diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22245baafecde..1a4cfa80101ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,35 +88,35 @@ The CDK uses [jsii](https://github.com/aws/jsii/) as its primary build system. j typescript-compliant source code and produce polyglot libraries, such as, in Java, .NET, Python and Go. The repo contains `packages/` directory that contains the CDK public modules. The source code for the IAM module in the -CDK can be found at the location `packages/@aws-cdk/aws-iam`. +CDK can be found at the location `packages/aws-cdk-lib/aws-iam`. The repo also contains the `tools/` directory that holds custom build tooling (modeled as private npm packages) specific to the CDK. ### Build -The full build of the CDK takes a long time to complete; 1-2 hours depending on the performance of the build machine. -However, most first time contributions will require changing only one CDK module, sometimes two. A full build of the -CDK is not required in these cases. - -If you want to work on the `@aws-cdk/aws-ec2` module, the following command will build just the EC2 module and any -necessary dependencies. +The full build of all of the packages within the repository can take a few minutes, about 20 when all tests are run. +Most contributions only require working on a single package, usually `aws-cdk-lib`. To build this package for the first +time, you can execute the following to build it and it's dependencies. ```console -$ cd packages/@aws-cdk/aws-ec2 +$ cd packages/aws-cdk-lib $ ../../../scripts/buildup ``` Note: The `buildup` command is resumable. If your build fails, you can fix the issue and run `buildup --resume` to resume. -At this point, you can run build and test the `aws-ec2` module by running +At this point, you can run build and test the `aws-cdk-lib` module by running ```console -$ cd packages/@aws-cdk/aws-ec2 +$ cd packages/aws-cdk-lib $ yarn build $ yarn test ``` +To cut down on iteration time as you develop, you can run `yarn watch` within the `aws-cdk-lib` directory to keep +some of the build state in memory and incrementally rebuild as you make changes. + However, if you wish to build the entire repository, the following command will achieve this. ```console @@ -137,12 +137,12 @@ Packing involves generating CDK code in the various target languages and packagi respective package managers. Once in a while, these will need to be generated either to test the experience of a new feature, or reproduce a packaging failure. -To package a specific module, say the `@aws-cdk/aws-ec2` module: +To package a specific module, say the `aws-cdk-lib` module: ```console $ cd $ docker run --rm --net=host -it -v $PWD:$PWD -w $PWD jsii/superchain:1-buster-slim -docker$ cd packages/@aws-cdk/aws-ec2 +docker$ cd packages/aws-cdk-lib docker$ ../../../scripts/foreach.sh --up yarn run package docker$ exit ``` @@ -317,12 +317,12 @@ CDK integration tests. We've added a watch feature to the CDK that builds your code as you type it. Start this by running `yarn watch` for each module that you are modifying. -For example, watch the EC2 and IAM modules in a second terminal session: +For example, watch the aws-cdk-lib and aws-cdk modules in a second terminal session: ```console -$ cd packages/@aws-cdk/aws-ec2 +$ cd packages/aws-cdk-lib $ yarn watch & # runs in the background -$ cd packages/@aws-cdk/aws-iam +$ cd packages/aws-cdk $ yarn watch & # runs in the background ``` @@ -637,10 +637,10 @@ The README file contains code snippets written as typescript code. Code snippets (such as `` ```ts ``) will be automatically extracted, compiled and translated to other languages when the during the [pack](#pack) step. We call this feature 'rosetta'. -You can run rosetta on the EC2 module (or any other module) by running: +You can run rosetta on the aws-cdk-lib module (or any other module) by running: ```console -$ cd packages/@aws-cdk/aws-ec2 +$ cd packages/aws-cdk-lib $ yarn rosetta:extract --strict ``` @@ -696,14 +696,14 @@ cases where some of those do not apply - good judgement is to be applied): - Types from the documented module should be **un-qualified**: ```ts - // An example in the @aws-cdk/core library, which defines Duration + // An example in the aws-cdk-lib library, which defines Duration Duration.minutes(15); ``` - Types from other modules should be **qualified**: ```ts - // An example in the @aws-cdk/core library, using something from @aws-cdk/aws-s3 + // An example in the aws-cdk-lib library, using something from aws-cdk-lib/aws-s3 const bucket = new s3.Bucket(this, 'Bucket'); // ...rest of the example... ``` @@ -712,7 +712,7 @@ cases where some of those do not apply - good judgement is to be applied): necessary for compilation but unimportant to the example: ```ts - // An example about adding a stage to a pipeline in the @aws-cdk/pipelines library + // An example about adding a stage to a pipeline in the aws-cdk-lib/pipelines library declare const pipeline: pipelines.CodePipeline; declare const myStage: Stage; pipeline.addStage(myStage); @@ -766,7 +766,7 @@ Consequently, there are two useful scripts that are built on top of `foreach.sh` All linters are executed automatically as part of the build script, `yarn build`. They can also be executed independently of the build script. From the root of a specific package (e.g. -`packages/@aws-cdk/aws-ec2`), run the following command to execute all the linters on that package - +`packages/aws-cdk-lib`), run the following command to execute all the linters on that package - ```bash yarn lint @@ -878,18 +878,6 @@ $ cdk -a some.app.js synth | $awscdk/scripts/template-deps-to-dot | dot -Tpng > You can use `find-cycles` to print a list of internal dependency cycles: -```shell -$ scripts/find-cycles.sh -Cycle: @aws-cdk/aws-iam => @aws-cdk/assert => aws-cdk => @aws-cdk/aws-s3 => @aws-cdk/aws-kms => @aws-cdk/aws-iam -Cycle: @aws-cdk/assert => aws-cdk => @aws-cdk/aws-s3 => @aws-cdk/aws-kms => @aws-cdk/assert -Cycle: @aws-cdk/aws-iam => @aws-cdk/assert => aws-cdk => @aws-cdk/aws-s3 => @aws-cdk/aws-iam -Cycle: @aws-cdk/assert => aws-cdk => @aws-cdk/aws-s3 => @aws-cdk/assert -Cycle: @aws-cdk/assert => aws-cdk => @aws-cdk/aws-cloudformation => @aws-cdk/assert -Cycle: @aws-cdk/aws-iam => @aws-cdk/assert => aws-cdk => @aws-cdk/util => @aws-cdk/aws-iam -Cycle: @aws-cdk/aws-sns => @aws-cdk/aws-lambda => @aws-cdk/aws-codecommit => @aws-cdk/aws-sns -Cycle: @aws-cdk/aws-sns => @aws-cdk/aws-lambda => @aws-cdk/aws-codecommit => @aws-cdk/aws-codepipeline => @aws-cdk/aws-sns -``` - ## Running CLI integration tests The CLI package (`packages/aws-cdk`) has some integration tests that aren't @@ -897,69 +885,17 @@ run as part of the regular build, since they have some particular requirements. See the [CLI CONTRIBUTING.md file](packages/aws-cdk/CONTRIBUTING.md) for more information on running those tests. -## Building aws-cdk-lib - -In AWS CDK v2, all stable libraries are packaged into a single monolithic -package and published as `aws-cdk-lib`. In most cases, you can iterate on a -single module's directory as previously described in this document (e.g. -`packages/@aws-cdk/aws-s3`). In some cases, you might need to build -`aws-cdk-lib`: - -``` -# Generate all of the L1s first. If you have already done a full build in the repository, you can skip this. -cd / -./scripts/gen.sh - -# Generate and build `aws-cdk-lib` -cd packages/aws-cdk-lib -yarn build -``` - -The commands above perform the following steps: -1. Run `yarn install` to install all dependencies -2. Generate `.generated.ts` files in each `packages/@aws-cdk/aws-` - directory. These files contain TypeScript source code for all of the L1 (Cfn) - Constructs, and are generated from the [CloudFormation Resource - Specification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html). -3. Copy the `.ts` source code files from each `packages/@aws-cdk/aws-` - directory to the corresponding `packages/aws-cdk-lib/aws-` - directory. -4. Compile `aws-cdk-lib`. - -Running unit tests and integration tests still has to be performed in each -module's `packages/@aws-cdk` directory. - ## Building and testing v2 -alpha packages -In AWS CDK v2, all experimental libraries are published separately with an --alpha suffix. In most cases, you can iterate on a single module's directory as -already described in this document (e.g. `packages/@aws-cdk/aws-amplify`). If -you need to generate and iterate on the alpha package, here are the steps. The -main differences between the alpha package is naming of the package, and import -statements. - -First, make sure the following packages are built: - - packages/@aws-cdk/assert - - packages/aws-cdk-lib - - tools/individual-pkg-gen - -The following command will create all of the alpha packages by copying files -from their source directories under `packages/@aws-cdk/aws-`, and it -will build and run unit tests for all of them. This is sometimes too much for a -developer machine or laptop. +Modules that are not stable are vended separately from `aws-cdk-lib`. These packages are found in the +`packages/@aws-cdk` directory and are marked `stability: 'experimental'` in their package.json files. +This means they will be given the `alpha` version from the `version.v2.json` when published and they +cannot be taken as dependencies by `aws-cdk-lib` -``` -/scripts/transform.sh -``` - -To only copy and transform the source files, and then build and test one -alpha package at a time, use the following: +Experimental packages are used to develop new constructs and experiment with their APIs before marking +them as stable and including them within `aws-cdk-lib`. Once they are included in `aws-cdk-lib`, no +more breaking api changes can be made. -``` -/scripts/transform.sh --skip-build -cd packages/individual-packages/aws- -yarn build+test -``` ## Changing Cloud Assembly Schema If you plan on making changes to the `cloud-assembly-schema` package, make sure you familiarize yourself with diff --git a/buildspec-pr.yaml b/buildspec-pr.yaml index 76729f89d86af..5c76464d6f402 100644 --- a/buildspec-pr.yaml +++ b/buildspec-pr.yaml @@ -25,7 +25,6 @@ phases: build: commands: - /bin/bash ./build.sh - - /bin/bash ./scripts/transform.sh # After compilation, run Rosetta (using the cache if available). # This will print errors, and fail the build if there are compilation errors in any packages marked as 'strict'. - /bin/bash ./scripts/run-rosetta.sh diff --git a/buildspec-remodel.yaml b/buildspec-remodel.yaml new file mode 100644 index 0000000000000..319aeb629c895 --- /dev/null +++ b/buildspec-remodel.yaml @@ -0,0 +1,41 @@ +version: 0.2 + +env: + secrets-manager: + TOKEN: $TOKEN_SECRET_ARN + variables: + NODE_OPTIONS: --max_old_space_size=8192 + +phases: + install: + commands: + # CodeBuild always runs as root, allow npm to operate as such + - npm config set unsafe-perm true + - mkdir ${HOME}/aws-cdk && cd ${HOME}/aws-cdk + # Configure git and git credentials + - git config --global user.email "${COMMIT_EMAIL}" + - git config --global user.name "${COMMIT_USERNAME}" + - echo "Retrieving gh token from secretsmanager" + - git clone https://$TOKEN@github.com/aws/aws-cdk -b feat/repo-restructure . + - git checkout ${CODEBUILD_RESOLVED_SOURCE_VERSION} + # Install yarn if it wasn't already present in the image + - yarn --version || npm -g install yarn + - yarn install --frozen-lockfile + - /sbin/sysctl -w vm.max_map_count=2251954 + build: + commands: + - cd ${HOME}/aws-cdk + - npx lerna run build --scope @aws-cdk/remodel --include-dependencies + - npx remodel ${PWD} --tmp-dir ${HOME}/remodel --no-clean --dry-run + post_build: + commands: + - cd ${HOME}/remodel + - git add -A + - git commit -m "Execute remodel" + - git remote add aws-cdk https://$TOKEN@github.com/aws/aws-cdk + - git fetch aws-cdk + - git push aws-cdk +feat/repo-restructure:feat/remodel +artifacts: + files: + - "**/*" + base-directory: ${HOME}/remodel diff --git a/buildspec.yaml b/buildspec.yaml index 2453686f5403d..9b012f729814d 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -27,7 +27,6 @@ phases: - 'if ${BUMP_CANDIDATE:-false}; then /bin/bash ./scripts/bump-candidate.sh; fi' - /bin/bash ./scripts/align-version.sh - /bin/bash ./build.sh - - /bin/bash ./scripts/transform.sh post_build: commands: # Short-circuit: Don't run pack if the above build failed. diff --git a/packages/@aws-cdk-testing/framework-integ/.eslintrc.js b/packages/@aws-cdk-testing/framework-integ/.eslintrc.js new file mode 100644 index 0000000000000..e79c8fad18e01 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/.eslintrc.js @@ -0,0 +1,13 @@ +const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/eslintrc'); +baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; +module.exports = { + ...baseConfig, + ignorePatterns: [ + ...baseConfig.ignorePatterns, + '**/*.snapshot/**/*' + ], + rules: { + ...baseConfig.rules, + 'import/order': 'off', + } +}; diff --git a/packages/@aws-cdk-testing/framework-integ/.gitignore b/packages/@aws-cdk-testing/framework-integ/.gitignore new file mode 100644 index 0000000000000..d51ed9d49b453 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/.gitignore @@ -0,0 +1,8 @@ + +.LAST_BUILD +*.snk +junit.xml +!.eslintrc.js +.nyc_output +coverage +nyc.config.js diff --git a/packages/@aws-cdk-testing/framework-integ/.npmignore b/packages/@aws-cdk-testing/framework-integ/.npmignore new file mode 100644 index 0000000000000..79f3b5a763216 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/.npmignore @@ -0,0 +1,7 @@ + +.LAST_BUILD +*.snk +junit.xml +.eslintrc.js +# exclude cdk artifacts +**/cdk.out \ No newline at end of file diff --git a/packages/@aws-cdk/alexa-ask/LICENSE b/packages/@aws-cdk-testing/framework-integ/LICENSE similarity index 100% rename from packages/@aws-cdk/alexa-ask/LICENSE rename to packages/@aws-cdk-testing/framework-integ/LICENSE diff --git a/packages/@aws-cdk-testing/framework-integ/NOTICE b/packages/@aws-cdk-testing/framework-integ/NOTICE new file mode 100644 index 0000000000000..0dd703eaedb4a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/NOTICE @@ -0,0 +1,16 @@ +AWS Cloud Development Kit (AWS CDK) +Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +Third party attributions of this package can be found in the THIRD_PARTY_LICENSES file diff --git a/packages/@aws-cdk-testing/framework-integ/package.json b/packages/@aws-cdk-testing/framework-integ/package.json new file mode 100644 index 0000000000000..babec6c4b10cb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/package.json @@ -0,0 +1,63 @@ +{ + "name": "@aws-cdk-testing/framework-integ", + "description": "Integration tests for aws-cdk-lib", + "private": true, + "version": "0.0.0", + "scripts": { + "build": "cdk-build", + "watch": "cdk-watch", + "lint": "cdk-lint", + "pkglint": "pkglint -f", + "test": "cdk-test", + "package": "cdk-package", + "build+test": "yarn build && yarn test", + "build+extract": "yarn build", + "build+test+package": "yarn build+test && yarn package", + "build+test+extract": "yarn build+test" + }, + "pkglint": { + "exclude": [ + "package-info/repository", + "dependencies/cdk-point-dependencies" + ] + }, + "author": { + "name": "Amazon Web Services", + "url": "https://aws.amazon.com", + "organization": true + }, + "license": "Apache-2.0", + "devDependencies": { + "@aws-cdk/cdk-build-tools": "0.0.0", + "delay": "5.0.0", + "@aws-cdk/pkglint": "0.0.0" + }, + "dependencies": { + "@aws-cdk/lambda-layer-kubectl-v24": "^2.0.100", + "aws-cdk-lib": "0.0.0", + "aws-sdk": "^2.1317.0", + "aws-sdk-mock": "5.6.0", + "cdk8s": "^2.7.15", + "cdk8s-plus-24": "2.4.40", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" + }, + "repository": { + "url": "https://github.com/aws/aws-cdk.git", + "type": "git", + "directory": "packages/@aws-cdk-testing/framework-integ" + }, + "keywords": [ + "aws", + "cdk" + ], + "homepage": "https://github.com/aws/aws-cdk", + "engines": { + "node": ">= 14.15.0" + }, + "stability": "experimental", + "maturity": "experimental", + "publishConfig": { + "tag": "latest" + } +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js new file mode 100644 index 0000000000000..7a6b831ce684f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cognito = require("aws-cdk-lib/aws-cognito"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +/* + * Stack verification steps: + * * 1. Get the IdToken for the created pool by adding user/app-client and using aws cognito-idp: + * * a. aws cognito-idp create-user-pool-client --user-pool-id --client-name --no-generate-secret + * * b. aws cognito-idp admin-create-user --user-pool-id --username --temporary-password + * * c. aws cognito-idp initiate-auth --client-id --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=,PASSWORD= + * * d. aws cognito-idp respond-to-auth-challenge --client-id --challenge-name --session + * * + * * 2. Verify the stack using above obtained token: + * * a. `curl -s -o /dev/null -w "%{http_code}" ` should return 401 + * * b. `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: ' ` should return 403 + * * c. `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: ' ` should return 200 + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'CognitoUserPoolsAuthorizerInteg'); +const userPool = new cognito.UserPool(stack, 'UserPool'); +const authorizer = new aws_apigateway_1.CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { + cognitoUserPools: [userPool], +}); +const restApi = new aws_apigateway_1.RestApi(stack, 'myrestapi', { cloudWatchRole: true }); +restApi.root.addMethod('ANY', new aws_apigateway_1.MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer, + authorizationType: aws_apigateway_1.AuthorizationType.COGNITO, +}); +new integ_tests_alpha_1.IntegTest(app, 'cognito-authorizer', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29nbml0by1hdXRob3JpemVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY29nbml0by1hdXRob3JpemVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbURBQW1EO0FBQ25ELDZDQUF5QztBQUN6QyxrRUFBdUQ7QUFDdkQsK0RBQTBJO0FBRTFJOzs7Ozs7Ozs7Ozs7R0FZRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsaUNBQWlDLENBQUMsQ0FBQztBQUVoRSxNQUFNLFFBQVEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLFVBQVUsQ0FBQyxDQUFDO0FBRXpELE1BQU0sVUFBVSxHQUFHLElBQUksMk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rocm91Z2hCZWhhdmlvci5ORVZFUixcbiAgcmVxdWVzdFRlbXBsYXRlczoge1xuICAgICdhcHBsaWNhdGlvbi9qc29uJzogJ3sgXCJzdGF0dXNDb2RlXCI6IDIwMCB9JyxcbiAgfSxcbn0pLCB7XG4gIG1ldGhvZFJlc3BvbnNlczogW1xuICAgIHsgc3RhdHVzQ29kZTogJzIwMCcgfSxcbiAgXSxcbiAgYXV0aG9yaXplcixcbiAgYXV0aG9yaXphdGlvblR5cGU6IEF1dGhvcml6YXRpb25UeXBlLkNPR05JVE8sXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdjb2duaXRvLWF1dGhvcml6ZXInLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/CognitoUserPoolsAuthorizerInteg.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/cognitoauthorizerDefaultTestDeployAssert4551574C.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts similarity index 88% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts index 9bd863efa736b..8ff6642fbf2ac 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.cognito-authorizer.ts @@ -1,7 +1,7 @@ -import * as cognito from '@aws-cdk/aws-cognito'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AuthorizationType, CognitoUserPoolsAuthorizer, MockIntegration, PassthroughBehavior, RestApi } from '../../lib'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AuthorizationType, CognitoUserPoolsAuthorizer, MockIntegration, PassthroughBehavior, RestApi } from 'aws-cdk-lib/aws-apigateway'; /* * Stack verification steps: diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.d.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.js similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.js diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js new file mode 100644 index 0000000000000..bcb56b4f44e00 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +// Against the RestApi endpoint from the stack output, run +// `curl -s -o /dev/null -w "%{http_code}" ` should return 401 +// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' ?allow=yes` should return 403 +// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' ?allow=yes` should return 200 +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'RequestAuthorizerInteg'); +const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')), +}); +const restapi = new aws_apigateway_1.RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); +const authorizer = new aws_apigateway_1.RequestAuthorizer(stack, 'MyAuthorizer', { + handler: authorizerFn, + identitySources: [aws_apigateway_1.IdentitySource.header('Authorization'), aws_apigateway_1.IdentitySource.queryString('allow')], +}); +const secondAuthorizer = new aws_apigateway_1.RequestAuthorizer(stack, 'MySecondAuthorizer', { + handler: authorizerFn, + identitySources: [aws_apigateway_1.IdentitySource.header('Authorization'), aws_apigateway_1.IdentitySource.queryString('allow')], +}); +restapi.root.addMethod('ANY', new aws_apigateway_1.MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer, +}); +restapi.root.resourceForPath('auth').addMethod('ANY', new aws_apigateway_1.MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer: secondAuthorizer, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVxdWVzdC1hdXRob3JpemVyLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJlcXVlc3QtYXV0aG9yaXplci5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsaURBQWlEO0FBQ2pELDZDQUF5QztBQUN6QywrREFBOEg7QUFFOUgsMERBQTBEO0FBQzFELG1FQUFtRTtBQUNuRSxzR0FBc0c7QUFDdEcsdUdBQXVHO0FBRXZHLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVB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ludGVncmF0aW9uKHtcbiAgaW50ZWdyYXRpb25SZXNwb25zZXM6IFtcbiAgICB7IHN0YXR1c0NvZGU6ICcyMDAnIH0sXG4gIF0sXG4gIHBhc3N0aHJvdWdoQmVoYXZpb3I6IFBhc3N0aHJvdWdoQmVoYXZpb3IuTkVWRVIsXG4gIHJlcXVlc3RUZW1wbGF0ZXM6IHtcbiAgICAnYXBwbGljYXRpb24vanNvbic6ICd7IFwic3RhdHVzQ29kZVwiOiAyMDAgfScsXG4gIH0sXG59KSwge1xuICBtZXRob2RSZXNwb25zZXM6IFtcbiAgICB7IHN0YXR1c0NvZGU6ICcyMDAnIH0sXG4gIF0sXG4gIGF1dGhvcml6ZXI6IHNlY29uZEF1dGhvcml6ZXIsXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/asset.3dc8c5549b88fef617feef923524902b3650973ae1159c9489ee8405344dd5a0.handler/index.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts new file mode 100644 index 0000000000000..3bf407ca48dfe --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts @@ -0,0 +1,60 @@ +import * as path from 'path'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; +import { MockIntegration, PassthroughBehavior, RestApi, RequestAuthorizer, IdentitySource } from 'aws-cdk-lib/aws-apigateway'; + +// Against the RestApi endpoint from the stack output, run +// `curl -s -o /dev/null -w "%{http_code}" ` should return 401 +// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' ?allow=yes` should return 403 +// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' ?allow=yes` should return 200 + +const app = new App(); +const stack = new Stack(app, 'RequestAuthorizerInteg'); + +const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')), +}); + +const restapi = new RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); + +const authorizer = new RequestAuthorizer(stack, 'MyAuthorizer', { + handler: authorizerFn, + identitySources: [IdentitySource.header('Authorization'), IdentitySource.queryString('allow')], +}); + +const secondAuthorizer = new RequestAuthorizer(stack, 'MySecondAuthorizer', { + handler: authorizerFn, + identitySources: [IdentitySource.header('Authorization'), IdentitySource.queryString('allow')], +}); + +restapi.root.addMethod('ANY', new MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer, +}); + +restapi.root.resourceForPath('auth').addMethod('ANY', new MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer: secondAuthorizer, +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js new file mode 100644 index 0000000000000..2eb65ec9a4a58 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +/* + * Stack verification steps: + * * `curl -s -o /dev/null -w "%{http_code}" ` should return 401 + * * `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' ` should return 403 + * * `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' ` should return 200 + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'TokenAuthorizerIAMRoleInteg'); +const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')), +}); +const role = new iam.Role(stack, 'authorizerRole', { + assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), +}); +const authorizer = new aws_apigateway_1.TokenAuthorizer(stack, 'MyAuthorizer', { + handler: authorizerFn, + assumeRole: role, +}); +const restapi = new aws_apigateway_1.RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); +restapi.root.addMethod('ANY', new aws_apigateway_1.MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer, + authorizationType: aws_apigateway_1.AuthorizationType.CUSTOM, +}); +new integ_tests_alpha_1.IntegTest(app, 'iam-token-authorizer', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudG9rZW4tYXV0aG9yaXplci1pYW0tcm9sZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnRva2VuLWF1dGhvcml6ZXItaWFtLXJvbG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20nKSxcbn0pO1xuXG5jb25zdCBhdXRob3JpemVyID0gbmV3IFRva2VuQXV0aG9yaXplcihzdGFjaywgJ015QXV0aG9yaXplcicsIHtcbiAgaGFuZGxlcjogYXV0aG9yaXplckZuLFxuICBhc3N1bWVSb2xlOiByb2xlLFxufSk7XG5cbmNvbnN0IHJlc3RhcGkgPSBuZXcgUmVzdEFwaShzdGFjaywgJ015UmVzdEFwaScsIHsgY2xvdWRXYXRjaFJvbGU6IHRydWUgfSk7XG5cbnJlc3RhcGkucm9vdC5hZGRNZXRob2QoJ0FOWScsIG5ldyBNb2NrSW50ZWdyYXRpb24oe1xuICBpbnRlZ3JhdGlvblJlc3BvbnNlczogW1xuICAgIHsgc3RhdHVzQ29kZTogJzIwMCcgfSxcbiAgXSxcbiAgcGFzc3Rocm91Z2hCZWhhdmlvcjogUGFzc3Rocm91Z2hCZWhhdmlvci5ORVZFUixcbiAgcmVxdWVzdFRlbXBsYXRlczoge1xuICAgICdhcHBsaWNhdGlvbi9qc29uJzogJ3sgXCJzdGF0dXNDb2RlXCI6IDIwMCB9JyxcbiAgfSxcbn0pLCB7XG4gIG1ldGhvZFJlc3BvbnNlczogW1xuICAgIHsgc3RhdHVzQ29kZTogJzIwMCcgfSxcbiAgXSxcbiAgYXV0aG9yaXplcixcbiAgYXV0aG9yaXphdGlvblR5cGU6IEF1dGhvcml6YXRpb25UeXBlLkNVU1RPTSxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2lhbS10b2tlbi1hdXRob3JpemVyJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/iamtokenauthorizerDefaultTestDeployAssert87D47FBB.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts similarity index 85% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts index 5ec9733a7ada5..129dab750e2cd 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AuthorizationType, MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer } from '../../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AuthorizationType, MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer } from 'aws-cdk-lib/aws-apigateway'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.d.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.js similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.js diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js new file mode 100644 index 0000000000000..397f18b288c20 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js @@ -0,0 +1,120 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'TokenAuthorizerInteg'); +const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')), +}); +const authorizer = new aws_apigateway_1.TokenAuthorizer(stack, 'MyAuthorizer', { + handler: authorizerFn, +}); +const restapi = new aws_apigateway_1.RestApi(stack, 'MyRestApi', { + cloudWatchRole: true, + defaultMethodOptions: { + authorizer, + }, + defaultCorsPreflightOptions: { + allowOrigins: aws_apigateway_1.Cors.ALL_ORIGINS, + }, +}); +restapi.root.addMethod('ANY', new aws_apigateway_1.MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'apigw-token-auth', { + testCases: [stack], +}); +const hostName = `${restapi.restApiId}.execute-api.${stack.region}.${stack.urlSuffix}`; +const testFunc = new lambda.Function(stack, 'InvokeFunction', { + memorySize: 250, + timeout: aws_cdk_lib_1.Duration.seconds(10), + code: lambda.Code.fromInline(` +const https = require('https'); +const options = { + hostname: '${hostName}', + path: '/${restapi.deploymentStage.stageName}', +}; +exports.handler = async function(event) { + console.log(event); + options.method = event.method; + if ('authorization' in event) { + options.headers = { + Authorization: event.authorization, + }; + } + let dataString = ''; + const response = await new Promise((resolve, reject) => { + const req = https.request(options, (res) => { + res.on('data', data => { + dataString += data; + }) + res.on('end', () => { + resolve({ + statusCode: res.statusCode, + body: dataString, + }); + }) + }); + req.on('error', err => { + reject({ + statusCode: 500, + body: JSON.stringify({ + cause: 'Something went wrong', + error: err, + }) + }); + }); + req.end(); + }); + return response; +} +`), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_16_X, +}); +const invokeGet = integ.assertions.invokeFunction({ + functionName: testFunc.functionName, + payload: JSON.stringify({ + method: 'GET', + authorization: 'allow', + }), +}); +invokeGet.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('200'), +})); +const invokeGetDeny = integ.assertions.invokeFunction({ + functionName: testFunc.functionName, + payload: JSON.stringify({ + method: 'GET', + authorization: 'deny', + }), +}); +invokeGetDeny.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('User is not authorized to access this resource with an explicit deny'), +})); +const invokeOptions = integ.assertions.invokeFunction({ + functionName: testFunc.functionName, + payload: JSON.stringify({ + method: 'OPTIONS', + }), +}); +invokeOptions.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('204'), +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudG9rZW4tYXV0aG9yaXplci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnRva2VuLWF1dGhvcml6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsaURBQWlEO0FBQ2pELDZDQUFtRDtBQUNuRCxrRUFBOEU7QUFDOUUsK0RBQWtIO0FBRWxILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztBQUVyRCxNQUFNLFlBQVksR0FBRyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLHNCQUFzQixFQUFFO0lBQ3RFLE9BQU8sRUFBRSxNQUFNLENBQUMsT0FBTyxDQUFDLFdBQVc7SUFDbkMsT0FBTyxFQUFFLGVBQWU7SUFDeEIsSUFBSSxFQUFFLE1BQU0sQ0FBQyxTQUFTLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLGdDQUFnQyxDQUFDLENBQUM7Q0FDekYsQ0FBQyxDQUFDO0FBRUgsTUFBTSxVQUFVLEdBQUcsSUFBSSxnQ0FBZSxDQUFDLEtBQUssRUFBRSxjQUFjLEVBQUU7SUFDNUQsT0FBTyxFQUFFLFlBQVk7Q0FDdEIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxPQUFPLEdBQUcsSUFBSSx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bnZva2VHZXREZW55ID0gaW50ZWcuYXNzZXJ0aW9ucy5pbnZva2VGdW5jdGlvbih7XG4gIGZ1bmN0aW9uTmFtZTogdGVzdEZ1bmMuZnVuY3Rpb25OYW1lLFxuICBwYXlsb2FkOiBKU09OLnN0cmluZ2lmeSh7XG4gICAgbWV0aG9kOiAnR0VUJyxcbiAgICBhdXRob3JpemF0aW9uOiAnZGVueScsXG4gIH0pLFxufSk7XG5pbnZva2VHZXREZW55LmV4cGVjdChFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgUGF5bG9hZDogTWF0Y2guc3RyaW5nTGlrZVJlZ2V4cCgnVXNlciBpcyBub3QgYXV0aG9yaXplZCB0byBhY2Nlc3MgdGhpcyByZXNvdXJjZSB3aXRoIGFuIGV4cGxpY2l0IGRlbnknKSxcbn0pKTtcblxuY29uc3QgaW52b2tlT3B0aW9ucyA9IGludGVnLmFzc2VydGlvbnMuaW52b2tlRnVuY3Rpb24oe1xuICBmdW5jdGlvbk5hbWU6IHRlc3RGdW5jLmZ1bmN0aW9uTmFtZSxcbiAgcGF5bG9hZDogSlNPTi5zdHJpbmdpZnkoe1xuICAgIG1ldGhvZDogJ09QVElPTlMnLFxuICB9KSxcbn0pO1xuaW52b2tlT3B0aW9ucy5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIFBheWxvYWQ6IE1hdGNoLnN0cmluZ0xpa2VSZWdleHAoJzIwNCcpLFxufSkpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.ts similarity index 95% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.ts index 19bed2089617e..1a57e6f32ffca 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack, Duration } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests'; -import { MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer, Cors } from '../../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack, Duration } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests-alpha'; +import { MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer, Cors } from 'aws-cdk-lib/aws-apigateway'; const app = new App(); const stack = new Stack(app, 'TokenAuthorizerInteg'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js new file mode 100644 index 0000000000000..d2a29eeff2e6c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +/* + * Stack verification steps: + * * `curl -s -o /dev/null -w "%{http_code}" ` should return HTTP code 200 + * * `curl -s -o /dev/null -w "%{http_code}" ` should return HTTP code 200 + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integtest-restapi-fromdefinition-asset'); +const api = new apigateway.SpecRestApi(stack, 'my-api', { + cloudWatchRole: true, + apiDefinition: apigateway.ApiDefinition.fromAsset(path.join(__dirname, 'sample-definition.yaml')), +}); +api.root.addResource('books').addMethod('GET', new apigateway.MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: apigateway.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [{ statusCode: '200' }], +}); +new cdk.CfnOutput(stack, 'PetsURL', { + value: api.urlForPath('/pets'), +}); +new cdk.CfnOutput(stack, 'BooksURL', { + value: api.urlForPath('/books'), +}); +new integ_tests_alpha_1.IntegTest(app, 'restapi-fromdefinition', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBpLWRlZmluaXRpb24uYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hcGktZGVmaW5pdGlvbi5hc3NldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELHlEQUF5RDtBQUV6RDs7OztHQUlHO0FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx3Q0FBd0MsQ0FBQyxDQUFDO0FBRTNFLE1BQU0sR0FBRyxHQUFHLElBQUksVUFBVSxDQUFDLFdBQVcsQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ3RELGNBQWMsRUFBRSxJQUFJO0lBQ3BCLGFBQWEsRUFBRSxVQUFVLENBQUMsYUFBYSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFN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5LlBhc3N0aHJvdWdoQmVoYXZpb3IuTkVWRVIsXG4gIHJlcXVlc3RUZW1wbGF0ZXM6IHtcbiAgICAnYXBwbGljYXRpb24vanNvbic6ICd7IFwic3RhdHVzQ29kZVwiOiAyMDAgfScsXG4gIH0sXG59KSwge1xuICBtZXRob2RSZXNwb25zZXM6IFt7IHN0YXR1c0NvZGU6ICcyMDAnIH1dLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnUGV0c1VSTCcsIHtcbiAgdmFsdWU6IGFwaS51cmxGb3JQYXRoKCcvcGV0cycpLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnQm9va3NVUkwnLCB7XG4gIHZhbHVlOiBhcGkudXJsRm9yUGF0aCgnL2Jvb2tzJyksXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdyZXN0YXBpLWZyb21kZWZpbml0aW9uJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/integtest-restapi-fromdefinition-asset.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/restapifromdefinitionDefaultTestDeployAssertDF3B0845.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.ts similarity index 88% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.ts index 272951a7b4602..86992ffc5249a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.asset.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js new file mode 100644 index 0000000000000..720ec61c3e085 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +/* + * Stack verification steps: + * * `curl -i ` should return HTTP code 200 + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integtest-restapi-fromdefinition-inline'); +const api = new apigateway.SpecRestApi(stack, 'my-api', { + cloudWatchRole: true, + apiDefinition: apigateway.ApiDefinition.fromInline({ + openapi: '3.0.2', + info: { + version: '1.0.0', + title: 'Test API for CDK', + }, + paths: { + '/pets': { + get: { + 'summary': 'Test Method', + 'operationId': 'testMethod', + 'responses': { + 200: { + description: 'A paged array of pets', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/Empty', + }, + }, + }, + }, + }, + 'x-amazon-apigateway-integration': { + responses: { + default: { + statusCode: '200', + }, + }, + requestTemplates: { + 'application/json': '{"statusCode": 200}', + }, + passthroughBehavior: 'when_no_match', + type: 'mock', + }, + }, + }, + }, + components: { + schemas: { + Empty: { + title: 'Empty Schema', + type: 'object', + }, + }, + }, + }), +}); +new cdk.CfnOutput(stack, 'PetsURL', { + value: api.urlForPath('/pets'), +}); +new integ_tests_alpha_1.IntegTest(app, 'inline-api-definition', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBpLWRlZmluaXRpb24uaW5saW5lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXBpLWRlZmluaXRpb24uaW5saW5lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCx5REFBeUQ7QUFFekQ7OztHQUdHO0FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx5Q0FBeUMsQ0FBQyxDQUFDO0FBRTVFLE1BQU0sR0FBRyxHQUFHLElBQUksVUFBVSxDQUFDLFdBQVcsQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ3RELGNBQWMsRUFBRSxJQUFJ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XG4gICAgICAnL3BldHMnOiB7XG4gICAgICAgIGdldDoge1xuICAgICAgICAgICdzdW1tYXJ5JzogJ1Rlc3QgTWV0aG9kJyxcbiAgICAgICAgICAnb3BlcmF0aW9uSWQnOiAndGVzdE1ldGhvZCcsXG4gICAgICAgICAgJ3Jlc3BvbnNlcyc6IHtcbiAgICAgICAgICAgIDIwMDoge1xuICAgICAgICAgICAgICBkZXNjcmlwdGlvbjogJ0EgcGFnZWQgYXJyYXkgb2YgcGV0cycsXG4gICAgICAgICAgICAgIGNvbnRlbnQ6IHtcbiAgICAgICAgICAgICAgICAnYXBwbGljYXRpb24vanNvbic6IHtcbiAgICAgICAgICAgICAgICAgIHNjaGVtYToge1xuICAgICAgICAgICAgICAgICAgICAkcmVmOiAnIy9jb21wb25lbnRzL3NjaGVtYXMvRW1wdHknLFxuICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9LFxuICAgICAgICAgICd4LWFtYXpvbi1hcGlnYXRld2F5LWludGVncmF0aW9uJzoge1xuICAgICAgICAgICAgcmVzcG9uc2VzOiB7XG4gICAgICAgICAgICAgIGRlZmF1bHQ6IHtcbiAgICAgICAgICAgICAgICBzdGF0dXNDb2RlOiAnMjAwJyxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICByZXF1ZXN0VGVtcGxhdGVzOiB7XG4gICAgICAgICAgICAgICdhcHBsaWNhdGlvbi9qc29uJzogJ3tcInN0YXR1c0NvZGVcIjogMjAwfScsXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcGFzc3Rocm91Z2hCZWhhdmlvcjogJ3doZW5fbm9fbWF0Y2gnLFxuICAgICAgICAgICAgdHlwZTogJ21vY2snLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgIH0sXG4gICAgY29tcG9uZW50czoge1xuICAgICAgc2NoZW1hczoge1xuICAgICAgICBFbXB0eToge1xuICAgICAgICAgIHRpdGxlOiAnRW1wdHkgU2NoZW1hJyxcbiAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgfSxcbiAgfSksXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdQZXRzVVJMJywge1xuICB2YWx1ZTogYXBpLnVybEZvclBhdGgoJy9wZXRzJyksXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdpbmxpbmUtYXBpLWRlZmluaXRpb24nLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/inlineapidefinitionDefaultTestDeployAssert923CAC29.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/integtest-restapi-fromdefinition-inline.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.ts similarity index 91% rename from packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.ts index 5c0843293744e..f1d72be8ea038 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.api-definition.inline.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.d.ts new file mode 100644 index 0000000000000..921aedfe13e58 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.d.ts @@ -0,0 +1,4 @@ +import * as cdk from 'aws-cdk-lib'; +export declare class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js new file mode 100644 index 0000000000000..d9c3158efe11d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestStack = void 0; +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const restApi = new apigateway.RestApi(this, 'Api'); + restApi.root.addMethod('GET'); + const domainName = apigateway.DomainName.fromDomainNameAttributes(this, 'Domain', { + domainName: 'domainName', + domainNameAliasHostedZoneId: 'domainNameAliasHostedZoneId', + domainNameAliasTarget: 'domainNameAliasTarget', + }); + new apigateway.BasePathMapping(this, 'MappingOne', { + domainName, + restApi, + }); + new apigateway.BasePathMapping(this, 'MappingTwo', { + domainName, + restApi, + basePath: 'path', + attachToStage: false, + }); + new apigateway.BasePathMapping(this, 'MappingThree', { + domainName, + restApi, + basePath: 'api/v1/multi-level-path', + attachToStage: false, + }); + } +} +exports.TestStack = TestStack; +const app = new cdk.App(); +const testStack = new TestStack(app, 'test-stack'); +new integ_tests_alpha_1.IntegTest(app, 'base-path-mapping', { + testCases: [testStack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYmFzZS1wYXRoLW1hcHBpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5iYXNlLXBhdGgtbWFwcGluZy50cyJdLCJuYW1lcy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JyxcbiAgICAgIGRvbWFpbk5hbWVBbGlhc1RhcmdldDogJ2RvbWFpbk5hbWVBbGlhc1RhcmdldCcsXG4gICAgfSk7XG5cbiAgICBuZXcgYXBpZ2F0ZXdheS5CYXNlUGF0aE1hcHBpbmcodGhpcywgJ01hcHBpbmdPbmUnLCB7XG4gICAgICBkb21haW5OYW1lLFxuICAgICAgcmVzdEFwaSxcbiAgICB9KTtcblxuICAgIG5ldyBhcGlnYXRld2F5LkJhc2VQYXRoTWFwcGluZyh0aGlzLCAnTWFwcGluZ1R3bycsIHtcbiAgICAgIGRvbWFpbk5hbWUsXG4gICAgICByZXN0QXBpLFxuICAgICAgYmFzZVBhdGg6ICdwYXRoJyxcbiAgICAgIGF0dGFjaFRvU3RhZ2U6IGZhbHNlLFxuICAgIH0pO1xuXG4gICAgbmV3IGFwaWdhdGV3YXkuQmFzZVBhdGhNYXBwaW5nKHRoaXMsICdNYXBwaW5nVGhyZWUnLCB7XG4gICAgICBkb21haW5OYW1lLFxuICAgICAgcmVzdEFwaSxcbiAgICAgIGJhc2VQYXRoOiAnYXBpL3YxL211bHRpLWxldmVsLXBhdGgnLFxuICAgICAgYXR0YWNoVG9TdGFnZTogZmFsc2UsXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxuY29uc3QgdGVzdFN0YWNrID0gbmV3IFRlc3RTdGFjayhhcHAsICd0ZXN0LXN0YWNrJyk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnYmFzZS1wYXRoLW1hcHBpbmcnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RTdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/basepathmappingDefaultTestDeployAssertDA82B6F0.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/test-stack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.ts similarity index 87% rename from packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.ts index f25b572545f49..ec8b557159781 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.base-path-mapping.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.base-path-mapping.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; export class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.d.ts new file mode 100644 index 0000000000000..ff2c8a3bc89fe --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.d.ts @@ -0,0 +1,4 @@ +import * as cdk from 'aws-cdk-lib'; +export declare class Test extends cdk.Stack { + constructor(scope: cdk.App, id: string); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js new file mode 100644 index 0000000000000..bda660af8f83b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Test = void 0; +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class Test extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const api = new apigateway.RestApi(this, 'my-api', { + retainDeployments: true, + }); + api.root.addMethod('GET'); // must have at least one method or an API definition + } +} +exports.Test = Test; +const app = new cdk.App(); +new integ_tests_alpha_1.IntegTest(app, 'cloudwatch-logs-disabled', { + testCases: [ + new Test(app, 'default-api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0ICogYXMgYXBpZ2F0ZXdheSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtYXBpZ2F0ZXdheSc7XG5cbmV4cG9ydCBjbGFzcyBUZXN0IGV4dGVuZHMgY2RrLlN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IGNkay5BcHAsIGlkOiBzdHJpbmcpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuICAgIGNvbnN0IGFwaSA9IG5ldyBhcGlnYXRld2F5LlJlc3RBcGkodGhpcywgJ215LWFwaScsIHtcbiAgICAgIHJldGFpbkRlcGxveW1lbnRzOiB0cnVlLFxuICAgIH0pO1xuICAgIGFwaS5yb290LmFkZE1ldGhvZCgnR0VUJyk7IC8vIG11c3QgaGF2ZSBhdCBsZWFzdCBvbmUgbWV0aG9kIG9yIGFuIEFQSSBkZWZpbml0aW9uXG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2xvdWR3YXRjaC1sb2dzLWRpc2FibGVkJywge1xuICB0ZXN0Q2FzZXM6IFtcbiAgICBuZXcgVGVzdChhcHAsICdkZWZhdWx0LWFwaScpLFxuICBdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/cloudwatchlogsdisabledDefaultTestDeployAssert6C87D47C.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/default-api.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.ts new file mode 100644 index 0000000000000..a4d9d990a11d9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cloudwatch-disabled.ts @@ -0,0 +1,20 @@ +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; + +export class Test extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + const api = new apigateway.RestApi(this, 'my-api', { + retainDeployments: true, + }); + api.root.addMethod('GET'); // must have at least one method or an API definition + } +} + +const app = new cdk.App(); +new IntegTest(app, 'cloudwatch-logs-disabled', { + testCases: [ + new Test(app, 'default-api'), + ], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.handler/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.handler/index.d.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.handler/index.js similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.handler/index.js diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.handler/index.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js new file mode 100644 index 0000000000000..82fca8a53979c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigw = require("aws-cdk-lib/aws-apigateway"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const api = new apigw.RestApi(this, 'cors-api-test', { + cloudWatchRole: true, + }); + const handler = new lambda.Function(this, 'handler', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'integ.cors.handler')), + }); + const twitch = api.root.addResource('twitch'); + const backend = new apigw.LambdaIntegration(handler); + twitch.addMethod('GET', backend); // GET /twitch + twitch.addMethod('POST', backend); // POST /twitch + twitch.addMethod('DELETE', backend); // DELETE /twitch + twitch.addCorsPreflight({ allowOrigins: ['https://google.com', 'https://www.test-cors.org'] }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'cors-twitch-test'); +new integ_tests_alpha_1.IntegTest(app, 'cors', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29ycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBN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aC10ZXN0Jyk7XG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2NvcnMnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/asset.c7bba0d9d477c86c6dc2adb0eb95842634a1c040dd3a66b42eec2bb604644d4f.handler/index.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/cors-twitch-test.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/corsDefaultTestDeployAssert5CF8F851.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.ts similarity index 83% rename from packages/@aws-cdk/aws-apigateway/test/integ.cors.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.ts index 5d83efbc1f3c4..6c10e15d062bf 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.cors.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.cors.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as apigw from '../lib'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js new file mode 100644 index 0000000000000..8760458e80ac2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js @@ -0,0 +1,249 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_certificatemanager_1 = require("aws-cdk-lib/aws-certificatemanager"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const constructs_1 = require("constructs"); +const apigw = require("aws-cdk-lib/aws-apigateway"); +const domainName = process.env.CDK_INTEG_DOMAIN_NAME || process.env.DOMAIN_NAME; +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID || process.env.HOSTED_ZONE_ID; +const certArn = process.env.CDK_INTEG_CERT_ARN || process.env.CERT_ARN; +if (!domainName || !certArn || !hostedZoneId) { + throw new Error('Env vars DOMAIN_NAME, HOSTED_ZONE_ID, and CERT_ARN must be set'); +} +/** + * ------------------------------------------------------- + * ------------------------- GIVEN------------------------ + * ------------------------------------------------------- + */ +const app = new cdk.App(); +const testCase = new cdk.Stack(app, 'integ-apigw-domain-name-mapping'); +class Api extends constructs_1.Construct { + constructor(scope, id, props) { + super(scope, id); + this.restApi = new apigw.RestApi(this, 'IntegApi' + props.statusCode, { + endpointTypes: [apigw.EndpointType.REGIONAL], + }); + this.resource = this.restApi.root.addResource(props.path); + const integration = this.createIntegration(props.statusCode); + const options = { + methodResponses: [{ + statusCode: props.statusCode, + }], + }; + this.restApi.root.addMethod('GET', integration, options); + this.resource.addMethod('GET', integration, options); + } + addResource(path, statusCode, resource) { + const subResource = (resource ?? this.resource).addResource(path); + const integration = this.createIntegration(statusCode); + subResource.addMethod('GET', integration, { + methodResponses: [{ statusCode }], + }); + } + addRootResource(path, statusCode) { + const subResource = this.restApi.root.addResource(path); + const integration = this.createIntegration(statusCode); + subResource.addMethod('GET', integration, { + methodResponses: [{ statusCode }], + }); + return subResource; + } + createIntegration(statusCode) { + return new apigw.MockIntegration({ + requestTemplates: { 'application/json': `{ statusCode: ${Number(statusCode)} }` }, + integrationResponses: [{ + statusCode: statusCode, + responseTemplates: { + 'application/json': JSON.stringify({ message: 'Hello, world' }), + }, + }], + }); + } +} +/** + * ------------------------------------------------------- + * ------------------------- WHEN ------------------------ + * ------------------------------------------------------- + */ +const certificate = aws_certificatemanager_1.Certificate.fromCertificateArn(testCase, 'Cert', certArn); +const api1 = new Api(testCase, 'IntegApi1', { + statusCode: '201', + path: 'items', +}); +const api2 = new Api(testCase, 'IntegApi2', { + statusCode: '202', + path: 'items', +}); +/** + * Test 1 + * + * Create an initial BasePathMapping for (none) + * Then use a mixture of `addBasePathMapping` and `addApiMapping` + * to test that they can be used together + */ +const domain = new apigw.DomainName(testCase, 'IntegDomain', { + domainName, + securityPolicy: apigw.SecurityPolicy.TLS_1_2, + certificate, + mapping: api1.restApi, +}); +new aws_route53_1.CfnRecordSet(testCase, 'IntegDomainRecord', { + name: domainName, + type: 'A', + hostedZoneId, + aliasTarget: { + hostedZoneId: domain.domainNameAliasHostedZoneId, + dnsName: domain.domainNameAliasDomainName, + }, +}); +domain.addBasePathMapping(api1.restApi, { + basePath: 'orders', +}); +domain.addApiMapping(api2.restApi.deploymentStage, { + basePath: 'orders/v2', +}); +domain.addApiMapping(api1.restApi.deploymentStage, { + basePath: 'orders/v1', +}); +/** + * Test 2 + * + * Create an initial BasePathMapping for 'orders' + * and then add an ApiMapping for a multi-level path + */ +const secondDomain = new apigw.DomainName(testCase, 'Integ2Domain', { + domainName: `another-${domainName}`, + securityPolicy: apigw.SecurityPolicy.TLS_1_2, + certificate, + mapping: api1.restApi, + basePath: 'orders', +}); +new aws_route53_1.CfnRecordSet(testCase, 'Integ2DomainRecord', { + name: `another-${domainName}`, + type: 'A', + hostedZoneId, + aliasTarget: { + hostedZoneId: secondDomain.domainNameAliasHostedZoneId, + dnsName: secondDomain.domainNameAliasDomainName, + }, +}); +secondDomain.addApiMapping(api2.restApi.deploymentStage, { + basePath: 'orders/v2', +}); +/** + * Test 3 + * + * Test that you can create an initial BasePathMapping (none) + * and then add additional base path mappings + */ +const thirdDomain = new apigw.DomainName(testCase, 'Integ3Domain', { + domainName: `yet-another-${domainName}`, + securityPolicy: apigw.SecurityPolicy.TLS_1_2, + certificate, + mapping: api1.restApi, +}); +new aws_route53_1.CfnRecordSet(testCase, 'Integ3DomainRecord', { + name: `yet-another-${domainName}`, + type: 'A', + hostedZoneId, + aliasTarget: { + hostedZoneId: thirdDomain.domainNameAliasHostedZoneId, + dnsName: thirdDomain.domainNameAliasDomainName, + }, +}); +thirdDomain.addBasePathMapping(api2.restApi, { + basePath: 'v2', +}); +/** + * ------------------------------------------------------- + * ------------------------- THEN ------------------------ + * ------------------------------------------------------- + */ +const integ = new integ_tests_alpha_1.IntegTest(app, 'domain-name-mapping-test', { + testCases: [testCase], + enableLookups: true, +}); +const invoke = new aws_lambda_1.Function(testCase, 'InvokeApi', { + code: aws_lambda_1.Code.fromInline(` +const https = require('https'); +exports.handler = async function(event) { + console.log(event); + const options = { + hostname: event.hostname, + path: event.path, + }; + let dataString = ''; + const response = await new Promise((resolve, reject) => { + const req = https.get(options, (res) => { + res.on('data', data => { + dataString += data; + }) + res.on('end', () => { + resolve({ + statusCode: res.statusCode, + body: dataString, + }); + }) + }); + req.on('error', err => { + reject({ + statusCode: 500, + body: JSON.stringify({ + cause: 'Something went wrong', + error: err, + }) + }); + }); + req.end(); + }); + return response; +} + +`), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.NODEJS_16_X, +}); +const api1Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: domain.domainName, + path: '/orders/v1/items', + }), +}); +api1Invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('201'), +})); +const api2Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: domain.domainName, + path: '/orders/v2/items', + }), +}); +api2Invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('202'), +})); +const domain2api1Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: secondDomain.domainName, + path: '/orders/items', + }), +}); +domain2api1Invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('201'), +})); +const domain2api2Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: secondDomain.domainName, + path: '/orders/v2/items', + }), +}); +domain2api2Invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.stringLikeRegexp('202'), +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZG9tYWluLW5hbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kb21haW4tbmFtZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtFQUFpRTtBQUNqRSx1REFBaUU7QUFDakUseURBQXVEO0FBQ3ZELG1DQUFtQztBQUNuQyxrRUFJb0M7QUFDcEMsMkNBQXVDO0FBQ3ZDLG9EQUFvRDtBQUVwRCxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLHFCQUFxQixJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxDQUFDO0FBQ2hGLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLElBQUksT0FBTyxDQUFDLEdBQUcsQ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92Mi9pdGVtcycsXG4gIH0pLFxufSk7XG5kb21haW4yYXBpMkludm9rZS5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIFBheWxvYWQ6IE1hdGNoLnN0cmluZ0xpa2VSZWdleHAoJzIwMicpLFxufSkpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/integ-apigw-domain-name-mapping.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.ts similarity index 95% rename from packages/@aws-cdk/aws-apigateway/test/integ.domain-name.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.ts index f2b106749e136..360ceb50e317b 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.domain-name.ts @@ -1,14 +1,14 @@ -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { Function, Code, Runtime } from '@aws-cdk/aws-lambda'; -import { CfnRecordSet } from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { Function, Code, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { CfnRecordSet } from 'aws-cdk-lib/aws-route53'; +import * as cdk from 'aws-cdk-lib'; import { IntegTest, ExpectedResult, Match, -} from '@aws-cdk/integ-tests'; +} from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as apigw from '../lib'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; const domainName = process.env.CDK_INTEG_DOMAIN_NAME || process.env.DOMAIN_NAME; const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID || process.env.HOSTED_ZONE_ID; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js new file mode 100644 index 0000000000000..b086d03476bd0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +class LambdaApiIntegrationOptionsNonProxyIntegrationStack extends aws_cdk_lib_1.Stack { + constructor(scope) { + super(scope, 'LambdaApiIntegrationOptionsNonProxyIntegrationStack'); + const fn = new aws_lambda_1.Function(this, 'myfn', { + code: aws_lambda_1.Code.fromInline('foo'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', + }); + new aws_apigateway_1.LambdaRestApi(this, 'lambdarestapi', { + cloudWatchRole: true, + handler: fn, + integrationOptions: { + proxy: false, + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.WHEN_NO_MATCH, + integrationResponses: [ + { + statusCode: '200', + responseTemplates: { + 'application/json': JSON.stringify({ message: 'Hello, word' }), + }, + }, + ], + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new LambdaApiIntegrationOptionsNonProxyIntegrationStack(app); +new integ_tests_alpha_1.IntegTest(app, 'lambda-non-proxy-integration', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWFwaS1ub25wcm94eS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxhbWJkYS1hcGktbm9ucHJveHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBaUU7QUFDakUsNkNBQXlDO0FBQ3pDLGtFQUF1RDtBQUV2RCwrREFBZ0Y7QUFFaEYsTUFBTSxtREFBb0QsU0FBUSxtQkFBSztJQUNyRSxZQUFZLEtBQWdCO1FBQzFCLEtBQUssQ0FBQyxLQUFLLEVBQUUscURBQXFELENBQUMsQ0FBQztRQUVwRSxNQUFNLEVBQUUsR0FBRyxJQUFJLHFCQUFRLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRTtZQUNwQyxJQUFJLEVBQUUsaUJBQUksQ0FBQyxVQUFVLENBQUMsS0FBSyxDQUFDO1lBQzVCLE9BQU8sRUFBRSxvQkFBTyxDQUFDLFdBQVc7WUFDNUIsT0FBTyxFQUFFLGVBQWU7U0FDekIsQ0FBQyxDQUFDO1FBRUgsSUFBSSw4QkFBYSxDQUFDLElBQUksRUFBRSxlQUFlLEVBQUU7WUFDdkMsY0FBYyxFQUFFLElBQUk7WUFDcEIsT0FBTyxFQUFFLEVBQUU7WUFDWCxrQkFBa0IsRUFBRTtnQkFDbEIsS0FBSyxFQUFFLEtBQU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uc05vblByb3h5SW50ZWdyYXRpb25TdGFjayhhcHApO1xubmV3IEludGVnVGVzdChhcHAsICdsYW1iZGEtbm9uLXByb3h5LWludGVncmF0aW9uJywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/LambdaApiIntegrationOptionsNonProxyIntegrationStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/lambdanonproxyintegrationDefaultTestDeployAssert31D3AA1B.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.ts similarity index 80% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.ts index 214e4dde30911..2222d39b2d59d 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api-nonproxy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api-nonproxy.ts @@ -1,8 +1,8 @@ -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { LambdaRestApi, PassthroughBehavior } from '../lib'; +import { LambdaRestApi, PassthroughBehavior } from 'aws-cdk-lib/aws-apigateway'; class LambdaApiIntegrationOptionsNonProxyIntegrationStack extends Stack { constructor(scope: Construct) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js new file mode 100644 index 0000000000000..925abcecafc75 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +class LambdaApiIntegrationOptionsStack extends aws_cdk_lib_1.Stack { + constructor(scope) { + super(scope, 'LambdaApiIntegrationOptionsStack'); + const fn = new aws_lambda_1.Function(this, 'myfn', { + code: aws_lambda_1.Code.fromInline('foo'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', + }); + new aws_apigateway_1.LambdaRestApi(this, 'lambdarestapi', { + handler: fn, + cloudWatchRole: true, + integrationOptions: { + timeout: aws_cdk_lib_1.Duration.seconds(1), + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new LambdaApiIntegrationOptionsStack(app); +new integ_tests_alpha_1.IntegTest(app, 'lambda-integration', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWFwaS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QgdGVzdENhc2UgPSBuZXcgTGFtYmRhQXBpSW50ZWdyYXRpb25PcHRpb25zU3RhY2soYXBwKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnbGFtYmRhLWludGVncmF0aW9uJywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/LambdaApiIntegrationOptionsStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/lambdaintegrationDefaultTestDeployAssertAC2ED705.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js new file mode 100644 index 0000000000000..d519266af0019 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +class LateBoundDeploymentStageStack extends aws_cdk_lib_1.Stack { + constructor(scope) { + super(scope, 'LateBoundDeploymentStageStack'); + const fn = new aws_lambda_1.Function(this, 'myfn', { + code: aws_lambda_1.Code.fromInline('foo'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', + }); + const api = new aws_apigateway_1.LambdaRestApi(this, 'lambdarestapi', { + cloudWatchRole: true, + deploy: false, + handler: fn, + }); + api.deploymentStage = new aws_apigateway_1.Stage(this, 'stage', { + deployment: new aws_apigateway_1.Deployment(this, 'deployment', { + api, + }), + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new LateBoundDeploymentStageStack(app); +new integ_tests_alpha_1.IntegTest(app, 'lambda-api-latebound-deploymentstage', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWFwaS5sYXRlYm91bmQtZGVwbG95bWVudHN0YWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGFtYmRhLWFwaS5sYXRlYm91bmQtZGVwbG95bWVudHN0YWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsdURBQWlFO0FBQ2pFLDZDQUF5QztBQUN6QyxrRUFBdUQ7QUFFdkQsK0RBQThFO0FBRTlFLE1BQU0sNkJBQThCLFNBQVEsbUJBQUs7SUFDL0MsWUFBWSxLQUFnQjtRQUMxQixLQUFLLENBQUMsS0FBSyxFQUFFLCtCQUErQixDQUFDLENBQUM7UUFFOUMsTUFBTSxFQUFFLEdBQUcsSUFBSSxxQkFBUSxDQUFDLElBQUksRUFBRSxNQUFNLEVBQUU7WUFDcEMsSUFBSSxFQUFFLGlCQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQztZQUM1QixPQUFPLEVBQUUsb0JBQU8sQ0FBQyxXQUFXO1lBQzVCLE9BQU8sRUFBRSxlQUFlO1NBQ3pCLENBQUMsQ0FBQztRQUVILE1BQU0sR0FBRyxHQUFHLElBQUksOEJBQWEsQ0FBQyxJQUFJLEVBQUUsZUFBZSxFQUFFO1lBQ25ELGNBQWMsRUFBRSxJQUFJO1lBQ3BCLE1BQU0sRUFBRSxLQUFLO1lBQ2IsT0FBTyxFQUFFLEVBQUU7U0FDWixDQUFDLENBQUM7UUFFSCxHQUFHLENBQUMsZUFBZSxHQUFHLElBQUksc0JBQUssQ0FBQyxJQUFJLEVBQ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IHtcbiAgICAgIGNvZGU6IENvZGUuZnJvbUlubGluZSgnZm9vJyksXG4gICAgICBydW50aW1lOiBSdW50aW1lLk5PREVKU18xNF9YLFxuICAgICAgaGFuZGxlcjogJ2luZGV4LmhhbmRsZXInLFxuICAgIH0pO1xuXG4gICAgY29uc3QgYXBpID0gbmV3IExhbWJkYVJlc3RBcGkodGhpcywgJ2xhbWJkYXJlc3RhcGknLCB7XG4gICAgICBjbG91ZFdhdGNoUm9sZTogdHJ1ZSxcbiAgICAgIGRlcGxveTogZmFsc2UsXG4gICAgICBoYW5kbGVyOiBmbixcbiAgICB9KTtcblxuICAgIGFwaS5kZXBsb3ltZW50U3RhZ2UgPSBuZXcgU3RhZ2UodGhpcywgJ3N0YWdlJywge1xuICAgICAgZGVwbG95bWVudDogbmV3IERlcGxveW1lbnQodGhpcywgJ2RlcGxveW1lbnQnLCB7XG4gICAgICAgIGFwaSxcbiAgICAgIH0pLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHRlc3RDYXNlID0gbmV3IExhdGVCb3VuZERlcGxveW1lbnRTdGFnZVN0YWNrKGFwcCk7XG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2xhbWJkYS1hcGktbGF0ZWJvdW5kLWRlcGxveW1lbnRzdGFnZScsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/LateBoundDeploymentStageStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/lambdaapilatebounddeploymentstageDefaultTestDeployAssert678919C4.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts similarity index 76% rename from packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts index 8f3a6c63736a2..113f5f730981e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.latebound-deploymentstage.ts @@ -1,8 +1,8 @@ -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { Deployment, LambdaRestApi, Stage } from '../lib'; +import { Deployment, LambdaRestApi, Stage } from 'aws-cdk-lib/aws-apigateway'; class LateBoundDeploymentStageStack extends Stack { constructor(scope: Construct) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.ts new file mode 100644 index 0000000000000..135383b70ad2b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.lambda-api.ts @@ -0,0 +1,31 @@ +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, Duration, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Construct } from 'constructs'; +import { LambdaRestApi } from 'aws-cdk-lib/aws-apigateway'; + +class LambdaApiIntegrationOptionsStack extends Stack { + constructor(scope: Construct) { + super(scope, 'LambdaApiIntegrationOptionsStack'); + + const fn = new Function(this, 'myfn', { + code: Code.fromInline('foo'), + runtime: Runtime.NODEJS_14_X, + handler: 'index.handler', + }); + + new LambdaRestApi(this, 'lambdarestapi', { + handler: fn, + cloudWatchRole: true, + integrationOptions: { + timeout: Duration.seconds(1), + }, + }); + } +} + +const app = new App(); +const testCase = new LambdaApiIntegrationOptionsStack(app); +new IntegTest(app, 'lambda-integration', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js new file mode 100644 index 0000000000000..b4a73894021f0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js @@ -0,0 +1,101 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_apigateway_1 = require("aws-cdk-lib/aws-apigateway"); +/** + * This file showcases how to split up a RestApi's Resources and Methods across nested stacks. + * + * The root stack 'RootStack' first defines a RestApi. + * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'. + * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack. + * + * To verify this worked, go to the APIGateway + */ +class RootStack extends aws_cdk_lib_1.Stack { + constructor(scope) { + super(scope, 'integ-restapi-import-RootStack'); + const restApi = new aws_apigateway_1.RestApi(this, 'RestApi', { + cloudWatchRole: true, + deploy: false, + }); + restApi.root.addMethod('ANY'); + const petsStack = new PetsStack(this, { + restApiId: restApi.restApiId, + rootResourceId: restApi.restApiRootResourceId, + }); + const booksStack = new BooksStack(this, { + restApiId: restApi.restApiId, + rootResourceId: restApi.restApiRootResourceId, + }); + new DeployStack(this, { + restApiId: restApi.restApiId, + methods: petsStack.methods.concat(booksStack.methods), + }); + new aws_cdk_lib_1.CfnOutput(this, 'PetsURL', { + value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/pets`, + }); + new aws_cdk_lib_1.CfnOutput(this, 'BooksURL', { + value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/books`, + }); + } +} +class PetsStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, props) { + super(scope, 'integ-restapi-import-PetsStack', props); + this.methods = []; + const api = aws_apigateway_1.RestApi.fromRestApiAttributes(this, 'RestApi', { + restApiId: props.restApiId, + rootResourceId: props.rootResourceId, + }); + const method = api.root.addResource('pets').addMethod('GET', new aws_apigateway_1.MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, + }), { + methodResponses: [{ statusCode: '200' }], + }); + this.methods.push(method); + } +} +class BooksStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, props) { + super(scope, 'integ-restapi-import-BooksStack', props); + this.methods = []; + const api = aws_apigateway_1.RestApi.fromRestApiAttributes(this, 'RestApi', { + restApiId: props.restApiId, + rootResourceId: props.rootResourceId, + }); + const method = api.root.addResource('books').addMethod('GET', new aws_apigateway_1.MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: aws_apigateway_1.PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, + }), { + methodResponses: [{ statusCode: '200' }], + }); + this.methods.push(method); + } +} +class DeployStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, props) { + super(scope, 'integ-restapi-import-DeployStack', props); + const deployment = new aws_apigateway_1.Deployment(this, 'Deployment', { + api: aws_apigateway_1.RestApi.fromRestApiId(this, 'RestApi', props.restApiId), + }); + if (props.methods) { + for (const method of props.methods) { + deployment.node.addDependency(method); + } + } + new aws_apigateway_1.Stage(this, 'Stage', { deployment }); + } +} +new RootStack(new aws_cdk_lib_1.App()); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS1pbXBvcnQubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucmVzdGFwaS1pbXBvcnQubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQW1GO0FBRW5GLCtEQUFzSDtBQUV0SDs7Ozs7Ozs7R0FRRztBQUVILE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0I7UUFDMUIsS0FBSyxDQUFDLEtBQUssRUFBRSxnQ0FBZ0MsQ0FBQyxDQUFDO1FBRS9DLE1BQU0sT0FBTyxHQUFHLElBQUksd0JBQU8sQ0FBQyxJQUFJLEVBQUUsU0FBUyxFQUFFO1lBQzNDLGNBQWMsRUFBRSxJQUFJO1lBQ3BCLE1BQU0sRUFBRSxLQUFLO1NBQ2QsQ0FBQyxDQUFDO1FBQ0gsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLENBQUM7UUFFOUIsTUFBTSxTQUFTLEdBQUcsSUFBSSxTQUFTLENBQUMsSUFBSSxFQUFFO1lBQ3BDLFNBQVMsRUFBRSxPQUFPLENBQUMsU0FBUztZQUM1QixjQUFjLEVBQUUsT0FBTyxDQUFDLHFCQUFxQjtTQUM5QyxDQUFDLENBQUM7UUFDSCxNQUFNLFVBQVUsR0FBRyxJQUFJLFVBQVUsQ0FBQyxJ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/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ-restapi-import-RootStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportBooksStack8A2BCEFB.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportBooksStack8A2BCEFB.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportBooksStack8A2BCEFB.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportBooksStack8A2BCEFB.nested.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportDeployStack7C4FC449.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportDeployStack7C4FC449.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportDeployStack7C4FC449.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportDeployStack7C4FC449.nested.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportPetsStackC2B0DDC8.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportPetsStackC2B0DDC8.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportPetsStackC2B0DDC8.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/integrestapiimportRootStackintegrestapiimportPetsStackC2B0DDC8.nested.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.ts new file mode 100644 index 0000000000000..b968c5946b1df --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-import.lit.ts @@ -0,0 +1,130 @@ +import { App, CfnOutput, NestedStack, NestedStackProps, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import { Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage } from 'aws-cdk-lib/aws-apigateway'; + +/** + * This file showcases how to split up a RestApi's Resources and Methods across nested stacks. + * + * The root stack 'RootStack' first defines a RestApi. + * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'. + * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack. + * + * To verify this worked, go to the APIGateway + */ + +class RootStack extends Stack { + constructor(scope: Construct) { + super(scope, 'integ-restapi-import-RootStack'); + + const restApi = new RestApi(this, 'RestApi', { + cloudWatchRole: true, + deploy: false, + }); + restApi.root.addMethod('ANY'); + + const petsStack = new PetsStack(this, { + restApiId: restApi.restApiId, + rootResourceId: restApi.restApiRootResourceId, + }); + const booksStack = new BooksStack(this, { + restApiId: restApi.restApiId, + rootResourceId: restApi.restApiRootResourceId, + }); + new DeployStack(this, { + restApiId: restApi.restApiId, + methods: petsStack.methods.concat(booksStack.methods), + }); + + new CfnOutput(this, 'PetsURL', { + value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/pets`, + }); + + new CfnOutput(this, 'BooksURL', { + value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/books`, + }); + } +} + +interface ResourceNestedStackProps extends NestedStackProps { + readonly restApiId: string; + + readonly rootResourceId: string; +} + +class PetsStack extends NestedStack { + public readonly methods: Method[] = []; + + constructor(scope: Construct, props: ResourceNestedStackProps) { + super(scope, 'integ-restapi-import-PetsStack', props); + + const api = RestApi.fromRestApiAttributes(this, 'RestApi', { + restApiId: props.restApiId, + rootResourceId: props.rootResourceId, + }); + + const method = api.root.addResource('pets').addMethod('GET', new MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, + }), { + methodResponses: [{ statusCode: '200' }], + }); + + this.methods.push(method); + } +} + +class BooksStack extends NestedStack { + public readonly methods: Method[] = []; + + constructor(scope: Construct, props: ResourceNestedStackProps) { + super(scope, 'integ-restapi-import-BooksStack', props); + + const api = RestApi.fromRestApiAttributes(this, 'RestApi', { + restApiId: props.restApiId, + rootResourceId: props.rootResourceId, + }); + + const method = api.root.addResource('books').addMethod('GET', new MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, + }), { + methodResponses: [{ statusCode: '200' }], + }); + + this.methods.push(method); + } +} + +interface DeployStackProps extends NestedStackProps { + readonly restApiId: string; + + readonly methods?: Method[]; +} + +class DeployStack extends NestedStack { + constructor(scope: Construct, props: DeployStackProps) { + super(scope, 'integ-restapi-import-DeployStack', props); + + const deployment = new Deployment(this, 'Deployment', { + api: RestApi.fromRestApiId(this, 'RestApi', props.restApiId), + }); + if (props.methods) { + for (const method of props.methods) { + deployment.node.addDependency(method); + } + } + new Stage(this, 'Stage', { deployment }); + } +} + +new RootStack(new App()); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js new file mode 100644 index 0000000000000..3ce70eb31489c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const apigw = require("aws-cdk-lib/aws-apigateway"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'restapi-metrics'); +const restApi = new apigw.RestApi(stack, 'Api', { cloudWatchRole: true }); +const stage = restApi.deploymentStage; +const method = restApi.root.addMethod('GET'); +new cloudwatch.Alarm(stack, 'RestApiAlarm', { + metric: restApi.metricClientError(), + evaluationPeriods: 1, + threshold: 1, +}); +new cloudwatch.Alarm(stack, 'MethodAlarm', { + metric: method.metricServerError(stage), + evaluationPeriods: 1, + threshold: 1, +}); +new cloudwatch.Alarm(stack, 'StageAlarm', { + metric: stage.metricCount(), + evaluationPeriods: 1, + threshold: 1, +}); +new integ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XN0QXBpLnJvb3QuYWRkTWV0aG9kKCdHRVQnKTtcblxubmV3IGNsb3Vkd2F0Y2guQWxhcm0oc3RhY2ssICdSZXN0QXBpQWxhcm0nLCB7XG4gIG1ldHJpYzogcmVzdEFwaS5tZXRyaWNDbGllbnRFcnJvcigpLFxuICBldmFsdWF0aW9uUGVyaW9kczogMSxcbiAgdGhyZXNob2xkOiAxLFxufSk7XG5cbm5ldyBjbG91ZHdhdGNoLkFsYXJtKHN0YWNrLCAnTWV0aG9kQWxhcm0nLCB7XG4gIG1ldHJpYzogbWV0aG9kLm1ldHJpY1NlcnZlckVycm9yKHN0YWdlKSxcbiAgZXZhbHVhdGlvblBlcmlvZHM6IDEsXG4gIHRocmVzaG9sZDogMSxcbn0pO1xuXG5uZXcgY2xvdWR3YXRjaC5BbGFybShzdGFjaywgJ1N0YWdlQWxhcm0nLCB7XG4gIG1ldHJpYzogc3RhZ2UubWV0cmljQ291bnQoKSxcbiAgZXZhbHVhdGlvblBlcmlvZHM6IDEsXG4gIHRocmVzaG9sZDogMSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ01ldHJpY3NUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/MetricsTestDefaultTestDeployAssertEA4ED73F.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/restapi-metrics.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.ts similarity index 77% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.ts index 01092efe56642..dbad107b39bc0 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-metrics.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi-metrics.ts @@ -1,7 +1,7 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as apigw from '../lib'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'restapi-metrics'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js new file mode 100644 index 0000000000000..b7ab95dfb5472 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const logs = require("aws-cdk-lib/aws-logs"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class Test extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ + requestId: apigateway.AccessLogField.contextRequestId(), + sourceIp: apigateway.AccessLogField.contextIdentitySourceIp(), + method: apigateway.AccessLogField.contextHttpMethod(), + callerAccountId: apigateway.AccessLogField.contextCallerAccountId(), + ownerAccountId: apigateway.AccessLogField.contextOwnerAccountId(), + userContext: { + sub: apigateway.AccessLogField.contextAuthorizerClaims('sub'), + email: apigateway.AccessLogField.contextAuthorizerClaims('email'), + }, + clientCertPem: apigateway.AccessLogField.contextIdentityClientCertPem(), + subjectDN: apigateway.AccessLogField.contextIdentityClientCertSubjectDN(), + issunerDN: apigateway.AccessLogField.contextIdentityClientCertIssunerDN(), + serialNumber: apigateway.AccessLogField.contextIdentityClientCertSerialNumber(), + validityNotBefore: apigateway.AccessLogField.contextIdentityClientCertValidityNotBefore(), + validityNotAfter: apigateway.AccessLogField.contextIdentityClientCertValidityNotAfter(), + })); + const logGroup = new logs.LogGroup(this, 'MyLogGroup'); + const api = new apigateway.RestApi(this, 'MyApi', { + cloudWatchRole: true, + deployOptions: { + accessLogDestination: new apigateway.LogGroupLogDestination(logGroup), + accessLogFormat: testFormat, + }, + }); + api.root.addMethod('GET'); + } +} +const app = new cdk.App(); +const testCase = new Test(app, 'test-apigateway-access-logs'); +new integ_tests_alpha_1.IntegTest(app, 'apigateway-access-logs', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS5hY2Nlc3MtbG9nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucmVzdGFwaS5hY2Nlc3MtbG9nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQTZDO0FBQzdDLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQseURBQXlEO0FBRXpELE1BQU0sSUFBSyxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQzFCLFlBQVksS0FBYyxFQUFFLEVBQVU7UUFDcEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixNQUFNLFVBQVUsR0FBRyxVQUFVLENBQUMsZUFBZSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDO1lBQ2xFLFNBQVMsRUFBRSxVQUFVLENBQUMsY0FBYyxDQUFDLGdCQUFnQixFQUFFO1lBQ3ZELFFBQVEsRUFBRSxVQUFVLENBQUMsY0FBYyxDQUFDLHVCQUF1QixFQUFFO1lB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k/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/apigatewayaccesslogsDefaultTestDeployAssert751ACD40.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/test-apigateway-access-logs.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.ts similarity index 89% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.ts index c7ca5480cdd6d..5d656bb58b94f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.access-log.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.access-log.ts @@ -1,7 +1,7 @@ -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; class Test extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js new file mode 100644 index 0000000000000..60b4ba7026f8a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigw = require("aws-cdk-lib/aws-apigateway"); +class BookStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const booksHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BooksHandler', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${echoHandlerCode}`), + })); + const bookHandler = new apigw.LambdaIntegration(new lambda.Function(this, 'BookHandler', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${echoHandlerCode}`), + })); + const hello = new apigw.LambdaIntegration(new lambda.Function(this, 'Hello', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${helloCode}`), + })); + const api = new apigw.RestApi(this, 'books-api', { cloudWatchRole: true }); + api.root.addMethod('ANY', hello); + const books = api.root.addResource('books', { + defaultIntegration: booksHandler, + defaultMethodOptions: { authorizationType: apigw.AuthorizationType.IAM }, + }); + books.addMethod('GET'); + books.addMethod('POST'); + const book = books.addResource('{book_id}', { + defaultIntegration: bookHandler, + // note that authorization type is inherited from /books + }); + book.addMethod('GET'); + book.addMethod('DELETE'); + } +} +const app = new cdk.App(); +const testCase = new BookStack(app, 'restapi-books-example'); +new integ_tests_alpha_1.IntegTest(app, 'restapi-books', { + testCases: [testCase], +}); +function echoHandlerCode(event, _, callback) { + return callback(undefined, { + isBase64Encoded: false, + statusCode: 200, + headers: { 'content-type': 'application/json' }, + body: JSON.stringify(event), + }); +} +function helloCode(_event, _context, callback) { + return callback(undefined, { + statusCode: 200, + body: 'hello, world!', + }); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS5ib29rcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJlc3RhcGkuYm9va3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaU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gIHJldHVybiBjYWxsYmFjayh1bmRlZmluZWQsIHtcbiAgICBpc0Jhc2U2NEVuY29kZWQ6IGZhbHNlLFxuICAgIHN0YXR1c0NvZGU6IDIwMCxcbiAgICBoZWFkZXJzOiB7ICdjb250ZW50LXR5cGUnOiAnYXBwbGljYXRpb24vanNvbicgfSxcbiAgICBib2R5OiBKU09OLnN0cmluZ2lmeShldmVudCksXG4gIH0pO1xufVxuXG5mdW5jdGlvbiBoZWxsb0NvZGUoX2V2ZW50OiBhbnksIF9jb250ZXh0OiBhbnksIGNhbGxiYWNrOiBhbnkpIHtcbiAgcmV0dXJuIGNhbGxiYWNrKHVuZGVmaW5lZCwge1xuICAgIHN0YXR1c0NvZGU6IDIwMCxcbiAgICBib2R5OiAnaGVsbG8sIHdvcmxkIScsXG4gIH0pO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapi-books-example.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/restapibooksDefaultTestDeployAssert1D3FCB77.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.ts similarity index 91% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.ts index a25cd1ba43d69..da6889af57220 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.books.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.books.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigw from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; class BookStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js new file mode 100644 index 0000000000000..69df90410f285 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'test-apigateway-restapi-defaults'); +const api = new apigateway.RestApi(stack, 'my-api', { cloudWatchRole: true }); +// at least one method is required +api.root.addMethod('GET'); +new integ_tests_alpha_1.IntegTest(app, 'apigateway-restapi-defaults', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS5kZWZhdWx0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJlc3RhcGkuZGVmYXVsdHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxL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iJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/apigatewayrestapidefaultsDefaultTestDeployAssertF892D174.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/test-apigateway-restapi-defaults.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.ts new file mode 100644 index 0000000000000..a775afa1c1c39 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.defaults.ts @@ -0,0 +1,16 @@ +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'test-apigateway-restapi-defaults'); + +const api = new apigateway.RestApi(stack, 'my-api', { cloudWatchRole: true }); + +// at least one method is required +api.root.addMethod('GET'); + +new IntegTest(app, 'apigateway-restapi-defaults', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js new file mode 100644 index 0000000000000..24599f986c215 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class Test extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const api = new apigateway.RestApi(this, 'my-api', { + retainDeployments: true, + cloudWatchRole: true, + minCompressionSize: aws_cdk_lib_1.Size.bytes(1024), + deployOptions: { + cacheClusterEnabled: true, + stageName: 'beta', + description: 'beta stage', + loggingLevel: apigateway.MethodLoggingLevel.INFO, + dataTraceEnabled: true, + methodOptions: { + '/api/appliances/GET': { + cachingEnabled: true, + }, + }, + }, + }); + const handler = new lambda.Function(this, 'MyHandler', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(`exports.handler = ${handlerCode}`), + handler: 'index.handler', + }); + const v1 = api.root.addResource('v1'); + const integration = new apigateway.LambdaIntegration(handler); + const toys = v1.addResource('toys'); + const getToysMethod = toys.addMethod('GET', integration, { apiKeyRequired: true }); + toys.addMethod('POST'); + toys.addMethod('PUT'); + const appliances = v1.addResource('appliances:all'); + appliances.addMethod('GET'); + const books = v1.addResource('books'); + books.addMethod('GET', integration); + books.addMethod('POST', integration); + function handlerCode(event, _, callback) { + return callback(undefined, { + isBase64Encoded: false, + statusCode: 200, + headers: { 'content-type': 'application/json' }, + body: JSON.stringify(event), + }); + } + const key = api.addApiKey('ApiKey'); + const plan = api.addUsagePlan('UsagePlan', { + name: 'Basic', + apiKey: key, + description: 'Free tier monthly usage plan', + throttle: { rateLimit: 5 }, + quota: { + limit: 10000, + period: apigateway.Period.MONTH, + }, + }); + plan.addApiStage({ + stage: api.deploymentStage, + throttle: [ + { + method: getToysMethod, + throttle: { + rateLimit: 10, + burstLimit: 2, + }, + }, + ], + }); + const testDeploy = new apigateway.Deployment(this, 'TestDeployment', { + api, + retainDeployments: false, + }); + const testStage = new apigateway.Stage(this, 'TestStage', { + deployment: testDeploy, + }); + testStage.addApiKey('MyTestApiKey'); + } +} +const app = new cdk.App(); +const testCase = new Test(app, 'test-apigateway-restapi'); +new integ_tests_alpha_1.IntegTest(app, 'apigateway-restapi', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJlc3RhcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLDZDQUF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GVyaW9kOiBhcGlnYXRld2F5LlBlcmlvZC5NT05USCxcbiAgICAgIH0sXG4gICAgfSk7XG4gICAgcGxhbi5hZGRBcGlTdGFnZSh7XG4gICAgICBzdGFnZTogYXBpLmRlcGxveW1lbnRTdGFnZSxcbiAgICAgIHRocm90dGxlOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBtZXRob2Q6IGdldFRveXNNZXRob2QsXG4gICAgICAgICAgdGhyb3R0bGU6IHtcbiAgICAgICAgICAgIHJhdGVMaW1pdDogMTAsXG4gICAgICAgICAgICBidXJzdExpbWl0OiAyLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH0pO1xuXG4gICAgY29uc3QgdGVzdERlcGxveSA9IG5ldyBhcGlnYXRld2F5LkRlcGxveW1lbnQodGhpcywgJ1Rlc3REZXBsb3ltZW50Jywge1xuICAgICAgYXBpLFxuICAgICAgcmV0YWluRGVwbG95bWVudHM6IGZhbHNlLFxuICAgIH0pO1xuICAgIGNvbnN0IHRlc3RTdGFnZSA9IG5ldyBhcGlnYXRld2F5LlN0YWdlKHRoaXMsICdUZXN0U3RhZ2UnLCB7XG4gICAgICBkZXBsb3ltZW50OiB0ZXN0RGVwbG95LFxuICAgIH0pO1xuICAgIHRlc3RTdGFnZS5hZGRBcGlLZXkoJ015VGVzdEFwaUtleScpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbmNvbnN0IHRlc3RDYXNlID0gbmV3IFRlc3QoYXBwLCAndGVzdC1hcGlnYXRld2F5LXJlc3RhcGknKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnYXBpZ2F0ZXdheS1yZXN0YXBpJywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcblxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/apigatewayrestapiDefaultTestDeployAssert6A9696A7.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/test-apigateway-restapi.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js new file mode 100644 index 0000000000000..5a87026827730 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apig = require("aws-cdk-lib/aws-apigateway"); +class FirstStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.firstLambda = new lambda.Function(this, 'firstLambda', { + functionName: 'FirstLambda', + code: lambda.Code.fromInline(`exports.handler = async function(event) { + return { + 'headers': { 'Content-Type': 'text/plain' }, + 'statusCode': 200 + } + }`), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + } +} +class SecondStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const api = new apig.RestApi(this, 'BooksApi', { + cloudWatchRole: true, + restApiName: 'SecondRestAPI', + }); + api.root.addMethod('ANY'); + const booksApi = api.root.addResource('books'); + const lambdaIntegration = new apig.LambdaIntegration(props.lambda); + booksApi.addMethod('GET', lambdaIntegration); + } +} +const app = new cdk.App(); +const first = new FirstStack(app, 'FirstStack'); +const testCase = new SecondStack(app, 'SecondStack', { lambda: first.firstLambda }); +// will deploy dependent stacks, i.e. first +new integ_tests_alpha_1.IntegTest(app, 'restapi-multistack', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS5tdWx0aXN0YWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucmVzdGFwaS5tdWx0aXN0YWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7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waSA9IG5ldyBhcGlnLlJlc3RBcGkodGhpcywgJ0Jvb2tzQXBpJywge1xuICAgICAgY2xvdWRXYXRjaFJvbGU6IHRydWUsXG4gICAgICByZXN0QXBpTmFtZTogJ1NlY29uZFJlc3RBUEknLFxuICAgIH0pO1xuICAgIGFwaS5yb290LmFkZE1ldGhvZCgnQU5ZJyk7XG4gICAgY29uc3QgYm9va3NBcGkgPSBhcGkucm9vdC5hZGRSZXNvdXJjZSgnYm9va3MnKTtcbiAgICBjb25zdCBsYW1iZGFJbnRlZ3JhdGlvbiA9IG5ldyBhcGlnLkxhbWJkYUludGVncmF0aW9uKHByb3BzLmxhbWJkYSk7XG4gICAgYm9va3NBcGkuYWRkTWV0aG9kKCdHRVQnLCBsYW1iZGFJbnRlZ3JhdGlvbik7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IGZpcnN0ID0gbmV3IEZpcnN0U3RhY2soYXBwLCAnRmlyc3RTdGFjaycpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgU2Vjb25kU3RhY2soYXBwLCAnU2Vjb25kU3RhY2snLCB7IGxhbWJkYTogZmlyc3QuZmlyc3RMYW1iZGEgfSk7XG5cbi8vIHdpbGwgZGVwbG95IGRlcGVuZGVudCBzdGFja3MsIGkuZS4gZmlyc3Rcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAncmVzdGFwaS1tdWx0aXN0YWNrJywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/FirstStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/SecondStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/restapimultistackDefaultTestDeployAssertFCCAE394.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.ts similarity index 88% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.ts index 13fb7d19b9833..6a1824d323adb 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multistack.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multistack.ts @@ -1,8 +1,8 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; -import * as apig from '../lib'; +import * as apig from 'aws-cdk-lib/aws-apigateway'; class FirstStack extends cdk.Stack { public readonly firstLambda: lambda.Function; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js new file mode 100644 index 0000000000000..6925fa968806a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigw = require("aws-cdk-lib/aws-apigateway"); +class MultiStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const hello = new apigw.LambdaIntegration(new lambda.Function(this, 'Hello', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${helloCode}`), + })); + const api = new apigw.RestApi(this, 'hello-api', { cloudWatchRole: true }); + api.root.resourceForPath('/hello').addMethod('GET', hello); + const api2 = new apigw.RestApi(this, 'second-api', { cloudWatchRole: true }); + api2.root.resourceForPath('/hello').addMethod('GET', hello); + } +} +const app = new cdk.App(); +const testCase = new MultiStack(app, 'restapi-multiuse-example'); +new integ_tests_alpha_1.IntegTest(app, 'restapi-multiuse', { + testCases: [testCase], +}); +function helloCode(_event, _context, callback) { + return callback(undefined, { + statusCode: 200, + body: 'hello, world!', + }); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdGFwaS5tdWx0aXVzZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJlc3RhcGkubXVsdGl1c2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCxvREFBb0Q7QUFFcEQsTUFBTSxVQUFXLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDaEMsWUFBWSxLQUFjLEVBQUUsRUFBVTtRQUNwQyxLQUFLLENBQUMsS0FBSyxFQUF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IG5ldyBhcGlndy5SZXN0QXBpKHRoaXMsICdoZWxsby1hcGknLCB7IGNsb3VkV2F0Y2hSb2xlOiB0cnVlIH0pO1xuICAgIGFwaS5yb290LnJlc291cmNlRm9yUGF0aCgnL2hlbGxvJykuYWRkTWV0aG9kKCdHRVQnLCBoZWxsbyk7XG5cbiAgICBjb25zdCBhcGkyID0gbmV3IGFwaWd3LlJlc3RBcGkodGhpcywgJ3NlY29uZC1hcGknLCB7IGNsb3VkV2F0Y2hSb2xlOiB0cnVlIH0pO1xuICAgIGFwaTIucm9vdC5yZXNvdXJjZUZvclBhdGgoJy9oZWxsbycpLmFkZE1ldGhvZCgnR0VUJywgaGVsbG8pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5jb25zdCB0ZXN0Q2FzZSA9IG5ldyBNdWx0aVN0YWNrKGFwcCwgJ3Jlc3RhcGktbXVsdGl1c2UtZXhhbXBsZScpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ3Jlc3RhcGktbXVsdGl1c2UnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuXG5mdW5jdGlvbiBoZWxsb0NvZGUoX2V2ZW50OiBhbnksIF9jb250ZXh0OiBhbnksIGNhbGxiYWNrOiBhbnkpIHtcbiAgcmV0dXJuIGNhbGxiYWNrKHVuZGVmaW5lZCwge1xuICAgIHN0YXR1c0NvZGU6IDIwMCxcbiAgICBib2R5OiAnaGVsbG8sIHdvcmxkIScsXG4gIH0pO1xufVxuXG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapi-multiuse-example.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/restapimultiuseDefaultTestDeployAssert47DF66CC.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.ts similarity index 83% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.ts index 83968e997f98a..c7fd1be6968d4 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.multiuse.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.multiuse.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigw from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; class MultiStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.ts similarity index 91% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.ts index 47030c17160fe..befc3df8a0e45 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.ts @@ -1,8 +1,8 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Size } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { Size } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; class Test extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js new file mode 100644 index 0000000000000..e83c9ffe4f531 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +/* + * Stack verification steps: + * * curl https://-.execute-api.us-east-1.amazonaws.com/prod/ + * The above command must be executed in the vpc + */ +class Test extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'MyVpc', {}); + const vpcEndpoint = vpc.addInterfaceEndpoint('MyVpcEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.APIGATEWAY, + }); + const api = new apigateway.RestApi(this, 'MyApi', { + cloudWatchRole: true, + endpointConfiguration: { + types: [apigateway.EndpointType.PRIVATE], + vpcEndpoints: [vpcEndpoint], + }, + policy: new iam.PolicyDocument({ + statements: [ + new iam.PolicyStatement({ + principals: [new iam.AnyPrincipal()], + actions: ['execute-api:Invoke'], + effect: iam.Effect.ALLOW, + }), + ], + }), + }); + api.root.addMethod('GET'); + } +} +const app = new cdk.App(); +const testCase = new Test(app, 'test-apigateway-vpcendpoint'); +new integ_tests_alpha_1.IntegTest(app, 'apigateway-vpcendpoint', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucm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dDogaWFtLkVmZmVjdC5BTExPVyxcbiAgICAgICAgICB9KSxcbiAgICAgICAgXSxcbiAgICAgIH0pLFxuICAgIH0pO1xuICAgIGFwaS5yb290LmFkZE1ldGhvZCgnR0VUJyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxuY29uc3QgdGVzdENhc2UgPSBuZXcgVGVzdChhcHAsICd0ZXN0LWFwaWdhdGV3YXktdnBjZW5kcG9pbnQnKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnYXBpZ2F0ZXdheS12cGNlbmRwb2ludCcsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/apigatewayvpcendpointDefaultTestDeployAssert95ED9392.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/test-apigateway-vpcendpoint.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.ts similarity index 82% rename from packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.ts index 2e7c0e0c01113..b15d74d78f849 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.vpc-endpoint.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.vpc-endpoint.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js new file mode 100644 index 0000000000000..2463291c9eba6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class Test extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const api = new apigateway.SpecRestApi(this, 'my-api', { + apiDefinition: apigateway.ApiDefinition.fromAsset(path.join(__dirname, 'sample-definition.yaml')), + disableExecuteApiEndpoint: true, + minCompressionSize: aws_cdk_lib_1.Size.bytes(1024), + retainDeployments: true, + cloudWatchRole: true, + deployOptions: { + cacheClusterEnabled: true, + stageName: 'beta', + description: 'beta stage', + loggingLevel: apigateway.MethodLoggingLevel.INFO, + dataTraceEnabled: true, + methodOptions: { + '/api/appliances/GET': { + cachingEnabled: true, + }, + }, + }, + }); + const handler = new lambda.Function(this, 'MyHandler', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(`exports.handler = ${handlerCode}`), + handler: 'index.handler', + }); + const v1 = api.root.addResource('v1'); + const integration = new apigateway.LambdaIntegration(handler); + const toys = v1.addResource('toys'); + const getToysMethod = toys.addMethod('GET', integration, { apiKeyRequired: true }); + toys.addMethod('POST'); + toys.addMethod('PUT'); + const appliances = v1.addResource('appliances'); + appliances.addMethod('GET'); + const books = v1.addResource('books'); + books.addMethod('GET', integration); + books.addMethod('POST', integration); + function handlerCode(event, _, callback) { + return callback(undefined, { + isBase64Encoded: false, + statusCode: 200, + headers: { 'content-type': 'application/json' }, + body: JSON.stringify(event), + }); + } + const key = api.addApiKey('ApiKey'); + const plan = api.addUsagePlan('UsagePlan', { + name: 'Basic', + apiKey: key, + description: 'Free tier monthly usage plan', + throttle: { rateLimit: 5 }, + quota: { + limit: 10000, + period: apigateway.Period.MONTH, + }, + }); + plan.addApiStage({ + stage: api.deploymentStage, + throttle: [ + { + method: getToysMethod, + throttle: { + rateLimit: 10, + burstLimit: 2, + }, + }, + ], + }); + } +} +const app = new cdk.App(); +const testCase = new Test(app, 'test-apigateway-spec-restapi'); +new integ_tests_alpha_1.IntegTest(app, 'apigateway-spec-restapi', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3BlYy1yZXN0YXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3BlYy1yZXN0YXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLGlEQUFpRDtBQUNqRCxtQ0FBbUM7QUFDbkMsNkNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCx5REFBeUQ7QUFFekQsTUFBTSxJQUFLLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDMUIsWUFBWSxLQUFjL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HBsYW4uYWRkQXBpU3RhZ2Uoe1xuICAgICAgc3RhZ2U6IGFwaS5kZXBsb3ltZW50U3RhZ2UsXG4gICAgICB0aHJvdHRsZTogW1xuICAgICAgICB7XG4gICAgICAgICAgbWV0aG9kOiBnZXRUb3lzTWV0aG9kLFxuICAgICAgICAgIHRocm90dGxlOiB7XG4gICAgICAgICAgICByYXRlTGltaXQ6IDEwLFxuICAgICAgICAgICAgYnVyc3RMaW1pdDogMixcbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5jb25zdCB0ZXN0Q2FzZSA9IG5ldyBUZXN0KGFwcCwgJ3Rlc3QtYXBpZ2F0ZXdheS1zcGVjLXJlc3RhcGknKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnYXBpZ2F0ZXdheS1zcGVjLXJlc3RhcGknLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/test-apigateway-spec-restapi.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.ts similarity index 91% rename from packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.ts index f10f166232a2d..c531edf6e1b20 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.spec-restapi.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Size } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { Size } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; class Test extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js new file mode 100644 index 0000000000000..38235065c12bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const apigw = require("aws-cdk-lib/aws-apigateway"); +/** + * Stack verification steps: + * * `curl -X POST 'https://.execute-api..amazonaws.com/prod' \ + * * -d '{"key":"Hello"}' -H 'Content-Type: application/json'` + * The above should return a "Hello" response + */ +class StepFunctionsRestApiDeploymentStack extends cdk.Stack { + constructor(scope) { + super(scope, 'StepFunctionsRestApiDeploymentStack'); + const passTask = new sfn.Pass(this, 'PassTask', { + result: { value: 'Hello' }, + }); + const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition: passTask, + stateMachineType: sfn.StateMachineType.EXPRESS, + }); + const api = new apigw.StepFunctionsRestApi(this, 'StepFunctionsRestApi', { + deploy: false, + cloudWatchRole: true, + stateMachine: stateMachine, + headers: true, + path: false, + querystring: false, + requestContext: { + accountId: true, + userArn: true, + }, + }); + api.deploymentStage = new apigw.Stage(this, 'stage', { + deployment: new apigw.Deployment(this, 'deployment', { + api, + }), + }); + new cdk.CfnOutput(this, 'ApiEndpoint', { + value: api.url, + }); + } +} +const app = new cdk.App(); +const testCase = new StepFunctionsRestApiDeploymentStack(app); +new integ_tests_alpha_1.IntegTest(app, 'step-functions-restapi', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RlcGZ1bmN0aW9ucy1hcGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zdGVwZnVuY3Rpb25zLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBRXZELG9EQUFvRDtBQUVwRDs7Ozs7R0FLRztBQUVILE1BQU0sbUNBQW9DLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDekQsWUFBWSxLQUFnQjtRQUMxQixLQUFLLENBQUMsS0FBSyxFQUFFLHFDQUFxQyxDQUFDLENBQUM7UUFFcEQsTUFBTSxRQUFRLEdBQ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GlzLCAnZGVwbG95bWVudCcsIHtcbiAgICAgICAgYXBpLFxuICAgICAgfSksXG4gICAgfSk7XG5cbiAgICBuZXcgY2RrLkNmbk91dHB1dCh0aGlzLCAnQXBpRW5kcG9pbnQnLCB7XG4gICAgICB2YWx1ZTogYXBpLnVybCxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgU3RlcEZ1bmN0aW9uc1Jlc3RBcGlEZXBsb3ltZW50U3RhY2soYXBwKTtcblxubmV3IEludGVnVGVzdChhcHAsICdzdGVwLWZ1bmN0aW9ucy1yZXN0YXBpJywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/StepFunctionsRestApiDeploymentStack.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/stepfunctionsrestapiDefaultTestDeployAssert53C3797F.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.ts similarity index 87% rename from packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.ts index 3ba3d13d38e7a..6db39f4d5c631 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.stepfunctions-api.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-api.ts @@ -1,8 +1,8 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as apigw from '../lib'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; /** * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js new file mode 100644 index 0000000000000..8daf5e4108c87 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class Test extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const usageplan = new apigateway.UsagePlan(this, 'myusageplan'); + const apikey1 = new apigateway.ApiKey(this, 'myapikey1'); + const apikey2 = new apigateway.ApiKey(this, 'myapikey2'); + usageplan.addApiKey(apikey1); + usageplan.addApiKey(apikey2); + } +} +const app = new cdk.App(); +new Test(app, 'test-apigateway-usageplan-multikey'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNhZ2UtcGxhbi5tdWx0aWtleS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnVzYWdlLXBsYW4ubXVsdGlrZXkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMseURBQXlEO0FBRXpELE1BQU0sSUFBSyxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQzFCLFlBQ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nN0IGFwaWtleTEgPSBuZXcgYXBpZ2F0ZXdheS5BcGlLZXkodGhpcywgJ215YXBpa2V5MScpO1xuICAgIGNvbnN0IGFwaWtleTIgPSBuZXcgYXBpZ2F0ZXdheS5BcGlLZXkodGhpcywgJ215YXBpa2V5MicpO1xuICAgIHVzYWdlcGxhbi5hZGRBcGlLZXkoYXBpa2V5MSk7XG4gICAgdXNhZ2VwbGFuLmFkZEFwaUtleShhcGlrZXkyKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5uZXcgVGVzdChhcHAsICd0ZXN0LWFwaWdhdGV3YXktdXNhZ2VwbGFuLW11bHRpa2V5Jyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.assets.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.assets.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/test-apigateway-usageplan-multikey.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.ts similarity index 83% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.ts index 13036c2943ced..7bb1b50b63424 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.multikey.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.multikey.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as apigateway from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; class Test extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js new file mode 100644 index 0000000000000..18199326aff66 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const cdk = require("aws-cdk-lib"); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +class Create extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + this.usagePlan = new apigateway.UsagePlan(this, 'myusageplan'); + } +} +class Import extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id); + const usageplan = apigateway.UsagePlan.fromUsagePlanId(this, 'myusageplan', props.usagePlan.usagePlanId); + const apikey = new apigateway.ApiKey(this, 'myapikey'); + usageplan.addApiKey(apikey); + } +} +const app = new cdk.App(); +const test = new Create(app, 'test-apigateway-usageplan-create'); +new Import(app, 'test-apigateway-usageplan-import', { +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ykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICBjb25zdCB1c2FnZXBsYW4gPSBhcGlnYXRld2F5LlVzYWdlUGxhbi5mcm9tVXNhZ2VQbGFuSWQodGhpcywgJ215dXNhZ2VwbGFuJywgcHJvcHMudXNhZ2VQbGFuLnVzYWdlUGxhbklkKTtcbiAgICBjb25zdCBhcGlrZXkgPSBuZXcgYXBpZ2F0ZXdheS5BcGlLZXkodGhpcywgJ215YXBpa2V5Jyk7XG4gICAgdXNhZ2VwbGFuLmFkZEFwaUtleShhcGlrZXkpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbmNvbnN0IHRlc3QgPSBuZXcgQ3JlYXRlKGFwcCwgJ3Rlc3QtYXBpZ2F0ZXdheS11c2FnZXBsYW4tY3JlYXRlJyk7XG5uZXcgSW1wb3J0KGFwcCwgJ3Rlc3QtYXBpZ2F0ZXdheS11c2FnZXBsYW4taW1wb3J0Jywge1xuICB1c2FnZVBsYW46IHRlc3QudXNhZ2VQbGFuLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-create.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-create.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-create.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-create.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-import.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-import.template.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-import.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/test-apigateway-usageplan-import.template.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.ts similarity index 84% rename from packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.ts index 58ffe84234367..bb13533221f37 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integ.usage-plan.sharing.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.usage-plan.sharing.ts @@ -1,7 +1,7 @@ /// !cdk-integ * -import * as cdk from '@aws-cdk/core'; -import * as apigateway from '../lib'; -import { IUsagePlan } from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +import { IUsagePlan } from 'aws-cdk-lib/aws-apigateway'; class Create extends cdk.Stack { public usagePlan: IUsagePlan; diff --git a/packages/@aws-cdk/aws-apigateway/test/sample-definition.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/sample-definition.yaml similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/sample-definition.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/sample-definition.yaml diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.d.ts new file mode 100644 index 0000000000000..bad9eaec3e91c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.d.ts @@ -0,0 +1,2 @@ +import * as cdk from 'aws-cdk-lib'; +export declare const app: cdk.App; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js new file mode 100644 index 0000000000000..429847cb8f886 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js @@ -0,0 +1,393 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.app = void 0; +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cloudmap = require("aws-cdk-lib/aws-servicediscovery"); +const cdk = require("aws-cdk-lib"); +const appmesh = require("aws-cdk-lib/aws-appmesh"); +exports.app = new cdk.App(); +const stack = new cdk.Stack(exports.app, 'mesh-stack', {}); +const vpc = new ec2.Vpc(stack, 'vpc', { + natGateways: 1, +}); +const namespace = new cloudmap.PrivateDnsNamespace(stack, 'test-namespace', { + vpc, + name: 'domain.local', +}); +const mesh = new appmesh.Mesh(stack, 'mesh'); +new appmesh.Mesh(stack, 'mesh-with-preference', { + serviceDiscovery: { + ipPreference: appmesh.IpPreference.IPV4_ONLY, + }, +}); +const router = mesh.addVirtualRouter('router', { + listeners: [ + appmesh.VirtualRouterListener.http(), + ], +}); +const virtualService = new appmesh.VirtualService(stack, 'service', { + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router), + virtualServiceName: 'service1.domain.local', +}); +const node = mesh.addVirtualNode('node', { + serviceDiscovery: appmesh.ServiceDiscovery.dns(`node1.${namespace.namespaceName}`, undefined, appmesh.IpPreference.IPV4_ONLY), + listeners: [appmesh.VirtualNodeListener.http({ + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + path: '/check-path', + }), + })], + backends: [appmesh.Backend.virtualService(virtualService)], +}); +node.addBackend(appmesh.Backend.virtualService(new appmesh.VirtualService(stack, 'service-2', { + virtualServiceName: 'service2.domain.local', + virtualServiceProvider: appmesh.VirtualServiceProvider.none(mesh), +}))); +router.addRoute('route-1', { + routeSpec: appmesh.RouteSpec.http({ + weightedTargets: [ + { + virtualNode: node, + weight: 50, + }, + ], + match: { + path: appmesh.HttpRoutePathMatch.startsWith('/'), + }, + timeout: { + idle: cdk.Duration.seconds(10), + perRequest: cdk.Duration.seconds(10), + }, + }), +}); +const node2 = mesh.addVirtualNode('node2', { + serviceDiscovery: appmesh.ServiceDiscovery.dns(`node2.${namespace.namespaceName}`), + listeners: [appmesh.VirtualNodeListener.http({ + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + interval: cdk.Duration.seconds(5), + path: '/check-path2', + timeout: cdk.Duration.seconds(2), + unhealthyThreshold: 2, + }), + })], + backendDefaults: { + tlsClientPolicy: { + validation: { + trust: appmesh.TlsValidationTrust.file('path/to/cert'), + }, + }, + }, + backends: [appmesh.Backend.virtualService(new appmesh.VirtualService(stack, 'service-3', { + virtualServiceName: 'service3.domain.local', + virtualServiceProvider: appmesh.VirtualServiceProvider.none(mesh), + }))], +}); +const node3 = mesh.addVirtualNode('node3', { + serviceDiscovery: appmesh.ServiceDiscovery.dns(`node3.${namespace.namespaceName}`), + listeners: [appmesh.VirtualNodeListener.http({ + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + interval: cdk.Duration.seconds(5), + path: '/check-path3', + timeout: cdk.Duration.seconds(2), + unhealthyThreshold: 2, + }), + })], + backendDefaults: { + tlsClientPolicy: { + validation: { + trust: appmesh.TlsValidationTrust.file('path-to-certificate'), + }, + }, + }, + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), +}); +const node4 = mesh.addVirtualNode('node4', { + serviceDiscovery: appmesh.ServiceDiscovery.dns(`node4.${namespace.namespaceName}`, appmesh.DnsResponseType.ENDPOINTS), + listeners: [appmesh.VirtualNodeListener.http({ + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.sds('spiffe://domain.local/backend-service'), + mutualTlsValidation: { + trust: appmesh.TlsValidationTrust.sds('spiffe://domain.local'), + subjectAlternativeNames: appmesh.SubjectAlternativeNames.matchingExactly('client.domain.local'), + }, + }, + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + interval: cdk.Duration.seconds(5), + path: '/check-path3', + timeout: cdk.Duration.seconds(2), + unhealthyThreshold: 2, + }), + })], + backendDefaults: { + tlsClientPolicy: { + mutualTlsCertificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'), + validation: { + subjectAlternativeNames: appmesh.SubjectAlternativeNames.matchingExactly('mymesh.local'), + trust: appmesh.TlsValidationTrust.file('path-to-certificate'), + }, + }, + }, + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), +}); +node4.addBackend(appmesh.Backend.virtualService(new appmesh.VirtualService(stack, 'service-4', { + virtualServiceName: 'service4.domain.local', + virtualServiceProvider: appmesh.VirtualServiceProvider.none(mesh), +}))); +router.addRoute('route-2', { + routeSpec: appmesh.RouteSpec.http({ + weightedTargets: [ + { + virtualNode: node2, + weight: 30, + }, + ], + match: { + path: appmesh.HttpRoutePathMatch.startsWith('/path2'), + }, + timeout: { + idle: cdk.Duration.seconds(11), + perRequest: cdk.Duration.seconds(11), + }, + }), +}); +router.addRoute('route-3', { + routeSpec: appmesh.RouteSpec.tcp({ + weightedTargets: [ + { + virtualNode: node3, + weight: 20, + }, + ], + timeout: { + idle: cdk.Duration.seconds(12), + }, + }), +}); +router.addRoute('route-4', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [ + { + virtualNode: node4, + weight: 20, + }, + ], + timeout: { + idle: cdk.Duration.seconds(12), + }, + match: { + serviceName: 'test', + }, + }), +}); +router.addRoute('route-matching', { + routeSpec: appmesh.RouteSpec.http2({ + weightedTargets: [{ virtualNode: node3 }], + match: { + path: appmesh.HttpRoutePathMatch.startsWith('/'), + method: appmesh.HttpRouteMethod.POST, + protocol: appmesh.HttpRouteProtocol.HTTPS, + headers: [ + appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueStartsWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueEndsWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueMatchesRegex('Content-Type', 'application/.*'), + appmesh.HeaderMatch.valuesIsInRange('Content-Type', 1, 5), + appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueDoesNotStartWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueDoesNotEndWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueDoesNotMatchRegex('Content-Type', 'application/.*'), + appmesh.HeaderMatch.valuesIsNotInRange('Content-Type', 1, 5), + ], + }, + }), +}); +router.addRoute('route-http2-retry', { + routeSpec: appmesh.RouteSpec.http2({ + weightedTargets: [{ virtualNode: node3 }], + retryPolicy: { + httpRetryEvents: [appmesh.HttpRetryEvent.CLIENT_ERROR], + tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR], + retryAttempts: 5, + retryTimeout: cdk.Duration.seconds(1), + }, + }), +}); +router.addRoute('route-5', { + routeSpec: appmesh.RouteSpec.http2({ + priority: 10, + weightedTargets: [{ virtualNode: node2 }], + }), +}); +router.addRoute('route-grpc-retry', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [{ virtualNode: node3 }], + match: { serviceName: 'servicename' }, + retryPolicy: { + grpcRetryEvents: [appmesh.GrpcRetryEvent.DEADLINE_EXCEEDED], + httpRetryEvents: [appmesh.HttpRetryEvent.CLIENT_ERROR], + tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR], + retryAttempts: 5, + retryTimeout: cdk.Duration.seconds(1), + }, + }), +}); +router.addRoute('route-6', { + routeSpec: appmesh.RouteSpec.http2({ + weightedTargets: [ + { + virtualNode: node2, + weight: 30, + }, + ], + match: { + path: appmesh.HttpRoutePathMatch.regex('regex'), + queryParameters: [ + appmesh.QueryParameterMatch.valueIs('query-field', 'value'), + ], + }, + }), +}); +router.addRoute('route-7', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [ + { + virtualNode: node4, + weight: 20, + }, + ], + match: { + serviceName: 'test-service', + methodName: 'test-method', + metadata: [ + appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'), + ], + }, + }), +}); +const gateway = mesh.addVirtualGateway('gateway1', { + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), + virtualGatewayName: 'gateway1', +}); +new appmesh.VirtualGateway(stack, 'gateway2', { + mesh: mesh, + listeners: [appmesh.VirtualGatewayListener.http({ + port: 443, + healthCheck: appmesh.HealthCheck.http({ + interval: cdk.Duration.seconds(10), + }), + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'), + }, + })], +}); +new appmesh.VirtualGateway(stack, 'gateway3', { + mesh: mesh, + listeners: [appmesh.VirtualGatewayListener.http({ + port: 443, + healthCheck: appmesh.HealthCheck.http({ + interval: cdk.Duration.seconds(10), + }), + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.sds('secret_certificate'), + mutualTlsValidation: { + trust: appmesh.TlsValidationTrust.file('path/to/certChain'), + }, + }, + })], + backendDefaults: { + tlsClientPolicy: { + mutualTlsCertificate: appmesh.TlsCertificate.sds('secret_validation'), + validation: { + trust: appmesh.TlsValidationTrust.file('path/to/certChain'), + }, + }, + }, +}); +gateway.addGatewayRoute('gateway1-route-http', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + }), +}); +gateway.addGatewayRoute('gateway1-route-http-2', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + match: { + path: appmesh.HttpGatewayRoutePathMatch.startsWith('/', ''), + hostname: appmesh.GatewayRouteHostnameMatch.exactly('example.com'), + method: appmesh.HttpRouteMethod.POST, + headers: [ + appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueStartsWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueEndsWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueMatchesRegex('Content-Type', 'application/.*'), + appmesh.HeaderMatch.valuesIsInRange('Content-Type', 1, 5), + appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueDoesNotStartWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueDoesNotEndWith('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueDoesNotMatchRegex('Content-Type', 'application/.*'), + appmesh.HeaderMatch.valuesIsNotInRange('Content-Type', 1, 5), + ], + queryParameters: [ + appmesh.QueryParameterMatch.valueIs('query-field', 'value'), + ], + rewriteRequestHostname: true, + }, + }), +}); +gateway.addGatewayRoute('gateway1-route-http2', { + routeSpec: appmesh.GatewayRouteSpec.http2({ + routeTarget: virtualService, + }), +}); +gateway.addGatewayRoute('gateway1-route-http2-2', { + routeSpec: appmesh.GatewayRouteSpec.http2({ + routeTarget: virtualService, + match: { + path: appmesh.HttpGatewayRoutePathMatch.exactly('/exact', '/rewrittenpath'), + }, + }), +}); +gateway.addGatewayRoute('gateway1-route-http2-3', { + routeSpec: appmesh.GatewayRouteSpec.http2({ + routeTarget: virtualService, + match: { + path: appmesh.HttpGatewayRoutePathMatch.regex('regex'), + }, + }), +}); +gateway.addGatewayRoute('gateway1-route-grpc', { + routeSpec: appmesh.GatewayRouteSpec.grpc({ + routeTarget: virtualService, + match: { + serviceName: virtualService.virtualServiceName, + }, + }), +}); +gateway.addGatewayRoute('gateway1-route-grpc-2', { + routeSpec: appmesh.GatewayRouteSpec.grpc({ + routeTarget: virtualService, + match: { + hostname: appmesh.GatewayRouteHostnameMatch.exactly('example.com'), + metadata: [ + appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueIsNot('Content-Type', 'text/html'), + appmesh.HeaderMatch.valueStartsWith('Content-Type', 'application/'), + appmesh.HeaderMatch.valueDoesNotStartWith('Content-Type', 'text/'), + appmesh.HeaderMatch.valueEndsWith('Content-Type', '/json'), + appmesh.HeaderMatch.valueDoesNotEndWith('Content-Type', '/json+foobar'), + appmesh.HeaderMatch.valueMatchesRegex('Content-Type', 'application/.*'), + appmesh.HeaderMatch.valueDoesNotMatchRegex('Content-Type', 'text/.*'), + appmesh.HeaderMatch.valuesIsInRange('Max-Forward', 1, 5), + appmesh.HeaderMatch.valuesIsNotInR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hZGVyTWF0Y2gudmFsdWVNYXRjaGVzUmVnZXgoJ0NvbnRlbnQtVHlwZScsICdhcHBsaWNhdGlvbi8uKicpLFxuICAgICAgICBhcHBtZXNoLkhlYWRlck1hdGNoLnZhbHVlRG9lc05vdE1hdGNoUmVnZXgoJ0NvbnRlbnQtVHlwZScsICd0ZXh0Ly4qJyksXG4gICAgICAgIGFwcG1lc2guSGVhZGVyTWF0Y2gudmFsdWVzSXNJblJhbmdlKCdNYXgtRm9yd2FyZCcsIDEsIDUpLFxuICAgICAgICBhcHBtZXNoLkhlYWRlck1hdGNoLnZhbHVlc0lzTm90SW5SYW5nZSgnTWF4LUZvcndhcmQnLCAxLCA1KSxcbiAgICAgIF0sXG4gICAgICByZXdyaXRlUmVxdWVzdEhvc3RuYW1lOiBmYWxzZSxcbiAgICB9LFxuICB9KSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.assets.json diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/mesh-stack.template.json diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/test/integ.mesh.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.ts index 7d731d1c41e3e..3ded552185eb6 100644 --- a/packages/@aws-cdk/aws-appmesh/test/integ.mesh.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appmesh/test/integ.mesh.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import * as cdk from '@aws-cdk/core'; -import * as appmesh from '../lib/'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cloudmap from 'aws-cdk-lib/aws-servicediscovery'; +import * as cdk from 'aws-cdk-lib'; +import * as appmesh from 'aws-cdk-lib/aws-appmesh'; export const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.auth.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.auth.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/appsync.auth.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.auth.graphql diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.js-resolver.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.js-resolver.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/appsync.js-resolver.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.js-resolver.graphql diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.lambda.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.lambda.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/appsync.lambda.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.lambda.graphql diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.none.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.none.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/appsync.none.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.none.graphql diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.test.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.test.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/appsync.test.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.test.graphql diff --git a/packages/@aws-cdk/aws-appsync/test/integ-assets/appsync-js-pipeline.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ-assets/appsync-js-pipeline.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ-assets/appsync-js-pipeline.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ-assets/appsync-js-pipeline.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ-assets/appsync-js-resolver.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ-assets/appsync-js-resolver.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ-assets/appsync-js-resolver.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ-assets/appsync-js-resolver.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ-assets/js-resolver-assertion/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ-assets/js-resolver-assertion/index.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ-assets/js-resolver-assertion/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ-assets/js-resolver-assertion/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js new file mode 100644 index 0000000000000..f0da224cfcab5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js @@ -0,0 +1,79 @@ +"use strict"; +/// !cdk-integ * +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const db = require("aws-cdk-lib/aws-dynamodb"); +const cdk = require("aws-cdk-lib"); +const appsync = require("aws-cdk-lib/aws-appsync"); +/* + * Creates an Appsync GraphQL API in a separate stack. + * Add dependencies to imported api. + * + * Stack verification steps: + * Install dependencies and deploy integration test. Check if data sources are + * connected to the GraphQL Api + * + * -- cdk deploy --app 'node integ.api-import.js' stack -- start -- + * -- aws appsync list-graphql-apis -- obtain api id -- + * -- aws appsync list-data-sources --api-id [api_id] -- testDS/None -- + * -- cdk destroy --app 'node integ.api-import.js' stack baseStack -- clean -- + */ +const app = new cdk.App(); +const baseStack = new cdk.Stack(app, 'baseStack'); +const baseApi = new appsync.GraphqlApi(baseStack, 'baseApi', { + name: 'baseApi', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), +}); +const stack = new cdk.Stack(app, 'stack'); +const api = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'Api', { + graphqlApiId: `${baseApi.apiId}`, +}); +const testTable = new db.Table(stack, 'TestTable', { + billingMode: db.BillingMode.PAY_PER_REQUEST, + partitionKey: { + name: 'id', + type: db.AttributeType.STRING, + }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const testDS = api.addDynamoDbDataSource('ds', testTable); +testDS.createResolver('QueryGetTests', { + typeName: 'Query', + fieldName: 'getTests', + requestMappingTemplate: appsync.MappingTemplate.dynamoDbScanTable(), + responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), +}); +testDS.createResolver('MutationAddTest', { + typeName: 'Mutation', + fieldName: 'addTest', + requestMappingTemplate: appsync.MappingTemplate.dynamoDbPutItem(appsync.PrimaryKey.partition('id').auto(), appsync.Values.projecting('test')), + responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultItem(), +}); +const api2 = appsync.GraphqlApi.fromGraphqlApiAttributes(stack, 'api2', { + graphqlApiId: baseApi.apiId, + graphqlApiArn: baseApi.arn, +}); +const none = api2.addNoneDataSource('none'); +const func = none.createFunction('PipelineFunction', { + name: 'pipeline_function', + requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + })), + responseMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: 'v1', + })), +}); +new appsync.Resolver(stack, 'pipeline_resolver', { + api: api2, + typeName: 'test', + fieldName: 'version', + pipelineConfig: [func], + requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + })), + responseMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: 'v1', + })), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBpLWltcG9ydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFwaS1pbXBvcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGdCQUFnQjs7QUFFaEIsNkJBQTZCO0FBQzdCLCtDQUErQztBQUMvQyxtQ0FBbUM7QUFDbkMsbURBQW1EO0FBRW5EOzs7Ozs7Ozs7Ozs7R0FZRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sU0FBUyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsV0FBVyxDQUFDLENBQUM7QUFFbEQsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsVUFBVSxDQUFDLFNBQVMsRUFBRSxTQUFTLEVBQUU7SUFDM0QsSUFBSSxFQUFFLFNBQVM7SUFDZixNQUFNLEVBQUUsT0FBTyxDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztDQUNuRixDQUFDLENBQUM7QUFFSCxNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBQzFDLE1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TT04uc3RyaW5naWZ5KHtcbiAgICB2ZXJzaW9uOiAndjEnLFxuICB9KSksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/baseStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/baseStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/baseStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/baseStack.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/stack.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.api-import.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.ts similarity index 95% rename from packages/@aws-cdk/aws-appsync/test/integ.api-import.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.ts index 451c4357c81aa..ab74a2a84a64c 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.api-import.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.api-import.ts @@ -1,9 +1,9 @@ /// !cdk-integ * import * as path from 'path'; -import * as db from '@aws-cdk/aws-dynamodb'; -import * as cdk from '@aws-cdk/core'; -import * as appsync from '../lib'; +import * as db from 'aws-cdk-lib/aws-dynamodb'; +import * as cdk from 'aws-cdk-lib'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; /* * Creates an Appsync GraphQL API in a separate stack. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js new file mode 100644 index 0000000000000..345803a7571ca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js @@ -0,0 +1,76 @@ +"use strict"; +/// !cdk-integ * +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const appsync = require("aws-cdk-lib/aws-appsync"); +/* + * Creates an Appsync GraphQL API and schema in a code-first approach. + * + * Stack verification steps: + * Deploy stack, get api key and endpoinScalarType. Check if schema connects to data source. + * + * -- bash verify.integ.appsync-lambda.sh --start -- start -- + * -- aws appsync list-graphql-apis -- obtain apiId & endpoint -- + * -- aws appsync list-api-keys --api-id [apiId] -- obtain api key -- + * -- bash verify.integ.appsync-lambda.sh --check [apiKey] [url] -- check if success -- + * -- bash verify.integ.appsync-lambda.sh --clean -- clean -- + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'stack'); +const api = new appsync.GraphqlApi(stack, 'LambdaAPI', { + name: 'LambdaAPI', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.lambda.graphql')), +}); +const func = new lambda.Function(stack, 'func', { + code: lambda.Code.fromAsset(path.join(__dirname, 'verify/lambda-tutorial')), + handler: 'lambda-tutorial.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const lambdaDS = api.addLambdaDataSource('LambdaDS', func); +const requestPayload = (field, { withArgs = false, withSource = false }) => { + const _field = `"field": "${field}"`; + const _args = '"arguments": $utils.toJson($context.arguments)'; + const _source = '"source": $utils.toJson($context.source)'; + const _payload = [_field]; + if (withArgs) + _payload.push(_args); + if (withSource) + _payload.push(_source); + return _payload.reduce((acc, v) => `${acc} ${v},`, '{').slice(0, -1) + '}'; +}; +const responseMappingTemplate = appsync.MappingTemplate.lambdaResult(); +lambdaDS.createResolver('QueryGetPost', { + typeName: 'Query', + fieldName: 'getPost', + requestMappingTemplate: appsync.MappingTemplate.lambdaRequest(requestPayload('getPost', { withArgs: true })), + responseMappingTemplate, +}); +lambdaDS.createResolver('QueryAllPosts', { + typeName: 'Query', + fieldName: 'allPosts', + requestMappingTemplate: appsync.MappingTemplate.lambdaRequest(requestPayload('allPosts', {})), + responseMappingTemplate, +}); +lambdaDS.createResolver('MutationAddPost', { + typeName: 'Mutation', + fieldName: 'addPost', + requestMappingTemplate: appsync.MappingTemplate.lambdaRequest(requestPayload('addPost', { withArgs: true })), + responseMappingTemplate, +}); +lambdaDS.createResolver('PostRelatedPosts', { + typeName: 'Post', + fieldName: 'relatedPosts', + requestMappingTemplate: appsync.MappingTemplate.lambdaRequest(requestPayload('relatedPosts', { withSource: true }), 'BatchInvoke'), + responseMappingTemplate, +}); +lambdaDS.createResolver('PostRelatedPostsMaxBatchSize', { + typeName: 'Post', + fieldName: 'relatedPostsMaxBatchSize', + requestMappingTemplate: appsync.MappingTemplate.lambdaRequest(requestPayload('relatedPostsMaxBatchSize', { withSource: true }), 'BatchInvoke'), + responseMappingTemplate, + maxBatchSize: 2, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBwc3luYy1sYW1iZGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hcHBzeW5jLWxhbWJkYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsZ0JBQWdCOztBQUVoQiw2QkFBNkI7QUFDN0IsaURBQWlEO0FBQ2pELG1DQUFtQztBQUNuQyxtREFBbUQ7QUFFbkQ7Ozs7Ozs7Ozs7O0dBV0c7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBRTFDLE1BQU0sR0FBRyxHQUFH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af9fa85591ad93f3353790f242fca60881a6ec73/lambda-tutorial.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/asset.8deae95d7935a4885bfc15a9af9fa85591ad93f3353790f242fca60881a6ec73/lambda-tutorial.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/asset.8deae95d7935a4885bfc15a9af9fa85591ad93f3353790f242fca60881a6ec73/lambda-tutorial.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/asset.8deae95d7935a4885bfc15a9af9fa85591ad93f3353790f242fca60881a6ec73/lambda-tutorial.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/stack.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.ts similarity index 95% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.ts index 365d8b328135a..50492141633fb 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.appsync-lambda.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-lambda.ts @@ -1,9 +1,9 @@ /// !cdk-integ * import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as appsync from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; /* * Creates an Appsync GraphQL API and schema in a code-first approach. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js new file mode 100644 index 0000000000000..cbdbd8bd54d12 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const appsync = require("aws-cdk-lib/aws-appsync"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'stack'); +const api = new appsync.GraphqlApi(stack, 'NoneAPI', { + name: 'NoneAPI', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.none.graphql')), +}); +api.addNoneDataSource('NoneDS', { + name: cdk.Lazy.string({ produce() { return 'NoneDS'; } }), +}); +new integ_tests_alpha_1.IntegTest(app, 'api', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBwc3luYy1ub25lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXBwc3luYy1ub25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsbURBQW1EO0FBRW5ELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFFMUMsTUFBTSxHQUFHLEdBQUcsSUFBSSxPQUFPLENBQ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Y2hlbWFGaWxlLmZyb21Bc3NldChwYXRoLmpvaW4oX19kaXJuYW1lLCAnYXBwc3luYy5ub25lLmdyYXBocWwnKSksXG59KTtcblxuYXBpLmFkZE5vbmVEYXRhU291cmNlKCdOb25lRFMnLCB7XG4gIG5hbWU6IGNkay5MYXp5LnN0cmluZyh7IHByb2R1Y2UoKTogc3RyaW5nIHsgcmV0dXJuICdOb25lRFMnOyB9IH0pLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnYXBpJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/apiDefaultTestDeployAssert018781F2.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/stack.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/stack.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.ts similarity index 75% rename from packages/@aws-cdk/aws-appsync/test/integ.appsync-none.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.ts index 20d8922210d1a..503637bb6633d 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.appsync-none.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.appsync-none.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as appsync from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'stack'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js new file mode 100644 index 0000000000000..eb90883d2206b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path_1 = require("path"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_appsync_1 = require("aws-cdk-lib/aws-appsync"); +/* + * Creates an Appsync GraphQL API with API_KEY authorization. + * Testing for API_KEY Authorization. + * + * Stack verification steps: + * Deploy stack, get api-key and endpoint. + * Check if authorization occurs with empty get. + * + * -- bash verify.integ.auth-apikey.sh --start -- deploy stack -- + * -- aws appsync list-graphql-apis -- obtain api id && endpoint -- + * -- aws appsync list-api-keys --api-id [API ID] -- obtain api key -- + * -- bash verify.integ.auth-apikey.sh --check [APIKEY] [ENDPOINT] -- check if fails/success -- + * -- bash verify.integ.auth-apikey.sh --clean -- clean dependencies/stack -- + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-appsync-integ'); +const api = new aws_appsync_1.GraphqlApi(stack, 'Api', { + name: 'Integ_Test_APIKey', + schema: aws_appsync_1.SchemaFile.fromAsset((0, path_1.join)(__dirname, 'appsync.auth.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: aws_appsync_1.AuthorizationType.API_KEY, + apiKeyConfig: { + // Rely on default expiration date provided by the API so we have a deterministic snapshot + expires: undefined, + }, + }, + }, +}); +const testTable = new aws_dynamodb_1.Table(stack, 'TestTable', { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: { + name: 'id', + type: aws_dynamodb_1.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const testDS = api.addDynamoDbDataSource('testDataSource', testTable); +testDS.createResolver('QueryGetTests', { + typeName: 'Query', + fieldName: 'getTests', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbScanTable(), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +testDS.createResolver('MutationAddTest', { + typeName: 'Mutation', + fieldName: 'addTest', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbPutItem(aws_appsync_1.PrimaryKey.partition('id').auto(), aws_appsync_1.Values.projecting('test')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXV0aC1hcGlrZXkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hdXRoLWFwaWtleS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtCQUE0QjtBQUM1QiwyREFBNkU7QUFDN0UsNkNBQXdEO0FBQ3hELHlEQUF5SDtBQUV6SDs7Ozs7Ozs7Ozs7OztHQWFHO0FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBRWxELE1BQU0sR0FBRyxHQUFHLElBQUksd0JBQVUsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ3ZDLElBQUksRUFBRSxtQkFBbUI7SUFDekIsTUFBTSxFQUFFLHdCQUFVLENBQUMsU0FBUyxDQUFDLElBQUEsV0FBSSxFQUFDLFNBQVMsRUFBRSxzQkFBc0IsQ0FBQyxDQUFDO0lBQ3JFLG1CQUFtQixFQUFFO1FBQ25CLG9CQUFvQixFQUFFO1lBQ3BCLGlCQUFpQixFQUFFLCtCQUFpQixDQUFDLE9BQU87WUFDNUMsWUFBWSxFQUFFO2dCQUNaLDBGQUEwRjtnQkFDMUYsT0FBTyxFQUFFLFNBQVM7YUFDbkI7U0FDRjtLQUNGO0NBQ0YsQ0FBQyxDQUFDO0FBRUgsTUFBTSxTQUFTLEdBQUcsSUFBSSxvQkFBSyxDQUFDLEtBQUssRUFBRSxXQUFXLEVBQUU7SUFDOUMsV0FBVyxFQUFFLDBCQUFXLENBQUMsZUFBZTtJQUN4QyxZQUFZLEVBQUU7UUFDW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PWSxcbn0pO1xuXG5jb25zdCB0ZXN0RFMgPSBhcGkuYWRkRHluYW1vRGJEYXRhU291cmNlKCd0ZXN0RGF0YVNvdXJjZScsIHRlc3RUYWJsZSk7XG5cbnRlc3REUy5jcmVhdGVSZXNvbHZlcignUXVlcnlHZXRUZXN0cycsIHtcbiAgdHlwZU5hbWU6ICdRdWVyeScsXG4gIGZpZWxkTmFtZTogJ2dldFRlc3RzJyxcbiAgcmVxdWVzdE1hcHBpbmdUZW1wbGF0ZTogTWFwcGluZ1RlbXBsYXRlLmR5bmFtb0RiU2NhblRhYmxlKCksXG4gIHJlc3BvbnNlTWFwcGluZ1RlbXBsYXRlOiBNYXBwaW5nVGVtcGxhdGUuZHluYW1vRGJSZXN1bHRMaXN0KCksXG59KTtcblxudGVzdERTLmNyZWF0ZVJlc29sdmVyKCdNdXRhdGlvbkFkZFRlc3QnLCB7XG4gIHR5cGVOYW1lOiAnTXV0YXRpb24nLFxuICBmaWVsZE5hbWU6ICdhZGRUZXN0JyxcbiAgcmVxdWVzdE1hcHBpbmdUZW1wbGF0ZTogTWFwcGluZ1RlbXBsYXRlLmR5bmFtb0RiUHV0SXRlbShQcmltYXJ5S2V5LnBhcnRpdGlvbignaWQnKS5hdXRvKCksIFZhbHVlcy5wcm9qZWN0aW5nKCd0ZXN0JykpLFxuICByZXNwb25zZU1hcHBpbmdUZW1wbGF0ZTogTWFwcGluZ1RlbXBsYXRlLmR5bmFtb0RiUmVzdWx0SXRlbSgpLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/aws-appsync-integ.template.json diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.ts similarity index 91% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.ts index 234f3595aa112..64f24259b7208 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.auth-apikey.ts @@ -1,7 +1,7 @@ import { join } from 'path'; -import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { AuthorizationType, GraphqlApi, MappingTemplate, PrimaryKey, SchemaFile, Values } from '../lib'; +import { AttributeType, BillingMode, Table } from 'aws-cdk-lib/aws-dynamodb'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { AuthorizationType, GraphqlApi, MappingTemplate, PrimaryKey, SchemaFile, Values } from 'aws-cdk-lib/aws-appsync'; /* * Creates an Appsync GraphQL API with API_KEY authorization. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js new file mode 100644 index 0000000000000..b8ff09001d7a0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const appsync = require("aws-cdk-lib/aws-appsync"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'appsync-elasticsearch'); +const user = new aws_iam_1.User(stack, 'User'); +const domain = new es.Domain(stack, 'Domain', { + version: es.ElasticsearchVersion.V7_1, + removalPolicy: cdk.RemovalPolicy.DESTROY, + fineGrainedAccessControl: { + masterUserArn: user.userArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, +}); +const api = new appsync.GraphqlApi(stack, 'api', { + name: 'api', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), +}); +const ds = api.addElasticsearchDataSource('ds', domain); +ds.createResolver('QueryGetTests', { + typeName: 'Query', + fieldName: 'getTests', + requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + operation: 'GET', + path: '/id/post/_search', + params: { + headers: {}, + queryString: {}, + body: { + from: 0, + size: 50, + }, + }, + })), + responseMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + operation: 'GET', + path: '/id/post/_search', + params: { + headers: {}, + queryString: {}, + body: { + from: 0, + size: 50, + query: { + term: { + author: '$util.toJson($context.arguments.author)', + }, + }, + }, + }, + })), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3JhcGhxbC1lbGFzdGljc2VhcmNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ3JhcGhxbC1lbGFzdGljc2VhcmNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiO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dXRob3I6ICckdXRpbC50b0pzb24oJGNvbnRleHQuYXJndW1lbnRzLmF1dGhvciknLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgIH0sXG4gIH0pKSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/appsync-elasticsearch.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.auth-apikey.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.ts similarity index 88% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.ts index e8b25d9f47538..c7db6c47bf37d 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-elasticsearch.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as es from '@aws-cdk/aws-elasticsearch'; -import { User } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as appsync from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; +import { User } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'appsync-elasticsearch'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.graphql diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js new file mode 100644 index 0000000000000..b1829e03c67d6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path_1 = require("path"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_appsync_1 = require("aws-cdk-lib/aws-appsync"); +/* + * Creates an Appsync GraphQL API and Lambda with IAM Roles. + * Testing for IAM Auth and grantFullAccess. + * + * Stack verification steps: + * Install dependencies and deploy integration test. Invoke Lambda + * function with different permissions to test policies. + * + * -- bash verify.integ.graphql-iam.sh --start -- get dependencies/deploy -- + * -- aws lambda list-functions -- obtain testFail/testQuery -- + * -- aws lambda invoke /dev/stdout --function-name [FAIL] -- fails beacuse no IAM Role` -- + * -- aws lambda invoke /dev/stdout --function-name [Query]-- succeeds with empty get ` -- + * -- bash verify.integ.graphql-iam.sh --clean -- clean dependencies/deploy -- + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-appsync-integ'); +const userPool = new aws_cognito_1.UserPool(stack, 'Pool', { + userPoolName: 'myPool', +}); +const api = new aws_appsync_1.GraphqlApi(stack, 'Api', { + name: 'Integ_Test_IAM', + schema: aws_appsync_1.SchemaFile.fromAsset((0, path_1.join)(__dirname, 'integ.graphql-iam.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: aws_appsync_1.AuthorizationType.USER_POOL, + userPoolConfig: { + userPool, + defaultAction: aws_appsync_1.UserPoolDefaultAction.ALLOW, + }, + }, + additionalAuthorizationModes: [ + { + authorizationType: aws_appsync_1.AuthorizationType.IAM, + }, + ], + }, +}); +const testTable = new aws_dynamodb_1.Table(stack, 'TestTable', { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: { + name: 'id', + type: aws_dynamodb_1.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const testDS = api.addDynamoDbDataSource('ds', testTable, { name: 'testDataSource' }); +testDS.createResolver('QueryGetTest', { + typeName: 'Query', + fieldName: 'getTest', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbGetItem('id', 'id'), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +testDS.createResolver('QueryGetTests', { + typeName: 'Query', + fieldName: 'getTests', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbScanTable(), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +testDS.createResolver('MutationAddTest', { + typeName: 'Mutation', + fieldName: 'addTest', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbPutItem(aws_appsync_1.PrimaryKey.partition('id').auto(), aws_appsync_1.Values.projecting('test')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +const lambdaIAM = new aws_iam_1.Role(stack, 'LambdaIAM', { assumedBy: new aws_iam_1.ServicePrincipal('lambda') }); +api.grant(lambdaIAM, aws_appsync_1.IamResource.custom('types/Query/fields/getTests'), 'appsync:graphql'); +api.grant(lambdaIAM, aws_appsync_1.IamResource.ofType('test'), 'appsync:GraphQL'); +api.grantMutation(lambdaIAM, 'addTest'); +new aws_lambda_1.Function(stack, 'testQuery', { + code: aws_lambda_1.Code.fromAsset((0, path_1.join)(__dirname, 'verify/iam-query')), + handler: 'iam-query.handler', + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + environment: { APPSYNC_ENDPOINT: api.graphqlUrl }, + role: lambdaIAM, +}); +new aws_lambda_1.Function(stack, 'testFail', { + code: aws_lambda_1.Code.fromAsset((0, path_1.join)(__dirname, 'verify/iam-query')), + handler: 'iam-query.handler', + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + environment: { APPSYNC_ENDPOINT: api.graphqlUrl }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3JhcGhxbC1pYW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5ncmFwaHFsLWlhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtCQUE0QjtBQUM1Qix5REFBbUQ7QUFDbkQsMkRBQTZFO0FBQzdFLGlEQUE2RDtBQUM3RCx1REFBaUU7QUFDakUsNkNBQXdEO0FBQ3hELHlEQVNpQztBQUVqQzs7Ozs7Ozs7Ozs7OztHQWFHO0FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFL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nYXBwc3luYzpncmFwaHFsJyk7XG5hcGkuZ3JhbnQobGFtYmRhSUFNLCBJYW1SZXNvdXJjZS5vZlR5cGUoJ3Rlc3QnKSwgJ2FwcHN5bmM6R3JhcGhRTCcpO1xuYXBpLmdyYW50TXV0YXRpb24obGFtYmRhSUFNLCAnYWRkVGVzdCcpO1xuXG5uZXcgRnVuY3Rpb24oc3RhY2ssICd0ZXN0UXVlcnknLCB7XG4gIGNvZGU6IENvZGUuZnJvbUFzc2V0KGpvaW4oX19kaXJuYW1lLCAndmVyaWZ5L2lhbS1xdWVyeScpKSxcbiAgaGFuZGxlcjogJ2lhbS1xdWVyeS5oYW5kbGVyJyxcbiAgcnVudGltZTogUnVudGltZS5OT0RFSlNfMTRfWCxcbiAgZW52aXJvbm1lbnQ6IHsgQVBQU1lOQ19FTkRQT0lOVDogYXBpLmdyYXBocWxVcmwgfSxcbiAgcm9sZTogbGFtYmRhSUFNLFxufSk7XG5uZXcgRnVuY3Rpb24oc3RhY2ssICd0ZXN0RmFpbCcsIHtcbiAgY29kZTogQ29kZS5mcm9tQXNzZXQoam9pbihfX2Rpcm5hbWUsICd2ZXJpZnkvaWFtLXF1ZXJ5JykpLFxuICBoYW5kbGVyOiAnaWFtLXF1ZXJ5LmhhbmRsZXInLFxuICBydW50aW1lOiBSdW50aW1lLk5PREVKU18xNF9YLFxuICBlbnZpcm9ubWVudDogeyBBUFBTWU5DX0VORFBPSU5UOiBhcGkuZ3JhcGhxbFVybCB9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/asset.f38244b9028d22d4e265a5b466bdba928d93b5a4ac2b4bbf583309b3f027f044/iam-query.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/asset.f38244b9028d22d4e265a5b466bdba928d93b5a4ac2b4bbf583309b3f027f044/iam-query.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/asset.f38244b9028d22d4e265a5b466bdba928d93b5a4ac2b4bbf583309b3f027f044/iam-query.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/asset.f38244b9028d22d4e265a5b466bdba928d93b5a4ac2b4bbf583309b3f027f044/iam-query.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/aws-appsync-integ.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-elasticsearch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.ts similarity index 90% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.ts index b92a78485c3c2..7ca2f45db7801 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-iam.ts @@ -1,9 +1,9 @@ import { join } from 'path'; -import { UserPool } from '@aws-cdk/aws-cognito'; -import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; -import { Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; +import { AttributeType, BillingMode, Table } from 'aws-cdk-lib/aws-dynamodb'; +import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; import { AuthorizationType, GraphqlApi, @@ -13,7 +13,7 @@ import { Values, IamResource, SchemaFile, -} from '../lib'; +} from 'aws-cdk-lib/aws-appsync'; /* * Creates an Appsync GraphQL API and Lambda with IAM Roles. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js new file mode 100644 index 0000000000000..e9cf55ef318bf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const appsync = require("aws-cdk-lib/aws-appsync"); +class OpensSearch23Stack extends cdk.Stack { + constructor(scope) { + super(scope, 'appsync-opensearch'); + const user = new aws_iam_1.User(this, 'User'); + const domain = new opensearch.Domain(this, 'Domain', { + version: opensearch.EngineVersion.OPENSEARCH_2_3, + removalPolicy: cdk.RemovalPolicy.DESTROY, + fineGrainedAccessControl: { + masterUserArn: user.userArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + const api = new appsync.GraphqlApi(this, 'api', { + name: 'api', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), + }); + const ds = api.addOpenSearchDataSource('ds', domain); + ds.createResolver('QueryGetTests', { + typeName: 'Query', + fieldName: 'getTests', + requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + operation: 'GET', + path: '/id/post/_search', + params: { + headers: {}, + queryString: {}, + body: { + from: 0, + size: 50, + }, + }, + })), + responseMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + operation: 'GET', + path: '/id/post/_search', + params: { + headers: {}, + queryString: {}, + body: { + from: 0, + size: 50, + query: { + term: { + author: '$util.toJson($context.arguments.author)', + }, + }, + }, + }, + })), + }); + } +} +const app = new cdk.App(); +const testCase = new OpensSearch23Stack(app); +new integ_tests_alpha_1.IntegTest(app, 'opensearch-2.3-stack', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3JhcGhxbC1vcGVuc2VhcmNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ3JhcGhxbC1vcGVuc2VhcmNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLGlEQUEyQztBQUMzQyxnRUFBZ0U7QUFDaEUsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUV2RCxtREFBbUQ7QUFFbkQsTUFBTSxrQkFBbUIsU0FBUSxHQUFHLENBQUMsS0FBSztJQUN4QyxZQUFZLEtBQWdCO1FBQzFCLEtBQUssQ0FBQyxLQUFLLEVBQUUsb0JBQW9CLENBQUMsQ0FBQztRQUVuQyxNQUFNLElBQUksR0FBRyxJQUFJLGNBQUksQ0FBQyxJQUFJLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFFcEMsTUFBTSxNQUF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TI4JyxcbiAgICAgICAgb3BlcmF0aW9uOiAnR0VUJyxcbiAgICAgICAgcGF0aDogJy9pZC9wb3N0L19zZWFyY2gnLFxuICAgICAgICBwYXJhbXM6IHtcbiAgICAgICAgICBoZWFkZXJzOiB7fSxcbiAgICAgICAgICBxdWVyeVN0cmluZzoge30sXG4gICAgICAgICAgYm9keToge1xuICAgICAgICAgICAgZnJvbTogMCxcbiAgICAgICAgICAgIHNpemU6IDUwLFxuICAgICAgICAgICAgcXVlcnk6IHtcbiAgICAgICAgICAgICAgdGVybToge1xuICAgICAgICAgICAgICAgIGF1dGhvcjogJyR1dGlsLnRvSnNvbigkY29udGV4dC5hcmd1bWVudHMuYXV0aG9yKScsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICB9KSksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHRlc3RDYXNlID0gbmV3IE9wZW5zU2VhcmNoMjNTdGFjayhhcHApO1xubmV3IEludGVnVGVzdChhcHAsICdvcGVuc2VhcmNoLTIuMy1zdGFjaycsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/opensearch23stackDefaultTestDeployAssert16E12129.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts similarity index 88% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts index daf75dad88555..f932464759649 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql-opensearch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import { User } from '@aws-cdk/aws-iam'; -import * as opensearch from '@aws-cdk/aws-opensearchservice'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { User } from 'aws-cdk-lib/aws-iam'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as appsync from '../lib'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; class OpensSearch23Stack extends cdk.Stack { constructor(scope: Construct) { diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/code-first-schema.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-schema.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-schema.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.graphql b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.graphql similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.graphql rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.graphql diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js new file mode 100644 index 0000000000000..527efd71aa7ca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js @@ -0,0 +1,285 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path_1 = require("path"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_appsync_1 = require("aws-cdk-lib/aws-appsync"); +/* + * Creates an Appsync GraphQL API and with multiple tables. + * Testing for importing, querying, and mutability. + * + * Stack verification steps: + * Add to a table through appsync GraphQL API. + * Read from a table through appsync API. + * + * -- aws appsync list-graphql-apis -- obtain apiId -- + * -- aws appsync get-graphql-api --api-id [apiId] -- obtain GraphQL endpoint -- + * -- aws appsync list-api-keys --api-id [apiId] -- obtain api key -- + * -- bash verify.integ.graphql.sh [apiKey] [url] -- shows query and mutation -- + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-appsync-integ'); +const userPool = new aws_cognito_1.UserPool(stack, 'Pool', { + userPoolName: 'myPool', +}); +const api = new aws_appsync_1.GraphqlApi(stack, 'Api', { + name: 'demoapi', + schema: aws_appsync_1.SchemaFile.fromAsset((0, path_1.join)(__dirname, 'integ.graphql.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: aws_appsync_1.AuthorizationType.USER_POOL, + userPoolConfig: { + userPool, + }, + }, + additionalAuthorizationModes: [ + { + authorizationType: aws_appsync_1.AuthorizationType.API_KEY, + }, + ], + }, +}); +const noneDS = api.addNoneDataSource('none', { name: 'None' }); +noneDS.createResolver('QuerygetServiceVersion', { + typeName: 'Query', + fieldName: 'getServiceVersion', + requestMappingTemplate: aws_appsync_1.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + })), + responseMappingTemplate: aws_appsync_1.MappingTemplate.fromString(JSON.stringify({ + version: 'v1', + })), +}); +const customerTable = new aws_dynamodb_1.Table(stack, 'CustomerTable', { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: { + name: 'id', + type: aws_dynamodb_1.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const orderTable = new aws_dynamodb_1.Table(stack, 'OrderTable', { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: { + name: 'customer', + type: aws_dynamodb_1.AttributeType.STRING, + }, + sortKey: { + name: 'order', + type: aws_dynamodb_1.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +orderTable.addGlobalSecondaryIndex({ + indexName: 'orderIndex', + partitionKey: { + name: 'order', + type: aws_dynamodb_1.AttributeType.STRING, + }, + sortKey: { + name: 'customer', + type: aws_dynamodb_1.AttributeType.STRING, + }, +}); +new aws_dynamodb_1.Table(stack, 'PaymentTable', { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: { + name: 'id', + type: aws_dynamodb_1.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const paymentTable = aws_dynamodb_1.Table.fromTableName(stack, 'ImportedPaymentTable', 'PaymentTable'); +const customerDS = api.addDynamoDbDataSource('customerDs', customerTable, { name: 'Customer' }); +const orderDS = api.addDynamoDbDataSource('orderDs', orderTable, { name: 'Order' }); +const paymentDS = api.addDynamoDbDataSource('paymentDs', paymentTable, { name: 'Payment' }); +customerDS.createResolver('QueryGetCustomers', { + typeName: 'Query', + fieldName: 'getCustomers', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbScanTable(), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +customerDS.createResolver('QueryGetCustomer', { + typeName: 'Query', + fieldName: 'getCustomer', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbGetItem('id', 'id'), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +customerDS.createResolver('QueryGetCusomtersNotConsistent', { + typeName: 'Query', + fieldName: 'getCustomersNotConsistent', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbScanTable(false), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +customerDS.createResolver('QueryGetCustomerNotConsistent', { + typeName: 'Query', + fieldName: 'getCustomerNotConsistent', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbGetItem('id', 'id', false), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +customerDS.createResolver('QueryGetCustomersConsistent', { + typeName: 'Query', + fieldName: 'getCustomersConsistent', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbScanTable(true), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +customerDS.createResolver('QueryGetCustomerConsistent', { + typeName: 'Query', + fieldName: 'getCustomerConsistent', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbGetItem('id', 'id', true), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +customerDS.createResolver('MutationAddCustomer', { + typeName: 'Mutation', + fieldName: 'addCustomer', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbPutItem(aws_appsync_1.PrimaryKey.partition('id').auto(), aws_appsync_1.Values.projecting('customer')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +customerDS.createResolver('MutationSaveCustomer', { + typeName: 'Mutation', + fieldName: 'saveCustomer', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbPutItem(aws_appsync_1.PrimaryKey.partition('id').is('id'), aws_appsync_1.Values.projecting('customer')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +customerDS.createResolver('MutationSaveCustomerWithFirstOrder', { + typeName: 'Mutation', + fieldName: 'saveCustomerWithFirstOrder', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbPutItem(aws_appsync_1.PrimaryKey + .partition('order').auto() + .sort('customer').is('customer.id'), aws_appsync_1.Values + .projecting('order') + .attribute('referral').is('referral')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +customerDS.createResolver('MutationRemoveCustomer', { + typeName: 'Mutation', + fieldName: 'removeCustomer', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbDeleteItem('id', 'id'), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +const ops = [ + { suffix: 'Eq', op: aws_appsync_1.KeyCondition.eq }, + { suffix: 'Lt', op: aws_appsync_1.KeyCondition.lt }, + { suffix: 'Le', op: aws_appsync_1.KeyCondition.le }, + { suffix: 'Gt', op: aws_appsync_1.KeyCondition.gt }, + { suffix: 'Ge', op: aws_appsync_1.KeyCondition.ge }, +]; +for (const { suffix, op } of ops) { + orderDS.createResolver(`QueryGetCustomerOrders${suffix}`, { + typeName: 'Query', + fieldName: 'getCustomerOrders' + suffix, + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(op('customer', 'customer')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), + }); + orderDS.createResolver(`QueryGetOrderCustomers${suffix}`, { + typeName: 'Query', + fieldName: 'getOrderCustomers' + suffix, + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(op('order', 'order'), 'orderIndex'), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), + }); +} +for (const { suffix, op } of ops) { + orderDS.createResolver(`QueryGetCustomerOrdersNotConsistent${suffix}`, { + typeName: 'Query', + fieldName: 'getCustomerOrdersNotConsistent' + suffix, + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(op('customer', 'customer'), undefined, false), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), + }); + orderDS.createResolver(`QueryGetOrderCustomersNotConsistent${suffix}`, { + typeName: 'Query', + fieldName: 'getOrderCustomersNotConsistent' + suffix, + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(op('order', 'order'), 'orderIndex', false), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), + }); +} +for (const { suffix, op } of ops) { + orderDS.createResolver(`QueryGetCustomerOrdersConsistent${suffix}`, { + typeName: 'Query', + fieldName: 'getCustomerOrdersConsistent' + suffix, + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(op('customer', 'customer'), undefined, true), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), + }); + orderDS.createResolver(`QueryGetOrderCustomersConsistent${suffix}`, { + typeName: 'Query', + fieldName: 'getOrderCustomersConsistent' + suffix, + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(op('order', 'order'), 'orderIndex', true), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), + }); +} +orderDS.createResolver('QueryGetCustomerOrdersFilter', { + typeName: 'Query', + fieldName: 'getCustomerOrdersFilter', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(aws_appsync_1.KeyCondition.eq('customer', 'customer').and(aws_appsync_1.KeyCondition.beginsWith('order', 'order'))), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +orderDS.createResolver('QueryGetCustomerOrdersBetween', { + typeName: 'Query', + fieldName: 'getCustomerOrdersBetween', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(aws_appsync_1.KeyCondition.eq('customer', 'customer').and(aws_appsync_1.KeyCondition.between('order', 'order1', 'order2'))), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +orderDS.createResolver('QueryGetOrderCustomersFilter', { + typeName: 'Query', + fieldName: 'getOrderCustomersFilter', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(aws_appsync_1.KeyCondition.eq('order', 'order').and(aws_appsync_1.KeyCondition.beginsWith('customer', 'customer'))), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +orderDS.createResolver('QueryGetOrderCustomersBetween', { + typeName: 'Query', + fieldName: 'getOrderCustomersBetween', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbQuery(aws_appsync_1.KeyCondition.eq('order', 'order').and(aws_appsync_1.KeyCondition.between('customer', 'customer1', 'customer2')), 'orderIndex'), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultList(), +}); +paymentDS.createResolver('QueryGetPayment', { + typeName: 'Query', + fieldName: 'getPayment', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbGetItem('id', 'id'), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +paymentDS.createResolver('QueryGetPaymentConsistent', { + typeName: 'Query', + fieldName: 'getPaymentConsistent', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbGetItem('id', 'id', true), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +paymentDS.createResolver('MutationSavePayment', { + typeName: 'Mutation', + fieldName: 'savePayment', + requestMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbPutItem(aws_appsync_1.PrimaryKey.partition('id').auto(), aws_appsync_1.Values.projecting('payment')), + responseMappingTemplate: aws_appsync_1.MappingTemplate.dynamoDbResultItem(), +}); +const httpDS = api.addHttpDataSource('ds', 'https://aws.amazon.com/', { name: 'http' }); +httpDS.createResolver('MutationDoPostOnAws', { + typeName: 'Mutation', + fieldName: 'doPostOnAws', + requestMappingTemplate: aws_appsync_1.MappingTemplate.fromString(`{ + "version": "2018-05-29", + "method": "POST", + # if full path is https://api.xxxxxxxxx.com/posts then resourcePath would be /posts + "resourcePath": "/path/123", + "params":{ + "body": $util.toJson($ctx.args), + "headers":{ + "Content-Type": "application/json", + "Authorization": "$ctx.request.headers.Authorization" + } + } + }`), + responseMappingTemplate: aws_appsync_1.MappingTemplate.fromString(` + ## Raise a GraphQL field error in case of a datasource invocation error + #if($ctx.error) + $util.error($ctx.error.message, $ctx.error.type) + #end + ## if the response status code is not 200, then return an error. Else return the body ** + #if($ctx.result.statusCode == 200) + ## If response is 200, return the body. + $ctx.result.body + #else + ## If response is not 200, append the response to error block. + $utils.appendError($ctx.result.body, "$ctx.result.statusCode") + #end + `), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3JhcGhxbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmdyYXBocWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQkFBNEI7QUFDNUIseURBQW1EO0FBQ25ELDJEQUE2RTtBQUM3RSw2Q0FBd0Q7QUFDeEQseURBUWlDO0FBRWpDOzs7Ozs7Ozs7Ozs7R0FZRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLENBQUMsQ0FBQztBQUVsRCxNQUFNLFFBQVEsR0FBRyxJQUFJLHNCQUFRLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRTtJQUMzQyxZQUFZLEVBQUUsUUFBUTtDQUN2QixDQUFDLENBQUM7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLHdCQUFVLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRTtJQUN2QyxJQUFJLEVBQUUsU0FBUztJQUNmLE1BQU0sRUFBRSx3QkFBVSxDQUFDLFNBQVMsQ0FBQyxJQUFBLFdBQUksRUFBQyxTQUFTLEVBQUUsdUJBQXVCLENBQUMsQ0FBQztJQUN0RSxtQkFBbUIsRUFBRTtRQUNuQixvQkFBb0IsRUFBRTtZQUNwQixpQkFBaUIsRUFBRSwrQkFBaUIsQ0FBQyxTQUFTO1lBQzlDLGNBQWMsRUFBRTtnQkFDZCxRQUFRO2FBQ1Q7U0FDRjtRQUNELDRCQUE0QixFQUFFO1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pZiB0aGUgcmVzcG9uc2Ugc3RhdHVzIGNvZGUgaXMgbm90IDIwMCwgdGhlbiByZXR1cm4gYW4gZXJyb3IuIEVsc2UgcmV0dXJuIHRoZSBib2R5ICoqXG4gICAgI2lmKCRjdHgucmVzdWx0LnN0YXR1c0NvZGUgPT0gMjAwKVxuICAgICAgICAjIyBJZiByZXNwb25zZSBpcyAyMDAsIHJldHVybiB0aGUgYm9keS5cbiAgICAgICAgJGN0eC5yZXN1bHQuYm9keVxuICAgICNlbHNlXG4gICAgICAgICMjIElmIHJlc3BvbnNlIGlzIG5vdCAyMDAsIGFwcGVuZCB0aGUgcmVzcG9uc2UgdG8gZXJyb3IgYmxvY2suXG4gICAgICAgICR1dGlscy5hcHBlbmRFcnJvcigkY3R4LnJlc3VsdC5ib2R5LCBcIiRjdHgucmVzdWx0LnN0YXR1c0NvZGVcIilcbiAgICAjZW5kXG4gIGApLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/aws-appsync-integ.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql-iam.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.ts similarity index 98% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.ts index 76303ff807297..9c9e4a4c501e7 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.graphql.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql.ts @@ -1,7 +1,7 @@ import { join } from 'path'; -import { UserPool } from '@aws-cdk/aws-cognito'; -import { AttributeType, BillingMode, Table } from '@aws-cdk/aws-dynamodb'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; +import { AttributeType, BillingMode, Table } from 'aws-cdk-lib/aws-dynamodb'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; import { AuthorizationType, GraphqlApi, @@ -10,7 +10,7 @@ import { PrimaryKey, SchemaFile, Values, -} from '../lib'; +} from 'aws-cdk-lib/aws-appsync'; /* * Creates an Appsync GraphQL API and with multiple tables. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js new file mode 100644 index 0000000000000..8fff45900a611 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const logs = require("aws-cdk-lib/aws-logs"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const appsync = require("aws-cdk-lib/aws-appsync"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'AppSyncJsResolverTestStack'); +const logConfig = { + retention: logs.RetentionDays.ONE_WEEK, +}; +const api = new appsync.GraphqlApi(stack, 'JsResolverApi', { + name: 'JsResolverApi', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.js-resolver.graphql')), + logConfig, +}); +const db = new dynamodb.Table(stack, 'DynamoTable', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const dataSource = api.addDynamoDbDataSource('DynamoDataSource', db); +const addTestFunc = dataSource.createFunction('AddTestFunction', { + name: 'addTestFunc', + runtime: appsync.FunctionRuntime.JS_1_0_0, + code: appsync.Code.fromAsset(path.join(__dirname, 'integ-assets', 'appsync-js-resolver.js')), +}); +new appsync.Resolver(stack, 'AddTestResolver', { + api, + typeName: 'Mutation', + fieldName: 'addTest', + code: appsync.Code.fromAsset(path.join(__dirname, 'integ-assets', 'appsync-js-pipeline.js')), + runtime: appsync.FunctionRuntime.JS_1_0_0, + pipelineConfig: [addTestFunc], +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'JsResolverIntegTest', { testCases: [stack] }); +/** + * Handler that calls our api with an `addTest` Mutation + */ +const invoke = new lambda.Function(stack, 'InvokeApi', { + code: lambda.Code.fromAsset(path.join(__dirname, 'integ-assets/js-resolver-assertion')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_18_X, +}); +const addTestInvoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: api.graphqlUrl, + apiKey: api.apiKey, + }), +}); +/** + * Assert result returned on API has a generated ID and the passed name. + */ +addTestInvoke.assertAtPath('Payload.data.addTest.name', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('123')); +addTestInvoke.assertAtPath('Payload.data.addTest.id', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('.+')); +/** + * Generated ID of the item added in the previous handler + */ +const addTestResultId = addTestInvoke.getAttString('Payload.data.addTest.id'); +/** + * Try to find the item added in the DynamoDB data source. + */ +const getItemCall = integ.assertions.awsApiCall('DynamoDB', 'getItem', { + TableName: db.tableName, + Key: { + id: { + S: addTestResultId, + }, + }, +}); +getItemCall.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Item: { + name: { + S: '123', + }, + id: { + S: addTestResultId, + }, + }, +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuanMtcmVzb2x2ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5qcy1yZXNvbHZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixxREFBcUQ7QUFDckQsaURBQWlEO0FBQ2pELDZDQUE2QztBQUM3QyxtQ0FBbUM7QUFDbkMsa0VBQXVFO0FBQ3ZFLG1EQUFtRDtBQUVuRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDRCQUE0QixDQUFDLENBQUM7QUFFL0QsTUFBTSxTQUFTLEdBQXNCO0lBQ25DLFNBQVMsRUFBRSxJQUFJLENBQUMsYUFBYSxDQUFDLFFBQVE7Q0FDdkMsQ0FBQztBQUVGLE1BQU0sR0FBRyxHQUFHLElBQUksT0FBTyxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsZUFBZSxFQUFFO0lBQ3pELElBQUksRUFBRSxlQUFlO0lBQ3JCLE1BQU0sRUFBRSxPQUFPLENBQUMsVUFBVSxDQUFDLFNBQVMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDO0lBQ3pGLFNBQVM7Q0FDVixDQUFDLENBQUM7QUFFSCxNQUFNLEVBQUUsR0FBRyxJQUFJLFFBQVEsQ0FBQyxLQUFLLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRTtJQUNsRCxZQUFZLEVBQUU7UUFDWixJQUFJLE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gICBuYW1lOiB7XG4gICAgICBTOiAnMTIzJyxcbiAgICB9LFxuICAgIGlkOiB7XG4gICAgICBTOiBhZGRUZXN0UmVzdWx0SWQsXG4gICAgfSxcbiAgfSxcbn0pKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/AppSyncJsResolverTestStack.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/JsResolverIntegTestDefaultTestDeployAssert57AD8D20.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.c8a056b7b029cede879af4833f48bcc456748b2f8456f85ba76393466c08693a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/asset.c8a056b7b029cede879af4833f48bcc456748b2f8456f85ba76393466c08693a/index.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.c8a056b7b029cede879af4833f48bcc456748b2f8456f85ba76393466c08693a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/asset.c8a056b7b029cede879af4833f48bcc456748b2f8456f85ba76393466c08693a/index.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.graphql.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.ts similarity index 89% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.ts index c59bcf53e88b3..8ba10b77e8f3b 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.js-resolver.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import * as appsync from '../lib'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'AppSyncJsResolverTestStack'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js new file mode 100644 index 0000000000000..f4d8fa1f027ad --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const appsync = require("aws-cdk-lib/aws-appsync"); +class GraphQLApiLambdaAuthStack extends cdk.Stack { + constructor(scope) { + super(scope, 'appsync-lambda-auth'); + const func = new lambda.Function(this, 'func', { + code: lambda.Code.fromAsset(path.join(__dirname, 'verify/lambda-tutorial')), + handler: 'lambda-tutorial.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + new appsync.GraphqlApi(this, 'api1', { + name: 'api1', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: appsync.AuthorizationType.LAMBDA, + lambdaAuthorizerConfig: { + handler: func, + }, + }, + }, + }); + new appsync.GraphqlApi(this, 'api2', { + name: 'api2', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: appsync.AuthorizationType.LAMBDA, + lambdaAuthorizerConfig: { + handler: func, + }, + }, + }, + }); + } +} +const app = new cdk.App(); +const testCase = new GraphQLApiLambdaAuthStack(app); +new integ_tests_alpha_1.IntegTest(app, 'GraphQlApiLambdaAuth', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWF1dGguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy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gICB9KTtcblxuICAgIG5ldyBhcHBzeW5jLkdyYXBocWxBcGkodGhpcywgJ2FwaTInLCB7XG4gICAgICBuYW1lOiAnYXBpMicsXG4gICAgICBzY2hlbWE6IGFwcHN5bmMuU2NoZW1hRmlsZS5mcm9tQXNzZXQoXG4gICAgICAgIHBhdGguam9pbihfX2Rpcm5hbWUsICdhcHBzeW5jLnRlc3QuZ3JhcGhxbCcpLFxuICAgICAgKSxcbiAgICAgIGF1dGhvcml6YXRpb25Db25maWc6IHtcbiAgICAgICAgZGVmYXVsdEF1dGhvcml6YXRpb246IHtcbiAgICAgICAgICBhdXRob3JpemF0aW9uVHlwZTogYXBwc3luYy5BdXRob3JpemF0aW9uVHlwZS5MQU1CREEsXG4gICAgICAgICAgbGFtYmRhQXV0aG9yaXplckNvbmZpZzoge1xuICAgICAgICAgICAgaGFuZGxlcjogZnVuYyxcbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgR3JhcGhRTEFwaUxhbWJkYUF1dGhTdGFjayhhcHApO1xubmV3IEludGVnVGVzdChhcHAsICdHcmFwaFFsQXBpTGFtYmRhQXV0aCcsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/GraphQlApiLambdaAuthDefaultTestDeployAssert3A9D82EA.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/appsync-lambda-auth.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/asset.df9f207d681056c35badb6bc0d60a945b44c887b227b759715fd6a6443486443/lambda-tutorial.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/asset.df9f207d681056c35badb6bc0d60a945b44c887b227b759715fd6a6443486443/lambda-tutorial.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/asset.df9f207d681056c35badb6bc0d60a945b44c887b227b759715fd6a6443486443/lambda-tutorial.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/asset.df9f207d681056c35badb6bc0d60a945b44c887b227b759715fd6a6443486443/lambda-tutorial.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.ts similarity index 87% rename from packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.ts index 3d23cfc405d2d..a57d8b8089088 100644 --- a/packages/@aws-cdk/aws-appsync/test/integ.lambda-auth.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.lambda-auth.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as appsync from '../lib'; +import * as appsync from 'aws-cdk-lib/aws-appsync'; class GraphQLApiLambdaAuthStack extends cdk.Stack { constructor(scope: Construct) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js new file mode 100644 index 0000000000000..3b4ba468075d8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path_1 = require("path"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_appsync_1 = require("aws-cdk-lib/aws-appsync"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'AppSyncIntegLogRetention'); +const retentionTime = aws_logs_1.RetentionDays.ONE_WEEK; +const logConfig = { + retention: retentionTime, +}; +const api = new aws_appsync_1.GraphqlApi(stack, 'GraphqlApi', { + authorizationConfig: {}, + name: 'IntegLogRetention', + schema: aws_appsync_1.SchemaFile.fromAsset((0, path_1.join)(__dirname, 'appsync.test.graphql')), + logConfig, +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'Integ', { testCases: [stack] }); +const describe = integ.assertions.awsApiCall('CloudWatchLogs', 'describeLogGroups', { + logGroupNamePrefix: api.logGroup.logGroupName, +}); +describe.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + logGroups: [ + { + logGroupName: api.logGroup.logGroupName, + retentionInDays: retentionTime, + }, + ], +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubG9nLXJldGVudGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxvZy1yZXRlbnRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQkFBNEI7QUFDNUIsbURBQXFEO0FBQ3JELDZDQUF5QztBQUN6QyxrRUFBdUU7QUFDdkUseURBQTRFO0FBRTVFLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsMEJBQTBCLENBQUMsQ0FBQztBQUd6RCxNQUFNLGFBQWEsR0FBRyx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R3JvdXBOYW1lUHJlZml4OiBhcGkubG9nR3JvdXAubG9nR3JvdXBOYW1lLFxuICB9KTtcblxuZGVzY3JpYmUuZXhwZWN0KEV4cGVjdGVkUmVzdWx0Lm9iamVjdExpa2Uoe1xuICBsb2dHcm91cHM6IFtcbiAgICB7XG4gICAgICBsb2dHcm91cE5hbWU6IGFwaS5sb2dHcm91cC5sb2dHcm91cE5hbWUsXG4gICAgICByZXRlbnRpb25JbkRheXM6IHJldGVudGlvblRpbWUsXG4gICAgfSxcbiAgXSxcbn0pKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/AppSyncIntegLogRetention.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.ts new file mode 100644 index 0000000000000..f28dabec7437a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.log-retention.ts @@ -0,0 +1,40 @@ +import { join } from 'path'; +import { RetentionDays } from 'aws-cdk-lib/aws-logs'; +import { App, Stack } from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { GraphqlApi, LogConfig, SchemaFile } from 'aws-cdk-lib/aws-appsync'; + +const app = new App(); +const stack = new Stack(app, 'AppSyncIntegLogRetention'); + + +const retentionTime = RetentionDays.ONE_WEEK; +const logConfig: LogConfig = { + retention: retentionTime, +}; + +const api = new GraphqlApi(stack, 'GraphqlApi', { + authorizationConfig: {}, + name: 'IntegLogRetention', + schema: SchemaFile.fromAsset(join(__dirname, 'appsync.test.graphql')), + logConfig, +}); + +const integ = new IntegTest(app, 'Integ', { testCases: [stack] }); + +const describe = integ.assertions.awsApiCall('CloudWatchLogs', + 'describeLogGroups', + { + logGroupNamePrefix: api.logGroup.logGroupName, + }); + +describe.expect(ExpectedResult.objectLike({ + logGroups: [ + { + logGroupName: api.logGroup.logGroupName, + retentionInDays: retentionTime, + }, + ], +})); + +app.synth(); diff --git a/packages/@aws-cdk/aws-appsync/test/verify/iam-query/iam-query.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/verify/iam-query/iam-query.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify/iam-query/iam-query.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/verify/iam-query/iam-query.js diff --git a/packages/@aws-cdk/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js new file mode 100644 index 0000000000000..4e97053b4d7b2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const scaling = require("aws-cdk-lib/aws-autoscaling"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_sqs_1 = require("aws-cdk-lib/aws-sqs"); +const aws_ssm_1 = require("aws-cdk-lib/aws-ssm"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_autoscaling_hooktargets_1 = require("aws-cdk-lib/aws-autoscaling-hooktargets"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const queue = new aws_sqs_1.Queue(this, 'HookQueue'); + this.queueUrl = queue.queueUrl; + const group = new scaling.AutoScalingGroup(this, 'Group', { + vpc: new aws_ec2_1.Vpc(this, 'Vpc'), + maxCapacity: 1, + minCapacity: 0, + instanceType: aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.T3, aws_ec2_1.InstanceSize.SMALL), + machineImage: { + getImage: () => { + return { + osType: aws_ec2_1.OperatingSystemType.LINUX, + userData: aws_ec2_1.UserData.forLinux(), + imageId: aws_ssm_1.StringParameter.fromStringParameterName(this, 'al2022AMI', '/aws/service/ami-amazon-linux-latest/al2022-ami-kernel-default-x86_64').stringValue, + }; + }, + }, + }); + this.groupName = group.autoScalingGroupName; + const hook = group.addLifecycleHook('scaleout', { + lifecycleTransition: scaling.LifecycleTransition.INSTANCE_LAUNCHING, + notificationTarget: new aws_autoscaling_hooktargets_1.QueueHook(queue), + }); + this.hookName = hook.lifecycleHookName; + } +} +const testCase = new TestStack(app, 'integ-autoscalinghook-queue'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'queue-hook-test', { + testCases: [testCase], +}); +const setDesired = integ.assertions.awsApiCall('AutoScaling', 'setDesiredCapacity', { + AutoScalingGroupName: testCase.groupName, + DesiredCapacity: 1, +}); +const message = integ.assertions.awsApiCall('SQS', 'receiveMessage', { + QueueUrl: testCase.queueUrl, +}); +message.assertAtPath('Messages.0.Body.LifecycleTransition', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('autoscaling:EC2_INSTANCE_LAUNCHING')).waitForAssertions(); +const token = message.getAttString('Messages.0.Body.LifecycleActionToken'); +const completeAction = integ.assertions.awsApiCall('AutoScaling', 'completeLifecycleAction', { + AutoScalingGroupName: testCase.groupName, + LifecycleActionResult: 'CONTINUE', + LifecycleActionToken: token, + LifecycleHookName: testCase.hookName, +}); +setDesired.next(message.next(completeAction)); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucXVldWUtaG9vay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnF1ZXVlLWhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBdUQ7QUFDdkQsaURBQW9IO0FBQ3BILGlEQUE0QztBQUM1QyxpREFBc0Q7QUFDdEQsbUNBQW1DO0FBQ25DLGtFQUF1RTtBQUV2RSx5RkFBb0U7QUFFcEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSx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WdlLmFzc2VydEF0UGF0aChcbiAgJ01lc3NhZ2VzLjAuQm9keS5MaWZlY3ljbGVUcmFuc2l0aW9uJyxcbiAgRXhwZWN0ZWRSZXN1bHQuc3RyaW5nTGlrZVJlZ2V4cCgnYXV0b3NjYWxpbmc6RUMyX0lOU1RBTkNFX0xBVU5DSElORycpLFxuKS53YWl0Rm9yQXNzZXJ0aW9ucygpO1xuXG5jb25zdCB0b2tlbiA9IG1lc3NhZ2UuZ2V0QXR0U3RyaW5nKCdNZXNzYWdlcy4wLkJvZHkuTGlmZWN5Y2xlQWN0aW9uVG9rZW4nKTtcblxuY29uc3QgY29tcGxldGVBY3Rpb24gPSBpbnRlZy5hc3NlcnRpb25zLmF3c0FwaUNhbGwoJ0F1dG9TY2FsaW5nJywgJ2NvbXBsZXRlTGlmZWN5Y2xlQWN0aW9uJywge1xuICBBdXRvU2NhbGluZ0dyb3VwTmFtZTogdGVzdENhc2UuZ3JvdXBOYW1lLFxuICBMaWZlY3ljbGVBY3Rpb25SZXN1bHQ6ICdDT05USU5VRScsXG4gIExpZmVjeWNsZUFjdGlvblRva2VuOiB0b2tlbixcbiAgTGlmZWN5Y2xlSG9va05hbWU6IHRlc3RDYXNlLmhvb2tOYW1lLFxufSk7XG5cbnNldERlc2lyZWQubmV4dChcbiAgbWVzc2FnZS5uZXh0KFxuICAgIGNvbXBsZXRlQWN0aW9uLFxuICApLFxuKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ-autoscalinghook-queue.template.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/queuehooktestDefaultTestDeployAssertCF5493DF.template.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.ts similarity index 85% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.ts index 44160510d734c..95f13ad7c3e91 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/integ.queue-hook.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling-hooktargets/test/integ.queue-hook.ts @@ -1,11 +1,11 @@ -import * as scaling from '@aws-cdk/aws-autoscaling'; -import { Vpc, InstanceType, InstanceClass, InstanceSize, OperatingSystemType, UserData } from '@aws-cdk/aws-ec2'; -import { Queue } from '@aws-cdk/aws-sqs'; -import { StringParameter } from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; +import * as scaling from 'aws-cdk-lib/aws-autoscaling'; +import { Vpc, InstanceType, InstanceClass, InstanceSize, OperatingSystemType, UserData } from 'aws-cdk-lib/aws-ec2'; +import { Queue } from 'aws-cdk-lib/aws-sqs'; +import { StringParameter } from 'aws-cdk-lib/aws-ssm'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { QueueHook } from '../lib'; +import { QueueHook } from 'aws-cdk-lib/aws-autoscaling-hooktargets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js new file mode 100644 index 0000000000000..b31fa07df4771 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new autoscaling.AutoScalingGroup(stack, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + maxInstanceLifetime: cdk.Duration.days(7), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYW1hem9ubGludXgyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYW1hem9ubGludXgyLnRzIl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jYWxpbmcgZnJvbSAnYXdzLWNkay1saWIvYXdzLWF1dG9zY2FsaW5nJztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtY2RrLWF1dG9zY2FsaW5nLWludGVnJyk7XG5cbmNvbnN0IHZwYyA9IG5ldyBlYzIuVnBjKHN0YWNrLCAnVlBDJywge1xuICBtYXhBenM6IDIsXG59KTtcblxubmV3IGF1dG9zY2FsaW5nLkF1dG9TY2FsaW5nR3JvdXAoc3RhY2ssICdGbGVldCcsIHtcbiAgdnBjLFxuICBpbnN0YW5jZVR5cGU6IGVjMi5JbnN0YW5jZVR5cGUub2YoZWMyLkluc3RhbmNlQ2xhc3MuQlVSU1RBQkxFMiwgZWMyLkluc3RhbmNlU2l6ZS5NSUNSTyksXG4gIG1hY2hpbmVJbWFnZTogbmV3IGVjMi5BbWF6b25MaW51eEltYWdlKHsgZ2VuZXJhdGlvbjogZWMyLkFtYXpvbkxpbnV4R2VuZXJhdGlvbi5BTUFaT05fTElOVVhfMiB9KSxcbiAgbWF4SW5zdGFuY2VMaWZldGltZTogY2RrLkR1cmF0aW9uLmRheXMoNyksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/aws-cdk-autoscaling-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.ts similarity index 77% rename from packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.ts index bbadfe039476f..0e17858a4a073 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.amazonlinux2.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.amazonlinux2.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as autoscaling from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js new file mode 100644 index 0000000000000..c6e60025aa57c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js @@ -0,0 +1,23 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new autoscaling.AutoScalingGroup(stack, 'CapacityRebalance', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + capacityRebalance: true, +}); +new integ.IntegTest(app, 'CapacityRebalanceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNnLWNhcGFjaXR5LXJlYmFsYW5jZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFzZy1jYXBhY2l0eS1yZWJhbGFuY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsMkRBQTJEO0FBRTNELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMkJBQTJCLENBQUMsQ0FBQztBQUU5RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRTtJQUNwQyxNQUFNLEVBQUUsQ0FBQztDQUNWLENBQUMsQ0FBQztBQUVILElBQUksV0FBVy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BenM6IDIsXG59KTtcblxubmV3IGF1dG9zY2FsaW5nLkF1dG9TY2FsaW5nR3JvdXAoc3RhY2ssICdDYXBhY2l0eVJlYmFsYW5jZScsIHtcbiAgdnBjLFxuICBpbnN0YW5jZVR5cGU6IGVjMi5JbnN0YW5jZVR5cGUub2YoZWMyLkluc3RhbmNlQ2xhc3MuQlVSU1RBQkxFMiwgZWMyLkluc3RhbmNlU2l6ZS5NSUNSTyksXG4gIG1hY2hpbmVJbWFnZTogbmV3IGVjMi5BbWF6b25MaW51eEltYWdlKHsgZ2VuZXJhdGlvbjogZWMyLkFtYXpvbkxpbnV4R2VuZXJhdGlvbi5BTUFaT05fTElOVVhfMiB9KSxcbiAgY2FwYWNpdHlSZWJhbGFuY2U6IHRydWUsXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdDYXBhY2l0eVJlYmFsYW5jZVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/CapacityRebalanceTestDefaultTestDeployAssert759ED6BE.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/aws-cdk-autoscaling-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.ts new file mode 100644 index 0000000000000..26573a92cdd9a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-capacity-rebalance.ts @@ -0,0 +1,25 @@ +#!/usr/bin/env node +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); + +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); + +new autoscaling.AutoScalingGroup(stack, 'CapacityRebalance', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + capacityRebalance: true, +}); + +new integ.IntegTest(app, 'CapacityRebalanceTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js new file mode 100644 index 0000000000000..0ded5a89a749c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js @@ -0,0 +1,88 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-asg-integ'); +const lt = new ec2.LaunchTemplate(stack, 'MainLT', { + instanceType: new ec2.InstanceType('t3.micro'), + machineImage: new ec2.AmazonLinuxImage({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + cpuType: ec2.AmazonLinuxCpuType.X86_64, + }), +}); +const ltOverrideT4g = new ec2.LaunchTemplate(stack, 'T4gLT', { + instanceType: new ec2.InstanceType('t4g.micro'), + machineImage: new ec2.AmazonLinuxImage({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + cpuType: ec2.AmazonLinuxCpuType.ARM_64, + }), +}); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new autoscaling.AutoScalingGroup(stack, 'AsgFromLT', { + vpc, + launchTemplate: lt, + minCapacity: 0, + maxCapacity: 10, + desiredCapacity: 5, +}); +new autoscaling.AutoScalingGroup(stack, 'AsgWithDefaultInstanceWarmup', { + vpc, + launchTemplate: lt, + defaultInstanceWarmup: cdk.Duration.seconds(5), +}); +new autoscaling.AutoScalingGroup(stack, 'AsgFromMip', { + vpc, + mixedInstancesPolicy: { + instancesDistribution: { + onDemandPercentageAboveBaseCapacity: 50, + }, + launchTemplate: lt, + launchTemplateOverrides: [ + { instanceType: new ec2.InstanceType('t3.micro') }, + { instanceType: new ec2.InstanceType('t3a.micro') }, + { instanceType: new ec2.InstanceType('t4g.micro'), launchTemplate: ltOverrideT4g }, + ], + }, + minCapacity: 0, + maxCapacity: 10, + desiredCapacity: 5, +}); +new autoscaling.AutoScalingGroup(stack, 'AsgFromMipWithoutDistribution', { + vpc, + mixedInstancesPolicy: { + launchTemplate: lt, + launchTemplateOverrides: [ + { instanceType: new ec2.InstanceType('t3.micro') }, + { instanceType: new ec2.InstanceType('t3a.micro') }, + { instanceType: new ec2.InstanceType('t4g.micro'), launchTemplate: ltOverrideT4g }, + ], + }, + minCapacity: 0, + maxCapacity: 10, + desiredCapacity: 5, +}); +new autoscaling.AutoScalingGroup(stack, 'AsgWithGp3Blockdevice', { + minCapacity: 0, + maxCapacity: 10, + desiredCapacity: 5, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), + blockDevices: [{ + deviceName: 'ebs', + mappingEnabled: true, + volume: autoscaling.BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + volumeType: autoscaling.EbsDeviceVolumeType.GP3, + throughput: 125, + }), + }], + vpc, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNnLWx0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXNnLWx0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMkRBQTJEO0FBRTNELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLENBQUMsQ0FBQztBQUV0RCxNQUFNLEVBQUUsR0FBRyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsS0FBSyxFQUFFLFFBQVEsRUFBRTtJQUNqRCxZQUFZLEVBQUUsSUFBSSxHQUFHLENBQUMsWUFBWSxDQUFDLFVBQVUsQ0FBQztJQUM5QyxZQUFZLEVBQUUsSUFBSSxHQUFHLENBQUMsZ0JBQWdCLENBQUM7UUFDckMsVUFBVSxFQUFFLEdBQUcsQ0FBQyxxQkFBcUIsQ0FBQyxjQUFjO1FBQ3BELE9BQU8sRUFBRSxHQUFHLENBQUMsa0JBQWtCLENBQUMsTUFBTTtLQUN2QyxDQUFDO0NBQ0gsQ0FBQyxDQUFDO0FBRUgsTUFBTSxhQUFhLEdBQUcsSUFBSSxHQUFHLENBQUMsY0FBYyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUU7SUFDM0QsWUFBWSxFQUFFLElBQUksR0FBRyxDQUFDLFlBQVksQ0FBQyxXQUFXLENBQUM7SUFD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tcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/aws-cdk-asg-integ.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.ts similarity index 94% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.ts index 3e07a7b1e093b..054362ab7c749 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-lt.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as autoscaling from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-asg-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js new file mode 100644 index 0000000000000..ffc6639d338ee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elb = require("aws-cdk-lib/aws-elasticloadbalancing"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-asg-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 3, +}); +const asg = new autoscaling.AutoScalingGroup(stack, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), +}); +const lb = new elb.LoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + healthCheck: { + port: 80, + }, +}); +lb.addTarget(asg); +lb.addListener({ externalPort: 80 }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNnLXctY2xhc3NpYy1sb2FkYmFsYW5jZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hc2ctdy1jbGFzc2ljLWxvYWRiYWxhbmNlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwyQ0FBMkM7QUFDM0MsNERBQTREO0FBQzVELG1DQUF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50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/aws-cdk-asg-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts new file mode 100644 index 0000000000000..2b57a5752dac3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts @@ -0,0 +1,31 @@ +#!/usr/bin/env node +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; +import * as cdk from 'aws-cdk-lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-asg-integ'); + +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 3, +}); + +const asg = new autoscaling.AutoScalingGroup(stack, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), +}); + +const lb = new elb.LoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + healthCheck: { + port: 80, + }, +}); + +lb.addTarget(asg); +lb.addListener({ externalPort: 80 }); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js new file mode 100644 index 0000000000000..5057e2863b85e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js @@ -0,0 +1,82 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const aws_elasticloadbalancingv2_1 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +class ElbV2AsgStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC', { + maxAzs: 2, + }); + const asg = new autoscaling.AutoScalingGroup(this, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), + }); + const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + listener.addTargets('Target', { + port: 80, + targets: [asg], + }); + listener.connections.allowDefaultPortFromAnyIpv4('Open to the world'); + asg.scaleOnRequestCount('AModestLoad', { + targetRequestsPerSecond: 1, + }); + } +} +class ElbV2AsgAtgStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC', { + maxAzs: 2, + }); + const alb = new elbv2.ApplicationLoadBalancer(this, 'alb', { + vpc, + internetFacing: true, + }); + const listener = alb.addListener('Listener', { + port: 80, + open: true, + }); + const asg = new autoscaling.AutoScalingGroup(this, 'Asg', { + vpc, + instanceType: new ec2.InstanceType('t3.micro'), + machineImage: new ec2.AmazonLinuxImage(), + }); + const atg1 = new elbv2.ApplicationTargetGroup(this, 'ATG1', { + port: 443, + vpc, + }); + const atg2 = new elbv2.ApplicationTargetGroup(this, 'ATG2', { + port: 443, + vpc, + }); + listener.addAction('tgs', { + action: aws_elasticloadbalancingv2_1.ListenerAction.weightedForward([ + { targetGroup: atg1, weight: 1 }, + { targetGroup: atg2, weight: 1 }, + ]), + }); + asg.attachToApplicationTargetGroup(atg1); + asg.attachToApplicationTargetGroup(atg2); + } +} +const app = new cdk.App(); +new integ.IntegTest(app, 'LambdaTest', { + testCases: [ + new ElbV2AsgStack(app, 'aws-cdk-asg-integ'), + new ElbV2AsgAtgStack(app, 'aws-cdk-asg-atg-integ'), + ], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNnLXctZWxidjIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hc2ctdy1lbGJ2Mi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwy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RHcm91cChhdGcxKTtcbiAgICBhc2cuYXR0YWNoVG9BcHBsaWNhdGlvblRhcmdldEdyb3VwKGF0ZzIpO1xuICB9XG59XG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ0xhbWJkYVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW1xuICAgIG5ldyBFbGJWMkFzZ1N0YWNrKGFwcCwgJ2F3cy1jZGstYXNnLWludGVnJyksXG4gICAgbmV3IEVsYlYyQXNnQXRnU3RhY2soYXBwLCAnYXdzLWNkay1hc2ctYXRnLWludGVnJyksXG4gIF0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-atg-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/aws-cdk-asg-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-lt.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.ts similarity index 87% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.ts index e949b58b17f84..89b665f2e3ce1 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.asg-w-elbv2.ts @@ -1,11 +1,11 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { ListenerAction } from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { ListenerAction } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as autoscaling from '../lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; class ElbV2AsgStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js new file mode 100644 index 0000000000000..03ca6d723b18c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js @@ -0,0 +1,29 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const asg = new autoscaling.AutoScalingGroup(stack, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), +}); +asg.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: autoscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 5, +}); +asg.scaleOnSchedule('ScaleDownAtNight', { + schedule: autoscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 2, +}); +asg.scaleOnCpuUtilization('KeepCPUReasonable', { + targetUtilizationPercent: 50, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY3VzdG9tLXNjYWxpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jdXN0b20tc2NhbGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDJEQUEyRDtBQUUzRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQU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cm9uKHsgaG91cjogJzgnLCBtaW51dGU6ICcwJyB9KSxcbiAgbWluQ2FwYWNpdHk6IDUsXG59KTtcblxuYXNnLnNjYWxlT25TY2hlZHVsZSgnU2NhbGVEb3duQXROaWdodCcsIHtcbiAgc2NoZWR1bGU6IGF1dG9zY2FsaW5nLlNjaGVkdWxlLmNyb24oeyBob3VyOiAnMjAnLCBtaW51dGU6ICcwJyB9KSxcbiAgbWF4Q2FwYWNpdHk6IDIsXG59KTtcblxuYXNnLnNjYWxlT25DcHVVdGlsaXphdGlvbignS2VlcENQVVJlYXNvbmFibGUnLCB7XG4gIHRhcmdldFV0aWxpemF0aW9uUGVyY2VudDogNTAsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/aws-cdk-autoscaling-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.ts similarity index 85% rename from packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.ts index edab26d0cf10c..0721ad9e14238 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.custom-scaling.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.custom-scaling.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as autoscaling from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js new file mode 100644 index 0000000000000..cd4ea3f592d7f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const asg = require("aws-cdk-lib/aws-autoscaling"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'VPC'); + const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), + }); + new asg.AutoScalingGroup(this, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO), + vpc, + machineImage: new ec2.AmazonLinuxImage(), + role, + }); + } +} +const app = new cdk.App(); +new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G59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBUZXN0U3RhY2soYXBwLCAnaW50ZWctaWFtLWV4dGVybmFsLXJvbGUnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/integ-iam-external-role.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.ts similarity index 76% rename from packages/@aws-cdk/aws-autoscaling/test/integ.external-role.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.ts index cb49c7db9824c..d2831c422756b 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.external-role.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.external-role.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as asg from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as asg from 'aws-cdk-lib/aws-autoscaling'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.d.ts new file mode 100644 index 0000000000000..4ef6af2cee1d8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.d.ts @@ -0,0 +1,13 @@ +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as constructs from 'constructs'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +export declare class FakeNotificationTarget implements autoscaling.ILifecycleHookTarget { + private readonly topic; + constructor(topic: sns.ITopic); + private createRole; + bind(_scope: constructs.Construct, options: autoscaling.BindHookTargetOptions): autoscaling.LifecycleHookTargetConfig; +} +export declare class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js new file mode 100644 index 0000000000000..b7dee8da6198a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestStack = exports.FakeNotificationTarget = void 0; +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +class FakeNotificationTarget { + constructor(topic) { + this.topic = topic; + } + createRole(scope, _role) { + let role = _role; + if (!role) { + role = new iam.Role(scope, 'Role', { + assumedBy: new iam.ServicePrincipal('autoscaling.amazonaws.com'), + }); + } + return role; + } + bind(_scope, options) { + const role = this.createRole(options.lifecycleHook, options.role); + this.topic.grantPublish(role); + return { + notificationTargetArn: this.topic.topicArn, + createdRole: role, + }; + } +} +exports.FakeNotificationTarget = FakeNotificationTarget; +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + let vpc = new ec2.Vpc(this, 'myVpcAuto', {}); + const myrole = new iam.Role(this, 'MyRole', { + assumedBy: new iam.ServicePrincipal('autoscaling.amazonaws.com'), + }); + const topic = new sns.Topic(this, 'topic', {}); + const topic2 = new sns.Topic(this, 'topic2', {}); + const asg = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), + healthCheck: autoscaling.HealthCheck.ec2(), + }); + // no role or notificationTarget + new autoscaling.LifecycleHook(this, 'LCHookNoRoleNoTarget', { + autoScalingGroup: asg, + lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_TERMINATING, + }); + // no role with notificationTarget + new autoscaling.LifecycleHook(this, 'LCHookNoRoleTarget', { + notificationTarget: new FakeNotificationTarget(topic), + autoScalingGroup: asg, + lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_TERMINATING, + }); + // role with target + new autoscaling.LifecycleHook(this, 'LCHookRoleTarget', { + notificationTarget: new FakeNotificationTarget(topic2), + role: myrole, + autoScalingGroup: asg, + lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_TERMINATING, + }); + } +} +exports.TestStack = TestStack; +const app = new cdk.App(); +new TestStack(app, 'integ-role-target-hook'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucm9sZS10YXJnZXQtaG9vay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJvbGUtdGFyZ2V0LWhvb2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBRW5DLDJEQUEyRDtBQUUzRCxNQUFhLHNCQUFzQjtJQUNqQyxZQUE2QixLQUFpQjtRQUFqQixVQUFL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yZ2V0LWhvb2snKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ-role-target-hook.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.ts similarity index 91% rename from packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.ts index 42fe82d88fb6a..e8ff11d000e57 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.role-target-hook.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.role-target-hook.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; import * as constructs from 'constructs'; -import * as autoscaling from '../lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; export class FakeNotificationTarget implements autoscaling.ILifecycleHookTarget { constructor(private readonly topic: sns.ITopic) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js new file mode 100644 index 0000000000000..90d90962b9c1a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new autoscaling.AutoScalingGroup(stack, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + spotPrice: '0.20', +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3BvdC1pbnN0YW5jZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zcG90LWluc3RhbmNlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDJEQUEyRDtBQUUzRCxNQUFNLEdB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MtY2RrLWF1dG9zY2FsaW5nLWludGVnJyk7XG5cbmNvbnN0IHZwYyA9IG5ldyBlYzIuVnBjKHN0YWNrLCAnVlBDJywge1xuICBtYXhBenM6IDIsXG59KTtcblxubmV3IGF1dG9zY2FsaW5nLkF1dG9TY2FsaW5nR3JvdXAoc3RhY2ssICdGbGVldCcsIHtcbiAgdnBjLFxuICBpbnN0YW5jZVR5cGU6IGVjMi5JbnN0YW5jZVR5cGUub2YoZWMyLkluc3RhbmNlQ2xhc3MuQlVSU1RBQkxFMiwgZWMyLkluc3RhbmNlU2l6ZS5NSUNSTyksXG4gIG1hY2hpbmVJbWFnZTogbmV3IGVjMi5BbWF6b25MaW51eEltYWdlKHsgZ2VuZXJhdGlvbjogZWMyLkFtYXpvbkxpbnV4R2VuZXJhdGlvbi5BTUFaT05fTElOVVhfMiB9KSxcbiAgc3BvdFByaWNlOiAnMC4yMCcsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/aws-cdk-autoscaling-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.ts similarity index 76% rename from packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.ts index 852e1d76508e3..e4e2f0447ff5a 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.spot-instances.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.spot-instances.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as autoscaling from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js new file mode 100644 index 0000000000000..e736c0239739d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +/** + * Stack verification steps: + * + * -- aws autoscaling describe-warm-pool --auto-scaling-group-name ASG has 0 and 'Stopped' as MinSize and PoolState, respectively. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const asg = new autoscaling.AutoScalingGroup(stack, 'Fleet', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + autoScalingGroupName: 'ASG', +}); +asg.addWarmPool(); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcud2FybS1wb29sLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcud2FybS1wb29sLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMkRBQTJEO0FBRTNEOzs7O0dBSUc7QUFDSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDJCQUEyQixDQUFDLENBQUM7QUFFOUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUU7SUFDcEMsTUFBTSxFQUFFLENBQUM7Q0FDVixDQUFDLENBQUM7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLFdBQVcsQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFO0lBQzNELEdBQUc7SUFDSCxZQUFZLEVBQUUsR0FBRyxDQUFDLFlBQVksQ0FBQyxFQUFFLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQyxVQUFVLEVBQUUsR0FBRyxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUM7SUFDdkYsWUFBWSxFQUFFLElBQUksR0FBRyxDQUFDL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VDbGFzcy5CVVJTVEFCTEUyLCBlYzIuSW5zdGFuY2VTaXplLk1JQ1JPKSxcbiAgbWFjaGluZUltYWdlOiBuZXcgZWMyLkFtYXpvbkxpbnV4SW1hZ2UoeyBnZW5lcmF0aW9uOiBlYzIuQW1hem9uTGludXhHZW5lcmF0aW9uLkFNQVpPTl9MSU5VWF8yIH0pLFxuICBhdXRvU2NhbGluZ0dyb3VwTmFtZTogJ0FTRycsXG59KTtcblxuYXNnLmFkZFdhcm1Qb29sKCk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.assets.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/aws-cdk-autoscaling-integ.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.ts similarity index 82% rename from packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.ts index 29c30f8401eb5..bdaa8f7ed9b30 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.warm-pool.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-autoscaling/test/integ.warm-pool.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as autoscaling from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; /** * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js new file mode 100644 index 0000000000000..7d3bb961ab0cc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const efs = require("aws-cdk-lib/aws-efs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const backup = require("aws-cdk-lib/aws-backup"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new dynamodb.Table(this, 'Table', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + const fs = new efs.CfnFileSystem(this, 'FileSystem'); + fs.applyRemovalPolicy(aws_cdk_lib_1.RemovalPolicy.DESTROY); + const vault = new backup.BackupVault(this, 'Vault', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + lockConfiguration: { + minRetention: aws_cdk_lib_1.Duration.days(5), + }, + }); + const secondaryVault = new backup.BackupVault(this, 'SecondaryVault', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + lockConfiguration: { + minRetention: aws_cdk_lib_1.Duration.days(5), + }, + }); + const plan = backup.BackupPlan.dailyWeeklyMonthly5YearRetention(this, 'Plan', vault); + plan.addSelection('Selection', { + resources: [ + backup.BackupResource.fromConstruct(this), + backup.BackupResource.fromTag('stage', 'prod'), // Resources that are tagged stage=prod + ], + }); + plan.addRule(new backup.BackupPlanRule({ + copyActions: [{ + destinationBackupVault: secondaryVault, + moveToColdStorageAfter: aws_cdk_lib_1.Duration.days(30), + deleteAfter: aws_cdk_lib_1.Duration.days(120), + }], + })); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-backup'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYmFja3VwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYmFja3VwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscURBQXFEO0FBQ3JELDJDQUEyQztBQUMzQyw2Q0FBOEU7QUFFOUUsaURBQWlEO0FBRWpELE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsSUFBSSxRQUFRLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxPQUFPLEVBQUU7WUFDaEMsWUFBWSxFQUFFO2dCQUNaLElBQUksRUFBRSxJQUFJO2dCQUNWLElBQUksRUFBRSxRQUFRLENBQUMsYUFBYSxDQUFDLE1BQU07YUFDcEM7WUFDRCxhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO1NBQ3JDLENBQUMsQ0FBQztRQUVILE1BQU0sRUFBRSxHQUFHLElBQUksR0FBRyxDQUFDLGFBQWEsQ0FBQyxJQUFJLEVBQUUsWUFBWSxDQUFDLENBQUM7UUFDckQsRUFBRSx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ZXNvdXJjZXMgaW4gdGhpcyBjb25zdHJ1Y3RcbiAgICAgICAgYmFja3VwLkJhY2t1cFJlc291cmNlLmZyb21UYWcoJ3N0YWdlJywgJ3Byb2QnKSwgLy8gUmVzb3VyY2VzIHRoYXQgYXJlIHRhZ2dlZCBzdGFnZT1wcm9kXG4gICAgICBdLFxuICAgIH0pO1xuXG4gICAgcGxhbi5hZGRSdWxlKG5ldyBiYWNrdXAuQmFja3VwUGxhblJ1bGUoe1xuICAgICAgY29weUFjdGlvbnM6IFt7XG4gICAgICAgIGRlc3RpbmF0aW9uQmFja3VwVmF1bHQ6IHNlY29uZGFyeVZhdWx0LFxuICAgICAgICBtb3ZlVG9Db2xkU3RvcmFnZUFmdGVyOiBEdXJhdGlvbi5kYXlzKDMwKSxcbiAgICAgICAgZGVsZXRlQWZ0ZXI6IER1cmF0aW9uLmRheXMoMTIwKSxcbiAgICAgIH1dLFxuICAgIH0pKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1iYWNrdXAnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/cdk-backup.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/cdk-backup.assets.json similarity index 100% rename from packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/cdk-backup.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/cdk-backup.assets.json diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/cdk-backup.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/cdk-backup.template.json similarity index 100% rename from packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/cdk-backup.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/cdk-backup.template.json diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-backup/test/integ.backup.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-backup/test/integ.backup.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.ts similarity index 90% rename from packages/@aws-cdk/aws-backup/test/integ.backup.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.ts index ef1bbff7251b2..00b9e3b182094 100644 --- a/packages/@aws-cdk/aws-backup/test/integ.backup.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-backup/test/integ.backup.ts @@ -1,8 +1,8 @@ -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as efs from '@aws-cdk/aws-efs'; -import { App, Duration, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as efs from 'aws-cdk-lib/aws-efs'; +import { App, Duration, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as backup from '../lib'; +import * as backup from 'aws-cdk-lib/aws-backup'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js new file mode 100644 index 0000000000000..6c9fb2bfbba02 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_certificatemanager_1 = require("aws-cdk-lib/aws-certificatemanager"); +/** + * In order to test this you need to have a valid public hosted zone that you can use + * to request certificates for. + * +*/ +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; +if (!hostedZoneId) + throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); +const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; +if (!hostedZoneName) + throw new Error('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME"'); +const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME; +if (!domainName) + throw new Error('For this test you must provide your own Domain Name as an env var "DOMAIN_NAME"'); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-certificate-name'); +const hostedZone = aws_route53_1.PublicHostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId, + zoneName: hostedZoneName, +}); +new aws_certificatemanager_1.Certificate(stack, 'Certificate', { + domainName, + certificateName: 'This is a test name', + validation: aws_certificatemanager_1.CertificateValidation.fromDns(hostedZone), +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-test', { + testCases: [stack], + diffAssets: true, + enableLookups: true, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2VydGlmaWNhdGUtbmFtZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNlcnRpZmljYXRlLW5hbWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5REFBMkQ7QUFDM0QsNkNBQXlDO0FBQ3pDLGtFQUF1RDtBQUN2RCwrRUFBd0Y7QUFFeEY7Ozs7RUFJRTtBQUNGLE1BQU0sWUFBWSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLENBQUM7QUFDeEYsSUFBSSxDQUFDLFlBQVk7SUFBRSxNQUFNLElBQUksS0FBSyxDQUFDLHFGQUFxRixDQUFDLENBQUM7QUFDMUgsTUFBTSxjQUFjLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQywwQkFBMEIsSUFBSSxPQUFPLENBQUMsR0FBRyx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udi5DREtfSU5URUdfRE9NQUlOX05BTUUgPz8gcHJvY2Vzcy5lbnYuRE9NQUlOX05BTUU7XG5pZiAoIWRvbWFpbk5hbWUpIHRocm93IG5ldyBFcnJvcignRm9yIHRoaXMgdGVzdCB5b3UgbXVzdCBwcm92aWRlIHlvdXIgb3duIERvbWFpbiBOYW1lIGFzIGFuIGVudiB2YXIgXCJET01BSU5fTkFNRVwiJyk7XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IFN0YWNrKGFwcCwgJ2ludGVnLWNlcnRpZmljYXRlLW5hbWUnKTtcbmNvbnN0IGhvc3RlZFpvbmUgPSBQdWJsaWNIb3N0ZWRab25lLmZyb21Ib3N0ZWRab25lQXR0cmlidXRlcyhzdGFjaywgJ0hvc3RlZFpvbmUnLCB7XG4gIGhvc3RlZFpvbmVJZCxcbiAgem9uZU5hbWU6IGhvc3RlZFpvbmVOYW1lLFxufSk7XG5cbm5ldyBDZXJ0aWZpY2F0ZShzdGFjaywgJ0NlcnRpZmljYXRlJywge1xuICBkb21haW5OYW1lLFxuICBjZXJ0aWZpY2F0ZU5hbWU6ICdUaGlzIGlzIGEgdGVzdCBuYW1lJyxcbiAgdmFsaWRhdGlvbjogQ2VydGlmaWNhdGVWYWxpZGF0aW9uLmZyb21EbnMoaG9zdGVkWm9uZSksXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdpbnRlZy10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG4gIGRpZmZBc3NldHM6IHRydWUsXG4gIGVuYWJsZUxvb2t1cHM6IHRydWUsXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.assets.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.assets.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.template.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ-certificate-name.template.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.ts similarity index 83% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.ts index bbc2ecf074b91..90130972b64c1 100644 --- a/packages/@aws-cdk/aws-certificatemanager/test/integ.certificate-name.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.certificate-name.ts @@ -1,7 +1,7 @@ -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Certificate, CertificateValidation } from '../lib'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Certificate, CertificateValidation } from 'aws-cdk-lib/aws-certificatemanager'; /** * In order to test this you need to have a valid public hosted zone that you can use diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js new file mode 100644 index 0000000000000..5ed5f7a1f3141 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_certificatemanager_1 = require("aws-cdk-lib/aws-certificatemanager"); +/** + * In order to test this you need to have a valid public hosted zone that you can use + * to request certificates for. Currently there is not a great way to test scenarios that involve + * multiple deploys so this is what I did to test these scenarios. + * + * 1. comment out the `cert.applyRemovalPolicy` line to create the certificate + * 2. Run `yarn integ --update-on-failed --no-clean` + * 3. uncomment the line to apply the removal policy + * 4. Run `yarn integ --update-on-failed --no-clean` to validate that changing + * that property does not cause a new certificate to be created + * 5. Run `yarn integ --force` to run the test again. Since we didn't pass `--no-clean` + * the stack will be deleted + * 6. Validate that the certificate was not deleted. + * 7. Delete the certificate manually. + */ +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; +if (!hostedZoneId) + throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); +const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; +if (!hostedZoneName) + throw new Error('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME"'); +const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME; +if (!domainName) + throw new Error('For this test you must provide your own Domain Name as an env var "DOMAIN_NAME"'); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-dns-validated-certificate'); +const hostedZone = aws_route53_1.PublicHostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId, + zoneName: hostedZoneName, +}); +const cert = new aws_certificatemanager_1.DnsValidatedCertificate(stack, 'Certificate', { + domainName, + hostedZone, + validation: aws_certificatemanager_1.CertificateValidation.fromDns(hostedZone), +}); +cert.applyRemovalPolicy(aws_cdk_lib_1.RemovalPolicy.RETAIN); +new aws_cdk_lib_1.CfnOutput(stack, 'CertificateArn', { + value: `https://${stack.region}.console.aws.amazon.com/acm/home?region=${stack.region}#/certificates/${aws_cdk_lib_1.Fn.select(1, aws_cdk_lib_1.Fn.split('/', cert.certificateArn))}`, +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-test', { + testCases: [stack], + diffAssets: true, + enableLookups: true, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZG5zLXZhbGlkYXRlZC1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_validated_certificate_handler/lib/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/asset.ef671dfd26b6dde1f73a4325587504813605a928622ebc466f4d0de6a0f3b672/index.js similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/lib/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/asset.ef671dfd26b6dde1f73a4325587504813605a928622ebc466f4d0de6a0f3b672/index.js diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.assets.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.template.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ-dns-validated-certificate.template.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.ts similarity index 90% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.ts index b5717d16b0005..1b10daa642f7b 100644 --- a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-certificatemanager/test/integ.dns-validated-certificate.ts @@ -1,7 +1,7 @@ -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { App, Stack, RemovalPolicy, CfnOutput, Fn } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { DnsValidatedCertificate, CertificateValidation } from '../lib'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { App, Stack, RemovalPolicy, CfnOutput, Fn } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { DnsValidatedCertificate, CertificateValidation } from 'aws-cdk-lib/aws-certificatemanager'; /** * In order to test this you need to have a valid public hosted zone that you can use diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js new file mode 100644 index 0000000000000..61b4ba7a1250c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const chatbot = require("aws-cdk-lib/aws-chatbot"); +class ChatbotGuardrailsInteg extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const guardrailPolicy = iam.ManagedPolicy.fromAwsManagedPolicyName('CloudWatchReadOnlyAccess'); + new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'test-channel', + slackWorkspaceId: 'T49239U4W', + slackChannelId: 'C0187JABUE9', + guardrailPolicies: [guardrailPolicy], + }); + } +} +const app = new cdk.App(); +new ChatbotGuardrailsInteg(app, 'ChatbotGuardrailsInteg'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2hhdGJvdC1ndWFyZHJhaWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2hhdGJvdC1ndWFyZHJhaWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxtREFBbUQ7QUFFbkQsTUFBTSxzQkFBdUIs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ZCwgcHJvcHMpO1xuXG4gICAgY29uc3QgZ3VhcmRyYWlsUG9saWN5ID0gaWFtLk1hbmFnZWRQb2xpY3kuZnJvbUF3c01hbmFnZWRQb2xpY3lOYW1lKCdDbG91ZFdhdGNoUmVhZE9ubHlBY2Nlc3MnKTtcblxuICAgIG5ldyBjaGF0Ym90LlNsYWNrQ2hhbm5lbENvbmZpZ3VyYXRpb24odGhpcywgJ015U2xhY2tDaGFubmVsJywge1xuICAgICAgc2xhY2tDaGFubmVsQ29uZmlndXJhdGlvbk5hbWU6ICd0ZXN0LWNoYW5uZWwnLFxuICAgICAgc2xhY2tXb3Jrc3BhY2VJZDogJ1Q0OTIzOVU0VycsIC8vIG1vZGlmeSB0byB5b3VyIHNsYWNrIHdvcmtzcGFjZSBpZFxuICAgICAgc2xhY2tDaGFubmVsSWQ6ICdDMDE4N0pBQlVFOScsIC8vIG1vZGlmeSB0byB5b3VyIHNsYWNrIGNoYW5uZWwgaWRcbiAgICAgIGd1YXJkcmFpbFBvbGljaWVzOiBbZ3VhcmRyYWlsUG9saWN5XSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5uZXcgQ2hhdGJvdEd1YXJkcmFpbHNJbnRlZyhhcHAsICdDaGF0Ym90R3VhcmRyYWlsc0ludGVnJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.assets.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/ChatbotGuardrailsInteg.template.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.ts similarity index 83% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.ts index ab3ce8d845445..118d28239b131 100644 --- a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-guardrails.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-guardrails.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as chatbot from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; class ChatbotGuardrailsInteg extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js new file mode 100644 index 0000000000000..401dfa07cf8ad --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const logs = require("aws-cdk-lib/aws-logs"); +const cdk = require("aws-cdk-lib"); +const chatbot = require("aws-cdk-lib/aws-chatbot"); +class ChatbotLogRetentionInteg extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const slackChannel = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'test-channel', + slackWorkspaceId: 'T49239U4W', + slackChannelId: 'C0187JABUE9', + loggingLevel: chatbot.LoggingLevel.NONE, + logRetention: logs.RetentionDays.ONE_MONTH, + }); + slackChannel.addToRolePolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: [ + 's3:GetObject', + ], + resources: ['arn:aws:s3:::abc/xyz/123.txt'], + })); + } +} +const app = new cdk.App(); +new ChatbotLogRetentionInteg(app, 'ChatbotLogRetentionInteg'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2hhdGJvdC1sb2dyZXRlbnRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jaGF0Ym90LWxvZ3JldGVudGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyw2Q0FBNkM7QUFDN0MsbUNBQW1DO0FBQ25DLG1EQUFtRDtBQUVuRCxNQUFNLHdCQUF5QixTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQzlDLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLFlBQVksR0FBRyxJQUFJLE9BQU8sQ0FBQyx5QkFBeUIsQ0FBQyxJQUFJLEVBQUUsZ0JBQWdCLEVBQUU7WUFDakYsNkJBQTZCLEVBQUUsY0FBYztZQUM3QyxnQkFBZ0IsRUFBRSxXQUFXO1lBQzdCLGNBQWMsRUFBRSxhQUFhO1lBQzdCLFlBQVksRUFBRSxPQUFPLENBQUMsWUFBWSxDQUFDLElBQUk7WUFDdkMsWUFBWSxFQUFFLElBQUksQ0FBQyxhQUFhLENBQUMsU0FBUztTQUMzQyxDQUFDLENB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VyYXRpb25OYW1lOiAndGVzdC1jaGFubmVsJyxcbiAgICAgIHNsYWNrV29ya3NwYWNlSWQ6ICdUNDkyMzlVNFcnLCAvLyBtb2RpZnkgdG8geW91ciBzbGFjayB3b3Jrc3BhY2UgaWRcbiAgICAgIHNsYWNrQ2hhbm5lbElkOiAnQzAxODdKQUJVRTknLCAvLyBtb2RpZnkgdG8geW91ciBzbGFjayBjaGFubmVsIGlkXG4gICAgICBsb2dnaW5nTGV2ZWw6IGNoYXRib3QuTG9nZ2luZ0xldmVsLk5PTkUsXG4gICAgICBsb2dSZXRlbnRpb246IGxvZ3MuUmV0ZW50aW9uRGF5cy5PTkVfTU9OVEgsXG4gICAgfSk7XG5cbiAgICBzbGFja0NoYW5uZWwuYWRkVG9Sb2xlUG9saWN5KG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgICAgIGVmZmVjdDogaWFtLkVmZmVjdC5BTExPVyxcbiAgICAgIGFjdGlvbnM6IFtcbiAgICAgICAgJ3MzOkdldE9iamVjdCcsXG4gICAgICBdLFxuICAgICAgcmVzb3VyY2VzOiBbJ2Fybjphd3M6czM6OjphYmMveHl6LzEyMy50eHQnXSxcbiAgICB9KSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IENoYXRib3RMb2dSZXRlbnRpb25JbnRlZyhhcHAsICdDaGF0Ym90TG9nUmV0ZW50aW9uSW50ZWcnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.assets.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/ChatbotLogRetentionInteg.template.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.ts similarity index 82% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.ts index b23280b6c45d7..22e3e77a07fc1 100644 --- a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot-logretention.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as chatbot from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; class ChatbotLogRetentionInteg extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js new file mode 100644 index 0000000000000..d38ea6740182e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const chatbot = require("aws-cdk-lib/aws-chatbot"); +class ChatbotInteg extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const slackChannel = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'test-channel', + slackWorkspaceId: 'T49239U4W', + slackChannelId: 'C0187JABUE9', + loggingLevel: chatbot.LoggingLevel.NONE, + }); + slackChannel.addToRolePolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: [ + 's3:GetObject', + ], + resources: ['arn:aws:s3:::abc/xyz/123.txt'], + })); + } +} +const app = new cdk.App(); +new ChatbotInteg(app, 'ChatbotInteg'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2hhdGJvdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNoYXRib3QudHMiXSw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XG5uZXcgQ2hhdGJvdEludGVnKGFwcCwgJ0NoYXRib3RJbnRlZycpO1xuXG5hcHAuc3ludGgoKTtcblxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.assets.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/ChatbotInteg.template.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.ts similarity index 85% rename from packages/@aws-cdk/aws-chatbot/test/integ.chatbot.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.ts index c005dfa873abe..f239892c766bf 100644 --- a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-chatbot/test/integ.chatbot.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as chatbot from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; class ChatbotInteg extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/asset-directory-fixture/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/asset-directory-fixture/index.d.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/asset-directory-fixture/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/asset-directory-fixture/index.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/asset-directory-fixture/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/asset-directory-fixture/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/asset-directory-fixture/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/asset-directory-fixture/index.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/core-custom-resource-provider-fixture/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/core-custom-resource-provider-fixture/index.d.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/core-custom-resource-provider-fixture/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/core-custom-resource-provider-fixture/index.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js new file mode 100644 index 0000000000000..b14a705f44982 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_sqs_1 = require("aws-cdk-lib/aws-sqs"); +const aws_ssm_1 = require("aws-cdk-lib/aws-ssm"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const constructs_1 = require("constructs"); +// GIVEN +const app = new aws_cdk_lib_1.App({ + treeMetadata: false, +}); +class ProducerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id, { + env: { + region: 'us-east-1', + }, + crossRegionReferences: true, + }); + const nested = new aws_cdk_lib_1.NestedStack(this, 'IntegNested'); + this.queue = new aws_sqs_1.Queue(this, 'IntegQueue'); + this.nestedQueue = new aws_sqs_1.Queue(nested, 'NestedIntegQueue'); + } +} +class ConsumerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, { + ...props, + env: { + region: 'us-east-2', + }, + crossRegionReferences: true, + }); + const nested = new aws_cdk_lib_1.NestedStack(this, 'IntegNested'); + props.queues.forEach((queue, i) => { + new aws_ssm_1.StringParameter(this, 'IntegParameter' + i, { + parameterName: 'integ-parameter' + i, + stringValue: queue.queueName, + }); + new aws_ssm_1.StringParameter(nested, 'IntegNestedParameter' + i, { + parameterName: 'integ-nested-parameter' + i, + stringValue: queue.queueName, + }); + }); + } +} +class TestCase extends constructs_1.Construct { + constructor(scope, id) { + super(scope, id); + this.producer = new ProducerStack(app, 'cross-region-producer'); + this.testCase = new ConsumerStack(app, 'cross-region-consumer', { + queues: [this.producer.queue, this.producer.nestedQueue], + }); + } +} +const testCase1 = new TestCase(app, 'TestCase1'); +// THEN +const integ = new integ_tests_alpha_1.IntegTest(app, 'cross-region-references', { + testCases: [testCase1.testCase], + stackUpdateWorkflow: false, +}); +/** + * Test that if the references are still in use, deleting the producer + * stack will fail + * + * When the test cleans up it will delete the consumer then the producer, which should + * test that the parameters are cleaned up correctly. + */ +integ.assertions.awsApiCall('CloudFormation', 'deleteStack', { + StackName: testCase1.producer.stackName, +}).next(integ.assertions.awsApiCall('CloudFormation', 'describeStacks', { + StackName: testCase1.producer.stackName, +}).expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Stacks: integ_tests_alpha_1.Match.arrayWith([ + integ_tests_alpha_1.Match.objectLike({ + StackName: testCase1.producer.stackName, + StackStatus: 'DELETE_FAILED', + }), + ]), +})).waitForAssertions()); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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iAqIHRlc3QgdGhhdCB0aGUgcGFyYW1ldGVycyBhcmUgY2xlYW5lZCB1cCBjb3JyZWN0bHkuXG4gKi9cblxuaW50ZWcuYXNzZXJ0aW9ucy5hd3NBcGlDYWxsKCdDbG91ZEZvcm1hdGlvbicsICdkZWxldGVTdGFjaycsIHtcbiAgU3RhY2tOYW1lOiB0ZXN0Q2FzZTEucHJvZHVjZXIuc3RhY2tOYW1lLFxufSkubmV4dChcbiAgaW50ZWcuYXNzZXJ0aW9ucy5hd3NBcGlDYWxsKCdDbG91ZEZvcm1hdGlvbicsICdkZXNjcmliZVN0YWNrcycsIHtcbiAgICBTdGFja05hbWU6IHRlc3RDYXNlMS5wcm9kdWNlci5zdGFja05hbWUsXG4gIH0pLmV4cGVjdChFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgICBTdGFja3M6IE1hdGNoLmFycmF5V2l0aChbXG4gICAgICBNYXRjaC5vYmplY3RMaWtlKHtcbiAgICAgICAgU3RhY2tOYW1lOiB0ZXN0Q2FzZTEucHJvZHVjZXIuc3RhY2tOYW1lLFxuICAgICAgICBTdGFja1N0YXR1czogJ0RFTEVURV9GQUlMRUQnLFxuICAgICAgfSksXG4gICAgXSksXG4gIH0pKS53YWl0Rm9yQXNzZXJ0aW9ucygpLFxuKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cross-region-producer.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionconsumerIntegNested815BEF8A.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionconsumerIntegNested815BEF8A.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionconsumerIntegNested815BEF8A.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionconsumerIntegNested815BEF8A.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionproducerIntegNested3342EBEB.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionproducerIntegNested3342EBEB.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionproducerIntegNested3342EBEB.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionproducerIntegNested3342EBEB.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.ts similarity index 93% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.ts index 5e6408139889d..d77be7df4678e 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-cross-region-references.ts @@ -1,7 +1,7 @@ -import { Queue, IQueue } from '@aws-cdk/aws-sqs'; -import { StringParameter } from '@aws-cdk/aws-ssm'; -import { App, Stack, StackProps, NestedStack } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests'; +import { Queue, IQueue } from 'aws-cdk-lib/aws-sqs'; +import { StringParameter } from 'aws-cdk-lib/aws-ssm'; +import { App, Stack, StackProps, NestedStack } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; // GIVEN diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js new file mode 100644 index 0000000000000..74fcefa103d1a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* + * Stack verification steps: + * - Deploy with `--no-clean` + * - Verify that the CloudFormation stack outputs have the following values: + * - Ref: "MyPhysicalReflectBack" + * - GetAtt.Attribute1: "foo" + * - GetAtt.Attribute2: 1234 + */ +const aws_cdk_lib_1 = require("aws-cdk-lib"); +/* eslint-disable @aws-cdk/no-core-construct */ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const resourceType = 'Custom::Reflect'; + const lengthyResourceType = 'Custom::Given_Resource_Type_Is_Exactly_Sixty_Characters_Long'; + const serviceToken = aws_cdk_lib_1.CustomResourceProvider.getOrCreate(this, resourceType, { + codeDirectory: `${__dirname}/core-custom-resource-provider-fixture`, + runtime: aws_cdk_lib_1.CustomResourceProviderRuntime.NODEJS_14_X, + description: 'veni vidi vici', + }); + const cr = new aws_cdk_lib_1.CustomResource(this, 'MyResource', { + resourceType, + serviceToken, + properties: { + physicalResourceId: 'MyPhysicalReflectBack', + attributes: { + Attribute1: 'foo', + Attribute2: 1234, + }, + }, + }); + new aws_cdk_lib_1.CustomResource(this, 'MyLengthyTypeResource', { + resourceType: lengthyResourceType, + serviceToken, + properties: { + physicalResourceId: 'MyPhysicalLengthyType', + }, + }); + new aws_cdk_lib_1.CfnOutput(this, 'Ref', { value: cr.ref }); + new aws_cdk_lib_1.CfnOutput(this, 'GetAtt.Attribute1', { value: aws_cdk_lib_1.Token.asString(cr.getAtt('Attribute1')) }); + new aws_cdk_lib_1.CfnOutput(this, 'GetAtt.Attribute2', { value: aws_cdk_lib_1.Token.asString(cr.getAtt('Attribute2')) }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'custom-resource-test'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29yZS1jdXN0b20tcmVzb3VyY2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY29yZS1jdXN0b20tcmVzb3VyY2VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7Ozs7R0FPRztBQUNILDZDQUFrSTtBQUdsSSwrQ0FBK0M7QUFFL0MsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVU7UUFDdEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ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ICAgIG5ldyBDdXN0b21SZXNvdXJjZSh0aGlzLCAnTXlMZW5ndGh5VHlwZVJlc291cmNlJywge1xuICAgICAgcmVzb3VyY2VUeXBlOiBsZW5ndGh5UmVzb3VyY2VUeXBlLFxuICAgICAgc2VydmljZVRva2VuLFxuICAgICAgcHJvcGVydGllczoge1xuICAgICAgICBwaHlzaWNhbFJlc291cmNlSWQ6ICdNeVBoeXNpY2FsTGVuZ3RoeVR5cGUnLFxuICAgICAgfSxcbiAgICB9KTtcblxuICAgIG5ldyBDZm5PdXRwdXQodGhpcywgJ1JlZicsIHsgdmFsdWU6IGNyLnJlZiB9KTtcbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdHZXRBdHQuQXR0cmlidXRlMScsIHsgdmFsdWU6IFRva2VuLmFzU3RyaW5nKGNyLmdldEF0dCgnQXR0cmlidXRlMScpKSB9KTtcbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdHZXRBdHQuQXR0cmlidXRlMicsIHsgdmFsdWU6IFRva2VuLmFzU3RyaW5nKGNyLmdldEF0dCgnQXR0cmlidXRlMicpKSB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2N1c3RvbS1yZXNvdXJjZS10ZXN0Jyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/asset.94be4e33263da312b2e3d038a855c4b46686a35cc3188e9736010642b8a9078a/index.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/custom-resource-test.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts index cdd25e7d4c179..036d8662e787b 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-custom-resources.ts @@ -6,7 +6,7 @@ * - GetAtt.Attribute1: "foo" * - GetAtt.Attribute2: 1234 */ -import { App, CfnOutput, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Stack, Token } from '@aws-cdk/core'; +import { App, CfnOutput, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Stack, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; /* eslint-disable @aws-cdk/no-core-construct */ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js new file mode 100644 index 0000000000000..8fa7284d13455 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* + * Real replaceDependency use case to test + * + * TestStack verification steps: + * - Deploy with `--no-clean` + * - Verify that the CloudFormation stack LogRetention CfnResource dependencies list CustomPolicy, not DefaultPolicy + * + * TestNestedStack verification steps: + * - Deploy with `--no-clean` + * - Verify that Stack2 lists Stack1 in DependsOn + */ +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + new lambda.Function(this, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: aws_logs_1.RetentionDays.ONE_DAY, + }); + const logRetentionFunction = this.node.tryFindChild('LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a'); + const serviceRole = logRetentionFunction.node.tryFindChild('ServiceRole'); + const defaultPolicy = serviceRole.node.tryFindChild('DefaultPolicy').node.defaultChild; + const customPolicy = new iam.CfnManagedPolicy(this, 'CustomPolicy', { + policyDocument: defaultPolicy.policyDocument, + roles: defaultPolicy.roles, + }); + const logRetentionResource = logRetentionFunction.node.tryFindChild('Resource'); + // Without replacing the dependency, Cfn will reject the template because it references this non-existent logical id + logRetentionResource.replaceDependency(defaultPolicy, customPolicy); + serviceRole.node.tryRemoveChild('DefaultPolicy'); + } +} +class TestNestedStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const stack1 = new aws_cdk_lib_1.NestedStack(this, 'Stack1'); + const stack2 = new aws_cdk_lib_1.NestedStack(this, 'Stack2'); + const resource1 = new lambda.Function(stack1, 'Lambda1', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }).node.defaultChild; + const resource2 = new lambda.Function(stack2, 'Lambda2', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }).node.defaultChild; + // The following two statements should cancel each other out + resource1.addDependency(resource2); + resource1.removeDependency(resource2); + resource2.addDependency(resource1); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'replace-depends-on-test'); +const nestedStack = new TestNestedStack(app, 'nested-stack-depends-test'); +new integ.IntegTest(app, 'DependsOnTest', { + testCases: [stack, nestedStack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJza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mVzb3VyY2UxLmFkZERlcGVuZGVuY3kocmVzb3VyY2UyKTtcbiAgICByZXNvdXJjZTEucmVtb3ZlRGVwZW5kZW5jeShyZXNvdXJjZTIpO1xuXG4gICAgcmVzb3VyY2UyLmFkZERlcGVuZGVuY3kocmVzb3VyY2UxKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBUZXN0U3RhY2soYXBwLCAncmVwbGFjZS1kZXBlbmRzLW9uLXRlc3QnKTtcbmNvbnN0IG5lc3RlZFN0YWNrID0gbmV3IFRlc3ROZXN0ZWRTdGFjayhhcHAsICduZXN0ZWQtc3RhY2stZGVwZW5kcy10ZXN0Jyk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnRGVwZW5kc09uVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2ssIG5lc3RlZFN0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.ts similarity index 90% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.ts index b8ea66419e9cc..14cfb04d87f33 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.core-deps.ts @@ -9,11 +9,11 @@ * - Deploy with `--no-clean` * - Verify that Stack2 lists Stack1 in DependsOn */ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { RetentionDays } from '@aws-cdk/aws-logs'; -import { App, Stack, CfnResource, NestedStack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { RetentionDays } from 'aws-cdk-lib/aws-logs'; +import { App, Stack, CfnResource, NestedStack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; class TestStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js new file mode 100644 index 0000000000000..a8a93b9749f36 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sns = require("aws-cdk-lib/aws-sns"); +const sns_subscriptions = require("aws-cdk-lib/aws-sns-subscriptions"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +class MyNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id, props) { + const topicNamePrefixLogicalId = 'TopicNamePrefix'; + super(scope, id, { + parameters: { + [topicNamePrefixLogicalId]: props.topicNamePrefix, // pass in a parameter to the nested stack + }, + description: props.description, + }); + const topicNamePrefixParameter = new aws_cdk_lib_1.CfnParameter(this, 'TopicNamePrefix', { type: 'String' }); + for (let i = 0; i < props.topicCount; ++i) { + const topic = new sns.Topic(this, `topic-${i}`, { displayName: `${topicNamePrefixParameter.valueAsString}-${i}` }); + // since the subscription resources are defined in the subscriber's stack, this + // will add an SNS subscription resource to the parent stack that reference this topic. + if (props.subscriber) { + topic.addSubscription(new sns_subscriptions.SqsSubscription(props.subscriber)); + } + } + if (props.subscriber) { + new lambda.Function(this, 'fn', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('console.error("hi")'), + handler: 'index.handler', + environment: { + TOPIC_ARN: props.siblingTopic?.topicArn ?? '', + QUEUE_URL: props.subscriber.queueUrl, // nested stack references a resource in the parent + }, + }); + } + } +} +class MyTestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const queue = new sqs.Queue(this, 'SubscriberQueue'); + new MyNestedStack(this, 'NestedStack1', { topicCount: 3, topicNamePrefix: 'Prefix1', subscriber: queue }); + new MyNestedStack(this, 'NestedStack2', { topicCount: 2, topicNamePrefix: 'Prefix2', description: 'This is secound nested stack.' }); + } +} +const app = new aws_cdk_lib_1.App(); +new MyTestStack(app, 'nested-stacks-test'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubmVzdGVkLXN0YWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQyx1RUFBdUU7QUFDdkUsMkNBQTJD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NeU5lc3RlZFN0YWNrKHRoaXMsICdOZXN0ZWRTdGFjazInLCB7IHRvcGljQ291bnQ6IDIsIHRvcGljTmFtZVByZWZpeDogJ1ByZWZpeDInLCBkZXNjcmlwdGlvbjogJ1RoaXMgaXMgc2Vjb3VuZCBuZXN0ZWQgc3RhY2suJyB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgTXlUZXN0U3RhY2soYXBwLCAnbmVzdGVkLXN0YWNrcy10ZXN0Jyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nested-stacks-test.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack1C289F6D5.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack1C289F6D5.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack1C289F6D5.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack1C289F6D5.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack209C5218A.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack209C5218A.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack209C5218A.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/nestedstackstestNestedStack209C5218A.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts similarity index 88% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts index c5f8227f9796b..7800f14771927 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stack.ts @@ -1,8 +1,8 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sns_subscriptions from '@aws-cdk/aws-sns-subscriptions'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, CfnParameter, NestedStack, Stack } from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sns_subscriptions from 'aws-cdk-lib/aws-sns-subscriptions'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, CfnParameter, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; /* eslint-disable @aws-cdk/no-core-construct */ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js new file mode 100644 index 0000000000000..37ab96a99fad5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +/* eslint-disable @aws-cdk/no-core-construct */ +class MyNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id) { + super(scope, id); + new lambda.Function(this, 'Handler', { + code: lambda.Code.fromAsset(path.join(__dirname, 'asset-directory-fixture')), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + }); + } +} +class ParentStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + new MyNestedStack(this, 'Nested'); + } +} +const app = new aws_cdk_lib_1.App(); +new ParentStack(app, 'nested-stacks-assets'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy1hc3NldHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5uZXN0ZWQtc3RhY2tzLWFzc2V0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixpREFBaUQ7QUFDakQsNkNBQXNEO0FBR3RELCtDQUErQztBQUUvQyxNQUFNLGFBQWMsU0FBUSx5QkFBVztJQUNyQyxZQUFZLEtBQWdCLEVBQUUsRUFBVTtRQUN0QyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLElBQUksTUFBTSxDQUFDLFFBQVEsQ0FB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HNjb3BlOiBDb25zdHJ1Y3QsIGlkOiBzdHJpbmcpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuXG4gICAgbmV3IGxhbWJkYS5GdW5jdGlvbih0aGlzLCAnSGFuZGxlcicsIHtcbiAgICAgIGNvZGU6IGxhbWJkYS5Db2RlLmZyb21Bc3NldChwYXRoLmpvaW4oX19kaXJuYW1lLCAnYXNzZXQtZGlyZWN0b3J5LWZpeHR1cmUnKSksXG4gICAgICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5OT0RFSlNfMTRfWCxcbiAgICAgIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgICB9KTtcbiAgfVxufVxuXG5jbGFzcyBQYXJlbnRTdGFjayBleHRlbmRzIFN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICBuZXcgTXlOZXN0ZWRTdGFjayh0aGlzLCAnTmVzdGVkJyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFBhcmVudFN0YWNrKGFwcCwgJ25lc3RlZC1zdGFja3MtYXNzZXRzJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/asset.bbe209afddb09a12327bab7a105e085758a29b769b5b4bf5b6320ac41b05fc51/index.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nested-stacks-assets.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nestedstacksassetsNested51BEE8E8.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nestedstacksassetsNested51BEE8E8.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nestedstacksassetsNested51BEE8E8.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/nestedstacksassetsNested51BEE8E8.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts similarity index 86% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts index b3c49a7e7d493..ffd1c2d1a2021 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-assets.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, NestedStack, Stack } from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; /* eslint-disable @aws-cdk/no-core-construct */ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js new file mode 100644 index 0000000000000..af63c271a3088 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const app = new aws_cdk_lib_1.App(); +const top = new aws_cdk_lib_1.Stack(app, 'nested-stacks-multi-refs'); +const level1 = new sns.Topic(top, 'Level1'); +const nested1 = new aws_cdk_lib_1.NestedStack(top, 'Nested1'); +const nested2 = new aws_cdk_lib_1.NestedStack(nested1, 'Nested2'); +const nested3 = new aws_cdk_lib_1.NestedStack(nested2, 'Nested3'); +// WHEN +const level2 = new sns.Topic(nested2, 'Level2ReferencesLevel1', { + displayName: shortName(level1.topicName), +}); +new sns.Topic(nested3, 'Level3ReferencesLevel1', { + displayName: shortName(level1.topicName), +}); +new sns.Topic(nested3, 'Level3ReferencesLevel2', { + displayName: shortName(level2.topicName), +}); +app.synth(); +// topicName is too long for displayName, so just take the second part: +// Stack1-NestedUnderStack1NestedStackNestedUnderStack1NestedStackResourceF616305B-EM64TEGA04J9-TopicInNestedUnderStack115E329C4-HEO7NLYC1AFL +function shortName(topicName) { + return aws_cdk_lib_1.Fn.select(1, aws_cdk_lib_1.Fn.split('-', topicName)); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy1tdWx0aS1yZWZzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubmVzdGVkLXN0YWNrcy1tdWx0aS1yZWZzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDZDQUEwRDtBQUUxRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEdBQUcsR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLDBCQUEwQixDQUFDLENBQUM7QUFDdkQsTUFBTSxNQUFNLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxRQUFRLENBQUMsQ0FBQztBQUM1QyxNQUFNLE9BQU8sR0FBRyxJQUFJLHlCQUFXLENBQUMsR0FBRyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0FBQ2hELE1BQU0sT0FBTyxHQUFHLElBQUkseUJBQVcsQ0FBQyxPQUFPLEVBQUUsU0FBUyxDQUFDLENBQUM7QUFDcEQsTUFBTSxPQUFPLEdBQUcsSUFBSSx5QkFBVyxDQUFDLE9BQU8sRUFBRSxTQUFTLENBQUMsQ0FBQztBQUVwRCxPQUFPO0FBQ1AsTUFBTSxNQUF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i5zcGxpdCgnLScsIHRvcGljTmFtZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nested-stacks-multi-refs.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested146CE1F9F.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested146CE1F9F.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested146CE1F9F.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested146CE1F9F.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2B1544EC7.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2B1544EC7.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2B1544EC7.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2B1544EC7.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2Nested34EDB63C2.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2Nested34EDB63C2.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2Nested34EDB63C2.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/nestedstacksmultirefsNested1Nested2Nested34EDB63C2.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.ts similarity index 89% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.ts index f0d3cae275f5f..b8852d919555c 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi-refs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi-refs.ts @@ -1,5 +1,5 @@ -import * as sns from '@aws-cdk/aws-sns'; -import { App, Fn, NestedStack, Stack } from '@aws-cdk/core'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, Fn, NestedStack, Stack } from 'aws-cdk-lib'; const app = new App(); const top = new Stack(app, 'nested-stacks-multi-refs'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js new file mode 100644 index 0000000000000..6cab7e9c8105b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +/* eslint-disable @aws-cdk/no-core-construct */ +class YourNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id) { + super(scope, id); + new sns.Topic(this, 'YourResource'); + } +} +class MyNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id) { + super(scope, id); + new sns.Topic(this, 'MyResource'); + new YourNestedStack(this, 'NestedChild'); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'nested-stacks-multi'); +new MyNestedStack(stack, 'NestedStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy1tdWx0aS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm5lc3RlZC1zdGFja3MtbXVsdGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFB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by1jb3JlLWNvbnN0cnVjdCAqL1xuXG5jbGFzcyBZb3VyTmVzdGVkU3RhY2sgZXh0ZW5kcyBOZXN0ZWRTdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBDb25zdHJ1Y3QsIGlkOiBzdHJpbmcpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuXG4gICAgbmV3IHNucy5Ub3BpYyh0aGlzLCAnWW91clJlc291cmNlJyk7XG4gIH1cbn1cblxuY2xhc3MgTXlOZXN0ZWRTdGFjayBleHRlbmRzIE5lc3RlZFN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICBuZXcgc25zLlRvcGljKHRoaXMsICdNeVJlc291cmNlJyk7XG5cbiAgICBuZXcgWW91ck5lc3RlZFN0YWNrKHRoaXMsICdOZXN0ZWRDaGlsZCcpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IFN0YWNrKGFwcCwgJ25lc3RlZC1zdGFja3MtbXVsdGknKTtcbm5ldyBNeU5lc3RlZFN0YWNrKHN0YWNrLCAnTmVzdGVkU3RhY2snKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nested-stacks-multi.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStack08DBC739.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStack08DBC739.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStack08DBC739.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStack08DBC739.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStackNestedChild2A7A1713.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStackNestedChild2A7A1713.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStackNestedChild2A7A1713.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/nestedstacksmultiNestedStackNestedChild2A7A1713.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts similarity index 85% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts index ebd9f51ee93ed..ff4e8ece52ac6 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-multi.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-multi.ts @@ -1,5 +1,5 @@ -import * as sns from '@aws-cdk/aws-sns'; -import { App, NestedStack, Stack } from '@aws-cdk/core'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; /* eslint-disable @aws-cdk/no-core-construct */ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js new file mode 100644 index 0000000000000..608a47881a942 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js @@ -0,0 +1,17 @@ +"use strict"; +/// !cdk-integ Stack1 Stack2 +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const app = new aws_cdk_lib_1.App(); +const stack1 = new aws_cdk_lib_1.Stack(app, 'Stack1'); +const stack2 = new aws_cdk_lib_1.Stack(app, 'Stack2'); +const nestedUnderStack1 = new aws_cdk_lib_1.NestedStack(stack1, 'NestedUnderStack1'); +const topicInNestedUnderStack1 = new sns.Topic(nestedUnderStack1, 'TopicInNestedUnderStack1'); +new sns.Topic(stack2, 'TopicInStack2', { + // topicName is too long for displayName, so just take the second part: + // Stack1-NestedUnderStack1NestedStackNestedUnderStack1NestedStackResourceF616305B-EM64TEGA04J9-TopicInNestedUnderStack115E329C4-HEO7NLYC1AFL + displayName: aws_cdk_lib_1.Fn.select(1, aws_cdk_lib_1.Fn.split('-', topicInNestedUnderStack1.topicName)), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy1uZXN0ZWQtZXhwb3J0LXRvLXNpYmxpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5uZXN0ZWQtc3RhY2tzLW5lc3RlZC1leHBvcnQtdG8tc2libGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNEJBQTRCOztBQUU1QiwyQ0FBMkM7QUFDM0MsNkNBQTBEO0FBRTFELE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sTUFBTSxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsUUFBUSxDQUFDLENBQUM7QUFDeEMsTUFBTSxNQUFNLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxRQUFRLENBQUMsQ0FBQztBQUV4QyxNQUFNLGlCQUFpQixHQUFHLElBQUkseUJBQVcsQ0FBQyxNQUFNLEVBQUUsbUJBQW1CLENBQUMsQ0FBQztBQUN2RSxNQUFNLHdCQUF3QixHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxpQkFBaUIsRUFBRSwwQkFBMEIsQ0FBQyxDQUFDO0FBRTlGLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxNQUFNLEVBQUUsZUFBZSxFQUFFO0lBQ3JDLHVFQUF1RTtJQUN2RSw2SUFBNkk7SUFDN0ksV0FBVyxFQUFFLGdCQUFFLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxnQkFBRSxDQUFDLEtBQUssQ0FBQ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lbGVjdCgxLCBGbi5zcGxpdCgnLScsIHRvcGljSW5OZXN0ZWRVbmRlclN0YWNrMS50b3BpY05hbWUpKSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1NestedUnderStack15F1F8640.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1NestedUnderStack15F1F8640.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1NestedUnderStack15F1F8640.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack1NestedUnderStack15F1F8640.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/Stack2.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.ts similarity index 86% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.ts index b5ad58fbb6c57..ff4df705b32ef 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-nested-export-to-sibling.ts @@ -1,7 +1,7 @@ /// !cdk-integ Stack1 Stack2 -import * as sns from '@aws-cdk/aws-sns'; -import { App, Fn, NestedStack, Stack } from '@aws-cdk/core'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, Fn, NestedStack, Stack } from 'aws-cdk-lib'; const app = new App(); const stack1 = new Stack(app, 'Stack1'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js new file mode 100644 index 0000000000000..fde8b8b8c87a6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js @@ -0,0 +1,31 @@ +"use strict"; +/// !cdk-integ * +Object.defineProperty(exports, "__esModule", { value: true }); +// nested stack references a resource from a non-nested non-parent stack +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +class ConsumerNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id, topic) { + super(scope, id); + new sns.Topic(this, 'ConsumerTopic', { + displayName: `Consumer of ${topic.topicName}`, + }); + } +} +class ProducerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + this.topic = new sns.Topic(this, 'MyTopic'); + } +} +class ParentStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, topic) { + super(scope, id); + new ConsumerNestedStack(this, 'Nested1', topic); + } +} +const app = new aws_cdk_lib_1.App(); +const producer = new ProducerStack(app, 'nest-stacks-refs1-producer'); +new ParentStack(app, 'nested-stacks-refs1-parent-with-consumer', producer.topic); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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7XG4gICAgc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIHRoaXMudG9waWMgPSBuZXcgc25zLlRvcGljKHRoaXMsICdNeVRvcGljJyk7XG4gIH1cbn1cblxuY2xhc3MgUGFyZW50U3RhY2sgZXh0ZW5kcyBTdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBDb25zdHJ1Y3QsIGlkOiBzdHJpbmcsIHRvcGljOiBzbnMuVG9waWMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuXG4gICAgbmV3IENvbnN1bWVyTmVzdGVkU3RhY2sodGhpcywgJ05lc3RlZDEnLCB0b3BpYyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3QgcHJvZHVjZXIgPSBuZXcgUHJvZHVjZXJTdGFjayhhcHAsICduZXN0LXN0YWNrcy1yZWZzMS1wcm9kdWNlcicpO1xubmV3IFBhcmVudFN0YWNrKGFwcCwgJ25lc3RlZC1zdGFja3MtcmVmczEtcGFyZW50LXdpdGgtY29uc3VtZXInLCBwcm9kdWNlci50b3BpYyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nest-stacks-refs1-producer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nest-stacks-refs1-producer.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nest-stacks-refs1-producer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nest-stacks-refs1-producer.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nested-stacks-refs1-parent-with-consumer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nested-stacks-refs1-parent-with-consumer.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nested-stacks-refs1-parent-with-consumer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nested-stacks-refs1-parent-with-consumer.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nestedstacksrefs1parentwithconsumerNested151B8A692.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nestedstacksrefs1parentwithconsumerNested151B8A692.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nestedstacksrefs1parentwithconsumerNested151B8A692.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/nestedstacksrefs1parentwithconsumerNested151B8A692.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.ts similarity index 90% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.ts index 2f5e569eb1a9e..9d3dec14df0de 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs1.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs1.ts @@ -2,8 +2,8 @@ // nested stack references a resource from a non-nested non-parent stack -import * as sns from '@aws-cdk/aws-sns'; -import { App, NestedStack, Stack } from '@aws-cdk/core'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; class ConsumerNestedStack extends NestedStack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js new file mode 100644 index 0000000000000..9379b310647f4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +// non-nested non-parent stack consumes a resource from a nested stack +class ProducerNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id) { + super(scope, id); + this.topic = new sns.Topic(this, 'MyTopic'); + } +} +class ParentStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const nested = new ProducerNestedStack(this, 'Nested1'); + this.topic = nested.topic; + } +} +class ConsumerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, topic) { + super(scope, id); + new sns.Topic(this, 'ConsumerTopic', { + displayName: `Consuming ${aws_cdk_lib_1.Fn.select(2, aws_cdk_lib_1.Fn.split('-', topic.topicName))}`, // just shorten because display name is limited + }); + } +} +const app = new aws_cdk_lib_1.App(); +const parent = new ParentStack(app, 'nested-stacks-refs2-parent-with-producer'); +new ConsumerStack(app, 'nested-stacks-refs2-consumer', parent.topic); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy1yZWZzMi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm5lc3RlZC1zdGFja3MtcmVmczIudHMiXSwibmFtZXMiOltdLCJ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ge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICBjb25zdCBuZXN0ZWQgPSBuZXcgUHJvZHVjZXJOZXN0ZWRTdGFjayh0aGlzLCAnTmVzdGVkMScpO1xuICAgIHRoaXMudG9waWMgPSBuZXN0ZWQudG9waWM7XG4gIH1cbn1cblxuY2xhc3MgQ29uc3VtZXJTdGFjayBleHRlbmRzIFN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZywgdG9waWM6IHNucy5Ub3BpYykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICBuZXcgc25zLlRvcGljKHRoaXMsICdDb25zdW1lclRvcGljJywge1xuICAgICAgZGlzcGxheU5hbWU6IGBDb25zdW1pbmcgJHtGbi5zZWxlY3QoMiwgRm4uc3BsaXQoJy0nLCB0b3BpYy50b3BpY05hbWUpKX1gLCAvLyBqdXN0IHNob3J0ZW4gYmVjYXVzZSBkaXNwbGF5IG5hbWUgaXMgbGltaXRlZFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHBhcmVudCA9IG5ldyBQYXJlbnRTdGFjayhhcHAsICduZXN0ZWQtc3RhY2tzLXJlZnMyLXBhcmVudC13aXRoLXByb2R1Y2VyJyk7XG5uZXcgQ29uc3VtZXJTdGFjayhhcHAsICduZXN0ZWQtc3RhY2tzLXJlZnMyLWNvbnN1bWVyJywgcGFyZW50LnRvcGljKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-consumer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-consumer.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-consumer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-consumer.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-parent-with-producer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-parent-with-producer.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-parent-with-producer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nested-stacks-refs2-parent-with-producer.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nestedstacksrefs2parentwithproducerNested1BBFBB3D5.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nestedstacksrefs2parentwithproducerNested1BBFBB3D5.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nestedstacksrefs2parentwithproducerNested1BBFBB3D5.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/nestedstacksrefs2parentwithproducerNested1BBFBB3D5.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.ts similarity index 91% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.ts index e77ca235555ef..796fa5420301a 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs2.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs2.ts @@ -1,6 +1,6 @@ /// !cdk-integ * -import * as sns from '@aws-cdk/aws-sns'; -import { App, Fn, NestedStack, Stack } from '@aws-cdk/core'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, Fn, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; // non-nested non-parent stack consumes a resource from a nested stack diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js new file mode 100644 index 0000000000000..4427243881104 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +// references between siblings +class ProducerNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id) { + super(scope, id); + this.topic = new sns.Topic(this, 'MyTopic'); + } +} +class ConsumerNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id, topic) { + super(scope, id); + new sns.Topic(this, 'ConsumerTopic', { + displayName: `Consuming ${aws_cdk_lib_1.Fn.select(2, aws_cdk_lib_1.Fn.split('-', topic.topicName))}`, // just shorten because display name is limited + }); + } +} +class ParentStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const nested = new ProducerNestedStack(this, 'Nested1'); + new ConsumerNestedStack(this, 'Nested2', nested.topic); + } +} +const app = new aws_cdk_lib_1.App(); +new ParentStack(app, 'nested-stacks-refs3-siblings'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3RvcihzY29wZTogQ29uc3RydWN0LCBpZDogc3RyaW5nLCB0b3BpYzogc25zLlRvcGljKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIG5ldyBzbnMuVG9waWModGhpcywgJ0NvbnN1bWVyVG9waWMnLCB7XG4gICAgICBkaXNwbGF5TmFtZTogYENvbnN1bWluZyAke0ZuLnNlbGVjdCgyLCBGbi5zcGxpdCgnLScsIHRvcGljLnRvcGljTmFtZSkpfWAsIC8vIGp1c3Qgc2hvcnRlbiBiZWNhdXNlIGRpc3BsYXkgbmFtZSBpcyBsaW1pdGVkXG4gICAgfSk7XG4gIH1cbn1cblxuY2xhc3MgUGFyZW50U3RhY2sgZXh0ZW5kcyBTdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBDb25zdHJ1Y3QsIGlkOiBzdHJpbmcpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuXG4gICAgY29uc3QgbmVzdGVkID0gbmV3IFByb2R1Y2VyTmVzdGVkU3RhY2sodGhpcywgJ05lc3RlZDEnKTtcbiAgICBuZXcgQ29uc3VtZXJOZXN0ZWRTdGFjayh0aGlzLCAnTmVzdGVkMicsIG5lc3RlZC50b3BpYyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5uZXcgUGFyZW50U3RhY2soYXBwLCAnbmVzdGVkLXN0YWNrcy1yZWZzMy1zaWJsaW5ncycpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nested-stacks-refs3-siblings.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nested-stacks-refs3-siblings.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nested-stacks-refs3-siblings.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nested-stacks-refs3-siblings.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested1C1211E86.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested1C1211E86.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested1C1211E86.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested1C1211E86.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested22C7C46E6.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested22C7C46E6.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested22C7C46E6.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/nestedstacksrefs3siblingsNested22C7C46E6.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.ts similarity index 90% rename from packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.ts index d2ba9f6a4f71d..660f425e68995 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-refs3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudformation/test/integ.nested-stacks-refs3.ts @@ -1,6 +1,6 @@ /// !cdk-integ * -import * as sns from '@aws-cdk/aws-sns'; -import { App, Fn, NestedStack, Stack } from '@aws-cdk/core'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, Fn, NestedStack, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; // references between siblings diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js new file mode 100644 index 0000000000000..eb790a2f3aad1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const cdk = require("aws-cdk-lib"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-http-origin'); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaHR0cC1vcmlnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5odHRwLW9yaWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUF5RDtBQUN6RCxtQ0FBbUM7QUFDbkMsOERBQThEO0FBRTlELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsd0JBQXdCLENBQUMsQ0FBQztBQUUzRCxJQUFJLFVBQVUsQ0FBQyxZQUFZLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUNqRCxlQUFlLEVBQUUsRUFBRSxNQUFNLEVBQUUsSUFBSSxPQUFPLENBQUMsVUFBVSxDQUFDLGlCQUFpQixDQUFDLEVBQUU7Q0FDdkUsQ0FBQyxDQUFDO0FBRUgsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2xvdWRmcm9udCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY2xvdWRmcm9udCc7XG5pbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgb3JpZ2lucyBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY2xvdWRmcm9udC1vcmlnaW5zJztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2Nsb3VkZnJvbnQtaHR0cC1vcmlnaW4nKTtcblxubmV3IGNsb3VkZnJvbnQuRGlzdHJpYnV0aW9uKHN0YWNrLCAnRGlzdHJpYnV0aW9uJywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHsgb3JpZ2luOiBuZXcgb3JpZ2lucy5IdHRwT3JpZ2luKCd3d3cuZXhhbXBsZS5jb20nKSB9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/cloudfront-http-origin.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.ts new file mode 100644 index 0000000000000..9fce39f1f0495 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.http-origin.ts @@ -0,0 +1,13 @@ +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as cdk from 'aws-cdk-lib'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'cloudfront-http-origin'); + +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js new file mode 100644 index 0000000000000..ad37b06826392 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-load-balancer-origin'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.LoadBalancerV2Origin(loadbalancer) }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubG9hZC1iYWxhbmNlci1vcmlnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5sb2FkLWJhbGFuY2VyLW9yaWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUF5RDtBQUN6RCwyQ0FBMkM7QUFDM0MsZ0VBQWdFO0FBQ2hFLG1DQUFtQztBQUNuQyw4REFBOEQ7QUFFOUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxpQ0FBaUMsQ0FBQyxDQUFDO0FBRXBFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFDckQsTUFBTSxZQUFZLEdBQUcsSUFBSSxLQUFLLENBQUMsdUJBQXVCLENBQUMsS0FBSy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zdHJpYnV0aW9uKHN0YWNrLCAnRGlzdHJpYnV0aW9uJywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHsgb3JpZ2luOiBuZXcgb3JpZ2lucy5Mb2FkQmFsYW5jZXJWMk9yaWdpbihsb2FkYmFsYW5jZXIpIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/cloudfront-load-balancer-origin.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.ts new file mode 100644 index 0000000000000..c751e222f0345 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.load-balancer-origin.ts @@ -0,0 +1,17 @@ +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-load-balancer-origin'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); + +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.LoadBalancerV2Origin(loadbalancer) }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js new file mode 100644 index 0000000000000..7759c6f6821a3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-origin-group'); +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const originGroup = new origins.OriginGroup({ + primaryOrigin: new origins.S3Origin(bucket), + fallbackOrigin: new origins.HttpOrigin('www.example.com'), +}); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: originGroup }, + additionalBehaviors: { + '/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0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/cloudfront-origin-group.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.ts new file mode 100644 index 0000000000000..f9aedd3ab7384 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.origin-group.ts @@ -0,0 +1,27 @@ +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-origin-group'); + +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +const originGroup = new origins.OriginGroup({ + primaryOrigin: new origins.S3Origin(bucket), + fallbackOrigin: new origins.HttpOrigin('www.example.com'), +}); + +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: originGroup }, + additionalBehaviors: { + '/api': { + origin: originGroup, + }, + }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js new file mode 100644 index 0000000000000..ed1a34a885dee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin-custom-origin-path'); +const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); +api.root.addMethod('GET'); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.RestApiOrigin(api, { originPath: '/' }) }, +}); +new integ_tests_alpha_1.IntegTest(app, 'rest-api-origin-custom-origin-path', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdC1hcGktb3JpZ2luLWN1c3RvbS1vcmlnaW4tcGF0aC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVn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qIGFzIGNsb3VkZnJvbnQgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNsb3VkZnJvbnQnO1xuaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7IEludGVnVGVzdCB9IGZyb20gJ0Bhd3MtY2RrL2ludGVnLXRlc3RzLWFscGhhJztcbmltcG9ydCAqIGFzIG9yaWdpbnMgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNsb3VkZnJvbnQtb3JpZ2lucyc7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdpbnRlZy1jbG91ZGZyb250LXJlc3QtYXBpLW9yaWdpbi1jdXN0b20tb3JpZ2luLXBhdGgnKTtcblxuY29uc3QgYXBpID0gbmV3IGFwaWdhdGV3YXkuUmVzdEFwaShzdGFjaywgJ1Jlc3RBcGknLCB7IGVuZHBvaW50VHlwZXM6IFthcGlnYXRld2F5LkVuZHBvaW50VHlwZS5SRUdJT05BTF0sIGNsb3VkV2F0Y2hSb2xlOiB0cnVlIH0pO1xuYXBpLnJvb3QuYWRkTWV0aG9kKCdHRVQnKTtcblxubmV3IGNsb3VkZnJvbnQuRGlzdHJpYnV0aW9uKHN0YWNrLCAnRGlzdHJpYnV0aW9uJywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHsgb3JpZ2luOiBuZXcgb3JpZ2lucy5SZXN0QXBpT3JpZ2luKGFwaSwgeyBvcmlnaW5QYXRoOiAnLycgfSkgfSxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ3Jlc3QtYXBpLW9yaWdpbi1jdXN0b20tb3JpZ2luLXBhdGgnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts new file mode 100644 index 0000000000000..2c92e924d806c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts @@ -0,0 +1,20 @@ +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin-custom-origin-path'); + +const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); +api.root.addMethod('GET'); + +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.RestApiOrigin(api, { originPath: '/' }) }, +}); + +new IntegTest(app, 'rest-api-origin-custom-origin-path', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ-cloudfront-rest-api-origin-custom-origin-path.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/restapiorigincustomoriginpathDefaultTestDeployAssertCD227A2A.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js new file mode 100644 index 0000000000000..97b456d60e572 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin'); +const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); +api.root.addMethod('GET'); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.RestApiOrigin(api) }, +}); +new integ_tests_alpha_1.IntegTest(app, 'rest-api-origin', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzdC1hcGktb3JpZ2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucmVzdC1hcGktb3JpZ2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseURBQXlEO0FBQ3pELHlEQUF5RDtBQUN6RCxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELDhEQUE4RDtBQUU5RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGtDQUFrQyxDQUFDLENBQUM7QUFFckUsTUFBTSxHQUFHLEdBQUcsSUFBSSxVQUFVLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUUsRUFBRSxhQUFhLEVBQUUsQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLFFBQVEsQ0FBQyxFQUFFLGNBQWMsRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO0FBQ2xJLEdBQUcsQ0FBQyxJQUFJLENBQUMsU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vb3QuYWRkTWV0aG9kKCdHRVQnKTtcblxubmV3IGNsb3VkZnJvbnQuRGlzdHJpYnV0aW9uKHN0YWNrLCAnRGlzdHJpYnV0aW9uJywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHsgb3JpZ2luOiBuZXcgb3JpZ2lucy5SZXN0QXBpT3JpZ2luKGFwaSkgfSxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ3Jlc3QtYXBpLW9yaWdpbicsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ-cloudfront-rest-api-origin.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/restapioriginDefaultTestDeployAssert6BBA15BA.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.ts new file mode 100644 index 0000000000000..12323aa227cf7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.rest-api-origin.ts @@ -0,0 +1,20 @@ +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin'); + +const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); +api.root.addMethod('GET'); + +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.RestApiOrigin(api) }, +}); + +new IntegTest(app, 'rest-api-origin', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js new file mode 100644 index 0000000000000..bb5a4f540a550 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-s3-origin-oai'); +const bucket = new s3.Bucket(stack, 'Bucket'); +const originAccessIdentity = new cloudfront.OriginAccessIdentity(stack, 'OriginAccessIdentity', { + comment: 'Identity for bucket provided by test', +}); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.S3Origin(bucket, { originAccessIdentity }) }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuczMtb3JpZ2luLW9haS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnMzLW9yaWdpbi1vYWkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5REFBeUQ7QUFDekQseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyw4REFBOEQ7QUFFOUQsTUFBTS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W9haScpO1xuXG5jb25zdCBidWNrZXQgPSBuZXcgczMuQnVja2V0KHN0YWNrLCAnQnVja2V0Jyk7XG5jb25zdCBvcmlnaW5BY2Nlc3NJZGVudGl0eSA9IG5ldyBjbG91ZGZyb250Lk9yaWdpbkFjY2Vzc0lkZW50aXR5KHN0YWNrLCAnT3JpZ2luQWNjZXNzSWRlbnRpdHknLCB7XG4gIGNvbW1lbnQ6ICdJZGVudGl0eSBmb3IgYnVja2V0IHByb3ZpZGVkIGJ5IHRlc3QnLFxufSk7XG5uZXcgY2xvdWRmcm9udC5EaXN0cmlidXRpb24oc3RhY2ssICdEaXN0cmlidXRpb24nLCB7XG4gIGRlZmF1bHRCZWhhdmlvcjogeyBvcmlnaW46IG5ldyBvcmlnaW5zLlMzT3JpZ2luKGJ1Y2tldCwgeyBvcmlnaW5BY2Nlc3NJZGVudGl0eSB9KSB9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/cloudfront-s3-origin-oai.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.ts new file mode 100644 index 0000000000000..22addbac4b88c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin-oai.ts @@ -0,0 +1,18 @@ +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'cloudfront-s3-origin-oai'); + +const bucket = new s3.Bucket(stack, 'Bucket'); +const originAccessIdentity = new cloudfront.OriginAccessIdentity(stack, 'OriginAccessIdentity', { + comment: 'Identity for bucket provided by test', +}); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.S3Origin(bucket, { originAccessIdentity }) }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js new file mode 100644 index 0000000000000..7887478c78b05 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const origins = require("aws-cdk-lib/aws-cloudfront-origins"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-s3-origin'); +const bucket = new s3.Bucket(stack, 'Bucket'); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.S3Origin(bucket) }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuczMtb3JpZ2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuczMtb3JpZ2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseURBQXlEO0FBQ3pELHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsOERBQThEO0FBRTlELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztBQUV6RCxNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFFBQVEsQ0FBQyxDQUFDO0FBQzlDLElBQUksVUFBVSxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsY0FBYyxFQUFFO0lBQ2pELGVBQWUsRUFBRSxFQUFFLE1BQU0sRUFBRSxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsTUFBTSxDQUFDLEVBQUU7Q0FDMUQsQ0FBQyxDQUFDO0FBRUgsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2xvdWRmcm9udCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY2xvdWRmcm9udCc7XG5pbXBvcnQgKiBhcyBzMyBmcm9tICdhd3MtY2RrLWxpYi9hd3MtczMnO1xuaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCAqIGFzIG9yaWdpbnMgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNsb3VkZnJvbnQtb3JpZ2lucyc7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdjbG91ZGZyb250LXMzLW9yaWdpbicpO1xuXG5jb25zdCBidWNrZXQgPSBuZXcgczMuQnVja2V0KHN0YWNrLCAnQnVja2V0Jyk7XG5uZXcgY2xvdWRmcm9udC5EaXN0cmlidXRpb24oc3RhY2ssICdEaXN0cmlidXRpb24nLCB7XG4gIGRlZmF1bHRCZWhhdmlvcjogeyBvcmlnaW46IG5ldyBvcmlnaW5zLlMzT3JpZ2luKGJ1Y2tldCkgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/cloudfront-s3-origin.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.ts new file mode 100644 index 0000000000000..1cbfc500756f4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-origin.ts @@ -0,0 +1,15 @@ +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'cloudfront-s3-origin'); + +const bucket = new s3.Bucket(stack, 'Bucket'); +new cloudfront.Distribution(stack, 'Distribution', { + defaultBehavior: { origin: new origins.S3Origin(bucket) }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js new file mode 100644 index 0000000000000..ecf94fc525182 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); +const loggingBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { + originConfigs: [ + { + originHeaders: { + 'X-Custom-Header': 'somevalue', + }, + customOriginSource: { + domainName: 'brelandm.a2z.com', + }, + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], + loggingConfig: { + bucket: loggingBucket, + includeCookies: true, + prefix: 'test-prefix', + }, +}); +new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably2', { + originConfigs: [ + { + originHeaders: { + 'X-Custom-Header': 'somevalue', + }, + customOriginSource: { + domainName: 'brelandm.a2z.com', + }, + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], + loggingConfig: {}, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1idWNrZXQtbG9nZ2luZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsb3VkZnJvbnQtYnVja2V0LWxvZ2dpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDJCQUEyQixDQUFDLENBQUM7QUFFOUQsTUFBTSxhQUFhLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDbkQsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztDQUN6QyxDQUFDLENBQUM7QUFFSCxJQUFJLFVBQVUsQ0FBQyx5QkFBeUIsQ0FBQyxLQUFLLEVBQUUsMEJBQTBCLEVBQUU7SUFDMUUsYUFBYSxFQUFFO1F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aW5Tb3VyY2U6IHtcbiAgICAgICAgZG9tYWluTmFtZTogJ2JyZWxhbmRtLmEyei5jb20nLFxuICAgICAgfSxcbiAgICAgIGJlaGF2aW9yczogW1xuICAgICAgICB7XG4gICAgICAgICAgaXNEZWZhdWx0QmVoYXZpb3I6IHRydWUsXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH0sXG4gIF0sXG4gIGxvZ2dpbmdDb25maWc6IHt9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/aws-cdk-cloudfront-custom.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts similarity index 88% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts index 61cc9c1fff28d..b2b4b1006cb6f 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-bucket-logging.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js new file mode 100644 index 0000000000000..8d992a388a005 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const acm = require("aws-cdk-lib/aws-certificatemanager"); +const route53 = require("aws-cdk-lib/aws-route53"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const account = process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT; +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; +if (!hostedZoneId) + throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); +const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; +if (!hostedZoneName) + throw new Error('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME"'); +const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME; +if (!domainName) + throw new Error('For this test you must provide your own Domain Name as an env var "DOMAIN_NAME"'); +const app = new cdk.App({ + treeMetadata: false, +}); +const acmStack = new cdk.Stack(app, 'integ-acm-stack', { + env: { + region: 'us-east-1', + account, + }, + crossRegionReferences: true, +}); +const cloudFrontStack = new cdk.Stack(app, 'integ-cloudfront-stack', { + env: { + region: 'us-east-2', + account, + }, + crossRegionReferences: true, +}); +const hostedZone = route53.PublicHostedZone.fromHostedZoneAttributes(acmStack, 'HostedZone', { + hostedZoneId, + zoneName: hostedZoneName, +}); +const cert = new acm.Certificate(acmStack, 'Cert', { + domainName, + validation: acm.CertificateValidation.fromDns(hostedZone), +}); +new cloudfront.Distribution(cloudFrontStack, 'Distro', { + defaultBehavior: { origin: new test_origin_1.TestOrigin(domainName) }, + certificate: cert, + domainNames: [domainName], +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-cloudfront-cross-region-acm', { + testCases: [cloudFrontStack], + diffAssets: false, + enableLookups: true, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1jcm9zcy1yZWdpb24tY2VydC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsb3VkZnJvbnQtY3Jvc3MtcmVnaW9uLWNlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwREFBMEQ7QUFDMUQsbURBQW1EO0FBQ25ELG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsK0NBQTJ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hdGlvbjogYWNtLkNlcnRpZmljYXRlVmFsaWRhdGlvbi5mcm9tRG5zKGhvc3RlZFpvbmUpLFxufSk7XG5cbm5ldyBjbG91ZGZyb250LkRpc3RyaWJ1dGlvbihjbG91ZEZyb250U3RhY2ssICdEaXN0cm8nLCB7XG4gIGRlZmF1bHRCZWhhdmlvcjogeyBvcmlnaW46IG5ldyBUZXN0T3JpZ2luKGRvbWFpbk5hbWUpIH0sXG4gIGNlcnRpZmljYXRlOiBjZXJ0LFxuICBkb21haW5OYW1lczogW2RvbWFpbk5hbWVdLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnaW50ZWctY2xvdWRmcm9udC1jcm9zcy1yZWdpb24tYWNtJywge1xuICB0ZXN0Q2FzZXM6IFtjbG91ZEZyb250U3RhY2tdLFxuICBkaWZmQXNzZXRzOiBmYWxzZSxcbiAgZW5hYmxlTG9va3VwczogdHJ1ZSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.4607a5d8b4a4167cb2ff3c986ec884e3eb44c22626b7bce07ac9807730147741/index.js diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-acm-stack.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ-cloudfront-stack.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/integcloudfrontcrossregionacmDefaultTestDeployAssertD48673AA.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.ts similarity index 86% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.ts index c920a98cba638..0dedd1322c8a0 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-cross-region-cert.ts @@ -1,9 +1,9 @@ -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const account = process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT; const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js new file mode 100644 index 0000000000000..a4ff98641bbb3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const bucket = new s3.Bucket(this, 'Bucket', { + publicReadAccess: true, + websiteIndexDocument: 'index.html', + websiteErrorDocument: '404.html', + }); + new cloudfront.CloudFrontWebDistribution(this, 'Distribution', { + viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, + priceClass: cloudfront.PriceClass.PRICE_CLASS_200, + originConfigs: [ + { + behaviors: [{ isDefaultBehavior: true }], + customOriginSource: { + originProtocolPolicy: cloudfront.OriginProtocolPolicy.HTTP_ONLY, + domainName: bucket.bucketWebsiteDomainName, + }, + }, + ], + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cloudfront-custom-s3-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1jdXN0b20tczMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZGZyb250LWN1c3RvbS1zMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUF5QztBQUN6Qyw2Q0FBeUM7QUFFekMseURBQXlEO0FBRXpELE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVO1FBQ3RDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUU7WUFDM0MsZ0JBQWdCLEVBQUUsSUFBSTtZQUN0QixvQkFBb0IsRUFBRSxZQUFZO1lBQ2xDLG9CQUFvQixFQUFFLFVBQVU7U0FDakMsQ0FBQyxDQUFDO1FBRUgsSUFBSSxVQUFVLENBQUMseUJBQXlCLENBQUMsSUFBSSxFQUFFLGNBQWMsRUFBRTtZQUM3RCxvQkFBb0IsRUFBRSxVQUFVLENBQUMsb0JBQW9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ICAgd2Vic2l0ZUluZGV4RG9jdW1lbnQ6ICdpbmRleC5odG1sJyxcbiAgICAgIHdlYnNpdGVFcnJvckRvY3VtZW50OiAnNDA0Lmh0bWwnLFxuICAgIH0pO1xuXG4gICAgbmV3IGNsb3VkZnJvbnQuQ2xvdWRGcm9udFdlYkRpc3RyaWJ1dGlvbih0aGlzLCAnRGlzdHJpYnV0aW9uJywge1xuICAgICAgdmlld2VyUHJvdG9jb2xQb2xpY3k6IGNsb3VkZnJvbnQuVmlld2VyUHJvdG9jb2xQb2xpY3kuUkVESVJFQ1RfVE9fSFRUUFMsXG4gICAgICBwcmljZUNsYXNzOiBjbG91ZGZyb250LlByaWNlQ2xhc3MuUFJJQ0VfQ0xBU1NfMjAwLFxuICAgICAgb3JpZ2luQ29uZmlnczogW1xuICAgICAgICB7XG4gICAgICAgICAgYmVoYXZpb3JzOiBbeyBpc0RlZmF1bHRCZWhhdmlvcjogdHJ1ZSB9XSxcbiAgICAgICAgICBjdXN0b21PcmlnaW5Tb3VyY2U6IHtcbiAgICAgICAgICAgIG9yaWdpblByb3RvY29sUG9saWN5OiBjbG91ZGZyb250Lk9yaWdpblByb3RvY29sUG9saWN5LkhUVFBfT05MWSxcbiAgICAgICAgICAgIGRvbWFpbk5hbWU6IGJ1Y2tldC5idWNrZXRXZWJzaXRlRG9tYWluTmFtZSxcbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICB9LFxuICAgICk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjbG91ZGZyb250LWN1c3RvbS1zMy1pbnRlZycpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/cloudfront-custom-s3-integ.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.ts similarity index 86% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.ts index c3fd14a25c45b..d0481ff353d5b 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom-s3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom-s3.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js new file mode 100644 index 0000000000000..33f46e1e64480 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); +new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { + originConfigs: [ + { + originHeaders: { + 'X-Custom-Header': 'somevalue', + }, + customOriginSource: { + domainName: 'brelandm.a2z.com', + }, + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1jdXN0b20uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZGZyb250LWN1c3RvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLG1DQUFtQztBQUNuQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSwyQkFBMkIsQ0FBQyxDQUFDO0FBRTlELElBQUksVUFBVSxDQUFDLHlCQUF5QixDQUFDLEtBQUssRUFBRSwwQkFBMEIsRUFBRTtJ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O1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/aws-cdk-cloudfront-custom.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.ts similarity index 83% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.ts index 39f4fb4cf810c..686c52f81632f 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-custom.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-custom.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js new file mode 100644 index 0000000000000..2283571e9f726 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); +new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { + originConfigs: [ + { + originHeaders: { + 'X-Custom-Header': 'somevalue', + }, + customOriginSource: { + domainName: 'brelandm.a2z.com', + }, + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], + defaultRootObject: '', +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1lbXB0eS1yb290LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2xvdWRmcm9udC1lbXB0eS1yb290LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDJCQUEyQixDQUFDLENBQUM7QUFFOUQsSUFBSSxVQUFVLENBQUMseUJB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YXZpb3I6IHRydWUsXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH0sXG4gIF0sXG4gIGRlZmF1bHRSb290T2JqZWN0OiAnJyxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/aws-cdk-cloudfront-custom.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.ts similarity index 83% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.ts index bb14fd30b7616..5cc3f2ddefa38 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-empty-root.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-empty-root.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js new file mode 100644 index 0000000000000..1cbcf65554fd7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudfront-failover'); +const dist = new cloudfront.CloudFrontWebDistribution(stack, 'Distribution', { + originConfigs: [{ + behaviors: [{ isDefaultBehavior: true }], + s3OriginSource: { + s3BucketSource: new s3.Bucket(stack, 'bucket1'), + }, + failoverS3OriginSource: { + s3BucketSource: new s3.Bucket(stack, 'bucket2'), + }, + failoverCriteriaStatusCodes: [cloudfront.FailoverStatusCode.INTERNAL_SERVER_ERROR], + }], +}); +new cdk.CfnOutput(stack, 'DistributionDomainName', { value: dist.domainName }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1mYWlsb3Zlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsb3VkZnJvbnQtZmFpbG92ZXIudHMiXSwibmFtZXMiOlt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9udCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY2xvdWRmcm9udCc7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBjZGsuU3RhY2soYXBwLCAnaW50ZWctY2xvdWRmcm9udC1mYWlsb3ZlcicpO1xuXG5jb25zdCBkaXN0ID0gbmV3IGNsb3VkZnJvbnQuQ2xvdWRGcm9udFdlYkRpc3RyaWJ1dGlvbihzdGFjaywgJ0Rpc3RyaWJ1dGlvbicsIHtcbiAgb3JpZ2luQ29uZmlnczogW3tcbiAgICBiZWhhdmlvcnM6IFt7IGlzRGVmYXVsdEJlaGF2aW9yOiB0cnVlIH1dLFxuICAgIHMzT3JpZ2luU291cmNlOiB7XG4gICAgICBzM0J1Y2tldFNvdXJjZTogbmV3IHMzLkJ1Y2tldChzdGFjaywgJ2J1Y2tldDEnKSxcbiAgICB9LFxuICAgIGZhaWxvdmVyUzNPcmlnaW5Tb3VyY2U6IHtcbiAgICAgIHMzQnVja2V0U291cmNlOiBuZXcgczMuQnVja2V0KHN0YWNrLCAnYnVja2V0MicpLFxuICAgIH0sXG4gICAgZmFpbG92ZXJDcml0ZXJpYVN0YXR1c0NvZGVzOiBbY2xvdWRmcm9udC5GYWlsb3ZlclN0YXR1c0NvZGUuSU5URVJOQUxfU0VSVkVSX0VSUk9SXSxcbiAgfV0sXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdEaXN0cmlidXRpb25Eb21haW5OYW1lJywgeyB2YWx1ZTogZGlzdC5kb21haW5OYW1lIH0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ-cloudfront-failover.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.ts similarity index 81% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.ts index 1a04ca09b3277..2332982304638 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-failover.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-failover.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-cloudfront-failover'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js new file mode 100644 index 0000000000000..e4c632b38a75a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'cloudfront-geo-restrictions'); +const sourceBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [{ isDefaultBehavior: true }], + }, + ], + geoRestriction: cloudfront.GeoRestriction.allowlist('US', 'GB'), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1nZW8tcmVzdHJpY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2xvdWRmcm9udC1nZW8tcmVzdHJpY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDO0FBRWhFLE1BQU0sWUFBWSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ2xELG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tcbiAgICAgIHMzT3JpZ2luU291cmNlOiB7XG4gICAgICAgIHMzQnVja2V0U291cmNlOiBzb3VyY2VCdWNrZXQsXG4gICAgICB9LFxuICAgICAgYmVoYXZpb3JzOiBbeyBpc0RlZmF1bHRCZWhhdmlvcjogdHJ1ZSB9XSxcbiAgICB9LFxuICBdLFxuICBnZW9SZXN0cmljdGlvbjogY2xvdWRmcm9udC5HZW9SZXN0cmljdGlvbi5hbGxvd2xpc3QoJ1VTJywgJ0dCJyksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/cloudfront-geo-restrictions.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts similarity index 78% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts index b89fee939cb4c..d5572e256fcc5 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-geo-restrictions.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js new file mode 100644 index 0000000000000..0669be843befb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); +const sourceBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [{ isDefaultBehavior: true }], + }, + ], + enableIpV6: false, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1pcHY2LWRpc2FibGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2xvdWRmcm9udC1pcHY2LWRpc2FibGVkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxvQkFBb0IsQ0FBQyxDQUFDO0FBRXZELE1BQU0sWUFBWSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ2xELGFBQWEsRUFBRSxHQUFHLENBQUMsYUFBYSxDQUFDLE9BQU87Q0FDekMsQ0FBQyxDQUFDO0FBRUgsSUFBSSxVQUFVLENBQUMseUJBQXlCLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFO0lBQ2hFLGFBQWEsRUFBRTtRQUNiO1lBQ0UsY0FBYyxFQUFFO2dCQUNkLGNBQWMsRUFBRSxZQUFZO2FBQzdCO1lBQ0QsU0FBUyxFQUFFLENBQUMsRUFBRSxpQkFBaUIsRUFBRSxJQUFJLEVBQUUsQ0FBQztTQUN6QztLQUNGO0lBQ0QsVUFBVSxFQUFFLEtBQUs7Q0FDbEIsQ0FBQyxDQUFDO0FBRUgsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG5pbXBvcnQgKiBhcyBzMyBmcm9tICdhd3MtY2RrLWxpYi9hd3MtczMnO1xuaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCAqIGFzIGNsb3VkZnJvbnQgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNsb3VkZnJvbnQnO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5jb25zdCBzdGFjayA9IG5ldyBjZGsuU3RhY2soYXBwLCAnYXdzLWNkay1jbG91ZGZyb250Jyk7XG5cbmNvbnN0IHNvdXJjZUJ1Y2tldCA9IG5ldyBzMy5CdWNrZXQoc3RhY2ssICdCdWNrZXQnLCB7XG4gIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG59KTtcblxubmV3IGNsb3VkZnJvbnQuQ2xvdWRGcm9udFdlYkRpc3RyaWJ1dGlvbihzdGFjaywgJ015RGlzdHJpYnV0aW9uJywge1xuICBvcmlnaW5Db25maWdzOiBbXG4gICAge1xuICAgICAgczNPcmlnaW5Tb3VyY2U6IHtcbiAgICAgICAgczNCdWNrZXRTb3VyY2U6IHNvdXJjZUJ1Y2tldCxcbiAgICAgIH0sXG4gICAgICBiZWhhdmlvcnM6IFt7IGlzRGVmYXVsdEJlaGF2aW9yOiB0cnVlIH1dLFxuICAgIH0sXG4gIF0sXG4gIGVuYWJsZUlwVjY6IGZhbHNlLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/aws-cdk-cloudfront.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts similarity index 76% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts index cd7cf5c16141a..23cb1204bc493 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-ipv6-disabled.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js new file mode 100644 index 0000000000000..e2ab7af92f0f6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); +new cloudfront.KeyGroup(stack, 'AwesomeKeyGroup', { + items: [ + new cloudfront.PublicKey(stack, 'AwesomePublicKey', { + encodedKey: `-----BEGIN PUBLIC KEY----- + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAudf8/iNkQgdvjEdm6xYS + JAyxd/kGTbJfQNg9YhInb7TSm0dGu0yx8yZ3fnpmxuRPqJIlaVr+fT4YRl71gEYa + dlhHmnVegyPNjP9dNqZ7zwNqMEPOPnS/NOHbJj1KYKpn1f8pPNycQ5MQCntKGnSj + 6fc+nbcC0joDvGz80xuy1W4hLV9oC9c3GT26xfZb2jy9MVtA3cppNuTwqrFi3t6e + 0iGpraxZlT5wewjZLpQkngqYr6s3aucPAZVsGTEYPo4nD5mswmtZOm+tgcOrivtD + /3sD/qZLQ6c5siqyS8aTraD6y+VXugujfarTU65IeZ6QAUbLMsWuZOIi5Jn8zAwx + NQIDAQAB + -----END PUBLIC KEY----- + `, + }), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1rZXktZ3JvdXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZGZyb250LWtleS1ncm91cC50cyJdLCJu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U9DQVE4QU1JSUJDZ0tDQVFFQXVkZjgvaU5rUWdkdmpFZG02eFlTXG4gICAgICBKQXl4ZC9rR1RiSmZRTmc5WWhJbmI3VFNtMGRHdTB5eDh5WjNmbnBteHVSUHFKSWxhVnIrZlQ0WVJsNzFnRVlhXG4gICAgICBkbGhIbW5WZWd5UE5qUDlkTnFaN3p3TnFNRVBPUG5TL05PSGJKajFLWUtwbjFmOHBQTnljUTVNUUNudEtHblNqXG4gICAgICA2ZmMrbmJjQzBqb0R2R3o4MHh1eTFXNGhMVjlvQzljM0dUMjZ4ZlpiMmp5OU1WdEEzY3BwTnVUd3FyRmkzdDZlXG4gICAgICAwaUdwcmF4WmxUNXdld2paTHBRa25ncVlyNnMzYXVjUEFaVnNHVEVZUG80bkQ1bXN3bXRaT20rdGdjT3JpdnREXG4gICAgICAvM3NEL3FaTFE2YzVzaXF5UzhhVHJhRDZ5K1ZYdWd1amZhclRVNjVJZVo2UUFVYkxNc1d1Wk9JaTVKbjh6QXd4XG4gICAgICBOUUlEQVFBQlxuICAgICAgLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXG4gICAgICBgLFxuICAgIH0pLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/aws-cdk-cloudfront-custom.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.ts similarity index 89% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.ts index 7bfdbbe645446..9527149e72d5f 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-key-group.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-key-group.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js new file mode 100644 index 0000000000000..134ab5bb5239b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); +const sourceBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const lambdaFunction = new lambda.Function(stack, 'Lambda', { + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const lambdaVersion = new lambda.Version(stack, 'LambdaVersion', { + lambda: lambdaFunction, +}); +new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [{ + isDefaultBehavior: true, + lambdaFunctionAssociations: [{ + eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST, + lambdaFunction: lambdaVersion, + }], + }], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1sYW1iZGEtYXNzb2NpYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZGZyb250LWxhbWJkYS1hc3NvY2lhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRDtBQUNqRCx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG9CQUFvQixDQUFDLENBQUM7QUFFdkQsTUFBTSxZQUFZLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDbEQsYUFBY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1ZSxcbiAgICAgICAgbGFtYmRhRnVuY3Rpb25Bc3NvY2lhdGlvbnM6IFt7XG4gICAgICAgICAgZXZlbnRUeXBlOiBjbG91ZGZyb250LkxhbWJkYUVkZ2VFdmVudFR5cGUuT1JJR0lOX1JFUVVFU1QsXG4gICAgICAgICAgbGFtYmRhRnVuY3Rpb246IGxhbWJkYVZlcnNpb24sXG4gICAgICAgIH1dLFxuICAgICAgfV0sXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/aws-cdk-cloudfront.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.ts similarity index 82% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.ts index 6427b28195c51..7ca443d759df4 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-lambda-association.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-lambda-association.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js new file mode 100644 index 0000000000000..f6efed45c85cf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudfront-s3'); +const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.DESTROY }); +const oai = new cloudfront.CfnCloudFrontOriginAccessIdentity(stack, 'OAI', { + cloudFrontOriginAccessIdentityConfig: { + comment: 'Allows CloudFront to reach the bucket!', + }, +}); +const oaiImported = cloudfront.OriginAccessIdentity.fromOriginAccessIdentityId(stack, 'OAIImported', oai.ref); +const dist = new cloudfront.CloudFrontWebDistribution(stack, 'Distribution', { + originConfigs: [{ + behaviors: [{ isDefaultBehavior: true }], + s3OriginSource: { + s3BucketSource: bucket, + originAccessIdentity: oaiImported, + }, + }], +}); +new cdk.CfnOutput(stack, 'DistributionDomainName', { value: dist.domainName }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1zMy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsb3VkZnJvbnQtczMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHFCQUFxQixDQUFDLENBQUM7QUFFeEQsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUUsRUFBRSxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFDO0FBQzVGLE1BQU0sR0FBRyxHQUFHLElBQUksVUFBVSxDQUFDLGlDQUFpQyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUU7SUFDekUsb0NBQW9DLEVBQUU7UUFDcEMsT0FBTyxFQUFFLHdDQUF3QztLQUNsRDtDQUNGLENBQUMsQ0FBQztBQUVILE1BQU0sV0FBVyxHQUFHLFVBQVUsQ0FBQyxvQkFBb0IsQ0FBQywwQkFBMEIsQ0FDNUUsS0FBSyxFQUNMLGFBQWEsRUFDYixHQUFHLENBQUMsR0F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HlDb25maWc6IHtcbiAgICBjb21tZW50OiAnQWxsb3dzIENsb3VkRnJvbnQgdG8gcmVhY2ggdGhlIGJ1Y2tldCEnLFxuICB9LFxufSk7XG5cbmNvbnN0IG9haUltcG9ydGVkID0gY2xvdWRmcm9udC5PcmlnaW5BY2Nlc3NJZGVudGl0eS5mcm9tT3JpZ2luQWNjZXNzSWRlbnRpdHlJZChcbiAgc3RhY2ssXG4gICdPQUlJbXBvcnRlZCcsXG4gIG9haS5yZWYsXG4pO1xuXG5jb25zdCBkaXN0ID0gbmV3IGNsb3VkZnJvbnQuQ2xvdWRGcm9udFdlYkRpc3RyaWJ1dGlvbihzdGFjaywgJ0Rpc3RyaWJ1dGlvbicsIHtcbiAgb3JpZ2luQ29uZmlnczogW3tcbiAgICBiZWhhdmlvcnM6IFt7IGlzRGVmYXVsdEJlaGF2aW9yOiB0cnVlIH1dLFxuICAgIHMzT3JpZ2luU291cmNlOiB7XG4gICAgICBzM0J1Y2tldFNvdXJjZTogYnVja2V0LFxuICAgICAgb3JpZ2luQWNjZXNzSWRlbnRpdHk6IG9haUltcG9ydGVkLFxuICAgIH0sXG4gIH1dLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnRGlzdHJpYnV0aW9uRG9tYWluTmFtZScsIHsgdmFsdWU6IGRpc3QuZG9tYWluTmFtZSB9KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ-cloudfront-s3.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.ts similarity index 85% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.ts index b4f482ff2e90b..3d4b090770c22 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-s3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-s3.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-cloudfront-s3'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js new file mode 100644 index 0000000000000..123fe574e69f9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront-custom'); +new cloudfront.CloudFrontWebDistribution(stack, 'AnAmazingWebsiteProbably', { + originConfigs: [ + { + originHeaders: { + 'X-Custom-Header': 'somevalue', + }, + customOriginSource: { + domainName: 'brelandm.a2z.com', + }, + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], + aliasConfiguration: { + acmCertRef: 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', + names: ['test.test.com'], + sslMethod: cloudfront.SSLMethod.SNI, + securityPolicy: cloudfront.SecurityPolicyProtocol.TLS_V1, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1zZWN1cml0eS1wb2xpY3kuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZGZyb250LXNlY3VyaXR5LXBvbGljeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSwyQkFBMkIsQ0FBQyxDQUFDO0FBRTlELElBQUksVUFBVSxDQUFDLHlCQUF5QixDQUFDLEtBQUssRUFBRSwwQkFBMEIsRUFBRTtJQUMxRSxhQUFhLEVBQUU7UUFDYjtZQUNFLGFBQWEsRUFBRTtnQkFDYixpQkFBaUIsRUFBRSxXQUFXO2FBQy9CO1lBQ0Qsa0JBQWtCLEVBQUU7Z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HtcbiAgICAgICAgICBpc0RlZmF1bHRCZWhhdmlvcjogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfSxcbiAgXSxcbiAgYWxpYXNDb25maWd1cmF0aW9uOiB7XG4gICAgYWNtQ2VydFJlZjogJ2Fybjphd3M6YWNtOnVzLWVhc3QtMToxMTExMTExOmNlcnRpZmljYXRlLzExLTMzMzZmMS00NDQ4M2QtYWRjNy05Y2QzNzVjNTE2OWQnLFxuICAgIG5hbWVzOiBbJ3Rlc3QudGVzdC5jb20nXSxcbiAgICBzc2xNZXRob2Q6IGNsb3VkZnJvbnQuU1NMTWV0aG9kLlNOSSxcbiAgICBzZWN1cml0eVBvbGljeTogY2xvdWRmcm9udC5TZWN1cml0eVBvbGljeVByb3RvY29sLlRMU19WMSxcbiAgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/aws-cdk-cloudfront-custom.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.ts similarity index 88% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.ts index 4a8d60efd5219..a4b6c6b47ce6b 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-security-policy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront-security-policy.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js new file mode 100644 index 0000000000000..f2e87fd68d79b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); +const sourceBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [{ isDefaultBehavior: true }], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsb3VkZnJvbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG9CQUFvQixDQUFDLENBQUM7QUFFdkQsTUFBTSxZQUFZLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDbEQsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztDQUN6QyxDQUFDLENBQUM7QUFFSCxJQUFJLFVBQVUsQ0FBQyx5QkFBeUIsQ0FBQyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUU7SUFDaEUsYUFBYSxFQUFFO1FBQ2I7WUFDRSxjQUFjLEVBQUU7Z0JBQ2QsY0FBYyxFQUFFLFlBQVk7YUFDN0I7WUFDRCxTQUFTLEVBQUUsQ0FBQyxFQUFFLGlCQUFpQixFQUFFLElBQUksRUFBRSxDQUFDO1NBQ3pDO0tBQ0Y7Q0FDRixDQUFDLENBQUM7QUFFSCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJcbmltcG9ydCAqIGFzIHMzIGZyb20gJ2F3cy1jZGstbGliL2F3cy1zMyc7XG5pbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgY2xvdWRmcm9udCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY2xvdWRmcm9udCc7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtY2RrLWNsb3VkZnJvbnQnKTtcblxuY29uc3Qgc291cmNlQnVja2V0ID0gbmV3IHMzLkJ1Y2tldChzdGFjaywgJ0J1Y2tldCcsIHtcbiAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5uZXcgY2xvdWRmcm9udC5DbG91ZEZyb250V2ViRGlzdHJpYnV0aW9uKHN0YWNrLCAnTXlEaXN0cmlidXRpb24nLCB7XG4gIG9yaWdpbkNvbmZpZ3M6IFtcbiAgICB7XG4gICAgICBzM09yaWdpblNvdXJjZToge1xuICAgICAgICBzM0J1Y2tldFNvdXJjZTogc291cmNlQnVja2V0LFxuICAgICAgfSxcbiAgICAgIGJlaGF2aW9yczogW3sgaXNEZWZhdWx0QmVoYXZpb3I6IHRydWUgfV0sXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/aws-cdk-cloudfront.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.ts similarity index 76% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.ts index d1f338dcbaf3d..964032b025e11 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.cloudfront.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cloudfront from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js new file mode 100644 index 0000000000000..037b50f24c302 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-basic'); +const distribution = new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { origin: new test_origin_1.TestOrigin('www.example.com') }, +}); +const role1 = new iam.Role(stack, 'Role1', { + assumedBy: new iam.AccountRootPrincipal(), +}); +const role2 = new iam.Role(stack, 'Role2', { + assumedBy: new iam.AccountRootPrincipal(), +}); +distribution.grantCreateInvalidation(role1); +distribution.grant(role2, 'cloudfront:ListInvalidations'); +new integ_tests_alpha_1.IntegTest(stack, 'distribution-basic-test', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLWJhc2ljLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZGlzdHJpYnV0aW9uLWJhc2ljLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsK0NBQTJDO0FBQzNDLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDBCQUEwQixDQUFDLENBQUM7QUFFN0QsTUFBTSxZQUFZLEdBQUcsSUFBSSxVQUFVLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUU7SUFDOUQsZUFBZSxFQUFFLEVBQUUsTUFBTSxFQUFFLElBQUksd0JBQVUsQ0FBQyxpQkFBaUIsQ0FBQyxFQUFFO0NBQy9ELENBQUMsQ0FBQztBQUVILE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFO0lBQ3pDLFNBQVMsRUFBRSx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Zpb3I6IHsgb3JpZ2luOiBuZXcgVGVzdE9yaWdpbignd3d3LmV4YW1wbGUuY29tJykgfSxcbn0pO1xuXG5jb25zdCByb2xlMSA9IG5ldyBpYW0uUm9sZShzdGFjaywgJ1JvbGUxJywge1xuICBhc3N1bWVkQnk6IG5ldyBpYW0uQWNjb3VudFJvb3RQcmluY2lwYWwoKSxcbn0pO1xuY29uc3Qgcm9sZTIgPSBuZXcgaWFtLlJvbGUoc3RhY2ssICdSb2xlMicsIHtcbiAgYXNzdW1lZEJ5OiBuZXcgaWFtLkFjY291bnRSb290UHJpbmNpcGFsKCksXG59KTtcbmRpc3RyaWJ1dGlvbi5ncmFudENyZWF0ZUludmFsaWRhdGlvbihyb2xlMSk7XG5kaXN0cmlidXRpb24uZ3JhbnQocm9sZTIsICdjbG91ZGZyb250Okxpc3RJbnZhbGlkYXRpb25zJyk7XG5cbm5ldyBJbnRlZ1Rlc3Qoc3RhY2ssICdkaXN0cmlidXRpb24tYmFzaWMtdGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-cross-region-cert.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ-distribution-basic.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/integdistributionbasicdistributionbasictestDefaultTestDeployAssert2D53EBF0.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.ts similarity index 76% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.ts index 86587ec676acd..c650257c38630 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-basic.ts @@ -1,8 +1,8 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-basic'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js new file mode 100644 index 0000000000000..e0896ddcc31bf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-extensive'); +new cloudfront.Distribution(stack, 'MyDist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com', { + originShieldRegion: 'us-west-2', + }), + }, + comment: 'a test', + defaultRootObject: 'index.html', + enabled: true, + enableIpv6: true, + enableLogging: true, + geoRestriction: cloudfront.GeoRestriction.whitelist('US', 'GB'), + httpVersion: cloudfront.HttpVersion.HTTP2, + logFilePrefix: 'logs/', + logIncludesCookies: true, + priceClass: cloudfront.PriceClass.PRICE_CLASS_100, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcu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@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ-distribution-extensive.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.ts similarity index 87% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.ts index 31f058d4dba35..89525f3ecc042 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-extensive.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-extensive.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-extensive'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js new file mode 100644 index 0000000000000..1ea498c05cb99 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-function', { env: { region: 'eu-west-1' } }); +const cfFunction = new cloudfront.Function(stack, 'Function', { + code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'), +}); +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com'), + cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED, + functionAssociations: [{ + function: cfFunction, + eventType: cloudfront.FunctionEventType.VIEWER_REQUEST, + }], + }, +}); +new cdk.CfnOutput(stack, 'FunctionArn', { value: cfFunction.functionArn }); +new cdk.CfnOutput(stack, 'FunctionStage', { value: cfFunction.functionStage }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLWZ1bmN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZGlzdHJpYnV0aW9uLWZ1bmN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLCtDQUEyQztBQUMzQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENB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kFybiB9KTtcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnRnVuY3Rpb25TdGFnZScsIHsgdmFsdWU6IGNmRnVuY3Rpb24uZnVuY3Rpb25TdGFnZSB9KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ-distribution-function.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts similarity index 89% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts index 79db3b069679a..cf56ff5e90be8 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-function.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-function.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-function', { env: { region: 'eu-west-1' } }); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js new file mode 100644 index 0000000000000..d8cd8daf2c39a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-http-version'); +new cloudfront.Distribution(stack, 'Http11', { + defaultBehavior: { origin: new test_origin_1.TestOrigin('www.example.com') }, + httpVersion: cloudfront.HttpVersion.HTTP1_1, +}); +new cloudfront.Distribution(stack, 'Http2', { + defaultBehavior: { origin: new test_origin_1.TestOrigin('www.example.com') }, + httpVersion: cloudfront.HttpVersion.HTTP2, +}); +new cloudfront.Distribution(stack, 'Http2and3', { + defaultBehavior: { origin: new test_origin_1.TestOrigin('www.example.com') }, + httpVersion: cloudfront.HttpVersion.HTTP2_AND_3, +}); +new cloudfront.Distribution(stack, 'Http3', { + defaultBehavior: { origin: new test_origin_1.TestOrigin('www.example.com') }, + httpVersion: cloudfront.HttpVersion.HTTP3, +}); +new integ_tests_alpha_1.IntegTest(app, 'DistributionHttpVersion', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLWh0dHAtdmVyc2lvbi5qcyIsInNvdXJjZVJvb3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dHAyJywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHsgb3JpZ2luOiBuZXcgVGVzdE9yaWdpbignd3d3LmV4YW1wbGUuY29tJykgfSxcbiAgaHR0cFZlcnNpb246IGNsb3VkZnJvbnQuSHR0cFZlcnNpb24uSFRUUDIsXG59KTtcbm5ldyBjbG91ZGZyb250LkRpc3RyaWJ1dGlvbihzdGFjaywgJ0h0dHAyYW5kMycsIHtcbiAgZGVmYXVsdEJlaGF2aW9yOiB7IG9yaWdpbjogbmV3IFRlc3RPcmlnaW4oJ3d3dy5leGFtcGxlLmNvbScpIH0sXG4gIGh0dHBWZXJzaW9uOiBjbG91ZGZyb250Lkh0dHBWZXJzaW9uLkhUVFAyX0FORF8zLFxufSk7XG5uZXcgY2xvdWRmcm9udC5EaXN0cmlidXRpb24oc3RhY2ssICdIdHRwMycsIHtcbiAgZGVmYXVsdEJlaGF2aW9yOiB7IG9yaWdpbjogbmV3IFRlc3RPcmlnaW4oJ3d3dy5leGFtcGxlLmNvbScpIH0sXG4gIGh0dHBWZXJzaW9uOiBjbG91ZGZyb250Lkh0dHBWZXJzaW9uLkhUVFAzLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnRGlzdHJpYnV0aW9uSHR0cFZlcnNpb24nLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/DistributionHttpVersionDefaultTestDeployAssert506965CB.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ-distribution-http-version.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.ts similarity index 85% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.ts index 15a7156c604f0..c8dc8d003f1de 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-http-version.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-http-version.ts @@ -1,7 +1,7 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-http-version'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js new file mode 100644 index 0000000000000..720524c51f0b1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-key-group'); +const publicKey = `-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAudf8/iNkQgdvjEdm6xYS +JAyxd/kGTbJfQNg9YhInb7TSm0dGu0yx8yZ3fnpmxuRPqJIlaVr+fT4YRl71gEYa +dlhHmnVegyPNjP9dNqZ7zwNqMEPOPnS/NOHbJj1KYKpn1f8pPNycQ5MQCntKGnSj +6fc+nbcC0joDvGz80xuy1W4hLV9oC9c3GT26xfZb2jy9MVtA3cppNuTwqrFi3t6e +0iGpraxZlT5wewjZLpQkngqYr6s3aucPAZVsGTEYPo4nD5mswmtZOm+tgcOrivtD +/3sD/qZLQ6c5siqyS8aTraD6y+VXugujfarTU65IeZ6QAUbLMsWuZOIi5Jn8zAwx +NQIDAQAB +-----END PUBLIC KEY-----`; +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com'), + trustedKeyGroups: [ + new cloudfront.KeyGroup(stack, 'MyKeyGroup', { + items: [ + new cloudfront.PublicKey(stack, 'MyPublicKey', { + encodedKey: publicKey, + }), + ], + }), + ], + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLWtleS1ncm91cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRpc3RyaWJ1dGlvbi1rZXktZ3JvdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsK0NBQTJDO0FBQzNDLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDhCQUE4QixDQUFDLENBQUM7QUFDakUsTUFBTSxTQUFTLEdBQUc7Ozs7Ozs7O3lCQVFPLENBQUM7QUFFMUIsSUFBSSxVQUFVLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUU7SUFDekMsZUFBZSxFQUFFO1FBQ2YsTUFBTSxFQUFFLElBQUksd0JBQVUsQ0FBQyxpQkFBaUIsQ0FBQztRQUN6QyxnQkFBZ0IsRUFBRTtZQUNoQixJQUFJLFVBQVUsQ0FBQyxR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kxwUWtuZ3FZcjZzM2F1Y1BBWlZzR1RFWVBvNG5ENW1zd210Wk9tK3RnY09yaXZ0RFxuLzNzRC9xWkxRNmM1c2lxeVM4YVRyYUQ2eStWWHVndWpmYXJUVTY1SWVaNlFBVWJMTXNXdVpPSWk1Sm44ekF3eFxuTlFJREFRQUJcbi0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLWA7XG5cbm5ldyBjbG91ZGZyb250LkRpc3RyaWJ1dGlvbihzdGFjaywgJ0Rpc3QnLCB7XG4gIGRlZmF1bHRCZWhhdmlvcjoge1xuICAgIG9yaWdpbjogbmV3IFRlc3RPcmlnaW4oJ3d3dy5leGFtcGxlLmNvbScpLFxuICAgIHRydXN0ZWRLZXlHcm91cHM6IFtcbiAgICAgIG5ldyBjbG91ZGZyb250LktleUdyb3VwKHN0YWNrLCAnTXlLZXlHcm91cCcsIHtcbiAgICAgICAgaXRlbXM6IFtcbiAgICAgICAgICBuZXcgY2xvdWRmcm9udC5QdWJsaWNLZXkoc3RhY2ssICdNeVB1YmxpY0tleScsIHtcbiAgICAgICAgICAgIGVuY29kZWRLZXk6IHB1YmxpY0tleSxcbiAgICAgICAgICB9KSxcbiAgICAgICAgXSxcbiAgICAgIH0pLFxuICAgIF0sXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ-distribution-key-group.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.ts similarity index 91% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.ts index 43e97018e98f6..ec24e1a953dfb 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-key-group.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-key-group'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js new file mode 100644 index 0000000000000..51ec940dd56d6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const region = 'eu-west-1'; +const stack = new cdk.Stack(app, 'integ-distribution-lambda-cross-region', { env: { region: region } }); +const lambdaFunction = new cloudfront.experimental.EdgeFunction(stack, 'Lambda', { + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const lambdaFunction2 = new cloudfront.experimental.EdgeFunction(stack, 'Lambda2', { + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + stackId: `edge-lambda-stack-${region}-2`, +}); +lambdaFunction.addAlias('live'); +lambdaFunction2.addAlias('live'); +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com'), + cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED, + edgeLambdas: [ + { + functionVersion: lambdaFunction.currentVersion, + eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST, + }, + { + functionVersion: lambdaFunction2.currentVersion, + eventType: cloudfront.LambdaEdgeEventType.ORIGIN_RESPONSE, + }, + ], + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLWxhbWJkYS1jcm9zcy1yZWdpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kaXN0cmlidXRpb24tbGFtYmRhLWNyb3NzLXJlZ2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGdCQUFnQjtBQUNoQixpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLCtDQUEyQztBQUMzQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxNQUFNLEdB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VycmVudFZlcnNpb24sXG4gICAgICAgIGV2ZW50VHlwZTogY2xvdWRmcm9udC5MYW1iZGFFZGdlRXZlbnRUeXBlLk9SSUdJTl9SRVNQT05TRSxcbiAgICAgIH0sXG4gICAgXSxcbiAgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudfront/lib/experimental/edge-function/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/lib/experimental/edge-function/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/index.js diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-c8363f8375cbe20a55dbe2aafe5dcee3889b0631e6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-c8363f8375cbe20a55dbe2aafe5dcee3889b0631e6.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-c8363f8375cbe20a55dbe2aafe5dcee3889b0631e6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-c8363f8375cbe20a55dbe2aafe5dcee3889b0631e6.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-eu-west-1-2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-eu-west-1-2.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-eu-west-1-2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/edge-lambda-stack-eu-west-1-2.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ-distribution-lambda-cross-region.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ-distribution-lambda-cross-region.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ-distribution-lambda-cross-region.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ-distribution-lambda-cross-region.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.ts similarity index 89% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.ts index 284f532d1657b..30f11d44cdb35 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda-cross-region.ts @@ -1,8 +1,8 @@ /// !cdk-integ * -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js new file mode 100644 index 0000000000000..c2c2b804b6906 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-lambda', { env: { region: 'us-east-1' } }); +const lambdaFunction = new lambda.Function(stack, 'Lambda', { + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com'), + cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED, + edgeLambdas: [{ + functionVersion: lambdaFunction.currentVersion, + eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST, + }], + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLWxhbWJkYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRpc3RyaWJ1dGlvbi1sYW1iZGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLCtDQUEyQztBQUMzQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSwyQkFBMkIsRUFBRSxFQUFFLEdBQUcsRUFBRSxFQUFFLE1BQU0sRUFBRSxXQUFXLEVBQUUsRUFBRSxDQUFDLENBQUM7QUFFaEcsTUFBTSxjQUFjLEdBQUcsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDMUQsSUFBSSxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQztJQUNuQyxPQUFPLEVBQUUsZUFBZTtJQUN4QixPQUFPLEVBQUUsTUFBTSxDQUFDLE9BQU8sQ0FBQyxXQUFXO0NBQ3BDLENBQUMsQ0FBQztBQUVILElBQUksVUFBVSxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFO0lBQ3pDLGVBQWUsRUFBRTtRQUNmLE1BQU0sRUFBRSxJQUFJLHdCQ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dmlvcjoge1xuICAgIG9yaWdpbjogbmV3IFRlc3RPcmlnaW4oJ3d3dy5leGFtcGxlLmNvbScpLFxuICAgIGNhY2hlUG9saWN5OiBjbG91ZGZyb250LkNhY2hlUG9saWN5LkNBQ0hJTkdfRElTQUJMRUQsXG4gICAgZWRnZUxhbWJkYXM6IFt7XG4gICAgICBmdW5jdGlvblZlcnNpb246IGxhbWJkYUZ1bmN0aW9uLmN1cnJlbnRWZXJzaW9uLFxuICAgICAgZXZlbnRUeXBlOiBjbG91ZGZyb250LkxhbWJkYUVkZ2VFdmVudFR5cGUuT1JJR0lOX1JFUVVFU1QsXG4gICAgfV0sXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ-distribution-lambda.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.ts similarity index 82% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.ts index fe8ea21004211..bb8233d1e88b3 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-lambda.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-lambda', { env: { region: 'us-east-1' } }); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js new file mode 100644 index 0000000000000..0f15d0de02875 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-origin-id'); +const origin = new test_origin_1.TestOrigin('www.example.com', { originId: 'my-custom-origin-id' }); +const distribution = new cloudfront.Distribution(stack, 'TestDistribution', { + defaultBehavior: { origin }, +}); +distribution.addBehavior('/second', origin); +distribution.addBehavior('/third', origin); +new integ_tests_alpha_1.IntegTest(app, 'DistributionOriginId', { + testC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0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7IEludGVnVGVzdCB9IGZyb20gJ0Bhd3MtY2RrL2ludGVnLXRlc3RzLWFscGhhJztcbmltcG9ydCB7IFRlc3RPcmlnaW4gfSBmcm9tICcuL3Rlc3Qtb3JpZ2luJztcbmltcG9ydCAqIGFzIGNsb3VkZnJvbnQgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNsb3VkZnJvbnQnO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2ludGVnLWRpc3RyaWJ1dGlvbi1vcmlnaW4taWQnKTtcblxuY29uc3Qgb3JpZ2luID0gbmV3IFRlc3RPcmlnaW4oJ3d3dy5leGFtcGxlLmNvbScsIHsgb3JpZ2luSWQ6ICdteS1jdXN0b20tb3JpZ2luLWlkJyB9KTtcblxuY29uc3QgZGlzdHJpYnV0aW9uID0gbmV3IGNsb3VkZnJvbnQuRGlzdHJpYnV0aW9uKHN0YWNrLCAnVGVzdERpc3RyaWJ1dGlvbicsIHtcbiAgZGVmYXVsdEJlaGF2aW9yOiB7IG9yaWdpbiB9LFxufSk7XG5kaXN0cmlidXRpb24uYWRkQmVoYXZpb3IoJy9zZWNvbmQnLCBvcmlnaW4pO1xuZGlzdHJpYnV0aW9uLmFkZEJlaGF2aW9yKCcvdGhpcmQnLCBvcmlnaW4pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ0Rpc3RyaWJ1dGlvbk9yaWdpbklkJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/DistributionOriginIdDefaultTestDeployAssert16FC3109.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-basic.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ-distribution-origin-id.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.ts similarity index 77% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.ts index 349488555cda6..46ddf3082fc86 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-id.ts @@ -1,7 +1,7 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-origin-id'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js new file mode 100644 index 0000000000000..ed7ef62a5345b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-origin-shield'); +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com', { + originShieldEnabled: false, + }), + }, +}); +new integ_tests_alpha_1.IntegTest(app, 'DistributionOriginShield', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLW9yaWdpbi1zaGllbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kaXN0cmlidXRpb24tb3JpZ2luLXNoaWVsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsK0NBQTJDO0FBQzNDLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGtDQUFrQyxDQUFDLENBQUM7QUFFckUsSUFBSSxVQUFVLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUU7SUFDekMsZUFBZSxFQUFFO1FBQ2YsTUFBTSxFQUFFLElBQUksd0JBQVUsQ0FBQyxpQkFBaUIsRUFBRTtZQUN4QyxtQkFBbUIsRUFBRSxLQUFLO1NBQzNCLENBQUM7S0FDSDtDQUNGLENBQUMsQ0FBQztBQUVILElBQUksNkJBQVMsQ0FBQyxHQUFHLEVBQUUsMEJBQTBCLEVBQUU7SUFDN0MsU0FBUyxFQUFFLENBQUMsS0FBSyxDQUFDO0NBQ25CLENBQUMsQ0FBQztBQUVILEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGNkayBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgeyBJbnRlZ1Rlc3QgfSBmcm9tICdAYXdzLWNkay9pbnRlZy10ZXN0cy1hbHBoYSc7XG5pbXBvcnQgeyBUZXN0T3JpZ2luIH0gZnJvbSAnLi90ZXN0LW9yaWdpbic7XG5pbXBvcnQgKiBhcyBjbG91ZGZyb250IGZyb20gJ2F3cy1jZGstbGliL2F3cy1jbG91ZGZyb250JztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdpbnRlZy1kaXN0cmlidXRpb24tb3JpZ2luLXNoaWVsZCcpO1xuXG5uZXcgY2xvdWRmcm9udC5EaXN0cmlidXRpb24oc3RhY2ssICdEaXN0Jywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHtcbiAgICBvcmlnaW46IG5ldyBUZXN0T3JpZ2luKCd3d3cuZXhhbXBsZS5jb20nLCB7XG4gICAgICBvcmlnaW5TaGllbGRFbmFibGVkOiBmYWxzZSxcbiAgICB9KSxcbiAgfSxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ0Rpc3RyaWJ1dGlvbk9yaWdpblNoaWVsZCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/DistributionOriginShieldDefaultTestDeployAssertDF7E33F9.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-id.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ-distribution-origin-shield.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.ts new file mode 100644 index 0000000000000..0e6266ce237f3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-origin-shield.ts @@ -0,0 +1,21 @@ +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { TestOrigin } from './test-origin'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-origin-shield'); + +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new TestOrigin('www.example.com', { + originShieldEnabled: false, + }), + }, +}); + +new IntegTest(app, 'DistributionOriginShield', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js new file mode 100644 index 0000000000000..12f32ffa533e2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const test_origin_1 = require("./test-origin"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-distribution-policies'); +const cachePolicy = new cloudfront.CachePolicy(stack, 'CachePolicy', { + cachePolicyName: 'ACustomCachePolicy', +}); +const originRequestPolicy = new cloudfront.OriginRequestPolicy(stack, 'OriginRequestPolicy', { + originRequestPolicyName: 'ACustomOriginRequestPolicy', + headerBehavior: cloudfront.OriginRequestHeaderBehavior.all('CloudFront-Forwarded-Proto'), +}); +const responseHeadersPolicy = new cloudfront.ResponseHeadersPolicy(stack, 'ResponseHeadersPolicy', { + responseHeadersPolicyName: 'ACustomResponseHeadersPolicy', + corsBehavior: { + accessControlAllowCredentials: false, + accessControlAllowHeaders: ['X-Custom-Header-1', 'X-Custom-Header-2'], + accessControlAllowMethods: ['GET', 'POST'], + accessControlAllowOrigins: ['*'], + accessControlExposeHeaders: ['X-Custom-Header-1', 'X-Custom-Header-2'], + accessControlMaxAge: cdk.Duration.seconds(600), + originOverride: true, + }, + removeHeaders: ['Server'], + serverTimingSamplingRate: 50, +}); +new cloudfront.Distribution(stack, 'Dist', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example.com'), + cachePolicy, + originRequestPolicy, + responseHeadersPolicy, + }, +}); +new cloudfront.Distribution(stack, 'Dist-2', { + defaultBehavior: { + origin: new test_origin_1.TestOrigin('www.example-2.com'), + cachePolicy, + originRequestPolicy: aws_cloudfront_1.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER, + responseHeadersPolicy, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGlzdHJpYnV0aW9uLXBvbGljaWVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZGlzdHJpYnV0aW9uLXBvbGljaWVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLCtDQUEyQztBQUMzQyx5REFBeUQ7QUFDekQsK0RBQWlFO0FBRWpFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsNkJBQTZCLENBQUMsQ0FBQztBQUVoRSxNQUFNLFdBQVcsR0FBRyxJQUFJLFVBQ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yVGltaW5nU2FtcGxpbmdSYXRlOiA1MCxcbn0pO1xuXG5uZXcgY2xvdWRmcm9udC5EaXN0cmlidXRpb24oc3RhY2ssICdEaXN0Jywge1xuICBkZWZhdWx0QmVoYXZpb3I6IHtcbiAgICBvcmlnaW46IG5ldyBUZXN0T3JpZ2luKCd3d3cuZXhhbXBsZS5jb20nKSxcbiAgICBjYWNoZVBvbGljeSxcbiAgICBvcmlnaW5SZXF1ZXN0UG9saWN5LFxuICAgIHJlc3BvbnNlSGVhZGVyc1BvbGljeSxcbiAgfSxcbn0pO1xuXG5uZXcgY2xvdWRmcm9udC5EaXN0cmlidXRpb24oc3RhY2ssICdEaXN0LTInLCB7XG4gIGRlZmF1bHRCZWhhdmlvcjoge1xuICAgIG9yaWdpbjogbmV3IFRlc3RPcmlnaW4oJ3d3dy5leGFtcGxlLTIuY29tJyksXG4gICAgY2FjaGVQb2xpY3ksXG4gICAgb3JpZ2luUmVxdWVzdFBvbGljeTogT3JpZ2luUmVxdWVzdFBvbGljeS5BTExfVklFV0VSX0VYQ0VQVF9IT1NUX0hFQURFUixcbiAgICByZXNwb25zZUhlYWRlcnNQb2xpY3ksXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.assets.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ-distribution-policies.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.ts similarity index 90% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.ts index 9bd15fc777634..acb94f5e2a56b 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-policies.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-policies.ts @@ -1,7 +1,7 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; -import { OriginRequestPolicy } from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import { OriginRequestPolicy } from 'aws-cdk-lib/aws-cloudfront'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-distribution-policies'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.d.ts new file mode 100644 index 0000000000000..883253a4f06ff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.d.ts @@ -0,0 +1,15 @@ +import { Construct } from 'constructs'; +import { CfnDistribution, IOrigin, OriginBase, OriginBindConfig, OriginBindOptions, OriginProps } from 'aws-cdk-lib/aws-cloudfront'; +/** Used for testing common Origin functionality */ +export declare class TestOrigin extends OriginBase { + constructor(domainName: string, props?: OriginProps); + protected renderCustomOriginConfig(): CfnDistribution.CustomOriginConfigProperty | undefined; +} +export declare class TestOriginGroup implements IOrigin { + private readonly primaryDomainName; + private readonly secondaryDomainName; + constructor(primaryDomainName: string, secondaryDomainName: string); + bind(scope: Construct, options: OriginBindOptions): OriginBindConfig; +} +export declare function defaultOrigin(domainName?: string, originId?: string): IOrigin; +export declare function defaultOriginGroup(): IOrigin; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.js new file mode 100644 index 0000000000000..cddd035d40047 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaultOriginGroup = exports.defaultOrigin = exports.TestOriginGroup = exports.TestOrigin = void 0; +const aws_cloudfront_1 = require("aws-cdk-lib/aws-cloudfront"); +/** Used for testing common Origin functionality */ +class TestOrigin extends aws_cloudfront_1.OriginBase { + constructor(domainName, props = {}) { super(domainName, props); } + renderCustomOriginConfig() { + return { originProtocolPolicy: aws_cloudfront_1.OriginProtocolPolicy.HTTPS_ONLY }; + } +} +exports.TestOrigin = TestOrigin; +class TestOriginGroup { + constructor(primaryDomainName, secondaryDomainName) { + this.primaryDomainName = primaryDomainName; + this.secondaryDomainName = secondaryDomainName; + } + /* eslint-disable @aws-cdk/no-core-construct */ + bind(scope, options) { + const primaryOrigin = new TestOrigin(this.primaryDomainName); + const secondaryOrigin = new TestOrigin(this.secondaryDomainName); + const primaryOriginConfig = primaryOrigin.bind(scope, options); + return { + originProperty: primaryOriginConfig.originProperty, + failoverConfig: { + failoverOrigin: secondaryOrigin, + }, + }; + } +} +exports.TestOriginGroup = TestOriginGroup; +function defaultOrigin(domainName, originId) { + return new TestOrigin(domainName ?? 'www.example.com', { + originId, + }); +} +exports.defaultOrigin = defaultOrigin; +function defaultOriginGroup() { + return new TestOriginGroup('www.example.com', 'foo.example.com'); +} +exports.defaultOriginGroup = defaultOriginGroup; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC1vcmlnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0ZXN0LW9yaWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQS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OiBJT3JpZ2luIHtcbiAgcmV0dXJuIG5ldyBUZXN0T3JpZ2luR3JvdXAoJ3d3dy5leGFtcGxlLmNvbScsICdmb28uZXhhbXBsZS5jb20nKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts new file mode 100644 index 0000000000000..5720f72d43727 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/test-origin.ts @@ -0,0 +1,37 @@ +import { Construct } from 'constructs'; +import { CfnDistribution, IOrigin, OriginBase, OriginBindConfig, OriginBindOptions, OriginProps, OriginProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront'; + +/** Used for testing common Origin functionality */ +export class TestOrigin extends OriginBase { + constructor(domainName: string, props: OriginProps = {}) { super(domainName, props); } + protected renderCustomOriginConfig(): CfnDistribution.CustomOriginConfigProperty | undefined { + return { originProtocolPolicy: OriginProtocolPolicy.HTTPS_ONLY }; + } +} + +export class TestOriginGroup implements IOrigin { + constructor(private readonly primaryDomainName: string, private readonly secondaryDomainName: string) { } + /* eslint-disable @aws-cdk/no-core-construct */ + public bind(scope: Construct, options: OriginBindOptions): OriginBindConfig { + const primaryOrigin = new TestOrigin(this.primaryDomainName); + const secondaryOrigin = new TestOrigin(this.secondaryDomainName); + + const primaryOriginConfig = primaryOrigin.bind(scope, options); + return { + originProperty: primaryOriginConfig.originProperty, + failoverConfig: { + failoverOrigin: secondaryOrigin, + }, + }; + } +} + +export function defaultOrigin(domainName?: string, originId?: string): IOrigin { + return new TestOrigin(domainName ?? 'www.example.com', { + originId, + }); +} + +export function defaultOriginGroup(): IOrigin { + return new TestOriginGroup('www.example.com', 'foo.example.com'); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js new file mode 100644 index 0000000000000..095f1beb65fb2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cloudtrail = require("aws-cdk-lib/aws-cloudtrail"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail-data-events'); +const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.DESTROY }); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_18_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); +const trail = new cloudtrail.Trail(stack, 'Trail', { + managementEvents: cloudtrail.ReadWriteType.NONE, +}); +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); +new integ.IntegTest(app, 'CloudTrailDataEventsOnlyTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWR0cmFpbC1kYXRhLWV2ZW50cy1vbmx5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2xvdWR0cmFpbC1kYXRhLWV2ZW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G5jb25zdCB0cmFpbCA9IG5ldyBjbG91ZHRyYWlsLlRyYWlsKHN0YWNrLCAnVHJhaWwnLCB7XG4gIG1hbmFnZW1lbnRFdmVudHM6IGNsb3VkdHJhaWwuUmVhZFdyaXRlVHlwZS5OT05FLFxufSk7XG50cmFpbC5hZGRMYW1iZGFFdmVudFNlbGVjdG9yKFtsYW1iZGFGdW5jdGlvbl0pO1xudHJhaWwuYWRkUzNFdmVudFNlbGVjdG9yKFt7IGJ1Y2tldCB9XSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnQ2xvdWRUcmFpbERhdGFFdmVudHNPbmx5VGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/CloudTrailDataEventsOnlyTestDefaultTestDeployAssertA7E52868.template.json diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-elbv2.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ-cloudtrail-data-events.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.ts new file mode 100644 index 0000000000000..eda806c88b554 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-data-events-only.ts @@ -0,0 +1,27 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail-data-events'); + +const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.DESTROY }); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_18_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); + +const trail = new cloudtrail.Trail(stack, 'Trail', { + managementEvents: cloudtrail.ReadWriteType.NONE, +}); +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); + +new integ.IntegTest(app, 'CloudTrailDataEventsOnlyTest', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js new file mode 100644 index 0000000000000..9d44fd48d60e2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cloudtrail = require("aws-cdk-lib/aws-cloudtrail"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail-defaults'); +new cloudtrail.Trail(stack, 'Trail'); +new integ.IntegTest(app, 'CloudTrailDefaultsTest',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FpbC5UcmFpbChzdGFjaywgJ1RyYWlsJyk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnQ2xvdWRUcmFpbERlZmF1bHRzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/CloudTrailDefaultsTestDefaultTestDeployAssertBD9995EA.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ-cloudtrail-defaults.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.ts new file mode 100644 index 0000000000000..fb6c24833e0e9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-defaults.ts @@ -0,0 +1,14 @@ +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail-defaults'); + +new cloudtrail.Trail(stack, 'Trail'); + +new integ.IntegTest(app, 'CloudTrailDefaultsTest', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js new file mode 100644 index 0000000000000..ddb8f5d5b48e0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cloudtrail = require("aws-cdk-lib/aws-cloudtrail"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-cloudtrail-inshights-test'); +const cloudTrailPrincipal = new iam.ServicePrincipal('cloudtrail.amazonaws.com'); +const Trailbucket = new s3.Bucket(stack, 'S3', { + encryption: s3.BucketEncryption.UNENCRYPTED, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.bucketArn], + actions: ['s3:GetBucketAcl'], + principals: [cloudTrailPrincipal], +})); +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.arnForObjects(`AWSLogs/${aws_cdk_lib_1.Stack.of(stack).account}/*`)], + actions: ['s3:PutObject'], + principals: [cloudTrailPrincipal], + conditions: { + StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' }, + }, +})); +new cloudtrail.Trail(stack, 'Trail', { + bucket: Trailbucket, + insightTypes: [ + cloudtrail.InsightType.API_CALL_RATE, + cloudtrail.InsightType.API_ERROR_RATE, + ], +}); +new integ.IntegTest(app, 'aws-cdk-cloudtrail-inshights', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ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ICAgIFN0cmluZ0VxdWFsczogeyAnczM6eC1hbXotYWNsJzogJ2J1Y2tldC1vd25lci1mdWxsLWNvbnRyb2wnIH0sXG4gIH0sXG59KSk7XG5cbm5ldyBjbG91ZHRyYWlsLlRyYWlsKHN0YWNrLCAnVHJhaWwnLCB7XG4gIGJ1Y2tldDogVHJhaWxidWNrZXQsXG4gIGluc2lnaHRUeXBlczogW1xuICAgIGNsb3VkdHJhaWwuSW5zaWdodFR5cGUuQVBJX0NBTExfUkFURSxcbiAgICBjbG91ZHRyYWlsLkluc2lnaHRUeXBlLkFQSV9FUlJPUl9SQVRFLFxuICBdLFxufSk7XG5cblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhd3MtY2RrLWNsb3VkdHJhaWwtaW5zaGlnaHRzJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/aws-cdk-cloudtrail-inshights-test.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/awscdkcloudtrailinshightsDefaultTestDeployAssertF7B86FF0.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.ts similarity index 81% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.ts index d43dc2493394c..972f7d7ff056d 100644 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-insight.ts @@ -1,9 +1,9 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; -import * as cloudtrail from '../lib'; +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; const app = new App(); const stack = new Stack(app, 'aws-cdk-cloudtrail-inshights-test'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js new file mode 100644 index 0000000000000..f2b289dec73f2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cloudtrail = require("aws-cdk-lib/aws-cloudtrail"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail'); +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); +// using exctecy the same code as inside the cloudtrail class to produce the supplied bucket and policy +const cloudTrailPrincipal = new iam.ServicePrincipal('cloudtrail.amazonaws.com'); +const Trailbucket = new s3.Bucket(stack, 'S3', { + encryption: s3.BucketEncryption.UNENCRYPTED, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.bucketArn], + actions: ['s3:GetBucketAcl'], + principals: [cloudTrailPrincipal], +})); +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.arnForObjects(`AWSLogs/${cdk.Stack.of(stack).account}/*`)], + actions: ['s3:PutObject'], + principals: [cloudTrailPrincipal], + conditions: { + StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' }, + }, +})); +const trail = new cloudtrail.Trail(stack, 'Trail', { bucket: Trailbucket }); +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWR0cmFpbC1zdXBwbGllZC1idWNrZXQubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2xvdWR0cmFpbC1zdXBwbGllZC1idWNrZXQubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLGlEQUFpRDtBQUNqRCx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBRW5DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGtCQUFrQixDQUFDLENBQUM7QUFFckQsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDNUMsYUFBYSxFQUFFLEdBQUcsQ0FBQyxh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uICByZXNvdXJjZXM6IFtUcmFpbGJ1Y2tldC5idWNrZXRBcm5dLFxuICBhY3Rpb25zOiBbJ3MzOkdldEJ1Y2tldEFjbCddLFxuICBwcmluY2lwYWxzOiBbY2xvdWRUcmFpbFByaW5jaXBhbF0sXG59KSk7XG5cblRyYWlsYnVja2V0LmFkZFRvUmVzb3VyY2VQb2xpY3kobmV3IGlhbS5Qb2xpY3lTdGF0ZW1lbnQoe1xuICByZXNvdXJjZXM6IFtUcmFpbGJ1Y2tldC5hcm5Gb3JPYmplY3RzKGBBV1NMb2dzLyR7Y2RrLlN0YWNrLm9mKHN0YWNrKS5hY2NvdW50fS8qYCldLFxuICBhY3Rpb25zOiBbJ3MzOlB1dE9iamVjdCddLFxuICBwcmluY2lwYWxzOiBbY2xvdWRUcmFpbFByaW5jaXBhbF0sXG4gIGNvbmRpdGlvbnM6IHtcbiAgICBTdHJpbmdFcXVhbHM6IHsgJ3MzOngtYW16LWFjbCc6ICdidWNrZXQtb3duZXItZnVsbC1jb250cm9sJyB9LFxuICB9LFxufSkpO1xuXG5jb25zdCB0cmFpbCA9IG5ldyBjbG91ZHRyYWlsLlRyYWlsKHN0YWNrLCAnVHJhaWwnLCB7IGJ1Y2tldDogVHJhaWxidWNrZXQgfSk7XG5cbnRyYWlsLmFkZExhbWJkYUV2ZW50U2VsZWN0b3IoW2xhbWJkYUZ1bmN0aW9uXSk7XG50cmFpbC5hZGRTM0V2ZW50U2VsZWN0b3IoW3sgYnVja2V0IH1dKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ-cloudtrail.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts new file mode 100644 index 0000000000000..998e9db521fa2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts @@ -0,0 +1,50 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; + +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail'); + +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); + +// using exctecy the same code as inside the cloudtrail class to produce the supplied bucket and policy +const cloudTrailPrincipal = new iam.ServicePrincipal('cloudtrail.amazonaws.com'); + +const Trailbucket = new s3.Bucket(stack, 'S3', { + encryption: s3.BucketEncryption.UNENCRYPTED, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); + +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.bucketArn], + actions: ['s3:GetBucketAcl'], + principals: [cloudTrailPrincipal], +})); + +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.arnForObjects(`AWSLogs/${cdk.Stack.of(stack).account}/*`)], + actions: ['s3:PutObject'], + principals: [cloudTrailPrincipal], + conditions: { + StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' }, + }, +})); + +const trail = new cloudtrail.Trail(stack, 'Trail', { bucket: Trailbucket }); + +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js new file mode 100644 index 0000000000000..e042e6aaa9e63 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const cloudtrail = require("aws-cdk-lib/aws-cloudtrail"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail'); +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const topic = new sns.Topic(stack, 'Topic'); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); +const trail = new cloudtrail.Trail(stack, 'Trail', { + snsTopic: topic, +}); +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWR0cmFpbC5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZHRyYWlsLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRDtBQUNqRCx5Q0FBeUM7QUFDekMsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyx5REFBeUQ7QUFFekQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxrQkFBa0IsQ0FBQyxDQUFDO0FBRXJELE1BQU0sTUFBTSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQzVDLGFBQWEsRUFBRSxHQUFHLENBQUMsYUFBYSxDQUFDLE9BQU87SUFDeEMsaUJBQWlCLEVBQUUsSUFBSTtDQUN4QixDQUFDLENBQUM7QUFDSCxNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsS0FBSyxFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBQzVDLE1BQU0sY0FBYyxHQUFHLElBQUksTUFBTSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsZ0JBQWdCLE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GljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgYXV0b0RlbGV0ZU9iamVjdHM6IHRydWUsXG59KTtcbmNvbnN0IHRvcGljID0gbmV3IHNucy5Ub3BpYyhzdGFjaywgJ1RvcGljJyk7XG5jb25zdCBsYW1iZGFGdW5jdGlvbiA9IG5ldyBsYW1iZGEuRnVuY3Rpb24oc3RhY2ssICdMYW1iZGFGdW5jdGlvbicsIHtcbiAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gIGhhbmRsZXI6ICdoZWxsby5oYW5kbGVyJyxcbiAgY29kZTogbGFtYmRhLkNvZGUuZnJvbUlubGluZSgnZXhwb3J0cy5oYW5kbGVyID0ge30nKSxcbn0pO1xuXG5jb25zdCB0cmFpbCA9IG5ldyBjbG91ZHRyYWlsLlRyYWlsKHN0YWNrLCAnVHJhaWwnLCB7XG4gIHNuc1RvcGljOiB0b3BpYyxcbn0pO1xudHJhaWwuYWRkTGFtYmRhRXZlbnRTZWxlY3RvcihbbGFtYmRhRnVuY3Rpb25dKTtcbnRyYWlsLmFkZFMzRXZlbnRTZWxlY3RvcihbeyBidWNrZXQgfV0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.assets.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ-cloudtrail.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.ts new file mode 100644 index 0000000000000..671128c721428 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudtrail/test/integ.cloudtrail.lit.ts @@ -0,0 +1,27 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail'); + +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const topic = new sns.Topic(stack, 'Topic'); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); + +const trail = new cloudtrail.Trail(stack, 'Trail', { + snsTopic: topic, +}); +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js new file mode 100644 index 0000000000000..a37ea09af2ec2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const kms = require("aws-cdk-lib/aws-kms"); +const ssmIncidents = require("aws-cdk-lib/aws-ssmincidents"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cloudwatchActions = require("aws-cdk-lib/aws-cloudwatch-actions"); +class SsmIncidentAlarmActionIntegrationTestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const responsePlanName = 'test-response-plan'; + const key = new kms.Key(this, 'Key', { + pendingWindow: aws_cdk_lib_1.Duration.days(7), + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + const replicationSet = new ssmIncidents.CfnReplicationSet(this, 'ReplicationSet', { + deletionProtected: false, + regions: [{ + regionName: this.region, + regionConfiguration: { + sseKmsKeyId: key.keyArn, + }, + }], + }); + const responsePlan = new ssmIncidents.CfnResponsePlan(this, 'ResponsePlan', { + name: responsePlanName, + incidentTemplate: { + title: 'Incident Title', + impact: 1, + }, + }); + responsePlan.node.addDependency(replicationSet); + const metric = new cloudwatch.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + label: 'Metric [AVG: ${AVG}]', + }); + const alarm = new cloudwatch.Alarm(this, 'Alarm1', { + metric, + threshold: 100, + evaluationPeriods: 3, + }); + alarm.node.addDependency(responsePlan); + alarm.addAlarmAction(new cloudwatchActions.SsmIncidentAction(responsePlanName)); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new SsmIncidentAlarmActionIntegrationTestStack(app, 'SsmIncidentAlarmActionIntegrationTestStack'); +new integ.IntegTest(app, 'SsmIncidentManagerAlarmActionTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3NtLWluY2lkZW50LWFsYXJtLWFjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNzb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LlNzbUluY2lkZW50QWN0aW9uKHJlc3BvbnNlUGxhbk5hbWUpKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IFNzbUluY2lkZW50QWxhcm1BY3Rpb25JbnRlZ3JhdGlvblRlc3RTdGFjayhhcHAsICdTc21JbmNpZGVudEFsYXJtQWN0aW9uSW50ZWdyYXRpb25UZXN0U3RhY2snKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdTc21JbmNpZGVudE1hbmFnZXJBbGFybUFjdGlvblRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentAlarmActionIntegrationTestStack.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/SsmIncidentManagerAlarmActionTestDefaultTestDeployAssert9DC05EC0.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.ts similarity index 83% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.ts index 23c93c502432f..31b2a1086191d 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch-actions/test/integ.ssm-incident-alarm-action.ts @@ -1,10 +1,10 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as kms from '@aws-cdk/aws-kms'; -import * as ssmIncidents from '@aws-cdk/aws-ssmincidents'; -import { App, Stack, StackProps, RemovalPolicy, Duration } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as ssmIncidents from 'aws-cdk-lib/aws-ssmincidents'; +import { App, Stack, StackProps, RemovalPolicy, Duration } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; -import * as cloudwatchActions from '../lib'; +import * as cloudwatchActions from 'aws-cdk-lib/aws-cloudwatch-actions'; class SsmIncidentAlarmActionIntegrationTestStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js new file mode 100644 index 0000000000000..ac8bed91aff7e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js @@ -0,0 +1,104 @@ +"use strict"; +// Integration test to deploy some resources, create an alarm on it and create a dashboard. +// +// Because literally every other library is going to depend on @aws-cdk/aws-cloudwatch, we drop down +// to the very lowest level to create CloudFormation resources by hand, without even generated +// library support. +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudwatch-alarms'); +const queue = new cdk.CfnResource(stack, 'queue', { type: 'AWS::SQS::Queue' }); +const numberOfMessagesVisibleMetric = new cloudwatch.Metric({ + namespace: 'AWS/SQS', + metricName: 'ApproximateNumberOfMessagesVisible', + dimensionsMap: { QueueName: queue.getAtt('QueueName').toString() }, +}); +const sentMessageSizeMetric = new cloudwatch.Metric({ + namespace: 'AWS/SQS', + metricName: 'SentMessageSize', + dimensionsMap: { QueueName: queue.getAtt('QueueName').toString() }, +}); +const alarm = numberOfMessagesVisibleMetric.createAlarm(stack, 'Alarm', { + threshold: 100, + evaluationPeriods: 3, + datapointsToAlarm: 2, +}); +const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { + dashboardName: 'MyCustomDashboardName', + start: '-9H', + end: '2018-12-17T06:00:00.000Z', + periodOverride: cloudwatch.PeriodOverride.INHERIT, +}); +dashboard.addWidgets(new cloudwatch.TextWidget({ markdown: '# This is my dashboard' }), new cloudwatch.TextWidget({ markdown: 'you like?' })); +dashboard.addWidgets(new cloudwatch.AlarmWidget({ + title: 'Messages in queue', + alarm, +})); +dashboard.addWidgets(new cloudwatch.AlarmStatusWidget({ + title: 'Firing alarms', + alarms: [alarm], +})); +dashboard.addWidgets(new cloudwatch.GraphWidget({ + title: 'More messages in queue with alarm annotation', + left: [numberOfMessagesVisibleMetric], + leftAnnotations: [alarm.toAnnotation()], +})); +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + title: 'Current messages in queue', + metrics: [numberOfMessagesVisibleMetric], +})); +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + title: 'Errors in my log group', + logGroupNames: ['my-log-group'], + queryString: `fields @message + | filter @message like /Error/`, +})); +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + title: 'Errors in my log group - bar', + view: cloudwatch.LogQueryVisualizationType.BAR, + logGroupNames: ['my-log-group'], + queryString: `fields @message + | filter @message like /Error/`, +})); +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + title: 'Errors in my log group - line', + view: cloudwatch.LogQueryVisualizationType.LINE, + logGroupNames: ['my-log-group'], + queryString: `fields @message + | filter @message like /Error/`, +})); +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + title: 'Errors in my log group - stacked', + view: cloudwatch.LogQueryVisualizationType.STACKEDAREA, + logGroupNames: ['my-log-group'], + queryString: `fields @message + | filter @message like /Error/`, +})); +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + title: 'Errors in my log group - pie', + view: cloudwatch.LogQueryVisualizationType.PIE, + logGroupNames: ['my-log-group'], + queryString: `fields @message + | filter @message like /Error/`, +})); +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + title: 'Sent message size', + metrics: [sentMessageSizeMetric], + fullPrecision: false, +})); +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + title: 'Sent message size with full precision', + metrics: [sentMessageSizeMetric], + fullPrecision: true, +})); +dashboard.addWidgets(new cloudwatch.CustomWidget({ + title: 'My custom alarm', + functionArn: 'arn:aws:lambda:us-west-2:123456789012:function:my-function', +})); +new integ_tests_alpha_1.IntegTest(app, 'cdk-cloudwatch-alarms-integ-test', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxhcm0tYW5kLWRhc2hib2FyZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFsYXJtLWFuZC1kYXNoYm9hcmQudHMiXSw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U2Nzg5MDEyOmZ1bmN0aW9uOm15LWZ1bmN0aW9uJyxcbn0pKTtcblxubmV3IEludGVnVGVzdChhcHAsICdjZGstY2xvdWR3YXRjaC1hbGFybXMtaW50ZWctdGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts index b59bbd087f7bd..8c6235a52c782 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts @@ -4,9 +4,9 @@ // to the very lowest level to create CloudFormation resources by hand, without even generated // library support. -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as cloudwatch from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js new file mode 100644 index 0000000000000..d5399c349b4d2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +class AlarmWithLabelIntegrationTest extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const testMetric = new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + label: 'Metric [AVG: ${AVG}]', + }); + new aws_cloudwatch_1.Alarm(this, 'Alarm1', { + metric: testMetric, + threshold: 100, + evaluationPeriods: 3, + }); + testMetric.createAlarm(this, 'Alarm2', { + threshold: 100, + evaluationPeriods: 3, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-cloudwatch-alarms-with-label-integ-test', { + testCases: [new AlarmWithLabelIntegrationTest(app, 'AlarmWithLabelIntegrationTest')], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxhcm0td2l0aC1sYWJlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFsYXJtLXdpdGgtbGFiZWwudHMiXSwib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cpXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/AlarmWithLabelIntegrationTest.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdkcloudwatchalarmswithlabelintegtestDefaultTestDeployAssert045C663E.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.ts similarity index 80% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.ts index a22fb4691fde2..daa98ddd86198 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-with-label.ts @@ -1,6 +1,6 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Alarm, Metric } from '../lib'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Alarm, Metric } from 'aws-cdk-lib/aws-cloudwatch'; class AlarmWithLabelIntegrationTest extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js new file mode 100644 index 0000000000000..8d824a87d3284 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +class CompositeAlarmIntegrationTest extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const testMetric = new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + }); + const alarm1 = new aws_cloudwatch_1.Alarm(this, 'Alarm1', { + metric: testMetric, + threshold: 100, + evaluationPeriods: 3, + }); + const alarm2 = new aws_cloudwatch_1.Alarm(this, 'Alarm2', { + metric: testMetric, + threshold: 1000, + evaluationPeriods: 3, + }); + const alarm3 = new aws_cloudwatch_1.Alarm(this, 'Alarm3', { + metric: testMetric, + threshold: 10000, + evaluationPeriods: 3, + }); + const alarm4 = new aws_cloudwatch_1.Alarm(this, 'Alarm4', { + metric: testMetric, + threshold: 100000, + evaluationPeriods: 3, + }); + const alarm5 = new aws_cloudwatch_1.Alarm(this, 'Alarm5', { + alarmName: 'Alarm with space in name', + metric: testMetric, + threshold: 100000, + evaluationPeriods: 3, + }); + const alarmRule = aws_cloudwatch_1.AlarmRule.anyOf(aws_cloudwatch_1.AlarmRule.allOf(aws_cloudwatch_1.AlarmRule.anyOf(alarm1, aws_cloudwatch_1.AlarmRule.fromAlarm(alarm2, aws_cloudwatch_1.AlarmState.OK), alarm3, alarm5), aws_cloudwatch_1.AlarmRule.not(aws_cloudwatch_1.AlarmRule.fromAlarm(alarm4, aws_cloudwatch_1.AlarmState.INSUFFICIENT_DATA))), aws_cloudwatch_1.AlarmRule.fromBoolean(false)); + new aws_cloudwatch_1.CompositeAlarm(this, 'CompositeAlarm', { + alarmRule, + actionsSuppressor: alarm5, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-composite-alarm', { + testCases: [new CompositeAlarmIntegrationTest(app, 'CompositeAlarmIntegrationTest')], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29tcG9zaXRlLWFsYXJtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY29tcG9zaXRlLWFsYXJtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQXFEO0FBQ3JELGtFQUF1RDtBQUN2RCwrREFBa0c7QUFFbEcsTUFBTSw2QkFBOEIsU0FBUSxtQkFBSztJQUUvQyxZQUFZLEtBQVUsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDcEQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxVQUFVLEdBQUcsSUFBSSx1QkFBTSxDQUFDO1lBQzVCLFNBQVMsRUFBRSxVQUFVO1lBQ3JCLFVBQVUsRUFBRSxRQUFRO1NBQ3JCLENBQUMsQ0FBQztRQUVILE1BQU0sTUFBTSxHQUFHLElBQUksc0JBQUssQ0FBQyxJQUFJLEVBQUUsUUFBUSxFQUFFO1lBQ3ZDLE1BQU0sRUFBRSxVQUFVO1lBQ2xCLFNBQVMsRUFBRSxHQUFHO1lBQ2QsaUJBQWlCLEVBQUUsQ0FBQztTQUNyQixDQUFDLENBQUM7UUFFSCxNQUFNLE1BQU0sR0FBRyxJQUFJLHNCQUFLLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRTtZQUN2QyxNQUFNLEVBQUUsVUFBVTtZQUNsQixTQUFTLEVBQUUsSUFBSTtZQUNmLGlCQUFpQixFQUFFLENBQUM7U0FDckIsQ0FBQyxDQUFDO1FBRUgsTUFBTSxNQUFNLEdBQUcsSUF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XG4gICAgICAgICAgYWxhcm01LFxuICAgICAgICApLFxuICAgICAgICBBbGFybVJ1bGUubm90KEFsYXJtUnVsZS5mcm9tQWxhcm0oYWxhcm00LCBBbGFybVN0YXRlLklOU1VGRklDSUVOVF9EQVRBKSksXG4gICAgICApLFxuICAgICAgQWxhcm1SdWxlLmZyb21Cb29sZWFuKGZhbHNlKSxcbiAgICApO1xuXG4gICAgbmV3IENvbXBvc2l0ZUFsYXJtKHRoaXMsICdDb21wb3NpdGVBbGFybScsIHtcbiAgICAgIGFsYXJtUnVsZSxcbiAgICAgIGFjdGlvbnNTdXBwcmVzc29yOiBhbGFybTUsXG4gICAgfSk7XG4gIH1cblxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLWNvbXBvc2l0ZS1hbGFybScsIHtcbiAgdGVzdENhc2VzOiBbbmV3IENvbXBvc2l0ZUFsYXJtSW50ZWdyYXRpb25UZXN0KGFwcCwgJ0NvbXBvc2l0ZUFsYXJtSW50ZWdyYXRpb25UZXN0JyldLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/CompositeAlarmIntegrationTest.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.alarm-with-label.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdkintegcompositealarmDefaultTestDeployAssertF4EF969E.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.ts similarity index 91% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.ts index 30bf8ce7ad936..94ebfb24d1a11 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.composite-alarm.ts @@ -1,6 +1,6 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Alarm, AlarmRule, AlarmState, CompositeAlarm, Metric } from '../lib'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Alarm, AlarmRule, AlarmState, CompositeAlarm, Metric } from 'aws-cdk-lib/aws-cloudwatch'; class CompositeAlarmIntegrationTest extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js new file mode 100644 index 0000000000000..518564e118248 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +class DashboardWithGraphWidgetWithStatisticIntegrationTest extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const dashboard = new aws_cloudwatch_1.Dashboard(this, 'Dash'); + const widget = new aws_cloudwatch_1.GraphWidget({ + title: 'My fancy graph', + left: [ + new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + label: 'Metric left 1 - p99', + statistic: aws_cloudwatch_1.Stats.p(99), + }), + new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + label: 'Metric left 2 - TC_10P_90P', + statistic: aws_cloudwatch_1.Stats.tc(10, 90), + }), + new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + label: 'Metric left 3 - TS(5%:95%)', + statistic: 'TS(5%:95%)', + }), + ], + right: [ + new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + label: 'Metric right 1 - p90.1234', + statistic: 'p90.1234', + }), + ], + }); + dashboard.addWidgets(widget); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-dashboard-with-graph-widget-with-statistic', { + testCases: [new DashboardWithGraphWidgetWithStatisticIntegrationTest(app, 'DashboardWithGraphWidgetWithStatisticIntegrationTest')], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGFzaGJvYXJkLXdpdGgtZ3JhcGh3aWRnZXQtd2l0aC1zdGF0aXN0aWMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kYXNoYm9hcmQtd2l0aC1ncmFwaHdpZGdldC13aXRoLXN0YXRpc3RpYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFxRDtBQUNyRCxrRUFBdUQ7QUFDdkQsK0RBQW1GO0FBRW5GLE1BQU0sb0RBQXFELFNBQVEsbUJBQUs7SUFDdEUsWUFBWSxLQUFVLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQ3BELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sU0FBUyxHQUFHLElBQUksMEJBQVMsQ0FBQyxJQUFJLEVBQUUsTUFBTSxDQUFDLENBQUM7UUFFOUMsTUFBTSxNQUFNLEdBQUcsSUFBSSw0Q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FdpdGhTdGF0aXN0aWNJbnRlZ3JhdGlvblRlc3QnKV0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/DashboardWithGraphWidgetWithStatisticIntegrationTest.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.composite-alarm.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdkintegdashboardwithgraphwidgetwithstatisticDefaultTestDeployAssertD4707D74.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.ts similarity index 87% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.ts index ec347fd269511..ef5020d073a17 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.ts @@ -1,6 +1,6 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Dashboard, Metric, Stats, GraphWidget } from '../lib'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Dashboard, Metric, Stats, GraphWidget } from 'aws-cdk-lib/aws-cloudwatch'; class DashboardWithGraphWidgetWithStatisticIntegrationTest extends Stack { constructor(scope: App, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js new file mode 100644 index 0000000000000..a83154991a83d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'DashboardIntegrationTestStack'); +const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { + defaultInterval: cdk.Duration.days(7), +}); +dashboard.addWidgets(new cloudwatch.TextWidget({ + markdown: 'I don\'t have a background', + background: aws_cloudwatch_1.TextWidgetBackground.TRANSPARENT, +})); +new cdk.CfnOutput(stack, 'DashboardArn', { + value: dashboard.dashboardArn, +}); +new integ.IntegTest(app, 'DashboardIntegrationTest', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGFzaGJvYXJkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZGFzaGJvYXJkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCx5REFBeUQ7QUFDekQsK0RBQWtFO0FBRWxFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsK0JBQStCLENBQUMsQ0FBQztBQUVsRSxNQUFNLFNBQVMsR0FBRyxJQUFJLFVBQVUsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRTtJQUN4RCxlQUFlLEVBQUUsR0FBRyxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0NBQ3RDLENBQUMsQ0FBQztBQUVILFNBQVMsQ0FBQyxVQUFVLENBQUMsSUFBSSxVQUFVLENBQUMsVUFBVSxDQUFDO0lBQzdDLFFBQVEsRUFBRSw0QkFBNEI7SUFDdEMsVUFBVSxFQUFFLHFDQUFvQixDQUFDLFdBQVc7Q0FDN0MsQ0FBQyxDQUFDLENBQUM7QUFFSixJQUFJLEdBQUcsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUN2QyxLQUFLLEVBQUUsU0FBUyxDQUFDLFlBQVk7Q0FDOUIsQ0FBQyxDQUFDO0FBRUgsSUFBSSxLQUFLLENBQUMsU0FBUyxDQUFDLEdBQUcsRUFBRSwwQkFBMEIsRUFBRTtJQUNuRCxTQUF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pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestDefaultTestDeployAssert5BE38902.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/DashboardIntegrationTestStack.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.ts new file mode 100644 index 0000000000000..1b85a7c43eebf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.dashboard.ts @@ -0,0 +1,25 @@ +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import { TextWidgetBackground } from 'aws-cdk-lib/aws-cloudwatch'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'DashboardIntegrationTestStack'); + +const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { + defaultInterval: cdk.Duration.days(7), +}); + +dashboard.addWidgets(new cloudwatch.TextWidget({ + markdown: 'I don\'t have a background', + background: TextWidgetBackground.TRANSPARENT, +})); + +new cdk.CfnOutput(stack, 'DashboardArn', { + value: dashboard.dashboardArn, +}); + +new integ.IntegTest(app, 'DashboardIntegrationTest', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js new file mode 100644 index 0000000000000..f09ee9315856a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'gauge-alarm'); +const queue = new cdk.CfnResource(stack, 'queue', { type: 'AWS::SQS::Queue' }); +const numberOfMessagesVisibleMetric = new cloudwatch.Metric({ + namespace: 'AWS/SQS', + metricName: 'ApproximateNumberOfMessagesVisible', + dimensionsMap: { QueueName: queue.getAtt('QueueName').toString() }, +}); +const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { + dashboardName: 'MyCustomGaugeAlarm', +}); +dashboard.addWidgets(new cloudwatch.GaugeWidget({ + leftYAxis: { + max: 500, + min: 0, + }, + width: 24, + metrics: [numberOfMessagesVisibleMetric], +})); +new integ.IntegTest(app, 'GaugeAlarmIntegrationTest', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2F1Z2UtYWxhcm0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5nYXVnZS1hbGFybS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQseURBQXlEO0FBRXpELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsYUFBYSxDQUFDLENBQUM7QUFFaEQsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsV0FBVyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUUsRUFBRSxJQUFJLEVBQUUsaUJBQWlCLEVBQUUsQ0FBQyxDQUFDO0FBRS9FLE1BQU0sNkJBQTZCLEdBQUcsSUFBSSxVQUFVLENBQUMsTUFBTSxDQUFDO0lBQzF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HF1ZXVlID0gbmV3IGNkay5DZm5SZXNvdXJjZShzdGFjaywgJ3F1ZXVlJywgeyB0eXBlOiAnQVdTOjpTUVM6OlF1ZXVlJyB9KTtcblxuY29uc3QgbnVtYmVyT2ZNZXNzYWdlc1Zpc2libGVNZXRyaWMgPSBuZXcgY2xvdWR3YXRjaC5NZXRyaWMoe1xuICBuYW1lc3BhY2U6ICdBV1MvU1FTJyxcbiAgbWV0cmljTmFtZTogJ0FwcHJveGltYXRlTnVtYmVyT2ZNZXNzYWdlc1Zpc2libGUnLFxuICBkaW1lbnNpb25zTWFwOiB7IFF1ZXVlTmFtZTogcXVldWUuZ2V0QXR0KCdRdWV1ZU5hbWUnKS50b1N0cmluZygpIH0sXG59KTtcblxuY29uc3QgZGFzaGJvYXJkID0gbmV3IGNsb3Vkd2F0Y2guRGFzaGJvYXJkKHN0YWNrLCAnRGFzaCcsIHtcbiAgZGFzaGJvYXJkTmFtZTogJ015Q3VzdG9tR2F1Z2VBbGFybScsXG59KTtcbmRhc2hib2FyZC5hZGRXaWRnZXRzKFxuICBuZXcgY2xvdWR3YXRjaC5HYXVnZVdpZGdldCh7XG4gICAgbGVmdFlBeGlzOiB7XG4gICAgICBtYXg6IDUwMCxcbiAgICAgIG1pbjogMCxcbiAgICB9LFxuICAgIHdpZHRoOiAyNCxcbiAgICBtZXRyaWNzOiBbbnVtYmVyT2ZNZXNzYWdlc1Zpc2libGVNZXRyaWNdLFxuICB9KSxcbik7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnR2F1Z2VBbGFybUludGVncmF0aW9uVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/GaugeAlarmIntegrationTestDefaultTestDeployAssertF43E2A2D.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard-with-graphwidget-with-statistic.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/gauge-alarm.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.ts similarity index 83% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.ts index 8c21cde7e3a17..3d64dbb8bd0ca 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.gauge-alarm.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as cloudwatch from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js new file mode 100644 index 0000000000000..dd25fe0bb5a7f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js @@ -0,0 +1,67 @@ +"use strict"; +// Integration test to deploy some resources, create an alarm on it and create a dashboard. +// +// Because literally every other library is going to depend on @aws-cdk/aws-cloudwatch, we drop down +// to the very lowest level to create CloudFormation resources by hand, without even generated +// library support. +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudwatch'); +const queue = new cdk.CfnResource(stack, 'queue', { type: 'AWS::SQS::Queue' }); +const metricA = new cloudwatch.Metric({ + namespace: 'AWS/SQS', + metricName: 'ApproximateNumberOfMessagesVisible', + dimensionsMap: { QueueName: queue.getAtt('QueueName').toString() }, + period: cdk.Duration.seconds(10), + label: 'Visible Messages', +}); +const metricB = new cloudwatch.Metric({ + namespace: 'AWS/SQS', + metricName: 'ApproximateNumberOfMessagesNotVisible', + dimensionsMap: { QueueName: queue.getAtt('QueueName').toString() }, + period: cdk.Duration.seconds(30), + label: 'NotVisible Messages', +}); +const sumExpression = new cloudwatch.MathExpression({ + expression: 'm1+m2', + usingMetrics: { + m1: metricA, + m2: metricB, + }, + label: 'Total Messages', + period: cdk.Duration.minutes(1), +}); +const alarm = sumExpression.createAlarm(stack, 'Alarm', { + threshold: 100, + evaluationPeriods: 3, +}); +const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { + dashboardName: 'MyMathExpressionDashboardName', +}); +dashboard.addWidgets(new cloudwatch.AlarmWidget({ + title: 'Total messages in queue', + alarm, +})); +dashboard.addWidgets(new cloudwatch.GraphWidget({ + title: 'More total messages in queue with alarm annotation', + left: [sumExpression], + right: [metricA, metricB], + leftAnnotations: [alarm.toAnnotation()], +})); +dashboard.addWidgets(new cloudwatch.GraphWidget({ + title: 'Percentage of messages in each queue as pie chart', + left: [metricA, metricB], + view: cloudwatch.GraphWidgetView.PIE, + setPeriodToTimeRange: true, +})); +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + title: 'Current total messages in queue', + metrics: [sumExpression], +})); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-math-alarm-and-dashboard', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjoz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FyZC5hZGRXaWRnZXRzKG5ldyBjbG91ZHdhdGNoLkdyYXBoV2lkZ2V0KHtcbiAgdGl0bGU6ICdNb3JlIHRvdGFsIG1lc3NhZ2VzIGluIHF1ZXVlIHdpdGggYWxhcm0gYW5ub3RhdGlvbicsXG4gIGxlZnQ6IFtzdW1FeHByZXNzaW9uXSxcbiAgcmlnaHQ6IFttZXRyaWNBLCBtZXRyaWNCXSxcbiAgbGVmdEFubm90YXRpb25zOiBbYWxhcm0udG9Bbm5vdGF0aW9uKCldLFxufSkpO1xuXG5kYXNoYm9hcmQuYWRkV2lkZ2V0cyhuZXcgY2xvdWR3YXRjaC5HcmFwaFdpZGdldCh7XG4gIHRpdGxlOiAnUGVyY2VudGFnZSBvZiBtZXNzYWdlcyBpbiBlYWNoIHF1ZXVlIGFzIHBpZSBjaGFydCcsXG4gIGxlZnQ6IFttZXRyaWNBLCBtZXRyaWNCXSxcbiAgdmlldzogY2xvdWR3YXRjaC5HcmFwaFdpZGdldFZpZXcuUElFLFxuICBzZXRQZXJpb2RUb1RpbWVSYW5nZTogdHJ1ZSxcbn0pKTtcblxuZGFzaGJvYXJkLmFkZFdpZGdldHMobmV3IGNsb3Vkd2F0Y2guU2luZ2xlVmFsdWVXaWRnZXQoe1xuICB0aXRsZTogJ0N1cnJlbnQgdG90YWwgbWVzc2FnZXMgaW4gcXVldWUnLFxuICBtZXRyaWNzOiBbc3VtRXhwcmVzc2lvbl0sXG59KSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLW1hdGgtYWxhcm0tYW5kLWRhc2hib2FyZCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.gauge-alarm.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts similarity index 93% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts index ba76026c287f6..c3dd931dc0f43 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts @@ -4,9 +4,9 @@ // to the very lowest level to create CloudFormation resources by hand, without even generated // library support. -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as cloudwatch from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js new file mode 100644 index 0000000000000..859837bedb2ff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const dashboard = new aws_cloudwatch_1.Dashboard(this, 'Dashboard'); + const testMetric = new aws_cloudwatch_1.Metric({ + namespace: 'CDK/Test', + metricName: 'Metric', + }); + const widget = new aws_cloudwatch_1.SingleValueWidget({ + metrics: [testMetric], + sparkline: true, + }); + dashboard.addWidgets(widget); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ'); +new integ_tests_alpha_1.IntegTest(app, 'singlevaluewidget-with-sparkline', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3BhcmtsaW5lLXNpbmdsZXZhbHVld2lkZ2V0LWFuZC1kYXNoYm9hcmQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zcGFya2xpbmUtc2luZ2xldmFsdWV3aWRnZXQtYW5kLWRhc2hib2FyZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFxRDtBQUNyRCxrRUFBdUQ7QUFDdkQsK0RBQWtGO0FBRWxGLE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBVSxFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUNwRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBR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N0b3Ioc2NvcGU6IEFwcCwgaWQ6IHN0cmluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBjb25zdCBkYXNoYm9hcmQgPSBuZXcgRGFzaGJvYXJkKHRoaXMsICdEYXNoYm9hcmQnKTtcblxuICAgIGNvbnN0IHRlc3RNZXRyaWMgPSBuZXcgTWV0cmljKHtcbiAgICAgIG5hbWVzcGFjZTogJ0NESy9UZXN0JyxcbiAgICAgIG1ldHJpY05hbWU6ICdNZXRyaWMnLFxuICAgIH0pO1xuXG4gICAgY29uc3Qgd2lkZ2V0ID0gbmV3IFNpbmdsZVZhbHVlV2lkZ2V0KHtcbiAgICAgIG1ldHJpY3M6IFt0ZXN0TWV0cmljXSxcbiAgICAgIHNwYXJrbGluZTogdHJ1ZSxcbiAgICB9KTtcblxuICAgIGRhc2hib2FyZC5hZGRXaWRnZXRzKHdpZGdldCk7XG4gIH1cbn1cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHRlc3RDYXNlID0gbmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLWNsb3Vkd2F0Y2gtc2luZ2xldmFsdWV3aWRnZXQtc3BhcmtsaW5lLWludGVnJyk7XG5uZXcgSW50ZWdUZXN0KGFwcCwgJ3NpbmdsZXZhbHVld2lkZ2V0LXdpdGgtc3BhcmtsaW5lJywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/aws-cdk-cloudwatch-singlevaluewidget-sparkline-integ.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.assets.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/singlevaluewidgetwithsparklineDefaultTestDeployAssert6B085881.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts similarity index 76% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts index 01cd4e3dd664b..a12c32a248cdf 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.ts @@ -1,6 +1,6 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Dashboard, SingleValueWidget, Metric } from '../lib'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Dashboard, SingleValueWidget, Metric } from 'aws-cdk-lib/aws-cloudwatch'; class TestStack extends Stack { constructor(scope: App, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk/aws-codebuild/test/build-spec-asset.yml b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/build-spec-asset.yml similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/build-spec-asset.yml rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/build-spec-asset.yml diff --git a/packages/@aws-cdk/aws-codebuild/test/demo-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/demo-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/demo-image/Dockerfile diff --git a/packages/@aws-cdk/aws-codebuild/test/demo-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/demo-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/demo-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/demo-image/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js new file mode 100644 index 0000000000000..3f77197688509 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'CodeBuildAssetBuildSpecStack'); +// Create a codebuild project using a local asset as the buildspec file +const buildSpec = codebuild.BuildSpec.fromAsset(path.resolve(__dirname, 'build-spec-asset.yml')); +const project = new codebuild.Project(stack, 'MyProject', { + buildSpec, +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'AssetBuildSpecTest', { testCases: [stack] }); +const getBuildProject = integ.assertions.awsApiCall('CodeBuild', 'batchGetProjects', { + names: [project.projectName], +}); +getBuildProject.assertAtPath('projects.0.name.buildspec', integ_tests_alpha_1.ExpectedResult.exact(project.projectName)); +getBuildProject.assertAtPath('projects.0.source.buildspec', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('.+')); +const getBuildProjectBuildSpecArn = getBuildProject.getAttString('projects.0.source.buildspec'); +// Assert that the buildspec for the project is in fact an S3 object arn +// by parsing it and calling `getObject`. +const { resource, resourceName } = cdk.Arn.parse(getBuildProjectBuildSpecArn); +integ.assertions.awsApiCall('S3', 'getObject', { + Bucket: resource, + Key: resourceName, +}); +// Kick off a build +const startBuild = integ.assertions.awsApiCall('CodeBuild', 'startBuild', { + projectName: project.projectName, +}); +// Describe the build and wait for the status to be successful +integ.assertions.awsApiCall('CodeBuild', 'batchGetBuilds', { + ids: [startBuild.getAttString('build.id')], +}).assertAtPath('builds.0.buildStatus', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('SUCCEEDED')).waitForAssertions({ + totalTimeout: cdk.Duration.minutes(5), + interval: cdk.Duration.seconds(30), +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXQtYnVpbGQtc3BlYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFzc2V0LWJ1aWxkLXNwZWMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsbUNBQW1DO0F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9ucy5hd3NBcGlDYWxsKCdDb2RlQnVpbGQnLCAnYmF0Y2hHZXRCdWlsZHMnLCB7XG4gIGlkczogW3N0YXJ0QnVpbGQuZ2V0QXR0U3RyaW5nKCdidWlsZC5pZCcpXSxcbn0pLmFzc2VydEF0UGF0aChcbiAgJ2J1aWxkcy4wLmJ1aWxkU3RhdHVzJyxcbiAgRXhwZWN0ZWRSZXN1bHQuc3RyaW5nTGlrZVJlZ2V4cCgnU1VDQ0VFREVEJyksXG4pLndhaXRGb3JBc3NlcnRpb25zKHtcbiAgdG90YWxUaW1lb3V0OiBjZGsuRHVyYXRpb24ubWludXRlcyg1KSxcbiAgaW50ZXJ2YWw6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/AssetBuildSpecTestDefaultTestDeployAssertC826AACC.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/CodeBuildAssetBuildSpecStack.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.0ddfdbafee06424f04319f1476a7a991c4d29cdfc917e4c4c5fac49ade421ad4.yml b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.0ddfdbafee06424f04319f1476a7a991c4d29cdfc917e4c4c5fac49ade421ad4.yml similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.0ddfdbafee06424f04319f1476a7a991c4d29cdfc917e4c4c5fac49ade421ad4.yml rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.0ddfdbafee06424f04319f1476a7a991c4d29cdfc917e4c4c5fac49ade421ad4.yml diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.ts similarity index 91% rename from packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.ts index 550f1768c371c..4635888952efb 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.asset-build-spec.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.asset-build-spec.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import * as codebuild from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'CodeBuildAssetBuildSpecStack'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js new file mode 100644 index 0000000000000..2bb31a4406954 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new core.App(); +const stack = new core.Stack(app, 'aws-deep-learning-container-build-image'); +new codebuild.Project(stack, 'Project', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + environment: { + buildImage: codebuild.LinuxGpuBuildImage.DLC_MXNET_1_4_1, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXdzLWRlZXAtbGVhcm5pbmctY29udGFpbmVyLWJ1aWxkLWltYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXdzLWRlZXAtbGVhcm5pbmctY29udGFpbmVyLWJ1aWxkLWltYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsb0NBQW9DO0FBQ3BDLHVEQUF1RDtBQUV2RCxNQUFNLEdBQUcsR0FBRyxJQUFJLElBQUksQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMzQixNQUFNLEtBQUssR0FBRyxJQUFJLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHlDQUF5QyxDQUFDLENBQUM7QUFFN0UsSUFBSSxTQUFTLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUU7SUFDdEMsU0FBUyxFQUFFLFNBQVMsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDO1FBQ3hDLE9BQU8sRUFBRSxLQUFLO1FBQ2QsTUFBTSxFQUFFO1lBQ04sS0FBSyxFQUFFO2dCQUNMLFFBQVEsRUFBRSxDQUFDLElBQUksQ0FBQzthQUNqQjtTQUNGO0tBQ0YsQ0FBQztJQUNGLFdBQVcsRUFBRTtRQUNYLFVBQVUsRUFBRSxTQUFTLENBQUMsa0JBQWtCLENBQUMsZUFBZTtLQUN6RDtDQUNGLENBQUMsQ0FBQztBQUVILEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGNvcmUgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgY29kZWJ1aWxkIGZyb20gJ2F3cy1jZGstbGliL2F3cy1jb2RlYnVpbGQnO1xuXG5jb25zdCBhcHAgPSBuZXcgY29yZS5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IGNvcmUuU3RhY2soYXBwLCAnYXdzLWRlZXAtbGVhcm5pbmctY29udGFpbmVyLWJ1aWxkLWltYWdlJyk7XG5cbm5ldyBjb2RlYnVpbGQuUHJvamVjdChzdGFjaywgJ1Byb2plY3QnLCB7XG4gIGJ1aWxkU3BlYzogY29kZWJ1aWxkLkJ1aWxkU3BlYy5mcm9tT2JqZWN0KHtcbiAgICB2ZXJzaW9uOiAnMC4yJyxcbiAgICBwaGFzZXM6IHtcbiAgICAgIGJ1aWxkOiB7XG4gICAgICAgIGNvbW1hbmRzOiBbJ2xzJ10sXG4gICAgICB9LFxuICAgIH0sXG4gIH0pLFxuICBlbnZpcm9ubWVudDoge1xuICAgIGJ1aWxkSW1hZ2U6IGNvZGVidWlsZC5MaW51eEdwdUJ1aWxkSW1hZ2UuRExDX01YTkVUXzFfNF8xLFxuICB9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/aws-deep-learning-container-build-image.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.ts similarity index 80% rename from packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.ts index 13d58db1198b5..04acd71e6f5ad 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.aws-deep-learning-container-build-image.ts @@ -1,5 +1,5 @@ -import * as core from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as core from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new core.App(); const stack = new core.Stack(app, 'aws-deep-learning-container-build-image'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js new file mode 100644 index 0000000000000..a2c5d5ad17aa3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js @@ -0,0 +1,32 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-breakpoint'); +new codebuild.Project(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.STANDARD_6_0, + }, + ssmSessionPermissions: true, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + // Pause the build container if possible + 'codebuild-breakpoint', + // Regular build in a script in the repository + 'echo "regular build here"', + ], + }, + }, + }), +}); +new integ.IntegTest(app, 'ReportGroupIntegTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnJlYWtwb2ludC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmJyZWFrcG9pbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCx1REFBdUQ7QUFFdkQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUI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LlN0YWNrKGFwcCwgJ2F3cy1jZGstY29kZWJ1aWxkLWJyZWFrcG9pbnQnKTtcblxubmV3IGNvZGVidWlsZC5Qcm9qZWN0KHN0YWNrLCAnUHJvamVjdCcsIHtcbiAgZW52aXJvbm1lbnQ6IHtcbiAgICBidWlsZEltYWdlOiBjb2RlYnVpbGQuTGludXhCdWlsZEltYWdlLlNUQU5EQVJEXzZfMCxcbiAgfSxcbiAgc3NtU2Vzc2lvblBlcm1pc3Npb25zOiB0cnVlLFxuICBidWlsZFNwZWM6IGNvZGVidWlsZC5CdWlsZFNwZWMuZnJvbU9iamVjdCh7XG4gICAgdmVyc2lvbjogJzAuMicsXG4gICAgcGhhc2VzOiB7XG4gICAgICBidWlsZDoge1xuICAgICAgICBjb21tYW5kczogW1xuICAgICAgICAgIC8vIFBhdXNlIHRoZSBidWlsZCBjb250YWluZXIgaWYgcG9zc2libGVcbiAgICAgICAgICAnY29kZWJ1aWxkLWJyZWFrcG9pbnQnLFxuICAgICAgICAgIC8vIFJlZ3VsYXIgYnVpbGQgaW4gYSBzY3JpcHQgaW4gdGhlIHJlcG9zaXRvcnlcbiAgICAgICAgICAnZWNobyBcInJlZ3VsYXIgYnVpbGQgaGVyZVwiJyxcbiAgICAgICAgXSxcbiAgICAgIH0sXG4gICAgfSxcbiAgfSksXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdSZXBvcnRHcm91cEludGVnVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuXG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.template.json diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.ts similarity index 82% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.ts index 423953884e953..80cf89a0c1ba3 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.breakpoint.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as codebuild from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js new file mode 100644 index 0000000000000..d5e00902f8d7a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js @@ -0,0 +1,26 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const aws_codebuild_1 = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild'); +const bucket = new s3.Bucket(stack, 'CacheBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new codebuild.Project(stack, 'MyProject', { + cache: aws_codebuild_1.Cache.bucket(bucket), + buildSpec: codebuild.BuildSpec.fromObject({ + build: { + commands: ['echo Hello'], + }, + cache: { + paths: ['/root/.cache/pip/**/*'], + }, + }), + grantReportGroupPermissions: false, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,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J0ICogYXMgczMgZnJvbSAnYXdzLWNkay1saWIvYXdzLXMzJztcbmltcG9ydCAqIGFzIGNkayBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgKiBhcyBjb2RlYnVpbGQgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNvZGVidWlsZCc7XG5pbXBvcnQgeyBDYWNoZSB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1jb2RlYnVpbGQnO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5jb25zdCBzdGFjayA9IG5ldyBjZGsuU3RhY2soYXBwLCAnYXdzLWNkay1jb2RlYnVpbGQnKTtcblxuY29uc3QgYnVja2V0ID0gbmV3IHMzLkJ1Y2tldChzdGFjaywgJ0NhY2hlQnVja2V0Jywge1xuICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbm5ldyBjb2RlYnVpbGQuUHJvamVjdChzdGFjaywgJ015UHJvamVjdCcsIHtcbiAgY2FjaGU6IENhY2hlLmJ1Y2tldChidWNrZXQpLFxuICBidWlsZFNwZWM6IGNvZGVidWlsZC5CdWlsZFNwZWMuZnJvbU9iamVjdCh7XG4gICAgYnVpbGQ6IHtcbiAgICAgIGNvbW1hbmRzOiBbJ2VjaG8gSGVsbG8nXSxcbiAgICB9LFxuICAgIGNhY2hlOiB7XG4gICAgICBwYXRoczogWycvcm9vdC8uY2FjaGUvcGlwLyoqLyonXSxcbiAgICB9LFxuICB9KSxcbiAgZ3JhbnRSZXBvcnRHcm91cFBlcm1pc3Npb25zOiBmYWxzZSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/aws-cdk-codebuild.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.caching.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.ts new file mode 100644 index 0000000000000..8559a0532b853 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.caching.ts @@ -0,0 +1,28 @@ +#!/usr/bin/env node +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import { Cache } from 'aws-cdk-lib/aws-codebuild'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-codebuild'); + +const bucket = new s3.Bucket(stack, 'CacheBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +new codebuild.Project(stack, 'MyProject', { + cache: Cache.bucket(bucket), + buildSpec: codebuild.BuildSpec.fromObject({ + build: { + commands: ['echo Hello'], + }, + cache: { + paths: ['/root/.cache/pip/**/*'], + }, + }), + grantReportGroupPermissions: false, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js new file mode 100644 index 0000000000000..6b8868634f58f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + /// !show + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'echo "Hello, CodeBuild!"', + ], + }, + }, + }), + }); + /// !hide + } +} +const app = new cdk.App(); +new TestStack(app, 'codebuild-default-project'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVmYXVsdHMubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZGVmYXVsdHMubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsU0FBUztRQUNULElBQUksU0FBUyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsV0FBVyxFQUFFO1lBQ3ZDLFNBQVMsRUFBRSxTQUFTLENBQUMsU0FBUyxDQUFDLFVBQVUsQ0FBQztnQkFDeEMsT0FBTyxFQUFFLEtBQUs7Z0JBQ2QsTUFBTSxFQUFFO29CQUNOLEtBQUssRUFBRTt3QkFDTCxRQUFRLEVBQUU7NEJBQ1IsMEJBQTBCO3lCQUMzQjtxQkFDRjtpQkFDRjthQUNGLENBQUM7U0FDSCxDQUFDLENBQUM7UUFDSCxTQUFTO0lBQ1gsQ0FBQztDQUNGO0FBRUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsSUFBSSxTQUFTLENBQUMsR0FBRyxFQUFFLDJCQUEyQixDQUFDLENBQUM7QUFFaEQsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCAqIGFzIGNvZGVidWlsZCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY29kZWJ1aWxkJztcblxuY2xhc3MgVGVzdFN0YWNrIGV4dGVuZHMgY2RrLlN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IGNkay5BcHAsIGlkOiBzdHJpbmcpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuXG4gICAgLy8vICFzaG93XG4gICAgbmV3IGNvZGVidWlsZC5Qcm9qZWN0KHRoaXMsICdNeVByb2plY3QnLCB7XG4gICAgICBidWlsZFNwZWM6IGNvZGVidWlsZC5CdWlsZFNwZWMuZnJvbU9iamVjdCh7XG4gICAgICAgIHZlcnNpb246ICcwLjInLFxuICAgICAgICBwaGFzZXM6IHtcbiAgICAgICAgICBidWlsZDoge1xuICAgICAgICAgICAgY29tbWFuZHM6IFtcbiAgICAgICAgICAgICAgJ2VjaG8gXCJIZWxsbywgQ29kZUJ1aWxkIVwiJyxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0pLFxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBUZXN0U3RhY2soYXBwLCAnY29kZWJ1aWxkLWRlZmF1bHQtcHJvamVjdCcpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/codebuild-default-project.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.ts new file mode 100644 index 0000000000000..6a4235f68abb4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.defaults.lit.ts @@ -0,0 +1,29 @@ +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + /// !show + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'echo "Hello, CodeBuild!"', + ], + }, + }, + }), + }); + /// !hide + } +} + +const app = new cdk.App(); + +new TestStack(app, 'codebuild-default-project'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js new file mode 100644 index 0000000000000..778337f9b66ab --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'MyImage', { + directory: path.join(__dirname, 'demo-image'), + }), + }, + /// !hide + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'test-codebuild-docker-asset'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZG9ja2VyLWFzc2V0LmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRvY2tlci1hc3NldC5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsSUFBSSxTQUFTLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxXQUFXLEVBQUU7WUFDdkMsU0FBUyxFQUFFLFNBQVMsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDO2dCQUN4QyxPQUFPLEVBQUUsS0FBSztnQkFDZCxNQUFNLEVBQUU7b0JBQ04sS0FBSyxFQUFFO3dCQUNMLFFBQVEsRUFBRSxDQUFDLElBQUksQ0FBQztxQk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iAgICAgICAgICAgIGNvbW1hbmRzOiBbJ2xzJ10sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0pLFxuICAgICAgZ3JhbnRSZXBvcnRHcm91cFBlcm1pc3Npb25zOiBmYWxzZSxcbiAgICAgIC8vLyAhc2hvd1xuICAgICAgZW52aXJvbm1lbnQ6IHtcbiAgICAgICAgYnVpbGRJbWFnZTogY29kZWJ1aWxkLkxpbnV4QnVpbGRJbWFnZS5mcm9tQXNzZXQodGhpcywgJ015SW1hZ2UnLCB7XG4gICAgICAgICAgZGlyZWN0b3J5OiBwYXRoLmpvaW4oX19kaXJuYW1lLCAnZGVtby1pbWFnZScpLFxuICAgICAgICB9KSxcbiAgICAgIH0sXG4gICAgICAvLy8gIWhpZGVcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5uZXcgVGVzdFN0YWNrKGFwcCwgJ3Rlc3QtY29kZWJ1aWxkLWRvY2tlci1hc3NldCcpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/Dockerfile diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/index.py similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/asset.73ee9c3cafd103104e2a42ee76961a90a2410d0dcad42110343c5fd85ad6db78/index.py diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/test-codebuild-docker-asset.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.ts new file mode 100644 index 0000000000000..8d30a45dabc24 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-asset.lit.ts @@ -0,0 +1,34 @@ +import * as path from 'path'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'MyImage', { + directory: path.join(__dirname, 'demo-image'), + }), + }, + /// !hide + }); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'test-codebuild-docker-asset'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js new file mode 100644 index 0000000000000..b7fa6df28ebff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const secrets = secretsmanager.Secret.fromSecretCompleteArn(this, 'MySecrets', `arn:aws:secretsmanager:${this.region}:${this.account}:secret:my-secrets-123456`); + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromDockerRegistry('my-registry/my-repo', { + secretsManagerCredentials: secrets, + }), + }, + /// !hide + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'test-codebuild-docker-asset'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZG9ja2VyLXJlZ2lzdHJ5LmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRvY2tlci1yZWdpc3RyeS5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpRUFBaUU7QUFDakUsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxPQUFPLEdBQUcsY0FBYyxDQUFDLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxJQUFJLEVBQUUsV0FBVyxFQUMzRSwwQkFBMEIsSUFBSSxDQUFDLE1BQU0sSUFBSSxJQUFJLENBQUMsT0FBTywyQkFBMkIsQ0FBQyxDQUFDO1FBRXBGLElBQUksU0FBUyxDQUFDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsV0FBVyxFQUFFO1lBQ3ZDLFNBQVMsRUFBRSxTQUFTLENBQUMsU0FBUyxDQUFDLFVBQVUsQ0FBQztnQkFDeEMsT0FBTyxFQUFFLEtBQUs7Z0JBQ2QsTUFBTSxFQUFFO29CQUNOLEtBQUssRUFBRTt3QkFDTCxRQUFRLEVBQUUsQ0FBQyxJQUFJLENBQUM7cUJBQ2pCO2lCQUNGO2FBQ0YsQ0FBQztZQUNGLDJCQUEyQixFQUFFLEtBQUs7WUFDbEMsU0FBUztZQUNULFdBQVcsRUFBRTtnQkFDWCxVQUFVLEVBQUUsU0FBUyxDQ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yb21PYmplY3Qoe1xuICAgICAgICB2ZXJzaW9uOiAnMC4yJyxcbiAgICAgICAgcGhhc2VzOiB7XG4gICAgICAgICAgYnVpbGQ6IHtcbiAgICAgICAgICAgIGNvbW1hbmRzOiBbJ2xzJ10sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0pLFxuICAgICAgZ3JhbnRSZXBvcnRHcm91cFBlcm1pc3Npb25zOiBmYWxzZSxcbiAgICAgIC8vLyAhc2hvd1xuICAgICAgZW52aXJvbm1lbnQ6IHtcbiAgICAgICAgYnVpbGRJbWFnZTogY29kZWJ1aWxkLkxpbnV4QnVpbGRJbWFnZS5mcm9tRG9ja2VyUmVnaXN0cnkoJ215LXJlZ2lzdHJ5L215LXJlcG8nLCB7XG4gICAgICAgICAgc2VjcmV0c01hbmFnZXJDcmVkZW50aWFsczogc2VjcmV0cyxcbiAgICAgICAgfSksXG4gICAgICB9LFxuICAgICAgLy8vICFoaWRlXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IFRlc3RTdGFjayhhcHAsICd0ZXN0LWNvZGVidWlsZC1kb2NrZXItYXNzZXQnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/test-codebuild-docker-asset.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.ts new file mode 100644 index 0000000000000..535f2a2bba65b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.docker-registry.lit.ts @@ -0,0 +1,37 @@ +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const secrets = secretsmanager.Secret.fromSecretCompleteArn(this, 'MySecrets', + `arn:aws:secretsmanager:${this.region}:${this.account}:secret:my-secrets-123456`); + + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromDockerRegistry('my-registry/my-repo', { + secretsManagerCredentials: secrets, + }), + }, + /// !hide + }); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'test-codebuild-docker-asset'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js new file mode 100644 index 0000000000000..1f32bbf3993c6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ecr = require("aws-cdk-lib/aws-ecr"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const ecrRepository = new ecr.Repository(this, 'MyRepo'); + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromEcrRepository(ecrRepository, 'v1.0'), + }, + /// !hide + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'test-codebuild-docker-asset'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWNyLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmVjci5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxhQUFhLEdBQUcsSUFBSSxHQUFHLENBQUMsVUFBVSxDQUFDLElBQUksRUFBRSxRQUFRLENBQUMsQ0FBQztRQUV6RCxJQUFJLFNBQVMsQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLFdBQVcsRUFBRTtZQUN2QyxTQUFTLEVBQUUsU0FBUyxDQUFDLFNBQVMsQ0FBQyxVQUFVLENBQUM7Z0JBQ3hDLE9BQU8sRUFBRSxLQUFLO2d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VjLmZyb21PYmplY3Qoe1xuICAgICAgICB2ZXJzaW9uOiAnMC4yJyxcbiAgICAgICAgcGhhc2VzOiB7XG4gICAgICAgICAgYnVpbGQ6IHtcbiAgICAgICAgICAgIGNvbW1hbmRzOiBbJ2xzJ10sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIH0pLFxuICAgICAgZ3JhbnRSZXBvcnRHcm91cFBlcm1pc3Npb25zOiBmYWxzZSxcbiAgICAgIC8vLyAhc2hvd1xuICAgICAgZW52aXJvbm1lbnQ6IHtcbiAgICAgICAgYnVpbGRJbWFnZTogY29kZWJ1aWxkLkxpbnV4QnVpbGRJbWFnZS5mcm9tRWNyUmVwb3NpdG9yeShlY3JSZXBvc2l0b3J5LCAndjEuMCcpLFxuICAgICAgfSxcbiAgICAgIC8vLyAhaGlkZVxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBUZXN0U3RhY2soYXBwLCAndGVzdC1jb2RlYnVpbGQtZG9ja2VyLWFzc2V0Jyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/test-codebuild-docker-asset.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.ts new file mode 100644 index 0000000000000..43ee2c075fe04 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.ecr.lit.ts @@ -0,0 +1,34 @@ +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const ecrRepository = new ecr.Repository(this, 'MyRepo'); + + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromEcrRepository(ecrRepository, 'v1.0'), + }, + /// !hide + }); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'test-codebuild-docker-asset'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js new file mode 100644 index 0000000000000..a4810e87cf6a6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const source = codebuild.Source.gitHub({ + owner: 'aws', + repo: 'aws-cdk', + reportBuildStatus: false, + webhook: true, + webhookTriggersBatchBuild: true, + webhookFilters: [ + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH), + ], + }); + new codebuild.Project(this, 'MyProject', { + source, + grantReportGroupPermissions: false, + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'test-codebuild-github-webhook-batch'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2l0aHViLXdlYmhvb2stYmF0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5naXRodWItd2ViaG9vay1iYXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyx1REFBdUQ7QUFFdkQsTUFBTSxTQUFVLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDL0IsWUFBWSxLQUFjLEVBQUUsRUFBVTtRQUNwQyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sTUFBTSxHQUFHLFNBQVMsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO1lBQ3JDLEtBQUssRUFBRSxLQUFLO1lBQ1osSUFBSSxFQUFFLFNBQVM7WUFDZixpQkFBaUIsRUFBRSxLQUFLO1lBQ3hCLE9BQU8sRUFBRSxJQUFJO1lBQ2IseUJBQXlCLEVBQUUsSUFBSTtZQUMvQixjQUFjLEVBQUU7Z0JBQ2QsU0FBUyxDQUFDLFdBQVcsQ0FBQyxTQUFTLENBQUMsU0FBUyxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUM7YUFDNUQ7U0FDRixDQUFDLENBQUM7UUFDSCxJQUFJLFNBQVMsQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLFdBQVcsRUFBRTtZQUN2QyxNQUFNO1lBQ04sMkJBQTJCLEVBQUUsS0FBSztTQUNuQ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wID0gbmV3IGNkay5BcHAoKTtcblxubmV3IFRlc3RTdGFjayhhcHAsICd0ZXN0LWNvZGVidWlsZC1naXRodWItd2ViaG9vay1iYXRjaCcpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/test-codebuild-github-webhook-batch.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.ts similarity index 86% rename from packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.ts index d8fd006956035..903dc3c75074d 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-batch.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js new file mode 100644 index 0000000000000..8e4e43789bf0a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const source = codebuild.Source.gitHub({ + owner: 'aws', + repo: 'aws-cdk', + reportBuildStatus: false, + }); + new codebuild.Project(this, 'MyProject', { + source, + grantReportGroupPermissions: false, + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'test-codebuild-github'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2l0aHViLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ2l0aHViLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxNQUFNLEdBQUcsU0FBUyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUM7WUFDckMsS0FBSyxFQUFFLEtBQUs7WUFDWixJQUFJLEVBQUUs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YWNrKGFwcCwgJ3Rlc3QtY29kZWJ1aWxkLWdpdGh1YicpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/test-codebuild-github.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.ts similarity index 82% rename from packages/@aws-cdk/aws-codebuild/test/integ.github.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.ts index e41cc722c0065..3dfe1697d44f6 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.github.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js new file mode 100644 index 0000000000000..39c9f34a022b6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js @@ -0,0 +1,23 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'path/to/my/source.zip', + }), + environment: { + computeType: codebuild.ComputeType.LARGE, + }, + grantReportGroupPermissions: false, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC1idWNrZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm9qZWN0LWJ1Y2tldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG1CQUFtQixDQUFDLENBQUM7QUFFdEQsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDOUMsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztDQUN6QyxDQUFDLENBQUM7QUFFSCxJQUFJLFNBQVMsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLFdBQVcsRUFBRTtJQUN4QyxNQUFNLEVBQUUsU0FB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mFsc2UsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/aws-cdk-codebuild.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.ts similarity index 77% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.ts index e78655e82f823..19a60b87a8ecc 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-bucket.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js new file mode 100644 index 0000000000000..f778d8fb49aca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-buildspec-artifact-name'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + grantReportGroupPermissions: false, + artifacts: codebuild.Artifacts.s3({ + bucket, + includeBuildId: false, + packageZip: true, + path: 'another/path', + identifier: 'AddArtifact1', + }), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC1idWlsZHNwZWMtYXJ0aWZhY3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucHJvamVjdC1idWlsZHNwZWMtYXJ0aWZhY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyx1REFBdUQ7QUFFdkQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSwyQ0FBMkMsQ0FBQyxDQUFDO0FBRTlF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b2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG59KTtcblxubmV3IGNvZGVidWlsZC5Qcm9qZWN0KHN0YWNrLCAnTXlQcm9qZWN0Jywge1xuICBidWlsZFNwZWM6IGNvZGVidWlsZC5CdWlsZFNwZWMuZnJvbU9iamVjdCh7XG4gICAgdmVyc2lvbjogJzAuMicsXG4gIH0pLFxuICBncmFudFJlcG9ydEdyb3VwUGVybWlzc2lvbnM6IGZhbHNlLFxuICBhcnRpZmFjdHM6XG4gICAgY29kZWJ1aWxkLkFydGlmYWN0cy5zMyh7XG4gICAgICBidWNrZXQsXG4gICAgICBpbmNsdWRlQnVpbGRJZDogZmFsc2UsXG4gICAgICBwYWNrYWdlWmlwOiB0cnVlLFxuICAgICAgcGF0aDogJ2Fub3RoZXIvcGF0aCcsXG4gICAgICBpZGVudGlmaWVyOiAnQWRkQXJ0aWZhY3QxJyxcbiAgICB9KSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/aws-cdk-codebuild-buildspec-artifact-name.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.ts similarity index 80% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.ts index b72b25271086e..5f8dfd67ef437 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-buildspec-artifacts.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js new file mode 100644 index 0000000000000..cefa2d8038100 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-file-system-locations'); +const vpc = new ec2.Vpc(stack, 'MyVPC', { + maxAzs: 1, + natGateways: 1, +}); +const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { + allowAllOutbound: true, + description: 'Example', + securityGroupName: 'Jane', + vpc, +}); +new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + environment: { + privileged: true, + }, + vpc, + securityGroups: [securityGroup], + fileSystemLocations: [codebuild.FileSystemLocation.efs({ + identifier: 'myidentifier', + location: `fs-c8d04839.efs.${cdk.Aws.REGION}.amazonaws.com:/mnt`, + mountOptions: 'nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2', + mountPoint: '/media', + })], + grantReportGroupPermissions: false, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC1maWxlLXN5c3RlbS1sb2NhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnByb2plY3QtZmlsZS1zeXN0ZW0tbG9jYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHlDQUF5QyxDQUFDLENBQUM7QUFDNUUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUU7SUFDdEMsTUFBTSxFQUFFLENBQUM7SUFDVCxXQUFXLEVBQUUsQ0FB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plPTEwNDg1NzYsaGFyZCx0aW1lbz02MDAscmV0cmFucz0yJyxcbiAgICBtb3VudFBvaW50OiAnL21lZGlhJyxcbiAgfSldLFxuICBncmFudFJlcG9ydEdyb3VwUGVybWlzc2lvbnM6IGZhbHNlLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/aws-cdk-codebuild-file-system-locations.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.ts similarity index 86% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.ts index ebfe3c5c803f0..6896907362c9d 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-file-system-location.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js new file mode 100644 index 0000000000000..8b9d08bdd8e1a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const logs = require("aws-cdk-lib/aws-logs"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-logging'); +new codebuild.PipelineProject(stack, 'Project', { + logging: { + cloudWatch: { + logGroup: new logs.LogGroup(stack, 'LogingGroup', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + }, + s3: { + bucket: new s3.Bucket(stack, 'LoggingBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + }, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC1sb2dnaW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucHJvamVjdC1sb2dnaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQTZDO0FBQzdDLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsdURBQXVEO0FBRX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xkLWxvZ2dpbmcnKTtcblxubmV3IGNvZGVidWlsZC5QaXBlbGluZVByb2plY3Qoc3RhY2ssICdQcm9qZWN0Jywge1xuICBsb2dnaW5nOiB7XG4gICAgY2xvdWRXYXRjaDoge1xuICAgICAgbG9nR3JvdXA6IG5ldyBsb2dzLkxvZ0dyb3VwKHN0YWNrLCAnTG9naW5nR3JvdXAnLCB7XG4gICAgICAgIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gICAgICB9KSxcbiAgICB9LFxuICAgIHMzOiB7XG4gICAgICBidWNrZXQ6IG5ldyBzMy5CdWNrZXQoc3RhY2ssICdMb2dnaW5nQnVja2V0Jywge1xuICAgICAgICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICAgICAgfSksXG4gICAgfSxcbiAgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/aws-cdk-codebuild-logging.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-logging.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.ts new file mode 100644 index 0000000000000..d9a072966ac1a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-logging.ts @@ -0,0 +1,25 @@ +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-logging'); + +new codebuild.PipelineProject(stack, 'Project', { + logging: { + cloudWatch: { + logGroup: new logs.LogGroup(stack, 'LogingGroup', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + }, + s3: { + bucket: new s3.Bucket(stack, 'LoggingBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + }, + }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js new file mode 100644 index 0000000000000..eda384c7b1dc1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-project-vpc'); +const project = new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['echo "Nothing to do!"'], + }, + }, + }), +}); +const target = new sns.Topic(stack, 'MyTopic'); +project.notifyOnBuildSucceeded('NotifyOnBuildS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GliL2F3cy1zbnMnO1xuaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCAqIGFzIGNvZGVidWlsZCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY29kZWJ1aWxkJztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1jZGstY29kZWJ1aWxkLXByb2plY3QtdnBjJyk7XG5cbmNvbnN0IHByb2plY3QgPSBuZXcgY29kZWJ1aWxkLlByb2plY3Qoc3RhY2ssICdNeVByb2plY3QnLCB7XG4gIGJ1aWxkU3BlYzogY29kZWJ1aWxkLkJ1aWxkU3BlYy5mcm9tT2JqZWN0KHtcbiAgICB2ZXJzaW9uOiAnMC4yJyxcbiAgICBwaGFzZXM6IHtcbiAgICAgIGJ1aWxkOiB7XG4gICAgICAgIGNvbW1hbmRzOiBbJ2VjaG8gXCJOb3RoaW5nIHRvIGRvIVwiJ10sXG4gICAgICB9LFxuICAgIH0sXG4gIH0pLFxufSk7XG5cbmNvbnN0IHRhcmdldCA9IG5ldyBzbnMuVG9waWMoc3RhY2ssICdNeVRvcGljJyk7XG5cbnByb2plY3Qubm90aWZ5T25CdWlsZFN1Y2NlZWRlZCgnTm90aWZ5T25CdWlsZFN1Y2NlZWRlZCcsIHRhcmdldCk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/aws-cdk-codebuild-project-vpc.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.ts similarity index 77% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-notification.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.ts index 9159a1e61fc32..477ec7363867d 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-notification.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js new file mode 100644 index 0000000000000..c57f23ff06f91 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-secondary-sources-artifacts'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + secondarySources: [ + codebuild.Source.s3({ + bucket, + path: 'some/path', + identifier: 'AddSource1', + }), + ], + secondaryArtifacts: [ + codebuild.Artifacts.s3({ + bucket, + path: 'another/path', + name: 'name', + identifier: 'AddArtifact1', + }), + ], + grantReportGroupPermissions: false, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC1zZWNvbmRhcnktc291cmNlcy1hcnRpZmFjdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm9qZWN0LXNlY29uZGFyeS1zb3VyY2VzLWFydGlmYWN0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsdURBQXVEO0FBRXZELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsK0NBQStDLENBQUMsQ0FBQztBQUVsRixNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUM5QyxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksU0FBUyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsV0FBVyxFQUFFO0l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9qZWN0KHN0YWNrLCAnTXlQcm9qZWN0Jywge1xuICBidWlsZFNwZWM6IGNvZGVidWlsZC5CdWlsZFNwZWMuZnJvbU9iamVjdCh7XG4gICAgdmVyc2lvbjogJzAuMicsXG4gIH0pLFxuICBzZWNvbmRhcnlTb3VyY2VzOiBbXG4gICAgY29kZWJ1aWxkLlNvdXJjZS5zMyh7XG4gICAgICBidWNrZXQsXG4gICAgICBwYXRoOiAnc29tZS9wYXRoJyxcbiAgICAgIGlkZW50aWZpZXI6ICdBZGRTb3VyY2UxJyxcbiAgICB9KSxcbiAgXSxcbiAgc2Vjb25kYXJ5QXJ0aWZhY3RzOiBbXG4gICAgY29kZWJ1aWxkLkFydGlmYWN0cy5zMyh7XG4gICAgICBidWNrZXQsXG4gICAgICBwYXRoOiAnYW5vdGhlci9wYXRoJyxcbiAgICAgIG5hbWU6ICduYW1lJyxcbiAgICAgIGlkZW50aWZpZXI6ICdBZGRBcnRpZmFjdDEnLFxuICAgIH0pLFxuICBdLFxuICBncmFudFJlcG9ydEdyb3VwUGVybWlzc2lvbnM6IGZhbHNlLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/aws-cdk-codebuild-secondary-sources-artifacts.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.ts similarity index 83% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.ts index cc552733c7912..e3f22351aecb8 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-secondary-sources-artifacts.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js new file mode 100644 index 0000000000000..26a9b77baaaea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js @@ -0,0 +1,33 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-project-vpc'); +const vpc = new ec2.Vpc(stack, 'MyVPC', { + maxAzs: 1, + natGateways: 1, +}); +const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { + allowAllOutbound: true, + description: 'Example', + securityGroupName: 'Bob', + vpc, +}); +new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['echo "Nothing to do!"'], + }, + }, + }), + grantReportGroupPermissions: false, + securityGroups: [securityGroup], + vpc, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC12cGMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm9qZWN0LXZwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLHVEQUF1RDtBQUV2RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLCtCQUErQixDQUFDLENBQUM7QUFDbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUU7SUFDdEMsTUFBTSxFQUFFLENBQUM7SUFDVCxXQUFXLEVBQUUsQ0FBQztDQUNmLENBQUMsQ0FBQ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1xuICBtYXhBenM6IDEsXG4gIG5hdEdhdGV3YXlzOiAxLFxufSk7XG5jb25zdCBzZWN1cml0eUdyb3VwID0gbmV3IGVjMi5TZWN1cml0eUdyb3VwKHN0YWNrLCAnU2VjdXJpdHlHcm91cDEnLCB7XG4gIGFsbG93QWxsT3V0Ym91bmQ6IHRydWUsXG4gIGRlc2NyaXB0aW9uOiAnRXhhbXBsZScsXG4gIHNlY3VyaXR5R3JvdXBOYW1lOiAnQm9iJyxcbiAgdnBjLFxufSk7XG5uZXcgY29kZWJ1aWxkLlByb2plY3Qoc3RhY2ssICdNeVByb2plY3QnLCB7XG4gIGJ1aWxkU3BlYzogY29kZWJ1aWxkLkJ1aWxkU3BlYy5mcm9tT2JqZWN0KHtcbiAgICB2ZXJzaW9uOiAnMC4yJyxcbiAgICBwaGFzZXM6IHtcbiAgICAgIGJ1aWxkOiB7XG4gICAgICAgIGNvbW1hbmRzOiBbJ2VjaG8gXCJOb3RoaW5nIHRvIGRvIVwiJ10sXG4gICAgICB9LFxuICAgIH0sXG4gIH0pLFxuICBncmFudFJlcG9ydEdyb3VwUGVybWlzc2lvbnM6IGZhbHNlLFxuICBzZWN1cml0eUdyb3VwczogW3NlY3VyaXR5R3JvdXBdLFxuICB2cGMsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/aws-cdk-codebuild-project-vpc.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.ts similarity index 82% rename from packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.ts index 1e0b9cc2bc424..2d0203ad0231f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-vpc.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js new file mode 100644 index 0000000000000..1040ec6291394 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-report-group'); +const reportGroupCodeCoverage = new codebuild.ReportGroup(stack, 'CoverageReportGroup', { + type: codebuild.ReportGroupType.CODE_COVERAGE, +}); +const reportGroupTest = new codebuild.ReportGroup(stack, 'TestReportGroup', { + type: codebuild.ReportGroupType.TEST, +}); +const project = new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['echo "Nothing to do!"'], + }, + }, + reports: { + [reportGroupTest.reportGroupArn]: { + 'base-directory': 'test-reports', + 'file-format': 'JUNITXML', + 'files': [ + '**/*', + ], + }, + [reportGroupCodeCoverage.reportGroupArn]: { + 'base-directory': 'coverage', + 'file-format': 'CLOVERXML', + 'files': ['clover.xml'], + }, + }, + }), + grantReportGroupPermissions: false, +}); +reportGroupCodeCoverage.grantWrite(project); +reportGroupTest.grantWrite(project); +new integ.IntegTest(app, 'ReportGroupIntegTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVwb3J0LWdyb3VwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucmVwb3J0LWdyb3VwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCx1REFBdUQ7QUFFdkQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxzQkFBc0IsQ0FBQyxDQUFDO0FBRXpELE1BQU0sdUJBQXVCLEdBQUcsSUFBSSxTQUFTLENBQUMsV0FBVyxDQUFDLEtBQUssRUFBRSxxQkFBcUIsRUFBRTtJQUN0RixJQUFJLEVBQUUsU0FBUyxDQUFDLGVBQWUsQ0FBQyxhQUFhO0NBQzlDLENBQUMsQ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CJOb3RoaW5nIHRvIGRvIVwiJ10sXG4gICAgICB9LFxuICAgIH0sXG4gICAgcmVwb3J0czoge1xuICAgICAgW3JlcG9ydEdyb3VwVGVzdC5yZXBvcnRHcm91cEFybl06IHtcbiAgICAgICAgJ2Jhc2UtZGlyZWN0b3J5JzogJ3Rlc3QtcmVwb3J0cycsXG4gICAgICAgICdmaWxlLWZvcm1hdCc6ICdKVU5JVFhNTCcsXG4gICAgICAgICdmaWxlcyc6IFtcbiAgICAgICAgICAnKiovKicsXG4gICAgICAgIF0sXG4gICAgICB9LFxuICAgICAgW3JlcG9ydEdyb3VwQ29kZUNvdmVyYWdlLnJlcG9ydEdyb3VwQXJuXToge1xuICAgICAgICAnYmFzZS1kaXJlY3RvcnknOiAnY292ZXJhZ2UnLFxuICAgICAgICAnZmlsZS1mb3JtYXQnOiAnQ0xPVkVSWE1MJyxcbiAgICAgICAgJ2ZpbGVzJzogWydjbG92ZXIueG1sJ10sXG4gICAgICB9LFxuICAgIH0sXG4gIH0pLFxuICBncmFudFJlcG9ydEdyb3VwUGVybWlzc2lvbnM6IGZhbHNlLFxufSk7XG5yZXBvcnRHcm91cENvZGVDb3ZlcmFnZS5ncmFudFdyaXRlKHByb2plY3QpO1xucmVwb3J0R3JvdXBUZXN0LmdyYW50V3JpdGUocHJvamVjdCk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnUmVwb3J0R3JvdXBJbnRlZ1Rlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/aws-cdk-report-group.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.ts similarity index 88% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.ts index 740d220c40ee0..837a869ed45b9 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.report-group.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as codebuild from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/asset-test.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/asset-test.zip new file mode 100644 index 0000000000000..1558a9215026d Binary files /dev/null and b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/asset-test.zip differ diff --git a/packages/@aws-cdk/aws-codecommit/test/asset-test/test.md b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/asset-test/test.md similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/asset-test/test.md rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/asset-test/test.md diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js new file mode 100644 index 0000000000000..1fc4ef5066e33 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const aws_codecommit_1 = require("aws-cdk-lib/aws-codecommit"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codecommit-repo-contents-zip-file'); +new codecommit.Repository(stack, 'Repo', { + repositoryName: 'aws-cdk-codecommit-repo-contents-zip-file', + code: aws_codecommit_1.Code.fromZipFile('./asset-test.zip'), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29kZWNvbW1pdC1jb2RlLWFzc2V0LXppcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNvZGVjb21taXQtY29kZS1hc3NldC16aXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMseURBQXlEO0FBQ3pELCtEQUFrRDtBQUVsRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDJDQUEyQyxDQUFDLENBQUM7QUFFOUUsSUFBSSxVQUFVLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUU7SUFDdkMsY0FBYyxFQUFFLDJDQUEyQztJQUMzRCxJQUFJLEVBQUUscUJBQUksQ0FBQyxXQUFXLENBQUMsa0JBQWtCLENBQUM7Q0FDM0MsQ0FBQyxDQUFDO0FBRUgsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCAqIGFzIGNvZGVjb21taXQgZnJvbSAnYXdzLWNkay1saWIvYXdzLWNvZGVjb21taXQnO1xuaW1wb3J0IHsgQ29kZSB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1jb2RlY29tbWl0JztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtY2RrLWNvZGVjb21taXQtcmVwby1jb250ZW50cy16aXAtZmlsZScpO1xuXG5uZXcgY29kZWNvbW1pdC5SZXBvc2l0b3J5KHN0YWNrLCAnUmVwbycsIHtcbiAgcmVwb3NpdG9yeU5hbWU6ICdhd3MtY2RrLWNvZGVjb21taXQtcmVwby1jb250ZW50cy16aXAtZmlsZScsXG4gIGNvZGU6IENvZGUuZnJvbVppcEZpbGUoJy4vYXNzZXQtdGVzdC56aXAnKSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/asset.ea7c70c09e0d23ef6105931ee931effc8b607184343aebf5e45e972807b3fc18.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/asset.ea7c70c09e0d23ef6105931ee931effc8b607184343aebf5e45e972807b3fc18.zip similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/asset.ea7c70c09e0d23ef6105931ee931effc8b607184343aebf5e45e972807b3fc18.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/asset.ea7c70c09e0d23ef6105931ee931effc8b607184343aebf5e45e972807b3fc18.zip diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.assets.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.template.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/aws-cdk-codecommit-repo-contents-zip-file.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.ts new file mode 100644 index 0000000000000..142c8305bcba1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset-zip.ts @@ -0,0 +1,13 @@ +import * as cdk from 'aws-cdk-lib'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import { Code } from 'aws-cdk-lib/aws-codecommit'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codecommit-repo-contents-zip-file'); + +new codecommit.Repository(stack, 'Repo', { + repositoryName: 'aws-cdk-codecommit-repo-contents-zip-file', + code: Code.fromZipFile('./asset-test.zip'), +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js new file mode 100644 index 0000000000000..de85e5736a70d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const aws_codecommit_1 = require("aws-cdk-lib/aws-codecommit"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codecommit-repo-contents-assets'); +new codecommit.Repository(stack, 'Repo', { + repositoryName: 'aws-cdk-codecommit-repo-contents-assets', + code: aws_codecommit_1.Code.fromDirectory('./asset-test'), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29kZWNvbW1pdC1jb2RlLWFzc2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY29kZWNvbW1pdC1jb2RlLWFzc2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUN6RCwrREFBa0Q7QUFFbEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx5Q0FBeUMsQ0FBQyxDQUFDO0FBRTVFLElBQUksVUFBVSxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFO0lBQ3ZDLGNBQWMsRUFBRSx5Q0FBeUM7SUFDekQsSUFBSSxFQUFFLHFCQUFJLENBQUMsYUFBYSxDQUFDLGNBQWMsQ0FBQztDQUN6QyxDQUFDLENBQUM7QUFFSCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgY29kZWNvbW1pdCBmcm9tICdhd3MtY2RrLWxpYi9hd3MtY29kZWNvbW1pdCc7XG5pbXBvcnQgeyBDb2RlIH0gZnJvbSAnYXdzLWNkay1saWIvYXdzLWNvZGVjb21taXQnO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1jZGstY29kZWNvbW1pdC1yZXBvLWNvbnRlbnRzLWFzc2V0cycpO1xuXG5uZXcgY29kZWNvbW1pdC5SZXBvc2l0b3J5KHN0YWNrLCAnUmVwbycsIHtcbiAgcmVwb3NpdG9yeU5hbWU6ICdhd3MtY2RrLWNvZGVjb21taXQtcmVwby1jb250ZW50cy1hc3NldHMnLFxuICBjb2RlOiBDb2RlLmZyb21EaXJlY3RvcnkoJy4vYXNzZXQtdGVzdCcpLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/asset.32b8e8a8b79a84deb31e4d456dbcf3e40937f201633ae38c9e90e15b82084ae3/test.md b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/asset.32b8e8a8b79a84deb31e4d456dbcf3e40937f201633ae38c9e90e15b82084ae3/test.md similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/asset.32b8e8a8b79a84deb31e4d456dbcf3e40937f201633ae38c9e90e15b82084ae3/test.md rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/asset.32b8e8a8b79a84deb31e4d456dbcf3e40937f201633ae38c9e90e15b82084ae3/test.md diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.assets.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.template.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/aws-cdk-codecommit-repo-contents-assets.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.ts new file mode 100644 index 0000000000000..4f28f497c1a36 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-code-asset.ts @@ -0,0 +1,13 @@ +import * as cdk from 'aws-cdk-lib'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import { Code } from 'aws-cdk-lib/aws-codecommit'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codecommit-repo-contents-assets'); + +new codecommit.Repository(stack, 'Repo', { + repositoryName: 'aws-cdk-codecommit-repo-contents-assets', + code: Code.fromDirectory('./asset-test'), +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js new file mode 100644 index 0000000000000..9517793da00aa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codecommit-events'); +const repo = new codecommit.Repository(stack, 'Repo', { + repositoryName: 'aws-cdk-codecommit-events', +}); +const topic = new sns.Topic(stack, 'MyTopic'); +// we can't use @aws-cdk/aws-events-targets.SnsTopic here because it will +// create a cyclic dependency with codebuild, so we just fake it +repo.onReferenceCreated('OnReferenceCreated', { + target: { + bind: () => ({ + arn: topic.topicArn, + id: '', + }), + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29kZWNvbW1pdC1ldmVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jb2RlY29tbWl0LWV2ZW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMseURBQXlEO0FBRXpELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMkJBQTJCLENBQUMsQ0FBQztBQUU5RCxNQUFNLElBQUksR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRTtJQUNwRCxjQUFjLEVBQUUsMkJBQTJCO0NBQzVDLENBQUMsQ0FBQzt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GEgY3ljbGljIGRlcGVuZGVuY3kgd2l0aCBjb2RlYnVpbGQsIHNvIHdlIGp1c3QgZmFrZSBpdFxucmVwby5vblJlZmVyZW5jZUNyZWF0ZWQoJ09uUmVmZXJlbmNlQ3JlYXRlZCcsIHtcbiAgdGFyZ2V0OiB7XG4gICAgYmluZDogKCkgPT4gKHtcbiAgICAgIGFybjogdG9waWMudG9waWNBcm4sXG4gICAgICBpZDogJycsXG4gICAgfSksXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.assets.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.template.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/aws-cdk-codecommit-events.template.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.ts similarity index 79% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.ts index 9429459a4a909..a895a4e9782f8 100644 --- a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.codecommit-events.ts @@ -1,6 +1,6 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as codecommit from '../lib'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-codecommit-events'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js new file mode 100644 index 0000000000000..625e5ad1d7dc8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codecommit'); +const repository = new codecommit.Repository(stack, 'MyCodecommitRepository', { + repositoryName: 'my-test-repository', +}); +const target = new sns.Topic(stack, 'MyTopic'); +repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); +repository.notifyOnPullRequestMerged('NotifyOnPullRequestMerged', target); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVwb3NpdG9yeS1ub3RpZmljYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5yZXBvc2l0b3J5LW5vdGlmaWNhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs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vcnkoc3RhY2ssICdNeUNvZGVjb21taXRSZXBvc2l0b3J5Jywge1xuICByZXBvc2l0b3J5TmFtZTogJ215LXRlc3QtcmVwb3NpdG9yeScsXG59KTtcblxuY29uc3QgdGFyZ2V0ID0gbmV3IHNucy5Ub3BpYyhzdGFjaywgJ015VG9waWMnKTtcblxucmVwb3NpdG9yeS5ub3RpZnlPblB1bGxSZXF1ZXN0Q3JlYXRlZCgnTm90aWZ5T25QdWxsUmVxdWVzdENyZWF0ZWQnLCB0YXJnZXQpO1xucmVwb3NpdG9yeS5ub3RpZnlPblB1bGxSZXF1ZXN0TWVyZ2VkKCdOb3RpZnlPblB1bGxSZXF1ZXN0TWVyZ2VkJywgdGFyZ2V0KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.assets.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.template.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/aws-cdk-codecommit.template.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.ts similarity index 76% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.ts index 9e61f82141178..5faa82b6d2c84 100644 --- a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codecommit/test/integ.repository-notification.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as codecommit from '../lib'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js new file mode 100644 index 0000000000000..f1952a9ced06c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-ecs-config'); +new codedeploy.EcsDeploymentConfig(stack, 'LinearConfig', { + trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), +}); +new integ.IntegTest(app, 'EcsDeploymentConfigTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwbG95bWVudC1jb25maWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kZXBsb3ltZW50LWNvbmZp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gY29kZWRlcGxveS5FY3NEZXBsb3ltZW50Q29uZmlnKHN0YWNrLCAnTGluZWFyQ29uZmlnJywge1xuICB0cmFmZmljUm91dGluZzogY29kZWRlcGxveS5UcmFmZmljUm91dGluZy50aW1lQmFzZWRMaW5lYXIoe1xuICAgIGludGVydmFsOiBjZGsuRHVyYXRpb24ubWludXRlcygxKSxcbiAgICBwZXJjZW50YWdlOiA1LFxuICB9KSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ0Vjc0RlcGxveW1lbnRDb25maWdUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/EcsDeploymentConfigTestDefaultTestDeployAssertA6573788.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-ecs-config.template.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.codecommit-events.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.ts new file mode 100644 index 0000000000000..a6ca520f4f94b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-config.ts @@ -0,0 +1,19 @@ +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-ecs-config'); + +new codedeploy.EcsDeploymentConfig(stack, 'LinearConfig', { + trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), +}); + +new integ.IntegTest(app, 'EcsDeploymentConfigTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js new file mode 100644 index 0000000000000..a1b5dd0fa5641 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js @@ -0,0 +1,216 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +/** + * Follow these instructions to manually test running a CodeDeploy deployment with the resources provisioned in this stack: + * + * 1. Deploy the stack: +``` +$ cdk deploy --app 'node integ.deployment-group.js' aws-cdk-codedeploy-ecs-dg +``` + * + * 2. Create a file called `appspec.json` with the following contents, replacing the placeholders with output values from the deployed stack: +``` +{ + "version": 0.0, + "Resources": [ + { + "TargetService": { + "Type": "AWS::ECS::Service", + "Properties": { + "TaskDefinition": "", + "LoadBalancerInfo": { + "ContainerName": "Container", + "ContainerPort": 80 + }, + "PlatformVersion": "LATEST", + "NetworkConfiguration": { + "awsvpcConfiguration": { + "subnets": [ + "", + "", + ], + "securityGroups": [ + "" + ], + "assignPublicIp": "DISABLED" + } + } + } + } + } + ] +} +``` + * + * 3. Start the deployment: +``` +$ appspec=$(jq -R -s '.' < appspec.json | sed 's/\\n//g') +$ aws deploy create-deployment \ + --application-name \ + --deployment-group-name \ + --description "AWS CDK integ test" \ + --revision revisionType=AppSpecContent,appSpecContent={content="$appspec"} +``` + * + * 4. Wait for the deployment to complete successfully, providing the deployment ID from the previous step: +``` +$ aws deploy wait deployment-successful --deployment-id +``` + * + * 5. Destroy the stack: +``` +$ cdk destroy --app 'node integ.deployment-group.js' aws-cdk-codedeploy-ecs-dg +``` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-ecs-dg'); +// Network infrastructure +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); +// ECS service +const cluster = new ecs.Cluster(stack, 'EcsCluster', { + vpc, +}); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('Container', { + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), + portMappings: [{ containerPort: 80 }], +}); +const service = new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + deploymentController: { + type: ecs.DeploymentControllerType.CODE_DEPLOY, + }, +}); +// A second task definition for testing a CodeDeploy deployment of the ECS service to a new task definition +const taskDefinition2 = new ecs.FargateTaskDefinition(stack, 'TaskDef2'); +taskDefinition2.addContainer('Container', { + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), + portMappings: [{ containerPort: 80 }], +}); +service.node.addDependency(taskDefinition2); +// Load balancer +const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'ServiceLB', { + vpc, + internetFacing: false, +}); +// Listeners +const prodListener = loadBalancer.addListener('ProdListener', { + port: 80, + protocol: elbv2.ApplicationProtocol.HTTP, +}); +const testListener = loadBalancer.addListener('TestListener', { + port: 9002, + protocol: elbv2.ApplicationProtocol.HTTP, +}); +// Target groups +const blueTG = prodListener.addTargets('BlueTG', { + port: 80, + protocol: elbv2.ApplicationProtocol.HTTP, + targets: [ + service.loadBalancerTarget({ + containerName: 'Container', + containerPort: 80, + }), + ], + deregistrationDelay: cdk.Duration.seconds(30), + healthCheck: { + interval: cdk.Duration.seconds(5), + healthyHttpCodes: '200', + healthyThresholdCount: 2, + unhealthyThresholdCount: 3, + timeout: cdk.Duration.seconds(4), + }, +}); +const greenTG = new elbv2.ApplicationTargetGroup(stack, 'GreenTG', { + vpc, + port: 80, + protocol: elbv2.ApplicationProtocol.HTTP, + targetType: elbv2.TargetType.IP, + deregistrationDelay: cdk.Duration.seconds(30), + healthCheck: { + interval: cdk.Duration.seconds(5), + healthyHttpCodes: '200', + healthyThresholdCount: 2, + unhealthyThresholdCount: 3, + timeout: cdk.Duration.seconds(4), + }, +}); +testListener.addTargetGroups('GreenTGTest', { + targetGroups: [greenTG], +}); +prodListener.node.addDependency(greenTG); +testListener.node.addDependency(blueTG); +service.node.addDependency(testListener); +service.node.addDependency(greenTG); +// Alarms: monitor 500s and unhealthy hosts on target groups +const blueUnhealthyHosts = new cloudwatch.Alarm(stack, 'BlueUnhealthyHosts', { + alarmName: stack.stackName + '-Unhealthy-Hosts-Blue', + metric: blueTG.metricUnhealthyHostCount(), + threshold: 1, + evaluationPeriods: 2, +}); +const blueApiFailure = new cloudwatch.Alarm(stack, 'Blue5xx', { + alarmName: stack.stackName + '-Http-500-Blue', + metric: blueTG.metricHttpCodeTarget(elbv2.HttpCodeTarget.TARGET_5XX_COUNT, { period: cdk.Duration.minutes(1) }), + threshold: 1, + evaluationPeriods: 1, +}); +const greenUnhealthyHosts = new cloudwatch.Alarm(stack, 'GreenUnhealthyHosts', { + alarmName: stack.stackName + '-Unhealthy-Hosts-Green', + metric: greenTG.metricUnhealthyHostCount(), + threshold: 1, + evaluationPeriods: 2, +}); +const greenApiFailure = new cloudwatch.Alarm(stack, 'Green5xx', { + alarmName: stack.stackName + '-Http-500-Green', + metric: greenTG.metricHttpCodeTarget(elbv2.HttpCodeTarget.TARGET_5XX_COUNT, { period: cdk.Duration.minutes(1) }), + threshold: 1, + evaluationPeriods: 1, +}); +// Deployment group +const deploymentConfig = new codedeploy.EcsDeploymentConfig(stack, 'CanaryConfig', { + trafficRouting: codedeploy.TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 20, + }), +}); +const dg = new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + alarms: [ + blueUnhealthyHosts, + blueApiFailure, + greenUnhealthyHosts, + greenApiFailure, + ], + service, + blueGreenDeploymentConfig: { + blueTargetGroup: blueTG, + greenTargetGroup: greenTG, + listener: prodListener, + testListener, + terminationWaitTime: cdk.Duration.minutes(1), + }, + deploymentConfig, + autoRollback: { + stoppedDeployment: true, + }, +}); +// Outputs to use for manual testing +new cdk.CfnOutput(stack, 'NewTaskDefinition', { value: taskDefinition2.taskDefinitionArn }); +new cdk.CfnOutput(stack, 'Subnet1Id', { value: vpc.privateSubnets[0].subnetId }); +new cdk.CfnOutput(stack, 'Subnet2Id', { value: vpc.privateSubnets[1].subnetId }); +new cdk.CfnOutput(stack, 'SecurityGroupId', { value: service.connections.securityGroups[0].securityGroupId }); +new cdk.CfnOutput(stack, 'CodeDeployApplicationName', { value: dg.application.applicationName }); +new cdk.CfnOutput(stack, 'CodeDeployDeploymentGroupName', { value: dg.deploymentGroupName }); +new integ.IntegTest(app, 'EcsDeploymentGroupTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwbG95bWVudC1ncm91cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRlcGxveW1lbnQtZ3JvdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5REFBeUQ7QUFDekQsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxnRUFBZ0U7QUFDaEUsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCx5REF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XG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0NvZGVEZXBsb3lEZXBsb3ltZW50R3JvdXBOYW1lJywgeyB2YWx1ZTogZGcuZGVwbG95bWVudEdyb3VwTmFtZSB9KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdFY3NEZXBsb3ltZW50R3JvdXBUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/EcsDeploymentGroupTestDefaultTestDeployAssert60AABFA0.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-ecs-dg.template.json diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/integ.repository-notification.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.ts new file mode 100644 index 0000000000000..8c49227a10a36 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/ecs/integ.deployment-group.ts @@ -0,0 +1,239 @@ +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; + +/** + * Follow these instructions to manually test running a CodeDeploy deployment with the resources provisioned in this stack: + * + * 1. Deploy the stack: +``` +$ cdk deploy --app 'node integ.deployment-group.js' aws-cdk-codedeploy-ecs-dg +``` + * + * 2. Create a file called `appspec.json` with the following contents, replacing the placeholders with output values from the deployed stack: +``` +{ + "version": 0.0, + "Resources": [ + { + "TargetService": { + "Type": "AWS::ECS::Service", + "Properties": { + "TaskDefinition": "", + "LoadBalancerInfo": { + "ContainerName": "Container", + "ContainerPort": 80 + }, + "PlatformVersion": "LATEST", + "NetworkConfiguration": { + "awsvpcConfiguration": { + "subnets": [ + "", + "", + ], + "securityGroups": [ + "" + ], + "assignPublicIp": "DISABLED" + } + } + } + } + } + ] +} +``` + * + * 3. Start the deployment: +``` +$ appspec=$(jq -R -s '.' < appspec.json | sed 's/\\n//g') +$ aws deploy create-deployment \ + --application-name \ + --deployment-group-name \ + --description "AWS CDK integ test" \ + --revision revisionType=AppSpecContent,appSpecContent={content="$appspec"} +``` + * + * 4. Wait for the deployment to complete successfully, providing the deployment ID from the previous step: +``` +$ aws deploy wait deployment-successful --deployment-id +``` + * + * 5. Destroy the stack: +``` +$ cdk destroy --app 'node integ.deployment-group.js' aws-cdk-codedeploy-ecs-dg +``` + */ + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-ecs-dg'); + +// Network infrastructure +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); + +// ECS service +const cluster = new ecs.Cluster(stack, 'EcsCluster', { + vpc, +}); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('Container', { + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), + portMappings: [{ containerPort: 80 }], +}); +const service = new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + deploymentController: { + type: ecs.DeploymentControllerType.CODE_DEPLOY, + }, +}); + +// A second task definition for testing a CodeDeploy deployment of the ECS service to a new task definition +const taskDefinition2 = new ecs.FargateTaskDefinition(stack, 'TaskDef2'); +taskDefinition2.addContainer('Container', { + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), + portMappings: [{ containerPort: 80 }], +}); +service.node.addDependency(taskDefinition2); + +// Load balancer +const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'ServiceLB', { + vpc, + internetFacing: false, +}); + +// Listeners +const prodListener = loadBalancer.addListener('ProdListener', { + port: 80, // port for production traffic + protocol: elbv2.ApplicationProtocol.HTTP, +}); +const testListener = loadBalancer.addListener('TestListener', { + port: 9002, // port for testing + protocol: elbv2.ApplicationProtocol.HTTP, +}); + +// Target groups +const blueTG = prodListener.addTargets('BlueTG', { + port: 80, + protocol: elbv2.ApplicationProtocol.HTTP, + targets: [ + service.loadBalancerTarget({ + containerName: 'Container', + containerPort: 80, + }), + ], + deregistrationDelay: cdk.Duration.seconds(30), + healthCheck: { + interval: cdk.Duration.seconds(5), + healthyHttpCodes: '200', + healthyThresholdCount: 2, + unhealthyThresholdCount: 3, + timeout: cdk.Duration.seconds(4), + }, +}); + +const greenTG = new elbv2.ApplicationTargetGroup(stack, 'GreenTG', { + vpc, + port: 80, + protocol: elbv2.ApplicationProtocol.HTTP, + targetType: elbv2.TargetType.IP, + deregistrationDelay: cdk.Duration.seconds(30), + healthCheck: { + interval: cdk.Duration.seconds(5), + healthyHttpCodes: '200', + healthyThresholdCount: 2, + unhealthyThresholdCount: 3, + timeout: cdk.Duration.seconds(4), + }, +}); + +testListener.addTargetGroups('GreenTGTest', { + targetGroups: [greenTG], +}); + +prodListener.node.addDependency(greenTG); +testListener.node.addDependency(blueTG); +service.node.addDependency(testListener); +service.node.addDependency(greenTG); + +// Alarms: monitor 500s and unhealthy hosts on target groups +const blueUnhealthyHosts = new cloudwatch.Alarm(stack, 'BlueUnhealthyHosts', { + alarmName: stack.stackName + '-Unhealthy-Hosts-Blue', + metric: blueTG.metricUnhealthyHostCount(), + threshold: 1, + evaluationPeriods: 2, +}); + +const blueApiFailure = new cloudwatch.Alarm(stack, 'Blue5xx', { + alarmName: stack.stackName + '-Http-500-Blue', + metric: blueTG.metricHttpCodeTarget( + elbv2.HttpCodeTarget.TARGET_5XX_COUNT, + { period: cdk.Duration.minutes(1) }, + ), + threshold: 1, + evaluationPeriods: 1, +}); + +const greenUnhealthyHosts = new cloudwatch.Alarm(stack, 'GreenUnhealthyHosts', { + alarmName: stack.stackName + '-Unhealthy-Hosts-Green', + metric: greenTG.metricUnhealthyHostCount(), + threshold: 1, + evaluationPeriods: 2, +}); + +const greenApiFailure = new cloudwatch.Alarm(stack, 'Green5xx', { + alarmName: stack.stackName + '-Http-500-Green', + metric: greenTG.metricHttpCodeTarget( + elbv2.HttpCodeTarget.TARGET_5XX_COUNT, + { period: cdk.Duration.minutes(1) }, + ), + threshold: 1, + evaluationPeriods: 1, +}); + +// Deployment group +const deploymentConfig = new codedeploy.EcsDeploymentConfig(stack, 'CanaryConfig', { + trafficRouting: codedeploy.TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 20, + }), +}); + +const dg = new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + alarms: [ + blueUnhealthyHosts, + blueApiFailure, + greenUnhealthyHosts, + greenApiFailure, + ], + service, + blueGreenDeploymentConfig: { + blueTargetGroup: blueTG, + greenTargetGroup: greenTG, + listener: prodListener, + testListener, + terminationWaitTime: cdk.Duration.minutes(1), + }, + deploymentConfig, + autoRollback: { + stoppedDeployment: true, + }, +}); + +// Outputs to use for manual testing +new cdk.CfnOutput(stack, 'NewTaskDefinition', { value: taskDefinition2.taskDefinitionArn }); +new cdk.CfnOutput(stack, 'Subnet1Id', { value: vpc.privateSubnets[0].subnetId }); +new cdk.CfnOutput(stack, 'Subnet2Id', { value: vpc.privateSubnets[1].subnetId }); +new cdk.CfnOutput(stack, 'SecurityGroupId', { value: service.connections.securityGroups[0].securityGroupId }); +new cdk.CfnOutput(stack, 'CodeDeployApplicationName', { value: dg.application.applicationName }); +new cdk.CfnOutput(stack, 'CodeDeployDeploymentGroupName', { value: dg.deploymentGroupName }); + +new integ.IntegTest(app, 'EcsDeploymentGroupTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/handler/index.js similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/handler/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/handler/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js new file mode 100644 index 0000000000000..f7ef349936878 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda-config'); +new codedeploy.LambdaDeploymentConfig(stack, 'LinearConfig', { + trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), +}); +new integ.IntegTest(app, 'LambdaDeploymentConfigTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwbG95bWVudC1jb25maWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kZXBsb3ltZW50LWNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdz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ltZW50Q29uZmlnKHN0YWNrLCAnTGluZWFyQ29uZmlnJywge1xuICB0cmFmZmljUm91dGluZzogY29kZWRlcGxveS5UcmFmZmljUm91dGluZy50aW1lQmFzZWRMaW5lYXIoe1xuICAgIGludGVydmFsOiBjZGsuRHVyYXRpb24ubWludXRlcygxKSxcbiAgICBwZXJjZW50YWdlOiA1LFxuICB9KSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ0xhbWJkYURlcGxveW1lbnRDb25maWdUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/LambdaDeploymentConfigTestDefaultTestDeployAssert161B09F6.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/aws-cdk-codedeploy-lambda-config.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.ts new file mode 100644 index 0000000000000..ad3261372c19f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-config.ts @@ -0,0 +1,19 @@ +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda-config'); + +new codedeploy.LambdaDeploymentConfig(stack, 'LinearConfig', { + trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), +}); + +new integ.IntegTest(app, 'LambdaDeploymentConfigTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js new file mode 100644 index 0000000000000..058bf2c224480 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda'); +const handler = new lambda.Function(stack, 'Handler', { + code: lambda.Code.fromAsset(path.join(__dirname, 'handler')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const version = handler.currentVersion; +const blueGreenAlias = new lambda.Alias(stack, 'Alias', { + aliasName: 'alias', + version, +}); +const preHook = new lambda.Function(stack, 'PreHook', { + code: lambda.Code.fromAsset(path.join(__dirname, 'preHook')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const postHook = new lambda.Function(stack, 'PostHook', { + code: lambda.Code.fromAsset(path.join(__dirname, 'postHook')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +new codedeploy.LambdaDeploymentGroup(stack, 'BlueGreenDeployment', { + alias: blueGreenAlias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, + alarms: [ + new cloudwatch.Alarm(stack, 'BlueGreenErrors', { + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + metric: blueGreenAlias.metricErrors(), + }), + ], + preHook, + postHook, +}); +const secondAlias = new lambda.Alias(stack, 'SecondAlias', { + aliasName: 'secondAlias', + version, +}); +new codedeploy.LambdaDeploymentGroup(stack, 'SecondDeployment', { + alias: secondAlias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwbG95bWVudC1ncm91cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRlcGxveW1lbnQtZ3JvdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IseURBQXlEO0FBQ3pELGlEQUFpRDtBQUNqRCxtQ0FBbUM7QUFDbkMseURBQXlEO0FBR3pELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMkJBQTJCLENBQUMsQ0FBQztBQUU5RCxNQUFNLE9BQU8sR0FBRyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRTtJQUNwRCxJQUFJLEVBQUUsTUFBTSxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsU0FBUyxDQUFDLENBQUM7SUFDNUQsT0FBTyxFQUFFLGVBQWU7SUFDeEIsT0FBTyxFQUFFLE1BQU0sQ0FBQyxPQUFPLENBQUMsV0F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kZXBsb3kuTGFtYmRhRGVwbG95bWVudEdyb3VwKHN0YWNrLCAnQmx1ZUdyZWVuRGVwbG95bWVudCcsIHtcbiAgYWxpYXM6IGJsdWVHcmVlbkFsaWFzLFxuICBkZXBsb3ltZW50Q29uZmlnOiBjb2RlZGVwbG95LkxhbWJkYURlcGxveW1lbnRDb25maWcuTElORUFSXzEwUEVSQ0VOVF9FVkVSWV8xTUlOVVRFLFxuICBhbGFybXM6IFtcbiAgICBuZXcgY2xvdWR3YXRjaC5BbGFybShzdGFjaywgJ0JsdWVHcmVlbkVycm9ycycsIHtcbiAgICAgIGNvbXBhcmlzb25PcGVyYXRvcjogY2xvdWR3YXRjaC5Db21wYXJpc29uT3BlcmF0b3IuR1JFQVRFUl9USEFOX1RIUkVTSE9MRCxcbiAgICAgIHRocmVzaG9sZDogMSxcbiAgICAgIGV2YWx1YXRpb25QZXJpb2RzOiAxLFxuICAgICAgbWV0cmljOiBibHVlR3JlZW5BbGlhcy5tZXRyaWNFcnJvcnMoKSxcbiAgICB9KSxcbiAgXSxcbiAgcHJlSG9vayxcbiAgcG9zdEhvb2ssXG59KTtcblxuY29uc3Qgc2Vjb25kQWxpYXMgPSBuZXcgbGFtYmRhLkFsaWFzKHN0YWNrLCAnU2Vjb25kQWxpYXMnLCB7XG4gIGFsaWFzTmFtZTogJ3NlY29uZEFsaWFzJyxcbiAgdmVyc2lvbixcbn0pO1xuXG5uZXcgY29kZWRlcGxveS5MYW1iZGFEZXBsb3ltZW50R3JvdXAoc3RhY2ssICdTZWNvbmREZXBsb3ltZW50Jywge1xuICBhbGlhczogc2Vjb25kQWxpYXMsXG4gIGRlcGxveW1lbnRDb25maWc6IGNvZGVkZXBsb3kuTGFtYmRhRGVwbG95bWVudENvbmZpZy5DQU5BUllfMTBQRVJDRU5UXzVNSU5VVEVTLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.87da351d4c9de5eead78cb80dde66bcbb6c42c418c3368747f32a4e9c013a2e1/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.87da351d4c9de5eead78cb80dde66bcbb6c42c418c3368747f32a4e9c013a2e1/index.js similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.87da351d4c9de5eead78cb80dde66bcbb6c42c418c3368747f32a4e9c013a2e1/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.87da351d4c9de5eead78cb80dde66bcbb6c42c418c3368747f32a4e9c013a2e1/index.js diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.93dbd8c02dbfca9077c9d83cb6d3a94659988c7d143988da4a554033a58f963c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.93dbd8c02dbfca9077c9d83cb6d3a94659988c7d143988da4a554033a58f963c/index.js similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.93dbd8c02dbfca9077c9d83cb6d3a94659988c7d143988da4a554033a58f963c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.93dbd8c02dbfca9077c9d83cb6d3a94659988c7d143988da4a554033a58f963c/index.js diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.edb7466707eb899fbaee22c1e67f9443e9edcc2eeda0b58d8448f7c4157746b3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.edb7466707eb899fbaee22c1e67f9443e9edcc2eeda0b58d8448f7c4157746b3/index.js similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.edb7466707eb899fbaee22c1e67f9443e9edcc2eeda0b58d8448f7c4157746b3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/asset.edb7466707eb899fbaee22c1e67f9443e9edcc2eeda0b58d8448f7c4157746b3/index.js diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-lambda.template.json diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-insight.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.ts new file mode 100644 index 0000000000000..6c0522d4f1d28 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/integ.deployment-group.ts @@ -0,0 +1,58 @@ +import * as path from 'path'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; + + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda'); + +const handler = new lambda.Function(stack, 'Handler', { + code: lambda.Code.fromAsset(path.join(__dirname, 'handler')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const version = handler.currentVersion; +const blueGreenAlias = new lambda.Alias(stack, 'Alias', { + aliasName: 'alias', + version, +}); + +const preHook = new lambda.Function(stack, 'PreHook', { + code: lambda.Code.fromAsset(path.join(__dirname, 'preHook')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const postHook = new lambda.Function(stack, 'PostHook', { + code: lambda.Code.fromAsset(path.join(__dirname, 'postHook')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); + +new codedeploy.LambdaDeploymentGroup(stack, 'BlueGreenDeployment', { + alias: blueGreenAlias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, + alarms: [ + new cloudwatch.Alarm(stack, 'BlueGreenErrors', { + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + metric: blueGreenAlias.metricErrors(), + }), + ], + preHook, + postHook, +}); + +const secondAlias = new lambda.Alias(stack, 'SecondAlias', { + aliasName: 'secondAlias', + version, +}); + +new codedeploy.LambdaDeploymentGroup(stack, 'SecondDeployment', { + alias: secondAlias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/postHook/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/postHook/index.js similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/postHook/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/postHook/index.js diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/preHook/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/preHook/index.js similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/preHook/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/lambda/preHook/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js new file mode 100644 index 0000000000000..f558895636593 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const lb = require("aws-cdk-lib/aws-elasticloadbalancing"); +const cdk = require("aws-cdk-lib"); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-server-dg'); +const vpc = new ec2.Vpc(stack, 'VPC'); +const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), + machineImage: new ec2.AmazonLinuxImage(), + vpc, +}); +const elb = new lb.LoadBalancer(stack, 'ELB', { vpc }); +elb.addListener({ + externalPort: 80, +}); +new codedeploy.ServerDeploymentGroup(stack, 'CodeDeployGroup', { + deploymentConfig: codedeploy.ServerDeploymentConfig.ALL_AT_ONCE, + autoScalingGroups: [asg], + loadBalancer: codedeploy.LoadBalancer.classic(elb), + alarms: [ + new cloudwatch.Alarm(stack, 'Alarm1', { + metric: new cloudwatch.Metric({ + metricName: 'Errors', + namespace: 'my.namespace', + }), + threshold: 1, + evaluationPeriods: 1, + }), + ], + autoRollback: { + failedDeployment: false, + deploymentInAlarm: false, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwbG95bWVudC1ncm91cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRlcGxveW1lbnQtZ3JvdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyREFBMkQ7QUFDM0QseURBQXlEO0FBQ3pELDJDQUEyQztBQUMzQywyREFBMkQ7QUFDM0QsbUNBQW1DO0FBQ25DLHlEQUF5RDtBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDhCQUE4QixDQUFDLENBQUM7QUFFakUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsQ0FBQztBQUV0QyxNQUFNLEdBQUcsR0FBRyxJQUFJLFdBQVcsQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ3pELFlBQVksRUFBRSxHQUFHLENBQUMsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDLEVBQUUsRUFBRSxHQUFHLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQztJQUMvRSxZQUFZLEVBQUUsSUFBSSxHQUFHLENBQUMsZ0JBQWdCLEVBQUU7SUFDeEMsR0FBRztDQUNKLENBQUMsQ0FBQztBQUVILE1BQU0sR0FBR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NhbGluZ0dyb3VwczogW2FzZ10sXG4gIGxvYWRCYWxhbmNlcjogY29kZWRlcGxveS5Mb2FkQmFsYW5jZXIuY2xhc3NpYyhlbGIpLFxuICBhbGFybXM6IFtcbiAgICBuZXcgY2xvdWR3YXRjaC5BbGFybShzdGFjaywgJ0FsYXJtMScsIHtcbiAgICAgIG1ldHJpYzogbmV3IGNsb3Vkd2F0Y2guTWV0cmljKHtcbiAgICAgICAgbWV0cmljTmFtZTogJ0Vycm9ycycsXG4gICAgICAgIG5hbWVzcGFjZTogJ215Lm5hbWVzcGFjZScsXG4gICAgICB9KSxcbiAgICAgIHRocmVzaG9sZDogMSxcbiAgICAgIGV2YWx1YXRpb25QZXJpb2RzOiAxLFxuICAgIH0pLFxuICBdLFxuICBhdXRvUm9sbGJhY2s6IHtcbiAgICBmYWlsZWREZXBsb3ltZW50OiBmYWxzZSxcbiAgICBkZXBsb3ltZW50SW5BbGFybTogZmFsc2UsXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.assets.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.template.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/aws-cdk-codedeploy-server-dg.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.ts new file mode 100644 index 0000000000000..d69ce21fee90c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codedeploy/test/server/integ.deployment-group.ts @@ -0,0 +1,45 @@ +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as lb from 'aws-cdk-lib/aws-elasticloadbalancing'; +import * as cdk from 'aws-cdk-lib'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-server-dg'); + +const vpc = new ec2.Vpc(stack, 'VPC'); + +const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), + machineImage: new ec2.AmazonLinuxImage(), + vpc, +}); + +const elb = new lb.LoadBalancer(stack, 'ELB', { vpc }); +elb.addListener({ + externalPort: 80, +}); + +new codedeploy.ServerDeploymentGroup(stack, 'CodeDeployGroup', { + deploymentConfig: codedeploy.ServerDeploymentConfig.ALL_AT_ONCE, + autoScalingGroups: [asg], + loadBalancer: codedeploy.LoadBalancer.classic(elb), + alarms: [ + new cloudwatch.Alarm(stack, 'Alarm1', { + metric: new cloudwatch.Metric({ + metricName: 'Errors', + namespace: 'my.namespace', + }), + threshold: 1, + evaluationPeriods: 1, + }), + ], + autoRollback: { + failedDeployment: false, + deploymentInAlarm: false, + }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js new file mode 100644 index 0000000000000..f8fc4cb8d1424 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_codeguruprofiler_1 = require("aws-cdk-lib/aws-codeguruprofiler"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'ProfilingGroupTestStack'); +const profilingGroup1 = new aws_codeguruprofiler_1.ProfilingGroup(stack, 'ProfilingGroupWithExplicitlySetName', { + profilingGroupName: 'ExplicitlySetName', +}); +const profilingGroup2 = new aws_codeguruprofiler_1.ProfilingGroup(stack, 'ProfilingGroupWithImplicitlySetName'); +const publishAppRole = new aws_iam_1.Role(stack, 'PublishAppRole', { + assumedBy: new aws_iam_1.AccountRootPrincipal(), +}); +profilingGroup1.grantPublish(publishAppRole); +profilingGroup2.grantPublish(publishAppRole); +const importedGroupWithExplicitlySetName = aws_codeguruprofiler_1.ProfilingGroup.fromProfilingGroupName(stack, 'ImportedProfilingGroupWithExplicitlySetName', profilingGroup1.profilingGroupName); +const importedGroupWithImplicitlySetName = aws_codeguruprofiler_1.ProfilingGroup.fromProfilingGroupName(stack, 'ImportedProfilingGroupWithImplicitlySetName', profilingGroup2.profilingGroupName); +const importedGroupFromArn = aws_codeguruprofiler_1.ProfilingGroup.fromProfilingGroupArn(stack, 'ImportedProfilingGroupFromArn', 'arn:aws:codeguru-profiler:a-region-1:1234567890:profilingGroup/MyAwesomeProfilingGroup'); +new aws_cdk_lib_1.CfnOutput(stack, 'ExplicitlySetProfilingGroupName', { + value: importedGroupWithExplicitlySetName.profilingGroupName, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'ImplicitlySetProfilingGroupName', { + value: importedGroupWithImplicitlySetName.profilingGroupName, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'ImportedFromArnProfilingGroupName', { + value: importedGroupFromArn.profilingGroupName, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'ImportedFromArnProfilingGroupArn', { + value: importedGroupFromArn.profilingGroupArn, +}); +const testCase = new integ_tests_alpha_1.IntegTest(app, 'test', { + testCases: [stack], +}); +const describe = testCase.assertions.awsApiCall('CloudFormation', 'describeStacks', { + StackName: 'ProfilingGroupTestStack', +}); +describe.assertAtPath('Stacks.0.Outputs.0.OutputKey', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('ExplicitlySetProfilingGroupName')); +describe.assertAtPath('Stacks.0.Outputs.0.OutputValue', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('ExplicitlySetName')); +describe.assertAtPath('Stacks.0.Outputs.1.OutputKey', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('ImplicitlySetProfilingGroupName')); +describe.assertAtPath('Stacks.0.Outputs.1.OutputValue', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('ProfilingGroupTestStackProfilingGroupWithImplicitlySetName98463923')); +describe.assertAtPath('Stacks.0.Outputs.2.OutputKey', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('ImportedFromArnProfilingGroupName')); +describe.assertAtPath('Stacks.0.Outputs.2.OutputValue', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('MyAwesomeProfilingGroup')); +describe.assertAtPath('Stacks.0.Outputs.3.OutputKey', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('ImportedFromArnProfilingGroupArn')); +describe.assertAtPath('Stacks.0.Outputs.3.OutputValue', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp('arn:aws:codeguru-profiler:a-region-1:1234567890:profilingGroup/MyAwesomeProfilingGroup')); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvZmlsZXItZ3JvdXAtaW1wb3J0LWZ1bmN0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnByb2ZpbGVyLWdyb3VwLWltcG9ydC1mdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUU7QUFDakUsNkNBQW9EO0FBQ3BELGtFQUF1RTtBQUN2RSwyRUFBa0U7QUFFbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFFdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSx5QkFBeUIsQ0FBQyxDQUFDO0FBRXhELE1BQU0sZUFBZSxHQUFHLElBQUkscUNBQWMsQ0FBQyxLQUFLLEVBQUUscUNBQXFDLEVBQUU7SUFDdkYsa0JBQWtCLEVBQUUsbUJBQW1CO0NBQ3hDLENBQUMsQ0FBQztBQUNILE1BQU0sZUFBZSxHQUFHLElBQUkscUNBQWMsQ0FBQyxLQUFLLEVBQUUscUNBQXFDLENBQUMsQ0FBQztBQUV6RixNQUFNLGNBQWMsR0FBRyxJQUFJLGNBQUksQ0FBQyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUU7SUFDdkQsU0FBUyxFQUFFLElBQUksOEJBQW9CLEVBQUU7Q0FDdEMsQ0FBQyxDQUFDO0FBQ0gsZUFBZSxDQUFDLFlBQVksQ0FBQyxjQUFjLENBQUMsQ0FBQztBQUM3QyxlQUFlLENBQUMsWUFBWSxDQUFDLGNBQWMsQ0FBQyxDQUFDO0FBRTdDLE1BQU0sa0NBQWtDLEdBQUcscUNBQWMsQ0FBQyxzQkFBc0IsQ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ilingGroupTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.assets.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/ProfilingGroupTestStack.template.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.assets.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.template.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/testDefaultTestDeployAssert4D02624A.template.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.ts similarity index 91% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.ts index 7a9f4fc426467..1e162e56f3c45 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group-import-functions.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group-import-functions.ts @@ -1,7 +1,7 @@ -import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; -import { ProfilingGroup } from '../lib'; +import { AccountRootPrincipal, Role } from 'aws-cdk-lib/aws-iam'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { ProfilingGroup } from 'aws-cdk-lib/aws-codeguruprofiler'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js new file mode 100644 index 0000000000000..f4d63327f7def --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_codeguruprofiler_1 = require("aws-cdk-lib/aws-codeguruprofiler"); +class ProfilerGroupIntegrationTest extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const profilingGroup = new aws_codeguruprofiler_1.ProfilingGroup(this, 'MyProfilingGroup'); + const publishAppRole = new aws_iam_1.Role(this, 'PublishAppRole', { + assumedBy: new aws_iam_1.AccountRootPrincipal(), + }); + profilingGroup.grantPublish(publishAppRole); + const readAppRole = new aws_iam_1.Role(this, 'ReadAppRole', { + assumedBy: new aws_iam_1.AccountRootPrincipal(), + }); + profilingGroup.grantRead(readAppRole); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-code-guru-profiler-group', { + testCases: [new ProfilerGroupIntegrationTest(app, 'ProfilerGroupIntegrationTest')], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvZmlsZXItZ3JvdXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm9maWxlci1ncm91cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRTtBQUNqRSw2Q0FBcUQ7QUFDckQsa0VBQXVEO0FBQ3ZELDJFQUFrRTtBQUVsRSxNQUFNLDRCQUE2QixTQUFRLG1CQUFLO0lBQzlDLFlBQVksS0FBVSxFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUNwRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLGNBQWMsR0FBRyxJQUFJLHFDQUFjLENBQUMsSUFBSSxFQUFFLGtCQUFrQixDQUFDLENBQUM7UUFFcEUsTUFBTSxjQUFjLEdBQUcsSUFBSSxjQUFJLENBQUMsSUFBSSxFQUFFLGdCQUFnQixFQUFFO1lBQ3RELFNBQVMsRUFBRSxJQUFJLDhCQUFvQixFQUFFO1NBQ3RDLENBQUMsQ0FBQztRQUNILGNBQWMsQ0FBQyxZQUFZLENBQUMsY0FBYyxDQUFDLENBQUM7UUFFNUMsTUFBTSxXQUFXLEdBQUcsSUFBSSxjQUFJLENBQUMsSUFBSSxFQUFFLGFBQWEsRUFBRTtZQUNoRCxTQUFTLEVBQUUsSUFBSSw4QkFBb0IsRUFBRTtTQUN0QyxDQUFDLENBQUM7UUFDSCxjQUFjLENBQUMsU0FBUyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0lBRXhDLENBQUM7Q0FDRjtBQUVELE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBRXRCLElBQUksNkJB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1JlYWRBcHBSb2xlJywge1xuICAgICAgYXNzdW1lZEJ5OiBuZXcgQWNjb3VudFJvb3RQcmluY2lwYWwoKSxcbiAgICB9KTtcbiAgICBwcm9maWxpbmdHcm91cC5ncmFudFJlYWQocmVhZEFwcFJvbGUpO1xuXG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2Nkay1jb2RlLWd1cnUtcHJvZmlsZXItZ3JvdXAnLCB7XG4gIHRlc3RDYXNlczogW25ldyBQcm9maWxlckdyb3VwSW50ZWdyYXRpb25UZXN0KGFwcCwgJ1Byb2ZpbGVyR3JvdXBJbnRlZ3JhdGlvblRlc3QnKV0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.assets.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.template.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/ProfilerGroupIntegrationTest.template.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.assets.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.template.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/cdkcodeguruprofilergroupDefaultTestDeployAssert05871DAC.template.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.ts new file mode 100644 index 0000000000000..0895a2f28bf39 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codeguruprofiler/test/integ.profiler-group.ts @@ -0,0 +1,29 @@ +import { AccountRootPrincipal, Role } from 'aws-cdk-lib/aws-iam'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { ProfilingGroup } from 'aws-cdk-lib/aws-codeguruprofiler'; + +class ProfilerGroupIntegrationTest extends Stack { + constructor(scope: App, id: string, props?: StackProps) { + super(scope, id, props); + + const profilingGroup = new ProfilingGroup(this, 'MyProfilingGroup'); + + const publishAppRole = new Role(this, 'PublishAppRole', { + assumedBy: new AccountRootPrincipal(), + }); + profilingGroup.grantPublish(publishAppRole); + + const readAppRole = new Role(this, 'ReadAppRole', { + assumedBy: new AccountRootPrincipal(), + }); + profilingGroup.grantRead(readAppRole); + + } +} + +const app = new App(); + +new IntegTest(app, 'cdk-code-guru-profiler-group', { + testCases: [new ProfilerGroupIntegrationTest(app, 'ProfilerGroupIntegrationTest')], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/assets/nodejs.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/assets/nodejs.zip new file mode 100644 index 0000000000000..e8db142cdf85d Binary files /dev/null and b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/assets/nodejs.zip differ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.d.ts new file mode 100644 index 0000000000000..561b79ffefa55 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.d.ts @@ -0,0 +1,5 @@ +import { Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +export declare class StackSetPipelineStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js new file mode 100644 index 0000000000000..5a2cac55b9fe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StackSetPipelineStack = void 0; +/** + * This integration test needs 2 accounts properly configured beforehand to properly test, + * and so is tested by hand. + * + * To test: + * + * ``` + * env AWS_REGION=eu-west-1 STACKSET_ACCOUNTS=11111111,22222222 cdk deploy -a test/cloudformation/integ.stacksets.js + * ``` + * + * Then make the pipeline in your account run. + * + * To update the snapshot: + * + * ``` + * yarn integ --dry-run cloudformation/integ.stacksets.js + * ``` + */ +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +class StackSetPipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const pipeline = new codepipeline.Pipeline(this, 'Pipeline', { + artifactBucket: new s3.Bucket(this, 'ArtifactBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }), + }); + const asset = new aws_s3_assets_1.Asset(this, 'Asset', { + path: `${__dirname}/test-artifact`, + }); + const sourceOutput = new codepipeline.Artifact('SourceArtifact'); + pipeline.addStage({ + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'Source', + output: sourceOutput, + bucket: asset.bucket, + bucketKey: asset.s3ObjectKey, + }), + ], + }); + const accounts = process.env.STACKSET_ACCOUNTS?.split(',') ?? ['1111', '2222']; + pipeline.addStage({ + stageName: 'Cfn', + actions: [ + new cpactions.CloudFormationDeployStackSetAction({ + actionName: 'StackSet', + stackSetName: 'TestStackSet', + template: cpactions.StackSetTemplate.fromArtifactPath(sourceOutput.atPath('template.yaml')), + stackInstances: cpactions.StackInstances.inAccounts(accounts, ['us-east-1', 'eu-west-1']), + runOrder: 1, + }), + new cpactions.CloudFormationDeployStackInstancesAction({ + actionName: 'Instances', + stackSetName: 'TestStackSet', + stackInstances: cpactions.StackInstances.inAccounts(accounts, ['us-east-1', 'eu-west-1']), + runOrder: 2, + }), + ], + }); + } +} +exports.StackSetPipelineStack = StackSetPipelineStack; +const app = new aws_cdk_lib_1.App(); +new StackSetPipelineStack(app, 'StackSetPipelineStack'); +//# sourceMapping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9uKHtcbiAgICAgICAgICBhY3Rpb25OYW1lOiAnSW5zdGFuY2VzJyxcbiAgICAgICAgICBzdGFja1NldE5hbWU6ICdUZXN0U3RhY2tTZXQnLFxuICAgICAgICAgIHN0YWNrSW5zdGFuY2VzOiBjcGFjdGlvbnMuU3RhY2tJbnN0YW5jZXMuaW5BY2NvdW50cyhhY2NvdW50cywgWyd1cy1lYXN0LTEnLCAnZXUtd2VzdC0xJ10pLFxuICAgICAgICAgIHJ1bk9yZGVyOiAyLFxuICAgICAgICB9KSxcbiAgICAgIF0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFN0YWNrU2V0UGlwZWxpbmVTdGFjayhhcHAsICdTdGFja1NldFBpcGVsaW5lU3RhY2snKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/StackSetPipelineStack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.5bcf205623ea5b34a1944fea4c9982e835555e710235ae6f60172097737302e2/template.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.5bcf205623ea5b34a1944fea4c9982e835555e710235ae6f60172097737302e2/template.yaml similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.5bcf205623ea5b34a1944fea4c9982e835555e710235ae6f60172097737302e2/template.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.5bcf205623ea5b34a1944fea4c9982e835555e710235ae6f60172097737302e2/template.yaml diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.ts similarity index 88% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.ts index f3b1b1f5c34dd..a98cabf19b8c7 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/integ.stacksets.ts @@ -16,12 +16,12 @@ * yarn integ --dry-run cloudformation/integ.stacksets.js * ``` */ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cpactions from '../../lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; export class StackSetPipelineStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js new file mode 100644 index 0000000000000..5151e136a9a63 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); +/// !show +// Source stage: read from repository +const repo = new codecommit.Repository(stack, 'TemplateRepo', { + repositoryName: 'template-repo', +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const source = new cpactions.CodeCommitSourceAction({ + actionName: 'Source', + repository: repo, + output: sourceOutput, + trigger: cpactions.CodeCommitTrigger.POLL, +}); +const sourceStage = { + stageName: 'Source', + actions: [source], +}; +// Deployment stage: create and deploy changeset with manual approval +const stackName = 'OurStack'; +const changeSetName = 'StagedChangeSet'; +const prodStage = { + stageName: 'Deploy', + actions: [ + new cpactions.CloudFormationCreateReplaceChangeSetAction({ + actionName: 'PrepareChanges', + stackName, + changeSetName, + adminPermissions: true, + templatePath: sourceOutput.atPath('template.yaml'), + runOrder: 1, + }), + new cpactions.ManualApprovalAction({ + actionName: 'ApproveChanges', + runOrder: 2, + }), + new cpactions.CloudFormationExecuteChangeSetAction({ + actionName: 'ExecuteChanges', + stackName, + changeSetName, + runOrder: 3, + }), + ], +}; +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + sourceStage, + prodStage, + ], +}); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2ZuLXRlbXBsYXRlLWZyb20tcmVwby5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jZm4tdGVtcGxhdGUtZnJvbS1yZXBvLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUF5RDtBQUN6RCw2REFBNkQ7QUFDN0QsbUNBQW1DO0FBQ25DLGtFQUFrRTtBQUVsRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHFDQUFxQyxDQUFDLENBQUM7QUFFeEUsU0FBUztBQUNULHFDQUFxQztBQUNyQyxNQUFNLElBQUksR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUM1RCxjQUFjLEVBQUUsZUFBZTtDQUNoQyxDQUFDLENBQUM7QUFDSCxNQUFNLFlBQVksR0FBRyxJQUFJLFlBQVksQ0FBQyxRQUFRLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQUNqRSxNQUFNLE1BQU0sR0FBRyxJQUFJLFNBQVMsQ0FBQyxzQkFBc0IsQ0FBQztJQUN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biAgICAgIGNoYW5nZVNldE5hbWUsXG4gICAgICBydW5PcmRlcjogMyxcbiAgICB9KSxcbiAgXSxcbn07XG5cbm5ldyBjb2RlcGlwZWxpbmUuUGlwZWxpbmUoc3RhY2ssICdQaXBlbGluZScsIHtcbiAgc3RhZ2VzOiBbXG4gICAgc291cmNlU3RhZ2UsXG4gICAgcHJvZFN0YWdlLFxuICBdLFxufSk7XG4vLy8gIWhpZGVcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts new file mode 100644 index 0000000000000..2172ee7b0633c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts @@ -0,0 +1,62 @@ +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); + +/// !show +// Source stage: read from repository +const repo = new codecommit.Repository(stack, 'TemplateRepo', { + repositoryName: 'template-repo', +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const source = new cpactions.CodeCommitSourceAction({ + actionName: 'Source', + repository: repo, + output: sourceOutput, + trigger: cpactions.CodeCommitTrigger.POLL, +}); +const sourceStage = { + stageName: 'Source', + actions: [source], +}; + +// Deployment stage: create and deploy changeset with manual approval +const stackName = 'OurStack'; +const changeSetName = 'StagedChangeSet'; + +const prodStage = { + stageName: 'Deploy', + actions: [ + new cpactions.CloudFormationCreateReplaceChangeSetAction({ + actionName: 'PrepareChanges', + stackName, + changeSetName, + adminPermissions: true, + templatePath: sourceOutput.atPath('template.yaml'), + runOrder: 1, + }), + new cpactions.ManualApprovalAction({ + actionName: 'ApproveChanges', + runOrder: 2, + }), + new cpactions.CloudFormationExecuteChangeSetAction({ + actionName: 'ExecuteChanges', + stackName, + changeSetName, + runOrder: 3, + }), + ], +}; + +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + sourceStage, + prodStage, + ], +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js new file mode 100644 index 0000000000000..fde568764d0dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js @@ -0,0 +1,128 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ PipelineStack +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const codepipeline_actions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +/// !show +const lambdaStack = new cdk.Stack(app, 'LambdaStack'); +const lambdaCode = lambda.Code.fromCfnParameters(); +new lambda.Function(lambdaStack, 'Lambda', { + code: lambdaCode, + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +// other resources that your Lambda needs, added to the lambdaStack... +const pipelineStack = new cdk.Stack(app, 'PipelineStack'); +const pipeline = new codepipeline.Pipeline(pipelineStack, 'Pipeline'); +// add the source code repository containing this code to your Pipeline, +// and the source code of the Lambda Function, if they're separate +const cdkSourceOutput = new codepipeline.Artifact(); +const cdkSourceAction = new codepipeline_actions.CodeCommitSourceAction({ + repository: new codecommit.Repository(pipelineStack, 'CdkCodeRepo', { + repositoryName: 'CdkCodeRepo', + }), + actionName: 'CdkCode_Source', + output: cdkSourceOutput, +}); +const lambdaSourceOutput = new codepipeline.Artifact(); +const lambdaSourceAction = new codepipeline_actions.CodeCommitSourceAction({ + repository: new codecommit.Repository(pipelineStack, 'LambdaCodeRepo', { + repositoryName: 'LambdaCodeRepo', + }), + actionName: 'LambdaCode_Source', + output: lambdaSourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [cdkSourceAction, lambdaSourceAction], +}); +// synthesize the Lambda CDK template, using CodeBuild +// the below values are just examples, assuming your CDK code is in TypeScript/JavaScript - +// adjust the build environment and/or commands accordingly +const cdkBuildProject = new codebuild.Project(pipelineStack, 'CdkBuildProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: 'npm install', + }, + build: { + commands: [ + 'npm run build', + 'npm run cdk synth LambdaStack -- -o .', + ], + }, + }, + artifacts: { + files: 'LambdaStack.template.yaml', + }, + }), +}); +const cdkBuildOutput = new codepipeline.Artifact(); +const cdkBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'CDK_Build', + project: cdkBuildProject, + input: cdkSourceOutput, + outputs: [cdkBuildOutput], +}); +// build your Lambda code, using CodeBuild +// again, this example assumes your Lambda is written in TypeScript/JavaScript - +// make sure to adjust the build environment and/or commands if they don't match your specific situation +const lambdaBuildProject = new codebuild.Project(pipelineStack, 'LambdaBuildProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: 'npm install', + }, + build: { + commands: 'npm run build', + }, + }, + artifacts: { + files: [ + 'index.js', + 'node_modules/**/*', + ], + }, + }), +}); +const lambdaBuildOutput = new codepipeline.Artifact(); +const lambdaBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'Lambda_Build', + project: lambdaBuildProject, + input: lambdaSourceOutput, + outputs: [lambdaBuildOutput], +}); +pipeline.addStage({ + stageName: 'Build', + actions: [cdkBuildAction, lambdaBuildAction], +}); +// finally, deploy your Lambda Stack +pipeline.addStage({ + stageName: 'Deploy', + actions: [ + new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'Lambda_CFN_Deploy', + templatePath: cdkBuildOutput.atPath('LambdaStack.template.yaml'), + stackName: 'LambdaStackDeployedName', + adminPermissions: true, + parameterOverrides: lambdaCode.assign(lambdaBuildOutput.s3Location), + extraInputs: [ + lambdaBuildOutput, + ], + }), + ], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWRlcGxveWVkLXRocm91Z2gtY29kZXBpcGVsaW5lLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxhbWJkYS1kZXBsb3llZC10aHJvdWdoLWNvZGVwaXBlbGluZS5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw0QkFBNEI7QUFDNUIsdURBQXVEO0FBQ3ZELHlEQUF5RDtBQUN6RCw2REFBNkQ7QUFDN0QsaURBQWlEO0FBQ2pELG1DQUFtQztBQUNuQyw2RUFBNkU7QUFFN0UsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsU0FBUztBQUNULE1BQU0sV0FBVyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsYUFBYSxDQUFDLENBQUM7QUFDdEQsTUFBTSxVQUFVLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxDQUFDO0FBQ25ELElBQUksTUFBTSxDQUFDLFFBQVEsQ0FBQyxXQUFXLEVBQUUsUUFBUSxFQUFFO0lBQ3pDLElBQUksRUFBRSxVQUFVO0lBQ2hCLE9BQU8sRUFBRSxlQUFlO0lBQ3hCLE9BQU8sRUFBRSxNQUFNLENBQUMsT0FBTyxDQUFDLFdBQVc7Q0FDcEMsQ0FBQyxDQUFDO0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YWdlKHtcbiAgc3RhZ2VOYW1lOiAnQnVpbGQnLFxuICBhY3Rpb25zOiBbY2RrQnVpbGRBY3Rpb24sIGxhbWJkYUJ1aWxkQWN0aW9uXSxcbn0pO1xuXG4vLyBmaW5hbGx5LCBkZXBsb3kgeW91ciBMYW1iZGEgU3RhY2tcbnBpcGVsaW5lLmFkZFN0YWdlKHtcbiAgc3RhZ2VOYW1lOiAnRGVwbG95JyxcbiAgYWN0aW9uczogW1xuICAgIG5ldyBjb2RlcGlwZWxpbmVfYWN0aW9ucy5DbG91ZEZvcm1hdGlvbkNyZWF0ZVVwZGF0ZVN0YWNrQWN0aW9uKHtcbiAgICAgIGFjdGlvbk5hbWU6ICdMYW1iZGFfQ0ZOX0RlcGxveScsXG4gICAgICB0ZW1wbGF0ZVBhdGg6IGNka0J1aWxkT3V0cHV0LmF0UGF0aCgnTGFtYmRhU3RhY2sudGVtcGxhdGUueWFtbCcpLFxuICAgICAgc3RhY2tOYW1lOiAnTGFtYmRhU3RhY2tEZXBsb3llZE5hbWUnLFxuICAgICAgYWRtaW5QZXJtaXNzaW9uczogdHJ1ZSxcbiAgICAgIHBhcmFtZXRlck92ZXJyaWRlczogbGFtYmRhQ29kZS5hc3NpZ24obGFtYmRhQnVpbGRPdXRwdXQuczNMb2NhdGlvbiksXG4gICAgICBleHRyYUlucHV0czogW1xuICAgICAgICBsYW1iZGFCdWlsZE91dHB1dCxcbiAgICAgIF0sXG4gICAgfSksXG4gIF0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/LambdaStack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/PipelineStack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts new file mode 100644 index 0000000000000..c5ec1989475aa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts @@ -0,0 +1,133 @@ +/// !cdk-integ PipelineStack +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; + +const app = new cdk.App(); + +/// !show +const lambdaStack = new cdk.Stack(app, 'LambdaStack'); +const lambdaCode = lambda.Code.fromCfnParameters(); +new lambda.Function(lambdaStack, 'Lambda', { + code: lambdaCode, + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +// other resources that your Lambda needs, added to the lambdaStack... + +const pipelineStack = new cdk.Stack(app, 'PipelineStack'); +const pipeline = new codepipeline.Pipeline(pipelineStack, 'Pipeline'); + +// add the source code repository containing this code to your Pipeline, +// and the source code of the Lambda Function, if they're separate +const cdkSourceOutput = new codepipeline.Artifact(); +const cdkSourceAction = new codepipeline_actions.CodeCommitSourceAction({ + repository: new codecommit.Repository(pipelineStack, 'CdkCodeRepo', { + repositoryName: 'CdkCodeRepo', + }), + actionName: 'CdkCode_Source', + output: cdkSourceOutput, +}); +const lambdaSourceOutput = new codepipeline.Artifact(); +const lambdaSourceAction = new codepipeline_actions.CodeCommitSourceAction({ + repository: new codecommit.Repository(pipelineStack, 'LambdaCodeRepo', { + repositoryName: 'LambdaCodeRepo', + }), + actionName: 'LambdaCode_Source', + output: lambdaSourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [cdkSourceAction, lambdaSourceAction], +}); + +// synthesize the Lambda CDK template, using CodeBuild +// the below values are just examples, assuming your CDK code is in TypeScript/JavaScript - +// adjust the build environment and/or commands accordingly +const cdkBuildProject = new codebuild.Project(pipelineStack, 'CdkBuildProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: 'npm install', + }, + build: { + commands: [ + 'npm run build', + 'npm run cdk synth LambdaStack -- -o .', + ], + }, + }, + artifacts: { + files: 'LambdaStack.template.yaml', + }, + }), +}); +const cdkBuildOutput = new codepipeline.Artifact(); +const cdkBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'CDK_Build', + project: cdkBuildProject, + input: cdkSourceOutput, + outputs: [cdkBuildOutput], +}); + +// build your Lambda code, using CodeBuild +// again, this example assumes your Lambda is written in TypeScript/JavaScript - +// make sure to adjust the build environment and/or commands if they don't match your specific situation +const lambdaBuildProject = new codebuild.Project(pipelineStack, 'LambdaBuildProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: 'npm install', + }, + build: { + commands: 'npm run build', + }, + }, + artifacts: { + files: [ + 'index.js', + 'node_modules/**/*', + ], + }, + }), +}); +const lambdaBuildOutput = new codepipeline.Artifact(); +const lambdaBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'Lambda_Build', + project: lambdaBuildProject, + input: lambdaSourceOutput, + outputs: [lambdaBuildOutput], +}); + +pipeline.addStage({ + stageName: 'Build', + actions: [cdkBuildAction, lambdaBuildAction], +}); + +// finally, deploy your Lambda Stack +pipeline.addStage({ + stageName: 'Deploy', + actions: [ + new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'Lambda_CFN_Deploy', + templatePath: cdkBuildOutput.atPath('LambdaStack.template.yaml'), + stackName: 'LambdaStackDeployedName', + adminPermissions: true, + parameterOverrides: lambdaCode.assign(lambdaBuildOutput.s3Location), + extraInputs: [ + lambdaBuildOutput, + ], + }), + ], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js new file mode 100644 index 0000000000000..eb40bd5a74c5f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudtrail = require("aws-cdk-lib/aws-cloudtrail"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-lambda'); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); +const sourceStage = pipeline.addStage({ stageName: 'Source' }); +const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const key = 'key'; +const trail = new cloudtrail.Trail(stack, 'CloudTrail'); +trail.addS3EventSelector([{ bucket, objectPrefix: key }], { readWriteType: cloudtrail.ReadWriteType.WRITE_ONLY, includeManagementEvents: false }); +sourceStage.addAction(new cpactions.S3SourceAction({ + actionName: 'Source', + output: new codepipeline.Artifact('SourceArtifact'), + bucket, + bucketKey: key, + trigger: cpactions.S3Trigger.EVENTS, +})); +const lambdaFun = new lambda.Function(stack, 'LambdaFun', { + code: new lambda.InlineCode(` + exports.handler = function () { + console.log("Hello, world!"); + }; + `), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const lambdaStage = pipeline.addStage({ stageName: 'Lambda' }); +lambdaStage.addAction(new cpactions.LambdaInvokeAction({ + actionName: 'Lambda', + lambda: lambdaFun, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLXBpcGVsaW5lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGFtYmRhLXBpcGVsaW5lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseURBQXlEO0FBQ3pELDZEQUE2RDtBQUM3RCxpREFBaUQ7QUFDakQseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyxrRUFBa0U7QUFFbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDO0FBRWhFLE1BQU0sUUFBUSxHQUFHLElBQUksWUFBWSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsVUFBVSxDQUFDLENBQUM7QUFFOUQsTUFBTSxXQUFXLEdBQUcsUUFBUSxDQUFDLFFBQVEsQ0FBQyxFQUFFLFNBQVMsRUFBRSxRQUFRLEVBQUUsQ0FBQyxDQUFDO0FBQy9ELE1BQU0sTUFBTSxHQUFHLElBQUksRUFBRSxDQUF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RpbWUuTk9ERUpTXzE0X1gsXG59KTtcbmNvbnN0IGxhbWJkYVN0YWdlID0gcGlwZWxpbmUuYWRkU3RhZ2UoeyBzdGFnZU5hbWU6ICdMYW1iZGEnIH0pO1xubGFtYmRhU3RhZ2UuYWRkQWN0aW9uKG5ldyBjcGFjdGlvbnMuTGFtYmRhSW52b2tlQWN0aW9uKHtcbiAgYWN0aW9uTmFtZTogJ0xhbWJkYScsXG4gIGxhbWJkYTogbGFtYmRhRnVuLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/aws-cdk-codepipeline-lambda.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.ts similarity index 79% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.ts index 460d0f79dc5ba..0fcc60981b9a0 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-pipeline.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.lambda-pipeline.ts @@ -1,9 +1,9 @@ -import * as cloudtrail from '@aws-cdk/aws-cloudtrail'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js new file mode 100644 index 0000000000000..039a0674198bd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const elasticbeanstalk = require("aws-cdk-lib/aws-elasticbeanstalk"); +const iam = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const deploy = require("aws-cdk-lib/aws-s3-deployment"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +/** + * To validate that the deployment actually succeeds, perform the following actions: + * + * 1. Delete the snapshot + * 2. Run `yarn integ --update-on-failed --no-clean` + * 3. Navigate to CodePipeline in the console and click 'Release change' + * - Before releasing the change, the pipeline will show a failure because it + * attempts to run on creation but the elastic beanstalk environment is not yet ready + * 4. Navigate to Elastic Beanstalk and click on the URL for the application just deployed + * - You should see 'Congratulations' message + * 5. Manually delete the 'aws-cdk-codepipeline-elastic-beanstalk-deploy' stack + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-codepipeline-elastic-beanstalk-deploy'); +const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const artifact = new deploy.BucketDeployment(stack, 'DeployApp', { + sources: [deploy.Source.asset(path.join(__dirname, 'assets/nodejs.zip'))], + destinationBucket: bucket, + extract: false, +}); +const serviceRole = new iam.Role(stack, 'service-role', { + roleName: 'codepipeline-elasticbeanstalk-action-test-serivce-role', + assumedBy: new iam.ServicePrincipal('elasticbeanstalk.amazonaws.com'), + managedPolicies: [ + { + managedPolicyArn: 'arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth', + }, + { + managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy', + }, + ], +}); +const instanceProfileRole = new iam.Role(stack, 'instance-profile-role', { + roleName: 'codepipeline-elasticbeanstalk-action-test-instance-profile-role', + assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), + managedPolicies: [ + { + managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier', + }, + { + managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker', + }, + { + managedPolicyArn: 'arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier', + }, + ], +}); +const instanceProfile = new iam.CfnInstanceProfile(stack, 'instance-profile', { + roles: [instanceProfileRole.roleName], + instanceProfileName: instanceProfileRole.roleName, +}); +const beanstalkApp = new elasticbeanstalk.CfnApplication(stack, 'beastalk-app', { + applicationName: 'codepipeline-test-app', +}); +const beanstalkEnv = new elasticbeanstalk.CfnEnvironment(stack, 'beanstlk-env', { + applicationName: beanstalkApp.applicationName, + environmentName: 'codepipeline-test-env', + solutionStackName: '64bit Amazon Linux 2 v5.5.6 running Node.js 16', + optionSettings: [ + { + namespace: 'aws:autoscaling:launchconfiguration', + optionName: 'IamInstanceProfile', + value: instanceProfile.instanceProfileName, + }, + { + namespace: 'aws:elasticbeanstalk:environment', + optionName: 'ServiceRole', + value: serviceRole.roleName, + }, + { + namespace: 'aws:elasticbeanstalk:environment', + optionName: 'LoadBalancerType', + value: 'application', + }, + { + namespace: 'aws:elasticbeanstalk:managedactions', + optionName: 'ServiceRoleForManagedUpdates', + value: 'AWSServiceRoleForElasticBeanstalkManagedUpdates', + }, + ], +}); +beanstalkEnv.addDependency(instanceProfile); +beanstalkEnv.addDependency(beanstalkApp); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'Source', + output: sourceOutput, + bucket, + bucketKey: aws_cdk_lib_1.Fn.select(0, artifact.objectKeys), +}); +pipeline.addStage({ + stageName: 'Source', + actions: [ + sourceAction, + ], +}); +const deployAction = new cpactions.ElasticBeanstalkDeployAction({ + actionName: 'Deploy', + input: sourceOutput, + environmentName: beanstalkEnv.environmentName, + applicationName: beanstalkApp.applicationName, +}); +pipeline.addStage({ + stageName: 'Deploy', + actions: [ + deployAction, + ], +}); +new integ.IntegTest(app, 'codepipeline-elastic-beanstalk-deploy', { + testCases: [stack], + stackUpdateWorkflow: false, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWlsbmUtZWxhc3RpYy1iZWFuc3RhbGstZGVwbG95LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWlsbmUtZWxhc3RpYy1iZWFuc3RhbGstZGVwbG95LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDZEQUE2RDtBQUM3RCxxRUFBcUU7QUFDckUsMkNBQTJDO0FBQzNDLHlDQUF5QztBQUN6Qyx3REFBd0Q7QUFDeEQsNkNBQTREO0FBQzVELG9EQUFvRDtBQUNwRCxrRUFBa0U7QUFFbEU7Ozs7Ozs7Ozs7O0dBV0c7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLCtDQUErQyxDQUFDLENBQUM7QUFFOUUsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxnQkFBZ0IsRUFBRTtJQUNwRCxTQUFTLEVBQUUsSUFBSTtJQUNmLGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87SUFDcEMsaUJBQWlCLEVBQUUsSUFBSTtDQUN4QixDQUFDLENBQUM7QUFFSCxNQUFNLFFBQVEsR0FBRyxJQUFJLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsV0FBVyxFQUFFO0lBQy9ELE9BQU8sRUFBRSxDQUFDLE1BQU0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waXBlbGluZS1lbGFzdGljLWJlYW5zdGFsay1kZXBsb3knLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbiAgc3RhY2tVcGRhdGVXb3JrZmxvdzogZmFsc2UsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/aws-cdk-codepipeline-elastic-beanstalk-deploy.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/codepipelineelasticbeanstalkdeployDefaultTestDeployAssert785E452B.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.ts similarity index 90% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.ts index c5239f88f3f9f..892976b254851 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.ts @@ -1,12 +1,12 @@ import * as path from 'path'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as elasticbeanstalk from '@aws-cdk/aws-elasticbeanstalk'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as deploy from '@aws-cdk/aws-s3-deployment'; -import { App, Fn, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as elasticbeanstalk from 'aws-cdk-lib/aws-elasticbeanstalk'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as deploy from 'aws-cdk-lib/aws-s3-deployment'; +import { App, Fn, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; /** * To validate that the deployment actually succeeds, perform the following actions: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js new file mode 100644 index 0000000000000..0b6c623b54dfb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-codepipeline-alexa-deploy'); +const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'Source', + output: sourceOutput, + bucket, + bucketKey: 'key', +}); +const sourceStage = { + stageName: 'Source', + actions: [sourceAction], +}; +const deployStage = { + stageName: 'Deploy', + actions: [ + new cpactions.AlexaSkillDeployAction({ + actionName: 'DeploySkill', + runOrder: 1, + input: sourceOutput, + clientId: 'clientId', + clientSecret: aws_cdk_lib_1.SecretValue.unsafePlainText('clientSecret'), + refreshToken: aws_cdk_lib_1.SecretValue.unsafePlainText('refreshToken'), + skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', + }), + ], +}; +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + sourceStage, + deployStage, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtYWxleGEtZGVwbG95LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtYWxleGEtZGVwbG95LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkRBQTZEO0FBQzdELHlDQU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NwYWN0aW9ucy5TM1NvdXJjZUFjdGlvbih7XG4gIGFjdGlvbk5hbWU6ICdTb3VyY2UnLFxuICBvdXRwdXQ6IHNvdXJjZU91dHB1dCxcbiAgYnVja2V0LFxuICBidWNrZXRLZXk6ICdrZXknLFxufSk7XG5jb25zdCBzb3VyY2VTdGFnZSA9IHtcbiAgc3RhZ2VOYW1lOiAnU291cmNlJyxcbiAgYWN0aW9uczogW3NvdXJjZUFjdGlvbl0sXG59O1xuXG5jb25zdCBkZXBsb3lTdGFnZSA9IHtcbiAgc3RhZ2VOYW1lOiAnRGVwbG95JyxcbiAgYWN0aW9uczogW1xuICAgIG5ldyBjcGFjdGlvbnMuQWxleGFTa2lsbERlcGxveUFjdGlvbih7XG4gICAgICBhY3Rpb25OYW1lOiAnRGVwbG95U2tpbGwnLFxuICAgICAgcnVuT3JkZXI6IDEsXG4gICAgICBpbnB1dDogc291cmNlT3V0cHV0LFxuICAgICAgY2xpZW50SWQ6ICdjbGllbnRJZCcsXG4gICAgICBjbGllbnRTZWNyZXQ6IFNlY3JldFZhbHVlLnVuc2FmZVBsYWluVGV4dCgnY2xpZW50U2VjcmV0JyksXG4gICAgICByZWZyZXNoVG9rZW46IFNlY3JldFZhbHVlLnVuc2FmZVBsYWluVGV4dCgncmVmcmVzaFRva2VuJyksXG4gICAgICBza2lsbElkOiAnYW16bjEuYXNrLnNraWxsLjEyMzQ1Njc4LTEyMzQtMTIzNC0xMjM0LTEyMzQ1Njc4OTAxMicsXG4gICAgfSksXG4gIF0sXG59O1xuXG5uZXcgY29kZXBpcGVsaW5lLlBpcGVsaW5lKHN0YWNrLCAnUGlwZWxpbmUnLCB7XG4gIHN0YWdlczogW1xuICAgIHNvdXJjZVN0YWdlLFxuICAgIGRlcGxveVN0YWdlLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/aws-cdk-codepipeline-alexa-deploy.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.ts similarity index 81% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.ts index af4a418e2a61b..63a546e1a65dd 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-alexa-deploy.ts @@ -1,7 +1,7 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, RemovalPolicy, SecretValue, Stack } from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, RemovalPolicy, SecretValue, Stack } from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js new file mode 100644 index 0000000000000..31fe462e8cbc1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const region = 'us-west-2'; // hardcode the region +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation-cross-region', { + env: { + region, + }, +}); +const bucket = new s3.Bucket(stack, 'MyBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'S3', + bucketKey: 'some/path', + bucket, + output: sourceOutput, +}); +new codepipeline.Pipeline(stack, 'MyPipeline', { + artifactBucket: bucket, + stages: [ + { + stageName: 'Source', + actions: [sourceAction], + }, + { + stageName: 'CFN', + actions: [ + new cpactions.CloudFormationCreateUpdateStackAction({ + actionName: 'CFN_Deploy', + stackName: 'aws-cdk-codepipeline-cross-region-deploy-stack', + templatePath: sourceOutput.atPath('template.yml'), + adminPermissions: false, + region, + }), + ], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY2ZuLWNyb3NzLXJlZ2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLWNmbi1jcm9zcy1yZWdpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2REFBNkQ7QUFDN0QseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyxrRUFBa0U7QUFFbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxNQUFNLEdBQUcsV0FBVyxDQUFDLENBQUMsc0JBQXNCO0FBQ2xELE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsa0RBQWtELEVBQUU7SUFDbkYsR0FBRyxFQUFFO1FBQ0gsTUFBTTtLQUNQO0NBQ0YsQ0FBQyxDQUFDO0FBRUgsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDOUMsU0FBUyxFQUFFLElBQUk7SUFDZixhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO0NBQ3pDLENBQUMsQ0FBQztBQUVILE1BQU0sWUFBWSxHQUFHLElBQUksWUFBWSxDQUFDLFFBQVEsRUFBRSxDQUFDO0FBQ2pELE1BQU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ICAgICBhY3Rpb25OYW1lOiAnQ0ZOX0RlcGxveScsXG4gICAgICAgICAgc3RhY2tOYW1lOiAnYXdzLWNkay1jb2RlcGlwZWxpbmUtY3Jvc3MtcmVnaW9uLWRlcGxveS1zdGFjaycsXG4gICAgICAgICAgdGVtcGxhdGVQYXRoOiBzb3VyY2VPdXRwdXQuYXRQYXRoKCd0ZW1wbGF0ZS55bWwnKSxcbiAgICAgICAgICBhZG1pblBlcm1pc3Npb25zOiBmYWxzZSxcbiAgICAgICAgICByZWdpb24sXG4gICAgICAgIH0pLFxuICAgICAgXSxcbiAgICB9LFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.ts similarity index 83% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.ts index 123145f0f588d..c17b22d81066b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.ts @@ -1,7 +1,7 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js new file mode 100644 index 0000000000000..dd140c41c4456 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const iam = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation-cross-region-with-action-role', {}); +const bucket = new s3.Bucket(stack, 'MyBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'S3', + bucketKey: 'some/path', + bucket, + output: sourceOutput, +}); +const sourceStage = { + stageName: 'Source', + actions: [sourceAction], +}; +const role = new iam.Role(stack, 'ActionRole', { + assumedBy: new iam.AccountPrincipal(cdk.Aws.ACCOUNT_ID), +}); +role.addToPolicy(new iam.PolicyStatement({ + actions: ['sqs:*'], + resources: ['*'], +})); +const cfnStage = { + stageName: 'CFN', + actions: [ + new cpactions.CloudFormationCreateUpdateStackAction({ + actionName: 'CFN_Deploy', + stackName: 'aws-cdk-codepipeline-cross-region-deploy-stack', + templatePath: sourceOutput.atPath('template.yml'), + adminPermissions: false, + role, + }), + ], +}; +new codepipeline.Pipeline(stack, 'MyPipeline', { + artifactBucket: bucket, + stages: [ + sourceStage, + cfnStage, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY2ZuLXdpdGgtYWN0aW9uLXJvbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5waXBlbGluZS1jZm4td2l0aC1hY3Rpb24tcm9sZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZEQUE2RDtBQUM3RCwyQ0FBM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Q3JlYXRlVXBkYXRlU3RhY2tBY3Rpb24oe1xuICAgICAgYWN0aW9uTmFtZTogJ0NGTl9EZXBsb3knLFxuICAgICAgc3RhY2tOYW1lOiAnYXdzLWNkay1jb2RlcGlwZWxpbmUtY3Jvc3MtcmVnaW9uLWRlcGxveS1zdGFjaycsXG4gICAgICB0ZW1wbGF0ZVBhdGg6IHNvdXJjZU91dHB1dC5hdFBhdGgoJ3RlbXBsYXRlLnltbCcpLFxuICAgICAgYWRtaW5QZXJtaXNzaW9uczogZmFsc2UsXG4gICAgICByb2xlLFxuICAgIH0pLFxuICBdLFxufTtcblxubmV3IGNvZGVwaXBlbGluZS5QaXBlbGluZShzdGFjaywgJ015UGlwZWxpbmUnLCB7XG4gIGFydGlmYWN0QnVja2V0OiBidWNrZXQsXG4gIHN0YWdlczogW1xuICAgIHNvdXJjZVN0YWdlLFxuICAgIGNmblN0YWdlLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/aws-cdk-codepipeline-cloudformation-cross-region-with-action-role.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.ts similarity index 82% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.ts index 338a1267bbf3c..52d53fd87efd7 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn-with-action-role.ts @@ -1,8 +1,8 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js new file mode 100644 index 0000000000000..4c7a08e0a3f7b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); +const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const additionalArtifact = new codepipeline.Artifact('AdditionalArtifact'); +const source = new cpactions.S3SourceAction({ + actionName: 'Source', + output: sourceOutput, + bucket, + bucketKey: 'key', +}); +const sourceStage = { + stageName: 'Source', + actions: [ + source, + new cpactions.S3SourceAction({ + actionName: 'AdditionalSource', + output: additionalArtifact, + bucket, + bucketKey: 'additional/key', + }), + ], +}; +const changeSetName = 'ChangeSetIntegTest'; +const stackName = 'IntegTest-TestActionStack'; +const role = new aws_iam_1.Role(stack, 'CfnChangeSetRole', { + assumedBy: new aws_iam_1.ServicePrincipal('cloudformation.amazonaws.com'), +}); +pipeline.addStage(sourceStage); +pipeline.addStage({ + stageName: 'CFN', + actions: [ + new cpactions.CloudFormationCreateReplaceChangeSetAction({ + actionName: 'DeployCFN', + changeSetName, + stackName, + deploymentRole: role, + templatePath: sourceOutput.atPath('test.yaml'), + adminPermissions: false, + parameterOverrides: { + BucketName: sourceOutput.bucketName, + ObjectKey: sourceOutput.objectKey, + Url: additionalArtifact.url, + OtherParam: sourceOutput.getParam('params.json', 'OtherParam'), + }, + extraInputs: [additionalArtifact], + }), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY2ZuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtY2ZuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkRBQTZEO0FBQzdELGlEQUE2RDtBQUM3RCx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLGtFQUFrRTtBQUVsRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHFDQUFxQyxDQUFDLENBQUM7QUFFeEUsTUFBTSxRQUFRLEdBQUcsSUFBSSxZQUFZLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxVQUFVLENBQUMsQ0FBQztBQUU5RCxNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFO0lBQ3BELFNBQVMsRUFBRSxJQUFJO0lBQ2YsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztDQUN6QyxDQUFDLENBQUM7QUFFSCxNQUFNLFlBQVksR0FBRyxJQUFJLFlBQVksQ0FBQyxRQUFRLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQUNqRSxNQUFNLGtCQUFrQ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ShzdGFjaywgJ0NmbkNoYW5nZVNldFJvbGUnLCB7XG4gIGFzc3VtZWRCeTogbmV3IFNlcnZpY2VQcmluY2lwYWwoJ2Nsb3VkZm9ybWF0aW9uLmFtYXpvbmF3cy5jb20nKSxcbn0pO1xuXG5waXBlbGluZS5hZGRTdGFnZShzb3VyY2VTdGFnZSk7XG5waXBlbGluZS5hZGRTdGFnZSh7XG4gIHN0YWdlTmFtZTogJ0NGTicsXG4gIGFjdGlvbnM6IFtcbiAgICBuZXcgY3BhY3Rpb25zLkNsb3VkRm9ybWF0aW9uQ3JlYXRlUmVwbGFjZUNoYW5nZVNldEFjdGlvbih7XG4gICAgICBhY3Rpb25OYW1lOiAnRGVwbG95Q0ZOJyxcbiAgICAgIGNoYW5nZVNldE5hbWUsXG4gICAgICBzdGFja05hbWUsXG4gICAgICBkZXBsb3ltZW50Um9sZTogcm9sZSxcbiAgICAgIHRlbXBsYXRlUGF0aDogc291cmNlT3V0cHV0LmF0UGF0aCgndGVzdC55YW1sJyksXG4gICAgICBhZG1pblBlcm1pc3Npb25zOiBmYWxzZSxcbiAgICAgIHBhcmFtZXRlck92ZXJyaWRlczoge1xuICAgICAgICBCdWNrZXROYW1lOiBzb3VyY2VPdXRwdXQuYnVja2V0TmFtZSxcbiAgICAgICAgT2JqZWN0S2V5OiBzb3VyY2VPdXRwdXQub2JqZWN0S2V5LFxuICAgICAgICBVcmw6IGFkZGl0aW9uYWxBcnRpZmFjdC51cmwsXG4gICAgICAgIE90aGVyUGFyYW06IHNvdXJjZU91dHB1dC5nZXRQYXJhbSgncGFyYW1zLmpzb24nLCAnT3RoZXJQYXJhbScpLFxuICAgICAgfSxcbiAgICAgIGV4dHJhSW5wdXRzOiBbYWRkaXRpb25hbEFydGlmYWN0XSxcbiAgICB9KSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/aws-cdk-codepipeline-cloudformation.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.ts similarity index 86% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.ts index 46585d6ba0042..3441fd5972fd9 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-cfn.ts @@ -1,8 +1,8 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import { Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js new file mode 100644 index 0000000000000..0ec8d663ed50f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codebuild-batch'); +const repository = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'MyIntegTestTempRepo', +}); +const bucket = new s3.Bucket(stack, 'MyBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, +}); +const pipelineRole = pipeline.role; +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new cpactions.CodeCommitSourceAction({ + actionName: 'Source', + repository, + output: sourceOutput, + role: pipelineRole, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [ + sourceAction, + ], +}); +const project = new codebuild.PipelineProject(stack, 'MyBuildProject', { + grantReportGroupPermissions: false, +}); +const buildAction = new cpactions.CodeBuildAction({ + actionName: 'Build', + project, + executeBatchBuild: true, + input: sourceOutput, + role: pipelineRole, +}); +pipeline.addStage({ + stageName: 'Build', + actions: [ + buildAction, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY29kZS1idWlsZC1iYXRjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLWNvZGUtYnVpbGQtYmF0Y2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBdUQ7QUFDdkQseURBQXlEO0FBQ3pELDZEQUE2RDtBQUM3RCx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLGtFQUFrRTtBQUVsRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHNDQUFzQyxDQUFDLENBQUM7QUFFekUsTUFBTSxVQUFVLEdBQUcsSUFBSSxVQUFVLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDNUQsY0FBYyxFQUFFLHFCQUFxQjtDQUN0QyxDQUFDLENBQUM7QUFDSCxNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUM5QyxTQUFTLEVBQUUsSUFBSTtJQUNmLGFBQWEsRUFBRSxHQUFHLENBQUMsYUFBYSxDQUFDLE9BQU87Q0FDekMsQ0FBQyxDQUFDO0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WNrZXQ6IGJ1Y2tldCxcbn0pO1xuY29uc3QgcGlwZWxpbmVSb2xlID0gcGlwZWxpbmUucm9sZTtcblxuY29uc3Qgc291cmNlT3V0cHV0ID0gbmV3IGNvZGVwaXBlbGluZS5BcnRpZmFjdCgpO1xuY29uc3Qgc291cmNlQWN0aW9uID0gbmV3IGNwYWN0aW9ucy5Db2RlQ29tbWl0U291cmNlQWN0aW9uKHtcbiAgYWN0aW9uTmFtZTogJ1NvdXJjZScsXG4gIHJlcG9zaXRvcnksXG4gIG91dHB1dDogc291cmNlT3V0cHV0LFxuICByb2xlOiBwaXBlbGluZVJvbGUsXG59KTtcbnBpcGVsaW5lLmFkZFN0YWdlKHtcbiAgc3RhZ2VOYW1lOiAnU291cmNlJyxcbiAgYWN0aW9uczogW1xuICAgIHNvdXJjZUFjdGlvbixcbiAgXSxcbn0pO1xuXG5jb25zdCBwcm9qZWN0ID0gbmV3IGNvZGVidWlsZC5QaXBlbGluZVByb2plY3Qoc3RhY2ssICdNeUJ1aWxkUHJvamVjdCcsIHtcbiAgZ3JhbnRSZXBvcnRHcm91cFBlcm1pc3Npb25zOiBmYWxzZSxcbn0pO1xuY29uc3QgYnVpbGRBY3Rpb24gPSBuZXcgY3BhY3Rpb25zLkNvZGVCdWlsZEFjdGlvbih7XG4gIGFjdGlvbk5hbWU6ICdCdWlsZCcsXG4gIHByb2plY3QsXG4gIGV4ZWN1dGVCYXRjaEJ1aWxkOiB0cnVlLFxuICBpbnB1dDogc291cmNlT3V0cHV0LFxuICByb2xlOiBwaXBlbGluZVJvbGUsXG59KTtcbnBpcGVsaW5lLmFkZFN0YWdlKHtcbiAgc3RhZ2VOYW1lOiAnQnVpbGQnLFxuICBhY3Rpb25zOiBbXG4gICAgYnVpbGRBY3Rpb24sXG4gIF0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/aws-cdk-codepipeline-codebuild-batch.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.ts similarity index 77% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.ts index d5fe1b2fb9b2f..3da6c4609cced 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.ts @@ -1,9 +1,9 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js new file mode 100644 index 0000000000000..5235d502fbbc8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codebuild-multiple-inputs-outputs'); +const repository = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'MyIntegTestTempRepo', +}); +const bucket = new s3.Bucket(stack, 'MyBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, +}); +const pipelineRole = pipeline.role; +const source1Output = new codepipeline.Artifact(); +const sourceAction1 = new cpactions.CodeCommitSourceAction({ + actionName: 'Source1', + repository, + output: source1Output, + role: pipelineRole, +}); +const source2Output = new codepipeline.Artifact(); +const sourceAction2 = new cpactions.S3SourceAction({ + actionName: 'Source2', + bucketKey: 'some/path', + bucket, + output: source2Output, + role: pipelineRole, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [ + sourceAction1, + sourceAction2, + ], +}); +const project = new codebuild.PipelineProject(stack, 'MyBuildProject', { + grantReportGroupPermissions: false, +}); +const buildAction = new cpactions.CodeBuildAction({ + actionName: 'Build1', + project, + input: source1Output, + extraInputs: [ + source2Output, + ], + outputs: [ + new codepipeline.Artifact(), + new codepipeline.Artifact(), + ], + role: pipelineRole, +}); +const testAction = new cpactions.CodeBuildAction({ + type: cpactions.CodeBuildActionType.TEST, + actionName: 'Build2', + project, + input: source2Output, + extraInputs: [ + source1Output, + ], + outputs: [ + new codepipeline.Artifact('CustomOutput2'), + ], + role: pipelineRole, +}); +pipeline.addStage({ + stageName: 'Build', + actions: [ + buildAction, + testAction, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY29kZS1idWlsZC1tdWx0aXBsZS1pbnB1dHMtb3V0cHV0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLWNvZGUtYnVpbGQtbXVsdGlwbGUtaW5wdXRzLW91dHB1dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBdUQ7QUFDdkQseURBQXlEO0FBQ3pELDZEQUE2RDtBQU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gICB0ZXN0QWN0aW9uLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/aws-cdk-codepipeline-codebuild-multiple-inputs-outputs.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.ts similarity index 84% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.ts index c09c1a3328545..81458ec6ed0ca 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.ts @@ -1,9 +1,9 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js new file mode 100644 index 0000000000000..f48fac5cc90ad --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +/* eslint-disable quote-props */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codecommit-codebuild'); +const repository = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'my-repo', +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const sourceAction = new cpactions.CodeCommitSourceAction({ + actionName: 'source', + output: sourceOutput, + repository, + trigger: cpactions.CodeCommitTrigger.POLL, +}); +const project = new codebuild.PipelineProject(stack, 'MyBuildProject', { + grantReportGroupPermissions: false, +}); +const buildAction = new cpactions.CodeBuildAction({ + actionName: 'build', + project, + input: sourceOutput, + outputs: [new codepipeline.Artifact()], + environmentVariables: { + 'TEST_ENV_VARIABLE': { + value: 'test env variable value', + }, + 'PARAM_STORE_VARIABLE': { + value: 'param_store', + type: codebuild.BuildEnvironmentVariableType.PARAMETER_STORE, + }, + }, +}); +const testAction = new cpactions.CodeBuildAction({ + type: cpactions.CodeBuildActionType.TEST, + actionName: 'test', + project, + input: sourceOutput, +}); +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'source', + actions: [sourceAction], + }, + ], +}).addStage({ + stageName: 'build', + actions: [ + buildAction, + testAction, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY29kZS1jb21taXQtYnVpbGQuanMiLCJzb3VyY2VSb290Ijo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ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/aws-cdk-codepipeline-codecommit-codebuild.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts similarity index 83% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts index 921227a3224ba..1182f775c775b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.ts @@ -1,8 +1,8 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js new file mode 100644 index 0000000000000..e5d6fb6127a09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codecommit'); +const repo = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'my-repo', +}); +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'source', + actions: [ + new cpactions.CodeCommitSourceAction({ + actionName: 'source', + repository: repo, + output: new codepipeline.Artifact('SourceArtifact'), + }), + ], + }, + { + stageName: 'build', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'manual' }), + ], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY29kZS1jb21taXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5waXBlbGluZS1jb2RlLWNvbW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUF5RDtBQUN6RCw2REFBNkQ7QUFDN0QsbUNBQW1DO0FBQ25DLGtFQUFrRTtBQUVsRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGlDQUFpQyxDQUFDLENBQUM7QUFFcEUsTUFBTSxJQUFJLEdBQUcsSUFBSSxVQUFVLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUU7SUFDdEQsY0FBYyxFQUFFLFNBQVM7Q0FDMUIsQ0FBQyxDQUFDO0FBRUgsSUFBSSxZQUFZLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDM0MsTUFBTSxFQUFFO1FBQ047WUFDRSxTQUFTLEVBQUUsUUFBUTtZQUNuQixPQUFPLEVBQUU7Z0JBQ1AsSUFBSSxTQUFTLENBQUMsc0JBQXNCLENBQUM7b0JBQ25DLFVBQVUsRUFBRSxRQUFRO29CQUNwQixVQUFVLEVBQUUsSUFBSTtvQkFDaEIsTUFBTSxFQUFFLElBQUksWUFBWSxDQUFDLFFBQVEsQ0FBQyxnQkFBZ0IsQ0FBQztpQkFDcEQsQ0FBQzthQUNIO1NBQ0Y7UUFDRDtZQUNFLF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XRvcnk6IHJlcG8sXG4gICAgICAgICAgb3V0cHV0OiBuZXcgY29kZXBpcGVsaW5lLkFydGlmYWN0KCdTb3VyY2VBcnRpZmFjdCcpLFxuICAgICAgICB9KSxcbiAgICAgIF0sXG4gICAgfSxcbiAgICB7XG4gICAgICBzdGFnZU5hbWU6ICdidWlsZCcsXG4gICAgICBhY3Rpb25zOiBbXG4gICAgICAgIG5ldyBjcGFjdGlvbnMuTWFudWFsQXBwcm92YWxBY3Rpb24oeyBhY3Rpb25OYW1lOiAnbWFudWFsJyB9KSxcbiAgICAgIF0sXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/aws-cdk-codepipeline-codecommit.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeilne-elastic-beanstalk-deploy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.ts new file mode 100644 index 0000000000000..7aabb4641a7da --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-commit.ts @@ -0,0 +1,35 @@ +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codecommit'); + +const repo = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'my-repo', +}); + +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'source', + actions: [ + new cpactions.CodeCommitSourceAction({ + actionName: 'source', + repository: repo, + output: new codepipeline.Artifact('SourceArtifact'), + }), + ], + }, + { + stageName: 'build', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'manual' }), + ], + }, + ], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js new file mode 100644 index 0000000000000..e0cf8fb45a55d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codedeploy-ecs'); +const application = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'CodeDeployApplication', 'IntegTestDeployApp'); +const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'CodeDeployGroup', { + application, + deploymentGroupName: 'IntegTestDeploymentGroup', +}); +const bucket = new s3.Bucket(stack, 'CodeDeployPipelineIntegTest', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, +}); +const sourceStage = pipeline.addStage({ stageName: 'Source' }); +const sourceOutput = new codepipeline.Artifact('SourceOutput'); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'S3Source', + bucketKey: 'application.zip', + output: sourceOutput, + bucket, +}); +sourceStage.addAction(sourceAction); +const deployStage = pipeline.addStage({ stageName: 'Deploy' }); +deployStage.addAction(new cpactions.CodeDeployEcsDeployAction({ + actionName: 'CodeDeploy', + deploymentGroup, + taskDefinitionTemplateFile: new codepipeline.ArtifactPath(sourceOutput, 'task-definition-test.json'), + appSpecTemplateFile: new codepipeline.ArtifactPath(sourceOutput, 'appspec-test.json'), + containerImageInputs: [ + { + input: sourceOutput, + taskDefinitionPlaceholder: 'PLACEHOLDER', + }, + ], +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY29kZS1kZXBsb3ktZWNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtY29kZS1kZXBsb3ktZWNzLnRzIl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RUhPTERFUicsXG4gICAgfSxcbiAgXSxcbn0pKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/aws-cdk-codepipeline-codedeploy-ecs.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.ts similarity index 84% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.ts index e0ea29370ddaf..64918283d95e6 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy-ecs.ts @@ -1,8 +1,8 @@ -import * as codedeploy from '@aws-cdk/aws-codedeploy'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js new file mode 100644 index 0000000000000..be241f84390e8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codedeploy = require("aws-cdk-lib/aws-codedeploy"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codedeploy'); +const application = new codedeploy.ServerApplication(stack, 'CodeDeployApplication', { + applicationName: 'IntegTestDeployApp', +}); +const deploymentConfig = new codedeploy.ServerDeploymentConfig(stack, 'CustomDeployConfig', { + minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(0), +}); +const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'CodeDeployGroup', { + application, + deploymentGroupName: 'IntegTestDeploymentGroup', + deploymentConfig, +}); +const bucket = new s3.Bucket(stack, 'CodeDeployPipelineIntegTest', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, +}); +const sourceStage = pipeline.addStage({ stageName: 'Source' }); +const sourceOutput = new codepipeline.Artifact('SourceOutput'); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'S3Source', + bucketKey: 'application.zip', + output: sourceOutput, + bucket, +}); +sourceStage.addAction(sourceAction); +const deployStage = pipeline.addStage({ stageName: 'Deploy' }); +deployStage.addAction(new cpactions.CodeDeployServerDeployAction({ + actionName: 'CodeDeploy', + deploymentGroup, + input: sourceOutput, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtY29kZS1kZXBsb3kuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5waXBlbGluZS1jb2RlLWRlcGxveS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUF5RDtBQUN6RCw2REFBNkQ7QUFDN0QseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyxrRUFBa0U7QUFFbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENB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3RhZ2VOYW1lOiAnU291cmNlJyB9KTtcbmNvbnN0IHNvdXJjZU91dHB1dCA9IG5ldyBjb2RlcGlwZWxpbmUuQXJ0aWZhY3QoJ1NvdXJjZU91dHB1dCcpO1xuY29uc3Qgc291cmNlQWN0aW9uID0gbmV3IGNwYWN0aW9ucy5TM1NvdXJjZUFjdGlvbih7XG4gIGFjdGlvbk5hbWU6ICdTM1NvdXJjZScsXG4gIGJ1Y2tldEtleTogJ2FwcGxpY2F0aW9uLnppcCcsXG4gIG91dHB1dDogc291cmNlT3V0cHV0LFxuICBidWNrZXQsXG59KTtcbnNvdXJjZVN0YWdlLmFkZEFjdGlvbihzb3VyY2VBY3Rpb24pO1xuXG5jb25zdCBkZXBsb3lTdGFnZSA9IHBpcGVsaW5lLmFkZFN0YWdlKHsgc3RhZ2VOYW1lOiAnRGVwbG95JyB9KTtcbmRlcGxveVN0YWdlLmFkZEFjdGlvbihuZXcgY3BhY3Rpb25zLkNvZGVEZXBsb3lTZXJ2ZXJEZXBsb3lBY3Rpb24oe1xuICBhY3Rpb25OYW1lOiAnQ29kZURlcGxveScsXG4gIGRlcGxveW1lbnRHcm91cCxcbiAgaW5wdXQ6IHNvdXJjZU91dHB1dCxcbn0pKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/aws-cdk-codepipeline-codedeploy.template.json diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.ts similarity index 83% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.ts index dd91836f7c559..c285bf36e9c11 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-code-deploy.ts @@ -1,8 +1,8 @@ -import * as codedeploy from '@aws-cdk/aws-codedeploy'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js new file mode 100644 index 0000000000000..d5fde87f1b5df --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +/** + * Manual validation steps + * + * Run test with `-vv` so that the outputs are printed and + * `--no-clean` flag so that the stack is not deleted after the deployment is complete + * + * You should see output like: + * + * Outputs: + * aws-cdk-codepipeline-ecr-source.PipelineConsoleLink = https://us-east-1.console.aws.amazon.com/codesuite/codepipeline/pipelines/aws-cdk-codepipeline-ecr-source-MyPipelineAED38ECF-1P0OYRLWF8FHY/view?region=us-east-1 + * aws-cdk-codepipeline-ecr-source.LoginCommand = aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 11111111111.dkr.ecr.us-east-1.amazonaws.com + * aws-cdk-codepipeline-ecr-source.PushCommand = docker tag public.ecr.aws/lambda/provided 11111111111.dkr.ecr.us-east-1.amazonaws.com/aws-cdk-codepipeline-ecr-source-myecrrepo767466d0-gsrntpvfwc5w:latest \ + * && docker push 11111111111.dkr.ecr.us-east-1.amazonaws.com/aws-cdk-codepipeline-ecr-source-myecrrepo767466d0-gsrntpvfwc5w:latest + * + * Run the LoginCommand & PushCommand to tag and push an image to the ECR repository. + * Then use the PipelineConsoleLink to navigate to the pipeline console page to validate that the pipeline + * was triggered successfully. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-ecr-source'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const pipeline = new codepipeline.Pipeline(stack, 'MyPipeline', { + artifactBucket: bucket, +}); +const repository = new ecr.Repository(stack, 'MyEcrRepo', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const sourceStage = pipeline.addStage({ stageName: 'Source' }); +sourceStage.addAction(new cpactions.EcrSourceAction({ + actionName: 'ECR_Source', + output: new codepipeline.Artifact(), + repository, +})); +const approveStage = pipeline.addStage({ stageName: 'Approve' }); +approveStage.addAction(new cpactions.ManualApprovalAction({ actionName: 'ManualApproval' })); +new cdk.CfnOutput(stack, 'LoginCommand', { + value: `aws ecr get-login-password --region ${stack.region} | docker login --username AWS --password-stdin ${stack.account}.dkr.ecr.${stack.region}.amazonaws.com`, +}); +new cdk.CfnOutput(stack, 'PushCommand', { + value: `docker tag public.ecr.aws/lambda/provided ${repository.repositoryUriForTag('latest')} && docker push ${repository.repositoryUriForTag('latest')}`, +}); +new cdk.CfnOutput(stack, 'PipelineConsoleLink', { + value: `https://${stack.region}.console.aws.amazon.com/codesuite/codepipeline/pipelines/${pipeline.pipelineName}/view?region=${stack.region}`, +}); +new integ_tests_alpha_1.IntegTest(app, 'ecr-source-action', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtZWNyLXNvdXJjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLWVjci1zb3VyY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2REFBNkQ7QUFDN0QsMkNBQTJDO0FBQzNDLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3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H0uZGtyLmVjci4ke3N0YWNrLnJlZ2lvbn0uYW1hem9uYXdzLmNvbWAsXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdQdXNoQ29tbWFuZCcsIHtcbiAgdmFsdWU6IGBkb2NrZXIgdGFnIHB1YmxpYy5lY3IuYXdzL2xhbWJkYS9wcm92aWRlZCAke3JlcG9zaXRvcnkucmVwb3NpdG9yeVVyaUZvclRhZygnbGF0ZXN0Jyl9ICYmIGRvY2tlciBwdXNoICR7cmVwb3NpdG9yeS5yZXBvc2l0b3J5VXJpRm9yVGFnKCdsYXRlc3QnKX1gLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnUGlwZWxpbmVDb25zb2xlTGluaycsIHtcbiAgdmFsdWU6IGBodHRwczovLyR7c3RhY2sucmVnaW9ufS5jb25zb2xlLmF3cy5hbWF6b24uY29tL2NvZGVzdWl0ZS9jb2RlcGlwZWxpbmUvcGlwZWxpbmVzLyR7cGlwZWxpbmUucGlwZWxpbmVOYW1lfS92aWV3P3JlZ2lvbj0ke3N0YWNrLnJlZ2lvbn1gLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnZWNyLXNvdXJjZS1hY3Rpb24nLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/aws-cdk-codepipeline-ecr-source.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/ecrsourceactionDefaultTestDeployAssert981BA701.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.ts similarity index 89% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.ts index 96352d7606838..ec5f23a5dccf6 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecr-source.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecr-source.ts @@ -1,9 +1,9 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; /** * Manual validation steps diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js new file mode 100644 index 0000000000000..e8086d73b5c88 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js @@ -0,0 +1,107 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +/* eslint-disable quote-props */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-ecs-deploy'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 1, +}); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { + vpc, +}); +const repository = new ecr.Repository(stack, 'EcrRepo'); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +const containerName = 'Container'; +taskDefinition.addContainer(containerName, { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), +}); +const service = new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, +}); +const bucket = new s3.Bucket(stack, 'MyBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'Source', + output: sourceOutput, + bucket, + bucketKey: 'path/to/Dockerfile', +}); +const project = new codebuild.PipelineProject(stack, 'EcsProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_DOCKER_17_09_0, + privileged: true, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + pre_build: { + commands: '$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)', + }, + build: { + commands: 'docker build -t $REPOSITORY_URI:latest .', + }, + post_build: { + commands: [ + 'docker push $REPOSITORY_URI:latest', + `printf '[{ "name": "${containerName}", "imageUri": "%s" }]' $REPOSITORY_URI:latest > imagedefinitions.json`, + ], + }, + }, + artifacts: { + files: 'imagedefinitions.json', + }, + }), + environmentVariables: { + 'REPOSITORY_URI': { + value: repository.repositoryUri, + }, + }, + grantReportGroupPermissions: false, +}); +// needed for `docker push` +repository.grantPullPush(project); +const buildOutput = new codepipeline.Artifact(); +const buildAction = new cpactions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + outputs: [buildOutput], +}); +new codepipeline.Pipeline(stack, 'MyPipeline', { + artifactBucket: bucket, + stages: [ + { + stageName: 'Source', + actions: [sourceAction], + }, + { + stageName: 'Build', + actions: [buildAction], + }, + { + stageName: 'Deploy', + actions: [ + new cpactions.EcsDeployAction({ + actionName: 'DeployAction', + input: buildOutput, + service, + deploymentTimeout: cdk.Duration.minutes(60), + }), + ], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtZWNzLWRlcGxveS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLWVjcy1kZXBsb3kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBdUQ7QUFDdkQsNkRBQTZEO0FBQzdELDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsa0VBQWtFO0FBRWxFLGdDQUFnQztBQUVoQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGlDQUFpQyxDQUFDLENBQUM7QUFFcEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBR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0cHV0LFxuICBvdXRwdXRzOiBbYnVpbGRPdXRwdXRdLFxufSk7XG5cbm5ldyBjb2RlcGlwZWxpbmUuUGlwZWxpbmUoc3RhY2ssICdNeVBpcGVsaW5lJywge1xuICBhcnRpZmFjdEJ1Y2tldDogYnVja2V0LFxuICBzdGFnZXM6IFtcbiAgICB7XG4gICAgICBzdGFnZU5hbWU6ICdTb3VyY2UnLFxuICAgICAgYWN0aW9uczogW3NvdXJjZUFjdGlvbl0sXG4gICAgfSxcbiAgICB7XG4gICAgICBzdGFnZU5hbWU6ICdCdWlsZCcsXG4gICAgICBhY3Rpb25zOiBbYnVpbGRBY3Rpb25dLFxuICAgIH0sXG4gICAge1xuICAgICAgc3RhZ2VOYW1lOiAnRGVwbG95JyxcbiAgICAgIGFjdGlvbnM6IFtcbiAgICAgICAgbmV3IGNwYWN0aW9ucy5FY3NEZXBsb3lBY3Rpb24oe1xuICAgICAgICAgIGFjdGlvbk5hbWU6ICdEZXBsb3lBY3Rpb24nLFxuICAgICAgICAgIGlucHV0OiBidWlsZE91dHB1dCxcbiAgICAgICAgICBzZXJ2aWNlLFxuICAgICAgICAgIGRlcGxveW1lbnRUaW1lb3V0OiBjZGsuRHVyYXRpb24ubWludXRlcyg2MCksXG4gICAgICAgIH0pLFxuICAgICAgXSxcbiAgICB9LFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/aws-cdk-codepipeline-ecs-deploy.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts similarity index 87% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts index 08c5b970112b1..49a26b6dcdd91 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.ts @@ -1,11 +1,11 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.d.ts new file mode 100644 index 0000000000000..bf50cc959d615 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.d.ts @@ -0,0 +1,31 @@ +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +/** + * This example demonstrates how to create a CodePipeline that deploys an ECS Service + * from a different source repository than the source repository of your CDK code. + * If your application code and your CDK code are in the same repository, + * use the CDK Pipelines module instead of this method. + */ +/** + * These are the construction properties for `EcsAppStack`. + * They extend the standard Stack properties, + * but also require providing the ContainerImage that the service will use. + * That Image will be provided from the Stack containing the CodePipeline. + */ +export interface EcsAppStackProps extends cdk.StackProps { + readonly image: ecs.ContainerImage; +} +/** + * This is the Stack containing a simple ECS Service that uses the provided ContainerImage. + */ +export declare class EcsAppStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: EcsAppStackProps); +} +/** + * This is the Stack containing the CodePipeline definition that deploys an ECS Service. + */ +export declare class PipelineStack extends cdk.Stack { + readonly tagParameterContainerImage: ecs.TagParameterContainerImage; + constructor(scope: Construct, id: string, props?: cdk.StackProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js new file mode 100644 index 0000000000000..5c23bd68d6bf6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js @@ -0,0 +1,192 @@ +"use strict"; +/// !cdk-integ * +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PipelineStack = exports.EcsAppStack = void 0; +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const codepipeline_actions = require("aws-cdk-lib/aws-codepipeline-actions"); +/** + * This is the Stack containing a simple ECS Service that uses the provided ContainerImage. + */ +class EcsAppStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const taskDefinition = new ecs.TaskDefinition(this, 'TaskDefinition', { + compatibility: ecs.Compatibility.FARGATE, + cpu: '1024', + memoryMiB: '2048', + }); + taskDefinition.addContainer('AppContainer', { + image: props.image, + }); + new ecs.FargateService(this, 'EcsService', { + taskDefinition, + cluster: new ecs.Cluster(this, 'Cluster', { + vpc: new ec2.Vpc(this, 'Vpc', { + maxAzs: 1, + }), + }), + }); + } +} +exports.EcsAppStack = EcsAppStack; +/** + * This is the Stack containing the CodePipeline definition that deploys an ECS Service. + */ +class PipelineStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /* ********** ECS part **************** */ + // this is the ECR repository where the built Docker image will be pushed + const appEcrRepo = new ecr.Repository(this, 'EcsDeployRepository'); + // the build that creates the Docker image, and pushes it to the ECR repo + const appCodeDockerBuild = new codebuild.PipelineProject(this, 'AppCodeDockerImageBuildAndPushProject', { + environment: { + // we need to run Docker + privileged: true, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + // login to ECR first + '$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)', + // if your application needs any build steps, they would be invoked here + // build the image, and tag it with the commit hash + // (CODEBUILD_RESOLVED_SOURCE_VERSION is a special environment variable available in CodeBuild) + 'docker build -t $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION .', + ], + }, + post_build: { + commands: [ + // push the built image into the ECR repository + 'docker push $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION', + // save the declared tag as an environment variable, + // that is then exported below in the 'exported-variables' section as a CodePipeline Variable + 'export imageTag=$CODEBUILD_RESOLVED_SOURCE_VERSION', + ], + }, + }, + env: { + // save the imageTag environment variable as a CodePipeline Variable + 'exported-variables': [ + 'imageTag', + ], + }, + }), + environmentVariables: { + REPOSITORY_URI: { + value: appEcrRepo.repositoryUri, + }, + }, + }); + // needed for `docker push` + appEcrRepo.grantPullPush(appCodeDockerBuild); + // create the ContainerImage used for the ECS application Stack + this.tagParameterContainerImage = new ecs.TagParameterContainerImage(appEcrRepo); + const cdkCodeBuild = new codebuild.PipelineProject(this, 'CdkCodeBuildProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: [ + 'npm install', + ], + }, + build: { + commands: [ + // synthesize the CDK code for the ECS application Stack + 'npx cdk synth --verbose', + ], + }, + }, + artifacts: { + // store the entire Cloud Assembly as the output artifact + 'base-directory': 'cdk.out', + 'files': '**/*', + }, + }), + }); + /* ********** Pipeline part **************** */ + const appCodeSourceOutput = new codepipeline.Artifact(); + const cdkCodeSourceOutput = new codepipeline.Artifact(); + const cdkCodeBuildOutput = new codepipeline.Artifact(); + const appCodeBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'AppCodeDockerImageBuildAndPush', + project: appCodeDockerBuild, + input: appCodeSourceOutput, + }); + new codepipeline.Pipeline(this, 'CodePipelineDeployingEcsApplication', { + artifactBucket: new s3.Bucket(this, 'ArtifactBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + stages: [ + { + stageName: 'Source', + actions: [ + // this is the Action that takes the source of your application code + new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'AppCodeSource', + repository: new codecommit.Repository(this, 'AppCodeSourceRepository', { repositoryName: 'AppCodeSourceRepository' }), + output: appCodeSourceOutput, + }), + // this is the Action that takes the source of your CDK code + // (which would probably include this Pipeline code as well) + new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CdkCodeSource', + repository: new codecommit.Repository(this, 'CdkCodeSourceRepository', { repositoryName: 'CdkCodeSourceRepository' }), + output: cdkCodeSourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + appCodeBuildAction, + new codepipeline_actions.CodeBuildAction({ + actionName: 'CdkCodeBuildAndSynth', + project: cdkCodeBuild, + input: cdkCodeSourceOutput, + outputs: [cdkCodeBuildOutput], + }), + ], + }, + { + stageName: 'Deploy', + actions: [ + new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'CFN_Deploy', + stackName: 'SampleEcsStackDeployedFromCodePipeline', + // this name has to be the same name as used below in the CDK code for the application Stack + templatePath: cdkCodeBuildOutput.atPath('EcsStackDeployedInPipeline.template.json'), + adminPermissions: true, + parameterOverrides: { + // read the tag pushed to the ECR repository from the CodePipeline Variable saved by the application build step, + // and pass it as the CloudFormation Parameter for the tag + [this.tagParameterContainerImage.tagParameterName]: appCodeBuildAction.variable('imageTag'), + }, + }), + ], + }, + ], + }); + } +} +exports.PipelineStack = PipelineStack; +const app = new cdk.App(); +// the CodePipeline Stack needs to be created first +const pipelineStack = new PipelineStack(app, 'aws-cdk-pipeline-ecs-separate-sources'); +// we supply the image to the ECS application Stack from the CodePipeline Stack +new EcsAppStack(app, 'EcsStackDeployedInPipeline', { + image: pipelineStack.tagParameterContainerImage, +}); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtZWNzLXNlcGFyYXRlLXNvdXJjZS5saXQuanMiLCJzb3VyY2VSb290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FnUGFyYW1ldGVyTmFtZV06IGFwcENvZGVCdWlsZEFjdGlvbi52YXJpYWJsZSgnaW1hZ2VUYWcnKSxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH0pLFxuICAgICAgICAgIF0sXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbi8vIHRoZSBDb2RlUGlwZWxpbmUgU3RhY2sgbmVlZHMgdG8gYmUgY3JlYXRlZCBmaXJzdFxuY29uc3QgcGlwZWxpbmVTdGFjayA9IG5ldyBQaXBlbGluZVN0YWNrKGFwcCwgJ2F3cy1jZGstcGlwZWxpbmUtZWNzLXNlcGFyYXRlLXNvdXJjZXMnKTtcbi8vIHdlIHN1cHBseSB0aGUgaW1hZ2UgdG8gdGhlIEVDUyBhcHBsaWNhdGlvbiBTdGFjayBmcm9tIHRoZSBDb2RlUGlwZWxpbmUgU3RhY2tcbm5ldyBFY3NBcHBTdGFjayhhcHAsICdFY3NTdGFja0RlcGxveWVkSW5QaXBlbGluZScsIHtcbiAgaW1hZ2U6IHBpcGVsaW5lU3RhY2sudGFnUGFyYW1ldGVyQ29udGFpbmVySW1hZ2UsXG59KTtcbi8vLyAhaGlkZVxuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/EcsStackDeployedInPipeline.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/EcsStackDeployedInPipeline.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/EcsStackDeployedInPipeline.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/EcsStackDeployedInPipeline.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/aws-cdk-pipeline-ecs-separate-sources.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/aws-cdk-pipeline-ecs-separate-sources.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/aws-cdk-pipeline-ecs-separate-sources.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/aws-cdk-pipeline-ecs-separate-sources.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts new file mode 100644 index 0000000000000..d01901bf175e2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts @@ -0,0 +1,221 @@ +/// !cdk-integ * + +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; + +/** + * This example demonstrates how to create a CodePipeline that deploys an ECS Service + * from a different source repository than the source repository of your CDK code. + * If your application code and your CDK code are in the same repository, + * use the CDK Pipelines module instead of this method. + */ + +/// !show + +/** + * These are the construction properties for `EcsAppStack`. + * They extend the standard Stack properties, + * but also require providing the ContainerImage that the service will use. + * That Image will be provided from the Stack containing the CodePipeline. + */ +export interface EcsAppStackProps extends cdk.StackProps { + readonly image: ecs.ContainerImage; +} + +/** + * This is the Stack containing a simple ECS Service that uses the provided ContainerImage. + */ +export class EcsAppStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: EcsAppStackProps) { + super(scope, id, props); + + const taskDefinition = new ecs.TaskDefinition(this, 'TaskDefinition', { + compatibility: ecs.Compatibility.FARGATE, + cpu: '1024', + memoryMiB: '2048', + }); + taskDefinition.addContainer('AppContainer', { + image: props.image, + }); + new ecs.FargateService(this, 'EcsService', { + taskDefinition, + cluster: new ecs.Cluster(this, 'Cluster', { + vpc: new ec2.Vpc(this, 'Vpc', { + maxAzs: 1, + }), + }), + }); + } +} + +/** + * This is the Stack containing the CodePipeline definition that deploys an ECS Service. + */ +export class PipelineStack extends cdk.Stack { + public readonly tagParameterContainerImage: ecs.TagParameterContainerImage; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /* ********** ECS part **************** */ + + // this is the ECR repository where the built Docker image will be pushed + const appEcrRepo = new ecr.Repository(this, 'EcsDeployRepository'); + // the build that creates the Docker image, and pushes it to the ECR repo + const appCodeDockerBuild = new codebuild.PipelineProject(this, 'AppCodeDockerImageBuildAndPushProject', { + environment: { + // we need to run Docker + privileged: true, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + // login to ECR first + '$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)', + // if your application needs any build steps, they would be invoked here + + // build the image, and tag it with the commit hash + // (CODEBUILD_RESOLVED_SOURCE_VERSION is a special environment variable available in CodeBuild) + 'docker build -t $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION .', + ], + }, + post_build: { + commands: [ + // push the built image into the ECR repository + 'docker push $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION', + // save the declared tag as an environment variable, + // that is then exported below in the 'exported-variables' section as a CodePipeline Variable + 'export imageTag=$CODEBUILD_RESOLVED_SOURCE_VERSION', + ], + }, + }, + env: { + // save the imageTag environment variable as a CodePipeline Variable + 'exported-variables': [ + 'imageTag', + ], + }, + }), + environmentVariables: { + REPOSITORY_URI: { + value: appEcrRepo.repositoryUri, + }, + }, + }); + // needed for `docker push` + appEcrRepo.grantPullPush(appCodeDockerBuild); + // create the ContainerImage used for the ECS application Stack + this.tagParameterContainerImage = new ecs.TagParameterContainerImage(appEcrRepo); + + const cdkCodeBuild = new codebuild.PipelineProject(this, 'CdkCodeBuildProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: [ + 'npm install', + ], + }, + build: { + commands: [ + // synthesize the CDK code for the ECS application Stack + 'npx cdk synth --verbose', + ], + }, + }, + artifacts: { + // store the entire Cloud Assembly as the output artifact + 'base-directory': 'cdk.out', + 'files': '**/*', + }, + }), + }); + + /* ********** Pipeline part **************** */ + + const appCodeSourceOutput = new codepipeline.Artifact(); + const cdkCodeSourceOutput = new codepipeline.Artifact(); + const cdkCodeBuildOutput = new codepipeline.Artifact(); + const appCodeBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'AppCodeDockerImageBuildAndPush', + project: appCodeDockerBuild, + input: appCodeSourceOutput, + }); + new codepipeline.Pipeline(this, 'CodePipelineDeployingEcsApplication', { + artifactBucket: new s3.Bucket(this, 'ArtifactBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + stages: [ + { + stageName: 'Source', + actions: [ + // this is the Action that takes the source of your application code + new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'AppCodeSource', + repository: new codecommit.Repository(this, 'AppCodeSourceRepository', { repositoryName: 'AppCodeSourceRepository' }), + output: appCodeSourceOutput, + }), + // this is the Action that takes the source of your CDK code + // (which would probably include this Pipeline code as well) + new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CdkCodeSource', + repository: new codecommit.Repository(this, 'CdkCodeSourceRepository', { repositoryName: 'CdkCodeSourceRepository' }), + output: cdkCodeSourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + appCodeBuildAction, + new codepipeline_actions.CodeBuildAction({ + actionName: 'CdkCodeBuildAndSynth', + project: cdkCodeBuild, + input: cdkCodeSourceOutput, + outputs: [cdkCodeBuildOutput], + }), + ], + }, + { + stageName: 'Deploy', + actions: [ + new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'CFN_Deploy', + stackName: 'SampleEcsStackDeployedFromCodePipeline', + // this name has to be the same name as used below in the CDK code for the application Stack + templatePath: cdkCodeBuildOutput.atPath('EcsStackDeployedInPipeline.template.json'), + adminPermissions: true, + parameterOverrides: { + // read the tag pushed to the ECR repository from the CodePipeline Variable saved by the application build step, + // and pass it as the CloudFormation Parameter for the tag + [this.tagParameterContainerImage.tagParameterName]: appCodeBuildAction.variable('imageTag'), + }, + }), + ], + }, + ], + }); + } +} + +const app = new cdk.App(); + +// the CodePipeline Stack needs to be created first +const pipelineStack = new PipelineStack(app, 'aws-cdk-pipeline-ecs-separate-sources'); +// we supply the image to the ECS application Stack from the CodePipeline Stack +new EcsAppStack(app, 'EcsStackDeployedInPipeline', { + image: pipelineStack.tagParameterContainerImage, +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js new file mode 100644 index 0000000000000..25c01538b48d6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js @@ -0,0 +1,56 @@ +"use strict"; +// Use pipeline as CloudWAtch event target +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const events = require("aws-cdk-lib/aws-events"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-pipeline-event-target'); +const pipeline = new codepipeline.Pipeline(stack, 'MyPipeline'); +const repository = new codecommit.Repository(stack, 'CodeCommitRepo', { + repositoryName: 'foo', +}); +const project = new codebuild.PipelineProject(stack, 'BuildProject', { + grantReportGroupPermissions: false, +}); +const sourceOutput = new codepipeline.Artifact('Source'); +const sourceAction = new cpactions.CodeCommitSourceAction({ + actionName: 'CodeCommitSource', + output: sourceOutput, + repository, + trigger: cpactions.CodeCommitTrigger.POLL, +}); +const sourceStage = pipeline.addStage({ + stageName: 'Source', + actions: [sourceAction], +}); +pipeline.addStage({ + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'CodeBuildAction', + input: sourceOutput, + project, + outputs: [new codepipeline.Artifact()], + }), + ], +}); +const topic = new sns.Topic(stack, 'MyTopic'); +const eventPipeline = events.EventField.fromPath('$.detail.pipeline'); +const eventState = events.EventField.fromPath('$.detail.state'); +pipeline.onStateChange('OnPipelineStateChange', { + target: new targets.SnsTopic(topic, { + message: events.RuleTargetInput.fromText(`Pipeline ${eventPipeline} changed state to ${eventState}`), + }), +}); +sourceStage.onStateChange('OnSourceStateChange', new targets.SnsTopic(topic)); +sourceAction.onStateChange('OnActionStateChange', new targets.SnsTopic(topic)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0ZUNoYW5nZScsIG5ldyB0YXJnZXRzLlNuc1RvcGljKHRvcGljKSkuYWRkRXZlbnRQYXR0ZXJuKHtcbiAgZGV0YWlsOiB7IHN0YXRlOiBbJ1NUQVJURUQnXSB9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/aws-cdk-pipeline-event-target.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-cfn-cross-region.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.ts similarity index 78% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.ts index cc08d14ddb4da..cfb5178e2a316 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-events.ts @@ -1,13 +1,13 @@ // Use pipeline as CloudWAtch event target -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as events from '@aws-cdk/aws-events'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js new file mode 100644 index 0000000000000..e8d7ae27f2da1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-jenkins'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + versioned: true, +}); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, +}); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'S3', + bucketKey: 'some/path', + bucket, + output: sourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [sourceAction], +}); +const jenkinsProvider = new cpactions.JenkinsProvider(stack, 'JenkinsProvider', { + providerName: 'JenkinsProvider', + serverUrl: 'http://myjenkins.com:8080', + version: '2', +}); +pipeline.addStage({ + stageName: 'Build', + actions: [ + new cpactions.JenkinsAction({ + actionName: 'JenkinsBuild', + jenkinsProvider, + type: cpactions.JenkinsActionType.BUILD, + projectName: 'JenkinsProject1', + inputs: [sourceOutput], + outputs: [new codepipeline.Artifact()], + }), + new cpactions.JenkinsAction({ + actionName: 'JenkinsTest', + jenkinsProvider, + type: cpactions.JenkinsActionType.TEST, + projectName: 'JenkinsProject2', + inputs: [sourceOutput], + }), + new cpactions.JenkinsAction({ + actionName: 'JenkinsTest2', + jenkinsProvider, + type: cpactions.JenkinsActionType.TEST, + projectName: 'JenkinsProject3', + inputs: [sourceOutput], + }), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtamVua2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLWplbmtpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2REFBNkQ7QUFDN0QseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyxrRUFBa0U7QUFFbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw4QkFBO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AgYWN0aW9uTmFtZTogJ0plbmtpbnNCdWlsZCcsXG4gICAgICBqZW5raW5zUHJvdmlkZXIsXG4gICAgICB0eXBlOiBjcGFjdGlvbnMuSmVua2luc0FjdGlvblR5cGUuQlVJTEQsXG4gICAgICBwcm9qZWN0TmFtZTogJ0plbmtpbnNQcm9qZWN0MScsXG4gICAgICBpbnB1dHM6IFtzb3VyY2VPdXRwdXRdLFxuICAgICAgb3V0cHV0czogW25ldyBjb2RlcGlwZWxpbmUuQXJ0aWZhY3QoKV0sXG4gICAgfSksXG4gICAgbmV3IGNwYWN0aW9ucy5KZW5raW5zQWN0aW9uKHtcbiAgICAgIGFjdGlvbk5hbWU6ICdKZW5raW5zVGVzdCcsXG4gICAgICBqZW5raW5zUHJvdmlkZXIsXG4gICAgICB0eXBlOiBjcGFjdGlvbnMuSmVua2luc0FjdGlvblR5cGUuVEVTVCxcbiAgICAgIHByb2plY3ROYW1lOiAnSmVua2luc1Byb2plY3QyJyxcbiAgICAgIGlucHV0czogW3NvdXJjZU91dHB1dF0sXG4gICAgfSksXG4gICAgbmV3IGNwYWN0aW9ucy5KZW5raW5zQWN0aW9uKHtcbiAgICAgIGFjdGlvbk5hbWU6ICdKZW5raW5zVGVzdDInLFxuICAgICAgamVua2luc1Byb3ZpZGVyLFxuICAgICAgdHlwZTogY3BhY3Rpb25zLkplbmtpbnNBY3Rpb25UeXBlLlRFU1QsXG4gICAgICBwcm9qZWN0TmFtZTogJ0plbmtpbnNQcm9qZWN0MycsXG4gICAgICBpbnB1dHM6IFtzb3VyY2VPdXRwdXRdLFxuICAgIH0pLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/aws-cdk-codepipeline-jenkins.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.ts similarity index 87% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.ts index ed099690d7208..32bbe67756c6e 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-jenkins.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-jenkins.ts @@ -1,7 +1,7 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js new file mode 100644 index 0000000000000..aedc83d868211 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-manual-approval'); +const bucket = new s3.Bucket(stack, 'Bucket'); +new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'S3', + bucket, + bucketKey: 'file.zip', + output: new codepipeline.Artifact(), + }), + ], + }, + { + stageName: 'Approve', + actions: [ + new cpactions.ManualApprovalAction({ + actionName: 'ManualApproval', + notifyEmails: ['adamruka85@gmail.com'], + }), + ], + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtbWFudWFsLWFwcHJvdmFsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtbWFudWFsLWFwcHJvdmFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0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vdmFsJyxcbiAgICAgICAgICBub3RpZnlFbWFpbHM6IFsnYWRhbXJ1a2E4NUBnbWFpbC5jb20nXSxcbiAgICAgICAgfSksXG4gICAgICBdLFxuICAgIH0sXG4gIF0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/aws-cdk-codepipeline-manual-approval.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.ts similarity index 77% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.ts index 9b287506a5650..92c3569697ffc 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-manual-approval.ts @@ -1,7 +1,7 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js new file mode 100644 index 0000000000000..5a8739732872f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js @@ -0,0 +1,93 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-s3-deploy'); +const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const sourceAction = new cpactions.S3SourceAction({ + actionName: 'Source', + output: sourceOutput, + bucket, + bucketKey: 'key', +}); +const deployBucket = new s3.Bucket(stack, 'DeployBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const otherDeployBucket = new s3.Bucket(stack, 'OtherDeployBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: bucket, + stages: [ + { + stageName: 'Source', + actions: [sourceAction], + }, + { + stageName: 'Deploy', + actions: [ + new cpactions.S3DeployAction({ + actionName: 'DeployAction', + extract: false, + objectKey: 'key', + input: sourceOutput, + bucket: deployBucket, + accessControl: s3.BucketAccessControl.PRIVATE, + cacheControl: [ + cpactions.CacheControl.setPublic(), + cpactions.CacheControl.maxAge(cdk.Duration.hours(12)), + ], + }), + ], + }, + { + stageName: 'Disabled', + transitionToEnabled: false, + actions: [ + new cpactions.S3DeployAction({ + actionName: 'DisabledDeployAction', + input: sourceOutput, + bucket: otherDeployBucket, + }), + ], + }, + ], +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 's3-deploy-test', { + testCases: [stack], +}); +integ.assertions.awsApiCall('S3', 'putObject', { + Bucket: bucket.bucketName, + Key: 'key', + Body: 'HelloWorld', +}).next(integ.assertions.awsApiCall('CodePipeline', 'getPipelineState', { + name: pipeline.pipelineName, +}).expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + stageStates: integ_tests_alpha_1.Match.arrayWith([ + integ_tests_alpha_1.Match.objectLike({ + stageName: 'Deploy', + latestExecution: integ_tests_alpha_1.Match.objectLike({ + status: 'Succeeded', + }), + }), + ]), +})).waitForAssertions({ + totalTimeout: aws_cdk_lib_1.Duration.minutes(5), +}).next(integ.assertions.awsApiCall('S3', 'getObject', { + Bucket: deployB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xcbn0pO1xuXG5pbnRlZy5hc3NlcnRpb25zLmF3c0FwaUNhbGwoJ1MzJywgJ3B1dE9iamVjdCcsIHtcbiAgQnVja2V0OiBidWNrZXQuYnVja2V0TmFtZSxcbiAgS2V5OiAna2V5JyxcbiAgQm9keTogJ0hlbGxvV29ybGQnLFxufSkubmV4dChcbiAgaW50ZWcuYXNzZXJ0aW9ucy5hd3NBcGlDYWxsKCdDb2RlUGlwZWxpbmUnLCAnZ2V0UGlwZWxpbmVTdGF0ZScsIHtcbiAgICBuYW1lOiBwaXBlbGluZS5waXBlbGluZU5hbWUsXG4gIH0pLmV4cGVjdChFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgICBzdGFnZVN0YXRlczogTWF0Y2guYXJyYXlXaXRoKFtcbiAgICAgIE1hdGNoLm9iamVjdExpa2Uoe1xuICAgICAgICBzdGFnZU5hbWU6ICdEZXBsb3knLFxuICAgICAgICBsYXRlc3RFeGVjdXRpb246IE1hdGNoLm9iamVjdExpa2Uoe1xuICAgICAgICAgIHN0YXR1czogJ1N1Y2NlZWRlZCcsXG4gICAgICAgIH0pLFxuICAgICAgfSksXG4gICAgXSksXG4gIH0pKS53YWl0Rm9yQXNzZXJ0aW9ucyh7XG4gICAgdG90YWxUaW1lb3V0OiBEdXJhdGlvbi5taW51dGVzKDUpLFxuICB9KS5uZXh0KFxuICAgIGludGVnLmFzc2VydGlvbnMuYXdzQXBpQ2FsbCgnUzMnLCAnZ2V0T2JqZWN0Jywge1xuICAgICAgQnVja2V0OiBkZXBsb3lCdWNrZXQuYnVja2V0TmFtZSxcbiAgICAgIEtleTogJ2tleScsXG4gICAgfSksXG4gICksXG4pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/aws-cdk-codepipeline-s3-deploy.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/s3deploytestDefaultTestDeployAssert6BC61647.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.ts similarity index 90% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.ts index 3a683676d29dc..6ef696607bc8b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.ts @@ -1,9 +1,9 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { Duration } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests-alpha'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js new file mode 100644 index 0000000000000..abee701e01994 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const stepfunctions = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-stepfunctions'); +const sourceOutput = new codepipeline.Artifact(); +const startState = new stepfunctions.Pass(stack, 'StartState'); +const simpleStateMachine = new stepfunctions.StateMachine(stack, 'SimpleStateMachine', { + definition: startState, +}); +const pipeline = new codepipeline.Pipeline(stack, 'MyPipeline'); +pipeline.addStage({ + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'Source', + bucket: new s3.Bucket(stack, 'MyBucket'), + bucketKey: 'some/path/to', + output: sourceOutput, + trigger: cpactions.S3Trigger.POLL, + }), + ], +}); +pipeline.addStage({ + stageName: 'Invoke', + actions: [ + new cpactions.StepFunctionInvokeAction({ + actionName: 'Invoke', + stateMachine: simpleStateMachine, + stateMachineInput: cpactions.StateMachineInput.literal({ IsHelloWorldExample: true }), + }), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtc3RlcGZ1bmN0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLXN0ZXBmdW5jdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2REFBNkQ7QUFDN0QseUNBQXlDO0FBQ3pDLCtEQUErRDtBQUMvRCxtQ0FBbUM7QUFDbkMsa0VBQWtFO0FBRWxFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsb0NBQW9DLENBQUMsQ0FBQztBQUV2RSxNQUFNLFlBQVksR0FBRyxJQUFJLFlBQVksQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUVqRCxNQUFNLFVBQVUsR0FBRyxJQUFJLGFBQWEsQ0FBQyxJQUFJLENBQUMsS0FBSyxFQUFFLFlBQVksQ0FBQyxDQUFDO0FBQy9ELE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxhQUFhLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxvQkFBb0IsRUFBRTtJQUNyRixVQUFVLEVBQUUsVUFBVTtDQUN2QixDQUFDLENBQUM7QUFFSCxNQUFNLFFBQVEsR0FBRyxJQUFJLFlBQVksQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLFlBQVksQ0FBQyxDQUFDO0FBQ2hFLFFBQVEsQ0FBQyxRQUFRLENBQUM7SUFDaEIsU0FBUyxFQUFFLFFB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IFtcbiAgICBuZXcgY3BhY3Rpb25zLlN0ZXBGdW5jdGlvbkludm9rZUFjdGlvbih7XG4gICAgICBhY3Rpb25OYW1lOiAnSW52b2tlJyxcbiAgICAgIHN0YXRlTWFjaGluZTogc2ltcGxlU3RhdGVNYWNoaW5lLFxuICAgICAgc3RhdGVNYWNoaW5lSW5wdXQ6IGNwYWN0aW9ucy5TdGF0ZU1hY2hpbmVJbnB1dC5saXRlcmFsKHsgSXNIZWxsb1dvcmxkRXhhbXBsZTogdHJ1ZSB9KSxcbiAgICB9KSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/aws-cdk-codepipeline-stepfunctions.template.json diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/integ.sparkline-singlevaluewidget-and-dashboard.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.ts similarity index 78% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.ts index d357b596d48ca..126c5a24521b4 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.ts @@ -1,8 +1,8 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as stepfunctions from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js new file mode 100644 index 0000000000000..6c59b1c7d21ec --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_codebuild_1 = require("aws-cdk-lib/aws-codebuild"); +const aws_codepipeline_1 = require("aws-cdk-lib/aws-codepipeline"); +const aws_kms_1 = require("aws-cdk-lib/aws-kms"); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_codepipeline_actions_1 = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new aws_cdk_lib_1.App({ + treeMetadata: false, +}); +const stack1 = new aws_cdk_lib_1.Stack(app, 'integ-pipeline-producer-stack', { + env: { + region: 'us-east-1', + }, + crossRegionReferences: true, +}); +const stack2 = new aws_cdk_lib_1.Stack(app, 'integ-pipeline-consumer-stack', { + env: { + region: 'us-east-2', + }, + crossRegionReferences: true, +}); +const key = new aws_kms_1.Key(stack1, 'ReplicationKey'); +const bucket = new aws_s3_1.Bucket(stack1, 'ReplicationBucket', { + encryptionKey: key, + autoDeleteObjects: true, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const artifact = new aws_codepipeline_1.Artifact(); +const pipeline = new aws_codepipeline_1.Pipeline(stack2, 'Pipeline', { + crossRegionReplicationBuckets: { + 'us-east-1': bucket, + }, +}); +const sourceBucket = new aws_s3_1.Bucket(stack2, 'SourceBucket', { + autoDeleteObjects: true, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +pipeline.addStage({ + stageName: 'source', + actions: [new aws_codepipeline_actions_1.S3SourceAction({ + bucket: sourceBucket, + output: artifact, + bucketKey: '/somepath', + actionName: 'Source', + })], +}); +pipeline.addStage({ + stageName: 'stage2', + actions: [new aws_codepipeline_actions_1.CodeBuildAction({ + input: artifact, + actionName: 'Build', + project: new aws_codebuild_1.PipelineProject(stack2, 'Build'), + })], +}); +new integ_tests_alpha_1.IntegTest(app, 'codepipeline-integ-test', { + testCases: [stack2], + stackUpdateWorkflow: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VpbGRBY3Rpb24oe1xuICAgIGlucHV0OiBhcnRpZmFjdCxcbiAgICBhY3Rpb25OYW1lOiAnQnVpbGQnLFxuICAgIHByb2plY3Q6IG5ldyBQaXBlbGluZVByb2plY3Qoc3RhY2syLCAnQnVpbGQnKSxcbiAgfSldLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY29kZXBpcGVsaW5lLWludGVnLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrMl0sXG4gIHN0YWNrVXBkYXRlV29ya2Zsb3c6IGZhbHNlLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-manual-approval.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/codepipelineintegtestDefaultTestDeployAssert88EAAC45.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-consumer-stack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ-pipeline-producer-stack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.ts similarity index 75% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.ts index 045f7bda8ef06..8e1af38f77fb7 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/integ.pipeline-with-replication.ts @@ -1,10 +1,10 @@ -import { PipelineProject } from '@aws-cdk/aws-codebuild'; -import { Pipeline, Artifact } from '@aws-cdk/aws-codepipeline'; -import { Key } from '@aws-cdk/aws-kms'; -import { Bucket } from '@aws-cdk/aws-s3'; -import { App, Stack, RemovalPolicy } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { S3SourceAction, CodeBuildAction } from '../lib'; +import { PipelineProject } from 'aws-cdk-lib/aws-codebuild'; +import { Pipeline, Artifact } from 'aws-cdk-lib/aws-codepipeline'; +import { Key } from 'aws-cdk-lib/aws-kms'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import { App, Stack, RemovalPolicy } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { S3SourceAction, CodeBuildAction } from 'aws-cdk-lib/aws-codepipeline-actions'; const app = new App({ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js new file mode 100644 index 0000000000000..766957349925a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js @@ -0,0 +1,46 @@ +"use strict"; +/// !cdk-integ PipelineStack +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const app = new aws_cdk_lib_1.App(); +const bucketStack = new aws_cdk_lib_1.Stack(app, 'BucketStack'); +const bucket = new s3.Bucket(bucketStack, 'Bucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const pipelineStack = new aws_cdk_lib_1.Stack(app, 'PipelineStack'); +const sourceOutput = new codepipeline.Artifact(); +new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'Source', + bucket, + trigger: cpactions.S3Trigger.EVENTS, + bucketKey: 'file.zip', + output: sourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'Build', + project: new codebuild.PipelineProject(pipelineStack, 'Project'), + input: sourceOutput, + }), + ], + }, + ], +}); +new integ.IntegTest(app, 'CodePipelineS3SourceTest', { + testCases: [pipelineStack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc291cmNlLWJ1Y2tldC1ldmVudHMtY3Jvc3Mtc3RhY2stc2FtZS1lbnYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zb3VyY2UtYnVja2V0LWV2ZW50cy1jcm9zcy1zdGFjay1zYW1lLWVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNEJBQTRCOztBQUU1Qix1REFBdUQ7QUFDdkQsNkRBQTZEO0FBQzdELHlDQUF5QztBQUN6Qyw2Q0FBd0Q7QUFDeEQsb0RBQW9EO0FBQ3BELGtFQUFrRTtBQUVsRSxNQUFNLEdBQUcsR0FBRyxJ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5BcnRpZmFjdCgpO1xubmV3IGNvZGVwaXBlbGluZS5QaXBlbGluZShwaXBlbGluZVN0YWNrLCAnUGlwZWxpbmUnLCB7XG4gIHN0YWdlczogW1xuICAgIHtcbiAgICAgIHN0YWdlTmFtZTogJ1NvdXJjZScsXG4gICAgICBhY3Rpb25zOiBbXG4gICAgICAgIG5ldyBjcGFjdGlvbnMuUzNTb3VyY2VBY3Rpb24oe1xuICAgICAgICAgIGFjdGlvbk5hbWU6ICdTb3VyY2UnLFxuICAgICAgICAgIGJ1Y2tldCxcbiAgICAgICAgICB0cmlnZ2VyOiBjcGFjdGlvbnMuUzNUcmlnZ2VyLkVWRU5UUyxcbiAgICAgICAgICBidWNrZXRLZXk6ICdmaWxlLnppcCcsXG4gICAgICAgICAgb3V0cHV0OiBzb3VyY2VPdXRwdXQsXG4gICAgICAgIH0pLFxuICAgICAgXSxcbiAgICB9LFxuICAgIHtcbiAgICAgIHN0YWdlTmFtZTogJ0J1aWxkJyxcbiAgICAgIGFjdGlvbnM6IFtcbiAgICAgICAgbmV3IGNwYWN0aW9ucy5Db2RlQnVpbGRBY3Rpb24oe1xuICAgICAgICAgIGFjdGlvbk5hbWU6ICdCdWlsZCcsXG4gICAgICAgICAgcHJvamVjdDogbmV3IGNvZGVidWlsZC5QaXBlbGluZVByb2plY3QocGlwZWxpbmVTdGFjaywgJ1Byb2plY3QnKSxcbiAgICAgICAgICBpbnB1dDogc291cmNlT3V0cHV0LFxuICAgICAgICB9KSxcbiAgICAgIF0sXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ0NvZGVQaXBlbGluZVMzU291cmNlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbcGlwZWxpbmVTdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/BucketStack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/CodePipelineS3SourceTestDefaultTestDeployAssertCC67F1E7.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.assets.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/PipelineStack.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.ts new file mode 100644 index 0000000000000..e2f789e9db9a8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.ts @@ -0,0 +1,47 @@ +/// !cdk-integ PipelineStack + +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; + +const app = new App(); +const bucketStack = new Stack(app, 'BucketStack'); +const bucket = new s3.Bucket(bucketStack, 'Bucket', { + removalPolicy: RemovalPolicy.DESTROY, +}); + +const pipelineStack = new Stack(app, 'PipelineStack'); +const sourceOutput = new codepipeline.Artifact(); +new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'Source', + bucket, + trigger: cpactions.S3Trigger.EVENTS, + bucketKey: 'file.zip', + output: sourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'Build', + project: new codebuild.PipelineProject(pipelineStack, 'Project'), + input: sourceOutput, + }), + ], + }, + ], +}); + +new integ.IntegTest(app, 'CodePipelineS3SourceTest', { + testCases: [pipelineStack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js new file mode 100644 index 0000000000000..24691cb386d96 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_secretsmanager_1 = require("aws-cdk-lib/aws-secretsmanager"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-client-explicit-props'); +const userpool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + customAttributes: { + attribute_one: new aws_cognito_1.StringAttribute(), + attribute_two: new aws_cognito_1.StringAttribute(), + }, +}); +const client = userpool.addClient('myuserpoolclient', { + userPoolClientName: 'myuserpoolclient', + authFlows: { + adminUserPassword: true, + custom: true, + userPassword: true, + userSrp: true, + }, + generateSecret: true, + oAuth: { + flows: { + implicitCodeGrant: true, + authorizationCodeGrant: true, + }, + scopes: [ + aws_cognito_1.OAuthScope.PHONE, + aws_cognito_1.OAuthScope.EMAIL, + aws_cognito_1.OAuthScope.OPENID, + aws_cognito_1.OAuthScope.PROFILE, + aws_cognito_1.OAuthScope.COGNITO_ADMIN, + ], + callbackUrls: ['https://redirect-here.myapp.com'], + }, + preventUserExistenceErrors: true, + authSessionValidity: aws_cdk_lib_1.Duration.minutes(3), + writeAttributes: (new aws_cognito_1.ClientAttributes()).withStandardAttributes({ + address: true, + birthdate: true, + email: true, + familyName: true, + fullname: true, + gender: true, + givenName: true, + lastUpdateTime: true, + locale: true, + middleName: true, + nickname: true, + phoneNumber: true, + preferredUsername: true, + profilePage: true, + profilePicture: true, + timezone: true, + website: true, + }).withCustomAttributes('attribute_one', 'attribute_two'), +}); +new aws_secretsmanager_1.Secret(stack, 'Secret', { + secretStringValue: client.userPoolClientSecret, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWNsaWVudC1leHBsaWNpdC1wcm9wcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnVzZXItcG9vbC1jbGllbnQtZXhwbGljaXQtcHJvcHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1RUFBd0Q7QUFDeEQsNkNBQWtFO0FBQ2xFLHlEQUFrRztBQUVsRyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLHVDQUF1QyxDQUFDLENBQUM7QUFFdEUsTUFBTSxRQUFRLEdBQUcsSUFBSSxzQkFBUSxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUU7SUFDakQsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztJQUNwQyxnQkFBZ0IsRUFBRTtRQUNoQixhQUFhLEVBQUUsSUFBSSw2QkFBZSxFQUFFO1FBQ3BDLGFBQWEsRUFBRSxJQUFJLDZCQUFlLEVBQUU7S0FDckM7Q0FDRixDQUFDLENBQUM7QUFFSCxNQUFNLE1BQU0sR0FBRyxRQUFRLENBQUMsU0FBUyxDQUFDLGtCQUFrQixFQUFFO0lBQ3BELGtCQUFrQixFQUFFLGtCQUFrQjtJQUN0QyxTQUFTLEVBQUU7UUFDVCxpQkFBaUIsRUFBRSxJQUFJO1FBQ3ZCLE1BQU0sRUFBR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iAgICAgIGxhc3RVcGRhdGVUaW1lOiB0cnVlLFxuICAgICAgbG9jYWxlOiB0cnVlLFxuICAgICAgbWlkZGxlTmFtZTogdHJ1ZSxcbiAgICAgIG5pY2tuYW1lOiB0cnVlLFxuICAgICAgcGhvbmVOdW1iZXI6IHRydWUsXG4gICAgICBwcmVmZXJyZWRVc2VybmFtZTogdHJ1ZSxcbiAgICAgIHByb2ZpbGVQYWdlOiB0cnVlLFxuICAgICAgcHJvZmlsZVBpY3R1cmU6IHRydWUsXG4gICAgICB0aW1lem9uZTogdHJ1ZSxcbiAgICAgIHdlYnNpdGU6IHRydWUsXG4gICAgfSkud2l0aEN1c3RvbUF0dHJpYnV0ZXMoJ2F0dHJpYnV0ZV9vbmUnLCAnYXR0cmlidXRlX3R3bycpLFxufSk7XG5cbm5ldyBTZWNyZXQoc3RhY2ssICdTZWNyZXQnLCB7XG4gIHNlY3JldFN0cmluZ1ZhbHVlOiBjbGllbnQudXNlclBvb2xDbGllbnRTZWNyZXQsXG59KTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ-user-pool-client-explicit-props.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.ts similarity index 91% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.ts index 1c12e2104a4ba..1161f7007d2b9 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-explicit-props.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-explicit-props.ts @@ -1,6 +1,6 @@ -import { Secret } from '@aws-cdk/aws-secretsmanager'; -import { App, Duration, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { ClientAttributes, OAuthScope, StringAttribute, UserPool } from '../lib'; +import { Secret } from 'aws-cdk-lib/aws-secretsmanager'; +import { App, Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { ClientAttributes, OAuthScope, StringAttribute, UserPool } from 'aws-cdk-lib/aws-cognito'; const app = new App(); const stack = new Stack(app, 'integ-user-pool-client-explicit-props'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js new file mode 100644 index 0000000000000..60724b316ba22 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const userpool = new aws_cognito_1.UserPool(this, 'pool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + const client = userpool.addClient('client', { generateSecret: true }); + const secret = new secretsmanager.Secret(this, 'secret', { + secretStringValue: client.userPoolClientSecret, + }); + new aws_cdk_lib_1.CfnOutput(this, 'ClientSecretName', { + value: secret.secretName, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'integ-user-pool-client-secret'); +new integ_tests_alpha_1.IntegTest(app, 'integ-user-pool-client-secret-test', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWNsaWVudC1zZWNyZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy51c2VyLXBvb2wtY2xpZW50LXNlY3JldC50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LFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHRlc3RDYXNlID0gbmV3IFRlc3RTdGFjayhhcHAsICdpbnRlZy11c2VyLXBvb2wtY2xpZW50LXNlY3JldCcpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2ludGVnLXVzZXItcG9vbC1jbGllbnQtc2VjcmV0LXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ-user-pool-client-secret.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/integuserpoolclientsecrettestDefaultTestDeployAssert4FDD1661.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.ts new file mode 100644 index 0000000000000..c2800b88dfb8a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-secret.ts @@ -0,0 +1,30 @@ +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Construct } from 'constructs'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + const userpool = new UserPool(this, 'pool', { + removalPolicy: RemovalPolicy.DESTROY, + }); + + const client = userpool.addClient('client', { generateSecret: true }); + const secret = new secretsmanager.Secret(this, 'secret', { + secretStringValue: client.userPoolClientSecret, + }); + + new CfnOutput(this, 'ClientSecretName', { + value: secret.secretName, + }); + } +} + +const app = new App(); +const testCase = new TestStack(app, 'integ-user-pool-client-secret'); + +new IntegTest(app, 'integ-user-pool-client-secret-test', { + testCases: [testCase], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js new file mode 100644 index 0000000000000..8e25b9f5978d4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kms = require("aws-cdk-lib/aws-kms"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps + * * Sign up to the created user pool using an email address as the username, and password. + * * Verify the CustomEmailSender lambda was called via logged message in CloudWatch. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-custom-sender'); +const customSenderLambda = new lambda.Function(stack, 'emailLambda', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { console.log("Mocked custom email send");return cb(null, "success"); }'), +}); +const userpool = new aws_cognito_1.UserPool(stack, 'pool', { + autoVerify: { + email: true, + }, + selfSignUpEnabled: true, + signInAliases: { + email: true, + }, + customSenderKmsKey: new kms.Key(stack, 'key'), + lambdaTriggers: { + customEmailSender: customSenderLambda, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const client = userpool.addClient('client', { + authFlows: { + userSrp: true, + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'UserPoolId', { + value: userpool.userPoolId, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'ClientId', { + value: client.userPoolClientId, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWN1c3RvbS1zZW5kZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy51c2VyLXBvb2wtY3VzdG9tLXNlbmRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxpREFBaUQ7QUFDakQsNkNBQW1FO0FBQ25FLHlEQUFtRDtBQUVuRDs7OztHQUlHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSwrQkFBK0IsQ0FBQyxDQUFDO0FBRTlELE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxhQUFhLEVBQUU7SUFDbkUsT0FBTyxFQUFFLE1BQU0sQ0FBQyxPQUFPLENBQUMsV0FBVztJQUNuQyxPQUFPLEVBQUUsZUFBZTtJQUN4QixJQUF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bDogdHJ1ZSxcbiAgfSxcbiAgc2VsZlNpZ25VcEVuYWJsZWQ6IHRydWUsXG4gIHNpZ25JbkFsaWFzZXM6IHtcbiAgICBlbWFpbDogdHJ1ZSxcbiAgfSxcbiAgY3VzdG9tU2VuZGVyS21zS2V5OiBuZXcga21zLktleShzdGFjaywgJ2tleScpLFxuICBsYW1iZGFUcmlnZ2Vyczoge1xuICAgIGN1c3RvbUVtYWlsU2VuZGVyOiBjdXN0b21TZW5kZXJMYW1iZGEsXG4gIH0sXG4gIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5jb25zdCBjbGllbnQgPSB1c2VycG9vbC5hZGRDbGllbnQoJ2NsaWVudCcsIHtcbiAgYXV0aEZsb3dzOiB7XG4gICAgdXNlclNycDogdHJ1ZSxcbiAgfSxcbn0pO1xuXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnVXNlclBvb2xJZCcsIHtcbiAgdmFsdWU6IHVzZXJwb29sLnVzZXJQb29sSWQsXG59KTtcblxubmV3IENmbk91dHB1dChzdGFjaywgJ0NsaWVudElkJywge1xuICB2YWx1ZTogY2xpZW50LnVzZXJQb29sQ2xpZW50SWQsXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ-user-pool-custom-sender.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.ts similarity index 84% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.ts index 802d8bc6baa21..b50f4804b6d7e 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-custom-sender.ts @@ -1,7 +1,7 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { UserPool } from '../lib'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js new file mode 100644 index 0000000000000..b3f0705b1763b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps: + * * Verify that the CloudFrontDistribution stack output is of the format 'xxxxxxxxxxxxxx.cloudfront.net' + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-domain-cfdist'); +const userpool = new aws_cognito_1.UserPool(stack, 'UserPool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const domain = userpool.addDomain('Domain', { + cognitoDomain: { + domainPrefix: 'cdk-integ-user-pool-domain', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'Domain', { + value: domain.domainName, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'CloudFrontDomainName', { + value: domain.cloudFrontDomainName, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWRvbWFpbi1jZmRpc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy51c2VyLXBvb2wtZG9tYWluLWNmZGlzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFtRTtBQUNuRSx5REFBbUQ7QUFFbkQ7OztHQUdHO0FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSwrQkFBK0IsQ0FBQyxDQUFDO0FBRTlELE1BQU0sUUFBUSxHQUFHLElBQUksc0JBQVEsQ0FBQyxLQUFLLEVBQUUsVUFBVSxFQUFFO0lBQy9DLGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87Q0FDckMsQ0FBQyxDQUFDO0FBRUgsTUFBTSxNQU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uICBjb2duaXRvRG9tYWluOiB7XG4gICAgZG9tYWluUHJlZml4OiAnY2RrLWludGVnLXVzZXItcG9vbC1kb21haW4nLFxuICB9LFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdEb21haW4nLCB7XG4gIHZhbHVlOiBkb21haW4uZG9tYWluTmFtZSxcbn0pO1xuXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnQ2xvdWRGcm9udERvbWFpbk5hbWUnLCB7XG4gIHZhbHVlOiBkb21haW4uY2xvdWRGcm9udERvbWFpbk5hbWUsXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-deploy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ-user-pool-domain-cfdist.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.ts similarity index 83% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.ts index e2e096037fd3c..cc230dd102693 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-cfdist.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { UserPool } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js new file mode 100644 index 0000000000000..b9625549981f1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps: + * * Run the command `curl -sS -D - '' -o /dev/null` should return HTTP/2 200. + * * It didn't work if it returns 302 or 400. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-domain-signinurl'); +const userpool = new aws_cognito_1.UserPool(stack, 'UserPool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const domain = userpool.addDomain('Domain', { + cognitoDomain: { + domainPrefix: 'cdk-integ-user-pool-domain', + }, +}); +const client = userpool.addClient('UserPoolClient', { + oAuth: { + callbackUrls: ['https://example.com'], + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'SignInUrl', { + value: domain.signInUrl(client, { + redirectUri: 'https://example.com', + }), +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWRvbWFpbi1zaWduaW51cmwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy51c2VyLXBvb2wtZG9tYWluLXNpZ25pbnVybC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFtRTtBQUNuRSx5REFBbUQ7QUFFbkQ7Ozs7R0FJRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsa0NBQWtDLENBQUMsQ0FBQztBQUVqRSxNQUFNLFFBQVEsR0FBRyxJQUFJLHNCQUFRLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUMvQyxhQUFhLEVBQUUsMkJBQWEsQ0F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wtZG9tYWluLXNpZ25pbnVybCcpO1xuXG5jb25zdCB1c2VycG9vbCA9IG5ldyBVc2VyUG9vbChzdGFjaywgJ1VzZXJQb29sJywge1xuICByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1ksXG59KTtcblxuY29uc3QgZG9tYWluID0gdXNlcnBvb2wuYWRkRG9tYWluKCdEb21haW4nLCB7XG4gIGNvZ25pdG9Eb21haW46IHtcbiAgICBkb21haW5QcmVmaXg6ICdjZGstaW50ZWctdXNlci1wb29sLWRvbWFpbicsXG4gIH0sXG59KTtcblxuY29uc3QgY2xpZW50ID0gdXNlcnBvb2wuYWRkQ2xpZW50KCdVc2VyUG9vbENsaWVudCcsIHtcbiAgb0F1dGg6IHtcbiAgICBjYWxsYmFja1VybHM6IFsnaHR0cHM6Ly9leGFtcGxlLmNvbSddLFxuICB9LFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdTaWduSW5VcmwnLCB7XG4gIHZhbHVlOiBkb21haW4uc2lnbkluVXJsKGNsaWVudCwge1xuICAgIHJlZGlyZWN0VXJpOiAnaHR0cHM6Ly9leGFtcGxlLmNvbScsXG4gIH0pLFxufSk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ-user-pool-domain-signinurl.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.ts similarity index 85% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.ts index 7b26359354f9b..cbf3fe5843d34 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-signinurl.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-domain-signinurl.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { UserPool } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js new file mode 100644 index 0000000000000..a000fe39a3b3a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js @@ -0,0 +1,98 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool'); +const userpool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + userPoolName: 'MyUserPool', + userInvitation: { + emailSubject: 'invitation email subject from the integ test', + emailBody: 'invitation email body from the integ test for {username}. Temp password is {####}.', + smsMessage: 'invitation sms message from the integ test for {username}. Temp password is {####}.', + }, + selfSignUpEnabled: true, + userVerification: { + emailBody: 'verification email body from the integ test. Code is {####}.', + emailSubject: 'verification email subject from the integ test', + smsMessage: 'verification sms message from the integ test. Code is {####}.', + }, + signInAliases: { + username: true, + email: true, + }, + autoVerify: { + email: true, + phone: true, + }, + keepOriginal: { + email: true, + phone: true, + }, + standardAttributes: { + fullname: { + required: true, + mutable: true, + }, + email: { + required: true, + }, + }, + customAttributes: { + 'some-string-attr': new aws_cognito_1.StringAttribute(), + 'another-string-attr': new aws_cognito_1.StringAttribute({ minLen: 4, maxLen: 100 }), + 'some-number-attr': new aws_cognito_1.NumberAttribute(), + 'another-number-attr': new aws_cognito_1.NumberAttribute({ min: 10, max: 50 }), + 'some-boolean-attr': new aws_cognito_1.BooleanAttribute(), + 'some-datetime-attr': new aws_cognito_1.DateTimeAttribute(), + }, + mfa: aws_cognito_1.Mfa.OFF, + mfaSecondFactor: { + sms: true, + otp: true, + }, + passwordPolicy: { + tempPasswordValidity: aws_cdk_lib_1.Duration.days(10), + minLength: 12, + requireDigits: true, + requireLowercase: true, + requireUppercase: true, + requireSymbols: true, + }, + lambdaTriggers: { + createAuthChallenge: dummyTrigger('createAuthChallenge'), + customMessage: dummyTrigger('customMessage'), + defineAuthChallenge: dummyTrigger('defineAuthChallenge'), + postAuthentication: dummyTrigger('postAuthentication'), + postConfirmation: dummyTrigger('postConfirmation'), + preAuthentication: dummyTrigger('preAuthentication'), + preSignUp: dummyTrigger('preSignUp'), + preTokenGeneration: dummyTrigger('preTokenGeneration'), + userMigration: dummyTrigger('userMigration'), + verifyAuthChallengeResponse: dummyTrigger('verifyAuthChallengeResponse'), + }, + advancedSecurityMode: aws_cognito_1.AdvancedSecurityMode.ENFORCED, + snsRegion: aws_cdk_lib_1.Stack.of(stack).region, +}); +const cognitoDomain = userpool.addDomain('myuserpooldomain', { + cognitoDomain: { + domainPrefix: 'cdkintegrationtestuserpoolexplicitprops', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'userpoolId', { + value: userpool.userPoolId, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'cognitoDomainName', { + value: `${cognitoDomain.domainName}.auth.${stack.region}.amazoncognito.com`, +}); +function dummyTrigger(name) { + return new aws_lambda_1.Function(stack, name, { + functionName: name, + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + code: aws_lambda_1.Code.fromInline('foo'), + }); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWV4cGxpY2l0LXByb3BzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudXNlci1wb29sLWV4cGxpY2l0LXByb3BzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsdURBQTRFO0FBQzVFLDZDQUE2RTtBQUM3RSx5REFBcUo7QUFFckosTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxpQkFBaUIsQ0FBQyxDQUFDO0FBRWhELE1BQU0sUUFBUSxHQUFHLElBQUksc0JBQVEsQ0FBQyxLQUFLLEVBQUUsWUFBWSxFQUFFO0lBQ2pELGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87S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ZSgnZm9vJyksXG4gIH0pO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-domain-cfdist.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ-user-pool.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.ts similarity index 94% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.ts index bbd322af0ce03..e04ca43ea4dce 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-explicit-props.ts @@ -1,6 +1,6 @@ -import { Code, Function, IFunction, Runtime } from '@aws-cdk/aws-lambda'; -import { App, CfnOutput, Duration, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { AdvancedSecurityMode, BooleanAttribute, DateTimeAttribute, Mfa, NumberAttribute, StringAttribute, UserPool } from '../lib'; +import { Code, Function, IFunction, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, CfnOutput, Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { AdvancedSecurityMode, BooleanAttribute, DateTimeAttribute, Mfa, NumberAttribute, StringAttribute, UserPool } from 'aws-cdk-lib/aws-cognito'; const app = new App(); const stack = new Stack(app, 'integ-user-pool'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js new file mode 100644 index 0000000000000..9f84a1df1f60a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps + * * Visit the URL provided by stack output 'SignInLink' in a browser, and verify the 'Login with Amazon' link shows up. + * * If you plug in valid 'Login with Amazon' credentials, the federated log in should work. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-idp-amazon'); +const userpool = new aws_cognito_1.UserPool(stack, 'pool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +new aws_cognito_1.UserPoolIdentityProviderAmazon(stack, 'amazon', { + userPool: userpool, + clientId: 'amzn-client-id', + clientSecret: 'amzn-client-secret', + attributeMapping: { + givenName: aws_cognito_1.ProviderAttribute.AMAZON_NAME, + email: aws_cognito_1.ProviderAttribute.AMAZON_EMAIL, + custom: { + userId: aws_cognito_1.ProviderAttribute.AMAZON_USER_ID, + }, + }, +}); +const client = userpool.addClient('client'); +const domain = userpool.addDomain('domain', { + cognitoDomain: { + domainPrefix: 'nija-test-pool', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'SignInLink', { + value: domain.signInUrl(client, { + redirectUri: 'https://example.com', + }), +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWlkcC5hbWF6b24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy51c2VyLXBvb2wtaWRwLmFtYXpvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFtRTtBQUNuRSx5REFBc0c7QUFFdEc7Ozs7R0FJRztBQUNILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsNEJBQTRCLENBQUMsQ0FBQztBQUUzRCxNQUFNLFFBQVEsR0FBRyxJQUFJLHNCQUFRLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRTtJQUMzQyxhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO0NBQ3JDLENBQUMsQ0FBQztBQUVILElBQUksNENBQThCLENBQUMsS0FBSyxFQUFFLFFBQVEsRUFBRTtJQUNsRCxRQUFRLEVBQUUsUUFBUTtJQUNsQixRQUFRLEVBQUUsZ0JBQWdCO0lBQzFCLFlBQVksRUFBRSxvQkFBb0I7SUFDbEMsZ0JBQWdCLEVBQUU7UUFDaEIsU0FBUyxFQUFFLCtCQUFpQixDQUFDLFdBQVc7UUFDeEMsS0FBSyxFQUFFLCtCQUFpQixDQUFDLFlBQVk7UUFDckMsTUFBTSxFQUFFO1lBQ04sTUFBTSxFQUFFLCtCQUFpQixDQUFDLGNBQWM7U0FDekM7S0FDRjtDQUNGLENBQUMsQ0FBQztBQUVILE1BQU0sTUFBTSxHQUFHLFFBQVEsQ0FBQyxTQUFTLENBQUMsUUF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VycG9vbCA9IG5ldyBVc2VyUG9vbChzdGFjaywgJ3Bvb2wnLCB7XG4gIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5uZXcgVXNlclBvb2xJZGVudGl0eVByb3ZpZGVyQW1hem9uKHN0YWNrLCAnYW1hem9uJywge1xuICB1c2VyUG9vbDogdXNlcnBvb2wsXG4gIGNsaWVudElkOiAnYW16bi1jbGllbnQtaWQnLFxuICBjbGllbnRTZWNyZXQ6ICdhbXpuLWNsaWVudC1zZWNyZXQnLFxuICBhdHRyaWJ1dGVNYXBwaW5nOiB7XG4gICAgZ2l2ZW5OYW1lOiBQcm92aWRlckF0dHJpYnV0ZS5BTUFaT05fTkFNRSxcbiAgICBlbWFpbDogUHJvdmlkZXJBdHRyaWJ1dGUuQU1BWk9OX0VNQUlMLFxuICAgIGN1c3RvbToge1xuICAgICAgdXNlcklkOiBQcm92aWRlckF0dHJpYnV0ZS5BTUFaT05fVVNFUl9JRCxcbiAgICB9LFxuICB9LFxufSk7XG5cbmNvbnN0IGNsaWVudCA9IHVzZXJwb29sLmFkZENsaWVudCgnY2xpZW50Jyk7XG5cbmNvbnN0IGRvbWFpbiA9IHVzZXJwb29sLmFkZERvbWFpbignZG9tYWluJywge1xuICBjb2duaXRvRG9tYWluOiB7XG4gICAgZG9tYWluUHJlZml4OiAnbmlqYS10ZXN0LXBvb2wnLFxuICB9LFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdTaWduSW5MaW5rJywge1xuICB2YWx1ZTogZG9tYWluLnNpZ25JblVybChjbGllbnQsIHtcbiAgICByZWRpcmVjdFVyaTogJ2h0dHBzOi8vZXhhbXBsZS5jb20nLFxuICB9KSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ-user-pool-idp-amazon.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.ts similarity index 91% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.ts index 77b95a5857330..30352c06a9b31 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.amazon.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.amazon.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { ProviderAttribute, UserPool, UserPoolIdentityProviderAmazon } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { ProviderAttribute, UserPool, UserPoolIdentityProviderAmazon } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js new file mode 100644 index 0000000000000..3a56abe05b793 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps + * * Visit the URL provided by stack output 'SignInLink' in a browser, and verify the 'Sign In With Apple' link shows up. + * * If you plug in valid 'Sign In With Apple' credentials, the federated log in should work. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-idp-apple'); +const userpool = new aws_cognito_1.UserPool(stack, 'pool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +new aws_cognito_1.UserPoolIdentityProviderApple(stack, 'apple', { + userPool: userpool, + clientId: 'com.amzn.cdk', + teamId: 'CDKTEAMCDK', + keyId: 'CDKKEYCDK1', + privateKey: 'PRIV_KEY_CDK', + scopes: ['email', 'name'], + attributeMapping: { + familyName: aws_cognito_1.ProviderAttribute.APPLE_LAST_NAME, + givenName: aws_cognito_1.ProviderAttribute.APPLE_FIRST_NAME, + }, +}); +const client = userpool.addClient('client'); +const domain = userpool.addDomain('domain', { + cognitoDomain: { + domainPrefix: 'nija-test-pool', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'SignInLink', { + value: domain.signInUrl(client, { + redirectUri: 'https://example.com', + }), +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWlkcC5hcHBsZS5qcyIsInNvdXJjZVJvb3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jaywgJ2FwcGxlJywge1xuICB1c2VyUG9vbDogdXNlcnBvb2wsXG4gIGNsaWVudElkOiAnY29tLmFtem4uY2RrJyxcbiAgdGVhbUlkOiAnQ0RLVEVBTUNESycsXG4gIGtleUlkOiAnQ0RLS0VZQ0RLMScsXG4gIHByaXZhdGVLZXk6ICdQUklWX0tFWV9DREsnLFxuICBzY29wZXM6IFsnZW1haWwnLCAnbmFtZSddLFxuICBhdHRyaWJ1dGVNYXBwaW5nOiB7XG4gICAgZmFtaWx5TmFtZTogUHJvdmlkZXJBdHRyaWJ1dGUuQVBQTEVfTEFTVF9OQU1FLFxuICAgIGdpdmVuTmFtZTogUHJvdmlkZXJBdHRyaWJ1dGUuQVBQTEVfRklSU1RfTkFNRSxcbiAgfSxcbn0pO1xuXG5jb25zdCBjbGllbnQgPSB1c2VycG9vbC5hZGRDbGllbnQoJ2NsaWVudCcpO1xuXG5jb25zdCBkb21haW4gPSB1c2VycG9vbC5hZGREb21haW4oJ2RvbWFpbicsIHtcbiAgY29nbml0b0RvbWFpbjoge1xuICAgIGRvbWFpblByZWZpeDogJ25pamEtdGVzdC1wb29sJyxcbiAgfSxcbn0pO1xuXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnU2lnbkluTGluaycsIHtcbiAgdmFsdWU6IGRvbWFpbi5zaWduSW5VcmwoY2xpZW50LCB7XG4gICAgcmVkaXJlY3RVcmk6ICdodHRwczovL2V4YW1wbGUuY29tJyxcbiAgfSksXG59KTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ-user-pool-idp-apple.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.ts similarity index 91% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.ts index fb8e15f26e308..60c9b0570b1d5 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.apple.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.apple.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { ProviderAttribute, UserPool, UserPoolIdentityProviderApple } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { ProviderAttribute, UserPool, UserPoolIdentityProviderApple } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js new file mode 100644 index 0000000000000..b6992d1b87529 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_secretsmanager_1 = require("aws-cdk-lib/aws-secretsmanager"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps + * * Visit the URL provided by stack output 'SignInLink' in a browser, and verify the 'Google' sign in link shows up. + * * If you plug in valid 'Google' credentials, the federated log in should work. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-idp-google'); +const userpool = new aws_cognito_1.UserPool(stack, 'pool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const secret = new aws_secretsmanager_1.Secret(stack, 'GoogleClientSecretValue', { + secretName: 'GoogleClientSecretValueName', + generateSecretString: { + excludePunctuation: true, + passwordLength: 20, + }, +}); +const clientSecret = aws_secretsmanager_1.Secret.fromSecretAttributes(stack, 'GoogleClientSecretValue2', { + secretCompleteArn: secret.secretArn, +}).secretValue; +new aws_cognito_1.UserPoolIdentityProviderGoogle(stack, 'google', { + userPool: userpool, + clientId: 'google-client-id', + clientSecretValue: clientSecret, + attributeMapping: { + givenName: aws_cognito_1.ProviderAttribute.GOOGLE_GIVEN_NAME, + familyName: aws_cognito_1.ProviderAttribute.GOOGLE_FAMILY_NAME, + email: aws_cognito_1.ProviderAttribute.GOOGLE_EMAIL, + gender: aws_cognito_1.ProviderAttribute.GOOGLE_GENDER, + custom: { + names: aws_cognito_1.ProviderAttribute.GOOGLE_NAMES, + }, + }, +}); +const client = userpool.addClient('client'); +const domain = userpool.addDomain('domain', { + cognitoDomain: { + domainPrefix: 'nija-test-pool', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'SignInLink', { + value: domain.signInUrl(client, { + redirectUri: 'https://example.com', + }), +}); +//# sourceMappingURL=data:application/json;base64,eyJ2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Hb29nbGUoc3RhY2ssICdnb29nbGUnLCB7XG4gIHVzZXJQb29sOiB1c2VycG9vbCxcbiAgY2xpZW50SWQ6ICdnb29nbGUtY2xpZW50LWlkJyxcbiAgY2xpZW50U2VjcmV0VmFsdWU6IGNsaWVudFNlY3JldCxcbiAgYXR0cmlidXRlTWFwcGluZzoge1xuICAgIGdpdmVuTmFtZTogUHJvdmlkZXJBdHRyaWJ1dGUuR09PR0xFX0dJVkVOX05BTUUsXG4gICAgZmFtaWx5TmFtZTogUHJvdmlkZXJBdHRyaWJ1dGUuR09PR0xFX0ZBTUlMWV9OQU1FLFxuICAgIGVtYWlsOiBQcm92aWRlckF0dHJpYnV0ZS5HT09HTEVfRU1BSUwsXG4gICAgZ2VuZGVyOiBQcm92aWRlckF0dHJpYnV0ZS5HT09HTEVfR0VOREVSLFxuICAgIGN1c3RvbToge1xuICAgICAgbmFtZXM6IFByb3ZpZGVyQXR0cmlidXRlLkdPT0dMRV9OQU1FUyxcbiAgICB9LFxuICB9LFxufSk7XG5cbmNvbnN0IGNsaWVudCA9IHVzZXJwb29sLmFkZENsaWVudCgnY2xpZW50Jyk7XG5cbmNvbnN0IGRvbWFpbiA9IHVzZXJwb29sLmFkZERvbWFpbignZG9tYWluJywge1xuICBjb2duaXRvRG9tYWluOiB7XG4gICAgZG9tYWluUHJlZml4OiAnbmlqYS10ZXN0LXBvb2wnLFxuICB9LFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdTaWduSW5MaW5rJywge1xuICB2YWx1ZTogZG9tYWluLnNpZ25JblVybChjbGllbnQsIHtcbiAgICByZWRpcmVjdFVyaTogJ2h0dHBzOi8vZXhhbXBsZS5jb20nLFxuICB9KSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-with-replication.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ-user-pool-idp-google.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.ts similarity index 90% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.ts index 5cc5df6325ad2..e26f9bd5bcc48 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.google.ts @@ -1,6 +1,6 @@ -import { Secret } from '@aws-cdk/aws-secretsmanager'; -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { ProviderAttribute, UserPool, UserPoolIdentityProviderGoogle } from '../lib'; +import { Secret } from 'aws-cdk-lib/aws-secretsmanager'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { ProviderAttribute, UserPool, UserPoolIdentityProviderGoogle } from 'aws-cdk-lib/aws-cognito'; /* diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js new file mode 100644 index 0000000000000..c949c4af76efc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps + * * Visit the URL provided by stack output 'SignInLink' in a browser, and verify the 'cdk' sign in link shows up. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-idp-google'); +const userpool = new aws_cognito_1.UserPool(stack, 'pool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +new aws_cognito_1.UserPoolIdentityProviderOidc(stack, 'cdk', { + userPool: userpool, + name: 'cdk', + clientId: 'client-id', + clientSecret: 'client-secret', + issuerUrl: 'https://www.issuer-url.com', + endpoints: { + authorization: 'https://www.issuer-url.com/authorize', + token: 'https://www.issuer-url.com/token', + userInfo: 'https://www.issuer-url.com/userinfo', + jwksUri: 'https://www.issuer-url.com/jwks', + }, + scopes: ['openid', 'phone'], + attributeMapping: { + phoneNumber: aws_cognito_1.ProviderAttribute.other('phone_number'), + }, +}); +const client = userpool.addClient('client'); +const domain = userpool.addDomain('domain', { + cognitoDomain: { + domainPrefix: 'cdk-test-pool', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'SignInLink', { + value: domain.signInUrl(client, { + redirectUri: 'https://example.com', + }), +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWlkcC5vaWRjLmpzIiwic291cmNlUm9vdCI6IiIsInNvd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Bvb2w6IHVzZXJwb29sLFxuICBuYW1lOiAnY2RrJyxcbiAgY2xpZW50SWQ6ICdjbGllbnQtaWQnLFxuICBjbGllbnRTZWNyZXQ6ICdjbGllbnQtc2VjcmV0JyxcbiAgaXNzdWVyVXJsOiAnaHR0cHM6Ly93d3cuaXNzdWVyLXVybC5jb20nLFxuICBlbmRwb2ludHM6IHtcbiAgICBhdXRob3JpemF0aW9uOiAnaHR0cHM6Ly93d3cuaXNzdWVyLXVybC5jb20vYXV0aG9yaXplJyxcbiAgICB0b2tlbjogJ2h0dHBzOi8vd3d3Lmlzc3Vlci11cmwuY29tL3Rva2VuJyxcbiAgICB1c2VySW5mbzogJ2h0dHBzOi8vd3d3Lmlzc3Vlci11cmwuY29tL3VzZXJpbmZvJyxcbiAgICBqd2tzVXJpOiAnaHR0cHM6Ly93d3cuaXNzdWVyLXVybC5jb20vandrcycsXG4gIH0sXG4gIHNjb3BlczogWydvcGVuaWQnLCAncGhvbmUnXSxcbiAgYXR0cmlidXRlTWFwcGluZzoge1xuICAgIHBob25lTnVtYmVyOiBQcm92aWRlckF0dHJpYnV0ZS5vdGhlcigncGhvbmVfbnVtYmVyJyksXG4gIH0sXG59KTtcblxuY29uc3QgY2xpZW50ID0gdXNlcnBvb2wuYWRkQ2xpZW50KCdjbGllbnQnKTtcblxuY29uc3QgZG9tYWluID0gdXNlcnBvb2wuYWRkRG9tYWluKCdkb21haW4nLCB7XG4gIGNvZ25pdG9Eb21haW46IHtcbiAgICBkb21haW5QcmVmaXg6ICdjZGstdGVzdC1wb29sJyxcbiAgfSxcbn0pO1xuXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnU2lnbkluTGluaycsIHtcbiAgdmFsdWU6IGRvbWFpbi5zaWduSW5VcmwoY2xpZW50LCB7XG4gICAgcmVkaXJlY3RVcmk6ICdodHRwczovL2V4YW1wbGUuY29tJyxcbiAgfSksXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ-user-pool-idp-google.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts similarity index 91% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts index 159c7e305d2ff..38488319e5e15 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.oidc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.oidc.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { ProviderAttribute, UserPool, UserPoolIdentityProviderOidc } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { ProviderAttribute, UserPool, UserPoolIdentityProviderOidc } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js new file mode 100644 index 0000000000000..c6655fe3dac45 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const userpool = new aws_cognito_1.UserPool(this, 'pool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + new aws_cognito_1.UserPoolIdentityProviderSaml(this, 'cdk', { + userPool: userpool, + name: 'cdk', + metadata: aws_cognito_1.UserPoolIdentityProviderSamlMetadata.url('https://fujifish.github.io/samling/public/metadata.xml'), + }); + const client = userpool.addClient('client'); + const domain = userpool.addDomain('domain', { + cognitoDomain: { + domainPrefix: 'cdk-test-pool', + }, + }); + new aws_cdk_lib_1.CfnOutput(this, 'SignInLink', { + value: domain.signInUrl(client, { + redirectUri: 'https://example.com', + }), + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'integ-user-pool-identity-provider-saml-stack'); +new integ_tests_alpha_1.IntegTest(app, 'integ-user-pool-identity-provider-saml-test', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLWlkcC5zYW1sLmpzIiwic291cmNlUm9vdCI6I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FkYXRhOiBVc2VyUG9vbElkZW50aXR5UHJvdmlkZXJTYW1sTWV0YWRhdGEudXJsKCdodHRwczovL2Z1amlmaXNoLmdpdGh1Yi5pby9zYW1saW5nL3B1YmxpYy9tZXRhZGF0YS54bWwnKSxcbiAgICB9KTtcblxuICAgIGNvbnN0IGNsaWVudCA9IHVzZXJwb29sLmFkZENsaWVudCgnY2xpZW50Jyk7XG5cbiAgICBjb25zdCBkb21haW4gPSB1c2VycG9vbC5hZGREb21haW4oJ2RvbWFpbicsIHtcbiAgICAgIGNvZ25pdG9Eb21haW46IHtcbiAgICAgICAgZG9tYWluUHJlZml4OiAnY2RrLXRlc3QtcG9vbCcsXG4gICAgICB9LFxuICAgIH0pO1xuXG4gICAgbmV3IENmbk91dHB1dCh0aGlzLCAnU2lnbkluTGluaycsIHtcbiAgICAgIHZhbHVlOiBkb21haW4uc2lnbkluVXJsKGNsaWVudCwge1xuICAgICAgICByZWRpcmVjdFVyaTogJ2h0dHBzOi8vZXhhbXBsZS5jb20nLFxuICAgICAgfSksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgVGVzdFN0YWNrKGFwcCwgJ2ludGVnLXVzZXItcG9vbC1pZGVudGl0eS1wcm92aWRlci1zYW1sLXN0YWNrJyk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnaW50ZWctdXNlci1wb29sLWlkZW50aXR5LXByb3ZpZGVyLXNhbWwtdGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-custom-sender.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ-user-pool-identity-provider-saml-stack.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/integuserpoolidentityprovidersamltestDefaultTestDeployAssert97F09C26.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.ts similarity index 85% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.ts index fd1de9dd1fc77..318cf387434cc 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-idp.saml.ts @@ -1,7 +1,7 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { UserPool, UserPoolIdentityProviderSaml, UserPoolIdentityProviderSamlMetadata } from '../lib'; +import { UserPool, UserPoolIdentityProviderSaml, UserPoolIdentityProviderSamlMetadata } from 'aws-cdk-lib/aws-cognito'; class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js new file mode 100644 index 0000000000000..d4ea90bd9afda --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-resource-server'); +/* + * Stack verification steps: + * Cognito will only allow you to add a custom scope on a user pool client that is defined by a resource server. + * Checking the app client scopes will verify if the resource server is configured correctly. + * The exports userPoolId and userPoolClientId are exported here to test + * + * * `aws cognito-idp describe-user-pool-client --user-pool-id $userPoolId --client-id $userPoolClientId` should return "users/read" in "AllowedOAuthScopes" + */ +const userPool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + userPoolName: 'MyUserPool', + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const readScope = new aws_cognito_1.ResourceServerScope({ scopeName: 'read', scopeDescription: 'read only' }); +const userServer = userPool.addResourceServer('myserver', { + identifier: 'users', + scopes: [readScope], +}); +const client = userPool.addClient('client', { + userPoolClientName: 'users-app', + generateSecret: true, + oAuth: { + flows: { + clientCredentials: true, + }, + scopes: [ + aws_cognito_1.OAuthScope.resourceServer(userServer, readScope), + ], + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'pool-id', { + value: userPool.userPoolId, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'client-id', { + value: client.userPoolClientId, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLXJlc291cmNlLXNlcnZlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnVzZXItcG9vbC1yZXNvdXJjZS1zZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBbUU7QUFDbkUseURBQW9GO0FBRXBGLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQU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VzZXJQb29sKHN0YWNrLCAnbXl1c2VycG9vbCcsIHtcbiAgdXNlclBvb2xOYW1lOiAnTXlVc2VyUG9vbCcsXG4gIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5jb25zdCByZWFkU2NvcGUgPSBuZXcgUmVzb3VyY2VTZXJ2ZXJTY29wZSh7IHNjb3BlTmFtZTogJ3JlYWQnLCBzY29wZURlc2NyaXB0aW9uOiAncmVhZCBvbmx5JyB9KTtcbmNvbnN0IHVzZXJTZXJ2ZXIgPSB1c2VyUG9vbC5hZGRSZXNvdXJjZVNlcnZlcignbXlzZXJ2ZXInLCB7XG4gIGlkZW50aWZpZXI6ICd1c2VycycsXG4gIHNjb3BlczogW3JlYWRTY29wZV0sXG59KTtcblxuY29uc3QgY2xpZW50ID0gdXNlclBvb2wuYWRkQ2xpZW50KCdjbGllbnQnLCB7XG4gIHVzZXJQb29sQ2xpZW50TmFtZTogJ3VzZXJzLWFwcCcsXG4gIGdlbmVyYXRlU2VjcmV0OiB0cnVlLFxuICBvQXV0aDoge1xuICAgIGZsb3dzOiB7XG4gICAgICBjbGllbnRDcmVkZW50aWFsczogdHJ1ZSxcbiAgICB9LFxuICAgIHNjb3BlczogW1xuICAgICAgT0F1dGhTY29wZS5yZXNvdXJjZVNlcnZlcih1c2VyU2VydmVyLCByZWFkU2NvcGUpLFxuICAgIF0sXG4gIH0sXG59KTtcblxubmV3IENmbk91dHB1dChzdGFjaywgJ3Bvb2wtaWQnLCB7XG4gIHZhbHVlOiB1c2VyUG9vbC51c2VyUG9vbElkLFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdjbGllbnQtaWQnLCB7XG4gIHZhbHVlOiBjbGllbnQudXNlclBvb2xDbGllbnRJZCxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ-user-pool-resource-server.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.ts similarity index 89% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.ts index cd56612c65cd7..2944da3d77620 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-resource-server.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-resource-server.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { OAuthScope, ResourceServerScope, UserPool } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { OAuthScope, ResourceServerScope, UserPool } from 'aws-cdk-lib/aws-cognito'; const app = new App(); const stack = new Stack(app, 'integ-user-pool-resource-server'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js new file mode 100644 index 0000000000000..88a704705cdc2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-ses-email'); +const userpool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + userPoolName: 'MyUserPool', + email: aws_cognito_1.UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: 'noreply@example.com', + fromName: 'myname@mycompany.com', + replyTo: 'support@example.com', + sesVerifiedDomain: 'example.com', + }), +}); +new aws_cdk_lib_1.CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); +new integ_tests_alpha_1.IntegTest(app, 'IntegTest', { testCases: [stack] }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLXNlcy1lbWFpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnVzZXItcG9vbC1zZXMtZW1haWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBbUU7QUFDbkUsa0VBQXVEO0FBQ3ZELHlEQUFrRTtBQUVsRSxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0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0IHVzZXJwb29sID0gbmV3IFVzZXJQb29sKHN0YWNrLCAnbXl1c2VycG9vbCcsIHtcbiAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICB1c2VyUG9vbE5hbWU6ICdNeVVzZXJQb29sJyxcbiAgZW1haWw6IFVzZXJQb29sRW1haWwud2l0aFNFUyh7XG4gICAgc2VzUmVnaW9uOiAndXMtZWFzdC0xJyxcbiAgICBmcm9tRW1haWw6ICdub3JlcGx5QGV4YW1wbGUuY29tJyxcbiAgICBmcm9tTmFtZTogJ215bmFtZUBteWNvbXBhbnkuY29tJyxcbiAgICByZXBseVRvOiAnc3VwcG9ydEBleGFtcGxlLmNvbScsXG4gICAgc2VzVmVyaWZpZWREb21haW46ICdleGFtcGxlLmNvbScsXG4gIH0pLFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICd1c2VyLXBvb2wtaWQnLCB7XG4gIHZhbHVlOiB1c2VycG9vbC51c2VyUG9vbElkLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnSW50ZWdUZXN0JywgeyB0ZXN0Q2FzZXM6IFtzdGFja10gfSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-explicit-props.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ-user-ses-email.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.ts new file mode 100644 index 0000000000000..a147077e52375 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-ses-email.ts @@ -0,0 +1,24 @@ +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { UserPool, UserPoolEmail } from 'aws-cdk-lib/aws-cognito'; + +const app = new App(); +const stack = new Stack(app, 'integ-user-ses-email'); + +const userpool = new UserPool(stack, 'myuserpool', { + removalPolicy: RemovalPolicy.DESTROY, + userPoolName: 'MyUserPool', + email: UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: 'noreply@example.com', + fromName: 'myname@mycompany.com', + replyTo: 'support@example.com', + sesVerifiedDomain: 'example.com', + }), +}); + +new CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); + +new IntegTest(app, 'IntegTest', { testCases: [stack] }); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js new file mode 100644 index 0000000000000..ba3521df1e36d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps: + * * `aws cognito-idp sign-up --client-id --username user-1 --password pass1234 \ + * --user-attributes Name="phone_number",Value="" + * * `aws cognito-idp sign-up --client-id --username user-2 --password pass1234 \ + * --user-attributes Name="email",Value="" + * * An email with the message 'integ-test: Account verification code is ' should be received. + * * An SMS with the message 'integ-test: Account verification code is ' should be received. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-signup-code'); +const userpool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + userPoolName: 'MyUserPool', + autoVerify: { + email: true, + phone: true, + }, + selfSignUpEnabled: true, + userVerification: { + emailStyle: aws_cognito_1.VerificationEmailStyle.CODE, + emailSubject: 'integ-test: Verify your account', + emailBody: 'integ-test: Account verification code is {####}', + smsMessage: 'integ-test: Account verification code is {####}', + }, + passwordPolicy: { + requireUppercase: false, + requireLowercase: false, + requireDigits: false, + requireSymbols: false, + }, +}); +const client = new aws_cognito_1.UserPoolClient(stack, 'myuserpoolclient', { + userPool: userpool, + userPoolClientName: 'signup-test', + generateSecret: false, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'client-id', { + value: client.userPoolClientId, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLXNpZ251cC1jb2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudXNlci1wb29sLXNpZ251cC1jb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQW1FO0FBQ25FLHlEQUEyRjtBQUUzRjs7Ozs7Ozs7R0FRRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsNkJBQTZCLENBQUMsQ0FBQztBQUU1RCxNQUFNLFFBQVEsR0FBRyxJQUFJLHNCQUFRLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRTtJQUNqRCxhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO0lBQ3BDLFlBQVksRUFBRSxZQUFZO0lBQzFCLFVBQVUsRUFBRTtRQUNWLEtBQUssRUFBRSxJQUFJO1FBQ1gsS0FBSyxFQUFFLElBQUk7S0FDWjtJQUNELGlCQUFpQixFQUFFLElBQUk7SUFDdkIsZ0JBQWdCLEVBQUU7UUFDaEIsVUFBVSxFQUF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sXG4gIH0sXG4gIHNlbGZTaWduVXBFbmFibGVkOiB0cnVlLFxuICB1c2VyVmVyaWZpY2F0aW9uOiB7XG4gICAgZW1haWxTdHlsZTogVmVyaWZpY2F0aW9uRW1haWxTdHlsZS5DT0RFLFxuICAgIGVtYWlsU3ViamVjdDogJ2ludGVnLXRlc3Q6IFZlcmlmeSB5b3VyIGFjY291bnQnLFxuICAgIGVtYWlsQm9keTogJ2ludGVnLXRlc3Q6IEFjY291bnQgdmVyaWZpY2F0aW9uIGNvZGUgaXMgeyMjIyN9JyxcbiAgICBzbXNNZXNzYWdlOiAnaW50ZWctdGVzdDogQWNjb3VudCB2ZXJpZmljYXRpb24gY29kZSBpcyB7IyMjI30nLFxuICB9LFxuICBwYXNzd29yZFBvbGljeToge1xuICAgIHJlcXVpcmVVcHBlcmNhc2U6IGZhbHNlLFxuICAgIHJlcXVpcmVMb3dlcmNhc2U6IGZhbHNlLFxuICAgIHJlcXVpcmVEaWdpdHM6IGZhbHNlLFxuICAgIHJlcXVpcmVTeW1ib2xzOiBmYWxzZSxcbiAgfSxcbn0pO1xuXG5jb25zdCBjbGllbnQgPSBuZXcgVXNlclBvb2xDbGllbnQoc3RhY2ssICdteXVzZXJwb29sY2xpZW50Jywge1xuICB1c2VyUG9vbDogdXNlcnBvb2wsXG4gIHVzZXJQb29sQ2xpZW50TmFtZTogJ3NpZ251cC10ZXN0JyxcbiAgZ2VuZXJhdGVTZWNyZXQ6IGZhbHNlLFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICd1c2VyLXBvb2wtaWQnLCB7XG4gIHZhbHVlOiB1c2VycG9vbC51c2VyUG9vbElkLFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdjbGllbnQtaWQnLCB7XG4gIHZhbHVlOiBjbGllbnQudXNlclBvb2xDbGllbnRJZCxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ-user-pool-signup-code.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.ts similarity index 94% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.ts index 9118b4c912adf..b63aa26de89a8 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-code.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-code.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { UserPool, UserPoolClient, VerificationEmailStyle } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool, UserPoolClient, VerificationEmailStyle } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js new file mode 100644 index 0000000000000..c966582e368ec --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +/* + * Stack verification steps: + * * `aws cognito-idp sign-up --client-id --username user-1 --password pass1234 \ + * --user-attributes Name="phone_number",Value="" + * * `aws cognito-idp sign-up --client-id --username user-2 --password pass1234 \ + * --user-attributes Name="email",Value="" + * * An email with the message 'integ-test: Verify by clicking on ' should be received. + * * An SMS with the message 'integ-test: Account verification code is ' should be received. + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool-signup-link'); +const userpool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + userPoolName: 'MyUserPool', + autoVerify: { + email: true, + phone: true, + }, + selfSignUpEnabled: true, + userVerification: { + emailStyle: aws_cognito_1.VerificationEmailStyle.LINK, + emailSubject: 'integ-test: Verify your account', + emailBody: 'integ-test: Verify by clicking on {##Verify Email##}', + smsMessage: 'integ-test: Account verification code is {####}', + }, + passwordPolicy: { + requireUppercase: false, + requireLowercase: false, + requireDigits: false, + requireSymbols: false, + }, +}); +const client = new aws_cognito_1.UserPoolClient(stack, 'myuserpoolclient', { + userPool: userpool, + userPoolClientName: 'signup-test', + generateSecret: false, +}); +userpool.addDomain('myuserpooldomain', { + cognitoDomain: { + domainPrefix: 'integ-user-pool-signup-link', + }, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); +new aws_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aW50ZWctdGVzdDogVmVyaWZ5IHlvdXIgYWNjb3VudCcsXG4gICAgZW1haWxCb2R5OiAnaW50ZWctdGVzdDogVmVyaWZ5IGJ5IGNsaWNraW5nIG9uIHsjI1ZlcmlmeSBFbWFpbCMjfScsXG4gICAgc21zTWVzc2FnZTogJ2ludGVnLXRlc3Q6IEFjY291bnQgdmVyaWZpY2F0aW9uIGNvZGUgaXMgeyMjIyN9JyxcbiAgfSxcbiAgcGFzc3dvcmRQb2xpY3k6IHtcbiAgICByZXF1aXJlVXBwZXJjYXNlOiBmYWxzZSxcbiAgICByZXF1aXJlTG93ZXJjYXNlOiBmYWxzZSxcbiAgICByZXF1aXJlRGlnaXRzOiBmYWxzZSxcbiAgICByZXF1aXJlU3ltYm9sczogZmFsc2UsXG4gIH0sXG59KTtcblxuY29uc3QgY2xpZW50ID0gbmV3IFVzZXJQb29sQ2xpZW50KHN0YWNrLCAnbXl1c2VycG9vbGNsaWVudCcsIHtcbiAgdXNlclBvb2w6IHVzZXJwb29sLFxuICB1c2VyUG9vbENsaWVudE5hbWU6ICdzaWdudXAtdGVzdCcsXG4gIGdlbmVyYXRlU2VjcmV0OiBmYWxzZSxcbn0pO1xuXG51c2VycG9vbC5hZGREb21haW4oJ215dXNlcnBvb2xkb21haW4nLCB7XG4gIGNvZ25pdG9Eb21haW46IHtcbiAgICBkb21haW5QcmVmaXg6ICdpbnRlZy11c2VyLXBvb2wtc2lnbnVwLWxpbmsnLFxuICB9LFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICd1c2VyLXBvb2wtaWQnLCB7XG4gIHZhbHVlOiB1c2VycG9vbC51c2VyUG9vbElkLFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdjbGllbnQtaWQnLCB7XG4gIHZhbHVlOiBjbGllbnQudXNlclBvb2xDbGllbnRJZCxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ-user-pool-signup-link.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.ts similarity index 94% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.ts index b7121720ad940..5ebc7745df42f 100644 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-signup-link.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-signup-link.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { UserPool, UserPoolClient, VerificationEmailStyle } from '../lib'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool, UserPoolClient, VerificationEmailStyle } from 'aws-cdk-lib/aws-cognito'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js new file mode 100644 index 0000000000000..e97d299292eea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_cognito_1 = require("aws-cdk-lib/aws-cognito"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-user-pool'); +const userpool = new aws_cognito_1.UserPool(stack, 'myuserpool', { + userPoolName: 'MyUserPool', + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + deletionProtection: false, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci1wb29sLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudXNlci1wb29sLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQW1FO0FBQ25FLHlEQUFtRDtBQUVuRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLGlCQUFpQixDQUFDLENBQUM7QUFFaEQsTUFBTSxRQUFRLEdBQUcsSUFBSSxzQkFBUSxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUU7SUFDakQsWUFBWSxFQUFFLFlBQVk7SUFDMUIsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztJQUNwQyxrQkFBa0IsRUFBRSxLQUFLO0NBQzFCLENBQUMsQ0FBQztBQUVILElBQUksdUJBQVMsQ0FBQyxLQUFLLEVBQUUsY0FBYyxFQUFFO0lBQ25DLEtBQUssRUFBRSxRQUFRLENBQUMsVUFBVTtDQUMzQixDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBcHAsIENmbk91dHB1dCwgUmVtb3ZhbFBvbGljeSwgU3RhY2sgfSBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgeyBVc2VyUG9vbCB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1jb2duaXRvJztcblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgU3RhY2soYXBwLCAnaW50ZWctdXNlci1wb29sJyk7XG5cbmNvbnN0IHVzZXJwb29sID0gbmV3IFVzZXJQb29sKHN0YWNrLCAnbXl1c2VycG9vbCcsIHtcbiAgdXNlclBvb2xOYW1lOiAnTXlVc2VyUG9vbCcsXG4gIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgZGVsZXRpb25Qcm90ZWN0aW9uOiBmYWxzZSxcbn0pO1xuXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAndXNlci1wb29sLWlkJywge1xuICB2YWx1ZTogdXNlcnBvb2wudXNlclBvb2xJZCxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.google.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.assets.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.template.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/integ-user-pool.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.ts new file mode 100644 index 0000000000000..f2f28986acb3a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool.ts @@ -0,0 +1,15 @@ +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; + +const app = new App(); +const stack = new Stack(app, 'integ-user-pool'); + +const userpool = new UserPool(stack, 'myuserpool', { + userPoolName: 'MyUserPool', + removalPolicy: RemovalPolicy.DESTROY, + deletionProtection: false, +}); + +new CfnOutput(stack, 'user-pool-id', { + value: userpool.userPoolId, +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js new file mode 100644 index 0000000000000..662e161b74eea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const config = require("aws-cdk-lib/aws-config"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-config-custompolicy'); +const samplePolicyText = ` +# This rule checks if point in time recovery (PITR) is enabled on active Amazon DynamoDB tables +let status = ['ACTIVE'] + +rule tableisactive when + resourceType == "AWS::DynamoDB::Table" { + configuration.tableStatus == %status +} + +rule checkcompliance when + resourceType == "AWS::DynamoDB::Table" + tableisactive { + let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus + %pitr == "ENABLED" +} +`; +new config.CustomPolicy(stack, 'Custom', { + policyText: samplePolicyText, + enableDebugLog: true, + ruleScope: config.RuleScope.fromResources([config.ResourceType.DYNAMODB_TABLE]), +}); +const user = new iam.User(stack, 'sample-user'); +new config.CustomPolicy(stack, 'Custom-lazy', { + policyText: 'lazy-create-test', + enableDebugLog: true, + ruleScope: config.RuleScope.fromResource(config.ResourceType.IAM_USER, user.userName), +}); +new integ.IntegTest(app, 'aws-cdk-config-custompolicy-integ', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY3VzdG9tcG9saWN5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY3VzdG9tcG9saWN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsaURBQWlEO0FBRWpELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsNkJBQTZCLENBQUMsQ0FBQztBQUVoRSxNQUFNLGdCQUFnQixHQUFHOzs7Ozs7Ozs7Ozs7Ozs7Q0FleEIsQ0FBQztBQUVGLElBQUksTUFBTSxDQUFDLFlBQVksQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ3ZDLFVBQVUsRUFBRSxnQkFBZ0I7SUFDNUIsY0FBYyxFQUFFLElBQUk7SUFDcEIsU0FBUyxFQUFFLE1BQU0sQ0FBQyxTQUFTLENBQUMsYUFBYSxDQUFDLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQyxjQUFjLENBQUMsQ0FBQztDQUNoRixD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Mb2c6IHRydWUsXG4gIHJ1bGVTY29wZTogY29uZmlnLlJ1bGVTY29wZS5mcm9tUmVzb3VyY2UoY29uZmlnLlJlc291cmNlVHlwZS5JQU1fVVNFUiwgdXNlci51c2VyTmFtZSksXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhd3MtY2RrLWNvbmZpZy1jdXN0b21wb2xpY3ktaW50ZWcnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/aws-cdk-config-custompolicy.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/awscdkconfigcustompolicyintegDefaultTestDeployAssert4EE21D3A.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-idp.saml.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.ts similarity index 86% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.ts index 83af445a1aca1..c5e052fb58774 100644 --- a/packages/@aws-cdk/aws-config/test/integ.custompolicy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.custompolicy.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as config from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as config from 'aws-cdk-lib/aws-config'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-config-custompolicy'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js new file mode 100644 index 0000000000000..eb0b8b9c80cf1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const targets = require("aws-cdk-lib/aws-events-targets"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const config = require("aws-cdk-lib/aws-config"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-config-custompolicy'); +// A custom rule that runs on configuration changes of EC2 instances +const fn = new lambda.Function(stack, 'CustomFunction', { + code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +new config.CustomRule(stack, 'Custom', { + configurationChanges: true, + lambdaFunction: fn, + ruleScope: config.RuleScope.fromResources([config.ResourceType.EC2_INSTANCE]), +}); +// A rule to detect stacks drifts +const driftRule = new config.CloudFormationStackDriftDetectionCheck(stack, 'Drift'); +// Topic for compliance events +const complianceTopic = new sns.Topic(stack, 'ComplianceTopic'); +// Send notification on compliance change +driftRule.onComplianceChange('ComplianceChange', { + target: new targets.SnsTopic(complianceTopic), +}); +new integ.IntegTest(app, 'aws-cdk-config-rule-integ', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwREFBMEQ7QUFDMUQsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELGlEQUFpRDtBQUVqRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQU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ssICdDdXN0b20nLCB7XG4gIGNvbmZpZ3VyYXRpb25DaGFuZ2VzOiB0cnVlLFxuICBsYW1iZGFGdW5jdGlvbjogZm4sXG4gIHJ1bGVTY29wZTogY29uZmlnLlJ1bGVTY29wZS5mcm9tUmVzb3VyY2VzKFtjb25maWcuUmVzb3VyY2VUeXBlLkVDMl9JTlNUQU5DRV0pLFxufSk7XG5cbi8vIEEgcnVsZSB0byBkZXRlY3Qgc3RhY2tzIGRyaWZ0c1xuY29uc3QgZHJpZnRSdWxlID0gbmV3IGNvbmZpZy5DbG91ZEZvcm1hdGlvblN0YWNrRHJpZnREZXRlY3Rpb25DaGVjayhzdGFjaywgJ0RyaWZ0Jyk7XG5cbi8vIFRvcGljIGZvciBjb21wbGlhbmNlIGV2ZW50c1xuY29uc3QgY29tcGxpYW5jZVRvcGljID0gbmV3IHNucy5Ub3BpYyhzdGFjaywgJ0NvbXBsaWFuY2VUb3BpYycpO1xuXG4vLyBTZW5kIG5vdGlmaWNhdGlvbiBvbiBjb21wbGlhbmNlIGNoYW5nZVxuZHJpZnRSdWxlLm9uQ29tcGxpYW5jZUNoYW5nZSgnQ29tcGxpYW5jZUNoYW5nZScsIHtcbiAgdGFyZ2V0OiBuZXcgdGFyZ2V0cy5TbnNUb3BpYyhjb21wbGlhbmNlVG9waWMpLFxufSk7XG5cblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhd3MtY2RrLWNvbmZpZy1ydWxlLWludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/aws-cdk-config-custompolicy.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-stepfunctions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/aws-cdk-config-custompolicy.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.ts new file mode 100644 index 0000000000000..da57beed2a01f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.rule.ts @@ -0,0 +1,38 @@ +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as config from 'aws-cdk-lib/aws-config'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-config-custompolicy'); + +// A custom rule that runs on configuration changes of EC2 instances +const fn = new lambda.Function(stack, 'CustomFunction', { + code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); + +new config.CustomRule(stack, 'Custom', { + configurationChanges: true, + lambdaFunction: fn, + ruleScope: config.RuleScope.fromResources([config.ResourceType.EC2_INSTANCE]), +}); + +// A rule to detect stacks drifts +const driftRule = new config.CloudFormationStackDriftDetectionCheck(stack, 'Drift'); + +// Topic for compliance events +const complianceTopic = new sns.Topic(stack, 'ComplianceTopic'); + +// Send notification on compliance change +driftRule.onComplianceChange('ComplianceChange', { + target: new targets.SnsTopic(complianceTopic), +}); + + +new integ.IntegTest(app, 'aws-cdk-config-rule-integ', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js new file mode 100644 index 0000000000000..fb8be176496eb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const config = require("aws-cdk-lib/aws-config"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-config-rule-scoped-integ', {}); +const fn = new lambda.Function(stack, 'CustomFunction', { + code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +new config.CustomRule(stack, 'Custom', { + lambdaFunction: fn, + periodic: true, + ruleScope: config.RuleScope.fromResources([config.ResourceType.EC2_INSTANCE]), +}); +new integ.IntegTest(app, 'aws-cdk-config-rule-integ', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL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CwgJ2F3cy1jZGstY29uZmlnLXJ1bGUtaW50ZWcnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/aws-cdk-config-rule-scoped-integ.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.assets.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/awscdkconfigruleintegDefaultTestDeployAssert37C5819B.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.rule.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.ts similarity index 75% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.ts index ef6781abc3c2b..a425e54a8f50f 100644 --- a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-config/test/integ.scoped-rule.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as config from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as config from 'aws-cdk-lib/aws-config'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster-rotation.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster-rotation.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster-rotation.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster-rotation.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster-rotation.lit.js new file mode 100644 index 0000000000000..fe3856bd48165 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster-rotation.lit.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const docdb = require("aws-cdk-lib/aws-docdb"); +/* + * Stack verification steps: + * * aws secretsmanager describe-secret --secret-id + * * aws lambda get-function --function-name + * * aws lambda get-function --function-name + */ +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + const params = new aws_docdb_1.ClusterParameterGroup(this, 'Params', { + family: 'docdb3.6', + description: 'A nice parameter group', + parameters: { + audit_logs: 'disabled', + tls: 'enabled', + ttl_monitor: 'enabled', + }, + }); + const kmsKey = new kms.Key(this, 'DbSecurity', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const cluster = new aws_docdb_1.DatabaseCluster(this, 'Database', { + engineVersion: '3.6.0', + masterUser: { + username: 'docdb', + password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + vpc, + parameterGroup: params, + kmsKey, + removalPolicy: cdk.RemovalPolicy.DESTROY, + enablePerformanceInsights: true, + }); + cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-docdb-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUVuQyxxREFBK0U7QUFFL0U7OztHQUdHO0FBRUgsTUFBTSxTQUFVLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDL0IsWUFBWSxLQUEyQixFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUN6RSxLQUFLLENBQUMsS0FBSyxFQUF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S5vZihlYzIuSW5zdGFuY2VDbGFzcy5SNSwgZWMyLkluc3RhbmNlU2l6ZS5MQVJHRSksXG4gICAgICB2cGNTdWJuZXRzOiB7IHN1Ym5ldFR5cGU6IGVjMi5TdWJuZXRUeXBlLlBVQkxJQyB9LFxuICAgICAgdnBjLFxuICAgICAgcGFyYW1ldGVyR3JvdXA6IHBhcmFtcyxcbiAgICAgIGttc0tleSxcbiAgICAgIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gICAgICBlbmFibGVQZXJmb3JtYW5jZUluc2lnaHRzOiB0cnVlLFxuICAgIH0pO1xuXG4gICAgY2x1c3Rlci5jb25uZWN0aW9ucy5hbGxvd0RlZmF1bHRQb3J0RnJvbUFueUlwdjQoJ09wZW4gdG8gdGhlIHdvcmxkJyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLWRvY2RiLWludGVnJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.assets.json diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/aws-cdk-docdb-integ.template.json diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-docdb/test/integ.cluster.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.ts new file mode 100644 index 0000000000000..343ea2fb8bbcb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-docdb/test/integ.cluster.ts @@ -0,0 +1,55 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; +import * as constructs from 'constructs'; +import { DatabaseCluster, ClusterParameterGroup } from 'aws-cdk-lib/aws-docdb'; + +/* + * Stack verification steps: + * * aws docdb describe-db-clusters --db-cluster-identifier + */ + +class TestStack extends cdk.Stack { + constructor(scope: constructs.Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + + const params = new ClusterParameterGroup(this, 'Params', { + family: 'docdb3.6', + description: 'A nice parameter group', + parameters: { + audit_logs: 'disabled', + tls: 'enabled', + ttl_monitor: 'enabled', + }, + }); + + const kmsKey = new kms.Key(this, 'DbSecurity', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + + const cluster = new DatabaseCluster(this, 'Database', { + engineVersion: '3.6.0', + masterUser: { + username: 'docdb', + password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + vpc, + parameterGroup: params, + kmsKey, + removalPolicy: cdk.RemovalPolicy.DESTROY, + enablePerformanceInsights: true, + }); + + cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'aws-cdk-docdb-integ'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js new file mode 100644 index 0000000000000..c21c4d1a09186 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const appscaling = require("aws-cdk-lib/aws-applicationautoscaling"); +const cdk = require("aws-cdk-lib"); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-dynamodb'); +const table = new dynamodb.Table(stack, 'Table', { + partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +/// !show +const readScaling = table.autoScaleReadCapacity({ minCapacity: 1, maxCapacity: 50 }); +readScaling.scaleOnUtilization({ + targetUtilizationPercent: 50, +}); +readScaling.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, +}); +readScaling.scaleOnSchedule('ScaleDownAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 20, +}); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXV0b3NjYWxpbmcubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXV0b3NjYWxpbmcubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscUVBQXFFO0FBQ3JFLG1DQUFtQztBQUNuQyxxREFBcUQ7QUFFckQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxrQkFBa0IsQ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ICBzY2hlZHVsZTogYXBwc2NhbGluZy5TY2hlZHVsZS5jcm9uKHsgaG91cjogJzIwJywgbWludXRlOiAnMCcgfSksXG4gIG1heENhcGFjaXR5OiAyMCxcbn0pO1xuLy8vICFoaWRlXG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/aws-cdk-dynamodb.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.ts new file mode 100644 index 0000000000000..6b1fb00702761 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.autoscaling.lit.ts @@ -0,0 +1,31 @@ +import * as appscaling from 'aws-cdk-lib/aws-applicationautoscaling'; +import * as cdk from 'aws-cdk-lib'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-dynamodb'); + +const table = new dynamodb.Table(stack, 'Table', { + partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +/// !show +const readScaling = table.autoScaleReadCapacity({ minCapacity: 1, maxCapacity: 50 }); + +readScaling.scaleOnUtilization({ + targetUtilizationPercent: 50, +}); + +readScaling.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, +}); + +readScaling.scaleOnSchedule('ScaleDownAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 20, +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.d.ts new file mode 100644 index 0000000000000..bbce4406ab611 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.d.ts @@ -0,0 +1,5 @@ +import { Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +export declare class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js new file mode 100644 index 0000000000000..d4c5c3a84c839 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestStack = void 0; +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const table = new aws_dynamodb_1.Table(this, 'Table', { + partitionKey: { name: 'metric', type: aws_dynamodb_1.AttributeType.STRING }, + }); + const metricTableThrottled = table.metricThrottledRequestsForOperations({ + operations: [aws_dynamodb_1.Operation.PUT_ITEM, aws_dynamodb_1.Operation.SCAN], + period: aws_cdk_lib_1.Duration.minutes(1), + }); + new aws_cloudwatch_1.Alarm(this, 'TableThrottleAlarm', { + metric: metricTableThrottled, + evaluationPeriods: 1, + threshold: 1, + }); + const metricTableError = table.metricSystemErrorsForOperations({ + operations: [aws_dynamodb_1.Operation.PUT_ITEM, aws_dynamodb_1.Operation.SCAN], + period: aws_cdk_lib_1.Duration.minutes(1), + }); + new aws_cloudwatch_1.Alarm(this, 'TableErrorAlarm', { + metric: metricTableError, + evaluationPeriods: 1, + threshold: 1, + }); + } +} +exports.TestStack = TestStack; +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'alarm-metrics'); +new integ_tests_alpha_1.IntegTest(app, 'alarm-metrics-integ', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIuYWxhcm0tbWV0cmljcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmR5bmFtb2RiLmFsYXJtLW1ldHJpY3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0RBQW1EO0FBQ25ELDZDQUErRDtBQUMvRCxrRUFBdUQ7QUFFdkQsMkRBQTJFO0FBRTNFLE1BQWEsU0FBVSxTQUFRLG1CQUFLO0lBQ2xDLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxvQkFBSyxDQUFDLElBQUksRUFBRSxPQUFPLEVBQUU7WUFDckMsWUFBWSxFQUFFLEVBQUUsSUF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BlcmF0aW9uLlBVVF9JVEVNLCBPcGVyYXRpb24uU0NBTl0sXG4gICAgICBwZXJpb2Q6IER1cmF0aW9uLm1pbnV0ZXMoMSksXG4gICAgfSk7XG4gICAgbmV3IEFsYXJtKHRoaXMsICdUYWJsZVRocm90dGxlQWxhcm0nLCB7XG4gICAgICBtZXRyaWM6IG1ldHJpY1RhYmxlVGhyb3R0bGVkLFxuICAgICAgZXZhbHVhdGlvblBlcmlvZHM6IDEsXG4gICAgICB0aHJlc2hvbGQ6IDEsXG4gICAgfSk7XG4gICAgY29uc3QgbWV0cmljVGFibGVFcnJvciA9IHRhYmxlLm1ldHJpY1N5c3RlbUVycm9yc0Zvck9wZXJhdGlvbnMoe1xuICAgICAgb3BlcmF0aW9uczogW09wZXJhdGlvbi5QVVRfSVRFTSwgT3BlcmF0aW9uLlNDQU5dLFxuICAgICAgcGVyaW9kOiBEdXJhdGlvbi5taW51dGVzKDEpLFxuICAgIH0pO1xuICAgIG5ldyBBbGFybSh0aGlzLCAnVGFibGVFcnJvckFsYXJtJywge1xuICAgICAgbWV0cmljOiBtZXRyaWNUYWJsZUVycm9yLFxuICAgICAgZXZhbHVhdGlvblBlcmlvZHM6IDEsXG4gICAgICB0aHJlc2hvbGQ6IDEsXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgVGVzdFN0YWNrKGFwcCwgJ2FsYXJtLW1ldHJpY3MnKTtcblxubmV3IEludGVnVGVzdChhcHAsICdhbGFybS1tZXRyaWNzLWludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarm-metrics.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/alarmmetricsintegDefaultTestDeployAssert8721BBC0.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.ts similarity index 81% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.ts index df7494b4b388a..84d114ad6236c 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.alarm-metrics.ts @@ -1,8 +1,8 @@ -import { Alarm } from '@aws-cdk/aws-cloudwatch'; -import { App, Duration, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { Alarm } from 'aws-cdk-lib/aws-cloudwatch'; +import { App, Duration, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { AttributeType, Operation, Table } from '../lib'; +import { AttributeType, Operation, Table } from 'aws-cdk-lib/aws-dynamodb'; export class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.d.ts new file mode 100644 index 0000000000000..12300ed44fe9d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.d.ts @@ -0,0 +1,7 @@ +import { Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import { Table } from 'aws-cdk-lib/aws-dynamodb'; +export declare class TestStack extends Stack { + readonly table: Table; + constructor(scope: Construct, id: string, props?: StackProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js new file mode 100644 index 0000000000000..ab3ed6c628d48 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestStack = void 0; +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.table = new aws_dynamodb_1.Table(this, 'Table', { + partitionKey: { name: 'pk', type: aws_dynamodb_1.AttributeType.STRING }, + deletionProtection: true, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + tableName: 'deletion-protection-test', + }); + } +} +exports.TestStack = TestStack; +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'deletion-protection-stack', { + env: { + region: 'us-east-1', + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + }, +}); +new integ_tests_alpha_1.IntegTest(app, 'deletion-protection-integ-test', { + testCases: [stack], + regions: ['us-east-1'], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, + hooks: { + postDeploy: [ + 'aws dynamodb update-table --no-cli-pager --region us-east-1 --table-name deletion-protection-test --no-deletion-protection-enabled', + ],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ufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletion-protection-stack.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/deletionprotectionintegtestDefaultTestDeployAssertA66823A5.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.ts similarity index 84% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.ts index 5cbf4b003bde3..7cffcebdb292e 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.deletion-protection.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.deletion-protection.ts @@ -1,7 +1,7 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { AttributeType, Table } from '../lib'; +import { AttributeType, Table } from 'aws-cdk-lib/aws-dynamodb'; export class TestStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js new file mode 100644 index 0000000000000..d185ba4c4c6f2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +// CDK parameters +const STACK_NAME = 'aws-cdk-dynamodb'; +// DynamoDB table parameters +const TABLE = 'Table'; +const TABLE_WITH_CMK = 'TableWithCustomerManagedKey'; +const TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX = 'TableWithGlobalAndLocalSecondaryIndex'; +const TABLE_WITH_GLOBAL_SECONDARY_INDEX = 'TableWithGlobalSecondaryIndex'; +const TABLE_WITH_LOCAL_SECONDARY_INDEX = 'TableWithLocalSecondaryIndex'; +const TABLE_PARTITION_KEY = { name: 'hashKey', type: aws_dynamodb_1.AttributeType.STRING }; +const TABLE_SORT_KEY = { name: 'sortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +// DynamoDB global secondary index parameters +const GSI_TEST_CASE_1 = 'GSI-PartitionKeyOnly'; +const GSI_TEST_CASE_2 = 'GSI-PartitionAndSortKeyWithReadAndWriteCapacity'; +const GSI_TEST_CASE_3 = 'GSI-ProjectionTypeKeysOnly'; +const GSI_TEST_CASE_4 = 'GSI-ProjectionTypeInclude'; +const GSI_TEST_CASE_5 = 'GSI-InverseTableKeySchema'; +const GSI_PARTITION_KEY = { name: 'gsiHashKey', type: aws_dynamodb_1.AttributeType.STRING }; +const GSI_SORT_KEY = { name: 'gsiSortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +const GSI_NON_KEY = []; +for (let i = 0; i < 10; i++) { // 'A' to 'J' + GSI_NON_KEY.push(String.fromCharCode(65 + i)); +} +// DynamoDB local secondary index parameters +const LSI_TEST_CASE_1 = 'LSI-PartitionAndSortKey'; +const LSI_TEST_CASE_2 = 'LSI-PartitionAndTableSortKey'; +const LSI_TEST_CASE_3 = 'LSI-ProjectionTypeKeysOnly'; +const LSI_TEST_CASE_4 = 'LSI-ProjectionTypeInclude'; +const LSI_SORT_KEY = { name: 'lsiSortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +const LSI_NON_KEY = []; +for (let i = 0; i < 10; i++) { // 'K' to 'T' + LSI_NON_KEY.push(String.fromCharCode(75 + i)); +} +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, STACK_NAME); +const table = new aws_dynamodb_1.Table(stack, TABLE, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const tableWithGlobalAndLocalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX, { + pointInTimeRecovery: true, + encryption: aws_dynamodb_1.TableEncryption.AWS_MANAGED, + stream: aws_dynamodb_1.StreamViewType.KEYS_ONLY, + timeToLiveAttribute: 'timeToLive', + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +aws_cdk_lib_1.Tags.of(tableWithGlobalAndLocalSecondaryIndex).add('Environment', 'Production'); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_2, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + readCapacity: 10, + writeCapacity: 10, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_3, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_4, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: GSI_NON_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_5, + partitionKey: TABLE_SORT_KEY, + sortKey: TABLE_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_2, + sortKey: LSI_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: TABLE_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_3, + sortKey: LSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_4, + sortKey: LSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: LSI_NON_KEY, +}); +const tableWithGlobalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_GLOBAL_SECONDARY_INDEX, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +tableWithGlobalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +const tableWithLocalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_LOCAL_SECONDARY_INDEX, { + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +tableWithLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: LSI_SORT_KEY, +}); +const encryptionKey = new kms.Key(stack, 'Key', { + enableKeyRotation: true, +}); +const tableWithCMK = new aws_dynamodb_1.Table(stack, TABLE_WITH_CMK, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + stream: aws_dynamodb_1.StreamViewType.NEW_AND_OLD_IMAGES, + encryptionKey: encryptionKey, +}); +const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), +}); +tableWithCMK.grantStreamRead(role); +const user = new iam.User(stack, 'User'); +table.grantReadData(user); +tableWithGlobalAndLocalSecondaryIndex.grantReadData(user); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5keW5hbW9kYi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsNkNBQThEO0FBQzlELDJEQUE0SDtBQUU1SCxpQkFBaUI7QUFDakIsTUFBTSxVQUFVLEdBQUcsa0JBQWtCLENBQUM7QUFFdEMsNEJBQTRCO0FBQzVCLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQztBQUN0QixNQUFNLGNBQWMsR0FBRyw2QkFBNkIsQ0FBQztBQUNyRCxNQUFNLDJDQUEyQyxHQUFHLHVDQUF1QyxDQUFDO0FBQzVGLE1BQU0saUNBQWlDLEdBQUcsK0JBQStCLENBQUM7QUFDMUUsTUFBTSxnQ0FBZ0MsR0FBRyw4QkFBOEIsQ0FBQztBQUN4RSxNQUFNLG1CQUFtQixHQUFjLEVBQUUsSUFBSSxFQUFFLFNBQVMsRUFBRSxJQUFJLEVBQUUsNEJBQWEsQ0FBQyxNQUFNLEVBQUUsQ0FBQztBQUN2RixNQUFNLGNBQWMsR0FBYyxFQUFFLElBQUksRUFBRSxTQUFTLEVBQUUsSUFBSSxFQUFFLDRCQUFhLENBQUMsTUFBTSxFQUFFLENBQUM7QUFFbEYsNkNBQTZDO0FBQzdDLE1BQU0sZUFBZSxHQUFHLHN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X1dJVEhfQ01LLCB7XG4gIHBhcnRpdGlvbktleTogVEFCTEVfUEFSVElUSU9OX0tFWSxcbiAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICBzdHJlYW06IFN0cmVhbVZpZXdUeXBlLk5FV19BTkRfT0xEX0lNQUdFUyxcbiAgZW5jcnlwdGlvbktleTogZW5jcnlwdGlvbktleSxcbn0pO1xuXG5jb25zdCByb2xlID0gbmV3IGlhbS5Sb2xlKHN0YWNrLCAnUm9sZScsIHtcbiAgYXNzdW1lZEJ5OiBuZXcgaWFtLlNlcnZpY2VQcmluY2lwYWwoJ3Nxcy5hbWF6b25hd3MuY29tJyksXG59KTtcbnRhYmxlV2l0aENNSy5ncmFudFN0cmVhbVJlYWQocm9sZSk7XG5cbmNvbnN0IHVzZXIgPSBuZXcgaWFtLlVzZXIoc3RhY2ssICdVc2VyJyk7XG50YWJsZS5ncmFudFJlYWREYXRhKHVzZXIpO1xudGFibGVXaXRoR2xvYmFsQW5kTG9jYWxTZWNvbmRhcnlJbmRleC5ncmFudFJlYWREYXRhKHVzZXIpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/aws-cdk-dynamodb.template.json diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js new file mode 100644 index 0000000000000..cc64e7d19ca59 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kinesis = require("aws-cdk-lib/aws-kinesis"); +const cdk = require("aws-cdk-lib"); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-dynamodb-kinesis-stream'); +const stream = new kinesis.Stream(stack, 'Stream'); +new dynamodb.Table(stack, 'Table', { + partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, + kinesisStream: stream, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIua2luZXNpcy1zdHJlYW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5keW5hbW9kYi5raW5lc2lzLXN0cmVhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1EQUFtRDtBQUNuRCxtQ0FBbUM7QUFDbkMscURBQXFEO0FBRXJELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHL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cmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAga2luZXNpc1N0cmVhbTogc3RyZWFtLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/aws-cdk-dynamodb-kinesis-stream.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.ts new file mode 100644 index 0000000000000..f403d06816211 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.kinesis-stream.ts @@ -0,0 +1,16 @@ +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as cdk from 'aws-cdk-lib'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-dynamodb-kinesis-stream'); + +const stream = new kinesis.Stream(stack, 'Stream'); + +new dynamodb.Table(stack, 'Table', { + partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, + kinesisStream: stream, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.d.ts new file mode 100644 index 0000000000000..adfc4933c96d8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.d.ts @@ -0,0 +1,7 @@ +/** + * This aimes to verify we can deploy a DynamoDB table with an attribute being + * a key attribute in one GSI, and a non-key attribute in another. + * + * See https://github.com/aws/aws-cdk/issues/4398 + */ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js new file mode 100644 index 0000000000000..9592dad1f389d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js @@ -0,0 +1,30 @@ +"use strict"; +/** + * This aimes to verify we can deploy a DynamoDB table with an attribute being + * a key attribute in one GSI, and a non-key attribute in another. + * + * See https://github.com/aws/aws-cdk/issues/4398 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-dynamodb-gsi'); +const table = new aws_dynamodb_1.Table(stack, 'Table', { + partitionKey: { name: 'pkey', type: aws_dynamodb_1.AttributeType.NUMBER }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +table.addGlobalSecondaryIndex({ + indexName: 'IndexA', + partitionKey: { name: 'foo', type: aws_dynamodb_1.AttributeType.STRING }, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: ['bar'], +}); +table.addGlobalSecondaryIndex({ + indexName: 'IndexB', + partitionKey: { name: 'baz', type: aws_dynamodb_1.AttributeType.STRING }, + sortKey: { name: 'bar', type: aws_dynamodb_1.AttributeType.STRING }, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: ['blah'], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIubWl4ZWQta2V5LWdzaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmR5bmFtb2RiLm1peGVkLWtleS1nc2kudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7OztHQUtHOztBQUVILDZDQUF3RDtBQUN4RCwyREFBZ0Y7QUFFaEYsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxzQkFBc0IsQ0FBQyxDQUFDO0FBRXJELE1BQU0sS0FBSyxHQUFHLElBQUksb0JBQUssQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFO0lBQ3RDLFlBQVksRUFBRSxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsSUFBSSxFQUFFLDRCQUFhLENBQUMsTUFBTSxFQUFFO0lBQzFELGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87Q0FDckMsQ0FBQyxDQUFDO0FBRUgsS0FBSyxDQUFDLHVCQUF1QixDQUFDO0lBQzVCLFNBQVMsRUFBRSxRQUFRO0lBQ25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b2RiJztcblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgU3RhY2soYXBwLCAnYXdzLWNkay1keW5hbW9kYi1nc2knKTtcblxuY29uc3QgdGFibGUgPSBuZXcgVGFibGUoc3RhY2ssICdUYWJsZScsIHtcbiAgcGFydGl0aW9uS2V5OiB7IG5hbWU6ICdwa2V5JywgdHlwZTogQXR0cmlidXRlVHlwZS5OVU1CRVIgfSxcbiAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbnRhYmxlLmFkZEdsb2JhbFNlY29uZGFyeUluZGV4KHtcbiAgaW5kZXhOYW1lOiAnSW5kZXhBJyxcbiAgcGFydGl0aW9uS2V5OiB7IG5hbWU6ICdmb28nLCB0eXBlOiBBdHRyaWJ1dGVUeXBlLlNUUklORyB9LFxuICBwcm9qZWN0aW9uVHlwZTogUHJvamVjdGlvblR5cGUuSU5DTFVERSxcbiAgbm9uS2V5QXR0cmlidXRlczogWydiYXInXSxcbn0pO1xuXG50YWJsZS5hZGRHbG9iYWxTZWNvbmRhcnlJbmRleCh7XG4gIGluZGV4TmFtZTogJ0luZGV4QicsXG4gIHBhcnRpdGlvbktleTogeyBuYW1lOiAnYmF6JywgdHlwZTogQXR0cmlidXRlVHlwZS5TVFJJTkcgfSxcbiAgc29ydEtleTogeyBuYW1lOiAnYmFyJywgdHlwZTogQXR0cmlidXRlVHlwZS5TVFJJTkcgfSxcbiAgcHJvamVjdGlvblR5cGU6IFByb2plY3Rpb25UeXBlLklOQ0xVREUsXG4gIG5vbktleUF0dHJpYnV0ZXM6IFsnYmxhaCddLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/aws-cdk-dynamodb-gsi.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.ts similarity index 86% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.ts index 8c0b55f1f48a2..393f92edac8b4 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.mixed-key-gsi.ts @@ -5,8 +5,8 @@ * See https://github.com/aws/aws-cdk/issues/4398 */ -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { AttributeType, ProjectionType, Table } from '../lib'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { AttributeType, ProjectionType, Table } from 'aws-cdk-lib/aws-dynamodb'; const app = new App(); const stack = new Stack(app, 'aws-cdk-dynamodb-gsi'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js new file mode 100644 index 0000000000000..07861c11bdd3b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js @@ -0,0 +1,121 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +// CDK parameters +const STACK_NAME = 'aws-cdk-dynamodb'; +// DynamoDB table parameters +const TABLE = 'Table'; +const TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX = 'TableWithGlobalAndLocalSecondaryIndex'; +const TABLE_WITH_GLOBAL_SECONDARY_INDEX = 'TableWithGlobalSecondaryIndex'; +const TABLE_WITH_LOCAL_SECONDARY_INDEX = 'TableWithLocalSecondaryIndex'; +const TABLE_PARTITION_KEY = { name: 'hashKey', type: aws_dynamodb_1.AttributeType.STRING }; +const TABLE_SORT_KEY = { name: 'sortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +// DynamoDB global secondary index parameters +const GSI_TEST_CASE_1 = 'GSI-PartitionKeyOnly'; +const GSI_TEST_CASE_2 = 'GSI-PartitionAndSortKeyWithReadAndWriteCapacity'; +const GSI_TEST_CASE_3 = 'GSI-ProjectionTypeKeysOnly'; +const GSI_TEST_CASE_4 = 'GSI-ProjectionTypeInclude'; +const GSI_TEST_CASE_5 = 'GSI-InverseTableKeySchema'; +const GSI_PARTITION_KEY = { name: 'gsiHashKey', type: aws_dynamodb_1.AttributeType.STRING }; +const GSI_SORT_KEY = { name: 'gsiSortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +const GSI_NON_KEY = []; +for (let i = 0; i < 10; i++) { // 'A' to 'J' + GSI_NON_KEY.push(String.fromCharCode(65 + i)); +} +// DynamoDB local secondary index parameters +const LSI_TEST_CASE_1 = 'LSI-PartitionAndSortKey'; +const LSI_TEST_CASE_2 = 'LSI-PartitionAndTableSortKey'; +const LSI_TEST_CASE_3 = 'LSI-ProjectionTypeKeysOnly'; +const LSI_TEST_CASE_4 = 'LSI-ProjectionTypeInclude'; +const LSI_SORT_KEY = { name: 'lsiSortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +const LSI_NON_KEY = []; +for (let i = 0; i < 10; i++) { // 'K' to 'T' + LSI_NON_KEY.push(String.fromCharCode(75 + i)); +} +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, STACK_NAME); +// Provisioned tables +new aws_dynamodb_1.Table(stack, TABLE, { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const tableWithGlobalAndLocalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX, { + pointInTimeRecovery: true, + encryption: aws_dynamodb_1.TableEncryption.AWS_MANAGED, + stream: aws_dynamodb_1.StreamViewType.KEYS_ONLY, + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + timeToLiveAttribute: 'timeToLive', + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +aws_cdk_lib_1.Tags.of(tableWithGlobalAndLocalSecondaryIndex).add('Environment', 'Production'); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_2, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_3, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_4, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: GSI_NON_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_5, + partitionKey: TABLE_SORT_KEY, + sortKey: TABLE_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_2, + sortKey: LSI_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: TABLE_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_3, + sortKey: LSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_4, + sortKey: LSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: LSI_NON_KEY, +}); +const tableWithGlobalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_GLOBAL_SECONDARY_INDEX, { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +tableWithGlobalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +const tableWithLocalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_LOCAL_SECONDARY_INDEX, { + billingMode: aws_dynamodb_1.BillingMode.PAY_PER_REQUEST, + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +tableWithLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: LSI_SORT_KEY, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIub25kZW1hbmQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5keW5hbW9kYi5vbmRlbWFuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUE4RDtBQUM5RCwyREFBeUk7QUFFekksaUJBQWlCO0FBQ2pCLE1BQU0sVUFBVSxHQUFHLGtCQUFrQixDQUFDO0FBRXRDLDRCQUE0QjtBQUM1QixNQUFNLEtBQUssR0FBRyxPQUFPLENBQUM7QUFDdEIsTUFBTSwyQ0FBMkMsR0FBRyx1Q0FBdUMsQ0FBQztBQUM1RixNQUFNLGlDQUFpQyxHQUFHLCtCQUErQixDQUFDO0FBQzFFLE1BQU0sZ0NBQWdDLEdBQUcsOEJBQThCLENBQUM7QUFDeEUsTUFBTSxtQkFBbUIsR0FBYyxFQUFFLElBQUksRUFBRSxTQUFTLEVBQUUsSUFBSSxFQUFFLDRCQUFhLENBQUMsTUFBTSxFQUF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wge1xuICBiaWxsaW5nTW9kZTogQmlsbGluZ01vZGUuUEFZX1BFUl9SRVFVRVNULFxuICBwYXJ0aXRpb25LZXk6IFRBQkxFX1BBUlRJVElPTl9LRVksXG4gIHNvcnRLZXk6IFRBQkxFX1NPUlRfS0VZLFxuICByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1ksXG59KTtcblxudGFibGVXaXRoTG9jYWxTZWNvbmRhcnlJbmRleC5hZGRMb2NhbFNlY29uZGFyeUluZGV4KHtcbiAgaW5kZXhOYW1lOiBMU0lfVEVTVF9DQVNFXzEsXG4gIHNvcnRLZXk6IExTSV9TT1JUX0tFWSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/aws-cdk-dynamodb.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts similarity index 97% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts index 53e0bd7b20f17..5a82c86155d65 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ondemand.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ondemand.ts @@ -1,5 +1,5 @@ -import { App, RemovalPolicy, Stack, Tags } from '@aws-cdk/core'; -import { Attribute, AttributeType, BillingMode, ProjectionType, StreamViewType, Table, TableEncryption } from '../lib'; +import { App, RemovalPolicy, Stack, Tags } from 'aws-cdk-lib'; +import { Attribute, AttributeType, BillingMode, ProjectionType, StreamViewType, Table, TableEncryption } from 'aws-cdk-lib/aws-dynamodb'; // CDK parameters const STACK_NAME = 'aws-cdk-dynamodb'; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js new file mode 100644 index 0000000000000..45a595e715070 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js @@ -0,0 +1,131 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_dynamodb_1 = require("aws-cdk-lib/aws-dynamodb"); +// CDK parameters +const STACK_NAME = 'aws-cdk-dynamodb'; +// DynamoDB table parameters +const TABLE = 'Table'; +const TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX = 'TableWithGlobalAndLocalSecondaryIndex'; +const TABLE_WITH_GLOBAL_SECONDARY_INDEX = 'TableWithGlobalSecondaryIndex'; +const TABLE_WITH_LOCAL_SECONDARY_INDEX = 'TableWithLocalSecondaryIndex'; +const TABLE_PARTITION_KEY = { name: 'hashKey', type: aws_dynamodb_1.AttributeType.STRING }; +const TABLE_SORT_KEY = { name: 'sortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +// DynamoDB global secondary index parameters +const GSI_TEST_CASE_1 = 'GSI-PartitionKeyOnly'; +const GSI_TEST_CASE_2 = 'GSI-PartitionAndSortKeyWithReadAndWriteCapacity'; +const GSI_TEST_CASE_3 = 'GSI-ProjectionTypeKeysOnly'; +const GSI_TEST_CASE_4 = 'GSI-ProjectionTypeInclude'; +const GSI_TEST_CASE_5 = 'GSI-InverseTableKeySchema'; +const GSI_PARTITION_KEY = { name: 'gsiHashKey', type: aws_dynamodb_1.AttributeType.STRING }; +const GSI_SORT_KEY = { name: 'gsiSortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +const GSI_NON_KEY = []; +for (let i = 0; i < 10; i++) { // 'A' to 'J' + GSI_NON_KEY.push(String.fromCharCode(65 + i)); +} +// DynamoDB local secondary index parameters +const LSI_TEST_CASE_1 = 'LSI-PartitionAndSortKey'; +const LSI_TEST_CASE_2 = 'LSI-PartitionAndTableSortKey'; +const LSI_TEST_CASE_3 = 'LSI-ProjectionTypeKeysOnly'; +const LSI_TEST_CASE_4 = 'LSI-ProjectionTypeInclude'; +const LSI_SORT_KEY = { name: 'lsiSortKey', type: aws_dynamodb_1.AttributeType.NUMBER }; +const LSI_NON_KEY = []; +for (let i = 0; i < 10; i++) { // 'K' to 'T' + LSI_NON_KEY.push(String.fromCharCode(75 + i)); +} +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, STACK_NAME); +const table = new aws_dynamodb_1.Table(stack, TABLE, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + encryption: aws_dynamodb_1.TableEncryption.CUSTOMER_MANAGED, +}); +const tableWithGlobalAndLocalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX, { + pointInTimeRecovery: true, + encryption: aws_dynamodb_1.TableEncryption.AWS_MANAGED, + stream: aws_dynamodb_1.StreamViewType.KEYS_ONLY, + timeToLiveAttribute: 'timeToLive', + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +aws_cdk_lib_1.Tags.of(tableWithGlobalAndLocalSecondaryIndex).add('Environment', 'Production'); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_2, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + readCapacity: 10, + writeCapacity: 10, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_3, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_4, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: GSI_NON_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_5, + partitionKey: TABLE_SORT_KEY, + sortKey: TABLE_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_2, + sortKey: LSI_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: TABLE_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_3, + sortKey: LSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_4, + sortKey: LSI_SORT_KEY, + projectionType: aws_dynamodb_1.ProjectionType.INCLUDE, + nonKeyAttributes: LSI_NON_KEY, +}); +const encryptionKey = new kms.Key(stack, 'Key', { + enableKeyRotation: true, +}); +const tableWithGlobalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_GLOBAL_SECONDARY_INDEX, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + encryptionKey, +}); +tableWithGlobalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +const tableWithLocalSecondaryIndex = new aws_dynamodb_1.Table(stack, TABLE_WITH_LOCAL_SECONDARY_INDEX, { + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + encryption: aws_dynamodb_1.TableEncryption.DEFAULT, +}); +tableWithLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: LSI_SORT_KEY, +}); +const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), +}); +table.grantReadData(role); +tableWithGlobalAndLocalSecondaryIndex.grantReadData(role); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIuc3NlLmpzIiwic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MRV9XSVRIX0xPQ0FMX1NFQ09OREFSWV9JTkRFWCwge1xuICBwYXJ0aXRpb25LZXk6IFRBQkxFX1BBUlRJVElPTl9LRVksXG4gIHNvcnRLZXk6IFRBQkxFX1NPUlRfS0VZLFxuICByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gIGVuY3J5cHRpb246IFRhYmxlRW5jcnlwdGlvbi5ERUZBVUxULFxufSk7XG5cbnRhYmxlV2l0aExvY2FsU2Vjb25kYXJ5SW5kZXguYWRkTG9jYWxTZWNvbmRhcnlJbmRleCh7XG4gIGluZGV4TmFtZTogTFNJX1RFU1RfQ0FTRV8xLFxuICBzb3J0S2V5OiBMU0lfU09SVF9LRVksXG59KTtcblxuY29uc3Qgcm9sZSA9IG5ldyBpYW0uUm9sZShzdGFjaywgJ1JvbGUnLCB7XG4gIGFzc3VtZWRCeTogbmV3IGlhbS5TZXJ2aWNlUHJpbmNpcGFsKCdzcXMuYW1hem9uYXdzLmNvbScpLFxufSk7XG50YWJsZS5ncmFudFJlYWREYXRhKHJvbGUpO1xudGFibGVXaXRoR2xvYmFsQW5kTG9jYWxTZWNvbmRhcnlJbmRleC5ncmFudFJlYWREYXRhKHJvbGUpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/aws-cdk-dynamodb.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.ts similarity index 95% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.ts index de077281b7479..0f55a596eb48c 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.sse.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { App, RemovalPolicy, Stack, Tags } from '@aws-cdk/core'; -import { Attribute, AttributeType, ProjectionType, StreamViewType, Table, TableEncryption } from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import { App, RemovalPolicy, Stack, Tags } from 'aws-cdk-lib'; +import { Attribute, AttributeType, ProjectionType, StreamViewType, Table, TableEncryption } from 'aws-cdk-lib/aws-dynamodb'; // CDK parameters const STACK_NAME = 'aws-cdk-dynamodb'; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ts new file mode 100644 index 0000000000000..14d228164bd09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.dynamodb.ts @@ -0,0 +1,152 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import { App, RemovalPolicy, Stack, Tags } from 'aws-cdk-lib'; +import { Attribute, AttributeType, ProjectionType, StreamViewType, Table, TableEncryption } from 'aws-cdk-lib/aws-dynamodb'; + +// CDK parameters +const STACK_NAME = 'aws-cdk-dynamodb'; + +// DynamoDB table parameters +const TABLE = 'Table'; +const TABLE_WITH_CMK = 'TableWithCustomerManagedKey'; +const TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX = 'TableWithGlobalAndLocalSecondaryIndex'; +const TABLE_WITH_GLOBAL_SECONDARY_INDEX = 'TableWithGlobalSecondaryIndex'; +const TABLE_WITH_LOCAL_SECONDARY_INDEX = 'TableWithLocalSecondaryIndex'; +const TABLE_PARTITION_KEY: Attribute = { name: 'hashKey', type: AttributeType.STRING }; +const TABLE_SORT_KEY: Attribute = { name: 'sortKey', type: AttributeType.NUMBER }; + +// DynamoDB global secondary index parameters +const GSI_TEST_CASE_1 = 'GSI-PartitionKeyOnly'; +const GSI_TEST_CASE_2 = 'GSI-PartitionAndSortKeyWithReadAndWriteCapacity'; +const GSI_TEST_CASE_3 = 'GSI-ProjectionTypeKeysOnly'; +const GSI_TEST_CASE_4 = 'GSI-ProjectionTypeInclude'; +const GSI_TEST_CASE_5 = 'GSI-InverseTableKeySchema'; +const GSI_PARTITION_KEY: Attribute = { name: 'gsiHashKey', type: AttributeType.STRING }; +const GSI_SORT_KEY: Attribute = { name: 'gsiSortKey', type: AttributeType.NUMBER }; +const GSI_NON_KEY: string[] = []; +for (let i = 0; i < 10; i++) { // 'A' to 'J' + GSI_NON_KEY.push(String.fromCharCode(65 + i)); +} + +// DynamoDB local secondary index parameters +const LSI_TEST_CASE_1 = 'LSI-PartitionAndSortKey'; +const LSI_TEST_CASE_2 = 'LSI-PartitionAndTableSortKey'; +const LSI_TEST_CASE_3 = 'LSI-ProjectionTypeKeysOnly'; +const LSI_TEST_CASE_4 = 'LSI-ProjectionTypeInclude'; +const LSI_SORT_KEY: Attribute = { name: 'lsiSortKey', type: AttributeType.NUMBER }; +const LSI_NON_KEY: string[] = []; +for (let i = 0; i < 10; i++) { // 'K' to 'T' + LSI_NON_KEY.push(String.fromCharCode(75 + i)); +} + +const app = new App(); + +const stack = new Stack(app, STACK_NAME); + +const table = new Table(stack, TABLE, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: RemovalPolicy.DESTROY, +}); + +const tableWithGlobalAndLocalSecondaryIndex = new Table(stack, TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX, { + pointInTimeRecovery: true, + encryption: TableEncryption.AWS_MANAGED, + stream: StreamViewType.KEYS_ONLY, + timeToLiveAttribute: 'timeToLive', + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: RemovalPolicy.DESTROY, +}); + +Tags.of(tableWithGlobalAndLocalSecondaryIndex).add('Environment', 'Production'); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_2, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + readCapacity: 10, + writeCapacity: 10, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_3, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_4, + partitionKey: GSI_PARTITION_KEY, + sortKey: GSI_SORT_KEY, + projectionType: ProjectionType.INCLUDE, + nonKeyAttributes: GSI_NON_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_5, + partitionKey: TABLE_SORT_KEY, + sortKey: TABLE_PARTITION_KEY, +}); + +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_2, + sortKey: LSI_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: TABLE_SORT_KEY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_3, + sortKey: LSI_SORT_KEY, + projectionType: ProjectionType.KEYS_ONLY, +}); +tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_4, + sortKey: LSI_SORT_KEY, + projectionType: ProjectionType.INCLUDE, + nonKeyAttributes: LSI_NON_KEY, +}); + +const tableWithGlobalSecondaryIndex = new Table(stack, TABLE_WITH_GLOBAL_SECONDARY_INDEX, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: RemovalPolicy.DESTROY, +}); +tableWithGlobalSecondaryIndex.addGlobalSecondaryIndex({ + indexName: GSI_TEST_CASE_1, + partitionKey: GSI_PARTITION_KEY, +}); + +const tableWithLocalSecondaryIndex = new Table(stack, TABLE_WITH_LOCAL_SECONDARY_INDEX, { + partitionKey: TABLE_PARTITION_KEY, + sortKey: TABLE_SORT_KEY, + removalPolicy: RemovalPolicy.DESTROY, +}); + +tableWithLocalSecondaryIndex.addLocalSecondaryIndex({ + indexName: LSI_TEST_CASE_1, + sortKey: LSI_SORT_KEY, +}); + +const encryptionKey = new kms.Key(stack, 'Key', { + enableKeyRotation: true, +}); + +const tableWithCMK = new Table(stack, TABLE_WITH_CMK, { + partitionKey: TABLE_PARTITION_KEY, + removalPolicy: RemovalPolicy.DESTROY, + stream: StreamViewType.NEW_AND_OLD_IMAGES, + encryptionKey: encryptionKey, +}); + +const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), +}); +tableWithCMK.grantStreamRead(role); + +const user = new iam.User(stack, 'User'); +table.grantReadData(user); +tableWithGlobalAndLocalSecondaryIndex.grantReadData(user); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js new file mode 100644 index 0000000000000..1bc8e76d675cb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-dynamodb-global-replicas-provisioned'); +const table = new dynamodb.Table(stack, 'Table', { + partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, + replicationRegions: ['us-east-2', 'eu-west-3'], + billingMode: dynamodb.BillingMode.PROVISIONED, +}); +table.autoScaleWriteCapacity({ + minCapacity: 5, + maxCapacity: 10, +}).scaleOnUtilization({ targetUtilizationPercent: 75 }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2xvYmFsLXJlcGxpY2FzLXByb3Zpc2lvbmVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ2xvYmFsLXJlcGxpY2FzLXByb3Zpc2lvbmVkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLHFEQUFxRDtBQUVyRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0F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0YWNrLCAnVGFibGUnLCB7XG4gIHBhcnRpdGlvbktleTogeyBuYW1lOiAnaGFzaEtleScsIHR5cGU6IGR5bmFtb2RiLkF0dHJpYnV0ZVR5cGUuU1RSSU5HIH0sXG4gIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gIHJlcGxpY2F0aW9uUmVnaW9uczogWyd1cy1lYXN0LTInLCAnZXUtd2VzdC0zJ10sXG4gIGJpbGxpbmdNb2RlOiBkeW5hbW9kYi5CaWxsaW5nTW9kZS5QUk9WSVNJT05FRCxcbn0pO1xuXG50YWJsZS5hdXRvU2NhbGVXcml0ZUNhcGFjaXR5KHtcbiAgbWluQ2FwYWNpdHk6IDUsXG4gIG1heENhcGFjaXR5OiAxMCxcbn0pLnNjYWxlT25VdGlsaXphdGlvbih7IHRhcmdldFV0aWxpemF0aW9uUGVyY2VudDogNzUgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts new file mode 100644 index 0000000000000..75c127848923f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts @@ -0,0 +1,77 @@ +/* eslint-disable no-console */ +import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +export async function onEventHandler(event: OnEventRequest): Promise { + console.log('Event: %j', { ...event, ResponseURL: '...' }); + + const dynamodb = new DynamoDB(); + + const tableName = event.ResourceProperties.TableName; + const region = event.ResourceProperties.Region; + + let updateTableAction: 'Create' | 'Update' | 'Delete' | undefined; + if (event.RequestType === 'Create' || event.RequestType === 'Delete') { + updateTableAction = event.RequestType; + } else { // Update + // There are two cases where an Update can happen: + // 1. A table replacement. In that case, we need to create the replica in the new Table + // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). + // 2. A customer has changed one of the properties of the Custom Resource, + // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. + // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. + const describeTableResult = await dynamodb.describeTable({ + TableName: tableName, + }).promise(); + console.log('Describe table: %j', describeTableResult); + const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); + updateTableAction = replicaExists ? undefined : 'Create'; + } + + if (updateTableAction) { + const data = await dynamodb.updateTable({ + TableName: tableName, + ReplicaUpdates: [ + { + [updateTableAction]: { + RegionName: region, + }, + }, + ], + }).promise(); + console.log('Update table: %j', data); + } else { + console.log("Skipping updating Table, as a replica in '%s' already exists", region); + } + + return event.RequestType === 'Create' || event.RequestType === 'Update' + ? { PhysicalResourceId: `${tableName}-${region}` } + : {}; +} + +export async function isCompleteHandler(event: IsCompleteRequest): Promise { + console.log('Event: %j', { ...event, ResponseURL: '...' }); + + const dynamodb = new DynamoDB(); + + const data = await dynamodb.describeTable({ + TableName: event.ResourceProperties.TableName, + }).promise(); + console.log('Describe table: %j', data); + + const tableActive = data.Table?.TableStatus === 'ACTIVE'; + const replicas = data.Table?.Replicas ?? []; + const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); + const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; + const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; + + switch (event.RequestType) { + case 'Create': + case 'Update': + // Complete when replica is reported as ACTIVE + return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; + case 'Delete': + // Complete when replica is gone + return { IsComplete: tableActive && regionReplica === undefined }; + } +} diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/aws-cdk-dynamodb-global-replicas-provisioned.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/awscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderEA32CB30.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/awscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderEA32CB30.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/awscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderEA32CB30.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/awscdkdynamodbglobalreplicasprovisionedawscdkawsdynamodbReplicaProviderEA32CB30.nested.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.ts similarity index 85% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.ts index 8403538c2bd50..6ed7111f94e01 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global-replicas-provisioned.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as dynamodb from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-dynamodb-global-replicas-provisioned'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js new file mode 100644 index 0000000000000..3fe6781db12ac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const table = new dynamodb.Table(this, 'Table', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + replicationRegions: [ + 'eu-west-2', + 'eu-central-1', + ], + }); + table.addGlobalSecondaryIndex({ + indexName: 'my-index', + partitionKey: { + name: 'key', + type: dynamodb.AttributeType.STRING, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-dynamodb-global-20191121', { env: { region: 'eu-west-1' } }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2xvYmFsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ2xvYmFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQW9FO0FBRXBFLHFEQUFxRDtBQUVyRCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sS0FBSyxHQUFHLElBQUksUUFBUSxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFO1lBQzlDLFlBQVksRUFBRTtnQkFDWixJQUFJLEVBQUUsSUFBSTtnQkFDVixJQUFJLEVBQUUsUUFBUSxDQUFDLGFBQWEsQ0FBQyxNQUFNO2FBQ3BDO1lBQ0QsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztZQUNwQyxrQkFBa0IsRUFBRTtnQkFD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AgICAgdHlwZTogZHluYW1vZGIuQXR0cmlidXRlVHlwZS5TVFJJTkcsXG4gICAgICB9LFxuICAgICAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICAgICAgcmVwbGljYXRpb25SZWdpb25zOiBbXG4gICAgICAgICdldS13ZXN0LTInLFxuICAgICAgICAnZXUtY2VudHJhbC0xJyxcbiAgICAgIF0sXG4gICAgfSk7XG5cbiAgICB0YWJsZS5hZGRHbG9iYWxTZWNvbmRhcnlJbmRleCh7XG4gICAgICBpbmRleE5hbWU6ICdteS1pbmRleCcsXG4gICAgICBwYXJ0aXRpb25LZXk6IHtcbiAgICAgICAgbmFtZTogJ2tleScsXG4gICAgICAgIHR5cGU6IGR5bmFtb2RiLkF0dHJpYnV0ZVR5cGUuU1RSSU5HLFxuICAgICAgfSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1keW5hbW9kYi1nbG9iYWwtMjAxOTExMjEnLCB7IGVudjogeyByZWdpb246ICdldS13ZXN0LTEnIH0gfSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts new file mode 100644 index 0000000000000..75c127848923f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts @@ -0,0 +1,77 @@ +/* eslint-disable no-console */ +import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +export async function onEventHandler(event: OnEventRequest): Promise { + console.log('Event: %j', { ...event, ResponseURL: '...' }); + + const dynamodb = new DynamoDB(); + + const tableName = event.ResourceProperties.TableName; + const region = event.ResourceProperties.Region; + + let updateTableAction: 'Create' | 'Update' | 'Delete' | undefined; + if (event.RequestType === 'Create' || event.RequestType === 'Delete') { + updateTableAction = event.RequestType; + } else { // Update + // There are two cases where an Update can happen: + // 1. A table replacement. In that case, we need to create the replica in the new Table + // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). + // 2. A customer has changed one of the properties of the Custom Resource, + // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. + // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. + const describeTableResult = await dynamodb.describeTable({ + TableName: tableName, + }).promise(); + console.log('Describe table: %j', describeTableResult); + const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); + updateTableAction = replicaExists ? undefined : 'Create'; + } + + if (updateTableAction) { + const data = await dynamodb.updateTable({ + TableName: tableName, + ReplicaUpdates: [ + { + [updateTableAction]: { + RegionName: region, + }, + }, + ], + }).promise(); + console.log('Update table: %j', data); + } else { + console.log("Skipping updating Table, as a replica in '%s' already exists", region); + } + + return event.RequestType === 'Create' || event.RequestType === 'Update' + ? { PhysicalResourceId: `${tableName}-${region}` } + : {}; +} + +export async function isCompleteHandler(event: IsCompleteRequest): Promise { + console.log('Event: %j', { ...event, ResponseURL: '...' }); + + const dynamodb = new DynamoDB(); + + const data = await dynamodb.describeTable({ + TableName: event.ResourceProperties.TableName, + }).promise(); + console.log('Describe table: %j', data); + + const tableActive = data.Table?.TableStatus === 'ACTIVE'; + const replicas = data.Table?.Replicas ?? []; + const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); + const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; + const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; + + switch (event.RequestType) { + case 'Create': + case 'Update': + // Complete when replica is reported as ACTIVE + return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; + case 'Delete': + // Complete when replica is gone + return { IsComplete: tableActive && regionReplica === undefined }; + } +} diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.assets.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.assets.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk-dynamodb-global-20191121.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdkdynamodbglobal20191121awscdkawsdynamodbReplicaProviderB281C954.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdkdynamodbglobal20191121awscdkawsdynamodbReplicaProviderB281C954.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/cdkdynamodbglobal20191121awscdkawsdynamodbReplicaProviderB281C954.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/cdkdynamodbglobal20191121awscdkawsdynamodbReplicaProviderB281C954.nested.template.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.ts similarity index 85% rename from packages/@aws-cdk/aws-dynamodb/test/integ.global.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.ts index e697731091ec7..c743a098f2866 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-dynamodb/test/integ.global.ts @@ -1,6 +1,6 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as dynamodb from '../lib'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/import-certificates-handler/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/import-certificates-handler/index.d.ts diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/import-certificates-handler/index.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/import-certificates-handler/index.js diff --git a/packages/@aws-cdk/aws-ec2/test/import-certificates-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/import-certificates-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-certificates-handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/import-certificates-handler/index.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js new file mode 100644 index 0000000000000..4f4bd2500959d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* + * Stack verification steps: + * * aws ssm start-session --target + * * lscpu # Architecture should be aarch64 + */ +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + new ec2.BastionHostLinux(this, 'BastionHost', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.NANO), + }); + } +} +new TestStack(app, 'TestStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYmFzdGlvbi1ob3N0LWFybS1zdXBwb3J0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYmFzdGlvbi1ob3N0LWFybS1zdXBwb3J0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7R0FJRztBQUNILG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxTQUFVLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDL0IsW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wcm9wcz86IGNkay5TdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBjb25zdCB2cGMgPSBuZXcgZWMyLlZwYyh0aGlzLCAnVlBDJyk7XG5cbiAgICBuZXcgZWMyLkJhc3Rpb25Ib3N0TGludXgodGhpcywgJ0Jhc3Rpb25Ib3N0Jywge1xuICAgICAgdnBjLFxuICAgICAgaW5zdGFuY2VUeXBlOiBlYzIuSW5zdGFuY2VUeXBlLm9mKGVjMi5JbnN0YW5jZUNsYXNzLlQ0RywgZWMyLkluc3RhbmNlU2l6ZS5OQU5PKSxcbiAgICB9KTtcbiAgfVxufVxuXG5uZXcgVGVzdFN0YWNrKGFwcCwgJ1Rlc3RTdGFjaycpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.ts similarity index 87% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.ts index 06d6d12557ba9..7a2b218d60b5c 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-arm-support.ts @@ -3,8 +3,8 @@ * * aws ssm start-session --target * * lscpu # Architecture should be aarch64 */ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js new file mode 100644 index 0000000000000..767d4cc4552e8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + new ec2.BastionHostLinux(this, 'BastionHost', { vpc }); + } +} +new TestStack(app, 'TestStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYmFzdGlvbi1ob3N0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYmFzdGlvbi1ob3N0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsZ0JBQWdCO0FBQ2hCLG1DQ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GludXgodGhpcywgJ0Jhc3Rpb25Ib3N0JywgeyB2cGMgfSk7XG4gIH1cbn1cblxubmV3IFRlc3RTdGFjayhhcHAsICdUZXN0U3RhY2snKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.ts similarity index 80% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.ts index 32b8976c6f7a0..3a08f411dda14 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host.ts @@ -1,6 +1,6 @@ /// !cdk-integ * -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js new file mode 100644 index 0000000000000..ab77402f6ef55 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const logs = require("aws-cdk-lib/aws-logs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const constructs_1 = require("constructs"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // Import server and client certificates in ACM + const certificates = new ImportCertificates(this, 'ImportCertificates'); + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 0 }); + vpc.node.addDependency(certificates); // ensure certificates are deleted last, when not in use anymore + const logGroup = new logs.LogGroup(this, 'LogGroup', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + vpc.addClientVpnEndpoint('Endpoint', { + cidr: '10.100.0.0/16', + serverCertificateArn: certificates.serverCertificateArn, + clientCertificateArn: certificates.clientCertificateArn, + logGroup, + }); + } +} +const IMPORT_CERTIFICATES_RESOURCE_TYPE = 'Custom::ACMImportCertificates'; +class ImportCertificates extends constructs_1.Construct { + constructor(scope, id) { + super(scope, id); + const serviceToken = aws_cdk_lib_1.CustomResourceProvider.getOrCreate(this, IMPORT_CERTIFICATES_RESOURCE_TYPE, { + codeDirectory: path.join(__dirname, 'import-certificates-handler'), + runtime: aws_cdk_lib_1.CustomResourceProviderRuntime.NODEJS_14_X, + policyStatements: [{ + Effect: 'Allow', + Action: ['acm:ImportCertificate', 'acm:DeleteCertificate'], + Resource: '*', + }], + }); + const createCertificates = new aws_cdk_lib_1.CustomResource(this, 'CreateCertificates', { + resourceType: IMPORT_CERTIFICATES_RESOURCE_TYPE, + serviceToken, + }); + this.serverCertificateArn = createCertificates.getAttString('ClientCertificateArn'); + this.clientCertificateArn = createCertificates.getAttString('ServerCertificateArn'); + new aws_cdk_lib_1.CustomResource(this, 'DeleteCertificates', { + resourceType: IMPORT_CERTIFICATES_RESOURCE_TYPE, + serviceToken, + properties: { + ServerCertificateArn: this.serverCertificateArn, + ClientCertificateArn: this.clientCertificateArn, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-ec2-client-vp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mljYXRlQXJuID0gY3JlYXRlQ2VydGlmaWNhdGVzLmdldEF0dFN0cmluZygnU2VydmVyQ2VydGlmaWNhdGVBcm4nKTtcblxuICAgIG5ldyBDdXN0b21SZXNvdXJjZSh0aGlzLCAnRGVsZXRlQ2VydGlmaWNhdGVzJywge1xuICAgICAgcmVzb3VyY2VUeXBlOiBJTVBPUlRfQ0VSVElGSUNBVEVTX1JFU09VUkNFX1RZUEUsXG4gICAgICBzZXJ2aWNlVG9rZW4sXG4gICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgIFNlcnZlckNlcnRpZmljYXRlQXJuOiB0aGlzLnNlcnZlckNlcnRpZmljYXRlQXJuLFxuICAgICAgICBDbGllbnRDZXJ0aWZpY2F0ZUFybjogdGhpcy5jbGllbnRDZXJ0aWZpY2F0ZUFybixcbiAgICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstZWMyLWNsaWVudC12cG4tZW5kcG9pbnQnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ec2/test/import-certificates-handler/ca.crt b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/ca.crt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-certificates-handler/ca.crt rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/ca.crt diff --git a/packages/@aws-cdk/aws-ec2/test/import-certificates-handler/client1.domain.tld.crt b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.crt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-certificates-handler/client1.domain.tld.crt rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.crt diff --git a/packages/@aws-cdk/aws-ec2/test/import-certificates-handler/client1.domain.tld.key b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.key similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-certificates-handler/client1.domain.tld.key rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.key diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/index.ts diff --git a/packages/@aws-cdk/aws-ec2/test/import-certificates-handler/server.crt b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.crt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-certificates-handler/server.crt rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.crt diff --git a/packages/@aws-cdk/aws-ec2/test/import-certificates-handler/server.key b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.key similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-certificates-handler/server.key rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.key diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk-ec2-client-vpn-endpoint.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.bastion-host-arm-support.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.ts similarity index 93% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.ts index bf844274e54b9..8376d69071ff5 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.client-vpn-endpoint.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as logs from '@aws-cdk/aws-logs'; -import { App, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import { App, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as ec2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.d.ts new file mode 100644 index 0000000000000..5e0782e6d6d51 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.d.ts @@ -0,0 +1,6 @@ +import { CfnParameter, StackProps } from 'aws-cdk-lib'; +export interface consumerDeployProps extends StackProps { + stringListGetAtt: string[]; + stringListRef: CfnParameter; + manualStringList: string[]; +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js new file mode 100644 index 0000000000000..2a4f2ca6c9729 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ssm = require("aws-cdk-lib/aws-ssm"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +// GIVEN +const app = new aws_cdk_lib_1.App({ + treeMetadata: false, +}); +class ProducerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'vpc'); + this.stringListGetAtt = new aws_ec2_1.InterfaceVpcEndpoint(this, 'endpoint', { + vpc, + service: aws_ec2_1.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, + }).vpcEndpointDnsEntries; + this.stringListRef = new aws_cdk_lib_1.CfnParameter(this, 'stringListParam', { + default: 'BLAT,BLAH', + type: 'List', + }); + this.manualExport = this.exportStringListValue(['string1', 'string2'], { + name: 'ManualExport', + }); + } +} +class ConsumerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new ssm.StringListParameter(this, 'GetAtt', { + stringListValue: props.stringListGetAtt, + }); + new ssm.StringListParameter(this, 'Ref', { + stringListValue: props.stringListRef.valueAsList, + }); + new ssm.StringListParameter(this, 'Manual', { + stringListValue: props.manualStringList, + }); + } +} +const producer = new ProducerStack(app, 'producer'); +const consumer = new ConsumerStack(app, 'consumer', { + stringListGetAtt: producer.stringListGetAtt, + stringListRef: producer.stringListRef, + manualStringList: producer.manualExport, +}); +// THEN +new integ_tests_alpha_1.IntegTest(app, 'cross-region-references', { + testCases: [producer, consumer], + stackUpdateWorkflow: false, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29yZS1jcm9zcy1zdGFjay1zdHJpbmctbGlzdC1yZWZlcmVuY2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY29yZS1jcm9zcy1zdGFjay1zdHJpbmctbGlzdC1yZWZlcmVuY2VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDZDQUFtRTtBQUNuRSxrRUFBdUQ7QUFFdkQsaURBQWdHO0FBRWhHLFFBQVE7QUFDUixNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLENBQUM7SUFDbEIsWUFBWSxFQUFFLEtBQUs7Q0FDcEIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxhQUFjLFNBQVEsbUJBQUs7SUFLL0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLEdBQUcsR0FBRyxJQUFJLGFBQUcsQ0FBQyxJQUFJLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFDakMsSUFBSSxDQUFDLGdCQUFnQixHQUFHLElBQUksOEJBQW9CLENBQUMsSUFBSSxFQUFFLFVBQVUsRUFBRTtZQUNqRSxHQUFHO1lBQ0gsT0FBTyxFQUFFLHdDQUE4QixDQUFDLGVBQWU7U0FDeEQsQ0FBQyxDQUFD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IHN0YWNrVXBkYXRlV29ya2Zsb3c6IGZhbHNlLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.sse.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/consumer.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/crossregionreferencesDefaultTestDeployAssertAB7415FD.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/producer.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.ts similarity index 90% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.ts index fc45599493847..c19901f7f969a 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.core-cross-stack-string-list-references.ts @@ -1,8 +1,8 @@ -import * as ssm from '@aws-cdk/aws-ssm'; -import { App, CfnParameter, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; +import { App, CfnParameter, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { InterfaceVpcEndpoint, InterfaceVpcEndpointAwsService, Vpc } from '../lib'; +import { InterfaceVpcEndpoint, InterfaceVpcEndpointAwsService, Vpc } from 'aws-cdk-lib/aws-ec2'; // GIVEN const app = new App({ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js new file mode 100644 index 0000000000000..43e841e2ede22 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + const instance = new ec2.Instance(this, 'Instance', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE), + machineImage: new ec2.AmazonLinuxImage({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + cpuType: ec2.AmazonLinuxCpuType.ARM_64, + }), + detailedMonitoring: true, + }); + instance.addToRolePolicy(new aws_iam_1.PolicyStatement({ + actions: ['ssm:*'], + resources: ['*'], + })); + instance.connections.allowFromAnyIpv4(ec2.Port.icmpPing()); + instance.addUserData('yum install -y'); + } +} +new TestStack(app, 'TestStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3Jhdml0b24zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ3Jhdml0b24z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SksXG4gICAgICBtYWNoaW5lSW1hZ2U6IG5ldyBlYzIuQW1hem9uTGludXhJbWFnZSh7XG4gICAgICAgIGdlbmVyYXRpb246IGVjMi5BbWF6b25MaW51eEdlbmVyYXRpb24uQU1BWk9OX0xJTlVYXzIsXG4gICAgICAgIGNwdVR5cGU6IGVjMi5BbWF6b25MaW51eENwdVR5cGUuQVJNXzY0LFxuICAgICAgfSksXG4gICAgICBkZXRhaWxlZE1vbml0b3Jpbmc6IHRydWUsXG4gICAgfSk7XG5cbiAgICBpbnN0YW5jZS5hZGRUb1JvbGVQb2xpY3kobmV3IFBvbGljeVN0YXRlbWVudCh7XG4gICAgICBhY3Rpb25zOiBbJ3NzbToqJ10sXG4gICAgICByZXNvdXJjZXM6IFsnKiddLFxuICAgIH0pKTtcblxuICAgIGluc3RhbmNlLmNvbm5lY3Rpb25zLmFsbG93RnJvbUFueUlwdjQoZWMyLlBvcnQuaWNtcFBpbmcoKSk7XG5cbiAgICBpbnN0YW5jZS5hZGRVc2VyRGF0YSgneXVtIGluc3RhbGwgLXknKTtcbiAgfVxufVxuXG5uZXcgVGVzdFN0YWNrKGFwcCwgJ1Rlc3RTdGFjaycpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.graviton3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.ts similarity index 86% rename from packages/@aws-cdk/aws-ec2/test/integ.graviton3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.ts index 4ac885155a38b..17464c5ba892f 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.graviton3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.graviton3.ts @@ -1,7 +1,7 @@ /// !cdk-integ * -import { PolicyStatement } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import { PolicyStatement } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js new file mode 100644 index 0000000000000..68dcc6d8a2d88 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * pragma:enable-lookups +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +// we associate this stack with an explicit environment since this is required by the +// environmental context provider used in `fromLookup`. CDK_INTEG_XXX are set +// when producing the .expected file and CDK_DEFAULT_XXX is passed in through from +// the CLI in actual deployment. +const env = { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, +}; +const stack = new cdk.Stack(app, 'aws-cdk-ec2-import', { env }); +/// !show +const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { + // This imports the default VPC but you can also + // specify a 'vpcName' or 'tags'. + isDefault: true, +}); +/// !hide +// The only thing in this library that takes a VPC as an argument :) +new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc, +}); +// Try subnet selection +new cdk.CfnOutput(stack, 'PublicSubnets', { value: 'ids:' + vpc.publicSubnets.map(s => s.subnetId).join(',') }); +new cdk.CfnOutput(stack, 'PrivateSubnets', { value: 'ids:' + vpc.privateSubnets.map(s => s.subnetId).join(',') }); +// Route table IDs +new cdk.CfnOutput(stack, 'PublicRouteTables', { value: 'ids: ' + vpc.publicSubnets.map(s => s.routeTable.routeTableId).join(', ') }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW1wb3J0LWRlZmF1bHQtdnBjLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmltcG9ydC1kZWZhdWx0LXZwYy5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxzQ0FBc0M7QUFDdEMsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixxRkFBcUY7QUFDckYsNkVBQTZFO0FBQzdFLGtGQUFrRjtBQUNsRixnQ0FBZ0M7QUFDaEMsTUFBTSxHQUFHLEdBQUc7SUFDVixPQUFPLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxpQkFBaUIsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLG1CQUFtQjtJQUN6RSxNQUFNLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxnQkFBZ0IsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGtCQUFrQjtDQUN2RSxDQUFDO0FBRUYsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxvQkFBb0IsRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFFaEUsU0FBUztBQUNULE1BQU0sR0FBRyxHQUFHLEdBQUcsQ0FBQyxHQUFHLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUU7SUFD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hbiBhbHNvXG4gIC8vIHNwZWNpZnkgYSAndnBjTmFtZScgb3IgJ3RhZ3MnLlxuICBpc0RlZmF1bHQ6IHRydWUsXG59KTtcbi8vLyAhaGlkZVxuXG4vLyBUaGUgb25seSB0aGluZyBpbiB0aGlzIGxpYnJhcnkgdGhhdCB0YWtlcyBhIFZQQyBhcyBhbiBhcmd1bWVudCA6KVxubmV3IGVjMi5TZWN1cml0eUdyb3VwKHN0YWNrLCAnU2VjdXJpdHlHcm91cCcsIHtcbiAgdnBjLFxufSk7XG5cbi8vIFRyeSBzdWJuZXQgc2VsZWN0aW9uXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1B1YmxpY1N1Ym5ldHMnLCB7IHZhbHVlOiAnaWRzOicgKyB2cGMucHVibGljU3VibmV0cy5tYXAocyA9PiBzLnN1Ym5ldElkKS5qb2luKCcsJykgfSk7XG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1ByaXZhdGVTdWJuZXRzJywgeyB2YWx1ZTogJ2lkczonICsgdnBjLnByaXZhdGVTdWJuZXRzLm1hcChzID0+IHMuc3VibmV0SWQpLmpvaW4oJywnKSB9KTtcblxuLy8gUm91dGUgdGFibGUgSURzXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1B1YmxpY1JvdXRlVGFibGVzJywgeyB2YWx1ZTogJ2lkczogJyArIHZwYy5wdWJsaWNTdWJuZXRzLm1hcChzID0+IHMucm91dGVUYWJsZS5yb3V0ZVRhYmxlSWQpLmpvaW4oJywgJykgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/aws-cdk-ec2-import.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/aws-cdk-ec2-import.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/aws-cdk-ec2-import.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/aws-cdk-ec2-import.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.ts new file mode 100644 index 0000000000000..670b2489a5974 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.import-default-vpc.lit.ts @@ -0,0 +1,38 @@ +/// !cdk-integ * pragma:enable-lookups +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +const app = new cdk.App(); + +// we associate this stack with an explicit environment since this is required by the +// environmental context provider used in `fromLookup`. CDK_INTEG_XXX are set +// when producing the .expected file and CDK_DEFAULT_XXX is passed in through from +// the CLI in actual deployment. +const env = { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, +}; + +const stack = new cdk.Stack(app, 'aws-cdk-ec2-import', { env }); + +/// !show +const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { + // This imports the default VPC but you can also + // specify a 'vpcName' or 'tags'. + isDefault: true, +}); +/// !hide + +// The only thing in this library that takes a VPC as an argument :) +new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc, +}); + +// Try subnet selection +new cdk.CfnOutput(stack, 'PublicSubnets', { value: 'ids:' + vpc.publicSubnets.map(s => s.subnetId).join(',') }); +new cdk.CfnOutput(stack, 'PrivateSubnets', { value: 'ids:' + vpc.privateSubnets.map(s => s.subnetId).join(',') }); + +// Route table IDs +new cdk.CfnOutput(stack, 'PublicRouteTables', { value: 'ids: ' + vpc.publicSubnets.map(s => s.routeTable.routeTableId).join(', ') }); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js new file mode 100644 index 0000000000000..6cd8d5828752b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js @@ -0,0 +1,52 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = require("fs"); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-init'); +const vpc = new ec2.Vpc(stack, 'IntegInitVpc'); +const tmpDir = fs.mkdtempSync('/tmp/cfn-init-test'); +fs.writeFileSync(path.resolve(tmpDir, 'testFile'), 'Hello World!\n'); +new ec2.Instance(stack, 'Instance2', { + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), + userDataCausesReplacement: true, + initOptions: { + timeout: cdk.Duration.minutes(30), + }, + init: ec2.CloudFormationInit.fromConfigSets({ + configSets: { + default: ['yumPreinstall', 'config'], + }, + configs: { + yumPreinstall: new ec2.InitConfig([ + ec2.InitPackage.yum('git'), + ]), + config: new ec2.InitConfig([ + ec2.InitFile.fromObject('/tmp/file2.json', { + stackId: stack.stackId, + stackName: stack.stackName, + region: stack.region, + intProperty: 18, + boolProperty: true, + numProperty: 58.23, + }), + ec2.InitGroup.fromName('group1'), + ec2.InitGroup.fromName('group2', 42), + ec2.InitUser.fromName('sysuser1', { + groups: ['group1', 'group2'], + homeDir: '/home/sysuser1-custom', + }), + ec2.InitUser.fromName('sysuser2'), + ec2.InitSource.fromAsset('/tmp/sourceDir', tmpDir), + ]), + }, + }), +}); +app.synth(); +//# sourceMappingURL=data:application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SW5pdFVzZXIuZnJvbU5hbWUoJ3N5c3VzZXIxJywge1xuICAgICAgICAgIGdyb3VwczogWydncm91cDEnLCAnZ3JvdXAyJ10sXG4gICAgICAgICAgaG9tZURpcjogJy9ob21lL3N5c3VzZXIxLWN1c3RvbScsXG4gICAgICAgIH0pLFxuICAgICAgICBlYzIuSW5pdFVzZXIuZnJvbU5hbWUoJ3N5c3VzZXIyJyksXG4gICAgICAgIGVjMi5Jbml0U291cmNlLmZyb21Bc3NldCgnL3RtcC9zb3VyY2VEaXInLCB0bXBEaXIpLFxuICAgICAgXSksXG4gICAgfSxcbiAgfSksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/asset.f8a1af398dac2fad92eeea4fb7620be1c4f504e23e3bfcd859fbb5744187930b/testFile b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/asset.f8a1af398dac2fad92eeea4fb7620be1c4f504e23e3bfcd859fbb5744187930b/testFile similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/asset.f8a1af398dac2fad92eeea4fb7620be1c4f504e23e3bfcd859fbb5744187930b/testFile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/asset.f8a1af398dac2fad92eeea4fb7620be1c4f504e23e3bfcd859fbb5744187930b/testFile diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/integ-init.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.ts similarity index 95% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.ts index f3977948f3168..8f906c09483bb 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node import * as fs from 'fs'; import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-init'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js new file mode 100644 index 0000000000000..2912a6dcdc417 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + // Here we test default separator as probably most useful + const multipartUserData = new ec2.MultipartUserData(); + const userData1 = ec2.UserData.forLinux(); + userData1.addCommands('echo 大らと > /var/tmp/echo1'); + userData1.addCommands('cp /var/tmp/echo1 /var/tmp/echo1-copy'); + const userData2 = ec2.UserData.forLinux(); + userData2.addCommands(`echo 大らと ${vpc.vpcId} > /var/tmp/echo2`); + const rawPart1 = ec2.MultipartBody.fromRawBody({ + contentType: 'text/x-shellscript', + body: 'echo "RawPart" > /var/tmp/rawPart1', + }); + const rawPart2 = ec2.MultipartBody.fromRawBody({ + contentType: 'text/x-shellscript', + body: `echo "RawPart ${vpc.vpcId}" > /var/tmp/rawPart2`, + }); + const bootHook = ec2.UserData.forLinux(); + bootHook.addCommands('echo "Boothook2" > /var/tmp/boothook', 'cloud-init-per once docker_options echo \'OPTIONS="${OPTIONS} --storage-opt dm.basesize=20G"\' >> /etc/sysconfig/docker'); + multipartUserData.addPart(ec2.MultipartBody.fromUserData(userData1)); + multipartUserData.addPart(ec2.MultipartBody.fromUserData(userData2)); + multipartUserData.addPart(ec2.MultipartBody.fromUserData(bootHook, 'text/cloud-boothook')); + const rawPart3 = ec2.MultipartBody.fromRawBody({ + contentType: 'text/x-shellscript', + body: 'cp $0 /var/tmp/upstart # Should be one line file no new line at the end and beginning', + }); + multipartUserData.addPart(rawPart1); + multipartUserData.addPart(rawPart2); + multipartUserData.addPart(rawPart3); + const instance = new ec2.Instance(this, 'Instance', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + userData: multipartUserData, + }); + instance.addToRolePolicy(new aws_iam_1.PolicyStatement({ + actions: ['ssm:*', 'ssmmessages:*', 'ec2messages:GetMessages'], + resources: ['*'], + })); + instance.connections.allowFromAnyIpv4(ec2.Port.icmpPing()); + } +} +new TestStack(app, 'TestStackMultipartUserData'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxl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bm5ldyBUZXN0U3RhY2soYXBwLCAnVGVzdFN0YWNrTXVsdGlwYXJ0VXNlckRhdGEnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/TestStackMultipartUserData.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/TestStackMultipartUserData.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/TestStackMultipartUserData.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/TestStackMultipartUserData.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.ts similarity index 94% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.ts index 9038166b93e39..25dd486f0a4a6 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.instance-multipart-userdata.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-multipart-userdata.ts @@ -1,7 +1,7 @@ /// !cdk-integ * -import { PolicyStatement } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import { PolicyStatement } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js new file mode 100644 index 0000000000000..2390deedfc688 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + const securityGroup = new ec2.SecurityGroup(this, 'IntegSg', { + vpc, + allowAllIpv6Outbound: true, + }); + const instance = new ec2.Instance(this, 'Instance', { + vpc, + securityGroup, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.NANO), + machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), + detailedMonitoring: true, + }); + instance.addToRolePolicy(new aws_iam_1.PolicyStatement({ + actions: ['ssm:*'], + resources: ['*'], + })); + instance.connections.allowFromAnyIpv4(ec2.Port.icmpPing()); + instance.addUserData('yum install -y'); + } +} +const testCase = new TestStack(app, 'integ-ec2-instance'); +new integ_tests_alpha_1.IntegTest(app, 'instance-test', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5pbnN0YW5jZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFzRDtBQUN0RCxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FB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c3RhbmNlID0gbmV3IGVjMi5JbnN0YW5jZSh0aGlzLCAnSW5zdGFuY2UnLCB7XG4gICAgICB2cGMsXG4gICAgICBzZWN1cml0eUdyb3VwLFxuICAgICAgaW5zdGFuY2VUeXBlOiBlYzIuSW5zdGFuY2VUeXBlLm9mKGVjMi5JbnN0YW5jZUNsYXNzLlQzLCBlYzIuSW5zdGFuY2VTaXplLk5BTk8pLFxuICAgICAgbWFjaGluZUltYWdlOiBuZXcgZWMyLkFtYXpvbkxpbnV4SW1hZ2UoeyBnZW5lcmF0aW9uOiBlYzIuQW1hem9uTGludXhHZW5lcmF0aW9uLkFNQVpPTl9MSU5VWF8yIH0pLFxuICAgICAgZGV0YWlsZWRNb25pdG9yaW5nOiB0cnVlLFxuICAgIH0pO1xuXG4gICAgaW5zdGFuY2UuYWRkVG9Sb2xlUG9saWN5KG5ldyBQb2xpY3lTdGF0ZW1lbnQoe1xuICAgICAgYWN0aW9uczogWydzc206KiddLFxuICAgICAgcmVzb3VyY2VzOiBbJyonXSxcbiAgICB9KSk7XG5cbiAgICBpbnN0YW5jZS5jb25uZWN0aW9ucy5hbGxvd0Zyb21BbnlJcHY0KGVjMi5Qb3J0LmljbXBQaW5nKCkpO1xuXG4gICAgaW5zdGFuY2UuYWRkVXNlckRhdGEoJ3l1bSBpbnN0YWxsIC15Jyk7XG4gIH1cbn1cblxuY29uc3QgdGVzdENhc2UgPSBuZXcgVGVzdFN0YWNrKGFwcCwgJ2ludGVnLWVjMi1pbnN0YW5jZScpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2luc3RhbmNlLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.custompolicy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/integ-ec2-instance.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.ts similarity index 83% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.ts index 24333b3e32757..20f26c8fe7e07 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.instance.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance.ts @@ -1,7 +1,7 @@ -import { PolicyStatement } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib'; +import { PolicyStatement } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js new file mode 100644 index 0000000000000..d897e4c5195e7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-lt-metadata-1'); +new ec2.LaunchTemplate(stack, 'LT', { + httpEndpoint: true, + httpProtocolIpv6: true, + httpPutResponseHopLimit: 2, + httpTokens: ec2.LaunchTemplateHttpTokens.REQUIRED, + instanceMetadataTags: true, +}); +new ec2.LaunchTemplate(stack, 'LTWithMachineImage', { + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), +}); +new integ.IntegTest(app, 'LambdaTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGF1bmNoLXRlbXBsYXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGF1bmNoLXRlbXBsYXR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cy1hbHBoYSc7XG5pbXBvcnQgKiBhcyBlYzIgZnJvbSAnYXdzLWNkay1saWIvYXdzLWVjMic7XG5cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1jZGstZWMyLWx0LW1ldGFkYXRhLTEnKTtcblxubmV3IGVjMi5MYXVuY2hUZW1wbGF0ZShzdGFjaywgJ0xUJywge1xuICBodHRwRW5kcG9pbnQ6IHRydWUsXG4gIGh0dHBQcm90b2NvbElwdjY6IHRydWUsXG4gIGh0dHBQdXRSZXNwb25zZUhvcExpbWl0OiAyLFxuICBodHRwVG9rZW5zOiBlYzIuTGF1bmNoVGVtcGxhdGVIdHRwVG9rZW5zLlJFUVVJUkVELFxuICBpbnN0YW5jZU1ldGFkYXRhVGFnczogdHJ1ZSxcbn0pO1xuXG5uZXcgZWMyLkxhdW5jaFRlbXBsYXRlKHN0YWNrLCAnTFRXaXRoTWFjaGluZUltYWdlJywge1xuICBtYWNoaW5lSW1hZ2U6IGVjMi5NYWNoaW5lSW1hZ2UubGF0ZXN0QW1hem9uTGludXgoe1xuICAgIGdlbmVyYXRpb246IGVjMi5BbWF6b25MaW51eEdlbmVyYXRpb24uQU1BWk9OX0xJTlVYXzIsXG4gIH0pLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnTGFtYmRhVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/aws-cdk-ec2-lt-metadata-1.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.core-cross-stack-string-list-references.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.ts similarity index 80% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.ts index ba56a75edd4d5..6aca1c8d76657 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.launch-template.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js new file mode 100644 index 0000000000000..66d1499eb8e92 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:enable-lookups +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +class NatInstanceStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + // Configure the `natGatewayProvider` when defining a Vpc + const natGatewayProvider = ec2.NatProvider.instance({ + instanceType: new ec2.InstanceType('t3.small'), + }); + const vpc = new ec2.Vpc(this, 'MyVpc', { + natGatewayProvider, + // The 'natGateways' parameter now controls the number of NAT instances + natGateways: 2, + }); + /// !hide + Array.isArray(vpc); + Array.isArray(natGatewayProvider.configuredGateways); + } +} +const app = new cdk.App(); +new NatInstanceStack(app, 'aws-cdk-vpc-nat-instances', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_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ZGVyLFxuXG4gICAgICAvLyBUaGUgJ25hdEdhdGV3YXlzJyBwYXJhbWV0ZXIgbm93IGNvbnRyb2xzIHRoZSBudW1iZXIgb2YgTkFUIGluc3RhbmNlc1xuICAgICAgbmF0R2F0ZXdheXM6IDIsXG4gICAgfSk7XG4gICAgLy8vICFoaWRlXG5cbiAgICBBcnJheS5pc0FycmF5KHZwYyk7XG4gICAgQXJyYXkuaXNBcnJheShuYXRHYXRld2F5UHJvdmlkZXIuY29uZmlndXJlZEdhdGV3YXlzKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IE5hdEluc3RhbmNlU3RhY2soYXBwLCAnYXdzLWNkay12cGMtbmF0LWluc3RhbmNlcycsIHtcbiAgZW52OiB7XG4gICAgYWNjb3VudDogcHJvY2Vzcy5lbnYuQ0RLX0lOVEVHX0FDQ09VTlQgfHwgcHJvY2Vzcy5lbnYuQ0RLX0RFRkFVTFRfQUNDT1VOVCxcbiAgICByZWdpb246IHByb2Nlc3MuZW52LkNES19JTlRFR19SRUdJT04gfHwgcHJvY2Vzcy5lbnYuQ0RLX0RFRkFVTFRfUkVHSU9OLFxuICB9LFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/aws-cdk-vpc-nat-instances.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance-init.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.ts new file mode 100644 index 0000000000000..8efd9c74f2412 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.nat-instances.lit.ts @@ -0,0 +1,35 @@ +/// !cdk-integ pragma:enable-lookups +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class NatInstanceStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + // Configure the `natGatewayProvider` when defining a Vpc + const natGatewayProvider = ec2.NatProvider.instance({ + instanceType: new ec2.InstanceType('t3.small'), + }); + + const vpc = new ec2.Vpc(this, 'MyVpc', { + natGatewayProvider, + + // The 'natGateways' parameter now controls the number of NAT instances + natGateways: 2, + }); + /// !hide + + Array.isArray(vpc); + Array.isArray(natGatewayProvider.configuredGateways); + } +} + +const app = new cdk.App(); +new NatInstanceStack(app, 'aws-cdk-vpc-nat-instances', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, + }, +}); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js new file mode 100644 index 0000000000000..9e9a9ab6e926a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + const sg = new ec2.SecurityGroup(this, 'SecGroup', { + vpc, + }); + sg.addIngressRule(ec2.Peer.anyIpv6(), ec2.Port.allIcmpV6(), 'allow ICMP6'); + } +} +new TestStack(app, 'TestStack'); +new integ_tests_alpha_1.IntegTest(app, 'Ports', { + testCases: [ + new TestStack(app, 'PortsTestStack', {}), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucG9ydHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wb3J0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sU0FBVSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQy9CLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXJDLE1BQU0sRUFBRSxHQUFHLElBQUksR0FBRyxDQUFDLGFBQWEsQ0FBQyxJQUFJLEVB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0dyb3VwJywge1xuICAgICAgdnBjLFxuICAgIH0pO1xuICAgIHNnLmFkZEluZ3Jlc3NSdWxlKFxuICAgICAgZWMyLlBlZXIuYW55SXB2NigpLFxuICAgICAgZWMyLlBvcnQuYWxsSWNtcFY2KCksXG4gICAgICAnYWxsb3cgSUNNUDYnLFxuICAgICk7XG4gIH1cbn1cblxubmV3IFRlc3RTdGFjayhhcHAsICdUZXN0U3RhY2snKTtcblxubmV3IEludGVnVGVzdChhcHAsICdQb3J0cycsIHtcbiAgdGVzdENhc2VzOiBbXG4gICAgbmV3IFRlc3RTdGFjayhhcHAsICdQb3J0c1Rlc3RTdGFjaycsIHt9KSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsDefaultTestDeployAssert044B81BF.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/PortsTestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/TestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/TestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/TestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/TestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.ts similarity index 79% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.ts index 4fbe54b5c5225..741cba67ae2a7 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.ports.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.ports.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib/index'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js new file mode 100644 index 0000000000000..9dafd915a5089 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +/* + * Creates a simple vpc with a public subnet and a private reserved subnet. + * Public subnet should be visible but a private reserved subnet only has IP space reserved. + * No resources are provisioned in a reserved subnet. + * + * Stack verification steps: + * -- aws ec2 describe-nat-gateways returns { "natGateways": []} + */ +const app = new cdk.App(); +class VpcReservedPrivateSubnetStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + // Specify no NAT gateways with a reserved private subnet + new ec2.Vpc(this, 'VPC', { + ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'), + subnetConfiguration: [ + { + name: 'ingress', + subnetType: ec2.SubnetType.PUBLIC, + }, + { + name: 'private', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + reserved: true, + }, + ], + natGateways: 0, + }); + /// !hide + } +} +new VpcReservedPrivateSubnetStack(app, 'aws-cdk-ec2-vpc-endpoint'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVzZXJ2ZWQtcHJpdmF0ZS1zdWJuZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5yZXNlcnZlZC1wcml2YXRl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2luZ3Jlc3MnLFxuICAgICAgICAgIHN1Ym5ldFR5cGU6IGVjMi5TdWJuZXRUeXBlLlBVQkxJQyxcbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgIG5hbWU6ICdwcml2YXRlJyxcbiAgICAgICAgICBzdWJuZXRUeXBlOiBlYzIuU3VibmV0VHlwZS5QUklWQVRFX1dJVEhfRUdSRVNTLFxuICAgICAgICAgIHJlc2VydmVkOiB0cnVlLFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICAgIG5hdEdhdGV3YXlzOiAwLFxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5uZXcgVnBjUmVzZXJ2ZWRQcml2YXRlU3VibmV0U3RhY2soYXBwLCAnYXdzLWNkay1lYzItdnBjLWVuZHBvaW50Jyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.ports.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.ts similarity index 93% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.ts index 583983e0aef2a..8bebc2df09416 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.reserved-private-subnet.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; /* * Creates a simple vpc with a public subnet and a private reserved subnet. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js new file mode 100644 index 0000000000000..4b09ac78264b8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const cdk = require("aws-cdk-lib"); +const constructs_1 = require("constructs"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class ConstructThatTakesAVpc extends constructs_1.Construct { + constructor(scope, id, _props) { + super(scope, id); + // new ec2.CfnInstance(this, 'Instance', { + // subnetId: props.vpc.privateSubnets[0].subnetId, + // imageId: new ec2.AmazonLinuxImage().getImage(this).imageId, + // }); + } +} +/// !show +/** + * Stack1 creates the VPC + */ +class Stack1 extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.vpc = new ec2.Vpc(this, 'VPC'); + } +} +/** + * Stack2 consumes the VPC + */ +class Stack2 extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // Pass the VPC to a construct that needs it + new ConstructThatTakesAVpc(this, 'Construct', { + vpc: props.vpc, + }); + } +} +const stack1 = new Stack1(app, 'Stack1'); +const stack2 = new Stack2(app, 'Stack2', { + vpc: stack1.vpc, +}); +/// !hide +Array.isArray(stack2); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2hhcmUtdnBjcy5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zaGFyZS12cGNzLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGdCQUFnQjtBQUNoQixtQ0FBbUM7QUFDbkMsMkNBQXVDO0FBQ3ZDLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQU0xQixNQUFNLHNCQUF1QixTQUFRLHNCQUFTO0lBQzVDLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsTUFBbUM7UUFDM0UsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQiwwQ0FBMEM7UUFDMUMsb0RBQW9EO1FBQ3BELGdFQUFnRTtRQUNoRSxNQUFNO0lBQ1IsQ0FBQztDQUNGO0FBRUQsU0FBUztBQUNUOztHQUVHO0FBQ0gsTUFBTSxNQUFPLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFHNUIsWUFBWSxLQUFjLEVBQUUsRUFBVSxFQUFFLEtBQXNCO1FBQzVELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLElBQUksQ0FBQyxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR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2NvcGU6IGNkay5BcHAsIGlkOiBzdHJpbmcsIHByb3BzOiBTdGFjazJQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgLy8gUGFzcyB0aGUgVlBDIHRvIGEgY29uc3RydWN0IHRoYXQgbmVlZHMgaXRcbiAgICBuZXcgQ29uc3RydWN0VGhhdFRha2VzQVZwYyh0aGlzLCAnQ29uc3RydWN0Jywge1xuICAgICAgdnBjOiBwcm9wcy52cGMsXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3Qgc3RhY2sxID0gbmV3IFN0YWNrMShhcHAsICdTdGFjazEnKTtcbmNvbnN0IHN0YWNrMiA9IG5ldyBTdGFjazIoYXBwLCAnU3RhY2syJywge1xuICB2cGM6IHN0YWNrMS52cGMsXG59KTtcbi8vLyAhaGlkZVxuXG5BcnJheS5pc0FycmF5KHN0YWNrMik7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack1.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack2.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/Stack2.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.ts new file mode 100644 index 0000000000000..a3df962a0306d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.share-vpcs.lit.ts @@ -0,0 +1,63 @@ +/// !cdk-integ * +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +const app = new cdk.App(); + +interface ConstructThatTakesAVpcProps { + vpc: ec2.IVpc; +} + +class ConstructThatTakesAVpc extends Construct { + constructor(scope: Construct, id: string, _props: ConstructThatTakesAVpcProps) { + super(scope, id); + + // new ec2.CfnInstance(this, 'Instance', { + // subnetId: props.vpc.privateSubnets[0].subnetId, + // imageId: new ec2.AmazonLinuxImage().getImage(this).imageId, + // }); + } +} + +/// !show +/** + * Stack1 creates the VPC + */ +class Stack1 extends cdk.Stack { + public readonly vpc: ec2.Vpc; + + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + this.vpc = new ec2.Vpc(this, 'VPC'); + } +} + +interface Stack2Props extends cdk.StackProps { + vpc: ec2.IVpc; +} + +/** + * Stack2 consumes the VPC + */ +class Stack2 extends cdk.Stack { + constructor(scope: cdk.App, id: string, props: Stack2Props) { + super(scope, id, props); + + // Pass the VPC to a construct that needs it + new ConstructThatTakesAVpc(this, 'Construct', { + vpc: props.vpc, + }); + } +} + +const stack1 = new Stack1(app, 'Stack1'); +const stack2 = new Stack2(app, 'Stack2', { + vpc: stack1.vpc, +}); +/// !hide + +Array.isArray(stack2); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js new file mode 100644 index 0000000000000..369e10552e8e0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js @@ -0,0 +1,17 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-userdata'); +const vpc = new ec2.Vpc(stack, 'IntegUserdataVpc'); +new ec2.Instance(stack, 'WindowsInstance', { + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: new ec2.WindowsImage(ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_BASE), + userData: ec2.UserData.forWindows({ persist: true }), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlcmRhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy51c2VyZGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZ0JBQWdCLENBQUMsQ0FBQztBQUVuRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLGtCQUFrQixDQUFDLENBQUM7QUFFbkQsSUFBSSxHQUFHLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxpQkFBaUIsRUFBRTtJQUN6QyxHQUFHO0lBQ0gsVUFBVSxFQUFFLEVBQUUsVUFBVSxFQUFFLEdBQUcsQ0FBQyxVQUFVLENBQUMsTUFBT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IuV2luZG93c0ltYWdlKGVjMi5XaW5kb3dzVmVyc2lvbi5XSU5ET1dTX1NFUlZFUl8yMDIyX0VOR0xJU0hfRlVMTF9CQVNFKSxcbiAgdXNlckRhdGE6IGVjMi5Vc2VyRGF0YS5mb3JXaW5kb3dzKHsgcGVyc2lzdDogdHJ1ZSB9KSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.alarm-metrics.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/integ-userdata.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.ts similarity index 86% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.ts index 002de7bd6cc29..ce265e61957d6 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.userdata.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.userdata.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-userdata'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js new file mode 100644 index 0000000000000..8ef2ee9e3af65 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-volume-1'); +new ec2.Volume(stack, 'TestVolume', { + availabilityZone: 'us-east-1a', + size: cdk.Size.gibibytes(1), + volumeType: ec2.EbsDeviceVolumeType.GP3, + throughput: 200, +}); +new integ.IntegTest(app, 'VolumeTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudm9sdW1lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudm9sdW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCwyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxzQkFBc0IsQ0FBQyxDQUFDO0FBRXpELElBQUksR0FBRyxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsWUFBWSxFQUFFO0lBQ2xDLGdCQUFnQixFQUFFLFlBQVk7SUFDOUIsSUFBSSxFQUFFLEdBQUcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQU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.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/aws-cdk-ec2-volume-1.template.json diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-config/test/integ.scoped-rule.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts new file mode 100644 index 0000000000000..98c93a683e4d1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts @@ -0,0 +1,20 @@ +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-ec2-volume-1'); + +new ec2.Volume(stack, 'TestVolume', { + availabilityZone: 'us-east-1a', + size: cdk.Size.gibibytes(1), + volumeType: ec2.EbsDeviceVolumeType.GP3, + throughput: 200, +}); + +new integ.IntegTest(app, 'VolumeTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/VolumeTestDefaultTestDeployAssert896AAE82.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/aws-cdk-ec2-volume-1.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.volume.ts.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js new file mode 100644 index 0000000000000..3b89113f37e3e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc-azs'); +new ec2.Vpc(stack, 'MyVpc', { + availabilityZones: [stack.availabilityZones[1]], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWF6cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1henMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUscUJBQXFCLENBQUMsQ0FBQztBQUV4RCxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRTtJQUMxQixpQkFBaUIsRUFBRSxDQUFDLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDLENBQUMsQ0FBQztDQUNoRCxDQUFDLENBQUM7QUFFSCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgZWMyIGZyb20gJ2F3cy1jZGstbGliL2F3cy1lYzInO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1jZGstZWMyLXZwYy1henMnKTtcblxubmV3IGVjMi5WcGMoc3RhY2ssICdNeVZwYycsIHtcbiAgYXZhaWxhYmlsaXR5Wm9uZXM6IFtzdGFjay5hdmFpbGFiaWxpdHlab25lc1sxXV0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/aws-cdk-ec2-vpc-azs.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.instance.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.ts new file mode 100644 index 0000000000000..3733776c47a68 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-azs.ts @@ -0,0 +1,11 @@ +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc-azs'); + +new ec2.Vpc(stack, 'MyVpc', { + availabilityZones: [stack.availabilityZones[1]], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js new file mode 100644 index 0000000000000..8025b71e3c875 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +class VpcEndpointStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + // Add gateway endpoints when creating the VPC + const vpc = new ec2.Vpc(this, 'MyVpc', { + gatewayEndpoints: { + S3: { + service: ec2.GatewayVpcEndpointAwsService.S3, + }, + }, + }); + // Alternatively gateway endpoints can be added on the VPC + const dynamoDbEndpoint = vpc.addGatewayEndpoint('DynamoDbEndpoint', { + service: ec2.GatewayVpcEndpointAwsService.DYNAMODB, + }); + // This allows to customize the endpoint policy + dynamoDbEndpoint.addToPolicy(new iam.PolicyStatement({ + principals: [new iam.AnyPrincipal()], + actions: ['dynamodb:DescribeTable', 'dynamodb:ListTables'], + resources: ['*'], + })); + // Add an interface endpoint + vpc.addInterfaceEndpoint('EcrDockerEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER, + // Uncomment the following to allow more fine-grained control over + // who can access the endpoint via the '.connections' object. + // open: false + }); + /// !hide + } +} +new VpcEndpointStack(app, 'aws-cdk-ec2-vpc-endpoint'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWVuZHBvaW50LmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1lbmRwb2ludC5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLGdCQUFpQixTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQ3RDLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixTQUFTO1FBQ1QsOENBQThDO1FBQzlDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFO1lBQ3JDLGdCQUFnQixFQUFFO2dCQUNoQixFQUFFLEVBQUU7b0JBQ0YsT0FBTyxFQUFFLEdBQUcsQ0FBQyw0QkFBNEIsQ0FBQyxFQUFFO2lCQUM3QzthQUNGO1NBQ0YsQ0FBQyxDQUFDO1FBRUgsMERBQTBEO1FBQzFELE1BQU0sZ0JBQWdCLEdBQUcsR0FBRyxDQUFDLGtCQUFrQix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cmNlczogWycqJ10sXG4gICAgICB9KSk7XG5cbiAgICAvLyBBZGQgYW4gaW50ZXJmYWNlIGVuZHBvaW50XG4gICAgdnBjLmFkZEludGVyZmFjZUVuZHBvaW50KCdFY3JEb2NrZXJFbmRwb2ludCcsIHtcbiAgICAgIHNlcnZpY2U6IGVjMi5JbnRlcmZhY2VWcGNFbmRwb2ludEF3c1NlcnZpY2UuRUNSX0RPQ0tFUixcblxuICAgICAgLy8gVW5jb21tZW50IHRoZSBmb2xsb3dpbmcgdG8gYWxsb3cgbW9yZSBmaW5lLWdyYWluZWQgY29udHJvbCBvdmVyXG4gICAgICAvLyB3aG8gY2FuIGFjY2VzcyB0aGUgZW5kcG9pbnQgdmlhIHRoZSAnLmNvbm5lY3Rpb25zJyBvYmplY3QuXG4gICAgICAvLyBvcGVuOiBmYWxzZVxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbm5ldyBWcGNFbmRwb2ludFN0YWNrKGFwcCwgJ2F3cy1jZGstZWMyLXZwYy1lbmRwb2ludCcpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/aws-cdk-ec2-vpc-endpoint.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.userdata.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.ts new file mode 100644 index 0000000000000..68bc76dcc5f79 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-endpoint.lit.ts @@ -0,0 +1,47 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +const app = new cdk.App(); + +class VpcEndpointStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + // Add gateway endpoints when creating the VPC + const vpc = new ec2.Vpc(this, 'MyVpc', { + gatewayEndpoints: { + S3: { + service: ec2.GatewayVpcEndpointAwsService.S3, + }, + }, + }); + + // Alternatively gateway endpoints can be added on the VPC + const dynamoDbEndpoint = vpc.addGatewayEndpoint('DynamoDbEndpoint', { + service: ec2.GatewayVpcEndpointAwsService.DYNAMODB, + }); + + // This allows to customize the endpoint policy + dynamoDbEndpoint.addToPolicy( + new iam.PolicyStatement({ // Restrict to listing and describing tables + principals: [new iam.AnyPrincipal()], + actions: ['dynamodb:DescribeTable', 'dynamodb:ListTables'], + resources: ['*'], + })); + + // Add an interface endpoint + vpc.addInterfaceEndpoint('EcrDockerEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER, + + // Uncomment the following to allow more fine-grained control over + // who can access the endpoint via the '.connections' object. + // open: false + }); + /// !hide + } +} + +new VpcEndpointStack(app, 'aws-cdk-ec2-vpc-endpoint'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js new file mode 100644 index 0000000000000..9c0d8bffda39b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new aws_cdk_lib_1.App(); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc'); + // Test can filter by Subnet Ids via selectSubnets + const subnets = vpc.selectSubnets({ + subnetFilters: [ec2.SubnetFilter.byIds([vpc.privateSubnets[0].subnetId])], + }); + new aws_cdk_lib_1.CfnOutput(this, 'PrivateSubnet01', { + value: subnets.subnetIds[0], + }); + } +} +new integ_tests_alpha_1.IntegTest(app, 'VPCFilterSubnets', { + testCases: [new TestStack(app, 'VPCFilterSubnetsTestStack')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWZpbHRlci1zdWJuZXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudnBjLWZpbHRlci1zdWJuZXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQWdFO0FBQ2hFLGtFQUF1RDtBQUN2RCwyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyx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ZXN0cy1hbHBoYSc7XG5pbXBvcnQgKiBhcyBlYzIgZnJvbSAnYXdzLWNkay1saWIvYXdzLWVjMic7XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcblxuY2xhc3MgVGVzdFN0YWNrIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQXBwLCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIGNvbnN0IHZwYyA9IG5ldyBlYzIuVnBjKHRoaXMsICdWcGMnKTtcblxuICAgIC8vIFRlc3QgY2FuIGZpbHRlciBieSBTdWJuZXQgSWRzIHZpYSBzZWxlY3RTdWJuZXRzXG4gICAgY29uc3Qgc3VibmV0cyA9IHZwYy5zZWxlY3RTdWJuZXRzKHtcbiAgICAgIHN1Ym5ldEZpbHRlcnM6IFtlYzIuU3VibmV0RmlsdGVyLmJ5SWRzKFt2cGMucHJpdmF0ZVN1Ym5ldHNbMF0uc3VibmV0SWRdKV0sXG4gICAgfSk7XG5cbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdQcml2YXRlU3VibmV0MDEnLCB7XG4gICAgICB2YWx1ZTogc3VibmV0cy5zdWJuZXRJZHNbMF0sXG4gICAgfSk7XG4gIH1cbn1cblxubmV3IEludGVnVGVzdChhcHAsICdWUENGaWx0ZXJTdWJuZXRzJywge1xuICB0ZXN0Q2FzZXM6IFtuZXcgVGVzdFN0YWNrKGFwcCwgJ1ZQQ0ZpbHRlclN1Ym5ldHNUZXN0U3RhY2snKV0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsDefaultTestDeployAssertC02936E8.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/VPCFilterSubnetsTestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.ts similarity index 78% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.ts index 1051767406ee3..3824bd15b5333 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-filter-subnets.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-filter-subnets.ts @@ -1,6 +1,6 @@ -import { App, Stack, StackProps, CfnOutput } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib'; +import { App, Stack, StackProps, CfnOutput } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js new file mode 100644 index 0000000000000..dfce1f3d2da9c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const app = new aws_cdk_lib_1.App(); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'VPC'); + new aws_ec2_1.FlowLog(this, 'FlowLogsCW', { + resourceType: aws_ec2_1.FlowLogResourceType.fromVpc(vpc), + logFormat: [ + aws_ec2_1.LogFormat.SRC_PORT, + ], + }); + new aws_ec2_1.FlowLog(this, 'FlowLogsAllFormatCW', { + resourceType: aws_ec2_1.FlowLogResourceType.fromVpc(vpc), + logFormat: [ + aws_ec2_1.LogFormat.VERSION, + aws_ec2_1.LogFormat.ACCOUNT_ID, + aws_ec2_1.LogFormat.INTERFACE_ID, + aws_ec2_1.LogFormat.SRC_ADDR, + aws_ec2_1.LogFormat.DST_ADDR, + aws_ec2_1.LogFormat.SRC_PORT, + aws_ec2_1.LogFormat.DST_PORT, + aws_ec2_1.LogFormat.PROTOCOL, + aws_ec2_1.LogFormat.PACKETS, + aws_ec2_1.LogFormat.BYTES, + aws_ec2_1.LogFormat.START_TIMESTAMP, + aws_ec2_1.LogFormat.END_TIMESTAMP, + aws_ec2_1.LogFormat.ACTION, + aws_ec2_1.LogFormat.LOG_STATUS, + aws_ec2_1.LogFormat.VPC_ID, + aws_ec2_1.LogFormat.SUBNET_ID, + aws_ec2_1.LogFormat.INSTANCE_ID, + aws_ec2_1.LogFormat.TCP_FLAGS, + aws_ec2_1.LogFormat.TRAFFIC_TYPE, + aws_ec2_1.LogFormat.PKT_SRC_ADDR, + aws_ec2_1.LogFormat.PKT_DST_ADDR, + aws_ec2_1.LogFormat.REGION, + aws_ec2_1.LogFormat.AZ_ID, + aws_ec2_1.LogFormat.SUBLOCATION_TYPE, + aws_ec2_1.LogFormat.SUBLOCATION_ID, + aws_ec2_1.LogFormat.PKT_SRC_AWS_SERVICE, + aws_ec2_1.LogFormat.PKT_DST_AWS_SERVICE, + aws_ec2_1.LogFormat.FLOW_DIRECTION, + aws_ec2_1.LogFormat.TRAFFIC_PATH, + ], + }); + const bucket = new aws_s3_1.Bucket(this, 'Bucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + vpc.addFlowLog('FlowLogsS3', { + destination: aws_ec2_1.FlowLogDestination.toS3(bucket, 'prefix/'), + logFormat: [ + aws_ec2_1.LogFormat.DST_PORT, + aws_ec2_1.LogFormat.SRC_PORT, + ], + }); + } +} +new integ_tests_alpha_1.IntegTest(app, 'FlowLogs', { + testCases: [ + new TestStack(app, 'FlowLogsTestStack'), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWZsb3ctbG9ncy1jdXN0b21mb3JtYXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52cGMtZmxvdy1sb2dzLWN1c3RvbWZvcm1hdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtDQUE0QztBQUM1Qyw2Q0FBb0U7QUFDcEUsa0VBQXVEO0FBQ3ZELGlEQUF1RztBQUV2RyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUd0QixNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQVUsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDcEQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxHQUFHLEdBQUcsSUFBSSxhQUFHLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRWpDLElBQUksaUJBQU8sQ0FBQyxJQUFJLEVBQUUsWUFBWSxFQUFFO1lBQzlCLFlBQVksRUFBRSw2QkFBbUIsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDO1lBQzlDLFNBQVMsRUFBRTtnQkFDVCxtQkFBUyxDQU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MnLCB7XG4gICAgICBkZXN0aW5hdGlvbjogRmxvd0xvZ0Rlc3RpbmF0aW9uLnRvUzMoYnVja2V0LCAncHJlZml4LycpLFxuICAgICAgbG9nRm9ybWF0OiBbXG4gICAgICAgIExvZ0Zvcm1hdC5EU1RfUE9SVCxcbiAgICAgICAgTG9nRm9ybWF0LlNSQ19QT1JULFxuICAgICAgXSxcbiAgICB9KTtcblxuICB9XG59XG5cblxubmV3IEludGVnVGVzdChhcHAsICdGbG93TG9ncycsIHtcbiAgdGVzdENhc2VzOiBbXG4gICAgbmV3IFRlc3RTdGFjayhhcHAsICdGbG93TG9nc1Rlc3RTdGFjaycpLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/FlowLogsTestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.ts similarity index 89% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.ts index 208f805c064c8..20dae1e9ada62 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-customformat.ts @@ -1,7 +1,7 @@ -import { Bucket } from '@aws-cdk/aws-s3'; -import { App, Stack, StackProps, RemovalPolicy } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { FlowLog, FlowLogDestination, FlowLogResourceType, Vpc, LogFormat } from '../lib'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import { App, Stack, StackProps, RemovalPolicy } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { FlowLog, FlowLogDestination, FlowLogResourceType, Vpc, LogFormat } from 'aws-cdk-lib/aws-ec2'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js new file mode 100644 index 0000000000000..de3e2e72782ce --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const app = new aws_cdk_lib_1.App(); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'VPC'); + new aws_ec2_1.FlowLog(this, 'FlowLogsCW', { + resourceType: aws_ec2_1.FlowLogResourceType.fromVpc(vpc), + maxAggregationInterval: aws_ec2_1.FlowLogMaxAggregationInterval.TEN_MINUTES, + }); + vpc.addFlowLog('FlowLogsS3', { + destination: aws_ec2_1.FlowLogDestination.toS3(), + maxAggregationInterval: aws_ec2_1.FlowLogMaxAggregationInterval.ONE_MINUTE, + }); + const bucket = new s3.Bucket(this, 'Bucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + bucket.addToResourcePolicy(new aws_iam_1.PolicyStatement({ + effect: aws_iam_1.Effect.ALLOW, + principals: [new aws_iam_1.ServicePrincipal('delivery.logs.amazonaws.com')], + actions: ['s3:PutObject'], + resources: [bucket.arnForObjects(`AWSLogs/${this.account}/*`)], + conditions: { + StringEquals: { + 's3:x-amz-acl': 'bucket-owner-full-control', + 'aws:SourceAccount': this.account, + }, + ArnLike: { + 'aws:SourceArn': this.formatArn({ + service: 'logs', + resource: '*', + }), + }, + }, + })); + bucket.addToResourcePolicy(new aws_iam_1.PolicyStatement({ + effect: aws_iam_1.Effect.ALLOW, + principals: [new aws_iam_1.ServicePrincipal('delivery.logs.amazonaws.com')], + actions: ['s3:GetBucketAcl', 's3:ListBucket'], + resources: [bucket.bucketArn], + conditions: { + StringEquals: { + 'aws:SourceAccount': this.account, + }, + ArnLike: { + 'aws:SourceArn': this.formatArn({ + service: 'logs', + resource: '*', + }), + }, + }, + })); + vpc.addFlowLog('FlowLogsS3KeyPrefix', { + destination: aws_ec2_1.FlowLogDestination.toS3(bucket, 'prefix/'), + }); + } +} +new integ_tests_alpha_1.IntegTest(app, 'FlowLogs', { + testCases: [ + new TestStack(app, 'FlowLogsTestStack'), + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWZsb3ctbG9ncy1pbnRlcnZhbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1mbG93LWxvZ3MtaW50ZXJ2YWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBZ0Y7QUFDaEYseUNBQXlDO0FBQ3pDLDZDQUFvRTtBQUNwRSxrRUFBdUQ7QUFDdkQsaURBQTJIO0FBRTNILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBR3RCLE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBVSxFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUNwRCxLQUFLLENBQUMs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1xuICAgIG5ldyBUZXN0U3RhY2soYXBwLCAnRmxvd0xvZ3NUZXN0U3RhY2snKSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/FlowLogsTestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.ts similarity index 86% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.ts index e21217a497e39..dff74e474b259 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-interval.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs-interval.ts @@ -1,8 +1,8 @@ -import { PolicyStatement, Effect, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { FlowLog, FlowLogDestination, FlowLogResourceType, Vpc, FlowLogMaxAggregationInterval } from '../lib'; +import { PolicyStatement, Effect, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { FlowLog, FlowLogDestination, FlowLogResourceType, Vpc, FlowLogMaxAggregationInterval } from 'aws-cdk-lib/aws-ec2'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js new file mode 100644 index 0000000000000..00d3cd263328f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js @@ -0,0 +1,119 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const app = new aws_cdk_lib_1.App(); +class FeatureFlagStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'VPC', { natGateways: 1 }); + const flowLog = vpc.addFlowLog('FlowLogsS3', { + destination: aws_ec2_1.FlowLogDestination.toS3(), + }); + this.bucket = flowLog.bucket; + this.bucketArn = this.exportValue(flowLog.bucket.bucketArn); + vpc.addFlowLog('FlowLogsS3WithDestinationOptions', { + destination: aws_ec2_1.FlowLogDestination.toS3(undefined, undefined, { + hiveCompatiblePartitions: true, + }), + }); + new aws_ec2_1.Instance(this, 'FlowLogsInstance', { + vpc, + instanceType: aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.T3, aws_ec2_1.InstanceSize.SMALL), + machineImage: aws_ec2_1.MachineImage.latestAmazonLinux({ + generation: aws_ec2_1.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + }); + } +} +class DependencyTestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'VPC', { natGateways: 1 }); + const bucket = new s3.Bucket(this, 'Bucket', { + autoDeleteObjects: true, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + vpc.addFlowLog('FlowLogS3', { + destination: aws_ec2_1.FlowLogDestination.toS3(bucket, 'vpcFlowLog'), + }); + } +} +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'VPC', { natGateways: 1 }); + new aws_ec2_1.FlowLog(this, 'FlowLogsCW', { + resourceType: aws_ec2_1.FlowLogResourceType.fromVpc(vpc), + }); + vpc.addFlowLog('FlowLogsS3', { + destination: aws_ec2_1.FlowLogDestination.toS3(), + }); + const bucket = new s3.Bucket(this, 'Bucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + bucket.addToResourcePolicy(new aws_iam_1.PolicyStatement({ + effect: aws_iam_1.Effect.ALLOW, + principals: [new aws_iam_1.ServicePrincipal('delivery.logs.amazonaws.com')], + actions: ['s3:PutObject'], + resources: [bucket.arnForObjects(`AWSLogs/${this.account}/*`)], + conditions: { + StringEquals: { + 's3:x-amz-acl': 'bucket-owner-full-control', + 'aws:SourceAccount': this.account, + }, + ArnLike: { + 'aws:SourceArn': this.formatArn({ + service: 'logs', + resource: '*', + }), + }, + }, + })); + bucket.addToResourcePolicy(new aws_iam_1.PolicyStatement({ + effect: aws_iam_1.Effect.ALLOW, + principals: [new aws_iam_1.ServicePrincipal('delivery.logs.amazonaws.com')], + actions: ['s3:GetBucketAcl', 's3:ListBucket'], + resources: [bucket.bucketArn], + conditions: { + StringEquals: { + 'aws:SourceAccount': this.account, + }, + ArnLike: { + 'aws:SourceArn': this.formatArn({ + service: 'logs', + resource: '*', + }), + }, + }, + })); + vpc.addFlowLog('FlowLogsS3KeyPrefix', { + destination: aws_ec2_1.FlowLogDestination.toS3(bucket, 'prefix/'), + }); + } +} +const featureFlagTest = new FeatureFlagStack(app, 'FlowLogsFeatureFlag'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'FlowLogs', { + testCases: [ + new TestStack(app, 'FlowLogsTestStack'), + featureFlagTest, + new DependencyTestStack(app, 'DependencyTestStack'), + ], +}); +const objects = integ.assertions.awsApiCall('S3', 'listObjectsV2', { + Bucket: featureFlagTest.bucket.bucketName, + MaxKeys: 1, + Prefix: `AWSLogs/${featureFlagTest.account}/vpcflowlogs`, +}); +const assertionProvider = objects.node.tryFindChild('SdkProvider'); +assertionProvider.addPolicyStatementFromSdkCall('s3', 'ListBucket', [featureFlagTest.bucketArn]); +assertionProvider.addPolicyStatementFromSdkCall('s3', 'GetObject', [`${featureFlagTest.bucketArn}/*`]); +objects.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + KeyCount: 1, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWZsb3ctbG9ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1mbG93LWxvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBZ0Y7QUFDaEYseUNBQXlDO0FBQ3pDLDZDQUFvRTtBQUNwRSxrRUFBMkY7QUFDM0YsaURBQXNMO0FBRXRMLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBRXRCLE1BQU0sZ0JBQWlCLFNBQVEsbUJBQUs7SUFHbEMsWUFBWSxLQUFVLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQ3BELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxDQUFDLElBQUksRUFBRSxLQUFLLEVBQUUsRUFBRSxXQUFXLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztRQUVyRCxNQUFNLE9BQU8sR0FBRyxHQUFHLENBQUMsVUFBVSxDQUFDLFlBQVksRUFBRTtZQUMzQyxXQUFXLEVBQUUsNEJBQWtCLENBQUMsSUFBSSxFQUFFO1NBQ3ZDLENBQUMsQ0FBQztRQUNILElBQUksQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDLE1BQU8sQ0FB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RTdGFjayhhcHAsICdEZXBlbmRlbmN5VGVzdFN0YWNrJyksXG4gIF0sXG59KTtcblxuY29uc3Qgb2JqZWN0cyA9IGludGVnLmFzc2VydGlvbnMuYXdzQXBpQ2FsbCgnUzMnLCAnbGlzdE9iamVjdHNWMicsIHtcbiAgQnVja2V0OiBmZWF0dXJlRmxhZ1Rlc3QuYnVja2V0LmJ1Y2tldE5hbWUsXG4gIE1heEtleXM6IDEsXG4gIFByZWZpeDogYEFXU0xvZ3MvJHtmZWF0dXJlRmxhZ1Rlc3QuYWNjb3VudH0vdnBjZmxvd2xvZ3NgLFxufSk7XG5jb25zdCBhc3NlcnRpb25Qcm92aWRlciA9IG9iamVjdHMubm9kZS50cnlGaW5kQ2hpbGQoJ1Nka1Byb3ZpZGVyJykgYXMgQXNzZXJ0aW9uc1Byb3ZpZGVyO1xuYXNzZXJ0aW9uUHJvdmlkZXIuYWRkUG9saWN5U3RhdGVtZW50RnJvbVNka0NhbGwoJ3MzJywgJ0xpc3RCdWNrZXQnLCBbZmVhdHVyZUZsYWdUZXN0LmJ1Y2tldEFybl0pO1xuYXNzZXJ0aW9uUHJvdmlkZXIuYWRkUG9saWN5U3RhdGVtZW50RnJvbVNka0NhbGwoJ3MzJywgJ0dldE9iamVjdCcsIFtgJHtmZWF0dXJlRmxhZ1Rlc3QuYnVja2V0QXJufS8qYF0pO1xuXG5vYmplY3RzLmV4cGVjdChFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgS2V5Q291bnQ6IDEsXG59KSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/DependencyTestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsDefaultTestDeployAssert6AFD1854.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsFeatureFlag.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/FlowLogsTestStack.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.ts similarity index 93% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.ts index 35d4c569aa736..585185dbb8ef6 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-flow-logs.ts @@ -1,8 +1,8 @@ -import { PolicyStatement, Effect, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, AssertionsProvider } from '@aws-cdk/integ-tests'; -import { FlowLog, FlowLogDestination, FlowLogResourceType, Vpc, Instance, InstanceType, InstanceClass, InstanceSize, MachineImage, AmazonLinuxGeneration } from '../lib'; +import { PolicyStatement, Effect, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, AssertionsProvider } from '@aws-cdk/integ-tests-alpha'; +import { FlowLog, FlowLogDestination, FlowLogResourceType, Vpc, Instance, InstanceType, InstanceClass, InstanceSize, MachineImage, AmazonLinuxGeneration } from 'aws-cdk-lib/aws-ec2'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js new file mode 100644 index 0000000000000..e0d106268c161 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc-gateway'); +const vpc = new ec2.Vpc(stack, 'MyVpc', { + maxAzs: 1, + subnetConfiguration: [ + { + subnetType: ec2.SubnetType.PUBLIC, + name: 'Public', + }, + { + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + name: 'Isolated', + }, + ], +}); +vpc.isolatedSubnets[0].addRoute('MyRoute', { + routerId: vpc.internetGatewayId, + routerType: ec2.RouterType.GATEWAY, + destinationCidrBlock: '8.8.8.8/32', +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWdhdGV3YXkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52cGMtZ2F0ZXdheS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx5QkFBeUIsQ0FBQyxDQUFDO0FBRTVELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFO0lBQ3RDLE1BQU0sRUFBRS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BSSVZBVEVfSVNPTEFURUQsXG4gICAgICBuYW1lOiAnSXNvbGF0ZWQnLFxuICAgIH0sXG4gIF0sXG59KTtcblxuKHZwYy5pc29sYXRlZFN1Ym5ldHNbMF0gYXMgZWMyLlN1Ym5ldCkuYWRkUm91dGUoJ015Um91dGUnLCB7XG4gIHJvdXRlcklkOiB2cGMuaW50ZXJuZXRHYXRld2F5SWQhLFxuICByb3V0ZXJUeXBlOiBlYzIuUm91dGVyVHlwZS5HQVRFV0FZLFxuICBkZXN0aW5hdGlvbkNpZHJCbG9jazogJzguOC44LjgvMzInLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/aws-cdk-ec2-vpc-gateway.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.reserved-private-subnet.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.ts similarity index 86% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.ts index 6f84541a29911..509ff83e3dd44 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-gateway.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc-gateway'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js new file mode 100644 index 0000000000000..3c349faf557bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-ipam-vpc'); +/** + * ### MANUAL CLEAN UP REQUIRED ### + * + * When IPAM is created running this integ-test it is not currently removed after the test run is complete. + * + */ +const ipam = new aws_ec2_1.CfnIPAM(stack, 'IPAM', { + operatingRegions: [ + { regionName: stack.region }, + ], + tags: [{ + key: 'stack', + value: stack.stackId, + }], +}); +ipam.applyRemovalPolicy(cdk.RemovalPolicy.RETAIN); +const pool = new aws_ec2_1.CfnIPAMPool(stack, 'Pool', { + description: 'Testing pool', + addressFamily: 'ipv4', + autoImport: false, + locale: stack.region, + ipamScopeId: ipam.attrPrivateDefaultScopeId, + provisionedCidrs: [{ + cidr: '100.100.0.0/16', + }], +}); +pool.applyRemovalPolicy(cdk.RemovalPolicy.RETAIN); +const awsIpamVpc = new aws_ec2_1.Vpc(stack, 'AwsIpamVpc', { + ipAddresses: aws_ec2_1.IpAddresses.awsIpamAllocation({ + ipv4IpamPoolId: pool.ref, + ipv4NetmaskLength: 18, + defaultSubnetIpv4NetmaskLength: 24, + }), + maxAzs: 2, + subnetConfiguration: [{ + name: 'private', + subnetType: aws_ec2_1.SubnetType.PRIVATE_ISOLATED, + cidrMask: 24, + }], +}); +// needs AwsApiCall Support for installLatestAwsSdk first, or another way to clean the Ipam +// new AwsApiCall(stack, 'cleanUpIpam', { +// service: 'EC2', +// api: 'deleteIpam', +// installLatestAwsSdk: true, +// parameters: { +// IpamId: ipam.attrIpamId, +// Cascade: true, +// }, +// }); +/** + * Testing That the Vpc is Deployed with the correct Cidrs. +**/ +const integ = new integ_tests_alpha_1.IntegTest(app, 'Vpc-Ipam', { + testCases: [stack], + allowDestroy: ['EC2::IPAM'], +}); +integ.assertions.awsApiCall('EC2', 'describeVpcs', { + VpcIds: [awsIpamVpc.node.defaultChild.getAtt('VpcId').toString()], +}).expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Vpcs: [ + { + CidrBlock: '100.100.0.0/18', + }, + ], +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWlwYW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52cGMtaXBhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxrRUFBdUU7QUFDdkUsaURBQWlHO0FBRWpHLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsc0JBQX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Ly8gICAgIENhc2NhZGU6IHRydWUsXG4vLyAgIH0sXG4vLyB9KTtcblxuLyoqXG4gKiBUZXN0aW5nIFRoYXQgdGhlIFZwYyBpcyBEZXBsb3llZCB3aXRoIHRoZSBjb3JyZWN0IENpZHJzLlxuKiovXG5jb25zdCBpbnRlZyA9IG5ldyBJbnRlZ1Rlc3QoYXBwLCAnVnBjLUlwYW0nLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbiAgYWxsb3dEZXN0cm95OiBbJ0VDMjo6SVBBTSddLFxufSk7XG5cbmludGVnLmFzc2VydGlvbnMuYXdzQXBpQ2FsbCgnRUMyJywgJ2Rlc2NyaWJlVnBjcycsIHtcbiAgVnBjSWRzOiBbKGF3c0lwYW1WcGMubm9kZS5kZWZhdWx0Q2hpbGQgYXMgQ2ZuVlBDKS5nZXRBdHQoJ1ZwY0lkJykudG9TdHJpbmcoKV0sXG59KS5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIFZwY3M6IFtcbiAgICB7XG4gICAgICBDaWRyQmxvY2s6ICcxMDAuMTAwLjAuMC8xOCcsXG4gICAgfSxcbiAgXSxcbn0pKTtcblxuYXBwLnN5bnRoKCk7XG5cblxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/VpcIpamDefaultTestDeployAssertB1CA1C3A.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/asset.d47f7e6772bfdf47ecbc070ffe204baf53bacbfbf7814eb407bd8ea108c1c1bb.bundle/index.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/aws-cdk-ec2-ipam-vpc.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.ts similarity index 93% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.ts index 7b4f3296c09f4..37eea8de9729d 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipam.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; -import { IpAddresses, CfnIPAM, CfnIPAMPool, CfnVPC, SubnetType, Vpc } from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { IpAddresses, CfnIPAM, CfnIPAMPool, CfnVPC, SubnetType, Vpc } from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-ipam-vpc'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js new file mode 100644 index 0000000000000..290fc63f2abd4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const appWithVpc = new cdk.App(); +const stack = new cdk.Stack(appWithVpc, 'StackWithVpc', { + env: { + region: 'eu-west-1', + account: '123456', + }, +}); +const testVpc = new ec2.Vpc(stack, 'MyVpc', { + vpcName: 'my-vpc-name', +}); +const appUnderTest = new cdk.App(); +const stackLookup = new cdk.Stack(appUnderTest, 'StackUnderTest', { + env: { + region: 'us-east-2', + account: '123456', + }, +}); +const vpcFromVpcAttributes = ec2.Vpc.fromVpcAttributes(stackLookup, 'VpcFromVpcAttributes', { + region: 'eu-west-1', + availabilityZones: ['eu-west-1a'], + vpcId: testVpc.vpcId, +}); +const vpcFromLookup = ec2.Vpc.fromLookup(stack, 'VpcFromLookup', { + region: 'eu-west-1', + vpcName: 'my-vpc-name', +}); +new cdk.CfnOutput(stackLookup, 'OutputFromVpcAttributes', { + value: `Region fromVpcAttributes: ${vpcFromVpcAttributes.env.region}`, +}); +new cdk.CfnOutput(stackLookup, 'OutputFromLookup', { + value: `Region fromLookup: ${vpcFromLookup.env.region}`, +}); +new integ_tests_alpha_1.IntegTest(appUnderTest, 'ArchiveTest', { + testCases: [stackLookup], +}); +appWithVpc.synth(); +appUnderTest.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWxvb2t1cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1sb29rdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELDJDQUEyQztBQUUzQyxNQUFNLFVBQVUsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUNqQ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XBwV2l0aFZwYy5zeW50aCgpO1xuYXBwVW5kZXJUZXN0LnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackUnderTest.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/StackWithVpc.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.ts similarity index 88% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.ts index 3ce324f2a1e08..aed4f6b782cc7 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-lookup.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const appWithVpc = new cdk.App(); const stack = new cdk.Stack(appWithVpc, 'StackWithVpc', { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js new file mode 100644 index 0000000000000..9c06cbb44f1fa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc'); +const vpc = new ec2.Vpc(stack, 'MyVpc'); +// Test NetworkAcl and rules +const nacl1 = new ec2.NetworkAcl(stack, 'myNACL1', { + vpc, + subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, +}); +nacl1.addEntry('AllowDNSEgress', { + ruleNumber: 100, + traffic: ec2.AclTraffic.udpPort(53), + cidr: ec2.AclCidr.ipv4('172.16.0.0/24'), + direction: ec2.TrafficDirection.EGRESS, +}); +nacl1.addEntry('AllowDNSIngress', { + ruleNumber: 100, + traffic: ec2.AclTraffic.udpPort(53), + direction: ec2.TrafficDirection.INGRESS, + cidr: ec2.AclCidr.anyIpv4(), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLW5ldHdvcmthY2wuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52cGMtbmV0d29ya2FjbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHL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lYzIuQWNsQ2lkci5hbnlJcHY0KCksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/aws-cdk-ec2-vpc.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-ipam.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.ts similarity index 89% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.ts index faf569911d390..667ea1d2e782d 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-networkacl.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js new file mode 100644 index 0000000000000..36c8d611d69bc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integtest-vpc-reserved-azs'); +new ec2.Vpc(stack, 'MyVpc', { + reservedAzs: 2, + maxAzs: 3, +}); +new integ_tests_alpha_1.IntegTest(app, 'vpc-reserved-azs', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLXJlc2VydmVkLWF6cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1yZXNlcnZlZC1henMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDRCQUE0QixDQUFDLENBQUM7QUFFL0QsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUU7SUFDMUIsV0FBVyxFQUFFLENBQUM7SUFDZCxNQUFNLEVBQUUsQ0FBQztDQUNWLENBQUMsQ0FBQztBQUVILElBQUksNkJBQVMsQ0FBQyxHQUFHLEVBQUUsa0JBQWtCLEVBQUU7SUFDckMsU0FBUyxFQUFFLENBQUMsS0FBSyxDQUFDO0NBQ25CLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGNkayBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgeyBJbnRlZ1Rlc3QgfSBmcm9tICdAYXdzLWNkay9pbnRlZy10ZXN0cy1hbHBoYSc7XG5pbXBvcnQgKiBhcyBlYzIgZnJvbSAnYXdzLWNkay1saWIvYXdzLWVjMic7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBjZGsuU3RhY2soYXBwLCAnaW50ZWd0ZXN0LXZwYy1yZXNlcnZlZC1henMnKTtcblxubmV3IGVjMi5WcGMoc3RhY2ssICdNeVZwYycsIHtcbiAgcmVzZXJ2ZWRBenM6IDIsXG4gIG1heEF6czogMyxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ3ZwYy1yZXNlcnZlZC1henMnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-lookup.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/integtest-vpc-reserved-azs.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/vpcreservedazsDefaultTestDeployAssertE48D2C6D.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.ts new file mode 100644 index 0000000000000..8cb30b8fbd8d9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-reserved-azs.ts @@ -0,0 +1,15 @@ +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integtest-vpc-reserved-azs'); + +new ec2.Vpc(stack, 'MyVpc', { + reservedAzs: 2, + maxAzs: 3, +}); + +new IntegTest(app, 'vpc-reserved-azs', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js new file mode 100644 index 0000000000000..6458fb5815655 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc'); +const vpc = new ec2.Vpc(stack, 'MyVpc'); +// Test Security Group Rules +const sg = new ec2.SecurityGroup(stack, 'SG', { vpc }); +const rules = [ + ec2.Port.icmpPing(), + ec2.Port.icmpType(128), + ec2.Port.allIcmp(), + ec2.Port.allUdp(), + ec2.Port.udp(123), + ec2.Port.udpRange(800, 801), +]; +for (const rule of rules) { + sg.addIngressRule(ec2.Peer.anyIpv4(), rule); +} +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI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XBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgZWMyIGZyb20gJ2F3cy1jZGstbGliL2F3cy1lYzInO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1jZGstZWMyLXZwYycpO1xuXG5jb25zdCB2cGMgPSBuZXcgZWMyLlZwYyhzdGFjaywgJ015VnBjJyk7XG5cbi8vIFRlc3QgU2VjdXJpdHkgR3JvdXAgUnVsZXNcbmNvbnN0IHNnID0gbmV3IGVjMi5TZWN1cml0eUdyb3VwKHN0YWNrLCAnU0cnLCB7IHZwYyB9KTtcblxuY29uc3QgcnVsZXMgPSBbXG4gIGVjMi5Qb3J0LmljbXBQaW5nKCksXG4gIGVjMi5Qb3J0LmljbXBUeXBlKDEyOCksXG4gIGVjMi5Qb3J0LmFsbEljbXAoKSxcbiAgZWMyLlBvcnQuYWxsVWRwKCksXG4gIGVjMi5Qb3J0LnVkcCgxMjMpLFxuICBlYzIuUG9ydC51ZHBSYW5nZSg4MDAsIDgwMSksXG5dO1xuXG5mb3IgKGNvbnN0IHJ1bGUgb2YgcnVsZXMpIHtcbiAgc2cuYWRkSW5ncmVzc1J1bGUoZWMyLlBlZXIuYW55SXB2NCgpLCBydWxlKTtcbn1cblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/aws-cdk-ec2-vpc.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-gateway.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.ts similarity index 85% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.ts index 2ffd5653e33f4..d1445dd644ece 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js new file mode 100644 index 0000000000000..36191fd5ff860 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpn'); +const vpc = new ec2.Vpc(stack, 'MyVpc', { + ipAddresses: ec2.IpAddresses.cidr('10.10.0.0/16'), + vpnConnections: { + Dynamic: { + ip: '52.85.255.164', + tunnelOptions: [ + { + preSharedKeySecret: cdk.SecretValue.unsafePlainText('ssmpwaaa'), + }, + ], + }, + }, +}); +vpc.addVpnConnection('Static', { + ip: '52.85.255.197', + staticRoutes: [ + '192.168.10.0/24', + '192.168.20.0/24', + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBuLXByZS1zaGFyZWQta2V5LXRva2VuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudnBuLXByZS1zaGFyZWQta2V5LXRva2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGlCQUFpQixDQUFDLENBQUM7QUFFcEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxPQUFPLEVBQUU7SUFDdEMsV0FBVyxFQUFFLEdBQUcsQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQztJQUNqRCxjQUFjLEVBQUU7UUFDZCxPQUFPLEVBQUU7WUFDUCxFQUFFLEVBQUUsZUFBZTtZQUNuQixhQUFhLEVBQUU7Z0JBQ2I7b0JBQ0Usa0JBQWtCLEVBQUUsR0FBRyxDQUFDLFdBQVcsQ0FBQyxlQUFlLENBQUMsVUFBVSxDQUFDO2lCQUNoRTthQUNGO1NBQ0Y7S0FDRjtDQUNGLENBQUMsQ0FBQztBQUVILEdBQUcsQ0FBQyxnQkFBZ0IsQ0FBQyxRQUFRLEVBQUU7SUFDN0IsRUFB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at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/aws-cdk-ec2-vpn.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.ts similarity index 87% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.ts index 24d97423bf033..09c4abedf27cb 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn-pre-shared-key-token.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpn'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js new file mode 100644 index 0000000000000..ce2c6bf485420 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpn'); +const vpc = new ec2.Vpc(stack, 'MyVpc', { + cidr: '10.10.0.0/16', + vpnConnections: { + Dynamic: { + ip: '52.85.255.164', + tunnelOptions: [ + { + preSharedKey: 'secretkey1234', + }, + ], + }, + }, +}); +vpc.addVpnConnection('Static', { + ip: '52.85.255.197', + staticRoutes: [ + '192.168.10.0/24', + '192.168.20.0/24', + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcudnBuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGlCQUFpQixDQUFDLENBQUM7QUFFcEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FB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bm5lY3Rpb24oJ1N0YXRpYycsIHsgLy8gU3RhdGljIHJvdXRpbmdcbiAgaXA6ICc1Mi44NS4yNTUuMTk3JyxcbiAgc3RhdGljUm91dGVzOiBbXG4gICAgJzE5Mi4xNjguMTAuMC8yNCcsXG4gICAgJzE5Mi4xNjguMjAuMC8yNCcsXG4gIF0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.assets.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/aws-cdk-ec2-vpn.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn-pre-shared-key-token.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.ts similarity index 86% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.ts index 7af84063b7c2d..6e9bd26528666 100644 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpn.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpn.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpn'); diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image-secret/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image-secret/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image-secret/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image-secret/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image-secret/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image-secret/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-image/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar new file mode 100644 index 0000000000000..dc438a80ce3b4 Binary files /dev/null and b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar differ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js new file mode 100644 index 0000000000000..71a1a29a47323 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-ecr-assets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-assets-docker'); +const asset = new assets.DockerImageAsset(stack, 'DockerImage', { + directory: path.join(__dirname, 'demo-image'), +}); +const asset2 = new assets.DockerImageAsset(stack, 'DockerImage2', { + directory: path.join(__dirname, 'demo-image'), +}); +const asset3 = new assets.DockerImageAsset(stack, 'DockerImage3', { + directory: path.join(__dirname, 'demo-image'), + platform: assets.Platform.LINUX_ARM64, +}); +const asset4 = new assets.DockerImageAsset(stack, 'DockerImage4', { + directory: path.join(__dirname, 'demo-image'), + outputs: ['type=docker'], +}); +const asset5 = new assets.DockerImageAsset(stack, 'DockerImage5', { + directory: path.join(__dirname, 'demo-image-secret'), + buildSecrets: { + mysecret: cdk.DockerBuildSecret.fromSrc('index.py'), + }, +}); +const asset6 = new assets.DockerImageAsset(stack, 'DockerImage6', { + directory: path.join(__dirname, 'demo-image'), + cacheTo: { type: 'inline' }, +}); +const user = new iam.User(stack, 'MyUser'); +asset.repository.grantPull(user); +asset2.repository.grantPull(user); +asset3.repository.grantPull(user); +asset4.repository.grantPull(user); +asset5.repository.grantPull(user); +asset6.repository.grantPull(user); +new cdk.CfnOutput(stack, 'ImageUri', { value: asset.imageUri }); +new cdk.CfnOutput(stack, 'ImageUri2', { value: asset2.imageUri }); +new cdk.CfnOutput(stack, 'ImageUri3', { value: asset3.imageUri }); +new cdk.CfnOutput(stack, 'ImageUri4', { value: asset4.imageUri }); +new cdk.CfnOutput(stack, 'ImageUri5', { value: asset5.imageUri }); +new cdk.CfnOutput(stack, 'ImageUri6', { value: asset6.imageUri }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLWRvY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFzc2V0cy1kb2NrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxxREFBcUQ7QUFFckQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxxQkFBcUIsQ0FBQyxDQUFDO0FBRXhELE1BQU0sS0FBSyxHQUFHLElBQUksTUFBTSxDQUFDLGdCQUFnQixDQUFDLEtBQUssRUFBRSxhQUFhLEVBQUU7SUFDOUQsU0FBUyxFQUFFLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLFlBQVksQ0FBQztDQUM5QyxDQUFDLENBQUM7QUFFSCxNQUFNLE1BQU0sR0FBRyxJQUFJLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxLQUFLLEVBQUUsY0FBYyxFQUFFO0lBQ2hFLFNBQVMsRUFBRSxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxZQUFZLENBQUM7Q0FDOUMsQ0FBQyxDQUFDO0FBRUgsTUFBTSxNQUFNLEdBQUcsSUFBSSxNQUFNLENBQUMsZ0JBQWdCLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUNoRSxTQUFTLEVBQUUsSUFBSSxDQUFDLElBQUksQ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VVcmknLCB7IHZhbHVlOiBhc3NldC5pbWFnZVVyaSB9KTtcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnSW1hZ2VVcmkyJywgeyB2YWx1ZTogYXNzZXQyLmltYWdlVXJpIH0pO1xubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdJbWFnZVVyaTMnLCB7IHZhbHVlOiBhc3NldDMuaW1hZ2VVcmkgfSk7XG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0ltYWdlVXJpNCcsIHsgdmFsdWU6IGFzc2V0NC5pbWFnZVVyaSB9KTtcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnSW1hZ2VVcmk1JywgeyB2YWx1ZTogYXNzZXQ1LmltYWdlVXJpIH0pO1xubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdJbWFnZVVyaTYnLCB7IHZhbHVlOiBhc3NldDYuaW1hZ2VVcmkgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image-secret/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image-secret/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.assets.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ-assets-docker.template.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.ts similarity index 92% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.ts index 65a6f266d5a35..e0a7369b2d70b 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-docker.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as assets from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as assets from 'aws-cdk-lib/aws-ecr-assets'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-assets-docker'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js new file mode 100644 index 0000000000000..476ba9d366bb6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const assets = require("aws-cdk-lib/aws-ecr-assets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-assets-tarball'); +const asset = new assets.TarballImageAsset(stack, 'DockerImage', { + tarballFile: path.join(__dirname, 'demo-tarball-hello-world/hello-world.tar'), +}); +const asset2 = new assets.TarballImageAsset(stack, 'DockerImage2', { + tarballFile: path.join(__dirname, 'demo-tarball-hello-world/hello-world.tar'), +}); +const user = new iam.User(stack, 'MyUser'); +asset.repository.grantPull(user); +asset2.repository.grantPull(user); +new cdk.CfnOutput(stack, 'ImageUri', { value: asset.imageUri }); +new cdk.CfnOutput(stack, 'ImageUri2', { value: asset2.imageUri }); +new integ_tests_alpha_1.IntegTest(app, 'LoadFromTarball', { + testCases: [ + stack, + ], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLXRhcmJhbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hc3NldHMtdGFyYmFsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCxxREFBcUQ7QUFFckQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0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O1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0ltYWdlVXJpJywgeyB2YWx1ZTogYXNzZXQuaW1hZ2VVcmkgfSk7XG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0ltYWdlVXJpMicsIHsgdmFsdWU6IGFzc2V0Mi5pbWFnZVVyaSB9KTtcblxubmV3IEludGVnVGVzdChhcHAsICdMb2FkRnJvbVRhcmJhbGwnLCB7XG4gIHRlc3RDYXNlczogW1xuICAgIHN0YWNrLFxuICBdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.assets.json similarity index 96% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.assets.json index 19e97d96f3815..cf8cdfef6132c 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.assets.json @@ -1,5 +1,5 @@ { - "version": "22.0.0", + "version": "31.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/LoadFromTarballDefaultTestDeployAssert46673615.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/asset.b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8.tar b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/asset.b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8.tar new file mode 100644 index 0000000000000..dc438a80ce3b4 Binary files /dev/null and b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/asset.b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8.tar differ diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/cdk.out diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.assets.json new file mode 100644 index 0000000000000..afd57d86a8edd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.assets.json @@ -0,0 +1,36 @@ +{ + "version": "31.0.0", + "files": { + "721a204c90992f064fa5e533990b4bbab3dd9d199b4d5d7f64be3f897d031140": { + "source": { + "path": "integ-assets-tarball.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "721a204c90992f064fa5e533990b4bbab3dd9d199b4d5d7f64be3f897d031140.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": { + "b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8": { + "source": { + "executable": [ + "sh", + "-c", + "docker load -i asset.b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8.tar | tail -n 1 | sed \"s/Loaded image: //g\"" + ] + }, + "destinations": { + "current_account-current_region": { + "repositoryName": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}", + "imageTag": "b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.template.json similarity index 93% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.template.json index a79e4296debea..f5fdd8d88c1ef 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.template.json @@ -59,12 +59,12 @@ "Outputs": { "ImageUri": { "Value": { - "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474" + "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8" } }, "ImageUri2": { "Value": { - "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474" + "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:b69dca74eab1d3c881feed06dec897337bffa8e1065e96edd71e0568c444e7b8" } } }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ.json new file mode 100644 index 0000000000000..5743bdadd6521 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "31.0.0", + "testCases": { + "LoadFromTarball/DefaultTest": { + "stacks": [ + "integ-assets-tarball" + ], + "assertionStack": "LoadFromTarball/DefaultTest/DeployAssert", + "assertionStackName": "LoadFromTarballDefaultTestDeployAssert46673615" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/manifest.json new file mode 100644 index 0000000000000..4f477d699533d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/manifest.json @@ -0,0 +1,129 @@ +{ + "version": "31.0.0", + "artifacts": { + "integ-assets-tarball.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-assets-tarball.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-assets-tarball": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-assets-tarball.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/721a204c90992f064fa5e533990b4bbab3dd9d199b4d5d7f64be3f897d031140.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-assets-tarball.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integ-assets-tarball.assets" + ], + "metadata": { + "/integ-assets-tarball/MyUser/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyUserDC45028B" + } + ], + "/integ-assets-tarball/MyUser/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyUserDefaultPolicy7B897426" + } + ], + "/integ-assets-tarball/ImageUri": [ + { + "type": "aws:cdk:logicalId", + "data": "ImageUri" + } + ], + "/integ-assets-tarball/ImageUri2": [ + { + "type": "aws:cdk:logicalId", + "data": "ImageUri2" + } + ], + "/integ-assets-tarball/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-assets-tarball/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-assets-tarball" + }, + "LoadFromTarballDefaultTestDeployAssert46673615.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "LoadFromTarballDefaultTestDeployAssert46673615.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "LoadFromTarballDefaultTestDeployAssert46673615": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "LoadFromTarballDefaultTestDeployAssert46673615.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "LoadFromTarballDefaultTestDeployAssert46673615.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "LoadFromTarballDefaultTestDeployAssert46673615.assets" + ], + "metadata": { + "/LoadFromTarball/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/LoadFromTarball/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "LoadFromTarball/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/tree.json new file mode 100644 index 0000000000000..946cdbde2047c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/tree.json @@ -0,0 +1,261 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "integ-assets-tarball": { + "id": "integ-assets-tarball", + "path": "integ-assets-tarball", + "children": { + "DockerImage": { + "id": "DockerImage", + "path": "integ-assets-tarball/DockerImage", + "children": { + "Staging": { + "id": "Staging", + "path": "integ-assets-tarball/DockerImage/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Repository": { + "id": "Repository", + "path": "integ-assets-tarball/DockerImage/Repository", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecr.RepositoryBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecr_assets.TarballImageAsset", + "version": "0.0.0" + } + }, + "DockerImage2": { + "id": "DockerImage2", + "path": "integ-assets-tarball/DockerImage2", + "children": { + "Staging": { + "id": "Staging", + "path": "integ-assets-tarball/DockerImage2/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Repository": { + "id": "Repository", + "path": "integ-assets-tarball/DockerImage2/Repository", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecr.RepositoryBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ecr_assets.TarballImageAsset", + "version": "0.0.0" + } + }, + "MyUser": { + "id": "MyUser", + "path": "integ-assets-tarball/MyUser", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-assets-tarball/MyUser/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::User", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnUser", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "integ-assets-tarball/MyUser/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-assets-tarball/MyUser/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "ecr:BatchCheckLayerAvailability", + "ecr:BatchGetImage", + "ecr:GetDownloadUrlForLayer" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::Sub": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}" + } + ] + ] + } + }, + { + "Action": "ecr:GetAuthorizationToken", + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyUserDefaultPolicy7B897426", + "users": [ + { + "Ref": "MyUserDC45028B" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.User", + "version": "0.0.0" + } + }, + "ImageUri": { + "id": "ImageUri", + "path": "integ-assets-tarball/ImageUri", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "ImageUri2": { + "id": "ImageUri2", + "path": "integ-assets-tarball/ImageUri2", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-assets-tarball/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-assets-tarball/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "LoadFromTarball": { + "id": "LoadFromTarball", + "path": "LoadFromTarball", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "LoadFromTarball/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "LoadFromTarball/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "LoadFromTarball/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "LoadFromTarball/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "LoadFromTarball/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.ts similarity index 79% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.ts index 472d512369067..9eeb0d38675f6 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.assets-tarball.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as assets from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as assets from 'aws-cdk-lib/aws-ecr-assets'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-assets-tarball'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js new file mode 100644 index 0000000000000..fdf9b0eaf6d14 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const ecr_assets = require("aws-cdk-lib/aws-ecr-assets"); +class TheNestedStack extends aws_cdk_lib_1.NestedStack { + constructor(scope, id, props) { + super(scope, id, props); + const asset = new ecr_assets.DockerImageAsset(this, 'my-image', { + directory: path.join(__dirname, 'demo-image'), + }); + const user = new iam.User(this, 'User'); + asset.repository.grantPull(user); + new aws_cdk_lib_1.CfnOutput(this, 'output', { value: asset.imageUri }); + } +} +class TheParentStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new TheNestedStack(this, 'nested-stack-with-image'); + } +} +const app = new aws_cdk_lib_1.App(); +new TheParentStack(app, 'nested-stacks-docker'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy1kb2NrZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5uZXN0ZWQtc3RhY2tzLWRvY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ0FBMkM7QUFDM0MsNkNBQStGO0FBRS9GLHlEQUF5RDtBQUV6RCxNQUFNLGNBQWUsU0FBUSx5QkFBVztJQUN0QyxZQUFZLEtBQWdCLEV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3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgbmV3IFRoZU5lc3RlZFN0YWNrKHRoaXMsICduZXN0ZWQtc3RhY2std2l0aC1pbWFnZScpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBUaGVQYXJlbnRTdGFjayhhcHAsICduZXN0ZWQtc3RhY2tzLWRvY2tlcicpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.assets.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nested-stacks-docker.template.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nestedstacksdockernestedstackwithimage2999F8C8.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nestedstacksdockernestedstackwithimage2999F8C8.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nestedstacksdockernestedstackwithimage2999F8C8.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/nestedstacksdockernestedstackwithimage2999F8C8.nested.template.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.ts similarity index 86% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.ts index 83d71192e18f4..39027b22aa4fb 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr-assets/test/integ.nested-stacks-docker.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, CfnOutput, NestedStack, NestedStackProps, Stack, StackProps } from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, CfnOutput, NestedStack, NestedStackProps, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as ecr_assets from '../lib'; +import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets'; class TheNestedStack extends NestedStack { constructor(scope: Construct, id: string, props?: NestedStackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js new file mode 100644 index 0000000000000..63bfb39307468 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); +const repo = new ecr.Repository(stack, 'Repo'); +repo.addLifecycleRule({ maxImageCount: 5 }); +new cdk.CfnOutput(stack, 'RepositoryURI', { + value: repo.repositoryUri, +}); +new integ_tests_alpha_1.IntegTest(app, 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25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1lY3ItaW50ZWctc3RhY2snKTtcblxuY29uc3QgcmVwbyA9IG5ldyBlY3IuUmVwb3NpdG9yeShzdGFjaywgJ1JlcG8nKTtcbnJlcG8uYWRkTGlmZWN5Y2xlUnVsZSh7IG1heEltYWdlQ291bnQ6IDUgfSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnUmVwb3NpdG9yeVVSSScsIHtcbiAgdmFsdWU6IHJlcG8ucmVwb3NpdG9yeVVyaSxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2Nkay1lY3ItaW50ZWctdGVzdC1iYXNpYycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.assets.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/aws-ecr-integ-stack.template.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.assets.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/cdkecrintegtestbasicDefaultTestDeployAssert4F7FBFB4.template.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.basic.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.ts new file mode 100644 index 0000000000000..b1ec378bd9df1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.basic.ts @@ -0,0 +1,17 @@ +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); + +const repo = new ecr.Repository(stack, 'Repo'); +repo.addLifecycleRule({ maxImageCount: 5 }); + +new cdk.CfnOutput(stack, 'RepositoryURI', { + value: repo.repositoryUri, +}); + +new IntegTest(app, 'cdk-ecr-integ-test-basic', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js new file mode 100644 index 0000000000000..5340f559d043f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); +const repo = new ecr.Repository(stack, 'Repo', { + imageScanOnPush: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +repo.onImageScanCompleted('ImageScanComplete'); +new cdk.CfnOutput(stack, 'RepositoryURI', { + value: repo.repositoryUri, +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-ecr-image-scan', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW1hZ2VzY2FuLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW1hZ2VzY2FuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCwyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxxQkFBcUIsQ0FBQyxDQUFDO0FBRXhELE1BQU0sSUFBSSxHQUFHLElBQUksR0FBRyxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsTUFBTSxFQUFFO0lBQzdDLGVBQWUsRUFBRSxJQUFJO0lBQ3JCLGFBQWEsRUFBRSxHQUFHLENBQUMsYUFBYSxDQUFDLE9BQU87Q0FDekMsQ0FBQyxDQUFDO0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AgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.assets.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/aws-ecr-integ-stack.template.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.assets.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/cdkintegecrimagescanDefaultTestDeployAssert2E4CA4F5.template.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.ts similarity index 75% rename from packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.ts index 4b0533b35cd03..28b27c7883052 100644 --- a/packages/@aws-cdk/aws-ecr/test/integ.imagescan.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.imagescan.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ecr from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js new file mode 100644 index 0000000000000..55f541dd79322 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); +const repo = new ecr.Repository(stack, 'Repo', { + repositoryName: 'delete-even-if-containing-images', + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteImages: true, +}); +new cdk.CfnOutput(stack, 'RepositoryURI', { + value: repo.repositoryUri, +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-auto-delete-images', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVwb3NpdG9yeS1hdXRvLWRlbGV0ZS1pbWFnZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5yZXBvc2l0b3J5LWF1dG8tZGVsZXRlLWltYWdlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUscUJBQXFCLENBQUMsQ0FBQztBQUV4RCxNQUFNLElBQUksR0FBRyxJQUFJLEdBQUcsQ0FBQyxVQUFVLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRTtJQUM3QyxjQUFjLEVBQUUsa0NBQWtDO0lBQ2xELGFBQWEsRUFBRSxHQUFHLENBQUMsYUFBYSxDQUFDLE9BQU87SUFDeEMsZ0JBQWdCLEVBQUUsSUFBSTtDQUN2QixDQUFDLENBQUM7QUFFSCxJQUFJLEdBQUcsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLGVBQWUsRUFBRTtJQUN4QyxLQUFLLEVBQUUsSUFBSSxDQUFDLGFBQWE7Q0FDMUIsQ0FBQyxDQUFDO0FBRUgsSUFBSSw2QkFBUyxDQUFDLEdBQUcsRUFBRSw4QkFBOEIsRUFBRTtJQUNqRCxTQUFTLEVBQUUsQ0FBQyxLQUFLLENBQUM7Q0FDbkIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7IEludGVnVGVzdCB9IGZyb20gJ0Bhd3MtY2RrL2ludGVnLXRlc3RzLWFscGhhJztcbmltcG9ydCAqIGFzIGVjciBmcm9tICdhd3MtY2RrLWxpYi9hd3MtZWNyJztcblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtZWNyLWludGVnLXN0YWNrJyk7XG5cbmNvbnN0IHJlcG8gPSBuZXcgZWNyLlJlcG9zaXRvcnkoc3RhY2ssICdSZXBvJywge1xuICByZXBvc2l0b3J5TmFtZTogJ2RlbGV0ZS1ldmVuLWlmLWNvbnRhaW5pbmctaW1hZ2VzJyxcbiAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgYXV0b0RlbGV0ZUltYWdlczogdHJ1ZSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1JlcG9zaXRvcnlVUkknLCB7XG4gIHZhbHVlOiByZXBvLnJlcG9zaXRvcnlVcmksXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdjZGstaW50ZWctYXV0by1kZWxldGUtaW1hZ2VzJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/index.js similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/asset.6150227d515909a73f0bcde4b9e19b4b206cc65634027053380d700f6e53f08e/index.js diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.assets.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/aws-ecr-integ-stack.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.assets.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/cdkintegautodeleteimagesDefaultTestDeployAssert6B08011C.template.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.ts similarity index 75% rename from packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.ts index 1d57788631713..19e400989cb8c 100644 --- a/packages/@aws-cdk/aws-ecr/test/integ.repository-auto-delete-images.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecr/test/integ.repository-auto-delete-images.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ecr from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.394b24fcdc153a83b1fc400bf2e812ee67e3a5ffafdf977d531cfe2187d95f38/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/demo-image/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/demo-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.60dea2e16e94d1977b92fe03fa7085fea446233f1fe499702b69593438baa59f/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/demo-image/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js new file mode 100644 index 0000000000000..5d1c0a4d2fa35 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-alb-ec2-cmd-entrypoint'); +// Create VPC and ECS Cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'Ec2Cluster', { vpc }); +const provider = new ecs.AsgCapacityProvider(stack, 'CapacityProvier', { + autoScalingGroup: new autoscaling.AutoScalingGroup(stack, 'AutoScalingGroup', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }), + capacityProviderName: 'test-capacity-provider', +}); +cluster.addAsgCapacityProvider(provider); +// Create ALB service with Command and EntryPoint +new ecsPatterns.ApplicationLoadBalancedEc2Service(stack, 'ALBECSServiceWithCommandEntryPoint', { + cluster, + memoryLimitMiB: 512, + cpu: 256, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + command: ['/usr/sbin/apache2', '-D', 'FOREGROUND'], + entryPoint: ['/bin/bash', '-l', '-c'], + }, + capacityProviderStrategies: [ + { + capacityProvider: provider.capacityProviderName, + base: 1, + weight: 1, + }, + ], +}); +new integ.IntegTest(app, 'AlbEc2ServiceWithCommandAndEntryPoint', { + testCases: [stack], +}); +app.synth(); +//# sourceMapping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XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/AlbEc2ServiceWithCommandAndEntryPointDefaultTestDeployAssert91EF33D6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/aws-ecs-integ-alb-ec2-cmd-entrypoint.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-networkacl.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts similarity index 81% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts index a1037350a62f9..1baec7ae1c50a 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts @@ -1,9 +1,9 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-alb-ec2-cmd-entrypoint'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js new file mode 100644 index 0000000000000..b65f22db21c45 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_autoscaling_1 = require("aws-cdk-lib/aws-autoscaling"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-alb'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +const provider1 = new aws_ecs_1.AsgCapacityProvider(stack, 'FirstCapacityProvier', { + autoScalingGroup: new aws_autoscaling_1.AutoScalingGroup(stack, 'FirstAutoScalingGroup', { + vpc, + instanceType: new aws_ec2_1.InstanceType('t2.micro'), + machineImage: aws_ecs_1.EcsOptimizedImage.amazonLinux2(), + }), + capacityProviderName: 'first-capacity-provider', +}); +cluster.addAsgCapacityProvider(provider1); +const provider2 = new aws_ecs_1.AsgCapacityProvider(stack, 'SecondCapacityProvier', { + autoScalingGroup: new aws_autoscaling_1.AutoScalingGroup(stack, 'SecondAutoScalingGroup', { + vpc, + instanceType: new aws_ec2_1.InstanceType('t3.micro'), + machineImage: aws_ecs_1.EcsOptimizedImage.amazonLinux2(), + }), + capacityProviderName: 'second-capacity-provider', +}); +cluster.addAsgCapacityProvider(provider2); +// one service with multi capacity provider strategies +new aws_ecs_patterns_1.ApplicationLoadBalancedEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + capacityProviderStrategies: [ + { + capacityProvider: provider1.capacityProviderName, + base: 1, + weight: 1, + }, + { + capacityProvider: provider2.capacityProviderName, + base: 0, + weight: 2, + }, + ], +}); +new integ.IntegTest(app, 'applicationLoadBalancedEc2ServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBwbGljYXRpb24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nkoJ2FtYXpvbi9hbWF6b24tZWNzLXNhbXBsZScpLFxuICB9LFxuICBjYXBhY2l0eVByb3ZpZGVyU3RyYXRlZ2llczogW1xuICAgIHtcbiAgICAgIGNhcGFjaXR5UHJvdmlkZXI6IHByb3ZpZGVyMS5jYXBhY2l0eVByb3ZpZGVyTmFtZSxcbiAgICAgIGJhc2U6IDEsXG4gICAgICB3ZWlnaHQ6IDEsXG4gICAgfSxcbiAgICB7XG4gICAgICBjYXBhY2l0eVByb3ZpZGVyOiBwcm92aWRlcjIuY2FwYWNpdHlQcm92aWRlck5hbWUsXG4gICAgICBiYXNlOiAwLFxuICAgICAgd2VpZ2h0OiAyLFxuICAgIH0sXG4gIF0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhcHBsaWNhdGlvbkxvYWRCYWxhbmNlZEVjMlNlcnZpY2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/applicationLoadBalancedEc2ServiceTestDefaultTestDeployAssert3356477A.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-alb.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpn.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.ts similarity index 82% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.ts index 1b4e3d120b7f7..9126f0f1437b6 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.ts @@ -1,9 +1,9 @@ -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import { InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage, AsgCapacityProvider, EcsOptimizedImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { ApplicationLoadBalancedEc2Service } from '../../lib'; +import { AutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling'; +import { InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage, AsgCapacityProvider, EcsOptimizedImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ApplicationLoadBalancedEc2Service } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-alb'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js new file mode 100644 index 0000000000000..7bf493e400f15 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_elasticloadbalancingv2_1 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-multiple-alb-healthchecks'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new aws_ec2_1.InstanceType('t2.micro') }); +// Two load balancers with two listeners and two target groups. +const applicationMultipleTargetGroupsFargateService = new aws_ecs_patterns_1.ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +applicationMultipleTargetGroupsFargateService.targetGroups[0].configureHealthCheck({ + protocol: aws_elasticloadbalancingv2_1.Protocol.HTTP, + healthyThresholdCount: 2, + unhealthyThresholdCount: 2, + timeout: aws_cdk_lib_1.Duration.seconds(10), + interval: aws_cdk_lib_1.Duration.seconds(30), + healthyHttpCodes: '200', +}); +applicationMultipleTargetGroupsFargateService.targetGroups[1].configureHealthCheck({ + protocol: aws_elasticloadbalancingv2_1.Protocol.HTTP, + healthyThresholdCount: 2, + unhealthyThresholdCount: 2, + timeout: aws_cdk_lib_1.Duration.seconds(10), + interval: aws_cdk_lib_1.Duration.seconds(30), + healthyHttpCodes: '200', +}); +new integ_tests_alpha_1.IntegTest(app, 'Integ', { testCases: [stack] }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaGVhbHRoY2hlY2tzLW11bHRpcGxlLWFwcGxpY2F0aW9uLWxvYWQtYmFsYW5jZWQtZWNzLXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5oZWFsdGhjaGVja3MtbXVsdGlwbGUtYXBwbGljYXRpb24tbG9hZC1iYWxhbmNlZC1lY3Mtc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUF3RDtBQUN4RCxpREFBOEQ7QUFDOUQsdUZBQWtFO0FBQ2xFLDZDQUFtRDtBQUNuRCxrRUFBdUQ7QUFFdkQsbUVBQXlGO0FBRXpGLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUseUNBQXlDLENBQUMsQ0FBQztBQUN4RSxNQUFNLEdBQUcsR0FBRyxJQUFJLGFBQUcsQ0FBQyxLQUFLLEVBQ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0ZVNlcnZpY2UudGFyZ2V0R3JvdXBzWzFdLmNvbmZpZ3VyZUhlYWx0aENoZWNrKHtcbiAgcHJvdG9jb2w6IFByb3RvY29sLkhUVFAsXG4gIGhlYWx0aHlUaHJlc2hvbGRDb3VudDogMixcbiAgdW5oZWFsdGh5VGhyZXNob2xkQ291bnQ6IDIsXG4gIHRpbWVvdXQ6IER1cmF0aW9uLnNlY29uZHMoMTApLFxuICBpbnRlcnZhbDogRHVyYXRpb24uc2Vjb25kcygzMCksXG4gIGhlYWx0aHlIdHRwQ29kZXM6ICcyMDAnLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnSW50ZWcnLCB7IHRlc3RDYXNlczogW3N0YWNrXSB9KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb-healthchecks.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.ts similarity index 80% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.ts index 8021d377c61f1..369c5e00373c8 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.ts @@ -1,10 +1,10 @@ -import { InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { Protocol } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, Duration, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { Protocol } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { App, Duration, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -import { ApplicationMultipleTargetGroupsEc2Service } from '../../lib'; +import { ApplicationMultipleTargetGroupsEc2Service } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-multiple-alb-healthchecks'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js new file mode 100644 index 0000000000000..1fea7892eb93a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-nlb-healthchecks'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new aws_ec2_1.InstanceType('t2.micro') }); +// Two load balancers with two listeners and two target groups. +const networkMultipleTargetGroupsFargateService = new aws_ecs_patterns_1.NetworkMultipleTargetGroupsEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +networkMultipleTargetGroupsFargateService.targetGroups[0].configureHealthCheck({}); +networkMultipleTargetGroupsFargateService.targetGroups[1].configureHealthCheck({}); +new integ_tests_alpha_1.IntegTest(app, 'Integ', { testCases: [stack] }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaGVhbHRoY2hlY2tzLW11bHRpcGxlLW5ldHdvcmstbG9hZC1iYWxhbmNlZC1lY3Mtc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmhlYWx0aGNoZWNrcy1tdWx0aXBsZS1uZXR3b3JrLWxvYWQtYmFsYW5jZWQtZWNzLXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBd0Q7QUFDeEQsaURBQThEO0FBQzlELDZDQUF5QztBQUN6QyxrRUFBdUQ7QUFDdkQsbUVBQXFGO0FBRXJGLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsZ0NBQWdDLENBQUMsQ0FBQztBQUMvRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGFBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFDakQsTUFBTSxPQUFPLEdBQUcsSUFBSSxpQkFBTyxDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUUsRUFBRS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YXRlU2VydmljZS50YXJnZXRHcm91cHNbMV0uY29uZmlndXJlSGVhbHRoQ2hlY2soe30pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ0ludGVnJywgeyB0ZXN0Q2FzZXM6IFtzdGFja10gfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb-healthchecks.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.ts similarity index 80% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.ts index 46ad009f1f8b9..7f9dce9cc306a 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.ts @@ -1,8 +1,8 @@ -import { InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { NetworkMultipleTargetGroupsEc2Service } from '../../lib'; +import { InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { NetworkMultipleTargetGroupsEc2Service } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-nlb-healthchecks'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js new file mode 100644 index 0000000000000..86e2570983b70 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js @@ -0,0 +1,82 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_certificatemanager_1 = require("aws-cdk-lib/aws-certificatemanager"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_elasticloadbalancingv2_1 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-alb-idle-timeout'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const zone = new aws_route53_1.PublicHostedZone(stack, 'HostedZone', { zoneName: 'example.com' }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new aws_ec2_1.InstanceType('t2.micro') }); +// Two load balancers with different idle timeouts. +new aws_ecs_patterns_1.ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + enableExecuteCommand: true, + loadBalancers: [ + { + name: 'lb', + idleTimeout: aws_cdk_lib_1.Duration.seconds(400), + domainName: 'api.example.com', + domainZone: zone, + listeners: [ + { + name: 'listener', + protocol: aws_elasticloadbalancingv2_1.ApplicationProtocol.HTTPS, + certificate: aws_certificatemanager_1.Certificate.fromCertificateArn(stack, 'Cert', 'helloworld'), + sslPolicy: aws_elasticloadbalancingv2_1.SslPolicy.TLS12_EXT, + }, + ], + }, + { + name: 'lb2', + idleTimeout: aws_cdk_lib_1.Duration.seconds(400), + domainName: 'frontend.example.com', + domainZone: zone, + listeners: [ + { + name: 'listener2', + protocol: aws_elasticloadbalancingv2_1.ApplicationProtocol.HTTPS, + certificate: aws_certificatemanager_1.Certificate.fromCertificateArn(stack, 'Cert2', 'helloworld'), + sslPolicy: aws_elasticloadbalancingv2_1.SslPolicy.TLS12_EXT, + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener', + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + listener: 'listener', + }, + { + containerPort: 443, + listener: 'listener2', + }, + { + containerPort: 80, + pathPattern: 'a/b/c', + priority: 10, + listener: 'listener2', + }, + ], +}); +new integ.IntegTest(app, 'multiAlbEcsEc2Test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubXVsdGlwbGUtYXBwbGljYXRpb24tbG9hZC1iYWxhbmNlZC1lY3Mtc2VydmljZS1pZGxlLXRpbWVvdXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5tdWx0aXBsZS1hcHBsaWNhdGlvbi1sb2FkLWJhbGFuY2VkLWVjcy1zZXJ2aWNlLWlkbGUtdGltZW91dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtFQUFpRTtBQUNqRSxpREFBd0Q7QUFDeEQsaURBQThEO0FBQzlELHVGQUF3RjtBQUN4Rix5REFBMkQ7QUFDM0QsNkNBQW1EO0FBQ25ELG9EQUFvRDtBQUVwRCxtRUFBeUY7QUFFekYsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUF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W5lclBvcnQ6IDQ0MyxcbiAgICAgIGxpc3RlbmVyOiAnbGlzdGVuZXIyJyxcbiAgICB9LFxuICAgIHtcbiAgICAgIGNvbnRhaW5lclBvcnQ6IDgwLFxuICAgICAgcGF0aFBhdHRlcm46ICdhL2IvYycsXG4gICAgICBwcmlvcml0eTogMTAsXG4gICAgICBsaXN0ZW5lcjogJ2xpc3RlbmVyMicsXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ211bHRpQWxiRWNzRWMyVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/aws-ecs-integ-alb-idle-timeout.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/multiAlbEcsEc2TestDefaultTestDeployAssertE5F6E3B0.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.ts similarity index 78% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.ts index c920dc7b686fe..1867fb552b8f7 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.ts @@ -1,12 +1,12 @@ -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { ApplicationProtocol, SslPolicy } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { App, Duration, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { ApplicationProtocol, SslPolicy } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { App, Duration, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; -import { ApplicationMultipleTargetGroupsEc2Service } from '../../lib'; +import { ApplicationMultipleTargetGroupsEc2Service } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-alb-idle-timeout'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js new file mode 100644 index 0000000000000..00e14df66214f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-multiple-alb'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new aws_ec2_1.InstanceType('t2.micro') }); +// One load balancer with one listener and two target groups. +new aws_ecs_patterns_1.ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + enableExecuteCommand: true, + targetGroups: [ + { + containerPort: 80, + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + }, + ], +}); +new integ.IntegTest(app, 'applicationMultipleTargetGroupsEc2ServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubXVsdGlwbGUtYXBwbGljYXRpb24tbG9hZC1iYWxhbmNlZC1lY3Mtc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm11bHRpcGxlLWFwcGxpY2F0aW9uLWxvYWQtYmFsYW5jZWQtZWNzLXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBd0Q7QUFDeEQsaURBQThEO0FBQzlELDZDQUF5QztBQUN6QyxvREFBb0Q7QUFDcEQsbUVBQXlGO0FBRXpGLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsNEJBQTRCLENBQUMsQ0FBQztBQUMzRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGFBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFDakQsTUFBTSxPQUFPLEdBQUcsSUFBSSxpQkFBTyxDQUFDLEtBQUssRUFBRS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yUG9ydDogOTAsXG4gICAgICBwYXRoUGF0dGVybjogJ2EvYi9jJyxcbiAgICAgIHByaW9yaXR5OiAxMCxcbiAgICB9LFxuICBdLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnYXBwbGljYXRpb25NdWx0aXBsZVRhcmdldEdyb3Vwc0VjMlNlcnZpY2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/applicationMultipleTargetGroupsEc2ServiceTestDefaultTestDeployAssert1194B50F.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-multiple-alb.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.healthchecks-multiple-network-load-balanced-ecs-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.ts new file mode 100644 index 0000000000000..9038c799ee541 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.ts @@ -0,0 +1,37 @@ +import { InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ApplicationMultipleTargetGroupsEc2Service } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-integ-multiple-alb'); +const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new Cluster(stack, 'Cluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new InstanceType('t2.micro') }); + +// One load balancer with one listener and two target groups. +new ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + enableExecuteCommand: true, + targetGroups: [ + { + containerPort: 80, + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + }, + ], +}); + +new integ.IntegTest(app, 'applicationMultipleTargetGroupsEc2ServiceTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js new file mode 100644 index 0000000000000..98513d276e569 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_autoscaling_1 = require("aws-cdk-lib/aws-autoscaling"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-nlb'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +const provider1 = new aws_ecs_1.AsgCapacityProvider(stack, 'FirstCapacityProvider', { + autoScalingGroup: new aws_autoscaling_1.AutoScalingGroup(stack, 'FirstAutoScalingGroup', { + vpc, + instanceType: new aws_ec2_1.InstanceType('t2.micro'), + machineImage: aws_ecs_1.EcsOptimizedImage.amazonLinux2(), + }), + capacityProviderName: 'first-capacity-provider', +}); +cluster.addAsgCapacityProvider(provider1); +const provider2 = new aws_ecs_1.AsgCapacityProvider(stack, 'SecondCapacityProvider', { + autoScalingGroup: new aws_autoscaling_1.AutoScalingGroup(stack, 'SecondAutoScalingGroup', { + vpc, + instanceType: new aws_ec2_1.InstanceType('t3.micro'), + machineImage: aws_ecs_1.EcsOptimizedImage.amazonLinux2(), + }), + capacityProviderName: 'second-capacity-provider', +}); +cluster.addAsgCapacityProvider(provider2); +// one service with multi capacity provider strategies +new aws_ecs_patterns_1.NetworkLoadBalancedEc2Service(stack, 'myService', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + capacityProviderStrategies: [ + { + capacityProvider: provider1.capacityProviderName, + base: 1, + weight: 1, + }, + { + capacityProvider: provider2.capacityProviderName, + base: 0, + weight: 2, + }, + ], +}); +new integ.IntegTest(app, 'networkLoadBalancedEc2ServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmV0d29yay1sb2FkLWJhbGFuY2VkLWVjcy1zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubmV0d29yay1sb2FkLWJhbGFuY2VkLWVjcy1zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaUVBQStEO0FBQy9ELGlEQUF3RDtBQUN4RCxpREFBc0c7QUFDdEcsNkNBQXlDO0FBQ3pDLG9EQUFvRDtBQUNwRCxtRUFBNkU7QUFFN0UsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBQ2xELE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUNqRCxNQUFNLE9BQU8sR0FBRyxJQUFJLGlCQUFPLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFFdkQsTUFBTSxTQUFTLEdBQUcsSUFBSSw2QkFBbUIsQ0FBQyxLQUFLLEVBQUU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yxcbn0pO1xuY2x1c3Rlci5hZGRBc2dDYXBhY2l0eVByb3ZpZGVyKHByb3ZpZGVyMik7XG5cbi8vIG9uZSBzZXJ2aWNlIHdpdGggbXVsdGkgY2FwYWNpdHkgcHJvdmlkZXIgc3RyYXRlZ2llc1xubmV3IE5ldHdvcmtMb2FkQmFsYW5jZWRFYzJTZXJ2aWNlKHN0YWNrLCAnbXlTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICBtZW1vcnlMaW1pdE1pQjogMjU2LFxuICB0YXNrSW1hZ2VPcHRpb25zOiB7XG4gICAgaW1hZ2U6IENvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIH0sXG4gIGNhcGFjaXR5UHJvdmlkZXJTdHJhdGVnaWVzOiBbXG4gICAge1xuICAgICAgY2FwYWNpdHlQcm92aWRlcjogcHJvdmlkZXIxLmNhcGFjaXR5UHJvdmlkZXJOYW1lLFxuICAgICAgYmFzZTogMSxcbiAgICAgIHdlaWdodDogMSxcbiAgICB9LFxuICAgIHtcbiAgICAgIGNhcGFjaXR5UHJvdmlkZXI6IHByb3ZpZGVyMi5jYXBhY2l0eVByb3ZpZGVyTmFtZSxcbiAgICAgIGJhc2U6IDAsXG4gICAgICB3ZWlnaHQ6IDIsXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ25ldHdvcmtMb2FkQmFsYW5jZWRFYzJTZXJ2aWNlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/aws-ecs-integ-nlb.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service-idle-timeout.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/networkLoadBalancedEc2ServiceTestDefaultTestDeployAssert34DAD7DE.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.ts similarity index 82% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.ts index a4ec8d3b93e78..819c507655078 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.ts @@ -1,9 +1,9 @@ -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import { InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage, AsgCapacityProvider, EcsOptimizedImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { NetworkLoadBalancedEc2Service } from '../../lib'; +import { AutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling'; +import { InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage, AsgCapacityProvider, EcsOptimizedImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { NetworkLoadBalancedEc2Service } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-nlb'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js new file mode 100644 index 0000000000000..2d70978e44b03 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const events = require("aws-cdk-lib/aws-events"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +class EventStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); + const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + /// !show + // Create the scheduled task + new aws_ecs_patterns_1.ScheduledEc2Task(this, 'ScheduledEc2Task', { + cluster, + scheduledEc2TaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + cpu: 1, + environment: { TRIGGER: 'CloudWatch Events' }, + }, + desiredTaskCount: 2, + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), + }); + /// !hide + } +} +const myStack = new EventStack(app, 'aws-ecs-integ-ecs'); +new integ.IntegTest(app, 'scheduledEc2TaskTest', { + testCases: [myStack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2NoZWR1bGVkLWVjcy10YXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2NoZWR1bGVkLWVjcy10YXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxtRUFBZ0U7QUFFaEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxVQUFXLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDaEMsWUFBWSxLQUFjLEVBQUUsRUFBVTtRQUNwQyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7UUFFcEQsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxZQUFZLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ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29udGFpbmVySW1hZ2UuZnJvbVJlZ2lzdHJ5KCdhbWF6b24vYW1hem9uLWVjcy1zYW1wbGUnKSxcbiAgICAgICAgbWVtb3J5TGltaXRNaUI6IDUxMixcbiAgICAgICAgY3B1OiAxLFxuICAgICAgICBlbnZpcm9ubWVudDogeyBUUklHR0VSOiAnQ2xvdWRXYXRjaCBFdmVudHMnIH0sXG4gICAgICB9LFxuICAgICAgZGVzaXJlZFRhc2tDb3VudDogMixcbiAgICAgIHNjaGVkdWxlOiBldmVudHMuU2NoZWR1bGUucmF0ZShjZGsuRHVyYXRpb24ubWludXRlcygxKSksXG4gICAgfSk7XG4gICAgLy8vICFoaWRlXG4gIH1cbn1cblxuY29uc3QgbXlTdGFjayA9IG5ldyBFdmVudFN0YWNrKGFwcCwgJ2F3cy1lY3MtaW50ZWctZWNzJyk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnc2NoZWR1bGVkRWMyVGFza1Rlc3QnLCB7XG4gIHRlc3RDYXNlczogW215U3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/aws-ecs-integ-ecs.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.ts similarity index 77% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.ts index ec99ce3350ccd..375ac9eb067bf 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { ScheduledEc2Task } from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ScheduledEc2Task } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js new file mode 100644 index 0000000000000..7ad4ed47b8558 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-lb-fargate-cmd-entrypoint-test'); +// Create VPC and cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'TestFargateCluster', { vpc }); +// Create ALB service with Command and EntryPoint +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'ALBFargateServiceWithCommandAndEntryPoint', { + cluster, + memoryLimitMiB: 512, + cpu: 256, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + command: ['/usr/sbin/apache2', '-D', 'FOREGROUND'], + entryPoint: ['/bin/bash'], + }, +}); +new integ.IntegTest(app, 'AlbFargateServiceWithCommandAndEntryPoint', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLWZhcmdhdGUtc2VydmljZS1jb21tYW5kLWVudHJ5LXBvaW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYWxiLWZhcmdhdGUtc2VydmljZS1jb21tYW5kLWVudHJ5LXBvaW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELDREQUE0RDtBQUU1RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUs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cy1zYW1wbGUnKSxcbiAgICAgIGNvbW1hbmQ6IFsnL3Vzci9zYmluL2FwYWNoZTInLCAnLUQnLCAnRk9SRUdST1VORCddLFxuICAgICAgZW50cnlQb2ludDogWycvYmluL2Jhc2gnXSxcbiAgICB9LFxuICB9LFxuKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdBbGJGYXJnYXRlU2VydmljZVdpdGhDb21tYW5kQW5kRW50cnlQb2ludCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/AlbFargateServiceWithCommandAndEntryPointDefaultTestDeployAssert84DAACDF.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/aws-ecs-integ-lb-fargate-cmd-entrypoint-test.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.ts similarity index 77% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.ts index 7c42234ead53f..3a2b3f3ebad5f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack( diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js new file mode 100644 index 0000000000000..8521363529cad --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_elasticloadbalancingv2_1 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const route53 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-alb-fg-idletimeout'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +// Loadbalancer with idleTimeout set to 120 seconds +new aws_ecs_patterns_1.ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + protocol: aws_elasticloadbalancingv2_1.ApplicationProtocol.HTTPS, + enableECSManagedTags: true, + enableExecuteCommand: true, + domainName: 'test.example.com', + domainZone: route53.HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'example.com.', + }), + redirectHTTP: true, + idleTimeout: aws_cdk_lib_1.Duration.seconds(120), +}); +new integ.IntegTest(app, 'idleTimeoutTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLWZhcmdhdGUtc2VydmljZS1odHRwcy1pZGxlLXRpbWVvdXQuanMiLCJzb3VyY2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V0VGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/aws-ecs-integ-alb-fg-idletimeout.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.network-load-balanced-ecs-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/idleTimeoutTestDefaultTestDeployAssert276553CB.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.ts new file mode 100644 index 0000000000000..538ef46ab8218 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.ts @@ -0,0 +1,38 @@ +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { ApplicationProtocol } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import { App, Duration, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; + +import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-integ-alb-fg-idletimeout'); +const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new Cluster(stack, 'Cluster', { vpc }); + +// Loadbalancer with idleTimeout set to 120 seconds +new ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + protocol: ApplicationProtocol.HTTPS, + enableECSManagedTags: true, + enableExecuteCommand: true, + domainName: 'test.example.com', + domainZone: route53.HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'example.com.', + }), + redirectHTTP: true, + idleTimeout: Duration.seconds(120), +}); + +new integ.IntegTest(app, 'idleTimeoutTest', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js new file mode 100644 index 0000000000000..70662f8c1ae90 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_elasticloadbalancingv2_1 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const route53 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-alb-fg-https'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +// Loadbalancer with HTTPS +new aws_ecs_patterns_1.ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + protocol: aws_elasticloadbalancingv2_1.ApplicationProtocol.HTTPS, + enableECSManagedTags: true, + enableExecuteCommand: true, + domainName: 'test.example.com', + domainZone: route53.HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'example.com.', + }), + redirectHTTP: true, +}); +new integ.IntegTest(app, 'albFargateServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLWZhcmdhdGUtc2VydmljZS1odHRwcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFsYi1mYXJnYXRlLXNlcnZpY2UtaHR0cHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBMEM7QUFDMUMsaURBQThEO0FBQzlELHVGQUE2RTtBQUM3R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TZXJ2aWNlKHN0YWNrLCAnbXlTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICBtZW1vcnlMaW1pdE1pQjogNTEyLFxuICB0YXNrSW1hZ2VPcHRpb25zOiB7XG4gICAgaW1hZ2U6IENvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIH0sXG4gIHByb3RvY29sOiBBcHBsaWNhdGlvblByb3RvY29sLkhUVFBTLFxuICBlbmFibGVFQ1NNYW5hZ2VkVGFnczogdHJ1ZSxcbiAgZW5hYmxlRXhlY3V0ZUNvbW1hbmQ6IHRydWUsXG4gIGRvbWFpbk5hbWU6ICd0ZXN0LmV4YW1wbGUuY29tJyxcbiAgZG9tYWluWm9uZTogcm91dGU1My5Ib3N0ZWRab25lLmZyb21Ib3N0ZWRab25lQXR0cmlidXRlcyhzdGFjaywgJ0hvc3RlZFpvbmUnLCB7XG4gICAgaG9zdGVkWm9uZUlkOiAnZmFrZUlkJyxcbiAgICB6b25lTmFtZTogJ2V4YW1wbGUuY29tLicsXG4gIH0pLFxuICByZWRpcmVjdEhUVFA6IHRydWUsXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhbGJGYXJnYXRlU2VydmljZVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/albFargateServiceTestDefaultTestDeployAssert11CD2C41.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/aws-ecs-integ-alb-fg-https.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.scheduled-ecs-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.ts new file mode 100644 index 0000000000000..88328fd609071 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.ts @@ -0,0 +1,36 @@ +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { ApplicationProtocol } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-integ-alb-fg-https'); +const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new Cluster(stack, 'Cluster', { vpc }); + +// Loadbalancer with HTTPS +new ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + protocol: ApplicationProtocol.HTTPS, + enableECSManagedTags: true, + enableExecuteCommand: true, + domainName: 'test.example.com', + domainZone: route53.HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'example.com.', + }), + redirectHTTP: true, +}); + +new integ.IntegTest(app, 'albFargateServiceTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js new file mode 100644 index 0000000000000..bdd902621f20d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-image'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); +Array.isArray(cluster); +Array.isArray(path); +// Instantiate Fargate Service with just cluster and image +const fargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'FargateService', { + cluster, + taskImageOptions: { + containerPort: 8000, + image: new ecs.AssetImage(path.join(__dirname, '..', 'demo-image')), + }, +}); +// CfnOutput the DNS where you can access your service +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: fargateService.loadBalancer.loadBalancerDnsName }); +new integ.IntegTest(app, 'fargateAssetImageTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXQtaW1hZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hc3N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hcmdhdGUgU2VydmljZSB3aXRoIGp1c3QgY2x1c3RlciBhbmQgaW1hZ2VcbmNvbnN0IGZhcmdhdGVTZXJ2aWNlID0gbmV3IGVjc1BhdHRlcm5zLkFwcGxpY2F0aW9uTG9hZEJhbGFuY2VkRmFyZ2F0ZVNlcnZpY2Uoc3RhY2ssICdGYXJnYXRlU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0ltYWdlT3B0aW9uczoge1xuICAgIGNvbnRhaW5lclBvcnQ6IDgwMDAsXG4gICAgaW1hZ2U6IG5ldyBlY3MuQXNzZXRJbWFnZShwYXRoLmpvaW4oX19kaXJuYW1lLCAnLi4nLCAnZGVtby1pbWFnZScpKSxcbiAgfSxcbn0pO1xuXG4vLyBDZm5PdXRwdXQgdGhlIEROUyB3aGVyZSB5b3UgY2FuIGFjY2VzcyB5b3VyIHNlcnZpY2Vcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnTG9hZEJhbGFuY2VyRE5TJywgeyB2YWx1ZTogZmFyZ2F0ZVNlcnZpY2UubG9hZEJhbGFuY2VyLmxvYWRCYWxhbmNlckRuc05hbWUgfSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnZmFyZ2F0ZUFzc2V0SW1hZ2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-docker.js.snapshot/asset.fa08370824fa0a7eab2c59a4f371fe7631019044d6c906b4268193120dc213b4/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/aws-ecs-integ-fargate-image.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/fargateAssetImageTestDefaultTestDeployAssert15DE6C40.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.ts similarity index 77% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.ts index e5c8b8159e617..139e0d12b8dc5 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-image'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js new file mode 100644 index 0000000000000..0993a1719c04c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cxapi = require("aws-cdk-lib/cx-api"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } }); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-circuit-breaker'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +new aws_ecs_patterns_1.ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + circuitBreaker: { rollback: true }, +}); +new integ.IntegTest(app, 'circuitBreakerAlbFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2lyY3VpdC1icmVha2VyLWxvYWQtYmFsYW5jZWQtZmFyZ2F0ZS1zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2lyY3VpdC1icmVha2VyLWxvYWQtYmFsYW5jZWQtZmFyZ2F0ZS1zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQTBDO0FBQzFDLGlEQUE4RDtBQUM5RCw2Q0FBeUM7QUFDekMsNENBQTRDO0FBQzVDLG9EQUFvRDtBQUNwRCxtRUFBcUY7QUFFckYsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxDQUFDLEVBQUUsY0FBYyxFQUFFLEVBQUUsQ0FBQyxLQUFLLENBQUMsOERBQThELENBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7QUFDM0gsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSwrQkFBK0IsQ0FBQyxDQ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ljYXRpb25Mb2FkQmFsYW5jZWRGYXJnYXRlU2VydmljZSB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1lY3MtcGF0dGVybnMnO1xuXG5jb25zdCBhcHAgPSBuZXcgQXBwKHsgcG9zdENsaUNvbnRleHQ6IHsgW2N4YXBpLkVDU19ESVNBQkxFX0VYUExJQ0lUX0RFUExPWU1FTlRfQ09OVFJPTExFUl9GT1JfQ0lSQ1VJVF9CUkVBS0VSXTogZmFsc2UgfSB9KTtcbmNvbnN0IHN0YWNrID0gbmV3IFN0YWNrKGFwcCwgJ2F3cy1lY3MtaW50ZWctY2lyY3VpdC1icmVha2VyJyk7XG5jb25zdCB2cGMgPSBuZXcgVnBjKHN0YWNrLCAnVnBjJywgeyBtYXhBenM6IDIgfSk7XG5jb25zdCBjbHVzdGVyID0gbmV3IENsdXN0ZXIoc3RhY2ssICdDbHVzdGVyJywgeyB2cGMgfSk7XG5cbm5ldyBBcHBsaWNhdGlvbkxvYWRCYWxhbmNlZEZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnbXlTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICBtZW1vcnlMaW1pdE1pQjogNTEyLFxuICB0YXNrSW1hZ2VPcHRpb25zOiB7XG4gICAgaW1hZ2U6IENvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIH0sXG4gIGNpcmN1aXRCcmVha2VyOiB7IHJvbGxiYWNrOiB0cnVlIH0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdjaXJjdWl0QnJlYWtlckFsYkZhcmdhdGVUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/circuitBreakerAlbFargateTestDefaultTestDeployAssert8EB02B4E.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.ts new file mode 100644 index 0000000000000..3df2b3e4075cf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.ts @@ -0,0 +1,26 @@ +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as cxapi from 'aws-cdk-lib/cx-api'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } }); +const stack = new Stack(app, 'aws-ecs-integ-circuit-breaker'); +const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new Cluster(stack, 'Cluster', { vpc }); + +new ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + circuitBreaker: { rollback: true }, +}); + +new integ.IntegTest(app, 'circuitBreakerAlbFargateTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js new file mode 100644 index 0000000000000..99cc860d368e5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-circuit-breaker-no-dc'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +new aws_ecs_patterns_1.ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + circuitBreaker: { rollback: true }, +}); +new integ.IntegTest(app, 'circuitBreakerNoDeploymentControllerFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2lyY3VpdC1icmVha2VyLW5vLWRlcGxveW1lbnQtY29udHJvbGxlci1mYXJnYXRlLXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jaXJjdWl0LWJyZWFrZXItbm8tZGVwbG95bWVudC1jb250cm9sbGVyLWZhcmdhdGUtc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUEwQztBQUMxQyxpREFBOEQ7QUFDOUQsNkNBQXlDO0FBQ3pDLG9EQUFvRDtBQUNwRCxtRUFBcUY7QUFFckYsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxxQ0FBcUMsQ0FBQyxDQUFDO0FBQ3BFLE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFL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J2F3cy1lY3MtaW50ZWctY2lyY3VpdC1icmVha2VyLW5vLWRjJyk7XG5jb25zdCB2cGMgPSBuZXcgVnBjKHN0YWNrLCAnVnBjJywgeyBtYXhBenM6IDIgfSk7XG5jb25zdCBjbHVzdGVyID0gbmV3IENsdXN0ZXIoc3RhY2ssICdDbHVzdGVyJywgeyB2cGMgfSk7XG5cbm5ldyBBcHBsaWNhdGlvbkxvYWRCYWxhbmNlZEZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnbXlTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICBtZW1vcnlMaW1pdE1pQjogNTEyLFxuICB0YXNrSW1hZ2VPcHRpb25zOiB7XG4gICAgaW1hZ2U6IENvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIH0sXG4gIGNpcmN1aXRCcmVha2VyOiB7IHJvbGxiYWNrOiB0cnVlIH0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdjaXJjdWl0QnJlYWtlck5vRGVwbG95bWVudENvbnRyb2xsZXJGYXJnYXRlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/aws-ecs-integ-circuit-breaker-no-dc.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/circuitBreakerNoDeploymentControllerFargateTestDefaultTestDeployAssert62C03B9E.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.ts new file mode 100644 index 0000000000000..1e807a4df3692 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.ts @@ -0,0 +1,25 @@ +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-integ-circuit-breaker-no-dc'); +const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new Cluster(stack, 'Cluster', { vpc }); + +new ApplicationLoadBalancedFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + circuitBreaker: { rollback: true }, +}); + +new integ.IntegTest(app, 'circuitBreakerNoDeploymentControllerFargateTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js new file mode 100644 index 0000000000000..deb62a0c4fb3b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cxapi = require("aws-cdk-lib/cx-api"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } }); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-patterns-queue'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new aws_ecs_patterns_1.QueueProcessingFargateService(stack, 'QueueProcessingService', { + vpc, + memoryLimitMiB: 512, + circuitBreaker: { rollback: true }, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), +}); +new integ.IntegTest(app, 'circuitBreakerQueueProcessingFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2lyY3VpdC1icmVha2VyLXF1ZXVlLXByb2Nlc3NpbmctZmFyZ2F0ZS1zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2lyY3VpdC1icmVha2VyLXF1ZXVlLXByb2Nlc3NpbmctZmFyZ2F0ZS1zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsNkNBQXlDO0FBQ3pDLDRDQUE0QztBQUM1QyxvREFBb0Q7QUFDcEQsbUVBQTZFO0FBRTdFLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsQ0FBQyxFQUFFLGNBQWMsRUFBRSxFQUFFLENBQUMsS0FBSyxDQUFDLDhEQUE4RCxDQUFDLEVBQUUsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO0FBQzNILE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsd0JBQXdCLENBQUMsQ0FBQztBQUN2RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRTtJQUNwQyxNQUFNLEVBQUUsQ0FBQztDQUNWLENBQUMsQ0FBQztBQUVILElBQUksZ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UUk9MTEVSX0ZPUl9DSVJDVUlUX0JSRUFLRVJdOiBmYWxzZSB9IH0pO1xuY29uc3Qgc3RhY2sgPSBuZXcgU3RhY2soYXBwLCAnYXdzLWVjcy1wYXR0ZXJucy1xdWV1ZScpO1xuY29uc3QgdnBjID0gbmV3IGVjMi5WcGMoc3RhY2ssICdWUEMnLCB7XG4gIG1heEF6czogMixcbn0pO1xuXG5uZXcgUXVldWVQcm9jZXNzaW5nRmFyZ2F0ZVNlcnZpY2Uoc3RhY2ssICdRdWV1ZVByb2Nlc3NpbmdTZXJ2aWNlJywge1xuICB2cGMsXG4gIG1lbW9yeUxpbWl0TWlCOiA1MTIsXG4gIGNpcmN1aXRCcmVha2VyOiB7IHJvbGxiYWNrOiB0cnVlIH0sXG4gIGltYWdlOiBuZXcgZWNzLkFzc2V0SW1hZ2UocGF0aC5qb2luKF9fZGlybmFtZSwgJy4uJywgJ3Nxcy1yZWFkZXInKSksXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdjaXJjdWl0QnJlYWtlclF1ZXVlUHJvY2Vzc2luZ0ZhcmdhdGVUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/circuitBreakerQueueProcessingFargateTestDefaultTestDeployAssert0128E6E6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.ts new file mode 100644 index 0000000000000..376e0030da1bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.ts @@ -0,0 +1,26 @@ +import * as path from 'path'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as cxapi from 'aws-cdk-lib/cx-api'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { QueueProcessingFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } }); +const stack = new Stack(app, 'aws-ecs-patterns-queue'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); + +new QueueProcessingFargateService(stack, 'QueueProcessingService', { + vpc, + memoryLimitMiB: 512, + circuitBreaker: { rollback: true }, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), +}); + +new integ.IntegTest(app, 'circuitBreakerQueueProcessingFargateTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js new file mode 100644 index 0000000000000..bb1cfd623c065 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-execrole'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'L3', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + executionRole: new iam.Role(stack, 'ExecutionRole', { + assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('ecs.amazonaws.com'), new iam.ServicePrincipal('ecs-tasks.amazonaws.com')), + }), + }, +}); +new integ.IntegTest(app, 'executionRoleAlbFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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XR0ZXJucy5BcHBsaWNhdGlvbkxvYWRCYWxhbmNlZEZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnTDMnLCB7XG4gIGNsdXN0ZXIsXG4gIG1lbW9yeUxpbWl0TWlCOiAxMDI0LFxuICBjcHU6IDUxMixcbiAgdGFza0ltYWdlT3B0aW9uczoge1xuICAgIGltYWdlOiBlY3MuQ29udGFpbmVySW1hZ2UuZnJvbVJlZ2lzdHJ5KCdhbWF6b24vYW1hem9uLWVjcy1zYW1wbGUnKSxcbiAgICBleGVjdXRpb25Sb2xlOiBuZXcgaWFtLlJvbGUoc3RhY2ssICdFeGVjdXRpb25Sb2xlJywge1xuICAgICAgYXNzdW1lZEJ5OiBuZXcgaWFtLkNvbXBvc2l0ZVByaW5jaXBhbChcbiAgICAgICAgbmV3IGlhbS5TZXJ2aWNlUHJpbmNpcGFsKCdlY3MuYW1hem9uYXdzLmNvbScpLFxuICAgICAgICBuZXcgaWFtLlNlcnZpY2VQcmluY2lwYWwoJ2Vjcy10YXNrcy5hbWF6b25hd3MuY29tJyksXG4gICAgICApLFxuICAgIH0pLFxuICB9LFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnZXhlY3V0aW9uUm9sZUFsYkZhcmdhdGVUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/aws-ecs-integ-fargate-execrole.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/executionRoleAlbFargateTestDefaultTestDeployAssert4C0F3ED3.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.ts new file mode 100644 index 0000000000000..ef270e6ab8dcf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.ts @@ -0,0 +1,34 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-execrole'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); + +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'L3', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + executionRole: new iam.Role(stack, 'ExecutionRole', { + assumedBy: new iam.CompositePrincipal( + new iam.ServicePrincipal('ecs.amazonaws.com'), + new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), + ), + }), + }, +}); + +new integ.IntegTest(app, 'executionRoleAlbFargateTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js new file mode 100644 index 0000000000000..3a244fb8b8fb2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_elasticloadbalancingv2_1 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-fargate-multi-alb-health'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +// Two load balancers with two listeners and two target groups. +const applicationMultipleTargetGroupsFargateService = new aws_ecs_patterns_1.ApplicationMultipleTargetGroupsFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +applicationMultipleTargetGroupsFargateService.targetGroups[0].configureHealthCheck({ + protocol: aws_elasticloadbalancingv2_1.Protocol.HTTP, + healthyThresholdCount: 2, + unhealthyThresholdCount: 2, + timeout: aws_cdk_lib_1.Duration.seconds(10), + interval: aws_cdk_lib_1.Duration.seconds(30), + healthyHttpCodes: '200', +}); +applicationMultipleTargetGroupsFargateService.targetGroups[1].configureHealthCheck({ + protocol: aws_elasticloadbalancingv2_1.Protocol.HTTP, + healthyThresholdCount: 2, + unhealthyThresholdCount: 2, + timeout: aws_cdk_lib_1.Duration.seconds(10), + interval: aws_cdk_lib_1.Duration.seconds(30), + healthyHttpCodes: '200', +}); +new integ_tests_alpha_1.IntegTest(app, 'Integ', { testCases: [stack] }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaGVhbHRoY2hlY2tzLW11bHRpcGxlLWFwcGxpY2F0aW9uLWxvYWQtYmFsYW5jZWQtZmFyZ2F0ZS1zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaGVhbHRoY2hlY2tzLW11bHRpcGxlLWFwcGxpY2F0aW9uLWxvYWQtYmFsYW5jZWQtZmFyZ2F0ZS1zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQTBDO0FBQzFDLGlEQUE4RDtBQUM5RCx1RkFBa0U7QUFDbEUsNkNBQW1EO0FBQ25ELGtFQUF1RDtBQUV2RCxtRUFBNkY7QUFFN0YsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSx3Q0FBd0MsQ0FBQyxDQUFDO0FBQ3ZFLE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUNqRCxNQUFNLE9BQU8sR0FBRyxJQUFJLGlCQUFPLENB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goKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-alb-health.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.ts similarity index 80% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.ts index 42b4f3a07696a..93463e4047659 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.ts @@ -1,10 +1,10 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { Protocol } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, Duration, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { Protocol } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { App, Duration, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -import { ApplicationMultipleTargetGroupsFargateService } from '../../lib'; +import { ApplicationMultipleTargetGroupsFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-fargate-multi-alb-health'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js new file mode 100644 index 0000000000000..b8e9e82890c19 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-multi-nlb-healthchecks'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +// Two load balancers with two listeners and two target groups. +const networkMultipleTargetGroupsFargateService = new aws_ecs_patterns_1.NetworkMultipleTargetGroupsFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +networkMultipleTargetGroupsFargateService.targetGroups[0].configureHealthCheck({}); +networkMultipleTargetGroupsFargateService.targetGroups[1].configureHealthCheck({}); +new integ_tests_alpha_1.IntegTest(app, 'Integ', { testCases: [stack] }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaGVhbHRoY2hlY2tzLW11bHRpcGxlLW5ldHdvcmstbG9hZC1iYWx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ydDogODAsXG4gICAgICBsaXN0ZW5lcjogJ2xpc3RlbmVyMScsXG4gICAgfSxcbiAgICB7XG4gICAgICBjb250YWluZXJQb3J0OiA5MCxcbiAgICAgIGxpc3RlbmVyOiAnbGlzdGVuZXIyJyxcbiAgICB9LFxuICBdLFxufSk7XG5cbm5ldHdvcmtNdWx0aXBsZVRhcmdldEdyb3Vwc0ZhcmdhdGVTZXJ2aWNlLnRhcmdldEdyb3Vwc1swXS5jb25maWd1cmVIZWFsdGhDaGVjayh7fSk7XG5cbm5ldHdvcmtNdWx0aXBsZVRhcmdldEdyb3Vwc0ZhcmdhdGVTZXJ2aWNlLnRhcmdldEdyb3Vwc1sxXS5jb25maWd1cmVIZWFsdGhDaGVjayh7fSk7XG5cblxubmV3IEludGVnVGVzdChhcHAsICdJbnRlZycsIHsgdGVzdENhc2VzOiBbc3RhY2tdIH0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-multi-nlb-healthchecks.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.ts similarity index 79% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.ts index 647cacba45149..b8d785277a840 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.ts @@ -1,8 +1,8 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { NetworkMultipleTargetGroupsFargateService } from '../../lib'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { NetworkMultipleTargetGroupsFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-multi-nlb-healthchecks'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js new file mode 100644 index 0000000000000..02a5b0404b02d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-l3-autocreate'); +// No VPC or Cluster specified +// Create ALB service +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'ALBFargateService', { + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, +}); +// Create NLB service +new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'NLBFargateService', { + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, +}); +new integ.IntegTest(app, 'autoCreateNlbFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubDMtYXV0b2NyZWF0ZS5qcyIsInNvdXJjZVJvb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lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIH0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhdXRvQ3JlYXRlTmxiRmFyZ2F0ZVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/autoCreateNlbFargateTestDefaultTestDeployAssertD6693011.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/aws-ecs-integ-l3-autocreate.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.ts similarity index 78% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.ts index 5f335eadc1c1f..ba61a2ac1d299 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.ts @@ -1,7 +1,7 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-l3-autocreate'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js new file mode 100644 index 0000000000000..5cdac84ccab19 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-lb-fargate'); +// Create VPC and cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +cluster.enableFargateCapacityProviders(); +// Create ALB service with capacity provider storategies +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'ALBFargateService', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + capacityProviderStrategies: [ + { + capacityProvider: 'FARGATE', + base: 1, + weight: 1, + }, + { + capacityProvider: 'FARGATE_SPOT', + base: 0, + weight: 2, + }, + ], +}); +// Create NLB service with capacity provider storategies +new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'NLBFargateService', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + capacityProviderStrategies: [ + { + capacityProvider: 'FARGATE', + base: 1, + weight: 1, + }, + { + capacityProvider: 'FARGATE_SPOT', + base: 0, + weight: 2, + }, + ], +}); +new integ.IntegTest(app, 'l3CapacityProviderStrategiesTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubDMtY2FwYWNpdHktcHJvdmlkZXItc3RyYXRlZ2llcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmwzLWNhcGFjaXR5LXByb3ZpZGVyLXN0cmF0ZWdpZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsNERBQTREO0FBRTVELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMEJBQTBCLENBQUMsQ0FBQztBQUU3RCx5QkFBeUI7QUFDekIsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUNyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQU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7XG4gICAgICBjYXBhY2l0eVByb3ZpZGVyOiAnRkFSR0FURScsXG4gICAgICBiYXNlOiAxLFxuICAgICAgd2VpZ2h0OiAxLFxuICAgIH0sXG4gICAge1xuICAgICAgY2FwYWNpdHlQcm92aWRlcjogJ0ZBUkdBVEVfU1BPVCcsXG4gICAgICBiYXNlOiAwLFxuICAgICAgd2VpZ2h0OiAyLFxuICAgIH0sXG4gIF0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdsM0NhcGFjaXR5UHJvdmlkZXJTdHJhdGVnaWVzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/aws-ecs-integ-lb-fargate.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-application-load-balanced-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/l3CapacityProviderStrategiesTestDefaultTestDeployAssertCE3F86E7.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.ts similarity index 85% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.ts index 0057bc77bd3ec..98615b7368691 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-lb-fargate'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js new file mode 100644 index 0000000000000..44dd741f7f707 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-l3-vpconly'); +// Create VPC only +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +// Create ALB service +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'ALBFargateService', { + vpc, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, +}); +// Create NLB service +new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'NLBFargateService', { + vpc, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, +}); +new integ.IntegTest(app, 'vpcOnlyFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubDMtdnBjb25seS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmwzLXZwY29ubHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsNERBQTREO0FBRTVELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMEJBQTBCLENBQUMsQ0FBQztBQUU3RCxrQkFBa0I7QUFDbEIsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUM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XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAndnBjT25seUZhcmdhdGVUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/aws-ecs-integ-l3-vpconly.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.healthchecks-multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/vpcOnlyFargateTestDefaultTestDeployAssertEB558D64.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.ts similarity index 76% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.ts index 3d5c6296afd07..8262a2bc3b1ac 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-l3-vpconly'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js new file mode 100644 index 0000000000000..6c0fe628b698c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-lb-fargate'); +// Create VPC and cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +// Create ALB service +new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'ALBFargateService', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, +}); +// Create NLB service +new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'NLBFargateService', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry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2x1c3RlciA9IG5ldyBlY3MuQ2x1c3RlcihzdGFjaywgJ0ZhcmdhdGVDbHVzdGVyJywgeyB2cGMgfSk7XG5cbi8vIENyZWF0ZSBBTEIgc2VydmljZVxubmV3IGVjc1BhdHRlcm5zLkFwcGxpY2F0aW9uTG9hZEJhbGFuY2VkRmFyZ2F0ZVNlcnZpY2Uoc3RhY2ssICdBTEJGYXJnYXRlU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgbWVtb3J5TGltaXRNaUI6IDEwMjQsXG4gIGNwdTogNTEyLFxuICB0YXNrSW1hZ2VPcHRpb25zOiB7XG4gICAgaW1hZ2U6IGVjcy5Db250YWluZXJJbWFnZS5mcm9tUmVnaXN0cnkoJ2FtYXpvbi9hbWF6b24tZWNzLXNhbXBsZScpLFxuICB9LFxufSk7XG5cbi8vIENyZWF0ZSBOTEIgc2VydmljZVxubmV3IGVjc1BhdHRlcm5zLk5ldHdvcmtMb2FkQmFsYW5jZWRGYXJnYXRlU2VydmljZShzdGFjaywgJ05MQkZhcmdhdGVTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICBtZW1vcnlMaW1pdE1pQjogMTAyNCxcbiAgY3B1OiA1MTIsXG4gIHRhc2tJbWFnZU9wdGlvbnM6IHtcbiAgICBpbWFnZTogZWNzLkNvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIH0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdsM0ZhcmdhdGVUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/l3FargateTestDefaultTestDeployAssert3391A20B.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.ts similarity index 77% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.ts index 174c232c7e346..214cda1d2f635 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-lb-fargate'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js new file mode 100644 index 0000000000000..50defd7a342db --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-integ-fargate-multi-nlb-health'); +const vpc = new aws_ec2_1.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new aws_ecs_1.Cluster(stack, 'Cluster', { vpc }); +// Two load balancers with two listeners and two target groups. +new aws_ecs_patterns_1.NetworkMultipleTargetGroupsFargateService(stack, 'myService', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: aws_ecs_1.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +new integ.IntegTest(app, 'networkMultipleTargetGroupsFargateServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubXVsdGlwbGUtbmV0d29yay1sb2FkLWJhbGFuY2VkLWZhcmdhdGUtc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm11bHRpcGxlLW5ldHdvcmstbG9hZC1iYWxhbmNlZC1mYXJnYXRlLXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBMEM7QUFDMUMsaURBQThEO0FBQzlELDZDQUF5Qzt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ydmljZScsIHtcbiAgY2x1c3RlcixcbiAgbWVtb3J5TGltaXRNaUI6IDUxMixcbiAgdGFza0ltYWdlT3B0aW9uczoge1xuICAgIGltYWdlOiBDb250YWluZXJJbWFnZS5mcm9tUmVnaXN0cnkoJ2FtYXpvbi9hbWF6b24tZWNzLXNhbXBsZScpLFxuICB9LFxuICBsb2FkQmFsYW5jZXJzOiBbXG4gICAge1xuICAgICAgbmFtZTogJ2xiMScsXG4gICAgICBsaXN0ZW5lcnM6IFtcbiAgICAgICAge1xuICAgICAgICAgIG5hbWU6ICdsaXN0ZW5lcjEnLFxuICAgICAgICB9LFxuICAgICAgXSxcbiAgICB9LFxuICAgIHtcbiAgICAgIG5hbWU6ICdsYjInLFxuICAgICAgbGlzdGVuZXJzOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBuYW1lOiAnbGlzdGVuZXIyJyxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfSxcbiAgXSxcbiAgdGFyZ2V0R3JvdXBzOiBbXG4gICAge1xuICAgICAgY29udGFpbmVyUG9ydDogODAsXG4gICAgICBsaXN0ZW5lcjogJ2xpc3RlbmVyMScsXG4gICAgfSxcbiAgICB7XG4gICAgICBjb250YWluZXJQb3J0OiA5MCxcbiAgICAgIGxpc3RlbmVyOiAnbGlzdGVuZXIyJyxcbiAgICB9LFxuICBdLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnbmV0d29ya011bHRpcGxlVGFyZ2V0R3JvdXBzRmFyZ2F0ZVNlcnZpY2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/aws-ecs-integ-fargate-multi-nlb-health.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/networkMultipleTargetGroupsFargateServiceTestDefaultTestDeployAssertC9049A80.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.ts similarity index 77% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.ts index 9c429034c9a49..75b851ec7cd21 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.ts @@ -1,8 +1,8 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { NetworkMultipleTargetGroupsFargateService } from '../../lib'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { NetworkMultipleTargetGroupsFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-integ-fargate-multi-nlb-health'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js new file mode 100644 index 0000000000000..0cff40c5163d8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-patterns-queue-isolated'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, + subnetConfiguration: [ + { + cidrMask: 24, + name: 'Public', + subnetType: ec2.SubnetType.PUBLIC, + }, + { + cidrMask: 24, + name: 'Isolated', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + }, + ], +}); +vpc.addS3Endpoint('S3Endpoint', [{ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }]); +const securityGroup = new ec2.SecurityGroup(stack, 'MyCustomSG', { + vpc, +}); +const queueProcessing = new aws_ecs_patterns_1.QueueProcessingFargateService(stack, 'IsolatedQueueService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), + securityGroups: [securityGroup], + taskSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, +}); +queueProcessing.service.node.addDependency(vpc.addInterfaceEndpoint('SqsEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.SQS, +}), vpc.addInterfaceEndpoint('EcrEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.ECR, +}), vpc.addInterfaceEndpoint('EcrImageEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER, +}), vpc.addInterfaceEndpoint('CloudWatchLogsEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_LOGS, +})); +new integ.IntegTest(app, 'isolatedQueueProcessingFargateServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucXVldWUtcHJvY2Vzc2luZy1mYXJnYXRlLXNlcnZpY2UtaXNvbGF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5xdWV1ZS1wcm9jZXNzaW5nLWZhcmdhdGUtc2VydmljZS1pc29sYXRlZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ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lVnBjRW5kcG9pbnRBd3NTZXJ2aWNlLkNMT1VEV0FUQ0hfTE9HUyxcbiAgfSksXG4pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2lzb2xhdGVkUXVldWVQcm9jZXNzaW5nRmFyZ2F0ZVNlcnZpY2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/aws-ecs-patterns-queue-isolated.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/isolatedQueueProcessingFargateServiceTestDefaultTestDeployAssert0132317A.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts similarity index 85% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts index 71b8bef6b6029..16ab480d1c777 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { QueueProcessingFargateService } from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { QueueProcessingFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new App(); const stack = new Stack(app, 'aws-ecs-patterns-queue-isolated'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js new file mode 100644 index 0000000000000..6b4c78c30537f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-patterns-queue-public'); +const vpc = new ec2.Vpc(stack, 'VPC'); +new aws_ecs_patterns_1.QueueProcessingFargateService(stack, 'PublicQueueService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), + assignPublicIp: true, + healthCheck: { + command: ['CMD-SHELL', 'curl -f http://localhost/ || exit 1'], + interval: aws_cdk_lib_1.Duration.seconds(6), + retries: 10, + }, +}); +new integ.IntegTest(app, 'publicQueueProcessingFargateServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucXVldWUtcHJvY2Vzc2luZy1mYXJnYXRlLXNlcnZpY2UtcHVibGljLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucXVldWUtcHJvY2Vzc2luZy1mYXJnYXRlLXNlcnZpY2UtcHVibGljLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsNkNBQW1EO0FBQ25ELG9EQUFvRDtBQUNwRCxtRUFBNkU7QUFFN0UsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSwrQkFBK0IsQ0FBQyxDQUFDO0FBQzlELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFFdEMsSUFBSSxnREFBNkIsQ0FBQyxLQUFLLEVBQUUsb0JBQW9CLEVBQUU7SUFDN0QsR0FB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ayhhcHAsICdhd3MtZWNzLXBhdHRlcm5zLXF1ZXVlLXB1YmxpYycpO1xuY29uc3QgdnBjID0gbmV3IGVjMi5WcGMoc3RhY2ssICdWUEMnKTtcblxubmV3IFF1ZXVlUHJvY2Vzc2luZ0ZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnUHVibGljUXVldWVTZXJ2aWNlJywge1xuICB2cGMsXG4gIG1lbW9yeUxpbWl0TWlCOiA1MTIsXG4gIGltYWdlOiBuZXcgZWNzLkFzc2V0SW1hZ2UocGF0aC5qb2luKF9fZGlybmFtZSwgJy4uJywgJ3Nxcy1yZWFkZXInKSksXG4gIGFzc2lnblB1YmxpY0lwOiB0cnVlLFxuICBoZWFsdGhDaGVjazoge1xuICAgIGNvbW1hbmQ6IFsnQ01ELVNIRUxMJywgJ2N1cmwgLWYgaHR0cDovL2xvY2FsaG9zdC8gfHwgZXhpdCAxJ10sXG4gICAgaW50ZXJ2YWw6IER1cmF0aW9uLnNlY29uZHMoNiksXG4gICAgcmV0cmllczogMTAsXG4gIH0sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdwdWJsaWNRdWV1ZVByb2Nlc3NpbmdGYXJnYXRlU2VydmljZVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/aws-ecs-patterns-queue-public.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.ts new file mode 100644 index 0000000000000..72de14c93deac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.ts @@ -0,0 +1,28 @@ +import * as path from 'path'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import { App, Stack, Duration } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { QueueProcessingFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-patterns-queue-public'); +const vpc = new ec2.Vpc(stack, 'VPC'); + +new QueueProcessingFargateService(stack, 'PublicQueueService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), + assignPublicIp: true, + healthCheck: { + command: ['CMD-SHELL', 'curl -f http://localhost/ || exit 1'], + interval: Duration.seconds(6), + retries: 10, + }, +}); + +new integ.IntegTest(app, 'publicQueueProcessingFargateServiceTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js new file mode 100644 index 0000000000000..4b4e5f52dcd16 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-ecs-patterns-queue'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new aws_ecs_patterns_1.QueueProcessingFargateService(stack, 'QueueProcessingService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), + minScalingCapacity: 0, +}); +new integ.IntegTest(app, 'queueProcessingFargateServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucXVldWUtcHJvY2Vzc2luZy1mYXJnYXRlLXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5xdWV1ZS1wcm9jZXNzaW5nLWZhcmdhdGUtc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLDZDQUF5QztBQUN6QyxvREFBb0Q7QUFDcEQsbUVBQTZFO0FBRTdFLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0F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zLXBhdHRlcm5zJztcblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgU3RhY2soYXBwLCAnYXdzLWVjcy1wYXR0ZXJucy1xdWV1ZScpO1xuY29uc3QgdnBjID0gbmV3IGVjMi5WcGMoc3RhY2ssICdWUEMnLCB7XG4gIG1heEF6czogMixcbn0pO1xuXG5uZXcgUXVldWVQcm9jZXNzaW5nRmFyZ2F0ZVNlcnZpY2Uoc3RhY2ssICdRdWV1ZVByb2Nlc3NpbmdTZXJ2aWNlJywge1xuICB2cGMsXG4gIG1lbW9yeUxpbWl0TWlCOiA1MTIsXG4gIGltYWdlOiBuZXcgZWNzLkFzc2V0SW1hZ2UocGF0aC5qb2luKF9fZGlybmFtZSwgJy4uJywgJ3Nxcy1yZWFkZXInKSksXG4gIG1pblNjYWxpbmdDYXBhY2l0eTogMCxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ3F1ZXVlUHJvY2Vzc2luZ0ZhcmdhdGVTZXJ2aWNlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/asset.95cefedd43575452a70cdeeeceb0f1c5728fd58c9ff8e81e760c3dac33c46417/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/aws-ecs-patterns-queue.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.multiple-network-load-balanced-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/queueProcessingFargateServiceTestDefaultTestDeployAssert73AFD2F6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.ts new file mode 100644 index 0000000000000..70f71590eedf4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.ts @@ -0,0 +1,25 @@ +import * as path from 'path'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { QueueProcessingFargateService } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new App(); +const stack = new Stack(app, 'aws-ecs-patterns-queue'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); + +new QueueProcessingFargateService(stack, 'QueueProcessingService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), + minScalingCapacity: 0, +}); + +new integ.IntegTest(app, 'queueProcessingFargateServiceTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js new file mode 100644 index 0000000000000..ec4d43b90dc0e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const events = require("aws-cdk-lib/aws-events"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-runtime-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +// Create the scheduled task +new aws_ecs_patterns_1.ScheduledFargateTask(stack, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: new ecs.AssetImage(path.join(__dirname, '..', 'demo-image')), + memoryLimitMiB: 512, + cpu: 256, + environment: { TRIGGER: 'CloudWatch Events' }, + runtimePlatform: { + cpuArchitecture: ecs.CpuArchitecture.X86_64, + operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, + }, + }, + desiredTaskCount: 2, + schedule: events.Schedule.rate(cdk.Duration.minutes(2)), +}); +new integ_tests_alpha_1.IntegTest(app, 'Integ', { testCases: [stack] }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVudGltZS1wbGF0Zm9ybS1hcHBsaWNhdGlvbi1sb2FkLWJhbGFuY2VkLWZhcmdhdGUtc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJ1bnRpbWUtcGxhdGZvcm0tYXBwbGljYXRpb24tbG9hZC1iYWxhbmNlZC1mYXJnYXRlLXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxpREFB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WR1bGVkIHRhc2tcbm5ldyBTY2hlZHVsZWRGYXJnYXRlVGFzayhzdGFjaywgJ1NjaGVkdWxlZEZhcmdhdGVUYXNrJywge1xuICBjbHVzdGVyLFxuICBzY2hlZHVsZWRGYXJnYXRlVGFza0ltYWdlT3B0aW9uczoge1xuICAgIGltYWdlOiBuZXcgZWNzLkFzc2V0SW1hZ2UocGF0aC5qb2luKF9fZGlybmFtZSwgJy4uJywgJ2RlbW8taW1hZ2UnKSksXG4gICAgbWVtb3J5TGltaXRNaUI6IDUxMixcbiAgICBjcHU6IDI1NixcbiAgICBlbnZpcm9ubWVudDogeyBUUklHR0VSOiAnQ2xvdWRXYXRjaCBFdmVudHMnIH0sXG4gICAgcnVudGltZVBsYXRmb3JtOiB7XG4gICAgICBjcHVBcmNoaXRlY3R1cmU6IGVjcy5DcHVBcmNoaXRlY3R1cmUuWDg2XzY0LFxuICAgICAgb3BlcmF0aW5nU3lzdGVtRmFtaWx5OiBlY3MuT3BlcmF0aW5nU3lzdGVtRmFtaWx5LkxJTlVYLFxuICAgIH0sXG4gIH0sXG4gIGRlc2lyZWRUYXNrQ291bnQ6IDIsXG4gIHNjaGVkdWxlOiBldmVudHMuU2NoZWR1bGUucmF0ZShjZGsuRHVyYXRpb24ubWludXRlcygyKSksXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdJbnRlZycsIHsgdGVzdENhc2VzOiBbc3RhY2tdIH0pO1xuXG5hcHAuc3ludGgoKTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/IntegDefaultTestDeployAssert4E6713E1.template.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.nested-stacks-docker.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/aws-ecs-runtime-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.ts new file mode 100644 index 0000000000000..30ff397fe331f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.ts @@ -0,0 +1,36 @@ +import * as path from 'path'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +import { ScheduledFargateTask } from 'aws-cdk-lib/aws-ecs-patterns'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-runtime-integ'); + + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); + +// Create the scheduled task +new ScheduledFargateTask(stack, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: new ecs.AssetImage(path.join(__dirname, '..', 'demo-image')), + memoryLimitMiB: 512, + cpu: 256, + environment: { TRIGGER: 'CloudWatch Events' }, + runtimePlatform: { + cpuArchitecture: ecs.CpuArchitecture.X86_64, + operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, + }, + }, + desiredTaskCount: 2, + schedule: events.Schedule.rate(cdk.Duration.minutes(2)), +}); + +new IntegTest(app, 'Integ', { testCases: [stack] }); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js new file mode 100644 index 0000000000000..2537de0abca65 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const events = require("aws-cdk-lib/aws-events"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ecs_patterns_1 = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +class EventStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); + const cluster = new ecs.Cluster(this, 'FargateCluster', { vpc }); + // Create the scheduled task + new aws_ecs_patterns_1.ScheduledFargateTask(this, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: new ecs.AssetImage(path.join(__dirname, '..', 'demo-image')), + memoryLimitMiB: 512, + cpu: 256, + environment: { TRIGGER: 'CloudWatch Events' }, + }, + desiredTaskCount: 2, + schedule: events.Schedule.rate(cdk.Duration.minutes(2)), + }); + } +} +const myStack = new EventStack(app, 'aws-fargate-integ'); +new integ.IntegTest(app, 'publicQueueProcessingFargateServiceTest', { + testCases: [myStack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2NoZWR1bGVkLWZhcmdhdGUtdGFzay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNjaGVkdWxlZC1mYXJnYXRlLXRhc2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxtRUFBb0U7QUFFcEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxVQUFXLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDaEMsWUFBWSxLQUFjLEVBQUUsRUFBVTtRQUNwQyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7UUFDcEQsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxnQkFBZ0IsRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7UUFFakUsNEJBQTRCO1FBQzVCLElBQUksdUNBQW9CLENBQUMsSUFBSSxFQUFFLHNCQUFzQixFQUFFO1lBQ3JELE9BQU87WUFDUCxnQ0FBZ0MsRUFBRTtnQkFDaEMsS0FBSyxFQUFFLElBQUksR0FBRyxDQUFDL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N0YWNrKGFwcCwgJ2F3cy1mYXJnYXRlLWludGVnJyk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAncHVibGljUXVldWVQcm9jZXNzaW5nRmFyZ2F0ZVNlcnZpY2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtteVN0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/demo-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/demo-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/demo-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/demo-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/aws-fargate-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.ts similarity index 75% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.ts index 40f96c34db86f..b9d61581adb99 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { ScheduledFargateTask } from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { ScheduledFargateTask } from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js new file mode 100644 index 0000000000000..ac4af7b02e9c4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-special-listener'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'Cluster', { vpc }); +const fargateNlbService = new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'FargateNlbService', { + cluster, + listenerPort: 2015, + taskImageOptions: { + containerPort: 2015, + image: ecs.ContainerImage.fromRegistry('abiosoft/caddy'), + }, +}); +const fargateAlbService = new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'FargateAlbService', { + cluster, + listenerPort: 2015, + taskImageOptions: { + containerPort: 2015, + image: ecs.ContainerImage.fromRegistry('abiosoft/caddy'), + }, +}); +new cdk.CfnOutput(stack, 'AlbDnsName', { value: fargateAlbService.loadBalancer.loadBalancerDnsName }); +new cdk.CfnOutput(stack, 'NlbDnsName', { value: fargateNlbService.loadBalancer.loadBalancerDnsName }); +new integ.IntegTest(app, 'publicQueueProcessingFargateServiceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3BlY2l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ZXIubG9hZEJhbGFuY2VyRG5zTmFtZSB9KTtcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnTmxiRG5zTmFtZScsIHsgdmFsdWU6IGZhcmdhdGVObGJTZXJ2aWNlLmxvYWRCYWxhbmNlci5sb2FkQmFsYW5jZXJEbnNOYW1lIH0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ3B1YmxpY1F1ZXVlUHJvY2Vzc2luZ0ZhcmdhdGVTZXJ2aWNlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/aws-ecs-integ-fargate-special-listener.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.assets.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.ts similarity index 81% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.ts index 059f8506fa58f..1aec589517e1c 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-special-listener'); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/sqs-reader/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/sqs-reader/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/sqs-reader/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/sqs-reader/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/sqs-reader/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/sqs-reader/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/sqs-reader/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/sqs-reader/index.py diff --git a/packages/@aws-cdk/aws-ecs/test/demo-envfiles/test-envfile.env b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/demo-envfiles/test-envfile.env similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/demo-envfiles/test-envfile.env rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/demo-envfiles/test-envfile.env diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/firelens.conf b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/firelens.conf similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/firelens.conf rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/firelens.conf diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js new file mode 100644 index 0000000000000..6ef30840773a3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-appmesh-proxy'); +// Create a cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const prox = ecs.ProxyConfigurations.appMeshProxyConfiguration({ + containerName: 'envoy', + properties: { + ignoredUID: 1337, + proxyIngressPort: 15000, + proxyEgressPort: 15001, + appPorts: [9080, 9081], + egressIgnoredIPs: ['169.254.170.2', '169.254.169.254'], + }, +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, + proxyConfiguration: prox, + ipcMode: ecs.IpcMode.HOST, + pidMode: ecs.PidMode.TASK, +}); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +taskDefinition.addContainer('envoy', { + // envoyproxy/envoy:latest tag gone from docker hub: https://github.com/envoyproxy/envoy/issues/6344 + image: ecs.ContainerImage.fromRegistry('envoyproxy/envoy:v1.16.2'), + memoryLimitMiB: 256, +}); +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBwLW1lc2gtcHJveHktY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXBwLW1lc2gtcHJveHktY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDO0FBRWhFLG1CQUFtQjtBQUNuQixNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRXJELE1BQU0sT0FBTyxHQUFHLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsWUFBWSxFQUFFLEVBQUUsR0FBRyxFQUFFLENBQUMsQ0FBQztBQUM5RCxPQUFPLENBQUMsV0FBVyxDQUFDLHlCQUF5QixFQUFFO0lBQzdDLFlBQVksRUFBRSxJQUFJLEdBQUcsQ0FBQyxZQUFZLENBQUMsVUFBVSxDQUFDO0NBQy9DLENBQUMsQ0FBQztBQUVILE1BQU0sSUFBSSxHQUFHLEdBQUcsQ0FBQyxtQkFBbUIsQ0FBQyx5QkFBeUIsQ0FBQztJQUM3RCxhQUFhLEVBQUUsT0FBTztJQUN0QixVQUFVLE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xufSk7XG5jb25zdCB0YXNrRGVmaW5pdGlvbiA9IG5ldyBlY3MuRWMyVGFza0RlZmluaXRpb24oc3RhY2ssICdUYXNrRGVmJywge1xuICBuZXR3b3JrTW9kZTogZWNzLk5ldHdvcmtNb2RlLkFXU19WUEMsXG4gIHByb3h5Q29uZmlndXJhdGlvbjogcHJveCxcbiAgaXBjTW9kZTogZWNzLklwY01vZGUuSE9TVCxcbiAgcGlkTW9kZTogZWNzLlBpZE1vZGUuVEFTSyxcbn0pO1xuXG50YXNrRGVmaW5pdGlvbi5hZGRDb250YWluZXIoJ3dlYicsIHtcbiAgaW1hZ2U6IGVjcy5Db250YWluZXJJbWFnZS5mcm9tUmVnaXN0cnkoJ2FtYXpvbi9hbWF6b24tZWNzLXNhbXBsZScpLFxuICBtZW1vcnlMaW1pdE1pQjogMjU2LFxufSk7XG5cbnRhc2tEZWZpbml0aW9uLmFkZENvbnRhaW5lcignZW52b3knLCB7XG4gIC8vIGVudm95cHJveHkvZW52b3k6bGF0ZXN0IHRhZyBnb25lIGZyb20gZG9ja2VyIGh1YjogaHR0cHM6Ly9naXRodWIuY29tL2Vudm95cHJveHkvZW52b3kvaXNzdWVzLzYzNDRcbiAgaW1hZ2U6IGVjcy5Db250YWluZXJJbWFnZS5mcm9tUmVnaXN0cnkoJ2Vudm95cHJveHkvZW52b3k6djEuMTYuMicpLFxuICBtZW1vcnlMaW1pdE1pQjogMjU2LFxufSk7XG5cbm5ldyBlY3MuRWMyU2VydmljZShzdGFjaywgJ1NlcnZpY2UnLCB7XG4gIGNsdXN0ZXIsXG4gIHRhc2tEZWZpbml0aW9uLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/aws-ecs-integ-appmesh-proxy.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts similarity index 91% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts index 0612f6d88c22f..6c02f9ace821a 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.app-mesh-proxy-config.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-appmesh-proxy'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js new file mode 100644 index 0000000000000..46dcfa8f8b8fd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-bottlerocket'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, natGateways: 1 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('bottlerocket-asg', { + minCapacity: 2, + instanceType: new ec2.InstanceType('c5.large'), + machineImageType: ecs.MachineImageType.BOTTLEROCKET, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYm90dGxlcm9ja2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYm90dGxlcm9ja2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLL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Y29uc3QgY2x1c3RlciA9IG5ldyBlY3MuQ2x1c3RlcihzdGFjaywgJ0Vjc0NsdXN0ZXInLCB7IHZwYyB9KTtcblxuY2x1c3Rlci5hZGRDYXBhY2l0eSgnYm90dGxlcm9ja2V0LWFzZycsIHtcbiAgbWluQ2FwYWNpdHk6IDIsXG4gIGluc3RhbmNlVHlwZTogbmV3IGVjMi5JbnN0YW5jZVR5cGUoJ2M1LmxhcmdlJyksXG4gIG1hY2hpbmVJbWFnZVR5cGU6IGVjcy5NYWNoaW5lSW1hZ2VUeXBlLkJPVFRMRVJPQ0tFVCxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/aws-ecs-integ-bottlerocket.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.ts similarity index 76% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.ts index 74dc16947a9a4..0ecc7323b0647 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.bottlerocket.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js new file mode 100644 index 0000000000000..99832a3855f27 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-ec2-capacity-provider'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EC2CPCluster', { + vpc, + enableFargateCapacityProviders: true, +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryReservationMiB: 256, +}); +const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'ASG', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), +}); +const cp = new ecs.AsgCapacityProvider(stack, 'EC2CapacityProvider', { + autoScalingGroup, + // This is to allow cdk destroy to work; otherwise deletion will hang bc ASG cannot be deleted + enableManagedTerminationProtection: false, +}); +cluster.addAsgCapacityProvider(cp); +new ecs.Ec2Service(stack, 'EC2Service', { + cluster, + taskDefinition, + capacityProviderStrategies: [ + { + capacityProvider: cp.capacityProviderName, + weight: 1, + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FwYWNpdHktcHJvdmlkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jYXBhY2l0eS1wcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJEQUEyRDtBQUMzRCwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDZCQUE2QixDQUFDLENBQUM7QUFFaEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUNyRCxHQUF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0FTRycsIHtcbiAgdnBjLFxuICBpbnN0YW5jZVR5cGU6IG5ldyBlYzIuSW5zdGFuY2VUeXBlKCd0Mi5taWNybycpLFxuICBtYWNoaW5lSW1hZ2U6IGVjcy5FY3NPcHRpbWl6ZWRJbWFnZS5hbWF6b25MaW51eDIoKSxcbn0pO1xuXG5jb25zdCBjcCA9IG5ldyBlY3MuQXNnQ2FwYWNpdHlQcm92aWRlcihzdGFjaywgJ0VDMkNhcGFjaXR5UHJvdmlkZXInLCB7XG4gIGF1dG9TY2FsaW5nR3JvdXAsXG4gIC8vIFRoaXMgaXMgdG8gYWxsb3cgY2RrIGRlc3Ryb3kgdG8gd29yazsgb3RoZXJ3aXNlIGRlbGV0aW9uIHdpbGwgaGFuZyBiYyBBU0cgY2Fubm90IGJlIGRlbGV0ZWRcbiAgZW5hYmxlTWFuYWdlZFRlcm1pbmF0aW9uUHJvdGVjdGlvbjogZmFsc2UsXG59KTtcblxuY2x1c3Rlci5hZGRBc2dDYXBhY2l0eVByb3ZpZGVyKGNwKTtcblxubmV3IGVjcy5FYzJTZXJ2aWNlKHN0YWNrLCAnRUMyU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG4gIGNhcGFjaXR5UHJvdmlkZXJTdHJhdGVnaWVzOiBbXG4gICAge1xuICAgICAgY2FwYWNpdHlQcm92aWRlcjogY3AuY2FwYWNpdHlQcm92aWRlck5hbWUsXG4gICAgICB3ZWlnaHQ6IDEsXG4gICAgfSxcbiAgXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ-ec2-capacity-provider.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.ts similarity index 86% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.ts index 3cc93ebaf2eb2..48aa96e87bbab 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.capacity-provider.ts @@ -1,7 +1,7 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-ec2-capacity-provider'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js new file mode 100644 index 0000000000000..2faea65fff6fe --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elb = require("aws-cdk-lib/aws-elasticloadbalancing"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.HOST, + ipcMode: ecs.IpcMode.HOST, + pidMode: ecs.PidMode.TASK, +}); +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +const service = new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +const lb = new elb.LoadBalancer(stack, 'LB', { vpc }); +lb.addListener({ externalPort: 80 }); +lb.addTarget(service); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xiLWhvc3QtbncuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbGItaG9zdC1udy50cyJdLCJuYW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1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG59KTtcblxuY29uc3QgbGIgPSBuZXcgZWxiLkxvYWRCYWxhbmNlcihzdGFjaywgJ0xCJywgeyB2cGMgfSk7XG5sYi5hZGRMaXN0ZW5lcih7IGV4dGVybmFsUG9ydDogODAgfSk7XG5sYi5hZGRUYXJnZXQoc2VydmljZSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnTG9hZEJhbGFuY2VyRE5TJywgeyB2YWx1ZTogbGIubG9hZEJhbGFuY2VyRG5zTmFtZSB9KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.special-listener.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.ts similarity index 84% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.ts index 915256db25141..3711b8c1bc91f 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.clb-host-nw.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js new file mode 100644 index 0000000000000..c532af726b5bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cloudmap = require("aws-cdk-lib/aws-servicediscovery"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 2, + subnetConfiguration: [ + { + name: 'pub', + cidrMask: 24, + subnetType: ec2.SubnetType.PUBLIC, + }, + ], +}); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +const capacity = cluster.addCapacity('capacity', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO), + desiredCapacity: 1, + minCapacity: 1, + maxCapacity: 1, +}); +capacity.connections.allowFromAnyIpv4(ec2.Port.tcpRange(32768, 61000)); +cluster.addDefaultCloudMapNamespace({ name: 'aws-ecs-integ' }); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', {}); +// Main container +const mainContainer = taskDefinition.addContainer('nginx', { + image: ecs.ContainerImage.fromRegistry('nginx'), + memoryReservationMiB: 32, + memoryLimitMiB: 512, +}); +mainContainer.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +// Name container with SRV +const nameContainer = taskDefinition.addContainer('name', { + image: ecs.ContainerImage.fromRegistry('nathanpeck/name'), + environment: { + PORT: '81', + }, + memoryReservationMiB: 32, + memoryLimitMiB: 512, +}); +nameContainer.addPortMappings({ + containerPort: 81, + protocol: ecs.Protocol.TCP, +}); +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, + desiredCount: 3, + cloudMapOptions: { + container: nameContainer, + containerPort: 81, + dnsRecordType: cloudmap.DnsRecordType.SRV, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRtYXAtY29udGFpbmVyLXBvcnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZG1hcC1jb250YWluZXItcG9ydC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyw2REFBNkQ7QUFDN0QsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFL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UxpbWl0TWlCOiA1MTIsXG59KTtcblxubmFtZUNvbnRhaW5lci5hZGRQb3J0TWFwcGluZ3Moe1xuICBjb250YWluZXJQb3J0OiA4MSxcbiAgcHJvdG9jb2w6IGVjcy5Qcm90b2NvbC5UQ1AsXG59KTtcblxubmV3IGVjcy5FYzJTZXJ2aWNlKHN0YWNrLCAnU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG4gIGRlc2lyZWRDb3VudDogMyxcbiAgY2xvdWRNYXBPcHRpb25zOiB7XG4gICAgY29udGFpbmVyOiBuYW1lQ29udGFpbmVyLFxuICAgIGNvbnRhaW5lclBvcnQ6IDgxLFxuICAgIGRuc1JlY29yZFR5cGU6IGNsb3VkbWFwLkRuc1JlY29yZFR5cGUuU1JWLFxuICB9LFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.ts similarity index 89% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.ts index 6c1fadbb23666..e16a2528b074f 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.cloudmap-container-port.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cloudmap from 'aws-cdk-lib/aws-servicediscovery'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js new file mode 100644 index 0000000000000..92d1b1f730692 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const autoscaling = require("aws-cdk-lib/aws-autoscaling"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-default-capacity-provider'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryReservationMiB: 256, +}); +const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'ASG', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), +}); +const cp = new ecs.AsgCapacityProvider(stack, 'EC2CapacityProvider', { + autoScalingGroup, + // This is to allow cdk destroy to work; otherwise deletion will hang bc ASG cannot be deleted + enableManagedTerminationProtection: false, +}); +const cluster = new ecs.Cluster(stack, 'EC2CPCluster', { + vpc, + enableFargateCapacityProviders: true, +}); +cluster.addAsgCapacityProvider(cp); +cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 1, weight: 1 }, + { capacityProvider: 'FARGATE_SPOT', weight: 1 }, +]); +new ecs.Ec2Service(stack, 'EC2Service', { + cluster, + taskDefinition, +}); +new integ.IntegTest(app, 'CapacityProviders', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVmYXVsdC1jYXBhY2l0eS1wcm92aWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmRlZmF1bHQtY2FwYWNpdHktcHJvdmlkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyREFBMkQ7QUFDM0QsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR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RlcihzdGFjaywgJ0VDMkNQQ2x1c3RlcicsIHtcbiAgdnBjLFxuICBlbmFibGVGYXJnYXRlQ2FwYWNpdHlQcm92aWRlcnM6IHRydWUsXG59KTtcblxuY2x1c3Rlci5hZGRBc2dDYXBhY2l0eVByb3ZpZGVyKGNwKTtcbmNsdXN0ZXIuYWRkRGVmYXVsdENhcGFjaXR5UHJvdmlkZXJTdHJhdGVneShbXG4gIHsgY2FwYWNpdHlQcm92aWRlcjogJ0ZBUkdBVEUnLCBiYXNlOiAxLCB3ZWlnaHQ6IDEgfSxcbiAgeyBjYXBhY2l0eVByb3ZpZGVyOiAnRkFSR0FURV9TUE9UJywgd2VpZ2h0OiAxIH0sXG5dKTtcblxuXG5uZXcgZWNzLkVjMlNlcnZpY2Uoc3RhY2ssICdFQzJTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICB0YXNrRGVmaW5pdGlvbixcbn0pO1xubmV3IGludGVnLkludGVnVGVzdChhcHAsICdDYXBhY2l0eVByb3ZpZGVycycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/CapacityProvidersDefaultTestDeployAssert30F9785A.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ-default-capacity-provider.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.ts similarity index 84% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.ts index 1031788517360..70285ca5eb74c 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.default-capacity-provider.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.default-capacity-provider.ts @@ -1,8 +1,8 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-default-capacity-provider'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js new file mode 100644 index 0000000000000..b199fe0012607 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const s3deployment = require("aws-cdk-lib/aws-s3-deployment"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +// S3 bucket to host envfile without public access +const bucket = new s3.Bucket(stack, 'Bucket', { + blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +// ECS cluster to host EC2 task +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +// permit EC2 task to read envfiles from S3 +const s3PolicyStatement = new iam.PolicyStatement({ + actions: ['s3:GetBucketLocation', 's3:GetObject'], +}); +s3PolicyStatement.addAllResources(); +const executionRole = new iam.Role(stack, 'ExecutionRole', { + assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), + inlinePolicies: { + s3Policy: new iam.PolicyDocument({ + statements: [s3PolicyStatement], + }), + }, +}); +// define task to run the container with envfiles +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDefinition', { + executionRole, + networkMode: ecs.NetworkMode.AWS_VPC, +}); +// deploy an envfile to S3 and delete when the bucket is deleted +const envFileDeployment = new s3deployment.BucketDeployment(stack, 'EnvFileDeployment', { + destinationBucket: bucket, + sources: [s3deployment.Source.asset(path.join(__dirname, '../demo-envfiles'))], +}); +// define container with envfiles - one from local disk and another from S3 +const containerDefinition = new ecs.ContainerDefinition(stack, 'Container', { + environmentFiles: [ + ecs.EnvironmentFile.fromAsset(path.join(__dirname, '../demo-envfiles/test-envfile.env')), + ecs.EnvironmentFile.fromBucket(bucket, 'test-envfile.env'), + ], + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, + taskDefinition, +}); +containerDefinition.node.addDependency(envFileDeployment); +// define a service to run the task definition +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZW52aXJvbm1lbnQtZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmVudmlyb25tZW50LWZpbGUudHMiXS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ZXJEZWZpbml0aW9uID0gbmV3IGVjcy5Db250YWluZXJEZWZpbml0aW9uKHN0YWNrLCAnQ29udGFpbmVyJywge1xuICBlbnZpcm9ubWVudEZpbGVzOiBbXG4gICAgZWNzLkVudmlyb25tZW50RmlsZS5mcm9tQXNzZXQocGF0aC5qb2luKF9fZGlybmFtZSwgJy4uL2RlbW8tZW52ZmlsZXMvdGVzdC1lbnZmaWxlLmVudicpKSxcbiAgICBlY3MuRW52aXJvbm1lbnRGaWxlLmZyb21CdWNrZXQoYnVja2V0LCAndGVzdC1lbnZmaWxlLmVudicpLFxuICBdLFxuICBpbWFnZTogZWNzLkNvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIG1lbW9yeUxpbWl0TWlCOiAyNTYsXG4gIHRhc2tEZWZpbml0aW9uLFxufSk7XG5cbmNvbnRhaW5lckRlZmluaXRpb24ubm9kZS5hZGREZXBlbmRlbmN5KGVudkZpbGVEZXBsb3ltZW50KTtcblxuLy8gZGVmaW5lIGEgc2VydmljZSB0byBydW4gdGhlIHRhc2sgZGVmaW5pdGlvblxubmV3IGVjcy5FYzJTZXJ2aWNlKHN0YWNrLCAnU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.6ddcf10002539818a9256eff3fb2b22aa09298d8f946e26ba121c175a600c44e/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.6ddcf10002539818a9256eff3fb2b22aa09298d8f946e26ba121c175a600c44e/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.6ddcf10002539818a9256eff3fb2b22aa09298d8f946e26ba121c175a600c44e/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.6ddcf10002539818a9256eff3fb2b22aa09298d8f946e26ba121c175a600c44e/index.py diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.872561bf078edd1685d50c9ff821cdd60d2b2ddfb0013c4087e79bf2bb50724d.env b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.872561bf078edd1685d50c9ff821cdd60d2b2ddfb0013c4087e79bf2bb50724d.env similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.872561bf078edd1685d50c9ff821cdd60d2b2ddfb0013c4087e79bf2bb50724d.env rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.872561bf078edd1685d50c9ff821cdd60d2b2ddfb0013c4087e79bf2bb50724d.env diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.972240f9dd6e036a93d5f081af9a24315b2053828ac049b3b19b2fa12d7ae64a/test-envfile.env b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.972240f9dd6e036a93d5f081af9a24315b2053828ac049b3b19b2fa12d7ae64a/test-envfile.env similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.972240f9dd6e036a93d5f081af9a24315b2053828ac049b3b19b2fa12d7ae64a/test-envfile.env rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.972240f9dd6e036a93d5f081af9a24315b2053828ac049b3b19b2fa12d7ae64a/test-envfile.env diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.ts diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.bottlerocket.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.ts similarity index 88% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.ts index 9a4d054c479c7..7b3827464ae90 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.environment-file.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3deployment from '@aws-cdk/aws-s3-deployment'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3deployment from 'aws-cdk-lib/aws-s3-deployment'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js new file mode 100644 index 0000000000000..9ff9fdf2f7a9d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const kms = require("aws-cdk-lib/aws-kms"); +const logs = require("aws-cdk-lib/aws-logs"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const kmsKey = new kms.Key(stack, 'KmsKey'); +const logGroup = new logs.LogGroup(stack, 'LogGroup', { + encryptionKey: kmsKey, +}); +const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { + encryptionKey: kmsKey, +}); +const cluster = new ecs.Cluster(stack, 'Ec2Cluster', { + vpc, + executeCommandConfiguration: { + kmsKey, + logConfiguration: { + cloudWatchLogGroup: logGroup, + cloudWatchEncryptionEnabled: true, + s3Bucket: execBucket, + s3EncryptionEnabled: true, + s3KeyPrefix: 'exec-output', + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, +}); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +new ecs.Ec2Service(stack, 'Ec2Service', { + cluster, + taskDefinition, + enableExecuteCommand: true, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXhlYy1jb21tYW5kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZXhlYy1jb21tYW5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyw2Q0FBNkM7QUFDN0MseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyw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OiBuZXcgZWMyLkluc3RhbmNlVHlwZSgndDIubWljcm8nKSxcbn0pO1xuXG5jb25zdCB0YXNrRGVmaW5pdGlvbiA9IG5ldyBlY3MuRWMyVGFza0RlZmluaXRpb24oc3RhY2ssICdUYXNrRGVmJyk7XG5cbnRhc2tEZWZpbml0aW9uLmFkZENvbnRhaW5lcignd2ViJywge1xuICBpbWFnZTogZWNzLkNvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIG1lbW9yeUxpbWl0TWlCOiAyNTYsXG59KTtcblxubmV3IGVjcy5FYzJTZXJ2aWNlKHN0YWNrLCAnRWMyU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG4gIGVuYWJsZUV4ZWN1dGVDb21tYW5kOiB0cnVlLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.ts new file mode 100644 index 0000000000000..b473579fdee4d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.exec-command.ts @@ -0,0 +1,54 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const kmsKey = new kms.Key(stack, 'KmsKey'); + +const logGroup = new logs.LogGroup(stack, 'LogGroup', { + encryptionKey: kmsKey, +}); + +const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { + encryptionKey: kmsKey, +}); + +const cluster = new ecs.Cluster(stack, 'Ec2Cluster', { + vpc, + executeCommandConfiguration: { + kmsKey, + logConfiguration: { + cloudWatchLogGroup: logGroup, + cloudWatchEncryptionEnabled: true, + s3Bucket: execBucket, + s3EncryptionEnabled: true, + s3KeyPrefix: 'exec-output', + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, +}); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); + +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); + +new ecs.Ec2Service(stack, 'Ec2Service', { + cluster, + taskDefinition, + enableExecuteCommand: true, +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js new file mode 100644 index 0000000000000..11a086f02534f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3_assets = require("aws-cdk-lib/aws-s3-assets"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); +const asset = new s3_assets.Asset(stack, 'SampleAsset', { + path: path.join(__dirname, 'firelens.conf'), +}); +// firelens log router with custom s3 configuration file +taskDefinition.addFirelensLogRouter('log_router', { + image: ecs.obtainDefaultFluentBitECRImage(taskDefinition, undefined, '2.1.0'), + firelensConfig: { + type: ecs.FirelensLogRouterType.FLUENTBIT, + options: { + enableECSLogMetadata: false, + configFileValue: `${asset.bucket.bucketArn}/${asset.s3ObjectKey}`, + configFileType: ecs.FirelensConfigFileType.S3, + }, + }, + logging: new ecs.AwsLogDriver({ streamPrefix: 'firelens' }), + memoryReservationMiB: 50, +}); +// new container with firelens log driver +const container = taskDefinition.addContainer('nginx', { + image: ecs.ContainerImage.fromRegistry('nginx'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.firelens({ + options: { + Name: 'cloudwatch', + region: stack.region, + log_group_name: 'ecs-integ-test', + auto_create_group: 'true', + log_stream_prefix: 'nginx', + }, + }), +}); +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +// Create a security group that allows tcp @ port 80 +const securityGroup = new ec2.SecurityGroup(stack, 'websvc-sg', { vpc }); +securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(80)); +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, + securityGroup, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZmlyZWxlbnMtczMtY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZmlyZWxlbnMtczMtY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQyx1REFBdUQ7QUFDdkQsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGVBQWUsQ0FBQyxDQUFDO0FBQ2xELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFDckQsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FBQyxDQUFDO0FBQzlELE9BQU8sQ0FBQyxXQUFX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GNoJyxcbiAgICAgIHJlZ2lvbjogc3RhY2sucmVnaW9uLFxuICAgICAgbG9nX2dyb3VwX25hbWU6ICdlY3MtaW50ZWctdGVzdCcsXG4gICAgICBhdXRvX2NyZWF0ZV9ncm91cDogJ3RydWUnLFxuICAgICAgbG9nX3N0cmVhbV9wcmVmaXg6ICduZ2lueCcsXG4gICAgfSxcbiAgfSksXG59KTtcblxuY29udGFpbmVyLmFkZFBvcnRNYXBwaW5ncyh7XG4gIGNvbnRhaW5lclBvcnQ6IDgwLFxuICBwcm90b2NvbDogZWNzLlByb3RvY29sLlRDUCxcbn0pO1xuXG4vLyBDcmVhdGUgYSBzZWN1cml0eSBncm91cCB0aGF0IGFsbG93cyB0Y3AgQCBwb3J0IDgwXG5jb25zdCBzZWN1cml0eUdyb3VwID0gbmV3IGVjMi5TZWN1cml0eUdyb3VwKHN0YWNrLCAnd2Vic3ZjLXNnJywgeyB2cGMgfSk7XG5zZWN1cml0eUdyb3VwLmFkZEluZ3Jlc3NSdWxlKGVjMi5QZWVyLmFueUlwdjQoKSwgZWMyLlBvcnQudGNwKDgwKSk7XG5uZXcgZWNzLkVjMlNlcnZpY2Uoc3RhY2ssICdTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICB0YXNrRGVmaW5pdGlvbixcbiAgc2VjdXJpdHlHcm91cCxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/asset.2ca891b3a73a4a36630bba20580e3390a104d2ac9ff1f22a6bcadf575f8a5a61.conf b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/asset.2ca891b3a73a4a36630bba20580e3390a104d2ac9ff1f22a6bcadf575f8a5a61.conf similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/asset.2ca891b3a73a4a36630bba20580e3390a104d2ac9ff1f22a6bcadf575f8a5a61.conf rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/asset.2ca891b3a73a4a36630bba20580e3390a104d2ac9ff1f22a6bcadf575f8a5a61.conf diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.capacity-provider.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.ts similarity index 91% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.ts index 3ac9d46ba6d6e..90e5475218fd6 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.firelens-s3-config.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js new file mode 100644 index 0000000000000..854617901d10f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('graviton-cluster', { + minCapacity: 2, + instanceType: new ec2.InstanceType('c6g.large'), + machineImageType: ecs.MachineImageType.BOTTLEROCKET, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3Jhdml0b24tYm90dGxlcm9ja2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ3Jhdml0b24tYm90dGxlcm9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ayhhcHAsICdhd3MtZWNzLWludGVnJyk7XG5cbmNvbnN0IHZwYyA9IG5ldyBlYzIuVnBjKHN0YWNrLCAnVnBjJywgeyBtYXhBenM6IDIgfSk7XG5jb25zdCBjbHVzdGVyID0gbmV3IGVjcy5DbHVzdGVyKHN0YWNrLCAnRWNzQ2x1c3RlcicsIHsgdnBjIH0pO1xuXG5jbHVzdGVyLmFkZENhcGFjaXR5KCdncmF2aXRvbi1jbHVzdGVyJywge1xuICBtaW5DYXBhY2l0eTogMixcbiAgaW5zdGFuY2VUeXBlOiBuZXcgZWMyLkluc3RhbmNlVHlwZSgnYzZnLmxhcmdlJyksXG4gIG1hY2hpbmVJbWFnZVR5cGU6IGVjcy5NYWNoaW5lSW1hZ2VUeXBlLkJPVFRMRVJPQ0tFVCxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.clb-host-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.ts similarity index 75% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.ts index 5b8ecdca4fd0b..7f5fc96365ec6 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton-bottlerocket.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js new file mode 100644 index 0000000000000..0d0725b81f3b7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('graviton-cluster', { + minCapacity: 2, + instanceType: new ec2.InstanceType('c6g.large'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3Jhdml0b24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5ncmF2aXRvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZUFBZSxDQUFDLENBQUM7QUFFbEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUNyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFFOUQsT0FBTyxDQUFDLFdBQVcsQ0FBQyxrQkFBa0IsRUFBRTtJQUN0QyxXQUFXLEVBQUUsQ0FBQztJQUNkLFlBQVksRUFBRSxJQUFJLEdBQUcsQ0FBQyxZQUFZLENBQUMsV0FBVyxDQUFDO0lBQy9DLFlBQVksRUFBRSxHQUFHLENBQUMsaUJBQWlCLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsR0FBRyxDQUFDO0NBQzFFLENBQUMsQ0FBQztBQUNILEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCAqIGFzIGVjMiBmcm9tICdhd3MtY2RrLWxpYi9hd3MtZWMyJztcbmltcG9ydCAqIGFzIGNkayBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgKiBhcyBlY3MgZnJvbSAnYXdzLWNkay1saWIvYXdzLWVjcyc7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBjZGsuU3RhY2soYXBwLCAnYXdzLWVjcy1pbnRlZycpO1xuXG5jb25zdCB2cGMgPSBuZXcgZWMyLlZwYyhzdGFjaywgJ1ZwYycsIHsgbWF4QXpzOiAyIH0pO1xuY29uc3QgY2x1c3RlciA9IG5ldyBlY3MuQ2x1c3RlcihzdGFjaywgJ0Vjc0NsdXN0ZXInLCB7IHZwYyB9KTtcblxuY2x1c3Rlci5hZGRDYXBhY2l0eSgnZ3Jhdml0b24tY2x1c3RlcicsIHtcbiAgbWluQ2FwYWNpdHk6IDIsXG4gIGluc3RhbmNlVHlwZTogbmV3IGVjMi5JbnN0YW5jZVR5cGUoJ2M2Zy5sYXJnZScpLFxuICBtYWNoaW5lSW1hZ2U6IGVjcy5FY3NPcHRpbWl6ZWRJbWFnZS5hbWF6b25MaW51eDIoZWNzLkFtaUhhcmR3YXJlVHlwZS5BUk0pLFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.app-mesh-proxy-config.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.ts similarity index 76% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.ts index 4ca63a18a2262..d18bdc5dd7c29 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.graviton.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js new file mode 100644 index 0000000000000..0f9f03c880bbf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +const service = new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('PublicListener', { port: 80, open: true }); +listener.addTargets('ECS', { + port: 80, + targets: [service], +}); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGItYXdzdnBjLW53LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGItYXdzdnBjLW53LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLGdFQUFnRTtBQUNoRSxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQ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GVuZXIoJ1B1YmxpY0xpc3RlbmVyJywgeyBwb3J0OiA4MCwgb3BlbjogdHJ1ZSB9KTtcbmxpc3RlbmVyLmFkZFRhcmdldHMoJ0VDUycsIHtcbiAgcG9ydDogODAsXG4gIHRhcmdldHM6IFtzZXJ2aWNlXSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0xvYWRCYWxhbmNlckROUycsIHsgdmFsdWU6IGxiLmxvYWRCYWxhbmNlckRuc05hbWUgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.cloudmap-container-port.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts new file mode 100644 index 0000000000000..0f1b0ffc45ec0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts @@ -0,0 +1,44 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); + +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); + +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); + +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); + +const service = new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); + +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('PublicListener', { port: 80, open: true }); +listener.addTargets('ECS', { + port: 80, + targets: [service], +}); + +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js new file mode 100644 index 0000000000000..0bb8b2558c679 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { +// networkMode defaults to "bridge" +// memoryMiB: '1GB', +// cpu: '512' +}); +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +container.addPortMappings({ + containerPort: 80, + hostPort: 8080, + protocol: ecs.Protocol.TCP, +}); +const service = new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('PublicListener', { port: 80, open: true }); +listener.addTargets('ECS', { + port: 80, + targets: [service], +}); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGItYnJpZGdlLW53LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGItYnJpZGdlLW53LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsMkNBQTJDO0FBQzNDLGdFQUFnRTtBQUNoRSxtQ0FBbU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ydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG59KTtcblxuY29uc3QgbGIgPSBuZXcgZWxidjIuQXBwbGljYXRpb25Mb2FkQmFsYW5jZXIoc3RhY2ssICdMQicsIHsgdnBjLCBpbnRlcm5ldEZhY2luZzogdHJ1ZSB9KTtcbmNvbnN0IGxpc3RlbmVyID0gbGIuYWRkTGlzdGVuZXIoJ1B1YmxpY0xpc3RlbmVyJywgeyBwb3J0OiA4MCwgb3BlbjogdHJ1ZSB9KTtcbmxpc3RlbmVyLmFkZFRhcmdldHMoJ0VDUycsIHtcbiAgcG9ydDogODAsXG4gIHRhcmdldHM6IFtzZXJ2aWNlXSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0xvYWRCYWxhbmNlckROUycsIHsgdmFsdWU6IGxiLmxvYWRCYWxhbmNlckRuc05hbWUgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.ts similarity index 85% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.ts index ffdde473871a4..06638e9bec9a4 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.lb-bridge-nw.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js new file mode 100644 index 0000000000000..f1a88fb150427 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +class EcsStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T2, ec2.InstanceSize.MICRO), + }); + const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); + taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, + }); + new ecs.Ec2Service(this, 'Test_Stack', { + cluster, + taskDefinition, + placementStrategies: [ + ecs.PlacementStrategy.packedByCpu(), + ecs.PlacementStrategy.packedByMemory(), + ], + }); + } +} +new EcsStack(app, 'aws-cdk-ecs-integration-test-stack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGxhY2VtZW50LXN0cmF0ZWdpZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wbGFjZW1lbnQtc3RyYXRlZ2llcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFFbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sUUFBUyxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQzlCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBc0I7UUFDOUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQ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yeUxpbWl0TWlCOiAyNTYsXG4gICAgfSk7XG5cbiAgICBuZXcgZWNzLkVjMlNlcnZpY2UodGhpcywgJ1Rlc3RfU3RhY2snLCB7XG4gICAgICBjbHVzdGVyLFxuICAgICAgdGFza0RlZmluaXRpb24sXG4gICAgICBwbGFjZW1lbnRTdHJhdGVnaWVzOiBbXG4gICAgICAgIGVjcy5QbGFjZW1lbnRTdHJhdGVneS5wYWNrZWRCeUNwdSgpLFxuICAgICAgICBlY3MuUGxhY2VtZW50U3RyYXRlZ3kucGFja2VkQnlNZW1vcnkoKSxcbiAgICAgIF0sXG4gICAgfSk7XG4gIH1cbn1cblxubmV3IEVjc1N0YWNrKGFwcCwgJ2F3cy1jZGstZWNzLWludGVncmF0aW9uLXRlc3Qtc3RhY2snKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/aws-cdk-ecs-integration-test-stack.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.firelens-s3-config.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.ts similarity index 88% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.ts index 56f4ecf001ba1..2833abbb2fe9a 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.placement-strategies.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as ecs from '../../lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js new file mode 100644 index 0000000000000..c65766f16de31 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-pseudo-terminal'); +// Create a cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, + pseudoTerminal: true, +}); +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +new integ.IntegTest(app, 'PseudoTerminal', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHNldWRvLXRlcm1pbmFsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucHNldWRvLXRlcm1pbmFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsK0JBQStCLENBQUMsQ0FBQztBQUVsRSxtQkFBbUI7QUFDbkIsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFDOUQsT0FBTyxDQUFDLFdBQV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of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/aws-ecs-integ-pseudo-terminal.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.ts new file mode 100644 index 0000000000000..36d2c503587c3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.pseudo-terminal.ts @@ -0,0 +1,35 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-pseudo-terminal'); + +// Create a cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); + +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); + +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, + pseudoTerminal: true, +}); + +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +new integ.IntegTest(app, 'PseudoTerminal', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js new file mode 100644 index 0000000000000..c917f49d995aa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +// Add Private DNS Namespace +const domainName = 'scorekeep.com'; +cluster.addDefaultCloudMapNamespace({ + name: domainName, +}); +// Create frontend service +const frontendTD = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); +const frontend = frontendTD.addContainer('frontend', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +frontend.addPortMappings({ + containerPort: 80, + hostPort: 80, + protocol: ecs.Protocol.TCP, +}); +new ecs.Ec2Service(stack, 'FrontendService', { + cluster, + taskDefinition: frontendTD, + cloudMapOptions: { + name: 'frontend', + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2QtYXdzdnBjLW53LmpzIiwic291cmNlUm9vdCI6IiIsIn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TtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/aws-ecs-integ-ecs.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton-bottlerocket.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts similarity index 88% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts index c59951fdf341d..9cfb34eba3362 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-awsvpc-nw.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js new file mode 100644 index 0000000000000..28dcf2c217877 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +// Add Private DNS Namespace +const domainName = 'scorekeep.com'; +cluster.addDefaultCloudMapNamespace({ + name: domainName, +}); +// Create frontend service +// default network mode is bridge +const frontendTD = new ecs.Ec2TaskDefinition(stack, 'frontendTD'); +const frontend = frontendTD.addContainer('frontend', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, +}); +frontend.addPortMappings({ + containerPort: 80, + hostPort: 80, + protocol: ecs.Protocol.TCP, +}); +new ecs.Ec2Service(stack, 'FrontendService', { + cluster, + taskDefinition: frontendTD, + cloudMapOptions: { + name: 'frontend', + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2QtYnJpZGdlLW53LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2QtYnJpZGdlLW53LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBRXRELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFFckQsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FBQyxDQUFDO0FBRTlELE9BQU8sQ0FBQyxXQUFXLENBQUMseUJBQXlCLEVBQUU7SUFDN0MsWUFBWSxFQUFFLElBQUksR0FBRyxDQUFDLFlBQVksQ0FBQyxVQUFVLENBQUM7Q0FDL0MsQ0FBQyxDQUFDO0FBRUgsNEJBQTRCO0FBQzVCLE1BQU0sVUFBVSxHQUFHLGVBQWUsQ0FBQztBQUNuQyxPQUFPLENBQUMsMkJBQTJCLENBQUM7SUFDbEMsSUFBSSxFQUFFLFVBQVU7Q0FDakIsQ0FBQyxDQUFDO0FBRUgsMEJBQTBCO0FBQzFCLGlDQUF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EQsXG4gIGNsb3VkTWFwT3B0aW9uczoge1xuICAgIG5hbWU6ICdmcm9udGVuZCcsXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/aws-ecs-integ-ecs.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.ts similarity index 88% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.ts index 3c719b1520499..5915611686839 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.sd-bridge-nw.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js new file mode 100644 index 0000000000000..2a3174a622ef9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-secret-json-field'); +const secret = new secretsmanager.Secret(stack, 'Secret', { + generateSecretString: { + generateStringKey: 'password', + secretStringTemplate: JSON.stringify({ username: 'user' }), + }, +}); +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, + secrets: { + PASSWORD: ecs.Secret.fromSecretsManager(secret, 'password'), + }, +}); +container.addSecret('APIKEY', ecs.Secret.fromSecretsManager(secret, 'apikey')); +new integ.IntegTest(app, 'aws-ecs-ec2-integ-secret-json-field', { + testCases: [stack], +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O1xuXG5jb25zdCB0YXNrRGVmaW5pdGlvbiA9IG5ldyBlY3MuRWMyVGFza0RlZmluaXRpb24oc3RhY2ssICdUYXNrRGVmJyk7XG5cbmNvbnN0IGNvbnRhaW5lciA9IHRhc2tEZWZpbml0aW9uLmFkZENvbnRhaW5lcignd2ViJywge1xuICBpbWFnZTogZWNzLkNvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG4gIG1lbW9yeUxpbWl0TWlCOiAyNTYsXG4gIHNlY3JldHM6IHtcbiAgICBQQVNTV09SRDogZWNzLlNlY3JldC5mcm9tU2VjcmV0c01hbmFnZXIoc2VjcmV0LCAncGFzc3dvcmQnKSxcbiAgfSxcbn0pO1xuXG5jb250YWluZXIuYWRkU2VjcmV0KCdBUElLRVknLCBlY3MuU2VjcmV0LmZyb21TZWNyZXRzTWFuYWdlcihzZWNyZXQsICdhcGlrZXknKSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnYXdzLWVjcy1lYzItaW50ZWctc2VjcmV0LWpzb24tZmllbGQnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/aws-ecs-integ-secret-json-field.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/awsecsec2integsecretjsonfieldDefaultTestDeployAssert5B8058F0.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.ts similarity index 79% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.ts index ef974361f8699..85fd426b47c6f 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.secret-json-field.ts @@ -1,7 +1,7 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-secret-json-field'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js new file mode 100644 index 0000000000000..cb6f9eaa36936 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-spot'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('asgSpot', { + maxCapacity: 2, + minCapacity: 2, + desiredCapacity: 2, + instanceType: new ec2.InstanceType('c5.xlarge'), + spotPrice: '0.0735', + spotInstanceDraining: true, +}); +cluster.addCapacity('asgOd', { + maxCapacity: 2, + minCapacity: 1, + desiredCapacity: 1, + instanceType: new ec2.InstanceType('t3.large'), +}); +const taskDefinition = new ecs.TaskDefinition(stack, 'Task', { + compatibility: ecs.Compatibility.EC2, +}); +taskDefinition.addContainer('PHP', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, +}).addPortMappings({ + containerPort: 80, +}); +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3BvdC1kcmFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNwb3QtZHJhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG9CQUFvQixDQUFDLENBQUM7QUFFdkQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFFOUQsT0FBTyxDQUFDLFdBQVcsQ0FBQyxTQUFTLEVBQUU7SUFDN0IsV0FBV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b24uYWRkQ29udGFpbmVyKCdQSFAnLCB7XG4gIGltYWdlOiBlY3MuQ29udGFpbmVySW1hZ2UuZnJvbVJlZ2lzdHJ5KCdhbWF6b24vYW1hem9uLWVjcy1zYW1wbGUnKSxcbiAgbWVtb3J5TGltaXRNaUI6IDUxMixcbn0pLmFkZFBvcnRNYXBwaW5ncyh7XG4gIGNvbnRhaW5lclBvcnQ6IDgwLFxufSk7XG5cbm5ldyBlY3MuRWMyU2VydmljZShzdGFjaywgJ1NlcnZpY2UnLCB7XG4gIGNsdXN0ZXIsXG4gIHRhc2tEZWZpbml0aW9uLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/aws-ecs-integ-spot.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-bridge-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.ts similarity index 88% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.ts index 69584f4d2f548..3b9236512f843 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.spot-drain.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-spot'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js new file mode 100644 index 0000000000000..7b976a5fd4cbc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const aws_ecs_1 = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +// ECS cluster to host EC2 task +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +// define task to run the container +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDefinition', { + networkMode: ecs.NetworkMode.AWS_VPC, +}); +// define linux parameters to enable swap +const linuxParameters = new aws_ecs_1.LinuxParameters(stack, 'LinuxParameters', { + maxSwap: cdk.Size.gibibytes(5), + swappiness: 90, +}); +// define container with linux parameters +new ecs.ContainerDefinition(stack, 'Container', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + linuxParameters, + memoryLimitMiB: 256, + taskDefinition, +}); +// define a service to run the task definition +new ecs.Ec2Service(stack, 'Service', { + cluster, + taskDefinition, +}); +new integ.IntegTest(app, 'SwapParametersTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3dhcC1wYXJhbWV0ZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3dhcC1wYXJhbWV0ZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsMkNBQTJDO0FBQzNDLGlEQUFzRDtBQUV0RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGVBQWUsQ0FBQyxDQUFDO0FBRWxELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFFckQsK0JBQStCO0FBQy9CLE1BQU0sT0FBTyxHQUFHLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsWUFBWSxFQUFFLEVBQUUsR0FBRyxFQUFFLENBQUMsQ0FBQztBQ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GRlZmluZSBsaW51eCBwYXJhbWV0ZXJzIHRvIGVuYWJsZSBzd2FwXG5jb25zdCBsaW51eFBhcmFtZXRlcnMgPSBuZXcgTGludXhQYXJhbWV0ZXJzKHN0YWNrLCAnTGludXhQYXJhbWV0ZXJzJywge1xuICBtYXhTd2FwOiBjZGsuU2l6ZS5naWJpYnl0ZXMoNSksXG4gIHN3YXBwaW5lc3M6IDkwLFxufSk7XG5cbi8vIGRlZmluZSBjb250YWluZXIgd2l0aCBsaW51eCBwYXJhbWV0ZXJzXG5uZXcgZWNzLkNvbnRhaW5lckRlZmluaXRpb24oc3RhY2ssICdDb250YWluZXInLCB7XG4gIGltYWdlOiBlY3MuQ29udGFpbmVySW1hZ2UuZnJvbVJlZ2lzdHJ5KCdhbWF6b24vYW1hem9uLWVjcy1zYW1wbGUnKSxcbiAgbGludXhQYXJhbWV0ZXJzLFxuICBtZW1vcnlMaW1pdE1pQjogMjU2LFxuICB0YXNrRGVmaW5pdGlvbixcbn0pO1xuXG4vLyBkZWZpbmUgYSBzZXJ2aWNlIHRvIHJ1biB0aGUgdGFzayBkZWZpbml0aW9uXG5uZXcgZWNzLkVjMlNlcnZpY2Uoc3RhY2ssICdTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICB0YXNrRGVmaW5pdGlvbixcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ1N3YXBQYXJhbWV0ZXJzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/SwapParametersTestDefaultTestDeployAssert4CDF4940.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.graviton.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.ts similarity index 82% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.ts index b736bafb78258..8ce6f726f7369 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/ec2/integ.swap-parameters.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; -import { LinuxParameters } from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import { LinuxParameters } from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js new file mode 100644 index 0000000000000..63bea21c00398 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 1024, + cpu: 512, +}); +// new container with firelens log driver, firelens log router will be created automatically. +const container = taskDefinition.addContainer('nginx', { + image: ecs.ContainerImage.fromRegistry('nginx'), +}); +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +// Create a security group that allows tcp @ port 80 +const securityGroup = new ec2.SecurityGroup(stack, 'websvc-sg', { vpc }); +securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(80)); +new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, + securityGroup, + assignPublicIp: true, +}); +container.addEnvironment('nameOne', 'valueOne'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWRkLWVudmlyb25tZW50LXZhcmlhYmxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYWRkLWVudmlyb25tZW50LXZhcmlhYmxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxlQUFlLENBQUMsQ0FBQztBQUNsRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBQ3JELE1BQU0sT0FBTyxHQUFHLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsZ0JBQWdCLEVB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gQ3JlYXRlIGEgc2VjdXJpdHkgZ3JvdXAgdGhhdCBhbGxvd3MgdGNwIEAgcG9ydCA4MFxuY29uc3Qgc2VjdXJpdHlHcm91cCA9IG5ldyBlYzIuU2VjdXJpdHlHcm91cChzdGFjaywgJ3dlYnN2Yy1zZycsIHsgdnBjIH0pO1xuc2VjdXJpdHlHcm91cC5hZGRJbmdyZXNzUnVsZShlYzIuUGVlci5hbnlJcHY0KCksIGVjMi5Qb3J0LnRjcCg4MCkpO1xubmV3IGVjcy5GYXJnYXRlU2VydmljZShzdGFjaywgJ1NlcnZpY2UnLCB7XG4gIGNsdXN0ZXIsXG4gIHRhc2tEZWZpbml0aW9uLFxuICBzZWN1cml0eUdyb3VwLFxuICBhc3NpZ25QdWJsaWNJcDogdHJ1ZSxcbn0pO1xuXG5jb250YWluZXIuYWRkRW52aXJvbm1lbnQoJ25hbWVPbmUnLCAndmFsdWVPbmUnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.placement-strategies.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.ts similarity index 88% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.ts index d42dc6bc98a58..91b2db1d3892f 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.add-environment-variable.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js new file mode 100644 index 0000000000000..0b19cb67d2fcf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-capacity-provider'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCPCluster', { + vpc, + capacityProviders: ['FARGATE', 'FARGATE_SPOT'], +}); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), +}); +new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + capacityProviderStrategies: [ + { + capacityProvider: 'FARGATE_SPOT', + weight: 2, + }, + { + capacityProvider: 'FARGATE', + weight: 1, + }, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FwYWNpdHktcHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2FwYWNpdHktcHJvdmlkZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxpQ0FBaUMsQ0FBQyxDQUFDO0FBRXBFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFFckQsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxrQkFBa0IsRUFBRTtJQUN6RCxHQUFHO0lBQ0gsaUJBQWlCLEVBQUUsQ0FBQyxTQUFTLEVBQUUsY0FBYyxDQUFDO0NBQy9DLENBQUMsQ0FBQztBQUVILE1BQU0sY0FBYyxHQUFHLEl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uICBjYXBhY2l0eVByb3ZpZGVyczogWydGQVJHQVRFJywgJ0ZBUkdBVEVfU1BPVCddLFxufSk7XG5cbmNvbnN0IHRhc2tEZWZpbml0aW9uID0gbmV3IGVjcy5GYXJnYXRlVGFza0RlZmluaXRpb24oc3RhY2ssICdUYXNrRGVmJyk7XG5cbnRhc2tEZWZpbml0aW9uLmFkZENvbnRhaW5lcignd2ViJywge1xuICBpbWFnZTogZWNzLkNvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgnYW1hem9uL2FtYXpvbi1lY3Mtc2FtcGxlJyksXG59KTtcblxubmV3IGVjcy5GYXJnYXRlU2VydmljZShzdGFjaywgJ0ZhcmdhdGVTZXJ2aWNlJywge1xuICBjbHVzdGVyLFxuICB0YXNrRGVmaW5pdGlvbixcbiAgY2FwYWNpdHlQcm92aWRlclN0cmF0ZWdpZXM6IFtcbiAgICB7XG4gICAgICBjYXBhY2l0eVByb3ZpZGVyOiAnRkFSR0FURV9TUE9UJyxcbiAgICAgIHdlaWdodDogMixcbiAgICB9LFxuICAgIHtcbiAgICAgIGNhcGFjaXR5UHJvdmlkZXI6ICdGQVJHQVRFJyxcbiAgICAgIHdlaWdodDogMSxcbiAgICB9LFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuXG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/aws-ecs-integ-capacity-provider.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-awsvpc-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.ts similarity index 85% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.ts index 673b15284a577..e044dbf8142f4 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.capacity-providers.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-capacity-provider'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js new file mode 100644 index 0000000000000..d6c3c9593ed0e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const kms = require("aws-cdk-lib/aws-kms"); +const logs = require("aws-cdk-lib/aws-logs"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const kmsKey = new kms.Key(stack, 'KmsKey'); +const logGroup = new logs.LogGroup(stack, 'LogGroup', { + encryptionKey: kmsKey, +}); +const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { + encryptionKey: kmsKey, +}); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { + vpc, + executeCommandConfiguration: { + kmsKey, + logConfiguration: { + cloudWatchLogGroup: logGroup, + cloudWatchEncryptionEnabled: true, + s3Bucket: execBucket, + s3EncryptionEnabled: true, + s3KeyPrefix: 'exec-output', + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, +}); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: aws_cdk_lib_1.Duration.seconds(60), + timeout: aws_cdk_lib_1.Duration.seconds(40), + }, +}); +new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + enableExecuteCommand: true, +}); +new integ.IntegTest(app, 'exec-command-integ-test', { + testCases: [stack], + diffAssets: true, + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXhlYy1jb21tYW5kLmpzIiwic291cmNlU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biAgdGFza0RlZmluaXRpb24sXG4gIGVuYWJsZUV4ZWN1dGVDb21tYW5kOiB0cnVlLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnZXhlYy1jb21tYW5kLWludGVnLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbiAgZGlmZkFzc2V0czogdHJ1ZSxcbiAgY2RrQ29tbWFuZE9wdGlvbnM6IHtcbiAgICBkZXBsb3k6IHtcbiAgICAgIGFyZ3M6IHtcbiAgICAgICAgcm9sbGJhY2s6IHRydWUsXG4gICAgICB9LFxuICAgIH0sXG4gIH0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/aws-ecs-integ-exec-command.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.volume.ts.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/execcommandintegtestDefaultTestDeployAssert4F7706FE.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.ts new file mode 100644 index 0000000000000..4fcf184deb1f2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.exec-command.ts @@ -0,0 +1,67 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { Duration } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const kmsKey = new kms.Key(stack, 'KmsKey'); + +const logGroup = new logs.LogGroup(stack, 'LogGroup', { + encryptionKey: kmsKey, +}); + +const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { + encryptionKey: kmsKey, +}); + +const cluster = new ecs.Cluster(stack, 'FargateCluster', { + vpc, + executeCommandConfiguration: { + kmsKey, + logConfiguration: { + cloudWatchLogGroup: logGroup, + cloudWatchEncryptionEnabled: true, + s3Bucket: execBucket, + s3EncryptionEnabled: true, + s3KeyPrefix: 'exec-output', + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, +}); + +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); + +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + healthCheck: { + command: ['CMD-SHELL', 'curl localhost:8000'], + interval: Duration.seconds(60), + timeout: Duration.seconds(40), + }, +}); + +new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + enableExecuteCommand: true, +}); + +new integ.IntegTest(app, 'exec-command-integ-test', { + testCases: [stack], + diffAssets: true, + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js new file mode 100644 index 0000000000000..5127137fa77de --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const efs = require("aws-cdk-lib/aws-efs"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +class FargateWithEfsStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2 }); + const fs = new efs.FileSystem(this, 'etcdata', { + vpc: vpc, + }); + // Just need a TaskDefinition to test this + const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef'); + taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }); + taskDefinition.addVolume({ + name: 'somedata', + efsVolumeConfiguration: { + fileSystemId: fs.fileSystemId, + }, + }); + } +} +const app = new cdk.App(); +new FargateWithEfsStack(app, 'aws-ecs-fargate-efs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZmFyZ2F0ZS13aXRoLWVmcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmZhcmdhdGUtd2l0aC1lZnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUVuQywyQ0FBMkM7QUFHM0MsTUFBTSxtQkFBb0IsU0FBUSxHQUFHLENBQUMsS0FBSztJQUN6QyxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQXNCO1FBQzlELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7UUFFcEQsTUFBTSxFQUFFLEdBQUcsSUFBSSxHQUFHLENBQUMsVUFBVSxDQUFDLElBQUksRUFBRSxTQUFTLEVBQUU7WUFDN0MsR0FBRyxFQUFFLEdBQUc7U0FDVCxDQUFDLENBQUM7UUFFSCwwQ0FBMEM7UUFDMUMsTUFBTSxjQUFjLEdBQUc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KHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgY29uc3QgdnBjID0gbmV3IGVjMi5WcGModGhpcywgJ1ZwYycsIHsgbWF4QXpzOiAyIH0pO1xuXG4gICAgY29uc3QgZnMgPSBuZXcgZWZzLkZpbGVTeXN0ZW0odGhpcywgJ2V0Y2RhdGEnLCB7XG4gICAgICB2cGM6IHZwYyxcbiAgICB9KTtcblxuICAgIC8vIEp1c3QgbmVlZCBhIFRhc2tEZWZpbml0aW9uIHRvIHRlc3QgdGhpc1xuICAgIGNvbnN0IHRhc2tEZWZpbml0aW9uID0gbmV3IGVjcy5GYXJnYXRlVGFza0RlZmluaXRpb24odGhpcywgJ1Rhc2tEZWYnKTtcbiAgICB0YXNrRGVmaW5pdGlvbi5hZGRDb250YWluZXIoJ3dlYicsIHtcbiAgICAgIGltYWdlOiBlY3MuQ29udGFpbmVySW1hZ2UuZnJvbVJlZ2lzdHJ5KCdhbWF6b24vYW1hem9uLWVjcy1zYW1wbGUnKSxcbiAgICB9KTtcbiAgICB0YXNrRGVmaW5pdGlvbi5hZGRWb2x1bWUoe1xuICAgICAgbmFtZTogJ3NvbWVkYXRhJyxcbiAgICAgIGVmc1ZvbHVtZUNvbmZpZ3VyYXRpb246IHtcbiAgICAgICAgZmlsZVN5c3RlbUlkOiBmcy5maWxlU3lzdGVtSWQsXG4gICAgICB9LFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5uZXcgRmFyZ2F0ZVdpdGhFZnNTdGFjayhhcHAsICdhd3MtZWNzLWZhcmdhdGUtZWZzJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/aws-ecs-fargate-efs.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.sd-bridge-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.ts similarity index 82% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.ts index eebb5a8f70119..744d44aef6f2a 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.fargate-with-efs.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as efs from 'aws-cdk-lib/aws-efs'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as ecs from '../../lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; class FargateWithEfsStack extends cdk.Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js new file mode 100644 index 0000000000000..89350fc05c892 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 1024, + cpu: 512, +}); +// new container with firelens log driver, firelens log router will be created automatically. +const container = taskDefinition.addContainer('nginx', { + image: ecs.ContainerImage.fromRegistry('nginx'), + logging: ecs.LogDrivers.firelens({ + options: { + Name: 'cloudwatch', + region: stack.region, + log_group_name: 'ecs-integ-test', + auto_create_group: 'true', + log_stream_prefix: 'nginx', + }, + }), +}); +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +// Create a security group that allows tcp @ port 80 +const securityGroup = new ec2.SecurityGroup(stack, 'websvc-sg', { vpc }); +securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(80)); +new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, + securityGroup, + assignPublicIp: true, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZmlyZWxlbnMtY2xvdWR3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SBzZWN1cml0eSBncm91cCB0aGF0IGFsbG93cyB0Y3AgQCBwb3J0IDgwXG5jb25zdCBzZWN1cml0eUdyb3VwID0gbmV3IGVjMi5TZWN1cml0eUdyb3VwKHN0YWNrLCAnd2Vic3ZjLXNnJywgeyB2cGMgfSk7XG5zZWN1cml0eUdyb3VwLmFkZEluZ3Jlc3NSdWxlKGVjMi5QZWVyLmFueUlwdjQoKSwgZWMyLlBvcnQudGNwKDgwKSk7XG5uZXcgZWNzLkZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnU2VydmljZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb24sXG4gIHNlY3VyaXR5R3JvdXAsXG4gIGFzc2lnblB1YmxpY0lwOiB0cnVlLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.spot-drain.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.ts similarity index 90% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.ts index ba7602944bd06..e1e97e8176e8b 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.firelens-cloudwatch.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js new file mode 100644 index 0000000000000..573460502a33a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 1024, + cpu: 512, +}); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + portMappings: [{ + containerPort: 80, + protocol: ecs.Protocol.TCP, + }], +}); +const service = new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, +}); +const scaling = service.autoScaleTaskCount({ maxCapacity: 10 }); +// Quite low to try and force it to scale +scaling.scaleOnCpuUtilization('ReasonableCpu', { targetUtilizationPercent: 10 }); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('PublicListener', { port: 80, open: true }); +listener.addTargets('Fargate', { + port: 80, + targets: [service], +}); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGItYXdzdnBjLW53LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGItYXdzdnBjLW53LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLGdFQUFnRTtBQUNoRSxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZUFBZSxDQUFDLENBQUM7QUFFbEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNL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RzKCdGYXJnYXRlJywge1xuICBwb3J0OiA4MCxcbiAgdGFyZ2V0czogW3NlcnZpY2VdLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnTG9hZEJhbGFuY2VyRE5TJywgeyB2YWx1ZTogbGIubG9hZEJhbGFuY2VyRG5zTmFtZSB9KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.add-environment-variable.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts new file mode 100644 index 0000000000000..ac21b60705ba5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts @@ -0,0 +1,44 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); + +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 1024, + cpu: 512, +}); + +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + portMappings: [{ + containerPort: 80, + protocol: ecs.Protocol.TCP, + }], +}); + +const service = new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, +}); + +const scaling = service.autoScaleTaskCount({ maxCapacity: 10 }); +// Quite low to try and force it to scale +scaling.scaleOnCpuUtilization('ReasonableCpu', { targetUtilizationPercent: 10 }); + +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('PublicListener', { port: 80, open: true }); +listener.addTargets('Fargate', { + port: 80, + targets: [service], +}); + +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js new file mode 100644 index 0000000000000..b3076507f6ec5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 1024, + cpu: 512, +}); +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), +}); +container.addPortMappings({ + containerPort: 80, + protocol: ecs.Protocol.TCP, +}); +const service = new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, +}); +const scaling = service.autoScaleTaskCount({ maxCapacity: 10 }); +// Quite low to try and force it to scale +scaling.scaleOnCpuUtilization('ReasonableCpu', { targetUtilizationPercent: 10 }); +const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('PublicListener', { port: 80 }); +service.registerLoadBalancerTargets({ + containerName: 'web', + containerPort: 80, + listener: ecs.ListenerConfig.networkListener(listener), + newTargetGroupId: 'ECS', +}); +new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmxiLWF3c3ZwYy1udy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm5sYi1hd3N2cGMtbncudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsZ0VBQWdFO0FBQ2hFLG1DQUFtQztBQUNuQywyQ0FB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LyBRdWl0ZSBsb3cgdG8gdHJ5IGFuZCBmb3JjZSBpdCB0byBzY2FsZVxuc2NhbGluZy5zY2FsZU9uQ3B1VXRpbGl6YXRpb24oJ1JlYXNvbmFibGVDcHUnLCB7IHRhcmdldFV0aWxpemF0aW9uUGVyY2VudDogMTAgfSk7XG5cbmNvbnN0IGxiID0gbmV3IGVsYnYyLk5ldHdvcmtMb2FkQmFsYW5jZXIoc3RhY2ssICdMQicsIHsgdnBjLCBpbnRlcm5ldEZhY2luZzogdHJ1ZSB9KTtcbmNvbnN0IGxpc3RlbmVyID0gbGIuYWRkTGlzdGVuZXIoJ1B1YmxpY0xpc3RlbmVyJywgeyBwb3J0OiA4MCB9KTtcblxuc2VydmljZS5yZWdpc3RlckxvYWRCYWxhbmNlclRhcmdldHMoXG4gIHtcbiAgICBjb250YWluZXJOYW1lOiAnd2ViJyxcbiAgICBjb250YWluZXJQb3J0OiA4MCxcbiAgICBsaXN0ZW5lcjogZWNzLkxpc3RlbmVyQ29uZmlnLm5ldHdvcmtMaXN0ZW5lcihsaXN0ZW5lciksXG4gICAgbmV3VGFyZ2V0R3JvdXBJZDogJ0VDUycsXG4gIH0sXG4pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ0xvYWRCYWxhbmNlckROUycsIHsgdmFsdWU6IGxiLmxvYWRCYWxhbmNlckRuc05hbWUgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/aws-ecs-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.capacity-providers.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.ts similarity index 86% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.ts index de5a1bdb7acf6..c5d1f249f1e31 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js new file mode 100644 index 0000000000000..bb07e9b79be08 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-pseudo-terminal'); +// Create a cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + cpu: 256, + memoryLimitMiB: 512, +}); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + cpu: 256, + pseudoTerminal: true, +}); +new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, +}); +new integ.IntegTest(app, 'PseudoTerminal', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHNldWRvLXRlcm1pbmFsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucHNldWRvLXRlcm1pbmFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUF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ge1xuICBjbHVzdGVyLFxuICB0YXNrRGVmaW5pdGlvbixcbn0pO1xubmV3IGludGVnLkludGVnVGVzdChhcHAsICdQc2V1ZG9UZXJtaW5hbCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/PseudoTerminalDefaultTestDeployAssert1B88B826.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ-pseudo-terminal.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.ts new file mode 100644 index 0000000000000..56468cde68d14 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.pseudo-terminal.ts @@ -0,0 +1,32 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-pseudo-terminal'); + +// Create a cluster +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + cpu: 256, + memoryLimitMiB: 512, +}); +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + cpu: 256, + pseudoTerminal: true, +}); + +new ecs.FargateService(stack, 'Service', { + cluster, + taskDefinition, +}); +new integ.IntegTest(app, 'PseudoTerminal', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js new file mode 100644 index 0000000000000..b3cab9cd27c7a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-runtime'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const cluster = new ecs.Cluster(stack, 'FargateCluster', { + vpc, +}); +const taskDefinitionwindows = new ecs.FargateTaskDefinition(stack, 'TaskDefWindows', { + runtimePlatform: { + operatingSystemFamily: ecs.OperatingSystemFamily.WINDOWS_SERVER_2019_CORE, + cpuArchitecture: ecs.CpuArchitecture.X86_64, + }, + cpu: 1024, + memoryLimitMiB: 2048, +}); +const taskDefinitiongraviton2 = new ecs.FargateTaskDefinition(stack, 'TaskDefGraviton2', { + runtimePlatform: { + operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, + cpuArchitecture: ecs.CpuArchitecture.ARM64, + }, + cpu: 256, + memoryLimitMiB: 1024, +}); +taskDefinitionwindows.addContainer('windowsservercore', { + logging: ecs.LogDriver.awsLogs({ streamPrefix: 'win-iis-on-fargate' }), + portMappings: [{ containerPort: 80 }], + image: ecs.ContainerImage.fromRegistry('mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019'), +}); +taskDefinitiongraviton2.addContainer('webarm64', { + logging: ecs.LogDriver.awsLogs({ streamPrefix: 'graviton2-on-fargate' }), + portMappings: [{ containerPort: 80 }], + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:latest-arm64v8'), +}); +new ecs.FargateService(stack, 'FargateServiceWindowsRuntime', { + cluster, + taskDefinition: taskDefinitionwindows, +}); +new ecs.FargateService(stack, 'FargateServiceGraviton2Runtime', { + cluster, + taskDefinition: taskDefinitiongraviton2, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVudGltZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJ1bnRpbWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHVCQUF1QixDQUFDLENBQUM7QUFFMUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUdyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFO0lBQ3ZELEdBQUc7Q0FDSixDQUFDLENBQUM7QUFFSCxNQUFNLHFCQUFxQixHQUFHLElBQUksR0FBRyxDQUFDLHFCQUFxQixDQUFDLEtBQUssRUFBRSxnQkFBZ0IsRUFBRTtJQUNuRixlQUFlLEVBQUU7UUFDZixxQkFBcUIsRUFBRSxHQUFHLENBQUMscUJBQXFCLEN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NMb2dzKHsgc3RyZWFtUHJlZml4OiAnZ3Jhdml0b24yLW9uLWZhcmdhdGUnIH0pLFxuICBwb3J0TWFwcGluZ3M6IFt7IGNvbnRhaW5lclBvcnQ6IDgwIH1dLFxuICBpbWFnZTogZWNzLkNvbnRhaW5lckltYWdlLmZyb21SZWdpc3RyeSgncHVibGljLmVjci5hd3Mvbmdpbngvbmdpbng6bGF0ZXN0LWFybTY0djgnKSxcbn0pO1xuXG5uZXcgZWNzLkZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnRmFyZ2F0ZVNlcnZpY2VXaW5kb3dzUnVudGltZScsIHtcbiAgY2x1c3RlcixcbiAgdGFza0RlZmluaXRpb246IHRhc2tEZWZpbml0aW9ud2luZG93cyxcbn0pO1xuXG5uZXcgZWNzLkZhcmdhdGVTZXJ2aWNlKHN0YWNrLCAnRmFyZ2F0ZVNlcnZpY2VHcmF2aXRvbjJSdW50aW1lJywge1xuICBjbHVzdGVyLFxuICB0YXNrRGVmaW5pdGlvbjogdGFza0RlZmluaXRpb25ncmF2aXRvbjIsXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/aws-ecs-integ-runtime.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.fargate-with-efs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.ts similarity index 92% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.ts index 2fa66c3de43f7..096f1d804ac7c 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.runtime.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-runtime'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js new file mode 100644 index 0000000000000..959a2f7f548bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-secret'); +const secret = new secretsmanager.Secret(stack, 'Secret', { + generateSecretString: { + generateStringKey: 'password', + secretStringTemplate: JSON.stringify({ username: 'user' }), + }, +}); +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +const container = taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + secrets: { + SECRET: ecs.Secret.fromSecretsManager(secret), + PASSWORD: ecs.Secret.fromSecretsManager(secret, 'password'), + }, +}); +container.addSecret('APIKEY', ecs.Secret.fromSecretsManager(secret, 'apikey')); +new integ.IntegTest(app, 'aws-ecs-fargate-integ-secret', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VjcmV0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2VjcmV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaUVBQWlFO0FBQ2pFLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztBQUV6RCxNQUFNLE1BQU0sR0FBRyxJQUFJLGNBQWMsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFFBQVEsRUFBRTtJQUN4RCxvQkFBb0IsRUFBRTtRQUNwQixpQkFBaUIsRUFBRSxVQUFVO1FBQzdCLG9CQUFvQixFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLENBQUM7S0FDM0Q7Q0FDRixDQUFDLENBQUM7QUFFSCxNQUFNLGNBQWMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxxQkFBcUIsQ0FBQyxLQUFLLEVBQUU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ay5TdGFjayhhcHAsICdhd3MtZWNzLWludGVnLXNlY3JldCcpO1xuXG5jb25zdCBzZWNyZXQgPSBuZXcgc2VjcmV0c21hbmFnZXIuU2VjcmV0KHN0YWNrLCAnU2VjcmV0Jywge1xuICBnZW5lcmF0ZVNlY3JldFN0cmluZzoge1xuICAgIGdlbmVyYXRlU3RyaW5nS2V5OiAncGFzc3dvcmQnLFxuICAgIHNlY3JldFN0cmluZ1RlbXBsYXRlOiBKU09OLnN0cmluZ2lmeSh7IHVzZXJuYW1lOiAndXNlcicgfSksXG4gIH0sXG59KTtcblxuY29uc3QgdGFza0RlZmluaXRpb24gPSBuZXcgZWNzLkZhcmdhdGVUYXNrRGVmaW5pdGlvbihzdGFjaywgJ1Rhc2tEZWYnKTtcblxuY29uc3QgY29udGFpbmVyID0gdGFza0RlZmluaXRpb24uYWRkQ29udGFpbmVyKCd3ZWInLCB7XG4gIGltYWdlOiBlY3MuQ29udGFpbmVySW1hZ2UuZnJvbVJlZ2lzdHJ5KCdhbWF6b24vYW1hem9uLWVjcy1zYW1wbGUnKSxcbiAgc2VjcmV0czoge1xuICAgIFNFQ1JFVDogZWNzLlNlY3JldC5mcm9tU2VjcmV0c01hbmFnZXIoc2VjcmV0KSxcbiAgICBQQVNTV09SRDogZWNzLlNlY3JldC5mcm9tU2VjcmV0c01hbmFnZXIoc2VjcmV0LCAncGFzc3dvcmQnKSxcbiAgfSxcbn0pO1xuXG5jb250YWluZXIuYWRkU2VjcmV0KCdBUElLRVknLCBlY3MuU2VjcmV0LmZyb21TZWNyZXRzTWFuYWdlcihzZWNyZXQsICdhcGlrZXknKSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnYXdzLWVjcy1mYXJnYXRlLWludGVnLXNlY3JldCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/aws-ecs-integ-secret.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/awsecsfargateintegsecretDefaultTestDeployAssert3A9C52E8.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.secret-json-field.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.ts similarity index 80% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.ts index 362fe03e6fe89..f52f6c27f151b 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.secret.ts @@ -1,7 +1,7 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ-secret'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js new file mode 100644 index 0000000000000..849de00857817 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ecs = require("aws-cdk-lib/aws-ecs"); +class ServiceConnect extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const cluster = new ecs.Cluster(this, 'EcsCluster', { + defaultCloudMapNamespace: { + name: 'scorekeep.com', + useForServiceConnect: true, + }, + }); + const td = new ecs.FargateTaskDefinition(this, 'TaskDef', { + cpu: 1024, + memoryLimitMiB: 2048, + }); + td.addContainer('container', { + containerName: 'web', + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + portMappings: [ + { + name: 'api', + containerPort: 80, + appProtocol: ecs.AppProtocol.http2, + }, + ], + logging: ecs.LogDrivers.awsLogs({ + streamPrefix: 'web', + }), + }); + new ecs.FargateService(this, 'svc', { + taskDefinition: td, + cluster: cluster, + serviceConnectConfiguration: { + services: [ + { + portMappingName: 'api', + dnsName: 'api', + port: 80, + }, + ], + logDriver: ecs.LogDrivers.awsLogs({ + streamPrefix: 'sc', + }), + }, + }); + } +} +const app = new cdk.App(); +const stack = new ServiceConnect(app, 'aws-ecs-service-connect'); +new integ.IntegTest(app, 'ServiceConnect', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmljZS1jb25uZWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2VydmljZS1jb25uZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUVwRCwyQ0FBMkM7QUFHM0MsTUFBTSxjQUFlLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDcEMsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM5RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUN4QixNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLFlBQVksRUFBRTtZQUNsRCx3QkFBd0IsRUFBRTtnQkFDeEIsSUFB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0RyaXZlcnMuYXdzTG9ncyh7XG4gICAgICAgICAgc3RyZWFtUHJlZml4OiAnc2MnLFxuICAgICAgICB9KSxcbiAgICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IFNlcnZpY2VDb25uZWN0KGFwcCwgJ2F3cy1lY3Mtc2VydmljZS1jb25uZWN0Jyk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnU2VydmljZUNvbm5lY3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.assets.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/aws-ecs-service-connect.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.swap-parameters.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.ts similarity index 91% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.ts index 391781f42ce89..94e061ad6170e 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.ts @@ -1,7 +1,7 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as ecs from '../../lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; class ServiceConnect extends cdk.Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js new file mode 100644 index 0000000000000..9750a84836ea8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +// eslint-disable-next-line import/no-extraneous-dependencies +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_efs_1 = require("aws-cdk-lib/aws-efs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'test-efs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 3, natGateways: 1 }); +const myFileSystemPolicy = new aws_iam_1.PolicyDocument({ + statements: [new aws_iam_1.PolicyStatement({ + actions: [ + 'elasticfilesystem:ClientWrite', + 'elasticfilesystem:ClientMount', + ], + principals: [new aws_iam_1.AccountRootPrincipal()], + resources: ['*'], + conditions: { + Bool: { + 'elasticfilesystem:AccessedViaMountTarget': 'true', + }, + }, + })], +}); +const fileSystem = new aws_efs_1.FileSystem(stack, 'FileSystem', { + vpc, + fileSystemPolicy: myFileSystemPolicy, +}); +fileSystem.addToResourcePolicy(new aws_iam_1.PolicyStatement({ + actions: [ + 'elasticfilesystem:ClientRootAccess', + ], + principals: [new aws_iam_1.AccountRootPrincipal()], + resources: ['*'], + conditions: { + Bool: { + 'elasticfilesystem:AccessedViaMountTarget': 'true', + }, + }, +})); +const accessPoint = new aws_efs_1.AccessPoint(stack, 'AccessPoint', { + fileSystem, +}); +cdk.Tags.of(accessPoint).add('Name', 'MyAccessPoint'); +new integ.IntegTest(app, 'FileSystemPolicyTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,e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uICB2cGMsXG4gIGZpbGVTeXN0ZW1Qb2xpY3k6IG15RmlsZVN5c3RlbVBvbGljeSxcbn0pO1xuZmlsZVN5c3RlbS5hZGRUb1Jlc291cmNlUG9saWN5KG5ldyBQb2xpY3lTdGF0ZW1lbnQoe1xuICBhY3Rpb25zOiBbXG4gICAgJ2VsYXN0aWNmaWxlc3lzdGVtOkNsaWVudFJvb3RBY2Nlc3MnLFxuICBdLFxuICBwcmluY2lwYWxzOiBbbmV3IEFjY291bnRSb290UHJpbmNpcGFsKCldLFxuICByZXNvdXJjZXM6IFsnKiddLFxuICBjb25kaXRpb25zOiB7XG4gICAgQm9vbDoge1xuICAgICAgJ2VsYXN0aWNmaWxlc3lzdGVtOkFjY2Vzc2VkVmlhTW91bnRUYXJnZXQnOiAndHJ1ZScsXG4gICAgfSxcbiAgfSxcbn0pKTtcblxuY29uc3QgYWNjZXNzUG9pbnQgPSBuZXcgQWNjZXNzUG9pbnQoc3RhY2ssICdBY2Nlc3NQb2ludCcsIHtcbiAgZmlsZVN5c3RlbSxcbn0pO1xuY2RrLlRhZ3Mub2YoYWNjZXNzUG9pbnQpLmFkZCgnTmFtZScsICdNeUFjY2Vzc1BvaW50Jyk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnRmlsZVN5c3RlbVBvbGljeVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.assets.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.template.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/FileSystemPolicyTestDefaultTestDeployAssertD0596FC1.template.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.assets.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/test-efs-integ.template.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.ts similarity index 84% rename from packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.ts index e6dd549fd2d4a..a39b5f6a6c021 100644 --- a/packages/@aws-cdk/aws-efs/test/integ.efs-filesystem-policy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs-filesystem-policy.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { AccountRootPrincipal, PolicyDocument, PolicyStatement } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { AccountRootPrincipal, PolicyDocument, PolicyStatement } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; // eslint-disable-next-line import/no-extraneous-dependencies -import * as integ from '@aws-cdk/integ-tests'; -import { AccessPoint, FileSystem } from '../lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { AccessPoint, FileSystem } from 'aws-cdk-lib/aws-efs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'test-efs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js new file mode 100644 index 0000000000000..8fa4db1c8baec --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const aws_efs_1 = require("aws-cdk-lib/aws-efs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'test-efs-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 3, natGateways: 1 }); +const fileSystem = new aws_efs_1.FileSystem(stack, 'FileSystem', { + vpc, +}); +fileSystem.addAccessPoint('AccessPoint', { + createAcl: { + ownerGid: '1000', + ownerUid: '1000', + permissions: '755', + }, + path: '/custom-path', + posixUser: { + gid: '1000', + uid: '1000', + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWZzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZWZzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxpREFBaUQ7QUFFakQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO0FBRW5ELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxXQUFXLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRSxNQUFNLFVBQVUsR0FBRyxJQUFJLG9CQUFVLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRTtJQUNyRCxHQUFHO0NBQ0osQ0FBQyxDQUFDO0FBRUgsVUFBVSxDQUFDLGNBQWMsQ0FBQyxhQUFhLEVBQUU7SUFDdkMsU0FBUyxFQUFFO1FBQ1QsUUFBUSxFQUFFLE1BQU07UUFDaEIsUUFBUSxFQUFFLE1BQU07UUFDaEIsV0FBVyxFQUFFLEtBQUs7S0FDbkI7SUFDRCxJQUFJLEVBQUUsY0FBYztJQUNwQixTQUFTLEVBQUU7UUFDVCxHQUFHLEVBQUUsTUFBTTtRQUNYLEdBQUcsRUFBRSxNQUFNO0tBQ1o7Q0FDRixDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBlYzIgZnJvbSAnYXdzLWNkay1saWIvYXdzLWVjMic7XG5pbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgRmlsZVN5c3RlbSB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1lZnMnO1xuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ3Rlc3QtZWZzLWludGVnJyk7XG5cbmNvbnN0IHZwYyA9IG5ldyBlYzIuVnBjKHN0YWNrLCAnVnBjJywgeyBtYXhBenM6IDMsIG5hdEdhdGV3YXlzOiAxIH0pO1xuXG5jb25zdCBmaWxlU3lzdGVtID0gbmV3IEZpbGVTeXN0ZW0oc3RhY2ssICdGaWxlU3lzdGVtJywge1xuICB2cGMsXG59KTtcblxuZmlsZVN5c3RlbS5hZGRBY2Nlc3NQb2ludCgnQWNjZXNzUG9pbnQnLCB7XG4gIGNyZWF0ZUFjbDoge1xuICAgIG93bmVyR2lkOiAnMTAwMCcsXG4gICAgb3duZXJVaWQ6ICcxMDAwJyxcbiAgICBwZXJtaXNzaW9uczogJzc1NScsXG4gIH0sXG4gIHBhdGg6ICcvY3VzdG9tLXBhdGgnLFxuICBwb3NpeFVzZXI6IHtcbiAgICBnaWQ6ICcxMDAwJyxcbiAgICB1aWQ6ICcxMDAwJyxcbiAgfSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.assets.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/test-efs-integ.template.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-efs/test/integ.efs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-efs/test/integ.efs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.ts similarity index 76% rename from packages/@aws-cdk/aws-efs/test/integ.efs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.ts index 595dd40d48aa2..961ff36a51e1c 100644 --- a/packages/@aws-cdk/aws-efs/test/integ.efs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-efs/test/integ.efs.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { FileSystem } from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { FileSystem } from 'aws-cdk-lib/aws-efs'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'test-efs-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.d.ts new file mode 100644 index 0000000000000..7cbc08b6feae4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.d.ts @@ -0,0 +1,11 @@ +import { Duration } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +export interface BucketPingerProps { + readonly bucketName: string; + readonly timeout?: Duration; +} +export declare class BucketPinger extends Construct { + private _resource; + constructor(scope: Construct, id: string, props: BucketPingerProps); + get response(): string; +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.js new file mode 100644 index 0000000000000..402f8301d070d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BucketPinger = void 0; +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cr = require("aws-cdk-lib/custom-resources"); +const constructs_1 = require("constructs"); +class BucketPinger extends constructs_1.Construct { + constructor(scope, id, props) { + super(scope, id); + const func = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(`${__dirname}/function`), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + timeout: props.timeout ?? aws_cdk_lib_1.Duration.minutes(1), + environment: { + BUCKET_NAME: props.bucketName, + }, + }); + if (!func.role) { + throw new Error('pinger lambda has no execution role!'); + } + func.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['s3:DeleteBucket', 's3:ListBucket'], + resources: [`arn:aws:s3:::${props.bucketName}`], + })); + const provider = new cr.Provider(this, 'Provider', { + onEventHandler: func, + }); + this._resource = new aws_cdk_lib_1.CustomResource(this, 'Resource', { + serviceToken: provider.serviceToken, + }); + } + get response() { + return aws_cdk_lib_1.Token.asString(this._resource.getAtt('Value')); + } +} +exports.BucketPinger = BucketPinger; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVja2V0LXBpbmdlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImJ1Y2tldC1waW5nZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkNBQTJDO0FBQzNDLGlEQUFpRDtBQUNqRCw2Q0FBOEQ7QUFDOUQsbURBQW1EO0FBQ25ELDJDQUF1QztBQU12QyxNQUFhLFlBQWEsU0FBUSxzQkFBUztJQUl6QyxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQXdCO1FBQ2hFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxJQUFJLEdBQUcsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxVQUFVLEVBQUU7WUFDakQsSUFBSSxFQUFFLE1BQ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WU6IGxhbWJkYS5SdW50aW1lLlBZVEhPTl8zXzksXG4gICAgICB0aW1lb3V0OiBwcm9wcy50aW1lb3V0ID8/IER1cmF0aW9uLm1pbnV0ZXMoMSksXG4gICAgICBlbnZpcm9ubWVudDoge1xuICAgICAgICBCVUNLRVRfTkFNRTogcHJvcHMuYnVja2V0TmFtZSxcbiAgICAgIH0sXG4gICAgfSk7XG5cbiAgICBpZiAoIWZ1bmMucm9sZSkge1xuICAgICAgdGhyb3cgbmV3IEVycm9yKCdwaW5nZXIgbGFtYmRhIGhhcyBubyBleGVjdXRpb24gcm9sZSEnKTtcbiAgICB9XG5cbiAgICBmdW5jLnJvbGUuYWRkVG9QcmluY2lwYWxQb2xpY3kobmV3IGlhbS5Qb2xpY3lTdGF0ZW1lbnQoe1xuICAgICAgYWN0aW9uczogWydzMzpEZWxldGVCdWNrZXQnLCAnczM6TGlzdEJ1Y2tldCddLFxuICAgICAgcmVzb3VyY2VzOiBbYGFybjphd3M6czM6Ojoke3Byb3BzLmJ1Y2tldE5hbWV9YF0sXG4gICAgfSkpO1xuXG4gICAgY29uc3QgcHJvdmlkZXIgPSBuZXcgY3IuUHJvdmlkZXIodGhpcywgJ1Byb3ZpZGVyJywge1xuICAgICAgb25FdmVudEhhbmRsZXI6IGZ1bmMsXG4gICAgfSk7XG5cbiAgICB0aGlzLl9yZXNvdXJjZSA9IG5ldyBDdXN0b21SZXNvdXJjZSh0aGlzLCAnUmVzb3VyY2UnLCB7XG4gICAgICBzZXJ2aWNlVG9rZW46IHByb3ZpZGVyLnNlcnZpY2VUb2tlbixcbiAgICB9KTtcbiAgfVxuXG4gIHB1YmxpYyBnZXQgcmVzcG9uc2UoKSB7XG4gICAgcmV0dXJuIFRva2VuLmFzU3RyaW5nKHRoaXMuX3Jlc291cmNlLmdldEF0dCgnVmFsdWUnKSk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.ts new file mode 100644 index 0000000000000..bf49995814429 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/bucket-pinger.ts @@ -0,0 +1,49 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { CustomResource, Token, Duration } from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import { Construct } from 'constructs'; + +export interface BucketPingerProps { + readonly bucketName: string; + readonly timeout?: Duration; +} +export class BucketPinger extends Construct { + + private _resource: CustomResource; + + constructor(scope: Construct, id: string, props: BucketPingerProps) { + super(scope, id); + + const func = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(`${__dirname}/function`), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + timeout: props.timeout ?? Duration.minutes(1), + environment: { + BUCKET_NAME: props.bucketName, + }, + }); + + if (!func.role) { + throw new Error('pinger lambda has no execution role!'); + } + + func.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['s3:DeleteBucket', 's3:ListBucket'], + resources: [`arn:aws:s3:::${props.bucketName}`], + })); + + const provider = new cr.Provider(this, 'Provider', { + onEventHandler: func, + }); + + this._resource = new CustomResource(this, 'Resource', { + serviceToken: provider.serviceToken, + }); + } + + public get response() { + return Token.asString(this._resource.getAtt('Value')); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/bucket-pinger/function/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/function/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/bucket-pinger/function/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/bucket-pinger/function/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.d.ts new file mode 100644 index 0000000000000..db3f15a88c271 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.d.ts @@ -0,0 +1,53 @@ +export declare const resources: ({ + apiVersion: string; + kind: string; + metadata: { + name: string; + }; + spec: { + type: string; + ports: { + port: number; + targetPort: number; + }[]; + selector: { + app: string; + matchLabels?: undefined; + }; + replicas?: undefined; + template?: undefined; + }; +} | { + apiVersion: string; + kind: string; + metadata: { + name: string; + }; + spec: { + replicas: number; + selector: { + matchLabels: { + app: string; + }; + app?: undefined; + }; + template: { + metadata: { + labels: { + app: string; + }; + }; + spec: { + containers: { + name: string; + image: string; + ports: { + containerPort: number; + }[]; + }[]; + }; + }; + type?: undefined; + ports?: undefined; + }; +})[]; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.js new file mode 100644 index 0000000000000..3a203130a83d6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resources = void 0; +exports.resources = [ + { + apiVersion: 'v1', + kind: 'Service', + metadata: { name: 'hello-kubernetes' }, + spec: { + type: 'LoadBalancer', + ports: [{ port: 80, targetPort: 8080 }], + selector: { app: 'hello-kubernetes' }, + }, + }, + { + apiVersion: 'apps/v1', + kind: 'Deployment', + metadata: { name: 'hello-kubernetes' }, + spec: { + replicas: 1, + selector: { matchLabels: { app: 'hello-kubernetes' } }, + template: { + metadata: { + labels: { app: 'hello-kubernetes' }, + }, + spec: { + containers: [ + { + name: 'hello-kubernetes', + image: 'paulbouwer/hello-kubernetes:1.5', + ports: [{ containerPort: 8080 }], + }, + ], + }, + }, + }, + }, +]; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVsbG8tazhzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJ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iAgICB9LFxuICB9LFxuXTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/hello-k8s.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/hello-k8s.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/hello-k8s.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.d.ts new file mode 100644 index 0000000000000..08ce35db03b0d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.d.ts @@ -0,0 +1,7 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { Construct } from 'constructs'; +import * as eks from 'aws-cdk-lib/aws-eks'; +export declare function getClusterVersionConfig(scope: Construct): { + version: eks.KubernetesVersion; + kubectlLayer: lambda.ILayerVersion; +}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.js new file mode 100644 index 0000000000000..3517aaf5cc45b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getClusterVersionConfig = void 0; +const lambda_layer_kubectl_v24_1 = require("@aws-cdk/lambda-layer-kubectl-v24"); +const eks = require("aws-cdk-lib/aws-eks"); +function getClusterVersionConfig(scope) { + return { + version: eks.KubernetesVersion.V1_24, + // Crazy type-casting is required because KubectlLayer peer depends on + // types from aws-cdk-lib, but we run integration tests in the @aws-cdk/ + // v1-style directory, not in the aws-cdk-lib v2-style directory. + kubectlLayer: new lambda_layer_kubectl_v24_1.KubectlV24Layer(scope, 'KubectlLayer'), + }; +} +exports.getClusterVersionConfig = getClusterVersionConfig; +; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWctdGVzdHMta3ViZXJuZXRlcy12ZXJzaW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWctdGVzdHMta3ViZXJuZXRlcy12ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLGdGQUFvRTtBQUVwRSwyQ0FBMkM7QUFFM0MsU0FBZ0IsdUJBQXVCLENBQUMsS0FBZ0I7SUFDdEQsT0FBTztRQUNMLE9BQU8sRUFBRSxHQUFHLENBQUMsaUJBQWlCLENBQUMsS0FBSztRQUNwQyxzRUFBc0U7UUFDdEUsd0VBQXdFO1FBQ3hFLGlFQUFpRTtRQUNqRSxZQUFZLEVBQUUsSUFBSSwwQ0FBZSxDQUFDLEtBQUssRUFBRSxjQUFjLENBQW9DO0tBQzVGLENBQUM7QUFDSixDQUFDO0FBUkQsMERBUUM7QUFBQSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgbGFtYmRhIGZyb20gJ2F3cy1jZGstbGliL2F3cy1sYW1iZGEnO1xuaW1wb3J0IHsgS3ViZWN0bFYyNExheWVyIH0gZnJvbSAnQGF3cy1jZGsvbGFtYmRhLWxheWVyLWt1YmVjdGwtdjI0JztcbmltcG9ydCB7IENvbnN0cnVjdCB9IGZyb20gJ2NvbnN0cnVjdHMnO1xuaW1wb3J0ICogYXMgZWtzIGZyb20gJ2F3cy1jZGstbGliL2F3cy1la3MnO1xuXG5leHBvcnQgZnVuY3Rpb24gZ2V0Q2x1c3RlclZlcnNpb25Db25maWcoc2NvcGU6IENvbnN0cnVjdCkge1xuICByZXR1cm4ge1xuICAgIHZlcnNpb246IGVrcy5LdWJlcm5ldGVzVmVyc2lvbi5WMV8yNCxcbiAgICAvLyBDcmF6eSB0eXBlLWNhc3RpbmcgaXMgcmVxdWlyZWQgYmVjYXVzZSBLdWJlY3RsTGF5ZXIgcGVlciBkZXBlbmRzIG9uXG4gICAgLy8gdHlwZXMgZnJvbSBhd3MtY2RrLWxpYiwgYnV0IHdlIHJ1biBpbnRlZ3JhdGlvbiB0ZXN0cyBpbiB0aGUgQGF3cy1jZGsvXG4gICAgLy8gdjEtc3R5bGUgZGlyZWN0b3J5LCBub3QgaW4gdGhlIGF3cy1jZGstbGliIHYyLXN0eWxlIGRpcmVjdG9yeS5cbiAgICBrdWJlY3RsTGF5ZXI6IG5ldyBLdWJlY3RsVjI0TGF5ZXIoc2NvcGUsICdLdWJlY3RsTGF5ZXInKSBhcyB1bmtub3duIGFzIGxhbWJkYS5JTGF5ZXJWZXJzaW9uLFxuICB9O1xufTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ-tests-kubernetes-version.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.ts similarity index 85% rename from packages/@aws-cdk/aws-eks/test/integ-tests-kubernetes-version.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.ts index 2454e2570c5de..f00d38e7dca3f 100644 --- a/packages/@aws-cdk/aws-eks/test/integ-tests-kubernetes-version.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ-tests-kubernetes-version.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24'; import { Construct } from 'constructs'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; export function getClusterVersionConfig(scope: Construct) { return { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js new file mode 100644 index 0000000000000..0985e3210ccc2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const ec2 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cdk8s = require("cdk8s"); +const kplus = require("cdk8s-plus-24"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const pinger_1 = require("./pinger/pinger"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksClusterAlbControllerStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + // just need one nat gateway to simplify the test + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 1 }); + const cluster = new eks.Cluster(this, 'Cluster', { + vpc, + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + albController: { + version: eks.AlbControllerVersion.V2_4_1, + }, + }); + const chart = new cdk8s.Chart(new cdk8s.App(), 'hello-server'); + const ingress = new kplus.Deployment(chart, 'Deployment', { + containers: [{ + image: 'hashicorp/http-echo', + args: ['-text', 'hello'], + port: 5678, + securityContext: { + user: 1005, + }, + }], + }) + .exposeViaService({ serviceType: kplus.ServiceType.NODE_PORT }) + .exposeViaIngress('/'); + // allow vpc to access the ELB so our pinger can hit it. + ingress.metadata.addAnnotation('alb.ingress.kubernetes.io/inbound-cidrs', cluster.vpc.vpcCidrBlock); + const echoServer = cluster.addCdk8sChart('echo-server', chart, { ingressAlb: true, ingressAlbScheme: eks.AlbScheme.INTERNAL }); + // the deletion of `echoServer` is what instructs the controller to delete the ELB. + // so we need to make sure this happens before the controller is deleted. + echoServer.node.addDependency(cluster.albController ?? []); + const loadBalancerAddress = cluster.getIngressLoadBalancerAddress(ingress.name, { timeout: aws_cdk_lib_1.Duration.minutes(10) }); + // create a resource that hits the load balancer to make sure + // everything is wired properly. + const pinger = new pinger_1.Pinger(this, 'IngressPinger', { + url: `http://${loadBalancerAddress}`, + vpc: cluster.vpc, + }); + // the pinger must wait for the ingress and echoServer to be deployed. + pinger.node.addDependency(ingress, echoServer); + // this should display the 'hello' text we gave to the server + new aws_cdk_lib_1.CfnOutput(this, 'IngressPingerResponse', { + value: pinger.response, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksClusterAlbControllerStack(app, 'aws-cdk-eks-cluster-alb-controller-test'); +new integ.IntegTest(app, 'aws-cdk-cluster-alb-controller', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLWNvbnRyb2xsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hbGItY29udHJvbGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUE2QztBQUM3QywyQ0FBMkM7QUFDM0MsNkNBQThEO0FBQzlELG9EQUFvRDtBQUNwRCwrQkFBK0I7QUFDL0IsdUNBQXVDO0FBQ3ZDLHFGQUEyRTtBQUMzRSw0Q0FBeUM7QUFDekMsMkNBQTJDO0FBRTNDLE1BQU0sNEJBQTZCLFNBQVEsbUJBQUs7SUFFOUMsWUFBWSxLQUFVLEVBQUUsRUFBVTtRQUNoQyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLGlEQUFpRDtRQUNqRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxF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HJlc3N9YCxcbiAgICAgIHZwYzogY2x1c3Rlci52cGMsXG4gICAgfSk7XG5cbiAgICAvLyB0aGUgcGluZ2VyIG11c3Qgd2FpdCBmb3IgdGhlIGluZ3Jlc3MgYW5kIGVjaG9TZXJ2ZXIgdG8gYmUgZGVwbG95ZWQuXG4gICAgcGluZ2VyLm5vZGUuYWRkRGVwZW5kZW5jeShpbmdyZXNzLCBlY2hvU2VydmVyKTtcblxuICAgIC8vIHRoaXMgc2hvdWxkIGRpc3BsYXkgdGhlICdoZWxsbycgdGV4dCB3ZSBnYXZlIHRvIHRoZSBzZXJ2ZXJcbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdJbmdyZXNzUGluZ2VyUmVzcG9uc2UnLCB7XG4gICAgICB2YWx1ZTogcGluZ2VyLnJlc3BvbnNlLFxuICAgIH0pO1xuXG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgRWtzQ2x1c3RlckFsYkNvbnRyb2xsZXJTdGFjayhhcHAsICdhd3MtY2RrLWVrcy1jbHVzdGVyLWFsYi1jb250cm9sbGVyLXRlc3QnKTtcbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnYXdzLWNkay1jbHVzdGVyLWFsYi1jb250cm9sbGVyJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.5f49893093e1ad14831626016699156d48da5f0890f19eb930bc3c46cf5f636d/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.5f49893093e1ad14831626016699156d48da5f0890f19eb930bc3c46cf5f636d/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.5f49893093e1ad14831626016699156d48da5f0890f19eb930bc3c46cf5f636d/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.5f49893093e1ad14831626016699156d48da5f0890f19eb930bc3c46cf5f636d/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/lib/kubectl-handler/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/kubectl-handler/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/lib/kubectl-handler/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/kubectl-handler/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/lib/kubectl-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/kubectl-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/lib/kubectl-handler/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/kubectl-handler/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/aws-cdk-eks-cluster-alb-controller-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkclusteralbcontrollerDefaultTestDeployAssert78AE94CA.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksClusterResourceProvider5DBBAFBB.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksClusterResourceProvider5DBBAFBB.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksClusterResourceProvider5DBBAFBB.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksClusterResourceProvider5DBBAFBB.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksKubectlProviderA1AC28D1.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksKubectlProviderA1AC28D1.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksKubectlProviderA1AC28D1.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/awscdkeksclusteralbcontrollertestawscdkawseksKubectlProviderA1AC28D1.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.ts similarity index 92% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.ts index 3125a8319fc9a..dd011f474bdac 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.alb-controller.ts @@ -1,12 +1,12 @@ /// !cdk-integ pragma:disable-update-workflow -import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, CfnOutput, Duration, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { App, CfnOutput, Duration, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as cdk8s from 'cdk8s'; import * as kplus from 'cdk8s-plus-24'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; import { Pinger } from './pinger/pinger'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksClusterAlbControllerStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js new file mode 100644 index 0000000000000..e983416fc7c43 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +const aws_eks_1 = require("aws-cdk-lib/aws-eks"); +class EksClusterStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + // allow all account users to assume this role in order to admin the cluster + const mastersRole = new iam.Role(this, 'AdminRole', { + assumedBy: new iam.AccountRootPrincipal(), + }); + // just need one nat gateway to simplify the test + this.vpc = new ec2.Vpc(this, 'Vpc', { natGateways: 1 }); + // create the cluster with a default nodegroup capacity + this.cluster = new eks.Cluster(this, 'Cluster', { + vpc: this.vpc, + mastersRole, + defaultCapacity: 0, + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + }); + this.cluster.addNodegroupCapacity('BottlerocketNG1', { + amiType: aws_eks_1.NodegroupAmiType.BOTTLEROCKET_X86_64, + }); + this.cluster.addNodegroupCapacity('BottlerocketNG2', { + amiType: aws_eks_1.NodegroupAmiType.BOTTLEROCKET_ARM_64, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksClusterStack(app, 'aws-cdk-eks-cluster-bottlerocket-ng-test'); +new integ.IntegTest(app, 'aws-cdk-eks-cluster-bottlerocket-ng', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWtzLWJvdHRsZXJvY2tldC1uZy5qcyIsInNvdXJjZVJvb3QiOiIiLC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ldE5HMScsIHtcbiAgICAgIGFtaVR5cGU6IE5vZGVncm91cEFtaVR5cGUuQk9UVExFUk9DS0VUX1g4Nl82NCxcbiAgICB9KTtcbiAgICB0aGlzLmNsdXN0ZXIuYWRkTm9kZWdyb3VwQ2FwYWNpdHkoJ0JvdHRsZXJvY2tldE5HMicsIHtcbiAgICAgIGFtaVR5cGU6IE5vZGVncm91cEFtaVR5cGUuQk9UVExFUk9DS0VUX0FSTV82NCxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IEVrc0NsdXN0ZXJTdGFjayhhcHAsICdhd3MtY2RrLWVrcy1jbHVzdGVyLWJvdHRsZXJvY2tldC1uZy10ZXN0Jyk7XG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2F3cy1jZGstZWtzLWNsdXN0ZXItYm90dGxlcm9ja2V0LW5nJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngDefaultTestDeployAssert6C42FFE7.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksClusterResourceProvider7EC04E81.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksClusterResourceProvider7EC04E81.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksClusterResourceProvider7EC04E81.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksClusterResourceProvider7EC04E81.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksKubectlProviderE02BC096.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksKubectlProviderE02BC096.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksKubectlProviderE02BC096.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/awscdkeksclusterbottlerocketngtestawscdkawseksKubectlProviderE02BC096.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.ts similarity index 81% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.ts index e3e9a2517fe56..c83ed60de7db2 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.ts @@ -1,11 +1,11 @@ /// !cdk-integ pragma:disable-update-workflow -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib'; -import { NodegroupAmiType } from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; +import { NodegroupAmiType } from 'aws-cdk-lib/aws-eks'; class EksClusterStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js new file mode 100644 index 0000000000000..3c06c09d93ffc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksAllHandlersInVpcStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + new eks.Cluster(this, 'EksAllHandlersInVpcStack', { + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + placeClusterHandlerInVpc: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksAllHandlersInVpcStack(app, 'aws-cdk-eks-handlers-in-vpc-test'); +new integ.IntegTest(app, 'aws-cdk-eks-handlers-in-vpc', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWtzLWNsdXN0ZXItaGFuZGxlcnMtdnBjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZWtzLWNsdXN0ZXItaGFuZGxlcnMtdnBjLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQTZDO0FBQzdDLDZDQUF5QztBQUN6QyxvREFBb0Q7QUFDcEQscUZBQTJFO0FBQzNFLDJDQUEyQztBQUUzQyxNQUFNLHdCQUF5QixTQUFRLG1CQUFLO0l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WN0b3Ioc2NvcGU6IEFwcCwgaWQ6IHN0cmluZykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICBuZXcgZWtzLkNsdXN0ZXIodGhpcywgJ0Vrc0FsbEhhbmRsZXJzSW5WcGNTdGFjaycsIHtcbiAgICAgIC4uLmdldENsdXN0ZXJWZXJzaW9uQ29uZmlnKHRoaXMpLFxuICAgICAgcGxhY2VDbHVzdGVySGFuZGxlckluVnBjOiB0cnVlLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcblxuY29uc3Qgc3RhY2sgPSBuZXcgRWtzQWxsSGFuZGxlcnNJblZwY1N0YWNrKGFwcCwgJ2F3cy1jZGstZWtzLWhhbmRsZXJzLWluLXZwYy10ZXN0Jyk7XG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2F3cy1jZGstZWtzLWhhbmRsZXJzLWluLXZwYycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/aws-cdk-eks-handlers-in-vpc-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpcDefaultTestDeployAssert40766711.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksClusterResourceProvider9260AB35.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksClusterResourceProvider9260AB35.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksClusterResourceProvider9260AB35.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksClusterResourceProvider9260AB35.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksKubectlProvider72227111.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksKubectlProvider72227111.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksKubectlProvider72227111.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/awscdkekshandlersinvpctestawscdkawseksKubectlProvider72227111.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.ts similarity index 80% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.ts index f93e444b3ff95..3fcc9fd0b99ad 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-handlers-vpc.ts @@ -1,8 +1,8 @@ /// !cdk-integ pragma:disable-update-workflow -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksAllHandlersInVpcStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js new file mode 100644 index 0000000000000..6ac6feacccd01 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksClusterStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + // allow all account users to assume this role in order to admin the cluster + const mastersRole = new iam.Role(this, 'AdminRole', { + assumedBy: new iam.AccountRootPrincipal(), + }); + // just need one nat gateway to simplify the test + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 3, natGateways: 1 }); + const cluster = new eks.Cluster(this, 'Cluster', { + vpc, + mastersRole, + defaultCapacity: 2, + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + endpointAccess: eks.EndpointAccess.PRIVATE, + prune: false, + }); + // this is the valdiation. it won't work if the private access is not setup properly. + cluster.addManifest('config-map', { + kind: 'ConfigMap', + apiVersion: 'v1', + data: { + hello: 'world', + }, + metadata: { + name: 'config-map', + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksClusterStack(app, 'aws-cdk-eks-cluster-private-endpoint-test'); +new integ.IntegTest(app, 'aws-cdk-eks-cluster-private-endpoint', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application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gcHJpdmF0ZSBhY2Nlc3MgaXMgbm90IHNldHVwIHByb3Blcmx5LlxuICAgIGNsdXN0ZXIuYWRkTWFuaWZlc3QoJ2NvbmZpZy1tYXAnLCB7XG4gICAgICBraW5kOiAnQ29uZmlnTWFwJyxcbiAgICAgIGFwaVZlcnNpb246ICd2MScsXG4gICAgICBkYXRhOiB7XG4gICAgICAgIGhlbGxvOiAnd29ybGQnLFxuICAgICAgfSxcbiAgICAgIG1ldGFkYXRhOiB7XG4gICAgICAgIG5hbWU6ICdjb25maWctbWFwJyxcbiAgICAgIH0sXG4gICAgfSk7XG5cbiAgfVxufVxuXG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcblxuY29uc3Qgc3RhY2sgPSBuZXcgRWtzQ2x1c3RlclN0YWNrKGFwcCwgJ2F3cy1jZGstZWtzLWNsdXN0ZXItcHJpdmF0ZS1lbmRwb2ludC10ZXN0Jyk7XG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2F3cy1jZGstZWtzLWNsdXN0ZXItcHJpdmF0ZS1lbmRwb2ludCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointDefaultTestDeployAssert3C16DBEA.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksClusterResourceProvider67118CB1.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksClusterResourceProvider67118CB1.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksClusterResourceProvider67118CB1.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksClusterResourceProvider67118CB1.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksKubectlProvider421F287E.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksKubectlProvider421F287E.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksKubectlProvider421F287E.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/awscdkeksclusterprivateendpointtestawscdkawseksKubectlProvider421F287E.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.ts similarity index 85% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.ts index f098af251a172..f3c25ede00e56 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.ts @@ -1,10 +1,10 @@ /// !cdk-integ pragma:disable-update-workflow -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksClusterStack extends Stack { constructor(scope: App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js new file mode 100644 index 0000000000000..f734704104ef5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js @@ -0,0 +1,298 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cdk8s = require("cdk8s"); +const kplus = require("cdk8s-plus-24"); +const hello = require("./hello-k8s"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksClusterStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // allow all account users to assume this role in order to admin the cluster + const mastersRole = new iam.Role(this, 'AdminRole', { + assumedBy: new iam.AccountRootPrincipal(), + }); + const secretsEncryptionKey = new kms.Key(this, 'SecretsKey'); + // just need one nat gateway to simplify the test + this.vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 3, natGateways: 1 }); + // Changing the subnets order should be supported + const vpcSubnets = [ + { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + { subnetType: ec2.SubnetType.PUBLIC }, + ]; + // create the cluster with a default nodegroup capacity + this.cluster = new eks.Cluster(this, 'Cluster', { + vpc: this.vpc, + vpcSubnets, + mastersRole, + defaultCapacity: 2, + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + secretsEncryptionKey, + tags: { + foo: 'bar', + }, + clusterLogging: [ + eks.ClusterLoggingTypes.API, + eks.ClusterLoggingTypes.AUTHENTICATOR, + eks.ClusterLoggingTypes.SCHEDULER, + ], + }); + this.assertFargateProfile(); + this.assertCapacityX86(); + this.assertCapacityArm(); + this.assertBottlerocket(); + this.assertSpotCapacity(); + this.assertNodeGroupX86(); + this.assertNodeGroupSpot(); + this.assertNodeGroupArm(); + this.assertNodeGroupGraviton3(); + this.assertNodeGroupCustomAmi(); + this.assertSimpleManifest(); + this.assertManifestWithoutValidation(); + this.assertSimpleHelmChart(); + this.assertHelmChartAsset(); + this.assertSimpleCdk8sChart(); + this.assertCreateNamespace(); + this.assertServiceAccount(); + this.assertExtendedServiceAccount(); + new aws_cdk_lib_1.CfnOutput(this, 'ClusterEndpoint', { value: this.cluster.clusterEndpoint }); + new aws_cdk_lib_1.CfnOutput(this, 'ClusterArn', { value: this.cluster.clusterArn }); + new aws_cdk_lib_1.CfnOutput(this, 'ClusterCertificateAuthorityData', { value: this.cluster.clusterCertificateAuthorityData }); + new aws_cdk_lib_1.CfnOutput(this, 'ClusterSecurityGroupId', { value: this.cluster.clusterSecurityGroupId }); + new aws_cdk_lib_1.CfnOutput(this, 'ClusterEncryptionConfigKeyArn', { value: this.cluster.clusterEncryptionConfigKeyArn }); + new aws_cdk_lib_1.CfnOutput(this, 'ClusterName', { value: this.cluster.clusterName }); + } + assertServiceAccount() { + // add a service account connected to a IAM role + this.cluster.addServiceAccount('MyServiceAccount'); + } + assertExtendedServiceAccount() { + // add a service account connected to a IAM role + this.cluster.addServiceAccount('MyExtendedServiceAccount', { + annotations: { + 'eks.amazonaws.com/sts-regional-endpoints': 'false', + }, + labels: { + 'some-label': 'with-some-value', + }, + }); + } + assertCreateNamespace() { + // deploy an nginx ingress in a namespace + const nginxNamespace = this.cluster.addManifest('nginx-namespace', { + apiVersion: 'v1', + kind: 'Namespace', + metadata: { + name: 'nginx', + }, + }); + const nginxIngress = this.cluster.addHelmChart('nginx-ingress', { + chart: 'nginx-ingress', + repository: 'https://helm.nginx.com/stable', + namespace: 'nginx', + wait: true, + createNamespace: false, + timeout: aws_cdk_lib_1.Duration.minutes(15), + }); + // make sure namespace is deployed before the chart + nginxIngress.node.addDependency(nginxNamespace); + } + assertSimpleCdk8sChart() { + class Chart extends cdk8s.Chart { + constructor(scope, ns, cluster) { + super(scope, ns); + new kplus.ConfigMap(this, 'config-map', { + data: { + clusterName: cluster.clusterName, + }, + }); + } + } + const app = new cdk8s.App(); + const chart = new Chart(app, 'Chart', this.cluster); + this.cluster.addCdk8sChart('cdk8s-chart', chart); + } + assertSimpleHelmChart() { + // deploy the Kubernetes dashboard through a helm chart + this.cluster.addHelmChart('dashboard', { + chart: 'kubernetes-dashboard', + repository: 'https://kubernetes.github.io/dashboard/', + }); + } + assertHelmChartAsset() { + // get helm chart from Asset + const chartAsset = new aws_s3_assets_1.Asset(this, 'ChartAsset', { + path: path.join(__dirname, 'test-chart'), + }); + this.cluster.addHelmChart('test-chart', { + chartAsset: chartAsset, + }); + } + assertSimpleManifest() { + // apply a kubernetes manifest + this.cluster.addManifest('HelloApp', ...hello.resources); + } + assertManifestWithoutValidation() { + // apply a kubernetes manifest + new eks.KubernetesManifest(this, 'HelloAppWithoutValidation', { + cluster: this.cluster, + manifest: [{ + apiVersion: 'v1', + kind: 'ConfigMap', + data: { hello: 'world' }, + metadata: { name: 'config-map' }, + unknown: { key: 'value' }, + }], + skipValidation: true, + }); + } + assertNodeGroupX86() { + // add a extra nodegroup + this.cluster.addNodegroupCapacity('extra-ng', { + instanceTypes: [new ec2.InstanceType('t3.small')], + minSize: 1, + // reusing the default capacity nodegroup instance role when available + nodeRole: this.cluster.defaultCapacity ? this.cluster.defaultCapacity.role : undefined, + }); + } + assertNodeGroupSpot() { + // add a extra nodegroup + this.cluster.addNodegroupCapacity('extra-ng-spot', { + instanceTypes: [ + new ec2.InstanceType('c5.large'), + new ec2.InstanceType('c5a.large'), + new ec2.InstanceType('c5d.large'), + ], + minSize: 3, + // reusing the default capacity nodegroup instance role when available + nodeRole: this.cluster.defaultCapacity ? this.cluster.defaultCapacity.role : undefined, + capacityType: eks.CapacityType.SPOT, + }); + } + assertNodeGroupCustomAmi() { + // add a extra nodegroup + const userData = ec2.UserData.forLinux(); + userData.addCommands('set -o xtrace', `/etc/eks/bootstrap.sh ${this.cluster.clusterName}`); + const lt = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', { + launchTemplateData: { + imageId: new eks.EksOptimizedImage({ + kubernetesVersion: eks.KubernetesVersion.V1_25.version, + }).getImage(this).imageId, + instanceType: new ec2.InstanceType('t3.small').toString(), + userData: aws_cdk_lib_1.Fn.base64(userData.render()), + }, + }); + this.cluster.addNodegroupCapacity('extra-ng2', { + minSize: 1, + // reusing the default capacity nodegroup instance role when available + nodeRole: this.cluster.defaultNodegroup?.role || this.cluster.defaultCapacity?.role, + launchTemplateSpec: { + id: lt.ref, + version: lt.attrDefaultVersionNumber, + }, + }); + } + assertNodeGroupArm() { + // add a extra nodegroup + this.cluster.addNodegroupCapacity('extra-ng-arm', { + instanceTypes: [new ec2.InstanceType('m6g.medium')], + minSize: 1, + // reusing the default capacity nodegroup instance role when available + nodeRole: this.cluster.defaultCapacity ? this.cluster.defaultCapacity.role : undefined, + }); + } + assertNodeGroupGraviton3() { + // add a Graviton3 nodegroup + this.cluster.addNodegroupCapacity('extra-ng-arm3', { + instanceTypes: [new ec2.InstanceType('c7g.large')], + minSize: 1, + // reusing the default capacity nodegroup instance role when available + nodeRole: this.cluster.defaultCapacity ? this.cluster.defaultCapacity.role : undefined, + }); + } + assertSpotCapacity() { + // spot instances (up to 10) + this.cluster.addAutoScalingGroupCapacity('spot', { + spotPrice: '0.1094', + instanceType: new ec2.InstanceType('t3.large'), + maxCapacity: 10, + bootstrapOptions: { + kubeletExtraArgs: '--node-labels foo=bar,goo=far', + awsApiRetryAttempts: 5, + }, + }); + } + assertBottlerocket() { + // add bottlerocket nodes + this.cluster.addAutoScalingGroupCapacity('BottlerocketNodes', { + instanceType: new ec2.InstanceType('t3.small'), + minCapacity: 2, + machineImageType: eks.MachineImageType.BOTTLEROCKET, + }); + } + assertCapacityX86() { + // add some x86_64 capacity to the cluster. The IAM instance role will + // automatically be mapped via aws-auth to allow nodes to join the cluster. + this.cluster.addAutoScalingGroupCapacity('Nodes', { + instanceType: new ec2.InstanceType('t2.medium'), + minCapacity: 3, + }); + } + assertCapacityArm() { + // add some arm64 capacity to the cluster. The IAM instance role will + // automatically be mapped via aws-auth to allow nodes to join the cluster. + this.cluster.addAutoScalingGroupCapacity('NodesArm', { + instanceType: new ec2.InstanceType('m6g.medium'), + minCapacity: 1, + }); + } + assertFargateProfile() { + // fargate profile for resources in the "default" namespace + this.cluster.addFargateProfile('default', { + selectors: [{ namespace: 'default' }], + }); + } +} +// this test uses both the bottlerocket image and the inf1 instance, which are only supported in these +// regions. see https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-eks#bottlerocket +// and https://aws.amazon.com/about-aws/whats-new/2019/12/introducing-amazon-ec2-inf1-instances-high-performance-and-the-lowest-cost-machine-learning-inference-in-the-cloud/ +const supportedRegions = [ + 'us-east-1', + 'us-west-2', +]; +const app = new aws_cdk_lib_1.App(); +// since the EKS optimized AMI is hard-coded here based on the region, +// we need to actually pass in a specific region. +const stack = new EksClusterStack(app, 'aws-cdk-eks-cluster-test', { + env: { region: 'us-east-1' }, +}); +if (process.env.CDK_INTEG_ACCOUNT !== '12345678') { + // only validate if we are about to actually deploy. + // TODO: better way to determine this, right now the 'CDK_INTEG_ACCOUNT' seems like the only way. + if (aws_cdk_lib_1.Token.isUnresolved(stack.region)) { + throw new Error(`region (${stack.region}) cannot be a token and must be configured to one of: ${supportedRegions}`); + } + if (!supportedRegions.includes(stack.region)) { + throw new Error(`region (${stack.region}) must be configured to one of: ${supportedRegions}`); + } +} +new integ.IntegTest(app, 'aws-cdk-eks-cluster', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWtzLWNsdXN0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5la3MtY2x1c3Rlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUE2QztBQUM3Qyw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsNkRBQWtEO0FBQ2xELDZDQUFxRjtBQUNyRixvREFBb0Q7QUFDcEQsK0JBQStCO0FBQy9CLHVDQUF1QztBQUV2QyxxQ0FBcUM7QUFDckMscUZBQTJFO0FBQzNFLDJDQUEyQztBQUczQyxNQUFNLGVBQWdCLFNBQVEsbUJBQUs7SUFLakMsWUFBWSxLQUFVLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQ3BELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLDRFQUE0RTtRQUM1RSxNQUFNLFdBQVcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLFdBQVcsRUFBRTtZQUNsRCxTQUFTLEVBQUUsSUFBSSxHQUFHLENBQUMsb0JBQW9CLEVBQUU7U0FDMUMsQ0FBQyxDQUFDO1FBRUgsTUFBTSxvQkFBb0IsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLFlBQVksQ0FBQyxDQUFDO1FBRTdELGlEQUFpRDtRQUNqRCx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OCcpIHtcblxuICAvLyBvbmx5IHZhbGlkYXRlIGlmIHdlIGFyZSBhYm91dCB0byBhY3R1YWxseSBkZXBsb3kuXG4gIC8vIFRPRE86IGJldHRlciB3YXkgdG8gZGV0ZXJtaW5lIHRoaXMsIHJpZ2h0IG5vdyB0aGUgJ0NES19JTlRFR19BQ0NPVU5UJyBzZWVtcyBsaWtlIHRoZSBvbmx5IHdheS5cblxuICBpZiAoVG9rZW4uaXNVbnJlc29sdmVkKHN0YWNrLnJlZ2lvbikpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYHJlZ2lvbiAoJHtzdGFjay5yZWdpb259KSBjYW5ub3QgYmUgYSB0b2tlbiBhbmQgbXVzdCBiZSBjb25maWd1cmVkIHRvIG9uZSBvZjogJHtzdXBwb3J0ZWRSZWdpb25zfWApO1xuICB9XG5cbiAgaWYgKCFzdXBwb3J0ZWRSZWdpb25zLmluY2x1ZGVzKHN0YWNrLnJlZ2lvbikpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYHJlZ2lvbiAoJHtzdGFjay5yZWdpb259KSBtdXN0IGJlIGNvbmZpZ3VyZWQgdG8gb25lIG9mOiAke3N1cHBvcnRlZFJlZ2lvbnN9YCk7XG4gIH1cblxufVxuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2F3cy1jZGstZWtzLWNsdXN0ZXInLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbiAgY2RrQ29tbWFuZE9wdGlvbnM6IHtcbiAgICBkZXBsb3k6IHtcbiAgICAgIGFyZ3M6IHtcbiAgICAgICAgcm9sbGJhY2s6IHRydWUsXG4gICAgICB9LFxuICAgIH0sXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/lib/kubectl-handler/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/kubectl-handler/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c9455aefa243f3cd7a810b3f6df8ed37e457d3e1d046353da27c4aa13551d4dc.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c9455aefa243f3cd7a810b3f6df8ed37e457d3e1d046353da27c4aa13551d4dc.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c9455aefa243f3cd7a810b3f6df8ed37e457d3e1d046353da27c4aa13551d4dc.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.c9455aefa243f3cd7a810b3f6df8ed37e457d3e1d046353da27c4aa13551d4dc.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclusterDefaultTestDeployAssertFBF4B356.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksClusterResourceProvider5F388D1A.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksClusterResourceProvider5F388D1A.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksClusterResourceProvider5F388D1A.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksClusterResourceProvider5F388D1A.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksKubectlProviderE05943BF.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksKubectlProviderE05943BF.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksKubectlProviderE05943BF.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/awscdkeksclustertestawscdkawseksKubectlProviderE05943BF.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.ts similarity index 97% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.ts index 927558895bcd8..382df4c574e49 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.ts @@ -1,17 +1,17 @@ /// !cdk-integ pragma:disable-update-workflow import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { App, CfnOutput, Duration, Token, Fn, Stack, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; +import { App, CfnOutput, Duration, Token, Fn, Stack, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as cdk8s from 'cdk8s'; import * as kplus from 'cdk8s-plus-24'; import * as constructs from 'constructs'; import * as hello from './hello-k8s'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksClusterStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js new file mode 100644 index 0000000000000..cded87c53eeb3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksClusterStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + // allow all account users to assume this role in order to admin the cluster + const mastersRole = new iam.Role(this, 'AdminRole', { + assumedBy: new iam.AccountRootPrincipal(), + }); + // just need one nat gateway to simplify the test + this.vpc = new ec2.Vpc(this, 'Vpc', { natGateways: 1 }); + // create the cluster with a default nodegroup capacity + this.cluster = new eks.Cluster(this, 'Cluster', { + vpc: this.vpc, + mastersRole, + defaultCapacity: 2, + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + tags: { + foo: 'bar', + }, + clusterLogging: [ + eks.ClusterLoggingTypes.API, + eks.ClusterLoggingTypes.AUTHENTICATOR, + eks.ClusterLoggingTypes.SCHEDULER, + ], + }); + this.assertHelmChartAsset(); + } + assertHelmChartAsset() { + // get helm chart from Asset + const chartAsset = new aws_s3_assets_1.Asset(this, 'ChartAsset', { + path: path.join(__dirname, 'test-chart'), + }); + this.cluster.addHelmChart('test-chart', { + chartAsset: chartAsset, + }); + this.cluster.addHelmChart('test-oci-chart', { + chart: 's3-chart', + release: 's3-chart', + repository: 'oci://public.ecr.aws/aws-controllers-k8s/s3-chart', + version: 'v0.1.0', + namespace: 'ack-system', + createNamespace: true, + }); + // there is no opinionated way of testing charts from private ECR, so there is description of manual steps needed to reproduce: + // 1. `export AWS_PROFILE=youraccountprofile; aws ecr create-repository --repository-name helm-charts-test/s3-chart --region YOUR_REGION` + // 2. `helm pull oci://public.ecr.aws/aws-controllers-k8s/s3-chart --version v0.1.0` + // 3. Login to ECR (howto: https://docs.aws.amazon.com/AmazonECR/latest/userguide/push-oci-artifact.html ) + // 4. `helm push s3-chart-v0.1.0.tgz oci://YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com/helm-charts-test/` + // 5. Change `repository` in above test to oci://YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com/helm-charts-test + // 6. Run integration tests as usual + this.cluster.addHelmChart('test-oci-chart-different-release-name', { + chart: 'lambda-chart', + release: 'lambda-chart-release', + repository: 'oci://public.ecr.aws/aws-controllers-k8s/lambda-chart', + version: 'v0.1.4', + namespace: 'ack-system', + createNamespace: true, + }); + // testing the disable mechanism of the installation of CRDs + this.cluster.addHelmChart('test-skip-crd-installation', { + chart: 'lambda-chart', + release: 'lambda-chart-release', + repository: 'oci://public.ecr.aws/aws-controllers-k8s/lambda-chart', + version: 'v0.1.4', + namespace: 'ack-system', + createNamespace: true, + skipCrds: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksClusterStack(app, 'aws-cdk-eks-helm-test'); +new integ.IntegTest(app, 'aws-cdk-eks-helm', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWtzLWhlbG0tYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5la3MtaGVsbS1hc3NldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUE2QztBQUM3Qyw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyw2REFBa0Q7QUFDbEQsNkNBQXlDO0FBQ3pDLG9EQUFvRDtBQUNwRCxxRkFBMkU7QUFDM0UsMkNBQTJDO0FBRTNDLE1BQU0sZUFBZ0IsU0FBUSxtQkFBSztJQUlqQyxZQUFZLEtBQ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 No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.d65fbdc11b108e0386ed8577c454d4544f6d4e7960f84a0d2e211478d6324dbf/Chart.yaml diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmDefaultTestDeployAssert044A589A.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksClusterResourceProviderB64048CD.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksClusterResourceProviderB64048CD.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksClusterResourceProviderB64048CD.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksClusterResourceProviderB64048CD.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksKubectlProvider207F42E4.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksKubectlProvider207F42E4.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksKubectlProvider207F42E4.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/awscdkekshelmtestawscdkawseksKubectlProvider207F42E4.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.ts similarity index 92% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.ts index f266123a6c6c8..b88f2ae383a44 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.ts @@ -1,12 +1,12 @@ /// !cdk-integ pragma:disable-update-workflow import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib/index'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksClusterStack extends Stack { private cluster: eks.Cluster; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js new file mode 100644 index 0000000000000..a4120a1aa9eee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const ec2 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksClusterInferenceStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + // just need one nat gateway to simplify the test + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 1 }); + const cluster = new eks.Cluster(this, 'Cluster', { + vpc, + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + albController: { + version: eks.AlbControllerVersion.V2_4_1, + }, + }); + cluster.addAutoScalingGroupCapacity('InferenceInstances', { + instanceType: new ec2.InstanceType('inf1.2xlarge'), + minCapacity: 1, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksClusterInferenceStack(app, 'aws-cdk-eks-cluster-inference-test'); +new integ.IntegTest(app, 'aws-cdk-eks-cluster-interence', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +app.synth(); +//# s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XBsaWZ5IHRoZSB0ZXN0XG4gICAgY29uc3QgdnBjID0gbmV3IGVjMi5WcGModGhpcywgJ1ZwYycsIHsgbWF4QXpzOiAyLCBuYXRHYXRld2F5czogMSB9KTtcblxuICAgIGNvbnN0IGNsdXN0ZXIgPSBuZXcgZWtzLkNsdXN0ZXIodGhpcywgJ0NsdXN0ZXInLCB7XG4gICAgICB2cGMsXG4gICAgICAuLi5nZXRDbHVzdGVyVmVyc2lvbkNvbmZpZyh0aGlzKSxcbiAgICAgIGFsYkNvbnRyb2xsZXI6IHtcbiAgICAgICAgdmVyc2lvbjogZWtzLkFsYkNvbnRyb2xsZXJWZXJzaW9uLlYyXzRfMSxcbiAgICAgIH0sXG4gICAgfSk7XG5cbiAgICBjbHVzdGVyLmFkZEF1dG9TY2FsaW5nR3JvdXBDYXBhY2l0eSgnSW5mZXJlbmNlSW5zdGFuY2VzJywge1xuICAgICAgaW5zdGFuY2VUeXBlOiBuZXcgZWMyLkluc3RhbmNlVHlwZSgnaW5mMS4yeGxhcmdlJyksXG4gICAgICBtaW5DYXBhY2l0eTogMSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBFa3NDbHVzdGVySW5mZXJlbmNlU3RhY2soYXBwLCAnYXdzLWNkay1la3MtY2x1c3Rlci1pbmZlcmVuY2UtdGVzdCcpO1xubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhd3MtY2RrLWVrcy1jbHVzdGVyLWludGVyZW5jZScsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxuICBjZGtDb21tYW5kT3B0aW9uczoge1xuICAgIGRlcGxveToge1xuICAgICAgYXJnczoge1xuICAgICAgICByb2xsYmFjazogdHJ1ZSxcbiAgICAgIH0sXG4gICAgfSxcbiAgfSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/aws-cdk-eks-cluster-inference-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksClusterResourceProviderFE14F3C4.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksClusterResourceProviderFE14F3C4.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksClusterResourceProviderFE14F3C4.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksClusterResourceProviderFE14F3C4.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksKubectlProviderB4348345.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksKubectlProviderB4348345.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksKubectlProviderB4348345.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinferencetestawscdkawseksKubectlProviderB4348345.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/awscdkeksclusterinterenceDefaultTestDeployAssert715EC778.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.ts similarity index 84% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.ts index aa5c78696ea1e..27382ce031d2d 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-inference.ts @@ -1,9 +1,9 @@ /// !cdk-integ pragma:disable-update-workflow -import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksClusterInferenceStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js new file mode 100644 index 0000000000000..8afa7548b5230 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const eks = require("aws-cdk-lib/aws-eks"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-eks-oidc-provider-test'); +new eks.OpenIdConnectProvider(stack, 'NoClientsNoThumbprint', { + url: `https://oidc.eks.${aws_cdk_lib_1.Stack.of(stack).region}.amazonaws.com/id/test2`, +}); +new integ.IntegTest(app, 'aws-cdk-eks-oidc-provider', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWtzLW9pZGMtcHJvdmlkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5la3Mtb2lkYy1wcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUF5QztBQUN6QyxvREFBb0Q7QUFDcEQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFH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b2lkYy1wcm92aWRlcicsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/aws-eks-oidc-provider-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/awscdkeksoidcproviderDefaultTestDeployAssert0BFFC9B9.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.ts new file mode 100644 index 0000000000000..f58a17baf4169 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-oidc-provider.ts @@ -0,0 +1,16 @@ +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as eks from 'aws-cdk-lib/aws-eks'; + +const app = new App(); +const stack = new Stack(app, 'aws-eks-oidc-provider-test'); + +new eks.OpenIdConnectProvider(stack, 'NoClientsNoThumbprint', { + url: `https://oidc.eks.${Stack.of(stack).region}.amazonaws.com/id/test2`, +}); + +new integ.IntegTest(app, 'aws-cdk-eks-oidc-provider', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js new file mode 100644 index 0000000000000..1e8417e531f5a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecrAssets = require("aws-cdk-lib/aws-ecr-assets"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cdk8s = require("cdk8s"); +const kplus = require("cdk8s-plus-24"); +const bucket_pinger_1 = require("./bucket-pinger/bucket-pinger"); +const eks = require("aws-cdk-lib/aws-eks"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-eks-service-account-sdk-calls-test'); +// this bucket gets created by a kubernetes pod. +const bucketName = `eks-bucket-${stack.account}-${stack.region}`; +const dockerImage = new ecrAssets.DockerImageAsset(stack, 'sdk-call-making-docker-image', { + directory: path.join(__dirname, 'sdk-call-integ-test-docker-app/app'), +}); +// just need one nat gateway to simplify the test +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 3, natGateways: 1 }); +const cluster = new eks.Cluster(stack, 'Cluster', { + vpc: vpc, + version: eks.KubernetesVersion.V1_24, +}); +const chart = new cdk8s.Chart(new cdk8s.App(), 'sdk-call-image'); +const serviceAccount = cluster.addServiceAccount('my-service-account'); +const kplusServiceAccount = kplus.ServiceAccount.fromServiceAccountName(stack, 'kplus-sa', serviceAccount.serviceAccountName); +new kplus.Deployment(chart, 'Deployment', { + containers: [{ + image: dockerImage.imageUri, + envVariables: { + BUCKET_NAME: kplus.EnvValue.fromValue(bucketName), + }, + securityContext: { + user: 1000, + }, + }], + restartPolicy: kplus.RestartPolicy.ALWAYS, + serviceAccount: kplusServiceAccount, +}); +cluster.addCdk8sChart('sdk-call', chart).node.addDependency(serviceAccount); +serviceAccount.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['s3:CreateBucket'], + resources: [`arn:aws:s3:::${bucketName}`], +})); +// this custom resource will check that the bucket exists +// the bucket will be deleted when the custom resource is deleted +// if the bucket does not exist, then it will throw an error and fail the deployment. +const pinger = new bucket_pinger_1.BucketPinger(stack, 'S3BucketPinger', { + bucketName, + // we need more timeout for the sdk-call in the pod as it could take more than 1 minute. + timeout: aws_cdk_lib_1.Duration.minutes(3), +}); +// the pinger must wait for the cluster to be updated. +// interestingly, without this dependency, CFN will always run the pinger +// before the pod. +pinger.node.addDependency(cluster); +// this should confirm that the bucket actually exists +new aws_cdk_lib_1.CfnOutput(stack, 'PingerResponse', { + value: pinger.response, +}); +new integ.IntegTest(app, 'aws-cdk-eks-service-account-sdk-call', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWtzLXNlcnZpY2UtYWNjb3VudC1zZGstY2FsbC5qcyIsInNvdXJjZVJv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dWFsbHkgZXhpc3RzXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnUGluZ2VyUmVzcG9uc2UnLCB7XG4gIHZhbHVlOiBwaW5nZXIucmVzcG9uc2UsXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhd3MtY2RrLWVrcy1zZXJ2aWNlLWFjY291bnQtc2RrLWNhbGwnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.52afb3e2686860c4a72b179852db125e37824bbfccee63ff90cd7b45b9560da1/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.52afb3e2686860c4a72b179852db125e37824bbfccee63ff90cd7b45b9560da1/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.52afb3e2686860c4a72b179852db125e37824bbfccee63ff90cd7b45b9560da1/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.52afb3e2686860c4a72b179852db125e37824bbfccee63ff90cd7b45b9560da1/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/.dockerignore b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/.dockerignore similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/.dockerignore rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/.dockerignore diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/Dockerfile diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package-lock.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package-lock.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package-lock.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package-lock.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/sdk-call.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/sdk-call.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/sdk-call.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/sdk-call.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/aws-eks-service-account-sdk-calls-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awscdkeksserviceaccountsdkcallDefaultTestDeployAssertC5196707.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksClusterResourceProvider7862DD6A.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksClusterResourceProvider7862DD6A.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksClusterResourceProvider7862DD6A.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksClusterResourceProvider7862DD6A.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksKubectlProvider62B779F7.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksKubectlProvider62B779F7.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksKubectlProvider62B779F7.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/awseksserviceaccountsdkcallstestawscdkawseksKubectlProvider62B779F7.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.ts similarity index 88% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.ts index b52f1ab82f154..5d2ecbff7e4cc 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-service-account-sdk-call.ts @@ -1,13 +1,13 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecrAssets from '@aws-cdk/aws-ecr-assets'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack, CfnOutput, Duration } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecrAssets from 'aws-cdk-lib/aws-ecr-assets'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, Stack, CfnOutput, Duration } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as cdk8s from 'cdk8s'; import * as kplus from 'cdk8s-plus-24'; import { BucketPinger } from './bucket-pinger/bucket-pinger'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; const app = new App(); const stack = new Stack(app, 'aws-eks-service-account-sdk-calls-test'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js new file mode 100644 index 0000000000000..300757dcde132 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ pragma:disable-update-workflow +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_kubernetes_version_1 = require("./integ-tests-kubernetes-version"); +const eks = require("aws-cdk-lib/aws-eks"); +class EksFargateClusterStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + new eks.FargateCluster(this, 'FargateCluster', { + ...(0, integ_tests_kubernetes_version_1.getClusterVersionConfig)(this), + prune: false, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new EksFargateClusterStack(app, 'aws-cdk-eks-fargate-cluster-test'); +new integ.IntegTest(app, 'aws-cdk-eks-fargate-cluster', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZmFyZ2F0ZS1jbHVzdGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZmFyZ2F0ZS1jbHVzdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQTZDO0FBQzdDLDZDQUF5QztBQUN6QyxvREFBb0Q7QUFDcEQscUZBQTJFO0FBQzNFLDJDQUEyQztBQUUzQyxNQUFNLHNCQUF1QixTQUFRLG1CQUFLO0lBRXhDLFlBQVksS0FBVSxFQUFFLEVBQVU7UUFDaEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLGdCQUFnQixFQUFFO1lBQzdDLEdBQUcsSUFBQSx3REFBdUIsRUFBQyxJQUFJLENBQUM7WUFDaEMsS0FBSyxFQUFFLEtBQUs7U0FDYixDQUFDLENBQUM7SUFDTCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLHNCQUFzQixDQUFDLEdBQUcsRUFBRSxrQ0FBa0MsQ0FBQyxDQUFDO0FBQ2xGLElBQUksS0FBSyxDQUFDLFNBQVMsQ0FBQyxHQUFHLEVBQUU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ge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..20eaaaacd094c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..2c7edd6dec44c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..9583c462aede6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c475180f5b1bbabac165414da13a9b843b111cd3b6d5fae9c954c006640c4064.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/aws-cdk-eks-fargate-cluster-test.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.assets.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.assets.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclusterDefaultTestDeployAssert7DCC5E4C.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksClusterResourceProviderB8887E20.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksClusterResourceProviderB8887E20.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksClusterResourceProviderB8887E20.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksClusterResourceProviderB8887E20.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksKubectlProviderB383571D.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksKubectlProviderB383571D.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksKubectlProviderB383571D.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/awscdkeksfargateclustertestawscdkawseksKubectlProviderB383571D.nested.template.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.ts similarity index 80% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.ts index 432c25de5eea3..dbe581f746476 100644 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.fargate-cluster.ts @@ -1,8 +1,8 @@ /// !cdk-integ pragma:disable-update-workflow -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { getClusterVersionConfig } from './integ-tests-kubernetes-version'; -import * as eks from '../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; class EksFargateClusterStack extends Stack { diff --git a/packages/@aws-cdk/aws-eks/test/pinger/function/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/function/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/pinger/function/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/function/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.d.ts new file mode 100644 index 0000000000000..ef3bafb60d235 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.d.ts @@ -0,0 +1,13 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Construct } from 'constructs'; +export interface PingerProps { + readonly url: string; + readonly securityGroup?: ec2.SecurityGroup; + readonly vpc?: ec2.IVpc; + readonly subnets?: ec2.ISubnet[]; +} +export declare class Pinger extends Construct { + private _resource; + constructor(scope: Construct, id: string, props: PingerProps); + get response(): string; +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.js new file mode 100644 index 0000000000000..53ae564243873 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Pinger = void 0; +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cr = require("aws-cdk-lib/custom-resources"); +const constructs_1 = require("constructs"); +class Pinger extends constructs_1.Construct { + constructor(scope, id, props) { + super(scope, id); + const func = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(`${__dirname}/function`), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + vpc: props.vpc, + vpcSubnets: props.subnets ? { subnets: props.subnets } : undefined, + securityGroups: props.securityGroup ? [props.securityGroup] : undefined, + timeout: aws_cdk_lib_1.Duration.minutes(10), + }); + const provider = new cr.Provider(this, 'Provider', { + onEventHandler: func, + }); + this._resource = new aws_cdk_lib_1.CustomResource(this, 'Resource', { + serviceToken: provider.serviceToken, + properties: { + Url: props.url, + }, + }); + } + get response() { + return aws_cdk_lib_1.Token.asString(this._resource.getAtt('Value')); + } +} +exports.Pinger = Pinger; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGluZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicGluZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI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lzLl9yZXNvdXJjZS5nZXRBdHQoJ1ZhbHVlJykpO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.ts new file mode 100644 index 0000000000000..1dd0b7076d08d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/pinger/pinger.ts @@ -0,0 +1,45 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { CustomResource, Token, Duration } from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import { Construct } from 'constructs'; + +export interface PingerProps { + readonly url: string; + readonly securityGroup?: ec2.SecurityGroup; + readonly vpc?: ec2.IVpc; + readonly subnets?: ec2.ISubnet[]; +} +export class Pinger extends Construct { + + private _resource: CustomResource; + + constructor(scope: Construct, id: string, props: PingerProps) { + super(scope, id); + + const func = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(`${__dirname}/function`), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + vpc: props.vpc, + vpcSubnets: props.subnets ? { subnets: props.subnets } : undefined, + securityGroups: props.securityGroup ? [props.securityGroup] : undefined, + timeout: Duration.minutes(10), + }); + + const provider = new cr.Provider(this, 'Provider', { + onEventHandler: func, + }); + + this._resource = new CustomResource(this, 'Resource', { + serviceToken: provider.serviceToken, + properties: { + Url: props.url, + }, + }); + } + + public get response() { + return Token.asString(this._resource.getAtt('Value')); + } +} diff --git a/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore similarity index 100% rename from packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore diff --git a/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile diff --git a/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json similarity index 100% rename from packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json diff --git a/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/sdk-call.js b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/sdk-call.js similarity index 100% rename from packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/sdk-call.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/sdk-call-integ-test-docker-app/app/sdk-call.js diff --git a/packages/@aws-cdk/aws-eks/test/test-chart/Chart.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/test-chart/Chart.yaml similarity index 100% rename from packages/@aws-cdk/aws-eks/test/test-chart/Chart.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/test-chart/Chart.yaml diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js new file mode 100644 index 0000000000000..0e36b3d5717f0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const elb = require("aws-cdk-lib/aws-elasticloadbalancing"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elb-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 1, +}); +new elb.LoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + listeners: [{ + externalPort: 80, + allowConnectionsFrom: [ec2.Peer.anyIpv4()], + }], + healthCheck: { + port: 80, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWxiLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZWxiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsNERBQTREO0FBRTVELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLENBQUMsQ0FBQztBQUV0RCxNQ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ICBleHRlcm5hbFBvcnQ6IDgwLFxuICAgIGFsbG93Q29ubmVjdGlvbnNGcm9tOiBbZWMyLlBlZXIuYW55SXB2NCgpXSxcbiAgfV0sXG4gIGhlYWx0aENoZWNrOiB7XG4gICAgcG9ydDogODAsXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/aws-cdk-elb-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.firelens-cloudwatch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.ts new file mode 100644 index 0000000000000..762a0e03240fb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.elb.ts @@ -0,0 +1,25 @@ +#!/usr/bin/env node +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elb-integ'); + +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 1, +}); + +new elb.LoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + listeners: [{ + externalPort: 80, + allowConnectionsFrom: [ec2.Peer.anyIpv4()], + }], + healthCheck: { + port: 80, + }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js new file mode 100644 index 0000000000000..7641d13a24885 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js @@ -0,0 +1,43 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +// eslint-disable-next-line import/no-extraneous-dependencies +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const elb = require("aws-cdk-lib/aws-elasticloadbalancing"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elb-instance-target-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 1, +}); +const instance = new ec2.Instance(stack, 'targetInstance', { + vpc: vpc, + instanceType: ec2.InstanceType.of(// t2.micro has free tier usage in aws + ec2.InstanceClass.T3, ec2.InstanceSize.MICRO), + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + initOptions: { + timeout: cdk.Duration.minutes(30), + }, + init: ec2.CloudFormationInit.fromElements(ec2.InitService.systemdConfigFile('pythonweb', { + command: '/usr/bin/python3 -m http.server 8080', + cwd: '/var/www/html', + }), ec2.InitService.enable('pythonweb', { + serviceManager: ec2.ServiceManager.SYSTEMD, + }), ec2.InitFile.fromString('/var/www/html/index.html', 'Hello! You can see me!')), +}); +instance.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSSMManagedInstanceCore')); +const elbalancer = new elb.LoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); +elbalancer.addTarget(new elb.InstanceTarget(instance)); +elbalancer.addListener({ externalPort: 80, internalPort: 8080 }); +new integ.IntegTest(app, 'InstanceTargetTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2VUYXJnZXQuZWxiLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW5zdGFuY2VUYXJnZXQuZWxiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyw2REFBNkQ7QUFDN0QsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsNERBQTREO0FBRTVELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsbUNBQW1DLENBQUMsQ0FBQztBQUV0RSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRTtJQUNwQyxNQUFNLEVBQUUsQ0FBQztDQUNWLENBQUMsQ0FBQztBQUVILE1BQU0sUUFBUSxHQUFHLElBQUksR0FBRyxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUU7SUFDekQsR0FBRyxFQUFFLEdBQUc7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NhbiBzZWUgbWUhJyksXG4gICksXG59KTtcbmluc3RhbmNlLnJvbGUuYWRkTWFuYWdlZFBvbGljeShpYW0uTWFuYWdlZFBvbGljeS5mcm9tQXdzTWFuYWdlZFBvbGljeU5hbWUoJ0FtYXpvblNTTU1hbmFnZWRJbnN0YW5jZUNvcmUnKSk7XG5cbmNvbnN0IGVsYmFsYW5jZXIgPSBuZXcgZWxiLkxvYWRCYWxhbmNlcihzdGFjaywgJ0xCJywge1xuICB2cGMsXG4gIGludGVybmV0RmFjaW5nOiB0cnVlLFxufSk7XG5cbmVsYmFsYW5jZXIuYWRkVGFyZ2V0KG5ldyBlbGIuSW5zdGFuY2VUYXJnZXQoaW5zdGFuY2UpKTtcbmVsYmFsYW5jZXIuYWRkTGlzdGVuZXIoeyBleHRlcm5hbFBvcnQ6IDgwLCBpbnRlcm5hbFBvcnQ6IDgwODAgfSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnSW5zdGFuY2VUYXJnZXRUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/InstanceTargetTestDefaultTestDeployAssertAF607556.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/aws-cdk-elb-instance-target-integ.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.ts similarity index 85% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.ts index a54154a229971..67ba1910ea4c5 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.instanceTarget.elb.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancing/test/integ.instanceTarget.elb.ts @@ -1,10 +1,10 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; // eslint-disable-next-line import/no-extraneous-dependencies -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as elb from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elb-instance-target-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js new file mode 100644 index 0000000000000..30db45b2a04b9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cognito = require("aws-cdk-lib/aws-cognito"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const actions = require("aws-cdk-lib/aws-elasticloadbalancingv2-actions"); +// This test can only be run as a dry-run at this time due to requiring a certificate +class CognitoStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'Stack', { + maxAzs: 2, + }); + const certificate = { + certificateArn: process.env.SELF_SIGNED_CERT_ARN ?? '', + }; + const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, + }); + const userPool = new cognito.UserPool(this, 'UserPool'); + const userPoolClient = new cognito.UserPoolClient(this, 'Client', { + userPool, + // Required minimal configuration for use with an ELB + generateSecret: true, + authFlows: { + userPassword: true, + }, + oAuth: { + flows: { + authorizationCodeGrant: true, + }, + scopes: [cognito.OAuthScope.EMAIL], + callbackUrls: [ + `https://${lb.loadBalancerDnsName}/oauth2/idpresponse`, + ], + }, + }); + const cfnClient = userPoolClient.node.defaultChild; + cfnClient.addPropertyOverride('RefreshTokenValidity', 1); + cfnClient.addPropertyOverride('SupportedIdentityProviders', ['COGNITO']); + const userPoolDomain = new cognito.UserPoolDomain(this, 'Domain', { + userPool, + cognitoDomain: { + domainPrefix: 'test-cdk-prefix', + }, + }); + lb.addListener('Listener', { + port: 443, + certificates: [certificate], + defaultAction: new actions.AuthenticateCognitoAction({ + userPool, + userPoolClient, + userPoolDomain, + next: elbv2.ListenerAction.fixedResponse(200, { + contentType: 'text/plain', + messageBody: 'Authenticated', + }), + }), + }); + new aws_cdk_lib_1.CfnOutput(this, 'DNS', { + value: lb.loadBalancerDnsName, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new CognitoStack(app, 'integ-cognito'); +new integ.IntegTest(app, 'integ-test-cognito', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29nbml0by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ZXJQb29sQ2xpZW50LFxuICAgICAgICB1c2VyUG9vbERvbWFpbixcbiAgICAgICAgbmV4dDogZWxidjIuTGlzdGVuZXJBY3Rpb24uZml4ZWRSZXNwb25zZSgyMDAsIHtcbiAgICAgICAgICBjb250ZW50VHlwZTogJ3RleHQvcGxhaW4nLFxuICAgICAgICAgIG1lc3NhZ2VCb2R5OiAnQXV0aGVudGljYXRlZCcsXG4gICAgICAgIH0pLFxuICAgICAgfSksXG4gICAgfSk7XG5cbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdETlMnLCB7XG4gICAgICB2YWx1ZTogbGIubG9hZEJhbGFuY2VyRG5zTmFtZSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCB0ZXN0Q2FzZSA9IG5ldyBDb2duaXRvU3RhY2soYXBwLCAnaW50ZWctY29nbml0bycpO1xubmV3IGludGVnLkludGVnVGVzdChhcHAsICdpbnRlZy10ZXN0LWNvZ25pdG8nLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuXG5hcHAuc3ludGgoKTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ-cognito.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/integtestcognitoDefaultTestDeployAssert6F2623C9.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.ts similarity index 86% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.ts index c8f3964d1f00e..0d3e33d3c5e2b 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-actions/test/integ.cognito.ts @@ -1,10 +1,10 @@ -import * as cognito from '@aws-cdk/aws-cognito'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as actions from '../lib'; +import * as actions from 'aws-cdk-lib/aws-elasticloadbalancingv2-actions'; // This test can only be run as a dry-run at this time due to requiring a certificate class CognitoStack extends Stack { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js new file mode 100644 index 0000000000000..12d4c5d094a8e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const patterns = require("aws-cdk-lib/aws-ecs-patterns"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-elasticloadbalancingv2-targets"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 1 }); + const task = new ecs.FargateTaskDefinition(this, 'Task', { cpu: 256, memoryLimitMiB: 512 }); + task.addContainer('nginx', { + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:latest'), + portMappings: [{ containerPort: 80 }], + }); + const svc = new patterns.ApplicationLoadBalancedFargateService(this, 'Service', { + vpc, + taskDefinition: task, + publicLoadBalancer: false, + }); + const nlb = new elbv2.NetworkLoadBalancer(this, 'Nlb', { + vpc, + crossZoneEnabled: true, + internetFacing: true, + }); + const listener = nlb.addListener('listener', { + port: 80, + }); + const target = listener.addTargets('Targets', { + targets: [new targets.AlbTarget(svc.loadBalancer, 80)], + port: 80, + healthCheck: { + protocol: elbv2.Protocol.HTTP, + }, + }); + target.node.addDependency(svc.listener); + new aws_cdk_lib_1.CfnOutput(this, 'NlbEndpoint', { value: `http://${nlb.loadBalancerDnsName}` }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'TestStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLXRhcmdldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFsYi10YXJnZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLHlEQUF5RDtBQUN6RCxnRUFBZ0U7QUFDaEUsNkNBQWdFO0FBRWhFLDBFQUEwRTtBQUUxRSxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtB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4gICAgICBwdWJsaWNMb2FkQmFsYW5jZXI6IGZhbHNlLFxuICAgIH0pO1xuXG4gICAgY29uc3QgbmxiID0gbmV3IGVsYnYyLk5ldHdvcmtMb2FkQmFsYW5jZXIodGhpcywgJ05sYicsIHtcbiAgICAgIHZwYyxcbiAgICAgIGNyb3NzWm9uZUVuYWJsZWQ6IHRydWUsXG4gICAgICBpbnRlcm5ldEZhY2luZzogdHJ1ZSxcbiAgICB9KTtcbiAgICBjb25zdCBsaXN0ZW5lciA9IG5sYi5hZGRMaXN0ZW5lcignbGlzdGVuZXInLCB7XG4gICAgICBwb3J0OiA4MCxcbiAgICB9KTtcblxuICAgIGNvbnN0IHRhcmdldCA9IGxpc3RlbmVyLmFkZFRhcmdldHMoJ1RhcmdldHMnLCB7XG4gICAgICB0YXJnZXRzOiBbbmV3IHRhcmdldHMuQWxiVGFyZ2V0KHN2Yy5sb2FkQmFsYW5jZXIsIDgwKV0sXG4gICAgICBwb3J0OiA4MCxcbiAgICAgIGhlYWx0aENoZWNrOiB7XG4gICAgICAgIHByb3RvY29sOiBlbGJ2Mi5Qcm90b2NvbC5IVFRQLFxuICAgICAgfSxcbiAgICB9KTtcbiAgICB0YXJnZXQubm9kZS5hZGREZXBlbmRlbmN5KHN2Yy5saXN0ZW5lcik7XG5cbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdObGJFbmRwb2ludCcsIHsgdmFsdWU6IGBodHRwOi8vJHtubGIubG9hZEJhbGFuY2VyRG5zTmFtZX1gIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBUZXN0U3RhY2soYXBwLCAnVGVzdFN0YWNrJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.nlb-awsvpc-nw.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.ts similarity index 78% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.ts index 431258346c10b..7c8a18450d9d1 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.ts @@ -1,10 +1,10 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as patterns from '@aws-cdk/aws-ecs-patterns'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, CfnOutput, Stack, StackProps } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as patterns from 'aws-cdk-lib/aws-ecs-patterns'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { App, CfnOutput, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as targets from '../lib'; +import * as targets from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js new file mode 100644 index 0000000000000..b787f16266f68 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-elasticloadbalancingv2-targets"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'Stack', { maxAzs: 2, natGateways: 1 }); + const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true }); + const listener = lb.addListener('Listener', { port: 80 }); + const fn = new lambda.Function(this, 'Fun', { + code: lambda.Code.fromInline(` +def handler(event, context): + return { + "isBase64Encoded": False, + "statusCode": 200, + "statusDescription": "200 OK", + "headers": { + "Set-cookie": "cookies", + "Content-Type": "application/json" + }, + "body": "Hello from Lambda" + } + `), + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'index.handler', + }); + listener.addTargets('Targets', { + targets: [new targets.LambdaTarget(fn)], + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'TestStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLXRhcmdldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxhbWJkYS10YXJnZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsZ0VBQWdFO0FBQ2hFLGlEQUFpRDtBQUNqRCw2Q0FBeUM7QUFFekMsMEVBQTBFO0FBRTFFLE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVO1FBQ3RDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxPQUFPLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLFdBQVcsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO1FBRXRFLE1BQU0sRUFBRSxHQUFHLElBQUksS0FBSyxDQUFDLHVCQUF1QixDQUFDLElBQUksRUFBRSxJQUFJLEVBQUUsRUFBRSxHQUFHLEVBQUUsY0FBYyxFQUFFLElBQUksRUFBRSxDQUFDLENBQUM7UUFDeEYsTUFBTSxRQUFRLEdBQUcsRUFBRSxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUUsRUFBRSxJQUFJLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0FBQztRQUUxRCxNQUFNLEVBQUUsR0FBRyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxFQUFFLEtBQUssRUFBRTtZQU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zOiBbbmV3IHRhcmdldHMuTGFtYmRhVGFyZ2V0KGZuKV0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdUZXN0U3RhY2snKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.runtime.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.ts similarity index 78% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.ts index c3436b22f70ee..86136cd46629c 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as targets from '../lib'; +import * as targets from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets'; class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js new file mode 100644 index 0000000000000..572ca49fe76d0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js @@ -0,0 +1,35 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + http2Enabled: false, + idleTimeout: cdk.Duration.seconds(1000), + dropInvalidHeaderFields: true, + desyncMitigationMode: elbv2.DesyncMitigationMode.DEFENSIVE, +}); +new elbv2.ApplicationLoadBalancer(stack, 'DesyncMitigationModeMonitor', { + vpc, + internetFacing: true, + desyncMitigationMode: elbv2.DesyncMitigationMode.MONITOR, +}); +new elbv2.ApplicationLoadBalancer(stack, 'DesyncMitigationModeStrictest', { + vpc, + internetFacing: true, + desyncMitigationMode: elbv2.DesyncMitigationMode.STRICTEST, +}); +new integ.IntegTest(app, 'Elbv2Test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLmF0dHJpYnV0ZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hbGIuYXR0cmlidXRlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxnRUFBZ0U7QUFFaEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxxQkFBcUIsQ0FBQyxDQUFDO0FBRXhELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ3BDLE1BQU0sRUFBRSxDQUFDO0NBQ1YsQ0FBQyxDQUFDO0FBRUgsSUFBSSxLQUFLLENBQUMsdUJBQXVCLENBQUMsS0FBSyxFQUFFLElBQUksRUFBRTtJQUM3QyxHQUFHO0lBQ0gsY0FBYyxFQUFFLElBQUk7SUFDcEIsWUFBWSxFQUFFLEtBQUs7SUFDbkIsV0FBVyx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gdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/Elbv2TestDefaultTestDeployAssert82DC2DEA.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.secret.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.ts similarity index 80% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.ts index 61aeece0d3812..f9951436907a5 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.attributes.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js new file mode 100644 index 0000000000000..258377accf4b1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js @@ -0,0 +1,92 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +/* IPv6 workaround found here: https://github.com/aws/aws-cdk/issues/894 */ +const valueOrDie = (value, err) => { + if (value === undefined) { + throw err; + } + return value; +}; +/** + * Integration test to deployability and use of dualstack ALB. Creates an ALB + * with dualstack ipAddresType and an ipv6Block to add to VPC subnets. Main + * test is for the inclusion of default IPv6 ingress rule. + * + * Stack Verification steps: + * VPC is created with subnets that allow for IPv6 connection and then dualstack + * ALB attaches a listener with dualstack that defaults IPv4/IPv6 ingress rule. + * + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const ipv6Block = new ec2.CfnVPCCidrBlock(stack, 'IPv6_Block', { + vpcId: vpc.vpcId, + amazonProvidedIpv6CidrBlock: true, +}); +// Get the vpc's internet gateway so we can create default routes for the +// public subnets. +const internetGateway = valueOrDie(vpc.node.children.find(c => c instanceof ec2.CfnInternetGateway), new Error('Couldnt find an internet gateway')); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + ipAddressType: elbv2.IpAddressType.DUAL_STACK, + internetFacing: true, +}); +const listener = lb.addListener('Listener', { + port: 80, +}); +const group1 = listener.addTargets('Target', { + port: 80, + targets: [new elbv2.IpTarget('10.0.128.6')], +}); +const group2 = listener.addTargets('ConditionalTarget', { + priority: 10, + hostHeader: 'example.com', + port: 80, + targets: [new elbv2.IpTarget('10.0.128.5')], +}); +vpc.publicSubnets.forEach((subnet, idx) => { + // Add a default ipv6 route to the subnet's route table. + const unboxedSubnet = subnet; + unboxedSubnet.addRoute('IPv6Default', { + routerId: internetGateway.ref, + routerType: ec2.RouterType.GATEWAY, + destinationIpv6CidrBlock: '::/0', + }); + // Find a CfnSubnet (raw cloudformation resources) child to the public + // subnet nodes. + const cfnSubnet = valueOrDie(subnet.node.children.find(c => c instanceof ec2.CfnSubnet), new Error('Couldnt find a CfnSubnet')); + // Use the intrinsic Fn::Cidr CloudFormation function on the VPC's + // first IPv6 block to determine ipv6 /64 cidrs for each subnet as + // a function of the public subnet's index. + const vpcCidrBlock = cdk.Fn.select(0, vpc.vpcIpv6CidrBlocks); + const ipv6Cidrs = cdk.Fn.cidr(vpcCidrBlock, vpc.publicSubnets.length, '64'); + cfnSubnet.ipv6CidrBlock = cdk.Fn.select(idx, ipv6Cidrs); + // The subnet depends on the ipv6 cidr being allocated. + cfnSubnet.addDependency(ipv6Block); + group1.node.addDependency(subnet); + group2.node.addDependency(subnet); +}); +listener.addAction('action1', { + priority: 1, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['example.com']), + ], + action: elbv2.ListenerAction.fixedResponse(200, { messageBody: 'success' }), +}); +group1.metricTargetResponseTime().createAlarm(stack, 'ResponseTimeHigh1', { + threshold: 5, + evaluationPeriods: 2, +}); +group2.metricTargetResponseTime().createAlarm(stack, 'ResponseTimeHigh2', { + threshold: 5, + evaluationPeriods: 2, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLmR1YWxzdGFjay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFsYi5kdWFsc3RhY2sudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUVuQyxnRUFBZ0U7QUFFaEUsMkVBQTJFO0FBQzNFLE1BQU0sVUFBVSxHQUFHLENBQXFCLEtBQW9CLEVBQUUsR0FBVSxFQUFLLEVBQUU7SUFDN0UsSUFBSSxLQUFLLEtBQUssU0FBUyxFQUFFO1FBQUUsTUFBTSxHQUFHLENBQUM7S0FBRTtJQUN2QyxPQUFPLEtBQVUsQ0FBQztBQUNwQixDQUFDLENBQUM7QUFFRjs7Ozs7Ozs7O0dBU0c7QUFDSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHFCQUFxQixDQUFDLENBQUM7QUFFeEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUU7SUFDcEMsTUFBTSxFQUFFLENBQUM7Q0FDVixDQUFDLENBQUM7QUFFSCxNQUFNLFNBQVMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxlQUFlLENBQ3ZDLEtBQUssRUFDTCxZQUFZLEVBQ1o7SUFDRSxLQUFLLEVBQUUsR0FBRyxDQUFDLEtBQUs7SUFDaEIsMkJBQTJCLEVBQUUsSUFBSTtDQUNsQyxDQUNGLENBQUM7QUFFRix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XG4gIGFjdGlvbjogZWxidjIuTGlzdGVuZXJBY3Rpb24uZml4ZWRSZXNwb25zZSgyMDAsIHsgbWVzc2FnZUJvZHk6ICdzdWNjZXNzJyB9KSxcbn0pO1xuXG5ncm91cDEubWV0cmljVGFyZ2V0UmVzcG9uc2VUaW1lKCkuY3JlYXRlQWxhcm0oc3RhY2ssICdSZXNwb25zZVRpbWVIaWdoMScsIHtcbiAgdGhyZXNob2xkOiA1LFxuICBldmFsdWF0aW9uUGVyaW9kczogMixcbn0pO1xuXG5ncm91cDIubWV0cmljVGFyZ2V0UmVzcG9uc2VUaW1lKCkuY3JlYXRlQWxhcm0oc3RhY2ssICdSZXNwb25zZVRpbWVIaWdoMicsIHtcbiAgdGhyZXNob2xkOiA1LFxuICBldmFsdWF0aW9uUGVyaW9kczogMixcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.ts similarity index 95% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.ts index 40034ed72c1c8..f7b957ae1f1d6 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.dualstack.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { IConstruct } from 'constructs'; -import * as elbv2 from '../lib'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; /* IPv6 workaround found here: https://github.com/aws/aws-cdk/issues/894 */ const valueOrDie = (value: T | undefined, err: Error): C => { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js new file mode 100644 index 0000000000000..0a520432add12 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js @@ -0,0 +1,46 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); +const listener = lb.addListener('Listener', { + port: 80, +}); +const group1 = listener.addTargets('Target', { + port: 80, + targets: [new elbv2.IpTarget('10.0.128.6')], + stickinessCookieDuration: cdk.Duration.minutes(5), +}); +const group2 = listener.addTargets('ConditionalTarget', { + priority: 10, + hostHeader: 'example.com', + port: 80, + targets: [new elbv2.IpTarget('10.0.128.5')], + stickinessCookieDuration: cdk.Duration.minutes(5), + stickinessCookieName: 'MyDeliciousCookie', + slowStart: cdk.Duration.minutes(1), +}); +group1.metricTargetResponseTime().createAlarm(stack, 'ResponseTimeHigh1', { + threshold: 5, + evaluationPeriods: 2, +}); +group2.metricTargetResponseTime().createAlarm(stack, 'ResponseTimeHigh2', { + threshold: 5, + evaluationPeriods: 2, +}); +vpc.publicSubnets.forEach(subnet => { + group2.node.addDependency(subnet); + group1.node.addDependency(subnet); +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYWxiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsZ0VBQWdFO0FBRWhFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUscUJBQXFCLENBQUMsQ0FBQztBQUV4RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRTtJQUNwQyxNQUFNLEVBQUUsQ0FBQztDQUNWLENBQUMsQ0FBQztBQUVILE1BQU0sRUFBRSxHQUFHLElBQUksS0FBSyxDQUFDLHVCQUF1QixDQUFDLEtBQUssRUFBRSxJQUFJL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mV0ID0+IHtcbiAgZ3JvdXAyLm5vZGUuYWRkRGVwZW5kZW5jeShzdWJuZXQpO1xuICBncm91cDEubm9kZS5hZGREZXBlbmRlbmN5KHN1Ym5ldCk7XG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/integ.cognito.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.ts similarity index 88% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.ts index ea17101adc678..7606c64d12334 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js new file mode 100644 index 0000000000000..d6efd0da9d8ec --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js @@ -0,0 +1,49 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); +const listener = lb.addListener('Listener', { + port: 80, +}); +const group1 = listener.addTargets('Target', { + port: 80, + targets: [new elbv2.IpTarget('10.0.128.4')], +}); +const group2 = listener.addTargets('ConditionalTarget', { + priority: 10, + hostHeader: 'example.com', + port: 80, + targets: [new elbv2.IpTarget('10.0.128.5')], +}); +listener.addAction('action1', { + priority: 1, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['example.com']), + ], + action: elbv2.ListenerAction.fixedResponse(200, { messageBody: 'success' }), +}); +group1.metricTargetResponseTime().createAlarm(stack, 'ResponseTimeHigh1', { + threshold: 5, + evaluationPeriods: 2, +}); +group2.metricTargetResponseTime().createAlarm(stack, 'ResponseTimeHigh2', { + threshold: 5, + evaluationPeriods: 2, +}); +vpc.publicSubnets.forEach(subnet => { + group2.node.addDependency(subnet); + group1.node.addDependency(subnet); +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWxiMi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFsYjIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxnRUFBZ0U7QUFFaEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxxQkFBcUIsQ0FBQyxDQUFDO0FBRXhELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ3BDLE1BQU0sRUFBRSxDQUFDO0NBQ1YsQ0FBQyxDQUFDO0FBRUgsTUFBTSxFQUFFLEdBQUcsSUFBSSxLQUFLLENBQUMsdUJBQXVCLENBQUMsS0FBSyxFQUFFLElBQUksRUFBRTtJQUN4RCxHQUFHO0lBQ0gsY0FBYyxFQUFFLElBQUk7Q0FDckIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxRQUFRLEdBQUcsRUFBRSxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUU7SUFDMUMsSUFBSSxFQUFFLEVBQUU7Q0FDVCxDQUFDLENBQUM7QUFFSCxNQUFNLE1BQU0sR0FBRyxRQUFRLENBQUMsVUFBVSxDQUF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bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.ts similarity index 89% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.ts index af5e95258f8d1..3b18e8205ff4d 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.alb2.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js new file mode 100644 index 0000000000000..4e8fddd8eff8c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js @@ -0,0 +1,34 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); +const targetGroup = new elbv2.NetworkTargetGroup(stack, 'TG', { + vpc, + port: 443, + deregistrationDelay: aws_cdk_lib_1.Duration.seconds(5), + connectionTermination: true, +}); +lb.addListener('listener', { + port: 443, + defaultTargetGroups: [targetGroup], +}); +targetGroup.node.addDependency(vpc.internetConnectivityEstablished); +// The target's security group must allow being routed by the LB and the clients. +new integ.IntegTest(app, 'targetGroupTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json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bmNvbnN0IHRhcmdldEdyb3VwID0gbmV3IGVsYnYyLk5ldHdvcmtUYXJnZXRHcm91cChzdGFjaywgJ1RHJywge1xuICB2cGMsXG4gIHBvcnQ6IDQ0MyxcbiAgZGVyZWdpc3RyYXRpb25EZWxheTogRHVyYXRpb24uc2Vjb25kcyg1KSxcbiAgY29ubmVjdGlvblRlcm1pbmF0aW9uOiB0cnVlLFxufSk7XG5cbmxiLmFkZExpc3RlbmVyKCdsaXN0ZW5lcicsIHtcbiAgcG9ydDogNDQzLFxuICBkZWZhdWx0VGFyZ2V0R3JvdXBzOiBbdGFyZ2V0R3JvdXBdLFxufSk7XG5cbnRhcmdldEdyb3VwLm5vZGUuYWRkRGVwZW5kZW5jeSh2cGMuaW50ZXJuZXRDb25uZWN0aXZpdHlFc3RhYmxpc2hlZCk7XG5cbi8vIFRoZSB0YXJnZXQncyBzZWN1cml0eSBncm91cCBtdXN0IGFsbG93IGJlaW5nIHJvdXRlZCBieSB0aGUgTEIgYW5kIHRoZSBjbGllbnRzLlxubmV3IGludGVnLkludGVnVGVzdChhcHAsICd0YXJnZXRHcm91cFRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/integ.lambda-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/targetGroupTestDefaultTestDeployAssert29FB5AEF.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.ts similarity index 75% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.ts index 884b9cce8305a..95340e28542b4 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.ts @@ -1,9 +1,9 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { Duration } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js new file mode 100644 index 0000000000000..50904f849ba22 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js @@ -0,0 +1,97 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +const stackWithLb = new cdk.Stack(app, 'aws-cdk-elbv2-StackWithLb', { + env: { + account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION, + }, +}); +const vpc = new ec2.Vpc(stackWithLb, 'VPC', { + maxAzs: 2, + vpcName: 'my-vpc-name', +}); +const lb = new elbv2.NetworkLoadBalancer(stackWithLb, 'LB', { + vpc, + internetFacing: true, + loadBalancerName: 'my-load-balancer', +}); +const listener = lb.addListener('Listener', { + port: 443, +}); +const group = listener.addTargets('TargetGroup', { + port: 443, + targets: [new elbv2.IpTarget('10.0.1.1')], +}); +new cdk.CfnOutput(stackWithLb, 'NlbArn', { + value: lb.loadBalancerArn, + exportName: 'NlbArn', +}); +new cdk.CfnOutput(stackWithLb, 'TgArn', { + value: group.targetGroupArn, + exportName: 'TgArn', +}); +const stackLookup = new integ_tests_alpha_1.IntegTestCaseStack(app, 'aws-cdk-elbv2-integ-StackUnderTest', { + env: { + account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION, + }, +}); +// Load Balancer +const lbByHardcodedArn = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stackLookup, 'NlbByHardcodedArn', { + loadBalancerArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188', +}); +lbByHardcodedArn.metrics.activeFlowCount().createAlarm(stackLookup, 'NlbByHardcodedArn_AlarmFlowCount', { + evaluationPeriods: 1, + threshold: 0, +}); +const lbByCfnOutputsFromAnotherStackOutsideCdk = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stackLookup, 'NlbByCfnOutputsFromAnotherStackOutsideCdk', { + loadBalancerArn: cdk.Fn.importValue('NlbArn'), +}); +lbByCfnOutputsFromAnotherStackOutsideCdk.metrics.activeFlowCount().createAlarm(stackLookup, 'NlbByCfnOutputsFromAnotherStackOutsideCdk_AlarmFlowCount', { + evaluationPeriods: 1, + threshold: 0, +}); +const lbByCfnOutputsFromAnotherStackWithinCdk = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stackLookup, 'NlbByCfnOutputsFromAnotherStackWithinCdk', { + loadBalancerArn: lb.loadBalancerArn, +}); +lbByCfnOutputsFromAnotherStackWithinCdk.metrics.activeFlowCount().createAlarm(stackLookup, 'NlbByCfnOutputsFromAnotherStackWithinCdk_AlarmFlowCount', { + evaluationPeriods: 1, + threshold: 0, +}); +// Target Group +const tgByHardcodedArn = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stackLookup, 'TgByHardcodedArn', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', + loadBalancerArns: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/net/my-load-balancer/50dc6c495c0c9188', +}); +tgByHardcodedArn.metrics.healthyHostCount().createAlarm(stackLookup, 'TgByHardcodedArn_HealthyHostCount', { + evaluationPeriods: 1, + threshold: 0, +}); +const tgByCfnOutputsFromAnotherStackOutsideCdk = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stackLookup, 'TgByCfnOutputsFromAnotherStackOutsideCdk', { + targetGroupArn: cdk.Fn.importValue('TgArn'), + loadBalancerArns: cdk.Fn.importValue('NlbArn'), +}); +tgByCfnOutputsFromAnotherStackOutsideCdk.metrics.healthyHostCount().createAlarm(stackLookup, 'TgByCfnOutputsFromAnotherStackOutsideCdk_HealthyHostCount', { + evaluationPeriods: 1, + threshold: 0, +}); +const tgByCfnOutputsFromAnotherStackWithinCdk = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stackLookup, 'TgByCfnOutputsFromAnotherStackWithinCdk', { + targetGroupArn: group.targetGroupArn, + loadBalancerArns: lb.loadBalancerArn, +}); +tgByCfnOutputsFromAnotherStackWithinCdk.metrics.healthyHostCount().createAlarm(stackLookup, 'TgByCfnOutputsFromAnotherStackWithinCdk_HealthyHostCount', { + evaluationPeriods: 1, + threshold: 0, +}); +new integ.IntegTest(app, 'elbv2-integ', { + testCases: [stackLookup], + enableLookups: true, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmxiLWxvb2t1cC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm5sYi1sb29rdXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxrRUFBZ0U7QUFDaEUsZ0VBQWdFO0FBRWhFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sV0FBVyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMkJBQTJCLEVBQUU7SUFDbEUsR0FBRyxFQUFFO1FBQ0gsT0FBTyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxtQkFBbUI7UUFDekUsTUFBTSxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsZ0JBQWdCLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxrQkFBa0I7S0FDdkU7Q0FDRixDQUFDLENBQUM7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsV0FBV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ws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-StackWithLb.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/aws-cdk-elbv2-integ-StackUnderTest.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestDeployAssert483BFB1A.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/awscdkelbv2integStackUnderTestawscdkelbv2integStackUnderTestTestCaseDeployAssert8C1D9093.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.ts similarity index 93% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.ts index 2bd2bbc8e1866..14d230a776481 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb-lookup.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb-lookup.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { IntegTestCaseStack } from '@aws-cdk/integ-tests'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { IntegTestCaseStack } from '@aws-cdk/integ-tests-alpha'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); const stackWithLb = new cdk.Stack(app, 'aws-cdk-elbv2-StackWithLb', { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js new file mode 100644 index 0000000000000..42728d335c47a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); +const listener = lb.addListener('Listener', { + port: 443, +}); +const group = listener.addTargets('Target', { + port: 443, + targets: [new elbv2.IpTarget('10.0.1.1')], +}); +group.configureHealthCheck({ + interval: cdk.Duration.seconds(250), + protocol: elbv2.Protocol.TCP, +}); +vpc.publicSubnets.forEach(subnet => group.node.addDependency(subnet)); +group.node.addDependency(vpc.internetConnectivityEstablished); +// The target's security group must allow being routed by the LB and the clients. +new integ.IntegTest(app, 'elbv2-integ', { + testCases: [stack], +}); +app.synth(); +//# sourceMapping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R3b3JrTG9hZEJhbGFuY2VyKHN0YWNrLCAnTEInLCB7XG4gIHZwYyxcbiAgaW50ZXJuZXRGYWNpbmc6IHRydWUsXG59KTtcblxuY29uc3QgbGlzdGVuZXIgPSBsYi5hZGRMaXN0ZW5lcignTGlzdGVuZXInLCB7XG4gIHBvcnQ6IDQ0Myxcbn0pO1xuXG5jb25zdCBncm91cCA9IGxpc3RlbmVyLmFkZFRhcmdldHMoJ1RhcmdldCcsIHtcbiAgcG9ydDogNDQzLFxuICB0YXJnZXRzOiBbbmV3IGVsYnYyLklwVGFyZ2V0KCcxMC4wLjEuMScpXSxcbn0pO1xuXG5ncm91cC5jb25maWd1cmVIZWFsdGhDaGVjayh7XG4gIGludGVydmFsOiBjZGsuRHVyYXRpb24uc2Vjb25kcygyNTApLFxuICBwcm90b2NvbDogZWxidjIuUHJvdG9jb2wuVENQLFxufSk7XG5cbnZwYy5wdWJsaWNTdWJuZXRzLmZvckVhY2goc3VibmV0ID0+IGdyb3VwLm5vZGUuYWRkRGVwZW5kZW5jeShzdWJuZXQpKTtcbmdyb3VwLm5vZGUuYWRkRGVwZW5kZW5jeSh2cGMuaW50ZXJuZXRDb25uZWN0aXZpdHlFc3RhYmxpc2hlZCk7XG5cbi8vIFRoZSB0YXJnZXQncyBzZWN1cml0eSBncm91cCBtdXN0IGFsbG93IGJlaW5nIHJvdXRlZCBieSB0aGUgTEIgYW5kIHRoZSBjbGllbnRzLlxuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2VsYnYyLWludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/elbv2integDefaultTestDeployAssert6120E394.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.ts similarity index 80% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.ts index 43e2e30ca572e..02e216094e6ba 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.nlb.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js new file mode 100644 index 0000000000000..abe6944e2bdb5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const app = new cdk.App(); +class VpcEndpointServiceStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC'); + const nlbNoPrincipals = new elbv2.NetworkLoadBalancer(this, 'NLBNoPrincipals', { + vpc, + }); + const service1 = new ec2.VpcEndpointService(this, 'MyVpcEndpointServiceWithNoPrincipals', { + vpcEndpointServiceLoadBalancers: [nlbNoPrincipals], + acceptanceRequired: false, + allowedPrincipals: [], + }); + const nlbWithPrincipals = new elbv2.NetworkLoadBalancer(this, 'NLBWithPrincipals', { + vpc, + }); + const principalArn = new aws_iam_1.ArnPrincipal('arn:aws:iam::123456789012:root'); + const service2 = new ec2.VpcEndpointService(this, 'MyVpcEndpointServiceWithPrincipals', { + vpcEndpointServiceLoadBalancers: [nlbWithPrincipals], + acceptanceRequired: false, + allowedPrincipals: [principalArn], + }); + new cdk.CfnOutput(this, 'MyVpcEndpointServiceWithNoPrincipalsServiceName', { + exportName: 'ServiceName', + value: service1.vpcEndpointServiceName, + description: 'Give this to service consumers so they can connect via VPC Endpoint', + }); + new cdk.CfnOutput(this, 'MyVpcEndpointServiceWithPrincipalsEndpointServiceId', { + exportName: 'EndpointServiceId', + value: service2.vpcEndpointServiceId, + description: 'Reference this service from other stacks', + }); + } +} +new VpcEndpointServiceStack(app, 'aws-cdk-ec2-vpc-endpoint-service'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWVuZHBvaW50LXNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52cGMtZW5kcG9pbnQtc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxpREFBbUQ7QUFDbkQsbUNBQW1DO0FBQ25DLGdFQUFnRTtBQUV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d2VkUHJpbmNpcGFsczogW3ByaW5jaXBhbEFybl0sXG4gICAgfSk7XG5cbiAgICBuZXcgY2RrLkNmbk91dHB1dCh0aGlzLCAnTXlWcGNFbmRwb2ludFNlcnZpY2VXaXRoTm9QcmluY2lwYWxzU2VydmljZU5hbWUnLCB7XG4gICAgICBleHBvcnROYW1lOiAnU2VydmljZU5hbWUnLFxuICAgICAgdmFsdWU6IHNlcnZpY2UxLnZwY0VuZHBvaW50U2VydmljZU5hbWUsXG4gICAgICBkZXNjcmlwdGlvbjogJ0dpdmUgdGhpcyB0byBzZXJ2aWNlIGNvbnN1bWVycyBzbyB0aGV5IGNhbiBjb25uZWN0IHZpYSBWUEMgRW5kcG9pbnQnLFxuICAgIH0pO1xuXG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ015VnBjRW5kcG9pbnRTZXJ2aWNlV2l0aFByaW5jaXBhbHNFbmRwb2ludFNlcnZpY2VJZCcsIHtcbiAgICAgIGV4cG9ydE5hbWU6ICdFbmRwb2ludFNlcnZpY2VJZCcsXG4gICAgICB2YWx1ZTogc2VydmljZTIudnBjRW5kcG9pbnRTZXJ2aWNlSWQsXG4gICAgICBkZXNjcmlwdGlvbjogJ1JlZmVyZW5jZSB0aGlzIHNlcnZpY2UgZnJvbSBvdGhlciBzdGFja3MnLFxuICAgIH0pO1xuICB9XG59XG5cbm5ldyBWcGNFbmRwb2ludFNlcnZpY2VTdGFjayhhcHAsICdhd3MtY2RrLWVjMi12cGMtZW5kcG9pbnQtc2VydmljZScpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.assets.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/aws-cdk-ec2-vpc-endpoint-service.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.dualstack.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.ts similarity index 88% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.ts index 92a39f118637c..eac5c727c6451 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { ArnPrincipal } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { ArnPrincipal } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js new file mode 100644 index 0000000000000..aac98e230b200 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const serviceLinkedRole = new aws_cdk_lib_1.CfnResource(this, 'ServiceLinkedRole', { + type: 'AWS::IAM::ServiceLinkedRole', + properties: { + AWSServiceName: 'es.amazonaws.com', + Description: 'Role for ElasticSearch VPC Test', + }, + }); + const vpc = new ec2.Vpc(this, 'Vpc'); + const domainProps = { + version: es.ElasticsearchVersion.V7_1, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + vpc, + zoneAwareness: { + enabled: true, + }, + capacity: { + dataNodes: 2, + }, + }; + const domain = new es.Domain(this, 'Domain', domainProps); + domain.node.addDependency(serviceLinkedRole); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'cdk-integ-elasticsearch-vpc'); +new integ.IntegTest(app, 'cdk-integ-elasticsearch-vpc-test', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWxhc3RpY3NlYXJjaC12cGMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5lbGFzdGljc2VhcmNoLXZwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyw2Q0FBaUY7QUFDakYsb0RBQW9EO0FBRXBELG9EQUFvRDtBQUVwRCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0saUJBQWlCLEdBQUcsSUFBSSx5QkFBVyxDQUFDLElBQUksRUFBRSxtQkFBbUIsRUFBRTtZQUNuRSxJQUFJLEVBQUUsNkJBQTZCO1lBQ25DLFVBQVUsRUFBRTtnQkFDVixjQUFjLEVBQUUsa0JBQWtCO2dCQUNsQyxXQUFXLEVBQUUsaUNBQWlDO2FBQy9DO1NBQ0YsQ0FBQyxDQUFDO1FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsQ0FBQztRQUNyQyxNQUFNLFdBQVcsR0FBbUI7WUFDbEMsT0FBTyxFQUFFLEVBQUUsQ0FBQyxvQkFBb0IsQ0FBQyxJQUFJO1lBQ3JDLGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87WUFDcEMsR0FBRztZQUNILGFBQWEsRUFBRTtnQkFDYixPQUFPLEVBQUUsSUFBSTthQUNkO1lBQ0QsUUFBUSxFQUFFO2dCQUNSLFNBQVMsRUFBRSxDQUFDO2FBQ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k7XG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2Nkay1pbnRlZy1lbGFzdGljc2VhcmNoLXZwYy10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk-integ-elasticsearch-vpc.template.json diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/fargate/integ.service-connect.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdkintegelasticsearchvpctestDefaultTestDeployAssert0B044175.template.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.ts similarity index 86% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.ts index 7ae9c070896c8..82c6e7d908bc1 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch-vpc.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, Stack, StackProps, RemovalPolicy, CfnResource } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { App, Stack, StackProps, RemovalPolicy, CfnResource } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as es from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js new file mode 100644 index 0000000000000..9ef4bace8a5e7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const user = new aws_iam_1.User(this, 'User'); + new es.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: es.ElasticsearchVersion.V7_1, + fineGrainedAccessControl: { + masterUserArn: user.userArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-elasticsearch-advancedsecurity'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWxhc3RpY3NlYXJjaC5hZHZhbmNlZHNlY3VyaXR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZWxhc3RpY3NlYXJjaC5hZHZhbmNlZHNlY3Vya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zLWNkay1saWInO1xuaW1wb3J0IHsgQ29uc3RydWN0IH0gZnJvbSAnY29uc3RydWN0cyc7XG5pbXBvcnQgKiBhcyBlcyBmcm9tICdhd3MtY2RrLWxpYi9hd3MtZWxhc3RpY3NlYXJjaCc7XG5cbmNsYXNzIFRlc3RTdGFjayBleHRlbmRzIFN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBjb25zdCB1c2VyID0gbmV3IFVzZXIodGhpcywgJ1VzZXInKTtcblxuICAgIG5ldyBlcy5Eb21haW4odGhpcywgJ0RvbWFpbicsIHtcbiAgICAgIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICAgIHZlcnNpb246IGVzLkVsYXN0aWNzZWFyY2hWZXJzaW9uLlY3XzEsXG4gICAgICBmaW5lR3JhaW5lZEFjY2Vzc0NvbnRyb2w6IHtcbiAgICAgICAgbWFzdGVyVXNlckFybjogdXNlci51c2VyQXJuLFxuICAgICAgfSxcbiAgICAgIGVuY3J5cHRpb25BdFJlc3Q6IHtcbiAgICAgICAgZW5hYmxlZDogdHJ1ZSxcbiAgICAgIH0sXG4gICAgICBub2RlVG9Ob2RlRW5jcnlwdGlvbjogdHJ1ZSxcbiAgICAgIGVuZm9yY2VIdHRwczogdHJ1ZSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1lbGFzdGljc2VhcmNoLWFkdmFuY2Vkc2VjdXJpdHknKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk-integ-elasticsearch-advancedsecurity.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.ts similarity index 79% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.ts index 828a5c9fe75e7..f19c2efe081dd 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.ts @@ -1,7 +1,7 @@ -import { User } from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { User } from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as es from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js new file mode 100644 index 0000000000000..034ea884ac02c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const key = new kms.Key(this, 'Key'); + const domainProps = { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: es.ElasticsearchVersion.V7_1, + ebs: { + volumeSize: 10, + volumeType: aws_ec2_1.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + logging: { + slowSearchLogEnabled: true, + appLogEnabled: true, + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + kmsKey: key, + }, + // test the access policies custom resource works + accessPolicies: [ + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['es:ESHttp*'], + principals: [new iam.AccountRootPrincipal()], + resources: ['*'], + }), + ], + }; + new es.Domain(this, 'Domain', domainProps); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-elasticsearch-custom-kms-key'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWxhc3RpY3NlYXJjaC5jdXN0b20ta21zLWtleS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmVsYXN0aWNzZWFyY2guY3VzdG9tLWttcy1rZXkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBMEQ7QUFDMUQsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyw2Q0FBb0U7QUFFcEUsb0RBQW9EO0FBRXBELE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsQ0FBQztRQUVyQyxNQUFNLFdBQVcsR0FBbUI7WUFDbEMsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztZQUNwQyxPQUFPLEVBQUUsRUFBRSxDQUFDLG9CQUFvQixDQUFDLElBQUk7WUFDckMsR0FBRyxFQUFFO2dCQUNILFVBQVUsRUFBRSxFQUFFO2dCQUNkLFVBQVUsRUFBRSw2QkFBbUIsQ0FBQyxtQkFBbUI7YUFDcEQ7WUFDRCxPQUFPLEVBQUU7Z0JBQ1Asb0JBQW9CLEVBQUUsSUFBSTtnQkFDMUIsYU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IG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgICAgICAgICBlZmZlY3Q6IGlhbS5FZmZlY3QuQUxMT1csXG4gICAgICAgICAgYWN0aW9uczogWydlczpFU0h0dHAqJ10sXG4gICAgICAgICAgcHJpbmNpcGFsczogW25ldyBpYW0uQWNjb3VudFJvb3RQcmluY2lwYWwoKV0sXG4gICAgICAgICAgcmVzb3VyY2VzOiBbJyonXSxcbiAgICAgICAgfSksXG4gICAgICBdLFxuICAgIH07XG5cbiAgICBuZXcgZXMuRG9tYWluKHRoaXMsICdEb21haW4nLCBkb21haW5Qcm9wcyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctZWxhc3RpY3NlYXJjaC1jdXN0b20ta21zLWtleScpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk-integ-elasticsearch-custom-kms-key.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.launch-template.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.ts similarity index 80% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.ts index 1c1d3493d5057..0a1092e72daed 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.ts @@ -1,9 +1,9 @@ -import { EbsDeviceVolumeType } from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { EbsDeviceVolumeType } from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as es from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js new file mode 100644 index 0000000000000..e88b02eb0f179 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const domainProps = { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: es.ElasticsearchVersion.V7_1, + ebs: { + volumeSize: 10, + volumeType: aws_ec2_1.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + logging: { + slowSearchLogEnabled: true, + appLogEnabled: true, + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + advancedOptions: { + 'rest.action.multi.allow_explicit_index': 'false', + 'indices.fielddata.cache.size': '25', + 'indices.query.bool.max_clause_count': '2048', + }, + // test the access policies custom resource works + accessPolicies: [ + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['es:ESHttp*'], + principals: [new iam.AccountRootPrincipal()], + resources: ['*'], + }), + ], + }; + // create 2 elasticsearch domains to ensure that Cloudwatch Log Group policy names dont conflict + new es.Domain(this, 'Domain1', domainProps); + new es.Domain(this, 'Domain2', domainProps); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-elasticsearch'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWxhc3RpY3NlYXJjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmVsYXN0aWNzZWFyY2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBMEQ7QUFDMUQsMkNBQTJDO0FBQzNDLDZDQUFvRTtBQUVwRSxvREFBb0Q7QUFFcEQsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLFdBQVcsR0FBbUI7WUFDbEMsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztZQUNwQyxPQUFPLEVBQUUsRUFBRSxDQUFDLG9CQUFvQixDQUFDLElBQUk7WUFDckMsR0FBRyxFQUFFO2dCQUNILFVBQVUsRUFBRSxFQUFFO2dCQUNkLFVBQVUsRUFBRSw2QkFBbUIsQ0FBQyxtQkFBbUI7YUFDcEQ7WUFDRCxPQUFPLEVBQUU7Z0JBQ1Asb0JBQW9CLEVBQUUsSUFBSTtnQkFDMUIsYUFBYSxFQUFFLElBQUk7YUFDcEI7WUFDRCxvQkFBb0IsRUFBRSxJQUFJO1lBQzFCLGdCQUFnQixFQ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ZpZWxkZGF0YS5jYWNoZS5zaXplJzogJzI1JyxcbiAgICAgICAgJ2luZGljZXMucXVlcnkuYm9vbC5tYXhfY2xhdXNlX2NvdW50JzogJzIwNDgnLFxuICAgICAgfSxcbiAgICAgIC8vIHRlc3QgdGhlIGFjY2VzcyBwb2xpY2llcyBjdXN0b20gcmVzb3VyY2Ugd29ya3NcbiAgICAgIGFjY2Vzc1BvbGljaWVzOiBbXG4gICAgICAgIG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgICAgICAgICBlZmZlY3Q6IGlhbS5FZmZlY3QuQUxMT1csXG4gICAgICAgICAgYWN0aW9uczogWydlczpFU0h0dHAqJ10sXG4gICAgICAgICAgcHJpbmNpcGFsczogW25ldyBpYW0uQWNjb3VudFJvb3RQcmluY2lwYWwoKV0sXG4gICAgICAgICAgcmVzb3VyY2VzOiBbJyonXSxcbiAgICAgICAgfSksXG4gICAgICBdLFxuICAgIH07XG5cbiAgICAvLyBjcmVhdGUgMiBlbGFzdGljc2VhcmNoIGRvbWFpbnMgdG8gZW5zdXJlIHRoYXQgQ2xvdWR3YXRjaCBMb2cgR3JvdXAgcG9saWN5IG5hbWVzIGRvbnQgY29uZmxpY3RcbiAgICBuZXcgZXMuRG9tYWluKHRoaXMsICdEb21haW4xJywgZG9tYWluUHJvcHMpO1xuICAgIG5ldyBlcy5Eb21haW4odGhpcywgJ0RvbWFpbjInLCBkb21haW5Qcm9wcyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctZWxhc3RpY3NlYXJjaCcpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk-integ-elasticsearch.template.json diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ts similarity index 85% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ts index dfef1fe48b1b9..9a33c02d903ef 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ts @@ -1,8 +1,8 @@ -import { EbsDeviceVolumeType } from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { EbsDeviceVolumeType } from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as es from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js new file mode 100644 index 0000000000000..16926dd9cedb9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new es.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: es.ElasticsearchVersion.V7_1, + capacity: { + masterNodes: 2, + warmNodes: 2, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-elasticsearch-ultrawarm'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZW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gVGVzdFN0YWNrIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQ29uc3RydWN0LCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIG5ldyBlcy5Eb21haW4odGhpcywgJ0RvbWFpbicsIHtcbiAgICAgIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICAgIHZlcnNpb246IGVzLkVsYXN0aWNzZWFyY2hWZXJzaW9uLlY3XzEsXG4gICAgICBjYXBhY2l0eToge1xuICAgICAgICBtYXN0ZXJOb2RlczogMixcbiAgICAgICAgd2FybU5vZGVzOiAyLFxuICAgICAgfSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1lbGFzdGljc2VhcmNoLXVsdHJhd2FybScpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk-integ-elasticsearch-ultrawarm.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb2.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.ts similarity index 79% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.ts index c7c581252fc7e..4335f41710d3f 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.ts @@ -1,6 +1,6 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as es from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js new file mode 100644 index 0000000000000..5c93d50450a88 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const es = require("aws-cdk-lib/aws-elasticsearch"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new es.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: es.ElasticsearchVersion.V7_1, + useUnsignedBasicAuth: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-elasticsearch-unsignedbasicauth'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWxhc3RpY3NlYXJjaC51bnNpZ25lZGJhc2ljYXV0aC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmVsYXN0aWNzZWFyY2gudW5zaWduZWRiYXNpY2F1dGgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBb0U7QUFFcEUsb0RBQW9EO0FBRXBELE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUU7WUFDNUIsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztZQUNwQyxPQUFPLEVBQUUsRUFBRSxDQUFDLG9CQUFvQixDQUFDLElBQUk7WUFDckMsb0JBQW9CLEVBQUUsSUFBSTtTQUMzQixDQUFDLENBQUM7SUFDTCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixJQUFJLFNBQVMsQ0FBQyxHQUFHLEVBQUUsMkNBQTJDLENBQUMsQ0FBQztBQUNoRSxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBcHAsIFJlbW92YWxQb2xpY3ksIFN0YWNrLCBTdGFja1Byb3BzIH0gZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgQ29uc3RydWN0IH0gZnJvbSAnY29uc3RydWN0cyc7XG5pbXBvcnQgKiBhcyBlcyBmcm9tICdhd3MtY2RrLWxpYi9hd3MtZWxhc3RpY3NlYXJjaCc7XG5cbmNsYXNzIFRlc3RTdGFjayBleHRlbmRzIFN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBuZXcgZXMuRG9tYWluKHRoaXMsICdEb21haW4nLCB7XG4gICAgICByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gICAgICB2ZXJzaW9uOiBlcy5FbGFzdGljc2VhcmNoVmVyc2lvbi5WN18xLFxuICAgICAgdXNlVW5zaWduZWRCYXNpY0F1dGg6IHRydWUsXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctZWxhc3RpY3NlYXJjaC11bnNpZ25lZGJhc2ljYXV0aCcpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.assets.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.assets.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.template.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk-integ-elasticsearch-unsignedbasicauth.template.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.custom-kms-key.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.ts similarity index 78% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.ts index 5e7fb2787972d..3b5c317c91d3e 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.ts @@ -1,6 +1,6 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as es from '../lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js new file mode 100644 index 0000000000000..7311802cdfbc9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +class AwsApi extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // Force new deployment of 'cool-service' and stop 'dev-instance' at midnight everyday + const scheduleRule = new events.Rule(this, 'ScheduleRule', { + schedule: events.Schedule.cron({ + hour: '0', + minute: '0', + }), + }); + scheduleRule.addTarget(new targets.AwsApi({ + service: 'ECS', + action: 'updateService', + parameters: { + service: 'cool-service', + forceNewDeployment: true, + }, + })); + scheduleRule.addTarget(new targets.AwsApi({ + service: 'RDS', + action: 'stopDBInstance', + parameters: { + DBInstanceIdentifier: 'dev-instance', + }, + })); + // Create snapshots when a DB instance restarts + const patternRule = new events.Rule(this, 'PatternRule', { + eventPattern: { + detailType: ['RDS DB Instance Event'], + detail: { + Message: ['DB instance restarted'], + }, + }, + }); + patternRule.addTarget(new targets.AwsApi({ + service: 'RDS', + action: 'createDBSnapshot', + parameters: { + DBInstanceIdentifier: events.EventField.fromPath('$.detail.SourceArn'), + }, + })); + } +} +new AwsApi(app, 'aws-cdk-aws-api-target-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXdzLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmF3cy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLDBEQUEwRDtBQUUxRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLE1BQU8sU0FBUSxHQUFHLENBQUMsS0FBSztJQUM1QixZQUFZLEtBQWMsRUFBRSxFQUFVLEVBQUUsS0FBc0I7UUFDNUQsS0FBSyxDQUFDLEtB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AgICAgICB9LFxuICAgICAgfSxcbiAgICB9KTtcblxuICAgIHBhdHRlcm5SdWxlLmFkZFRhcmdldChuZXcgdGFyZ2V0cy5Bd3NBcGkoe1xuICAgICAgc2VydmljZTogJ1JEUycsXG4gICAgICBhY3Rpb246ICdjcmVhdGVEQlNuYXBzaG90JyxcbiAgICAgIHBhcmFtZXRlcnM6IHtcbiAgICAgICAgREJJbnN0YW5jZUlkZW50aWZpZXI6IGV2ZW50cy5FdmVudEZpZWxkLmZyb21QYXRoKCckLmRldGFpbC5Tb3VyY2VBcm4nKSxcbiAgICAgIH0gYXMgQVdTLlJEUy5DcmVhdGVEQlNuYXBzaG90TWVzc2FnZSxcbiAgICB9KSk7XG4gIH1cbn1cblxubmV3IEF3c0FwaShhcHAsICdhd3MtY2RrLWF3cy1hcGktdGFyZ2V0LWludGVnJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/asset.b4065f27128bfec53dda4059f9632e1a428f29038cfaaf8b3a4fd7185beac355/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/asset.b4065f27128bfec53dda4059f9632e1a428f29038cfaaf8b3a4fd7185beac355/index.js similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/asset.b4065f27128bfec53dda4059f9632e1a428f29038cfaaf8b3a4fd7185beac355/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/asset.b4065f27128bfec53dda4059f9632e1a428f29038cfaaf8b3a4fd7185beac355/index.js diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/aws-cdk-aws-api-target-integ.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.connection-termination.nlb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.ts similarity index 91% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.ts index 9dc135dfef993..c63b7aa29e272 100644 --- a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/aws-api/integ.aws-api.ts @@ -1,6 +1,6 @@ -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../../lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js new file mode 100644 index 0000000000000..529a5e1b26616 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js @@ -0,0 +1,48 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const events = require("aws-cdk-lib/aws-events"); +const sns = require("aws-cdk-lib/aws-sns"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codebuild-events'); +const repo = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'aws-cdk-codebuild-events', +}); +const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.codeCommit({ repository: repo }), +}); +const queue = new sqs.Queue(stack, 'MyQueue'); +const deadLetterQueue = new sqs.Queue(stack, 'DeadLetterQueue'); +const topic = new sns.Topic(stack, 'MyTopic'); +topic.addSubscription(new subs.SqsSubscription(queue)); +// this will send an email with the JSON event for every state change of this +// build project. +project.onStateChange('StateChange', { target: new targets.SnsTopic(topic) }); +// this will send an email with the message "Build phase changed to ". +// The phase will be extracted from the "completed-phase" field of the event +// details. +project.onPhaseChange('PhaseChange', { + target: new targets.SnsTopic(topic, { + message: events.RuleTargetInput.fromText(`Build phase changed to ${codebuild.PhaseChangeEvent.completedPhase}`), + }), +}); +// trigger a build when a commit is pushed to the repo +const onCommitRule = repo.onCommit('OnCommit', { + target: new targets.CodeBuildProject(project, { + deadLetterQueue: deadLetterQueue, + maxEventAge: cdk.Duration.hours(2), + retryAttempts: 2, + }), + branches: ['master'], +}); +onCommitRule.addTarget(new targets.SnsTopic(topic, { + message: events.RuleTargetInput.fromText(`A commit was pushed to the repository ${codecommit.ReferenceEvent.repositoryName} on branch ${codecommit.ReferenceEvent.referenceName}`), +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvamVjdC1ldmVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm9qZWN0LWV2ZW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSx1REFBdUQ7QUFDdkQseURBQXlEO0FBQ3pELGlEQUFpRDtBQUNqRCwyQ0FBMkM7QUFDM0MsMERBQTBEO0FBQzFELDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMERBQTBEO0FBRTFELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMEJBQTBCLENBQUMsQ0FBQztBQUU3RCxNQUFNLElBQUksR0FBRyxJQUFJLFVBQVUsQ0FBQyxVQUFVLENBQUMsS0FBSyxFQUFFLFFBQVEsRUFBRTtJQUN0RCxjQUFjLEVBQUUsMEJBQTBCO0NBQzNDLENBQUMsQ0FBQztBQUNILE1BQU0sT0FBTyxHQUFHLElBQUksU0FBUyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsV0FBVyxFQUFFO0lBQ3hELE1BQU0sRUFBRSxTQUFTLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxFQUFFLFVBQVUsRUFBRSxJQUFJLEVBQUUsQ0FBQztDQUMxRCxDQUFDLENBQUM7QUFFSCxNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsS0FBSyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0FBQzlDLE1BQU0sZUFBZ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TmFtZX1gLFxuICApLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/aws-cdk-codebuild-events.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.vpc-endpoint-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.ts similarity index 80% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.ts index 83b48805d2387..fd3ff0a03cd39 100644 --- a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codebuild/integ.project-events.ts @@ -1,12 +1,12 @@ #!/usr/bin/env node -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as events from '@aws-cdk/aws-events'; -import * as sns from '@aws-cdk/aws-sns'; -import * as subs from '@aws-cdk/aws-sns-subscriptions'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js new file mode 100644 index 0000000000000..4f02f036470db --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codecommit = require("aws-cdk-lib/aws-codecommit"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const events = require("aws-cdk-lib/aws-events"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +class MockAction { + constructor(props) { + this.actionProperties = props; + this.configuration = props.configuration; + } + bind(_scope, _stage, _options) { + return { + configuration: this.configuration, + }; + } + onStateChange(_name, _target, _options) { + throw new Error('onStateChange() is not available on MockAction'); + } +} +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'pipeline-events'); +const repo = new codecommit.Repository(stack, 'Repo', { + repositoryName: 'TestRepository', +}); +const pipeline = new codepipeline.Pipeline(stack, 'pipelinePipeline22F2A91D'); +const srcArtifact = new codepipeline.Artifact('Src'); +pipeline.addStage({ + stageName: 'Source', + actions: [new MockAction({ + actionName: 'CodeCommit', + category: codepipeline.ActionCategory.SOURCE, + provider: 'CodeCommit', + artifactBounds: { minInputs: 0, maxInputs: 0, minOutputs: 1, maxOutputs: 1 }, + configuration: { + RepositoryName: repo.repositoryName, + BranchName: 'master', + }, + outputs: [srcArtifact], + })], +}); +pipeline.addStage({ + stageName: 'Build', + actions: [new MockAction({ + actionName: 'Hello', + category: codepipeline.ActionCategory.APPROVAL, + provider: 'Manual', + artifactBounds: { minInputs: 0, maxInputs: 0, minOutputs: 0, maxOutputs: 0 }, + })], +}); +let queue = new sqs.Queue(stack, 'dlq'); +new events.Rule(stack, 'rule', { + schedule: events.Schedule.expression('rate(1 minute)'), + targets: [new targets.CodePipeline(pipeline, { + deadLetterQueue: queue, + maxEventAge: cdk.Duration.hours(2), + retryAttempts: 2, + })], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtZXZlbnQtdGFyZ2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtZXZlbnQtdGFyZ2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseURBQXlEO0FBQ3pELDZEQUE2RDtBQUM3RCxpREFBaUQ7QUFDakQsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUVuQywwREFBMEQ7QUFNMUQsTUFBTSxVQUFVO0lBSWQsWUFBWSxLQUFzQjtRQUNoQyxJQUFJLENBQUMsZ0JBQWdCLEdBQUcsS0FBSyxDQUFDO1FBQzlCLElBQUksQ0FBQyxhQUFhLEdBQUcsS0FBSyxDQUFDLGFBQWEsQ0FBQztJQUMzQyxDQUFDO0lBRU0sSUFBSSxDQUFDLE1BQTRCL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YXJnZXRzLkNvZGVQaXBlbGluZShwaXBlbGluZSwge1xuICAgIGRlYWRMZXR0ZXJRdWV1ZTogcXVldWUsXG4gICAgbWF4RXZlbnRBZ2U6IGNkay5EdXJhdGlvbi5ob3VycygyKSxcbiAgICByZXRyeUF0dGVtcHRzOiAyLFxuICB9KV0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.advancedsecurity.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/pipeline-events.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.ts similarity index 87% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.ts index dafad82627605..a09a82218a771 100644 --- a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/codepipeline/integ.pipeline-event-target.ts @@ -1,10 +1,10 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as events from '@aws-cdk/aws-events'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; import * as constructs from 'constructs'; -import * as targets from '../../lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; interface MockActionProps extends codepipeline.ActionProperties { configuration?: any; diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/eventhandler-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/eventhandler-image/Dockerfile diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/eventhandler-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/eventhandler-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/eventhandler-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/eventhandler-image/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js new file mode 100644 index 0000000000000..7425178f1fac5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const events = require("aws-cdk-lib/aws-events"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-ecs'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), +}); +const deadLetterQueue = new sqs.Queue(stack, 'MyDeadLetterQueue'); +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'eventhandler-image')), + memoryLimitMiB: 256, + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' }), +}); +// An Rule that describes the event trigger (in this case a scheduled run) +const rule = new events.Rule(stack, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +// Use EcsTask as the target of the Rule +rule.addTarget(new targets.EcsTask({ + cluster, + taskDefinition, + taskCount: 1, + containerOverrides: [{ + containerName: 'TheContainer', + environment: [ + { name: 'I_WAS_TRIGGERED', value: 'From CloudWatch Events' }, + ], + }], + deadLetterQueue, +})); +new integ.IntegTest(app, 'EcsTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXZlbnQtZWMyLXRhc2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5ldmVudC1lYzItdGFzay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLGlEQUFpRDtBQUNqRCwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCwwREFBMEQ7QUFFMUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBRXRELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFFckQsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FBQyxDQUFDO0FBQzlELE9BQU8sQ0FBQyxXQUFXLENBQUMseUJBQXlCLEVBQUU7SUFDN0MsWUFBWSxFQUFFLElBQUksR0FBRyxDQUFDLFlBQVksQ0FBQyxVQUFVLENBQUM7Q0FDL0MsQ0FBQyxDQUFDO0FBRUgsTUFBTSxlQUFlLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEtB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ZXJyaWRlczogW3tcbiAgICBjb250YWluZXJOYW1lOiAnVGhlQ29udGFpbmVyJyxcbiAgICBlbnZpcm9ubWVudDogW1xuICAgICAgeyBuYW1lOiAnSV9XQVNfVFJJR0dFUkVEJywgdmFsdWU6ICdGcm9tIENsb3VkV2F0Y2ggRXZlbnRzJyB9LFxuICAgIF0sXG4gIH1dLFxuICBkZWFkTGV0dGVyUXVldWUsXG59KSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnRWNzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/EcsTestDefaultTestDeployAssert8B2741C4.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/aws-ecs-integ-ecs.template.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.ultrawarm.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.ts similarity index 80% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.ts index f387c57cb7caf..9803c8c172e44 100644 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-ec2-task.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as targets from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js new file mode 100644 index 0000000000000..812729851d254 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const events = require("aws-cdk-lib/aws-events"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); +const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); +const deadLetterQueue = new sqs.Queue(stack, 'MyDeadLetterQueue'); +// Create a Task Definition for the container to start +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'eventhandler-image')), + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' }), +}); +// A rule that describes the event trigger (in this case a scheduled run) +const rule = new events.Rule(stack, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +// Use EcsTask as the target of the Rule +rule.addTarget(new targets.EcsTask({ + cluster, + taskDefinition, + taskCount: 1, + containerOverrides: [{ + containerName: 'TheContainer', + environment: [ + { name: 'I_WAS_TRIGGERED', value: 'From CloudWatch Events' }, + ], + }], + deadLetterQueue, +})); +new integ.IntegTest(app, 'EcsFargateTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXZlbnQtZmFyZ2F0ZS10YXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZXZlbnQtZmFyZ2F0ZS10YXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELDBEQUEwRDtBQUUxRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHVCQUF1QixDQUFDLENBQUM7QUFFMUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRSxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQUM7QUFFOUQsTUFBTSxlQUFlLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEtBQUssRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBRWxFLHNEQUFzRDtBQUN0RCxNQU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VnVGVzdChhcHAsICdFY3NGYXJnYXRlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/EcsFargateTestDefaultTestDeployAssert36341BFB.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/aws-ecs-integ-fargate.template.json diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.alb.attributes.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.ts similarity index 78% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.ts index c1f0c9b93aa0f..81af86efa0825 100644 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/ecs/integ.event-fargate-task.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as targets from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js new file mode 100644 index 0000000000000..68b2dcbe6794f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +class EventSourceStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.expression('rate(1 minute)'), + }); + const queue = new sqs.Queue(this, 'Queue'); + rule.addTarget(new targets.EventBus(events.EventBus.fromEventBusArn(this, 'External', `arn:aws:events:${this.region}:999999999999:event-bus/test-bus`), { + deadLetterQueue: queue, + })); + } +} +new EventSourceStack(app, 'event-source-stack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXZlbnQtYnVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZXZlbnQtYnVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMERBQTBEO0FBRTFELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sZ0JBQWlCLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDdEMsWUFBWSxLQUFjLEVBQUUsRUFBVSxFQUFFLEtBQXNCO1FBQzVELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sSUFBSSxHQUFHLElBQUksTUFBTSxDQUFDL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1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBjb25zdCBydWxlID0gbmV3IGV2ZW50cy5SdWxlKHRoaXMsICdSdWxlJywge1xuICAgICAgc2NoZWR1bGU6IGV2ZW50cy5TY2hlZHVsZS5leHByZXNzaW9uKCdyYXRlKDEgbWludXRlKScpLFxuICAgIH0pO1xuXG4gICAgY29uc3QgcXVldWUgPSBuZXcgc3FzLlF1ZXVlKHRoaXMsICdRdWV1ZScpO1xuXG4gICAgcnVsZS5hZGRUYXJnZXQobmV3IHRhcmdldHMuRXZlbnRCdXMoXG4gICAgICBldmVudHMuRXZlbnRCdXMuZnJvbUV2ZW50QnVzQXJuKFxuICAgICAgICB0aGlzLFxuICAgICAgICAnRXh0ZXJuYWwnLFxuICAgICAgICBgYXJuOmF3czpldmVudHM6JHt0aGlzLnJlZ2lvbn06OTk5OTk5OTk5OTk5OmV2ZW50LWJ1cy90ZXN0LWJ1c2AsXG4gICAgICApLFxuICAgICAge1xuICAgICAgICBkZWFkTGV0dGVyUXVldWU6IHF1ZXVlLFxuICAgICAgfSxcbiAgICApKTtcbiAgfVxufVxuXG5uZXcgRXZlbnRTb3VyY2VTdGFjayhhcHAsICdldmVudC1zb3VyY2Utc3RhY2snKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/aws-api/integ.aws-api.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/event-source-stack.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.ts similarity index 77% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.ts index 7874121359afc..e097bdeb0ac87 100644 --- a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/event-bus/integ.event-bus.ts @@ -1,7 +1,7 @@ -import * as events from '@aws-cdk/aws-events'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../../lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js new file mode 100644 index 0000000000000..fd95254116b4d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const iam = require("aws-cdk-lib/aws-iam"); +const firehose = require("aws-cdk-lib/aws-kinesisfirehose"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +// --------------------------------- +// Define a rule that triggers a put to a Kinesis stream every 1min. +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-firehose-event-target'); +const bucket = new s3.Bucket(stack, 'firehose-bucket'); +const firehoseRole = new iam.Role(stack, 'firehose-role', { + assumedBy: new iam.ServicePrincipal('firehose.amazonaws.com'), +}); +const stream = new firehose.CfnDeliveryStream(stack, 'MyStream', { + extendedS3DestinationConfiguration: { + bucketArn: bucket.bucketArn, + roleArn: firehoseRole.roleArn, + }, +}); +bucket.grantReadWrite(firehoseRole); +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +event.addTarget(new targets.KinesisFirehoseStream(stream, {})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2luZXNpcy1maXJlaG9zZS1zdHJlYW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5raW5lc2lzLWZpcmVob3NlLXN0cmVhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRDtBQUNqRCwyQ0FBMkM7QUFDM0MsNERBQTREO0FBQzVELHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsMERBQTBEO0FBRTFELG9DQUFvQztBQUNwQyxvRUFBb0U7QUFFcEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFD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1Y2tldEFybjogYnVja2V0LmJ1Y2tldEFybixcbiAgICByb2xlQXJuOiBmaXJlaG9zZVJvbGUucm9sZUFybixcbiAgfSxcbn0pO1xuYnVja2V0LmdyYW50UmVhZFdyaXRlKGZpcmVob3NlUm9sZSk7XG5cbmNvbnN0IGV2ZW50ID0gbmV3IGV2ZW50cy5SdWxlKHN0YWNrLCAnRXZlcnlNaW51dGUnLCB7XG4gIHNjaGVkdWxlOiBldmVudHMuU2NoZWR1bGUucmF0ZShjZGsuRHVyYXRpb24ubWludXRlcygxKSksXG59KTtcblxuZXZlbnQuYWRkVGFyZ2V0KG5ldyB0YXJnZXRzLktpbmVzaXNGaXJlaG9zZVN0cmVhbShzdHJlYW0sIHt9KSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/aws-cdk-firehose-event-target.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/batch/integ.job-definition-events.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.ts new file mode 100644 index 0000000000000..335cb9c8c0204 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.ts @@ -0,0 +1,33 @@ +import * as events from 'aws-cdk-lib/aws-events'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +// --------------------------------- +// Define a rule that triggers a put to a Kinesis stream every 1min. + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-firehose-event-target'); + +const bucket = new s3.Bucket(stack, 'firehose-bucket'); +const firehoseRole = new iam.Role(stack, 'firehose-role', { + assumedBy: new iam.ServicePrincipal('firehose.amazonaws.com'), +}); +const stream = new firehose.CfnDeliveryStream(stack, 'MyStream', { + extendedS3DestinationConfiguration: { + bucketArn: bucket.bucketArn, + roleArn: firehoseRole.roleArn, + }, +}); +bucket.grantReadWrite(firehoseRole); + +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); + +event.addTarget(new targets.KinesisFirehoseStream(stream, {})); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js new file mode 100644 index 0000000000000..d7e283acbff23 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const kinesis = require("aws-cdk-lib/aws-kinesis"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +// --------------------------------- +// Define a rule that triggers a put to a Kinesis stream every 1min. +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-kinesis-event-target'); +const stream = new kinesis.Stream(stack, 'MyStream'); +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +event.addTarget(new targets.KinesisStream(stream, { + partitionKeyPath: events.EventField.eventId, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2luZXNpcy1zdHJlYW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5raW5lc2lzLXN0cmVhbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRDtBQUNqRCxtREFBbUQ7QUFDbkQsbUNBQW1DO0FBQ25DLDBEQUEwRDtBQUUxRCxvQ0FBb0M7QUFDcEMsb0VBQW9FO0FBRXBFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsOEJ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gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtY2RrLWtpbmVzaXMtZXZlbnQtdGFyZ2V0Jyk7XG5cbmNvbnN0IHN0cmVhbSA9IG5ldyBraW5lc2lzLlN0cmVhbShzdGFjaywgJ015U3RyZWFtJyk7XG5jb25zdCBldmVudCA9IG5ldyBldmVudHMuUnVsZShzdGFjaywgJ0V2ZXJ5TWludXRlJywge1xuICBzY2hlZHVsZTogZXZlbnRzLlNjaGVkdWxlLnJhdGUoY2RrLkR1cmF0aW9uLm1pbnV0ZXMoMSkpLFxufSk7XG5cbmV2ZW50LmFkZFRhcmdldChuZXcgdGFyZ2V0cy5LaW5lc2lzU3RyZWFtKHN0cmVhbSwge1xuICBwYXJ0aXRpb25LZXlQYXRoOiBldmVudHMuRXZlbnRGaWVsZC5ldmVudElkLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/aws-cdk-kinesis-event-target.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.ts new file mode 100644 index 0000000000000..641d6f44bfdea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/kinesis/integ.kinesis-stream.ts @@ -0,0 +1,22 @@ +import * as events from 'aws-cdk-lib/aws-events'; +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +// --------------------------------- +// Define a rule that triggers a put to a Kinesis stream every 1min. + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-kinesis-event-target'); + +const stream = new kinesis.Stream(stack, 'MyStream'); +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); + +event.addTarget(new targets.KinesisStream(stream, { + partitionKeyPath: events.EventField.eventId, +})); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js new file mode 100644 index 0000000000000..97a18ea56ef5f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-events'); +const fn = new lambda.Function(stack, 'MyFunc', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), +}); +const timer = new events.Rule(stack, 'Timer', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +timer.addTarget(new targets.LambdaFunction(fn)); +const timer2 = new events.Rule(stack, 'Timer2', { + schedule: events.Schedule.rate(cdk.Duration.minutes(2)), +}); +timer2.addTarget(new targets.LambdaFunction(fn)); +const timer3 = new events.Rule(stack, 'Timer3', { + schedule: events.Schedule.rate(cdk.Duration.minutes(2)), +}); +const queue = new sqs.Queue(stack, 'Queue'); +timer3.addTarget(new targets.LambdaFunction(fn, { + deadLetterQueue: queue, + maxEventAge: cdk.Duration.hours(2), + retryAttempts: 0, +})); +app.synth(); +/* eslint-disable no-console */ +function handler(event, _context, callback) { + console.log(JSON.stringify(event, undefined, 2)); + return callback(); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXZlbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZXZlbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELGlEQUFpRDtBQUNqRCwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDBEQUEwRDtBQUUxRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGVBQWUsQ0FBQyxDQUFDO0FBRWxELE1BQU0sRUFBRSxHQUFHLElBQUksTUFBTSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0l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GFGdW5jdGlvbihmbiwge1xuICBkZWFkTGV0dGVyUXVldWU6IHF1ZXVlLFxuICBtYXhFdmVudEFnZTogY2RrLkR1cmF0aW9uLmhvdXJzKDIpLFxuICByZXRyeUF0dGVtcHRzOiAwLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcblxuLyogZXNsaW50LWRpc2FibGUgbm8tY29uc29sZSAqL1xuZnVuY3Rpb24gaGFuZGxlcihldmVudDogYW55LCBfY29udGV4dDogYW55LCBjYWxsYmFjazogYW55KSB7XG4gIGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50LCB1bmRlZmluZWQsIDIpKTtcbiAgcmV0dXJuIGNhbGxiYWNrKCk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch-vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/lambda-events.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.ts similarity index 81% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.ts index 9a83116ba85d2..f789f3254f4ed 100644 --- a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/lambda/integ.events.ts @@ -1,8 +1,8 @@ -import * as events from '@aws-cdk/aws-events'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../../lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js new file mode 100644 index 0000000000000..71bb1d847db04 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const logs = require("aws-cdk-lib/aws-logs"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const aws_events_targets_1 = require("aws-cdk-lib/aws-events-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'log-group-events'); +const logGroup = new logs.LogGroup(stack, 'log-group', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const logGroup2 = new logs.LogGroup(stack, 'log-group2', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new logs.LogGroup(stack, 'log-group-imported', { + logGroupName: 'MyLogGroupNameToBeImported', + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const importedLogGroup = logs.LogGroup.fromLogGroupName(stack, 'imported-log-group', 'MyLogGroupNameToBeImported'); +const timer = new events.Rule(stack, 'Timer', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +timer.addTarget(new targets.CloudWatchLogGroup(logGroup)); +const customRule = new events.Rule(stack, 'CustomRule', { + eventPattern: { + source: ['cdk-integ'], + detailType: ['cdk-integ-custom-rule'], + }, +}); +customRule.addTarget(new targets.CloudWatchLogGroup(logGroup2, { + logEvent: aws_events_targets_1.LogGroupTargetInput.fromObject({ + message: events.EventField.fromPath('$.detail.date'), + }), +})); +const queue = new sqs.Queue(stack, 'dlq'); +const timer3 = new events.Rule(stack, 'Timer3', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +timer3.addTarget(new targets.CloudWatchLogGroup(importedLogGroup, { + deadLetterQueue: queue, + maxEventAge: cdk.Duration.hours(2), + retryAttempts: 2, +})); +const integ = new integ_tests_alpha_1.IntegTest(app, 'LogGroup', { + testCases: [stack], +}); +const putEventsDate = Date.now().toString(); +const expectedValue = `abc${putEventsDate}`; +const putEvent = integ.assertions.awsApiCall('EventBridge', 'putEvents', { + Entries: [ + { + Detail: JSON.stringify({ + date: expectedValue, + }), + DetailType: 'cdk-integ-custom-rule', + Source: 'cdk-integ', + }, + ], +}); +putEvent.provider.addPolicyStatementFromSdkCall('events', 'PutEvents'); +const logEvents = integ.assertions.awsApiCall('CloudWatchLogs', 'filterLogEvents', { + logGroupName: logGroup2.logGroupName, + startTime: putEventsDate, + limit: 1, +}); +putEvent.next(logEvents); +logEvents.assertAtPath('events.0.message', integ_tests_alpha_1.ExpectedResult.stringLikeRegexp(expectedValue)); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubG9nLWdyb3VwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubG9nLWdyb3VwLnRzIl0sIm5hbWVzIjpb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uICAgICAgU291cmNlOiAnY2RrLWludGVnJyxcbiAgICB9LFxuICBdLFxufSk7XG5wdXRFdmVudC5wcm92aWRlci5hZGRQb2xpY3lTdGF0ZW1lbnRGcm9tU2RrQ2FsbCgnZXZlbnRzJywgJ1B1dEV2ZW50cycpO1xuXG5jb25zdCBsb2dFdmVudHMgPSBpbnRlZy5hc3NlcnRpb25zLmF3c0FwaUNhbGwoJ0Nsb3VkV2F0Y2hMb2dzJywgJ2ZpbHRlckxvZ0V2ZW50cycsIHtcbiAgbG9nR3JvdXBOYW1lOiBsb2dHcm91cDIubG9nR3JvdXBOYW1lLFxuICBzdGFydFRpbWU6IHB1dEV2ZW50c0RhdGUsXG4gIGxpbWl0OiAxLFxufSk7XG5cbnB1dEV2ZW50Lm5leHQobG9nRXZlbnRzKTtcblxubG9nRXZlbnRzLmFzc2VydEF0UGF0aCgnZXZlbnRzLjAubWVzc2FnZScsIEV4cGVjdGVkUmVzdWx0LnN0cmluZ0xpa2VSZWdleHAoZXhwZWN0ZWRWYWx1ZSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/LogGroupDefaultTestDeployAssert353EE07A.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/log-group-events.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.ts similarity index 85% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.ts index 975e006283b07..ce0afd39cc7ab 100644 --- a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/logs/integ.log-group.ts @@ -1,10 +1,10 @@ -import * as events from '@aws-cdk/aws-events'; -import * as logs from '@aws-cdk/aws-logs'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import * as targets from '../../lib'; -import { LogGroupTargetInput } from '../../lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import { LogGroupTargetInput } from 'aws-cdk-lib/aws-events-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js new file mode 100644 index 0000000000000..a827e2a015fc0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const sns = require("aws-cdk-lib/aws-sns"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +// --------------------------------- +// Define a rule that triggers an SNS topic every 1min. +// Connect the topic with a queue. This means that the queue should have +// a message sent to it every minute. +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-sns-event-target'); +const topic = new sns.Topic(stack, 'MyTopic'); +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +const queue = new sqs.Queue(stack, 'MyQueue'); +topic.addSubscription(new subs.SqsSubscription(queue)); +const deadLetterQueue = new sqs.Queue(stack, 'MyDeadLetterQueue'); +event.addTarget(new targets.SnsTopic(topic, { + deadLetterQueue, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLWV2ZW50LXJ1bGUtdGFyZ2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc25zLWV2ZW50LXJ1bGUtdGFyZ2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQywwREFBM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XG5cbmNvbnN0IHF1ZXVlID0gbmV3IHNxcy5RdWV1ZShzdGFjaywgJ015UXVldWUnKTtcbnRvcGljLmFkZFN1YnNjcmlwdGlvbihuZXcgc3Vicy5TcXNTdWJzY3JpcHRpb24ocXVldWUpKTtcblxuY29uc3QgZGVhZExldHRlclF1ZXVlID0gbmV3IHNxcy5RdWV1ZShzdGFjaywgJ015RGVhZExldHRlclF1ZXVlJyk7XG5cbmV2ZW50LmFkZFRhcmdldChuZXcgdGFyZ2V0cy5TbnNUb3BpYyh0b3BpYywge1xuICBkZWFkTGV0dGVyUXVldWUsXG59KSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/aws-cdk-sns-event-target.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/codepipeline/integ.pipeline-event-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.ts new file mode 100644 index 0000000000000..f7222edb2bc30 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sns/integ.sns-event-rule-target.ts @@ -0,0 +1,31 @@ +import * as events from 'aws-cdk-lib/aws-events'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +// --------------------------------- +// Define a rule that triggers an SNS topic every 1min. +// Connect the topic with a queue. This means that the queue should have +// a message sent to it every minute. + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-sns-event-target'); + +const topic = new sns.Topic(stack, 'MyTopic'); +const event = new events.Rule(stack, 'EveryMinute', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); + +const queue = new sqs.Queue(stack, 'MyQueue'); +topic.addSubscription(new subs.SqsSubscription(queue)); + +const deadLetterQueue = new sqs.Queue(stack, 'MyDeadLetterQueue'); + +event.addTarget(new targets.SnsTopic(topic, { + deadLetterQueue, +})); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js new file mode 100644 index 0000000000000..cbc56789719f9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const kms = require("aws-cdk-lib/aws-kms"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-events-targets"); +// --------------------------------- +// Define a rule that triggers an SNS topic every 1min. +// Connect the topic with a queue. This means that the queue should have +// a message sent to it every minute. +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-sqs-event-target'); +const key = new kms.Key(stack, 'MyKey'); +const event = new events.Rule(stack, 'MyRule', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); +const queue = new sqs.Queue(stack, 'MyQueue', { + encryption: sqs.QueueEncryption.KMS, + encryptionMasterKey: key, +}); +const deadLetterQueue = new sqs.Queue(stack, 'MyDeadLetterQueue'); +event.addTarget(new targets.SqsQueue(queue, { + deadLetterQueue, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3FzLWV2ZW50LXJ1bGUtdGFyZ2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3FzLWV2ZW50LXJ1bGUtdGFyZ2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDBEQUEwRDtBQUUxRCxvQ0FBb0M7QUFDcEMsdURBQXVEO0FBQ3ZELHdFQUF3RTtBQUN4RSxxQ0FBcUM7QUFFckMsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSwwQkFBMEIsQ0FBQyxDQUFDO0FBRTdELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEV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integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.assets.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.template.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/aws-cdk-sqs-event-target.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.ts similarity index 75% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.ts index f2375dd7c2a37..876e6afc4130a 100644 --- a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events-targets/test/sqs/integ.sqs-event-rule-target.ts @@ -1,8 +1,8 @@ -import * as events from '@aws-cdk/aws-events'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../../lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; // --------------------------------- // Define a rule that triggers an SNS topic every 1min. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js new file mode 100644 index 0000000000000..5b99569ef224a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_events_1 = require("aws-cdk-lib/aws-events"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'IntegStack'); +const eventBus = new aws_events_1.EventBus(stack, 'EventBridge'); +const archive = new aws_events_1.Archive(stack, 'Archive', { + sourceEventBus: eventBus, + eventPattern: { + account: [stack.account], + }, +}); +archive.node.defaultChild.overrideLogicalId('MyCustomArchive'); +new integ_tests_alpha_1.IntegTest(app, 'ArchiveTest', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXJjaGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFyY2hpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBeUM7QUFDekMsa0VBQXVEO0FBQ3ZELHVEQUF1RTtBQ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bnRCcmlkZ2UnKTtcblxuY29uc3QgYXJjaGl2ZSA9IG5ldyBBcmNoaXZlKHN0YWNrLCAnQXJjaGl2ZScsIHtcbiAgc291cmNlRXZlbnRCdXM6IGV2ZW50QnVzLFxuICBldmVudFBhdHRlcm46IHtcbiAgICBhY2NvdW50OiBbc3RhY2suYWNjb3VudF0sXG4gIH0sXG59KTtcbihhcmNoaXZlLm5vZGUuZGVmYXVsdENoaWxkIGFzIENmbkFyY2hpdmUpLm92ZXJyaWRlTG9naWNhbElkKCdNeUN1c3RvbUFyY2hpdmUnKTtcblxubmV3IEludGVnVGVzdChhcHAsICdBcmNoaXZlVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/ArchiveTestDefaultTestDeployAssert3405726A.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/IntegStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/IntegStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/IntegStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/IntegStack.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/IntegStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/IntegStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/IntegStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/IntegStack.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.ts new file mode 100644 index 0000000000000..27c136e89ff23 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.archive.ts @@ -0,0 +1,21 @@ +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Archive, CfnArchive, EventBus } from 'aws-cdk-lib/aws-events'; + +const app = new App(); + +const stack = new Stack(app, 'IntegStack'); + +const eventBus = new EventBus(stack, 'EventBridge'); + +const archive = new Archive(stack, 'Archive', { + sourceEventBus: eventBus, + eventPattern: { + account: [stack.account], + }, +}); +(archive.node.defaultChild as CfnArchive).overrideLogicalId('MyCustomArchive'); + +new IntegTest(app, 'ArchiveTest', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js new file mode 100644 index 0000000000000..ca6d7e6e54c2d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_events_1 = require("aws-cdk-lib/aws-events"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'IntegConnectionStack'); +const connection = new aws_events_1.Connection(stack, 'Connection', { + authorization: aws_events_1.Authorization.apiKey('keyname', aws_cdk_lib_1.SecretValue.unsafePlainText('keyvalue')), + headerParameters: { + 'content-type': aws_events_1.HttpParameter.fromString('application/json'), + }, +}); +const testCase = new integ_tests_alpha_1.IntegTest(app, 'ConnectionTest', { + testCases: [stack], +}); +const deployedConncention = testCase.assertions.awsApiCall('EventBridge', 'describeConnection', { Name: connection.connectionName }); +deployedConncention.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + AuthParameters: { + ApiKeyAuthParameters: { + ApiKeyName: 'keyname', + }, + InvocationHttpParameters: { + HeaderParameters: [ + { + Key: 'content-type', + Value: 'application/json', + IsValueSecret: false, + }, + ], + }, + }, +})); +const assertionProvider = deployedConncention.node.tryFindChild('SdkProvider'); +assertionProvider.addPolicyStatementFromSdkCall('events', 'DescribeConnection'); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29ubmVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNvbm5lY3Rpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBc0Q7QUFDdEQsa0VBQTJGO0FBQzNGLHVEQUFrRjtBQUVsRixNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLHNCQUFzQixDQUFDLENBQUM7QUFFckQsTUFBTSxVQUFVLEdBQUcsSUFBSSx1QkFBVSxDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUU7SUFDckQsYUFBYSxFQUFFLDBCQUFhLENBQUMsTUFBTSxDQUFDLFNBQVMsRUFBRSx5QkFBVyxDQUFDLGVBQWUsQ0FBQyxVQUFVLENBQUMsQ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QXV0aFBhcmFtZXRlcnM6IHtcbiAgICBBcGlLZXlBdXRoUGFyYW1ldGVyczoge1xuICAgICAgQXBpS2V5TmFtZTogJ2tleW5hbWUnLFxuICAgIH0sXG4gICAgSW52b2NhdGlvbkh0dHBQYXJhbWV0ZXJzOiB7XG4gICAgICBIZWFkZXJQYXJhbWV0ZXJzOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBLZXk6ICdjb250ZW50LXR5cGUnLFxuICAgICAgICAgIFZhbHVlOiAnYXBwbGljYXRpb24vanNvbicsXG4gICAgICAgICAgSXNWYWx1ZVNlY3JldDogZmFsc2UsXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH0sXG4gIH0sXG59KSk7XG5cbmNvbnN0IGFzc2VydGlvblByb3ZpZGVyID0gZGVwbG95ZWRDb25uY2VudGlvbi5ub2RlLnRyeUZpbmRDaGlsZCgnU2RrUHJvdmlkZXInKSBhcyBBc3NlcnRpb25zUHJvdmlkZXI7XG5hc3NlcnRpb25Qcm92aWRlci5hZGRQb2xpY3lTdGF0ZW1lbnRGcm9tU2RrQ2FsbCgnZXZlbnRzJywgJ0Rlc2NyaWJlQ29ubmVjdGlvbicpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/ConnectionTestDefaultTestDeployAssertBA181C0F.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/IntegConnectionStack.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js diff --git a/packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/lambda/integ.events.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.ts similarity index 87% rename from packages/@aws-cdk/aws-events/test/integ.connection.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.ts index 41df8a9e97f91..ee38c4d89e173 100644 --- a/packages/@aws-cdk/aws-events/test/integ.connection.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.connection.ts @@ -1,6 +1,6 @@ -import { App, SecretValue, Stack } from '@aws-cdk/core'; -import { AssertionsProvider, ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; -import { Authorization, Connection, HttpParameter } from '../lib'; +import { App, SecretValue, Stack } from 'aws-cdk-lib'; +import { AssertionsProvider, ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Authorization, Connection, HttpParameter } from 'aws-cdk-lib/aws-events'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js new file mode 100644 index 0000000000000..e4c8f5e5a1796 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_events_1 = require("aws-cdk-lib/aws-events"); +/** + * Basic idea for this test is to create an EventBridge that "connects" + * an SQS queue in one account to another account. Nothing is sent on the + * queue, it's just used to set up the condition where aws-events creates + * a support stack. + */ +const app = new aws_cdk_lib_1.App(); +const account = process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT; +// As the integ-runner doesnt provide a default cross account, we make our own. +const crossAccount = process.env.CDK_INTEG_CROSS_ACCOUNT || '987654321'; +const region = process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION; +const fromCrossAccountStack = new aws_cdk_lib_1.Stack(app, 'FromCrossAccountRuleStack', { + env: { + account: crossAccount, + region, + }, +}); +/** + * To make this testable, we need to have the stack that stores the event bridge be in + * the same account that the IntegTest stack is deployed into. Otherwise, we have no + * access to the IAM policy that the EventBusPolicy-account-region support stack creates. + */ +const toCrossAccountStack = new aws_cdk_lib_1.Stack(app, 'ToCrossAccountRuleStack', { + env: { + account, + region, + }, +}); +const queueName = 'IntegTestCrossEnvRule'; +const queue = new aws_cdk_lib_1.CfnResource(toCrossAccountStack, 'Queue', { + type: 'AWS::SQS::Queue', + properties: { + QueueName: queueName, + ReceiveMessageWaitTimeSeconds: 20, + }, +}); +const target = { + bind: () => ({ + id: 'SQS', + arn: aws_cdk_lib_1.Arn.format({ + resource: queueName, + service: 'sqs', + }, toCrossAccountStack), + targetResource: queue, + }), +}; +new aws_events_1.Rule(fromCrossAccountStack, 'MyRule', { + eventPattern: { + detail: { + foo: ['bar'], + }, + detailType: ['cdk-integ-custom-rule'], + source: ['cdk-integ'], + }, + targets: [target], +}); +toCrossAccountStack.addDependency(fromCrossAccountStack); +const integ = new integ_tests_alpha_1.IntegTest(app, 'CrossAccountDeploy', { + testCases: [ + toCrossAccountStack, + ], +}); +// We are using the default event bus, don't need to define any parameters for this call. +const eventVerification = integ.assertions.awsApiCall('EventBridge', 'describeEventBus'); +integ.node.addDependency(toCrossAccountStack); +eventVerification.provider.addPolicyStatementFromSdkCall('events', 'DescribeEventBus'); +// IAM policy will be created by the support stack, assert that everything created as expected. +eventVerification.assertAtPath('Policy', integ_tests_alpha_1.ExpectedResult.objectLike({ + Statement: integ_tests_alpha_1.Match.arrayWith([integ_tests_alpha_1.Match.objectLike({ + Sid: integ_tests_alpha_1.Match.stringLikeRegexp(`Allow-account-${crossAccount}`), + Principal: { + AWS: `arn:aws:iam::${crossAccount}:root`, + }, + Resource: integ_tests_alpha_1.Match.stringLikeRegexp(`arn:aws:events:us-east-1:${account}`), + })]), +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY3Jvc3M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ZWN0TGlrZSh7XG4gIFN0YXRlbWVudDogTWF0Y2guYXJyYXlXaXRoKFxuICAgIFtNYXRjaC5vYmplY3RMaWtlKHtcbiAgICAgIFNpZDogTWF0Y2guc3RyaW5nTGlrZVJlZ2V4cChgQWxsb3ctYWNjb3VudC0ke2Nyb3NzQWNjb3VudH1gKSxcbiAgICAgIFByaW5jaXBhbDoge1xuICAgICAgICBBV1M6IGBhcm46YXdzOmlhbTo6JHtjcm9zc0FjY291bnR9OnJvb3RgLFxuICAgICAgfSxcbiAgICAgIFJlc291cmNlOiBNYXRjaC5zdHJpbmdMaWtlUmVnZXhwKGBhcm46YXdzOmV2ZW50czp1cy1lYXN0LTE6JHthY2NvdW50fWApLFxuICAgIH0pXSxcbiAgKSxcbn0pKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/CrossAccountDeployDefaultTestDeployAssertB5328BEF.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/EventBusPolicy-987654321-test-region-12345678.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/FromCrossAccountRuleStack.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/ToCrossAccountRuleStack.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/asset.2a53dc40a7dae81c8850e125ab49e5f55d80b7b8ceac86976f2a4119393cab72.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/asset.2a53dc40a7dae81c8850e125ab49e5f55d80b7b8ceac86976f2a4119393cab72.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/asset.2a53dc40a7dae81c8850e125ab49e5f55d80b7b8ceac86976f2a4119393cab72.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/asset.2a53dc40a7dae81c8850e125ab49e5f55d80b7b8ceac86976f2a4119393cab72.bundle/index.js diff --git a/packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sqs/integ.sqs-event-rule-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.ts similarity index 95% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.ts index 5578fc2956507..4eada21bd2154 100644 --- a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.cross-account-rule.ts @@ -1,7 +1,7 @@ /// !cdk-integ * -import { App, Arn, CfnResource, Stack } from '@aws-cdk/core'; -import { ExpectedResult, IntegTest, Match } from '@aws-cdk/integ-tests'; -import { Rule, IRuleTarget } from '../lib'; +import { App, Arn, CfnResource, Stack } from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest, Match } from '@aws-cdk/integ-tests-alpha'; +import { Rule, IRuleTarget } from 'aws-cdk-lib/aws-events'; /** * Basic idea for this test is to create an EventBridge that "connects" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js new file mode 100644 index 0000000000000..43e3c22da56bc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_events_1 = require("aws-cdk-lib/aws-events"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'Stack', { + env: { + region: 'us-east-1', + }, +}); +const bus = new aws_events_1.EventBus(stack, 'Bus'); +bus.addToResourcePolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal(stack.account)], + actions: ['events:PutEvents'], + sid: '123', + resources: [bus.eventBusArn], +})); +new integ_tests_alpha_1.IntegTest(app, 'IntegTest-BatchDefaultEnvVarsStack', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXZlbnRidXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5ldmVudGJ1cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyw2Q0FBeUM7QUFDekMsa0VBQXVEO0FBQ3ZELHVEQUFrRDtBQUVsRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLE9BQU8sRUFBRTtJQUNwQyxHQUFHLEVBQUU7UUFDSCxNQUFNLEVBQUUsV0FBVztLQUNwQjtDQUNGLENBQUMsQ0FBQztBQUNILE1BQU0sR0FBRyxHQUFHLElBQUkscUJBQVEsQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFFdkMsR0FBRyxDQUFDLG1CQUFtQixDQUFDLElBQUksR0FBRyxDQUFDLGVBQWUsQ0FBQztJQUM5QyxNQUFNLEVBQUUsR0FBRyxDQUFDLE1BQU0sQ0FBQyxLQUFLO0lBQ3hCLFVBQVUsRUFBRSxDQUFDLElBQUksR0FBRyxDQUFDLGdCQUFnQixDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUNyRCxPQUFPLEVBQUUsQ0FBQyxrQkFBa0IsQ0FBQztJQUM3QixHQUFHLEVBQUUsS0FBSztJQUNWLFNBQVMsRUFBRSxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUM7Q0FDN0IsQ0FBQyxDQUFDLENBQUM7QUFFSixJQUFJLDZCQUFTLENBQUMsR0FBRyxFQUFFLG9DQUFvQyxFQUFFO0lBQ3ZELFNBQVMsRUFBRSxDQUFDLEtBQUssQ0FBQztDQUNuQixDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpYW0gZnJvbSAnYXdzLWNkay1saWIvYXdzLWlhbSc7XG5pbXBvcnQgeyBBcHAsIFN0YWNrIH0gZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgSW50ZWdUZXN0IH0gZnJvbSAnQGF3cy1jZGsvaW50ZWctdGVzdHMtYWxwaGEnO1xuaW1wb3J0IHsgRXZlbnRCdXMgfSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtZXZlbnRzJztcblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgU3RhY2soYXBwLCAnU3RhY2snLCB7XG4gIGVudjoge1xuICAgIHJlZ2lvbjogJ3VzLWVhc3QtMScsXG4gIH0sXG59KTtcbmNvbnN0IGJ1cyA9IG5ldyBFdmVudEJ1cyhzdGFjaywgJ0J1cycpO1xuXG5idXMuYWRkVG9SZXNvdXJjZVBvbGljeShuZXcgaWFtLlBvbGljeVN0YXRlbWVudCh7XG4gIGVmZmVjdDogaWFtLkVmZmVjdC5BTExPVyxcbiAgcHJpbmNpcGFsczogW25ldyBpYW0uQWNjb3VudFByaW5jaXBhbChzdGFjay5hY2NvdW50KV0sXG4gIGFjdGlvbnM6IFsnZXZlbnRzOlB1dEV2ZW50cyddLFxuICBzaWQ6ICcxMjMnLFxuICByZXNvdXJjZXM6IFtidXMuZXZlbnRCdXNBcm5dLFxufSkpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ0ludGVnVGVzdC1CYXRjaERlZmF1bHRFbnZWYXJzU3RhY2snLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/Stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/Stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/Stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/Stack.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/Stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/Stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/Stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/Stack.template.json diff --git a/packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/test/integ.elasticsearch.unsignedbasicauth.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.ts new file mode 100644 index 0000000000000..2afeb6e23df3c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.eventbus.ts @@ -0,0 +1,24 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { EventBus } from 'aws-cdk-lib/aws-events'; + +const app = new App(); +const stack = new Stack(app, 'Stack', { + env: { + region: 'us-east-1', + }, +}); +const bus = new EventBus(stack, 'Bus'); + +bus.addToResourcePolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal(stack.account)], + actions: ['events:PutEvents'], + sid: '123', + resources: [bus.eventBusArn], +})); + +new IntegTest(app, 'IntegTest-BatchDefaultEnvVarsStack', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js new file mode 100644 index 0000000000000..e61bdedc9f522 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_events_1 = require("aws-cdk-lib/aws-events"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'RuleStack'); +new aws_events_1.Rule(stack, 'MyRule', { + eventPattern: { + account: ['account1', 'account2'], + detail: { + foo: [1, 2], + strings: ['foo', 'bar'], + rangeMatcher: aws_events_1.Match.interval(-1, 1), + stringMatcher: aws_events_1.Match.exactString('I am just a string'), + prefixMatcher: aws_events_1.Match.prefix('aws.'), + ipAddress: aws_events_1.Match.ipAddressRange('192.0.2.0/24'), + shouldExist: aws_events_1.Match.exists(), + shouldNotExist: aws_events_1.Match.doesNotExist(), + numbers: aws_events_1.Match.allOf(aws_events_1.Match.greaterThan(0), aws_events_1.Match.lessThan(5)), + topLevel: { + deeper: aws_events_1.Match.equal(42), + oneMoreLevel: { + deepest: aws_events_1.Match.anyOf(aws_events_1.Match.lessThanOrEqual(-1), aws_events_1.Match.greaterThanOrEqual(1)), + }, + }, + state: aws_events_1.Match.anythingBut('initializing'), + limit: aws_events_1.Match.anythingBut(100, 200, 300), + notPrefixedBy: aws_events_1.Match.anythingButPrefix('sensitive-'), + suffix: aws_events_1.Match.suffix('.com'), + equalsIgnoreCase: aws_events_1.Match.equalsIgnoreCase('ignore case'), + }, + detailType: ['detailType1'], + id: ['id1', 'id2'], + region: ['region1', 'region2', 'region3'], + resources: ['r1'], + source: ['src1', 'src2'], + time: ['t1'], + version: ['0'], + }, +}); +new integ_tests_alpha_1.IntegTest(app, 'IntegTest-BatchDefaultEnvVarsStack', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJ1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBeUM7QUFDekMsa0VBQXVEO0FBQ3ZELHVEQUFxRDtBQUVyRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLFdBQVcsQ0FBQyxDQUFDO0FBRzFDLElBQUksaUJBQUksQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ3hCLFlBQVksRUFBRTtRQUNaLE9BQU8sRUFBRSxDQUFDLFVBQVUsRUFBRSxVQUFVLENBQUM7UUFDakMsTUFBTSxFQUFFO1lBQ04sR0FBRyxFQUFFLENBQUMsQ0F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gICAgIHN1ZmZpeDogTWF0Y2guc3VmZml4KCcuY29tJyksXG4gICAgICBlcXVhbHNJZ25vcmVDYXNlOiBNYXRjaC5lcXVhbHNJZ25vcmVDYXNlKCdpZ25vcmUgY2FzZScpLFxuICAgIH0sXG4gICAgZGV0YWlsVHlwZTogWydkZXRhaWxUeXBlMSddLFxuICAgIGlkOiBbJ2lkMScsICdpZDInXSxcbiAgICByZWdpb246IFsncmVnaW9uMScsICdyZWdpb24yJywgJ3JlZ2lvbjMnXSxcbiAgICByZXNvdXJjZXM6IFsncjEnXSxcbiAgICBzb3VyY2U6IFsnc3JjMScsICdzcmMyJ10sXG4gICAgdGltZTogWyd0MSddLFxuICAgIHZlcnNpb246IFsnMCddLFxuICB9LFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnSW50ZWdUZXN0LUJhdGNoRGVmYXVsdEVudlZhcnNTdGFjaycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/RuleStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/RuleStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/RuleStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/RuleStack.assets.json diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/RuleStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/RuleStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/RuleStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/RuleStack.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.connection.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.ts new file mode 100644 index 0000000000000..cf3b79622ef66 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-events/test/integ.rule.ts @@ -0,0 +1,47 @@ +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Rule, Match } from 'aws-cdk-lib/aws-events'; + +const app = new App(); + +const stack = new Stack(app, 'RuleStack'); + + +new Rule(stack, 'MyRule', { + eventPattern: { + account: ['account1', 'account2'], + detail: { + foo: [1, 2], + strings: ['foo', 'bar'], + rangeMatcher: Match.interval(-1, 1), + stringMatcher: Match.exactString('I am just a string'), + prefixMatcher: Match.prefix('aws.'), + ipAddress: Match.ipAddressRange('192.0.2.0/24'), + shouldExist: Match.exists(), + shouldNotExist: Match.doesNotExist(), + numbers: Match.allOf(Match.greaterThan(0), Match.lessThan(5)), + topLevel: { + deeper: Match.equal(42), + oneMoreLevel: { + deepest: Match.anyOf(Match.lessThanOrEqual(-1), Match.greaterThanOrEqual(1)), + }, + }, + state: Match.anythingBut('initializing'), + limit: Match.anythingBut(100, 200, 300), + notPrefixedBy: Match.anythingButPrefix('sensitive-'), + suffix: Match.suffix('.com'), + equalsIgnoreCase: Match.equalsIgnoreCase('ignore case'), + }, + detailType: ['detailType1'], + id: ['id1', 'id2'], + region: ['region1', 'region2', 'region3'], + resources: ['r1'], + source: ['src1', 'src2'], + time: ['t1'], + version: ['0'], + }, +}); + +new IntegTest(app, 'IntegTest-BatchDefaultEnvVarsStack', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js new file mode 100644 index 0000000000000..f814dce0388c3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const fsx = require("aws-cdk-lib/aws-fsx"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'AwsCdkFsxLustre'); +const vpc = new ec2.Vpc(stack, 'VPC'); +const bucket = new s3.Bucket(stack, 'ImportBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const storageCapacity = 1200; +const lustreConfiguration = { + deploymentType: fsx.LustreDeploymentType.SCRATCH_2, + importPath: bucket.s3UrlForObject(), + autoImportPolicy: fsx.LustreAutoImportPolicy.NEW_CHANGED_DELETED, +}; +new fsx.LustreFileSystem(stack, 'FsxLustreFileSystem', { + lustreConfiguration, + storageCapacityGiB: storageCapacity, + vpc, + vpcSubnet: vpc.privateSubnets[0], + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +new integ.IntegTest(app, 'FsxLustreWithS3Test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubHVzdHJlLWZpbGUtc3lzdGVtLXdpdGgtczMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5sdXN0cmUtZmlsZS1zeXN0ZW0td2l0aC1zMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyx5Q0FBeUM7QUFDekMsNkNBQXdEO0FBQ3hELG9EQUFvRDtBQUNwRCwyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFFdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxpQkFBaUIsQ0FBQyxDQUFDO0FBRWhELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUM7QUFFdEMsTUFBTSxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxjQUFjLEVBQUU7SUFDbEQsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztDQUNyQyxDQUFDLENBQUM7QUFFSCxNQUFNLGVBQWUsR0FBRyxJQUFJLENBQUM7QUFDN0IsTUFBTSxtQkFBbUIsR0FBRztJQUMxQixjQUFjLEVBQUUsR0FBRyxDQUFDLG9CQUFvQixDQUFDLFNBQVM7SUFDbEQsVUFBVSxFQUFFLE1BQU0sQ0FBQyxjQUFjLEVBQUU7SUFDbkMsZ0JBQWdCLEVBQUUs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cbiAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbmNvbnN0IHN0b3JhZ2VDYXBhY2l0eSA9IDEyMDA7XG5jb25zdCBsdXN0cmVDb25maWd1cmF0aW9uID0ge1xuICBkZXBsb3ltZW50VHlwZTogZnN4Lkx1c3RyZURlcGxveW1lbnRUeXBlLlNDUkFUQ0hfMixcbiAgaW1wb3J0UGF0aDogYnVja2V0LnMzVXJsRm9yT2JqZWN0KCksXG4gIGF1dG9JbXBvcnRQb2xpY3k6IGZzeC5MdXN0cmVBdXRvSW1wb3J0UG9saWN5Lk5FV19DSEFOR0VEX0RFTEVURUQsXG59O1xuXG5uZXcgZnN4Lkx1c3RyZUZpbGVTeXN0ZW0oc3RhY2ssICdGc3hMdXN0cmVGaWxlU3lzdGVtJywge1xuICBsdXN0cmVDb25maWd1cmF0aW9uLFxuICBzdG9yYWdlQ2FwYWNpdHlHaUI6IHN0b3JhZ2VDYXBhY2l0eSxcbiAgdnBjLFxuICB2cGNTdWJuZXQ6IHZwYy5wcml2YXRlU3VibmV0c1swXSxcbiAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnRnN4THVzdHJlV2l0aFMzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.assets.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.assets.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.template.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/AwsCdkFsxLustre.template.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.assets.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.assets.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.template.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/FsxLustreWithS3TestDefaultTestDeployAssert0752DB81.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.cross-account-rule.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.ts similarity index 75% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.ts index 295616cf91024..82f1e2a7cddb2 100644 --- a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system-with-s3.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as fsx from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as fsx from 'aws-cdk-lib/aws-fsx'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js new file mode 100644 index 0000000000000..38fffe65b36af --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_fsx_1 = require("aws-cdk-lib/aws-fsx"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'AwsCdkFsxLustre'); +const vpc = new aws_ec2_1.Vpc(stack, 'VPC'); +const storageCapacity = 1200; +const lustreConfiguration = { + deploymentType: aws_fsx_1.LustreDeploymentType.SCRATCH_2, + dataCompressionType: aws_fsx_1.LustreDataCompressionType.LZ4, +}; +const fs = new aws_fsx_1.LustreFileSystem(stack, 'FsxLustreFileSystem', { + lustreConfiguration, + storageCapacityGiB: storageCapacity, + vpc, + vpcSubnet: vpc.privateSubnets[0], + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const inst = new aws_ec2_1.Instance(stack, 'inst', { + instanceType: aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.T2, aws_ec2_1.InstanceSize.LARGE), + machineImage: new aws_ec2_1.AmazonLinuxImage({ + generation: aws_ec2_1.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + vpc, + vpcSubnets: { + subnetType: aws_ec2_1.SubnetType.PUBLIC, + }, +}); +fs.connections.allowDefaultPortFrom(inst); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubHVzdHJlLWZpbGUtc3lzdGVtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubHVzdHJlLWZpbGUtc3lzdGVtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQW9KO0FBQ3BKLDZDQUF3RDtBQUN4RCxpREFBd0c7QUFFeEcsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFFdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxpQkFBaUIsQ0FBQyxDQUFDO0FBRWhELE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUMsQ0FBQztBQUVsQyxNQUFNLGVBQWUsR0FB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5jZVR5cGU6IEluc3RhbmNlVHlwZS5vZihJbnN0YW5jZUNsYXNzLlQyLCBJbnN0YW5jZVNpemUuTEFSR0UpLFxuICBtYWNoaW5lSW1hZ2U6IG5ldyBBbWF6b25MaW51eEltYWdlKHtcbiAgICBnZW5lcmF0aW9uOiBBbWF6b25MaW51eEdlbmVyYXRpb24uQU1BWk9OX0xJTlVYXzIsXG4gIH0pLFxuICB2cGMsXG4gIHZwY1N1Ym5ldHM6IHtcbiAgICBzdWJuZXRUeXBlOiBTdWJuZXRUeXBlLlBVQkxJQyxcbiAgfSxcbn0pO1xuZnMuY29ubmVjdGlvbnMuYWxsb3dEZWZhdWx0UG9ydEZyb20oaW5zdCk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.assets.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.assets.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.template.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/AwsCdkFsxLustre.template.json diff --git a/packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.rule.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.ts similarity index 83% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.ts index c0f0e560146a9..b42b8bbed20b3 100644 --- a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-fsx/test/integ.lustre-file-system.ts @@ -1,6 +1,6 @@ -import { AmazonLinuxGeneration, AmazonLinuxImage, Instance, InstanceClass, InstanceSize, InstanceType, SubnetType, Vpc } from '@aws-cdk/aws-ec2'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { LustreDeploymentType, LustreFileSystem, LustreDataCompressionType } from '../lib'; +import { AmazonLinuxGeneration, AmazonLinuxImage, Instance, InstanceClass, InstanceSize, InstanceType, SubnetType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { LustreDeploymentType, LustreFileSystem, LustreDataCompressionType } from 'aws-cdk-lib/aws-fsx'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js new file mode 100644 index 0000000000000..b39dabd90a4a1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const ga = require("aws-cdk-lib/aws-globalaccelerator"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const endpoints = require("aws-cdk-lib/aws-globalaccelerator-endpoints"); +class GaStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 3, natGateways: 1 }); + const accelerator = new ga.Accelerator(this, 'Accelerator'); + const listener = new ga.Listener(this, 'Listener', { + accelerator, + portRanges: [ + { + fromPort: 80, + toPort: 80, + }, + ], + }); + const alb = new elbv2.ApplicationLoadBalancer(this, 'ALB', { vpc, internetFacing: true }); + const nlb = new elbv2.NetworkLoadBalancer(this, 'NLB', { vpc, internetFacing: true }); + const eip = new ec2.CfnEIP(this, 'ElasticIpAddress'); + const instances = new Array(); + for (let i = 0; i < 2; i++) { + instances.push(new ec2.Instance(this, `Instance${i}`, { + vpc, + machineImage: new ec2.AmazonLinuxImage(), + instanceType: new ec2.InstanceType('t3.small'), + })); + } + const group = new ga.EndpointGroup(this, 'Group', { + listener, + endpoints: [ + new endpoints.ApplicationLoadBalancerEndpoint(alb), + new endpoints.NetworkLoadBalancerEndpoint(nlb), + new endpoints.CfnEipEndpoint(eip), + new endpoints.InstanceEndpoint(instances[0]), + new endpoints.InstanceEndpoint(instances[1]), + ], + }); + alb.connections.allowFrom(group.connectionsPeer('Peer', vpc), ec2.Port.tcp(443)); + } +} +const app = new aws_cdk_lib_1.App(); +new GaStack(app, 'integ-globalaccelerator'); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2xvYmFsYWNjZWxlcmF0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5nbG9iYWxhY2NlbGVyYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxnRUFBZ0U7QUFDaEUsd0RBQXdEO0FBQ3hELDZDQUF5QztBQUV6Qyx5RUFBeUU7QUFFekUsTUFBTSxPQUFRLFNBQVEsbUJBQUs7SUFDekIsWUFBWSxLQUEyQixFQUFFLEVBQVU7UUFDakQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQix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nQoaW5zdGFuY2VzWzBdKSxcbiAgICAgICAgbmV3IGVuZHBvaW50cy5JbnN0YW5jZUVuZHBvaW50KGluc3RhbmNlc1sxXSksXG4gICAgICBdLFxuICAgIH0pO1xuXG4gICAgYWxiLmNvbm5lY3Rpb25zLmFsbG93RnJvbShncm91cC5jb25uZWN0aW9uc1BlZXIoJ1BlZXInLCB2cGMpLCBlYzIuUG9ydC50Y3AoNDQzKSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IEdhU3RhY2soYXBwLCAnaW50ZWctZ2xvYmFsYWNjZWxlcmF0b3InKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/globalaccelerator.integ.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/globalaccelerator.integ.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/logs/integ.log-group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.assets.json similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.assets.json diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.template.json similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ-globalaccelerator.template.json diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.ts similarity index 84% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.ts index d4b5c2ada5ca1..e5bbd8681f9b4 100644 --- a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as ga from '@aws-cdk/aws-globalaccelerator'; -import { App, Stack } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as ga from 'aws-cdk-lib/aws-globalaccelerator'; +import { App, Stack } from 'aws-cdk-lib'; import * as constructs from 'constructs'; -import * as endpoints from '../lib'; +import * as endpoints from 'aws-cdk-lib/aws-globalaccelerator-endpoints'; class GaStack extends Stack { constructor(scope: constructs.Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js new file mode 100644 index 0000000000000..9dfded446fdc2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-iam-access-key-1'); +const user = new aws_iam_1.User(stack, 'TestUser'); +const accessKey = new aws_iam_1.AccessKey(stack, 'TestAccessKey', { user }); +new aws_cdk_lib_1.CfnOutput(stack, 'AccessKeyId', { value: accessKey.accessKeyId }); +new integ_tests_alpha_1.IntegTest(app, 'iam-access-key-1', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWNjZXNzLWtleS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFjY2Vzcy1rZXkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBb0Q7QUFDcEQsa0VBQXVEO0FBQ3ZELGlEQUFzRDtBQUV0RCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLHdCQUF3QixDQUFDLENBQUM7QUFFdkQsTUFBTSxJQUFJLEdB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xubmV3IEludGVnVGVzdChhcHAsICdpYW0tYWNjZXNzLWtleS0xJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/integ.nlb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/iamaccesskey1DefaultTestDeployAssert00360C89.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/integ-iam-access-key-1.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.ts new file mode 100644 index 0000000000000..7e2e34c11db0e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.access-key.ts @@ -0,0 +1,17 @@ +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AccessKey, User } from 'aws-cdk-lib/aws-iam'; + +const app = new App(); +const stack = new Stack(app, 'integ-iam-access-key-1'); + +const user = new User(stack, 'TestUser'); +const accessKey = new AccessKey(stack, 'TestAccessKey', { user }); + +new CfnOutput(stack, 'AccessKeyId', { value: accessKey.accessKeyId }); + +new IntegTest(app, 'iam-access-key-1', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js new file mode 100644 index 0000000000000..d1b91bc8befc8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const iam = require("aws-cdk-lib/aws-iam"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + new iam.Role(this, 'RoleWithCompositePrincipal', { + assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('ec2.amazonaws.com'), new iam.AnyPrincipal()), + }); + } +} +const app = new cdk.App(); +new integ_tests_alpha_1.IntegTest(app, 'iam-integ-composite-principal-test', { + testCases: [new TestStack(app, 'iam-integ-composite-principal')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29tcG9zaXRlLXByaW5jaXBhbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNvbXBvc2l0ZS1wcmluY2lwYWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELDJDQUEyQztBQUUzQyxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSw0QkFBNEIsRUFBRTtZQUMvQyxTQUFTLEVBQUUsSUFBSSxHQUFHLENBQUMsa0JBQWtCLENBQ25DLElBQUksR0FBRyxDQUFDLGdCQUFnQixDQUFDLG1CQUFtQixDQUFDLEVBQzdDLElBQUksR0FBRyxDQUFDLFlBQVksRUFBRSxDQUN2QjtTQUNGLENBQUMsQ0FBQztJQUNMLENBQUM7Q0FDRjtBQUVELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLElBQUksNkJBQVMsQ0FBQyxHQUFHLEVBQUUsb0NBQW9DLEVBQUU7SUFDdkQsU0FBUyxFQUFFLENBQUMsSUFBSSxTQUFTLENBQUMsR0FBRyxFQUFFLCtCQUErQixDQUFDLENBQUM7Q0FDakUsQ0FBQyxDQUFDO0FBRUgsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2RrIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7IEludGVnVGVzdCB9IGZyb20gJ0Bhd3MtY2RrL2ludGVnLXRlc3RzLWFscGhhJztcbmltcG9ydCAqIGFzIGlhbSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtaWFtJztcblxuY2xhc3MgVGVzdFN0YWNrIGV4dGVuZHMgY2RrLlN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IGNkay5BcHAsIGlkOiBzdHJpbmcpIHtcbiAgICBzdXBlcihzY29wZSwgaWQpO1xuXG4gICAgbmV3IGlhbS5Sb2xlKHRoaXMsICdSb2xlV2l0aENvbXBvc2l0ZVByaW5jaXBhbCcsIHtcbiAgICAgIGFzc3VtZWRCeTogbmV3IGlhbS5Db21wb3NpdGVQcmluY2lwYWwoXG4gICAgICAgIG5ldyBpYW0uU2VydmljZVByaW5jaXBhbCgnZWMyLmFtYXpvbmF3cy5jb20nKSxcbiAgICAgICAgbmV3IGlhbS5BbnlQcmluY2lwYWwoKSxcbiAgICAgICksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IEludGVnVGVzdChhcHAsICdpYW0taW50ZWctY29tcG9zaXRlLXByaW5jaXBhbC10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtuZXcgVGVzdFN0YWNrKGFwcCwgJ2lhbS1pbnRlZy1jb21wb3NpdGUtcHJpbmNpcGFsJyldLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.access-key.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iam-integ-composite-principal.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/iamintegcompositeprincipaltestDefaultTestDeployAssertDD256D71.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.ts similarity index 78% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.ts index a72c20be1dc00..98a2ae84a19bb 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.composite-principal.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as iam from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js new file mode 100644 index 0000000000000..792fdc8f20ddb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +class MyStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const tagName = new aws_cdk_lib_1.CfnParameter(this, 'PrincipalTag', { default: 'developer' }); + const stringEquals = new aws_cdk_lib_1.CfnJson(this, 'PrincipalTagCondition', { + value: { + [`aws:PrincipalTag/${tagName.valueAsString}`]: 'true', + }, + }); + const principal = new aws_iam_1.AccountRootPrincipal().withConditions({ + StringEquals: stringEquals, + }); + new aws_iam_1.Role(this, 'MyRole', { assumedBy: principal }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'iam-test-condition-with-ref', { + testCases: [new MyStack(app, 'test-condition-with-ref')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29uZGl0aW9uLXdpdGg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Fzc3VtZWRCeTogcHJpbmNpcGFsIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnaWFtLXRlc3QtY29uZGl0aW9uLXdpdGgtcmVmJywge1xuICB0ZXN0Q2FzZXM6IFtuZXcgTXlTdGFjayhhcHAsICd0ZXN0LWNvbmRpdGlvbi13aXRoLXJlZicpXSxcbn0pXG47XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/consts.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/asset.f4599f463f56c5c9d584a8aca5b607b7bb0cead0b089b8ccd66b69f00b5ee98a/index.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.composite-principal.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/iamtestconditionwithrefDefaultTestDeployAssert5E44A64B.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/test-condition-with-ref.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.ts similarity index 79% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.ts index a6b66b8c0a419..20f2de47fcece 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.condition-with-ref.ts @@ -1,7 +1,7 @@ -import { App, CfnJson, CfnParameter, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { App, CfnJson, CfnParameter, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { AccountRootPrincipal, Role } from '../lib'; +import { AccountRootPrincipal, Role } from 'aws-cdk-lib/aws-iam'; class MyStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js new file mode 100644 index 0000000000000..0ce92b1459b97 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js @@ -0,0 +1,14 @@ +"use strict"; +// Creates a default group, with no users and no policy attached. +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-iam-role-1'); +new aws_iam_1.Group(stack, 'MyGroup'); +new integ_tests_alpha_1.IntegTest(app, 'iam-role-1', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ3JvdXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5ncm91cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsaUVBQWlFOztBQUVqRSw2Q0FBeUM7QUFDekMsa0VBQXVEO0FBQ3ZELGlEQUE0QztBQUU1QyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLGtCQUFrQixDQUFDLENBQUM7QUFFakQsSUFBSSxlQUFLLENBQUMsS0FBSyxFQUFFLFNBQVMsQ0FBQyxDQUFDO0FBRTVCLElBQUksNkJBQVMsQ0FBQyxHQUFHLEVBQUUsWUFBWSxFQUFFO0lBQy9CLFNBQVMsRUFBRSxDQUFDLEtBQUssQ0FBQztDQUNuQixDQUFDLENBQUM7QUFFSCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBDcmVhdGVzIGEgZGVmYXVsdCBncm91cCwgd2l0aCBubyB1c2VycyBhbmQgbm8gcG9saWN5IGF0dGFjaGVkLlxuXG5pbXBvcnQgeyBBcHAsIFN0YWNrIH0gZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgSW50ZWdUZXN0IH0gZnJvbSAnQGF3cy1jZGsvaW50ZWctdGVzdHMtYWxwaGEnO1xuaW1wb3J0IHsgR3JvdXAgfSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtaWFtJztcblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5jb25zdCBzdGFjayA9IG5ldyBTdGFjayhhcHAsICdpbnRlZy1pYW0tcm9sZS0xJyk7XG5cbm5ldyBHcm91cChzdGFjaywgJ015R3JvdXAnKTtcblxubmV3IEludGVnVGVzdChhcHAsICdpYW0tcm9sZS0xJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.condition-with-ref.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/iamrole1DefaultTestDeployAssertC34A70B7.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/integ-iam-role-1.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.ts new file mode 100644 index 0000000000000..006e6b505a5bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.group.ts @@ -0,0 +1,17 @@ +// Creates a default group, with no users and no policy attached. + +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Group } from 'aws-cdk-lib/aws-iam'; + +const app = new App(); + +const stack = new Stack(app, 'integ-iam-role-1'); + +new Group(stack, 'MyGroup'); + +new IntegTest(app, 'iam-role-1', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js new file mode 100644 index 0000000000000..f4a48a8f93d4f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cx_api_1 = require("aws-cdk-lib/cx-api"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App({ context: { [cx_api_1.IAM_IMPORTED_ROLE_STACK_SAFE_DEFAULT_POLICY_NAME]: true } }); +const roleStack = new aws_cdk_lib_1.Stack(app, 'integ-iam-imported-role-role-stack'); +const role = new aws_iam_1.Role(roleStack, 'TestRole', { + assumedBy: new aws_iam_1.ServicePrincipal('sqs.amazonaws.com'), +}); +const firstStack = new aws_cdk_lib_1.Stack(app, 'integ-iam-imported-role-1'); +const roleInFirstStack = aws_iam_1.Role.fromRoleName(firstStack, 'Role', role.roleName); +roleInFirstStack.addToPrincipalPolicy(new aws_iam_1.PolicyStatement({ resources: ['arn:aws:sqs:*:*:firstQueue'], actions: ['sqs:SendMessage'] })); +const secondStack = new aws_cdk_lib_1.Stack(app, 'integ-iam-imported-role-2'); +secondStack.addDependency(firstStack, 'So that this stack can be tested after both are deployed.'); +const roleInSecondStack = aws_iam_1.Role.fromRoleName(secondStack, 'Role', role.roleName); +roleInSecondStack.addToPrincipalPolicy(new aws_iam_1.PolicyStatement({ resources: ['arn:aws:sqs:*:*:secondQueue'], actions: ['sqs:SendMessage'] })); +const assertionStack = new aws_cdk_lib_1.Stack(app, 'ImportedRoleTestAssertions'); +assertionStack.addDependency(roleStack); +assertionStack.addDependency(firstStack); +assertionStack.addDependency(secondStack); +const test = new integ.IntegTest(app, 'ImportedRoleTest', { + testCases: [roleStack], + assertionStack, +}); +test.assertions + .awsApiCall('IAM', 'listRolePolicies', { RoleName: role.roleName }) + .assertAtPath('PolicyNames.0', integ.ExpectedResult.stringLikeRegexp('^Policyintegiamimportedrole1Role.{8}$')) + .assertAtPath('PolicyN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VuY3koc2Vjb25kU3RhY2spO1xuXG5jb25zdCB0ZXN0ID0gbmV3IGludGVnLkludGVnVGVzdChhcHAsICdJbXBvcnRlZFJvbGVUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtyb2xlU3RhY2tdLFxuICBhc3NlcnRpb25TdGFjayxcbn0pO1xuXG50ZXN0LmFzc2VydGlvbnNcbiAgLmF3c0FwaUNhbGwoJ0lBTScsICdsaXN0Um9sZVBvbGljaWVzJywgeyBSb2xlTmFtZTogcm9sZS5yb2xlTmFtZSB9KVxuICAuYXNzZXJ0QXRQYXRoKCdQb2xpY3lOYW1lcy4wJywgaW50ZWcuRXhwZWN0ZWRSZXN1bHQuc3RyaW5nTGlrZVJlZ2V4cCgnXlBvbGljeWludGVnaWFtaW1wb3J0ZWRyb2xlMVJvbGUuezh9JCcpKVxuICAuYXNzZXJ0QXRQYXRoKCdQb2xpY3lOYW1lcy4xJywgaW50ZWcuRXhwZWN0ZWRSZXN1bHQuc3RyaW5nTGlrZVJlZ2V4cCgnXlBvbGljeWludGVnaWFtaW1wb3J0ZWRyb2xlMlJvbGUuezh9JCcpKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/ImportedRoleTestAssertions.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.group.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-1.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-2.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ-iam-imported-role-role-stack.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.ts similarity index 88% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.ts index 3569d198c6bc4..ee5c6f913cc6e 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.imported-role.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.imported-role.ts @@ -1,9 +1,9 @@ -import { App, Stack } from '@aws-cdk/core'; +import { App, Stack } from 'aws-cdk-lib'; import { IAM_IMPORTED_ROLE_STACK_SAFE_DEFAULT_POLICY_NAME, -} from '@aws-cdk/cx-api'; -import * as integ from '@aws-cdk/integ-tests'; -import { PolicyStatement, Role, ServicePrincipal } from '../lib'; +} from 'aws-cdk-lib/cx-api'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; const app = new App({ context: { [IAM_IMPORTED_ROLE_STACK_SAFE_DEFAULT_POLICY_NAME]: true } }); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js new file mode 100644 index 0000000000000..f690f4b6c40b5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-iam-managed-policy'); +const user = new aws_iam_1.User(stack, 'MyUser'); +const policy = new aws_iam_1.ManagedPolicy(stack, 'OneManagedPolicy', { + managedPolicyName: 'Default', + description: 'My Policy', + path: '/some/path/', +}); +policy.addStatements(new aws_iam_1.PolicyStatement({ resources: ['*'], actions: ['sqs:SendMessage'] })); +policy.attachToUser(user); +const policy2 = new aws_iam_1.ManagedPolicy(stack, 'TwoManagedPolicy'); +policy2.addStatements(new aws_iam_1.PolicyStatement({ resources: ['*'], actions: ['lambda:InvokeFunction'] })); +user.addManagedPolicy(policy2); +const policy3 = aws_iam_1.ManagedPolicy.fromAwsManagedPolicyName('SecurityAudit'); +user.addManagedPolicy(policy3); +const role = new aws_iam_1.Role(stack, 'Role', { assumedBy: new aws_iam_1.AccountRootPrincipal() }); +role.grantAssumeRole(policy.grantPrincipal); +aws_iam_1.Grant.addToPrincipal({ actions: ['iam:*'], resourceArns: [role.roleArn], grantee: policy2 }); +new integ_tests_alpha_1.IntegTest(app, 'ManagedPolicyInteg', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubWFuYWdlZC1wb2xpY3kuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5tYW5hZ2VkLXBvbGljeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUF5QztBQUN6QyxrRUFBdUQ7QUFDdkQsaURBQThHO0FBRTlHLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBRXRCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsNEJBQTRCLENBQUMsQ0FBQztBQUUzRCxNQUFNLElBQUksR0FBRyxJQUFJLGNBQUksQ0FBQyxLQUFLLEVBQUUsUUFBUSxDQUFDLENBQUM7QUFFdkMsTUFBTSxNQUFNLEdBQUcsSUFBSSx1QkFBYSxDQUFDLEtBQUssRUFBRSxrQkFBa0IsRUFBRTtJQUMxRCxpQkFBaUIsRUFBRSxTQUFTO0lBQzVCLFdBQVcsRUFBRSxXQUFXO0lBQ3hCLElBQUksRUFBRSxhQUFhO0NBQ3BCLENBQUMsQ0FBQztBQUNILE1BQU0sQ0FBQyxhQUFhLENBQUMsSUFBSSx5QkFBZSxDQU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XNvdXJjZXM6IFsnKiddLCBhY3Rpb25zOiBbJ2xhbWJkYTpJbnZva2VGdW5jdGlvbiddIH0pKTtcbnVzZXIuYWRkTWFuYWdlZFBvbGljeShwb2xpY3kyKTtcblxuY29uc3QgcG9saWN5MyA9IE1hbmFnZWRQb2xpY3kuZnJvbUF3c01hbmFnZWRQb2xpY3lOYW1lKCdTZWN1cml0eUF1ZGl0Jyk7XG51c2VyLmFkZE1hbmFnZWRQb2xpY3kocG9saWN5Myk7XG5cbmNvbnN0IHJvbGUgPSBuZXcgUm9sZShzdGFjaywgJ1JvbGUnLCB7IGFzc3VtZWRCeTogbmV3IEFjY291bnRSb290UHJpbmNpcGFsKCkgfSk7XG5yb2xlLmdyYW50QXNzdW1lUm9sZShwb2xpY3kuZ3JhbnRQcmluY2lwYWwpO1xuR3JhbnQuYWRkVG9QcmluY2lwYWwoeyBhY3Rpb25zOiBbJ2lhbToqJ10sIHJlc291cmNlQXJuczogW3JvbGUucm9sZUFybl0sIGdyYW50ZWU6IHBvbGljeTIgfSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnTWFuYWdlZFBvbGljeUludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/ManagedPolicyIntegDefaultTestDeployAssert27007DC6.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/aws-cdk-iam-managed-policy.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.imported-role.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.ts similarity index 87% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.ts index 4bbc7372e1285..d30976dc491eb 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.managed-policy.ts @@ -1,6 +1,6 @@ -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AccountRootPrincipal, Grant, ManagedPolicy, PolicyStatement, Role, User } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AccountRootPrincipal, Grant, ManagedPolicy, PolicyStatement, Role, User } from 'aws-cdk-lib/aws-iam'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js new file mode 100644 index 0000000000000..9ee4c0cccae2f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const iam = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'oidc-provider-integ-test'); +const noClients = new iam.OpenIdConnectProvider(stack, 'NoClientsNoThumbprint', { + url: 'https://oidc.eks.us-east-1.amazonaws.com/id/test2', +}); +const clients = new iam.OpenIdConnectProvider(stack, 'Clients', { + url: 'https://oidc.eks.us-east-1.amazonaws.com/id/test3', + clientIds: ['foo', 'bar'], +}); +const thumbprints = new iam.OpenIdConnectProvider(stack, 'Thumbprints', { + url: 'https://oidc.eks.us-east-1.amazonaws.com/id/test4', + thumbprints: [ + 'aa00aa1122aa00aa1122aa00aa1122aa00aa1122', + 'aa00aa1122aa00aa1122aa00aa1122aa00aa1111', + ], +}); +new aws_cdk_lib_1.CfnOutput(stack, 'NoClientsThumbprints', { + value: `${noClients.openIdConnectProviderthumbprints}`, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'ClientsThumbprints', { + value: `${clients.openIdConnectProviderthumbprints}`, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'ThumbprintsThumbprints', { + value: `${thumbprints.openIdConnectProviderthumbprints}`, +}); +new integ_tests_alpha_1.IntegTest(app, 'iodc-provider-test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub2lkYy1wcm92aWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm9pZGMtcHJvdmlkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBb0Q7QUFDcEQsa0VBQXVEO0FBQ3ZELDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLDBCQUEwQixDQUFDLENBQUM7QUFFekQsTUFBTSxTQUFTLEdBQUcsSUFBSSxHQUFHLENBQUMscUJBQXFCLENBQUMsS0FBSyxFQUFFLHVCQUF1QixFQUFFO0lBQzlFLEdBQUcsRUFBRSxtREFBbUQ7Q0FDekQsQ0FBQyxDQUFDO0FBRUgsTUFBTSxPQUFPLEdBQUcsSUFBSSxHQUFHLENBQUMscUJBQXFCLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRTtJQUM5RCxHQUFHLEVBQUUsbURBQW1EO0lBQ3hELFNBQVMsRUFBRSxDQUFDLEtBQUssRUFBRSxLQUFLLENBQUM7Q0FDMUIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxXQUFXLEdBQUcsSUFBSSxHQUFHLENBQUMscUJBQXFCLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRTtJQUN0RSxHQUFHLEVBQUUsbURBQW1EO0lBQ3hELFdBQVcsRUFBRTtRQUNYLDBDQUEwQztRQUMxQywwQ0FBMEM7S0FDM0M7Q0FDRixDQUFDLENBQU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ldyBJbnRlZ1Rlc3QoYXBwLCAnaW9kYy1wcm92aWRlci10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/diff.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/external.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/asset.2df5a59d801a1efa337d7f2787d401cc48d736faa94d1f42eccad2d88f3ce2e3/index.js diff --git a/packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.managed-policy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/iodcprovidertestDefaultTestDeployAssert2D70E37E.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/oidc-provider-integ-test.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.ts similarity index 87% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.ts index d56099c13f584..db6126e6e4eef 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.oidc-provider.ts @@ -1,6 +1,6 @@ -import { App, Stack, CfnOutput } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as iam from '../lib'; +import { App, Stack, CfnOutput } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; const app = new App(); const stack = new Stack(app, 'oidc-provider-integ-test'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js new file mode 100644 index 0000000000000..1e595508ff468 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const supportStack = new aws_cdk_lib_1.Stack(app, 'integ-permissions-boundary-support'); +new aws_iam_1.ManagedPolicy(supportStack, 'PB', { + statements: [new aws_iam_1.PolicyStatement({ + actions: ['*'], + resources: ['*'], + })], + managedPolicyName: `cdk-${supportStack.synthesizer.bootstrapQualifier}-PermissionsBoundary-${supportStack.account}-${supportStack.region}`, +}); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-permissions-boundary', { + env: { + account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION, + }, + permissionsBoundary: aws_cdk_lib_1.PermissionsBoundary.fromName('cdk-${Qualifier}-PermissionsBoundary-${AWS::AccountId}-${AWS::Region}'), +}); +stack.addDependency(supportStack); +new aws_iam_1.Role(stack, 'TestRole', { + assumedBy: new aws_iam_1.ServicePrincipal('sqs.amazonaws.com'), +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-test', { + testCases: [stack], + enableLookups: true, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGVybWlzc2lvbnMtYm91bmRhcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wZXJtaXNzaW9ucy1ib3VuZGFyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUE4RDtBQUM5RCxrRUFBdUQ7QUFDdkQsaURBQTZGO0FBRTdGLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBRXRCLE1BQU0sWUFBWSxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsb0NBQW9DLENBQUMsQ0FBQztBQUMxRSxJQUFJLHVCQUFhLENBQUMsWUFBWSxFQUFFLElBQUksRUFBRTtJQUNwQyxVQUFVLEVBQUUsQ0FBQyxJQUFJLHlCQUFlLENBQUM7WUFDL0IsT0FBTyxFQUFFLENBQUMsR0FBRyxDQUFDO1lBQ2QsU0FBUyxFQUFFLENBQUMsR0FBRyxDQUFDO1NBQ2pCLENBQUMsQ0FBQztJQUNILGlCQUFpQixFQUFFLE9BQU8sWUFBWSxDQUFDLFdBQVcsQ0FBQyxrQkFBa0Isd0JBQXdCLFlBQVksQ0FBQyxPQUFPLElBQUksWUFBWSxDQUFDLE1BQU0sRUFBRTtDQUMzSSxDQUFDLENBQUM7QUFFSCxNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLDRCQUE0QixFQUFFO0lBQ3pELEdBQUcsRUFBRTtRQUNILE9BQU8sRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsbUJBQW1CO1FBQ3pFLE1BQU0sRUFBRSxPQUFPLENBQUM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a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system-with-s3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary-support.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ-permissions-boundary.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.ts similarity index 87% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.ts index c9b36678ef532..531c29d629fb1 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.permissions-boundary.ts @@ -1,6 +1,6 @@ -import { App, Stack, PermissionsBoundary } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Role, ServicePrincipal, ManagedPolicy, PolicyStatement } from '../lib'; +import { App, Stack, PermissionsBoundary } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Role, ServicePrincipal, ManagedPolicy, PolicyStatement } from 'aws-cdk-lib/aws-iam'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js new file mode 100644 index 0000000000000..b5688c9172218 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-iam-policy'); +const user = new aws_iam_1.User(stack, 'MyUser'); +const policy = new aws_iam_1.Policy(stack, 'HelloPolicy', { policyName: 'Default' }); +policy.addStatements(new aws_iam_1.PolicyStatement({ resources: ['*'], actions: ['sqs:SendMessage'] })); +policy.attachToUser(user); +const policy2 = new aws_iam_1.Policy(stack, 'GoodbyePolicy'); +policy2.addStatements(new aws_iam_1.PolicyStatement({ resources: ['*'], actions: ['lambda:InvokeFunction'] })); +policy2.attachToUser(user); +const role = new aws_iam_1.Role(stack, 'Role', { assumedBy: new aws_iam_1.AccountRootPrincipal() }); +role.grantAssumeRole(policy.grantPrincipal); +aws_iam_1.Grant.addToPrincipal({ actions: ['iam:*'], resourceArns: [role.roleArn], grantee: policy2 }); +new integ_tests_alpha_1.IntegTest(app, 'PolicyInteg', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucG9saWN5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucG9saWN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQXlDO0FBQ3pDLGtFQUF1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GljeS5hdHRhY2hUb1VzZXIodXNlcik7XG5cbmNvbnN0IHBvbGljeTIgPSBuZXcgUG9saWN5KHN0YWNrLCAnR29vZGJ5ZVBvbGljeScpO1xucG9saWN5Mi5hZGRTdGF0ZW1lbnRzKG5ldyBQb2xpY3lTdGF0ZW1lbnQoeyByZXNvdXJjZXM6IFsnKiddLCBhY3Rpb25zOiBbJ2xhbWJkYTpJbnZva2VGdW5jdGlvbiddIH0pKTtcbnBvbGljeTIuYXR0YWNoVG9Vc2VyKHVzZXIpO1xuXG5jb25zdCByb2xlID0gbmV3IFJvbGUoc3RhY2ssICdSb2xlJywgeyBhc3N1bWVkQnk6IG5ldyBBY2NvdW50Um9vdFByaW5jaXBhbCgpIH0pO1xucm9sZS5ncmFudEFzc3VtZVJvbGUocG9saWN5LmdyYW50UHJpbmNpcGFsKTtcbkdyYW50LmFkZFRvUHJpbmNpcGFsKHsgYWN0aW9uczogWydpYW06KiddLCByZXNvdXJjZUFybnM6IFtyb2xlLnJvbGVBcm5dLCBncmFudGVlOiBwb2xpY3kyIH0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ1BvbGljeUludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/PolicyIntegDefaultTestDeployAssert274BB918.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/aws-cdk-iam-policy.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.oidc-provider.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.ts similarity index 86% rename from packages/@aws-cdk/aws-iam/test/integ.policy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.ts index 2ad98cb2ed931..0f98857c9f03e 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.policy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.policy.ts @@ -1,6 +1,6 @@ -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AccountRootPrincipal, Grant, Policy, PolicyStatement, Role, User } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AccountRootPrincipal, Grant, Policy, PolicyStatement, Role, User } from 'aws-cdk-lib/aws-iam'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js new file mode 100644 index 0000000000000..129d11af36be7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const iam = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-principal-with-conditions'); +const basePrincipal = new iam.AnyPrincipal(); +const principal = new iam.PrincipalWithConditions(basePrincipal, { + StringLike: { 'aws:username': 'foo-*' }, +}); +principal.addCondition('StringLike', { 'aws:PrincipalTag/owner': 'foo' }); +principal.addCondition('Bool', { 'aws:MultiFactorAuthPresent': 'true' }); +new iam.Role(stack, 'TestRole', { + assumedBy: principal, +}); +new integ_tests_alpha_1.IntegTest(app, 'PrincipalWithCondition', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJpbmNpcGFsLXdpdGgtY29uZGl0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnByaW5jaXBhbC13aXRoLWNvbmRpdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBeUM7QUFDekMsa0VBQXVEO0FBQ3ZELDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUM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jb25kaXRpb25zJyk7XG5cbmNvbnN0IGJhc2VQcmluY2lwYWwgPSBuZXcgaWFtLkFueVByaW5jaXBhbCgpO1xuY29uc3QgcHJpbmNpcGFsID0gbmV3IGlhbS5QcmluY2lwYWxXaXRoQ29uZGl0aW9ucyhiYXNlUHJpbmNpcGFsLCB7XG4gIFN0cmluZ0xpa2U6IHsgJ2F3czp1c2VybmFtZSc6ICdmb28tKicgfSxcbn0pO1xucHJpbmNpcGFsLmFkZENvbmRpdGlvbignU3RyaW5nTGlrZScsIHsgJ2F3czpQcmluY2lwYWxUYWcvb3duZXInOiAnZm9vJyB9KTtcbnByaW5jaXBhbC5hZGRDb25kaXRpb24oJ0Jvb2wnLCB7ICdhd3M6TXVsdGlGYWN0b3JBdXRoUHJlc2VudCc6ICd0cnVlJyB9KTtcblxubmV3IGlhbS5Sb2xlKHN0YWNrLCAnVGVzdFJvbGUnLCB7XG4gIGFzc3VtZWRCeTogcHJpbmNpcGFsLFxufSk7XG5cblxubmV3IEludGVnVGVzdChhcHAsICdQcmluY2lwYWxXaXRoQ29uZGl0aW9uJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/PrincipalWithConditionDefaultTestDeployAssertA4D5A2E9.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.policy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ-principal-with-conditions.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.ts similarity index 79% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.ts index 867c308bacace..7eab73dfd6326 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.principal-with-conditions.ts @@ -1,6 +1,6 @@ -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as iam from '../lib/index'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; const app = new App(); const stack = new Stack(app, 'integ-principal-with-conditions'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js new file mode 100644 index 0000000000000..d8759fed332b3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-iam-role-1'); +const role = new aws_iam_1.Role(stack, 'TestRole', { + assumedBy: new aws_iam_1.ServicePrincipal('sqs.amazonaws.com'), +}); +role.addToPolicy(new aws_iam_1.PolicyStatement({ resources: ['*'], actions: ['sqs:SendMessage'] })); +const policy = new aws_iam_1.Policy(stack, 'HelloPolicy', { policyName: 'Default' }); +policy.addStatements(new aws_iam_1.PolicyStatement({ actions: ['ec2:*'], resources: ['*'] })); +policy.attachToRole(role); +// Role with an external ID +new aws_iam_1.Role(stack, 'TestRole2', { + assumedBy: new aws_iam_1.AccountRootPrincipal(), + externalIds: ['supply-me'], +}); +// Role with an org +new aws_iam_1.Role(stack, 'TestRole3', { + assumedBy: new aws_iam_1.OrganizationPrincipal('o-1234'), +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-iam-role', { + testCases: [stack], +}); +app.synth(); +//# s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3kobmV3IFBvbGljeVN0YXRlbWVudCh7IHJlc291cmNlczogWycqJ10sIGFjdGlvbnM6IFsnc3FzOlNlbmRNZXNzYWdlJ10gfSkpO1xuXG5jb25zdCBwb2xpY3kgPSBuZXcgUG9saWN5KHN0YWNrLCAnSGVsbG9Qb2xpY3knLCB7IHBvbGljeU5hbWU6ICdEZWZhdWx0JyB9KTtcbnBvbGljeS5hZGRTdGF0ZW1lbnRzKG5ldyBQb2xpY3lTdGF0ZW1lbnQoeyBhY3Rpb25zOiBbJ2VjMjoqJ10sIHJlc291cmNlczogWycqJ10gfSkpO1xucG9saWN5LmF0dGFjaFRvUm9sZShyb2xlKTtcblxuLy8gUm9sZSB3aXRoIGFuIGV4dGVybmFsIElEXG5uZXcgUm9sZShzdGFjaywgJ1Rlc3RSb2xlMicsIHtcbiAgYXNzdW1lZEJ5OiBuZXcgQWNjb3VudFJvb3RQcmluY2lwYWwoKSxcbiAgZXh0ZXJuYWxJZHM6IFsnc3VwcGx5LW1lJ10sXG59KTtcblxuLy8gUm9sZSB3aXRoIGFuIG9yZ1xubmV3IFJvbGUoc3RhY2ssICdUZXN0Um9sZTMnLCB7XG4gIGFzc3VtZWRCeTogbmV3IE9yZ2FuaXphdGlvblByaW5jaXBhbCgnby0xMjM0JyksXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdpbnRlZy1pYW0tcm9sZScsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.principal-with-conditions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integ-iam-role-1.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/integiamroleDefaultTestDeployAssert48737E31.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.ts similarity index 83% rename from packages/@aws-cdk/aws-iam/test/integ.role.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.ts index cbb0217deb7a9..89fec30eac73f 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.role.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.role.ts @@ -1,6 +1,6 @@ -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AccountRootPrincipal, OrganizationPrincipal, Policy, PolicyStatement, Role, ServicePrincipal } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AccountRootPrincipal, OrganizationPrincipal, Policy, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js new file mode 100644 index 0000000000000..9c0db2b9917ee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ saml* +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const iam = require("aws-cdk-lib/aws-iam"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const provider = new iam.SamlProvider(this, 'Provider', { + metadataDocument: iam.SamlMetadataDocument.fromFile(path.join(__dirname, 'saml-metadata-document.xml')), + }); + new iam.Role(this, 'Role', { + assumedBy: new iam.SamlConsolePrincipal(provider), + }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'saml-provider-test', { + testCases: [new TestStack(app, 'cdk-saml-provider')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2FtbC1wcm92aWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNhbWwtcHJvdmlkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxvQkFBb0I7QUFDcEIsNkJBQTZCO0FBQzdCLDZDQUFxRDtBQUNyRCxrRUFBdUQ7QUFFdkQsMkNBQTJDO0FBRTNDLE1BQU0sU0FBVSxTQUFRLG1CQUFLO0l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pbXBvcnQgeyBDb25zdHJ1Y3QgfSBmcm9tICdjb25zdHJ1Y3RzJztcbmltcG9ydCAqIGFzIGlhbSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtaWFtJztcblxuY2xhc3MgVGVzdFN0YWNrIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQ29uc3RydWN0LCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIGNvbnN0IHByb3ZpZGVyID0gbmV3IGlhbS5TYW1sUHJvdmlkZXIodGhpcywgJ1Byb3ZpZGVyJywge1xuICAgICAgbWV0YWRhdGFEb2N1bWVudDogaWFtLlNhbWxNZXRhZGF0YURvY3VtZW50LmZyb21GaWxlKHBhdGguam9pbihfX2Rpcm5hbWUsICdzYW1sLW1ldGFkYXRhLWRvY3VtZW50LnhtbCcpKSxcbiAgICB9KTtcblxuICAgIG5ldyBpYW0uUm9sZSh0aGlzLCAnUm9sZScsIHtcbiAgICAgIGFzc3VtZWRCeTogbmV3IGlhbS5TYW1sQ29uc29sZVByaW5jaXBhbChwcm92aWRlciksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ3NhbWwtcHJvdmlkZXItdGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbbmV3IFRlc3RTdGFjayhhcHAsICdjZGstc2FtbC1wcm92aWRlcicpXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/cdk-saml-provider.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/samlprovidertestDefaultTestDeployAssert29A1AF64.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.ts similarity index 80% rename from packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.ts index 57f35b21d1afd..fcb81d5b2be52 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.saml-provider.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.saml-provider.ts @@ -1,9 +1,9 @@ /// !cdk-integ saml* import * as path from 'path'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as iam from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js new file mode 100644 index 0000000000000..fe3550ce598a5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-iam-user'); +new aws_iam_1.User(stack, 'MyUser', { + userName: 'benisrae', + password: aws_cdk_lib_1.SecretValue.unsafePlainText('Test1234567890!'), + passwordResetRequired: true, +}); +const userImportedByArn = aws_iam_1.User.fromUserArn(stack, 'ImportedUserByArn', 'arn:aws:iam::123456789012:user/rossrhodes'); +const userImportedByArnWithPath = aws_iam_1.User.fromUserArn(stack, 'ImportedUserByArnPath', 'arn:aws:iam::123456789012:user/path/johndoe'); +const userImportedByArnPathMultiple = aws_iam_1.User.fromUserArn(stack, 'ImportedUserByArnPathMultiple', 'arn:aws:iam::123456789012:user/p/a/t/h/johndoe'); +const userImportedByAttributes = aws_iam_1.User.fromUserAttributes(stack, 'ImportedUserByAttributes', { + userArn: 'arn:aws:iam::123456789012:user/johndoe', +}); +const userImportedByAttributesPath = aws_iam_1.User.fromUserAttributes(stack, 'ImportedUserByAttributesPath', { + userArn: 'arn:aws:iam::123456789012:user/path/johndoe', +}); +const userImportedByAttributesPathMultiple = aws_iam_1.User.fromUserAttributes(stack, 'ImportedUserByAttributesPathMultiple', { + userArn: 'arn:aws:iam::123456789012:user/p/a/t/h/johndoe', +}); +const userImportedByName = aws_iam_1.User.fromUserName(stack, 'ImportedUserByName', 'janedoe'); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByArn', { value: userImportedByArn.userName }); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByArnPath', { value: userImportedByArnWithPath.userName }); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByArnPathMultiple', { value: userImportedByArnPathMultiple.userName }); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByAttributes', { value: userImportedByAttributes.userName }); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByAttributesPath', { value: userImportedByAttributesPath.userName }); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByAttributesPathMultiple', { value: userImportedByAttributesPathMultiple.userName }); +new aws_cdk_lib_1.CfnOutput(stack, 'NameForUserImportedByName', { value: userImportedByName.userName }); +new integ_tests_alpha_1.IntegTest(app, 'iam-user-test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnVzZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBaUU7QUFDakUsa0VBQXVEO0FBQ3ZELGlEQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUs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JuUGF0aCcsIHsgdmFsdWU6IHVzZXJJbXBvcnRlZEJ5QXJuV2l0aFBhdGgudXNlck5hbWUgfSk7XG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnTmFtZUZvclVzZXJJbXBvcnRlZEJ5QXJuUGF0aE11bHRpcGxlJywgeyB2YWx1ZTogdXNlckltcG9ydGVkQnlBcm5QYXRoTXVsdGlwbGUudXNlck5hbWUgfSk7XG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnTmFtZUZvclVzZXJJbXBvcnRlZEJ5QXR0cmlidXRlcycsIHsgdmFsdWU6IHVzZXJJbXBvcnRlZEJ5QXR0cmlidXRlcy51c2VyTmFtZSB9KTtcbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdOYW1lRm9yVXNlckltcG9ydGVkQnlBdHRyaWJ1dGVzUGF0aCcsIHsgdmFsdWU6IHVzZXJJbXBvcnRlZEJ5QXR0cmlidXRlc1BhdGgudXNlck5hbWUgfSk7XG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnTmFtZUZvclVzZXJJbXBvcnRlZEJ5QXR0cmlidXRlc1BhdGhNdWx0aXBsZScsIHsgdmFsdWU6IHVzZXJJbXBvcnRlZEJ5QXR0cmlidXRlc1BhdGhNdWx0aXBsZS51c2VyTmFtZSB9KTtcbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdOYW1lRm9yVXNlckltcG9ydGVkQnlOYW1lJywgeyB2YWx1ZTogdXNlckltcG9ydGVkQnlOYW1lLnVzZXJOYW1lIH0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2lhbS11c2VyLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/aws-cdk-iam-user.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.role.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/iamusertestDefaultTestDeployAssertBD838880.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.ts similarity index 92% rename from packages/@aws-cdk/aws-iam/test/integ.user.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.ts index 85faf94386a30..505141a26ec40 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.user.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.user.ts @@ -1,6 +1,6 @@ -import { App, CfnOutput, SecretValue, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { User } from '../lib'; +import { App, CfnOutput, SecretValue, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { User } from 'aws-cdk-lib/aws-iam'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js new file mode 100644 index 0000000000000..37882fe5b7438 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-iam-role-1'); +const g1 = new aws_iam_1.Group(stack, 'MyGroup'); +const g2 = new aws_iam_1.Group(stack, 'YourGroup'); +for (let i = 0; i < 5; ++i) { + const user = new aws_iam_1.User(stack, `User${i + 1}`); + user.addToGroup(g1); + g2.addUser(user); +} +const policy = new aws_iam_1.Policy(stack, 'MyPolicy'); +policy.attachToGroup(g1); +policy.addStatements(new aws_iam_1.PolicyStatement({ + resources: [g2.groupArn], + actions: ['iam:*'], +})); +new integ_tests_alpha_1.IntegTest(app, 'iam-role-test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudXNlcnMtYW5kLWdyb3Vwcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnVzZXJzLWFuZC1ncm91cHMudHMiXSwibmFtZXMiOltdL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XN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.user.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/iamroletestDefaultTestDeployAssert00952CFF.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.assets.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/integ-iam-role-1.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.ts similarity index 75% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.ts index 45c8ddeb58c9d..46a9ad5c660a1 100644 --- a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/integ.users-and-groups.ts @@ -1,6 +1,6 @@ -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Group, Policy, PolicyStatement, User } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Group, Policy, PolicyStatement, User } from 'aws-cdk-lib/aws-iam'; const app = new App(); diff --git a/packages/@aws-cdk/aws-iam/test/saml-metadata-document.xml b/packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/saml-metadata-document.xml similarity index 100% rename from packages/@aws-cdk/aws-iam/test/saml-metadata-document.xml rename to packages/@aws-cdk-testing/framework-integ/test/aws-iam/test/saml-metadata-document.xml diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js new file mode 100644 index 0000000000000..4314f55244b28 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_kinesis_1 = require("aws-cdk-lib/aws-kinesis"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-kinesis-stream-dashboard'); +const stream = new aws_kinesis_1.Stream(stack, 'myStream'); +const dashboard = new cloudwatch.Dashboard(stack, 'StreamDashboard'); +function graphWidget(title, metric) { + return new cloudwatch.GraphWidget({ + title, + left: [metric], + width: 12, + height: 5, + }); +} +function percentGraphWidget(title, countMetric, totalMetric) { + return new cloudwatch.GraphWidget({ + title, + left: [new cloudwatch.MathExpression({ + expression: '( count / total ) * 100', + usingMetrics: { + count: countMetric, + total: totalMetric, + }, + })], + width: 12, + height: 5, + }); +} +dashboard.addWidgets(graphWidget('Get records - sum (Bytes)', stream.metricGetRecordsBytes({ statistic: 'Sum' })), graphWidget('Get records iterator age - maximum (Milliseconds)', stream.metricGetRecordsIteratorAgeMilliseconds()), graphWidget('Get records latency - average (Milliseconds)', stream.metricGetRecordsLatency()), graphWidget('Get records - sum (Count)', stream.metricGetRecords({ statistic: 'Sum' })), graphWidget('Get records success - average (Percent)', stream.metricGetRecordsSuccess()), graphWidget('Incoming data - sum (Bytes)', stream.metricIncomingBytes({ statistic: 'Sum' })), graphWidget('Incoming records - sum (Count)', stream.metricIncomingRecords({ statistic: 'Sum' })), graphWidget('Put record - sum (Bytes)', stream.metricPutRecordBytes({ statistic: 'Sum' })), graphWidget('Put record latency - average (Milliseconds)', stream.metricPutRecordLatency()), graphWidget('Put record success - average (Percent)', stream.metricPutRecordSuccess()), graphWidget('Put records - sum (Bytes)', stream.metricPutRecordsBytes({ statistic: 'Sum' })), graphWidget('Put records latency - average (Milliseconds)', stream.metricPutRecordsLatency()), graphWidget('Read throughput exceeded - average (Percent)', stream.metricReadProvisionedThroughputExceeded()), graphWidget('Write throughput exceeded - average (Count)', stream.metricWriteProvisionedThroughputExceeded()), percentGraphWidget('Put records successful records - average (Percent)', stream.metricPutRecordsSuccessfulRecords(), stream.metricPutRecordsTotalRecords()), percentGraphWidget('Put records failed records - average (Percent)', stream.metricPutRecordsFailedRecords(), stream.metricPutRecordsTotalRecords()), percentGraphWidget('Put records throttled records - average (Percent)', stream.metricPutRecordsThrottledRecords(), stream.metricPutRecordsTotalRecords())); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RyZWFtLWRhc2hib2FyZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnN0cmVhbS1kYXNoYm9hcmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5REFBeUQ7QUFDekQsNkNBQXlDO0FBQ3pDLHlEQUFpRDtBQUVqRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLGdDQUFnQyxDQUFDLENBQUM7QUFFL0QsTUFBTSxNQUFNLEdBQUcsSUFBSSxvQkFBTSxDQUFDLEtBQUssRUFBRSxVQUFVLENBQUMsQ0FBQztBQUU3QyxNQUFNLFNBQVMsR0FBRyxJQUFJLFVBQVUsQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLGlCQUFpQixDQUFDLENBQUM7QUFFckUsU0FBUyxXQUFXLENBQUMsS0FBYSxFQUFFLE1BQXlCO0lBQzNELE9BQU8sSUFBSSxVQUFVLENBQUMsV0FBVyxDQUFDO1FBQ2hDLEtBQUs7UUFDTCxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUM7UUFDZCxLQUFLLEVBQUUsRUFBRTtRQUNULE1BQU0sRUFBRSxDQUFDO0tBQ1YsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQUVELFNBQVMsa0JBQWtCLENBQUMsS0FBYSxFQUFFLFdBQThCLEVBQUUsV0FBOEI7SUFDdkcsT0FBTyxJQUFJLFVBQVUsQ0FBQyxXQUFXLENBQUM7UUFDaEMsS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NmdWxSZWNvcmRzKCksIHN0cmVhbS5tZXRyaWNQdXRSZWNvcmRzVG90YWxSZWNvcmRzKCkpLFxuICBwZXJjZW50R3JhcGhXaWRnZXQoJ1B1dCByZWNvcmRzIGZhaWxlZCByZWNvcmRzIC0gYXZlcmFnZSAoUGVyY2VudCknLFxuICAgIHN0cmVhbS5tZXRyaWNQdXRSZWNvcmRzRmFpbGVkUmVjb3JkcygpLCBzdHJlYW0ubWV0cmljUHV0UmVjb3Jkc1RvdGFsUmVjb3JkcygpKSxcbiAgcGVyY2VudEdyYXBoV2lkZ2V0KCdQdXQgcmVjb3JkcyB0aHJvdHRsZWQgcmVjb3JkcyAtIGF2ZXJhZ2UgKFBlcmNlbnQpJyxcbiAgICBzdHJlYW0ubWV0cmljUHV0UmVjb3Jkc1Rocm90dGxlZFJlY29yZHMoKSwgc3RyZWFtLm1ldHJpY1B1dFJlY29yZHNUb3RhbFJlY29yZHMoKSksXG4pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/event-bus/integ.event-bus.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.assets.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.assets.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.template.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ-kinesis-stream-dashboard.template.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.ts similarity index 94% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.ts index cb1dcadf749be..a9e1b47912ef0 100644 --- a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream-dashboard.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { App, Stack } from '@aws-cdk/core'; -import { Stream } from '../lib'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import { App, Stack } from 'aws-cdk-lib'; +import { Stream } from 'aws-cdk-lib/aws-kinesis'; const app = new App(); const stack = new Stack(app, 'integ-kinesis-stream-dashboard'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js new file mode 100644 index 0000000000000..e23f493305303 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_kinesis_1 = require("aws-cdk-lib/aws-kinesis"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-kinesis-stream'); +const role = new iam.Role(stack, 'UserRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); +const stream = new aws_kinesis_1.Stream(stack, 'myStream'); +stream.grantReadWrite(role); +//# sourceM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CeTogbmV3IGlhbS5BY2NvdW50Um9vdFByaW5jaXBhbCgpLFxufSk7XG5cbmNvbnN0IHN0cmVhbSA9IG5ldyBTdHJlYW0oc3RhY2ssICdteVN0cmVhbScpO1xuXG5zdHJlYW0uZ3JhbnRSZWFkV3JpdGUocm9sZSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-fsx/test/integ.lustre-file-system.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.assets.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.assets.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.template.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/integ-kinesis-stream.template.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.ts new file mode 100644 index 0000000000000..9fd7f18a90356 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kinesis/test/integ.stream.ts @@ -0,0 +1,14 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, Stack } from 'aws-cdk-lib'; +import { Stream } from 'aws-cdk-lib/aws-kinesis'; + +const app = new App(); +const stack = new Stack(app, 'integ-kinesis-stream'); + +const role = new iam.Role(stack, 'UserRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); + +const stream = new Stream(stack, 'myStream'); + +stream.grantReadWrite(role); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js new file mode 100644 index 0000000000000..786a875bee2eb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_kms_1 = require("aws-cdk-lib/aws-kms"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-kms-hmac'); +const role = new aws_iam_1.Role(stack, 'Role', { + assumedBy: new aws_iam_1.AccountRootPrincipal(), +}); +const key = new aws_kms_1.Key(stack, 'MyHmacKey', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + keyUsage: aws_kms_1.KeyUsage.GENERATE_VERIFY_MAC, + keySpec: aws_kms_1.KeySpec.HMAC_512, +}); +key.grantGenerateMac(role); +key.grantVerifyMac(role); +new integ_tests_alpha_1.IntegTest(app, 'HmacIntegTest', { + testCases: [ + stack, + ], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2V5LWhtYWMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5rZXktaG1hYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRTtBQUNqRSw2Q0FBd0Q7QUFDeEQsa0VBQXVEO0FBQ3ZELGlEQUE2RDtBQUU3RCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLGtCQUFrQixDQUFDLENBQUM7QUFFakQsTUFBTSxJ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LCAnYXdzLWNkay1rbXMtaG1hYycpO1xuXG5jb25zdCByb2xlID0gbmV3IFJvbGUoc3RhY2ssICdSb2xlJywge1xuICBhc3N1bWVkQnk6IG5ldyBBY2NvdW50Um9vdFByaW5jaXBhbCgpLFxufSk7XG5cbmNvbnN0IGtleSA9IG5ldyBLZXkoc3RhY2ssICdNeUhtYWNLZXknLCB7XG4gIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAga2V5VXNhZ2U6IEtleVVzYWdlLkdFTkVSQVRFX1ZFUklGWV9NQUMsXG4gIGtleVNwZWM6IEtleVNwZWMuSE1BQ181MTIsXG59KTtcblxua2V5LmdyYW50R2VuZXJhdGVNYWMocm9sZSk7XG5rZXkuZ3JhbnRWZXJpZnlNYWMocm9sZSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnSG1hY0ludGVnVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbXG4gICAgc3RhY2ssXG4gIF0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG5cblxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.assets.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.template.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/HmacIntegTestDefaultTestDeployAssert10C19CC4.template.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.assets.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.assets.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.template.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/aws-cdk-kms-hmac.template.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-hmac.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.ts new file mode 100644 index 0000000000000..e16092506d2ae --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-hmac.ts @@ -0,0 +1,31 @@ +import { AccountRootPrincipal, Role } from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Key, KeySpec, KeyUsage } from 'aws-cdk-lib/aws-kms'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-kms-hmac'); + +const role = new Role(stack, 'Role', { + assumedBy: new AccountRootPrincipal(), +}); + +const key = new Key(stack, 'MyHmacKey', { + removalPolicy: RemovalPolicy.DESTROY, + keyUsage: KeyUsage.GENERATE_VERIFY_MAC, + keySpec: KeySpec.HMAC_512, +}); + +key.grantGenerateMac(role); +key.grantVerifyMac(role); + +new IntegTest(app, 'HmacIntegTest', { + testCases: [ + stack, + ], +}); + +app.synth(); + + diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js new file mode 100644 index 0000000000000..261381efb4229 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const cdk = require("aws-cdk-lib"); +const kms = require("aws-cdk-lib/aws-kms"); +const app = new cdk.App(); +/// !show +/** + * Stack that defines the key + */ +class KeyStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.key = new kms.Key(this, 'MyKey', { removalPolicy: cdk.RemovalPolicy.DESTROY }); + } +} +/** + * Stack that uses the key + */ +class UseStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // Use the IKey object here. + new kms.Alias(this, 'Alias', { + aliasName: 'alias/foo', + targetKey: props.key, + }); + } +} +const keyStack = new KeyStack(app, 'KeyStack'); +new UseStack(app, 'UseStack', { key: keyStack.key }); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2V5LXNoYXJpbmcubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcua2V5LXNoYXJpbmcubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsZ0JBQWdCO0FBQ2hCLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQU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sIHtcbiAgICAgIGFsaWFzTmFtZTogJ2FsaWFzL2ZvbycsXG4gICAgICB0YXJnZXRLZXk6IHByb3BzLmtleSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBrZXlTdGFjayA9IG5ldyBLZXlTdGFjayhhcHAsICdLZXlTdGFjaycpO1xubmV3IFVzZVN0YWNrKGFwcCwgJ1VzZVN0YWNrJywgeyBrZXk6IGtleVN0YWNrLmtleSB9KTtcbi8vLyAhaGlkZVxuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/KeyStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/KeyStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/KeyStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/KeyStack.template.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/UseStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/UseStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/UseStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/UseStack.template.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key-sharing.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.ts new file mode 100644 index 0000000000000..1078be60e0a96 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key-sharing.lit.ts @@ -0,0 +1,44 @@ +/// !cdk-integ * +import * as cdk from 'aws-cdk-lib'; +import * as kms from 'aws-cdk-lib/aws-kms'; + +const app = new cdk.App(); + +/// !show + +/** + * Stack that defines the key + */ +class KeyStack extends cdk.Stack { + public readonly key: kms.Key; + + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.key = new kms.Key(this, 'MyKey', { removalPolicy: cdk.RemovalPolicy.DESTROY }); + } +} + +interface UseStackProps extends cdk.StackProps { + key: kms.IKey; // Use IKey here +} + +/** + * Stack that uses the key + */ +class UseStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props: UseStackProps) { + super(scope, id, props); + + // Use the IKey object here. + new kms.Alias(this, 'Alias', { + aliasName: 'alias/foo', + targetKey: props.key, + }); + } +} + +const keyStack = new KeyStack(app, 'KeyStack'); +new UseStack(app, 'UseStack', { key: keyStack.key }); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js new file mode 100644 index 0000000000000..fcf213052f425 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_kms_1 = require("aws-cdk-lib/aws-kms"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-kms-1'); +const key = new aws_kms_1.Key(stack, 'MyKey', { removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY }); +key.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['kms:encrypt'], + principals: [new iam.ArnPrincipal(stack.account)], +})); +key.addAlias('alias/bar'); +new aws_kms_1.Key(stack, 'AsymmetricKey', { + keySpec: aws_kms_1.KeySpec.ECC_NIST_P256, + keyUsage: aws_kms_1.KeyUsage.SIGN_VERIFY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +app.synth(); +//# sourceMappingUR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CJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBpYW0gZnJvbSAnYXdzLWNkay1saWIvYXdzLWlhbSc7XG5pbXBvcnQgeyBBcHAsIFJlbW92YWxQb2xpY3ksIFN0YWNrIH0gZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgS2V5LCBLZXlTcGVjLCBLZXlVc2FnZSB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1rbXMnO1xuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IFN0YWNrKGFwcCwgJ2F3cy1jZGsta21zLTEnKTtcblxuY29uc3Qga2V5ID0gbmV3IEtleShzdGFjaywgJ015S2V5JywgeyByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1kgfSk7XG5cbmtleS5hZGRUb1Jlc291cmNlUG9saWN5KG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgcmVzb3VyY2VzOiBbJyonXSxcbiAgYWN0aW9uczogWydrbXM6ZW5jcnlwdCddLFxuICBwcmluY2lwYWxzOiBbbmV3IGlhbS5Bcm5QcmluY2lwYWwoc3RhY2suYWNjb3VudCldLFxufSkpO1xuXG5rZXkuYWRkQWxpYXMoJ2FsaWFzL2JhcicpO1xuXG5uZXcgS2V5KHN0YWNrLCAnQXN5bW1ldHJpY0tleScsIHtcbiAga2V5U3BlYzogS2V5U3BlYy5FQ0NfTklTVF9QMjU2LFxuICBrZXlVc2FnZTogS2V5VXNhZ2UuU0lHTl9WRVJJRlksXG4gIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.assets.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/aws-cdk-kms-1.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis-firehose/integ.kinesis-firehose-stream.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.ts similarity index 75% rename from packages/@aws-cdk/aws-kms/test/integ.key.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.ts index 18a7da10d50a2..05ae34fe1edd7 100644 --- a/packages/@aws-cdk/aws-kms/test/integ.key.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-kms/test/integ.key.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { Key, KeySpec, KeyUsage } from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Key, KeySpec, KeyUsage } from 'aws-cdk-lib/aws-kms'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js new file mode 100644 index 0000000000000..433e81dddf96f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sns = require("aws-cdk-lib/aws-sns"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const destinations = require("aws-cdk-lib/aws-lambda-destinations"); +/* + * Stack verification steps: + * * aws lambda invoke --function-name --invocation-type Event --payload '"OK"' response.json + * * aws lambda invoke --function-name --invocation-type Event --payload '"NOT OK"' response.json + */ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const topic = new sns.Topic(this, 'Topic'); + this.queue = new sqs.Queue(this, 'Queue'); + this.fn = new lambda.Function(this, 'SnsSqs', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => { + if (event.status === 'OK') return 'success'; + throw new Error('failure'); + };`), + onFailure: new destinations.SnsDestination(topic), + onSuccess: new destinations.SqsDestination(this.queue), + maxEventAge: aws_cdk_lib_1.Duration.hours(3), + retryAttempts: 1, + }); + const onSuccessLambda = new lambda.Function(this, 'OnSucces', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => { + console.log(event); + };`), + }); + new lambda.Function(this, 'EventBusLambda', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => { + if (event.status === 'OK') return 'success'; + throw new Error('failure'); + };`), + onFailure: new destinations.EventBridgeDestination(), + onSuccess: new destinations.LambdaDestination(onSuccessLambda), + }); + const version = this.fn.addVersion('MySpecialVersion'); + new lambda.Alias(this, 'MySpecialAlias', { + aliasName: 'MySpecialAlias', + version, + onSuccess: new destinations.SqsDestination(this.queue), + onFailure: new destinations.SnsDestination(topic), + maxEventAge: aws_cdk_lib_1.Duration.hours(2), + retryAttempts: 0, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'aws-cdk-lambda-destinations'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'Destinations', { + testCases: [stack], +}); +integ.assertions.invokeFunction({ + functionName: stack.fn.functionName, + invocationType: integ_tests_alpha_1.InvocationType.EVENT, + payload: JSON.stringify({ status: 'OK' }), +}); +const message = integ.assertions.awsApiCall('SQS', 'receiveMessage', { + QueueUrl: stack.queue.queueUrl, + WaitTimeSeconds: 20, +}); +message.assertAtPath('Messages.0.Body', integ_tests_alpha_1.ExpectedResult.objectLike({ + requestContext: { + condition: 'Success', + }, + requestPayload: { + status: 'OK', + }, + responseContext: { + statusCode: 200, + }, + responsePayload: 'success', +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVzdGluYXRpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZGVzdGluYXRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsNkNBQStEO0FBQy9ELGtFQUF1RjtBQUV2RixvRUFBb0U7QUFFcEU7Ozs7R0FJRztBQUVILE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBRzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQztRQUMzQyxJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsT0FBTyxDQUFDLENBQUM7UUFFMUMsSUFBSSxDQUFDLEVBQUUsR0FBRyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRTtZQUM1QyxP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cGUuRVZFTlQsXG4gIHBheWxvYWQ6IEpTT04uc3RyaW5naWZ5KHsgc3RhdHVzOiAnT0snIH0pLFxufSk7XG5cbmNvbnN0IG1lc3NhZ2UgPSBpbnRlZy5hc3NlcnRpb25zLmF3c0FwaUNhbGwoJ1NRUycsICdyZWNlaXZlTWVzc2FnZScsIHtcbiAgUXVldWVVcmw6IHN0YWNrLnF1ZXVlLnF1ZXVlVXJsLFxuICBXYWl0VGltZVNlY29uZHM6IDIwLFxufSk7XG5cbm1lc3NhZ2UuYXNzZXJ0QXRQYXRoKCdNZXNzYWdlcy4wLkJvZHknLCBFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgcmVxdWVzdENvbnRleHQ6IHtcbiAgICBjb25kaXRpb246ICdTdWNjZXNzJyxcbiAgfSxcbiAgcmVxdWVzdFBheWxvYWQ6IHtcbiAgICBzdGF0dXM6ICdPSycsXG4gIH0sXG4gIHJlc3BvbnNlQ29udGV4dDoge1xuICAgIHN0YXR1c0NvZGU6IDIwMCxcbiAgfSxcbiAgcmVzcG9uc2VQYXlsb2FkOiAnc3VjY2VzcycsXG59KSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.assets.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/DestinationsDefaultTestDeployAssertCC49E667.template.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.assets.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/aws-cdk-lambda-destinations.template.json diff --git a/packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.permissions-boundary.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.ts similarity index 90% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.ts index f3d6293fc2455..b87b2434b8fd4 100644 --- a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.destinations.ts @@ -1,10 +1,10 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, Duration, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest, InvocationType, ExpectedResult } from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, Duration, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest, InvocationType, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as destinations from '../lib'; +import * as destinations from 'aws-cdk-lib/aws-lambda-destinations'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js new file mode 100644 index 0000000000000..1b0ead7160ba7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const destinations = require("aws-cdk-lib/aws-lambda-destinations"); +// Test success case with: +// 1. Invoke first function in the chain +// aws lambda invoke --function-name --invocation-type Event --payload '"OK"' response.json +// 2. Check logs of third function (should show 'Event: "OK"') +// aws logs filter-log-events --log-group-name /aws/lambda/ +// +// Test failure case with: +// 1. Invoke first function in the chain +// aws lambda invoke --function-name --invocation-type Event --payload '"error"' response.json +// 2. Check logs of error function (should show 'Event: {"errorType": "Error", "errorMessage": "UnkownError", "trace":"..."}') +// aws logs filter-log-events --log-group-name /aws/lambda/ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const lambdaProps = { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => { + console.log('Event: %j', event); + if (event.status === 'error') throw new Error('UnkownError'); + return event; + };`), + }; + const first = new lambda.Function(this, 'First', lambdaProps); + const second = new lambda.Function(this, 'Second', lambdaProps); + const third = new lambda.Function(this, 'Third', lambdaProps); + const error = new lambda.Function(this, 'Error', lambdaProps); + this.firstFunctionName = first.functionName; + this.thirdFunctionName = third.functionName; + first.configureAsyncInvoke({ + onSuccess: new destinations.LambdaDestination(second, { responseOnly: true }), + onFailure: new destinations.LambdaDestination(error, { responseOnly: true }), + retryAttempts: 0, + }); + second.configureAsyncInvoke({ + onSuccess: new destinations.LambdaDestination(third, { responseOnly: true }), + }); + new aws_cdk_lib_1.CfnOutput(this, 'FirstFunctionName', { value: first.functionName }); + new aws_cdk_lib_1.CfnOutput(this, 'ThirdFunctionName', { value: third.functionName }); + new aws_cdk_lib_1.CfnOutput(this, 'ErrorFunctionName', { value: error.functionName }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'aws-cdk-lambda-chain'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'LambdaDestChain3', { + testCases: [stack], +}); +integ.assertions.invokeFunction({ + functionName: stack.firstFunctionName, + invocationType: integ_tests_alpha_1.InvocationType.EVENT, + payload: JSON.stringify({ + status: 'success', + }), +}); +integ.assertions.awsApiCall('CloudWatchLogs', 'filterLogEvents', { + logGroupName: `/aws/lambda/${stack.thirdFunctionName}`, +}).expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + events: integ_tests_alpha_1.Match.arrayWith([ + integ_tests_alpha_1.Match.objectLike({ + message: integ_tests_alpha_1.Match.stringLikeRegexp('success'), + }), + ]), +})).waitForAssertions(); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWNoYWluLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGFtYmRhLWNoYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELDZDQUFnRTtBQUNoRSxrRUFBOEY7QUFFOUYsb0VBQW9FO0FBRXBFLDBCQUEwQjtBQUMxQix3Q0FBd0M7QUFDeEMsbUhBQW1IO0FBQ25ILDhEQUE4RDtBQUM5RCxrRkFBa0Y7QUFDbEYsRUFBRTtBQUNGLDBCQUEwQjtBQUMxQix3Q0FBd0M7QUFDeEMsc0hBQXNIO0FBQ3RILDhIQUE4SDtBQUM5SCxrRkFBa0Y7QUFFbEYsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFHM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLFdBQVcsR0FBeUI7WUFDeEMsT0FBTyxFQUFFLE1BQU0sQ0FBQyxPQUFPLENBQUMsV0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nVuY3Rpb25OYW1lOiBzdGFjay5maXJzdEZ1bmN0aW9uTmFtZSxcbiAgaW52b2NhdGlvblR5cGU6IEludm9jYXRpb25UeXBlLkVWRU5ULFxuICBwYXlsb2FkOiBKU09OLnN0cmluZ2lmeSh7XG4gICAgc3RhdHVzOiAnc3VjY2VzcycsXG4gIH0pLFxufSk7XG5cbmludGVnLmFzc2VydGlvbnMuYXdzQXBpQ2FsbCgnQ2xvdWRXYXRjaExvZ3MnLCAnZmlsdGVyTG9nRXZlbnRzJywge1xuICBsb2dHcm91cE5hbWU6IGAvYXdzL2xhbWJkYS8ke3N0YWNrLnRoaXJkRnVuY3Rpb25OYW1lfWAsXG59KS5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIGV2ZW50czogTWF0Y2guYXJyYXlXaXRoKFtcbiAgICBNYXRjaC5vYmplY3RMaWtlKHtcbiAgICAgIG1lc3NhZ2U6IE1hdGNoLnN0cmluZ0xpa2VSZWdleHAoJ3N1Y2Nlc3MnKSxcbiAgICB9KSxcbiAgXSksXG59KSkud2FpdEZvckFzc2VydGlvbnMoKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.assets.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/LambdaDestChain3DefaultTestDeployAssertB72F10E8.template.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.assets.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/aws-cdk-lambda-chain.template.json diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.ts similarity index 93% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.ts index cb6ebe3a21847..1f04c4b87d71f 100644 --- a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-destinations/test/integ.lambda-chain.ts @@ -1,8 +1,8 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, CfnOutput, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, InvocationType, Match } from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, CfnOutput, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, InvocationType, Match } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as destinations from '../lib'; +import * as destinations from 'aws-cdk-lib/aws-lambda-destinations'; // Test success case with: // 1. Invoke first function in the chain diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js new file mode 100644 index 0000000000000..84146523169b5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-event-source-filter-criteria-dynamodb'); +const fn = new test_function_1.TestFunction(stack, 'F'); +const table = new dynamodb.Table(stack, 'T', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + stream: dynamodb.StreamViewType.NEW_IMAGE, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +fn.addEventSource(new aws_lambda_event_sources_1.DynamoEventSource(table, { + batchSize: 5, + startingPosition: lambda.StartingPosition.LATEST, + filters: [ + lambda.FilterCriteria.filter({ + eventName: lambda.FilterRule.isEqual('INSERT'), + dynamodb: { + Keys: { + id: { + S: lambda.FilterRule.exists(), + }, + }, + }, + }), + ], +})); +new integ.IntegTest(app, 'DynamoDBFilterCriteria', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGItd2l0aC1maWx0ZXItY3JpdGVyaWEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5keW5hbW9kYi13aXRoLWZpbHRlci1jcml0ZXJpYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUFxRDtBQUNyRCxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxtREFBK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gc3RyZWFtOiBkeW5hbW9kYi5TdHJlYW1WaWV3VHlwZS5ORVdfSU1BR0UsXG4gIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG59KTtcblxuZm4uYWRkRXZlbnRTb3VyY2UobmV3IER5bmFtb0V2ZW50U291cmNlKHRhYmxlLCB7XG4gIGJhdGNoU2l6ZTogNSxcbiAgc3RhcnRpbmdQb3NpdGlvbjogbGFtYmRhLlN0YXJ0aW5nUG9zaXRpb24uTEFURVNULFxuICBmaWx0ZXJzOiBbXG4gICAgbGFtYmRhLkZpbHRlckNyaXRlcmlhLmZpbHRlcih7XG4gICAgICBldmVudE5hbWU6IGxhbWJkYS5GaWx0ZXJSdWxlLmlzRXF1YWwoJ0lOU0VSVCcpLFxuICAgICAgZHluYW1vZGI6IHtcbiAgICAgICAgS2V5czoge1xuICAgICAgICAgIGlkOiB7XG4gICAgICAgICAgICBTOiBsYW1iZGEuRmlsdGVyUnVsZS5leGlzdHMoKSxcbiAgICAgICAgICB9LFxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICB9KSxcbiAgXSxcbn0pKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdEeW5hbW9EQkZpbHRlckNyaXRlcmlhJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/DynamoDBFilterCriteriaDefaultTestDeployAssert448231D5.template.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.destinations.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-dynamodb.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.ts similarity index 76% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.ts index 538901e035e5c..544290074e7f6 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.ts @@ -1,9 +1,9 @@ -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { TestFunction } from './test-function'; -import { DynamoEventSource } from '../lib'; +import { DynamoEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js new file mode 100644 index 0000000000000..81e481fb66092 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamodb = require("aws-cdk-lib/aws-dynamodb"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class DynamoEventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new test_function_1.TestFunction(this, 'F'); + const queue = new dynamodb.Table(this, 'T', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + stream: dynamodb.StreamViewType.NEW_IMAGE, + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + fn.addEventSource(new aws_lambda_event_sources_1.DynamoEventSource(queue, { + batchSize: 5, + startingPosition: lambda.StartingPosition.TRIM_HORIZON, + tumblingWindow: cdk.Duration.seconds(60), + })); + } +} +const app = new cdk.App(); +new DynamoEventSourceTest(app, 'lambda-event-source-dynamodb'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZHluYW1vZGIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5keW5hbW9kYi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUFxRDtBQUNyRCxpREFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLG1EQUErQztBQUMvQyxtRkFBeUU7QUFFekUsTUFBTSxxQkFBc0IsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMzQyxZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFL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jZGsuQXBwKCk7XG5uZXcgRHluYW1vRXZlbnRTb3VyY2VUZXN0KGFwcCwgJ2xhbWJkYS1ldmVudC1zb3VyY2UtZHluYW1vZGInKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/kinesis/integ.kinesis-stream.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/lambda-event-source-dynamodb.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.ts new file mode 100644 index 0000000000000..12597ac4da723 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.dynamodb.ts @@ -0,0 +1,31 @@ +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { TestFunction } from './test-function'; +import { DynamoEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +class DynamoEventSourceTest extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new TestFunction(this, 'F'); + const queue = new dynamodb.Table(this, 'T', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, + stream: dynamodb.StreamViewType.NEW_IMAGE, + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + + fn.addEventSource(new DynamoEventSource(queue, { + batchSize: 5, + startingPosition: lambda.StartingPosition.TRIM_HORIZON, + tumblingWindow: cdk.Duration.seconds(60), + })); + } +} + +const app = new cdk.App(); +new DynamoEventSourceTest(app, 'lambda-event-source-dynamodb'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js new file mode 100644 index 0000000000000..5c007f1f2f60e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class KafkaSelfManagedEventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const dummyCertString = `-----BEGIN CERTIFICATE----- +MIIE5DCCAsygAwIBAgIRAPJdwaFaNRrytHBto0j5BA0wDQYJKoZIhvcNAQELBQAw +cmUuiAii9R0= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIFgjCCA2qgAwIBAgIQdjNZd6uFf9hbNC5RdfmHrzANBgkqhkiG9w0BAQsFADBb +c8PH3PSoAaRwMMgOSA2ALJvbRz8mpg== +-----END CERTIFICATE-----" +`; + const dummyPrivateKey = `-----BEGIN ENCRYPTED PRIVATE KEY----- +zp2mwJn2NYB7AZ7+imp0azDZb+8YG2aUCiyqb6PnnA== +-----END ENCRYPTED PRIVATE KEY-----`; + const fn = new test_function_1.TestFunction(this, 'F'); + const rootCASecret = new secretsmanager.Secret(this, 'S', { + secretObjectValue: { + certificate: cdk.SecretValue.unsafePlainText(dummyCertString), + }, + }); + const clientCertificatesSecret = new secretsmanager.Secret(this, 'SC', { + secretObjectValue: { + certificate: cdk.SecretValue.unsafePlainText(dummyCertString), + privateKey: cdk.SecretValue.unsafePlainText(dummyPrivateKey), + }, + }); + rootCASecret.grantRead(fn); + clientCertificatesSecret.grantRead(fn); + const bootstrapServers = [ + 'my-self-hosted-kafka-broker-1:9092', + 'my-self-hosted-kafka-broker-2:9092', + 'my-self-hosted-kafka-broker-3:9092', + ]; + fn.addEventSource(new aws_lambda_event_sources_1.SelfManagedKafkaEventSource({ + bootstrapServers, + topic: 'my-test-topic', + consumerGroupId: 'myTestConsumerGroup', + secret: clientCertificatesSecret, + authenticationMethod: aws_lambda_event_sources_1.AuthenticationMethod.CLIENT_CERTIFICATE_TLS_AUTH, + rootCACertificate: rootCASecret, + startingPosition: lambda.StartingPosition.TRIM_HORIZON, + })); + } +} +const app = new cdk.App(); +const stack = new KafkaSelfManagedEventSourceTest(app, 'lambda-event-source-kafka-self-managed'); +new integ.IntegTest(app, 'LambdaEventSourceKafkaSelfManagedTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2Fma2Etc2VsZm1hbmFnZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5rYWZrYS1zZWxmbWFu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YWdlZEthZmthRXZlbnRTb3VyY2Uoe1xuICAgICAgICBib290c3RyYXBTZXJ2ZXJzLFxuICAgICAgICB0b3BpYzogJ215LXRlc3QtdG9waWMnLFxuICAgICAgICBjb25zdW1lckdyb3VwSWQ6ICdteVRlc3RDb25zdW1lckdyb3VwJyxcbiAgICAgICAgc2VjcmV0OiBjbGllbnRDZXJ0aWZpY2F0ZXNTZWNyZXQsXG4gICAgICAgIGF1dGhlbnRpY2F0aW9uTWV0aG9kOiBBdXRoZW50aWNhdGlvbk1ldGhvZC5DTElFTlRfQ0VSVElGSUNBVEVfVExTX0FVVEgsXG4gICAgICAgIHJvb3RDQUNlcnRpZmljYXRlOiByb290Q0FTZWNyZXQsXG4gICAgICAgIHN0YXJ0aW5nUG9zaXRpb246IGxhbWJkYS5TdGFydGluZ1Bvc2l0aW9uLlRSSU1fSE9SSVpPTixcbiAgICAgIH0pLFxuICAgICk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IEthZmthU2VsZk1hbmFnZWRFdmVudFNvdXJjZVRlc3QoXG4gIGFwcCxcbiAgJ2xhbWJkYS1ldmVudC1zb3VyY2Uta2Fma2Etc2VsZi1tYW5hZ2VkJyxcbik7XG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ0xhbWJkYUV2ZW50U291cmNlS2Fma2FTZWxmTWFuYWdlZFRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/LambdaEventSourceKafkaSelfManagedTestDefaultTestDeployAssertAF78BD0F.template.json diff --git a/packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/sns/integ.sns-event-rule-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/lambda-event-source-kafka-self-managed.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.ts similarity index 89% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.ts index 77b01157276f0..3503f56ad26b3 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kafka-selfmanaged.ts @@ -1,9 +1,9 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { TestFunction } from './test-function'; -import { AuthenticationMethod, SelfManagedKafkaEventSource } from '../lib'; +import { AuthenticationMethod, SelfManagedKafkaEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; class KafkaSelfManagedEventSourceTest extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js new file mode 100644 index 0000000000000..b46e135b63006 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kinesis = require("aws-cdk-lib/aws-kinesis"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'lambda-event-source-kinesis-at-timestamp'); +const fn = new test_function_1.TestFunction(stack, 'F'); +const stream = new kinesis.Stream(stack, 'S'); +fn.addEventSource(new aws_lambda_event_sources_1.KinesisEventSource(stream, { + startingPosition: lambda.StartingPosition.AT_TIMESTAMP, + startingPositionTimestamp: 1655237653, +})); +new integ.IntegTest(app, 'AtTimestamp', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2luZXNpcy1hdC10aW1lc3RhbXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5raW5lc2lzLWF0LXRpbWVzdGFtcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1EQUFtRDtBQUNuRCxpREFBaUQ7QUFDakQsNkNBQXlDO0FBQ3pDLG9EQUFvRDtBQUNwRCxtREFBK0M7QUFDL0MsbUZBQTBFO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2lzRXZlbnRTb3VyY2UgfSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtbGFtYmRhLWV2ZW50LXNvdXJjZXMnO1xuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IFN0YWNrKGFwcCwgJ2xhbWJkYS1ldmVudC1zb3VyY2Uta2luZXNpcy1hdC10aW1lc3RhbXAnKTtcblxuY29uc3QgZm4gPSBuZXcgVGVzdEZ1bmN0aW9uKHN0YWNrLCAnRicpO1xuXG5jb25zdCBzdHJlYW0gPSBuZXcga2luZXNpcy5TdHJlYW0oc3RhY2ssICdTJyk7XG5cbmZuLmFkZEV2ZW50U291cmNlKG5ldyBLaW5lc2lzRXZlbnRTb3VyY2Uoc3RyZWFtLCB7XG4gIHN0YXJ0aW5nUG9zaXRpb246IGxhbWJkYS5TdGFydGluZ1Bvc2l0aW9uLkFUX1RJTUVTVEFNUCxcbiAgc3RhcnRpbmdQb3NpdGlvblRpbWVzdGFtcDogMTY1NTIzNzY1Myxcbn0pKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdBdFRpbWVzdGFtcCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/AtTimestampDefaultTestDeployAssert8000E9DC.template.json diff --git a/packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-destinations/test/integ.lambda-chain.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/lambda-event-source-kinesis-at-timestamp.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.ts new file mode 100644 index 0000000000000..9bba77c92eb05 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.ts @@ -0,0 +1,25 @@ +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { TestFunction } from './test-function'; +import { KinesisEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +const app = new App(); + +const stack = new Stack(app, 'lambda-event-source-kinesis-at-timestamp'); + +const fn = new TestFunction(stack, 'F'); + +const stream = new kinesis.Stream(stack, 'S'); + +fn.addEventSource(new KinesisEventSource(stream, { + startingPosition: lambda.StartingPosition.AT_TIMESTAMP, + startingPositionTimestamp: 1655237653, +})); + +new integ.IntegTest(app, 'AtTimestamp', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js new file mode 100644 index 0000000000000..f5316bd6f71bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kinesis = require("aws-cdk-lib/aws-kinesis"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class KinesisEventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new test_function_1.TestFunction(this, 'F'); + const stream = new kinesis.Stream(this, 'Q'); + fn.addEventSource(new aws_lambda_event_sources_1.KinesisEventSource(stream, { + startingPosition: lambda.StartingPosition.TRIM_HORIZON, + tumblingWindow: cdk.Duration.seconds(60), + })); + } +} +const app = new cdk.App(); +new KinesisEventSourceTest(app, 'lambda-event-source-kinesis'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2luZXNpcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmtpbmVzaXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtREFBbUQ7QUFDbkQsaURBQWlEO0FBQ2pELG1DQUFtQztBQUNuQyxtREFBK0M7QUFDL0MsbUZBQTBFO0FBRTFFLE1BQU0sc0JBQXVCLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDNUMsWUFBWSxLQUFjLEVBQUUsRUFBVTtRQUNwQyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sRUFBRSxHQUFHLElBQUksNEJBQVksQ0FBQyxJQUFJLEVBQUUsR0FBRyxDQUFDLENBQUM7UUFDdkMsTUFBTSxNQUFNLEdBQUcsSUFBSSxPQUFPLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxHQUFHLENBQUMsQ0FBQztRQUU3QyxFQUFFLENBQUMsY0FBYyxDQUFDLElBQUksNkNBQWtCLENBQUMsTUFBTSxFQUFFO1lBQy9DLGdCQUFnQixFQUFFLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxZQUFZO1lBQ3RELGNBQWMsRUFBRSxHQUFHLENBQUMsUUFBUSxDQU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XRpb24uVFJJTV9IT1JJWk9OLFxuICAgICAgdHVtYmxpbmdXaW5kb3c6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDYwKSxcbiAgICB9KSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBLaW5lc2lzRXZlbnRTb3VyY2VUZXN0KGFwcCwgJ2xhbWJkYS1ldmVudC1zb3VyY2Uta2luZXNpcycpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb-with-filter-criteria.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/lambda-event-source-kinesis.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.ts new file mode 100644 index 0000000000000..ca53f286111f4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesis.ts @@ -0,0 +1,23 @@ +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { TestFunction } from './test-function'; +import { KinesisEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +class KinesisEventSourceTest extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new TestFunction(this, 'F'); + const stream = new kinesis.Stream(this, 'Q'); + + fn.addEventSource(new KinesisEventSource(stream, { + startingPosition: lambda.StartingPosition.TRIM_HORIZON, + tumblingWindow: cdk.Duration.seconds(60), + })); + } +} + +const app = new cdk.App(); +new KinesisEventSourceTest(app, 'lambda-event-source-kinesis'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js new file mode 100644 index 0000000000000..c253d15ca1c90 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kinesis = require("aws-cdk-lib/aws-kinesis"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +/* + * Stack verification steps: + * * aws kinesis put-record --stream-name --partition-key 123 --data testdata + * * aws sqs receive-message --queue-url --max-number-of-messages 1 --query 'Messages[0].Body' + * The last command should return a string that contains the Lambda function ARN in it. + */ +async function handler(event) { + // eslint-disable-next-line no-console + console.log('event:', JSON.stringify(event, undefined, 2)); + throw new Error(); +} +class KinesisWithDLQTest extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new lambda.Function(this, 'F', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + }); + new aws_cdk_lib_1.CfnOutput(this, 'FunctionArn', { value: fn.functionArn }); + const stream = new kinesis.Stream(this, 'S'); + new aws_cdk_lib_1.CfnOutput(this, 'InputKinesisStreamName', { value: stream.streamName }); + const dlq = new sqs.Queue(this, 'Q'); + new aws_cdk_lib_1.CfnOutput(this, 'DlqSqsQueueUrl', { value: dlq.queueUrl }); + fn.addEventSource(new aws_lambda_event_sources_1.KinesisEventSource(stream, { + startingPosition: lambda.StartingPosition.TRIM_HORIZON, + onFailure: new aws_lambda_event_sources_1.SqsDlq(dlq), + retryAttempts: 0, + })); + } +} +const app = new aws_cdk_lib_1.App(); +new KinesisWithDLQTest(app, 'lambda-event-source-kinesis-with-dlq'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2luZXNpc3dpdGhkbHEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5raW5lc2lzd2l0aGRscS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1EQUFtRDtBQUNuRCxpREFBaUQ7QUFDakQsMkNBQTJDO0FBQzNDLDZDQUFvRDtBQUNwRCxtRkFBa0Y7QUFFbEY7Ozs7O0dBS0c7QUFFSCxLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQVU7SUFDL0Isc0NBQXNDO0lBQ3RDLE9BQU8sQ0FBQyxHQUFHLENBQUMsUUFBUSxFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQzNELE1BQU0sSUFBSSxLQUFLLEVBQUUsQ0FBQztBQUNwQixDQUFDO0FBRU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hpcywgJ0lucHV0S2luZXNpc1N0cmVhbU5hbWUnLCB7IHZhbHVlOiBzdHJlYW0uc3RyZWFtTmFtZSB9KTtcblxuICAgIGNvbnN0IGRscSA9IG5ldyBzcXMuUXVldWUodGhpcywgJ1EnKTtcbiAgICBuZXcgQ2ZuT3V0cHV0KHRoaXMsICdEbHFTcXNRdWV1ZVVybCcsIHsgdmFsdWU6IGRscS5xdWV1ZVVybCB9KTtcblxuICAgIGZuLmFkZEV2ZW50U291cmNlKG5ldyBLaW5lc2lzRXZlbnRTb3VyY2Uoc3RyZWFtLCB7XG4gICAgICBzdGFydGluZ1Bvc2l0aW9uOiBsYW1iZGEuU3RhcnRpbmdQb3NpdGlvbi5UUklNX0hPUklaT04sXG4gICAgICBvbkZhaWx1cmU6IG5ldyBTcXNEbHEoZGxxKSxcbiAgICAgIHJldHJ5QXR0ZW1wdHM6IDAsXG4gICAgfSkpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBLaW5lc2lzV2l0aERMUVRlc3QoYXBwLCAnbGFtYmRhLWV2ZW50LXNvdXJjZS1raW5lc2lzLXdpdGgtZGxxJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis-at-timestamp.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/lambda-event-source-kinesis-with-dlq.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts similarity index 83% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts index b909d213f0b8b..8979fcf7c36f9 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.kinesiswithdlq.ts @@ -1,8 +1,8 @@ -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { KinesisEventSource, SqsDlq } from '../lib'; +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { KinesisEventSource, SqsDlq } from 'aws-cdk-lib/aws-lambda-event-sources'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js new file mode 100644 index 0000000000000..dc5c5218a3d67 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class S3EventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new test_function_1.TestFunction(this, 'F'); + const bucket = new s3.Bucket(this, 'B', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + fn.addEventSource(new aws_lambda_event_sources_1.S3EventSource(bucket, { + events: [s3.EventType.OBJECT_CREATED], + filters: [{ prefix: 'subdir/' }], + })); + } +} +const app = new cdk.App(); +new S3EventSourceTest(app, 'lambda-event-source-s3'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuczMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsbURBQStDO0FBQy9DLG1GQUFxRTtBQUVyRSxNQUFNLGlCQUFrQixTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQ3ZDLFlBQVksS0FBYyxFQUFFLEVBQVU7UUFDcEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixNQUFNLEVBQUUsR0FBRyxJQUFJLDRCQUFZLENBQUMsSUFBSSxFQUFFLEdBQUcsQ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XG4gICAgc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIGNvbnN0IGZuID0gbmV3IFRlc3RGdW5jdGlvbih0aGlzLCAnRicpO1xuICAgIGNvbnN0IGJ1Y2tldCA9IG5ldyBzMy5CdWNrZXQodGhpcywgJ0InLCB7XG4gICAgICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICAgICAgYXV0b0RlbGV0ZU9iamVjdHM6IHRydWUsXG4gICAgfSk7XG5cbiAgICBmbi5hZGRFdmVudFNvdXJjZShuZXcgUzNFdmVudFNvdXJjZShidWNrZXQsIHtcbiAgICAgIGV2ZW50czogW3MzLkV2ZW50VHlwZS5PQkpFQ1RfQ1JFQVRFRF0sXG4gICAgICBmaWx0ZXJzOiBbeyBwcmVmaXg6ICdzdWJkaXIvJyB9XSxcbiAgICB9KSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBTM0V2ZW50U291cmNlVGVzdChhcHAsICdsYW1iZGEtZXZlbnQtc291cmNlLXMzJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.eventbus.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/lambda-event-source-s3.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.ts similarity index 79% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.ts index 917c982e17008..5c84f658f6b71 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.s3.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { TestFunction } from './test-function'; -import { S3EventSource } from '../lib'; +import { S3EventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; class S3EventSourceTest extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js new file mode 100644 index 0000000000000..de176707f7ed6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class SqsEventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new test_function_1.TestFunction(this, 'F'); + const topic = new sns.Topic(this, 'T'); + fn.addEventSource(new aws_lambda_event_sources_1.SnsEventSource(topic)); + } +} +const app = new cdk.App(); +new SqsEventSourceTest(app, 'lambda-event-source-sns'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQ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gc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIGNvbnN0IGZuID0gbmV3IFRlc3RGdW5jdGlvbih0aGlzLCAnRicpO1xuICAgIGNvbnN0IHRvcGljID0gbmV3IHNucy5Ub3BpYyh0aGlzLCAnVCcpO1xuXG4gICAgZm4uYWRkRXZlbnRTb3VyY2UobmV3IFNuc0V2ZW50U291cmNlKHRvcGljKSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBTcXNFdmVudFNvdXJjZVRlc3QoYXBwLCAnbGFtYmRhLWV2ZW50LXNvdXJjZS1zbnMnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-events/test/integ.archive.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/lambda-event-source-sns.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.ts new file mode 100644 index 0000000000000..8ed62fd5798dc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sns.ts @@ -0,0 +1,19 @@ +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import { TestFunction } from './test-function'; +import { SnsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +class SqsEventSourceTest extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new TestFunction(this, 'F'); + const topic = new sns.Topic(this, 'T'); + + fn.addEventSource(new SnsEventSource(topic)); + } +} + +const app = new cdk.App(); +new SqsEventSourceTest(app, 'lambda-event-source-sns'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js new file mode 100644 index 0000000000000..5d5292d2b2517 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class SqsEventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new test_function_1.TestFunction(this, 'F'); + const queue = new sqs.Queue(this, 'Q'); + fn.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(queue, { + batchSize: 5, + maxConcurrency: 5, + })); + } +} +const app = new cdk.App(); +const stack = new SqsEventSourceTest(app, 'sqs-event-source-max-concurrency'); +new integ_tests_alpha_1.IntegTest(app, 'sqs-max-concurrency-integ-test', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJz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eW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/sqs-event-source-max-concurrency.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.ts new file mode 100644 index 0000000000000..35651a2d17c52 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-max-concurrency.ts @@ -0,0 +1,28 @@ +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { TestFunction } from './test-function'; +import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +class SqsEventSourceTest extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new TestFunction(this, 'F'); + const queue = new sqs.Queue(this, 'Q'); + + fn.addEventSource(new SqsEventSource(queue, { + batchSize: 5, + maxConcurrency: 5, + })); + } +} + +const app = new cdk.App(); +const stack = new SqsEventSourceTest(app, 'sqs-event-source-max-concurrency'); + +new IntegTest(app, 'sqs-max-concurrency-integ-test', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js new file mode 100644 index 0000000000000..9cf26090196a6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-event-source-filter-criteria-sqs'); +const fn = new test_function_1.TestFunction(stack, 'F'); +const queue = new sqs.Queue(stack, 'Q'); +fn.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(queue, { + batchSize: 5, + filters: [ + lambda.FilterCriteria.filter({ + body: { + id: lambda.FilterRule.exists(), + }, + }), + ], +})); +new integ.IntegTest(app, 'SQSFilterCriteria', { + testC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0pKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdTUVNGaWx0ZXJDcml0ZXJpYScsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/SQSFilterCriteriaDefaultTestDeployAssert70A9A808.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesis.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/lambda-event-source-filter-criteria-sqs.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.ts new file mode 100644 index 0000000000000..3890428a70ff8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.ts @@ -0,0 +1,30 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { TestFunction } from './test-function'; +import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'lambda-event-source-filter-criteria-sqs'); + +const fn = new TestFunction(stack, 'F'); +const queue = new sqs.Queue(stack, 'Q'); + +fn.addEventSource(new SqsEventSource(queue, { + batchSize: 5, + filters: [ + lambda.FilterCriteria.filter({ + body: { + id: lambda.FilterRule.exists(), + }, + }), + ], +})); + +new integ.IntegTest(app, 'SQSFilterCriteria', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js new file mode 100644 index 0000000000000..a6a401c4f74e8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const test_function_1 = require("./test-function"); +const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources"); +class SqsEventSourceTest extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new test_function_1.TestFunction(this, 'F'); + const queue = new sqs.Queue(this, 'Q'); + fn.addEventSource(new aws_lambda_event_sources_1.SqsEventSource(queue, { + batchSize: 5, + })); + } +} +const app = new cdk.App(); +new SqsEventSourceTest(app, 'lambda-event-source-sqs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3FzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3FzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxtREFBK0M7QUFDL0MsbUZBQXNFO0FBRXRFLE1BQU0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TtcblxuICAgIGNvbnN0IGZuID0gbmV3IFRlc3RGdW5jdGlvbih0aGlzLCAnRicpO1xuICAgIGNvbnN0IHF1ZXVlID0gbmV3IHNxcy5RdWV1ZSh0aGlzLCAnUScpO1xuXG4gICAgZm4uYWRkRXZlbnRTb3VyY2UobmV3IFNxc0V2ZW50U291cmNlKHF1ZXVlLCB7XG4gICAgICBiYXRjaFNpemU6IDUsXG4gICAgfSkpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5uZXcgU3FzRXZlbnRTb3VyY2VUZXN0KGFwcCwgJ2xhbWJkYS1ldmVudC1zb3VyY2Utc3FzJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-kinesis/test/integ.stream-dashboard.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.assets.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/lambda-event-source-sqs.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.ts new file mode 100644 index 0000000000000..7c74e50006cf0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/integ.sqs.ts @@ -0,0 +1,21 @@ +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import { TestFunction } from './test-function'; +import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'; + +class SqsEventSourceTest extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new TestFunction(this, 'F'); + const queue = new sqs.Queue(this, 'Q'); + + fn.addEventSource(new SqsEventSource(queue, { + batchSize: 5, + })); + } +} + +const app = new cdk.App(); +new SqsEventSourceTest(app, 'lambda-event-source-sqs'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.d.ts new file mode 100644 index 0000000000000..882549339a9f9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.d.ts @@ -0,0 +1,5 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as constructs from 'constructs'; +export declare class TestFunction extends lambda.Function { + constructor(scope: constructs.Construct, id: string); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.js new file mode 100644 index 0000000000000..952c04254b382 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestFunction = void 0; +const lambda = require("aws-cdk-lib/aws-lambda"); +class TestFunction extends lambda.Function { + constructor(scope, id) { + super(scope, id, { + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + runtime: lambda.Runtime.NODEJS_14_X, + }); + } +} +exports.TestFunction = TestFunction; +/* eslint-disable no-console */ +async function handler(event) { + console.log('event:', JSON.stringify(event, undefined, 2)); + return { event }; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC1mdW5jdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2V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XI6ICdpbmRleC5oYW5kbGVyJyxcbiAgICAgIGNvZGU6IGxhbWJkYS5Db2RlLmZyb21JbmxpbmUoYGV4cG9ydHMuaGFuZGxlciA9ICR7aGFuZGxlci50b1N0cmluZygpfWApLFxuICAgICAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gICAgfSk7XG4gIH1cbn1cblxuLyogZXNsaW50LWRpc2FibGUgbm8tY29uc29sZSAqL1xuYXN5bmMgZnVuY3Rpb24gaGFuZGxlcihldmVudDogYW55KSB7XG4gIGNvbnNvbGUubG9nKCdldmVudDonLCBKU09OLnN0cmluZ2lmeShldmVudCwgdW5kZWZpbmVkLCAyKSk7XG4gIHJldHVybiB7IGV2ZW50IH07XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.ts new file mode 100644 index 0000000000000..c5204b267fc62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-event-sources/test/test-function.ts @@ -0,0 +1,18 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as constructs from 'constructs'; + +export class TestFunction extends lambda.Function { + constructor(scope: constructs.Construct, id: string) { + super(scope, id, { + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + runtime: lambda.Runtime.NODEJS_14_X, + }); + } +} + +/* eslint-disable no-console */ +async function handler(event: any) { + console.log('event:', JSON.stringify(event, undefined, 2)); + return { event }; +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.d.ts new file mode 100644 index 0000000000000..6225c5bf079d7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.d.ts @@ -0,0 +1 @@ +export declare function handler(): (string | undefined)[]; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.js new file mode 100644 index 0000000000000..ea09f08dc3a29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +function handler() { + return [ + process.env.KEY, + process.env.BOOL, + process.env.NUMBER, + process.env.STRING, + ]; +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmaW5lLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZGVmaW5lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLFNBQWdCLE9BQU87SUFDckIsT0FBTztRQUNMLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRztRQUNmLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSTtRQUNoQixPQUFPLENBQUMsR0FBRyxDQUFDLE1BQU07UUFDbEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNO0tBQ25CLENBQUM7QUFDSixDQUFDO0FBUEQsMEJBT0MiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaGFuZGxlcigpIHtcbiAgcmV0dXJuIFtcbiAgICBwcm9jZXNzLmVudi5LRVksXG4gICAgcHJvY2Vzcy5lbnYuQk9PTCxcbiAgICBwcm9jZXNzLmVudi5OVU1CRVIsXG4gICAgcHJvY2Vzcy5lbnYuU1RSSU5HLFxuICBdO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/define.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/define.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/define.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.d.ts new file mode 100644 index 0000000000000..bc49bdd93ab29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.d.ts @@ -0,0 +1 @@ +export declare function handler(): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.js new file mode 100644 index 0000000000000..4b664238425e8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +/* eslint-disable no-console */ +// @ts-ignore +const client_s3_1 = require("@aws-sdk/client-s3"); // eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved +const s3 = new client_s3_1.S3Client(); +async function handler() { + console.log(s3); +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwZW5kZW5jaWVzLXNkay12My5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImRlcGVuZGVuY2llcy1zZGstdjMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsK0JBQStCO0FBQy9CLGFBQWE7QUFDYixrREFBOEMsQ0FBQyw4RUFBOEU7QUFFN0gsTUFBTSxFQUFFLEdBQUcsSUFBSSxvQkFBUSxFQUFFLENBQUM7QUFFbkIsS0FBSyxVQUFVLE9BQU87SUFDM0IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUNsQixDQUFDO0FBRkQsMEJBRUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1jb25zb2xlICovXG4vLyBAdHMtaWdub3JlXG5pbXBvcnQgeyBTM0NsaWVudCB9IGZyb20gJ0Bhd3Mtc2RrL2NsaWVudC1zMyc7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgaW1wb3J0L25vLWV4dHJhbmVvdXMtZGVwZW5kZW5jaWVzLCBpbXBvcnQvbm8tdW5yZXNvbHZlZFxuXG5jb25zdCBzMyA9IG5ldyBTM0NsaWVudCgpO1xuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaGFuZGxlcigpIHtcbiAgY29uc29sZS5sb2coczMpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies-sdk-v3.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.d.ts new file mode 100644 index 0000000000000..bc49bdd93ab29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.d.ts @@ -0,0 +1 @@ +export declare function handler(): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.js new file mode 100644 index 0000000000000..3b8dce303c94c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +/* eslint-disable no-console */ +const aws_sdk_1 = require("aws-sdk"); // eslint-disable-line import/no-extraneous-dependencies +const delay_1 = require("delay"); +const s3 = new aws_sdk_1.S3(); +async function handler() { + console.log(s3); + await (0, delay_1.default)(5); +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwZW5kZW5jaWVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZGVwZW5kZW5jaWVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUErQjtBQUMvQixxQ0FBNkIsQ0FBQyx3REFBd0Q7QUFDdEYsaUNBQTBCO0FBRTFCLE1BQU0sRUFBRSxHQUFHLElBQUksWUFBRSxFQUFFLENBQUM7QUFFYixLQUFLLFVBQVUsT0FBTztJQUMzQixPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFDO0lBQ2hCLE1BQU0sSUFBQSxlQUFLLEVBQUMsQ0FBQyxDQUFDLENBQUM7QUFDakIsQ0FBQztBQUhELDBCQUdDIiwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbm8tY29uc29sZSAqL1xuaW1wb3J0IHsgUzMgfSBmcm9tICdhd3Mtc2RrJzsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBpbXBvcnQvbm8tZXh0cmFuZW91cy1kZXBlbmRlbmNpZXNcbmltcG9ydCBkZWxheSBmcm9tICdkZWxheSc7XG5cbmNvbnN0IHMzID0gbmV3IFMzKCk7XG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBoYW5kbGVyKCkge1xuICBjb25zb2xlLmxvZyhzMyk7XG4gIGF3YWl0IGRlbGF5KDUpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/dependencies.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/dependencies.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.d.ts new file mode 100644 index 0000000000000..bc49bdd93ab29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.d.ts @@ -0,0 +1 @@ +export declare function handler(): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.js new file mode 100644 index 0000000000000..110ec35fa795c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +/* eslint-disable no-console */ +const crypto = require("crypto"); +async function handler() { + console.log(crypto.createHash('sha512').update('cdk').digest('hex')); +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXNtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZXNtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQUErQjtBQUMvQixpQ0FBaUM7QUFFMUIsS0FBSyxVQUFVLE9BQU87SUFDM0IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQztBQUN2RSxDQUFDO0FBRkQsMEJBRUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1jb25zb2xlICovXG5pbXBvcnQgKiBhcyBjcnlwdG8gZnJvbSAnY3J5cHRvJztcblxuZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIGhhbmRsZXIoKSB7XG4gIGNvbnNvbGUubG9nKGNyeXB0by5jcmVhdGVIYXNoKCdzaGE1MTInKS51cGRhdGUoJ2NkaycpLmRpZ2VzdCgnaGV4JykpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/esm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/esm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/esm.ts diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/js-handler.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/js-handler.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/js-handler.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/js-handler.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.d.ts new file mode 100644 index 0000000000000..bc49bdd93ab29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.d.ts @@ -0,0 +1 @@ +export declare function handler(): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.js new file mode 100644 index 0000000000000..27878862e231a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +// eslint-disable-next-line import/no-extraneous-dependencies +const axios_1 = require("axios"); +async function handler() { + await axios_1.default.get('https://www.google.com'); +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVwZW5kZW5jaWVzLXBucG0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJkZXBlbmRlbmNpZXMtcG5wbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QsaUNBQTBCO0FBRW5CLEtBQUssVUFBVSxPQUFPO0lBQzNCLE1BQU0sZUFBSyxDQUFDLEdBQUcsQ0FBQyx3QkFBd0IsQ0FBQyxDQUFDO0FBQzVDLENBQUM7QUFGRCwwQkFFQyIsInNvdXJjZXNDb250ZW50IjpbIi8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBpbXBvcnQvbm8tZXh0cmFuZW91cy1kZXBlbmRlbmNpZXNcbmltcG9ydCBheGlvcyBmcm9tICdheGlvcyc7XG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBoYW5kbGVyKCkge1xuICBhd2FpdCBheGlvcy5nZXQoJ2h0dHBzOi8vd3d3Lmdvb2dsZS5jb20nKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/dependencies-pnpm.ts diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/pnpm/pnpm-lock.yaml diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.d.ts new file mode 100644 index 0000000000000..bc49bdd93ab29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.d.ts @@ -0,0 +1 @@ +export declare function handler(): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.js new file mode 100644 index 0000000000000..f965b92e2c068 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.js @@ -0,0 +1,31 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +function enumerable(value) { + return function (_target, _propertyKey, descriptor) { + descriptor.enumerable = value; + }; +} +class Greeter { + constructor(message) { + this.greeting = message; + } + greet() { + return 'Hello, ' + this.greeting; + } +} +__decorate([ + enumerable(false) +], Greeter.prototype, "greet", null); +async function handler() { + const message = new Greeter('World').greet(); + console.log(message); // eslint-disable-line no-console +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHMtZGVjb3JhdG9yLWhhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ0cy1kZWNvcmF0b3ItaGFuZGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxTQUFTLFVBQVUsQ0FBQyxLQUFjO0lBQ2hDLE9BQU8sVUFBVSxPQUFZLEVBQUUsWUFBb0IsRUFBRSxVQUE4QjtRQUNqRixVQUFVLENBQUMsVUFBVSxHQUFHLEtBQUssQ0FBQztJQUNoQyxDQUFDLENBQUM7QUFDSixDQUFDO0FBRUQsTUFBTSxPQUFPO0lBRVgsWUFBWSxPQUFlO1FBQ3pCLElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDO0lBQzFCLENBQUM7SUFHRCxLQUFLO1FBQ0gsT0FBTyxTQUFTLEdBQUcsSUFBSSxDQUFDLFFBQVEsQ0FBQztJQUNuQyxDQUFDO0NBQ0Y7QUFIQztJQURDLFVBQVUsQ0FBQyxLQUFLLENBQUM7b0NBR2pCO0FBSUksS0FBSyxVQUFVLE9BQU87SUFDM0IsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0MsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLGlDQUFpQztBQUN6RCxDQUFDO0FBSEQsMEJBR0MiLCJzb3VyY2VzQ29udGVudCI6WyJmdW5jdGlvbiBlbnVtZXJhYmxlKHZhbHVlOiBib29sZWFuKSB7XG4gIHJldHVybiBmdW5jdGlvbiAoX3RhcmdldDogYW55LCBfcHJvcGVydHlLZXk6IHN0cmluZywgZGVzY3JpcHRvcjogUHJvcGVydHlEZXNjcmlwdG9yKSB7XG4gICAgZGVzY3JpcHRvci5lbnVtZXJhYmxlID0gdmFsdWU7XG4gIH07XG59XG5cbmNsYXNzIEdyZWV0ZXIge1xuICBncmVldGluZzogc3RyaW5nO1xuICBjb25zdHJ1Y3RvcihtZXNzYWdlOiBzdHJpbmcpIHtcbiAgICB0aGlzLmdyZWV0aW5nID0gbWVzc2FnZTtcbiAgfVxuXG4gIEBlbnVtZXJhYmxlKGZhbHNlKVxuICBncmVldCgpIHtcbiAgICByZXR1cm4gJ0hlbGxvLCAnICsgdGhpcy5ncmVldGluZztcbiAgfVxufVxuXG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBoYW5kbGVyKCk6IFByb21pc2U8dm9pZD4ge1xuICBjb25zdCBtZXNzYWdlID0gbmV3IEdyZWV0ZXIoJ1dvcmxkJykuZ3JlZXQoKTtcbiAgY29uc29sZS5sb2cobWVzc2FnZSk7IC8vIGVzbGludC1kaXNhYmxlLWxpbmUgbm8tY29uc29sZVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-decorator-handler.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.d.ts new file mode 100644 index 0000000000000..bc49bdd93ab29 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.d.ts @@ -0,0 +1 @@ +export declare function handler(): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.js new file mode 100644 index 0000000000000..dc6a8062b6a10 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +const util_1 = require("./util"); +async function handler() { + console.log((0, util_1.mult)(3, 4)); // eslint-disable-line no-console +} +exports.handler = handler; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHMtaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRzLWhhbmRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsaUNBQThCO0FBRXZCLEtBQUssVUFBVSxPQUFPO0lBQzNCLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBQSxXQUFJLEVBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxpQ0FBaUM7QUFDNUQsQ0FBQztBQUZELDBCQUVDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgbXVsdCB9IGZyb20gJy4vdXRpbCc7XG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBoYW5kbGVyKCk6IFByb21pc2U8dm9pZD4ge1xuICBjb25zb2xlLmxvZyhtdWx0KDMsIDQpKTsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby1jb25zb2xlXG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-handler.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.js new file mode 100644 index 0000000000000..2eb471baa273d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const http_1 = require("http"); +const util_1 = require("./util"); +// Create simple http server +const server = new http_1.Server((_req, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end(`${(0, util_1.mult)(3, 4)}`); + console.log((0, util_1.mult)(3, 4)); // eslint-disable-line no-console +}); +const port = parseInt(process.env.PORT || '3001', 10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GVIZWFkKDIwMCwgeyAnQ29udGVudC1UeXBlJzogJ3RleHQvcGxhaW4nIH0pO1xuICByZXMuZW5kKGAke211bHQoMywgNCl9YCk7XG4gIGNvbnNvbGUubG9nKG11bHQoMywgNCkpOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLWNvbnNvbGVcbn0pO1xuXG5jb25zdCBwb3J0ID0gcGFyc2VJbnQocHJvY2Vzcy5lbnYuUE9SVCB8fCAnMzAwMScsIDEwKTtcbnNlcnZlci5saXN0ZW4ocG9ydCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-handler.ts diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/ts-web-run.sh diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.d.ts new file mode 100644 index 0000000000000..d87ed809ebff8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.d.ts @@ -0,0 +1,2 @@ +export declare function add(a: number, b: number): number; +export declare function mult(a: number, b: number): number; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.js new file mode 100644 index 0000000000000..441f0efc98d92 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mult = exports.add = void 0; +function add(a, b) { + return a + b; +} +exports.add = add; +function mult(a, b) { + return a * b; +} +exports.mult = mult; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsU0FBZ0IsR0FBRyxDQUFDLENBQVMsRUFBRSxDQUFTO0lBQ3RDLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNmLENBQUM7QUFGRCxrQkFFQztBQUVELFNBQWdCLElBQUksQ0FBQyxDQUFTLEVBQUUsQ0FBUztJQUN2QyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDZixDQUFDO0FBRkQsb0JBRUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gYWRkKGE6IG51bWJlciwgYjogbnVtYmVyKTogbnVtYmVyIHtcbiAgcmV0dXJuIGEgKyBiO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gbXVsdChhOiBudW1iZXIsIGI6IG51bWJlcik6IG51bWJlciB7XG4gIHJldHVybiBhICogYjtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/util.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ-handlers/util.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ-handlers/util.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js new file mode 100644 index 0000000000000..2c3ec84f61d68 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda-nodejs"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new lambda.NodejsFunction(this, 'ts-decorator-handler', { + entry: path.join(__dirname, 'integ-handlers/ts-decorator-handler.ts'), + bundling: { + minify: true, + sourceMap: true, + sourceMapMode: lambda.SourceMapMode.BOTH, + preCompilation: true, + }, + runtime: aws_lambda_1.Runtime.NODEJS_16_X, + }); + new lambda.NodejsFunction(this, 'ts-decorator-handler-tsconfig', { + entry: path.join(__dirname, 'integ-handlers/ts-decorator-handler.ts'), + bundling: { + minify: true, + sourceMap: true, + sourceMapMode: lambda.SourceMapMode.BOTH, + tsconfig: path.join(__dirname, '..', 'tsconfig.json'), + preCompilation: true, + }, + runtime: aws_lambda_1.Runtime.NODEJS_16_X, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-compilations-lambda-nodejs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJm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tcbiAgICAgICAgbWluaWZ5OiB0cnVlLFxuICAgICAgICBzb3VyY2VNYXA6IHRydWUsXG4gICAgICAgIHNvdXJjZU1hcE1vZGU6IGxhbWJkYS5Tb3VyY2VNYXBNb2RlLkJPVEgsXG4gICAgICAgIHByZUNvbXBpbGF0aW9uOiB0cnVlLFxuICAgICAgfSxcbiAgICAgIHJ1bnRpbWU6IFJ1bnRpbWUuTk9ERUpTXzE2X1gsXG4gICAgfSk7XG5cbiAgICBuZXcgbGFtYmRhLk5vZGVqc0Z1bmN0aW9uKHRoaXMsICd0cy1kZWNvcmF0b3ItaGFuZGxlci10c2NvbmZpZycsIHtcbiAgICAgIGVudHJ5OiBwYXRoLmpvaW4oX19kaXJuYW1lLCAnaW50ZWctaGFuZGxlcnMvdHMtZGVjb3JhdG9yLWhhbmRsZXIudHMnKSxcbiAgICAgIGJ1bmRsaW5nOiB7XG4gICAgICAgIG1pbmlmeTogdHJ1ZSxcbiAgICAgICAgc291cmNlTWFwOiB0cnVlLFxuICAgICAgICBzb3VyY2VNYXBNb2RlOiBsYW1iZGEuU291cmNlTWFwTW9kZS5CT1RILFxuICAgICAgICB0c2NvbmZpZzogcGF0aC5qb2luKF9fZGlybmFtZSwgJy4uJywgJ3RzY29uZmlnLmpzb24nKSxcbiAgICAgICAgcHJlQ29tcGlsYXRpb246IHRydWUsXG4gICAgICB9LFxuICAgICAgcnVudGltZTogUnVudGltZS5OT0RFSlNfMTZfWCxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1jb21waWxhdGlvbnMtbGFtYmRhLW5vZGVqcycpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js.map b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js.map similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js.map rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/asset.8df6c4f7f61921e6f88f328521b8a71aef10b045b77847bd61cfe75cf3a64c32/index.js.map diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk-integ-compilations-lambda-nodejs.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.ts similarity index 86% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.ts index 3cb1796022709..2cc60a21a689b 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.compilations.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.compilations.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Runtime } from '@aws-cdk/aws-lambda'; -import { App, Stack, StackProps } from '@aws-cdk/core'; +import { Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as lambda from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js new file mode 100644 index 0000000000000..438b9abf12e09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const lambda = require("aws-cdk-lib/aws-lambda-nodejs"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'TestStack'); +const handler = new lambda.NodejsFunction(stack, 'Function', { + entry: path.join(__dirname, 'integ-handlers/pnpm/dependencies-pnpm.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_18_X, + bundling: { + minify: true, + // Will be installed, not bundled + // (axios is a package with sub-dependencies, + // will be used to ensure pnpm bundling works as expected) + nodeModules: ['axios'], + forceDockerBundling: true, + }, + depsLockFilePath: path.join(__dirname, 'integ-handlers/pnpm/pnpm-lock.yaml'), +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'PnpmTest', { + testCases: [stack], + stackUpdateWorkflow: false, // this will tell the runner to not check in assets. +}); +const response = integ.assertions.invokeFunction({ + functionName: handler.functionName, +}); +response.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + // expect invoking without error + StatusCode: 200, + ExecutedVersion: '$LATEST', + Payload: 'null', +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwZW5kZW5jaWVzLXBucG0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5kZXBlbmRlbmNpZXMtcG5wbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3Qix1REFBaUQ7QUFDakQsbUNBQW1DO0FBQ25DLGtFQUF1RTtBQUN2RSx3REFBd0Q7QUFFeEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBT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lLFxuICB9LFxuICBkZXBzTG9ja0ZpbGVQYXRoOiBwYXRoLmpvaW4oX19kaXJuYW1lLCAnaW50ZWctaGFuZGxlcnMvcG5wbS9wbnBtLWxvY2sueWFtbCcpLFxufSk7XG5cbmNvbnN0IGludGVnID0gbmV3IEludGVnVGVzdChhcHAsICdQbnBtVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxuICBzdGFja1VwZGF0ZVdvcmtmbG93OiBmYWxzZSwgLy8gdGhpcyB3aWxsIHRlbGwgdGhlIHJ1bm5lciB0byBub3QgY2hlY2sgaW4gYXNzZXRzLlxufSk7XG5cblxuY29uc3QgcmVzcG9uc2UgPSBpbnRlZy5hc3NlcnRpb25zLmludm9rZUZ1bmN0aW9uKHtcbiAgZnVuY3Rpb25OYW1lOiBoYW5kbGVyLmZ1bmN0aW9uTmFtZSxcbn0pO1xucmVzcG9uc2UuZXhwZWN0KEV4cGVjdGVkUmVzdWx0Lm9iamVjdExpa2Uoe1xuICAvLyBleHBlY3QgaW52b2tpbmcgd2l0aG91dCBlcnJvclxuICBTdGF0dXNDb2RlOiAyMDAsXG4gIEV4ZWN1dGVkVmVyc2lvbjogJyRMQVRFU1QnLFxuICBQYXlsb2FkOiAnbnVsbCcsXG59KSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/PnpmTestDefaultTestDeployAssert397EDF83.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/TestStack.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/9530fc7b936783b8c08f83efc065b4b49b6eba10ec493a5725527d98b889a19ef0e98ae732d3812967d9bd31b3d1f062577b260945d9363c34c5c0ffa4a61d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/9530fc7b936783b8c08f83efc065b4b49b6eba10ec493a5725527d98b889a19ef0e98ae732d3812967d9bd31b3d1f062577b260945d9363c34c5c0ffa4a61d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/9530fc7b936783b8c08f83efc065b4b49b6eba10ec493a5725527d98b889a19ef0e98ae732d3812967d9bd31b3d1f062577b260945d9363c34c5c0ffa4a61d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/9530fc7b936783b8c08f83efc065b4b49b6eba10ec493a5725527d98b889a19ef0e98ae732d3812967d9bd31b3d1f062577b260945d9363c34c5c0ffa4a61d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/c497bf0e46ba69f12b50bb5d7cfa98e64a5d3d0a559919f5ecdc0d4fb1060e75e9bd469f9c2ec29d9c479d9764af82ff04a779baa849feb75a0fb2b6cd81ea b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/c497bf0e46ba69f12b50bb5d7cfa98e64a5d3d0a559919f5ecdc0d4fb1060e75e9bd469f9c2ec29d9c479d9764af82ff04a779baa849feb75a0fb2b6cd81ea similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/c497bf0e46ba69f12b50bb5d7cfa98e64a5d3d0a559919f5ecdc0d4fb1060e75e9bd469f9c2ec29d9c479d9764af82ff04a779baa849feb75a0fb2b6cd81ea rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/00/c497bf0e46ba69f12b50bb5d7cfa98e64a5d3d0a559919f5ecdc0d4fb1060e75e9bd469f9c2ec29d9c479d9764af82ff04a779baa849feb75a0fb2b6cd81ea diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/03/de3103f16015a0384fe5f38ae72fccbc2e5569b1dab4929c1730b220ba423cc3288cbcfbc2d5883b74b757eef67861f90cb64e27a91a2bf650fa72c42b70ef b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/03/de3103f16015a0384fe5f38ae72fccbc2e5569b1dab4929c1730b220ba423cc3288cbcfbc2d5883b74b757eef67861f90cb64e27a91a2bf650fa72c42b70ef similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/03/de3103f16015a0384fe5f38ae72fccbc2e5569b1dab4929c1730b220ba423cc3288cbcfbc2d5883b74b757eef67861f90cb64e27a91a2bf650fa72c42b70ef rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/03/de3103f16015a0384fe5f38ae72fccbc2e5569b1dab4929c1730b220ba423cc3288cbcfbc2d5883b74b757eef67861f90cb64e27a91a2bf650fa72c42b70ef diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/06/e01e517407d506ed158806079549def19e1cbcf265b4f59797a021ce3be1e84ef647a9a3bda2745149b06d135a704ff3642158953ad207b33ec869601e6df4 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/06/e01e517407d506ed158806079549def19e1cbcf265b4f59797a021ce3be1e84ef647a9a3bda2745149b06d135a704ff3642158953ad207b33ec869601e6df4 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/06/e01e517407d506ed158806079549def19e1cbcf265b4f59797a021ce3be1e84ef647a9a3bda2745149b06d135a704ff3642158953ad207b33ec869601e6df4 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/06/e01e517407d506ed158806079549def19e1cbcf265b4f59797a021ce3be1e84ef647a9a3bda2745149b06d135a704ff3642158953ad207b33ec869601e6df4 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/714ae0c97294ab228f081b55df029f661f7eb1de143cf01cb23c62aa4b39d1b7feeef328ac9450bde02a707e6e4310a78e59aadfcfc112564285c5c29e46f4 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/714ae0c97294ab228f081b55df029f661f7eb1de143cf01cb23c62aa4b39d1b7feeef328ac9450bde02a707e6e4310a78e59aadfcfc112564285c5c29e46f4 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/714ae0c97294ab228f081b55df029f661f7eb1de143cf01cb23c62aa4b39d1b7feeef328ac9450bde02a707e6e4310a78e59aadfcfc112564285c5c29e46f4 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/714ae0c97294ab228f081b55df029f661f7eb1de143cf01cb23c62aa4b39d1b7feeef328ac9450bde02a707e6e4310a78e59aadfcfc112564285c5c29e46f4 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/874fe4f480997452565478a243494911ce13c43f77dc3416d8aa672f9251b217da797a81e1d9f352b84b10964c5fdebbb078d9fa3f80c5444b39b6fd0841b8 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/874fe4f480997452565478a243494911ce13c43f77dc3416d8aa672f9251b217da797a81e1d9f352b84b10964c5fdebbb078d9fa3f80c5444b39b6fd0841b8 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/874fe4f480997452565478a243494911ce13c43f77dc3416d8aa672f9251b217da797a81e1d9f352b84b10964c5fdebbb078d9fa3f80c5444b39b6fd0841b8 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/07/874fe4f480997452565478a243494911ce13c43f77dc3416d8aa672f9251b217da797a81e1d9f352b84b10964c5fdebbb078d9fa3f80c5444b39b6fd0841b8 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/0e/3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/0e/3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/0e/3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/0e/3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/10/d223011ec6ab8226a4dfa5f1a3a4c14c2740368d5453605333a23fdf52a9fa55163a29379c937f568212725b11dfa006488d7df4cc4d25ba47b60d6b511a83 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/10/d223011ec6ab8226a4dfa5f1a3a4c14c2740368d5453605333a23fdf52a9fa55163a29379c937f568212725b11dfa006488d7df4cc4d25ba47b60d6b511a83 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/10/d223011ec6ab8226a4dfa5f1a3a4c14c2740368d5453605333a23fdf52a9fa55163a29379c937f568212725b11dfa006488d7df4cc4d25ba47b60d6b511a83 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/10/d223011ec6ab8226a4dfa5f1a3a4c14c2740368d5453605333a23fdf52a9fa55163a29379c937f568212725b11dfa006488d7df4cc4d25ba47b60d6b511a83 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/11/31249521a2e6dd10319ba25e803f43abdc9f170b40fe6f76e812a6e0328ba4951a2d9c94f3e9fb180486e31a1c2fb31a09f7d4a776df95b7e5fec7ca491ac3-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/11/31249521a2e6dd10319ba25e803f43abdc9f170b40fe6f76e812a6e0328ba4951a2d9c94f3e9fb180486e31a1c2fb31a09f7d4a776df95b7e5fec7ca491ac3-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/11/31249521a2e6dd10319ba25e803f43abdc9f170b40fe6f76e812a6e0328ba4951a2d9c94f3e9fb180486e31a1c2fb31a09f7d4a776df95b7e5fec7ca491ac3-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/11/31249521a2e6dd10319ba25e803f43abdc9f170b40fe6f76e812a6e0328ba4951a2d9c94f3e9fb180486e31a1c2fb31a09f7d4a776df95b7e5fec7ca491ac3-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/13/f9117d2af0c059f324f483cc6ab6b4e51c28dee28703b83bfc3fac7c1077cc90ee7cb222b6e2164eb3191a430002b24cfee07bfd91a2a51604250cfc4d4a4a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/13/f9117d2af0c059f324f483cc6ab6b4e51c28dee28703b83bfc3fac7c1077cc90ee7cb222b6e2164eb3191a430002b24cfee07bfd91a2a51604250cfc4d4a4a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/13/f9117d2af0c059f324f483cc6ab6b4e51c28dee28703b83bfc3fac7c1077cc90ee7cb222b6e2164eb3191a430002b24cfee07bfd91a2a51604250cfc4d4a4a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/13/f9117d2af0c059f324f483cc6ab6b4e51c28dee28703b83bfc3fac7c1077cc90ee7cb222b6e2164eb3191a430002b24cfee07bfd91a2a51604250cfc4d4a4a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/15/03783117ee25e1dfedc05b04c2455e12920eafb690002b06599106f72f144e410751d9297b5214048385d973f73398c3187c943767be630e7bffb971da0476-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/15/03783117ee25e1dfedc05b04c2455e12920eafb690002b06599106f72f144e410751d9297b5214048385d973f73398c3187c943767be630e7bffb971da0476-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/15/03783117ee25e1dfedc05b04c2455e12920eafb690002b06599106f72f144e410751d9297b5214048385d973f73398c3187c943767be630e7bffb971da0476-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/15/03783117ee25e1dfedc05b04c2455e12920eafb690002b06599106f72f144e410751d9297b5214048385d973f73398c3187c943767be630e7bffb971da0476-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/066da212f8df88127a67abf0d1c83da12c44297cb818aef5bf54b0dbe2ed1713212531b6682af9b4a6ff07991781c4a421740db71732e24406be317d13a7b4 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/066da212f8df88127a67abf0d1c83da12c44297cb818aef5bf54b0dbe2ed1713212531b6682af9b4a6ff07991781c4a421740db71732e24406be317d13a7b4 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/066da212f8df88127a67abf0d1c83da12c44297cb818aef5bf54b0dbe2ed1713212531b6682af9b4a6ff07991781c4a421740db71732e24406be317d13a7b4 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/066da212f8df88127a67abf0d1c83da12c44297cb818aef5bf54b0dbe2ed1713212531b6682af9b4a6ff07991781c4a421740db71732e24406be317d13a7b4 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/5817f7bc0b2eb28e2d8924b6d34ad1ec27f93d4caf73a40c108c68cd912df7aac8f40932c9e2e6f08824ada29a2ccbeae7dfada16a32c7e6215bc062333bf9 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/5817f7bc0b2eb28e2d8924b6d34ad1ec27f93d4caf73a40c108c68cd912df7aac8f40932c9e2e6f08824ada29a2ccbeae7dfada16a32c7e6215bc062333bf9 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/5817f7bc0b2eb28e2d8924b6d34ad1ec27f93d4caf73a40c108c68cd912df7aac8f40932c9e2e6f08824ada29a2ccbeae7dfada16a32c7e6215bc062333bf9 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/5817f7bc0b2eb28e2d8924b6d34ad1ec27f93d4caf73a40c108c68cd912df7aac8f40932c9e2e6f08824ada29a2ccbeae7dfada16a32c7e6215bc062333bf9 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/9999dff25f0e7b542ada4b0cd0b620b256aab8cb6af968519471310179dc16ef66af340be53b1d446e5cc1b4194a978fd2728517b784f64efbbe49ad375644 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/9999dff25f0e7b542ada4b0cd0b620b256aab8cb6af968519471310179dc16ef66af340be53b1d446e5cc1b4194a978fd2728517b784f64efbbe49ad375644 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/9999dff25f0e7b542ada4b0cd0b620b256aab8cb6af968519471310179dc16ef66af340be53b1d446e5cc1b4194a978fd2728517b784f64efbbe49ad375644 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/17/9999dff25f0e7b542ada4b0cd0b620b256aab8cb6af968519471310179dc16ef66af340be53b1d446e5cc1b4194a978fd2728517b784f64efbbe49ad375644 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/45c0dac594e4321854d53a43e4f63480449f4f6e69a9bc99ceb8be942227a1e9d4e438ed004bcbf88023a57c76b6514004585439d790edfa4a1bf5f08d2f63 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/45c0dac594e4321854d53a43e4f63480449f4f6e69a9bc99ceb8be942227a1e9d4e438ed004bcbf88023a57c76b6514004585439d790edfa4a1bf5f08d2f63 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/45c0dac594e4321854d53a43e4f63480449f4f6e69a9bc99ceb8be942227a1e9d4e438ed004bcbf88023a57c76b6514004585439d790edfa4a1bf5f08d2f63 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/45c0dac594e4321854d53a43e4f63480449f4f6e69a9bc99ceb8be942227a1e9d4e438ed004bcbf88023a57c76b6514004585439d790edfa4a1bf5f08d2f63 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/486cc441d4748bc04aac3d5681842805d57d1a7382e9b250bea7b93091d9ec6584d98e392398b2d5784344859fa36b939124064ed172e2ba84398a2f305045 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/486cc441d4748bc04aac3d5681842805d57d1a7382e9b250bea7b93091d9ec6584d98e392398b2d5784344859fa36b939124064ed172e2ba84398a2f305045 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/486cc441d4748bc04aac3d5681842805d57d1a7382e9b250bea7b93091d9ec6584d98e392398b2d5784344859fa36b939124064ed172e2ba84398a2f305045 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/486cc441d4748bc04aac3d5681842805d57d1a7382e9b250bea7b93091d9ec6584d98e392398b2d5784344859fa36b939124064ed172e2ba84398a2f305045 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/f7ea15e4d492bf65cb28d5cf3cf991f80d0a00a82d53afdf089d45c6e3ab9064ff9a12e124c8b0202fb640a200b72b62166c675d6e1557fc4a8db5c1a70be7 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/f7ea15e4d492bf65cb28d5cf3cf991f80d0a00a82d53afdf089d45c6e3ab9064ff9a12e124c8b0202fb640a200b72b62166c675d6e1557fc4a8db5c1a70be7 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/f7ea15e4d492bf65cb28d5cf3cf991f80d0a00a82d53afdf089d45c6e3ab9064ff9a12e124c8b0202fb640a200b72b62166c675d6e1557fc4a8db5c1a70be7 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/18/f7ea15e4d492bf65cb28d5cf3cf991f80d0a00a82d53afdf089d45c6e3ab9064ff9a12e124c8b0202fb640a200b72b62166c675d6e1557fc4a8db5c1a70be7 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/19/b556bb76c0e515f2968c0c92d13c2238d455da908fe7b893e5936227aef24d8d8a9db04c94261ffeefd3a8dbe7f644677c3439c60d5e1e524699522184a8af b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/19/b556bb76c0e515f2968c0c92d13c2238d455da908fe7b893e5936227aef24d8d8a9db04c94261ffeefd3a8dbe7f644677c3439c60d5e1e524699522184a8af similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/19/b556bb76c0e515f2968c0c92d13c2238d455da908fe7b893e5936227aef24d8d8a9db04c94261ffeefd3a8dbe7f644677c3439c60d5e1e524699522184a8af rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/19/b556bb76c0e515f2968c0c92d13c2238d455da908fe7b893e5936227aef24d8d8a9db04c94261ffeefd3a8dbe7f644677c3439c60d5e1e524699522184a8af diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/1b/1aaee5b768cb949869f4c76707eb6331acef0086ce1b8a618fb26a4cf2e5e39aa0ed5e02bc3d631b80bd251b9103fc4f219bf0a0a4bf19d30459e48b041d65 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/1b/1aaee5b768cb949869f4c76707eb6331acef0086ce1b8a618fb26a4cf2e5e39aa0ed5e02bc3d631b80bd251b9103fc4f219bf0a0a4bf19d30459e48b041d65 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/1b/1aaee5b768cb949869f4c76707eb6331acef0086ce1b8a618fb26a4cf2e5e39aa0ed5e02bc3d631b80bd251b9103fc4f219bf0a0a4bf19d30459e48b041d65 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/1b/1aaee5b768cb949869f4c76707eb6331acef0086ce1b8a618fb26a4cf2e5e39aa0ed5e02bc3d631b80bd251b9103fc4f219bf0a0a4bf19d30459e48b041d65 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/7818be7415747d4432389dcbd24372084b3606e8b1b955f371affdf1a5fbe030adcfed962cc37a78764fef00b63e1dbe48a2173c356ad8dbfa4e951f6c5e3c b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/7818be7415747d4432389dcbd24372084b3606e8b1b955f371affdf1a5fbe030adcfed962cc37a78764fef00b63e1dbe48a2173c356ad8dbfa4e951f6c5e3c similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/7818be7415747d4432389dcbd24372084b3606e8b1b955f371affdf1a5fbe030adcfed962cc37a78764fef00b63e1dbe48a2173c356ad8dbfa4e951f6c5e3c rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/7818be7415747d4432389dcbd24372084b3606e8b1b955f371affdf1a5fbe030adcfed962cc37a78764fef00b63e1dbe48a2173c356ad8dbfa4e951f6c5e3c diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/923fbecf49405963f39248e245c56082bc8d83f690f16f0829b857b170eab7a9b3cff5ace86af7041dbe6c8b95053690fb0fafa344321c27adffff78721b4a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/923fbecf49405963f39248e245c56082bc8d83f690f16f0829b857b170eab7a9b3cff5ace86af7041dbe6c8b95053690fb0fafa344321c27adffff78721b4a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/923fbecf49405963f39248e245c56082bc8d83f690f16f0829b857b170eab7a9b3cff5ace86af7041dbe6c8b95053690fb0fafa344321c27adffff78721b4a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2a/923fbecf49405963f39248e245c56082bc8d83f690f16f0829b857b170eab7a9b3cff5ace86af7041dbe6c8b95053690fb0fafa344321c27adffff78721b4a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2b/cd66a0585c36af775e44e2b3c3e86cc8d540b997e9111b0a393c94e9636b024cd8e2e2939ee7757c9b27320561490b1f891d57bf25953f4ba34ad998cee103-exec b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2b/cd66a0585c36af775e44e2b3c3e86cc8d540b997e9111b0a393c94e9636b024cd8e2e2939ee7757c9b27320561490b1f891d57bf25953f4ba34ad998cee103-exec similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2b/cd66a0585c36af775e44e2b3c3e86cc8d540b997e9111b0a393c94e9636b024cd8e2e2939ee7757c9b27320561490b1f891d57bf25953f4ba34ad998cee103-exec rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2b/cd66a0585c36af775e44e2b3c3e86cc8d540b997e9111b0a393c94e9636b024cd8e2e2939ee7757c9b27320561490b1f891d57bf25953f4ba34ad998cee103-exec diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2d/15de2635e7ce9cab7fa0bf1ce4bd04c4f38c96a1345d7ca2267990b9c8f6db49c5bd69b554b217fb9eaafc938a9ab8f1f7f1b3e75f2c8609da4b8b8ffb5d1a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2d/15de2635e7ce9cab7fa0bf1ce4bd04c4f38c96a1345d7ca2267990b9c8f6db49c5bd69b554b217fb9eaafc938a9ab8f1f7f1b3e75f2c8609da4b8b8ffb5d1a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2d/15de2635e7ce9cab7fa0bf1ce4bd04c4f38c96a1345d7ca2267990b9c8f6db49c5bd69b554b217fb9eaafc938a9ab8f1f7f1b3e75f2c8609da4b8b8ffb5d1a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2d/15de2635e7ce9cab7fa0bf1ce4bd04c4f38c96a1345d7ca2267990b9c8f6db49c5bd69b554b217fb9eaafc938a9ab8f1f7f1b3e75f2c8609da4b8b8ffb5d1a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/222c8630272cd36f1c1ae4de49c5005b27334c016c9ffef65c5289dbdc528443147e96e7bf63a30b09a8a2346370345c308a0d94dcd872b493ea8031f13df0 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/222c8630272cd36f1c1ae4de49c5005b27334c016c9ffef65c5289dbdc528443147e96e7bf63a30b09a8a2346370345c308a0d94dcd872b493ea8031f13df0 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/222c8630272cd36f1c1ae4de49c5005b27334c016c9ffef65c5289dbdc528443147e96e7bf63a30b09a8a2346370345c308a0d94dcd872b493ea8031f13df0 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/222c8630272cd36f1c1ae4de49c5005b27334c016c9ffef65c5289dbdc528443147e96e7bf63a30b09a8a2346370345c308a0d94dcd872b493ea8031f13df0 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/b2e2b5548da581101eef16ebb201e0d03d54d28b0ceec2bd0f46b3b4a776358af6068323da64c348a4c553dca31cddb5bb4f45db6fd173e54aa5d71088bb61 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/b2e2b5548da581101eef16ebb201e0d03d54d28b0ceec2bd0f46b3b4a776358af6068323da64c348a4c553dca31cddb5bb4f45db6fd173e54aa5d71088bb61 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/b2e2b5548da581101eef16ebb201e0d03d54d28b0ceec2bd0f46b3b4a776358af6068323da64c348a4c553dca31cddb5bb4f45db6fd173e54aa5d71088bb61 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/2f/b2e2b5548da581101eef16ebb201e0d03d54d28b0ceec2bd0f46b3b4a776358af6068323da64c348a4c553dca31cddb5bb4f45db6fd173e54aa5d71088bb61 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/32/f5bb5248a641236e320d9109b9e29fd97116c63f45cf46447558b6f30c3ac82080f50aabb40d2782c71ec915c24b43c477ab79daf4d753d8e9e0ee57a20f9c b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/32/f5bb5248a641236e320d9109b9e29fd97116c63f45cf46447558b6f30c3ac82080f50aabb40d2782c71ec915c24b43c477ab79daf4d753d8e9e0ee57a20f9c similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/32/f5bb5248a641236e320d9109b9e29fd97116c63f45cf46447558b6f30c3ac82080f50aabb40d2782c71ec915c24b43c477ab79daf4d753d8e9e0ee57a20f9c rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/32/f5bb5248a641236e320d9109b9e29fd97116c63f45cf46447558b6f30c3ac82080f50aabb40d2782c71ec915c24b43c477ab79daf4d753d8e9e0ee57a20f9c diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/33/4c331549d37b8f29d193b89109dc236865ef5ef4c37b2b0f200e5829a1c921e98875c9caac8857e1e64b9e6393b8f26d7774e321461eda9751d45085950898 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/33/4c331549d37b8f29d193b89109dc236865ef5ef4c37b2b0f200e5829a1c921e98875c9caac8857e1e64b9e6393b8f26d7774e321461eda9751d45085950898 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/33/4c331549d37b8f29d193b89109dc236865ef5ef4c37b2b0f200e5829a1c921e98875c9caac8857e1e64b9e6393b8f26d7774e321461eda9751d45085950898 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/33/4c331549d37b8f29d193b89109dc236865ef5ef4c37b2b0f200e5829a1c921e98875c9caac8857e1e64b9e6393b8f26d7774e321461eda9751d45085950898 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/34/b2491b80fddb57e830c0ad52a9b6da9efc75655490b117a1fd8bb464959d54ac2585ddd6726975fb60a4017d33af50f844c4311f1570c09c413559b4a0699a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/34/b2491b80fddb57e830c0ad52a9b6da9efc75655490b117a1fd8bb464959d54ac2585ddd6726975fb60a4017d33af50f844c4311f1570c09c413559b4a0699a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/34/b2491b80fddb57e830c0ad52a9b6da9efc75655490b117a1fd8bb464959d54ac2585ddd6726975fb60a4017d33af50f844c4311f1570c09c413559b4a0699a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/34/b2491b80fddb57e830c0ad52a9b6da9efc75655490b117a1fd8bb464959d54ac2585ddd6726975fb60a4017d33af50f844c4311f1570c09c413559b4a0699a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/35/1dec3644f5ed880983e8cf75c58f5b33693f0aa25da83228de3252dc0abc290c4e99fe06365695a807133638dfeb7295a4047cdafdb7d076daffced9801e35 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/35/1dec3644f5ed880983e8cf75c58f5b33693f0aa25da83228de3252dc0abc290c4e99fe06365695a807133638dfeb7295a4047cdafdb7d076daffced9801e35 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/35/1dec3644f5ed880983e8cf75c58f5b33693f0aa25da83228de3252dc0abc290c4e99fe06365695a807133638dfeb7295a4047cdafdb7d076daffced9801e35 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/35/1dec3644f5ed880983e8cf75c58f5b33693f0aa25da83228de3252dc0abc290c4e99fe06365695a807133638dfeb7295a4047cdafdb7d076daffced9801e35 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/39/e8bd387e2d461d18a94dc6c615fbf5d33f9b0560bdb64969235a464f9bb21923d12e5c7c772061a92b7818eb1f06ad5ca6f3f88a087582f1aca8a6d8c8d6d1-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/39/e8bd387e2d461d18a94dc6c615fbf5d33f9b0560bdb64969235a464f9bb21923d12e5c7c772061a92b7818eb1f06ad5ca6f3f88a087582f1aca8a6d8c8d6d1-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/39/e8bd387e2d461d18a94dc6c615fbf5d33f9b0560bdb64969235a464f9bb21923d12e5c7c772061a92b7818eb1f06ad5ca6f3f88a087582f1aca8a6d8c8d6d1-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/39/e8bd387e2d461d18a94dc6c615fbf5d33f9b0560bdb64969235a464f9bb21923d12e5c7c772061a92b7818eb1f06ad5ca6f3f88a087582f1aca8a6d8c8d6d1-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3b/4df160cf4de4c6228c6c57bb0d77ecf1d198364927c55f6d648365f922c96336041c1cc673fb0729667092a43863417b7dd92a1681087aca6d4f4567394dbb b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3b/4df160cf4de4c6228c6c57bb0d77ecf1d198364927c55f6d648365f922c96336041c1cc673fb0729667092a43863417b7dd92a1681087aca6d4f4567394dbb similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3b/4df160cf4de4c6228c6c57bb0d77ecf1d198364927c55f6d648365f922c96336041c1cc673fb0729667092a43863417b7dd92a1681087aca6d4f4567394dbb rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3b/4df160cf4de4c6228c6c57bb0d77ecf1d198364927c55f6d648365f922c96336041c1cc673fb0729667092a43863417b7dd92a1681087aca6d4f4567394dbb diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3c/8274f57e22eb58f658f0302713ebd1bf516d880a258faeb1309a9551a5867afb86016fb30a4bb2b50b6b6ec5e8d32c87ea4c36b33e16f8d0a428337e0947d0 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3c/8274f57e22eb58f658f0302713ebd1bf516d880a258faeb1309a9551a5867afb86016fb30a4bb2b50b6b6ec5e8d32c87ea4c36b33e16f8d0a428337e0947d0 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3c/8274f57e22eb58f658f0302713ebd1bf516d880a258faeb1309a9551a5867afb86016fb30a4bb2b50b6b6ec5e8d32c87ea4c36b33e16f8d0a428337e0947d0 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3c/8274f57e22eb58f658f0302713ebd1bf516d880a258faeb1309a9551a5867afb86016fb30a4bb2b50b6b6ec5e8d32c87ea4c36b33e16f8d0a428337e0947d0 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3d/c680b23c1ff593e5944fbf149f4a7579f1d3bb449cfd25d12fa8428e53cdadd5670508dd7a9c9204dd86736ebaebf73d10da39e6110d6f83dde2f9c4f6ebc8 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3d/c680b23c1ff593e5944fbf149f4a7579f1d3bb449cfd25d12fa8428e53cdadd5670508dd7a9c9204dd86736ebaebf73d10da39e6110d6f83dde2f9c4f6ebc8 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3d/c680b23c1ff593e5944fbf149f4a7579f1d3bb449cfd25d12fa8428e53cdadd5670508dd7a9c9204dd86736ebaebf73d10da39e6110d6f83dde2f9c4f6ebc8 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/3d/c680b23c1ff593e5944fbf149f4a7579f1d3bb449cfd25d12fa8428e53cdadd5670508dd7a9c9204dd86736ebaebf73d10da39e6110d6f83dde2f9c4f6ebc8 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/40/2fc737e90380d6290bb8b7df07ef9f9c0a684cfc1f898c2e356e03ac34de6d4e95016ae70ecbe0c6c966b59969696ca36bb8c484bbc590d94fae7be1c4353a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/40/2fc737e90380d6290bb8b7df07ef9f9c0a684cfc1f898c2e356e03ac34de6d4e95016ae70ecbe0c6c966b59969696ca36bb8c484bbc590d94fae7be1c4353a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/40/2fc737e90380d6290bb8b7df07ef9f9c0a684cfc1f898c2e356e03ac34de6d4e95016ae70ecbe0c6c966b59969696ca36bb8c484bbc590d94fae7be1c4353a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/40/2fc737e90380d6290bb8b7df07ef9f9c0a684cfc1f898c2e356e03ac34de6d4e95016ae70ecbe0c6c966b59969696ca36bb8c484bbc590d94fae7be1c4353a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/aac98b0de04af17c382a0d673633d8330dfe834918b826ec9c10d60f8030c6eb721e84040295561ef62ac53e42cb6962c27e4229d2ea7e573a852c44004d2a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/aac98b0de04af17c382a0d673633d8330dfe834918b826ec9c10d60f8030c6eb721e84040295561ef62ac53e42cb6962c27e4229d2ea7e573a852c44004d2a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/aac98b0de04af17c382a0d673633d8330dfe834918b826ec9c10d60f8030c6eb721e84040295561ef62ac53e42cb6962c27e4229d2ea7e573a852c44004d2a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/aac98b0de04af17c382a0d673633d8330dfe834918b826ec9c10d60f8030c6eb721e84040295561ef62ac53e42cb6962c27e4229d2ea7e573a852c44004d2a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/c948693ff71feeeecc31fbfb4b210231a9da914541893dcf76522a301a3ab6a7109393e0f7bdb916aae817b573ffd521d4f32f44c166427cdb7139565b5e9a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/c948693ff71feeeecc31fbfb4b210231a9da914541893dcf76522a301a3ab6a7109393e0f7bdb916aae817b573ffd521d4f32f44c166427cdb7139565b5e9a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/c948693ff71feeeecc31fbfb4b210231a9da914541893dcf76522a301a3ab6a7109393e0f7bdb916aae817b573ffd521d4f32f44c166427cdb7139565b5e9a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/41/c948693ff71feeeecc31fbfb4b210231a9da914541893dcf76522a301a3ab6a7109393e0f7bdb916aae817b573ffd521d4f32f44c166427cdb7139565b5e9a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/45/8ad48844e1663fdf256baa642bb8619ea3ce963ba943d874ce3d181c0effdcd2a7901becf29749aa12f1a867fab4e826bd3e24c41ec93108713ef81e687a0d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/45/8ad48844e1663fdf256baa642bb8619ea3ce963ba943d874ce3d181c0effdcd2a7901becf29749aa12f1a867fab4e826bd3e24c41ec93108713ef81e687a0d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/45/8ad48844e1663fdf256baa642bb8619ea3ce963ba943d874ce3d181c0effdcd2a7901becf29749aa12f1a867fab4e826bd3e24c41ec93108713ef81e687a0d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/45/8ad48844e1663fdf256baa642bb8619ea3ce963ba943d874ce3d181c0effdcd2a7901becf29749aa12f1a867fab4e826bd3e24c41ec93108713ef81e687a0d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4c/629a1a452331a5568cb1be6aa00eed31ae88ea8f4751c553a225dd4b3a0c32eff30ab6dbda44012fafb0946e25ad11a91e6971424771d26920b26844093ade b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4c/629a1a452331a5568cb1be6aa00eed31ae88ea8f4751c553a225dd4b3a0c32eff30ab6dbda44012fafb0946e25ad11a91e6971424771d26920b26844093ade similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4c/629a1a452331a5568cb1be6aa00eed31ae88ea8f4751c553a225dd4b3a0c32eff30ab6dbda44012fafb0946e25ad11a91e6971424771d26920b26844093ade rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4c/629a1a452331a5568cb1be6aa00eed31ae88ea8f4751c553a225dd4b3a0c32eff30ab6dbda44012fafb0946e25ad11a91e6971424771d26920b26844093ade diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4f/ac797281b903d00a106d02b1cf946b5270c9d557c08a3f1402a846b9076b03efcdb778c86f972dc6eaa9aab5078d42f10e6fffc852983158a928b53c863957 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4f/ac797281b903d00a106d02b1cf946b5270c9d557c08a3f1402a846b9076b03efcdb778c86f972dc6eaa9aab5078d42f10e6fffc852983158a928b53c863957 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4f/ac797281b903d00a106d02b1cf946b5270c9d557c08a3f1402a846b9076b03efcdb778c86f972dc6eaa9aab5078d42f10e6fffc852983158a928b53c863957 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/4f/ac797281b903d00a106d02b1cf946b5270c9d557c08a3f1402a846b9076b03efcdb778c86f972dc6eaa9aab5078d42f10e6fffc852983158a928b53c863957 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/51/264c2df72bcd5e4b558d1e02630a6251760d15156e4b3619fb0d03b3b17bcf7f9a60acac43a7ad128d6b7dc5d1753f26a228facb75c41bc62e9124d7e64ba5 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/51/264c2df72bcd5e4b558d1e02630a6251760d15156e4b3619fb0d03b3b17bcf7f9a60acac43a7ad128d6b7dc5d1753f26a228facb75c41bc62e9124d7e64ba5 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/51/264c2df72bcd5e4b558d1e02630a6251760d15156e4b3619fb0d03b3b17bcf7f9a60acac43a7ad128d6b7dc5d1753f26a228facb75c41bc62e9124d7e64ba5 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/51/264c2df72bcd5e4b558d1e02630a6251760d15156e4b3619fb0d03b3b17bcf7f9a60acac43a7ad128d6b7dc5d1753f26a228facb75c41bc62e9124d7e64ba5 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/55/02c6df7a34e0a690f2e622dad54d6ddad6a75416c4d35e6be9e6201e0454cdbcbf48663f5ef3eda1b5fb002437356ae0a7974eadf6db5c9ee6a4c93fdd49c0-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/55/02c6df7a34e0a690f2e622dad54d6ddad6a75416c4d35e6be9e6201e0454cdbcbf48663f5ef3eda1b5fb002437356ae0a7974eadf6db5c9ee6a4c93fdd49c0-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/55/02c6df7a34e0a690f2e622dad54d6ddad6a75416c4d35e6be9e6201e0454cdbcbf48663f5ef3eda1b5fb002437356ae0a7974eadf6db5c9ee6a4c93fdd49c0-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/55/02c6df7a34e0a690f2e622dad54d6ddad6a75416c4d35e6be9e6201e0454cdbcbf48663f5ef3eda1b5fb002437356ae0a7974eadf6db5c9ee6a4c93fdd49c0-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/88dd35e23895763f76a12f27aaff39a46046b1739d01b0cd47e3badf4d41ff2b50bf1449c43d1cef6afa879f335fe349fd19d511dfb142d0eabf29ae5f5e64 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/88dd35e23895763f76a12f27aaff39a46046b1739d01b0cd47e3badf4d41ff2b50bf1449c43d1cef6afa879f335fe349fd19d511dfb142d0eabf29ae5f5e64 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/88dd35e23895763f76a12f27aaff39a46046b1739d01b0cd47e3badf4d41ff2b50bf1449c43d1cef6afa879f335fe349fd19d511dfb142d0eabf29ae5f5e64 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/88dd35e23895763f76a12f27aaff39a46046b1739d01b0cd47e3badf4d41ff2b50bf1449c43d1cef6afa879f335fe349fd19d511dfb142d0eabf29ae5f5e64 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/b07617b9b13fefa23f62f970adbb5515f1bb2388582de729ae89165af3a82478b7d03950afa7126748d754bfcfbda497eecba30a6d0f3f4074812fb71d3862 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/b07617b9b13fefa23f62f970adbb5515f1bb2388582de729ae89165af3a82478b7d03950afa7126748d754bfcfbda497eecba30a6d0f3f4074812fb71d3862 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/b07617b9b13fefa23f62f970adbb5515f1bb2388582de729ae89165af3a82478b7d03950afa7126748d754bfcfbda497eecba30a6d0f3f4074812fb71d3862 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/56/b07617b9b13fefa23f62f970adbb5515f1bb2388582de729ae89165af3a82478b7d03950afa7126748d754bfcfbda497eecba30a6d0f3f4074812fb71d3862 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/57/0f810f55e637828ffbaa63541388bc15b73bf35a73c73f25d77bfb0e55b30f89d036e904130b9bdd5b20c816b3a9d79e49500678fcfdea0eb9be73e070803d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/57/0f810f55e637828ffbaa63541388bc15b73bf35a73c73f25d77bfb0e55b30f89d036e904130b9bdd5b20c816b3a9d79e49500678fcfdea0eb9be73e070803d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/57/0f810f55e637828ffbaa63541388bc15b73bf35a73c73f25d77bfb0e55b30f89d036e904130b9bdd5b20c816b3a9d79e49500678fcfdea0eb9be73e070803d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/57/0f810f55e637828ffbaa63541388bc15b73bf35a73c73f25d77bfb0e55b30f89d036e904130b9bdd5b20c816b3a9d79e49500678fcfdea0eb9be73e070803d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/59/800893257d77a8313baca5280c98ce674d6305fcb3080457ea5c18acd74da237967bea96f173ba8f09dd8fa9eba75ef92d1134ab004799e862dc09a1f0fd69 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/59/800893257d77a8313baca5280c98ce674d6305fcb3080457ea5c18acd74da237967bea96f173ba8f09dd8fa9eba75ef92d1134ab004799e862dc09a1f0fd69 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/59/800893257d77a8313baca5280c98ce674d6305fcb3080457ea5c18acd74da237967bea96f173ba8f09dd8fa9eba75ef92d1134ab004799e862dc09a1f0fd69 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/59/800893257d77a8313baca5280c98ce674d6305fcb3080457ea5c18acd74da237967bea96f173ba8f09dd8fa9eba75ef92d1134ab004799e862dc09a1f0fd69 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5c/d9760552d300c545dc5de18170a3a0fdbfb799c70d487408abb7884da09a2575a693c3ffe2c9716b28bf46488a68f1a28437e630d04bcc1166e6e849923274 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5c/d9760552d300c545dc5de18170a3a0fdbfb799c70d487408abb7884da09a2575a693c3ffe2c9716b28bf46488a68f1a28437e630d04bcc1166e6e849923274 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5c/d9760552d300c545dc5de18170a3a0fdbfb799c70d487408abb7884da09a2575a693c3ffe2c9716b28bf46488a68f1a28437e630d04bcc1166e6e849923274 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5c/d9760552d300c545dc5de18170a3a0fdbfb799c70d487408abb7884da09a2575a693c3ffe2c9716b28bf46488a68f1a28437e630d04bcc1166e6e849923274 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5f/35e548b3003509a6caab668fc3af1dbbf3b7b5a7fb0ad965dbd27a53d9252222410b103fc35c1a1049c78ff3e22c700dacb8e701aa6cabf42ddaaa0b539c18 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5f/35e548b3003509a6caab668fc3af1dbbf3b7b5a7fb0ad965dbd27a53d9252222410b103fc35c1a1049c78ff3e22c700dacb8e701aa6cabf42ddaaa0b539c18 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5f/35e548b3003509a6caab668fc3af1dbbf3b7b5a7fb0ad965dbd27a53d9252222410b103fc35c1a1049c78ff3e22c700dacb8e701aa6cabf42ddaaa0b539c18 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/5f/35e548b3003509a6caab668fc3af1dbbf3b7b5a7fb0ad965dbd27a53d9252222410b103fc35c1a1049c78ff3e22c700dacb8e701aa6cabf42ddaaa0b539c18 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/14c07523f936a1f786017a69f48335bb392fb6a8d8ad6627d9215bf39fbb09b33ec41f7f8a5355486a62b7c8c9192c501d1658f6789c2915124d7c32c52568 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/14c07523f936a1f786017a69f48335bb392fb6a8d8ad6627d9215bf39fbb09b33ec41f7f8a5355486a62b7c8c9192c501d1658f6789c2915124d7c32c52568 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/14c07523f936a1f786017a69f48335bb392fb6a8d8ad6627d9215bf39fbb09b33ec41f7f8a5355486a62b7c8c9192c501d1658f6789c2915124d7c32c52568 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/14c07523f936a1f786017a69f48335bb392fb6a8d8ad6627d9215bf39fbb09b33ec41f7f8a5355486a62b7c8c9192c501d1658f6789c2915124d7c32c52568 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/27492c460862f31ac4a84a65438531d488785f08e2bc97fa3915055e3a908af812dc881d490efbe60950a899c82c8f057bbb1bb751cc6f9b8dc2e9293a1a4c b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/27492c460862f31ac4a84a65438531d488785f08e2bc97fa3915055e3a908af812dc881d490efbe60950a899c82c8f057bbb1bb751cc6f9b8dc2e9293a1a4c similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/27492c460862f31ac4a84a65438531d488785f08e2bc97fa3915055e3a908af812dc881d490efbe60950a899c82c8f057bbb1bb751cc6f9b8dc2e9293a1a4c rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/27492c460862f31ac4a84a65438531d488785f08e2bc97fa3915055e3a908af812dc881d490efbe60950a899c82c8f057bbb1bb751cc6f9b8dc2e9293a1a4c diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/8ae8ad13ab0c7610941217a4d46d73a5c121dc7b6387af198cf2334f01935d907b50958b59d8b868ceca8698c5ee65fa2bf27301e9f1f64ad81d577114d65a-exec b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/8ae8ad13ab0c7610941217a4d46d73a5c121dc7b6387af198cf2334f01935d907b50958b59d8b868ceca8698c5ee65fa2bf27301e9f1f64ad81d577114d65a-exec similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/8ae8ad13ab0c7610941217a4d46d73a5c121dc7b6387af198cf2334f01935d907b50958b59d8b868ceca8698c5ee65fa2bf27301e9f1f64ad81d577114d65a-exec rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/63/8ae8ad13ab0c7610941217a4d46d73a5c121dc7b6387af198cf2334f01935d907b50958b59d8b868ceca8698c5ee65fa2bf27301e9f1f64ad81d577114d65a-exec diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/64/363e6cf9b9cd34c5f98a42ac053d9cad148080983d3d10b53d4d65616fe2cfbe4cd91c815693d20ebee11dae238323423cf2b07075cf1b962f9d21cda7978b-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/64/363e6cf9b9cd34c5f98a42ac053d9cad148080983d3d10b53d4d65616fe2cfbe4cd91c815693d20ebee11dae238323423cf2b07075cf1b962f9d21cda7978b-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/64/363e6cf9b9cd34c5f98a42ac053d9cad148080983d3d10b53d4d65616fe2cfbe4cd91c815693d20ebee11dae238323423cf2b07075cf1b962f9d21cda7978b-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/64/363e6cf9b9cd34c5f98a42ac053d9cad148080983d3d10b53d4d65616fe2cfbe4cd91c815693d20ebee11dae238323423cf2b07075cf1b962f9d21cda7978b-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/049f5c90316dca7f303ec1fa1ef5a7185a4d55e4f5fbc87938ede2422894ee7f1038f2ea1bb8c6f05dec0609592221a8b3fc434e948c09e90b3a9baad36cc1 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/049f5c90316dca7f303ec1fa1ef5a7185a4d55e4f5fbc87938ede2422894ee7f1038f2ea1bb8c6f05dec0609592221a8b3fc434e948c09e90b3a9baad36cc1 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/049f5c90316dca7f303ec1fa1ef5a7185a4d55e4f5fbc87938ede2422894ee7f1038f2ea1bb8c6f05dec0609592221a8b3fc434e948c09e90b3a9baad36cc1 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/049f5c90316dca7f303ec1fa1ef5a7185a4d55e4f5fbc87938ede2422894ee7f1038f2ea1bb8c6f05dec0609592221a8b3fc434e948c09e90b3a9baad36cc1 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/9fe1b94b84b0dc2df59484959a722ff7e85e2f1ebdb3aec053f892ff83fc88528d305d8b85d5415be4f99f26449f86bbe7f5b90f3fe44202cf0afe7bbd431d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/9fe1b94b84b0dc2df59484959a722ff7e85e2f1ebdb3aec053f892ff83fc88528d305d8b85d5415be4f99f26449f86bbe7f5b90f3fe44202cf0afe7bbd431d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/9fe1b94b84b0dc2df59484959a722ff7e85e2f1ebdb3aec053f892ff83fc88528d305d8b85d5415be4f99f26449f86bbe7f5b90f3fe44202cf0afe7bbd431d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/65/9fe1b94b84b0dc2df59484959a722ff7e85e2f1ebdb3aec053f892ff83fc88528d305d8b85d5415be4f99f26449f86bbe7f5b90f3fe44202cf0afe7bbd431d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/06674006e8796e9e17134b8bfc5ad14a0d4b484560f0351fd5142be9ebf1381cdf38b45df6969d04618bcfb86b11fa0735496e6bf488b0b81be8e111a62525 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/06674006e8796e9e17134b8bfc5ad14a0d4b484560f0351fd5142be9ebf1381cdf38b45df6969d04618bcfb86b11fa0735496e6bf488b0b81be8e111a62525 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/06674006e8796e9e17134b8bfc5ad14a0d4b484560f0351fd5142be9ebf1381cdf38b45df6969d04618bcfb86b11fa0735496e6bf488b0b81be8e111a62525 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/06674006e8796e9e17134b8bfc5ad14a0d4b484560f0351fd5142be9ebf1381cdf38b45df6969d04618bcfb86b11fa0735496e6bf488b0b81be8e111a62525 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/2483ecd7fdd5a2c1d11c4be0a1ab28705797b11db350c098475ca156b05e72c3ed20e1a4d82db88236680920edaed04b8d63c4f499d7ba7855d1a730793731-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/2483ecd7fdd5a2c1d11c4be0a1ab28705797b11db350c098475ca156b05e72c3ed20e1a4d82db88236680920edaed04b8d63c4f499d7ba7855d1a730793731-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/2483ecd7fdd5a2c1d11c4be0a1ab28705797b11db350c098475ca156b05e72c3ed20e1a4d82db88236680920edaed04b8d63c4f499d7ba7855d1a730793731-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/2483ecd7fdd5a2c1d11c4be0a1ab28705797b11db350c098475ca156b05e72c3ed20e1a4d82db88236680920edaed04b8d63c4f499d7ba7855d1a730793731-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/43fec5855e542c8fcc3f5b152024bed3e63fbe5791c0650602398db28f06193d3d68939335cb62c71d9a3550fc62f68789b38c326be0e1e0755180883c113e b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/43fec5855e542c8fcc3f5b152024bed3e63fbe5791c0650602398db28f06193d3d68939335cb62c71d9a3550fc62f68789b38c326be0e1e0755180883c113e similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/43fec5855e542c8fcc3f5b152024bed3e63fbe5791c0650602398db28f06193d3d68939335cb62c71d9a3550fc62f68789b38c326be0e1e0755180883c113e rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/67/43fec5855e542c8fcc3f5b152024bed3e63fbe5791c0650602398db28f06193d3d68939335cb62c71d9a3550fc62f68789b38c326be0e1e0755180883c113e diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6c/818187785a73e073c4a2c482cacf4fabb6577a2e52b9c049f6b76e30ee6aa20ee921dcb0652e89145af74159d94871507ca11a57cd3ef1bd919ba7a6810dbf b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6c/818187785a73e073c4a2c482cacf4fabb6577a2e52b9c049f6b76e30ee6aa20ee921dcb0652e89145af74159d94871507ca11a57cd3ef1bd919ba7a6810dbf similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6c/818187785a73e073c4a2c482cacf4fabb6577a2e52b9c049f6b76e30ee6aa20ee921dcb0652e89145af74159d94871507ca11a57cd3ef1bd919ba7a6810dbf rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6c/818187785a73e073c4a2c482cacf4fabb6577a2e52b9c049f6b76e30ee6aa20ee921dcb0652e89145af74159d94871507ca11a57cd3ef1bd919ba7a6810dbf diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6d/d2594fa982201d026e633e5a83cfa3e5463bdb18d57343ee7678e4cda1beaab9ecde03e8b14df221d5361fff24e57b5d47441657cb795ed8d2c0b332d0cfd1 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6d/d2594fa982201d026e633e5a83cfa3e5463bdb18d57343ee7678e4cda1beaab9ecde03e8b14df221d5361fff24e57b5d47441657cb795ed8d2c0b332d0cfd1 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6d/d2594fa982201d026e633e5a83cfa3e5463bdb18d57343ee7678e4cda1beaab9ecde03e8b14df221d5361fff24e57b5d47441657cb795ed8d2c0b332d0cfd1 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6d/d2594fa982201d026e633e5a83cfa3e5463bdb18d57343ee7678e4cda1beaab9ecde03e8b14df221d5361fff24e57b5d47441657cb795ed8d2c0b332d0cfd1 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/1ae1f9c66e88acae73b1bc1040d187f3377070f682befda148299ce3d71f213dee0177368634bf07e0a12c62604abab71cf205be6511265dafc1bcf40c6c72 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/1ae1f9c66e88acae73b1bc1040d187f3377070f682befda148299ce3d71f213dee0177368634bf07e0a12c62604abab71cf205be6511265dafc1bcf40c6c72 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/1ae1f9c66e88acae73b1bc1040d187f3377070f682befda148299ce3d71f213dee0177368634bf07e0a12c62604abab71cf205be6511265dafc1bcf40c6c72 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/1ae1f9c66e88acae73b1bc1040d187f3377070f682befda148299ce3d71f213dee0177368634bf07e0a12c62604abab71cf205be6511265dafc1bcf40c6c72 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/8713f975ce4960499a4488e63f1fa7713d50915d776a843995022350040e28214feeb56edaf89f527777834d3daf4363bd8916d33da16f946f2bc06fd5866d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/8713f975ce4960499a4488e63f1fa7713d50915d776a843995022350040e28214feeb56edaf89f527777834d3daf4363bd8916d33da16f946f2bc06fd5866d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/8713f975ce4960499a4488e63f1fa7713d50915d776a843995022350040e28214feeb56edaf89f527777834d3daf4363bd8916d33da16f946f2bc06fd5866d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/6e/8713f975ce4960499a4488e63f1fa7713d50915d776a843995022350040e28214feeb56edaf89f527777834d3daf4363bd8916d33da16f946f2bc06fd5866d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/72/a173fc9ce25d9ae8df620f9d9581c73eacec5ca16c96b25527cc010a13b622319854e1ca3be3e2ed20191a0253992326952fe258b6b8359dcff38e9172a9ad b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/72/a173fc9ce25d9ae8df620f9d9581c73eacec5ca16c96b25527cc010a13b622319854e1ca3be3e2ed20191a0253992326952fe258b6b8359dcff38e9172a9ad similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/72/a173fc9ce25d9ae8df620f9d9581c73eacec5ca16c96b25527cc010a13b622319854e1ca3be3e2ed20191a0253992326952fe258b6b8359dcff38e9172a9ad rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/72/a173fc9ce25d9ae8df620f9d9581c73eacec5ca16c96b25527cc010a13b622319854e1ca3be3e2ed20191a0253992326952fe258b6b8359dcff38e9172a9ad diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/73/d000123449665ca9b99fe0e08c1df5680b2c1ec2b2f3753d65860c06607c76212f8ecfc2533262272c937259d880c46ba29de7f92ef02a0b654a9cc648ff33 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/73/d000123449665ca9b99fe0e08c1df5680b2c1ec2b2f3753d65860c06607c76212f8ecfc2533262272c937259d880c46ba29de7f92ef02a0b654a9cc648ff33 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/73/d000123449665ca9b99fe0e08c1df5680b2c1ec2b2f3753d65860c06607c76212f8ecfc2533262272c937259d880c46ba29de7f92ef02a0b654a9cc648ff33 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/73/d000123449665ca9b99fe0e08c1df5680b2c1ec2b2f3753d65860c06607c76212f8ecfc2533262272c937259d880c46ba29de7f92ef02a0b654a9cc648ff33 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/76/257a4fa2ea50b3cf72339b5a01c2ff8f07a744f746ac53874c5a14d3c97373fed4f0b1292550bb372c664d9bb112a653aaae264a1c61262952113e85f3b936 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/76/257a4fa2ea50b3cf72339b5a01c2ff8f07a744f746ac53874c5a14d3c97373fed4f0b1292550bb372c664d9bb112a653aaae264a1c61262952113e85f3b936 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/76/257a4fa2ea50b3cf72339b5a01c2ff8f07a744f746ac53874c5a14d3c97373fed4f0b1292550bb372c664d9bb112a653aaae264a1c61262952113e85f3b936 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/76/257a4fa2ea50b3cf72339b5a01c2ff8f07a744f746ac53874c5a14d3c97373fed4f0b1292550bb372c664d9bb112a653aaae264a1c61262952113e85f3b936 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7b/cb6b463d7be20668ccb3f5a93c60b9b5a48a6264ab4e27094a8c25f2ee362995829326222ca593e7c169e1e19d6ba0aaa4a78a55c6c23046d9391a80a7a927 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7b/cb6b463d7be20668ccb3f5a93c60b9b5a48a6264ab4e27094a8c25f2ee362995829326222ca593e7c169e1e19d6ba0aaa4a78a55c6c23046d9391a80a7a927 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7b/cb6b463d7be20668ccb3f5a93c60b9b5a48a6264ab4e27094a8c25f2ee362995829326222ca593e7c169e1e19d6ba0aaa4a78a55c6c23046d9391a80a7a927 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7b/cb6b463d7be20668ccb3f5a93c60b9b5a48a6264ab4e27094a8c25f2ee362995829326222ca593e7c169e1e19d6ba0aaa4a78a55c6c23046d9391a80a7a927 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/59e31a43d1f19271772bbe21014c277a078ba3732004b2ca68693e4f9e60663def41b4c5ac8e36056c76587d391ddf3a22be2e29053143e36b150464d25c5f b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/59e31a43d1f19271772bbe21014c277a078ba3732004b2ca68693e4f9e60663def41b4c5ac8e36056c76587d391ddf3a22be2e29053143e36b150464d25c5f similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/59e31a43d1f19271772bbe21014c277a078ba3732004b2ca68693e4f9e60663def41b4c5ac8e36056c76587d391ddf3a22be2e29053143e36b150464d25c5f rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/59e31a43d1f19271772bbe21014c277a078ba3732004b2ca68693e4f9e60663def41b4c5ac8e36056c76587d391ddf3a22be2e29053143e36b150464d25c5f diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/bb8ddf4a6c0c82684a25b0e2d680490362453d9f344a773323f3ffe84c5c515ed881f4ce7952b1283109bdccc1d927eac4735985217c25813c805a8163c79a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/bb8ddf4a6c0c82684a25b0e2d680490362453d9f344a773323f3ffe84c5c515ed881f4ce7952b1283109bdccc1d927eac4735985217c25813c805a8163c79a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/bb8ddf4a6c0c82684a25b0e2d680490362453d9f344a773323f3ffe84c5c515ed881f4ce7952b1283109bdccc1d927eac4735985217c25813c805a8163c79a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7c/bb8ddf4a6c0c82684a25b0e2d680490362453d9f344a773323f3ffe84c5c515ed881f4ce7952b1283109bdccc1d927eac4735985217c25813c805a8163c79a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7d/7241c3f55f5ce7dc0cf980279b1d8e72d25063a89b640e1f4cc63db921dc04267d33602ac9b1c8b96793ca3f5f2717e77499fa9c05cfc4b54313b15b48f08a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7d/7241c3f55f5ce7dc0cf980279b1d8e72d25063a89b640e1f4cc63db921dc04267d33602ac9b1c8b96793ca3f5f2717e77499fa9c05cfc4b54313b15b48f08a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7d/7241c3f55f5ce7dc0cf980279b1d8e72d25063a89b640e1f4cc63db921dc04267d33602ac9b1c8b96793ca3f5f2717e77499fa9c05cfc4b54313b15b48f08a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/7d/7241c3f55f5ce7dc0cf980279b1d8e72d25063a89b640e1f4cc63db921dc04267d33602ac9b1c8b96793ca3f5f2717e77499fa9c05cfc4b54313b15b48f08a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/8a467310483cc1bd852c555c9651e63ca05219b6f438c7feed53c998a58fe7f00e3a011cf8c5c6760e5eb81f0755899838e7248707b416da7cf31a818e58b3 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/8a467310483cc1bd852c555c9651e63ca05219b6f438c7feed53c998a58fe7f00e3a011cf8c5c6760e5eb81f0755899838e7248707b416da7cf31a818e58b3 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/8a467310483cc1bd852c555c9651e63ca05219b6f438c7feed53c998a58fe7f00e3a011cf8c5c6760e5eb81f0755899838e7248707b416da7cf31a818e58b3 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/8a467310483cc1bd852c555c9651e63ca05219b6f438c7feed53c998a58fe7f00e3a011cf8c5c6760e5eb81f0755899838e7248707b416da7cf31a818e58b3 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/e274f294c5b6dddd9cae77a17ec251fd8fd0eca79b219d7d1891e7d152fff15068357f7cd4e9b8d17d52ba8c9103fdf481149e1ec193729afad5ecf53c479d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/e274f294c5b6dddd9cae77a17ec251fd8fd0eca79b219d7d1891e7d152fff15068357f7cd4e9b8d17d52ba8c9103fdf481149e1ec193729afad5ecf53c479d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/e274f294c5b6dddd9cae77a17ec251fd8fd0eca79b219d7d1891e7d152fff15068357f7cd4e9b8d17d52ba8c9103fdf481149e1ec193729afad5ecf53c479d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/82/e274f294c5b6dddd9cae77a17ec251fd8fd0eca79b219d7d1891e7d152fff15068357f7cd4e9b8d17d52ba8c9103fdf481149e1ec193729afad5ecf53c479d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/86/5222f396d460e938abe95c4a2b20bce66dc18d569c0574256d29023e22688720cba05510c7bcfd34774dc96ec6d6a7b3383a029b794e0b85f21fdd7659225b b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/86/5222f396d460e938abe95c4a2b20bce66dc18d569c0574256d29023e22688720cba05510c7bcfd34774dc96ec6d6a7b3383a029b794e0b85f21fdd7659225b similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/86/5222f396d460e938abe95c4a2b20bce66dc18d569c0574256d29023e22688720cba05510c7bcfd34774dc96ec6d6a7b3383a029b794e0b85f21fdd7659225b rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/86/5222f396d460e938abe95c4a2b20bce66dc18d569c0574256d29023e22688720cba05510c7bcfd34774dc96ec6d6a7b3383a029b794e0b85f21fdd7659225b diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/8b2a158caff5ff0b464206f3d1876caa2f91d9924edc9945b50a164920d21f414dd2030290a279bfa019ec03e49ae8c72ee42ac2df421b7ac83a8dab922925 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/8b2a158caff5ff0b464206f3d1876caa2f91d9924edc9945b50a164920d21f414dd2030290a279bfa019ec03e49ae8c72ee42ac2df421b7ac83a8dab922925 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/8b2a158caff5ff0b464206f3d1876caa2f91d9924edc9945b50a164920d21f414dd2030290a279bfa019ec03e49ae8c72ee42ac2df421b7ac83a8dab922925 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/8b2a158caff5ff0b464206f3d1876caa2f91d9924edc9945b50a164920d21f414dd2030290a279bfa019ec03e49ae8c72ee42ac2df421b7ac83a8dab922925 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/f0feb0a2feb1c79b57ee045257309225b2dca064d097c9f2b6e90a4346bd62626fa3cc33e537036641348cc819bd5ed39941dcbc06dc390fa38946aab3f5b7 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/f0feb0a2feb1c79b57ee045257309225b2dca064d097c9f2b6e90a4346bd62626fa3cc33e537036641348cc819bd5ed39941dcbc06dc390fa38946aab3f5b7 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/f0feb0a2feb1c79b57ee045257309225b2dca064d097c9f2b6e90a4346bd62626fa3cc33e537036641348cc819bd5ed39941dcbc06dc390fa38946aab3f5b7 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/87/f0feb0a2feb1c79b57ee045257309225b2dca064d097c9f2b6e90a4346bd62626fa3cc33e537036641348cc819bd5ed39941dcbc06dc390fa38946aab3f5b7 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8b/f97f2f8385896b631e9b8918881c426c17593cbb1a666758b9808901358653e7d9f03c1de39c781436fdc66b0af20b84443f8476f0699a2ef919697a0f9a4a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8b/f97f2f8385896b631e9b8918881c426c17593cbb1a666758b9808901358653e7d9f03c1de39c781436fdc66b0af20b84443f8476f0699a2ef919697a0f9a4a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8b/f97f2f8385896b631e9b8918881c426c17593cbb1a666758b9808901358653e7d9f03c1de39c781436fdc66b0af20b84443f8476f0699a2ef919697a0f9a4a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8b/f97f2f8385896b631e9b8918881c426c17593cbb1a666758b9808901358653e7d9f03c1de39c781436fdc66b0af20b84443f8476f0699a2ef919697a0f9a4a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8c/435fca9a0fed9c6e77f4405d84f6f5378a7d872fdf3dbca9a29e3a29aa004fa3774bf3ac83f17921024016782e54e8947097c020c0eacb194f7b309319a671 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8c/435fca9a0fed9c6e77f4405d84f6f5378a7d872fdf3dbca9a29e3a29aa004fa3774bf3ac83f17921024016782e54e8947097c020c0eacb194f7b309319a671 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8c/435fca9a0fed9c6e77f4405d84f6f5378a7d872fdf3dbca9a29e3a29aa004fa3774bf3ac83f17921024016782e54e8947097c020c0eacb194f7b309319a671 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/8c/435fca9a0fed9c6e77f4405d84f6f5378a7d872fdf3dbca9a29e3a29aa004fa3774bf3ac83f17921024016782e54e8947097c020c0eacb194f7b309319a671 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/92/e93689b732d288308a33c173c946fadf64a0ebd9fe6d402a79c7d0773b70dd11ec054de55d8b6f29c58271adc581d02711bccda9ea97d845de2a89a38a159e b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/92/e93689b732d288308a33c173c946fadf64a0ebd9fe6d402a79c7d0773b70dd11ec054de55d8b6f29c58271adc581d02711bccda9ea97d845de2a89a38a159e similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/92/e93689b732d288308a33c173c946fadf64a0ebd9fe6d402a79c7d0773b70dd11ec054de55d8b6f29c58271adc581d02711bccda9ea97d845de2a89a38a159e rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/92/e93689b732d288308a33c173c946fadf64a0ebd9fe6d402a79c7d0773b70dd11ec054de55d8b6f29c58271adc581d02711bccda9ea97d845de2a89a38a159e diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/44c3df2a8b5d3abf4f1a7be8a7a3b885445d1355b294c69f855185bc1556f179ab4e2d8657b5ccc558494a382db37df57dfabb83574604c22f8de5f7233808 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/44c3df2a8b5d3abf4f1a7be8a7a3b885445d1355b294c69f855185bc1556f179ab4e2d8657b5ccc558494a382db37df57dfabb83574604c22f8de5f7233808 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/44c3df2a8b5d3abf4f1a7be8a7a3b885445d1355b294c69f855185bc1556f179ab4e2d8657b5ccc558494a382db37df57dfabb83574604c22f8de5f7233808 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/44c3df2a8b5d3abf4f1a7be8a7a3b885445d1355b294c69f855185bc1556f179ab4e2d8657b5ccc558494a382db37df57dfabb83574604c22f8de5f7233808 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/a470fc59aaa55177bd3fd2b067632bdc64a3254b359047ce8c278feb15340ef552a6fcdd178fcd1026b161c693f4c84b426763a8881dcf02e74e1345c63940 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/a470fc59aaa55177bd3fd2b067632bdc64a3254b359047ce8c278feb15340ef552a6fcdd178fcd1026b161c693f4c84b426763a8881dcf02e74e1345c63940 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/a470fc59aaa55177bd3fd2b067632bdc64a3254b359047ce8c278feb15340ef552a6fcdd178fcd1026b161c693f4c84b426763a8881dcf02e74e1345c63940 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/93/a470fc59aaa55177bd3fd2b067632bdc64a3254b359047ce8c278feb15340ef552a6fcdd178fcd1026b161c693f4c84b426763a8881dcf02e74e1345c63940 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/9a/5328f01683d07f75a7183d86356680d4e9115bb8d27221be4cec8cf73ffdeb4fe1a2eccff28745269ff6a29dc52af3cb66cf2090deab82c94aceca93dde312 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/9a/5328f01683d07f75a7183d86356680d4e9115bb8d27221be4cec8cf73ffdeb4fe1a2eccff28745269ff6a29dc52af3cb66cf2090deab82c94aceca93dde312 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/9a/5328f01683d07f75a7183d86356680d4e9115bb8d27221be4cec8cf73ffdeb4fe1a2eccff28745269ff6a29dc52af3cb66cf2090deab82c94aceca93dde312 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/9a/5328f01683d07f75a7183d86356680d4e9115bb8d27221be4cec8cf73ffdeb4fe1a2eccff28745269ff6a29dc52af3cb66cf2090deab82c94aceca93dde312 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/a293eb0097fe87875f3bf908cc0b0ee8f15e995c68e984b6a24e247b2e954407d7941ea96abd7fe002a1bdfb713fdfb0d3839d948a334603f05e644829f606 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/a293eb0097fe87875f3bf908cc0b0ee8f15e995c68e984b6a24e247b2e954407d7941ea96abd7fe002a1bdfb713fdfb0d3839d948a334603f05e644829f606 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/a293eb0097fe87875f3bf908cc0b0ee8f15e995c68e984b6a24e247b2e954407d7941ea96abd7fe002a1bdfb713fdfb0d3839d948a334603f05e644829f606 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/a293eb0097fe87875f3bf908cc0b0ee8f15e995c68e984b6a24e247b2e954407d7941ea96abd7fe002a1bdfb713fdfb0d3839d948a334603f05e644829f606 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/d366a1cd57272e71d5331531d0bb10cb37215748b4b3e509e2f9bd250f37696560a309d9e0724d30088a2baa2e0f8674dafd845eb3f35a76ec302b445293ec b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/d366a1cd57272e71d5331531d0bb10cb37215748b4b3e509e2f9bd250f37696560a309d9e0724d30088a2baa2e0f8674dafd845eb3f35a76ec302b445293ec similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/d366a1cd57272e71d5331531d0bb10cb37215748b4b3e509e2f9bd250f37696560a309d9e0724d30088a2baa2e0f8674dafd845eb3f35a76ec302b445293ec rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a1/d366a1cd57272e71d5331531d0bb10cb37215748b4b3e509e2f9bd250f37696560a309d9e0724d30088a2baa2e0f8674dafd845eb3f35a76ec302b445293ec diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a5/cabe67bebc98ba3542132a29c6671d5f2d132ac12798e8757b96282d08e623b0fa7f3a9b4c385f77021dca9a12b6d197038114e834fe7178abd2af576cc0fc b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a5/cabe67bebc98ba3542132a29c6671d5f2d132ac12798e8757b96282d08e623b0fa7f3a9b4c385f77021dca9a12b6d197038114e834fe7178abd2af576cc0fc similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a5/cabe67bebc98ba3542132a29c6671d5f2d132ac12798e8757b96282d08e623b0fa7f3a9b4c385f77021dca9a12b6d197038114e834fe7178abd2af576cc0fc rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a5/cabe67bebc98ba3542132a29c6671d5f2d132ac12798e8757b96282d08e623b0fa7f3a9b4c385f77021dca9a12b6d197038114e834fe7178abd2af576cc0fc diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a8/2072ff53e56c0f2412d7055ce51937ad684e8c5eaca61b4098c804efaffcca85fa57891a66367f07ff537c39e49c6ad01bdffc53963bb5ce17e14d5d5b2691 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a8/2072ff53e56c0f2412d7055ce51937ad684e8c5eaca61b4098c804efaffcca85fa57891a66367f07ff537c39e49c6ad01bdffc53963bb5ce17e14d5d5b2691 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a8/2072ff53e56c0f2412d7055ce51937ad684e8c5eaca61b4098c804efaffcca85fa57891a66367f07ff537c39e49c6ad01bdffc53963bb5ce17e14d5d5b2691 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a8/2072ff53e56c0f2412d7055ce51937ad684e8c5eaca61b4098c804efaffcca85fa57891a66367f07ff537c39e49c6ad01bdffc53963bb5ce17e14d5d5b2691 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a9/f06cebe80afa38c614f316d4449fb36792e29e96e77e4fff60d96c113a01d8a35a99b39a6ecdfa2c3d4b91b253db71f41b71b35894b53c02faf56dd2dc9b2b b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a9/f06cebe80afa38c614f316d4449fb36792e29e96e77e4fff60d96c113a01d8a35a99b39a6ecdfa2c3d4b91b253db71f41b71b35894b53c02faf56dd2dc9b2b similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a9/f06cebe80afa38c614f316d4449fb36792e29e96e77e4fff60d96c113a01d8a35a99b39a6ecdfa2c3d4b91b253db71f41b71b35894b53c02faf56dd2dc9b2b rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/a9/f06cebe80afa38c614f316d4449fb36792e29e96e77e4fff60d96c113a01d8a35a99b39a6ecdfa2c3d4b91b253db71f41b71b35894b53c02faf56dd2dc9b2b diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/1753539f9ebfdb72d5243076a87459068cb4d3014c9572fd8fd7d63289572d33ea1b9a09343707bcc0156f52da38d419255a80ddcc3d047acb425ad13a6c65 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/1753539f9ebfdb72d5243076a87459068cb4d3014c9572fd8fd7d63289572d33ea1b9a09343707bcc0156f52da38d419255a80ddcc3d047acb425ad13a6c65 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/1753539f9ebfdb72d5243076a87459068cb4d3014c9572fd8fd7d63289572d33ea1b9a09343707bcc0156f52da38d419255a80ddcc3d047acb425ad13a6c65 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/1753539f9ebfdb72d5243076a87459068cb4d3014c9572fd8fd7d63289572d33ea1b9a09343707bcc0156f52da38d419255a80ddcc3d047acb425ad13a6c65 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/b65782c506600ccab8e3773b1d9d4b78b5c4390e5f7c7d84b8f687a955491a86d9094e56cb243139aa4cae7920a8dad6b6444d26d7c8e7d1d703d005baf881 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/b65782c506600ccab8e3773b1d9d4b78b5c4390e5f7c7d84b8f687a955491a86d9094e56cb243139aa4cae7920a8dad6b6444d26d7c8e7d1d703d005baf881 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/b65782c506600ccab8e3773b1d9d4b78b5c4390e5f7c7d84b8f687a955491a86d9094e56cb243139aa4cae7920a8dad6b6444d26d7c8e7d1d703d005baf881 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ab/b65782c506600ccab8e3773b1d9d4b78b5c4390e5f7c7d84b8f687a955491a86d9094e56cb243139aa4cae7920a8dad6b6444d26d7c8e7d1d703d005baf881 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ae/8cc174db52ee3c3d0650bbe981751501a3cf5eea43427f56ef59085216dfbe2c132e046516d171465ad9153f319f745f69a72d4e7a17be557dd4e8195d1188 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ae/8cc174db52ee3c3d0650bbe981751501a3cf5eea43427f56ef59085216dfbe2c132e046516d171465ad9153f319f745f69a72d4e7a17be557dd4e8195d1188 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ae/8cc174db52ee3c3d0650bbe981751501a3cf5eea43427f56ef59085216dfbe2c132e046516d171465ad9153f319f745f69a72d4e7a17be557dd4e8195d1188 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ae/8cc174db52ee3c3d0650bbe981751501a3cf5eea43427f56ef59085216dfbe2c132e046516d171465ad9153f319f745f69a72d4e7a17be557dd4e8195d1188 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/2c41be28025556716c648b4c946fe912eb2486f1ff6ce55314ac073794763085160211fa5a40b8b8ecb77bd42ef25702a924c1568852a51fb8ece66cbded7d b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/2c41be28025556716c648b4c946fe912eb2486f1ff6ce55314ac073794763085160211fa5a40b8b8ecb77bd42ef25702a924c1568852a51fb8ece66cbded7d similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/2c41be28025556716c648b4c946fe912eb2486f1ff6ce55314ac073794763085160211fa5a40b8b8ecb77bd42ef25702a924c1568852a51fb8ece66cbded7d rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/2c41be28025556716c648b4c946fe912eb2486f1ff6ce55314ac073794763085160211fa5a40b8b8ecb77bd42ef25702a924c1568852a51fb8ece66cbded7d diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/f538b95edd625bed589c70c311c3d0fba285536213b4f201b439496c43081f66518bce82ba103b061040e28f27c0886c4fb51135653a82b5502da7537818be-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/f538b95edd625bed589c70c311c3d0fba285536213b4f201b439496c43081f66518bce82ba103b061040e28f27c0886c4fb51135653a82b5502da7537818be-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/f538b95edd625bed589c70c311c3d0fba285536213b4f201b439496c43081f66518bce82ba103b061040e28f27c0886c4fb51135653a82b5502da7537818be-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b0/f538b95edd625bed589c70c311c3d0fba285536213b4f201b439496c43081f66518bce82ba103b061040e28f27c0886c4fb51135653a82b5502da7537818be-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b5/d4365b51992ed68b1694687961133e5fb248c0d73d8c8bd72843c2c68d43dcb36acc68990ea14f864c27308438b71e69d36c3e8bf59d37d55fa32f44ee5e9c b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b5/d4365b51992ed68b1694687961133e5fb248c0d73d8c8bd72843c2c68d43dcb36acc68990ea14f864c27308438b71e69d36c3e8bf59d37d55fa32f44ee5e9c similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b5/d4365b51992ed68b1694687961133e5fb248c0d73d8c8bd72843c2c68d43dcb36acc68990ea14f864c27308438b71e69d36c3e8bf59d37d55fa32f44ee5e9c rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b5/d4365b51992ed68b1694687961133e5fb248c0d73d8c8bd72843c2c68d43dcb36acc68990ea14f864c27308438b71e69d36c3e8bf59d37d55fa32f44ee5e9c diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ba6b65f843e79d2c64c065d9c9bcfdfa13b59261048cea72faeb8ba7c7e699ef3c3e53ae7302fa6bcca19d7e07774283a2489149eff2a99f1498688535921a b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ba6b65f843e79d2c64c065d9c9bcfdfa13b59261048cea72faeb8ba7c7e699ef3c3e53ae7302fa6bcca19d7e07774283a2489149eff2a99f1498688535921a similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ba6b65f843e79d2c64c065d9c9bcfdfa13b59261048cea72faeb8ba7c7e699ef3c3e53ae7302fa6bcca19d7e07774283a2489149eff2a99f1498688535921a rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ba6b65f843e79d2c64c065d9c9bcfdfa13b59261048cea72faeb8ba7c7e699ef3c3e53ae7302fa6bcca19d7e07774283a2489149eff2a99f1498688535921a diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ec91232c92453a7fc2e6b9c44afecf5abad1098babc001b12e4ef4c7b502c13975f2aa827085cf0882659fdc18d77596ae3feda90358cc5d85596e7239a739-index.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ec91232c92453a7fc2e6b9c44afecf5abad1098babc001b12e4ef4c7b502c13975f2aa827085cf0882659fdc18d77596ae3feda90358cc5d85596e7239a739-index.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ec91232c92453a7fc2e6b9c44afecf5abad1098babc001b12e4ef4c7b502c13975f2aa827085cf0882659fdc18d77596ae3feda90358cc5d85596e7239a739-index.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b7/ec91232c92453a7fc2e6b9c44afecf5abad1098babc001b12e4ef4c7b502c13975f2aa827085cf0882659fdc18d77596ae3feda90358cc5d85596e7239a739-index.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b9/3983757d131d5f583f14f320fd7958feef3e44c3466d340e5d96b04d4a6be8123fdd0cca035ced36d501c18a1ec5d15195643454f41ca4e011743c92f4ed84 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b9/3983757d131d5f583f14f320fd7958feef3e44c3466d340e5d96b04d4a6be8123fdd0cca035ced36d501c18a1ec5d15195643454f41ca4e011743c92f4ed84 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b9/3983757d131d5f583f14f320fd7958feef3e44c3466d340e5d96b04d4a6be8123fdd0cca035ced36d501c18a1ec5d15195643454f41ca4e011743c92f4ed84 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/b9/3983757d131d5f583f14f320fd7958feef3e44c3466d340e5d96b04d4a6be8123fdd0cca035ced36d501c18a1ec5d15195643454f41ca4e011743c92f4ed84 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/bb/810ac7659f1f5acfd6d8a7684095cb415743eae8b6ac34b36dd731a705f6dce63ccc0faaebf4d3aa342ad43c357b07463a4593fd745f176d36413d8387e232 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/bb/810ac7659f1f5acfd6d8a7684095cb415743eae8b6ac34b36dd731a705f6dce63ccc0faaebf4d3aa342ad43c357b07463a4593fd745f176d36413d8387e232 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/bb/810ac7659f1f5acfd6d8a7684095cb415743eae8b6ac34b36dd731a705f6dce63ccc0faaebf4d3aa342ad43c357b07463a4593fd745f176d36413d8387e232 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/bb/810ac7659f1f5acfd6d8a7684095cb415743eae8b6ac34b36dd731a705f6dce63ccc0faaebf4d3aa342ad43c357b07463a4593fd745f176d36413d8387e232 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c1/627c28f6ff66112cbf8528a20a0c764b70a83def607ac439ae34ed6a53606ba2acea929c5c6bdc4da3baad854fa1342fe7584e66cc2865038235ada2d080e9 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c1/627c28f6ff66112cbf8528a20a0c764b70a83def607ac439ae34ed6a53606ba2acea929c5c6bdc4da3baad854fa1342fe7584e66cc2865038235ada2d080e9 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c1/627c28f6ff66112cbf8528a20a0c764b70a83def607ac439ae34ed6a53606ba2acea929c5c6bdc4da3baad854fa1342fe7584e66cc2865038235ada2d080e9 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c1/627c28f6ff66112cbf8528a20a0c764b70a83def607ac439ae34ed6a53606ba2acea929c5c6bdc4da3baad854fa1342fe7584e66cc2865038235ada2d080e9 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/489de379efa61d68cea7f1d4ce40593a48a86f62c8be1da099a4462df0705c324ce2260b1998e9bde494d2a8158c60d7517be8448d27252379d675d99ae1be b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/489de379efa61d68cea7f1d4ce40593a48a86f62c8be1da099a4462df0705c324ce2260b1998e9bde494d2a8158c60d7517be8448d27252379d675d99ae1be similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/489de379efa61d68cea7f1d4ce40593a48a86f62c8be1da099a4462df0705c324ce2260b1998e9bde494d2a8158c60d7517be8448d27252379d675d99ae1be rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/489de379efa61d68cea7f1d4ce40593a48a86f62c8be1da099a4462df0705c324ce2260b1998e9bde494d2a8158c60d7517be8448d27252379d675d99ae1be diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/8b3fe5b3296a738463ce8a47c61c2327cbf836980b587a1eb7f9bab9381b8aa64a906127d0746be88975a294e2b1366e9c6ebd29beb3533c26a34c0836ec63 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/8b3fe5b3296a738463ce8a47c61c2327cbf836980b587a1eb7f9bab9381b8aa64a906127d0746be88975a294e2b1366e9c6ebd29beb3533c26a34c0836ec63 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/8b3fe5b3296a738463ce8a47c61c2327cbf836980b587a1eb7f9bab9381b8aa64a906127d0746be88975a294e2b1366e9c6ebd29beb3533c26a34c0836ec63 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c2/8b3fe5b3296a738463ce8a47c61c2327cbf836980b587a1eb7f9bab9381b8aa64a906127d0746be88975a294e2b1366e9c6ebd29beb3533c26a34c0836ec63 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c5/02ab890efbf3a02ce07e6c5a0e7bc5f6d1fe4c07a6853ea6dcda1eea5734e4c6cf5a3b01ff0933938ec0f904668ff6ceef6c30f06a028282d7bed0ff5e80fd b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c5/02ab890efbf3a02ce07e6c5a0e7bc5f6d1fe4c07a6853ea6dcda1eea5734e4c6cf5a3b01ff0933938ec0f904668ff6ceef6c30f06a028282d7bed0ff5e80fd similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c5/02ab890efbf3a02ce07e6c5a0e7bc5f6d1fe4c07a6853ea6dcda1eea5734e4c6cf5a3b01ff0933938ec0f904668ff6ceef6c30f06a028282d7bed0ff5e80fd rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/c5/02ab890efbf3a02ce07e6c5a0e7bc5f6d1fe4c07a6853ea6dcda1eea5734e4c6cf5a3b01ff0933938ec0f904668ff6ceef6c30f06a028282d7bed0ff5e80fd diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ca/aef648fadff31bff67bcf356914123c841f31901e366605fc56ab9b21c12862a8458b00421c97659a89ac062ec1149e0ea3564fa20831eff54fde3fed929a9 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ca/aef648fadff31bff67bcf356914123c841f31901e366605fc56ab9b21c12862a8458b00421c97659a89ac062ec1149e0ea3564fa20831eff54fde3fed929a9 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ca/aef648fadff31bff67bcf356914123c841f31901e366605fc56ab9b21c12862a8458b00421c97659a89ac062ec1149e0ea3564fa20831eff54fde3fed929a9 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/ca/aef648fadff31bff67bcf356914123c841f31901e366605fc56ab9b21c12862a8458b00421c97659a89ac062ec1149e0ea3564fa20831eff54fde3fed929a9 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d4/ed3c76ebd0373b0f89f7cf234dbb847d282dd12c746b92e252c541abdc3d3349e11ada478524a3bf4faf2624d0b3a81bdf8b6f0daeb5a1b3f260c5844a52ee b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d4/ed3c76ebd0373b0f89f7cf234dbb847d282dd12c746b92e252c541abdc3d3349e11ada478524a3bf4faf2624d0b3a81bdf8b6f0daeb5a1b3f260c5844a52ee similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d4/ed3c76ebd0373b0f89f7cf234dbb847d282dd12c746b92e252c541abdc3d3349e11ada478524a3bf4faf2624d0b3a81bdf8b6f0daeb5a1b3f260c5844a52ee rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d4/ed3c76ebd0373b0f89f7cf234dbb847d282dd12c746b92e252c541abdc3d3349e11ada478524a3bf4faf2624d0b3a81bdf8b6f0daeb5a1b3f260c5844a52ee diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d9/083a273b29fe4dfb0f89675d8ebfe7181c015a73ba38bfa4749e7667835c8e40f11f4d807dbb6248a335d668303174d0162432ae274a81d6a26c5f63720185 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d9/083a273b29fe4dfb0f89675d8ebfe7181c015a73ba38bfa4749e7667835c8e40f11f4d807dbb6248a335d668303174d0162432ae274a81d6a26c5f63720185 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d9/083a273b29fe4dfb0f89675d8ebfe7181c015a73ba38bfa4749e7667835c8e40f11f4d807dbb6248a335d668303174d0162432ae274a81d6a26c5f63720185 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/d9/083a273b29fe4dfb0f89675d8ebfe7181c015a73ba38bfa4749e7667835c8e40f11f4d807dbb6248a335d668303174d0162432ae274a81d6a26c5f63720185 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/dd/92acec86cd45731b94b2c19c39e660827193255ca255df773e8d813f27a5f7e095ae5f6ab589378442438a3164fa3ec9306be4969bf29992bea19c6fa5be99 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/dd/92acec86cd45731b94b2c19c39e660827193255ca255df773e8d813f27a5f7e095ae5f6ab589378442438a3164fa3ec9306be4969bf29992bea19c6fa5be99 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/dd/92acec86cd45731b94b2c19c39e660827193255ca255df773e8d813f27a5f7e095ae5f6ab589378442438a3164fa3ec9306be4969bf29992bea19c6fa5be99 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/dd/92acec86cd45731b94b2c19c39e660827193255ca255df773e8d813f27a5f7e095ae5f6ab589378442438a3164fa3ec9306be4969bf29992bea19c6fa5be99 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e2/259701f5d70901ead0eaf1b6b7606c466b167169e57d243c3865900570393aacc723ae0ab9628bed5382dc76ffd820e33df9b18ea9d2a6cc0970dda8307dd1 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e2/259701f5d70901ead0eaf1b6b7606c466b167169e57d243c3865900570393aacc723ae0ab9628bed5382dc76ffd820e33df9b18ea9d2a6cc0970dda8307dd1 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e2/259701f5d70901ead0eaf1b6b7606c466b167169e57d243c3865900570393aacc723ae0ab9628bed5382dc76ffd820e33df9b18ea9d2a6cc0970dda8307dd1 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e2/259701f5d70901ead0eaf1b6b7606c466b167169e57d243c3865900570393aacc723ae0ab9628bed5382dc76ffd820e33df9b18ea9d2a6cc0970dda8307dd1 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e6/b5a339b07d126ba1cb1f5df3be7ca36c7dc25e3f05b4a4caca096132528e05d55200b41ae3d332b4b8f0a40ecadffd90902167d8dd012990d800e5b1492443 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e6/b5a339b07d126ba1cb1f5df3be7ca36c7dc25e3f05b4a4caca096132528e05d55200b41ae3d332b4b8f0a40ecadffd90902167d8dd012990d800e5b1492443 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e6/b5a339b07d126ba1cb1f5df3be7ca36c7dc25e3f05b4a4caca096132528e05d55200b41ae3d332b4b8f0a40ecadffd90902167d8dd012990d800e5b1492443 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e6/b5a339b07d126ba1cb1f5df3be7ca36c7dc25e3f05b4a4caca096132528e05d55200b41ae3d332b4b8f0a40ecadffd90902167d8dd012990d800e5b1492443 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e9/79b09a8f67cf3c16ff8864149b365652f33fcfd91c576d38c04c00a88ff6c2bffb35fd0de89e6da8e591ec51698fd33985c59617e4d2e648680b812707fd32 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e9/79b09a8f67cf3c16ff8864149b365652f33fcfd91c576d38c04c00a88ff6c2bffb35fd0de89e6da8e591ec51698fd33985c59617e4d2e648680b812707fd32 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e9/79b09a8f67cf3c16ff8864149b365652f33fcfd91c576d38c04c00a88ff6c2bffb35fd0de89e6da8e591ec51698fd33985c59617e4d2e648680b812707fd32 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/e9/79b09a8f67cf3c16ff8864149b365652f33fcfd91c576d38c04c00a88ff6c2bffb35fd0de89e6da8e591ec51698fd33985c59617e4d2e648680b812707fd32 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f1/1f089b504fbd98ddfb1152244e8b5a44259f4708badb3406c9f72bd330a4f4412338e2d1cfbdc48228ef31680b1d7306ae7e37ca51dc5f07c5d21a8d642eea b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f1/1f089b504fbd98ddfb1152244e8b5a44259f4708badb3406c9f72bd330a4f4412338e2d1cfbdc48228ef31680b1d7306ae7e37ca51dc5f07c5d21a8d642eea similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f1/1f089b504fbd98ddfb1152244e8b5a44259f4708badb3406c9f72bd330a4f4412338e2d1cfbdc48228ef31680b1d7306ae7e37ca51dc5f07c5d21a8d642eea rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f1/1f089b504fbd98ddfb1152244e8b5a44259f4708badb3406c9f72bd330a4f4412338e2d1cfbdc48228ef31680b1d7306ae7e37ca51dc5f07c5d21a8d642eea diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f4/53b9f76d8a71f33a64a437bee3a124b8d93e45ebec7c652944181c1b49fb959decfa9d545ee0b677601b57c66e3a4d356840442118f29ff6162905481dd672 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f4/53b9f76d8a71f33a64a437bee3a124b8d93e45ebec7c652944181c1b49fb959decfa9d545ee0b677601b57c66e3a4d356840442118f29ff6162905481dd672 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f4/53b9f76d8a71f33a64a437bee3a124b8d93e45ebec7c652944181c1b49fb959decfa9d545ee0b677601b57c66e3a4d356840442118f29ff6162905481dd672 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f4/53b9f76d8a71f33a64a437bee3a124b8d93e45ebec7c652944181c1b49fb959decfa9d545ee0b677601b57c66e3a4d356840442118f29ff6162905481dd672 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f5/d91d1b795b75e1be37c912cce3dc67ffba97d1b25fcb6c8455ff385fb19b5adcd570f4991933a2b42cd465c61ada0f079b27c9d8d18270e760f043a129b09c b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f5/d91d1b795b75e1be37c912cce3dc67ffba97d1b25fcb6c8455ff385fb19b5adcd570f4991933a2b42cd465c61ada0f079b27c9d8d18270e760f043a129b09c similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f5/d91d1b795b75e1be37c912cce3dc67ffba97d1b25fcb6c8455ff385fb19b5adcd570f4991933a2b42cd465c61ada0f079b27c9d8d18270e760f043a129b09c rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f5/d91d1b795b75e1be37c912cce3dc67ffba97d1b25fcb6c8455ff385fb19b5adcd570f4991933a2b42cd465c61ada0f079b27c9d8d18270e760f043a129b09c diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f7/fa4379bdbd9163d92b20e814a57989b8a4f9e2c29a9bbdf5aa3546280f5dc2e65a4b942ed756848d80743be0c57f6ee49eaec3bc0d45075bf49219a67f285b b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f7/fa4379bdbd9163d92b20e814a57989b8a4f9e2c29a9bbdf5aa3546280f5dc2e65a4b942ed756848d80743be0c57f6ee49eaec3bc0d45075bf49219a67f285b similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f7/fa4379bdbd9163d92b20e814a57989b8a4f9e2c29a9bbdf5aa3546280f5dc2e65a4b942ed756848d80743be0c57f6ee49eaec3bc0d45075bf49219a67f285b rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f7/fa4379bdbd9163d92b20e814a57989b8a4f9e2c29a9bbdf5aa3546280f5dc2e65a4b942ed756848d80743be0c57f6ee49eaec3bc0d45075bf49219a67f285b diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f8/99e6a1b7399d530c9c7a715b982629d11ed2b7c29c4d6012565446f52765a0ea6ba03bd02846ac5d869a4c8eafd78cec329067cd8bbe67e8e9c376ddc65323 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f8/99e6a1b7399d530c9c7a715b982629d11ed2b7c29c4d6012565446f52765a0ea6ba03bd02846ac5d869a4c8eafd78cec329067cd8bbe67e8e9c376ddc65323 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f8/99e6a1b7399d530c9c7a715b982629d11ed2b7c29c4d6012565446f52765a0ea6ba03bd02846ac5d869a4c8eafd78cec329067cd8bbe67e8e9c376ddc65323 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/f8/99e6a1b7399d530c9c7a715b982629d11ed2b7c29c4d6012565446f52765a0ea6ba03bd02846ac5d869a4c8eafd78cec329067cd8bbe67e8e9c376ddc65323 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/3105ba6d7a827fb30919e3ddc2f6556ac578933d0f75cbe92a2e5c3858933fabbcb9720a5b5e916e2e6f2b3bb748f628c580671485aa4d35c381c5d3c1cb28 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/3105ba6d7a827fb30919e3ddc2f6556ac578933d0f75cbe92a2e5c3858933fabbcb9720a5b5e916e2e6f2b3bb748f628c580671485aa4d35c381c5d3c1cb28 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/3105ba6d7a827fb30919e3ddc2f6556ac578933d0f75cbe92a2e5c3858933fabbcb9720a5b5e916e2e6f2b3bb748f628c580671485aa4d35c381c5d3c1cb28 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/3105ba6d7a827fb30919e3ddc2f6556ac578933d0f75cbe92a2e5c3858933fabbcb9720a5b5e916e2e6f2b3bb748f628c580671485aa4d35c381c5d3c1cb28 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/376ecb3f77b684de895ee83e6557107cba99c99860f1209aa777627c2124c24f9c7eea2601292314adc869b6e79071169cd04299ab78dbd94dc19303cde999 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/376ecb3f77b684de895ee83e6557107cba99c99860f1209aa777627c2124c24f9c7eea2601292314adc869b6e79071169cd04299ab78dbd94dc19303cde999 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/376ecb3f77b684de895ee83e6557107cba99c99860f1209aa777627c2124c24f9c7eea2601292314adc869b6e79071169cd04299ab78dbd94dc19303cde999 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/376ecb3f77b684de895ee83e6557107cba99c99860f1209aa777627c2124c24f9c7eea2601292314adc869b6e79071169cd04299ab78dbd94dc19303cde999 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/73a6f06bcc104dea563c7f2b8a687928b68254e9bedad61a726af2c7b0858fe8b0e74ddcea95a8ad7ddf42f775a09b7271d5ac1a91afbf64becf04c2635c07 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/73a6f06bcc104dea563c7f2b8a687928b68254e9bedad61a726af2c7b0858fe8b0e74ddcea95a8ad7ddf42f775a09b7271d5ac1a91afbf64becf04c2635c07 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/73a6f06bcc104dea563c7f2b8a687928b68254e9bedad61a726af2c7b0858fe8b0e74ddcea95a8ad7ddf42f775a09b7271d5ac1a91afbf64becf04c2635c07 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/73a6f06bcc104dea563c7f2b8a687928b68254e9bedad61a726af2c7b0858fe8b0e74ddcea95a8ad7ddf42f775a09b7271d5ac1a91afbf64becf04c2635c07 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/ff00031cdc3509dbe34626edd86ca869705e2915cb2acabe7a92c29e2224efeeeb05ea821114479195ddb3757571c1b7c4014f8398c8dd6f4bf8377cd5feec b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/ff00031cdc3509dbe34626edd86ca869705e2915cb2acabe7a92c29e2224efeeeb05ea821114479195ddb3757571c1b7c4014f8398c8dd6f4bf8377cd5feec similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/ff00031cdc3509dbe34626edd86ca869705e2915cb2acabe7a92c29e2224efeeeb05ea821114479195ddb3757571c1b7c4014f8398c8dd6f4bf8377cd5feec rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fb/ff00031cdc3509dbe34626edd86ca869705e2915cb2acabe7a92c29e2224efeeeb05ea821114479195ddb3757571c1b7c4014f8398c8dd6f4bf8377cd5feec diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/a2e53177a7d470107f506cf76300c9a640a3a23eca997ab3fee93e7ef71aa53be54a338146395fa179892eda72fc01e7f7b7644ac6d273f149183b0605c094 b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/a2e53177a7d470107f506cf76300c9a640a3a23eca997ab3fee93e7ef71aa53be54a338146395fa179892eda72fc01e7f7b7644ac6d273f149183b0605c094 similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/a2e53177a7d470107f506cf76300c9a640a3a23eca997ab3fee93e7ef71aa53be54a338146395fa179892eda72fc01e7f7b7644ac6d273f149183b0605c094 rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/a2e53177a7d470107f506cf76300c9a640a3a23eca997ab3fee93e7ef71aa53be54a338146395fa179892eda72fc01e7f7b7644ac6d273f149183b0605c094 diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/bf1cf9214ee3e490e7c78f62de78204514ff500097e393b1ced4286150d306ad517a3f9237d65ed092bd0ffbf60d903e3afbd82aa797020cb73d7a5c43fd1e b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/bf1cf9214ee3e490e7c78f62de78204514ff500097e393b1ced4286150d306ad517a3f9237d65ed092bd0ffbf60d903e3afbd82aa797020cb73d7a5c43fd1e similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/bf1cf9214ee3e490e7c78f62de78204514ff500097e393b1ced4286150d306ad517a3f9237d65ed092bd0ffbf60d903e3afbd82aa797020cb73d7a5c43fd1e rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/.pnpm-store/v3/files/fe/bf1cf9214ee3e490e7c78f62de78204514ff500097e393b1ced4286150d306ad517a3f9237d65ed092bd0ffbf60d903e3afbd82aa797020cb73d7a5c43fd1e diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-lock.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-lock.yaml similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-lock.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-lock.yaml diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-workspace.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-workspace.yaml similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-workspace.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/asset.a11c8e6e312f823cabbe86608124d4e1253aa8e8e69d7dfcb687304a1b2c359b/pnpm-workspace.yaml diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.ts similarity index 82% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.ts index 5b0168bd082f4..5490987e9f6d0 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies-pnpm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies-pnpm.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Runtime } from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; -import * as lambda from '../lib'; +import { Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js new file mode 100644 index 0000000000000..8e56d203e5a32 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const lambda = require("aws-cdk-lib/aws-lambda-nodejs"); +class SdkV2TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // This function uses aws-sdk but it will not be included + this.lambdaFunction = new lambda.NodejsFunction(this, 'external', { + entry: path.join(__dirname, 'integ-handlers/dependencies.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_16_X, + bundling: { + minify: true, + // Will be installed, not bundled + // (delay is a zero dependency package and its version is fixed + // in the package.json to ensure a stable hash for this integ test) + nodeModules: ['delay'], + forceDockerBundling: true, + }, + }); + } +} +class SdkV3TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // This function uses @aws-sdk/* but it will not be included + this.lambdaFunction = new lambda.NodejsFunction(this, 'external-sdk-v3', { + entry: path.join(__dirname, 'integ-handlers/dependencies-sdk-v3.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_18_X, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const sdkV2testCase = new SdkV2TestStack(app, 'cdk-integ-lambda-nodejs-dependencies'); +const sdkV3testCase = new SdkV3TestStack(app, 'cdk-integ-lambda-nodejs-dependencies-for-sdk-v3'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'LambdaDependencies', { + testCases: [sdkV2testCase, sdkV3testCase], +}); +for (const testCase of [sdkV2testCase, sdkV3testCase]) { + const response = integ.assertions.invokeFunction({ + functionName: testCase.lambdaFunction.functionName, + }); + response.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + // expect invoking without error + StatusCode: 200, + ExecutedVersion: '$LATEST', + Payload: 'null', + })); +} +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVwZW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cCwgJ2Nkay1pbnRlZy1sYW1iZGEtbm9kZWpzLWRlcGVuZGVuY2llcycpO1xuY29uc3Qgc2RrVjN0ZXN0Q2FzZSA9IG5ldyBTZGtWM1Rlc3RTdGFjayhhcHAsICdjZGstaW50ZWctbGFtYmRhLW5vZGVqcy1kZXBlbmRlbmNpZXMtZm9yLXNkay12MycpO1xuXG5jb25zdCBpbnRlZyA9IG5ldyBJbnRlZ1Rlc3QoYXBwLCAnTGFtYmRhRGVwZW5kZW5jaWVzJywge1xuICB0ZXN0Q2FzZXM6IFtzZGtWMnRlc3RDYXNlLCBzZGtWM3Rlc3RDYXNlXSxcbn0pO1xuXG5mb3IgKGNvbnN0IHRlc3RDYXNlIG9mIFtzZGtWMnRlc3RDYXNlLCBzZGtWM3Rlc3RDYXNlXSkge1xuICBjb25zdCByZXNwb25zZSA9IGludGVnLmFzc2VydGlvbnMuaW52b2tlRnVuY3Rpb24oe1xuICAgIGZ1bmN0aW9uTmFtZTogdGVzdENhc2UubGFtYmRhRnVuY3Rpb24uZnVuY3Rpb25OYW1lLFxuICB9KTtcbiAgcmVzcG9uc2UuZXhwZWN0KEV4cGVjdGVkUmVzdWx0Lm9iamVjdExpa2Uoe1xuICAgIC8vIGV4cGVjdCBpbnZva2luZyB3aXRob3V0IGVycm9yXG4gICAgU3RhdHVzQ29kZTogMjAwLFxuICAgIEV4ZWN1dGVkVmVyc2lvbjogJyRMQVRFU1QnLFxuICAgIFBheWxvYWQ6ICdudWxsJyxcbiAgfSkpO1xufVxuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/LambdaDependenciesDefaultTestDeployAssert259C940B.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.17aca8d66b8002777cc23fe0985e380297b38bc1a82600d6f78c38ada6902d96/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.17aca8d66b8002777cc23fe0985e380297b38bc1a82600d6f78c38ada6902d96/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.17aca8d66b8002777cc23fe0985e380297b38bc1a82600d6f78c38ada6902d96/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.17aca8d66b8002777cc23fe0985e380297b38bc1a82600d6f78c38ada6902d96/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/yarn.lock b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/yarn.lock similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/yarn.lock rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.50a8879346510e33e69a511e29d588e7b2d2b477b6989a4db677027bb8605b9f/yarn.lock diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/asset.92ec9d050245fd270cf2b0df478b31f140ba820c3407e964246946bcea933a19.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies-for-sdk-v3.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk-integ-lambda-nodejs-dependencies.template.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.ts similarity index 88% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.ts index 02d17aee3d142..3b2f2f7e94f1e 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.dependencies.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.dependencies.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { Runtime, IFunction } from '@aws-cdk/aws-lambda'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; +import { Runtime, IFunction } from 'aws-cdk-lib/aws-lambda'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as lambda from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'; class SdkV2TestStack extends Stack { public lambdaFunction: IFunction diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js new file mode 100644 index 0000000000000..0504df662f7c9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda-nodejs"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new lambda.NodejsFunction(this, 'esm', { + entry: path.join(__dirname, 'integ-handlers/esm.ts'), + bundling: { + format: lambda.OutputFormat.ESM, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-lambda-nodejs-esm'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXNtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZXNtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDZDQUFxRDtBQUVyRCx3REFBd0Q7QUFFeEQsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixJQUFJLE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxFQUFFLEtBQUssRUFBRTtZQUNyQyxLQUFLLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsdUJBQXVCLENBQUM7WUFDcEQsUUFBUSxFQUFFO2dCQUNSLE1BQU0sRUFBRSxNQUFNLENBQUMsWUFBWSxDQUFDLEdBQUc7YUFDaEM7U0FDRixDQUFDLENBQUM7SUFDTCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUN0QixJQUFJLFNBQVMsQ0FBQyxHQUFHLEVBQUUsNkJBQTZCLENBQUMsQ0FBQztBQUNsRCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBwYXRoIGZyb20gJ3BhdGgnO1xuaW1wb3J0IHsgQXBwLCBTdGFjaywgU3RhY2tQcm9wcyB9IGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7IENvbnN0cnVjdCB9IGZyb20gJ2NvbnN0cnVjdHMnO1xuaW1wb3J0ICogYXMgbGFtYmRhIGZyb20gJ2F3cy1jZGstbGliL2F3cy1sYW1iZGEtbm9kZWpzJztcblxuY2xhc3MgVGVzdFN0YWNrIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQ29uc3RydWN0LCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIG5ldyBsYW1iZGEuTm9kZWpzRnVuY3Rpb24odGhpcywgJ2VzbScsIHtcbiAgICAgIGVudHJ5OiBwYXRoLmpvaW4oX19kaXJuYW1lLCAnaW50ZWctaGFuZGxlcnMvZXNtLnRzJyksXG4gICAgICBidW5kbGluZzoge1xuICAgICAgICBmb3JtYXQ6IGxhbWJkYS5PdXRwdXRGb3JtYXQuRVNNLFxuICAgICAgfSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1sYW1iZGEtbm9kZWpzLWVzbScpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/asset.e1af356d995917f14ba5cf5e65cb7c4e969e2c28567bea560a8912fbbfa3fa4e/index.mjs b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/asset.e1af356d995917f14ba5cf5e65cb7c4e969e2c28567bea560a8912fbbfa3fa4e/index.mjs similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/asset.e1af356d995917f14ba5cf5e65cb7c4e969e2c28567bea560a8912fbbfa3fa4e/index.mjs rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/asset.e1af356d995917f14ba5cf5e65cb7c4e969e2c28567bea560a8912fbbfa3fa4e/index.mjs diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk-integ-lambda-nodejs-esm.template.json diff --git a/packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-kms/test/integ.key.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.ts similarity index 81% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.ts index acf0ac363489b..28203a2d89150 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.esm.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { App, Stack, StackProps } from '@aws-cdk/core'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as lambda from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js new file mode 100644 index 0000000000000..1923e3650b358 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const os = require("os"); +const path = require("path"); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda-nodejs"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new lambda.NodejsFunction(this, 'ts-handler', { + entry: path.join(__dirname, 'integ-handlers/ts-handler.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + bundling: { + minify: true, + sourceMap: true, + sourceMapMode: lambda.SourceMapMode.BOTH, + }, + }); + new lambda.NodejsFunction(this, 'js-handler', { + entry: path.join(__dirname, 'integ-handlers/js-handler.js'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + }); + new lambda.NodejsFunction(this, 'ts-handler-vpc', { + entry: path.join(__dirname, 'integ-handlers/ts-handler.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + vpc: new aws_ec2_1.Vpc(this, 'Vpc'), + }); + new lambda.NodejsFunction(this, 'ts-handler-custom-handler-no-dots', { + entry: path.join(__dirname, 'integ-handlers/ts-handler.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + bundling: { + minify: true, + sourceMap: true, + sourceMapMode: lambda.SourceMapMode.BOTH, + }, + handler: 'handler', + }); + new lambda.NodejsFunction(this, 'ts-handler-custom-handler-dots', { + entry: path.join(__dirname, 'integ-handlers/ts-web-handler.ts'), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + bundling: { + minify: true, + sourceMap: true, + sourceMapMode: lambda.SourceMapMode.BOTH, + commandHooks: { + beforeBundling: () => [], + beforeInstall: () => [], + afterBundling: (_inputDir, outputDir) => [ + `${os.platform() === 'win32' ? 'copy' : 'cp'} ${path.join(__dirname, 'integ-handlers', 'ts-web-run.sh')} ${outputDir}`, + ], + }, + }, + handler: 'ts-web.run.sh', + layers: [ + aws_lambda_1.LayerVersion.fromLayerVersionArn(this, 'lambda-adapter-layer', `arn:aws:lambda:${aws_cdk_lib_1.Aws.REGION}:753240598075:layer:LambdaAdapterLayerX86:13`), + ], + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-lambda-nodejs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZnVuY3Rpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5mdW5jdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlCQUF5QjtBQUN6Qiw2QkFBNkI7QUFDN0IsaURBQTBDO0FBQzFDLHVEQUErRDtBQUMvRCw2Q0FBMEQ7QUFFMUQsd0RBQXdEO0FBRXhELE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxD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ZXJWZXJzaW9uLmZyb21MYXllclZlcnNpb25Bcm4oXG4gICAgICAgICAgdGhpcyxcbiAgICAgICAgICAnbGFtYmRhLWFkYXB0ZXItbGF5ZXInLFxuICAgICAgICAgIGBhcm46YXdzOmxhbWJkYToke0F3cy5SRUdJT059Ojc1MzI0MDU5ODA3NTpsYXllcjpMYW1iZGFBZGFwdGVyTGF5ZXJYODY6MTNgLFxuICAgICAgICApLFxuICAgICAgXSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1sYW1iZGEtbm9kZWpzJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.382942a012a71461edc27c0448dc538344be5c159143f651b626408206e10d44/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.382942a012a71461edc27c0448dc538344be5c159143f651b626408206e10d44/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.382942a012a71461edc27c0448dc538344be5c159143f651b626408206e10d44/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.382942a012a71461edc27c0448dc538344be5c159143f651b626408206e10d44/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js.map b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js.map similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js.map rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.5017e4b2e278e32bc634202d075b7ed8961b0d784f75450f7918a6a4f6f7df4a/index.js.map diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.6180c9978dfd12a00b82fe039bf88defd289ae4bfbcca5917f7f306a384f9eae/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.6180c9978dfd12a00b82fe039bf88defd289ae4bfbcca5917f7f306a384f9eae/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.6180c9978dfd12a00b82fe039bf88defd289ae4bfbcca5917f7f306a384f9eae/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.6180c9978dfd12a00b82fe039bf88defd289ae4bfbcca5917f7f306a384f9eae/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js.map b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js.map similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js.map rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/index.js.map diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/ts-web-run.sh b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/ts-web-run.sh similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/ts-web-run.sh rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/asset.a33898f49e24c41ff9be236439c418d30e576c5f57763097162d9ec4245216ce/ts-web-run.sh diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.assets.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk-integ-lambda-nodejs.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.ts similarity index 90% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.ts index ba6e676e1b7fc..d02db7dba8a17 100644 --- a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.function.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/test/integ.function.ts @@ -1,10 +1,10 @@ import * as os from 'os'; import * as path from 'path'; -import { Vpc } from '@aws-cdk/aws-ec2'; -import { LayerVersion, Runtime } from '@aws-cdk/aws-lambda'; -import { Aws, App, Stack, StackProps } from '@aws-cdk/core'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { LayerVersion, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { Aws, App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as lambda from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/tsconfig.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/tsconfig.json new file mode 100644 index 0000000000000..9199dc27c7bd6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda-nodejs/tsconfig.json @@ -0,0 +1,69 @@ +{ + "compilerOptions": { + "declarationMap": false, + "inlineSourceMap": true, + "inlineSources": true, + "alwaysStrict": true, + "charset": "utf8", + "declaration": true, + "experimentalDecorators": true, + "incremental": true, + "lib": [ + "es2020" + ], + "module": "CommonJS", + "newLine": "lf", + "noEmitOnError": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": false, + "target": "ES2020", + "composite": true, + "tsBuildInfoFile": "tsconfig.tsbuildinfo" + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "node_modules" + ], + "references": [ + { + "path": "../aws-lambda" + }, + { + "path": "../core" + }, + { + "path": "../assertions" + }, + { + "path": "../aws-ec2" + }, + { + "path": "../../../tools/@aws-cdk/cdk-build-tools" + }, + { + "path": "../integ-runner" + }, + { + "path": "../integ-tests" + }, + { + "path": "../../../tools/@aws-cdk/pkglint" + }, + { + "path": "../triggers" + } + ], + "_generated_by_jsii_": "Generated by jsii - safe to delete, and ideally should be in .gitignore" +} diff --git a/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-arm64-handler/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-arm64-handler/Dockerfile diff --git a/packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-arm64-handler/index.py similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/docker-arm64-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-arm64-handler/index.py diff --git a/packages/@aws-cdk/aws-lambda/test/docker-lambda-handler/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/docker-lambda-handler/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/Dockerfile diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/app.d.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/app.d.ts diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/app.js similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/app.js diff --git a/packages/@aws-cdk/aws-lambda/test/docker-lambda-handler/app.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/app.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/docker-lambda-handler/app.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/docker-lambda-handler/app.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/handler.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/handler.zip new file mode 100644 index 0000000000000..c10082ad29f5f Binary files /dev/null and b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/handler.zip differ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js new file mode 100644 index 0000000000000..751e8b2617264 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + /// !show + new lambda.Function(this, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_9, + }); + /// !hide + } +} +const app = new cdk.App(); +new TestStack(app, 'lambda-test-assets-file'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLmZpbGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hc3NldHMuZmlsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixtQ0FBbUM7QUFDbkMsaURBQWlEO0FBRWpELE1BQU0sU0FBVSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQy9CLFlBQVksS0FB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XJuYW1lLCAnaGFuZGxlci56aXAnKSksXG4gICAgICBoYW5kbGVyOiAnaW5kZXgubWFpbicsXG4gICAgICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5QWVRIT05fM185LFxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBUZXN0U3RhY2soYXBwLCAnbGFtYmRhLXRlc3QtYXNzZXRzLWZpbGUnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/asset.a37d3ef54c18e7738fe5dc008504591bd3b1f14c6a09ee91eac6d55f7ca5ba5f.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/asset.a37d3ef54c18e7738fe5dc008504591bd3b1f14c6a09ee91eac6d55f7ca5ba5f.zip similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/asset.a37d3ef54c18e7738fe5dc008504591bd3b1f14c6a09ee91eac6d55f7ca5ba5f.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/asset.a37d3ef54c18e7738fe5dc008504591bd3b1f14c6a09ee91eac6d55f7ca5ba5f.zip diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kinesiswithdlq.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/lambda-test-assets-file.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.ts similarity index 84% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.ts index 0a92afb18e82b..7f4190d853314 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.file.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js new file mode 100644 index 0000000000000..39be3833f5647 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + /// !show + new lambda.Function(this, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_9, + }); + /// !hide + } +} +const app = new cdk.App(); +new TestStack(app, 'lambda-test-assets'); +app.synth(); +//# sourceMappingURL=data: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XG5jbGFzcyBUZXN0U3RhY2sgZXh0ZW5kcyBjZGsuU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogY2RrLkFwcCwgaWQ6IHN0cmluZykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICAvLy8gIXNob3dcbiAgICBuZXcgbGFtYmRhLkZ1bmN0aW9uKHRoaXMsICdNeUxhbWJkYScsIHtcbiAgICAgIGNvZGU6IGxhbWJkYS5Db2RlLmZyb21Bc3NldChwYXRoLmpvaW4oX19kaXJuYW1lLCAnbXktbGFtYmRhLWhhbmRsZXInKSksXG4gICAgICBoYW5kbGVyOiAnaW5kZXgubWFpbicsXG4gICAgICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5QWVRIT05fM185LFxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBUZXN0U3RhY2soYXBwLCAnbGFtYmRhLXRlc3QtYXNzZXRzJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront/test/experimental/my-lambda-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/experimental/my-lambda-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs-with-filter-criteria.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/lambda-test-assets.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.ts new file mode 100644 index 0000000000000..090c12201f39a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.assets.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + /// !show + new lambda.Function(this, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_9, + }); + /// !hide + } +} + +const app = new cdk.App(); + +new TestStack(app, 'lambda-test-assets'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js new file mode 100644 index 0000000000000..5f4452599c099 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const appscaling = require("aws-cdk-lib/aws-applicationautoscaling"); +const cdk = require("aws-cdk-lib"); +const cx_api_1 = require("aws-cdk-lib/cx-api"); +const lambda = require("aws-cdk-lib/aws-lambda"); +/** +* Stack verification steps: +* aws application-autoscaling describe-scalable-targets --service-namespace lambda --resource-ids function::prod +* has a minCapacity of 3 and maxCapacity of 50 +*/ +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const fn = new lambda.Function(this, 'MyLambda', { + code: new lambda.InlineCode('exports.handler = async () => { console.log(\'hello world\'); };'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const version = fn.currentVersion; + const alias = new lambda.Alias(this, 'Alias', { + aliasName: 'prod', + version, + }); + const scalingTarget = alias.addAutoScaling({ minCapacity: 3, maxCapacity: 50 }); + scalingTarget.scaleOnUtilization({ + utilizationTarget: 0.5, + }); + scalingTarget.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, + }); + scalingTarget.scaleOnSchedule('ScaleDownAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 20, + }); + new cdk.CfnOutput(this, 'FunctionName', { + value: fn.functionName, + }); + } +} +const app = new cdk.App(); +const stack = new TestStack(app, 'aws-lambda-autoscaling'); +// Changes the function description when the feature flag is present +// to validate the changed function hash. +cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(cx_api_1.LAMBDA_RECOGNIZE_LAYER_VERSION)); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXV0b3NjYWxpbmcubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXV0b3NjYWxpbmcubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscUVBQXFFO0FBQ3JFLG1DQUFtQztBQUNuQywrQ0FBb0U7QUFDcEUsaURBQWlEO0FBRWpEOzs7O0VBS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blVwZ3JhZGUoTEFNQkRBX1JFQ09HTklaRV9MQVlFUl9WRVJTSU9OKSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/aws-lambda-autoscaling.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.file.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.ts new file mode 100644 index 0000000000000..b315365c88fcc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.autoscaling.lit.ts @@ -0,0 +1,58 @@ +import * as appscaling from 'aws-cdk-lib/aws-applicationautoscaling'; +import * as cdk from 'aws-cdk-lib'; +import { LAMBDA_RECOGNIZE_LAYER_VERSION } from 'aws-cdk-lib/cx-api'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +/** +* Stack verification steps: +* aws application-autoscaling describe-scalable-targets --service-namespace lambda --resource-ids function::prod +* has a minCapacity of 3 and maxCapacity of 50 +*/ +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new lambda.Function(this, 'MyLambda', { + code: new lambda.InlineCode('exports.handler = async () => { console.log(\'hello world\'); };'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.currentVersion; + + const alias = new lambda.Alias(this, 'Alias', { + aliasName: 'prod', + version, + }); + + const scalingTarget = alias.addAutoScaling({ minCapacity: 3, maxCapacity: 50 }); + + scalingTarget.scaleOnUtilization({ + utilizationTarget: 0.5, + }); + + scalingTarget.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, + }); + + scalingTarget.scaleOnSchedule('ScaleDownAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 20, + }); + + new cdk.CfnOutput(this, 'FunctionName', { + value: fn.functionName, + }); + } +} + +const app = new cdk.App(); + +const stack = new TestStack(app, 'aws-lambda-autoscaling'); + +// Changes the function description when the feature flag is present +// to validate the changed function hash. +cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(LAMBDA_RECOGNIZE_LAYER_VERSION)); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js new file mode 100644 index 0000000000000..dacbef53491f5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const lambda = require("aws-cdk-lib/aws-lambda"); +/** + * Stack verification steps: + * * aws cloudformation describe-stacks --stack-name cdk-integ-lambda-bundling-docker-bundling-opts --query Stacks[0].Outputs[0].OutputValue + * * aws lambda invoke --function-name response.json + * * cat response.json + * The last command should show '200' + */ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const assetPath = path.join(__dirname, 'python-lambda-handler'); + const fn = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(assetPath, { + bundling: { + image: lambda.Runtime.PYTHON_3_9.bundlingImage, + command: [ + 'bash', '-c', [ + 'cp -au . /asset-output', + 'cd /asset-output', + 'pip install -r requirements.txt -t .', + ].join(' && '), + ], + network: 'host', + }, + }), + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'index.handler', + }); + this.functionName = fn.functionName; + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'cdk-integ-lambda-bundling-docker-bundling-opts'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'DockerOptsBundling', { + testCases: [stack], + stackUpdateWorkflow: false, +}); +const invoke = integ.assertions.invokeFunction({ + functionName: stack.functionName, +}); +invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: '200', +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVuZGxpbmcuZG9ja2VyLW9wdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idW5kbGluZy5kb2NrZXItb3B0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3Qiw2Q0FBcUQ7QU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XG4gICAgICAgICAgXSxcbiAgICAgICAgICBuZXR3b3JrOiAnaG9zdCcsXG4gICAgICAgIH0sXG4gICAgICB9KSxcbiAgICAgIHJ1bnRpbWU6IGxhbWJkYS5SdW50aW1lLlBZVEhPTl8zXzksXG4gICAgICBoYW5kbGVyOiAnaW5kZXguaGFuZGxlcicsXG4gICAgfSk7XG5cbiAgICB0aGlzLmZ1bmN0aW9uTmFtZSA9IGZuLmZ1bmN0aW9uTmFtZTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBUZXN0U3RhY2soYXBwLCAnY2RrLWludGVnLWxhbWJkYS1idW5kbGluZy1kb2NrZXItYnVuZGxpbmctb3B0cycpO1xuXG5jb25zdCBpbnRlZyA9IG5ldyBJbnRlZ1Rlc3QoYXBwLCAnRG9ja2VyT3B0c0J1bmRsaW5nJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG4gIHN0YWNrVXBkYXRlV29ya2Zsb3c6IGZhbHNlLFxufSk7XG5cbmNvbnN0IGludm9rZSA9IGludGVnLmFzc2VydGlvbnMuaW52b2tlRnVuY3Rpb24oe1xuICBmdW5jdGlvbk5hbWU6IHN0YWNrLmZ1bmN0aW9uTmFtZSxcbn0pO1xuaW52b2tlLmV4cGVjdChFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgUGF5bG9hZDogJzIwMCcsXG59KSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk-integ-lambda-bundling-docker-bundling-opts.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.ts similarity index 90% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.ts index 37d7b70dc1f55..9d8cd16ea3b67 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.docker-opts.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as lambda from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; /** * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js new file mode 100644 index 0000000000000..720d02c193ad3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const lambda = require("aws-cdk-lib/aws-lambda"); +/** + * Stack verification steps: + * * aws cloudformation describe-stacks --stack-name cdk-integ-lambda-bundling --query Stacks[0].Outputs[0].OutputValue + * * aws lambda invoke --function-name response.json + * * cat response.json + * The last command should show '200' + */ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const assetPath = path.join(__dirname, 'python-lambda-handler'); + const fn = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(assetPath, { + bundling: { + image: lambda.Runtime.PYTHON_3_9.bundlingImage, + command: [ + 'bash', '-c', [ + 'cp -au . /asset-output', + 'cd /asset-output', + 'pip install -r requirements.txt -t .', + ].join(' && '), + ], + }, + }), + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'index.handler', + }); + this.functionName = fn.functionName; + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'cdk-integ-lambda-bundling'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'Bundling', { + testCases: [stack], + stackUpdateWorkflow: false, +}); +const invoke = integ.assertions.invokeFunction({ + functionName: stack.functionName, +}); +invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: '200', +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVuZGxpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idW5kbGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3Qiw2Q0FBcUQ7QUFDckQsa0VBQXVFO0FBRXZFLGlEQUFpRDtBQUVqRDs7Ozs7O0dBTUc7QUFDSCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUUzQixZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQU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tcbmNvbnN0IHN0YWNrID0gbmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctbGFtYmRhLWJ1bmRsaW5nJyk7XG5cbmNvbnN0IGludGVnID0gbmV3IEludGVnVGVzdChhcHAsICdCdW5kbGluZycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxuICBzdGFja1VwZGF0ZVdvcmtmbG93OiBmYWxzZSxcbn0pO1xuXG5jb25zdCBpbnZva2UgPSBpbnRlZy5hc3NlcnRpb25zLmludm9rZUZ1bmN0aW9uKHtcbiAgZnVuY3Rpb25OYW1lOiBzdGFjay5mdW5jdGlvbk5hbWUsXG59KTtcbmludm9rZS5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIFBheWxvYWQ6ICcyMDAnLFxufSkpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/BundlingDefaultTestDeployAssertAACA0CAF.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/asset.84802aa01d2d2c9e7d8d69705ee832c97f1ebad2d73c72be5c32d53f16cf90a7.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/cdk-integ-lambda-bundling.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.ts similarity index 89% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.ts index 6e22153aff953..fdfad0fb71ae8 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.bundling.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.bundling.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as lambda from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; /** * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js new file mode 100644 index 0000000000000..da35e907cab3e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cx_api_1 = require("aws-cdk-lib/cx-api"); +const lambda = require("aws-cdk-lib/aws-lambda"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const handler = new lambda.Function(this, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'layer-code')), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_8, + currentVersionOptions: { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.RETAIN, + retryAttempts: 1, + }, + }); + handler.currentVersion.addAlias('live'); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'lambda-test-current-version'); +// Changes the function description when the feature flag is present +// to validate the changed function hash. +aws_cdk_lib_1.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(cx_api_1.LAMBDA_RECOGNIZE_LAYER_VERSION)); +app.synth(); +//# sourceMappingURL=data:application/json;base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N1cnJlbnRWZXJzaW9uLmFkZEFsaWFzKCdsaXZlJyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5jb25zdCBzdGFjayA9IG5ldyBUZXN0U3RhY2soYXBwLCAnbGFtYmRhLXRlc3QtY3VycmVudC12ZXJzaW9uJyk7XG5cbi8vIENoYW5nZXMgdGhlIGZ1bmN0aW9uIGRlc2NyaXB0aW9uIHdoZW4gdGhlIGZlYXR1cmUgZmxhZyBpcyBwcmVzZW50XG4vLyB0byB2YWxpZGF0ZSB0aGUgY2hhbmdlZCBmdW5jdGlvbiBoYXNoLlxuQXNwZWN0cy5vZihzdGFjaykuYWRkKG5ldyBsYW1iZGEuRnVuY3Rpb25WZXJzaW9uVXBncmFkZShMQU1CREFfUkVDT0dOSVpFX0xBWUVSX1ZFUlNJT04pKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.docker-opts.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/lambda-test-current-version.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.ts similarity index 81% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.ts index 441f687d7d0cc..4657cca294b12 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.current-version.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.current-version.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Aspects, App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { LAMBDA_RECOGNIZE_LAYER_VERSION } from '@aws-cdk/cx-api'; -import * as lambda from '../lib'; +import { Aspects, App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { LAMBDA_RECOGNIZE_LAYER_VERSION } from 'aws-cdk-lib/cx-api'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; class TestStack extends Stack { constructor(scope: App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js new file mode 100644 index 0000000000000..b94d87691067b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +class StackUnderTest extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new aws_lambda_1.Function(this, 'MyFunc1', { + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: aws_lambda_1.Code.fromInline(`exports.handler = ${handler.toString()}`), + architecture: props.architecture, + adotInstrumentation: { + layerVersion: aws_lambda_1.AdotLayerVersion.fromJavaScriptSdkLayerVersion(aws_lambda_1.AdotLambdaLayerJavaScriptSdkVersion.LATEST), + execWrapper: aws_lambda_1.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }); + new aws_lambda_1.Function(this, 'MyFunc2', { + runtime: aws_lambda_1.Runtime.PYTHON_3_9, + handler: 'index.handler', + code: aws_lambda_1.Code.fromInline('def handler(event, context): pass'), + adotInstrumentation: { + layerVersion: aws_lambda_1.AdotLayerVersion.fromPythonSdkLayerVersion(aws_lambda_1.AdotLambdaLayerPythonSdkVersion.LATEST), + execWrapper: aws_lambda_1.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }); + new aws_lambda_1.Function(this, 'MyFunc3', { + runtime: aws_lambda_1.Runtime.PYTHON_3_9, + handler: 'index.handler', + code: aws_lambda_1.Code.fromInline('def handler(event, context): pass'), + adotInstrumentation: { + layerVersion: aws_lambda_1.AdotLayerVersion.fromJavaSdkLayerVersion(aws_lambda_1.AdotLambdaLayerJavaSdkVersion.LATEST), + execWrapper: aws_lambda_1.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }); + new aws_lambda_1.Function(this, 'MyFunc4', { + runtime: aws_lambda_1.Runtime.PYTHON_3_9, + handler: 'index.handler', + code: aws_lambda_1.Code.fromInline('def handler(event, context): pass'), + adotInstrumentation: { + layerVersion: aws_lambda_1.AdotLayerVersion.fromJavaAutoInstrumentationLayerVersion(aws_lambda_1.AdotLambdaLayerJavaAutoInstrumentationVersion.LATEST), + execWrapper: aws_lambda_1.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }); + new aws_lambda_1.Function(this, 'MyFunc5', { + runtime: aws_lambda_1.Runtime.PYTHON_3_9, + handler: 'index.handler', + code: aws_lambda_1.Code.fromInline('def handler(event, context): pass'), + adotInstrumentation: { + layerVersion: aws_lambda_1.AdotLayerVersion.fromGenericLayerVersion(aws_lambda_1.AdotLambdaLayerGenericVersion.LATEST), + execWrapper: aws_lambda_1.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }); + } +} +/* eslint-disable no-console */ +function handler(event, _context, callback) { + console.log(JSON.stringify(event, undefined, 2)); + return callback(); +} +new integ_tests_alpha_1.IntegTest(app, 'IntegTest', { + testCases: [ + new StackUnderTest(app, 'Stack1', { + architecture: aws_lambda_1.Architecture.ARM_64, + }), + new StackUnderTest(app, 'Stack2', { + architecture: aws_lambda_1.Architecture.X86_64, + }), + ], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWFkb3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5sYW1iZGEtYWRvdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFFdkQsNkNBQWdEO0FBQ2hELHVEQVlnQztBQUVoQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQU0xQixNQUFNLGNBQWUsU0FBUSxtQkFBSztJQUNoQyxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQTBCO1FBQ2xFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLElBQUkscUJBQVEsQ0FBQyxJQUFJLEVB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YWxsYmFjazogYW55KSB7XG4gIGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50LCB1bmRlZmluZWQsIDIpKTtcbiAgcmV0dXJuIGNhbGxiYWNrKCk7XG59XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnSW50ZWdUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtcbiAgICBuZXcgU3RhY2tVbmRlclRlc3QoYXBwLCAnU3RhY2sxJywge1xuICAgICAgYXJjaGl0ZWN0dXJlOiBBcmNoaXRlY3R1cmUuQVJNXzY0LFxuICAgIH0pLFxuICAgIG5ldyBTdGFja1VuZGVyVGVzdChhcHAsICdTdGFjazInLCB7XG4gICAgICBhcmNoaXRlY3R1cmU6IEFyY2hpdGVjdHVyZS5YODZfNjQsXG4gICAgfSksXG4gIF0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack1.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/Stack2.template.json diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.ts similarity index 94% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.ts index 0dad219ddf1d5..f5a8e1839bd8c 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-adot.ts @@ -1,7 +1,7 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { StackProps, Stack } from '../../core/lib/stack'; +import { StackProps, Stack } from 'aws-cdk-lib'; import { AdotLambdaLayerPythonSdkVersion, AdotLambdaLayerJavaSdkVersion, @@ -14,7 +14,7 @@ import { Function, Runtime, AdotLayerVersion, -} from '../lib'; +} from 'aws-cdk-lib/aws-lambda'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js new file mode 100644 index 0000000000000..152c2acc9fa1a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-lambda-customize-roles'); +iam.Role.customizeRoles(stack, { + usePrecreatedRoles: { + 'integ-lambda-customize-roles/MyLambda/ServiceRole': 'precreated-role', + }, +}); +const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const bucket = new aws_s3_1.Bucket(stack, 'Bucket'); +bucket.grantRead(fn); +/** + * This test will not deploy and is only used to provide an example + * of the synthesized iam policy report + */ +new integ_tests_alpha_1.IntegTest(app, 'IntegTest', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + enabled: false, + }, + destroy: { + enabled: false, + }, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWN1c3RvbWl6ZS1yb2xlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxhbWJkYS1jdXN0b21pemUtcm9sZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsK0NBQTRDO0FBQzVDLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsaURBQWlEO0FBRWpELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsOEJBQThCLENBQUMsQ0FBQztBQUNqRSxHQUFHLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxLQUFLLEVBQUU7SUFDN0Isa0JBQWtCLEVBQUU7UUFDbEIsbURBQW1ELEVBQUUsaUJBQWlCO0tBQ3ZFO0NBQ0YsQ0FBQyxDQUFDO0FBRUgsTUFBTSxFQUFFLEdBQUcsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDaEQsSUFBSSxFQUFFLElBQUksTUFBTSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUM7SUFDbEMsT0FBTyxFQUFFLGVB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y1sYW1iZGEtY3VzdG9taXplLXJvbGVzL015TGFtYmRhL1NlcnZpY2VSb2xlJzogJ3ByZWNyZWF0ZWQtcm9sZScsXG4gIH0sXG59KTtcblxuY29uc3QgZm4gPSBuZXcgbGFtYmRhLkZ1bmN0aW9uKHN0YWNrLCAnTXlMYW1iZGEnLCB7XG4gIGNvZGU6IG5ldyBsYW1iZGEuSW5saW5lQ29kZSgnZm9vJyksXG4gIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG59KTtcblxuY29uc3QgYnVja2V0ID0gbmV3IEJ1Y2tldChzdGFjaywgJ0J1Y2tldCcpO1xuYnVja2V0LmdyYW50UmVhZChmbik7XG5cbi8qKlxuICogVGhpcyB0ZXN0IHdpbGwgbm90IGRlcGxveSBhbmQgaXMgb25seSB1c2VkIHRvIHByb3ZpZGUgYW4gZXhhbXBsZVxuICogb2YgdGhlIHN5bnRoZXNpemVkIGlhbSBwb2xpY3kgcmVwb3J0XG4gKi9cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnSW50ZWdUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG4gIGNka0NvbW1hbmRPcHRpb25zOiB7XG4gICAgZGVwbG95OiB7XG4gICAgICBlbmFibGVkOiBmYWxzZSxcbiAgICB9LFxuICAgIGRlc3Ryb3k6IHtcbiAgICAgIGVuYWJsZWQ6IGZhbHNlLFxuICAgIH0sXG4gIH0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.bundling.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.txt similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/iam-policy-report.txt diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ-lambda-customize-roles.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.ts similarity index 76% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.ts index c16f330d0c841..654eb108e2ef8 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-customize-roles.ts @@ -1,8 +1,8 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Bucket } from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as lambda from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-lambda-customize-roles'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js new file mode 100644 index 0000000000000..086f015004e07 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'stack'); +new lambda.Function(stack, 'MyFunc1', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_54_0, +}); +new lambda.Function(stack, 'MyFunc2', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_86_0, +}); +new lambda.Function(stack, 'MyFunc3', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_89_0, +}); +new lambda.Function(stack, 'MyFunc4', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_98_0, +}); +new lambda.Function(stack, 'MyFunc5', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_119_0, +}); +new lambda.Function(stack, 'MyFunc6', { + runtime: lambda.Runtime.NODEJS_14_X, + architecture: lambda.Architecture.ARM_64, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + insightsVersion: lambda.LambdaInsightsVersion.VERSION_1_0_119_0, +}); +app.synth(); +/* eslint-disable no-console */ +function handler(event, _context, callback) { + console.log(JSON.stringify(event, undefined, 2)); + return callback(); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLWluc2lnaHRzLW1hcHBpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5sYW1iZGEtaW5zaWdodHMtbWFwcGluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxpREFBaUQ7QUFFakQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQztBQUUxQyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRTtJQUNwQyxPQUFPLEVBQUUsTUFBTSxDQUFDLE9BQU8sQ0FBQyxXQUFXO0lBQ25DLE9BQU8sRUFBRSxlQUFlO0lBQ3hCLElBQUksRUFBRSxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxxQkFBcUIsT0FBTyxDQUFDLFFBQVEsRUFBRSxFQUFFLENBQUM7SUFDdkUsZUFBZSxFQUFFLE1BQU0sQ0FBQyxxQkFBcUIsQ0FBQyxnQkFBZ0I7Q0FDL0QsQ0FBQyxDQUFDO0FBRUgsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUU7SUFDcEMsT0FBTyxF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W5kbGVyLnRvU3RyaW5nKCl9YCksXG4gIGluc2lnaHRzVmVyc2lvbjogbGFtYmRhLkxhbWJkYUluc2lnaHRzVmVyc2lvbi5WRVJTSU9OXzFfMF8xMTlfMCxcbn0pO1xuXG5hcHAuc3ludGgoKTtcblxuLyogZXNsaW50LWRpc2FibGUgbm8tY29uc29sZSAqL1xuZnVuY3Rpb24gaGFuZGxlcihldmVudDogYW55LCBfY29udGV4dDogYW55LCBjYWxsYmFjazogYW55KSB7XG4gIGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50LCB1bmRlZmluZWQsIDIpKTtcbiAgcmV0dXJuIGNhbGxiYWNrKCk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/stack.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.ts similarity index 95% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.ts index 8fce7e06fdd97..dee643c44c8e9 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda-insights-mapping.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js new file mode 100644 index 0000000000000..daca52a72ee9b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'lambda-ecr-docker-arm64'); +new aws_lambda_1.DockerImageFunction(stack, 'MyLambda', { + code: aws_lambda_1.DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')), + architecture: aws_lambda_1.Architecture.ARM_64, +}); +new integ.IntegTest(app, 'lambda-docker-arm64', { + testCases: [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CBEb2NrZXJJbWFnZUNvZGUsIERvY2tlckltYWdlRnVuY3Rpb24gfSBmcm9tICdhd3MtY2RrLWxpYi9hd3MtbGFtYmRhJztcblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5jb25zdCBzdGFjayA9IG5ldyBTdGFjayhhcHAsICdsYW1iZGEtZWNyLWRvY2tlci1hcm02NCcpO1xuXG5uZXcgRG9ja2VySW1hZ2VGdW5jdGlvbihzdGFjaywgJ015TGFtYmRhJywge1xuICBjb2RlOiBEb2NrZXJJbWFnZUNvZGUuZnJvbUltYWdlQXNzZXQocGF0aC5qb2luKF9fZGlybmFtZSwgJ2RvY2tlci1hcm02NC1oYW5kbGVyJykpLFxuICBhcmNoaXRlY3R1cmU6IEFyY2hpdGVjdHVyZS5BUk1fNjQsXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdsYW1iZGEtZG9ja2VyLWFybTY0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/Dockerfile diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/index.py similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/asset.027b9b499ce9e488d4c3cfa41abdbdc6afe203989a5bd77258f471da03f3f040/index.py diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-customize-roles.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambda-ecr-docker-arm64.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/lambdadockerarm64DefaultTestDeployAssert07D408EF.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.ts similarity index 77% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.ts index b567e9b5733fc..7e539f672aabe 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker-arm64.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Architecture, DockerImageCode, DockerImageFunction } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Architecture, DockerImageCode, DockerImageFunction } from 'aws-cdk-lib/aws-lambda'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js new file mode 100644 index 0000000000000..d3ee02ca6e6f6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + this.fn = new aws_lambda_1.DockerImageFunction(this, 'MyLambda', { + code: aws_lambda_1.DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-lambda-handler')), + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testStack = new TestStack(app, 'lambda-ecr-docker'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'integ', { + testCases: [testStack], +}); +const invoke = integ.assertions.invokeFunction({ + functionName: testStack.fn.functionName, +}); +invoke.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Payload: integ_tests_alpha_1.Match.serializedJson({ statusCode: 200 }), +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLmRvY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxhbWJkYS5kb2NrZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsNkNBQXlDO0FBQ3pDLGtFQUE4RTtBQUM5RSx1REFBd0Y7QUF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XhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIFBheWxvYWQ6IE1hdGNoLnNlcmlhbGl6ZWRKc29uKHsgc3RhdHVzQ29kZTogMjAwIH0pLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.0ac341521855ed4705d41029b27ada812d7667cb8dcd05598acd18d5cc96b5a0.bundle/index.js diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/Dockerfile diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/asset.768d7b6c1d41b85135f498fe0cca69fea410be3c3322c69cf08690aaad29a610/app.ts diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.s3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/integDefaultTestDeployAssert946684A0.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/lambda-ecr-docker.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.ts similarity index 90% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.ts index 2cacbc8a27989..cca2bb941b73e 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.docker.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { App, Stack } from '@aws-cdk/core'; -import { ExpectedResult, IntegTest, Match } from '@aws-cdk/integ-tests'; -import { DockerImageCode, DockerImageFunction, Function } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest, Match } from '@aws-cdk/integ-tests-alpha'; +import { DockerImageCode, DockerImageFunction, Function } from 'aws-cdk-lib/aws-lambda'; class TestStack extends Stack { public fn: Function diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js new file mode 100644 index 0000000000000..d5f34f0a1fcd6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const efs = require("aws-cdk-lib/aws-efs"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-lambda-1'); +const vpc = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 3, + natGateways: 1, +}); +const fileSystem = new efs.FileSystem(stack, 'Efs', { + vpc, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +// create an access point and expose the root of the filesystem +const accessPoint = fileSystem.addAccessPoint('AccessPoint', { + createAcl: { + ownerGid: '1001', + ownerUid: '1001', + permissions: '750', + }, + path: '/export/lambda', + posixUser: { + gid: '1001', + uid: '1001', + }, +}); +const lambdaCode = new lambda.InlineCode(` +import json +import os +import string +import random +import datetime + +MSG_FILE_PATH = '/mnt/msg/content' + +def randomString(stringLength=10): + letters = string.ascii_lowercase + return ''.join(random.choice(letters) for i in range(stringLength)) + +def lambda_handler(event, context): + with open(MSG_FILE_PATH, 'a') as f: + f.write(f"{datetime.datetime.utcnow():%Y-%m-%d-%H:%M:%S} " + randomString(5) + ' ') + + file = open(MSG_FILE_PATH, "r") + file_content = file.read() + file.close() + + return { + 'statusCode': 200, + 'body': str(file_content) + } +`); +// this function will mount the access point to '/mnt/msg' and write content onto /mnt/msg/content +const lambda1 = new lambda.Function(stack, 'MyLambda', { + code: lambdaCode, + handler: 'index.lambda_handler', + runtime: lambda.Runtime.PYTHON_3_7, + vpc, + filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), +}); +let importedFileSystem = efs.FileSystem.fromFileSystemAttributes(stack, 'fileSystemImported', { + fileSystemId: fileSystem.fileSystemId, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'securityGroup', fileSystem.connections.securityGroups[0].securityGroupId), +}); +let importedAccessPoint = efs.AccessPoint.fromAccessPointAttributes(stack, 'AccessPointImported', { + accessPointId: accessPoint.accessPointId, + fileSystem: importedFileSystem, +}); +// this function will mount the access point to '/mnt/msg' and write content onto /mnt/msg/content +const lambda2 = new lambda.Function(stack, 'MyLambda2', { + code: lambdaCode, + handler: 'index.lambda_handler', + runtime: lambda.Runtime.PYTHON_3_7, + vpc, + filesystem: lambda.FileSystem.fromEfsAccessPoint(importedAccessPoint, '/mnt/msg'), +}); +// lambda2 doesn't have dependencies on MountTargets because the fileSystem is imported. +// Ideally, lambda2 would be deployed in another stack but integ doesn't support it. +// We are adding a dependency on the first lambda to simulate this situation. +lambda2.node.addDependency(lambda1); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLmZpbGVzeXN0ZW0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5sYW1iZGEuZmlsZXN5c3RlbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLGlEQUFpRDtBQUVqRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGtCQUFrQixDQUFDLENBQUM7QUFHckQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUU7SUFDcEMsTUFBTSxFQUFFLENBQUM7SUFDVCxXQUFXLEVBQUUsQ0FBQztDQUNmLENBQUMsQ0FBQztBQUVILE1BQU0sVUFBVSxHQUFHLElBQUksR0FBRyxDQUFDLFVBQVUsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO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GFtYmRhLkZpbGVTeXN0ZW0uZnJvbUVmc0FjY2Vzc1BvaW50KFxuICAgIGltcG9ydGVkQWNjZXNzUG9pbnQsXG4gICAgJy9tbnQvbXNnJyxcbiAgKSxcbn0pO1xuXG4vLyBsYW1iZGEyIGRvZXNuJ3QgaGF2ZSBkZXBlbmRlbmNpZXMgb24gTW91bnRUYXJnZXRzIGJlY2F1c2UgdGhlIGZpbGVTeXN0ZW0gaXMgaW1wb3J0ZWQuXG4vLyBJZGVhbGx5LCBsYW1iZGEyIHdvdWxkIGJlIGRlcGxveWVkIGluIGFub3RoZXIgc3RhY2sgYnV0IGludGVnIGRvZXNuJ3Qgc3VwcG9ydCBpdC5cbi8vIFdlIGFyZSBhZGRpbmcgYSBkZXBlbmRlbmN5IG9uIHRoZSBmaXJzdCBsYW1iZGEgdG8gc2ltdWxhdGUgdGhpcyBzaXR1YXRpb24uXG5sYW1iZGEyLm5vZGUuYWRkRGVwZW5kZW5jeShsYW1iZGExKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/aws-cdk-lambda-1.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.ts similarity index 93% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.ts index c9441c1cd0a52..539e6930381c1 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.filesystem.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.filesystem.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as efs from 'aws-cdk-lib/aws-efs'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js new file mode 100644 index 0000000000000..1185f42ff20f5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const cx_api_1 = require("aws-cdk-lib/cx-api"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-lambda-1'); +const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +fn.addToRolePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['*'], +})); +fn.addFunctionUrl(); +const version = fn.currentVersion; +const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version, +}); +alias.addPermission('AliasPermission', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), +}); +alias.addFunctionUrl({ + authType: lambda.FunctionUrlAuthType.NONE, +}); +// Changes the function description when the feature flag is present +// to validate the changed function hash. +cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(cx_api_1.LAMBDA_RECOGNIZE_LAYER_VERSION)); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGFtYmRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywrQ0FBb0U7QUFDcEUsaURBQWlEO0FBRWpELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsa0JBQWtCLENBQUMsQ0FBQztBQUVyRCxNQUFNLEVBQUUsR0FBRyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUNoRCxJQUFJLEVBQUUsSUFBSSxNQUFNLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQztJQUNsQyxPQUFPLEVBQUUsZUFBZTtJQUN4QixPQUFPLEVBQUUsTUFBTSxDQUFDLE9BQU8sQ0FBQyxXQUFXO0NBQ3BDLENBQUMsQ0FBQztBQUVILEVBQUUsQ0FBQyxlQUFlLENBQUMsSUFBSSxHQUFHLENBQUMsZUFBZSxDQUFDO0lBQ3pDLFNBQVMsRUFBRSxDQUFDLEdBQUcsQ0FBQztJQUNoQixPQUFPLEVBQUUsQ0FBQyxHQUFHLENBQUM7Q0FDZixDQUFDLENBQUMsQ0FBQztBQUNKLEVBQUUsQ0FBQyxjQUFjLEVBQUUsQ0FBQztBQUVwQixNQUFNLE9BQU8sR0FBRyxFQUFFLENBQUMsY0FBYyx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TEFZRVJfVkVSU0lPTikpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/aws-cdk-lambda-1.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-insights-mapping.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js new file mode 100644 index 0000000000000..313faad08903e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const cx_api_1 = require("aws-cdk-lib/cx-api"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-lambda-pce-1'); +const lambdaCode = 'exports.handler = async function(event, context) { ' + + 'console.log("Hello from CDK! with #type# Provisioned Concurrent Exec!");}'; +const pce = 5; +// Integration test for provisioned concurrent execution via Alias +const fn = new lambda.Function(stack, 'MyLambdaAliasPCE', { + code: new lambda.InlineCode(lambdaCode.replace('#type#', 'Alias')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +fn.addToRolePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['*'], +})); +const version = fn.currentVersion; +const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version, + provisionedConcurrentExecutions: pce, +}); +alias.addPermission('AliasPermission', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), +}); +// Integration test for provisioned concurrent execution via Version +const fnVersionPCE = new lambda.Function(stack, 'MyLambdaVersionPCE', { + code: new lambda.InlineCode(lambdaCode.replace('#type#', 'Version')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + currentVersionOptions: { + provisionedConcurrentExecutions: pce, + }, +}); +fnVersionPCE.addToRolePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['*'], +})); +const version2 = fnVersionPCE.currentVersion; +const alias2 = new lambda.Alias(stack, 'Alias2', { + aliasName: 'prod', + version: version2, +}); +alias2.addPermission('AliasPermission2', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), +}); +// Changes the function description when the feature flag is present +// to validate the changed function hash. +cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(cx_api_1.LAMBDA_RECOGNIZE_LAYER_VERSION)); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLnByb3YuY29uY3VycmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxhbWJkYS5wcm92LmNvbmN1cnJlbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLCtDQUFvRTtBQUNwRSxpREFBaUQ7QUFFakQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRy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uICAgIHByb3Zpc2lvbmVkQ29uY3VycmVudEV4ZWN1dGlvbnM6IHBjZSxcbiAgfSxcbn0pO1xuXG5mblZlcnNpb25QQ0UuYWRkVG9Sb2xlUG9saWN5KG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgcmVzb3VyY2VzOiBbJyonXSxcbiAgYWN0aW9uczogWycqJ10sXG59KSk7XG5cbmNvbnN0IHZlcnNpb24yID0gZm5WZXJzaW9uUENFLmN1cnJlbnRWZXJzaW9uO1xuXG5jb25zdCBhbGlhczIgPSBuZXcgbGFtYmRhLkFsaWFzKHN0YWNrLCAnQWxpYXMyJywge1xuICBhbGlhc05hbWU6ICdwcm9kJyxcbiAgdmVyc2lvbjogdmVyc2lvbjIsXG59KTtcblxuYWxpYXMyLmFkZFBlcm1pc3Npb24oJ0FsaWFzUGVybWlzc2lvbjInLCB7XG4gIHByaW5jaXBhbDogbmV3IGlhbS5TZXJ2aWNlUHJpbmNpcGFsKCdjbG91ZGZvcm1hdGlvbi5hbWF6b25hd3MuY29tJyksXG59KTtcblxuLy8gQ2hhbmdlcyB0aGUgZnVuY3Rpb24gZGVzY3JpcHRpb24gd2hlbiB0aGUgZmVhdHVyZSBmbGFnIGlzIHByZXNlbnRcbi8vIHRvIHZhbGlkYXRlIHRoZSBjaGFuZ2VkIGZ1bmN0aW9uIGhhc2guXG5jZGsuQXNwZWN0cy5vZihzdGFjaykuYWRkKG5ldyBsYW1iZGEuRnVuY3Rpb25WZXJzaW9uVXBncmFkZShMQU1CREFfUkVDT0dOSVpFX0xBWUVSX1ZFUlNJT04pKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/aws-cdk-lambda-pce-1.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker-arm64.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.ts similarity index 90% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.ts index a0d576926ded7..98866c52ce1e6 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.prov.concurrent.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { LAMBDA_RECOGNIZE_LAYER_VERSION } from '@aws-cdk/cx-api'; -import * as lambda from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { LAMBDA_RECOGNIZE_LAYER_VERSION } from 'aws-cdk-lib/cx-api'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.ts new file mode 100644 index 0000000000000..5e441fd1f6228 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.lambda.ts @@ -0,0 +1,39 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { LAMBDA_RECOGNIZE_LAYER_VERSION } from 'aws-cdk-lib/cx-api'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-lambda-1'); + +const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); + +fn.addToRolePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['*'], +})); +fn.addFunctionUrl(); + +const version = fn.currentVersion; + +const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version, +}); +alias.addPermission('AliasPermission', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), +}); +alias.addFunctionUrl({ + authType: lambda.FunctionUrlAuthType.NONE, +}); + +// Changes the function description when the feature flag is present +// to validate the changed function hash. +cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(LAMBDA_RECOGNIZE_LAYER_VERSION)); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js new file mode 100644 index 0000000000000..b46f626d6610e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-layer-version-1'); +// Just for the example - granting to the current account is not necessary. +const awsAccountId = stack.account; +/// !show +const layer = new lambda.LayerVersion(stack, 'MyLayer', { + code: lambda.Code.fromAsset(path.join(__dirname, 'layer-code')), + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + license: 'Apache-2.0', + description: 'A layer to test the L2 construct', +}); +// To grant usage by other AWS accounts +layer.addPermission('remote-account-grant', { accountId: awsAccountId }); +// To grant usage to all accounts in some AWS Ogranization +// layer.grantUsage({ accountId: '*', organizationId }); +new lambda.Function(stack, 'MyLayeredLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + layers: [layer], +}); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGF5ZXItdmVyc2lvbi5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5sYXllci12ZXJzaW9uLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QixtQ0FBbUM7QUFDbkMsaURBQWlEO0FBRWpELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUseUJBQXlCLENBQUMsQ0FBQztBQUU1RCwyRUFBMkU7QUFDM0UsTUFBTSxZQUFZLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQztBQUVuQyxTQUFTO0FBQ1QsTUFBTSxLQUFLLEdBQUcsSUFBSSxNQUFNLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUU7SUFDdEQsSUFBSSxFQUFF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LyAhaGlkZVxuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.ts diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/aws-cdk-layer-version-1.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.ts new file mode 100644 index 0000000000000..6ded43147af09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.layer-version.lit.ts @@ -0,0 +1,34 @@ +import * as path from 'path'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-layer-version-1'); + +// Just for the example - granting to the current account is not necessary. +const awsAccountId = stack.account; + +/// !show +const layer = new lambda.LayerVersion(stack, 'MyLayer', { + code: lambda.Code.fromAsset(path.join(__dirname, 'layer-code')), + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + license: 'Apache-2.0', + description: 'A layer to test the L2 construct', +}); + +// To grant usage by other AWS accounts +layer.addPermission('remote-account-grant', { accountId: awsAccountId }); + +// To grant usage to all accounts in some AWS Ogranization +// layer.grantUsage({ accountId: '*', organizationId }); + +new lambda.Function(stack, 'MyLayeredLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + layers: [layer], +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js new file mode 100644 index 0000000000000..8adbc484bb1c6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const logs = require("aws-cdk-lib/aws-logs"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-lambda-log-retention'); +new lambda.Function(stack, 'OneWeek', { + code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: logs.RetentionDays.ONE_WEEK, +}); +new lambda.Function(stack, 'OneMonth', { + code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: logs.RetentionDays.ONE_MONTH, +}); +new lambda.Function(stack, 'OneYear', { + code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: logs.RetentionDays.ONE_YEAR, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubG9nLXJldGVudGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxvZy1yZXRlbnRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBNkM7QUFDN0MsbUNBQW1DO0FBQ25DLGlEQUFpRDtBQUVqRCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDhCQUE4QixDQUFDLENBQUM7QUFFakUsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxTQUFTLEVBQUU7SUFDcEMsSUFBSSxFQUFFLElBQUksTUFBTSxDQUFDLFVBQVUsQ0FBQyxrRUFBa0UsQ0FBQztJQUMvRixPQUFPLEVBQUUsZUFBZTtJQUN4QixPQUFPLEVBQUUsTUFBTSxDQUFDLE9BQU8sQ0FBQyxXQUFXO0lBQ25DLFlBQVksRUFBRSxJQUFJLENBQUMsYUFBYSxDQUFDLFFBQVE7Q0FDMUMsQ0FBQyxDQUFDO0FBRUgsSUFBSSxNQUFNLENBQUMsUUFBUSx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gPSAoZXZlbnQpID0+IGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50KSk7JyksXG4gIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gIGxvZ1JldGVudGlvbjogbG9ncy5SZXRlbnRpb25EYXlzLk9ORV9XRUVLLFxufSk7XG5cbm5ldyBsYW1iZGEuRnVuY3Rpb24oc3RhY2ssICdPbmVNb250aCcsIHtcbiAgY29kZTogbmV3IGxhbWJkYS5JbmxpbmVDb2RlKCdleHBvcnRzLmhhbmRsZXIgPSAoZXZlbnQpID0+IGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50KSk7JyksXG4gIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gIGxvZ1JldGVudGlvbjogbG9ncy5SZXRlbnRpb25EYXlzLk9ORV9NT05USCxcbn0pO1xuXG5uZXcgbGFtYmRhLkZ1bmN0aW9uKHN0YWNrLCAnT25lWWVhcicsIHtcbiAgY29kZTogbmV3IGxhbWJkYS5JbmxpbmVDb2RlKCdleHBvcnRzLmhhbmRsZXIgPSAoZXZlbnQpID0+IGNvbnNvbGUubG9nKEpTT04uc3RyaW5naWZ5KGV2ZW50KSk7JyksXG4gIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gIGxvZ1JldGVudGlvbjogbG9ncy5SZXRlbnRpb25EYXlzLk9ORV9ZRUFSLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/aws-cdk-lambda-log-retention.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.prov.concurrent.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.ts new file mode 100644 index 0000000000000..b2e268847847a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.log-retention.ts @@ -0,0 +1,30 @@ +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-lambda-log-retention'); + +new lambda.Function(stack, 'OneWeek', { + code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: logs.RetentionDays.ONE_WEEK, +}); + +new lambda.Function(stack, 'OneMonth', { + code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: logs.RetentionDays.ONE_MONTH, +}); + +new lambda.Function(stack, 'OneYear', { + code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + logRetention: logs.RetentionDays.ONE_YEAR, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js new file mode 100644 index 0000000000000..c46359adc5166 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-permissions'); +const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +fn.grantInvoke(new iam.AnyPrincipal().inOrganization('o-yyyyyyyyyy')); +fn.grantInvoke(new iam.OrganizationPrincipal('o-xxxxxxxxxx')); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGVybWlzc2lvbnMuanMiLCJzb3VyY2VSb290Ijoi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CwgJ2xhbWJkYS1wZXJtaXNzaW9ucycpO1xuXG5jb25zdCBmbiA9IG5ldyBsYW1iZGEuRnVuY3Rpb24oc3RhY2ssICdNeUxhbWJkYScsIHtcbiAgY29kZTogbmV3IGxhbWJkYS5JbmxpbmVDb2RlKCdmb28nKSxcbiAgaGFuZGxlcjogJ2luZGV4LmhhbmRsZXInLFxuICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5OT0RFSlNfMTRfWCxcbn0pO1xuXG5mbi5ncmFudEludm9rZShuZXcgaWFtLkFueVByaW5jaXBhbCgpLmluT3JnYW5pemF0aW9uKCdvLXl5eXl5eXl5eXknKSk7XG5cbmZuLmdyYW50SW52b2tlKG5ldyBpYW0uT3JnYW5pemF0aW9uUHJpbmNpcGFsKCdvLXh4eHh4eHh4eHgnKSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/lambda-permissions.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.ts new file mode 100644 index 0000000000000..80ef825fa5fab --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.permissions.ts @@ -0,0 +1,17 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'lambda-permissions'); + +const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); + +fn.grantInvoke(new iam.AnyPrincipal().inOrganization('o-yyyyyyyyyy')); + +fn.grantInvoke(new iam.OrganizationPrincipal('o-xxxxxxxxxx')); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js new file mode 100644 index 0000000000000..00ac4504347bf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-lambda-runtime-management'); +new aws_lambda_1.Function(stack, 'Lambda', { + code: new aws_lambda_1.InlineCode('foo'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.NODEJS_18_X, + runtimeManagementMode: aws_lambda_1.RuntimeManagementMode.AUTO, +}); +new integ.IntegTest(app, 'lambda-runtime-management', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVudGltZS1tYW5hZ2VtZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucnVudGltZS1tYW5hZ2VtZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FB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Y2ssICdMYW1iZGEnLCB7XG4gIGNvZGU6IG5ldyBJbmxpbmVDb2RlKCdmb28nKSxcbiAgaGFuZGxlcjogJ2luZGV4LmhhbmRsZXInLFxuICBydW50aW1lOiBSdW50aW1lLk5PREVKU18xOF9YLFxuICBydW50aW1lTWFuYWdlbWVudE1vZGU6IFJ1bnRpbWVNYW5hZ2VtZW50TW9kZS5BVVRPLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnbGFtYmRhLXJ1bnRpbWUtbWFuYWdlbWVudCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/aws-cdk-lambda-runtime-management.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/lambdaruntimemanagementDefaultTestDeployAssertDE680AF3.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.ts similarity index 77% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime-management.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.ts index cc0682721f4ed..865d3d56635b4 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.runtime-management.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime-management.ts @@ -1,6 +1,6 @@ -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Function, InlineCode, Runtime, RuntimeManagementMode } from '../lib'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Function, InlineCode, Runtime, RuntimeManagementMode } from 'aws-cdk-lib/aws-lambda'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js new file mode 100644 index 0000000000000..ffc8859999159 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +// CloudFormation supports InlineCode only for a subset of runtimes. This integration test +// is used to verify that the ones marked in the CDK are in fact supported by CloudFormation. +// Running `cdk deploy` on this stack will confirm if all the runtimes here are supported. +// +// To verify that the lambda function works correctly, use the function names that are part +// of the stack output (printed on the console at the end of 'cdk deploy') and run the command - +// aws lambda invoke --function-name +// +// If successful, the output will contain "success" +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-lambda-runtime-inlinecode'); +const python37 = new aws_lambda_1.Function(stack, 'PYTHON_3_7', { + code: new aws_lambda_1.InlineCode('def handler(event, context):\n return "success"'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.PYTHON_3_7, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'PYTHON_3_7-functionName', { value: python37.functionName }); +const python38 = new aws_lambda_1.Function(stack, 'PYTHON_3_8', { + code: new aws_lambda_1.InlineCode('def handler(event, context):\n return "success"'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.PYTHON_3_8, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'PYTHON_3_8-functionName', { value: python38.functionName }); +const python39 = new aws_lambda_1.Function(stack, 'PYTHON_3_9', { + code: new aws_lambda_1.InlineCode('def handler(event, context):\n return "success"'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.PYTHON_3_9, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'PYTHON_3_9-functionName', { value: python39.functionName }); +const node14xfn = new aws_lambda_1.Function(stack, 'NODEJS_14_X', { + code: new aws_lambda_1.InlineCode('exports.handler = async function(event) { return "success" }'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.NODEJS_14_X, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'NODEJS_14_X-functionName', { value: node14xfn.functionName }); +const node16xfn = new aws_lambda_1.Function(stack, 'NODEJS_16_X', { + code: new aws_lambda_1.InlineCode('exports.handler = async function(event) { return "success" }'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.NODEJS_16_X, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'NODEJS_16_X-functionName', { value: node16xfn.functionName }); +const node18xfn = new aws_lambda_1.Function(stack, 'NODEJS_18_X', { + code: new aws_lambda_1.InlineCode('exports.handler = async function(event) { return "success" }'), + handler: 'index.handler', + runtime: aws_lambda_1.Runtime.NODEJS_18_X, +}); +new aws_cdk_lib_1.CfnOutput(stack, 'NODEJS_18_X-functionName', { value: node18xfn.functionName }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVudGltZS5pbmxpbmVjb2RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucnVudGltZS5pbmxpbmVjb2RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQW9EO0FBQ3BELHVEQUF1RTtBQUV2RSwwRkFBMEY7QUFDMUYsNkZBQTZGO0FBQzdGLDBGQUEwRjtBQUMxRixFQUFFO0FBQ0YsMkZBQTJGO0FBQzNGLGdHQUFnRztBQUNoRyxvREFBb0Q7QUFDcEQsRUFBRTtBQUNGLG1EQUFtRDtBQUVuRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLG1DQUFtQyxDQUFDLENBQUM7QUFFbEUsTUFBTSxRQU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ZW50KSB7IHJldHVybiBcInN1Y2Nlc3NcIiB9JyksXG4gIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgcnVudGltZTogUnVudGltZS5OT0RFSlNfMThfWCxcbn0pO1xubmV3IENmbk91dHB1dChzdGFjaywgJ05PREVKU18xOF9YLWZ1bmN0aW9uTmFtZScsIHsgdmFsdWU6IG5vZGUxOHhmbi5mdW5jdGlvbk5hbWUgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/aws-cdk-lambda-runtime-inlinecode.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.ts similarity index 95% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.ts index c68f681d8d099..9afd54138773b 100644 --- a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.runtime.inlinecode.ts @@ -1,5 +1,5 @@ -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { Function, InlineCode, Runtime } from '../lib'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { Function, InlineCode, Runtime } from 'aws-cdk-lib/aws-lambda'; // CloudFormation supports InlineCode only for a subset of runtimes. This integration test // is used to verify that the ones marked in the CDK are in fact supported by CloudFormation. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js new file mode 100644 index 0000000000000..baa5ef781c758 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-vpc-lambda'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); +new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('def main(event, context): pass'), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_9, + vpc, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWxhbWJkYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnZwYy1sYW1iZGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6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m5ldyBsYW1iZGEuRnVuY3Rpb24oc3RhY2ssICdNeUxhbWJkYScsIHtcbiAgY29kZTogbmV3IGxhbWJkYS5JbmxpbmVDb2RlKCdkZWYgbWFpbihldmVudCwgY29udGV4dCk6IHBhc3MnKSxcbiAgaGFuZGxlcjogJ2luZGV4Lm1haW4nLFxuICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5QWVRIT05fM185LFxuICB2cGMsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.assets.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.assets.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.template.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/aws-cdk-vpc-lambda.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.permissions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.ts new file mode 100644 index 0000000000000..28793683394f1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/integ.vpc-lambda.ts @@ -0,0 +1,17 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-vpc-lambda'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); + +new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('def main(event, context): pass'), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_9, + vpc, +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/layer-code/layer.d.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/layer-code/layer.d.ts diff --git a/packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.js b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/layer-code/layer.js similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.current-version.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/layer-code/layer.js diff --git a/packages/@aws-cdk/aws-lambda/test/layer-code/layer.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/layer-code/layer.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/layer-code/layer.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/layer-code/layer.ts diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/my-lambda-handler/index.py similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.assets.lit.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/my-lambda-handler/index.py diff --git a/packages/@aws-cdk/aws-lambda/test/python-lambda-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/python-lambda-handler/index.py similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/python-lambda-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/python-lambda-handler/index.py diff --git a/packages/@aws-cdk/aws-lambda/test/python-lambda-handler/requirements.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/python-lambda-handler/requirements.txt similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/python-lambda-handler/requirements.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-lambda/test/python-lambda-handler/requirements.txt diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js new file mode 100644 index 0000000000000..cbec40f487b56 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kinesis = require("aws-cdk-lib/aws-kinesis"); +const logs = require("aws-cdk-lib/aws-logs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const dests = require("aws-cdk-lib/aws-logs-destinations"); +class KinesisEnv extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const stream = new kinesis.Stream(this, 'MyStream'); + const logGroup = new logs.LogGroup(this, 'LogGroup', { removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY }); + const kinesisDestination = new dests.KinesisDestination(stream); + new logs.SubscriptionFilter(this, 'Subscription', { + logGroup: logGroup, + destination: kinesisDestination, + filterPattern: logs.FilterPattern.allEvents(), + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new KinesisEnv(app, 'kinesis-logsubscription-integ'); +// If the proper dependency is not set, then the deployment fails with: +// Resource handler returned message: "Could not deliver test message to specified +// Kinesis stream. Check if the given kinesis stream is in ACTIVE state. +// (Service: CloudWatchLogs, Status Code: 400, Request ID: [...])" +new integ_tests_alpha_1.IntegTest(app, 'KinesisInteg', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua2luZXNpcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmtpbmVzaXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtREFBbUQ7QUFDbkQsNkNBQTZDO0FBQzdDLDZDQUF3RDtBQUN4RCxrRUFBdUQ7QUFFdkQsMkRBQTJEO0FBRzNELE1BQU0sVUFBVyxTQUFRLG1CQUFLO0lBQzVCLFlBQVksS0FBMkIsRUFBRSxFQUFVO1FBQ2pELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxNQUFNLEdBQUcsSUFBSSxPQUFPLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxVQUFVLENBQUMsQ0FBQztRQUNwRCxNQUFNLFFBQVEsR0FBRyxJQUFJLElBQUksQ0FBQyxRQUFRLENBQUMsSUFBSSxFQUFFLFVBQVUsRUFBRSxFQUFFLGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU8sRUFBRSxDQUFDLENBQUM7UUFDL0YsTUFBTSxrQkFBa0IsR0FBRyxJQUFJLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQU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gc3BlY2lmaWVkXG4vLyBLaW5lc2lzIHN0cmVhbS4gQ2hlY2sgaWYgdGhlIGdpdmVuIGtpbmVzaXMgc3RyZWFtIGlzIGluIEFDVElWRSBzdGF0ZS5cbi8vIChTZXJ2aWNlOiBDbG91ZFdhdGNoTG9ncywgU3RhdHVzIENvZGU6IDQwMCwgUmVxdWVzdCBJRDogWy4uLl0pXCJcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnS2luZXNpc0ludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.assets.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/KinesisIntegDefaultTestDeployAssertE6E3ADDB.template.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/kinesis-logsubscription-integ.template.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.ts new file mode 100644 index 0000000000000..df5d2aec2360a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.kinesis.ts @@ -0,0 +1,35 @@ +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import { App, Stack, RemovalPolicy } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as constructs from 'constructs'; +import * as dests from 'aws-cdk-lib/aws-logs-destinations'; + + +class KinesisEnv extends Stack { + constructor(scope: constructs.Construct, id: string) { + super(scope, id); + + const stream = new kinesis.Stream(this, 'MyStream'); + const logGroup = new logs.LogGroup(this, 'LogGroup', { removalPolicy: RemovalPolicy.DESTROY }); + const kinesisDestination = new dests.KinesisDestination(stream); + + new logs.SubscriptionFilter(this, 'Subscription', { + logGroup: logGroup, + destination: kinesisDestination, + filterPattern: logs.FilterPattern.allEvents(), + }); + } +} + +const app = new App(); +const stack = new KinesisEnv(app, 'kinesis-logsubscription-integ'); + +// If the proper dependency is not set, then the deployment fails with: +// Resource handler returned message: "Could not deliver test message to specified +// Kinesis stream. Check if the given kinesis stream is in ACTIVE state. +// (Service: CloudWatchLogs, Status Code: 400, Request ID: [...])" +new IntegTest(app, 'KinesisInteg', { + testCases: [stack], +}); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js new file mode 100644 index 0000000000000..4d725f4cb021d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js @@ -0,0 +1,77 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const aws_events_targets_1 = require("aws-cdk-lib/aws-events-targets"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_lambda_destinations_1 = require("aws-cdk-lib/aws-lambda-destinations"); +const logs = require("aws-cdk-lib/aws-logs"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_logs_destinations_1 = require("aws-cdk-lib/aws-logs-destinations"); +class LambdaStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + this.queue = new sqs.Queue(this, 'Queue'); + const fn = new lambda.Function(this, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_16_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => { + return 'success'; + };`), + onSuccess: new aws_lambda_destinations_1.SqsDestination(this.queue), + }); + const logGroup = new logs.LogGroup(this, 'LogGroup', { removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY }); + const lambdaDestination = new aws_logs_destinations_1.LambdaDestination(fn); + new logs.SubscriptionFilter(this, 'Subscription', { + logGroup: logGroup, + destination: lambdaDestination, + filterPattern: logs.FilterPattern.allEvents(), + }); + const customRule = new events.Rule(this, 'CustomRule', { + eventPattern: { + source: ['cdk-lambda-integ'], + detailType: ['cdk-integ-custom-rule'], + }, + }); + customRule.addTarget(new aws_events_targets_1.CloudWatchLogGroup(logGroup, { + logEvent: aws_events_targets_1.LogGroupTargetInput.fromObject({ + message: 'Howdy Ho!', + }), + })); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new LambdaStack(app, 'lambda-logssubscription-integ'); +const integ = new integ_tests_alpha_1.IntegTest(app, 'LambdaInteg', { + testCases: [stack], +}); +const putEvents = integ.assertions.awsApiCall('EventBridge', 'putEvents', { + Entries: [ + { + Detail: JSON.stringify({ + foo: 'bar', + }), + DetailType: 'cdk-integ-custom-rule', + Source: 'cdk-lambda-integ', + }, + ], +}); +putEvents.provider.addToRolePolicy({ + Effect: 'Allow', + Action: ['events:PutEvents'], + Resource: ['*'], +}); +const receiveMessage = integ.assertions.awsApiCall('SQS', 'receiveMessage', { + QueueUrl: stack.queue.queueUrl, + WaitTimeSeconds: 20, +}); +// TODO: Replace with `receiveMessage.assertAtPath('Messages.0.Body', ExpectedResult.objectLike({...` +// when issue #24215 is addressed +receiveMessage.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Messages: [{ + Body: integ_tests_alpha_1.Match.stringLikeRegexp('"responsePayload":"success"'), + }], +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGFtYmRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlEO0FBQ2pELHVFQUF5RjtBQUN6RixpREFBaUQ7QUFDakQsaUZBQXFFO0FBQ3JFLDZDQUE2QztBQUM3QywyQ0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5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSgge1xuICBNZXNzYWdlczpcbiAgW3tcbiAgICBCb2R5OiBNYXRjaC5zdHJpbmdMaWtlUmVnZXhwKCAnXCJyZXNwb25zZVBheWxvYWRcIjpcInN1Y2Nlc3NcIicgKSxcbiAgfV0sXG59KSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.assets.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/LambdaIntegDefaultTestDeployAssert7BC530B7.template.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.33583035258f91f2130bb9759626b0a4b2fe7fad9f3e63d427ce5cdc3447b820.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.33583035258f91f2130bb9759626b0a4b2fe7fad9f3e63d427ce5cdc3447b820.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.33583035258f91f2130bb9759626b0a4b2fe7fad9f3e63d427ce5cdc3447b820.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.33583035258f91f2130bb9759626b0a4b2fe7fad9f3e63d427ce5cdc3447b820.bundle/index.js diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.a9d3d4d1afa000946b9863b3e7578a5a5ad86d88274b3639938aa2baebf822ce/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.a9d3d4d1afa000946b9863b3e7578a5a5ad86d88274b3639938aa2baebf822ce/index.js similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.a9d3d4d1afa000946b9863b3e7578a5a5ad86d88274b3639938aa2baebf822ce/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/asset.a9d3d4d1afa000946b9863b3e7578a5a5ad86d88274b3639938aa2baebf822ce/index.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/lambda-logssubscription-integ.template.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.ts new file mode 100644 index 0000000000000..9414cbade7a78 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs-destinations/test/integ.lambda.ts @@ -0,0 +1,91 @@ +import * as events from 'aws-cdk-lib/aws-events'; +import { CloudWatchLogGroup, LogGroupTargetInput } from 'aws-cdk-lib/aws-events-targets'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { SqsDestination } from 'aws-cdk-lib/aws-lambda-destinations'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, Stack, RemovalPolicy } from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests-alpha'; +import * as constructs from 'constructs'; +import { LambdaDestination } from 'aws-cdk-lib/aws-logs-destinations'; + +class LambdaStack extends Stack { + + public readonly queue: sqs.Queue; + + constructor(scope: constructs.Construct, id: string) { + super(scope, id); + + this.queue = new sqs.Queue(this, 'Queue'); + + const fn = new lambda.Function(this, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_16_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => { + return 'success'; + };`), + onSuccess: new SqsDestination(this.queue), + }); + + const logGroup = new logs.LogGroup(this, 'LogGroup', { removalPolicy: RemovalPolicy.DESTROY }); + const lambdaDestination = new LambdaDestination(fn); + + new logs.SubscriptionFilter(this, 'Subscription', { + logGroup: logGroup, + destination: lambdaDestination, + filterPattern: logs.FilterPattern.allEvents(), + }); + + const customRule = new events.Rule(this, 'CustomRule', { + eventPattern: { + source: ['cdk-lambda-integ'], + detailType: ['cdk-integ-custom-rule'], + }, + }); + customRule.addTarget(new CloudWatchLogGroup(logGroup, { + logEvent: LogGroupTargetInput.fromObject({ + message: 'Howdy Ho!', + }), + })); + } +} + +const app = new App(); +const stack = new LambdaStack(app, 'lambda-logssubscription-integ'); + +const integ = new IntegTest(app, 'LambdaInteg', { + testCases: [stack], +}); + +const putEvents = integ.assertions.awsApiCall('EventBridge', 'putEvents', { + Entries: [ + { + Detail: JSON.stringify({ + foo: 'bar', + }), + DetailType: 'cdk-integ-custom-rule', + Source: 'cdk-lambda-integ', + }, + ], +}); +putEvents.provider.addToRolePolicy({ + Effect: 'Allow', + Action: ['events:PutEvents'], + Resource: ['*'], +}); + +const receiveMessage = integ.assertions.awsApiCall('SQS', 'receiveMessage', { + QueueUrl: stack.queue.queueUrl, + WaitTimeSeconds: 20, +}); + +// TODO: Replace with `receiveMessage.assertAtPath('Messages.0.Body', ExpectedResult.objectLike({...` +// when issue #24215 is addressed +receiveMessage.expect(ExpectedResult.objectLike( { + Messages: + [{ + Body: Match.stringLikeRegexp( '"responsePayload":"success"' ), + }], +})); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js new file mode 100644 index 0000000000000..bc9b121593fa4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +/* + * Stack verification steps: + * + * -- aws cloudwatch describe-alarms --alarm-name-prefix aws-cdk-expose-metric-integ + * has Namespace of `MyApp` and Statistic of `Average` + */ +class ExposeMetricIntegStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const logGroup = new aws_logs_1.LogGroup(this, 'LogGroup', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + /// !show + const mf = new aws_logs_1.MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: aws_logs_1.FilterPattern.exists('$.latency'), + metricValue: '$.latency', + }); + new aws_cloudwatch_1.Alarm(this, 'alarm from metric filter', { + metric: mf.metric(), + threshold: 100, + evaluationPeriods: 2, + }); + /// !hide + } +} +const app = new aws_cdk_lib_1.App(); +new ExposeMetricIntegStack(app, 'aws-cdk-expose-metric-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXhwb3NlLW1ldHJpYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmV4cG9zZS1tZXRyaWMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrREFBbUQ7QUFDbkQsNkNBQW9FO0FBQ3BFLG1EQUE2RTtBQUU3RTs7Ozs7R0FLRztBQUVILE1BQU0sc0JBQXVCLFNBQVEsbUJBQUs7SUFDeEMsWUFBWSxLQUFVLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQ3BELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sUUFBUSxHQUFHLElBQUksbUJBQVEsQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFO1lBQzlDLGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87U0FDckMsQ0FBQyxDQUFDO1FBRUgsU0FBUztRQUNULE1BQU0sRUFBRSxHQUFHLElBQUksdUJBQVksQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFO1lBQ2hELFFBQVE7WUFDUixlQUFlLEVBQUUsT0FBTztZQUN4QixVQUFVLEVBQUUsU0FBUztZQUNyQixhQUFhLEVBQUUsd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nRlZ1N0YWNrIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQXBwLCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIGNvbnN0IGxvZ0dyb3VwID0gbmV3IExvZ0dyb3VwKHRoaXMsICdMb2dHcm91cCcsIHtcbiAgICAgIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICB9KTtcblxuICAgIC8vLyAhc2hvd1xuICAgIGNvbnN0IG1mID0gbmV3IE1ldHJpY0ZpbHRlcih0aGlzLCAnTWV0cmljRmlsdGVyJywge1xuICAgICAgbG9nR3JvdXAsXG4gICAgICBtZXRyaWNOYW1lc3BhY2U6ICdNeUFwcCcsXG4gICAgICBtZXRyaWNOYW1lOiAnTGF0ZW5jeScsXG4gICAgICBmaWx0ZXJQYXR0ZXJuOiBGaWx0ZXJQYXR0ZXJuLmV4aXN0cygnJC5sYXRlbmN5JyksXG4gICAgICBtZXRyaWNWYWx1ZTogJyQubGF0ZW5jeScsXG4gICAgfSk7XG5cbiAgICBuZXcgQWxhcm0odGhpcywgJ2FsYXJtIGZyb20gbWV0cmljIGZpbHRlcicsIHtcbiAgICAgIG1ldHJpYzogbWYubWV0cmljKCksXG4gICAgICB0aHJlc2hvbGQ6IDEwMCxcbiAgICAgIGV2YWx1YXRpb25QZXJpb2RzOiAyLFxuICAgIH0pO1xuXG4gICAgLy8vICFoaWRlXG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IEV4cG9zZU1ldHJpY0ludGVnU3RhY2soYXBwLCAnYXdzLWNkay1leHBvc2UtbWV0cmljLWludGVnJyk7XG5hcHAuc3ludGgoKTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/aws-cdk-expose-metric-integ.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda-adot.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.ts similarity index 82% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.ts index dc442923a5822..d7b7bc173045c 100644 --- a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.expose-metric.ts @@ -1,6 +1,6 @@ -import { Alarm } from '@aws-cdk/aws-cloudwatch'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { FilterPattern, LogGroup, MetricFilter } from '../lib'; +import { Alarm } from 'aws-cdk-lib/aws-cloudwatch'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { FilterPattern, LogGroup, MetricFilter } from 'aws-cdk-lib/aws-logs'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js new file mode 100644 index 0000000000000..f899e12789366 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +class LogRetentionIntegStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new aws_logs_1.LogRetention(this, 'MyLambda', { + logGroupName: 'logRetentionLogGroup', + retention: aws_logs_1.RetentionDays.ONE_DAY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + new aws_logs_1.LogRetention(this, 'MyLambda2', { + logGroupName: 'logRetentionLogGroup2', + retention: aws_logs_1.RetentionDays.ONE_DAY, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new LogRetentionIntegStack(app, 'aws-cdk-log-retention-integ'); +new integ_tests_alpha_1.IntegTest(app, 'LogRetentionInteg', { testCases: [stack] }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubG9nLXJldGVudGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmxvZy1yZXRlbnRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBb0U7QUFDcEUsa0VBQXVEO0FBQ3ZELG1EQUFtRTtBQUVuRSxNQUFNLHNCQUF1QixTQUFRLG1CQUFLO0lBQ3hDLFlBQVksS0FBVSxFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUNwRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixJQUFJLHVCQUFZLENBQUMsSUFBSSxFQUFFLFVBQ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mluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBuZXcgTG9nUmV0ZW50aW9uKHRoaXMsICdNeUxhbWJkYScsIHtcbiAgICAgIGxvZ0dyb3VwTmFtZTogJ2xvZ1JldGVudGlvbkxvZ0dyb3VwJyxcbiAgICAgIHJldGVudGlvbjogUmV0ZW50aW9uRGF5cy5PTkVfREFZLFxuICAgICAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICAgIH0pO1xuXG4gICAgbmV3IExvZ1JldGVudGlvbih0aGlzLCAnTXlMYW1iZGEyJywge1xuICAgICAgbG9nR3JvdXBOYW1lOiAnbG9nUmV0ZW50aW9uTG9nR3JvdXAyJyxcbiAgICAgIHJldGVudGlvbjogUmV0ZW50aW9uRGF5cy5PTkVfREFZLFxuICAgICAgcmVtb3ZhbFBvbGljeTogUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IExvZ1JldGVudGlvbkludGVnU3RhY2soYXBwLCAnYXdzLWNkay1sb2ctcmV0ZW50aW9uLWludGVnJyk7XG5uZXcgSW50ZWdUZXN0KGFwcCwgJ0xvZ1JldGVudGlvbkludGVnJywgeyB0ZXN0Q2FzZXM6IFtzdGFja10gfSk7XG5hcHAuc3ludGgoKTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/LogRetentionIntegDefaultTestDeployAssert6ACC5A74.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/aws-cdk-log-retention-integ.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.runtime.inlinecode.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.ts new file mode 100644 index 0000000000000..e854391a6b76b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.log-retention.ts @@ -0,0 +1,26 @@ +import { App, Stack, StackProps, RemovalPolicy } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { LogRetention, RetentionDays } from 'aws-cdk-lib/aws-logs'; + +class LogRetentionIntegStack extends Stack { + constructor(scope: App, id: string, props?: StackProps) { + super(scope, id, props); + + new LogRetention(this, 'MyLambda', { + logGroupName: 'logRetentionLogGroup', + retention: RetentionDays.ONE_DAY, + removalPolicy: RemovalPolicy.DESTROY, + }); + + new LogRetention(this, 'MyLambda2', { + logGroupName: 'logRetentionLogGroup2', + retention: RetentionDays.ONE_DAY, + removalPolicy: RemovalPolicy.DESTROY, + }); + } +} + +const app = new App(); +const stack = new LogRetentionIntegStack(app, 'aws-cdk-log-retention-integ'); +new IntegTest(app, 'LogRetentionInteg', { testCases: [stack] }); +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js new file mode 100644 index 0000000000000..afc5d6242896d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-loggroup-grantreads-integ'); +const logGroup = new aws_logs_1.LogGroup(stack, 'LogGroup'); +logGroup.grantRead(new aws_iam_1.ServicePrincipal('es.amazonaws.com')); +new integ_tests_alpha_1.IntegTest(app, 'loggroup-grantreads', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubG9nZ3JvdXAtZ3JhbnRyZWFkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubG9nZ3JvdXAtZ3JhbnRyZWFkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQXVEO0FBQ3ZELDZDQUF5QztBQUN6QyxrRUFBdUQ7QUFDdkQsbURBQWdEO0FBRWhELE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsbUNBQW1DLENBQUMsQ0FBQztBQUVsRSxNQUFNLFFBQVEsR0FBRyxJQUFJLG1CQUFRLENBQUMsS0FBSyxFQUFFLFVBQVUsQ0FBQyxDQUFDO0FBQ2pELFFBQVEsQ0FBQyxTQUFTLENBQUMsSUFBSSwwQkFBZ0IsQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDLENBQUM7QUFFN0QsSUFBSSw2QkFBUyxDQUFDLEdBQUcsRUFBRSxxQkFBcUIsRUFBRTtJQUN4QyxTQUFTLEVBQUUsQ0FBQyxLQUFLLENBQUM7Q0FDbkIsQ0FBQyxDQUFDO0FBQ0gsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgU2VydmljZVByaW5jaXBhbCB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1pYW0nO1xuaW1wb3J0IHsgQXBwLCBTdGFjayB9IGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCB7IEludGVnVGVzdCB9IGZyb20gJ0Bhd3MtY2RrL2ludGVnLXRlc3RzLWFscGhhJztcbmltcG9ydCB7IExvZ0dyb3VwIH0gZnJvbSAnYXdzLWNkay1saWIvYXdzLWxvZ3MnO1xuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBTdGFjayhhcHAsICdhd3MtY2RrLWxvZ2dyb3VwLWdyYW50cmVhZHMtaW50ZWcnKTtcblxuY29uc3QgbG9nR3JvdXAgPSBuZXcgTG9nR3JvdXAoc3RhY2ssICdMb2dHcm91cCcpO1xubG9nR3JvdXAuZ3JhbnRSZWFkKG5ldyBTZXJ2aWNlUHJpbmNpcGFsKCdlcy5hbWF6b25hd3MuY29tJykpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2xvZ2dyb3VwLWdyYW50cmVhZHMnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/aws-cdk-loggroup-grantreads-integ.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.lambda.docker.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/loggroupgrantreadsDefaultTestDeployAssert7C1C7FAA.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.ts new file mode 100644 index 0000000000000..aebdda81dd5f4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.loggroup-grantread.ts @@ -0,0 +1,15 @@ +import { ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { LogGroup } from 'aws-cdk-lib/aws-logs'; + +const app = new App(); +const stack = new Stack(app, 'aws-cdk-loggroup-grantreads-integ'); + +const logGroup = new LogGroup(stack, 'LogGroup'); +logGroup.grantRead(new ServicePrincipal('es.amazonaws.com')); + +new IntegTest(app, 'loggroup-grantreads', { + testCases: [stack], +}); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js new file mode 100644 index 0000000000000..4adacb5e53354 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const logGroup = new aws_logs_1.LogGroup(this, 'LogGroup', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + new aws_logs_1.MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: aws_logs_1.FilterPattern.exists('$.latency'), + metricValue: '$.latency', + dimensions: { + ErrorCode: '$.errorCode', + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'aws-cdk-metricfilter-dimensions-integ'); +new integ_tests_alpha_1.IntegTest(app, 'metricfilter-dimensions', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubWV0cmljZmlsdGVyLWRpbWVuc2lvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5tZXRyaWNmaWx0ZXItZGltZW5zaW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFvRTtBQUNwRSxrRUFBdUQ7QUFDdkQsbURBQTZFO0FBRTdFLE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBVSxFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUNwRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLFFBQVEsR0FBRyxJQUFJLG1CQUFRLENBQUMsSUFBSSxFQUFFLFVBQVUsRUFBRTtZQUM5QyxhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO1NBQ3JDLENBQUMsQ0FBQztRQUVILElBQUksdUJBQVksQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFO1lBQ3JDLFFBQVE7WUFDUixlQUFlLEVBQUUsT0FBTztZQUN4QixVQUFVLEVBQUUsU0FBUztZQUNyQixhQUFhLEVBQUUsd0JBQWEsQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDO1lBQ2hELFdBQVcsRUFBRSxXQUFXO1lBQ3hCLFVBQVUsRUFBRTtnQkFDVixTQUFTLEVBQUUsYUFBYTthQUN6QjtTQUNGLENBQUMsQ0FBQztJQUNMLENBQUM7Q0FDRjtBQUVELE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sUUFBUSxHQUFHLElBQUksU0F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JC5sYXRlbmN5JyksXG4gICAgICBtZXRyaWNWYWx1ZTogJyQubGF0ZW5jeScsXG4gICAgICBkaW1lbnNpb25zOiB7XG4gICAgICAgIEVycm9yQ29kZTogJyQuZXJyb3JDb2RlJyxcbiAgICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgVGVzdFN0YWNrKGFwcCwgJ2F3cy1jZGstbWV0cmljZmlsdGVyLWRpbWVuc2lvbnMtaW50ZWcnKTtcblxubmV3IEludGVnVGVzdChhcHAsICdtZXRyaWNmaWx0ZXItZGltZW5zaW9ucycsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/aws-cdk-metricfilter-dimensions-integ.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.expose-metric.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/metricfilterdimensionsDefaultTestDeployAssertF7E39B09.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.ts similarity index 77% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.ts index 542f481be5817..e5a830137d983 100644 --- a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-dimensions.ts @@ -1,6 +1,6 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { FilterPattern, LogGroup, MetricFilter } from '../lib'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { FilterPattern, LogGroup, MetricFilter } from 'aws-cdk-lib/aws-logs'; class TestStack extends Stack { constructor(scope: App, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js new file mode 100644 index 0000000000000..1c99009d25681 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cloudwatch_1 = require("aws-cdk-lib/aws-cloudwatch"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const logGroup = new aws_logs_1.LogGroup(this, 'LogGroup', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + new aws_logs_1.MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: aws_logs_1.FilterPattern.exists('$.latency'), + metricValue: '$.latency', + dimensions: { + ErrorCode: '$.errorCode', + }, + unit: aws_cloudwatch_1.Unit.MILLISECONDS, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'aws-cdk-metricfilter-unit-integ'); +new integ_tests_alpha_1.IntegTest(app, 'metricfilter-unit', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW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mFsdWU6ICckLmxhdGVuY3knLFxuICAgICAgZGltZW5zaW9uczoge1xuICAgICAgICBFcnJvckNvZGU6ICckLmVycm9yQ29kZScsXG4gICAgICB9LFxuICAgICAgdW5pdDogVW5pdC5NSUxMSVNFQ09ORFMsXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgVGVzdFN0YWNrKGFwcCwgJ2F3cy1jZGstbWV0cmljZmlsdGVyLXVuaXQtaW50ZWcnKTtcblxubmV3IEludGVnVGVzdChhcHAsICdtZXRyaWNmaWx0ZXItdW5pdCcsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/aws-cdk-metricfilter-unit-integ.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/metricfilterunitDefaultTestDeployAssertB2F4057A.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.ts new file mode 100644 index 0000000000000..0117cdc930a90 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter-unit.ts @@ -0,0 +1,34 @@ +import { Unit } from 'aws-cdk-lib/aws-cloudwatch'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { FilterPattern, LogGroup, MetricFilter } from 'aws-cdk-lib/aws-logs'; + +class TestStack extends Stack { + constructor(scope: App, id: string, props?: StackProps) { + super(scope, id, props); + + const logGroup = new LogGroup(this, 'LogGroup', { + removalPolicy: RemovalPolicy.DESTROY, + }); + + new MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: FilterPattern.exists('$.latency'), + metricValue: '$.latency', + dimensions: { + ErrorCode: '$.errorCode', + }, + unit: Unit.MILLISECONDS, + }); + } +} + +const app = new App(); +const testCase = new TestStack(app, 'aws-cdk-metricfilter-unit-integ'); + +new IntegTest(app, 'metricfilter-unit', { + testCases: [testCase], +}); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js new file mode 100644 index 0000000000000..49f23f0442cba --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +class MetricFilterIntegStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const logGroup = new aws_logs_1.LogGroup(this, 'LogGroup', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + /// !show + new aws_logs_1.MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: aws_logs_1.FilterPattern.exists('$.latency'), + metricValue: '$.latency', + }); + /// !hide + } +} +const app = new aws_cdk_lib_1.App(); +new MetricFilterIntegStack(app, 'aws-cdk-metricfilter-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubWV0cmljZmlsdGVyLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm1ldHJpY2ZpbHRlci5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7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rIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQXBwLCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIGNvbnN0IGxvZ0dyb3VwID0gbmV3IExvZ0dyb3VwKHRoaXMsICdMb2dHcm91cCcsIHtcbiAgICAgIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICB9KTtcblxuICAgIC8vLyAhc2hvd1xuICAgIG5ldyBNZXRyaWNGaWx0ZXIodGhpcywgJ01ldHJpY0ZpbHRlcicsIHtcbiAgICAgIGxvZ0dyb3VwLFxuICAgICAgbWV0cmljTmFtZXNwYWNlOiAnTXlBcHAnLFxuICAgICAgbWV0cmljTmFtZTogJ0xhdGVuY3knLFxuICAgICAgZmlsdGVyUGF0dGVybjogRmlsdGVyUGF0dGVybi5leGlzdHMoJyQubGF0ZW5jeScpLFxuICAgICAgbWV0cmljVmFsdWU6ICckLmxhdGVuY3knLFxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBNZXRyaWNGaWx0ZXJJbnRlZ1N0YWNrKGFwcCwgJ2F3cy1jZGstbWV0cmljZmlsdGVyLWludGVnJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/aws-cdk-metricfilter-integ.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-dimensions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.ts new file mode 100644 index 0000000000000..a8bdc885961d1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.metricfilter.lit.ts @@ -0,0 +1,26 @@ +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { FilterPattern, LogGroup, MetricFilter } from 'aws-cdk-lib/aws-logs'; + +class MetricFilterIntegStack extends Stack { + constructor(scope: App, id: string, props?: StackProps) { + super(scope, id, props); + + const logGroup = new LogGroup(this, 'LogGroup', { + removalPolicy: RemovalPolicy.DESTROY, + }); + + /// !show + new MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: FilterPattern.exists('$.latency'), + metricValue: '$.latency', + }); + /// !hide + } +} + +const app = new App(); +new MetricFilterIntegStack(app, 'aws-cdk-metricfilter-integ'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js new file mode 100644 index 0000000000000..d67d7e738fdd1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_logs_1 = require("aws-cdk-lib/aws-logs"); +class LogsInsightsQueryDefinitionIntegStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const logGroup = new aws_logs_1.LogGroup(this, 'LogGroup', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + // Test query creation with single parse and filter statements + new aws_logs_1.QueryDefinition(this, 'QueryDefinition', { + queryDefinitionName: 'QueryDefinition', + queryString: new aws_logs_1.QueryString({ + fields: ['@timestamp', '@message'], + parse: '@message "[*] *" as loggingType, loggingMessage', + filter: 'loggingType = "ERROR"', + sort: '@timestamp desc', + limit: 20, + display: 'loggingMessage', + }), + logGroups: [logGroup], + }); + // Test query creation with multiple parse and filter statements + new aws_logs_1.QueryDefinition(this, 'QueryDefinitionWithMultipleStatements', { + queryDefinitionName: 'QueryDefinitionWithMultipleStatements', + queryString: new aws_logs_1.QueryString({ + fields: ['@timestamp', '@message'], + parseStatements: [ + '@message "[*] *" as loggingType, loggingMessage', + '@message "<*>: *" as differentLoggingType, differentLoggingMessage', + ], + filterStatements: [ + 'loggingType = "ERROR"', + 'loggingMessage = "A very strange error occurred!"', + ], + sort: '@timestamp desc', + limit: 20, + display: 'loggingMessage', + }), + logGroups: [logGroup], + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new LogsInsightsQueryDefinitionIntegStack(app, 'aws-cdk-logs-insights-querydefinition-integ'); +new integ_tests_alpha_1.IntegTest(app, 'LogsInsightsQueryDefinitionIntegTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2F2ZS1sb2dzLWluc2lnaHRzLXF1ZXJ5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RlZ1N0YWNrKGFwcCwgJ2F3cy1jZGstbG9ncy1pbnNpZ2h0cy1xdWVyeWRlZmluaXRpb24taW50ZWcnKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnTG9nc0luc2lnaHRzUXVlcnlEZWZpbml0aW9uSW50ZWdUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/LogsInsightsQueryDefinitionIntegTestDefaultTestDeployAssert902BAAD5.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.assets.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/aws-cdk-logs-insights-querydefinition-integ.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.ts similarity index 89% rename from packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.ts index ad022bcc486a7..9926910a76132 100644 --- a/packages/@aws-cdk/aws-logs/test/integ.save-logs-insights-query-definition.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-logs/test/integ.save-logs-insights-query-definition.ts @@ -1,7 +1,7 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -import { LogGroup, QueryDefinition, QueryString } from '../lib'; +import { LogGroup, QueryDefinition, QueryString } from 'aws-cdk-lib/aws-logs'; class LogsInsightsQueryDefinitionIntegStack extends Stack { constructor(scope: App, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js new file mode 100644 index 0000000000000..f45980ab8372d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const user = new aws_iam_1.User(this, 'User'); + new opensearch.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.ELASTICSEARCH_7_1, + fineGrainedAccessControl: { + masterUserArn: user.userArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-opensearch-advancedsecurity'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNlYXJjaC5hZHZhbmNlZHNlY3VyaXR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsi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--git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.dynamodb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts similarity index 78% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts index f72ad9eaa48ef..d81e16ba0be2b 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts @@ -1,7 +1,7 @@ -import { User } from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { User } from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js new file mode 100644 index 0000000000000..9428374bc8259 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cognito = require("aws-cdk-lib/aws-cognito"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // Adding required resources per https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html#cognito-auth-config + const identityPool = new cognito.CfnIdentityPool(this, 'IdentityPool', { + allowUnauthenticatedIdentities: true, + }); + const userPool = new cognito.UserPool(this, 'UserPool', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + userPool.addDomain('UserPoolDomain', { + cognitoDomain: { + domainPrefix: 'integ-test-domain-prefix', + }, + }); + const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('opensearchservice.amazonaws.com'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonOpenSearchServiceCognitoAccess'), + ], + }); + // Adding a domain with cognito dashboards auth configured + new opensearch.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.OPENSEARCH_1_0, + cognitoDashboardsAuth: { + role, + identityPoolId: identityPool.ref, + userPoolId: userPool.userPoolId, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'cdk-integ-opensearch-cognitodashboardsauth'); +new integ_tests_alpha_1.IntegTest(app, 'CognitoAuthForOpenSearchDashboards', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNlYXJjaC5jb2duaXRvZGFzaGJvYXJkc2F1dGguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5vcGVuc2VhcmNoLmNvZ25pdG9kYXNoYm9hcmRzYXV0aC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1EQUFtRDtBQUNuRCwyQ0FBMkM7QUFDM0MsNkNBQW9FO0FBQ3BFLGtFQUF1RDtBQUV2RCxnRUFBZ0U7QUFFaEUsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QiwySUFBMkk7UUFDM0ksTUFBTSxZQUFZLEdBQUcsSUFBSSxPQUFPLENBQUMsZUFBZSxDQUFDLElBQUksRUFBRSxjQUFjLEVBQUU7WUFDckUsOEJBQThCLEVBQUUsSUFBSTtTQU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0hfMV8wLFxuICAgICAgY29nbml0b0Rhc2hib2FyZHNBdXRoOiB7XG4gICAgICAgIHJvbGUsXG4gICAgICAgIGlkZW50aXR5UG9vbElkOiBpZGVudGl0eVBvb2wucmVmLFxuICAgICAgICB1c2VyUG9vbElkOiB1c2VyUG9vbC51c2VyUG9vbElkLFxuICAgICAgfSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBUZXN0U3RhY2soYXBwLCAnY2RrLWludGVnLW9wZW5zZWFyY2gtY29nbml0b2Rhc2hib2FyZHNhdXRoJyk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnQ29nbml0b0F1dGhGb3JPcGVuU2VhcmNoRGFzaGJvYXJkcycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/CognitoAuthForOpenSearchDashboardsDefaultTestDeployAssert4CCFA971.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.kafka-selfmanaged.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts similarity index 84% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts index 1ae65595e94b9..4631bb995a891 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts @@ -1,9 +1,9 @@ -import * as cognito from '@aws-cdk/aws-cognito'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js new file mode 100644 index 0000000000000..79fd2cff54766 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const key = new kms.Key(this, 'Key'); + const domainProps = { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.ELASTICSEARCH_7_1, + encryptionAtRest: { + enabled: true, + kmsKey: key, + }, + accessPolicies: [ + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['es:ESHttp*'], + principals: [new iam.AccountRootPrincipal()], + resources: ['*'], + }), + ], + }; + new opensearch.Domain(this, 'Domain', domainProps); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-opensearch-custom-kms-key'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNlYXJjaC5jdXN0b20ta21zLWtleS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm9wZW5zZWFyY2guY3VzdG9tLWttcy1rZXkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLDZDQUFvRTtBQUVwRSxnRUFBZ0U7QUFFaEUsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQ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J0RvbWFpbicsIGRvbWFpblByb3BzKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1vcGVuc2VhcmNoLWN1c3RvbS1rbXMta2V5Jyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-globalaccelerator-endpoints/test/integ.globalaccelerator.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts similarity index 79% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts index fd6e1bb48ab17..123bf4de3bd44 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts @@ -1,8 +1,8 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js new file mode 100644 index 0000000000000..62faf383dddc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const domainProps = { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.ELASTICSEARCH_7_1, + ebs: { + volumeSize: 10, + volumeType: aws_ec2_1.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + logging: { + slowSearchLogEnabled: true, + appLogEnabled: true, + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + advancedOptions: { + 'rest.action.multi.allow_explicit_index': 'false', + 'indices.fielddata.cache.size': '25', + 'indices.query.bool.max_clause_count': '2048', + }, + // test the access policies custom resource works + accessPolicies: [ + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['es:ESHttp*'], + principals: [new iam.AccountRootPrincipal()], + resources: ['*'], + }), + ], + }; + // create 2 domains to ensure that Cloudwatch Log Group policy names dont conflict + new opensearch.Domain(this, 'Domain1', domainProps); + new opensearch.Domain(this, 'Domain2', domainProps); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-opensearch'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNlYXJjaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm9wZW5zZWFyY2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5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HM6IFtuZXcgaWFtLkFjY291bnRSb290UHJpbmNpcGFsKCldLFxuICAgICAgICAgIHJlc291cmNlczogWycqJ10sXG4gICAgICAgIH0pLFxuICAgICAgXSxcbiAgICB9O1xuXG4gICAgLy8gY3JlYXRlIDIgZG9tYWlucyB0byBlbnN1cmUgdGhhdCBDbG91ZHdhdGNoIExvZyBHcm91cCBwb2xpY3kgbmFtZXMgZG9udCBjb25mbGljdFxuICAgIG5ldyBvcGVuc2VhcmNoLkRvbWFpbih0aGlzLCAnRG9tYWluMScsIGRvbWFpblByb3BzKTtcbiAgICBuZXcgb3BlbnNlYXJjaC5Eb21haW4odGhpcywgJ0RvbWFpbjInLCBkb21haW5Qcm9wcyk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctb3BlbnNlYXJjaCcpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts similarity index 85% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts index e7e9c2e6e75ee..8523e601033e6 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts @@ -1,8 +1,8 @@ -import { EbsDeviceVolumeType } from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { EbsDeviceVolumeType } from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js new file mode 100644 index 0000000000000..3a352ae5363c3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new opensearch.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.ELASTICSEARCH_7_1, + capacity: { + masterNodes: 2, + warmNodes: 2, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-opensearch-ultrawarm'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNlYXJjaC51bHRyYXdhcm0uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5vcGVuc2VhcmNoLnVsdHJhd2FybS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFvRTtBQUVwRSxnRUFBZ0U7QUFFaEUsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixJQUFJLFVBQVUsQ0FBQyxNQUFNLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRTtZQUNwQyxhQUFhLEVBQUUsMkJBQWEsQ0FBQyxPQUFPO1lBQ3BDLE9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gICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctb3BlbnNlYXJjaC11bHRyYXdhcm0nKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sns.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts similarity index 78% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts index 79d349478212a..068b79b63d77b 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts @@ -1,6 +1,6 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js new file mode 100644 index 0000000000000..abbb2742c8841 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new opensearch.Domain(this, 'Domain', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.ELASTICSEARCH_7_1, + useUnsignedBasicAuth: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-opensearch-unsignedbasicauth'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNl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biAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBuZXcgb3BlbnNlYXJjaC5Eb21haW4odGhpcywgJ0RvbWFpbicsIHtcbiAgICAgIHJlbW92YWxQb2xpY3k6IFJlbW92YWxQb2xpY3kuREVTVFJPWSxcbiAgICAgIHZlcnNpb246IG9wZW5zZWFyY2guRW5naW5lVmVyc2lvbi5FTEFTVElDU0VBUkNIXzdfMSxcbiAgICAgIHVzZVVuc2lnbmVkQmFzaWNBdXRoOiB0cnVlLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBUZXN0U3RhY2soYXBwLCAnY2RrLWludGVnLW9wZW5zZWFyY2gtdW5zaWduZWRiYXNpY2F1dGgnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts similarity index 77% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts index b9115efaeaf70..7462fa9657b49 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts @@ -1,6 +1,6 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js new file mode 100644 index 0000000000000..0a5c42704b4df --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const opensearch = require("aws-cdk-lib/aws-opensearchservice"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const serviceLinkedRole = new aws_cdk_lib_1.CfnResource(this, 'ServiceLinkedRole', { + type: 'AWS::IAM::ServiceLinkedRole', + properties: { + AWSServiceName: 'opensearchservice.amazonaws.com', + Description: 'Role for OpenSearch VPC Test', + }, + }); + const vpc = new ec2.Vpc(this, 'Vpc'); + const domainProps = { + version: opensearch.EngineVersion.ELASTICSEARCH_7_1, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + vpc, + zoneAwareness: { + enabled: true, + }, + capacity: { + dataNodes: 2, + }, + }; + const domain = new opensearch.Domain(this, 'Domain', domainProps); + domain.node.addDependency(serviceLinkedRole); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'cdk-integ-opensearch-vpc'); +new integ.IntegTest(app, 'cdk-integ-opensearch-vpc-test', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcub3BlbnNlYXJjaC52cGMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5vcGVuc2VhcmNoLnZwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyw2Q0FBaUY7QUFDakYsb0RBQW9EO0FBRXBELGdFQUFnRTtBQUVoRSxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0saUJBQWlCLEdBQUcsSUFBSSx5QkFBVyxDQUFDLElBQUksRUFBRSxtQkFBbUIsRUFBRTtZQUNuRSxJQUFJLEVBQUUsNkJBQTZCO1lBQ25DLFVBQVUsRUFBRTtnQkFDVixjQUFjLEVBQUUsaUNBQWlDO2dCQUNqRCxXQUFXLEVBQUUsOEJBQThCO2FBQzVDO1NBQ0YsQ0FBQyxDQUFDO1FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsQ0FBQztRQUNyQyxNQUFNLFdBQVcsR0FBMkI7WUFDMUMsT0FBTyxFQUFFLFVBQVUsQ0FBQyxhQUFhLENBQUMsaUJBQWlCO1lBQ25ELGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87WUFDcEMsR0FBRztZQUNILGFBQWEsRUFBRTtnQkFDYixPQUFPLEVBQUUsSUFBSTthQUNkO1lBQ0QsUUFBUSxFQUFFO2dCQUNSLFNBQVMsRUFBRSxDQUFDO2F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DYXNlID0gbmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctb3BlbnNlYXJjaC12cGMnKTtcbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLW9wZW5zZWFyY2gtdnBjLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.assets.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdkintegopensearchvpctestDefaultTestDeployAssertF8864CE2.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts similarity index 86% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts index efe3080acf3fa..0fa1d0233efd9 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, Stack, StackProps, RemovalPolicy, CfnResource } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { App, Stack, StackProps, RemovalPolicy, CfnResource } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as opensearch from '../lib'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js new file mode 100644 index 0000000000000..5aca4539345b5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-dual-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2, natGateways: 0 }); +const ipv6 = new ec2.CfnVPCCidrBlock(stack, 'Ipv6CidrBlock', { vpcId: vpc.vpcId, amazonProvidedIpv6CidrBlock: true }); +vpc.isolatedSubnets.forEach((subnet, idx) => { + const cfnSubnet = subnet.node.defaultChild; + cfnSubnet.ipv6CidrBlock = cdk.Fn.select(idx, cdk.Fn.cidr(cdk.Fn.select(0, vpc.vpcIpv6CidrBlocks), 256, '64')); + cfnSubnet.addDependsOn(ipv6); +}); +new rds.DatabaseCluster(stack, 'DualstackCluster', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_02_0 }), + credentials: rds.Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + vpc, + }, + networkType: rds.NetworkType.DUAL, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new rds.DatabaseCluster(stack, 'Ipv4Cluster', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_02_0 }), + credentials: rds.Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + vpc, + }, + networkType: rds.NetworkType.IPV4, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new integ_tests_alpha_1.IntegTest(app, 'cluster-dual-test', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci1kdWFsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2x1c3Rlci1kdWFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZ0NBQWdDLENBQUMsQ0FBQztBQUVuRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsV0FBVyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QU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YXRhYmFzZUNsdXN0ZXJFbmdpbmUuYXVyb3JhTXlzcWwoeyB2ZXJzaW9uOiByZHMuQXVyb3JhTXlzcWxFbmdpbmVWZXJzaW9uLlZFUl8zXzAyXzAgfSksXG4gIGNyZWRlbnRpYWxzOiByZHMuQ3JlZGVudGlhbHMuZnJvbVVzZXJuYW1lKCdhZG1pbicsIHsgcGFzc3dvcmQ6IGNkay5TZWNyZXRWYWx1ZS51bnNhZmVQbGFpblRleHQoJzc5NTk4NjZjYWNjMDJjMmQyNDNlY2ZlMTc3NDY0ZmU2JykgfSksXG4gIGluc3RhbmNlUHJvcHM6IHtcbiAgICBpbnN0YW5jZVR5cGU6IGVjMi5JbnN0YW5jZVR5cGUub2YoZWMyLkluc3RhbmNlQ2xhc3MuQlVSU1RBQkxFMywgZWMyLkluc3RhbmNlU2l6ZS5NRURJVU0pLFxuICAgIHZwY1N1Ym5ldHM6IHsgc3VibmV0VHlwZTogZWMyLlN1Ym5ldFR5cGUuUFJJVkFURV9JU09MQVRFRCB9LFxuICAgIHZwYyxcbiAgfSxcbiAgbmV0d29ya1R5cGU6IHJkcy5OZXR3b3JrVHlwZS5JUFY0LFxuICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2x1c3Rlci1kdWFsLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/aws-cdk-rds-cluster-dual-integ.template.json diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/clusterdualtestDefaultTestDeployAssert0AE5E6E0.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.ts similarity index 90% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.ts index cebeeeb8cec61..930f482b7b06d 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-dual.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-dual-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js new file mode 100644 index 0000000000000..c723c51e472b7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-rotation'); +const vpc = new ec2.Vpc(stack, 'VPC'); +const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc }); +const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { + vpc, + service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, +}); +/// !show +const cluster = new rds.DatabaseCluster(stack, 'Database', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, +}); +cluster.addRotationSingleUser(); +const clusterWithCustomRotationOptions = new rds.DatabaseCluster(stack, 'CustomRotationOptions', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, +}); +clusterWithCustomRotationOptions.addRotationSingleUser({ + automaticallyAfter: cdk.Duration.days(7), + excludeCharacters: '!@#$%^&*', + securityGroup, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + endpoint: endpoint, +}); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci1yb3RhdGlvbi5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbHVzdGVyLXJvdGF0aW9uLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsOEJBQThCLENBQUMsQ0FBQztBQUVqRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ3RDLE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxDQUFDLGFBQWEsQ0FBQyxLQUFLLEVBQUUsZUFBZSxFQUFFLEVBQUUsR0FBRyxFQUFFLENBQUMsQ0FBQztBQUM3RSxNQUFNLFFBQVEsR0FBRyxJQUFJLEdBQUcsQ0FBQyxvQk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iB7XG4gICAgaW5zdGFuY2VUeXBlOiBlYzIuSW5zdGFuY2VUeXBlLm9mKGVjMi5JbnN0YW5jZUNsYXNzLkJVUlNUQUJMRTMsIGVjMi5JbnN0YW5jZVNpemUuU01BTEwpLFxuICAgIHZwYyxcbiAgfSxcbn0pO1xuXG5jbHVzdGVyLmFkZFJvdGF0aW9uU2luZ2xlVXNlcigpO1xuXG5jb25zdCBjbHVzdGVyV2l0aEN1c3RvbVJvdGF0aW9uT3B0aW9ucyA9IG5ldyByZHMuRGF0YWJhc2VDbHVzdGVyKHN0YWNrLCAnQ3VzdG9tUm90YXRpb25PcHRpb25zJywge1xuICBlbmdpbmU6IHJkcy5EYXRhYmFzZUNsdXN0ZXJFbmdpbmUuQVVST1JBLFxuICBpbnN0YW5jZVByb3BzOiB7XG4gICAgaW5zdGFuY2VUeXBlOiBlYzIuSW5zdGFuY2VUeXBlLm9mKGVjMi5JbnN0YW5jZUNsYXNzLkJVUlNUQUJMRTMsIGVjMi5JbnN0YW5jZVNpemUuU01BTEwpLFxuICAgIHZwYyxcbiAgfSxcbn0pO1xuY2x1c3RlcldpdGhDdXN0b21Sb3RhdGlvbk9wdGlvbnMuYWRkUm90YXRpb25TaW5nbGVVc2VyKHtcbiAgYXV0b21hdGljYWxseUFmdGVyOiBjZGsuRHVyYXRpb24uZGF5cyg3KSxcbiAgZXhjbHVkZUNoYXJhY3RlcnM6ICchQCMkJV4mKicsXG4gIHNlY3VyaXR5R3JvdXAsXG4gIHZwY1N1Ym5ldHM6IHsgc3VibmV0VHlwZTogZWMyLlN1Ym5ldFR5cGUuUFJJVkFURV9XSVRIX0VHUkVTUyB9LFxuICBlbmRwb2ludDogZW5kcG9pbnQsXG59KTtcbi8vLyAhaGlkZVxuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/aws-cdk-rds-cluster-rotation.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.ts new file mode 100644 index 0000000000000..cb946fa6cc1e6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-rotation.lit.ts @@ -0,0 +1,42 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-rotation'); + +const vpc = new ec2.Vpc(stack, 'VPC'); +const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc }); +const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { + vpc, + service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, +}); + +/// !show +const cluster = new rds.DatabaseCluster(stack, 'Database', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, +}); + +cluster.addRotationSingleUser(); + +const clusterWithCustomRotationOptions = new rds.DatabaseCluster(stack, 'CustomRotationOptions', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, +}); +clusterWithCustomRotationOptions.addRotationSingleUser({ + automaticallyAfter: cdk.Duration.days(7), + excludeCharacters: '!@#$%^&*', + securityGroup, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + endpoint: endpoint, +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js new file mode 100644 index 0000000000000..5d2515b17bc0e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const kms = require("aws-cdk-lib/aws-kms"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const aws_rds_1 = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-s3-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); +const kmsKey = new kms.Key(stack, 'DbSecurity'); +const importBucket = new s3.Bucket(stack, 'ImportBucket'); +const exportBucket = new s3.Bucket(stack, 'ExportBucket'); +const cluster = new aws_rds_1.DatabaseCluster(stack, 'Database', { + engine: aws_rds_1.DatabaseClusterEngine.AURORA, + credentials: aws_rds_1.Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + vpc, + }, + storageEncryptionKey: kmsKey, + s3ImportBuckets: [importBucket], + s3ExportBuckets: [exportBucket], +}); +cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci1zMy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsdXN0ZXItczMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsaURBQTBGO0FBRTFGLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztBQUV6RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRXJELE1BQU0sTUFBTSxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFFaEQsTUFBTSxZQUFZLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxjQUFjLENBQUMsQ0FBQztBQUMxRCxNQUFNLFlBQVksR0FBRyxJQUF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uU01BTEwpLFxuICAgIHZwY1N1Ym5ldHM6IHsgc3VibmV0VHlwZTogZWMyLlN1Ym5ldFR5cGUuUFVCTElDIH0sXG4gICAgdnBjLFxuICB9LFxuICBzdG9yYWdlRW5jcnlwdGlvbktleToga21zS2V5LFxuICBzM0ltcG9ydEJ1Y2tldHM6IFtpbXBvcnRCdWNrZXRdLFxuICBzM0V4cG9ydEJ1Y2tldHM6IFtleHBvcnRCdWNrZXRdLFxufSk7XG5cbmNsdXN0ZXIuY29ubmVjdGlvbnMuYWxsb3dEZWZhdWx0UG9ydEZyb21BbnlJcHY0KCdPcGVuIHRvIHRoZSB3b3JsZCcpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/aws-cdk-rds-s3-integ.template.json diff --git a/packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-event-sources/test/integ.sqs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js new file mode 100644 index 0000000000000..086f280ebac80 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-s3-mysql-8-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); +const importExportBucket = new s3.Bucket(stack, 'ImportExportBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new rds.DatabaseCluster(stack, 'Database', { + engine: rds.DatabaseClusterEngine.auroraMysql({ + version: rds.AuroraMysqlEngineVersion.VER_3_01_0, + }), + credentials: rds.Credentials.fromUsername('admin', { + password: cdk.SecretValue.plainText('7959866cacc02c2d243ecfe177464fe6'), + }), + instances: 1, + instanceProps: { vpc }, + s3ImportBuckets: [importExportBucket], + s3ExportBuckets: [importExportBucket], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci1zMy5teXNxbC04LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY2x1c3Rlci1zMy5teXNxbC04LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLHlDQUF5QztBQUN6QyxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsOEJBQThCLENBQUMsQ0FBQztBQUVqRSxNQ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\ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/aws-cdk-rds-s3-mysql-8-integ.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.ts similarity index 80% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.ts index f36fffc15c59c..03e3f25981ff5 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.mysql-8.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-s3-mysql-8-integ'); diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.ts similarity index 83% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.ts index 03953ca6fd899..fe427b9a9723d 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-s3.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { Credentials, DatabaseCluster, DatabaseClusterEngine } from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { Credentials, DatabaseCluster, DatabaseClusterEngine } from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-s3-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js new file mode 100644 index 0000000000000..e7bb9bae63099 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cr = require("aws-cdk-lib/custom-resources"); +const constructs_1 = require("constructs"); +const rds = require("aws-cdk-lib/aws-rds"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 1 }); + const cluster = new rds.DatabaseCluster(this, 'Cluster', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_10_2 }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + const snapshoter = new Snapshoter(this, 'Snapshoter', { + cluster, + snapshotIdentifier: 'cdk-integ-cluster-snapshot', + }); + const fromSnapshot = new rds.DatabaseClusterFromSnapshot(this, 'FromSnapshot', { + snapshotIdentifier: snapshoter.snapshotArn, + snapshotCredentials: rds.SnapshotCredentials.fromGeneratedSecret('admin'), + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_10_2 }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + fromSnapshot.addRotationSingleUser(); + } +} +class Snapshoter extends constructs_1.Construct { + constructor(scope, id, props) { + super(scope, id); + const clusterArn = aws_cdk_lib_1.Stack.of(this).formatArn({ + service: 'rds', + resource: 'cluster', + resourceName: props.cluster.clusterIdentifier, + arnFormat: aws_cdk_lib_1.ArnFormat.COLON_RESOURCE_NAME, + }); + const snapshotArn = aws_cdk_lib_1.Stack.of(this).formatArn({ + service: 'rds', + resource: 'cluster-snapshot', + resourceName: props.snapshotIdentifier, + arnFormat: aws_cdk_lib_1.ArnFormat.COLON_RESOURCE_NAME, + }); + const code = lambda.Code.fromAsset(path.join(__dirname, 'snapshot-handler')); + const onEventHandler = new lambda.Function(this, 'OnEventHandler', { + code, + runtime: lambda.Runtime.NODEJS_16_X, + handler: 'index.onEventHandler', + }); + onEventHandler.addToRolePolicy(new iam.PolicyStatement({ + actions: ['rds:CreateDBClusterSnapshot', 'rds:DeleteDBClusterSnapshot'], + resources: [clusterArn, snapshotArn], + })); + const isCompleteHandler = new lambda.Function(this, 'IsCompleteHandler', { + code, + runtime: lambda.Runtime.NODEJS_16_X, + handler: 'index.isCompleteHandler', + }); + isCompleteHandler.addToRolePolicy(new iam.PolicyStatement({ + actions: ['rds:DescribeDBClusterSnapshots'], + resources: [clusterArn, snapshotArn], + })); + const provider = new cr.Provider(this, 'SnapshotProvider', { + onEventHandler, + isCompleteHandler, + }); + const customResource = new aws_cdk_lib_1.CustomResource(this, 'Snapshot', { + resourceType: 'Custom::Snapshoter', + serviceToken: provider.serviceToken, + properties: { + DBClusterIdentifier: props.cluster.clusterIdentifier, + DBClusterSnapshotIdentifier: props.snapshotIdentifier, + }, + }); + this.snapshotArn = customResource.getAttString('DBClusterSnapshotArn'); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-cluster-snapshot'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci1zbmFwc2hvdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsdXN0ZXItc25hcHNob3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsMkNBQTJD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icsIHtcbiAgICAgIG9uRXZlbnRIYW5kbGVyLFxuICAgICAgaXNDb21wbGV0ZUhhbmRsZXIsXG4gICAgfSk7XG5cbiAgICBjb25zdCBjdXN0b21SZXNvdXJjZSA9IG5ldyBDdXN0b21SZXNvdXJjZSh0aGlzLCAnU25hcHNob3QnLCB7XG4gICAgICByZXNvdXJjZVR5cGU6ICdDdXN0b206OlNuYXBzaG90ZXInLFxuICAgICAgc2VydmljZVRva2VuOiBwcm92aWRlci5zZXJ2aWNlVG9rZW4sXG4gICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgIERCQ2x1c3RlcklkZW50aWZpZXI6IHByb3BzLmNsdXN0ZXIuY2x1c3RlcklkZW50aWZpZXIsXG4gICAgICAgIERCQ2x1c3RlclNuYXBzaG90SWRlbnRpZmllcjogcHJvcHMuc25hcHNob3RJZGVudGlmaWVyLFxuICAgICAgfSxcbiAgICB9KTtcbiAgICB0aGlzLnNuYXBzaG90QXJuID0gY3VzdG9tUmVzb3VyY2UuZ2V0QXR0U3RyaW5nKCdEQkNsdXN0ZXJTbmFwc2hvdEFybicpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbm5ldyBUZXN0U3RhY2soYXBwLCAnY2RrLWludGVnLWNsdXN0ZXItc25hcHNob3QnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.ts new file mode 100644 index 0000000000000..a9ce649e1121c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.ts @@ -0,0 +1,63 @@ +/* eslint-disable no-console */ +import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '../../../../custom-resources/lib/provider-framework/types'; +import { RDS } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +export async function onEventHandler(event: OnEventRequest): Promise { + console.log('Event: %j', event); + + const rds = new RDS(); + + const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; + + if (event.RequestType === 'Create' || event.RequestType === 'Update') { + const data = await rds.createDBClusterSnapshot({ + DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + return { + PhysicalResourceId: physicalResourceId, + Data: { + DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, + }, + }; + } + + if (event.RequestType === 'Delete') { + await rds.deleteDBClusterSnapshot({ + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + } + + return { + PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, + }; +} + +export async function isCompleteHandler(event: IsCompleteRequest): Promise { + console.log('Event: %j', event); + + const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); + + switch (event.RequestType) { + case 'Create': + case 'Update': + return { IsComplete: snapshotStatus === 'available' }; + case 'Delete': + return { IsComplete: snapshotStatus === undefined }; + } +} + +async function tryGetClusterSnapshotStatus(identifier: string): Promise { + try { + const rds = new RDS(); + const data = await rds.describeDBClusterSnapshots({ + DBClusterSnapshotIdentifier: identifier, + }).promise(); + return data.DBClusterSnapshots?.[0].Status; + } catch (err: any) { + if (err.code === 'DBClusterSnapshotNotFoundFault') { + return undefined; + } + throw err; + } +} diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk-integ-cluster-snapshot.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.ts similarity index 92% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.ts index 771bf19532f96..8bf069b8668c7 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster-snapshot.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, ArnFormat, CustomResource, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, ArnFormat, CustomResource, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; import { Construct } from 'constructs'; -import * as rds from '../lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js new file mode 100644 index 0000000000000..cb219f7e2ef10 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const cdk = require("aws-cdk-lib"); +const aws_rds_1 = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); +const params = new aws_rds_1.ParameterGroup(stack, 'Params', { + engine: aws_rds_1.DatabaseClusterEngine.AURORA, + description: 'A nice parameter group', + parameters: { + character_set_database: 'utf8mb4', + }, +}); +const kmsKey = new kms.Key(stack, 'DbSecurity'); +const cluster = new aws_rds_1.DatabaseCluster(stack, 'Database', { + engine: aws_rds_1.DatabaseClusterEngine.AURORA, + credentials: aws_rds_1.Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + vpc, + }, + parameterGroup: params, + storageEncryptionKey: kmsKey, +}); +cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +const role = new iam.Role(stack, 'ClusterIamAccess', { + assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), +}); +const clusterIamAuthArn = stack.formatArn({ + service: 'rds-db', + resource: `dbuser:${cluster.clusterResourceIdentifier}`, + resourceName: 'db_user', +}); +role.addToPolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['rds-db:connect'], + resources: [clusterIamAuthArn], +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsaURBQTBHO0FBRTFHLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLENBQUMsQ0FBQztBQUV0RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDO0FBRXJELE1BQU0sTUFBTSxHQUFHLElBQUksd0JBQWMsQ0FBQyxLQUFLLEVBQUUsUUFBUSxFQUFFO0lBQ2pELE1BQU0sRUFBRSwrQkFBcUIsQ0FBQyxNQUFNO0lBQ3BDLFdBQVcsRUFBRSx3QkFBd0I7SUFDckMsVUFBVSxFQUFFO1FBQ1Ysc0JBQXNCLEVBQUUsU0FBUztLQUNsQztDQUNG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m9sZShzdGFjaywgJ0NsdXN0ZXJJYW1BY2Nlc3MnLCB7XG4gIGFzc3VtZWRCeTogbmV3IGlhbS5TZXJ2aWNlUHJpbmNpcGFsKCdlY3MtdGFza3MuYW1hem9uYXdzLmNvbScpLFxufSk7XG5jb25zdCBjbHVzdGVySWFtQXV0aEFybiA9IHN0YWNrLmZvcm1hdEFybih7XG4gIHNlcnZpY2U6ICdyZHMtZGInLFxuICByZXNvdXJjZTogYGRidXNlcjoke2NsdXN0ZXIuY2x1c3RlclJlc291cmNlSWRlbnRpZmllcn1gLFxuICByZXNvdXJjZU5hbWU6ICdkYl91c2VyJyxcbn0pO1xucm9sZS5hZGRUb1BvbGljeShcbiAgbmV3IGlhbS5Qb2xpY3lTdGF0ZW1lbnQoe1xuICAgIGVmZmVjdDogaWFtLkVmZmVjdC5BTExPVyxcbiAgICBhY3Rpb25zOiBbJ3Jkcy1kYjpjb25uZWN0J10sXG4gICAgcmVzb3VyY2VzOiBbY2x1c3RlcklhbUF1dGhBcm5dLFxuICB9KSxcbik7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/aws-cdk-rds-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.ts new file mode 100644 index 0000000000000..1aef156ad9bcc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.cluster.ts @@ -0,0 +1,52 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; +import { Credentials, DatabaseCluster, DatabaseClusterEngine, ParameterGroup } from 'aws-cdk-lib/aws-rds'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); + +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); + +const params = new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'A nice parameter group', + parameters: { + character_set_database: 'utf8mb4', + }, +}); + +const kmsKey = new kms.Key(stack, 'DbSecurity'); + +const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + vpc, + }, + parameterGroup: params, + storageEncryptionKey: kmsKey, +}); + +cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); + +const role = new iam.Role(stack, 'ClusterIamAccess', { + assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), +}); +const clusterIamAuthArn = stack.formatArn({ + service: 'rds-db', + resource: `dbuser:${cluster.clusterResourceIdentifier}`, + resourceName: 'db_user', +}); +role.addToPolicy( + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['rds-db:connect'], + resources: [clusterIamAuthArn], + }), +); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js new file mode 100644 index 0000000000000..f4cbfddb23a71 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-dual-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2, natGateways: 0 }); +const ipv6 = new ec2.CfnVPCCidrBlock(stack, 'Ipv6CidrBlock', { vpcId: vpc.vpcId, amazonProvidedIpv6CidrBlock: true }); +vpc.isolatedSubnets.forEach((subnet, idx) => { + const cfnSubnet = subnet.node.defaultChild; + cfnSubnet.ipv6CidrBlock = cdk.Fn.select(idx, cdk.Fn.cidr(cdk.Fn.select(0, vpc.vpcIpv6CidrBlocks), 256, '64')); + cfnSubnet.addDependsOn(ipv6); +}); +new rds.DatabaseInstance(stack, 'DualstackInstance', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + credentials: rds.Credentials.fromUsername('postgres', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO), + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + multiAz: false, + publiclyAccessible: false, + networkType: rds.NetworkType.DUAL, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new rds.DatabaseInstance(stack, 'Ipv4Instance', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + credentials: rds.Credentials.fromUsername('postgres', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MICRO), + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + multiAz: false, + publiclyAccessible: false, + networkType: rds.NetworkType.IPV4, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new integ_tests_alpha_1.IntegTest(app, 'instance-dual-test', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2UtZHVhbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmluc3RhbmNlLWR1YWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCwyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxpQ0FBaUMsQ0FBQyxDQUFDO0FBRXBFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxXQUFXLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUNyRSxNQUFNLElBQUksR0FBRyxJQUFJLEdBQUcsQ0FBQyxlQUFlLENBQUMsS0FBSyxFQUFFLGVBQWUsRUFBRSxFQUFFLEtBQUssRUFBRSxHQUFHLENBQUMsS0FBSyxFQUFFLDJCQUEyQixFQUFFLElBQUksRUFBRSxDQU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lVmVyc2lvbi5WRVJfMTVfMiB9KSxcbiAgY3JlZGVudGlhbHM6IHJkcy5DcmVkZW50aWFscy5mcm9tVXNlcm5hbWUoJ3Bvc3RncmVzJywgeyBwYXNzd29yZDogY2RrLlNlY3JldFZhbHVlLnVuc2FmZVBsYWluVGV4dCgnNzk1OTg2NmNhY2MwMmMyZDI0M2VjZmUxNzc0NjRmZTYnKSB9KSxcbiAgaW5zdGFuY2VUeXBlOiBlYzIuSW5zdGFuY2VUeXBlLm9mKGVjMi5JbnN0YW5jZUNsYXNzLkJVUlNUQUJMRTMsIGVjMi5JbnN0YW5jZVNpemUuTUlDUk8pLFxuICB2cGMsXG4gIHZwY1N1Ym5ldHM6IHsgc3VibmV0VHlwZTogZWMyLlN1Ym5ldFR5cGUuUFJJVkFURV9JU09MQVRFRCB9LFxuICBtdWx0aUF6OiBmYWxzZSxcbiAgcHVibGljbHlBY2Nlc3NpYmxlOiBmYWxzZSxcbiAgbmV0d29ya1R5cGU6IHJkcy5OZXR3b3JrVHlwZS5JUFY0LFxuICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnaW5zdGFuY2UtZHVhbC10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/aws-cdk-rds-instance-dual-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/instancedualtestDefaultTestDeployAssertD87FA35D.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.ts similarity index 90% rename from packages/@aws-cdk/aws-rds/test/integ.instance-dual.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.ts index c684c3550694f..02c00535ccec5 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.instance-dual.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-dual.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-dual-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js new file mode 100644 index 0000000000000..766380b840016 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +class DatabaseInstanceStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc'); + new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_21 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + credentials: rds.Credentials.fromGeneratedSecret('admin', { excludeCharacters: '!&*^#@()' }), + vpc, + databaseName: 'CDKDB', + storageEncrypted: true, + backupRetention: cdk.Duration.days(0), + deleteAutomatedBackups: true, + }); + } +} +new DatabaseInstanceStack(app, 'aws-cdk-rds-fixed-username'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIj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vZihlYzIuSW5zdGFuY2VDbGFzcy5CVVJTVEFCTEUzLCBlYzIuSW5zdGFuY2VTaXplLlNNQUxMKSxcbiAgICAgIGNyZWRlbnRpYWxzOiByZHMuQ3JlZGVudGlhbHMuZnJvbUdlbmVyYXRlZFNlY3JldCgnYWRtaW4nLCB7IGV4Y2x1ZGVDaGFyYWN0ZXJzOiAnISYqXiNAKCknIH0pLFxuICAgICAgdnBjLFxuICAgICAgZGF0YWJhc2VOYW1lOiAnQ0RLREInLFxuICAgICAgc3RvcmFnZUVuY3J5cHRlZDogdHJ1ZSxcbiAgICAgIGJhY2t1cFJldGVudGlvbjogY2RrLkR1cmF0aW9uLmRheXMoMCksXG4gICAgICBkZWxldGVBdXRvbWF0ZWRCYWNrdXBzOiB0cnVlLFxuICAgIH0pO1xuICB9XG59XG5cbm5ldyBEYXRhYmFzZUluc3RhbmNlU3RhY2soYXBwLCAnYXdzLWNkay1yZHMtZml4ZWQtdXNlcm5hbWUnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/aws-cdk-rds-fixed-username.template.json diff --git a/packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-lambda-nodejs/test/integ.esm.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.ts similarity index 86% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.ts index 04b9746aa409a..b518a777cb1f5 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-from-generated-password.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js new file mode 100644 index 0000000000000..a152df1a1efed --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_rds_1 = require("aws-cdk-lib/aws-rds"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const vpc = new aws_ec2_1.Vpc(this, 'Vpc', { maxAzs: 2, natGateways: 1 }); + new aws_rds_1.DatabaseInstance(this, 'Instance', { + engine: aws_rds_1.DatabaseInstanceEngine.mysql({ version: aws_rds_1.MysqlEngineVersion.VER_8_0_30 }), + instanceType: aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.BURSTABLE3, aws_ec2_1.InstanceSize.SMALL), + vpc, + allocatedStorage: 1000, + storageType: aws_rds_1.StorageType.GP3, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ.IntegTest(app, 'InstanceGp3Test', { + testCases: [new TestStack(app, 'cdk-integ-rds-instance-gp3')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2UtZ3AzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW5zdGFuY2UtZ3AzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQXFGO0FBQ3JGLDZDQUF3RDtBQUN4RCxvREFBb0Q7QUFFcEQsaURBQWdIO0FBRWhILE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVO1FBQ3RDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxHQUFHLEdBQUcsSUFBSSxhQUFHLENBQUMsSUFBSSxFQUFFLEtBQUssRUFBRSxFQUFFLE1BQU0sRUFBRSxDQUFDLEVBQUUsV0FBVyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7UUFFaEUsSUFBSSwwQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFO1lBQ3JDLE1BQU0sRUFBRSxnQ0FBc0IsQ0FBQyxLQUFLLENBQUMsRUFBRSxPQUFPLEVBQUUsNEJBQWtCLENBQUMsVUFBVSxFQUFFLENBQUM7WUFDaEYsWUFBWSxFQUFFLHNCQUFZLENBQUMsRUFBRSxDQUFDLHVC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Y3RvcihzY29wZTogQ29uc3RydWN0LCBpZDogc3RyaW5nKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIGNvbnN0IHZwYyA9IG5ldyBWcGModGhpcywgJ1ZwYycsIHsgbWF4QXpzOiAyLCBuYXRHYXRld2F5czogMSB9KTtcblxuICAgIG5ldyBEYXRhYmFzZUluc3RhbmNlKHRoaXMsICdJbnN0YW5jZScsIHtcbiAgICAgIGVuZ2luZTogRGF0YWJhc2VJbnN0YW5jZUVuZ2luZS5teXNxbCh7IHZlcnNpb246IE15c3FsRW5naW5lVmVyc2lvbi5WRVJfOF8wXzMwIH0pLFxuICAgICAgaW5zdGFuY2VUeXBlOiBJbnN0YW5jZVR5cGUub2YoSW5zdGFuY2VDbGFzcy5CVVJTVEFCTEUzLCBJbnN0YW5jZVNpemUuU01BTEwpLFxuICAgICAgdnBjLFxuICAgICAgYWxsb2NhdGVkU3RvcmFnZTogMTAwMCxcbiAgICAgIHN0b3JhZ2VUeXBlOiBTdG9yYWdlVHlwZS5HUDMsXG4gICAgICByZW1vdmFsUG9saWN5OiBSZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ0luc3RhbmNlR3AzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbbmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctcmRzLWluc3RhbmNlLWdwMycpXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/InstanceGp3TestDefaultTestDeployAssert21C147A7.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/cdk-integ-rds-instance-gp3.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-dual.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.ts similarity index 82% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.ts index d93bc8c9f8d52..a043c8c525c79 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-gp3.ts @@ -1,8 +1,8 @@ -import { InstanceClass, InstanceSize, InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import { InstanceClass, InstanceSize, InstanceType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import { DatabaseInstance, DatabaseInstanceEngine, MysqlEngineVersion, StorageType } from '../lib'; +import { DatabaseInstance, DatabaseInstanceEngine, MysqlEngineVersion, StorageType } from 'aws-cdk-lib/aws-rds'; class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js new file mode 100644 index 0000000000000..26c669371e250 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-s3-postgres-integ'); +new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc: new ec2.Vpc(stack, 'VPC', { maxAzs: 2, natGateways: 1 }), + multiAz: false, + publiclyAccessible: true, + iamAuthentication: true, + s3ImportBuckets: [new s3.Bucket(stack, 'ImportBucket', { removalPolicy: cdk.RemovalPolicy.DESTROY })], + s3ExportBuckets: [new s3.Bucket(stack, 'ExportBucket', { removalPolicy: cdk.RemovalPolicy.DESTROY })], + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2UtczMtcG9zdGdyZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5pbnN0YW5jZS1zMy1wb3N0Z3Jlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLDJDQUEyQztBQUUzQyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHdDQUF3QyxDQUFDLENBQUM7QUFFM0UsSUFBSSxHQUFHLENBQUMsZ0JBQWdCLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUMxQyxNQUFNLEVBQUUsR0FBRyxDQUFDLHNCQUFzQixDQUFDLFFBQVEsQ0FBQyxFQUFFLE9BQU8sRUFBRSxHQUFHLENBQUMscUJBQXFCLENBQUMsUUFBUSxFQUFFLENBQUM7SUFDNUYsR0FBRyxFQUFFLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxXQUFXLEVBQUUsQ0FBQyxFQUFFLENBQ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dmVyc2lvbjogcmRzLlBvc3RncmVzRW5naW5lVmVyc2lvbi5WRVJfMTVfMiB9KSxcbiAgdnBjOiBuZXcgZWMyLlZwYyhzdGFjaywgJ1ZQQycsIHsgbWF4QXpzOiAyLCBuYXRHYXRld2F5czogMSB9KSxcbiAgbXVsdGlBejogZmFsc2UsXG4gIHB1YmxpY2x5QWNjZXNzaWJsZTogdHJ1ZSxcbiAgaWFtQXV0aGVudGljYXRpb246IHRydWUsXG4gIHMzSW1wb3J0QnVja2V0czogW25ldyBzMy5CdWNrZXQoc3RhY2ssICdJbXBvcnRCdWNrZXQnLCB7IHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1kgfSldLFxuICBzM0V4cG9ydEJ1Y2tldHM6IFtuZXcgczMuQnVja2V0KHN0YWNrLCAnRXhwb3J0QnVja2V0JywgeyByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZIH0pXSxcbiAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/aws-cdk-rds-instance-s3-postgres-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.ts similarity index 79% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.ts index c7a9d487e2ad1..2994bc7928cdc 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.instance-s3-postgres.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3-postgres.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-s3-postgres-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js new file mode 100644 index 0000000000000..4e50dcb70d492 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const aws_rds_1 = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-s3-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); +const importBucket = new s3.Bucket(stack, 'ImportBucket', { removalPolicy: cdk.RemovalPolicy.DESTROY }); +const exportBucket = new s3.Bucket(stack, 'ExportBucket', { removalPolicy: cdk.RemovalPolicy.DESTROY }); +new aws_rds_1.DatabaseInstance(stack, 'Database', { + engine: aws_rds_1.DatabaseInstanceEngine.sqlServerSe({ version: aws_rds_1.SqlServerEngineVersion.VER_14 }), + vpc, + licenseModel: aws_rds_1.LicenseModel.LICENSE_INCLUDED, + s3ImportBuckets: [importBucket], + s3ExportBuckets: [exportBucket], + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2UtczMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5pbnN0YW5jZS1zMy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLGlEQUFxSDtBQUVySCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLCtCQUErQixDQUFDLENBQUM7QUFFbEUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUFNLFlBQVksR0FBRyxJQ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Nkay1saWIvYXdzLXJkcyc7XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5jb25zdCBzdGFjayA9IG5ldyBjZGsuU3RhY2soYXBwLCAnYXdzLWNkay1yZHMtaW5zdGFuY2UtczMtaW50ZWcnKTtcblxuY29uc3QgdnBjID0gbmV3IGVjMi5WcGMoc3RhY2ssICdWUEMnLCB7IG1heEF6czogMiB9KTtcblxuY29uc3QgaW1wb3J0QnVja2V0ID0gbmV3IHMzLkJ1Y2tldChzdGFjaywgJ0ltcG9ydEJ1Y2tldCcsIHsgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSB9KTtcbmNvbnN0IGV4cG9ydEJ1Y2tldCA9IG5ldyBzMy5CdWNrZXQoc3RhY2ssICdFeHBvcnRCdWNrZXQnLCB7IHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1kgfSk7XG5cbm5ldyBEYXRhYmFzZUluc3RhbmNlKHN0YWNrLCAnRGF0YWJhc2UnLCB7XG4gIGVuZ2luZTogRGF0YWJhc2VJbnN0YW5jZUVuZ2luZS5zcWxTZXJ2ZXJTZSh7IHZlcnNpb246IFNxbFNlcnZlckVuZ2luZVZlcnNpb24uVkVSXzE0IH0pLFxuICB2cGMsXG4gIGxpY2Vuc2VNb2RlbDogTGljZW5zZU1vZGVsLkxJQ0VOU0VfSU5DTFVERUQsXG4gIHMzSW1wb3J0QnVja2V0czogW2ltcG9ydEJ1Y2tldF0sXG4gIHMzRXhwb3J0QnVja2V0czogW2V4cG9ydEJ1Y2tldF0sXG4gIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/aws-cdk-rds-instance-s3-integ.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.ts similarity index 80% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.ts index 317e3c74abb57..2cf9b20b227fe 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance-s3.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { DatabaseInstance, DatabaseInstanceEngine, LicenseModel, SqlServerEngineVersion } from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { DatabaseInstance, DatabaseInstanceEngine, LicenseModel, SqlServerEngineVersion } from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-instance-s3-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js new file mode 100644 index 0000000000000..b9610476e8f47 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js @@ -0,0 +1,95 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudwatch = require("aws-cdk-lib/aws-cloudwatch"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const targets = require("aws-cdk-lib/aws-events-targets"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const logs = require("aws-cdk-lib/aws-logs"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +class DatabaseInstanceStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + /// !show + // Set open cursors with parameter group + const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + parameters: { + open_cursors: '2500', + }, + }); + /// Add XMLDB and OEM with option group + const optionGroup = new rds.OptionGroup(this, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + configurations: [ + { + name: 'LOCATOR', + }, + { + name: 'OEM', + port: 1158, + vpc, + }, + ], + }); + // Allow connections to OEM + optionGroup.optionConnections.OEM.connections.allowDefaultPortFromAnyIpv4(); + // Database instance with production values + const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + licenseModel: rds.LicenseModel.BRING_YOUR_OWN_LICENSE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), + multiAz: true, + storageType: rds.StorageType.IO1, + credentials: rds.Credentials.fromUsername('syscdk'), + vpc, + databaseName: 'ORCL', + storageEncrypted: true, + backupRetention: cdk.Duration.days(7), + monitoringInterval: cdk.Duration.seconds(60), + enablePerformanceInsights: true, + cloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener', + ], + cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH, + autoMinorVersionUpgrade: true, + optionGroup, + parameterGroup, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + }); + // Allow connections on default port from any IPV4 + instance.connections.allowDefaultPortFromAnyIpv4(); + // Rotate the master user password every 30 days + instance.addRotationSingleUser(); + // Add alarm for high CPU + new cloudwatch.Alarm(this, 'HighCPU', { + metric: instance.metricCPUUtilization(), + threshold: 90, + evaluationPeriods: 1, + }); + // Trigger Lambda function on instance availability events + const fn = new lambda.Function(this, 'Function', { + code: lambda.Code.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const availabilityRule = instance.onEvent('Availability', { target: new targets.LambdaFunction(fn) }); + availabilityRule.addEventPattern({ + detail: { + EventCategories: [ + 'availability', + ], + }, + }); + /// !hide + } +} +new DatabaseInstanceStack(app, 'aws-cdk-rds-instance'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW5zdGFuY2UubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW5zdGFuY2UubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseURBQXlEO0FBQ3pELDJDQUEyQztBQUMzQywwREFBMEQ7QUFDMUQsaURBQWlEO0FBQ2pELDZDQUE2QztBQUM3QyxtQ0FBbUM7QUFDbkMsNkNBQTR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LyBUcmlnZ2VyIExhbWJkYSBmdW5jdGlvbiBvbiBpbnN0YW5jZSBhdmFpbGFiaWxpdHkgZXZlbnRzXG4gICAgY29uc3QgZm4gPSBuZXcgbGFtYmRhLkZ1bmN0aW9uKHRoaXMsICdGdW5jdGlvbicsIHtcbiAgICAgIGNvZGU6IGxhbWJkYS5Db2RlLmZyb21JbmxpbmUoJ2V4cG9ydHMuaGFuZGxlciA9IChldmVudCkgPT4gY29uc29sZS5sb2coZXZlbnQpOycpLFxuICAgICAgaGFuZGxlcjogJ2luZGV4LmhhbmRsZXInLFxuICAgICAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gICAgfSk7XG5cbiAgICBjb25zdCBhdmFpbGFiaWxpdHlSdWxlID0gaW5zdGFuY2Uub25FdmVudCgnQXZhaWxhYmlsaXR5JywgeyB0YXJnZXQ6IG5ldyB0YXJnZXRzLkxhbWJkYUZ1bmN0aW9uKGZuKSB9KTtcbiAgICBhdmFpbGFiaWxpdHlSdWxlLmFkZEV2ZW50UGF0dGVybih7XG4gICAgICBkZXRhaWw6IHtcbiAgICAgICAgRXZlbnRDYXRlZ29yaWVzOiBbXG4gICAgICAgICAgJ2F2YWlsYWJpbGl0eScsXG4gICAgICAgIF0sXG4gICAgICB9LFxuICAgIH0pO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbm5ldyBEYXRhYmFzZUluc3RhbmNlU3RhY2soYXBwLCAnYXdzLWNkay1yZHMtaW5zdGFuY2UnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/aws-cdk-rds-instance.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.ts new file mode 100644 index 0000000000000..e51ac3bb7f7e4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.instance.lit.ts @@ -0,0 +1,105 @@ +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; +import { RemovalPolicy } from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; + +const app = new cdk.App(); + +class DatabaseInstanceStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + + /// !show + // Set open cursors with parameter group + const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + parameters: { + open_cursors: '2500', + }, + }); + + /// Add XMLDB and OEM with option group + const optionGroup = new rds.OptionGroup(this, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + configurations: [ + { + name: 'LOCATOR', + }, + { + name: 'OEM', + port: 1158, + vpc, + }, + ], + }); + + // Allow connections to OEM + optionGroup.optionConnections.OEM.connections.allowDefaultPortFromAnyIpv4(); + + // Database instance with production values + const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + licenseModel: rds.LicenseModel.BRING_YOUR_OWN_LICENSE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), + multiAz: true, + storageType: rds.StorageType.IO1, + credentials: rds.Credentials.fromUsername('syscdk'), + vpc, + databaseName: 'ORCL', + storageEncrypted: true, + backupRetention: cdk.Duration.days(7), + monitoringInterval: cdk.Duration.seconds(60), + enablePerformanceInsights: true, + cloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener', + ], + cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH, + autoMinorVersionUpgrade: true, // required to be true if LOCATOR is used in the option group + optionGroup, + parameterGroup, + removalPolicy: RemovalPolicy.DESTROY, + }); + + // Allow connections on default port from any IPV4 + instance.connections.allowDefaultPortFromAnyIpv4(); + + // Rotate the master user password every 30 days + instance.addRotationSingleUser(); + + // Add alarm for high CPU + new cloudwatch.Alarm(this, 'HighCPU', { + metric: instance.metricCPUUtilization(), + threshold: 90, + evaluationPeriods: 1, + }); + + // Trigger Lambda function on instance availability events + const fn = new lambda.Function(this, 'Function', { + code: lambda.Code.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const availabilityRule = instance.onEvent('Availability', { target: new targets.LambdaFunction(fn) }); + availabilityRule.addEventPattern({ + detail: { + EventCategories: [ + 'availability', + ], + }, + }); + /// !hide + } +} + +new DatabaseInstanceStack(app, 'aws-cdk-rds-instance'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js new file mode 100644 index 0000000000000..e8eff43a6deb4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-proxy'); +const vpc = new ec2.Vpc(stack, 'vpc', { maxAzs: 2 }); +const dbInstance = new rds.DatabaseInstance(stack, 'dbInstance', { + engine: rds.DatabaseInstanceEngine.postgres({ + version: rds.PostgresEngineVersion.VER_15_2, + }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), + credentials: rds.Credentials.fromUsername('master', { + excludeCharacters: '"@/\\', + }), + vpc, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +new rds.DatabaseProxy(stack, 'dbProxy', { + borrowTimeout: cdk.Duration.seconds(30), + maxConnectionsPercent: 50, + secrets: [dbInstance.secret], + proxyTarget: rds.ProxyTarget.fromInstance(dbInstance), + vpc, +}); +const cluster = new rds.DatabaseCluster(stack, 'dbCluster', { + engine: rds.DatabaseClusterEngine.auroraPostgres({ + version: rds.AuroraPostgresEngineVersion.VER_14_5, + }), + instanceProps: { vpc }, +}); +new rds.DatabaseProxy(stack, 'Proxy', { + dbProxyName: 'cluster-db-proxy', + proxyTarget: rds.ProxyTarget.fromCluster(cluster), + secrets: [cluster.secret], + vpc, +}); +new integ.IntegTest(app, 'database-proxy-integ-test', { + testCases: [stack], + diffAssets: true, + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJveHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm94eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsNkNBQTRDO0FBQzVDLG9EQUFvRDtBQUNwRCwyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBRXRELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLEVBQUUsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7QUFFckQsTUFBTSxVQUFVLEdBQUcsSUFBSSxHQUFHLENBQUMsZ0JBQWdCLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRTtJQUMvRCxNQUFNLEVBQUUsR0FBRyxDQUFDLHNCQ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aW9uLlZFUl8xNF81LFxuICB9KSxcbiAgaW5zdGFuY2VQcm9wczogeyB2cGMgfSxcbn0pO1xuXG5uZXcgcmRzLkRhdGFiYXNlUHJveHkoc3RhY2ssICdQcm94eScsIHtcbiAgZGJQcm94eU5hbWU6ICdjbHVzdGVyLWRiLXByb3h5JyxcbiAgcHJveHlUYXJnZXQ6IHJkcy5Qcm94eVRhcmdldC5mcm9tQ2x1c3RlcihjbHVzdGVyKSxcbiAgc2VjcmV0czogW2NsdXN0ZXIuc2VjcmV0IV0sXG4gIHZwYyxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2RhdGFiYXNlLXByb3h5LWludGVnLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbiAgZGlmZkFzc2V0czogdHJ1ZSxcbiAgY2RrQ29tbWFuZE9wdGlvbnM6IHtcbiAgICBkZXBsb3k6IHtcbiAgICAgIGFyZ3M6IHtcbiAgICAgICAgcm9sbGJhY2s6IHRydWUsXG4gICAgICB9LFxuICAgIH0sXG4gIH0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/aws-cdk-rds-proxy.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/databaseproxyintegtestDefaultTestDeployAssert1DC3D9D5.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.proxy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.ts similarity index 85% rename from packages/@aws-cdk/aws-rds/test/integ.proxy.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.ts index b51366548913b..5b4986b3fd0d9 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.proxy.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.proxy.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { RemovalPolicy } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { RemovalPolicy } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-proxy'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js new file mode 100644 index 0000000000000..e973604abaff1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_ec2_1 = require("aws-cdk-lib/aws-ec2"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new aws_ec2_1.Vpc(this, 'Vpc', { + maxAzs: 2, + subnetConfiguration: [ + { + name: 'isolated', + subnetType: aws_ec2_1.SubnetType.PRIVATE_ISOLATED, + }, + ], + }); + const instanceType = aws_ec2_1.InstanceType.of(aws_ec2_1.InstanceClass.T3, aws_ec2_1.InstanceSize.SMALL); + const vpcSubnets = { subnetType: aws_ec2_1.SubnetType.PRIVATE_ISOLATED }; + const postgresSource = new rds.DatabaseInstance(this, 'PostgresSource', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + backupRetention: aws_cdk_lib_1.Duration.days(5), + instanceType, + vpc, + vpcSubnets, + }); + new rds.DatabaseInstanceReadReplica(this, 'PostgresReplica', { + sourceDatabaseInstance: postgresSource, + instanceType, + vpc, + vpcSubnets, + }); + const mysqlSource = new rds.DatabaseInstance(this, 'MysqlSource', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0 }), + backupRetention: aws_cdk_lib_1.Duration.days(5), + instanceType, + vpc, + vpcSubnets, + }); + const parameterGroup = new rds.ParameterGroup(this, 'ReplicaParameterGroup', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0 }), + parameters: { + wait_timeout: '86400', + }, + }); + new rds.DatabaseInstanceReadReplica(this, 'MysqlReplica', { + sourceDatabaseInstance: mysqlSource, + backupRetention: aws_cdk_lib_1.Duration.days(3), + instanceType, + vpc, + vpcSubnets, + parameterGroup, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-rds-read-replica'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucmVhZC1yZXBsaWNhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucmVhZC1yZXBsaWNhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWtIO0FBQ2xILDZDQUErRDtBQUUvRCwyQ0FBMkM7QUFFM0MsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLEdBQUcsR0FBRyxJQUFJLGFBQUcsQ0FBQyxJQUFJLEVBQUUsS0FBSyxFQUFFO1lBQy9CLE1BQU0sRUFBRSxDQUFDO1lBQ1QsbUJBQW1CLEVBQUU7Z0JBQ25CO29CQUNFLElBQUksRUFBRSxVQUFVO29CQUNoQixVQUFVLEVBQUUsb0JBQVUsQ0FBQyxnQkFBZ0I7aUJBQ3hDO2FBQ0Y7U0FDRixDQUFDLENBQUM7UUFFSCxNQUFNLFlBQVksR0FBRyxzQkFBWSxDQUFDLEVBQUUsQ0FBQyx1QkFBYSxDQUFDLEVBQUUsRUFBRSxzQkFBWSxDQUFDLEtBQUssQ0F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wZSxcbiAgICAgIHZwYyxcbiAgICAgIHZwY1N1Ym5ldHMsXG4gICAgICBwYXJhbWV0ZXJHcm91cCxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1yZHMtcmVhZC1yZXBsaWNhJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/cdk-rds-read-replica.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.read-replica.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.ts similarity index 92% rename from packages/@aws-cdk/aws-rds/test/integ.read-replica.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.ts index e00ab9256ba29..268ddc2aeff9b 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.read-replica.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.read-replica.ts @@ -1,7 +1,7 @@ -import { InstanceClass, InstanceSize, InstanceType, SubnetSelection, SubnetType, Vpc } from '@aws-cdk/aws-ec2'; -import { App, Duration, Stack, StackProps } from '@aws-cdk/core'; +import { InstanceClass, InstanceSize, InstanceType, SubnetSelection, SubnetType, Vpc } from 'aws-cdk-lib/aws-ec2'; +import { App, Duration, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as rds from '../lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js new file mode 100644 index 0000000000000..8092563ea7174 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integTests = require("@aws-cdk/integ-tests-alpha"); +const rds = require("aws-cdk-lib/aws-rds"); +class RollingInstanceUpdateTestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc', { + maxAzs: 2, + }); + new rds.DatabaseCluster(this, 'DatabaseCluster', { + engine: rds.DatabaseClusterEngine.AURORA, + instances: 3, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, + removalPolicy: cdk.RemovalPolicy.DESTROY, + instanceUpdateBehaviour: props.instanceUpdateBehaviour, + }); + } +} +// Beginning of the test suite +const app = new cdk.App(); +new integTests.IntegTest(app, 'InstanceUpdateBehaviorTests', { + testCases: [ + new RollingInstanceUpdateTestStack(app, 'BulkUpdate', { + instanceUpdateBehaviour: rds.InstanceUpdateBehaviour.BULK, + }), + new RollingInstanceUpdateTestStack(app, 'RollingUpdate', { + instanceUpdateBehaviour: rds.InstanceUpd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0Q2FzZXM6IFtcbiAgICBuZXcgUm9sbGluZ0luc3RhbmNlVXBkYXRlVGVzdFN0YWNrKGFwcCwgJ0J1bGtVcGRhdGUnLCB7XG4gICAgICBpbnN0YW5jZVVwZGF0ZUJlaGF2aW91cjogcmRzLkluc3RhbmNlVXBkYXRlQmVoYXZpb3VyLkJVTEssXG4gICAgfSksXG4gICAgbmV3IFJvbGxpbmdJbnN0YW5jZVVwZGF0ZVRlc3RTdGFjayhhcHAsICdSb2xsaW5nVXBkYXRlJywge1xuICAgICAgaW5zdGFuY2VVcGRhdGVCZWhhdmlvdXI6IHJkcy5JbnN0YW5jZVVwZGF0ZUJlaGF2aW91ci5ST0xMSU5HLFxuICAgIH0pLFxuICBdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/BulkUpdate.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/InstanceUpdateBehaviorTestsDefaultTestDeployAssert287956FD.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/RollingUpdate.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.ts similarity index 87% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.ts index 733e5023d56d0..2ffc31bf9dced 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.rolling-instance-updates.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integTests from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integTests from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; -import * as rds from '../lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; interface RollingInstanceUpdateTestStackProps extends cdk.StackProps { instanceUpdateBehaviour: rds.InstanceUpdateBehaviour; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js new file mode 100644 index 0000000000000..5740dc389a288 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-sls-cluster-no-vpc-integ'); +const cluster = new rds.ServerlessCluster(stack, 'Serverless Database Without VPC', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), + }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +const noCopyTagsCluster = new rds.ServerlessCluster(stack, 'Serverless Database Without VPC and Copy Tags', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), + }, + removalPolicy: cdk.RemovalPolicy.DESTROY, + copyTagsToSnapshot: false, +}); +noCopyTagsCluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmVybGVzcy1jbHVzdGVyLW5vLXZwYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNlcnZlcmxlc3MtY2x1c3Rlci1uby12cGMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsa0NBQWtDLENBQUMsQ0FBQztBQUVyRSxNQUFNLE9BQU8sR0FBRyxJQUFJLEdBQUcsQ0FBQyxpQkFBaUIsQ0FBQyxLQUFLLEVBQUUsaUNBQWlDLEVBQUU7SUFDbEYsTUFBTSxFQUFFLEdBQUcsQ0FBQyxxQkFBcUIsQ0FBQyxZQUFZO0lBQzlDLFdBQVcsRUFBRTtRQUNYLFFBQVEsRUFBRSxPQ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cm9tQW55SXB2NCgnT3BlbiB0byB0aGUgd29ybGQnKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/aws-cdk-sls-cluster-no-vpc-integ.template.json diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.ts similarity index 92% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.ts index b5d571f9a9978..25542d83df4d6 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-no-vpc.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-sls-cluster-no-vpc-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js new file mode 100644 index 0000000000000..9e00bfa565c05 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_rds_1 = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-integ-secret-rotation'); +const kmsKey = new kms.Key(stack, 'DbSecurity'); +const secret = new aws_rds_1.DatabaseSecret(stack, 'test-secret', { + username: 'admin', + dbname: 'admindb', + secretName: 'admin-secret', +}); +const cluster = new aws_rds_1.ServerlessCluster(stack, 'Database', { + engine: aws_rds_1.DatabaseClusterEngine.AURORA_MYSQL, + credentials: aws_rds_1.Credentials.fromSecret(secret), + storageEncryptionKey: kmsKey, +}); +secret.addRotationSchedule('test-schedule', { + hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), +}); +cluster.grantDataApiAccess(new iam.AccountRootPrincipal()); +cluster.grantDataApiAccess(new iam.ServicePrincipal('ecs-tasks.amazonaws.com')); +new integ_tests_alpha_1.IntegTest(app, 'cdk-rds-integ-secret-rotation', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmVybGVzcy1jbHVzdGVyLXNlY3JldC1yb3RhdGlvbi1jdXN0b20tbmFtZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zZXJ2ZXJsZXNzLWNsdXN0ZXItc2VjcmV0LXJvdGF0aW9uLWN1c3RvbS1uYW1lcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsaUVBQWlFO0FBQ2pFLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsaURBQTRHO0FBRTVHLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsbUNBQW1DLENBQUMsQ0FBQztBQUV0RSxNQUFNLE1BQU0sR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsS0FBSyxFQUFFLFlBQVksQ0FBQyxDQUFDO0FBQ2hELE1BQU0sTUFBTSxHQUFHLElBQUksd0JBQWMsQ0FBQyxLQUFLLEVBQUUsYUFBYSxFQUFFO0lBQ3RELFFBQVEsRUFBRSxPQUFPO0lBQ2pCLE1BQU0sRUFBRSxTQUFTO0lBQ2pCLFVBQVUsRUFBRSxjQUFjO0NBQzNCLENBQUMsQ0FBQztBQUVILE1BQU0sT0FBTyxHQUFHLElBQUksMkJBQWlCLENBQUMsS0FBSyxFQUFFLFVB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lUHJpbmNpcGFsKCdlY3MtdGFza3MuYW1hem9uYXdzLmNvbScpKTtcblxubmV3IEludGVnVGVzdChhcHAsICdjZGstcmRzLWludGVnLXNlY3JldC1yb3RhdGlvbicsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.ts similarity index 75% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.ts index bcedc5c287f12..cfeab28bd914f 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation-custom-names.ts @@ -1,9 +1,9 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Credentials, ServerlessCluster, DatabaseClusterEngine, DatabaseSecret } from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Credentials, ServerlessCluster, DatabaseClusterEngine, DatabaseSecret } from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-integ-secret-rotation'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js new file mode 100644 index 0000000000000..5ba107fbfb1d4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_rds_1 = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-integ-secret-rotation'); +const kmsKey = new kms.Key(stack, 'DbSecurity'); +const secret = new aws_rds_1.DatabaseSecret(stack, 'test-secret', { + username: 'admin', +}); +const cluster = new aws_rds_1.ServerlessCluster(stack, 'Database', { + engine: aws_rds_1.DatabaseClusterEngine.AURORA_MYSQL, + credentials: aws_rds_1.Credentials.fromSecret(secret), + storageEncryptionKey: kmsKey, +}); +secret.addRotationSchedule('test-schedule', { + hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), +}); +cluster.grantDataApiAccess(new iam.AccountRootPrincipal()); +cluster.grantDataApiAccess(new iam.ServicePrincipal('ecs-tasks.amazonaws.com')); +new integ_tests_alpha_1.IntegTest(app, 'cdk-rds-integ-secret-rotation', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmVybGVzcy1jbHVzdGVyLXNlY3JldC1yb3RhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNlcnZlcmxlc3MtY2x1c3Rlci1zZWNyZXQtcm90YXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLGlFQUFpRTtBQUNqRSxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELGlEQUE0RztBQUU1RyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG1DQUFtQyxDQUFDLENBQUM7QUFFdEUsTUFBTSxNQUFNLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxZQUFZLENBQUMsQ0FBQztBQUNoRCxNQUFNLE1BQU0sR0FBRyxJQUFJLHdCQUFjLENBQUMsS0FBSyxFQUFFLGFBQWE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FwaUFjY2VzcyhuZXcgaWFtLlNlcnZpY2VQcmluY2lwYWwoJ2Vjcy10YXNrcy5hbWF6b25hd3MuY29tJykpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2Nkay1yZHMtaW50ZWctc2VjcmV0LXJvdGF0aW9uJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/aws-cdk-rds-integ-secret-rotation.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/cdkrdsintegsecretrotationDefaultTestDeployAssert9780868B.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.ts new file mode 100644 index 0000000000000..2e69aa45045ed --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster-secret-rotation.ts @@ -0,0 +1,33 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Credentials, ServerlessCluster, DatabaseClusterEngine, DatabaseSecret } from 'aws-cdk-lib/aws-rds'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-integ-secret-rotation'); + +const kmsKey = new kms.Key(stack, 'DbSecurity'); +const secret = new DatabaseSecret(stack, 'test-secret', { + username: 'admin', +}); + +const cluster = new ServerlessCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + credentials: Credentials.fromSecret(secret), + storageEncryptionKey: kmsKey, +}); + +secret.addRotationSchedule('test-schedule', { + hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), +}); + +cluster.grantDataApiAccess(new iam.AccountRootPrincipal()); +cluster.grantDataApiAccess(new iam.ServicePrincipal('ecs-tasks.amazonaws.com')); + +new IntegTest(app, 'cdk-rds-integ-secret-rotation', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js new file mode 100644 index 0000000000000..7e52ef29a8912 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const rds = require("aws-cdk-lib/aws-rds"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const subnetGroup = new rds.SubnetGroup(stack, 'SubnetGroup', { + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + description: 'My Subnet Group', + subnetGroupName: 'MyNotLowerCaseSubnetGroupName', +}); +const cluster = new rds.ServerlessCluster(stack, 'Serverless Database', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), + }, + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + subnetGroup, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +const noCopyTagsCluster = new rds.ServerlessCluster(stack, 'Serverless Database Without Copy Tags', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), + }, + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + subnetGroup, + removalPolicy: cdk.RemovalPolicy.DESTROY, + copyTagsToSnapshot: false, +}); +noCopyTagsCluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmVybGVzcy1jbHVzdGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2VydmVybGVzcy1jbHVzdGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQywyQ0FBMkM7QUFFM0MsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDO0FBRXRELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ3BDLE1BQU0sRUFBRSxDQUFDO0NBQ1YsQ0FBQyxDQUFDO0FBQ0gsTUFBTSxXQUFXLEdBQUcsSUFBSSxHQUFHLENBQUMsV0FBVyxDQUFDLEtBQU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W92YWxQb2xpY3kuREVTVFJPWSxcbiAgY29weVRhZ3NUb1NuYXBzaG90OiBmYWxzZSxcbn0pO1xubm9Db3B5VGFnc0NsdXN0ZXIuY29ubmVjdGlvbnMuYWxsb3dEZWZhdWx0UG9ydEZyb21BbnlJcHY0KCdPcGVuIHRvIHRoZSB3b3JsZCcpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.assets.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/aws-cdk-rds-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.ts similarity index 91% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.ts index 04e06903e7011..150c1d637d365 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/integ.serverless-cluster.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as rds from 'aws-cdk-lib/aws-rds'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.d.ts new file mode 100644 index 0000000000000..e074ead763e0a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.d.ts @@ -0,0 +1,3 @@ +/// +export declare function onEventHandler(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; +export declare function isCompleteHandler(event: AWSCDKAsyncCustomResource.IsCompleteRequest): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.js new file mode 100644 index 0000000000000..96200908f12ba --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isCompleteHandler = exports.onEventHandler = void 0; +/* eslint-disable no-console */ +/// +const aws_sdk_1 = require("aws-sdk"); // eslint-disable-line import/no-extraneous-dependencies +async function onEventHandler(event) { + console.log('Event: %j', event); + const rds = new aws_sdk_1.RDS(); + const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; + if (event.RequestType === 'Create' || event.RequestType === 'Update') { + const data = await rds.createDBClusterSnapshot({ + DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + return { + PhysicalResourceId: physicalResourceId, + Data: { + DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, + }, + }; + } + if (event.RequestType === 'Delete') { + await rds.deleteDBClusterSnapshot({ + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + } + return { + PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, + }; +} +exports.onEventHandler = onEventHandler; +async function isCompleteHandler(event) { + console.log('Event: %j', event); + const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); + switch (event.RequestType) { + case 'Create': + case 'Update': + return { IsComplete: snapshotStatus === 'available' }; + case 'Delete': + return { IsComplete: snapshotStatus === undefined }; + } +} +exports.isCompleteHandler = isCompleteHandler; +async function tryGetClusterSnapshotStatus(identifier) { + try { + const rds = new aws_sdk_1.RDS(); + const data = await rds.describeDBClusterSnapshots({ + DBClusterSnapshotIdentifier: identifier, + }).promise(); + return data.DBClusterSnapshots?.[0].Status; + } + catch (err) { + if (err.code === 'DBClusterSnapshotNotFoundFault') { + return undefined; + } + throw err; + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IseUhBQXlIO0FBQ3pILHFDQUE4QixDQUFDLHdEQUF3RDtBQUVoRixLQUFLLFVBQVUsY0FBYyxDQUFDLEtBQStDO0lBQ2xGLE9BQU8sQ0FBQyxHQUFHLENBQUMsV0FBVyxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBRWhDLE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxFQUFFLENBQUM7SUFFdEIsTUFBTSxrQkFBa0IsR0FBRyxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxtQkFBbUIsSUFBSSxLQUFLLENBQUMsa0JBQWtCLENBQUMsbUJBQW1CLEVBQUUsQ0FBQztJQUU3SCxJQUFJLEtBQUssQ0FBQyxXQUFXLEtBQUssUUFBUSxJQUFJLEtBQUssQ0FBQyxXQUFXLEtBQUssUUFBUSxFQUFFO1FBQ3BFLE1BQU0sSUFBSSxHQUFHLE1BQU0sR0FBRyx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gICAgICByZXR1cm4geyBJc0NvbXBsZXRlOiBzbmFwc2hvdFN0YXR1cyA9PT0gdW5kZWZpbmVkIH07XG4gIH1cbn1cblxuYXN5bmMgZnVuY3Rpb24gdHJ5R2V0Q2x1c3RlclNuYXBzaG90U3RhdHVzKGlkZW50aWZpZXI6IHN0cmluZyk6IFByb21pc2U8c3RyaW5nIHwgdW5kZWZpbmVkPiB7XG4gIHRyeSB7XG4gICAgY29uc3QgcmRzID0gbmV3IFJEUygpO1xuICAgIGNvbnN0IGRhdGEgPSBhd2FpdCByZHMuZGVzY3JpYmVEQkNsdXN0ZXJTbmFwc2hvdHMoe1xuICAgICAgREJDbHVzdGVyU25hcHNob3RJZGVudGlmaWVyOiBpZGVudGlmaWVyLFxuICAgIH0pLnByb21pc2UoKTtcbiAgICByZXR1cm4gZGF0YS5EQkNsdXN0ZXJTbmFwc2hvdHM/LlswXS5TdGF0dXM7XG4gIH0gY2F0Y2ggKGVycjogYW55KSB7XG4gICAgaWYgKGVyci5jb2RlID09PSAnREJDbHVzdGVyU25hcHNob3ROb3RGb3VuZEZhdWx0Jykge1xuICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcbiAgICB9XG4gICAgdGhyb3cgZXJyO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.ts new file mode 100644 index 0000000000000..be8fc45f2dc9e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-rds/test/snapshot-handler/index.ts @@ -0,0 +1,63 @@ +/* eslint-disable no-console */ +/// +import { RDS } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +export async function onEventHandler(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise { + console.log('Event: %j', event); + + const rds = new RDS(); + + const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; + + if (event.RequestType === 'Create' || event.RequestType === 'Update') { + const data = await rds.createDBClusterSnapshot({ + DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + return { + PhysicalResourceId: physicalResourceId, + Data: { + DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, + }, + }; + } + + if (event.RequestType === 'Delete') { + await rds.deleteDBClusterSnapshot({ + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + } + + return { + PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, + }; +} + +export async function isCompleteHandler(event: AWSCDKAsyncCustomResource.IsCompleteRequest): Promise { + console.log('Event: %j', event); + + const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); + + switch (event.RequestType) { + case 'Create': + case 'Update': + return { IsComplete: snapshotStatus === 'available' }; + case 'Delete': + return { IsComplete: snapshotStatus === undefined }; + } +} + +async function tryGetClusterSnapshotStatus(identifier: string): Promise { + try { + const rds = new RDS(); + const data = await rds.describeDBClusterSnapshots({ + DBClusterSnapshotIdentifier: identifier, + }).promise(); + return data.DBClusterSnapshots?.[0].Status; + } catch (err: any) { + if (err.code === 'DBClusterSnapshotNotFoundFault') { + return undefined; + } + throw err; + } +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js new file mode 100644 index 0000000000000..70aa9e80c7fa4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +// import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '@aws-cdk/cx-api'; +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_route53_patterns_1 = require("aws-cdk-lib/aws-route53-patterns"); +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; +if (!hostedZoneId) + throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); +const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; +if (!hostedZoneName) + throw new Error('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME"'); +const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME; +if (!domainName) + throw new Error('For this test you must provide your own Domain Name as an env var "DOMAIN_NAME"'); +const app = new aws_cdk_lib_1.App({ +// uncomment this to test the old behavior +// postCliContext: { +// [ROUTE53_PATTERNS_USE_CERTIFICATE]: false, +// }, +}); +const testCase = new aws_cdk_lib_1.Stack(app, 'integ-https-redirect-same-region', { + env: { region: 'us-east-1' }, +}); +const hostedZone = aws_route53_1.PublicHostedZone.fromHostedZoneAttributes(testCase, 'HostedZone', { + hostedZoneId, + zoneName: hostedZoneName, +}); +new aws_route53_patterns_1.HttpsRedirect(testCase, 'redirect', { + zone: hostedZone, + recordNames: [`integ-same-region.${hostedZoneName}`], + targetDomain: 'aws.amazon.com', +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-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9VVEU1M19QQVRURVJOU19VU0VfQ0VSVElGSUNBVEVdOiBmYWxzZSxcbiAgLy8gfSxcbn0pO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgU3RhY2soYXBwLCAnaW50ZWctaHR0cHMtcmVkaXJlY3Qtc2FtZS1yZWdpb24nLCB7XG4gIGVudjogeyByZWdpb246ICd1cy1lYXN0LTEnIH0sXG59KTtcblxuY29uc3QgaG9zdGVkWm9uZSA9IFB1YmxpY0hvc3RlZFpvbmUuZnJvbUhvc3RlZFpvbmVBdHRyaWJ1dGVzKHRlc3RDYXNlLCAnSG9zdGVkWm9uZScsIHtcbiAgaG9zdGVkWm9uZUlkLFxuICB6b25lTmFtZTogaG9zdGVkWm9uZU5hbWUsXG59KTtcbm5ldyBIdHRwc1JlZGlyZWN0KHRlc3RDYXNlLCAncmVkaXJlY3QnLCB7XG4gIHpvbmU6IGhvc3RlZFpvbmUsXG4gIHJlY29yZE5hbWVzOiBbYGludGVnLXNhbWUtcmVnaW9uLiR7aG9zdGVkWm9uZU5hbWV9YF0sXG4gIHRhcmdldERvbWFpbjogJ2F3cy5hbWF6b24uY29tJyxcbn0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2ludGVnLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3Rlc3RDYXNlXSxcbiAgZW5hYmxlTG9va3VwczogdHJ1ZSxcbiAgc3RhY2tVcGRhdGVXb3JrZmxvdzogZmFsc2UsXG59KTtcblxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.assets.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ-https-redirect-same-region.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts similarity index 85% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts index d5f79d88d0697..ac3237157465f 100644 --- a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts @@ -1,8 +1,8 @@ -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { Stack, App } from '@aws-cdk/core'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { Stack, App } from 'aws-cdk-lib'; // import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '@aws-cdk/cx-api'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { HttpsRedirect } from '../lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { HttpsRedirect } from 'aws-cdk-lib/aws-route53-patterns'; const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; if (!hostedZoneId) throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js new file mode 100644 index 0000000000000..cec1fd20c0f6e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +// import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '@aws-cdk/cx-api'; +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_route53_patterns_1 = require("aws-cdk-lib/aws-route53-patterns"); +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; +if (!hostedZoneId) + throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); +const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; +if (!hostedZoneName) + throw new Error('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME"'); +const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME; +if (!domainName) + throw new Error('For this test you must provide your own Domain Name as an env var "DOMAIN_NAME"'); +const app = new aws_cdk_lib_1.App({ +// uncomment this to test the old behavior +// postCliContext: { +// [ROUTE53_PATTERNS_USE_CERTIFICATE]: false, +// }, +}); +const testCase = new aws_cdk_lib_1.Stack(app, 'integ-https-redirect', { + crossRegionReferences: true, + env: { + account: process.env.CDK_DEFAULT_ACCOUNT, + region: 'us-east-2', // specifying region to test cross region functionality + }, +}); +const hostedZone = aws_route53_1.PublicHostedZone.fromHostedZoneAttributes(testCase, 'HostedZone', { + hostedZoneId, + zoneName: hostedZoneName, +}); +new aws_route53_patterns_1.HttpsRedirect(testCase, 'redirect', { + zone: hostedZone, + recordNames: [`integ.${hostedZoneName}`], + targetDomain: 'aws.amazon.com', +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-test', { + testCases: [testCase], + enableLookups: true, + stackUpdateWorkflow: false, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozL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VSTlNfVVNFX0NFUlRJRklDQVRFXTogZmFsc2UsXG4gIC8vIH0sXG59KTtcbmNvbnN0IHRlc3RDYXNlID0gbmV3IFN0YWNrKGFwcCwgJ2ludGVnLWh0dHBzLXJlZGlyZWN0Jywge1xuICBjcm9zc1JlZ2lvblJlZmVyZW5jZXM6IHRydWUsXG4gIGVudjoge1xuICAgIGFjY291bnQ6IHByb2Nlc3MuZW52LkNES19ERUZBVUxUX0FDQ09VTlQsXG4gICAgcmVnaW9uOiAndXMtZWFzdC0yJywgLy8gc3BlY2lmeWluZyByZWdpb24gdG8gdGVzdCBjcm9zcyByZWdpb24gZnVuY3Rpb25hbGl0eVxuICB9LFxufSk7XG5cbmNvbnN0IGhvc3RlZFpvbmUgPSBQdWJsaWNIb3N0ZWRab25lLmZyb21Ib3N0ZWRab25lQXR0cmlidXRlcyh0ZXN0Q2FzZSwgJ0hvc3RlZFpvbmUnLCB7XG4gIGhvc3RlZFpvbmVJZCxcbiAgem9uZU5hbWU6IGhvc3RlZFpvbmVOYW1lLFxufSk7XG5uZXcgSHR0cHNSZWRpcmVjdCh0ZXN0Q2FzZSwgJ3JlZGlyZWN0Jywge1xuICB6b25lOiBob3N0ZWRab25lLFxuICByZWNvcmROYW1lczogW2BpbnRlZy4ke2hvc3RlZFpvbmVOYW1lfWBdLFxuICB0YXJnZXREb21haW46ICdhd3MuYW1hem9uLmNvbScsXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdpbnRlZy10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFt0ZXN0Q2FzZV0sXG4gIGVuYWJsZUxvb2t1cHM6IHRydWUsXG4gIHN0YWNrVXBkYXRlV29ya2Zsb3c6IGZhbHNlLFxufSk7XG5cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.assets.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/certificate-redirect-stack-c8dcaeced090b732e39f9a17bfcca0bf8d20ce4f61.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.assets.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ-https-redirect.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/integtestDefaultTestDeployAssert24D5C536.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.ts similarity index 86% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.ts index 1c6a2dff626aa..0488f2db1df52 100644 --- a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect.ts @@ -1,8 +1,8 @@ -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { Stack, App } from '@aws-cdk/core'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { Stack, App } from 'aws-cdk-lib'; // import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '@aws-cdk/cx-api'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { HttpsRedirect } from '../lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { HttpsRedirect } from 'aws-cdk-lib/aws-route53-patterns'; const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID; if (!hostedZoneId) throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID"'); const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js new file mode 100644 index 0000000000000..b4a9bcd7c53d1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const route53 = require("aws-cdk-lib/aws-route53"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-route53-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); +const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); +new route53.ARecord(zone, 'Alias', { + zone, + recordName: '_foo', + target: route53.RecordTarget.fromAlias(new targets.Lo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uICByZWNvcmROYW1lOiAnX2ZvbycsXG4gIHRhcmdldDogcm91dGU1My5SZWNvcmRUYXJnZXQuZnJvbUFsaWFzKG5ldyB0YXJnZXRzLkxvYWRCYWxhbmNlclRhcmdldChsYikpLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/aws-cdk-elbv2-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-from-generated-password.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.ts new file mode 100644 index 0000000000000..ebb6145395590 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.alb-alias-target.ts @@ -0,0 +1,28 @@ +#!/usr/bin/env node +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); + +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); + +const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, +}); + +const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); + +new route53.ARecord(zone, 'Alias', { + zone, + recordName: '_foo', + target: route53.RecordTarget.fromAlias(new targets.LoadBalancerTarget(lb)), +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js new file mode 100644 index 0000000000000..e94e8edd3e142 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js @@ -0,0 +1,52 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const apig = require("aws-cdk-lib/aws-apigateway"); +const acm = require("aws-cdk-lib/aws-certificatemanager"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const route53 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const targets = require("aws-cdk-lib/aws-route53-targets"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const domainName = 'example.com'; + const certArn = 'arn:aws:acm:us-east-1:111111111111:certificate'; + const hostedZoneId = 'AAAAAAAAAAAAA'; + const handler = new lambda.Function(this, 'Handler', { + code: lambda.Code.fromInline(`exports.handler = async () => { + return { + statusCode: '200', + body: 'hello, world!' + }; + };`), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + }); + const certificate = acm.Certificate.fromCertificateArn(this, 'cert', certArn); + const api = new apig.LambdaRestApi(this, 'api', { + cloudWatchRole: true, + handler, + domainName: { + certificate, + domainName, + endpointType: apig.EndpointType.REGIONAL, + }, + }); + const zone = route53.HostedZone.fromHostedZoneAttributes(this, 'hosted-zone', { + zoneName: domainName, + hostedZoneId, + }); + new route53.ARecord(this, 'Alias', { + zone, + target: route53.RecordTarget.fromAlias(new targets.ApiGateway(api)), + }); + } +} +const app = new aws_cdk_lib_1.App(); +const testCase = new TestStack(app, 'aws-cdk-apigw-alias-integ'); +new integ_tests_alpha_1.IntegTest(app, 'apigateway-domain-name', { + testCases: [testCase], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXBpLWdhdGV3YXktZG9tYWluLW5hbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5hcGktZ2F0ZXdheS1kb21haW4tbmFtZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtREFBbUQ7QUFDbkQsMERBQTBEO0FBQzFELGlEQUFpRDtBQUNqRCxtREFBbUQ7QUFDbkQsNkNBQXlDO0FBQ3pDLGtFQUF1RDtBQUV2RCwyREFBMkQ7QUFFM0QsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVU7UUFDdEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixNQUFNLFVBQVUsR0FBRyxhQUFhLENBQUM7UUFDakMsTUFBTSxPQUFPLEdBQUcsZ0RBQWdELENBQUM7UUFDakUsTUFBTSxZQUFZLEdBQUcsZUFBZSxDQUFDO1FBRXJDLE1BQU0sT0FBTyxHQUFHLElBQUksTUFBTSxDQUFDLFFBQVEsQ0F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FtZSxcbiAgICAgIGhvc3RlZFpvbmVJZCxcbiAgICB9KTtcblxuICAgIG5ldyByb3V0ZTUzLkFSZWNvcmQodGhpcywgJ0FsaWFzJywge1xuICAgICAgem9uZSxcbiAgICAgIHRhcmdldDogcm91dGU1My5SZWNvcmRUYXJnZXQuZnJvbUFsaWFzKG5ldyB0YXJnZXRzLkFwaUdhdGV3YXkoYXBpKSksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuY29uc3QgdGVzdENhc2UgPSBuZXcgVGVzdFN0YWNrKGFwcCwgJ2F3cy1jZGstYXBpZ3ctYWxpYXMtaW50ZWcnKTtcbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnYXBpZ2F0ZXdheS1kb21haW4tbmFtZScsIHtcbiAgdGVzdENhc2VzOiBbdGVzdENhc2VdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/apigatewaydomainnameDefaultTestDeployAssertC8336909.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/aws-cdk-apigw-alias-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-s3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.ts similarity index 78% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.ts index 55d39480a9e1b..0f5f4d8bf36a6 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.api-gateway-domain-name.ts @@ -1,12 +1,12 @@ #!/usr/bin/env node -import * as apig from '@aws-cdk/aws-apigateway'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as route53 from '@aws-cdk/aws-route53'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as apig from 'aws-cdk-lib/aws-apigateway'; +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as targets from '../lib'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js new file mode 100644 index 0000000000000..5dd83c5e0f200 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const route53 = require("aws-cdk-lib/aws-route53"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-route53-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); +const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); +const sourceBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const distribution = new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [{ isDefaultBehavior: true }], + }, + ], +}); +new route53.ARecord(zone, 'Alias', { + zone, + recordName: '_foo', + target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2xvdWRmcm9udC1hbGlhcy10YXJnZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jbG91ZGZyb250LWFsaWFzLXRhcmdldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlEQUF5RDtBQUN6RCxtREFBbUQ7QUFDbkQseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQywyREFBMkQ7QUFFM0QsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxvQkFBb0IsQ0FBQyxDQUFDO0FBRXZELE1BQU0sSUFBSSxHQUFHLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLEtBQUssRUFBRSxZQUFZLEVBQUUsRUFBRSxRQUFRLEVBQUUsYUFBYSxFQUFFLENBQUMsQ0FBQztBQUU1RixNQUFNLFlBQVksR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFFBQVEsRUFBRTtJQUNsRCxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO0NBQ3pDLENBQUMsQ0FBQztBQUVILE1BQU0sWUFBWSxHQUFHLElBQUksVUFBVSxDQUFDLHlCQUF5QixDQUFDLEtBQU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CB7IHpvbmVOYW1lOiAndGVzdC5wdWJsaWMnIH0pO1xuXG5jb25zdCBzb3VyY2VCdWNrZXQgPSBuZXcgczMuQnVja2V0KHN0YWNrLCAnQnVja2V0Jywge1xuICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbmNvbnN0IGRpc3RyaWJ1dGlvbiA9IG5ldyBjbG91ZGZyb250LkNsb3VkRnJvbnRXZWJEaXN0cmlidXRpb24oc3RhY2ssICdNeURpc3RyaWJ1dGlvbicsIHtcbiAgb3JpZ2luQ29uZmlnczogW1xuICAgIHtcbiAgICAgIHMzT3JpZ2luU291cmNlOiB7XG4gICAgICAgIHMzQnVja2V0U291cmNlOiBzb3VyY2VCdWNrZXQsXG4gICAgICB9LFxuICAgICAgYmVoYXZpb3JzOiBbeyBpc0RlZmF1bHRCZWhhdmlvcjogdHJ1ZSB9XSxcbiAgICB9LFxuICBdLFxufSk7XG5cbm5ldyByb3V0ZTUzLkFSZWNvcmQoem9uZSwgJ0FsaWFzJywge1xuICB6b25lLFxuICByZWNvcmROYW1lOiAnX2ZvbycsXG4gIHRhcmdldDogcm91dGU1My5SZWNvcmRUYXJnZXQuZnJvbUFsaWFzKG5ldyB0YXJnZXRzLkNsb3VkRnJvbnRUYXJnZXQoZGlzdHJpYnV0aW9uKSksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.rolling-instance-updates.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.ts new file mode 100644 index 0000000000000..ba9cf4f99c808 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.ts @@ -0,0 +1,34 @@ +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); + +const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); + +const sourceBucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +const distribution = new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [{ isDefaultBehavior: true }], + }, + ], +}); + +new route53.ARecord(zone, 'Alias', { + zone, + recordName: '_foo', + target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js new file mode 100644 index 0000000000000..57ab6fa8d9f90 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const globalaccelerator = require("aws-cdk-lib/aws-globalaccelerator"); +const route53 = require("aws-cdk-lib/aws-route53"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-route53-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-globalaccelerator-integ'); +let accelerator = new globalaccelerator.Accelerator(stack, 'Accelerator', { + acceleratorName: `${stack.stackName}`, + enabled: true, +}); +const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); +new route53.ARecord(stack, 'LocalGlobalAcceleratorAlias', { + comment: 'Alias to the locally created Global Accelerator', + target: route53.RecordTarget.fromAlias(new targets.GlobalAcceleratorTarget(accelerator)), + recordName: 'test-local', + zone, +}); +new route53.ARecord(stack, 'ExistingGlobalAcceleratorAlias', { + comment: 'Alias to the an existing Global Accelerator', + target: route53.RecordTarget.fromAlias(new targets.GlobalAcceleratorDomainTarget('someexisting.awsglobalaccelerator.com')), + recordName: 'test-existing', + zone, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2xvYmFsYWNjZWxlcmF0b3ItYWxpYXMtdGFyZ2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ2xvYmFsYWNjZWxl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xBY2NlbGVyYXRvckFsaWFzJywge1xuICBjb21tZW50OiAnQWxpYXMgdG8gdGhlIGxvY2FsbHkgY3JlYXRlZCBHbG9iYWwgQWNjZWxlcmF0b3InLFxuICB0YXJnZXQ6IHJvdXRlNTMuUmVjb3JkVGFyZ2V0LmZyb21BbGlhcyhuZXcgdGFyZ2V0cy5HbG9iYWxBY2NlbGVyYXRvclRhcmdldChhY2NlbGVyYXRvcikpLFxuICByZWNvcmROYW1lOiAndGVzdC1sb2NhbCcsXG4gIHpvbmUsXG59KTtcblxubmV3IHJvdXRlNTMuQVJlY29yZChzdGFjaywgJ0V4aXN0aW5nR2xvYmFsQWNjZWxlcmF0b3JBbGlhcycsIHtcbiAgY29tbWVudDogJ0FsaWFzIHRvIHRoZSBhbiBleGlzdGluZyBHbG9iYWwgQWNjZWxlcmF0b3InLFxuICB0YXJnZXQ6IHJvdXRlNTMuUmVjb3JkVGFyZ2V0LmZyb21BbGlhcyhuZXcgdGFyZ2V0cy5HbG9iYWxBY2NlbGVyYXRvckRvbWFpblRhcmdldCgnc29tZWV4aXN0aW5nLmF3c2dsb2JhbGFjY2VsZXJhdG9yLmNvbScpKSxcbiAgcmVjb3JkTmFtZTogJ3Rlc3QtZXhpc3RpbmcnLFxuICB6b25lLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/aws-cdk-globalaccelerator-integ.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-no-vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts similarity index 80% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts index 560e828accaa5..5cc0d5368da61 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.globalaccelerator-alias-target.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as globalaccelerator from '@aws-cdk/aws-globalaccelerator'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../lib'; +import * as globalaccelerator from 'aws-cdk-lib/aws-globalaccelerator'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-globalaccelerator-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js new file mode 100644 index 0000000000000..a9f3a5b88ae01 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const route53 = require("aws-cdk-lib/aws-route53"); +const cdk = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-route53-targets"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-interface-vpc-endpoint', { + env: { + region: 'us-west-2', + }, +}); +const vpc = new ec2.Vpc(stack, 'VPC'); +const interfaceVpcEndpoint = new ec2.InterfaceVpcEndpoint(stack, 'InterfaceEndpoint', { + vpc, + service: { + name: 'com.amazonaws.us-west-2.sms', + port: 80, + }, + privateDnsEnabled: false, + subnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, +}); +const zone = new route53.PrivateHostedZone(stack, 'PrivateZone', { + vpc, + zoneName: 'test.aws.cdk.com', +}); +new route53.ARecord(stack, 'AliasEndpointRecord', { + zone, + recordName: 'foo', + target: route53.RecordTarget.fromAlias(new targets.InterfaceVpcEndpointTarget(interfaceVpcEndpoint)), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW50ZXJmYWNlLXZwYy1lbmRwb2ludC10YXJnZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5pbnRlcmZhY2UtdnBjLWVuZHBvaW50LXRhcmdldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMz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mF0ZUhvc3RlZFpvbmUoc3RhY2ssICdQcml2YXRlWm9uZScsIHtcbiAgdnBjLFxuICB6b25lTmFtZTogJ3Rlc3QuYXdzLmNkay5jb20nLFxufSk7XG5cbm5ldyByb3V0ZTUzLkFSZWNvcmQoc3RhY2ssICdBbGlhc0VuZHBvaW50UmVjb3JkJywge1xuICB6b25lLFxuICByZWNvcmROYW1lOiAnZm9vJyxcbiAgdGFyZ2V0OiByb3V0ZTUzLlJlY29yZFRhcmdldC5mcm9tQWxpYXMobmV3IHRhcmdldHMuSW50ZXJmYWNlVnBjRW5kcG9pbnRUYXJnZXQoaW50ZXJmYWNlVnBjRW5kcG9pbnQpKSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/aws-cdk-interface-vpc-endpoint.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.serverless-cluster.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts similarity index 79% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts index ce121283a1a10..059e5a92aba4c 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as cdk from 'aws-cdk-lib'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js new file mode 100644 index 0000000000000..9c32253c7f069 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const route53 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const targets = require("aws-cdk-lib/aws-route53-targets"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const zone = new route53.PublicHostedZone(this, 'HostedZone', { + zoneName: 'cdk-integ.com', + }); + const www = new route53.ARecord(this, 'WWW', { + zone, + recordName: 'www.cdk-integ.com', + target: route53.RecordTarget.fromIpAddresses('1.2.3.4'), + }); + new route53.ARecord(this, 'Alias', { + zone, + target: route53.RecordTarget.fromAlias(new targets.Route53RecordTarget(www)), + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'aws-cdk-r53-record-alias-target-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucm91dGU1My1yZWNvcmQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5yb3V0ZTUzLXJlY29yZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtREFBbUQ7QUFDbkQsNkNBQXlDO0FBRXpDLDJEQUEyRDtBQUUzRCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVTtRQUN0QyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sSUFBSSxHQUFHLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLElBQUksRUFBRSxZQUFZLEVBQUU7WUFDNUQsUUFBUSxFQUFFLGVBQWU7U0FDMUIsQ0FBQyxDQUFDO1FBRUgsTUFBTSxHQUFHLEdBQUcsSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxLQUFLLEVBQUU7WUFDM0MsSUFBSTtZQUNKLFVBQVUsRUFBRSxtQkFBbUI7WUFDL0IsTUFBTSxFQUFFLE9BQU8sQ0FBQyxZQUFZLENBQUMsZUFBZSxDQUFDLFNBQVMsQ0FBQztTQUN4RCxDQUFDLENBQUM7UUFFSCxJQUFJLE9BQU8sQ0FBQyx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AgICByZWNvcmROYW1lOiAnd3d3LmNkay1pbnRlZy5jb20nLFxuICAgICAgdGFyZ2V0OiByb3V0ZTUzLlJlY29yZFRhcmdldC5mcm9tSXBBZGRyZXNzZXMoJzEuMi4zLjQnKSxcbiAgICB9KTtcblxuICAgIG5ldyByb3V0ZTUzLkFSZWNvcmQodGhpcywgJ0FsaWFzJywge1xuICAgICAgem9uZSxcbiAgICAgIHRhcmdldDogcm91dGU1My5SZWNvcmRUYXJnZXQuZnJvbUFsaWFzKG5ldyB0YXJnZXRzLlJvdXRlNTNSZWNvcmRUYXJnZXQod3d3KSksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLXI1My1yZWNvcmQtYWxpYXMtdGFyZ2V0LWludGVnJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/aws-cdk-r53-record-alias-target-integ.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.ts similarity index 81% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.ts index aeec73fa19233..e11841fd0e30c 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.route53-record.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as route53 from '@aws-cdk/aws-route53'; -import { App, Stack } from '@aws-cdk/core'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import { App, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as targets from '../lib'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; class TestStack extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js new file mode 100644 index 0000000000000..409b8c6f5f5de --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-route53-cross-account-integ'); +const parentZone = new aws_route53_1.PublicHostedZone(stack, 'ParentHostedZone', { + zoneName: 'myzone.com', + crossAccountZoneDelegationPrincipal: new iam.AccountPrincipal(cdk.Aws.ACCOUNT_ID), +}); +// with zoneId +const childZoneWithZoneId = new aws_route53_1.PublicHostedZone(stack, 'ChildHostedZoneWithZoneId', { + zoneName: 'sub.myzone.com', +}); +new aws_route53_1.CrossAccountZoneDelegationRecord(stack, 'DelegationWithZoneId', { + delegatedZone: childZoneWithZoneId, + parentHostedZoneId: parentZone.hostedZoneId, + delegationRole: parentZone.crossAccountZoneDelegationRole, +}); +// with zoneName +const childZoneWithZoneName = new aws_route53_1.PublicHostedZone(stack, 'ChildHostedZoneWithZoneName', { + zoneName: 'anothersub.myzone.com', +}); +new aws_route53_1.CrossAccountZoneDelegationRecord(stack, 'DelegationWithZoneName', { + delegatedZone: childZoneWithZoneName, + parentHostedZoneName: 'myzone.com', + delegationRole: parentZone.crossAccountZoneDelegationRole, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY3Jvc3MtYWNjb3VudC16b25lLWRlbGVnYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jcm9zcy1hY2NvdW50LXpvbmUtZGVsZWdhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMseURBQTZGO0FBRTdGLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUscUNBQXFDLENBQUMsQ0FBQztBQUV4RSxNQUFNLFVBQVUsR0FBRyxJQUFJLDhCQUFnQixDQUFDLEtBQUssRUFBRSxrQkFBa0IsRUFBRTtJQUNqRSxRQUFRLEVBQUUsWUFBWTtJQUN0QixtQ0FBbUMsRUFBRSxJQUFJLEdBQUcsQ0FBQyxnQkFBZ0IsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLFVBQVUsQ0FBQztDQUNsRixDQUFDLENBQUM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UmVjb3JkKHN0YWNrLCAnRGVsZWdhdGlvbldpdGhab25lTmFtZScsIHtcbiAgZGVsZWdhdGVkWm9uZTogY2hpbGRab25lV2l0aFpvbmVOYW1lLFxuICBwYXJlbnRIb3N0ZWRab25lTmFtZTogJ215em9uZS5jb20nLFxuICBkZWxlZ2F0aW9uUm9sZTogcGFyZW50Wm9uZS5jcm9zc0FjY291bnRab25lRGVsZWdhdGlvblJvbGUhLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/index.js similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/asset.89af49ab813a5bc5ab7e18adff91dcff5a5889842f419767c8a2a5aa94b0e6f8/index.js diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/aws-cdk-route53-cross-account-integ.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect-same-region.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.ts similarity index 90% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.ts index 8ec89ab3ec343..6e870b0cb76ab 100644 --- a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.cross-account-zone-delegation.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { PublicHostedZone, CrossAccountZoneDelegationRecord } from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { PublicHostedZone, CrossAccountZoneDelegationRecord } from 'aws-cdk-lib/aws-route53'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js new file mode 100644 index 0000000000000..12abc2c745ce9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const route53 = require("aws-cdk-lib/aws-route53"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const hostedZone = new route53.PublicHostedZone(this, 'HostedZone', { + zoneName: 'cdk.dev', + }); + // Simulate existing record + const existingRecord = new route53.ARecord(this, 'ExistingRecord', { + target: route53.RecordTarget.fromIpAddresses('1.2.3.4'), + zone: hostedZone, + recordName: 'integ', + }); + const newRecord = new route53.ARecord(this, 'NewRecord', { + target: route53.RecordTarget.fromIpAddresses('5.6.7.8'), + ttl: aws_cdk_lib_1.Duration.hours(2), + zone: hostedZone, + recordName: 'integ', + deleteExisting: true, + }); + newRecord.node.addDependency(existingRecord); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-route53-integ-delete-existing-record-set'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZGVsZXRlLWV4aXN0aW5nLXJlY29yZC1zZXQuanMiL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AgICAgIHJlY29yZE5hbWU6ICdpbnRlZycsXG4gICAgfSk7XG5cbiAgICBjb25zdCBuZXdSZWNvcmQgPSBuZXcgcm91dGU1My5BUmVjb3JkKHRoaXMsICdOZXdSZWNvcmQnLCB7XG4gICAgICB0YXJnZXQ6IHJvdXRlNTMuUmVjb3JkVGFyZ2V0LmZyb21JcEFkZHJlc3NlcygnNS42LjcuOCcpLFxuICAgICAgdHRsOiBEdXJhdGlvbi5ob3VycygyKSxcbiAgICAgIHpvbmU6IGhvc3RlZFpvbmUsXG4gICAgICByZWNvcmROYW1lOiAnaW50ZWcnLFxuICAgICAgZGVsZXRlRXhpc3Rpbmc6IHRydWUsXG4gICAgfSk7XG4gICAgbmV3UmVjb3JkLm5vZGUuYWRkRGVwZW5kZW5jeShleGlzdGluZ1JlY29yZCk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstcm91dGU1My1pbnRlZy1kZWxldGUtZXhpc3RpbmctcmVjb3JkLXNldCcpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-route53/lib/delete-existing-record-set-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/lib/delete-existing-record-set-handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.ts diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.assets.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk-route53-integ-delete-existing-record-set.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.cluster-s3.mysql-8.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.ts similarity index 88% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.ts index 728ec98cfbf55..c38030fe2ee57 100644 --- a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.delete-existing-record-set.ts @@ -1,6 +1,6 @@ -import { App, Duration, Stack, StackProps } from '@aws-cdk/core'; +import { App, Duration, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as route53 from '../lib'; +import * as route53 from 'aws-cdk-lib/aws-route53'; class TestStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js new file mode 100644 index 0000000000000..697e5fbf9df09 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-route53-integ'); +const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 1 }); +const privateZone = new aws_route53_1.PrivateHostedZone(stack, 'PrivateZone', { + zoneName: 'cdk.local', vpc, +}); +const publicZone = new aws_route53_1.PublicHostedZone(stack, 'PublicZone', { + zoneName: 'cdk.test', +}); +const publicSubZone = new aws_route53_1.PublicHostedZone(stack, 'PublicSubZone', { + zoneName: 'sub.cdk.test', +}); +publicZone.addDelegation(publicSubZone); +new aws_route53_1.TxtRecord(privateZone, 'TXT', { + zone: privateZone, + recordName: '_foo', + values: [ + 'Bar!', + 'Baz?', + ], + ttl: cdk.Duration.minutes(1), +}); +new aws_route53_1.CnameRecord(stack, 'CNAME', { + zone: privateZone, + recordName: 'www', + domainName: 'server', +}); +new aws_route53_1.ARecord(stack, 'A', { + zone: privateZone, + recordName: 'test', + target: aws_route53_1.RecordTarget.fromIpAddresses('1.2.3.4', '5.6.7.8'), +}); +new aws_route53_1.CaaAmazonRecord(stack, 'CaaAmazon', { + zone: publicZone, +}); +new aws_route53_1.TxtRecord(stack, 'TXT', { + zone: publicZone, + values: [ + 'this is a very long string'.repeat(10), + ], +}); +new cdk.CfnOutput(stack, 'PrivateZoneId', { value: privateZone.hostedZoneId }); +new cdk.CfnOutput(stack, 'PublicZoneId', { value: publicZone.hostedZoneId }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucm91dGU1My5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJvdXRlNTMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLHlEQUE4STtBQUU5SSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHVCQUF1QixDQUFDLENBQUM7QUFFMUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUFNLFdBQVcsR0FBRyxJQUFJLCtCQUFpQixDQUFDLEtBQUssRUFBRSxhQUFhLEVBQUU7SUFDOUQsUUFBUSxFQUFFLFdBQVcsRUFBRSxHQUFHO0NBQzNCLENBQUMsQ0FBQztBQUVILE1BQU0sVUFBVSxHQUFHLElBQUksOEJBQWdCLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRTtJQUMz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FxuICBdLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnUHJpdmF0ZVpvbmVJZCcsIHsgdmFsdWU6IHByaXZhdGVab25lLmhvc3RlZFpvbmVJZCB9KTtcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnUHVibGljWm9uZUlkJywgeyB2YWx1ZTogcHVibGljWm9uZS5ob3N0ZWRab25lSWQgfSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/aws-cdk-route53-integ.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.api-gateway-domain-name.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.ts similarity index 89% rename from packages/@aws-cdk/aws-route53/test/integ.route53.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.ts index dd959fb50373d..c7c70941499ea 100644 --- a/packages/@aws-cdk/aws-route53/test/integ.route53.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.route53.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { ARecord, CaaAmazonRecord, CnameRecord, PrivateHostedZone, PublicHostedZone, RecordTarget, TxtRecord } from '../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { ARecord, CaaAmazonRecord, CnameRecord, PrivateHostedZone, PublicHostedZone, RecordTarget, TxtRecord } from 'aws-cdk-lib/aws-route53'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js new file mode 100644 index 0000000000000..9ce75c03848e2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +/** + * A load balancer that can host a VPC Endpoint Service. + * + * Why do this instead of using the NetworkLoadBalancer construct? aws-route53 + * cannot depend on aws-elasticloadbalancingv2 because aws-elasticloadbalancingv2 + * already takes a dependency on aws-route53. + */ +class DummyEndpointLoadBalancer { + constructor(scope, id, vpc) { + const lb = new cdk.CfnResource(scope, id, { + type: 'AWS::ElasticLoadBalancingV2::LoadBalancer', + properties: { + Type: 'network', + Name: 'mylb', + Scheme: 'internal', + Subnets: [vpc.privateSubnets[0].subnetId], + }, + }); + this.loadBalancerArn = lb.ref; + } +} +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-vpc-endpoint-dns-integ'); +const vpc = new ec2.Vpc(stack, 'VPC'); +const nlb = new DummyEndpointLoadBalancer(stack, 'mylb', vpc); +const vpces = new ec2.VpcEndpointService(stack, 'VPCES', { + vpcEndpointServiceLoadBalancers: [nlb], +}); +const zone = new aws_route53_1.PublicHostedZone(stack, 'PHZ', { + zoneName: 'aws-cdk.dev', +}); +new aws_route53_1.VpcEndpointServiceDomainName(stack, 'EndpointDomain', { + endpointService: vpces, + domainName: 'my-stuff.aws-cdk.dev', + publicHostedZone: zone, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudnBjLWVuZHBvaW50LXNlcnZpY2UtZG9tYWluLW5hbWUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52cGMtZW5kcG9pbnQtc2VydmljZS1kb21haW4tbmFtZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFFbkMseURBQXlGO0FBRXpGOzs7Ozs7R0FNRztBQUNILE1BQU0seUJBQXlCO0lBSzdCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsR0FBWTtRQUNwRCxNQUFNLEVBQUUsR0FBRyxJQUFJLEdBQUcsQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRTtZQUN4QyxJQUFJLEVBQUUsMkNBQTJDO1lBQ2pELFVBQVUsRUFBRTtnQkFDVixJQUFJLEVBQUUsU0FBUztnQkFDZixJQUFJLEVBQUUsTUFBTTtnQkFDWixNQUFNLEVBQUUsVUFBVTtnQkFDbEIsT0FBTyxFQUFFLENBQUMsR0FBRyxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUM7YUFDMUM7U0FDRixDQUFDLENBQUM7UUFDSCxJQUFJLENBQUMsZUFBZSxHQUFHLEVBQUUsQ0FBQyxHQUFHLENBQUM7SUFDaEMsQ0FBQztDQUNGO0FBRUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxn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gdGhpcy5sb2FkQmFsYW5jZXJBcm4gPSBsYi5yZWY7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtY2RrLXZwYy1lbmRwb2ludC1kbnMtaW50ZWcnKTtcbmNvbnN0IHZwYyA9IG5ldyBlYzIuVnBjKHN0YWNrLCAnVlBDJyk7XG5jb25zdCBubGIgPSBuZXcgRHVtbXlFbmRwb2ludExvYWRCYWxhbmNlcihzdGFjaywgJ215bGInLCB2cGMpO1xuY29uc3QgdnBjZXMgPSBuZXcgZWMyLlZwY0VuZHBvaW50U2VydmljZShzdGFjaywgJ1ZQQ0VTJywge1xuICB2cGNFbmRwb2ludFNlcnZpY2VMb2FkQmFsYW5jZXJzOiBbbmxiXSxcbn0pO1xuY29uc3Qgem9uZSA9IG5ldyBQdWJsaWNIb3N0ZWRab25lKHN0YWNrLCAnUEhaJywge1xuICB6b25lTmFtZTogJ2F3cy1jZGsuZGV2Jyxcbn0pO1xubmV3IFZwY0VuZHBvaW50U2VydmljZURvbWFpbk5hbWUoc3RhY2ssICdFbmRwb2ludERvbWFpbicsIHtcbiAgZW5kcG9pbnRTZXJ2aWNlOiB2cGNlcyxcbiAgZG9tYWluTmFtZTogJ215LXN0dWZmLmF3cy1jZGsuZGV2JyxcbiAgcHVibGljSG9zdGVkWm9uZTogem9uZSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.assets.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/aws-cdk-vpc-endpoint-dns-integ.template.json diff --git a/packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/test/integ.hosted-redirect.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.ts similarity index 93% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.ts index 672b2133f077b..af123fe3547b0 100644 --- a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-route53/test/integ.vpc-endpoint-service-domain-name.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { PublicHostedZone, VpcEndpointServiceDomainName } from '../lib'; +import { PublicHostedZone, VpcEndpointServiceDomainName } from 'aws-cdk-lib/aws-route53'; /** * A load balancer that can host a VPC Endpoint Service. diff --git a/packages/@aws-cdk/aws-s3-assets/test/alpine-markdown/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/alpine-markdown/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/alpine-markdown/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/alpine-markdown/Dockerfile diff --git a/packages/@aws-cdk/aws-s3-assets/test/file-asset.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/file-asset.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/file-asset.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/file-asset.txt diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js new file mode 100644 index 0000000000000..4876fcbae3802 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'cdk-integ-assets-bundling-docker-opts'); +new assets.Asset(stack, 'BundledAsset', { + path: path.join(__dirname, 'markdown-asset'), + bundling: { + image: aws_cdk_lib_1.DockerImage.fromBuild(path.join(__dirname, 'alpine-markdown')), + command: [ + 'sh', '-c', ` + markdown index.md > /asset-output/index.html + `, + ], + network: 'host', + }, +}); +/// !hide +new integ.IntegTest(app, 'cdk-integ-s3-assets-bundling-docker-opts', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLmJ1bmRsaW5nLmRvY2tlci1vcHRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXNzZXRzLmJ1bmRsaW5nLmRvY2tlci1vcHRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDZDQUFzRDtBQUN0RCxvREFBb0Q7QUFDcEQsb0RBQW9EO0FBR3BELE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsdUNBQXVDLENBQUMsQ0FBQztBQUV0RSxJQUFJLE1BQU0sQ0FBQyxLQUFLLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUN0QyxJQUFJLEVBQUUsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUUsZ0JBQWdCLENBQUM7SUFDNUMsUUFBUSxFQ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AgIGltYWdlOiBEb2NrZXJJbWFnZS5mcm9tQnVpbGQocGF0aC5qb2luKF9fZGlybmFtZSwgJ2FscGluZS1tYXJrZG93bicpKSwgLy8gQnVpbGQgYW4gaW1hZ2VcbiAgICBjb21tYW5kOiBbXG4gICAgICAnc2gnLCAnLWMnLCBgXG4gICAgICAgIG1hcmtkb3duIGluZGV4Lm1kID4gL2Fzc2V0LW91dHB1dC9pbmRleC5odG1sXG4gICAgICBgLFxuICAgIF0sXG4gICAgbmV0d29yazogJ2hvc3QnLFxuICB9LFxufSk7XG4vLy8gIWhpZGVcbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLXMzLWFzc2V0cy1idW5kbGluZy1kb2NrZXItb3B0cycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/asset.98ba393580c41ce2b2e3417f5e114223359ba726471a06326cf81743b16daa22/index.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/asset.98ba393580c41ce2b2e3417f5e114223359ba726471a06326cf81743b16daa22/index.html similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/asset.98ba393580c41ce2b2e3417f5e114223359ba726471a06326cf81743b16daa22/index.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/asset.98ba393580c41ce2b2e3417f5e114223359ba726471a06326cf81743b16daa22/index.html diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk-integ-assets-bundling-docker-opts.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdkintegs3assetsbundlingdockeroptsDefaultTestDeployAssert7B7BC575.template.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts similarity index 79% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts index 4541aca5a81ff..49040039341b4 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { App, DockerImage, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as assets from '../lib'; +import { App, DockerImage, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; const app = new App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js new file mode 100644 index 0000000000000..e0514d4a2a88d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + const asset = new assets.Asset(this, 'BundledAsset', { + path: path.join(__dirname, 'markdown-asset'), + bundling: { + image: aws_cdk_lib_1.DockerImage.fromBuild(path.join(__dirname, 'alpine-markdown')), + command: [ + 'sh', '-c', ` + markdown index.md > /asset-output/index.html + `, + ], + }, + }); + /// !hide + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'cdk-integ-assets-bundling'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLmJ1bmRsaW5nLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFzc2V0cy5idW5kbGluZy5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLDZDQUFrRTtBQUVsRSxvREFBb0Q7QUFFcEQsTUFBTSxTQUFVLFNBQVEsbUJBQUs7SUFDM0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixTQUFTO1FBQ1QsTUFBTSxLQUFLLEdBQUcsSUFBSSxNQUFNLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxjQUFjLEVBQUU7WUFDbkQsSUFBSSxFQUFFLElBQUksQ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HN0cmluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICAvLy8gIXNob3dcbiAgICBjb25zdCBhc3NldCA9IG5ldyBhc3NldHMuQXNzZXQodGhpcywgJ0J1bmRsZWRBc3NldCcsIHtcbiAgICAgIHBhdGg6IHBhdGguam9pbihfX2Rpcm5hbWUsICdtYXJrZG93bi1hc3NldCcpLCAvLyAvYXNzZXQtaW5wdXQgYW5kIHdvcmtpbmcgZGlyZWN0b3J5IGluIHRoZSBjb250YWluZXJcbiAgICAgIGJ1bmRsaW5nOiB7XG4gICAgICAgIGltYWdlOiBEb2NrZXJJbWFnZS5mcm9tQnVpbGQocGF0aC5qb2luKF9fZGlybmFtZSwgJ2FscGluZS1tYXJrZG93bicpKSwgLy8gQnVpbGQgYW4gaW1hZ2VcbiAgICAgICAgY29tbWFuZDogW1xuICAgICAgICAgICdzaCcsICctYycsIGBcbiAgICAgICAgICAgIG1hcmtkb3duIGluZGV4Lm1kID4gL2Fzc2V0LW91dHB1dC9pbmRleC5odG1sXG4gICAgICAgICAgYCxcbiAgICAgICAgXSxcbiAgICAgIH0sXG4gICAgfSk7XG4gICAgLy8vICFoaWRlXG5cbiAgICBjb25zdCB1c2VyID0gbmV3IGlhbS5Vc2VyKHRoaXMsICdNeVVzZXInKTtcbiAgICBhc3NldC5ncmFudFJlYWQodXNlcik7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctYXNzZXRzLWJ1bmRsaW5nJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/asset.96eb17ab9d98dd42b972aa0dd468f59024f21aba33c7d792b8ebe7a8d378e2b6/index.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/asset.96eb17ab9d98dd42b972aa0dd468f59024f21aba33c7d792b8ebe7a8d378e2b6/index.html similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/asset.96eb17ab9d98dd42b972aa0dd468f59024f21aba33c7d792b8ebe7a8d378e2b6/index.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/asset.96eb17ab9d98dd42b972aa0dd468f59024f21aba33c7d792b8ebe7a8d378e2b6/index.html diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk-integ-assets-bundling.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.globalaccelerator-alias-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.ts new file mode 100644 index 0000000000000..09b227816fa11 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.lit.ts @@ -0,0 +1,32 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, DockerImage, Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'BundledAsset', { + path: path.join(__dirname, 'markdown-asset'), // /asset-input and working directory in the container + bundling: { + image: DockerImage.fromBuild(path.join(__dirname, 'alpine-markdown')), // Build an image + command: [ + 'sh', '-c', ` + markdown index.md > /asset-output/index.html + `, + ], + }, + }); + /// !hide + + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} + +const app = new App(); +new TestStack(app, 'cdk-integ-assets-bundling'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js new file mode 100644 index 0000000000000..153fa8e2c2494 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'sample-asset-directory'), + }); + /// !hide + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-test'); +app.synth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XG5pbXBvcnQgKiBhcyBpYW0gZnJvbSAnYXdzLWNkay1saWIvYXdzLWlhbSc7XG5pbXBvcnQgKiBhcyBjZGsgZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgYXNzZXRzIGZyb20gJ2F3cy1jZGstbGliL2F3cy1zMy1hc3NldHMnO1xuXG5jbGFzcyBUZXN0U3RhY2sgZXh0ZW5kcyBjZGsuU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogY2RrLkFwcCwgaWQ6IHN0cmluZywgcHJvcHM/OiBjZGsuU3RhY2tQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgLy8vICFzaG93XG4gICAgY29uc3QgYXNzZXQgPSBuZXcgYXNzZXRzLkFzc2V0KHRoaXMsICdTYW1wbGVBc3NldCcsIHtcbiAgICAgIHBhdGg6IHBhdGguam9pbihfX2Rpcm5hbWUsICdzYW1wbGUtYXNzZXQtZGlyZWN0b3J5JyksXG4gICAgfSk7XG4gICAgLy8vICFoaWRlXG5cbiAgICBjb25zdCB1c2VyID0gbmV3IGlhbS5Vc2VyKHRoaXMsICdNeVVzZXInKTtcbiAgICBhc3NldC5ncmFudFJlYWQodXNlcik7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBUZXN0U3RhY2soYXBwLCAnYXdzLWNkay1hc3NldC10ZXN0Jyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/aws-cdk-asset-test.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.interface-vpc-endpoint-target.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.ts new file mode 100644 index 0000000000000..4cc943b5f8550 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.directory.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'sample-asset-directory'), + }); + /// !hide + + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-test'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js new file mode 100644 index 0000000000000..0e938fe222a60 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'file-asset.txt'), + }); + /// !hide + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-file-test'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLmZpbGUubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXNzZXRzLmZpbGUubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBRXBELE1BQU0sU0FBVSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQy9CLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQU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NldHMuQXNzZXQodGhpcywgJ1NhbXBsZUFzc2V0Jywge1xuICAgICAgcGF0aDogcGF0aC5qb2luKF9fZGlybmFtZSwgJ2ZpbGUtYXNzZXQudHh0JyksXG4gICAgfSk7XG4gICAgLy8vICFoaWRlXG5cbiAgICBjb25zdCB1c2VyID0gbmV3IGlhbS5Vc2VyKHRoaXMsICdNeVVzZXInKTtcbiAgICBhc3NldC5ncmFudFJlYWQodXNlcik7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBUZXN0U3RhY2soYXBwLCAnYXdzLWNkay1hc3NldC1maWxlLXRlc3QnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/aws-cdk-asset-file-test.template.json diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/test/integ.route53-record.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.ts new file mode 100644 index 0000000000000..f21a2905d2ddc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.file.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'file-asset.txt'), + }); + /// !hide + + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-file-test'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js new file mode 100644 index 0000000000000..cb11128bba89d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const asset = new assets.Asset(this, 'MyFile', { + path: path.join(__dirname, 'file-asset.txt'), + }); + /// !show + const group = new iam.Group(this, 'MyUserGroup'); + asset.grantRead(group); + /// !hide + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-refs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLnBlcm1pc3Npb25zLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFzc2V0cy5wZXJtaXNzaW9ucy5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFFcEQsTUFBTSxTQUFVLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDL0IsWUFBWSxLQUFjLEVBQUUsRUFBVSxFQUFFLEtBQXNCO1FBQzVELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sS0FBSyxHQUFHLElBQUksTUFBTSxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsUUFBUSxFQUFFO1lBQzdDLElBQUksRUFBRSxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxnQkFBZ0IsQ0FBQztTQUM3QyxDQUFDLENBQUM7UUFFSCxTQUFTO1FBQ1QsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxhQUFhLENBQUMsQ0FBQztRQUNqRCx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HAsICdhd3MtY2RrLWFzc2V0LXJlZnMnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/aws-cdk-asset-refs.template.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.route53.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.ts new file mode 100644 index 0000000000000..35ab962650cab --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.permissions.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const asset = new assets.Asset(this, 'MyFile', { + path: path.join(__dirname, 'file-asset.txt'), + }); + + /// !show + const group = new iam.Group(this, 'MyUserGroup'); + asset.grantRead(group); + /// !hide + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-refs'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js new file mode 100644 index 0000000000000..d35470d1ac84d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'sample-asset-directory'), + }); + new cdk.CfnOutput(this, 'S3BucketName', { value: asset.s3BucketName }); + new cdk.CfnOutput(this, 'S3ObjectKey', { value: asset.s3ObjectKey }); + new cdk.CfnOutput(this, 'S3HttpURL', { value: asset.httpUrl }); + new cdk.CfnOutput(this, 'S3ObjectURL', { value: asset.s3ObjectUrl }); + /// !hide + // we need at least one resource + asset.grantRead(new iam.User(this, 'MyUser')); + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-refs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXNzZXRzLnJlZnMubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXNzZXRzLnJlZnMubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBRXBELE1BQU0sU0FBVSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQy9CLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixTQUFTO1FBQ1QsTUFBTSxLQUFLLEdBQUcsSUFBSSxNQUFNLENBQUMsS0FBSyxDQUFDLElBQUksRUFBRSxhQUFhLEVBQUU7WUFDbEQsSUFBSSxFQUFFLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLHdCQUF3QixDQUFDO1NBQ3JELENBQUMsQ0FBQztRQUVILElBQUksR0FBRyxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFLEVBQUUsS0FBSyxFQUFFLEtBQUssQ0FBQyxZQUFZLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZFLElBQUksR0FBRyxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUUsYUFBYSxFQUFFLEVBQUUsS0FBSyxFQUFFLEtBQUssQ0FBQy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biAgICAvLy8gIXNob3dcbiAgICBjb25zdCBhc3NldCA9IG5ldyBhc3NldHMuQXNzZXQodGhpcywgJ1NhbXBsZUFzc2V0Jywge1xuICAgICAgcGF0aDogcGF0aC5qb2luKF9fZGlybmFtZSwgJ3NhbXBsZS1hc3NldC1kaXJlY3RvcnknKSxcbiAgICB9KTtcblxuICAgIG5ldyBjZGsuQ2ZuT3V0cHV0KHRoaXMsICdTM0J1Y2tldE5hbWUnLCB7IHZhbHVlOiBhc3NldC5zM0J1Y2tldE5hbWUgfSk7XG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ1MzT2JqZWN0S2V5JywgeyB2YWx1ZTogYXNzZXQuczNPYmplY3RLZXkgfSk7XG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ1MzSHR0cFVSTCcsIHsgdmFsdWU6IGFzc2V0Lmh0dHBVcmwgfSk7XG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ1MzT2JqZWN0VVJMJywgeyB2YWx1ZTogYXNzZXQuczNPYmplY3RVcmwgfSk7XG4gICAgLy8vICFoaWRlXG5cbiAgICAvLyB3ZSBuZWVkIGF0IGxlYXN0IG9uZSByZXNvdXJjZVxuICAgIGFzc2V0LmdyYW50UmVhZChuZXcgaWFtLlVzZXIodGhpcywgJ015VXNlcicpKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLWFzc2V0LXJlZnMnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-asset-file.txt diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-jar-asset.jar diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/asset.6b84b87243a4a01c592d78e1fd3855c4bfef39328cd0a450cc97e81717fea2a2/sample-zip-asset.zip diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/aws-cdk-asset-refs.template.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.docker-opts.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.ts new file mode 100644 index 0000000000000..381d222ab4d23 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.refs.lit.ts @@ -0,0 +1,28 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'sample-asset-directory'), + }); + + new cdk.CfnOutput(this, 'S3BucketName', { value: asset.s3BucketName }); + new cdk.CfnOutput(this, 'S3ObjectKey', { value: asset.s3ObjectKey }); + new cdk.CfnOutput(this, 'S3HttpURL', { value: asset.httpUrl }); + new cdk.CfnOutput(this, 'S3ObjectURL', { value: asset.s3ObjectUrl }); + /// !hide + + // we need at least one resource + asset.grantRead(new iam.User(this, 'MyUser')); + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-refs'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js new file mode 100644 index 0000000000000..79301fbf3ee7a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +class TestStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // The template must contain at least one resource, so there is this... + new iam.User(this, 'DummyResource'); + // Check that the same asset added multiple times is + // uploaded and copied. + new assets.Asset(this, 'SampleAsset1', { + path: path.join(__dirname, 'file-asset.txt'), + }); + new assets.Asset(this, 'SampleAsset2', { + path: path.join(__dirname, 'file-asset.txt'), + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-multi-assets'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubXVsdGktYXNzZXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcub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WxpYi9hd3MtaWFtJztcbmltcG9ydCAqIGFzIGNkayBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgKiBhcyBhc3NldHMgZnJvbSAnYXdzLWNkay1saWIvYXdzLXMzLWFzc2V0cyc7XG5cbmNsYXNzIFRlc3RTdGFjayBleHRlbmRzIGNkay5TdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBjZGsuQXBwLCBpZDogc3RyaW5nLCBwcm9wcz86IGNkay5TdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICAvLyBUaGUgdGVtcGxhdGUgbXVzdCBjb250YWluIGF0IGxlYXN0IG9uZSByZXNvdXJjZSwgc28gdGhlcmUgaXMgdGhpcy4uLlxuICAgIG5ldyBpYW0uVXNlcih0aGlzLCAnRHVtbXlSZXNvdXJjZScpO1xuXG4gICAgLy8gQ2hlY2sgdGhhdCB0aGUgc2FtZSBhc3NldCBhZGRlZCBtdWx0aXBsZSB0aW1lcyBpc1xuICAgIC8vIHVwbG9hZGVkIGFuZCBjb3BpZWQuXG4gICAgbmV3IGFzc2V0cy5Bc3NldCh0aGlzLCAnU2FtcGxlQXNzZXQxJywge1xuICAgICAgcGF0aDogcGF0aC5qb2luKF9fZGlybmFtZSwgJ2ZpbGUtYXNzZXQudHh0JyksXG4gICAgfSk7XG5cbiAgICBuZXcgYXNzZXRzLkFzc2V0KHRoaXMsICdTYW1wbGVBc3NldDInLCB7XG4gICAgICBwYXRoOiBwYXRoLmpvaW4oX19kaXJuYW1lLCAnZmlsZS1hc3NldC50eHQnKSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLW11bHRpLWFzc2V0cycpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.assets.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/aws-cdk-multi-assets.template.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.ts similarity index 83% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.ts index c16f8da96fb00..ed217830d92ea 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.multi-assets.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as assets from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { diff --git a/packages/@aws-cdk/aws-s3-assets/test/markdown-asset/index.md b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/markdown-asset/index.md similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/markdown-asset/index.md rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/markdown-asset/index.md diff --git a/packages/@aws-cdk/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt diff --git a/packages/@aws-cdk/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar diff --git a/packages/@aws-cdk/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js new file mode 100644 index 0000000000000..d52c6bd69b020 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cloudfront = require("aws-cdk-lib/aws-cloudfront"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const s3deploy = require("aws-cdk-lib/aws-s3-deployment"); +class TestBucketDeployment extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const bucket = new s3.Bucket(this, 'Destination3', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + const distribution = new cloudfront.CloudFrontWebDistribution(this, 'Distribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: bucket, + }, + behaviors: [{ isDefaultBehavior: true }], + }, + ], + }); + new s3deploy.BucketDeployment(this, 'DeployWithInvalidation', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket: bucket, + distribution, + distributionPaths: ['/images/*.png'], + retainOnDelete: false, // default is true, which will block the integration test cleanup + }); + } +} +const app = new cdk.App(); +new TestBucketDeployment(app, 'test-bucket-deployments-1'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWRlcGxveW1lbnQtY2xvdWRmcm9udC5qcy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3JhdGlvbiB0ZXN0IGNsZWFudXBcbiAgICB9KTtcbiAgICBjb25zdCBkaXN0cmlidXRpb24gPSBuZXcgY2xvdWRmcm9udC5DbG91ZEZyb250V2ViRGlzdHJpYnV0aW9uKHRoaXMsICdEaXN0cmlidXRpb24nLCB7XG4gICAgICBvcmlnaW5Db25maWdzOiBbXG4gICAgICAgIHtcbiAgICAgICAgICBzM09yaWdpblNvdXJjZToge1xuICAgICAgICAgICAgczNCdWNrZXRTb3VyY2U6IGJ1Y2tldCxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGJlaGF2aW9yczogW3sgaXNEZWZhdWx0QmVoYXZpb3I6IHRydWUgfV0sXG4gICAgICAgIH0sXG4gICAgICBdLFxuICAgIH0pO1xuXG4gICAgbmV3IHMzZGVwbG95LkJ1Y2tldERlcGxveW1lbnQodGhpcywgJ0RlcGxveVdpdGhJbnZhbGlkYXRpb24nLCB7XG4gICAgICBzb3VyY2VzOiBbczNkZXBsb3kuU291cmNlLmFzc2V0KHBhdGguam9pbihfX2Rpcm5hbWUsICdteS13ZWJzaXRlJykpXSxcbiAgICAgIGRlc3RpbmF0aW9uQnVja2V0OiBidWNrZXQsXG4gICAgICBkaXN0cmlidXRpb24sXG4gICAgICBkaXN0cmlidXRpb25QYXRoczogWycvaW1hZ2VzLyoucG5nJ10sXG4gICAgICByZXRhaW5PbkRlbGV0ZTogZmFsc2UsIC8vIGRlZmF1bHQgaXMgdHJ1ZSwgd2hpY2ggd2lsbCBibG9jayB0aGUgaW50ZWdyYXRpb24gdGVzdCBjbGVhbnVwXG4gICAgfSk7XG5cbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuXG5uZXcgVGVzdEJ1Y2tldERlcGxveW1lbnQoYXBwLCAndGVzdC1idWNrZXQtZGVwbG95bWVudHMtMScpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.ts diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.f98b78092dcdd31f5e6d47489beb5f804d4835ef86a8085d0a2053cb9ae711da/index.py diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/test-bucket-deployments-1.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts similarity index 84% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts index 765fc4666be32..f590c45e316f2 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as s3deploy from '../lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'; class TestBucketDeployment extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js new file mode 100644 index 0000000000000..70ea46db28c88 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_s3_deployment_1 = require("aws-cdk-lib/aws-s3-deployment"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'TestBucketDeploymentContent'); +const bucket = new aws_s3_1.Bucket(stack, 'Bucket'); +const file1 = aws_s3_deployment_1.Source.data('file1.txt', 'boom'); +const file2 = aws_s3_deployment_1.Source.data('path/to/file2.txt', `bam! ${bucket.bucketName}`); +const file3 = aws_s3_deployment_1.Source.jsonData('my-json/config.json', { website_url: bucket.bucketWebsiteUrl }); +const file4 = aws_s3_deployment_1.Source.yamlData('my-yaml/config.yaml', { website_url: bucket.bucketWebsiteUrl }); +const deployment = new aws_s3_deployment_1.BucketDeployment(stack, 'DeployMeHere', { + destinationBucket: bucket, + sources: [file1, file2], + destinationKeyPrefix: 'deploy/here/', + retainOnDelete: false, // default is true, which will block the integration test cleanup +}); +deployment.addSource(file3); +deployment.addSource(file4); +new aws_cdk_lib_1.CfnOutput(stack, 'BucketName', { value: bucket.bucketName }); +new integ_tests_alpha_1.IntegTest(app, 'integ-test-bucket-deployment-data', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWRlcGxveW1lbnQtZGF0YS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmJ1Y2tldC1kZXBsb3ltZW50LWRhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwrQ0FBNEM7QUFDNUMsNkNBQW9EO0FBQ3BELGtFQUF1RDtBQUN2RCxxRUFBeUU7QUFFekUsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFDdEIsTUFBTSxLQUFLLEdBQUc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WFtbC9jb25maWcueWFtbCcsIHsgd2Vic2l0ZV91cmw6IGJ1Y2tldC5idWNrZXRXZWJzaXRlVXJsIH0pO1xuXG5jb25zdCBkZXBsb3ltZW50ID0gbmV3IEJ1Y2tldERlcGxveW1lbnQoc3RhY2ssICdEZXBsb3lNZUhlcmUnLCB7XG4gIGRlc3RpbmF0aW9uQnVja2V0OiBidWNrZXQsXG4gIHNvdXJjZXM6IFtmaWxlMSwgZmlsZTJdLFxuICBkZXN0aW5hdGlvbktleVByZWZpeDogJ2RlcGxveS9oZXJlLycsXG4gIHJldGFpbk9uRGVsZXRlOiBmYWxzZSwgLy8gZGVmYXVsdCBpcyB0cnVlLCB3aGljaCB3aWxsIGJsb2NrIHRoZSBpbnRlZ3JhdGlvbiB0ZXN0IGNsZWFudXBcbn0pO1xuZGVwbG95bWVudC5hZGRTb3VyY2UoZmlsZTMpO1xuZGVwbG95bWVudC5hZGRTb3VyY2UoZmlsZTQpO1xuXG5uZXcgQ2ZuT3V0cHV0KHN0YWNrLCAnQnVja2V0TmFtZScsIHsgdmFsdWU6IGJ1Y2tldC5idWNrZXROYW1lIH0pO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2ludGVnLXRlc3QtYnVja2V0LWRlcGxveW1lbnQtZGF0YScsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/TestBucketDeploymentContent.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.0f14dedeaf4386031c978375cbda0f65d7b52b29452cabb8873eb8f0d0fa936b/path/to/file2.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.0f14dedeaf4386031c978375cbda0f65d7b52b29452cabb8873eb8f0d0fa936b/path/to/file2.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.0f14dedeaf4386031c978375cbda0f65d7b52b29452cabb8873eb8f0d0fa936b/path/to/file2.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.0f14dedeaf4386031c978375cbda0f65d7b52b29452cabb8873eb8f0d0fa936b/path/to/file2.txt diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.27eff729291aea0a2b33592996b9a764c233dc3387bd9cfd58c6f064073f177f/my-json/config.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.27eff729291aea0a2b33592996b9a764c233dc3387bd9cfd58c6f064073f177f/my-json/config.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.27eff729291aea0a2b33592996b9a764c233dc3387bd9cfd58c6f064073f177f/my-json/config.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.27eff729291aea0a2b33592996b9a764c233dc3387bd9cfd58c6f064073f177f/my-json/config.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.68b22621fff135f9e3f225bad7ff80fdf2f45c3d9910af601206a0d9b279933a.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.68b22621fff135f9e3f225bad7ff80fdf2f45c3d9910af601206a0d9b279933a.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.68b22621fff135f9e3f225bad7ff80fdf2f45c3d9910af601206a0d9b279933a.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.68b22621fff135f9e3f225bad7ff80fdf2f45c3d9910af601206a0d9b279933a.zip diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.939a4ab8b51f1a1cccb59d97f04c318ad41c1d404e666c158ca2810894bc5f5f/my-yaml/config.yaml b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.939a4ab8b51f1a1cccb59d97f04c318ad41c1d404e666c158ca2810894bc5f5f/my-yaml/config.yaml similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.939a4ab8b51f1a1cccb59d97f04c318ad41c1d404e666c158ca2810894bc5f5f/my-yaml/config.yaml rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.939a4ab8b51f1a1cccb59d97f04c318ad41c1d404e666c158ca2810894bc5f5f/my-yaml/config.yaml diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.d09271be89b6cb0398f793b40c1531fd9b076aa92ba80b5e436914b1808fe18d/file1.txt b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.d09271be89b6cb0398f793b40c1531fd9b076aa92ba80b5e436914b1808fe18d/file1.txt similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.d09271be89b6cb0398f793b40c1531fd9b076aa92ba80b5e436914b1808fe18d/file1.txt rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/asset.d09271be89b6cb0398f793b40c1531fd9b076aa92ba80b5e436914b1808fe18d/file1.txt diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/integtestbucketdeploymentdataDefaultTestDeployAssert6FF3075D.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.ts similarity index 80% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.ts index 4e79d0ca886a7..d31df79ccdb98 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-data.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-data.ts @@ -1,7 +1,7 @@ -import { Bucket } from '@aws-cdk/aws-s3'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { BucketDeployment, Source } from '../lib'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { BucketDeployment, Source } from 'aws-cdk-lib/aws-s3-deployment'; const app = new App(); const stack = new Stack(app, 'TestBucketDeploymentContent'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js new file mode 100644 index 0000000000000..f8ff0615ea635 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const s3deploy = require("aws-cdk-lib/aws-s3-deployment"); +class TestBucketDeployment extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.bucket = new s3.Bucket(this, 'Destination', { + publicReadAccess: false, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + const deploy = new s3deploy.BucketDeployment(this, 'DeployMe5', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website-second'))], + destinationBucket: this.bucket, + retainOnDelete: false, // default is true, which will block the integration test cleanup + }); + this.exportValue(deploy.deployedBucket.bucketWebsiteUrl, { + name: 'WebsiteUrl', + }); + } +} +const app = new cdk.App(); +const testCase = new TestBucketDeployment(app, 'test-bucket-deployment-deployed-bucket'); +new integ.IntegTest(app, 'integ-test-bucket-deployments', { + testCases: [testCase], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWRlcGxveW1lbnQt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c3RDYXNlczogW3Rlc3RDYXNlXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html diff --git a/packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-iam/test/integ.users-and-groups.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/test-bucket-deployment-deployed-bucket.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.ts similarity index 85% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.ts index 7cb2191339c64..0f304389fd8b2 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as s3deploy from '../lib'; +import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'; class TestBucketDeployment extends cdk.Stack { public readonly bucket: s3.IBucket; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js new file mode 100644 index 0000000000000..1012e96e8ce12 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js @@ -0,0 +1,115 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3deploy = require("aws-cdk-lib/aws-s3-deployment"); +class TestBucketDeployment extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const destinationBucket = new s3.Bucket(this, 'Destination', { + websiteIndexDocument: 'index.html', + publicReadAccess: false, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + new s3deploy.BucketDeployment(this, 'DeployMe', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + retainOnDelete: false, // default is true, which will block the integration test cleanup + }); + new s3deploy.BucketDeployment(this, 'DeployMeWithEfsStorage', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + destinationKeyPrefix: 'efs/', + useEfs: true, + vpc: new ec2.Vpc(this, 'InlineVpc'), + retainOnDelete: false, // default is true, which will block the integration test cleanup + }); + const bucket2 = new s3.Bucket(this, 'Destination2', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + new s3deploy.BucketDeployment(this, 'DeployWithPrefix', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket: bucket2, + destinationKeyPrefix: 'deploy/here/', + retainOnDelete: false, // default is true, which will block the integration test cleanup + }); + const bucket3 = new s3.Bucket(this, 'Destination3', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + new s3deploy.BucketDeployment(this, 'DeployWithMetadata', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket: bucket3, + retainOnDelete: false, + cacheControl: [s3deploy.CacheControl.setPublic(), s3deploy.CacheControl.maxAge(cdk.Duration.minutes(1))], + contentType: 'text/html', + metadata: { A: 'aaa', B: 'bbb', C: 'ccc' }, + }); + new s3deploy.BucketDeployment(this, 'DeployMeWithoutDeletingFilesOnDestination', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + prune: false, + retainOnDelete: false, + }); + new s3deploy.BucketDeployment(this, 'DeployMeWithExcludedFilesOnDestination', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + exclude: ['*.gif'], + retainOnDelete: false, + }); + const bucket4 = new s3.Bucket(this, 'Destination4', { + publicReadAccess: false, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + new s3deploy.BucketDeployment(this, 'DeployMeWithoutExtractingFilesOnDestination', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket: bucket4, + extract: false, + retainOnDelete: false, + }); + this.bucket5 = new s3.Bucket(this, 'Destination5', { + publicReadAccess: false, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, // needed for integration test cleanup + }); + const deploy5 = new s3deploy.BucketDeployment(this, 'DeployMe5', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website-second'))], + destinationBucket: this.bucket5, + retainOnDelete: false, // default is true, which will block the integration test cleanup + }); + deploy5.addSource(s3deploy.Source.data('some-key', 'helloworld')); + } +} +const app = new cdk.App(); +const testCase = new TestBucketDeployment(app, 'test-bucket-deployments-2'); +// Assert that DeployMeWithoutExtractingFilesOnDestination deploys a zip file to bucket4 +const integTest = new integ.IntegTest(app, 'integ-test-bucket-deployments', { + testCases: [testCase], +}); +const listObjectsCall = integTest.assertions.awsApiCall('S3', 'listObjects', { + Bucket: testCase.bucket5.bucketName, +}); +listObjectsCall.provider.addToRolePolicy({ + Effect: 'Allow', + Action: ['s3:GetObject', 's3:ListBucket'], + Resource: ['*'], +}); +listObjectsCall.expect(integ.ExpectedResult.objectLike({ + Contents: integ_tests_alpha_1.Match.arrayWith([ + integ_tests_alpha_1.Match.objectLike({ + Key: '403.html', + }), + integ_tests_alpha_1.Match.objectLike({ + Key: 'some-key', + }), + ]), +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWRlcGxveW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idWNrZXQtZGVwbG95bWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ0FBMkM7QUFDM0MseUNBQXlDO0FBQ3pDLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQsa0VBQW1EO0FBRW5ELDBEQUEwRDtBQUUxRCxNQUFNLG9CQUF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UG9saWN5KHtcbiAgRWZmZWN0OiAnQWxsb3cnLFxuICBBY3Rpb246IFsnczM6R2V0T2JqZWN0JywgJ3MzOkxpc3RCdWNrZXQnXSxcbiAgUmVzb3VyY2U6IFsnKiddLFxufSk7XG5saXN0T2JqZWN0c0NhbGwuZXhwZWN0KGludGVnLkV4cGVjdGVkUmVzdWx0Lm9iamVjdExpa2Uoe1xuICBDb250ZW50czogTWF0Y2guYXJyYXlXaXRoKFxuICAgIFtcbiAgICAgIE1hdGNoLm9iamVjdExpa2Uoe1xuICAgICAgICBLZXk6ICc0MDMuaHRtbCcsXG4gICAgICB9KSxcbiAgICAgIE1hdGNoLm9iamVjdExpa2Uoe1xuICAgICAgICBLZXk6ICdzb21lLWtleScsXG4gICAgICB9KSxcbiAgICBdLFxuICApLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.67b455acb1a39b8327b9eece665245f3ecdef054977a27de1155c58054395c54/some-key b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.67b455acb1a39b8327b9eece665245f3ecdef054977a27de1155c58054395c54/some-key similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.67b455acb1a39b8327b9eece665245f3ecdef054977a27de1155c58054395c54/some-key rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.67b455acb1a39b8327b9eece665245f3ecdef054977a27de1155c58054395c54/some-key diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.a94977ede0211fd3b45efa33d6d8d1d7bbe0c5a96d977139d8b16abfa96fe9cb/403.html diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/index.html diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/asset.fc4481abf279255619ff7418faa5d24456fef3432ea0da59c95542578ff0222e/rabir2v.gif diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/integtestbucketdeploymentsDefaultTestDeployAssertCF25A2DF.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.assets.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/test-bucket-deployments-2.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.ts similarity index 94% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.ts index 115d4b6d8875b..912d5e93ed07f 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/integ.bucket-deployment.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Match } from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Match } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as s3deploy from '../lib'; +import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'; class TestBucketDeployment extends cdk.Stack { public readonly bucket5: s3.IBucket; diff --git a/packages/@aws-cdk/aws-s3-deployment/test/my-website-second/403.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/my-website-second/403.html similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/my-website-second/403.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/my-website-second/403.html diff --git a/packages/@aws-cdk/aws-s3-deployment/test/my-website/index.html b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/my-website/index.html similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/my-website/index.html rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/my-website/index.html diff --git a/packages/@aws-cdk/aws-s3-deployment/test/my-website/rabir2v.gif b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/my-website/rabir2v.gif similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/my-website/rabir2v.gif rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-deployment/test/my-website/rabir2v.gif diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js new file mode 100644 index 0000000000000..ab9870218c498 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const s3n = require("aws-cdk-lib/aws-s3-notifications"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'test-3'); +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const topic = new sns.Topic(stack, 'Topic'); +const topic3 = new sns.Topic(stack, 'Topic3'); +bucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.SnsDestination(topic)); +bucket.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.SnsDestination(topic3), { prefix: 'home/myusername/' }); +const bucket2 = new s3.Bucket(stack, 'Bucket2', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +bucket2.addObjectRemovedNotification(new s3n.SnsDestination(topic3), { prefix: 'foo' }, { suffix: 'foo/bar' }); +const bucket3 = new s3.Bucket(stack, 'Bucket3', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const importedBucket3 = s3.Bucket.fromBucketName(stack, 'Bucket3Imported', bucket3.bucketName); +importedBucket3.addEventNotification(s3.EventType.OBJECT_CREATED_COPY, new s3n.SnsDestination(topic3)); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubm90aWZpY2F0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm5vdGlmaWNhdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBeUM7QUFDekMsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyx3REFBd0Q7QUFFeEQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxRQUFRLENBQUMsQ0FBQztBQUUzQyxNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFFBQVEsRUFBRTtJQUM1QyxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO0NBQ3pDLENBQUMsQ0FBQztBQUNILE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDNUMsTUFBTSxNQUFNLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEtBQUssRUFBRSxRQUFRLENBQUMsQ0FBQztBQUU5Qy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MicsIHtcbiAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuYnVja2V0Mi5hZGRPYmplY3RSZW1vdmVkTm90aWZpY2F0aW9uKG5ldyBzM24uU25zRGVzdGluYXRpb24odG9waWMzKSwgeyBwcmVmaXg6ICdmb28nIH0sIHsgc3VmZml4OiAnZm9vL2JhcicgfSk7XG5cbmNvbnN0IGJ1Y2tldDMgPSBuZXcgczMuQnVja2V0KHN0YWNrLCAnQnVja2V0MycsIHtcbiAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5jb25zdCBpbXBvcnRlZEJ1Y2tldDMgPSBzMy5CdWNrZXQuZnJvbUJ1Y2tldE5hbWUoc3RhY2ssICdCdWNrZXQzSW1wb3J0ZWQnLCBidWNrZXQzLmJ1Y2tldE5hbWUpO1xuaW1wb3J0ZWRCdWNrZXQzLmFkZEV2ZW50Tm90aWZpY2F0aW9uKHMzLkV2ZW50VHlwZS5PQkpFQ1RfQ1JFQVRFRF9DT1BZLCBuZXcgczNuLlNuc0Rlc3RpbmF0aW9uKHRvcGljMykpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.assets.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/test-3.template.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.ts similarity index 84% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.ts index b4fd7c3ac604f..fa83caf3474f8 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/integ.notifications.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as s3n from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as s3n from 'aws-cdk-lib/aws-s3-notifications'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js new file mode 100644 index 0000000000000..271adefe8aab6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const s3n = require("aws-cdk-lib/aws-s3-notifications"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-bucket-notifications'); +const bucketA = new s3.Bucket(stack, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const fn = new lambda.Function(stack, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), +}); +const bucketB = new s3.Bucket(stack, 'YourBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); +bucketB.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.LambdaDestination(fn)); +app.synth(); +/* eslint-disable no-console */ +function handler(event, _context, callback) { + console.log(JSON.stringify(event, undefined, 2)); + return callback(null, event); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LW5vdGlmaWNhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idWNrZXQtbm90aWZpY2F0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRDtBQUNqRCx5Q0FBeUM7QUFDekMsbUNBQW1DO0FBQ25DLHdEQUF3RDtBQUV4RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDZCQUE2QixDQUFDLENBQUM7QUFFaEUsTUFBTSxPQUFPLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDL0MsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztDQUN6QyxDQUFDLENBQUM7QUFFSCxNQUFNLEVBQUUsR0FBRyxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLFlBQVksRUFBRTtJQUNsRCxP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BzM24uTGFtYmRhRGVzdGluYXRpb24oZm4pKTtcblxuYXBwLnN5bnRoKCk7XG5cbi8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cbmZ1bmN0aW9uIGhhbmRsZXIoZXZlbnQ6IGFueSwgX2NvbnRleHQ6IGFueSwgY2FsbGJhY2s6IGFueSkge1xuICBjb25zb2xlLmxvZyhKU09OLnN0cmluZ2lmeShldmVudCwgdW5kZWZpbmVkLCAyKSk7XG4gIHJldHVybiBjYWxsYmFjayhudWxsLCBldmVudCk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.assets.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/lambda-bucket-notifications.template.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts new file mode 100644 index 0000000000000..98f2dc7d07fcc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts @@ -0,0 +1,33 @@ +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import * as s3n from 'aws-cdk-lib/aws-s3-notifications'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'lambda-bucket-notifications'); + +const bucketA = new s3.Bucket(stack, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +const fn = new lambda.Function(stack, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), +}); + +const bucketB = new s3.Bucket(stack, 'YourBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); +bucketB.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.LambdaDestination(fn)); + +app.synth(); + +/* eslint-disable no-console */ +function handler(event: any, _context: any, callback: any) { + console.log(JSON.stringify(event, undefined, 2)); + return callback(null, event); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js new file mode 100644 index 0000000000000..bab4fe3bc069d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const s3n = require("aws-cdk-lib/aws-s3-notifications"); +class MyStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const objectCreateTopic = new sns.Topic(this, 'ObjectCreatedTopic'); + const objectRemovedTopic = new sns.Topic(this, 'ObjectDeletedTopic'); + const bucket = new s3.Bucket(this, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + bucket.addObjectCreatedNotification(new s3n.SnsDestination(objectCreateTopic)); + bucket.addObjectRemovedNotification(new s3n.SnsDestination(objectRemovedTopic), { prefix: 'foo/', suffix: '.txt' }); + } +} +const app = new cdk.App(); +new MyStack(app, 'sns-bucket-notifications'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLWJ1Y2tldC1ub3RpZmljYXRpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc25zLWJ1Y2tldC1ub3RpZmljYXRpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEseUNBQXlDO0FBQ3pDLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsd0RBQXdEO0FBRXhELE1BQU0sT0FBUSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQzdCLFlBQVksS0FBYyxFQUFFLEVBQVU7UUFDcEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixNQUFNLGlCQUFpQixHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsb0JBQW9CLENBQUMsQ0FBQztRQUNwRSxNQUFNLGtCQUFrQixHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsb0JBQW9CLENBQUMsQ0FBQztRQUNyRSxNQUFNLE1B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WMgPSBuZXcgc25zLlRvcGljKHRoaXMsICdPYmplY3RDcmVhdGVkVG9waWMnKTtcbiAgICBjb25zdCBvYmplY3RSZW1vdmVkVG9waWMgPSBuZXcgc25zLlRvcGljKHRoaXMsICdPYmplY3REZWxldGVkVG9waWMnKTtcbiAgICBjb25zdCBidWNrZXQgPSBuZXcgczMuQnVja2V0KHRoaXMsICdNeUJ1Y2tldCcsIHtcbiAgICAgIHJlbW92YWxQb2xpY3k6IGNkay5SZW1vdmFsUG9saWN5LkRFU1RST1ksXG4gICAgfSk7XG5cbiAgICBidWNrZXQuYWRkT2JqZWN0Q3JlYXRlZE5vdGlmaWNhdGlvbihuZXcgczNuLlNuc0Rlc3RpbmF0aW9uKG9iamVjdENyZWF0ZVRvcGljKSk7XG4gICAgYnVja2V0LmFkZE9iamVjdFJlbW92ZWROb3RpZmljYXRpb24obmV3IHMzbi5TbnNEZXN0aW5hdGlvbihvYmplY3RSZW1vdmVkVG9waWMpLCB7IHByZWZpeDogJ2Zvby8nLCBzdWZmaXg6ICcudHh0JyB9KTtcblxuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBNeVN0YWNrKGFwcCwgJ3Nucy1idWNrZXQtbm90aWZpY2F0aW9ucycpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/integ.notifications.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.assets.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/sns-bucket-notifications.template.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.ts similarity index 78% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.ts index ffce8ec2f28b7..3091621abc8b4 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as s3n from '../../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as s3n from 'aws-cdk-lib/aws-s3-notifications'; class MyStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js new file mode 100644 index 0000000000000..6648258905e3f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const s3n = require("aws-cdk-lib/aws-s3-notifications"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'sqs-bucket-notifications'); +const bucket1 = new s3.Bucket(stack, 'Bucket1', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const queue = new sqs.Queue(stack, 'MyQueue'); +bucket1.addObjectCreatedNotification(new s3n.SqsDestination(queue)); +const bucket2 = new s3.Bucket(stack, 'Bucket2', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +bucket2.addObjectCreatedNotification(new s3n.SqsDestination(queue), { suffix: '.png' }); +const encryptedQueue = new sqs.Queue(stack, 'EncryptedQueue', { encryption: sqs.QueueEncryption.KMS }); +bucket1.addObjectRemovedNotification(new s3n.SqsDestination(encryptedQueue)); +const integTest = new integ.IntegTest(app, 'SQSBucketNotificationsTest', { + testCases: [stack], +}); +integTest.assertions + // First remove the test notifications + .awsApiCall('SQS', 'purgeQueue', { + QueueUrl: queue.queueUrl, +}) + .next(integTest.assertions + .awsApiCall('S3', 'putObject', { + Bucket: bucket2.bucketName, + Key: 'image.png', + Body: 'Some content', +})) + .next(integTest.assertions + .awsApiCall('SQS', 'receiveMessage', { + QueueUrl: queue.queueUrl, + WaitTimeSeconds: 20, +}) + .assertAtPath('Messages.0.Body.Records.0.s3.object.key', integ.ExpectedResult.stringLikeRegexp('image\\.png'))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IFF1ZXVlVXJsOiBxdWV1ZS5xdWV1ZVVybCxcbiAgICAgIFdhaXRUaW1lU2Vjb25kczogMjAsXG4gICAgfSlcbiAgICAuYXNzZXJ0QXRQYXRoKCdNZXNzYWdlcy4wLkJvZHkuUmVjb3Jkcy4wLnMzLm9iamVjdC5rZXknLCBpbnRlZy5FeHBlY3RlZFJlc3VsdC5zdHJpbmdMaWtlUmVnZXhwKCdpbWFnZVxcXFwucG5nJykpKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.assets.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/SQSBucketNotificationsTestDefaultTestDeployAssert53BCF57E.template.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/asset.382ba2a8fd0a13f6782aec5543e465f988f5c100f35ed20f90cd96b8ee53f674.bundle/index.js diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.assets.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/sqs-bucket-notifications.template.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.ts new file mode 100644 index 0000000000000..55d69fdc1a0ea --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3-notifications/test/sqs/integ.bucket-notifications.ts @@ -0,0 +1,50 @@ +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as s3n from 'aws-cdk-lib/aws-s3-notifications'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'sqs-bucket-notifications'); + +const bucket1 = new s3.Bucket(stack, 'Bucket1', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const queue = new sqs.Queue(stack, 'MyQueue'); + +bucket1.addObjectCreatedNotification(new s3n.SqsDestination(queue)); + +const bucket2 = new s3.Bucket(stack, 'Bucket2', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +bucket2.addObjectCreatedNotification(new s3n.SqsDestination(queue), { suffix: '.png' }); + +const encryptedQueue = new sqs.Queue(stack, 'EncryptedQueue', { encryption: sqs.QueueEncryption.KMS }); +bucket1.addObjectRemovedNotification(new s3n.SqsDestination(encryptedQueue)); + + +const integTest = new integ.IntegTest(app, 'SQSBucketNotificationsTest', { + testCases: [stack], +}); + +integTest.assertions + // First remove the test notifications + .awsApiCall('SQS', 'purgeQueue', { + QueueUrl: queue.queueUrl, + }) + .next(integTest.assertions + .awsApiCall('S3', 'putObject', { + Bucket: bucket2.bucketName, + Key: 'image.png', + Body: 'Some content', + })) + .next(integTest.assertions + .awsApiCall('SQS', 'receiveMessage', { + QueueUrl: queue.queueUrl, + WaitTimeSeconds: 20, + }) + .assertAtPath('Messages.0.Body.Records.0.s3.object.key', integ.ExpectedResult.stringLikeRegexp('image\\.png'))); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js new file mode 100644 index 0000000000000..916ec46796f52 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const PUT_OBJECTS_RESOURCE_TYPE = 'Custom::S3PutObjects'; +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const bucket = new s3.Bucket(this, 'Bucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + // Put objects in the bucket to ensure auto delete works as expected + const serviceToken = aws_cdk_lib_1.CustomResourceProvider.getOrCreate(this, PUT_OBJECTS_RESOURCE_TYPE, { + codeDirectory: path.join(__dirname, 'put-objects-handler'), + runtime: aws_cdk_lib_1.CustomResourceProviderRuntime.NODEJS_14_X, + policyStatements: [{ + Effect: 'Allow', + Action: 's3:PutObject', + Resource: bucket.arnForObjects('*'), + }], + }); + new aws_cdk_lib_1.CustomResource(this, 'PutObjectsCustomResource', { + resourceType: PUT_OBJECTS_RESOURCE_TYPE, + serviceToken, + properties: { + BucketName: bucket.bucketName, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-s3-bucket-auto-delete-objects', { + testCases: [new TestStack(app, 'cdk-s3-bucket-auto-delete-objects')], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWF1dG8tZGVsZXRlLW9iamVjdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idWNrZXQtYXV0by1kZWxldG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HAsICdjZGstaW50ZWctczMtYnVja2V0LWF1dG8tZGVsZXRlLW9iamVjdHMnLCB7XG4gIHRlc3RDYXNlczogW25ldyBUZXN0U3RhY2soYXBwLCAnY2RrLXMzLWJ1Y2tldC1hdXRvLWRlbGV0ZS1vYmplY3RzJyldLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.01eedf6f2e5aae25db3514bf9c65e042c4365726d7876ad9f10d35b65f5500cf/index.js diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk-s3-bucket-auto-delete-objects.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/cdkintegs3bucketautodeleteobjectsDefaultTestDeployAssert7EEB3F44.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts similarity index 87% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts index ba27583d3ce86..8163b8b6cd5bd 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-auto-delete-objects.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-auto-delete-objects.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { App, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { App, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as s3 from '../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const PUT_OBJECTS_RESOURCE_TYPE = 'Custom::S3PutObjects'; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js new file mode 100644 index 0000000000000..33802fedad6fd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + encryption: s3.BucketEncryption.S3_MANAGED, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const user = new iam.User(stack, 'MyUser'); +bucket.grantWrite(user, '*', ['s3:PutObject', 's3:DeleteObject*']); +new integ.IntegTest(app, 'BucketGrantWriteTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWdyYW50LXdyaXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYnVja2V0LWdyYW50LXdyaXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELHlDQUF5QztBQUV6QyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLFlBQVksQ0FBQyxDQUFDO0FBRS9DLE1BQU0sTUFBTSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsVUFBVSxFQUFFO0lBQzlDLFVBQVUsRUFBRSxFQUFFLENBQUMsZ0JBQWdCLENBQUMsVUFBVTtJQUMxQyxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO0NBQ3pDLENBQUMsQ0FBQ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snczM6UHV0T2JqZWN0JywgJ3MzOkRlbGV0ZU9iamVjdConXSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnQnVja2V0R3JhbnRXcml0ZVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/BucketGrantWriteTestDefaultTestDeployAssertF3318F24.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-deployed-bucket.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.ts new file mode 100644 index 0000000000000..8511caef8c466 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grant-write.ts @@ -0,0 +1,24 @@ +#!/usr/bin/env node +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-s3'); + +const bucket = new s3.Bucket(stack, 'MyBucket', { + encryption: s3.BucketEncryption.S3_MANAGED, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +const user = new iam.User(stack, 'MyUser'); + +bucket.grantWrite(user, '*', ['s3:PutObject', 's3:DeleteObject*']); + +new integ.IntegTest(app, 'BucketGrantWriteTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js new file mode 100644 index 0000000000000..969ce66b7080e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const kms = require("aws-cdk-lib/aws-kms"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3'); +const key = new kms.Key(stack, 'MyKey'); +const deleter = new iam.User(stack, 'Deleter'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + encryptionKey: key, + encryption: s3.BucketEncryption.KMS, +}); +// when +bucket.grantDelete(deleter); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-s3-grant-delete-kms', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWdyYW50ZGVsZXRlLWttcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmJ1Y2tldC1ncmFudGRlbGV0ZS1rbXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELHlDQUF5QztBQUV6QyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLFlBQVksQ0FBQyxDQUFDO0FBRS9DLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsQ0FBQyxLQUFL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aWFtLlVzZXIoc3RhY2ssICdEZWxldGVyJyk7XG5jb25zdCBidWNrZXQgPSBuZXcgczMuQnVja2V0KHN0YWNrLCAnTXlCdWNrZXQnLCB7XG4gIGVuY3J5cHRpb25LZXk6IGtleSxcbiAgZW5jcnlwdGlvbjogczMuQnVja2V0RW5jcnlwdGlvbi5LTVMsXG59KTtcblxuLy8gd2hlblxuYnVja2V0LmdyYW50RGVsZXRlKGRlbGV0ZXIpO1xuXG5uZXcgSW50ZWdUZXN0KGFwcCwgJ2Nkay1pbnRlZy1zMy1ncmFudC1kZWxldGUta21zJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/cdkintegs3grantdeletekmsDefaultTestDeployAssertEC0923BA.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.ts new file mode 100644 index 0000000000000..d9c19e77b107e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-grantdelete-kms.ts @@ -0,0 +1,24 @@ +#!/usr/bin/env node +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-s3'); + +const key = new kms.Key(stack, 'MyKey'); +const deleter = new iam.User(stack, 'Deleter'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + encryptionKey: key, + encryption: s3.BucketEncryption.KMS, +}); + +// when +bucket.grantDelete(deleter); + +new IntegTest(app, 'cdk-integ-s3-grant-delete-kms', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js new file mode 100644 index 0000000000000..ddf52e8c31ef4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +// Reproduces the issues experienced in #23588 and #23547, both resulting from +// not validating log delivery is applied correctly when the target bucket for +// server access logs is in another account. +const app = new cdk.App(); +const targetBucketStack = new cdk.Stack(app, 'aws-cdk-s3-access-logs-target'); +const sourceBucketStack = new cdk.Stack(app, 'aws-cdk-s3-access-logs-delivery'); +const targetBucket = new s3.Bucket(targetBucketStack, 'TargetBucket', { + autoDeleteObjects: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, + blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL, + enforceSSL: true, + objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED, + encryption: s3.BucketEncryption.S3_MANAGED, + accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL, +}); +new s3.Bucket(sourceBucketStack, 'SourceBucket', { + autoDeleteObjects: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, + blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL, + enforceSSL: true, + objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED, + encryption: s3.BucketEncryption.S3_MANAGED, + accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL, + serverAccessLogsBucket: targetBucket, + serverAccessLogsPrefix: 'test/', +}); +new integ.IntegTest(app, 'ServerAccessLogsImportTest', { + testCases: [sourceBucketStack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWltcG9ydC1zZXJ2ZXItYWNjZXNzLWxvZ3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idWNrZXQtaW1wb3J0LXNlcnZlci1hY2Nlc3MtbG9ncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELHlDQUF5QztBQUV6Qyw4RUFBOEU7QUFDOUUsOEVBQThFO0FBQzlFLDRDQUE0QztBQUM1QyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLGlCQUFpQixHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsK0JBQStCLENBQUMsQ0FBQztBQUM5RSxNQUFNLGlCQUFpQixHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsaUNBQWlDLENBQUMsQ0FBQztBQUVoRixNQUFNLFlBQVksR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsaUJBQWlCLEVBQUUsY0FBYyxFQUFFO0lBQ3BFLGlCQUFpQixFQUFFLElBQUk7SUFDdkIsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztJQUN4QyxpQkFBaUIsRUFBRSxFQUFFLENBQUMs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9sOiBzMy5CdWNrZXRBY2Nlc3NDb250cm9sLkJVQ0tFVF9PV05FUl9GVUxMX0NPTlRST0wsXG59KTtcbm5ldyBzMy5CdWNrZXQoc291cmNlQnVja2V0U3RhY2ssICdTb3VyY2VCdWNrZXQnLCB7XG4gIGF1dG9EZWxldGVPYmplY3RzOiB0cnVlLFxuICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxuICBibG9ja1B1YmxpY0FjY2VzczogczMuQmxvY2tQdWJsaWNBY2Nlc3MuQkxPQ0tfQUxMLFxuICBlbmZvcmNlU1NMOiB0cnVlLFxuICBvYmplY3RPd25lcnNoaXA6IHMzLk9iamVjdE93bmVyc2hpcC5CVUNLRVRfT1dORVJfRU5GT1JDRUQsXG4gIGVuY3J5cHRpb246IHMzLkJ1Y2tldEVuY3J5cHRpb24uUzNfTUFOQUdFRCxcbiAgYWNjZXNzQ29udHJvbDogczMuQnVja2V0QWNjZXNzQ29udHJvbC5CVUNLRVRfT1dORVJfRlVMTF9DT05UUk9MLFxuICBzZXJ2ZXJBY2Nlc3NMb2dzQnVja2V0OiB0YXJnZXRCdWNrZXQsXG4gIHNlcnZlckFjY2Vzc0xvZ3NQcmVmaXg6ICd0ZXN0LycsXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdTZXJ2ZXJBY2Nlc3NMb2dzSW1wb3J0VGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc291cmNlQnVja2V0U3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-delivery.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/aws-cdk-s3-access-logs-target.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.ts similarity index 91% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.ts index 612fd2e587112..af4d5fbd3f53e 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-import-server-access-logs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-import-server-access-logs.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; // Reproduces the issues experienced in #23588 and #23547, both resulting from // not validating log delivery is applied correctly when the target bucket for diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js new file mode 100644 index 0000000000000..4c323d5dc04e9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-s3'); +new s3.Bucket(stack, 'MyBucket', { + intelligentTieringConfigurations: [{ + name: 'foo', + prefix: 'bar', + archiveAccessTierTime: aws_cdk_lib_1.Duration.days(90), + deepArchiveAccessTierTime: aws_cdk_lib_1.Duration.days(180), + tags: [{ key: 'test', value: 'bazz' }], + }], +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-intelligent-tiering', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWludGVsbGlnZW50LXRpZXJpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idWNrZXQtaW50ZWxsaWdlbnQtdGllcmluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFtRDtBQUNuRCxrRUFBdUQ7QUFDdkQseUNBQXlDO0FBRXpDLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBRXRCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFFM0MsSUFBSSxFQU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AgICBkZWVwQXJjaGl2ZUFjY2Vzc1RpZXJUaW1lOiBEdXJhdGlvbi5kYXlzKDE4MCksXG4gICAgdGFnczogW3sga2V5OiAndGVzdCcsIHZhbHVlOiAnYmF6eicgfV0sXG4gIH1dLFxufSk7XG5cblxubmV3IEludGVnVGVzdChhcHAsICdjZGstaW50ZWctaW50ZWxsaWdlbnQtdGllcmluZycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/cdkintegintelligenttieringDefaultTestDeployAssertCA983383.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.ts new file mode 100644 index 0000000000000..c9f7acc108b6d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-intelligent-tiering.ts @@ -0,0 +1,22 @@ +import { App, Duration, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-s3'); + +new s3.Bucket(stack, 'MyBucket', { + intelligentTieringConfigurations: [{ + name: 'foo', + prefix: 'bar', + archiveAccessTierTime: Duration.days(90), + deepArchiveAccessTierTime: Duration.days(180), + tags: [{ key: 'test', value: 'bazz' }], + }], +}); + + +new IntegTest(app, 'cdk-integ-intelligent-tiering', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js new file mode 100644 index 0000000000000..751015abe5e92 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js @@ -0,0 +1,36 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3'); +const inventoryBucket = new s3.Bucket(stack, 'InventoryBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const myBucket = new s3.Bucket(stack, 'MyBucket', { + inventories: [ + { + destination: { + bucket: inventoryBucket, + prefix: 'reports', + }, + frequency: s3.InventoryFrequency.DAILY, + format: s3.InventoryFormat.PARQUET, + }, + ], + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const secondInventoryBucket = new s3.Bucket(stack, 'SecondBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +myBucket.addInventory({ + destination: { + bucket: secondInventoryBucket, + }, +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-bucket-inventory', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LWludmVudG9yeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmJ1Y2tldC1pbnZlbnRvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCx5Q0FBeUM7QUFFekMsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FB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ByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbm15QnVja2V0LmFkZEludmVudG9yeSh7XG4gIGRlc3RpbmF0aW9uOiB7XG4gICAgYnVja2V0OiBzZWNvbmRJbnZlbnRvcnlCdWNrZXQsXG4gIH0sXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdjZGstaW50ZWctYnVja2V0LWludmVudG9yeScsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/cdkintegbucketinventoryDefaultTestDeployAssertDAAFB0C3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.ts similarity index 85% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.ts index 090a633c8ebcd..ff29faf24f92b 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-inventory.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-inventory.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js new file mode 100644 index 0000000000000..a538f0fa7e4a9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3-bucket-object-lock'); +new s3.Bucket(stack, 'ObjectLockBucket', { + objectLockEnabled: true, +}); +new s3.Bucket(stack, 'ObjectLockWithRetentionBucket', { + objectLockDefaultRetention: s3.ObjectLockRetention.governance(cdk.Duration.days(2)), +}); +new integ.IntegTest(app, 'ServerAccessLogsImportTest', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LW9iamVjdC1sb2NrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYnVja2V0LW9iamVjdC1sb2NrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLG1DQUFtQztBQUNuQyxvREFBb0Q7QUFDcEQseUNBQXlDO0FBRXpDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsK0JBQStCLENBQUMsQ0FBQztBQUVsRSxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLGtCQUFrQixFQUFFO0lBQ3ZDLGlCQUFpQixFQUFFLElBQUk7Q0FDeEIsQ0FBQyxDQUFDO0FBRUgsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSwrQkFBK0IsRUFBRTtJQUNwRCwwQkFBMEIsRUFBRSxFQUFFLENBQUMs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/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/ServerAccessLogsImportTestDefaultTestDeployAssert076DA7F5.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/aws-cdk-s3-bucket-object-lock.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.ts similarity index 76% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.ts index 60b267d682963..9a7f5780c48b4 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-object-lock.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-object-lock.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-s3-bucket-object-lock'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js new file mode 100644 index 0000000000000..ea3a52135c259 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +/** + * Stack that defines the bucket + */ +class Producer extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const bucket = new s3.Bucket(this, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + this.myBucket = bucket; + } +} +/** + * Stack that consumes the bucket + */ +class Consumer extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const user = new iam.User(this, 'MyUser'); + props.userBucket.grantReadWrite(user); + } +} +const producer = new Producer(app, 'ProducerStack'); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-bucket-sharing', { + testCases: [new Consumer(app, 'ConsumerStack', { userBucket: producer.myBucket })], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LXNoYXJpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5idWNrZXQtc2hhcmluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELHlDQUF5QztBQUV6QyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQjs7R0FFRztBQUNILE1BQU0sUUFBUyxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBRzlCLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsSUFBSSxFQUFFLFVBQVUsRUFBRTtZQUM3QyxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO1NBQ3pDLENBQUMsQ0FBQztRQU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XQtc2hhcmluZycsIHtcbiAgdGVzdENhc2VzOiBbbmV3IENvbnN1bWVyKGFwcCwgJ0NvbnN1bWVyU3RhY2snLCB7IHVzZXJCdWNrZXQ6IHByb2R1Y2VyLm15QnVja2V0IH0pXSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ConsumerStack.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/ProducerStack.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/cdkintegbucketsharingDefaultTestDeployAssertD8250F42.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.ts similarity index 83% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.ts index efce9843d0359..d82a6c79eaf3c 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-sharing.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket-sharing.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js new file mode 100644 index 0000000000000..425dd98cee38a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const bucket = new s3.Bucket(this, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const bucket2 = s3.Bucket.fromBucketAttributes(this, 'MyBucket2', { + bucketArn: 'arn:aws:s3:::my-bucket-test', + }); + new cdk.CfnOutput(this, 'RealBucketDomain', { value: bucket.bucketDomainName }); + new cdk.CfnOutput(this, 'ImportedBucketDomain', { value: bucket2.bucketDomainName }); + } +} +const app = new cdk.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-bucket-domain-name', { + testCases: [new TestStack(app, 'aws-cdk-domain-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i5idWNrZXREb21haW5OYW1lIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLWJ1Y2tldC1kb21haW4tbmFtZScsIHtcbiAgdGVzdENhc2VzOiBbbmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLWRvbWFpbi1uYW1lJyldLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/aws-cdk-domain-name.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/cdkintegbucketdomainnameDefaultTestDeployAssert72465477.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.ts similarity index 83% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.ts index 2be6add4c317b..820ce53d5c7ec 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.domain-name.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.domain-name.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js new file mode 100644 index 0000000000000..e817caf5458fb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js @@ -0,0 +1,24 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3'); +const bucket = new s3.Bucket(stack, 'MyBucket', { + encryption: s3.BucketEncryption.KMS, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const otherwiseEncryptedBucket = new s3.Bucket(stack, 'MyOtherBucket', { + encryption: s3.BucketEncryption.S3_MANAGED, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const user = new iam.User(stack, 'MyUser'); +bucket.grantReadWrite(user); +otherwiseEncryptedBucket.grantRead(user); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-s3-bucket', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYnVja2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUNBLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsa0VBQXVEO0FBQ3ZELHlDQUF5QztBQUV6QyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLFlBQVksQ0FBQyxDQUFDO0FBRS9DLE1BQU0sTUFBTSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsVUFBVSxFQUFFO0lBQzlDLFVBQVUsRUFBRSxFQUFFLENBQUMsZ0JBQWdCLENBQUMsR0FBRztJQUNuQyxhQUFhLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxPQUFPO0NBQ3pDLENBQUMsQ0FBQztBQUVILE1BQU0sd0JBQXdCLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLEtBQUssRUFBRSxlQUFlLEVBQUU7SUFDckUsVUFBVSxFQUFFLEVBQ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WNrZXQgPSBuZXcgczMuQnVja2V0KHN0YWNrLCAnTXlPdGhlckJ1Y2tldCcsIHtcbiAgZW5jcnlwdGlvbjogczMuQnVja2V0RW5jcnlwdGlvbi5TM19NQU5BR0VELFxuICByZW1vdmFsUG9saWN5OiBjZGsuUmVtb3ZhbFBvbGljeS5ERVNUUk9ZLFxufSk7XG5cbmNvbnN0IHVzZXIgPSBuZXcgaWFtLlVzZXIoc3RhY2ssICdNeVVzZXInKTtcbmJ1Y2tldC5ncmFudFJlYWRXcml0ZSh1c2VyKTtcbm90aGVyd2lzZUVuY3J5cHRlZEJ1Y2tldC5ncmFudFJlYWQodXNlcik7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLXMzLWJ1Y2tldCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/cdkintegs3bucketDefaultTestDeployAssertB89636B8.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js new file mode 100644 index 0000000000000..1c67cd2b8ddc0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3-notifications'); +new s3.Bucket(stack, 'MyEventBridgeBucket', { + eventBridgeEnabled: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new integ.IntegTest(app, 'NotificationTest', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0Lm5vdGlmaWNhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ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DogdHJ1ZSxcbiAgcmVtb3ZhbFBvbGljeTogY2RrLlJlbW92YWxQb2xpY3kuREVTVFJPWSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ05vdGlmaWNhdGlvblRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/NotificationTestDefaultTestDeployAssertBFB81666.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/aws-cdk-s3-notifications.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.ts new file mode 100644 index 0000000000000..53b21dc556028 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.notifications.ts @@ -0,0 +1,17 @@ +#!/usr/bin/env node +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-s3-notifications'); + +new s3.Bucket(stack, 'MyEventBridgeBucket', { + eventBridgeEnabled: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +new integ.IntegTest(app, 'NotificationTest', { + testCases: [stack], +}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js new file mode 100644 index 0000000000000..9cb8d5f4cc15d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-s3-access-logs'); +const accessLogBucket = new s3.Bucket(stack, 'MyAccessLogsBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new s3.Bucket(stack, 'MyBucket', { + serverAccessLogsBucket: accessLogBucket, + serverAccessLogsPrefix: 'example', + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-s3-access-logs', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LnNlcnZlci1hY2Nlc3MtbG9ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmJ1Y2tldC5zZXJ2ZXItYWNjZXNzLWxvZ3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCx5Q0FBeUM7QUFFekMsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx3QkFBd0IsQ0FBQyxDQUFDO0FBRTNELE1BQU0sZUFBZSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxLQUFLLEVBQUUsb0JBQW9CLEVBQUU7SUFDakUsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztDQUN6QyxDQUFDLENBQUM7QUFFSCxJQUFJLEVBQUUsQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUMvQixzQkFBc0IsRUFBRSxlQUFlO0lBQ3ZDLHNCQUFzQixFQUFFL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No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/aws-cdk-s3-access-logs.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/cdkintegs3accesslogsDefaultTestDeployAssert37A16466.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.ts similarity index 77% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.ts index ac9ca66688cc2..105eac7716fc0 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.server-access-logs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.server-access-logs.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.ts similarity index 76% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.ts index ec8b536ea887e..5835343ec37a4 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js new file mode 100644 index 0000000000000..bd6a0b96ada62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const s3 = require("aws-cdk-lib/aws-s3"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const bucket = new s3.Bucket(this, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + new cdk.CfnOutput(this, 'BucketURL', { value: bucket.bucketWebsiteUrl }); + new cdk.CfnOutput(this, 'ObjectURL', { value: bucket.urlForObject('myfolder/myfile.txt') }); + new cdk.CfnOutput(this, 'VirtualHostedObjectURL', { value: bucket.virtualHostedUrlForObject('myfolder/myfile.txt') }); + new cdk.CfnOutput(this, 'VirtualHostedObjectURLNonRegional', { value: bucket.virtualHostedUrlForObject('myfolder/myfile.txt', { regional: false }) }); + new cdk.CfnOutput(this, 'S3ObjectURL', { value: bucket.s3UrlForObject('myfolder/myfile.txt') }); + } +} +const app = new cdk.App(); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-s3-urls', { + testCases: [new TestStack(app, 'aws-cdk-s3-urls')], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYnVja2V0LnVybC5qcyI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PdXRwdXQodGhpcywgJ09iamVjdFVSTCcsIHsgdmFsdWU6IGJ1Y2tldC51cmxGb3JPYmplY3QoJ215Zm9sZGVyL215ZmlsZS50eHQnKSB9KTtcbiAgICBuZXcgY2RrLkNmbk91dHB1dCh0aGlzLCAnVmlydHVhbEhvc3RlZE9iamVjdFVSTCcsIHsgdmFsdWU6IGJ1Y2tldC52aXJ0dWFsSG9zdGVkVXJsRm9yT2JqZWN0KCdteWZvbGRlci9teWZpbGUudHh0JykgfSk7XG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ1ZpcnR1YWxIb3N0ZWRPYmplY3RVUkxOb25SZWdpb25hbCcsIHsgdmFsdWU6IGJ1Y2tldC52aXJ0dWFsSG9zdGVkVXJsRm9yT2JqZWN0KCdteWZvbGRlci9teWZpbGUudHh0JywgeyByZWdpb25hbDogZmFsc2UgfSkgfSk7XG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ1MzT2JqZWN0VVJMJywgeyB2YWx1ZTogYnVja2V0LnMzVXJsRm9yT2JqZWN0KCdteWZvbGRlci9teWZpbGUudHh0JykgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcblxubmV3IEludGVnVGVzdChhcHAsICdjZGstaW50ZWctczMtdXJscycsIHtcbiAgdGVzdENhc2VzOiBbbmV3IFRlc3RTdGFjayhhcHAsICdhd3MtY2RrLXMzLXVybHMnKV0sXG59KTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/aws-cdk-s3-urls.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/cdkintegs3urlsDefaultTestDeployAssertDB43F13E.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.ts similarity index 87% rename from packages/@aws-cdk/aws-s3/test/integ.bucket.url.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.ts index 421df8bd28912..de9c8d0f07a94 100644 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.url.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.bucket.url.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js new file mode 100644 index 0000000000000..7c7508e600e64 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-s3'); +new aws_s3_1.Bucket(stack, 'MyBucket', { + lifecycleRules: [{ + noncurrentVersionExpiration: aws_cdk_lib_1.Duration.days(30), + noncurrentVersionsToRetain: 123, + }], +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-lifecycle-expiration', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGlmZWN5Y2xlLWV4cGlyYXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5saWZlY3ljbGUtZXhwaXJhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFtRDtBQU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HAsICdjZGstaW50ZWctbGlmZWN5Y2xlLWV4cGlyYXRpb24nLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/cdkinteglifecycleexpirationDefaultTestDeployAssertDFC0D8F1.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.ts new file mode 100644 index 0000000000000..38efbb45ff338 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle-expiration.ts @@ -0,0 +1,18 @@ +import { App, Duration, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-s3'); + +new Bucket(stack, 'MyBucket', { + lifecycleRules: [{ + noncurrentVersionExpiration: Duration.days(30), + noncurrentVersionsToRetain: 123, + }], +}); + +new IntegTest(app, 'cdk-integ-lifecycle-expiration', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js new file mode 100644 index 0000000000000..847a517c049c0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-s3'); +// Test a lifecycle rule with an expiration DATE +new aws_s3_1.Bucket(stack, 'MyBucket', { + lifecycleRules: [ + { + expirationDate: new Date('2019-10-01'), + }, + { + expirationDate: new Date('2019-10-01'), + objectSizeLessThan: 600, + objectSizeGreaterThan: 500, + }, + ], + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-lifecycle', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGlmZWN5Y2xlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGlmZWN5Y2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkNBQXdEO0FBQ3hELGtFQUF1RDtBQUN2RCwrQ0FBNEM7QUFFNUMsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFFdEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLEdBQUcsRUFBRSxZQUFZLENBQUMsQ0FBQztBQUUzQyxnREFBZ0Q7QUFDaEQsSUFBSSxlQUFNLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUM1QixjQUFjLEVBQUU7UUFDZDtZQUNFLGNBQWMsRUFBRSxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUM7U0FDdkM7UUFDRDtZQUNFLGNBQWMsRUFBRSxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUM7WUFDdEMsa0JBQWtCLEVBQUUsR0FBRztZQUN2QixxQkFBcUIsRUFBRSxHQUFHO1NBQzNCO0tBQ0Y7SUFDRCxhQUFhLEVBQUUsMkJBQWEsQ0FBQy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ff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/aws-cdk-s3.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.assets.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.template.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/cdkinteglifecycleDefaultTestDeployAssert83FA03B1.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.lifecycle.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.ts new file mode 100644 index 0000000000000..d77f26f742559 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/integ.lifecycle.ts @@ -0,0 +1,26 @@ +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-s3'); + +// Test a lifecycle rule with an expiration DATE +new Bucket(stack, 'MyBucket', { + lifecycleRules: [ + { + expirationDate: new Date('2019-10-01'), + }, + { + expirationDate: new Date('2019-10-01'), + objectSizeLessThan: 600, + objectSizeGreaterThan: 500, + }, + ], + removalPolicy: RemovalPolicy.DESTROY, +}); + +new IntegTest(app, 'cdk-integ-lifecycle', { + testCases: [stack], +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.d.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.js new file mode 100644 index 0000000000000..cc9a2d16bd8f8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.handler = void 0; +// eslint-disable-next-line import/no-extraneous-dependencies +const aws_sdk_1 = require("aws-sdk"); +const s3 = new aws_sdk_1.S3(); +async function handler(event) { + switch (event.RequestType) { + case 'Create': + if (event.ResourceProperties.Fail) { + throw new Error('Failing on request!'); + } + const bucketName = event.ResourceProperties.BucketName; + if (!bucketName) { + throw new Error('Missing BucketName'); + } + return putObjects(bucketName); + case 'Update': + case 'Delete': + return; + } +} +exports.handler = handler; +async function putObjects(bucketName, n = 5) { + // Put n objects in parallel + await Promise.all([...Array(n).keys()] + .map(key => s3.putObject({ + Bucket: bucketName, + Key: `Key${key}`, + Body: `Body${key}`, + }).promise())); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sRUFBRSxHQUFHLElBQUksWUFBRSxFQUFFLENBQUM7QUFFYixLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQWtEO0lBQzlFLFFBQVEsS0FBSyxDQUFDLFdBQVcsRUFBRTtRQUN6QixLQUFLLFFBQVE7WUFDWCxJQUFJLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxJQUFJLEVBQUU7Z0JBQ2pDLE1BQU0sSUFBSSxLQUFLLENBQUMscUJBQXFCLENBQUMsQ0FBQzthQUN4QztZQUNELE1BQU0sVUFBVSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxVQUFVLENBQUM7WUFDdkQsSUFBSSxDQUFDLFVBQVUsRUFBRTtnQkFDZixNQUFNLElBQUksS0FBSyxDQUFDLG9CQUFvQixDQUFDLENBQUM7YUFDdkM7WUFDRCxPQUFPLFVBQVUsQ0FBQyxVQUFVLENBQUMsQ0FBQztRQUNoQyxLQUFLLFFBQVEsQ0FBQztRQUNkLEtBQUssUUFBUTtZQUNYLE9BQU87S0FDVjtBQUNILENBQUM7QUFmRCwwQkFlQztBQUVELEtBQUssVUFBVSxVQUFVLENBQUMsVUFBa0IsRUFBRSxDQUFDLEdBQUcsQ0F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1lJyk7XG4gICAgICB9XG4gICAgICByZXR1cm4gcHV0T2JqZWN0cyhidWNrZXROYW1lKTtcbiAgICBjYXNlICdVcGRhdGUnOlxuICAgIGNhc2UgJ0RlbGV0ZSc6XG4gICAgICByZXR1cm47XG4gIH1cbn1cblxuYXN5bmMgZnVuY3Rpb24gcHV0T2JqZWN0cyhidWNrZXROYW1lOiBzdHJpbmcsIG4gPSA1KSB7XG4gIC8vIFB1dCBuIG9iamVjdHMgaW4gcGFyYWxsZWxcbiAgYXdhaXQgUHJvbWlzZS5hbGwoWy4uLkFycmF5KG4pLmtleXMoKV1cbiAgICAubWFwKGtleSA9PiBzMy5wdXRPYmplY3Qoe1xuICAgICAgQnVja2V0OiBidWNrZXROYW1lLFxuICAgICAgS2V5OiBgS2V5JHtrZXl9YCxcbiAgICAgIEJvZHk6IGBCb2R5JHtrZXl9YCxcbiAgICB9KS5wcm9taXNlKCkpKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/put-objects-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/test/put-objects-handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-s3/test/put-objects-handler/index.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js new file mode 100644 index 0000000000000..c07e270cb28ce --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const secret = new secretsmanager.Secret(this, 'Secret'); + secret.addRotationSchedule('Schedule', { + hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), + }); + const customSecret = new secretsmanager.Secret(this, 'CustomSecret', { + generateSecretString: { + excludeCharacters: '&@/', + }, + }); + customSecret.addRotationSchedule('Schedule', { + hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'cdk-integ-secret-hosted-rotation'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaG9zdGVkLXJvdGF0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaG9zdGVkLXJvdGF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLGlFQUFpRTtBQUVqRSxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxNQUFNLEdBQUcsSUFBSSxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxRQUFRLENBQUMsQ0FBQztRQUN6RCxNQUFNLENBQUMsbUJBQW1CLENBQUMsVUFBVSxFQUFFO1lBQ3JDLGNBQWMsRUFBRSxjQUFjLENBQUMsY0FBYyxDQUFDLGVBQWUsRUFBRTtTQUNoRSxDQUFDLENBQUM7UUFFSCxNQUFNLFlBQVksR0FBRyxJQUF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PSBuZXcgc2VjcmV0c21hbmFnZXIuU2VjcmV0KHRoaXMsICdDdXN0b21TZWNyZXQnLCB7XG4gICAgICBnZW5lcmF0ZVNlY3JldFN0cmluZzoge1xuICAgICAgICBleGNsdWRlQ2hhcmFjdGVyczogJyZALycsXG4gICAgICB9LFxuICAgIH0pO1xuICAgIGN1c3RvbVNlY3JldC5hZGRSb3RhdGlvblNjaGVkdWxlKCdTY2hlZHVsZScsIHtcbiAgICAgIGhvc3RlZFJvdGF0aW9uOiBzZWNyZXRzbWFuYWdlci5Ib3N0ZWRSb3RhdGlvbi5teXNxbFNpbmdsZVVzZXIoKSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdjZGstaW50ZWctc2VjcmV0LWhvc3RlZC1yb3RhdGlvbicpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.assets.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.template.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk-integ-secret-hosted-rotation.template.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.ts similarity index 86% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.ts index 16a9e5352f4de..a5ec40c9ecc37 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.hosted-rotation.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as secretsmanager from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js new file mode 100644 index 0000000000000..c7e0a52cd70e4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kms = require("aws-cdk-lib/aws-kms"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const key = new kms.Key(this, 'Key', { removalPolicy: cdk.RemovalPolicy.DESTROY }); + const secret = new secretsmanager.Secret(this, 'Secret', { + encryptionKey: key, + }); + secret.addRotationSchedule('Schedule', { + rotationLambda: new lambda.Function(this, 'Lambda', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('NOOP'), + }), + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'cdk-integ-secret-lambda-rotation'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGFtYmRhLXJvdGF0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGFtYmRhLXJvdGF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLGlEQUFpRDtBQUNqRCxtQ0FBbUM7QUFDbkMsaUVBQWlFO0FBRWpFLE1BQU0sU0FBVSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQy9CLFlBQVksS0FBYyxFQUFFLEVBQVU7UUFDcEMsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLEtBQUssRUFBRSxFQUFFLGFBQWEsRUFBRSxHQUFHLENBQUMsYUFBYSxDQUFDLE9BQU8sRUFBRSxDQUFDLENBQUM7UUFFbkYsTUFBTSxNQUFNLEdBQUcsSUFBSSxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUU7WUFDdkQsYUFBYSxFQUFFLEdBQUc7U0FDbkIsQ0FBQyxDQUFDO1FBRUgsTUFBTSxDQUFDLG1CQUFtQixDQUFDLFVBQVUsRUFBRTtZQUNyQyxjQUFjLEVBQUUsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxRQUFRLEVBQUU7Z0JBQ2xELE9BQU8sRUFBRSxNQUFNLENBQUMsT0F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GlvblNjaGVkdWxlKCdTY2hlZHVsZScsIHtcbiAgICAgIHJvdGF0aW9uTGFtYmRhOiBuZXcgbGFtYmRhLkZ1bmN0aW9uKHRoaXMsICdMYW1iZGEnLCB7XG4gICAgICAgIHJ1bnRpbWU6IGxhbWJkYS5SdW50aW1lLk5PREVKU18xNF9YLFxuICAgICAgICBoYW5kbGVyOiAnaW5kZXguaGFuZGxlcicsXG4gICAgICAgIGNvZGU6IGxhbWJkYS5Db2RlLmZyb21JbmxpbmUoJ05PT1AnKSxcbiAgICAgIH0pLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1zZWNyZXQtbGFtYmRhLXJvdGF0aW9uJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.assets.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.assets.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.template.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk-integ-secret-lambda-rotation.template.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.ts similarity index 76% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.ts index 09c7c5dcbabf3..eedd5f6654472 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.lambda-rotation.ts @@ -1,7 +1,7 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as secretsmanager from '../lib'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js new file mode 100644 index 0000000000000..b9ef3110e04ee --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +class TestStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const secret = new secretsmanager.Secret(this, 'Secret'); + secret.addReplicaRegion('eu-central-1'); + } +} +const app = new cdk.App(); +new TestStack(app, 'cdk-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Y3JldHNtYW5hZ2VyLlNlY3JldCh0aGlzLCAnU2VjcmV0Jyk7XG4gICAgc2VjcmV0LmFkZFJlcGxpY2FSZWdpb24oJ2V1LWNlbnRyYWwtMScpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1zZWNyZXRzLXJlcGxpY2EnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.assets.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.assets.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.template.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/cdk-integ-secrets-replica.template.json diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.ts similarity index 75% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.ts index b172a46eac567..c8d8e91dc2885 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.replica.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as secretsmanager from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; class TestStack extends cdk.Stack { constructor(scope: cdk.App, id: string) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.handler/index.js similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.handler/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.handler/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js new file mode 100644 index 0000000000000..69af6652b7c5e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const cdk = require("aws-cdk-lib"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +/** + * Creates several secrets, with varying names and IDs, with the parseOwnedSecretName feature flag set, + * to verify the secretName returned by `Secret.secretName` matches the `Name` returned by `DescribeSecrets`. + */ +class SecretsManagerStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const defaultSecret = new secretsmanager.Secret(this, 'DefaultSecret'); + const namedSecret = new secretsmanager.Secret(this, 'NamedSecret', { secretName: 'namedSecret' }); + const namedSecretWithHyphen = new secretsmanager.Secret(this, 'NamedSecretWithHyphen', { secretName: 'named-secret-1' }); + const longSecret = new secretsmanager.Secret(this, 'AReallyLongLogicalIThatWillBeTrimmedBeforeItsUsedInTheName'); + const secrets = [defaultSecret, namedSecret, namedSecretWithHyphen, longSecret]; + const resourceType = 'Custom::IntegVerificationSecretNameMatches'; + const serviceToken = cdk.CustomResourceProvider.getOrCreate(this, resourceType, { + codeDirectory: path.join(__dirname, 'integ.secret-name-parsed.handler'), + runtime: cdk.CustomResourceProviderRuntime.NODEJS_14_X, + policyStatements: [{ + Effect: 'Allow', + Resource: secrets.map(s => s.secretArn), + Action: ['secretsmanager:DescribeSecret'], + }], + }); + new cdk.CustomResource(this, 'SecretNameVerification', { + resourceType: resourceType, + serviceToken, + properties: { + Secrets: secrets.map(s => ({ secretArn: s.secretArn, secretName: s.secretName })), + }, + }); + } +} +const app = new cdk.App(); +new SecretsManagerStack(app, 'Integ-SecretsManager-ParsedSecretName'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VjcmV0LW5hbWUtcGFyc2VkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2VjcmV0LW5hbWUtcGFyc2VkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLG1DQUFtQztBQUNuQyxpRUFBaUU7QUFFakU7OztHQUdHO0FBRUgsTUFBTSxtQkFBb0IsU0FBUSxHQUFHLENBQUMsS0FBSztJQUN6QyxZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxhQUFhLEdBQUcsSUFBSSxjQUFjLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxlQUFlLENBQUMsQ0FBQztRQUN2RSxNQUFNLFdBQVcsR0FBRyxJQUFJLGNBQWMsQ0FBQyxNQUFNLENBQUMsSUFBSSxFQUFFLGFBQWEsRUFBRSxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsQ0FBQyxDQUFDO1FBQ2xHLE1BQU0scUJBQXFC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XG4gICAgICAgIFJlc291cmNlOiBzZWNyZXRzLm1hcChzID0+IHMuc2VjcmV0QXJuKSxcbiAgICAgICAgQWN0aW9uOiBbJ3NlY3JldHNtYW5hZ2VyOkRlc2NyaWJlU2VjcmV0J10sXG4gICAgICB9XSxcbiAgICB9KTtcbiAgICBuZXcgY2RrLkN1c3RvbVJlc291cmNlKHRoaXMsICdTZWNyZXROYW1lVmVyaWZpY2F0aW9uJywge1xuICAgICAgcmVzb3VyY2VUeXBlOiByZXNvdXJjZVR5cGUsXG4gICAgICBzZXJ2aWNlVG9rZW4sXG4gICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgIFNlY3JldHM6IHNlY3JldHMubWFwKHMgPT4gKHsgc2VjcmV0QXJuOiBzLnNlY3JldEFybiwgc2VjcmV0TmFtZTogcy5zZWNyZXROYW1lIH0pKSxcbiAgICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBTZWNyZXRzTWFuYWdlclN0YWNrKGFwcCwgJ0ludGVnLVNlY3JldHNNYW5hZ2VyLVBhcnNlZFNlY3JldE5hbWUnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.assets.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.assets.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.template.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/Integ-SecretsManager-ParsedSecretName.template.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/index.js similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/index.js diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/test/integ.multi-assets.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.ts similarity index 94% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.ts index fcb06b6a6c0ce..66747f387d990 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret-name-parsed.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as secretsmanager from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; /** * Creates several secrets, with varying names and IDs, with the parseOwnedSecretName feature flag set, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js new file mode 100644 index 0000000000000..ad594a876e3ff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const secretsmanager = require("aws-cdk-lib/aws-secretsmanager"); +class SecretsManagerStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + const role = new iam.Role(this, 'TestRole', { assumedBy: new iam.AccountRootPrincipal() }); + /// !show + // Default secret + const secret = new secretsmanager.Secret(this, 'Secret'); + secret.grantRead(role); + const user = new iam.User(this, 'User', { + password: secret.secretValue, + }); + // Templated secret + const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { + generateSecretString: { + secretStringTemplate: JSON.stringify({ username: 'user' }), + generateStringKey: 'password', + }, + }); + new iam.User(this, 'OtherUser', { + // 'userName' is not actually a secret, so it's okay to use `unsafeUnwrap` to convert + // the `SecretValue` into a 'string'. + userName: templatedSecret.secretValueFromJson('username').unsafeUnwrap(), + password: templatedSecret.secretValueFromJson('password'), + }); + // Secret with predefined value + const accessKey = new iam.AccessKey(this, 'AccessKey', { user }); + new secretsmanager.Secret(this, 'PredefinedSecret', { + secretStringValue: accessKey.secretAccessKey, + }); + // JSON secret + new secretsmanager.Secret(this, 'JSONSecret', { + secretObjectValue: { + username: aws_cdk_lib_1.SecretValue.unsafePlainText(user.userName), + database: aws_cdk_lib_1.SecretValue.unsafePlainText('foo'), + password: accessKey.secretAccessKey, + }, + }); + /// !hide + } +} +const app = new cdk.App(); +new SecretsManagerStack(app, 'Integ-SecretsManager-Secret'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VjcmV0LmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNlY3JldC5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDZDQUEwQztBQUMxQyxpRUFBaUU7QUFFakUsTUFBTSxtQkFBb0IsU0FBUSxHQUFHLENBQUMsS0FBSztJQUN6QyxZQUFZLEtBQWMsRUFBRSxFQUFVO1FBQ3BDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxJQUFJLEdBQUcsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxVQUFVLEVBQ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nZXItU2VjcmV0Jyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.assets.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.assets.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.template.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/Integ-SecretsManager-Secret.template.json diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.ts new file mode 100644 index 0000000000000..16661b50ec542 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-secretsmanager/test/integ.secret.lit.ts @@ -0,0 +1,57 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { SecretValue } from 'aws-cdk-lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; + +class SecretsManagerStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const role = new iam.Role(this, 'TestRole', { assumedBy: new iam.AccountRootPrincipal() }); + + /// !show + // Default secret + const secret = new secretsmanager.Secret(this, 'Secret'); + secret.grantRead(role); + + const user = new iam.User(this, 'User', { + password: secret.secretValue, + }); + + // Templated secret + const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { + generateSecretString: { + secretStringTemplate: JSON.stringify({ username: 'user' }), + generateStringKey: 'password', + }, + }); + + new iam.User(this, 'OtherUser', { + // 'userName' is not actually a secret, so it's okay to use `unsafeUnwrap` to convert + // the `SecretValue` into a 'string'. + userName: templatedSecret.secretValueFromJson('username').unsafeUnwrap(), + password: templatedSecret.secretValueFromJson('password'), + }); + + // Secret with predefined value + const accessKey = new iam.AccessKey(this, 'AccessKey', { user }); + new secretsmanager.Secret(this, 'PredefinedSecret', { + secretStringValue: accessKey.secretAccessKey, + }); + + // JSON secret + new secretsmanager.Secret(this, 'JSONSecret', { + secretObjectValue: { + username: SecretValue.unsafePlainText(user.userName), + database: SecretValue.unsafePlainText('foo'), + password: accessKey.secretAccessKey, + }, + }); + /// !hide + } +} + +const app = new cdk.App(); +new SecretsManagerStack(app, 'Integ-SecretsManager-Secret'); + +app.synth(); diff --git a/packages/@aws-cdk/aws-servicecatalog/test/assets/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/assets/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/assets/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/assets/index.py diff --git a/packages/@aws-cdk/aws-servicecatalog/test/assetsv2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/assetsv2/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/assetsv2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/assetsv2/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js new file mode 100644 index 0000000000000..97b88a9f6994e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js @@ -0,0 +1,77 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const servicecatalog = require("aws-cdk-lib/aws-servicecatalog"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-servicecatalog-portfolio'); +const role = new iam.Role(stack, 'TestRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); +const group = new iam.Group(stack, 'TestGroup'); +const portfolio = new servicecatalog.Portfolio(stack, 'TestPortfolio', { + displayName: 'TestPortfolio', + providerName: 'TestProvider', + description: 'This is our Service Catalog Portfolio', + messageLanguage: servicecatalog.MessageLanguage.EN, +}); +portfolio.giveAccessToRole(role); +portfolio.giveAccessToGroup(group); +const tagOptions = new servicecatalog.TagOptions(stack, 'TagOptions', { + allowedValuesForTags: { + key1: ['value1', 'value2'], + key2: ['value1'], + }, +}); +portfolio.associateTagOptions(tagOptions); +portfolio.shareWithAccount('123456789012'); +const product = new servicecatalog.CloudFormationProduct(stack, 'TestProduct', { + productName: 'testProduct', + owner: 'testOwner', + productVersions: [ + { + validateTemplate: false, + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromUrl('https://awsdocs.s3.amazonaws.com/servicecatalog/development-environment.template'), + }, + ], + tagOptions: tagOptions, +}); +portfolio.addProduct(product); +portfolio.constrainTagUpdates(product); +const topic = new sns.Topic(stack, 'Topic1'); +const specialTopic = new sns.Topic(stack, 'specialTopic'); +portfolio.notifyOnStackEvents(product, topic); +portfolio.notifyOnStackEvents(product, specialTopic, { + description: 'special topic description', + messageLanguage: servicecatalog.MessageLanguage.EN, +}); +const launchRole = new iam.Role(stack, 'LaunchRole', { + assumedBy: new iam.ServicePrincipal('servicecatalog.amazonaws.com'), +}); +portfolio.setLaunchRole(product, launchRole); +const secondPortfolio = new servicecatalog.Portfolio(stack, 'SecondTestPortfolio', { + displayName: 'SecondTestPortfolio', + providerName: 'TestProvider', +}); +const adminRole = new iam.Role(stack, 'AdminRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); +secondPortfolio.deployWithStackSets(product, { + accounts: ['000000000000', '111111111111', '222222222222'], + regions: ['us-east-1', 'us-west-2', 'eu-west-1'], + adminRole: adminRole, + executionRoleName: 'StackSetExecutionRole', + allowStackSetInstanceOperations: true, +}); +portfolio.constrainCloudFormationParameters(product, { + rule: { + ruleName: 'SubnetsinVPC', + assertions: [{ + assert: cdk.Fn.conditionEachMemberIn(cdk.Fn.valueOfAll('AWs::EC2::Subnet::Id', 'VpcId'), cdk.Fn.refAll('AWS::EC2::VPC::Id')), + description: 'test description', + }], + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucG9ydGZvbGlvLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucG9ydGZvbGlvLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsaUVBQWlFO0FBRWpFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZ0NBQWdDLENBQUMsQ0FBQztBQUVuRSxNQUFNLElBQUksR0FBRyxJQUFJLEdBQUcsQ0FBQyxJQUFJLENBQUMsS0FBSyxFQUFFLFVBQVUsRUFBRTtJQUMzQyxTQUFTLEVBQUUsSUFBSSxHQUFHLENBQUMsb0JBQW9CLEVBQUU7Q0FDMUMsQ0FBQyxDQUFDO0FBRUgsTUFBTSxLQUFLLEdBQUc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SddLFxuICBhZG1pblJvbGU6IGFkbWluUm9sZSxcbiAgZXhlY3V0aW9uUm9sZU5hbWU6ICdTdGFja1NldEV4ZWN1dGlvblJvbGUnLFxuICBhbGxvd1N0YWNrU2V0SW5zdGFuY2VPcGVyYXRpb25zOiB0cnVlLFxufSk7XG5cbnBvcnRmb2xpby5jb25zdHJhaW5DbG91ZEZvcm1hdGlvblBhcmFtZXRlcnMocHJvZHVjdCwge1xuICBydWxlOiB7XG4gICAgcnVsZU5hbWU6ICdTdWJuZXRzaW5WUEMnLFxuICAgIGFzc2VydGlvbnM6IFt7XG4gICAgICBhc3NlcnQ6IGNkay5Gbi5jb25kaXRpb25FYWNoTWVtYmVySW4oXG4gICAgICAgIGNkay5Gbi52YWx1ZU9mQWxsKCdBV3M6OkVDMjo6U3VibmV0OjpJZCcsICdWcGNJZCcpLFxuICAgICAgICBjZGsuRm4ucmVmQWxsKCdBV1M6OkVDMjo6VlBDOjpJZCcpKSxcbiAgICAgIGRlc2NyaXB0aW9uOiAndGVzdCBkZXNjcmlwdGlvbicsXG4gICAgfV0sXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.hosted-rotation.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.assets.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ-servicecatalog-portfolio.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.ts similarity index 93% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.ts index c5941dec42062..0f5cade9d96ba 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.portfolio.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as servicecatalog from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as servicecatalog from 'aws-cdk-lib/aws-servicecatalog'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'integ-servicecatalog-portfolio'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js new file mode 100644 index 0000000000000..1590ea7c2f0ff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js @@ -0,0 +1,144 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const servicecatalog = require("aws-cdk-lib/aws-servicecatalog"); +const aws_servicecatalog_1 = require("aws-cdk-lib/aws-servicecatalog"); +/** + * Follow these instructions to manually test provisioning a Product with an Asset with the resources provisioned in this stack: + * + * 1. Deploy the stack: + ``` + $ cdk deploy --app "node integ.product.js" integ-servicecatalog-product + ``` + * + * 2. Obtain IAM Principal ARN that will provision product. + One way this can be done is by using + ``` + $ aws sts get-caller-identity + ``` + * + * 3. Associate your principal to your portfolio. PortfolioId is stored as an output values from the deployed stack. + ``` + $ aws servicecatalog associate-principal-with-portfolio \ + --portfolio-id= \ + --principal-arn= \ + --principal-type=IAM + ``` + * + * 4. Provision Product using the following prefilled values. + ``` + $ aws servicecatalog provision-product \ + --provisioned-product-name=testAssetProvisioningProduct \ + --product-name=testProduct \ + --provisioning-artifact-name=testAssetProduct + ``` + * + * 5. Verify Provision Product was provisioned providing the ProvisionedProductId from the previous step. + ``` + $ aws servicecatalog describe-provisioned-product --id= + ``` + * + * 6. Terminate Provisioned Product providing the ProvisionedProductId from the previous step. + ``` + $ aws servicecatalog terminate-provisioned-product --provisioned-product-id= + ``` + * + * 7. Disassociate your principal from your portfolio. + ``` + $ aws servicecatalog disassociate-principal-from-portfolio \ + --portfolio-id= \ + --principal-arn= \ + ``` + * + * 8. Destroy the stack: + ``` + $ cdk destroy --app "node integ.product.js" integ-servicecatalog-product + ``` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-servicecatalog-product', { + env: { + account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION, + }, +}); +class TestProductStack extends servicecatalog.ProductStack { + constructor(scope, id) { + super(scope, id); + new sns.Topic(this, 'TopicProduct'); + } +} +const portfolio = new servicecatalog.Portfolio(stack, 'TestPortfolio', { + displayName: 'TestPortfolio', + providerName: 'TestProvider', + description: 'This is our Service Catalog Portfolio', + messageLanguage: servicecatalog.MessageLanguage.EN, +}); +class TestAssetProductStack extends servicecatalog.ProductStack { + constructor(scope, id, props) { + super(scope, id, props); + new lambda.Function(this, 'HelloHandler', { + runtime: lambda.Runtime.PYTHON_3_9, + code: lambda.Code.fromAsset('./assets'), + handler: 'index.handler', + }); + new lambda.Function(this, 'HelloHandler2', { + runtime: lambda.Runtime.PYTHON_3_9, + code: lambda.Code.fromAsset('./assetsv2'), + handler: 'index.handler', + }); + } +} +const productStackHistory = new aws_servicecatalog_1.ProductStackHistory(stack, 'ProductStackHistory', { + productStack: new TestProductStack(stack, 'SNSTopicProduct3'), + currentVersionName: 'v1', + currentVersionLocked: false, +}); +const testAssetBucket = new s3.Bucket(stack, 'TestAssetBucket', { + bucketName: `product-stack-asset-bucket-${stack.account}-${stack.region}`, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const product = new servicecatalog.CloudFormationProduct(stack, 'TestProduct', { + productName: 'testProduct', + owner: 'testOwner', + productVersions: [ + { + validateTemplate: false, + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromUrl('https://awsdocs.s3.amazonaws.com/servicecatalog/development-environment.template'), + }, + { + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromAsset(path.join(__dirname, 'product1.template.json')), + }, + { + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromAsset(path.join(__dirname, 'product2.template.json')), + }, + { + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new TestProductStack(stack, 'SNSTopicProduct1')), + }, + { + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new TestProductStack(stack, 'SNSTopicProduct2')), + }, + { + productVersionName: 'testAssetProduct', + validateTemplate: false, + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new TestAssetProductStack(stack, 'S3AssetProduct', { + assetBucket: testAssetBucket, + })), + }, + productStackHistory.currentVersion(), + ], +}); +new integ_tests_alpha_1.IntegTest(app, 'integ-product', { + testCases: [stack], + enableLookups: true, +}); +portfolio.addProduct(product); +new cdk.CfnOutput(stack, 'PortfolioId', { value: portfolio.portfolioId }); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvZHVjdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnByb2R1Y3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsaURBQWlEO0FBQ2pELHlDQUF5QztBQUN6QywyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCxpRUFBaUU7QUFDakUsdUVBQXdGO0FBRXhGOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FtREc7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDhCQUE4QixFQUFFO0lBQy9ELEdBQUcsRUFBRTtRQUNILE9BQU8sRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLGlCQUFpQixJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsbUJBQW1CO1FBQ3pFLE1BQU0sRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLGdCQUFnQixJQUFJLE9BQU8sQ0FBQyxHQUFHLENBQUMsa0JBQWtCO0tBQ3ZFO0NBQ0YsQ0FBQyxDQUFDO0FBRUgsTUFBTSxnQkFBaUIsU0FBUSxjQUFjLENBQUMsWUFBWTtJQUN4RCxZQUFZLEtBQVUsRUFBRSxFQUFVO1FBQ2hDLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsSU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RGb3JtYXRpb25UZW1wbGF0ZS5mcm9tUHJvZHVjdFN0YWNrKG5ldyBUZXN0UHJvZHVjdFN0YWNrKHN0YWNrLCAnU05TVG9waWNQcm9kdWN0MicpKSxcbiAgICB9LFxuICAgIHtcbiAgICAgIHByb2R1Y3RWZXJzaW9uTmFtZTogJ3Rlc3RBc3NldFByb2R1Y3QnLFxuICAgICAgdmFsaWRhdGVUZW1wbGF0ZTogZmFsc2UsXG4gICAgICBjbG91ZEZvcm1hdGlvblRlbXBsYXRlOiBzZXJ2aWNlY2F0YWxvZy5DbG91ZEZvcm1hdGlvblRlbXBsYXRlLmZyb21Qcm9kdWN0U3RhY2sobmV3IFRlc3RBc3NldFByb2R1Y3RTdGFjayhzdGFjaywgJ1MzQXNzZXRQcm9kdWN0Jywge1xuICAgICAgICBhc3NldEJ1Y2tldDogdGVzdEFzc2V0QnVja2V0LFxuICAgICAgfSkpLFxuICAgIH0sXG4gICAgcHJvZHVjdFN0YWNrSGlzdG9yeS5jdXJyZW50VmVyc2lvbigpLFxuICBdLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnaW50ZWctcHJvZHVjdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxuICBlbmFibGVMb29rdXBzOiB0cnVlLFxufSk7XG5cbnBvcnRmb2xpby5hZGRQcm9kdWN0KHByb2R1Y3QpO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1BvcnRmb2xpb0lkJywgeyB2YWx1ZTogcG9ydGZvbGlvLnBvcnRmb2xpb0lkIH0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.2bc265c5e0569aeb24a6349c15bd54e76e845892376515e036627ab0cc70bb64/index.py diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.6412a5f4524c6b41d26fbeee226c68c2dad735393940a51008d77e6f8b1038f5.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.b59f768286e16b69628bb23b9c1a1f07300a24101b8979d8e2a94ff1ab03d09e.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.d3833f63e813b3a96ea04c8c50ca98209330867f5f6ac358efca11f85a3476c2/index.py diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/asset.e2204c9fddfc339ea362dec9143b4c22f883d4c18dd38c456f8f6a7161c1073d/index.py diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sns/integ.sns-bucket-notifications.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.assets.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integ-servicecatalog-product.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.assets.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integproductDefaultTestDeployAssertEB23E2A9.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductS3AssetProductCED6E119.product.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductS3AssetProductCED6E119.product.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductS3AssetProductCED6E119.product.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductS3AssetProductCED6E119.product.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct1B8D03934.product.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct1B8D03934.product.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct1B8D03934.product.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct1B8D03934.product.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct24C7C16DA.product.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct24C7C16DA.product.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct24C7C16DA.product.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct24C7C16DA.product.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct3B51CF591.product.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct3B51CF591.product.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct3B51CF591.product.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/integservicecatalogproductSNSTopicProduct3B51CF591.product.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.ts similarity index 92% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.ts index 6d32d6aad82ff..445fb6c994f54 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/integ.product.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as servicecatalog from '../lib'; -import { ProductStackHistory, ProductStackProps } from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as servicecatalog from 'aws-cdk-lib/aws-servicecatalog'; +import { ProductStackHistory, ProductStackProps } from 'aws-cdk-lib/aws-servicecatalog'; /** * Follow these instructions to manually test provisioning a Product with an Asset with the resources provisioned in this stack: diff --git a/packages/@aws-cdk/aws-servicecatalog/test/product1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product1.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/product1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product1.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/product2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product2.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/product2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicecatalog/test/product2.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js new file mode 100644 index 0000000000000..d20946915215d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const servicediscovery = require("aws-cdk-lib/aws-servicediscovery"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); +const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { + name: 'foobar.com', +}); +const service = namespace.createService('Service', { + name: 'foo', + dnsRecordType: servicediscovery.DnsRecordType.CNAME, + dnsTtl: cdk.Duration.seconds(30), +}); +service.registerCnameInstance('CnameInstance', { + instanceCname: 'service.pizza', +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmljZS13aXRoLWNuYW1lLXJlY29yZC5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zZXJ2aWNlLXdpdGgtY25hbWUtcmVjb3JkLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLG1DQUFtQztBQUNuQyxxRUFBcUU7QUFFckUsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw0QkFBNEIsQ0FBQyxDQUFDO0FBRS9ELE1BQU0sU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vbycsXG4gIGRuc1JlY29yZFR5cGU6IHNlcnZpY2VkaXNjb3ZlcnkuRG5zUmVjb3JkVHlwZS5DTkFNRSxcbiAgZG5zVHRsOiBjZGsuRHVyYXRpb24uc2Vjb25kcygzMCksXG59KTtcblxuc2VydmljZS5yZWdpc3RlckNuYW1lSW5zdGFuY2UoJ0NuYW1lSW5zdGFuY2UnLCB7XG4gIGluc3RhbmNlQ25hbWU6ICdzZXJ2aWNlLnBpenphJyxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.assets.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/aws-servicediscovery-integ.template.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.lambda-rotation.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts new file mode 100644 index 0000000000000..55bb561576343 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts @@ -0,0 +1,21 @@ +import * as cdk from 'aws-cdk-lib'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { + name: 'foobar.com', +}); + +const service = namespace.createService('Service', { + name: 'foo', + dnsRecordType: servicediscovery.DnsRecordType.CNAME, + dnsTtl: cdk.Duration.seconds(30), +}); + +service.registerCnameInstance('CnameInstance', { + instanceCname: 'service.pizza', +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js new file mode 100644 index 0000000000000..618a4232adda9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const servicediscovery = require("aws-cdk-lib/aws-servicediscovery"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); +const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'MyHTTPNamespace', +}); +const service1 = namespace.createService('NonIpService', { + description: 'service registering non-ip instances', +}); +service1.registerNonIpInstance('NonIpInstance', { + customAttributes: { arn: 'arn:aws:s3:::mybucket' }, +}); +const service2 = namespace.createService('IpService', { + description: 'service registering ip instances', + healthCheck: { + type: servicediscovery.HealthCheckType.HTTP, + resourcePath: '/check', + }, +}); +service2.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmljZS13aXRoLWh0dHAtbmFtZXNwYWNlLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNlcnZpY2Utd2l0aC1odHRwLW5hbWVzcGFjZS5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMscUVBQXFFO0FBRXJFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsNEJBQTRCLENBQUMsQ0FBQztBQUUvRCxNQUFNLFNBQVMsR0FBRyxJQUFJLGdCQUFnQixDQUFDLGFBQWEsQ0FBQyxLQUFLLEVBQUUsYUFBYSxFQUFFO0lBQ3pFLElBQUksRUFBRSxpQkFBaUI7Q0FDeEIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxRQUFRLEdBQUcsU0FBUyxDQUFDLGFBQWEsQ0FBQyxjQUFjLEVBQUU7SUFDdkQsV0FBVyxFQUFFLHNDQUFzQztDQUNwRCxDQUFDLENBQUM7QUFFSCxRQUFRLENBQUMscUJBQXFCLENBQUMsZUFBZSxFQUFFO0lBQzlDLGdCQUFnQixFQUFFLEVBQUUsR0FBRyxFQUFFLHVCQUF1QixFQUFFO0NBQ25ELENBQUMsQ0FBQztBQUVILE1BQU0sUUFBUSxHQUFHLFNBQVMsQ0FBQyxhQUFhLENBQUMsV0FBVyxFQUFFO0lBQ3BELFdBQVcsRUFBRSxrQ0FBa0M7SUFDL0MsV0FBVyxFQUFFO1FBQ1gsSUFBSSxFQUFFLGdCQUF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IHtcbiAgZGVzY3JpcHRpb246ICdzZXJ2aWNlIHJlZ2lzdGVyaW5nIGlwIGluc3RhbmNlcycsXG4gIGhlYWx0aENoZWNrOiB7XG4gICAgdHlwZTogc2VydmljZWRpc2NvdmVyeS5IZWFsdGhDaGVja1R5cGUuSFRUUCxcbiAgICByZXNvdXJjZVBhdGg6ICcvY2hlY2snLFxuICB9LFxufSk7XG5cbnNlcnZpY2UyLnJlZ2lzdGVySXBJbnN0YW5jZSgnSXBJbnN0YW5jZScsIHtcbiAgaXB2NDogJzU0LjIzOS4yNS4xOTInLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.replica.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts new file mode 100644 index 0000000000000..d45cf63409f4d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts @@ -0,0 +1,31 @@ +import * as cdk from 'aws-cdk-lib'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'MyHTTPNamespace', +}); + +const service1 = namespace.createService('NonIpService', { + description: 'service registering non-ip instances', +}); + +service1.registerNonIpInstance('NonIpInstance', { + customAttributes: { arn: 'arn:aws:s3:::mybucket' }, +}); + +const service2 = namespace.createService('IpService', { + description: 'service registering ip instances', + healthCheck: { + type: servicediscovery.HealthCheckType.HTTP, + resourcePath: '/check', + }, +}); + +service2.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js new file mode 100644 index 0000000000000..d419795f15d6a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const elbv2 = require("aws-cdk-lib/aws-elasticloadbalancingv2"); +const cdk = require("aws-cdk-lib"); +const servicediscovery = require("aws-cdk-lib/aws-servicediscovery"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); +const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'Namespace', { + name: 'boobar.com', + vpc, +}); +const service = namespace.createService('Service', { + dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, + dnsTtl: cdk.Duration.seconds(30), + loadBalancer: true, +}); +const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); +service.registerLoadBalancer('Loadbalancer', loadbalancer); +const arnService = namespace.createService('ArnService', { + discoveryType: servicediscovery.DiscoveryType.API, +}); +arnService.registerNonIpInstance('NonIpInstance', { + customAttributes: { arn: 'arn://' }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmljZS13aXRoLXByaXZhdGUtZG5zLW5hbWVzcGFjZS5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zZXJ2aWNlLXdpdGgtcHJpdmF0ZS1kbnMtbmFtZXNwYWNlLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyxnRUFBZ0U7QUFDaEUsbUNBQW1DO0FBQ25DLHFFQUFxRTtBQUVyRSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDRCQUE0QixDQUFDLENBQUM7QUFFL0QsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsRUFBRSxNQUFNLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztBQUVyRCxNQUF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GVTZXJ2aWNlKCdBcm5TZXJ2aWNlJywge1xuICBkaXNjb3ZlcnlUeXBlOiBzZXJ2aWNlZGlzY292ZXJ5LkRpc2NvdmVyeVR5cGUuQVBJLFxufSk7XG5cbmFyblNlcnZpY2UucmVnaXN0ZXJOb25JcEluc3RhbmNlKCdOb25JcEluc3RhbmNlJywge1xuICBjdXN0b21BdHRyaWJ1dGVzOiB7IGFybjogJ2FybjovLycgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts new file mode 100644 index 0000000000000..385b2f25545a1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts @@ -0,0 +1,34 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as cdk from 'aws-cdk-lib'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'Namespace', { + name: 'boobar.com', + vpc, +}); + +const service = namespace.createService('Service', { + dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, + dnsTtl: cdk.Duration.seconds(30), + loadBalancer: true, +}); + +const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); + +service.registerLoadBalancer('Loadbalancer', loadbalancer); + +const arnService = namespace.createService('ArnService', { + discoveryType: servicediscovery.DiscoveryType.API, +}); + +arnService.registerNonIpInstance('NonIpInstance', { + customAttributes: { arn: 'arn://' }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js new file mode 100644 index 0000000000000..d1861e58dc21a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const servicediscovery = require("aws-cdk-lib/aws-servicediscovery"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); +const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { + name: 'foobar.com', +}); +const service = namespace.createService('Service', { + name: 'foo', + dnsRecordType: servicediscovery.DnsRecordType.A, + dnsTtl: cdk.Duration.seconds(30), + healthCheck: { + type: servicediscovery.HealthCheckType.HTTPS, + resourcePath: '/healthcheck', + failureThreshold: 2, + }, +}); +service.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', + port: 443, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VydmljZS13aXRoLXB1YmxpYy1kbnMtbmFtZXNwYWNlLmxpdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNlcnZpY2Utd2l0aC1wdWJsaWMtZG5zLW5hbWVzcGFjZS5saXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMscUVBQXFFO0FBRXJFLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsNEJBQTRCLENBQUMsQ0FBQztBQUUvRCxNQUFNLFNBQVMsR0FBRyxJQUFJLGdCQUFnQixDQUFDLGtCQUFrQixDQUFDLEtBQUssRUFBRSxXQUFXLEVBQUU7SUFDNUUsSUFBSSxFQUFFLFlBQVk7Q0FDbkIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxPQUFPLEdBQUcsU0FBUyxDQUFDLGFBQWEsQ0FB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jb3JkVHlwZTogc2VydmljZWRpc2NvdmVyeS5EbnNSZWNvcmRUeXBlLkEsXG4gIGRuc1R0bDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMzApLFxuICBoZWFsdGhDaGVjazoge1xuICAgIHR5cGU6IHNlcnZpY2VkaXNjb3ZlcnkuSGVhbHRoQ2hlY2tUeXBlLkhUVFBTLFxuICAgIHJlc291cmNlUGF0aDogJy9oZWFsdGhjaGVjaycsXG4gICAgZmFpbHVyZVRocmVzaG9sZDogMixcbiAgfSxcbn0pO1xuXG5zZXJ2aWNlLnJlZ2lzdGVySXBJbnN0YW5jZSgnSXBJbnN0YW5jZScsIHtcbiAgaXB2NDogJzU0LjIzOS4yNS4xOTInLFxuICBwb3J0OiA0NDMsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.assets.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/aws-servicediscovery-integ.template.json diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts new file mode 100644 index 0000000000000..3f386953c2b63 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts @@ -0,0 +1,27 @@ +import * as cdk from 'aws-cdk-lib'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { + name: 'foobar.com', +}); + +const service = namespace.createService('Service', { + name: 'foo', + dnsRecordType: servicediscovery.DnsRecordType.A, + dnsTtl: cdk.Duration.seconds(30), + healthCheck: { + type: servicediscovery.HealthCheckType.HTTPS, + resourcePath: '/healthcheck', + failureThreshold: 2, + }, +}); + +service.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', + port: 443, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js new file mode 100644 index 0000000000000..b61dd6011bfe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kms = require("aws-cdk-lib/aws-kms"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const s3 = require("aws-cdk-lib/aws-s3"); +const ses = require("aws-cdk-lib/aws-ses"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const actions = require("aws-cdk-lib/aws-ses-actions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ses-receipt'); +const topic = new sns.Topic(stack, 'Topic'); +const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('exports.handler = async (event) => event;'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +const bucket = new s3.Bucket(stack, 'Bucket'); +const kmsKey = new kms.Key(stack, 'Key'); +const ruleSet = new ses.ReceiptRuleSet(stack, 'RuleSet', { + dropSpam: true, +}); +const firstRule = ruleSet.addRule('FirstRule', { + actions: [ + new actions.AddHeader({ + name: 'X-My-Header', + value: 'value', + }), + new actions.Lambda({ + function: fn, + invocationType: actions.LambdaInvocationType.REQUEST_RESPONSE, + topic, + }), + new actions.S3({ + bucket, + kmsKey, + objectKeyPrefix: 'emails/', + topic, + }), + new actions.Sns({ + encoding: actions.EmailEncoding.BASE64, + topic, + }), + ], + receiptRuleName: 'FirstRule', + recipients: ['cdk-ses-receipt-test@yopmail.com'], + scanEnabled: true, + tlsPolicy: ses.TlsPolicy.REQUIRE, +}); +firstRule.addAction(new actions.Bounce({ + sender: 'cdk-ses-receipt-test@yopmail.com', + template: actions.BounceTemplate.MESSAGE_CONTENT_REJECTED, + topic, +})); +const secondRule = ruleSet.addRule('SecondRule'); +secondRule.addAction(new actions.Stop({ + topic, +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYWN0aW9ucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmFjdGlvbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsaURBQWlEO0FBQ2pELHlDQUF5Qzt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XRlc3RAeW9wbWFpbC5jb20nLFxuICB0ZW1wbGF0ZTogYWN0aW9ucy5Cb3VuY2VUZW1wbGF0ZS5NRVNTQUdFX0NPTlRFTlRfUkVKRUNURUQsXG4gIHRvcGljLFxufSkpO1xuXG5jb25zdCBzZWNvbmRSdWxlID0gcnVsZVNldC5hZGRSdWxlKCdTZWNvbmRSdWxlJyk7XG5cbnNlY29uZFJ1bGUuYWRkQWN0aW9uKG5ldyBhY3Rpb25zLlN0b3Aoe1xuICB0b3BpYyxcbn0pKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.assets.json diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/aws-cdk-ses-receipt.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.portfolio.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.ts similarity index 81% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.ts index b4c7122bf1cce..fd174a8f6f33a 100644 --- a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses-actions/test/integ.actions.ts @@ -1,10 +1,10 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as actions from '../lib'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as ses from 'aws-cdk-lib/aws-ses'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as actions from 'aws-cdk-lib/aws-ses-actions'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js new file mode 100644 index 0000000000000..d60cfa94b2515 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ses = require("aws-cdk-lib/aws-ses"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new ses.ConfigurationSet(this, 'ConfigurationSet'); + } +} +const app = new aws_cdk_lib_1.App(); +new integ.IntegTest(app, 'ConfigurationSetInteg', { + testCases: [new TestStack(app, 'cdk-ses-configuration-set-integ')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY29uZmlndXJhdGlvbi1zZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jb25maWd1cmF0aW9uLXNldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFxRDtBQUNyRCxvREFBb0Q7QUFFcEQsMkNBQTJDO0FBRTNDLE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsSUFBSSxHQUFHLENBQUMsZ0JBQWdCLENBQUMsSUFBSSxFQUFFLGtCQUFrQixDQUFDLENBQUM7SUFDckQsQ0FBQztDQUNGO0FBRUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFFdEIsSUFBSSxLQUFLLENBQUMsU0FBUyxDQUFDLEdBQUcsRUFBRSx1QkFBdUIsRUFBRTtJQUNoRCxTQUFTLEVBQUUsQ0FBQyxJQUFJLFNBQVMsQ0FBQyxHQUFHLEVBQUUsaUNBQWlDLENBQUMsQ0FBQztDQUNuRSxDQUFDLENBQUM7QUFFSCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBBcHAsIFN0YWNrLCBTdGFja1Byb3BzIH0gZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0ICogYXMgaW50ZWcgZnJvbSAnQGF3cy1jZGsvaW50ZWctdGVzdHMtYWxwaGEnO1xuaW1wb3J0IHsgQ29uc3RydWN0IH0gZnJvbSAnY29uc3RydWN0cyc7XG5pbXBvcnQgKiBhcyBzZXMgZnJvbSAnYXdzLWNkay1saWIvYXdzLXNlcyc7XG5cbmNsYXNzIFRlc3RTdGFjayBleHRlbmRzIFN0YWNrIHtcbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZywgcHJvcHM/OiBTdGFja1Byb3BzKSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkLCBwcm9wcyk7XG5cbiAgICBuZXcgc2VzLkNvbmZpZ3VyYXRpb25TZXQodGhpcywgJ0NvbmZpZ3VyYXRpb25TZXQnKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnQ29uZmlndXJhdGlvblNldEludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtuZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1zZXMtY29uZmlndXJhdGlvbi1zZXQtaW50ZWcnKV0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/ConfigurationSetIntegDefaultTestDeployAssert9B6AD46A.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/cdk-ses-configuration-set-integ.template.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.ts new file mode 100644 index 0000000000000..8c86966c19e32 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.configuration-set.ts @@ -0,0 +1,20 @@ +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Construct } from 'constructs'; +import * as ses from 'aws-cdk-lib/aws-ses'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + new ses.ConfigurationSet(this, 'ConfigurationSet'); + } +} + +const app = new App(); + +new integ.IntegTest(app, 'ConfigurationSetInteg', { + testCases: [new TestStack(app, 'cdk-ses-configuration-set-integ')], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js new file mode 100644 index 0000000000000..a9af1f6bbba5d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_route53_1 = require("aws-cdk-lib/aws-route53"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ses = require("aws-cdk-lib/aws-ses"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const hostedZone = new aws_route53_1.PublicHostedZone(this, 'HostedZone', { + zoneName: 'cdk.dev', + }); + new ses.EmailIdentity(this, 'EmailIdentity', { + identity: ses.Identity.publicHostedZone(hostedZone), + mailFromDomain: 'mail.cdk.dev', + }); + } +} +const app = new aws_cdk_lib_1.App(); +new integ.IntegTest(app, 'EmailIdentityInteg', { + testCases: [new TestStack(app, 'cdk-ses-email-identity-integ')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZW1haWwtaWRlbnRpdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5lbWFpbC1pZGVudGl0eS50cyJdLCJuYW1lcyI6W10sIm1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ludGVnIGZyb20gJ0Bhd3MtY2RrL2ludGVnLXRlc3RzLWFscGhhJztcbmltcG9ydCB7IENvbnN0cnVjdCB9IGZyb20gJ2NvbnN0cnVjdHMnO1xuaW1wb3J0ICogYXMgc2VzIGZyb20gJ2F3cy1jZGstbGliL2F3cy1zZXMnO1xuXG5jbGFzcyBUZXN0U3RhY2sgZXh0ZW5kcyBTdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBDb25zdHJ1Y3QsIGlkOiBzdHJpbmcsIHByb3BzPzogU3RhY2tQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgY29uc3QgaG9zdGVkWm9uZSA9IG5ldyBQdWJsaWNIb3N0ZWRab25lKHRoaXMsICdIb3N0ZWRab25lJywge1xuICAgICAgem9uZU5hbWU6ICdjZGsuZGV2JyxcbiAgICB9KTtcblxuICAgIG5ldyBzZXMuRW1haWxJZGVudGl0eSh0aGlzLCAnRW1haWxJZGVudGl0eScsIHtcbiAgICAgIGlkZW50aXR5OiBzZXMuSWRlbnRpdHkucHVibGljSG9zdGVkWm9uZShob3N0ZWRab25lKSxcbiAgICAgIG1haWxGcm9tRG9tYWluOiAnbWFpbC5jZGsuZGV2JyxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnRW1haWxJZGVudGl0eUludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtuZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1zZXMtZW1haWwtaWRlbnRpdHktaW50ZWcnKV0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/EmailIdentityIntegDefaultTestDeployAssert3F909307.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/cdk-ses-email-identity-integ.template.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.ts new file mode 100644 index 0000000000000..5a0bd64bbff69 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.email-identity.ts @@ -0,0 +1,28 @@ +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Construct } from 'constructs'; +import * as ses from 'aws-cdk-lib/aws-ses'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + const hostedZone = new PublicHostedZone(this, 'HostedZone', { + zoneName: 'cdk.dev', + }); + + new ses.EmailIdentity(this, 'EmailIdentity', { + identity: ses.Identity.publicHostedZone(hostedZone), + mailFromDomain: 'mail.cdk.dev', + }); + } +} + +const app = new App(); + +new integ.IntegTest(app, 'EmailIdentityInteg', { + testCases: [new TestStack(app, 'cdk-ses-email-identity-integ')], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js new file mode 100644 index 0000000000000..b917181f6d111 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const ses = require("aws-cdk-lib/aws-ses"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-ses-receipt'); +const ruleSet = new ses.ReceiptRuleSet(stack, 'RuleSet', { + dropSpam: true, +}); +ruleSet.addRule('FirstRule', { + receiptRuleName: 'FirstRule', + recipients: ['cdk-ses-receipt-test@yopmail.com'], + scanEnabled: true, + tlsPolicy: ses.TlsPolicy.REQUIRE, +}); +ruleSet.addRule('SecondRule'); +new ses.AllowListReceiptFilter(stack, 'Allowlist', { + ips: [ + '10.0.0.0/16', + ], +}); +//# sour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vbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IGNkay5TdGFjayhhcHAsICdhd3MtY2RrLXNlcy1yZWNlaXB0Jyk7XG5cbmNvbnN0IHJ1bGVTZXQgPSBuZXcgc2VzLlJlY2VpcHRSdWxlU2V0KHN0YWNrLCAnUnVsZVNldCcsIHtcbiAgZHJvcFNwYW06IHRydWUsXG59KTtcblxucnVsZVNldC5hZGRSdWxlKCdGaXJzdFJ1bGUnLCB7XG4gIHJlY2VpcHRSdWxlTmFtZTogJ0ZpcnN0UnVsZScsXG4gIHJlY2lwaWVudHM6IFsnY2RrLXNlcy1yZWNlaXB0LXRlc3RAeW9wbWFpbC5jb20nXSxcbiAgc2NhbkVuYWJsZWQ6IHRydWUsXG4gIHRsc1BvbGljeTogc2VzLlRsc1BvbGljeS5SRVFVSVJFLFxufSk7XG5cbnJ1bGVTZXQuYWRkUnVsZSgnU2Vjb25kUnVsZScpO1xuXG5uZXcgc2VzLkFsbG93TGlzdFJlY2VpcHRGaWx0ZXIoc3RhY2ssICdBbGxvd2xpc3QnLCB7XG4gIGlwczogW1xuICAgICcxMC4wLjAuMC8xNicsXG4gIF0sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/lib/drop-spam-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ses/lib/drop-spam-handler/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/aws-cdk-ses-receipt.template.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.ts similarity index 85% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.ts index 2598496a5ab83..bed1cfe463dd7 100644 --- a/packages/@aws-cdk/aws-ses/test/integ.receipt.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.receipt.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as ses from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as ses from 'aws-cdk-lib/aws-ses'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js new file mode 100644 index 0000000000000..cd2f1398dea63 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_ses_1 = require("aws-cdk-lib/aws-ses"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new aws_ses_1.VdmAttributes(this, 'Vdm'); + } +} +const app = new aws_cdk_lib_1.App(); +new integ.IntegTest(app, 'VdmAttribtuesInteg', { + testCases: [new TestStack(app, 'cdk-integ-ses-vdm-attributes')], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcudmRtLWF0dHJpYnV0ZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy52ZG0tYXR0cmlidXRlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFxRDtBQUNyRCxvREFBb0Q7QUFFcEQsaURBQW9EO0FBRXBELE1BQU0sU0FBVSxTQUFRLG1CQUFLO0lBQzNCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsSUFBSSx1QkFBYSxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsQ0FBQztJQUNqQyxDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixJQUFJLEtBQUssQ0FBQyxTQUFTLENBQUMsR0FBRyxFQUFFLG9CQUFvQixFQUFFO0lBQzdDLFNBQVMsRUFBRSxDQUFDLElBQUksU0FBUyxDQUFDLEdBQUcsRUFBRSw4QkFBOEIsQ0FBQyxDQUFDO0NBQ2hFLENBQUMsQ0FBQztBQUVILEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEFwcCwgU3RhY2ssIFN0YWNrUHJvcHMgfSBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgKiBhcyBpbnRlZyBmcm9tICdAYXdzLWNkay9pbnRlZy10ZXN0cy1hbHBoYSc7XG5pbXBvcnQgeyBDb25zdHJ1Y3QgfSBmcm9tICdjb25zdHJ1Y3RzJztcbmltcG9ydCB7IFZkbUF0dHJpYnV0ZXMgfSBmcm9tICdhd3MtY2RrLWxpYi9hd3Mtc2VzJztcblxuY2xhc3MgVGVzdFN0YWNrIGV4dGVuZHMgU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogQ29uc3RydWN0LCBpZDogc3RyaW5nLCBwcm9wcz86IFN0YWNrUHJvcHMpIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIG5ldyBWZG1BdHRyaWJ1dGVzKHRoaXMsICdWZG0nKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnVmRtQXR0cmlidHVlc0ludGVnJywge1xuICB0ZXN0Q2FzZXM6IFtuZXcgVGVzdFN0YWNrKGFwcCwgJ2Nkay1pbnRlZy1zZXMtdmRtLWF0dHJpYnV0ZXMnKV0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/VdmAttribtuesIntegDefaultTestDeployAssert44077E00.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.assets.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.template.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk-integ-ses-vdm-attributes.template.json diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance-gp3.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.ts new file mode 100644 index 0000000000000..a5e65c76c2e4d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ses/test/integ.vdm-attributes.ts @@ -0,0 +1,20 @@ +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Construct } from 'constructs'; +import { VdmAttributes } from 'aws-cdk-lib/aws-ses'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + new VdmAttributes(this, 'Vdm'); + } +} + +const app = new App(); + +new integ.IntegTest(app, 'VdmAttribtuesInteg', { + testCases: [new TestStack(app, 'cdk-integ-ses-vdm-attributes')], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js new file mode 100644 index 0000000000000..4129b2917d40a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sns = require("aws-cdk-lib/aws-sns"); +const cdk = require("aws-cdk-lib"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +/// !cdk-integ * pragma:enable-lookups +const app = new cdk.App(); +const topicStack = new cdk.Stack(app, 'TopicStack', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: 'us-east-1', + }, +}); +const topic = new sns.Topic(topicStack, 'MyTopic', { + topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, +}); +const functionStack = new cdk.Stack(app, 'FunctionStack', { + env: { region: 'us-east-2' }, +}); +const fction = new lambda.Function(functionStack, 'Echo', { + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), +}); +topic.addSubscription(new subs.LambdaSubscription(fction)); +app.synth(); +function handler(event, _context, callback) { + /* eslint-disable no-console */ + console.log('===================================================='); + console.log(JSON.stringify(event, undefined, 2)); + console.log('===================================================='); + return callback(undefined, event); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLWxhbWJkYS1jcm9zcy1yZWdpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zbnMtbGFtYmRhLWNyb3NzLXJlZ2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUFpRDtBQUNqRCwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLDBEQUEwRDtBQUUxRCxzQ0FBc0M7QUFDdEMsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxVQUFVLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUU7SUFDbEQsR0FBRyxFQUFFO1FBQ0gsT0FBTyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxtQkFBbUI7UUFDekUsTUFBTSxFQUFFLFdBQVc7S0FDcEI7Q0FDRixDQUFDLENBQUM7QUFDSCxNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsVUFBVSxFQUFFLFNBQVMsRUFBRTtJQUNqRCxTQUFTLEVBQUUsR0FBRyxDQUFDLFlBQVksQ0FBQyxrQkFBa0I7Q0FDL0MsQ0FBQyxDQUFDO0FBRUgsTUFBTSxhQUFhLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxlQUFlLEVBQUU7SUFDeEQsR0FBRyxFQUFFLEVBQUUsTUFBTSxFQUFFLFdBQVcsRUFBRTtDQUM3QixDQUFDLENBQUM7QUFDSCxNQUFNLE1BQU0sR0FBRyx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iBhbnksIF9jb250ZXh0OiBhbnksIGNhbGxiYWNrOiBhbnkpIHtcbiAgLyogZXNsaW50LWRpc2FibGUgbm8tY29uc29sZSAqL1xuICBjb25zb2xlLmxvZygnPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PScpO1xuICBjb25zb2xlLmxvZyhKU09OLnN0cmluZ2lmeShldmVudCwgdW5kZWZpbmVkLCAyKSk7XG4gIGNvbnNvbGUubG9nKCc9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Jyk7XG4gIHJldHVybiBjYWxsYmFjayh1bmRlZmluZWQsIGV2ZW50KTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/FunctionStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/FunctionStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/FunctionStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/FunctionStack.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/TopicStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/TopicStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/TopicStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/TopicStack.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts similarity index 84% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts index a7d97cf2368c3..0f82618315c10 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda-cross-region.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as subs from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cdk from 'aws-cdk-lib'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; /// !cdk-integ * pragma:enable-lookups const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js new file mode 100644 index 0000000000000..947dacb7cdb49 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sns = require("aws-cdk-lib/aws-sns"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +class SnsToLambda extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const topic = new sns.Topic(this, 'MyTopic'); + const func = new lambda.Function(this, 'Echo', { + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + }); + topic.addSubscription(new subs.LambdaSubscription(func, { + deadLetterQueue: new sqs.Queue(this, 'DeadLetterQueue'), + })); + const funcFiltered = new lambda.Function(this, 'Filtered', { + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + }); + topic.addSubscription(new subs.LambdaSubscription(funcFiltered, { + filterPolicy: { + color: sns.SubscriptionFilter.stringFilter({ + allowlist: ['red'], + matchPrefixes: ['bl', 'ye'], + }), + size: sns.SubscriptionFilter.stringFilter({ + denylist: ['small', 'medium'], + }), + price: sns.SubscriptionFilter.numericFilter({ + between: { start: 100, stop: 200 }, + }), + }, + })); + const funcFilteredWithMessageBody = new lambda.Function(this, 'FilteredMessageBody', { + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), + }); + topic.addSubscription(new subs.LambdaSubscription(funcFilteredWithMessageBody, { + filterPolicyWithMessageBody: { + background: sns.FilterOrPolicy.policy({ + color: sns.FilterOrPolicy.filter(sns.SubscriptionFilter.stringFilter({ + allowlist: ['red'], + matchPrefixes: ['bl', 'ye'], + })), + }), + }, + })); + } +} +const app = new cdk.App(); +new SnsToLambda(app, 'aws-cdk-sns-lambda'); +app.synth(); +function handler(event, _context, callback) { + /* eslint-disable no-console */ + console.log('===================================================='); + console.log(JSON.stringify(event, undefined, 2)); + console.log('===================================================='); + return callback(undefined, event); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLWxhbWJkYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNucy1sYW1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Z2lmeShldmVudCwgdW5kZWZpbmVkLCAyKSk7XG4gIGNvbnNvbGUubG9nKCc9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Jyk7XG4gIHJldHVybiBjYWxsYmFjayh1bmRlZmluZWQsIGV2ZW50KTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.assets.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/aws-cdk-sns-lambda.template.json diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.ts similarity index 90% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.ts index da150e9929861..22dbd54abcd87 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-lambda.ts @@ -1,10 +1,10 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as subs from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; class SnsToLambda extends cdk.Stack { constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js new file mode 100644 index 0000000000000..0e46ce52ccb15 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +/// !cdk-integ * pragma:enable-lookups +const app = new cdk.App(); +/// !show +const topicStack = new cdk.Stack(app, 'TopicStack', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: 'us-east-1', + }, +}); +const topic = new sns.Topic(topicStack, 'MyTopic', { + topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, +}); +const queueStack = new cdk.Stack(app, 'QueueStack', { + env: { region: 'us-east-2' }, +}); +const queue = new sqs.Queue(queueStack, 'MyQueue'); +topic.addSubscription(new subs.SqsSubscription(queue)); +/// !hide +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLXNxcy1jcm9zcy1yZWdpb24ubGl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc25zLXNxcy1jcm9zcy1yZWdpb24ubGl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQyxtQ0FBbUM7QUFDbkMsMERBQTBEO0FBRTFELHNDQUFzQztBQUN0QyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUUxQixTQUFTO0FBQ1QsTUFBTSxVQUFVLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUU7SUFDbEQsR0FBRyxFQUFFO1FBQ0gsT0FBTyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsaUJBQWlCLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxtQkFBbUI7UUFDekUsTUFBTSxFQUFFLFdBQVc7S0FDcEI7Q0FDRixDQUFDLENBQUM7QUFDSCxNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsVUFBVSxFQUFFLFNBQVMsRUFBRTtJQUNqRCxTQUFTLEVBQUUsR0FBRyxDQUFDLFlBQVksQ0FBQyxrQkFBa0I7Q0FDL0MsQ0FBQyxDQUFDO0FBRUgsTUFBTSxVQUFVLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUU7SUFDbEQsR0FBRyxFQUFFLEVBQUUsT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VlU3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ1F1ZXVlU3RhY2snLCB7XG4gIGVudjogeyByZWdpb246ICd1cy1lYXN0LTInIH0sXG59KTtcbmNvbnN0IHF1ZXVlID0gbmV3IHNxcy5RdWV1ZShxdWV1ZVN0YWNrLCAnTXlRdWV1ZScpO1xuXG50b3BpYy5hZGRTdWJzY3JpcHRpb24obmV3IHN1YnMuU3FzU3Vic2NyaXB0aW9uKHF1ZXVlKSk7XG4vLy8gIWhpZGVcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/QueueStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/QueueStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/QueueStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/QueueStack.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/TopicStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/TopicStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/TopicStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/TopicStack.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts new file mode 100644 index 0000000000000..e6d896c698346 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts @@ -0,0 +1,28 @@ +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; + +/// !cdk-integ * pragma:enable-lookups +const app = new cdk.App(); + +/// !show +const topicStack = new cdk.Stack(app, 'TopicStack', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: 'us-east-1', + }, +}); +const topic = new sns.Topic(topicStack, 'MyTopic', { + topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, +}); + +const queueStack = new cdk.Stack(app, 'QueueStack', { + env: { region: 'us-east-2' }, +}); +const queue = new sqs.Queue(queueStack, 'MyQueue'); + +topic.addSubscription(new subs.SqsSubscription(queue)); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js new file mode 100644 index 0000000000000..c1868782e2524 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +class SnsToSqsStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.topic = new sns.Topic(this, 'MyTopic'); + const queueStack = new cdk.Stack(app, 'QueueStack'); + this.queue = new sqs.Queue(queueStack, 'MyQueue'); + this.topic.addSubscription(new subs.SqsSubscription(this.queue, { + filterPolicyWithMessageBody: { + background: sns.Policy.policy({ + color: sns.Filter.filter(sns.SubscriptionFilter.stringFilter({ + allowlist: ['red', 'green'], + denylist: ['white', 'orange'], + })), + }), + price: sns.Filter.filter(sns.SubscriptionFilter.numericFilter({ + allowlist: [100, 200], + between: { start: 300, stop: 350 }, + greaterThan: 500, + lessThan: 1000, + betweenStrict: { start: 2000, stop: 3000 }, + })), + }, + })); + } +} +// Beginning of the test suite +const app = new cdk.App(); +const stack = new SnsToSqsStack(app, 'SnsToSqsStack'); +const integTest = new integ_tests_alpha_1.IntegTest(app, 'SNS Subscriptions', { + testCases: [ + stack, + ], +}); +integTest.assertions.awsApiCall('SNS', 'publish', { + Message: '{ background: { color: \'green\' }, price: 200 }', + TopicArn: stack.topic.topicArn, +}); +const message = integTest.assertions.awsApiCall('SQS', 'receiveMessage', { + QueueUrl: stack.queue.queueUrl, + WaitTimeSeconds: 20, +}); +message.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Messages: [{ Body: '{color: "green", price: 200}' }], +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLXNxcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNucy1zcXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxrRUFBdUU7QUFDdkUsMERBQTBEO0FBQzFELE1BQU0sYUFB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NlcnRpb25zLmF3c0FwaUNhbGwoJ1NOUycsICdwdWJsaXNoJywge1xuICBNZXNzYWdlOiAneyBiYWNrZ3JvdW5kOiB7IGNvbG9yOiBcXCdncmVlblxcJyB9LCBwcmljZTogMjAwIH0nLFxuICBUb3BpY0Fybjogc3RhY2sudG9waWMudG9waWNBcm4sXG59KTtcbmNvbnN0IG1lc3NhZ2UgPSBpbnRlZ1Rlc3QuYXNzZXJ0aW9ucy5hd3NBcGlDYWxsKCdTUVMnLCAncmVjZWl2ZU1lc3NhZ2UnLCB7XG4gIFF1ZXVlVXJsOiBzdGFjay5xdWV1ZS5xdWV1ZVVybCxcbiAgV2FpdFRpbWVTZWNvbmRzOiAyMCxcbn0pO1xubWVzc2FnZS5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIE1lc3NhZ2VzOiBbeyBCb2R5OiAne2NvbG9yOiBcImdyZWVuXCIsIHByaWNlOiAyMDB9JyB9XSxcbn0pKTtcbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.assets.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/QueueStack.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.assets.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SNSSubscriptionsDefaultTestDeployAssertD77125EB.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.assets.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/SnsToSqsStack.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/asset.278d42fa865f60954d898636503d0ee86a6689d73dc50eb912fac62def0ef6a4.bundle/index.js diff --git a/packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/integ.product.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js new file mode 100644 index 0000000000000..c21a7aadc1601 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const kms = require("aws-cdk-lib/aws-kms"); +const sns = require("aws-cdk-lib/aws-sns"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const cdk = require("aws-cdk-lib"); +const cxapi = require("aws-cdk-lib/cx-api"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +const restrictSqsDescryption = { [cxapi.SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY]: true }; +class SnsToSqs extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + /// !show + const topic = new sns.Topic(this, 'MyTopic'); + const queue = new sqs.Queue(this, 'MyQueue', { + encryptionMasterKey: new kms.Key(this, 'EncryptionMasterKey'), + }); + topic.addSubscription(new subs.SqsSubscription(queue, { + deadLetterQueue: new sqs.Queue(this, 'DeadLetterQueue'), + })); + /// !hide + } +} +const app = new cdk.App({ + context: restrictSqsDescryption, +}); +new SnsToSqs(app, 'aws-cdk-sns-sqs'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLXNxcy5saXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zbnMtc3FzLmxpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyw0Q0FBNEM7QUFDNUMsMERBQTBEO0FBRTFELE1BQU0sc0JBQXNCLEdBQUcsRUFBRSxDQUFDLEtBQUssQ0FBQyx1Q0FBdUMsQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDO0FBRXpGLE1BQU0sUUFBUyxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQzlCLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxLQUFzQjtRQUM1RCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixTQUFTO1FBQ1QsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLElBQUksRUFB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uc3QgcmVzdHJpY3RTcXNEZXNjcnlwdGlvbiA9IHsgW2N4YXBpLlNOU19TVUJTQ1JJUFRJT05TX1NRU19ERUNSWVBUSU9OX1BPTElDWV06IHRydWUgfTtcblxuY2xhc3MgU25zVG9TcXMgZXh0ZW5kcyBjZGsuU3RhY2sge1xuICBjb25zdHJ1Y3RvcihzY29wZTogY2RrLkFwcCwgaWQ6IHN0cmluZywgcHJvcHM/OiBjZGsuU3RhY2tQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgLy8vICFzaG93XG4gICAgY29uc3QgdG9waWMgPSBuZXcgc25zLlRvcGljKHRoaXMsICdNeVRvcGljJyk7XG4gICAgY29uc3QgcXVldWUgPSBuZXcgc3FzLlF1ZXVlKHRoaXMsICdNeVF1ZXVlJywge1xuICAgICAgZW5jcnlwdGlvbk1hc3RlcktleTogbmV3IGttcy5LZXkodGhpcywgJ0VuY3J5cHRpb25NYXN0ZXJLZXknKSxcbiAgICB9KTtcblxuICAgIHRvcGljLmFkZFN1YnNjcmlwdGlvbihuZXcgc3Vicy5TcXNTdWJzY3JpcHRpb24ocXVldWUsIHtcbiAgICAgIGRlYWRMZXR0ZXJRdWV1ZTogbmV3IHNxcy5RdWV1ZSh0aGlzLCAnRGVhZExldHRlclF1ZXVlJyksXG4gICAgfSkpO1xuICAgIC8vLyAhaGlkZVxuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKHtcbiAgY29udGV4dDogcmVzdHJpY3RTcXNEZXNjcnlwdGlvbixcbn0pO1xuXG5uZXcgU25zVG9TcXMoYXBwLCAnYXdzLWNkay1zbnMtc3FzJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.assets.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/aws-cdk-sns-sqs.template.json diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts new file mode 100644 index 0000000000000..ca27d2c803d7f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts @@ -0,0 +1,33 @@ +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import * as cxapi from 'aws-cdk-lib/cx-api'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; + +const restrictSqsDescryption = { [cxapi.SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY]: true }; + +class SnsToSqs extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const topic = new sns.Topic(this, 'MyTopic'); + const queue = new sqs.Queue(this, 'MyQueue', { + encryptionMasterKey: new kms.Key(this, 'EncryptionMasterKey'), + }); + + topic.addSubscription(new subs.SqsSubscription(queue, { + deadLetterQueue: new sqs.Queue(this, 'DeadLetterQueue'), + })); + /// !hide + } +} + +const app = new cdk.App({ + context: restrictSqsDescryption, +}); + +new SnsToSqs(app, 'aws-cdk-sns-sqs'); + +app.synth(); diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.ts similarity index 86% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.ts index 0a6c2ec1b8037..de1f366ec4e91 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns-subscriptions/test/integ.sns-sqs.ts @@ -1,8 +1,8 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import * as subs from '../lib'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; class SnsToSqsStack extends cdk.Stack { topic: sns.Topic; queue: sqs.Queue; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js new file mode 100644 index 0000000000000..057a0a48aa4f6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_sns_1 = require("aws-cdk-lib/aws-sns"); +class SNSFifoInteg extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + new aws_sns_1.Topic(this, 'MyTopic', { + topicName: 'fooTopic', + displayName: 'fooDisplayName', + contentBasedDeduplication: true, + fifo: true, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new SNSFifoInteg(app, 'SNSFifoInteg'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLWZpZm8uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zbnMtZmlmby50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFxRDtBQUNyRCxpREFBNEM7QUFFNUMsTUFBTSxZQUFhLFNBQVEsbUJBQUs7SUFDOUIsWUFBWSxLQUFVLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQ3BELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLElBQUksZUFBSyxDQUFDLElBQUksRUFBRSxTQUFTLEVBQUU7WUFDekIsU0FBUyxFQUFFLFVBQVU7WUFDckIsV0FBVyxFQUFFLGdCQUFnQjtZQUM3Qix5QkFBeUIsRUFBRSxJQUFJO1lBQy9CLElBQUksRUFBRSxJQUFJO1NBQ1gsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztDQUNGO0FBRUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxpQkFBRyxFQUFFLENBQUM7QUFFdEIsSUFBSSxZQUFZLENBQUMsR0FBRyxFQUFFLGNBQWMsQ0FBQyxDQUFDO0FBRXRDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEFwcCwgU3RhY2ssIFN0YWNrUHJvcHMgfSBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgeyBUb3BpYyB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1zbnMnO1xuXG5jbGFzcyBTTlNGaWZvSW50ZWcgZXh0ZW5kcyBTdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBBcHAsIGlkOiBzdHJpbmcsIHByb3BzPzogU3RhY2tQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgbmV3IFRvcGljKHRoaXMsICdNeVRvcGljJywge1xuICAgICAgdG9waWNOYW1lOiAnZm9vVG9waWMnLFxuICAgICAgZGlzcGxheU5hbWU6ICdmb29EaXNwbGF5TmFtZScsXG4gICAgICBjb250ZW50QmFzZWREZWR1cGxpY2F0aW9uOiB0cnVlLFxuICAgICAgZmlmbzogdHJ1ZSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbm5ldyBTTlNGaWZvSW50ZWcoYXBwLCAnU05TRmlmb0ludGVnJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.assets.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/SNSFifoInteg.template.json diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js new file mode 100644 index 0000000000000..cb57fb0a131b7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_sns_1 = require("aws-cdk-lib/aws-sns"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-sns-fifo-1'); +new aws_sns_1.Topic(stack, 'MyTopic', { + fifo: true, +}); +new integ_tests_alpha_1.IntegTest(app, 'SnsFifoNoNameTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLWZpZm8ubm8tbmFtZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNucy1maWZvLm5vLW5hbWUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2Q0FBeUM7QUFDekMsa0VBQXVEO0FBQ3ZELGlEQUE0QztBQUU1QyxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixNQUFNLEtBQUssR0FBRyxJQUFJLG1CQUFLLENBQUMsR0FBRyxFQUFFLG9CQUFvQixDQUFDLENBQUM7QUFFbkQsSUFBSSxlQUFLLENBQUMsS0FBSyxFQUFFLFNBQVMsRUFBRTtJQUMxQixJQUFJLEVBQUUsSUFBSTtDQUNYLENBQUMsQ0FBQztBQUVILElBQUksNkJBQVMsQ0FBQyxHQUFHLEVBQUUsbUJBQW1CLEVBQUU7SUFDdEMsU0FBUyxFQUFFLENBQUMsS0FBSyxDQUFDO0NBQ25CLENBQUMsQ0FBQztBQUVILEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEFwcCwgU3RhY2sgfSBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgeyBJbnRlZ1Rlc3QgfSBmcm9tICdAYXdzLWNkay9pbnRlZy10ZXN0cy1hbHBoYSc7XG5pbXBvcnQgeyBUb3BpYyB9IGZyb20gJ2F3cy1jZGstbGliL2F3cy1zbnMnO1xuXG5jb25zdCBhcHAgPSBuZXcgQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IFN0YWNrKGFwcCwgJ2F3cy1jZGstc25zLWZpZm8tMScpO1xuXG5uZXcgVG9waWMoc3RhY2ssICdNeVRvcGljJywge1xuICBmaWZvOiB0cnVlLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnU25zRmlmb05vTmFtZVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.assets.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/SnsFifoNoNameTestDefaultTestDeployAssert931FC5EA.template.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.assets.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/aws-cdk-sns-fifo-1.template.json diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.ts new file mode 100644 index 0000000000000..1513330697cf6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.no-name.ts @@ -0,0 +1,17 @@ +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { Topic } from 'aws-cdk-lib/aws-sns'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-sns-fifo-1'); + +new Topic(stack, 'MyTopic', { + fifo: true, +}); + +new IntegTest(app, 'SnsFifoNoNameTest', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.ts similarity index 79% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.ts index a4352cbe6fe44..a4dffe0ed2b35 100644 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns-fifo.ts @@ -1,5 +1,5 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { Topic } from '../lib'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { Topic } from 'aws-cdk-lib/aws-sns'; class SNSFifoInteg extends Stack { constructor(scope: App, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js new file mode 100644 index 0000000000000..9e884ff2efc80 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_kms_1 = require("aws-cdk-lib/aws-kms"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_sns_1 = require("aws-cdk-lib/aws-sns"); +class SNSInteg extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const key = new aws_kms_1.Key(this, 'CustomKey'); + new aws_sns_1.Topic(this, 'MyTopic', { + topicName: 'fooTopic', + displayName: 'fooDisplayName', + masterKey: key, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new SNSInteg(app, 'SNSInteg'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQTBDO0FBQzFDLDZDQUFxRDtBQUNyRCxpREFBNEM7QUFFNUMsTUFBTSxRQUFTLFNBQVEsbUJBQUs7SUFDMUIsWUFBWSxLQUFVLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQ3BELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sR0FBRyxHQUFHLElBQUksYUFBRyxDQUFDLElBQUksRUFBRSxXQUFXLENBQUMsQ0FBQztRQUV2QyxJQUFJLGVBQUssQ0FBQyxJQUFJLEVBQUUsU0FBUyxFQUFFO1lBQ3pCLFNBQVMsRUFBRSxVQUFVO1lBQ3JCLFdBQVcsRUFBRSxnQkFBZ0I7WUFDN0IsU0FBUyxFQUFFLEdBQUc7U0FDZixDQUFDLENBQUM7SUFDTCxDQUFDO0NBQ0Y7QUFFRCxNQUFNLEdBQUcsR0FBRyxJQUFJLGlCQUFHLEVBQUUsQ0FBQztBQUV0QixJQUFJLFFBQVEsQ0FBQyxHQUFHLEVBQUUsVUFBVSxDQUFDLENBQUM7QUFFOUIsR0FBRyxDQUFDLEtBQUssRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgS2V5IH0gZnJvbSAnYXdzLWNkay1saWIvYXdzLWttcyc7XG5pbXBvcnQgeyBBcHAsIFN0YWNrLCBTdGFja1Byb3BzIH0gZnJvbSAnYXdzLWNkay1saWInO1xuaW1wb3J0IHsgVG9waWMgfSBmcm9tICdhd3MtY2RrLWxpYi9hd3Mtc25zJztcblxuY2xhc3MgU05TSW50ZWcgZXh0ZW5kcyBTdGFjayB7XG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBBcHAsIGlkOiBzdHJpbmcsIHByb3BzPzogU3RhY2tQcm9wcykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuXG4gICAgY29uc3Qga2V5ID0gbmV3IEtleSh0aGlzLCAnQ3VzdG9tS2V5Jyk7XG5cbiAgICBuZXcgVG9waWModGhpcywgJ015VG9waWMnLCB7XG4gICAgICB0b3BpY05hbWU6ICdmb29Ub3BpYycsXG4gICAgICBkaXNwbGF5TmFtZTogJ2Zvb0Rpc3BsYXlOYW1lJyxcbiAgICAgIG1hc3RlcktleToga2V5LFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcblxubmV3IFNOU0ludGVnKGFwcCwgJ1NOU0ludGVnJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/SNSInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/SNSInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/SNSInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/SNSInteg.assets.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/SNSInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/SNSInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/SNSInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/SNSInteg.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.configuration-set.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.ts new file mode 100644 index 0000000000000..ad9e6048dce91 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sns/test/integ.sns.ts @@ -0,0 +1,23 @@ +import { Key } from 'aws-cdk-lib/aws-kms'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; +import { Topic } from 'aws-cdk-lib/aws-sns'; + +class SNSInteg extends Stack { + constructor(scope: App, id: string, props?: StackProps) { + super(scope, id, props); + + const key = new Key(this, 'CustomKey'); + + new Topic(this, 'MyTopic', { + topicName: 'fooTopic', + displayName: 'fooDisplayName', + masterKey: key, + }); + } +} + +const app = new App(); + +new SNSInteg(app, 'SNSInteg'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js new file mode 100644 index 0000000000000..562bf54e0b1ce --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_kms_1 = require("aws-cdk-lib/aws-kms"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_sqs_1 = require("aws-cdk-lib/aws-sqs"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-sqs'); +const dlq = new aws_sqs_1.Queue(stack, 'DeadLetterQueue'); +const queue = new aws_sqs_1.Queue(stack, 'Queue', { + deadLetterQueue: { queue: dlq, maxReceiveCount: 5 }, + encryption: aws_sqs_1.QueueEncryption.KMS_MANAGED, +}); +const fifo = new aws_sqs_1.Queue(stack, 'FifoQueue', { + fifo: true, + encryptionMasterKey: new aws_kms_1.Key(stack, 'EncryptionKey', { removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY }), +}); +const highThroughputFifo = new aws_sqs_1.Queue(stack, 'HighThroughputFifoQueue', { + fifo: true, + fifoThroughputLimit: aws_sqs_1.FifoThroughputLimit.PER_MESSAGE_GROUP_ID, + deduplicationScope: aws_sqs_1.DeduplicationScope.MESSAGE_GROUP, +}); +const sqsManagedEncryptedQueue = new aws_sqs_1.Queue(stack, 'SqsManagedEncryptedQueue', { + encryption: aws_sqs_1.QueueEncryption.SQS_MANAGED, +}); +const unencryptedQueue = new aws_sqs_1.Queue(stack, 'UnencryptedQueue', { + encryption: aws_sqs_1.QueueEncryption.UNENCRYPTED, +}); +const ssl = new aws_sqs_1.Queue(stack, 'SSLQueue', { enforceSSL: true }); +const role = new aws_iam_1.Role(stack, 'Role', { + assumedBy: new aws_iam_1.AccountRootPrincipal(), +}); +dlq.grantConsumeMessages(role); +queue.grantConsumeMessages(role); +fifo.grantConsumeMessages(role); +highThroughputFifo.grantConsumeMessages(role); +sqsManagedEncryptedQueue.grantConsumeMessages(role); +unencryptedQueue.grantConsumeMessages(role); +ssl.grantConsumeMessages(role); +new aws_cdk_lib_1.CfnOutput(stack, 'QueueUrl', { value: queue.queueUrl }); +new integ.IntegTest(app, 'SqsTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3FzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3FzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaURBQWlFO0FBQ2pFLGlEQUEwQztBQUMxQyw2Q0FBbUU7QUFDbkUsb0RBQW9EO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mdyYW50Q29uc3VtZU1lc3NhZ2VzKHJvbGUpO1xuc3FzTWFuYWdlZEVuY3J5cHRlZFF1ZXVlLmdyYW50Q29uc3VtZU1lc3NhZ2VzKHJvbGUpO1xudW5lbmNyeXB0ZWRRdWV1ZS5ncmFudENvbnN1bWVNZXNzYWdlcyhyb2xlKTtcbnNzbC5ncmFudENvbnN1bWVNZXNzYWdlcyhyb2xlKTtcblxubmV3IENmbk91dHB1dChzdGFjaywgJ1F1ZXVlVXJsJywgeyB2YWx1ZTogcXVldWUucXVldWVVcmwgfSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnU3FzVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.assets.json diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.template.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/SqsTestDefaultTestDeployAssert659366A6.template.json diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.assets.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.assets.json diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.template.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/aws-cdk-sqs.template.json diff --git a/packages/@aws-cdk/aws-servicecatalog/test/portfolio.integ.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/portfolio.integ.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.ts new file mode 100644 index 0000000000000..fc3344f1bfb98 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-sqs/test/integ.sqs.ts @@ -0,0 +1,51 @@ +import { AccountRootPrincipal, Role } from 'aws-cdk-lib/aws-iam'; +import { Key } from 'aws-cdk-lib/aws-kms'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { DeduplicationScope, FifoThroughputLimit, Queue, QueueEncryption } from 'aws-cdk-lib/aws-sqs'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-sqs'); + +const dlq = new Queue(stack, 'DeadLetterQueue'); +const queue = new Queue(stack, 'Queue', { + deadLetterQueue: { queue: dlq, maxReceiveCount: 5 }, + encryption: QueueEncryption.KMS_MANAGED, +}); +const fifo = new Queue(stack, 'FifoQueue', { + fifo: true, + encryptionMasterKey: new Key(stack, 'EncryptionKey', { removalPolicy: RemovalPolicy.DESTROY }), +}); +const highThroughputFifo = new Queue(stack, 'HighThroughputFifoQueue', { + fifo: true, + fifoThroughputLimit: FifoThroughputLimit.PER_MESSAGE_GROUP_ID, + deduplicationScope: DeduplicationScope.MESSAGE_GROUP, +}); +const sqsManagedEncryptedQueue = new Queue(stack, 'SqsManagedEncryptedQueue', { + encryption: QueueEncryption.SQS_MANAGED, +}); +const unencryptedQueue = new Queue(stack, 'UnencryptedQueue', { + encryption: QueueEncryption.UNENCRYPTED, +}); +const ssl = new Queue(stack, 'SSLQueue', { enforceSSL: true }); + +const role = new Role(stack, 'Role', { + assumedBy: new AccountRootPrincipal(), +}); + +dlq.grantConsumeMessages(role); +queue.grantConsumeMessages(role); +fifo.grantConsumeMessages(role); +highThroughputFifo.grantConsumeMessages(role); +sqsManagedEncryptedQueue.grantConsumeMessages(role); +unencryptedQueue.grantConsumeMessages(role); +ssl.grantConsumeMessages(role); + +new CfnOutput(stack, 'QueueUrl', { value: queue.queueUrl }); + +new integ.IntegTest(app, 'SqsTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js new file mode 100644 index 0000000000000..1746ad5cb9b5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ssm = require("aws-cdk-lib/aws-ssm"); +const paramName = 'integ-list-param'; +const paramValue = ['value1', 'value2']; +class TestCaseBase extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + this.listParam = new ssm.StringListParameter(this, 'ListParam', { + parameterName: paramName, + stringListValue: paramValue, + }); + } +} +const app = new cdk.App({ + treeMetadata: false, +}); +app.node.setContext('@aws-cdk/core:newStyleStackSynthesis', true); +const base = new TestCaseBase(app, 'base'); +const testCase = new cdk.Stack(app, 'list-param'); +// creates the dependency between stacks +new cdk.CfnOutput(testCase, 'Output', { + value: cdk.Fn.join(',', base.listParam.stringListValue), +}); +/** + * get the value from the `base` stack and then write it to a new parameter + * We will then assert that the value that is written is the correct value + * This validates that the `fromXXX` and `valueForXXX` imports the value correctly + */ +const fromAttrs = ssm.StringListParameter.fromListParameterAttributes(testCase, 'FromAttrs', { + parameterName: paramName, + elementType: ssm.ParameterValueType.STRING, +}); +const ssmAttrsValue = new ssm.CfnParameter(testCase, 'attrs-test', { + type: 'StringList', + value: cdk.Fn.join(',', fromAttrs.stringListValue), +}); +const value = ssm.StringListParameter.valueForTypedListParameter(testCase, paramName, ssm.ParameterValueType.STRING); +const ssmValue = new ssm.CfnParameter(testCase, 'value-test', { + type: 'StringList', + value: cdk.Fn.join(',', value), +}); +const versionValue = ssm.StringListParameter.valueForTypedListParameter(testCase, paramName, ssm.ParameterValueType.STRING, 1); +const ssmVersionValue = new ssm.CfnParameter(testCase, 'version-value-test', { + type: 'StringList', + value: cdk.Fn.join(',', versionValue), +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'ssm-string-param', { + testCases: [ + testCase, + ], +}); +// list the parameters +const actualAttrs = integ.assertions.awsApiCall('SSM', 'getParameters', { + Names: [ssmVersionValue.ref, ssmValue.ref, ssmAttrsValue.ref], +}); +actualAttrs.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + Parameters: integ_tests_alpha_1.Match.arrayWith([ + integ_tests_alpha_1.Match.objectLike({ + Value: paramValue.join(','), + }), + integ_tests_alpha_1.Match.objectLike({ + Value: paramValue.join(','), + }), + integ_tests_alpha_1.Match.objectLike({ + Value: paramValue.join(','), + }), + ]), +})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGlzdC1wYXJhbWV0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5saXN0LXBhcmFtZXRlci50cyJdLCJuYW1lcyI6W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FtZXM6IFtzc21WZXJzaW9uVmFsdWUucmVmLCBzc21WYWx1ZS5yZWYsIHNzbUF0dHJzVmFsdWUucmVmXSxcbn0pO1xuXG5hY3R1YWxBdHRycy5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIFBhcmFtZXRlcnM6IE1hdGNoLmFycmF5V2l0aChbXG4gICAgTWF0Y2gub2JqZWN0TGlrZSh7XG4gICAgICBWYWx1ZTogcGFyYW1WYWx1ZS5qb2luKCcsJyksXG4gICAgfSksXG4gICAgTWF0Y2gub2JqZWN0TGlrZSh7XG4gICAgICBWYWx1ZTogcGFyYW1WYWx1ZS5qb2luKCcsJyksXG4gICAgfSksXG4gICAgTWF0Y2gub2JqZWN0TGlrZSh7XG4gICAgICBWYWx1ZTogcGFyYW1WYWx1ZS5qb2luKCcsJyksXG4gICAgfSksXG4gIF0pLFxufSkpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/base.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/base.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/base.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/base.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/base.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/base.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/base.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/base.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/list-param.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.js.snapshot/ssmstringparamDefaultTestDeployAssert9C612E37.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.ts similarity index 96% rename from packages/@aws-cdk/aws-ssm/test/integ.list-parameter.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.ts index 81d438fa96f9c..bdf4b628669c4 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.list-parameter.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.list-parameter.ts @@ -1,7 +1,7 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as ssm from '../lib'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; const paramName = 'integ-list-param'; const paramValue = ['value1', 'value2']; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js new file mode 100644 index 0000000000000..569a10a7e34ac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ssm = require("aws-cdk-lib/aws-ssm"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-parameter-arns'); +const input = new aws_cdk_lib_1.CfnParameter(stack, 'ParameterNameParameter', { type: 'String', default: 'myParamName' }); +const params = [ + new ssm.StringParameter(stack, 'StringAutogen', { stringValue: 'hello, world' }), + new ssm.StringParameter(stack, 'StringSimple', { stringValue: 'hello, world', parameterName: 'simple-name' }), + new ssm.StringParameter(stack, 'StringPath', { stringValue: 'hello, world', parameterName: '/path/name/foo/bar' }), + new ssm.StringListParameter(stack, 'ListAutogen', { stringListValue: ['hello', 'world'] }), + new ssm.StringListParameter(stack, 'ListSimple', { stringListValue: ['hello', 'world'], parameterName: 'list-simple-name' }), + new ssm.StringListParameter(stack, 'ListPath', { stringListValue: ['hello', 'world'], parameterName: '/list/path/name' }), + new ssm.StringParameter(stack, 'ParameterizedSimple', { stringValue: 'hello, world', parameterName: input.valueAsString, simpleName: true }), + new ssm.StringParameter(stack, 'ParameterizedNonSimple', { stringValue: 'hello, world', parameterName: `/${input.valueAsString}/non/simple`, simpleName: false }), +]; +for (const p of params) { + new aws_cdk_lib_1.CfnOutput(stack, `${p.node.id}Arn`, { value: p.parameterArn }); +} +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-ssm-parameter-arns', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGFyYW1ldGVyLWFybnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wYXJhbWV0ZXItYXJucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZDQUFrRTtBQUNsRSxrRUFBdUQ7QUFDdkQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztBQUVyRCxNQUFNLEtBQUssR0FBRyxJQUFJLDBCQUFZLENBQUMsS0FBSyxFQUFFLHdCQUF3QixFQUFFLEVBQUUsSUFBSSxFQUFFLFFBQVEsRUFBRSx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BzdHJpbmdWYWx1ZTogJ2hlbGxvLCB3b3JsZCcsIHBhcmFtZXRlck5hbWU6IGlucHV0LnZhbHVlQXNTdHJpbmcsIHNpbXBsZU5hbWU6IHRydWUgfSksXG4gIG5ldyBzc20uU3RyaW5nUGFyYW1ldGVyKHN0YWNrLCAnUGFyYW1ldGVyaXplZE5vblNpbXBsZScsIHsgc3RyaW5nVmFsdWU6ICdoZWxsbywgd29ybGQnLCBwYXJhbWV0ZXJOYW1lOiBgLyR7aW5wdXQudmFsdWVBc1N0cmluZ30vbm9uL3NpbXBsZWAsIHNpbXBsZU5hbWU6IGZhbHNlIH0pLFxuXTtcblxuZm9yIChjb25zdCBwIG9mIHBhcmFtcykge1xuICBuZXcgQ2ZuT3V0cHV0KHN0YWNrLCBgJHtwLm5vZGUuaWR9QXJuYCwgeyB2YWx1ZTogcC5wYXJhbWV0ZXJBcm4gfSk7XG59XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2RrLWludGVnLXNzbS1wYXJhbWV0ZXItYXJucycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/cdkintegssmparameterarnsDefaultTestDeployAssertE4B86A49.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/integ-parameter-arns.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.ts similarity index 89% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.ts index 6d14c352f1350..ee72612e309ab 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.parameter-arns.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-arns.ts @@ -1,6 +1,6 @@ -import { App, CfnOutput, CfnParameter, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ssm from '../lib'; +import { App, CfnOutput, CfnParameter, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; const app = new App(); const stack = new Stack(app, 'integ-parameter-arns'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js new file mode 100644 index 0000000000000..da5be1650dcad --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js @@ -0,0 +1,88 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const ssm = require("aws-cdk-lib/aws-ssm"); +const SECURE_PARAM_NAME = '/My/Secret/Parameter'; +class CreatingStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + new ssm.StringParameter(this, 'String', { + parameterName: '/My/Public/Parameter', + stringValue: 'Abc123', + }); + new integ.AwsApiCall(this, 'SecureParam', { + service: 'SSM', + api: 'putParameter', + parameters: { + Name: SECURE_PARAM_NAME, + Type: 'SecureString', + Value: 'Abc123', + }, + }); + } +} +class UsingStack extends cdk.Stack { + constructor(scope, id) { + super(scope, id); + // Parameter that contains version number, will be used to pass + // version value from token. + const parameterVersion = new cdk.CfnParameter(this, 'MyParameterVersion', { + type: 'Number', + default: 1, + }).valueAsNumber; + // Retrieve the latest value of the non-secret parameter + // with name "/My/String/Parameter". + const stringValue = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValue', { + parameterName: '/My/Public/Parameter', + // 'version' can be specified but is optional. + }).stringValue; + const stringValueVersionFromToken = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValueVersionFromToken', { + parameterName: '/My/Public/Parameter', + // parameter version from token + version: parameterVersion, + }).stringValue; + // Retrieve a specific version of the secret (SecureString) parameter. + const secretValue = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValue', { + parameterName: '/My/Secret/Parameter', + }).stringValue; + const secretValueVersion = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValueVersion', { + parameterName: '/My/Secret/Parameter', + version: 1, + }).stringValue; + const secretValueVersionFromToken = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValueVersionFromToken', { + parameterName: '/My/Secret/Parameter', + // parameter version from token + version: parameterVersion, + }).stringValue; + const user = new cdk.CfnResource(this, 'DummyResourceUsingStringParameters', { + type: 'AWS::IAM::User', + properties: { + LoginProfile: { + Password: cdk.Fn.join('-', [ + stringValue, + stringValueVersionFromToken, + secretValue, + secretValueVersion, + secretValueVersionFromToken, + ]), + }, + }, + }); + user.applyRemovalPolicy(cdk.RemovalPolicy.DESTROY); + } +} +const app = new cdk.App(); +const creating = new CreatingStack(app, 'sspms-creating'); +const using = new UsingStack(app, 'sspms-using'); +using.addDependency(creating); +const cleanup = new cdk.Stack(app, 'sspms-cleanup'); +cleanup.addDependency(using); +const integTest = new integ.IntegTest(app, 'SSMParameterStoreTest', { + assertionStack: cleanup, + testCases: [using], +}); +integTest.assertions.awsApiCall('SSM', 'deleteParameter', { + Name: SECURE_PARAM_NAME, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGFyYW1ldGVyLXN0b3JlLXN0cmluZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBhcmFtZXRlci1zdG9yZS1zdHJpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELDJDQUEyQztBQUUzQyxNQUFNLGlCQUFpQixHQUFHLHNCQUFzQixDQUFDO0FBRWpELE1BQU0sYUFB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N0b3JlVGVzdCcsIHtcbiAgYXNzZXJ0aW9uU3RhY2s6IGNsZWFudXAsXG4gIHRlc3RDYXNlczogW3VzaW5nXSxcbn0pO1xuXG5pbnRlZ1Rlc3QuYXNzZXJ0aW9ucy5hd3NBcGlDYWxsKCdTU00nLCAnZGVsZXRlUGFyYW1ldGVyJywge1xuICBOYW1lOiBTRUNVUkVfUEFSQU1fTkFNRSxcbn0pO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/asset.1f3c2cfb18e102edc713fe4c4b4d87572f4297ee4a5e80a5960adf526ee9ea28.bundle/index.js diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-cleanup.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-creating.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/sspms-using.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.ts similarity index 95% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.ts index a345c3c761b01..7dee2fc62fd4a 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.parameter-store-string.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter-store-string.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ssm from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; const SECURE_PARAM_NAME = '/My/Secret/Parameter'; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js new file mode 100644 index 0000000000000..2d7e7e1a8aae5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const ssm = require("aws-cdk-lib/aws-ssm"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'SSM-Parameter'); +const role = new iam.Role(stack, 'UserRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); +const param = new ssm.StringParameter(stack, 'StringParameter', { + stringValue: 'Initial parameter value', +}); +param.grantRead(role); +const listParameter = new ssm.StringListParameter(stack, 'StringListParameter', { + stringListValue: ['Initial parameter value A', 'Initial parameter value B'], +}); +new cdk.CfnOutput(stack, 'StringListOutput', { + value: cdk.Fn.join('+', listParameter.stringListValue), +}); +new cdk.CfnOutput(stack, 'ParamArn', { + value: param.parameterArn, +}); +new integ_tests_alpha_1.IntegTest(app, 'cdk-integ-ssm-parameter', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGFyYW1ldGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGFyYW1ldGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLG1DQUFtQztBQUNuQyxrRUFBdUQ7QUFDdkQsMkNBQTJDO0FBRTNDLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZUFBZSxDQUFDLENBQUM7QUFFbEQsTUFBTSxJQUFJLEdBQUcsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDM0MsU0FBUyxFQUFFLElBQUksR0FBRyxDQUFDLG9CQUFvQixFQUFFO0NBQzFDLENBQUMsQ0FBQztBQUVILE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLGVBQWUsQ0FBQyxLQUFLLEVBQUUsaUJBQWlCLEVBQUU7SUFDOUQsV0FBVyxFQUFFLHlCQUF5QjtDQUN2QyxDQUFDLENBQUM7QUFFSCxLQUFLLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxDQUFDO0FBRXRCLE1BQU0sYUFBYSxHQUFHLElBQUksR0FBRyxDQUFDLG1CQUFtQixDQUFDLEtBQUssRUFBRSxxQkFBcUIsRUFBRTtJQUM5RSxlQUFlLEVBQU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hcmFtZXRlcihzdGFjaywgJ1N0cmluZ1BhcmFtZXRlcicsIHtcbiAgc3RyaW5nVmFsdWU6ICdJbml0aWFsIHBhcmFtZXRlciB2YWx1ZScsXG59KTtcblxucGFyYW0uZ3JhbnRSZWFkKHJvbGUpO1xuXG5jb25zdCBsaXN0UGFyYW1ldGVyID0gbmV3IHNzbS5TdHJpbmdMaXN0UGFyYW1ldGVyKHN0YWNrLCAnU3RyaW5nTGlzdFBhcmFtZXRlcicsIHtcbiAgc3RyaW5nTGlzdFZhbHVlOiBbJ0luaXRpYWwgcGFyYW1ldGVyIHZhbHVlIEEnLCAnSW5pdGlhbCBwYXJhbWV0ZXIgdmFsdWUgQiddLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnU3RyaW5nTGlzdE91dHB1dCcsIHtcbiAgdmFsdWU6IGNkay5Gbi5qb2luKCcrJywgbGlzdFBhcmFtZXRlci5zdHJpbmdMaXN0VmFsdWUpLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnUGFyYW1Bcm4nLCB7XG4gIHZhbHVlOiBwYXJhbS5wYXJhbWV0ZXJBcm4sXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdjZGstaW50ZWctc3NtLXBhcmFtZXRlcicsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/SSM-Parameter.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.assets.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.assets.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.template.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/cdkintegssmparameterDefaultTestDeployAssert8D247A87.template.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ssm/test/integ.parameter.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.ts similarity index 80% rename from packages/@aws-cdk/aws-ssm/test/integ.parameter.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.ts index db8315792696b..19f754a887de0 100644 --- a/packages/@aws-cdk/aws-ssm/test/integ.parameter.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ssm/test/integ.parameter.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ssm from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'SSM-Parameter'); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/CallHttpApiInteg.template.json diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js new file mode 100644 index 0000000000000..c32676cfb9977 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const apigateway = require("aws-cdk-lib/aws-apigateway"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * + * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED + * * aws stepfunctions describe-execution --execution-arn --query 'output': should return the string \"hello, world!\" + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'CallRestApiInteg'); +const restApi = new apigateway.RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); +const hello = new apigateway.LambdaIntegration(new lambda.Function(stack, 'Hello', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: new lambda.InlineCode('exports.handler = async function(event, context) { return { statusCode: 200, body: "hello, world!" }; };'), +})); +restApi.root.addMethod('ANY', hello); +const callEndpointJob = new aws_stepfunctions_tasks_1.CallApiGatewayRestApiEndpoint(stack, 'Call APIGW', { + api: restApi, + stageName: 'prod', + method: aws_stepfunctions_tasks_1.HttpMethod.GET, + authType: aws_stepfunctions_tasks_1.AuthType.IAM_ROLE, + outputPath: sfn.JsonPath.stringAt('$.ResponseBody'), +}); +const chain = sfn.Chain.start(callEndpointJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new integ_tests_alpha_1.IntegTest(app, 'call-rest-api', { + testCases: [stack], +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FsbC1yZXN0LWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3V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YWNoaW5lQXJuLFxufSk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnY2FsbC1yZXN0LWFwaScsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/CallRestApiInteg.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/callrestapiDefaultTestDeployAssert9913150A.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts similarity index 84% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts index 78e3f3800d726..37411facf734a 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.ts @@ -1,9 +1,9 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AuthType, HttpMethod, CallApiGatewayRestApiEndpoint } from '../../lib'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AuthType, HttpMethod, CallApiGatewayRestApiEndpoint } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js new file mode 100644 index 0000000000000..bb96796167da8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED and a query-execution-id + * * aws athena get-query-execution --query-execution-id : should return QueryExecution + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-athena-get-query-execution-integ'); +const startQueryExecutionJob = new aws_stepfunctions_tasks_1.AthenaStartQueryExecution(stack, 'Start Athena Query', { + queryString: sfn.JsonPath.stringAt('$.queryString'), + queryExecutionContext: { + databaseName: 'mydatabase', + }, + resultConfiguration: { + encryptionConfiguration: { + encryptionOption: aws_stepfunctions_tasks_1.EncryptionOption.S3_MANAGED, + }, + }, +}); +const getQueryExecutionJob = new aws_stepfunctions_tasks_1.AthenaGetQueryExecution(stack, 'Get Query Execution', { + queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), +}); +const chain = sfn.Chain.start(startQueryExecutionJob).next(getQueryExecutionJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2V0LXF1ZXJ5LWV4ZWN1dGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmdldC1xdWVyeS1leGVjdXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxREFBcUQ7QUFDckQsbUNBQW1DO0FBQ25DLGlGQUEySDtBQUUzSDs7Ozs7R0FLRztBQUNILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMERBQTBELENBQUMsQ0FBQztBQUU3RixNQUFNLHNCQUFzQixHQUFHLElBQUksbURBQXlCLENBQUMsS0FBSyxFQUFFLG9CQUFvQixFQUFFO0lBQ3hGLFdBQVcsRUFBRSxHQUFHLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxlQUFlLENBQUM7SUFDbkQscUJBQXFCLEVBQUU7UUFDckIsWUFBWSxFQUFFLFlBQVk7S0FDM0I7SUFDRCxtQkFBbUIsRUFBRTtRQUNuQix1QkFBdUIsRUFBRTtZQUN2QixnQkFBZ0IsRUFBRSwwQ0FBZ0IsQ0FBQyxVQUFVO1NBQzlDO0tBQ0Y7Q0FDRixDQUFDLENBQUM7QUFFSCxNQUFNLG9CQUF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3J5cHRpb25PcHRpb246IEVuY3J5cHRpb25PcHRpb24uUzNfTUFOQUdFRCxcbiAgICB9LFxuICB9LFxufSk7XG5cbmNvbnN0IGdldFF1ZXJ5RXhlY3V0aW9uSm9iID0gbmV3IEF0aGVuYUdldFF1ZXJ5RXhlY3V0aW9uKHN0YWNrLCAnR2V0IFF1ZXJ5IEV4ZWN1dGlvbicsIHtcbiAgcXVlcnlFeGVjdXRpb25JZDogc2ZuLkpzb25QYXRoLnN0cmluZ0F0KCckLlF1ZXJ5RXhlY3V0aW9uSWQnKSxcbn0pO1xuXG5jb25zdCBjaGFpbiA9IHNmbi5DaGFpbi5zdGFydChzdGFydFF1ZXJ5RXhlY3V0aW9uSm9iKS5uZXh0KGdldFF1ZXJ5RXhlY3V0aW9uSm9iKTtcblxuY29uc3Qgc20gPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbjogY2hhaW4sXG4gIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-get-query-execution-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-rest-api.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.ts similarity index 90% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.ts index ea61de7bc44d8..a8e1f44c8a2d3 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { AthenaStartQueryExecution, AthenaGetQueryExecution, EncryptionOption } from '../../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { AthenaStartQueryExecution, AthenaGetQueryExecution, EncryptionOption } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js new file mode 100644 index 0000000000000..fa7508a0ce248 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED and a query-execution-id + * * aws athena get-query-results --query-execution-id : should return query results + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-athena-get-query-results-integ'); +const query = sfn.JsonPath.stringAt('$.queryString'); +const startQueryExecutionJob = new aws_stepfunctions_tasks_1.AthenaStartQueryExecution(stack, 'Start Athena Query', { + queryString: query, + queryExecutionContext: { + databaseName: 'mydatabase', + }, + resultConfiguration: { + encryptionConfiguration: { + encryptionOption: aws_stepfunctions_tasks_1.EncryptionOption.S3_MANAGED, + }, + }, +}); +const wait = new sfn.Wait(stack, 'Wait', { + time: sfn.WaitTime.duration(cdk.Duration.seconds(10)), +}); +const getQueryResultsJob = new aws_stepfunctions_tasks_1.AthenaGetQueryResults(stack, 'Get Query Results', { + queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), +}); +const chain = sfn.Chain + .start(startQueryExecutionJob) + .next(wait) + .next(getQueryResultsJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2V0LXF1ZXJ5LXJlc3VsdHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5nZXQtcXVlcnktcmVzdWx0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsaUZBQXlIO0FBRXpIOzs7OztHQUtHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx3REFBd0QsQ0FBQyxDQUFDO0FBRTNGLE1BQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBQyxDQUFDO0FBRXJELE1BQU0sc0JBQXNCLEdBQUcsSUFBSSxtREFBeUIsQ0FBQyxLQUFLLEVBQUUsb0JBQW9CLEVBQUU7SUFDeEYsV0FBVyxFQUFFLEtBQUs7SUFDbEIscUJBQXFCLEVBQUU7UUFDckIsWUFBWSxFQUFFLFlBQVk7S0FDM0I7SUFDRCxtQkFBbUIsRUFBRTtRQUNuQix1QkFBdUIsRUFBRTtZQUN2QixnQkFBZ0IsRUFBRSwwQ0FBZ0IsQ0FBQyxVQUFVO1NBQzlDO0tBQ0Y7Q0FDRixDQUFDLENBQUM7QUFFSCxNQUFNLElBQUksR0FBRyxJQUFJLEdBQUcsQ0FBQyxJQUFJLENBQUMsS0FBSyxFQUFFLE1BQU0s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pbmVBcm4nLCB7XG4gIHZhbHVlOiBzbS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/aws-stepfunctions-tasks-athena-get-query-results-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-execution.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.ts index d175ee7268aee..be15b8e5a4fa6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.get-query-results.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { AthenaStartQueryExecution, AthenaGetQueryResults, EncryptionOption } from '../../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { AthenaStartQueryExecution, AthenaGetQueryResults, EncryptionOption } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js new file mode 100644 index 0000000000000..0989d2cfe8e0e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED and a query-execution-id + * * aws athena get-query-execution --query-execution-id : should return QueryExecution + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-athena-start-query-execution-integ'); +const startQueryExecutionJob = new aws_stepfunctions_tasks_1.AthenaStartQueryExecution(stack, 'Start Athena Query', { + queryString: sfn.JsonPath.stringAt('$.queryString'), + queryExecutionContext: { + databaseName: 'mydatabase', + }, + resultConfiguration: { + encryptionConfiguration: { + encryptionOption: aws_stepfunctions_tasks_1.EncryptionOption.S3_MANAGED, + }, + outputLocation: { + bucketName: 'query-results-bucket', + objectKey: 'folder', + }, + }, +}); +const chain = sfn.Chain.start(startQueryExecutionJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtcXVlcnktZXhlY3V0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3RhcnQtcXVlcnktZXhlY3V0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyxpRkFBa0c7QUFFbEc7Ozs7O0dBS0c7QUFDSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDREQUE0RCxDQUFDLENBQUM7QUFFL0YsTUFBTSxzQkFBc0IsR0FBRyxJQUFJLG1EQUF5QixDQUFDLEtBQUssRUFBRSxvQkFBb0IsRUFBRTtJQUN4RixXQUFXLEVBQUUsR0FBRyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsZUFBZSxDQUFDO0lBQ25ELHFCQUFxQixFQUFFO1FBQ3JCLFlBQVksRUFBRSxZQUFZO0tBQzNCO0lBQ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9uT3B0aW9uOiBFbmNyeXB0aW9uT3B0aW9uLlMzX01BTkFHRUQsXG4gICAgfSxcbiAgICBvdXRwdXRMb2NhdGlvbjoge1xuICAgICAgYnVja2V0TmFtZTogJ3F1ZXJ5LXJlc3VsdHMtYnVja2V0JyxcbiAgICAgIG9iamVjdEtleTogJ2ZvbGRlcicsXG4gICAgfSxcbiAgfSxcbn0pO1xuXG5cbmNvbnN0IGNoYWluID0gc2ZuLkNoYWluLnN0YXJ0KHN0YXJ0UXVlcnlFeGVjdXRpb25Kb2IpO1xuXG5jb25zdCBzbSA9IG5ldyBzZm4uU3RhdGVNYWNoaW5lKHN0YWNrLCAnU3RhdGVNYWNoaW5lJywge1xuICBkZWZpbml0aW9uOiBjaGFpbixcbiAgdGltZW91dDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMzApLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnc3RhdGVNYWNoaW5lQXJuJywge1xuICB2YWx1ZTogc20uc3RhdGVNYWNoaW5lQXJuLFxufSk7XG5cblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-start-query-execution-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.get-query-results.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts similarity index 86% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts index 1a8e3e21d9bb2..fb07e283f3860 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { AthenaStartQueryExecution, EncryptionOption } from '../../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { AthenaStartQueryExecution, EncryptionOption } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js new file mode 100644 index 0000000000000..fabfb3132b236 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED and a query-execution-id + * * aws athena get-query-execution --query-execution-id : should return QueryExecution + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-athena-stop-query-execution-integ'); +const query = sfn.JsonPath.stringAt('$.queryString'); +const startQueryExecutionJob = new aws_stepfunctions_tasks_1.AthenaStartQueryExecution(stack, 'Start Athena Query', { + queryString: query, + queryExecutionContext: { + databaseName: 'mydatabase', + }, + resultConfiguration: { + encryptionConfiguration: { + encryptionOption: aws_stepfunctions_tasks_1.EncryptionOption.S3_MANAGED, + }, + }, +}); +const stopQueryExecutionJob = new aws_stepfunctions_tasks_1.AthenaStopQueryExecution(stack, 'Stop Query Execution', { + queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), +}); +const chain = sfn.Chain.start(startQueryExecutionJob).next(stopQueryExecutionJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RvcC1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UV4ZWN1dGlvbklkOiBzZm4uSnNvblBhdGguc3RyaW5nQXQoJyQuUXVlcnlFeGVjdXRpb25JZCcpLFxufSk7XG5cbmNvbnN0IGNoYWluID0gc2ZuLkNoYWluLnN0YXJ0KHN0YXJ0UXVlcnlFeGVjdXRpb25Kb2IpLm5leHQoc3RvcFF1ZXJ5RXhlY3V0aW9uSm9iKTtcblxuY29uc3Qgc20gPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbjogY2hhaW4sXG4gIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/aws-stepfunctions-tasks-athena-stop-query-execution-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.start-query-execution.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.ts similarity index 90% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.ts index f4ffae41bdbfc..d5bb2ee2d942d 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { AthenaStartQueryExecution, AthenaStopQueryExecution, EncryptionOption } from '../../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { AthenaStartQueryExecution, AthenaStopQueryExecution, EncryptionOption } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js new file mode 100644 index 0000000000000..444c1289bf131 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-call-aws-service-sfn-integ'); +const task = new aws_stepfunctions_tasks_1.CallAwsService(stack, 'SendTaskSuccess', { + service: 'sfn', + action: 'sendTaskSuccess', + iamResources: ['*'], + parameters: { + Output: sfn.JsonPath.objectAt('$.output'), + TaskToken: sfn.JsonPath.stringAt('$.taskToken'), + }, +}); +const childStateMachine = new sfn.StateMachine(stack, 'ChildStateMachine', { + definition: task, +}); +const stateMachine = new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: new aws_stepfunctions_tasks_1.StepFunctionsStartExecution(stack, 'StepFunctionsStartExecution', { + stateMachine: childStateMachine, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + input: sfn.TaskInput.fromObject({ + output: sfn.JsonPath.entirePayload, + taskToken: sfn.JsonPath.taskToken, + }), + }), +}); +// THEN +const integ = new integ_tests_alpha_1.IntegTest(app, 'IntegTest', { + testCases: [stack], +}); +const res = integ.assertions.awsApiCall('StepFunctions', 'startExecution', { + stateMachineArn: stateMachine.stateMachineArn, +}); +const executionArn = res.getAttString('executionArn'); +integ.assertions.awsApiCall('StepFunctions', 'describeExecution', { + executionArn, +}).expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + status: 'SUCCEEDED', +})).waitForAssertions({ + totalTimeout: cdk.Duration.seconds(10), + interval: cdk.Duration.seconds(3), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FsbC1hd3Mtc2VydmljZS1zZm4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jYWxsLWF3cy1zZXJ2aWNlLXNmbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsa0VBQXVFO0FBQ3ZFLGlGQUFrRztBQUVsRyxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG9EQUFvRCxDQUFDLENBQUM7QUFFdkYsTUFBTSxJQUFJLEdBQUcsSUFBSSx3Q0FBYyxDQUFDLEtBQUssRUFBRSxpQkFBaUIsRUFBRTtJQUN4RCxPQUFPLEVBQUUsS0FBSztJQUNkLE1BQU0sRUFBRSxpQkFBaUI7SUFDekIsWUFBWSxFQUFFLENBQUMsR0FBRyxDQUFDO0lBQ25CLFVBQVUsRUFBRTtRQUNWLE1BQU0sRUFBRSxHQUFHLENBQUMsUUFBUSxDQUFDLFFBQVEsQ0FBQyxVQUFVLENBQUM7UUFDekMsU0FBUyxFQUFFLEdBQUcsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLGFBQWEsQ0FBQztLQUNoRDtDQUNGLENBQUMsQ0FBQztBQUVILE1BQU0saUJBQWlCLEdBQUcsSUFBSSxHQUFHLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxtQkFBbUIsRUFBRTtJQUN6RSxVQUFVLEVBQUUsSUFBSTt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aW5lLnN0YXRlTWFjaGluZUFybixcbn0pO1xuY29uc3QgZXhlY3V0aW9uQXJuID0gcmVzLmdldEF0dFN0cmluZygnZXhlY3V0aW9uQXJuJyk7XG5pbnRlZy5hc3NlcnRpb25zLmF3c0FwaUNhbGwoJ1N0ZXBGdW5jdGlvbnMnLCAnZGVzY3JpYmVFeGVjdXRpb24nLCB7XG4gIGV4ZWN1dGlvbkFybixcbn0pLmV4cGVjdChFeHBlY3RlZFJlc3VsdC5vYmplY3RMaWtlKHtcbiAgc3RhdHVzOiAnU1VDQ0VFREVEJyxcbn0pKS53YWl0Rm9yQXNzZXJ0aW9ucyh7XG4gIHRvdGFsVGltZW91dDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMTApLFxuICBpbnRlcnZhbDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMyksXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/IntegTestDefaultTestDeployAssertE3E7D2A4.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/aws-stepfunctions-tasks-call-aws-service-sfn-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/integ.stop-query-execution.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.ts similarity index 84% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.ts index 06cb7aa72623f..985d886a6af34 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.ts @@ -1,7 +1,7 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import { CallAwsService, StepFunctionsStartExecution } from '../../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import { CallAwsService, StepFunctionsStartExecution } from 'aws-cdk-lib/aws-stepfunctions-tasks'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-call-aws-service-sfn-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js new file mode 100644 index 0000000000000..b4620915207eb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const s3 = require("aws-cdk-lib/aws-s3"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/** + * + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn --input {"body": "hello world!"} : should return execution arn + * * + * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED + * * aws stepfunctions describe-execution --execution-arn --query 'output': should return "hello world!" + */ +class TestStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + const bucket = new s3.Bucket(this, 'Bucket'); + const commonParameters = { + Bucket: bucket.bucketName, + Key: 'test.txt', + }; + const iamResources = [bucket.arnForObjects('*')]; + const putObject = new tasks.CallAwsService(this, 'PutObject', { + service: 's3', + action: 'putObject', + parameters: { + Body: sfn.JsonPath.stringAt('$.body'), + ...commonParameters, + }, + iamResources, + }); + const getObject = new tasks.CallAwsService(this, 'GetObject', { + service: 's3', + action: 'getObject', + parameters: commonParameters, + iamResources, + }); + const deleteObject = new tasks.CallAwsService(this, 'DeleteObject', { + service: 's3', + action: 'deleteObject', + parameters: commonParameters, + iamResources, + resultPath: aws_stepfunctions_1.JsonPath.DISCARD, + }); + const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition: putObject.next(getObject).next(deleteObject), + }); + new cdk.CfnOutput(this, 'StateMachineArn', { + value: stateMachine.stateMachineArn, + }); + } +} +const app = new cdk.App(); +new TestStack(app, 'aws-stepfunctions-aws-sdk-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FsbC1hd3Mtc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNhbGwtYXdzLXNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5Q0FBeUM7QUFDekMscURBQXFEO0FBQ3JELHFFQUF5RDtBQUN6RCxtQ0FBbUM7QUFDbkMsNkRBQTZEO0FBRTdEOzs7Ozs7O0dBT0c7QUFDSCxNQUFNLFNBQVUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUMvQixZQUFZLEtBQWMsRUFBRSxFQUFVLEVBQUUsUUFBd0IsRUFBRTtRQUNoRSxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLE1BQU0sR0FBRyxJQUFJLEVBQUUs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lLnN0YXRlTWFjaGluZUFybixcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IFRlc3RTdGFjayhhcHAsICdhd3Mtc3RlcGZ1bmN0aW9ucy1hd3Mtc2RrLWludGVnJyk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/aws-stepfunctions-aws-sdk-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service-sfn.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.ts similarity index 87% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.ts index 3c9302e389763..93eba96965779 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.ts @@ -1,8 +1,8 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { JsonPath } from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { JsonPath } from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /** * diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js new file mode 100644 index 0000000000000..546cdac77137a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws codebuild list-builds-for-project --project-name : should return a list of projects with size greater than 0 + * * + * * aws codebuild batch-get-builds --ids --query 'builds[0].buildStatus': wait until the status is 'SUCCEEDED' + * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED + */ +class StartBuildStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + let project = new codebuild.Project(this, 'Project', { + projectName: 'MyTestProject', + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'echo "Hello, CodeBuild!"', + ], + }, + }, + }), + environmentVariables: { + zone: { + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + value: 'defaultZone', + }, + }, + }); + let startBuild = new tasks.CodeBuildStartBuild(this, 'build-task', { + project: project, + environmentVariablesOverride: { + ZONE: { + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + value: sfn.JsonPath.stringAt('$.envVariables.zone'), + }, + }, + }); + const definition = new sfn.Pass(this, 'Start', { + result: sfn.Result.fromObject({ bar: 'SomeValue' }), + }).next(startBuild); + const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, + }); + new cdk.CfnOutput(this, 'ProjectName', { + value: project.projectName, + }); + new cdk.CfnOutput(this, 'StateMachineArn', { + value: stateMachine.stateMachineArn, + }); + } +} +const app = new cdk.App(); +new StartBuildStack(app, 'aws-stepfunctions-tasks-codebuild-start-build-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtYnVpbGQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5zdGFydC1idWlsZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbm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mbi5Kc29uUGF0aC5zdHJpbmdBdCgnJC5lbnZWYXJpYWJsZXMuem9uZScpLFxuICAgICAgICB9LFxuICAgICAgfSxcbiAgICB9KTtcblxuICAgIGNvbnN0IGRlZmluaXRpb24gPSBuZXcgc2ZuLlBhc3ModGhpcywgJ1N0YXJ0Jywge1xuICAgICAgcmVzdWx0OiBzZm4uUmVzdWx0LmZyb21PYmplY3QoeyBiYXI6ICdTb21lVmFsdWUnIH0pLFxuICAgIH0pLm5leHQoc3RhcnRCdWlsZCk7XG5cbiAgICBjb25zdCBzdGF0ZU1hY2hpbmUgPSBuZXcgc2ZuLlN0YXRlTWFjaGluZSh0aGlzLCAnU3RhdGVNYWNoaW5lJywge1xuICAgICAgZGVmaW5pdGlvbixcbiAgICB9KTtcblxuICAgIG5ldyBjZGsuQ2ZuT3V0cHV0KHRoaXMsICdQcm9qZWN0TmFtZScsIHtcbiAgICAgIHZhbHVlOiBwcm9qZWN0LnByb2plY3ROYW1lLFxuICAgIH0pO1xuICAgIG5ldyBjZGsuQ2ZuT3V0cHV0KHRoaXMsICdTdGF0ZU1hY2hpbmVBcm4nLCB7XG4gICAgICB2YWx1ZTogc3RhdGVNYWNoaW5lLnN0YXRlTWFjaGluZUFybixcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IFN0YXJ0QnVpbGRTdGFjayhhcHAsICdhd3Mtc3RlcGZ1bmN0aW9ucy10YXNrcy1jb2RlYnVpbGQtc3RhcnQtYnVpbGQtaW50ZWcnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/aws-stepfunctions-tasks-codebuild-start-build-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/integ.call-aws-service.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.ts similarity index 90% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.ts index bf33a46907833..bb339d9823458 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/codebuild/integ.start-build.ts @@ -1,7 +1,7 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js new file mode 100644 index 0000000000000..e9a1ac73a0193 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const databrew = require("aws-cdk-lib/aws-databrew"); +const iam = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED + */ +class GlueDataBrewJobStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + const region = this.region; + const outputBucket = new s3.Bucket(this, 'JobOutputBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const role = new iam.Role(this, 'DataBrew Role', { + managedPolicies: [{ + managedPolicyArn: 'arn:aws:iam::aws:policy/service-role/AWSGlueDataBrewServiceRole', + }], + path: '/', + assumedBy: new iam.ServicePrincipal('databrew.amazonaws.com'), + inlinePolicies: { + DataBrewPolicy: iam.PolicyDocument.fromJson({ + Statement: [{ + Effect: 'Allow', + Action: [ + 's3:GetObject', + 's3:PutObject', + 's3:DeleteObject', + 's3:ListBucket', + ], + Resource: [ + `arn:aws:s3:::databrew-public-datasets-${region}/*`, + `arn:aws:s3:::databrew-public-datasets-${region}`, + `${outputBucket.bucketArn}/*`, + `${outputBucket.bucketArn}`, + ], + }], + }), + }, + }); + const recipe = new databrew.CfnRecipe(this, 'DataBrew Recipe', { + name: 'recipe-1', + steps: [ + { + action: { + operation: 'UPPER_CASE', + parameters: { + sourceColumn: 'description', + }, + }, + }, + { + action: { + operation: 'DELETE', + parameters: { + sourceColumn: 'doc_id', + }, + }, + }, + ], + }); + const dataset = new databrew.CfnDataset(this, 'DataBrew Dataset', { + input: { + s3InputDefinition: { + bucket: `databrew-public-datasets-${region}`, + key: 'votes.csv', + }, + }, + name: 'dataset-1', + }); + const project = new databrew.CfnProject(this, 'DataBrew Project', { + name: 'project-1', + roleArn: role.roleArn, + datasetName: dataset.name, + recipeName: recipe.name, + }); + project.addDependency(dataset); + project.addDependency(recipe); + const job = new databrew.CfnJob(this, 'DataBrew Job', { + name: 'job-1', + type: 'RECIPE', + projectName: project.name, + roleArn: role.roleArn, + outputs: [{ + location: { + bucket: outputBucket.bucketName, + }, + }], + }); + job.addDependency(project); + const startGlueDataBrewJob = new aws_stepfunctions_tasks_1.GlueDataBrewStartJobRun(this, 'Start DataBrew Job run', { + name: job.name, + }); + const chain = sfn.Chain.start(startGlueDataBrewJob); + const sm = new sfn.StateMachine(this, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), + }); + new cdk.CfnOutput(this, 'stateMachineArn', { + value: sm.stateMachineArn, + }); + } +} +const app = new cdk.App(); +new GlueDataBrewJobStack(app, 'aws-stepfunctions-tasks-databrew-start-job-run-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtam9iLXJ1bi5qcyIsInNvdXJjZVJvb3QiOiIiLC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HtcbiAgICAgICAgRGF0YUJyZXdQb2xpY3k6IGlhbS5Qb2xpY3lEb2N1bWVudC5mcm9tSnNvbih7XG4gICAgICAgICAgU3RhdGVtZW50OiBbe1xuICAgICAgICAgICAgRWZmZWN0OiAnQWxsb3cnLFxuICAgICAgICAgICAgQWN0aW9uOiBbXG4gICAgICAgICAgICAgICdzMzpHZXRPYmplY3QnLFxuICAgICAgICAgICAgICAnczM6UHV0T2JqZWN0JyxcbiAgICAgICAgICAgICAgJ3MzOkRlbGV0ZU9iamVjdCcsXG4gICAgICAgICAgICAgICdzMzpMaXN0QnVja2V0JyxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgICBSZXNvdXJjZTogW1xuICAgICAgICAgICAgICBgYXJuOmF3czpzMzo6OmRhdGFicmV3LXB1YmxpYy1kYXRhc2V0cy0ke3JlZ2lvbn0vKmAsXG4gICAgICAgICAgICAgIGBhcm46YXdzOnMzOjo6ZGF0YWJyZXctcHVibGljLWRhdGFzZXRzLSR7cmVnaW9ufWAsXG4gICAgICAgICAgICAgIGAke291dHB1dEJ1Y2tldC5idWNrZXRBcm59LypgLFxuICAgICAgICAgICAgICBgJHtvdXRwdXRCdWNrZXQuYnVja2V0QXJufWAsXG4gICAgICAgICAgICBdLFxuICAgICAgICAgIH1dLFxuICAgICAgICB9KSxcbiAgICAgIH0sXG4gICAgfSk7XG5cbiAgICBjb25zdCByZWNpcGUgPSBuZXcgZGF0YWJyZXcuQ2ZuUmVjaXBlKHRoaXMsICdEYXRhQnJldyBSZWNpcGUnLCB7XG4gICAgICBuYW1lOiAncmVjaXBlLTEnLFxuICAgICAgc3RlcHM6IFtcbiAgICAgICAge1xuICAgICAgICAgIGFjdGlvbjoge1xuICAgICAgICAgICAgb3BlcmF0aW9uOiAnVVBQRVJfQ0FTRScsXG4gICAgICAgICAgICBwYXJhbWV0ZXJzOiB7XG4gICAgICAgICAgICAgIHNvdXJjZUNvbHVtbjogJ2Rlc2NyaXB0aW9uJyxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgICAge1xuICAgICAgICAgIGFjdGlvbjoge1xuICAgICAgICAgICAgb3BlcmF0aW9uOiAnREVMRVRFJyxcbiAgICAgICAgICAgIHBhcmFtZXRlcnM6IHtcbiAgICAgICAgICAgICAgc291cmNlQ29sdW1uOiAnZG9jX2lkJyxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfSk7XG5cbiAgICBjb25zdCBkYXRhc2V0ID0gbmV3IGRhdGFicmV3LkNmbkRhdGFzZXQodGhpcywgJ0RhdGFCcmV3IERhdGFzZXQnLCB7XG4gICAgICBpbnB1dDoge1xuICAgICAgICBzM0lucHV0RGVmaW5pdGlvbjoge1xuICAgICAgICAgIGJ1Y2tldDogYGRhdGFicmV3LXB1YmxpYy1kYXRhc2V0cy0ke3JlZ2lvbn1gLFxuICAgICAgICAgIGtleTogJ3ZvdGVzLmNzdicsXG4gICAgICAgIH0sXG4gICAgICB9LFxuICAgICAgbmFtZTogJ2RhdGFzZXQtMScsXG4gICAgfSk7XG5cbiAgICBjb25zdCBwcm9qZWN0ID0gbmV3IGRhdGFicmV3LkNmblByb2plY3QodGhpcywgJ0RhdGFCcmV3IFByb2plY3QnLCB7XG4gICAgICBuYW1lOiAncHJvamVjdC0xJyxcbiAgICAgIHJvbGVBcm46IHJvbGUucm9sZUFybixcbiAgICAgIGRhdGFzZXROYW1lOiBkYXRhc2V0Lm5hbWUsXG4gICAgICByZWNpcGVOYW1lOiByZWNpcGUubmFtZSxcbiAgICB9KTtcbiAgICBwcm9qZWN0LmFkZERlcGVuZGVuY3koZGF0YXNldCk7XG4gICAgcHJvamVjdC5hZGREZXBlbmRlbmN5KHJlY2lwZSk7XG5cbiAgICBjb25zdCBqb2IgPSBuZXcgZGF0YWJyZXcuQ2ZuSm9iKHRoaXMsICdEYXRhQnJldyBKb2InLCB7XG4gICAgICBuYW1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end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-databrew-start-job-run-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.ts new file mode 100644 index 0000000000000..4d4634c39ea84 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.ts @@ -0,0 +1,124 @@ +import * as databrew from 'aws-cdk-lib/aws-databrew'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { GlueDataBrewStartJobRun } from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED + */ + +class GlueDataBrewJobStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props: cdk.StackProps = {}) { + super(scope, id, props); + + const region = this.region; + + const outputBucket = new s3.Bucket(this, 'JobOutputBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + + const role = new iam.Role(this, 'DataBrew Role', { + managedPolicies: [{ + managedPolicyArn: 'arn:aws:iam::aws:policy/service-role/AWSGlueDataBrewServiceRole', + }], + path: '/', + assumedBy: new iam.ServicePrincipal('databrew.amazonaws.com'), + inlinePolicies: { + DataBrewPolicy: iam.PolicyDocument.fromJson({ + Statement: [{ + Effect: 'Allow', + Action: [ + 's3:GetObject', + 's3:PutObject', + 's3:DeleteObject', + 's3:ListBucket', + ], + Resource: [ + `arn:aws:s3:::databrew-public-datasets-${region}/*`, + `arn:aws:s3:::databrew-public-datasets-${region}`, + `${outputBucket.bucketArn}/*`, + `${outputBucket.bucketArn}`, + ], + }], + }), + }, + }); + + const recipe = new databrew.CfnRecipe(this, 'DataBrew Recipe', { + name: 'recipe-1', + steps: [ + { + action: { + operation: 'UPPER_CASE', + parameters: { + sourceColumn: 'description', + }, + }, + }, + { + action: { + operation: 'DELETE', + parameters: { + sourceColumn: 'doc_id', + }, + }, + }, + ], + }); + + const dataset = new databrew.CfnDataset(this, 'DataBrew Dataset', { + input: { + s3InputDefinition: { + bucket: `databrew-public-datasets-${region}`, + key: 'votes.csv', + }, + }, + name: 'dataset-1', + }); + + const project = new databrew.CfnProject(this, 'DataBrew Project', { + name: 'project-1', + roleArn: role.roleArn, + datasetName: dataset.name, + recipeName: recipe.name, + }); + project.addDependency(dataset); + project.addDependency(recipe); + + const job = new databrew.CfnJob(this, 'DataBrew Job', { + name: 'job-1', + type: 'RECIPE', + projectName: project.name, + roleArn: role.roleArn, + outputs: [{ + location: { + bucket: outputBucket.bucketName, + }, + }], + }); + job.addDependency(project); + + const startGlueDataBrewJob = new GlueDataBrewStartJobRun(this, 'Start DataBrew Job run', { + name: job.name, + }); + + const chain = sfn.Chain.start(startGlueDataBrewJob); + + const sm = new sfn.StateMachine(this, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), + }); + + new cdk.CfnOutput(this, 'stateMachineArn', { + value: sm.stateMachineArn, + }); + } +} + +const app = new cdk.App(); +new GlueDataBrewJobStack(app, 'aws-stepfunctions-tasks-databrew-start-job-run-integ'); +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js new file mode 100644 index 0000000000000..d21061c2cab54 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ddb = require("aws-cdk-lib/aws-dynamodb"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/** + * + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * + * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED + * * aws stepfunctions describe-execution --execution-arn --query 'output': should return the number 42 + */ +class CallDynamoDBStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + const TABLE_NAME = 'Messages'; + const MESSAGE_ID = '1234'; + const firstNumber = 18; + const secondNumber = 24; + const table = new ddb.Table(this, 'Messages', { + tableName: TABLE_NAME, + partitionKey: { + name: 'MessageId', + type: ddb.AttributeType.STRING, + }, + readCapacity: 10, + writeCapacity: 5, + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const putItemTask = new tasks.DynamoPutItem(this, 'PutItem', { + item: { + MessageId: tasks.DynamoAttributeValue.fromString(MESSAGE_ID), + Text: tasks.DynamoAttributeValue.fromString(sfn.JsonPath.stringAt('$.bar')), + TotalCount: tasks.DynamoAttributeValue.fromNumber(firstNumber), + Activated: tasks.DynamoAttributeValue.booleanFromJsonPath(sfn.JsonPath.stringAt('$.foo')), + List: tasks.DynamoAttributeValue.listFromJsonPath(sfn.JsonPath.stringAt('$.list')), + }, + table, + }); + const getItemTaskAfterPut = new tasks.DynamoGetItem(this, 'GetItemAfterPut', { + key: { MessageId: tasks.DynamoAttributeValue.fromString(MESSAGE_ID) }, + table, + }); + const updateItemTask = new tasks.DynamoUpdateItem(this, 'UpdateItem', { + key: { MessageId: tasks.DynamoAttributeValue.fromString(MESSAGE_ID) }, + table, + expressionAttributeValues: { + ':val': tasks.DynamoAttributeValue.numberFromString(sfn.JsonPath.stringAt('$.Item.TotalCount.N')), + ':rand': tasks.DynamoAttributeValue.fromNumber(secondNumber), + }, + updateExpression: 'SET TotalCount = :val + :rand', + }); + const getItemTaskAfterUpdate = new tasks.DynamoGetItem(this, 'GetItemAfterUpdate', { + key: { MessageId: tasks.DynamoAttributeValue.fromString(MESSAGE_ID) }, + table, + outputPath: sfn.JsonPath.stringAt('$.Item.TotalCount.N'), + }); + const deleteItemTask = new tasks.DynamoDeleteItem(this, 'DeleteItem', { + key: { MessageId: tasks.DynamoAttributeValue.fromString(MESSAGE_ID) }, + table, + resultPath: sfn.JsonPath.DISCARD, + }); + const definition = new sfn.Pass(this, 'Start', { + result: sfn.Result.fromObject({ bar: 'SomeValue' }), + }) + .next(putItemTask) + .next(getItemTaskAfterPut) + .next(updateItemTask) + .next(getItemTaskAfterUpdate) + .next(deleteItemTask); + const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, + }); + new cdk.CfnOutput(this, 'StateMachineArn', { + value: stateMachine.stateMachineArn, + }); + } +} +const app = new cdk.App(); +new CallDynamoDBStack(app, 'aws-stepfunctions-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FsbC1keW5hbW9kYi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNhbGwtZHluYW1vZGIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxnREFBZ0Q7QUFDaEQscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyw2REFBNkQ7QUFFN0Q7Ozs7Ozs7R0FPRztBQUNILE1BQU0saUJBQWtCLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDdkMsWUFBWSxLQUFjLEVBQUUsRUFBVSxFQUFFLFFBQXdCLEVBQUU7UUFDaEUsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxVQUFVLEdBQUcsVUFBVSxDQUFDO1FBQzlCLE1BQU0sVUFBVSxHQUFHLE1BQU0sQ0FBQztRQUMxQixNQUFNLFdBQVcsR0FBRyxFQUFFLENBQUM7UUFDdkIsTUFBTSxZQUFZLEdBQUcsRUFBRSxDQUFDO1FBRXhCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFO1lBQzVDLFNBQVMsRUFBRSxVQUFVO1lBQ3J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2hpbmUnLCB7XG4gICAgICBkZWZpbml0aW9uLFxuICAgIH0pO1xuXG4gICAgbmV3IGNkay5DZm5PdXRwdXQodGhpcywgJ1N0YXRlTWFjaGluZUFybicsIHtcbiAgICAgIHZhbHVlOiBzdGF0ZU1hY2hpbmUuc3RhdGVNYWNoaW5lQXJuLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5uZXcgQ2FsbER5bmFtb0RCU3RhY2soYXBwLCAnYXdzLXN0ZXBmdW5jdGlvbnMtaW50ZWcnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.ts index 18be323c22db3..627dc9b602f77 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.ts @@ -1,7 +1,7 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as ddb from 'aws-cdk-lib/aws-dynamodb'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /** * diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js new file mode 100644 index 0000000000000..47444fe860dfd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ddb = require("aws-cdk-lib/aws-dynamodb"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'stringset-after-parallel'); +const table = new ddb.Table(stack, 'Table', { + partitionKey: { name: 'pk', type: ddb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); +const passPK = new sfn.Pass(stack, 'passPK', { + parameters: { 'pk.$': '$.pk' }, +}); +const passStringSet = new sfn.Pass(stack, 'PassStringSet', { + parameters: { 'stringset.$': '$.stringset' }, +}); +const parallel = new sfn.Parallel(stack, 'Parallel', { + resultPath: '$', +}); +parallel.branch(passPK) + .branch(passStringSet); +const putItem = new tasks.DynamoPutItem(stack, 'PutItem', { + table: table, + item: { + pk: tasks.DynamoAttributeValue.fromString('$[0].pk'), + stringset: tasks.DynamoAttributeValue.fromStringSet(sfn.JsonPath.listAt('$[1].stringset')), + }, +}); +const definition = sfn.Chain.start(parallel).next(putItem); +new sfn.StateMachine(stack, 'StateMachine', { + definition: definition, +}); +new integ.IntegTest(app, 'StringSetAfterParallel', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RyaW5nc2V0LWFmdGVyLXBhcmFsbGVsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3RyaW5nc2V0LWFmdGVyLXBhcmFsbGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsZ0RBQWdEO0FBQ2hELHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELDZEQUE2RDtBQUU3RCxNQUFNLEdBQUcsR0FBRyxJQ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Wx1ZS5mcm9tU3RyaW5nU2V0KHNmbi5Kc29uUGF0aC5saXN0QXQoJyRbMV0uc3RyaW5nc2V0JykpLFxuICB9LFxufSk7XG5cbmNvbnN0IGRlZmluaXRpb24gPSBzZm4uQ2hhaW4uc3RhcnQocGFyYWxsZWwpLm5leHQocHV0SXRlbSk7XG5cbm5ldyBzZm4uU3RhdGVNYWNoaW5lKHN0YWNrLCAnU3RhdGVNYWNoaW5lJywge1xuICBkZWZpbml0aW9uOiBkZWZpbml0aW9uLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnU3RyaW5nU2V0QWZ0ZXJQYXJhbGxlbCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/stringset-after-parallel.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts similarity index 80% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts index d369ef0b6e826..2ea0d2515f8d8 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts @@ -1,8 +1,8 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as tasks from '../../lib'; +import * as ddb from 'aws-cdk-lib/aws-dynamodb'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'stringset-after-parallel'); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js new file mode 100644 index 0000000000000..f23983f659c63 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * * Creates a state machine with a task state to run a job with ECS on EC2 + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-sfn-tasks-ecs-ec2-integ'); +const cluster = new ecs.Cluster(stack, 'Ec2Cluster'); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, +}); +// Build task definition +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +const containerDefinition = taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'eventhandler-image')), + memoryLimitMiB: 256, + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' }), +}); +// Build state machine +const definition = new sfn.Pass(stack, 'Start', { + result: sfn.Result.fromObject({ SomeKey: 'SomeValue' }), +}).next(new tasks.EcsRunTask(stack, 'Run', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + cluster, + taskDefinition, + containerOverrides: [ + { + containerDefinition, + environment: [ + { + name: 'SOME_KEY', + value: sfn.JsonPath.stringAt('$.SomeKey'), + }, + ], + }, + ], + launchTarget: new tasks.EcsEc2LaunchTarget(), +})); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition, +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWMyLXJ1bi10YXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZWMyLXJ1bi10YXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyw2REFBNkQ7QUFFN0Q7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw2QkFBNkIsQ0FBQyxDQUFDO0FBRWhFLE1BQU0sT0FBTyxHQUFHLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFD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pLFxuICAgICAgICAgIH0sXG4gICAgICAgIF0sXG4gICAgICB9LFxuICAgIF0sXG4gICAgbGF1bmNoVGFyZ2V0OiBuZXcgdGFza3MuRWNzRWMyTGF1bmNoVGFyZ2V0KCksXG4gIH0pLFxuKTtcblxuY29uc3Qgc20gPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbixcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/demo-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/demo-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/aws-sfn-tasks-ecs-ec2-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.ts similarity index 88% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.ts index c44d5429bb5b1..4b48c083e9482 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * * Creates a state machine with a task state to run a job with ECS on EC2 diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js new file mode 100644 index 0000000000000..7c9a4688621cb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ2'); +const cluster = new ecs.Cluster(stack, 'FargateCluster'); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, +}); +// Build task definition +const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); +const containerDefinition = taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'eventhandler-image')), + memoryLimitMiB: 256, + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' }), +}); +// Build state machine +const definition = new sfn.Pass(stack, 'Start', { + result: sfn.Result.fromObject({ SomeKey: 'SomeValue' }), +}).next(new sfn.Task(stack, 'Run', { + task: new tasks.RunEcsEc2Task({ + integrationPattern: sfn.ServiceIntegrationPattern.SYNC, + cluster, + taskDefinition, + containerOverrides: [ + { + containerDefinition, + environment: [ + { + name: 'SOME_KEY', + value: sfn.JsonPath.stringAt('$.SomeKey'), + }, + ], + }, + ], + }), +})); +new sfn.StateMachine(stack, 'StateMachine', { + definition, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZWMyLXRhc2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5lYzItdGFzay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZCQUE2QjtBQUM3QiwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsNkRBQTZEO0FBRTdELE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsZ0JBQWdC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FYzJUYXNrKHtcbiAgICAgIGludGVncmF0aW9uUGF0dGVybjogc2ZuLlNlcnZpY2VJbnRlZ3JhdGlvblBhdHRlcm4uU1lOQyxcbiAgICAgIGNsdXN0ZXIsXG4gICAgICB0YXNrRGVmaW5pdGlvbixcbiAgICAgIGNvbnRhaW5lck92ZXJyaWRlczogW1xuICAgICAgICB7XG4gICAgICAgICAgY29udGFpbmVyRGVmaW5pdGlvbixcbiAgICAgICAgICBlbnZpcm9ubWVudDogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBuYW1lOiAnU09NRV9LRVknLFxuICAgICAgICAgICAgICB2YWx1ZTogc2ZuLkpzb25QYXRoLnN0cmluZ0F0KCckLlNvbWVLZXknKSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgXSxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfSksXG4gIH0pLFxuKTtcblxubmV3IHNmbi5TdGF0ZU1hY2hpbmUoc3RhY2ssICdTdGF0ZU1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb24sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/eventhandler-image/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/eventhandler-image/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/aws-ecs-integ2.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.call-dynamodb.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.ts similarity index 84% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.ts index e47524f326c2d..55344d1e9cd2c 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ2'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js new file mode 100644 index 0000000000000..fc6cf5be2d6ff --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to run a job with ECS on Fargate + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-sfn-tasks-ecs-fargate-integ'); +const cluster = new ecs.Cluster(stack, 'FargateCluster'); +// Build task definition +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 512, + cpu: 256, +}); +const containerDefinition = taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'eventhandler-image')), + memoryLimitMiB: 256, + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' }), +}); +// Build state machine +const definition = new sfn.Pass(stack, 'Start', { + result: sfn.Result.fromObject({ SomeKey: 'SomeValue', Timeout: 900 }), +}).next(new tasks.EcsRunTask(stack, 'FargateTask', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + cluster, + taskDefinition, + assignPublicIp: true, + containerOverrides: [ + { + containerDefinition, + environment: [ + { + name: 'SOME_KEY', + value: sfn.JsonPath.stringAt('$.SomeKey'), + }, + ], + }, + ], + launchTarget: new tasks.EcsFargateLaunchTarget({ + platformVersion: ecs.FargatePlatformVersion.VERSION1_4, + }), + taskTimeout: sfn.Timeout.at('$.Timeout'), +})).next(new tasks.EcsRunTask(stack, 'FargeateTaskSetRevisionNumber', { + cluster, + taskDefinition, + revisionNumber: 1, + launchTarget: new tasks.EcsFargateLaunchTarget({ + platformVersion: ecs.FargatePlatformVersion.VERSION1_4, + }), +})); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition, +}); +new cdk.CfnOutput(stack, 'st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AgICB0YXNrVGltZW91dDogc2ZuLlRpbWVvdXQuYXQoJyQuVGltZW91dCcpLFxuICB9KSxcbikubmV4dChcbiAgbmV3IHRhc2tzLkVjc1J1blRhc2soc3RhY2ssICdGYXJnZWF0ZVRhc2tTZXRSZXZpc2lvbk51bWJlcicsIHtcbiAgICBjbHVzdGVyLFxuICAgIHRhc2tEZWZpbml0aW9uLFxuICAgIHJldmlzaW9uTnVtYmVyOiAxLFxuICAgIGxhdW5jaFRhcmdldDogbmV3IHRhc2tzLkVjc0ZhcmdhdGVMYXVuY2hUYXJnZXQoe1xuICAgICAgcGxhdGZvcm1WZXJzaW9uOiBlY3MuRmFyZ2F0ZVBsYXRmb3JtVmVyc2lvbi5WRVJTSU9OMV80LFxuICAgIH0pLFxuICB9KSxcbik7XG5cbmNvbnN0IHNtID0gbmV3IHNmbi5TdGF0ZU1hY2hpbmUoc3RhY2ssICdTdGF0ZU1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb24sXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdzdGF0ZU1hY2hpbmVBcm4nLCB7XG4gIHZhbHVlOiBzbS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/aws-sfn-tasks-ecs-fargate-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.ts index cbee6f54f03c7..ab311f11acf2e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to run a job with ECS on Fargate diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js new file mode 100644 index 0000000000000..388f65e8cb659 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const ecs = require("aws-cdk-lib/aws-ecs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-ecs-integ2'); +const cluster = new ecs.Cluster(stack, 'FargateCluster'); +// Build task definition +const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { + memoryLimitMiB: 512, + cpu: 256, +}); +const containerDefinition = taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, 'eventhandler-image')), + memoryLimitMiB: 256, + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' }), +}); +// Build state machine +const definition = new sfn.Pass(stack, 'Start', { + result: sfn.Result.fromObject({ SomeKey: 'SomeValue' }), +}).next(new sfn.Task(stack, 'FargateTask', { + task: new tasks.RunEcsFargateTask({ + integrationPattern: sfn.ServiceIntegrationPattern.SYNC, + cluster, + taskDefinition, + assignPublicIp: true, + containerOverrides: [ + { + containerDefinition, + environment: [ + { + name: 'SOME_KEY', + value: sfn.JsonPath.stringAt('$.SomeKey'), + }, + ], + }, + ], + }), +})); +new sfn.StateMachine(stack, 'StateMachine', { + definition, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZmFyZ2F0ZS10YXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ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zayh7XG4gICAgICBpbnRlZ3JhdGlvblBhdHRlcm46IHNmbi5TZXJ2aWNlSW50ZWdyYXRpb25QYXR0ZXJuLlNZTkMsXG4gICAgICBjbHVzdGVyLFxuICAgICAgdGFza0RlZmluaXRpb24sXG4gICAgICBhc3NpZ25QdWJsaWNJcDogdHJ1ZSxcbiAgICAgIGNvbnRhaW5lck92ZXJyaWRlczogW1xuICAgICAgICB7XG4gICAgICAgICAgY29udGFpbmVyRGVmaW5pdGlvbixcbiAgICAgICAgICBlbnZpcm9ubWVudDogW1xuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBuYW1lOiAnU09NRV9LRVknLFxuICAgICAgICAgICAgICB2YWx1ZTogc2ZuLkpzb25QYXRoLnN0cmluZ0F0KCckLlNvbWVLZXknKSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgXSxcbiAgICAgICAgfSxcbiAgICAgIF0sXG4gICAgfSksXG4gIH0pLFxuKTtcblxubmV3IHNmbi5TdGF0ZU1hY2hpbmUoc3RhY2ssICdTdGF0ZU1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb24sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/aws-ecs-integ2.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.ts similarity index 86% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.ts index d22f8964c12b1..3e307d86921c8 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-ecs-integ2'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js new file mode 100644 index 0000000000000..9fef9807dfe47 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const eks = require("aws-cdk-lib/aws-eks"); +const iam = require("aws-cdk-lib/aws-iam"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Create a state machine with a task state to use the Kubernetes API to read Kubernetes resource objects + * via a Kubernetes API endpoint. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-eks-call-integ-test'); +const cluster = new eks.Cluster(stack, 'EksCluster', { + version: eks.KubernetesVersion.V1_21, + clusterName: 'eksCluster', +}); +const executionRole = new iam.Role(stack, 'Role', { + roleName: 'stateMachineExecutionRole', + assumedBy: new iam.ServicePrincipal('states.amazonaws.com'), +}); +cluster.awsAuth.addMastersRole(executionRole); +const callJob = new aws_stepfunctions_tasks_1.EksCall(stack, 'Call a EKS Endpoint', { + cluster: cluster, + httpMethod: aws_stepfunctions_tasks_1.HttpMethods.GET, + httpPath: '/api/v1/namespaces/default/pods', +}); +const chain = sfn.Chain.start(callJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + role: executionRole, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new integ.IntegTest(app, 'aws-stepfunctions-tasks-eks-call-integ', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludG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IGludGVnLkludGVnVGVzdChhcHAsICdhd3Mtc3RlcGZ1bmN0aW9ucy10YXNrcy1la3MtY2FsbC1pbnRlZycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxuICBjZGtDb21tYW5kT3B0aW9uczoge1xuICAgIGRlcGxveToge1xuICAgICAgYXJnczoge1xuICAgICAgICByb2xsYmFjazogdHJ1ZSxcbiAgICAgIH0sXG4gICAgfSxcbiAgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..48bb13a42eae0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..7353e9d0afe7a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..d1634967c6e6b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/aws-stepfunctions-tasks-eks-call-integ-test.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegDefaultTestDeployAssert2DF4AD1E.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksClusterResourceProvider412BC189.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksClusterResourceProvider412BC189.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksClusterResourceProvider412BC189.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksClusterResourceProvider412BC189.nested.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksKubectlProvider65D285A0.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksKubectlProvider65D285A0.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksKubectlProvider65D285A0.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/awsstepfunctionstasksekscallintegtestawscdkawseksKubectlProvider65D285A0.nested.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.ts similarity index 84% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.ts index c6973d30351c9..bc6433aa97871 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eks/integ.call.ts @@ -1,9 +1,9 @@ -import * as eks from '@aws-cdk/aws-eks'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { EksCall, HttpMethods } from '../../lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { EksCall, HttpMethods } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Create a state machine with a task state to use the Kubernetes API to read Kubernetes resource objects diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js new file mode 100644 index 0000000000000..972d60cd31364 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-emr-create-cluster'); +new aws_stepfunctions_tasks_1.EmrCreateCluster(stack, 'EmrCreateCluster', { + instances: {}, + name: 'Cluster', + integrationPattern: sfn.IntegrationPattern.RUN_JOB, +}); +new integ_tests_alpha_1.IntegTest(app, 'EmrCreateClusterTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZW1yLWNyZWF0ZS1jbHVzdGVyLXdpdGgtdjEtcG9saWN5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZW1yLWNyZWF0ZS1jbHVzdGVyLXdpdGgtdjEtcG9saWN5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscURBQXFEO0FBQ3JELDZDQUF5QztBQUN6QyxrRUFBdUQ7QUFDdkQsaUZBQXVFO0FBRXZFLE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBRXRCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsNEJBQTRCLENBQUMsQ0FBQztBQUUzRCxJQUFJLDBDQUFnQixDQUFDLEtBQUssRUFBRSxrQkFBa0IsRUFBRTtJQUM5QyxTQUFTLEVBQUUsRUFBRTtJQUNiLElBQUksRUFBRSxTQUFTO0lBQ2Ysa0JBQWtCLEVBQUUsR0FBRyxDQUFDLGtCQUFrQixDQUF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shot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.ts new file mode 100644 index 0000000000000..16ab642ff55b0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.ts @@ -0,0 +1,20 @@ +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { App, Stack } from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { EmrCreateCluster } from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +const app = new App(); + +const stack = new Stack(app, 'aws-cdk-emr-create-cluster'); + +new EmrCreateCluster(stack, 'EmrCreateCluster', { + instances: {}, + name: 'Cluster', + integrationPattern: sfn.IntegrationPattern.RUN_JOB, +}); + +new IntegTest(app, 'EmrCreateClusterTest', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js new file mode 100644 index 0000000000000..4f99d9679d1d1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +// eslint-disable-next-line import/no-extraneous-dependencies +const cx_api_1 = require("aws-cdk-lib/cx-api"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const enableEmrServicePolicyV2 = { [cx_api_1.ENABLE_EMR_SERVICE_POLICY_V2]: true }; +const app = new aws_cdk_lib_1.App({ + context: enableEmrServicePolicyV2, +}); +const stack = new aws_cdk_lib_1.Stack(app, 'aws-cdk-emr-create-cluster'); +new aws_stepfunctions_tasks_1.EmrCreateCluster(stack, 'EmrCreateCluster', { + instances: {}, + name: 'Cluster', + integrationPattern: sfn.IntegrationPattern.RUN_JOB, +}); +new integ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10sXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/EmrCreateClusterTestDefaultTestDeployAssert697DC891.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/aws-cdk-emr-create-cluster.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.ts new file mode 100644 index 0000000000000..71d28820d0066 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.ts @@ -0,0 +1,26 @@ +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { App, Stack } from 'aws-cdk-lib'; +// eslint-disable-next-line import/no-extraneous-dependencies +import { ENABLE_EMR_SERVICE_POLICY_V2 } from 'aws-cdk-lib/cx-api'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { EmrCreateCluster } from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +const enableEmrServicePolicyV2 = { [ENABLE_EMR_SERVICE_POLICY_V2]: true }; + +const app = new App({ + context: enableEmrServicePolicyV2, +}); + +const stack = new Stack(app, 'aws-cdk-emr-create-cluster'); + +new EmrCreateCluster(stack, 'EmrCreateCluster', { + instances: {}, + name: 'Cluster', + integrationPattern: sfn.IntegrationPattern.RUN_JOB, +}); + +new IntegTest(app, 'EmrCreateClusterTest', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js new file mode 100644 index 0000000000000..27afc525b6584 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const eks = require("aws-cdk-lib/aws-eks"); +const iam = require("aws-cdk-lib/aws-iam"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/** + * Stack verification steps: + * Everything in the links below must be setup for the EKS Cluster and Execution Role before running the state machine. + * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-cluster-access.html + * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html + * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-trust-policy.html + * + * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-emr-containers-all-services-test'); +const eksCluster = new eks.Cluster(stack, 'integration-test-eks-cluster', { + version: eks.KubernetesVersion.V1_21, + defaultCapacity: 3, + defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), +}); +const jobExecutionRole = new iam.Role(stack, 'JobExecutionRole', { + assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('emr-containers.amazonaws.com'), new iam.ServicePrincipal('states.amazonaws.com')), +}); +const createVirtualCluster = new aws_stepfunctions_tasks_1.EmrContainersCreateVirtualCluster(stack, 'Create a virtual Cluster', { + virtualClusterName: 'Virtual-Cluster-Name', + eksCluster: aws_stepfunctions_tasks_1.EksClusterInput.fromCluster(eksCluster), + resultPath: '$.cluster', +}); +const startJobRun = new aws_stepfunctions_tasks_1.EmrContainersStartJobRun(stack, 'Start a Job Run', { + virtualCluster: aws_stepfunctions_tasks_1.VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.cluster.Id')), + releaseLabel: aws_stepfunctions_tasks_1.ReleaseLabel.EMR_6_2_0, + jobName: 'EMR-Containers-Job', + executionRole: iam.Role.fromRoleArn(stack, 'Job-Execution-Role', jobExecutionRole.roleArn), + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + entryPointArguments: sfn.TaskInput.fromObject(['2']), + sparkSubmitParameters: '--conf spark.driver.memory=512M --conf spark.kubernetes.driver.request.cores=0.2 --conf spark.kubernetes.executor.request.cores=0.2 --conf spark.sql.shuffle.partitions=60 --conf spark.dynamicAllocation.enabled=false', + }, + }, + monitoring: { + logging: true, + persistentAppUI: true, + }, + applicationConfig: [{ + classification: aws_stepfunctions_tasks_1.Classification.SPARK_DEFAULTS, + properties: { + 'spark.executor.instances': '1', + 'spark.executor.memory': '512M', + }, + }], + resultPath: '$.job', +}); +const deleteVirtualCluster = new aws_stepfunctions_tasks_1.EmrContainersDeleteVirtualCluster(stack, 'Delete a Virtual Cluster', { + virtualClusterId: sfn.TaskInput.fromJsonPathAt('$.job.VirtualClusterId'), +}); +const chain = sfn.Chain + .start(createVirtualCluster) + .next(startJobRun) + .next(deleteVirtualCluster); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.minutes(20), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new integ.IntegTest(app, 'aws-stepfunctions-tasks-emr-containers-all-services', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuam9iLXN1Ym1pc3Npb24td29ya2Zsb3cuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5qb2Itc3VibWlzc2lvbi13b3JrZmxvdy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBQzNDLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsb0RBQW9EO0FBQ3BELGlGQUc2QztBQUU3Qzs7Ozs7Ozs7O0dBU0c7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0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NvblBhdGhBdCgnJC5qb2IuVmlydHVhbENsdXN0ZXJJZCcpLFxufSk7XG5cbmNvbnN0IGNoYWluID0gc2ZuLkNoYWluXG4gIC5zdGFydChjcmVhdGVWaXJ0dWFsQ2x1c3RlcilcbiAgLm5leHQoc3RhcnRKb2JSdW4pXG4gIC5uZXh0KGRlbGV0ZVZpcnR1YWxDbHVzdGVyKTtcblxuY29uc3Qgc20gPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbjogY2hhaW4sXG4gIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5taW51dGVzKDIwKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2F3cy1zdGVwZnVuY3Rpb25zLXRhc2tzLWVtci1jb250YWluZXJzLWFsbC1zZXJ2aWNlcycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxuICBjZGtDb21tYW5kT3B0aW9uczoge1xuICAgIGRlcGxveToge1xuICAgICAgYXJnczoge1xuICAgICAgICByb2xsYmFjazogdHJ1ZSxcbiAgICAgIH0sXG4gICAgfSxcbiAgfSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..48bb13a42eae0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..7353e9d0afe7a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..d1634967c6e6b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/aws-stepfunctions-tasks-emr-containers-all-services-test.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicesDefaultTestDeployAssertE09C88B0.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksClusterResourceProvider6985269B.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksClusterResourceProvider6985269B.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksClusterResourceProvider6985269B.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksClusterResourceProvider6985269B.nested.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksKubectlProviderD9DFA1E3.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksKubectlProviderD9DFA1E3.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksKubectlProviderD9DFA1E3.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/awsstepfunctionstasksemrcontainersallservicestestawscdkawseksKubectlProviderD9DFA1E3.nested.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.ts index c2ccc02634d38..fc5667fafccc9 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.ts @@ -1,13 +1,13 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as eks from '@aws-cdk/aws-eks'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as eks from 'aws-cdk-lib/aws-eks'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Classification, VirtualClusterInput, EksClusterInput, EmrContainersDeleteVirtualCluster, EmrContainersCreateVirtualCluster, EmrContainersStartJobRun, ReleaseLabel, -} from '../../lib'; +} from 'aws-cdk-lib/aws-stepfunctions-tasks'; /** * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js new file mode 100644 index 0000000000000..ca6f3d1b95bba --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js @@ -0,0 +1,98 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const eks = require("aws-cdk-lib/aws-eks"); +const iam = require("aws-cdk-lib/aws-iam"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/** + * Stack verification steps: + * Everything in the link below must be setup before running the state machine. + * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html + * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-emr-containers-start-job-run-test'); +const eksCluster = new eks.Cluster(stack, 'integration-test-eks-cluster', { + version: eks.KubernetesVersion.V1_21, + defaultCapacity: 3, + defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), +}); +const virtualCluster = new cdk.CfnResource(stack, 'Virtual Cluster', { + type: 'AWS::EMRContainers::VirtualCluster', + properties: { + ContainerProvider: { + Id: eksCluster.clusterName, + Info: { + EksInfo: { + Namespace: 'default', + }, + }, + Type: 'EKS', + }, + Name: 'Virtual-Cluster-Name', + }, +}); +const emrRole = eksCluster.addManifest('emrRole', { + apiVersion: 'rbac.authorization.k8s.io/v1', + kind: 'Role', + metadata: { name: 'emr-containers', namespace: 'default' }, + rules: [ + { apiGroups: [''], resources: ['namespaces'], verbs: ['get'] }, + { apiGroups: [''], resources: ['serviceaccounts', 'services', 'configmaps', 'events', 'pods', 'pods/log'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'deletecollection', 'annotate', 'patch', 'label'] }, + { apiGroups: [''], resources: ['secrets'], verbs: ['create', 'patch', 'delete', 'watch'] }, + { apiGroups: ['apps'], resources: ['statefulsets', 'deployments'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, + { apiGroups: ['batch'], resources: ['jobs'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, + { apiGroups: ['extensions'], resources: ['ingresses'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, + { apiGroups: ['rbac.authorization.k8s.io'], resources: ['roles', 'rolebindings'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'deletecollection', 'annotate', 'patch', 'label'] }, + ], +}); +const emrRoleBind = eksCluster.addManifest('emrRoleBind', { + apiVersion: 'rbac.authorization.k8s.io/v1', + kind: 'RoleBinding', + metadata: { name: 'emr-containers', namespace: 'default' }, + subjects: [{ kind: 'User', name: 'emr-containers', apiGroup: 'rbac.authorization.k8s.io' }], + roleRef: { kind: 'Role', name: 'emr-containers', apiGroup: 'rbac.authorization.k8s.io' }, +}); +emrRoleBind.node.addDependency(emrRole); +const emrServiceRole = iam.Role.fromRoleArn(stack, 'emrServiceRole', 'arn:aws:iam::' + aws_cdk_lib_1.Aws.ACCOUNT_ID + ':role/AWSServiceRoleForAmazonEMRContainers'); +const authMapping = { groups: [], username: 'emr-containers' }; +eksCluster.awsAuth.addRoleMapping(emrServiceRole, authMapping); +virtualCluster.node.addDependency(emrRoleBind); +virtualCluster.node.addDependency(eksCluster.awsAuth); +const startJobRunJob = new aws_stepfunctions_tasks_1.EmrContainersStartJobRun(stack, 'Start a Job Run', { + virtualCluster: aws_stepfunctions_tasks_1.VirtualClusterInput.fromVirtualClusterId(virtualCluster.getAtt('Id').toString()), + releaseLabel: aws_stepfunctions_tasks_1.ReleaseLabel.EMR_6_2_0, + jobName: 'EMR-Containers-Job', + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + entryPointArguments: sfn.TaskInput.fromObject(['2']), + sparkSubmitParameters: '--conf spark.driver.memory=512M --conf spark.kubernetes.driver.request.cores=0.2 --conf spark.kubernetes.executor.request.cores=0.2 --conf spark.sql.shuffle.partitions=60 --conf spark.dynamicAllocation.enabled=false', + }, + }, +}); +const chain = sfn.Chain.start(startJobRunJob); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(1000), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new integ.IntegTest(app, 'aws-stepfunctions-tasks-emr-containers-start-job-run', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtam9iLXJ1bi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnN0YXJ0LWpvYi1ydW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMkNBQTJDO0FBRTNDLDJDQUEyQztBQUMzQyxxREFBcUQ7QUFDckQsbUNBQW1DO0FBQ25DLDZDQUFrQztBQUNsQyxvREFBb0Q7QUFDcEQsaUZBQWtIO0FBRWxIOzs7Ozs7R0FNRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMkRBQTJELENBQUMsQ0FBQztBQUU5RixNQUFNLFVBQVUsR0FBRyxJQUFJLEdBQUcsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLDhCQUE4QixFQUFFO0lBQ3hFLE9BQU8sRUFBRSxHQUFHLENBQUMsaUJBQWlCLENBQUMsS0FBSztJQUNwQyxlQUFlLEVBQUUsQ0FBQztJQUNsQix1QkFBdUIsRUFBRSxHQUFHLENBQUMsWUFBWSxDQUFDLEVBQUUsQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDLEVBQUUsRUFBRSxHQUFHLENBQUMsWUFBWSxDQUFDLE1BQU0sQ0FBQztDQUM1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C5jb3Jlcz0wLjIgLS1jb25mIHNwYXJrLmt1YmVybmV0ZXMuZXhlY3V0b3IucmVxdWVzdC5jb3Jlcz0wLjIgLS1jb25mIHNwYXJrLnNxbC5zaHVmZmxlLnBhcnRpdGlvbnM9NjAgLS1jb25mIHNwYXJrLmR5bmFtaWNBbGxvY2F0aW9uLmVuYWJsZWQ9ZmFsc2UnLFxuICAgIH0sXG4gIH0sXG59KTtcblxuY29uc3QgY2hhaW4gPSBzZm4uQ2hhaW4uc3RhcnQoc3RhcnRKb2JSdW5Kb2IpO1xuXG5jb25zdCBzbSA9IG5ldyBzZm4uU3RhdGVNYWNoaW5lKHN0YWNrLCAnU3RhdGVNYWNoaW5lJywge1xuICBkZWZpbml0aW9uOiBjaGFpbixcbiAgdGltZW91dDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMTAwMCksXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdzdGF0ZU1hY2hpbmVBcm4nLCB7XG4gIHZhbHVlOiBzbS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdhd3Mtc3RlcGZ1bmN0aW9ucy10YXNrcy1lbXItY29udGFpbmVycy1zdGFydC1qb2ItcnVuJywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG4gIGNka0NvbW1hbmRPcHRpb25zOiB7XG4gICAgZGVwbG95OiB7XG4gICAgICBhcmdzOiB7XG4gICAgICAgIHJvbGxiYWNrOiB0cnVlLFxuICAgICAgfSxcbiAgICB9LFxuICB9LFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/utils/role-policy/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.3c25783c134c6817b53033bdc57fc404bda6ba93392fcc7d3ca4d92bd072351f/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/utils/role-policy/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.3c25783c134c6817b53033bdc57fc404bda6ba93392fcc7d3ca4d92bd072351f/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts new file mode 100644 index 0000000000000..48bb13a42eae0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts @@ -0,0 +1,344 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts new file mode 100644 index 0000000000000..7353e9d0afe7a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts new file mode 100644 index 0000000000000..d1634967c6e6b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip diff --git a/packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.vpc-endpoint-service-domain-name.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/helm/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/aws-stepfunctions-tasks-emr-containers-start-job-run-test.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobrunDefaultTestDeployAssert0C0D5C7F.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksClusterResourceProvider2391B7F7.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksClusterResourceProvider2391B7F7.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksClusterResourceProvider2391B7F7.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksClusterResourceProvider2391B7F7.nested.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksKubectlProviderEB85BF5A.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksKubectlProviderEB85BF5A.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksKubectlProviderEB85BF5A.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/awsstepfunctionstasksemrcontainersstartjobruntestawscdkawseksKubectlProviderEB85BF5A.nested.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.ts new file mode 100644 index 0000000000000..dfb1c01646e15 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.ts @@ -0,0 +1,111 @@ +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as eks from 'aws-cdk-lib/aws-eks'; +import { AwsAuthMapping } from 'aws-cdk-lib/aws-eks'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { Aws } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { EmrContainersStartJobRun, ReleaseLabel, VirtualClusterInput } from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +/** + * Stack verification steps: + * Everything in the link below must be setup before running the state machine. + * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html + * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED + */ + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-emr-containers-start-job-run-test'); + +const eksCluster = new eks.Cluster(stack, 'integration-test-eks-cluster', { + version: eks.KubernetesVersion.V1_21, + defaultCapacity: 3, + defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), +}); + +const virtualCluster = new cdk.CfnResource(stack, 'Virtual Cluster', { + type: 'AWS::EMRContainers::VirtualCluster', + properties: { + ContainerProvider: { + Id: eksCluster.clusterName, + Info: { + EksInfo: { + Namespace: 'default', + }, + }, + Type: 'EKS', + }, + Name: 'Virtual-Cluster-Name', + }, +}); + +const emrRole = eksCluster.addManifest('emrRole', { + apiVersion: 'rbac.authorization.k8s.io/v1', + kind: 'Role', + metadata: { name: 'emr-containers', namespace: 'default' }, + rules: [ + { apiGroups: [''], resources: ['namespaces'], verbs: ['get'] }, + { apiGroups: [''], resources: ['serviceaccounts', 'services', 'configmaps', 'events', 'pods', 'pods/log'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'deletecollection', 'annotate', 'patch', 'label'] }, + { apiGroups: [''], resources: ['secrets'], verbs: ['create', 'patch', 'delete', 'watch'] }, + { apiGroups: ['apps'], resources: ['statefulsets', 'deployments'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, + { apiGroups: ['batch'], resources: ['jobs'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, + { apiGroups: ['extensions'], resources: ['ingresses'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, + { apiGroups: ['rbac.authorization.k8s.io'], resources: ['roles', 'rolebindings'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'deletecollection', 'annotate', 'patch', 'label'] }, + ], +}); + +const emrRoleBind = eksCluster.addManifest('emrRoleBind', { + apiVersion: 'rbac.authorization.k8s.io/v1', + kind: 'RoleBinding', + metadata: { name: 'emr-containers', namespace: 'default' }, + subjects: [{ kind: 'User', name: 'emr-containers', apiGroup: 'rbac.authorization.k8s.io' }], + roleRef: { kind: 'Role', name: 'emr-containers', apiGroup: 'rbac.authorization.k8s.io' }, +}); + +emrRoleBind.node.addDependency(emrRole); + +const emrServiceRole = iam.Role.fromRoleArn(stack, 'emrServiceRole', 'arn:aws:iam::'+Aws.ACCOUNT_ID+':role/AWSServiceRoleForAmazonEMRContainers'); +const authMapping: AwsAuthMapping = { groups: [], username: 'emr-containers' }; +eksCluster.awsAuth.addRoleMapping(emrServiceRole, authMapping); + +virtualCluster.node.addDependency(emrRoleBind); +virtualCluster.node.addDependency(eksCluster.awsAuth); + +const startJobRunJob = new EmrContainersStartJobRun(stack, 'Start a Job Run', { + virtualCluster: VirtualClusterInput.fromVirtualClusterId(virtualCluster.getAtt('Id').toString()), + releaseLabel: ReleaseLabel.EMR_6_2_0, + jobName: 'EMR-Containers-Job', + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + entryPointArguments: sfn.TaskInput.fromObject(['2']), + sparkSubmitParameters: '--conf spark.driver.memory=512M --conf spark.kubernetes.driver.request.cores=0.2 --conf spark.kubernetes.executor.request.cores=0.2 --conf spark.sql.shuffle.partitions=60 --conf spark.dynamicAllocation.enabled=false', + }, + }, +}); + +const chain = sfn.Chain.start(startJobRunJob); + +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(1000), +}); + +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); + +new integ.IntegTest(app, 'aws-stepfunctions-tasks-emr-containers-start-job-run', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js new file mode 100644 index 0000000000000..608dbcefce865 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events = require("aws-cdk-lib/aws-events"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps : + * * aws stepfunctions start-execution --state-machine-arn : should return execution arn + * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-eventbridge-put-events-integ'); +const eventBus = new events.EventBus(stack, 'EventBus', { + eventBusName: 'MyEventBus1', +}); +const putEventsTask = new aws_stepfunctions_tasks_1.EventBridgePutEvents(stack, 'Put Custom Events', { + entries: [{ + // Entry with no event bus specified + detail: sfn.TaskInput.fromObject({ + Message: 'Hello from Step Functions!', + }), + detailType: 'MessageFromStepFunctions', + source: 'step.functions', + }, { + // Entry with EventBus provided as object + detail: sfn.TaskInput.fromObject({ + Message: 'Hello from Step Functions!', + }), + eventBus, + detailType: 'MessageFromStepFunctions', + source: 'step.functions', + }], +}); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: putEventsTask, + timeout: cdk.Duration.seconds(30), +}); +const testCase = new integ_tests_alpha_1.IntegTest(app, 'PutEvents', { + testCases: [stack], +}); +// Start an execution +const start = testCase.assertions.awsApiCall('StepFunctions', 'startExecution', { + stateMachineArn: sm.stateMachineArn, +}); +// describe the results of the execution +const describe = testCase.assertions.awsApiCall('StepFunctions', 'describeExecution', { + executionArn: start.getAttString('executionArn'), +}); +// assert the results +describe.expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + status: 'SUCCEEDED', +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHV0LWV2ZW50cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnB1dC1ldmVudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBaUQ7QUFDakQscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyxrRUFBdUU7QUFDdkUsaUZBQTJFO0FBRTNFOzs7O0dBSUc7QUFDSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHNEQUFzRCxDQUFDLENBQUM7QUFFekYsTUFBTSxRQUFRLEdBQUcsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRSxVQUFVLEVBQUU7SUFDdEQsWUFBWSxFQUFFLGFBQWE7Q0FDNUIsQ0FBQyxDQUFDO0FBRUgsTUFBTSxhQUFhLEdBQUcsSUFBSSw4Q0FBb0IsQ0FBQyxLQUFLLEVBQUUsbUJBQW1CLEVBQUU7SUFDekUsT0FBTyxFQUFFLENBQUM7WUFDUixvQ0FBb0M7WUFDcEMsTUFBTSxFQUFFLEdBQUcsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDO2dCQUMvQixPQUFPLEVBQUUsNEJBQTRCO2FBQ3RDLENBQUM7WUFDRixVQUFVLEVBQUUsMEJBQ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uLnNlY29uZHMoMzApLFxufSk7XG5cblxuY29uc3QgdGVzdENhc2UgPSBuZXcgSW50ZWdUZXN0KGFwcCwgJ1B1dEV2ZW50cycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbi8vIFN0YXJ0IGFuIGV4ZWN1dGlvblxuY29uc3Qgc3RhcnQgPSB0ZXN0Q2FzZS5hc3NlcnRpb25zLmF3c0FwaUNhbGwoJ1N0ZXBGdW5jdGlvbnMnLCAnc3RhcnRFeGVjdXRpb24nLCB7XG4gIHN0YXRlTWFjaGluZUFybjogc20uc3RhdGVNYWNoaW5lQXJuLFxufSk7XG5cbi8vIGRlc2NyaWJlIHRoZSByZXN1bHRzIG9mIHRoZSBleGVjdXRpb25cbmNvbnN0IGRlc2NyaWJlID0gdGVzdENhc2UuYXNzZXJ0aW9ucy5hd3NBcGlDYWxsKCdTdGVwRnVuY3Rpb25zJywgJ2Rlc2NyaWJlRXhlY3V0aW9uJywge1xuICBleGVjdXRpb25Bcm46IHN0YXJ0LmdldEF0dFN0cmluZygnZXhlY3V0aW9uQXJuJyksXG59KTtcblxuLy8gYXNzZXJ0IHRoZSByZXN1bHRzXG5kZXNjcmliZS5leHBlY3QoRXhwZWN0ZWRSZXN1bHQub2JqZWN0TGlrZSh7XG4gIHN0YXR1czogJ1NVQ0NFRURFRCcsXG59KSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/PutEventsDefaultTestDeployAssert1A6BA3F3.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/aws-stepfunctions-tasks-eventbridge-put-events-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts similarity index 85% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts index d72ecfb494415..7f090e487d074 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.ts @@ -1,8 +1,8 @@ -import * as events from '@aws-cdk/aws-events'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import { EventBridgePutEvents } from '../../lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import { EventBridgePutEvents } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps : diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js new file mode 100644 index 0000000000000..ce41f4d8b3c60 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const glue = require("aws-cdk-lib/aws-glue"); +const iam = require("aws-cdk-lib/aws-iam"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * The "describe-execution" call should eventually return status "SUCCEEDED". + * NOTE: It will take up to 15 minutes for the step function to completem due to the cold start time + * for AWS Glue, which as of 02/2020, is around 10-15 minutes. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); +const codeAsset = new assets.Asset(stack, 'Glue Job Script', { + path: path.join(__dirname, 'my-glue-script/job.py'), +}); +const jobRole = new iam.Role(stack, 'Glue Job Role', { + assumedBy: new iam.ServicePrincipal('glue'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSGlueServiceRole'), + ], +}); +codeAsset.grantRead(jobRole); +const job = new glue.CfnJob(stack, 'Glue Job', { + name: 'My Glue Job', + glueVersion: '1.0', + command: { + name: 'glueetl', + pythonVersion: '3', + scriptLocation: `s3://${codeAsset.s3BucketName}/${codeAsset.s3ObjectKey}`, + }, + role: jobRole.roleArn, +}); +const jobTask = new sfn.Task(stack, 'Glue Job Task', { + task: new tasks.RunGlueJobTask(job.name, { + integrationPattern: sfn.ServiceIntegrationPattern.SYNC, + arguments: { + '--enable-metrics': 'true', + }, + }), +}); +const startTask = new sfn.Pass(stack, 'Start Task'); +const endTask = new sfn.Pass(stack, 'End Task'); +const stateMachine = new sfn.StateMachine(stack, 'State Machine', { + definition: sfn.Chain.start(startTask).next(jobTask).next(endTask), +}); +new cdk.CfnOutput(stack, 'State Machine ARN Output', { + value: stateMachine.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZ2x1ZS10YXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuZ2x1ZS10YXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLDZDQUE2QztBQUM3QywyQ0FBMkM7QUFDM0Msb0RBQW9EO0FBQ3BELHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsNkRBQTZEO0FBRTdEOzs7Ozs7O0dBT0c7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLHlCQUF5QixDQUFDLENBQUM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sXG4gIH0pLFxufSk7XG5cbmNvbnN0IHN0YXJ0VGFzayA9IG5ldyBzZm4uUGFzcyhzdGFjaywgJ1N0YXJ0IFRhc2snKTtcbmNvbnN0IGVuZFRhc2sgPSBuZXcgc2ZuLlBhc3Moc3RhY2ssICdFbmQgVGFzaycpO1xuXG5jb25zdCBzdGF0ZU1hY2hpbmUgPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlIE1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb246IHNmbi5DaGFpbi5zdGFydChzdGFydFRhc2spLm5leHQoam9iVGFzaykubmV4dChlbmRUYXNrKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1N0YXRlIE1hY2hpbmUgQVJOIE91dHB1dCcsIHtcbiAgdmFsdWU6IHN0YXRlTWFjaGluZS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.ts similarity index 85% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.ts index 5f24555aeb029..b9761a986d8bb 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.glue-task.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as glue from '@aws-cdk/aws-glue'; -import * as iam from '@aws-cdk/aws-iam'; -import * as assets from '@aws-cdk/aws-s3-assets'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as glue from 'aws-cdk-lib/aws-glue'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js new file mode 100644 index 0000000000000..ff50fd8997413 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const glue = require("aws-cdk-lib/aws-glue"); +const iam = require("aws-cdk-lib/aws-iam"); +const assets = require("aws-cdk-lib/aws-s3-assets"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * The "describe-execution" call should eventually return status "SUCCEEDED". + * NOTE: It will take up to 15 minutes for the step function to complete due to the cold start time + * for AWS Glue, which as of 02/2020, is around 10-15 minutes. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); +const codeAsset = new assets.Asset(stack, 'Glue Job Script', { + path: path.join(__dirname, 'my-glue-script/job.py'), +}); +const jobRole = new iam.Role(stack, 'Glue Job Role', { + assumedBy: new iam.ServicePrincipal('glue'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSGlueServiceRole'), + ], +}); +codeAsset.grantRead(jobRole); +const job = new glue.CfnJob(stack, 'Glue Job', { + name: 'My Glue Job', + glueVersion: '1.0', + command: { + name: 'glueetl', + pythonVersion: '3', + scriptLocation: `s3://${codeAsset.s3BucketName}/${codeAsset.s3ObjectKey}`, + }, + role: jobRole.roleArn, +}); +const jobTask = new aws_stepfunctions_tasks_1.GlueStartJobRun(stack, 'Glue Job Task', { + glueJobName: job.name, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + arguments: sfn.TaskInput.fromObject({ + '--enable-metrics': 'true', + }), +}); +const startTask = new sfn.Pass(stack, 'Start Task'); +const endTask = new sfn.Pass(stack, 'End Task'); +const stateMachine = new sfn.StateMachine(stack, 'State Machine', { + definition: sfn.Chain.start(startTask).next(jobTask).next(endTask), +}); +new cdk.CfnOutput(stack, 'State Machine ARN Output', { + value: stateMachine.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtam9iLXJ1bi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnN0YXJ0LWpvYi1ydW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsNkNBQTZDO0FBQzdDLDJDQUEyQztBQUMzQyxvREFBb0Q7QUFDcEQscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyxpRkFBc0U7QUFFdEU7Ozs7Ozs7R0FPRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUseUJBQXlCLENBQUMsQ0FBQztBQUU1RCxNQUFNLF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ldyBzZm4uUGFzcyhzdGFjaywgJ1N0YXJ0IFRhc2snKTtcbmNvbnN0IGVuZFRhc2sgPSBuZXcgc2ZuLlBhc3Moc3RhY2ssICdFbmQgVGFzaycpO1xuXG5jb25zdCBzdGF0ZU1hY2hpbmUgPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlIE1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb246IHNmbi5DaGFpbi5zdGFydChzdGFydFRhc2spLm5leHQoam9iVGFzaykubmV4dChlbmRUYXNrKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1N0YXRlIE1hY2hpbmUgQVJOIE91dHB1dCcsIHtcbiAgdmFsdWU6IHN0YXRlTWFjaGluZS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/asset.d030bb7913ca422df69f29b2ea678ab4e5085bb3cbb17029e4b101d2dc4e3e0d.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.ts new file mode 100644 index 0000000000000..8b04350e49643 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/integ.start-job-run.ts @@ -0,0 +1,63 @@ +import * as path from 'path'; +import * as glue from 'aws-cdk-lib/aws-glue'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { GlueStartJobRun } from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +/* + * Stack verification steps: + * * aws stepfunctions start-execution --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * The "describe-execution" call should eventually return status "SUCCEEDED". + * NOTE: It will take up to 15 minutes for the step function to complete due to the cold start time + * for AWS Glue, which as of 02/2020, is around 10-15 minutes. + */ + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); + +const codeAsset = new assets.Asset(stack, 'Glue Job Script', { + path: path.join(__dirname, 'my-glue-script/job.py'), +}); + +const jobRole = new iam.Role(stack, 'Glue Job Role', { + assumedBy: new iam.ServicePrincipal('glue'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSGlueServiceRole'), + ], +}); +codeAsset.grantRead(jobRole); + +const job = new glue.CfnJob(stack, 'Glue Job', { + name: 'My Glue Job', + glueVersion: '1.0', + command: { + name: 'glueetl', + pythonVersion: '3', + scriptLocation: `s3://${codeAsset.s3BucketName}/${codeAsset.s3ObjectKey}`, + }, + role: jobRole.roleArn, +}); + +const jobTask = new GlueStartJobRun(stack, 'Glue Job Task', { + glueJobName: job.name!, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + arguments: sfn.TaskInput.fromObject({ + '--enable-metrics': 'true', + }), +}); + +const startTask = new sfn.Pass(stack, 'Start Task'); +const endTask = new sfn.Pass(stack, 'End Task'); + +const stateMachine = new sfn.StateMachine(stack, 'State Machine', { + definition: sfn.Chain.start(startTask).next(jobTask).next(endTask), +}); + +new cdk.CfnOutput(stack, 'State Machine ARN Output', { + value: stateMachine.stateMachineArn, +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js new file mode 100644 index 0000000000000..573a0d2727f04 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --input '{"a": 3, "b": 4}' --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * * The output here should contain `status: "SUCCEEDED"` and `output: "{ a: 3, b: 4, c: 7, d: 14, now: }" + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); +const sum = new tasks.EvaluateExpression(stack, 'Sum', { + expression: '$.a + $.b', + resultPath: '$.c', +}); +const multiply = new tasks.EvaluateExpression(stack, 'Multiply', { + expression: '$.c * 2', + resultPath: '$.d', +}); +const now = new tasks.EvaluateExpression(stack, 'Now', { + expression: '(new Date()).toUTCString()', + resultPath: '$.now', +}); +const statemachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: sum + .next(multiply) + .next(new sfn.Wait(stack, 'Wait', { + time: sfn.WaitTime.secondsPath('$.d'), + })) + .next(now), +}); +new cdk.CfnOutput(stack, 'StateMachineARN', { + value: statemachine.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuZXZhbHVhdGUtZXhwcmVzc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmV2YWx1YXRlLWV4cHJlc3Npb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5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BmdW5jdGlvbnMtaW50ZWcnKTtcblxuY29uc3Qgc3VtID0gbmV3IHRhc2tzLkV2YWx1YXRlRXhwcmVzc2lvbihzdGFjaywgJ1N1bScsIHtcbiAgZXhwcmVzc2lvbjogJyQuYSArICQuYicsXG4gIHJlc3VsdFBhdGg6ICckLmMnLFxufSk7XG5cbmNvbnN0IG11bHRpcGx5ID0gbmV3IHRhc2tzLkV2YWx1YXRlRXhwcmVzc2lvbihzdGFjaywgJ011bHRpcGx5Jywge1xuICBleHByZXNzaW9uOiAnJC5jICogMicsXG4gIHJlc3VsdFBhdGg6ICckLmQnLFxufSk7XG5cbmNvbnN0IG5vdyA9IG5ldyB0YXNrcy5FdmFsdWF0ZUV4cHJlc3Npb24oc3RhY2ssICdOb3cnLCB7XG4gIGV4cHJlc3Npb246ICcobmV3IERhdGUoKSkudG9VVENTdHJpbmcoKScsXG4gIHJlc3VsdFBhdGg6ICckLm5vdycsXG59KTtcblxuY29uc3Qgc3RhdGVtYWNoaW5lID0gbmV3IHNmbi5TdGF0ZU1hY2hpbmUoc3RhY2ssICdTdGF0ZU1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb246IHN1bVxuICAgIC5uZXh0KG11bHRpcGx5KVxuICAgIC5uZXh0KFxuICAgICAgbmV3IHNmbi5XYWl0KHN0YWNrLCAnV2FpdCcsIHtcbiAgICAgICAgdGltZTogc2ZuLldhaXRUaW1lLnNlY29uZHNQYXRoKCckLmQnKSxcbiAgICAgIH0pLFxuICAgIClcbiAgICAubmV4dChub3cpLFxufSk7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnU3RhdGVNYWNoaW5lQVJOJywge1xuICB2YWx1ZTogc3RhdGVtYWNoaW5lLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/asset.4a61519d8f4df8206cfaff4e519462aa81beab9213c3642a1353cd679c697638/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/asset.4a61519d8f4df8206cfaff4e519462aa81beab9213c3642a1353cd679c697638/index.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/asset.4a61519d8f4df8206cfaff4e519462aa81beab9213c3642a1353cd679c697638/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/asset.4a61519d8f4df8206cfaff4e519462aa81beab9213c3642a1353cd679c697638/index.js diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/integ.put-events.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts similarity index 88% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts index 8034635352b32..28160fdcff4b9 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js new file mode 100644 index 0000000000000..070971f230a1c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +class JobPollerStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + const submitJobActivity = new sfn.Activity(this, 'SubmitJob'); + const checkJobActivity = new sfn.Activity(this, 'CheckJob'); + const submitJob = new sfn.Task(this, 'Submit Job', { + task: new tasks.InvokeActivity(submitJobActivity), + resultPath: '$.guid', + }); + const waitX = new sfn.Wait(this, 'Wait X Seconds', { time: sfn.WaitTime.secondsPath('$.wait_time') }); + const getStatus = new sfn.Task(this, 'Get Job Status', { + task: new tasks.InvokeActivity(checkJobActivity), + inputPath: '$.guid', + resultPath: '$.status', + }); + const isComplete = new sfn.Choice(this, 'Job Complete?'); + const jobFailed = new sfn.Fail(this, 'Job Failed', { + cause: 'AWS Batch Job Failed', + error: 'DescribeJob returned FAILED', + }); + const finalStatus = new sfn.Task(this, 'Get Final Job Status', { + task: new tasks.InvokeActivity(checkJobActivity), + inputPath: '$.guid', + }); + const chain = sfn.Chain + .start(submitJob) + .next(waitX) + .next(getStatus) + .next(isComplete + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus) + .otherwise(waitX)); + new sfn.StateMachine(this, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), + }); + } +} +const app = new cdk.App(); +new JobPollerStack(app, 'aws-stepfunctions-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuam9iLXBvbGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmpvYi1wb2xsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxREFBcUQ7QUFDckQsbUNBQW1DO0FBQ25DLDZEQUE2RDtBQUU3RCxNQUFNLGNBQWUsU0FBUSxHQUFHLENBQUMsS0FBSztJQUNwQyxZQUFZLEtBQWMsRUFBRSxFQUFVLEVBQUUsUUFBd0IsRUFBRTtRQUNoRSxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV4QixNQUFNLGlCQUFpQixHQUFHLElBQUksR0FBRyxDQUFDLFFBQVEsQ0FBQyxJQUFJLEVBQUUsV0FBVyxDQUFDLENBQUM7UU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jZGsuRHVyYXRpb24uc2Vjb25kcygzMCksXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IGNkay5BcHAoKTtcbm5ldyBKb2JQb2xsZXJTdGFjayhhcHAsICdhd3Mtc3RlcGZ1bmN0aW9ucy1pbnRlZycpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.glue-task.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.ts index f713051af6632..2c68bf79576e9 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.job-poller.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; class JobPollerStack extends cdk.Stack { constructor(scope: cdk.App, id: string, props: cdk.StackProps = {}) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js new file mode 100644 index 0000000000000..5ec2809985155 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --input '{"hello": "world"}' --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * * The output here should contain `status: "SUCCEEDED"` and `output:"{...\"Output\":\"{\\\"hello\\\":\\\"world\\\"}\"...}"` + */ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const child = new sfn.StateMachine(this, 'Child', { + definition: new sfn.Pass(this, 'Pass'), + }); + const parent = new sfn.StateMachine(this, 'Parent', { + definition: new sfn.Task(this, 'Task', { + task: new tasks.StartExecution(child, { + input: { + hello: sfn.JsonPath.stringAt('$.hello'), + }, + integrationPattern: sfn.ServiceIntegrationPattern.SYNC, + }), + }), + }); + new aws_cdk_lib_1.CfnOutput(this, 'StateMachineARN', { + value: parent.stateMachineArn, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'integ-sfn-start-execution'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtZXhlY3V0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3RhcnQtZXhlY3V0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscURBQXFEO0FBQ3JELDZDQUFvRDtBQUVwRCw2REFBNkQ7QUFFN0Q7Ozs7O0dBS0c7QUFFSCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVTtRQUN0QyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLFlBQVksQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFO1lBQ2hELFVBQVUsRUFBRSxJQUFJLEdBQUcsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQztTQUN2QyxDQUFDLENBQUM7UUFFSCxNQUFNLE1BQU0sR0FBRyxJQUFJLEdBQUcsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRTtZQUNsRCxVQUFVLEVBQUUsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxNQUFNLEVBQUU7Z0JBQ3JDLElBQUksRUFBRSxJQUFJLEtBQUssQ0FBQyxjQUFjLENBQUMsS0FBSyxFQUFFO29CQUNwQyxLQUFLLEVBQUU7d0JBQ0wsS0FBSyxFQUFFLEdBQUcsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQ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pO1xuXG5uZXcgVGVzdFN0YWNrKGFwcCwgJ2ludGVnLXNmbi1zdGFydC1leGVjdXRpb24nKTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.ts new file mode 100644 index 0000000000000..f0dff61b97940 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.start-execution.ts @@ -0,0 +1,42 @@ +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +/* + * Stack verification steps: + * * aws stepfunctions start-execution --input '{"hello": "world"}' --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * * The output here should contain `status: "SUCCEEDED"` and `output:"{...\"Output\":\"{\\\"hello\\\":\\\"world\\\"}\"...}"` + */ + +class TestStack extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const child = new sfn.StateMachine(this, 'Child', { + definition: new sfn.Pass(this, 'Pass'), + }); + + const parent = new sfn.StateMachine(this, 'Parent', { + definition: new sfn.Task(this, 'Task', { + task: new tasks.StartExecution(child, { + input: { + hello: sfn.JsonPath.stringAt('$.hello'), + }, + integrationPattern: sfn.ServiceIntegrationPattern.SYNC, + }), + }), + }); + + new CfnOutput(this, 'StateMachineARN', { + value: parent.stateMachineArn, + }); + } +} + +const app = new App(); + +new TestStack(app, 'integ-sfn-start-execution'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js new file mode 100644 index 0000000000000..9fd15889e6eb2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); +const handler = new aws_lambda_1.Function(stack, 'Handler', { + code: aws_lambda_1.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.main', + runtime: aws_lambda_1.Runtime.PYTHON_3_9, +}); +const submitJob = new sfn.Task(stack, 'Invoke Handler', { + task: new tasks.InvokeFunction(handler), +}); +const callbackHandler = new aws_lambda_1.Function(stack, 'CallbackHandler', { + code: aws_lambda_1.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.main', + runtime: aws_lambda_1.Runtime.PYTHON_3_9, +}); +const taskTokenHandler = new sfn.Task(stack, 'Invoke Handler with task token', { + task: new tasks.RunLambdaTask(callbackHandler, { + integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, + payload: sfn.TaskInput.fromObject({ + token: sfn.JsonPath.taskToken, + }), + }), + inputPath: '$.guid', + resultPath: '$.status', +}); +const isComplete = new sfn.Choice(stack, 'Job Complete?'); +const jobFailed = new sfn.Fail(stack, 'Job Failed', { + cause: 'AWS Batch Job Failed', + error: 'DescribeJob returned FAILED', +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain + .start(submitJob) + .next(taskTokenHandler) + .next(isComplete + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus)); +new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW52b2tlLWZ1bmN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW52b2tlLWZ1bmN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLHVEQUFpRTtBQUNqRSxxREFBcUQ7QUFDckQsbUNBQW1DO0FBQ25DLDZEQUE2RDtBQUU3RCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixN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VibWl0Sm9iKVxuICAubmV4dCh0YXNrVG9rZW5IYW5kbGVyKVxuICAubmV4dChpc0NvbXBsZXRlXG4gICAgLndoZW4oc2ZuLkNvbmRpdGlvbi5zdHJpbmdFcXVhbHMoJyQuc3RhdHVzJywgJ0ZBSUxFRCcpLCBqb2JGYWlsZWQpXG4gICAgLndoZW4oc2ZuLkNvbmRpdGlvbi5zdHJpbmdFcXVhbHMoJyQuc3RhdHVzJywgJ1NVQ0NFRURFRCcpLCBmaW5hbFN0YXR1cyksXG4gICk7XG5cbm5ldyBzZm4uU3RhdGVNYWNoaW5lKHN0YWNrLCAnU3RhdGVNYWNoaW5lJywge1xuICBkZWZpbml0aW9uOiBjaGFpbixcbiAgdGltZW91dDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMzApLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/my-lambda-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/my-lambda-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.evaluate-expression.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.ts similarity index 87% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.ts index 747a23d93587f..bc0a13cc8c381 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js new file mode 100644 index 0000000000000..1782416dc6aa5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to invoke a Lambda function + * The state machine creates a couple of Lambdas that pass results forward + * and into a Choice state that validates the output. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-lambda-invoke-integ'); +const submitJobLambda = new aws_lambda_1.Function(stack, 'submitJobLambda', { + code: aws_lambda_1.Code.fromInline(`exports.handler = async () => { + return { + statusCode: '200', + body: 'hello, world!' + }; + };`), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); +const submitJob = new aws_stepfunctions_tasks_1.LambdaInvoke(stack, 'Invoke Handler', { + lambdaFunction: submitJobLambda, + outputPath: '$.Payload', +}); +const checkJobStateLambda = new aws_lambda_1.Function(stack, 'checkJobStateLambda', { + code: aws_lambda_1.Code.fromInline(`exports.handler = async function(event, context) { + return { + status: event.statusCode === '200' ? 'SUCCEEDED' : 'FAILED' + }; + };`), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); +const checkJobState = new aws_stepfunctions_tasks_1.LambdaInvoke(stack, 'Check the job state', { + lambdaFunction: checkJobStateLambda, + resultSelector: { + status: sfn.JsonPath.stringAt('$.Payload.status'), + }, +}); +const isComplete = new sfn.Choice(stack, 'Job Complete?'); +const jobFailed = new sfn.Fail(stack, 'Job Failed', { + cause: 'Job Failed', + error: 'Received a status that was not 200', +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain.start(submitJob) + .next(checkJobState) + .next(isComplete + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus)); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW52b2tlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW52b2tlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsdURBQWlFO0FBQ2pFLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsaUZBQW1FO0FBRW5FOzs7Ozs7Ozs7OztHQVdHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSw2Q0FBNkMsQ0FBQyxDQUFDO0FBRWhGLE1BQU0sZUFBZSxHQUFHLElBQUkscUJBQVEsQ0FBQyxLQUFLLEVBQUUsaUJBQWlCLEVBQUU7S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GNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.job-poller.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js new file mode 100644 index 0000000000000..63f78644755f4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to invoke a Lambda function + * The state machine creates a couple of Lambdas that pass results forward + * and into a Choice state that validates the output. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-lambda-invoke-integ'); +const submitJobLambda = new aws_lambda_1.Function(stack, 'submitJobLambda', { + code: aws_lambda_1.Code.fromInline(`exports.handler = async () => { + return { + statusCode: '200', + body: 'hello, world!' + }; + };`), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); +const submitJob = new aws_stepfunctions_tasks_1.LambdaInvoke(stack, 'Invoke Handler', { + lambdaFunction: submitJobLambda, + payloadResponseOnly: true, +}); +const checkJobStateLambda = new aws_lambda_1.Function(stack, 'checkJobStateLambda', { + code: aws_lambda_1.Code.fromInline(`exports.handler = async function(event, context) { + return { + status: event.statusCode === '200' ? 'SUCCEEDED' : 'FAILED' + }; + };`), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); +const checkJobState = new aws_stepfunctions_tasks_1.LambdaInvoke(stack, 'Check the job state', { + lambdaFunction: checkJobStateLambda, + payloadResponseOnly: true, +}); +const isComplete = new sfn.Choice(stack, 'Job Complete?'); +const jobFailed = new sfn.Fail(stack, 'Job Failed', { + cause: 'Job Failed', + error: 'Received a status that was not 200', +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain.start(submitJob) + .next(checkJobState) + .next(isComplete + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus)); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW52b2tlLnBheWxvYWQub25seS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmludm9rZS5wYXlsb2FkLm9ubHkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBaUU7QUFDakUscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyxpRkFBbUU7QUFFbkU7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLDZDQUE2QyxDQUFDLENBQUM7QUFFaEYsTUFBTSxlQUFlLEdBQUcsSUFBSSxxQkFBUSxDQUFDLEtBQUssRUFBRSxpQkFBaUIsRUFBRTtJQUM3RCxJQUFJLEVBQUUsaUJBQUksQ0FBQyxVQUFVLENBQUM7Ozs7O1NBS2YsQ0FBQztJQUNSLE9BQU8sRUFB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functions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/aws-stepfunctions-tasks-lambda-invoke-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.ts index 88bd3830df602..326dce19cd1d3 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.ts @@ -1,7 +1,7 @@ -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { LambdaInvoke } from '../../lib'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to invoke a Lambda function diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.ts index 8caa0b9e2032b..f1da9ebeaa6bd 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.invoke.ts @@ -1,7 +1,7 @@ -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { LambdaInvoke } from '../../lib'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to invoke a Lambda function diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js new file mode 100644 index 0000000000000..bc589394fce44 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_lambda_1 = require("aws-cdk-lib/aws-lambda"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-run-lambda-integ'); +const submitJobLambda = new aws_lambda_1.Function(stack, 'submitJobLambda', { + code: aws_lambda_1.Code.fromInline(`exports.handler = async () => { + return { + statusCode: '200', + body: 'hello, world!' + }; + };`), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); +const submitJob = new sfn.Task(stack, 'Invoke Handler', { + task: new tasks.RunLambdaTask(submitJobLambda), + outputPath: '$.Payload', +}); +const checkJobStateLambda = new aws_lambda_1.Function(stack, 'checkJobStateLambda', { + code: aws_lambda_1.Code.fromInline(`exports.handler = async function(event, context) { + return { + status: event.statusCode === '200' ? 'SUCCEEDED' : 'FAILED' + }; + };`), + runtime: aws_lambda_1.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); +const checkJobState = new sfn.Task(stack, 'Check the job state', { + task: new tasks.RunLambdaTask(checkJobStateLambda), + outputPath: '$.Payload', +}); +const isComplete = new sfn.Choice(stack, 'Job Complete?'); +const jobFailed = new sfn.Fail(stack, 'Job Failed', { + cause: 'Job Failed', + error: 'Received a status that was not 200', +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain.start(submitJob) + .next(checkJobState) + .next(isComplete + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus)); +new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucnVuLWxhbWJkYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnJ1bi1sYW1iZGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx1REFBaUU7QUFDakUscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyw2REFBNkQ7QUFFN0Q7Ozs7Ozs7R0FPRztBQUNILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsMENBQTBDLENBQUMsQ0FBQztBQUU3RSxNQUFNLGVBQWUsR0FBRyxJQUFJLHFCQUFRLENBQUMsS0FBSyxFQUFFLGlCQUFpQixFQUFFO0lBQzdELElBQUksRUFBRSxpQkFBSSxDQUFDLFVBQVUsQ0FBQzs7Ozs7U0FLZixDQUFDO0lBQ1IsT0FBTyxFQUFFLG9CQUFPLENBQUMsV0FBVztJQUM1QixPQUFPLEVBQUUsZUFBZTtDQUN6QixDQUFDLENBQUM7QUFFSCxNQUFNLFNBQVMsR0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i5zdGFydChzdWJtaXRKb2IpXG4gIC5uZXh0KGNoZWNrSm9iU3RhdGUpXG4gIC5uZXh0KFxuICAgIGlzQ29tcGxldGVcbiAgICAgIC53aGVuKHNmbi5Db25kaXRpb24uc3RyaW5nRXF1YWxzKCckLnN0YXR1cycsICdGQUlMRUQnKSwgam9iRmFpbGVkKVxuICAgICAgLndoZW4oc2ZuLkNvbmRpdGlvbi5zdHJpbmdFcXVhbHMoJyQuc3RhdHVzJywgJ1NVQ0NFRURFRCcpLCBmaW5hbFN0YXR1cyksXG4gICk7XG5cbm5ldyBzZm4uU3RhdGVNYWNoaW5lKHN0YWNrLCAnU3RhdGVNYWNoaW5lJywge1xuICBkZWZpbml0aW9uOiBjaGFpbixcbiAgdGltZW91dDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMzApLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/aws-stepfunctions-tasks-run-lambda-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.ts similarity index 90% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.ts index 28b75282aeeb0..2b42b5ec9256b 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.ts @@ -1,7 +1,7 @@ -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Stack verification steps: diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke-function.js.snapshot/asset.9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232/index.py rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js new file mode 100644 index 0000000000000..7fe21b1d5368b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js @@ -0,0 +1,111 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const kms = require("aws-cdk-lib/aws-kms"); +const s3 = require("aws-cdk-lib/aws-s3"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task states needed to deploy the SageMaker Endpoint + * + * SageMaker jobs need training algorithms. These can be found in the AWS marketplace + * or created. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +class CallSageMakerStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + const encryptionKey = new kms.Key(this, 'EncryptionKey', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const trainingData = new s3.Bucket(this, 'TrainingData', { + encryption: s3.BucketEncryption.KMS, + encryptionKey, + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const trainingJob = new tasks.SageMakerCreateTrainingJob(this, 'Train Task', { + algorithmSpecification: { + algorithmName: 'arn:aws:sagemaker:us-east-1:865070037744:algorithm/scikit-decision-trees-15423055-57b73412d2e93e9239e4e16f83298b8f', + }, + inputDataConfig: [{ + channelName: 'InputData', + dataSource: { + s3DataSource: { + s3Location: tasks.S3Location.fromBucket(trainingData, 'data/'), + }, + }, + }], + outputDataConfig: { s3OutputLocation: tasks.S3Location.fromBucket(trainingData, 'result/') }, + trainingJobName: 'mytrainingjob', + resultPath: '$.TrainingJob', + }); + const createModelTask = new tasks.SageMakerCreateModel(this, 'Create Model', { + modelName: sfn.JsonPath.stringAt('$.Endpoint.Model'), + primaryContainer: new tasks.ContainerDefinition({ + image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Endpoint.Image')), + mode: tasks.Mode.SINGLE_MODEL, + modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'), + }), + resultPath: '$.Model', + }); + const createEndpointConfigTask = new tasks.SageMakerCreateEndpointConfig(this, 'Create enpoint config', { + endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.Config'), + productionVariants: [{ + initialInstanceCount: 1, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), + variantName: 'awesome-variant', + modelName: sfn.JsonPath.stringAt('$.Endpoint.Model'), + }], + resultPath: '$.EndpointConfig', + }); + const createEndpointTask = new tasks.SageMakerCreateEndpoint(this, 'Create endpoint', { + endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.Config'), + endpointName: sfn.JsonPath.stringAt('$.Endpoint.Name'), + tags: sfn.TaskInput.fromObject([{ + Key: 'Endpoint', + Value: 'New', + }]), + resultPath: '$.EndpointDeployed', + }); + const updateEndpointTask = new tasks.SageMakerUpdateEndpoint(this, 'Update endpoint', { + endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.Config'), + endpointName: sfn.JsonPath.stringAt('$.Endpoint.Name'), + }); + createEndpointTask.addCatch(updateEndpointTask, { + errors: ['States.TaskFailed'], + resultPath: '$.EndpointDeployed', + }); + const definition = new sfn.Pass(this, 'Start', { + result: sfn.Result.fromObject({ + Endpoint: { + // Change to real parameters for the actual run & put the testing data in the training bucket + Image: 'ImageArn', + Config: 'MyEndpointConfig', + Name: 'MyEndpointName', + Model: 'MyEndpointModelName', + }, + }), + }) + .next(trainingJob) + .next(createModelTask) + .next(createEndpointConfigTask) + .next(createEndpointTask); + const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, + }); + new cdk.CfnOutput(this, 'StateMachineArn', { + value: stateMachine.stateMachineArn, + }); + } +} +const app = new cdk.App(); +new CallSageMakerStack(app, 'aws-stepfunctions-integ-sagemaker'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY2FsbC1zYWdlbWFrZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5jYWxsLXNhZ2VtYWtlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MseUNBQXlDO0FBQ3pDLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsNkRBQTZEO0FBRzdEOzs7Ozs7Ozs7Ozs7R0FZRztBQUdILE1BQU0sa0JBQW1CLFNBQVEsR0FBRyxDQUFDLEtBQUs7SUFDeEMsWUFBWSxLQUFjLEVBQUUsRUFBVSxFQUFFLFFBQXdCLEVBQUU7UUFDaEUsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxhQUFhLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxlQUFlLEVBQUU7WUFDdkQsYUFBYSxFQUFFLEdBQUcsQ0FBQyxhQUFhLENBQUMsT0FBTztTQUN6QyxDQUFDLEN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1hY2hpbmUgPSBuZXcgc2ZuLlN0YXRlTWFjaGluZSh0aGlzLCAnU3RhdGVNYWNoaW5lJywge1xuICAgICAgZGVmaW5pdGlvbixcbiAgICB9KTtcblxuICAgIG5ldyBjZGsuQ2ZuT3V0cHV0KHRoaXMsICdTdGF0ZU1hY2hpbmVBcm4nLCB7XG4gICAgICB2YWx1ZTogc3RhdGVNYWNoaW5lLnN0YXRlTWFjaGluZUFybixcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xubmV3IENhbGxTYWdlTWFrZXJTdGFjayhhcHAsICdhd3Mtc3RlcGZ1bmN0aW9ucy1pbnRlZy1zYWdlbWFrZXInKTtcbmFwcC5zeW50aCgpO1xuXG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/aws-stepfunctions-integ-sagemaker.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts similarity index 93% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts index 6ede459130439..2134028d79e76 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js new file mode 100644 index 0000000000000..464f5bfac5aab --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_kms_1 = require("aws-cdk-lib/aws-kms"); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to create a training job in AWS SageMaker + * SageMaker jobs need training algorithms. These can be found in the AWS marketplace + * or created. + * + * Subscribe to demo Algorithm vended by Amazon (free): + * https://aws.amazon.com/marketplace/ai/procurement?productId=cc5186a0-b8d6-4750-a9bb-1dcdf10e787a + * FIXME - create Input data pertinent for the training model and insert into S3 location specified in inputDataConfig. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + */ +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'integ-stepfunctions-sagemaker'); +const encryptionKey = new aws_kms_1.Key(stack, 'EncryptionKey', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const trainingData = new aws_s3_1.Bucket(stack, 'TrainingData', { + encryption: aws_s3_1.BucketEncryption.KMS, + encryptionKey, + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, +}); +const sm = new aws_stepfunctions_1.StateMachine(stack, 'StateMachine', { + definition: new aws_stepfunctions_tasks_1.SageMakerCreateTrainingJob(stack, 'TrainTask', { + algorithmSpecification: { + algorithmName: 'arn:aws:sagemaker:us-east-1:865070037744:algorithm/scikit-decision-trees-15423055-57b73412d2e93e9239e4e16f83298b8f', + }, + inputDataConfig: [{ + channelName: 'InputData', + dataSource: { + s3DataSource: { + s3Location: aws_stepfunctions_tasks_1.S3Location.fromBucket(trainingData, 'data/'), + }, + }, + }], + outputDataConfig: { s3OutputLocation: aws_stepfunctions_tasks_1.S3Location.fromBucket(trainingData, 'result/') }, + trainingJobName: 'mytrainingjob', + }), +}); +new aws_cdk_lib_1.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY3JlYXRlLXRyYWluaW5nLWpvYi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmNyZWF0ZS10cmFpbmluZy1qb2IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxpREFBMEM7QUFDMUMsK0NBQThEO0FBQzlELHFFQUE2RDtBQUM3RCw2Q0FBbUU7QUFDbkUsaUZBQTZGO0FBRTdGOzs7Ozs7Ozs7Ozs7Ozs7R0FlRztBQUNILE1BQU0sR0FBRyxHQUFHLElBQUksaUJBQUcsRUFBRSxDQUFDO0FBQ3RCLE1BQU0sS0FBSyxHQUFHLElBQUksbUJBQUssQ0FBQyxHQUFHLEVBQUUsK0JBQStCLENBQUMsQ0FBQztBQUU5RCxNQUFNLGFBQWEsR0FBRyxJQUFJLGFBQUcsQ0FBQyxLQUFLLEVBQUUsZUFBZSxFQUFFO0lBQ3BELGFBQWEsRUFBRSwyQkFBYSxDQUFDLE9BQU87Q0FDckMsQ0FBQyxDQUFDO0FBQ0gsTUFBTSxZQUFZLEdBQUcsSUFBSSxlQUFNLENBQUMsS0FBSyxFQUFFLGNBQWMsRUFBRTtJQUNyRCxVQUFVLEVBQUUseUJBQWdCLEN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cbiAgICAgIGFsZ29yaXRobU5hbWU6ICdhcm46YXdzOnNhZ2VtYWtlcjp1cy1lYXN0LTE6ODY1MDcwMDM3NzQ0OmFsZ29yaXRobS9zY2lraXQtZGVjaXNpb24tdHJlZXMtMTU0MjMwNTUtNTdiNzM0MTJkMmU5M2U5MjM5ZTRlMTZmODMyOThiOGYnLFxuICAgIH0sXG4gICAgaW5wdXREYXRhQ29uZmlnOiBbe1xuICAgICAgY2hhbm5lbE5hbWU6ICdJbnB1dERhdGEnLFxuICAgICAgZGF0YVNvdXJjZToge1xuICAgICAgICBzM0RhdGFTb3VyY2U6IHtcbiAgICAgICAgICBzM0xvY2F0aW9uOiBTM0xvY2F0aW9uLmZyb21CdWNrZXQodHJhaW5pbmdEYXRhLCAnZGF0YS8nKSxcbiAgICAgICAgfSxcbiAgICAgIH0sXG4gICAgfV0sXG4gICAgb3V0cHV0RGF0YUNvbmZpZzogeyBzM091dHB1dExvY2F0aW9uOiBTM0xvY2F0aW9uLmZyb21CdWNrZXQodHJhaW5pbmdEYXRhLCAncmVzdWx0LycpIH0sXG4gICAgdHJhaW5pbmdKb2JOYW1lOiAnbXl0cmFpbmluZ2pvYicsXG4gIH0pLFxufSk7XG5cbm5ldyBDZm5PdXRwdXQoc3RhY2ssICdzdGF0ZU1hY2hpbmVBcm4nLCB7XG4gIHZhbHVlOiBzbS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.invoke.payload.only.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ-stepfunctions-sagemaker.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.ts similarity index 85% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.ts index 2d1bceabc6507..aafd6f282b410 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.ts @@ -1,8 +1,8 @@ -import { Key } from '@aws-cdk/aws-kms'; -import { Bucket, BucketEncryption } from '@aws-cdk/aws-s3'; -import { StateMachine } from '@aws-cdk/aws-stepfunctions'; -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { S3Location, SageMakerCreateTrainingJob } from '../../lib'; +import { Key } from 'aws-cdk-lib/aws-kms'; +import { Bucket, BucketEncryption } from 'aws-cdk-lib/aws-s3'; +import { StateMachine } from 'aws-cdk-lib/aws-stepfunctions'; +import { App, CfnOutput, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { S3Location, SageMakerCreateTrainingJob } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to create a training job in AWS SageMaker diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js new file mode 100644 index 0000000000000..a898823a7075c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sns = require("aws-cdk-lib/aws-sns"); +const subs = require("aws-cdk-lib/aws-sns-subscriptions"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to publish to an SNS topic. + * The SNS topic has an SQS queue added as a subscriber. + * When the state machine is executed, it will publish a message to our + * topic, which can subsequently be consumed from the SQS queue. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + * -- aws sqs receive-message --queue-url has a message of 'sending message over' + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-sns-publish-integ'); +const topic = new sns.Topic(stack, 'cool-topic'); +const queue = new sqs.Queue(stack, 'show-me-the-messages'); +topic.addSubscription(new subs.SqsSubscription(queue)); +const publishTask = new aws_stepfunctions_tasks_1.SnsPublish(stack, 'publish to SNS', { + topic, + message: sfn.TaskInput.fromText('sending message over'), +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain.start(publishTask) + .next(finalStatus); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new cdk.CfnOutput(stack, 'queueUrl', { + value: queue.queueUrl, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHVibGlzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnB1Ymxpc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsMERBQTBEO0FBQzFELDJDQUEyQztBQUMzQyxxREFBcUQ7QUFDckQsbUNBQW1DO0FBQ25DLGlGQUFpRTtBQUVqRTs7Ozs7Ozs7Ozs7OztHQWFHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSwyQ0FBMkMsQ0FBQyxDQUFDO0FBRTlFLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFDakQsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEtBQUssRUFBRSxzQkFBc0IsQ0FBQyxDQUFDO0FBRTNELEtBQUssQ0FBQyxlQUFlLENBQUMsSUFBS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NoYWluLnN0YXJ0KHB1Ymxpc2hUYXNrKVxuICAubmV4dChmaW5hbFN0YXR1cyk7XG5cbmNvbnN0IHNtID0gbmV3IHNmbi5TdGF0ZU1hY2hpbmUoc3RhY2ssICdTdGF0ZU1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb246IGNoYWluLFxuICB0aW1lb3V0OiBjZGsuRHVyYXRpb24uc2Vjb25kcygzMCksXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdzdGF0ZU1hY2hpbmVBcm4nLCB7XG4gIHZhbHVlOiBzbS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdxdWV1ZVVybCcsIHtcbiAgdmFsdWU6IHF1ZXVlLnF1ZXVlVXJsLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/aws-stepfunctions-tasks-sns-publish-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/integ.run-lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.ts similarity index 84% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.ts index 536a21de1ade6..3ddefdb17527c 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sns/integ.publish.ts @@ -1,9 +1,9 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as subs from '@aws-cdk/aws-sns-subscriptions'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { SnsPublish } from '../../lib/sns/publish'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as subs from 'aws-cdk-lib/aws-sns-subscriptions'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { SnsPublish } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to publish to an SNS topic. diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js new file mode 100644 index 0000000000000..5d5843386197b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sqs = require("aws-cdk-lib/aws-sqs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to send a message to an SQS + * queue. + * + * When the state machine is executed, it will send a message to our + * queue, which can subsequently be consumed. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + * -- aws sqs receive-message --queue-url has a message of 'sending message over' + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-sqs-send-message-integ'); +const queue = new sqs.Queue(stack, 'show-me-the-messages', { + encryption: sqs.QueueEncryption.KMS, +}); +const sendMessageTask = new aws_stepfunctions_tasks_1.SqsSendMessage(stack, 'send message to sqs', { + queue, + messageBody: sfn.TaskInput.fromText('sending message over'), +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain.start(sendMessageTask) + .next(finalStatus); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new cdk.CfnOutput(stack, 'queueUrl', { + value: queue.queueUrl, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VuZC1tZXNzYWdlLWVuY3J5cHRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnNl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lucHV0LmZyb21UZXh0KCdzZW5kaW5nIG1lc3NhZ2Ugb3ZlcicpLFxufSk7XG5cbmNvbnN0IGZpbmFsU3RhdHVzID0gbmV3IHNmbi5QYXNzKHN0YWNrLCAnRmluYWwgc3RlcCcpO1xuXG5jb25zdCBjaGFpbiA9IHNmbi5DaGFpbi5zdGFydChzZW5kTWVzc2FnZVRhc2spXG4gIC5uZXh0KGZpbmFsU3RhdHVzKTtcblxuY29uc3Qgc20gPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbjogY2hhaW4sXG4gIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3F1ZXVlVXJsJywge1xuICB2YWx1ZTogcXVldWUucXVldWVVcmwsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.call-sagemaker.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.ts similarity index 88% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.ts index d461bb1f1fd98..7996016c28830 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.ts @@ -1,7 +1,7 @@ -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { SqsSendMessage } from '../../lib/sqs/send-message'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { SqsSendMessage } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to send a message to an SQS diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js new file mode 100644 index 0000000000000..828f7ab7d1df9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sqs = require("aws-cdk-lib/aws-sqs"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a task state to send a message to an SQS + * queue. + * + * When the state machine is executed, it will send a message to our + * queue, which can subsequently be consumed. + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Succeeded`. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Succeeded` + * -- aws sqs receive-message --queue-url has a message of 'sending message over' + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-sqs-send-message-integ'); +const queue = new sqs.Queue(stack, 'show-me-the-messages'); +const sendMessageTask = new aws_stepfunctions_tasks_1.SqsSendMessage(stack, 'send message to sqs', { + queue, + messageBody: sfn.TaskInput.fromText('sending message over'), +}); +const finalStatus = new sfn.Pass(stack, 'Final step'); +const chain = sfn.Chain.start(sendMessageTask) + .next(finalStatus); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'stateMachineArn', { + value: sm.stateMachineArn, +}); +new cdk.CfnOutput(stack, 'queueUrl', { + value: queue.queueUrl, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc2VuZC1tZXNzYWdlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc2VuZC1tZXNzYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMkNBQTJDO0FBQzNDLHFEQUFxRDtBQUNyRCxtQ0FBbUM7QUFDbkMsaUZBQXFFO0FBRXJFOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxnREFBZ0QsQ0FBQyxDQUFDO0FBQ25GLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLEVBQUUsc0JBQXNCLENBQUMsQ0FBQztBQUUzRCxNQUFNLGVBQWUsR0FBRyxJQUFJLHdDQUFjLENBQUMsS0FBSyxFQUFFLHFCQUFxQixFQUFFO0lBQ3ZFLEtBQUs7SUFDTCxXQUFXLEVBQUUsR0FBRyxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsc0JBQXNCLENBQUM7Q0FDNUQsQ0FBQyxDQUFDO0FBRUgsTUFBTSxXQUFXLEdBQUcsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxZQUFZLENBQUMsQ0FBQztBQUV0RCxNQUFNLEtBQUssR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxlQUFlLENBQUM7S0FDM0MsSUFBSSxDQUFDLFdBQVcsQ0FBQyxDQUFD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lbmRNZXNzYWdlKHN0YWNrLCAnc2VuZCBtZXNzYWdlIHRvIHNxcycsIHtcbiAgcXVldWUsXG4gIG1lc3NhZ2VCb2R5OiBzZm4uVGFza0lucHV0LmZyb21UZXh0KCdzZW5kaW5nIG1lc3NhZ2Ugb3ZlcicpLFxufSk7XG5cbmNvbnN0IGZpbmFsU3RhdHVzID0gbmV3IHNmbi5QYXNzKHN0YWNrLCAnRmluYWwgc3RlcCcpO1xuXG5jb25zdCBjaGFpbiA9IHNmbi5DaGFpbi5zdGFydChzZW5kTWVzc2FnZVRhc2spXG4gIC5uZXh0KGZpbmFsU3RhdHVzKTtcblxuY29uc3Qgc20gPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbjogY2hhaW4sXG4gIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3N0YXRlTWFjaGluZUFybicsIHtcbiAgdmFsdWU6IHNtLnN0YXRlTWFjaGluZUFybixcbn0pO1xuXG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ3F1ZXVlVXJsJywge1xuICB2YWx1ZTogcXVldWUucXVldWVVcmwsXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/aws-stepfunctions-tasks-sqs-send-message-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/integ.create-training-job.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.ts similarity index 87% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.ts index a62686e76ea59..a2e16d15044cc 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/sqs/integ.send-message.ts @@ -1,7 +1,7 @@ -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { SqsSendMessage } from '../../lib/sqs/send-message'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { SqsSendMessage } from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a task state to send a message to an SQS diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js new file mode 100644 index 0000000000000..9c509d96027c9 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const cdk = require("aws-cdk-lib"); +const tasks = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Creates a state machine with a job poller sample project + * https://docs.aws.amazon.com/step-functions/latest/dg/sample-project-job-poller.html + * + * Stack verification steps: + * The generated State Machine can be executed from the CLI (or Step Functions console) + * and runs with an execution status of `Running`. + * + * An external process can call the state machine to send a heartbeat or response before it times out. + * + * -- aws stepfunctions start-execution --state-machine-arn provides execution arn + * -- aws stepfunctions describe-execution --execution-arn returns a status of `Running` + * + * CHANGEME: extend this test to create the external resources to report heartbeats + */ +class InvokeActivityStack extends cdk.Stack { + constructor(scope, id, props = {}) { + super(scope, id, props); + const submitJobActivity = new sfn.Activity(this, 'SubmitJob'); + const checkJobActivity = new sfn.Activity(this, 'CheckJob'); + const submitJob = new tasks.StepFunctionsInvokeActivity(this, 'Submit Job', { + activity: submitJobActivity, + resultPath: '$.guid', + }); + const waitX = new sfn.Wait(this, 'Wait X Seconds', { time: sfn.WaitTime.secondsPath('$.wait_time') }); + const getStatus = new tasks.StepFunctionsInvokeActivity(this, 'Get Job Status', { + activity: checkJobActivity, + inputPath: '$.guid', + resultPath: '$.status', + }); + const isComplete = new sfn.Choice(this, 'Job Complete?'); + const jobFailed = new sfn.Fail(this, 'Job Failed', { + cause: 'AWS Batch Job Failed', + error: 'DescribeJob returned FAILED', + }); + const finalStatus = new tasks.StepFunctionsInvokeActivity(this, 'Get Final Job Status', { + activity: checkJobActivity, + inputPath: '$.guid', + parameters: { + 'input.$': '$', + 'stringArgument': 'inital-task', + 'numberArgument': 123, + 'booleanArgument': true, + 'arrayArgument': ['a', 'b', 'c'], + 'jsonPath': sfn.JsonPath.stringAt('$.status'), + }, + }); + const chain = sfn.Chain + .start(submitJob) + .next(waitX) + .next(getStatus) + .next(isComplete + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus) + .otherwise(waitX)); + const sm = new sfn.StateMachine(this, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(300), + }); + new cdk.CfnOutput(this, 'stateMachineArn', { + value: sm.stateMachineArn, + }); + } +} +const app = new cdk.App(); +new InvokeActivityStack(app, 'aws-stepfunctions-integ'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW52b2tlLWFjdGl2aXR5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuaW52b2tlLWFjdGl2aXR5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscURBQXFEO0FBQ3JELG1DQUFtQztBQUNuQyw2REFBNkQ7QUFFN0Q7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFDSCxNQUFNLG1CQUFvQixTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQ3pDLFlBQVksS0FBYyxFQUFFLEVBQVUsRUFBRSxRQUF3QixFQUFFO1FBQ2hFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0saUJBQWlCLEdBQUcsSUFBSSxHQU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aW50ZWcnKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/integ.publish.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.ts index c4f3f024dca73..9e8bec9090e04 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.ts @@ -1,6 +1,6 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; /* * Creates a state machine with a job poller sample project diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js new file mode 100644 index 0000000000000..42584407f984c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks"); +/* + * Stack verification steps: + * * aws stepfunctions start-execution --input '{"hello": "world"}' --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * * The output here should contain `status: "SUCCEEDED"` and `output`: '"Output": { "hello": "world"},' + */ +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const child = new sfn.StateMachine(this, 'Child', { + definition: new sfn.Pass(this, 'Pass'), + }); + const parent = new sfn.StateMachine(this, 'Parent', { + definition: new aws_stepfunctions_tasks_1.StepFunctionsStartExecution(this, 'Task', { + stateMachine: child, + input: sfn.TaskInput.fromObject({ + hello: sfn.JsonPath.stringAt('$.hello'), + }), + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + }), + }); + new aws_cdk_lib_1.CfnOutput(this, 'StateMachineARN', { + value: parent.stateMachineArn, + }); + } +} +const app = new aws_cdk_lib_1.App(); +new TestStack(app, 'integ-sfn-start-execution'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhcnQtZXhlY3V0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuc3RhcnQtZXhlY3V0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscURBQXFEO0FBQ3JELDZDQUFvRDtBQUVwRCxpRkFBa0Y7QUFFbEY7Ozs7O0dBS0c7QUFFSCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVTtRQUN0QyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLFlBQVksQ0FBQyxJQUFJLEVBQUUsT0FBTyxFQUFFO1lBQ2hELFVBQVUsRUFBRSxJQUFJLEdBQUcsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQztTQUN2QyxDQUFDLENBQUM7UUFFSCxNQUFNLE1BQU0sR0FBRyxJQUFJLEdBQUcsQ0FBQyxZQUFZLENBQUMsSUFBSSxFQUFFLFFBQVEsRUFBRTtZQUNsRCxVQUFVLEVBQUUsSUFBSSxxREFBMkIsQ0FBQyxJQUFJLEVBQUUsTUFBTSxFQUFFO2dCQUN4RCxZQUFZLEVBQUUsS0FBSztnQkFDbkIsS0FBSyxF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1N0YXRlTWFjaGluZUFSTicsIHtcbiAgICAgIHZhbHVlOiBwYXJlbnQuc3RhdGVNYWNoaW5lQXJuLFxuICAgIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcblxubmV3IFRlc3RTdGFjayhhcHAsICdpbnRlZy1zZm4tc3RhcnQtZXhlY3V0aW9uJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message-encrypted.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ-sfn-start-execution.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.ts new file mode 100644 index 0000000000000..ae7a718f196d1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.ts @@ -0,0 +1,41 @@ +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import { StepFunctionsStartExecution } from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +/* + * Stack verification steps: + * * aws stepfunctions start-execution --input '{"hello": "world"}' --state-machine-arn + * * aws stepfunctions describe-execution --execution-arn + * * The output here should contain `status: "SUCCEEDED"` and `output`: '"Output": { "hello": "world"},' + */ + +class TestStack extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const child = new sfn.StateMachine(this, 'Child', { + definition: new sfn.Pass(this, 'Pass'), + }); + + const parent = new sfn.StateMachine(this, 'Parent', { + definition: new StepFunctionsStartExecution(this, 'Task', { + stateMachine: child, + input: sfn.TaskInput.fromObject({ + hello: sfn.JsonPath.stringAt('$.hello'), + }), + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + }), + }); + + new CfnOutput(this, 'StateMachineARN', { + value: parent.stateMachineArn, + }); + } +} + +const app = new App(); + +new TestStack(app, 'integ-sfn-start-execution'); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.d.ts new file mode 100644 index 0000000000000..9e1209fa54a37 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.d.ts @@ -0,0 +1,20 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as constructs from 'constructs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +export interface FakeTaskProps extends sfn.TaskStateBaseProps { + parameters?: { + [key: string]: string; + }; +} +/** + * Task extending sfn.TaskStateBase to facilitate integ testing setting credentials + */ +export declare class FakeTask extends sfn.TaskStateBase { + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + protected readonly parameters?: { + [key: string]: string; + }; + constructor(scope: constructs.Construct, id: string, props?: FakeTaskProps); + protected _renderTask(): any; +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.js new file mode 100644 index 0000000000000..5d39a30086007 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FakeTask = void 0; +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +/** + * Task extending sfn.TaskStateBase to facilitate integ testing setting credentials + */ +class FakeTask extends sfn.TaskStateBase { + constructor(scope, id, props = {}) { + super(scope, id, props); + this.parameters = props.parameters; + } + _renderTask() { + return { + Type: 'Task', + Resource: 'arn:aws:states:::dynamodb:putItem', + Parameters: { + TableName: 'my-cool-table', + Item: { + id: { + S: 'my-entry', + }, + }, + ...this.parameters, + }, + }; + } +} +exports.FakeTask = FakeTask; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFrZS10YXNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZmFrZS10YXNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBLHFEQUFxRDtBQU1yRDs7R0FFRztBQUNILE1BQWEsUUFBUyxTQUFRLEdBQUcsQ0FBQyxhQUFhO0lBSzdDLFlBQVksS0FBMkIsRUFBRSxFQUFVLEVBQUUsUUFBdUIsRUFBRTtRQUM1RSxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUN4QixJQUFJLENBQUMsVUFBVSxHQUFHLEtBQUssQ0FBQyxVQUFVLENBQUM7SUFDckMsQ0FBQztJQUVTLFdBQVc7UUFDbkIsT0FBTztZQUNMLElBQUksRUFBRSxNQU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IHN0cmluZyB9O1xuXG4gIGNvbnN0cnVjdG9yKHNjb3BlOiBjb25zdHJ1Y3RzLkNvbnN0cnVjdCwgaWQ6IHN0cmluZywgcHJvcHM6IEZha2VUYXNrUHJvcHMgPSB7fSkge1xuICAgIHN1cGVyKHNjb3BlLCBpZCwgcHJvcHMpO1xuICAgIHRoaXMucGFyYW1ldGVycyA9IHByb3BzLnBhcmFtZXRlcnM7XG4gIH1cblxuICBwcm90ZWN0ZWQgX3JlbmRlclRhc2soKTogYW55IHtcbiAgICByZXR1cm4ge1xuICAgICAgVHlwZTogJ1Rhc2snLFxuICAgICAgUmVzb3VyY2U6ICdhcm46YXdzOnN0YXRlczo6OmR5bmFtb2RiOnB1dEl0ZW0nLFxuICAgICAgUGFyYW1ldGVyczoge1xuICAgICAgICBUYWJsZU5hbWU6ICdteS1jb29sLXRhYmxlJyxcbiAgICAgICAgSXRlbToge1xuICAgICAgICAgIGlkOiB7XG4gICAgICAgICAgICBTOiAnbXktZW50cnknLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIC4uLnRoaXMucGFyYW1ldGVycyxcbiAgICAgIH0sXG4gICAgfTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.ts new file mode 100644 index 0000000000000..784040751559c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/fake-task.ts @@ -0,0 +1,37 @@ +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as constructs from 'constructs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; + +export interface FakeTaskProps extends sfn.TaskStateBaseProps { + parameters?: { [key: string]: string }; +} + +/** + * Task extending sfn.TaskStateBase to facilitate integ testing setting credentials + */ +export class FakeTask extends sfn.TaskStateBase { + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + protected readonly parameters?: { [key: string]: string }; + + constructor(scope: constructs.Construct, id: string, props: FakeTaskProps = {}) { + super(scope, id, props); + this.parameters = props.parameters; + } + + protected _renderTask(): any { + return { + Type: 'Task', + Resource: 'arn:aws:states:::dynamodb:putItem', + Parameters: { + TableName: 'my-cool-table', + Item: { + id: { + S: 'my-entry', + }, + }, + ...this.parameters, + }, + }; + } +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js new file mode 100644 index 0000000000000..8b271fe66fa9c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +/* + * Stack verification steps: + * + * -- aws stepfunctions describe-state-machine --state-machine-arn has a status of `ACTIVE` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-custom-state-integ'); +const finalStatus = new sfn.Pass(stack, 'final step'); +const stateJson = { + Type: 'Task', + Resource: 'arn:aws:states:::dynamodb:putItem', + Parameters: { + TableName: 'my-cool-table', + Item: { + id: { + S: 'my-entry', + }, + }, + }, + ResultPath: null, +}; +const custom = new sfn.CustomState(stack, 'my custom task', { + stateJson, +}); +const chain = sfn.Chain.start(custom).next(finalStatus); +const sm = new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new cdk.CfnOutput(stack, 'StateMachineARN', { + value: sm.stateMachineArn, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuY3VzdG9tLXN0YXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuY3VzdG9tLXN0YXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLHFEQUFxRDtBQUVyRDs7OztHQUlHO0FBQ0gsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxzQ0FBc0MsQ0FBQyxDQUFDO0FBRXpFLE1BQU0sV0FBVyxHQUFHLElBQUksR0FBRyxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFFdEQsTUFBTSxTQUFTLEdBQUc7SUFDaEIsSUFBSSxFQUFFLE1BQU07SUFDWixRQUFRLEVBQUUsbUNBQW1DO0lBQzdDLFVBQVUsRUFBRTtRQUNWLFNBQVMsRUFBRSxlQUFlO1FBQzFCLElBQUksRUFBRTtZQUNKLEVBQUUsRUFBRTtnQkFDRixDQUFDLEVBQUUsVUFBVTthQUNkO1NBQ0Y7S0FDRjtJQUNELFVBQVUsRUFBRSxJQUFJO0NBQ2pCLENBQUM7QUFFRixNQUFNLE1BQU0sR0FBRyxJQUFJLEdBQUcsQ0FBQyxXQUFXLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFO0lBQzFELFNBQVM7Q0FDVixDQUFDLENBQUM7QUFFSCxNQUFNLEtBQUssR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsQ0FBQyxJQUF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46YXdzOnN0YXRlczo6OmR5bmFtb2RiOnB1dEl0ZW0nLFxuICBQYXJhbWV0ZXJzOiB7XG4gICAgVGFibGVOYW1lOiAnbXktY29vbC10YWJsZScsXG4gICAgSXRlbToge1xuICAgICAgaWQ6IHtcbiAgICAgICAgUzogJ215LWVudHJ5JyxcbiAgICAgIH0sXG4gICAgfSxcbiAgfSxcbiAgUmVzdWx0UGF0aDogbnVsbCxcbn07XG5cbmNvbnN0IGN1c3RvbSA9IG5ldyBzZm4uQ3VzdG9tU3RhdGUoc3RhY2ssICdteSBjdXN0b20gdGFzaycsIHtcbiAgc3RhdGVKc29uLFxufSk7XG5cbmNvbnN0IGNoYWluID0gc2ZuLkNoYWluLnN0YXJ0KGN1c3RvbSkubmV4dChmaW5hbFN0YXR1cyk7XG5cbmNvbnN0IHNtID0gbmV3IHNmbi5TdGF0ZU1hY2hpbmUoc3RhY2ssICdTdGF0ZU1hY2hpbmUnLCB7XG4gIGRlZmluaXRpb246IGNoYWluLFxuICB0aW1lb3V0OiBjZGsuRHVyYXRpb24uc2Vjb25kcygzMCksXG59KTtcblxubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdTdGF0ZU1hY2hpbmVBUk4nLCB7XG4gIHZhbHVlOiBzbS5zdGF0ZU1hY2hpbmVBcm4sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/aws-stepfunctions-custom-state-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/integ.send-message.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.ts similarity index 90% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.ts index 318f2cd98dd11..d65b0e373945b 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.custom-state.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as sfn from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js new file mode 100644 index 0000000000000..ca764eb18f46e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-intrinsics-integ'); +const pass = new aws_stepfunctions_1.Pass(stack, 'pass', { + parameters: { + array1: aws_stepfunctions_1.JsonPath.array('asdf', aws_stepfunctions_1.JsonPath.stringAt('$.Id')), + arrayPartition1: aws_stepfunctions_1.JsonPath.arrayPartition(aws_stepfunctions_1.JsonPath.listAt('$.inputArray'), 4), + arrayPartition2: aws_stepfunctions_1.JsonPath.arrayPartition(aws_stepfunctions_1.JsonPath.listAt('$.inputArray'), aws_stepfunctions_1.JsonPath.numberAt('$.chunkSize')), + arrayContains1: aws_stepfunctions_1.JsonPath.arrayContains(aws_stepfunctions_1.JsonPath.listAt('$.inputArray'), 5), + arrayContains2: aws_stepfunctions_1.JsonPath.arrayContains(aws_stepfunctions_1.JsonPath.listAt('$.inputArray'), 'a'), + arrayContains3: aws_stepfunctions_1.JsonPath.arrayContains(aws_stepfunctions_1.JsonPath.listAt('$.inputArray'), aws_stepfunctions_1.JsonPath.numberAt('$.lookingFor')), + arrayRange1: aws_stepfunctions_1.JsonPath.arrayRange(1, 9, 2), + arrayRange2: aws_stepfunctions_1.JsonPath.arrayRange(aws_stepfunctions_1.JsonPath.numberAt('$.start'), aws_stepfunctions_1.JsonPath.numberAt('$.end'), aws_stepfunctions_1.JsonPath.numberAt('$.step')), + arrayGetItem1: aws_stepfunctions_1.JsonPath.arrayGetItem(aws_stepfunctions_1.JsonPath.listAt('$.inputArray'), 5), + arrayGetItem2: aws_stepfunctions_1.JsonPath.arrayGetItem(aws_stepfunctions_1.JsonPath.numberAt('$.inputArray'), aws_stepfunctions_1.JsonPath.numberAt('$.index')), + arrayLength1: aws_stepfunctions_1.JsonPath.arrayLength(aws_stepfunctions_1.JsonPath.listAt('$.inputArray')), + arrayUnique1: aws_stepfunctions_1.JsonPath.arrayUnique(aws_stepfunctions_1.JsonPath.listAt('$.inputArray')), + base64Encode1: aws_stepfunctions_1.JsonPath.base64Encode('Data to encode'), + base64Encode2: aws_stepfunctions_1.JsonPath.base64Encode(aws_stepfunctions_1.JsonPath.stringAt('$.input')), + base64Decode1: aws_stepfunctions_1.JsonPath.base64Decode('RGF0YSB0byBlbmNvZGU='), + base64Decode2: aws_stepfunctions_1.JsonPath.base64Decode(aws_stepfunctions_1.JsonPath.stringAt('$.base64')), + hash1: aws_stepfunctions_1.JsonPath.hash('Input data', 'SHA-1'), + hash2: aws_stepfunctions_1.JsonPath.hash(aws_stepfunctions_1.JsonPath.objectAt('$.Data'), aws_stepfunctions_1.JsonPath.stringAt('$.Algorithm')), + jsonMerge1: aws_stepfunctions_1.JsonPath.jsonMerge(aws_stepfunctions_1.JsonPath.objectAt('$.Obj1'), aws_stepfunctions_1.JsonPath.objectAt('$.Obj2')), + mathRandom1: aws_stepfunctions_1.JsonPath.mathRandom(1, 999), + mathRandom2: aws_stepfunctions_1.JsonPath.mathRandom(aws_stepfunctions_1.JsonPath.numberAt('$.start'), aws_stepfunctions_1.JsonPath.numberAt('$.end')), + mathAdd1: aws_stepfunctions_1.JsonPath.mathAdd(1, 999), + mathAdd2: aws_stepfunctions_1.JsonPath.mathAdd(aws_stepfunctions_1.JsonPath.numberAt('$.value1'), aws_stepfunctions_1.JsonPath.numberAt('$.step')), + stringSplit1: aws_stepfunctions_1.JsonPath.stringSplit('1,2,3,4,5', ','), + stringSplit2: aws_stepfunctions_1.JsonPath.stringSplit(aws_stepfunctions_1.JsonPath.stringAt('$.inputString'), aws_stepfunctions_1.JsonPath.stringAt('$.splitter')), + uuid: aws_stepfunctions_1.JsonPath.uuid(), + format1: aws_stepfunctions_1.JsonPath.format('Hi my name is {}.', aws_stepfunctions_1.JsonPath.stringAt('$.Name')), + format2: aws_stepfunctions_1.JsonPath.format(aws_stepfunctions_1.JsonPath.stringAt('$.Format'), aws_stepfunctions_1.JsonPath.stringAt('$.Name')), + stringToJson1: aws_stepfunctions_1.JsonPath.stringToJson(aws_stepfunctions_1.JsonPath.stringAt('$.Str')), + jsonToString1: aws_stepfunctions_1.JsonPath.jsonToString(aws_stepfunctions_1.JsonPath.objectAt('$.Obj')), + }, +}); +const stateMachine = new aws_stepfunctions_1.StateMachine(stack, 'StateMachine', { + definition: pass, +}); +const integ = new integ_tests_alpha_1.IntegTest(app, 'StateMachineIntrinsicsTest', { + testCases: [stack], +}); +integ.assertions.awsApiCall('StepFunctions', 'describeStateMachine', { + stateMachineArn: stateMachine.stateMachineArn, +}).expect(integ_tests_alpha_1.ExpectedResult.objectLike({ + status: 'ACTIVE', +})); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuaW50cmluc2ljcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmludHJpbnNpY3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBbUM7QUFDbkMsa0VBQXVFO0FBQ3ZFLHFFQUE2RTtBQUU3RSxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG9DQUFvQyxDQUFDLENBQUM7QUFFdkUsTUFBTSxJQUFJLEdBQUcsSUFBSSx3QkFBSSxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUU7SUFDbkMsVUFBVSxFQUFFO1FBQ1YsTUFBTSxFQUFFLDRCQUFRLENBQUMsS0FBSyxDQUFDLE1BQU0sRUFBRSw0QkFBUSxDQUFDLFFBQVEsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUN6RCxlQUFlLEVBQUUsNEJBQVEsQ0FBQyxjQUFjLENBQUMsNEJBQVEsQ0FBQyxNQUFNLENBQUMsY0FBYyxDQUFDLEVBQUUsQ0FBQyxDQUFDO1FBQzVFLGVBQWUsRUFBRSw0QkFBUSxDQUFDLGNBQWMsQ0FBQyw0QkFBUSxDQU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ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcbmludGVnLmFzc2VydGlvbnMuYXdzQXBpQ2FsbCgnU3RlcEZ1bmN0aW9ucycsICdkZXNjcmliZVN0YXRlTWFjaGluZScsIHtcbiAgc3RhdGVNYWNoaW5lQXJuOiBzdGF0ZU1hY2hpbmUuc3RhdGVNYWNoaW5lQXJuLFxufSkuZXhwZWN0KEV4cGVjdGVkUmVzdWx0Lm9iamVjdExpa2Uoe1xuICBzdGF0dXM6ICdBQ1RJVkUnLFxufSkpO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/StateMachineIntrinsicsTestDefaultTestDeployAssert1C1E1D7E.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/asset.73c20a669c041469f7fc3fc03d574b093b5b97e7c716f76c1e8117e6163e4dc4.bundle/index.js diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/aws-stepfunctions-intrinsics-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.invoke-activity.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.ts similarity index 93% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.ts index f07836da4c30e..64be2fd746510 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.intrinsics.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import { JsonPath, Pass, StateMachine } from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; +import { JsonPath, Pass, StateMachine } from 'aws-cdk-lib/aws-stepfunctions'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-stepfunctions-intrinsics-integ'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js new file mode 100644 index 0000000000000..2e4a1f856f908 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'listAt-after-parallel'); +const passStringList = new sfn.Pass(stack, 'PSL', { + parameters: { 'newStringList.$': '$.stringList' }, +}); +const passSingleString = new sfn.Pass(stack, 'PSS', { + parameters: { 'newSingleString.$': '$.singleString' }, +}); +const parallel = new sfn.Parallel(stack, 'PRL', { + resultPath: '$', +}); +parallel.branch(passStringList).branch(passSingleString); +const joinPass = new sfn.Pass(stack, 'JP', { + parameters: { + 'resultStringList.$': sfn.JsonPath.listAt('$[0].newStringList'), + 'newSingleString.$': '$[1].newSingleString', + }, +}); +const chain = sfn.Chain.start(parallel).next(joinPass); +new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); +new integ.IntegTest(app, 'ListAtAfterParallel', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubGlzdEF0LWFmdGVyLXBhcmFsbGVsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcubGlzdEF0LWFmdGVyLXBhcmFsbGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxxREFBcUQ7QUFFckQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSx1QkFBdUIsQ0FBQyxDQUFDO0FBRTFELE1BQU0sY0FBYyxHQUFHLElBQUksR0FBRyxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ2hELFVBQVUsRUFBRSxFQUFFLGlCQUFpQixFQUFFLGNBQWMsRUFBRTtDQUNsRCxDQUFDLENBQUM7QUFDSCxNQUFNLGdCQUFnQixHQUFHLElBQUksR0FBRyxDQUFDLElBQUksQ0FBQyxLQUFLLEVBQUUsS0FBSyxFQUFFO0lBQ2xELFVBQVUsRUFBRSxFQUFFLG1CQUFtQixFQUFFLGdCQUFnQ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IHNmbi5DaGFpbi5zdGFydChwYXJhbGxlbCkubmV4dChqb2luUGFzcyk7XG5cbm5ldyBzZm4uU3RhdGVNYWNoaW5lKHN0YWNrLCAnU3RhdGVNYWNoaW5lJywge1xuICBkZWZpbml0aW9uOiBjaGFpbixcbiAgdGltZW91dDogY2RrLkR1cmF0aW9uLnNlY29uZHMoMzApLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnTGlzdEF0QWZ0ZXJQYXJhbGxlbCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/listAt-after-parallel.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.ts similarity index 86% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.ts index 8c11f2805dd32..d0d6e309fea7e 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.listAt-after-parallel.ts @@ -1,6 +1,6 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as sfn from '../lib'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'listAt-after-parallel'); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js new file mode 100644 index 0000000000000..f17cc21783d07 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const fake_task_1 = require("./fake-task"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +/* + * Stack verification steps: + * + * -- aws stepfunctions describe-state-machine --state-machine-arn has a status of `ACTIVE` + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-state-machine-credentials-integ'); +const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.AccountPrincipal(stack.account), +}); +new sfn.StateMachine(stack, 'StateMachineWithLiteralCredentials', { + definition: new fake_task_1.FakeTask(stack, 'FakeTaskWithLiteralCredentials', { credentials: { role: sfn.TaskRole.fromRole(role) } }), + timeout: cdk.Duration.seconds(30), +}); +const crossAccountRole = iam.Role.fromRoleArn(stack, 'CrossAccountRole', 'arn:aws:iam::123456789012:role/CrossAccountRole'); +new sfn.StateMachine(stack, 'StateMachineWithCrossAccountLiteralCredentials', { + definition: new fake_task_1.FakeTask(stack, 'FakeTaskWithCrossAccountLiteralCredentials', { credentials: { role: sfn.TaskRole.fromRole(crossAccountRole) } }), + timeout: cdk.Duration.seconds(30), +}); +new sfn.StateMachine(stack, 'StateMachineWithJsonPathCredentials', { + definition: new fake_task_1.FakeTask(stack, 'FakeTaskWithJsonPathCredentials', { credentials: { role: sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn') } }), + timeout: cdk.Duration.seconds(30), +}); +new integ_tests_alpha_1.IntegTest(app, 'StateMachineCredentials', { testCases: [stack] }); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhdGUtbWFjaGluZS1jcmVkZW50aWFscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnN0YXRlLW1hY2hpbmUtY3JlZGVudGlhbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLGtFQUF1RDtBQUN2RCwyQ0FBdUM7QUFDdkMscURBQXFEO0FBRXJEOzs7O0dBSUc7QUFDSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLG1EQUFtRCxDQUFDLENBQUM7QUFFdEYsTUFBTSxJQUFJLEdBQUcsSUFBSSxHQUFHLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUU7SUFDdkMsU0FBUyxFQUFFLElBQUksR0FBRyxDQUFDLGdCQUFnQixDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUM7Q0FDbkQsQ0FBQyxDQUFDO0FBRUgsSUFBSSxHQUFHLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxvQ0FBb0MsRUFBRTtJQUNoRSxVQUFVLEVBQUUsSUFBSSxvQkFBUSxDQUFDLEtBQUssRUFBRSxnQ0FBZ0MsRUFBRSxFQUFFLFdBQVcsRUFBRSxFQUFFLElBQUksRUFBRSxHQUFHLEN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0KGFwcCwgJ1N0YXRlTWFjaGluZUNyZWRlbnRpYWxzJywgeyB0ZXN0Q2FzZXM6IFtzdGFja10gfSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/StateMachineCredentialsDefaultTestDeployAssert3F5E6D8D.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/aws-stepfunctions-state-machine-credentials-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.custom-state.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.ts similarity index 87% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.ts index f76e465581266..666b97b7ad301 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine-credentials.ts @@ -1,8 +1,8 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { FakeTask } from './fake-task'; -import * as sfn from '../lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; /* * Stack verification steps: diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.d.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js new file mode 100644 index 0000000000000..9745223cac9d4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const cdk = require("aws-cdk-lib"); +const sfn = require("aws-cdk-lib/aws-stepfunctions"); +/* + * Stack verification steps: + * + * -- aws stepfunctions describe-state-machine --state-machine-arn has a status of `ACTIVE` + * -- aws iam get-role-policy --role-name --policy-name has all actions mapped to respective resources. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); +const wait = new sfn.Wait(stack, 'wait time', { + time: sfn.WaitTime.secondsPath('$.waitSeconds'), +}); +const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); +const stateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: wait, +}); +stateMachine.grantRead(role); +stateMachine.grant(role, 'states:SendTaskSuccess'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuc3RhdGUtbWFjaGluZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnN0YXRlLW1hY2hpbmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLHFEQUFxRDtBQUNyRDs7Ozs7R0FLRztBQUNILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUseUJBQXlCLEN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YXMgYSBzdGF0dXMgb2YgYEFDVElWRWBcbiAqIC0tIGF3cyBpYW0gZ2V0LXJvbGUtcG9saWN5IC0tcm9sZS1uYW1lIDxyb2xlLW5hbWU+IC0tcG9saWN5LW5hbWUgPHBvbGljeS1uYW1lPiBoYXMgYWxsIGFjdGlvbnMgbWFwcGVkIHRvIHJlc3BlY3RpdmUgcmVzb3VyY2VzLlxuICovXG5jb25zdCBhcHAgPSBuZXcgY2RrLkFwcCgpO1xuY29uc3Qgc3RhY2sgPSBuZXcgY2RrLlN0YWNrKGFwcCwgJ2F3cy1zdGVwZnVuY3Rpb25zLWludGVnJyk7XG5cbmNvbnN0IHdhaXQgPSBuZXcgc2ZuLldhaXQoc3RhY2ssICd3YWl0IHRpbWUnLCB7XG4gIHRpbWU6IHNmbi5XYWl0VGltZS5zZWNvbmRzUGF0aCgnJC53YWl0U2Vjb25kcycpLFxufSk7XG5cbmNvbnN0IHJvbGUgPSBuZXcgaWFtLlJvbGUoc3RhY2ssICdSb2xlJywge1xuICBhc3N1bWVkQnk6IG5ldyBpYW0uU2VydmljZVByaW5jaXBhbCgnbGFtYmRhLmFtYXpvbmF3cy5jb20nKSxcbn0pO1xuXG5jb25zdCBzdGF0ZU1hY2hpbmUgPSBuZXcgc2ZuLlN0YXRlTWFjaGluZShzdGFjaywgJ1N0YXRlTWFjaGluZScsIHtcbiAgZGVmaW5pdGlvbjogd2FpdCxcbn0pO1xuXG5zdGF0ZU1hY2hpbmUuZ3JhbnRSZWFkKHJvbGUpO1xuc3RhdGVNYWNoaW5lLmdyYW50KHJvbGUsICdzdGF0ZXM6U2VuZFRhc2tTdWNjZXNzJyk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.assets.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.assets.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/aws-stepfunctions-integ.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.intrinsics.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.js.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.ts similarity index 85% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.ts rename to packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.ts index 74d8d02eb7f2d..4f4f97ccde34a 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions/test/integ.state-machine.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as sfn from '../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; /* * Stack verification steps: * diff --git a/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.d.ts b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js new file mode 100644 index 0000000000000..ae37a0714dc1c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core = require("aws-cdk-lib"); +const inc = require("aws-cdk-lib/cloudformation-include"); +const app = new core.App(); +const stack = new core.Stack(app, 'ParentStack'); +new inc.CfnInclude(stack, 'ParentStack', { + templateFile: 'test-templates/nested/parent-one-child.json', + loadNestedStacks: { + ChildStack: { + templateFile: 'test-templates/nested/grandchild-import-stack.json', + }, + }, +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmVzdGVkLXN0YWNrcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLm5lc3RlZC1zdGFja3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxvQ0FBb0M7QUFDcEMsMERBQTBEO0FBRTFELE1BQU0sR0FBRyxHQUFHLElBQUksSUFBSSxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBRTNCLE1BQU0sS0FBSyxHQUFHLElBQUksSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsYUFBYSxDQUFDLENBQUM7QUFFakQsSUFBSSxHQUFHLENBQUMsVUFBVSxDQUFDLEtBQUssRUFBRSxhQUFhLEVBQUU7SUFDdkMsWUFBWSxFQUFFLDZDQUE2QztJQUMzRCxnQkFBZ0IsRUFBRTtRQUNoQixVQUFVLEVBQUU7WUFDVixZQUFZLEVBQUUsb0RBQW9EO1NBQ25FO0tBQ0Y7Q0FDRixDQUFDLENBQUM7QUFFSCxHQUFHLENBQUMsS0FBSyxFQUFFLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBjb3JlIGZyb20gJ2F3cy1jZGstbGliJztcbmltcG9ydCAqIGFzIGluYyBmcm9tICdhd3MtY2RrLWxpYi9jbG91ZGZvcm1hdGlvbi1pbmNsdWRlJztcblxuY29uc3QgYXBwID0gbmV3IGNvcmUuQXBwKCk7XG5cbmNvbnN0IHN0YWNrID0gbmV3IGNvcmUuU3RhY2soYXBwLCAnUGFyZW50U3RhY2snKTtcblxubmV3IGluYy5DZm5JbmNsdWRlKHN0YWNrLCAnUGFyZW50U3RhY2snLCB7XG4gIHRlbXBsYXRlRmlsZTogJ3Rlc3QtdGVtcGxhdGVzL25lc3RlZC9wYXJlbnQtb25lLWNoaWxkLmpzb24nLFxuICBsb2FkTmVzdGVkU3RhY2tzOiB7XG4gICAgQ2hpbGRTdGFjazoge1xuICAgICAgdGVtcGxhdGVGaWxlOiAndGVzdC10ZW1wbGF0ZXMvbmVzdGVkL2dyYW5kY2hpbGQtaW1wb3J0LXN0YWNrLmpzb24nLFxuICAgIH0sXG4gIH0sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.assets.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.assets.json diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.template.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStack.template.json diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStackChildStack26957E6F.nested.template.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStackChildStack26957E6F.nested.template.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStackChildStack26957E6F.nested.template.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/ParentStackChildStack26957E6F.nested.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.email-identity.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/integ.json diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.js.snapshot/tree.json diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.ts b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.ts similarity index 77% rename from packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.ts rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.ts index 11d2391e06582..f886a08dbbeaa 100644 --- a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.nested-stacks.ts @@ -1,5 +1,5 @@ -import * as core from '@aws-cdk/core'; -import * as inc from '../lib'; +import * as core from 'aws-cdk-lib'; +import * as inc from 'aws-cdk-lib/cloudformation-include'; const app = new core.App(); diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/boolean-for-string.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/boolean-for-string.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/boolean-for-string.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/boolean-for-string.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/bucket-with-encryption-key.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/bucket-with-encryption-key.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/bucket-with-encryption-key.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/bucket-with-encryption-key.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/bucket-with-parameters.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/bucket-with-parameters.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/bucket-with-parameters.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/bucket-with-parameters.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/condition-same-name-as-resource.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/condition-same-name-as-resource.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/condition-same-name-as-resource.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/condition-same-name-as-resource.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/condition-using-mapping.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/condition-using-mapping.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/condition-using-mapping.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/condition-using-mapping.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/custom-resource-with-attributes.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/custom-resource-with-attributes.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/custom-resource-with-attributes.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/custom-resource-with-attributes.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-select-with-novalue.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-select-with-novalue.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-select-with-novalue.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-select-with-novalue.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-brace-edges.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-brace-edges.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-brace-edges.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-brace-edges.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-escaping.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-escaping.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-escaping.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-escaping.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-map-empty.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-map-empty.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-map-empty.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-map-empty.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-override.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-override.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-override.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-override.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-parameters.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-parameters.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-parameters.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-parameters.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-parsing-edges.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-parsing-edges.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-parsing-edges.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-parsing-edges.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-shadow.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-shadow.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-shadow.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-string.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-string.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/fn-sub-string.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/fn-sub-string.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/functions-and-conditions.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/functions-and-conditions.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/functions-and-conditions.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/functions-and-conditions.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/get-att-string-form.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/get-att-string-form.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/get-att-string-form.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/get-att-string-form.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/if-complex-property.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/if-complex-property.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/if-complex-property.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/if-complex-property.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/if-in-tags.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/if-in-tags.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/if-in-tags.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/if-in-tags.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/if-simple-property.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/if-simple-property.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/if-simple-property.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/if-simple-property.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-condition.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-condition.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-condition.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-condition.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-import-stack.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-import-stack.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-import-stack.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-import-stack.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-no-bucket.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-no-bucket.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-no-bucket.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-no-bucket.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-two-parameters.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-two-parameters.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-two-parameters.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-two-parameters.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/cross-stack-refs.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/cross-stack-refs.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/cross-stack-refs.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/cross-stack-refs.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/custom-resource.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/custom-resource.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/custom-resource.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/custom-resource.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/only-nested-stack.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/only-nested-stack.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/only-nested-stack.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/only-nested-stack.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-creation-policy.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-creation-policy.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-creation-policy.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-creation-policy.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-one-child.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-one-child.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-one-child.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-one-child.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-two-children.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-two-children.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-two-children.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-two-children.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-two-parameters.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-two-parameters.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-two-parameters.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-two-parameters.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-update-policy.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-update-policy.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-update-policy.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-update-policy.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-valid-condition.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-valid-condition.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-valid-condition.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-valid-condition.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-with-attributes.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-with-attributes.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/nested/parent-with-attributes.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/nested/parent-with-attributes.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/non-existent-resource-attribute.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/non-existent-resource-attribute.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/non-existent-resource-attribute.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/non-existent-resource-attribute.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/number-for-string.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/number-for-string.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/number-for-string.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/number-for-string.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/only-bucket-complex-props.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-bucket-complex-props.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/only-bucket-complex-props.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-bucket-complex-props.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/only-empty-bucket.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-empty-bucket.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/only-empty-bucket.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-empty-bucket.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/only-mapping-and-bucket.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-mapping-and-bucket.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/only-mapping-and-bucket.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-mapping-and-bucket.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/only-parameters-and-rule.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-parameters-and-rule.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/only-parameters-and-rule.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/only-parameters-and-rule.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/outputs-with-references.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/outputs-with-references.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/outputs-with-references.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/outputs-with-references.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/parameter-references.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/parameter-references.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/parameter-references.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/parameter-references.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/ref-array-property.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/ref-array-property.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/ref-array-property.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/ref-array-property.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-condition.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-condition.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-condition.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-condition.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-depends-on.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-depends-on.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-depends-on.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-depends-on.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-update-policy.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-update-policy.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/resource-attribute-update-policy.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/resource-attribute-update-policy.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/ssm-association.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/ssm-association.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/ssm-association.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/ssm-association.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/string-for-number.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/string-for-number.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/string-for-number.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/string-for-number.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/user-data.json b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/user-data.json similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/user-data.json rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/user-data.json diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-join.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-join.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-join.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-join.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-select.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-select.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-select.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-select.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-split.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-split.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-split.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-split.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml diff --git a/packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml b/packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml similarity index 100% rename from packages/@aws-cdk/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml rename to packages/@aws-cdk-testing/framework-integ/test/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js new file mode 100644 index 0000000000000..9ed90358732cc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const aws_iam_1 = require("aws-cdk-lib/aws-iam"); +const aws_s3_1 = require("aws-cdk-lib/aws-s3"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const custom_resources_1 = require("aws-cdk-lib/custom-resources"); +/* + * + * Stack verification steps: + * + * 1) Deploy app. + * $ yarn build && yarn integ --update-on-failed --no-clean + * 2) Change `notebookName` to perform an update. + * $ yarn build && yarn integ --update-on-failed --no-clean + * 3) Check if PhysicalResourceId is consistent. + * $ aws cloudformation describe-stack-events \ + * --stack-name aws-cdk-customresources-athena \ + * --query 'StackEvents[?starts_with(LogicalResourceId,`AthenaNotebook`)]' + * + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-customresources-athena'); +const athenaResultBucket = new aws_s3_1.Bucket(stack, 'AthenaResultBucket'); +const athenaExecutionRole = new aws_iam_1.Role(stack, 'AthenaExecRole', { + assumedBy: new aws_iam_1.ServicePrincipal('athena.amazonaws.com'), + managedPolicies: [ + aws_iam_1.ManagedPolicy.fromAwsManagedPolicyName('AmazonAthenaFullAccess'), + ], +}); +// To avoid the Lambda Function from failing due to delays +// in policy propagation, this role should be created explicitly. +const customResourceRole = new aws_iam_1.Role(stack, 'CustomResourceRole', { + assumedBy: new aws_iam_1.ServicePrincipal('lambda.amazonaws.com'), + managedPolicies: [ + aws_iam_1.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaBasicExecutionRole'), + ], + inlinePolicies: { + PassRolePolicy: new aws_iam_1.PolicyDocument({ + statements: [new aws_iam_1.PolicyStatement({ + actions: ['iam:PassRole'], + resources: [athenaExecutionRole.roleArn], + })], + }), + AthenaWorkGroupPolicy: new aws_iam_1.PolicyDocument({ + statements: [new aws_iam_1.PolicyStatement({ + actions: [ + 'athena:CreateWorkGroup', + 'athena:DeleteWorkGroup', + ], + resources: ['*'], + })], + }), + AthenaNotebookPolicy: new aws_iam_1.PolicyDocument({ + statements: [new aws_iam_1.PolicyStatement({ + actions: [ + 'athena:CreateNotebook', + 'athena:UpdateNotebookMetadata', + 'athena:DeleteNotebook', + ], + resources: ['*'], + })], + }), + }, +}); +const workgroupName = 'TestWG'; +const workgroup = new custom_resources_1.AwsCustomResource(stack, 'AthenaWorkGroup', { + role: customResourceRole, + resourceType: 'Custom::AthenaWorkGroup', + installLatestAwsSdk: true, + onCreate: { + service: 'Athena', + action: 'createWorkGroup', + physicalResourceId: custom_resources_1.PhysicalResourceId.of(workgroupName), + parameters: { + Name: workgroupName, + Configuration: { + ExecutionRole: athenaExecutionRole.roleArn, + ResultConfiguration: { + OutputLocation: athenaResultBucket.s3UrlForObject(), + }, + EngineVersion: { + SelectedEngineVersion: 'PySpark engine version 3', + }, + }, + }, + }, + onDelete: { + service: 'Athena', + action: 'deleteWorkGroup', + parameters: { + WorkGroup: workgroupName, + }, + }, + timeout: cdk.Duration.minutes(3), +}); +// Athena.updateNotebook responses with empty body. +// This test case expects physicalResourceId to remain unchanged +// even if the user is unable to explicitly specify it because of empty response. +// https://docs.aws.amazon.com/athena/latest/APIReference/API_UpdateNotebook.html +const notebookName = 'MyNotebook1'; // Update name for test +const notebook = new custom_resources_1.AwsCustomResource(stack, 'AthenaNotebook', { + role: customResourceRole, + resourceType: 'Custom::AthenaNotebook', + installLatestAwsSdk: true, + onCreate: { + service: 'Athena', + action: 'createNotebook', + physicalResourceId: custom_resources_1.PhysicalResourceId.fromResponse('NotebookId'), + parameters: { + WorkGroup: workgroupName, + Name: notebookName, + }, + }, + onUpdate: { + service: 'Athena', + action: 'updateNotebookMetadata', + parameters: { + Name: notebookName, + NotebookId: new custom_resources_1.PhysicalResourceIdReference(), + }, + }, + onDelete: { + service: 'Athena', + action: 'deleteNotebook', + parameters: { + NotebookId: new custom_resources_1.PhysicalResourceIdReference(), + }, + }, + timeout: cdk.Duration.minutes(3), +}); +notebook.node.addDependency(workgroup); +new integ_tests_alpha_1.IntegTest(app, 'CustomResourceAthena', { + testCases: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ZmVyZW5jZSgpLFxuICAgIH0sXG4gIH0sXG4gIG9uRGVsZXRlOiB7XG4gICAgc2VydmljZTogJ0F0aGVuYScsXG4gICAgYWN0aW9uOiAnZGVsZXRlTm90ZWJvb2snLFxuICAgIHBhcmFtZXRlcnM6IHtcbiAgICAgIE5vdGVib29rSWQ6IG5ldyBQaHlzaWNhbFJlc291cmNlSWRSZWZlcmVuY2UoKSxcbiAgICB9LFxuICB9LFxuICB0aW1lb3V0OiBjZGsuRHVyYXRpb24ubWludXRlcygzKSxcbn0pO1xubm90ZWJvb2subm9kZS5hZGREZXBlbmRlbmN5KHdvcmtncm91cCk7XG5cbm5ldyBJbnRlZ1Rlc3QoYXBwLCAnQ3VzdG9tUmVzb3VyY2VBdGhlbmEnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/CustomResourceAthenaDefaultTestDeployAssert7AE6A475.template.json diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/aws-cdk-customresources-athena.template.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/integ.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/tree.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.ts similarity index 94% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.ts index 98dedeb8e2b72..2cd9d40db2413 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.ts @@ -1,8 +1,8 @@ -import { ManagedPolicy, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { Bucket } from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AwsCustomResource, PhysicalResourceId, PhysicalResourceIdReference } from '../../lib'; +import { ManagedPolicy, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AwsCustomResource, PhysicalResourceId, PhysicalResourceIdReference } from 'aws-cdk-lib/custom-resources'; /* * diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js new file mode 100644 index 0000000000000..d651c78c80b98 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const cdk = require("aws-cdk-lib"); +const integ_tests_alpha_1 = require("@aws-cdk/integ-tests-alpha"); +const custom_resources_1 = require("aws-cdk-lib/custom-resources"); +/* + * + * Stack verification steps: + * + * aws lambda get-function-configuration --function-name : should include a VPC config + * + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-customresources-vpc'); +const vpc = new ec2.Vpc(stack, 'Vpc'); +new custom_resources_1.AwsCustomResource(stack, 'DescribeVpcAttribute', { + onUpdate: { + service: 'EC2', + action: 'describeVpcAttribute', + parameters: { + VpcId: vpc.vpcId, + Attribute: 'enableDnsHostnames', + }, + physicalResourceId: custom_resources_1.PhysicalResourceId.of(vpc.vpcId), + }, + policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ resources: custom_resources_1.AwsCustomResourcePolicy.ANY_RESOURCE }), + timeout: cdk.Duration.minutes(3), + vpc: vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, +}); +new integ_tests_alpha_1.IntegTest(app, 'CustomResourceVpc', { + testC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V3IGVjMi5WcGMoc3RhY2ssICdWcGMnKTtcbm5ldyBBd3NDdXN0b21SZXNvdXJjZShzdGFjaywgJ0Rlc2NyaWJlVnBjQXR0cmlidXRlJywge1xuICBvblVwZGF0ZToge1xuICAgIHNlcnZpY2U6ICdFQzInLFxuICAgIGFjdGlvbjogJ2Rlc2NyaWJlVnBjQXR0cmlidXRlJyxcbiAgICBwYXJhbWV0ZXJzOiB7XG4gICAgICBWcGNJZDogdnBjLnZwY0lkLFxuICAgICAgQXR0cmlidXRlOiAnZW5hYmxlRG5zSG9zdG5hbWVzJyxcbiAgICB9LFxuICAgIHBoeXNpY2FsUmVzb3VyY2VJZDogUGh5c2ljYWxSZXNvdXJjZUlkLm9mKHZwYy52cGNJZCksXG4gIH0sXG4gIHBvbGljeTogQXdzQ3VzdG9tUmVzb3VyY2VQb2xpY3kuZnJvbVNka0NhbGxzKHsgcmVzb3VyY2VzOiBBd3NDdXN0b21SZXNvdXJjZVBvbGljeS5BTllfUkVTT1VSQ0UgfSksXG4gIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5taW51dGVzKDMpLFxuICB2cGM6IHZwYyxcbiAgdnBjU3VibmV0czogeyBzdWJuZXRUeXBlOiBlYzIuU3VibmV0VHlwZS5QUklWQVRFX1dJVEhfRUdSRVNTIH0sXG59KTtcblxubmV3IEludGVnVGVzdChhcHAsICdDdXN0b21SZXNvdXJjZVZwYycsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/CustomResourceVpcDefaultTestDeployAssert5F9D2F88.template.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-athena.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/asset.a268caa53756f51bda8ad5f499be4ed8484a81b314811806fbb66f874837c476/index.js diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/aws-cdk-customresources-vpc.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-lambda.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/integ.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/tree.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts similarity index 83% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts index 48ac50d7f8c05..222764b32bb5c 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '../../lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from 'aws-cdk-lib/custom-resources'; /* * diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.d.ts new file mode 100644 index 0000000000000..b7988016daa5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js new file mode 100644 index 0000000000000..55b68867f9904 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js @@ -0,0 +1,82 @@ +#!/usr/bin/env node +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const iam = require("aws-cdk-lib/aws-iam"); +const sns = require("aws-cdk-lib/aws-sns"); +const ssm = require("aws-cdk-lib/aws-ssm"); +const cdk = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const custom_resources_1 = require("aws-cdk-lib/custom-resources"); +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-sdk-js'); +const topic = new sns.Topic(stack, 'Topic'); +const snsPublish = new custom_resources_1.AwsCustomResource(stack, 'Publish', { + resourceType: 'Custom::SNSPublisher', + onUpdate: { + service: 'SNS', + action: 'publish', + parameters: { + Message: 'hello', + TopicArn: topic.topicArn, + }, + physicalResourceId: custom_resources_1.PhysicalResourceId.of(topic.topicArn), + }, + policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ resources: custom_resources_1.AwsCustomResourcePolicy.ANY_RESOURCE }), +}); +const listTopics = new custom_resources_1.AwsCustomResource(stack, 'ListTopics', { + onUpdate: { + service: 'SNS', + action: 'listTopics', + physicalResourceId: custom_resources_1.PhysicalResourceId.fromResponse('Topics.0.TopicArn'), + }, + policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ resources: custom_resources_1.AwsCustomResourcePolicy.ANY_RESOURCE }), +}); +listTopics.node.addDependency(topic); +const ssmParameter = new ssm.StringParameter(stack, 'Utf8Parameter', { + stringValue: 'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!"#¤%&/()=?`´^*+~_-.,:;<>|', +}); +const getParameter = new custom_resources_1.AwsCustomResource(stack, 'GetParameter', { + resourceType: 'Custom::SSMParameter', + onUpdate: { + service: 'SSM', + action: 'getParameter', + parameters: { + Name: ssmParameter.parameterName, + WithDecryption: true, + }, + physicalResourceId: custom_resources_1.PhysicalResourceId.fromResponse('Parameter.ARN'), + }, + policy: custom_resources_1.AwsCustomResourcePolicy.fromSdkCalls({ resources: custom_resources_1.AwsCustomResourcePolicy.ANY_RESOURCE }), +}); +const customRole = new iam.Role(stack, 'CustomRole', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); +customRole.addToPolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + resources: ['*'], + actions: [ + 'ssm:*', + ], +})); +const getParameterNoPolicy = new custom_resources_1.AwsCustomResource(stack, 'GetParameterNoPolicy', { + resourceType: 'Custom::SSMParameter', + onUpdate: { + service: 'SSM', + action: 'getParameter', + parameters: { + Name: ssmParameter.parameterName, + WithDecryption: true, + }, + physicalResourceId: custom_resources_1.PhysicalResourceId.fromResponse('Parameter.ARN'), + }, + role: customRole, +}); +new cdk.CfnOutput(stack, 'MessageId', { value: snsPublish.getResponseField('MessageId') }); +new cdk.CfnOutput(stack, 'TopicArn', { value: listTopics.getResponseField('Topics.0.TopicArn') }); +new cdk.CfnOutput(stack, 'ParameterValue', { value: getParameter.getResponseField('Parameter.Value') }); +new cdk.CfnOutput(stack, 'ParameterValueNoPolicy', { value: getParameterNoPolicy.getResponseField('Parameter.Value') }); +new integ.IntegTest(app, 'AwsCustomResourceTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXdzLWN1c3RvbS1yZXNvdXJjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmF3cy1jdXN0b20tcmVzb3VyY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsMkNBQTJDO0FBQzNDLDJDQUEyQztBQUMzQywyQ0FBMkM7QUFDM0MsbUNBQW1DO0FBQ25DLG9EQUFvRDtBQUNwRCxtRUFBOEc7QUFFOUcsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFFMUIsTUFBTSxLQUFLLEdBQUcsSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO0FBRW5ELE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFFNUMsTUFBTSxVQUFVLEdBQUcsSUFBSSxvQ0FBaUIsQ0FBQyxLQUFLLEVBQUUsU0FBUyxFQUFFO0lBQ3pELFlBQVksRUFBRSxzQkFBc0I7SUFDcEMsUUFBUSxFQUFFO1FBQ1IsT0FBTyxFQUFFLEtBQUs7UUFDZCxNQUFNLEVBQUUsU0FBUztRQUNqQixVQUFVLEVBQUU7WUFDVixPQUFPLEVBQUUsT0FBTztZQUNoQixRQUFRLEVBQU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k7XG5cbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnTWVzc2FnZUlkJywgeyB2YWx1ZTogc25zUHVibGlzaC5nZXRSZXNwb25zZUZpZWxkKCdNZXNzYWdlSWQnKSB9KTtcbm5ldyBjZGsuQ2ZuT3V0cHV0KHN0YWNrLCAnVG9waWNBcm4nLCB7IHZhbHVlOiBsaXN0VG9waWNzLmdldFJlc3BvbnNlRmllbGQoJ1RvcGljcy4wLlRvcGljQXJuJykgfSk7XG5uZXcgY2RrLkNmbk91dHB1dChzdGFjaywgJ1BhcmFtZXRlclZhbHVlJywgeyB2YWx1ZTogZ2V0UGFyYW1ldGVyLmdldFJlc3BvbnNlRmllbGQoJ1BhcmFtZXRlci5WYWx1ZScpIH0pO1xubmV3IGNkay5DZm5PdXRwdXQoc3RhY2ssICdQYXJhbWV0ZXJWYWx1ZU5vUG9saWN5JywgeyB2YWx1ZTogZ2V0UGFyYW1ldGVyTm9Qb2xpY3kuZ2V0UmVzcG9uc2VGaWVsZCgnUGFyYW1ldGVyLlZhbHVlJykgfSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnQXdzQ3VzdG9tUmVzb3VyY2VUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/AwsCustomResourceTestDefaultTestDeployAssert289A7DC5.template.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/asset.8c980c60f4c1c0edebd987e6043e356b8d439b2d731c5af3329df082ca5a6a79/index.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/asset.8c980c60f4c1c0edebd987e6043e356b8d439b2d731c5af3329df082ca5a6a79/index.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/asset.8c980c60f4c1c0edebd987e6043e356b8d439b2d731c5af3329df082ca5a6a79/index.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/asset.8c980c60f4c1c0edebd987e6043e356b8d439b2d731c5af3329df082ca5a6a79/index.js diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/aws-cdk-sdk-js.template.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/integ.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.js.snapshot/tree.json diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts similarity index 91% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts index f3a7e94a6a882..d5250fa5bf3e8 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/aws-custom-resource/integ.aws-custom-resource.ts @@ -1,10 +1,10 @@ #!/usr/bin/env node -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '../../lib'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from 'aws-cdk-lib/custom-resources'; const app = new cdk.App(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js new file mode 100644 index 0000000000000..0c2b16e7df710 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ * +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const constructs_1 = require("constructs"); +const s3_assert_1 = require("./integration-test-fixtures/s3-assert"); +const s3_file_1 = require("./integration-test-fixtures/s3-file"); +class TestStack extends aws_cdk_lib_1.Stack { + constructor(scope, id) { + super(scope, id); + const file2Contents = 'this file has a generated physical id'; + const bucket = new s3.Bucket(this, 'MyBucket'); + const file1 = new s3_file_1.S3File(this, 'file1', { + bucket, + objectKey: 'second.txt', + contents: 'Hello, world, 1980!', + }); + const file2 = new s3_file_1.S3File(this, 'file2', { + bucket, + contents: file2Contents, + }); + const file3 = new s3_file_1.S3File(this, 'file3Utf8', { + bucket, + objectKey: 'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!"#¤%&/()=?`´^*+~_-.,:;<>|', + contents: 'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ!"#¤%&/()=?`´^*+~_-.,:;<>|', + }); + new s3_assert_1.S3Assert(this, 'assert-file', { + bucket, + objectKey: file2.objectKey, + expectedContent: file2Contents, + }); + // delay file2 updates so we can test async assertions + constructs_1.Node.of(file2).addDependency(file1); + new aws_cdk_lib_1.CfnOutput(this, 'file1-url', { value: file1.url }); + new aws_cdk_lib_1.CfnOutput(this, 'file2-url', { value: file2.url }); + new aws_cdk_lib_1.CfnOutput(this, 'file3-url', { value: file3.url }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new TestStack(app, 'integ-provider-framework'); +new integ.IntegTest(app, 'IntegProviderFrameworkTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucHJvdmlkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5wcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGdCQUFnQjtBQUNoQix5Q0FBeUM7QUFDekMsNkNBQW9EO0FBQ3BELG9EQUFvRDtBQUNwRCwyQ0FBNkM7QUFDN0MscUVBQWlFO0FBQ2pFLGlFQUE2RDtBQUU3RCxNQUFNLFNBQVUsU0FBUSxtQkFBSztJQUMzQixZQUFZLEtBQWdCLEVBQUUsRUFBVTtRQUN0QyxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBRWpCLE1BQU0sYUFBYSxHQUFHLHVDQUF1QyxDQUFDO1FBQzlELE1BQU0sTUFBTSxHQUFHLElBQUksRUFBRSxDQUFDLE1BQU0sQ0FBQyxJQUFJLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFFL0MsTUFBTSxLQUFLLEdBQUcsSUFBSSxnQkFBTSxDQUFDLElBQUksRUFBRSxPQUFPLEVBQUU7WUFDdEMsTUFBTTtZQUNOLFNBQVMsRUFBRSxZQUFZO1lBQ3ZCLFFBQVEsRUFBRSxxQkFBcUI7U0FDa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VlOiBmaWxlMi51cmwgfSk7XG4gICAgbmV3IENmbk91dHB1dCh0aGlzLCAnZmlsZTMtdXJsJywgeyB2YWx1ZTogZmlsZTMudXJsIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoKTtcbmNvbnN0IHN0YWNrID0gbmV3IFRlc3RTdGFjayhhcHAsICdpbnRlZy1wcm92aWRlci1mcmFtZXdvcmsnKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdJbnRlZ1Byb3ZpZGVyRnJhbWV3b3JrVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/IntegProviderFrameworkTestDefaultTestDeployAssertAEF9AF2E.template.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4bafad8d010ba693e235b77d2c6decfc2ac79a8208d4477cbb36d31caf7189e8/index.py b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4bafad8d010ba693e235b77d2c6decfc2ac79a8208d4477cbb36d31caf7189e8/index.py similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4bafad8d010ba693e235b77d2c6decfc2ac79a8208d4477cbb36d31caf7189e8/index.py rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4bafad8d010ba693e235b77d2c6decfc2ac79a8208d4477cbb36d31caf7189e8/index.py diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/cfn-response.js diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/consts.js diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/framework.js diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/outbound.js diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.e1c44c46b1daa364ad4e38dbc77e6fe7714ea5fbf40251a924e8c34281aa2eda/util.js diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.assets.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.assets.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.assets.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.template.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.template.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.template.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ-provider-framework.template.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/integ.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.js.snapshot/tree.json diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.ts similarity index 90% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.ts index d4b20daf3f122..26b1f3f26918d 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integ.provider.ts @@ -1,7 +1,7 @@ /// !cdk-integ * -import * as s3 from '@aws-cdk/aws-s3'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct, Node } from 'constructs'; import { S3Assert } from './integration-test-fixtures/s3-assert'; import { S3File } from './integration-test-fixtures/s3-file'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.d.ts new file mode 100644 index 0000000000000..62214a50845db --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.d.ts @@ -0,0 +1,26 @@ +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { Construct } from 'constructs'; +export interface S3AssertProps { + /** + * The s3 bucket to query. + */ + readonly bucket: s3.IBucket; + /** + * The object key. + */ + readonly objectKey: string; + /** + * The expected contents. + */ + readonly expectedContent: string; +} +/** + * A custom resource that asserts that a file on s3 has the specified contents. + * This resource will wait 10 minutes before, allowing for eventual consistency + * to stabilize (and also exercises the idea of asynchronous custom resources). + * + * Code is written in Python because why not. + */ +export declare class S3Assert extends Construct { + constructor(scope: Construct, id: string, props: S3AssertProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.js new file mode 100644 index 0000000000000..2efdfd66ce140 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.S3Assert = void 0; +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const constructs_1 = require("constructs"); +const cr = require("aws-cdk-lib/custom-resources"); +/** + * A custom resource that asserts that a file on s3 has the specified contents. + * This resource will wait 10 minutes before, allowing for eventual consistency + * to stabilize (and also exercises the idea of asynchronous custom resources). + * + * Code is written in Python because why not. + */ +class S3Assert extends constructs_1.Construct { + constructor(scope, id, props) { + super(scope, id); + new aws_cdk_lib_1.CustomResource(this, 'Resource', { + serviceToken: S3AssertProvider.getOrCreate(this), + resourceType: 'Custom::S3Assert', + properties: { + BucketName: props.bucket.bucketName, + ObjectKey: props.objectKey, + ExpectedContent: props.expectedContent, + }, + }); + } +} +exports.S3Assert = S3Assert; +class S3AssertProvider extends constructs_1.Construct { + /** + * Returns the singleton provider. + */ + static getOrCreate(scope) { + const providerId = 'com.amazonaws.cdk.custom-resources.s3assert-provider'; + const stack = aws_cdk_lib_1.Stack.of(scope); + const group = constructs_1.Node.of(stack).tryFindChild(providerId) || new S3AssertProvider(stack, providerId); + return group.provider.serviceToken; + } + constructor(scope, id) { + super(scope, id); + const onEvent = new lambda.Function(this, 's3assert-on-event', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.on_event', + }); + const isComplete = new lambda.Function(this, 's3assert-is-complete', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.is_complete', + initialPolicy: [ + new iam.PolicyStatement({ + resources: ['*'], + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + }), + ], + }); + this.provider = new cr.Provider(this, 's3assert-provider', { + onEventHandler: onEvent, + isCompleteHandler: isComplete, + totalTimeout: aws_cdk_lib_1.Duration.minutes(5), + }); + } +} +//# sourceMappingURL=data:application/json;base64,ey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XRlID0gbmV3IGxhbWJkYS5GdW5jdGlvbih0aGlzLCAnczNhc3NlcnQtaXMtY29tcGxldGUnLCB7XG4gICAgICBjb2RlOiBsYW1iZGEuQ29kZS5mcm9tQXNzZXQocGF0aC5qb2luKF9fZGlybmFtZSwgJ3MzLWFzc2VydC1oYW5kbGVyJykpLFxuICAgICAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuUFlUSE9OXzNfNyxcbiAgICAgIGhhbmRsZXI6ICdpbmRleC5pc19jb21wbGV0ZScsXG4gICAgICBpbml0aWFsUG9saWN5OiBbXG4gICAgICAgIG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgICAgICAgICByZXNvdXJjZXM6IFsnKiddLFxuICAgICAgICAgIGFjdGlvbnM6IFtcbiAgICAgICAgICAgICdzMzpHZXRPYmplY3QqJyxcbiAgICAgICAgICAgICdzMzpHZXRCdWNrZXQqJyxcbiAgICAgICAgICAgICdzMzpMaXN0KicsXG4gICAgICAgICAgXSxcbiAgICAgICAgfSksXG4gICAgICBdLFxuICAgIH0pO1xuXG4gICAgdGhpcy5wcm92aWRlciA9IG5ldyBjci5Qcm92aWRlcih0aGlzLCAnczNhc3NlcnQtcHJvdmlkZXInLCB7XG4gICAgICBvbkV2ZW50SGFuZGxlcjogb25FdmVudCxcbiAgICAgIGlzQ29tcGxldGVIYW5kbGVyOiBpc0NvbXBsZXRlLFxuICAgICAgdG90YWxUaW1lb3V0OiBEdXJhdGlvbi5taW51dGVzKDUpLFxuICAgIH0pO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts new file mode 100644 index 0000000000000..9874c4e84dc73 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts @@ -0,0 +1,95 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { CustomResource, Duration, Stack } from 'aws-cdk-lib'; +import { Construct, Node } from 'constructs'; +import * as cr from 'aws-cdk-lib/custom-resources'; + +export interface S3AssertProps { + /** + * The s3 bucket to query. + */ + readonly bucket: s3.IBucket; + + /** + * The object key. + */ + readonly objectKey: string; + + /** + * The expected contents. + */ + readonly expectedContent: string; +} + +/** + * A custom resource that asserts that a file on s3 has the specified contents. + * This resource will wait 10 minutes before, allowing for eventual consistency + * to stabilize (and also exercises the idea of asynchronous custom resources). + * + * Code is written in Python because why not. + */ +export class S3Assert extends Construct { + + constructor(scope: Construct, id: string, props: S3AssertProps) { + super(scope, id); + + new CustomResource(this, 'Resource', { + serviceToken: S3AssertProvider.getOrCreate(this), + resourceType: 'Custom::S3Assert', + properties: { + BucketName: props.bucket.bucketName, + ObjectKey: props.objectKey, + ExpectedContent: props.expectedContent, + }, + }); + } +} + +class S3AssertProvider extends Construct { + + /** + * Returns the singleton provider. + */ + public static getOrCreate(scope: Construct) { + const providerId = 'com.amazonaws.cdk.custom-resources.s3assert-provider'; + const stack = Stack.of(scope); + const group = Node.of(stack).tryFindChild(providerId) as S3AssertProvider || new S3AssertProvider(stack, providerId); + return group.provider.serviceToken; + } + + private readonly provider: cr.Provider; + + constructor(scope: Construct, id: string) { + super(scope, id); + + const onEvent = new lambda.Function(this, 's3assert-on-event', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.on_event', + }); + + const isComplete = new lambda.Function(this, 's3assert-is-complete', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.is_complete', + initialPolicy: [ + new iam.PolicyStatement({ + resources: ['*'], + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + }), + ], + }); + + this.provider = new cr.Provider(this, 's3assert-provider', { + onEventHandler: onEvent, + isCompleteHandler: isComplete, + totalTimeout: Duration.minutes(5), + }); + } +} diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.d.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.d.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.d.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.js similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/api.js rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.js diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts rename to packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.d.ts new file mode 100644 index 0000000000000..833e8cf000b4b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.d.ts @@ -0,0 +1,4 @@ +/// +export declare function onEvent(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; +export declare function putObject(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; +export declare function deleteObject(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.js new file mode 100644 index 0000000000000..78cab75936301 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.deleteObject = exports.putObject = exports.onEvent = void 0; +/// +/* eslint-disable no-console */ +const AWS = require("aws-sdk"); +const api = require("./api"); +const s3 = new AWS.S3(); +async function onEvent(event) { + switch (event.RequestType) { + case 'Create': + case 'Update': + return putObject(event); + case 'Delete': + return deleteObject(event); + } +} +exports.onEvent = onEvent; +async function putObject(event) { + const bucketName = event.ResourceProperties[api.PROP_BUCKET_NAME]; + if (!bucketName) { + throw new Error('"BucketName" is required'); + } + const contents = event.ResourceProperties[api.PROP_CONTENTS]; + if (!contents) { + throw new Error('"Contents" is required'); + } + // determine the object key which is the physical ID of the resource. + // if it was not provided by the user, we generated it using the request ID. + let objectKey = event.ResourceProperties[api.PROP_OBJECT_KEY] || event.LogicalResourceId + '-' + event.RequestId.replace(/-/g, '') + '.txt'; + // trim trailing `/` + if (objectKey.startsWith('/')) { + objectKey = objectKey.slice(1); + } + const publicRead = event.ResourceProperties[api.PROP_PUBLIC] || false; + console.log(`writing s3://${bucketName}/${objectKey}`); + const resp = await s3.putObject({ + Bucket: bucketName, + Key: objectKey, + Body: contents, + ACL: publicRead ? 'public-read' : undefined, + }).promise(); + // NOTE: updates to the object key will be handled automatically: a new object will be put and then we return + // the new name. this will tell cloudformation that the resource has been replaced and it will issue a DELETE + // for the old object. + return { + PhysicalResourceId: objectKey, + Data: { + [api.ATTR_OBJECT_KEY]: objectKey, + [api.ATTR_ETAG]: resp.ETag, + [api.ATTR_URL]: `https://${bucketName}.s3.amazonaws.com/${objectKey}`, + }, + }; +} +exports.putObject = putObject; +async function deleteObject(event) { + const bucketName = event.ResourceProperties.BucketName; + if (!bucketName) { + throw new Error('"BucketName" is required'); + } + const objectKey = event.PhysicalResourceId; + if (!objectKey) { + throw new Error('PhysicalResourceId expected for DELETE events'); + } + await s3.deleteObject({ + Bucket: bucketName, + Key: objectKey, + }).promise(); +} +exports.deleteObject = deleteObject; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrSEFBK0g7QUFDL0gsK0JBQStCO0FBQy9CLCtCQUErQjtBQUMvQiw2QkFBNkI7QUFFN0IsTUFBTSxFQUFFLEdBQUcsSUFBSSxHQUFHLENBQUMsRUFBRSxFQUFFLENBQUM7QUFFakIsS0FBSyxVQUFVLE9BQU8sQ0FBQyxLQUErQztJQUMzRSxRQUFRLEtBQUssQ0FBQyxXQUFXLEVBQUU7UUFDekIsS0FBSyxRQUFRLENBQUM7UUFDZCxLQUFLLFFBQVE7WUFDWCxPQUFPLFNBQVMsQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUUxQixLQUFLLFFBQVE7WUFDWCxPQUFPLFlBQVksQ0FBQyxLQUFLLENBQUMsQ0FBQztLQUM5QjtB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XMgcmVxdWlyZWQnKTsgfVxuXG4gIGNvbnN0IG9iamVjdEtleSA9IGV2ZW50LlBoeXNpY2FsUmVzb3VyY2VJZDtcbiAgaWYgKCFvYmplY3RLZXkpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoJ1BoeXNpY2FsUmVzb3VyY2VJZCBleHBlY3RlZCBmb3IgREVMRVRFIGV2ZW50cycpO1xuICB9XG5cbiAgYXdhaXQgczMuZGVsZXRlT2JqZWN0KHtcbiAgICBCdWNrZXQ6IGJ1Y2tldE5hbWUsXG4gICAgS2V5OiBvYmplY3RLZXksXG4gIH0pLnByb21pc2UoKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts new file mode 100644 index 0000000000000..28c6fe3021faa --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts @@ -0,0 +1,73 @@ +/// +/* eslint-disable no-console */ +import * as AWS from 'aws-sdk'; +import * as api from './api'; + +const s3 = new AWS.S3(); + +export async function onEvent(event: AWSCDKAsyncCustomResource.OnEventRequest) { + switch (event.RequestType) { + case 'Create': + case 'Update': + return putObject(event); + + case 'Delete': + return deleteObject(event); + } +} + +export async function putObject(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise { + const bucketName = event.ResourceProperties[api.PROP_BUCKET_NAME]; + if (!bucketName) { throw new Error('"BucketName" is required'); } + + const contents = event.ResourceProperties[api.PROP_CONTENTS]; + if (!contents) { throw new Error('"Contents" is required'); } + + // determine the object key which is the physical ID of the resource. + // if it was not provided by the user, we generated it using the request ID. + let objectKey = event.ResourceProperties[api.PROP_OBJECT_KEY] || event.LogicalResourceId + '-' + event.RequestId.replace(/-/g, '') + '.txt'; + + // trim trailing `/` + if (objectKey.startsWith('/')) { + objectKey = objectKey.slice(1); + } + + const publicRead = event.ResourceProperties[api.PROP_PUBLIC] || false; + + console.log(`writing s3://${bucketName}/${objectKey}`); + + const resp = await s3.putObject({ + Bucket: bucketName, + Key: objectKey, + Body: contents, + ACL: publicRead ? 'public-read' : undefined, + }).promise(); + + // NOTE: updates to the object key will be handled automatically: a new object will be put and then we return + // the new name. this will tell cloudformation that the resource has been replaced and it will issue a DELETE + // for the old object. + + return { + PhysicalResourceId: objectKey, + Data: { + [api.ATTR_OBJECT_KEY]: objectKey, + [api.ATTR_ETAG]: resp.ETag, + [api.ATTR_URL]: `https://${bucketName}.s3.amazonaws.com/${objectKey}`, + }, + }; +} + +export async function deleteObject(event: AWSCDKAsyncCustomResource.OnEventRequest) { + const bucketName = event.ResourceProperties.BucketName; + if (!bucketName) { throw new Error('"BucketName" is required'); } + + const objectKey = event.PhysicalResourceId; + if (!objectKey) { + throw new Error('PhysicalResourceId expected for DELETE events'); + } + + await s3.deleteObject({ + Bucket: bucketName, + Key: objectKey, + }).promise(); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.d.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.d.ts new file mode 100644 index 0000000000000..5c02666461fe1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.d.ts @@ -0,0 +1,31 @@ +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { Construct } from 'constructs'; +interface S3FileProps { + /** + * The bucket in which the file will be created. + */ + readonly bucket: s3.IBucket; + /** + * The object key. + * + * @default - automatically-generated + */ + readonly objectKey?: string; + /** + * The contents of the file. + */ + readonly contents: string; + /** + * Indicates if this file should have public-read permissions. + * + * @default false + */ + readonly public?: boolean; +} +export declare class S3File extends Construct { + readonly objectKey: string; + readonly url: string; + readonly etag: string; + constructor(scope: Construct, id: string, props: S3FileProps); +} +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.js b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.js new file mode 100644 index 0000000000000..1268a39e51010 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.S3File = void 0; +const path = require("path"); +const iam = require("aws-cdk-lib/aws-iam"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const constructs_1 = require("constructs"); +const api = require("./s3-file-handler/api"); +const cr = require("aws-cdk-lib/custom-resources"); +class S3File extends constructs_1.Construct { + constructor(scope, id, props) { + super(scope, id); + const resource = new aws_cdk_lib_1.CustomResource(this, 'Resource', { + serviceToken: S3FileProvider.getOrCreate(this), + resourceType: 'Custom::S3File', + properties: { + [api.PROP_BUCKET_NAME]: props.bucket.bucketName, + [api.PROP_CONTENTS]: props.contents, + [api.PROP_OBJECT_KEY]: props.objectKey, + [api.PROP_PUBLIC]: props.public, + }, + }); + this.objectKey = resource.getAttString(api.ATTR_OBJECT_KEY); + this.url = resource.getAttString(api.ATTR_URL); + this.etag = resource.getAttString(api.ATTR_ETAG); + } +} +exports.S3File = S3File; +class S3FileProvider extends constructs_1.Construct { + /** + * Returns the singleton provider. + */ + static getOrCreate(scope) { + const stack = aws_cdk_lib_1.Stack.of(scope); + const id = 'com.amazonaws.cdk.custom-resources.s3file-provider'; + const x = constructs_1.Node.of(stack).tryFindChild(id) || new S3FileProvider(stack, id); + return x.provider.serviceToken; + } + constructor(scope, id) { + super(scope, id); + this.provider = new cr.Provider(this, 's3file-provider', { + onEventHandler: new lambda.Function(this, 's3file-on-event', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-file-handler')), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.onEvent', + initialPolicy: [ + new iam.PolicyStatement({ + resources: ['*'], + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject*', + 's3:Abort*', + ], + }), + ], + }), + }); + } +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiczMtZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInMzLWZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsNkJBQTZCO0FBQzdCLDJDQUEyQztBQUMzQyxpREFBaUQ7QUFFakQsNkNBQW9EO0FBQ3BELDJDQUE2QztBQUM3Qyw2Q0FBNkM7QUFDN0MsbURBQW1EO0FBNEJuRCxNQUFhLE1BQU8sU0FBUSxzQkFBUztJQUtuQyxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsTUFBTSxRQUFRLEdBQUcsSUFBSSw0QkFBYyxDQUFDLElBQUksRUFBRSxVQUFVLEVBQUU7WUFDcEQsWUFBWSxFQUFFLGNBQWMsQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDO1lBQzlDLFlBQVksRUFBRSxnQkFBZ0I7WUFDOUIsVUFBVSxFQUFFO2dCQUNWLENBQUMsR0FBRyxDQUFDLGdCQUFnQixDQUFDLEVBQUUsS0FBSyxDQUFDLE1BQU0sQ0FBQyxVQUFVO2dCQUMvQyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsRUFBRSxLQUFLLENBQUMsUUFBUTtnQkFDbkMsQ0FBQyxHQUFHLENBQUMsZUFBZSxDQUFDLEVBQUUsS0FBSyxDQUFDLFNBQVM7Z0JBQ3RDLENBQUMsR0FBRyxDQUFDLFdBQVcsQ0FBQyxFQUFFLEtBQUssQ0FBQyx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LCBpZCk7XG4gICAgcmV0dXJuIHgucHJvdmlkZXIuc2VydmljZVRva2VuO1xuICB9XG5cbiAgcHJpdmF0ZSByZWFkb25seSBwcm92aWRlcjogY3IuUHJvdmlkZXI7XG5cbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZykge1xuICAgIHN1cGVyKHNjb3BlLCBpZCk7XG5cbiAgICB0aGlzLnByb3ZpZGVyID0gbmV3IGNyLlByb3ZpZGVyKHRoaXMsICdzM2ZpbGUtcHJvdmlkZXInLCB7XG4gICAgICBvbkV2ZW50SGFuZGxlcjogbmV3IGxhbWJkYS5GdW5jdGlvbih0aGlzLCAnczNmaWxlLW9uLWV2ZW50Jywge1xuICAgICAgICBjb2RlOiBsYW1iZGEuQ29kZS5mcm9tQXNzZXQocGF0aC5qb2luKF9fZGlybmFtZSwgJ3MzLWZpbGUtaGFuZGxlcicpKSxcbiAgICAgICAgcnVudGltZTogbGFtYmRhLlJ1bnRpbWUuTk9ERUpTXzE0X1gsXG4gICAgICAgIGhhbmRsZXI6ICdpbmRleC5vbkV2ZW50JyxcbiAgICAgICAgaW5pdGlhbFBvbGljeTogW1xuICAgICAgICAgIG5ldyBpYW0uUG9saWN5U3RhdGVtZW50KHtcbiAgICAgICAgICAgIHJlc291cmNlczogWycqJ10sXG4gICAgICAgICAgICBhY3Rpb25zOiBbXG4gICAgICAgICAgICAgICdzMzpHZXRPYmplY3QqJyxcbiAgICAgICAgICAgICAgJ3MzOkdldEJ1Y2tldConLFxuICAgICAgICAgICAgICAnczM6TGlzdConLFxuICAgICAgICAgICAgICAnczM6RGVsZXRlT2JqZWN0KicsXG4gICAgICAgICAgICAgICdzMzpQdXRPYmplY3QqJyxcbiAgICAgICAgICAgICAgJ3MzOkFib3J0KicsXG4gICAgICAgICAgICBdLFxuICAgICAgICAgIH0pLFxuICAgICAgICBdLFxuICAgICAgfSksXG4gICAgfSk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts new file mode 100644 index 0000000000000..6ab5483a7abde --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts @@ -0,0 +1,99 @@ +import * as path from 'path'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { CustomResource, Stack } from 'aws-cdk-lib'; +import { Construct, Node } from 'constructs'; +import * as api from './s3-file-handler/api'; +import * as cr from 'aws-cdk-lib/custom-resources'; + +interface S3FileProps { + /** + * The bucket in which the file will be created. + */ + readonly bucket: s3.IBucket; + + /** + * The object key. + * + * @default - automatically-generated + */ + readonly objectKey?: string; + + /** + * The contents of the file. + */ + readonly contents: string; + + /** + * Indicates if this file should have public-read permissions. + * + * @default false + */ + readonly public?: boolean; +} + +export class S3File extends Construct { + public readonly objectKey: string; + public readonly url: string; + public readonly etag: string; + + constructor(scope: Construct, id: string, props: S3FileProps) { + super(scope, id); + + const resource = new CustomResource(this, 'Resource', { + serviceToken: S3FileProvider.getOrCreate(this), + resourceType: 'Custom::S3File', + properties: { + [api.PROP_BUCKET_NAME]: props.bucket.bucketName, + [api.PROP_CONTENTS]: props.contents, + [api.PROP_OBJECT_KEY]: props.objectKey, + [api.PROP_PUBLIC]: props.public, + }, + }); + + this.objectKey = resource.getAttString(api.ATTR_OBJECT_KEY); + this.url = resource.getAttString(api.ATTR_URL); + this.etag = resource.getAttString(api.ATTR_ETAG); + } +} + +class S3FileProvider extends Construct { + + /** + * Returns the singleton provider. + */ + public static getOrCreate(scope: Construct) { + const stack = Stack.of(scope); + const id = 'com.amazonaws.cdk.custom-resources.s3file-provider'; + const x = Node.of(stack).tryFindChild(id) as S3FileProvider || new S3FileProvider(stack, id); + return x.provider.serviceToken; + } + + private readonly provider: cr.Provider; + + constructor(scope: Construct, id: string) { + super(scope, id); + + this.provider = new cr.Provider(this, 's3file-provider', { + onEventHandler: new lambda.Function(this, 's3file-on-event', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-file-handler')), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.onEvent', + initialPolicy: [ + new iam.PolicyStatement({ + resources: ['*'], + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject*', + 's3:Abort*', + ], + }), + ], + }), + }); + } +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.d.ts b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js new file mode 100644 index 0000000000000..121fc7924f76a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const cr = require("aws-cdk-lib/custom-resources"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const lambda_layer_awscli_1 = require("aws-cdk-lib/lambda-layer-awscli"); +/** + * Test verifies that AWS CLI is invoked successfully inside Lambda runtime. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-layer-awscli-integ-stack'); +const layer = new lambda_layer_awscli_1.AwsCliLayer(stack, 'AwsCliLayer'); +const runtimes = [ + lambda.Runtime.PYTHON_3_7, + lambda.Runtime.PYTHON_3_9, +]; +for (const runtime of runtimes) { + const provider = new cr.Provider(stack, `Provider${runtime.name}`, { + onEventHandler: new lambda.Function(stack, `Lambda$${runtime.name}`, { + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), + handler: 'index.handler', + runtime: runtime, + layers: [layer], + memorySize: 512, + timeout: cdk.Duration.seconds(30), + }), + }); + new cdk.CustomResource(stack, `CustomResource${runtime.name}`, { + serviceToken: provider.serviceToken, + }); +} +new integ.IntegTest(app, 'lambda-layer-awscli-integ-test', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcuYXdzY2xpLWxheWVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcuYXdzY2xpLWxheWVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsNkJBQTZCO0FBQzdCLGlEQUFpRDtBQUNqRCxtQ0FBbUM7QUFDbkMsbURBQW1EO0FBQ25ELG9EQUFvRDtBQUVwRCx5RUFBOEQ7QUFFOUQ7O0dBRUc7QUFFSCxNQUFNLEdBQUcsR0FBRyxJQUFJLEdBQUcsQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUMxQixNQUFNLEtBQUssR0FBRyxJQUFJLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLGlDQUFpQyxDQUFDLENBQUM7QUFDcEUsTUFBTSxLQUFLLEdBQUcsSUFBSSxpQ0FBVyxDQUFDLEtBQUssRUFBRSxhQUFhLENBQUMsQ0FBQztBQUVwRCxNQUFNLFFBQVEsR0FBRztJQUNmLE1BQU0sQ0FBQyxPQUFPLENBQUMsVUFBVTtJQUN6QixNQUFNLENBQUMsT0FBTyxDQUFDLFVBQVU7Q0FDMU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W50aW1lLm5hbWV9YCwge1xuICAgICAgY29kZTogbGFtYmRhLkNvZGUuZnJvbUFzc2V0KHBhdGguam9pbihfX2Rpcm5hbWUsICdsYW1iZGEtaGFuZGxlcicpKSxcbiAgICAgIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgICAgIHJ1bnRpbWU6IHJ1bnRpbWUsXG4gICAgICBsYXllcnM6IFtsYXllcl0sXG4gICAgICBtZW1vcnlTaXplOiA1MTIsXG4gICAgICB0aW1lb3V0OiBjZGsuRHVyYXRpb24uc2Vjb25kcygzMCksXG4gICAgfSksXG4gIH0pO1xuXG4gIG5ldyBjZGsuQ3VzdG9tUmVzb3VyY2Uoc3RhY2ssIGBDdXN0b21SZXNvdXJjZSR7cnVudGltZS5uYW1lfWAsIHtcbiAgICBzZXJ2aWNlVG9rZW46IHByb3ZpZGVyLnNlcnZpY2VUb2tlbixcbiAgfSk7XG59XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnbGFtYmRhLWxheWVyLWF3c2NsaS1pbnRlZy10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG4gIGNka0NvbW1hbmRPcHRpb25zOiB7XG4gICAgZGVwbG95OiB7XG4gICAgICBhcmdzOiB7XG4gICAgICAgIHJvbGxiYWNrOiB0cnVlLFxuICAgICAgfSxcbiAgICB9LFxuICB9LFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5d8d1d0aacea23824c62f362e1e3c14b7dd14a31c71b53bfae4d14a6373c5510.zip diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5dff6208ccd5fb196bb0354fd6e47faa8431a789e6125d20386586fef761ed48/index.py b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5dff6208ccd5fb196bb0354fd6e47faa8431a789e6125d20386586fef761ed48/index.py similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5dff6208ccd5fb196bb0354fd6e47faa8431a789e6125d20386586fef761ed48/index.py rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.5dff6208ccd5fb196bb0354fd6e47faa8431a789e6125d20386586fef761ed48/index.py diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/integ.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.assets.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.assets.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambda-layer-awscli-integ-stack.template.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.template.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.template.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/tree.json diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.ts similarity index 80% rename from packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.ts index 5ef54ae8706a2..cd58a415b2c6a 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/integ.awscli-layer.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import * as integ from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import * as integ from '@aws-cdk/integ-tests-alpha'; -import { AwsCliLayer } from '../lib'; +import { AwsCliLayer } from 'aws-cdk-lib/lambda-layer-awscli'; /** * Test verifies that AWS CLI is invoked successfully inside Lambda runtime. diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/lambda-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/lambda-handler/index.py similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/lambda-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-awscli/test/lambda-handler/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.d.ts b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js new file mode 100644 index 0000000000000..4b8ce5573358b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const cr = require("aws-cdk-lib/custom-resources"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const lambda_layer_kubectl_1 = require("aws-cdk-lib/lambda-layer-kubectl"); +/** + * Test verifies that kubectl and helm are invoked successfully inside Lambda runtime. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-layer-kubectl-integ-stack'); +const layer = new lambda_layer_kubectl_1.KubectlLayer(stack, 'KubectlLayer'); +const runtimes = [ + lambda.Runtime.PYTHON_3_7, + lambda.Runtime.PYTHON_3_9, +]; +for (const runtime of runtimes) { + const provider = new cr.Provider(stack, `Provider${runtime.name}`, { + onEventHandler: new lambda.Function(stack, `Lambda$${runtime.name}`, { + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), + handler: 'index.handler', + runtime: runtime, + layers: [layer], + memorySize: 512, + timeout: cdk.Duration.seconds(30), + }), + }); + new cdk.CustomResource(stack, `CustomResource${runtime.name}`, { + serviceToken: provider.serviceToken, + }); +} +new integ.IntegTest(app, 'lambda-layer-kubectl-integ-test', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcua3ViZWN0bC1sYXllci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLmt1YmVjdGwtbGF5ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSw2QkFBNkI7QUFDN0IsaURBQWlEO0FBQ2pELG1DQUFtQztBQUNuQyxtREFBbUQ7QUFDbkQsb0RBQW9EO0FBRXBELDJFQUFnRTtBQUVoRTs7R0FFRztBQUVILE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQzFCLE1BQU0sS0FBSyxHQUFHLElBQUksR0FBRyxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsa0NBQWtDLENBQUMsQ0FBQztBQUNy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l8zXzksXG5dO1xuXG5mb3IgKGNvbnN0IHJ1bnRpbWUgb2YgcnVudGltZXMpIHtcbiAgY29uc3QgcHJvdmlkZXIgPSBuZXcgY3IuUHJvdmlkZXIoc3RhY2ssIGBQcm92aWRlciR7cnVudGltZS5uYW1lfWAsIHtcbiAgICBvbkV2ZW50SGFuZGxlcjogbmV3IGxhbWJkYS5GdW5jdGlvbihzdGFjaywgYExhbWJkYSQke3J1bnRpbWUubmFtZX1gLCB7XG4gICAgICBjb2RlOiBsYW1iZGEuQ29kZS5mcm9tQXNzZXQocGF0aC5qb2luKF9fZGlybmFtZSwgJ2xhbWJkYS1oYW5kbGVyJykpLFxuICAgICAgaGFuZGxlcjogJ2luZGV4LmhhbmRsZXInLFxuICAgICAgcnVudGltZTogcnVudGltZSxcbiAgICAgIGxheWVyczogW2xheWVyXSxcbiAgICAgIG1lbW9yeVNpemU6IDUxMixcbiAgICAgIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbiAgICB9KSxcbiAgfSk7XG5cbiAgbmV3IGNkay5DdXN0b21SZXNvdXJjZShzdGFjaywgYEN1c3RvbVJlc291cmNlJHtydW50aW1lLm5hbWV9YCwge1xuICAgIHNlcnZpY2VUb2tlbjogcHJvdmlkZXIuc2VydmljZVRva2VuLFxuICB9KTtcbn1cblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdsYW1iZGEtbGF5ZXIta3ViZWN0bC1pbnRlZy10ZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG4gIGNka0NvbW1hbmRPcHRpb25zOiB7XG4gICAgZGVwbG95OiB7XG4gICAgICBhcmdzOiB7XG4gICAgICAgIHJvbGxiYWNrOiB0cnVlLFxuICAgICAgfSxcbiAgICB9LFxuICB9LFxufSk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.7e5f48d1e79c915595d938c932b6f0101715a162780d01a55845367e014fbcda.zip diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.d7e7dde0df178e20d82e70ae55bb9fb58d53bfb2da9dbb92c07f1437c7bdf841/index.py b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.d7e7dde0df178e20d82e70ae55bb9fb58d53bfb2da9dbb92c07f1437c7bdf841/index.py similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.d7e7dde0df178e20d82e70ae55bb9fb58d53bfb2da9dbb92c07f1437c7bdf841/index.py rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/asset.d7e7dde0df178e20d82e70ae55bb9fb58d53bfb2da9dbb92c07f1437c7bdf841/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine-credentials.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/integ.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.assets.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.assets.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambda-layer-kubectl-integ-stack.template.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.assets.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.assets.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.template.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/lambdalayerkubectlintegtestDefaultTestDeployAssertB3B33DD7.template.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/tree.json diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.ts b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.ts similarity index 80% rename from packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.ts rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.ts index f37ada2811b1e..d99f37fe9ca48 100644 --- a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/integ.kubectl-layer.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import * as integ from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import * as integ from '@aws-cdk/integ-tests-alpha'; -import { KubectlLayer } from '../lib'; +import { KubectlLayer } from 'aws-cdk-lib/lambda-layer-kubectl'; /** * Test verifies that kubectl and helm are invoked successfully inside Lambda runtime. diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/lambda-handler/index.py b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/lambda-handler/index.py similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/test/lambda-handler/index.py rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-kubectl/test/lambda-handler/index.py diff --git a/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.d.ts b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js new file mode 100644 index 0000000000000..dde0cc9ab96d5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const cdk = require("aws-cdk-lib"); +const cr = require("aws-cdk-lib/custom-resources"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const lambda_layer_node_proxy_agent_1 = require("aws-cdk-lib/lambda-layer-node-proxy-agent"); +/** + * Test verifies that node-proxy-agent is invoked successfully inside Lambda runtime. + */ +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'lambda-layer-node-proxy-agent-integ-stack'); +const layer = new lambda_layer_node_proxy_agent_1.NodeProxyAgentLayer(stack, 'NodeProxyAgentLayer'); +const provider = new cr.Provider(stack, 'ProviderNode14', { + onEventHandler: new lambda.Function(stack, 'Lambda$Node14', { + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + layers: [layer], + memorySize: 512, + timeout: cdk.Duration.seconds(30), + }), +}); +new cdk.CustomResource(stack, 'CustomResourceNode14', { + serviceToken: provider.serviceToken, +}); +new integ.IntegTest(app, 'lambda-layer-node-proxy-agent-integ-test', { + testCases: [stack], + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubm9kZS1wcm94eS1hZ2VudC5qcyIsInNvdXJjZVJvb3QiOiI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GxheWVyID0gbmV3IE5vZGVQcm94eUFnZW50TGF5ZXIoc3RhY2ssICdOb2RlUHJveHlBZ2VudExheWVyJyk7XG5cbmNvbnN0IHByb3ZpZGVyID0gbmV3IGNyLlByb3ZpZGVyKHN0YWNrLCAnUHJvdmlkZXJOb2RlMTQnLCB7XG4gIG9uRXZlbnRIYW5kbGVyOiBuZXcgbGFtYmRhLkZ1bmN0aW9uKHN0YWNrLCAnTGFtYmRhJE5vZGUxNCcsIHtcbiAgICBjb2RlOiBsYW1iZGEuQ29kZS5mcm9tQXNzZXQocGF0aC5qb2luKF9fZGlybmFtZSwgJ2xhbWJkYS1oYW5kbGVyJykpLFxuICAgIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5OT0RFSlNfMTRfWCxcbiAgICBsYXllcnM6IFtsYXllcl0sXG4gICAgbWVtb3J5U2l6ZTogNTEyLFxuICAgIHRpbWVvdXQ6IGNkay5EdXJhdGlvbi5zZWNvbmRzKDMwKSxcbiAgfSksXG59KTtcblxubmV3IGNkay5DdXN0b21SZXNvdXJjZShzdGFjaywgJ0N1c3RvbVJlc291cmNlTm9kZTE0Jywge1xuICBzZXJ2aWNlVG9rZW46IHByb3ZpZGVyLnNlcnZpY2VUb2tlbixcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ2xhbWJkYS1sYXllci1ub2RlLXByb3h5LWFnZW50LWludGVnLXRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbiAgY2RrQ29tbWFuZE9wdGlvbnM6IHtcbiAgICBkZXBsb3k6IHtcbiAgICAgIGFyZ3M6IHtcbiAgICAgICAgcm9sbGJhY2s6IHRydWUsXG4gICAgICB9LFxuICAgIH0sXG4gIH0sXG59KTsiXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.06c04d53e96719c6077dd6ff79d66b48853e9fe13d109ba06cbec8c094a69657/index.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.06c04d53e96719c6077dd6ff79d66b48853e9fe13d109ba06cbec8c094a69657/index.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.06c04d53e96719c6077dd6ff79d66b48853e9fe13d109ba06cbec8c094a69657/index.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.06c04d53e96719c6077dd6ff79d66b48853e9fe13d109ba06cbec8c094a69657/index.js diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/cfn-response.js diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/consts.js diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/framework.js diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/outbound.js diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.a8a62b989c7866e3ad5b24f3eb6228f8ca91ebff5f5c76f1da466f6c805c0585/util.js diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/asset.ad44c2b0638f04871c889d78e71dea90ffae67b9cc4aa4366d5102db42435ee1.zip diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/integ.state-machine.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/integ.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.assets.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.assets.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambda-layer-node-proxy-agent-integ-stack.template.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.assets.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.assets.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.assets.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.template.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.template.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/lambdalayernodeproxyagentintegtestDefaultTestDeployAssert951A1212.template.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/tree.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.ts b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.ts similarity index 77% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.ts rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.ts index 7c2c52cd2ae3d..e08db5591d6c0 100644 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import * as integ from '@aws-cdk/integ-tests'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import * as integ from '@aws-cdk/integ-tests-alpha'; -import { NodeProxyAgentLayer } from '../lib'; +import { NodeProxyAgentLayer } from 'aws-cdk-lib/lambda-layer-node-proxy-agent'; /** * Test verifies that node-proxy-agent is invoked successfully inside Lambda runtime. diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/lambda-handler/index.js b/packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/lambda-handler/index.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/lambda-handler/index.js rename to packages/@aws-cdk-testing/framework-integ/test/lambda-layer-node-proxy-agent/test/lambda-handler/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js new file mode 100644 index 0000000000000..bc17bb1e7c715 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const pipelines = require("aws-cdk-lib/pipelines"); +class PipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + crossAccountKeys: true, + enableKeyRotation: true, + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.gitHub('tkglaser/cdk-pipelines-demo', 'main'), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), + }); + pipeline.addStage(new AppStage(this, 'Beta')); + const group = pipeline.addWave('Wave1'); + group.addStage(new AppStage(this, 'Prod1')); + group.addStage(new AppStage(this, 'Prod2')); + const group2 = pipeline.addWave('Wave2'); + group2.addStage(new AppStage(this, 'Prod3')); + group2.addStage(new AppStage(this, 'Prod4')); + group2.addStage(new AppStage(this, 'Prod5')); + group2.addStage(new AppStage(this, 'Prod6')); + } +} +class AppStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack1 = new aws_cdk_lib_1.Stack(this, 'Stack1'); + const queue1 = new sqs.Queue(stack1, 'Queue'); + const stack2 = new aws_cdk_lib_1.Stack(this, 'Stack2'); + new sqs.Queue(stack2, 'OtherQueue', { + deadLetterQueue: { + queue: queue1, + maxReceiveCount: 5, + }, + }); + } +} +const app = new aws_cdk_lib_1.App(); +const stack = new PipelineStack(app, 'PipelineStack'); +new integ.IntegTest(app, 'LambdaTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmV3cGlwZWxpbmUtd2l0aC1jcm9zcy1hY2NvdW50LWtleXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5uZXdwaXBlbGluZS13aXRoLWNyb3NzLWFjY291bnQta2V5cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDJDQUEyQztBQUMzQyw2Q0FBd0U7QUFDeEUsb0RBQW9EO0FBR3BELG1EQUFtRDtBQUVuRCxNQUFNLGFBQWMsU0FBUSxtQkFBSztJQUMvQixZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLE1BQU0sUUFBUSxHQUFHLElBQUksU0FBUyxDQUFDLFlBQVksQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFO1lBQzVELGdCQUFnQix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OiBxdWV1ZTEsXG4gICAgICAgIG1heFJlY2VpdmVDb3VudDogNSxcbiAgICAgIH0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCgpO1xuXG5jb25zdCBzdGFjayA9IG5ldyBQaXBlbGluZVN0YWNrKGFwcCwgJ1BpcGVsaW5lU3RhY2snKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdMYW1iZGFUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json similarity index 96% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json index ac81843aa3aef..5e84c5907c2b7 100644 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.assets.json @@ -1,5 +1,5 @@ { - "version": "30.1.0", + "version": "31.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/LambdaTestDefaultTestDeployAssert1AF2B360.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.assets.json new file mode 100644 index 0000000000000..9cb253d1a4c55 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "5e7bb85d81710361d2e2b5fba94f50ef4141aa3fc151119f5b8d5d786c9c149e": { + "source": { + "path": "PipelineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5e7bb85d81710361d2e2b5fba94f50ef4141aa3fc151119f5b8d5d786c9c149e.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.template.json new file mode 100644 index 0000000000000..b9e86731073b3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.template.json @@ -0,0 +1,2546 @@ +{ + "Resources": { + "PipelineArtifactsBucketEncryptionKeyF5BF0670": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "EnableKeyRotation": true + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { + "Type": "AWS::KMS::Alias", + "Properties": { + "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "TargetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketAEA9A052": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "KMSMasterKeyID": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "SSEAlgorithm": "aws:kms" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "PipelineArtifactsBucketPolicyF53CCC52": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleB27FAA37": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicy7BDC1ABB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "Roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "Pipeline9850B417": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "ThirdParty", + "Provider": "GitHub", + "Version": "1" + }, + "Configuration": { + "Owner": "tkglaser", + "Repo": "cdk-pipelines-demo", + "Branch": "main", + "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", + "PollForSourceChanges": false + }, + "Name": "tkglaser_cdk-pipelines-demo", + "OutputArtifacts": [ + { + "Name": "tkglaser_cdk_pipelines_demo_Source" + } + ], + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" + }, + "InputArtifacts": [ + { + "Name": "tkglaser_cdk_pipelines_demo_Source" + } + ], + "Name": "Synth", + "OutputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Build" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"d481eb7e52fa70e98aa3e0e22b2f258bef28632bc13e90928d96c7e1479e3a2b\"}]" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "SelfMutate", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "UpdatePipeline" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + } + ], + "Name": "Beta" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod1.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod2.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod1.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod2.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod1.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod2.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod1.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod2.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + } + ], + "Name": "Wave1" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod3.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod4.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod5.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod6.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod3.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod4.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod5.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod6.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod3.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod4.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod5.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod6.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod3.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod4.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod5.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod6.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + } + ], + "Name": "Wave2" + } + ], + "ArtifactStore": { + "EncryptionKey": { + "Id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Type": "KMS" + }, + "Location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "Type": "S3" + }, + "RestartExecutionOnUpdate": true + }, + "DependsOn": [ + "PipelineRoleDefaultPolicy7BDC1ABB", + "PipelineRoleB27FAA37" + ] + }, + "PipelineSourcetkglasercdkpipelinesdemoWebhookResource54EE51BE": { + "Type": "AWS::CodePipeline::Webhook", + "Properties": { + "Authentication": "GITHUB_HMAC", + "AuthenticationConfiguration": { + "SecretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" + }, + "Filters": [ + { + "JsonPath": "$.ref", + "MatchEquals": "refs/heads/{Branch}" + } + ], + "TargetAction": "tkglaser_cdk-pipelines-demo", + "TargetPipeline": { + "Ref": "Pipeline9850B417" + }, + "TargetPipelineVersion": 1, + "RegisterWithThirdParty": true + } + }, + "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProject6BEFA8E6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/Build/Synth", + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineCodeBuildActionRole226DB0CB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "Bool": { + "aws:ViaAWSService": "codepipeline.amazonaws.com" + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", + "Roles": [ + { + "Ref": "PipelineCodeBuildActionRole226DB0CB" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationRole57E559E8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationDAA41400": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStackPipeline9DB740AF.dot b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStackPipeline9DB740AF.dot similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStackPipeline9DB740AF.dot rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStackPipeline9DB740AF.dot diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json new file mode 100644 index 0000000000000..216c3528dcab8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65": { + "source": { + "path": "PipelineStackBetaStack1E6541489.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json new file mode 100644 index 0000000000000..9e43ccbe2df62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326": { + "source": { + "path": "PipelineStackBetaStack2C79AD00A.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/manifest.json new file mode 100644 index 0000000000000..594f450e28ad8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackBetaStack1E6541489.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackBetaStack1E6541489.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackBetaStack1E6541489": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackBetaStack1E6541489.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackBetaStack1E6541489.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Beta-Stack1" + }, + "dependencies": [ + "PipelineStackBetaStack1E6541489.assets" + ], + "metadata": { + "/PipelineStack/Beta/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Beta/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Beta/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Beta/Stack1" + }, + "PipelineStackBetaStack2C79AD00A.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackBetaStack2C79AD00A.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackBetaStack2C79AD00A": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackBetaStack2C79AD00A.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackBetaStack2C79AD00A.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Beta-Stack2" + }, + "dependencies": [ + "PipelineStackBetaStack1E6541489", + "PipelineStackBetaStack2C79AD00A.assets" + ], + "metadata": { + "/PipelineStack/Beta/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Beta/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Beta/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Beta/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json new file mode 100644 index 0000000000000..a0f0b275109b1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3": { + "source": { + "path": "PipelineStackProd1Stack14013D698.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json new file mode 100644 index 0000000000000..a353a3353a451 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059": { + "source": { + "path": "PipelineStackProd1Stack2F0681AFF.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/manifest.json new file mode 100644 index 0000000000000..0bcf638cb353d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd1Stack14013D698.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd1Stack14013D698.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd1Stack14013D698": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd1Stack14013D698.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd1Stack14013D698.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod1-Stack1" + }, + "dependencies": [ + "PipelineStackProd1Stack14013D698.assets" + ], + "metadata": { + "/PipelineStack/Prod1/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod1/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod1/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod1/Stack1" + }, + "PipelineStackProd1Stack2F0681AFF.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd1Stack2F0681AFF.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd1Stack2F0681AFF": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd1Stack2F0681AFF.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd1Stack2F0681AFF.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod1-Stack2" + }, + "dependencies": [ + "PipelineStackProd1Stack14013D698", + "PipelineStackProd1Stack2F0681AFF.assets" + ], + "metadata": { + "/PipelineStack/Prod1/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod1/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod1/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod1/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json new file mode 100644 index 0000000000000..b4ba394fe5593 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68": { + "source": { + "path": "PipelineStackProd2Stack1FD464162.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json new file mode 100644 index 0000000000000..ff7a88294f34b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9": { + "source": { + "path": "PipelineStackProd2Stack2176123EB.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/manifest.json new file mode 100644 index 0000000000000..c355127a22618 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd2Stack1FD464162.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd2Stack1FD464162.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd2Stack1FD464162": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd2Stack1FD464162.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd2Stack1FD464162.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod2-Stack1" + }, + "dependencies": [ + "PipelineStackProd2Stack1FD464162.assets" + ], + "metadata": { + "/PipelineStack/Prod2/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod2/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod2/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod2/Stack1" + }, + "PipelineStackProd2Stack2176123EB.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd2Stack2176123EB.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd2Stack2176123EB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd2Stack2176123EB.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd2Stack2176123EB.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod2-Stack2" + }, + "dependencies": [ + "PipelineStackProd2Stack1FD464162", + "PipelineStackProd2Stack2176123EB.assets" + ], + "metadata": { + "/PipelineStack/Prod2/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod2/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod2/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod2/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json new file mode 100644 index 0000000000000..6ddd60f7ac5d5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff": { + "source": { + "path": "PipelineStackProd3Stack1795F3D43.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json new file mode 100644 index 0000000000000..15ac86fbb3d1b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99": { + "source": { + "path": "PipelineStackProd3Stack2DFBBA0B2.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/manifest.json new file mode 100644 index 0000000000000..3e5d77e11f064 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd3Stack1795F3D43.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd3Stack1795F3D43.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd3Stack1795F3D43": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd3Stack1795F3D43.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd3Stack1795F3D43.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod3-Stack1" + }, + "dependencies": [ + "PipelineStackProd3Stack1795F3D43.assets" + ], + "metadata": { + "/PipelineStack/Prod3/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod3/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod3/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod3/Stack1" + }, + "PipelineStackProd3Stack2DFBBA0B2.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd3Stack2DFBBA0B2.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd3Stack2DFBBA0B2": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd3Stack2DFBBA0B2.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd3Stack2DFBBA0B2.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod3-Stack2" + }, + "dependencies": [ + "PipelineStackProd3Stack1795F3D43", + "PipelineStackProd3Stack2DFBBA0B2.assets" + ], + "metadata": { + "/PipelineStack/Prod3/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod3/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod3/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod3/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json new file mode 100644 index 0000000000000..edc13cf3ff6d4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78": { + "source": { + "path": "PipelineStackProd4Stack118F74ADB.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json new file mode 100644 index 0000000000000..29af583241fca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd": { + "source": { + "path": "PipelineStackProd4Stack2E2CB4ED3.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/manifest.json new file mode 100644 index 0000000000000..d347c675cc6bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd4Stack118F74ADB.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd4Stack118F74ADB.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd4Stack118F74ADB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd4Stack118F74ADB.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd4Stack118F74ADB.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod4-Stack1" + }, + "dependencies": [ + "PipelineStackProd4Stack118F74ADB.assets" + ], + "metadata": { + "/PipelineStack/Prod4/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod4/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod4/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod4/Stack1" + }, + "PipelineStackProd4Stack2E2CB4ED3.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd4Stack2E2CB4ED3.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd4Stack2E2CB4ED3": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd4Stack2E2CB4ED3.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd4Stack2E2CB4ED3.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod4-Stack2" + }, + "dependencies": [ + "PipelineStackProd4Stack118F74ADB", + "PipelineStackProd4Stack2E2CB4ED3.assets" + ], + "metadata": { + "/PipelineStack/Prod4/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod4/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod4/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod4/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json new file mode 100644 index 0000000000000..44bcf91a50021 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7": { + "source": { + "path": "PipelineStackProd5Stack1E7E4E4C6.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json new file mode 100644 index 0000000000000..42799cb0799d2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8": { + "source": { + "path": "PipelineStackProd5Stack2C39BEE5B.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/manifest.json new file mode 100644 index 0000000000000..1abe7afb824d3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd5Stack1E7E4E4C6.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd5Stack1E7E4E4C6.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd5Stack1E7E4E4C6": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd5Stack1E7E4E4C6.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd5Stack1E7E4E4C6.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod5-Stack1" + }, + "dependencies": [ + "PipelineStackProd5Stack1E7E4E4C6.assets" + ], + "metadata": { + "/PipelineStack/Prod5/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod5/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod5/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod5/Stack1" + }, + "PipelineStackProd5Stack2C39BEE5B.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd5Stack2C39BEE5B.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd5Stack2C39BEE5B": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd5Stack2C39BEE5B.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd5Stack2C39BEE5B.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod5-Stack2" + }, + "dependencies": [ + "PipelineStackProd5Stack1E7E4E4C6", + "PipelineStackProd5Stack2C39BEE5B.assets" + ], + "metadata": { + "/PipelineStack/Prod5/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod5/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod5/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod5/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json new file mode 100644 index 0000000000000..79eb72847d519 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813": { + "source": { + "path": "PipelineStackProd6Stack1E7C34314.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json new file mode 100644 index 0000000000000..e9833a6066b2d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30": { + "source": { + "path": "PipelineStackProd6Stack2BED1BBCE.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/manifest.json new file mode 100644 index 0000000000000..f79f20c324fb2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd6Stack1E7C34314.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd6Stack1E7C34314.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd6Stack1E7C34314": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd6Stack1E7C34314.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd6Stack1E7C34314.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod6-Stack1" + }, + "dependencies": [ + "PipelineStackProd6Stack1E7C34314.assets" + ], + "metadata": { + "/PipelineStack/Prod6/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod6/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod6/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod6/Stack1" + }, + "PipelineStackProd6Stack2BED1BBCE.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd6Stack2BED1BBCE.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd6Stack2BED1BBCE": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd6Stack2BED1BBCE.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd6Stack2BED1BBCE.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod6-Stack2" + }, + "dependencies": [ + "PipelineStackProd6Stack1E7C34314", + "PipelineStackProd6Stack2BED1BBCE.assets" + ], + "metadata": { + "/PipelineStack/Prod6/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod6/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod6/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod6/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/integ.json new file mode 100644 index 0000000000000..5a0d6b466fbe3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "31.0.0", + "testCases": { + "LambdaTest/DefaultTest": { + "stacks": [ + "PipelineStack" + ], + "assertionStack": "LambdaTest/DefaultTest/DeployAssert", + "assertionStackName": "LambdaTestDefaultTestDeployAssert1AF2B360" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/manifest.json new file mode 100644 index 0000000000000..a09bc103fde26 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/manifest.json @@ -0,0 +1,250 @@ +{ + "version": "31.0.0", + "artifacts": { + "assembly-PipelineStack-Beta": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Beta", + "displayName": "PipelineStack/Beta" + } + }, + "assembly-PipelineStack-Prod1": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod1", + "displayName": "PipelineStack/Prod1" + } + }, + "assembly-PipelineStack-Prod2": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod2", + "displayName": "PipelineStack/Prod2" + } + }, + "assembly-PipelineStack-Prod3": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod3", + "displayName": "PipelineStack/Prod3" + } + }, + "assembly-PipelineStack-Prod4": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod4", + "displayName": "PipelineStack/Prod4" + } + }, + "assembly-PipelineStack-Prod5": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod5", + "displayName": "PipelineStack/Prod5" + } + }, + "assembly-PipelineStack-Prod6": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod6", + "displayName": "PipelineStack/Prod6" + } + }, + "PipelineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5e7bb85d81710361d2e2b5fba94f50ef4141aa3fc151119f5b8d5d786c9c149e.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "PipelineStack.assets" + ], + "metadata": { + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketAEA9A052" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketPolicyF53CCC52" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleB27FAA37" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleDefaultPolicy7BDC1ABB" + } + ], + "/PipelineStack/Pipeline/Pipeline/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Pipeline9850B417" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/tkglaser_cdk-pipelines-demo/WebhookResource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourcetkglasercdkpipelinesdemoWebhookResource54EE51BE" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ], + "/PipelineStack/Pipeline/CodeBuildActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineCodeBuildActionRole226DB0CB" + } + ], + "/PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ], + "/PipelineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack" + }, + "LambdaTestDefaultTestDeployAssert1AF2B360.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "LambdaTestDefaultTestDeployAssert1AF2B360.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "LambdaTestDefaultTestDeployAssert1AF2B360": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "LambdaTestDefaultTestDeployAssert1AF2B360.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "LambdaTestDefaultTestDeployAssert1AF2B360.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "LambdaTestDefaultTestDeployAssert1AF2B360.assets" + ], + "metadata": { + "/LambdaTest/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/LambdaTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "LambdaTest/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/tree.json new file mode 100644 index 0000000000000..d0eab653d95b8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/tree.json @@ -0,0 +1,4200 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "PipelineStack": { + "id": "PipelineStack", + "path": "PipelineStack", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline/Pipeline", + "children": { + "ArtifactsBucketEncryptionKey": { + "id": "ArtifactsBucketEncryptionKey", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "enableKeyRotation": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "0.0.0" + } + }, + "ArtifactsBucketEncryptionKeyAlias": { + "id": "ArtifactsBucketEncryptionKeyAlias", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Alias", + "aws:cdk:cloudformation:props": { + "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "targetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Alias", + "version": "0.0.0" + } + }, + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms", + "kmsMasterKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + ] + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "stages": [ + { + "name": "Source", + "actions": [ + { + "name": "tkglaser_cdk-pipelines-demo", + "outputArtifacts": [ + { + "name": "tkglaser_cdk_pipelines_demo_Source" + } + ], + "actionTypeId": { + "category": "Source", + "version": "1", + "owner": "ThirdParty", + "provider": "GitHub" + }, + "configuration": { + "Owner": "tkglaser", + "Repo": "cdk-pipelines-demo", + "Branch": "main", + "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", + "PollForSourceChanges": false + }, + "runOrder": 1 + } + ] + }, + { + "name": "Build", + "actions": [ + { + "name": "Synth", + "inputArtifacts": [ + { + "name": "tkglaser_cdk_pipelines_demo_Source" + } + ], + "outputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "UpdatePipeline", + "actions": [ + { + "name": "SelfMutate", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"d481eb7e52fa70e98aa3e0e22b2f258bef28632bc13e90928d96c7e1479e3a2b\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "Beta", + "actions": [ + { + "name": "Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + }, + { + "name": "Wave1", + "actions": [ + { + "name": "Prod1.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod1.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod1.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod1.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + }, + { + "name": "Wave2", + "actions": [ + { + "name": "Prod3.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod3.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod3.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod3.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + } + ], + "artifactStore": { + "type": "S3", + "location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "encryptionKey": { + "type": "KMS", + "id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "restartExecutionOnUpdate": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnPipeline", + "version": "0.0.0" + } + }, + "Source": { + "id": "Source", + "path": "PipelineStack/Pipeline/Pipeline/Source", + "children": { + "tkglaser_cdk-pipelines-demo": { + "id": "tkglaser_cdk-pipelines-demo", + "path": "PipelineStack/Pipeline/Pipeline/Source/tkglaser_cdk-pipelines-demo", + "children": { + "WebhookResource": { + "id": "WebhookResource", + "path": "PipelineStack/Pipeline/Pipeline/Source/tkglaser_cdk-pipelines-demo/WebhookResource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Webhook", + "aws:cdk:cloudformation:props": { + "authentication": "GITHUB_HMAC", + "authenticationConfiguration": { + "secretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" + }, + "filters": [ + { + "jsonPath": "$.ref", + "matchEquals": "refs/heads/{Branch}" + } + ], + "targetAction": "tkglaser_cdk-pipelines-demo", + "targetPipeline": { + "Ref": "Pipeline9850B417" + }, + "targetPipelineVersion": 1, + "registerWithThirdParty": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnWebhook", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Build": { + "id": "Build", + "path": "PipelineStack/Pipeline/Pipeline/Build", + "children": { + "Synth": { + "id": "Synth", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", + "children": { + "CdkBuildProject": { + "id": "CdkBuildProject", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/Build/Synth", + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", + "children": { + "SelfMutate": { + "id": "SelfMutate", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Beta": { + "id": "Beta", + "path": "PipelineStack/Pipeline/Pipeline/Beta", + "children": { + "Stack1.Prepare": { + "id": "Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack1.Deploy": { + "id": "Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack2.Prepare": { + "id": "Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack2.Deploy": { + "id": "Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "children": { + "8389e75f-0810-4838-bf64-d6f85a95cf83": { + "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Wave1": { + "id": "Wave1", + "path": "PipelineStack/Pipeline/Pipeline/Wave1", + "children": { + "Prod1.Stack1.Prepare": { + "id": "Prod1.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack1.Prepare": { + "id": "Prod2.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod1.Stack1.Deploy": { + "id": "Prod1.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack1.Deploy": { + "id": "Prod2.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod1.Stack2.Prepare": { + "id": "Prod1.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack2.Prepare": { + "id": "Prod2.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod1.Stack2.Deploy": { + "id": "Prod1.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack2.Deploy": { + "id": "Prod2.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Wave2": { + "id": "Wave2", + "path": "PipelineStack/Pipeline/Pipeline/Wave2", + "children": { + "Prod3.Stack1.Prepare": { + "id": "Prod3.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack1.Prepare": { + "id": "Prod4.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack1.Prepare": { + "id": "Prod5.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack1.Prepare": { + "id": "Prod6.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod3.Stack1.Deploy": { + "id": "Prod3.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack1.Deploy": { + "id": "Prod4.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack1.Deploy": { + "id": "Prod5.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack1.Deploy": { + "id": "Prod6.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod3.Stack2.Prepare": { + "id": "Prod3.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack2.Prepare": { + "id": "Prod4.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack2.Prepare": { + "id": "Prod5.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack2.Prepare": { + "id": "Prod6.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod3.Stack2.Deploy": { + "id": "Prod3.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack2.Deploy": { + "id": "Prod4.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack2.Deploy": { + "id": "Prod5.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack2.Deploy": { + "id": "Prod6.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.Pipeline", + "version": "0.0.0" + } + }, + "CodeBuildActionRole": { + "id": "CodeBuildActionRole", + "path": "PipelineStack/Pipeline/CodeBuildActionRole", + "children": { + "ImportCodeBuildActionRole": { + "id": "ImportCodeBuildActionRole", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/ImportCodeBuildActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "Bool": { + "aws:ViaAWSService": "codepipeline.amazonaws.com" + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", + "roles": [ + { + "Ref": "PipelineCodeBuildActionRole226DB0CB" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/UpdatePipeline", + "children": { + "SelfMutation": { + "id": "SelfMutation", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CodePipeline", + "version": "0.0.0" + } + }, + "Beta": { + "id": "Beta", + "path": "PipelineStack/Beta", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Beta/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Beta/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Beta/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Beta/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Beta/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Beta/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Beta/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Beta/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Beta/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Beta-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Beta/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Beta/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod1": { + "id": "Prod1", + "path": "PipelineStack/Prod1", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod1/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod1/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod1/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod1/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod1/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod1/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod1/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod1/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod1/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod1-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod1/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod1/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod2": { + "id": "Prod2", + "path": "PipelineStack/Prod2", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod2/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod2/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod2/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod2/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod2/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod2/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod2/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod2/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod2/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod2-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod2/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod2/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod3": { + "id": "Prod3", + "path": "PipelineStack/Prod3", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod3/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod3/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod3/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod3/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod3/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod3/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod3/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod3/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod3/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod3-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod3/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod3/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod4": { + "id": "Prod4", + "path": "PipelineStack/Prod4", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod4/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod4/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod4/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod4/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod4/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod4/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod4/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod4/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod4/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod4-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod4/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod4/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod5": { + "id": "Prod5", + "path": "PipelineStack/Prod5", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod5/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod5/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod5/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod5/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod5/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod5/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod5/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod5/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod5/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod5-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod5/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod5/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod6": { + "id": "Prod6", + "path": "PipelineStack/Prod6", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod6/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod6/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod6/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod6/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod6/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod6/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod6/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod6/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod6/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod6-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod6/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod6/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "LambdaTest": { + "id": "LambdaTest", + "path": "LambdaTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "LambdaTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "LambdaTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "LambdaTest/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "LambdaTest/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "LambdaTest/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.ts similarity index 87% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.ts index de79adf2b5081..853f0d2805f19 100644 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-cross-account-keys.ts @@ -1,9 +1,9 @@ -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as pipelines from '../lib'; +import * as pipelines from 'aws-cdk-lib/pipelines'; class PipelineStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js new file mode 100644 index 0000000000000..953ad45e5bee3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// eslint-disable-next-line import/no-extraneous-dependencies +/// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const path = require("path"); +const ec2 = require("aws-cdk-lib/aws-ec2"); +const s3_assets = require("aws-cdk-lib/aws-s3-assets"); +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const pipelines = require("aws-cdk-lib/pipelines"); +class PipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const vpc = new ec2.Vpc(this, 'Vpc'); + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + codeBuildDefaults: { vpc }, + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.gitHub('aws/aws-cdk', 'v2-main'), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), + }); + pipeline.addStage(new AppStage(this, 'Beta')); + } +} +class AppStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'Stack1'); + new s3_assets.Asset(stack, 'Asset', { + path: path.join(__dirname, 'testhelpers/assets/test-file-asset.txt'), + }); + new s3_assets.Asset(stack, 'Asset2', { + path: path.join(__dirname, 'testhelpers/assets/test-file-asset-two.txt'), + }); + new sqs.Queue(stack, 'OtherQueue'); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': '1', + }, +}); +new PipelineStack(app, 'PipelineStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLC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KGFwcCwgJ1BpcGVsaW5lU3RhY2snKTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.assets.json new file mode 100644 index 0000000000000..bc0d8faa4b842 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "dbefd7608e6caa1510bfb640277e8e0b94a8933d4dc658cc6b95ba3edfdd0906": { + "source": { + "path": "PipelineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "dbefd7608e6caa1510bfb640277e8e0b94a8933d4dc658cc6b95ba3edfdd0906.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.template.json new file mode 100644 index 0000000000000..454231aea8d08 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.template.json @@ -0,0 +1,2153 @@ +{ + "Resources": { + "Vpc8378EB38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc" + } + ] + } + }, + "VpcPublicSubnet1Subnet5C2D37C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPublicSubnet1RouteTable6C95E38E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPublicSubnet1RouteTableAssociation97140677": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "VpcPublicSubnet1DefaultRoute3DA9E72A": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet1EIPD7E02669": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPublicSubnet1NATGateway4D7517AA": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet1DefaultRoute3DA9E72A", + "VpcPublicSubnet1RouteTableAssociation97140677" + ] + }, + "VpcPublicSubnet2Subnet691E08A3": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "VpcPublicSubnet2RouteTable94F7E489": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "VpcPublicSubnet2RouteTableAssociationDD5762D8": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "VpcPublicSubnet2DefaultRoute97F91067": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet2EIP3C605A87": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc", + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "VpcPublicSubnet2NATGateway9182C01D": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet2EIP3C605A87", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VpcPublicSubnet2DefaultRoute97F91067", + "VpcPublicSubnet2RouteTableAssociationDD5762D8" + ] + }, + "VpcPrivateSubnet1Subnet536B997A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PrivateSubnet1" + } + ] + } + }, + "VpcPrivateSubnet1RouteTableB2C5B500": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PrivateSubnet1" + } + ] + } + }, + "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "VpcPrivateSubnet1DefaultRouteBE02A9ED": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + } + } + }, + "VpcPrivateSubnet2Subnet3788AAA1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PrivateSubnet2" + } + ] + } + }, + "VpcPrivateSubnet2RouteTableA678073B": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc/PrivateSubnet2" + } + ] + } + }, + "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "VpcPrivateSubnet2DefaultRoute060D2087": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + } + } + }, + "VpcIGWD7BA715C": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "PipelineStack/Vpc" + } + ] + } + }, + "VpcVPCGWBF912B6E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "InternetGatewayId": { + "Ref": "VpcIGWD7BA715C" + } + } + }, + "PipelineArtifactsBucketAEA9A052": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "aws:kms" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "PipelineArtifactsBucketPolicyF53CCC52": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleB27FAA37": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicy7BDC1ABB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "Roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "Pipeline9850B417": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "ThirdParty", + "Provider": "GitHub", + "Version": "1" + }, + "Configuration": { + "Owner": "aws", + "Repo": "aws-cdk", + "Branch": "v2-main", + "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", + "PollForSourceChanges": false + }, + "Name": "aws_aws-cdk", + "OutputArtifacts": [ + { + "Name": "aws_aws_cdk_Source" + } + ], + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" + }, + "InputArtifacts": [ + { + "Name": "aws_aws_cdk_Source" + } + ], + "Name": "Synth", + "OutputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Build" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"d481eb7e52fa70e98aa3e0e22b2f258bef28632bc13e90928d96c7e1479e3a2b\"}]" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "SelfMutate", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "UpdatePipeline" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset185A67CB4" + } + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "FileAsset1", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset24D2D639B" + } + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "FileAsset2", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Assets" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + } + ], + "Name": "Beta" + } + ], + "ArtifactStore": { + "Location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "Type": "S3" + }, + "RestartExecutionOnUpdate": true + }, + "DependsOn": [ + "PipelineRoleDefaultPolicy7BDC1ABB", + "PipelineRoleB27FAA37" + ] + }, + "PipelineSourceawsawscdkWebhookResource46EC529B": { + "Type": "AWS::CodePipeline::Webhook", + "Properties": { + "Authentication": "GITHUB_HMAC", + "AuthenticationConfiguration": { + "SecretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" + }, + "Filters": [ + { + "JsonPath": "$.ref", + "MatchEquals": "refs/heads/{Branch}" + } + ], + "TargetAction": "aws_aws-cdk", + "TargetPipeline": { + "Ref": "Pipeline9850B417" + }, + "TargetPipelineVersion": 1, + "RegisterWithThirdParty": true + } + }, + "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "ec2:CreateNetworkInterfacePermission", + "Condition": { + "StringEquals": { + "ec2:Subnet": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + ] + } + ], + "ec2:AuthorizedService": "codebuild.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":network-interface/*" + ] + ] + } + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineBuildSynthCdkBuildProject225CEB2C", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "PipelineBuildSynthCdkBuildProject6BEFA8E6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/Build/Synth", + "EncryptionKey": "alias/aws/s3", + "VpcConfig": { + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "DependsOn": [ + "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A" + ] + }, + "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DeleteNetworkInterface", + "ec2:DescribeDhcpOptions", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineCodeBuildActionRole226DB0CB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "Bool": { + "aws:ViaAWSService": "codepipeline.amazonaws.com" + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset185A67CB4", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset24D2D639B", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", + "Roles": [ + { + "Ref": "PipelineCodeBuildActionRole226DB0CB" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationRole57E559E8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "ec2:CreateNetworkInterfacePermission", + "Condition": { + "StringEquals": { + "ec2:Subnet": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + ] + } + ], + "ec2:AuthorizedService": "codebuild.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":network-interface/*" + ] + ] + } + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineUpdatePipelineSelfMutationE51045FC", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "PipelineUpdatePipelineSelfMutationDAA41400": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", + "EncryptionKey": "alias/aws/s3", + "VpcConfig": { + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "DependsOn": [ + "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74" + ] + }, + "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DeleteNetworkInterface", + "ec2:DescribeDhcpOptions", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineAssetsFileRole59943A77": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + }, + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineAssetsFileRoleDefaultPolicy14DB8755": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": { + "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + }, + { + "Action": "ec2:CreateNetworkInterfacePermission", + "Condition": { + "StringEquals": { + "ec2:Subnet": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + ] + } + ], + "ec2:AuthorizedService": "codebuild.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":network-interface/*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", + "Roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "PipelineAssetsFileAsset1SecurityGroupF04F1AD4": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset10191BEFB", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "PipelineAssetsFileAsset185A67CB4": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset1", + "EncryptionKey": "alias/aws/s3", + "VpcConfig": { + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset1SecurityGroupF04F1AD4", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "DependsOn": [ + "PipelineAssetsFileAsset1PolicyDocument4681543E" + ] + }, + "PipelineAssetsFileAsset1PolicyDocument4681543E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DeleteNetworkInterface", + "ec2:DescribeDhcpOptions", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineAssetsFileAsset1PolicyDocument4681543E", + "Roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "PipelineAssetsFileAsset2SecurityGroupA400C1A5": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset24DB856A2", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "PipelineAssetsFileAsset24D2D639B": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset2", + "EncryptionKey": "alias/aws/s3", + "VpcConfig": { + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset2SecurityGroupA400C1A5", + "GroupId" + ] + } + ], + "Subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "DependsOn": [ + "PipelineAssetsFileAsset1PolicyDocument4681543E" + ] + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStackPipeline9DB740AF.dot b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStackPipeline9DB740AF.dot similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStackPipeline9DB740AF.dot rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStackPipeline9DB740AF.dot diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json new file mode 100644 index 0000000000000..de7703c76b213 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json @@ -0,0 +1,45 @@ +{ + "version": "31.0.0", + "files": { + "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5": { + "source": { + "path": "../asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e": { + "source": { + "path": "../asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "9b0251342ce12f30650bbf24424c57aba9857cc654420b1deff1533588801ceb": { + "source": { + "path": "PipelineStackBetaStack1E6541489.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "9b0251342ce12f30650bbf24424c57aba9857cc654420b1deff1533588801ceb.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/manifest.json new file mode 100644 index 0000000000000..2b3f5f3cff2a4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/manifest.json @@ -0,0 +1,59 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackBetaStack1E6541489.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackBetaStack1E6541489.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackBetaStack1E6541489": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackBetaStack1E6541489.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9b0251342ce12f30650bbf24424c57aba9857cc654420b1deff1533588801ceb.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackBetaStack1E6541489.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Beta-Stack1" + }, + "dependencies": [ + "PipelineStackBetaStack1E6541489.assets" + ], + "metadata": { + "/PipelineStack/Beta/Stack1/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Beta/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Beta/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Beta/Stack1" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/integ.json new file mode 100644 index 0000000000000..d89ad922ea702 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "31.0.0", + "testCases": { + "integ.newpipeline-with-vpc": { + "stacks": [ + "PipelineStack" + ], + "diffAssets": false, + "stackUpdateWorkflow": true + } + }, + "synthContext": { + "@aws-cdk/core:newStyleStackSynthesis": "true" + }, + "enableLookups": false +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/manifest.json new file mode 100644 index 0000000000000..06f7bd74c086d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/manifest.json @@ -0,0 +1,353 @@ +{ + "version": "31.0.0", + "artifacts": { + "assembly-PipelineStack-Beta": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Beta", + "displayName": "PipelineStack/Beta" + } + }, + "PipelineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/dbefd7608e6caa1510bfb640277e8e0b94a8933d4dc658cc6b95ba3edfdd0906.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "PipelineStack.assets" + ], + "metadata": { + "/PipelineStack/Vpc/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Vpc8378EB38" + } + ], + "/PipelineStack/Vpc/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1Subnet5C2D37C4" + } + ], + "/PipelineStack/Vpc/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTable6C95E38E" + } + ], + "/PipelineStack/Vpc/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1RouteTableAssociation97140677" + } + ], + "/PipelineStack/Vpc/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" + } + ], + "/PipelineStack/Vpc/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1EIPD7E02669" + } + ], + "/PipelineStack/Vpc/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet1NATGateway4D7517AA" + } + ], + "/PipelineStack/Vpc/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2Subnet691E08A3" + } + ], + "/PipelineStack/Vpc/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTable94F7E489" + } + ], + "/PipelineStack/Vpc/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" + } + ], + "/PipelineStack/Vpc/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2DefaultRoute97F91067" + } + ], + "/PipelineStack/Vpc/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2EIP3C605A87" + } + ], + "/PipelineStack/Vpc/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPublicSubnet2NATGateway9182C01D" + } + ], + "/PipelineStack/Vpc/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1Subnet536B997A" + } + ], + "/PipelineStack/Vpc/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableB2C5B500" + } + ], + "/PipelineStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" + } + ], + "/PipelineStack/Vpc/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" + } + ], + "/PipelineStack/Vpc/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "/PipelineStack/Vpc/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableA678073B" + } + ], + "/PipelineStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" + } + ], + "/PipelineStack/Vpc/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcPrivateSubnet2DefaultRoute060D2087" + } + ], + "/PipelineStack/Vpc/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcIGWD7BA715C" + } + ], + "/PipelineStack/Vpc/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VpcVPCGWBF912B6E" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketAEA9A052" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketPolicyF53CCC52" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleB27FAA37" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleDefaultPolicy7BDC1ABB" + } + ], + "/PipelineStack/Pipeline/Pipeline/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Pipeline9850B417" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/aws_aws-cdk/WebhookResource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceawsawscdkWebhookResource46EC529B" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/PolicyDocument/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A" + } + ], + "/PipelineStack/Pipeline/CodeBuildActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineCodeBuildActionRole226DB0CB" + } + ], + "/PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/PolicyDocument/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74" + } + ], + "/PipelineStack/Pipeline/Assets/FileRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileRole59943A77" + } + ], + "/PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileRoleDefaultPolicy14DB8755" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset1/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset1SecurityGroupF04F1AD4" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset1/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset185A67CB4" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset1/PolicyDocument/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset1PolicyDocument4681543E" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset2/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset2SecurityGroupA400C1A5" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset2/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset24D2D639B" + } + ], + "/PipelineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/tree.json new file mode 100644 index 0000000000000..b50b4a08d6365 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/tree.json @@ -0,0 +1,3168 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "PipelineStack": { + "id": "PipelineStack", + "path": "PipelineStack", + "children": { + "Vpc": { + "id": "Vpc", + "path": "PipelineStack/Vpc", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Vpc/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "PipelineStack/Vpc/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "PipelineStack/Vpc/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "PipelineStack/Vpc/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "PipelineStack/Vpc/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "PipelineStack/Vpc/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "PipelineStack/Vpc/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "PipelineStack/Vpc/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "PipelineStack/Vpc/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "allocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "PipelineStack/Vpc/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "PipelineStack/Vpc/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "PipelineStack/Vpc/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "PipelineStack/Vpc/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "PipelineStack/Vpc/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "PipelineStack/Vpc/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VpcIGWD7BA715C" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "PipelineStack/Vpc/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "PipelineStack/Vpc/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, + "allocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet2EIP3C605A87", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "PipelineStack/Vpc/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "PipelineStack/Vpc/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "PipelineStack/Vpc/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "PipelineStack/Vpc/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "PipelineStack/Vpc/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "PipelineStack/Vpc/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "PipelineStack/Vpc/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "PipelineStack/Vpc/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "PipelineStack/Vpc/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "PipelineStack/Vpc/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "PipelineStack/Vpc/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "PipelineStack/Vpc/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "PipelineStack/Vpc/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "subnetId": { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "PipelineStack/Vpc/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VpcPublicSubnet2NATGateway9182C01D" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "PipelineStack/Vpc/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "PipelineStack/Vpc" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "PipelineStack/Vpc/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "internetGatewayId": { + "Ref": "VpcIGWD7BA715C" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline/Pipeline", + "children": { + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms" + } + } + ] + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "stages": [ + { + "name": "Source", + "actions": [ + { + "name": "aws_aws-cdk", + "outputArtifacts": [ + { + "name": "aws_aws_cdk_Source" + } + ], + "actionTypeId": { + "category": "Source", + "version": "1", + "owner": "ThirdParty", + "provider": "GitHub" + }, + "configuration": { + "Owner": "aws", + "Repo": "aws-cdk", + "Branch": "v2-main", + "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", + "PollForSourceChanges": false + }, + "runOrder": 1 + } + ] + }, + { + "name": "Build", + "actions": [ + { + "name": "Synth", + "inputArtifacts": [ + { + "name": "aws_aws_cdk_Source" + } + ], + "outputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "UpdatePipeline", + "actions": [ + { + "name": "SelfMutate", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"d481eb7e52fa70e98aa3e0e22b2f258bef28632bc13e90928d96c7e1479e3a2b\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "Assets", + "actions": [ + { + "name": "FileAsset1", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset185A67CB4" + } + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + }, + { + "name": "FileAsset2", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset24D2D639B" + } + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "Beta", + "actions": [ + { + "name": "Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + } + ], + "artifactStore": { + "type": "S3", + "location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + } + }, + "restartExecutionOnUpdate": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnPipeline", + "version": "0.0.0" + } + }, + "Source": { + "id": "Source", + "path": "PipelineStack/Pipeline/Pipeline/Source", + "children": { + "aws_aws-cdk": { + "id": "aws_aws-cdk", + "path": "PipelineStack/Pipeline/Pipeline/Source/aws_aws-cdk", + "children": { + "WebhookResource": { + "id": "WebhookResource", + "path": "PipelineStack/Pipeline/Pipeline/Source/aws_aws-cdk/WebhookResource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Webhook", + "aws:cdk:cloudformation:props": { + "authentication": "GITHUB_HMAC", + "authenticationConfiguration": { + "secretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" + }, + "filters": [ + { + "jsonPath": "$.ref", + "matchEquals": "refs/heads/{Branch}" + } + ], + "targetAction": "aws_aws-cdk", + "targetPipeline": { + "Ref": "Pipeline9850B417" + }, + "targetPipelineVersion": 1, + "registerWithThirdParty": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnWebhook", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Build": { + "id": "Build", + "path": "PipelineStack/Pipeline/Pipeline/Build", + "children": { + "Synth": { + "id": "Synth", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", + "children": { + "CdkBuildProject": { + "id": "CdkBuildProject", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "ec2:CreateNetworkInterfacePermission", + "Condition": { + "StringEquals": { + "ec2:Subnet": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + ] + } + ], + "ec2:AuthorizedService": "codebuild.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":network-interface/*" + ] + ] + } + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineBuildSynthCdkBuildProject225CEB2C", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/Build/Synth", + "encryptionKey": "alias/aws/s3", + "vpcConfig": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459", + "GroupId" + ] + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + }, + "PolicyDocument": { + "id": "PolicyDocument", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/PolicyDocument", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/PolicyDocument/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DeleteNetworkInterface", + "ec2:DescribeDhcpOptions", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", + "children": { + "SelfMutate": { + "id": "SelfMutate", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Pipeline/Assets", + "children": { + "FileAsset1": { + "id": "FileAsset1", + "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset1", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "FileAsset2": { + "id": "FileAsset2", + "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset2", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Beta": { + "id": "Beta", + "path": "PipelineStack/Pipeline/Pipeline/Beta", + "children": { + "Prepare": { + "id": "Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Deploy": { + "id": "Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "children": { + "8389e75f-0810-4838-bf64-d6f85a95cf83": { + "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.Pipeline", + "version": "0.0.0" + } + }, + "CodeBuildActionRole": { + "id": "CodeBuildActionRole", + "path": "PipelineStack/Pipeline/CodeBuildActionRole", + "children": { + "ImportCodeBuildActionRole": { + "id": "ImportCodeBuildActionRole", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/ImportCodeBuildActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "Bool": { + "aws:ViaAWSService": "codepipeline.amazonaws.com" + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset185A67CB4", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset24D2D639B", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", + "roles": [ + { + "Ref": "PipelineCodeBuildActionRole226DB0CB" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/UpdatePipeline", + "children": { + "SelfMutation": { + "id": "SelfMutation", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "ec2:CreateNetworkInterfacePermission", + "Condition": { + "StringEquals": { + "ec2:Subnet": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + ] + } + ], + "ec2:AuthorizedService": "codebuild.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":network-interface/*" + ] + ] + } + }, + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineUpdatePipelineSelfMutationE51045FC", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", + "encryptionKey": "alias/aws/s3", + "vpcConfig": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC", + "GroupId" + ] + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + }, + "PolicyDocument": { + "id": "PolicyDocument", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/PolicyDocument", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/PolicyDocument/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DeleteNetworkInterface", + "ec2:DescribeDhcpOptions", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Assets", + "children": { + "FileRole": { + "id": "FileRole", + "path": "PipelineStack/Pipeline/Assets/FileRole", + "children": { + "ImportFileRole": { + "id": "ImportFileRole", + "path": "PipelineStack/Pipeline/Assets/FileRole/ImportFileRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + }, + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": { + "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + }, + { + "Action": "ec2:CreateNetworkInterfacePermission", + "Condition": { + "StringEquals": { + "ec2:Subnet": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":subnet/", + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ] + ] + } + ], + "ec2:AuthorizedService": "codebuild.amazonaws.com" + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":network-interface/*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", + "roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "FileAsset1": { + "id": "FileAsset1", + "path": "PipelineStack/Pipeline/Assets/FileAsset1", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset10191BEFB", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset1", + "encryptionKey": "alias/aws/s3", + "vpcConfig": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset1SecurityGroupF04F1AD4", + "GroupId" + ] + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + }, + "PolicyDocument": { + "id": "PolicyDocument", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/PolicyDocument", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/PolicyDocument/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DeleteNetworkInterface", + "ec2:DescribeDhcpOptions", + "ec2:DescribeNetworkInterfaces", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineAssetsFileAsset1PolicyDocument4681543E", + "roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + }, + "FileAsset2": { + "id": "FileAsset2", + "path": "PipelineStack/Pipeline/Assets/FileAsset2", + "children": { + "SecurityGroup": { + "id": "SecurityGroup", + "path": "PipelineStack/Pipeline/Assets/FileAsset2/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset2/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset24DB856A2", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset2/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset2", + "encryptionKey": "alias/aws/s3", + "vpcConfig": { + "vpcId": { + "Ref": "Vpc8378EB38" + }, + "subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + { + "Ref": "VpcPrivateSubnet2Subnet3788AAA1" + } + ], + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileAsset2SecurityGroupA400C1A5", + "GroupId" + ] + } + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CodePipeline", + "version": "0.0.0" + } + }, + "Beta": { + "id": "Beta", + "path": "PipelineStack/Beta", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Beta/Stack1", + "children": { + "Asset": { + "id": "Asset", + "path": "PipelineStack/Beta/Stack1/Asset", + "children": { + "Stage": { + "id": "Stage", + "path": "PipelineStack/Beta/Stack1/Asset/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "PipelineStack/Beta/Stack1/Asset/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Asset2": { + "id": "Asset2", + "path": "PipelineStack/Beta/Stack1/Asset2", + "children": { + "Stage": { + "id": "Stage", + "path": "PipelineStack/Beta/Stack1/Asset2/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "PipelineStack/Beta/Stack1/Asset2/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Beta/Stack1/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Beta/Stack1/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Beta/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Beta/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.ts similarity index 84% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.ts index 1541d400feb3f..e4208a51ae747 100644 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline-with-vpc.ts @@ -1,12 +1,12 @@ // eslint-disable-next-line import/no-extraneous-dependencies /// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as pipelines from '../lib'; +import * as pipelines from 'aws-cdk-lib/pipelines'; class PipelineStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js new file mode 100644 index 0000000000000..180c7e35176e4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// eslint-disable-next-line import/no-extraneous-dependencies +/// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const sqs = require("aws-cdk-lib/aws-sqs"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const pipelines = require("aws-cdk-lib/pipelines"); +class PipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.gitHub('rix0rrr/cdk-pipelines-demo', 'main'), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), + }); + pipeline.addStage(new AppStage(this, 'Beta')); + const group = pipeline.addWave('Wave1'); + group.addStage(new AppStage(this, 'Prod1')); + group.addStage(new AppStage(this, 'Prod2')); + const group2 = pipeline.addWave('Wave2'); + group2.addStage(new AppStage(this, 'Prod3')); + group2.addStage(new AppStage(this, 'Prod4')); + group2.addStage(new AppStage(this, 'Prod5')); + group2.addStage(new AppStage(this, 'Prod6')); + } +} +class AppStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack1 = new aws_cdk_lib_1.Stack(this, 'Stack1'); + const queue1 = new sqs.Queue(stack1, 'Queue'); + const stack2 = new aws_cdk_lib_1.Stack(this, 'Stack2'); + new sqs.Queue(stack2, 'OtherQueue', { + deadLetterQueue: { + queue: queue1, + maxReceiveCount: 5, + }, + }); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': '1', + }, +}); +new PipelineStack(app, 'PipelineStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcubmV3cGlwZWxpbmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5uZXdwaXBlbGluZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZEQUE2RDtBQUM3RCx5RkFBeUY7QUFDekYsMkNBQTJDO0FBQzNDLDZDQUF3RTtBQUV4RSxtREFBbUQ7QUFFbkQsTUFBTSxhQUFjLFNBQVEsbUJBQUs7SUFDL0IsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUV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ldWU6IHF1ZXVlMSxcbiAgICAgICAgbWF4UmVjZWl2ZUNvdW50OiA1LFxuICAgICAgfSxcbiAgICB9KTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKHtcbiAgY29udGV4dDoge1xuICAgICdAYXdzLWNkay9jb3JlOm5ld1N0eWxlU3RhY2tTeW50aGVzaXMnOiAnMScsXG4gIH0sXG59KTtcbm5ldyBQaXBlbGluZVN0YWNrKGFwcCwgJ1BpcGVsaW5lU3RhY2snKTtcbmFwcC5zeW50aCgpOyJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.assets.json new file mode 100644 index 0000000000000..2d8b51838abd6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "bb6adc0f7fd12a7b804a73ec5f746450c3851c82569c4ab7a6e604d6778df985": { + "source": { + "path": "PipelineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "bb6adc0f7fd12a7b804a73ec5f746450c3851c82569c4ab7a6e604d6778df985.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.template.json new file mode 100644 index 0000000000000..1bc1511049a64 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.template.json @@ -0,0 +1,2390 @@ +{ + "Resources": { + "PipelineArtifactsBucketAEA9A052": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "aws:kms" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "PipelineArtifactsBucketPolicyF53CCC52": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleB27FAA37": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicy7BDC1ABB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "Roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "Pipeline9850B417": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "ThirdParty", + "Provider": "GitHub", + "Version": "1" + }, + "Configuration": { + "Owner": "rix0rrr", + "Repo": "cdk-pipelines-demo", + "Branch": "main", + "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", + "PollForSourceChanges": false + }, + "Name": "rix0rrr_cdk-pipelines-demo", + "OutputArtifacts": [ + { + "Name": "rix0rrr_cdk_pipelines_demo_Source" + } + ], + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" + }, + "InputArtifacts": [ + { + "Name": "rix0rrr_cdk_pipelines_demo_Source" + } + ], + "Name": "Synth", + "OutputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Build" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"d481eb7e52fa70e98aa3e0e22b2f258bef28632bc13e90928d96c7e1479e3a2b\"}]" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "SelfMutate", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "UpdatePipeline" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Beta-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + } + ], + "Name": "Beta" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod1.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod2.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod1.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod2.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod1.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod2.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod1-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod1.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod2-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod2.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + } + ], + "Name": "Wave1" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod3.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod4.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod5.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod6.Stack1.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod3.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod4.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod5.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod6.Stack1.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod3.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod4.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod5.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" + }, + "InputArtifacts": [ + { + "Name": "Synth_Output" + } + ], + "Name": "Prod6.Stack2.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 3 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod3-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod3.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod4-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod4.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod5-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod5.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "Prod6-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Prod6.Stack2.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 4 + } + ], + "Name": "Wave2" + } + ], + "ArtifactStore": { + "Location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "Type": "S3" + }, + "RestartExecutionOnUpdate": true + }, + "DependsOn": [ + "PipelineRoleDefaultPolicy7BDC1ABB", + "PipelineRoleB27FAA37" + ] + }, + "PipelineSourcerix0rrrcdkpipelinesdemoWebhookResourceDB0C1BCA": { + "Type": "AWS::CodePipeline::Webhook", + "Properties": { + "Authentication": "GITHUB_HMAC", + "AuthenticationConfiguration": { + "SecretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" + }, + "Filters": [ + { + "JsonPath": "$.ref", + "MatchEquals": "refs/heads/{Branch}" + } + ], + "TargetAction": "rix0rrr_cdk-pipelines-demo", + "TargetPipeline": { + "Ref": "Pipeline9850B417" + }, + "TargetPipelineVersion": 1, + "RegisterWithThirdParty": true + } + }, + "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProject6BEFA8E6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/Build/Synth", + "EncryptionKey": "alias/aws/s3" + } + }, + "PipelineCodeBuildActionRole226DB0CB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "Bool": { + "aws:ViaAWSService": "codepipeline.amazonaws.com" + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", + "Roles": [ + { + "Ref": "PipelineCodeBuildActionRole226DB0CB" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationRole57E559E8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationDAA41400": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "Description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", + "EncryptionKey": "alias/aws/s3" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStackPipeline9DB740AF.dot b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStackPipeline9DB740AF.dot similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStackPipeline9DB740AF.dot rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/PipelineStackPipeline9DB740AF.dot diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json new file mode 100644 index 0000000000000..216c3528dcab8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65": { + "source": { + "path": "PipelineStackBetaStack1E6541489.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json new file mode 100644 index 0000000000000..9e43ccbe2df62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326": { + "source": { + "path": "PipelineStackBetaStack2C79AD00A.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/manifest.json new file mode 100644 index 0000000000000..594f450e28ad8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackBetaStack1E6541489.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackBetaStack1E6541489.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackBetaStack1E6541489": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackBetaStack1E6541489.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackBetaStack1E6541489.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Beta-Stack1" + }, + "dependencies": [ + "PipelineStackBetaStack1E6541489.assets" + ], + "metadata": { + "/PipelineStack/Beta/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Beta/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Beta/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Beta/Stack1" + }, + "PipelineStackBetaStack2C79AD00A.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackBetaStack2C79AD00A.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackBetaStack2C79AD00A": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackBetaStack2C79AD00A.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackBetaStack2C79AD00A.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Beta-Stack2" + }, + "dependencies": [ + "PipelineStackBetaStack1E6541489", + "PipelineStackBetaStack2C79AD00A.assets" + ], + "metadata": { + "/PipelineStack/Beta/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Beta/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Beta/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Beta/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json new file mode 100644 index 0000000000000..a0f0b275109b1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3": { + "source": { + "path": "PipelineStackProd1Stack14013D698.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json new file mode 100644 index 0000000000000..a353a3353a451 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059": { + "source": { + "path": "PipelineStackProd1Stack2F0681AFF.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/manifest.json new file mode 100644 index 0000000000000..0bcf638cb353d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd1Stack14013D698.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd1Stack14013D698.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd1Stack14013D698": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd1Stack14013D698.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd1Stack14013D698.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod1-Stack1" + }, + "dependencies": [ + "PipelineStackProd1Stack14013D698.assets" + ], + "metadata": { + "/PipelineStack/Prod1/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod1/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod1/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod1/Stack1" + }, + "PipelineStackProd1Stack2F0681AFF.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd1Stack2F0681AFF.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd1Stack2F0681AFF": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd1Stack2F0681AFF.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd1Stack2F0681AFF.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod1-Stack2" + }, + "dependencies": [ + "PipelineStackProd1Stack14013D698", + "PipelineStackProd1Stack2F0681AFF.assets" + ], + "metadata": { + "/PipelineStack/Prod1/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod1/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod1/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod1/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json new file mode 100644 index 0000000000000..b4ba394fe5593 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68": { + "source": { + "path": "PipelineStackProd2Stack1FD464162.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json new file mode 100644 index 0000000000000..ff7a88294f34b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9": { + "source": { + "path": "PipelineStackProd2Stack2176123EB.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/manifest.json new file mode 100644 index 0000000000000..c355127a22618 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd2Stack1FD464162.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd2Stack1FD464162.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd2Stack1FD464162": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd2Stack1FD464162.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd2Stack1FD464162.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod2-Stack1" + }, + "dependencies": [ + "PipelineStackProd2Stack1FD464162.assets" + ], + "metadata": { + "/PipelineStack/Prod2/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod2/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod2/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod2/Stack1" + }, + "PipelineStackProd2Stack2176123EB.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd2Stack2176123EB.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd2Stack2176123EB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd2Stack2176123EB.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd2Stack2176123EB.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod2-Stack2" + }, + "dependencies": [ + "PipelineStackProd2Stack1FD464162", + "PipelineStackProd2Stack2176123EB.assets" + ], + "metadata": { + "/PipelineStack/Prod2/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod2/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod2/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod2/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json new file mode 100644 index 0000000000000..6ddd60f7ac5d5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff": { + "source": { + "path": "PipelineStackProd3Stack1795F3D43.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json new file mode 100644 index 0000000000000..15ac86fbb3d1b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99": { + "source": { + "path": "PipelineStackProd3Stack2DFBBA0B2.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/manifest.json new file mode 100644 index 0000000000000..3e5d77e11f064 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd3Stack1795F3D43.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd3Stack1795F3D43.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd3Stack1795F3D43": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd3Stack1795F3D43.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd3Stack1795F3D43.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod3-Stack1" + }, + "dependencies": [ + "PipelineStackProd3Stack1795F3D43.assets" + ], + "metadata": { + "/PipelineStack/Prod3/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod3/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod3/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod3/Stack1" + }, + "PipelineStackProd3Stack2DFBBA0B2.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd3Stack2DFBBA0B2.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd3Stack2DFBBA0B2": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd3Stack2DFBBA0B2.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd3Stack2DFBBA0B2.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod3-Stack2" + }, + "dependencies": [ + "PipelineStackProd3Stack1795F3D43", + "PipelineStackProd3Stack2DFBBA0B2.assets" + ], + "metadata": { + "/PipelineStack/Prod3/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod3/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod3/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod3/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json new file mode 100644 index 0000000000000..edc13cf3ff6d4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78": { + "source": { + "path": "PipelineStackProd4Stack118F74ADB.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json new file mode 100644 index 0000000000000..29af583241fca --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd": { + "source": { + "path": "PipelineStackProd4Stack2E2CB4ED3.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/manifest.json new file mode 100644 index 0000000000000..d347c675cc6bb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd4Stack118F74ADB.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd4Stack118F74ADB.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd4Stack118F74ADB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd4Stack118F74ADB.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd4Stack118F74ADB.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod4-Stack1" + }, + "dependencies": [ + "PipelineStackProd4Stack118F74ADB.assets" + ], + "metadata": { + "/PipelineStack/Prod4/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod4/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod4/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod4/Stack1" + }, + "PipelineStackProd4Stack2E2CB4ED3.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd4Stack2E2CB4ED3.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd4Stack2E2CB4ED3": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd4Stack2E2CB4ED3.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd4Stack2E2CB4ED3.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod4-Stack2" + }, + "dependencies": [ + "PipelineStackProd4Stack118F74ADB", + "PipelineStackProd4Stack2E2CB4ED3.assets" + ], + "metadata": { + "/PipelineStack/Prod4/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod4/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod4/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod4/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json new file mode 100644 index 0000000000000..44bcf91a50021 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7": { + "source": { + "path": "PipelineStackProd5Stack1E7E4E4C6.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json new file mode 100644 index 0000000000000..42799cb0799d2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8": { + "source": { + "path": "PipelineStackProd5Stack2C39BEE5B.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/manifest.json new file mode 100644 index 0000000000000..1abe7afb824d3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd5Stack1E7E4E4C6.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd5Stack1E7E4E4C6.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd5Stack1E7E4E4C6": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd5Stack1E7E4E4C6.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd5Stack1E7E4E4C6.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod5-Stack1" + }, + "dependencies": [ + "PipelineStackProd5Stack1E7E4E4C6.assets" + ], + "metadata": { + "/PipelineStack/Prod5/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod5/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod5/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod5/Stack1" + }, + "PipelineStackProd5Stack2C39BEE5B.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd5Stack2C39BEE5B.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd5Stack2C39BEE5B": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd5Stack2C39BEE5B.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd5Stack2C39BEE5B.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod5-Stack2" + }, + "dependencies": [ + "PipelineStackProd5Stack1E7E4E4C6", + "PipelineStackProd5Stack2C39BEE5B.assets" + ], + "metadata": { + "/PipelineStack/Prod5/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod5/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod5/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod5/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json new file mode 100644 index 0000000000000..79eb72847d519 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813": { + "source": { + "path": "PipelineStackProd6Stack1E7C34314.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json new file mode 100644 index 0000000000000..e9833a6066b2d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30": { + "source": { + "path": "PipelineStackProd6Stack2BED1BBCE.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/manifest.json new file mode 100644 index 0000000000000..f79f20c324fb2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/manifest.json @@ -0,0 +1,120 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackProd6Stack1E7C34314.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd6Stack1E7C34314.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd6Stack1E7C34314": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd6Stack1E7C34314.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd6Stack1E7C34314.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod6-Stack1" + }, + "dependencies": [ + "PipelineStackProd6Stack1E7C34314.assets" + ], + "metadata": { + "/PipelineStack/Prod6/Stack1/Queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Queue4A7E3555" + } + ], + "/PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + } + ], + "/PipelineStack/Prod6/Stack1/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod6/Stack1/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod6/Stack1" + }, + "PipelineStackProd6Stack2BED1BBCE.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackProd6Stack2BED1BBCE.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackProd6Stack2BED1BBCE": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackProd6Stack2BED1BBCE.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackProd6Stack2BED1BBCE.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "Prod6-Stack2" + }, + "dependencies": [ + "PipelineStackProd6Stack1E7C34314", + "PipelineStackProd6Stack2BED1BBCE.assets" + ], + "metadata": { + "/PipelineStack/Prod6/Stack2/OtherQueue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "OtherQueue60B686DC" + } + ], + "/PipelineStack/Prod6/Stack2/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/Prod6/Stack2/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/Prod6/Stack2" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/integ.json new file mode 100644 index 0000000000000..97241780c845b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "31.0.0", + "testCases": { + "integ.newpipeline": { + "stacks": [ + "PipelineStack" + ], + "diffAssets": false, + "stackUpdateWorkflow": true + } + }, + "synthContext": { + "@aws-cdk/core:newStyleStackSynthesis": "true" + }, + "enableLookups": false +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/manifest.json new file mode 100644 index 0000000000000..2598182a9af67 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/manifest.json @@ -0,0 +1,191 @@ +{ + "version": "31.0.0", + "artifacts": { + "assembly-PipelineStack-Beta": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Beta", + "displayName": "PipelineStack/Beta" + } + }, + "assembly-PipelineStack-Prod1": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod1", + "displayName": "PipelineStack/Prod1" + } + }, + "assembly-PipelineStack-Prod2": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod2", + "displayName": "PipelineStack/Prod2" + } + }, + "assembly-PipelineStack-Prod3": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod3", + "displayName": "PipelineStack/Prod3" + } + }, + "assembly-PipelineStack-Prod4": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod4", + "displayName": "PipelineStack/Prod4" + } + }, + "assembly-PipelineStack-Prod5": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod5", + "displayName": "PipelineStack/Prod5" + } + }, + "assembly-PipelineStack-Prod6": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-Prod6", + "displayName": "PipelineStack/Prod6" + } + }, + "PipelineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/bb6adc0f7fd12a7b804a73ec5f746450c3851c82569c4ab7a6e604d6778df985.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "PipelineStack.assets" + ], + "metadata": { + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketAEA9A052" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketPolicyF53CCC52" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleB27FAA37" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleDefaultPolicy7BDC1ABB" + } + ], + "/PipelineStack/Pipeline/Pipeline/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Pipeline9850B417" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/rix0rrr_cdk-pipelines-demo/WebhookResource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourcerix0rrrcdkpipelinesdemoWebhookResourceDB0C1BCA" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ], + "/PipelineStack/Pipeline/CodeBuildActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineCodeBuildActionRole226DB0CB" + } + ], + "/PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ], + "/PipelineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/tree.json new file mode 100644 index 0000000000000..a3655698c41fd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.js.snapshot/tree.json @@ -0,0 +1,3958 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "PipelineStack": { + "id": "PipelineStack", + "path": "PipelineStack", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline/Pipeline", + "children": { + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms" + } + } + ] + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "stages": [ + { + "name": "Source", + "actions": [ + { + "name": "rix0rrr_cdk-pipelines-demo", + "outputArtifacts": [ + { + "name": "rix0rrr_cdk_pipelines_demo_Source" + } + ], + "actionTypeId": { + "category": "Source", + "version": "1", + "owner": "ThirdParty", + "provider": "GitHub" + }, + "configuration": { + "Owner": "rix0rrr", + "Repo": "cdk-pipelines-demo", + "Branch": "main", + "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", + "PollForSourceChanges": false + }, + "runOrder": 1 + } + ] + }, + { + "name": "Build", + "actions": [ + { + "name": "Synth", + "inputArtifacts": [ + { + "name": "rix0rrr_cdk_pipelines_demo_Source" + } + ], + "outputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "UpdatePipeline", + "actions": [ + { + "name": "SelfMutate", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"d481eb7e52fa70e98aa3e0e22b2f258bef28632bc13e90928d96c7e1479e3a2b\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineCodeBuildActionRole226DB0CB", + "Arn" + ] + } + } + ] + }, + { + "name": "Beta", + "actions": [ + { + "name": "Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Beta-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + }, + { + "name": "Wave1", + "actions": [ + { + "name": "Prod1.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod1.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod1.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod1.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod1-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod2.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod2-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + }, + { + "name": "Wave2", + "actions": [ + { + "name": "Prod3.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack1.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack1", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod3.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack1.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack1", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod3.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack2.Prepare", + "inputArtifacts": [ + { + "name": "Synth_Output" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack2", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" + }, + "runOrder": 3, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod3.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod3-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod4.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod4-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod5.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod5-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Prod6.Stack2.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "Prod6-Stack2", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 4, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + } + ], + "artifactStore": { + "type": "S3", + "location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + } + }, + "restartExecutionOnUpdate": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnPipeline", + "version": "0.0.0" + } + }, + "Source": { + "id": "Source", + "path": "PipelineStack/Pipeline/Pipeline/Source", + "children": { + "rix0rrr_cdk-pipelines-demo": { + "id": "rix0rrr_cdk-pipelines-demo", + "path": "PipelineStack/Pipeline/Pipeline/Source/rix0rrr_cdk-pipelines-demo", + "children": { + "WebhookResource": { + "id": "WebhookResource", + "path": "PipelineStack/Pipeline/Pipeline/Source/rix0rrr_cdk-pipelines-demo/WebhookResource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Webhook", + "aws:cdk:cloudformation:props": { + "authentication": "GITHUB_HMAC", + "authenticationConfiguration": { + "secretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" + }, + "filters": [ + { + "jsonPath": "$.ref", + "matchEquals": "refs/heads/{Branch}" + } + ], + "targetAction": "rix0rrr_cdk-pipelines-demo", + "targetPipeline": { + "Ref": "Pipeline9850B417" + }, + "targetPipelineVersion": 1, + "registerWithThirdParty": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnWebhook", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Build": { + "id": "Build", + "path": "PipelineStack/Pipeline/Pipeline/Build", + "children": { + "Synth": { + "id": "Synth", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", + "children": { + "CdkBuildProject": { + "id": "CdkBuildProject", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/Build/Synth", + "encryptionKey": "alias/aws/s3" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", + "children": { + "SelfMutate": { + "id": "SelfMutate", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Beta": { + "id": "Beta", + "path": "PipelineStack/Pipeline/Pipeline/Beta", + "children": { + "Stack1.Prepare": { + "id": "Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack1.Deploy": { + "id": "Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack2.Prepare": { + "id": "Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack2.Deploy": { + "id": "Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "children": { + "8389e75f-0810-4838-bf64-d6f85a95cf83": { + "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Wave1": { + "id": "Wave1", + "path": "PipelineStack/Pipeline/Pipeline/Wave1", + "children": { + "Prod1.Stack1.Prepare": { + "id": "Prod1.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack1.Prepare": { + "id": "Prod2.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod1.Stack1.Deploy": { + "id": "Prod1.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack1.Deploy": { + "id": "Prod2.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod1.Stack2.Prepare": { + "id": "Prod1.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack2.Prepare": { + "id": "Prod2.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod1.Stack2.Deploy": { + "id": "Prod1.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod2.Stack2.Deploy": { + "id": "Prod2.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Wave2": { + "id": "Wave2", + "path": "PipelineStack/Pipeline/Pipeline/Wave2", + "children": { + "Prod3.Stack1.Prepare": { + "id": "Prod3.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack1.Prepare": { + "id": "Prod4.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack1.Prepare": { + "id": "Prod5.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack1.Prepare": { + "id": "Prod6.Stack1.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod3.Stack1.Deploy": { + "id": "Prod3.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack1.Deploy": { + "id": "Prod4.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack1.Deploy": { + "id": "Prod5.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack1.Deploy": { + "id": "Prod6.Stack1.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod3.Stack2.Prepare": { + "id": "Prod3.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack2.Prepare": { + "id": "Prod4.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack2.Prepare": { + "id": "Prod5.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack2.Prepare": { + "id": "Prod6.Stack2.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod3.Stack2.Deploy": { + "id": "Prod3.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod4.Stack2.Deploy": { + "id": "Prod4.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod5.Stack2.Deploy": { + "id": "Prod5.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Prod6.Stack2.Deploy": { + "id": "Prod6.Stack2.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.Pipeline", + "version": "0.0.0" + } + }, + "CodeBuildActionRole": { + "id": "CodeBuildActionRole", + "path": "PipelineStack/Pipeline/CodeBuildActionRole", + "children": { + "ImportCodeBuildActionRole": { + "id": "ImportCodeBuildActionRole", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/ImportCodeBuildActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Condition": { + "Bool": { + "aws:ViaAWSService": "codepipeline.amazonaws.com" + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", + "roles": [ + { + "Ref": "PipelineCodeBuildActionRole226DB0CB" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/UpdatePipeline", + "children": { + "SelfMutation": { + "id": "SelfMutation", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", + "encryptionKey": "alias/aws/s3" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CodePipeline", + "version": "0.0.0" + } + }, + "Beta": { + "id": "Beta", + "path": "PipelineStack/Beta", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Beta/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Beta/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Beta/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Beta/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Beta/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Beta/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Beta/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Beta/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Beta/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Beta-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Beta/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Beta/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod1": { + "id": "Prod1", + "path": "PipelineStack/Prod1", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod1/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod1/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod1/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod1/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod1/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod1/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod1/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod1/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod1/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod1-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod1/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod1/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod2": { + "id": "Prod2", + "path": "PipelineStack/Prod2", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod2/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod2/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod2/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod2/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod2/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod2/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod2/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod2/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod2/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod2-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod2/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod2/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod3": { + "id": "Prod3", + "path": "PipelineStack/Prod3", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod3/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod3/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod3/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod3/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod3/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod3/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod3/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod3/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod3/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod3-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod3/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod3/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod4": { + "id": "Prod4", + "path": "PipelineStack/Prod4", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod4/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod4/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod4/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod4/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod4/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod4/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod4/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod4/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod4/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod4-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod4/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod4/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod5": { + "id": "Prod5", + "path": "PipelineStack/Prod5", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod5/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod5/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod5/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod5/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod5/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod5/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod5/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod5/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod5/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod5-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod5/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod5/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "Prod6": { + "id": "Prod6", + "path": "PipelineStack/Prod6", + "children": { + "Stack1": { + "id": "Stack1", + "path": "PipelineStack/Prod6/Stack1", + "children": { + "Queue": { + "id": "Queue", + "path": "PipelineStack/Prod6/Stack1/Queue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod6/Stack1/Queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "PipelineStack/Prod6/Stack1/Exports", + "children": { + "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { + "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "path": "PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod6/Stack1/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod6/Stack1/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Stack2": { + "id": "Stack2", + "path": "PipelineStack/Prod6/Stack2", + "children": { + "OtherQueue": { + "id": "OtherQueue", + "path": "PipelineStack/Prod6/Stack2/OtherQueue", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Prod6/Stack2/OtherQueue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::ImportValue": "Prod6-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" + }, + "maxReceiveCount": 5 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/Prod6/Stack2/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/Prod6/Stack2/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.ts similarity index 90% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.ts index f57681b742b39..258b3e80d1bdc 100644 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.newpipeline.ts @@ -1,9 +1,9 @@ // eslint-disable-next-line import/no-extraneous-dependencies /// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { App, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as pipelines from '../lib'; +import * as pipelines from 'aws-cdk-lib/pipelines'; class PipelineStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.d.ts new file mode 100644 index 0000000000000..18966d9bb5331 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.d.ts @@ -0,0 +1,5 @@ +import { Stack, StackProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +export declare class TestCdkStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js new file mode 100644 index 0000000000000..914c962d8863c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js @@ -0,0 +1,94 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestCdkStack = void 0; +/// !cdk-integ PipelineSecurityStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const codepipeline_actions = require("aws-cdk-lib/aws-codepipeline-actions"); +const iam = require("aws-cdk-lib/aws-iam"); +const s3 = require("aws-cdk-lib/aws-s3"); +const sns = require("aws-cdk-lib/aws-sns"); +const subscriptions = require("aws-cdk-lib/aws-sns-subscriptions"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const cdkp = require("aws-cdk-lib/pipelines"); +class MyStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'MyStack', { + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), + }); + const topic = new sns.Topic(stack, 'Topic'); + topic.grantPublish(new iam.AccountPrincipal(stack.account)); + } +} +class MySafeStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'MySafeStack', { + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), + }); + new sns.Topic(stack, 'MySafeTopic'); + } +} +class TestCdkStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + // The code that defines your stack goes here + const sourceArtifact = new codepipeline.Artifact(); + const cloudAssemblyArtifact = new codepipeline.Artifact('CloudAsm'); + const sourceBucket = new s3.Bucket(this, 'SourceBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + const pipeline = new cdkp.CdkPipeline(this, 'TestPipeline', { + selfMutating: false, + pipelineName: 'TestPipeline', + cloudAssemblyArtifact, + sourceAction: new codepipeline_actions.S3SourceAction({ + bucket: sourceBucket, + output: sourceArtifact, + bucketKey: 'key', + actionName: 'S3', + }), + synthAction: cdkp.SimpleSynthAction.standardYarnSynth({ + sourceArtifact, + cloudAssemblyArtifact, + buildCommand: 'yarn build', + }), + }); + const pipelineStage = pipeline.codePipeline.addStage({ + stageName: 'UnattachedStage', + }); + const unattachedStage = new cdkp.CdkStage(this, 'UnattachedStage', { + stageName: 'UnattachedStage', + pipelineStage, + cloudAssemblyArtifact, + host: { + publishAsset: () => undefined, + stackOutputArtifact: () => undefined, + }, + }); + const topic = new sns.Topic(this, 'SecurityChangesTopic'); + topic.addSubscription(new subscriptions.EmailSubscription('test@email.com')); + unattachedStage.addApplication(new MyStage(this, 'SingleStage', {}), { confirmBroadeningPermissions: true, securityNotificationTopic: topic }); + const stage1 = pipeline.addApplicationStage(new MyStage(this, 'PreProduction', {}), { confirmBroadeningPermissions: true, securityNotificationTopic: topic }); + stage1.addApplication(new MySafeStage(this, 'SafeProduction', {})); + stage1.addApplication(new MySafeStage(this, 'DisableSecurityCheck', {}), { confirmBroadeningPermissions: false }); + const stage2 = pipeline.addApplicationStage(new MyStage(this, 'NoSecurityCheck', {})); + stage2.addApplication(new MyStage(this, 'EnableSecurityCheck', {}), { confirmBroadeningPermissions: true }); + } +} +exports.TestCdkStack = TestCdkStack; +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': 'true', + }, +}); +const stack = new TestCdkStack(app, 'PipelineSecurityStack', { + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), +}); +new integ.IntegTest(app, 'PipelineSecurityTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtc2VjdXJpdHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5waXBlbGluZS1zZWN1cml0eS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpR0FBaUc7QUFDakcsNkRBQTZEO0FBQzdELDZFQUE2RTtBQUM3RSwyQ0FBMkM7QUFDM0MseUNBQXlDO0FBQ3pDLDJDQUEyQztBQUMzQyxtRUFBbUU7QUFDbkUsNkNBQWdIO0FBQ2hILG9EQUFvRDtBQUVwRCw4Q0FBOEM7QUFFOUMsTUFBTSxPQUFRLFNBQVEsbUJBQUs7SUFDekIsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxLQUFrQjtRQUMxRCxLQUFLLENBQUMsS0FBSyxFQUFFLEVBQUUsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUN4QixNQUFNLEtBQUssR0FBRyxJQUF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NlY3VyaXR5Q2hlY2snLCB7XG4gICAgfSkpO1xuXG4gICAgc3RhZ2UyLmFkZEFwcGxpY2F0aW9uKG5ldyBNeVN0YWdlKHRoaXMsICdFbmFibGVTZWN1cml0eUNoZWNrJywgeyB9KSwgeyBjb25maXJtQnJvYWRlbmluZ1Blcm1pc3Npb25zOiB0cnVlIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoe1xuICBjb250ZXh0OiB7XG4gICAgJ0Bhd3MtY2RrL2NvcmU6bmV3U3R5bGVTdGFja1N5bnRoZXNpcyc6ICd0cnVlJyxcbiAgfSxcbn0pO1xuY29uc3Qgc3RhY2sgPSBuZXcgVGVzdENka1N0YWNrKGFwcCwgJ1BpcGVsaW5lU2VjdXJpdHlTdGFjaycsIHtcbiAgc3ludGhlc2l6ZXI6IG5ldyBEZWZhdWx0U3RhY2tTeW50aGVzaXplcigpLFxufSk7XG5cbm5ldyBpbnRlZy5JbnRlZ1Rlc3QoYXBwLCAnUGlwZWxpbmVTZWN1cml0eVRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityStack.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/PipelineSecurityTestDefaultTestDeployAssertEE246BCA.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/PipelineSecurityStackDisableSecurityCheckMySafeStack7A4F8E95.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/PipelineSecurityStackEnableSecurityCheckMyStack0B9FE272.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/PipelineSecurityStackNoSecurityCheckMyStack3484019E.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/PipelineSecurityStackPreProductionMyStackDCCBB4EA.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/PipelineSecurityStackSafeProductionMySafeStackC0D87904.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/PipelineSecurityStackSingleStageMyStack29962269.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/pipelines/lib/private/approve-lambda/index.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/approve-lambda/index.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.ts diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/integ.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.js.snapshot/tree.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.ts similarity index 87% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.ts index 736e984569577..4f49a23f8f7c4 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-security.ts @@ -1,14 +1,14 @@ /// !cdk-integ PipelineSecurityStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as subscriptions from '@aws-cdk/aws-sns-subscriptions'; -import { App, DefaultStackSynthesizer, RemovalPolicy, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as subscriptions from 'aws-cdk-lib/aws-sns-subscriptions'; +import { App, DefaultStackSynthesizer, RemovalPolicy, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as cdkp from '../lib'; +import * as cdkp from 'aws-cdk-lib/pipelines'; class MyStage extends Stage { constructor(scope: Construct, id: string, props?: StageProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js new file mode 100644 index 0000000000000..cb95ab84741cf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const path = require("path"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const codepipeline_actions = require("aws-cdk-lib/aws-codepipeline-actions"); +const s3 = require("aws-cdk-lib/aws-s3"); +const s3_assets = require("aws-cdk-lib/aws-s3-assets"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cdkp = require("aws-cdk-lib/pipelines"); +class MyStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'Stack', { + ...props, + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), + }); + new s3_assets.Asset(stack, 'Asset', { + path: path.join(__dirname, 'testhelpers/assets/test-file-asset.txt'), + }); + new s3_assets.Asset(stack, 'Asset2', { + path: path.join(__dirname, 'testhelpers/assets/test-file-asset-two.txt'), + }); + new aws_cdk_lib_1.CfnResource(stack, 'Resource', { + type: 'AWS::Test::SomeResource', + }); + } +} +/** + * The stack that defines the application pipeline + */ +class CdkpipelinesDemoPipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const sourceArtifact = new codepipeline.Artifact(); + const cloudAssemblyArtifact = new codepipeline.Artifact('CloudAsm'); + const integTestArtifact = new codepipeline.Artifact('IntegTests'); + const sourceBucket = new s3.Bucket(this, 'SourceBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + const pipeline = new cdkp.CdkPipeline(this, 'Pipeline', { + cloudAssemblyArtifact, + singlePublisherPerType: true, + // Where the source can be found + sourceAction: new codepipeline_actions.S3SourceAction({ + bucket: sourceBucket, + output: sourceArtifact, + bucketKey: 'key', + actionName: 'S3', + }), + // How it will be built + synthAction: cdkp.SimpleSynthAction.standardNpmSynth({ + sourceArtifact, + cloudAssemblyArtifact, + projectName: 'MyServicePipeline-synth', + additionalArtifacts: [ + { + directory: 'test', + artifact: integTestArtifact, + }, + ], + }), + }); + // This is where we add the application stages + // ... + const stage = pipeline.addApplicationStage(new MyStage(this, 'PreProd')); + stage.addActions(new cdkp.ShellScriptAction({ + actionName: 'UseSource', + commands: [ + // Comes from source + 'cat README.md', + ], + additionalArtifacts: [sourceArtifact], + })); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': 'true', + }, +}); +new CdkpipelinesDemoPipelineStack(app, 'PipelineStack', { + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtd2l0aC1hc3NldHMtc2luZ2xlLXVwbG9hZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImludGVnLnBpcGVsaW5lLXdpdGgtYXNzZXRzLXNpbmdsZS11cGxvYWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSx5RkFBeUY7QUFDekYsNkJBQTZCO0FBQzdCLDZEQUE2RDtBQUM3RCw2RUFBNkU7QUFDN0UseUNBQXlDO0FBQ3pDLHVEQUF1RDtBQUN2RCw2Q0FBNkg7QUFFN0gsOENBQThDO0FBRTlDLE1BQU0sT0FBUSxTQUFRLG1CQUFLO0lBQ3pCLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxLQUFLLEdBQUcsSUFBSSxtQkFBSyxDQUFDLElBQUksRUFB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leHQ6IHtcbiAgICAnQGF3cy1jZGsvY29yZTpuZXdTdHlsZVN0YWNrU3ludGhlc2lzJzogJ3RydWUnLFxuICB9LFxufSk7XG5uZXcgQ2RrcGlwZWxpbmVzRGVtb1BpcGVsaW5lU3RhY2soYXBwLCAnUGlwZWxpbmVTdGFjaycsIHtcbiAgc3ludGhlc2l6ZXI6IG5ldyBEZWZhdWx0U3RhY2tTeW50aGVzaXplcigpLFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.assets.json new file mode 100644 index 0000000000000..f1cf5d6548f81 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "31.0.0", + "files": { + "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9": { + "source": { + "path": "asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "94623e41b872232f01d131542ed880435486bced83cf31a80c4b9edf816f27f0": { + "source": { + "path": "PipelineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "94623e41b872232f01d131542ed880435486bced83cf31a80c4b9edf816f27f0.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.template.json new file mode 100644 index 0000000000000..fdc9ae9b28168 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.template.json @@ -0,0 +1,2015 @@ +{ + "Resources": { + "SourceBucketDDD2130A": { + "Type": "AWS::S3::Bucket", + "Properties": { + "Tags": [ + { + "Key": "aws-cdk:auto-delete-objects", + "Value": "true" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "SourceBucketPolicy703DFBF9": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "SourceBucketAutoDeleteObjectsCustomResourceC68FC040": { + "Type": "Custom::S3AutoDeleteObjects", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", + "Arn" + ] + }, + "BucketName": { + "Ref": "SourceBucketDDD2130A" + } + }, + "DependsOn": [ + "SourceBucketPolicy703DFBF9" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ] + } + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + }, + "Runtime": "nodejs14.x", + "Description": { + "Fn::Join": [ + "", + [ + "Lambda function for auto-deleting objects in ", + { + "Ref": "SourceBucketDDD2130A" + }, + " S3 bucket." + ] + ] + } + }, + "DependsOn": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + ] + }, + "PipelineArtifactsBucketEncryptionKeyF5BF0670": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { + "Type": "AWS::KMS::Alias", + "Properties": { + "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "TargetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketAEA9A052": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "KMSMasterKeyID": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "SSEAlgorithm": "aws:kms" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "PipelineArtifactsBucketPolicyF53CCC52": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleB27FAA37": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicy7BDC1ABB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "Roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "Pipeline9850B417": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "AWS", + "Provider": "S3", + "Version": "1" + }, + "Configuration": { + "S3Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "S3ObjectKey": "key" + }, + "Name": "S3", + "OutputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" + }, + "InputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "Name": "Synth", + "OutputArtifacts": [ + { + "Name": "CloudAsm" + }, + { + "Name": "IntegTests" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Build" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "SelfMutate", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "UpdatePipeline" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset5D8C5DA6" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "FileAsset", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Assets" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + }, + "InputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "Name": "UseSource", + "RoleArn": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + "RunOrder": 100 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "PreProd-Stack", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "Stack.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "PreProd-Stack", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + } + ], + "Name": "PreProd" + } + ], + "ArtifactStore": { + "EncryptionKey": { + "Id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Type": "KMS" + }, + "Location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "Type": "S3" + }, + "RestartExecutionOnUpdate": true + }, + "DependsOn": [ + "PipelineRoleDefaultPolicy7BDC1ABB", + "PipelineRoleB27FAA37" + ] + }, + "PipelineSourceS3CodePipelineActionRole83895A58": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/key" + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", + "Roles": [ + { + "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ] + } + }, + "PipelineBuildSynthCodePipelineActionRole4E7A6C97": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", + "Roles": [ + { + "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProject6BEFA8E6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "EnvironmentVariables": [ + { + "Name": "NPM_CONFIG_UNSAFE_PERM", + "Type": "PLAINTEXT", + "Value": "true" + } + ], + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Name": "MyServicePipeline-synth" + } + }, + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ] + } + }, + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProject2E711EB4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", + "Roles": [ + { + "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ] + } + }, + "PipelinePreProdUseSourceProjectRole69B20A71": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", + "Roles": [ + { + "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ] + } + }, + "PipelinePreProdUseSourceProject2E711EB4": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProjectRole69B20A71", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineUpdatePipelineSelfMutationRole57E559E8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationDAA41400": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineAssetsFileRole59943A77": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + }, + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineAssetsFileRoleDefaultPolicy14DB8755": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": { + "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", + "Roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "PipelineAssetsFileAsset5D8C5DA6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "Source": { + "BuildSpec": "buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json new file mode 100644 index 0000000000000..2ce37b729009c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json @@ -0,0 +1,45 @@ +{ + "version": "31.0.0", + "files": { + "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5": { + "source": { + "path": "../asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e": { + "source": { + "path": "../asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4": { + "source": { + "path": "PipelineStackPreProdStack65A0AD1F.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/manifest.json new file mode 100644 index 0000000000000..0c5d00061bc62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/manifest.json @@ -0,0 +1,59 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackPreProdStack65A0AD1F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackPreProdStack65A0AD1F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackPreProdStack65A0AD1F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackPreProdStack65A0AD1F.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackPreProdStack65A0AD1F.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "PreProd-Stack" + }, + "dependencies": [ + "PipelineStackPreProdStack65A0AD1F.assets" + ], + "metadata": { + "/PipelineStack/PreProd/Stack/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Resource" + } + ], + "/PipelineStack/PreProd/Stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/PreProd/Stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/PreProd/Stack" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js new file mode 100644 index 0000000000000..c83ecebaaadac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + exports.external.log('submit response to cloudformation', json); + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, responseBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, _ => resolve()); + request.on('error', reject); + request.write(responseBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlI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ZSkge1xuICAgICAgdHJ5IHtcbiAgICAgICAgcmV0dXJuIGF3YWl0IGZuKC4uLnhzKTtcbiAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgaWYgKGF0dGVtcHRzLS0gPD0gMCkge1xuICAgICAgICAgIHRocm93IGU7XG4gICAgICAgIH1cbiAgICAgICAgYXdhaXQgc2xlZXAoTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogbXMpKTtcbiAgICAgICAgbXMgKj0gMjtcbiAgICAgIH1cbiAgICB9XG4gIH07XG59XG5cbmFzeW5jIGZ1bmN0aW9uIHNsZWVwKG1zOiBudW1iZXIpOiBQcm9taXNlPHZvaWQ+IHtcbiAgcmV0dXJuIG5ldyBQcm9taXNlKChvaykgPT4gc2V0VGltZW91dChvaywgbXMpKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml similarity index 94% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml index 098c08a6931e4..06708bb7e14f9 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml @@ -3,7 +3,7 @@ "phases": { "install": { "commands": [ - "npm install -g cdk-assets@1" + "npm install -g cdk-assets@2" ] }, "build": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/integ.json new file mode 100644 index 0000000000000..2aa1679a7223e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "31.0.0", + "testCases": { + "integ.pipeline-with-assets-single-upload": { + "stacks": [ + "PipelineStack" + ], + "diffAssets": false, + "stackUpdateWorkflow": true + } + }, + "synthContext": { + "@aws-cdk/core:newStyleStackSynthesis": "true" + }, + "enableLookups": false +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/manifest.json new file mode 100644 index 0000000000000..b778542835e2c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/manifest.json @@ -0,0 +1,257 @@ +{ + "version": "31.0.0", + "artifacts": { + "assembly-PipelineStack-PreProd": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-PreProd", + "displayName": "PipelineStack/PreProd" + } + }, + "PipelineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/94623e41b872232f01d131542ed880435486bced83cf31a80c4b9edf816f27f0.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "PipelineStack.assets" + ], + "metadata": { + "/PipelineStack/SourceBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketDDD2130A" + } + ], + "/PipelineStack/SourceBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketPolicy703DFBF9" + } + ], + "/PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketAutoDeleteObjectsCustomResourceC68FC040" + } + ], + "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + } + ], + "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketAEA9A052" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketPolicyF53CCC52" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleB27FAA37" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleDefaultPolicy7BDC1ABB" + } + ], + "/PipelineStack/Pipeline/Pipeline/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Pipeline9850B417" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ], + "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ], + "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProject2E711EB4" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ], + "/PipelineStack/Pipeline/Assets/FileRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileRole59943A77" + } + ], + "/PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileRoleDefaultPolicy14DB8755" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset/Default/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset5D8C5DA6" + } + ], + "/PipelineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/tree.json new file mode 100644 index 0000000000000..b7a975d1bb875 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/tree.json @@ -0,0 +1,2883 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "PipelineStack": { + "id": "PipelineStack", + "path": "PipelineStack", + "children": { + "SourceBucket": { + "id": "SourceBucket", + "path": "PipelineStack/SourceBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/SourceBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "aws-cdk:auto-delete-objects", + "value": "true" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/SourceBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/SourceBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + }, + "AutoDeleteObjectsCustomResource": { + "id": "AutoDeleteObjectsCustomResource", + "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Custom::S3AutoDeleteObjectsCustomResourceProvider": { + "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProvider", + "version": "0.0.0" + } + }, + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline/Pipeline", + "children": { + "ArtifactsBucketEncryptionKey": { + "id": "ArtifactsBucketEncryptionKey", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "0.0.0" + } + }, + "ArtifactsBucketEncryptionKeyAlias": { + "id": "ArtifactsBucketEncryptionKeyAlias", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Alias", + "aws:cdk:cloudformation:props": { + "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "targetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Alias", + "version": "0.0.0" + } + }, + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms", + "kmsMasterKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + ] + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "stages": [ + { + "name": "Source", + "actions": [ + { + "name": "S3", + "outputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "actionTypeId": { + "category": "Source", + "version": "1", + "owner": "AWS", + "provider": "S3" + }, + "configuration": { + "S3Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "S3ObjectKey": "key" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + } + } + ] + }, + { + "name": "Build", + "actions": [ + { + "name": "Synth", + "inputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "outputArtifacts": [ + { + "name": "CloudAsm" + }, + { + "name": "IntegTests" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + } + } + ] + }, + { + "name": "UpdatePipeline", + "actions": [ + { + "name": "SelfMutate", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + } + } + ] + }, + { + "name": "Assets", + "actions": [ + { + "name": "FileAsset", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset5D8C5DA6" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + } + } + ] + }, + { + "name": "PreProd", + "actions": [ + { + "name": "UseSource", + "inputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + }, + "runOrder": 100, + "roleArn": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + } + }, + { + "name": "Stack.Prepare", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "PreProd-Stack", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "PreProd-Stack", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + } + ], + "artifactStore": { + "type": "S3", + "location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "encryptionKey": { + "type": "KMS", + "id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "restartExecutionOnUpdate": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnPipeline", + "version": "0.0.0" + } + }, + "Source": { + "id": "Source", + "path": "PipelineStack/Pipeline/Pipeline/Source", + "children": { + "S3": { + "id": "S3", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/key" + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", + "roles": [ + { + "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Build": { + "id": "Build", + "path": "PipelineStack/Pipeline/Pipeline/Build", + "children": { + "Synth": { + "id": "Synth", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", + "roles": [ + { + "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "CdkBuildProject": { + "id": "CdkBuildProject", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL", + "environmentVariables": [ + { + "name": "NPM_CONFIG_UNSAFE_PERM", + "type": "PLAINTEXT", + "value": "true" + } + ] + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "name": "MyServicePipeline-synth" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", + "children": { + "SelfMutate": { + "id": "SelfMutate", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/Pipeline/Pipeline/PreProd", + "children": { + "UseSource": { + "id": "UseSource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProject2E711EB4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", + "roles": [ + { + "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Project": { + "id": "Project", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", + "roles": [ + { + "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProjectRole69B20A71", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack.Deploy": { + "id": "Stack.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack.Prepare": { + "id": "Stack.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Pipeline/Assets", + "children": { + "FileAsset": { + "id": "FileAsset", + "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.Pipeline", + "version": "0.0.0" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/UpdatePipeline", + "children": { + "SelfMutation": { + "id": "SelfMutation", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.UpdatePipelineAction", + "version": "0.0.0" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Assets", + "children": { + "FileRole": { + "id": "FileRole", + "path": "PipelineStack/Pipeline/Assets/FileRole", + "children": { + "ImportFileRole": { + "id": "ImportFileRole", + "path": "PipelineStack/Pipeline/Assets/FileRole/ImportFileRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + }, + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": { + "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", + "roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "FileAsset": { + "id": "FileAsset", + "path": "PipelineStack/Pipeline/Assets/FileAsset", + "children": { + "Default": { + "id": "Default", + "path": "PipelineStack/Pipeline/Assets/FileAsset/Default", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset/Default/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.PublishAssetsAction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/Pipeline/PreProd", + "children": { + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "children": { + "8389e75f-0810-4838-bf64-d6f85a95cf83": { + "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CdkStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CdkPipeline", + "version": "0.0.0" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/PreProd", + "children": { + "Stack": { + "id": "Stack", + "path": "PipelineStack/PreProd/Stack", + "children": { + "Asset": { + "id": "Asset", + "path": "PipelineStack/PreProd/Stack/Asset", + "children": { + "Stage": { + "id": "Stage", + "path": "PipelineStack/PreProd/Stack/Asset/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "PipelineStack/PreProd/Stack/Asset/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Asset2": { + "id": "Asset2", + "path": "PipelineStack/PreProd/Stack/Asset2", + "children": { + "Stage": { + "id": "Stage", + "path": "PipelineStack/PreProd/Stack/Asset2/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "PipelineStack/PreProd/Stack/Asset2/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/PreProd/Stack/Resource", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/PreProd/Stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/PreProd/Stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.ts similarity index 88% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.ts index 30813fe00a2af..34545c05dada8 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets-single-upload.ts @@ -1,12 +1,12 @@ /// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true import * as path from 'path'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import { App, CfnResource, RemovalPolicy, DefaultStackSynthesizer, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; +import { App, CfnResource, RemovalPolicy, DefaultStackSynthesizer, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cdkp from '../lib'; +import * as cdkp from 'aws-cdk-lib/pipelines'; class MyStage extends Stage { constructor(scope: Construct, id: string, props?: StageProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js new file mode 100644 index 0000000000000..d8a445e256374 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const path = require("path"); +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const codepipeline_actions = require("aws-cdk-lib/aws-codepipeline-actions"); +const s3 = require("aws-cdk-lib/aws-s3"); +const s3_assets = require("aws-cdk-lib/aws-s3-assets"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cdkp = require("aws-cdk-lib/pipelines"); +class MyStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'Stack', { + ...props, + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), + }); + new s3_assets.Asset(stack, 'Asset', { + path: path.join(__dirname, 'testhelpers/assets/test-file-asset.txt'), + }); + new s3_assets.Asset(stack, 'Asset2', { + path: path.join(__dirname, 'testhelpers/assets/test-file-asset-two.txt'), + }); + new aws_cdk_lib_1.CfnResource(stack, 'Resource', { + type: 'AWS::Test::SomeResource', + }); + } +} +/** + * The stack that defines the application pipeline + */ +class CdkpipelinesDemoPipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const sourceArtifact = new codepipeline.Artifact(); + const cloudAssemblyArtifact = new codepipeline.Artifact('CloudAsm'); + const integTestArtifact = new codepipeline.Artifact('IntegTests'); + const sourceBucket = new s3.Bucket(this, 'SourceBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + const pipeline = new cdkp.CdkPipeline(this, 'Pipeline', { + cloudAssemblyArtifact, + // Where the source can be found + sourceAction: new codepipeline_actions.S3SourceAction({ + bucket: sourceBucket, + output: sourceArtifact, + bucketKey: 'key', + actionName: 'S3', + }), + // How it will be built + synthAction: cdkp.SimpleSynthAction.standardNpmSynth({ + sourceArtifact, + cloudAssemblyArtifact, + projectName: 'MyServicePipeline-synth', + additionalArtifacts: [ + { + directory: 'test', + artifact: integTestArtifact, + }, + ], + }), + }); + // This is where we add the application stages + // ... + const stage = pipeline.addApplicationStage(new MyStage(this, 'PreProd')); + stage.addActions(new cdkp.ShellScriptAction({ + actionName: 'UseSource', + commands: [ + // Comes from source + 'cat README.md', + ], + additionalArtifacts: [sourceArtifact], + })); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': 'true', + }, +}); +new CdkpipelinesDemoPipelineStack(app, 'PipelineStack', { + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtd2l0aC1hc3NldHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5waXBlbGluZS13aXRoLWFzc2V0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlGQUF5RjtBQUN6Riw2QkFBNkI7QUFDN0IsNkRBQTZEO0FBQzdELDZFQUE2RTtBQUM3RSx5Q0FBeUM7QUFDekMsdURBQXVEO0FBQ3ZELDZDQUE2SDtBQUU3SCw4Q0FBOEM7QUFFOUMsTUFBTSxPQUFRLFNBQVEsbUJBQUs7SUFDekIsWUFBWSxLQUFnQixFQUFFLEVBQVUs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fSksXG4gICAgKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKHtcbiAgY29udGV4dDoge1xuICAgICdAYXdzLWNkay9jb3JlOm5ld1N0eWxlU3RhY2tTeW50aGVzaXMnOiAndHJ1ZScsXG4gIH0sXG59KTtcbm5ldyBDZGtwaXBlbGluZXNEZW1vUGlwZWxpbmVTdGFjayhhcHAsICdQaXBlbGluZVN0YWNrJywge1xuICBzeW50aGVzaXplcjogbmV3IERlZmF1bHRTdGFja1N5bnRoZXNpemVyKCksXG59KTtcbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.assets.json new file mode 100644 index 0000000000000..49b0b45833186 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "31.0.0", + "files": { + "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9": { + "source": { + "path": "asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "d1b4e5e1b8e4479eceeb4166bfdc3cd16d18bb701c1fa4bbdac32cfe9a897ca3": { + "source": { + "path": "PipelineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "d1b4e5e1b8e4479eceeb4166bfdc3cd16d18bb701c1fa4bbdac32cfe9a897ca3.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.template.json new file mode 100644 index 0000000000000..e1a2260b32c2a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.template.json @@ -0,0 +1,2076 @@ +{ + "Resources": { + "SourceBucketDDD2130A": { + "Type": "AWS::S3::Bucket", + "Properties": { + "Tags": [ + { + "Key": "aws-cdk:auto-delete-objects", + "Value": "true" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "SourceBucketPolicy703DFBF9": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "SourceBucketAutoDeleteObjectsCustomResourceC68FC040": { + "Type": "Custom::S3AutoDeleteObjects", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", + "Arn" + ] + }, + "BucketName": { + "Ref": "SourceBucketDDD2130A" + } + }, + "DependsOn": [ + "SourceBucketPolicy703DFBF9" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ] + } + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + }, + "Runtime": "nodejs14.x", + "Description": { + "Fn::Join": [ + "", + [ + "Lambda function for auto-deleting objects in ", + { + "Ref": "SourceBucketDDD2130A" + }, + " S3 bucket." + ] + ] + } + }, + "DependsOn": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + ] + }, + "PipelineArtifactsBucketEncryptionKeyF5BF0670": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { + "Type": "AWS::KMS::Alias", + "Properties": { + "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "TargetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketAEA9A052": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "KMSMasterKeyID": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "SSEAlgorithm": "aws:kms" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "PipelineArtifactsBucketPolicyF53CCC52": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleB27FAA37": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicy7BDC1ABB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "Roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "Pipeline9850B417": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "AWS", + "Provider": "S3", + "Version": "1" + }, + "Configuration": { + "S3Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "S3ObjectKey": "key" + }, + "Name": "S3", + "OutputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" + }, + "InputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "Name": "Synth", + "OutputArtifacts": [ + { + "Name": "CloudAsm" + }, + { + "Name": "IntegTests" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Build" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "SelfMutate", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "UpdatePipeline" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset185A67CB4" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "FileAsset1", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset24D2D639B" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "FileAsset2", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Assets" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + }, + "InputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "Name": "UseSource", + "RoleArn": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + "RunOrder": 100 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "PreProd-Stack", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "Stack.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "PreProd-Stack", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + } + ], + "Name": "PreProd" + } + ], + "ArtifactStore": { + "EncryptionKey": { + "Id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Type": "KMS" + }, + "Location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "Type": "S3" + }, + "RestartExecutionOnUpdate": true + }, + "DependsOn": [ + "PipelineRoleDefaultPolicy7BDC1ABB", + "PipelineRoleB27FAA37" + ] + }, + "PipelineSourceS3CodePipelineActionRole83895A58": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/key" + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", + "Roles": [ + { + "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ] + } + }, + "PipelineBuildSynthCodePipelineActionRole4E7A6C97": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", + "Roles": [ + { + "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProject6BEFA8E6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "EnvironmentVariables": [ + { + "Name": "NPM_CONFIG_UNSAFE_PERM", + "Type": "PLAINTEXT", + "Value": "true" + } + ], + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Name": "MyServicePipeline-synth" + } + }, + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ] + } + }, + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProject2E711EB4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", + "Roles": [ + { + "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ] + } + }, + "PipelinePreProdUseSourceProjectRole69B20A71": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", + "Roles": [ + { + "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ] + } + }, + "PipelinePreProdUseSourceProject2E711EB4": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProjectRole69B20A71", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineUpdatePipelineSelfMutationRole57E559E8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationDAA41400": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineAssetsFileRole59943A77": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + }, + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineAssetsFileRoleDefaultPolicy14DB8755": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": { + "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", + "Roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "PipelineAssetsFileAsset185A67CB4": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineAssetsFileAsset24D2D639B": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json new file mode 100644 index 0000000000000..2ce37b729009c --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json @@ -0,0 +1,45 @@ +{ + "version": "31.0.0", + "files": { + "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5": { + "source": { + "path": "../asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e": { + "source": { + "path": "../asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4": { + "source": { + "path": "PipelineStackPreProdStack65A0AD1F.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/manifest.json new file mode 100644 index 0000000000000..0c5d00061bc62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/manifest.json @@ -0,0 +1,59 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackPreProdStack65A0AD1F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackPreProdStack65A0AD1F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackPreProdStack65A0AD1F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackPreProdStack65A0AD1F.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackPreProdStack65A0AD1F.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "PreProd-Stack" + }, + "dependencies": [ + "PipelineStackPreProdStack65A0AD1F.assets" + ], + "metadata": { + "/PipelineStack/PreProd/Stack/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Resource" + } + ], + "/PipelineStack/PreProd/Stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/PreProd/Stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/PreProd/Stack" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js new file mode 100644 index 0000000000000..c83ecebaaadac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + exports.external.log('submit response to cloudformation', json); + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, responseBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, _ => resolve()); + request.on('error', reject); + request.write(responseBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9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3aGlsZSAodHJ1ZSkge1xuICAgICAgdHJ5IHtcbiAgICAgICAgcmV0dXJuIGF3YWl0IGZuKC4uLnhzKTtcbiAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgaWYgKGF0dGVtcHRzLS0gPD0gMCkge1xuICAgICAgICAgIHRocm93IGU7XG4gICAgICAgIH1cbiAgICAgICAgYXdhaXQgc2xlZXAoTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogbXMpKTtcbiAgICAgICAgbXMgKj0gMjtcbiAgICAgIH1cbiAgICB9XG4gIH07XG59XG5cbmFzeW5jIGZ1bmN0aW9uIHNsZWVwKG1zOiBudW1iZXIpOiBQcm9taXNlPHZvaWQ+IHtcbiAgcmV0dXJuIG5ldyBQcm9taXNlKChvaykgPT4gc2V0VGltZW91dChvaywgbXMpKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/integ.json new file mode 100644 index 0000000000000..4233251715c94 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "31.0.0", + "testCases": { + "integ.pipeline-with-assets": { + "stacks": [ + "PipelineStack" + ], + "diffAssets": false, + "stackUpdateWorkflow": true + } + }, + "synthContext": { + "@aws-cdk/core:newStyleStackSynthesis": "true" + }, + "enableLookups": false +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/manifest.json new file mode 100644 index 0000000000000..afc4b2d53b0f2 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/manifest.json @@ -0,0 +1,263 @@ +{ + "version": "31.0.0", + "artifacts": { + "assembly-PipelineStack-PreProd": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-PreProd", + "displayName": "PipelineStack/PreProd" + } + }, + "PipelineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d1b4e5e1b8e4479eceeb4166bfdc3cd16d18bb701c1fa4bbdac32cfe9a897ca3.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "PipelineStack.assets" + ], + "metadata": { + "/PipelineStack/SourceBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketDDD2130A" + } + ], + "/PipelineStack/SourceBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketPolicy703DFBF9" + } + ], + "/PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketAutoDeleteObjectsCustomResourceC68FC040" + } + ], + "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + } + ], + "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketAEA9A052" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketPolicyF53CCC52" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleB27FAA37" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleDefaultPolicy7BDC1ABB" + } + ], + "/PipelineStack/Pipeline/Pipeline/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Pipeline9850B417" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ], + "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ], + "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProject2E711EB4" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ], + "/PipelineStack/Pipeline/Assets/FileRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileRole59943A77" + } + ], + "/PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileRoleDefaultPolicy14DB8755" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset1/Default/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset185A67CB4" + } + ], + "/PipelineStack/Pipeline/Assets/FileAsset2/Default/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineAssetsFileAsset24D2D639B" + } + ], + "/PipelineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/tree.json new file mode 100644 index 0000000000000..25cbaab931547 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.js.snapshot/tree.json @@ -0,0 +1,2980 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "PipelineStack": { + "id": "PipelineStack", + "path": "PipelineStack", + "children": { + "SourceBucket": { + "id": "SourceBucket", + "path": "PipelineStack/SourceBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/SourceBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "aws-cdk:auto-delete-objects", + "value": "true" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/SourceBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/SourceBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + }, + "AutoDeleteObjectsCustomResource": { + "id": "AutoDeleteObjectsCustomResource", + "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Custom::S3AutoDeleteObjectsCustomResourceProvider": { + "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProvider", + "version": "0.0.0" + } + }, + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline/Pipeline", + "children": { + "ArtifactsBucketEncryptionKey": { + "id": "ArtifactsBucketEncryptionKey", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "0.0.0" + } + }, + "ArtifactsBucketEncryptionKeyAlias": { + "id": "ArtifactsBucketEncryptionKeyAlias", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Alias", + "aws:cdk:cloudformation:props": { + "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "targetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Alias", + "version": "0.0.0" + } + }, + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms", + "kmsMasterKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + ] + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "stages": [ + { + "name": "Source", + "actions": [ + { + "name": "S3", + "outputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "actionTypeId": { + "category": "Source", + "version": "1", + "owner": "AWS", + "provider": "S3" + }, + "configuration": { + "S3Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "S3ObjectKey": "key" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + } + } + ] + }, + { + "name": "Build", + "actions": [ + { + "name": "Synth", + "inputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "outputArtifacts": [ + { + "name": "CloudAsm" + }, + { + "name": "IntegTests" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + } + } + ] + }, + { + "name": "UpdatePipeline", + "actions": [ + { + "name": "SelfMutate", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + } + } + ] + }, + { + "name": "Assets", + "actions": [ + { + "name": "FileAsset1", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset185A67CB4" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + } + }, + { + "name": "FileAsset2", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineAssetsFileAsset24D2D639B" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + } + } + ] + }, + { + "name": "PreProd", + "actions": [ + { + "name": "UseSource", + "inputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + }, + "runOrder": 100, + "roleArn": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + } + }, + { + "name": "Stack.Prepare", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "PreProd-Stack", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "PreProd-Stack", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + } + ], + "artifactStore": { + "type": "S3", + "location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "encryptionKey": { + "type": "KMS", + "id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "restartExecutionOnUpdate": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnPipeline", + "version": "0.0.0" + } + }, + "Source": { + "id": "Source", + "path": "PipelineStack/Pipeline/Pipeline/Source", + "children": { + "S3": { + "id": "S3", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/key" + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", + "roles": [ + { + "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Build": { + "id": "Build", + "path": "PipelineStack/Pipeline/Pipeline/Build", + "children": { + "Synth": { + "id": "Synth", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", + "roles": [ + { + "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "CdkBuildProject": { + "id": "CdkBuildProject", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL", + "environmentVariables": [ + { + "name": "NPM_CONFIG_UNSAFE_PERM", + "type": "PLAINTEXT", + "value": "true" + } + ] + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "name": "MyServicePipeline-synth" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", + "children": { + "SelfMutate": { + "id": "SelfMutate", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/Pipeline/Pipeline/PreProd", + "children": { + "UseSource": { + "id": "UseSource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProject2E711EB4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", + "roles": [ + { + "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Project": { + "id": "Project", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", + "roles": [ + { + "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProjectRole69B20A71", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack.Deploy": { + "id": "Stack.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack.Prepare": { + "id": "Stack.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Pipeline/Assets", + "children": { + "FileAsset1": { + "id": "FileAsset1", + "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset1", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "FileAsset2": { + "id": "FileAsset2", + "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset2", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.Pipeline", + "version": "0.0.0" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/UpdatePipeline", + "children": { + "SelfMutation": { + "id": "SelfMutation", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.UpdatePipelineAction", + "version": "0.0.0" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Assets", + "children": { + "FileRole": { + "id": "FileRole", + "path": "PipelineStack/Pipeline/Assets/FileRole", + "children": { + "ImportFileRole": { + "id": "ImportFileRole", + "path": "PipelineStack/Pipeline/Assets/FileRole/ImportFileRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + }, + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/*" + ] + ] + } + }, + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": { + "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", + "roles": [ + { + "Ref": "PipelineAssetsFileRole59943A77" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "FileAsset1": { + "id": "FileAsset1", + "path": "PipelineStack/Pipeline/Assets/FileAsset1", + "children": { + "Default": { + "id": "Default", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/Default", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset1/Default/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.PublishAssetsAction", + "version": "0.0.0" + } + }, + "FileAsset2": { + "id": "FileAsset2", + "path": "PipelineStack/Pipeline/Assets/FileAsset2", + "children": { + "Default": { + "id": "Default", + "path": "PipelineStack/Pipeline/Assets/FileAsset2/Default", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Assets/FileAsset2/Default/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineAssetsFileRole59943A77", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.PublishAssetsAction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/Pipeline/PreProd", + "children": { + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "children": { + "8389e75f-0810-4838-bf64-d6f85a95cf83": { + "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CdkStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CdkPipeline", + "version": "0.0.0" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/PreProd", + "children": { + "Stack": { + "id": "Stack", + "path": "PipelineStack/PreProd/Stack", + "children": { + "Asset": { + "id": "Asset", + "path": "PipelineStack/PreProd/Stack/Asset", + "children": { + "Stage": { + "id": "Stage", + "path": "PipelineStack/PreProd/Stack/Asset/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "PipelineStack/PreProd/Stack/Asset/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Asset2": { + "id": "Asset2", + "path": "PipelineStack/PreProd/Stack/Asset2", + "children": { + "Stage": { + "id": "Stage", + "path": "PipelineStack/PreProd/Stack/Asset2/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "PipelineStack/PreProd/Stack/Asset2/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/PreProd/Stack/Resource", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/PreProd/Stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/PreProd/Stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.ts similarity index 88% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.ts index c251224a24d88..569c91ebe9f71 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-assets.ts @@ -1,12 +1,12 @@ /// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true import * as path from 'path'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import { App, CfnResource, DefaultStackSynthesizer, RemovalPolicy, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; +import { App, CfnResource, DefaultStackSynthesizer, RemovalPolicy, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cdkp from '../lib'; +import * as cdkp from 'aws-cdk-lib/pipelines'; class MyStage extends Stage { constructor(scope: Construct, id: string, props?: StageProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js new file mode 100644 index 0000000000000..82d8868623cd6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const cpactions = require("aws-cdk-lib/aws-codepipeline-actions"); +const ecr = require("aws-cdk-lib/aws-ecr"); +const lambda = require("aws-cdk-lib/aws-lambda"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const pipelines = require("aws-cdk-lib/pipelines"); +const pipelines_1 = require("aws-cdk-lib/pipelines"); +class CustomStep extends pipelines_1.Step { + constructor(stackOutput) { + super('CustomStep'); + this.stackOutput = stackOutput; + } + produceAction(stage, options) { + const [outputRef] = this.consumedStackOutputs; + const handler = new lambda.Function(options.scope, 'CustomFunction', { + runtime: lambda.Runtime.NODEJS_16_X, + code: lambda.Code.fromInline(` + exports.handler = async (event) => { + console.log('Hello world.') + }; + `), + handler: 'index.handler', + }); + stage.addAction(new cpactions.LambdaInvokeAction({ + actionName: options.actionName, + runOrder: options.runOrder, + userParameters: { stackOutput: options.stackOutputsMap.toCodePipeline(outputRef) }, + lambda: handler, + })); + return { runOrdersConsumed: 1 }; + } + get consumedStackOutputs() { + return [pipelines.StackOutputReference.fromCfnOutput(this.stackOutput)]; + } +} +class AppStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'Stack'); + this.output = new aws_cdk_lib_1.CfnOutput(stack, 'OutputVariable', { value: 'Hello' }); + } +} +class PipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const repository = new ecr.Repository(this, 'Source', { removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY }); + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.ecr(repository), + commands: ['mkdir cdk.out', 'touch cdk.out/dummy'], + }), + selfMutation: false, + }); + const stage = new AppStage(this, 'AppStage'); + const postStep = new CustomStep(stage.output); + // WHEN + pipeline.addStage(stage, { post: [postStep] }); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': '1', + }, +}); +const stack = new PipelineStack(app, 'StackOutputPipelineStack'); +new integ.IntegTest(app, 'PipelineWithCustomStepStackOutputTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtd2l0aC1zdGFjay1vdXRwdXRzLWluLWN1c3RvbS1zdGVwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtd2l0aC1zdGFjay1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3J5KSxcbiAgICAgICAgY29tbWFuZHM6IFsnbWtkaXIgY2RrLm91dCcsICd0b3VjaCBjZGsub3V0L2R1bW15J10sXG4gICAgICB9KSxcbiAgICAgIHNlbGZNdXRhdGlvbjogZmFsc2UsXG4gICAgfSk7XG4gICAgY29uc3Qgc3RhZ2UgPSBuZXcgQXBwU3RhZ2UodGhpcywgJ0FwcFN0YWdlJyk7XG5cbiAgICBjb25zdCBwb3N0U3RlcCA9IG5ldyBDdXN0b21TdGVwKHN0YWdlLm91dHB1dCk7XG5cbiAgICAvLyBXSEVOXG5cbiAgICBwaXBlbGluZS5hZGRTdGFnZShzdGFnZSwgeyBwb3N0OiBbcG9zdFN0ZXBdIH0pO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBBcHAoe1xuICBjb250ZXh0OiB7XG4gICAgJ0Bhd3MtY2RrL2NvcmU6bmV3U3R5bGVTdGFja1N5bnRoZXNpcyc6ICcxJyxcbiAgfSxcbn0pO1xuXG5jb25zdCBzdGFjayA9IG5ldyBQaXBlbGluZVN0YWNrKGFwcCwgJ1N0YWNrT3V0cHV0UGlwZWxpbmVTdGFjaycpO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ1BpcGVsaW5lV2l0aEN1c3RvbVN0ZXBTdGFja091dHB1dFRlc3QnLCB7XG4gIHRlc3RDYXNlczogW3N0YWNrXSxcbn0pO1xuXG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/PipelineWithCustomStepStackOutputTestDefaultTestDeployAssert6C17E8C5.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStack.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStackPipeline53534A72.dot b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStackPipeline53534A72.dot similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStackPipeline53534A72.dot rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/StackOutputPipelineStackPipeline53534A72.dot diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/StackOutputPipelineStackAppStageStackB810E610.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/integ.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/tree.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.ts similarity index 85% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.ts index 92c2f1a925554..98d4be41ed3c4 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.ts @@ -1,13 +1,13 @@ /// !cdk-integ StackOutputPipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true -import { IStage } from '@aws-cdk/aws-codepipeline'; -import * as cpactions from '@aws-cdk/aws-codepipeline-actions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack, StackProps, CfnOutput, Stage, StageProps, RemovalPolicy } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import { IStage } from 'aws-cdk-lib/aws-codepipeline'; +import * as cpactions from 'aws-cdk-lib/aws-codepipeline-actions'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack, StackProps, CfnOutput, Stage, StageProps, RemovalPolicy } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as pipelines from '../lib'; -import { ICodePipelineActionFactory, Step } from '../lib'; +import * as pipelines from 'aws-cdk-lib/pipelines'; +import { ICodePipelineActionFactory, Step } from 'aws-cdk-lib/pipelines'; class CustomStep extends Step implements ICodePipelineActionFactory { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js new file mode 100644 index 0000000000000..4ed4e442aae3f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// eslint-disable-next-line import/no-extraneous-dependencies +/// !cdk-integ VariablePipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const codebuild = require("aws-cdk-lib/aws-codebuild"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const pipelines = require("aws-cdk-lib/pipelines"); +class PipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const sourceBucket = new s3.Bucket(this, 'SourceBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.s3(sourceBucket, 'key'), + // input: pipelines.CodePipelineSource.gitHub('cdklabs/construct-hub-probe', 'main', { + // trigger: GitHubTrigger.POLL, + // }), + commands: ['mkdir cdk.out', 'touch cdk.out/dummy'], + }), + selfMutation: false, + }); + const cacheBucket = new s3.Bucket(this, 'TestCacheBucket'); + const producer = new pipelines.CodeBuildStep('Produce', { + commands: ['export MY_VAR=hello'], + cache: codebuild.Cache.bucket(cacheBucket), + }); + const consumer = new pipelines.CodeBuildStep('Consume', { + env: { + THE_VAR: producer.exportedVariable('MY_VAR'), + }, + commands: [ + 'echo "The variable was: $THE_VAR"', + ], + cache: codebuild.Cache.bucket(cacheBucket), + }); + // WHEN + pipeline.addWave('MyWave', { + post: [consumer, producer], + }); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': '1', + }, +}); +new PipelineStack(app, 'VariablePipelineStack'); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtd2l0aC12YXJpYWJsZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbnRlZy5waXBlbGluZS13aXRoLXZhcmlhYmxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDZEQUE2RDtBQUM3RCxpR0FBaUc7QUFDakcsdURBQXVEO0FBQ3ZELHlDQUF5QztBQUN6Qyw2Q0FBb0U7QUFFcEUsbURBQW1EO0FBRW5ELE1BQU0sYUFBYyxTQUFRLG1CQUFLO0lBQy9CLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFFeEIsTUFBTSxZQUFZLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxjQUFjLEVBQUU7WUFDdkQsYUFBYSxFQUFFLDJCQUFhLENBQUMsT0FBTztZQUNwQyxpQkFBaUIsRUFBRSxJQUFJO1NBQ3hCLENBQUMsQ0FBQztRQUNILE1BQU0sUUFBUSxHQUFHLElBQUksU0FBUyxDQUFDLFlBQVksQ0FBQyxJQUFJLEVBQUUsVUFBVSxFQUFFO1lBQzVELEtBQUssRUFBRSxJQUFJLFNBQVMsQ0FBQyxTQUFTLENBQUMsT0FBTyxFQUFFO2dCQUN0QyxLQUFLLEVBQUUsU0FBUyxDQUFDLGtCQUFrQixDQUFDLEVBQUUsQ0FBQyxZQUFZLEVBQUUsS0FBSyxDQUFDO2dCQUMzRCxzRkFBc0Y7Z0JBQ3RGLGlDQUFpQztnQkFDakMsTUFBTTtnQkFDTixRQUFRLEV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29tbWFuZHM6IFtcbiAgICAgICAgJ2VjaG8gXCJUaGUgdmFyaWFibGUgd2FzOiAkVEhFX1ZBUlwiJyxcbiAgICAgIF0sXG4gICAgICBjYWNoZTogY29kZWJ1aWxkLkNhY2hlLmJ1Y2tldChjYWNoZUJ1Y2tldCksXG4gICAgfSk7XG5cbiAgICAvLyBXSEVOXG4gICAgcGlwZWxpbmUuYWRkV2F2ZSgnTXlXYXZlJywge1xuICAgICAgcG9zdDogW2NvbnN1bWVyLCBwcm9kdWNlcl0sXG4gICAgfSk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCh7XG4gIGNvbnRleHQ6IHtcbiAgICAnQGF3cy1jZGsvY29yZTpuZXdTdHlsZVN0YWNrU3ludGhlc2lzJzogJzEnLFxuICB9LFxufSk7XG5cbm5ldyBQaXBlbGluZVN0YWNrKGFwcCwgJ1ZhcmlhYmxlUGlwZWxpbmVTdGFjaycpO1xuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStack.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStackPipeline0F9B805A.dot b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStackPipeline0F9B805A.dot similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStackPipeline0F9B805A.dot rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/VariablePipelineStackPipeline0F9B805A.dot diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.vpc-flow-logs-customformat.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/integ.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.js.snapshot/tree.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.ts similarity index 88% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.ts index afae0a640b0a8..c03f287514b7c 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-with-variables.ts @@ -1,10 +1,10 @@ // eslint-disable-next-line import/no-extraneous-dependencies /// !cdk-integ VariablePipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack, StackProps, RemovalPolicy } from '@aws-cdk/core'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, Stack, StackProps, RemovalPolicy } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as pipelines from '../lib'; +import * as pipelines from 'aws-cdk-lib/pipelines'; class PipelineStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.d.ts new file mode 100644 index 0000000000000..53899645bd953 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.d.ts @@ -0,0 +1,15 @@ +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +/** + * A test stack + * + * It contains a single Bucket. Such robust. Much uptime. + */ +export declare class BucketStack extends Stack { + readonly bucket: s3.IBucket; + constructor(scope: Construct, id: string, props?: StackProps); +} +export declare class PlainStackApp extends Stage { + constructor(scope: Construct, id: string, props?: StageProps); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js new file mode 100644 index 0000000000000..13c4759369c53 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PlainStackApp = exports.BucketStack = void 0; +// eslint-disable-next-line import/no-extraneous-dependencies +/// !cdk-integ VarablePipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const pipelines = require("aws-cdk-lib/pipelines"); +/** + * A test stack + * + * It contains a single Bucket. Such robust. Much uptime. + */ +class BucketStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + this.bucket = new s3.Bucket(this, 'Bucket'); + } +} +exports.BucketStack = BucketStack; +class PlainStackApp extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + new BucketStack(this, 'Stack'); + } +} +exports.PlainStackApp = PlainStackApp; +class MyStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'Stack', { + ...props, + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), + }); + new PlainStackApp(stack, 'MyApp'); + } +} +class PipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const sourceBucket = new s3.Bucket(this, 'SourceBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.s3(sourceBucket, 'key'), + // input: pipelines.CodePipelineSource.gitHub('cdklabs/construct-hub-probe', 'main', { + // trigger: GitHubTrigger.POLL, + // }), + commands: ['mkdir cdk.out', 'touch cdk.out/dummy'], + }), + selfMutation: false, + useChangeSets: false, + }); + pipeline.addStage(new MyStage(this, 'MyStage', {})); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': '1', + }, +}); +const stack = new PipelineStack(app, 'PreparelessPipelineStack'); +new integ.IntegTest(app, 'PreparelessPipelineTest', { + testCases: [stack], +}); +app.synth(); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZWcucGlwZWxpbmUtd2l0aG91dC1wcmVwYXJlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaW50ZWcucGlwZWxpbmUtd2l0aG91dC1wcmVwYXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDZEQUE2RDtBQUM3RCxnR0FBZ0c7QUFDaEcseUNBQXlDO0FBQ3pDLDZDQUFnSDtBQUNoSCxvREFBb0Q7QUFFcEQsbURBQW1EO0FBRW5EOzs7O0dBSUc7QUFDSCxNQUFhLFdBQVksU0FBUSxtQkFBSztJQUdwQyxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQWtCO1FBQzFELEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBQ3hCLElBQUksQ0FBQyxNQUFNLEdBQUcsSUFBSSxFQUFFLENBQUMsTUFBTSxDQUFDLElBQUksRUFBRSxRQUFRLENBQUMsQ0FBQztJQUM5QyxDQUFDO0NBQ0Y7QUFQRCxrQ0FPQztBQUdELE1BQWEsYUFBYyxTQUFRLG1CQUFLO0lBQ3RDLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsS0FBa0I7UUFDMUQsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFDeEIsSUFBSSxXQUFXLENBQUMsSUFBSSxFQUFFLE9BQU8sQ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B7XG4gICAgICAgIC8vICAgdHJpZ2dlcjogR2l0SHViVHJpZ2dlci5QT0xMLFxuICAgICAgICAvLyB9KSxcbiAgICAgICAgY29tbWFuZHM6IFsnbWtkaXIgY2RrLm91dCcsICd0b3VjaCBjZGsub3V0L2R1bW15J10sXG4gICAgICB9KSxcbiAgICAgIHNlbGZNdXRhdGlvbjogZmFsc2UsXG4gICAgICB1c2VDaGFuZ2VTZXRzOiBmYWxzZSxcbiAgICB9KTtcblxuICAgIHBpcGVsaW5lLmFkZFN0YWdlKG5ldyBNeVN0YWdlKHRoaXMsICdNeVN0YWdlJywge30pKTtcbiAgfVxufVxuXG5jb25zdCBhcHAgPSBuZXcgQXBwKHtcbiAgY29udGV4dDoge1xuICAgICdAYXdzLWNkay9jb3JlOm5ld1N0eWxlU3RhY2tTeW50aGVzaXMnOiAnMScsXG4gIH0sXG59KTtcblxuY29uc3Qgc3RhY2sgPSBuZXcgUGlwZWxpbmVTdGFjayhhcHAsICdQcmVwYXJlbGVzc1BpcGVsaW5lU3RhY2snKTtcblxubmV3IGludGVnLkludGVnVGVzdChhcHAsICdQcmVwYXJlbGVzc1BpcGVsaW5lVGVzdCcsIHtcbiAgdGVzdENhc2VzOiBbc3RhY2tdLFxufSk7XG5cbmFwcC5zeW50aCgpO1xuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStack.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStackPipeline55359117.dot b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStackPipeline55359117.dot similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStackPipeline55359117.dot rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineStackPipeline55359117.dot diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/PreparelessPipelineTestDefaultTestDeployAssert7B7DD2C6.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/PreparelessPipelineStackMyStageStack3DC192E7.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.assets.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.assets.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/PreparelessPipelineStackMyStageStackMyAppStack51FBCD39.template.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/integ.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.js.snapshot/tree.json diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.ts similarity index 91% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.ts index 91b52552c6302..0288eb79268d5 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline-without-prepare.ts @@ -1,10 +1,10 @@ // eslint-disable-next-line import/no-extraneous-dependencies /// !cdk-integ VarablePipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack, StackProps, RemovalPolicy, Stage, StageProps, DefaultStackSynthesizer } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, Stack, StackProps, RemovalPolicy, Stage, StageProps, DefaultStackSynthesizer } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; -import * as pipelines from '../lib'; +import * as pipelines from 'aws-cdk-lib/pipelines'; /** * A test stack diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.d.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js new file mode 100644 index 0000000000000..331212635b282 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js @@ -0,0 +1,78 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true +const codepipeline = require("aws-cdk-lib/aws-codepipeline"); +const codepipeline_actions = require("aws-cdk-lib/aws-codepipeline-actions"); +const s3 = require("aws-cdk-lib/aws-s3"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const cdkp = require("aws-cdk-lib/pipelines"); +class MyStage extends aws_cdk_lib_1.Stage { + constructor(scope, id, props) { + super(scope, id, props); + const stack = new aws_cdk_lib_1.Stack(this, 'Stack', { + ...props, + synthesizer: new aws_cdk_lib_1.DefaultStackSynthesizer(), + }); + new aws_cdk_lib_1.CfnResource(stack, 'Resource', { + type: 'AWS::Test::SomeResource', + }); + } +} +/** + * The stack that defines the application pipeline + */ +class CdkpipelinesDemoPipelineStack extends aws_cdk_lib_1.Stack { + constructor(scope, id, props) { + super(scope, id, props); + const sourceArtifact = new codepipeline.Artifact(); + const cloudAssemblyArtifact = new codepipeline.Artifact('CloudAsm'); + const integTestArtifact = new codepipeline.Artifact('IntegTests'); + const sourceBucket = new s3.Bucket(this, 'SourceBucket', { + removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, + autoDeleteObjects: true, + }); + const pipeline = new cdkp.CdkPipeline(this, 'Pipeline', { + cloudAssemblyArtifact, + // Where the source can be found + sourceAction: new codepipeline_actions.S3SourceAction({ + bucket: sourceBucket, + output: sourceArtifact, + bucketKey: 'key', + actionName: 'S3', + }), + // How it will be built + synthAction: cdkp.SimpleSynthAction.standardNpmSynth({ + sourceArtifact, + cloudAssemblyArtifact, + projectName: 'MyServicePipeline-synth', + additionalArtifacts: [ + { + directory: 'test', + artifact: integTestArtifact, + }, + ], + }), + }); + // This is where we add the application stages + // ... + const stage = pipeline.addApplicationStage(new MyStage(this, 'PreProd')); + stage.addActions(new cdkp.ShellScriptAction({ + actionName: 'UseSource', + commands: [ + // Comes from source + 'cat README.md', + ], + additionalArtifacts: [sourceArtifact], + })); + } +} +const app = new aws_cdk_lib_1.App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': 'true', + }, +}); +new CdkpipelinesDemoPipelineStack(app, 'PipelineStack', { + synthesizer: new aws_cdk_l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gICAgICAgZGlyZWN0b3J5OiAndGVzdCcsXG4gICAgICAgICAgICBhcnRpZmFjdDogaW50ZWdUZXN0QXJ0aWZhY3QsXG4gICAgICAgICAgfSxcbiAgICAgICAgXSxcbiAgICAgIH0pLFxuICAgIH0pO1xuXG4gICAgLy8gVGhpcyBpcyB3aGVyZSB3ZSBhZGQgdGhlIGFwcGxpY2F0aW9uIHN0YWdlc1xuICAgIC8vIC4uLlxuICAgIGNvbnN0IHN0YWdlID0gcGlwZWxpbmUuYWRkQXBwbGljYXRpb25TdGFnZShuZXcgTXlTdGFnZSh0aGlzLCAnUHJlUHJvZCcpKTtcbiAgICBzdGFnZS5hZGRBY3Rpb25zKFxuICAgICAgbmV3IGNka3AuU2hlbGxTY3JpcHRBY3Rpb24oe1xuICAgICAgICBhY3Rpb25OYW1lOiAnVXNlU291cmNlJyxcbiAgICAgICAgY29tbWFuZHM6IFtcbiAgICAgICAgICAvLyBDb21lcyBmcm9tIHNvdXJjZVxuICAgICAgICAgICdjYXQgUkVBRE1FLm1kJyxcbiAgICAgICAgXSxcbiAgICAgICAgYWRkaXRpb25hbEFydGlmYWN0czogW3NvdXJjZUFydGlmYWN0XSxcbiAgICAgIH0pLFxuICAgICk7XG4gIH1cbn1cblxuY29uc3QgYXBwID0gbmV3IEFwcCh7XG4gIGNvbnRleHQ6IHtcbiAgICAnQGF3cy1jZGsvY29yZTpuZXdTdHlsZVN0YWNrU3ludGhlc2lzJzogJ3RydWUnLFxuICB9LFxufSk7XG5uZXcgQ2RrcGlwZWxpbmVzRGVtb1BpcGVsaW5lU3RhY2soYXBwLCAnUGlwZWxpbmVTdGFjaycsIHtcbiAgc3ludGhlc2l6ZXI6IG5ldyBEZWZhdWx0U3RhY2tTeW50aGVzaXplcigpLFxufSk7XG5hcHAuc3ludGgoKTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.assets.json new file mode 100644 index 0000000000000..2f735f9045c93 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "31.0.0", + "files": { + "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9": { + "source": { + "path": "asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "ef736f6b2ab9622d9d8259658b9fdafecb46e7f935d8b687afc4839dc2e0c666": { + "source": { + "path": "PipelineStack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "ef736f6b2ab9622d9d8259658b9fdafecb46e7f935d8b687afc4839dc2e0c666.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.template.json new file mode 100644 index 0000000000000..7f6ec6adf2290 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.template.json @@ -0,0 +1,1777 @@ +{ + "Resources": { + "SourceBucketDDD2130A": { + "Type": "AWS::S3::Bucket", + "Properties": { + "Tags": [ + { + "Key": "aws-cdk:auto-delete-objects", + "Value": "true" + } + ] + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "SourceBucketPolicy703DFBF9": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "SourceBucketAutoDeleteObjectsCustomResourceC68FC040": { + "Type": "Custom::S3AutoDeleteObjects", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", + "Arn" + ] + }, + "BucketName": { + "Ref": "SourceBucketDDD2130A" + } + }, + "DependsOn": [ + "SourceBucketPolicy703DFBF9" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ] + } + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + }, + "Runtime": "nodejs14.x", + "Description": { + "Fn::Join": [ + "", + [ + "Lambda function for auto-deleting objects in ", + { + "Ref": "SourceBucketDDD2130A" + }, + " S3 bucket." + ] + ] + } + }, + "DependsOn": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + ] + }, + "PipelineArtifactsBucketEncryptionKeyF5BF0670": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { + "Type": "AWS::KMS::Alias", + "Properties": { + "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "TargetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "PipelineArtifactsBucketAEA9A052": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "KMSMasterKeyID": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "SSEAlgorithm": "aws:kms" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "PipelineArtifactsBucketPolicyF53CCC52": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleB27FAA37": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineRoleDefaultPolicy7BDC1ABB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "Roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "Pipeline9850B417": { + "Type": "AWS::CodePipeline::Pipeline", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "Stages": [ + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Source", + "Owner": "AWS", + "Provider": "S3", + "Version": "1" + }, + "Configuration": { + "S3Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "S3ObjectKey": "key" + }, + "Name": "S3", + "OutputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Source" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" + }, + "InputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "Name": "Synth", + "OutputArtifacts": [ + { + "Name": "CloudAsm" + }, + { + "Name": "IntegTests" + } + ], + "RoleArn": { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "Build" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "SelfMutate", + "RoleArn": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + "RunOrder": 1 + } + ], + "Name": "UpdatePipeline" + }, + { + "Actions": [ + { + "ActionTypeId": { + "Category": "Build", + "Owner": "AWS", + "Provider": "CodeBuild", + "Version": "1" + }, + "Configuration": { + "ProjectName": { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + }, + "InputArtifacts": [ + { + "Name": "Artifact_Source_S3" + } + ], + "Name": "UseSource", + "RoleArn": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + "RunOrder": 100 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "PreProd-Stack", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" + }, + "InputArtifacts": [ + { + "Name": "CloudAsm" + } + ], + "Name": "Stack.Prepare", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 1 + }, + { + "ActionTypeId": { + "Category": "Deploy", + "Owner": "AWS", + "Provider": "CloudFormation", + "Version": "1" + }, + "Configuration": { + "StackName": "PreProd-Stack", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "Name": "Stack.Deploy", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "RunOrder": 2 + } + ], + "Name": "PreProd" + } + ], + "ArtifactStore": { + "EncryptionKey": { + "Id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Type": "KMS" + }, + "Location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "Type": "S3" + }, + "RestartExecutionOnUpdate": true + }, + "DependsOn": [ + "PipelineRoleDefaultPolicy7BDC1ABB", + "PipelineRoleB27FAA37" + ] + }, + "PipelineSourceS3CodePipelineActionRole83895A58": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/key" + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", + "Roles": [ + { + "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ] + } + }, + "PipelineBuildSynthCodePipelineActionRole4E7A6C97": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", + "Roles": [ + { + "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "Roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "PipelineBuildSynthCdkBuildProject6BEFA8E6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "EnvironmentVariables": [ + { + "Name": "NPM_CONFIG_UNSAFE_PERM", + "Type": "PLAINTEXT", + "Value": "true" + } + ], + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "Name": "MyServicePipeline-synth" + } + }, + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ] + } + }, + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProject2E711EB4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", + "Roles": [ + { + "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ] + } + }, + "PipelinePreProdUseSourceProjectRole69B20A71": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", + "Roles": [ + { + "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ] + } + }, + "PipelinePreProdUseSourceProject2E711EB4": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProjectRole69B20A71", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "PipelineUpdatePipelineSelfMutationRole57E559E8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "Roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "PipelineUpdatePipelineSelfMutationDAA41400": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "CODEPIPELINE" + }, + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:6.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", + "Type": "CODEPIPELINE" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json new file mode 100644 index 0000000000000..22e80aa7eccda --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json @@ -0,0 +1,19 @@ +{ + "version": "31.0.0", + "files": { + "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4": { + "source": { + "path": "PipelineStackPreProdStack65A0AD1F.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/manifest.json new file mode 100644 index 0000000000000..0c5d00061bc62 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/manifest.json @@ -0,0 +1,59 @@ +{ + "version": "31.0.0", + "artifacts": { + "PipelineStackPreProdStack65A0AD1F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStackPreProdStack65A0AD1F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStackPreProdStack65A0AD1F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStackPreProdStack65A0AD1F.template.json", + "validateOnSynth": true, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStackPreProdStack65A0AD1F.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + }, + "stackName": "PreProd-Stack" + }, + "dependencies": [ + "PipelineStackPreProdStack65A0AD1F.assets" + ], + "metadata": { + "/PipelineStack/PreProd/Stack/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Resource" + } + ], + "/PipelineStack/PreProd/Stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/PreProd/Stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack/PreProd/Stack" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js new file mode 100644 index 0000000000000..c83ecebaaadac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/__entrypoint__.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + exports.external.log('submit response to cloudformation', json); + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, responseBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, _ => resolve()); + request.on('error', reject); + request.write(responseBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJub2RlanMtZW50cnlwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBRTNCLGlCQUFpQjtBQUNKLFFBQUEsUUFBUSxHQUFHO0lBQ3RCLGVBQWUsRUFBRSxzQ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ICogbXMpKTtcbiAgICAgICAgbXMgKj0gMjtcbiAgICAgIH1cbiAgICB9XG4gIH07XG59XG5cbmFzeW5jIGZ1bmN0aW9uIHNsZWVwKG1zOiBudW1iZXIpOiBQcm9taXNlPHZvaWQ+IHtcbiAgcmV0dXJuIG5ldyBQcm9taXNlKChvaykgPT4gc2V0VGltZW91dChvaywgbXMpKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/asset.40aa87cdf43c4095cec18bc443965f22ab2f8c1ace47e482a0ba4e35d83b0cc9/index.js diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/cdk.out new file mode 100644 index 0000000000000..7925065efbcc4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"31.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/integ.json new file mode 100644 index 0000000000000..03f840b0996ec --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/integ.json @@ -0,0 +1,16 @@ +{ + "version": "31.0.0", + "testCases": { + "integ.pipeline": { + "stacks": [ + "PipelineStack" + ], + "diffAssets": false, + "stackUpdateWorkflow": true + } + }, + "synthContext": { + "@aws-cdk/core:newStyleStackSynthesis": "true" + }, + "enableLookups": false +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/manifest.json new file mode 100644 index 0000000000000..4567be8abbd35 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/manifest.json @@ -0,0 +1,239 @@ +{ + "version": "31.0.0", + "artifacts": { + "assembly-PipelineStack-PreProd": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "assembly-PipelineStack-PreProd", + "displayName": "PipelineStack/PreProd" + } + }, + "PipelineStack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "PipelineStack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "PipelineStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "PipelineStack.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/ef736f6b2ab9622d9d8259658b9fdafecb46e7f935d8b687afc4839dc2e0c666.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "PipelineStack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "PipelineStack.assets" + ], + "metadata": { + "/PipelineStack/SourceBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketDDD2130A" + } + ], + "/PipelineStack/SourceBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketPolicy703DFBF9" + } + ], + "/PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "SourceBucketAutoDeleteObjectsCustomResourceC68FC040" + } + ], + "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + } + ], + "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketAEA9A052" + } + ], + "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineArtifactsBucketPolicyF53CCC52" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleB27FAA37" + } + ], + "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineRoleDefaultPolicy7BDC1ABB" + } + ], + "/PipelineStack/Pipeline/Pipeline/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Pipeline9850B417" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ], + "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" + } + ], + "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ], + "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ], + "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3" + } + ], + "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelinePreProdUseSourceProject2E711EB4" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" + } + ], + "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ], + "/PipelineStack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/PipelineStack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "PipelineStack" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/tree.json new file mode 100644 index 0000000000000..3b9d5bea7d64a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.js.snapshot/tree.json @@ -0,0 +1,2501 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "PipelineStack": { + "id": "PipelineStack", + "path": "PipelineStack", + "children": { + "SourceBucket": { + "id": "SourceBucket", + "path": "PipelineStack/SourceBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/SourceBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "aws-cdk:auto-delete-objects", + "value": "true" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/SourceBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/SourceBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + }, + "AutoDeleteObjectsCustomResource": { + "id": "AutoDeleteObjectsCustomResource", + "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Custom::S3AutoDeleteObjectsCustomResourceProvider": { + "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProvider", + "version": "0.0.0" + } + }, + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline", + "children": { + "Pipeline": { + "id": "Pipeline", + "path": "PipelineStack/Pipeline/Pipeline", + "children": { + "ArtifactsBucketEncryptionKey": { + "id": "ArtifactsBucketEncryptionKey", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "0.0.0" + } + }, + "ArtifactsBucketEncryptionKeyAlias": { + "id": "ArtifactsBucketEncryptionKeyAlias", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Alias", + "aws:cdk:cloudformation:props": { + "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", + "targetKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Alias", + "version": "0.0.0" + } + }, + "ArtifactsBucket": { + "id": "ArtifactsBucket", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::Bucket", + "aws:cdk:cloudformation:props": { + "bucketEncryption": { + "serverSideEncryptionConfiguration": [ + { + "serverSideEncryptionByDefault": { + "sseAlgorithm": "aws:kms", + "kmsMasterKeyId": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + } + ] + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "0.0.0" + } + }, + "Policy": { + "id": "Policy", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codepipeline.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + }, + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + }, + { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", + "roles": [ + { + "Ref": "PipelineRoleB27FAA37" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "PipelineRoleB27FAA37", + "Arn" + ] + }, + "stages": [ + { + "name": "Source", + "actions": [ + { + "name": "S3", + "outputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "actionTypeId": { + "category": "Source", + "version": "1", + "owner": "AWS", + "provider": "S3" + }, + "configuration": { + "S3Bucket": { + "Ref": "SourceBucketDDD2130A" + }, + "S3ObjectKey": "key" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineSourceS3CodePipelineActionRole83895A58", + "Arn" + ] + } + } + ] + }, + { + "name": "Build", + "actions": [ + { + "name": "Synth", + "inputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "outputArtifacts": [ + { + "name": "CloudAsm" + }, + { + "name": "IntegTests" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineBuildSynthCodePipelineActionRole4E7A6C97", + "Arn" + ] + } + } + ] + }, + { + "name": "UpdatePipeline", + "actions": [ + { + "name": "SelfMutate", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"2\"}]" + }, + "runOrder": 1, + "roleArn": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", + "Arn" + ] + } + } + ] + }, + { + "name": "PreProd", + "actions": [ + { + "name": "UseSource", + "inputArtifacts": [ + { + "name": "Artifact_Source_S3" + } + ], + "actionTypeId": { + "category": "Build", + "version": "1", + "owner": "AWS", + "provider": "CodeBuild" + }, + "configuration": { + "ProjectName": { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + }, + "runOrder": 100, + "roleArn": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", + "Arn" + ] + } + }, + { + "name": "Stack.Prepare", + "inputArtifacts": [ + { + "name": "CloudAsm" + } + ], + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "PreProd-Stack", + "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", + "RoleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-cfn-exec-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + }, + "ActionMode": "CHANGE_SET_REPLACE", + "ChangeSetName": "PipelineChange", + "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" + }, + "runOrder": 1, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + }, + { + "name": "Stack.Deploy", + "actionTypeId": { + "category": "Deploy", + "version": "1", + "owner": "AWS", + "provider": "CloudFormation" + }, + "configuration": { + "StackName": "PreProd-Stack", + "ActionMode": "CHANGE_SET_EXECUTE", + "ChangeSetName": "PipelineChange" + }, + "runOrder": 2, + "roleArn": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/cdk-hnb659fds-deploy-role-", + { + "Ref": "AWS::AccountId" + }, + "-", + { + "Ref": "AWS::Region" + } + ] + ] + } + } + ] + } + ], + "artifactStore": { + "type": "S3", + "location": { + "Ref": "PipelineArtifactsBucketAEA9A052" + }, + "encryptionKey": { + "type": "KMS", + "id": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "restartExecutionOnUpdate": true + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.CfnPipeline", + "version": "0.0.0" + } + }, + "Source": { + "id": "Source", + "path": "PipelineStack/Pipeline/Pipeline/Source", + "children": { + "S3": { + "id": "S3", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "SourceBucketDDD2130A", + "Arn" + ] + }, + "/key" + ] + ] + } + ] + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", + "roles": [ + { + "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Build": { + "id": "Build", + "path": "PipelineStack/Pipeline/Pipeline/Build", + "children": { + "Synth": { + "id": "Synth", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProject6BEFA8E6", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", + "roles": [ + { + "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "CdkBuildProject": { + "id": "CdkBuildProject", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:Abort*", + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", + "roles": [ + { + "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL", + "environmentVariables": [ + { + "name": "NPM_CONFIG_UNSAFE_PERM", + "type": "PLAINTEXT", + "value": "true" + } + ] + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineBuildSynthCdkBuildProjectRole231EEA2A", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + }, + "name": "MyServicePipeline-synth" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", + "children": { + "SelfMutate": { + "id": "SelfMutate", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationDAA41400", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/Pipeline/Pipeline/PreProd", + "children": { + "UseSource": { + "id": "UseSource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource", + "children": { + "CodePipelineActionRole": { + "id": "CodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole", + "children": { + "ImportCodePipelineActionRole": { + "id": "ImportCodePipelineActionRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/ImportCodePipelineActionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "codebuild:BatchGetBuilds", + "codebuild:StartBuild", + "codebuild:StopBuild" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProject2E711EB4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", + "roles": [ + { + "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Project": { + "id": "Project", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelinePreProdUseSourceProject2E711EB4" + }, + "-*" + ] + ] + } + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", + "roles": [ + { + "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelinePreProdUseSourceProjectRole69B20A71", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack.Deploy": { + "id": "Stack.Deploy", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Deploy", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "Stack.Prepare": { + "id": "Stack.Prepare", + "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Prepare", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codepipeline.Pipeline", + "version": "0.0.0" + } + }, + "UpdatePipeline": { + "id": "UpdatePipeline", + "path": "PipelineStack/Pipeline/UpdatePipeline", + "children": { + "SelfMutation": { + "id": "SelfMutation", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", + "children": { + "Role": { + "id": "Role", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" + }, + "-*" + ] + ] + } + }, + { + "Action": "sts:AssumeRole", + "Condition": { + "ForAnyValue:StringEquals": { + "iam:ResourceTag/aws-cdk:bootstrap-role": [ + "image-publishing", + "file-publishing", + "deploy" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:*:iam::", + { + "Ref": "AWS::AccountId" + }, + ":role/*" + ] + ] + } + }, + { + "Action": [ + "cloudformation:DescribeStacks", + "s3:ListBucket" + ], + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "s3:GetBucket*", + "s3:GetObject*", + "s3:List*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "PipelineArtifactsBucketAEA9A052", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", + "roles": [ + { + "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "CODEPIPELINE" + }, + "environment": { + "type": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:6.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "PipelineUpdatePipelineSelfMutationRole57E559E8", + "Arn" + ] + }, + "source": { + "type": "CODEPIPELINE", + "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@2\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": { + "Fn::GetAtt": [ + "PipelineArtifactsBucketEncryptionKeyF5BF0670", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.PipelineProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.UpdatePipelineAction", + "version": "0.0.0" + } + }, + "Assets": { + "id": "Assets", + "path": "PipelineStack/Pipeline/Assets", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/Pipeline/PreProd", + "children": { + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "children": { + "8389e75f-0810-4838-bf64-d6f85a95cf83": { + "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { + "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CdkStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.pipelines.CdkPipeline", + "version": "0.0.0" + } + }, + "PreProd": { + "id": "PreProd", + "path": "PipelineStack/PreProd", + "children": { + "Stack": { + "id": "Stack", + "path": "PipelineStack/PreProd/Stack", + "children": { + "Resource": { + "id": "Resource", + "path": "PipelineStack/PreProd/Stack/Resource", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/PreProd/Stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/PreProd/Stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stage", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "PipelineStack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "PipelineStack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.270" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.ts b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.ts similarity index 89% rename from packages/@aws-cdk/pipelines/test/integ.pipeline.ts rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.ts index bf10ee0c6dcf3..9244f9fd65333 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/integ.pipeline.ts @@ -1,10 +1,10 @@ /// !cdk-integ PipelineStack pragma:set-context:@aws-cdk/core:newStyleStackSynthesis=true -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, CfnResource, DefaultStackSynthesizer, RemovalPolicy, Stack, StackProps, Stage, StageProps } from '@aws-cdk/core'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, CfnResource, DefaultStackSynthesizer, RemovalPolicy, Stack, StackProps, Stage, StageProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cdkp from '../lib'; +import * as cdkp from 'aws-cdk-lib/pipelines'; class MyStage extends Stage { constructor(scope: Construct, id: string, props?: StageProps) { diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile similarity index 100% rename from packages/@aws-cdk/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/assets/test-file-asset-two.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/testhelpers/assets/test-file-asset-two.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/testhelpers/assets/test-file-asset-two.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/testhelpers/assets/test-file-asset-two.txt diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/assets/test-file-asset.txt b/packages/@aws-cdk-testing/framework-integ/test/pipelines/test/testhelpers/assets/test-file-asset.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/testhelpers/assets/test-file-asset.txt rename to packages/@aws-cdk-testing/framework-integ/test/pipelines/test/testhelpers/assets/test-file-asset.txt diff --git a/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.d.ts b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.d.ts new file mode 100644 index 0000000000000..cb0ff5c3b541f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js new file mode 100644 index 0000000000000..2e4965d073aac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lambda = require("aws-cdk-lib/aws-lambda"); +const sns = require("aws-cdk-lib/aws-sns"); +const aws_cdk_lib_1 = require("aws-cdk-lib"); +const integ = require("@aws-cdk/integ-tests-alpha"); +const triggers = require("aws-cdk-lib/triggers"); +const app = new aws_cdk_lib_1.App(); +const stack = new aws_cdk_lib_1.Stack(app, 'MyStack'); +const topic1 = new sns.Topic(stack, 'Topic1'); +const topic2 = new sns.Topic(stack, 'Topic2'); +const trigger = new triggers.TriggerFunction(stack, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('exports.handler = function() { console.log("hi"); };'), + executeBefore: [topic1], +}); +trigger.executeAfter(topic2); +new triggers.TriggerFunction(stack, 'MySecondFunction', { + runtime: lambda.Runtime.NODEJS_16_X, + handler: 'index.handler', + code: lambda.Code.fromInline('exports.handler = function() { console.log("hello"); };'), +}); +new integ.IntegTest(app,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E0X1gsXG4gIGhhbmRsZXI6ICdpbmRleC5oYW5kbGVyJyxcbiAgY29kZTogbGFtYmRhLkNvZGUuZnJvbUlubGluZSgnZXhwb3J0cy5oYW5kbGVyID0gZnVuY3Rpb24oKSB7IGNvbnNvbGUubG9nKFwiaGlcIik7IH07JyksXG4gIGV4ZWN1dGVCZWZvcmU6IFt0b3BpYzFdLFxufSk7XG5cbnRyaWdnZXIuZXhlY3V0ZUFmdGVyKHRvcGljMik7XG5cbm5ldyB0cmlnZ2Vycy5UcmlnZ2VyRnVuY3Rpb24oc3RhY2ssICdNeVNlY29uZEZ1bmN0aW9uJywge1xuICBydW50aW1lOiBsYW1iZGEuUnVudGltZS5OT0RFSlNfMTZfWCxcbiAgaGFuZGxlcjogJ2luZGV4LmhhbmRsZXInLFxuICBjb2RlOiBsYW1iZGEuQ29kZS5mcm9tSW5saW5lKCdleHBvcnRzLmhhbmRsZXIgPSBmdW5jdGlvbigpIHsgY29uc29sZS5sb2coXCJoZWxsb1wiKTsgfTsnKSxcbn0pO1xuXG5uZXcgaW50ZWcuSW50ZWdUZXN0KGFwcCwgJ1RyaWdnZXJUZXN0Jywge1xuICB0ZXN0Q2FzZXM6IFtzdGFja10sXG59KTtcblxuYXBwLnN5bnRoKCk7XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/MyStack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/MyStack.assets.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/MyStack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/MyStack.assets.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/MyStack.template.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/MyStack.template.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/MyStack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/MyStack.template.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.assets.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.assets.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.assets.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.template.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.template.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.template.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/TriggerTestDefaultTestDeployAssert61636546.template.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/cdk.out rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/cdk.out diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/integ.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/integ.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/manifest.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/manifest.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/triggers/test/integ.triggers.js.snapshot/tree.json rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.js.snapshot/tree.json diff --git a/packages/@aws-cdk/triggers/test/integ.triggers.ts b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.ts similarity index 75% rename from packages/@aws-cdk/triggers/test/integ.triggers.ts rename to packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.ts index e59101eaf53b4..8f2ca50789690 100644 --- a/packages/@aws-cdk/triggers/test/integ.triggers.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/triggers/test/integ.triggers.ts @@ -1,8 +1,8 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as triggers from '../lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import * as triggers from 'aws-cdk-lib/triggers'; const app = new App(); const stack = new Stack(app, 'MyStack'); diff --git a/packages/@aws-cdk-testing/framework-integ/tsconfig.json b/packages/@aws-cdk-testing/framework-integ/tsconfig.json new file mode 100644 index 0000000000000..964e7e28fa2fc --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "lib": ["es2019", "es2020", "dom"], + "strict": true, + "alwaysStrict": true, + "declaration": true, + "inlineSourceMap": true, + "inlineSources": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "experimentalDecorators": true, + "resolveJsonModule": true, + "composite": true, + "incremental": true + }, + "include": [ + "**/*.ts", + "**/*.d.ts" + ], + "exclude": [ + "resources/**/*", + "**/*.snapshot/**/*" + ] +} diff --git a/packages/@aws-cdk/alexa-ask/.gitignore b/packages/@aws-cdk/alexa-ask/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/alexa-ask/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/alexa-ask/.npmignore b/packages/@aws-cdk/alexa-ask/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/alexa-ask/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/alexa-ask/README.md b/packages/@aws-cdk/alexa-ask/README.md deleted file mode 100644 index 9de782e255195..0000000000000 --- a/packages/@aws-cdk/alexa-ask/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Alexa Skills Kit Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as alexa_ask from '@aws-cdk/alexa-ask'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ASK construct libraries](https://constructs.dev/search?q=ask) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation Alexa::ASK resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Alexa_ASK.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for Alexa::ASK](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Alexa_ASK.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/alexa-ask/jest.config.js b/packages/@aws-cdk/alexa-ask/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/alexa-ask/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/alexa-ask/lib/index.ts b/packages/@aws-cdk/alexa-ask/lib/index.ts deleted file mode 100644 index 59194e547cc5a..0000000000000 --- a/packages/@aws-cdk/alexa-ask/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Alexa::ASK CloudFormation Resources: -export * from './ask.generated'; diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json deleted file mode 100644 index bf769db681cf9..0000000000000 --- a/packages/@aws-cdk/alexa-ask/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/alexa-ask", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for Alexa::ASK", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.Alexa.Ask", - "packageId": "Amazon.CDK.Alexa.Ask", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.alexa.ask", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "alexa-ask" - } - }, - "python": { - "distName": "aws-cdk.alexa-ask", - "module": "aws_cdk.alexa_ask", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/alexa-ask" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "Alexa::ASK", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "alexa-ask" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/alexa-ask/test/ask.test.ts b/packages/@aws-cdk/alexa-ask/test/ask.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/alexa-ask/test/ask.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/assertions/.eslintrc.js b/packages/@aws-cdk/assertions/.eslintrc.js deleted file mode 100644 index 274069c3dd9e0..0000000000000 --- a/packages/@aws-cdk/assertions/.eslintrc.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = { - ...baseConfig, - ignorePatterns: [...baseConfig.ignorePatterns, 'lib/vendored/'], - rules: { - ...baseConfig.rules, - '@typescript-eslint/explicit-function-return-type': ['error'], - } -}; diff --git a/packages/@aws-cdk/assertions/.gitignore b/packages/@aws-cdk/assertions/.gitignore deleted file mode 100644 index 0f9ee623d16cd..0000000000000 --- a/packages/@aws-cdk/assertions/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -lib/vendored/ - -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/assertions/.npmignore b/packages/@aws-cdk/assertions/.npmignore deleted file mode 100644 index 1b85a2d6623ba..0000000000000 --- a/packages/@aws-cdk/assertions/.npmignore +++ /dev/null @@ -1,26 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!.jsii -!*.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/assertions/NOTICE b/packages/@aws-cdk/assertions/NOTICE deleted file mode 100644 index 2684ad262c0db..0000000000000 --- a/packages/@aws-cdk/assertions/NOTICE +++ /dev/null @@ -1,88 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** fs-extra - https://www.npmjs.com/package/fs-extra -Copyright (c) 2011-2017 JP Richardson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- - -** at-least-node - https://www.npmjs.com/package/at-least-node -Copyright (c) 2020 Ryan Zimmerman - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------- - -** graceful-fs - https://www.npmjs.com/package/graceful-fs -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------- - -** jsonfile - https://www.npmjs.com/package/jsonfile -Copyright (c) 2012-2015, JP Richardson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, - merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- - -** universalify - https://www.npmjs.com/package/universalify -Copyright (c) 2017, Ryan Zimmerman - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the 'Software'), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- diff --git a/packages/@aws-cdk/assertions/README.md b/packages/@aws-cdk/assertions/README.md deleted file mode 100644 index 48361f66effc8..0000000000000 --- a/packages/@aws-cdk/assertions/README.md +++ /dev/null @@ -1,605 +0,0 @@ -# Assertions - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -If you're migrating from the old `assert` library, the migration guide can be found in -[our GitHub repository](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/assertions/MIGRATING.md). - -Functions for writing test asserting against CDK applications, with focus on CloudFormation templates. - -The `Template` class includes a set of methods for writing assertions against CloudFormation templates. Use one of the `Template.fromXxx()` static methods to create an instance of this class. - -To create `Template` from CDK stack, start off with: - -```ts nofixture -import { Stack } from '@aws-cdk/core'; -import { Template } from '@aws-cdk/assertions'; - -const stack = new Stack(/* ... */); -// ... -const template = Template.fromStack(stack); -``` - -Alternatively, assertions can be run on an existing CloudFormation template - - -```ts fixture=init -const templateJson = '{ "Resources": ... }'; /* The CloudFormation template as JSON serialized string. */ -const template = Template.fromString(templateJson); -``` - -**Cyclical Resources Note** - -If allowing cyclical references is desired, for example in the case of unprocessed Transform templates, supply TemplateParsingOptions and -set skipCyclicalDependenciesCheck to true. In all other cases, will fail on detecting cyclical dependencies. - -## Full Template Match - -The simplest assertion would be to assert that the template matches a given -template. - -```ts -template.templateMatches({ - Resources: { - BarLogicalId: { - Type: 'Foo::Bar', - Properties: { - Baz: 'Qux', - }, - }, - }, -}); -``` - -By default, the `templateMatches()` API will use the an 'object-like' comparison, -which means that it will allow for the actual template to be a superset of the -given expectation. See [Special Matchers](#special-matchers) for details on how -to change this. - -Snapshot testing is a common technique to store a snapshot of the output and -compare it during future changes. Since CloudFormation templates are human readable, -they are a good target for snapshot testing. - -The `toJSON()` method on the `Template` can be used to produce a well formatted JSON -of the CloudFormation template that can be used as a snapshot. - -See [Snapshot Testing in Jest](https://jestjs.io/docs/snapshot-testing) and [Snapshot -Testing in Java](https://json-snapshot.github.io/). - -## Counting Resources - -This module allows asserting the number of resources of a specific type found -in a template. - -```ts -template.resourceCountIs('Foo::Bar', 2); -``` - -You can also count the number of resources of a specific type whose `Properties` -section contains the specified properties: - -```ts -template.resourcePropertiesCountIs('Foo::Bar', { - Foo: 'Bar', - Baz: 5, - Qux: [ 'Waldo', 'Fred' ], -}, 1); -``` - -## Resource Matching & Retrieval - -Beyond resource counting, the module also allows asserting that a resource with -specific properties are present. - -The following code asserts that the `Properties` section of a resource of type -`Foo::Bar` contains the specified properties - - -```ts -template.hasResourceProperties('Foo::Bar', { - Lorem: 'Ipsum', - Baz: 5, - Qux: [ 'Waldo', 'Fred' ], -}); -``` - -You can also assert that the `Properties` section of all resources of type -`Foo::Bar` contains the specified properties - - -```ts -template.allResourcesProperties('Foo::Bar', { - Lorem: 'Ipsum', - Baz: 5, - Qux: [ 'Waldo', 'Fred' ], -}); -``` - -Alternatively, if you would like to assert the entire resource definition, you -can use the `hasResource()` API. - -```ts -template.hasResource('Foo::Bar', { - Properties: { Lorem: 'Ipsum' }, - DependsOn: [ 'Waldo', 'Fred' ], -}); -``` - -You can also assert the definitions of all resources of a type using the -`allResources()` API. - -```ts -template.allResources('Foo::Bar', { - Properties: { Lorem: 'Ipsum' }, - DependsOn: [ 'Waldo', 'Fred' ], -}); -``` - -Beyond assertions, the module provides APIs to retrieve matching resources. -The `findResources()` API is complementary to the `hasResource()` API, except, -instead of asserting its presence, it returns the set of matching resources. - -By default, the `hasResource()` and `hasResourceProperties()` APIs perform deep -partial object matching. This behavior can be configured using matchers. -See subsequent section on [special matchers](#special-matchers). - -## Output and Mapping sections - -The module allows you to assert that the CloudFormation template contains an Output -that matches specific properties. The following code asserts that a template contains -an Output with a `logicalId` of `Foo` and the specified properties - - -```ts -const expected = { - Value: 'Bar', - Export: { Name: 'ExportBaz' }, -}; -template.hasOutput('Foo', expected); -``` - -If you want to match against all Outputs in the template, use `*` as the `logicalId`. - -```ts -template.hasOutput('*', { - Value: 'Bar', - Export: { Name: 'ExportBaz' }, -}); -``` - -`findOutputs()` will return a set of outputs that match the `logicalId` and `props`, -and you can use the `'*'` special case as well. - -```ts -const result = template.findOutputs('*', { Value: 'Fred' }); -expect(result.Foo).toEqual({ Value: 'Fred', Description: 'FooFred' }); -expect(result.Bar).toEqual({ Value: 'Fred', Description: 'BarFred' }); -``` - -The APIs `hasMapping()`, `findMappings()`, `hasCondition()`, and `hasCondtions()` provide similar functionalities. - -## Special Matchers - -The expectation provided to the `hasXxx()`, `findXxx()` and `templateMatches()` -APIs, besides carrying literal values, as seen in the above examples, also accept -special matchers. - -They are available as part of the `Match` class. - -### Object Matchers - -The `Match.objectLike()` API can be used to assert that the target is a superset -object of the provided pattern. -This API will perform a deep partial match on the target. -Deep partial matching is where objects are matched partially recursively. At each -level, the list of keys in the target is a subset of the provided pattern. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": { -// "Wobble": "Flob", -// "Bob": "Cat" -// } -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: Match.objectLike({ - Wobble: 'Flob', - }), -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: Match.objectLike({ - Brew: 'Coffee', - }), -}); -``` - -The `Match.objectEquals()` API can be used to assert a target as a deep exact -match. - -### Presence and Absence - -The `Match.absent()` matcher can be used to specify that a specific -value should not exist on the target. This can be used within `Match.objectLike()` -or outside of any matchers. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": { -// "Wobble": "Flob", -// } -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: Match.objectLike({ - Bob: Match.absent(), - }), -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: Match.objectLike({ - Wobble: Match.absent(), - }), -}); -``` - -The `Match.anyValue()` matcher can be used to specify that a specific value should be found -at the location. This matcher will fail if when the target location has null-ish values -(i.e., `null` or `undefined`). - -This matcher can be combined with any of the other matchers. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": { -// "Wobble": ["Flob", "Flib"], -// } -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: { - Wobble: [ Match.anyValue(), Match.anyValue() ], - }, -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: { - Wimble: Match.anyValue(), - }, -}); -``` - -### Array Matchers - -The `Match.arrayWith()` API can be used to assert that the target is equal to or a subset -of the provided pattern array. -This API will perform subset match on the target. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": ["Flob", "Cat"] -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: Match.arrayWith(['Flob']), -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', Match.objectLike({ - Fred: Match.arrayWith(['Wobble']), -})); -``` - -*Note:* The list of items in the pattern array should be in order as they appear in the -target array. Out of order will be recorded as a match failure. - -Alternatively, the `Match.arrayEquals()` API can be used to assert that the target is -exactly equal to the pattern array. - -### String Matchers - -The `Match.stringLikeRegexp()` API can be used to assert that the target matches the -provided regular expression. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Template": "const includeHeaders = true;" -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Template: Match.stringLikeRegexp('includeHeaders = (true|false)'), -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Template: Match.stringLikeRegexp('includeHeaders = null'), -}); -``` - -### Not Matcher - -The not matcher inverts the search pattern and matches all patterns in the path that does -not match the pattern specified. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": ["Flob", "Cat"] -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Fred: Match.not(['Flob']), -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', Match.objectLike({ - Fred: Match.not(['Flob', 'Cat']), -})); -``` - -### Serialized JSON - -Often, we find that some CloudFormation Resource types declare properties as a string, -but actually expect JSON serialized as a string. -For example, the [`BuildSpec` property of `AWS::CodeBuild::Project`][Pipeline BuildSpec], -the [`Definition` property of `AWS::StepFunctions::StateMachine`][StateMachine Definition], -to name a couple. - -The `Match.serializedJson()` matcher allows deep matching within a stringified JSON. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Baz": "{ \"Fred\": [\"Waldo\", \"Willow\"] }" -// } -// } -// } -// } - -// The following will NOT throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Baz: Match.serializedJson({ - Fred: Match.arrayWith(["Waldo"]), - }), -}); - -// The following will throw an assertion error -template.hasResourceProperties('Foo::Bar', { - Baz: Match.serializedJson({ - Fred: ["Waldo", "Johnny"], - }), -}); -``` - -[Pipeline BuildSpec]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-buildspec -[StateMachine Definition]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definition - -## Capturing Values - -The matcher APIs documented above allow capturing values in the matching entry -(Resource, Output, Mapping, etc.). The following code captures a string from a -matching resource. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": ["Flob", "Cat"], -// "Waldo": ["Qix", "Qux"], -// } -// } -// } -// } - -const fredCapture = new Capture(); -const waldoCapture = new Capture(); -template.hasResourceProperties('Foo::Bar', { - Fred: fredCapture, - Waldo: ["Qix", waldoCapture], -}); - -fredCapture.asArray(); // returns ["Flob", "Cat"] -waldoCapture.asString(); // returns "Qux" -``` - -With captures, a nested pattern can also be specified, so that only targets -that match the nested pattern will be captured. This pattern can be literals or -further Matchers. - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar1": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": ["Flob", "Cat"], -// } -// } -// "MyBar2": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": ["Qix", "Qux"], -// } -// } -// } -// } - -const capture = new Capture(Match.arrayWith(['Cat'])); -template.hasResourceProperties('Foo::Bar', { - Fred: capture, -}); - -capture.asArray(); // returns ['Flob', 'Cat'] -``` - -When multiple resources match the given condition, each `Capture` defined in -the condition will capture all matching values. They can be paged through using -the `next()` API. The following example illustrates this - - -```ts -// Given a template - -// { -// "Resources": { -// "MyBar": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": "Flob", -// } -// }, -// "MyBaz": { -// "Type": "Foo::Bar", -// "Properties": { -// "Fred": "Quib", -// } -// } -// } -// } - -const fredCapture = new Capture(); -template.hasResourceProperties('Foo::Bar', { - Fred: fredCapture, -}); - -fredCapture.asString(); // returns "Flob" -fredCapture.next(); // returns true -fredCapture.asString(); // returns "Quib" -``` - -## Asserting Annotations - -In addition to template matching, we provide an API for annotation matching. -[Annotations](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Annotations.html) -can be added via the [Aspects](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Aspects.html) -API. You can learn more about Aspects [here](https://docs.aws.amazon.com/cdk/v2/guide/aspects.html). - -Say you have a `MyAspect` and a `MyStack` that uses `MyAspect`: - -```ts nofixture -import * as cdk from '@aws-cdk/core'; -import { Construct, IConstruct } from 'constructs'; - -class MyAspect implements cdk.IAspect { - public visit(node: IConstruct): void { - if (node instanceof cdk.CfnResource && node.cfnResourceType === 'Foo::Bar') { - this.error(node, 'we do not want a Foo::Bar resource'); - } - } - - protected error(node: IConstruct, message: string): void { - cdk.Annotations.of(node).addError(message); - } -} - -class MyStack extends cdk.Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - const stack = new cdk.Stack(); - new cdk.CfnResource(stack, 'Foo', { - type: 'Foo::Bar', - properties: { - Fred: 'Thud', - }, - }); - cdk.Aspects.of(stack).add(new MyAspect()); - } -} -``` - -We can then assert that the stack contains the expected Error: - -```ts -// import { Annotations } from '@aws-cdk/assertions'; - -Annotations.fromStack(stack).hasError( - '/Default/Foo', - 'we do not want a Foo::Bar resource', -); -``` - -Here are the available APIs for `Annotations`: - -- `hasError()`, `hasNoError()`, and `findError()` -- `hasWarning()`, `hasNoWarning()`, and `findWarning()` -- `hasInfo()`, `hasNoInfo()`, and `findInfo()` - -The corresponding `findXxx()` API is complementary to the `hasXxx()` API, except instead -of asserting its presence, it returns the set of matching messages. - -In addition, this suite of APIs is compatible with `Matchers` for more fine-grained control. -For example, the following assertion works as well: - -```ts -Annotations.fromStack(stack).hasError( - '/Default/Foo', - Match.stringLikeRegexp('.*Foo::Bar.*'), -); -``` diff --git a/packages/@aws-cdk/assertions/jest.config.js b/packages/@aws-cdk/assertions/jest.config.js deleted file mode 100644 index 50cd7fd05c74f..0000000000000 --- a/packages/@aws-cdk/assertions/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - statements: 75, - branches: 60, - }, - }, - collectCoverageFrom: ['lib/**', '!lib/vendored/**'] -}; diff --git a/packages/@aws-cdk/assertions/lib/annotations.ts b/packages/@aws-cdk/assertions/lib/annotations.ts deleted file mode 100644 index 2068b58ccb480..0000000000000 --- a/packages/@aws-cdk/assertions/lib/annotations.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { Stack, Stage } from '@aws-cdk/core'; -import { SynthesisMessage } from '@aws-cdk/cx-api'; -import { Messages } from './private/message'; -import { findMessage, hasMessage, hasNoMessage } from './private/messages'; - -/** - * Suite of assertions that can be run on a CDK Stack. - * Focused on asserting annotations. - */ -export class Annotations { - /** - * Base your assertions on the messages returned by a synthesized CDK `Stack`. - * @param stack the CDK Stack to run assertions on - */ - public static fromStack(stack: Stack): Annotations { - return new Annotations(toMessages(stack)); - } - - private readonly _messages: Messages; - - private constructor(messages: SynthesisMessage[]) { - this._messages = convertArrayToMessagesType(messages); - } - - /** - * Assert that an error with the given message exists in the synthesized CDK `Stack`. - * - * @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template. - * @param message the error message as should be expected. This should be a string or Matcher object. - */ - public hasError(constructPath: string, message: any): void { - const matchError = hasMessage(this._messages, constructPath, constructMessage('error', message)); - if (matchError) { - throw new Error(matchError); - } - } - - /** - * Assert that an error with the given message does not exist in the synthesized CDK `Stack`. - * - * @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template. - * @param message the error message as should be expected. This should be a string or Matcher object. - */ - public hasNoError(constructPath: string, message: any): void { - const matchError = hasNoMessage(this._messages, constructPath, constructMessage('error', message)); - if (matchError) { - throw new Error(matchError); - } - } - - /** - * Get the set of matching errors of a given construct path and message. - * - * @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template. - * @param message the error message as should be expected. This should be a string or Matcher object. - */ - public findError(constructPath: string, message: any): SynthesisMessage[] { - return convertMessagesTypeToArray(findMessage(this._messages, constructPath, constructMessage('error', message)) as Messages); - } - - /** - * Assert that an warning with the given message exists in the synthesized CDK `Stack`. - * - * @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template. - * @param message the warning message as should be expected. This should be a string or Matcher object. - */ - public hasWarning(constructPath: string, message: any): void { - const matchError = hasMessage(this._messages, constructPath, constructMessage('warning', message)); - if (matchError) { - throw new Error(matchError); - } - } - - /** - * Assert that an warning with the given message does not exist in the synthesized CDK `Stack`. - * - * @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template. - * @param message the warning message as should be expected. This should be a string or Matcher object. - */ - public hasNoWarning(constructPath: string, message: any): void { - const matchError = hasNoMessage(this._messages, constructPath, constructMessage('warning', message)); - if (matchError) { - throw new Error(matchError); - } - } - - /** - * Get the set of matching warning of a given construct path and message. - * - * @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template. - * @param message the warning message as should be expected. This should be a string or Matcher object. - */ - public findWarning(constructPath: string, message: any): SynthesisMessage[] { - return convertMessagesTypeToArray(findMessage(this._messages, constructPath, constructMessage('warning', message)) as Messages); - } - - /** - * Assert that an info with the given message exists in the synthesized CDK `Stack`. - * - * @param constructPath the construct path to the info. Provide `'*'` to match all info in the template. - * @param message the info message as should be expected. This should be a string or Matcher object. - */ - public hasInfo(constructPath: string, message: any): void { - const matchError = hasMessage(this._messages, constructPath, constructMessage('info', message)); - if (matchError) { - throw new Error(matchError); - } - } - - /** - * Assert that an info with the given message does not exist in the synthesized CDK `Stack`. - * - * @param constructPath the construct path to the info. Provide `'*'` to match all info in the template. - * @param message the info message as should be expected. This should be a string or Matcher object. - */ - public hasNoInfo(constructPath: string, message: any): void { - const matchError = hasNoMessage(this._messages, constructPath, constructMessage('info', message)); - if (matchError) { - throw new Error(matchError); - } - } - - /** - * Get the set of matching infos of a given construct path and message. - * - * @param constructPath the construct path to the info. Provide `'*'` to match all infos in the template. - * @param message the info message as should be expected. This should be a string or Matcher object. - */ - public findInfo(constructPath: string, message: any): SynthesisMessage[] { - return convertMessagesTypeToArray(findMessage(this._messages, constructPath, constructMessage('info', message)) as Messages); - } -} - -function constructMessage(type: 'info' | 'warning' | 'error', message: any): {[key:string]: any } { - return { - level: type, - entry: { - data: message, - }, - }; -} - -function convertArrayToMessagesType(messages: SynthesisMessage[]): Messages { - return messages.reduce((obj, item, index) => { - return { - ...obj, - [index]: item, - }; - }, {}) as Messages; -} - -function convertMessagesTypeToArray(messages: Messages): SynthesisMessage[] { - return Object.values(messages) as SynthesisMessage[]; -} - -function toMessages(stack: Stack): any { - const root = stack.node.root; - if (!Stage.isStage(root)) { - throw new Error('unexpected: all stacks must be part of a Stage or an App'); - } - - // to support incremental assertions (i.e. "expect(stack).toNotContainSomething(); doSomething(); expect(stack).toContainSomthing()") - const force = true; - - const assembly = root.synth({ force }); - - return assembly.getStackArtifact(stack.artifactId).messages; -} diff --git a/packages/@aws-cdk/assertions/lib/private/message.ts b/packages/@aws-cdk/assertions/lib/private/message.ts deleted file mode 100644 index 1a14fe6be1b00..0000000000000 --- a/packages/@aws-cdk/assertions/lib/private/message.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { SynthesisMessage } from '@aws-cdk/cx-api'; - -export type Messages = { - [key: string]: SynthesisMessage; -} diff --git a/packages/@aws-cdk/assertions/package.json b/packages/@aws-cdk/assertions/package.json deleted file mode 100644 index 730d1cdfbd9e9..0000000000000 --- a/packages/@aws-cdk/assertions/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "name": "@aws-cdk/assertions", - "version": "0.0.0", - "description": "An assertion library for use with CDK Apps", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "package": "cdk-package", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "compat": "cdk-compat", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "ubergen": { - "exports": { - "./lib/helpers-internal": "./lib/helpers-internal/index.js" - } - }, - "jsii": { - "outdir": "dist", - "diagnostics": { - "language-compatibility/member-name-conflicts-with-type-name": "error", - "language-compatibility/reserved-word": "error" - }, - "targets": { - "java": { - "package": "software.amazon.awscdk.assertions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "assertions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.Assertions", - "packageId": "Amazon.CDK.Assertions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.assertions", - "module": "aws_cdk.assertions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/fs-extra": "^9.0.13", - "@types/jest": "^27.5.2", - "jest": "^27.5.1", - "constructs": "^10.0.0", - "ts-jest": "^27.1.5" - }, - "dependencies": { - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0", - "fs-extra": "^9.1.0" - }, - "peerDependencies": { - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "bundledDependencies": [ - "fs-extra" - ], - "repository": { - "url": "https://github.com/aws/aws-cdk.git", - "type": "git", - "directory": "packages/@aws-cdk/assertions" - }, - "keywords": [ - "aws", - "cdk", - "assert" - ], - "homepage": "https://github.com/aws/aws-cdk", - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "publishConfig": { - "tag": "next" - }, - "awscdkio": { - "announce": false - }, - "private": true -} diff --git a/packages/@aws-cdk/assertions/rosetta/default.ts-fixture b/packages/@aws-cdk/assertions/rosetta/default.ts-fixture deleted file mode 100644 index 5a04dc9a1076c..0000000000000 --- a/packages/@aws-cdk/assertions/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -import { Construct } from 'constructs'; -import { Aspects, CfnResource, Stack } from '@aws-cdk/core'; -import { Annotations, Capture, Match, Template } from '@aws-cdk/assertions'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - const stack = new Stack(); - const template = Template.fromStack(stack); - - /// here - } -} diff --git a/packages/@aws-cdk/assertions/rosetta/init.ts-fixture b/packages/@aws-cdk/assertions/rosetta/init.ts-fixture deleted file mode 100644 index ce18625a2744b..0000000000000 --- a/packages/@aws-cdk/assertions/rosetta/init.ts-fixture +++ /dev/null @@ -1,3 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; - -/// here \ No newline at end of file diff --git a/packages/@aws-cdk/assets/.eslintrc.js b/packages/@aws-cdk/assets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/assets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/assets/.gitignore b/packages/@aws-cdk/assets/.gitignore deleted file mode 100644 index 00d6f883b5de3..0000000000000 --- a/packages/@aws-cdk/assets/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -dist -tsconfig.json - -.LAST_BUILD -.nyc_output -coverage - -.jsii - -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/assets/.npmignore b/packages/@aws-cdk/assets/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/assets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/assets/LICENSE b/packages/@aws-cdk/assets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/assets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/assets/NOTICE b/packages/@aws-cdk/assets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/assets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/assets/README.md b/packages/@aws-cdk/assets/README.md deleted file mode 100644 index aac70ac108a12..0000000000000 --- a/packages/@aws-cdk/assets/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# AWS CDK Assets - - ---- - -![Deprecated](https://img.shields.io/badge/deprecated-critical.svg?style=for-the-badge) - -> This API may emit warnings. Backward compatibility is not guaranteed. - ---- - - - -All types moved to @aws-cdk/core. diff --git a/packages/@aws-cdk/assets/jest.config.js b/packages/@aws-cdk/assets/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/assets/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/assets/lib/compat.ts b/packages/@aws-cdk/assets/lib/compat.ts deleted file mode 100644 index 07bd050d77f5d..0000000000000 --- a/packages/@aws-cdk/assets/lib/compat.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { SymlinkFollowMode } from '@aws-cdk/core'; -import { FollowMode } from './fs/follow-mode'; - -export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined { - if (!follow) { - return undefined; - } - - switch (follow) { - case FollowMode.NEVER: return SymlinkFollowMode.NEVER; - case FollowMode.ALWAYS: return SymlinkFollowMode.ALWAYS; - case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL; - case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL; - default: - throw new Error(`unknown follow mode: ${follow}`); - } -} diff --git a/packages/@aws-cdk/assets/package.json b/packages/@aws-cdk/assets/package.json deleted file mode 100644 index 90c197bb3d09a..0000000000000 --- a/packages/@aws-cdk/assets/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "@aws-cdk/assets", - "version": "0.0.0", - "private": true, - "description": "This module is deprecated. All types are now available under the core module", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.assets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-assets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.Assets", - "packageId": "Amazon.CDK.Assets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.assets", - "module": "aws_cdk.assets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/assets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "pre": [ - "rm -rf test/fs/fixtures && cd test/fs && tar -xzvf fixtures.tar.gz" - ] - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "assets" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/sinon": "^9.0.11", - "aws-cdk": "0.0.0", - "jest": "^27.5.1", - "sinon": "^9.2.4", - "ts-mock-imports": "^1.3.8" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "deprecated", - "maturity": "deprecated", - "awscdkio": { - "announce": false - }, - "nozem": { - "ostools": [ - "rm", - "tar", - "gzip" - ] - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/assets/test/compat.test.ts b/packages/@aws-cdk/assets/test/compat.test.ts deleted file mode 100644 index dfb3c3afd2daa..0000000000000 --- a/packages/@aws-cdk/assets/test/compat.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { SymlinkFollowMode } from '@aws-cdk/core'; -import { FollowMode } from '../lib'; -import { toSymlinkFollow } from '../lib/compat'; - -test('FollowMode compatibility', () => { - expect(toSymlinkFollow(undefined)).toEqual(undefined); - expect(toSymlinkFollow(FollowMode.ALWAYS)).toEqual(SymlinkFollowMode.ALWAYS); - expect(toSymlinkFollow(FollowMode.BLOCK_EXTERNAL)).toEqual(SymlinkFollowMode.BLOCK_EXTERNAL); - expect(toSymlinkFollow(FollowMode.EXTERNAL)).toEqual(SymlinkFollowMode.EXTERNAL); - expect(toSymlinkFollow(FollowMode.NEVER)).toEqual(SymlinkFollowMode.NEVER); -}); diff --git a/packages/@aws-cdk/assets/test/fs/.gitignore b/packages/@aws-cdk/assets/test/fs/.gitignore deleted file mode 100644 index b13de5858771b..0000000000000 --- a/packages/@aws-cdk/assets/test/fs/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# codepipeline looses symlinks so we bundled fixtures into a tarball -# and unpack in pre-build script (yak) -fixtures/** diff --git a/packages/@aws-cdk/assets/test/staging.test.ts b/packages/@aws-cdk/assets/test/staging.test.ts deleted file mode 100644 index 6b59a771e5c48..0000000000000 --- a/packages/@aws-cdk/assets/test/staging.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Staging } from '../lib'; - -describeDeprecated('staging', () => { - test('base case', () => { - // GIVEN - const stack = new Stack(); - const sourcePath = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const staging = new Staging(stack, 's1', { sourcePath }); - - expect(staging.assetHash).toEqual('2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); - expect(staging.sourcePath).toEqual(sourcePath); - expect(staging.relativeStagedPath(stack)).toEqual('asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); - }); - - test('staging can be disabled through context', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true); - const sourcePath = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const staging = new Staging(stack, 's1', { sourcePath }); - - expect(staging.assetHash).toEqual('2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); - expect(staging.sourcePath).toEqual(sourcePath); - expect(staging.absoluteStagedPath).toEqual(sourcePath); - }); - - test('files are copied to the output directory during synth', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - const file = path.join(__dirname, 'fs', 'fixtures.tar.gz'); - - // WHEN - new Staging(stack, 's1', { sourcePath: directory }); - new Staging(stack, 'file', { sourcePath: file }); - - // THEN - const assembly = app.synth(); - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00', - 'asset.af10ac04b3b607b0f8659c8f0cee8c343025ee75baf0b146f10f0e5311d2c46b.tar.gz', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - }); - - test('allow specifying extra data to include in the source hash', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const withoutExtra = new Staging(stack, 'withoutExtra', { sourcePath: directory }); - const withExtra = new Staging(stack, 'withExtra', { sourcePath: directory, extraHash: 'boom' }); - - // THEN - expect(withoutExtra.assetHash).not.toEqual(withExtra.assetHash); - expect(withoutExtra.assetHash).toEqual('2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); - expect(withExtra.assetHash).toEqual('c95c915a5722bb9019e2c725d11868e5a619b55f36172f76bcbcaa8bb2d10c5f'); - }); -}); diff --git a/packages/@aws-cdk/aws-accessanalyzer/.eslintrc.js b/packages/@aws-cdk/aws-accessanalyzer/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-accessanalyzer/.gitignore b/packages/@aws-cdk/aws-accessanalyzer/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-accessanalyzer/.npmignore b/packages/@aws-cdk/aws-accessanalyzer/.npmignore deleted file mode 100644 index b8abeff418a53..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo -tsconfig.json -!.jsii -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-accessanalyzer/LICENSE b/packages/@aws-cdk/aws-accessanalyzer/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-accessanalyzer/NOTICE b/packages/@aws-cdk/aws-accessanalyzer/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-accessanalyzer/README.md b/packages/@aws-cdk/aws-accessanalyzer/README.md deleted file mode 100644 index 0e2624586b5a7..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::AccessAnalyzer Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as accessanalyzer from '@aws-cdk/aws-accessanalyzer'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AccessAnalyzer construct libraries](https://constructs.dev/search?q=accessanalyzer) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AccessAnalyzer resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AccessAnalyzer.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AccessAnalyzer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AccessAnalyzer.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-accessanalyzer/jest.config.js b/packages/@aws-cdk/aws-accessanalyzer/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-accessanalyzer/lib/index.ts b/packages/@aws-cdk/aws-accessanalyzer/lib/index.ts deleted file mode 100644 index 24462dae8bc96..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AccessAnalyzer CloudFormation Resources: -export * from './accessanalyzer.generated'; diff --git a/packages/@aws-cdk/aws-accessanalyzer/package.json b/packages/@aws-cdk/aws-accessanalyzer/package.json deleted file mode 100644 index fb0079f81e8f0..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-accessanalyzer", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AccessAnalyzer", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AccessAnalyzer", - "packageId": "Amazon.CDK.AWS.AccessAnalyzer", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.accessanalyzer", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "accessanalyzer" - } - }, - "python": { - "distName": "aws-cdk.aws-accessanalyzer", - "module": "aws_cdk.aws_accessanalyzer", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-accessanalyzer" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "compat": "cdk-compat", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AccessAnalyzer", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AccessAnalyzer", - "aws-accessanalyzer" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-accessanalyzer/test/accessanalyzer.test.ts b/packages/@aws-cdk/aws-accessanalyzer/test/accessanalyzer.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-accessanalyzer/test/accessanalyzer.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-acmpca/.eslintrc.js b/packages/@aws-cdk/aws-acmpca/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-acmpca/.gitignore b/packages/@aws-cdk/aws-acmpca/.gitignore deleted file mode 100644 index 1b902ec08a098..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -nyc.config.js -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-acmpca/.npmignore b/packages/@aws-cdk/aws-acmpca/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-acmpca/LICENSE b/packages/@aws-cdk/aws-acmpca/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-acmpca/NOTICE b/packages/@aws-cdk/aws-acmpca/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-acmpca/README.md b/packages/@aws-cdk/aws-acmpca/README.md deleted file mode 100644 index d6f2c754f808e..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# AWS::ACMPCA Construct Library - - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as acmpca from '@aws-cdk/aws-acmpca'; -``` - -## Certificate Authority - -This package contains a `CertificateAuthority` class. -At the moment, you cannot create new Authorities using it, -but you can import existing ones using the `fromCertificateAuthorityArn` static method: - -```ts -const certificateAuthority = acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CA', - 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77'); -``` - -## Low-level `Cfn*` classes - -You can always use the low-level classes -(starting with `Cfn*`) to create resources like the Certificate Authority: - -```ts -const cfnCertificateAuthority = new acmpca.CfnCertificateAuthority(this, 'CA', { - type: 'ROOT', - keyAlgorithm: 'RSA_2048', - signingAlgorithm: 'SHA256WITHRSA', - subject: { - country: 'US', - organization: 'string', - organizationalUnit: 'string', - distinguishedNameQualifier: 'string', - state: 'string', - commonName: '123', - serialNumber: 'string', - locality: 'string', - title: 'string', - surname: 'string', - givenName: 'string', - initials: 'DG', - pseudonym: 'string', - generationQualifier: 'DBG', - }, -}); -``` - -If you need to pass the higher-level `ICertificateAuthority` somewhere, -you can get it from the lower-level `CfnCertificateAuthority` using the same `fromCertificateAuthorityArn` method: - -```ts -declare const cfnCertificateAuthority: acmpca.CfnCertificateAuthority; - -const certificateAuthority = acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CertificateAuthority', - cfnCertificateAuthority.attrArn); -``` diff --git a/packages/@aws-cdk/aws-acmpca/jest.config.js b/packages/@aws-cdk/aws-acmpca/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-acmpca/package.json b/packages/@aws-cdk/aws-acmpca/package.json deleted file mode 100644 index 4f97f9579a544..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-acmpca", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ACMPCA", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ACMPCA", - "packageId": "Amazon.CDK.AWS.ACMPCA", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.acmpca", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "acmpca" - } - }, - "python": { - "distName": "aws-cdk.aws-acmpca", - "module": "aws_cdk.aws_acmpca", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-acmpca" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ACMPCA", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ACMPCA", - "aws-acmpca" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-acmpca/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-acmpca/rosetta/default.ts-fixture deleted file mode 100644 index 16526213b2c62..0000000000000 --- a/packages/@aws-cdk/aws-acmpca/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as acmpca from '@aws-cdk/aws-acmpca'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-amazonmq/.eslintrc.js b/packages/@aws-cdk/aws-amazonmq/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-amazonmq/.gitignore b/packages/@aws-cdk/aws-amazonmq/.gitignore deleted file mode 100644 index ac4ba3ab6a8a9..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json - -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-amazonmq/.npmignore b/packages/@aws-cdk/aws-amazonmq/.npmignore deleted file mode 100644 index 83cbb853b0cea..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/.npmignore +++ /dev/null @@ -1,33 +0,0 @@ -# The basics -*.ts -*.tgz -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.snk - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-amazonmq/LICENSE b/packages/@aws-cdk/aws-amazonmq/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-amazonmq/NOTICE b/packages/@aws-cdk/aws-amazonmq/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-amazonmq/README.md b/packages/@aws-cdk/aws-amazonmq/README.md deleted file mode 100644 index 5e3b151adc289..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon MQ Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as amazonmq from '@aws-cdk/aws-amazonmq'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AmazonMQ construct libraries](https://constructs.dev/search?q=amazonmq) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AmazonMQ resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmazonMQ.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AmazonMQ](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmazonMQ.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-amazonmq/jest.config.js b/packages/@aws-cdk/aws-amazonmq/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-amazonmq/lib/index.ts b/packages/@aws-cdk/aws-amazonmq/lib/index.ts deleted file mode 100644 index 7914a9c4008e4..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AmazonMQ CloudFormation Resources: -export * from './amazonmq.generated'; diff --git a/packages/@aws-cdk/aws-amazonmq/package.json b/packages/@aws-cdk/aws-amazonmq/package.json deleted file mode 100644 index 9226e86f05aab..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-amazonmq", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AmazonMQ", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AmazonMQ", - "packageId": "Amazon.CDK.AWS.AmazonMQ", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.amazonmq", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "amazonmq" - } - }, - "python": { - "distName": "aws-cdk.aws-amazonmq", - "module": "aws_cdk.aws_amazonmq", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-amazonmq" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AmazonMQ", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "aws-amazonmq" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-amazonmq/test/amazonmq.test.ts b/packages/@aws-cdk/aws-amazonmq/test/amazonmq.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-amazonmq/test/amazonmq.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-amplify/.eslintrc.js b/packages/@aws-cdk/aws-amplify/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-amplify/.eslintrc.js +++ b/packages/@aws-cdk/aws-amplify/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-amplify/.gitignore b/packages/@aws-cdk/aws-amplify/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-amplify/.gitignore +++ b/packages/@aws-cdk/aws-amplify/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-amplify/README.md b/packages/@aws-cdk/aws-amplify/README.md index 1ff84b938a323..5cb37b99e28ce 100644 --- a/packages/@aws-cdk/aws-amplify/README.md +++ b/packages/@aws-cdk/aws-amplify/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -28,7 +22,7 @@ The AWS Amplify Console provides a Git-based workflow for deploying and hosting To set up an Amplify Console app, define an `App`: ```ts -import * as codebuild from '@aws-cdk/aws-codebuild'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; const amplifyApp = new amplify.App(this, 'MyApp', { sourceCodeProvider: new amplify.GitHubSourceCodeProvider({ @@ -77,7 +71,7 @@ const amplifyApp = new amplify.App(this, 'MyApp', { To connect your `App` to CodeCommit, use the `CodeCommitSourceCodeProvider`: ```ts -import * as codecommit from '@aws-cdk/aws-codecommit'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; const repository = new codecommit.Repository(this, 'Repo', { repositoryName: 'my-repo', @@ -236,7 +230,7 @@ const amplifyApp = new amplify.App(this, 'App', { `sourceCodeProvider` is optional; when this is not specified the Amplify app can be deployed to using `.zip` packages. The `asset` property can be used to deploy S3 assets to Amplify as part of the CDK: ```ts -import * as assets from '@aws-cdk/aws-s3-assets'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; declare const asset: assets.Asset; declare const amplifyApp: amplify.App; diff --git a/packages/@aws-cdk/aws-amplify/lib/app.ts b/packages/@aws-cdk/aws-amplify/lib/app.ts index 387e89110568b..a4238b39608ce 100644 --- a/packages/@aws-cdk/aws-amplify/lib/app.ts +++ b/packages/@aws-cdk/aws-amplify/lib/app.ts @@ -1,8 +1,8 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as iam from '@aws-cdk/aws-iam'; -import { IResource, Lazy, Resource, SecretValue } from '@aws-cdk/core'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { IResource, Lazy, Resource, SecretValue } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnApp } from './amplify.generated'; +import { CfnApp } from 'aws-cdk-lib/aws-amplify'; import { BasicAuth } from './basic-auth'; import { Branch, BranchOptions } from './branch'; import { Domain, DomainOptions } from './domain'; diff --git a/packages/@aws-cdk/aws-amplify/lib/asset-deployment-handler/index.ts b/packages/@aws-cdk/aws-amplify/lib/asset-deployment-handler/index.ts index ebb589bb3f847..2b19693ce9a8c 100644 --- a/packages/@aws-cdk/aws-amplify/lib/asset-deployment-handler/index.ts +++ b/packages/@aws-cdk/aws-amplify/lib/asset-deployment-handler/index.ts @@ -1,5 +1,5 @@ // eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; +import { IsCompleteResponse } from 'aws-cdk-lib/custom-resources/lib/provider-framework/types'; // aws-sdk available at runtime for lambdas // eslint-disable-next-line import/no-extraneous-dependencies import { Amplify, S3, config } from 'aws-sdk'; diff --git a/packages/@aws-cdk/aws-amplify/lib/basic-auth.ts b/packages/@aws-cdk/aws-amplify/lib/basic-auth.ts index fd61e0f78d494..17b0104e6bfec 100644 --- a/packages/@aws-cdk/aws-amplify/lib/basic-auth.ts +++ b/packages/@aws-cdk/aws-amplify/lib/basic-auth.ts @@ -1,6 +1,6 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { SecretValue } from '@aws-cdk/core'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import { SecretValue } from 'aws-cdk-lib'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-amplify/lib/branch.ts b/packages/@aws-cdk/aws-amplify/lib/branch.ts index 40c1bdb3d0671..172fb567ebf08 100644 --- a/packages/@aws-cdk/aws-amplify/lib/branch.ts +++ b/packages/@aws-cdk/aws-amplify/lib/branch.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { NodejsFunction } from '@aws-cdk/aws-lambda-nodejs'; -import { Asset } from '@aws-cdk/aws-s3-assets'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; import { CustomResource, IResource, @@ -12,10 +12,10 @@ import { Duration, NestedStack, Stack, -} from '@aws-cdk/core'; -import { Provider } from '@aws-cdk/custom-resources'; +} from 'aws-cdk-lib'; +import { Provider } from 'aws-cdk-lib/custom-resources'; import { Construct } from 'constructs'; -import { CfnBranch } from './amplify.generated'; +import { CfnBranch } from 'aws-cdk-lib/aws-amplify'; import { IApp } from './app'; import { BasicAuth } from './basic-auth'; import { renderEnvironmentVariables } from './utils'; diff --git a/packages/@aws-cdk/aws-amplify/lib/domain.ts b/packages/@aws-cdk/aws-amplify/lib/domain.ts index ed2b16668eb11..e7b5800842886 100644 --- a/packages/@aws-cdk/aws-amplify/lib/domain.ts +++ b/packages/@aws-cdk/aws-amplify/lib/domain.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Lazy, Resource, IResolvable } from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Lazy, Resource, IResolvable } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnDomain } from './amplify.generated'; +import { CfnDomain } from 'aws-cdk-lib/aws-amplify'; import { IApp } from './app'; import { IBranch } from './branch'; diff --git a/packages/@aws-cdk/aws-amplify/lib/index.ts b/packages/@aws-cdk/aws-amplify/lib/index.ts index 5a89be4af844c..c7a17e7b1029d 100644 --- a/packages/@aws-cdk/aws-amplify/lib/index.ts +++ b/packages/@aws-cdk/aws-amplify/lib/index.ts @@ -5,4 +5,3 @@ export * from './basic-auth'; export * from './source-code-providers'; // AWS::Amplify CloudFormation Resources: -export * from './amplify.generated'; diff --git a/packages/@aws-cdk/aws-amplify/lib/source-code-providers.ts b/packages/@aws-cdk/aws-amplify/lib/source-code-providers.ts index 8736c76ff7649..5f43bbe0df650 100644 --- a/packages/@aws-cdk/aws-amplify/lib/source-code-providers.ts +++ b/packages/@aws-cdk/aws-amplify/lib/source-code-providers.ts @@ -1,5 +1,5 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import { SecretValue } from '@aws-cdk/core'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import { SecretValue } from 'aws-cdk-lib'; import { App, ISourceCodeProvider, SourceCodeProviderConfig } from './app'; /** diff --git a/packages/@aws-cdk/aws-amplify/package.json b/packages/@aws-cdk/aws-amplify/package.json index 209e8d3545966..3cfd7aea9c966 100644 --- a/packages/@aws-cdk/aws-amplify/package.json +++ b/packages/@aws-cdk/aws-amplify/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-amplify", + "name": "@aws-cdk/aws-amplify-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Amplify", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Amplify", - "packageId": "Amazon.CDK.AWS.Amplify", + "namespace": "Amazon.CDK.AWS.Amplify.Alpha", + "packageId": "Amazon.CDK.AWS.Amplify.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.amplify", + "package": "software.amazon.awscdk.services.amplify.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "amplify" + "artifactId": "amplify-alpha" } }, "python": { - "distName": "aws-cdk.aws-amplify", - "module": "aws_cdk.aws_amplify", + "distName": "aws-cdk.aws-amplify-alpha", + "module": "aws_cdk.aws_amplify_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkamplifyalpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "pkglint": "pkglint -f", "test": "cdk-test", "watch": "cdk-watch", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Amplify", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -82,38 +83,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0" - }, - "dependencies": { - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lambda-nodejs": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", + "aws-sdk": "^2.1329.0", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lambda-nodejs": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -123,7 +104,7 @@ "maturity": "experimental", "awslint": { "exclude": [ - "construct-ctor-props-optional:@aws-cdk/aws-amplify.App" + "*:*" ] }, "awscdkio": { @@ -131,5 +112,11 @@ }, "publishConfig": { "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-amplify/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-amplify/rosetta/default.ts-fixture index 922b7902f805d..dd27e406b3985 100644 --- a/packages/@aws-cdk/aws-amplify/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-amplify/rosetta/default.ts-fixture @@ -1,7 +1,7 @@ // Fixture with packages imported, but nothing else -import { SecretValue, Stack } from '@aws-cdk/core'; +import { SecretValue, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as amplify from '@aws-cdk/aws-amplify'; +import * as amplify from '@aws-cdk/aws-amplify-alpha'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-amplify/test/app.test.ts b/packages/@aws-cdk/aws-amplify/test/app.test.ts index d778ce133b337..8e7c4e9f24b9b 100644 --- a/packages/@aws-cdk/aws-amplify/test/app.test.ts +++ b/packages/@aws-cdk/aws-amplify/test/app.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import { SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import { SecretValue, Stack } from 'aws-cdk-lib'; import * as amplify from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-amplify/test/branch.test.ts b/packages/@aws-cdk/aws-amplify/test/branch.test.ts index 0e5255b8d0f2b..c4b7a6ac2f4e3 100644 --- a/packages/@aws-cdk/aws-amplify/test/branch.test.ts +++ b/packages/@aws-cdk/aws-amplify/test/branch.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; +import { SecretValue, Stack } from 'aws-cdk-lib'; import * as amplify from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-amplify/test/domain.test.ts b/packages/@aws-cdk/aws-amplify/test/domain.test.ts index 65bd1ae2ae3da..4ed31051277e6 100644 --- a/packages/@aws-cdk/aws-amplify/test/domain.test.ts +++ b/packages/@aws-cdk/aws-amplify/test/domain.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, SecretValue, Stack } from 'aws-cdk-lib'; import * as amplify from '../lib'; test('create a domain', () => { diff --git a/packages/@aws-cdk/aws-amplify/test/integ.app-asset-deployment.ts b/packages/@aws-cdk/aws-amplify/test/integ.app-asset-deployment.ts index 305eb84cf1298..ed2a1b6240fbd 100644 --- a/packages/@aws-cdk/aws-amplify/test/integ.app-asset-deployment.ts +++ b/packages/@aws-cdk/aws-amplify/test/integ.app-asset-deployment.ts @@ -1,6 +1,6 @@ // import * as path from 'path'; // import { Asset } from '@aws-cdk/aws-s3-assets'; -import { App, Stack, StackProps } from '@aws-cdk/core'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import * as amplify from '../lib'; diff --git a/packages/@aws-cdk/aws-amplify/test/integ.app-codecommit.ts b/packages/@aws-cdk/aws-amplify/test/integ.app-codecommit.ts index a81499ce8d3fe..fcd88cb7d1a14 100644 --- a/packages/@aws-cdk/aws-amplify/test/integ.app-codecommit.ts +++ b/packages/@aws-cdk/aws-amplify/test/integ.app-codecommit.ts @@ -1,5 +1,5 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import { App, Stack, StackProps } from '@aws-cdk/core'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import * as amplify from '../lib'; diff --git a/packages/@aws-cdk/aws-amplify/test/integ.app.ts b/packages/@aws-cdk/aws-amplify/test/integ.app.ts index 602ee47b8ada2..737d226ce92c2 100644 --- a/packages/@aws-cdk/aws-amplify/test/integ.app.ts +++ b/packages/@aws-cdk/aws-amplify/test/integ.app.ts @@ -1,4 +1,4 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import * as amplify from '../lib'; diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/.eslintrc.js b/packages/@aws-cdk/aws-amplifyuibuilder/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/.gitignore b/packages/@aws-cdk/aws-amplifyuibuilder/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/.npmignore b/packages/@aws-cdk/aws-amplifyuibuilder/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/LICENSE b/packages/@aws-cdk/aws-amplifyuibuilder/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/NOTICE b/packages/@aws-cdk/aws-amplifyuibuilder/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/README.md b/packages/@aws-cdk/aws-amplifyuibuilder/README.md deleted file mode 100644 index a64a883f9c7f5..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::AmplifyUIBuilder Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as amplifyuibuilder from '@aws-cdk/aws-amplifyuibuilder'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AmplifyUIBuilder construct libraries](https://constructs.dev/search?q=amplifyuibuilder) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AmplifyUIBuilder resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmplifyUIBuilder.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AmplifyUIBuilder](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmplifyUIBuilder.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/jest.config.js b/packages/@aws-cdk/aws-amplifyuibuilder/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/lib/index.ts b/packages/@aws-cdk/aws-amplifyuibuilder/lib/index.ts deleted file mode 100644 index 0becb5a95c06d..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AmplifyUIBuilder CloudFormation Resources: -export * from './amplifyuibuilder.generated'; diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/package.json b/packages/@aws-cdk/aws-amplifyuibuilder/package.json deleted file mode 100644 index daa97b9ae728f..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/package.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "name": "@aws-cdk/aws-amplifyuibuilder", - "version": "0.0.0", - "description": "AWS::AmplifyUIBuilder Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AmplifyUIBuilder", - "packageId": "Amazon.CDK.AWS.AmplifyUIBuilder", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.amplifyuibuilder", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "amplifyuibuilder" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-amplifyuibuilder", - "module": "aws_cdk.aws_amplifyuibuilder" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-amplifyuibuilder" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AmplifyUIBuilder", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AmplifyUIBuilder", - "aws-amplifyuibuilder" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/node": "18.11.19" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-amplifyuibuilder/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-amplifyuibuilder/test/amplifyuibuilder.test.ts b/packages/@aws-cdk/aws-amplifyuibuilder/test/amplifyuibuilder.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-amplifyuibuilder/test/amplifyuibuilder.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-apigateway/.eslintrc.js b/packages/@aws-cdk/aws-apigateway/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-apigateway/.gitignore b/packages/@aws-cdk/aws-apigateway/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-apigateway/.npmignore b/packages/@aws-cdk/aws-apigateway/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-apigateway/LICENSE b/packages/@aws-cdk/aws-apigateway/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-apigateway/NOTICE b/packages/@aws-cdk/aws-apigateway/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-apigateway/README.md b/packages/@aws-cdk/aws-apigateway/README.md deleted file mode 100644 index deaf8d41f3a26..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/README.md +++ /dev/null @@ -1,1488 +0,0 @@ -# Amazon API Gateway Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Amazon API Gateway is a fully managed service that makes it easy for developers -to publish, maintain, monitor, and secure APIs at any scale. Create an API to -access data, business logic, or functionality from your back-end services, such -as applications running on Amazon Elastic Compute Cloud (Amazon EC2), code -running on AWS Lambda, or any web application. - -## Table of Contents - -- [Defining APIs](#defining-apis) - - [Breaking up Methods and Resources across Stacks](#breaking-up-methods-and-resources-across-stacks) -- [AWS Lambda-backed APIs](#aws-lambda-backed-apis) -- [AWS StepFunctions backed APIs](#aws-stepfunctions-backed-APIs) -- [Integration Targets](#integration-targets) -- [Usage Plan & API Keys](#usage-plan--api-keys) -- [Working with models](#working-with-models) -- [Default Integration and Method Options](#default-integration-and-method-options) -- [Proxy Routes](#proxy-routes) -- [Authorizers](#authorizers) - - [IAM-based authorizer](#iam-based-authorizer) - - [Lambda-based token authorizer](#lambda-based-token-authorizer) - - [Lambda-based request authorizer](#lambda-based-request-authorizer) - - [Cognito User Pools authorizer](#cognito-user-pools-authorizer) -- [Mutual TLS](#mutal-tls-mtls) -- [Deployments](#deployments) - - [Deep dive: Invalidation of deployments](#deep-dive-invalidation-of-deployments) -- [Custom Domains](#custom-domains) -- [Access Logging](#access-logging) -- [Cross Origin Resource Sharing (CORS)](#cross-origin-resource-sharing-cors) -- [Endpoint Configuration](#endpoint-configuration) -- [Private Integrations](#private-integrations) -- [Gateway Response](#gateway-response) -- [OpenAPI Definition](#openapi-definition) - - [Endpoint configuration](#endpoint-configuration) -- [Metrics](#metrics) -- [APIGateway v2](#apigateway-v2) - -## Defining APIs - -APIs are defined as a hierarchy of resources and methods. `addResource` and -`addMethod` can be used to build this hierarchy. The root resource is -`api.root`. - -For example, the following code defines an API that includes the following HTTP -endpoints: `ANY /`, `GET /books`, `POST /books`, `GET /books/{book_id}`, `DELETE /books/{book_id}`. - -```ts -const api = new apigateway.RestApi(this, 'books-api'); - -api.root.addMethod('ANY'); - -const books = api.root.addResource('books'); -books.addMethod('GET'); -books.addMethod('POST'); - -const book = books.addResource('{book_id}'); -book.addMethod('GET'); -book.addMethod('DELETE'); -``` - -## AWS Lambda-backed APIs - -A very common practice is to use Amazon API Gateway with AWS Lambda as the -backend integration. The `LambdaRestApi` construct makes it easy: - -The following code defines a REST API that routes all requests to the -specified AWS Lambda function: - -```ts -declare const backend: lambda.Function; -new apigateway.LambdaRestApi(this, 'myapi', { - handler: backend, -}); -``` - -You can also supply `proxy: false`, in which case you will have to explicitly -define the API model: - -```ts -declare const backend: lambda.Function; -const api = new apigateway.LambdaRestApi(this, 'myapi', { - handler: backend, - proxy: false -}); - -const items = api.root.addResource('items'); -items.addMethod('GET'); // GET /items -items.addMethod('POST'); // POST /items - -const item = items.addResource('{item}'); -item.addMethod('GET'); // GET /items/{item} - -// the default integration for methods is "handler", but one can -// customize this behavior per method or even a sub path. -item.addMethod('DELETE', new apigateway.HttpIntegration('http://amazon.com')); -``` - -Additionally, `integrationOptions` can be supplied to explicitly define -options of the Lambda integration: - -```ts -declare const backend: lambda.Function; - -const api = new apigateway.LambdaRestApi(this, 'myapi', { - handler: backend, - integrationOptions: { - allowTestInvoke: false, - timeout: Duration.seconds(1), - } -}) -``` - -## AWS StepFunctions backed APIs - -You can use Amazon API Gateway with AWS Step Functions as the backend integration, specifically Synchronous Express Workflows. - -The `StepFunctionsRestApi` only supports integration with Synchronous Express state machine. The `StepFunctionsRestApi` construct makes this easy by setting up input, output and error mapping. - -The construct sets up an API endpoint and maps the `ANY` HTTP method and any calls to the API endpoint starts an express workflow execution for the underlying state machine. - -Invoking the endpoint with any HTTP method (`GET`, `POST`, `PUT`, `DELETE`, ...) in the example below will send the request to the state machine as a new execution. On success, an HTTP code `200` is returned with the execution output as the Response Body. - -If the execution fails, an HTTP `500` response is returned with the `error` and `cause` from the execution output as the Response Body. If the request is invalid (ex. bad execution input) HTTP code `400` is returned. - -The response from the invocation contains only the `output` field from the -[StartSyncExecution](https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartSyncExecution.html#API_StartSyncExecution_ResponseSyntax) API. -In case of failures, the fields `error` and `cause` are returned as part of the response. -Other metadata such as billing details, AWS account ID and resource ARNs are not returned in the API response. - -By default, a `prod` stage is provisioned. - -In order to reduce the payload size sent to AWS Step Functions, `headers` are not forwarded to the Step Functions execution input. It is possible to choose whether `headers`, `requestContext`, `path`, `querystring`, and `authorizer` are included or not. By default, `headers` are excluded in all requests. - -More details about AWS Step Functions payload limit can be found at https://docs.aws.amazon.com/step-functions/latest/dg/limits-overview.html#service-limits-task-executions. - -The following code defines a REST API that routes all requests to the specified AWS StepFunctions state machine: - -```ts -const stateMachineDefinition = new stepfunctions.Pass(this, 'PassState'); - -const stateMachine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', { - definition: stateMachineDefinition, - stateMachineType: stepfunctions.StateMachineType.EXPRESS, -}); - -new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', { - deploy: true, - stateMachine: stateMachine, -}); -``` - -When the REST API endpoint configuration above is invoked using POST, as follows - - -```bash -curl -X POST -d '{ "customerId": 1 }' https://example.com/ -``` - -AWS Step Functions will receive the request body in its input as follows: - -```json -{ - "body": { - "customerId": 1 - }, - "path": "/", - "querystring": {} -} -``` - -When the endpoint is invoked at path '/users/5' using the HTTP GET method as below: - -```bash -curl -X GET https://example.com/users/5?foo=bar -``` - -AWS Step Functions will receive the following execution input: - -```json -{ - "body": {}, - "path": { - "users": "5" - }, - "querystring": { - "foo": "bar" - } -} -``` - -Additional information around the request such as the request context, authorizer context, and headers can be included as part of the input -forwarded to the state machine. The following example enables headers to be included in the input but not query string. - -```ts fixture=stepfunctions -new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', { - stateMachine: machine, - headers: true, - path: false, - querystring: false, - authorizer: false, - requestContext: { - caller: true, - user: true, - }, -}); -``` - -In such a case, when the endpoint is invoked as below: - -```bash -curl -X GET https://example.com/ -``` - -AWS Step Functions will receive the following execution input: - -```json -{ - "headers": { - "Accept": "...", - "CloudFront-Forwarded-Proto": "...", - }, - "requestContext": { - "accountId": "...", - "apiKey": "...", - }, - "body": {} -} -``` - -### Breaking up Methods and Resources across Stacks - -It is fairly common for REST APIs with a large number of Resources and Methods to hit the [CloudFormation -limit](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) of 500 resources per -stack. - -To help with this, Resources and Methods for the same REST API can be re-organized across multiple stacks. A common -way to do this is to have a stack per Resource or groups of Resources, but this is not the only possible way. -The following example uses sets up two Resources '/pets' and '/books' in separate stacks using nested stacks: - -[Resources grouped into nested stacks](test/integ.restapi-import.lit.ts) - -## Integration Targets - -Methods are associated with backend integrations, which are invoked when this -method is called. API Gateway supports the following integrations: - -- `MockIntegration` - can be used to test APIs. This is the default - integration if one is not specified. -- `LambdaIntegration` - can be used to invoke an AWS Lambda function. -- `AwsIntegration` - can be used to invoke arbitrary AWS service APIs. -- `HttpIntegration` - can be used to invoke HTTP endpoints. - -The following example shows how to integrate the `GET /book/{book_id}` method to -an AWS Lambda function: - -```ts -declare const getBookHandler: lambda.Function; -declare const book: apigateway.Resource; - -const getBookIntegration = new apigateway.LambdaIntegration(getBookHandler); -book.addMethod('GET', getBookIntegration); -``` - -Integration options can be optionally be specified: - -```ts -declare const getBookHandler: lambda.Function; -declare const getBookIntegration: apigateway.LambdaIntegration; - -const getBookIntegration = new apigateway.LambdaIntegration(getBookHandler, { - contentHandling: apigateway.ContentHandling.CONVERT_TO_TEXT, // convert to base64 - credentialsPassthrough: true, // use caller identity to invoke the function -}); -``` - -Method options can optionally be specified when adding methods: - -```ts -declare const book: apigateway.Resource; -declare const getBookIntegration: apigateway.LambdaIntegration; - -book.addMethod('GET', getBookIntegration, { - authorizationType: apigateway.AuthorizationType.IAM, - apiKeyRequired: true -}); -``` - -It is possible to also integrate with AWS services in a different region. The following code integrates with Amazon SQS in the -`eu-west-1` region. - -```ts -const getMessageIntegration = new apigateway.AwsIntegration({ - service: 'sqs', - path: 'queueName', - region: 'eu-west-1' -}); -``` - -## Usage Plan & API Keys - -A usage plan specifies who can access one or more deployed API stages and methods, and the rate at which they can be -accessed. The plan uses API keys to identify API clients and meters access to the associated API stages for each key. -Usage plans also allow configuring throttling limits and quota limits that are enforced on individual client API keys. - -The following example shows how to create and associate a usage plan and an API key: - -```ts -declare const integration: apigateway.LambdaIntegration; - -const api = new apigateway.RestApi(this, 'hello-api'); - -const v1 = api.root.addResource('v1'); -const echo = v1.addResource('echo'); -const echoMethod = echo.addMethod('GET', integration, { apiKeyRequired: true }); - -const plan = api.addUsagePlan('UsagePlan', { - name: 'Easy', - throttle: { - rateLimit: 10, - burstLimit: 2 - } -}); - -const key = api.addApiKey('ApiKey'); -plan.addApiKey(key); -``` - -To associate a plan to a given RestAPI stage: - -```ts -declare const plan: apigateway.UsagePlan; -declare const api: apigateway.RestApi; -declare const echoMethod: apigateway.Method; - -plan.addApiStage({ - stage: api.deploymentStage, - throttle: [ - { - method: echoMethod, - throttle: { - rateLimit: 10, - burstLimit: 2 - } - } - ] -}); -``` - -Existing usage plans can be imported into a CDK app using its id. - -```ts -const importedUsagePlan = apigateway.UsagePlan.fromUsagePlanId(this, 'imported-usage-plan', ''); -``` - -The name and value of the API Key can be specified at creation; if not -provided, a name and value will be automatically generated by API Gateway. - -```ts -declare const api: apigateway.RestApi; -const key = api.addApiKey('ApiKey', { - apiKeyName: 'myApiKey1', - value: 'MyApiKeyThatIsAtLeast20Characters', -}); -``` - -Existing API keys can also be imported into a CDK app using its id. - -```ts -const importedKey = apigateway.ApiKey.fromApiKeyId(this, 'imported-key', ''); -``` - -The "grant" methods can be used to give prepackaged sets of permissions to other resources. The -following code provides read permission to an API key. - -```ts -declare const importedKey: apigateway.ApiKey; -declare const lambdaFn: lambda.Function; -importedKey.grantRead(lambdaFn); -``` - -### Adding an API Key to an imported RestApi - -API Keys are added to ApiGateway Stages, not to the API itself. When you import a RestApi -it does not have any information on the Stages that may be associated with it. Since adding an API -Key requires a stage, you should instead add the Api Key to the imported Stage. - -```ts -declare const restApi: apigateway.IRestApi; -const importedStage = apigateway.Stage.fromStageAttributes(this, 'imported-stage', { - stageName: 'myStageName', - restApi, -}); - -importedStage.addApiKey('MyApiKey'); -``` - -### ⚠️ Multiple API Keys - -It is possible to specify multiple API keys for a given Usage Plan, by calling `usagePlan.addApiKey()`. - -When using multiple API keys, a past bug of the CDK prevents API key associations to a Usage Plan to be deleted. -If the CDK app had the [feature flag] - `@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId` - enabled when the API -keys were created, then the app will not be affected by this bug. - -If this is not the case, you will need to ensure that the CloudFormation [logical ids] of the API keys that are not -being deleted remain unchanged. -Make note of the logical ids of these API keys before removing any, and set it as part of the `addApiKey()` method: - -```ts -declare const usageplan: apigateway.UsagePlan; -declare const apiKey: apigateway.ApiKey; - -usageplan.addApiKey(apiKey, { - overrideLogicalId: '...', -}); -``` - -[feature flag]: https://docs.aws.amazon.com/cdk/latest/guide/featureflags.html -[logical ids]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html - -### Rate Limited API Key - -In scenarios where you need to create a single api key and configure rate limiting for it, you can use `RateLimitedApiKey`. -This construct lets you specify rate limiting properties which should be applied only to the api key being created. -The API key created has the specified rate limits, such as quota and throttles, applied. - -The following example shows how to use a rate limited api key : - -```ts -declare const api: apigateway.RestApi; - -const key = new apigateway.RateLimitedApiKey(this, 'rate-limited-api-key', { - customerId: 'hello-customer', - stages: [api.deploymentStage], - quota: { - limit: 10000, - period: apigateway.Period.MONTH - } -}); -``` - -## Working with models - -When you work with Lambda integrations that are not Proxy integrations, you -have to define your models and mappings for the request, response, and integration. - -```ts -const hello = new lambda.Function(this, 'hello', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'hello.handler', - code: lambda.Code.fromAsset('lambda') -}); - -const api = new apigateway.RestApi(this, 'hello-api', { }); -const resource = api.root.addResource('v1'); -``` - -You can define more parameters on the integration to tune the behavior of API Gateway - -```ts -declare const hello: lambda.Function; - -const integration = new apigateway.LambdaIntegration(hello, { - proxy: false, - requestParameters: { - // You can define mapping parameters from your method to your integration - // - Destination parameters (the key) are the integration parameters (used in mappings) - // - Source parameters (the value) are the source request parameters or expressions - // @see: https://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html - 'integration.request.querystring.who': 'method.request.querystring.who' - }, - allowTestInvoke: true, - requestTemplates: { - // You can define a mapping that will build a payload for your integration, based - // on the integration parameters that you have specified - // Check: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html - 'application/json': JSON.stringify({ action: 'sayHello', pollId: "$util.escapeJavaScript($input.params('who'))" }) - }, - // This parameter defines the behavior of the engine is no suitable response template is found - passthroughBehavior: apigateway.PassthroughBehavior.NEVER, - integrationResponses: [ - { - // Successful response from the Lambda function, no filter defined - // - the selectionPattern filter only tests the error message - // We will set the response status code to 200 - statusCode: "200", - responseTemplates: { - // This template takes the "message" result from the Lambda function, and embeds it in a JSON response - // Check https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html - 'application/json': JSON.stringify({ state: 'ok', greeting: '$util.escapeJavaScript($input.body)' }) - }, - responseParameters: { - // We can map response parameters - // - Destination parameters (the key) are the response parameters (used in mappings) - // - Source parameters (the value) are the integration response parameters or expressions - 'method.response.header.Content-Type': "'application/json'", - 'method.response.header.Access-Control-Allow-Origin': "'*'", - 'method.response.header.Access-Control-Allow-Credentials': "'true'" - } - }, - { - // For errors, we check if the error message is not empty, get the error data - selectionPattern: '(\n|.)+', - // We will set the response status code to 200 - statusCode: "400", - responseTemplates: { - 'application/json': JSON.stringify({ state: 'error', message: "$util.escapeJavaScript($input.path('$.errorMessage'))" }) - }, - responseParameters: { - 'method.response.header.Content-Type': "'application/json'", - 'method.response.header.Access-Control-Allow-Origin': "'*'", - 'method.response.header.Access-Control-Allow-Credentials': "'true'" - } - } - ] -}); - -``` - -You can define models for your responses (and requests) - -```ts -declare const api: apigateway.RestApi; - -// We define the JSON Schema for the transformed valid response -const responseModel = api.addModel('ResponseModel', { - contentType: 'application/json', - modelName: 'ResponseModel', - schema: { - schema: apigateway.JsonSchemaVersion.DRAFT4, - title: 'pollResponse', - type: apigateway.JsonSchemaType.OBJECT, - properties: { - state: { type: apigateway.JsonSchemaType.STRING }, - greeting: { type: apigateway.JsonSchemaType.STRING } - } - } -}); - -// We define the JSON Schema for the transformed error response -const errorResponseModel = api.addModel('ErrorResponseModel', { - contentType: 'application/json', - modelName: 'ErrorResponseModel', - schema: { - schema: apigateway.JsonSchemaVersion.DRAFT4, - title: 'errorResponse', - type: apigateway.JsonSchemaType.OBJECT, - properties: { - state: { type: apigateway.JsonSchemaType.STRING }, - message: { type: apigateway.JsonSchemaType.STRING } - } - } -}); - -``` - -And reference all on your method definition. - -```ts -declare const integration: apigateway.LambdaIntegration; -declare const resource: apigateway.Resource; -declare const responseModel: apigateway.Model; -declare const errorResponseModel: apigateway.Model; - -resource.addMethod('GET', integration, { - // We can mark the parameters as required - requestParameters: { - 'method.request.querystring.who': true - }, - // we can set request validator options like below - requestValidatorOptions: { - requestValidatorName: 'test-validator', - validateRequestBody: true, - validateRequestParameters: false - }, - methodResponses: [ - { - // Successful response from the integration - statusCode: '200', - // Define what parameters are allowed or not - responseParameters: { - 'method.response.header.Content-Type': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Access-Control-Allow-Credentials': true - }, - // Validate the schema on the response - responseModels: { - 'application/json': responseModel - } - }, - { - // Same thing for the error responses - statusCode: '400', - responseParameters: { - 'method.response.header.Content-Type': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Access-Control-Allow-Credentials': true - }, - responseModels: { - 'application/json': errorResponseModel - } - } - ] -}); -``` - -Specifying `requestValidatorOptions` automatically creates the RequestValidator construct with the given options. -However, if you have your RequestValidator already initialized or imported, use the `requestValidator` option instead. - -## Default Integration and Method Options - -The `defaultIntegration` and `defaultMethodOptions` properties can be used to -configure a default integration at any resource level. These options will be -used when defining method under this resource (recursively) with undefined -integration or options. - -> If not defined, the default integration is `MockIntegration`. See reference -documentation for default method options. - -The following example defines the `booksBackend` integration as a default -integration. This means that all API methods that do not explicitly define an -integration will be routed to this AWS Lambda function. - -```ts -declare const booksBackend: apigateway.LambdaIntegration; -const api = new apigateway.RestApi(this, 'books', { - defaultIntegration: booksBackend -}); - -const books = api.root.addResource('books'); -books.addMethod('GET'); // integrated with `booksBackend` -books.addMethod('POST'); // integrated with `booksBackend` - -const book = books.addResource('{book_id}'); -book.addMethod('GET'); // integrated with `booksBackend` -``` - -A Method can be configured with authorization scopes. Authorization scopes are -used in conjunction with an [authorizer that uses Amazon Cognito user -pools](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html#apigateway-enable-cognito-user-pool). -Read more about authorization scopes -[here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationscopes). - -Authorization scopes for a Method can be configured using the `authorizationScopes` property as shown below - - -```ts -declare const books: apigateway.Resource; - -books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { - authorizationType: apigateway.AuthorizationType.COGNITO, - authorizationScopes: ['Scope1','Scope2'] -}); -``` - -## Proxy Routes - -The `addProxy` method can be used to install a greedy `{proxy+}` resource -on a path. By default, this also installs an `"ANY"` method: - -```ts -declare const resource: apigateway.Resource; -declare const handler: lambda.Function; -const proxy = resource.addProxy({ - defaultIntegration: new apigateway.LambdaIntegration(handler), - - // "false" will require explicitly adding methods on the `proxy` resource - anyMethod: true // "true" is the default -}); -``` - -## Authorizers - -API Gateway [supports several different authorization types](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-to-api.html) -that can be used for controlling access to your REST APIs. - -### IAM-based authorizer - -The following CDK code provides 'execute-api' permission to an IAM user, via IAM policies, for the 'GET' method on the `books` resource: - -```ts -declare const books: apigateway.Resource; -declare const iamUser: iam.User; - -const getBooks = books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { - authorizationType: apigateway.AuthorizationType.IAM -}); - -iamUser.attachInlinePolicy(new iam.Policy(this, 'AllowBooks', { - statements: [ - new iam.PolicyStatement({ - actions: [ 'execute-api:Invoke' ], - effect: iam.Effect.ALLOW, - resources: [ getBooks.methodArn ] - }) - ] -})) -``` - -### Lambda-based token authorizer - -API Gateway also allows [lambda functions to be used as authorizers](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html). - -This module provides support for token-based Lambda authorizers. When a client makes a request to an API's methods configured with such -an authorizer, API Gateway calls the Lambda authorizer, which takes the caller's identity as input and returns an IAM policy as output. -A token-based Lambda authorizer (also called a token authorizer) receives the caller's identity in a bearer token, such as -a JSON Web Token (JWT) or an OAuth token. - -API Gateway interacts with the authorizer Lambda function handler by passing input and expecting the output in a specific format. -The event object that the handler is called with contains the `authorizationToken` and the `methodArn` from the request to the -API Gateway endpoint. The handler is expected to return the `principalId` (i.e. the client identifier) and a `policyDocument` stating -what the client is authorizer to perform. -See [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html) for a detailed specification on -inputs and outputs of the Lambda handler. - -The following code attaches a token-based Lambda authorizer to the 'GET' Method of the Book resource: - -```ts -declare const authFn: lambda.Function; -declare const books: apigateway.Resource; - -const auth = new apigateway.TokenAuthorizer(this, 'booksAuthorizer', { - handler: authFn -}); - -books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { - authorizer: auth -}); -``` - -A full working example is shown below. - -```ts -import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; -import { MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer, Cors } from '../../lib'; - -/// !show -const app = new App(); -const stack = new Stack(app, 'TokenAuthorizerInteg'); - -const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')), -}); - -const authorizer = new TokenAuthorizer(stack, 'MyAuthorizer', { - handler: authorizerFn, -}); - -const restapi = new RestApi(stack, 'MyRestApi', { - cloudWatchRole: true, - defaultMethodOptions: { - authorizer, - }, - defaultCorsPreflightOptions: { - allowOrigins: Cors.ALL_ORIGINS, - }, -}); - - -restapi.root.addMethod('ANY', new MockIntegration({ - integrationResponses: [ - { statusCode: '200' }, - ], - passthroughBehavior: PassthroughBehavior.NEVER, - requestTemplates: { - 'application/json': '{ "statusCode": 200 }', - }, -}), { - methodResponses: [ - { statusCode: '200' }, - ], -}); -``` - -By default, the `TokenAuthorizer` looks for the authorization token in the request header with the key 'Authorization'. This can, -however, be modified by changing the `identitySource` property. - -Authorizers can also be passed via the `defaultMethodOptions` property within the `RestApi` construct or the `Method` construct. Unless -explicitly overridden, the specified defaults will be applied across all `Method`s across the `RestApi` or across all `Resource`s, -depending on where the defaults were specified. - -### Lambda-based request authorizer - -This module provides support for request-based Lambda authorizers. When a client makes a request to an API's methods configured with such -an authorizer, API Gateway calls the Lambda authorizer, which takes specified parts of the request, known as identity sources, -as input and returns an IAM policy as output. A request-based Lambda authorizer (also called a request authorizer) receives -the identity sources in a series of values pulled from the request, from the headers, stage variables, query strings, and the context. - -API Gateway interacts with the authorizer Lambda function handler by passing input and expecting the output in a specific format. -The event object that the handler is called with contains the body of the request and the `methodArn` from the request to the -API Gateway endpoint. The handler is expected to return the `principalId` (i.e. the client identifier) and a `policyDocument` stating -what the client is authorizer to perform. -See [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html) for a detailed specification on -inputs and outputs of the Lambda handler. - -The following code attaches a request-based Lambda authorizer to the 'GET' Method of the Book resource: - -```ts -declare const authFn: lambda.Function; -declare const books: apigateway.Resource; - -const auth = new apigateway.RequestAuthorizer(this, 'booksAuthorizer', { - handler: authFn, - identitySources: [apigateway.IdentitySource.header('Authorization')] -}); - -books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { - authorizer: auth -}); -``` - -A full working example is shown below. - -[Full request authorizer example](test/authorizers/integ.request-authorizer.lit.ts). - -By default, the `RequestAuthorizer` does not pass any kind of information from the request. This can, -however, be modified by changing the `identitySource` property, and is required when specifying a value for caching. - -Authorizers can also be passed via the `defaultMethodOptions` property within the `RestApi` construct or the `Method` construct. Unless -explicitly overridden, the specified defaults will be applied across all `Method`s across the `RestApi` or across all `Resource`s, -depending on where the defaults were specified. - -### Cognito User Pools authorizer - -API Gateway also allows [Amazon Cognito user pools as authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html) - -The following snippet configures a Cognito user pool as an authorizer: - -```ts -const userPool = new cognito.UserPool(this, 'UserPool'); - -const auth = new apigateway.CognitoUserPoolsAuthorizer(this, 'booksAuthorizer', { - cognitoUserPools: [userPool] -}); - -declare const books: apigateway.Resource; -books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { - authorizer: auth, - authorizationType: apigateway.AuthorizationType.COGNITO, -}); -``` - -## Mutual TLS (mTLS) - -Mutual TLS can be configured to limit access to your API based by using client certificates instead of (or as an extension of) using authorization headers. - -```ts -declare const acm: any; - -new apigateway.DomainName(this, 'domain-name', { - domainName: 'example.com', - certificate: acm.Certificate.fromCertificateArn(this, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), - mtls: { - bucket: new s3.Bucket(this, 'bucket'), - key: 'truststore.pem', - version: 'version', - }, -}); -``` - -Instructions for configuring your trust store can be found [here](https://aws.amazon.com/blogs/compute/introducing-mutual-tls-authentication-for-amazon-api-gateway/). - -## Deployments - -By default, the `RestApi` construct will automatically create an API Gateway -[Deployment] and a "prod" [Stage] which represent the API configuration you -defined in your CDK app. This means that when you deploy your app, your API will -be have open access from the internet via the stage URL. - -The URL of your API can be obtained from the attribute `restApi.url`, and is -also exported as an `Output` from your stack, so it's printed when you `cdk -deploy` your app: - -```console -$ cdk deploy -... -books.booksapiEndpointE230E8D5 = https://6lyktd4lpk.execute-api.us-east-1.amazonaws.com/prod/ -``` - -To disable this behavior, you can set `{ deploy: false }` when creating your -API. This means that the API will not be deployed and a stage will not be -created for it. You will need to manually define a `apigateway.Deployment` and -`apigateway.Stage` resources. - -Use the `deployOptions` property to customize the deployment options of your -API. - -The following example will configure API Gateway to emit logs and data traces to -AWS CloudWatch for all API calls: - -> Note: whether or not this is enabled or disabled by default is controlled by the -`@aws-cdk/aws-apigateway:disableCloudWatchRole` feature flag. When this feature flag -is set to `false` the default behavior will set `cloudWatchRole=true` - -This is controlled via the `@aws-cdk/aws-apigateway:disableCloudWatchRole` feature flag and -is disabled by default. When enabled (or `@aws-cdk/aws-apigateway:disableCloudWatchRole=false`), -an IAM role will be created and associated with API Gateway to allow it to write logs and metrics to AWS CloudWatch. - -```ts -const api = new apigateway.RestApi(this, 'books', { - cloudWatchRole: true, - deployOptions: { - loggingLevel: apigateway.MethodLoggingLevel.INFO, - dataTraceEnabled: true - } -}) -``` - -> Note: there can only be a single apigateway.CfnAccount per AWS environment -so if you create multiple `RestApi`s with `cloudWatchRole=true` each new `RestApi` -will overwrite the `CfnAccount`. It is recommended to set `cloudWatchRole=false` -(the default behavior if `@aws-cdk/aws-apigateway:disableCloudWatchRole` is enabled) -and only create a single CloudWatch role and account per environment. - -### Deep dive: Invalidation of deployments - -API Gateway deployments are an immutable snapshot of the API. This means that we -want to automatically create a new deployment resource every time the API model -defined in our CDK app changes. - -In order to achieve that, the AWS CloudFormation logical ID of the -`AWS::ApiGateway::Deployment` resource is dynamically calculated by hashing the -API configuration (resources, methods). This means that when the configuration -changes (i.e. a resource or method are added, configuration is changed), a new -logical ID will be assigned to the deployment resource. This will cause -CloudFormation to create a new deployment resource. - -By default, old deployments are _deleted_. You can set `retainDeployments: true` -to allow users revert the stage to an old deployment manually. - -[Deployment]: https://docs.aws.amazon.com/apigateway/api-reference/resource/deployment/ -[Stage]: https://docs.aws.amazon.com/apigateway/api-reference/resource/stage/ - -In order to also create a new deployment when changes are made to any authorizer attached to the API, -the `@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId` [feature flag](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html) can be enabled. This can be set -in the `cdk.json` file. - -```json -{ - "context": { - "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true - } -} -``` - -## Custom Domains - -To associate an API with a custom domain, use the `domainName` configuration when -you define your API: - -```ts -declare const acmCertificateForExampleCom: any; - -const api = new apigateway.RestApi(this, 'MyDomain', { - domainName: { - domainName: 'example.com', - certificate: acmCertificateForExampleCom, - }, -}); -``` - -This will define a `DomainName` resource for you, along with a `BasePathMapping` -from the root of the domain to the deployment stage of the API. This is a common -set up. - -To route domain traffic to an API Gateway API, use Amazon Route 53 to create an -alias record. An alias record is a Route 53 extension to DNS. It's similar to a -CNAME record, but you can create an alias record both for the root domain, such -as `example.com`, and for subdomains, such as `www.example.com`. (You can create -CNAME records only for subdomains.) - -```ts -import * as route53 from '@aws-cdk/aws-route53'; -import * as targets from '@aws-cdk/aws-route53-targets'; - -declare const api: apigateway.RestApi; -declare const hostedZoneForExampleCom: any; - -new route53.ARecord(this, 'CustomDomainAliasRecord', { - zone: hostedZoneForExampleCom, - target: route53.RecordTarget.fromAlias(new targets.ApiGateway(api)) -}); -``` - -You can also define a `DomainName` resource directly in order to customize the default behavior: - -```ts -declare const acmCertificateForExampleCom: any; - -new apigateway.DomainName(this, 'custom-domain', { - domainName: 'example.com', - certificate: acmCertificateForExampleCom, - endpointType: apigateway.EndpointType.EDGE, // default is REGIONAL - securityPolicy: apigateway.SecurityPolicy.TLS_1_2 -}); -``` - -Once you have a domain, you can map base paths of the domain to APIs. -The following example will map the URL -to the `api1` API and to the `api2` API. - -```ts -declare const domain: apigateway.DomainName; -declare const api1: apigateway.RestApi; -declare const api2: apigateway.RestApi; - -domain.addBasePathMapping(api1, { basePath: 'go-to-api1' }); -domain.addBasePathMapping(api2, { basePath: 'boom' }); -``` - -By default, the base path URL will map to the `deploymentStage` of the `RestApi`. -You can specify a different API `Stage` to which the base path URL will map to. - -```ts -declare const domain: apigateway.DomainName; -declare const restapi: apigateway.RestApi; - -const betaDeploy = new apigateway.Deployment(this, 'beta-deployment', { - api: restapi, -}); -const betaStage = new apigateway.Stage(this, 'beta-stage', { - deployment: betaDeploy, -}); -domain.addBasePathMapping(restapi, { basePath: 'api/beta', stage: betaStage }); -``` - -It is possible to create a base path mapping without associating it with a -stage by using the `attachToStage` property. When set to `false`, the stage must be -included in the URL when invoking the API. For example, - will invoke the stage named `prod` from the -`myapi` base path mapping. - -```ts -declare const domain: apigateway.DomainName; -declare const api: apigateway.RestApi; - -domain.addBasePathMapping(api, { basePath: 'myapi', attachToStage: false }); -``` - -If you don't specify `basePath`, all URLs under this domain will be mapped -to the API, and you won't be able to map another API to the same domain: - -```ts -declare const domain: apigateway.DomainName; -declare const api: apigateway.RestApi; -domain.addBasePathMapping(api); -``` - -This can also be achieved through the `mapping` configuration when defining the -domain as demonstrated above. - -Base path mappings can also be created with the `BasePathMapping` resource. - -```ts -declare const api: apigateway.RestApi; - -const domainName = apigateway.DomainName.fromDomainNameAttributes(this, 'DomainName', { - domainName: 'domainName', - domainNameAliasHostedZoneId: 'domainNameAliasHostedZoneId', - domainNameAliasTarget: 'domainNameAliasTarget', -}); - -new apigateway.BasePathMapping(this, 'BasePathMapping', { - domainName: domainName, - restApi: api, -}); -``` - -If you wish to setup this domain with an Amazon Route53 alias, use the `targets.ApiGatewayDomain`: - -```ts -declare const hostedZoneForExampleCom: any; -declare const domainName: apigateway.DomainName; - -import * as route53 from '@aws-cdk/aws-route53'; -import * as targets from '@aws-cdk/aws-route53-targets'; - -new route53.ARecord(this, 'CustomDomainAliasRecord', { - zone: hostedZoneForExampleCom, - target: route53.RecordTarget.fromAlias(new targets.ApiGatewayDomain(domainName)) -}); -``` - -### Custom Domains with multi-level api mapping - -Additional requirements for creating multi-level path mappings for RestApis: - -(both are defaults) - -- Must use `SecurityPolicy.TLS_1_2` -- DomainNames must be `EndpointType.REGIONAL` - -```ts -declare const acmCertificateForExampleCom: any; -declare const restApi: apigateway.RestApi; - -new apigateway.DomainName(this, 'custom-domain', { - domainName: 'example.com', - certificate: acmCertificateForExampleCom, - mapping: restApi, - basePath: 'orders/v1/api', -}); -``` - -To then add additional mappings to a domain you can use the `addApiMapping` method. - -```ts -declare const acmCertificateForExampleCom: any; -declare const restApi: apigateway.RestApi; -declare const secondRestApi: apigateway.RestApi; - -const domain = new apigateway.DomainName(this, 'custom-domain', { - domainName: 'example.com', - certificate: acmCertificateForExampleCom, - mapping: restApi, -}); - -domain.addApiMapping(secondRestApi.deploymentStage, { - basePath: 'orders/v2/api', -}); -``` - -## Access Logging - -Access logging creates logs every time an API method is accessed. Access logs can have information on -who has accessed the API, how the caller accessed the API and what responses were generated. -Access logs are configured on a Stage of the RestApi. -Access logs can be expressed in a format of your choosing, and can contain any access details, with a -minimum that it must include either 'requestId' or 'extendedRequestId'. The list of variables that -can be expressed in the access log can be found -[here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference). -Read more at [Setting Up CloudWatch API Logging in API -Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html) - -```ts -// production stage -const prdLogGroup = new logs.LogGroup(this, "PrdLogs"); -const api = new apigateway.RestApi(this, 'books', { - deployOptions: { - accessLogDestination: new apigateway.LogGroupLogDestination(prdLogGroup), - accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields(), - }, -}); -const deployment = new apigateway.Deployment(this, 'Deployment', {api}); - -// development stage -const devLogGroup = new logs.LogGroup(this, "DevLogs"); -new apigateway.Stage(this, 'dev', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(devLogGroup), - accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields({ - caller: false, - httpMethod: true, - ip: true, - protocol: true, - requestTime: true, - resourcePath: true, - responseLength: true, - status: true, - user: true, - }), -}); -``` - -The following code will generate the access log in the [CLF format](https://en.wikipedia.org/wiki/Common_Log_Format). - -```ts -const logGroup = new logs.LogGroup(this, "ApiGatewayAccessLogs"); -const api = new apigateway.RestApi(this, 'books', { - deployOptions: { - accessLogDestination: new apigateway.LogGroupLogDestination(logGroup), - accessLogFormat: apigateway.AccessLogFormat.clf(), - }}); -``` - -You can also configure your own access log format by using the `AccessLogFormat.custom()` API. -`AccessLogField` provides commonly used fields. The following code configures access log to contain. - -```ts -const logGroup = new logs.LogGroup(this, "ApiGatewayAccessLogs"); -new apigateway.RestApi(this, 'books', { - deployOptions: { - accessLogDestination: new apigateway.LogGroupLogDestination(logGroup), - accessLogFormat: apigateway.AccessLogFormat.custom( - `${apigateway.AccessLogField.contextRequestId()} ${apigateway.AccessLogField.contextErrorMessage()} ${apigateway.AccessLogField.contextErrorMessageString()} - ${apigateway.AccessLogField.contextAuthorizerError()} ${apigateway.AccessLogField.contextAuthorizerIntegrationStatus()}` - ) - } -}); -``` - -You can use the `methodOptions` property to configure -[default method throttling](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html#apigateway-api-level-throttling-in-usage-plan) -for a stage. The following snippet configures the a stage that accepts -100 requests per minute, allowing burst up to 200 requests per minute. - -```ts -const api = new apigateway.RestApi(this, 'books'); -const deployment = new apigateway.Deployment(this, 'my-deployment', { api }); -const stage = new apigateway.Stage(this, 'my-stage', { - deployment, - methodOptions: { - '/*/*': { // This special path applies to all resource paths and all HTTP methods - throttlingRateLimit: 100, - throttlingBurstLimit: 200 - } - } -}); -``` - -Configuring `methodOptions` on the `deployOptions` of `RestApi` will set the -throttling behaviors on the default stage that is automatically created. - -```ts -const api = new apigateway.RestApi(this, 'books', { - deployOptions: { - methodOptions: { - '/*/*': { // This special path applies to all resource paths and all HTTP methods - throttlingRateLimit: 100, - throttlingBurstLimit: 1000 - } - } - } -}); -``` - -## Cross Origin Resource Sharing (CORS) - -[Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism -that uses additional HTTP headers to tell browsers to give a web application -running at one origin, access to selected resources from a different origin. A -web application executes a cross-origin HTTP request when it requests a resource -that has a different origin (domain, protocol, or port) from its own. - -You can add the CORS [preflight](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Preflighted_requests) OPTIONS -HTTP method to any API resource via the `defaultCorsPreflightOptions` option or by calling the `addCorsPreflight` on a specific resource. - -The following example will enable CORS for all methods and all origins on all resources of the API: - -```ts -new apigateway.RestApi(this, 'api', { - defaultCorsPreflightOptions: { - allowOrigins: apigateway.Cors.ALL_ORIGINS, - allowMethods: apigateway.Cors.ALL_METHODS // this is also the default - } -}) -``` - -The following example will add an OPTIONS method to the `myResource` API resource, which -only allows GET and PUT HTTP requests from the origin - -```ts -declare const myResource: apigateway.Resource; - -myResource.addCorsPreflight({ - allowOrigins: [ 'https://amazon.com' ], - allowMethods: [ 'GET', 'PUT' ] -}); -``` - -See the -[`CorsOptions`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.CorsOptions.html) -API reference for a detailed list of supported configuration options. - -You can specify defaults this at the resource level, in which case they will be applied to the entire resource sub-tree: - -```ts -declare const resource: apigateway.Resource; - -const subtree = resource.addResource('subtree', { - defaultCorsPreflightOptions: { - allowOrigins: [ 'https://amazon.com' ] - } -}); -``` - -This means that all resources under `subtree` (inclusive) will have a preflight -OPTIONS added to them. - -See [#906](https://github.com/aws/aws-cdk/issues/906) for a list of CORS -features which are not yet supported. - -## Endpoint Configuration - -API gateway allows you to specify an -[API Endpoint Type](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-endpoint-types.html). -To define an endpoint type for the API gateway, use `endpointConfiguration` property: - -```ts -const api = new apigateway.RestApi(this, 'api', { - endpointConfiguration: { - types: [ apigateway.EndpointType.EDGE ] - } -}); -``` - -You can also create an association between your Rest API and a VPC endpoint. By doing so, -API Gateway will generate a new -Route53 Alias DNS record which you can use to invoke your private APIs. More info can be found -[here](https://docs.aws.amazon.com/apigateway/latest/developerguide/associate-private-api-with-vpc-endpoint.html). - -Here is an example: - -```ts -declare const someEndpoint: ec2.IVpcEndpoint; - -const api = new apigateway.RestApi(this, 'api', { - endpointConfiguration: { - types: [ apigateway.EndpointType.PRIVATE ], - vpcEndpoints: [ someEndpoint ] - } -}); -``` - -By performing this association, we can invoke the API gateway using the following format: - -```plaintext -https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage} -``` - -## Private Integrations - -A private integration makes it simple to expose HTTP/HTTPS resources behind an -Amazon VPC for access by clients outside of the VPC. The private integration uses -an API Gateway resource of `VpcLink` to encapsulate connections between API -Gateway and targeted VPC resources. -The `VpcLink` is then attached to the `Integration` of a specific API Gateway -Method. The following code sets up a private integration with a network load -balancer - - -```ts -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; - -const vpc = new ec2.Vpc(this, 'VPC'); -const nlb = new elbv2.NetworkLoadBalancer(this, 'NLB', { - vpc, -}); -const link = new apigateway.VpcLink(this, 'link', { - targets: [nlb], -}); - -const integration = new apigateway.Integration({ - type: apigateway.IntegrationType.HTTP_PROXY, - options: { - connectionType: apigateway.ConnectionType.VPC_LINK, - vpcLink: link, - }, -}); -``` - -The uri for the private integration, in the case of a VpcLink, will be set to the DNS name of -the VPC Link's NLB. If the VPC Link has multiple NLBs or the VPC Link is imported or the DNS -name cannot be determined for any other reason, the user is expected to specify the `uri` -property. - -Any existing `VpcLink` resource can be imported into the CDK app via the `VpcLink.fromVpcLinkId()`. - -```ts -const awesomeLink = apigateway.VpcLink.fromVpcLinkId(this, 'awesome-vpc-link', 'us-east-1_oiuR12Abd'); -``` - -## Gateway response - -If the Rest API fails to process an incoming request, it returns to the client an error response without forwarding the -request to the integration backend. API Gateway has a set of standard response messages that are sent to the client for -each type of error. These error responses can be configured on the Rest API. The list of Gateway responses that can be -configured can be found [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/supported-gateway-response-types.html). -Learn more about [Gateway -Responses](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-gatewayResponse-definition.html). - -The following code configures a Gateway Response when the response is 'access denied': - -```ts -const api = new apigateway.RestApi(this, 'books-api'); -api.addGatewayResponse('test-response', { - type: apigateway.ResponseType.ACCESS_DENIED, - statusCode: '500', - responseHeaders: { - // Note that values must be enclosed within a pair of single quotes - 'Access-Control-Allow-Origin': "'test.com'", - 'test-key': "'test-value'", - }, - templates: { - 'application/json': '{ "message": $context.error.messageString, "statusCode": "488", "type": "$context.error.responseType" }' - } -}); -``` - -## OpenAPI Definition - -CDK supports creating a REST API by importing an OpenAPI definition file. It currently supports OpenAPI v2.0 and OpenAPI -v3.0 definition files. Read more about [Configuring a REST API using -OpenAPI](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html). - -The following code creates a REST API using an external OpenAPI definition JSON file - - -```ts -declare const integration: apigateway.Integration; - -const api = new apigateway.SpecRestApi(this, 'books-api', { - apiDefinition: apigateway.ApiDefinition.fromAsset('path-to-file.json') -}); - -const booksResource = api.root.addResource('books') -booksResource.addMethod('GET', integration); -``` - -It is possible to use the `addResource()` API to define additional API Gateway Resources. - -**Note:** Deployment will fail if a Resource of the same name is already defined in the Open API specification. - -**Note:** Any default properties configured, such as `defaultIntegration`, `defaultMethodOptions`, etc. will only be -applied to Resources and Methods defined in the CDK, and not the ones defined in the spec. Use the [API Gateway -extensions to OpenAPI](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html) -to configure these. - -There are a number of limitations in using OpenAPI definitions in API Gateway. Read the [Amazon API Gateway important -notes for REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html#api-gateway-known-issues-rest-apis) -for more details. - -**Note:** When starting off with an OpenAPI definition using `SpecRestApi`, it is not possible to configure some -properties that can be configured directly in the OpenAPI specification file. This is to prevent people duplication -of these properties and potential confusion. - -### Endpoint configuration - -By default, `SpecRestApi` will create an edge optimized endpoint. - -This can be modified as shown below: - -```ts -declare const apiDefinition: apigateway.ApiDefinition; - -const api = new apigateway.SpecRestApi(this, 'ExampleRestApi', { - apiDefinition, - endpointTypes: [apigateway.EndpointType.PRIVATE] -}); -``` - -**Note:** For private endpoints you will still need to provide the -[`x-amazon-apigateway-policy`](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html) and -[`x-amazon-apigateway-endpoint-configuration`](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html) -in your openApi file. - -## Metrics - -The API Gateway service sends metrics around the performance of Rest APIs to Amazon CloudWatch. -These metrics can be referred to using the metric APIs available on the `RestApi`, `Stage` and `Method` constructs. -Note that detailed metrics must be enabled for a stage to use the `Method` metrics. -Read more about [API Gateway metrics](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html), including enabling detailed metrics. -The APIs with the `metric` prefix can be used to get reference to specific metrics for this API. For example: - -```ts -const api = new apigateway.RestApi(this, 'my-api'); -const stage = api.deploymentStage; -const method = api.root.addMethod('GET'); - -const clientErrorApiMetric = api.metricClientError(); -const serverErrorStageMetric = stage.metricServerError(); -const latencyMethodMetric = method.metricLatency(stage); -``` - -## APIGateway v2 - -APIGateway v2 APIs are now moved to its own package named `aws-apigatewayv2`. For backwards compatibility, existing -APIGateway v2 "CFN resources" (such as `CfnApi`) that were previously exported as part of this package, are still -exported from here and have been marked deprecated. However, updates to these CloudFormation resources, such as new -properties and new resource types will not be available. - -Move to using `aws-apigatewayv2` to get the latest APIs and updates. - ----- - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/@aws-cdk/aws-apigateway/jest.config.js b/packages/@aws-cdk/aws-apigateway/jest.config.js deleted file mode 100644 index 3403249680be2..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 80, - statements: 60, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts b/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts deleted file mode 100644 index 8c119293a87a9..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts +++ /dev/null @@ -1,313 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Arn, ArnFormat, Duration, FeatureFlags, Lazy, Names, Stack } from '@aws-cdk/core'; -import { APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID } from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { CfnAuthorizer, CfnAuthorizerProps } from '../apigateway.generated'; -import { Authorizer, IAuthorizer } from '../authorizer'; -import { IRestApi } from '../restapi'; - - -/** - * Base properties for all lambda authorizers - */ -export interface LambdaAuthorizerProps { - /** - * An optional human friendly name for the authorizer. Note that, this is not the primary identifier of the authorizer. - * - * @default - the unique construct ID - */ - readonly authorizerName?: string; - - /** - * The handler for the authorizer lambda function. - * - * The handler must follow a very specific protocol on the input it receives - * and the output it needs to produce. API Gateway has documented the - * handler's [input specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html) - * and [output specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html). - */ - readonly handler: lambda.IFunction; - - /** - * How long APIGateway should cache the results. Max 1 hour. - * Disable caching by setting this to 0. - * - * @default Duration.minutes(5) - */ - readonly resultsCacheTtl?: Duration; - - /** - * An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer. The IAM role must be - * assumable by 'apigateway.amazonaws.com'. - * - * @default - A resource policy is added to the Lambda function allowing apigateway.amazonaws.com to invoke the function. - */ - readonly assumeRole?: iam.IRole; -} - -abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer { - - /** - * The id of the authorizer. - * @attribute - */ - public abstract override readonly authorizerId: string; - - /** - * The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants. - */ - public abstract readonly authorizerArn: string; - - /** - * The Lambda function handler that this authorizer uses. - */ - protected readonly handler: lambda.IFunction; - - /** - * The IAM role that the API Gateway service assumes while invoking the Lambda function. - */ - protected readonly role?: iam.IRole; - - protected restApiId?: string; - - protected abstract readonly authorizerProps: CfnAuthorizerProps; - - protected constructor(scope: Construct, id: string, props: LambdaAuthorizerProps) { - super(scope, id); - - this.handler = props.handler; - this.role = props.assumeRole; - - if (props.resultsCacheTtl && props.resultsCacheTtl?.toSeconds() > 3600) { - throw new Error('Lambda authorizer property \'resultsCacheTtl\' must not be greater than 3600 seconds (1 hour)'); - } - } - - /** - * Attaches this authorizer to a specific REST API. - * @internal - */ - public _attachToApi(restApi: IRestApi) { - if (this.restApiId && this.restApiId !== restApi.restApiId) { - throw new Error('Cannot attach authorizer to two different rest APIs'); - } - - this.restApiId = restApi.restApiId; - - const deployment = restApi.latestDeployment; - const addToLogicalId = FeatureFlags.of(this).isEnabled(APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID); - - if (deployment && addToLogicalId) { - let functionName; - - if (this.handler instanceof lambda.Function) { - // if not imported, attempt to get the function name, which - // may be a token - functionName = (this.handler.node.defaultChild as lambda.CfnFunction).functionName; - } else { - // if imported, the function name will be a token - functionName = this.handler.functionName; - } - - deployment.node.addDependency(this); - deployment.addToLogicalId({ - authorizer: this.authorizerProps, - authorizerToken: functionName, - }); - } - } - - /** - * Sets up the permissions necessary for the API Gateway service to invoke the Lambda function. - */ - protected setupPermissions() { - if (!this.role) { - this.addDefaultPermisionRole(); - } else if (iam.Role.isRole(this.role)) { - this.addLambdaInvokePermission(this.role); - } - } - - /** - * Add Default Permission Role for handler - */ - private addDefaultPermisionRole() :void { - this.handler.addPermission(`${Names.uniqueId(this)}:Permissions`, { - principal: new iam.ServicePrincipal('apigateway.amazonaws.com'), - sourceArn: this.authorizerArn, - }); - } - - /** - * Add Lambda Invoke Permission for LambdaAurhorizer's role - */ - private addLambdaInvokePermission(role: iam.Role) :void { - role.attachInlinePolicy(new iam.Policy(this, 'authorizerInvokePolicy', { - statements: [ - new iam.PolicyStatement({ - resources: this.handler.resourceArnsForGrantInvoke, - actions: ['lambda:InvokeFunction'], - }), - ], - })); - } - - /** - * Returns a token that resolves to the Rest Api Id at the time of synthesis. - * Throws an error, during token resolution, if no RestApi is attached to this authorizer. - */ - protected lazyRestApiId() { - return Lazy.string({ - produce: () => { - if (!this.restApiId) { - throw new Error(`Authorizer (${this.node.path}) must be attached to a RestApi`); - } - return this.restApiId; - }, - }); - } -} - -/** - * Properties for TokenAuthorizer - */ -export interface TokenAuthorizerProps extends LambdaAuthorizerProps { - /** - * An optional regex to be matched against the authorization token. When matched the authorizer lambda is invoked, - * otherwise a 401 Unauthorized is returned to the client. - * - * @default - no regex filter will be applied. - */ - readonly validationRegex?: string; - - /** - * The request header mapping expression for the bearer token. This is typically passed as part of the header, in which case - * this should be `method.request.header.Authorizer` where Authorizer is the header containing the bearer token. - * @see https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource - * @default `IdentitySource.header('Authorization')` - */ - readonly identitySource?: string; -} - -/** - * Token based lambda authorizer that recognizes the caller's identity as a bearer token, - * such as a JSON Web Token (JWT) or an OAuth token. - * Based on the token, authorization is performed by a lambda function. - * - * @resource AWS::ApiGateway::Authorizer - */ -export class TokenAuthorizer extends LambdaAuthorizer { - - public readonly authorizerId: string; - - public readonly authorizerArn: string; - - protected readonly authorizerProps: CfnAuthorizerProps; - - constructor(scope: Construct, id: string, props: TokenAuthorizerProps) { - super(scope, id, props); - - const restApiId = this.lazyRestApiId(); - - const authorizerProps: CfnAuthorizerProps = { - name: props.authorizerName ?? Names.uniqueId(this), - restApiId, - type: 'TOKEN', - authorizerUri: lambdaAuthorizerArn(props.handler), - authorizerCredentials: props.assumeRole?.roleArn, - authorizerResultTtlInSeconds: props.resultsCacheTtl?.toSeconds(), - identitySource: props.identitySource || 'method.request.header.Authorization', - identityValidationExpression: props.validationRegex, - }; - - this.authorizerProps = authorizerProps; - - const resource = new CfnAuthorizer(this, 'Resource', authorizerProps); - - this.authorizerId = resource.ref; - this.authorizerArn = Stack.of(this).formatArn({ - service: 'execute-api', - resource: restApiId, - resourceName: `authorizers/${this.authorizerId}`, - }); - - this.setupPermissions(); - } -} - -/** - * Properties for RequestAuthorizer - */ -export interface RequestAuthorizerProps extends LambdaAuthorizerProps { - /** - * An array of request header mapping expressions for identities. Supported parameter types are - * Header, Query String, Stage Variable, and Context. For instance, extracting an authorization - * token from a header would use the identity source `IdentitySource.header('Authorizer')`. - * - * Note: API Gateway uses the specified identity sources as the request authorizer caching key. When caching is - * enabled, API Gateway calls the authorizer's Lambda function only after successfully verifying that all the - * specified identity sources are present at runtime. If a specified identify source is missing, null, or empty, - * API Gateway returns a 401 Unauthorized response without calling the authorizer Lambda function. - * - * @see https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource - */ - readonly identitySources: string[]; -} - -/** - * Request-based lambda authorizer that recognizes the caller's identity via request parameters, - * such as headers, paths, query strings, stage variables, or context variables. - * Based on the request, authorization is performed by a lambda function. - * - * @resource AWS::ApiGateway::Authorizer - */ -export class RequestAuthorizer extends LambdaAuthorizer { - - public readonly authorizerId: string; - - public readonly authorizerArn: string; - - protected readonly authorizerProps: CfnAuthorizerProps; - - constructor(scope: Construct, id: string, props: RequestAuthorizerProps) { - super(scope, id, props); - - if ((props.resultsCacheTtl === undefined || props.resultsCacheTtl.toSeconds() !== 0) && props.identitySources.length === 0) { - throw new Error('At least one Identity Source is required for a REQUEST-based Lambda authorizer if caching is enabled.'); - } - - const restApiId = this.lazyRestApiId(); - - const authorizerProps: CfnAuthorizerProps = { - name: props.authorizerName ?? Names.uniqueId(this), - restApiId, - type: 'REQUEST', - authorizerUri: lambdaAuthorizerArn(props.handler), - authorizerCredentials: props.assumeRole?.roleArn, - authorizerResultTtlInSeconds: props.resultsCacheTtl?.toSeconds(), - identitySource: props.identitySources.map(is => is.toString()).join(','), - }; - - this.authorizerProps = authorizerProps; - - const resource = new CfnAuthorizer(this, 'Resource', authorizerProps); - - this.authorizerId = resource.ref; - this.authorizerArn = Stack.of(this).formatArn({ - service: 'execute-api', - resource: restApiId, - resourceName: `authorizers/${this.authorizerId}`, - }); - - this.setupPermissions(); - } -} - -/** - * constructs the authorizerURIArn. - */ -function lambdaAuthorizerArn(handler: lambda.IFunction) { - const { region, partition } = Arn.split( handler.functionArn, ArnFormat.COLON_RESOURCE_NAME); - return `arn:${partition}:apigateway:${region}:lambda:path/2015-03-31/functions/${handler.functionArn}/invocations`; -} diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts b/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts deleted file mode 100644 index 2cafdaef5dfdf..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/lib/integrations/lambda.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Lazy, Names, Token } from '@aws-cdk/core'; -import { AwsIntegration } from './aws'; -import { IntegrationConfig, IntegrationOptions } from '../integration'; -import { Method } from '../method'; - -export interface LambdaIntegrationOptions extends IntegrationOptions { - /** - * Use proxy integration or normal (request/response mapping) integration. - * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format - * - * @default true - */ - readonly proxy?: boolean; - - /** - * Allow invoking method from AWS Console UI (for testing purposes). - * - * This will add another permission to the AWS Lambda resource policy which - * will allow the `test-invoke-stage` stage to invoke this handler. If this - * is set to `false`, the function will only be usable from the deployment - * endpoint. - * - * @default true - */ - readonly allowTestInvoke?: boolean; -} - -/** - * Integrates an AWS Lambda function to an API Gateway method. - * - * @example - * - * declare const resource: apigateway.Resource; - * declare const handler: lambda.Function; - * resource.addMethod('GET', new apigateway.LambdaIntegration(handler)); - * - */ -export class LambdaIntegration extends AwsIntegration { - private readonly handler: lambda.IFunction; - private readonly enableTest: boolean; - - constructor(handler: lambda.IFunction, options: LambdaIntegrationOptions = { }) { - const proxy = options.proxy ?? true; - - super({ - proxy, - service: 'lambda', - path: `2015-03-31/functions/${handler.functionArn}/invocations`, - options, - }); - - this.handler = handler; - this.enableTest = options.allowTestInvoke ?? true; - } - - public bind(method: Method): IntegrationConfig { - const bindResult = super.bind(method); - const principal = new iam.ServicePrincipal('apigateway.amazonaws.com'); - - const desc = `${Names.nodeUniqueId(method.api.node)}.${method.httpMethod}.${method.resource.path.replace(/\//g, '.')}`; - - this.handler.addPermission(`ApiPermission.${desc}`, { - principal, - scope: method, - sourceArn: Lazy.string({ produce: () => method.methodArn }), - }); - - // add permission to invoke from the console - if (this.enableTest) { - this.handler.addPermission(`ApiPermission.Test.${desc}`, { - principal, - scope: method, - sourceArn: method.testMethodArn, - }); - } - - let functionName; - - if (this.handler instanceof lambda.Function) { - // if not imported, extract the name from the CFN layer to reach - // the literal value if it is given (rather than a token) - functionName = (this.handler.node.defaultChild as lambda.CfnFunction).functionName; - } else { - // imported, just take the function name. - functionName = this.handler.functionName; - } - - let deploymentToken; - if (!Token.isUnresolved(functionName)) { - deploymentToken = JSON.stringify({ functionName }); - } - return { - ...bindResult, - deploymentToken, - }; - } -} diff --git a/packages/@aws-cdk/aws-apigateway/lib/resource.ts b/packages/@aws-cdk/aws-apigateway/lib/resource.ts deleted file mode 100644 index a3fc44e5360f3..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/lib/resource.ts +++ /dev/null @@ -1,565 +0,0 @@ -import { IResource as IResourceBase, Resource as ResourceConstruct } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnResource, CfnResourceProps } from './apigateway.generated'; -import { Cors, CorsOptions } from './cors'; -import { Integration } from './integration'; -import { MockIntegration } from './integrations'; -import { Method, MethodOptions, AuthorizationType } from './method'; -import { IRestApi, RestApi } from './restapi'; - -export interface IResource extends IResourceBase { - /** - * The parent of this resource or undefined for the root resource. - */ - readonly parentResource?: IResource; - - /** - * The rest API that this resource is part of. - * - * @deprecated - Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead. - */ - readonly restApi: RestApi; - - /** - * The rest API that this resource is part of. - * - * The reason we need the RestApi object itself and not just the ID is because the model - * is being tracked by the top-level RestApi object for the purpose of calculating it's - * hash to determine the ID of the deployment. This allows us to automatically update - * the deployment when the model of the REST API changes. - */ - readonly api: IRestApi; - - /** - * The ID of the resource. - * @attribute - */ - readonly resourceId: string; - - /** - * The full path of this resource. - */ - readonly path: string; - - /** - * An integration to use as a default for all methods created within this - * API unless an integration is specified. - */ - readonly defaultIntegration?: Integration; - - /** - * Method options to use as a default for all methods created within this - * API unless custom options are specified. - */ - readonly defaultMethodOptions?: MethodOptions; - - /** - * Default options for CORS preflight OPTIONS method. - */ - readonly defaultCorsPreflightOptions?: CorsOptions; - - /** - * Gets or create all resources leading up to the specified path. - * - * - Path may only start with "/" if this method is called on the root resource. - * - All resources are created using default options. - * - * @param path The relative path - * @returns a new or existing resource. - */ - resourceForPath(path: string): Resource; - - /** - * Defines a new child resource where this resource is the parent. - * @param pathPart The path part for the child resource - * @param options Resource options - * @returns A Resource object - */ - addResource(pathPart: string, options?: ResourceOptions): Resource; - - /** - * Retrieves a child resource by path part. - * - * @param pathPart The path part of the child resource - * @returns the child resource or undefined if not found - */ - getResource(pathPart: string): IResource | undefined; - - /** - * Adds a greedy proxy resource ("{proxy+}") and an ANY method to this route. - * @param options Default integration and method options. - */ - addProxy(options?: ProxyResourceOptions): ProxyResource; - - /** - * Defines a new method for this resource. - * @param httpMethod The HTTP method - * @param target The target backend integration for this method - * @param options Method options, such as authentication. - * - * @returns The newly created `Method` object. - */ - addMethod(httpMethod: string, target?: Integration, options?: MethodOptions): Method; - - /** - * Adds an OPTIONS method to this resource which responds to Cross-Origin - * Resource Sharing (CORS) preflight requests. - * - * Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional - * HTTP headers to tell browsers to give a web application running at one - * origin, access to selected resources from a different origin. A web - * application executes a cross-origin HTTP request when it requests a - * resource that has a different origin (domain, protocol, or port) from its - * own. - * - * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS - * @param options CORS options - * @returns a `Method` object - */ - addCorsPreflight(options: CorsOptions): Method; -} - -export interface ResourceOptions { - /** - * An integration to use as a default for all methods created within this - * API unless an integration is specified. - * - * @default - Inherited from parent. - */ - readonly defaultIntegration?: Integration; - - /** - * Method options to use as a default for all methods created within this - * API unless custom options are specified. - * - * @default - Inherited from parent. - */ - readonly defaultMethodOptions?: MethodOptions; - - /** - * Adds a CORS preflight OPTIONS method to this resource and all child - * resources. - * - * You can add CORS at the resource-level using `addCorsPreflight`. - * - * @default - CORS is disabled - */ - readonly defaultCorsPreflightOptions?: CorsOptions; -} - -export interface ResourceProps extends ResourceOptions { - /** - * The parent resource of this resource. You can either pass another - * `Resource` object or a `RestApi` object here. - */ - readonly parent: IResource; - - /** - * A path name for the resource. - */ - readonly pathPart: string; -} - -export abstract class ResourceBase extends ResourceConstruct implements IResource { - public abstract readonly parentResource?: IResource; - /** - * @deprecated - Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead. - */ - public abstract readonly restApi: RestApi; - public abstract readonly api: IRestApi; - public abstract readonly resourceId: string; - public abstract readonly path: string; - public abstract readonly defaultIntegration?: Integration; - public abstract readonly defaultMethodOptions?: MethodOptions; - public abstract readonly defaultCorsPreflightOptions?: CorsOptions; - - private readonly children: { [pathPart: string]: Resource } = { }; - - constructor(scope: Construct, id: string) { - super(scope, id); - } - - public addResource(pathPart: string, options?: ResourceOptions): Resource { - return new Resource(this, pathPart, { parent: this, pathPart, ...options }); - } - - public addMethod(httpMethod: string, integration?: Integration, options?: MethodOptions): Method { - return new Method(this, httpMethod, { resource: this, httpMethod, integration, options }); - } - - public addProxy(options?: ProxyResourceOptions): ProxyResource { - return new ProxyResource(this, '{proxy+}', { parent: this, ...options }); - } - - public addCorsPreflight(options: CorsOptions) { - const headers: { [name: string]: string } = { }; - - // - // Access-Control-Allow-Headers - - const allowHeaders = options.allowHeaders || Cors.DEFAULT_HEADERS; - headers['Access-Control-Allow-Headers'] = `'${allowHeaders.join(',')}'`; - - // - // Access-Control-Allow-Origin - - if (options.allowOrigins.length === 0) { - throw new Error('allowOrigins must contain at least one origin'); - } - - if (options.allowOrigins.includes('*') && options.allowOrigins.length > 1) { - throw new Error(`Invalid "allowOrigins" - cannot mix "*" with specific origins: ${options.allowOrigins.join(',')}`); - } - - // we use the first origin here and if there are more origins in the list, we - // will match against them in the response velocity template - const initialOrigin = options.allowOrigins[0]; - headers['Access-Control-Allow-Origin'] = `'${initialOrigin}'`; - - // the "Vary" header is required if we allow a specific origin - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin#CORS_and_caching - if (initialOrigin !== '*') { - headers.Vary = '\'Origin\''; - } - - // - // Access-Control-Allow-Methods - - let allowMethods = options.allowMethods || Cors.ALL_METHODS; - - if (allowMethods.includes('ANY')) { - if (allowMethods.length > 1) { - throw new Error(`ANY cannot be used with any other method. Received: ${allowMethods.join(',')}`); - } - - allowMethods = Cors.ALL_METHODS; - } - - headers['Access-Control-Allow-Methods'] = `'${allowMethods.join(',')}'`; - - // - // Access-Control-Allow-Credentials - - if (options.allowCredentials) { - headers['Access-Control-Allow-Credentials'] = '\'true\''; - } - - // - // Access-Control-Max-Age - - let maxAgeSeconds; - - if (options.maxAge && options.disableCache) { - throw new Error('The options "maxAge" and "disableCache" are mutually exclusive'); - } - - if (options.maxAge) { - maxAgeSeconds = options.maxAge.toSeconds(); - } - - if (options.disableCache) { - maxAgeSeconds = -1; - } - - if (maxAgeSeconds) { - headers['Access-Control-Max-Age'] = `'${maxAgeSeconds}'`; - } - - // - // Access-Control-Expose-Headers - // - - if (options.exposeHeaders) { - headers['Access-Control-Expose-Headers'] = `'${options.exposeHeaders.join(',')}'`; - } - - // - // statusCode - - const statusCode = options.statusCode ?? 204; - - // - // prepare responseParams - - const integrationResponseParams: { [p: string]: string } = { }; - const methodResponseParams: { [p: string]: boolean } = { }; - - for (const [name, value] of Object.entries(headers)) { - const key = `method.response.header.${name}`; - integrationResponseParams[key] = value; - methodResponseParams[key] = true; - } - - return this.addMethod('OPTIONS', new MockIntegration({ - requestTemplates: { 'application/json': '{ statusCode: 200 }' }, - integrationResponses: [ - { statusCode: `${statusCode}`, responseParameters: integrationResponseParams, responseTemplates: renderResponseTemplate() }, - ], - }), { - authorizer: { - authorizerId: '', - authorizationType: AuthorizationType.NONE, - }, - apiKeyRequired: false, - authorizationType: AuthorizationType.NONE, - methodResponses: [ - { statusCode: `${statusCode}`, responseParameters: methodResponseParams }, - ], - }); - - // renders the response template to match all possible origins (if we have more than one) - function renderResponseTemplate() { - const origins = options.allowOrigins.slice(1); - - if (origins.length === 0) { - return undefined; - } - - const template = new Array(); - - template.push('#set($origin = $input.params().header.get("Origin"))'); - template.push('#if($origin == "") #set($origin = $input.params().header.get("origin")) #end'); - - const condition = origins.map(o => `$origin.matches("${o}")`).join(' || '); - - template.push(`#if(${condition})`); - template.push(' #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)'); - template.push('#end'); - - return { - 'application/json': template.join('\n'), - }; - } - } - - public getResource(pathPart: string): IResource | undefined { - return this.children[pathPart]; - } - - /** - * @internal - */ - public _trackChild(pathPart: string, resource: Resource) { - this.children[pathPart] = resource; - } - - public resourceForPath(path: string): Resource { - if (!path) { - return this; - } - - if (path.startsWith('/')) { - if (this.path !== '/') { - throw new Error(`Path may start with "/" only for the resource, but we are at: ${this.path}`); - } - - // trim trailing "/" - return this.resourceForPath(path.slice(1)); - } - - const parts = path.split('/'); - const next = parts.shift(); - if (!next || next === '') { - throw new Error('resourceForPath cannot be called with an empty path'); - } - - let resource = this.getResource(next); - if (!resource) { - resource = this.addResource(next); - } - - return resource.resourceForPath(parts.join('/')); - } - - /** - * @deprecated - Throws error in some use cases that have been enabled since this deprecation notice. Use `RestApi.urlForPath()` instead. - */ - public get url(): string { - return this.restApi.urlForPath(this.path); - } -} - -/** - * Attributes that can be specified when importing a Resource - */ -export interface ResourceAttributes { - /** - * The ID of the resource. - */ - readonly resourceId: string; - - /** - * The rest API that this resource is part of. - */ - readonly restApi: IRestApi; - - /** - * The full path of this resource. - */ - readonly path: string; -} - -export class Resource extends ResourceBase { - /** - * Import an existing resource - */ - public static fromResourceAttributes(scope: Construct, id: string, attrs: ResourceAttributes): IResource { - class Import extends ResourceBase { - public readonly api = attrs.restApi; - public readonly resourceId = attrs.resourceId; - public readonly path = attrs.path; - public readonly defaultIntegration?: Integration = undefined; - public readonly defaultMethodOptions?: MethodOptions = undefined; - public readonly defaultCorsPreflightOptions?: CorsOptions = undefined; - - public get parentResource(): IResource { - throw new Error('parentResource is not configured for imported resource.'); - } - - public get restApi(): RestApi { - throw new Error('restApi is not configured for imported resource.'); - } - } - - return new Import(scope, id); - } - - public readonly parentResource?: IResource; - public readonly api: IRestApi; - public readonly resourceId: string; - public readonly path: string; - - public readonly defaultIntegration?: Integration; - public readonly defaultMethodOptions?: MethodOptions; - public readonly defaultCorsPreflightOptions?: CorsOptions; - - constructor(scope: Construct, id: string, props: ResourceProps) { - super(scope, id); - - validateResourcePathPart(props.pathPart); - - this.parentResource = props.parent; - - if (props.parent instanceof ResourceBase) { - props.parent._trackChild(props.pathPart, this); - } - - const resourceProps: CfnResourceProps = { - restApiId: props.parent.api.restApiId, - parentId: props.parent.resourceId, - pathPart: props.pathPart, - }; - const resource = new CfnResource(this, 'Resource', resourceProps); - - this.resourceId = resource.ref; - this.api = props.parent.api; - - // render resource path (special case for root) - this.path = props.parent.path; - if (!this.path.endsWith('/')) { this.path += '/'; } - this.path += props.pathPart; - - const deployment = props.parent.api.latestDeployment; - if (deployment) { - deployment.node.addDependency(resource); - deployment.addToLogicalId({ resource: resourceProps }); - } - - // setup defaults based on properties and inherit from parent. method defaults - // are inherited per property, so children can override piecemeal. - this.defaultIntegration = props.defaultIntegration || props.parent.defaultIntegration; - this.defaultMethodOptions = { - ...props.parent.defaultMethodOptions, - ...props.defaultMethodOptions, - }; - this.defaultCorsPreflightOptions = props.defaultCorsPreflightOptions || props.parent.defaultCorsPreflightOptions; - - if (this.defaultCorsPreflightOptions) { - this.addCorsPreflight(this.defaultCorsPreflightOptions); - } - } - - /** - * The RestApi associated with this Resource - * @deprecated - Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead. - */ - public get restApi(): RestApi { - if (!this.parentResource) { - throw new Error('parentResource was unexpectedly not defined'); - } - return this.parentResource.restApi; - } -} - -export interface ProxyResourceOptions extends ResourceOptions { - /** - * Adds an "ANY" method to this resource. If set to `false`, you will have to explicitly - * add methods to this resource after it's created. - * - * @default true - */ - readonly anyMethod?: boolean; -} - -export interface ProxyResourceProps extends ProxyResourceOptions { - /** - * The parent resource of this resource. You can either pass another - * `Resource` object or a `RestApi` object here. - */ - readonly parent: IResource; -} - -/** - * Defines a {proxy+} greedy resource and an ANY method on a route. - * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html - */ -export class ProxyResource extends Resource { - /** - * If `props.anyMethod` is `true`, this will be the reference to the 'ANY' - * method associated with this proxy resource. - */ - public readonly anyMethod?: Method; - - constructor(scope: Construct, id: string, props: ProxyResourceProps) { - super(scope, id, { - parent: props.parent, - pathPart: '{proxy+}', - defaultIntegration: props.defaultIntegration, - defaultMethodOptions: props.defaultMethodOptions, - }); - - const anyMethod = props.anyMethod ?? true; - if (anyMethod) { - this.anyMethod = this.addMethod('ANY'); - } - } - - public addMethod(httpMethod: string, integration?: Integration, options?: MethodOptions): Method { - // In case this proxy is mounted under the root, also add this method to - // the root so that empty paths are proxied as well. - if (this.parentResource && this.parentResource.path === '/') { - // skip if the root resource already has this method defined - if (!(this.parentResource.node.tryFindChild(httpMethod) instanceof Method)) { - this.parentResource.addMethod(httpMethod, integration, options); - } - } - return super.addMethod(httpMethod, integration, options); - } -} - -function validateResourcePathPart(part: string) { - // strip {} which indicate this is a parameter - if (part.startsWith('{') && part.endsWith('}')) { - part = part.slice(1, -1); - - // proxy resources are allowed to end with a '+' - if (part.endsWith('+')) { - part = part.slice(0, -1); - } - } - - if (!/^[a-zA-Z0-9:\.\_\-]+$/.test(part)) { - throw new Error(`Resource's path part only allow [a-zA-Z0-9:._-], an optional trailing '+' - and curly braces at the beginning and the end: ${part}`); - } -} diff --git a/packages/@aws-cdk/aws-apigateway/lib/stage.ts b/packages/@aws-cdk/aws-apigateway/lib/stage.ts deleted file mode 100644 index df28bdc711256..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/lib/stage.ts +++ /dev/null @@ -1,495 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { ArnFormat, Duration, IResource, Resource, Stack, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { AccessLogFormat, IAccessLogDestination } from './access-log'; -import { IApiKey, ApiKeyOptions, ApiKey } from './api-key'; -import { ApiGatewayMetrics } from './apigateway-canned-metrics.generated'; -import { CfnStage } from './apigateway.generated'; -import { Deployment } from './deployment'; -import { IRestApi, RestApiBase } from './restapi'; -import { parseMethodOptionsPath } from './util'; - -/** - * Represents an APIGateway Stage. - */ -export interface IStage extends IResource { - /** - * Name of this stage. - * @attribute - */ - readonly stageName: string; - - /** - * RestApi to which this stage is associated. - */ - readonly restApi: IRestApi; - - /** - * Add an ApiKey to this Stage - */ - addApiKey(id: string, options?: ApiKeyOptions): IApiKey; -} - -export interface StageOptions extends MethodDeploymentOptions { - /** - * The name of the stage, which API Gateway uses as the first path segment - * in the invoked Uniform Resource Identifier (URI). - * - * @default - "prod" - */ - readonly stageName?: string; - - /** - * The CloudWatch Logs log group. - * - * @default - No destination - */ - readonly accessLogDestination?: IAccessLogDestination; - - /** - * A single line format of access logs of data, as specified by selected $content variables. - * The format must include either `AccessLogFormat.contextRequestId()` - * or `AccessLogFormat.contextExtendedRequestId()`. - * - * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference - * - * @default - Common Log Format - */ - readonly accessLogFormat?: AccessLogFormat; - - /** - * Specifies whether Amazon X-Ray tracing is enabled for this method. - * - * @default false - */ - readonly tracingEnabled?: boolean; - - /** - * Indicates whether cache clustering is enabled for the stage. - * - * @default - Disabled for the stage. - */ - readonly cacheClusterEnabled?: boolean; - - /** - * The stage's cache cluster size. - * @default 0.5 - */ - readonly cacheClusterSize?: string; - - /** - * The identifier of the client certificate that API Gateway uses to call - * your integration endpoints in the stage. - * - * @default - None. - */ - readonly clientCertificateId?: string; - - /** - * A description of the purpose of the stage. - * - * @default - No description. - */ - readonly description?: string; - - /** - * The version identifier of the API documentation snapshot. - * - * @default - No documentation version. - */ - readonly documentationVersion?: string; - - /** - * A map that defines the stage variables. Variable names must consist of - * alphanumeric characters, and the values must match the following regular - * expression: [A-Za-z0-9-._~:/?#&=,]+. - * - * @default - No stage variables. - */ - readonly variables?: { [key: string]: string }; - - /** - * Method deployment options for specific resources/methods. These will - * override common options defined in `StageOptions#methodOptions`. - * - * @param path is {resource_path}/{http_method} (i.e. /api/toys/GET) for an - * individual method override. You can use `*` for both {resource_path} and {http_method} - * to define options for all methods/resources. - * - * @default - Common options will be used. - */ - readonly methodOptions?: { [path: string]: MethodDeploymentOptions }; -} - -export interface StageProps extends StageOptions { - /** - * The deployment that this stage points to [disable-awslint:ref-via-interface]. - */ - readonly deployment: Deployment; -} - -export enum MethodLoggingLevel { - OFF = 'OFF', - ERROR = 'ERROR', - INFO = 'INFO' -} - -export interface MethodDeploymentOptions { - /** - * Specifies whether Amazon CloudWatch metrics are enabled for this method. - * - * @default false - */ - readonly metricsEnabled?: boolean; - - /** - * Specifies the logging level for this method, which effects the log - * entries pushed to Amazon CloudWatch Logs. - * - * @default - Off - */ - readonly loggingLevel?: MethodLoggingLevel; - - /** - * Specifies whether data trace logging is enabled for this method. - * When enabled, API gateway will log the full API requests and responses. - * This can be useful to troubleshoot APIs, but can result in logging sensitive data. - * We recommend that you don't enable this feature for production APIs. - * - * @default false - */ - readonly dataTraceEnabled?: boolean; - - /** - * Specifies the throttling burst limit. - * The total rate of all requests in your AWS account is limited to 5,000 requests. - * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html - * - * @default - No additional restriction. - */ - readonly throttlingBurstLimit?: number; - - /** - * Specifies the throttling rate limit. - * The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps). - * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html - * - * @default - No additional restriction. - */ - readonly throttlingRateLimit?: number; - - /** - * Specifies whether responses should be cached and returned for requests. A - * cache cluster must be enabled on the stage for responses to be cached. - * - * @default - Caching is Disabled. - */ - readonly cachingEnabled?: boolean; - - /** - * Specifies the time to live (TTL), in seconds, for cached responses. The - * higher the TTL, the longer the response will be cached. - * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html - * - * @default Duration.minutes(5) - */ - readonly cacheTtl?: Duration; - - /** - * Indicates whether the cached responses are encrypted. - * - * @default false - */ - readonly cacheDataEncrypted?: boolean; -} - -/** - * The attributes of an imported Stage - */ -export interface StageAttributes { - /** - * The name of the stage - */ - readonly stageName: string; - - /** - * The RestApi that the stage belongs to - */ - readonly restApi: IRestApi; -} - -/** - * Base class for an ApiGateway Stage - */ -export abstract class StageBase extends Resource implements IStage { - public abstract readonly stageName: string; - public abstract readonly restApi: IRestApi; - - /** - * Add an ApiKey to this stage - */ - public addApiKey(id: string, options?: ApiKeyOptions): IApiKey { - return new ApiKey(this, id, { - stages: [this], - ...options, - }); - } - - /** - * Returns the invoke URL for a certain path. - * @param path The resource path - */ - public urlForPath(path: string = '/') { - if (!path.startsWith('/')) { - throw new Error(`Path must begin with "/": ${path}`); - } - return `https://${this.restApi.restApiId}.execute-api.${Stack.of(this).region}.${Stack.of(this).urlSuffix}/${this.stageName}${path}`; - } - - /** - * Returns the resource ARN for this stage: - * - * arn:aws:apigateway:{region}::/restapis/{restApiId}/stages/{stageName} - * - * Note that this is separate from the execute-api ARN for methods and resources - * within this stage. - * - * @attribute - */ - public get stageArn() { - return Stack.of(this).formatArn({ - arnFormat: ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME, - service: 'apigateway', - account: '', - resource: 'restapis', - resourceName: `${this.restApi.restApiId}/stages/${this.stageName}`, - }); - } - - /** - * Returns the given named metric for this stage - */ - public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return new cloudwatch.Metric({ - namespace: 'AWS/ApiGateway', - metricName, - dimensionsMap: { ApiName: this.restApi.restApiName, Stage: this.stageName }, - ...props, - }).attachTo(this); - } - - /** - * Metric for the number of client-side errors captured in a given period. - * - * @default - sum over 5 minutes - */ - public metricClientError(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics._4XxErrorSum, props); - } - - /** - * Metric for the number of server-side errors captured in a given period. - * - * @default - sum over 5 minutes - */ - public metricServerError(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics._5XxErrorSum, props); - } - - /** - * Metric for the number of requests served from the API cache in a given period. - * - * @default - sum over 5 minutes - */ - public metricCacheHitCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics.cacheHitCountSum, props); - } - - /** - * Metric for the number of requests served from the backend in a given period, - * when API caching is enabled. - * - * @default - sum over 5 minutes - */ - public metricCacheMissCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics.cacheMissCountSum, props); - } - - /** - * Metric for the total number API requests in a given period. - * - * @default - sample count over 5 minutes - */ - public metricCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics.countSum, { - statistic: 'SampleCount', - ...props, - }); - } - - /** - * Metric for the time between when API Gateway relays a request to the backend - * and when it receives a response from the backend. - * - * @default - average over 5 minutes. - */ - public metricIntegrationLatency(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics.integrationLatencyAverage, props); - } - - /** - * The time between when API Gateway receives a request from a client - * and when it returns a response to the client. - * The latency includes the integration latency and other API Gateway overhead. - * - * @default - average over 5 minutes. - */ - public metricLatency(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ApiGatewayMetrics.latencyAverage, props); - } - - private cannedMetric(fn: (dims: { ApiName: string; Stage: string }) => cloudwatch.MetricProps, props?: cloudwatch.MetricOptions) { - return new cloudwatch.Metric({ - ...fn({ ApiName: this.restApi.restApiName, Stage: this.stageName }), - ...props, - }).attachTo(this); - } -} - -export class Stage extends StageBase { - /** - * Import a Stage by its attributes - */ - public static fromStageAttributes(scope: Construct, id: string, attrs: StageAttributes): IStage { - class Import extends StageBase { - public readonly stageName = attrs.stageName; - public readonly restApi = attrs.restApi; - } - return new Import(scope, id); - } - - public readonly stageName: string; - public readonly restApi: IRestApi; - - private enableCacheCluster?: boolean; - - constructor(scope: Construct, id: string, props: StageProps) { - super(scope, id); - - this.enableCacheCluster = props.cacheClusterEnabled; - - const methodSettings = this.renderMethodSettings(props); // this can mutate `this.cacheClusterEnabled` - - // custom access logging - let accessLogSetting: CfnStage.AccessLogSettingProperty | undefined; - const accessLogDestination = props.accessLogDestination; - const accessLogFormat = props.accessLogFormat; - if (!accessLogDestination && !accessLogFormat) { - accessLogSetting = undefined; - } else { - if (accessLogFormat !== undefined && - !Token.isUnresolved(accessLogFormat.toString()) && - !/.*\$context.(requestId|extendedRequestId)\b.*/.test(accessLogFormat.toString())) { - - throw new Error('Access log must include either `AccessLogFormat.contextRequestId()` or `AccessLogFormat.contextExtendedRequestId()`'); - } - if (accessLogFormat !== undefined && accessLogDestination === undefined) { - throw new Error('Access log format is specified without a destination'); - } - - accessLogSetting = { - destinationArn: accessLogDestination?.bind(this).destinationArn, - format: accessLogFormat?.toString() ? accessLogFormat?.toString() : AccessLogFormat.clf().toString(), - }; - } - - // enable cache cluster if cacheClusterSize is set - if (props.cacheClusterSize !== undefined) { - if (this.enableCacheCluster === undefined) { - this.enableCacheCluster = true; - } else if (this.enableCacheCluster === false) { - throw new Error(`Cannot set "cacheClusterSize" to ${props.cacheClusterSize} and "cacheClusterEnabled" to "false"`); - } - } - - const cacheClusterSize = this.enableCacheCluster ? (props.cacheClusterSize || '0.5') : undefined; - const resource = new CfnStage(this, 'Resource', { - stageName: props.stageName || 'prod', - accessLogSetting, - cacheClusterEnabled: this.enableCacheCluster, - cacheClusterSize, - clientCertificateId: props.clientCertificateId, - deploymentId: props.deployment.deploymentId, - restApiId: props.deployment.api.restApiId, - description: props.description, - documentationVersion: props.documentationVersion, - variables: props.variables, - tracingEnabled: props.tracingEnabled, - methodSettings, - }); - - this.stageName = resource.ref; - this.restApi = props.deployment.api; - - if (RestApiBase._isRestApiBase(this.restApi)) { - this.restApi._attachStage(this); - } - } - - - private renderMethodSettings(props: StageProps): CfnStage.MethodSettingProperty[] | undefined { - const settings = new Array(); - const self = this; - - // extract common method options from the stage props - const commonMethodOptions: MethodDeploymentOptions = { - metricsEnabled: props.metricsEnabled, - loggingLevel: props.loggingLevel, - dataTraceEnabled: props.dataTraceEnabled, - throttlingBurstLimit: props.throttlingBurstLimit, - throttlingRateLimit: props.throttlingRateLimit, - cachingEnabled: props.cachingEnabled, - cacheTtl: props.cacheTtl, - cacheDataEncrypted: props.cacheDataEncrypted, - }; - - // if any of them are defined, add an entry for '/*/*'. - const hasCommonOptions = Object.keys(commonMethodOptions).map(v => (commonMethodOptions as any)[v]).filter(x => x !== undefined).length > 0; - if (hasCommonOptions) { - settings.push(renderEntry('/*/*', commonMethodOptions)); - } - - if (props.methodOptions) { - for (const path of Object.keys(props.methodOptions)) { - settings.push(renderEntry(path, props.methodOptions[path])); - } - } - - return settings.length === 0 ? undefined : settings; - - function renderEntry(path: string, options: MethodDeploymentOptions): CfnStage.MethodSettingProperty { - if (options.cachingEnabled) { - if (self.enableCacheCluster === undefined) { - self.enableCacheCluster = true; - } else if (self.enableCacheCluster === false) { - throw new Error(`Cannot enable caching for method ${path} since cache cluster is disabled on stage`); - } - } - - const { httpMethod, resourcePath } = parseMethodOptionsPath(path); - - return { - httpMethod, - resourcePath, - cacheDataEncrypted: options.cacheDataEncrypted, - cacheTtlInSeconds: options.cacheTtl && options.cacheTtl.toSeconds(), - cachingEnabled: options.cachingEnabled, - dataTraceEnabled: options.dataTraceEnabled ?? false, - loggingLevel: options.loggingLevel, - metricsEnabled: options.metricsEnabled, - throttlingBurstLimit: options.throttlingBurstLimit, - throttlingRateLimit: options.throttlingRateLimit, - }; - } - } -} diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json deleted file mode 100644 index 0b642868750ad..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ /dev/null @@ -1,356 +0,0 @@ -{ - "name": "@aws-cdk/aws-apigateway", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ApiGateway", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.apigateway", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "apigateway" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.APIGateway", - "packageId": "Amazon.CDK.AWS.APIGateway", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-apigateway", - "module": "aws_cdk.aws_apigateway", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-apigateway" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ApiGateway", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "apigateway" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "nyc": { - "exclude": [ - "coverage/**", - "test/**", - "lib/*.generated.js", - "lib/apigatewayv2.js" - ] - }, - "pkglint": { - "exclude": [ - "no-experimental-dependencies" - ] - }, - "awslint": { - "exclude": [ - "from-method:@aws-cdk/aws-apigateway.Resource", - "duration-prop-type:@aws-cdk/aws-apigateway.QuotaSettings.period", - "duration-prop-type:@aws-cdk/aws-apigateway.ResponseType.INTEGRATION_TIMEOUT", - "ref-via-interface:@aws-cdk/aws-apigateway.ApiKeyProps.resources", - "props-physical-name:@aws-cdk/aws-apigateway.DeploymentProps", - "props-physical-name:@aws-cdk/aws-apigateway.MethodProps", - "props-physical-name:@aws-cdk/aws-apigateway.ProxyResourceProps", - "props-physical-name:@aws-cdk/aws-apigateway.ResourceProps", - "props-physical-name:@aws-cdk/aws-apigateway.UsagePlanProps", - "props-physical-name-type:@aws-cdk/aws-apigateway.StageProps.stageName", - "props-physical-name:@aws-cdk/aws-apigateway.BasePathMappingProps", - "props-physical-name:@aws-cdk/aws-apigateway.LambdaRestApiProps", - "props-physical-name:@aws-cdk/aws-apigateway.GatewayResponseProps", - "construct-interface-extends-iconstruct:@aws-cdk/aws-apigateway.IModel", - "resource-interface-extends-resource:@aws-cdk/aws-apigateway.IModel", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.definitions", - "docs-public-apis:@aws-cdk/aws-apigateway.Period.MONTH", - "docs-public-apis:@aws-cdk/aws-apigateway.Period.WEEK", - "docs-public-apis:@aws-cdk/aws-apigateway.Period.DAY", - "docs-public-apis:@aws-cdk/aws-apigateway.PassthroughBehavior", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodLoggingLevel.INFO", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodLoggingLevel.ERROR", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodLoggingLevel.OFF", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodLoggingLevel", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaVersion.DRAFT7", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaVersion", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.STRING", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.INTEGER", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.NUMBER", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.ARRAY", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.OBJECT", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.BOOLEAN", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType.NULL", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchemaType", - "docs-public-apis:@aws-cdk/aws-apigateway.IntegrationType", - "docs-public-apis:@aws-cdk/aws-apigateway.EndpointType", - "docs-public-apis:@aws-cdk/aws-apigateway.ContentHandling", - "docs-public-apis:@aws-cdk/aws-apigateway.ConnectionType", - "docs-public-apis:@aws-cdk/aws-apigateway.AuthorizationType", - "docs-public-apis:@aws-cdk/aws-apigateway.ApiKeySourceType", - "docs-public-apis:@aws-cdk/aws-apigateway.UsagePlanProps", - "docs-public-apis:@aws-cdk/aws-apigateway.UsagePlanPerApiStage.throttle", - "docs-public-apis:@aws-cdk/aws-apigateway.UsagePlanPerApiStage.api", - "docs-public-apis:@aws-cdk/aws-apigateway.StageProps", - "docs-public-apis:@aws-cdk/aws-apigateway.StageOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.RestApiProps", - "docs-public-apis:@aws-cdk/aws-apigateway.ResourceProps", - "docs-public-apis:@aws-cdk/aws-apigateway.ResourceOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.RequestValidatorProps", - "docs-public-apis:@aws-cdk/aws-apigateway.RequestValidatorOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.ProxyResourceProps", - "docs-public-apis:@aws-cdk/aws-apigateway.ProxyResourceOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.ModelProps", - "docs-public-apis:@aws-cdk/aws-apigateway.ModelOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodResponse", - "docs-public-apis:@aws-cdk/aws-apigateway.Cors", - "docs-public-apis:@aws-cdk/aws-apigateway.Deployment.api", - "docs-public-apis:@aws-cdk/aws-apigateway.Deployment.deploymentId", - "docs-public-apis:@aws-cdk/aws-apigateway.DomainName", - "docs-public-apis:@aws-cdk/aws-apigateway.Method", - "docs-public-apis:@aws-cdk/aws-apigateway.Method.httpMethod", - "docs-public-apis:@aws-cdk/aws-apigateway.Method.methodId", - "docs-public-apis:@aws-cdk/aws-apigateway.Method.resource", - "docs-public-apis:@aws-cdk/aws-apigateway.Model", - "docs-public-apis:@aws-cdk/aws-apigateway.Model.fromModelName", - "docs-public-apis:@aws-cdk/aws-apigateway.RequestValidator", - "docs-public-apis:@aws-cdk/aws-apigateway.RequestValidator.fromRequestValidatorId", - "docs-public-apis:@aws-cdk/aws-apigateway.Resource", - "docs-public-apis:@aws-cdk/aws-apigateway.ResourceBase", - "docs-public-apis:@aws-cdk/aws-apigateway.RestApi.arnForExecuteApi", - "docs-public-apis:@aws-cdk/aws-apigateway.Stage", - "docs-public-apis:@aws-cdk/aws-apigateway.Stage.restApi", - "docs-public-apis:@aws-cdk/aws-apigateway.Stage.stageName", - "docs-public-apis:@aws-cdk/aws-apigateway.UsagePlan", - "docs-public-apis:@aws-cdk/aws-apigateway.UsagePlan.usagePlanId", - "docs-public-apis:@aws-cdk/aws-apigateway.VpcLink.addTargets", - "docs-public-apis:@aws-cdk/aws-apigateway.AwsIntegrationProps", - "props-default-doc:@aws-cdk/aws-apigateway.AwsIntegrationProps.action", - "props-default-doc:@aws-cdk/aws-apigateway.AwsIntegrationProps.actionParameters", - "props-default-doc:@aws-cdk/aws-apigateway.AwsIntegrationProps.options", - "props-default-doc:@aws-cdk/aws-apigateway.AwsIntegrationProps.path", - "props-default-doc:@aws-cdk/aws-apigateway.AwsIntegrationProps.subdomain", - "docs-public-apis:@aws-cdk/aws-apigateway.BasePathMappingOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.BasePathMappingProps", - "docs-public-apis:@aws-cdk/aws-apigateway.CorsOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.DeploymentProps", - "docs-public-apis:@aws-cdk/aws-apigateway.DomainNameAttributes", - "docs-public-apis:@aws-cdk/aws-apigateway.DomainNameOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.DomainNameProps", - "docs-public-apis:@aws-cdk/aws-apigateway.HttpIntegrationProps", - "docs-public-apis:@aws-cdk/aws-apigateway.IDomainName", - "docs-public-apis:@aws-cdk/aws-apigateway.IModel", - "docs-public-apis:@aws-cdk/aws-apigateway.IRequestValidator", - "docs-public-apis:@aws-cdk/aws-apigateway.IResource", - "docs-public-apis:@aws-cdk/aws-apigateway.IRestApi", - "docs-public-apis:@aws-cdk/aws-apigateway.IntegrationOptions", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.cacheKeyParameters", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.cacheNamespace", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.integrationResponses", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.passthroughBehavior", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.requestParameters", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.requestTemplates", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationOptions.vpcLink", - "docs-public-apis:@aws-cdk/aws-apigateway.IntegrationProps", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationProps.integrationHttpMethod", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationProps.options", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationProps.uri", - "docs-public-apis:@aws-cdk/aws-apigateway.IntegrationResponse", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationResponse.responseParameters", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationResponse.responseTemplates", - "props-default-doc:@aws-cdk/aws-apigateway.IntegrationResponse.selectionPattern", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.additionalItems", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.additionalItems", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.additionalProperties", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.additionalProperties", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.allOf", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.allOf", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.anyOf", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.anyOf", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.contains", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.contains", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodProps", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.definitions", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.dependencies", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.dependencies", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.description", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.description", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.enum", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.enum", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.exclusiveMaximum", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.exclusiveMaximum", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.exclusiveMinimum", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.exclusiveMinimum", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.format", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.format", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.id", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.id", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.items", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.items", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.maximum", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.maximum", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.maxItems", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.maxItems", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.maxLength", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.maxLength", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.maxProperties", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.maxProperties", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.minimum", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.minimum", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.minItems", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.minItems", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.minLength", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.minLength", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.minProperties", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.minProperties", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.multipleOf", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.multipleOf", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.not", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.not", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.oneOf", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.oneOf", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.pattern", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.pattern", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.patternProperties", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.patternProperties", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.properties", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.properties", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.propertyNames", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.propertyNames", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.ref", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.ref", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.required", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.required", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.schema", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.schema", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.title", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.title", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.type", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.type", - "docs-public-apis:@aws-cdk/aws-apigateway.JsonSchema.uniqueItems", - "props-default-doc:@aws-cdk/aws-apigateway.JsonSchema.uniqueItems", - "docs-public-apis:@aws-cdk/aws-apigateway.LambdaIntegrationOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.LambdaRestApiProps", - "docs-public-apis:@aws-cdk/aws-apigateway.LambdaRestApiProps.options", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodDeploymentOptions", - "docs-public-apis:@aws-cdk/aws-apigateway.MethodOptions", - "props-default-doc:@aws-cdk/aws-apigateway.MethodOptions.authorizer", - "props-default-doc:@aws-cdk/aws-apigateway.MethodOptions.operationName", - "props-default-doc:@aws-cdk/aws-apigateway.MethodOptions.requestModels", - "props-default-doc:@aws-cdk/aws-apigateway.MethodOptions.requestValidator", - "docs-public-apis:@aws-cdk/aws-apigateway.ResourceBase.url", - "attribute-tag:@aws-cdk/aws-apigateway.LambdaAuthorizer.authorizerArn", - "attribute-tag:@aws-cdk/aws-apigateway.RequestAuthorizer.authorizerArn", - "attribute-tag:@aws-cdk/aws-apigateway.TokenAuthorizer.authorizerArn", - "attribute-tag:@aws-cdk/aws-apigateway.RestApi.restApiName", - "attribute-tag:@aws-cdk/aws-apigateway.SpecRestApi.restApiName", - "attribute-tag:@aws-cdk/aws-apigateway.LambdaRestApi.restApiName", - "from-method:@aws-cdk/aws-apigateway.Stage", - "resource-attribute:@aws-cdk/aws-apigateway.ApiKey.apiKeyId", - "resource-attribute:@aws-cdk/aws-apigateway.GatewayResponse.gatewayResponseId", - "resource-attribute:@aws-cdk/aws-apigateway.RateLimitedApiKey.apiKeyId" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-apigateway/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-apigateway/rosetta/default.ts-fixture deleted file mode 100644 index 18fa141d2787b..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/rosetta/default.ts-fixture +++ /dev/null @@ -1,19 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import apigateway = require('@aws-cdk/aws-apigateway'); -import cognito = require('@aws-cdk/aws-cognito'); -import lambda = require('@aws-cdk/aws-lambda'); -import iam = require('@aws-cdk/aws-iam'); -import s3 = require('@aws-cdk/aws-s3'); -import ec2 = require('@aws-cdk/aws-ec2'); -import logs = require('@aws-cdk/aws-logs'); -import stepfunctions = require('@aws-cdk/aws-stepfunctions'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-apigateway/rosetta/stepfunctions.ts-fixture b/packages/@aws-cdk/aws-apigateway/rosetta/stepfunctions.ts-fixture deleted file mode 100644 index eb7728585bcde..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/rosetta/stepfunctions.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import apigateway = require('@aws-cdk/aws-apigateway'); -import stepfunctions = require('@aws-cdk/aws-stepfunctions'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - const machine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', { - definition: new stepfunctions.Pass(this, 'PassState'), - stateMachineType: stepfunctions.StateMachineType.EXPRESS, - }); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito.test.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito.test.ts deleted file mode 100644 index 214384359016b..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/cognito.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cognito from '@aws-cdk/aws-cognito'; -import { Duration, Stack } from '@aws-cdk/core'; -import { AuthorizationType, CognitoUserPoolsAuthorizer, RestApi } from '../../lib'; - -describe('Cognito Authorizer', () => { - test('default cognito authorizer', () => { - // GIVEN - const stack = new Stack(); - const userPool = new cognito.UserPool(stack, 'UserPool'); - - // WHEN - const authorizer = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { - cognitoUserPools: [userPool], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer, - authorizationType: AuthorizationType.COGNITO, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'COGNITO_USER_POOLS', - RestApiId: stack.resolve(restApi.restApiId), - IdentitySource: 'method.request.header.Authorization', - ProviderARNs: [stack.resolve(userPool.userPoolArn)], - }); - - expect(authorizer.authorizerArn.endsWith(`/authorizers/${authorizer.authorizerId}`)).toBeTruthy(); - }); - - test('cognito authorizer with all parameters specified', () => { - // GIVEN - const stack = new Stack(); - const userPool1 = new cognito.UserPool(stack, 'UserPool1'); - const userPool2 = new cognito.UserPool(stack, 'UserPool2'); - - // WHEN - const authorizer = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { - cognitoUserPools: [userPool1, userPool2], - identitySource: 'method.request.header.whoami', - authorizerName: 'myauthorizer', - resultsCacheTtl: Duration.minutes(1), - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer, - authorizationType: AuthorizationType.COGNITO, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'COGNITO_USER_POOLS', - Name: 'myauthorizer', - RestApiId: stack.resolve(restApi.restApiId), - IdentitySource: 'method.request.header.whoami', - AuthorizerResultTtlInSeconds: 60, - ProviderARNs: [stack.resolve(userPool1.userPoolArn), stack.resolve(userPool2.userPoolArn)], - }); - - expect(authorizer.authorizerArn.endsWith(`/authorizers/${authorizer.authorizerId}`)).toBeTruthy(); - }); - - test('rest api depends on the authorizer when @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { - const stack = new Stack(); - stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); - const userPool1 = new cognito.UserPool(stack, 'UserPool'); - - const authorizer = new CognitoUserPoolsAuthorizer(stack, 'Authorizer', { - cognitoUserPools: [userPool1], - }); - - const restApi = new RestApi(stack, 'Api'); - - restApi.root.addMethod('ANY', undefined, { - authorizer, - authorizationType: AuthorizationType.COGNITO, - }); - - const template = Template.fromStack(stack); - - const authorizerId = Object.keys(template.findResources('AWS::ApiGateway::Authorizer'))[0]; - const deployment = Object.values(template.findResources('AWS::ApiGateway::Deployment'))[0]; - - expect(deployment.DependsOn).toEqual(expect.arrayContaining([authorizerId])); - }); - - test('a new deployment is created when a cognito user pool is re-created and @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { - const createApiTemplate = (userPoolId: string) => { - const stack = new Stack(); - stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); - - const userPool = new cognito.UserPool(stack, userPoolId); - - const auth = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { - resultsCacheTtl: Duration.seconds(0), - cognitoUserPools: [userPool], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.COGNITO, - }); - - return Template.fromStack(stack); - }; - - const oldTemplate = createApiTemplate('foo'); - const newTemplate = createApiTemplate('bar'); - - const oldDeploymentId = Object.keys(oldTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; - const newDeploymentId = Object.keys(newTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; - - expect(oldDeploymentId).not.toEqual(newDeploymentId); - }); -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts deleted file mode 100644 index 8d629a76aa98f..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts +++ /dev/null @@ -1,60 +0,0 @@ -import * as path from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; -import { MockIntegration, PassthroughBehavior, RestApi, RequestAuthorizer, IdentitySource } from '../../lib'; - -// Against the RestApi endpoint from the stack output, run -// `curl -s -o /dev/null -w "%{http_code}" ` should return 401 -// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' ?allow=yes` should return 403 -// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' ?allow=yes` should return 200 - -const app = new App(); -const stack = new Stack(app, 'RequestAuthorizerInteg'); - -const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')), -}); - -const restapi = new RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); - -const authorizer = new RequestAuthorizer(stack, 'MyAuthorizer', { - handler: authorizerFn, - identitySources: [IdentitySource.header('Authorization'), IdentitySource.queryString('allow')], -}); - -const secondAuthorizer = new RequestAuthorizer(stack, 'MySecondAuthorizer', { - handler: authorizerFn, - identitySources: [IdentitySource.header('Authorization'), IdentitySource.queryString('allow')], -}); - -restapi.root.addMethod('ANY', new MockIntegration({ - integrationResponses: [ - { statusCode: '200' }, - ], - passthroughBehavior: PassthroughBehavior.NEVER, - requestTemplates: { - 'application/json': '{ "statusCode": 200 }', - }, -}), { - methodResponses: [ - { statusCode: '200' }, - ], - authorizer, -}); - -restapi.root.resourceForPath('auth').addMethod('ANY', new MockIntegration({ - integrationResponses: [ - { statusCode: '200' }, - ], - passthroughBehavior: PassthroughBehavior.NEVER, - requestTemplates: { - 'application/json': '{ "statusCode": 200 }', - }, -}), { - methodResponses: [ - { statusCode: '200' }, - ], - authorizer: secondAuthorizer, -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.d.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.d.ts deleted file mode 100644 index 8795919cf34fc..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const handler: (event: any, _context?: any) => Promise; diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.js b/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.js deleted file mode 100644 index 01fc876058482..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/asset.fec8e8354e12687c5a4b843b4e269741f53dec634946869b276f7fd1017845c3.handler/index.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -const handler = async (event, _context = {}) => { - const authToken = event.authorizationToken; - console.log(`event.authorizationToken = ${authToken}`); - if (authToken === 'allow' || authToken === 'deny') { - return { - principalId: 'user', - policyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: 'execute-api:Invoke', - Effect: authToken, - Resource: event.methodArn, - }, - ], - }, - }; - } - else { - throw new Error('Unauthorized'); - } -}; -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3V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G9rZW4gPSAke2F1dGhUb2tlbn1gKTtcbiAgaWYgKGF1dGhUb2tlbiA9PT0gJ2FsbG93JyB8fCBhdXRoVG9rZW4gPT09ICdkZW55Jykge1xuICAgIHJldHVybiB7XG4gICAgICBwcmluY2lwYWxJZDogJ3VzZXInLFxuICAgICAgcG9saWN5RG9jdW1lbnQ6IHtcbiAgICAgICAgVmVyc2lvbjogJzIwMTItMTAtMTcnLFxuICAgICAgICBTdGF0ZW1lbnQ6IFtcbiAgICAgICAgICB7XG4gICAgICAgICAgICBBY3Rpb246ICdleGVjdXRlLWFwaTpJbnZva2UnLFxuICAgICAgICAgICAgRWZmZWN0OiBhdXRoVG9rZW4sXG4gICAgICAgICAgICBSZXNvdXJjZTogZXZlbnQubWV0aG9kQXJuLFxuICAgICAgICAgIH0sXG4gICAgICAgIF0sXG4gICAgICB9LFxuICAgIH07XG4gIH0gZWxzZSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKCdVbmF1dGhvcml6ZWQnKTtcbiAgfVxufTtcbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/lambda.test.ts b/packages/@aws-cdk/aws-apigateway/test/authorizers/lambda.test.ts deleted file mode 100644 index cef396426d377..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/authorizers/lambda.test.ts +++ /dev/null @@ -1,652 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, Stack } from '@aws-cdk/core'; -import { AuthorizationType, IdentitySource, RequestAuthorizer, RestApi, TokenAuthorizer } from '../../lib'; - -describe('lambda authorizer', () => { - test('default token authorizer', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const auth = new TokenAuthorizer(stack, 'myauthorizer', { - handler: func, - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'TOKEN', - RestApiId: stack.resolve(restApi.restApiId), - IdentitySource: 'method.request.header.Authorization', - AuthorizerUri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':apigateway:', - { - 'Fn::Select': [ - 3, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - '/invocations', - ], - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - Principal: 'apigateway.amazonaws.com', - }); - - expect(auth.authorizerArn.endsWith(`/authorizers/${auth.authorizerId}`)).toBeTruthy(); - }); - - test('default request authorizer', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - resultsCacheTtl: Duration.seconds(0), - identitySources: [], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'REQUEST', - RestApiId: stack.resolve(restApi.restApiId), - AuthorizerUri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':apigateway:', - { - 'Fn::Select': [ - 3, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - '/invocations', - ], - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - Principal: 'apigateway.amazonaws.com', - }); - - expect(auth.authorizerArn.endsWith(`/authorizers/${auth.authorizerId}`)).toBeTruthy(); - - - }); - - test('invalid request authorizer config', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - expect(() => new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - resultsCacheTtl: Duration.seconds(1), - identitySources: [], - })).toThrow('At least one Identity Source is required for a REQUEST-based Lambda authorizer if caching is enabled.'); - }); - - test('token authorizer with all parameters specified', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const auth = new TokenAuthorizer(stack, 'myauthorizer', { - handler: func, - identitySource: 'method.request.header.whoami', - validationRegex: 'a-hacker', - authorizerName: 'myauthorizer', - resultsCacheTtl: Duration.minutes(1), - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'TOKEN', - RestApiId: stack.resolve(restApi.restApiId), - IdentitySource: 'method.request.header.whoami', - IdentityValidationExpression: 'a-hacker', - Name: 'myauthorizer', - AuthorizerResultTtlInSeconds: 60, - AuthorizerUri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':apigateway:', - { - 'Fn::Select': [ - 3, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - '/invocations', - ], - ], - }, - }); - }); - - test('request authorizer with all parameters specified', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - identitySources: [IdentitySource.header('whoami')], - authorizerName: 'myauthorizer', - resultsCacheTtl: Duration.minutes(1), - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'REQUEST', - RestApiId: stack.resolve(restApi.restApiId), - IdentitySource: 'method.request.header.whoami', - Name: 'myauthorizer', - AuthorizerResultTtlInSeconds: 60, - AuthorizerUri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':apigateway:', - { - 'Fn::Select': [ - 3, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - '/invocations', - ], - ], - }, - }); - }); - - test('token authorizer with assume role', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const role = new iam.Role(stack, 'authorizerassumerole', { - assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), - roleName: 'authorizerassumerole', - }); - - const auth = new TokenAuthorizer(stack, 'myauthorizer', { - handler: func, - assumeRole: role, - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'TOKEN', - RestApiId: stack.resolve(restApi.restApiId), - AuthorizerUri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':apigateway:', - { - 'Fn::Select': [ - 3, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - '/invocations', - ], - ], - }, - }); - - Template.fromStack(stack).hasResource('AWS::IAM::Role', Match.anyValue()); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - Roles: [ - stack.resolve(role.roleName), - ], - PolicyDocument: { - Statement: [ - { - Resource: stack.resolve(func.resourceArnsForGrantInvoke), - Action: 'lambda:InvokeFunction', - Effect: 'Allow', - }, - ], - }, - }); - - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); - }); - - test('request authorizer with assume role', () => { - const stack = new Stack(); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const role = new iam.Role(stack, 'authorizerassumerole', { - assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), - roleName: 'authorizerassumerole', - }); - - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - assumeRole: role, - resultsCacheTtl: Duration.seconds(0), - identitySources: [], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { - Type: 'REQUEST', - RestApiId: stack.resolve(restApi.restApiId), - AuthorizerUri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':apigateway:', - { - 'Fn::Select': [ - 3, - { - 'Fn::Split': [ - ':', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - ], - }, - ], - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], - }, - '/invocations', - ], - ], - }, - }); - - Template.fromStack(stack).hasResource('AWS::IAM::Role', Match.anyValue()); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - Roles: [ - stack.resolve(role.roleName), - ], - PolicyDocument: { - Statement: [ - { - Resource: stack.resolve(func.resourceArnsForGrantInvoke), - Action: 'lambda:InvokeFunction', - Effect: 'Allow', - }, - ], - }, - }); - - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); - }); - - test('token authorizer throws when not attached to a rest api', () => { - const stack = new Stack(); - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - const auth = new TokenAuthorizer(stack, 'myauthorizer', { - handler: func, - }); - - expect(() => stack.resolve(auth.authorizerArn)).toThrow(/must be attached to a RestApi/); - }); - - test('request authorizer throws when not attached to a rest api', () => { - const stack = new Stack(); - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - identitySources: [IdentitySource.header('myheader')], - }); - - expect(() => stack.resolve(auth.authorizerArn)).toThrow(/must be attached to a RestApi/); - }); - - test('rest api depends on the token authorizer when @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { - const stack = new Stack(); - stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_18_X, - }); - - const auth = new TokenAuthorizer(stack, 'myauthorizer', { - handler: func, - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - const template = Template.fromStack(stack); - - const authorizerId = Object.keys(template.findResources('AWS::ApiGateway::Authorizer'))[0]; - const deployment = Object.values(template.findResources('AWS::ApiGateway::Deployment'))[0]; - - expect(deployment.DependsOn).toEqual(expect.arrayContaining([authorizerId])); - }); - - test('rest api depends on the request authorizer when @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { - const stack = new Stack(); - stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - resultsCacheTtl: Duration.seconds(0), - identitySources: [], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - const template = Template.fromStack(stack); - - const authorizerId = Object.keys(template.findResources('AWS::ApiGateway::Authorizer'))[0]; - const deployment = Object.values(template.findResources('AWS::ApiGateway::Deployment'))[0]; - - expect(deployment.DependsOn).toEqual(expect.arrayContaining([authorizerId])); - }); - - test('a new deployment is created when a lambda function changes name and @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { - const createApiTemplate = (lambdaFunctionName: string) => { - const stack = new Stack(); - stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); - - const func = new lambda.Function(stack, 'myfunction', { - handler: 'handler', - functionName: lambdaFunctionName, - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_18_X, - }); - - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - resultsCacheTtl: Duration.seconds(0), - identitySources: [], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - return Template.fromStack(stack); - }; - - const oldTemplate = createApiTemplate('foo'); - const newTemplate = createApiTemplate('bar'); - - const oldDeploymentId = Object.keys(oldTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; - const newDeploymentId = Object.keys(newTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; - - expect(oldDeploymentId).not.toEqual(newDeploymentId); - }); - - test('a new deployment is created when an imported lambda function changes name and @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { - const createApiTemplate = (lambdaFunctionName: string) => { - const stack = new Stack(); - stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); - - const func = lambda.Function.fromFunctionName(stack, 'myfunction', lambdaFunctionName); - - const auth = new RequestAuthorizer(stack, 'myauthorizer', { - handler: func, - resultsCacheTtl: Duration.seconds(0), - identitySources: [], - }); - - const restApi = new RestApi(stack, 'myrestapi'); - restApi.root.addMethod('ANY', undefined, { - authorizer: auth, - authorizationType: AuthorizationType.CUSTOM, - }); - - return Template.fromStack(stack); - }; - - const oldTemplate = createApiTemplate('foo'); - const newTemplate = createApiTemplate('bar'); - - const oldDeploymentId = Object.keys(oldTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; - const newDeploymentId = Object.keys(newTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; - - expect(oldDeploymentId).not.toEqual(newDeploymentId); - }); -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/cors.test.ts b/packages/@aws-cdk/aws-apigateway/test/cors.test.ts deleted file mode 100644 index 0712a76bb2471..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/cors.test.ts +++ /dev/null @@ -1,683 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as apigw from '../lib'; - -describe('cors', () => { - test('adds an OPTIONS method to a resource', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://amazon.com'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('allowCredentials', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://amazon.com'], - allowCredentials: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - 'method.response.header.Access-Control-Allow-Credentials': "'true'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - 'method.response.header.Access-Control-Allow-Credentials': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('allowMethods', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://aws.amazon.com'], - allowMethods: ['GET', 'PUT'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://aws.amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'GET,PUT'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('allowMethods ANY will expand to all supported methods', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://aws.amazon.com'], - allowMethods: ['ANY'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://aws.amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('allowMethods ANY cannot be used with any other method', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // THEN - expect(() => resource.addCorsPreflight({ - allowOrigins: ['https://aws.amazon.com'], - allowMethods: ['ANY', 'PUT'], - })).toThrow(/ANY cannot be used with any other method. Received: ANY,PUT/); - }); - - test('statusCode can be used to set the response status code', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://aws.amazon.com'], - statusCode: 200, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://aws.amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - }, - StatusCode: '200', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - }, - StatusCode: '200', - }, - ], - }); - }); - - test('allowOrigins must contain at least one origin', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - expect(() => resource.addCorsPreflight({ - allowOrigins: [], - })).toThrow(/allowOrigins must contain at least one origin/); - }); - - test('allowOrigins can be used to specify multiple origins', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://twitch.tv', 'https://amazon.com', 'https://aws.amazon.com'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://twitch.tv'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - }, - ResponseTemplates: { - 'application/json': '#set($origin = $input.params().header.get("Origin"))\n#if($origin == "") #set($origin = $input.params().header.get("origin")) #end\n#if($origin.matches("https://amazon.com") || $origin.matches("https://aws.amazon.com"))\n #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)\n#end', - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('maxAge can be used to specify Access-Control-Max-Age', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://amazon.com'], - maxAge: Duration.minutes(60), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - 'method.response.header.Access-Control-Max-Age': `'${60 * 60}'`, - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - 'method.response.header.Access-Control-Max-Age': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('disableCache will set Max-Age to -1', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://amazon.com'], - disableCache: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - 'method.response.header.Access-Control-Max-Age': '\'-1\'', - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - 'method.response.header.Access-Control-Max-Age': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('maxAge and disableCache are mutually exclusive', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // THEN - expect(() => resource.addCorsPreflight({ - allowOrigins: ['https://amazon.com'], - disableCache: true, - maxAge: Duration.seconds(10), - })).toThrow(/The options "maxAge" and "disableCache" are mutually exclusive/); - }); - - test('exposeHeaders can be used to specify Access-Control-Expose-Headers', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const resource = api.root.addResource('MyResource'); - - // WHEN - resource.addCorsPreflight({ - allowOrigins: ['https://amazon.com'], - exposeHeaders: ['Authorization', 'Foo'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", - 'method.response.header.Vary': "'Origin'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - 'method.response.header.Access-Control-Expose-Headers': "'Authorization,Foo'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Vary': true, - 'method.response.header.Access-Control-Allow-Methods': true, - 'method.response.header.Access-Control-Expose-Headers': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('defaultCorsPreflightOptions can be used to specify CORS for all resource tree', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - - // WHEN - const resource = api.root.addResource('MyResource', { - defaultCorsPreflightOptions: { - allowOrigins: ['https://amazon.com'], - }, - }); - resource.addResource('MyChildResource'); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 2); // on both resources - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceD5CDB490' }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apiMyResourceMyChildResource2DC010C5' }, - }); - }); - - test('defaultCorsPreflightOptions can be specified at the API level to apply to all resources', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const api = new apigw.RestApi(stack, 'api', { - defaultCorsPreflightOptions: { - allowOrigins: ['https://amazon.com'], - }, - }); - - const child1 = api.root.addResource('child1'); - child1.addResource('child2'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { 'Fn::GetAtt': ['apiC8550315', 'RootResourceId'] }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apichild1841A5840' }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { Ref: 'apichild1child26A9A7C47' }, - }); - }); - - test('Vary: Origin is sent back if Allow-Origin is not "*"', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - - // WHEN - api.root.addResource('AllowAll', { - defaultCorsPreflightOptions: { - allowOrigins: apigw.Cors.ALL_ORIGINS, - }, - }); - - api.root.addResource('AllowSpecific', { - defaultCorsPreflightOptions: { - allowOrigins: ['http://specific.com'], - }, - }); - - // THENB - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - ResourceId: { - Ref: 'apiAllowAll2F5BC564', - }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'*'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Access-Control-Allow-Methods': true, - }, - StatusCode: '204', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - ResourceId: { - Ref: 'apiAllowSpecific77DD8AF1', - }, - Integration: { - IntegrationResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", - 'method.response.header.Access-Control-Allow-Origin': "'http://specific.com'", - 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", - 'method.response.header.Vary': "'Origin'", - }, - StatusCode: '204', - }, - ], - RequestTemplates: { - 'application/json': '{ statusCode: 200 }', - }, - Type: 'MOCK', - }, - MethodResponses: [ - { - ResponseParameters: { - 'method.response.header.Access-Control-Allow-Headers': true, - 'method.response.header.Access-Control-Allow-Origin': true, - 'method.response.header.Access-Control-Allow-Methods': true, - 'method.response.header.Vary': true, - }, - StatusCode: '204', - }, - ], - }); - }); - - test('If "*" is specified in allow-origin, it cannot be mixed with specific origins', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - - // WHEN - expect(() => api.root.addResource('AllowAll', { - defaultCorsPreflightOptions: { - allowOrigins: ['https://bla.com', '*', 'https://specific'], - }, - })).toThrow(/Invalid "allowOrigins" - cannot mix "\*" with specific origins: https:\/\/bla\.com,\*,https:\/\/specific/); - }); - - test('defaultCorsPreflightOptions can be used to specify CORS for all resource tree [LambdaRestApi]', () => { - // GIVEN - const stack = new Stack(); - - const handler = new lambda.Function(stack, 'handler', { - handler: 'index.handler', - code: lambda.Code.fromInline('boom'), - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - new apigw.LambdaRestApi(stack, 'lambda-rest-api', { - handler, - defaultCorsPreflightOptions: { - allowOrigins: ['https://amazon.com'], - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 4); // two ANY and two OPTIONS resources - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { - 'Fn::GetAtt': [ - 'lambdarestapiAAD10924', - 'RootResourceId', - ], - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - ResourceId: { - Ref: 'lambdarestapiproxyE3AE07E3', - }, - }); - }); - - test('CORS and proxy resources', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const api = new apigw.RestApi(stack, 'API', { - defaultCorsPreflightOptions: { allowOrigins: ['*'] }, - }); - - api.root.addProxy(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'OPTIONS', - }); - }); -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.ts b/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.ts deleted file mode 100644 index 41017a976de4b..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/integ.cloudwatch-disabled.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; - -export class Test extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - const api = new apigateway.RestApi(this, 'my-api', { - retainDeployments: true, - }); - api.root.addMethod('GET'); // must have at least one method or an API definition - } -} - -const app = new cdk.App(); -new IntegTest(app, 'cloudwatch-logs-disabled', { - testCases: [ - new Test(app, 'default-api'), - ], -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts b/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts deleted file mode 100644 index 4462535b60d3a..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/integ.lambda-api.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { App, Duration, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Construct } from 'constructs'; -import { LambdaRestApi } from '../lib'; - -class LambdaApiIntegrationOptionsStack extends Stack { - constructor(scope: Construct) { - super(scope, 'LambdaApiIntegrationOptionsStack'); - - const fn = new Function(this, 'myfn', { - code: Code.fromInline('foo'), - runtime: Runtime.NODEJS_14_X, - handler: 'index.handler', - }); - - new LambdaRestApi(this, 'lambdarestapi', { - handler: fn, - cloudWatchRole: true, - integrationOptions: { - timeout: Duration.seconds(1), - }, - }); - } -} - -const app = new App(); -const testCase = new LambdaApiIntegrationOptionsStack(app); -new IntegTest(app, 'lambda-integration', { - testCases: [testCase], -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts deleted file mode 100644 index 4552292571e8c..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi-import.lit.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { App, CfnOutput, NestedStack, NestedStackProps, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage } from '../lib'; - -/** - * This file showcases how to split up a RestApi's Resources and Methods across nested stacks. - * - * The root stack 'RootStack' first defines a RestApi. - * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'. - * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack. - * - * To verify this worked, go to the APIGateway - */ - -class RootStack extends Stack { - constructor(scope: Construct) { - super(scope, 'integ-restapi-import-RootStack'); - - const restApi = new RestApi(this, 'RestApi', { - cloudWatchRole: true, - deploy: false, - }); - restApi.root.addMethod('ANY'); - - const petsStack = new PetsStack(this, { - restApiId: restApi.restApiId, - rootResourceId: restApi.restApiRootResourceId, - }); - const booksStack = new BooksStack(this, { - restApiId: restApi.restApiId, - rootResourceId: restApi.restApiRootResourceId, - }); - new DeployStack(this, { - restApiId: restApi.restApiId, - methods: petsStack.methods.concat(booksStack.methods), - }); - - new CfnOutput(this, 'PetsURL', { - value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/pets`, - }); - - new CfnOutput(this, 'BooksURL', { - value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/books`, - }); - } -} - -interface ResourceNestedStackProps extends NestedStackProps { - readonly restApiId: string; - - readonly rootResourceId: string; -} - -class PetsStack extends NestedStack { - public readonly methods: Method[] = []; - - constructor(scope: Construct, props: ResourceNestedStackProps) { - super(scope, 'integ-restapi-import-PetsStack', props); - - const api = RestApi.fromRestApiAttributes(this, 'RestApi', { - restApiId: props.restApiId, - rootResourceId: props.rootResourceId, - }); - - const method = api.root.addResource('pets').addMethod('GET', new MockIntegration({ - integrationResponses: [{ - statusCode: '200', - }], - passthroughBehavior: PassthroughBehavior.NEVER, - requestTemplates: { - 'application/json': '{ "statusCode": 200 }', - }, - }), { - methodResponses: [{ statusCode: '200' }], - }); - - this.methods.push(method); - } -} - -class BooksStack extends NestedStack { - public readonly methods: Method[] = []; - - constructor(scope: Construct, props: ResourceNestedStackProps) { - super(scope, 'integ-restapi-import-BooksStack', props); - - const api = RestApi.fromRestApiAttributes(this, 'RestApi', { - restApiId: props.restApiId, - rootResourceId: props.rootResourceId, - }); - - const method = api.root.addResource('books').addMethod('GET', new MockIntegration({ - integrationResponses: [{ - statusCode: '200', - }], - passthroughBehavior: PassthroughBehavior.NEVER, - requestTemplates: { - 'application/json': '{ "statusCode": 200 }', - }, - }), { - methodResponses: [{ statusCode: '200' }], - }); - - this.methods.push(method); - } -} - -interface DeployStackProps extends NestedStackProps { - readonly restApiId: string; - - readonly methods?: Method[]; -} - -class DeployStack extends NestedStack { - constructor(scope: Construct, props: DeployStackProps) { - super(scope, 'integ-restapi-import-DeployStack', props); - - const deployment = new Deployment(this, 'Deployment', { - api: RestApi.fromRestApiId(this, 'RestApi', props.restApiId), - }); - if (props.methods) { - for (const method of props.methods) { - deployment.node.addDependency(method); - } - } - new Stage(this, 'Stage', { deployment }); - } -} - -new RootStack(new App()); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts b/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts deleted file mode 100644 index 102818881d324..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/integ.restapi.defaults.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as apigateway from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'test-apigateway-restapi-defaults'); - -const api = new apigateway.RestApi(stack, 'my-api', { cloudWatchRole: true }); - -// at least one method is required -api.root.addMethod('GET'); - -new IntegTest(app, 'apigateway-restapi-defaults', { - testCases: [stack], -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integrations/lambda.test.ts b/packages/@aws-cdk/aws-apigateway/test/integrations/lambda.test.ts deleted file mode 100644 index 7d2221c0ddb92..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/integrations/lambda.test.ts +++ /dev/null @@ -1,300 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as apigateway from '../../lib'; - -describe('lambda', () => { - test('minimal setup', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'my-api'); - const handler = new lambda.Function(stack, 'Handler', { - runtime: lambda.Runtime.PYTHON_3_9, - handler: 'boom', - code: lambda.Code.fromInline('foo'), - }); - - // WHEN - const integ = new apigateway.LambdaIntegration(handler); - api.root.addMethod('GET', integ); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - Integration: { - IntegrationHttpMethod: 'POST', - Type: 'AWS_PROXY', - Uri: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':apigateway:', - { - Ref: 'AWS::Region', - }, - ':lambda:path/2015-03-31/functions/', - { - 'Fn::GetAtt': [ - 'Handler886CB40B', - 'Arn', - ], - }, - '/invocations', - ], - ], - }, - }, - }); - }); - - test('"allowTestInvoke" can be used to disallow calling the API from the test UI', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Handler', { - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - handler: 'index.handler', - }); - - const api = new apigateway.RestApi(stack, 'api'); - - // WHEN - const integ = new apigateway.LambdaIntegration(fn, { allowTestInvoke: false }); - api.root.addMethod('GET', integ); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - SourceArn: { - 'Fn::Join': [ - '', - [ - 'arn:', { Ref: 'AWS::Partition' }, ':execute-api:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':', - { Ref: 'apiC8550315' }, '/', { Ref: 'apiDeploymentStageprod896C8101' }, '/GET/', - ], - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', Match.not({ - SourceArn: { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':execute-api:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'apiC8550315' }, - '/test-invoke-stage/GET/', - ], - ], - }, - })); - }); - - test('"allowTestInvoke" set to true allows calling the API from the test UI', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Handler', { - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - handler: 'index.handler', - }); - - const api = new apigateway.RestApi(stack, 'api'); - - // WHEN - const integ = new apigateway.LambdaIntegration(fn, { allowTestInvoke: true }); - api.root.addMethod('GET', integ); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - SourceArn: { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':execute-api:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'apiC8550315' }, - '/test-invoke-stage/GET/', - ], - ], - }, - }); - }); - - test('"proxy" can be used to disable proxy mode', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Handler', { - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - handler: 'index.handler', - }); - - const api = new apigateway.RestApi(stack, 'api'); - - // WHEN - const integ = new apigateway.LambdaIntegration(fn, { proxy: false }); - api.root.addMethod('GET', integ); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - Integration: { - Type: 'AWS', - }, - }); - }); - - test('when "ANY" is used, lambda permission will include "*" for method', () => { - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api'); - - const handler = new lambda.Function(stack, 'MyFunc', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('loo'), - }); - - const target = new apigateway.LambdaIntegration(handler); - - api.root.addMethod('ANY', target); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - SourceArn: { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':execute-api:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'testapiD6451F70' }, - '/test-invoke-stage/*/', - ], - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - SourceArn: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':execute-api:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':', - { - Ref: 'testapiD6451F70', - }, - '/', - { Ref: 'testapiDeploymentStageprod5C9E92A4' }, - '/*/', - ], - ], - }, - }); - }); - - test('works for imported RestApi', () => { - const stack = new cdk.Stack(); - const api = apigateway.RestApi.fromRestApiAttributes(stack, 'RestApi', { - restApiId: 'imported-rest-api-id', - rootResourceId: 'imported-root-resource-id', - }); - - const handler = new lambda.Function(stack, 'MyFunc', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('loo'), - }); - - api.root.addMethod('ANY', new apigateway.LambdaIntegration(handler)); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - RestApiId: 'imported-rest-api-id', - ResourceId: 'imported-root-resource-id', - HttpMethod: 'ANY', - }); - }); - - test('fingerprint is computed when functionName is specified', () => { - // GIVEN - const stack = new cdk.Stack(); - const restapi = new apigateway.RestApi(stack, 'RestApi'); - const method = restapi.root.addMethod('ANY'); - const handler = new lambda.Function(stack, 'MyFunc', { - functionName: 'ThisFunction', - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('loo'), - }); - const integration = new apigateway.LambdaIntegration(handler); - - // WHEN - const bindResult = integration.bind(method); - - // THEN - expect(bindResult?.deploymentToken).toBeDefined(); - expect(bindResult!.deploymentToken).toEqual('{"functionName":"ThisFunction"}'); - }); - - test('fingerprint is not computed when functionName is not specified', () => { - // GIVEN - const stack = new cdk.Stack(); - const restapi = new apigateway.RestApi(stack, 'RestApi'); - const method = restapi.root.addMethod('ANY'); - const handler = new lambda.Function(stack, 'MyFunc', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('loo'), - }); - const integration = new apigateway.LambdaIntegration(handler); - - // WHEN - const bindResult = integration.bind(method); - - // THEN - expect(bindResult?.deploymentToken).toBeUndefined(); - }); - - test('bind works for integration with imported functions', () => { - // GIVEN - const stack = new cdk.Stack(); - const restapi = new apigateway.RestApi(stack, 'RestApi'); - const method = restapi.root.addMethod('ANY'); - const handler = lambda.Function.fromFunctionArn(stack, 'MyFunc', 'arn:aws:lambda:region:account:function:myfunc'); - const integration = new apigateway.LambdaIntegration(handler); - - // WHEN - const bindResult = integration.bind(method); - - // the deployment token should be defined since the function name - // should be a literal string. - expect(bindResult?.deploymentToken).toEqual(JSON.stringify({ functionName: 'myfunc' })); - }); -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/resource.test.ts b/packages/@aws-cdk/aws-apigateway/test/resource.test.ts deleted file mode 100644 index 6c4bc92a50d28..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/resource.test.ts +++ /dev/null @@ -1,427 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; -import * as apigw from '../lib'; - -/* eslint-disable quote-props */ - -describe('resource', () => { - test('ProxyResource defines a "{proxy+}" resource with ANY method', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - - // WHEN - new apigw.ProxyResource(stack, 'proxy', { - parent: api.root, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Resource', { - 'ParentId': { - 'Fn::GetAtt': [ - 'apiC8550315', - 'RootResourceId', - ], - }, - 'PathPart': '{proxy+}', - 'RestApiId': { - 'Ref': 'apiC8550315', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - 'HttpMethod': 'ANY', - 'ResourceId': { - 'Ref': 'proxy3A1DA9C7', - }, - 'RestApiId': { - 'Ref': 'apiC8550315', - }, - 'AuthorizationType': 'NONE', - 'Integration': { - 'Type': 'MOCK', - }, - }); - - - }); - - test('if "anyMethod" is false, then an ANY method will not be defined', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - - // WHEN - const proxy = new apigw.ProxyResource(stack, 'proxy', { - parent: api.root, - anyMethod: false, - }); - - proxy.addMethod('GET'); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Resource', 1); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { 'HttpMethod': 'GET' }); - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', Match.not({ 'HttpMethod': 'ANY' })); - - - }); - - test('addProxy can be used on any resource to attach a proxy from that route', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api', { - deploy: false, - cloudWatchRole: false, - }); - - const v2 = api.root.addResource('v2'); - v2.addProxy(); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'apiC8550315': { - 'Type': 'AWS::ApiGateway::RestApi', - 'Properties': { - 'Name': 'api', - }, - }, - 'apiv25206B108': { - 'Type': 'AWS::ApiGateway::Resource', - 'Properties': { - 'ParentId': { - 'Fn::GetAtt': [ - 'apiC8550315', - 'RootResourceId', - ], - }, - 'PathPart': 'v2', - 'RestApiId': { - 'Ref': 'apiC8550315', - }, - }, - }, - 'apiv2proxyAEA4DAC8': { - 'Type': 'AWS::ApiGateway::Resource', - 'Properties': { - 'ParentId': { - 'Ref': 'apiv25206B108', - }, - 'PathPart': '{proxy+}', - 'RestApiId': { - 'Ref': 'apiC8550315', - }, - }, - }, - 'apiv2proxyANY889F4CE1': { - 'Type': 'AWS::ApiGateway::Method', - 'Properties': { - 'HttpMethod': 'ANY', - 'ResourceId': { - 'Ref': 'apiv2proxyAEA4DAC8', - }, - 'RestApiId': { - 'Ref': 'apiC8550315', - }, - 'AuthorizationType': 'NONE', - 'Integration': { - 'Type': 'MOCK', - }, - }, - }, - }, - }); - - - }); - - test('if proxy is added to root, proxy methods are automatically duplicated (with integration and options)', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - const proxy = api.root.addProxy({ - anyMethod: false, - }); - const deleteInteg = new apigw.MockIntegration({ - requestParameters: { - foo: 'bar', - }, - }); - - // WHEN - proxy.addMethod('DELETE', deleteInteg, { - operationName: 'DeleteMe', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'DELETE', - ResourceId: { Ref: 'apiproxy4EA44110' }, - Integration: { - RequestParameters: { foo: 'bar' }, - Type: 'MOCK', - }, - OperationName: 'DeleteMe', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'DELETE', - ResourceId: { 'Fn::GetAtt': ['apiC8550315', 'RootResourceId'] }, - Integration: { - RequestParameters: { foo: 'bar' }, - Type: 'MOCK', - }, - OperationName: 'DeleteMe', - }); - - - }); - - test('if proxy is added to root, proxy methods are only added if they are not defined already on the root resource', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - api.root.addMethod('POST'); - const proxy = api.root.addProxy({ anyMethod: false }); - - // WHEN - proxy.addMethod('POST'); - - // THEN - - }); - - test('url for a resource', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'api'); - - // WHEN - const aResource = api.root.addResource('a'); - const cResource = aResource.addResource('b').addResource('c'); - const colonResource = cResource.addResource('d:e'); - - // THEN - expect(stack.resolve(api.urlForPath(aResource.path))).toEqual({ - 'Fn::Join': [ - '', - [ - 'https://', - { Ref: 'apiC8550315' }, - '.execute-api.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - '/', - { Ref: 'apiDeploymentStageprod896C8101' }, - '/a', - ], - ], - }); - expect(stack.resolve(api.urlForPath(cResource.path))).toEqual({ - 'Fn::Join': [ - '', - [ - 'https://', - { Ref: 'apiC8550315' }, - '.execute-api.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - '/', - { Ref: 'apiDeploymentStageprod896C8101' }, - '/a/b/c', - ], - ], - }); - expect(stack.resolve(api.urlForPath(colonResource.path))).toEqual({ - 'Fn::Join': [ - '', - [ - 'https://', - { Ref: 'apiC8550315' }, - '.execute-api.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - '/', - { Ref: 'apiDeploymentStageprod896C8101' }, - '/a/b/c/d:e', - ], - ], - }); - - }); - - test('fromResourceAttributes()', () => { - // GIVEN - const stack = new Stack(); - const resourceId = 'resource-id'; - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // WHEN - const imported = apigw.Resource.fromResourceAttributes(stack, 'imported-resource', { - resourceId, - restApi: api, - path: 'some-path', - }); - imported.addMethod('GET'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { - HttpMethod: 'GET', - ResourceId: resourceId, - }); - }); - - describe('getResource', () => { - - describe('root resource', () => { - test('returns undefined if not found', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // THEN - expect(api.root.getResource('boom')).toBeUndefined(); - - }); - - test('returns the resource if found', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // WHEN - const r1 = api.root.addResource('hello'); - const r2 = api.root.addResource('world'); - - // THEN - expect(api.root.getResource('hello')).toEqual(r1); - expect(api.root.getResource('world')).toEqual(r2); - - }); - - test('returns the resource even if it was created using "new"', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // WHEN - const r1 = new apigw.Resource(stack, 'child', { - parent: api.root, - pathPart: 'yello', - }); - - // THEN - expect(api.root.getResource('yello')).toEqual(r1); - - }); - - }); - - describe('non-root', () => { - - test('returns undefined if not found', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - const res = api.root.addResource('boom'); - - // THEN - expect(res.getResource('child-of-boom')).toBeUndefined(); - - }); - - test('returns the resource if found', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - const child = api.root.addResource('boom'); - - // WHEN - const r1 = child.addResource('hello'); - const r2 = child.addResource('world'); - - // THEN - expect(child.getResource('hello')).toEqual(r1); - expect(child.getResource('world')).toEqual(r2); - - }); - - test('returns the resource even if created with "new"', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - const child = api.root.addResource('boom'); - - // WHEN - const r1 = child.addResource('hello'); - - const r2 = new apigw.Resource(stack, 'world', { - parent: child, - pathPart: 'outside-world', - }); - - // THEN - expect(child.getResource('hello')).toEqual(r1); - expect(child.getResource('outside-world')).toEqual(r2); - - - }); - }); - - describe('resourceForPath', () => { - - test('empty path or "/" (on root) returns this', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // THEN - expect(api.root.resourceForPath('')).toEqual(api.root); - expect(api.root.resourceForPath('/')).toEqual(api.root); - expect(api.root.resourceForPath('///')).toEqual(api.root); - - }); - - test('returns a resource for that path', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // WHEN - const resource = api.root.resourceForPath('/boom/trach'); - - // THEN - expect(resource.path).toEqual('/boom/trach'); - - }); - - test('resources not created if not needed', () => { - // GIVEN - const stack = new Stack(); - const api = new apigw.RestApi(stack, 'MyRestApi'); - - // WHEN - const trach = api.root.resourceForPath('/boom/trach'); - const bam1 = api.root.resourceForPath('/boom/bam'); - - // THEN - const parent = api.root.getResource('boom'); - expect(parent).toBeDefined(); - expect(parent!.path).toEqual('/boom'); - - expect(trach.parentResource).toBe(parent); - expect(trach.parentResource!.path).toEqual('/boom'); - - const bam2 = api.root.resourceForPath('/boom/bam'); - expect(bam1).toBe(bam2); - expect(bam1.parentResource!.path).toEqual('/boom'); - - }); - - }); - }); - -}); diff --git a/packages/@aws-cdk/aws-apigateway/test/stage.test.ts b/packages/@aws-cdk/aws-apigateway/test/stage.test.ts deleted file mode 100644 index 156fa29ca7e0b..0000000000000 --- a/packages/@aws-cdk/aws-apigateway/test/stage.test.ts +++ /dev/null @@ -1,715 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as apigateway from '../lib'; -import { ApiDefinition } from '../lib'; - -describe('stage', () => { - test('minimal setup', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { deployment }); - - // THEN - Template.fromStack(stack).templateMatches({ - Resources: { - testapiD6451F70: { - Type: 'AWS::ApiGateway::RestApi', - Properties: { - Name: 'test-api', - }, - }, - testapiGETD8DE4ED1: { - Type: 'AWS::ApiGateway::Method', - Properties: { - HttpMethod: 'GET', - ResourceId: { - 'Fn::GetAtt': [ - 'testapiD6451F70', - 'RootResourceId', - ], - }, - RestApiId: { - Ref: 'testapiD6451F70', - }, - AuthorizationType: 'NONE', - Integration: { - Type: 'MOCK', - }, - }, - }, - mydeployment71ED3B4B5ce82e617e0729f75657ddcca51e3b91: { - Type: 'AWS::ApiGateway::Deployment', - Properties: { - RestApiId: { - Ref: 'testapiD6451F70', - }, - }, - DependsOn: [ - 'testapiGETD8DE4ED1', - ], - }, - mystage7483BE9A: { - Type: 'AWS::ApiGateway::Stage', - Properties: { - RestApiId: { - Ref: 'testapiD6451F70', - }, - DeploymentId: { - Ref: 'mydeployment71ED3B4B5ce82e617e0729f75657ddcca51e3b91', - }, - StageName: 'prod', - }, - }, - }, - }); - }); - - test('RestApi - stage depends on the CloudWatch role when it exists', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: true, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { deployment }); - - // THEN - Template.fromStack(stack).hasResource('AWS::ApiGateway::Stage', { - DependsOn: ['testapiAccount9B907665'], - }); - }); - - test('SpecRestApi - stage depends on the CloudWatch role when it exists', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.SpecRestApi(stack, 'test-api', { apiDefinition: apigateway.ApiDefinition.fromInline( { foo: 'bar' }) }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { deployment }); - - // THEN - Template.fromStack(stack).hasResource('AWS::ApiGateway::Stage', { - DependsOn: ['testapiAccount9B907665'], - }); - }); - - test('common method settings can be set at the stage level', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { - deployment, - loggingLevel: apigateway.MethodLoggingLevel.INFO, - throttlingRateLimit: 12, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - MethodSettings: [ - { - DataTraceEnabled: false, - HttpMethod: '*', - LoggingLevel: 'INFO', - ResourcePath: '/*', - ThrottlingRateLimit: 12, - }, - ], - }); - }); - - test('"stageResourceArn" returns the ARN for the stage', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api'); - const deployment = new apigateway.Deployment(stack, 'test-deploymnet', { - api, - }); - api.root.addMethod('GET'); - - // WHEN - const stage = new apigateway.Stage(stack, 'test-stage', { - deployment, - }); - - // THEN - expect(stack.resolve(stage.stageArn)).toEqual({ - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':apigateway:', - { Ref: 'AWS::Region' }, - '::/restapis/', - { Ref: 'testapiD6451F70' }, - '/stages/', - { Ref: 'teststage8788861E' }, - ], - ], - }); - }); - - test('custom method settings can be set by their path', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { - deployment, - loggingLevel: apigateway.MethodLoggingLevel.INFO, - throttlingRateLimit: 12, - methodOptions: { - '/goo/bar/GET': { - loggingLevel: apigateway.MethodLoggingLevel.ERROR, - }, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - MethodSettings: [ - { - DataTraceEnabled: false, - HttpMethod: '*', - LoggingLevel: 'INFO', - ResourcePath: '/*', - ThrottlingRateLimit: 12, - }, - { - DataTraceEnabled: false, - HttpMethod: 'GET', - LoggingLevel: 'ERROR', - ResourcePath: '/~1goo~1bar', - }, - ], - }); - }); - - test('default "cacheClusterSize" is 0.5 (if cache cluster is enabled)', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { - deployment, - cacheClusterEnabled: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - CacheClusterEnabled: true, - CacheClusterSize: '0.5', - }); - }); - - test('setting "cacheClusterSize" implies "cacheClusterEnabled"', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { - deployment, - cacheClusterSize: '0.5', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - CacheClusterEnabled: true, - CacheClusterSize: '0.5', - }); - }); - - test('fails when "cacheClusterEnabled" is "false" and "cacheClusterSize" is set', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - cacheClusterSize: '0.5', - cacheClusterEnabled: false, - })).toThrow(/Cannot set "cacheClusterSize" to 0.5 and "cacheClusterEnabled" to "false"/); - }); - - test('if "cachingEnabled" in method settings, implicitly enable cache cluster', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - new apigateway.Stage(stack, 'my-stage', { - deployment, - cachingEnabled: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - CacheClusterEnabled: true, - CacheClusterSize: '0.5', - MethodSettings: [ - { - DataTraceEnabled: false, - CachingEnabled: true, - HttpMethod: '*', - ResourcePath: '/*', - }, - ], - StageName: 'prod', - }); - }); - - test('if caching cluster is explicitly disabled, do not auto-enable cache cluster when "cachingEnabled" is set in method options', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - cacheClusterEnabled: false, - deployment, - cachingEnabled: true, - })).toThrow(/Cannot enable caching for method \/\*\/\* since cache cluster is disabled on stage/); - }); - - test('if only the custom log destination log group is set', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - AccessLogSetting: { - DestinationArn: { - 'Fn::GetAtt': [ - 'LogGroupF5B46931', - 'Arn', - ], - }, - Format: '$context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime] "$context.httpMethod $context.resourcePath $context.protocol" $context.status $context.responseLength $context.requestId', - }, - StageName: 'prod', - }); - }); - - test('if the custom log destination log group and format is set', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.jsonWithStandardFields(); - new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - AccessLogSetting: { - DestinationArn: { - 'Fn::GetAtt': [ - 'LogGroupF5B46931', - 'Arn', - ], - }, - Format: '{"requestId":"$context.requestId","ip":"$context.identity.sourceIp","user":"$context.identity.user","caller":"$context.identity.caller","requestTime":"$context.requestTime","httpMethod":"$context.httpMethod","resourcePath":"$context.resourcePath","status":"$context.status","protocol":"$context.protocol","responseLength":"$context.responseLength"}', - }, - StageName: 'prod', - }); - }); - - describe('access log check', () => { - test('fails when access log format does not contain `contextRequestId()` or `contextExtendedRequestId()', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.custom(''); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - })).toThrow('Access log must include either `AccessLogFormat.contextRequestId()` or `AccessLogFormat.contextExtendedRequestId()`'); - }); - - test('succeeds when access log format contains `contextRequestId()`', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ - requestId: apigateway.AccessLogField.contextRequestId(), - })); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - })).not.toThrow(); - }); - - test('succeeds when access log format contains `contextExtendedRequestId()`', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ - extendedRequestId: apigateway.AccessLogField.contextExtendedRequestId(), - })); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - })).not.toThrow(); - }); - - test('succeeds when access log format contains both `contextRequestId()` and `contextExtendedRequestId`', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ - requestId: apigateway.AccessLogField.contextRequestId(), - extendedRequestId: apigateway.AccessLogField.contextExtendedRequestId(), - })); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - })).not.toThrow(); - }); - - test('fails when access log format contains `contextRequestIdXxx`', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ - requestIdXxx: '$context.requestIdXxx', - })); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - })).toThrow('Access log must include either `AccessLogFormat.contextRequestId()` or `AccessLogFormat.contextExtendedRequestId()`'); - }); - - test('does not fail when access log format is a token', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); - const testFormat = apigateway.AccessLogFormat.custom(cdk.Lazy.string({ produce: () => 'test' })); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), - accessLogFormat: testFormat, - })).not.toThrow(); - }); - - test('fails when access log destination is empty', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); - const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); - api.root.addMethod('GET'); - - // WHEN - const testFormat = apigateway.AccessLogFormat.jsonWithStandardFields(); - - // THEN - expect(() => new apigateway.Stage(stack, 'my-stage', { - deployment, - accessLogFormat: testFormat, - })).toThrow(/Access log format is specified without a destination/); - }); - }); - - test('default throttling settings', () => { - // GIVEN - const stack = new cdk.Stack(); - new apigateway.SpecRestApi(stack, 'testapi', { - apiDefinition: ApiDefinition.fromInline({ - openapi: '3.0.2', - }), - deployOptions: { - throttlingBurstLimit: 0, - throttlingRateLimit: 0, - metricsEnabled: false, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { - MethodSettings: [{ - DataTraceEnabled: false, - HttpMethod: '*', - ResourcePath: '/*', - ThrottlingBurstLimit: 0, - ThrottlingRateLimit: 0, - }], - }); - }); - - test('addApiKey is supported', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false }); - api.root.addMethod('GET'); - const stage = new apigateway.Stage(stack, 'Stage', { - deployment: api.latestDeployment!, - }); - - // WHEN - stage.addApiKey('MyKey'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::ApiKey', { - StageKeys: [ - { - RestApiId: { - Ref: 'testapiD6451F70', - }, - StageName: { - Ref: 'Stage0E8C2AF5', - }, - }, - ], - }); - }); - - test('addApiKey is supported on an imported stage', () => { - // GIVEN - const stack = new cdk.Stack(); - const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false }); - api.root.addMethod('GET'); - const stage = apigateway.Stage.fromStageAttributes(stack, 'Stage', { - restApi: api, - stageName: 'MyStage', - }); - - // WHEN - stage.addApiKey('MyKey'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::ApiKey', { - StageKeys: [ - { - RestApiId: { - Ref: 'testapiD6451F70', - }, - StageName: 'MyStage', - }, - ], - }); - - }); - - describe('Metrics', () => { - test('metric', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const metricName = '4XXError'; - const statistic = 'Sum'; - const metric = api.deploymentStage.metric(metricName, { statistic }); - - // THEN - expect(metric.namespace).toEqual('AWS/ApiGateway'); - expect(metric.metricName).toEqual(metricName); - expect(metric.statistic).toEqual(statistic); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricClientError', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricClientError({ color }); - - // THEN - expect(metric.metricName).toEqual('4XXError'); - expect(metric.statistic).toEqual('Sum'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricServerError', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricServerError({ color }); - - // THEN - expect(metric.metricName).toEqual('5XXError'); - expect(metric.statistic).toEqual('Sum'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricCacheHitCount', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricCacheHitCount({ color }); - - // THEN - expect(metric.metricName).toEqual('CacheHitCount'); - expect(metric.statistic).toEqual('Sum'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricCacheMissCount', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricCacheMissCount({ color }); - - // THEN - expect(metric.metricName).toEqual('CacheMissCount'); - expect(metric.statistic).toEqual('Sum'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricCount', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricCount({ color }); - - // THEN - expect(metric.metricName).toEqual('Count'); - expect(metric.statistic).toEqual('SampleCount'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricIntegrationLatency', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricIntegrationLatency({ color }); - - // THEN - expect(metric.metricName).toEqual('IntegrationLatency'); - expect(metric.statistic).toEqual('Average'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - - test('metricLatency', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const api = new apigateway.RestApi(stack, 'test-api'); - const color = '#00ff00'; - const metric = api.deploymentStage.metricLatency({ color }); - - // THEN - expect(metric.metricName).toEqual('Latency'); - expect(metric.statistic).toEqual('Average'); - expect(metric.color).toEqual(color); - expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/.eslintrc.js b/packages/@aws-cdk/aws-apigatewayv2-authorizers/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/.eslintrc.js +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/.gitignore b/packages/@aws-cdk/aws-apigatewayv2-authorizers/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/.gitignore +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/README.md b/packages/@aws-cdk/aws-apigatewayv2-authorizers/README.md index fa5e05e7288fd..b893c5aed9107 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/README.md +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/README.md @@ -50,7 +50,7 @@ When using default authorization, all routes of the api will inherit the configu In the example below, all routes will require the `manage:books` scope present in order to invoke the integration. ```ts -import { HttpJwtAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; +import { HttpJwtAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; const issuer = 'https://test.us.auth0.com'; const authorizer = new HttpJwtAuthorizer('DefaultAuthorizer', issuer, { @@ -74,8 +74,8 @@ The example below showcases default authorization, along with route authorizatio - `POST /login` removes the default authorizer (unauthenticated route) ```ts -import { HttpJwtAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpJwtAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const issuer = 'https://test.us.auth0.com'; const authorizer = new HttpJwtAuthorizer('DefaultAuthorizer', issuer, { @@ -131,8 +131,8 @@ Clients that fail authorization are presented with either 2 responses: - `403 - Forbidden` - When the JWT validation is successful but the required scopes are not met ```ts -import { HttpJwtAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpJwtAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const issuer = 'https://test.us.auth0.com'; const authorizer = new HttpJwtAuthorizer('BooksAuthorizer', issuer, { @@ -157,9 +157,9 @@ They must then use this token in the specified `identitySource` for the API call pools as authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html). ```ts -import * as cognito from '@aws-cdk/aws-cognito'; -import { HttpUserPoolAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import { HttpUserPoolAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const userPool = new cognito.UserPool(this, 'UserPool'); @@ -182,8 +182,8 @@ Lambda authorizers depending on their response, fall into either two types - Sim ```ts -import { HttpLambdaAuthorizer, HttpLambdaResponseType } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpLambdaAuthorizer, HttpLambdaResponseType } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; // This function handles your auth logic declare const authHandler: lambda.Function; @@ -206,8 +206,8 @@ api.addRoutes({ API Gateway supports IAM via the included `HttpIamAuthorizer` and grant syntax: ```ts -import { HttpIamAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpIamAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const principal: iam.AnyPrincipal; @@ -234,8 +234,8 @@ You can set an authorizer to your WebSocket API's `$connect` route to control ac Lambda authorizers use a Lambda function to control access to your WebSocket API. When a client connects to your API, API Gateway invokes your Lambda function and uses the response to determine whether the client can access your API. ```ts -import { WebSocketLambdaAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { WebSocketLambdaAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; // This function handles your auth logic declare const authHandler: lambda.Function; @@ -263,8 +263,8 @@ new apigwv2.WebSocketApi(this, 'WebSocketApi', { IAM authorizers can be used to allow identity-based access to your WebSocket API. ```ts -import { WebSocketIamAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers'; -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { WebSocketIamAuthorizer } from '@aws-cdk/aws-apigatewayv2-authorizers-alpha'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; // This function handles your connect route declare const connectHandler: lambda.Function; diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/iam.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/iam.ts index 682aa4c24356a..22c96ddd11a7b 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/iam.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/iam.ts @@ -3,7 +3,7 @@ import { HttpRouteAuthorizerBindOptions, HttpRouteAuthorizerConfig, IHttpRouteAuthorizer, -} from '@aws-cdk/aws-apigatewayv2'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; /** * Authorize HTTP API Routes with IAM diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/jwt.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/jwt.ts index 94e4f1e230e62..b1472466ce3da 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/jwt.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/jwt.ts @@ -4,7 +4,7 @@ import { HttpRouteAuthorizerBindOptions, HttpRouteAuthorizerConfig, IHttpRouteAuthorizer, -} from '@aws-cdk/aws-apigatewayv2'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; /** * Properties to initialize HttpJwtAuthorizer. diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/lambda.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/lambda.ts index ff9b3d0b03ea3..803432e0df0b4 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/lambda.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/lambda.ts @@ -6,10 +6,10 @@ import { IHttpRouteAuthorizer, AuthorizerPayloadVersion, IHttpApi, -} from '@aws-cdk/aws-apigatewayv2'; -import { ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { Stack, Duration, Names } from '@aws-cdk/core'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; +import { ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { IFunction } from 'aws-cdk-lib/aws-lambda'; +import { Stack, Duration, Names } from 'aws-cdk-lib'; /** * Specifies the type responses the lambda returns diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/user-pool.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/user-pool.ts index 22f46a92b9b8c..de271ff2cbfa6 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/user-pool.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/http/user-pool.ts @@ -1,6 +1,6 @@ -import { HttpAuthorizer, HttpAuthorizerType, HttpRouteAuthorizerBindOptions, HttpRouteAuthorizerConfig, IHttpRouteAuthorizer } from '@aws-cdk/aws-apigatewayv2'; -import { IUserPool, IUserPoolClient } from '@aws-cdk/aws-cognito'; -import { Stack } from '@aws-cdk/core'; +import { HttpAuthorizer, HttpAuthorizerType, HttpRouteAuthorizerBindOptions, HttpRouteAuthorizerConfig, IHttpRouteAuthorizer } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { IUserPool, IUserPoolClient } from 'aws-cdk-lib/aws-cognito'; +import { Stack } from 'aws-cdk-lib'; /** * Properties to initialize HttpUserPoolAuthorizer. diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/iam.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/iam.ts index 1adac6766e3b7..d215f64988c66 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/iam.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/iam.ts @@ -3,7 +3,7 @@ import { WebSocketRouteAuthorizerBindOptions, WebSocketRouteAuthorizerConfig, IWebSocketRouteAuthorizer, -} from '@aws-cdk/aws-apigatewayv2'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; /** * Authorize WebSocket API Routes with IAM diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/lambda.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/lambda.ts index 73d30c3de7b8b..26b63e355214c 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/lambda.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/lib/websocket/lambda.ts @@ -5,10 +5,10 @@ import { WebSocketRouteAuthorizerConfig, IWebSocketRouteAuthorizer, IWebSocketApi, -} from '@aws-cdk/aws-apigatewayv2'; -import { ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { Stack, Names } from '@aws-cdk/core'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; +import { ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { IFunction } from 'aws-cdk-lib/aws-lambda'; +import { Stack, Names } from 'aws-cdk-lib'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/package.json b/packages/@aws-cdk/aws-apigatewayv2-authorizers/package.json index c31a3c9d65253..59440071def01 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/package.json +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-cdk/aws-apigatewayv2-authorizers", + "name": "@aws-cdk/aws-apigatewayv2-authorizers-alpha", "version": "0.0.0", "description": "Authorizers for AWS APIGateway V2", "main": "lib/index.js", @@ -8,26 +8,30 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Apigatewayv2.Authorizers", - "packageId": "Amazon.CDK.AWS.APIGatewayv2.Authorizers", + "namespace": "Amazon.CDK.AWS.Apigatewayv2.Authorizers.Alpha", + "packageId": "Amazon.CDK.AWS.APIGatewayv2.Authorizers.Alpha", "signAssembly": true, "assemblyOriginatorKeyFile": "../../key.snk", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.apigatewayv2.authorizers", + "package": "software.amazon.awscdk.services.apigatewayv2.authorizers.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "apigatewayv2-authorizers" + "artifactId": "apigatewayv2-authorizers-alpha" } }, "python": { - "distName": "aws-cdk.aws-apigatewayv2-authorizers", - "module": "aws_cdk.aws_apigatewayv2_authorizers", + "distName": "aws-cdk.aws-apigatewayv2-authorizers-alpha", + "module": "aws_cdk.aws_apigatewayv2_authorizers_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkapigatewayv2authorizersalpha" } }, "projectReferences": true, @@ -79,30 +83,21 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/aws-lambda": "^8.10.111", - "@aws-cdk/integ-tests": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/aws-apigatewayv2-integrations-alpha": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0", + "@aws-cdk/aws-apigatewayv2-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", + "@aws-cdk/aws-apigatewayv2-alpha": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -116,5 +111,16 @@ "publishConfig": { "tag": "latest" }, - "private": true + "private": false, + "awslint": { + "exclude": [ + "*:*" + ] + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + } } diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-apigatewayv2-authorizers/rosetta/default.ts-fixture index 12918827cf034..cfd71b43ab440 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/rosetta/default.ts-fixture @@ -1,9 +1,9 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as apigwv2 from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.iam.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.iam.ts index ae698b6a1ad1a..e369c5723fd1f 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.iam.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.iam.ts @@ -1,6 +1,6 @@ -import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import { HttpIamAuthorizer } from '../../lib'; class ExampleComIntegration extends apigatewayv2.HttpRouteIntegration { diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.lambda.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.lambda.ts index 4293703183ca7..30e2ba74916e6 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.lambda.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.lambda.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { HttpApi, HttpMethod } from '@aws-cdk/aws-apigatewayv2'; -import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack, CfnOutput } from '@aws-cdk/core'; +import { HttpApi, HttpMethod } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack, CfnOutput } from 'aws-cdk-lib'; import { HttpLambdaAuthorizer, HttpLambdaResponseType } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.user-pool.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.user-pool.ts index 3de728d75412b..f21e0c60b7d57 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.user-pool.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.user-pool.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { HttpApi, HttpMethod } from '@aws-cdk/aws-apigatewayv2'; -import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; -import * as cognito from '@aws-cdk/aws-cognito'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; +import { HttpApi, HttpMethod } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; import { HttpUserPoolAuthorizer } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integration.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integration.ts index bfabca0545ea5..eb260beeb4a62 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integration.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integration.ts @@ -1,4 +1,4 @@ -import { HttpIntegrationType, HttpRouteIntegration, HttpRouteIntegrationBindOptions, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2'; +import { HttpIntegrationType, HttpRouteIntegration, HttpRouteIntegrationBindOptions, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2-alpha'; export class DummyRouteIntegration extends HttpRouteIntegration { constructor() { diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/jwt.test.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/jwt.test.ts index 1ef62dfe73b3e..f93d6a3a533aa 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/jwt.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/jwt.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Stack } from 'aws-cdk-lib'; import { DummyRouteIntegration } from './integration'; import { HttpJwtAuthorizer } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/lambda.test.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/lambda.test.ts index 262d02088ae6b..9757e59309a83 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/lambda.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/lambda.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { Duration, Stack } from 'aws-cdk-lib'; import { DummyRouteIntegration } from './integration'; import { HttpLambdaAuthorizer, HttpLambdaResponseType } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/user-pool.test.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/user-pool.test.ts index fe7a33ec6227b..da2a56b3b0477 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/user-pool.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/user-pool.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import { UserPool } from '@aws-cdk/aws-cognito'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; +import { Stack } from 'aws-cdk-lib'; import { DummyRouteIntegration } from './integration'; import { HttpUserPoolAuthorizer } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/iam.test.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/iam.test.ts index f0f34a3c11214..e52a5c6ae7835 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/iam.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/iam.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2'; -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketIamAuthorizer } from '../../lib'; describe('WebSocketLambdaAuthorizer', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/integ.iam.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/integ.iam.ts index 281268ab6bee8..72dc0f2884ab0 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/integ.iam.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/integ.iam.ts @@ -1,10 +1,10 @@ -import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; -import * as iam from '@aws-cdk/aws-iam'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2-alpha'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { WebSocketIamAuthorizer } from '../../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/lambda.test.ts b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/lambda.test.ts index f6c7eee39686d..4b7890e1a9de5 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/lambda.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-authorizers/test/websocket/lambda.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2'; -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketLambdaAuthorizer } from '../../lib'; describe('WebSocketLambdaAuthorizer', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/.eslintrc.js b/packages/@aws-cdk/aws-apigatewayv2-integrations/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/.eslintrc.js +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/.gitignore b/packages/@aws-cdk/aws-apigatewayv2-integrations/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/.gitignore +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/README.md b/packages/@aws-cdk/aws-apigatewayv2-integrations/README.md index 3eb1dfad2c1b4..340a2d54af6e9 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/README.md +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/README.md @@ -41,7 +41,7 @@ proxy integrations](https://docs.aws.amazon.com/apigateway/latest/developerguide The following code configures a route `GET /books` with a Lambda proxy integration. ```ts -import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const booksDefaultFn: lambda.Function; const booksIntegration = new HttpLambdaIntegration('BooksIntegration', booksDefaultFn); @@ -66,7 +66,7 @@ The following code configures a route `GET /books` with an HTTP proxy integratio `get-books-proxy.example.com`. ```ts -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const booksIntegration = new HttpUrlIntegration('BooksIntegration', 'https://get-books-proxy.example.com'); @@ -92,7 +92,7 @@ The following integrations are supported for private resources in a VPC. The following code is a basic application load balancer private integration of HTTP API: ```ts -import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const vpc = new ec2.Vpc(this, 'VPC'); const lb = new elbv2.ApplicationLoadBalancer(this, 'lb', { vpc }); @@ -113,7 +113,7 @@ When an imported load balancer is used, the `vpc` option must be specified for ` The following code is a basic network load balancer private integration of HTTP API: ```ts -import { HttpNlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpNlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const vpc = new ec2.Vpc(this, 'VPC'); const lb = new elbv2.NetworkLoadBalancer(this, 'lb', { vpc }); @@ -134,8 +134,8 @@ When an imported load balancer is used, the `vpc` option must be specified for ` The following code is a basic discovery service private integration of HTTP API: ```ts -import * as servicediscovery from '@aws-cdk/aws-servicediscovery'; -import { HttpServiceDiscoveryIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; +import { HttpServiceDiscoveryIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const vpc = new ec2.Vpc(this, 'VPC'); const vpcLink = new apigwv2.VpcLink(this, 'VpcLink', { vpc }); @@ -161,7 +161,7 @@ responses](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api The following example creates a new header - `header2` - as a copy of `header1` and removes `header1`. ```ts -import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const lb: elbv2.ApplicationLoadBalancer; const listener = lb.addListener('listener', { port: 80 }); @@ -181,7 +181,7 @@ const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', { To add mapping keys and values not yet supported by the CDK, use the `custom()` method: ```ts -import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpAlbIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const lb: elbv2.ApplicationLoadBalancer; const listener = lb.addListener('listener', { port: 80 }); @@ -211,7 +211,7 @@ The API Gateway service will invoke the lambda function with an event payload of The following code configures a `sendmessage` route with a Lambda integration ```ts -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi'); new apigwv2.WebSocketStage(this, 'mystage', { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/alb.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/alb.ts index d7795f909f874..fa83988e701c6 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/alb.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/alb.ts @@ -1,6 +1,6 @@ -import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; import { HttpPrivateIntegrationOptions } from './base-types'; import { HttpPrivateIntegration } from './private/integration'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/base-types.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/base-types.ts index 1627b9b0c4deb..fc153b769872b 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/base-types.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/base-types.ts @@ -1,4 +1,4 @@ -import { HttpMethod, IVpcLink, ParameterMapping } from '@aws-cdk/aws-apigatewayv2'; +import { HttpMethod, IVpcLink, ParameterMapping } from '@aws-cdk/aws-apigatewayv2-alpha'; /** * Base options for private integration diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/http-proxy.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/http-proxy.ts index c0b3104653cc2..360ddb2785059 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/http-proxy.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/http-proxy.ts @@ -6,7 +6,7 @@ import { HttpRouteIntegration, ParameterMapping, PayloadFormatVersion, -} from '@aws-cdk/aws-apigatewayv2'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; /** * Properties to initialize a new `HttpProxyIntegration`. diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/lambda.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/lambda.ts index 69019e0c2866a..e55d1472b94d4 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/lambda.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/lambda.ts @@ -5,10 +5,10 @@ import { HttpRouteIntegration, PayloadFormatVersion, ParameterMapping, -} from '@aws-cdk/aws-apigatewayv2'; -import { ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; +import { ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { IFunction } from 'aws-cdk-lib/aws-lambda'; +import { Stack } from 'aws-cdk-lib'; /** * Lambda Proxy integration properties diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/nlb.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/nlb.ts index a7b7690ef3ed4..b728faf50480c 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/nlb.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/nlb.ts @@ -1,6 +1,6 @@ -import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; import { HttpPrivateIntegrationOptions } from './base-types'; import { HttpPrivateIntegration } from './private/integration'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/private/integration.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/private/integration.ts index e03e208d9271d..416733cbb3835 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/private/integration.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/private/integration.ts @@ -7,8 +7,8 @@ import { PayloadFormatVersion, HttpMethod, IVpcLink, -} from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/service-discovery.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/service-discovery.ts index 3a3433abdb83b..97ee9b926994d 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/service-discovery.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/http/service-discovery.ts @@ -1,5 +1,5 @@ -import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '@aws-cdk/aws-apigatewayv2'; -import * as servicediscovery from '@aws-cdk/aws-servicediscovery'; +import { HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; import { HttpPrivateIntegrationOptions } from './base-types'; import { HttpPrivateIntegration } from './private/integration'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/lambda.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/lambda.ts index a5c61af497f89..4b77351c5a64f 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/lambda.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/lambda.ts @@ -3,10 +3,10 @@ import { WebSocketIntegrationType, WebSocketRouteIntegrationBindOptions, WebSocketRouteIntegrationConfig, -} from '@aws-cdk/aws-apigatewayv2'; -import { ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; +import { ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { IFunction } from 'aws-cdk-lib/aws-lambda'; +import { Stack } from 'aws-cdk-lib'; /** * Lambda WebSocket Integration diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/mock.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/mock.ts index 9c7a83ece4538..5f1790c09d5c9 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/mock.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/lib/websocket/mock.ts @@ -3,7 +3,7 @@ import { WebSocketIntegrationType, WebSocketRouteIntegrationConfig, WebSocketRouteIntegrationBindOptions, -} from '@aws-cdk/aws-apigatewayv2'; +} from '@aws-cdk/aws-apigatewayv2-alpha'; /** * Mock WebSocket Integration diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/package.json b/packages/@aws-cdk/aws-apigatewayv2-integrations/package.json index 3b9a0665e8acb..b88bb7898d5ad 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/package.json +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-apigatewayv2-integrations", + "name": "@aws-cdk/aws-apigatewayv2-integrations-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "Integrations for AWS APIGateway V2", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Apigatewayv2.Integrations", - "packageId": "Amazon.CDK.AWS.APIGatewayv2.Integrations", + "namespace": "Amazon.CDK.AWS.Apigatewayv2.Integrations.Alpha", + "packageId": "Amazon.CDK.AWS.APIGatewayv2.Integrations.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.apigatewayv2.integrations", + "package": "software.amazon.awscdk.services.apigatewayv2.integrations.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "apigatewayv2-integrations" + "artifactId": "apigatewayv2-integrations-alpha" } }, "python": { - "distName": "aws-cdk.aws-apigatewayv2-integrations", - "module": "aws_cdk.aws_apigatewayv2_integrations", + "distName": "aws-cdk.aws-apigatewayv2-integrations-alpha", + "module": "aws_cdk.aws_apigatewayv2_integrations_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkapigatewayv2integrationsalpha" } }, "projectReferences": true, @@ -78,31 +82,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0", + "@aws-cdk/aws-apigatewayv2-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/core": "0.0.0", + "@aws-cdk/aws-apigatewayv2-alpha": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -115,5 +107,16 @@ }, "publishConfig": { "tag": "latest" + }, + "awslint": { + "exclude": [ + "*:*" + ] + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-apigatewayv2-integrations/rosetta/default.ts-fixture index d5ba330e26005..c2a4de9f54473 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/rosetta/default.ts-fixture @@ -1,10 +1,10 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as apigwv2 from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/alb.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/alb.test.ts index c73d9c41055da..e13163a9b9956 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/alb.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/alb.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey, VpcLink, ParameterMapping, MappingValue } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey, VpcLink, ParameterMapping, MappingValue } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { Stack } from 'aws-cdk-lib'; import { HttpAlbIntegration } from '../../lib'; describe('HttpAlbIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/http-proxy.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/http-proxy.test.ts index 3792f25d84ae1..ef696f17b590b 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/http-proxy.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/http-proxy.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { HttpApi, HttpIntegration, HttpIntegrationType, HttpMethod, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { HttpApi, HttpIntegration, HttpIntegrationType, HttpMethod, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Stack } from 'aws-cdk-lib'; import { HttpUrlIntegration } from '../../lib'; describe('HttpProxyIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.alb.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.alb.ts index 9ef01807d11d4..69e8ebacde2dc 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.alb.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.alb.ts @@ -1,7 +1,7 @@ -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { HttpAlbIntegration } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.http-proxy.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.http-proxy.ts index 15a799a0dba51..980ba108b09a1 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.http-proxy.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.http-proxy.ts @@ -1,6 +1,6 @@ -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { HttpUrlIntegration, HttpLambdaIntegration } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.lambda-proxy.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.lambda-proxy.ts index e4d472bef6b48..cefdb08014905 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.lambda-proxy.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.lambda-proxy.ts @@ -1,6 +1,6 @@ -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { HttpLambdaIntegration } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.nlb.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.nlb.ts index 6c0a8e64e1f94..635936d6b7ce6 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.nlb.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.nlb.ts @@ -1,7 +1,7 @@ -import { HttpApi } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { HttpNlbIntegration } from '../../lib'; const app = new App(); diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.service-discovery.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.service-discovery.ts index a79acef0d0007..ff8c8bf1256f3 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.service-discovery.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.service-discovery.ts @@ -1,7 +1,7 @@ -import { HttpApi, VpcLink } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as servicediscovery from '@aws-cdk/aws-servicediscovery'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { HttpApi, VpcLink } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { HttpServiceDiscoveryIntegration } from '../../lib'; const app = new App(); diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/lambda.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/lambda.test.ts index 9564e8eead4f8..2515df27163e3 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/lambda.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/lambda.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { HttpApi, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import { HttpApi, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, PayloadFormatVersion } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; import { HttpLambdaIntegration } from '../../lib'; describe('LambdaProxyIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/nlb.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/nlb.test.ts index a5c6eded4b884..d842b17d41e87 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/nlb.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/nlb.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, VpcLink } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, VpcLink } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { Stack } from 'aws-cdk-lib'; import { HttpNlbIntegration } from '../../lib'; describe('HttpNlbIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/private/integration.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/private/integration.test.ts index a7649b1fb8620..b07ad34551a0a 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/private/integration.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/private/integration.test.ts @@ -1,5 +1,5 @@ -import { HttpApi, HttpRoute, HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig, HttpRouteKey } from '@aws-cdk/aws-apigatewayv2'; -import { Stack } from '@aws-cdk/core'; +import { HttpApi, HttpRoute, HttpRouteIntegrationBindOptions, HttpRouteIntegrationConfig, HttpRouteKey } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Stack } from 'aws-cdk-lib'; import { HttpPrivateIntegration } from '../../../lib/http/private/integration'; describe('HttpPrivateIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/service-discovery.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/service-discovery.test.ts index 1d3ece56f2cd8..3f121d76baeb5 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/service-discovery.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/service-discovery.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, VpcLink } from '@aws-cdk/aws-apigatewayv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as servicediscovery from '@aws-cdk/aws-servicediscovery'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { HttpApi, HttpMethod, HttpRoute, HttpRouteKey, MappingValue, ParameterMapping, VpcLink } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as servicediscovery from 'aws-cdk-lib/aws-servicediscovery'; +import { Stack } from 'aws-cdk-lib'; import { HttpServiceDiscoveryIntegration } from '../../lib'; describe('HttpServiceDiscoveryIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.lambda.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.lambda.ts index 04c906883a08b..e77b88cb9b2f1 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.lambda.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.lambda.ts @@ -1,6 +1,6 @@ -import { WebSocketApi, WebSocketStage } from '@aws-cdk/aws-apigatewayv2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { WebSocketApi, WebSocketStage } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { WebSocketLambdaIntegration } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.mock.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.mock.ts index 672378b42d375..db8bdcaec007e 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.mock.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.mock.ts @@ -1,5 +1,5 @@ -import { WebSocketApi, WebSocketStage } from '@aws-cdk/aws-apigatewayv2'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; +import { WebSocketApi, WebSocketStage } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { App, CfnOutput, Stack } from 'aws-cdk-lib'; import { WebSocketMockIntegration } from '../../lib'; /* diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.route-response.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.route-response.ts index 063b1d20d962e..d416fefa7bf59 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.route-response.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/integ.route-response.ts @@ -1,6 +1,6 @@ -import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import { WebSocketMockIntegration } from '../../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/lambda.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/lambda.test.ts index 301b3f5e9e35a..7bf6cd9c1094b 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/lambda.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/lambda.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2'; -import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketLambdaIntegration } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/mock.test.ts b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/mock.test.ts index 4bd7eccd9fc7b..8515294e3d4f4 100644 --- a/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/mock.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2-integrations/test/websocket/mock.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { WebSocketApi } from '@aws-cdk/aws-apigatewayv2-alpha'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketMockIntegration } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/.eslintrc.js b/packages/@aws-cdk/aws-apigatewayv2/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/.eslintrc.js +++ b/packages/@aws-cdk/aws-apigatewayv2/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-apigatewayv2/.gitignore b/packages/@aws-cdk/aws-apigatewayv2/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/.gitignore +++ b/packages/@aws-cdk/aws-apigatewayv2/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-apigatewayv2/README.md b/packages/@aws-cdk/aws-apigatewayv2/README.md index ceca6f35c3854..a70c78b5b4e67 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/README.md +++ b/packages/@aws-cdk/aws-apigatewayv2/README.md @@ -5,17 +5,9 @@ Features | Stability -------------------------------------------|-------------------------------------------------------- -CFN Resources | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) Higher level constructs for HTTP APIs | ![Experimental](https://img.shields.io/badge/experimental-important.svg?style=for-the-badge) Higher level constructs for Websocket APIs | ![Experimental](https://img.shields.io/badge/experimental-important.svg?style=for-the-badge) -> **CFN Resources:** All classes with the `Cfn` prefix in this module ([CFN Resources]) are always -> stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - - - > **Experimental:** Higher level constructs in this module that are marked as experimental are > under active development. They are subject to non-backward compatible changes or removal in any > future version. These are not subject to the [Semantic Versioning](https://semver.org/) model and @@ -77,7 +69,7 @@ As an early example, the following code snippet configures a route `GET /books` configures all other HTTP method calls to `/books` to a lambda proxy. ```ts -import { HttpUrlIntegration, HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpUrlIntegration, HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const getBooksIntegration = new HttpUrlIntegration('GetBooksIntegration', 'https://get-books-proxy.example.com'); @@ -110,7 +102,7 @@ The `defaultIntegration` option while defining HTTP APIs lets you create a defau matched when a client reaches a route that is not explicitly defined. ```ts -import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpUrlIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; new apigwv2.HttpApi(this, 'HttpProxyApi', { defaultIntegration: new HttpUrlIntegration('DefaultIntegration', 'https://example.com'), @@ -177,8 +169,8 @@ The code snippet below creates a custom domain and configures a default domain m custom domain to the `$default` stage of the API. ```ts -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; const certArn = 'arn:aws:acm:us-east-1:111111111111:certificate'; const domainName = 'example.com'; @@ -223,7 +215,7 @@ api.addStage('beta', { The same domain name can be associated with stages across different `HttpApi` as so - ```ts -import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const handler: lambda.Function; declare const dn: apigwv2.DomainName; @@ -260,8 +252,8 @@ const demoDomainUrl = apiDemo.defaultStage?.domainUrl; // returns "https://examp Mutual TLS can be configured to limit access to your API based by using client certificates instead of (or as an extension of) using authorization headers. ```ts -import * as s3 from '@aws-cdk/aws-s3'; -import * as acm from '@aws-cdk/aws-certificatemanager'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; const certArn = 'arn:aws:acm:us-east-1:111111111111:certificate'; const domainName = 'example.com'; @@ -317,7 +309,7 @@ Load Balancers, Network Load Balancers or a Cloud Map service. The `VpcLink` con The following code creates a `VpcLink` to a private VPC. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const vpc = new ec2.Vpc(this, 'VPC'); const vpcLink = new apigwv2.VpcLink(this, 'VpcLink', { vpc }); @@ -326,7 +318,7 @@ const vpcLink = new apigwv2.VpcLink(this, 'VpcLink', { vpc }); Any existing `VpcLink` resource can be imported into the CDK app via the `VpcLink.fromVpcLinkAttributes()`. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; declare const vpc: ec2.Vpc; const awesomeLink = apigwv2.VpcLink.fromVpcLinkAttributes(this, 'awesome-vpc-link', { @@ -362,7 +354,7 @@ Integrations are available in the `aws-apigatewayv2-integrations` module and mor To add the default WebSocket routes supported by API Gateway (`$connect`, `$disconnect` and `$default`), configure them as part of api props: ```ts -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const connectHandler: lambda.Function; declare const disconnectHandler: lambda.Function; @@ -395,7 +387,7 @@ const callbackURL = webSocketStage.callbackUrl; To add any other route: ```ts -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const messageHandler: lambda.Function; const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi'); @@ -407,7 +399,7 @@ webSocketApi.addRoute('sendmessage', { To add a route that can return a result: ```ts -import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations'; +import { WebSocketLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha'; declare const messageHandler: lambda.Function; const webSocketApi = new apigwv2.WebSocketApi(this, 'mywsapi'); diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/api-mapping.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/api-mapping.ts index c965e1a5b0fc1..98aae8b741dd9 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/api-mapping.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/api-mapping.ts @@ -1,9 +1,9 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IApi } from './api'; import { IDomainName } from './domain-name'; import { IStage } from './stage'; -import { CfnApiMapping, CfnApiMappingProps } from '../apigatewayv2.generated'; +import { CfnApiMapping, CfnApiMappingProps } from 'aws-cdk-lib/aws-apigatewayv2'; /** * Represents an ApiGatewayV2 ApiMapping resource diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/api.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/api.ts index 8e6089d3cf419..8c5fb2e991946 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/api.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/api.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { IResource } from '@aws-cdk/core'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import { IResource } from 'aws-cdk-lib'; /** * Represents a API Gateway HTTP/WebSocket API diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/authorizer.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/authorizer.ts index 609d469a572fa..3b404d1e76037 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/authorizer.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/authorizer.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from 'aws-cdk-lib'; /** * Represents an Authorizer. diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/base.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/base.ts index 26342c75b5a0f..ce507e806a818 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/base.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/base.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Resource } from '@aws-cdk/core'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import { Resource } from 'aws-cdk-lib'; import { IApi } from './api'; import { ApiMapping } from './api-mapping'; import { DomainMappingOptions, IStage } from './stage'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts index 70bc42e67b64e..ffab9059fc113 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/domain-name.ts @@ -1,8 +1,8 @@ -import { ICertificate } from '@aws-cdk/aws-certificatemanager'; -import { IBucket } from '@aws-cdk/aws-s3'; -import { IResource, Lazy, Resource, Token } from '@aws-cdk/core'; +import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { IBucket } from 'aws-cdk-lib/aws-s3'; +import { IResource, Lazy, Resource, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnDomainName, CfnDomainNameProps } from '../apigatewayv2.generated'; +import { CfnDomainName, CfnDomainNameProps } from 'aws-cdk-lib/aws-apigatewayv2'; /** * The minimum version of the SSL protocol that you want API Gateway to use for HTTPS connections. diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/integration.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/integration.ts index 83e200aadb007..4beab4ce21ab7 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/integration.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/integration.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from 'aws-cdk-lib'; /** * Represents an integration to an API Route. diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/route.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/route.ts index 7419328256220..d73481295fc31 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/route.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/route.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from 'aws-cdk-lib'; /** * Represents a route. diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/common/stage.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/common/stage.ts index 523ba77a5e1cb..6ad27320e3e91 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/common/stage.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/common/stage.ts @@ -1,5 +1,5 @@ -import { Metric, MetricOptions } from '@aws-cdk/aws-cloudwatch'; -import { IResource } from '@aws-cdk/core'; +import { Metric, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch'; +import { IResource } from 'aws-cdk-lib'; import { IDomainName } from './domain-name'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts index 9a2a3a5df209e..15deefaa44fcd 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts @@ -1,12 +1,12 @@ -import { Metric, MetricOptions } from '@aws-cdk/aws-cloudwatch'; -import { Duration } from '@aws-cdk/core'; +import { Metric, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch'; +import { Duration } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IHttpRouteAuthorizer } from './authorizer'; import { HttpRouteIntegration } from './integration'; import { BatchHttpRouteOptions, HttpMethod, HttpRoute, HttpRouteKey } from './route'; import { IHttpStage, HttpStage, HttpStageOptions } from './stage'; import { VpcLink, VpcLinkProps } from './vpc-link'; -import { CfnApi, CfnApiProps } from '../apigatewayv2.generated'; +import { CfnApi, CfnApiProps } from 'aws-cdk-lib/aws-apigatewayv2'; import { IApi } from '../common/api'; import { ApiBase } from '../common/base'; import { DomainMappingOptions } from '../common/stage'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts index d13ffe2d5898f..3ca670ca3644e 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts @@ -1,8 +1,8 @@ -import { Duration, Resource } from '@aws-cdk/core'; +import { Duration, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IHttpApi } from './api'; import { IHttpRoute } from './route'; -import { CfnAuthorizer } from '../apigatewayv2.generated'; +import { CfnAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2'; import { IAuthorizer } from '../common'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts index fa057683f6641..102e9bf60b462 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts @@ -1,9 +1,9 @@ -import { IRole } from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; +import { IRole } from 'aws-cdk-lib/aws-iam'; +import { Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IHttpApi } from './api'; import { HttpMethod, IHttpRoute } from './route'; -import { CfnIntegration } from '../apigatewayv2.generated'; +import { CfnIntegration } from 'aws-cdk-lib/aws-apigatewayv2'; import { IIntegration } from '../common'; import { ParameterMapping } from '../parameter-mapping'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts index 9afd44e97222c..f7ef005604eba 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts @@ -1,10 +1,10 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IHttpApi } from './api'; import { HttpRouteAuthorizerConfig, IHttpRouteAuthorizer } from './authorizer'; import { HttpRouteIntegration } from './integration'; -import { CfnRoute, CfnRouteProps } from '../apigatewayv2.generated'; +import { CfnRoute, CfnRouteProps } from 'aws-cdk-lib/aws-apigatewayv2'; import { IRoute } from '../common'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts index 5714984a1def3..3f90e07f55d4b 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/stage.ts @@ -1,8 +1,8 @@ -import { Metric, MetricOptions } from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import { Metric, MetricOptions } from 'aws-cdk-lib/aws-cloudwatch'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IHttpApi } from './api'; -import { CfnStage } from '../apigatewayv2.generated'; +import { CfnStage } from 'aws-cdk-lib/aws-apigatewayv2'; import { StageOptions, IStage, StageAttributes } from '../common'; import { IApi } from '../common/api'; import { StageBase } from '../common/base'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/vpc-link.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/vpc-link.ts index b27ca3cd21225..dd986ca540bd8 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/vpc-link.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/vpc-link.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IResource, Lazy, Names, Resource } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { IResource, Lazy, Names, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnVpcLink } from '../apigatewayv2.generated'; +import { CfnVpcLink } from 'aws-cdk-lib/aws-apigatewayv2'; /** * Represents an API Gateway VpcLink diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/index.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/index.ts index 81df171d98aa1..954907568ebd7 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/index.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/index.ts @@ -1,4 +1,3 @@ -export * from './apigatewayv2.generated'; export * from './common'; export * from './http'; export * from './websocket'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts index 1ee1e26cbcd50..652f2eeb2c6e5 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts @@ -1,8 +1,8 @@ -import { Grant, IGrantable } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { WebSocketRoute, WebSocketRouteOptions } from './route'; -import { CfnApi } from '../apigatewayv2.generated'; +import { CfnApi } from 'aws-cdk-lib/aws-apigatewayv2'; import { IApi } from '../common/api'; import { ApiBase } from '../common/base'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/authorizer.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/authorizer.ts index 9822f560f487c..7048e9cce386e 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/authorizer.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/authorizer.ts @@ -1,8 +1,8 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IWebSocketApi } from './api'; import { IWebSocketRoute } from './route'; -import { CfnAuthorizer } from '../apigatewayv2.generated'; +import { CfnAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2'; import { IAuthorizer } from '../common'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/integration.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/integration.ts index 4261d50a1806c..d4c37b73a9a52 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/integration.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/integration.ts @@ -1,8 +1,8 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IWebSocketApi } from './api'; import { IWebSocketRoute } from './route'; -import { CfnIntegration } from '../apigatewayv2.generated'; +import { CfnIntegration } from 'aws-cdk-lib/aws-apigatewayv2'; import { IIntegration } from '../common'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/route.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/route.ts index 50f82bf002319..7f6c8ed24e40d 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/route.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/route.ts @@ -1,9 +1,9 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IWebSocketApi } from './api'; import { IWebSocketRouteAuthorizer, WebSocketNoneAuthorizer } from './authorizer'; import { WebSocketRouteIntegration } from './integration'; -import { CfnRoute, CfnRouteResponse } from '../apigatewayv2.generated'; +import { CfnRoute, CfnRouteResponse } from 'aws-cdk-lib/aws-apigatewayv2'; import { IRoute } from '../common'; /** diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/stage.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/stage.ts index 6aea435d4cb8a..ae94d8a0a100f 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/stage.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/websocket/stage.ts @@ -1,8 +1,8 @@ -import { Grant, IGrantable } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IWebSocketApi } from './api'; -import { CfnStage } from '../apigatewayv2.generated'; +import { CfnStage } from 'aws-cdk-lib/aws-apigatewayv2'; import { StageOptions, IApi, IStage, StageAttributes } from '../common'; import { StageBase } from '../common/base'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/package.json b/packages/@aws-cdk/aws-apigatewayv2/package.json index 07dc778290741..a122ad82fd0db 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/package.json +++ b/packages/@aws-cdk/aws-apigatewayv2/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-apigatewayv2", + "name": "@aws-cdk/aws-apigatewayv2-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::APIGatewayv2", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -13,24 +13,28 @@ }, "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Apigatewayv2", - "packageId": "Amazon.CDK.AWS.APIGatewayv2", + "namespace": "Amazon.CDK.AWS.Apigatewayv2.Alpha", + "packageId": "Amazon.CDK.AWS.APIGatewayv2.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.apigatewayv2", + "package": "software.amazon.awscdk.services.apigatewayv2.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "apigatewayv2" + "artifactId": "apigatewayv2-alpha" } }, "python": { - "distName": "aws-cdk.aws-apigatewayv2", - "module": "aws_cdk.aws_apigatewayv2", + "distName": "aws-cdk.aws-apigatewayv2-alpha", + "module": "aws_cdk.aws_apigatewayv2_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkapigatewayv2alpha" } }, "projectReferences": true, @@ -57,17 +61,14 @@ "pkglint": "pkglint -f", "test": "cdk-test", "watch": "cdk-watch", - "cfn2ts": "cfn2ts", "compat": "cdk-compat", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::ApiGatewayV2", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -85,29 +86,17 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -115,16 +104,7 @@ }, "awslint": { "exclude": [ - "props-physical-name:@aws-cdk/aws-apigatewayv2.ApiMappingProps", - "from-method:@aws-cdk/aws-apigatewayv2.HttpIntegration", - "from-method:@aws-cdk/aws-apigatewayv2.HttpRoute", - "props-physical-name:@aws-cdk/aws-apigatewayv2.HttpIntegrationProps", - "props-physical-name:@aws-cdk/aws-apigatewayv2.HttpRouteProps", - "from-method:@aws-cdk/aws-apigatewayv2.WebSocketApi", - "from-method:@aws-cdk/aws-apigatewayv2.WebSocketIntegration", - "from-method:@aws-cdk/aws-apigatewayv2.WebSocketRoute", - "props-physical-name:@aws-cdk/aws-apigatewayv2.WebSocketIntegrationProps", - "props-physical-name:@aws-cdk/aws-apigatewayv2.WebSocketRouteProps" + "*:*" ] }, "stability": "experimental", @@ -144,5 +124,11 @@ }, "publishConfig": { "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-apigatewayv2/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-apigatewayv2/rosetta/default.ts-fixture index 3d0f887754334..19c25bc8f43c7 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-apigatewayv2/rosetta/default.ts-fixture @@ -1,8 +1,8 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as apigwv2 from '@aws-cdk/aws-apigatewayv2-alpha'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/common/api-mapping.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/common/api-mapping.test.ts index c057d4a578050..6998f0aff69ba 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/common/api-mapping.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/common/api-mapping.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { Stack } from 'aws-cdk-lib'; import { DomainName, HttpApi, ApiMapping, WebSocketApi } from '../../lib'; const domainName = 'example.com'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/api.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/api.test.ts index bb123c6815adc..5e81d92f5be5e 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/api.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/api.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { Metric } from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { Metric } from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Duration, Stack } from 'aws-cdk-lib'; import { CorsHttpMethod, DomainName, HttpApi, HttpAuthorizer, HttpIntegrationType, HttpMethod, HttpRouteAuthorizerBindOptions, HttpRouteAuthorizerConfig, diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/authorizer.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/authorizer.test.ts index 8cdca389cad00..e87730bfc2022 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/authorizer.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/authorizer.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Stack } from 'aws-cdk-lib'; import { HttpApi, HttpAuthorizer, HttpAuthorizerType, } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts index b1c5e0b52e35f..efd5348ee4a01 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/domain-name.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { Bucket } from '@aws-cdk/aws-s3'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import { Stack } from 'aws-cdk-lib'; import { DomainName, EndpointType, HttpApi, SecurityPolicy } from '../../lib'; const domainName = 'example.com'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.stage.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.stage.ts index b1626871f0d08..197657d81593d 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.stage.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.stage.ts @@ -1,5 +1,5 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as apigw from '../../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts index 7f64176446928..93e67dc649d92 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { AccountPrincipal, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { Stack, App } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { AccountPrincipal, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam'; +import { Stack, App } from 'aws-cdk-lib'; import { HttpApi, HttpAuthorizer, HttpAuthorizerType, HttpConnectionType, HttpIntegrationType, HttpMethod, HttpRoute, HttpRouteAuthorizerBindOptions, HttpRouteAuthorizerConfig, HttpRouteIntegrationConfig, HttpRouteKey, IHttpRouteAuthorizer, HttpRouteIntegration, diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/stage.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/stage.test.ts index 07bf3b85846a2..3da4bc17542b0 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/stage.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/stage.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { Metric } from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { Metric } from 'aws-cdk-lib/aws-cloudwatch'; +import { Stack } from 'aws-cdk-lib'; import { DomainName, HttpApi, HttpStage } from '../../lib'; describe('HttpStage', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/vpc-link.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/vpc-link.test.ts index 99f7d480da63b..6ff88392b6fa3 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/vpc-link.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/vpc-link.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Stack } from 'aws-cdk-lib'; import { VpcLink } from '../../lib'; describe('VpcLink', () => { diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/api.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/api.test.ts index fd7839b4b7657..35a1f4dba986c 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/api.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/api.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { User } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import { User } from 'aws-cdk-lib/aws-iam'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketRouteIntegration, WebSocketApi, diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/authorizer.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/authorizer.test.ts index 105b7f168e74e..7f663d1721b25 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/authorizer.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/authorizer.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketApi, WebSocketAuthorizer, WebSocketAuthorizerType, } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.api-apikey.ts b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.api-apikey.ts index 1c5482bd3848e..0f8e13863ae1d 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.api-apikey.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.api-apikey.ts @@ -1,5 +1,5 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as apigw from '../../lib'; import { WebSocketApiKeySelectionExpression } from '../../lib'; diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.stage.ts b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.stage.ts index 65fbefd3dac39..c0310be9e84cc 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.stage.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/integ.stage.ts @@ -1,5 +1,5 @@ #!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as apigw from '../../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/route.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/route.test.ts index 63bc3e6e969c7..680878a3e7020 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/route.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/route.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketRouteIntegration, WebSocketApi, WebSocketIntegrationType, WebSocketRoute, WebSocketRouteIntegrationBindOptions, WebSocketRouteIntegrationConfig, diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/stage.test.ts b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/stage.test.ts index 3699d1bad78c0..6068f1cc59817 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/websocket/stage.test.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/websocket/stage.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { User } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import { User } from 'aws-cdk-lib/aws-iam'; +import { Stack } from 'aws-cdk-lib'; import { WebSocketApi, WebSocketStage } from '../../lib'; describe('WebSocketStage', () => { diff --git a/packages/@aws-cdk/aws-appconfig/.eslintrc.js b/packages/@aws-cdk/aws-appconfig/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appconfig/.gitignore b/packages/@aws-cdk/aws-appconfig/.gitignore deleted file mode 100644 index c7bad6a7b3ee2..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk - -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-appconfig/.npmignore b/packages/@aws-cdk/aws-appconfig/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-appconfig/LICENSE b/packages/@aws-cdk/aws-appconfig/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-appconfig/NOTICE b/packages/@aws-cdk/aws-appconfig/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-appconfig/README.md b/packages/@aws-cdk/aws-appconfig/README.md deleted file mode 100644 index 866957e13e1c1..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::AppConfig Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as appconfig from '@aws-cdk/aws-appconfig'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AppConfig construct libraries](https://constructs.dev/search?q=appconfig) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppConfig resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppConfig.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppConfig](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppConfig.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-appconfig/jest.config.js b/packages/@aws-cdk/aws-appconfig/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appconfig/lib/index.ts b/packages/@aws-cdk/aws-appconfig/lib/index.ts deleted file mode 100644 index 3b1a2ee0243db..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AppConfig CloudFormation Resources: -export * from './appconfig.generated'; diff --git a/packages/@aws-cdk/aws-appconfig/package.json b/packages/@aws-cdk/aws-appconfig/package.json deleted file mode 100644 index 2c182cdaec705..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-appconfig", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AppConfig", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AppConfig", - "packageId": "Amazon.CDK.AWS.AppConfig", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.appconfig", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "appconfig" - } - }, - "python": { - "distName": "aws-cdk.aws-appconfig", - "module": "aws_cdk.aws_appconfig", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-appconfig" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AppConfig", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AppConfig", - "aws-appconfig" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-appconfig/test/appconfig.test.ts b/packages/@aws-cdk/aws-appconfig/test/appconfig.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-appconfig/test/appconfig.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-appflow/.eslintrc.js b/packages/@aws-cdk/aws-appflow/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-appflow/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appflow/.gitignore b/packages/@aws-cdk/aws-appflow/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-appflow/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-appflow/.npmignore b/packages/@aws-cdk/aws-appflow/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-appflow/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-appflow/LICENSE b/packages/@aws-cdk/aws-appflow/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-appflow/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-appflow/NOTICE b/packages/@aws-cdk/aws-appflow/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-appflow/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-appflow/README.md b/packages/@aws-cdk/aws-appflow/README.md deleted file mode 100644 index 474c4be008281..0000000000000 --- a/packages/@aws-cdk/aws-appflow/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::AppFlow Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as appflow from '@aws-cdk/aws-appflow'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AppFlow construct libraries](https://constructs.dev/search?q=appflow) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppFlow resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppFlow.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppFlow](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppFlow.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-appflow/jest.config.js b/packages/@aws-cdk/aws-appflow/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-appflow/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appflow/lib/index.ts b/packages/@aws-cdk/aws-appflow/lib/index.ts deleted file mode 100644 index 381d4ebb68f8a..0000000000000 --- a/packages/@aws-cdk/aws-appflow/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AppFlow CloudFormation Resources: -export * from './appflow.generated'; diff --git a/packages/@aws-cdk/aws-appflow/package.json b/packages/@aws-cdk/aws-appflow/package.json deleted file mode 100644 index 2b841fc561580..0000000000000 --- a/packages/@aws-cdk/aws-appflow/package.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "name": "@aws-cdk/aws-appflow", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AppFlow", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AppFlow", - "packageId": "Amazon.CDK.AWS.AppFlow", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.appflow", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "appflow" - } - }, - "python": { - "distName": "aws-cdk.aws-appflow", - "module": "aws_cdk.aws_appflow", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-appflow" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AppFlow" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AppFlow", - "aws-appflow" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-appflow/test/appflow.test.ts b/packages/@aws-cdk/aws-appflow/test/appflow.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-appflow/test/appflow.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-appintegrations/.eslintrc.js b/packages/@aws-cdk/aws-appintegrations/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appintegrations/.gitignore b/packages/@aws-cdk/aws-appintegrations/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-appintegrations/.npmignore b/packages/@aws-cdk/aws-appintegrations/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-appintegrations/LICENSE b/packages/@aws-cdk/aws-appintegrations/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-appintegrations/NOTICE b/packages/@aws-cdk/aws-appintegrations/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-appintegrations/README.md b/packages/@aws-cdk/aws-appintegrations/README.md deleted file mode 100644 index c7fde058d23d5..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::AppIntegrations Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as appintegrations from '@aws-cdk/aws-appintegrations'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AppIntegrations construct libraries](https://constructs.dev/search?q=appintegrations) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppIntegrations resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppIntegrations.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppIntegrations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppIntegrations.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-appintegrations/jest.config.js b/packages/@aws-cdk/aws-appintegrations/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appintegrations/lib/index.ts b/packages/@aws-cdk/aws-appintegrations/lib/index.ts deleted file mode 100644 index c62e3d98b2398..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AppIntegrations CloudFormation Resources: -export * from './appintegrations.generated'; diff --git a/packages/@aws-cdk/aws-appintegrations/package.json b/packages/@aws-cdk/aws-appintegrations/package.json deleted file mode 100644 index 8d53503958e2b..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-appintegrations", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::AppIntegrations", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AppIntegrations", - "packageId": "Amazon.CDK.AWS.AppIntegrations", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.appintegrations", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "appintegrations" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-appintegrations", - "module": "aws_cdk.aws_appintegrations" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-appintegrations" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AppIntegrations", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AppIntegrations", - "aws-appintegrations" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-appintegrations/test/appintegrations.test.ts b/packages/@aws-cdk/aws-appintegrations/test/appintegrations.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-appintegrations/test/appintegrations.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-applicationautoscaling/.eslintrc.js b/packages/@aws-cdk/aws-applicationautoscaling/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-applicationautoscaling/.gitignore b/packages/@aws-cdk/aws-applicationautoscaling/.gitignore deleted file mode 100644 index a44eba2329f2d..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-applicationautoscaling/.npmignore b/packages/@aws-cdk/aws-applicationautoscaling/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-applicationautoscaling/LICENSE b/packages/@aws-cdk/aws-applicationautoscaling/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-applicationautoscaling/NOTICE b/packages/@aws-cdk/aws-applicationautoscaling/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-applicationautoscaling/README.md b/packages/@aws-cdk/aws-applicationautoscaling/README.md deleted file mode 100644 index 9697a9d27badc..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/README.md +++ /dev/null @@ -1,256 +0,0 @@ -# AWS Auto Scaling Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -**Application AutoScaling** is used to configure autoscaling for all -services other than scaling EC2 instances. For example, you will use this to -scale ECS tasks, DynamoDB capacity, Spot Fleet sizes, Comprehend document classification endpoints, Lambda function provisioned concurrency and more. - -As a CDK user, you will probably not have to interact with this library -directly; instead, it will be used by other construct libraries to -offer AutoScaling features for their own constructs. - -This document will describe the general autoscaling features and concepts; -your particular service may offer only a subset of these. - -## AutoScaling basics - -Resources can offer one or more **attributes** to autoscale, typically -representing some capacity dimension of the underlying service. For example, -a DynamoDB Table offers autoscaling of the read and write capacity of the -table proper and its Global Secondary Indexes, an ECS Service offers -autoscaling of its task count, an RDS Aurora cluster offers scaling of its -replica count, and so on. - -When you enable autoscaling for an attribute, you specify a minimum and a -maximum value for the capacity. AutoScaling policies that respond to metrics -will never go higher or lower than the indicated capacity (but scheduled -scaling actions might, see below). - -There are three ways to scale your capacity: - -* **In response to a metric** (also known as step scaling); for example, you - might want to scale out if the CPU usage across your cluster starts to rise, - and scale in when it drops again. -* **By trying to keep a certain metric around a given value** (also known as - target tracking scaling); you might want to automatically scale out an in to - keep your CPU usage around 50%. -* **On a schedule**; you might want to organize your scaling around traffic - flows you expect, by scaling out in the morning and scaling in in the - evening. - -The general pattern of autoscaling will look like this: - -```ts -declare const resource: SomeScalableResource; - -const capacity = resource.autoScaleCapacity({ - minCapacity: 5, - maxCapacity: 100 -}); - -// Then call a method to enable metric scaling and/or schedule scaling -// (explained below): -// -// capacity.scaleOnMetric(...); -// capacity.scaleToTrackMetric(...); -// capacity.scaleOnSchedule(...); -``` - -## Step Scaling - -This type of scaling scales in and out in deterministic steps that you -configure, in response to metric values. For example, your scaling strategy -to scale in response to CPU usage might look like this: - -```plaintext - Scaling -1 (no change) +1 +3 - │ │ │ │ │ - ├────────┼───────────────────────┼────────┼────────┤ - │ │ │ │ │ -CPU usage 0% 10% 50% 70% 100% -``` - -(Note that this is not necessarily a recommended scaling strategy, but it's -a possible one. You will have to determine what thresholds are right for you). - -You would configure it like this: - -```ts -declare const capacity: ScalableAttribute; -declare const cpuUtilization: cloudwatch.Metric; - -capacity.scaleOnMetric('ScaleToCPU', { - metric: cpuUtilization, - scalingSteps: [ - { upper: 10, change: -1 }, - { lower: 50, change: +1 }, - { lower: 70, change: +3 }, - ], - - // Change this to AdjustmentType.PercentChangeInCapacity to interpret the - // 'change' numbers before as percentages instead of capacity counts. - adjustmentType: appscaling.AdjustmentType.CHANGE_IN_CAPACITY, -}); -``` - -The AutoScaling construct library will create the required CloudWatch alarms and -AutoScaling policies for you. - -### Scaling based on multiple datapoints - -The Step Scaling configuration above will initiate a scaling event when a single -datapoint of the scaling metric is breaching a scaling step breakpoint. In cases -where you might want to initiate scaling actions on a larger number of datapoints -(ie in order to smooth out randomness in the metric data), you can use the -optional `evaluationPeriods` and `datapointsToAlarm` properties: - -```ts -declare const capacity: ScalableAttribute; -declare const cpuUtilization: cloudwatch.Metric; - -capacity.scaleOnMetric('ScaleToCPUWithMultipleDatapoints', { - metric: cpuUtilization, - scalingSteps: [ - { upper: 10, change: -1 }, - { lower: 50, change: +1 }, - { lower: 70, change: +3 }, - ], - - // if the cpuUtilization metric has a period of 1 minute, then data points - // in the last 10 minutes will be evaluated - evaluationPeriods: 10, - - // Only trigger a scaling action when 6 datapoints out of the last 10 are - // breaching. If this is left unspecified, then ALL datapoints in the - // evaluation period must be breaching to trigger a scaling action - datapointsToAlarm: 6 -}); -``` - -## Target Tracking Scaling - -This type of scaling scales in and out in order to keep a metric (typically -representing utilization) around a value you prefer. This type of scaling is -typically heavily service-dependent in what metric you can use, and so -different services will have different methods here to set up target tracking -scaling. - -The following example configures the read capacity of a DynamoDB table -to be around 60% utilization: - -```ts -import * as dynamodb from '@aws-cdk/aws-dynamodb'; - -declare const table: dynamodb.Table; - -const readCapacity = table.autoScaleReadCapacity({ - minCapacity: 10, - maxCapacity: 1000 -}); -readCapacity.scaleOnUtilization({ - targetUtilizationPercent: 60 -}); -``` - -## Scheduled Scaling - -This type of scaling is used to change capacities based on time. It works -by changing the `minCapacity` and `maxCapacity` of the attribute, and so -can be used for two purposes: - -* Scale in and out on a schedule by setting the `minCapacity` high or - the `maxCapacity` low. -* Still allow the regular scaling actions to do their job, but restrict - the range they can scale over (by setting both `minCapacity` and - `maxCapacity` but changing their range over time). - -The following schedule expressions can be used: - -* `at(yyyy-mm-ddThh:mm:ss)` -- scale at a particular moment in time -* `rate(value unit)` -- scale every minute/hour/day -* `cron(mm hh dd mm dow)` -- scale on arbitrary schedules - -Of these, the cron expression is the most useful but also the most -complicated. A schedule is expressed as a cron expression. The `Schedule` class has a `cron` method to help build cron expressions. - -The following example scales the fleet out in the morning, and lets natural -scaling take over at night: - -```ts -declare const resource: SomeScalableResource; - -const capacity = resource.autoScaleCapacity({ - minCapacity: 1, - maxCapacity: 50, -}); - -capacity.scaleOnSchedule('PrescaleInTheMorning', { - schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), - minCapacity: 20, -}); - -capacity.scaleOnSchedule('AllowDownscalingAtNight', { - schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), - minCapacity: 1 -}); -``` - -## Examples - -### Lambda Provisioned Concurrency Auto Scaling - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -declare const code: lambda.Code; - -const handler = new lambda.Function(this, 'MyFunction', { - runtime: lambda.Runtime.PYTHON_3_7, - handler: 'index.handler', - code, - - reservedConcurrentExecutions: 2, -}); - -const fnVer = handler.currentVersion; - -const target = new appscaling.ScalableTarget(this, 'ScalableTarget', { - serviceNamespace: appscaling.ServiceNamespace.LAMBDA, - maxCapacity: 100, - minCapacity: 10, - resourceId: `function:${handler.functionName}:${fnVer.version}`, - scalableDimension: 'lambda:function:ProvisionedConcurrency', -}) - -target.scaleToTrackMetric('PceTracking', { - targetValue: 0.9, - predefinedMetric: appscaling.PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION, -}) -``` - -### ElastiCache Redis shards scaling with target value - -```ts -const shardsScalableTarget = new appscaling.ScalableTarget(this, 'ElastiCacheRedisShardsScalableTarget', { - serviceNamespace: appscaling.ServiceNamespace.ELASTICACHE, - scalableDimension: 'elasticache:replication-group:NodeGroups', - minCapacity: 2, - maxCapacity: 10, - resourceId: 'replication-group/main-cluster', -}); - -shardsScalableTarget.scaleToTrackMetric('ElastiCacheRedisShardsCPUUtilization', { - targetValue: 20, - predefinedMetric: appscaling.PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION, -}); -``` diff --git a/packages/@aws-cdk/aws-applicationautoscaling/jest.config.js b/packages/@aws-cdk/aws-applicationautoscaling/jest.config.js deleted file mode 100644 index 211d217076e38..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/jest.config.js +++ /dev/null @@ -1,9 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 75, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/schedule.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/schedule.ts deleted file mode 100644 index ab51bb43452ee..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/schedule.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { Annotations, Duration } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Schedule for scheduled scaling actions - */ -export abstract class Schedule { - /** - * Construct a schedule from a literal schedule expression - * - * @param expression The expression to use. Must be in a format that Application AutoScaling will recognize - */ - public static expression(expression: string): Schedule { - return new LiteralSchedule(expression); - } - - /** - * Construct a schedule from an interval and a time unit - */ - public static rate(duration: Duration): Schedule { - if (duration.isUnresolved()) { - const validDurationUnit = ['minute', 'minutes', 'hour', 'hours', 'day', 'days']; - if (!validDurationUnit.includes(duration.unitLabel())) { - throw new Error("Allowed units for scheduling are: 'minute', 'minutes', 'hour', 'hours', 'day' or 'days'"); - } - return new LiteralSchedule(`rate(${duration.formatTokenToNumber()})`); - } - if (duration.toSeconds() === 0) { - throw new Error('Duration cannot be 0'); - } - - let rate = maybeRate(duration.toDays({ integral: false }), 'day'); - if (rate === undefined) { rate = maybeRate(duration.toHours({ integral: false }), 'hour'); } - if (rate === undefined) { rate = makeRate(duration.toMinutes({ integral: true }), 'minute'); } - return new LiteralSchedule(rate); - } - - /** - * Construct a Schedule from a moment in time - */ - public static at(moment: Date): Schedule { - return new LiteralSchedule(`at(${formatISO(moment)})`); - } - - /** - * Create a schedule from a set of cron fields - */ - public static cron(options: CronOptions): Schedule { - if (options.weekDay !== undefined && options.day !== undefined) { - throw new Error('Cannot supply both \'day\' and \'weekDay\', use at most one'); - } - - const minute = fallback(options.minute, '*'); - const hour = fallback(options.hour, '*'); - const month = fallback(options.month, '*'); - const year = fallback(options.year, '*'); - - // Weekday defaults to '?' if not supplied. If it is supplied, day must become '?' - const day = fallback(options.day, options.weekDay !== undefined ? '?' : '*'); - const weekDay = fallback(options.weekDay, '?'); - - return new class extends Schedule { - public readonly expressionString: string = `cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`; - public _bind(scope: Construct) { - if (!options.minute) { - Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.'); - } - return new LiteralSchedule(this.expressionString); - } - }; - } - - /** - * Retrieve the expression for this schedule - */ - public abstract readonly expressionString: string; - - protected constructor() {} - - /** - * - * @internal - */ - public abstract _bind(scope: Construct): void; -} - -/** - * Options to configure a cron expression - * - * All fields are strings so you can use complex expressions. Absence of - * a field implies '*' or '?', whichever one is appropriate. - * - * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions - */ -export interface CronOptions { - /** - * The minute to run this rule at - * - * @default - Every minute - */ - readonly minute?: string; - - /** - * The hour to run this rule at - * - * @default - Every hour - */ - readonly hour?: string; - - /** - * The day of the month to run this rule at - * - * @default - Every day of the month - */ - readonly day?: string; - - /** - * The month to run this rule at - * - * @default - Every month - */ - readonly month?: string; - - /** - * The year to run this rule at - * - * @default - Every year - */ - readonly year?: string; - - /** - * The day of the week to run this rule at - * - * @default - Any day of the week - */ - readonly weekDay?: string; -} - -class LiteralSchedule extends Schedule { - constructor(public readonly expressionString: string) { - super(); - } - - public _bind() {} -} - -function fallback(x: T | undefined, def: T): T { - return x === undefined ? def : x; -} - -function formatISO(date?: Date) { - if (!date) { return undefined; } - - return date.getUTCFullYear() + - '-' + pad(date.getUTCMonth() + 1) + - '-' + pad(date.getUTCDate()) + - 'T' + pad(date.getUTCHours()) + - ':' + pad(date.getUTCMinutes()) + - ':' + pad(date.getUTCSeconds()); - - function pad(num: number) { - if (num < 10) { - return '0' + num; - } - return num; - } -} - -/** - * Return the rate if the rate is whole number - */ -function maybeRate(interval: number, singular: string) { - if (interval === 0 || !Number.isInteger(interval)) { return undefined; } - return makeRate(interval, singular); -} - -/** - * Return 'rate(${interval} ${singular}(s))` for the interval - */ -function makeRate(interval: number, singular: string) { - return interval === 1 ? `rate(1 ${singular})` : `rate(${interval} ${singular}s)`; -} diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts deleted file mode 100644 index 0ff9f200f263c..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-action.ts +++ /dev/null @@ -1,194 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnScalingPolicy } from './applicationautoscaling.generated'; -import { IScalableTarget } from './scalable-target'; - -/** - * Properties for a scaling policy - */ -export interface StepScalingActionProps { - /** - * The scalable target - */ - readonly scalingTarget: IScalableTarget; - - /** - * A name for the scaling policy - * - * @default Automatically generated name - */ - readonly policyName?: string; - - /** - * How the adjustment numbers are interpreted - * - * @default ChangeInCapacity - */ - readonly adjustmentType?: AdjustmentType; - - /** - * Grace period after scaling activity. - * - * For scale out policies, multiple scale outs during the cooldown period are - * squashed so that only the biggest scale out happens. - * - * For scale in policies, subsequent scale ins during the cooldown period are - * ignored. - * - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html - * @default No cooldown period - */ - readonly cooldown?: cdk.Duration; - - /** - * Minimum absolute number to adjust capacity with as result of percentage scaling. - * - * Only when using AdjustmentType = PercentChangeInCapacity, this number controls - * the minimum absolute effect size. - * - * @default No minimum scaling effect - */ - readonly minAdjustmentMagnitude?: number; - - /** - * The aggregation type for the CloudWatch metrics. - * - * @default Average - */ - readonly metricAggregationType?: MetricAggregationType; -} - -/** - * Define a step scaling action - * - * This kind of scaling policy adjusts the target capacity in configurable - * steps. The size of the step is configurable based on the metric's distance - * to its alarm threshold. - * - * This Action must be used as the target of a CloudWatch alarm to take effect. - */ -export class StepScalingAction extends Construct { - /** - * ARN of the scaling policy - */ - public readonly scalingPolicyArn: string; - - private readonly adjustments = new Array(); - - constructor(scope: Construct, id: string, props: StepScalingActionProps) { - super(scope, id); - - // Cloudformation requires either the ResourceId, ScalableDimension, and ServiceNamespace - // properties, or the ScalingTargetId property, but not both. - // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html - const resource = new CfnScalingPolicy(this, 'Resource', { - policyName: props.policyName || cdk.Names.uniqueId(this), - policyType: 'StepScaling', - scalingTargetId: props.scalingTarget.scalableTargetId, - stepScalingPolicyConfiguration: { - adjustmentType: props.adjustmentType, - cooldown: props.cooldown && props.cooldown.toSeconds(), - minAdjustmentMagnitude: props.minAdjustmentMagnitude, - metricAggregationType: props.metricAggregationType, - stepAdjustments: cdk.Lazy.any({ produce: () => this.adjustments }), - } as CfnScalingPolicy.StepScalingPolicyConfigurationProperty, - }); - - this.scalingPolicyArn = resource.ref; - } - - /** - * Add an adjusment interval to the ScalingAction - */ - public addAdjustment(adjustment: AdjustmentTier) { - if (adjustment.lowerBound === undefined && adjustment.upperBound === undefined) { - throw new Error('At least one of lowerBound or upperBound is required'); - } - this.adjustments.push({ - metricIntervalLowerBound: adjustment.lowerBound, - metricIntervalUpperBound: adjustment.upperBound, - scalingAdjustment: adjustment.adjustment, - }); - } -} - -/** - * How adjustment numbers are interpreted - */ -export enum AdjustmentType { - /** - * Add the adjustment number to the current capacity. - * - * A positive number increases capacity, a negative number decreases capacity. - */ - CHANGE_IN_CAPACITY = 'ChangeInCapacity', - - /** - * Add this percentage of the current capacity to itself. - * - * The number must be between -100 and 100; a positive number increases - * capacity and a negative number decreases it. - */ - PERCENT_CHANGE_IN_CAPACITY = 'PercentChangeInCapacity', - - /** - * Make the capacity equal to the exact number given. - */ - EXACT_CAPACITY = 'ExactCapacity', -} - -/** - * How the scaling metric is going to be aggregated - */ -export enum MetricAggregationType { - /** - * Average - */ - AVERAGE = 'Average', - - /** - * Minimum - */ - MINIMUM = 'Minimum', - - /** - * Maximum - */ - MAXIMUM = 'Maximum' -} - -/** - * An adjustment - */ -export interface AdjustmentTier { - /** - * What number to adjust the capacity with - * - * The number is interpeted as an added capacity, a new fixed capacity or an - * added percentage depending on the AdjustmentType value of the - * StepScalingPolicy. - * - * Can be positive or negative. - */ - readonly adjustment: number; - - /** - * Lower bound where this scaling tier applies. - * - * The scaling tier applies if the difference between the metric - * value and its alarm threshold is higher than this value. - * - * @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier - */ - readonly lowerBound?: number; - - /** - * Upper bound where this scaling tier applies - * - * The scaling tier applies if the difference between the metric - * value and its alarm threshold is lower than this value. - * - * @default +Infinity - */ - readonly upperBound?: number; -} diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts deleted file mode 100644 index 7d86e34fcaafe..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/step-scaling-policy.ts +++ /dev/null @@ -1,257 +0,0 @@ -import { findAlarmThresholds, normalizeIntervals } from '@aws-cdk/aws-autoscaling-common'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IScalableTarget } from './scalable-target'; -import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action'; - -export interface BasicStepScalingPolicyProps { - /** - * Metric to scale on. - */ - readonly metric: cloudwatch.IMetric; - - /** - * The intervals for scaling. - * - * Maps a range of metric values to a particular scaling behavior. - */ - readonly scalingSteps: ScalingInterval[]; - - /** - * How the adjustment numbers inside 'intervals' are interpreted. - * - * @default ChangeInCapacity - */ - readonly adjustmentType?: AdjustmentType; - - /** - * Grace period after scaling activity. - * - * Subsequent scale outs during the cooldown period are squashed so that only - * the biggest scale out happens. - * - * Subsequent scale ins during the cooldown period are ignored. - * - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html - * @default No cooldown period - */ - readonly cooldown?: cdk.Duration; - - /** - * Minimum absolute number to adjust capacity with as result of percentage scaling. - * - * Only when using AdjustmentType = PercentChangeInCapacity, this number controls - * the minimum absolute effect size. - * - * @default No minimum scaling effect - */ - readonly minAdjustmentMagnitude?: number; - - /** - * How many evaluation periods of the metric to wait before triggering a scaling action - * - * Raising this value can be used to smooth out the metric, at the expense - * of slower response times. - * - * If `datapointsToAlarm` is not set, then all data points in the evaluation period - * must meet the criteria to trigger a scaling action. - * - * @default 1 - */ - readonly evaluationPeriods?: number; - - /** - * The number of data points out of the evaluation periods that must be breaching to - * trigger a scaling action - * - * Creates an "M out of N" alarm, where this property is the M and the value set for - * `evaluationPeriods` is the N value. - * - * Only has meaning if `evaluationPeriods != 1`. - * - * @default `evaluationPeriods` - */ - readonly datapointsToAlarm?: number; - - /** - * Aggregation to apply to all data points over the evaluation periods - * - * Only has meaning if `evaluationPeriods != 1`. - * - * @default - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE. - */ - readonly metricAggregationType?: MetricAggregationType; -} - -export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { - /** - * The scaling target - */ - readonly scalingTarget: IScalableTarget; -} - -/** - * Define a scaling strategy which scales depending on absolute values of some metric. - * - * You can specify the scaling behavior for various values of the metric. - * - * Implemented using one or more CloudWatch alarms and Step Scaling Policies. - */ -export class StepScalingPolicy extends Construct { - public readonly lowerAlarm?: cloudwatch.Alarm; - public readonly lowerAction?: StepScalingAction; - public readonly upperAlarm?: cloudwatch.Alarm; - public readonly upperAction?: StepScalingAction; - - constructor(scope: Construct, id: string, props: StepScalingPolicyProps) { - super(scope, id); - - if (props.scalingSteps.length < 2) { - throw new Error('You must supply at least 2 intervals for autoscaling'); - } - - if (props.datapointsToAlarm !== undefined && props.datapointsToAlarm < 1) { - throw new RangeError(`datapointsToAlarm cannot be less than 1, got: ${props.datapointsToAlarm}`); - } - - const adjustmentType = props.adjustmentType || AdjustmentType.CHANGE_IN_CAPACITY; - const changesAreAbsolute = adjustmentType === AdjustmentType.EXACT_CAPACITY; - - const intervals = normalizeIntervals(props.scalingSteps, changesAreAbsolute); - const alarms = findAlarmThresholds(intervals); - - if (alarms.lowerAlarmIntervalIndex !== undefined) { - const threshold = intervals[alarms.lowerAlarmIntervalIndex].upper; - - this.lowerAction = new StepScalingAction(this, 'LowerPolicy', { - adjustmentType, - cooldown: props.cooldown, - metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), - minAdjustmentMagnitude: props.minAdjustmentMagnitude, - scalingTarget: props.scalingTarget, - }); - - for (let i = alarms.lowerAlarmIntervalIndex; i >= 0; i--) { - this.lowerAction.addAdjustment({ - adjustment: intervals[i].change!, - lowerBound: i !== 0 ? intervals[i].lower - threshold : undefined, // Extend last interval to -infinity - upperBound: intervals[i].upper - threshold, - }); - } - - this.lowerAlarm = new cloudwatch.Alarm(this, 'LowerAlarm', { - // Recommended by AutoScaling - metric: props.metric, - alarmDescription: 'Lower threshold scaling alarm', - comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD, - evaluationPeriods: props.evaluationPeriods ?? 1, - datapointsToAlarm: props.datapointsToAlarm, - threshold, - }); - this.lowerAlarm.addAlarmAction(new StepScalingAlarmAction(this.lowerAction)); - } - - if (alarms.upperAlarmIntervalIndex !== undefined) { - const threshold = intervals[alarms.upperAlarmIntervalIndex].lower; - - this.upperAction = new StepScalingAction(this, 'UpperPolicy', { - adjustmentType, - cooldown: props.cooldown, - metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), - minAdjustmentMagnitude: props.minAdjustmentMagnitude, - scalingTarget: props.scalingTarget, - }); - - for (let i = alarms.upperAlarmIntervalIndex; i < intervals.length; i++) { - this.upperAction.addAdjustment({ - adjustment: intervals[i].change!, - lowerBound: intervals[i].lower - threshold, - upperBound: i !== intervals.length - 1 ? intervals[i].upper - threshold : undefined, // Extend last interval to +infinity - }); - } - - this.upperAlarm = new cloudwatch.Alarm(this, 'UpperAlarm', { - // Recommended by AutoScaling - metric: props.metric, - alarmDescription: 'Upper threshold scaling alarm', - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD, - evaluationPeriods: props.evaluationPeriods ?? 1, - datapointsToAlarm: props.datapointsToAlarm, - threshold, - }); - this.upperAlarm.addAlarmAction(new StepScalingAlarmAction(this.upperAction)); - } - } -} - -/** - * A range of metric values in which to apply a certain scaling operation - */ -export interface ScalingInterval { - /** - * The lower bound of the interval. - * - * The scaling adjustment will be applied if the metric is higher than this value. - * - * @default Threshold automatically derived from neighbouring intervals - */ - readonly lower?: number; - - /** - * The upper bound of the interval. - * - * The scaling adjustment will be applied if the metric is lower than this value. - * - * @default Threshold automatically derived from neighbouring intervals - */ - readonly upper?: number; - - /** - * The capacity adjustment to apply in this interval - * - * The number is interpreted differently based on AdjustmentType: - * - * - ChangeInCapacity: add the adjustment to the current capacity. - * The number can be positive or negative. - * - PercentChangeInCapacity: add or remove the given percentage of the current - * capacity to itself. The number can be in the range [-100..100]. - * - ExactCapacity: set the capacity to this number. The number must - * be positive. - */ - readonly change: number; -} - -function aggregationTypeFromMetric(metric: cloudwatch.IMetric): MetricAggregationType | undefined { - const statistic = metric.toMetricConfig().metricStat?.statistic; - if (statistic == null) { return undefined; } // Math expression, don't know aggregation, leave default - - switch (statistic) { - case 'Average': - return MetricAggregationType.AVERAGE; - case 'Minimum': - return MetricAggregationType.MINIMUM; - case 'Maximum': - return MetricAggregationType.MAXIMUM; - default: - return MetricAggregationType.AVERAGE; - } -} - -/** - * Use a StepScalingAction as an Alarm Action - * - * This class is here and not in aws-cloudwatch-actions because this library - * needs to use the class, and otherwise we'd have a circular dependency: - * - * aws-autoscaling -> aws-cloudwatch-actions (for using the Action) - * aws-cloudwatch-actions -> aws-autoscaling (for the definition of IStepScalingAction) - */ -class StepScalingAlarmAction implements cloudwatch.IAlarmAction { - constructor(private readonly stepScalingAction: StepScalingAction) { - } - - public bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { - return { alarmActionArn: this.stepScalingAction.scalingPolicyArn }; - } -} diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts deleted file mode 100644 index 5bb7214c4c350..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts +++ /dev/null @@ -1,292 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnScalingPolicy } from './applicationautoscaling.generated'; -import { IScalableTarget } from './scalable-target'; - -/** - * Base interface for target tracking props - * - * Contains the attributes that are common to target tracking policies, - * except the ones relating to the metric and to the scalable target. - * - * This interface is reused by more specific target tracking props objects - * in other services. - */ -export interface BaseTargetTrackingProps { - /** - * A name for the scaling policy - * - * @default - Automatically generated name. - */ - readonly policyName?: string; - - /** - * Indicates whether scale in by the target tracking policy is disabled. - * - * If the value is true, scale in is disabled and the target tracking policy - * won't remove capacity from the scalable resource. Otherwise, scale in is - * enabled and the target tracking policy can remove capacity from the - * scalable resource. - * - * @default false - */ - readonly disableScaleIn?: boolean; - - /** - * Period after a scale in activity completes before another scale in activity can start. - * - * @default Duration.seconds(300) for the following scalable targets: ECS services, - * Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, - * Amazon SageMaker endpoint variants, Custom resources. For all other scalable - * targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB - * global secondary indexes, Amazon Comprehend document classification endpoints, - * Lambda provisioned concurrency - */ - readonly scaleInCooldown?: cdk.Duration; - - /** - * Period after a scale out activity completes before another scale out activity can start. - * - * @default Duration.seconds(300) for the following scalable targets: ECS services, - * Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, - * Amazon SageMaker endpoint variants, Custom resources. For all other scalable - * targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB - * global secondary indexes, Amazon Comprehend document classification endpoints, - * Lambda provisioned concurrency - */ - readonly scaleOutCooldown?: cdk.Duration; -} - -/** - * Properties for a Target Tracking policy that include the metric but exclude the target - */ -export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackingProps { - /** - * The target value for the metric. - */ - readonly targetValue: number; - - /** - * A predefined metric for application autoscaling - * - * The metric must track utilization. Scaling out will happen if the metric is higher than - * the target value, scaling in will happen in the metric is lower than the target value. - * - * Exactly one of customMetric or predefinedMetric must be specified. - * - * @default - No predefined metrics. - */ - readonly predefinedMetric?: PredefinedMetric; - - /** - * Identify the resource associated with the metric type. - * - * Only used for predefined metric ALBRequestCountPerTarget. - * - * Example value: `app///targetgroup//` - * - * @default - No resource label. - */ - readonly resourceLabel?: string; - - /** - * A custom metric for application autoscaling - * - * The metric must track utilization. Scaling out will happen if the metric is higher than - * the target value, scaling in will happen in the metric is lower than the target value. - * - * Exactly one of customMetric or predefinedMetric must be specified. - * - * @default - No custom metric. - */ - readonly customMetric?: cloudwatch.IMetric; -} - -/** - * Properties for a concrete TargetTrackingPolicy - * - * Adds the scalingTarget. - */ -export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps { - /* - * The scalable target - */ - readonly scalingTarget: IScalableTarget; -} - -export class TargetTrackingScalingPolicy extends Construct { - /** - * ARN of the scaling policy - */ - public readonly scalingPolicyArn: string; - - constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps) { - if ((props.customMetric === undefined) === (props.predefinedMetric === undefined)) { - throw new Error('Exactly one of \'customMetric\' or \'predefinedMetric\' must be specified.'); - } - - if (props.customMetric && !props.customMetric.toMetricConfig().metricStat) { - throw new Error('Only direct metrics are supported for Target Tracking. Use Step Scaling or supply a Metric object.'); - } - - super(scope, id); - - // replace dummy value in DYNAMODB_WRITE_CAPACITY_UTILIZATION due to a jsii bug (https://github.com/aws/jsii/issues/2782) - const predefinedMetric = props.predefinedMetric === PredefinedMetric.DYNAMODB_WRITE_CAPACITY_UTILIZATION ? - PredefinedMetric.DYANMODB_WRITE_CAPACITY_UTILIZATION : - props.predefinedMetric; - - const resource = new CfnScalingPolicy(this, 'Resource', { - policyName: props.policyName || cdk.Names.uniqueId(this), - policyType: 'TargetTrackingScaling', - scalingTargetId: props.scalingTarget.scalableTargetId, - targetTrackingScalingPolicyConfiguration: { - customizedMetricSpecification: renderCustomMetric(props.customMetric), - disableScaleIn: props.disableScaleIn, - predefinedMetricSpecification: predefinedMetric !== undefined ? { - predefinedMetricType: predefinedMetric, - resourceLabel: props.resourceLabel, - } : undefined, - scaleInCooldown: props.scaleInCooldown && props.scaleInCooldown.toSeconds(), - scaleOutCooldown: props.scaleOutCooldown && props.scaleOutCooldown.toSeconds(), - targetValue: props.targetValue, - }, - }); - - this.scalingPolicyArn = resource.ref; - } -} - -function renderCustomMetric(metric?: cloudwatch.IMetric): CfnScalingPolicy.CustomizedMetricSpecificationProperty | undefined { - if (!metric) { return undefined; } - const c = metric.toMetricConfig().metricStat!; - - if (c.statistic.startsWith('p')) { - throw new Error(`Cannot use statistic '${c.statistic}' for Target Tracking: only 'Average', 'Minimum', 'Maximum', 'SampleCount', and 'Sum' are supported.`); - } - - return { - dimensions: c.dimensions, - metricName: c.metricName, - namespace: c.namespace, - statistic: c.statistic, - unit: c.unitFilter, - }; -} - -/** - * One of the predefined autoscaling metrics - */ -export enum PredefinedMetric { - /** - * Average percentage of instances in an AppStream fleet that are being used. - */ - APPSTREAM_AVERAGE_CAPACITY_UTILIZATION = 'AppStreamAverageCapacityUtilization', - /** - * Percentage of provisioned read capacity units utilized by a Keyspaces table. - */ - CASSANDRA_READ_CAPACITY_UTILIZATION = 'CassandraReadCapacityUtilization', - /** - * Percentage of provisioned write capacity units utilized by a Keyspaces table. - */ - CASSANDRA_WRITE_CAPACITY_UTILIZATION = 'CassandraWriteCapacityUtilization', - /** - * Percentage of provisioned inference units utilized by a Comprehend endpoint. - */ - COMPREHEND_INFERENCE_UTILIZATION = 'ComprehendInferenceUtilization', - /** - * Average CPU Utilization of read replica instances in a Neptune DB cluster. - */ - NEPTURE_READER_AVERAGE_CPU_UTILIZATION = 'NeptuneReaderAverageCPUUtilization', - /** - * Percentage of provisioned read capacity units consumed by a DynamoDB table. - */ - DYNAMODB_READ_CAPACITY_UTILIZATION = 'DynamoDBReadCapacityUtilization', - /** - * Percentage of provisioned write capacity units consumed by a DynamoDB table. - * - * Suffix `dummy` is necessary due to jsii bug (https://github.com/aws/jsii/issues/2782). - * Duplicate values will be dropped, so this suffix is added as a workaround. - * The value will be replaced when this enum is used. - * - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - DYNAMODB_WRITE_CAPACITY_UTILIZATION = 'DynamoDBWriteCapacityUtilization-dummy', - /** - * DYANMODB_WRITE_CAPACITY_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - * @deprecated use `PredefinedMetric.DYNAMODB_WRITE_CAPACITY_UTILIZATION` - */ - DYANMODB_WRITE_CAPACITY_UTILIZATION = 'DynamoDBWriteCapacityUtilization', - /** - * ALB_REQUEST_COUNT_PER_TARGET - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - ALB_REQUEST_COUNT_PER_TARGET = 'ALBRequestCountPerTarget', - /** - * RDS_READER_AVERAGE_CPU_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - RDS_READER_AVERAGE_CPU_UTILIZATION = 'RDSReaderAverageCPUUtilization', - /** - * RDS_READER_AVERAGE_DATABASE_CONNECTIONS - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - RDS_READER_AVERAGE_DATABASE_CONNECTIONS = 'RDSReaderAverageDatabaseConnections', - /** - * EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION = 'EC2SpotFleetRequestAverageCPUUtilization', - /** - * EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN = 'EC2SpotFleetRequestAverageNetworkIn', - /** - * EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT = 'EC2SpotFleetRequestAverageNetworkOut', - /** - * SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE = 'SageMakerVariantInvocationsPerInstance', - /** - * ECS_SERVICE_AVERAGE_CPU_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - ECS_SERVICE_AVERAGE_CPU_UTILIZATION = 'ECSServiceAverageCPUUtilization', - /** - * ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION = 'ECSServiceAverageMemoryUtilization', - /** - * LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION - * @see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency - */ - LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION = 'LambdaProvisionedConcurrencyUtilization', - /** - * KAFKA_BROKER_STORAGE_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - KAFKA_BROKER_STORAGE_UTILIZATION = 'KafkaBrokerStorageUtilization', - /** - * ELASTIC_CACHE_PRIMARY_ENGINE_CPU_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION = 'ElastiCachePrimaryEngineCPUUtilization', - /** - * ELASTIC_CACHE_REPLICA_ENGINE_CPU_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - ELASTICACHE_REPLICA_ENGINE_CPU_UTILIZATION = 'ElastiCacheReplicaEngineCPUUtilization', - /** - * ELASTIC_CACHE_REPLICA_ENGINE_CPU_UTILIZATION - * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html - */ - ELASTICACHE_DATABASE_MEMORY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE = 'ElastiCacheDatabaseMemoryUsageCountedForEvictPercentage', -} diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package.json b/packages/@aws-cdk/aws-applicationautoscaling/package.json deleted file mode 100644 index 9ad744901bf79..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/package.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "name": "@aws-cdk/aws-applicationautoscaling", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ApplicationAutoScaling", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.applicationautoscaling", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "applicationautoscaling" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ApplicationAutoScaling", - "packageId": "Amazon.CDK.AWS.ApplicationAutoScaling", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-applicationautoscaling", - "module": "aws_cdk.aws_applicationautoscaling", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-applicationautoscaling" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ApplicationAutoScaling", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "applicationautoscaling" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "fast-check": "^2.25.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-autoscaling-common": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-autoscaling-common": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "nyc": { - "branches": 65, - "statements": 75 - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-applicationautoscaling.ScalableTargetProps", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicyProps.scalingTarget", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.ScalableTarget.fromScalableTargetId", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.StepScalingPolicy.lowerAction", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.StepScalingPolicy.lowerAlarm", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.StepScalingPolicy.upperAction", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.StepScalingPolicy.upperAlarm", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.TargetTrackingScalingPolicy", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.BasicStepScalingPolicyProps", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.IScalableTarget", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.IScalableTarget.scalableTargetId", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.StepScalingPolicyProps", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.ECS_SERVICE_AVERAGE_CPU_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.DYNAMODB_READ_CAPACITY_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.DYNAMODB_WRITE_CAPACITY_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.DYANMODB_WRITE_CAPACITY_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.ALB_REQUEST_COUNT_PER_TARGET", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.RDS_READER_AVERAGE_CPU_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.RDS_READER_AVERAGE_DATABASE_CONNECTIONS", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT", - "docs-public-apis:@aws-cdk/aws-applicationautoscaling.PredefinedMetric.SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-applicationautoscaling/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-applicationautoscaling/rosetta/default.ts-fixture deleted file mode 100644 index 9a75db0061b9d..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/rosetta/default.ts-fixture +++ /dev/null @@ -1,48 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct, Node } from 'constructs'; -import { Aspects, CfnOutput, Stack, Duration, Resource, SecretValue } from '@aws-cdk/core'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; - - -interface UtilizationScalingProps { - readonly targetUtilizationPercent: number; -} - -class ScalableAttribute { - public scaleOnSchedule(id: string, action: appscaling.ScalingSchedule) { - Array.isArray(id); - Array.isArray(action); - } - public scaleOnUtilization(props: UtilizationScalingProps) { - Array.isArray(props); - } - public scaleOnMetric(id: string, props: appscaling.BasicStepScalingPolicyProps) { - Array.isArray(id); - Array.isArray(props); - } -} - -interface Caps { - readonly minCapacity: number; - readonly maxCapacity: number; -} - -class SomeScalableResource { - public autoScaleCapacity(caps: Caps) { - return new ScalableAttribute(); - } -} - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - - - diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/schedule.test.ts b/packages/@aws-cdk/aws-applicationautoscaling/test/schedule.test.ts deleted file mode 100644 index 976c1863ca991..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/schedule.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Duration, Stack, Lazy } from '@aws-cdk/core'; -import * as appscaling from '../lib'; - -describe('cron', () => { - test('test utc cron, hour only', () => { - expect(appscaling.Schedule.cron({ hour: '18', minute: '0' }).expressionString).toEqual('cron(0 18 * * ? *)'); - - }); - - test('test utc cron, hour and minute', () => { - expect(appscaling.Schedule.cron({ hour: '18', minute: '24' }).expressionString).toEqual('cron(24 18 * * ? *)'); - - }); -}); - -describe('rate', () => { - test('rate must be whole number of minutes', () => { - expect(() => { - appscaling.Schedule.rate(Duration.minutes(0.13456)); - }).toThrow(/'0.13456 minutes' cannot be converted into a whole number of seconds/); - - }); - - test('rate can be in seconds', () => { - const duration = appscaling.Schedule.rate(Duration.seconds(120)); - expect('rate(2 minutes)').toEqual(duration.expressionString); - - }); - - test('rate must not be in seconds when specified as a token', () => { - expect(() => { - appscaling.Schedule.rate(Duration.seconds(Lazy.number({ produce: () => 5 }))); - }).toThrow(/Allowed units for scheduling/); - - }); - - test('rate cannot be 0', () => { - expect(() => { - appscaling.Schedule.rate(Duration.days(0)); - }).toThrow(/Duration cannot be 0/); - - }); - - test('rate can be token', () => { - const stack = new Stack(); - const lazyDuration = Duration.minutes(Lazy.number({ produce: () => 5 })); - const rate = appscaling.Schedule.rate(lazyDuration); - expect('rate(5 minutes)').toEqual(stack.resolve(rate).expressionString); - - }); - - test('rate can be in allowed type hours', () => { - expect('rate(1 hour)').toEqual(appscaling.Schedule.rate(Duration.hours(1)) - .expressionString); - - }); -}); - -describe('expression', () => { - test('test using a literal schedule expression', () => { - expect(appscaling.Schedule.expression('cron(0 18 * * ? *)').expressionString).toEqual('cron(0 18 * * ? *)'); - - }); -}); - -describe('at', () => { - test('test using at with a specific Date', () => { - expect(appscaling.Schedule.at(new Date(Date.UTC(2021, 10, 26))).expressionString).toEqual('at(2021-11-26T00:00:00)'); - }); -}); diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/util.ts b/packages/@aws-cdk/aws-applicationautoscaling/test/util.ts deleted file mode 100644 index 36929eb527e0f..0000000000000 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/util.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as scalingcommon from '@aws-cdk/aws-autoscaling-common'; -import * as constructs from 'constructs'; -import * as fc from 'fast-check'; -import * as appscaling from '../lib'; - -export function createScalableTarget(scope: constructs.Construct) { - return new appscaling.ScalableTarget(scope, 'Target', { - serviceNamespace: appscaling.ServiceNamespace.DYNAMODB, - scalableDimension: 'test:TestCount', - resourceId: 'test:this/test', - minCapacity: 1, - maxCapacity: 20, - }); -} - -export class ArbitraryInputIntervals extends fc.Arbitrary { - public generate(mrng: fc.Random): fc.Shrinkable { - const ret = scalingcommon.generateArbitraryIntervals(mrng); - return new fc.Shrinkable(ret.intervals); - } -} - -export function arbitrary_input_intervals() { - return new ArbitraryInputIntervals(); -} diff --git a/packages/@aws-cdk/aws-applicationinsights/.eslintrc.js b/packages/@aws-cdk/aws-applicationinsights/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-applicationinsights/.gitignore b/packages/@aws-cdk/aws-applicationinsights/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-applicationinsights/.npmignore b/packages/@aws-cdk/aws-applicationinsights/.npmignore deleted file mode 100644 index 6aadbb833a3bb..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-applicationinsights/LICENSE b/packages/@aws-cdk/aws-applicationinsights/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-applicationinsights/NOTICE b/packages/@aws-cdk/aws-applicationinsights/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-applicationinsights/README.md b/packages/@aws-cdk/aws-applicationinsights/README.md deleted file mode 100644 index 914b24f8666e2..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ApplicationInsights Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as applicationinsights from '@aws-cdk/aws-applicationinsights'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ApplicationInsights construct libraries](https://constructs.dev/search?q=applicationinsights) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ApplicationInsights resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApplicationInsights.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ApplicationInsights](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApplicationInsights.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-applicationinsights/jest.config.js b/packages/@aws-cdk/aws-applicationinsights/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-applicationinsights/lib/index.ts b/packages/@aws-cdk/aws-applicationinsights/lib/index.ts deleted file mode 100644 index 2af597d5caeae..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ApplicationInsights CloudFormation Resources: -export * from './applicationinsights.generated'; diff --git a/packages/@aws-cdk/aws-applicationinsights/package.json b/packages/@aws-cdk/aws-applicationinsights/package.json deleted file mode 100644 index dca55a0c2885e..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-applicationinsights", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ApplicationInsights", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ApplicationInsights", - "packageId": "Amazon.CDK.AWS.ApplicationInsights", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.applicationinsights", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "applicationinsights" - } - }, - "python": { - "distName": "aws-cdk.aws-applicationinsights", - "module": "aws_cdk.aws_applicationinsights", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-applicationinsights" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ApplicationInsights", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ApplicationInsights", - "aws-applicationinsights" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-applicationinsights/test/applicationinsights.test.ts b/packages/@aws-cdk/aws-applicationinsights/test/applicationinsights.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-applicationinsights/test/applicationinsights.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-appmesh/.eslintrc.js b/packages/@aws-cdk/aws-appmesh/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appmesh/.gitignore b/packages/@aws-cdk/aws-appmesh/.gitignore deleted file mode 100644 index 15ec5f91e143a..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-appmesh/.npmignore b/packages/@aws-cdk/aws-appmesh/.npmignore deleted file mode 100644 index 8990240425fe4..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-appmesh/LICENSE b/packages/@aws-cdk/aws-appmesh/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-appmesh/NOTICE b/packages/@aws-cdk/aws-appmesh/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-appmesh/README.md b/packages/@aws-cdk/aws-appmesh/README.md deleted file mode 100644 index 9e1f46e84ee96..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/README.md +++ /dev/null @@ -1,893 +0,0 @@ -# AWS App Mesh Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -AWS App Mesh is a service mesh based on the [Envoy](https://www.envoyproxy.io/) proxy that makes it easy to monitor and control microservices. App Mesh standardizes how your microservices communicate, giving you end-to-end visibility and helping to ensure high-availability for your applications. - -App Mesh gives you consistent visibility and network traffic controls for every microservice in an application. - -App Mesh supports microservice applications that use service discovery naming for their components. To use App Mesh, you must have an existing application running on AWS Fargate, Amazon ECS, Amazon EKS, Kubernetes on AWS, or Amazon EC2. - -For further information on **AWS App Mesh**, visit the [AWS App Mesh Documentation](https://docs.aws.amazon.com/app-mesh/index.html). - -## Create the App and Stack - -```ts -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'stack'); -``` - -## Creating the Mesh - -A service mesh is a logical boundary for network traffic between the services that reside within it. - -After you create your service mesh, you can create virtual services, virtual nodes, virtual routers, and routes to distribute traffic between the applications in your mesh. - -The following example creates the `AppMesh` service mesh with the default egress filter of `DROP_ALL`. See [the AWS CloudFormation `EgressFilter` resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-mesh-egressfilter.html) for more info on egress filters. - -```ts -const mesh = new appmesh.Mesh(this, 'AppMesh', { - meshName: 'myAwsMesh', -}); -``` - -The mesh can instead be created with the `ALLOW_ALL` egress filter by providing the `egressFilter` property. - -```ts -const mesh = new appmesh.Mesh(this, 'AppMesh', { - meshName: 'myAwsMesh', - egressFilter: appmesh.MeshFilterType.ALLOW_ALL, -}); -``` - -A mesh with an IP preference can be created by providing the property `serviceDiscovery` that specifes an `ipPreference`. - -```ts -const mesh = new appmesh.Mesh(this, 'AppMesh', { - meshName: 'myAwsMesh', - serviceDiscovery: { - ipPreference: appmesh.IpPreference.IPV4_ONLY, - }, -}); -``` - -## Adding VirtualRouters - -A _mesh_ uses _virtual routers_ as logical units to route requests to _virtual nodes_. - -Virtual routers handle traffic for one or more virtual services within your mesh. -After you create a virtual router, you can create and associate routes to your virtual router that direct incoming requests to different virtual nodes. - -```ts -declare const mesh: appmesh.Mesh; -const router = mesh.addVirtualRouter('router', { - listeners: [appmesh.VirtualRouterListener.http(8080)], -}); -``` - -Note that creating the router using the `addVirtualRouter()` method places it in the same stack as the mesh -(which might be different from the current stack). -The router can also be created using the `VirtualRouter` constructor (passing in the mesh) instead of calling the `addVirtualRouter()` method. -This is particularly useful when splitting your resources between many stacks: for example, defining the mesh itself as part of an infrastructure stack, but defining the other resources, such as routers, in the application stack: - -```ts -declare const infraStack: cdk.Stack; -declare const appStack: cdk.Stack; - -const mesh = new appmesh.Mesh(infraStack, 'AppMesh', { - meshName: 'myAwsMesh', - egressFilter: appmesh.MeshFilterType.ALLOW_ALL, -}); - -// the VirtualRouter will belong to 'appStack', -// even though the Mesh belongs to 'infraStack' -const router = new appmesh.VirtualRouter(appStack, 'router', { - mesh, // notice that mesh is a required property when creating a router with the 'new' statement - listeners: [appmesh.VirtualRouterListener.http(8081)], -}); -``` - -The same is true for other `add*()` methods in the App Mesh construct library. - -The `VirtualRouterListener` class lets you define protocol-specific listeners. -The `http()`, `http2()`, `grpc()` and `tcp()` methods create listeners for the named protocols. -They accept a single parameter that defines the port to on which requests will be matched. -The port parameter defaults to 8080 if omitted. - -## Adding a VirtualService - -A _virtual service_ is an abstraction of a real service that is provided by a virtual node directly, or indirectly by means of a virtual router. Dependent services call your virtual service by its `virtualServiceName`, and those requests are routed to the virtual node or virtual router specified as the provider for the virtual service. - -We recommend that you use the service discovery name of the real service that you're targeting (such as `my-service.default.svc.cluster.local`). - -When creating a virtual service: - -- If you want the virtual service to spread traffic across multiple virtual nodes, specify a virtual router. -- If you want the virtual service to reach a virtual node directly, without a virtual router, specify a virtual node. - -Adding a virtual router as the provider: - -```ts -declare const router: appmesh.VirtualRouter; - -new appmesh.VirtualService(this, 'virtual-service', { - virtualServiceName: 'my-service.default.svc.cluster.local', // optional - virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router), -}); -``` - -Adding a virtual node as the provider: - -```ts -declare const node: appmesh.VirtualNode; - -new appmesh.VirtualService(this, 'virtual-service', { - virtualServiceName: `my-service.default.svc.cluster.local`, // optional - virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node), -}); -``` - -## Adding a VirtualNode - -A _virtual node_ acts as a logical pointer to a particular task group, such as an Amazon ECS service or a Kubernetes deployment. - -When you create a virtual node, accept inbound traffic by specifying a *listener*. Outbound traffic that your virtual node expects to send should be specified as a *back end*. - -The response metadata for your new virtual node contains the Amazon Resource Name (ARN) that is associated with the virtual node. Set this value (either the full ARN or the truncated resource name) as the `APPMESH_VIRTUAL_NODE_NAME` environment variable for your task group's Envoy proxy container in your task definition or pod spec. For example, the value could be `mesh/default/virtualNode/simpleapp`. This is then mapped to the `node.id` and `node.cluster` Envoy parameters. - -> **Note** -> If you require your Envoy stats or tracing to use a different name, you can override the `node.cluster` value that is set by `APPMESH_VIRTUAL_NODE_NAME` with the `APPMESH_VIRTUAL_NODE_CLUSTER` environment variable. - -```ts -const vpc = new ec2.Vpc(this, 'vpc'); -const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', { - vpc, - name: 'domain.local', -}); -const service = namespace.createService('Svc'); - -declare const mesh: appmesh.Mesh; -const node = mesh.addVirtualNode('virtual-node', { - serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), - listeners: [appmesh.VirtualNodeListener.http({ - port: 8081, - healthCheck: appmesh.HealthCheck.http({ - healthyThreshold: 3, - interval: cdk.Duration.seconds(5), // minimum - path: '/health-check-path', - timeout: cdk.Duration.seconds(2), // minimum - unhealthyThreshold: 2, - }), - })], - accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), -}); -``` - -Create a `VirtualNode` with the constructor and add tags. - -```ts -declare const mesh: appmesh.Mesh; -declare const service: cloudmap.Service; - -const node = new appmesh.VirtualNode(this, 'node', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), - listeners: [appmesh.VirtualNodeListener.http({ - port: 8080, - healthCheck: appmesh.HealthCheck.http({ - healthyThreshold: 3, - interval: cdk.Duration.seconds(5), - path: '/ping', - timeout: cdk.Duration.seconds(2), - unhealthyThreshold: 2, - }), - timeout: { - idle: cdk.Duration.seconds(5), - }, - })], - backendDefaults: { - tlsClientPolicy: { - validation: { - trust: appmesh.TlsValidationTrust.file('/keys/local_cert_chain.pem'), - }, - }, - }, - accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), -}); - -cdk.Tags.of(node).add('Environment', 'Dev'); -``` - -Create a `VirtualNode` with the constructor and add backend virtual service. - -```ts -declare const mesh: appmesh.Mesh; -declare const router: appmesh.VirtualRouter; -declare const service: cloudmap.Service; - -const node = new appmesh.VirtualNode(this, 'node', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), - listeners: [appmesh.VirtualNodeListener.http({ - port: 8080, - healthCheck: appmesh.HealthCheck.http({ - healthyThreshold: 3, - interval: cdk.Duration.seconds(5), - path: '/ping', - timeout: cdk.Duration.seconds(2), - unhealthyThreshold: 2, - }), - timeout: { - idle: cdk.Duration.seconds(5), - }, - })], - accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), -}); - -const virtualService = new appmesh.VirtualService(this, 'service-1', { - virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router), - virtualServiceName: 'service1.domain.local', -}); - -node.addBackend(appmesh.Backend.virtualService(virtualService)); -``` - -The `listeners` property can be left blank and added later with the `node.addListener()` method. The `serviceDiscovery` property must be specified when specifying a listener. - -The `backends` property can be added with `node.addBackend()`. In the example, we define a virtual service and add it to the virtual node to allow egress traffic to other nodes. - -The `backendDefaults` property is added to the node while creating the virtual node. These are the virtual node's default settings for all backends. - -The `VirtualNode.addBackend()` method is especially useful if you want to create a circular traffic flow by having a Virtual Service as a backend whose provider is that same Virtual Node: - -```ts -declare const mesh: appmesh.Mesh; - -const node = new appmesh.VirtualNode(this, 'node', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.dns('node'), -}); - -const virtualService = new appmesh.VirtualService(this, 'service-1', { - virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node), - virtualServiceName: 'service1.domain.local', -}); - -node.addBackend(appmesh.Backend.virtualService(virtualService)); -``` - -### Adding TLS to a listener - -The `tls` property specifies TLS configuration when creating a listener for a virtual node or a virtual gateway. -Provide the TLS certificate to the proxy in one of the following ways: - -- A certificate from AWS Certificate Manager (ACM). - -- A customer-provided certificate (specify a `certificateChain` path file and a `privateKey` file path). - -- A certificate provided by a Secrets Discovery Service (SDS) endpoint over local Unix Domain Socket (specify its `secretName`). - -```ts -// A Virtual Node with listener TLS from an ACM provided certificate -declare const cert: certificatemanager.Certificate; -declare const mesh: appmesh.Mesh; - -const node = new appmesh.VirtualNode(this, 'node', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.dns('node'), - listeners: [appmesh.VirtualNodeListener.grpc({ - port: 80, - tls: { - mode: appmesh.TlsMode.STRICT, - certificate: appmesh.TlsCertificate.acm(cert), - }, - })], -}); - -// A Virtual Gateway with listener TLS from a customer provided file certificate -const gateway = new appmesh.VirtualGateway(this, 'gateway', { - mesh, - listeners: [appmesh.VirtualGatewayListener.grpc({ - port: 8080, - tls: { - mode: appmesh.TlsMode.STRICT, - certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'), - }, - })], - virtualGatewayName: 'gateway', -}); - -// A Virtual Gateway with listener TLS from a SDS provided certificate -const gateway2 = new appmesh.VirtualGateway(this, 'gateway2', { - mesh, - listeners: [appmesh.VirtualGatewayListener.http2({ - port: 8080, - tls: { - mode: appmesh.TlsMode.STRICT, - certificate: appmesh.TlsCertificate.sds('secrete_certificate'), - }, - })], - virtualGatewayName: 'gateway2', -}); -``` - -### Adding mutual TLS authentication - -Mutual TLS authentication is an optional component of TLS that offers two-way peer authentication. -To enable mutual TLS authentication, add the `mutualTlsCertificate` property to TLS client policy and/or the `mutualTlsValidation` property to your TLS listener. - -`tls.mutualTlsValidation` and `tlsClientPolicy.mutualTlsCertificate` can be sourced from either: - -- A customer-provided certificate (specify a `certificateChain` path file and a `privateKey` file path). - -- A certificate provided by a Secrets Discovery Service (SDS) endpoint over local Unix Domain Socket (specify its `secretName`). - -> **Note** -> Currently, a certificate from AWS Certificate Manager (ACM) cannot be used for mutual TLS authentication. - -```ts -declare const mesh: appmesh.Mesh; - -const node1 = new appmesh.VirtualNode(this, 'node1', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.dns('node'), - listeners: [appmesh.VirtualNodeListener.grpc({ - port: 80, - tls: { - mode: appmesh.TlsMode.STRICT, - certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'), - // Validate a file client certificates to enable mutual TLS authentication when a client provides a certificate. - mutualTlsValidation: { - trust: appmesh.TlsValidationTrust.file('path-to-certificate'), - }, - }, - })], -}); - -const certificateAuthorityArn = 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012'; -const node2 = new appmesh.VirtualNode(this, 'node2', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.dns('node2'), - backendDefaults: { - tlsClientPolicy: { - ports: [8080, 8081], - validation: { - subjectAlternativeNames: appmesh.SubjectAlternativeNames.matchingExactly('mesh-endpoint.apps.local'), - trust: appmesh.TlsValidationTrust.acm([ - acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'certificate', certificateAuthorityArn)]), - }, - // Provide a SDS client certificate when a server requests it and enable mutual TLS authentication. - mutualTlsCertificate: appmesh.TlsCertificate.sds('secret_certificate'), - }, - }, -}); -``` - -### Adding outlier detection to a Virtual Node listener - -The `outlierDetection` property adds outlier detection to a Virtual Node listener. The properties -`baseEjectionDuration`, `interval`, `maxEjectionPercent`, and `maxServerErrors` are required. - -```ts -// Cloud Map service discovery is currently required for host ejection by outlier detection -const vpc = new ec2.Vpc(this, 'vpc'); -const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', { - vpc, - name: 'domain.local', -}); -const service = namespace.createService('Svc'); - -declare const mesh: appmesh.Mesh; -const node = mesh.addVirtualNode('virtual-node', { - serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), - listeners: [appmesh.VirtualNodeListener.http({ - outlierDetection: { - baseEjectionDuration: cdk.Duration.seconds(10), - interval: cdk.Duration.seconds(30), - maxEjectionPercent: 50, - maxServerErrors: 5, - }, - })], -}); -``` - -### Adding a connection pool to a listener - -The `connectionPool` property can be added to a Virtual Node listener or Virtual Gateway listener to add a request connection pool. Each listener protocol type has its own connection pool properties. - -```ts -// A Virtual Node with a gRPC listener with a connection pool set -declare const mesh: appmesh.Mesh; -const node = new appmesh.VirtualNode(this, 'node', { - mesh, - // DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS. - // LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints, - // whereas ENDPOINTS means that the DNS resolver is returning all the endpoints. - // By default, the response type is assumed to be LOAD_BALANCER - serviceDiscovery: appmesh.ServiceDiscovery.dns('node', appmesh.DnsResponseType.ENDPOINTS), - listeners: [appmesh.VirtualNodeListener.http({ - port: 80, - connectionPool: { - maxConnections: 100, - maxPendingRequests: 10, - }, - })], -}); - -// A Virtual Gateway with a gRPC listener with a connection pool set -const gateway = new appmesh.VirtualGateway(this, 'gateway', { - mesh, - listeners: [appmesh.VirtualGatewayListener.grpc({ - port: 8080, - connectionPool: { - maxRequests: 10, - }, - })], - virtualGatewayName: 'gateway', -}); -``` - -### Adding an IP Preference to a Virtual Node - -An `ipPreference` can be specified as part of a Virtual Node's service discovery. An IP preference defines how clients for this Virtual Node will interact with it. - -There a four different IP preferences available to use which each specify what IP versions this Virtual Node will use and prefer. - -- `IPv4_ONLY` - Only use IPv4. For CloudMap service discovery, only IPv4 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv4. - -- `IPv4_PREFERRED` - Prefer IPv4 and fall back to IPv6. For CloudMap service discovery, an IPv4 address will be used if returned from CloudMap. Otherwise, an IPv6 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv4 and fall back to IPv6. - -- `IPv6_ONLY` - Only use IPv6. For CloudMap service discovery, only IPv6 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv6. - -- `IPv6_PREFERRED` - Prefer IPv6 and fall back to IPv4. For CloudMap service discovery, an IPv6 address will be used if returned from CloudMap. Otherwise, an IPv4 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv6 and fall back to IPv4. - -```ts -const mesh = new appmesh.Mesh(stack, 'mesh', { - meshName: 'mesh-with-preference', -}); - -// Virtual Node with DNS service discovery and an IP preference -const dnsNode = new appmesh.VirtualNode(stack, 'dns-node', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.dns('test', appmesh.DnsResponseType.LOAD_BALANCER, appmesh.IpPreference.IPV4_ONLY), -}); - -// Virtual Node with CloudMap service discovery and an IP preference -const vpc = new ec2.Vpc(stack, 'vpc'); -const namespace = new cloudmap.PrivateDnsNamespace(stack, 'test-namespace', { - vpc, - name: 'domain.local', -}); -const service = namespace.createService('Svc'); - -const instanceAttribute : { [key: string]: string} = {}; -instanceAttribute.testKey = 'testValue'; - -const cloudmapNode = new appmesh.VirtualNode(stack, 'cloudmap-node', { - mesh, - serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service, instanceAttribute, appmesh.IpPreference.IPV4_ONLY), -}); -``` - -## Adding a Route - -A _route_ matches requests with an associated virtual router and distributes traffic to its associated virtual nodes. -The route distributes matching requests to one or more target virtual nodes with relative weighting. - -The `RouteSpec` class lets you define protocol-specific route specifications. -The `tcp()`, `http()`, `http2()`, and `grpc()` methods create a specification for the named protocols. - -For HTTP-based routes, the match field can match on path (prefix, exact, or regex), HTTP method, scheme, -HTTP headers, and query parameters. By default, HTTP-based routes match all requests. - -For gRPC-based routes, the match field can match on service name, method name, and metadata. -When specifying the method name, the service name must also be specified. - -For example, here's how to add an HTTP route that matches based on a prefix of the URL path: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-http', { - routeSpec: appmesh.RouteSpec.http({ - weightedTargets: [ - { - virtualNode: node, - }, - ], - match: { - // Path that is passed to this method must start with '/'. - path: appmesh.HttpRoutePathMatch.startsWith('/path-to-app'), - }, - }), -}); -``` - -Add an HTTP2 route that matches based on exact path, method, scheme, headers, and query parameters: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-http2', { - routeSpec: appmesh.RouteSpec.http2({ - weightedTargets: [ - { - virtualNode: node, - }, - ], - match: { - path: appmesh.HttpRoutePathMatch.exactly('/exact'), - method: appmesh.HttpRouteMethod.POST, - protocol: appmesh.HttpRouteProtocol.HTTPS, - headers: [ - // All specified headers must match for the route to match. - appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'), - appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'), - ], - queryParameters: [ - // All specified query parameters must match for the route to match. - appmesh.QueryParameterMatch.valueIs('query-field', 'value') - ], - }, - }), -}); -``` - -Add a single route with two targets and split traffic 50/50: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-http', { - routeSpec: appmesh.RouteSpec.http({ - weightedTargets: [ - { - virtualNode: node, - weight: 50, - }, - { - virtualNode: node, - weight: 50, - }, - ], - match: { - path: appmesh.HttpRoutePathMatch.startsWith('/path-to-app'), - }, - }), -}); -``` - -Add an http2 route with retries: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-http2-retry', { - routeSpec: appmesh.RouteSpec.http2({ - weightedTargets: [{ virtualNode: node }], - retryPolicy: { - // Retry if the connection failed - tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR], - // Retry if HTTP responds with a gateway error (502, 503, 504) - httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR], - // Retry five times - retryAttempts: 5, - // Use a 1 second timeout per retry - retryTimeout: cdk.Duration.seconds(1), - }, - }), -}); -``` - -Add a gRPC route with retries: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-grpc-retry', { - routeSpec: appmesh.RouteSpec.grpc({ - weightedTargets: [{ virtualNode: node }], - match: { serviceName: 'servicename' }, - retryPolicy: { - tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR], - httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR], - // Retry if gRPC responds that the request was cancelled, a resource - // was exhausted, or if the service is unavailable - grpcRetryEvents: [ - appmesh.GrpcRetryEvent.CANCELLED, - appmesh.GrpcRetryEvent.RESOURCE_EXHAUSTED, - appmesh.GrpcRetryEvent.UNAVAILABLE, - ], - retryAttempts: 5, - retryTimeout: cdk.Duration.seconds(1), - }, - }), -}); -``` - -Add an gRPC route that matches based on method name and metadata: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-grpc-retry', { - routeSpec: appmesh.RouteSpec.grpc({ - weightedTargets: [{ virtualNode: node }], - match: { - // When method name is specified, service name must be also specified. - methodName: 'methodname', - serviceName: 'servicename', - metadata: [ - // All specified metadata must match for the route to match. - appmesh.HeaderMatch.valueStartsWith('Content-Type', 'application/'), - appmesh.HeaderMatch.valueDoesNotStartWith('Content-Type', 'text/'), - ], - }, - }), -}); -``` - -Add a gRPC route with timeout: - -```ts -declare const router: appmesh.VirtualRouter; -declare const node: appmesh.VirtualNode; - -router.addRoute('route-http', { - routeSpec: appmesh.RouteSpec.grpc({ - weightedTargets: [ - { - virtualNode: node, - }, - ], - match: { - serviceName: 'my-service.default.svc.cluster.local', - }, - timeout: { - idle : cdk.Duration.seconds(2), - perRequest: cdk.Duration.seconds(1), - }, - }), -}); -``` - -## Adding a Virtual Gateway - -A _virtual gateway_ allows resources outside your mesh to communicate with resources inside your mesh. -The virtual gateway represents an Envoy proxy running in an Amazon ECS task, in a Kubernetes service, or on an Amazon EC2 instance. -Unlike a virtual node, which represents Envoy running with an application, a virtual gateway represents Envoy deployed by itself. - -A virtual gateway is similar to a virtual node in that it has a listener that accepts traffic for a particular port and protocol (HTTP, HTTP2, gRPC). -Traffic received by the virtual gateway is directed to other services in your mesh -using rules defined in gateway routes which can be added to your virtual gateway. - -Create a virtual gateway with the constructor: - -```ts -declare const mesh: appmesh.Mesh; -const certificateAuthorityArn = 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012'; - -const gateway = new appmesh.VirtualGateway(this, 'gateway', { - mesh: mesh, - listeners: [appmesh.VirtualGatewayListener.http({ - port: 443, - healthCheck: appmesh.HealthCheck.http({ - interval: cdk.Duration.seconds(10), - }), - })], - backendDefaults: { - tlsClientPolicy: { - ports: [8080, 8081], - validation: { - trust: appmesh.TlsValidationTrust.acm([ - acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'certificate', certificateAuthorityArn)]), - }, - }, - }, - accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), - virtualGatewayName: 'virtualGateway', -}); -``` - -Add a virtual gateway directly to the mesh: - -```ts -declare const mesh: appmesh.Mesh; - -const gateway = mesh.addVirtualGateway('gateway', { - accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), - virtualGatewayName: 'virtualGateway', - listeners: [appmesh.VirtualGatewayListener.http({ - port: 443, - healthCheck: appmesh.HealthCheck.http({ - interval: cdk.Duration.seconds(10), - }), - })], -}); -``` - -The `listeners` field defaults to an HTTP Listener on port 8080 if omitted. -A gateway route can be added using the `gateway.addGatewayRoute()` method. - -The `backendDefaults` property, provided when creating the virtual gateway, specifies the virtual gateway's default settings for all backends. - -## Adding a Gateway Route - -A _gateway route_ is attached to a virtual gateway and routes matching traffic to an existing virtual service. - -For HTTP-based gateway routes, the `match` field can be used to match on -path (prefix, exact, or regex), HTTP method, host name, HTTP headers, and query parameters. -By default, HTTP-based gateway routes match all requests. - -```ts -declare const gateway: appmesh.VirtualGateway; -declare const virtualService: appmesh.VirtualService; - -gateway.addGatewayRoute('gateway-route-http', { - routeSpec: appmesh.GatewayRouteSpec.http({ - routeTarget: virtualService, - match: { - path: appmesh.HttpGatewayRoutePathMatch.regex('regex'), - }, - }), -}); -``` - -For gRPC-based gateway routes, the `match` field can be used to match on service name, host name, and metadata. - -```ts -declare const gateway: appmesh.VirtualGateway; -declare const virtualService: appmesh.VirtualService; - -gateway.addGatewayRoute('gateway-route-grpc', { - routeSpec: appmesh.GatewayRouteSpec.grpc({ - routeTarget: virtualService, - match: { - hostname: appmesh.GatewayRouteHostnameMatch.endsWith('.example.com'), - }, - }), -}); -``` - -For HTTP based gateway routes, App Mesh automatically rewrites the matched prefix path in Gateway Route to “/”. -This automatic rewrite configuration can be overwritten in following ways: - -```ts -declare const gateway: appmesh.VirtualGateway; -declare const virtualService: appmesh.VirtualService; - -gateway.addGatewayRoute('gateway-route-http', { - routeSpec: appmesh.GatewayRouteSpec.http({ - routeTarget: virtualService, - match: { - // This disables the default rewrite to '/', and retains original path. - path: appmesh.HttpGatewayRoutePathMatch.startsWith('/path-to-app/', ''), - }, - }), -}); - -gateway.addGatewayRoute('gateway-route-http-1', { - routeSpec: appmesh.GatewayRouteSpec.http({ - routeTarget: virtualService, - match: { - // If the request full path is '/path-to-app/xxxxx', this rewrites the path to '/rewrittenUri/xxxxx'. - // Please note both `prefixPathMatch` and `rewriteTo` must start and end with the `/` character. - path: appmesh.HttpGatewayRoutePathMatch.startsWith('/path-to-app/', '/rewrittenUri/'), - }, - }), -}); -``` - -If matching other path (exact or regex), only specific rewrite path can be specified. -Unlike `startsWith()` method above, no default rewrite is performed. - -```ts -declare const gateway: appmesh.VirtualGateway; -declare const virtualService: appmesh.VirtualService; - -gateway.addGatewayRoute('gateway-route-http-2', { - routeSpec: appmesh.GatewayRouteSpec.http({ - routeTarget: virtualService, - match: { - // This rewrites the path from '/test' to '/rewrittenPath'. - path: appmesh.HttpGatewayRoutePathMatch.exactly('/test', '/rewrittenPath'), - }, - }), -}); -``` - -For HTTP/gRPC based routes, App Mesh automatically rewrites -the original request received at the Virtual Gateway to the destination Virtual Service name. -This default host name rewrite can be configured by specifying the rewrite rule as one of the `match` property: - -```ts -declare const gateway: appmesh.VirtualGateway; -declare const virtualService: appmesh.VirtualService; - -gateway.addGatewayRoute('gateway-route-grpc', { - routeSpec: appmesh.GatewayRouteSpec.grpc({ - routeTarget: virtualService, - match: { - hostname: appmesh.GatewayRouteHostnameMatch.exactly('example.com'), - // This disables the default rewrite to virtual service name and retain original request. - rewriteRequestHostname: false, - }, - }), -}); -``` - -## Importing Resources - -Each App Mesh resource class comes with two static methods, `fromArn` and `fromAttributes` (where `` is replaced with the resource name, such as `VirtualNode`) for importing a reference to an existing App Mesh resource. -These imported resources can be used with other resources in your mesh as if they were defined directly in your CDK application. - -```ts -const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh/virtualNode/testNode'; -appmesh.VirtualNode.fromVirtualNodeArn(this, 'importedVirtualNode', arn); -``` - -```ts -const virtualNodeName = 'my-virtual-node'; -appmesh.VirtualNode.fromVirtualNodeAttributes(this, 'imported-virtual-node', { - mesh: appmesh.Mesh.fromMeshName(this, 'Mesh', 'testMesh'), - virtualNodeName: virtualNodeName, -}); -``` - -To import a mesh, again there are two static methods, `fromMeshArn` and `fromMeshName`. - -```ts -const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh'; -appmesh.Mesh.fromMeshArn(this, 'imported-mesh', arn); -``` - -```ts -appmesh.Mesh.fromMeshName(this, 'imported-mesh', 'abc'); -``` - -## IAM Grants - -`VirtualNode` and `VirtualGateway` provide `grantStreamAggregatedResources` methods that grant identities that are running -Envoy access to stream generated config from App Mesh. - -```ts -declare const mesh: appmesh.Mesh; -const gateway = new appmesh.VirtualGateway(this, 'testGateway', { mesh }); -const envoyUser = new iam.User(this, 'envoyUser'); - -/** - * This will grant `grantStreamAggregatedResources` ONLY for this gateway. - */ -gateway.grantStreamAggregatedResources(envoyUser) -``` - -## Adding Resources to shared meshes - -A shared mesh allows resources created by different accounts to communicate with each other in the same mesh: - -```ts -// This is the ARN for the mesh from different AWS IAM account ID. -// Ensure mesh is properly shared with your account. For more details, see: https://github.com/aws/aws-cdk/issues/15404 -const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh'; -const sharedMesh = appmesh.Mesh.fromMeshArn(this, 'imported-mesh', arn); - -// This VirtualNode resource can communicate with the resources in the mesh from different AWS IAM account ID. -new appmesh.VirtualNode(this, 'test-node', { - mesh: sharedMesh, -}); -``` diff --git a/packages/@aws-cdk/aws-appmesh/jest.config.js b/packages/@aws-cdk/aws-appmesh/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appmesh/lib/private/utils.ts b/packages/@aws-cdk/aws-appmesh/lib/private/utils.ts deleted file mode 100644 index 249c4254ce5c0..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/lib/private/utils.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { Token, TokenComparison } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnVirtualNode } from '../appmesh.generated'; -import { GrpcGatewayRouteMatch } from '../gateway-route-spec'; -import { HeaderMatch } from '../header-match'; -import { ListenerTlsOptions } from '../listener-tls-options'; -import { QueryParameterMatch } from '../query-parameter-match'; -import { GrpcRouteMatch } from '../route-spec'; -import { TlsClientPolicy } from '../tls-client-policy'; - -/** - * Generated Connection pool config - */ -export interface ConnectionPoolConfig { - /** - * The maximum connections in the pool - * - * @default - none - */ - readonly maxConnections?: number; - - /** - * The maximum pending requests in the pool - * - * @default - none - */ - readonly maxPendingRequests?: number; - - /** - * The maximum requests in the pool - * - * @default - none - */ - readonly maxRequests?: number; -} - -/** - * This is the helper method to render TLS property of client policy. - */ -export function renderTlsClientPolicy(scope: Construct, tlsClientPolicy: TlsClientPolicy | undefined) - : CfnVirtualNode.ClientPolicyTlsProperty | undefined { - const certificate = tlsClientPolicy?.mutualTlsCertificate?.bind(scope).tlsCertificate; - const sans = tlsClientPolicy?.validation.subjectAlternativeNames; - - return tlsClientPolicy - ? { - certificate: certificate, - ports: tlsClientPolicy.ports, - enforce: tlsClientPolicy.enforce, - validation: { - subjectAlternativeNames: sans - ? { - match: sans.bind(scope).subjectAlternativeNamesMatch, - } - : undefined, - trust: tlsClientPolicy.validation.trust.bind(scope).tlsValidationTrust, - }, - } - : undefined; -} - -/** - * This is the helper method to render the TLS config for a listener. - */ -export function renderListenerTlsOptions(scope: Construct, listenerTls: ListenerTlsOptions | undefined) - : CfnVirtualNode.ListenerTlsProperty | undefined { - const tlsValidation = listenerTls?.mutualTlsValidation; - - return listenerTls - ? { - certificate: listenerTls.certificate.bind(scope).tlsCertificate, - mode: listenerTls.mode, - validation: tlsValidation - ? { - subjectAlternativeNames: tlsValidation.subjectAlternativeNames - ? { - match: tlsValidation.subjectAlternativeNames.bind(scope).subjectAlternativeNamesMatch, - } - : undefined, - trust: tlsValidation.trust.bind(scope).tlsValidationTrust, - } - : undefined, - } - : undefined; -} - -/** - * This is the helper method to populate mesh owner when it is a shared mesh scenario - */ -export function renderMeshOwner(resourceAccount: string, meshAccount: string) : string | undefined { - const comparison = Token.compareStrings(resourceAccount, meshAccount); - return comparison === TokenComparison.DIFFERENT || comparison === TokenComparison.ONE_UNRESOLVED - ? meshAccount - : undefined; -} - -/** - * This is the helper method to validate the length of HTTP match array when it is specified. - */ -export function validateHttpMatchArrayLength(headers?: HeaderMatch[], queryParameters?: QueryParameterMatch[]) { - const MIN_LENGTH = 1; - const MAX_LENGTH = 10; - - if (headers && (headers.length < MIN_LENGTH || headers.length > MAX_LENGTH)) { - throw new Error(`Number of headers provided for matching must be between ${MIN_LENGTH} and ${MAX_LENGTH}, got: ${headers.length}`); - } - - if (queryParameters && (queryParameters.length < MIN_LENGTH || queryParameters.length > MAX_LENGTH)) { - throw new Error(`Number of query parameters provided for matching must be between ${MIN_LENGTH} and ${MAX_LENGTH}, got: ${queryParameters.length}`); - } -} - -/** - * This is the helper method to validate the length of gRPC match array when it is specified. - */ -export function validateGrpcMatchArrayLength(metadata?: HeaderMatch[]): void { - const MIN_LENGTH = 1; - const MAX_LENGTH = 10; - - if (metadata && (metadata.length < MIN_LENGTH || metadata.length > MAX_LENGTH)) { - throw new Error(`Number of metadata provided for matching must be between ${MIN_LENGTH} and ${MAX_LENGTH}, got: ${metadata.length}`); - } -} - -/** - * This is the helper method to validate at least one of gRPC route match type is defined. - */ -export function validateGrpcRouteMatch(match: GrpcRouteMatch): void { - if (match.serviceName === undefined && match.metadata === undefined && match.methodName === undefined) { - throw new Error('At least one gRPC route match property must be provided'); - } -} - -/** - * This is the helper method to validate at least one of gRPC gateway route match type is defined. - */ -export function validateGrpcGatewayRouteMatch(match: GrpcGatewayRouteMatch): void { - if (match.serviceName === undefined && match.metadata === undefined && match.hostname === undefined) { - throw new Error('At least one gRPC gateway route match property beside rewriteRequestHostname must be provided'); - } -} diff --git a/packages/@aws-cdk/aws-appmesh/package.json b/packages/@aws-cdk/aws-appmesh/package.json deleted file mode 100644 index a85fb342c5360..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/package.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "name": "@aws-cdk/aws-appmesh", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AppMesh", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AppMesh", - "packageId": "Amazon.CDK.AWS.AppMesh", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.appmesh", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "appmesh" - } - }, - "python": { - "distName": "aws-cdk.aws-appmesh", - "module": "aws_cdk.aws_appmesh", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-appmesh" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AppMesh", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "statements": 75 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AppMesh", - "aws-appmesh" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "construct-ctor-props-type:@aws-cdk/aws-appmesh.ImportedMesh", - "construct-ctor-props-type:@aws-cdk/aws-appmesh.ImportedRoute", - "construct-ctor-props-type:@aws-cdk/aws-appmesh.ImportedVirtualNode", - "construct-ctor-props-type:@aws-cdk/aws-appmesh.ImportedVirtualRouter", - "construct-ctor-props-type:@aws-cdk/aws-appmesh.ImportedVirtualService", - "from-signature:@aws-cdk/aws-appmesh.Route.fromRouteName", - "from-signature:@aws-cdk/aws-appmesh.VirtualNode.fromVirtualNodeName", - "from-signature:@aws-cdk/aws-appmesh.VirtualRouter.fromVirtualRouterName", - "from-signature:@aws-cdk/aws-appmesh.VirtualService.fromVirtualServiceName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayRoute.gatewayRouteMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayRoute.gatewayRouteMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayRoute.gatewayRouteResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayRoute.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayRoute.gatewayRouteVirtualGatewayName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayGrpcRoute.gatewayRouteMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayGrpcRoute.gatewayRouteMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayGrpcRoute.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayGrpcRoute.gatewayRouteResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayGrpcRoute.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayGrpcRoute.gatewayRouteVirtualGatewayName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttp2Route.gatewayRouteMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttp2Route.gatewayRouteMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttp2Route.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttp2Route.gatewayRouteResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttp2Route.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttp2Route.gatewayRouteVirtualGatewayName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttpRoute.gatewayRouteMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttpRoute.gatewayRouteMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttpRoute.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttpRoute.gatewayRouteResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttpRoute.gatewayRouteUid", - "resource-attribute:@aws-cdk/aws-appmesh.GatewayHttpRoute.gatewayRouteVirtualGatewayName", - "resource-attribute:@aws-cdk/aws-appmesh.IMesh.meshUid", - "resource-attribute:@aws-cdk/aws-appmesh.IRoute.routeUid", - "resource-attribute:@aws-cdk/aws-appmesh.IVirtualNode.virtualNodeUid", - "resource-attribute:@aws-cdk/aws-appmesh.IVirtualRouter.virtualRouterUid", - "resource-attribute:@aws-cdk/aws-appmesh.IVirtualService.virtualServiceUid", - "resource-attribute:@aws-cdk/aws-appmesh.Mesh.meshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.Mesh.meshResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.Mesh.meshUid", - "resource-attribute:@aws-cdk/aws-appmesh.Route.routeMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.Route.routeMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.Route.routeResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.Route.routeUid", - "resource-attribute:@aws-cdk/aws-appmesh.Route.routeVirtualRouterName", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualGateway.virtualGatewayMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualGateway.virtualGatewayMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualGateway.virtualGatewayResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualGateway.virtualGatewayUid", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualNode.virtualNodeMeshName", - "duration-prop-type:@aws-cdk/aws-appmesh.VirtualNodeListener.timeout", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualNode.virtualNodeMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualNode.virtualNodeResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualNode.virtualNodeUid", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualRouter.virtualRouterMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualRouter.virtualRouterMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualRouter.virtualRouterResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualRouter.virtualRouterUid", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualService.virtualServiceMeshName", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualService.virtualServiceMeshOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualService.virtualServiceResourceOwner", - "resource-attribute:@aws-cdk/aws-appmesh.VirtualService.virtualServiceUid", - "docs-public-apis:@aws-cdk/aws-appmesh.Protocol.TCP", - "docs-public-apis:@aws-cdk/aws-appmesh.VirtualRouter", - "props-default-doc:@aws-cdk/aws-appmesh.VirtualRouterAttributes.mesh", - "props-default-doc:@aws-cdk/aws-appmesh.VirtualRouterAttributes.meshName", - "props-default-doc:@aws-cdk/aws-appmesh.VirtualRouterAttributes.virtualRouterArn", - "props-default-doc:@aws-cdk/aws-appmesh.VirtualRouterAttributes.virtualRouterName", - "docs-public-apis:@aws-cdk/aws-appmesh.Protocol.HTTP", - "docs-public-apis:@aws-cdk/aws-appmesh.Protocol.HTTP2", - "docs-public-apis:@aws-cdk/aws-appmesh.Protocol.GRPC", - "duration-prop-type:@aws-cdk/aws-appmesh.GrpcVirtualNodeListenerOptions.timeout", - "duration-prop-type:@aws-cdk/aws-appmesh.HttpVirtualNodeListenerOptions.timeout", - "duration-prop-type:@aws-cdk/aws-appmesh.Http2VirtualNodeListenerOptions.timeout", - "duration-prop-type:@aws-cdk/aws-appmesh.TcpVirtualNodeListenerOptions.timeout", - "duration-prop-type:@aws-cdk/aws-appmesh.GrpcRouteSpecOptions.timeout", - "duration-prop-type:@aws-cdk/aws-appmesh.HttpRouteSpecOptions.timeout", - "duration-prop-type:@aws-cdk/aws-appmesh.TcpRouteSpecOptions.timeout", - "no-unused-type:@aws-cdk/aws-appmesh.Protocol" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-appmesh/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-appmesh/rosetta/default.ts-fixture deleted file mode 100644 index 09e9b7277edcb..0000000000000 --- a/packages/@aws-cdk/aws-appmesh/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import cdk = require('@aws-cdk/core'); -import acmpca = require('@aws-cdk/aws-acmpca'); -import appmesh = require('@aws-cdk/aws-appmesh'); -import certificatemanager = require('@aws-cdk/aws-certificatemanager'); -import cloudmap = require('@aws-cdk/aws-servicediscovery'); -import ec2 = require('@aws-cdk/aws-ec2'); -import iam = require('@aws-cdk/aws-iam'); - -class Fixture extends cdk.Stack { - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-apprunner/.eslintrc.js b/packages/@aws-cdk/aws-apprunner/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-apprunner/.eslintrc.js +++ b/packages/@aws-cdk/aws-apprunner/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-apprunner/.gitignore b/packages/@aws-cdk/aws-apprunner/.gitignore index a103aefa2bfbb..276e2e169d01b 100644 --- a/packages/@aws-cdk/aws-apprunner/.gitignore +++ b/packages/@aws-cdk/aws-apprunner/.gitignore @@ -22,3 +22,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-apprunner/README.md b/packages/@aws-cdk/aws-apprunner/README.md index d67688c002d62..80e3bbf100830 100644 --- a/packages/@aws-cdk/aws-apprunner/README.md +++ b/packages/@aws-cdk/aws-apprunner/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -24,7 +18,7 @@ This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. ```ts nofixture -import * as apprunner from '@aws-cdk/aws-apprunner'; +import * as apprunner from '@aws-cdk/aws-apprunner-alpha'; ``` ## Introduction @@ -59,7 +53,7 @@ new apprunner.Service(this, 'Service', { To create a `Service` from an existing ECR repository: ```ts -import * as ecr from '@aws-cdk/aws-ecr'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; new apprunner.Service(this, 'Service', { source: apprunner.Source.fromEcr({ @@ -75,7 +69,7 @@ To create a `Service` from local docker image asset directory built and pushed t You can specify whether to enable continuous integration from the source repository with the `autoDeploymentsEnabled` flag. ```ts -import * as assets from '@aws-cdk/aws-ecr-assets'; +import * as assets from 'aws-cdk-lib/aws-ecr-assets'; const imageAsset = new assets.DockerImageAsset(this, 'ImageAssets', { directory: path.join(__dirname, './docker.assets'), @@ -143,7 +137,7 @@ See [App Runner IAM Roles](https://docs.aws.amazon.com/apprunner/latest/dg/secur To associate an App Runner service with a custom VPC, define `vpcConnector` for the service. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const vpc = new ec2.Vpc(this, 'Vpc', { ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16') @@ -171,8 +165,8 @@ You can use the `addSecret` method from the App Runner `Service` class to includ service definition. ```ts -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; declare const stack: Stack; diff --git a/packages/@aws-cdk/aws-apprunner/lib/index.ts b/packages/@aws-cdk/aws-apprunner/lib/index.ts index 3c5400bf44a0d..e061d5b7ecf80 100644 --- a/packages/@aws-cdk/aws-apprunner/lib/index.ts +++ b/packages/@aws-cdk/aws-apprunner/lib/index.ts @@ -1,4 +1,3 @@ // AWS::AppRunner CloudFormation Resources: -export * from './apprunner.generated'; export * from './service'; export * from './vpc-connector'; diff --git a/packages/@aws-cdk/aws-apprunner/lib/service.ts b/packages/@aws-cdk/aws-apprunner/lib/service.ts index 013431c207cdc..83751d07213d1 100644 --- a/packages/@aws-cdk/aws-apprunner/lib/service.ts +++ b/packages/@aws-cdk/aws-apprunner/lib/service.ts @@ -1,12 +1,12 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import * as assets from '@aws-cdk/aws-ecr-assets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; -import { Lazy } from '@aws-cdk/core'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as assets from 'aws-cdk-lib/aws-ecr-assets'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; +import * as cdk from 'aws-cdk-lib'; +import { Lazy } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnService } from './apprunner.generated'; +import { CfnService } from 'aws-cdk-lib/aws-apprunner'; import { IVpcConnector } from './vpc-connector'; /** diff --git a/packages/@aws-cdk/aws-apprunner/lib/vpc-connector.ts b/packages/@aws-cdk/aws-apprunner/lib/vpc-connector.ts index 8d09e5665a777..ab9e03d846065 100644 --- a/packages/@aws-cdk/aws-apprunner/lib/vpc-connector.ts +++ b/packages/@aws-cdk/aws-apprunner/lib/vpc-connector.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Connections } from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Connections } from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnVpcConnector } from './apprunner.generated'; +import { CfnVpcConnector } from 'aws-cdk-lib/aws-apprunner'; /** * Properties of the AppRunner VPC Connector diff --git a/packages/@aws-cdk/aws-apprunner/package.json b/packages/@aws-cdk/aws-apprunner/package.json index e4c4e7747b193..1756985bf5f50 100644 --- a/packages/@aws-cdk/aws-apprunner/package.json +++ b/packages/@aws-cdk/aws-apprunner/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-cdk/aws-apprunner", + "name": "@aws-cdk/aws-apprunner-alpha", "version": "0.0.0", "description": "The CDK Construct Library for AWS::AppRunner", "main": "lib/index.js", @@ -16,17 +16,17 @@ }, "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.AppRunner", - "packageId": "Amazon.CDK.AWS.AppRunner", + "namespace": "Amazon.CDK.AWS.AppRunner.Alpha", + "packageId": "Amazon.CDK.AWS.AppRunner.Alpha", "signAssembly": true, "assemblyOriginatorKeyFile": "../../key.snk", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.apprunner", + "package": "software.amazon.awscdk.services.apprunner.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "apprunner" + "artifactId": "apprunner-alpha" } }, "python": { @@ -34,8 +34,12 @@ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ], - "distName": "aws-cdk.aws-apprunner", - "module": "aws_cdk.aws_apprunner" + "distName": "aws-cdk.aws-apprunner-alpha", + "module": "aws_cdk.aws_apprunner_alpha" + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkapprunneralpha" } } }, @@ -54,17 +58,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::AppRunner", "env": { "AWSLINT_BASE_CONSTRUCT": "true" } @@ -83,40 +84,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "constructs": "^10.0.0" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -128,7 +107,18 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" + }, + "private": false, + "awslint": { + "exclude": [ + "*:*" + ] }, - "private": true + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + } } diff --git a/packages/@aws-cdk/aws-apprunner/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-apprunner/rosetta/default.ts-fixture index 585b54c64cf81..345494f4f19f5 100644 --- a/packages/@aws-cdk/aws-apprunner/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-apprunner/rosetta/default.ts-fixture @@ -1,7 +1,7 @@ // Fixture with packages imported, but nothing else -import { Stack, SecretValue } from '@aws-cdk/core'; +import { Stack, SecretValue } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as apprunner from '@aws-cdk/aws-apprunner'; +import * as apprunner from '@aws-cdk/aws-apprunner-alpha'; import * as path from 'path'; class Fixture extends Stack { diff --git a/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr-public.ts b/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr-public.ts index 57cb5ccb48a73..e5df18bad4b7f 100644 --- a/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr-public.ts +++ b/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr-public.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { Service, Source } from '../lib'; diff --git a/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr.ts b/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr.ts index c6222abd7aa59..c828632d66df8 100644 --- a/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr.ts +++ b/packages/@aws-cdk/aws-apprunner/test/integ.service-ecr.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as assets from '@aws-cdk/aws-ecr-assets'; -import * as cdk from '@aws-cdk/core'; +import * as assets from 'aws-cdk-lib/aws-ecr-assets'; +import * as cdk from 'aws-cdk-lib'; import { Service, Source } from '../lib'; diff --git a/packages/@aws-cdk/aws-apprunner/test/integ.service-github.ts b/packages/@aws-cdk/aws-apprunner/test/integ.service-github.ts index 8813865f04259..98804d01765e6 100644 --- a/packages/@aws-cdk/aws-apprunner/test/integ.service-github.ts +++ b/packages/@aws-cdk/aws-apprunner/test/integ.service-github.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { Service, Source, GitHubConnection, ConfigurationSourceType, Runtime } from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apprunner/test/integ.service-later-secrets-env-vars.ts b/packages/@aws-cdk/aws-apprunner/test/integ.service-later-secrets-env-vars.ts index 163ea13282811..51c30102e4e66 100644 --- a/packages/@aws-cdk/aws-apprunner/test/integ.service-later-secrets-env-vars.ts +++ b/packages/@aws-cdk/aws-apprunner/test/integ.service-later-secrets-env-vars.ts @@ -1,6 +1,6 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as apprunner from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apprunner/test/integ.service-secrets-manager.ts b/packages/@aws-cdk/aws-apprunner/test/integ.service-secrets-manager.ts index 2adc7193cfee1..d521fe551054a 100644 --- a/packages/@aws-cdk/aws-apprunner/test/integ.service-secrets-manager.ts +++ b/packages/@aws-cdk/aws-apprunner/test/integ.service-secrets-manager.ts @@ -1,7 +1,7 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as apprunner from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-apprunner/test/integ.service-vpc-connector.ts b/packages/@aws-cdk/aws-apprunner/test/integ.service-vpc-connector.ts index 487a1b2569f14..2fbc037966af9 100644 --- a/packages/@aws-cdk/aws-apprunner/test/integ.service-vpc-connector.ts +++ b/packages/@aws-cdk/aws-apprunner/test/integ.service-vpc-connector.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { Service, Source, VpcConnector } from '../lib'; diff --git a/packages/@aws-cdk/aws-apprunner/test/service.test.ts b/packages/@aws-cdk/aws-apprunner/test/service.test.ts index 1c118fbdb0702..73d2f4c068993 100644 --- a/packages/@aws-cdk/aws-apprunner/test/service.test.ts +++ b/packages/@aws-cdk/aws-apprunner/test/service.test.ts @@ -1,13 +1,13 @@ import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecr_assets from '@aws-cdk/aws-ecr-assets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as apprunner from '../lib'; test('create a service with ECR Public(image repository type: ECR_PUBLIC)', () => { diff --git a/packages/@aws-cdk/aws-apprunner/test/vpc-connector.test.ts b/packages/@aws-cdk/aws-apprunner/test/vpc-connector.test.ts index 71baeac75b692..4cc432c975d96 100644 --- a/packages/@aws-cdk/aws-apprunner/test/vpc-connector.test.ts +++ b/packages/@aws-cdk/aws-apprunner/test/vpc-connector.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { VpcConnector } from '../lib'; test('create a vpcConnector with all properties', () => { diff --git a/packages/@aws-cdk/aws-appstream/.eslintrc.js b/packages/@aws-cdk/aws-appstream/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-appstream/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appstream/.gitignore b/packages/@aws-cdk/aws-appstream/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-appstream/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-appstream/.npmignore b/packages/@aws-cdk/aws-appstream/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/aws-appstream/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-appstream/LICENSE b/packages/@aws-cdk/aws-appstream/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-appstream/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-appstream/NOTICE b/packages/@aws-cdk/aws-appstream/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-appstream/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-appstream/README.md b/packages/@aws-cdk/aws-appstream/README.md deleted file mode 100644 index 3e8ee563aa29d..0000000000000 --- a/packages/@aws-cdk/aws-appstream/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon AppStream 2.0 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as appstream from '@aws-cdk/aws-appstream'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AppStream construct libraries](https://constructs.dev/search?q=appstream) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppStream resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppStream.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppStream](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppStream.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-appstream/jest.config.js b/packages/@aws-cdk/aws-appstream/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-appstream/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appstream/lib/index.ts b/packages/@aws-cdk/aws-appstream/lib/index.ts deleted file mode 100644 index 8c6fdee55650a..0000000000000 --- a/packages/@aws-cdk/aws-appstream/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AppStream CloudFormation Resources: -export * from './appstream.generated'; diff --git a/packages/@aws-cdk/aws-appstream/package.json b/packages/@aws-cdk/aws-appstream/package.json deleted file mode 100644 index 7bdc99e06f575..0000000000000 --- a/packages/@aws-cdk/aws-appstream/package.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "@aws-cdk/aws-appstream", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AppStream", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AppStream", - "packageId": "Amazon.CDK.AWS.AppStream", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.appstream", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "appstream" - } - }, - "python": { - "distName": "aws-cdk.aws-appstream", - "module": "aws_cdk.aws_appstream", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-appstream" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AppStream", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "aws-appstream" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-appstream/test/appstream.test.ts b/packages/@aws-cdk/aws-appstream/test/appstream.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/appstream.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/asset.e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041.bundle/index.js b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/asset.e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041.bundle/index.js deleted file mode 100644 index bbbe0310bc3dd..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/asset.e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041.bundle/index.js +++ /dev/null @@ -1,1051 +0,0 @@ -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// lib/assertions/providers/lambda-handler/index.ts -var lambda_handler_exports = {}; -__export(lambda_handler_exports, { - handler: () => handler, - isComplete: () => isComplete, - onTimeout: () => onTimeout -}); -module.exports = __toCommonJS(lambda_handler_exports); - -// ../assertions/lib/matcher.ts -var Matcher = class { - static isMatcher(x) { - return x && x instanceof Matcher; - } -}; -var MatchResult = class { - constructor(target) { - this.failuresHere = /* @__PURE__ */ new Map(); - this.captures = /* @__PURE__ */ new Map(); - this.finalized = false; - this.innerMatchFailures = /* @__PURE__ */ new Map(); - this._hasFailed = false; - this._failCount = 0; - this._cost = 0; - this.target = target; - } - push(matcher, path, message) { - return this.recordFailure({ matcher, path, message }); - } - recordFailure(failure) { - const failKey = failure.path.join("."); - let list = this.failuresHere.get(failKey); - if (!list) { - list = []; - this.failuresHere.set(failKey, list); - } - this._failCount += 1; - this._cost += failure.cost ?? 1; - list.push(failure); - this._hasFailed = true; - return this; - } - get isSuccess() { - return !this._hasFailed; - } - hasFailed() { - return this._hasFailed; - } - get failCount() { - return this._failCount; - } - get failCost() { - return this._cost; - } - compose(id, inner) { - if (inner.hasFailed()) { - this._hasFailed = true; - this._failCount += inner.failCount; - this._cost += inner._cost; - this.innerMatchFailures.set(id, inner); - } - inner.captures.forEach((vals, capture) => { - vals.forEach((value) => this.recordCapture({ capture, value })); - }); - return this; - } - finished() { - if (this.finalized) { - return this; - } - if (this.failCount === 0) { - this.captures.forEach((vals, cap) => cap._captured.push(...vals)); - } - this.finalized = true; - return this; - } - toHumanStrings() { - const failures = new Array(); - debugger; - recurse(this, []); - return failures.map((r) => { - const loc = r.path.length === 0 ? "" : ` at /${r.path.join("/")}`; - return "" + r.message + loc + ` (using ${r.matcher.name} matcher)`; - }); - function recurse(x, prefix) { - for (const fail of Array.from(x.failuresHere.values()).flat()) { - failures.push({ - matcher: fail.matcher, - message: fail.message, - path: [...prefix, ...fail.path] - }); - } - for (const [key, inner] of x.innerMatchFailures.entries()) { - recurse(inner, [...prefix, key]); - } - } - } - renderMismatch() { - if (!this.hasFailed()) { - return ""; - } - const parts = new Array(); - const indents = new Array(); - emitFailures(this, ""); - recurse(this); - return moveMarkersToFront(parts.join("").trimEnd()); - function emit(x) { - if (x === void 0) { - debugger; - } - parts.push(x.replace(/\n/g, ` -${indents.join("")}`)); - } - function emitFailures(r, path, scrapSet) { - for (const fail of r.failuresHere.get(path) ?? []) { - emit(`!! ${fail.message} -`); - } - scrapSet == null ? void 0 : scrapSet.delete(path); - } - function recurse(r) { - const remainingFailures = new Set(Array.from(r.failuresHere.keys()).filter((x) => x !== "")); - if (Array.isArray(r.target)) { - indents.push(" "); - emit("[\n"); - for (const [first, i] of enumFirst(range(r.target.length))) { - if (!first) { - emit(",\n"); - } - emitFailures(r, `${i}`, remainingFailures); - const innerMatcher = r.innerMatchFailures.get(`${i}`); - if (innerMatcher) { - emitFailures(innerMatcher, ""); - recurseComparingValues(innerMatcher, r.target[i]); - } else { - emit(renderAbridged(r.target[i])); - } - } - emitRemaining(); - indents.pop(); - emit("\n]"); - return; - } - if (r.target && typeof r.target === "object") { - indents.push(" "); - emit("{\n"); - const keys = Array.from(/* @__PURE__ */ new Set([ - ...Object.keys(r.target), - ...Array.from(remainingFailures) - ])).sort(); - for (const [first, key] of enumFirst(keys)) { - if (!first) { - emit(",\n"); - } - emitFailures(r, key, remainingFailures); - const innerMatcher = r.innerMatchFailures.get(key); - if (innerMatcher) { - emitFailures(innerMatcher, ""); - emit(`${jsonify(key)}: `); - recurseComparingValues(innerMatcher, r.target[key]); - } else { - emit(`${jsonify(key)}: `); - emit(renderAbridged(r.target[key])); - } - } - emitRemaining(); - indents.pop(); - emit("\n}"); - return; - } - emitRemaining(); - emit(jsonify(r.target)); - function emitRemaining() { - if (remainingFailures.size > 0) { - emit("\n"); - } - for (const key of remainingFailures) { - emitFailures(r, key); - } - } - } - function recurseComparingValues(inner, actualValue) { - if (inner.target === actualValue) { - return recurse(inner); - } - emit(renderAbridged(actualValue)); - emit(" <*> "); - recurse(inner); - } - function renderAbridged(x) { - if (Array.isArray(x)) { - switch (x.length) { - case 0: - return "[]"; - case 1: - return `[ ${renderAbridged(x[0])} ]`; - case 2: - if (x.every((e) => ["number", "boolean", "string"].includes(typeof e))) { - return `[ ${x.map(renderAbridged).join(", ")} ]`; - } - return "[ ... ]"; - default: - return "[ ... ]"; - } - } - if (x && typeof x === "object") { - const keys = Object.keys(x); - switch (keys.length) { - case 0: - return "{}"; - case 1: - return `{ ${JSON.stringify(keys[0])}: ${renderAbridged(x[keys[0]])} }`; - default: - return "{ ... }"; - } - } - return jsonify(x); - } - function jsonify(x) { - return JSON.stringify(x) ?? "undefined"; - } - function moveMarkersToFront(x) { - const re = /^(\s+)!!/gm; - return x.replace(re, (_, spaces) => `!!${spaces.substring(0, spaces.length - 2)}`); - } - } - recordCapture(options) { - let values = this.captures.get(options.capture); - if (values === void 0) { - values = []; - } - values.push(options.value); - this.captures.set(options.capture, values); - } -}; -function* range(n) { - for (let i = 0; i < n; i++) { - yield i; - } -} -function* enumFirst(xs) { - let first = true; - for (const x of xs) { - yield [first, x]; - first = false; - } -} - -// ../assertions/lib/private/matchers/absent.ts -var AbsentMatch = class extends Matcher { - constructor(name) { - super(); - this.name = name; - } - test(actual) { - const result = new MatchResult(actual); - if (actual !== void 0) { - result.recordFailure({ - matcher: this, - path: [], - message: `Received ${actual}, but key should be absent` - }); - } - return result; - } -}; - -// ../assertions/lib/private/sorting.ts -function sortKeyComparator(keyFn) { - return (a, b) => { - const ak = keyFn(a); - const bk = keyFn(b); - for (let i = 0; i < ak.length && i < bk.length; i++) { - const av = ak[i]; - const bv = bk[i]; - let diff = 0; - if (typeof av === "number" && typeof bv === "number") { - diff = av - bv; - } else if (typeof av === "string" && typeof bv === "string") { - diff = av.localeCompare(bv); - } - if (diff !== 0) { - return diff; - } - } - return bk.length - ak.length; - }; -} - -// ../assertions/lib/private/sparse-matrix.ts -var SparseMatrix = class { - constructor() { - this.matrix = /* @__PURE__ */ new Map(); - } - get(row, col) { - var _a; - return (_a = this.matrix.get(row)) == null ? void 0 : _a.get(col); - } - row(row) { - var _a; - return Array.from(((_a = this.matrix.get(row)) == null ? void 0 : _a.entries()) ?? []); - } - set(row, col, value) { - let r = this.matrix.get(row); - if (!r) { - r = /* @__PURE__ */ new Map(); - this.matrix.set(row, r); - } - r.set(col, value); - } -}; - -// ../assertions/lib/private/type.ts -function getType(obj) { - return Array.isArray(obj) ? "array" : typeof obj; -} - -// ../assertions/lib/match.ts -var Match = class { - static absent() { - return new AbsentMatch("absent"); - } - static arrayWith(pattern) { - return new ArrayMatch("arrayWith", pattern); - } - static arrayEquals(pattern) { - return new ArrayMatch("arrayEquals", pattern, { subsequence: false }); - } - static exact(pattern) { - return new LiteralMatch("exact", pattern, { partialObjects: false }); - } - static objectLike(pattern) { - return new ObjectMatch("objectLike", pattern); - } - static objectEquals(pattern) { - return new ObjectMatch("objectEquals", pattern, { partial: false }); - } - static not(pattern) { - return new NotMatch("not", pattern); - } - static serializedJson(pattern) { - return new SerializedJson("serializedJson", pattern); - } - static anyValue() { - return new AnyMatch("anyValue"); - } - static stringLikeRegexp(pattern) { - return new StringLikeRegexpMatch("stringLikeRegexp", pattern); - } -}; -var LiteralMatch = class extends Matcher { - constructor(name, pattern, options = {}) { - super(); - this.name = name; - this.pattern = pattern; - this.partialObjects = options.partialObjects ?? false; - if (Matcher.isMatcher(this.pattern)) { - throw new Error("LiteralMatch cannot directly contain another matcher. Remove the top-level matcher or nest it more deeply."); - } - } - test(actual) { - if (Array.isArray(this.pattern)) { - return new ArrayMatch(this.name, this.pattern, { subsequence: false, partialObjects: this.partialObjects }).test(actual); - } - if (typeof this.pattern === "object") { - return new ObjectMatch(this.name, this.pattern, { partial: this.partialObjects }).test(actual); - } - const result = new MatchResult(actual); - if (typeof this.pattern !== typeof actual) { - result.recordFailure({ - matcher: this, - path: [], - message: `Expected type ${typeof this.pattern} but received ${getType(actual)}` - }); - return result; - } - if (actual !== this.pattern) { - result.recordFailure({ - matcher: this, - path: [], - message: `Expected ${this.pattern} but received ${actual}` - }); - } - return result; - } -}; -var ArrayMatch = class extends Matcher { - constructor(name, pattern, options = {}) { - super(); - this.name = name; - this.pattern = pattern; - this.subsequence = options.subsequence ?? true; - this.partialObjects = options.partialObjects ?? false; - } - test(actual) { - if (!Array.isArray(actual)) { - return new MatchResult(actual).recordFailure({ - matcher: this, - path: [], - message: `Expected type array but received ${getType(actual)}` - }); - } - return this.subsequence ? this.testSubsequence(actual) : this.testFullArray(actual); - } - testFullArray(actual) { - const result = new MatchResult(actual); - let i = 0; - for (; i < this.pattern.length && i < actual.length; i++) { - const patternElement = this.pattern[i]; - const matcher = Matcher.isMatcher(patternElement) ? patternElement : new LiteralMatch(this.name, patternElement, { partialObjects: this.partialObjects }); - const innerResult = matcher.test(actual[i]); - result.compose(`${i}`, innerResult); - } - if (i < this.pattern.length) { - result.recordFailure({ - matcher: this, - message: `Not enough elements in array (expecting ${this.pattern.length}, got ${actual.length})`, - path: [`${i}`] - }); - } - if (i < actual.length) { - result.recordFailure({ - matcher: this, - message: `Too many elements in array (expecting ${this.pattern.length}, got ${actual.length})`, - path: [`${i}`] - }); - } - return result; - } - testSubsequence(actual) { - const result = new MatchResult(actual); - let patternIdx = 0; - let actualIdx = 0; - const matches = new SparseMatrix(); - while (patternIdx < this.pattern.length && actualIdx < actual.length) { - const patternElement = this.pattern[patternIdx]; - const matcher = Matcher.isMatcher(patternElement) ? patternElement : new LiteralMatch(this.name, patternElement, { partialObjects: this.partialObjects }); - const matcherName = matcher.name; - if (matcherName == "absent" || matcherName == "anyValue") { - throw new Error(`The Matcher ${matcherName}() cannot be nested within arrayWith()`); - } - const innerResult = matcher.test(actual[actualIdx]); - matches.set(patternIdx, actualIdx, innerResult); - actualIdx++; - if (innerResult.isSuccess) { - result.compose(`${actualIdx}`, innerResult); - patternIdx++; - } - } - if (patternIdx < this.pattern.length) { - for (let spi = 0; spi < patternIdx; spi++) { - const foundMatch = matches.row(spi).find(([, r]) => r.isSuccess); - if (!foundMatch) { - continue; - } - const [index] = foundMatch; - result.compose(`${index}`, new MatchResult(actual[index]).recordFailure({ - matcher: this, - message: `arrayWith pattern ${spi} matched here`, - path: [], - cost: 0 - })); - } - const failedMatches = matches.row(patternIdx); - failedMatches.sort(sortKeyComparator(([i, r]) => [r.failCost, i])); - if (failedMatches.length > 0) { - const [index, innerResult] = failedMatches[0]; - result.recordFailure({ - matcher: this, - message: `Could not match arrayWith pattern ${patternIdx}. This is the closest match`, - path: [`${index}`], - cost: 0 - }); - result.compose(`${index}`, innerResult); - } else { - result.recordFailure({ - matcher: this, - message: `Could not match arrayWith pattern ${patternIdx}. No more elements to try`, - path: [`${actual.length}`] - }); - } - } - return result; - } -}; -var ObjectMatch = class extends Matcher { - constructor(name, pattern, options = {}) { - super(); - this.name = name; - this.pattern = pattern; - this.partial = options.partial ?? true; - } - test(actual) { - if (typeof actual !== "object" || Array.isArray(actual)) { - return new MatchResult(actual).recordFailure({ - matcher: this, - path: [], - message: `Expected type object but received ${getType(actual)}` - }); - } - const result = new MatchResult(actual); - if (!this.partial) { - for (const a of Object.keys(actual)) { - if (!(a in this.pattern)) { - result.recordFailure({ - matcher: this, - path: [a], - message: `Unexpected key ${a}` - }); - } - } - } - for (const [patternKey, patternVal] of Object.entries(this.pattern)) { - if (!(patternKey in actual) && !(patternVal instanceof AbsentMatch)) { - result.recordFailure({ - matcher: this, - path: [patternKey], - message: `Missing key '${patternKey}'` - }); - continue; - } - const matcher = Matcher.isMatcher(patternVal) ? patternVal : new LiteralMatch(this.name, patternVal, { partialObjects: this.partial }); - const inner = matcher.test(actual[patternKey]); - result.compose(patternKey, inner); - } - return result; - } -}; -var SerializedJson = class extends Matcher { - constructor(name, pattern) { - super(); - this.name = name; - this.pattern = pattern; - } - test(actual) { - if (getType(actual) !== "string") { - return new MatchResult(actual).recordFailure({ - matcher: this, - path: [], - message: `Expected JSON as a string but found ${getType(actual)}` - }); - } - let parsed; - try { - parsed = JSON.parse(actual); - } catch (err) { - if (err instanceof SyntaxError) { - return new MatchResult(actual).recordFailure({ - matcher: this, - path: [], - message: `Invalid JSON string: ${actual}` - }); - } else { - throw err; - } - } - const matcher = Matcher.isMatcher(this.pattern) ? this.pattern : new LiteralMatch(this.name, this.pattern); - const innerResult = matcher.test(parsed); - if (innerResult.hasFailed()) { - innerResult.recordFailure({ - matcher: this, - path: [], - message: "Encoded JSON value does not match" - }); - } - return innerResult; - } -}; -var NotMatch = class extends Matcher { - constructor(name, pattern) { - super(); - this.name = name; - this.pattern = pattern; - } - test(actual) { - const matcher = Matcher.isMatcher(this.pattern) ? this.pattern : new LiteralMatch(this.name, this.pattern); - const innerResult = matcher.test(actual); - const result = new MatchResult(actual); - if (innerResult.failCount === 0) { - result.recordFailure({ - matcher: this, - path: [], - message: `Found unexpected match: ${JSON.stringify(actual, void 0, 2)}` - }); - } - return result; - } -}; -var AnyMatch = class extends Matcher { - constructor(name) { - super(); - this.name = name; - } - test(actual) { - const result = new MatchResult(actual); - if (actual == null) { - result.recordFailure({ - matcher: this, - path: [], - message: "Expected a value but found none" - }); - } - return result; - } -}; -var StringLikeRegexpMatch = class extends Matcher { - constructor(name, pattern) { - super(); - this.name = name; - this.pattern = pattern; - } - test(actual) { - const result = new MatchResult(actual); - const regex = new RegExp(this.pattern, "gm"); - if (typeof actual !== "string") { - result.recordFailure({ - matcher: this, - path: [], - message: `Expected a string, but got '${typeof actual}'` - }); - } - if (!regex.test(actual)) { - result.recordFailure({ - matcher: this, - path: [], - message: `String '${actual}' did not match pattern '${this.pattern}'` - }); - } - return result; - } -}; - -// lib/assertions/providers/lambda-handler/base.ts -var https = __toESM(require("https")); -var url = __toESM(require("url")); -var AWS = __toESM(require("aws-sdk")); -var CustomResourceHandler = class { - constructor(event, context) { - this.event = event; - this.context = context; - this.timedOut = false; - this.timeout = setTimeout(async () => { - await this.respond({ - status: "FAILED", - reason: "Lambda Function Timeout", - data: this.context.logStreamName - }); - this.timedOut = true; - }, context.getRemainingTimeInMillis() - 1200); - this.event = event; - this.physicalResourceId = extractPhysicalResourceId(event); - } - async handle() { - try { - if ("stateMachineArn" in this.event.ResourceProperties) { - const req = { - stateMachineArn: this.event.ResourceProperties.stateMachineArn, - name: this.event.RequestId, - input: JSON.stringify(this.event) - }; - await this.startExecution(req); - return; - } else { - const response = await this.processEvent(this.event.ResourceProperties); - return response; - } - } catch (e) { - console.log(e); - throw e; - } finally { - clearTimeout(this.timeout); - } - } - async handleIsComplete() { - try { - const result = await this.processEvent(this.event.ResourceProperties); - return result; - } catch (e) { - console.log(e); - return; - } finally { - clearTimeout(this.timeout); - } - } - async startExecution(req) { - try { - const sfn = new AWS.StepFunctions(); - await sfn.startExecution(req).promise(); - } finally { - clearTimeout(this.timeout); - } - } - respond(response) { - if (this.timedOut) { - return; - } - const cfResponse = { - Status: response.status, - Reason: response.reason, - PhysicalResourceId: this.physicalResourceId, - StackId: this.event.StackId, - RequestId: this.event.RequestId, - LogicalResourceId: this.event.LogicalResourceId, - NoEcho: false, - Data: response.data - }; - const responseBody = JSON.stringify(cfResponse); - console.log("Responding to CloudFormation", responseBody); - const parsedUrl = url.parse(this.event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: "PUT", - headers: { "content-type": "", "content-length": responseBody.length } - }; - return new Promise((resolve, reject) => { - try { - const request2 = https.request(requestOptions, resolve); - request2.on("error", reject); - request2.write(responseBody); - request2.end(); - } catch (e) { - reject(e); - } finally { - clearTimeout(this.timeout); - } - }); - } -}; -function extractPhysicalResourceId(event) { - switch (event.RequestType) { - case "Create": - return event.LogicalResourceId; - case "Update": - case "Delete": - return event.PhysicalResourceId; - } -} - -// lib/assertions/providers/lambda-handler/assertion.ts -var AssertionHandler = class extends CustomResourceHandler { - async processEvent(request2) { - let actual = decodeCall(request2.actual); - const expected = decodeCall(request2.expected); - let result; - const matcher = new MatchCreator(expected).getMatcher(); - console.log(`Testing equality between ${JSON.stringify(request2.actual)} and ${JSON.stringify(request2.expected)}`); - const matchResult = matcher.test(actual); - matchResult.finished(); - if (matchResult.hasFailed()) { - result = { - failed: true, - assertion: JSON.stringify({ - status: "fail", - message: matchResult.renderMismatch() - }) - }; - if (request2.failDeployment) { - throw new Error(result.assertion); - } - } else { - result = { - assertion: JSON.stringify({ - status: "success" - }) - }; - } - return result; - } -}; -var MatchCreator = class { - constructor(obj) { - this.parsedObj = { - matcher: obj - }; - } - getMatcher() { - try { - const final = JSON.parse(JSON.stringify(this.parsedObj), function(_k, v) { - const nested = Object.keys(v)[0]; - switch (nested) { - case "$ArrayWith": - return Match.arrayWith(v[nested]); - case "$ObjectLike": - return Match.objectLike(v[nested]); - case "$StringLike": - return Match.stringLikeRegexp(v[nested]); - case "$SerializedJson": - return Match.serializedJson(v[nested]); - default: - return v; - } - }); - if (Matcher.isMatcher(final.matcher)) { - return final.matcher; - } - return Match.exact(final.matcher); - } catch { - return Match.exact(this.parsedObj.matcher); - } - } -}; -function decodeCall(call) { - if (!call) { - return void 0; - } - try { - const parsed = JSON.parse(call); - return parsed; - } catch (e) { - return call; - } -} - -// lib/assertions/providers/lambda-handler/utils.ts -function decode(object) { - return JSON.parse(JSON.stringify(object), (_k, v) => { - switch (v) { - case "TRUE:BOOLEAN": - return true; - case "FALSE:BOOLEAN": - return false; - default: - return v; - } - }); -} - -// lib/assertions/providers/lambda-handler/sdk.ts -function flatten(object) { - return Object.assign( - {}, - ...function _flatten(child, path = []) { - return [].concat(...Object.keys(child).map((key) => { - let childKey = Buffer.isBuffer(child[key]) ? child[key].toString("utf8") : child[key]; - if (typeof childKey === "string") { - childKey = isJsonString(childKey); - } - return typeof childKey === "object" && childKey !== null ? _flatten(childKey, path.concat([key])) : { [path.concat([key]).join(".")]: childKey }; - })); - }(object) - ); -} -var AwsApiCallHandler = class extends CustomResourceHandler { - async processEvent(request2) { - const AWS2 = require("aws-sdk"); - console.log(`AWS SDK VERSION: ${AWS2.VERSION}`); - if (!Object.prototype.hasOwnProperty.call(AWS2, request2.service)) { - throw Error(`Service ${request2.service} does not exist in AWS SDK version ${AWS2.VERSION}.`); - } - const service = new AWS2[request2.service](); - const response = await service[request2.api](request2.parameters && decode(request2.parameters)).promise(); - console.log(`SDK response received ${JSON.stringify(response)}`); - delete response.ResponseMetadata; - const respond = { - apiCallResponse: response - }; - const flatData = { - ...flatten(respond) - }; - let resp = respond; - if (request2.outputPaths) { - resp = filterKeys(flatData, request2.outputPaths); - } else if (request2.flattenResponse === "true") { - resp = flatData; - } - console.log(`Returning result ${JSON.stringify(resp)}`); - return resp; - } -}; -function filterKeys(object, searchStrings) { - return Object.entries(object).reduce((filteredObject, [key, value]) => { - for (const searchString of searchStrings) { - if (key.startsWith(`apiCallResponse.${searchString}`)) { - filteredObject[key] = value; - } - } - return filteredObject; - }, {}); -} -function isJsonString(value) { - try { - return JSON.parse(value); - } catch { - return value; - } -} - -// lib/assertions/providers/lambda-handler/types.ts -var ASSERT_RESOURCE_TYPE = "Custom::DeployAssert@AssertEquals"; -var SDK_RESOURCE_TYPE_PREFIX = "Custom::DeployAssert@SdkCall"; - -// lib/assertions/providers/lambda-handler/index.ts -async function handler(event, context) { - console.log(`Event: ${JSON.stringify({ ...event, ResponseURL: "..." })}`); - const provider = createResourceHandler(event, context); - try { - if (event.RequestType === "Delete") { - await provider.respond({ - status: "SUCCESS", - reason: "OK" - }); - return; - } - const result = await provider.handle(); - if ("stateMachineArn" in event.ResourceProperties) { - console.info('Found "stateMachineArn", waiter statemachine started'); - return; - } else if ("expected" in event.ResourceProperties) { - console.info('Found "expected", testing assertions'); - const actualPath = event.ResourceProperties.actualPath; - const actual = actualPath ? result[`apiCallResponse.${actualPath}`] : result.apiCallResponse; - const assertion = new AssertionHandler({ - ...event, - ResourceProperties: { - ServiceToken: event.ServiceToken, - actual, - expected: event.ResourceProperties.expected - } - }, context); - try { - const assertionResult = await assertion.handle(); - await provider.respond({ - status: "SUCCESS", - reason: "OK", - data: { - ...assertionResult, - ...result - } - }); - return; - } catch (e) { - await provider.respond({ - status: "FAILED", - reason: e.message ?? "Internal Error" - }); - return; - } - } - await provider.respond({ - status: "SUCCESS", - reason: "OK", - data: result - }); - } catch (e) { - await provider.respond({ - status: "FAILED", - reason: e.message ?? "Internal Error" - }); - return; - } - return; -} -async function onTimeout(timeoutEvent) { - const isCompleteRequest = JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage); - const provider = createResourceHandler(isCompleteRequest, standardContext); - await provider.respond({ - status: "FAILED", - reason: "Operation timed out: " + JSON.stringify(isCompleteRequest) - }); -} -async function isComplete(event, context) { - console.log(`Event: ${JSON.stringify({ ...event, ResponseURL: "..." })}`); - const provider = createResourceHandler(event, context); - try { - const result = await provider.handleIsComplete(); - const actualPath = event.ResourceProperties.actualPath; - if (result) { - const actual = actualPath ? result[`apiCallResponse.${actualPath}`] : result.apiCallResponse; - if ("expected" in event.ResourceProperties) { - const assertion = new AssertionHandler({ - ...event, - ResourceProperties: { - ServiceToken: event.ServiceToken, - actual, - expected: event.ResourceProperties.expected - } - }, context); - const assertionResult = await assertion.handleIsComplete(); - if (!(assertionResult == null ? void 0 : assertionResult.failed)) { - await provider.respond({ - status: "SUCCESS", - reason: "OK", - data: { - ...assertionResult, - ...result - } - }); - return; - } else { - console.log(`Assertion Failed: ${JSON.stringify(assertionResult)}`); - throw new Error(JSON.stringify(event)); - } - } - await provider.respond({ - status: "SUCCESS", - reason: "OK", - data: result - }); - } else { - console.log("No result"); - throw new Error(JSON.stringify(event)); - } - return; - } catch (e) { - console.log(e); - throw new Error(JSON.stringify(event)); - } -} -function createResourceHandler(event, context) { - if (event.ResourceType.startsWith(SDK_RESOURCE_TYPE_PREFIX)) { - return new AwsApiCallHandler(event, context); - } else if (event.ResourceType.startsWith(ASSERT_RESOURCE_TYPE)) { - return new AssertionHandler(event, context); - } else { - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -var standardContext = { - getRemainingTimeInMillis: () => 9e4 -}; -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { - handler, - isComplete, - onTimeout -}); diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/fleettestDefaultTestDeployAssert9067216F.assets.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/fleettestDefaultTestDeployAssert9067216F.assets.json deleted file mode 100644 index e91707cbe239f..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/fleettestDefaultTestDeployAssert9067216F.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "22.0.0", - "files": { - "e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041": { - "source": { - "path": "asset.e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041.bundle", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "8911073233f2efdc6a92d463a6a5da8f015989571b4e69466ea1d2328ce3b75b": { - "source": { - "path": "fleettestDefaultTestDeployAssert9067216F.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8911073233f2efdc6a92d463a6a5da8f015989571b4e69466ea1d2328ce3b75b.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/fleettestDefaultTestDeployAssert9067216F.template.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/fleettestDefaultTestDeployAssert9067216F.template.json deleted file mode 100644 index e3135d0516995..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/fleettestDefaultTestDeployAssert9067216F.template.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "Resources": { - "AwsApiCallAppStreamdescribeFleets": { - "Type": "Custom::DeployAssert@SdkCallAppStreamdescribeFleets", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", - "Arn" - ] - }, - "service": "AppStream", - "api": "describeFleets", - "expected": "{\"$ObjectLike\":{\"Fleets\":[{\"State\":\"RUNNING\"}]}}", - "parameters": { - "Names": [ - { - "Fn::ImportValue": "integ-appstream-fleet:ExportsOutputRefMyFleet2DDF6411" - } - ] - }, - "flattenResponse": "false", - "salt": "1673180608482" - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ], - "Policies": [ - { - "PolicyName": "Inline", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": [ - "appstream:DescribeFleets" - ], - "Effect": "Allow", - "Resource": [ - "*" - ] - } - ] - } - } - ] - } - }, - "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Runtime": "nodejs14.x", - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "e452e213d7f0cc8e3f721cfec0fe9d623c51052282e9df20c641a723b612f041.zip" - }, - "Timeout": 120, - "Handler": "index.handler", - "Role": { - "Fn::GetAtt": [ - "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", - "Arn" - ] - } - } - } - }, - "Outputs": { - "AssertionResultsAwsApiCallAppStreamdescribeFleets": { - "Value": { - "Fn::GetAtt": [ - "AwsApiCallAppStreamdescribeFleets", - "assertion" - ] - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ-appstream-fleet.assets.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ-appstream-fleet.assets.json deleted file mode 100644 index f7e470e3e4fea..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ-appstream-fleet.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "22.0.0", - "files": { - "5f9fe4d8145c4eeb8dc77cd8e867cf2e6b3b0736819b9ccaf63e5fcee2891cc5": { - "source": { - "path": "integ-appstream-fleet.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "5f9fe4d8145c4eeb8dc77cd8e867cf2e6b3b0736819b9ccaf63e5fcee2891cc5.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ-appstream-fleet.template.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ-appstream-fleet.template.json deleted file mode 100644 index ab2859b4e7506..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ-appstream-fleet.template.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "Resources": { - "MyFleet": { - "Type": "AWS::AppStream::Fleet", - "Properties": { - "InstanceType": "stream.standard.small", - "Name": "MyFleet", - "ComputeCapacity": { - "DesiredInstances": 1 - }, - "ImageName": "AppStream-AmazonLinux2-09-21-2022" - }, - "CreationPolicy": { - "StartFleet": true - } - } - }, - "Outputs": { - "ExportsOutputRefMyFleet2DDF6411": { - "Value": { - "Ref": "MyFleet" - }, - "Export": { - "Name": "integ-appstream-fleet:ExportsOutputRefMyFleet2DDF6411" - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ.json deleted file mode 100644 index 93ccf43a7db6a..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "22.0.0", - "testCases": { - "fleet-test/DefaultTest": { - "stacks": [ - "integ-appstream-fleet" - ], - "assertionStack": "fleet-test/DefaultTest/DeployAssert", - "assertionStackName": "fleettestDefaultTestDeployAssert9067216F" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/manifest.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/manifest.json deleted file mode 100644 index 5f59a737409ce..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/manifest.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "version": "22.0.0", - "artifacts": { - "integ-appstream-fleet.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "integ-appstream-fleet.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "integ-appstream-fleet": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "integ-appstream-fleet.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5f9fe4d8145c4eeb8dc77cd8e867cf2e6b3b0736819b9ccaf63e5fcee2891cc5.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "integ-appstream-fleet.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "integ-appstream-fleet.assets" - ], - "metadata": { - "/integ-appstream-fleet/MyFleet": [ - { - "type": "aws:cdk:logicalId", - "data": "MyFleet" - } - ], - "/integ-appstream-fleet/Exports/Output{\"Ref\":\"MyFleet\"}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputRefMyFleet2DDF6411" - } - ], - "/integ-appstream-fleet/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/integ-appstream-fleet/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "integ-appstream-fleet" - }, - "fleettestDefaultTestDeployAssert9067216F.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "fleettestDefaultTestDeployAssert9067216F.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "fleettestDefaultTestDeployAssert9067216F": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "fleettestDefaultTestDeployAssert9067216F.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8911073233f2efdc6a92d463a6a5da8f015989571b4e69466ea1d2328ce3b75b.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "fleettestDefaultTestDeployAssert9067216F.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "integ-appstream-fleet", - "fleettestDefaultTestDeployAssert9067216F.assets" - ], - "metadata": { - "/fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/Default/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "AwsApiCallAppStreamdescribeFleets" - } - ], - "/fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/AssertionResults": [ - { - "type": "aws:cdk:logicalId", - "data": "AssertionResultsAwsApiCallAppStreamdescribeFleets" - } - ], - "/fleet-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73" - } - ], - "/fleet-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F" - } - ], - "/fleet-test/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/fleet-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "fleet-test/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/tree.json b/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/tree.json deleted file mode 100644 index fa76a7cd5d85b..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.js.snapshot/tree.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "integ-appstream-fleet": { - "id": "integ-appstream-fleet", - "path": "integ-appstream-fleet", - "children": { - "MyFleet": { - "id": "MyFleet", - "path": "integ-appstream-fleet/MyFleet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::AppStream::Fleet", - "aws:cdk:cloudformation:props": { - "instanceType": "stream.standard.small", - "name": "MyFleet", - "computeCapacity": { - "desiredInstances": 1 - }, - "imageName": "AppStream-AmazonLinux2-09-21-2022" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-appstream.CfnFleet", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "integ-appstream-fleet/Exports", - "children": { - "Output{\"Ref\":\"MyFleet\"}": { - "id": "Output{\"Ref\":\"MyFleet\"}", - "path": "integ-appstream-fleet/Exports/Output{\"Ref\":\"MyFleet\"}", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "integ-appstream-fleet/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "integ-appstream-fleet/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - }, - "fleet-test": { - "id": "fleet-test", - "path": "fleet-test", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "fleet-test/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "fleet-test/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "fleet-test/DefaultTest/DeployAssert", - "children": { - "AwsApiCallAppStreamdescribeFleets": { - "id": "AwsApiCallAppStreamdescribeFleets", - "path": "fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets", - "children": { - "SdkProvider": { - "id": "SdkProvider", - "path": "fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/SdkProvider", - "children": { - "AssertionsProvider": { - "id": "AssertionsProvider", - "path": "fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/SdkProvider/AssertionsProvider", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.AssertionsProvider", - "version": "0.0.0" - } - }, - "Default": { - "id": "Default", - "path": "fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/Default", - "children": { - "Default": { - "id": "Default", - "path": "fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/Default/Default", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.CustomResource", - "version": "0.0.0" - } - }, - "AssertionResults": { - "id": "AssertionResults", - "path": "fleet-test/DefaultTest/DeployAssert/AwsApiCallAppStreamdescribeFleets/AssertionResults", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.AwsApiCall", - "version": "0.0.0" - } - }, - "SingletonFunction1488541a7b23466481b69b4408076b81": { - "id": "SingletonFunction1488541a7b23466481b69b4408076b81", - "path": "fleet-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81", - "children": { - "Staging": { - "id": "Staging", - "path": "fleet-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "fleet-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - }, - "Handler": { - "id": "Handler", - "path": "fleet-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Handler", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "fleet-test/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "fleet-test/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/test/integ.fleet.ts b/packages/@aws-cdk/aws-appstream/test/integ.fleet.ts deleted file mode 100644 index aaab190a456ec..0000000000000 --- a/packages/@aws-cdk/aws-appstream/test/integ.fleet.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest, ExpectedResult } from '@aws-cdk/integ-tests'; -import * as appstream from '../lib'; - -/* - * Before this test can run you need to visit the AppStream console once and click fleets. - * This will create the necessary AmazonAppStreamServiceAccess service role. - * - * Stack verification steps: - * * aws appstream describe-fleets --region us-east-1 - * The command should return a json with an array Fleets containing one with a Name MyFleet and a State of RUNNING. - */ - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-appstream-fleet'); - -const fleet = new appstream.CfnFleet(stack, 'MyFleet', { - instanceType: 'stream.standard.small', - name: 'MyFleet', - computeCapacity: { - desiredInstances: 1, - }, - imageName: 'AppStream-AmazonLinux2-09-21-2022', -}); -fleet.cfnOptions.creationPolicy = { - startFleet: true, -}; - -const testCase = new IntegTest(app, 'fleet-test', { - testCases: [stack], -}); - -const describe = testCase.assertions.awsApiCall('AppStream', 'describeFleets', { - Names: [fleet.ref], -}); - -// assert the results -describe.expect(ExpectedResult.objectLike({ - Fleets: [{ - State: 'RUNNING', - }], -})); - -app.synth(); diff --git a/packages/@aws-cdk/aws-appsync/.eslintrc.js b/packages/@aws-cdk/aws-appsync/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-appsync/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-appsync/.gitignore b/packages/@aws-cdk/aws-appsync/.gitignore deleted file mode 100644 index 8c18bc6583957..0000000000000 --- a/packages/@aws-cdk/aws-appsync/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -!test/verify/**/*.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** -!test/integ-assets/**/*.js diff --git a/packages/@aws-cdk/aws-appsync/.npmignore b/packages/@aws-cdk/aws-appsync/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-appsync/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-appsync/LICENSE b/packages/@aws-cdk/aws-appsync/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-appsync/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-appsync/NOTICE b/packages/@aws-cdk/aws-appsync/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-appsync/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-appsync/README.md b/packages/@aws-cdk/aws-appsync/README.md deleted file mode 100644 index 815a1b7ab0699..0000000000000 --- a/packages/@aws-cdk/aws-appsync/README.md +++ /dev/null @@ -1,583 +0,0 @@ -# AWS AppSync Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -The `@aws-cdk/aws-appsync` package contains constructs for building flexible -APIs that use GraphQL. - -```ts nofixture -import * as appsync from '@aws-cdk/aws-appsync'; -``` - -## Example - -### DynamoDB - -Example of a GraphQL API with `AWS_IAM` [authorization](#authorization) resolving into a DynamoDb -backend data source. - -GraphQL schema file `schema.graphql`: - -```gql -type demo { - id: String! - version: String! -} -type Query { - getDemos: [ demo! ] -} -input DemoInput { - version: String! -} -type Mutation { - addDemo(input: DemoInput!): demo -} -``` - -CDK stack file `app-stack.ts`: - -```ts -const api = new appsync.GraphqlApi(this, 'Api', { - name: 'demo', - schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphql')), - authorizationConfig: { - defaultAuthorization: { - authorizationType: appsync.AuthorizationType.IAM, - }, - }, - xrayEnabled: true, -}); - -const demoTable = new dynamodb.Table(this, 'DemoTable', { - partitionKey: { - name: 'id', - type: dynamodb.AttributeType.STRING, - }, -}); - -const demoDS = api.addDynamoDbDataSource('demoDataSource', demoTable); - -// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list. -// Resolver Mapping Template Reference: -// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html -demoDS.createResolver('QueryGetDemosResolver', { - typeName: 'Query', - fieldName: 'getDemos', - requestMappingTemplate: appsync.MappingTemplate.dynamoDbScanTable(), - responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), -}); - -// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table. -demoDS.createResolver('MutationAddDemoResolver', { - typeName: 'Mutation', - fieldName: 'addDemo', - requestMappingTemplate: appsync.MappingTemplate.dynamoDbPutItem( - appsync.PrimaryKey.partition('id').auto(), - appsync.Values.projecting('input'), - ), - responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultItem(), -}); - -//To enable DynamoDB read consistency with the `MappingTemplate`: -demoDS.createResolver('QueryGetDemosConsistentResolver', { - typeName: 'Query', - fieldName: 'getDemosConsistent', - requestMappingTemplate: appsync.MappingTemplate.dynamoDbScanTable(true), - responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), -}); -``` - - - -### Aurora Serverless - -AppSync provides a data source for executing SQL commands against Amazon Aurora -Serverless clusters. You can use AppSync resolvers to execute SQL statements -against the Data API with GraphQL queries, mutations, and subscriptions. - -```ts -// Create username and password secret for DB Cluster -const secret = new rds.DatabaseSecret(this, 'AuroraSecret', { - username: 'clusteradmin', -}); - -// The VPC to place the cluster in -const vpc = new ec2.Vpc(this, 'AuroraVpc'); - -// Create the serverless cluster, provide all values needed to customise the database. -const cluster = new rds.ServerlessCluster(this, 'AuroraCluster', { - engine: rds.DatabaseClusterEngine.AURORA_MYSQL, - vpc, - credentials: { username: 'clusteradmin' }, - clusterIdentifier: 'db-endpoint-test', - defaultDatabaseName: 'demos', -}); - -// Build a data source for AppSync to access the database. -declare const api: appsync.GraphqlApi; -const rdsDS = api.addRdsDataSource('rds', cluster, secret, 'demos'); - -// Set up a resolver for an RDS query. -rdsDS.createResolver('QueryGetDemosRdsResolver', { - typeName: 'Query', - fieldName: 'getDemosRds', - requestMappingTemplate: appsync.MappingTemplate.fromString(` - { - "version": "2018-05-29", - "statements": [ - "SELECT * FROM demos" - ] - } - `), - responseMappingTemplate: appsync.MappingTemplate.fromString(` - $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) - `), -}); - -// Set up a resolver for an RDS mutation. -rdsDS.createResolver('MutationAddDemoRdsResolver', { - typeName: 'Mutation', - fieldName: 'addDemoRds', - requestMappingTemplate: appsync.MappingTemplate.fromString(` - { - "version": "2018-05-29", - "statements": [ - "INSERT INTO demos VALUES (:id, :version)", - "SELECT * WHERE id = :id" - ], - "variableMap": { - ":id": $util.toJson($util.autoId()), - ":version": $util.toJson($ctx.args.version) - } - } - `), - responseMappingTemplate: appsync.MappingTemplate.fromString(` - $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0]) - `), -}); -``` - -### HTTP Endpoints - -GraphQL schema file `schema.graphql`: - -```gql -type job { - id: String! - version: String! -} - -input DemoInput { - version: String! -} - -type Mutation { - callStepFunction(input: DemoInput!): job -} -``` - -GraphQL request mapping template `request.vtl`: - -```json -{ - "version": "2018-05-29", - "method": "POST", - "resourcePath": "/", - "params": { - "headers": { - "content-type": "application/x-amz-json-1.0", - "x-amz-target":"AWSStepFunctions.StartExecution" - }, - "body": { - "stateMachineArn": "", - "input": "{ \"id\": \"$context.arguments.id\" }" - } - } -} -``` - -GraphQL response mapping template `response.vtl`: - -```json -{ - "id": "${context.result.id}" -} -``` - -CDK stack file `app-stack.ts`: - -```ts -const api = new appsync.GraphqlApi(this, 'api', { - name: 'api', - schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphql')), -}); - -const httpDs = api.addHttpDataSource( - 'ds', - 'https://states.amazonaws.com', - { - name: 'httpDsWithStepF', - description: 'from appsync to StepFunctions Workflow', - authorizationConfig: { - signingRegion: 'us-east-1', - signingServiceName: 'states', - } - } -); - -httpDs.createResolver('MutationCallStepFunctionResolver', { - typeName: 'Mutation', - fieldName: 'callStepFunction', - requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'), - responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'), -}); -``` - -### Amazon OpenSearch Service - -AppSync has builtin support for Amazon OpenSearch Service (successor to Amazon -Elasticsearch Service) from domains that are provisioned through your AWS account. You can -use AppSync resolvers to perform GraphQL operations such as queries, mutations, and -subscriptions. - -```ts -import * as opensearch from '@aws-cdk/aws-opensearchservice'; - -const user = new iam.User(this, 'User'); -const domain = new opensearch.Domain(this, 'Domain', { - version: opensearch.EngineVersion.OPENSEARCH_2_3, - removalPolicy: RemovalPolicy.DESTROY, - fineGrainedAccessControl: { masterUserArn: user.userArn }, - encryptionAtRest: { enabled: true }, - nodeToNodeEncryption: true, - enforceHttps: true, -}); - -declare const api: appsync.GraphqlApi; -const ds = api.addOpenSearchDataSource('ds', domain); - -ds.createResolver('QueryGetTestsResolver', { - typeName: 'Query', - fieldName: 'getTests', - requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ - version: '2017-02-28', - operation: 'GET', - path: '/id/post/_search', - params: { - headers: {}, - queryString: {}, - body: { from: 0, size: 50 }, - }, - })), - responseMappingTemplate: appsync.MappingTemplate.fromString(`[ - #foreach($entry in $context.result.hits.hits) - #if( $velocityCount > 1 ) , #end - $utils.toJson($entry.get("_source")) - #end - ]`), -}); -``` - -## Custom Domain Names - -For many use cases you may want to associate a custom domain name with your -GraphQL API. This can be done during the API creation. - -```ts -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; - -const myDomainName = 'api.example.com'; -const certificate = new acm.Certificate(this, 'cert', { domainName: myDomainName }); -const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' }) -const api = new appsync.GraphqlApi(this, 'api', { - name: 'myApi', - schema, - domainName: { - certificate, - domainName: myDomainName, - }, -}); - -// hosted zone and route53 features -declare const hostedZoneId: string; -declare const zoneName = 'example.com'; - -// hosted zone for adding appsync domain -const zone = route53.HostedZone.fromHostedZoneAttributes(this, `HostedZone`, { - hostedZoneId, - zoneName, -}); - -// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net -new route53.CnameRecord(this, `CnameApiRecord`, { - recordName: 'api', - zone, - domainName: api.appSyncDomainName, -}); -``` - -## Log Group - -AppSync automatically create a log group with the name `/aws/appsync/apis/` upon deployment with -log data set to never expire. If you want to set a different expiration period, use the `logConfig.retention` property. - -To obtain the GraphQL API's log group as a `logs.ILogGroup` use the `logGroup` property of the -`GraphqlApi` construct. - -```ts -import * as logs from '@aws-cdk/aws-logs'; - -const logConfig: appsync.LogConfig = { - retention: logs.RetentionDays.ONE_WEEK, -}; - -new appsync.GraphqlApi(this, 'api', { - authorizationConfig: {}, - name: 'myApi', - schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'myApi.graphql')), - logConfig, -}); -``` - -## Schema - -You can define a schema using from a local file using `SchemaFile.fromAsset` - -```ts -const api = new appsync.GraphqlApi(this, 'api', { - name: 'myApi', - schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphl')), -}); -``` - -### ISchema - -Alternative schema sources can be defined by implementing the `ISchema` -interface. An example of this is the `CodeFirstSchema` class provided in -[awscdk-appsync-utils](https://github.com/cdklabs/awscdk-appsync-utils) - -## Imports - -Any GraphQL Api that has been created outside the stack can be imported from -another stack into your CDK app. Utilizing the `fromXxx` function, you have -the ability to add data sources and resolvers through a `IGraphqlApi` interface. - -```ts -declare const api: appsync.GraphqlApi; -declare const table: dynamodb.Table; -const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(this, 'IApi', { - graphqlApiId: api.apiId, - graphqlApiArn: api.arn, -}); -importedApi.addDynamoDbDataSource('TableDataSource', table); -``` - -If you don't specify `graphqlArn` in `fromXxxAttributes`, CDK will autogenerate -the expected `arn` for the imported api, given the `apiId`. For creating data -sources and resolvers, an `apiId` is sufficient. - -## Authorization - -There are multiple authorization types available for GraphQL API to cater to different -access use cases. They are: - -- API Keys (`AuthorizationType.API_KEY`) -- Amazon Cognito User Pools (`AuthorizationType.USER_POOL`) -- OpenID Connect (`AuthorizationType.OPENID_CONNECT`) -- AWS Identity and Access Management (`AuthorizationType.AWS_IAM`) -- AWS Lambda (`AuthorizationType.AWS_LAMBDA`) - -These types can be used simultaneously in a single API, allowing different types of clients to -access data. When you specify an authorization type, you can also specify the corresponding -authorization mode to finish defining your authorization. For example, this is a GraphQL API -with AWS Lambda Authorization. - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; -declare const authFunction: lambda.Function; - -new appsync.GraphqlApi(this, 'api', { - name: 'api', - schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), - authorizationConfig: { - defaultAuthorization: { - authorizationType: appsync.AuthorizationType.LAMBDA, - lambdaAuthorizerConfig: { - handler: authFunction, - // can also specify `resultsCacheTtl` and `validationRegex`. - }, - }, - }, -}); -``` - -## Permissions - -When using `AWS_IAM` as the authorization type for GraphQL API, an IAM Role -with correct permissions must be used for access to API. - -When configuring permissions, you can specify specific resources to only be -accessible by `IAM` authorization. For example, if you want to only allow mutability -for `IAM` authorized access you would configure the following. - -In `schema.graphql`: - -```gql -type Mutation { - updateExample(...): ... - @aws_iam -} -``` - -In `IAM`: - -```json -{ - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "appsync:GraphQL" - ], - "Resource": [ - "arn:aws:appsync:REGION:ACCOUNT_ID:apis/GRAPHQL_ID/types/Mutation/fields/updateExample" - ] - } - ] -} -``` - -See [documentation](https://docs.aws.amazon.com/appsync/latest/devguide/security.html#aws-iam-authorization) for more details. - -To make this easier, CDK provides `grant` API. - -Use the `grant` function for more granular authorization. - -```ts -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), -}); -declare const api: appsync.GraphqlApi; - -api.grant(role, appsync.IamResource.custom('types/Mutation/fields/updateExample'), 'appsync:GraphQL'); -``` - -### IamResource - -In order to use the `grant` functions, you need to use the class `IamResource`. - -- `IamResource.custom(...arns)` permits custom ARNs and requires an argument. - -- `IamResouce.ofType(type, ...fields)` permits ARNs for types and their fields. - -- `IamResource.all()` permits ALL resources. - -### Generic Permissions - -Alternatively, you can use more generic `grant` functions to accomplish the same usage. - -These include: - -- grantMutation (use to grant access to Mutation fields) -- grantQuery (use to grant access to Query fields) -- grantSubscription (use to grant access to Subscription fields) - -```ts -declare const api: appsync.GraphqlApi; -declare const role: iam.Role; - -// For generic types -api.grantMutation(role, 'updateExample'); - -// For custom types and granular design -api.grant(role, appsync.IamResource.ofType('Mutation', 'updateExample'), 'appsync:GraphQL'); -``` - -## Pipeline Resolvers and AppSync Functions - -AppSync Functions are local functions that perform certain operations onto a -backend data source. Developers can compose operations (Functions) and execute -them in sequence with Pipeline Resolvers. - -```ts -declare const api: appsync.GraphqlApi; - -const appsyncFunction = new appsync.AppsyncFunction(this, 'function', { - name: 'appsync_function', - api, - dataSource: api.addNoneDataSource('none'), - requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'), - responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'), -}); -``` - -AppSync Functions are used in tandem with pipeline resolvers to compose multiple -operations. - -```ts -declare const api: appsync.GraphqlApi; -declare const appsyncFunction: appsync.AppsyncFunction; - -const pipelineResolver = new appsync.Resolver(this, 'pipeline', { - api, - dataSource: api.addNoneDataSource('none'), - typeName: 'typeName', - fieldName: 'fieldName', - requestMappingTemplate: appsync.MappingTemplate.fromFile('beforeRequest.vtl'), - pipelineConfig: [appsyncFunction], - responseMappingTemplate: appsync.MappingTemplate.fromFile('afterResponse.vtl'), -}); -``` - -### JS Functions and Resolvers - -JS Functions and resolvers are also supported. You can use a `.js` file within your CDK project, or specify your function code inline. - -```ts -declare const api: appsync.GraphqlApi; - -const myJsFunction = new appsync.AppsyncFunction(this, 'function', { - name: 'my_js_function', - api, - dataSource: api.addNoneDataSource('none'), - code: appsync.Code.fromAsset('directory/function_code.js'), - runtime: appsync.FunctionRuntime.JS_1_0_0, -}); - -new appsync.Resolver(this, 'PipelineResolver', { - api, - typeName: 'typeName', - fieldName: 'fieldName', - code: appsync.Code.fromInline(` - // The before step - export function request(...args) { - console.log(args); - return {} - } - - // The after step - export function response(ctx) { - return ctx.prev.result - } - `), - runtime: appsync.FunctionRuntime.JS_1_0_0, - pipelineConfig: [myJsFunction], -}); -``` - -Learn more about Pipeline Resolvers and AppSync Functions [here](https://docs.aws.amazon.com/appsync/latest/devguide/pipeline-resolvers.html). diff --git a/packages/@aws-cdk/aws-appsync/jest.config.js b/packages/@aws-cdk/aws-appsync/jest.config.js deleted file mode 100644 index 219d718579a52..0000000000000 --- a/packages/@aws-cdk/aws-appsync/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 1, - statements: 1, - } - } -}; diff --git a/packages/@aws-cdk/aws-appsync/lib/code.ts b/packages/@aws-cdk/aws-appsync/lib/code.ts deleted file mode 100644 index 821e166faeb2d..0000000000000 --- a/packages/@aws-cdk/aws-appsync/lib/code.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Result of binding `Code` into a `Function`. - */ -export interface CodeConfig { - /** - * The location of the code in S3 (mutually exclusive with `inlineCode`. - * @default - code is not an s3 location - */ - readonly s3Location?: string; - - /** - * Inline code (mutually exclusive with `s3Location`). - * @default - code is not inline code - */ - readonly inlineCode?: string; -} - -/** - * Represents source code for an AppSync Function or Resolver. - */ -export abstract class Code { - /** - * Loads the function code from a local disk path. - * - * @param path The path to the source code file. - */ - public static fromAsset(path: string, options?: s3_assets.AssetOptions): AssetCode { - return new AssetCode(path, options); - } - - /** - * Inline code for AppSync function - * @returns `InlineCode` with inline code. - * @param code The actual handler code (limited to 4KiB) - */ - public static fromInline(code: string): InlineCode { - return new InlineCode(code); - } - - /** - * Bind source code to an AppSync Function or resolver. - */ - public abstract bind(scope: Construct): CodeConfig; -} - -/** - * Represents a local file with source code used for an AppSync Function or Resolver. - */ -export class AssetCode extends Code { - private asset?: s3_assets.Asset; - - /** - * @param path The path to the asset file. - */ - constructor(public readonly path: string, private readonly options: s3_assets.AssetOptions = { }) { - super(); - } - - public bind(scope: Construct): CodeConfig { - // If the same AssetCode is used multiple times, retain only the first instantiation. - if (!this.asset) { - this.asset = new s3_assets.Asset(scope, 'Code', { - path: this.path, - ...this.options, - }); - } else if (cdk.Stack.of(this.asset) !== cdk.Stack.of(scope)) { - throw new Error(`Asset is already associated with another stack '${cdk.Stack.of(this.asset).stackName}'. ` + - 'Create a new Code instance for every stack.'); - } - - return { - s3Location: this.asset.s3ObjectUrl, - }; - } -} - -/** - * AppSync function code from an inline string. - */ -export class InlineCode extends Code { - constructor(private code: string) { - super(); - - if (code.length === 0) { - throw new Error('AppSync Inline code cannot be empty'); - } - } - - public bind(_scope: Construct): CodeConfig { - return { - inlineCode: this.code, - }; - } -} diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json deleted file mode 100644 index 6dbfbfcecd35b..0000000000000 --- a/packages/@aws-cdk/aws-appsync/package.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "name": "@aws-cdk/aws-appsync", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AppSync", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.appsync", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "appsync" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.AppSync", - "packageId": "Amazon.CDK.AWS.AppSync", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-appsync", - "module": "aws_cdk.aws_appsync", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-appsync" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AppSync", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "appsync" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticsearch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-opensearchservice": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticsearch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-opensearchservice": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "no-unused-type:@aws-cdk/aws-appsync.ApiKeyConfig", - "no-unused-type:@aws-cdk/aws-appsync.UserPoolConfig", - "no-unused-type:@aws-cdk/aws-appsync.UserPoolDefaultAction", - "props-physical-name:@aws-cdk/aws-appsync.GraphqlApiProps", - "props-physical-name:@aws-cdk/aws-appsync.AppsyncFunctionProps" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-appsync/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-appsync/rosetta/default.ts-fixture deleted file mode 100644 index e80df3fcd54a8..0000000000000 --- a/packages/@aws-cdk/aws-appsync/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import { RemovalPolicy, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import appsync = require('@aws-cdk/aws-appsync'); -import ec2 = require('@aws-cdk/aws-ec2'); -import dynamodb = require('@aws-cdk/aws-dynamodb'); -import iam = require('@aws-cdk/aws-iam'); -import rds = require('@aws-cdk/aws-rds'); -import path = require('path'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdBQUcsT0FBTyxFQUFFLFVBQVUsSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUM1RSxNQUFNLEtBQUssR0FBRyxPQUFPLEVBQUUsWUFBWSxFQUFFLElBQUksSUFBSSxTQUFTLENBQUMsQ0FBQyxDQ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RyaWVzKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5tYXhSZXRyaWVzID0gcGFyc2VJbnQocmF3T3B0aW9ucy5tYXhSZXRyaWVzLCAxMCk7XG4gICAgICB9XG4gICAgICBpZiAocmF3T3B0aW9ucy5iYXNlKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5yZXRyeU9wdGlvbnMgPSB7XG4gICAgICAgICAgYmFzZTogcGFyc2VJbnQocmF3T3B0aW9ucy5iYXNlLCAxMCksXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXRyeU9wdGlvbnM7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.ts b/packages/@aws-cdk/aws-appsync/test/integ.log-retention.ts deleted file mode 100644 index 96f981ce6c197..0000000000000 --- a/packages/@aws-cdk/aws-appsync/test/integ.log-retention.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { join } from 'path'; -import { RetentionDays } from '@aws-cdk/aws-logs'; -import { App, Stack } from '@aws-cdk/core'; -import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; -import { GraphqlApi, LogConfig, SchemaFile } from '../lib'; - -const app = new App(); -const stack = new Stack(app, 'AppSyncIntegLogRetention'); - - -const retentionTime = RetentionDays.ONE_WEEK; -const logConfig: LogConfig = { - retention: retentionTime, -}; - -const api = new GraphqlApi(stack, 'GraphqlApi', { - authorizationConfig: {}, - name: 'IntegLogRetention', - schema: SchemaFile.fromAsset(join(__dirname, 'appsync.test.graphql')), - logConfig, -}); - -const integ = new IntegTest(app, 'Integ', { testCases: [stack] }); - -const describe = integ.assertions.awsApiCall('CloudWatchLogs', - 'describeLogGroups', - { - logGroupNamePrefix: api.logGroup.logGroupName, - }); - -describe.expect(ExpectedResult.objectLike({ - logGroups: [ - { - logGroupName: api.logGroup.logGroupName, - retentionInDays: retentionTime, - }, - ], -})); - -app.synth(); diff --git a/packages/@aws-cdk/aws-aps/.eslintrc.js b/packages/@aws-cdk/aws-aps/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-aps/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-aps/.gitignore b/packages/@aws-cdk/aws-aps/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-aps/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-aps/.npmignore b/packages/@aws-cdk/aws-aps/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-aps/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-aps/LICENSE b/packages/@aws-cdk/aws-aps/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-aps/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-aps/NOTICE b/packages/@aws-cdk/aws-aps/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-aps/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-aps/README.md b/packages/@aws-cdk/aws-aps/README.md deleted file mode 100644 index 042e9b913ae25..0000000000000 --- a/packages/@aws-cdk/aws-aps/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::APS Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as aps from '@aws-cdk/aws-aps'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for APS construct libraries](https://constructs.dev/search?q=aps) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::APS resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_APS.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::APS](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_APS.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-aps/jest.config.js b/packages/@aws-cdk/aws-aps/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-aps/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-aps/lib/index.ts b/packages/@aws-cdk/aws-aps/lib/index.ts deleted file mode 100644 index 76aef1a74fda7..0000000000000 --- a/packages/@aws-cdk/aws-aps/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::APS CloudFormation Resources: -export * from './aps.generated'; diff --git a/packages/@aws-cdk/aws-aps/package.json b/packages/@aws-cdk/aws-aps/package.json deleted file mode 100644 index 1044d90c5a7f8..0000000000000 --- a/packages/@aws-cdk/aws-aps/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-aps", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::APS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.APS", - "packageId": "Amazon.CDK.AWS.APS", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.aps", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "aps" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-aps", - "module": "aws_cdk.aws_aps" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-aps" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::APS", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::APS", - "aws-aps" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-aps/test/aps.test.ts b/packages/@aws-cdk/aws-aps/test/aps.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-aps/test/aps.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-athena/.eslintrc.js b/packages/@aws-cdk/aws-athena/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-athena/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-athena/.gitignore b/packages/@aws-cdk/aws-athena/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-athena/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-athena/.npmignore b/packages/@aws-cdk/aws-athena/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-athena/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-athena/LICENSE b/packages/@aws-cdk/aws-athena/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-athena/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-athena/NOTICE b/packages/@aws-cdk/aws-athena/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-athena/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-athena/README.md b/packages/@aws-cdk/aws-athena/README.md deleted file mode 100644 index 9ea0a48d7a49b..0000000000000 --- a/packages/@aws-cdk/aws-athena/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon Athena Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as athena from '@aws-cdk/aws-athena'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Athena construct libraries](https://constructs.dev/search?q=athena) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Athena resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Athena.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Athena](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Athena.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-athena/jest.config.js b/packages/@aws-cdk/aws-athena/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-athena/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-athena/lib/index.ts b/packages/@aws-cdk/aws-athena/lib/index.ts deleted file mode 100644 index ccfa2e983f38c..0000000000000 --- a/packages/@aws-cdk/aws-athena/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Athena CloudFormation Resources: -export * from './athena.generated'; diff --git a/packages/@aws-cdk/aws-athena/package.json b/packages/@aws-cdk/aws-athena/package.json deleted file mode 100644 index 6ac916cea984b..0000000000000 --- a/packages/@aws-cdk/aws-athena/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-athena", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Athena", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.athena", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "athena" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Athena", - "packageId": "Amazon.CDK.AWS.Athena", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-athena", - "module": "aws_cdk.aws_athena", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "cdk-build": { - "cloudformation": "AWS::Athena", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-athena" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "athena" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-athena/test/athena.test.ts b/packages/@aws-cdk/aws-athena/test/athena.test.ts deleted file mode 100644 index 5e84a85f5e1cf..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/athena.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { CfnWorkGroup } from '../lib'; - -describe('Athena Workgroup Tags', () => { - test('test tag spec correction', () => { - const stack = new cdk.Stack(); - new CfnWorkGroup(stack, 'Athena-Workgroup', { - name: 'HelloWorld', - description: 'A WorkGroup', - recursiveDeleteOption: true, - state: 'ENABLED', - tags: [ - { - key: 'key1', - value: 'value1', - }, - { - key: 'key2', - value: 'value2', - }, - ], - workGroupConfiguration: { - requesterPaysEnabled: true, - resultConfiguration: { - outputLocation: 's3://fakebucketme/athena/results/', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Athena::WorkGroup', { - Tags: [ - { - Key: 'key1', - Value: 'value1', - }, - { - Key: 'key2', - Value: 'value2', - }, - ], - }); - }); - test('test tag aspect spec correction', () => { - const stack = new cdk.Stack(); - cdk.Tags.of(stack).add('key1', 'value1'); - cdk.Tags.of(stack).add('key2', 'value2'); - new CfnWorkGroup(stack, 'Athena-Workgroup', { - name: 'HelloWorld', - description: 'A WorkGroup', - recursiveDeleteOption: true, - state: 'ENABLED', - workGroupConfiguration: { - requesterPaysEnabled: true, - resultConfiguration: { - outputLocation: 's3://fakebucketme/athena/results/', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Athena::WorkGroup', { - Tags: [ - { - Key: 'key1', - Value: 'value1', - }, - { - Key: 'key2', - Value: 'value2', - }, - ], - }); - }); -}); diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets.json deleted file mode 100644 index f1d91048247ac..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.0.0", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.template.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.template.json deleted file mode 100644 index ad9d0fb73d1dd..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/aws-cdk-athena-workgroup-tags.assets.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/aws-cdk-athena-workgroup-tags.assets.json deleted file mode 100644 index 7f55e4b268d0b..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/aws-cdk-athena-workgroup-tags.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.0.0", - "files": { - "d8b01509e317c31bcc2aa728dce91fba9a9fb5d533a6b61cf09948a178861951": { - "source": { - "path": "aws-cdk-athena-workgroup-tags.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d8b01509e317c31bcc2aa728dce91fba9a9fb5d533a6b61cf09948a178861951.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/aws-cdk-athena-workgroup-tags.template.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/aws-cdk-athena-workgroup-tags.template.json deleted file mode 100644 index 4f5f97b163d20..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/aws-cdk-athena-workgroup-tags.template.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "Resources": { - "AthenaWorkgroup": { - "Type": "AWS::Athena::WorkGroup", - "Properties": { - "Name": "HelloWorld", - "Description": "A WorkGroup", - "RecursiveDeleteOption": true, - "State": "ENABLED", - "Tags": [ - { - "Key": "key1", - "Value": "value1" - }, - { - "Key": "key2", - "Value": "value2" - } - ] - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/integ.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/integ.json deleted file mode 100644 index 10db286950e8e..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "30.0.0", - "testCases": { - "athena-workgroup-tags-test/DefaultTest": { - "stacks": [ - "aws-cdk-athena-workgroup-tags" - ], - "assertionStack": "athena-workgroup-tags-test/DefaultTest/DeployAssert", - "assertionStackName": "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/manifest.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/manifest.json deleted file mode 100644 index 6e3370835f703..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/manifest.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "version": "30.0.0", - "artifacts": { - "aws-cdk-athena-workgroup-tags.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "aws-cdk-athena-workgroup-tags.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "aws-cdk-athena-workgroup-tags": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-cdk-athena-workgroup-tags.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d8b01509e317c31bcc2aa728dce91fba9a9fb5d533a6b61cf09948a178861951.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "aws-cdk-athena-workgroup-tags.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "aws-cdk-athena-workgroup-tags.assets" - ], - "metadata": { - "/aws-cdk-athena-workgroup-tags/AthenaWorkgroup": [ - { - "type": "aws:cdk:logicalId", - "data": "AthenaWorkgroup" - } - ], - "/aws-cdk-athena-workgroup-tags/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/aws-cdk-athena-workgroup-tags/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "aws-cdk-athena-workgroup-tags" - }, - "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "athenaworkgrouptagstestDefaultTestDeployAssert5C4419AB.assets" - ], - "metadata": { - "/athena-workgroup-tags-test/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/athena-workgroup-tags-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "athena-workgroup-tags-test/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/tree.json b/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/tree.json deleted file mode 100644 index 5aad17478f674..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.js.snapshot/tree.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "aws-cdk-athena-workgroup-tags": { - "id": "aws-cdk-athena-workgroup-tags", - "path": "aws-cdk-athena-workgroup-tags", - "children": { - "AthenaWorkgroup": { - "id": "AthenaWorkgroup", - "path": "aws-cdk-athena-workgroup-tags/AthenaWorkgroup", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Athena::WorkGroup", - "aws:cdk:cloudformation:props": { - "name": "HelloWorld", - "description": "A WorkGroup", - "recursiveDeleteOption": true, - "state": "ENABLED", - "tags": [ - { - "key": "key1", - "value": "value1" - }, - { - "key": "key2", - "value": "value2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-athena.CfnWorkGroup", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "aws-cdk-athena-workgroup-tags/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "aws-cdk-athena-workgroup-tags/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - }, - "athena-workgroup-tags-test": { - "id": "athena-workgroup-tags-test", - "path": "athena-workgroup-tags-test", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "athena-workgroup-tags-test/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "athena-workgroup-tags-test/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.249" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "athena-workgroup-tags-test/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "athena-workgroup-tags-test/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "athena-workgroup-tags-test/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.249" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/test/integ.workgroup.ts b/packages/@aws-cdk/aws-athena/test/integ.workgroup.ts deleted file mode 100644 index 8a5a05ee50cf2..0000000000000 --- a/packages/@aws-cdk/aws-athena/test/integ.workgroup.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { CfnWorkGroup } from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-athena-workgroup-tags'); - -new CfnWorkGroup(stack, 'AthenaWorkgroup', { - name: 'HelloWorld', - description: 'A WorkGroup', - recursiveDeleteOption: true, - state: 'ENABLED', - tags: [ - { - key: 'key1', - value: 'value1', - }, - { - key: 'key2', - value: 'value2', - }, - ], -}); - -new IntegTest(app, 'athena-workgroup-tags-test', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-auditmanager/.eslintrc.js b/packages/@aws-cdk/aws-auditmanager/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-auditmanager/.gitignore b/packages/@aws-cdk/aws-auditmanager/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-auditmanager/.npmignore b/packages/@aws-cdk/aws-auditmanager/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-auditmanager/LICENSE b/packages/@aws-cdk/aws-auditmanager/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-auditmanager/NOTICE b/packages/@aws-cdk/aws-auditmanager/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-auditmanager/README.md b/packages/@aws-cdk/aws-auditmanager/README.md deleted file mode 100644 index 7da734187ed09..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::AuditManager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as auditmanager from '@aws-cdk/aws-auditmanager'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AuditManager construct libraries](https://constructs.dev/search?q=auditmanager) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AuditManager resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AuditManager.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AuditManager](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AuditManager.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-auditmanager/jest.config.js b/packages/@aws-cdk/aws-auditmanager/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-auditmanager/lib/index.ts b/packages/@aws-cdk/aws-auditmanager/lib/index.ts deleted file mode 100644 index f6234117e603f..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AuditManager CloudFormation Resources: -export * from './auditmanager.generated'; diff --git a/packages/@aws-cdk/aws-auditmanager/package.json b/packages/@aws-cdk/aws-auditmanager/package.json deleted file mode 100644 index 065f5346ccaf3..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-auditmanager", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::AuditManager", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.AuditManager", - "packageId": "Amazon.CDK.AWS.AuditManager", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.auditmanager", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "auditmanager" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-auditmanager", - "module": "aws_cdk.aws_auditmanager" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-auditmanager" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AuditManager", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::AuditManager", - "aws-auditmanager" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-auditmanager/test/auditmanager.test.ts b/packages/@aws-cdk/aws-auditmanager/test/auditmanager.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-auditmanager/test/auditmanager.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-autoscaling-common/.eslintrc.js b/packages/@aws-cdk/aws-autoscaling-common/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscaling-common/.gitignore b/packages/@aws-cdk/aws-autoscaling-common/.gitignore deleted file mode 100644 index 6d9260259c3e0..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -lambda/bundle.zip - -*.js -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii -lib/*.zip - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -tsconfig.json - -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-autoscaling-common/.npmignore b/packages/@aws-cdk/aws-autoscaling-common/.npmignore deleted file mode 100644 index d7bdcd01a63c6..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -lambda/src -lambda/test -lambda/*.sh -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-autoscaling-common/LICENSE b/packages/@aws-cdk/aws-autoscaling-common/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-autoscaling-common/NOTICE b/packages/@aws-cdk/aws-autoscaling-common/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-autoscaling-common/README.md b/packages/@aws-cdk/aws-autoscaling-common/README.md deleted file mode 100644 index fdea0531620e1..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# AWS AutoScaling Common Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This is a sister package to `@aws-cdk/aws-autoscaling` and -`@aws-cdk/aws-applicationautoscaling`. It contains shared implementation -details between them. - -It does not need to be used directly. diff --git a/packages/@aws-cdk/aws-autoscaling-common/jest.config.js b/packages/@aws-cdk/aws-autoscaling-common/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscaling-common/package.json b/packages/@aws-cdk/aws-autoscaling-common/package.json deleted file mode 100644 index fd7bcfa055b8f..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-common/package.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "name": "@aws-cdk/aws-autoscaling-common", - "version": "0.0.0", - "private": true, - "description": "Common implementation package for @aws-cdk/aws-autoscaling and @aws-cdk/aws-applicationautoscaling", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.autoscaling.common", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "autoscaling-common" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.AutoScaling.Common", - "packageId": "Amazon.CDK.AWS.AutoScaling.Common", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-autoscaling-common", - "module": "aws_cdk.aws_autoscaling_common", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-autoscaling-common" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "s3" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "fast-check": "^2.25.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "awslint": { - "exclude": [ - "no-unused-type:@aws-cdk/aws-autoscaling-common.*", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.ArbitraryIntervals", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.IRandomGenerator.nextInt", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.IRandomGenerator.nextBoolean", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.IRandomGenerator", - "props-default-doc:@aws-cdk/aws-autoscaling-common.CompleteScalingInterval.change", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.Alarms", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.Alarms.lowerAlarmIntervalIndex", - "props-default-doc:@aws-cdk/aws-autoscaling-common.Alarms.lowerAlarmIntervalIndex", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.Alarms.upperAlarmIntervalIndex", - "props-default-doc:@aws-cdk/aws-autoscaling-common.Alarms.upperAlarmIntervalIndex", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.CompleteScalingInterval.change", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.ArbitraryIntervals.absolute", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.ArbitraryIntervals.intervals", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.CompleteScalingInterval", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.CompleteScalingInterval.lower", - "docs-public-apis:@aws-cdk/aws-autoscaling-common.CompleteScalingInterval.upper" - ] - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/.eslintrc.js b/packages/@aws-cdk/aws-autoscaling-hooktargets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/.gitignore b/packages/@aws-cdk/aws-autoscaling-hooktargets/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/.npmignore b/packages/@aws-cdk/aws-autoscaling-hooktargets/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/LICENSE b/packages/@aws-cdk/aws-autoscaling-hooktargets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/NOTICE b/packages/@aws-cdk/aws-autoscaling-hooktargets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/README.md b/packages/@aws-cdk/aws-autoscaling-hooktargets/README.md deleted file mode 100644 index 806170e6fd167..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Lifecycle Hook for the CDK AWS AutoScaling Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library contains integration classes for AutoScaling lifecycle hooks. -Instances of these classes should be passed to the -`autoScalingGroup.addLifecycleHook()` method. - -Lifecycle hooks can be activated in one of the following ways: - -* Invoke a Lambda function -* Publish to an SNS topic -* Send to an SQS queue - -For more information on using this library, see the README of the -`@aws-cdk/aws-autoscaling` library. - -For more information about lifecycle hooks, see -[Amazon EC2 AutoScaling Lifecycle hooks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) in the Amazon EC2 User Guide. diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/jest.config.js b/packages/@aws-cdk/aws-autoscaling-hooktargets/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/common.ts b/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/common.ts deleted file mode 100644 index 6dd0544f106a3..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/common.ts +++ /dev/null @@ -1,14 +0,0 @@ -// eslint-disable-next-line import/order -import * as iam from '@aws-cdk/aws-iam'; -import * as constructs from 'constructs'; - -export function createRole(scope: constructs.Construct, _role?: iam.IRole) { - let role = _role; - if (!role) { - role = new iam.Role(scope, 'Role', { - assumedBy: new iam.ServicePrincipal('autoscaling.amazonaws.com'), - }); - } - - return role; -} diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json deleted file mode 100644 index c8aa0e9524665..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "name": "@aws-cdk/aws-autoscaling-hooktargets", - "version": "0.0.0", - "private": true, - "description": "Lifecycle hook for AWS AutoScaling", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.autoscaling.hooktargets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "autoscaling-hooktargets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.AutoScaling.HookTargets", - "packageId": "Amazon.CDK.AWS.AutoScaling.HookTargets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-autoscaling-hooktargets", - "module": "aws_cdk.aws_autoscaling_hooktargets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-autoscaling-hooktargets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "autoscaling" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-autoscaling/.eslintrc.js b/packages/@aws-cdk/aws-autoscaling/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscaling/.gitignore b/packages/@aws-cdk/aws-autoscaling/.gitignore deleted file mode 100644 index e9725a3028633..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -*.generated.ts -tsconfig.json -node_modules -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -!jest.config.js -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-autoscaling/.npmignore b/packages/@aws-cdk/aws-autoscaling/.npmignore deleted file mode 100644 index a59f043eedc1f..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -jest.config.js -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-autoscaling/LICENSE b/packages/@aws-cdk/aws-autoscaling/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-autoscaling/NOTICE b/packages/@aws-cdk/aws-autoscaling/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-autoscaling/README.md b/packages/@aws-cdk/aws-autoscaling/README.md deleted file mode 100644 index 7efe26c2593e4..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/README.md +++ /dev/null @@ -1,669 +0,0 @@ -# Amazon EC2 Auto Scaling Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Auto Scaling Group - -An `AutoScalingGroup` represents a number of instances on which you run your code. You -pick the size of the fleet, the instance type and the OS image: - -```ts -declare const vpc: ec2.Vpc; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), - - // The latest Amazon Linux image of a particular generation - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }), -}); -``` - -NOTE: AutoScalingGroup has an property called `allowAllOutbound` (allowing the instances to contact the -internet) which is set to `true` by default. Be sure to set this to `false` if you don't want -your instances to be able to start arbitrary connections. Alternatively, you can specify an existing security -group to attach to the instances that are launched, rather than have the group create a new one. - -```ts -declare const vpc: ec2.Vpc; - -const mySecurityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc }); -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }), - securityGroup: mySecurityGroup, -}); -``` - -Alternatively you can create an `AutoScalingGroup` from a `LaunchTemplate`: - -```ts -declare const vpc: ec2.Vpc; -declare const launchTemplate: ec2.LaunchTemplate; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - launchTemplate: launchTemplate -}); -``` - -To launch a mixture of Spot and on-demand instances, and/or with multiple instance types, you can create an `AutoScalingGroup` from a MixedInstancesPolicy: - -```ts -declare const vpc: ec2.Vpc; -declare const launchTemplate1: ec2.LaunchTemplate; -declare const launchTemplate2: ec2.LaunchTemplate; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - mixedInstancesPolicy: { - instancesDistribution: { - onDemandPercentageAboveBaseCapacity: 50, // Mix Spot and On-Demand instances - }, - launchTemplate: launchTemplate1, - launchTemplateOverrides: [ // Mix multiple instance types - { instanceType: new ec2.InstanceType('t3.micro') }, - { instanceType: new ec2.InstanceType('t3a.micro') }, - { instanceType: new ec2.InstanceType('t4g.micro'), launchTemplate: launchTemplate2 }, - ], - } -}); -``` - -## Machine Images (AMIs) - -AMIs control the OS that gets launched when you start your EC2 instance. The EC2 -library contains constructs to select the AMI you want to use. - -Depending on the type of AMI, you select it a different way. - -The latest version of Amazon Linux and Microsoft Windows images are -selectable by instantiating one of these classes: - -[example of creating images](test/example.images.lit.ts) - -> NOTE: The Amazon Linux images selected will be cached in your `cdk.json`, so that your -> AutoScalingGroups don't automatically change out from under you when you're making unrelated -> changes. To update to the latest version of Amazon Linux, remove the cache entry from the `context` -> section of your `cdk.json`. -> -> We will add command-line options to make this step easier in the future. - -## AutoScaling Instance Counts - -AutoScalingGroups make it possible to raise and lower the number of instances in the group, -in response to (or in advance of) changes in workload. - -When you create your AutoScalingGroup, you specify a `minCapacity` and a -`maxCapacity`. AutoScaling policies that respond to metrics will never go higher -or lower than the indicated capacity (but scheduled scaling actions might, see -below). - -There are three ways to scale your capacity: - -* **In response to a metric** (also known as step scaling); for example, you - might want to scale out if the CPU usage across your cluster starts to rise, - and scale in when it drops again. -* **By trying to keep a certain metric around a given value** (also known as - target tracking scaling); you might want to automatically scale out and in to - keep your CPU usage around 50%. -* **On a schedule**; you might want to organize your scaling around traffic - flows you expect, by scaling out in the morning and scaling in in the - evening. - -The general pattern of autoscaling will look like this: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - minCapacity: 5, - maxCapacity: 100 - // ... -}); - -// Then call one of the scaling methods (explained below) -// -// autoScalingGroup.scaleOnMetric(...); -// -// autoScalingGroup.scaleOnCpuUtilization(...); -// autoScalingGroup.scaleOnIncomingBytes(...); -// autoScalingGroup.scaleOnOutgoingBytes(...); -// autoScalingGroup.scaleOnRequestCount(...); -// autoScalingGroup.scaleToTrackMetric(...); -// -// autoScalingGroup.scaleOnSchedule(...); -``` - -### Step Scaling - -This type of scaling scales in and out in deterministics steps that you -configure, in response to metric values. For example, your scaling strategy to -scale in response to a metric that represents your average worker pool usage -might look like this: - -```plaintext - Scaling -1 (no change) +1 +3 - │ │ │ │ │ - ├────────┼───────────────────────┼────────┼────────┤ - │ │ │ │ │ -Worker use 0% 10% 50% 70% 100% -``` - -(Note that this is not necessarily a recommended scaling strategy, but it's -a possible one. You will have to determine what thresholds are right for you). - -Note that in order to set up this scaling strategy, you will have to emit a -metric representing your worker utilization from your instances. After that, -you would configure the scaling something like this: - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -const workerUtilizationMetric = new cloudwatch.Metric({ - namespace: 'MyService', - metricName: 'WorkerUtilization' -}); - -autoScalingGroup.scaleOnMetric('ScaleToCPU', { - metric: workerUtilizationMetric, - scalingSteps: [ - { upper: 10, change: -1 }, - { lower: 50, change: +1 }, - { lower: 70, change: +3 }, - ], - - // Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the - // 'change' numbers before as percentages instead of capacity counts. - adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY, -}); -``` - -The AutoScaling construct library will create the required CloudWatch alarms and -AutoScaling policies for you. - -### Target Tracking Scaling - -This type of scaling scales in and out in order to keep a metric around a value -you prefer. There are four types of predefined metrics you can track, or you can -choose to track a custom metric. If you do choose to track a custom metric, -be aware that the metric has to represent instance utilization in some way -(AutoScaling will scale out if the metric is higher than the target, and scale -in if the metric is lower than the target). - -If you configure multiple target tracking policies, AutoScaling will use the -one that yields the highest capacity. - -The following example scales to keep the CPU usage of your instances around -50% utilization: - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -autoScalingGroup.scaleOnCpuUtilization('KeepSpareCPU', { - targetUtilizationPercent: 50 -}); -``` - -To scale on average network traffic in and out of your instances: - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -autoScalingGroup.scaleOnIncomingBytes('LimitIngressPerInstance', { - targetBytesPerSecond: 10 * 1024 * 1024 // 10 MB/s -}); -autoScalingGroup.scaleOnOutgoingBytes('LimitEgressPerInstance', { - targetBytesPerSecond: 10 * 1024 * 1024 // 10 MB/s -}); -``` - -To scale on the average request count per instance (only works for -AutoScalingGroups that have been attached to Application Load -Balancers): - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -autoScalingGroup.scaleOnRequestCount('LimitRPS', { - targetRequestsPerSecond: 1000 -}); -``` - -### Scheduled Scaling - -This type of scaling is used to change capacities based on time. It works by -changing `minCapacity`, `maxCapacity` and `desiredCapacity` of the -AutoScalingGroup, and so can be used for two purposes: - -* Scale in and out on a schedule by setting the `minCapacity` high or - the `maxCapacity` low. -* Still allow the regular scaling actions to do their job, but restrict - the range they can scale over (by setting both `minCapacity` and - `maxCapacity` but changing their range over time). - -A schedule is expressed as a cron expression. The `Schedule` class has a `cron` method to help build cron expressions. - -The following example scales the fleet out in the morning, going back to natural -scaling (all the way down to 1 instance if necessary) at night: - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -autoScalingGroup.scaleOnSchedule('PrescaleInTheMorning', { - schedule: autoscaling.Schedule.cron({ hour: '8', minute: '0' }), - minCapacity: 20, -}); - -autoScalingGroup.scaleOnSchedule('AllowDownscalingAtNight', { - schedule: autoscaling.Schedule.cron({ hour: '20', minute: '0' }), - minCapacity: 1 -}); -``` - -### Block Devices - -This type specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. - -#### GP3 Volumes - -You can only specify the `throughput` on GP3 volumes. - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - blockDevices: [ - { - deviceName: 'gp3-volume', - volume: autoscaling.BlockDeviceVolume.ebs(15, { - volumeType: autoscaling.EbsDeviceVolumeType.GP3, - throughput: 125, - }), - }, - ], - // ... -}); -``` - -## Configuring Instances using CloudFormation Init - -It is possible to use the CloudFormation Init mechanism to configure the -instances in the AutoScalingGroup. You can write files to it, run commands, -start services, etc. See the documentation of -[AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html) -and the documentation of CDK's `aws-ec2` library for more information. - -When you specify a CloudFormation Init configuration for an AutoScalingGroup: - -* you *must* also specify `signals` to configure how long CloudFormation - should wait for the instances to successfully configure themselves. -* you *should* also specify an `updatePolicy` to configure how instances - should be updated when the AutoScalingGroup is updated (for example, - when the AMI is updated). If you don't specify an update policy, a *rolling - update* is chosen by default. - -Here's an example of using CloudFormation Init to write a file to the -instance hosts on startup: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - init: ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromString('/etc/my_instance', 'This got written during instance startup'), - ), - signals: autoscaling.Signals.waitForAll({ - timeout: Duration.minutes(10), - }), -}); -``` - -## Signals - -In normal operation, CloudFormation will send a Create or Update command to -an AutoScalingGroup and proceed with the rest of the deployment without waiting -for the *instances in the AutoScalingGroup*. - -Configure `signals` to tell CloudFormation to wait for a specific number of -instances in the AutoScalingGroup to have been started (or failed to start) -before moving on. An instance is supposed to execute the -[`cfn-signal`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-signal.html) -program as part of its startup to indicate whether it was started -successfully or not. - -If you use CloudFormation Init support (described in the previous section), -the appropriate call to `cfn-signal` is automatically added to the -AutoScalingGroup's UserData. If you don't use the `signals` directly, you are -responsible for adding such a call yourself. - -The following type of `Signals` are available: - -* `Signals.waitForAll([options])`: wait for all of `desiredCapacity` amount of instances - to have started (recommended). -* `Signals.waitForMinCapacity([options])`: wait for a `minCapacity` amount of instances - to have started (use this if waiting for all instances takes too long and you are happy - with a minimum count of healthy hosts). -* `Signals.waitForCount(count, [options])`: wait for a specific amount of instances to have - started. - -There are two `options` you can configure: - -* `timeout`: maximum time a host startup is allowed to take. If a host does not report - success within this time, it is considered a failure. Default is 5 minutes. -* `minSuccessPercentage`: percentage of hosts that needs to be healthy in order for the - update to succeed. If you set this value lower than 100, some percentage of hosts may - report failure, while still considering the deployment a success. Default is 100%. - -## Update Policy - -The *update policy* describes what should happen to running instances when the definition -of the AutoScalingGroup is changed. For example, if you add a command to the UserData -of an AutoScalingGroup, do the existing instances get replaced with new instances that -have executed the new UserData? Or do the "old" instances just keep on running? - -It is recommended to always use an update policy, otherwise the current state of your -instances also depends the previous state of your instances, rather than just on your -source code. This degrades the reproducibility of your deployments. - -The following update policies are available: - -* `UpdatePolicy.none()`: leave existing instances alone (not recommended). -* `UpdatePolicy.rollingUpdate([options])`: progressively replace the existing - instances with new instances, in small batches. At any point in time, - roughly the same amount of total instances will be running. If the deployment - needs to be rolled back, the fresh instances will be replaced with the "old" - configuration again. -* `UpdatePolicy.replacingUpdate([options])`: build a completely fresh copy - of the new AutoScalingGroup next to the old one. Once the AutoScalingGroup - has been successfully created (and the instances started, if `signals` is - configured on the AutoScalingGroup), the old AutoScalingGroup is deleted. - If the deployment needs to be rolled back, the new AutoScalingGroup is - deleted and the old one is left unchanged. - -## Allowing Connections - -See the documentation of the `@aws-cdk/aws-ec2` package for more information -about allowing connections between resources backed by instances. - -## Max Instance Lifetime - -To enable the max instance lifetime support, specify `maxInstanceLifetime` property -for the `AutoscalingGroup` resource. The value must be between 7 and 365 days(inclusive). -To clear a previously set value, leave this property undefined. - -## Instance Monitoring - -To disable detailed instance monitoring, specify `instanceMonitoring` property -for the `AutoscalingGroup` resource as `Monitoring.BASIC`. Otherwise detailed monitoring -will be enabled. - -## Monitoring Group Metrics - -Group metrics are used to monitor group level properties; they describe the group rather than any of its instances (e.g GroupMaxSize, the group maximum size). To enable group metrics monitoring, use the `groupMetrics` property. -All group metrics are reported in a granularity of 1 minute at no additional charge. - -See [EC2 docs](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html#as-group-metrics) for a list of all available group metrics. - -To enable group metrics monitoring using the `groupMetrics` property: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -// Enable monitoring of all group metrics -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - groupMetrics: [autoscaling.GroupMetrics.all()], -}); - -// Enable monitoring for a subset of group metrics -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - groupMetrics: [new autoscaling.GroupMetrics(autoscaling.GroupMetric.MIN_SIZE, autoscaling.GroupMetric.MAX_SIZE)], -}); -``` - -## Termination policies - -Auto Scaling uses [termination policies](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html) -to determine which instances it terminates first during scale-in events. You -can specify one or more termination policies with the `terminationPolicies` -property: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - terminationPolicies: [ - autoscaling.TerminationPolicy.OLDEST_INSTANCE, - autoscaling.TerminationPolicy.DEFAULT, - ], -}); -``` - -## Protecting new instances from being terminated on scale-in - -By default, Auto Scaling can terminate an instance at any time after launch when -scaling in an Auto Scaling Group, subject to the group's [termination -policy](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html). - -However, you may wish to protect newly-launched instances from being scaled in -if they are going to run critical applications that should not be prematurely -terminated. EC2 Capacity Providers for Amazon ECS requires this attribute be -set to `true`. - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - newInstancesProtectedFromScaleIn: true, -}); -``` - -## Configuring Capacity Rebalancing - -Indicates whether Capacity Rebalancing is enabled. Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see [Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) in the in the Amazon EC2 Auto Scaling User Guide. - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - capacityRebalance: true, -}); -``` - -## Connecting to your instances using SSM Session Manager - -SSM Session Manager makes it possible to connect to your instances from the -AWS Console, without preparing SSH keys. - -To do so, you need to: - -* Use an image with [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) installed - and configured. [Many images come with SSM Agent - preinstalled](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html), otherwise you - may need to manually put instructions to [install SSM - Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) into your - instance's UserData or use EC2 Init). -* Create the AutoScalingGroup with `ssmSessionPermissions: true`. - -If these conditions are met, you can connect to the instance from the EC2 Console. Example: - -```ts -declare const vpc: ec2.Vpc; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO), - - // Amazon Linux 2 comes with SSM Agent by default - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }), - - // Turn on SSM - ssmSessionPermissions: true, -}); -``` - -## Configuring Instance Metadata Service (IMDS) - -### Toggling IMDSv1 - -You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options to either -allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS. - -To do this for a single `AutoScalingGroup`, you can use set the `requireImdsv2` property. -The example below demonstrates IMDSv2 being required on a single `AutoScalingGroup`: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - requireImdsv2: true, -}); -``` - -You can also use `AutoScalingGroupRequireImdsv2Aspect` to apply the operation to multiple AutoScalingGroups. -The example below demonstrates the `AutoScalingGroupRequireImdsv2Aspect` being used to require IMDSv2 for all AutoScalingGroups in a stack: - -```ts -const aspect = new autoscaling.AutoScalingGroupRequireImdsv2Aspect(); - -Aspects.of(this).add(aspect); -``` - -## Warm Pool - -Auto Scaling offers [a warm pool](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) which gives an ability to decrease latency for applications that have exceptionally long boot times. You can create a warm pool with default parameters as below: - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -autoScalingGroup.addWarmPool(); -``` - -You can also customize a warm pool by configuring parameters: - -```ts -declare const autoScalingGroup: autoscaling.AutoScalingGroup; - -autoScalingGroup.addWarmPool({ - minSize: 1, - reuseOnScaleIn: true, -}); -``` - -### Default Instance Warming - -You can use the default instance warmup feature to improve the Amazon CloudWatch metrics used for dynamic scaling. -When default instance warmup is not enabled, each instance starts contributing usage data to the aggregated metrics -as soon as the instance reaches the InService state. However, if you enable default instance warmup, this lets -your instances finish warming up before they contribute the usage data. - -To optimize the performance of scaling policies that scale continuously, such as target tracking and step scaling -policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds. - -To set up Default Instance Warming for an autoscaling group, simply pass it in as a prop - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - - -new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType, - machineImage, - - // ... - - defaultInstanceWarmup: Duration.seconds(5), -}); -``` - -## Future work - -* [ ] CloudWatch Events (impossible to add currently as the AutoScalingGroup ARN is - necessary to make this rule and this cannot be accessed from CloudFormation). diff --git a/packages/@aws-cdk/aws-autoscaling/jest.config.js b/packages/@aws-cdk/aws-autoscaling/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/aspects/require-imdsv2-aspect.ts b/packages/@aws-cdk/aws-autoscaling/lib/aspects/require-imdsv2-aspect.ts deleted file mode 100644 index 840cb5d215fd0..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/lib/aspects/require-imdsv2-aspect.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IConstruct } from 'constructs'; -import { AutoScalingGroup } from '../auto-scaling-group'; -import { CfnLaunchConfiguration } from '../autoscaling.generated'; - -/** - * Aspect that makes IMDSv2 required on instances deployed by AutoScalingGroups. - */ -export class AutoScalingGroupRequireImdsv2Aspect implements cdk.IAspect { - constructor() { - } - - public visit(node: IConstruct): void { - if (!(node instanceof AutoScalingGroup)) { - return; - } - - const launchConfig = node.node.tryFindChild('LaunchConfig') as CfnLaunchConfiguration; - if (cdk.isResolvableObject(launchConfig.metadataOptions)) { - this.warn(node, 'CfnLaunchConfiguration.MetadataOptions field is a CDK token.'); - return; - } - - launchConfig.metadataOptions = { - ...launchConfig.metadataOptions, - httpTokens: 'required', - }; - } - - /** - * Adds a warning annotation to a node. - * - * @param node The scope to add the warning to. - * @param message The warning message. - */ - protected warn(node: IConstruct, message: string) { - cdk.Annotations.of(node).addWarning(`${AutoScalingGroupRequireImdsv2Aspect.name} failed on node ${node.node.id}: ${message}`); - } -} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/schedule.ts b/packages/@aws-cdk/aws-autoscaling/lib/schedule.ts deleted file mode 100644 index 48b6553639319..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/lib/schedule.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { Annotations } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Schedule for scheduled scaling actions - */ -export abstract class Schedule { - /** - * Construct a schedule from a literal schedule expression - * - * @param expression The expression to use. Must be in a format that AutoScaling will recognize - * @see http://crontab.org/ - */ - public static expression(expression: string): Schedule { - return new LiteralSchedule(expression); - } - - /** - * Create a schedule from a set of cron fields - */ - public static cron(options: CronOptions): Schedule { - if (options.weekDay !== undefined && options.day !== undefined) { - throw new Error('Cannot supply both \'day\' and \'weekDay\', use at most one'); - } - - const minute = fallback(options.minute, '*'); - const hour = fallback(options.hour, '*'); - const month = fallback(options.month, '*'); - const day = fallback(options.day, '*'); - const weekDay = fallback(options.weekDay, '*'); - - return new class extends Schedule { - public readonly expressionString: string = `${minute} ${hour} ${day} ${month} ${weekDay}`; - public _bind(scope: Construct) { - if (!options.minute) { - Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.'); - } - return new LiteralSchedule(this.expressionString); - } - }; - } - - /** - * Retrieve the expression for this schedule - */ - public abstract readonly expressionString: string; - - protected constructor() {} - - /** - * - * @internal - */ - public abstract _bind(scope: Construct): void; -} - -/** - * Options to configure a cron expression - * - * All fields are strings so you can use complex expressions. Absence of - * a field implies '*' or '?', whichever one is appropriate. - * - * @see http://crontab.org/ - */ -export interface CronOptions { - /** - * The minute to run this rule at - * - * @default - Every minute - */ - readonly minute?: string; - - /** - * The hour to run this rule at - * - * @default - Every hour - */ - readonly hour?: string; - - /** - * The day of the month to run this rule at - * - * @default - Every day of the month - */ - readonly day?: string; - - /** - * The month to run this rule at - * - * @default - Every month - */ - readonly month?: string; - - /** - * The day of the week to run this rule at - * - * @default - Any day of the week - */ - readonly weekDay?: string; -} - -class LiteralSchedule extends Schedule { - constructor(public readonly expressionString: string) { - super(); - } - - public _bind(): void {} -} - -function fallback(x: T | undefined, def: T): T { - return x === undefined ? def : x; -} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts deleted file mode 100644 index 78e64b28cb429..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts +++ /dev/null @@ -1,182 +0,0 @@ -import { Duration, Lazy } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IAutoScalingGroup } from './auto-scaling-group'; -import { CfnScalingPolicy } from './autoscaling.generated'; - -/** - * Properties for a scaling policy - */ -export interface StepScalingActionProps { - /** - * The auto scaling group - */ - readonly autoScalingGroup: IAutoScalingGroup; - - /** - * Period after a scaling completes before another scaling activity can start. - * - * @default The default cooldown configured on the AutoScalingGroup - */ - readonly cooldown?: Duration; - - /** - * Estimated time until a newly launched instance can send metrics to CloudWatch. - * - * @default Same as the cooldown - */ - readonly estimatedInstanceWarmup?: Duration; - - /** - * How the adjustment numbers are interpreted - * - * @default ChangeInCapacity - */ - readonly adjustmentType?: AdjustmentType; - - /** - * Minimum absolute number to adjust capacity with as result of percentage scaling. - * - * Only when using AdjustmentType = PercentChangeInCapacity, this number controls - * the minimum absolute effect size. - * - * @default No minimum scaling effect - */ - readonly minAdjustmentMagnitude?: number; - - /** - * The aggregation type for the CloudWatch metrics. - * - * @default Average - */ - readonly metricAggregationType?: MetricAggregationType; -} - -/** - * Define a step scaling action - * - * This kind of scaling policy adjusts the target capacity in configurable - * steps. The size of the step is configurable based on the metric's distance - * to its alarm threshold. - * - * This Action must be used as the target of a CloudWatch alarm to take effect. - */ -export class StepScalingAction extends Construct { - /** - * ARN of the scaling policy - */ - public readonly scalingPolicyArn: string; - - private readonly adjustments = new Array(); - - constructor(scope: Construct, id: string, props: StepScalingActionProps) { - super(scope, id); - - const resource = new CfnScalingPolicy(this, 'Resource', { - policyType: 'StepScaling', - autoScalingGroupName: props.autoScalingGroup.autoScalingGroupName, - cooldown: props.cooldown && props.cooldown.toSeconds().toString(), - estimatedInstanceWarmup: props.estimatedInstanceWarmup && props.estimatedInstanceWarmup.toSeconds(), - adjustmentType: props.adjustmentType, - minAdjustmentMagnitude: props.minAdjustmentMagnitude, - metricAggregationType: props.metricAggregationType, - stepAdjustments: Lazy.any({ produce: () => this.adjustments }), - }); - - this.scalingPolicyArn = resource.ref; - } - - /** - * Add an adjusment interval to the ScalingAction - */ - public addAdjustment(adjustment: AdjustmentTier) { - if (adjustment.lowerBound === undefined && adjustment.upperBound === undefined) { - throw new Error('At least one of lowerBound or upperBound is required'); - } - this.adjustments.push({ - metricIntervalLowerBound: adjustment.lowerBound, - metricIntervalUpperBound: adjustment.upperBound, - scalingAdjustment: adjustment.adjustment, - }); - } -} - -/** - * How adjustment numbers are interpreted - */ -export enum AdjustmentType { - /** - * Add the adjustment number to the current capacity. - * - * A positive number increases capacity, a negative number decreases capacity. - */ - CHANGE_IN_CAPACITY = 'ChangeInCapacity', - - /** - * Add this percentage of the current capacity to itself. - * - * The number must be between -100 and 100; a positive number increases - * capacity and a negative number decreases it. - */ - PERCENT_CHANGE_IN_CAPACITY = 'PercentChangeInCapacity', - - /** - * Make the capacity equal to the exact number given. - */ - EXACT_CAPACITY = 'ExactCapacity', -} - -/** - * How the scaling metric is going to be aggregated - */ -export enum MetricAggregationType { - /** - * Average - */ - AVERAGE = 'Average', - - /** - * Minimum - */ - MINIMUM = 'Minimum', - - /** - * Maximum - */ - MAXIMUM = 'Maximum' -} - -/** - * An adjustment - */ -export interface AdjustmentTier { - /** - * What number to adjust the capacity with - * - * The number is interpeted as an added capacity, a new fixed capacity or an - * added percentage depending on the AdjustmentType value of the - * StepScalingPolicy. - * - * Can be positive or negative. - */ - readonly adjustment: number; - - /** - * Lower bound where this scaling tier applies. - * - * The scaling tier applies if the difference between the metric - * value and its alarm threshold is higher than this value. - * - * @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier - */ - readonly lowerBound?: number; - - /** - * Upper bound where this scaling tier applies - * - * The scaling tier applies if the difference between the metric - * value and its alarm threshold is lower than this value. - * - * @default +Infinity - */ - readonly upperBound?: number; -} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts b/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts deleted file mode 100644 index 2632d6ff0271d..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { findAlarmThresholds, normalizeIntervals } from '@aws-cdk/aws-autoscaling-common'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Duration } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IAutoScalingGroup } from './auto-scaling-group'; -import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action'; - -export interface BasicStepScalingPolicyProps { - /** - * Metric to scale on. - */ - readonly metric: cloudwatch.IMetric; - - /** - * The intervals for scaling. - * - * Maps a range of metric values to a particular scaling behavior. - */ - readonly scalingSteps: ScalingInterval[]; - - /** - * How the adjustment numbers inside 'intervals' are interpreted. - * - * @default ChangeInCapacity - */ - readonly adjustmentType?: AdjustmentType; - - /** - * Grace period after scaling activity. - * - * @default Default cooldown period on your AutoScalingGroup - */ - readonly cooldown?: Duration; - - /** - * Estimated time until a newly launched instance can send metrics to CloudWatch. - * - * @default Same as the cooldown - */ - readonly estimatedInstanceWarmup?: Duration; - - /** - * Minimum absolute number to adjust capacity with as result of percentage scaling. - * - * Only when using AdjustmentType = PercentChangeInCapacity, this number controls - * the minimum absolute effect size. - * - * @default No minimum scaling effect - */ - readonly minAdjustmentMagnitude?: number; - - /** - * How many evaluation periods of the metric to wait before triggering a scaling action - * - * Raising this value can be used to smooth out the metric, at the expense - * of slower response times. - * - * @default 1 - */ - readonly evaluationPeriods?: number; - - /** - * Aggregation to apply to all data points over the evaluation periods - * - * Only has meaning if `evaluationPeriods != 1`. - * - * @default - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE. - */ - readonly metricAggregationType?: MetricAggregationType; -} - -export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { - /** - * The auto scaling group - */ - readonly autoScalingGroup: IAutoScalingGroup; -} - -/** - * Define a acaling strategy which scales depending on absolute values of some metric. - * - * You can specify the scaling behavior for various values of the metric. - * - * Implemented using one or more CloudWatch alarms and Step Scaling Policies. - */ -export class StepScalingPolicy extends Construct { - public readonly lowerAlarm?: cloudwatch.Alarm; - public readonly lowerAction?: StepScalingAction; - public readonly upperAlarm?: cloudwatch.Alarm; - public readonly upperAction?: StepScalingAction; - - constructor(scope: Construct, id: string, props: StepScalingPolicyProps) { - super(scope, id); - - if (props.scalingSteps.length < 2) { - throw new Error('You must supply at least 2 intervals for autoscaling'); - } - - const adjustmentType = props.adjustmentType || AdjustmentType.CHANGE_IN_CAPACITY; - const changesAreAbsolute = adjustmentType === AdjustmentType.EXACT_CAPACITY; - - const intervals = normalizeIntervals(props.scalingSteps, changesAreAbsolute); - const alarms = findAlarmThresholds(intervals); - - if (alarms.lowerAlarmIntervalIndex !== undefined) { - const threshold = intervals[alarms.lowerAlarmIntervalIndex].upper; - - this.lowerAction = new StepScalingAction(this, 'LowerPolicy', { - adjustmentType: props.adjustmentType, - cooldown: props.cooldown, - estimatedInstanceWarmup: props.estimatedInstanceWarmup, - metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), - minAdjustmentMagnitude: props.minAdjustmentMagnitude, - autoScalingGroup: props.autoScalingGroup, - }); - - for (let i = alarms.lowerAlarmIntervalIndex; i >= 0; i--) { - this.lowerAction.addAdjustment({ - adjustment: intervals[i].change!, - lowerBound: i !== 0 ? intervals[i].lower - threshold : undefined, // Extend last interval to -infinity - upperBound: intervals[i].upper - threshold, - }); - } - - this.lowerAlarm = new cloudwatch.Alarm(this, 'LowerAlarm', { - // Recommended by AutoScaling - metric: props.metric, - alarmDescription: 'Lower threshold scaling alarm', - comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD, - evaluationPeriods: props.evaluationPeriods ?? 1, - threshold, - }); - this.lowerAlarm.addAlarmAction(new StepScalingAlarmAction(this.lowerAction)); - } - - if (alarms.upperAlarmIntervalIndex !== undefined) { - const threshold = intervals[alarms.upperAlarmIntervalIndex].lower; - - this.upperAction = new StepScalingAction(this, 'UpperPolicy', { - adjustmentType: props.adjustmentType, - cooldown: props.cooldown, - estimatedInstanceWarmup: props.estimatedInstanceWarmup, - metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), - minAdjustmentMagnitude: props.minAdjustmentMagnitude, - autoScalingGroup: props.autoScalingGroup, - }); - - for (let i = alarms.upperAlarmIntervalIndex; i < intervals.length; i++) { - this.upperAction.addAdjustment({ - adjustment: intervals[i].change!, - lowerBound: intervals[i].lower - threshold, - upperBound: i !== intervals.length - 1 ? intervals[i].upper - threshold : undefined, // Extend last interval to +infinity - }); - } - - this.upperAlarm = new cloudwatch.Alarm(this, 'UpperAlarm', { - // Recommended by AutoScaling - metric: props.metric, - alarmDescription: 'Upper threshold scaling alarm', - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD, - evaluationPeriods: props.evaluationPeriods ?? 1, - threshold, - }); - this.upperAlarm.addAlarmAction(new StepScalingAlarmAction(this.upperAction)); - } - } -} - -function aggregationTypeFromMetric(metric: cloudwatch.IMetric): MetricAggregationType | undefined { - const statistic = metric.toMetricConfig().metricStat?.statistic; - if (statistic === undefined) { return undefined; } // Math expression, don't know aggregation, leave default - - switch (statistic) { - case 'Average': - return MetricAggregationType.AVERAGE; - case 'Minimum': - return MetricAggregationType.MINIMUM; - case 'Maximum': - return MetricAggregationType.MAXIMUM; - default: - return MetricAggregationType.AVERAGE; - } -} - -/** - * A range of metric values in which to apply a certain scaling operation - */ -export interface ScalingInterval { - /** - * The lower bound of the interval. - * - * The scaling adjustment will be applied if the metric is higher than this value. - * - * @default Threshold automatically derived from neighbouring intervals - */ - readonly lower?: number; - - /** - * The upper bound of the interval. - * - * The scaling adjustment will be applied if the metric is lower than this value. - * - * @default Threshold automatically derived from neighbouring intervals - */ - readonly upper?: number; - - /** - * The capacity adjustment to apply in this interval - * - * The number is interpreted differently based on AdjustmentType: - * - * - ChangeInCapacity: add the adjustment to the current capacity. - * The number can be positive or negative. - * - PercentChangeInCapacity: add or remove the given percentage of the current - * capacity to itself. The number can be in the range [-100..100]. - * - ExactCapacity: set the capacity to this number. The number must - * be positive. - */ - readonly change: number; -} - -/** - * Use a StepScalingAction as an Alarm Action - * - * This class is here and not in aws-cloudwatch-actions because this library - * needs to use the class, and otherwise we'd have a circular dependency: - * - * aws-autoscaling -> aws-cloudwatch-actions (for using the Action) - * aws-cloudwatch-actions -> aws-autoscaling (for the definition of IStepScalingAction) - */ -class StepScalingAlarmAction implements cloudwatch.IAlarmAction { - constructor(private readonly stepScalingAction: StepScalingAction) { - } - - public bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { - return { alarmActionArn: this.stepScalingAction.scalingPolicyArn }; - } -} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts b/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts deleted file mode 100644 index 1533821459cd2..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts +++ /dev/null @@ -1,185 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Duration } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IAutoScalingGroup } from './auto-scaling-group'; -import { CfnScalingPolicy } from './autoscaling.generated'; - -/** - * Base interface for target tracking props - * - * Contains the attributes that are common to target tracking policies, - * except the ones relating to the metric and to the scalable target. - * - * This interface is reused by more specific target tracking props objects. - */ -export interface BaseTargetTrackingProps { - /** - * Indicates whether scale in by the target tracking policy is disabled. - * - * If the value is true, scale in is disabled and the target tracking policy - * won't remove capacity from the autoscaling group. Otherwise, scale in is - * enabled and the target tracking policy can remove capacity from the - * group. - * - * @default false - */ - readonly disableScaleIn?: boolean; - - /** - * Period after a scaling completes before another scaling activity can start. - * - * @default - The default cooldown configured on the AutoScalingGroup. - */ - readonly cooldown?: Duration; - - /** - * Estimated time until a newly launched instance can send metrics to CloudWatch. - * - * @default - Same as the cooldown. - */ - readonly estimatedInstanceWarmup?: Duration; -} - -/** - * Properties for a Target Tracking policy that include the metric but exclude the target - */ -export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackingProps { - /** - * The target value for the metric. - */ - readonly targetValue: number; - - /** - * A predefined metric for application autoscaling - * - * The metric must track utilization. Scaling out will happen if the metric is higher than - * the target value, scaling in will happen in the metric is lower than the target value. - * - * Exactly one of customMetric or predefinedMetric must be specified. - * - * @default - No predefined metric. - */ - readonly predefinedMetric?: PredefinedMetric; - - /** - * A custom metric for application autoscaling - * - * The metric must track utilization. Scaling out will happen if the metric is higher than - * the target value, scaling in will happen in the metric is lower than the target value. - * - * Exactly one of customMetric or predefinedMetric must be specified. - * - * @default - No custom metric. - */ - readonly customMetric?: cloudwatch.IMetric; - - /** - * The resource label associated with the predefined metric - * - * Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the - * format should be: - * - * app///targetgroup// - * - * @default - No resource label. - */ - readonly resourceLabel?: string; -} - -/** - * Properties for a concrete TargetTrackingPolicy - * - * Adds the scalingTarget. - */ -export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps { - /* - * The auto scaling group - */ - readonly autoScalingGroup: IAutoScalingGroup; -} - -export class TargetTrackingScalingPolicy extends Construct { - /** - * ARN of the scaling policy - */ - public readonly scalingPolicyArn: string; - - /** - * The resource object - */ - private resource: CfnScalingPolicy; - - constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps) { - if ((props.customMetric === undefined) === (props.predefinedMetric === undefined)) { - throw new Error('Exactly one of \'customMetric\' or \'predefinedMetric\' must be specified.'); - } - - if (props.predefinedMetric === PredefinedMetric.ALB_REQUEST_COUNT_PER_TARGET && !props.resourceLabel) { - throw new Error('When tracking the ALBRequestCountPerTarget metric, the ALB identifier must be supplied in resourceLabel'); - } - - if (props.customMetric && !props.customMetric.toMetricConfig().metricStat) { - throw new Error('Only direct metrics are supported for Target Tracking. Use Step Scaling or supply a Metric object.'); - } - - super(scope, id); - - this.resource = new CfnScalingPolicy(this, 'Resource', { - policyType: 'TargetTrackingScaling', - autoScalingGroupName: props.autoScalingGroup.autoScalingGroupName, - cooldown: props.cooldown && props.cooldown.toSeconds().toString(), - estimatedInstanceWarmup: props.estimatedInstanceWarmup && props.estimatedInstanceWarmup.toSeconds(), - targetTrackingConfiguration: { - customizedMetricSpecification: renderCustomMetric(props.customMetric), - disableScaleIn: props.disableScaleIn, - predefinedMetricSpecification: props.predefinedMetric !== undefined ? { - predefinedMetricType: props.predefinedMetric, - resourceLabel: props.resourceLabel, - } : undefined, - targetValue: props.targetValue, - }, - }); - - this.scalingPolicyArn = this.resource.ref; - } -} - -function renderCustomMetric(metric?: cloudwatch.IMetric): CfnScalingPolicy.CustomizedMetricSpecificationProperty | undefined { - if (!metric) { return undefined; } - const c = metric.toMetricConfig().metricStat!; - - return { - dimensions: c.dimensions, - metricName: c.metricName, - namespace: c.namespace, - statistic: c.statistic, - unit: c.unitFilter, - }; -} - -/** - * One of the predefined autoscaling metrics - */ -export enum PredefinedMetric { - /** - * Average CPU utilization of the Auto Scaling group - */ - ASG_AVERAGE_CPU_UTILIZATION = 'ASGAverageCPUUtilization', - - /** - * Average number of bytes received on all network interfaces by the Auto Scaling group - */ - ASG_AVERAGE_NETWORK_IN = 'ASGAverageNetworkIn', - - /** - * Average number of bytes sent out on all network interfaces by the Auto Scaling group - */ - ASG_AVERAGE_NETWORK_OUT = 'ASGAverageNetworkOut', - - /** - * Number of requests completed per target in an Application Load Balancer target group - * - * Specify the ALB to look at in the `resourceLabel` field. - */ - ALB_REQUEST_COUNT_PER_TARGET = 'ALBRequestCountPerTarget', -} diff --git a/packages/@aws-cdk/aws-autoscaling/package.json b/packages/@aws-cdk/aws-autoscaling/package.json deleted file mode 100644 index 91cbf8992ccd5..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/package.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "name": "@aws-cdk/aws-autoscaling", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AutoScaling", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.autoscaling", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "autoscaling" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.AutoScaling", - "packageId": "Amazon.CDK.AWS.AutoScaling", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-autoscaling", - "module": "aws_cdk.aws_autoscaling", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-autoscaling" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AutoScaling", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "autoscaling" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-autoscaling-common": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-autoscaling-common": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "import-props-interface:@aws-cdk/aws-autoscaling.AutoScalingGroupImportProps", - "resource-interface-extends-construct:@aws-cdk/aws-autoscaling.IAutoScalingGroup", - "export:@aws-cdk/aws-autoscaling.IAutoScalingGroup", - "props-physical-name:@aws-cdk/aws-autoscaling.AutoScalingGroupProps", - "props-physical-name:@aws-cdk/aws-autoscaling.ScheduledActionProps", - "props-physical-name:@aws-cdk/aws-autoscaling.WarmPoolProps", - "props-default-doc:@aws-cdk/aws-autoscaling.EbsDeviceOptionsBase.iops", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.ADD_TO_LOAD_BALANCER", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.SCHEDULED_ACTIONS", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.ALARM_NOTIFICATION", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.AZ_REBALANCE", - "docs-public-apis:@aws-cdk/aws-autoscaling.AutoScalingGroup.fromAutoScalingGroupName", - "docs-public-apis:@aws-cdk/aws-autoscaling.BlockDeviceVolume.ebsDevice", - "docs-public-apis:@aws-cdk/aws-autoscaling.BlockDeviceVolume.virtualName", - "docs-public-apis:@aws-cdk/aws-autoscaling.HealthCheck.type", - "docs-public-apis:@aws-cdk/aws-autoscaling.HealthCheck.gracePeriod", - "docs-public-apis:@aws-cdk/aws-autoscaling.StepScalingPolicy.lowerAction", - "docs-public-apis:@aws-cdk/aws-autoscaling.StepScalingPolicy.lowerAlarm", - "docs-public-apis:@aws-cdk/aws-autoscaling.StepScalingPolicy.upperAction", - "docs-public-apis:@aws-cdk/aws-autoscaling.StepScalingPolicy.upperAlarm", - "docs-public-apis:@aws-cdk/aws-autoscaling.TargetTrackingScalingPolicy", - "docs-public-apis:@aws-cdk/aws-autoscaling.BasicStepScalingPolicyProps", - "docs-public-apis:@aws-cdk/aws-autoscaling.BlockDevice", - "docs-public-apis:@aws-cdk/aws-autoscaling.EbsDeviceOptions", - "docs-public-apis:@aws-cdk/aws-autoscaling.EbsDeviceOptionsBase", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.REPLACE_UNHEALTHY", - "docs-public-apis:@aws-cdk/aws-autoscaling.EbsDeviceProps", - "docs-public-apis:@aws-cdk/aws-autoscaling.EbsDeviceProps.snapshotId", - "props-default-doc:@aws-cdk/aws-autoscaling.EbsDeviceProps.snapshotId", - "docs-public-apis:@aws-cdk/aws-autoscaling.EbsDeviceSnapshotOptions", - "docs-public-apis:@aws-cdk/aws-autoscaling.StepScalingPolicyProps", - "docs-public-apis:@aws-cdk/aws-autoscaling.TargetTrackingScalingPolicyProps.autoScalingGroup", - "docs-public-apis:@aws-cdk/aws-autoscaling.DefaultResult", - "docs-public-apis:@aws-cdk/aws-autoscaling.DefaultResult.CONTINUE", - "docs-public-apis:@aws-cdk/aws-autoscaling.DefaultResult.ABANDON", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.LAUNCH", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.TERMINATE", - "docs-public-apis:@aws-cdk/aws-autoscaling.ScalingProcess.HEALTH_CHECK" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-autoscaling/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-autoscaling/rosetta/default.ts-fixture deleted file mode 100644 index 314520288f9cb..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/rosetta/default.ts-fixture +++ /dev/null @@ -1,18 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct, Node } from 'constructs'; -import { Aspects, CfnOutput, Stack, Duration, Resource, SecretValue } from '@aws-cdk/core'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - - - diff --git a/packages/@aws-cdk/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts b/packages/@aws-cdk/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts deleted file mode 100644 index 59f6de7519a91..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { - AutoScalingGroup, - AutoScalingGroupRequireImdsv2Aspect, - CfnLaunchConfiguration, -} from '../../lib'; - -describe('AutoScalingGroupRequireImdsv2Aspect', () => { - let app: cdk.App; - let stack: cdk.Stack; - let vpc: ec2.Vpc; - - beforeEach(() => { - app = new cdk.App(); - stack = new cdk.Stack(app, 'Stack'); - vpc = new ec2.Vpc(stack, 'Vpc'); - }); - - test('warns when metadataOptions is a token', () => { - // GIVEN - const asg = new AutoScalingGroup(stack, 'AutoScalingGroup', { - vpc, - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: ec2.MachineImage.latestAmazonLinux(), - }); - const launchConfig = asg.node.tryFindChild('LaunchConfig') as CfnLaunchConfiguration; - launchConfig.metadataOptions = cdk.Token.asAny({ - httpEndpoint: 'https://bla.com', - } as CfnLaunchConfiguration.MetadataOptionsProperty); - const aspect = new AutoScalingGroupRequireImdsv2Aspect(); - - // WHEN - cdk.Aspects.of(stack).add(aspect); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', Match.not({ - MetadataOptions: { - HttpTokens: 'required', - }, - })); - - Annotations.fromStack(stack).hasWarning('/Stack/AutoScalingGroup', Match.stringLikeRegexp('.*CfnLaunchConfiguration.MetadataOptions field is a CDK token.')); - }); - - test('requires IMDSv2', () => { - // GIVEN - new AutoScalingGroup(stack, 'AutoScalingGroup', { - vpc, - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: ec2.MachineImage.latestAmazonLinux(), - }); - const aspect = new AutoScalingGroupRequireImdsv2Aspect(); - - // WHEN - cdk.Aspects.of(stack).add(aspect); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - MetadataOptions: { - HttpTokens: 'required', - }, - }); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/cfn-init.test.ts b/packages/@aws-cdk/aws-autoscaling/test/cfn-init.test.ts deleted file mode 100644 index 1e34f43260c62..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/test/cfn-init.test.ts +++ /dev/null @@ -1,257 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as autoscaling from '../lib'; - -interface BaseProps { - vpc: ec2.Vpc; - machineImage: ec2.IMachineImage; - instanceType: ec2.InstanceType; - desiredCapacity: number; - minCapacity: number; -} - -let stack: Stack; -let vpc: ec2.Vpc; -let baseProps: BaseProps; - -beforeEach(() => { - stack = new Stack(); - vpc = new ec2.Vpc(stack, 'Vpc'); - - baseProps = { - vpc, - machineImage: new ec2.AmazonLinuxImage(), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO), - desiredCapacity: 5, - minCapacity: 2, - }; -}); - -test('Signals.waitForAll uses desiredCapacity if available', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - signals: autoscaling.Signals.waitForAll(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - CreationPolicy: { - ResourceSignal: { - Count: 5, - }, - }, - }); -}); - -test('Signals.waitForAll uses minCapacity if desiredCapacity is not available', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - desiredCapacity: undefined, - signals: autoscaling.Signals.waitForAll(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - CreationPolicy: { - ResourceSignal: { - Count: 2, - }, - }, - }); -}); - -test('Signals.waitForMinCapacity uses minCapacity', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - signals: autoscaling.Signals.waitForMinCapacity(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - CreationPolicy: { - ResourceSignal: { - Count: 2, - }, - }, - }); -}); - -test('Signals.waitForCount uses given number', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - signals: autoscaling.Signals.waitForCount(10), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - CreationPolicy: { - ResourceSignal: { - Count: 10, - }, - }, - }); -}); - -test('When signals are given appropriate IAM policy is added', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - signals: autoscaling.Signals.waitForAll(), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: 'cloudformation:SignalResource', - Effect: 'Allow', - Resource: { Ref: 'AWS::StackId' }, - }]), - }, - }); -}); - -test('UpdatePolicy.rollingUpdate() still correctly inserts IgnoreUnmodifiedGroupSizeProperties', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingScheduledAction: { - IgnoreUnmodifiedGroupSizeProperties: true, - }, - }, - }); -}); - -test('UpdatePolicy.rollingUpdate() with Signals uses those defaults', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - signals: autoscaling.Signals.waitForCount(10, { - minSuccessPercentage: 50, - timeout: Duration.minutes(30), - }), - updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - CreationPolicy: { - AutoScalingCreationPolicy: { - MinSuccessfulInstancesPercent: 50, - }, - ResourceSignal: { - Count: 10, - Timeout: 'PT30M', - }, - }, - UpdatePolicy: { - AutoScalingRollingUpdate: { - MinSuccessfulInstancesPercent: 50, - PauseTime: 'PT30M', - WaitOnResourceSignals: true, - }, - }, - }); -}); - -test('UpdatePolicy.rollingUpdate() without Signals', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingRollingUpdate: { - }, - }, - }); -}); - -test('UpdatePolicy.replacingUpdate() renders correct UpdatePolicy', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingReplacingUpdate: { - WillReplace: true, - }, - }, - }); -}); - -test('Using init config in ASG leads to default updatepolicy', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - init: ec2.CloudFormationInit.fromElements( - ec2.InitCommand.shellCommand('echo hihi'), - ), - signals: autoscaling.Signals.waitForAll(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingRollingUpdate: Match.anyValue(), - }, - }); -}); - -test('Using init config in ASG leads to correct UserData and permissions', () => { - // WHEN - new autoscaling.AutoScalingGroup(stack, 'Asg', { - ...baseProps, - init: ec2.CloudFormationInit.fromElements( - ec2.InitCommand.shellCommand('echo hihi'), - ), - signals: autoscaling.Signals.waitForAll(), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - UserData: { - 'Fn::Base64': { - 'Fn::Join': ['', [ - '#!/bin/bash\n# fingerprint: 593c357d7f305b75\n(\n set +e\n /opt/aws/bin/cfn-init -v --region ', - { Ref: 'AWS::Region' }, - ' --stack ', - { Ref: 'AWS::StackName' }, - ' --resource AsgASGD1D7B4E2 -c default\n /opt/aws/bin/cfn-signal -e $? --region ', - { Ref: 'AWS::Region' }, - ' --stack ', - { Ref: 'AWS::StackName' }, - ' --resource AsgASGD1D7B4E2\n cat /var/log/cfn-init.log >&2\n)', - ]], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['cloudformation:DescribeStackResource', 'cloudformation:SignalResource'], - Effect: 'Allow', - Resource: { Ref: 'AWS::StackId' }, - }]), - }, - }); -}); diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.ts b/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.ts deleted file mode 100644 index 751bcd58da02d..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-capacity-rebalance.ts +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as autoscaling from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-autoscaling-integ'); - -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 2, -}); - -new autoscaling.AutoScalingGroup(stack, 'CapacityRebalance', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), - machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 }), - capacityRebalance: true, -}); - -new integ.IntegTest(app, 'CapacityRebalanceTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts b/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts deleted file mode 100644 index ac4ea62b6f615..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/test/integ.asg-w-classic-loadbalancer.ts +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as cdk from '@aws-cdk/core'; -import * as autoscaling from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-asg-integ'); - -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 3, -}); - -const asg = new autoscaling.AutoScalingGroup(stack, 'Fleet', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), - machineImage: new ec2.AmazonLinuxImage(), -}); - -const lb = new elb.LoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - healthCheck: { - port: 80, - }, -}); - -lb.addTarget(asg); -lb.addListener({ externalPort: 80 }); - -app.synth(); diff --git a/packages/@aws-cdk/aws-autoscaling/test/scaling.test.ts b/packages/@aws-cdk/aws-autoscaling/test/scaling.test.ts deleted file mode 100644 index 18a9b4c351164..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling/test/scaling.test.ts +++ /dev/null @@ -1,344 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as autoscaling from '../lib'; - -describe('scaling', () => { - describe('target tracking policies', () => { - test('cpu utilization', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleOnCpuUtilization('ScaleCpu', { - targetUtilizationPercent: 30, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingConfiguration: { - PredefinedMetricSpecification: { PredefinedMetricType: 'ASGAverageCPUUtilization' }, - TargetValue: 30, - }, - }); - }); - - test('network ingress', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleOnIncomingBytes('ScaleNetwork', { - targetBytesPerSecond: 100, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingConfiguration: { - PredefinedMetricSpecification: { PredefinedMetricType: 'ASGAverageNetworkIn' }, - TargetValue: 100, - }, - }); - }); - - test('network egress', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleOnOutgoingBytes('ScaleNetwork', { - targetBytesPerSecond: 100, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingConfiguration: { - PredefinedMetricSpecification: { PredefinedMetricType: 'ASGAverageNetworkOut' }, - TargetValue: 100, - }, - }); - }); - - test('request count per second', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - const alb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', { vpc: fixture.vpc }); - const listener = alb.addListener('Listener', { port: 80 }); - listener.addTargets('Targets', { - port: 80, - targets: [fixture.asg], - }); - - // WHEN - fixture.asg.scaleOnRequestCount('ScaleRequest', { - targetRequestsPerSecond: 10, - }); - - // THEN - const arnParts = { - 'Fn::Split': [ - '/', - { Ref: 'ALBListener3B99FF85' }, - ], - }; - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingConfiguration: { - TargetValue: 600, - PredefinedMetricSpecification: { - PredefinedMetricType: 'ALBRequestCountPerTarget', - ResourceLabel: { - 'Fn::Join': ['', [ - { 'Fn::Select': [1, arnParts] }, - '/', - { 'Fn::Select': [2, arnParts] }, - '/', - { 'Fn::Select': [3, arnParts] }, - '/', - { 'Fn::GetAtt': ['ALBListenerTargetsGroup01D7716A', 'TargetGroupFullName'] }, - ]], - }, - }, - }, - }); - }); - - test('request count per minute', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - const alb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', { vpc: fixture.vpc }); - const listener = alb.addListener('Listener', { port: 80 }); - listener.addTargets('Targets', { - port: 80, - targets: [fixture.asg], - }); - - // WHEN - fixture.asg.scaleOnRequestCount('ScaleRequest', { - targetRequestsPerMinute: 10, - }); - - // THEN - const arnParts = { - 'Fn::Split': [ - '/', - { Ref: 'ALBListener3B99FF85' }, - ], - }; - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingConfiguration: { - TargetValue: 10, - PredefinedMetricSpecification: { - PredefinedMetricType: 'ALBRequestCountPerTarget', - ResourceLabel: { - 'Fn::Join': ['', [ - { 'Fn::Select': [1, arnParts] }, - '/', - { 'Fn::Select': [2, arnParts] }, - '/', - { 'Fn::Select': [3, arnParts] }, - '/', - { 'Fn::GetAtt': ['ALBListenerTargetsGroup01D7716A', 'TargetGroupFullName'] }, - ]], - }, - }, - }, - }); - }); - - test('custom metric', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleToTrackMetric('Metric', { - metric: new cloudwatch.Metric({ - metricName: 'Henk', - namespace: 'Test', - dimensionsMap: { - Mustache: 'Bushy', - }, - }), - targetValue: 2, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingConfiguration: { - CustomizedMetricSpecification: { - Dimensions: [{ Name: 'Mustache', Value: 'Bushy' }], - MetricName: 'Henk', - Namespace: 'Test', - Statistic: 'Average', - }, - TargetValue: 2, - }, - }); - }); - }); - - test('step scaling', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleOnMetric('Metric', { - metric: new cloudwatch.Metric({ - metricName: 'Legs', - namespace: 'Henk', - dimensionsMap: { Mustache: 'Bushy' }, - }), - estimatedInstanceWarmup: cdk.Duration.seconds(150), - // Adjust the number of legs to be closer to 2 - scalingSteps: [ - { lower: 0, upper: 2, change: +1 }, - { lower: 3, upper: 5, change: -1 }, - { lower: 5, change: -2 }, // Must work harder to remove legs - ], - }); - - // THEN: scaling in policy - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - MetricAggregationType: 'Average', - PolicyType: 'StepScaling', - StepAdjustments: [ - { - MetricIntervalLowerBound: 0, - MetricIntervalUpperBound: 2, - ScalingAdjustment: -1, - }, - { - MetricIntervalLowerBound: 2, - ScalingAdjustment: -2, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - ComparisonOperator: 'GreaterThanOrEqualToThreshold', - Threshold: 3, - AlarmActions: [{ Ref: 'FixtureASGMetricUpperPolicyC464CAFB' }], - AlarmDescription: 'Upper threshold scaling alarm', - }); - - // THEN: scaling out policy - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - MetricAggregationType: 'Average', - PolicyType: 'StepScaling', - EstimatedInstanceWarmup: 150, - StepAdjustments: [ - { - MetricIntervalUpperBound: 0, - ScalingAdjustment: 1, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - ComparisonOperator: 'LessThanOrEqualToThreshold', - Threshold: 2, - AlarmActions: [{ Ref: 'FixtureASGMetricLowerPolicy4A1CDE42' }], - AlarmDescription: 'Lower threshold scaling alarm', - }); - }); -}); - -test('step scaling from percentile metric', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleOnMetric('Tracking', { - metric: new cloudwatch.Metric({ namespace: 'Test', metricName: 'Metric', statistic: 'p99' }), - scalingSteps: [ - { upper: 0, change: -1 }, - { lower: 100, change: +1 }, - { lower: 500, change: +5 }, - ], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'StepScaling', - MetricAggregationType: 'Average', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - ComparisonOperator: 'GreaterThanOrEqualToThreshold', - EvaluationPeriods: 1, - AlarmActions: [ - { Ref: 'FixtureASGTrackingUpperPolicy27D4301F' }, - ], - ExtendedStatistic: 'p99', - MetricName: 'Metric', - Namespace: 'Test', - Threshold: 100, - }); -}); - -test('step scaling with evaluation period configured', () => { - // GIVEN - const stack = new cdk.Stack(); - const fixture = new ASGFixture(stack, 'Fixture'); - - // WHEN - fixture.asg.scaleOnMetric('Tracking', { - metric: new cloudwatch.Metric({ namespace: 'Test', metricName: 'Metric', statistic: 'p99' }), - scalingSteps: [ - { upper: 0, change: -1 }, - { lower: 100, change: +1 }, - { lower: 500, change: +5 }, - ], - evaluationPeriods: 10, - metricAggregationType: autoscaling.MetricAggregationType.MAXIMUM, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { - PolicyType: 'StepScaling', - MetricAggregationType: 'Maximum', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - ComparisonOperator: 'GreaterThanOrEqualToThreshold', - EvaluationPeriods: 10, - ExtendedStatistic: 'p99', - MetricName: 'Metric', - Namespace: 'Test', - Threshold: 100, - }); -}); - -class ASGFixture extends Construct { - public readonly vpc: ec2.Vpc; - public readonly asg: autoscaling.AutoScalingGroup; - - constructor(scope: Construct, id: string) { - super(scope, id); - - this.vpc = new ec2.Vpc(this, 'VPC'); - this.asg = new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc: this.vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO), - machineImage: new ec2.AmazonLinuxImage(), - }); - } -} diff --git a/packages/@aws-cdk/aws-autoscalingplans/.eslintrc.js b/packages/@aws-cdk/aws-autoscalingplans/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscalingplans/.gitignore b/packages/@aws-cdk/aws-autoscalingplans/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-autoscalingplans/.npmignore b/packages/@aws-cdk/aws-autoscalingplans/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-autoscalingplans/LICENSE b/packages/@aws-cdk/aws-autoscalingplans/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-autoscalingplans/NOTICE b/packages/@aws-cdk/aws-autoscalingplans/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-autoscalingplans/README.md b/packages/@aws-cdk/aws-autoscalingplans/README.md deleted file mode 100644 index 742cbff5e854e..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Auto Scaling Plans Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as autoscalingplans from '@aws-cdk/aws-autoscalingplans'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for AutoScalingPlans construct libraries](https://constructs.dev/search?q=autoscalingplans) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AutoScalingPlans resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AutoScalingPlans.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AutoScalingPlans](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AutoScalingPlans.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-autoscalingplans/jest.config.js b/packages/@aws-cdk/aws-autoscalingplans/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-autoscalingplans/lib/index.ts b/packages/@aws-cdk/aws-autoscalingplans/lib/index.ts deleted file mode 100644 index d3c4bfa27331a..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::AutoScalingPlans CloudFormation Resources: -export * from './autoscalingplans.generated'; diff --git a/packages/@aws-cdk/aws-autoscalingplans/package.json b/packages/@aws-cdk/aws-autoscalingplans/package.json deleted file mode 100644 index 4d872744f4c8e..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-autoscalingplans", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::AutoScalingPlans", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.autoscalingplans", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "autoscalingplans" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.AutoScalingPlans", - "packageId": "Amazon.CDK.AWS.AutoScalingPlans", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-autoscalingplans", - "module": "aws_cdk.aws_autoscalingplans", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-autoscalingplans" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::AutoScalingPlans", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "autoscalingplans" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-autoscalingplans/test/autoscalingplans.test.ts b/packages/@aws-cdk/aws-autoscalingplans/test/autoscalingplans.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-autoscalingplans/test/autoscalingplans.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-backup/.eslintrc.js b/packages/@aws-cdk/aws-backup/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-backup/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-backup/.gitignore b/packages/@aws-cdk/aws-backup/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-backup/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-backup/.npmignore b/packages/@aws-cdk/aws-backup/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-backup/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-backup/LICENSE b/packages/@aws-cdk/aws-backup/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-backup/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-backup/NOTICE b/packages/@aws-cdk/aws-backup/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-backup/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-backup/README.md b/packages/@aws-cdk/aws-backup/README.md deleted file mode 100644 index 1bc6cec09476b..0000000000000 --- a/packages/@aws-cdk/aws-backup/README.md +++ /dev/null @@ -1,235 +0,0 @@ -# AWS Backup Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -AWS Backup is a fully managed backup service that makes it easy to centralize and automate the -backup of data across AWS services in the cloud and on premises. Using AWS Backup, you can -configure backup policies and monitor backup activity for your AWS resources in one place. - -## Backup plan and selection - -In AWS Backup, a *backup plan* is a policy expression that defines when and how you want to back up - your AWS resources, such as Amazon DynamoDB tables or Amazon Elastic File System (Amazon EFS) file - systems. You can assign resources to backup plans, and AWS Backup automatically backs up and retains - backups for those resources according to the backup plan. You can create multiple backup plans if you - have workloads with different backup requirements. - -This module provides ready-made backup plans (similar to the console experience): - -```ts -// Daily, weekly and monthly with 5 year retention -const plan = backup.BackupPlan.dailyWeeklyMonthly5YearRetention(this, 'Plan'); -``` - -Assigning resources to a plan can be done with `addSelection()`: - -```ts -declare const plan: backup.BackupPlan; -declare const vpc: ec2.Vpc; -const myTable = dynamodb.Table.fromTableName(this, 'Table', 'myTableName'); -const myDatabaseInstance = new rds.DatabaseInstance(this, 'DatabaseInstance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_26 }), - vpc, -}); -const myDatabaseCluster = new rds.DatabaseCluster(this, 'DatabaseCluster', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), - credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'), - instanceProps: { - vpc, - }, -}); -const myServerlessCluster = new rds.ServerlessCluster(this, 'ServerlessCluster', { - engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL, - parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql10'), - vpc, -}); -const myCoolConstruct = new Construct(this, 'MyCoolConstruct'); - -plan.addSelection('Selection', { - resources: [ - backup.BackupResource.fromDynamoDbTable(myTable), // A DynamoDB table - backup.BackupResource.fromRdsDatabaseInstance(myDatabaseInstance), // A RDS instance - backup.BackupResource.fromRdsDatabaseCluster(myDatabaseCluster), // A RDS database cluster - backup.BackupResource.fromRdsServerlessCluster(myServerlessCluster), // An Aurora Serverless cluster - backup.BackupResource.fromTag('stage', 'prod'), // All resources that are tagged stage=prod in the region/account - backup.BackupResource.fromConstruct(myCoolConstruct), // All backupable resources in `myCoolConstruct` - ] -}) -``` - -If not specified, a new IAM role with a managed policy for backup will be -created for the selection. The `BackupSelection` implements `IGrantable`. - -To add rules to a plan, use `addRule()`: - -```ts -declare const plan: backup.BackupPlan; -plan.addRule(new backup.BackupPlanRule({ - completionWindow: Duration.hours(2), - startWindow: Duration.hours(1), - scheduleExpression: events.Schedule.cron({ // Only cron expressions are supported - day: '15', - hour: '3', - minute: '30', - }), - moveToColdStorageAfter: Duration.days(30), -})); -``` - -Continuous backup and point-in-time restores (PITR) can be configured. -Property `deleteAfter` defines the retention period for the backup. It is mandatory if PITR is enabled. -If no value is specified, the retention period is set to 35 days which is the maximum retention period supported by PITR. -Property `moveToColdStorageAfter` must not be specified because PITR does not support this option. -This example defines an AWS Backup rule with PITR and a retention period set to 14 days: - -```ts -declare const plan: backup.BackupPlan; -plan.addRule(new backup.BackupPlanRule({ - enableContinuousBackup: true, - deleteAfter: Duration.days(14), -})); -``` - -Rules can also specify to copy recovery points to another Backup Vault using `copyActions`. Copied recovery points can -optionally have `moveToColdStorageAfter` and `deleteAfter` configured. - -```ts -declare const plan: backup.BackupPlan; -declare const secondaryVault: backup.BackupVault; -plan.addRule(new backup.BackupPlanRule({ - copyActions: [{ - destinationBackupVault: secondaryVault, - moveToColdStorageAfter: Duration.days(30), - deleteAfter: Duration.days(120), - }] -})); -``` - -Ready-made rules are also available: - -```ts -declare const plan: backup.BackupPlan; -plan.addRule(backup.BackupPlanRule.daily()); -plan.addRule(backup.BackupPlanRule.weekly()); -``` - -By default a new [vault](#Backup-vault) is created when creating a plan. -It is also possible to specify a vault either at the plan level or at the -rule level. - -```ts -const myVault = backup.BackupVault.fromBackupVaultName(this, 'Vault1', 'myVault'); -const otherVault = backup.BackupVault.fromBackupVaultName(this, 'Vault2', 'otherVault'); - -const plan = backup.BackupPlan.daily35DayRetention(this, 'Plan', myVault); // Use `myVault` for all plan rules -plan.addRule(backup.BackupPlanRule.monthly1Year(otherVault)); // Use `otherVault` for this specific rule -``` - -You can [backup](https://docs.aws.amazon.com/aws-backup/latest/devguide/windows-backups.html) -VSS-enabled Windows applications running on Amazon EC2 instances by setting the `windowsVss` -parameter to `true`. If the application has VSS writer registered with Windows VSS, -then AWS Backup creates a snapshot that will be consistent for that application. - -```ts -const plan = new backup.BackupPlan(this, 'Plan', { - windowsVss: true, -}); -``` - -## Backup vault - -In AWS Backup, a *backup vault* is a container that you organize your backups in. You can use backup -vaults to set the AWS Key Management Service (AWS KMS) encryption key that is used to encrypt backups -in the backup vault and to control access to the backups in the backup vault. If you require different -encryption keys or access policies for different groups of backups, you can optionally create multiple -backup vaults. - -```ts -const myKey = kms.Key.fromKeyArn(this, 'MyKey', 'aaa'); -const myTopic = sns.Topic.fromTopicArn(this, 'MyTopic', 'bbb'); - -const vault = new backup.BackupVault(this, 'Vault', { - encryptionKey: myKey, // Custom encryption key - notificationTopic: myTopic, // Send all vault events to this SNS topic -}); -``` - -A vault has a default `RemovalPolicy` set to `RETAIN`. Note that removing a vault -that contains recovery points will fail. - -You can assign policies to backup vaults and the resources they contain. Assigning policies allows -you to do things like grant access to users to create backup plans and on-demand backups, but limit -their ability to delete recovery points after they're created. - -Use the `accessPolicy` property to create a backup vault policy: - -```ts -const vault = new backup.BackupVault(this, 'Vault', { - accessPolicy: new iam.PolicyDocument({ - statements: [ - new iam.PolicyStatement({ - effect: iam.Effect.DENY, - principals: [new iam.AnyPrincipal()], - actions: ['backup:DeleteRecoveryPoint'], - resources: ['*'], - conditions: { - StringNotLike: { - 'aws:userId': [ - 'user1', - 'user2', - ], - }, - }, - }), - ], - }), -}) -``` - -Alternativately statements can be added to the vault policy using `addToAccessPolicy()`. - -Use the `blockRecoveryPointDeletion` property or the `blockRecoveryPointDeletion()` method to add -a statement to the vault access policy that prevents recovery point deletions in your vault: - -```ts -new backup.BackupVault(this, 'Vault', { - blockRecoveryPointDeletion: true, -}); - -declare const backupVault: backup.BackupVault; -backupVault.blockRecoveryPointDeletion(); -``` - -By default access is not restricted. - -Use the `lockConfiguration` property to enable [AWS Backup Vault Lock](https://docs.aws.amazon.com/aws-backup/latest/devguide/vault-lock.html): - -```ts -new BackupVault(stack, 'Vault', { - lockConfiguration: { - minRetention: Duration.days(30), - }, -}); -``` - -## Importing existing backup vault - -To import an existing backup vault into your CDK application, use the `BackupVault.fromBackupVaultArn` or `BackupVault.fromBackupVaultName` -static method. Here is an example of giving an IAM Role permission to start a backup job: - -```ts -const importedVault = backup.BackupVault.fromBackupVaultName(this, 'Vault', 'myVaultName'); - -const role = new iam.Role(this, 'Access Role', { assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com') }); - -importedVault.grant(role, 'backup:StartBackupJob'); -``` diff --git a/packages/@aws-cdk/aws-backup/jest.config.js b/packages/@aws-cdk/aws-backup/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-backup/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-backup/lib/resource.ts b/packages/@aws-cdk/aws-backup/lib/resource.ts deleted file mode 100644 index 8afd52a58fdd8..0000000000000 --- a/packages/@aws-cdk/aws-backup/lib/resource.ts +++ /dev/null @@ -1,155 +0,0 @@ -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as rds from '@aws-cdk/aws-rds'; -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * An operation that is applied to a key-value pair - */ -export enum TagOperation { - /** - * StringEquals - */ - STRING_EQUALS = 'STRINGEQUALS', - - /** - * Dummy member - */ - DUMMY = 'dummy' -} - -/** - * A tag condition - */ -export interface TagCondition { - /** - * The key in a key-value pair. - * - * For example, in `"ec2:ResourceTag/Department": "accounting"`, - * `ec2:ResourceTag/Department` is the key. - */ - readonly key: string; - - /** - * An operation that is applied to a key-value pair used to filter - * resources in a selection. - * - * @default STRING_EQUALS - */ - readonly operation?: TagOperation; - - /** - * The value in a key-value pair. - * - * For example, in `"ec2:ResourceTag/Department": "accounting"`, - * `accounting` is the value. - */ - readonly value: string; -} - -/** - * A resource to backup - */ -export class BackupResource { - /** - * Adds all supported resources in a construct - * - * @param construct The construct containing resources to backup - */ - public static fromConstruct(construct: Construct) { - return new BackupResource(undefined, undefined, construct); - } - - /** - * A DynamoDB table - */ - public static fromDynamoDbTable(table: dynamodb.ITable) { - return BackupResource.fromArn(table.tableArn); - } - - /** - * An EC2 instance - */ - public static fromEc2Instance(instance: ec2.IInstance) { - return BackupResource.fromArn(Stack.of(instance).formatArn({ - service: 'ec2', - resource: 'instance', - resourceName: instance.instanceId, - })); - } - - /** - * An EFS file system - */ - public static fromEfsFileSystem(fileSystem: efs.IFileSystem) { - return BackupResource.fromArn(Stack.of(fileSystem).formatArn({ - service: 'elasticfilesystem', - resource: 'file-system', - resourceName: fileSystem.fileSystemId, - })); - } - - /** - * A RDS database instance - */ - public static fromRdsDatabaseInstance(instance: rds.IDatabaseInstance) { - return BackupResource.fromArn(instance.instanceArn); - } - - /** - * A RDS database cluter - */ - public static fromRdsDatabaseCluster(cluster: rds.IDatabaseCluster) { - const stack = Stack.of(cluster); - return BackupResource.fromArn(`arn:${stack.partition}:rds:${stack.region}:${stack.account}:cluster:${cluster.clusterIdentifier}`); - } - - /** - * An Aurora database instance - */ - public static fromRdsServerlessCluster(cluster: rds.IServerlessCluster) { - return BackupResource.fromArn(cluster.clusterArn); - } - - /** - * A list of ARNs or match patterns such as - * `arn:aws:ec2:us-east-1:123456789012:volume/*` - */ - public static fromArn(arn: string) { - return new BackupResource(arn); - } - - /** - * A tag condition - */ - public static fromTag(key: string, value: string, operation?: TagOperation) { - return new BackupResource(undefined, { - key, - value, - operation, - }); - } - - /** - * A resource - */ - public readonly resource?: string; - - /** - * A condition on a tag - */ - public readonly tagCondition?: TagCondition; - - /** - * A construct - */ - public readonly construct?: Construct; - - constructor(resource?: string, tagCondition?: TagCondition, construct?: Construct) { - this.resource = resource; - this.tagCondition = tagCondition; - this.construct = construct; - } -} diff --git a/packages/@aws-cdk/aws-backup/lib/rule.ts b/packages/@aws-cdk/aws-backup/lib/rule.ts deleted file mode 100644 index a879fafd17d83..0000000000000 --- a/packages/@aws-cdk/aws-backup/lib/rule.ts +++ /dev/null @@ -1,239 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import { Duration, Token } from '@aws-cdk/core'; -import { IBackupVault } from './vault'; - -/** - * Properties for a BackupPlanRule - */ -export interface BackupPlanRuleProps { - /** - * The duration after a backup job is successfully started before it must be - * completed or it is canceled by AWS Backup. - * - * @default - 8 hours - */ - readonly completionWindow?: Duration; - - /** - * Specifies the duration after creation that a recovery point is deleted. - * Must be greater than `moveToColdStorageAfter`. - * - * @default - recovery point is never deleted - */ - readonly deleteAfter?: Duration; - - /** - * Specifies the duration after creation that a recovery point is moved to cold - * storage. - * - * @default - recovery point is never moved to cold storage - */ - readonly moveToColdStorageAfter?: Duration; - - /** - * A display name for the backup rule. - * - * @default - a CDK generated name - */ - readonly ruleName?: string; - - /** - * A CRON expression specifying when AWS Backup initiates a backup job. - * - * @default - no schedule - */ - readonly scheduleExpression?: events.Schedule; - - /** - * The duration after a backup is scheduled before a job is canceled if it doesn't start successfully. - * - * @default - 8 hours - */ - readonly startWindow?: Duration; - - /** - * The backup vault where backups are - * - * @default - use the vault defined at the plan level. If not defined a new - * common vault for the plan will be created - */ - readonly backupVault?: IBackupVault; - - /** - * Enables continuous backup and point-in-time restores (PITR). - * - * Property `deleteAfter` defines the retention period for the backup. It is mandatory if PITR is enabled. - * If no value is specified, the retention period is set to 35 days which is the maximum retention period supported by PITR. - * - * Property `moveToColdStorageAfter` must not be specified because PITR does not support this option. - * - * @default false - */ - readonly enableContinuousBackup?: boolean; - - /** - * Copy operations to perform on recovery points created by this rule - * - * @default - no copy actions - */ - readonly copyActions?: BackupPlanCopyActionProps[]; -} - -/** - * Properties for a BackupPlanCopyAction - */ -export interface BackupPlanCopyActionProps { - /** - * Destination Vault for recovery points to be copied into - */ - readonly destinationBackupVault: IBackupVault; - - /** - * Specifies the duration after creation that a copied recovery point is deleted from the destination vault. - * Must be at least 90 days greater than `moveToColdStorageAfter`, if specified. - * - * @default - recovery point is never deleted - */ - readonly deleteAfter?: Duration; - - /** - * Specifies the duration after creation that a copied recovery point is moved to cold storage. - * - * @default - recovery point is never moved to cold storage - */ - readonly moveToColdStorageAfter?: Duration; -} - -/** - * A backup plan rule - */ -export class BackupPlanRule { - /** - * Daily with 35 days retention - */ - public static daily(backupVault?: IBackupVault) { - return new BackupPlanRule({ - backupVault, - ruleName: 'Daily', - scheduleExpression: events.Schedule.cron({ - hour: '5', - minute: '0', - }), - deleteAfter: Duration.days(35), - }); - } - - /** - * Weekly with 3 months retention - */ - public static weekly(backupVault?: IBackupVault) { - return new BackupPlanRule({ - backupVault, - ruleName: 'Weekly', - scheduleExpression: events.Schedule.cron({ - hour: '5', - minute: '0', - weekDay: 'SAT', - }), - deleteAfter: Duration.days(30 * 3), - }); - } - - /** - * Monthly 1 year retention, move to cold storage after 1 month - */ - public static monthly1Year(backupVault?: IBackupVault) { - return new BackupPlanRule({ - backupVault, - ruleName: 'Monthly1Year', - scheduleExpression: events.Schedule.cron({ - day: '1', - hour: '5', - minute: '0', - }), - moveToColdStorageAfter: Duration.days(30), - deleteAfter: Duration.days(365), - }); - } - - /** - * Monthly 5 year retention, move to cold storage after 3 months - */ - public static monthly5Year(backupVault?: IBackupVault) { - return new BackupPlanRule({ - backupVault, - ruleName: 'Monthly5Year', - scheduleExpression: events.Schedule.cron({ - day: '1', - hour: '5', - minute: '0', - }), - moveToColdStorageAfter: Duration.days(30 * 3), - deleteAfter: Duration.days(365 * 5), - }); - } - - /** - * Monthly 7 year retention, move to cold storage after 3 months - */ - public static monthly7Year(backupVault?: IBackupVault) { - return new BackupPlanRule({ - backupVault, - ruleName: 'Monthly7Year', - scheduleExpression: events.Schedule.cron({ - day: '1', - hour: '5', - minute: '0', - }), - moveToColdStorageAfter: Duration.days(30 * 3), - deleteAfter: Duration.days(365 * 7), - }); - } - - /** - * Properties of BackupPlanRule - */ - public readonly props: BackupPlanRuleProps - - /** @param props Rule properties */ - constructor(props: BackupPlanRuleProps) { - if (props.deleteAfter && props.moveToColdStorageAfter && - props.deleteAfter.toDays() < props.moveToColdStorageAfter.toDays()) { - throw new Error('`deleteAfter` must be greater than `moveToColdStorageAfter`'); - } - - if (props.scheduleExpression && !/^cron/.test(props.scheduleExpression.expressionString)) { - throw new Error('`scheduleExpression` must be of type `cron`'); - } - - const deleteAfter = (props.enableContinuousBackup && !props.deleteAfter) ? Duration.days(35) : props.deleteAfter; - - if (props.enableContinuousBackup && props.moveToColdStorageAfter) { - throw new Error('`moveToColdStorageAfter` must not be specified if `enableContinuousBackup` is enabled'); - } - - if (props.enableContinuousBackup && props.deleteAfter && - (props.deleteAfter?.toDays() < 1 || props.deleteAfter?.toDays() > 35)) { - throw new Error(`'deleteAfter' must be between 1 and 35 days if 'enableContinuousBackup' is enabled, but got ${props.deleteAfter.toHumanString()}`); - } - - if (props.copyActions && props.copyActions.length > 0) { - props.copyActions.forEach(copyAction => { - if (copyAction.deleteAfter && !Token.isUnresolved(copyAction.deleteAfter) && - copyAction.moveToColdStorageAfter && !Token.isUnresolved(copyAction.moveToColdStorageAfter) && - copyAction.deleteAfter.toDays() < copyAction.moveToColdStorageAfter.toDays() + 90) { - throw new Error([ - '\'deleteAfter\' must at least 90 days later than corresponding \'moveToColdStorageAfter\'', - `received 'deleteAfter: ${copyAction.deleteAfter.toDays()}' and 'moveToColdStorageAfter: ${copyAction.moveToColdStorageAfter.toDays()}'`, - ].join('\n')); - } - }); - } - - this.props = { - ...props, - deleteAfter, - }; - - } -} diff --git a/packages/@aws-cdk/aws-backup/package.json b/packages/@aws-cdk/aws-backup/package.json deleted file mode 100644 index d225f2056a713..0000000000000 --- a/packages/@aws-cdk/aws-backup/package.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "name": "@aws-cdk/aws-backup", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Backup", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Backup", - "packageId": "Amazon.CDK.AWS.Backup", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.backup", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "backup" - } - }, - "python": { - "distName": "aws-cdk.aws-backup", - "module": "aws_cdk.aws_backup", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-backup" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Backup", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Backup", - "aws-backup" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "resource-attribute:@aws-cdk/aws-backup.BackupSelection.backupSelectionId" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-backup/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-backup/rosetta/default.ts-fixture deleted file mode 100644 index 1384bd0540ee8..0000000000000 --- a/packages/@aws-cdk/aws-backup/rosetta/default.ts-fixture +++ /dev/null @@ -1,19 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as backup from '@aws-cdk/aws-backup'; -import * as iam from '@aws-cdk/aws-iam'; -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as events from '@aws-cdk/aws-events'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sns from '@aws-cdk/aws-sns'; -import * as rds from '@aws-cdk/aws-rds'; -import * as ec2 from '@aws-cdk/aws-ec2'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-batch/.eslintrc.js b/packages/@aws-cdk/aws-batch/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-batch/.eslintrc.js +++ b/packages/@aws-cdk/aws-batch/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-batch/.gitignore b/packages/@aws-cdk/aws-batch/.gitignore index 3e895fc51317c..8ab7624e63416 100644 --- a/packages/@aws-cdk/aws-batch/.gitignore +++ b/packages/@aws-cdk/aws-batch/.gitignore @@ -21,3 +21,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-batch/README.md b/packages/@aws-cdk/aws-batch/README.md index 082e29af446e6..03a52a6007f87 100644 --- a/packages/@aws-cdk/aws-batch/README.md +++ b/packages/@aws-cdk/aws-batch/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -82,7 +76,7 @@ connections on other CDK resources to manipulate the security groups and allow a For example, allowing a Compute Environment to access an EFS filesystem: ```ts -import * as efs from '@aws-cdk/aws-efs'; +import * as efs from 'aws-cdk-lib/aws-efs'; declare const fileSystem: efs.FileSystem; declare const computeEnvironment: batch.ComputeEnvironment; @@ -324,7 +318,7 @@ const jobQueue = batch.JobQueue.fromJobQueueArn(this, 'imported-job-queue', 'arn A Batch Job definition helps AWS Batch understand important details about how to run your application in the scope of a Batch Job. This involves key information like resource requirements, what containers to run, how the compute environment should be prepared, and more. Below is a simple example of how to create a job definition: ```ts -import * as ecr from '@aws-cdk/aws-ecr'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; const repo = ecr.Repository.fromRepositoryName(this, 'batch-job-repo', 'todo-list'); @@ -353,7 +347,7 @@ new batch.JobDefinition(this, 'batch-job-def-from-local', { You can provide custom log driver and its configuration for the container. ```ts -import * as ssm from '@aws-cdk/aws-ssm'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; new batch.JobDefinition(this, 'job-def', { container: { diff --git a/packages/@aws-cdk/aws-batch/lib/compute-environment.ts b/packages/@aws-cdk/aws-batch/lib/compute-environment.ts index 557eabd3ce4fe..408301aec014d 100644 --- a/packages/@aws-cdk/aws-batch/lib/compute-environment.ts +++ b/packages/@aws-cdk/aws-batch/lib/compute-environment.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, IResource, Resource, Stack } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { ArnFormat, IResource, Resource, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnComputeEnvironment } from './batch.generated'; +import { CfnComputeEnvironment } from 'aws-cdk-lib/aws-batch'; /** * Property to specify if the compute environment diff --git a/packages/@aws-cdk/aws-batch/lib/exposed-secret.ts b/packages/@aws-cdk/aws-batch/lib/exposed-secret.ts index 6ee6e3587208b..611f890f19942 100644 --- a/packages/@aws-cdk/aws-batch/lib/exposed-secret.ts +++ b/packages/@aws-cdk/aws-batch/lib/exposed-secret.ts @@ -1,5 +1,5 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; /** * Exposed secret for log configuration diff --git a/packages/@aws-cdk/aws-batch/lib/index.ts b/packages/@aws-cdk/aws-batch/lib/index.ts index 5d1e094147107..76fd0080f9fb7 100644 --- a/packages/@aws-cdk/aws-batch/lib/index.ts +++ b/packages/@aws-cdk/aws-batch/lib/index.ts @@ -1,5 +1,4 @@ // AWS::Batch CloudFormation Resources: -export * from './batch.generated'; export * from './exposed-secret'; export * from './compute-environment'; export * from './job-definition'; diff --git a/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts b/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts index 29e2b9e72e079..ab60a0a46b618 100644 --- a/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts +++ b/packages/@aws-cdk/aws-batch/lib/job-definition-image-config.ts @@ -1,5 +1,5 @@ -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; import { Construct } from 'constructs'; import { JobDefinitionContainer } from './job-definition'; diff --git a/packages/@aws-cdk/aws-batch/lib/job-definition.ts b/packages/@aws-cdk/aws-batch/lib/job-definition.ts index 618919542ab87..3205302d72971 100644 --- a/packages/@aws-cdk/aws-batch/lib/job-definition.ts +++ b/packages/@aws-cdk/aws-batch/lib/job-definition.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, Duration, IResource, Resource, Stack } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { ArnFormat, Duration, IResource, Resource, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnJobDefinition } from './batch.generated'; +import { CfnJobDefinition } from 'aws-cdk-lib/aws-batch'; import { ExposedSecret } from './exposed-secret'; import { JobDefinitionImageConfig } from './job-definition-image-config'; diff --git a/packages/@aws-cdk/aws-batch/lib/job-queue.ts b/packages/@aws-cdk/aws-batch/lib/job-queue.ts index 8fb265d0ce86a..13b8416f78f66 100644 --- a/packages/@aws-cdk/aws-batch/lib/job-queue.ts +++ b/packages/@aws-cdk/aws-batch/lib/job-queue.ts @@ -1,6 +1,6 @@ -import { ArnFormat, IResource, Resource, Stack } from '@aws-cdk/core'; +import { ArnFormat, IResource, Resource, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnJobQueue } from './batch.generated'; +import { CfnJobQueue } from 'aws-cdk-lib/aws-batch'; import { IComputeEnvironment } from './compute-environment'; /** diff --git a/packages/@aws-cdk/aws-batch/package.json b/packages/@aws-cdk/aws-batch/package.json index 2ca9c3ded5de6..2f942f77c5572 100644 --- a/packages/@aws-cdk/aws-batch/package.json +++ b/packages/@aws-cdk/aws-batch/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-batch", + "name": "@aws-cdk/aws-batch-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Batch", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "java": { - "package": "software.amazon.awscdk.services.batch", + "package": "software.amazon.awscdk.services.batch.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "batch" + "artifactId": "batch-alpha" } }, "dotnet": { - "namespace": "Amazon.CDK.AWS.Batch", - "packageId": "Amazon.CDK.AWS.Batch", + "namespace": "Amazon.CDK.AWS.Batch.Alpha", + "packageId": "Amazon.CDK.AWS.Batch.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "python": { - "distName": "aws-cdk.aws-batch", - "module": "aws_cdk.aws_batch", + "distName": "aws-cdk.aws-batch-alpha", + "module": "aws_cdk.aws_batch_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkbatchalpha" } }, "projectReferences": true, @@ -52,17 +56,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Batch", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -80,36 +81,20 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "jest": "^27.5.1", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -121,6 +106,17 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" + }, + "awslint": { + "exclude": [ + "*:*" + ] + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-batch/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-batch/rosetta/default.ts-fixture index 76bb82380fc06..59fa569234ec3 100644 --- a/packages/@aws-cdk/aws-batch/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-batch/rosetta/default.ts-fixture @@ -1,10 +1,10 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as batch from '@aws-cdk/aws-batch'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; +import { Stack } from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as batch from '@aws-cdk/aws-batch-alpha'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts b/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts index bb1f54b6aed61..5b6e4489939b2 100644 --- a/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts +++ b/packages/@aws-cdk/aws-batch/test/compute-environment.test.ts @@ -1,9 +1,9 @@ import { throws } from 'assert'; -import { Template, Match } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template, Match } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import * as batch from '../lib'; describe('Batch Compute Environment', () => { diff --git a/packages/@aws-cdk/aws-batch/test/integ.batch-with-efa.ts b/packages/@aws-cdk/aws-batch/test/integ.batch-with-efa.ts index 63c1d84f3be42..29a331678f858 100644 --- a/packages/@aws-cdk/aws-batch/test/integ.batch-with-efa.ts +++ b/packages/@aws-cdk/aws-batch/test/integ.batch-with-efa.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as batch from '../lib/'; export const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.ts b/packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.ts index 58c1a6a37d0a5..e799c760c44d0 100644 --- a/packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.ts +++ b/packages/@aws-cdk/aws-batch/test/integ.batch-with-efs.ts @@ -1,11 +1,11 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as efs from '@aws-cdk/aws-efs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as efs from 'aws-cdk-lib/aws-efs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as batch from '../lib/'; export const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-batch/test/integ.batch.ts b/packages/@aws-cdk/aws-batch/test/integ.batch.ts index e2206b072c73b..417b46d73ef46 100644 --- a/packages/@aws-cdk/aws-batch/test/integ.batch.ts +++ b/packages/@aws-cdk/aws-batch/test/integ.batch.ts @@ -1,10 +1,10 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as batch from '../lib/'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-batch/test/integ.job-definition.ts b/packages/@aws-cdk/aws-batch/test/integ.job-definition.ts index b4cfffc3d574b..63b31a045280c 100644 --- a/packages/@aws-cdk/aws-batch/test/integ.job-definition.ts +++ b/packages/@aws-cdk/aws-batch/test/integ.job-definition.ts @@ -1,7 +1,7 @@ /* eslint-disable quotes */ -import { ContainerImage } from "@aws-cdk/aws-ecs"; -import { App, Stack } from "@aws-cdk/core"; -import { ExpectedResult, IntegTest } from "@aws-cdk/integ-tests"; +import { ContainerImage } from "aws-cdk-lib/aws-ecs"; +import { App, Stack } from "aws-cdk-lib"; +import { ExpectedResult, IntegTest } from "@aws-cdk/integ-tests-alpha"; import { JobDefinition } from "../lib"; const app = new App(); diff --git a/packages/@aws-cdk/aws-batch/test/job-definition.test.ts b/packages/@aws-cdk/aws-batch/test/job-definition.test.ts index 6793c0aee527d..ea9b2c0d3b591 100644 --- a/packages/@aws-cdk/aws-batch/test/job-definition.test.ts +++ b/packages/@aws-cdk/aws-batch/test/job-definition.test.ts @@ -1,12 +1,12 @@ import { throws } from 'assert'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; +import * as cdk from 'aws-cdk-lib'; import * as batch from '../lib'; import { PlatformCapabilities } from '../lib'; diff --git a/packages/@aws-cdk/aws-batch/test/job-queue.test.ts b/packages/@aws-cdk/aws-batch/test/job-queue.test.ts index 94fe03c5e93f0..1f73b0bbf3f80 100644 --- a/packages/@aws-cdk/aws-batch/test/job-queue.test.ts +++ b/packages/@aws-cdk/aws-batch/test/job-queue.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as cdk from 'aws-cdk-lib'; import * as batch from '../lib'; describe('Batch Job Queue', () => { diff --git a/packages/@aws-cdk/aws-billingconductor/.eslintrc.js b/packages/@aws-cdk/aws-billingconductor/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-billingconductor/.gitignore b/packages/@aws-cdk/aws-billingconductor/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-billingconductor/.npmignore b/packages/@aws-cdk/aws-billingconductor/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-billingconductor/LICENSE b/packages/@aws-cdk/aws-billingconductor/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-billingconductor/NOTICE b/packages/@aws-cdk/aws-billingconductor/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-billingconductor/README.md b/packages/@aws-cdk/aws-billingconductor/README.md deleted file mode 100644 index 9f45892ecf2e7..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::BillingConductor Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as billingconductor from '@aws-cdk/aws-billingconductor'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for BillingConductor construct libraries](https://constructs.dev/search?q=billingconductor) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::BillingConductor resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_BillingConductor.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::BillingConductor](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_BillingConductor.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-billingconductor/jest.config.js b/packages/@aws-cdk/aws-billingconductor/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-billingconductor/lib/index.ts b/packages/@aws-cdk/aws-billingconductor/lib/index.ts deleted file mode 100644 index f8d5221b7fe42..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::BillingConductor CloudFormation Resources: -export * from './billingconductor.generated'; diff --git a/packages/@aws-cdk/aws-billingconductor/package.json b/packages/@aws-cdk/aws-billingconductor/package.json deleted file mode 100644 index 5836a29a56059..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-billingconductor", - "version": "0.0.0", - "description": "AWS::BillingConductor Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.BillingConductor", - "packageId": "Amazon.CDK.AWS.BillingConductor", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.billingconductor", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "billingconductor" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-billingconductor", - "module": "aws_cdk.aws_billingconductor" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-billingconductor" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::BillingConductor", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::BillingConductor", - "aws-billingconductor" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-billingconductor/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-billingconductor/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-billingconductor/test/billingconductor.test.ts b/packages/@aws-cdk/aws-billingconductor/test/billingconductor.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-billingconductor/test/billingconductor.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-budgets/.eslintrc.js b/packages/@aws-cdk/aws-budgets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-budgets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-budgets/.gitignore b/packages/@aws-cdk/aws-budgets/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-budgets/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-budgets/.npmignore b/packages/@aws-cdk/aws-budgets/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-budgets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-budgets/LICENSE b/packages/@aws-cdk/aws-budgets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-budgets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-budgets/NOTICE b/packages/@aws-cdk/aws-budgets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-budgets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-budgets/README.md b/packages/@aws-cdk/aws-budgets/README.md deleted file mode 100644 index 4510fa99b2ea9..0000000000000 --- a/packages/@aws-cdk/aws-budgets/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Budgets Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as budgets from '@aws-cdk/aws-budgets'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Budgets construct libraries](https://constructs.dev/search?q=budgets) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Budgets resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Budgets.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Budgets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Budgets.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-budgets/jest.config.js b/packages/@aws-cdk/aws-budgets/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-budgets/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-budgets/lib/index.ts b/packages/@aws-cdk/aws-budgets/lib/index.ts deleted file mode 100644 index 57d3d60547051..0000000000000 --- a/packages/@aws-cdk/aws-budgets/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Budgets CloudFormation Resources: -export * from './budgets.generated'; diff --git a/packages/@aws-cdk/aws-budgets/package.json b/packages/@aws-cdk/aws-budgets/package.json deleted file mode 100644 index 7e59128ded8d7..0000000000000 --- a/packages/@aws-cdk/aws-budgets/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-budgets", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Budgets", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.budgets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "budgets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Budgets", - "packageId": "Amazon.CDK.AWS.Budgets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-budgets", - "module": "aws_cdk.aws_budgets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-budgets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Budgets", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "budgets" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-budgets/test/budgets.test.ts b/packages/@aws-cdk/aws-budgets/test/budgets.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-budgets/test/budgets.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-cassandra/.eslintrc.js b/packages/@aws-cdk/aws-cassandra/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cassandra/.gitignore b/packages/@aws-cdk/aws-cassandra/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cassandra/.npmignore b/packages/@aws-cdk/aws-cassandra/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cassandra/LICENSE b/packages/@aws-cdk/aws-cassandra/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cassandra/NOTICE b/packages/@aws-cdk/aws-cassandra/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cassandra/README.md b/packages/@aws-cdk/aws-cassandra/README.md deleted file mode 100644 index 106c31013fa00..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Cassandra Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as cassandra from '@aws-cdk/aws-cassandra'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Cassandra construct libraries](https://constructs.dev/search?q=cassandra) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Cassandra resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Cassandra.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Cassandra](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Cassandra.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-cassandra/jest.config.js b/packages/@aws-cdk/aws-cassandra/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cassandra/lib/index.ts b/packages/@aws-cdk/aws-cassandra/lib/index.ts deleted file mode 100644 index 86bc022f66915..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Cassandra CloudFormation Resources: -export * from './cassandra.generated'; diff --git a/packages/@aws-cdk/aws-cassandra/package.json b/packages/@aws-cdk/aws-cassandra/package.json deleted file mode 100644 index a57ea9946da47..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-cassandra", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Cassandra", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Cassandra", - "packageId": "Amazon.CDK.AWS.Cassandra", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.cassandra", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cassandra" - } - }, - "python": { - "distName": "aws-cdk.aws-cassandra", - "module": "aws_cdk.aws_cassandra", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cassandra" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Cassandra", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Cassandra", - "aws-cassandra" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-cassandra/test/cassandra.test.ts b/packages/@aws-cdk/aws-cassandra/test/cassandra.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-cassandra/test/cassandra.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-ce/.eslintrc.js b/packages/@aws-cdk/aws-ce/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ce/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ce/.gitignore b/packages/@aws-cdk/aws-ce/.gitignore deleted file mode 100644 index 147a6c1ef79db..0000000000000 --- a/packages/@aws-cdk/aws-ce/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ce/.npmignore b/packages/@aws-cdk/aws-ce/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-ce/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ce/LICENSE b/packages/@aws-cdk/aws-ce/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ce/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ce/NOTICE b/packages/@aws-cdk/aws-ce/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ce/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ce/README.md b/packages/@aws-cdk/aws-ce/README.md deleted file mode 100644 index 082e6734c8988..0000000000000 --- a/packages/@aws-cdk/aws-ce/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::CE Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as ce from '@aws-cdk/aws-ce'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for CE construct libraries](https://constructs.dev/search?q=ce) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CE resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CE.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CE](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CE.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-ce/jest.config.js b/packages/@aws-cdk/aws-ce/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-ce/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ce/lib/index.ts b/packages/@aws-cdk/aws-ce/lib/index.ts deleted file mode 100644 index 8b17f7cc542cd..0000000000000 --- a/packages/@aws-cdk/aws-ce/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::CE CloudFormation Resources: -export * from './ce.generated'; diff --git a/packages/@aws-cdk/aws-ce/package.json b/packages/@aws-cdk/aws-ce/package.json deleted file mode 100644 index b12232e141eef..0000000000000 --- a/packages/@aws-cdk/aws-ce/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-ce", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CE", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CE", - "packageId": "Amazon.CDK.AWS.CE", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.ce", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ce" - } - }, - "python": { - "distName": "aws-cdk.aws-ce", - "module": "aws_cdk.aws_ce", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ce" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CE", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CE", - "aws-ce" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ce/test/ce.test.ts b/packages/@aws-cdk/aws-ce/test/ce.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-ce/test/ce.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-certificatemanager/.eslintrc.js b/packages/@aws-cdk/aws-certificatemanager/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-certificatemanager/.gitignore b/packages/@aws-cdk/aws-certificatemanager/.gitignore deleted file mode 100644 index 5416b7824aee9..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-certificatemanager/.npmignore b/packages/@aws-cdk/aws-certificatemanager/.npmignore deleted file mode 100644 index 4b8c458090c3a..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/.npmignore +++ /dev/null @@ -1,33 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -# Don't pack node_modules directories of the lambdas in there. They should only be dev dependencies. -lambda-packages/dns_validated_certificate_handler/node_modules - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -jest.config.js - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-certificatemanager/LICENSE b/packages/@aws-cdk/aws-certificatemanager/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-certificatemanager/NOTICE b/packages/@aws-cdk/aws-certificatemanager/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-certificatemanager/README.md b/packages/@aws-cdk/aws-certificatemanager/README.md deleted file mode 100644 index 54b98fda913b5..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/README.md +++ /dev/null @@ -1,202 +0,0 @@ -# AWS Certificate Manager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -AWS Certificate Manager (ACM) handles the complexity of creating, storing, and renewing public and private SSL/TLS X.509 certificates and keys that -protect your AWS websites and applications. ACM certificates can secure singular domain names, multiple specific domain names, wildcard domains, or -combinations of these. ACM wildcard certificates can protect an unlimited number of subdomains. - -This package provides Constructs for provisioning and referencing ACM certificates which can be used with CloudFront and ELB. - -After requesting a certificate, you will need to prove that you own the -domain in question before the certificate will be granted. The CloudFormation -deployment will wait until this verification process has been completed. - -Because of this wait time, when using manual validation methods, it's better -to provision your certificates either in a separate stack from your main -service, or provision them manually and import them into your CDK application. - -**Note:** There is a limit on total number of ACM certificates that can be requested on an account and region within a year. -The default limit is 2000, but this limit may be (much) lower on new AWS accounts. -See https://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html for more information. - -## DNS validation - -DNS validation is the preferred method to validate domain ownership, as it has a number of advantages over email validation. -See also [Validate with DNS](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate-dns.html) -in the AWS Certificate Manager User Guide. - -If Amazon Route 53 is your DNS provider for the requested domain, the DNS record can be -created automatically: - -```ts -const myHostedZone = new route53.HostedZone(this, 'HostedZone', { - zoneName: 'example.com', -}); -new acm.Certificate(this, 'Certificate', { - domainName: 'hello.example.com', - certificateName: 'Hello World Service', // Optionally provide an certificate name - validation: acm.CertificateValidation.fromDns(myHostedZone), -}); -``` - -If Route 53 is not your DNS provider, the DNS records must be added manually and the stack will not complete -creating until the records are added. - -```ts -new acm.Certificate(this, 'Certificate', { - domainName: 'hello.example.com', - validation: acm.CertificateValidation.fromDns(), // Records must be added manually -}); -``` - -When working with multiple domains, use the `CertificateValidation.fromDnsMultiZone()`: - -```ts -const exampleCom = new route53.HostedZone(this, 'ExampleCom', { - zoneName: 'example.com', -}); -const exampleNet = new route53.HostedZone(this, 'ExampleNet', { - zoneName: 'example.net', -}); - -const cert = new acm.Certificate(this, 'Certificate', { - domainName: 'test.example.com', - subjectAlternativeNames: ['cool.example.com', 'test.example.net'], - validation: acm.CertificateValidation.fromDnsMultiZone({ - 'test.example.com': exampleCom, - 'cool.example.com': exampleCom, - 'test.example.net': exampleNet, - }), -}); -``` - -## Email validation - -Email-validated certificates (the default) are validated by receiving an -email on one of a number of predefined domains and following the instructions -in the email. - -See [Validate with Email](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate-email.html) -in the AWS Certificate Manager User Guide. - -```ts -new acm.Certificate(this, 'Certificate', { - domainName: 'hello.example.com', - validation: acm.CertificateValidation.fromEmail(), // Optional, this is the default -}); -``` - -## Cross-region Certificates - -ACM certificates that are used with CloudFront -- or higher-level constructs which rely on CloudFront -- must be in the `us-east-1` region. -CloudFormation allows you to create a Stack with a CloudFront distribution in any region. In order -to create an ACM certificate in us-east-1 and reference it in a CloudFront distribution is a -different region, it is recommended to perform a multi stack deployment. - -Enable the Stack property `crossRegionReferences` -in order to access the cross stack/region certificate. - -> **This feature is currently experimental** - -```ts -const stack1 = new Stack(app, 'Stack1', { - env: { - region: 'us-east-1', - }, - crossRegionReferences: true, -}); -const cert = new acm.Certificate(stack1, 'Cert', { - domainName: '*.example.com', - validation: acm.CertificateValidation.fromDns(PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'ZONE_ID')), -}); - -const stack2 = new Stack(app, 'Stack2', { - env: { - region: 'us-east-2', - }, - crossRegionReferences: true, -}); - -new cloudfront.Distribution(stack2, 'Distribution', { - defaultBehavior: { - origin: new origins.HttpOrigin('example.com'), - }, - domainNames: ['dev.example.com'], - certificate: cert, -}); -``` - -## Requesting private certificates - -AWS Certificate Manager can create [private certificates](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-private.html) issued by [Private Certificate Authority (PCA)](https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaWelcome.html). Validation of private certificates is not necessary. - -```ts -import * as acmpca from '@aws-cdk/aws-acmpca'; - -new acm.PrivateCertificate(this, 'PrivateCertificate', { - domainName: 'test.example.com', - subjectAlternativeNames: ['cool.example.com', 'test.example.net'], // optional - certificateAuthority: acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CA', - 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77'), -}); -``` - -## Requesting certificates without transparency logging - -Transparency logging can be opted out of for AWS Certificate Manager certificates. See [opting out of certificate transparency logging](https://docs.aws.amazon.com/acm/latest/userguide/acm-bestpractices.html#best-practices-transparency) for limits. - -```ts -new acm.Certificate(this, 'Certificate', { - domainName: 'test.example.com', - transparencyLoggingEnabled: false, -}); -``` - -## Importing - -If you want to import an existing certificate, you can do so from its ARN: - -```ts -const arn = 'arn:aws:...'; -const certificate = acm.Certificate.fromCertificateArn(this, 'Certificate', arn); -``` - -## Sharing between Stacks - -To share the certificate between stacks in the same CDK application, simply -pass the `Certificate` object between the stacks. - -## Metrics - -The `DaysToExpiry` metric is available via the `metricDaysToExpiry` method for -all certificates. This metric is emitted by AWS Certificates Manager once per -day until the certificate has effectively expired. - -An alarm can be created to determine whether a certificate is soon due for -renewal ussing the following code: - -```ts -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; - -declare const myHostedZone: route53.HostedZone; -const certificate = new acm.Certificate(this, 'Certificate', { - domainName: 'hello.example.com', - validation: acm.CertificateValidation.fromDns(myHostedZone), -}); -certificate.metricDaysToExpiry().createAlarm(this, 'Alarm', { - comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD, - evaluationPeriods: 1, - threshold: 45, // Automatic rotation happens between 60 and 45 days before expiry -}); -``` diff --git a/packages/@aws-cdk/aws-certificatemanager/jest.config.js b/packages/@aws-cdk/aws-certificatemanager/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.eslintrc.js b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/LICENSE b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/NOTICE b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/util.ts b/packages/@aws-cdk/aws-certificatemanager/lib/util.ts deleted file mode 100644 index e917213d36a06..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/lib/util.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Arn, ArnFormat, Stack, Token } from '@aws-cdk/core'; -import { ICertificate } from './certificate'; -import { DnsValidatedCertificate } from './dns-validated-certificate'; -import { publicSuffixes } from './public-suffixes'; - -/** - * Returns the apex domain (domain.com) from a subdomain (www.sub.domain.com) - */ -export function apexDomain(domainName: string): string { - const parts = domainName.split('.').reverse(); - - let curr: any = publicSuffixes; - - const accumulated: string[] = []; - for (const part of parts) { - accumulated.push(part); - if (!(part in curr)) { break; } - curr = curr[part]; - } - return accumulated.reverse().join('.'); -} - -export function isDnsValidatedCertificate(cert: ICertificate): cert is DnsValidatedCertificate { - return cert.hasOwnProperty('domainName'); -} - -export function getCertificateRegion(cert: ICertificate): string | undefined { - const { certificateArn, stack } = cert; - - if (isDnsValidatedCertificate(cert)) { - const requestResource = cert.node.findChild('CertificateRequestorResource').node.defaultChild; - - // @ts-ignore - const { _cfnProperties: properties } = requestResource; - const { Region: region } = properties; - - if (region && !Token.isUnresolved(region)) { - return region; - } - } - - { - const { region } = Arn.split(certificateArn, ArnFormat.SLASH_RESOURCE_NAME); - - if (region && !Token.isUnresolved(region)) { - return region; - } - } - - return Stack.of(stack).region; -} diff --git a/packages/@aws-cdk/aws-certificatemanager/package.json b/packages/@aws-cdk/aws-certificatemanager/package.json deleted file mode 100644 index 5a6c030175093..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/package.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "name": "@aws-cdk/aws-certificatemanager", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CertificateManager", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.certificatemanager", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "certificatemanager" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CertificateManager", - "packageId": "Amazon.CDK.AWS.CertificateManager", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-certificatemanager", - "module": "aws_cdk.aws_certificatemanager", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-certificatemanager" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CertificateManager", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "certificatemanager" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-certificatemanager.CertificateProps", - "props-physical-name:@aws-cdk/aws-certificatemanager.DnsValidatedCertificateProps", - "props-physical-name:@aws-cdk/aws-certificatemanager.PrivateCertificateProps" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-certificatemanager/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-certificatemanager/rosetta/default.ts-fixture deleted file mode 100644 index 774bd94dbca22..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { StringParameter } from '@aws-cdk/aws-ssm'; -import { Stack, Names } from '@aws-cdk/core'; -import { AwsCustomResource, PhysicalResourceId, AwsCustomResourcePolicy } from '@aws-cdk/custom-resources'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-certificatemanager/test/util.test.ts b/packages/@aws-cdk/aws-certificatemanager/test/util.test.ts deleted file mode 100644 index ce2203f005b41..0000000000000 --- a/packages/@aws-cdk/aws-certificatemanager/test/util.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Aws, Stack } from '@aws-cdk/core'; -import { Certificate, DnsValidatedCertificate } from '../lib'; -import { apexDomain, getCertificateRegion, isDnsValidatedCertificate } from '../lib/util'; - -describe('apex domain', () => { - test('returns right domain', () => { - expect(apexDomain('domain.com')).toEqual('domain.com'); - expect(apexDomain('test.domain.com')).toEqual('domain.com'); - }); - - test('understands eTLDs', () => { - expect(apexDomain('test.domain.co.uk')).toEqual('domain.co.uk'); - }); -}); - -describe('isDnsValidatedCertificate', () => { - testDeprecated('new DnsValidatedCertificate is a DnsValidatedCertificate', () => { - const stack = new Stack(); - - const hostedZone = new PublicHostedZone(stack, 'ExampleDotCom', { - zoneName: 'example.com', - }); - const cert = new DnsValidatedCertificate(stack, 'Certificate', { - domainName: 'test.example.com', - hostedZone, - }); - - expect(isDnsValidatedCertificate(cert)).toBeTruthy(); - }); - - test('new Certificate is not a DnsValidatedCertificate', () => { - const stack = new Stack(); - - const cert = new Certificate(stack, 'Certificate', { - domainName: 'test.example.com', - }); - - expect(isDnsValidatedCertificate(cert)).toBeFalsy(); - }); - - test('fromCertificateArn is not a DnsValidatedCertificate', () => { - const stack = new Stack(); - - const cert = Certificate.fromCertificateArn(stack, 'Certificate', 'cert-arn'); - - expect(isDnsValidatedCertificate(cert)).toBeFalsy(); - }); -}); - -describe('getCertificateRegion', () => { - test('from stack', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'RegionStack', { env: { region: 'eu-west-1' } }); - - const certificate = new Certificate(stack, 'TestCertificate', { - domainName: 'www.example.com', - }); - - expect(getCertificateRegion(certificate)).toEqual('eu-west-1'); - }); - - testDeprecated('from DnsValidatedCertificate region', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'RegionStack', { env: { region: 'eu-west-1' } }); - const hostedZone = new PublicHostedZone(stack, 'ExampleDotCom', { - zoneName: 'example.com', - }); - - const certificate = new DnsValidatedCertificate(stack, 'TestCertificate', { - domainName: 'www.example.com', - hostedZone, - region: 'eu-west-3', - }); - - expect(getCertificateRegion(certificate)).toEqual('eu-west-3'); - }); - - test('fromCertificateArn', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'RegionStack', { env: { region: 'eu-west-1' } }); - - const certificate = Certificate.fromCertificateArn( - stack, 'TestCertificate', 'arn:aws:acm:us-east-2:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', - ); - - expect(getCertificateRegion(certificate)).toEqual('us-east-2'); - }); - - test('region agnostic stack', () => { - // GIVEN - const stack = new Stack(); - - const certificate = new Certificate(stack, 'TestCertificate', { - domainName: 'www.example.com', - }); - - expect(getCertificateRegion(certificate)).toEqual(Aws.REGION); - }); - -}); diff --git a/packages/@aws-cdk/aws-chatbot/.eslintrc.js b/packages/@aws-cdk/aws-chatbot/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-chatbot/.gitignore b/packages/@aws-cdk/aws-chatbot/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-chatbot/.npmignore b/packages/@aws-cdk/aws-chatbot/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-chatbot/LICENSE b/packages/@aws-cdk/aws-chatbot/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-chatbot/NOTICE b/packages/@aws-cdk/aws-chatbot/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-chatbot/README.md b/packages/@aws-cdk/aws-chatbot/README.md deleted file mode 100644 index b4b92719c1583..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# AWS::Chatbot Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -AWS Chatbot is an AWS service that enables DevOps and software development teams to use Slack chat rooms to monitor and respond to operational events in their AWS Cloud. AWS Chatbot processes AWS service notifications from Amazon Simple Notification Service (Amazon SNS), and forwards them to Slack chat rooms so teams can analyze and act on them immediately, regardless of location. - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts -import * as chatbot from '@aws-cdk/aws-chatbot'; -import * as sns from '@aws-cdk/aws-sns'; -import * as iam from '@aws-cdk/aws-iam'; - -const slackChannel = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { - slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', - slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', - slackChannelId: 'YOUR_SLACK_CHANNEL_ID', -}); - -slackChannel.addToRolePolicy(new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: [ - 's3:GetObject', - ], - resources: ['arn:aws:s3:::abc/xyz/123.txt'], -})); - -slackChannel.addNotificationTopic(new sns.Topic(this, 'MyTopic')); -``` - -## Log Group - -Slack channel configuration automatically create a log group with the name `/aws/chatbot/` in `us-east-1` upon first execution with -log data set to never expire. - -The `logRetention` property can be used to set a different expiration period. A log group will be created if not already exists. -If the log group already exists, it's expiration will be configured to the value specified in this construct (never expire, by default). - -By default, CDK uses the AWS SDK retry options when interacting with the log group. The `logRetentionRetryOptions` property -allows you to customize the maximum number of retries and base backoff duration. - -*Note* that, if `logRetention` is set, a [CloudFormation custom -resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html) is added -to the stack that pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the -correct log retention period (never expire, by default). - -## Guardrails - -By default slack channel will use `AdministratorAccess` managed policy as guardrail policy. -The `guardrailPolicies` property can be used to set a different set of managed policies. diff --git a/packages/@aws-cdk/aws-chatbot/jest.config.js b/packages/@aws-cdk/aws-chatbot/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-chatbot/package.json b/packages/@aws-cdk/aws-chatbot/package.json deleted file mode 100644 index 0aee89698941b..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/package.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "name": "@aws-cdk/aws-chatbot", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Chatbot", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Chatbot", - "packageId": "Amazon.CDK.AWS.Chatbot", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.chatbot", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "chatbot" - } - }, - "python": { - "distName": "aws-cdk.aws-chatbot", - "module": "aws_cdk.aws_chatbot", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-chatbot" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Chatbot", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Chatbot", - "aws-chatbot" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-chatbot/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-chatbot/rosetta/default.ts-fixture deleted file mode 100644 index 50d86e8a055ce..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/rosetta/default.ts-fixture +++ /dev/null @@ -1,10 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-chatbot/test/integ.chatbot-logretention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdBQUcsT0FBTyxFQUFFLFVBQVUsSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUM1RSxNQUFNLEt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yA9IHt9O1xuICAgIGlmIChyYXdPcHRpb25zKSB7XG4gICAgICBpZiAocmF3T3B0aW9ucy5tYXhSZXRyaWVzKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5tYXhSZXRyaWVzID0gcGFyc2VJbnQocmF3T3B0aW9ucy5tYXhSZXRyaWVzLCAxMCk7XG4gICAgICB9XG4gICAgICBpZiAocmF3T3B0aW9ucy5iYXNlKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5yZXRyeU9wdGlvbnMgPSB7XG4gICAgICAgICAgYmFzZTogcGFyc2VJbnQocmF3T3B0aW9ucy5iYXNlLCAxMCksXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXRyeU9wdGlvbnM7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloud9/.eslintrc.js b/packages/@aws-cdk/aws-cloud9/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-cloud9/.eslintrc.js +++ b/packages/@aws-cdk/aws-cloud9/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloud9/.gitignore b/packages/@aws-cdk/aws-cloud9/.gitignore index 3e895fc51317c..8ab7624e63416 100644 --- a/packages/@aws-cdk/aws-cloud9/.gitignore +++ b/packages/@aws-cdk/aws-cloud9/.gitignore @@ -21,3 +21,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-cloud9/README.md b/packages/@aws-cdk/aws-cloud9/README.md index f87860ae71b3d..984af19f0426b 100644 --- a/packages/@aws-cdk/aws-cloud9/README.md +++ b/packages/@aws-cdk/aws-cloud9/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -83,7 +77,7 @@ new cloud9.Ec2Environment(this, 'Cloud9Env2', { Use `clonedRepositories` to clone one or multiple AWS Codecommit repositories into the environment: ```ts -import * as codecommit from '@aws-cdk/aws-codecommit'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; // create a codecommit repository to clone into the cloud9 environment const repoNew = new codecommit.Repository(this, 'RepoNew', { @@ -128,7 +122,7 @@ new cloud9.Ec2Environment(this, 'C9Env', { To specify a specific IAM User as the environment owner, use `Owner.user()`. The user should have the `AWSCloud9Administrator` managed policy ```ts -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from 'aws-cdk-lib/aws-iam'; const user = new iam.User(this, 'user'); user.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AWSCloud9Administrator')); diff --git a/packages/@aws-cdk/aws-cloud9/lib/environment.ts b/packages/@aws-cdk/aws-cloud9/lib/environment.ts index d1e4565f786ff..a541a04848746 100644 --- a/packages/@aws-cdk/aws-cloud9/lib/environment.ts +++ b/packages/@aws-cdk/aws-cloud9/lib/environment.ts @@ -1,9 +1,9 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IUser } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { IUser } from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnEnvironmentEC2 } from '../lib/cloud9.generated'; +import { CfnEnvironmentEC2 } from 'aws-cdk-lib/aws-cloud9'; /** * A Cloud9 Environment diff --git a/packages/@aws-cdk/aws-cloud9/lib/index.ts b/packages/@aws-cdk/aws-cloud9/lib/index.ts index b3fde34a8442b..a6c0441ff5342 100644 --- a/packages/@aws-cdk/aws-cloud9/lib/index.ts +++ b/packages/@aws-cdk/aws-cloud9/lib/index.ts @@ -1,3 +1,2 @@ // AWS::Cloud9 CloudFormation Resources: -export * from './cloud9.generated'; export * from './environment'; diff --git a/packages/@aws-cdk/aws-cloud9/package.json b/packages/@aws-cdk/aws-cloud9/package.json index b76154609d311..6f35f056e3b82 100644 --- a/packages/@aws-cdk/aws-cloud9/package.json +++ b/packages/@aws-cdk/aws-cloud9/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-cloud9", + "name": "@aws-cdk/aws-cloud9-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Cloud9", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "java": { - "package": "software.amazon.awscdk.services.cloud9", + "package": "software.amazon.awscdk.services.cloud9.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "cloud9" + "artifactId": "cloud9-alpha" } }, "dotnet": { - "namespace": "Amazon.CDK.AWS.Cloud9", - "packageId": "Amazon.CDK.AWS.Cloud9", + "namespace": "Amazon.CDK.AWS.Cloud9.Alpha", + "packageId": "Amazon.CDK.AWS.Cloud9.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "python": { - "distName": "aws-cdk.aws-cloud9", - "module": "aws_cdk.aws_cloud9", + "distName": "aws-cdk.aws-cloud9-alpha", + "module": "aws_cdk.aws_cloud9_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkcloud9alpha" } }, "projectReferences": true, @@ -52,17 +56,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Cloud9", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -80,28 +81,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -109,11 +101,7 @@ }, "awslint": { "exclude": [ - "resource-attribute:@aws-cdk/aws-cloud9.Ec2Environment.environmentEc2Arn", - "resource-attribute:@aws-cdk/aws-cloud9.Ec2Environment.environmentEc2Name", - "props-physical-name:@aws-cdk/aws-cloud9.Ec2EnvironmentProps", - "docs-public-apis:@aws-cdk/aws-cloud9.CloneRepository.pathComponent", - "docs-public-apis:@aws-cdk/aws-cloud9.CloneRepository.repositoryUrl" + "*:*" ] }, "stability": "experimental", @@ -122,6 +110,12 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-cloud9/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cloud9/rosetta/default.ts-fixture index e2687d0d2c5bf..d5f0a7c1464c8 100644 --- a/packages/@aws-cdk/aws-cloud9/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-cloud9/rosetta/default.ts-fixture @@ -1,8 +1,8 @@ // Fixture with packages imported, but nothing else -import { CfnOutput, Stack } from '@aws-cdk/core'; +import { CfnOutput, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cloud9 from '@aws-cdk/aws-cloud9'; -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as cloud9 from '@aws-cdk/aws-cloud9-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-cloud9/test/cloud9.environment.test.ts b/packages/@aws-cdk/aws-cloud9/test/cloud9.environment.test.ts index 69210bf01a135..cd4783c6ae10a 100644 --- a/packages/@aws-cdk/aws-cloud9/test/cloud9.environment.test.ts +++ b/packages/@aws-cdk/aws-cloud9/test/cloud9.environment.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import * as cloud9 from '../lib'; import { ConnectionType, ImageId, Owner } from '../lib'; diff --git a/packages/@aws-cdk/aws-cloud9/test/integ.cloud9.ts b/packages/@aws-cdk/aws-cloud9/test/integ.cloud9.ts index 2081084a9ed33..cced3fbb33918 100644 --- a/packages/@aws-cdk/aws-cloud9/test/integ.cloud9.ts +++ b/packages/@aws-cdk/aws-cloud9/test/integ.cloud9.ts @@ -1,6 +1,6 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import * as constructs from 'constructs'; import * as cloud9 from '../lib'; diff --git a/packages/@aws-cdk/aws-cloud9/test/integ.connection-type.ts b/packages/@aws-cdk/aws-cloud9/test/integ.connection-type.ts index ce9ef6e71df8d..97cb6d0642173 100644 --- a/packages/@aws-cdk/aws-cloud9/test/integ.connection-type.ts +++ b/packages/@aws-cdk/aws-cloud9/test/integ.connection-type.ts @@ -1,7 +1,7 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; import * as cloud9 from '../lib'; import { ConnectionType } from '../lib'; diff --git a/packages/@aws-cdk/aws-cloud9/test/integ.image-id.ts b/packages/@aws-cdk/aws-cloud9/test/integ.image-id.ts index 50f16ee857ade..74aa12e6e9b9b 100644 --- a/packages/@aws-cdk/aws-cloud9/test/integ.image-id.ts +++ b/packages/@aws-cdk/aws-cloud9/test/integ.image-id.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack, App, StackProps, CfnOutput } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Stack, App, StackProps, CfnOutput } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import * as cloud9 from '../lib'; import { ImageId } from '../lib'; diff --git a/packages/@aws-cdk/aws-cloudformation/.eslintrc.js b/packages/@aws-cdk/aws-cloudformation/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudformation/.gitignore b/packages/@aws-cdk/aws-cloudformation/.gitignore deleted file mode 100644 index b75716bf2a00e..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml - -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cloudformation/.npmignore b/packages/@aws-cdk/aws-cloudformation/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cloudformation/LICENSE b/packages/@aws-cdk/aws-cloudformation/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cloudformation/NOTICE b/packages/@aws-cdk/aws-cloudformation/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cloudformation/README.md b/packages/@aws-cdk/aws-cloudformation/README.md deleted file mode 100644 index f37db8ba71325..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# AWS CloudFormation Construct Library - - ---- - -![Deprecated](https://img.shields.io/badge/deprecated-critical.svg?style=for-the-badge) - -> This API may emit warnings. Backward compatibility is not guaranteed. - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/@aws-cdk/aws-cloudformation/jest.config.js b/packages/@aws-cdk/aws-cloudformation/jest.config.js deleted file mode 100644 index 0fd77f7ff8d37..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - ...baseConfig.coverageThreshold, - global: { - ...baseConfig.coverageThreshold.global, - statements: 75, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-cloudformation/lib/nested-stack.ts b/packages/@aws-cdk/aws-cloudformation/lib/nested-stack.ts deleted file mode 100644 index 21a0d00b7909c..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/lib/nested-stack.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as core from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Initialization props for the `NestedStack` construct. - * - * @deprecated use core.NestedStackProps instead - */ -export interface NestedStackProps { - /** - * The set value pairs that represent the parameters passed to CloudFormation - * when this nested stack is created. Each parameter has a name corresponding - * to a parameter defined in the embedded template and a value representing - * the value that you want to set for the parameter. - * - * The nested stack construct will automatically synthesize parameters in order - * to bind references from the parent stack(s) into the nested stack. - * - * @default - no user-defined parameters are passed to the nested stack - */ - readonly parameters?: { [key: string]: string }; - - /** - * The length of time that CloudFormation waits for the nested stack to reach - * the CREATE_COMPLETE state. - * - * When CloudFormation detects that the nested stack has reached the - * CREATE_COMPLETE state, it marks the nested stack resource as - * CREATE_COMPLETE in the parent stack and resumes creating the parent stack. - * If the timeout period expires before the nested stack reaches - * CREATE_COMPLETE, CloudFormation marks the nested stack as failed and rolls - * back both the nested stack and parent stack. - * - * @default - no timeout - */ - readonly timeout?: core.Duration; - - /** - * The Simple Notification Service (SNS) topics to publish stack related - * events. - * - * @default - notifications are not sent for this stack. - */ - readonly notifications?: sns.ITopic[]; -} - -/** - * A CloudFormation nested stack. - * - * When you apply template changes to update a top-level stack, CloudFormation - * updates the top-level stack and initiates an update to its nested stacks. - * CloudFormation updates the resources of modified nested stacks, but does not - * update the resources of unmodified nested stacks. - * - * Furthermore, this stack will not be treated as an independent deployment - * artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), - * but rather only synthesized as a template and uploaded as an asset to S3. - * - * Cross references of resource attributes between the parent stack and the - * nested stack will automatically be translated to stack parameters and - * outputs. - * - * @deprecated use core.NestedStack instead - */ -export class NestedStack extends core.NestedStack { - constructor(scope: Construct, id: string, props: NestedStackProps = { }) { - super(scope, id, { - parameters: props.parameters, - timeout: props.timeout, - notificationArns: props.notifications?.map(n => n.topicArn), - }); - } -} diff --git a/packages/@aws-cdk/aws-cloudformation/package.json b/packages/@aws-cdk/aws-cloudformation/package.json deleted file mode 100644 index 3955563cb8786..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/package.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "name": "@aws-cdk/aws-cloudformation", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CloudFormation", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cloudformation", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cloudformation" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CloudFormation", - "packageId": "Amazon.CDK.AWS.CloudFormation", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cloudformation", - "module": "aws_cdk.aws_cloudformation", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cloudformation" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CloudFormation" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudformation" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "construct-ctor:@aws-cdk/aws-cloudformation.PipelineCloudFormationAction.", - "construct-ctor:@aws-cdk/aws-cloudformation.PipelineCloudFormationDeployAction.", - "no-unused-type:@aws-cdk/aws-cloudformation.CloudFormationCapabilities", - "props-physical-name:@aws-cdk/aws-cloudformation.CustomResourceProps" - ] - }, - "stability": "deprecated", - "awscdkio": { - "announce": false - }, - "maturity": "deprecated", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoi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bm8tcmVxdWlyZS1pbXBvcnRzXG4gICAgICAgIGNvbnN0IHJlcXVlc3QgPSByZXF1aXJlKCdodHRwcycpLnJlcXVlc3QocmVxdWVzdE9wdGlvbnMsIHJlc29sdmUpO1xuICAgICAgICByZXF1ZXN0Lm9uKCdlcnJvcicsIHJlamVjdCk7XG4gICAgICAgIHJlcXVlc3Qud3JpdGUocmVzcG9uc2VCb2R5KTtcbiAgICAgICAgcmVxdWVzdC5lbmQoKTtcbiAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgcmVqZWN0KGUpO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG5cbiAgZnVuY3Rpb24gcGFyc2VSZXRyeU9wdGlvbnMocmF3T3B0aW9uczogYW55KTogU2RrUmV0cnlPcHRpb25zIHtcbiAgICBjb25zdCByZXRyeU9wdGlvbnM6IFNka1JldHJ5T3B0aW9ucyA9IHt9O1xuICAgIGlmIChyYXdPcHRpb25zKSB7XG4gICAgICBpZiAocmF3T3B0aW9ucy5tYXhSZXRyaWVzKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5tYXhSZXRyaWVzID0gcGFyc2VJbnQocmF3T3B0aW9ucy5tYXhSZXRyaWVzLCAxMCk7XG4gICAgICB9XG4gICAgICBpZiAocmF3T3B0aW9ucy5iYXNlKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5yZXRyeU9wdGlvbnMgPSB7XG4gICAgICAgICAgYmFzZTogcGFyc2VJbnQocmF3T3B0aW9ucy5iYXNlLCAxMCksXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXRyeU9wdGlvbnM7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdBQUcsT0FBTyxFQUFFLFVBQVUsSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUM1RSxNQUFNLEtBQUssR0FBRyxPQUFPLEVBQUUsWUFBWSxFQUFFLElBQUks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gICBpZiAocmF3T3B0aW9ucy5tYXhSZXRyaWVzKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5tYXhSZXRyaWVzID0gcGFyc2VJbnQocmF3T3B0aW9ucy5tYXhSZXRyaWVzLCAxMCk7XG4gICAgICB9XG4gICAgICBpZiAocmF3T3B0aW9ucy5iYXNlKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5yZXRyeU9wdGlvbnMgPSB7XG4gICAgICAgICAgYmFzZTogcGFyc2VJbnQocmF3T3B0aW9ucy5iYXNlLCAxMCksXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXRyeU9wdGlvbnM7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/resource.test.ts b/packages/@aws-cdk/aws-cloudformation/test/resource.test.ts deleted file mode 100644 index 3f60e6a09e729..0000000000000 --- a/packages/@aws-cdk/aws-cloudformation/test/resource.test.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CustomResource, CustomResourceProvider } from '../lib'; - -/* eslint-disable @aws-cdk/no-core-construct */ -/* eslint-disable quote-props */ - -describeDeprecated('custom resources honor removalPolicy', () => { - test('unspecified (aka .Destroy)', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - // WHEN - new TestCustomResource(stack, 'Custom'); - - // THEN - Template.fromStack(stack).hasResource('AWS::CloudFormation::CustomResource', {}); - expect(app.synth().tryGetArtifact(stack.stackName)!.findMetadataByType('aws:cdk:protected').length).toEqual(0); - }); - - test('.Destroy', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - // WHEN - new TestCustomResource(stack, 'Custom', { removalPolicy: cdk.RemovalPolicy.DESTROY }); - - // THEN - Template.fromStack(stack).hasResource('AWS::CloudFormation::CustomResource', {}); - expect(app.synth().tryGetArtifact(stack.stackName)!.findMetadataByType('aws:cdk:protected').length).toEqual(0); - }); - - test('.Retain', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - // WHEN - new TestCustomResource(stack, 'Custom', { removalPolicy: cdk.RemovalPolicy.RETAIN }); - - // THEN - Template.fromStack(stack).hasResource('AWS::CloudFormation::CustomResource', { - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }); - }); -}); - -testDeprecated('custom resource is added twice, lambda is added once', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - // WHEN - new TestCustomResource(stack, 'Custom1'); - new TestCustomResource(stack, 'Custom2'); - - // THEN - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'SingletonLambdaTestCustomResourceProviderServiceRole81FEAB5C': { - 'Type': 'AWS::IAM::Role', - 'Properties': { - 'AssumeRolePolicyDocument': { - 'Statement': [ - { - 'Action': 'sts:AssumeRole', - 'Effect': 'Allow', - 'Principal': { - 'Service': 'lambda.amazonaws.com', - }, - }, - ], - 'Version': '2012-10-17', - }, - 'ManagedPolicyArns': [ - { - 'Fn::Join': ['', [ - 'arn:', { 'Ref': 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', - ]], - }, - ], - }, - }, - 'SingletonLambdaTestCustomResourceProviderA9255269': { - 'Type': 'AWS::Lambda::Function', - 'Properties': { - 'Code': { - 'ZipFile': 'def hello(): pass', - }, - 'Handler': 'index.hello', - 'Role': { - 'Fn::GetAtt': [ - 'SingletonLambdaTestCustomResourceProviderServiceRole81FEAB5C', - 'Arn', - ], - }, - 'Runtime': 'python3.9', - 'Timeout': 300, - }, - 'DependsOn': [ - 'SingletonLambdaTestCustomResourceProviderServiceRole81FEAB5C', - ], - }, - 'Custom1D319B237': { - 'Type': 'AWS::CloudFormation::CustomResource', - 'DeletionPolicy': 'Delete', - 'UpdateReplacePolicy': 'Delete', - 'Properties': { - 'ServiceToken': { - 'Fn::GetAtt': [ - 'SingletonLambdaTestCustomResourceProviderA9255269', - 'Arn', - ], - }, - }, - }, - 'Custom2DD5FB44D': { - 'Type': 'AWS::CloudFormation::CustomResource', - 'DeletionPolicy': 'Delete', - 'UpdateReplacePolicy': 'Delete', - 'Properties': { - 'ServiceToken': { - 'Fn::GetAtt': [ - 'SingletonLambdaTestCustomResourceProviderA9255269', - 'Arn', - ], - }, - }, - }, - }, - }); -}); - -testDeprecated('custom resources can specify a resource type that starts with Custom::', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - new CustomResource(stack, 'MyCustomResource', { - resourceType: 'Custom::MyCustomResourceType', - provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), - }); - Template.fromStack(stack).hasResourceProperties('Custom::MyCustomResourceType', {}); -}); - -describeDeprecated('fails if custom resource type is invalid', () => { - test('does not start with "Custom::"', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - expect(() => { - new CustomResource(stack, 'MyCustomResource', { - resourceType: 'NoCustom::MyCustomResourceType', - provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), - }); - }).toThrow(/Custom resource type must begin with "Custom::"/); - }); - - test('has invalid characters', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - expect(() => { - new CustomResource(stack, 'MyCustomResource', { - resourceType: 'Custom::My Custom?ResourceType', - provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), - }); - }).toThrow(/Custom resource type name can only include alphanumeric characters and/); - }); - - test('is longer than 60 characters', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Test'); - - expect(() => { - new CustomResource(stack, 'MyCustomResource', { - resourceType: 'Custom::0123456789012345678901234567890123456789012345678901234567891', - provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), - }); - }).toThrow(/Custom resource type length > 60/); - }); -}); - -testDeprecated('.ref returns the intrinsic reference (physical name)', () => { - // GIVEN - const stack = new cdk.Stack(); - const res = new TestCustomResource(stack, 'myResource'); - - // THEN - expect(stack.resolve(res.resource.ref)).toEqual({ Ref: 'myResourceC6A188A9' }); -}); - -class TestCustomResource extends Construct { - public readonly resource: CustomResource; - - constructor(scope: Construct, id: string, opts: { removalPolicy?: cdk.RemovalPolicy } = {}) { - super(scope, id); - - const singletonLambda = new lambda.SingletonFunction(this, 'Lambda', { - uuid: 'TestCustomResourceProvider', - code: new lambda.InlineCode('def hello(): pass'), - runtime: lambda.Runtime.PYTHON_3_9, - handler: 'index.hello', - timeout: cdk.Duration.minutes(5), - }); - - this.resource = new CustomResource(this, 'Resource', { - ...opts, - provider: CustomResourceProvider.fromLambda(singletonLambda), - }); - } -} diff --git a/packages/@aws-cdk/aws-cloudfront-origins/.eslintrc.js b/packages/@aws-cdk/aws-cloudfront-origins/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/.gitignore b/packages/@aws-cdk/aws-cloudfront-origins/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cloudfront-origins/.npmignore b/packages/@aws-cdk/aws-cloudfront-origins/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cloudfront-origins/LICENSE b/packages/@aws-cdk/aws-cloudfront-origins/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cloudfront-origins/NOTICE b/packages/@aws-cdk/aws-cloudfront-origins/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cloudfront-origins/README.md b/packages/@aws-cdk/aws-cloudfront-origins/README.md deleted file mode 100644 index e58af3c142212..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/README.md +++ /dev/null @@ -1,141 +0,0 @@ -# CloudFront Origins for the CDK CloudFront Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library contains convenience methods for defining origins for a CloudFront distribution. You can use this library to create origins from -S3 buckets, Elastic Load Balancing v2 load balancers, or any other domain name. - -## S3 Bucket - -An S3 bucket can be added as an origin. If the bucket is configured as a website endpoint, the distribution can use S3 redirects and S3 custom error -documents. - -```ts -const myBucket = new s3.Bucket(this, 'myBucket'); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.S3Origin(myBucket) }, -}); -``` - -The above will treat the bucket differently based on if `IBucket.isWebsite` is set or not. If the bucket is configured as a website, the bucket is -treated as an HTTP origin, and the built-in S3 redirects and error pages can be used. Otherwise, the bucket is handled as a bucket origin and -CloudFront's redirect and error handling will be used. In the latter case, the Origin will create an origin access identity and grant it access to the -underlying bucket. This can be used in conjunction with a bucket that is not public to require that your users access your content using CloudFront -URLs and not S3 URLs directly. Alternatively, a custom origin access identity can be passed to the S3 origin in the properties. - -### Adding Custom Headers - -You can configure CloudFront to add custom headers to the requests that it sends to your origin. These custom headers enable you to send and gather information from your origin that you don’t get with typical viewer requests. These headers can even be customized for each origin. CloudFront supports custom headers for both for custom and Amazon S3 origins. - -```ts -const myBucket = new s3.Bucket(this, 'myBucket'); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.S3Origin(myBucket, { - customHeaders: { - Foo: 'bar', - }, - })}, -}); -``` - -## ELBv2 Load Balancer - -An Elastic Load Balancing (ELB) v2 load balancer may be used as an origin. In order for a load balancer to serve as an origin, it must be publicly -accessible (`internetFacing` is true). Both Application and Network load balancers are supported. - -```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; - -declare const vpc: ec2.Vpc; -// Create an application load balancer in a VPC. 'internetFacing' must be 'true' -// for CloudFront to access the load balancer and use it as an origin. -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { - vpc, - internetFacing: true, -}); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.LoadBalancerV2Origin(lb) }, -}); -``` - -The origin can also be customized to respond on different ports, have different connection properties, etc. - -```ts -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; - -declare const loadBalancer: elbv2.ApplicationLoadBalancer; -const origin = new origins.LoadBalancerV2Origin(loadBalancer, { - connectionAttempts: 3, - connectionTimeout: Duration.seconds(5), - readTimeout: Duration.seconds(45), - keepaliveTimeout: Duration.seconds(45), - protocolPolicy: cloudfront.OriginProtocolPolicy.MATCH_VIEWER, -}); -``` - -Note that the `readTimeout` and `keepaliveTimeout` properties can extend their values over 60 seconds only if a limit increase request for CloudFront origin response timeout -quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Consider that this value is -still limited to a maximum value of 180 seconds, which is a hard limit for that quota. - -## From an HTTP endpoint - -Origins can also be created from any other HTTP endpoint, given the domain name, and optionally, other origin properties. - -```ts -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, -}); -``` - -See the documentation of `@aws-cdk/aws-cloudfront` for more information. - -## Failover Origins (Origin Groups) - -You can set up CloudFront with origin failover for scenarios that require high availability. -To get started, you create an origin group with two origins: a primary and a secondary. -If the primary origin is unavailable, or returns specific HTTP response status codes that indicate a failure, -CloudFront automatically switches to the secondary origin. -You achieve that behavior in the CDK using the `OriginGroup` class: - -```ts -const myBucket = new s3.Bucket(this, 'myBucket'); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { - origin: new origins.OriginGroup({ - primaryOrigin: new origins.S3Origin(myBucket), - fallbackOrigin: new origins.HttpOrigin('www.example.com'), - // optional, defaults to: 500, 502, 503 and 504 - fallbackStatusCodes: [404], - }), - }, -}); -``` - -## From an API Gateway REST API - -Origins can be created from an API Gateway REST API. It is recommended to use a -[regional API](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-endpoint-types.html) in this case. The origin path will automatically be set as the stage name. - -```ts -declare const api: apigateway.RestApi; -new cloudfront.Distribution(this, 'Distribution', { - defaultBehavior: { origin: new origins.RestApiOrigin(api) }, -}); -``` - -If you want to use a different origin path, you can specify it in the `originPath` property. - -```ts -declare const api: apigateway.RestApi; -new cloudfront.Distribution(this, 'Distribution', { - defaultBehavior: { origin: new origins.RestApiOrigin(api, { originPath: '/custom-origin-path' }) }, -}); -``` diff --git a/packages/@aws-cdk/aws-cloudfront-origins/jest.config.js b/packages/@aws-cdk/aws-cloudfront-origins/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/private/utils.ts b/packages/@aws-cdk/aws-cloudfront-origins/lib/private/utils.ts deleted file mode 100644 index ad6dfc2e69392..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/lib/private/utils.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as cdk from '@aws-cdk/core'; - -/** - * Throws an error if a duration is defined and not an integer number of seconds within a range. - */ -export function validateSecondsInRangeOrUndefined(name: string, min: number, max: number, duration?: cdk.Duration) { - if (duration === undefined) { return; } - const value = duration.toSeconds(); - if (!Number.isInteger(value) || value < min || value > max) { - throw new Error(`${name}: Must be an int between ${min} and ${max} seconds (inclusive); received ${value}.`); - } -} diff --git a/packages/@aws-cdk/aws-cloudfront-origins/package.json b/packages/@aws-cdk/aws-cloudfront-origins/package.json deleted file mode 100644 index cfd2c78d0d9fc..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "@aws-cdk/aws-cloudfront-origins", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS CloudFront Origins", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cloudfront.origins", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cloudfront-origins" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CloudFront.Origins", - "packageId": "Amazon.CDK.AWS.CloudFront.Origins", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cloudfront-origins", - "module": "aws_cdk.aws_cloudfront_origins", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cloudfront-origins" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudfront", - "cloudfront-origins" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0" - }, - "dependencies": { - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-cloudfront-origins/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cloudfront-origins/rosetta/default.ts-fixture deleted file mode 100644 index 3c7781d356955..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as origins from '@aws-cdk/aws-cloudfront-origins'; -import * as s3 from '@aws-cdk/aws-s3'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - - } -} diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.ts deleted file mode 100644 index 8806ca3aafdc4..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.http-origin.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as cdk from '@aws-cdk/core'; -import * as origins from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'cloudfront-http-origin'); - -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.ts deleted file mode 100644 index 85685500993ae..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.load-balancer-origin.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as origins from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'cloudfront-load-balancer-origin'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); -const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); - -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: new origins.LoadBalancerV2Origin(loadbalancer) }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.ts deleted file mode 100644 index aa210ad2755fa..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.origin-group.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as origins from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'cloudfront-origin-group'); - -const bucket = new s3.Bucket(stack, 'Bucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -const originGroup = new origins.OriginGroup({ - primaryOrigin: new origins.S3Origin(bucket), - fallbackOrigin: new origins.HttpOrigin('www.example.com'), -}); - -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: originGroup }, - additionalBehaviors: { - '/api': { - origin: originGroup, - }, - }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts deleted file mode 100644 index 1bd9d05e9ec8a..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin-custom-origin-path.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as origins from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin-custom-origin-path'); - -const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); -api.root.addMethod('GET'); - -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: new origins.RestApiOrigin(api, { originPath: '/' }) }, -}); - -new IntegTest(app, 'rest-api-origin-custom-origin-path', { - testCases: [stack], -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts deleted file mode 100644 index 29c691545a592..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.rest-api-origin.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as origins from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'integ-cloudfront-rest-api-origin'); - -const api = new apigateway.RestApi(stack, 'RestApi', { endpointTypes: [apigateway.EndpointType.REGIONAL], cloudWatchRole: true }); -api.root.addMethod('GET'); - -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: new origins.RestApiOrigin(api) }, -}); - -new IntegTest(app, 'rest-api-origin', { - testCases: [stack], -}); diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.ts deleted file mode 100644 index d7331a160abcd..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as origins from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'cloudfront-s3-origin-oai'); - -const bucket = new s3.Bucket(stack, 'Bucket'); -const originAccessIdentity = new cloudfront.OriginAccessIdentity(stack, 'OriginAccessIdentity', { - comment: 'Identity for bucket provided by test', -}); -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: new origins.S3Origin(bucket, { originAccessIdentity }) }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.ts b/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.ts deleted file mode 100644 index 53289c306a256..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as origins from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'cloudfront-s3-origin'); - -const bucket = new s3.Bucket(stack, 'Bucket'); -new cloudfront.Distribution(stack, 'Distribution', { - defaultBehavior: { origin: new origins.S3Origin(bucket) }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudfront/.eslintrc.js b/packages/@aws-cdk/aws-cloudfront/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudfront/.gitignore b/packages/@aws-cdk/aws-cloudfront/.gitignore deleted file mode 100644 index 511ea0b28f7d9..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -*.js -*.d.ts -tsconfig.json -*.js.map -*.generated.ts -dist -coverage -.nyc_output -.jsii - -.LAST_BUILD -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -!lib/experimental/edge-function/index.js -!test/function-code.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cloudfront/.npmignore b/packages/@aws-cdk/aws-cloudfront/.npmignore deleted file mode 100644 index 71955ad3442d1..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -cfn -dist -coverage -.nyc_output -*.tgz - -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -jest.config.js - -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cloudfront/LICENSE b/packages/@aws-cdk/aws-cloudfront/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cloudfront/NOTICE b/packages/@aws-cdk/aws-cloudfront/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cloudfront/README.md b/packages/@aws-cdk/aws-cloudfront/README.md deleted file mode 100644 index 95e0acb755f13..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/README.md +++ /dev/null @@ -1,1033 +0,0 @@ -# Amazon CloudFront Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Amazon CloudFront is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .js, and image files, to -your users. CloudFront delivers your content through a worldwide network of data centers called edge locations. When a user requests content that -you're serving with CloudFront, the user is routed to the edge location that provides the lowest latency, so that content is delivered with the best -possible performance. - -## Distribution API - -The `Distribution` API is currently being built to replace the existing `CloudFrontWebDistribution` API. The `Distribution` API is optimized for the -most common use cases of CloudFront distributions (e.g., single origin and behavior, few customizations) while still providing the ability for more -advanced use cases. The API focuses on simplicity for the common use cases, and convenience methods for creating the behaviors and origins necessary -for more complex use cases. - -### Creating a distribution - -CloudFront distributions deliver your content from one or more origins; an origin is the location where you store the original version of your -content. Origins can be created from S3 buckets or a custom origin (HTTP server). Constructs to define origins are in the `@aws-cdk/aws-cloudfront-origins` module. - -Each distribution has a default behavior which applies to all requests to that distribution, and routes requests to a primary origin. -Additional behaviors may be specified for an origin with a given URL path pattern. Behaviors allow routing with multiple origins, -controlling which HTTP methods to support, whether to require users to use HTTPS, and what query strings or cookies to forward to your origin, -among other settings. - -#### From an S3 Bucket - -An S3 bucket can be added as an origin. If the bucket is configured as a website endpoint, the distribution can use S3 redirects and S3 custom error -documents. - -```ts -// Creates a distribution from an S3 bucket. -const myBucket = new s3.Bucket(this, 'myBucket'); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.S3Origin(myBucket) }, -}); -``` - -The above will treat the bucket differently based on if `IBucket.isWebsite` is set or not. If the bucket is configured as a website, the bucket is -treated as an HTTP origin, and the built-in S3 redirects and error pages can be used. Otherwise, the bucket is handled as a bucket origin and -CloudFront's redirect and error handling will be used. In the latter case, the Origin will create an origin access identity and grant it access to the -underlying bucket. This can be used in conjunction with a bucket that is not public to require that your users access your content using CloudFront -URLs and not S3 URLs directly. - -#### ELBv2 Load Balancer - -An Elastic Load Balancing (ELB) v2 load balancer may be used as an origin. In order for a load balancer to serve as an origin, it must be publicly -accessible (`internetFacing` is true). Both Application and Network load balancers are supported. - -```ts -// Creates a distribution from an ELBv2 load balancer -declare const vpc: ec2.Vpc; -// Create an application load balancer in a VPC. 'internetFacing' must be 'true' -// for CloudFront to access the load balancer and use it as an origin. -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { - vpc, - internetFacing: true, -}); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.LoadBalancerV2Origin(lb) }, -}); -``` - -#### From an HTTP endpoint - -Origins can also be created from any other HTTP endpoint, given the domain name, and optionally, other origin properties. - -```ts -// Creates a distribution from an HTTP endpoint -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, -}); -``` - -### Domain Names and Certificates - -When you create a distribution, CloudFront assigns a domain name for the distribution, for example: `d111111abcdef8.cloudfront.net`; this value can -be retrieved from `distribution.distributionDomainName`. CloudFront distributions use a default certificate (`*.cloudfront.net`) to support HTTPS by -default. If you want to use your own domain name, such as `www.example.com`, you must associate a certificate with your distribution that contains -your domain name, and provide one (or more) domain names from the certificate for the distribution. - -The certificate must be present in the AWS Certificate Manager (ACM) service in the US East (N. Virginia) region; the certificate -may either be created by ACM, or created elsewhere and imported into ACM. When a certificate is used, the distribution will support HTTPS connections -from SNI only and a minimum protocol version of TLSv1.2_2021 if the `@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021` feature flag is set, and TLSv1.2_2019 otherwise. - -```ts -// To use your own domain name in a Distribution, you must associate a certificate -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; - -declare const hostedZone: route53.HostedZone; -const myCertificate = new acm.Certificate(this, 'mySiteCert', { - domainName: 'www.example.com', - validation: acm.CertificateValidation.fromDns(hostedZone), -}); - -declare const myBucket: s3.Bucket; -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.S3Origin(myBucket) }, - domainNames: ['www.example.com'], - certificate: myCertificate, -}); -``` - -However, you can customize the minimum protocol version for the certificate while creating the distribution using `minimumProtocolVersion` property. - -```ts -// Create a Distribution with a custom domain name and a minimum protocol version. -declare const myBucket: s3.Bucket; -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.S3Origin(myBucket) }, - domainNames: ['www.example.com'], - minimumProtocolVersion: cloudfront.SecurityPolicyProtocol.TLS_V1_2016, - sslSupportMethod: cloudfront.SSLMethod.SNI, -}); -``` - -#### Cross Region Certificates - -> **This feature is currently experimental** - -You can enable the Stack property `crossRegionReferences` -in order to access resources in a different stack _and_ region. With this feature flag -enabled it is possible to do something like creating a CloudFront distribution in `us-east-2` and -an ACM certificate in `us-east-1`. - -```ts -const stack1 = new Stack(app, 'Stack1', { - env: { - region: 'us-east-1', - }, - crossRegionReferences: true, -}); -const cert = new acm.Certificate(stack1, 'Cert', { - domainName: '*.example.com', - validation: acm.CertificateValidation.fromDns(route53.PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'Z0329774B51CGXTDQV3X')), -}); - -const stack2 = new Stack(app, 'Stack2', { - env: { - region: 'us-east-2', - }, - crossRegionReferences: true, -}); -new cloudfront.Distribution(stack2, 'Distribution', { - defaultBehavior: { - origin: new origins.HttpOrigin('example.com'), - }, - domainNames: ['dev.example.com'], - certificate: cert, -}); -``` - -### Multiple Behaviors & Origins - -Each distribution has a default behavior which applies to all requests to that distribution; additional behaviors may be specified for a -given URL path pattern. Behaviors allow routing with multiple origins, controlling which HTTP methods to support, whether to require users to -use HTTPS, and what query strings or cookies to forward to your origin, among others. - -The properties of the default behavior can be adjusted as part of the distribution creation. The following example shows configuring the HTTP -methods and viewer protocol policy of the cache. - -```ts -// Create a Distribution with configured HTTP methods and viewer protocol policy of the cache. -declare const myBucket: s3.Bucket; -const myWebDistribution = new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { - origin: new origins.S3Origin(myBucket), - allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL, - viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, - }, -}); -``` - -Additional behaviors can be specified at creation, or added after the initial creation. Each additional behavior is associated with an origin, -and enable customization for a specific set of resources based on a URL path pattern. For example, we can add a behavior to `myWebDistribution` to -override the default viewer protocol policy for all of the images. - -```ts -// Add a behavior to a Distribution after initial creation. -declare const myBucket: s3.Bucket; -declare const myWebDistribution: cloudfront.Distribution; -myWebDistribution.addBehavior('/images/*.jpg', new origins.S3Origin(myBucket), { - viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, -}); -``` - -These behaviors can also be specified at distribution creation time. - -```ts -// Create a Distribution with additional behaviors at creation time. -declare const myBucket: s3.Bucket; -const bucketOrigin = new origins.S3Origin(myBucket); -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { - origin: bucketOrigin, - allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL, - viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, - }, - additionalBehaviors: { - '/images/*.jpg': { - origin: bucketOrigin, - viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, - }, - }, -}); -``` - -### Customizing Cache Keys and TTLs with Cache Policies - -You can use a cache policy to improve your cache hit ratio by controlling the values (URL query strings, HTTP headers, and cookies) -that are included in the cache key, and/or adjusting how long items remain in the cache via the time-to-live (TTL) settings. -CloudFront provides some predefined cache policies, known as managed policies, for common use cases. You can use these managed policies, -or you can create your own cache policy that’s specific to your needs. -See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html for more details. - -```ts -// Using an existing cache policy for a Distribution -declare const bucketOrigin: origins.S3Origin; -new cloudfront.Distribution(this, 'myDistManagedPolicy', { - defaultBehavior: { - origin: bucketOrigin, - cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED, - }, -}); -``` - -```ts -// Creating a custom cache policy for a Distribution -- all parameters optional -declare const bucketOrigin: origins.S3Origin; -const myCachePolicy = new cloudfront.CachePolicy(this, 'myCachePolicy', { - cachePolicyName: 'MyPolicy', - comment: 'A default policy', - defaultTtl: Duration.days(2), - minTtl: Duration.minutes(1), - maxTtl: Duration.days(10), - cookieBehavior: cloudfront.CacheCookieBehavior.all(), - headerBehavior: cloudfront.CacheHeaderBehavior.allowList('X-CustomHeader'), - queryStringBehavior: cloudfront.CacheQueryStringBehavior.denyList('username'), - enableAcceptEncodingGzip: true, - enableAcceptEncodingBrotli: true, -}); -new cloudfront.Distribution(this, 'myDistCustomPolicy', { - defaultBehavior: { - origin: bucketOrigin, - cachePolicy: myCachePolicy, - }, -}); -``` - -### Customizing Origin Requests with Origin Request Policies - -When CloudFront makes a request to an origin, the URL path, request body (if present), and a few standard headers are included. -Other information from the viewer request, such as URL query strings, HTTP headers, and cookies, is not included in the origin request by default. -You can use an origin request policy to control the information that’s included in an origin request. -CloudFront provides some predefined origin request policies, known as managed policies, for common use cases. You can use these managed policies, -or you can create your own origin request policy that’s specific to your needs. -See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html for more details. - -```ts -// Using an existing origin request policy for a Distribution -declare const bucketOrigin: origins.S3Origin; -new cloudfront.Distribution(this, 'myDistManagedPolicy', { - defaultBehavior: { - origin: bucketOrigin, - originRequestPolicy: cloudfront.OriginRequestPolicy.CORS_S3_ORIGIN, - }, -}); -``` - -```ts -// Creating a custom origin request policy for a Distribution -- all parameters optional -declare const bucketOrigin: origins.S3Origin; -const myOriginRequestPolicy = new cloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', { - originRequestPolicyName: 'MyPolicy', - comment: 'A default policy', - cookieBehavior: cloudfront.OriginRequestCookieBehavior.none(), - headerBehavior: cloudfront.OriginRequestHeaderBehavior.all('CloudFront-Is-Android-Viewer'), - queryStringBehavior: cloudfront.OriginRequestQueryStringBehavior.allowList('username'), -}); - -new cloudfront.Distribution(this, 'myDistCustomPolicy', { - defaultBehavior: { - origin: bucketOrigin, - originRequestPolicy: myOriginRequestPolicy, - }, -}); -``` - -### Customizing Response Headers with Response Headers Policies - -You can configure CloudFront to add one or more HTTP headers to the responses that it sends to viewers (web browsers or other clients), without making any changes to the origin or writing any code. -To specify the headers that CloudFront adds to HTTP responses, you use a response headers policy. CloudFront adds the headers regardless of whether it serves the object from the cache or has to retrieve the object from the origin. If the origin response includes one or more of the headers that’s in a response headers policy, the policy can specify whether CloudFront uses the header it received from the origin or overwrites it with the one in the policy. -See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/adding-response-headers.html - -```ts -// Using an existing managed response headers policy -declare const bucketOrigin: origins.S3Origin; -new cloudfront.Distribution(this, 'myDistManagedPolicy', { - defaultBehavior: { - origin: bucketOrigin, - responseHeadersPolicy: cloudfront.ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS, - }, -}); - -// Creating a custom response headers policy -- all parameters optional -const myResponseHeadersPolicy = new cloudfront.ResponseHeadersPolicy(this, 'ResponseHeadersPolicy', { - responseHeadersPolicyName: 'MyPolicy', - comment: 'A default policy', - corsBehavior: { - accessControlAllowCredentials: false, - accessControlAllowHeaders: ['X-Custom-Header-1', 'X-Custom-Header-2'], - accessControlAllowMethods: ['GET', 'POST'], - accessControlAllowOrigins: ['*'], - accessControlExposeHeaders: ['X-Custom-Header-1', 'X-Custom-Header-2'], - accessControlMaxAge: Duration.seconds(600), - originOverride: true, - }, - customHeadersBehavior: { - customHeaders: [ - { header: 'X-Amz-Date', value: 'some-value', override: true }, - { header: 'X-Amz-Security-Token', value: 'some-value', override: false }, - ], - }, - securityHeadersBehavior: { - contentSecurityPolicy: { contentSecurityPolicy: 'default-src https:;', override: true }, - contentTypeOptions: { override: true }, - frameOptions: { frameOption: cloudfront.HeadersFrameOption.DENY, override: true }, - referrerPolicy: { referrerPolicy: cloudfront.HeadersReferrerPolicy.NO_REFERRER, override: true }, - strictTransportSecurity: { accessControlMaxAge: Duration.seconds(600), includeSubdomains: true, override: true }, - xssProtection: { protection: true, modeBlock: true, reportUri: 'https://example.com/csp-report', override: true }, - }, - removeHeaders: ['Server'], - serverTimingSamplingRate: 50, -}); -new cloudfront.Distribution(this, 'myDistCustomPolicy', { - defaultBehavior: { - origin: bucketOrigin, - responseHeadersPolicy: myResponseHeadersPolicy, - }, -}); -``` - -### Validating signed URLs or signed cookies with Trusted Key Groups - -CloudFront Distribution supports validating signed URLs or signed cookies using key groups. -When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed -cookies for all requests that match the cache behavior. - -```ts -// Validating signed URLs or signed cookies with Trusted Key Groups - -// public key in PEM format -declare const publicKey: string; -const pubKey = new cloudfront.PublicKey(this, 'MyPubKey', { - encodedKey: publicKey, -}); - -const keyGroup = new cloudfront.KeyGroup(this, 'MyKeyGroup', { - items: [ - pubKey, - ], -}); - -new cloudfront.Distribution(this, 'Dist', { - defaultBehavior: { - origin: new origins.HttpOrigin('www.example.com'), - trustedKeyGroups: [ - keyGroup, - ], - }, -}); -``` - -### Lambda@Edge - -Lambda@Edge is an extension of AWS Lambda, a compute service that lets you execute -functions that customize the content that CloudFront delivers. You can author Node.js -or Python functions in the US East (N. Virginia) region, and then execute them in AWS -locations globally that are closer to the viewer, without provisioning or managing servers. -Lambda@Edge functions are associated with a specific behavior and event type. Lambda@Edge -can be used to rewrite URLs, alter responses based on headers or cookies, or authorize -requests based on headers or authorization tokens. - -The following shows a Lambda@Edge function added to the default behavior and triggered -on every request: - -```ts -// A Lambda@Edge function added to default behavior of a Distribution -// and triggered on every request -const myFunc = new cloudfront.experimental.EdgeFunction(this, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), -}); - -declare const myBucket: s3.Bucket; -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { - origin: new origins.S3Origin(myBucket), - edgeLambdas: [ - { - functionVersion: myFunc.currentVersion, - eventType: cloudfront.LambdaEdgeEventType.VIEWER_REQUEST, - } - ], - }, -}); -``` - -> **Note:** Lambda@Edge functions must be created in the `us-east-1` region, regardless of the region of the CloudFront distribution and stack. -> To make it easier to request functions for Lambda@Edge, the `EdgeFunction` construct can be used. -> The `EdgeFunction` construct will automatically request a function in `us-east-1`, regardless of the region of the current stack. -> `EdgeFunction` has the same interface as `Function` and can be created and used interchangeably. -> Please note that using `EdgeFunction` requires that the `us-east-1` region has been bootstrapped. -> See https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html for more about bootstrapping regions. - -If the stack is in `us-east-1`, a "normal" `lambda.Function` can be used instead of an `EdgeFunction`. - -```ts -// Using a lambda Function instead of an EdgeFunction for stacks in `us-east-`. -const myFunc = new lambda.Function(this, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), -}); -``` - -If the stack is not in `us-east-1`, and you need references from different applications on the same account, -you can also set a specific stack ID for each Lambda@Edge. - -```ts -// Setting stackIds for EdgeFunctions that can be referenced from different applications -// on the same account. -const myFunc1 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction1', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler1')), - stackId: 'edge-lambda-stack-id-1', -}); - -const myFunc2 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction2', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler2')), - stackId: 'edge-lambda-stack-id-2', -}); -``` - -Lambda@Edge functions can also be associated with additional behaviors, -either at or after Distribution creation time. - -```ts -// Associating a Lambda@Edge function with additional behaviors. - -declare const myFunc: cloudfront.experimental.EdgeFunction; -// assigning at Distribution creation -declare const myBucket: s3.Bucket; -const myOrigin = new origins.S3Origin(myBucket); -const myDistribution = new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: myOrigin }, - additionalBehaviors: { - 'images/*': { - origin: myOrigin, - edgeLambdas: [ - { - functionVersion: myFunc.currentVersion, - eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST, - includeBody: true, // Optional - defaults to false - }, - ], - }, - }, -}); - -// assigning after creation -myDistribution.addBehavior('images/*', myOrigin, { - edgeLambdas: [ - { - functionVersion: myFunc.currentVersion, - eventType: cloudfront.LambdaEdgeEventType.VIEWER_RESPONSE, - }, - ], -}); -``` - -Adding an existing Lambda@Edge function created in a different stack to a CloudFront distribution. - -```ts -// Adding an existing Lambda@Edge function created in a different stack -// to a CloudFront distribution. -declare const s3Bucket: s3.Bucket; -const functionVersion = lambda.Version.fromVersionArn(this, 'Version', 'arn:aws:lambda:us-east-1:123456789012:function:functionName:1'); - -new cloudfront.Distribution(this, 'distro', { - defaultBehavior: { - origin: new origins.S3Origin(s3Bucket), - edgeLambdas: [ - { - functionVersion, - eventType: cloudfront.LambdaEdgeEventType.VIEWER_REQUEST, - }, - ], - }, -}); -``` - -### CloudFront Function - -You can also deploy CloudFront functions and add them to a CloudFront distribution. - -```ts -// Add a cloudfront Function to a Distribution -const cfFunction = new cloudfront.Function(this, 'Function', { - code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'), -}); - -declare const s3Bucket: s3.Bucket; -new cloudfront.Distribution(this, 'distro', { - defaultBehavior: { - origin: new origins.S3Origin(s3Bucket), - functionAssociations: [{ - function: cfFunction, - eventType: cloudfront.FunctionEventType.VIEWER_REQUEST, - }], - }, -}); -``` - -It will auto-generate the name of the function and deploy it to the `live` stage. - -Additionally, you can load the function's code from a file using the `FunctionCode.fromFile()` method. - -### Logging - -You can configure CloudFront to create log files that contain detailed information about every user request that CloudFront receives. -The logs can go to either an existing bucket, or a bucket will be created for you. - -```ts -// Configure logging for Distributions - -// Simplest form - creates a new bucket and logs to it. -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, - enableLogging: true, -}); - -// You can optionally log to a specific bucket, configure whether cookies are logged, and give the log files a prefix. -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, - enableLogging: true, // Optional, this is implied if logBucket is specified - logBucket: new s3.Bucket(this, 'LogBucket'), - logFilePrefix: 'distribution-access-logs/', - logIncludesCookies: true, -}); -``` - -### HTTP Versions - -You can configure CloudFront to use a particular version of the HTTP protocol. By default, -newly created distributions use HTTP/2 but can be configured to use both HTTP/2 and HTTP/3 or -just HTTP/3. For all supported HTTP versions, see the `HttpVerson` enum. - -```ts -// Configure a distribution to use HTTP/2 and HTTP/3 -new cloudfront.Distribution(this, 'myDist', { - defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, - httpVersion: cloudfront.HttpVersion.HTTP2_AND_3, -}); -``` - -### Importing Distributions - -Existing distributions can be imported as well; note that like most imported constructs, an imported distribution cannot be modified. -However, it can be used as a reference for other higher-level constructs. - -```ts -// Using a reference to an imported Distribution -const distribution = cloudfront.Distribution.fromDistributionAttributes(this, 'ImportedDist', { - domainName: 'd111111abcdef8.cloudfront.net', - distributionId: '012345ABCDEF', -}); -``` - -### Permissions - -Use the `grant()` method to allow actions on the distribution. -`grantCreateInvalidation()` is a shorthand to allow `CreateInvalidation`. - -```ts -declare const distribution: cloudfront.Distribution; -declare const lambdaFn: lambda.Function; -distribution.grant(lambdaFn, 'cloudfront:ListInvalidations', 'cloudfront:GetInvalidation'); -distribution.grantCreateInvalidation(lambdaFn); -``` - -## Migrating from the original CloudFrontWebDistribution to the newer Distribution construct - -It's possible to migrate a distribution from the original to the modern API. -The changes necessary are the following: - -### The Distribution - -Replace `new CloudFrontWebDistribution` with `new Distribution`. Some -configuration properties have been changed: - -| Old API | New API | -|--------------------------------|------------------------------------------------------------------------------------------------| -| `originConfigs` | `defaultBehavior`; use `additionalBehaviors` if necessary | -| `viewerCertificate` | `certificate`; use `domainNames` for aliases | -| `errorConfigurations` | `errorResponses` | -| `loggingConfig` | `enableLogging`; configure with `logBucket` `logFilePrefix` and `logIncludesCookies` | -| `viewerProtocolPolicy` | removed; set on each behavior instead. default changed from `REDIRECT_TO_HTTPS` to `ALLOW_ALL` | - -After switching constructs, you need to maintain the same logical ID for the underlying [CfnDistribution](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-cloudfront.CfnDistribution.html) if you wish to avoid the deletion and recreation of your distribution. -To do this, use [escape hatches](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) to override the logical ID created by the new Distribution construct with the logical ID created by the old construct. - -Example: - -```ts -declare const sourceBucket: s3.Bucket; - -const myDistribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { - defaultBehavior: { - origin: new origins.S3Origin(sourceBucket), - }, -}); -const cfnDistribution = myDistribution.node.defaultChild as cloudfront.CfnDistribution; -cfnDistribution.overrideLogicalId('MyDistributionCFDistribution3H55TI9Q'); -``` - -### Behaviors - -The modern API makes use of the [CloudFront Origins](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins-readme.html) module to easily configure your origin. Replace your origin configuration with the relevant CloudFront Origins class. For example, here's a behavior with an S3 origin: - -```ts -declare const sourceBucket: s3.Bucket; -declare const oai: cloudfront.OriginAccessIdentity; - -new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - originAccessIdentity: oai, - }, - behaviors : [ {isDefaultBehavior: true}], - }, - ], -}); -``` - -Becomes: - -```ts -declare const sourceBucket: s3.Bucket; - -const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { - defaultBehavior: { - origin: new origins.S3Origin(sourceBucket) // This class automatically creates an Origin Access Identity - }, -}); -``` - -In the original API all behaviors are defined in the `originConfigs` property. The new API is optimized for a single origin and behavior, so the default behavior and additional behaviors will be defined separately. - -```ts -declare const sourceBucket: s3.Bucket; -declare const oai: cloudfront.OriginAccessIdentity; - -new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - originAccessIdentity: oai, - }, - behaviors: [ {isDefaultBehavior: true}], - }, - { - customOriginSource: { - domainName: 'MYALIAS', - }, - behaviors: [{ pathPattern: '/somewhere' }] - } - ], -}); -``` - -Becomes: - -```ts -declare const sourceBucket: s3.Bucket; - -const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { - defaultBehavior: { - origin: new origins.S3Origin(sourceBucket) // This class automatically creates an Origin Access Identity - }, - additionalBehaviors: { - '/somewhere': { - origin: new origins.HttpOrigin('MYALIAS'), - } - } -}); -``` - -### Certificates - -If you are using an ACM certificate, you can pass the certificate directly to the `certificate` prop. -Any aliases used before in the `ViewerCertificate` class should be passed in to the `domainNames` prop in the modern API. - -```ts -import * as acm from '@aws-cdk/aws-certificatemanager'; -declare const certificate: acm.Certificate; -declare const sourceBucket: s3.Bucket; - -const viewerCertificate = cloudfront.ViewerCertificate.fromAcmCertificate(certificate, { - aliases: ['MYALIAS'], -}); - -new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - }, - behaviors : [ {isDefaultBehavior: true} ], - }, - ], - viewerCertificate: viewerCertificate, -}); -``` - -Becomes: - -```ts -import * as acm from '@aws-cdk/aws-certificatemanager'; -declare const certificate: acm.Certificate; -declare const sourceBucket: s3.Bucket; - -const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { - defaultBehavior: { - origin: new origins.S3Origin(sourceBucket), - }, - domainNames: ['MYALIAS'], - certificate: certificate, -}); -``` - -IAM certificates aren't directly supported by the new API, but can be easily configured through [escape hatches](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) - -```ts -declare const sourceBucket: s3.Bucket; -const viewerCertificate = cloudfront.ViewerCertificate.fromIamCertificate('MYIAMROLEIDENTIFIER', { - aliases: ['MYALIAS'], -}); - -new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - }, - behaviors : [ {isDefaultBehavior: true} ], - }, - ], - viewerCertificate: viewerCertificate, -}); -``` - -Becomes: - -```ts -declare const sourceBucket: s3.Bucket; -const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { - defaultBehavior: { - origin: new origins.S3Origin(sourceBucket), - }, - domainNames: ['MYALIAS'], -}); - -const cfnDistribution = distribution.node.defaultChild as cloudfront.CfnDistribution; - -cfnDistribution.addPropertyOverride('ViewerCertificate.IamCertificateId', 'MYIAMROLEIDENTIFIER'); -cfnDistribution.addPropertyOverride('ViewerCertificate.SslSupportMethod', 'sni-only'); -``` - -### Other changes - -A number of default settings have changed on the new API when creating a new distribution, behavior, and origin. -After making the major changes needed for the migration, run `cdk diff` to see what settings have changed. -If no changes are desired during migration, you will at the least be able to use [escape hatches](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) to override what the CDK synthesizes, if you can't change the properties directly. - -## CloudFrontWebDistribution API - -> The `CloudFrontWebDistribution` construct is the original construct written for working with CloudFront distributions. -> Users are encouraged to use the newer `Distribution` instead, as it has a simpler interface and receives new features faster. - -Example usage: - -```ts -// Using a CloudFrontWebDistribution construct. - -declare const sourceBucket: s3.Bucket; -const distribution = new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - }, - behaviors : [ {isDefaultBehavior: true}], - }, - ], -}); -``` - -### Viewer certificate - -By default, CloudFront Web Distributions will answer HTTPS requests with CloudFront's default certificate, -only containing the distribution `domainName` (e.g. d111111abcdef8.cloudfront.net). -You can customize the viewer certificate property to provide a custom certificate and/or list of domain name aliases to fit your needs. - -See [Using Alternate Domain Names and HTTPS](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https-alternate-domain-names.html) in the CloudFront User Guide. - -#### Default certificate - -You can customize the default certificate aliases. This is intended to be used in combination with CNAME records in your DNS zone. - -Example: - -[create a distribution with an default certificate example](test/example.default-cert-alias.lit.ts) - -#### ACM certificate - -You can change the default certificate by one stored AWS Certificate Manager, or ACM. -Those certificate can either be generated by AWS, or purchased by another CA imported into ACM. - -For more information, see -[the aws-certificatemanager module documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-certificatemanager-readme.html) -or [Importing Certificates into AWS Certificate Manager](https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html) -in the AWS Certificate Manager User Guide. - -Example: - -[create a distribution with an acm certificate example](test/example.acm-cert-alias.lit.ts) - -#### IAM certificate - -You can also import a certificate into the IAM certificate store. - -See [Importing an SSL/TLS Certificate](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cnames-and-https-procedures.html#cnames-and-https-uploading-certificates) in the CloudFront User Guide. - -Example: - -[create a distribution with an iam certificate example](test/example.iam-cert-alias.lit.ts) - -### Trusted Key Groups - -CloudFront Web Distributions supports validating signed URLs or signed cookies using key groups. -When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. - -Example: - -```ts -// Using trusted key groups for Cloudfront Web Distributions. -declare const sourceBucket: s3.Bucket; -declare const publicKey: string; -const pubKey = new cloudfront.PublicKey(this, 'MyPubKey', { - encodedKey: publicKey, -}); - -const keyGroup = new cloudfront.KeyGroup(this, 'MyKeyGroup', { - items: [ - pubKey, - ], -}); - -new cloudfront.CloudFrontWebDistribution(this, 'AnAmazingWebsiteProbably', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - }, - behaviors: [ - { - isDefaultBehavior: true, - trustedKeyGroups: [ - keyGroup, - ], - }, - ], - }, - ], -}); -``` - -### Restrictions - -CloudFront supports adding restrictions to your distribution. - -See [Restricting the Geographic Distribution of Your Content](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/georestrictions.html) in the CloudFront User Guide. - -Example: - -```ts -// Adding restrictions to a Cloudfront Web Distribution. -declare const sourceBucket: s3.Bucket; -new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - }, - behaviors : [ {isDefaultBehavior: true}], - }, - ], - geoRestriction: cloudfront.GeoRestriction.allowlist('US', 'GB'), -}); -``` - -### Connection behaviors between CloudFront and your origin - -CloudFront provides you even more control over the connection behaviors between CloudFront and your origin. -You can now configure the number of connection attempts CloudFront will make to your origin and the origin connection timeout for each attempt. - -See [Origin Connection Attempts](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-attempts) - -See [Origin Connection Timeout](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-timeout) - -Example usage: - -```ts -// Configuring connection behaviors between Cloudfront and your origin -const distribution = new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', { - originConfigs: [ - { - connectionAttempts: 3, - connectionTimeout: Duration.seconds(10), - behaviors: [ - { - isDefaultBehavior: true, - }, - ], - }, - ], -}); -``` - -#### Origin Fallback - -In case the origin source is not available and answers with one of the -specified status codes the failover origin source will be used. - -```ts -// Configuring origin fallback options for the CloudFrontWebDistribution -new cloudfront.CloudFrontWebDistribution(this, 'ADistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucket', 'myoriginbucket'), - originPath: '/', - originHeaders: { - 'myHeader': '42', - }, - originShieldRegion: 'us-west-2', - }, - failoverS3OriginSource: { - s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucketFallback', 'myoriginbucketfallback'), - originPath: '/somewhere', - originHeaders: { - 'myHeader2': '21', - }, - originShieldRegion: 'us-east-1', - }, - failoverCriteriaStatusCodes: [cloudfront.FailoverStatusCode.INTERNAL_SERVER_ERROR], - behaviors: [ - { - isDefaultBehavior: true, - }, - ], - }, - ], -}); -``` - -## KeyGroup & PublicKey API - -You can create a key group to use with CloudFront signed URLs and signed cookies -You can add public keys to use with CloudFront features such as signed URLs, signed cookies, and field-level encryption. - -The following example command uses OpenSSL to generate an RSA key pair with a length of 2048 bits and save to the file named `private_key.pem`. - -```bash -openssl genrsa -out private_key.pem 2048 -``` - -The resulting file contains both the public and the private key. The following example command extracts the public key from the file named `private_key.pem` and stores it in `public_key.pem`. - -```bash -openssl rsa -pubout -in private_key.pem -out public_key.pem -``` - -Note: Don't forget to copy/paste the contents of `public_key.pem` file including `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----` lines into `encodedKey` parameter when creating a `PublicKey`. - -Example: - -```ts -// Create a key group to use with CloudFront signed URLs and signed cookies. -new cloudfront.KeyGroup(this, 'MyKeyGroup', { - items: [ - new cloudfront.PublicKey(this, 'MyPublicKey', { - encodedKey: '...', // contents of public_key.pem file - // comment: 'Key is expiring on ...', - }), - ], - // comment: 'Key group containing public keys ...', -}); -``` - -See: - -* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html -* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html diff --git a/packages/@aws-cdk/aws-cloudfront/jest.config.js b/packages/@aws-cdk/aws-cloudfront/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/function.ts b/packages/@aws-cdk/aws-cloudfront/lib/function.ts deleted file mode 100644 index 9a99815882fdd..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/lib/function.ts +++ /dev/null @@ -1,215 +0,0 @@ -import * as fs from 'fs'; -import { IResource, Names, Resource, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnFunction } from './cloudfront.generated'; - -/** - * Represents the function's source code - */ -export abstract class FunctionCode { - - /** - * Inline code for function - * @returns code object with inline code. - * @param code The actual function code - */ - public static fromInline(code: string): FunctionCode { - return new InlineCode(code); - } - - /** - * Code from external file for function - * @returns code object with contents from file. - * @param options the options for the external file - */ - public static fromFile(options: FileCodeOptions): FunctionCode { - return new FileCode(options); - } - - /** - * renders the function code - */ - public abstract render(): string; -} - -/** - * Options when reading the function's code from an external file - */ -export interface FileCodeOptions { - /** - * The path of the file to read the code from - */ - readonly filePath: string; -} - -/** - * Represents the function's source code as inline code - */ -class InlineCode extends FunctionCode { - - constructor(private code: string) { - super(); - } - - public render(): string { - return this.code; - } -} - - -/** - * Represents the function's source code loaded from an external file - */ -class FileCode extends FunctionCode { - - constructor(private options: FileCodeOptions) { - super(); - } - - public render(): string { - return fs.readFileSync(this.options.filePath, { encoding: 'utf-8' }); - } -} - -/** - * Represents a CloudFront Function - */ -export interface IFunction extends IResource { - /** - * The name of the function. - * @attribute - */ - readonly functionName: string; - - /** - * The ARN of the function. - * @attribute - */ - readonly functionArn: string; -} - -/** - * Attributes of an existing CloudFront Function to import it - */ -export interface FunctionAttributes { - /** - * The name of the function. - */ - readonly functionName: string; - - /** - * The ARN of the function. - */ - readonly functionArn: string; -} - -/** - * Properties for creating a CloudFront Function - */ -export interface FunctionProps { - /** - * A name to identify the function. - * @default - generated from the `id` - */ - readonly functionName?: string; - - /** - * A comment to describe the function. - * @default - same as `functionName` - */ - readonly comment?: string; - - /** - * The source code of the function. - */ - readonly code: FunctionCode; -} - -/** - * A CloudFront Function - * - * @resource AWS::CloudFront::Function - */ -export class Function extends Resource implements IFunction { - - /** Imports a function by its name and ARN */ - public static fromFunctionAttributes(scope: Construct, id: string, attrs: FunctionAttributes): IFunction { - return new class extends Resource implements IFunction { - public readonly functionName = attrs.functionName; - public readonly functionArn = attrs.functionArn; - }(scope, id); - } - - /** - * the name of the CloudFront function - * @attribute - */ - public readonly functionName: string; - /** - * the ARN of the CloudFront function - * @attribute - */ - public readonly functionArn: string; - /** - * the deployment stage of the CloudFront function - * @attribute - */ - public readonly functionStage: string; - - constructor(scope: Construct, id: string, props: FunctionProps) { - super(scope, id); - - this.functionName = props.functionName ?? this.generateName(); - - const resource = new CfnFunction(this, 'Resource', { - autoPublish: true, - functionCode: props.code.render(), - functionConfig: { - comment: props.comment ?? this.functionName, - runtime: 'cloudfront-js-1.0', - }, - name: this.functionName, - }); - - this.functionArn = resource.attrFunctionArn; - this.functionStage = resource.attrStage; - } - - private generateName(): string { - const name = Stack.of(this).region + Names.uniqueId(this); - if (name.length > 64) { - return name.substring(0, 32) + name.substring(name.length - 32); - } - return name; - } -} - -/** - * The type of events that a CloudFront function can be invoked in response to. - */ -export enum FunctionEventType { - - /** - * The viewer-request specifies the incoming request - */ - VIEWER_REQUEST = 'viewer-request', - - /** - * The viewer-response specifies the outgoing response - */ - VIEWER_RESPONSE = 'viewer-response', -} - -/** - * Represents a CloudFront function and event type when using CF Functions. - * The type of the `AddBehaviorOptions.functionAssociations` property. - */ -export interface FunctionAssociation { - /** - * The CloudFront function that will be invoked. - */ - readonly function: IFunction; - - /** The type of event which should invoke the function. */ - readonly eventType: FunctionEventType; -} diff --git a/packages/@aws-cdk/aws-cloudfront/lib/private/utils.ts b/packages/@aws-cdk/aws-cloudfront/lib/private/utils.ts deleted file mode 100644 index 256e161181193..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/lib/private/utils.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Stack } from '@aws-cdk/core'; -import { IDistribution } from '..'; - -/** - * Format distribution ARN from stack and distribution ID. - */ -export function formatDistributionArn(dist: IDistribution) { - return Stack.of(dist).formatArn({ - service: 'cloudfront', - region: '', - resource: 'distribution', - resourceName: dist.distributionId, - }); -} diff --git a/packages/@aws-cdk/aws-cloudfront/package.json b/packages/@aws-cdk/aws-cloudfront/package.json deleted file mode 100644 index 07562a41b9e53..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/package.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "name": "@aws-cdk/aws-cloudfront", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CloudFront", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cloudfront", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cloudfront" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CloudFront", - "packageId": "Amazon.CDK.AWS.CloudFront", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cloudfront", - "module": "aws_cdk.aws_cloudfront", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cloudfront" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CloudFront", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudfront" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-cloudfront.Distribution", - "props-physical-name:@aws-cdk/aws-cloudfront.DistributionProps", - "props-physical-name:@aws-cdk/aws-cloudfront.CloudFrontWebDistribution", - "props-physical-name:@aws-cdk/aws-cloudfront.CloudFrontWebDistributionProps", - "props-physical-name:@aws-cdk/aws-cloudfront.OriginAccessIdentityProps", - "docs-public-apis:@aws-cdk/aws-cloudfront.ViewerProtocolPolicy.ALLOW_ALL", - "docs-public-apis:@aws-cdk/aws-cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS", - "props-default-doc:@aws-cdk/aws-cloudfront.Behavior.isDefaultBehavior", - "props-default-doc:@aws-cdk/aws-cloudfront.Behavior.minTtl", - "props-default-doc:@aws-cdk/aws-cloudfront.Behavior.pathPattern", - "props-default-doc:@aws-cdk/aws-cloudfront.Behavior.trustedSigners", - "docs-public-apis:@aws-cdk/aws-cloudfront.CloudFrontWebDistributionProps", - "docs-public-apis:@aws-cdk/aws-cloudfront.LambdaFunctionAssociation", - "props-default-doc:@aws-cdk/aws-cloudfront.SourceConfiguration.customOriginSource", - "props-default-doc:@aws-cdk/aws-cloudfront.SourceConfiguration.s3OriginSource", - "docs-public-apis:@aws-cdk/aws-cloudfront.CloudFrontAllowedCachedMethods.GET_HEAD", - "docs-public-apis:@aws-cdk/aws-cloudfront.CloudFrontAllowedCachedMethods.GET_HEAD_OPTIONS", - "docs-public-apis:@aws-cdk/aws-cloudfront.CloudFrontAllowedMethods.GET_HEAD", - "docs-public-apis:@aws-cdk/aws-cloudfront.CloudFrontAllowedMethods.GET_HEAD_OPTIONS", - "docs-public-apis:@aws-cdk/aws-cloudfront.CloudFrontAllowedMethods.ALL", - "docs-public-apis:@aws-cdk/aws-cloudfront.OriginSslPolicy", - "docs-public-apis:@aws-cdk/aws-cloudfront.OriginSslPolicy.SSL_V3", - "docs-public-apis:@aws-cdk/aws-cloudfront.OriginSslPolicy.TLS_V1", - "docs-public-apis:@aws-cdk/aws-cloudfront.OriginSslPolicy.TLS_V1_1", - "docs-public-apis:@aws-cdk/aws-cloudfront.OriginSslPolicy.TLS_V1_2", - "docs-public-apis:@aws-cdk/aws-cloudfront.SSLMethod.SNI", - "docs-public-apis:@aws-cdk/aws-cloudfront.SSLMethod.VIP", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.SSL_V3", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.TLS_V1", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.TLS_V1_2016", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.TLS_V1_1_2016", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.TLS_V1_2_2018", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.TLS_V1_2_2019", - "docs-public-apis:@aws-cdk/aws-cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021", - "docs-public-apis:@aws-cdk/aws-cloudfront.ViewerCertificate.aliases", - "docs-public-apis:@aws-cdk/aws-cloudfront.ViewerCertificate.props", - "docs-public-apis:@aws-cdk/aws-cloudfront.ViewerCertificateOptions", - "props-default-doc:@aws-cdk/aws-cloudfront.ViewerCertificateOptions.aliases", - "construct-interface-extends-iconstruct:@aws-cdk/aws-cloudfront.ICachePolicy", - "resource-interface-extends-resource:@aws-cdk/aws-cloudfront.ICachePolicy", - "resource-attribute:@aws-cdk/aws-cloudfront.CachePolicy.cachePolicyLastModifiedTime", - "construct-interface-extends-iconstruct:@aws-cdk/aws-cloudfront.IOriginRequestPolicy", - "resource-interface-extends-resource:@aws-cdk/aws-cloudfront.IOriginRequestPolicy", - "resource-attribute:@aws-cdk/aws-cloudfront.OriginRequestPolicy.originRequestPolicyLastModifiedTime", - "resource-attribute:@aws-cdk/aws-cloudfront.KeyGroup.keyGroupLastModifiedTime", - "resource-attribute:@aws-cdk/aws-cloudfront.PublicKey.publicKeyCreatedTime", - "resource-attribute:@aws-cdk/aws-cloudfront.OriginAccessIdentity.cloudFrontOriginAccessIdentityId", - "resource-attribute:@aws-cdk/aws-cloudfront.Function.functionMetadataFunctionArn", - "construct-interface-extends-iconstruct:@aws-cdk/aws-cloudfront.IResponseHeadersPolicy", - "resource-interface-extends-resource:@aws-cdk/aws-cloudfront.IResponseHeadersPolicy", - "resource-attribute:@aws-cdk/aws-cloudfront.ResponseHeadersPolicy.responseHeadersPolicyLastModifiedTime" - ] - }, - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-cloudfront/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cloudfront/rosetta/default.ts-fixture deleted file mode 100644 index 1ac8c7fec5da3..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/rosetta/default.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as origins from '@aws-cdk/aws-cloudfront-origins'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as path from 'path'; - -class Context extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-cloudfront/test/function.test.ts b/packages/@aws-cdk/aws-cloudfront/test/function.test.ts deleted file mode 100644 index 12e3d1d525433..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/test/function.test.ts +++ /dev/null @@ -1,135 +0,0 @@ -import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { App, Stack } from '@aws-cdk/core'; -import { Function, FunctionCode } from '../lib'; - -describe('CloudFront Function', () => { - - test('minimal example', () => { - const app = new App(); - const stack = new Stack(app, 'Stack', { - env: { account: '123456789012', region: 'testregion' }, - }); - new Function(stack, 'CF2', { - code: FunctionCode.fromInline('code'), - }); - - Template.fromStack(stack).templateMatches({ - Resources: { - CF2D7241DD7: { - Type: 'AWS::CloudFront::Function', - Properties: { - Name: 'testregionStackCF2CE3F783F', - AutoPublish: true, - FunctionCode: 'code', - FunctionConfig: { - Comment: 'testregionStackCF2CE3F783F', - Runtime: 'cloudfront-js-1.0', - }, - }, - }, - }, - }); - }); - - test('minimal example in environment agnostic stack', () => { - const app = new App(); - const stack = new Stack(app, 'Stack'); - new Function(stack, 'CF2', { - code: FunctionCode.fromInline('code'), - }); - - Template.fromStack(stack).templateMatches({ - Resources: { - CF2D7241DD7: { - Type: 'AWS::CloudFront::Function', - Properties: { - Name: { - 'Fn::Join': [ - '', - [ - { - Ref: 'AWS::Region', - }, - 'StackCF2CE3F783F', - ], - ], - }, - AutoPublish: true, - FunctionCode: 'code', - FunctionConfig: { - Comment: { - 'Fn::Join': [ - '', - [ - { - Ref: 'AWS::Region', - }, - 'StackCF2CE3F783F', - ], - ], - }, - Runtime: 'cloudfront-js-1.0', - }, - }, - }, - }, - }); - }); - - test('maximum example', () => { - const app = new App(); - const stack = new Stack(app, 'Stack', { - env: { account: '123456789012', region: 'testregion' }, - }); - new Function(stack, 'CF2', { - code: FunctionCode.fromInline('code'), - comment: 'My super comment', - functionName: 'FunctionName', - }); - - Template.fromStack(stack).templateMatches({ - Resources: { - CF2D7241DD7: { - Type: 'AWS::CloudFront::Function', - Properties: { - Name: 'FunctionName', - AutoPublish: true, - FunctionCode: 'code', - FunctionConfig: { - Comment: 'My super comment', - Runtime: 'cloudfront-js-1.0', - }, - }, - }, - }, - }); - }); - - test('code from external file', () => { - const app = new App(); - const stack = new Stack(app, 'Stack', { - env: { account: '123456789012', region: 'testregion' }, - }); - new Function(stack, 'CF2', { - code: FunctionCode.fromFile({ filePath: path.join(__dirname, 'function-code.js') }), - }); - - Template.fromStack(stack).templateMatches({ - Resources: { - CF2D7241DD7: { - Type: 'AWS::CloudFront::Function', - Properties: { - Name: 'testregionStackCF2CE3F783F', - AutoPublish: true, - FunctionCode: 'function handler(event) {\n return event.request;\n}', - FunctionConfig: { - Comment: 'testregionStackCF2CE3F783F', - Runtime: 'cloudfront-js-1.0', - }, - }, - }, - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.ts b/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.ts deleted file mode 100644 index b3237dc2c9e08..0000000000000 --- a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-origin-shield.ts +++ /dev/null @@ -1,21 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { TestOrigin } from './test-origin'; -import * as cloudfront from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-distribution-origin-shield'); - -new cloudfront.Distribution(stack, 'Dist', { - defaultBehavior: { - origin: new TestOrigin('www.example.com', { - originShieldEnabled: false, - }), - }, -}); - -new IntegTest(app, 'DistributionOriginShield', { - testCases: [stack], -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/.eslintrc.js b/packages/@aws-cdk/aws-cloudtrail/.eslintrc.js deleted file mode 100644 index 92484d9f02ab4..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; - diff --git a/packages/@aws-cdk/aws-cloudtrail/.gitignore b/packages/@aws-cdk/aws-cloudtrail/.gitignore deleted file mode 100644 index 9e72a27e3281d..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -!jest.config.js -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cloudtrail/.npmignore b/packages/@aws-cdk/aws-cloudtrail/.npmignore deleted file mode 100644 index beca996b54f36..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -jest.config.js -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cloudtrail/LICENSE b/packages/@aws-cdk/aws-cloudtrail/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cloudtrail/NOTICE b/packages/@aws-cdk/aws-cloudtrail/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cloudtrail/README.md b/packages/@aws-cdk/aws-cloudtrail/README.md deleted file mode 100644 index 26050e56a817d..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/README.md +++ /dev/null @@ -1,213 +0,0 @@ -# AWS CloudTrail Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -## Trail - -AWS CloudTrail enables governance, compliance, and operational and risk auditing of your AWS account. Actions taken by -a user, role, or an AWS service are recorded as events in CloudTrail. Learn more at the [CloudTrail -documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html). - -The `Trail` construct enables ongoing delivery of events as log files to an Amazon S3 bucket. Learn more about [Creating -a Trail for Your AWS Account](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html). -The following code creates a simple CloudTrail for your account - - -```ts -const trail = new cloudtrail.Trail(this, 'CloudTrail'); -``` - -By default, this will create a new S3 Bucket that CloudTrail will write to, and choose a few other reasonable defaults -such as turning on multi-region and global service events. -The defaults for each property and how to override them are all documented on the `TrailProps` interface. - -## Log File Validation - -In order to validate that the CloudTrail log file was not modified after CloudTrail delivered it, CloudTrail provides a -digital signature for each file. Learn more at [Validating CloudTrail Log File -Integrity](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-log-file-validation-intro.html). - -This is enabled on the `Trail` construct by default, but can be turned off by setting `enableFileValidation` to `false`. - -```ts -const trail = new cloudtrail.Trail(this, 'CloudTrail', { - enableFileValidation: false, -}); -``` - -## Notifications - -Amazon SNS notifications can be configured upon new log files containing Trail events are delivered to S3. -Learn more at [Configuring Amazon SNS Notifications for -CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/configure-sns-notifications-for-cloudtrail.html). -The following code configures an SNS topic to be notified - - -```ts -const topic = new sns.Topic(this, 'TrailTopic'); -const trail = new cloudtrail.Trail(this, 'CloudTrail', { - snsTopic: topic, -}); -``` - -## Service Integrations - -Besides sending trail events to S3, they can also be configured to notify other AWS services - - -### Amazon CloudWatch Logs - -CloudTrail events can be delivered to a CloudWatch Logs LogGroup. By default, a new LogGroup is created with a -default retention setting. The following code enables sending CloudWatch logs but specifies a particular retention -period for the created Log Group. - -```ts -import * as logs from '@aws-cdk/aws-logs'; - -const trail = new cloudtrail.Trail(this, 'CloudTrail', { - sendToCloudWatchLogs: true, - cloudWatchLogsRetention: logs.RetentionDays.FOUR_MONTHS, -}); -``` - -If you would like to use a specific log group instead, this can be configured via `cloudwatchLogGroup`. - -### Amazon EventBridge - -Amazon EventBridge rules can be configured to be triggered when CloudTrail events occur using the `Trail.onEvent()` API. -Using APIs available in `aws-events`, these events can be filtered to match to those that are of interest, either from -a specific service, account or time range. See [Events delivered via -CloudTrail](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#events-for-services-not-listed) -to learn more about the event structure for events from CloudTrail. - -The following code filters events for S3 from a specific AWS account and triggers a lambda function. - -```ts -const myFunctionHandler = new lambda.Function(this, 'MyFunction', { - code: lambda.Code.fromAsset('resource/myfunction'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', -}); - -const eventRule = cloudtrail.Trail.onEvent(this, 'MyCloudWatchEvent', { - target: new targets.LambdaFunction(myFunctionHandler), -}); - -eventRule.addEventPattern({ - account: ['123456789012'], - source: ['aws.s3'], -}); -``` - -## Multi-Region & Global Service Events - -By default, a `Trail` is configured to deliver log files from multiple regions to a single S3 bucket for a given -account. This creates shadow trails (replication of the trails) in all of the other regions. Learn more about [How -CloudTrail Behaves Regionally](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-regional-and-global-services) -and about the [`IsMultiRegion` -property](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-ismultiregiontrail). - -For most services, events are recorded in the region where the action occurred. For global services such as AWS IAM, -AWS STS, Amazon CloudFront, Route 53, etc., events are delivered to any trail that includes global services. Learn more -[About Global Service Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-global-service-events). - -Events for global services are turned on by default for `Trail` constructs in the CDK. - -The following code disables multi-region trail delivery and trail delivery for global services for a specific `Trail` - - -```ts -const trail = new cloudtrail.Trail(this, 'CloudTrail', { - // ... - isMultiRegionTrail: false, - includeGlobalServiceEvents: false, -}); -``` - -## Events Types - -**Management events** provide information about management operations that are performed on resources in your AWS -account. These are also known as control plane operations. Learn more about [Management -Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-events). - -By default, a `Trail` logs all management events. However, they can be configured to either be turned off, or to only -log 'Read' or 'Write' events. - -The following code configures the `Trail` to only track management events that are of type 'Read'. - -```ts -const trail = new cloudtrail.Trail(this, 'CloudTrail', { - // ... - managementEvents: cloudtrail.ReadWriteType.READ_ONLY, -}); -``` - -**Data events** provide information about the resource operations performed on or in a resource. These are also known -as data plane operations. Learn more about [Data -Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-events). -By default, no data events are logged for a `Trail`. - -AWS CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda functions. - -The `logAllS3DataEvents()` API configures the trail to log all S3 data events while the `addS3EventSelector()` API can -be used to configure logging of S3 data events for specific buckets and specific object prefix. The following code -configures logging of S3 data events for `fooBucket` and with object prefix `bar/`. - -```ts -import * as s3 from '@aws-cdk/aws-s3'; - -const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail'); -declare const bucket: s3.Bucket; - -// Adds an event selector to the bucket foo -trail.addS3EventSelector([{ - bucket, - objectPrefix: 'bar/', -}]); -``` - -Similarly, the `logAllLambdaDataEvents()` configures the trail to log all Lambda data events while the -`addLambdaEventSelector()` API can be used to configure logging for specific Lambda functions. The following code -configures logging of Lambda data events for a specific Function. - -```ts -const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail'); -const amazingFunction = new lambda.Function(this, 'AnAmazingFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: "hello.handler", - code: lambda.Code.fromAsset("lambda"), -}); - -// Add an event selector to log data events for the provided Lambda functions. -trail.addLambdaEventSelector([ amazingFunction ]); -``` - -## Organization Trail - -It is possible to create a trail that will be applied to all accounts in an organization if the current account manages an organization. -To enable this, the property `isOrganizationTrail` must be set. If this property is set and the current account does not manage an organization, the stack will fail to deploy. - -```ts -new cloudtrail.Trail(this, 'OrganizationTrail', { - isOrganizationTrail: true, -}); -``` - -## CloudTrail Insights - -Set `InsightSelector` to enable Insight. -Insights selector values can be `ApiCallRateInsight`, `ApiErrorRateInsight`, or both. - -```ts -new Trail(stack, 'Insights', { - insightTypes: [ - InsightType.API_CALL_RATE, - InsightType.API_ERROR_RATE, - ], -}); -``` diff --git a/packages/@aws-cdk/aws-cloudtrail/jest.config.js b/packages/@aws-cdk/aws-cloudtrail/jest.config.js deleted file mode 100644 index da69fabe154d9..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 75, - statements: 80, - } - } -}; diff --git a/packages/@aws-cdk/aws-cloudtrail/package.json b/packages/@aws-cdk/aws-cloudtrail/package.json deleted file mode 100644 index 768f1b9ff5dc4..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/package.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "name": "@aws-cdk/aws-cloudtrail", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CloudTrail", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cloudtrail", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cloudtrail" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CloudTrail", - "packageId": "Amazon.CDK.AWS.CloudTrail", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cloudtrail", - "module": "aws_cdk.aws_cloudtrail", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cloudtrail" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "integ": "integ-runner", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CloudTrail", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudtrail" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "awslint": { - "exclude": [ - "events-method-signature:@aws-cdk/aws-cloudtrail.Trail.onEvent", - "docs-public-apis:@aws-cdk/aws-cloudtrail.InsightType.value" - ] - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-cloudtrail/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cloudtrail/rosetta/default.ts-fixture deleted file mode 100644 index b6440cd045f44..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as cloudtrail from '@aws-cdk/aws-cloudtrail'; -import * as sns from '@aws-cdk/aws-sns'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as targets from '@aws-cdk/aws-events-targets'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.ts b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.ts deleted file mode 100644 index 585805fd7eef9..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-data-events-only.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as cloudtrail from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-cloudtrail-data-events'); - -const bucket = new s3.Bucket(stack, 'Bucket', { removalPolicy: cdk.RemovalPolicy.DESTROY }); -const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { - runtime: lambda.Runtime.NODEJS_18_X, - handler: 'hello.handler', - code: lambda.Code.fromInline('exports.handler = {}'), -}); - -const trail = new cloudtrail.Trail(stack, 'Trail', { - managementEvents: cloudtrail.ReadWriteType.NONE, -}); -trail.addLambdaEventSelector([lambdaFunction]); -trail.addS3EventSelector([{ bucket }]); - -new integ.IntegTest(app, 'CloudTrailDataEventsOnlyTest', { - testCases: [stack], -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.ts b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.ts deleted file mode 100644 index 5691c09704526..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-defaults.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as cloudtrail from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-cloudtrail-defaults'); - -new cloudtrail.Trail(stack, 'Trail'); - -new integ.IntegTest(app, 'CloudTrailDefaultsTest', { - testCases: [stack], -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts deleted file mode 100644 index 1e399351646d1..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; - -import * as cloudtrail from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-cloudtrail'); - -const bucket = new s3.Bucket(stack, 'Bucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - autoDeleteObjects: true, -}); -const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'hello.handler', - code: lambda.Code.fromInline('exports.handler = {}'), -}); - -// using exctecy the same code as inside the cloudtrail class to produce the supplied bucket and policy -const cloudTrailPrincipal = new iam.ServicePrincipal('cloudtrail.amazonaws.com'); - -const Trailbucket = new s3.Bucket(stack, 'S3', { - encryption: s3.BucketEncryption.UNENCRYPTED, - removalPolicy: cdk.RemovalPolicy.DESTROY, - autoDeleteObjects: true, -}); - -Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ - resources: [Trailbucket.bucketArn], - actions: ['s3:GetBucketAcl'], - principals: [cloudTrailPrincipal], -})); - -Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ - resources: [Trailbucket.arnForObjects(`AWSLogs/${cdk.Stack.of(stack).account}/*`)], - actions: ['s3:PutObject'], - principals: [cloudTrailPrincipal], - conditions: { - StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' }, - }, -})); - -const trail = new cloudtrail.Trail(stack, 'Trail', { bucket: Trailbucket }); - -trail.addLambdaEventSelector([lambdaFunction]); -trail.addS3EventSelector([{ bucket }]); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts deleted file mode 100644 index 3554dc94d4617..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.ts b/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.ts deleted file mode 100644 index 8280f7f797a44..0000000000000 --- a/packages/@aws-cdk/aws-cloudtrail/test/integ.cloudtrail.lit.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as cloudtrail from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-cloudtrail'); - -const bucket = new s3.Bucket(stack, 'Bucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - autoDeleteObjects: true, -}); -const topic = new sns.Topic(stack, 'Topic'); -const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'hello.handler', - code: lambda.Code.fromInline('exports.handler = {}'), -}); - -const trail = new cloudtrail.Trail(stack, 'Trail', { - snsTopic: topic, -}); -trail.addLambdaEventSelector([lambdaFunction]); -trail.addS3EventSelector([{ bucket }]); - -app.synth(); diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/.eslintrc.js b/packages/@aws-cdk/aws-cloudwatch-actions/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/.gitignore b/packages/@aws-cdk/aws-cloudwatch-actions/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/.npmignore b/packages/@aws-cdk/aws-cloudwatch-actions/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/LICENSE b/packages/@aws-cdk/aws-cloudwatch-actions/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/NOTICE b/packages/@aws-cdk/aws-cloudwatch-actions/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/README.md b/packages/@aws-cdk/aws-cloudwatch-actions/README.md deleted file mode 100644 index 1b75954652f89..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# CloudWatch Alarm Actions library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library contains a set of classes which can be used as CloudWatch Alarm actions. - -The currently implemented actions are: EC2 Actions, SNS Actions, SSM OpsCenter Actions, Autoscaling Actions and Application Autoscaling Actions - - -## EC2 Action Example - -```ts -// Alarm must be configured with an EC2 per-instance metric -declare const alarm: cloudwatch.Alarm; -// Attach a reboot when alarm triggers -alarm.addAlarmAction( - new actions.Ec2Action(actions.Ec2InstanceAction.REBOOT), -); -``` - -## SSM OpsCenter Action Example - -```ts -declare const alarm: cloudwatch.Alarm; -// Create an OpsItem with specific severity and category when alarm triggers -alarm.addAlarmAction( - new actions.SsmAction( - actions.OpsItemSeverity.CRITICAL, - actions.OpsItemCategory.PERFORMANCE // category is optional - ) -); -``` - -## SSM Incident Manager Action Example - -```ts -declare const alarm: cloudwatch.Alarm; -// Create an Incident Manager incident based on a specific response plan -alarm.addAlarmAction( - new actions.SsmIncidentAction('ResponsePlanName') -); -``` - -See `@aws-cdk/aws-cloudwatch` for more information. diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/jest.config.js b/packages/@aws-cdk/aws-cloudwatch-actions/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/lib/sns.ts b/packages/@aws-cdk/aws-cloudwatch-actions/lib/sns.ts deleted file mode 100644 index a7c11f9dba918..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/lib/sns.ts +++ /dev/null @@ -1,18 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as sns from '@aws-cdk/aws-sns'; -import { Construct } from 'constructs'; - -/** - * Use an SNS topic as an alarm action - */ -export class SnsAction implements cloudwatch.IAlarmAction { - constructor(private readonly topic: sns.ITopic) { - } - - /** - * Returns an alarm action configuration to use an SNS topic as an alarm action - */ - public bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { - return { alarmActionArn: this.topic.topicArn }; - } -} diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/package.json b/packages/@aws-cdk/aws-cloudwatch-actions/package.json deleted file mode 100644 index 7ccb4048ed419..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "@aws-cdk/aws-cloudwatch-actions", - "version": "0.0.0", - "private": true, - "description": "Alarm Actions for AWS CloudWatch CDK library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cloudwatch.actions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cloudwatch-actions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CloudWatch.Actions", - "packageId": "Amazon.CDK.AWS.CloudWatch.Actions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cloudwatch-actions", - "module": "aws_cdk.aws_cloudwatch_actions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cloudwatch-actions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudwatch" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ssmincidents": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cloudwatch-actions/rosetta/default.ts-fixture deleted file mode 100644 index c473f965be130..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as actions from '@aws-cdk/aws-cloudwatch-actions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/scaling.test.ts b/packages/@aws-cdk/aws-cloudwatch-actions/test/scaling.test.ts deleted file mode 100644 index d3b16268e03bf..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/test/scaling.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack } from '@aws-cdk/core'; -import * as actions from '../lib'; - -test('can use topic as alarm action', () => { - // GIVEN - const stack = new Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'ASG', { - minCapacity: 1, - maxCapacity: 100, - instanceType: new ec2.InstanceType('t-1000.macro'), - machineImage: new ec2.AmazonLinuxImage(), - vpc, - }); - const action = new autoscaling.StepScalingAction(stack, 'Action', { - autoScalingGroup, - }); - const alarm = new cloudwatch.Alarm(stack, 'Alarm', { - metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Henk' }), - evaluationPeriods: 3, - threshold: 100, - }); - - // WHEN - alarm.addAlarmAction(new actions.AutoScalingAction(action)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - AlarmActions: [ - { Ref: 'Action62AD07C0' }, - ], - }); -}); diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/sns.test.ts b/packages/@aws-cdk/aws-cloudwatch-actions/test/sns.test.ts deleted file mode 100644 index ba379902b653f..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch-actions/test/sns.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as sns from '@aws-cdk/aws-sns'; -import { Stack } from '@aws-cdk/core'; -import * as actions from '../lib'; - -test('can use topic as alarm action', () => { - // GIVEN - const stack = new Stack(); - const topic = new sns.Topic(stack, 'Topic'); - const alarm = new cloudwatch.Alarm(stack, 'Alarm', { - metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Henk' }), - evaluationPeriods: 3, - threshold: 100, - }); - - // WHEN - alarm.addAlarmAction(new actions.SnsAction(topic)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - AlarmActions: [ - { Ref: 'TopicBFC7AF6E' }, - ], - }); -}); diff --git a/packages/@aws-cdk/aws-cloudwatch/.eslintrc.js b/packages/@aws-cdk/aws-cloudwatch/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudwatch/.gitignore b/packages/@aws-cdk/aws-cloudwatch/.gitignore deleted file mode 100644 index 0f9112062f226..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -*.tgz -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cloudwatch/.npmignore b/packages/@aws-cdk/aws-cloudwatch/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cloudwatch/LICENSE b/packages/@aws-cdk/aws-cloudwatch/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cloudwatch/NOTICE b/packages/@aws-cdk/aws-cloudwatch/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cloudwatch/README.md b/packages/@aws-cdk/aws-cloudwatch/README.md deleted file mode 100644 index 67828ee2b6864..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/README.md +++ /dev/null @@ -1,714 +0,0 @@ -# Amazon CloudWatch Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -## Metric objects - -Metric objects represent a metric that is emitted by AWS services or your own -application, such as `CPUUsage`, `FailureCount` or `Bandwidth`. - -Metric objects can be constructed directly or are exposed by resources as -attributes. Resources that expose metrics will have functions that look -like `metricXxx()` which will return a Metric object, initialized with defaults -that make sense. - -For example, `lambda.Function` objects have the `fn.metricErrors()` method, which -represents the amount of errors reported by that Lambda function: - -```ts -declare const fn: lambda.Function; - -const errors = fn.metricErrors(); -``` - -`Metric` objects can be account and region aware. You can specify `account` and `region` as properties of the metric, or use the `metric.attachTo(Construct)` method. `metric.attachTo()` will automatically copy the `region` and `account` fields of the `Construct`, which can come from anywhere in the Construct tree. - -You can also instantiate `Metric` objects to reference any -[published metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) -that's not exposed using a convenience method on the CDK construct. -For example: - -```ts -const hostedZone = new route53.HostedZone(this, 'MyHostedZone', { zoneName: "example.org" }); -const metric = new cloudwatch.Metric({ - namespace: 'AWS/Route53', - metricName: 'DNSQueries', - dimensionsMap: { - HostedZoneId: hostedZone.hostedZoneId - } -}); -``` - -### Instantiating a new Metric object - -If you want to reference a metric that is not yet exposed by an existing construct, -you can instantiate a `Metric` object to represent it. For example: - -```ts -const metric = new cloudwatch.Metric({ - namespace: 'MyNamespace', - metricName: 'MyMetric', - dimensionsMap: { - ProcessingStep: 'Download' - } -}); -``` - -### Metric Math - -Math expressions are supported by instantiating the `MathExpression` class. -For example, a math expression that sums two other metrics looks like this: - -```ts -declare const fn: lambda.Function; - -const allProblems = new cloudwatch.MathExpression({ - expression: "errors + throttles", - usingMetrics: { - errors: fn.metricErrors(), - throttles: fn.metricThrottles(), - } -}); -``` - -You can use `MathExpression` objects like any other metric, including using -them in other math expressions: - -```ts -declare const fn: lambda.Function; -declare const allProblems: cloudwatch.MathExpression; - -const problemPercentage = new cloudwatch.MathExpression({ - expression: "(problems / invocations) * 100", - usingMetrics: { - problems: allProblems, - invocations: fn.metricInvocations() - } -}); -``` - -### Search Expressions - -Math expressions also support search expressions. For example, the following -search expression returns all CPUUtilization metrics that it finds, with the -graph showing the Average statistic with an aggregation period of 5 minutes: - -```ts -const cpuUtilization = new cloudwatch.MathExpression({ - expression: "SEARCH('{AWS/EC2,InstanceId} MetricName=\"CPUUtilization\"', 'Average', 300)", - - // Specifying '' as the label suppresses the default behavior - // of using the expression as metric label. This is especially appropriate - // when using expressions that return multiple time series (like SEARCH() - // or METRICS()), to show the labels of the retrieved metrics only. - label: '', -}); -``` - -Cross-account and cross-region search expressions are also supported. Use -the `searchAccount` and `searchRegion` properties to specify the account -and/or region to evaluate the search expression against. - -### Aggregation - -To graph or alarm on metrics you must aggregate them first, using a function -like `Average` or a percentile function like `P99`. By default, most Metric objects -returned by CDK libraries will be configured as `Average` over `300 seconds` (5 minutes). -The exception is if the metric represents a count of discrete events, such as -failures. In that case, the Metric object will be configured as `Sum` over `300 -seconds`, i.e. it represents the number of times that event occurred over the -time period. - -If you want to change the default aggregation of the Metric object (for example, -the function or the period), you can do so by passing additional parameters -to the metric function call: - -```ts -declare const fn: lambda.Function; - -const minuteErrorRate = fn.metricErrors({ - statistic: cloudwatch.Stats.AVERAGE, - period: Duration.minutes(1), - label: 'Lambda failure rate' -}); -``` - -The `statistic` field accepts a `string`; the `cloudwatch.Stats` object has a -number of predefined factory functions that help you constructs strings that are -appropriate for CloudWatch. The `metricErrors` function also allows changing the -metric label or color, which will be useful when embedding them in graphs (see -below). - -> Rates versus Sums -> -> The reason for using `Sum` to count discrete events is that *some* events are -> emitted as either `0` or `1` (for example `Errors` for a Lambda) and some are -> only emitted as `1` (for example `NumberOfMessagesPublished` for an SNS -> topic). -> -> In case `0`-metrics are emitted, it makes sense to take the `Average` of this -> metric: the result will be the fraction of errors over all executions. -> -> If `0`-metrics are not emitted, the `Average` will always be equal to `1`, -> and not be very useful. -> -> In order to simplify the mental model of `Metric` objects, we default to -> aggregating using `Sum`, which will be the same for both metrics types. If you -> happen to know the Metric you want to alarm on makes sense as a rate -> (`Average`) you can always choose to change the statistic. - -### Available Aggregation Statistics - -For your metrics aggregation, you can use the following statistics: - -| Statistic | Short format | Long format | Factory name | -| ------------------------ | :-----------------: | :------------------------------------------: | -------------------- | -| SampleCount (n) | ❌ | ❌ | `Stats.SAMPLE_COUNT` | -| Average (avg) | ❌ | ❌ | `Stats.AVERAGE` | -| Sum | ❌ | ❌ | `Stats.SUM` | -| Minimum (min) | ❌ | ❌ | `Stats.MINIMUM` | -| Maximum (max) | ❌ | ❌ | `Stats.MAXIMUM` | -| Interquartile mean (IQM) | ❌ | ❌ | `Stats.IQM` | -| Percentile (p) | `p99` | ❌ | `Stats.p(99)` | -| Winsorized mean (WM) | `wm99` = `WM(:99%)` | `WM(x:y) \| WM(x%:y%) \| WM(x%:) \| WM(:y%)` | `Stats.wm(10, 90)` | -| Trimmed count (TC) | `tc99` = `TC(:99%)` | `TC(x:y) \| TC(x%:y%) \| TC(x%:) \| TC(:y%)` | `Stats.tc(10, 90)` | -| Trimmed sum (TS) | `ts99` = `TS(:99%)` | `TS(x:y) \| TS(x%:y%) \| TS(x%:) \| TS(:y%)` | `Stats.ts(10, 90)` | -| Percentile rank (PR) | ❌ | `PR(x:y) \| PR(x:) \| PR(:y)` | `Stats.pr(10, 5000)` | - -The most common values are provided in the `cloudwatch.Stats` class. You can provide any string if your statistic is not in the class. - -Read more at [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html). - -```ts -new cloudwatch.Metric({ - namespace: 'AWS/Route53', - metricName: 'DNSQueries', - dimensionsMap: { - HostedZoneId: hostedZone.hostedZoneId - }, - statistic: cloudwatch.Stats.SAMPLE_COUNT, - period: cloudwatch.Duration.minutes(5) -}); - -new cloudwatch.Metric({ - namespace: 'AWS/Route53', - metricName: 'DNSQueries', - dimensionsMap: { - HostedZoneId: hostedZone.hostedZoneId - }, - statistic: cloudwatch.Stats.p(99), - period: cloudwatch.Duration.minutes(5) -}); - -new cloudwatch.Metric({ - namespace: 'AWS/Route53', - metricName: 'DNSQueries', - dimensionsMap: { - HostedZoneId: hostedZone.hostedZoneId - }, - statistic: 'TS(7.5%:90%)', - period: cloudwatch.Duration.minutes(5) -}); -``` - -### Labels - -Metric labels are displayed in the legend of graphs that include the metrics. - -You can use [dynamic labels](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html) -to show summary information about the displayed time series -in the legend. For example, if you use: - -```ts -declare const fn: lambda.Function; - -const minuteErrorRate = fn.metricErrors({ - statistic: cloudwatch.Stats.SUM, - period: Duration.hours(1), - - // Show the maximum hourly error count in the legend - label: '[max: ${MAX}] Lambda failure rate', -}); -``` - -As the metric label, the maximum value in the visible range will -be shown next to the time series name in the graph's legend. - -If the metric is a math expression producing more than one time series, the -maximum will be individually calculated and shown for each time series produce -by the math expression. - -## Alarms - -Alarms can be created on metrics in one of two ways. Either create an `Alarm` -object, passing the `Metric` object to set the alarm on: - -```ts -declare const fn: lambda.Function; - -new cloudwatch.Alarm(this, 'Alarm', { - metric: fn.metricErrors(), - threshold: 100, - evaluationPeriods: 2, -}); -``` - -Alternatively, you can call `metric.createAlarm()`: - -```ts -declare const fn: lambda.Function; - -fn.metricErrors().createAlarm(this, 'Alarm', { - threshold: 100, - evaluationPeriods: 2, -}); -``` - -The most important properties to set while creating an Alarms are: - -- `threshold`: the value to compare the metric against. -- `comparisonOperator`: the comparison operation to use, defaults to `metric >= threshold`. -- `evaluationPeriods`: how many consecutive periods the metric has to be - breaching the the threshold for the alarm to trigger. - -To create a cross-account alarm, make sure you have enabled [cross-account functionality](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html) in CloudWatch. Then, set the `account` property in the `Metric` object either manually or via the `metric.attachTo()` method. - -### Alarm Actions - -To add actions to an alarm, use the integration classes from the -`@aws-cdk/aws-cloudwatch-actions` package. For example, to post a message to -an SNS topic when an alarm breaches, do the following: - -```ts -import * as cw_actions from '@aws-cdk/aws-cloudwatch-actions'; -declare const alarm: cloudwatch.Alarm; - -const topic = new sns.Topic(this, 'Topic'); -alarm.addAlarmAction(new cw_actions.SnsAction(topic)); -``` - -#### Notification formats - -Alarms can be created in one of two "formats": - -- With "top-level parameters" (these are the classic style of CloudWatch Alarms). -- With a list of metrics specifications (these are the modern style of CloudWatch Alarms). - -For backwards compatibility, CDK will try to create classic, top-level CloudWatch alarms -as much as possible, unless you are using features that cannot be expressed in that format. -Features that require the new-style alarm format are: - -- Metric math -- Cross-account metrics -- Labels - -The difference between these two does not impact the functionality of the alarm -in any way, *except* that the format of the notifications the Alarm generates is -different between them. This affects both the notifications sent out over SNS, -as well as the EventBridge events generated by this Alarm. If you are writing -code to consume these notifications, be sure to handle both formats. - -### Composite Alarms - -[Composite Alarms](https://aws.amazon.com/about-aws/whats-new/2020/03/amazon-cloudwatch-now-allows-you-to-combine-multiple-alarms/) -can be created from existing Alarm resources. - -```ts -declare const alarm1: cloudwatch.Alarm; -declare const alarm2: cloudwatch.Alarm; -declare const alarm3: cloudwatch.Alarm; -declare const alarm4: cloudwatch.Alarm; - -const alarmRule = cloudwatch.AlarmRule.anyOf( - cloudwatch.AlarmRule.allOf( - cloudwatch.AlarmRule.anyOf( - alarm1, - cloudwatch.AlarmRule.fromAlarm(alarm2, cloudwatch.AlarmState.OK), - alarm3, - ), - cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.fromAlarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA)), - ), - cloudwatch.AlarmRule.fromBoolean(false), -); - -new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', { - alarmRule, -}); -``` - -#### Actions Suppressor - -If you want to disable actions of a Composite Alarm based on a certain condition, you can use [Actions Suppression](https://www.amazonaws.cn/en/new/2022/amazon-cloudwatch-supports-composite-alarm-actions-suppression/). - -```ts -declare const childAlarm1: cloudwatch.Alarm; -declare const childAlarm2: cloudwatch.Alarm; -declare const onAlarmAction: cloudwatch.IAlarmAction; -declare const onOkAction: cloudwatch.IAlarmAction; -declare const actionsSuppressor: cloudwatch.Alarm; - -const alarmRule = cloudwatch.AlarmRule.anyOf(alarm1, alarm2); - -const myCompositeAlarm = new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', { - alarmRule, - actionsSuppressor, -}); -myCompositeAlarm.addAlarmActions(onAlarmAction); -myComposireAlarm.addOkAction(onOkAction); -``` - -In the provided example, if `actionsSuppressor` is in `ALARM` state, `onAlarmAction` won't be triggered even if `myCompositeAlarm` goes into `ALARM` state. -Similar, if `actionsSuppressor` is in `ALARM` state and `myCompositeAlarm` goes from `ALARM` into `OK` state, `onOkAction` won't be triggered. - -### A note on units - -In CloudWatch, Metrics datums are emitted with units, such as `seconds` or -`bytes`. When `Metric` objects are given a `unit` attribute, it will be used to -*filter* the stream of metric datums for datums emitted using the same `unit` -attribute. - -In particular, the `unit` field is *not* used to rescale datums or alarm threshold -values (for example, it cannot be used to specify an alarm threshold in -*Megabytes* if the metric stream is being emitted as *bytes*). - -You almost certainly don't want to specify the `unit` property when creating -`Metric` objects (which will retrieve all datums regardless of their unit), -unless you have very specific requirements. Note that in any case, CloudWatch -only supports filtering by `unit` for Alarms, not in Dashboard graphs. - -Please see the following GitHub issue for a discussion on real unit -calculations in CDK: https://github.com/aws/aws-cdk/issues/5595 - -## Dashboards - -Dashboards are set of Widgets stored server-side which can be accessed quickly -from the AWS console. Available widgets are graphs of a metric over time, the -current value of a metric, or a static piece of Markdown which explains what the -graphs mean. - -The following widgets are available: - -- `GraphWidget` -- shows any number of metrics on both the left and right - vertical axes. -- `AlarmWidget` -- shows the graph and alarm line for a single alarm. -- `SingleValueWidget` -- shows the current value of a set of metrics. -- `TextWidget` -- shows some static Markdown. -- `AlarmStatusWidget` -- shows the status of your alarms in a grid view. - -### Graph widget - -A graph widget can display any number of metrics on either the `left` or -`right` vertical axis: - -```ts -declare const dashboard: cloudwatch.Dashboard; -declare const executionCountMetric: cloudwatch.Metric; -declare const errorCountMetric: cloudwatch.Metric; - -dashboard.addWidgets(new cloudwatch.GraphWidget({ - title: "Executions vs error rate", - - left: [executionCountMetric], - - right: [errorCountMetric.with({ - statistic: cloudwatch.Stats.AVERAGE, - label: "Error rate", - color: cloudwatch.Color.GREEN, - })] -})); -``` - -Using the methods `addLeftMetric()` and `addRightMetric()` you can add metrics to a graph widget later on. - -Graph widgets can also display annotations attached to the left or the right y-axis. - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.GraphWidget({ - // ... - - leftAnnotations: [ - { value: 1800, label: Duration.minutes(30).toHumanString(), color: cloudwatch.Color.RED, }, - { value: 3600, label: '1 hour', color: '#2ca02c', } - ], -})); -``` - -The graph legend can be adjusted from the default position at bottom of the widget. - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.GraphWidget({ - // ... - - legendPosition: cloudwatch.LegendPosition.RIGHT, -})); -``` - -The graph can publish live data within the last minute that has not been fully aggregated. - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.GraphWidget({ - // ... - - liveData: true, -})); -``` - -The graph view can be changed from default 'timeSeries' to 'bar' or 'pie'. - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.GraphWidget({ - // ... - - view: cloudwatch.GraphWidgetView.BAR, -})); -``` - -### Gauge widget - -Gauge graph requires the max and min value of the left Y axis, if no value is informed the limits will be from 0 to 100. - -```ts -declare const dashboard: cloudwatch.Dashboard; -declare const errorAlarm: cloudwatch.Alarm; -declare const gaugeMetric: cloudwatch.Metric; - -dashboard.addWidgets(new cloudwatch.GaugeWidget({ - metrics: [gaugeMetric], - leftYAxis: { - min: 0, - max: 1000, - } -})); -``` - -### Alarm widget - -An alarm widget shows the graph and the alarm line of a single alarm: - -```ts -declare const dashboard: cloudwatch.Dashboard; -declare const errorAlarm: cloudwatch.Alarm; - -dashboard.addWidgets(new cloudwatch.AlarmWidget({ - title: "Errors", - alarm: errorAlarm, -})); -``` - -### Single value widget - -A single-value widget shows the latest value of a set of metrics (as opposed -to a graph of the value over time): - -```ts -declare const dashboard: cloudwatch.Dashboard; -declare const visitorCount: cloudwatch.Metric; -declare const purchaseCount: cloudwatch.Metric; - -dashboard.addWidgets(new cloudwatch.SingleValueWidget({ - metrics: [visitorCount, purchaseCount], -})); -``` - -Show as many digits as can fit, before rounding. - - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.SingleValueWidget({ - metrics: [ /* ... */ ], - - fullPrecision: true, -})); -``` - -Sparkline allows you to glance the trend of a metric by displaying a simplified linegraph below the value. You can't use `sparkline: true` together with `setPeriodToTimeRange: true` - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.SingleValueWidget({ - metrics: [ /* ... */ ], - - sparkline: true, -})); -``` - -### Text widget - -A text widget shows an arbitrary piece of MarkDown. Use this to add explanations -to your dashboard: - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.TextWidget({ - markdown: '# Key Performance Indicators' -})); -``` - -Optionally set the TextWidget background to be transparent - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.TextWidget({ - markdown: '# Key Performance Indicators', - background: TextWidgetBackground.TRANSPARENT -})); -``` - -### Alarm Status widget - -An alarm status widget displays instantly the status of any type of alarms and gives the -ability to aggregate one or more alarms together in a small surface. - -```ts -declare const dashboard: cloudwatch.Dashboard; -declare const errorAlarm: cloudwatch.Alarm; - -dashboard.addWidgets( - new cloudwatch.AlarmStatusWidget({ - alarms: [errorAlarm], - }) -); -``` - -An alarm status widget only showing firing alarms, sorted by state and timestamp: - -```ts -declare const dashboard: cloudwatch.Dashboard; -declare const errorAlarm: cloudwatch.Alarm; - -dashboard.addWidgets(new cloudwatch.AlarmStatusWidget({ - title: "Errors", - alarms: [errorAlarm], - sortBy: cloudwatch.AlarmStatusWidgetSortBy.STATE_UPDATED_TIMESTAMP, - states: [cloudwatch.AlarmState.ALARM], -})); -``` - -### Query results widget - -A `LogQueryWidget` shows the results of a query from Logs Insights: - -```ts -declare const dashboard: cloudwatch.Dashboard; - -dashboard.addWidgets(new cloudwatch.LogQueryWidget({ - logGroupNames: ['my-log-group'], - view: cloudwatch.LogQueryVisualizationType.TABLE, - // The lines will be automatically combined using '\n|'. - queryLines: [ - 'fields @message', - 'filter @message like /Error/', - ] -})); -``` - -### Custom widget - -A `CustomWidget` shows the result of an AWS Lambda function: - -```ts -declare const dashboard: cloudwatch.Dashboard; - -// Import or create a lambda function -const fn = lambda.Function.fromFunctionArn( - dashboard, - 'Function', - 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', -); - -dashboard.addWidgets(new cloudwatch.CustomWidget({ - functionArn: fn.functionArn, - title: 'My lambda baked widget', -})); -``` - -You can learn more about custom widgets in the [Amazon Cloudwatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard.html). - -### Dashboard Layout - -The widgets on a dashboard are visually laid out in a grid that is 24 columns -wide. Normally you specify X and Y coordinates for the widgets on a Dashboard, -but because this is inconvenient to do manually, the library contains a simple -layout system to help you lay out your dashboards the way you want them to. - -Widgets have a `width` and `height` property, and they will be automatically -laid out either horizontally or vertically stacked to fill out the available -space. - -Widgets are added to a Dashboard by calling `add(widget1, widget2, ...)`. -Widgets given in the same call will be laid out horizontally. Widgets given -in different calls will be laid out vertically. To make more complex layouts, -you can use the following widgets to pack widgets together in different ways: - -- `Column`: stack two or more widgets vertically. -- `Row`: lay out two or more widgets horizontally. -- `Spacer`: take up empty space - -### Column widget - -A column widget contains other widgets and they will be laid out in a -vertical column. Widgets will be put one after another in order. - -```ts -declare const widgetA: cloudwatch.IWidget; -declare const widgetB: cloudwatch.IWidget; - -new cloudwatch.Column(widgetA, widgetB); -``` - -You can add a widget after object instantiation with the method -`addWidget()`. Each new widget will be put at the bottom of the column. - -### Row widget - -A row widget contains other widgets and they will be laid out in a -horizontal row. Widgets will be put one after another in order. -If the total width of the row exceeds the max width of the grid of 24 -columns, the row will wrap automatically and adapt its height. - -```ts -declare const widgetA: cloudwatch.IWidget; -declare const widgetB: cloudwatch.IWidget; - -new cloudwatch.Row(widgetA, widgetB); -``` - -You can add a widget after object instantiation with the method -`addWidget()`. - -### Interval duration for dashboard - -Interval duration for metrics in dashboard. You can specify `defaultInterval` with -the relative time(eg. 7 days) as `cdk.Duration.days(7)`. - -```ts -import * as cw from '@aws-cdk/aws-cloudwatch'; - -const dashboard = new cw.Dashboard(stack, 'Dash', { - defaultInterval: cdk.Duration.days(7), -}); -``` - -Here, the dashboard would show the metrics for the last 7 days. diff --git a/packages/@aws-cdk/aws-cloudwatch/jest.config.js b/packages/@aws-cdk/aws-cloudwatch/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cloudwatch/package.json b/packages/@aws-cdk/aws-cloudwatch/package.json deleted file mode 100644 index 4fecd4700ef15..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/package.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "name": "@aws-cdk/aws-cloudwatch", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CloudWatch", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cloudwatch", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cloudwatch" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CloudWatch", - "packageId": "Amazon.CDK.AWS.CloudWatch", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cloudwatch", - "module": "aws_cdk.aws_cloudwatch", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cloudwatch" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CloudWatch", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudwatch" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "awslint": { - "exclude": [ - "duration-prop-type:@aws-cdk/aws-cloudwatch.MetricAlarmConfig.period", - "duration-prop-type:@aws-cdk/aws-cloudwatch.MetricGraphConfig.period", - "duration-prop-type:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.period", - "no-unused-type:@aws-cdk/aws-cloudwatch.Statistic", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricAlarmConfig.dimensions", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricAlarmConfig.extendedStatistic", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricAlarmConfig.statistic", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricAlarmConfig.unit", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.color", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.dimensions", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.label", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.period", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.statistic", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricGraphConfig.unit", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.color", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.label", - "props-default-doc:@aws-cdk/aws-cloudwatch.MetricRenderingProperties.stat", - "duration-prop-type:@aws-cdk/aws-cloudwatch.MetricExpressionConfig.period", - "resource-attribute:@aws-cdk/aws-cloudwatch.CompositeAlarm.compositeAlarmArn" - ] - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-cloudwatch/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cloudwatch/rosetta/default.ts-fixture deleted file mode 100644 index 85cc6b579f761..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/rosetta/default.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack, Duration } from '@aws-cdk/core'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as sns from '@aws-cdk/aws-sns'; -import * as lambda from '@aws-cdk/aws-lambda'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - - diff --git a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.ts b/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.ts deleted file mode 100644 index b35722bb60975..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/test/integ.dashboard.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as cloudwatch from '../lib'; -import { TextWidgetBackground } from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'DashboardIntegrationTestStack'); - -const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { - defaultInterval: cdk.Duration.days(7), -}); - -dashboard.addWidgets(new cloudwatch.TextWidget({ - markdown: 'I don\'t have a background', - background: TextWidgetBackground.TRANSPARENT, -})); - -new cdk.CfnOutput(stack, 'DashboardArn', { - value: dashboard.dashboardArn, -}); - -new integ.IntegTest(app, 'DashboardIntegrationTest', { - testCases: [stack], -}); diff --git a/packages/@aws-cdk/aws-cloudwatch/test/metrics.test.ts b/packages/@aws-cdk/aws-cloudwatch/test/metrics.test.ts deleted file mode 100644 index 370dbcb60dc6d..0000000000000 --- a/packages/@aws-cdk/aws-cloudwatch/test/metrics.test.ts +++ /dev/null @@ -1,354 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import { Alarm, Metric, Stats } from '../lib'; -import { PairStatistic, parseStatistic, SingleStatistic } from '../lib/private/statistic'; - -describe('Metrics', () => { - test('metric grant', () => { - // GIVEN - const stack = new cdk.Stack(); - const role = new iam.Role(stack, 'SomeRole', { - assumedBy: new iam.AnyPrincipal(), - }); - - // WHEN - Metric.grantPutMetricData(role); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: 'cloudwatch:PutMetricData', - Effect: 'Allow', - Resource: '*', - }, - ], - }, - }); - - - }); - - test('can not use invalid period in Metric', () => { - expect(() => { - new Metric({ namespace: 'Test', metricName: 'ACount', period: cdk.Duration.seconds(20) }); - }).toThrow(/'period' must be 1, 5, 10, 30, or a multiple of 60 seconds, received 20/); - - - }); - - test('Metric optimization: "with" with the same period returns the same object', () => { - const m = new Metric({ namespace: 'Test', metricName: 'Metric', period: cdk.Duration.minutes(10) }); - - // Note: object equality, NOT deep equality on purpose - expect(m.with({})).toEqual(m); - expect(m.with({ period: cdk.Duration.minutes(10) })).toEqual(m); - - expect(m.with({ period: cdk.Duration.minutes(5) })).not.toEqual(m); - - - }); - - testDeprecated('cannot use null dimension value', () => { - expect(() => { - new Metric({ - namespace: 'Test', - metricName: 'ACount', - period: cdk.Duration.minutes(10), - dimensions: { - DimensionWithNull: null, - }, - }); - }).toThrow(/Dimension value of 'null' is invalid/); - - - }); - - testDeprecated('cannot use undefined dimension value', () => { - expect(() => { - new Metric({ - namespace: 'Test', - metricName: 'ACount', - period: cdk.Duration.minutes(10), - dimensions: { - DimensionWithUndefined: undefined, - }, - }); - }).toThrow(/Dimension value of 'undefined' is invalid/); - - - }); - - testDeprecated('cannot use long dimension values', () => { - const arr = new Array(256); - const invalidDimensionValue = arr.fill('A', 0).join(''); - - expect(() => { - new Metric({ - namespace: 'Test', - metricName: 'ACount', - period: cdk.Duration.minutes(10), - dimensions: { - DimensionWithLongValue: invalidDimensionValue, - }, - }); - }).toThrow(`Dimension value must be at least 1 and no more than 255 characters; received ${invalidDimensionValue}`); - - - }); - - test('cannot use long dimension values in dimensionsMap', () => { - const arr = new Array(256); - const invalidDimensionValue = arr.fill('A', 0).join(''); - - expect(() => { - new Metric({ - namespace: 'Test', - metricName: 'ACount', - period: cdk.Duration.minutes(10), - dimensionsMap: { - DimensionWithLongValue: invalidDimensionValue, - }, - }); - }).toThrow(`Dimension value must be at least 1 and no more than 255 characters; received ${invalidDimensionValue}`); - - - }); - - testDeprecated('throws error when there are more than 10 dimensions', () => { - expect(() => { - new Metric({ - namespace: 'Test', - metricName: 'ACount', - period: cdk.Duration.minutes(10), - dimensions: { - dimensionA: 'value1', - dimensionB: 'value2', - dimensionC: 'value3', - dimensionD: 'value4', - dimensionE: 'value5', - dimensionF: 'value6', - dimensionG: 'value7', - dimensionH: 'value8', - dimensionI: 'value9', - dimensionJ: 'value10', - dimensionK: 'value11', - }, - } ); - }).toThrow(/The maximum number of dimensions is 10, received 11/); - - - }); - - test('throws error when there are more than 10 dimensions in dimensionsMap', () => { - expect(() => { - new Metric({ - namespace: 'Test', - metricName: 'ACount', - period: cdk.Duration.minutes(10), - dimensionsMap: { - dimensionA: 'value1', - dimensionB: 'value2', - dimensionC: 'value3', - dimensionD: 'value4', - dimensionE: 'value5', - dimensionF: 'value6', - dimensionG: 'value7', - dimensionH: 'value8', - dimensionI: 'value9', - dimensionJ: 'value10', - dimensionK: 'value11', - }, - } ); - }).toThrow(/The maximum number of dimensions is 10, received 11/); - - - }); - - test('can create metric with dimensionsMap property', () => { - const stack = new cdk.Stack(); - const metric = new Metric({ - namespace: 'Test', - metricName: 'Metric', - dimensionsMap: { - dimensionA: 'value1', - dimensionB: 'value2', - }, - }); - - new Alarm(stack, 'Alarm', { - metric: metric, - threshold: 10, - evaluationPeriods: 1, - }); - - expect(metric.dimensions).toEqual({ - dimensionA: 'value1', - dimensionB: 'value2', - }); - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - Namespace: 'Test', - MetricName: 'Metric', - Dimensions: [ - { - Name: 'dimensionA', - Value: 'value1', - }, - { - Name: 'dimensionB', - Value: 'value2', - }, - ], - Threshold: 10, - EvaluationPeriods: 1, - }); - - - }); - - test('"with" with a different dimensions property', () => { - const dims = { - dimensionA: 'value1', - }; - - const metric = new Metric({ - namespace: 'Test', - metricName: 'Metric', - period: cdk.Duration.minutes(10), - dimensionsMap: dims, - }); - - const newDims = { - dimensionB: 'value2', - }; - - expect(metric.with({ - dimensionsMap: newDims, - }).dimensions).toEqual(newDims); - - - }); - - test('metric accepts a variety of statistics', () => { - const customStat = 'myCustomStatistic'; - const metric = new Metric({ - namespace: 'Test', - metricName: 'Metric', - statistic: customStat, - }); - - expect(metric.statistic).toEqual(customStat); - }); - - test('statistic is properly parsed', () => { - const checkParsingSingle = (statistic: string, statPrefix: string, statName: string, value: number) => { - const parsed = parseStatistic(statistic); - expect(parsed.type).toEqual('single'); - expect((parsed as SingleStatistic).value).toEqual(value); - expect((parsed as SingleStatistic).statPrefix).toEqual(statPrefix); - expect((parsed as SingleStatistic).statName).toEqual(statName); - }; - - const checkParsingPair = ( - statistic: string, - statPrefix: string, - statName: string, - isPercent: boolean, - canBeSingleStat: boolean, - asSingleStatStr?: string, - lower?: number, - upper?: number, - ) => { - const parsed = parseStatistic(statistic); - expect(parsed.type).toEqual('pair'); - expect((parsed as PairStatistic).isPercent).toEqual(isPercent); - expect((parsed as PairStatistic).lower).toEqual(lower); - expect((parsed as PairStatistic).upper).toEqual(upper); - expect((parsed as PairStatistic).canBeSingleStat).toEqual(canBeSingleStat); - expect((parsed as PairStatistic).asSingleStatStr).toEqual(asSingleStatStr); - expect((parsed as PairStatistic).statPrefix).toEqual(statPrefix); - expect((parsed as PairStatistic).statName).toEqual(statName); - }; - - expect(parseStatistic(Stats.SAMPLE_COUNT).type).toEqual('simple'); - expect(parseStatistic(Stats.AVERAGE).type).toEqual('simple'); - expect(parseStatistic(Stats.SUM).type).toEqual('simple'); - expect(parseStatistic(Stats.MINIMUM).type).toEqual('simple'); - expect(parseStatistic(Stats.MAXIMUM).type).toEqual('simple'); - expect(parseStatistic(Stats.IQM).type).toEqual('simple'); - - /* eslint-disable no-multi-spaces */ - - // Check single statistics - checkParsingSingle('p9', 'p', 'percentile', 9); - checkParsingSingle('p99', 'p', 'percentile', 99); - checkParsingSingle('P99', 'p', 'percentile', 99); - checkParsingSingle('p99.99', 'p', 'percentile', 99.99); - checkParsingSingle('tm99', 'tm', 'trimmedMean', 99); - checkParsingSingle('wm99', 'wm', 'winsorizedMean', 99); - checkParsingSingle('tc99', 'tc', 'trimmedCount', 99); - checkParsingSingle('ts99', 'ts', 'trimmedSum', 99); - - // Check all pair statistics - checkParsingPair('TM(10%:90%)', 'TM', 'trimmedMean', true, false, undefined, 10, 90); - checkParsingPair('TM(10.99%:90.99%)', 'TM', 'trimmedMean', true, false, undefined, 10.99, 90.99); - checkParsingPair('WM(10%:90%)', 'WM', 'winsorizedMean', true, false, undefined, 10, 90); - checkParsingPair('TC(10%:90%)', 'TC', 'trimmedCount', true, false, undefined, 10, 90); - checkParsingPair('TS(10%:90%)', 'TS', 'trimmedSum', true, false, undefined, 10, 90); - - // Check can be represented as a single statistic - checkParsingPair('TM(:90%)', 'TM', 'trimmedMean', true, true, 'tm90', undefined, 90); - - // Check every case - checkParsingPair('tm(10%:90%)', 'TM', 'trimmedMean', true, false, undefined, 10, 90); - checkParsingPair('TM(10%:90%)', 'TM', 'trimmedMean', true, false, undefined, 10, 90); - checkParsingPair('TM(:90%)', 'TM', 'trimmedMean', true, true, 'tm90', undefined, 90); - checkParsingPair('TM(10%:)', 'TM', 'trimmedMean', true, false, undefined, 10, undefined); - checkParsingPair('TM(10:1500)', 'TM', 'trimmedMean', false, false, undefined, 10, 1500); - checkParsingPair('TM(10:)', 'TM', 'trimmedMean', false, false, undefined, 10, undefined); - checkParsingPair('TM(:5000)', 'TM', 'trimmedMean', false, false, undefined, undefined, 5000); - checkParsingPair('TM(0.123456789:)', 'TM', 'trimmedMean', false, false, undefined, 0.123456789, undefined); - checkParsingPair('TM(0.123456789:)', 'TM', 'trimmedMean', false, false, undefined, 0.123456789, undefined); - checkParsingPair('TM(:0.123456789)', 'TM', 'trimmedMean', false, false, undefined, undefined, 0.123456789); - checkParsingPair('TM(0.123456789%:)', 'TM', 'trimmedMean', true, false, undefined, 0.123456789, undefined); - checkParsingPair('TM(:0.123456789%)', 'TM', 'trimmedMean', true, true, 'tm0.123456789', undefined, 0.123456789); - checkParsingPair('TM(0.123:0.4543)', 'TM', 'trimmedMean', false, false, undefined, 0.123, 0.4543); - checkParsingPair('TM(0.123%:0.4543%)', 'TM', 'trimmedMean', true, false, undefined, 0.123, 0.4543); - checkParsingPair('TM(0.1000%:0.1000%)', 'TM', 'trimmedMean', true, false, undefined, 0.1, 0.1); - checkParsingPair('TM(0.9999:100.9999)', 'TM', 'trimmedMean', false, false, undefined, 0.9999, 100.9999); - - /* eslint-enable no-multi-spaces */ - - // Check invalid statistics - expect(parseStatistic('p99.99.99').type).toEqual('generic'); - expect(parseStatistic('p200').type).toEqual('generic'); - expect(parseStatistic('pa99').type).toEqual('generic'); - expect(parseStatistic('99').type).toEqual('generic'); - expect(parseStatistic('tm1.').type).toEqual('generic'); - expect(parseStatistic('tm12.').type).toEqual('generic'); - expect(parseStatistic('tm123').type).toEqual('generic'); - expect(parseStatistic('tm123.123456789').type).toEqual('generic'); - expect(parseStatistic('tm.123456789').type).toEqual('generic'); - expect(parseStatistic('TM(10:90%)').type).toEqual('generic'); - expect(parseStatistic('TM(10%:1500)').type).toEqual('generic'); - expect(parseStatistic('TM(10)').type).toEqual('generic'); - expect(parseStatistic('TM()').type).toEqual('generic'); - expect(parseStatistic('TM(0.:)').type).toEqual('generic'); - expect(parseStatistic('TM(:0.)').type).toEqual('generic'); - expect(parseStatistic('()').type).toEqual('generic'); - expect(parseStatistic('(:)').type).toEqual('generic'); - expect(parseStatistic('TM(:)').type).toEqual('generic'); - expect(parseStatistic('TM(').type).toEqual('generic'); - expect(parseStatistic('TM)').type).toEqual('generic'); - expect(parseStatistic('TM(0.123456789%:%)').type).toEqual('generic'); - expect(parseStatistic('TM(0.123:0.4543%)').type).toEqual('generic'); - expect(parseStatistic('TM(0.123%:0.4543)').type).toEqual('generic'); - expect(parseStatistic('TM(1000%:)').type).toEqual('generic'); - expect(parseStatistic('TM(:1000%)').type).toEqual('generic'); - expect(parseStatistic('TM(1000%:1000%)').type).toEqual('generic'); - }); -}); diff --git a/packages/@aws-cdk/aws-codeartifact/.eslintrc.js b/packages/@aws-cdk/aws-codeartifact/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codeartifact/.gitignore b/packages/@aws-cdk/aws-codeartifact/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codeartifact/.npmignore b/packages/@aws-cdk/aws-codeartifact/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codeartifact/LICENSE b/packages/@aws-cdk/aws-codeartifact/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codeartifact/NOTICE b/packages/@aws-cdk/aws-codeartifact/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codeartifact/README.md b/packages/@aws-cdk/aws-codeartifact/README.md deleted file mode 100644 index 3b100d839d59c..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::CodeArtifact Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as codeartifact from '@aws-cdk/aws-codeartifact'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for CodeArtifact construct libraries](https://constructs.dev/search?q=codeartifact) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeArtifact resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeArtifact.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeArtifact](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeArtifact.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-codeartifact/jest.config.js b/packages/@aws-cdk/aws-codeartifact/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codeartifact/lib/index.ts b/packages/@aws-cdk/aws-codeartifact/lib/index.ts deleted file mode 100644 index 0cba8c930ded5..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::CodeArtifact CloudFormation Resources: -export * from './codeartifact.generated'; diff --git a/packages/@aws-cdk/aws-codeartifact/package.json b/packages/@aws-cdk/aws-codeartifact/package.json deleted file mode 100644 index 867496a792dfd..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-codeartifact", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeArtifact", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeArtifact", - "packageId": "Amazon.CDK.AWS.CodeArtifact", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.codeartifact", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codeartifact" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-codeartifact", - "module": "aws_cdk.aws_codeartifact" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codeartifact" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeArtifact", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CodeArtifact", - "aws-codeartifact" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codeartifact/test/codeartifact.test.ts b/packages/@aws-cdk/aws-codeartifact/test/codeartifact.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-codeartifact/test/codeartifact.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-codebuild/.eslintrc.js b/packages/@aws-cdk/aws-codebuild/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codebuild/.gitignore b/packages/@aws-cdk/aws-codebuild/.gitignore deleted file mode 100644 index 1f6a2603bdf03..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codebuild/.npmignore b/packages/@aws-cdk/aws-codebuild/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codebuild/LICENSE b/packages/@aws-cdk/aws-codebuild/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codebuild/NOTICE b/packages/@aws-cdk/aws-codebuild/NOTICE deleted file mode 100644 index 91f398efbcb4a..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/NOTICE +++ /dev/null @@ -1,23 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** yaml - https://www.npmjs.com/package/yaml -Copyright 2018 Eemeli Aro - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - ----------------- diff --git a/packages/@aws-cdk/aws-codebuild/README.md b/packages/@aws-cdk/aws-codebuild/README.md deleted file mode 100644 index 37e09f272e338..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/README.md +++ /dev/null @@ -1,862 +0,0 @@ -# AWS CodeBuild Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -AWS CodeBuild is a fully managed continuous integration service that compiles -source code, runs tests, and produces software packages that are ready to -deploy. With CodeBuild, you don’t need to provision, manage, and scale your own -build servers. CodeBuild scales continuously and processes multiple builds -concurrently, so your builds are not left waiting in a queue. You can get -started quickly by using prepackaged build environments, or you can create -custom build environments that use your own build tools. With CodeBuild, you are -charged by the minute for the compute resources you use. - -## Source - -Build projects are usually associated with a _source_, which is specified via -the `source` property which accepts a class that extends the `Source` -abstract base class. -The default is to have no source associated with the build project; -the `buildSpec` option is required in that case. - -Here's a CodeBuild project with no source which simply prints `Hello, -CodeBuild!`: - -[Minimal Example](./test/integ.defaults.lit.ts) - -### `CodeCommitSource` - -Use an AWS CodeCommit repository as the source of this build: - -```ts -import * as codecommit from '@aws-cdk/aws-codecommit'; - -const repository = new codecommit.Repository(this, 'MyRepo', { repositoryName: 'foo' }); -new codebuild.Project(this, 'MyFirstCodeCommitProject', { - source: codebuild.Source.codeCommit({ repository }), -}); -``` - -### `S3Source` - -Create a CodeBuild project with an S3 bucket as the source: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket'); - -new codebuild.Project(this, 'MyProject', { - source: codebuild.Source.s3({ - bucket: bucket, - path: 'path/to/file.zip', - }), -}); -``` - -The CodeBuild role will be granted to read just the given path from the given `bucket`. - -### `GitHubSource` and `GitHubEnterpriseSource` - -These source types can be used to build code from a GitHub repository. -Example: - -```ts -const gitHubSource = codebuild.Source.gitHub({ - owner: 'awslabs', - repo: 'aws-cdk', - webhook: true, // optional, default: true if `webhookFilters` were provided, false otherwise - webhookTriggersBatchBuild: true, // optional, default is false - webhookFilters: [ - codebuild.FilterGroup - .inEventOf(codebuild.EventAction.PUSH) - .andBranchIs('main') - .andCommitMessageIs('the commit message'), - ], // optional, by default all pushes and Pull Requests will trigger a build -}); -``` - -To provide GitHub credentials, please either go to AWS CodeBuild Console to connect -or call `ImportSourceCredentials` to persist your personal access token. -Example: - -```console -aws codebuild import-source-credentials --server-type GITHUB --auth-type PERSONAL_ACCESS_TOKEN --token -``` - -### `BitBucketSource` - -This source type can be used to build code from a BitBucket repository. - -```ts -const bbSource = codebuild.Source.bitBucket({ - owner: 'owner', - repo: 'repo', -}); -``` - -### For all Git sources - -For all Git sources, you can fetch submodules while cloning git repo. - -```ts -const gitHubSource = codebuild.Source.gitHub({ - owner: 'awslabs', - repo: 'aws-cdk', - fetchSubmodules: true, -}); -``` - -## BuildSpec - -The build spec can be provided from a number of different sources - -### File path relative to the root of the source - -You can specify a specific filename that exists within the project's source artifact to use as the buildspec. - -```ts -const project = new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromSourceFileName('my-buildspec.yml'), - source: codebuild.Source.gitHub({ - owner: 'awslabs', - repo: 'aws-cdk', - }) -}); -``` - -This will use `my-buildspec.yml` file within the `awslabs/aws-cdk` repository as the build spec. - -### File within the CDK project codebuild - -You can also specify a file within your cdk project directory to use as the buildspec. - -```ts -const project = new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromAsset('my-buildspec.yml'), -}); -``` - -This file will be uploaded to S3 and referenced from the codebuild project. - -### Inline object - -```ts -const project = new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), -}); -``` - -This will result in the buildspec being rendered as JSON within the codebuild project, if you prefer it to be rendered as YAML, use `fromObjectToYaml`. - -```ts -const project = new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObjectToYaml({ - version: '0.2', - }), -}); -``` - -## Artifacts - -CodeBuild Projects can produce Artifacts and upload them to S3. For example: - -```ts -declare const bucket: s3.Bucket; - -const project = new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - artifacts: codebuild.Artifacts.s3({ - bucket, - includeBuildId: false, - packageZip: true, - path: 'another/path', - identifier: 'AddArtifact1', - }), -}); -``` - -Because we've not set the `name` property, this example will set the -`overrideArtifactName` parameter, and produce an artifact named as defined in -the Buildspec file, uploaded to an S3 bucket (`bucket`). The path will be -`another/path` and the artifact will be a zipfile. - -## CodePipeline - -To add a CodeBuild Project as an Action to CodePipeline, -use the `PipelineProject` class instead of `Project`. -It's a simple class that doesn't allow you to specify `sources`, -`secondarySources`, `artifacts` or `secondaryArtifacts`, -as these are handled by setting input and output CodePipeline `Artifact` instances on the Action, -instead of setting them on the Project. - -```ts -const project = new codebuild.PipelineProject(this, 'Project', { - // properties as above... -}) -``` - -For more details, see the readme of the `@aws-cdk/aws-codepipeline-actions` package. - -## Caching - -You can save time when your project builds by using a cache. A cache can store reusable pieces of your build environment and use them across multiple builds. Your build project can use one of two types of caching: Amazon S3 or local. In general, S3 caching is a good option for small and intermediate build artifacts that are more expensive to build than to download. Local caching is a good option for large intermediate build artifacts because the cache is immediately available on the build host. - -### S3 Caching - -With S3 caching, the cache is stored in an S3 bucket which is available -regardless from what CodeBuild instance gets selected to run your CodeBuild job -on. When using S3 caching, you must also add in a `cache` section to your -buildspec which indicates the files to be cached: - -```ts -declare const myCachingBucket: s3.Bucket; - -new codebuild.Project(this, 'Project', { - source: codebuild.Source.bitBucket({ - owner: 'awslabs', - repo: 'aws-cdk', - }), - - cache: codebuild.Cache.bucket(myCachingBucket), - - // BuildSpec with a 'cache' section necessary for S3 caching. This can - // also come from 'buildspec.yml' in your source. - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: ['...'], - }, - }, - cache: { - paths: [ - // The '**/*' is required to indicate all files in this directory - '/root/cachedir/**/*', - ], - }, - }), -}); -``` - -Note that two different CodeBuild Projects using the same S3 bucket will *not* -share their cache: each Project will get a unique file in the S3 bucket to store -the cache in. - -### Local Caching - -With local caching, the cache is stored on the codebuild instance itself. This -is simple, cheap and fast, but CodeBuild cannot guarantee a reuse of instance -and hence cannot guarantee cache hits. For example, when a build starts and -caches files locally, if two subsequent builds start at the same time afterwards -only one of those builds would get the cache. Three different cache modes are -supported, which can be turned on individually. - -* `LocalCacheMode.SOURCE` caches Git metadata for primary and secondary sources. -* `LocalCacheMode.DOCKER_LAYER` caches existing Docker layers. -* `LocalCacheMode.CUSTOM` caches directories you specify in the buildspec file. - -```ts -new codebuild.Project(this, 'Project', { - source: codebuild.Source.gitHubEnterprise({ - httpsCloneUrl: 'https://my-github-enterprise.com/owner/repo', - }), - - // Enable Docker AND custom caching - cache: codebuild.Cache.local(codebuild.LocalCacheMode.DOCKER_LAYER, codebuild.LocalCacheMode.CUSTOM), - - // BuildSpec with a 'cache' section necessary for 'CUSTOM' caching. This can - // also come from 'buildspec.yml' in your source. - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: ['...'], - }, - }, - cache: { - paths: [ - // The '**/*' is required to indicate all files in this directory - '/root/cachedir/**/*', - ], - }, - }), -}); -``` - -## Environment - -By default, projects use a small instance with an Ubuntu 18.04 image. You -can use the `environment` property to customize the build environment: - -* `buildImage` defines the Docker image used. See [Images](#images) below for - details on how to define build images. -* `certificate` defines the location of a PEM encoded certificate to import. -* `computeType` defines the instance type used for the build. -* `privileged` can be set to `true` to allow privileged access. -* `environmentVariables` can be set at this level (and also at the project - level). - -## Images - -The CodeBuild library supports both Linux and Windows images via the -`LinuxBuildImage` (or `LinuxArmBuildImage`), and `WindowsBuildImage` classes, respectively. - -You can specify one of the predefined Windows/Linux images by using one -of the constants such as `WindowsBuildImage.WIN_SERVER_CORE_2019_BASE`, -`WindowsBuildImage.WINDOWS_BASE_2_0`, `LinuxBuildImage.STANDARD_2_0`, or -`LinuxArmBuildImage.AMAZON_LINUX_2_ARM`. - -Alternatively, you can specify a custom image using one of the static methods on -`LinuxBuildImage`: - -* `LinuxBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }])` to reference an image in any public or private Docker registry. -* `LinuxBuildImage.fromEcrRepository(repo[, tag])` to reference an image available in an - ECR repository. -* `LinuxBuildImage.fromAsset(parent, id, props)` to use an image created from a - local asset. -* `LinuxBuildImage.fromCodeBuildImageId(id)` to reference a pre-defined, CodeBuild-provided Docker image. - -or one of the corresponding methods on `WindowsBuildImage`: - -* `WindowsBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }, imageType])` -* `WindowsBuildImage.fromEcrRepository(repo[, tag, imageType])` -* `WindowsBuildImage.fromAsset(parent, id, props, [, imageType])` - -or one of the corresponding methods on `LinuxArmBuildImage`: - -* `LinuxArmBuildImage.fromEcrRepository(repo[, tag])` - -Note that the `WindowsBuildImage` version of the static methods accepts an optional parameter of type `WindowsImageType`, -which can be either `WindowsImageType.STANDARD`, the default, or `WindowsImageType.SERVER_2019`: - -```ts -declare const ecrRepository: ecr.Repository; - -new codebuild.Project(this, 'Project', { - environment: { - buildImage: codebuild.WindowsBuildImage.fromEcrRepository(ecrRepository, 'v1.0', codebuild.WindowsImageType.SERVER_2019), - // optional certificate to include in the build image - certificate: { - bucket: s3.Bucket.fromBucketName(this, 'Bucket', 'my-bucket'), - objectKey: 'path/to/cert.pem', - }, - }, - // ... -}) -``` - -The following example shows how to define an image from a Docker asset: - -[Docker asset example](./test/integ.docker-asset.lit.ts) - -The following example shows how to define an image from an ECR repository: - -[ECR example](./test/integ.ecr.lit.ts) - -The following example shows how to define an image from a private docker registry: - -[Docker Registry example](./test/integ.docker-registry.lit.ts) - -### GPU images - -The class `LinuxGpuBuildImage` contains constants for working with -[AWS Deep Learning Container images](https://aws.amazon.com/releasenotes/available-deep-learning-containers-images): - - -```ts -new codebuild.Project(this, 'Project', { - environment: { - buildImage: codebuild.LinuxGpuBuildImage.DLC_TENSORFLOW_2_1_0_INFERENCE, - }, - // ... -}) -``` - -One complication is that the repositories for the DLC images are in -different accounts in different AWS regions. -In most cases, the CDK will handle providing the correct account for you; -in rare cases (for example, deploying to new regions) -where our information might be out of date, -you can always specify the account -(along with the repository name and tag) -explicitly using the `awsDeepLearningContainersImage` method: - -```ts -new codebuild.Project(this, 'Project', { - environment: { - buildImage: codebuild.LinuxGpuBuildImage.awsDeepLearningContainersImage( - 'tensorflow-inference', '2.1.0-gpu-py36-cu101-ubuntu18.04', '123456789012'), - }, - // ... -}) -``` - -Alternatively, you can reference an image available in an ECR repository using the `LinuxGpuBuildImage.fromEcrRepository(repo[, tag])` method. - -## Logs - -CodeBuild lets you specify an S3 Bucket, CloudWatch Log Group or both to receive logs from your projects. - -By default, logs will go to cloudwatch. - -### CloudWatch Logs Example - -```ts -new codebuild.Project(this, 'Project', { - logging: { - cloudWatch: { - logGroup: new logs.LogGroup(this, `MyLogGroup`), - } - }, -}) -``` - -### S3 Logs Example - -```ts -new codebuild.Project(this, 'Project', { - logging: { - s3: { - bucket: new s3.Bucket(this, `LogBucket`) - } - }, -}) -``` - -## Debugging builds interactively using SSM Session Manager - -Integration with SSM Session Manager makes it possible to add breakpoints to your -build commands, pause the build there and log into the container to interactively -debug the environment. - -To do so, you need to: - -* Create the build with `ssmSessionPermissions: true`. -* Use a build image with SSM agent installed and configured (default CodeBuild images come with the image preinstalled). -* Start the build with [debugSessionEnabled](https://docs.aws.amazon.com/codebuild/latest/APIReference/API_StartBuild.html#CodeBuild-StartBuild-request-debugSessionEnabled) set to true. - -If these conditions are met, execution of the command `codebuild-breakpoint` -will suspend your build and allow you to attach a Session Manager session from -the CodeBuild console. - -For more information, see [View a running build in Session -Manager](https://docs.aws.amazon.com/codebuild/latest/userguide/session-manager.html) -in the CodeBuild documentation. - -Example: - -```ts -new codebuild.Project(this, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.STANDARD_6_0, - }, - ssmSessionPermissions: true, - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - // Pause the build container if possible - 'codebuild-breakpoint', - // Regular build in a script in the repository - './my-build.sh', - ], - }, - }, - }), -}) -``` - -## Credentials - -CodeBuild allows you to store credentials used when communicating with various sources, -like GitHub: - -```ts -new codebuild.GitHubSourceCredentials(this, 'CodeBuildGitHubCreds', { - accessToken: SecretValue.secretsManager('my-token'), -}); -// GitHub Enterprise is almost the same, -// except the class is called GitHubEnterpriseSourceCredentials -``` - -and BitBucket: - -```ts -new codebuild.BitBucketSourceCredentials(this, 'CodeBuildBitBucketCreds', { - username: SecretValue.secretsManager('my-bitbucket-creds', { jsonField: 'username' }), - password: SecretValue.secretsManager('my-bitbucket-creds', { jsonField: 'password' }), -}); -``` - -**Note**: the credentials are global to a given account in a given region - -they are not defined per CodeBuild project. -CodeBuild only allows storing a single credential of a given type -(GitHub, GitHub Enterprise or BitBucket) -in a given account in a given region - -any attempt to save more than one will result in an error. -You can use the [`list-source-credentials` AWS CLI operation](https://docs.aws.amazon.com/cli/latest/reference/codebuild/list-source-credentials.html) -to inspect what credentials are stored in your account. - -## Test reports - -You can specify a test report in your buildspec: - -```ts -const project = new codebuild.Project(this, 'Project', { - buildSpec: codebuild.BuildSpec.fromObject({ - // ... - reports: { - myReport: { - files: '**/*', - 'base-directory': 'build/test-results', - }, - }, - }), -}); -``` - -This will create a new test report group, -with the name `-myReport`. - -The project's role in the CDK will always be granted permissions to create and use report groups -with names starting with the project's name; -if you'd rather not have those permissions added, -you can opt out of it when creating the project: - -```ts -declare const source: codebuild.Source; - -const project = new codebuild.Project(this, 'Project', { - source, - grantReportGroupPermissions: false, -}); -``` - -Alternatively, you can specify an ARN of an existing resource group, -instead of a simple name, in your buildspec: - -```ts -declare const source: codebuild.Source; - -// create a new ReportGroup -const reportGroup = new codebuild.ReportGroup(this, 'ReportGroup'); - -const project = new codebuild.Project(this, 'Project', { - source, - buildSpec: codebuild.BuildSpec.fromObject({ - // ... - reports: { - [reportGroup.reportGroupArn]: { - files: '**/*', - 'base-directory': 'build/test-results', - }, - }, - }), -}); -``` - -For a code coverage report, you can specify a report group with the code coverage report group type. - -```ts -declare const source: codebuild.Source; - -// create a new ReportGroup -const reportGroup = new codebuild.ReportGroup(this, 'ReportGroup', { - type: codebuild.ReportGroupType.CODE_COVERAGE -}); - -const project = new codebuild.Project(this, 'Project', { - source, - buildSpec: codebuild.BuildSpec.fromObject({ - // ... - reports: { - [reportGroup.reportGroupArn]: { - files: '**/*', - 'base-directory': 'build/coverage-report.xml', - 'file-format': 'JACOCOXML' - }, - }, - }), -}); -``` - -If you specify a report group, you need to grant the project's role permissions to write reports to that report group: - -```ts -declare const project: codebuild.Project; -declare const reportGroup: codebuild.ReportGroup; - -reportGroup.grantWrite(project); -``` - -The created policy will adjust to the report group type. If no type is specified when creating the report group the created policy will contain the action for the test report group type. - -For more information on the test reports feature, -see the [AWS CodeBuild documentation](https://docs.aws.amazon.com/codebuild/latest/userguide/test-reporting.html). - -## Events - -CodeBuild projects can be used either as a source for events or be triggered -by events via an event rule. - -### Using Project as an event target - -The `@aws-cdk/aws-events-targets.CodeBuildProject` allows using an AWS CodeBuild -project as a AWS CloudWatch event rule target: - -```ts -// start build when a commit is pushed -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as targets from '@aws-cdk/aws-events-targets'; - -declare const codeCommitRepository: codecommit.Repository; -declare const project: codebuild.Project; - -codeCommitRepository.onCommit('OnCommit', { - target: new targets.CodeBuildProject(project), -}); -``` - -### Using Project as an event source - -To define Amazon CloudWatch event rules for build projects, use one of the `onXxx` -methods: - -```ts -import * as targets from '@aws-cdk/aws-events-targets'; -declare const fn: lambda.Function; -declare const project: codebuild.Project; - -const rule = project.onStateChange('BuildStateChange', { - target: new targets.LambdaFunction(fn) -}); -``` - -## CodeStar Notifications - -To define CodeStar Notification rules for Projects, use one of the `notifyOnXxx()` methods. -They are very similar to `onXxx()` methods for CloudWatch events: - -```ts -import * as chatbot from '@aws-cdk/aws-chatbot'; - -declare const project: codebuild.Project; - -const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { - slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', - slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', - slackChannelId: 'YOUR_SLACK_CHANNEL_ID', -}); - -const rule = project.notifyOnBuildSucceeded('NotifyOnBuildSucceeded', target); -``` - -## Secondary sources and artifacts - -CodeBuild Projects can get their sources from multiple places, and produce -multiple outputs. For example: - -```ts -import * as codecommit from '@aws-cdk/aws-codecommit'; -declare const repo: codecommit.Repository; -declare const bucket: s3.Bucket; - -const project = new codebuild.Project(this, 'MyProject', { - secondarySources: [ - codebuild.Source.codeCommit({ - identifier: 'source2', - repository: repo, - }), - ], - secondaryArtifacts: [ - codebuild.Artifacts.s3({ - identifier: 'artifact2', - bucket: bucket, - path: 'some/path', - name: 'file.zip', - }), - ], - // ... -}); -``` - -Note that the `identifier` property is required for both secondary sources and -artifacts. - -The contents of the secondary source is available to the build under the -directory specified by the `CODEBUILD_SRC_DIR_` environment variable -(so, `CODEBUILD_SRC_DIR_source2` in the above case). - -The secondary artifacts have their own section in the buildspec, under the -regular `artifacts` one. Each secondary artifact has its own section, beginning -with their identifier. - -So, a buildspec for the above Project could look something like this: - -```ts -const project = new codebuild.Project(this, 'MyProject', { - // secondary sources and artifacts as above... - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - 'cd $CODEBUILD_SRC_DIR_source2', - 'touch output2.txt', - ], - }, - }, - artifacts: { - 'secondary-artifacts': { - 'artifact2': { - 'base-directory': '$CODEBUILD_SRC_DIR_source2', - 'files': [ - 'output2.txt', - ], - }, - }, - }, - }), -}); -``` - -### Definition of VPC configuration in CodeBuild Project - -Typically, resources in an VPC are not accessible by AWS CodeBuild. To enable -access, you must provide additional VPC-specific configuration information as -part of your CodeBuild project configuration. This includes the VPC ID, the -VPC subnet IDs, and the VPC security group IDs. VPC-enabled builds are then -able to access resources inside your VPC. - -For further Information see https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html - -**Use Cases** -VPC connectivity from AWS CodeBuild builds makes it possible to: - -* Run integration tests from your build against data in an Amazon RDS database that's isolated on a private subnet. -* Query data in an Amazon ElastiCache cluster directly from tests. -* Interact with internal web services hosted on Amazon EC2, Amazon ECS, or services that use internal Elastic Load Balancing. -* Retrieve dependencies from self-hosted, internal artifact repositories, such as PyPI for Python, Maven for Java, and npm for Node.js. -* Access objects in an Amazon S3 bucket configured to allow access through an Amazon VPC endpoint only. -* Query external web services that require fixed IP addresses through the Elastic IP address of the NAT gateway or NAT instance associated with your subnet(s). - -Your builds can access any resource that's hosted in your VPC. - -**Enable Amazon VPC Access in your CodeBuild Projects** - -Pass the VPC when defining your Project, then make sure to -give the CodeBuild's security group the right permissions -to access the resources that it needs by using the -`connections` object. - -For example: - -```ts -declare const loadBalancer: elbv2.ApplicationLoadBalancer; - -const vpc = new ec2.Vpc(this, 'MyVPC'); -const project = new codebuild.Project(this, 'MyProject', { - vpc: vpc, - buildSpec: codebuild.BuildSpec.fromObject({ - // ... - }), -}); - -project.connections.allowTo(loadBalancer, ec2.Port.tcp(443)); -``` - -## Project File System Location EFS - -Add support for CodeBuild to build on AWS EFS file system mounts using -the new ProjectFileSystemLocation. -The `fileSystemLocations` property which accepts a list `ProjectFileSystemLocation` -as represented by the interface `IFileSystemLocations`. -The only supported file system type is `EFS`. - -For example: - -```ts -new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - fileSystemLocations: [ - codebuild.FileSystemLocation.efs({ - identifier: "myidentifier2", - location: "myclodation.mydnsroot.com:/loc", - mountPoint: "/media", - mountOptions: "opts" - }) - ] -}); -``` - -Here's a CodeBuild project with a simple example that creates a project mounted on AWS EFS: - -[Minimal Example](./test/integ.project-file-system-location.ts) - -## Batch builds - -To enable batch builds you should call `enableBatchBuilds()` on the project instance. - -It returns an object containing the batch service role that was created, -or `undefined` if batch builds could not be enabled, for example if the project was imported. - -```ts -declare const source: codebuild.Source; - -const project = new codebuild.Project(this, 'MyProject', { source, }); - -if (project.enableBatchBuilds()) { - console.log('Batch builds were enabled'); -} -``` - -## Timeouts - -There are two types of timeouts that can be set when creating your Project. -The `timeout` property can be used to set an upper limit on how long your Project is able to run without being marked as completed. -The default is 60 minutes. -An example of overriding the default follows. - -```ts -new codebuild.Project(this, 'MyProject', { - timeout: Duration.minutes(90) -}); -``` - -The `queuedTimeout` property can be used to set an upper limit on how your Project remains queued to run. -There is no default value for this property. -As an example, to allow your Project to queue for up to thirty (30) minutes before the build fails, -use the following code. - -```ts -new codebuild.Project(this, 'MyProject', { - queuedTimeout: Duration.minutes(30) -}); -``` - -## Limiting concurrency - -By default if a new build is triggered it will be run even if there is a previous build already in progress. -It is possible to limit the maximum concurrent builds to value between 1 and the account specific maximum limit. -By default there is no explicit limit. - -```ts -new codebuild.Project(this, 'MyProject', { - concurrentBuildLimit: 1 -}); -``` diff --git a/packages/@aws-cdk/aws-codebuild/jest.config.js b/packages/@aws-cdk/aws-codebuild/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codebuild/lib/events.ts b/packages/@aws-cdk/aws-codebuild/lib/events.ts deleted file mode 100644 index 51fa38e57caf8..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/lib/events.ts +++ /dev/null @@ -1,88 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; - -/** - * Event fields for the CodeBuild "state change" event - * - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html#sample-build-notifications-ref - */ -export class StateChangeEvent { - /** - * The triggering build's status - */ - public static get buildStatus() { - return events.EventField.fromPath('$.detail.build-status'); - } - - /** - * The triggering build's project name - */ - public static get projectName() { - return events.EventField.fromPath('$.detail.project-name'); - } - - /** - * Return the build id - */ - public static get buildId() { - return events.EventField.fromPath('$.detail.build-id'); - } - - public static get currentPhase() { - return events.EventField.fromPath('$.detail.current-phase'); - } - - private constructor() { - } -} - -/** - * Event fields for the CodeBuild "phase change" event - * - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html#sample-build-notifications-ref - */ -export class PhaseChangeEvent { - /** - * The triggering build's project name - */ - public static get projectName() { - return events.EventField.fromPath('$.detail.project-name'); - } - - /** - * The triggering build's id - */ - public static get buildId() { - return events.EventField.fromPath('$.detail.build-id'); - } - - /** - * The phase that was just completed - */ - public static get completedPhase() { - return events.EventField.fromPath('$.detail.completed-phase'); - } - - /** - * The status of the completed phase - */ - public static get completedPhaseStatus() { - return events.EventField.fromPath('$.detail.completed-phase-status'); - } - - /** - * The duration of the completed phase - */ - public static get completedPhaseDurationSeconds() { - return events.EventField.fromPath('$.detail.completed-phase-duration-seconds'); - } - - /** - * Whether the build is complete - */ - public static get buildComplete() { - return events.EventField.fromPath('$.detail.build-complete'); - } - - private constructor() { - } -} diff --git a/packages/@aws-cdk/aws-codebuild/lib/source.ts b/packages/@aws-cdk/aws-codebuild/lib/source.ts deleted file mode 100644 index ac2e538aaf9c2..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/lib/source.ts +++ /dev/null @@ -1,887 +0,0 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Construct } from 'constructs'; -import { CfnProject } from './codebuild.generated'; -import { IProject } from './project'; -import { - BITBUCKET_SOURCE_TYPE, - CODECOMMIT_SOURCE_TYPE, - GITHUB_ENTERPRISE_SOURCE_TYPE, - GITHUB_SOURCE_TYPE, - S3_SOURCE_TYPE, -} from './source-types'; - -/** - * The type returned from `ISource#bind`. - */ -export interface SourceConfig { - readonly sourceProperty: CfnProject.SourceProperty; - - readonly buildTriggers?: CfnProject.ProjectTriggersProperty; - - /** - * `AWS::CodeBuild::Project.SourceVersion` - * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-sourceversion - * @default the latest version - */ - readonly sourceVersion?: string; -} - -/** - * The abstract interface of a CodeBuild source. - * Implemented by `Source`. - */ -export interface ISource { - readonly identifier?: string; - - readonly type: string; - - readonly badgeSupported: boolean; - - bind(scope: Construct, project: IProject): SourceConfig; -} - -/** - * Properties common to all Source classes. - */ -export interface SourceProps { - /** - * The source identifier. - * This property is required on secondary sources. - */ - readonly identifier?: string; -} - -/** - * Source provider definition for a CodeBuild Project. - */ -export abstract class Source implements ISource { - public static s3(props: S3SourceProps): ISource { - return new S3Source(props); - } - - public static codeCommit(props: CodeCommitSourceProps): ISource { - return new CodeCommitSource(props); - } - - public static gitHub(props: GitHubSourceProps): ISource { - return new GitHubSource(props); - } - - public static gitHubEnterprise(props: GitHubEnterpriseSourceProps): ISource { - return new GitHubEnterpriseSource(props); - } - - public static bitBucket(props: BitBucketSourceProps): ISource { - return new BitBucketSource(props); - } - - public readonly identifier?: string; - public abstract readonly type: string; - public readonly badgeSupported: boolean = false; - - protected constructor(props: SourceProps) { - this.identifier = props.identifier; - } - - /** - * Called by the project when the source is added so that the source can perform - * binding operations on the source. For example, it can grant permissions to the - * code build project to read from the S3 bucket. - */ - public bind(_scope: Construct, _project: IProject): SourceConfig { - return { - sourceProperty: { - sourceIdentifier: this.identifier, - type: this.type, - }, - }; - } -} - -/** - * The construction properties common to all build sources that are backed by Git. - */ -interface GitSourceProps extends SourceProps { - /** - * The depth of history to download. Minimum value is 0. - * If this value is 0, greater than 25, or not provided, - * then the full history is downloaded with each build of the project. - */ - readonly cloneDepth?: number; - - /** - * The commit ID, pull request ID, branch name, or tag name that corresponds to - * the version of the source code you want to build - * - * @example 'mybranch' - * @default the default branch's HEAD commit ID is used - */ - readonly branchOrRef?: string; - - /** - * Whether to fetch submodules while cloning git repo. - * - * @default false - */ - readonly fetchSubmodules?: boolean; -} - -/** - * A common superclass of all build sources that are backed by Git. - */ -abstract class GitSource extends Source { - private readonly cloneDepth?: number; - private readonly branchOrRef?: string; - private readonly fetchSubmodules?: boolean; - - protected constructor(props: GitSourceProps) { - super(props); - - this.cloneDepth = props.cloneDepth; - this.branchOrRef = props.branchOrRef; - this.fetchSubmodules = props.fetchSubmodules; - } - - public bind(_scope: Construct, _project: IProject): SourceConfig { - const superConfig = super.bind(_scope, _project); - return { - sourceVersion: this.branchOrRef, - sourceProperty: { - ...superConfig.sourceProperty, - gitCloneDepth: this.cloneDepth, - gitSubmodulesConfig: this.fetchSubmodules ? { - fetchSubmodules: this.fetchSubmodules, - } : undefined, - }, - }; - } -} - -/** - * The types of webhook event actions. - */ -export enum EventAction { - /** - * A push (of a branch, or a tag) to the repository. - */ - PUSH = 'PUSH', - - /** - * Creating a Pull Request. - */ - PULL_REQUEST_CREATED = 'PULL_REQUEST_CREATED', - - /** - * Updating a Pull Request. - */ - PULL_REQUEST_UPDATED = 'PULL_REQUEST_UPDATED', - - /** - * Merging a Pull Request. - */ - PULL_REQUEST_MERGED = 'PULL_REQUEST_MERGED', - - /** - * Re-opening a previously closed Pull Request. - * Note that this event is only supported for GitHub and GitHubEnterprise sources. - */ - PULL_REQUEST_REOPENED = 'PULL_REQUEST_REOPENED', -} - -enum WebhookFilterTypes { - FILE_PATH = 'FILE_PATH', - COMMIT_MESSAGE = 'COMMIT_MESSAGE', - HEAD_REF = 'HEAD_REF', - ACTOR_ACCOUNT_ID = 'ACTOR_ACCOUNT_ID', - BASE_REF = 'BASE_REF', -} - -/** - * An object that represents a group of filter conditions for a webhook. - * Every condition in a given FilterGroup must be true in order for the whole group to be true. - * You construct instances of it by calling the `#inEventOf` static factory method, - * and then calling various `andXyz` instance methods to create modified instances of it - * (this class is immutable). - * - * You pass instances of this class to the `webhookFilters` property when constructing a source. - */ -export class FilterGroup { - /** - * Creates a new event FilterGroup that triggers on any of the provided actions. - * - * @param actions the actions to trigger the webhook on - */ - public static inEventOf(...actions: EventAction[]): FilterGroup { - return new FilterGroup(new Set(actions), []); - } - - private readonly actions: Set; - private readonly filters: CfnProject.WebhookFilterProperty[]; - - private constructor(actions: Set, filters: CfnProject.WebhookFilterProperty[]) { - if (actions.size === 0) { - throw new Error('A filter group must contain at least one event action'); - } - this.actions = actions; - this.filters = filters; - } - - /** - * Create a new FilterGroup with an added condition: - * the event must affect the given branch. - * - * @param branchName the name of the branch (can be a regular expression) - */ - public andBranchIs(branchName: string): FilterGroup { - return this.addHeadBranchFilter(branchName, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must not affect the given branch. - * - * @param branchName the name of the branch (can be a regular expression) - */ - public andBranchIsNot(branchName: string): FilterGroup { - return this.addHeadBranchFilter(branchName, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must affect a head commit with the given message. - * - * @param commitMessage the commit message (can be a regular expression) - */ - public andCommitMessageIs(commitMessage: string): FilterGroup { - return this.addCommitMessageFilter(commitMessage, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must not affect a head commit with the given message. - * - * @param commitMessage the commit message (can be a regular expression) - */ - public andCommitMessageIsNot(commitMessage: string): FilterGroup { - return this.addCommitMessageFilter(commitMessage, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must affect the given tag. - * - * @param tagName the name of the tag (can be a regular expression) - */ - public andTagIs(tagName: string): FilterGroup { - return this.addHeadTagFilter(tagName, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must not affect the given tag. - * - * @param tagName the name of the tag (can be a regular expression) - */ - public andTagIsNot(tagName: string): FilterGroup { - return this.addHeadTagFilter(tagName, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must affect a Git reference (ie., a branch or a tag) - * that matches the given pattern. - * - * @param pattern a regular expression - */ - public andHeadRefIs(pattern: string) { - return this.addHeadRefFilter(pattern, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the event must not affect a Git reference (ie., a branch or a tag) - * that matches the given pattern. - * - * @param pattern a regular expression - */ - public andHeadRefIsNot(pattern: string) { - return this.addHeadRefFilter(pattern, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the account ID of the actor initiating the event must match the given pattern. - * - * @param pattern a regular expression - */ - public andActorAccountIs(pattern: string): FilterGroup { - return this.addActorAccountId(pattern, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the account ID of the actor initiating the event must not match the given pattern. - * - * @param pattern a regular expression - */ - public andActorAccountIsNot(pattern: string): FilterGroup { - return this.addActorAccountId(pattern, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the Pull Request that is the source of the event must target the given base branch. - * Note that you cannot use this method if this Group contains the `PUSH` event action. - * - * @param branchName the name of the branch (can be a regular expression) - */ - public andBaseBranchIs(branchName: string): FilterGroup { - return this.addBaseBranchFilter(branchName, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the Pull Request that is the source of the event must not target the given base branch. - * Note that you cannot use this method if this Group contains the `PUSH` event action. - * - * @param branchName the name of the branch (can be a regular expression) - */ - public andBaseBranchIsNot(branchName: string): FilterGroup { - return this.addBaseBranchFilter(branchName, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the Pull Request that is the source of the event must target the given Git reference. - * Note that you cannot use this method if this Group contains the `PUSH` event action. - * - * @param pattern a regular expression - */ - public andBaseRefIs(pattern: string): FilterGroup { - return this.addBaseRefFilter(pattern, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the Pull Request that is the source of the event must not target the given Git reference. - * Note that you cannot use this method if this Group contains the `PUSH` event action. - * - * @param pattern a regular expression - */ - public andBaseRefIsNot(pattern: string): FilterGroup { - return this.addBaseRefFilter(pattern, false); - } - - /** - * Create a new FilterGroup with an added condition: - * the push that is the source of the event must affect a file that matches the given pattern. - * Note that you can only use this method if this Group contains only the `PUSH` event action, - * and only for GitHub, Bitbucket and GitHubEnterprise sources. - * - * @param pattern a regular expression - */ - public andFilePathIs(pattern: string): FilterGroup { - return this.addFilePathFilter(pattern, true); - } - - /** - * Create a new FilterGroup with an added condition: - * the push that is the source of the event must not affect a file that matches the given pattern. - * Note that you can only use this method if this Group contains only the `PUSH` event action, - * and only for GitHub, Bitbucket and GitHubEnterprise sources. - * - * @param pattern a regular expression - */ - public andFilePathIsNot(pattern: string): FilterGroup { - return this.addFilePathFilter(pattern, false); - } - - /** @internal */ - public get _actions(): EventAction[] { - return set2Array(this.actions); - } - - /** @internal */ - public get _filters(): CfnProject.WebhookFilterProperty[] { - return this.filters.slice(); - } - - /** @internal */ - public _toJson(): CfnProject.WebhookFilterProperty[] { - const eventFilter: CfnProject.WebhookFilterProperty = { - type: 'EVENT', - pattern: set2Array(this.actions).join(', '), - }; - return [eventFilter].concat(this.filters); - } - - private addCommitMessageFilter(commitMessage: string, include: boolean): FilterGroup { - return this.addFilter(WebhookFilterTypes.COMMIT_MESSAGE, commitMessage, include); - } - - private addHeadBranchFilter(branchName: string, include: boolean): FilterGroup { - return this.addHeadRefFilter(`refs/heads/${branchName}`, include); - } - - private addHeadTagFilter(tagName: string, include: boolean): FilterGroup { - return this.addHeadRefFilter(`refs/tags/${tagName}`, include); - } - - private addHeadRefFilter(refName: string, include: boolean) { - return this.addFilter(WebhookFilterTypes.HEAD_REF, refName, include); - } - - private addActorAccountId(accountId: string, include: boolean) { - return this.addFilter(WebhookFilterTypes.ACTOR_ACCOUNT_ID, accountId, include); - } - - private addBaseBranchFilter(branchName: string, include: boolean): FilterGroup { - return this.addBaseRefFilter(`refs/heads/${branchName}`, include); - } - - private addBaseRefFilter(refName: string, include: boolean) { - if (this.actions.has(EventAction.PUSH)) { - throw new Error('A base reference condition cannot be added if a Group contains a PUSH event action'); - } - return this.addFilter(WebhookFilterTypes.BASE_REF, refName, include); - } - - private addFilePathFilter(pattern: string, include: boolean): FilterGroup { - return this.addFilter(WebhookFilterTypes.FILE_PATH, pattern, include); - } - - private addFilter(type: WebhookFilterTypes, pattern: string, include: boolean) { - return new FilterGroup(this.actions, this.filters.concat([{ - type, - pattern, - excludeMatchedPattern: include ? undefined : true, - }])); - } -} - -/** - * The construction properties common to all third-party build sources that are backed by Git. - */ -interface ThirdPartyGitSourceProps extends GitSourceProps { - /** - * Whether to send notifications on your build's start and end. - * - * @default true - */ - readonly reportBuildStatus?: boolean; - - /** - * Whether to create a webhook that will trigger a build every time an event happens in the repository. - * - * @default true if any `webhookFilters` were provided, false otherwise - */ - readonly webhook?: boolean; - - /** - * Trigger a batch build from a webhook instead of a standard one. - * - * Enabling this will enable batch builds on the CodeBuild project. - * - * @default false - */ - readonly webhookTriggersBatchBuild?: boolean; - - /** - * A list of webhook filters that can constraint what events in the repository will trigger a build. - * A build is triggered if any of the provided filter groups match. - * Only valid if `webhook` was not provided as false. - * - * @default every push and every Pull Request (create or update) triggers a build - */ - readonly webhookFilters?: FilterGroup[]; - - /** - * The URL that the build will report back to the source provider. - * Can use built-in CodeBuild variables, like $AWS_REGION. - * - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.source.buildstatusconfig.targeturl - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html - * - * @example "$CODEBUILD_PUBLIC_BUILD_URL" - * @default - link to the AWS Console for CodeBuild to a particular build execution - */ - readonly buildStatusUrl?: string; -} - -/** - * A common superclass of all third-party build sources that are backed by Git. - */ -abstract class ThirdPartyGitSource extends GitSource { - public readonly badgeSupported: boolean = true; - protected readonly webhookFilters: FilterGroup[]; - private readonly reportBuildStatus: boolean; - private readonly webhook?: boolean; - private readonly webhookTriggersBatchBuild?: boolean; - protected readonly buildStatusUrl?: string; - - protected constructor(props: ThirdPartyGitSourceProps) { - super(props); - - this.webhook = props.webhook; - this.reportBuildStatus = props.reportBuildStatus ?? true; - this.webhookFilters = props.webhookFilters || []; - this.webhookTriggersBatchBuild = props.webhookTriggersBatchBuild; - this.buildStatusUrl = props.buildStatusUrl; - } - - public bind(_scope: Construct, project: IProject): SourceConfig { - const anyFilterGroupsProvided = this.webhookFilters.length > 0; - const webhook = this.webhook ?? (anyFilterGroupsProvided ? true : undefined); - - if (!webhook && anyFilterGroupsProvided) { - throw new Error('`webhookFilters` cannot be used when `webhook` is `false`'); - } - - if (!webhook && this.webhookTriggersBatchBuild) { - throw new Error('`webhookTriggersBatchBuild` cannot be used when `webhook` is `false`'); - } - - const superConfig = super.bind(_scope, project); - - if (this.webhookTriggersBatchBuild) { - project.enableBatchBuilds(); - } - - return { - sourceProperty: { - ...superConfig.sourceProperty, - reportBuildStatus: this.reportBuildStatus, - }, - sourceVersion: superConfig.sourceVersion, - buildTriggers: webhook === undefined ? undefined : { - webhook, - buildType: this.webhookTriggersBatchBuild ? 'BUILD_BATCH' : undefined, - filterGroups: anyFilterGroupsProvided ? this.webhookFilters.map(fg => fg._toJson()) : undefined, - }, - }; - } -} - -/** - * Construction properties for `CodeCommitSource`. - */ -export interface CodeCommitSourceProps extends GitSourceProps { - readonly repository: codecommit.IRepository; -} - -/** - * CodeCommit Source definition for a CodeBuild project. - */ -class CodeCommitSource extends GitSource { - public readonly badgeSupported = true; - public readonly type = CODECOMMIT_SOURCE_TYPE; - private readonly repo: codecommit.IRepository; - - constructor(props: CodeCommitSourceProps) { - super(props); - this.repo = props.repository; - } - - public bind(_scope: Construct, project: IProject): SourceConfig { - // https://docs.aws.amazon.com/codebuild/latest/userguide/setting-up.html - project.addToRolePolicy(new iam.PolicyStatement({ - actions: ['codecommit:GitPull'], - resources: [this.repo.repositoryArn], - })); - - const superConfig = super.bind(_scope, project); - return { - sourceProperty: { - ...superConfig.sourceProperty, - location: this.repo.repositoryCloneUrlHttp, - }, - sourceVersion: superConfig.sourceVersion, - }; - } -} - -/** - * Construction properties for `S3Source`. - */ -export interface S3SourceProps extends SourceProps { - readonly bucket: s3.IBucket; - readonly path: string; - - /** - * The version ID of the object that represents the build input ZIP file to use. - * - * @default latest - */ - readonly version?: string; -} - -/** - * S3 bucket definition for a CodeBuild project. - */ -class S3Source extends Source { - public readonly type = S3_SOURCE_TYPE; - private readonly bucket: s3.IBucket; - private readonly path: string; - private readonly version?: string; - - constructor(props: S3SourceProps) { - super(props); - this.bucket = props.bucket; - this.path = props.path; - this.version = props.version; - } - - public bind(_scope: Construct, project: IProject): SourceConfig { - this.bucket.grantRead(project, this.path); - - const superConfig = super.bind(_scope, project); - return { - sourceProperty: { - ...superConfig.sourceProperty, - location: `${this.bucket.bucketName}/${this.path}`, - }, - sourceVersion: this.version, - }; - } -} - -/** - * Common properties between `GitHubSource` and `GitHubEnterpriseSource`. - */ -interface CommonGithubSourceProps extends ThirdPartyGitSourceProps { - /** - * This parameter is used for the `context` parameter in the GitHub commit status. - * Can use built-in CodeBuild variables, like $AWS_REGION. - * - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.source.buildstatusconfig.context - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html - * - * @example "My build #$CODEBUILD_BUILD_NUMBER" - * @default "AWS CodeBuild $AWS_REGION ($PROJECT_NAME)" - */ - readonly buildStatusContext?: string -} - -abstract class CommonGithubSource extends ThirdPartyGitSource { - private readonly buildStatusContext?: string; - - constructor(props: CommonGithubSourceProps) { - super(props); - this.buildStatusContext = props.buildStatusContext; - } - - public bind(scope: Construct, project: IProject): SourceConfig { - const superConfig = super.bind(scope, project); - return { - sourceProperty: { - ...superConfig.sourceProperty, - buildStatusConfig: this.buildStatusContext !== undefined || this.buildStatusUrl !== undefined - ? { - context: this.buildStatusContext, - targetUrl: this.buildStatusUrl, - } - : undefined, - }, - sourceVersion: superConfig.sourceVersion, - buildTriggers: superConfig.buildTriggers, - }; - } -} - -/** - * Construction properties for `GitHubSource` and `GitHubEnterpriseSource`. - */ -export interface GitHubSourceProps extends CommonGithubSourceProps { - /** - * The GitHub account/user that owns the repo. - * - * @example 'awslabs' - */ - readonly owner: string; - - /** - * The name of the repo (without the username). - * - * @example 'aws-cdk' - */ - readonly repo: string; -} - -/** - * GitHub Source definition for a CodeBuild project. - */ -class GitHubSource extends CommonGithubSource { - public readonly type = GITHUB_SOURCE_TYPE; - private readonly httpsCloneUrl: string; - - constructor(props: GitHubSourceProps) { - super(props); - this.httpsCloneUrl = `https://github.com/${props.owner}/${props.repo}.git`; - } - - public bind(_scope: Construct, project: IProject): SourceConfig { - const superConfig = super.bind(_scope, project); - return { - sourceProperty: { - ...superConfig.sourceProperty, - location: this.httpsCloneUrl, - }, - sourceVersion: superConfig.sourceVersion, - buildTriggers: superConfig.buildTriggers, - }; - } -} - -/** - * Construction properties for `GitHubEnterpriseSource`. - */ -export interface GitHubEnterpriseSourceProps extends CommonGithubSourceProps { - /** - * The HTTPS URL of the repository in your GitHub Enterprise installation. - */ - readonly httpsCloneUrl: string; - - /** - * Whether to ignore SSL errors when connecting to the repository. - * - * @default false - */ - readonly ignoreSslErrors?: boolean; -} - -/** - * GitHub Enterprise Source definition for a CodeBuild project. - */ -class GitHubEnterpriseSource extends CommonGithubSource { - public readonly type = GITHUB_ENTERPRISE_SOURCE_TYPE; - private readonly httpsCloneUrl: string; - private readonly ignoreSslErrors?: boolean; - - constructor(props: GitHubEnterpriseSourceProps) { - super(props); - this.httpsCloneUrl = props.httpsCloneUrl; - this.ignoreSslErrors = props.ignoreSslErrors; - } - - public bind(_scope: Construct, _project: IProject): SourceConfig { - if (this.hasCommitMessageFilterAndPrEvent()) { - throw new Error('COMMIT_MESSAGE filters cannot be used with GitHub Enterprise Server pull request events'); - } - - if (this.hasFilePathFilterAndPrEvent()) { - throw new Error('FILE_PATH filters cannot be used with GitHub Enterprise Server pull request events'); - } - - const superConfig = super.bind(_scope, _project); - return { - sourceProperty: { - ...superConfig.sourceProperty, - location: this.httpsCloneUrl, - insecureSsl: this.ignoreSslErrors, - }, - sourceVersion: superConfig.sourceVersion, - buildTriggers: superConfig.buildTriggers, - }; - } - - private hasCommitMessageFilterAndPrEvent() { - return this.webhookFilters.some(fg => ( - fg._filters.some(fp => fp.type === WebhookFilterTypes.COMMIT_MESSAGE) && - this.hasPrEvent(fg._actions))); - } - private hasFilePathFilterAndPrEvent() { - return this.webhookFilters.some(fg => ( - fg._filters.some(fp => fp.type === WebhookFilterTypes.FILE_PATH) && - this.hasPrEvent(fg._actions))); - } - private hasPrEvent(actions: EventAction[]) { - return actions.includes( - EventAction.PULL_REQUEST_CREATED || - EventAction.PULL_REQUEST_MERGED || - EventAction.PULL_REQUEST_REOPENED || - EventAction.PULL_REQUEST_UPDATED); - } -} - -/** - * Construction properties for `BitBucketSource`. - */ -export interface BitBucketSourceProps extends ThirdPartyGitSourceProps { - /** - * The BitBucket account/user that owns the repo. - * - * @example 'awslabs' - */ - readonly owner: string; - - /** - * The name of the repo (without the username). - * - * @example 'aws-cdk' - */ - readonly repo: string; - - /** - * This parameter is used for the `name` parameter in the Bitbucket commit status. - * Can use built-in CodeBuild variables, like $AWS_REGION. - * - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.source.buildstatusconfig.context - * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html - * - * @example "My build #$CODEBUILD_BUILD_NUMBER" - * @default "AWS CodeBuild $AWS_REGION ($PROJECT_NAME)" - */ - readonly buildStatusName?: string; -} - -/** - * BitBucket Source definition for a CodeBuild project. - */ -class BitBucketSource extends ThirdPartyGitSource { - public readonly type = BITBUCKET_SOURCE_TYPE; - private readonly httpsCloneUrl: any; - private readonly buildStatusName?: string; - - constructor(props: BitBucketSourceProps) { - super(props); - this.httpsCloneUrl = `https://bitbucket.org/${props.owner}/${props.repo}.git`; - this.buildStatusName = props.buildStatusName; - } - - public bind(_scope: Construct, _project: IProject): SourceConfig { - // BitBucket sources don't support the PULL_REQUEST_REOPENED event action - if (this.anyWebhookFilterContainsPrReopenedEventAction()) { - throw new Error('BitBucket sources do not support the PULL_REQUEST_REOPENED webhook event action'); - } - - const superConfig = super.bind(_scope, _project); - return { - sourceProperty: { - ...superConfig.sourceProperty, - location: this.httpsCloneUrl, - buildStatusConfig: this.buildStatusName !== undefined || this.buildStatusUrl !== undefined - ? { - context: this.buildStatusName, - targetUrl: this.buildStatusUrl, - } - : undefined, - }, - sourceVersion: superConfig.sourceVersion, - buildTriggers: superConfig.buildTriggers, - }; - } - - private anyWebhookFilterContainsPrReopenedEventAction() { - return this.webhookFilters.findIndex(fg => { - return fg._actions.findIndex(a => a === EventAction.PULL_REQUEST_REOPENED) !== -1; - }) !== -1; - } -} - -function set2Array(set: Set): T[] { - const ret: T[] = []; - set.forEach(el => ret.push(el)); - return ret; -} diff --git a/packages/@aws-cdk/aws-codebuild/package.json b/packages/@aws-cdk/aws-codebuild/package.json deleted file mode 100644 index b852fc29fe572..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/package.json +++ /dev/null @@ -1,250 +0,0 @@ -{ - "name": "@aws-cdk/aws-codebuild", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeBuild", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.codebuild", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codebuild" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeBuild", - "packageId": "Amazon.CDK.AWS.CodeBuild", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-codebuild", - "module": "aws_cdk.aws_codebuild", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codebuild" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeBuild", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "statements": 74, - "lines": 74 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "codebuild" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0", - "yaml": "1.10.2" - }, - "bundledDependencies": [ - "yaml" - ], - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "construct-ctor-props-optional:@aws-cdk/aws-codebuild.Project", - "duration-prop-type:@aws-cdk/aws-codebuild.PhaseChangeEvent.completedPhaseDurationSeconds", - "duration-prop-name:@aws-cdk/aws-codebuild.PhaseChangeEvent.completedPhaseDurationSeconds", - "docs-public-apis:@aws-cdk/aws-codebuild.Project.metric", - "docs-public-apis:@aws-cdk/aws-codebuild.ComputeType.X2_LARGE", - "docs-public-apis:@aws-cdk/aws-codebuild.ComputeType.LARGE", - "docs-public-apis:@aws-cdk/aws-codebuild.ComputeType.MEDIUM", - "docs-public-apis:@aws-cdk/aws-codebuild.ComputeType.SMALL", - "docs-public-apis:@aws-cdk/aws-codebuild.BuildEnvironmentVariableType", - "docs-public-apis:@aws-cdk/aws-codebuild.Artifacts.s3", - "docs-public-apis:@aws-cdk/aws-codebuild.BuildSpec.fromObject", - "docs-public-apis:@aws-cdk/aws-codebuild.Cache.none", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.AMAZON_LINUX_2", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.AMAZON_LINUX_2_2", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.STANDARD_1_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.STANDARD_2_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.STANDARD_3_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_ANDROID_JAVA8_24_4_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_ANDROID_JAVA8_26_1_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_BASE", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_DOCKER_17_09_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_DOCKER_18_09_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_DOTNET_CORE_1_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_DOTNET_CORE_2_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_DOTNET_CORE_2_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_GOLANG_1_10", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_GOLANG_1_11", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_14_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_6_3_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_8_11_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_OPEN_JDK_11", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_OPEN_JDK_8", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_OPEN_JDK_9", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PHP_5_6", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PHP_7_0", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PHP_7_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PYTHON_2_7_12", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PYTHON_3_3_6", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PYTHON_3_4_5", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PYTHON_3_5_2", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PYTHON_3_6_5", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_PYTHON_3_7_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_RUBY_2_2_5", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_RUBY_2_3_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_RUBY_2_5_1", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.UBUNTU_14_04_RUBY_2_5_3", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.fromDockerRegistry", - "docs-public-apis:@aws-cdk/aws-codebuild.LinuxBuildImage.fromEcrRepository", - "docs-public-apis:@aws-cdk/aws-codebuild.Project.fromProjectArn", - "props-default-doc:@aws-cdk/aws-codebuild.SourceProps.identifier", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.badgeSupported", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.type", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.identifier", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.bitBucket", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.codeCommit", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.gitHub", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.gitHubEnterprise", - "docs-public-apis:@aws-cdk/aws-codebuild.Source.s3", - "docs-public-apis:@aws-cdk/aws-codebuild.StateChangeEvent.currentPhase", - "docs-public-apis:@aws-cdk/aws-codebuild.WindowsBuildImage.fromDockerRegistry", - "docs-public-apis:@aws-cdk/aws-codebuild.WindowsBuildImage.fromEcrRepository", - "props-default-doc:@aws-cdk/aws-codebuild.ArtifactsProps.identifier", - "props-default-doc:@aws-cdk/aws-codebuild.BitBucketSourceProps.cloneDepth", - "docs-public-apis:@aws-cdk/aws-codebuild.BucketCacheOptions", - "props-default-doc:@aws-cdk/aws-codebuild.BucketCacheOptions.prefix", - "docs-public-apis:@aws-cdk/aws-codebuild.BuildEnvironment", - "props-default-doc:@aws-cdk/aws-codebuild.BuildEnvironment.environmentVariables", - "docs-public-apis:@aws-cdk/aws-codebuild.BuildEnvironmentVariable", - "docs-public-apis:@aws-cdk/aws-codebuild.CodeCommitSourceProps.repository", - "props-default-doc:@aws-cdk/aws-codebuild.CodeCommitSourceProps.cloneDepth", - "docs-public-apis:@aws-cdk/aws-codebuild.CommonProjectProps", - "props-default-doc:@aws-cdk/aws-codebuild.GitHubEnterpriseSourceProps.cloneDepth", - "props-default-doc:@aws-cdk/aws-codebuild.GitHubSourceProps.cloneDepth", - "docs-public-apis:@aws-cdk/aws-codebuild.IProject", - "docs-public-apis:@aws-cdk/aws-codebuild.IProject.addToRolePolicy", - "docs-public-apis:@aws-cdk/aws-codebuild.IProject.metric", - "docs-public-apis:@aws-cdk/aws-codebuild.ISource.badgeSupported", - "docs-public-apis:@aws-cdk/aws-codebuild.ISource.type", - "docs-public-apis:@aws-cdk/aws-codebuild.ISource.identifier", - "docs-public-apis:@aws-cdk/aws-codebuild.ISource.bind", - "docs-public-apis:@aws-cdk/aws-codebuild.PipelineProjectProps", - "docs-public-apis:@aws-cdk/aws-codebuild.ProjectProps", - "props-default-doc:@aws-cdk/aws-codebuild.S3ArtifactsProps.path", - "docs-public-apis:@aws-cdk/aws-codebuild.S3SourceProps.bucket", - "docs-public-apis:@aws-cdk/aws-codebuild.S3SourceProps.path", - "docs-public-apis:@aws-cdk/aws-codebuild.SourceConfig.sourceProperty", - "docs-public-apis:@aws-cdk/aws-codebuild.SourceConfig.buildTriggers", - "props-default-doc:@aws-cdk/aws-codebuild.SourceConfig.buildTriggers", - "props-physical-name:@aws-cdk/aws-codebuild.BitBucketSourceCredentialsProps", - "props-physical-name:@aws-cdk/aws-codebuild.GitHubSourceCredentialsProps", - "props-physical-name:@aws-cdk/aws-codebuild.GitHubEnterpriseSourceCredentialsProps" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codebuild/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codebuild/rosetta/default.ts-fixture deleted file mode 100644 index 12926b4e95060..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/rosetta/default.ts-fixture +++ /dev/null @@ -1,19 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack, Duration, SecretValue } from '@aws-cdk/core'; -import codebuild = require('@aws-cdk/aws-codebuild'); -import iam = require('@aws-cdk/aws-iam'); -import ec2 = require('@aws-cdk/aws-ec2'); -import lambda = require('@aws-cdk/aws-lambda'); -import * as s3 from '@aws-cdk/aws-s3'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as logs from '@aws-cdk/aws-logs'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts b/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts deleted file mode 100644 index e95a536a69a4e..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts +++ /dev/null @@ -1,1988 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; -import { CodePipelineSource } from '../lib/codepipeline-source'; -import { NoSource } from '../lib/no-source'; - -/* eslint-disable quote-props */ - -describe('default properties', () => { - test('with CodePipeline source', () => { - const stack = new cdk.Stack(); - - new codebuild.PipelineProject(stack, 'MyProject'); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'MyProjectRole9BBE5233': { - 'Type': 'AWS::IAM::Role', - 'Properties': { - 'AssumeRolePolicyDocument': { - 'Statement': [ - { - 'Action': 'sts:AssumeRole', - 'Effect': 'Allow', - 'Principal': { - 'Service': 'codebuild.amazonaws.com', - }, - }, - ], - 'Version': '2012-10-17', - }, - }, - }, - 'MyProjectRoleDefaultPolicyB19B7C29': { - 'Type': 'AWS::IAM::Policy', - 'Properties': { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': [ - 'logs:CreateLogGroup', - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - 'Effect': 'Allow', - 'Resource': [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':logs:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':log-group:/aws/codebuild/', - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':logs:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':log-group:/aws/codebuild/', - { - 'Ref': 'MyProject39F7B0AE', - }, - ':*', - ], - ], - }, - ], - }, - { - 'Action': [ - 'codebuild:CreateReportGroup', - 'codebuild:CreateReport', - 'codebuild:UpdateReport', - 'codebuild:BatchPutTestCases', - 'codebuild:BatchPutCodeCoverages', - ], - 'Effect': 'Allow', - 'Resource': { - 'Fn::Join': ['', [ - 'arn:', - { 'Ref': 'AWS::Partition' }, - ':codebuild:', - { 'Ref': 'AWS::Region' }, - ':', - { 'Ref': 'AWS::AccountId' }, - ':report-group/', - { 'Ref': 'MyProject39F7B0AE' }, - '-*', - ]], - }, - }, - ], - 'Version': '2012-10-17', - }, - 'PolicyName': 'MyProjectRoleDefaultPolicyB19B7C29', - 'Roles': [ - { - 'Ref': 'MyProjectRole9BBE5233', - }, - ], - }, - }, - 'MyProject39F7B0AE': { - 'Type': 'AWS::CodeBuild::Project', - 'Properties': { - 'Source': { - 'Type': 'CODEPIPELINE', - }, - 'Artifacts': { - 'Type': 'CODEPIPELINE', - }, - 'ServiceRole': { - 'Fn::GetAtt': [ - 'MyProjectRole9BBE5233', - 'Arn', - ], - }, - 'Environment': { - 'Type': 'LINUX_CONTAINER', - 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', - 'ImagePullCredentialsType': 'CODEBUILD', - 'ComputeType': 'BUILD_GENERAL1_SMALL', - }, - 'EncryptionKey': 'alias/aws/s3', - 'Cache': { - 'Type': 'NO_CACHE', - }, - }, - }, - }, - }); - }); - - test('with CodeCommit source', () => { - const stack = new cdk.Stack(); - - const repo = new codecommit.Repository(stack, 'MyRepo', { - repositoryName: 'hello-cdk', - }); - - const source = codebuild.Source.codeCommit({ repository: repo, cloneDepth: 2 }); - - new codebuild.Project(stack, 'MyProject', { - source, - }); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'MyRepoF4F48043': { - 'Type': 'AWS::CodeCommit::Repository', - 'Properties': { - 'RepositoryName': 'hello-cdk', - }, - }, - 'MyProjectRole9BBE5233': { - 'Type': 'AWS::IAM::Role', - 'Properties': { - 'AssumeRolePolicyDocument': { - 'Statement': [ - { - 'Action': 'sts:AssumeRole', - 'Effect': 'Allow', - 'Principal': { - 'Service': 'codebuild.amazonaws.com', - }, - }, - ], - 'Version': '2012-10-17', - }, - }, - }, - 'MyProjectRoleDefaultPolicyB19B7C29': { - 'Type': 'AWS::IAM::Policy', - 'Properties': { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': 'codecommit:GitPull', - 'Effect': 'Allow', - 'Resource': { - 'Fn::GetAtt': [ - 'MyRepoF4F48043', - 'Arn', - ], - }, - }, - { - 'Action': [ - 'logs:CreateLogGroup', - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - 'Effect': 'Allow', - 'Resource': [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':logs:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':log-group:/aws/codebuild/', - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':logs:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':log-group:/aws/codebuild/', - { - 'Ref': 'MyProject39F7B0AE', - }, - ':*', - ], - ], - }, - ], - }, - { - 'Action': [ - 'codebuild:CreateReportGroup', - 'codebuild:CreateReport', - 'codebuild:UpdateReport', - 'codebuild:BatchPutTestCases', - 'codebuild:BatchPutCodeCoverages', - ], - 'Effect': 'Allow', - 'Resource': { - 'Fn::Join': ['', [ - 'arn:', - { 'Ref': 'AWS::Partition' }, - ':codebuild:', - { 'Ref': 'AWS::Region' }, - ':', - { 'Ref': 'AWS::AccountId' }, - ':report-group/', - { 'Ref': 'MyProject39F7B0AE' }, - '-*', - ]], - }, - }, - ], - 'Version': '2012-10-17', - }, - 'PolicyName': 'MyProjectRoleDefaultPolicyB19B7C29', - 'Roles': [ - { - 'Ref': 'MyProjectRole9BBE5233', - }, - ], - }, - }, - 'MyProject39F7B0AE': { - 'Type': 'AWS::CodeBuild::Project', - 'Properties': { - 'Artifacts': { - 'Type': 'NO_ARTIFACTS', - }, - 'Environment': { - 'ComputeType': 'BUILD_GENERAL1_SMALL', - 'Image': 'aws/codebuild/standard:1.0', - 'ImagePullCredentialsType': 'CODEBUILD', - 'PrivilegedMode': false, - 'Type': 'LINUX_CONTAINER', - }, - 'ServiceRole': { - 'Fn::GetAtt': [ - 'MyProjectRole9BBE5233', - 'Arn', - ], - }, - 'Source': { - 'Location': { - 'Fn::GetAtt': [ - 'MyRepoF4F48043', - 'CloneUrlHttp', - ], - }, - 'GitCloneDepth': 2, - 'Type': 'CODECOMMIT', - }, - 'EncryptionKey': 'alias/aws/s3', - 'Cache': { - 'Type': 'NO_CACHE', - }, - }, - }, - }, - }); - }); - - test('with S3Bucket source', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'path/to/source.zip', - }), - environment: { - buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0, - }, - }); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'MyBucketF68F3FF0': { - 'Type': 'AWS::S3::Bucket', - 'DeletionPolicy': 'Retain', - 'UpdateReplacePolicy': 'Retain', - }, - 'MyProjectRole9BBE5233': { - 'Type': 'AWS::IAM::Role', - 'Properties': { - 'AssumeRolePolicyDocument': { - 'Statement': [ - { - 'Action': 'sts:AssumeRole', - 'Effect': 'Allow', - 'Principal': { - 'Service': 'codebuild.amazonaws.com', - }, - }, - ], - 'Version': '2012-10-17', - }, - }, - }, - 'MyProjectRoleDefaultPolicyB19B7C29': { - 'Type': 'AWS::IAM::Policy', - 'Properties': { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - ], - 'Effect': 'Allow', - 'Resource': [ - { - 'Fn::GetAtt': [ - 'MyBucketF68F3FF0', - 'Arn', - ], - }, - { - 'Fn::Join': [ - '', - [ - { - 'Fn::GetAtt': [ - 'MyBucketF68F3FF0', - 'Arn', - ], - }, - '/path/to/source.zip', - ], - ], - }, - ], - }, - { - 'Action': [ - 'logs:CreateLogGroup', - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - 'Effect': 'Allow', - 'Resource': [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':logs:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':log-group:/aws/codebuild/', - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':logs:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':log-group:/aws/codebuild/', - { - 'Ref': 'MyProject39F7B0AE', - }, - ':*', - ], - ], - }, - ], - }, - { - 'Action': [ - 'codebuild:CreateReportGroup', - 'codebuild:CreateReport', - 'codebuild:UpdateReport', - 'codebuild:BatchPutTestCases', - 'codebuild:BatchPutCodeCoverages', - ], - 'Effect': 'Allow', - 'Resource': { - 'Fn::Join': ['', [ - 'arn:', - { 'Ref': 'AWS::Partition' }, - ':codebuild:', - { 'Ref': 'AWS::Region' }, - ':', - { 'Ref': 'AWS::AccountId' }, - ':report-group/', - { 'Ref': 'MyProject39F7B0AE' }, - '-*', - ]], - }, - }, - ], - 'Version': '2012-10-17', - }, - 'PolicyName': 'MyProjectRoleDefaultPolicyB19B7C29', - 'Roles': [ - { - 'Ref': 'MyProjectRole9BBE5233', - }, - ], - }, - }, - 'MyProject39F7B0AE': { - 'Type': 'AWS::CodeBuild::Project', - 'Properties': { - 'Artifacts': { - 'Type': 'NO_ARTIFACTS', - }, - 'Environment': { - 'ComputeType': 'BUILD_GENERAL1_MEDIUM', - 'Image': 'aws/codebuild/windows-base:2.0', - 'ImagePullCredentialsType': 'CODEBUILD', - 'PrivilegedMode': false, - 'Type': 'WINDOWS_CONTAINER', - }, - 'ServiceRole': { - 'Fn::GetAtt': [ - 'MyProjectRole9BBE5233', - 'Arn', - ], - }, - 'Source': { - 'Location': { - 'Fn::Join': [ - '', - [ - { - 'Ref': 'MyBucketF68F3FF0', - }, - '/path/to/source.zip', - ], - ], - }, - 'Type': 'S3', - }, - 'EncryptionKey': 'alias/aws/s3', - 'Cache': { - 'Type': 'NO_CACHE', - }, - }, - }, - }, - }); - }); - - test('with GitHub source', () => { - const stack = new cdk.Stack(); - - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.gitHub({ - owner: 'testowner', - repo: 'testrepo', - cloneDepth: 3, - fetchSubmodules: true, - webhook: true, - reportBuildStatus: false, - webhookFilters: [ - codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH).andTagIsNot('stable'), - codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_REOPENED).andBaseBranchIs('main'), - ], - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - Type: 'GITHUB', - Location: 'https://github.com/testowner/testrepo.git', - ReportBuildStatus: false, - GitCloneDepth: 3, - GitSubmodulesConfig: { - FetchSubmodules: true, - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Triggers: { - Webhook: true, - FilterGroups: [ - [ - { Type: 'EVENT', Pattern: 'PUSH' }, - { Type: 'HEAD_REF', Pattern: 'refs/tags/stable', ExcludeMatchedPattern: true }, - ], - [ - { Type: 'EVENT', Pattern: 'PULL_REQUEST_REOPENED' }, - { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, - ], - ], - }, - }); - }); - - test('with GitHubEnterprise source', () => { - const stack = new cdk.Stack(); - - const pushFilterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH); - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.gitHubEnterprise({ - httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', - ignoreSslErrors: true, - cloneDepth: 4, - webhook: true, - reportBuildStatus: false, - webhookFilters: [ - pushFilterGroup.andBranchIs('main'), - pushFilterGroup.andBranchIs('develop'), - pushFilterGroup.andFilePathIs('ReadMe.md'), - ], - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - Type: 'GITHUB_ENTERPRISE', - InsecureSsl: true, - GitCloneDepth: 4, - ReportBuildStatus: false, - Location: 'https://github.testcompany.com/testowner/testrepo', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Triggers: { - Webhook: true, - FilterGroups: [ - [ - { Type: 'EVENT', Pattern: 'PUSH' }, - { Type: 'HEAD_REF', Pattern: 'refs/heads/main' }, - ], - [ - { Type: 'EVENT', Pattern: 'PUSH' }, - { Type: 'HEAD_REF', Pattern: 'refs/heads/develop' }, - ], - [ - { Type: 'EVENT', Pattern: 'PUSH' }, - { Type: 'FILE_PATH', Pattern: 'ReadMe.md' }, - ], - ], - }, - }); - }); - - test('with Bitbucket source', () => { - const stack = new cdk.Stack(); - - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.bitBucket({ - owner: 'testowner', - repo: 'testrepo', - cloneDepth: 5, - reportBuildStatus: false, - webhookFilters: [ - codebuild.FilterGroup.inEventOf( - codebuild.EventAction.PULL_REQUEST_CREATED, - codebuild.EventAction.PULL_REQUEST_UPDATED, - codebuild.EventAction.PULL_REQUEST_MERGED, - ).andTagIs('v.*'), - // duplicate event actions are fine - codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PUSH).andActorAccountIsNot('aws-cdk-dev'), - ], - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - Type: 'BITBUCKET', - Location: 'https://bitbucket.org/testowner/testrepo.git', - GitCloneDepth: 5, - ReportBuildStatus: false, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Triggers: { - Webhook: true, - FilterGroups: [ - [ - { Type: 'EVENT', Pattern: 'PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_MERGED' }, - { Type: 'HEAD_REF', Pattern: 'refs/tags/v.*' }, - ], - [ - { Type: 'EVENT', Pattern: 'PUSH' }, - { Type: 'ACTOR_ACCOUNT_ID', Pattern: 'aws-cdk-dev', ExcludeMatchedPattern: true }, - ], - ], - }, - }); - }); - - test('with webhookTriggersBatchBuild option', () => { - const stack = new cdk.Stack(); - - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.gitHub({ - owner: 'testowner', - repo: 'testrepo', - webhook: true, - webhookTriggersBatchBuild: true, - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - Triggers: { - Webhook: true, - BuildType: 'BUILD_BATCH', - }, - BuildBatchConfig: { - ServiceRole: { - 'Fn::GetAtt': [ - 'ProjectBatchServiceRoleF97A1CFB', - 'Arn', - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'codebuild.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'codebuild:StartBuild', - 'codebuild:StopBuild', - 'codebuild:RetryBuild', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'ProjectC78D97AD', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - }); - - test('fail creating a Project when webhook false and webhookTriggersBatchBuild option', () => { - [false, undefined].forEach((webhook) => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.gitHub({ - owner: 'testowner', - repo: 'testrepo', - webhook, - webhookTriggersBatchBuild: true, - }), - }); - }).toThrow(/`webhookTriggersBatchBuild` cannot be used when `webhook` is `false`/); - }); - }); - - test('fail creating a Project when no build spec is given', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.Project(stack, 'MyProject', { - }); - }).toThrow(/buildSpec/); - }); - - test('with VPC configuration', () => { - const stack = new cdk.Stack(); - - const bucket = new s3.Bucket(stack, 'MyBucket'); - const vpc = new ec2.Vpc(stack, 'MyVPC'); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { - securityGroupName: 'Bob', - vpc, - allowAllOutbound: true, - description: 'Example', - }); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'path/to/source.zip', - }), - vpc, - securityGroups: [securityGroup], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'VpcConfig': { - 'SecurityGroupIds': [ - { - 'Fn::GetAtt': [ - 'SecurityGroup1F554B36F', - 'GroupId', - ], - }, - ], - 'Subnets': [ - { - 'Ref': 'MyVPCPrivateSubnet1Subnet641543F4', - }, - { - 'Ref': 'MyVPCPrivateSubnet2SubnetA420D3F0', - }, - ], - 'VpcId': { - 'Ref': 'MyVPCAFB07A31', - }, - }, - }); - - expect(project.connections).toBeDefined(); - }); - - test('without VPC configuration but security group identified', () => { - const stack = new cdk.Stack(); - - const bucket = new s3.Bucket(stack, 'MyBucket'); - const vpc = new ec2.Vpc(stack, 'MyVPC'); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { - securityGroupName: 'Bob', - vpc, - allowAllOutbound: true, - description: 'Example', - }); - - expect(() => - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'path/to/source.zip', - }), - securityGroups: [securityGroup], - }), - ).toThrow(/Cannot configure 'securityGroup' or 'allowAllOutbound' without configuring a VPC/); - }); - - test('with VPC configuration but allowAllOutbound identified', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const vpc = new ec2.Vpc(stack, 'MyVPC'); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { - securityGroupName: 'Bob', - vpc, - allowAllOutbound: true, - description: 'Example', - }); - - expect(() => - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'path/to/source.zip', - }), - vpc, - allowAllOutbound: true, - securityGroups: [securityGroup], - }), - ).toThrow(/Configure 'allowAllOutbound' directly on the supplied SecurityGroup/); - }); - - test('without passing a VPC cannot access the connections property', () => { - const stack = new cdk.Stack(); - - const project = new codebuild.PipelineProject(stack, 'MyProject'); - - expect(() => project.connections).toThrow( - /Only VPC-associated Projects have security groups to manage. Supply the "vpc" parameter when creating the Project/); - }); - - test('no KMS Key defaults to default S3 managed key', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new codebuild.PipelineProject(stack, 'MyProject'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - EncryptionKey: 'alias/aws/s3', - }); - }); - - test('with a KMS Key adds decrypt permissions to the CodeBuild Role', () => { - const stack = new cdk.Stack(); - - const key = new kms.Key(stack, 'MyKey'); - - new codebuild.PipelineProject(stack, 'MyProject', { - encryptionKey: key, - grantReportGroupPermissions: false, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ - {}, // CloudWatch logs - { - 'Action': [ - 'kms:Decrypt', - 'kms:Encrypt', - 'kms:ReEncrypt*', - 'kms:GenerateDataKey*', - ], - 'Effect': 'Allow', - 'Resource': { - 'Fn::GetAtt': [ - 'MyKey6AB29FA6', - 'Arn', - ], - }, - }, - ], - }, - 'Roles': [ - { - 'Ref': 'MyProjectRole9BBE5233', - }, - ], - }); - }); -}); - -test('using timeout and path in S3 artifacts sets it correctly', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'Bucket'); - new codebuild.Project(stack, 'Project', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - artifacts: codebuild.Artifacts.s3({ - path: 'some/path', - name: 'some_name', - bucket, - }), - timeout: cdk.Duration.minutes(123), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Artifacts': { - 'Path': 'some/path', - 'Name': 'some_name', - 'Type': 'S3', - }, - 'TimeoutInMinutes': 123, - }); -}); - -describe('secondary sources', () => { - test('require providing an identifier when creating a Project', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.Project(stack, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - secondarySources: [ - codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'path', - }), - ], - }); - }).toThrow(/identifier/); - }); - - test('are not allowed for a Project with CodePipeline as Source', () => { - const stack = new cdk.Stack(); - const project = new codebuild.PipelineProject(stack, 'MyProject'); - - project.addSecondarySource(codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'some/path', - identifier: 'id', - })); - - expect(() => Template.fromStack(stack)).toThrow(/secondary sources/); - }); - - test('added with an identifer after the Project has been created are rendered in the template', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - }); - - project.addSecondarySource(codebuild.Source.s3({ - bucket, - path: 'another/path', - identifier: 'source1', - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'SecondarySources': [ - { - 'SourceIdentifier': 'source1', - 'Type': 'S3', - }, - ], - }); - }); -}); - -describe('sources with customised build status configuration', () => { - test('GitHub', () => { - const context = 'My custom CodeBuild worker!'; - const stack = new cdk.Stack(); - const source = codebuild.Source.gitHub({ - owner: 'awslabs', - repo: 'aws-cdk', - buildStatusContext: context, - }); - - new codebuild.Project(stack, 'MyProject', { source }); - Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { - Source: { - buildStatusConfig: { - context: context, - }, - }, - }); - }); - - test('GitHub Enterprise', () => { - const context = 'My custom CodeBuild worker!'; - const stack = new cdk.Stack(); - const source = codebuild.Source.gitHubEnterprise({ - httpsCloneUrl: 'url', - buildStatusContext: context, - }); - new codebuild.Project(stack, 'MyProject', { source }); - Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { - Source: { - buildStatusConfig: { - context: context, - }, - }, - }); - }); - - test('BitBucket', () => { - const context = 'My custom CodeBuild worker!'; - const stack = new cdk.Stack(); - const source = codebuild.Source.bitBucket({ owner: 'awslabs', repo: 'aws-cdk' }); - new codebuild.Project(stack, 'MyProject', { source }); - Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { - Source: { - buildStatusConfig: { - context: context, - }, - }, - }); - }); -}); - -describe('sources with customised build status configuration', () => { - test('GitHub with targetUrl', () => { - const targetUrl = 'https://example.com'; - const stack = new cdk.Stack(); - const source = codebuild.Source.gitHub({ - owner: 'awslabs', - repo: 'aws-cdk', - buildStatusUrl: targetUrl, - }); - new codebuild.Project(stack, 'MyProject', { source }); - Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { - Source: { - buildStatusConfig: { - targetUrl: targetUrl, - }, - }, - }); - }); -}); - -describe('secondary source versions', () => { - test('allow secondary source versions', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - }); - - project.addSecondarySource(codebuild.Source.s3({ - bucket, - path: 'another/path', - identifier: 'source1', - version: 'someversion', - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'SecondarySources': [ - { - 'SourceIdentifier': 'source1', - 'Type': 'S3', - }, - ], - 'SecondarySourceVersions': [ - { - 'SourceIdentifier': 'source1', - 'SourceVersion': 'someversion', - }, - ], - }); - }); - - test('allow not to specify secondary source versions', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - }); - - project.addSecondarySource(codebuild.Source.s3({ - bucket, - path: 'another/path', - identifier: 'source1', - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'SecondarySources': [ - { - 'SourceIdentifier': 'source1', - 'Type': 'S3', - }, - ], - }); - }); -}); - -describe('fileSystemLocations', () => { - test('create fileSystemLocation and validate attributes', () => { - const stack = new cdk.Stack(); - new codebuild.Project(stack, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - fileSystemLocations: [codebuild.FileSystemLocation.efs({ - identifier: 'myidentifier2', - location: 'myclodation.mydnsroot.com:/loc', - mountPoint: '/media', - mountOptions: 'opts', - })], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'FileSystemLocations': [ - { - 'Identifier': 'myidentifier2', - 'MountPoint': '/media', - 'MountOptions': 'opts', - 'Location': 'myclodation.mydnsroot.com:/loc', - 'Type': 'EFS', - }, - ], - }); - }); - - test('Multiple fileSystemLocation created', () => { - const stack = new cdk.Stack(); - const project = new codebuild.Project(stack, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - }); - project.addFileSystemLocation(codebuild.FileSystemLocation.efs({ - identifier: 'myidentifier3', - location: 'myclodation.mydnsroot.com:/loc', - mountPoint: '/media', - mountOptions: 'opts', - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'FileSystemLocations': [ - { - 'Identifier': 'myidentifier3', - 'MountPoint': '/media', - 'MountOptions': 'opts', - 'Location': 'myclodation.mydnsroot.com:/loc', - 'Type': 'EFS', - }, - ], - }); - }); -}); - -describe('secondary artifacts', () => { - test('require providing an identifier when creating a Project', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.Project(stack, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - }), - secondaryArtifacts: [ - codebuild.Artifacts.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'some/path', - name: 'name', - }), - ], - }); - }).toThrow(/identifier/); - }); - - test('are not allowed for a Project with CodePipeline as Source', () => { - const stack = new cdk.Stack(); - const project = new codebuild.PipelineProject(stack, 'MyProject'); - - project.addSecondaryArtifact(codebuild.Artifacts.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'some/path', - name: 'name', - identifier: 'id', - })); - - expect(() => Template.fromStack(stack)).toThrow(/secondary artifacts/); - }); - - test('added with an identifier after the Project has been created are rendered in the template', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - }); - - project.addSecondaryArtifact(codebuild.Artifacts.s3({ - bucket, - path: 'another/path', - name: 'name', - identifier: 'artifact1', - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'SecondaryArtifacts': [ - { - 'ArtifactIdentifier': 'artifact1', - 'Type': 'S3', - }, - ], - }); - }); - - test('disabledEncryption is set', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - }); - - project.addSecondaryArtifact(codebuild.Artifacts.s3({ - bucket, - path: 'another/path', - name: 'name', - identifier: 'artifact1', - encryption: false, - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'SecondaryArtifacts': [ - { - 'ArtifactIdentifier': 'artifact1', - 'EncryptionDisabled': true, - }, - ], - }); - }); -}); - -describe('artifacts', () => { - describe('CodePipeline', () => { - test('both source and artifacs are set to CodePipeline', () => { - const stack = new cdk.Stack(); - - new codebuild.PipelineProject(stack, 'MyProject'); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Source': { - 'Type': 'CODEPIPELINE', - }, - 'Artifacts': { - 'Type': 'CODEPIPELINE', - }, - 'ServiceRole': { - 'Fn::GetAtt': [ - 'MyProjectRole9BBE5233', - 'Arn', - ], - }, - 'Environment': { - 'Type': 'LINUX_CONTAINER', - 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', - 'ImagePullCredentialsType': 'CODEBUILD', - 'ComputeType': 'BUILD_GENERAL1_SMALL', - }, - }); - }); - }); - - describe('S3', () => { - test('name is not set so use buildspec', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - artifacts: codebuild.Artifacts.s3({ - bucket, - path: 'another/path', - identifier: 'artifact1', - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Artifacts': { - 'Name': Match.absent(), - 'ArtifactIdentifier': 'artifact1', - 'OverrideArtifactName': true, - }, - }); - }); - - test('name is set so use it', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket, - path: 'some/path', - }), - artifacts: codebuild.Artifacts.s3({ - bucket, - path: 'another/path', - name: 'specificname', - identifier: 'artifact1', - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Artifacts': { - 'ArtifactIdentifier': 'artifact1', - 'Name': 'specificname', - 'OverrideArtifactName': Match.absent(), - }, - }); - }); - }); -}); - -test('events', () => { - const stack = new cdk.Stack(); - const project = new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'path', - }), - }); - - project.onBuildFailed('OnBuildFailed', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); - project.onBuildSucceeded('OnBuildSucceeded', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); - project.onPhaseChange('OnPhaseChange', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); - project.onStateChange('OnStateChange', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); - project.onBuildStarted('OnBuildStarted', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - 'EventPattern': { - 'source': [ - 'aws.codebuild', - ], - 'detail-type': [ - 'CodeBuild Build State Change', - ], - 'detail': { - 'project-name': [ - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - 'build-status': [ - 'FAILED', - ], - }, - }, - 'State': 'ENABLED', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - 'EventPattern': { - 'source': [ - 'aws.codebuild', - ], - 'detail-type': [ - 'CodeBuild Build State Change', - ], - 'detail': { - 'project-name': [ - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - 'build-status': [ - 'SUCCEEDED', - ], - }, - }, - 'State': 'ENABLED', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - 'EventPattern': { - 'source': [ - 'aws.codebuild', - ], - 'detail-type': [ - 'CodeBuild Build Phase Change', - ], - 'detail': { - 'project-name': [ - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - }, - }, - 'State': 'ENABLED', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - 'EventPattern': { - 'source': [ - 'aws.codebuild', - ], - 'detail-type': [ - 'CodeBuild Build State Change', - ], - 'detail': { - 'project-name': [ - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - }, - }, - 'State': 'ENABLED', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - 'EventPattern': { - 'source': [ - 'aws.codebuild', - ], - 'detail-type': [ - 'CodeBuild Build State Change', - ], - 'detail': { - 'project-name': [ - { - 'Ref': 'MyProject39F7B0AE', - }, - ], - 'build-status': [ - 'IN_PROGRESS', - ], - }, - }, - 'State': 'ENABLED', - }); -}); - -test('environment variables can be overridden at the project level', () => { - const stack = new cdk.Stack(); - - new codebuild.PipelineProject(stack, 'Project', { - environment: { - environmentVariables: { - FOO: { value: '1234' }, - BAR: { value: `111${cdk.Token.asString({ twotwotwo: '222' })}`, type: codebuild.BuildEnvironmentVariableType.PARAMETER_STORE }, - }, - }, - environmentVariables: { - GOO: { value: 'ABC' }, - FOO: { value: 'OVERRIDE!' }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Source': { - 'Type': 'CODEPIPELINE', - }, - 'Artifacts': { - 'Type': 'CODEPIPELINE', - }, - 'ServiceRole': { - 'Fn::GetAtt': [ - 'ProjectRole4CCB274E', - 'Arn', - ], - }, - 'Environment': { - 'Type': 'LINUX_CONTAINER', - 'EnvironmentVariables': [ - { - 'Type': 'PLAINTEXT', - 'Value': 'OVERRIDE!', - 'Name': 'FOO', - }, - { - 'Type': 'PARAMETER_STORE', - 'Value': { - 'Fn::Join': [ - '', - [ - '111', - { twotwotwo: '222' }, - ], - ], - }, - 'Name': 'BAR', - }, - { - 'Type': 'PLAINTEXT', - 'Value': 'ABC', - 'Name': 'GOO', - }, - ], - 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', - 'ImagePullCredentialsType': 'CODEBUILD', - 'ComputeType': 'BUILD_GENERAL1_SMALL', - }, - }); -}); - -test('.metricXxx() methods can be used to obtain Metrics for CodeBuild projects', () => { - const stack = new cdk.Stack(); - - const project = new codebuild.Project(stack, 'MyBuildProject', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'path', - }), - }); - - const metricBuilds = project.metricBuilds(); - expect(metricBuilds.dimensions!.ProjectName).toEqual(project.projectName); - expect(metricBuilds.namespace).toEqual('AWS/CodeBuild'); - expect(metricBuilds.statistic).toEqual('Sum'); - expect(metricBuilds.metricName).toEqual('Builds'); - - const metricDuration = project.metricDuration({ label: 'hello' }); - - expect(metricDuration.metricName).toEqual('Duration'); - expect(metricDuration.label).toEqual('hello'); - - expect(project.metricFailedBuilds().metricName).toEqual('FailedBuilds'); - expect(project.metricSucceededBuilds().metricName).toEqual('SucceededBuilds'); -}); - -test('using ComputeType.Small with a Windows image fails validation', () => { - const stack = new cdk.Stack(); - const invalidEnvironment: codebuild.BuildEnvironment = { - buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0, - computeType: codebuild.ComputeType.SMALL, - }; - - expect(() => { - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'MyBucket'), - path: 'path', - }), - environment: invalidEnvironment, - }); - }).toThrow(/Windows images do not support the Small ComputeType/); -}); - -test('fromCodebuildImage', () => { - const stack = new cdk.Stack(); - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.fromCodeBuildImageId('aws/codebuild/standard:4.0'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Environment': { - 'Image': 'aws/codebuild/standard:4.0', - }, - }); -}); - -describe('Windows2019 image', () => { - describe('WIN_SERVER_CORE_2016_BASE', () => { - test('has type WINDOWS_SERVER_2019_CONTAINER and default ComputeType MEDIUM', () => { - const stack = new cdk.Stack(); - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Environment': { - 'Type': 'WINDOWS_SERVER_2019_CONTAINER', - 'ComputeType': 'BUILD_GENERAL1_MEDIUM', - }, - }); - }); - }); -}); - -describe('ARM image', () => { - describe('AMAZON_LINUX_2_ARM', () => { - test('has type ARM_CONTAINER and default ComputeType LARGE', () => { - const stack = new cdk.Stack(); - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Environment': { - 'Type': 'ARM_CONTAINER', - 'ComputeType': 'BUILD_GENERAL1_LARGE', - }, - }); - }); - - test('can be used with ComputeType SMALL', () => { - const stack = new cdk.Stack(); - new codebuild.PipelineProject(stack, 'Project', { - environment: { - computeType: codebuild.ComputeType.SMALL, - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Environment': { - 'Type': 'ARM_CONTAINER', - 'ComputeType': 'BUILD_GENERAL1_SMALL', - }, - }); - }); - - test('cannot be used in conjunction with ComputeType MEDIUM', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - computeType: codebuild.ComputeType.MEDIUM, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/); - }); - - test('can be used with ComputeType LARGE', () => { - const stack = new cdk.Stack(); - new codebuild.PipelineProject(stack, 'Project', { - environment: { - computeType: codebuild.ComputeType.LARGE, - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Environment': { - 'Type': 'ARM_CONTAINER', - 'ComputeType': 'BUILD_GENERAL1_LARGE', - }, - }); - }); - - test('cannot be used in conjunction with ComputeType X2_LARGE', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - computeType: codebuild.ComputeType.X2_LARGE, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/); - }); - }); -}); - -test('badge support test', () => { - const stack = new cdk.Stack(); - - interface BadgeValidationTestCase { - source: codebuild.Source, - allowsBadge: boolean - } - - const repo = new codecommit.Repository(stack, 'MyRepo', { - repositoryName: 'hello-cdk', - }); - const bucket = new s3.Bucket(stack, 'MyBucket'); - - const cases: BadgeValidationTestCase[] = [ - { source: new NoSource(), allowsBadge: false }, - { source: new CodePipelineSource(), allowsBadge: false }, - { source: codebuild.Source.codeCommit({ repository: repo }), allowsBadge: true }, - { source: codebuild.Source.s3({ bucket, path: 'path/to/source.zip' }), allowsBadge: false }, - { source: codebuild.Source.gitHub({ owner: 'awslabs', repo: 'aws-cdk' }), allowsBadge: true }, - { source: codebuild.Source.gitHubEnterprise({ httpsCloneUrl: 'url' }), allowsBadge: true }, - { source: codebuild.Source.bitBucket({ owner: 'awslabs', repo: 'aws-cdk' }), allowsBadge: true }, - ]; - - cases.forEach(testCase => { - const source = testCase.source; - const validationBlock = () => { new codebuild.Project(stack, `MyProject-${source.type}`, { source, badge: true }); }; - if (testCase.allowsBadge) { - expect(validationBlock).not.toThrow(); - } else { - expect(validationBlock).toThrow(/Badge is not supported for source type /); - } - }); -}); - -describe('webhook Filters', () => { - test('a Group cannot be created with an empty set of event actions', () => { - expect(() => { - codebuild.FilterGroup.inEventOf(); - }).toThrow(/A filter group must contain at least one event action/); - }); - - test('cannot have base ref conditions if the Group contains the PUSH action', () => { - const filterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_CREATED, - codebuild.EventAction.PUSH); - - expect(() => { - filterGroup.andBaseRefIs('.*'); - }).toThrow(/A base reference condition cannot be added if a Group contains a PUSH event action/); - }); - - test('cannot be used when webhook is false', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.bitBucket({ - owner: 'owner', - repo: 'repo', - webhook: false, - webhookFilters: [ - codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH), - ], - }), - }); - }).toThrow(/`webhookFilters` cannot be used when `webhook` is `false`/); - }); - - test('can have FILE_PATH filters if the Group contains PUSH and PR_CREATED events', () => { - codebuild.FilterGroup.inEventOf( - codebuild.EventAction.PULL_REQUEST_CREATED, - codebuild.EventAction.PUSH) - .andFilePathIsNot('.*\\.java'); - }); - - test('BitBucket sources do not support the PULL_REQUEST_REOPENED event action', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.bitBucket({ - owner: 'owner', - repo: 'repo', - webhookFilters: [ - codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_REOPENED), - ], - }), - }); - }).toThrow(/BitBucket sources do not support the PULL_REQUEST_REOPENED webhook event action/); - }); - - test('BitBucket sources support file path conditions', () => { - const stack = new cdk.Stack(); - const filterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH).andFilePathIs('.*'); - - expect(() => { - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.bitBucket({ - owner: 'owner', - repo: 'repo', - webhookFilters: [filterGroup], - }), - }); - }).not.toThrow(); - }); - - test('GitHub Enterprise Server sources do not support FILE_PATH filters on PR events', () => { - const stack = new cdk.Stack(); - const pullFilterGroup = codebuild.FilterGroup.inEventOf( - codebuild.EventAction.PULL_REQUEST_CREATED, - codebuild.EventAction.PULL_REQUEST_MERGED, - codebuild.EventAction.PULL_REQUEST_REOPENED, - codebuild.EventAction.PULL_REQUEST_UPDATED, - ); - - expect(() => { - new codebuild.Project(stack, 'MyFilePathProject', { - source: codebuild.Source.gitHubEnterprise({ - httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', - webhookFilters: [ - pullFilterGroup.andFilePathIs('ReadMe.md'), - ], - }), - }); - }).toThrow(/FILE_PATH filters cannot be used with GitHub Enterprise Server pull request events/); - }); - - describe('COMMIT_MESSAGE Filter', () => { - test('GitHub Enterprise Server sources do not support COMMIT_MESSAGE filters on PR events', () => { - const stack = new cdk.Stack(); - const pullFilterGroup = codebuild.FilterGroup.inEventOf( - codebuild.EventAction.PULL_REQUEST_CREATED, - codebuild.EventAction.PULL_REQUEST_MERGED, - codebuild.EventAction.PULL_REQUEST_REOPENED, - codebuild.EventAction.PULL_REQUEST_UPDATED, - ); - - expect(() => { - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.gitHubEnterprise({ - httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', - webhookFilters: [ - pullFilterGroup.andCommitMessageIs('the commit message'), - ], - }), - }); - }).toThrow(/COMMIT_MESSAGE filters cannot be used with GitHub Enterprise Server pull request events/); - }); - - test('GitHub Enterprise Server sources support COMMIT_MESSAGE filters on PUSH events', () => { - const stack = new cdk.Stack(); - const pushFilterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH); - - expect(() => { - new codebuild.Project(stack, 'MyProject', { - source: codebuild.Source.gitHubEnterprise({ - httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', - webhookFilters: [ - pushFilterGroup.andCommitMessageIs('the commit message'), - ], - }), - }); - }).not.toThrow(); - }); - - test('BitBucket and GitHub sources support a COMMIT_MESSAGE filter', () => { - const stack = new cdk.Stack(); - const filterGroup = codebuild - .FilterGroup - .inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PULL_REQUEST_CREATED) - .andCommitMessageIs('the commit message'); - - expect(() => { - new codebuild.Project(stack, 'BitBucket Project', { - source: codebuild.Source.bitBucket({ - owner: 'owner', - repo: 'repo', - webhookFilters: [filterGroup], - }), - }); - new codebuild.Project(stack, 'GitHub Project', { - source: codebuild.Source.gitHub({ - owner: 'owner', - repo: 'repo', - webhookFilters: [filterGroup], - }), - }); - }).not.toThrow(); - }); - }); -}); - -test('enableBatchBuilds()', () => { - const stack = new cdk.Stack(); - - const project = new codebuild.Project(stack, 'Project', { - source: codebuild.Source.gitHub({ - owner: 'testowner', - repo: 'testrepo', - }), - }); - - const returnVal = project.enableBatchBuilds(); - if (!returnVal?.role) { - throw new Error('Expecting return value with role'); - } - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - BuildBatchConfig: { - ServiceRole: { - 'Fn::GetAtt': [ - 'ProjectBatchServiceRoleF97A1CFB', - 'Arn', - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'codebuild.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'codebuild:StartBuild', - 'codebuild:StopBuild', - 'codebuild:RetryBuild', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'ProjectC78D97AD', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); -}); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts b/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts deleted file mode 100644 index f2436d6cc4504..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/integ.caching.ts +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env node -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; -import { Cache } from '../lib/cache'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-codebuild'); - -const bucket = new s3.Bucket(stack, 'CacheBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -new codebuild.Project(stack, 'MyProject', { - cache: Cache.bucket(bucket), - buildSpec: codebuild.BuildSpec.fromObject({ - build: { - commands: ['echo Hello'], - }, - cache: { - paths: ['/root/.cache/pip/**/*'], - }, - }), - grantReportGroupPermissions: false, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.ts b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.ts deleted file mode 100644 index 34b27dcd5fc07..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - /// !show - new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - 'echo "Hello, CodeBuild!"', - ], - }, - }, - }), - }); - /// !hide - } -} - -const app = new cdk.App(); - -new TestStack(app, 'codebuild-default-project'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.ts b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.ts deleted file mode 100644 index 34b254899b9e9..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: ['ls'], - }, - }, - }), - grantReportGroupPermissions: false, - /// !show - environment: { - buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'MyImage', { - directory: path.join(__dirname, 'demo-image'), - }), - }, - /// !hide - }); - } -} - -const app = new cdk.App(); - -new TestStack(app, 'test-codebuild-docker-asset'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.ts b/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.ts deleted file mode 100644 index 916f51b07b1f5..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - const secrets = secretsmanager.Secret.fromSecretCompleteArn(this, 'MySecrets', - `arn:aws:secretsmanager:${this.region}:${this.account}:secret:my-secrets-123456`); - - new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: ['ls'], - }, - }, - }), - grantReportGroupPermissions: false, - /// !show - environment: { - buildImage: codebuild.LinuxBuildImage.fromDockerRegistry('my-registry/my-repo', { - secretsManagerCredentials: secrets, - }), - }, - /// !hide - }); - } -} - -const app = new cdk.App(); - -new TestStack(app, 'test-codebuild-docker-asset'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.ts b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.ts deleted file mode 100644 index b3b89309d5852..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - const ecrRepository = new ecr.Repository(this, 'MyRepo'); - - new codebuild.Project(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: ['ls'], - }, - }, - }), - grantReportGroupPermissions: false, - /// !show - environment: { - buildImage: codebuild.LinuxBuildImage.fromEcrRepository(ecrRepository, 'v1.0'), - }, - /// !hide - }); - } -} - -const app = new cdk.App(); - -new TestStack(app, 'test-codebuild-docker-asset'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.ts b/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.ts deleted file mode 100644 index b0134178bac30..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-codebuild-logging'); - -new codebuild.PipelineProject(stack, 'Project', { - logging: { - cloudWatch: { - logGroup: new logs.LogGroup(stack, 'LogingGroup', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - }), - }, - s3: { - bucket: new s3.Bucket(stack, 'LoggingBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - }), - }, - }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/notification-rule.test.ts b/packages/@aws-cdk/aws-codebuild/test/notification-rule.test.ts deleted file mode 100644 index e0dc908185427..0000000000000 --- a/packages/@aws-cdk/aws-codebuild/test/notification-rule.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as codebuild from '../lib'; - -test('notifications rule', () => { - const stack = new cdk.Stack(); - const project = new codebuild.Project(stack, 'MyCodebuildProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - 'echo "Hello, CodeBuild!"', - ], - }, - }, - }), - }); - - const target = new sns.Topic(stack, 'MyTopic'); - - project.notifyOnBuildSucceeded('NotifyOnBuildSucceeded', target); - - project.notifyOnBuildFailed('NotifyOnBuildFailed', target); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyCodebuildProjectNotifyOnBuildSucceeded77719592', - DetailType: 'FULL', - EventTypeIds: [ - 'codebuild-project-build-state-succeeded', - ], - Resource: { - 'Fn::GetAtt': [ - 'MyCodebuildProjectB0479580', - 'Arn', - ], - }, - Targets: [ - { - TargetAddress: { - Ref: 'MyTopic86869434', - }, - TargetType: 'SNS', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyCodebuildProjectNotifyOnBuildFailedF680E310', - DetailType: 'FULL', - EventTypeIds: [ - 'codebuild-project-build-state-failed', - ], - Resource: { - 'Fn::GetAtt': [ - 'MyCodebuildProjectB0479580', - 'Arn', - ], - }, - Targets: [ - { - TargetAddress: { - Ref: 'MyTopic86869434', - }, - TargetType: 'SNS', - }, - ], - }); -}); diff --git a/packages/@aws-cdk/aws-codecommit/.eslintrc.js b/packages/@aws-cdk/aws-codecommit/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codecommit/.gitignore b/packages/@aws-cdk/aws-codecommit/.gitignore deleted file mode 100644 index e025f81c8fde3..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -*.generated.ts -dist -tsconfig.json -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codecommit/.npmignore b/packages/@aws-cdk/aws-codecommit/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codecommit/LICENSE b/packages/@aws-cdk/aws-codecommit/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codecommit/NOTICE b/packages/@aws-cdk/aws-codecommit/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codecommit/README.md b/packages/@aws-cdk/aws-codecommit/README.md deleted file mode 100644 index b4f9c25715ffe..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# AWS CodeCommit Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -AWS CodeCommit is a version control service that enables you to privately store and manage Git repositories in the AWS cloud. - -For further information on CodeCommit, -see the [AWS CodeCommit documentation](https://docs.aws.amazon.com/codecommit). - -To add a CodeCommit Repository to your stack: - -```ts -const repo = new codecommit.Repository(this, 'Repository', { - repositoryName: 'MyRepositoryName', - description: 'Some description.', // optional property -}); -``` - -Use the `repositoryCloneUrlHttp`, `repositoryCloneUrlSsh` or `repositoryCloneUrlGrc` -property to clone your repository. - -To add an Amazon SNS trigger to your repository: - -```ts -declare const repo: codecommit.Repository; - -// trigger is established for all repository actions on all branches by default. -repo.notify('arn:aws:sns:*:123456789012:my_topic'); -``` - -## Add initial commit - -It is possible to initialize the Repository via the `Code` class. -It provides methods for loading code from a directory, `.zip` file and from a pre-created CDK Asset. - -Example: - -```ts -const repo = new codecommit.Repository(this, 'Repository', { - repositoryName: 'MyRepositoryName', - code: codecommit.Code.fromDirectory(path.join(__dirname, 'directory/'), 'develop'), // optional property, branch parameter can be omitted -}); -``` - -## Events - -CodeCommit repositories emit Amazon CloudWatch events for certain activities. -Use the `repo.onXxx` methods to define rules that trigger on these events -and invoke targets as a result: - -```ts -import * as sns from '@aws-cdk/aws-sns'; -import * as targets from '@aws-cdk/aws-events-targets'; - -declare const repo: codecommit.Repository; -declare const project: codebuild.PipelineProject; -declare const myTopic: sns.Topic; - -// starts a CodeBuild project when a commit is pushed to the "main" branch of the repo -repo.onCommit('CommitToMain', { - target: new targets.CodeBuildProject(project), - branches: ['main'], -}); - -// publishes a message to an Amazon SNS topic when a comment is made on a pull request -const rule = repo.onCommentOnPullRequest('CommentOnPullRequest', { - target: new targets.SnsTopic(myTopic), -}); -``` - -## CodeStar Notifications - -To define CodeStar Notification rules for Repositories, use one of the `notifyOnXxx()` methods. -They are very similar to `onXxx()` methods for CloudWatch events: - -```ts -import * as chatbot from '@aws-cdk/aws-chatbot'; - -declare const repository: codecommit.Repository; -const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { - slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', - slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', - slackChannelId: 'YOUR_SLACK_CHANNEL_ID', -}); -const rule = repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); -``` diff --git a/packages/@aws-cdk/aws-codecommit/jest.config.js b/packages/@aws-cdk/aws-codecommit/jest.config.js deleted file mode 100644 index 7c2e6abe4d7ed..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 55, - statements: 60 - } - } -}; diff --git a/packages/@aws-cdk/aws-codecommit/lib/code.ts b/packages/@aws-cdk/aws-codecommit/lib/code.ts deleted file mode 100644 index fde5d85cb25f4..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/lib/code.ts +++ /dev/null @@ -1,104 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import * as assets from '@aws-cdk/aws-s3-assets'; -import { Construct } from 'constructs'; -import { CfnRepository } from './codecommit.generated'; - -/** - * Represents the structure to pass into the underlying CfnRepository class. - */ -export interface CodeConfig { - /** - * represents the underlying code structure - */ - readonly code: CfnRepository.CodeProperty; -} - -/** - * Represents the contents to initialize the repository with. - */ -export abstract class Code { - /** - * Code from directory. - * @param directoryPath the path to the local directory containing the contents to initialize the repository with - * @param branch the name of the branch to create in the repository. Default is "main" - */ - public static fromDirectory(directoryPath: string, branch?: string): Code { - const resolvedPath = path.resolve(directoryPath); - - const statResult = fs.statSync(resolvedPath); - if (!statResult || !statResult.isDirectory()) { - throw new Error(`'${directoryPath}' needs to be a path to a directory (resolved to: '${resolvedPath }')`); - } - - return new PathResolvedCode(resolvedPath, branch); - } - - /** - * Code from preexisting ZIP file. - * @param filePath the path to the local ZIP file containing the contents to initialize the repository with - * @param branch the name of the branch to create in the repository. Default is "main" - */ - public static fromZipFile(filePath: string, branch?: string): Code { - const resolvedPath = path.resolve(filePath); - - const statResult = fs.statSync(resolvedPath); - if (!statResult || !statResult.isFile()) { - throw new Error(`'${filePath}' needs to be a path to a ZIP file (resolved to: '${resolvedPath }')`); - } - - return new PathResolvedCode(resolvedPath, branch); - } - - /** - * Code from user-supplied asset. - * @param asset pre-existing asset - * @param branch the name of the branch to create in the repository. Default is "main" - */ - public static fromAsset(asset: assets.Asset, branch?: string): Code { - return new AssetCode(asset, branch); - } - - /** - * This method is called after a repository is passed this instance of Code in its 'code' property. - * - * @param scope the binding scope - */ - public abstract bind(scope: Construct): CodeConfig; -} - -class PathResolvedCode extends Code { - constructor(private readonly resolvedPath: string, private readonly branch?: string) { - super(); - } - - public bind(scope: Construct): CodeConfig { - const asset = new assets.Asset(scope, 'PathResolvedCodeAsset', { - path: this.resolvedPath, - }); - - return (new AssetCode(asset, this.branch)).bind(scope); - } -} - -class AssetCode extends Code { - constructor(private readonly asset: assets.Asset, private readonly branch?: string) { - super(); - } - - public bind(_scope: Construct): CodeConfig { - if (!this.asset.isZipArchive) { - throw new Error('Asset must be a .zip file or a directory (resolved to: ' + this.asset.assetPath + ' )'); - } - - return { - code: { - branchName: this.branch, - s3: { - bucket: this.asset.s3BucketName, - key: this.asset.s3ObjectKey, - }, - }, - }; - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/lib/events.ts b/packages/@aws-cdk/aws-codecommit/lib/events.ts deleted file mode 100644 index 0b57d6aa6b7d4..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/lib/events.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; - -/** - * Fields of CloudWatch Events that change references - * - * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#codebuild_event_type - */ -export class ReferenceEvent { - /** - * The type of reference event - * - * 'referenceCreated', 'referenceUpdated' or 'referenceDeleted' - */ - public static get eventType() { - return events.EventField.fromPath('$.detail.event'); - } - - /** - * Name of the CodeCommit repository - */ - public static get repositoryName() { - return events.EventField.fromPath('$.detail.repositoryName'); - } - - /** - * Id of the CodeCommit repository - */ - public static get repositoryId() { - return events.EventField.fromPath('$.detail.repositoryId'); - } - - /** - * Type of reference changed - * - * 'branch' or 'tag' - */ - public static get referenceType() { - return events.EventField.fromPath('$.detail.referenceType'); - } - - /** - * Name of reference changed (branch or tag name) - */ - public static get referenceName() { - return events.EventField.fromPath('$.detail.referenceName'); - } - - /** - * Full reference name - * - * For example, 'refs/tags/myTag' - */ - public static get referenceFullName() { - return events.EventField.fromPath('$.detail.referenceFullName'); - } - - /** - * Commit id this reference now points to - */ - public static get commitId() { - return events.EventField.fromPath('$.detail.commitId'); - } - - private constructor() { - } -} diff --git a/packages/@aws-cdk/aws-codecommit/lib/repository.ts b/packages/@aws-cdk/aws-codecommit/lib/repository.ts deleted file mode 100644 index 9041cd5602056..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/lib/repository.ts +++ /dev/null @@ -1,723 +0,0 @@ -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Code } from './code'; -import { CfnRepository } from './codecommit.generated'; - -/** - * Additional options to pass to the notification rule. - */ -export interface RepositoryNotifyOnOptions extends notifications.NotificationRuleOptions { - /** - * A list of event types associated with this notification rule for CodeCommit repositories. - * For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide. - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api - */ - readonly events: RepositoryNotificationEvents[]; -} - -export interface IRepository extends IResource, notifications.INotificationRuleSource { - /** - * The ARN of this Repository. - * @attribute - */ - readonly repositoryArn: string; - - /** - * The human-visible name of this Repository. - * @attribute - */ - readonly repositoryName: string; - - /** - * The HTTP clone URL. - * @attribute - */ - readonly repositoryCloneUrlHttp: string; - - /** - * The SSH clone URL. - * @attribute - */ - readonly repositoryCloneUrlSsh: string; - - /** - * The HTTPS (GRC) clone URL. - * - * HTTPS (GRC) is the protocol to use with git-remote-codecommit (GRC). - * - * It is the recommended method for supporting connections made with federated - * access, identity providers, and temporary credentials. - * - * @see https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html - */ - readonly repositoryCloneUrlGrc: string; - - /** - * Defines a CloudWatch event rule which triggers for repository events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - onEvent(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a "CodeCommit - * Repository State Change" event occurs. - */ - onStateChange(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a reference is - * created (i.e. a new branch/tag is created) to the repository. - */ - onReferenceCreated(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a reference is - * updated (i.e. a commit is pushed to an existing or new branch) from the repository. - */ - onReferenceUpdated(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a reference is - * delete (i.e. a branch/tag is deleted) from the repository. - */ - onReferenceDeleted(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a pull request state is changed. - */ - onPullRequestStateChange(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a comment is made on a pull request. - */ - onCommentOnPullRequest(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a comment is made on a commit. - */ - onCommentOnCommit(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers when a commit is pushed to a branch. - */ - onCommit(id: string, options?: OnCommitOptions): events.Rule; - - /** - * Grant the given principal identity permissions to perform the actions on this repository. - */ - grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant; - - /** - * Grant the given identity permissions to pull this repository. - */ - grantPull(grantee: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity permissions to pull and push this repository. - */ - grantPullPush(grantee: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity permissions to read this repository. - */ - grantRead(grantee: iam.IGrantable): iam.Grant; - - /** - * Defines a CodeStar Notification rule triggered when the project - * events specified by you are emitted. Similar to `onEvent` API. - * - * You can also use the methods to define rules for the specific event emitted. - * eg: `notifyOnPullRequstCreated`. - * - * @returns CodeStar Notifications rule associated with this repository. - */ - notifyOn( - id: string, - target: notifications.INotificationRuleTarget, - options: RepositoryNotifyOnOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when a comment is made on a pull request. - */ - notifyOnPullRequestComment( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when an approval status is changed. - */ - notifyOnApprovalStatusChanged( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when an approval rule is overridden. - */ - notifyOnApprovalRuleOverridden( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when a pull request is created. - */ - notifyOnPullRequestCreated( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when a pull request is merged. - * @deprecated this method has a typo in its name, use notifyOnPullRequestMerged instead - */ - notifiyOnPullRequestMerged( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when a pull request is merged. - */ - notifyOnPullRequestMerged( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when a new branch or tag is created. - */ - notifyOnBranchOrTagCreated( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Defines a CodeStar Notification rule which triggers when a branch or tag is deleted. - */ - notifyOnBranchOrTagDeleted( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; -} - -/** - * Options for the onCommit() method. - */ -export interface OnCommitOptions extends events.OnEventOptions { - /** - * The branch to monitor. - * - * @default - All branches - */ - readonly branches?: string[]; -} - -/** - * Represents a reference to a CodeCommit Repository. - * - * If you want to create a new Repository managed alongside your CDK code, - * use the `Repository` class. - * - * If you want to reference an already existing Repository, - * use the `Repository.import` method. - */ -abstract class RepositoryBase extends Resource implements IRepository { - /** The ARN of this Repository. */ - public abstract readonly repositoryArn: string; - - /** The human-visible name of this Repository. */ - public abstract readonly repositoryName: string; - - /** The HTTP clone URL */ - public abstract readonly repositoryCloneUrlHttp: string; - - /** The SSH clone URL */ - public abstract readonly repositoryCloneUrlSsh: string; - - public abstract readonly repositoryCloneUrlGrc: string; - - /** - * Defines a CloudWatch event rule which triggers for repository events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - public onEvent(id: string, options: events.OnEventOptions = {}) { - const rule = new events.Rule(this, id, options); - rule.addEventPattern({ - source: ['aws.codecommit'], - resources: [this.repositoryArn], - }); - rule.addTarget(options.target); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a "CodeCommit - * Repository State Change" event occurs. - */ - public onStateChange(id: string, options: events.OnEventOptions = {}) { - const rule = this.onEvent(id, options); - rule.addEventPattern({ - detailType: ['CodeCommit Repository State Change'], - }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a reference is - * created (i.e. a new branch/tag is created) to the repository. - */ - public onReferenceCreated(id: string, options: events.OnEventOptions = {}) { - const rule = this.onStateChange(id, options); - rule.addEventPattern({ detail: { event: ['referenceCreated'] } }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a reference is - * updated (i.e. a commit is pushed to an existing or new branch) from the repository. - */ - public onReferenceUpdated(id: string, options: events.OnEventOptions = {}) { - const rule = this.onStateChange(id, options); - rule.addEventPattern({ detail: { event: ['referenceCreated', 'referenceUpdated'] } }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a reference is - * delete (i.e. a branch/tag is deleted) from the repository. - */ - public onReferenceDeleted(id: string, options: events.OnEventOptions = {}) { - const rule = this.onStateChange(id, options); - rule.addEventPattern({ detail: { event: ['referenceDeleted'] } }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a pull request state is changed. - */ - public onPullRequestStateChange(id: string, options: events.OnEventOptions = {}) { - const rule = this.onEvent(id, options); - rule.addEventPattern({ detailType: ['CodeCommit Pull Request State Change'] }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a comment is made on a pull request. - */ - public onCommentOnPullRequest(id: string, options: events.OnEventOptions = {}) { - const rule = this.onEvent(id, options); - rule.addEventPattern({ detailType: ['CodeCommit Comment on Pull Request'] }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a comment is made on a commit. - */ - public onCommentOnCommit(id: string, options: events.OnEventOptions = {}) { - const rule = this.onEvent(id, options); - rule.addEventPattern({ detailType: ['CodeCommit Comment on Commit'] }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers when a commit is pushed to a branch. - */ - public onCommit(id: string, options: OnCommitOptions = {}) { - const rule = this.onReferenceUpdated(id, options); - if (options.branches) { - rule.addEventPattern({ detail: { referenceName: options.branches } }); - } - return rule; - } - - public grant(grantee: iam.IGrantable, ...actions: string[]) { - return iam.Grant.addToPrincipal({ - grantee, - actions, - resourceArns: [this.repositoryArn], - }); - } - - public grantPull(grantee: iam.IGrantable) { - return this.grant(grantee, 'codecommit:GitPull'); - } - - public grantPullPush(grantee: iam.IGrantable) { - this.grantPull(grantee); - return this.grant(grantee, 'codecommit:GitPush'); - } - - public grantRead(grantee: iam.IGrantable) { - this.grantPull(grantee); - return this.grant(grantee, - 'codecommit:EvaluatePullRequestApprovalRules', - 'codecommit:Get*', - 'codecommit:Describe*', - ); - } - - public notifyOn( - id: string, - target: notifications.INotificationRuleTarget, - options: RepositoryNotifyOnOptions, - ): notifications.INotificationRule { - return new notifications.NotificationRule(this, id, { - ...options, - source: this, - targets: [target], - }); - } - - public notifyOnPullRequestComment( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.PULL_REQUEST_COMMENT], - }); - } - - public notifyOnApprovalStatusChanged( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.APPROVAL_STATUS_CHANGED], - }); - } - - public notifyOnApprovalRuleOverridden( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.APPROVAL_RULE_OVERRIDDEN], - }); - } - - public notifyOnPullRequestCreated( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.PULL_REQUEST_CREATED], - }); - } - - public notifiyOnPullRequestMerged( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOnPullRequestMerged(id, target, options); - } - - public notifyOnPullRequestMerged( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.PULL_REQUEST_MERGED], - }); - } - - public notifyOnBranchOrTagCreated( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.BRANCH_OR_TAG_CREATED], - }); - } - - public notifyOnBranchOrTagDeleted( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [RepositoryNotificationEvents.BRANCH_OR_TAG_DELETED], - }); - } - - public bindAsNotificationRuleSource(_scope: Construct): notifications.NotificationRuleSourceConfig { - return { - sourceArn: this.repositoryArn, - }; - } -} - -export interface RepositoryProps { - /** - * Name of the repository. - * - * This property is required for all CodeCommit repositories. - */ - readonly repositoryName: string; - - /** - * A description of the repository. Use the description to identify the - * purpose of the repository. - * - * @default - No description. - */ - readonly description?: string; - - /** - * The contents with which to initialize the repository after it has been created. - * - * @default - No initialization (create empty repo) - */ - readonly code?: Code; -} - -/** - * Provides a CodeCommit Repository. - */ -export class Repository extends RepositoryBase { - - /** - * Imports a codecommit repository. - * @param repositoryArn (e.g. `arn:aws:codecommit:us-east-1:123456789012:MyDemoRepo`) - */ - public static fromRepositoryArn(scope: Construct, id: string, repositoryArn: string): IRepository { - const stack = Stack.of(scope); - const arn = stack.splitArn(repositoryArn, ArnFormat.NO_RESOURCE_NAME); - const repositoryName = arn.resource; - const region = arn.region; - - class Import extends RepositoryBase { - public readonly repositoryArn = repositoryArn; - public readonly repositoryName = repositoryName; - public readonly repositoryCloneUrlHttp = makeCloneUrl(stack, repositoryName, 'https', region); - public readonly repositoryCloneUrlSsh = makeCloneUrl(stack, repositoryName, 'ssh', region); - public readonly repositoryCloneUrlGrc = makeCloneUrl(stack, repositoryName, 'grc', region); - } - - return new Import(scope, id, { - account: arn.account, - region, - }); - } - - public static fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository { - const stack = Stack.of(scope); - - class Import extends RepositoryBase { - public repositoryName = repositoryName; - public repositoryArn = Stack.of(scope).formatArn({ - service: 'codecommit', - resource: repositoryName, - }); - public readonly repositoryCloneUrlHttp = makeCloneUrl(stack, repositoryName, 'https'); - public readonly repositoryCloneUrlSsh = makeCloneUrl(stack, repositoryName, 'ssh'); - public readonly repositoryCloneUrlGrc = makeCloneUrl(stack, repositoryName, 'grc'); - } - - return new Import(scope, id); - } - - public readonly repositoryArn: string; - public readonly repositoryName: string; - public readonly repositoryCloneUrlHttp: string; - public readonly repositoryCloneUrlSsh: string; - public readonly repositoryCloneUrlGrc: string; - private readonly triggers = new Array(); - - constructor(scope: Construct, id: string, props: RepositoryProps) { - super(scope, id, { - physicalName: props.repositoryName, - }); - - const repository = new CfnRepository(this, 'Resource', { - repositoryName: props.repositoryName, - repositoryDescription: props.description, - triggers: Lazy.any({ produce: () => this.triggers }, { omitEmptyArray: true }), - code: (props.code?.bind(this))?.code, - }); - - this.repositoryName = this.getResourceNameAttribute(repository.attrName); - this.repositoryArn = this.getResourceArnAttribute(repository.attrArn, { - service: 'codecommit', - resource: this.physicalName, - }); - this.repositoryCloneUrlHttp = repository.attrCloneUrlHttp; - this.repositoryCloneUrlSsh = repository.attrCloneUrlSsh; - this.repositoryCloneUrlGrc = makeCloneUrl(Stack.of(this), this.repositoryName, 'grc'); - } - - /** - * Create a trigger to notify another service to run actions on repository events. - * @param arn Arn of the resource that repository events will notify - * @param options Trigger options to run actions - */ - public notify(arn: string, options?: RepositoryTriggerOptions): Repository { - - let evt = options && options.events; - if (evt && evt.length > 1 && evt.indexOf(RepositoryEventTrigger.ALL) > -1) { - evt = [RepositoryEventTrigger.ALL]; - } - - const customData = options && options.customData; - const branches = options && options.branches; - - let name = options && options.name; - if (!name) { - name = this.node.path + '/' + arn; - } - - if (this.triggers.find(prop => prop.name === name)) { - throw new Error(`Unable to set repository trigger named ${name} because trigger names must be unique`); - } - - this.triggers.push({ - destinationArn: arn, - name, - customData, - branches, - events: evt || [RepositoryEventTrigger.ALL], - }); - return this; - } -} - -/** - * Creates for a repository trigger to an SNS topic or Lambda function. - */ -export interface RepositoryTriggerOptions { - /** - * A name for the trigger.Triggers on a repository must have unique names. - */ - readonly name?: string; - - /** - * The repository events for which AWS CodeCommit sends information to the - * target, which you specified in the DestinationArn property.If you don't - * specify events, the trigger runs for all repository events. - */ - readonly events?: RepositoryEventTrigger[]; - - /** - * The names of the branches in the AWS CodeCommit repository that contain - * events that you want to include in the trigger. If you don't specify at - * least one branch, the trigger applies to all branches. - */ - readonly branches?: string[]; - - /** - * When an event is triggered, additional information that AWS CodeCommit - * includes when it sends information to the target. - */ - readonly customData?: string; -} - -/** - * Repository events that will cause the trigger to run actions in another service. - */ -export enum RepositoryEventTrigger { - ALL = 'all', - UPDATE_REF = 'updateReference', - CREATE_REF = 'createReference', - DELETE_REF = 'deleteReference' -} - -/** - * Returns the clone URL for a protocol. - */ -function makeCloneUrl(stack: Stack, repositoryName: string, protocol: 'https' | 'ssh' | 'grc', region?: string) { - switch (protocol) { - case 'https': - case 'ssh': - return `${protocol}://git-codecommit.${region ?? stack.region}.${stack.urlSuffix}/v1/repos/${repositoryName}`; - case 'grc': - return `codecommit::${region ?? stack.region}://${repositoryName}`; - } -} - -/** - * List of event types for AWS CodeCommit - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-repositories - */ -export enum RepositoryNotificationEvents { - /** - * Trigger notication when comment made on commit. - */ - COMMIT_COMMENT = 'codecommit-repository-comments-on-commits', - - /** - * Trigger notification when comment made on pull request. - */ - PULL_REQUEST_COMMENT = 'codecommit-repository-comments-on-pull-requests', - - /** - * Trigger notification when approval status changed. - */ - APPROVAL_STATUS_CHANGED = 'codecommit-repository-approvals-status-changed', - - /** - * Trigger notifications when approval rule is overridden. - */ - APPROVAL_RULE_OVERRIDDEN = 'codecommit-repository-approvals-rule-override', - - /** - * Trigger notification when pull request created. - */ - PULL_REQUEST_CREATED = 'codecommit-repository-pull-request-created', - - /** - * Trigger notification when pull request source updated. - */ - PULL_REQUEST_SOURCE_UPDATED = 'codecommit-repository-pull-request-source-updated', - - /** - * Trigger notification when pull request status is changed. - */ - PULL_REQUEST_STATUS_CHANGED = 'codecommit-repository-pull-request-status-changed', - - /** - * Trigger notification when pull requset is merged. - */ - PULL_REQUEST_MERGED = 'codecommit-repository-pull-request-merged', - - /** - * Trigger notification when a branch or tag is created. - */ - BRANCH_OR_TAG_CREATED = 'codecommit-repository-branches-and-tags-created', - - /** - * Trigger notification when a branch or tag is deleted. - */ - BRANCH_OR_TAG_DELETED = 'codecommit-repository-branches-and-tags-deleted', - - /** - * Trigger notification when a branch or tag is updated. - */ - BRANCH_OR_TAG_UPDATED = 'codecommit-repository-branches-and-tags-updated', -} diff --git a/packages/@aws-cdk/aws-codecommit/package.json b/packages/@aws-cdk/aws-codecommit/package.json deleted file mode 100644 index 7448d83798d16..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/package.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "name": "@aws-cdk/aws-codecommit", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeCommit", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.codecommit", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codecommit" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeCommit", - "packageId": "Amazon.CDK.AWS.CodeCommit", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-codecommit", - "module": "aws_cdk.aws_codecommit", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codecommit" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeCommit", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "statements": 30, - "lines": 30, - "branches": 36 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "codecommit" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awslint": { - "exclude": [ - "props-default-doc:@aws-cdk/aws-codecommit.RepositoryTriggerOptions.events", - "docs-public-apis:@aws-cdk/aws-codecommit.Repository.fromRepositoryName", - "docs-public-apis:@aws-cdk/aws-codecommit.RepositoryProps", - "props-default-doc:@aws-cdk/aws-codecommit.RepositoryTriggerOptions.branches", - "props-default-doc:@aws-cdk/aws-codecommit.RepositoryTriggerOptions.customData", - "docs-public-apis:@aws-cdk/aws-codecommit.IRepository", - "props-default-doc:@aws-cdk/aws-codecommit.RepositoryTriggerOptions.name", - "attribute-tag:@aws-cdk/aws-codecommit.Repository.repositoryCloneUrlGrc", - "docs-public-apis:@aws-cdk/aws-codecommit.RepositoryEventTrigger.ALL", - "docs-public-apis:@aws-cdk/aws-codecommit.RepositoryEventTrigger.UPDATE_REF", - "docs-public-apis:@aws-cdk/aws-codecommit.RepositoryEventTrigger.CREATE_REF", - "docs-public-apis:@aws-cdk/aws-codecommit.RepositoryEventTrigger.DELETE_REF" - ] - }, - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codecommit/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codecommit/rosetta/default.ts-fixture deleted file mode 100644 index f3da3c09182a1..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as path from 'path'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.ts b/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.ts deleted file mode 100644 index c2adb12b71485..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset-zip.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as codecommit from '../lib'; -import { Code } from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codecommit-repo-contents-zip-file'); - -new codecommit.Repository(stack, 'Repo', { - repositoryName: 'aws-cdk-codecommit-repo-contents-zip-file', - code: Code.fromZipFile('./asset-test.zip'), -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.ts b/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.ts deleted file mode 100644 index ac94a84ade264..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/test/integ.codecommit-code-asset.ts +++ /dev/null @@ -1,13 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as codecommit from '../lib'; -import { Code } from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codecommit-repo-contents-assets'); - -new codecommit.Repository(stack, 'Repo', { - repositoryName: 'aws-cdk-codecommit-repo-contents-assets', - code: Code.fromDirectory('./asset-test'), -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts b/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts deleted file mode 100644 index ae65a5f4f2ef8..0000000000000 --- a/packages/@aws-cdk/aws-codecommit/test/notification-rule.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as codecommit from '../lib'; - -describe('notification rule', () => { - test('CodeCommit Repositories - can create notification rule', () => { - const stack = new cdk.Stack(); - const repository = new codecommit.Repository(stack, 'MyCodecommitRepository', { - repositoryName: 'my-test-repository', - }); - - const target = new sns.Topic(stack, 'MyTopic'); - - repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); - - repository.notifyOnPullRequestMerged('NotifyOnPullRequestMerged', target); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyCodecommitRepositoryNotifyOnPullRequestCreatedBB14EA32', - DetailType: 'FULL', - EventTypeIds: [ - 'codecommit-repository-pull-request-created', - ], - Resource: { - 'Fn::GetAtt': [ - 'MyCodecommitRepository26DB372B', - 'Arn', - ], - }, - Targets: [ - { - TargetAddress: { - Ref: 'MyTopic86869434', - }, - TargetType: 'SNS', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyCodecommitRepositoryNotifyOnPullRequestMerged34A7EDF1', - DetailType: 'FULL', - EventTypeIds: [ - 'codecommit-repository-pull-request-merged', - ], - Resource: { - 'Fn::GetAtt': [ - 'MyCodecommitRepository26DB372B', - 'Arn', - ], - }, - Targets: [ - { - TargetAddress: { - Ref: 'MyTopic86869434', - }, - TargetType: 'SNS', - }, - ], - }); - - - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy/.eslintrc.js b/packages/@aws-cdk/aws-codedeploy/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codedeploy/.gitignore b/packages/@aws-cdk/aws-codedeploy/.gitignore deleted file mode 100644 index 1f8527d078b19..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!test/lambda/*/*.js -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codedeploy/.npmignore b/packages/@aws-cdk/aws-codedeploy/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codedeploy/LICENSE b/packages/@aws-cdk/aws-codedeploy/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codedeploy/NOTICE b/packages/@aws-cdk/aws-codedeploy/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codedeploy/README.md b/packages/@aws-cdk/aws-codedeploy/README.md deleted file mode 100644 index f47f4b40844a0..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/README.md +++ /dev/null @@ -1,718 +0,0 @@ -# AWS CodeDeploy Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -## Table of Contents - -- [Introduction](#introduction) -- Deploying to Amazon EC2 and on-premise instances - - [EC2/on-premise Applications](#ec2on-premise-applications) - - [EC2/on-premise Deployment Groups](#ec2on-premise-deployment-groups) - - [EC2/on-premise Deployment Configurations](#ec2on-premise-deployment-configurations) -- Deploying to AWS Lambda functions - - [Lambda Applications](#lambda-applications) - - [Lambda Deployment Groups](#lambda-deployment-groups) - - [Lambda Deployment Configurations](#lambda-deployment-configurations) -- Deploying to Amazon ECS services - - [ECS Applications](#ecs-applications) - - [ECS Deployment Groups](#ecs-deployment-groups) - - [ECS Deployment Configurations](#ecs-deployment-configurations) - - [ECS Deployments](#ecs-deployments) - -## Introduction - -AWS CodeDeploy is a deployment service that automates application deployments to -Amazon EC2 instances, on-premises instances, serverless Lambda functions, or -Amazon ECS services. - -The CDK currently supports Amazon EC2, on-premise, AWS Lambda, and Amazon ECS applications. - -## EC2/on-premise Applications - -To create a new CodeDeploy Application that deploys to EC2/on-premise instances: - -```ts -const application = new codedeploy.ServerApplication(this, 'CodeDeployApplication', { - applicationName: 'MyApplication', // optional property -}); -``` - -To import an already existing Application: - -```ts -const application = codedeploy.ServerApplication.fromServerApplicationName( - this, - 'ExistingCodeDeployApplication', - 'MyExistingApplication', -); -``` - -## EC2/on-premise Deployment Groups - -To create a new CodeDeploy Deployment Group that deploys to EC2/on-premise instances: - -```ts -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; - -declare const application: codedeploy.ServerApplication; -declare const asg: autoscaling.AutoScalingGroup; -declare const alarm: cloudwatch.Alarm; -const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'CodeDeployDeploymentGroup', { - application, - deploymentGroupName: 'MyDeploymentGroup', - autoScalingGroups: [asg], - // adds User Data that installs the CodeDeploy agent on your auto-scaling groups hosts - // default: true - installAgent: true, - // adds EC2 instances matching tags - ec2InstanceTags: new codedeploy.InstanceTagSet( - { - // any instance with tags satisfying - // key1=v1 or key1=v2 or key2 (any value) or value v3 (any key) - // will match this group - 'key1': ['v1', 'v2'], - 'key2': [], - '': ['v3'], - }, - ), - // adds on-premise instances matching tags - onPremiseInstanceTags: new codedeploy.InstanceTagSet( - // only instances with tags (key1=v1 or key1=v2) AND key2=v3 will match this set - { - 'key1': ['v1', 'v2'], - }, - { - 'key2': ['v3'], - }, - ), - // CloudWatch alarms - alarms: [alarm], - // whether to ignore failure to fetch the status of alarms from CloudWatch - // default: false - ignorePollAlarmsFailure: false, - // auto-rollback configuration - autoRollback: { - failedDeployment: true, // default: true - stoppedDeployment: true, // default: false - deploymentInAlarm: true, // default: true if you provided any alarms, false otherwise - }, -}); -``` - -All properties are optional - if you don't provide an Application, -one will be automatically created. - -To import an already existing Deployment Group: - -```ts -declare const application: codedeploy.ServerApplication; -const deploymentGroup = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes( - this, - 'ExistingCodeDeployDeploymentGroup', { - application, - deploymentGroupName: 'MyExistingDeploymentGroup', - }, -); -``` - -### Load balancers - -You can [specify a load balancer](https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-elastic-load-balancing.html) -with the `loadBalancer` property when creating a Deployment Group. - -`LoadBalancer` is an abstract class with static factory methods that allow you to create instances of it from various sources. - -With Classic Elastic Load Balancer, you provide it directly: - -```ts -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; - -declare const lb: elb.LoadBalancer; -lb.addListener({ - externalPort: 80, -}); - -const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', { - loadBalancer: codedeploy.LoadBalancer.classic(lb), -}); -``` - -With Application Load Balancer or Network Load Balancer, -you provide a Target Group as the load balancer: - -```ts -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; - -declare const alb: elbv2.ApplicationLoadBalancer; -const listener = alb.addListener('Listener', { port: 80 }); -const targetGroup = listener.addTargets('Fleet', { port: 80 }); - -const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', { - loadBalancer: codedeploy.LoadBalancer.application(targetGroup), -}); -``` - -## EC2/on-premise Deployment Configurations - -You can also pass a Deployment Configuration when creating the Deployment Group: - -```ts -const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'CodeDeployDeploymentGroup', { - deploymentConfig: codedeploy.ServerDeploymentConfig.ALL_AT_ONCE, -}); -``` - -The default Deployment Configuration is `ServerDeploymentConfig.ONE_AT_A_TIME`. - -You can also create a custom Deployment Configuration: - -```ts -const deploymentConfig = new codedeploy.ServerDeploymentConfig(this, 'DeploymentConfiguration', { - deploymentConfigName: 'MyDeploymentConfiguration', // optional property - // one of these is required, but both cannot be specified at the same time - minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(2), - // minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), -}); -``` - -Or import an existing one: - -```ts -const deploymentConfig = codedeploy.ServerDeploymentConfig.fromServerDeploymentConfigName( - this, - 'ExistingDeploymentConfiguration', - 'MyExistingDeploymentConfiguration', -); -``` - -## Lambda Applications - -To create a new CodeDeploy Application that deploys to a Lambda function: - -```ts -const application = new codedeploy.LambdaApplication(this, 'CodeDeployApplication', { - applicationName: 'MyApplication', // optional property -}); -``` - -To import an already existing Application: - -```ts -const application = codedeploy.LambdaApplication.fromLambdaApplicationName( - this, - 'ExistingCodeDeployApplication', - 'MyExistingApplication', -); -``` - -## Lambda Deployment Groups - -To enable traffic shifting deployments for Lambda functions, CodeDeploy uses Lambda Aliases, which can balance incoming traffic between two different versions of your function. -Before deployment, the alias sends 100% of invokes to the version used in production. -When you publish a new version of the function to your stack, CodeDeploy will send a small percentage of traffic to the new version, monitor, and validate before shifting 100% of traffic to the new version. - -To create a new CodeDeploy Deployment Group that deploys to a Lambda function: - -```ts -declare const myApplication: codedeploy.LambdaApplication; -declare const func: lambda.Function; -const version = func.currentVersion; -const version1Alias = new lambda.Alias(this, 'alias', { - aliasName: 'prod', - version, -}); - -const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { - application: myApplication, // optional property: one will be created for you if not provided - alias: version1Alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, -}); -``` - -In order to deploy a new version of this function: - -1. Reference the version with the latest changes `const version = func.currentVersion`. -2. Re-deploy the stack (this will trigger a deployment). -3. Monitor the CodeDeploy deployment as traffic shifts between the versions. - -### Lambda Deployment Rollbacks and Alarms - -CodeDeploy will roll back if the deployment fails. You can optionally trigger a rollback when one or more alarms are in a failed state: - -```ts -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; - -declare const alias: lambda.Alias; -const alarm = new cloudwatch.Alarm(this, 'Errors', { - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - metric: alias.metricErrors(), -}); -const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, - alarms: [ - // pass some alarms when constructing the deployment group - alarm, - ], -}); - -// or add alarms to an existing group -declare const blueGreenAlias: lambda.Alias; -deploymentGroup.addAlarm(new cloudwatch.Alarm(this, 'BlueGreenErrors', { - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - metric: blueGreenAlias.metricErrors(), -})); -``` - -### Pre and Post Hooks - -CodeDeploy allows you to run an arbitrary Lambda function before traffic shifting actually starts (PreTraffic Hook) and after it completes (PostTraffic Hook). -With either hook, you have the opportunity to run logic that determines whether the deployment must succeed or fail. -For example, with PreTraffic hook you could run integration tests against the newly created Lambda version (but not serving traffic). With PostTraffic hook, you could run end-to-end validation checks. - -```ts -declare const warmUpUserCache: lambda.Function; -declare const endToEndValidation: lambda.Function; -declare const alias: lambda.Alias; - -// pass a hook whe creating the deployment group -const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { - alias: alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, - preHook: warmUpUserCache, -}); - -// or configure one on an existing deployment group -deploymentGroup.addPostHook(endToEndValidation); -``` - -### Import an existing Lambda Deployment Group - -To import an already existing Deployment Group: - -```ts -declare const application: codedeploy.LambdaApplication; -const deploymentGroup = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(this, 'ExistingCodeDeployDeploymentGroup', { - application, - deploymentGroupName: 'MyExistingDeploymentGroup', -}); -``` - -## Lambda Deployment Configurations - -CodeDeploy for Lambda comes with predefined configurations for traffic shifting. -The predefined configurations are available as LambdaDeploymentConfig constants. - -```ts -const config = codedeploy.LambdaDeploymentConfig.CANARY_10PERCENT_30MINUTES; - -declare const application: codedeploy.LambdaApplication; -declare const alias: lambda.Alias; -const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { - application, - alias, - deploymentConfig: config, -}); -``` - -If you want to specify your own strategy, -you can do so with the LambdaDeploymentConfig construct, -letting you specify precisely how fast a new function version is deployed. - -```ts -const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', { - trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ - interval: cdk.Duration.minutes(15), - percentage: 5, - }), -}); - -declare const application: codedeploy.LambdaApplication; -declare const alias: lambda.Alias; -const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { - application, - alias, - deploymentConfig: config, -}); -``` - -You can specify a custom name for your deployment config, but if you do you will not be able to update the interval/percentage through CDK. - -```ts -const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', { - trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ - interval: cdk.Duration.minutes(15), - percentage: 5, - }), - deploymentConfigName: 'MyDeploymentConfig', -}); -``` - -To import an already existing Deployment Config: - -```ts -const deploymentConfig = codedeploy.LambdaDeploymentConfig.fromLambdaDeploymentConfigName( - this, - 'ExistingDeploymentConfiguration', - 'MyExistingDeploymentConfiguration', -); -``` - -## ECS Applications - -To create a new CodeDeploy Application that deploys an ECS service: - -```ts -const application = new codedeploy.EcsApplication(this, 'CodeDeployApplication', { - applicationName: 'MyApplication', // optional property -}); -``` - -To import an already existing Application: - -```ts -const application = codedeploy.EcsApplication.fromEcsApplicationName( - this, - 'ExistingCodeDeployApplication', - 'MyExistingApplication', -); -``` - -## ECS Deployment Groups - -CodeDeploy can be used to deploy to load-balanced ECS services. -CodeDeploy performs ECS blue-green deployments by managing ECS task sets and load balancer -target groups. During a blue-green deployment, one task set and target group runs the -original version of your ECS task definition ('blue') and another task set and target group -runs the new version of your ECS task definition ('green'). - -CodeDeploy orchestrates traffic shifting during ECS blue-green deployments by using -a load balancer listener to balance incoming traffic between the 'blue' and 'green' task sets/target groups -running two different versions of your ECS task definition. -Before deployment, the load balancer listener sends 100% of requests to the 'blue' target group. -When you publish a new version of the task definition and start a CodeDeploy deployment, -CodeDeploy can send a small percentage of traffic to the new 'green' task set behind the 'green' target group, -monitor, and validate before shifting 100% of traffic to the new version. - -To create a new CodeDeploy Deployment Group that deploys to an ECS service: - -```ts -declare const myApplication: codedeploy.EcsApplication; -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.FargateTaskDefinition; -declare const blueTargetGroup: elbv2.ITargetGroup; -declare const greenTargetGroup: elbv2.ITargetGroup; -declare const listener: elbv2.IApplicationListener; - -const service = new ecs.FargateService(this, 'Service', { - cluster, - taskDefinition, - deploymentController: { - type: ecs.DeploymentControllerType.CODE_DEPLOY, - }, -}); - -new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { - service, - blueGreenDeploymentConfig: { - blueTargetGroup, - greenTargetGroup, - listener, - }, - deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, -}); -``` - -In order to deploy a new task definition version to the ECS service, -deploy the changes directly through CodeDeploy using the CodeDeploy APIs or console. -When the `CODE_DEPLOY` deployment controller is used, the ECS service cannot be -deployed with a new task definition version through CloudFormation. - -For more information on the behavior of CodeDeploy blue-green deployments for ECS, see -[What happens during an Amazon ECS deployment](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html#deployment-steps-what-happens) -in the CodeDeploy user guide. - -Note: If you wish to deploy updates to your ECS service through CDK and CloudFormation instead of directly through CodeDeploy, -using the [`CfnCodeDeployBlueGreenHook`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnCodeDeployBlueGreenHook.html) -construct is the recommended approach instead of using the `EcsDeploymentGroup` construct. For a comparison -of ECS blue-green deployments through CodeDeploy (using `EcsDeploymentGroup`) and through CloudFormation (using `CfnCodeDeployBlueGreenHook`), -see [Create an Amazon ECS blue/green deployment through AWS CloudFormation](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployments-create-ecs-cfn.html#differences-ecs-bg-cfn) -in the CloudFormation user guide. - -### ECS Deployment Rollbacks and Alarms - -CodeDeploy will automatically roll back if a deployment fails. -You can optionally trigger an automatic rollback when one or more alarms are in a failed state during a deployment, or if the deployment stops. - -In this example, CodeDeploy will monitor and roll back on alarms set for the -number of unhealthy ECS tasks in each of the blue and green target groups, -as well as alarms set for the number HTTP 5xx responses seen in each of the blue -and green target groups. - -```ts -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; - -// Alarm on the number of unhealthy ECS tasks in each target group -const blueUnhealthyHosts = new cloudwatch.Alarm(stack, 'BlueUnhealthyHosts', { - alarmName: stack.stackName + '-Unhealthy-Hosts-Blue', - metric: blueTargetGroup.metricUnhealthyHostCount(), - threshold: 1, - evaluationPeriods: 2, -}); - -const greenUnhealthyHosts = new cloudwatch.Alarm(stack, 'GreenUnhealthyHosts', { - alarmName: stack.stackName + '-Unhealthy-Hosts-Green', - metric: greenTargetGroup.metricUnhealthyHostCount(), - threshold: 1, - evaluationPeriods: 2, -}); - -// Alarm on the number of HTTP 5xx responses returned by each target group -const blueApiFailure = new cloudwatch.Alarm(stack, 'Blue5xx', { - alarmName: stack.stackName + '-Http-5xx-Blue', - metric: blueTargetGroup.metricHttpCodeTarget( - elbv2.HttpCodeTarget.TARGET_5XX_COUNT, - { period: cdk.Duration.minutes(1) }, - ), - threshold: 1, - evaluationPeriods: 1, -}); - -const greenApiFailure = new cloudwatch.Alarm(stack, 'Green5xx', { - alarmName: stack.stackName + '-Http-5xx-Green', - metric: greenTargetGroup.metricHttpCodeTarget( - elbv2.HttpCodeTarget.TARGET_5XX_COUNT, - { period: cdk.Duration.minutes(1) }, - ), - threshold: 1, - evaluationPeriods: 1, -}); - -new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { - // CodeDeploy will monitor these alarms during a deployment and automatically roll back - alarms: [blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure], - autoRollback: { - // CodeDeploy will automatically roll back if a deployment is stopped - stoppedDeployment: true, - }, - service, - blueGreenDeploymentConfig: { - blueTargetGroup, - greenTargetGroup, - listener, - }, - deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, -}); -``` - -### Deployment validation and manual deployment approval - -CodeDeploy blue-green deployments provide an opportunity to validate the new task definition version running on -the 'green' ECS task set prior to shifting any production traffic to the new version. A second 'test' listener -serving traffic on a different port be added to the load balancer. For example, the test listener can serve -test traffic on port 9001 while the main listener serves production traffic on port 443. -During a blue-green deployment, CodeDeploy can then shift 100% of test traffic over to the 'green' -task set/target group prior to shifting any production traffic during the deployment. - -```ts -declare const myApplication: codedeploy.EcsApplication; -declare const service: ecs.FargateService; -declare const blueTargetGroup: elbv2.ITargetGroup; -declare const greenTargetGroup: elbv2.ITargetGroup; -declare const listener: elbv2.IApplicationListener; -declare const testListener: elbv2.IApplicationListener; - -new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { - service, - blueGreenDeploymentConfig: { - blueTargetGroup, - greenTargetGroup, - listener, - testListener, - }, - deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, -}); -``` - -Automated validation steps can run during the CodeDeploy deployment after shifting test traffic and before -shifting production traffic. CodeDeploy supports registering Lambda functions as lifecycle hooks for -an ECS deployment. These Lambda functions can run automated validation steps against the test traffic -port, for example in response to the `AfterAllowTestTraffic` lifecycle hook. For more information about -how to specify the Lambda functions to run for each CodeDeploy lifecycle hook in an ECS deployment, see the -[AppSpec 'hooks' for an Amazon ECS deployment](https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs) -section in the CodeDeploy user guide. - -After provisioning the 'green' ECS task set and re-routing test traffic during a blue-green deployment, -CodeDeploy can wait for approval before continuing the deployment and re-routing production traffic. -During this approval wait time, you can complete additional validation steps prior to exposing the new -'green' task set to production traffic, such as manual testing through the test listener port or -running automated integration test suites. - -To approve the deployment, validation steps use the CodeDeploy -[ContinueDeployment API(https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ContinueDeployment.html). -If the ContinueDeployment API is not called within the approval wait time period, CodeDeploy will stop the -deployment and can automatically roll back the deployment. - -```ts -new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { - autoRollback: { - // CodeDeploy will automatically roll back if the 8-hour approval period times out and the deployment stops - stoppedDeployment: true, - }, - service, - blueGreenDeploymentConfig: { - // The deployment will wait for approval for up to 8 hours before stopping the deployment - deploymentApprovalWaitTime: Duration.hours(8), - blueTargetGroup, - greenTargetGroup, - listener, - testListener, - }, - deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, -}); -``` - -### Deployment bake time - -You can specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment -is complete in order to let the deployment "bake" a while. During this bake time, CodeDeploy will continue to monitor any -CloudWatch alarms specified for the deployment group and will automatically roll back if those alarms go into a failed state. - -```ts -new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { - service, - blueGreenDeploymentConfig: { - blueTargetGroup, - greenTargetGroup, - listener, - // CodeDeploy will wait for 30 minutes after completing the blue-green deployment before it terminates the blue tasks - terminationWaitTime: Duration.minutes(30), - }, - // CodeDeploy will continue to monitor these alarms during the 30-minute bake time and will automatically - // roll back if they go into a failed state at any point during the deployment. - alarms: [blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure], - deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, -}); -``` - -### Import an existing ECS Deployment Group - -To import an already existing Deployment Group: - -```ts -declare const application: codedeploy.EcsApplication; -const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(this, 'ExistingCodeDeployDeploymentGroup', { - application, - deploymentGroupName: 'MyExistingDeploymentGroup', -}); -``` - -## ECS Deployment Configurations - -CodeDeploy for ECS comes with predefined configurations for traffic shifting. -The predefined configurations are available as LambdaDeploymentConfig constants. - -```ts -const config = codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES; -``` - -If you want to specify your own strategy, -you can do so with the EcsDeploymentConfig construct, -letting you specify precisely how fast an ECS service is deployed. - -```ts -new codedeploy.EcsDeploymentConfig(this, 'CustomConfig', { - trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ - interval: cdk.Duration.minutes(15), - percentage: 5, - }), -}); -``` - -You can specify a custom name for your deployment config, but if you do you will not be able to update the interval/percentage through CDK. - -```ts -const config = new codedeploy.EcsDeploymentConfig(this, 'CustomConfig', { - trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ - interval: cdk.Duration.minutes(15), - percentage: 5, - }), - deploymentConfigName: 'MyDeploymentConfig', -}); -``` - -Or import an existing one: - -```ts -const deploymentConfig = codedeploy.EcsDeploymentConfig.fromEcsDeploymentConfigName( - this, - 'ExistingDeploymentConfiguration', - 'MyExistingDeploymentConfiguration', -); -``` - -## ECS Deployments - -[![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg)](https://constructs.dev/packages/@cdklabs/cdk-ecs-codedeploy) - -An experimental construct is available on the Construct Hub called [@cdklabs/cdk-ecs-codedeploy](https://constructs.dev/packages/@cdklabs/cdk-ecs-codedeploy) that manages ECS CodeDeploy deployments. - -```ts -declare const deploymentGroup: codeDeploy.IEcsDeploymentGroup; -declare const taskDefinition: ecs.ITaskDefinition; - -new EcsDeployment({ - deploymentGroup, - targetService: { - taskDefinition, - containerName: 'mycontainer', - containerPort: 80, - }, -}); -``` - -The deployment will use the AutoRollbackConfig for the EcsDeploymentGroup unless it is overridden in the deployment: - -```ts -new EcsDeployment({ - deploymentGroup, - targetService: { - taskDefinition, - containerName: 'mycontainer', - containerPort: 80, - }, - autoRollback: { - failedDeployment: true, - deploymentInAlarm: true, - stoppedDeployment: false, - }, -}); -``` - -By default, the CodeDeploy Deployment will timeout after 30 minutes. The timeout value can be overridden: - -```ts -new EcsDeployment({ - deploymentGroup, - targetService: { - taskDefinition, - containerName: 'mycontainer', - containerPort: 80, - }, - timeout: Duration.minutes(60), -}); -``` diff --git a/packages/@aws-cdk/aws-codedeploy/jest.config.js b/packages/@aws-cdk/aws-codedeploy/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts deleted file mode 100644 index 61217841bef5a..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/ecs/application.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { ArnFormat, IResource, Resource, Stack, Arn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnApplication } from '../codedeploy.generated'; -import { arnForApplication, validateName } from '../private/utils'; - -/** - * Represents a reference to a CodeDeploy Application deploying to Amazon ECS. - * - * If you're managing the Application alongside the rest of your CDK resources, - * use the `EcsApplication` class. - * - * If you want to reference an already existing Application, - * or one defined in a different CDK Stack, - * use the `EcsApplication#fromEcsApplicationName` method. - */ -export interface IEcsApplication extends IResource { - /** @attribute */ - readonly applicationArn: string; - - /** @attribute */ - readonly applicationName: string; -} - -/** - * Construction properties for `EcsApplication`. - */ -export interface EcsApplicationProps { - /** - * The physical, human-readable name of the CodeDeploy Application. - * - * @default an auto-generated name will be used - */ - readonly applicationName?: string; -} - -/** - * A CodeDeploy Application that deploys to an Amazon ECS service. - * - * @resource AWS::CodeDeploy::Application - */ -export class EcsApplication extends Resource implements IEcsApplication { - /** - * Import an Application defined either outside the CDK, or in a different CDK Stack. - * - * The Application's account and region are assumed to be the same as the stack it is being imported - * into. If not, use `fromEcsApplicationArn`. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param ecsApplicationName the name of the application to import - * @returns a Construct representing a reference to an existing Application - */ - public static fromEcsApplicationName(scope: Construct, id: string, ecsApplicationName: string): IEcsApplication { - class Import extends Resource implements IEcsApplication { - public applicationArn = arnForApplication(Stack.of(scope), ecsApplicationName); - public applicationName = ecsApplicationName; - } - - return new Import(scope, id); - } - - /** - * Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param ecsApplicationArn the ARN of the application to import - * @returns a Construct representing a reference to an existing Application - */ - public static fromEcsApplicationArn(scope: Construct, id: string, ecsApplicationArn: string): IEcsApplication { - return new class extends Resource implements IEcsApplication { - public applicationArn = ecsApplicationArn; - public applicationName = Arn.split(ecsApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? ''; - } (scope, id, { environmentFromArn: ecsApplicationArn }); - } - - public readonly applicationArn: string; - public readonly applicationName: string; - - constructor(scope: Construct, id: string, props: EcsApplicationProps = {}) { - super(scope, id, { - physicalName: props.applicationName, - }); - - const resource = new CfnApplication(this, 'Resource', { - applicationName: this.physicalName, - computePlatform: 'ECS', - }); - - this.applicationName = this.getResourceNameAttribute(resource.ref); - this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(scope), resource.ref), { - service: 'codedeploy', - resource: 'application', - resourceName: this.physicalName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - - this.node.addValidation({ validate: () => validateName('Application', this.physicalName) }); - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts deleted file mode 100644 index 0b339ab203ff3..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-group.ts +++ /dev/null @@ -1,368 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP } from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { IEcsApplication, EcsApplication } from './application'; -import { EcsDeploymentConfig, IEcsDeploymentConfig } from './deployment-config'; -import { CfnDeploymentGroup } from '../codedeploy.generated'; -import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group'; -import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils'; -import { AutoRollbackConfig } from '../rollback-config'; - -/** - * Interface for an ECS deployment group. - */ -export interface IEcsDeploymentGroup extends cdk.IResource { - /** - * The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. - */ - readonly application: IEcsApplication; - - /** - * The physical name of the CodeDeploy Deployment Group. - * @attribute - */ - readonly deploymentGroupName: string; - - /** - * The ARN of this Deployment Group. - * @attribute - */ - readonly deploymentGroupArn: string; - - /** - * The Deployment Configuration this Group uses. - */ - readonly deploymentConfig: IEcsDeploymentConfig; -} - -/** - * Specify how the deployment behaves and how traffic is routed to the ECS service during a blue-green ECS deployment. - * - * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html#deployment-steps-what-happens - * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs - */ -export interface EcsBlueGreenDeploymentConfig { - /** - * The target group that will be associated with the 'blue' ECS task set during a blue-green deployment. - */ - readonly blueTargetGroup: elbv2.ITargetGroup; - - /** - * The target group that will be associated with the 'green' ECS task set during a blue-green deployment. - */ - readonly greenTargetGroup: elbv2.ITargetGroup; - - /** - * The load balancer listener used to serve production traffic and to shift production traffic from the - * 'blue' ECS task set to the 'green' ECS task set during a blue-green deployment. - */ - readonly listener: elbv2.IListener; - - /** - * The load balancer listener used to route test traffic to the 'green' ECS task set during a blue-green deployment. - * - * During a blue-green deployment, validation can occur after test traffic has been re-routed and before production - * traffic has been re-routed to the 'green' ECS task set. You can specify one or more Lambda funtions in the - * deployment's AppSpec file that run during the AfterAllowTestTraffic hook. The functions can run validation tests. - * If a validation test fails, a deployment rollback is triggered. If the validation tests succeed, the next hook in - * the deployment lifecycle, BeforeAllowTraffic, is triggered. - * - * If a test listener is not specified, the deployment will proceed to routing the production listener to the 'green' ECS task set - * and will skip the AfterAllowTestTraffic hook. - * - * @default No test listener will be added - */ - readonly testListener?: elbv2.IListener; - - /** - * Specify how long CodeDeploy waits for approval to continue a blue-green deployment before it stops the deployment. - * - * After provisioning the 'green' ECS task set and re-routing test traffic, CodeDeploy can wait for approval before - * continuing the deployment and re-routing production traffic. During this wait time, validation such as manual - * testing or running integration tests can occur using the test traffic port, prior to exposing the new 'green' task - * set to production traffic. To approve the deployment, validation steps use the CodeDeploy - * [ContinueDeployment API(https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ContinueDeployment.html). - * If the ContinueDeployment API is not called within the wait time period, CodeDeploy will stop the deployment. - * - * By default, CodeDeploy will not wait for deployment approval. After re-routing test traffic to the 'green' ECS task set - * and running any 'AfterAllowTestTraffic' and 'BeforeAllowTraffic' lifecycle hooks, the deployment will immediately - * re-route production traffic to the 'green' ECS task set. - * - * @default 0 - */ - readonly deploymentApprovalWaitTime?: cdk.Duration; - - /** - * Specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment is complete. - * - * During this wait time, CodeDeploy will continue to monitor any CloudWatch alarms specified for the deployment group, - * and the deployment group can be configured to automatically roll back if those alarms fire. Once CodeDeploy begins to - * terminate the 'blue' ECS task set, the deployment can no longer be rolled back, manually or automatically. - * - * By default, the deployment will immediately terminate the 'blue' ECS task set after production traffic is successfully - * routed to the 'green' ECS task set. - * - * @default 0 - */ - readonly terminationWaitTime?: cdk.Duration; -} - -/** - * Construction properties for `EcsDeploymentGroup`. - */ -export interface EcsDeploymentGroupProps { - /** - * The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. - * - * @default One will be created for you. - */ - readonly application?: IEcsApplication; - - /** - * The physical, human-readable name of the CodeDeploy Deployment Group. - * - * @default An auto-generated name will be used. - */ - readonly deploymentGroupName?: string; - - /** - * The Deployment Configuration this Deployment Group uses. - * - * @default EcsDeploymentConfig.ALL_AT_ONCE - */ - readonly deploymentConfig?: IEcsDeploymentConfig; - - /** - * The CloudWatch alarms associated with this Deployment Group. - * CodeDeploy will stop (and optionally roll back) - * a deployment if during it any of the alarms trigger. - * - * Alarms can also be added after the Deployment Group is created using the `#addAlarm` method. - * - * @default [] - * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html - */ - readonly alarms?: cloudwatch.IAlarm[]; - - /** - * The service Role of this Deployment Group. - * - * @default - A new Role will be created. - */ - readonly role?: iam.IRole; - - /** - * The ECS service to deploy with this Deployment Group. - */ - readonly service: ecs.IBaseService; - - /** - * The configuration options for blue-green ECS deployments - */ - readonly blueGreenDeploymentConfig: EcsBlueGreenDeploymentConfig; - - /** - * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. - * - * @default false - */ - readonly ignorePollAlarmsFailure?: boolean; - - /** - * The auto-rollback configuration for this Deployment Group. - * - * @default - default AutoRollbackConfig. - */ - readonly autoRollback?: AutoRollbackConfig; -} - -/** - * A CodeDeploy deployment group that orchestrates ECS blue-green deployments. - * @resource AWS::CodeDeploy::DeploymentGroup - */ -export class EcsDeploymentGroup extends DeploymentGroupBase implements IEcsDeploymentGroup { - /** - * Reference an ECS Deployment Group defined outside the CDK app. - * - * Account and region for the DeploymentGroup are taken from the application. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param attrs the properties of the referenced Deployment Group - * @returns a Construct representing a reference to an existing Deployment Group - */ - public static fromEcsDeploymentGroupAttributes( - scope:Construct, - id: string, - attrs: EcsDeploymentGroupAttributes): IEcsDeploymentGroup { - return new ImportedEcsDeploymentGroup(scope, id, attrs); - } - - public readonly application: IEcsApplication; - public readonly deploymentConfig: IEcsDeploymentConfig; - /** - * The service Role of this Deployment Group. - */ - public readonly role: iam.IRole; - - private readonly alarms: cloudwatch.IAlarm[]; - - constructor(scope: Construct, id: string, props: EcsDeploymentGroupProps) { - super(scope, id, { - deploymentGroupName: props.deploymentGroupName, - role: props.role, - roleConstructId: 'ServiceRole', - }); - this.role = this._role; - - this.application = props.application || new EcsApplication(this, 'Application'); - this.alarms = props.alarms || []; - - this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AWSCodeDeployRoleForECS')); - this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || EcsDeploymentConfig.ALL_AT_ONCE); - - if (cdk.Resource.isOwnedResource(props.service)) { - const cfnSvc = (props.service as ecs.BaseService).node.defaultChild as ecs.CfnService; - if (cfnSvc.deploymentController === undefined || - (cfnSvc.deploymentController! as ecs.CfnService.DeploymentControllerProperty).type !== ecs.DeploymentControllerType.CODE_DEPLOY) { - throw new Error( - 'The ECS service associated with the deployment group must use the CODE_DEPLOY deployment controller type', - ); - } - - if (cfnSvc.taskDefinition !== (props.service as ecs.BaseService).taskDefinition.family) { - throw new Error( - 'The ECS service associated with the deployment group must specify the task definition using the task definition family name only. Otherwise, the task definition cannot be updated in the stack', - ); - } - } - - const removeAlarmsFromDeploymentGroup = cdk.FeatureFlags.of(this).isEnabled(CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP); - - const resource = new CfnDeploymentGroup(this, 'Resource', { - applicationName: this.application.applicationName, - serviceRoleArn: this.role.roleArn, - deploymentGroupName: this.physicalName, - deploymentConfigName: this.deploymentConfig.deploymentConfigName, - deploymentStyle: { - deploymentType: 'BLUE_GREEN', - deploymentOption: 'WITH_TRAFFIC_CONTROL', - }, - ecsServices: [{ - clusterName: props.service.cluster.clusterName, - serviceName: props.service.serviceName, - }], - blueGreenDeploymentConfiguration: cdk.Lazy.any({ - produce: () => this.renderBlueGreenDeploymentConfiguration(props.blueGreenDeploymentConfig), - }), - loadBalancerInfo: cdk.Lazy.any({ produce: () => this.renderLoadBalancerInfo(props.blueGreenDeploymentConfig) }), - alarmConfiguration: cdk.Lazy.any({ - produce: () => renderAlarmConfiguration(this.alarms, props.ignorePollAlarmsFailure, removeAlarmsFromDeploymentGroup), - }), - autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }), - }); - - this._setNameAndArn(resource, this.application); - - // If the deployment config is a construct, add a dependency to ensure the deployment config - // is created before the deployment group is. - if (Construct.isConstruct(this.deploymentConfig)) { - this.node.addDependency(this.deploymentConfig); - } - } - - /** - * Associates an additional alarm with this Deployment Group. - * - * @param alarm the alarm to associate with this Deployment Group - */ - public addAlarm(alarm: cloudwatch.IAlarm): void { - this.alarms.push(alarm); - } - - private renderBlueGreenDeploymentConfiguration(options: EcsBlueGreenDeploymentConfig): - CfnDeploymentGroup.BlueGreenDeploymentConfigurationProperty { - return { - deploymentReadyOption: { - actionOnTimeout: options.deploymentApprovalWaitTime ? 'STOP_DEPLOYMENT' : 'CONTINUE_DEPLOYMENT', - waitTimeInMinutes: options.deploymentApprovalWaitTime?.toMinutes() ?? 0, - }, - terminateBlueInstancesOnDeploymentSuccess: { - action: 'TERMINATE', - terminationWaitTimeInMinutes: options.terminationWaitTime?.toMinutes() ?? 0, - }, - }; - } - - private renderLoadBalancerInfo(options: EcsBlueGreenDeploymentConfig): CfnDeploymentGroup.LoadBalancerInfoProperty { - return { - targetGroupPairInfoList: [ - { - targetGroups: [ - { - name: options.blueTargetGroup.targetGroupName, - }, - { - name: options.greenTargetGroup.targetGroupName, - }, - ], - prodTrafficRoute: { - listenerArns: [ - options.listener.listenerArn, - ], - }, - testTrafficRoute: options.testListener ? { - listenerArns: [ - options.testListener.listenerArn, - ], - } : undefined, - }, - ], - }; - } -} - -/** - * Properties of a reference to a CodeDeploy ECS Deployment Group. - * - * @see EcsDeploymentGroup#fromEcsDeploymentGroupAttributes - */ -export interface EcsDeploymentGroupAttributes { - /** - * The reference to the CodeDeploy ECS Application - * that this Deployment Group belongs to. - */ - readonly application: IEcsApplication; - - /** - * The physical, human-readable name of the CodeDeploy ECS Deployment Group - * that we are referencing. - */ - readonly deploymentGroupName: string; - - /** - * The Deployment Configuration this Deployment Group uses. - * - * @default EcsDeploymentConfig.ALL_AT_ONCE - */ - readonly deploymentConfig?: IEcsDeploymentConfig; -} - -class ImportedEcsDeploymentGroup extends ImportedDeploymentGroupBase implements IEcsDeploymentGroup { - public readonly application: IEcsApplication; - public readonly deploymentConfig: IEcsDeploymentConfig; - - constructor(scope: Construct, id: string, props: EcsDeploymentGroupAttributes) { - super(scope, id, { - application: props.application, - deploymentGroupName: props.deploymentGroupName, - }); - - this.application = props.application; - this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || EcsDeploymentConfig.ALL_AT_ONCE); - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts deleted file mode 100644 index 6700762cb07af..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/application.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { ArnFormat, IResource, Resource, Stack, Arn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnApplication } from '../codedeploy.generated'; -import { arnForApplication, validateName } from '../private/utils'; - -/** - * Represents a reference to a CodeDeploy Application deploying to AWS Lambda. - * - * If you're managing the Application alongside the rest of your CDK resources, - * use the `LambdaApplication` class. - * - * If you want to reference an already existing Application, - * or one defined in a different CDK Stack, - * use the `LambdaApplication#fromLambdaApplicationName` method. - */ -export interface ILambdaApplication extends IResource { - /** @attribute */ - readonly applicationArn: string; - - /** @attribute */ - readonly applicationName: string; -} - -/** - * Construction properties for `LambdaApplication`. - */ -export interface LambdaApplicationProps { - /** - * The physical, human-readable name of the CodeDeploy Application. - * - * @default an auto-generated name will be used - */ - readonly applicationName?: string; -} - -/** - * A CodeDeploy Application that deploys to an AWS Lambda function. - * - * @resource AWS::CodeDeploy::Application - */ -export class LambdaApplication extends Resource implements ILambdaApplication { - /** - * Import an Application defined either outside the CDK, or in a different CDK Stack. - * - * The Application's account and region are assumed to be the same as the stack it is being imported - * into. If not, use `fromLambdaApplicationArn`. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param lambdaApplicationName the name of the application to import - * @returns a Construct representing a reference to an existing Application - */ - public static fromLambdaApplicationName(scope: Construct, id: string, lambdaApplicationName: string): ILambdaApplication { - class Import extends Resource implements ILambdaApplication { - public applicationArn = arnForApplication(Stack.of(scope), lambdaApplicationName); - public applicationName = lambdaApplicationName; - } - - return new Import(scope, id); - } - - /** - * Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param lambdaApplicationArn the ARN of the application to import - * @returns a Construct representing a reference to an existing Application - */ - public static fromLambdaApplicationArn(scope: Construct, id: string, lambdaApplicationArn: string): ILambdaApplication { - return new class extends Resource implements ILambdaApplication { - public applicationArn = lambdaApplicationArn; - public applicationName = Arn.split(lambdaApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? ''; - }(scope, id, { environmentFromArn: lambdaApplicationArn }); - } - - public readonly applicationArn: string; - public readonly applicationName: string; - - constructor(scope: Construct, id: string, props: LambdaApplicationProps = {}) { - super(scope, id, { - physicalName: props.applicationName, - }); - - const resource = new CfnApplication(this, 'Resource', { - applicationName: this.physicalName, - computePlatform: 'Lambda', - }); - - this.applicationName = this.getResourceNameAttribute(resource.ref); - this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(this), resource.ref), { - service: 'codedeploy', - resource: 'application', - resourceName: this.physicalName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - - this.node.addValidation({ validate: () => validateName('Application', this.physicalName) }); - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts deleted file mode 100644 index add32d3809cdb..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-group.ts +++ /dev/null @@ -1,300 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP } from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { ILambdaApplication, LambdaApplication } from './application'; -import { ILambdaDeploymentConfig, LambdaDeploymentConfig } from './deployment-config'; -import { CfnDeploymentGroup } from '../codedeploy.generated'; -import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group'; -import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils'; -import { AutoRollbackConfig } from '../rollback-config'; - -/** - * Interface for a Lambda deployment groups. - */ -export interface ILambdaDeploymentGroup extends cdk.IResource { - /** - * The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. - */ - readonly application: ILambdaApplication; - - /** - * The physical name of the CodeDeploy Deployment Group. - * @attribute - */ - readonly deploymentGroupName: string; - - /** - * The ARN of this Deployment Group. - * @attribute - */ - readonly deploymentGroupArn: string; - - /** - * The Deployment Configuration this Group uses. - */ - readonly deploymentConfig: ILambdaDeploymentConfig; -} - -/** - * Construction properties for `LambdaDeploymentGroup`. - */ -export interface LambdaDeploymentGroupProps { - /** - * The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. - * - * @default - One will be created for you. - */ - readonly application?: ILambdaApplication; - - /** - * The physical, human-readable name of the CodeDeploy Deployment Group. - * - * @default - An auto-generated name will be used. - */ - readonly deploymentGroupName?: string; - - /** - * The Deployment Configuration this Deployment Group uses. - * - * @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES - */ - readonly deploymentConfig?: ILambdaDeploymentConfig; - - /** - * The CloudWatch alarms associated with this Deployment Group. - * CodeDeploy will stop (and optionally roll back) - * a deployment if during it any of the alarms trigger. - * - * Alarms can also be added after the Deployment Group is created using the `#addAlarm` method. - * - * @default [] - * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html - */ - readonly alarms?: cloudwatch.IAlarm[]; - - /** - * The service Role of this Deployment Group. - * - * @default - A new Role will be created. - */ - readonly role?: iam.IRole; - - /** - * Lambda Alias to shift traffic. Updating the version - * of the alias will trigger a CodeDeploy deployment. - * - * [disable-awslint:ref-via-interface] since we need to modify the alias CFN resource update policy - */ - readonly alias: lambda.Alias; - - /** - * The Lambda function to run before traffic routing starts. - * - * @default - None. - */ - readonly preHook?: lambda.IFunction; - - /** - * The Lambda function to run after traffic routing starts. - * - * @default - None. - */ - readonly postHook?: lambda.IFunction; - - /** - * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. - * - * @default false - */ - readonly ignorePollAlarmsFailure?: boolean; - - /** - * The auto-rollback configuration for this Deployment Group. - * - * @default - default AutoRollbackConfig. - */ - readonly autoRollback?: AutoRollbackConfig; -} - -/** - * @resource AWS::CodeDeploy::DeploymentGroup - */ -export class LambdaDeploymentGroup extends DeploymentGroupBase implements ILambdaDeploymentGroup { - /** - * Import an Lambda Deployment Group defined either outside the CDK app, or in a different AWS region. - * - * Account and region for the DeploymentGroup are taken from the application. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param attrs the properties of the referenced Deployment Group - * @returns a Construct representing a reference to an existing Deployment Group - */ - public static fromLambdaDeploymentGroupAttributes( - scope: Construct, - id: string, - attrs: LambdaDeploymentGroupAttributes): ILambdaDeploymentGroup { - return new ImportedLambdaDeploymentGroup(scope, id, attrs); - } - - public readonly application: ILambdaApplication; - public readonly deploymentConfig: ILambdaDeploymentConfig; - /** - * The service Role of this Deployment Group. - */ - public readonly role: iam.IRole; - - private readonly alarms: cloudwatch.IAlarm[]; - private preHook?: lambda.IFunction; - private postHook?: lambda.IFunction; - - constructor(scope: Construct, id: string, props: LambdaDeploymentGroupProps) { - super(scope, id, { - deploymentGroupName: props.deploymentGroupName, - role: props.role, - roleConstructId: 'ServiceRole', - }); - this.role = this._role; - - this.application = props.application || new LambdaApplication(this, 'Application'); - this.alarms = props.alarms || []; - - this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSCodeDeployRoleForLambdaLimited')); - this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES); - - const removeAlarmsFromDeploymentGroup = cdk.FeatureFlags.of(this).isEnabled(CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP); - - const resource = new CfnDeploymentGroup(this, 'Resource', { - applicationName: this.application.applicationName, - serviceRoleArn: this.role.roleArn, - deploymentGroupName: this.physicalName, - deploymentConfigName: this.deploymentConfig.deploymentConfigName, - deploymentStyle: { - deploymentType: 'BLUE_GREEN', - deploymentOption: 'WITH_TRAFFIC_CONTROL', - }, - alarmConfiguration: cdk.Lazy.any({ - produce: () => renderAlarmConfiguration(this.alarms, props.ignorePollAlarmsFailure, removeAlarmsFromDeploymentGroup), - }), - autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }), - }); - - this._setNameAndArn(resource, this.application); - - if (props.preHook) { - this.addPreHook(props.preHook); - } - if (props.postHook) { - this.addPostHook(props.postHook); - } - - (props.alias.node.defaultChild as lambda.CfnAlias).cfnOptions.updatePolicy = { - codeDeployLambdaAliasUpdate: { - applicationName: this.application.applicationName, - deploymentGroupName: resource.ref, - beforeAllowTrafficHook: cdk.Lazy.string({ produce: () => this.preHook && this.preHook.functionName }), - afterAllowTrafficHook: cdk.Lazy.string({ produce: () => this.postHook && this.postHook.functionName }), - }, - }; - - // If the deployment config is a construct, add a dependency to ensure the deployment config - // is created before the deployment group is. - if (this.deploymentConfig instanceof Construct) { - this.node.addDependency(this.deploymentConfig); - } - } - - /** - * Associates an additional alarm with this Deployment Group. - * - * @param alarm the alarm to associate with this Deployment Group - */ - public addAlarm(alarm: cloudwatch.IAlarm): void { - this.alarms.push(alarm); - } - - /** - * Associate a function to run before deployment begins. - * @param preHook function to run before deployment beings - * @throws an error if a pre-hook function is already configured - */ - public addPreHook(preHook: lambda.IFunction): void { - if (this.preHook !== undefined) { - throw new Error('A pre-hook function is already defined for this deployment group'); - } - this.preHook = preHook; - this.grantPutLifecycleEventHookExecutionStatus(this.preHook); - this.preHook.grantInvoke(this.role); - } - - /** - * Associate a function to run after deployment completes. - * @param postHook function to run after deployment completes - * @throws an error if a post-hook function is already configured - */ - public addPostHook(postHook: lambda.IFunction): void { - if (this.postHook !== undefined) { - throw new Error('A post-hook function is already defined for this deployment group'); - } - this.postHook = postHook; - this.grantPutLifecycleEventHookExecutionStatus(this.postHook); - this.postHook.grantInvoke(this.role); - } - - /** - * Grant a principal permission to codedeploy:PutLifecycleEventHookExecutionStatus - * on this deployment group resource. - * @param grantee to grant permission to - */ - public grantPutLifecycleEventHookExecutionStatus(grantee: iam.IGrantable): iam.Grant { - return iam.Grant.addToPrincipal({ - grantee, - resourceArns: [this.deploymentGroupArn], - actions: ['codedeploy:PutLifecycleEventHookExecutionStatus'], - }); - } -} - -/** - * Properties of a reference to a CodeDeploy Lambda Deployment Group. - * - * @see LambdaDeploymentGroup#fromLambdaDeploymentGroupAttributes - */ -export interface LambdaDeploymentGroupAttributes { - /** - * The reference to the CodeDeploy Lambda Application - * that this Deployment Group belongs to. - */ - readonly application: ILambdaApplication; - - /** - * The physical, human-readable name of the CodeDeploy Lambda Deployment Group - * that we are referencing. - */ - readonly deploymentGroupName: string; - - /** - * The Deployment Configuration this Deployment Group uses. - * - * @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES - */ - readonly deploymentConfig?: ILambdaDeploymentConfig; -} - -class ImportedLambdaDeploymentGroup extends ImportedDeploymentGroupBase implements ILambdaDeploymentGroup { - public readonly application: ILambdaApplication; - public readonly deploymentConfig: ILambdaDeploymentConfig; - - constructor(scope: Construct, id: string, props: LambdaDeploymentGroupAttributes) { - super(scope, id, { - application: props.application, - deploymentGroupName: props.deploymentGroupName, - }); - - this.application = props.application; - this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES); - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/private/utils.ts b/packages/@aws-cdk/aws-codedeploy/lib/private/utils.ts deleted file mode 100644 index 1c8e78230269b..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/private/utils.ts +++ /dev/null @@ -1,125 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Token, Stack, ArnFormat, Arn, Fn, Aws, IResource } from '@aws-cdk/core'; -import { IPredefinedDeploymentConfig } from './predefined-deployment-config'; -import { IBaseDeploymentConfig } from '../base-deployment-config'; -import { CfnDeploymentGroup } from '../codedeploy.generated'; -import { AutoRollbackConfig } from '../rollback-config'; - -export function arnForApplication(stack: Stack, applicationName: string): string { - return stack.formatArn({ - service: 'codedeploy', - resource: 'application', - resourceName: applicationName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); -} - -export function nameFromDeploymentGroupArn(deploymentGroupArn: string): string { - const components = Arn.split(deploymentGroupArn, ArnFormat.COLON_RESOURCE_NAME); - return Fn.select(1, Fn.split('/', components.resourceName ?? '')); -} - -export function arnForDeploymentConfig(name: string, resource?: IResource): string { - return Arn.format({ - partition: Aws.PARTITION, - account: resource?.env.account ?? Aws.ACCOUNT_ID, - region: resource?.env.region ?? Aws.REGION, - service: 'codedeploy', - resource: 'deploymentconfig', - resourceName: name, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); -} - -export function renderAlarmConfiguration(alarms: cloudwatch.IAlarm[], ignorePollAlarmFailure: boolean | undefined, removeAlarms = true): -CfnDeploymentGroup.AlarmConfigurationProperty | undefined { - if (removeAlarms) { - return { - alarms: alarms.length > 0 ? alarms.map(a => ({ name: a.alarmName })) : undefined, - enabled: alarms.length > 0, - ignorePollAlarmFailure, - }; - } - - return alarms.length === 0 - ? undefined - : { - alarms: alarms.map(a => ({ name: a.alarmName })), - enabled: true, - ignorePollAlarmFailure, - }; -} - -export function deploymentConfig(name: string): IBaseDeploymentConfig & IPredefinedDeploymentConfig { - return { - deploymentConfigName: name, - deploymentConfigArn: arnForDeploymentConfig(name), - bindEnvironment: (resource) => ({ - deploymentConfigName: name, - deploymentConfigArn: arnForDeploymentConfig(name, resource), - }), - }; -} - -enum AutoRollbackEvent { - DEPLOYMENT_FAILURE = 'DEPLOYMENT_FAILURE', - DEPLOYMENT_STOP_ON_ALARM = 'DEPLOYMENT_STOP_ON_ALARM', - DEPLOYMENT_STOP_ON_REQUEST = 'DEPLOYMENT_STOP_ON_REQUEST' -} - -export function renderAutoRollbackConfiguration(alarms: cloudwatch.IAlarm[], autoRollbackConfig: AutoRollbackConfig = {}): -CfnDeploymentGroup.AutoRollbackConfigurationProperty | undefined { - const events = new Array(); - - // we roll back failed deployments by default - if (autoRollbackConfig.failedDeployment !== false) { - events.push(AutoRollbackEvent.DEPLOYMENT_FAILURE); - } - - // we _do not_ roll back stopped deployments by default - if (autoRollbackConfig.stoppedDeployment === true) { - events.push(AutoRollbackEvent.DEPLOYMENT_STOP_ON_REQUEST); - } - - // we _do not_ roll back alarm-triggering deployments by default - // unless the Deployment Group has at least one alarm - if (autoRollbackConfig.deploymentInAlarm !== false) { - if (alarms.length > 0) { - events.push(AutoRollbackEvent.DEPLOYMENT_STOP_ON_ALARM); - } else if (autoRollbackConfig.deploymentInAlarm === true) { - throw new Error( - "The auto-rollback setting 'deploymentInAlarm' does not have any effect unless you associate " + - 'at least one CloudWatch alarm with the Deployment Group'); - } - } - - if (autoRollbackConfig.failedDeployment === false - && autoRollbackConfig.stoppedDeployment !== true - && autoRollbackConfig.deploymentInAlarm === false) { - return { - enabled: false, - }; - } - - return events.length > 0 - ? { - enabled: true, - events, - } - : undefined; -} - -export function validateName(type: 'Application' | 'Deployment group' | 'Deployment config', name: string): string[] { - const ret = []; - - if (!Token.isUnresolved(name) && name !== undefined) { - if (name.length > 100) { - ret.push(`${type} name: "${name}" can be a max of 100 characters.`); - } - if (!/^[a-z0-9._+=,@-]+$/i.test(name)) { - ret.push(`${type} name: "${name}" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).`); - } - } - - return ret; -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts deleted file mode 100644 index 442cf48e2edc0..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/application.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { ArnFormat, IResource, Resource, Stack, Arn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnApplication } from '../codedeploy.generated'; -import { arnForApplication, validateName } from '../private/utils'; - -/** - * Represents a reference to a CodeDeploy Application deploying to EC2/on-premise instances. - * - * If you're managing the Application alongside the rest of your CDK resources, - * use the `ServerApplication` class. - * - * If you want to reference an already existing Application, - * or one defined in a different CDK Stack, - * use the `#fromServerApplicationName` method. - */ -export interface IServerApplication extends IResource { - /** @attribute */ - readonly applicationArn: string; - - /** @attribute */ - readonly applicationName: string; -} - -/** - * Construction properties for `ServerApplication`. - */ -export interface ServerApplicationProps { - /** - * The physical, human-readable name of the CodeDeploy Application. - * - * @default an auto-generated name will be used - */ - readonly applicationName?: string; -} - -/** - * A CodeDeploy Application that deploys to EC2/on-premise instances. - * - * @resource AWS::CodeDeploy::Application - */ -export class ServerApplication extends Resource implements IServerApplication { - /** - * Import an Application defined either outside the CDK app, or in a different region. - * - * The Application's account and region are assumed to be the same as the stack it is being imported - * into. If not, use `fromServerApplicationArn`. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param serverApplicationName the name of the application to import - * @returns a Construct representing a reference to an existing Application - */ - public static fromServerApplicationName(scope: Construct, id: string, serverApplicationName: string): IServerApplication { - class Import extends Resource implements IServerApplication { - public readonly applicationArn = arnForApplication(Stack.of(scope), serverApplicationName); - public readonly applicationName = serverApplicationName; - } - - return new Import(scope, id); - } - - /** - * Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param serverApplicationArn the ARN of the application to import - * @returns a Construct representing a reference to an existing Application - */ - public static fromServerApplicationArn(scope: Construct, id: string, serverApplicationArn: string): IServerApplication { - return new class extends Resource implements IServerApplication { - public applicationArn = serverApplicationArn; - public applicationName = Arn.split(serverApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? ''; - }(scope, id, { environmentFromArn: serverApplicationArn }); - } - - public readonly applicationArn: string; - public readonly applicationName: string; - - constructor(scope: Construct, id: string, props: ServerApplicationProps = {}) { - super(scope, id, { - physicalName: props.applicationName, - }); - - const resource = new CfnApplication(this, 'Resource', { - applicationName: this.physicalName, - computePlatform: 'Server', - }); - - this.applicationName = this.getResourceNameAttribute(resource.ref); - this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(scope), resource.ref), { - service: 'codedeploy', - resource: 'application', - resourceName: this.physicalName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - - this.node.addValidation({ validate: () => validateName('Application', this.physicalName) }); - } - -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts deleted file mode 100644 index 20f2534b4ff4c..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-group.ts +++ /dev/null @@ -1,461 +0,0 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP } from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { IServerApplication, ServerApplication } from './application'; -import { IServerDeploymentConfig, ServerDeploymentConfig } from './deployment-config'; -import { LoadBalancer, LoadBalancerGeneration } from './load-balancer'; -import { CfnDeploymentGroup } from '../codedeploy.generated'; -import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group'; -import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils'; -import { AutoRollbackConfig } from '../rollback-config'; - -export interface IServerDeploymentGroup extends cdk.IResource { - readonly application: IServerApplication; - readonly role?: iam.IRole; - /** - * @attribute - */ - readonly deploymentGroupName: string; - - /** - * @attribute - */ - readonly deploymentGroupArn: string; - readonly deploymentConfig: IServerDeploymentConfig; - readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[]; -} - -/** - * Properties of a reference to a CodeDeploy EC2/on-premise Deployment Group. - * - * @see ServerDeploymentGroup#import - */ -export interface ServerDeploymentGroupAttributes { - /** - * The reference to the CodeDeploy EC2/on-premise Application - * that this Deployment Group belongs to. - */ - readonly application: IServerApplication; - - /** - * The physical, human-readable name of the CodeDeploy EC2/on-premise Deployment Group - * that we are referencing. - */ - readonly deploymentGroupName: string; - - /** - * The Deployment Configuration this Deployment Group uses. - * - * @default ServerDeploymentConfig#OneAtATime - */ - readonly deploymentConfig?: IServerDeploymentConfig; -} - -class ImportedServerDeploymentGroup extends ImportedDeploymentGroupBase implements IServerDeploymentGroup { - public readonly application: IServerApplication; - public readonly role?: iam.Role = undefined; - public readonly autoScalingGroups?: autoscaling.AutoScalingGroup[] = undefined; - public readonly deploymentConfig: IServerDeploymentConfig; - - constructor(scope: Construct, id: string, props: ServerDeploymentGroupAttributes) { - super(scope, id, { - application: props.application, - deploymentGroupName: props.deploymentGroupName, - }); - - this.application = props.application; - this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || ServerDeploymentConfig.ONE_AT_A_TIME); - } -} - -/** - * Represents a group of instance tags. - * An instance will match a group if it has a tag matching - * any of the group's tags by key and any of the provided values - - * in other words, tag groups follow 'or' semantics. - * If the value for a given key is an empty array, - * an instance will match when it has a tag with the given key, - * regardless of the value. - * If the key is an empty string, any tag, - * regardless of its key, with any of the given values, will match. - */ -export type InstanceTagGroup = {[key: string]: string[]}; - -/** - * Represents a set of instance tag groups. - * An instance will match a set if it matches all of the groups in the set - - * in other words, sets follow 'and' semantics. - * You can have a maximum of 3 tag groups inside a set. - */ -export class InstanceTagSet { - private readonly _instanceTagGroups: InstanceTagGroup[]; - - constructor(...instanceTagGroups: InstanceTagGroup[]) { - if (instanceTagGroups.length > 3) { - throw new Error('An instance tag set can have a maximum of 3 instance tag groups, ' + - `but ${instanceTagGroups.length} were provided`); - } - this._instanceTagGroups = instanceTagGroups; - } - - public get instanceTagGroups(): InstanceTagGroup[] { - return this._instanceTagGroups.slice(); - } -} - -/** - * Construction properties for `ServerDeploymentGroup`. - */ -export interface ServerDeploymentGroupProps { - /** - * The CodeDeploy EC2/on-premise Application this Deployment Group belongs to. - * - * @default - A new Application will be created. - */ - readonly application?: IServerApplication; - - /** - * The service Role of this Deployment Group. - * - * @default - A new Role will be created. - */ - readonly role?: iam.IRole; - - /** - * The physical, human-readable name of the CodeDeploy Deployment Group. - * - * @default - An auto-generated name will be used. - */ - readonly deploymentGroupName?: string; - - /** - * The EC2/on-premise Deployment Configuration to use for this Deployment Group. - * - * @default ServerDeploymentConfig#OneAtATime - */ - readonly deploymentConfig?: IServerDeploymentConfig; - - /** - * The auto-scaling groups belonging to this Deployment Group. - * - * Auto-scaling groups can also be added after the Deployment Group is created - * using the `#addAutoScalingGroup` method. - * - * [disable-awslint:ref-via-interface] is needed because we update userdata - * for ASGs to install the codedeploy agent. - * - * @default [] - */ - readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[]; - - /** - * If you've provided any auto-scaling groups with the `#autoScalingGroups` property, - * you can set this property to add User Data that installs the CodeDeploy agent on the instances. - * - * @default true - * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html - */ - readonly installAgent?: boolean; - - /** - * The load balancer to place in front of this Deployment Group. - * Can be created from either a classic Elastic Load Balancer, - * or an Application Load Balancer / Network Load Balancer Target Group. - * - * @default - Deployment Group will not have a load balancer defined. - */ - readonly loadBalancer?: LoadBalancer; - - /** - * All EC2 instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. - * - * @default - No additional EC2 instances will be added to the Deployment Group. - */ - readonly ec2InstanceTags?: InstanceTagSet; - - /** - * All on-premise instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. - * - * @default - No additional on-premise instances will be added to the Deployment Group. - */ - readonly onPremiseInstanceTags?: InstanceTagSet; - - /** - * The CloudWatch alarms associated with this Deployment Group. - * CodeDeploy will stop (and optionally roll back) - * a deployment if during it any of the alarms trigger. - * - * Alarms can also be added after the Deployment Group is created using the `#addAlarm` method. - * - * @default [] - * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html - */ - readonly alarms?: cloudwatch.IAlarm[]; - - /** - * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. - * - * @default false - */ - readonly ignorePollAlarmsFailure?: boolean; - - /** - * The auto-rollback configuration for this Deployment Group. - * - * @default - default AutoRollbackConfig. - */ - readonly autoRollback?: AutoRollbackConfig; -} - -/** - * A CodeDeploy Deployment Group that deploys to EC2/on-premise instances. - * @resource AWS::CodeDeploy::DeploymentGroup - */ -export class ServerDeploymentGroup extends DeploymentGroupBase implements IServerDeploymentGroup { - /** - * Import an EC2/on-premise Deployment Group defined either outside the CDK app, - * or in a different region. - * - * @param scope the parent Construct for this new Construct - * @param id the logical ID of this new Construct - * @param attrs the properties of the referenced Deployment Group - * @returns a Construct representing a reference to an existing Deployment Group - */ - public static fromServerDeploymentGroupAttributes( - scope: Construct, - id: string, - attrs: ServerDeploymentGroupAttributes): IServerDeploymentGroup { - return new ImportedServerDeploymentGroup(scope, id, attrs); - } - - public readonly application: IServerApplication; - public readonly deploymentConfig: IServerDeploymentConfig; - /** - * The service Role of this Deployment Group. - */ - public readonly role?: iam.IRole; - - private readonly _autoScalingGroups: autoscaling.IAutoScalingGroup[]; - private readonly installAgent: boolean; - private readonly codeDeployBucket: s3.IBucket; - private readonly alarms: cloudwatch.IAlarm[]; - - constructor(scope: Construct, id: string, props: ServerDeploymentGroupProps = {}) { - super(scope, id, { - deploymentGroupName: props.deploymentGroupName, - role: props.role, - roleConstructId: 'Role', - }); - this.role = this._role; - - this.application = props.application || new ServerApplication(this, 'Application', { - applicationName: props.deploymentGroupName === cdk.PhysicalName.GENERATE_IF_NEEDED ? cdk.PhysicalName.GENERATE_IF_NEEDED : undefined, - }); - this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || ServerDeploymentConfig.ONE_AT_A_TIME); - - this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSCodeDeployRole')); - this._autoScalingGroups = props.autoScalingGroups || []; - this.installAgent = props.installAgent ?? true; - this.codeDeployBucket = s3.Bucket.fromBucketName(this, 'Bucket', `aws-codedeploy-${cdk.Stack.of(this).region}`); - for (const asg of this._autoScalingGroups) { - this.addCodeDeployAgentInstallUserData(asg); - } - - this.alarms = props.alarms || []; - - const removeAlarmsFromDeploymentGroup = cdk.FeatureFlags.of(this).isEnabled(CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP); - - const resource = new CfnDeploymentGroup(this, 'Resource', { - applicationName: this.application.applicationName, - deploymentGroupName: this.physicalName, - serviceRoleArn: this.role.roleArn, - deploymentConfigName: props.deploymentConfig && - props.deploymentConfig.deploymentConfigName, - autoScalingGroups: cdk.Lazy.list({ produce: () => this._autoScalingGroups.map(asg => asg.autoScalingGroupName) }, { omitEmpty: true }), - loadBalancerInfo: this.loadBalancerInfo(props.loadBalancer), - deploymentStyle: props.loadBalancer === undefined - ? undefined - : { - deploymentOption: 'WITH_TRAFFIC_CONTROL', - }, - ec2TagSet: this.ec2TagSet(props.ec2InstanceTags), - onPremisesTagSet: this.onPremiseTagSet(props.onPremiseInstanceTags), - alarmConfiguration: cdk.Lazy.any({ - produce: () => renderAlarmConfiguration(this.alarms, props.ignorePollAlarmsFailure, removeAlarmsFromDeploymentGroup), - }), - autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }), - }); - - this._setNameAndArn(resource, this.application); - } - - /** - * Adds an additional auto-scaling group to this Deployment Group. - * - * @param asg the auto-scaling group to add to this Deployment Group. - * [disable-awslint:ref-via-interface] is needed in order to install the code - * deploy agent by updating the ASGs user data. - */ - public addAutoScalingGroup(asg: autoscaling.AutoScalingGroup): void { - this._autoScalingGroups.push(asg); - this.addCodeDeployAgentInstallUserData(asg); - } - - /** - * Associates an additional alarm with this Deployment Group. - * - * @param alarm the alarm to associate with this Deployment Group - */ - public addAlarm(alarm: cloudwatch.IAlarm): void { - this.alarms.push(alarm); - } - - public get autoScalingGroups(): autoscaling.IAutoScalingGroup[] | undefined { - return this._autoScalingGroups.slice(); - } - - private addCodeDeployAgentInstallUserData(asg: autoscaling.IAutoScalingGroup): void { - if (!this.installAgent) { - return; - } - - this.codeDeployBucket.grantRead(asg, 'latest/*'); - - switch (asg.osType) { - case ec2.OperatingSystemType.LINUX: - asg.addUserData( - 'set +e', // make sure we don't exit on the `which` failing - 'PKG_CMD=`which yum 2>/dev/null`', - 'set -e', // continue with failing on error - 'if [ -z "$PKG_CMD" ]; then', - 'PKG_CMD=apt-get', - 'else', - 'PKG_CMD=yum', - 'fi', - '$PKG_CMD update -y', - 'set +e', // make sure we don't exit on the next command failing (we check its exit code below) - '$PKG_CMD install -y ruby2.0', - 'RUBY2_INSTALL=$?', - 'set -e', // continue with failing on error - 'if [ $RUBY2_INSTALL -ne 0 ]; then', - '$PKG_CMD install -y ruby', - 'fi', - 'AWS_CLI_PACKAGE_NAME=awscli', - 'if [ "$PKG_CMD" = "yum" ]; then', - 'AWS_CLI_PACKAGE_NAME=aws-cli', - 'fi', - '$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME', - 'TMP_DIR=`mktemp -d`', - 'cd $TMP_DIR', - `aws s3 cp s3://aws-codedeploy-${cdk.Stack.of(this).region}/latest/install . --region ${cdk.Stack.of(this).region}`, - 'chmod +x ./install', - './install auto', - 'rm -fr $TMP_DIR', - ); - break; - case ec2.OperatingSystemType.WINDOWS: - asg.addUserData( - 'Set-Variable -Name TEMPDIR -Value (New-TemporaryFile).DirectoryName', - `aws s3 cp s3://aws-codedeploy-${cdk.Stack.of(this).region}/latest/codedeploy-agent.msi $TEMPDIR\\codedeploy-agent.msi`, - 'cd $TEMPDIR', - '.\\codedeploy-agent.msi /quiet /l c:\\temp\\host-agent-install-log.txt', - ); - break; - } - } - - private loadBalancerInfo(loadBalancer?: LoadBalancer): - CfnDeploymentGroup.LoadBalancerInfoProperty | undefined { - if (!loadBalancer) { - return undefined; - } - - switch (loadBalancer.generation) { - case LoadBalancerGeneration.FIRST: - return { - elbInfoList: [ - { name: loadBalancer.name }, - ], - }; - case LoadBalancerGeneration.SECOND: - return { - targetGroupInfoList: [ - { name: loadBalancer.name }, - ], - }; - } - } - - private ec2TagSet(tagSet?: InstanceTagSet): - CfnDeploymentGroup.EC2TagSetProperty | undefined { - if (!tagSet || tagSet.instanceTagGroups.length === 0) { - return undefined; - } - - return { - ec2TagSetList: tagSet.instanceTagGroups.map(tagGroup => { - return { - ec2TagGroup: this.tagGroup2TagsArray(tagGroup) as - CfnDeploymentGroup.EC2TagFilterProperty[], - }; - }), - }; - } - - private onPremiseTagSet(tagSet?: InstanceTagSet): - CfnDeploymentGroup.OnPremisesTagSetProperty | undefined { - if (!tagSet || tagSet.instanceTagGroups.length === 0) { - return undefined; - } - - return { - onPremisesTagSetList: tagSet.instanceTagGroups.map(tagGroup => { - return { - onPremisesTagGroup: this.tagGroup2TagsArray(tagGroup), - }; - }), - }; - } - - private tagGroup2TagsArray(tagGroup: InstanceTagGroup): CfnDeploymentGroup.TagFilterProperty[] { - const tagsInGroup = new Array(); - for (const tagKey in tagGroup) { - if (tagGroup.hasOwnProperty(tagKey)) { - const tagValues = tagGroup[tagKey]; - if (tagKey.length > 0) { - if (tagValues.length > 0) { - for (const tagValue of tagValues) { - tagsInGroup.push({ - key: tagKey, - value: tagValue, - type: 'KEY_AND_VALUE', - }); - } - } else { - tagsInGroup.push({ - key: tagKey, - type: 'KEY_ONLY', - }); - } - } else { - if (tagValues.length > 0) { - for (const tagValue of tagValues) { - tagsInGroup.push({ - value: tagValue, - type: 'VALUE_ONLY', - }); - } - } else { - throw new Error('Cannot specify both an empty key and no values for an instance tag filter'); - } - } - } - } - return tagsInGroup; - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/load-balancer.ts b/packages/@aws-cdk/aws-codedeploy/lib/server/load-balancer.ts deleted file mode 100644 index 5e04330267dfc..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/lib/server/load-balancer.ts +++ /dev/null @@ -1,69 +0,0 @@ -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; - -/** - * The generations of AWS load balancing solutions. - */ -export enum LoadBalancerGeneration { - /** - * The first generation (ELB Classic). - */ - FIRST = 0, - - /** - * The second generation (ALB and NLB). - */ - SECOND = 1 -} - -/** - * An interface of an abstract load balancer, as needed by CodeDeploy. - * Create instances using the static factory methods: - * `#classic`, `#application` and `#network`. - */ -export abstract class LoadBalancer { - /** - * Creates a new CodeDeploy load balancer from a Classic ELB Load Balancer. - * - * @param loadBalancer a classic ELB Load Balancer - */ - public static classic(loadBalancer: elb.LoadBalancer): LoadBalancer { - class ClassicLoadBalancer extends LoadBalancer { - public readonly generation = LoadBalancerGeneration.FIRST; - public readonly name = loadBalancer.loadBalancerName; - } - - return new ClassicLoadBalancer(); - } - - /** - * Creates a new CodeDeploy load balancer from an Application Load Balancer Target Group. - * - * @param albTargetGroup an ALB Target Group - */ - public static application(albTargetGroup: elbv2.IApplicationTargetGroup): LoadBalancer { - class AlbLoadBalancer extends LoadBalancer { - public readonly generation = LoadBalancerGeneration.SECOND; - public readonly name = albTargetGroup.targetGroupName; - } - - return new AlbLoadBalancer(); - } - - /** - * Creates a new CodeDeploy load balancer from a Network Load Balancer Target Group. - * - * @param nlbTargetGroup an NLB Target Group - */ - public static network(nlbTargetGroup: elbv2.INetworkTargetGroup): LoadBalancer { - class NlbLoadBalancer extends LoadBalancer { - public readonly generation = LoadBalancerGeneration.SECOND; - public readonly name = nlbTargetGroup.targetGroupName; - } - - return new NlbLoadBalancer(); - } - - public abstract readonly generation: LoadBalancerGeneration; - public abstract readonly name: string; -} diff --git a/packages/@aws-cdk/aws-codedeploy/package.json b/packages/@aws-cdk/aws-codedeploy/package.json deleted file mode 100644 index 5a329a0d0919c..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/package.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "name": "@aws-cdk/aws-codedeploy", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeDeploy", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.codedeploy", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codedeploy" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeDeploy", - "packageId": "Amazon.CDK.AWS.CodeDeploy", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-codedeploy", - "module": "aws_cdk.aws_codedeploy", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codedeploy" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeDeploy", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "statements": 79 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "codedeploy" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "construct-interface-extends-iconstruct:@aws-cdk/aws-codedeploy.IServerDeploymentConfig", - "construct-interface-extends-iconstruct:@aws-cdk/aws-codedeploy.ILambdaDeploymentConfig", - "construct-interface-extends-iconstruct:@aws-cdk/aws-codedeploy.IEcsDeploymentConfig", - "resource-interface-extends-resource:@aws-cdk/aws-codedeploy.IServerDeploymentConfig", - "resource-interface-extends-resource:@aws-cdk/aws-codedeploy.ILambdaDeploymentConfig", - "resource-interface-extends-resource:@aws-cdk/aws-codedeploy.IEcsDeploymentConfig", - "no-static-import:@aws-cdk/aws-codedeploy.LambdaDeploymentConfig.import", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.role", - "docs-public-apis:@aws-cdk/aws-codedeploy.InstanceTagSet.instanceTagGroups", - "docs-public-apis:@aws-cdk/aws-codedeploy.LambdaApplication.applicationArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.LambdaApplication.applicationName", - "docs-public-apis:@aws-cdk/aws-codedeploy.LambdaDeploymentGroup", - "docs-public-apis:@aws-cdk/aws-codedeploy.LambdaDeploymentGroup.role", - "docs-public-apis:@aws-cdk/aws-codedeploy.LoadBalancer.generation", - "docs-public-apis:@aws-cdk/aws-codedeploy.LoadBalancer.name", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerApplication.applicationArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerApplication.applicationName", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.autoScalingGroups", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.application", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.deploymentConfig", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.deploymentGroupArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.deploymentGroupName", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.autoScalingGroups", - "docs-public-apis:@aws-cdk/aws-codedeploy.ServerDeploymentGroup.role", - "docs-public-apis:@aws-cdk/aws-codedeploy.ILambdaApplication.applicationArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.ILambdaApplication.applicationName", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerApplication.applicationArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerApplication.applicationName", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.application", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.deploymentConfig", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.deploymentGroupArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.IServerDeploymentGroup.deploymentGroupName", - "docs-public-apis:@aws-cdk/aws-codedeploy.EcsApplication.applicationArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.EcsApplication.applicationName", - "docs-public-apis:@aws-cdk/aws-codedeploy.IEcsApplication.applicationArn", - "docs-public-apis:@aws-cdk/aws-codedeploy.IEcsApplication.applicationName", - "props-physical-name:@aws-cdk/aws-codedeploy.CustomLambdaDeploymentConfigProps" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codedeploy/rosetta/default.ts-fixture deleted file mode 100644 index 4baee63065a45..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as codedeploy from '@aws-cdk/aws-codedeploy'; -import * as lambda from '@aws-cdk/aws-lambda'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/application.test.ts b/packages/@aws-cdk/aws-codedeploy/test/ecs/application.test.ts deleted file mode 100644 index c907bb4c38740..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/ecs/application.test.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - -describe('CodeDeploy ECS Application', () => { - test('can be created', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsApplication(stack, 'MyApp'); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { - ComputePlatform: 'ECS', - }); - }); - - test('can be created with explicit name', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsApplication(stack, 'MyApp', { - applicationName: 'my-name', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { - ApplicationName: 'my-name', - ComputePlatform: 'ECS', - }); - }); - - test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.EcsApplication(stack, 'MyApp', { - applicationName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Application name: "${'a'.repeat(101)}" can be a max of 100 characters.`); - }); - - test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.EcsApplication(stack, 'MyApp', { - applicationName: 'my name', - }); - - expect(() => app.synth()).toThrow('Application name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); - }); - - test('can be imported', () => { - const stack = new cdk.Stack(); - - const application = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'MyApp', 'MyApp'); - - expect(application).not.toEqual(undefined); - expect(application.applicationName).toEqual('MyApp'); - }); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/deployment-config.test.ts b/packages/@aws-cdk/aws-codedeploy/test/ecs/deployment-config.test.ts deleted file mode 100644 index 3dc660e10bb08..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/ecs/deployment-config.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; -import { TrafficRouting } from '../../lib'; - -/* eslint-disable quote-props */ - -let stack: cdk.Stack; - -beforeEach(() => { - stack = new cdk.Stack(); -}); - -test('can create default config', () => { - // WHEN - new codedeploy.EcsDeploymentConfig(stack, 'MyConfig'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'ECS', - 'TrafficRoutingConfig': { - 'Type': 'AllAtOnce', - }, - }); -}); - -test('can create all-at-once config', () => { - // WHEN - new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.allAtOnce(), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'ECS', - 'TrafficRoutingConfig': { - 'Type': 'AllAtOnce', - }, - }); -}); - -test('can create linear config', () => { - // WHEN - new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedLinear({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'ECS', - 'TrafficRoutingConfig': { - 'TimeBasedLinear': { - 'LinearInterval': 1, - 'LinearPercentage': 5, - }, - 'Type': 'TimeBasedLinear', - }, - }); -}); - -test('can create canary config', () => { - // WHEN - new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'ECS', - 'TrafficRoutingConfig': { - 'TimeBasedCanary': { - 'CanaryInterval': 1, - 'CanaryPercentage': 5, - }, - 'Type': 'TimeBasedCanary', - }, - }); -}); - -test('can create a config with a specific name', () => { - // WHEN - new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { - deploymentConfigName: 'MyCanaryConfig', - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'ECS', - 'DeploymentConfigName': 'MyCanaryConfig', - 'TrafficRoutingConfig': { - 'TimeBasedCanary': { - 'CanaryInterval': 1, - 'CanaryPercentage': 5, - }, - 'Type': 'TimeBasedCanary', - }, - }); -}); - -test('can be imported', () => { - const deploymentConfig = codedeploy.EcsDeploymentConfig.fromEcsDeploymentConfigName(stack, 'MyDC', 'MyDC'); - - expect(deploymentConfig).not.toEqual(undefined); -}); - -test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stackWithApp = new cdk.Stack(app); - new codedeploy.EcsDeploymentConfig(stackWithApp, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - deploymentConfigName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Deployment config name: "${'a'.repeat(101)}" can be a max of 100 characters.`); -}); - -test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stackWithApp = new cdk.Stack(app); - new codedeploy.EcsDeploymentConfig(stackWithApp, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - deploymentConfigName: 'my name', - }); - - expect(() => app.synth()).toThrow('Deployment config name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/deployment-group.test.ts b/packages/@aws-cdk/aws-codedeploy/test/ecs/deployment-group.test.ts deleted file mode 100644 index 7051f9e793318..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/ecs/deployment-group.test.ts +++ /dev/null @@ -1,887 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - -const mockCluster = 'my-cluster'; -const mockService = 'my-service'; -const mockRegion = 'my-region'; -const mockAccount = 'my-account'; - -function mockEcsService(stack: cdk.Stack): ecs.IBaseService { - const serviceArn = `arn:aws:ecs:${mockRegion}:${mockAccount}:service/${mockCluster}/${mockService}`; - return ecs.BaseService.fromServiceArnWithCluster(stack, 'Service', serviceArn); -} - -function mockTargetGroup(stack: cdk.Stack, id: string): elbv2.ITargetGroup { - const targetGroupArn = `arn:aws:elasticloadbalancing:${mockRegion}:${mockAccount}:targetgroup/${id}/f7a80aba5edd5980`; - return elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, id, { - targetGroupArn, - }); -} - -function mockListener(stack: cdk.Stack, id: string): elbv2.IListener { - const listenerArn = `arn:aws:elasticloadbalancing:${mockRegion}:${mockAccount}:listener/app/myloadbalancer/lb-12345/${id}`; - const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack, 'MySecurityGroup' + id, 'sg-12345678'); - return elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener' + id, { - listenerArn, - securityGroup, - }); -} - -describe('CodeDeploy ECS DeploymentGroup', () => { - describe('imported with fromEcsDeploymentGroupAttributes', () => { - test('defaults the Deployment Config to AllAtOnce', () => { - const stack = new cdk.Stack(); - - const ecsApp = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'EA', 'EcsApplication'); - const importedGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'EDG', { - application: ecsApp, - deploymentGroupName: 'EcsDeploymentGroup', - }); - - expect(importedGroup.deploymentConfig.deploymentConfigName).toEqual('CodeDeployDefault.ECSAllAtOnce'); - }); - }); - - test('can be created with default configuration', () => { - const stack = new cdk.Stack(); - stack.node.setContext('@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup', true); - - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResource('AWS::CodeDeploy::DeploymentGroup', { - Type: 'AWS::CodeDeploy::DeploymentGroup', - Properties: { - ApplicationName: { - Ref: 'MyDGApplication57B1E402', - }, - ServiceRoleArn: { - 'Fn::GetAtt': [ - 'MyDGServiceRole5E94FD88', - 'Arn', - ], - }, - AlarmConfiguration: { - Enabled: false, - Alarms: Match.absent(), - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - ], - }, - BlueGreenDeploymentConfiguration: { - DeploymentReadyOption: { - ActionOnTimeout: 'CONTINUE_DEPLOYMENT', - WaitTimeInMinutes: 0, - }, - TerminateBlueInstancesOnDeploymentSuccess: { - Action: 'TERMINATE', - TerminationWaitTimeInMinutes: 0, - }, - }, - DeploymentConfigName: 'CodeDeployDefault.ECSAllAtOnce', - DeploymentStyle: { - DeploymentOption: 'WITH_TRAFFIC_CONTROL', - DeploymentType: 'BLUE_GREEN', - }, - ECSServices: [ - { - ClusterName: 'my-cluster', - ServiceName: 'my-service', - }, - ], - LoadBalancerInfo: { - TargetGroupPairInfoList: [ - { - ProdTrafficRoute: { - ListenerArns: [ - 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/prod', - ], - }, - TargetGroups: [ - { - Name: 'blue', - }, - { - Name: 'green', - }, - ], - }, - ], - }, - }, - }); - - Template.fromStack(stack).hasResource('AWS::CodeDeploy::Application', { - Type: 'AWS::CodeDeploy::Application', - Properties: { - ComputePlatform: 'ECS', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: { - 'Fn::FindInMap': [ - 'ServiceprincipalMap', - { - Ref: 'AWS::Region', - }, - 'codedeploy', - ], - }, - }, - }], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AWSCodeDeployRoleForECS', - ], - ], - }, - ], - }); - }); - - test('can be created with explicit name', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: 'test', - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - DeploymentGroupName: 'test', - }); - }); - - test('can be created with explicit application', () => { - const stack = new cdk.Stack(); - const application = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'A', 'myapp'); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - application, - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - ApplicationName: 'myapp', - }); - }); - - test('can be created with explicit deployment config', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_15MINUTES, - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - DeploymentConfigName: 'CodeDeployDefault.ECSCanary10Percent15Minutes', - }); - }); - - test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: 'a'.repeat(101), - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - expect(() => app.synth()).toThrow(`Deployment group name: "${'a'.repeat(101)}" can be a max of 100 characters.`); - }); - - test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: 'my name', - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - expect(() => app.synth()).toThrow('Deployment group name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); - }); - - test('fail when ECS service does not use CODE_DEPLOY deployment controller', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef'); - - taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }); - - const service = new ecs.FargateService(stack, 'FargateService', { - cluster, - taskDefinition, - deploymentController: { - type: ecs.DeploymentControllerType.ECS, - }, - }); - - expect(() => new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: 'a'.repeat(101), - service, - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - })).toThrow('The ECS service associated with the deployment group must use the CODE_DEPLOY deployment controller type'); - }); - - test('fail when ECS service uses CODE_DEPLOY deployment controller, but did not strip the revision ID from the task definition', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef'); - - taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }); - - const service = new ecs.FargateService(stack, 'FargateService', { - cluster, - taskDefinition, - deploymentController: { - type: ecs.DeploymentControllerType.CODE_DEPLOY, - }, - }); - (service.node.defaultChild as ecs.CfnService).taskDefinition = 'arn:aws:ecs:us-west-2:123456789012:task-definition/hello_world:8'; - - expect(() => new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: 'a'.repeat(101), - service, - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - })).toThrow('The ECS service associated with the deployment group must specify the task definition using the task definition family name only. Otherwise, the task definition cannot be updated in the stack'); - }); - - test('can be created with explicit role', () => { - const stack = new cdk.Stack(); - const serviceRole = new iam.Role(stack, 'MyRole', { - assumedBy: new iam.ServicePrincipal('not-codedeploy.test'), - }); - - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - role: serviceRole, - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'not-codedeploy.test', - }, - }], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AWSCodeDeployRoleForECS', - ], - ], - }, - ], - }); - }); - - test('can rollback on alarm', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - alarms: [ - new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'blue/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'green/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - ], - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Alarms: [ - { - Name: { - Ref: 'BlueTGUnHealthyHostsE5A415E0', - }, - }, - { - Name: { - Ref: 'GreenTGUnHealthyHosts49873ED5', - }, - }, - ], - Enabled: true, - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - 'DEPLOYMENT_STOP_ON_ALARM', - ], - }, - }); - }); - - test('can add alarms after construction', () => { - const stack = new cdk.Stack(); - const dg = new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - alarms: [ - new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'blue/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - ], - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - dg.addAlarm(new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'green/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - })); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Alarms: [ - { - Name: { - Ref: 'BlueTGUnHealthyHostsE5A415E0', - }, - }, - { - Name: { - Ref: 'GreenTGUnHealthyHosts49873ED5', - }, - }, - ], - Enabled: true, - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - 'DEPLOYMENT_STOP_ON_ALARM', - ], - }, - }); - }); - - test('fail if alarm rollbacks are enabled, but no alarms provided', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - autoRollback: { - deploymentInAlarm: true, - }, - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - expect(() => app.synth()).toThrow('The auto-rollback setting \'deploymentInAlarm\' does not have any effect unless you associate at least one CloudWatch alarm with the Deployment Group.'); - }); - - test('can disable rollback when alarm polling fails', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - ignorePollAlarmsFailure: true, - alarms: [ - new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'blue/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'green/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - ], - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Alarms: [ - { - Name: { - Ref: 'BlueTGUnHealthyHostsE5A415E0', - }, - }, - { - Name: { - Ref: 'GreenTGUnHealthyHosts49873ED5', - }, - }, - ], - Enabled: true, - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - 'DEPLOYMENT_STOP_ON_ALARM', - ], - }, - }); - }); - - test('can disable rollback when deployment fails', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - autoRollback: { - failedDeployment: false, - }, - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResource('AWS::CodeDeploy::DeploymentGroup', { - Type: 'AWS::CodeDeploy::DeploymentGroup', - Properties: { - ApplicationName: { - Ref: 'MyDGApplication57B1E402', - }, - ServiceRoleArn: { - 'Fn::GetAtt': [ - 'MyDGServiceRole5E94FD88', - 'Arn', - ], - }, - BlueGreenDeploymentConfiguration: { - DeploymentReadyOption: { - ActionOnTimeout: 'CONTINUE_DEPLOYMENT', - WaitTimeInMinutes: 0, - }, - TerminateBlueInstancesOnDeploymentSuccess: { - Action: 'TERMINATE', - TerminationWaitTimeInMinutes: 0, - }, - }, - DeploymentConfigName: 'CodeDeployDefault.ECSAllAtOnce', - DeploymentStyle: { - DeploymentOption: 'WITH_TRAFFIC_CONTROL', - DeploymentType: 'BLUE_GREEN', - }, - ECSServices: [ - { - ClusterName: 'my-cluster', - ServiceName: 'my-service', - }, - ], - LoadBalancerInfo: { - TargetGroupPairInfoList: [ - { - ProdTrafficRoute: { - ListenerArns: [ - 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/prod', - ], - }, - TargetGroups: [ - { - Name: 'blue', - }, - { - Name: 'green', - }, - ], - }, - ], - }, - }, - }); - }); - - test('can enable rollback when deployment stops', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - autoRollback: { - stoppedDeployment: true, - }, - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - 'DEPLOYMENT_STOP_ON_REQUEST', - ], - }, - }); - }); - - test('can disable rollback when alarm in failure state', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - autoRollback: { - deploymentInAlarm: false, - }, - alarms: [ - new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'blue/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { - metric: new cloudwatch.Metric({ - namespace: 'AWS/ApplicationELB', - metricName: 'UnHealthyHostCount', - dimensionsMap: { - TargetGroup: 'green/f7a80aba5edd5980', - LoadBalancer: 'app/myloadbalancer/lb-12345', - }, - }), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - }), - ], - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Alarms: [ - { - Name: { - Ref: 'BlueTGUnHealthyHostsE5A415E0', - }, - }, - { - Name: { - Ref: 'GreenTGUnHealthyHosts49873ED5', - }, - }, - ], - Enabled: true, - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - ], - }, - }); - }); - - test('can specify a test traffic route', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - testListener: mockListener(stack, 'test'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - LoadBalancerInfo: { - TargetGroupPairInfoList: [ - { - ProdTrafficRoute: { - ListenerArns: [ - 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/prod', - ], - }, - TestTrafficRoute: { - ListenerArns: [ - 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/test', - ], - }, - TargetGroups: [ - { - Name: 'blue', - }, - { - Name: 'green', - }, - ], - }, - ], - }, - }); - }); - - test('can require manual deployment approval', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - deploymentApprovalWaitTime: Duration.hours(8), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - BlueGreenDeploymentConfiguration: { - DeploymentReadyOption: { - ActionOnTimeout: 'STOP_DEPLOYMENT', - WaitTimeInMinutes: 480, - }, - TerminateBlueInstancesOnDeploymentSuccess: { - Action: 'TERMINATE', - TerminationWaitTimeInMinutes: 0, - }, - }, - }); - }); - - test('can add deployment bake time', () => { - const stack = new cdk.Stack(); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - terminationWaitTime: Duration.hours(1), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - BlueGreenDeploymentConfiguration: { - DeploymentReadyOption: { - ActionOnTimeout: 'CONTINUE_DEPLOYMENT', - WaitTimeInMinutes: 0, - }, - TerminateBlueInstancesOnDeploymentSuccess: { - Action: 'TERMINATE', - TerminationWaitTimeInMinutes: 60, - }, - }, - }); - }); - - test('uses the correct Service Principal in the us-isob-east-1 region', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'CodeDeployLambdaStack', { - env: { region: 'us-isob-east-1' }, - }); - new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { - service: mockEcsService(stack), - blueGreenDeploymentConfig: { - blueTargetGroup: mockTargetGroup(stack, 'blue'), - greenTargetGroup: mockTargetGroup(stack, 'green'), - listener: mockListener(stack, 'prod'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'codedeploy.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - }); - - describe('deploymentGroup from ARN in different account and region', () => { - let stack: Stack; - let application: codedeploy.IEcsApplication; - let group: codedeploy.IEcsDeploymentGroup; - - const account = '222222222222'; - const region = 'theregion-1'; - - beforeEach(() => { - stack = new cdk.Stack(undefined, 'Stack', { env: { account: '111111111111', region: 'blabla-1' } }); - - application = codedeploy.EcsApplication.fromEcsApplicationArn(stack, 'Application', `arn:aws:codedeploy:${region}:${account}:application:MyApplication`); - group = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'Group', { - application, - deploymentGroupName: 'DeploymentGroup', - }); - }); - - test('knows its account and region', () => { - // THEN - expect(application.env).toEqual(expect.objectContaining({ account, region })); - expect(group.env).toEqual(expect.objectContaining({ account, region })); - }); - - test('references the predefined DeploymentGroupConfig in the right region', () => { - expect(group.deploymentConfig.deploymentConfigArn).toEqual(expect.stringContaining( - `:codedeploy:${region}:${account}:deploymentconfig:CodeDeployDefault.ECSAllAtOnce`, - )); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.ts deleted file mode 100644 index 651ed7efa0962..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-config.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as codedeploy from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-ecs-config'); - -new codedeploy.EcsDeploymentConfig(stack, 'LinearConfig', { - trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), -}); - -new integ.IntegTest(app, 'EcsDeploymentConfigTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.ts deleted file mode 100644 index 96bc428c7e283..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/ecs/integ.deployment-group.ts +++ /dev/null @@ -1,239 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as codedeploy from '../../lib'; - -/** - * Follow these instructions to manually test running a CodeDeploy deployment with the resources provisioned in this stack: - * - * 1. Deploy the stack: -``` -$ cdk deploy --app 'node integ.deployment-group.js' aws-cdk-codedeploy-ecs-dg -``` - * - * 2. Create a file called `appspec.json` with the following contents, replacing the placeholders with output values from the deployed stack: -``` -{ - "version": 0.0, - "Resources": [ - { - "TargetService": { - "Type": "AWS::ECS::Service", - "Properties": { - "TaskDefinition": "", - "LoadBalancerInfo": { - "ContainerName": "Container", - "ContainerPort": 80 - }, - "PlatformVersion": "LATEST", - "NetworkConfiguration": { - "awsvpcConfiguration": { - "subnets": [ - "", - "", - ], - "securityGroups": [ - "" - ], - "assignPublicIp": "DISABLED" - } - } - } - } - } - ] -} -``` - * - * 3. Start the deployment: -``` -$ appspec=$(jq -R -s '.' < appspec.json | sed 's/\\n//g') -$ aws deploy create-deployment \ - --application-name \ - --deployment-group-name \ - --description "AWS CDK integ test" \ - --revision revisionType=AppSpecContent,appSpecContent={content="$appspec"} -``` - * - * 4. Wait for the deployment to complete successfully, providing the deployment ID from the previous step: -``` -$ aws deploy wait deployment-successful --deployment-id -``` - * - * 5. Destroy the stack: -``` -$ cdk destroy --app 'node integ.deployment-group.js' aws-cdk-codedeploy-ecs-dg -``` - */ - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-ecs-dg'); - -// Network infrastructure -const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); - -// ECS service -const cluster = new ecs.Cluster(stack, 'EcsCluster', { - vpc, -}); -const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); -taskDefinition.addContainer('Container', { - image: ecs.ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), - portMappings: [{ containerPort: 80 }], -}); -const service = new ecs.FargateService(stack, 'FargateService', { - cluster, - taskDefinition, - deploymentController: { - type: ecs.DeploymentControllerType.CODE_DEPLOY, - }, -}); - -// A second task definition for testing a CodeDeploy deployment of the ECS service to a new task definition -const taskDefinition2 = new ecs.FargateTaskDefinition(stack, 'TaskDef2'); -taskDefinition2.addContainer('Container', { - image: ecs.ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'), - portMappings: [{ containerPort: 80 }], -}); -service.node.addDependency(taskDefinition2); - -// Load balancer -const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'ServiceLB', { - vpc, - internetFacing: false, -}); - -// Listeners -const prodListener = loadBalancer.addListener('ProdListener', { - port: 80, // port for production traffic - protocol: elbv2.ApplicationProtocol.HTTP, -}); -const testListener = loadBalancer.addListener('TestListener', { - port: 9002, // port for testing - protocol: elbv2.ApplicationProtocol.HTTP, -}); - -// Target groups -const blueTG = prodListener.addTargets('BlueTG', { - port: 80, - protocol: elbv2.ApplicationProtocol.HTTP, - targets: [ - service.loadBalancerTarget({ - containerName: 'Container', - containerPort: 80, - }), - ], - deregistrationDelay: cdk.Duration.seconds(30), - healthCheck: { - interval: cdk.Duration.seconds(5), - healthyHttpCodes: '200', - healthyThresholdCount: 2, - unhealthyThresholdCount: 3, - timeout: cdk.Duration.seconds(4), - }, -}); - -const greenTG = new elbv2.ApplicationTargetGroup(stack, 'GreenTG', { - vpc, - port: 80, - protocol: elbv2.ApplicationProtocol.HTTP, - targetType: elbv2.TargetType.IP, - deregistrationDelay: cdk.Duration.seconds(30), - healthCheck: { - interval: cdk.Duration.seconds(5), - healthyHttpCodes: '200', - healthyThresholdCount: 2, - unhealthyThresholdCount: 3, - timeout: cdk.Duration.seconds(4), - }, -}); - -testListener.addTargetGroups('GreenTGTest', { - targetGroups: [greenTG], -}); - -prodListener.node.addDependency(greenTG); -testListener.node.addDependency(blueTG); -service.node.addDependency(testListener); -service.node.addDependency(greenTG); - -// Alarms: monitor 500s and unhealthy hosts on target groups -const blueUnhealthyHosts = new cloudwatch.Alarm(stack, 'BlueUnhealthyHosts', { - alarmName: stack.stackName + '-Unhealthy-Hosts-Blue', - metric: blueTG.metricUnhealthyHostCount(), - threshold: 1, - evaluationPeriods: 2, -}); - -const blueApiFailure = new cloudwatch.Alarm(stack, 'Blue5xx', { - alarmName: stack.stackName + '-Http-500-Blue', - metric: blueTG.metricHttpCodeTarget( - elbv2.HttpCodeTarget.TARGET_5XX_COUNT, - { period: cdk.Duration.minutes(1) }, - ), - threshold: 1, - evaluationPeriods: 1, -}); - -const greenUnhealthyHosts = new cloudwatch.Alarm(stack, 'GreenUnhealthyHosts', { - alarmName: stack.stackName + '-Unhealthy-Hosts-Green', - metric: greenTG.metricUnhealthyHostCount(), - threshold: 1, - evaluationPeriods: 2, -}); - -const greenApiFailure = new cloudwatch.Alarm(stack, 'Green5xx', { - alarmName: stack.stackName + '-Http-500-Green', - metric: greenTG.metricHttpCodeTarget( - elbv2.HttpCodeTarget.TARGET_5XX_COUNT, - { period: cdk.Duration.minutes(1) }, - ), - threshold: 1, - evaluationPeriods: 1, -}); - -// Deployment group -const deploymentConfig = new codedeploy.EcsDeploymentConfig(stack, 'CanaryConfig', { - trafficRouting: codedeploy.TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 20, - }), -}); - -const dg = new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { - alarms: [ - blueUnhealthyHosts, - blueApiFailure, - greenUnhealthyHosts, - greenApiFailure, - ], - service, - blueGreenDeploymentConfig: { - blueTargetGroup: blueTG, - greenTargetGroup: greenTG, - listener: prodListener, - testListener, - terminationWaitTime: cdk.Duration.minutes(1), - }, - deploymentConfig, - autoRollback: { - stoppedDeployment: true, - }, -}); - -// Outputs to use for manual testing -new cdk.CfnOutput(stack, 'NewTaskDefinition', { value: taskDefinition2.taskDefinitionArn }); -new cdk.CfnOutput(stack, 'Subnet1Id', { value: vpc.privateSubnets[0].subnetId }); -new cdk.CfnOutput(stack, 'Subnet2Id', { value: vpc.privateSubnets[1].subnetId }); -new cdk.CfnOutput(stack, 'SecurityGroupId', { value: service.connections.securityGroups[0].securityGroupId }); -new cdk.CfnOutput(stack, 'CodeDeployApplicationName', { value: dg.application.applicationName }); -new cdk.CfnOutput(stack, 'CodeDeployDeploymentGroupName', { value: dg.deploymentGroupName }); - -new integ.IntegTest(app, 'EcsDeploymentGroupTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/application.test.ts b/packages/@aws-cdk/aws-codedeploy/test/lambda/application.test.ts deleted file mode 100644 index 7832ef202c949..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/lambda/application.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - -describe('CodeDeploy Lambda Application', () => { - test('can be created', () => { - const stack = new cdk.Stack(); - new codedeploy.LambdaApplication(stack, 'MyApp'); - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { - ComputePlatform: 'Lambda', - }); - }); - - test('can be created with explicit name', () => { - const stack = new cdk.Stack(); - new codedeploy.LambdaApplication(stack, 'MyApp', { - applicationName: 'my-name', - }); - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { - ApplicationName: 'my-name', - ComputePlatform: 'Lambda', - }); - }); - - test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.LambdaApplication(stack, 'MyApp', { - applicationName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Application name: "${'a'.repeat(101)}" can be a max of 100 characters.`); - }); - - test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.LambdaApplication(stack, 'MyApp', { - applicationName: 'my name', - }); - - expect(() => app.synth()).toThrow('Application name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); - }); - - test('can be imported', () => { - const stack = new cdk.Stack(); - - const application = codedeploy.LambdaApplication.fromLambdaApplicationName(stack, 'MyApp', 'MyApp'); - - expect(application).not.toEqual(undefined); - expect(application.applicationName).toEqual('MyApp'); - }); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-config.test.ts b/packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-config.test.ts deleted file mode 100644 index b50e897bf366d..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-config.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; -import { TrafficRouting } from '../../lib'; - -/* eslint-disable quote-props */ - -let stack: cdk.Stack; - -beforeEach(() => { - stack = new cdk.Stack(); -}); - -test('can create default config', () => { - // WHEN - new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'Lambda', - 'TrafficRoutingConfig': { - 'Type': 'AllAtOnce', - }, - }); -}); - -test('can create all-at-once config', () => { - // WHEN - new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.allAtOnce(), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'Lambda', - 'TrafficRoutingConfig': { - 'Type': 'AllAtOnce', - }, - }); -}); - -test('can create linear config', () => { - // WHEN - new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedLinear({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'Lambda', - 'TrafficRoutingConfig': { - 'TimeBasedLinear': { - 'LinearInterval': 1, - 'LinearPercentage': 5, - }, - 'Type': 'TimeBasedLinear', - }, - }); -}); - -test('can create canary config', () => { - // WHEN - new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'Lambda', - 'TrafficRoutingConfig': { - 'TimeBasedCanary': { - 'CanaryInterval': 1, - 'CanaryPercentage': 5, - }, - 'Type': 'TimeBasedCanary', - }, - }); -}); - -test('can create a config with a specific name', () => { - // WHEN - new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { - deploymentConfigName: 'MyCanaryConfig', - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'ComputePlatform': 'Lambda', - 'DeploymentConfigName': 'MyCanaryConfig', - 'TrafficRoutingConfig': { - 'TimeBasedCanary': { - 'CanaryInterval': 1, - 'CanaryPercentage': 5, - }, - 'Type': 'TimeBasedCanary', - }, - }); -}); - -test('can be imported', () => { - const deploymentConfig = codedeploy.LambdaDeploymentConfig.fromLambdaDeploymentConfigName(stack, 'MyDC', 'MyDC'); - - expect(deploymentConfig).not.toEqual(undefined); -}); - -test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stackWithApp = new cdk.Stack(app); - new codedeploy.LambdaDeploymentConfig(stackWithApp, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - deploymentConfigName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Deployment config name: "${'a'.repeat(101)}" can be a max of 100 characters.`); -}); - -test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stackWithApp = new cdk.Stack(app); - new codedeploy.LambdaDeploymentConfig(stackWithApp, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - deploymentConfigName: 'my name', - }); - - expect(() => app.synth()).toThrow('Deployment config name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.test.ts b/packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.test.ts deleted file mode 100644 index 33dadeb60dd61..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.test.ts +++ /dev/null @@ -1,697 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Stack } from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; -import { TrafficRouting } from '../../lib'; - -function mockFunction(stack: cdk.Stack, id: string) { - return new lambda.Function(stack, id, { - code: lambda.Code.fromInline('mock'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); -} -function mockAlias(stack: cdk.Stack) { - return new lambda.Alias(stack, 'Alias', { - aliasName: 'my-alias', - version: new lambda.Version(stack, 'Version', { - lambda: mockFunction(stack, 'Function'), - }), - }); -} - -describe('CodeDeploy Lambda DeploymentGroup', () => { - test('can be created with default AllAtOnce IN_PLACE configuration', () => { - const stack = new cdk.Stack(); - stack.node.setContext('@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup', true); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - ServiceRoleArn: { - 'Fn::GetAtt': [ - 'MyDGServiceRole5E94FD88', - 'Arn', - ], - }, - AlarmConfiguration: { - Enabled: false, - Alarms: Match.absent(), - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - ], - }, - DeploymentConfigName: 'CodeDeployDefault.LambdaAllAtOnce', - DeploymentStyle: { - DeploymentOption: 'WITH_TRAFFIC_CONTROL', - DeploymentType: 'BLUE_GREEN', - }, - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { - Type: 'AWS::Lambda::Alias', - Properties: { - FunctionName: { - Ref: 'Function76856677', - }, - FunctionVersion: { - 'Fn::GetAtt': [ - 'Version6A868472', - 'Version', - ], - }, - Name: 'my-alias', - }, - UpdatePolicy: { - CodeDeployLambdaAliasUpdate: { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - DeploymentGroupName: { - Ref: 'MyDGC350BD3F', - }, - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: { - 'Fn::FindInMap': [ - 'ServiceprincipalMap', - { - Ref: 'AWS::Region', - }, - 'codedeploy', - ], - }, - }, - }], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited', - ], - ], - }, - ], - }); - }); - - test('can be created with explicit name', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - deploymentGroupName: 'test', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - DeploymentGroupName: 'test', - }); - }); - - test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - alias, - deploymentGroupName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Deployment group name: "${'a'.repeat(101)}" can be a max of 100 characters.`); - }); - - test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - alias, - deploymentGroupName: 'my name', - }); - - expect(() => app.synth()).toThrow('Deployment group name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); - }); - - test('can be created with explicit role', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - const serviceRole = new iam.Role(stack, 'MyRole', { - assumedBy: new iam.ServicePrincipal('not-codedeploy.test'), - }); - - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - role: serviceRole, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'not-codedeploy.test', - }, - }], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited', - ], - ], - }, - ], - }); - }); - - test('can configure blue/green traffic shifting', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - ServiceRoleArn: { - 'Fn::GetAtt': [ - 'MyDGServiceRole5E94FD88', - 'Arn', - ], - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - ], - }, - DeploymentConfigName: 'CodeDeployDefault.LambdaLinear10PercentEvery1Minute', - DeploymentStyle: { - DeploymentOption: 'WITH_TRAFFIC_CONTROL', - DeploymentType: 'BLUE_GREEN', - }, - }); - }); - - test('can rollback on alarm', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - alarms: [new cloudwatch.Alarm(stack, 'Failures', { - metric: alias.metricErrors(), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - })], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Alarms: [{ - Name: { - Ref: 'Failures8A3E1A2F', - }, - }], - Enabled: true, - }, - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - 'DEPLOYMENT_STOP_ON_ALARM', - ], - }, - }); - }); - - test('onPreHook throws error if pre-hook already defined', () => { - const stack = new cdk.Stack(); - const alias = mockAlias(stack); - const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - alias, - preHook: mockFunction(stack, 'PreHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - expect(() => group.addPreHook(mockFunction(stack, 'PreHook2'))).toThrow(); - }); - - test('onPostHook throws error if post-hook already defined', () => { - const stack = new cdk.Stack(); - const alias = mockAlias(stack); - const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - alias, - postHook: mockFunction(stack, 'PostHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - expect(() => group.addPostHook(mockFunction(stack, 'PostHook2'))).toThrow(); - }); - - test('can run pre hook lambda function before deployment', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - preHook: mockFunction(stack, 'PreHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { - UpdatePolicy: { - CodeDeployLambdaAliasUpdate: { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - DeploymentGroupName: { - Ref: 'MyDGC350BD3F', - }, - BeforeAllowTrafficHook: { - Ref: 'PreHook8B53F672', - }, - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', - Roles: [{ - Ref: 'MyDGServiceRole5E94FD88', - }], - PolicyDocument: { - Statement: [{ - Action: 'lambda:InvokeFunction', - Resource: [ - { 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, ':*']] }, - ], - Effect: 'Allow', - }], - Version: '2012-10-17', - }, - }); - }); - - test('can add pre hook lambda function after creating the deployment group', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - group.addPreHook(mockFunction(stack, 'PreHook')); - - Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { - UpdatePolicy: { - CodeDeployLambdaAliasUpdate: { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - DeploymentGroupName: { - Ref: 'MyDGC350BD3F', - }, - BeforeAllowTrafficHook: { - Ref: 'PreHook8B53F672', - }, - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', - Roles: [{ - Ref: 'MyDGServiceRole5E94FD88', - }], - PolicyDocument: { - Statement: [{ - Action: 'lambda:InvokeFunction', - Resource: [ - { 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, ':*']] }, - ], - Effect: 'Allow', - }], - Version: '2012-10-17', - }, - }); - }); - - test('can run post hook lambda function before deployment', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - postHook: mockFunction(stack, 'PostHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { - UpdatePolicy: { - CodeDeployLambdaAliasUpdate: { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - DeploymentGroupName: { - Ref: 'MyDGC350BD3F', - }, - AfterAllowTrafficHook: { - Ref: 'PostHookF2E49B30', - }, - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', - Roles: [{ - Ref: 'MyDGServiceRole5E94FD88', - }], - PolicyDocument: { - Statement: [{ - Action: 'lambda:InvokeFunction', - Resource: [ - { 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, ':*']] }, - ], - Effect: 'Allow', - }], - Version: '2012-10-17', - }, - }); - }); - - test('can add post hook lambda function after creating the deployment group', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - }); - group.addPostHook(mockFunction(stack, 'PostHook')); - - Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { - UpdatePolicy: { - CodeDeployLambdaAliasUpdate: { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - DeploymentGroupName: { - Ref: 'MyDGC350BD3F', - }, - AfterAllowTrafficHook: { - Ref: 'PostHookF2E49B30', - }, - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', - Roles: [{ - Ref: 'MyDGServiceRole5E94FD88', - }], - PolicyDocument: { - Statement: [{ - Action: 'lambda:InvokeFunction', - Resource: [ - { 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, ':*']] }, - ], - Effect: 'Allow', - }], - Version: '2012-10-17', - }, - }); - }); - - test('can disable rollback when alarm polling fails', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - postHook: mockFunction(stack, 'PostHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - ignorePollAlarmsFailure: true, - alarms: [new cloudwatch.Alarm(stack, 'Failures', { - metric: alias.metricErrors(), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - })], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Alarms: [{ - Name: { - Ref: 'Failures8A3E1A2F', - }, - }], - Enabled: true, - IgnorePollAlarmFailure: true, - }, - }); - }); - - test('can disable rollback when deployment fails', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - postHook: mockFunction(stack, 'PostHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - autoRollback: { - failedDeployment: false, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - ApplicationName: { - Ref: 'MyApp3CE31C26', - }, - ServiceRoleArn: { - 'Fn::GetAtt': [ - 'MyDGServiceRole5E94FD88', - 'Arn', - ], - }, - DeploymentConfigName: 'CodeDeployDefault.LambdaAllAtOnce', - DeploymentStyle: { - DeploymentOption: 'WITH_TRAFFIC_CONTROL', - DeploymentType: 'BLUE_GREEN', - }, - }); - }); - - test('can enable rollback when deployment stops', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - postHook: mockFunction(stack, 'PostHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - autoRollback: { - stoppedDeployment: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - 'DEPLOYMENT_STOP_ON_REQUEST', - ], - }, - }); - }); - - test('can disable rollback when alarm in failure state', () => { - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - postHook: mockFunction(stack, 'PostHook'), - deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, - autoRollback: { - deploymentInAlarm: false, - }, - alarms: [new cloudwatch.Alarm(stack, 'Failures', { - metric: alias.metricErrors(), - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - })], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AutoRollbackConfiguration: { - Enabled: true, - Events: [ - 'DEPLOYMENT_FAILURE', - ], - }, - }); - }); - - test('uses the correct Service Principal in the us-isob-east-1 region', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'CodeDeployLambdaStack', { - env: { region: 'us-isob-east-1' }, - }); - const alias = mockAlias(stack); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - alias, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'codedeploy.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - }); - - describe('deploymentGroup from ARN in different account and region', () => { - let stack: Stack; - let application: codedeploy.ILambdaApplication; - let group: codedeploy.ILambdaDeploymentGroup; - - const account = '222222222222'; - const region = 'theregion-1'; - - beforeEach(() => { - stack = new cdk.Stack(undefined, 'Stack', { env: { account: '111111111111', region: 'blabla-1' } }); - - application = codedeploy.LambdaApplication.fromLambdaApplicationArn(stack, 'Application', `arn:aws:codedeploy:${region}:${account}:application:MyApplication`); - group = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(stack, 'Group', { - application, - deploymentGroupName: 'DeploymentGroup', - }); - }); - - test('knows its account and region', () => { - // THEN - expect(application.env).toEqual(expect.objectContaining({ account, region })); - expect(group.env).toEqual(expect.objectContaining({ account, region })); - }); - - test('references the predefined DeploymentGroupConfig in the right region', () => { - expect(group.deploymentConfig.deploymentConfigArn).toEqual(expect.stringContaining( - `:codedeploy:${region}:${account}:deploymentconfig:CodeDeployDefault.LambdaCanary10Percent5Minutes`, - )); - }); - }); -}); - -describe('imported with fromLambdaDeploymentGroupAttributes', () => { - test('defaults the Deployment Config to Canary10Percent5Minutes', () => { - const stack = new cdk.Stack(); - - const lambdaApp = codedeploy.LambdaApplication.fromLambdaApplicationName(stack, 'LA', 'LambdaApplication'); - const importedGroup = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(stack, 'LDG', { - application: lambdaApp, - deploymentGroupName: 'LambdaDeploymentGroup', - }); - - expect(importedGroup.deploymentConfig.deploymentConfigName).toEqual('CodeDeployDefault.LambdaCanary10Percent5Minutes'); - }); -}); - -test('dependency on the config exists to ensure ordering', () => { - // WHEN - const stack = new cdk.Stack(); - const application = new codedeploy.LambdaApplication(stack, 'MyApp'); - const alias = mockAlias(stack); - const config = new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { - trafficRouting: TrafficRouting.timeBasedCanary({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), - }); - new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { - application, - alias, - deploymentConfig: config, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::CodeDeploy::DeploymentGroup', { - Properties: { - DeploymentConfigName: stack.resolve(config.deploymentConfigName), - }, - DependsOn: [ - stack.getLogicalId(config.node.defaultChild as codedeploy.CfnDeploymentConfig), - ], - }); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.ts b/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.ts deleted file mode 100644 index de578cb7eb648..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-config.ts +++ /dev/null @@ -1,19 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as codedeploy from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda-config'); - -new codedeploy.LambdaDeploymentConfig(stack, 'LinearConfig', { - trafficRouting: codedeploy.TrafficRouting.timeBasedLinear({ - interval: cdk.Duration.minutes(1), - percentage: 5, - }), -}); - -new integ.IntegTest(app, 'LambdaDeploymentConfigTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.ts deleted file mode 100644 index 1eda714fab3ae..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/lambda/integ.deployment-group.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as path from 'path'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-lambda'); - -const handler = new lambda.Function(stack, 'Handler', { - code: lambda.Code.fromAsset(path.join(__dirname, 'handler')), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); -const version = handler.currentVersion; -const blueGreenAlias = new lambda.Alias(stack, 'Alias', { - aliasName: 'alias', - version, -}); - -const preHook = new lambda.Function(stack, 'PreHook', { - code: lambda.Code.fromAsset(path.join(__dirname, 'preHook')), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); -const postHook = new lambda.Function(stack, 'PostHook', { - code: lambda.Code.fromAsset(path.join(__dirname, 'postHook')), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); - -new codedeploy.LambdaDeploymentGroup(stack, 'BlueGreenDeployment', { - alias: blueGreenAlias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, - alarms: [ - new cloudwatch.Alarm(stack, 'BlueGreenErrors', { - comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, - threshold: 1, - evaluationPeriods: 1, - metric: blueGreenAlias.metricErrors(), - }), - ], - preHook, - postHook, -}); - -const secondAlias = new lambda.Alias(stack, 'SecondAlias', { - aliasName: 'secondAlias', - version, -}); - -new codedeploy.LambdaDeploymentGroup(stack, 'SecondDeployment', { - alias: secondAlias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/deployment-config.test.ts b/packages/@aws-cdk/aws-codedeploy/test/server/deployment-config.test.ts deleted file mode 100644 index 8523518c68a34..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/server/deployment-config.test.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - -/* eslint-disable quote-props */ - -describe('CodeDeploy DeploymentConfig', () => { - test('can be created by specifying only minHealthyHostCount', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { - minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(1), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'MinimumHealthyHosts': { - 'Type': 'HOST_COUNT', - 'Value': 1, - }, - }); - }); - - test('can be created by specifying only minHealthyHostPercentage', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { - minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { - 'MinimumHealthyHosts': { - 'Type': 'FLEET_PERCENT', - 'Value': 75, - }, - }); - }); - - test('can be imported', () => { - const stack = new cdk.Stack(); - - const deploymentConfig = codedeploy.ServerDeploymentConfig.fromServerDeploymentConfigName(stack, 'MyDC', 'MyDC'); - - expect(deploymentConfig).not.toEqual(undefined); - }); - - test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { - minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), - deploymentConfigName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Deployment config name: "${'a'.repeat(101)}" can be a max of 100 characters.`); - }); - - test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { - minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), - deploymentConfigName: 'my name', - }); - - expect(() => app.synth()).toThrow('Deployment config name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); - }); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/deployment-group.test.ts b/packages/@aws-cdk/aws-codedeploy/test/server/deployment-group.test.ts deleted file mode 100644 index 7787af144c0ba..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/server/deployment-group.test.ts +++ /dev/null @@ -1,544 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as lbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - -/* eslint-disable quote-props */ - -describe('CodeDeploy Server Deployment Group', () => { - test('can be created by explicitly passing an Application', () => { - const stack = new cdk.Stack(); - - const application = new codedeploy.ServerApplication(stack, 'MyApp'); - new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { - application, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'ApplicationName': { - 'Ref': 'MyApp3CE31C26', - }, - }); - }); - - test('can create a deployment group with no alarms', () => { - const stack = new cdk.Stack(); - stack.node.setContext('@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup', true); - - const application = new codedeploy.ServerApplication(stack, 'MyApp'); - new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { - application, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - AlarmConfiguration: { - Enabled: false, - Alarms: Match.absent(), - }, - }); - }); - - test('creating an application with physical name if needed', () => { - const stack = new cdk.Stack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } }); - const stack2 = new cdk.Stack(undefined, undefined, { env: { account: '12346', region: 'us-test-2' } }); - const serverDeploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: cdk.PhysicalName.GENERATE_IF_NEEDED, - }); - - new cdk.CfnOutput(stack2, 'Output', { - value: serverDeploymentGroup.application.applicationName, - }); - - Template.fromStack(stack2).hasOutput('Output', { - Value: 'defaultmydgapplication78dba0bb0c7580b32033', - }); - }); - - test('can be imported', () => { - const stack = new cdk.Stack(); - - const application = codedeploy.ServerApplication.fromServerApplicationName(stack, 'MyApp', 'MyApp'); - const deploymentGroup = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes(stack, 'MyDG', { - application, - deploymentGroupName: 'MyDG', - }); - - expect(deploymentGroup).not.toEqual(undefined); - }); - - test('uses good linux install agent script', () => { - const stack = new cdk.Stack(); - - const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), - machineImage: new ec2.AmazonLinuxImage(), - vpc: new ec2.Vpc(stack, 'VPC'), - }); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoScalingGroups: [asg], - installAgent: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - 'UserData': { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\nset +e\nPKG_CMD=`which yum 2>/dev/null`\nset -e\nif [ -z "$PKG_CMD" ]; then\nPKG_CMD=apt-get\nelse\nPKG_CMD=yum\nfi\n$PKG_CMD update -y\nset +e\n$PKG_CMD install -y ruby2.0\nRUBY2_INSTALL=$?\nset -e\nif [ $RUBY2_INSTALL -ne 0 ]; then\n$PKG_CMD install -y ruby\nfi\nAWS_CLI_PACKAGE_NAME=awscli\nif [ "$PKG_CMD" = "yum" ]; then\nAWS_CLI_PACKAGE_NAME=aws-cli\nfi\n$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME\nTMP_DIR=`mktemp -d`\ncd $TMP_DIR\naws s3 cp s3://aws-codedeploy-', - { - 'Ref': 'AWS::Region', - }, - '/latest/install . --region ', - { - 'Ref': 'AWS::Region', - }, - '\nchmod +x ./install\n./install auto\nrm -fr $TMP_DIR', - ], - ], - }, - }, - }); - }); - - test('uses good windows install agent script', () => { - const stack = new cdk.Stack(); - - const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), - machineImage: new ec2.WindowsImage(ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE, {}), - vpc: new ec2.Vpc(stack, 'VPC'), - }); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoScalingGroups: [asg], - installAgent: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - 'UserData': { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - 'Set-Variable -Name TEMPDIR -Value (New-TemporaryFile).DirectoryName\naws s3 cp s3://aws-codedeploy-', - { - 'Ref': 'AWS::Region', - }, - '/latest/codedeploy-agent.msi $TEMPDIR\\codedeploy-agent.msi\ncd $TEMPDIR\n.\\codedeploy-agent.msi /quiet /l c:\\temp\\host-agent-install-log.txt', - ], - ], - }, - }, - }); - }); - - test('created with ASGs contains the ASG names', () => { - const stack = new cdk.Stack(); - - const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), - machineImage: new ec2.AmazonLinuxImage(), - vpc: new ec2.Vpc(stack, 'VPC'), - }); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoScalingGroups: [asg], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AutoScalingGroups': [ - { - 'Ref': 'ASG46ED3070', - }, - ], - }); - }); - - test('created without ASGs but adding them later contains the ASG names', () => { - const stack = new cdk.Stack(); - - const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), - machineImage: new ec2.AmazonLinuxImage(), - vpc: new ec2.Vpc(stack, 'VPC'), - }); - - const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup'); - deploymentGroup.addAutoScalingGroup(asg); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AutoScalingGroups': [ - { - 'Ref': 'ASG46ED3070', - }, - ], - }); - }); - - test('can be created with an ALB Target Group as the load balancer', () => { - const stack = new cdk.Stack(); - - const alb = new lbv2.ApplicationLoadBalancer(stack, 'ALB', { - vpc: new ec2.Vpc(stack, 'VPC'), - }); - const listener = alb.addListener('Listener', { protocol: lbv2.ApplicationProtocol.HTTP }); - const targetGroup = listener.addTargets('Fleet', { protocol: lbv2.ApplicationProtocol.HTTP }); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - loadBalancer: codedeploy.LoadBalancer.application(targetGroup), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'LoadBalancerInfo': { - 'TargetGroupInfoList': [ - { - 'Name': { - 'Fn::GetAtt': [ - 'ALBListenerFleetGroup008CEEE4', - 'TargetGroupName', - ], - }, - }, - ], - }, - 'DeploymentStyle': { - 'DeploymentOption': 'WITH_TRAFFIC_CONTROL', - }, - }); - }); - - test('can be created with an NLB Target Group as the load balancer', () => { - const stack = new cdk.Stack(); - - const nlb = new lbv2.NetworkLoadBalancer(stack, 'NLB', { - vpc: new ec2.Vpc(stack, 'VPC'), - }); - const listener = nlb.addListener('Listener', { port: 80 }); - const targetGroup = listener.addTargets('Fleet', { port: 80 }); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - loadBalancer: codedeploy.LoadBalancer.network(targetGroup), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'LoadBalancerInfo': { - 'TargetGroupInfoList': [ - { - 'Name': { - 'Fn::GetAtt': [ - 'NLBListenerFleetGroupB882EC86', - 'TargetGroupName', - ], - }, - }, - ], - }, - 'DeploymentStyle': { - 'DeploymentOption': 'WITH_TRAFFIC_CONTROL', - }, - }); - }); - - test('can be created with a single EC2 instance tag set with a single or no value', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - ec2InstanceTags: new codedeploy.InstanceTagSet( - { - 'some-key': ['some-value'], - 'other-key': [], - }, - ), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'Ec2TagSet': { - 'Ec2TagSetList': [ - { - 'Ec2TagGroup': [ - { - 'Key': 'some-key', - 'Value': 'some-value', - 'Type': 'KEY_AND_VALUE', - }, - { - 'Key': 'other-key', - 'Type': 'KEY_ONLY', - }, - ], - }, - ], - }, - }); - }); - - test('can be created with two on-premise instance tag sets with multiple values or without a key', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - onPremiseInstanceTags: new codedeploy.InstanceTagSet( - { - 'some-key': ['some-value', 'another-value'], - }, - { - '': ['keyless-value'], - }, - ), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'OnPremisesTagSet': { - 'OnPremisesTagSetList': [ - { - 'OnPremisesTagGroup': [ - { - 'Key': 'some-key', - 'Value': 'some-value', - 'Type': 'KEY_AND_VALUE', - }, - { - 'Key': 'some-key', - 'Value': 'another-value', - 'Type': 'KEY_AND_VALUE', - }, - ], - }, - { - 'OnPremisesTagGroup': [ - { - 'Value': 'keyless-value', - 'Type': 'VALUE_ONLY', - }, - ], - }, - ], - }, - }); - }); - - test('cannot be created with an instance tag set containing a keyless, valueless filter', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - onPremiseInstanceTags: new codedeploy.InstanceTagSet({ - '': [], - }), - }); - }).toThrow(); - }); - - test('cannot be created with an instance tag set containing 4 instance tag groups', () => { - const stack = new cdk.Stack(); - - expect(() => { - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - onPremiseInstanceTags: new codedeploy.InstanceTagSet({}, {}, {}, {}), - }); - }).toThrow(/3/); - }); - - test('can have alarms added to it after being created', () => { - const stack = new cdk.Stack(); - - const alarm = new cloudwatch.Alarm(stack, 'Alarm1', { - metric: new cloudwatch.Metric({ - metricName: 'Errors', - namespace: 'my.namespace', - }), - threshold: 1, - evaluationPeriods: 1, - }); - - const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup'); - deploymentGroup.addAlarm(alarm); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AlarmConfiguration': { - 'Alarms': [ - { - 'Name': { - 'Ref': 'Alarm1F9009D71', - }, - }, - ], - 'Enabled': true, - }, - }); - }); - - test('only automatically rolls back failed deployments by default', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup'); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AutoRollbackConfiguration': { - 'Enabled': true, - 'Events': [ - 'DEPLOYMENT_FAILURE', - ], - }, - }); - }); - - test('rolls back alarmed deployments if at least one alarm has been added', () => { - const stack = new cdk.Stack(); - - const alarm = new cloudwatch.Alarm(stack, 'Alarm1', { - metric: new cloudwatch.Metric({ - metricName: 'Errors', - namespace: 'my.namespace', - }), - threshold: 1, - evaluationPeriods: 1, - }); - - const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoRollback: { - failedDeployment: false, - }, - }); - deploymentGroup.addAlarm(alarm); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AutoRollbackConfiguration': { - 'Enabled': true, - 'Events': [ - 'DEPLOYMENT_STOP_ON_ALARM', - ], - }, - }); - }); - - test('setting to roll back on alarms without providing any results in an exception', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoRollback: { - deploymentInAlarm: true, - }, - }); - - expect(() => app.synth()).toThrow(/deploymentInAlarm/); - }); - - test('disable automatic rollback', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoRollback: { - deploymentInAlarm: false, - failedDeployment: false, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AutoRollbackConfiguration': { - 'Enabled': false, - }, - }); - }); - - test('disable automatic rollback when all options are false', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - autoRollback: { - deploymentInAlarm: false, - failedDeployment: false, - stoppedDeployment: false, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'AutoRollbackConfiguration': { - 'Enabled': false, - }, - }); - }); - - - test('can be used with an imported ALB Target Group as the load balancer', () => { - const stack = new cdk.Stack(); - - new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { - loadBalancer: codedeploy.LoadBalancer.application( - lbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedAlbTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', - }), - ), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { - 'LoadBalancerInfo': { - 'TargetGroupInfoList': [ - { - 'Name': 'myAlbTargetGroup', - }, - ], - }, - 'DeploymentStyle': { - 'DeploymentOption': 'WITH_TRAFFIC_CONTROL', - }, - }); - }); - - test('fail with more than 100 characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { - deploymentGroupName: 'a'.repeat(101), - }); - - expect(() => app.synth()).toThrow(`Deployment group name: "${'a'.repeat(101)}" can be a max of 100 characters.`); - }); - - test('fail with unallowed characters in name', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { - - deploymentGroupName: 'my name', - }); - - expect(() => app.synth()).toThrow('Deployment group name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); - }); - - describe('deploymentGroup from ARN in different account and region', () => { - let stack: cdk.Stack; - let application: codedeploy.IServerApplication; - let group: codedeploy.IServerDeploymentGroup; - - const account = '222222222222'; - const region = 'theregion-1'; - - beforeEach(() => { - stack = new cdk.Stack(undefined, 'Stack', { env: { account: '111111111111', region: 'blabla-1' } }); - - application = codedeploy.ServerApplication.fromServerApplicationArn(stack, 'Application', `arn:aws:codedeploy:${region}:${account}:application:MyApplication`); - group = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes(stack, 'Group', { - application, - deploymentGroupName: 'DeploymentGroup', - }); - }); - - test('knows its account and region', () => { - // THEN - expect(application.env).toEqual(expect.objectContaining({ account, region })); - expect(group.env).toEqual(expect.objectContaining({ account, region })); - }); - - test('references the predefined DeploymentGroupConfig in the right region', () => { - expect(group.deploymentConfig.deploymentConfigArn).toEqual(expect.stringContaining( - `:codedeploy:${region}:${account}:deploymentconfig:CodeDeployDefault.OneAtATime`, - )); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.ts b/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.ts deleted file mode 100644 index aaafc6628456c..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy/test/server/integ.deployment-group.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as lb from '@aws-cdk/aws-elasticloadbalancing'; -import * as cdk from '@aws-cdk/core'; -import * as codedeploy from '../../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-codedeploy-server-dg'); - -const vpc = new ec2.Vpc(stack, 'VPC'); - -const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), - machineImage: new ec2.AmazonLinuxImage(), - vpc, -}); - -const elb = new lb.LoadBalancer(stack, 'ELB', { vpc }); -elb.addListener({ - externalPort: 80, -}); - -new codedeploy.ServerDeploymentGroup(stack, 'CodeDeployGroup', { - deploymentConfig: codedeploy.ServerDeploymentConfig.ALL_AT_ONCE, - autoScalingGroups: [asg], - loadBalancer: codedeploy.LoadBalancer.classic(elb), - alarms: [ - new cloudwatch.Alarm(stack, 'Alarm1', { - metric: new cloudwatch.Metric({ - metricName: 'Errors', - namespace: 'my.namespace', - }), - threshold: 1, - evaluationPeriods: 1, - }), - ], - autoRollback: { - failedDeployment: false, - deploymentInAlarm: false, - }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codeguruprofiler/.eslintrc.js b/packages/@aws-cdk/aws-codeguruprofiler/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codeguruprofiler/.gitignore b/packages/@aws-cdk/aws-codeguruprofiler/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codeguruprofiler/.npmignore b/packages/@aws-cdk/aws-codeguruprofiler/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codeguruprofiler/LICENSE b/packages/@aws-cdk/aws-codeguruprofiler/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codeguruprofiler/NOTICE b/packages/@aws-cdk/aws-codeguruprofiler/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codeguruprofiler/README.md b/packages/@aws-cdk/aws-codeguruprofiler/README.md deleted file mode 100644 index 6c8c54954a40e..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# AWS::CodeGuruProfiler Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Amazon CodeGuru Profiler collects runtime performance data from your live applications, and provides recommendations that can help you fine-tune your application performance. - -## Installation - -Import to your project: - -```ts nofixture -import * as codeguruprofiler from '@aws-cdk/aws-codeguruprofiler'; -``` - -## Basic usage - -Here's how to setup a profiling group and give your compute role permissions to publish to the profiling group to the profiling agent can publish profiling information: - -```ts -// The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example) -const publishAppRole = new iam.Role(this, 'PublishAppRole', { - assumedBy: new iam.AccountRootPrincipal(), -}); - -const profilingGroup = new codeguruprofiler.ProfilingGroup(this, 'MyProfilingGroup'); -profilingGroup.grantPublish(publishAppRole); -``` - -## Compute Platform configuration - -Code Guru Profiler supports multiple compute environments. -They can be configured when creating a Profiling Group by using the `computePlatform` property: - -```ts -const profilingGroup = new codeguruprofiler.ProfilingGroup(this, 'MyProfilingGroup', { - computePlatform: codeguruprofiler.ComputePlatform.AWS_LAMBDA, -}); -``` diff --git a/packages/@aws-cdk/aws-codeguruprofiler/jest.config.js b/packages/@aws-cdk/aws-codeguruprofiler/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codeguruprofiler/package.json b/packages/@aws-cdk/aws-codeguruprofiler/package.json deleted file mode 100644 index 949fcc3b90e43..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/package.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "name": "@aws-cdk/aws-codeguruprofiler", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeGuruProfiler", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeGuruProfiler", - "packageId": "Amazon.CDK.AWS.CodeGuruProfiler", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.codeguruprofiler", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codeguruprofiler" - } - }, - "python": { - "distName": "aws-cdk.aws-codeguruprofiler", - "module": "aws_cdk.aws_codeguruprofiler", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codeguruprofiler" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeGuruProfiler", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CodeGuruProfiler", - "aws-codeguruprofiler" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-codeguruprofiler/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codeguruprofiler/rosetta/default.ts-fixture deleted file mode 100644 index c809dffd674cb..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as codeguruprofiler from '@aws-cdk/aws-codeguruprofiler'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.ts b/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.ts deleted file mode 100644 index de30b58065001..0000000000000 --- a/packages/@aws-cdk/aws-codeguruprofiler/test/integ.profiler-group.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { ProfilingGroup } from '../lib'; - -class ProfilerGroupIntegrationTest extends Stack { - constructor(scope: App, id: string, props?: StackProps) { - super(scope, id, props); - - const profilingGroup = new ProfilingGroup(this, 'MyProfilingGroup'); - - const publishAppRole = new Role(this, 'PublishAppRole', { - assumedBy: new AccountRootPrincipal(), - }); - profilingGroup.grantPublish(publishAppRole); - - const readAppRole = new Role(this, 'ReadAppRole', { - assumedBy: new AccountRootPrincipal(), - }); - profilingGroup.grantRead(readAppRole); - - } -} - -const app = new App(); - -new IntegTest(app, 'cdk-code-guru-profiler-group', { - testCases: [new ProfilerGroupIntegrationTest(app, 'ProfilerGroupIntegrationTest')], -}); diff --git a/packages/@aws-cdk/aws-codegurureviewer/.eslintrc.js b/packages/@aws-cdk/aws-codegurureviewer/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codegurureviewer/.gitignore b/packages/@aws-cdk/aws-codegurureviewer/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codegurureviewer/.npmignore b/packages/@aws-cdk/aws-codegurureviewer/.npmignore deleted file mode 100644 index a79536cbbe7e1..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codegurureviewer/LICENSE b/packages/@aws-cdk/aws-codegurureviewer/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codegurureviewer/NOTICE b/packages/@aws-cdk/aws-codegurureviewer/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codegurureviewer/README.md b/packages/@aws-cdk/aws-codegurureviewer/README.md deleted file mode 100644 index 840b65a75b835..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::CodeGuruReviewer Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as codegurureviewer from '@aws-cdk/aws-codegurureviewer'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for CodeGuruReviewer construct libraries](https://constructs.dev/search?q=codegurureviewer) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeGuruReviewer resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeGuruReviewer.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeGuruReviewer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeGuruReviewer.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-codegurureviewer/jest.config.js b/packages/@aws-cdk/aws-codegurureviewer/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codegurureviewer/lib/index.ts b/packages/@aws-cdk/aws-codegurureviewer/lib/index.ts deleted file mode 100644 index 6b307ac407c24..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::CodeGuruReviewer CloudFormation Resources: -export * from './codegurureviewer.generated'; diff --git a/packages/@aws-cdk/aws-codegurureviewer/package.json b/packages/@aws-cdk/aws-codegurureviewer/package.json deleted file mode 100644 index 8aea3e25c524b..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-codegurureviewer", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeGuruReviewer", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeGuruReviewer", - "packageId": "Amazon.CDK.AWS.CodeGuruReviewer", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.codegurureviewer", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codegurureviewer" - } - }, - "python": { - "distName": "aws-cdk.aws-codegurureviewer", - "module": "aws_cdk.aws_codegurureviewer", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codegurureviewer" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeGuruReviewer", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CodeGuruReviewer", - "aws-codegurureviewer" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codegurureviewer/test/codegurureviewer.test.ts b/packages/@aws-cdk/aws-codegurureviewer/test/codegurureviewer.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-codegurureviewer/test/codegurureviewer.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/.eslintrc.js b/packages/@aws-cdk/aws-codepipeline-actions/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/.gitignore b/packages/@aws-cdk/aws-codepipeline-actions/.gitignore deleted file mode 100644 index 0f9112062f226..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -*.tgz -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codepipeline-actions/.npmignore b/packages/@aws-cdk/aws-codepipeline-actions/.npmignore deleted file mode 100644 index 3c1ceb7605a65..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -jest.config.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codepipeline-actions/LICENSE b/packages/@aws-cdk/aws-codepipeline-actions/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codepipeline-actions/NOTICE b/packages/@aws-cdk/aws-codepipeline-actions/NOTICE deleted file mode 100644 index 822895dc2b759..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** case - https://www.npmjs.com/package/case -Copyright (c) 2013 Nathan Bubna - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - ----------------- \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/README.md b/packages/@aws-cdk/aws-codepipeline-actions/README.md deleted file mode 100644 index fb78e3f024482..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/README.md +++ /dev/null @@ -1,1233 +0,0 @@ -# AWS CodePipeline Actions - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This package contains Actions that can be used in a CodePipeline. - -```ts nofixture -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -``` - -## Sources - -### AWS CodeCommit - -To use a CodeCommit Repository in a CodePipeline: - -```ts -const repo = new codecommit.Repository(this, 'Repo', { - repositoryName: 'MyRepo', -}); - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', { - pipelineName: 'MyPipeline', -}); -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'CodeCommit', - repository: repo, - output: sourceOutput, -}); -pipeline.addStage({ - stageName: 'Source', - actions: [sourceAction], -}); -``` - -If you want to use existing role which can be used by on commit event rule. -You can specify the role object in eventRole property. - -```ts -const eventRole = iam.Role.fromRoleArn(this, 'Event-role', 'roleArn'); -declare const repo: codecommit.Repository; -const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'CodeCommit', - repository: repo, - output: new codepipeline.Artifact(), - eventRole, -}); -``` - -If you want to clone the entire CodeCommit repository (only available for CodeBuild actions), -you can set the `codeBuildCloneOutput` property to `true`: - -```ts -declare const project: codebuild.PipelineProject; -declare const repo: codecommit.Repository; -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'CodeCommit', - repository: repo, - output: sourceOutput, - codeBuildCloneOutput: true, -}); - -const buildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, // The build action must use the CodeCommitSourceAction output as input. - outputs: [new codepipeline.Artifact()], // optional -}); -``` - -The CodeCommit source action emits variables: - -```ts -declare const project: codebuild.PipelineProject; -declare const repo: codecommit.Repository; -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'CodeCommit', - repository: repo, - output: sourceOutput, - variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you -}); - -// later: - -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - COMMIT_ID: { - value: sourceAction.variables.commitId, - }, - }, -}); -``` - -### GitHub - -If you want to use a GitHub repository as the source, you must create: - -* A [GitHub Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line), - with scopes **repo** and **admin:repo_hook**. -* A [Secrets Manager Secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html) - with the value of the **GitHub Access Token**. Pick whatever name you want (for example `my-github-token`). - This token can be stored either as Plaintext or as a Secret key/value. - If you stored the token as Plaintext, - set `SecretValue.secretsManager('my-github-token')` as the value of `oauthToken`. - If you stored it as a Secret key/value, - you must set `SecretValue.secretsManager('my-github-token', { jsonField : 'my-github-token' })` as the value of `oauthToken`. - -To use GitHub as the source of a CodePipeline: - -```ts -// Read the secret from Secrets Manager -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.GitHubSourceAction({ - actionName: 'GitHub_Source', - owner: 'awslabs', - repo: 'aws-cdk', - oauthToken: SecretValue.secretsManager('my-github-token'), - output: sourceOutput, - branch: 'develop', // default: 'master' -}); -pipeline.addStage({ - stageName: 'Source', - actions: [sourceAction], -}); -``` - -The GitHub source action emits variables: - -```ts -declare const sourceOutput: codepipeline.Artifact; -declare const project: codebuild.PipelineProject; - -const sourceAction = new codepipeline_actions.GitHubSourceAction({ - actionName: 'Github_Source', - output: sourceOutput, - owner: 'my-owner', - repo: 'my-repo', - oauthToken: SecretValue.secretsManager('my-github-token'), - variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you -}); - -// later: - -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - COMMIT_URL: { - value: sourceAction.variables.commitUrl, - }, - }, -}); -``` - -### BitBucket - -CodePipeline can use a BitBucket Git repository as a source: - -**Note**: you have to manually connect CodePipeline through the AWS Console with your BitBucket account. -This is a one-time operation for a given AWS account in a given region. -The simplest way to do that is to either start creating a new CodePipeline, -or edit an existing one, while being logged in to BitBucket. -Choose BitBucket as the source, -and grant CodePipeline permissions to your BitBucket account. -Copy & paste the Connection ARN that you get in the console, -or use the [`codestar-connections list-connections` AWS CLI operation](https://docs.aws.amazon.com/cli/latest/reference/codestar-connections/list-connections.html) -to find it. -After that, you can safely abort creating or editing the pipeline - -the connection has already been created. - -```ts -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({ - actionName: 'BitBucket_Source', - owner: 'aws', - repo: 'aws-cdk', - output: sourceOutput, - connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh', -}); -``` - -You can also use the `CodeStarConnectionsSourceAction` to connect to GitHub, in the same way -(you just have to select GitHub as the source when creating the connection in the console). - -Similarly to `GitHubSourceAction`, `CodeStarConnectionsSourceAction` also emits the variables: - -```ts -declare const project: codebuild.Project; - -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({ - actionName: 'BitBucket_Source', - owner: 'aws', - repo: 'aws-cdk', - output: sourceOutput, - connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh', - variablesNamespace: 'SomeSpace', // optional - by default, a name will be generated for you -}); - -// later: - -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - COMMIT_ID: { - value: sourceAction.variables.commitId, - }, - }, -}); -``` - -### AWS S3 Source - -To use an S3 Bucket as a source in CodePipeline: - -```ts -const sourceBucket = new s3.Bucket(this, 'MyBucket', { - versioned: true, // a Bucket used as a source in CodePipeline must be versioned -}); - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.S3SourceAction({ - actionName: 'S3Source', - bucket: sourceBucket, - bucketKey: 'path/to/file.zip', - output: sourceOutput, -}); -pipeline.addStage({ - stageName: 'Source', - actions: [sourceAction], -}); -``` - -The region of the action will be determined by the region the bucket itself is in. -When using a newly created bucket, -that region will be taken from the stack the bucket belongs to; -for an imported bucket, -you can specify the region explicitly: - -```ts -const sourceBucket = s3.Bucket.fromBucketAttributes(this, 'SourceBucket', { - bucketName: 'my-bucket', - region: 'ap-southeast-1', -}); -``` - -By default, the Pipeline will poll the Bucket to detect changes. -You can change that behavior to use CloudWatch Events by setting the `trigger` -property to `S3Trigger.EVENTS` (it's `S3Trigger.POLL` by default). -If you do that, make sure the source Bucket is part of an AWS CloudTrail Trail - -otherwise, the CloudWatch Events will not be emitted, -and your Pipeline will not react to changes in the Bucket. -You can do it through the CDK: - -```ts -import * as cloudtrail from '@aws-cdk/aws-cloudtrail'; - -declare const sourceBucket: s3.Bucket; -const sourceOutput = new codepipeline.Artifact(); -const key = 'some/key.zip'; -const trail = new cloudtrail.Trail(this, 'CloudTrail'); -trail.addS3EventSelector([{ - bucket: sourceBucket, - objectPrefix: key, -}], { - readWriteType: cloudtrail.ReadWriteType.WRITE_ONLY, -}); -const sourceAction = new codepipeline_actions.S3SourceAction({ - actionName: 'S3Source', - bucketKey: key, - bucket: sourceBucket, - output: sourceOutput, - trigger: codepipeline_actions.S3Trigger.EVENTS, // default: S3Trigger.POLL -}); -``` - -The S3 source action emits variables: - -```ts -const key = 'some/key.zip'; -declare const sourceBucket: s3.Bucket; -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.S3SourceAction({ - actionName: 'S3Source', - bucketKey: key, - bucket: sourceBucket, - output: sourceOutput, - variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you -}); - -// later: -declare const project: codebuild.PipelineProject; -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - VERSION_ID: { - value: sourceAction.variables.versionId, - }, - }, -}); -``` - -### AWS ECR - -To use an ECR Repository as a source in a Pipeline: - -```ts -import * as ecr from '@aws-cdk/aws-ecr'; - -declare const ecrRepository: ecr.Repository; -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.EcrSourceAction({ - actionName: 'ECR', - repository: ecrRepository, - imageTag: 'some-tag', // optional, default: 'latest' - output: sourceOutput, -}); -pipeline.addStage({ - stageName: 'Source', - actions: [sourceAction], -}); -``` - -The ECR source action emits variables: - -```ts -import * as ecr from '@aws-cdk/aws-ecr'; - -const sourceOutput = new codepipeline.Artifact(); -declare const ecrRepository: ecr.Repository; -const sourceAction = new codepipeline_actions.EcrSourceAction({ - actionName: 'Source', - output: sourceOutput, - repository: ecrRepository, - variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you -}); - -// later: -declare const project: codebuild.PipelineProject; -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - IMAGE_URI: { - value: sourceAction.variables.imageUri, - }, - }, -}); -``` - -## Build & test - -### AWS CodeBuild - -Example of a CodeBuild Project used in a Pipeline, alongside CodeCommit: - -```ts -declare const project: codebuild.PipelineProject; -const repository = new codecommit.Repository(this, 'MyRepository', { - repositoryName: 'MyRepository', -}); -const project = new codebuild.PipelineProject(this, 'MyProject'); - -const sourceOutput = new codepipeline.Artifact(); -const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'CodeCommit', - repository, - output: sourceOutput, -}); -const buildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - outputs: [new codepipeline.Artifact()], // optional - executeBatchBuild: true, // optional, defaults to false - combineBatchBuildArtifacts: true, // optional, defaults to false -}); - -new codepipeline.Pipeline(this, 'MyPipeline', { - stages: [ - { - stageName: 'Source', - actions: [sourceAction], - }, - { - stageName: 'Build', - actions: [buildAction], - }, - ], -}); -``` - -The default category of the CodeBuild Action is `Build`; -if you want a `Test` Action instead, -override the `type` property: - -```ts -declare const project: codebuild.PipelineProject; -const sourceOutput = new codepipeline.Artifact(); -const testAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'IntegrationTest', - project, - input: sourceOutput, - type: codepipeline_actions.CodeBuildActionType.TEST, // default is BUILD -}); -``` - -#### Multiple inputs and outputs - -When you want to have multiple inputs and/or outputs for a Project used in a -Pipeline, instead of using the `secondarySources` and `secondaryArtifacts` -properties of the `Project` class, you need to use the `extraInputs` and -`outputs` properties of the CodeBuild CodePipeline -Actions. Example: - -```ts -declare const repository1: codecommit.Repository; -const sourceOutput1 = new codepipeline.Artifact(); -const sourceAction1 = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'Source1', - repository: repository1, - output: sourceOutput1, -}); -declare const repository2: codecommit.Repository; -const sourceOutput2 = new codepipeline.Artifact('source2'); -const sourceAction2 = new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'Source2', - repository: repository2, - output: sourceOutput2, -}); - -declare const project: codebuild.PipelineProject; -const buildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'Build', - project, - input: sourceOutput1, - extraInputs: [ - sourceOutput2, // this is where 'source2' comes from - ], - outputs: [ - new codepipeline.Artifact('artifact1'), // for better buildspec readability - see below - new codepipeline.Artifact('artifact2'), - ], -}); -``` - -**Note**: when a CodeBuild Action in a Pipeline has more than one output, it -only uses the `secondary-artifacts` field of the buildspec, never the -primary output specification directly under `artifacts`. Because of that, it -pays to explicitly name all output artifacts of that Action, like we did -above, so that you know what name to use in the buildspec. - -Example buildspec for the above project: - -```ts -const project = new codebuild.PipelineProject(this, 'MyProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - // By default, you're in a directory with the contents of the repository from sourceAction1. - // Use the CODEBUILD_SRC_DIR_source2 environment variable - // to get a path to the directory with the contents of the second input repository. - ], - }, - }, - artifacts: { - 'secondary-artifacts': { - 'artifact1': { - // primary Action output artifact, - // available as buildAction.outputArtifact - }, - 'artifact2': { - // additional output artifact, - // available as buildAction.additionalOutputArtifact('artifact2') - }, - }, - }, - }), - // ... -}); -``` - -#### Variables - -The CodeBuild action emits variables. -Unlike many other actions, the variables are not static, -but dynamic, defined in the buildspec, -in the 'exported-variables' subsection of the 'env' section. -Example: - -```ts -const sourceOutput = new codepipeline.Artifact(); -const buildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'Build1', - input: sourceOutput, - project: new codebuild.PipelineProject(this, 'Project', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - env: { - 'exported-variables': [ - 'MY_VAR', - ], - }, - phases: { - build: { - commands: 'export MY_VAR="some value"', - }, - }, - }), - }), - variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you -}); - -// later: -declare const project: codebuild.PipelineProject; -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - MyVar: { - value: buildAction.variable('MY_VAR'), - }, - }, -}); -``` - -### Jenkins - -In order to use Jenkins Actions in the Pipeline, -you first need to create a `JenkinsProvider`: - -```ts -const jenkinsProvider = new codepipeline_actions.JenkinsProvider(this, 'JenkinsProvider', { - providerName: 'MyJenkinsProvider', - serverUrl: 'http://my-jenkins.com:8080', - version: '2', // optional, default: '1' -}); -``` - -If you've registered a Jenkins provider in a different CDK app, -or outside the CDK (in the CodePipeline AWS Console, for example), -you can import it: - -```ts -const jenkinsProvider = codepipeline_actions.JenkinsProvider.fromJenkinsProviderAttributes(this, 'JenkinsProvider', { - providerName: 'MyJenkinsProvider', - serverUrl: 'http://my-jenkins.com:8080', - version: '2', // optional, default: '1' -}); -``` - -Note that a Jenkins provider -(identified by the provider name-category(build/test)-version tuple) -must always be registered in the given account, in the given AWS region, -before it can be used in CodePipeline. - -With a `JenkinsProvider`, -we can create a Jenkins Action: - -```ts -declare const jenkinsProvider: codepipeline_actions.JenkinsProvider; -const buildAction = new codepipeline_actions.JenkinsAction({ - actionName: 'JenkinsBuild', - jenkinsProvider: jenkinsProvider, - projectName: 'MyProject', - type: codepipeline_actions.JenkinsActionType.BUILD, -}); -``` - -## Deploy - -### AWS CloudFormation - -This module contains Actions that allows you to deploy to CloudFormation from AWS CodePipeline. - -For example, the following code fragment defines a pipeline that automatically deploys a CloudFormation template -directly from a CodeCommit repository, with a manual approval step in between to confirm the changes: - -[example Pipeline to deploy CloudFormation](test/integ.cfn-template-from-repo.lit.ts) - -See [the AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline.html) -for more details about using CloudFormation in CodePipeline. - -#### Actions for updating individual CloudFormation Stacks - -This package contains the following CloudFormation actions: - -* **CloudFormationCreateUpdateStackAction** - Deploy a CloudFormation template directly from the pipeline. The indicated stack is created, - or updated if it already exists. If the stack is in a failure state, deployment will fail (unless `replaceOnFailure` - is set to `true`, in which case it will be destroyed and recreated). -* **CloudFormationDeleteStackAction** - Delete the stack with the given name. -* **CloudFormationCreateReplaceChangeSetAction** - Prepare a change set to be applied later. You will typically use change sets if you want - to manually verify the changes that are being staged, or if you want to separate the people (or system) preparing the - changes from the people (or system) applying the changes. -* **CloudFormationExecuteChangeSetAction** - Execute a change set prepared previously. - -#### Actions for deploying CloudFormation StackSets to multiple accounts - -You can use CloudFormation StackSets to deploy the same CloudFormation template to multiple -accounts in a managed way. If you use AWS Organizations, StackSets can be deployed to -all accounts in a particular Organizational Unit (OU), and even automatically to new -accounts as soon as they are added to a particular OU. For more information, see -the [Working with StackSets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/what-is-cfnstacksets.html) -section of the CloudFormation developer guide. - -The actions available for updating StackSets are: - -* **CloudFormationDeployStackSetAction** - Create or update a CloudFormation StackSet directly from the pipeline, optionally - immediately create and update Stack Instances as well. -* **CloudFormationDeployStackInstancesAction** - Update outdated Stack Instances using the current version of the StackSet. - -Here's an example of using both of these actions: - -```ts -declare const pipeline: codepipeline.Pipeline; -declare const sourceOutput: codepipeline.Artifact; - -pipeline.addStage({ - stageName: 'DeployStackSets', - actions: [ - // First, update the StackSet itself with the newest template - new codepipeline_actions.CloudFormationDeployStackSetAction({ - actionName: 'UpdateStackSet', - runOrder: 1, - stackSetName: 'MyStackSet', - template: codepipeline_actions.StackSetTemplate.fromArtifactPath(sourceOutput.atPath('template.yaml')), - - // Change this to 'StackSetDeploymentModel.organizations()' if you want to deploy to OUs - deploymentModel: codepipeline_actions.StackSetDeploymentModel.selfManaged(), - // This deploys to a set of accounts - stackInstances: codepipeline_actions.StackInstances.inAccounts(['111111111111'], ['us-east-1', 'eu-west-1']), - }), - - // Afterwards, update/create additional instances in other accounts - new codepipeline_actions.CloudFormationDeployStackInstancesAction({ - actionName: 'AddMoreInstances', - runOrder: 2, - stackSetName: 'MyStackSet', - stackInstances: codepipeline_actions.StackInstances.inAccounts( - ['222222222222', '333333333333'], - ['us-east-1', 'eu-west-1'] - ), - }), - ], -}); -``` - -#### Lambda deployed through CodePipeline - -If you want to deploy your Lambda through CodePipeline, -and you don't use assets (for example, because your CDK code and Lambda code are separate), -you can use a special Lambda `Code` class, `CfnParametersCode`. -Note that your Lambda must be in a different Stack than your Pipeline. -The Lambda itself will be deployed, alongside the entire Stack it belongs to, -using a CloudFormation CodePipeline Action. Example: - -[Example of deploying a Lambda through CodePipeline](test/integ.lambda-deployed-through-codepipeline.lit.ts) - -#### Cross-account actions - -If you want to update stacks in a different account, -pass the `account` property when creating the action: - -```ts -const sourceOutput = new codepipeline.Artifact(); -new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - actionName: 'CloudFormationCreateUpdate', - stackName: 'MyStackName', - adminPermissions: true, - templatePath: sourceOutput.atPath('template.yaml'), - account: '123456789012', -}); -``` - -This will create a new stack, called `-support-123456789012`, in your `App`, -that will contain the role that the pipeline will assume in account 123456789012 before executing this action. -This support stack will automatically be deployed before the stack containing the pipeline. - -You can also pass a role explicitly when creating the action - -in that case, the `account` property is ignored, -and the action will operate in the same account the role belongs to: - -```ts -import { PhysicalName } from '@aws-cdk/core'; - -// in stack for account 123456789012... -declare const otherAccountStack: Stack; -const actionRole = new iam.Role(otherAccountStack, 'ActionRole', { - assumedBy: new iam.AccountPrincipal('123456789012'), - // the role has to have a physical name set - roleName: PhysicalName.GENERATE_IF_NEEDED, -}); - -// in the pipeline stack... -const sourceOutput = new codepipeline.Artifact(); -new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - actionName: 'CloudFormationCreateUpdate', - stackName: 'MyStackName', - adminPermissions: true, - templatePath: sourceOutput.atPath('template.yaml'), - role: actionRole, // this action will be cross-account as well -}); -``` - -### AWS CodeDeploy - -#### Server deployments - -To use CodeDeploy for EC2/on-premise deployments in a Pipeline: - -```ts -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', { - pipelineName: 'MyPipeline', -}); - -// add the source and build Stages to the Pipeline... -const buildOutput = new codepipeline.Artifact(); -declare const deploymentGroup: codedeploy.ServerDeploymentGroup; -const deployAction = new codepipeline_actions.CodeDeployServerDeployAction({ - actionName: 'CodeDeploy', - input: buildOutput, - deploymentGroup, -}); -pipeline.addStage({ - stageName: 'Deploy', - actions: [deployAction], -}); -``` - -##### Lambda deployments - -To use CodeDeploy for blue-green Lambda deployments in a Pipeline: - -```ts -const lambdaCode = lambda.Code.fromCfnParameters(); -const func = new lambda.Function(this, 'Lambda', { - code: lambdaCode, - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); -// used to make sure each CDK synthesis produces a different Version -const version = func.currentVersion; -const alias = new lambda.Alias(this, 'LambdaAlias', { - aliasName: 'Prod', - version, -}); - -new codedeploy.LambdaDeploymentGroup(this, 'DeploymentGroup', { - alias, - deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, -}); -``` - -Then, you need to create your Pipeline Stack, -where you will define your Pipeline, -and deploy the `lambdaStack` using a CloudFormation CodePipeline Action -(see above for a complete example). - -### ECS - -CodePipeline can deploy an ECS service. -The deploy Action receives one input Artifact which contains the [image definition file]: - -```ts -import * as ecs from '@aws-cdk/aws-ecs'; - -declare const service: ecs.FargateService; -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const buildOutput = new codepipeline.Artifact(); -const deployStage = pipeline.addStage({ - stageName: 'Deploy', - actions: [ - new codepipeline_actions.EcsDeployAction({ - actionName: 'DeployAction', - service, - // if your file is called imagedefinitions.json, - // use the `input` property, - // and leave out the `imageFile` property - input: buildOutput, - // if your file name is _not_ imagedefinitions.json, - // use the `imageFile` property, - // and leave out the `input` property - imageFile: buildOutput.atPath('imageDef.json'), - deploymentTimeout: Duration.minutes(60), // optional, default is 60 minutes - }), - ], -}); -``` - -[image definition file]: https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html#pipelines-create-image-definitions - -#### Deploying ECS applications to existing services - -CodePipeline can deploy to an existing ECS service which uses the -[ECS service ARN format that contains the Cluster name](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). -This also works if the service is in a different account and/or region than the pipeline: - -```ts -import * as ecs from '@aws-cdk/aws-ecs'; - -const service = ecs.BaseService.fromServiceArnWithCluster(this, 'EcsService', - 'arn:aws:ecs:us-east-1:123456789012:service/myClusterName/myServiceName' -); -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const buildOutput = new codepipeline.Artifact(); -// add source and build stages to the pipeline as usual... -const deployStage = pipeline.addStage({ - stageName: 'Deploy', - actions: [ - new codepipeline_actions.EcsDeployAction({ - actionName: 'DeployAction', - service: service, - input: buildOutput, - }), - ], -}); -``` - -When deploying across accounts, especially in a CDK Pipelines self-mutating pipeline, -it is recommended to provide the `role` property to the `EcsDeployAction`. -The Role will need to have permissions assigned to it for ECS deployment. -See [the CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam.html#how-to-custom-role) -for the permissions needed. - -#### Deploying ECS applications stored in a separate source code repository - -The idiomatic CDK way of deploying an ECS application is to have your Dockerfiles and your CDK code in the same source code repository, -leveraging [Docker Assets](https://docs.aws.amazon.com/cdk/latest/guide/assets.html#assets_types_docker), -and use the [CDK Pipelines module](https://docs.aws.amazon.com/cdk/api/latest/docs/pipelines-readme.html). - -However, if you want to deploy a Docker application whose source code is kept in a separate version control repository than the CDK code, -you can use the `TagParameterContainerImage` class from the ECS module. -Here's an example: - -[example ECS pipeline for an application in a separate source code repository](test/integ.pipeline-ecs-separate-source.lit.ts) - -### AWS S3 Deployment - -To use an S3 Bucket as a deployment target in CodePipeline: - -```ts -const sourceOutput = new codepipeline.Artifact(); -const targetBucket = new s3.Bucket(this, 'MyBucket'); - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const deployAction = new codepipeline_actions.S3DeployAction({ - actionName: 'S3Deploy', - bucket: targetBucket, - input: sourceOutput, -}); -const deployStage = pipeline.addStage({ - stageName: 'Deploy', - actions: [deployAction], -}); -``` - -#### Invalidating the CloudFront cache when deploying to S3 - -There is currently no native support in CodePipeline for invalidating a CloudFront cache after deployment. -One workaround is to add another build step after the deploy step, -and use the AWS CLI to invalidate the cache: - -```ts -// Create a Cloudfront Web Distribution -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -declare const distribution: cloudfront.Distribution; - -// Create the build project that will invalidate the cache -const invalidateBuildProject = new codebuild.PipelineProject(this, `InvalidateProject`, { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands:[ - 'aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths "/*"', - // Choose whatever files or paths you'd like, or all files as specified here - ], - }, - }, - }), - environmentVariables: { - CLOUDFRONT_ID: { value: distribution.distributionId }, - }, -}); - -// Add Cloudfront invalidation permissions to the project -const distributionArn = `arn:aws:cloudfront::${this.account}:distribution/${distribution.distributionId}`; -invalidateBuildProject.addToRolePolicy(new iam.PolicyStatement({ - resources: [distributionArn], - actions: [ - 'cloudfront:CreateInvalidation', - ], -})); - -// Create the pipeline (here only the S3 deploy and Invalidate cache build) -const deployBucket = new s3.Bucket(this, 'DeployBucket'); -const deployInput = new codepipeline.Artifact(); -new codepipeline.Pipeline(this, 'Pipeline', { - stages: [ - // ... - { - stageName: 'Deploy', - actions: [ - new codepipeline_actions.S3DeployAction({ - actionName: 'S3Deploy', - bucket: deployBucket, - input: deployInput, - runOrder: 1, - }), - new codepipeline_actions.CodeBuildAction({ - actionName: 'InvalidateCache', - project: invalidateBuildProject, - input: deployInput, - runOrder: 2, - }), - ], - }, - ], -}); -``` - -### Elastic Beanstalk Deployment - -To deploy an Elastic Beanstalk Application in CodePipeline: - -```ts -const sourceOutput = new codepipeline.Artifact(); -const targetBucket = new s3.Bucket(this, 'MyBucket'); - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const deployAction = new codepipeline_actions.ElasticBeanstalkDeployAction({ - actionName: 'ElasticBeanstalkDeploy', - input: sourceOutput, - environmentName: 'envName', - applicationName: 'appName', -}); - -const deployStage = pipeline.addStage({ - stageName: 'Deploy', - actions: [deployAction], -}); -``` - -### Alexa Skill - -You can deploy to Alexa using CodePipeline with the following Action: - -```ts -// Read the secrets from ParameterStore -const clientId = SecretValue.secretsManager('AlexaClientId'); -const clientSecret = SecretValue.secretsManager('AlexaClientSecret'); -const refreshToken = SecretValue.secretsManager('AlexaRefreshToken'); - -// Add deploy action -const sourceOutput = new codepipeline.Artifact(); -new codepipeline_actions.AlexaSkillDeployAction({ - actionName: 'DeploySkill', - runOrder: 1, - input: sourceOutput, - clientId: clientId.toString(), - clientSecret: clientSecret, - refreshToken: refreshToken, - skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', -}); -``` - -If you need manifest overrides you can specify them as `parameterOverridesArtifact` in the action: - -```ts -// Deploy some CFN change set and store output -const executeOutput = new codepipeline.Artifact('CloudFormation'); -const executeChangeSetAction = new codepipeline_actions.CloudFormationExecuteChangeSetAction({ - actionName: 'ExecuteChangesTest', - runOrder: 2, - stackName: 'MyStack', - changeSetName: 'MyChangeSet', - outputFileName: 'overrides.json', - output: executeOutput, -}); - -// Provide CFN output as manifest overrides -const clientId = SecretValue.secretsManager('AlexaClientId'); -const clientSecret = SecretValue.secretsManager('AlexaClientSecret'); -const refreshToken = SecretValue.secretsManager('AlexaRefreshToken'); -const sourceOutput = new codepipeline.Artifact(); -new codepipeline_actions.AlexaSkillDeployAction({ - actionName: 'DeploySkill', - runOrder: 1, - input: sourceOutput, - parameterOverridesArtifact: executeOutput, - clientId: clientId.toString(), - clientSecret: clientSecret, - refreshToken: refreshToken, - skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', -}); -``` - -### AWS Service Catalog - -You can deploy a CloudFormation template to an existing Service Catalog product with the following Action: - -```ts -const cdkBuildOutput = new codepipeline.Artifact(); -const serviceCatalogDeployAction = new codepipeline_actions.ServiceCatalogDeployActionBeta1({ - actionName: 'ServiceCatalogDeploy', - templatePath: cdkBuildOutput.atPath("Sample.template.json"), - productVersionName: "Version - " + Date.now.toString, - productVersionDescription: "This is a version from the pipeline with a new description.", - productId: "prod-XXXXXXXX", -}); -``` - -## Approve & invoke - -### Manual approval Action - -This package contains an Action that stops the Pipeline until someone manually clicks the approve button: - -```ts -import * as sns from '@aws-cdk/aws-sns'; - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const approveStage = pipeline.addStage({ stageName: 'Approve' }); -const manualApprovalAction = new codepipeline_actions.ManualApprovalAction({ - actionName: 'Approve', - notificationTopic: new sns.Topic(this, 'Topic'), // optional - notifyEmails: [ - 'some_email@example.com', - ], // optional - additionalInformation: 'additional info', // optional -}); -approveStage.addAction(manualApprovalAction); -// `manualApprovalAction.notificationTopic` can be used to access the Topic -// after the Action has been added to a Pipeline -``` - -If the `notificationTopic` has not been provided, -but `notifyEmails` were, -a new SNS Topic will be created -(and accessible through the `notificationTopic` property of the Action). - -If you want to grant a principal permissions to approve the changes, -you can invoke the method `grantManualApproval` passing it a `IGrantable`: - -```ts -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const approveStage = pipeline.addStage({ stageName: 'Approve' }); -const manualApprovalAction = new codepipeline_actions.ManualApprovalAction({ - actionName: 'Approve', -}); -approveStage.addAction(manualApprovalAction); - -const role = iam.Role.fromRoleArn(this, 'Admin', Arn.format({ service: 'iam', resource: 'role', resourceName: 'Admin' }, this)); -manualApprovalAction.grantManualApproval(role); -``` - -### AWS Lambda - -This module contains an Action that allows you to invoke a Lambda function in a Pipeline: - -```ts -declare const fn: lambda.Function; -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const lambdaAction = new codepipeline_actions.LambdaInvokeAction({ - actionName: 'Lambda', - lambda: fn, -}); -pipeline.addStage({ - stageName: 'Lambda', - actions: [lambdaAction], -}); -``` - -The Lambda Action can have up to 5 inputs, -and up to 5 outputs: - -```ts -declare const fn: lambda.Function; -const sourceOutput = new codepipeline.Artifact(); -const buildOutput = new codepipeline.Artifact(); -const lambdaAction = new codepipeline_actions.LambdaInvokeAction({ - actionName: 'Lambda', - inputs: [ - sourceOutput, - buildOutput, - ], - outputs: [ - new codepipeline.Artifact('Out1'), - new codepipeline.Artifact('Out2'), - ], - lambda: fn, -}); -``` - -The Lambda Action supports custom user parameters that pipeline -will pass to the Lambda function: - -```ts -declare const fn: lambda.Function; - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const lambdaAction = new codepipeline_actions.LambdaInvokeAction({ - actionName: 'Lambda', - lambda: fn, - userParameters: { - foo: 'bar', - baz: 'qux', - }, - // OR - userParametersString: 'my-parameter-string', -}); -``` - -The Lambda invoke action emits variables. -Unlike many other actions, the variables are not static, -but dynamic, defined by the function calling the `PutJobSuccessResult` -API with the `outputVariables` property filled with the map of variables -Example: - -```ts -const lambdaInvokeAction = new codepipeline_actions.LambdaInvokeAction({ - actionName: 'Lambda', - lambda: new lambda.Function(this, 'Func', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline(` - const AWS = require('aws-sdk'); - - exports.handler = async function(event, context) { - const codepipeline = new AWS.CodePipeline(); - await codepipeline.putJobSuccessResult({ - jobId: event['CodePipeline.job'].id, - outputVariables: { - MY_VAR: "some value", - }, - }).promise(); - } - `), - }), - variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you -}); - -// later: -declare const project: codebuild.PipelineProject; -const sourceOutput = new codepipeline.Artifact(); -new codepipeline_actions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - environmentVariables: { - MyVar: { - value: lambdaInvokeAction.variable('MY_VAR'), - }, - }, -}); -``` - -See [the AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html) -on how to write a Lambda function invoked from CodePipeline. - -### AWS Step Functions - -This module contains an Action that allows you to invoke a Step Function in a Pipeline: - -```ts -import * as stepfunctions from '@aws-cdk/aws-stepfunctions'; -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const startState = new stepfunctions.Pass(this, 'StartState'); -const simpleStateMachine = new stepfunctions.StateMachine(this, 'SimpleStateMachine', { - definition: startState, -}); -const stepFunctionAction = new codepipeline_actions.StepFunctionInvokeAction({ - actionName: 'Invoke', - stateMachine: simpleStateMachine, - stateMachineInput: codepipeline_actions.StateMachineInput.literal({ IsHelloWorldExample: true }), -}); -pipeline.addStage({ - stageName: 'StepFunctions', - actions: [stepFunctionAction], -}); -``` - -The `StateMachineInput` can be created with one of 2 static factory methods: -`literal`, which takes an arbitrary map as its only argument, or `filePath`: - -```ts -import * as stepfunctions from '@aws-cdk/aws-stepfunctions'; - -const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); -const inputArtifact = new codepipeline.Artifact(); -const startState = new stepfunctions.Pass(this, 'StartState'); -const simpleStateMachine = new stepfunctions.StateMachine(this, 'SimpleStateMachine', { - definition: startState, -}); -const stepFunctionAction = new codepipeline_actions.StepFunctionInvokeAction({ - actionName: 'Invoke', - stateMachine: simpleStateMachine, - stateMachineInput: codepipeline_actions.StateMachineInput.filePath(inputArtifact.atPath('assets/input.json')), -}); -pipeline.addStage({ - stageName: 'StepFunctions', - actions: [stepFunctionAction], -}); -``` - -See [the AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-StepFunctions.html) -for information on Action structure reference. diff --git a/packages/@aws-cdk/aws-codepipeline-actions/jest.config.js b/packages/@aws-cdk/aws-codepipeline-actions/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/action.ts deleted file mode 100644 index f6e8a58d27329..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/action.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; - -/** - * Low-level class for generic CodePipeline Actions. - * If you're implementing your own IAction, - * prefer to use the Action class from the codepipeline module. - */ -export abstract class Action extends codepipeline.Action { - protected readonly providedActionProperties: codepipeline.ActionProperties; - - protected constructor(actionProperties: codepipeline.ActionProperties) { - super(); - this.providedActionProperties = actionProperties; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/alexa-ask/deploy-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/alexa-ask/deploy-action.ts deleted file mode 100644 index 822a2ad50f523..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/alexa-ask/deploy-action.ts +++ /dev/null @@ -1,84 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { SecretValue } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; - -/** - * Construction properties of the `AlexaSkillDeployAction Alexa deploy Action`. - */ -export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionProps { - /** - * The client id of the developer console token - */ - readonly clientId: string; - - /** - * The client secret of the developer console token - */ - readonly clientSecret: SecretValue; - - /** - * The refresh token of the developer console token - */ - readonly refreshToken: SecretValue; - - /** - * The Alexa skill id - */ - readonly skillId: string; - - /** - * The source artifact containing the voice model and skill manifest - */ - readonly input: codepipeline.Artifact; - - /** - * An optional artifact containing overrides for the skill manifest - */ - readonly parameterOverridesArtifact?: codepipeline.Artifact; -} - -/** - * Deploys the skill to Alexa - */ -export class AlexaSkillDeployAction extends Action { - private readonly props: AlexaSkillDeployActionProps; - - constructor(props: AlexaSkillDeployActionProps) { - super({ - ...props, - category: codepipeline.ActionCategory.DEPLOY, - owner: 'ThirdParty', - provider: 'AlexaSkillsKit', - artifactBounds: { - minInputs: 1, - maxInputs: 2, - minOutputs: 0, - maxOutputs: 0, - }, - inputs: getInputs(props), - }); - - this.props = props; - } - - protected bound(_scope: Construct, _stage: codepipeline.IStage, _options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - return { - configuration: { - ClientId: this.props.clientId, - ClientSecret: this.props.clientSecret.unsafeUnwrap(), // Safe usage - RefreshToken: this.props.refreshToken.unsafeUnwrap(), // Safe usage - SkillId: this.props.skillId, - }, - }; - } -} - -function getInputs(props: AlexaSkillDeployActionProps): codepipeline.Artifact[] { - const ret = [props.input]; - if (props.parameterOverridesArtifact) { - ret.push(props.parameterOverridesArtifact); - } - return ret; -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts deleted file mode 100644 index 3131b07b11c38..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/bitbucket/source-action.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as events from '@aws-cdk/aws-events'; -import { Construct } from 'constructs'; -import { CodeStarConnectionsSourceAction, CodeStarConnectionsSourceActionProps } from '../codestar-connections/source-action'; - -/** - * Construction properties for `BitBucketSourceAction`. - * - * @deprecated use CodeStarConnectionsSourceActionProps instead - */ -export interface BitBucketSourceActionProps extends CodeStarConnectionsSourceActionProps { -} - -/** - * A CodePipeline source action for BitBucket. - * - * @deprecated use CodeStarConnectionsSourceAction instead - */ -export class BitBucketSourceAction implements codepipeline.IAction { - private readonly codeStarConnectionsSourceAction: CodeStarConnectionsSourceAction; - - constructor(props: BitBucketSourceActionProps) { - this.codeStarConnectionsSourceAction = new CodeStarConnectionsSourceAction(props); - } - - public get actionProperties(): codepipeline.ActionProperties { - return this.codeStarConnectionsSourceAction.actionProperties; - } - - public bind(scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): codepipeline.ActionConfig { - return this.codeStarConnectionsSourceAction.bind(scope, stage, options); - } - - public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule { - return this.codeStarConnectionsSourceAction.onStateChange(name, target, options); - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts deleted file mode 100644 index 2566ff985b734..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/codecommit/source-action.ts +++ /dev/null @@ -1,231 +0,0 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as iam from '@aws-cdk/aws-iam'; -import { Names, Stack, Token, TokenComparison } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { sourceArtifactBounds } from '../common'; - -/** - * How should the CodeCommit Action detect changes. - * This is the type of the `CodeCommitSourceAction.trigger` property. - */ -export enum CodeCommitTrigger { - /** - * The Action will never detect changes - - * the Pipeline it's part of will only begin a run when explicitly started. - */ - NONE = 'None', - - /** - * CodePipeline will poll the repository to detect changes. - */ - POLL = 'Poll', - - /** - * CodePipeline will use CloudWatch Events to be notified of changes. - * This is the default method of detecting changes. - */ - EVENTS = 'Events', -} - -/** - * The CodePipeline variables emitted by the CodeCommit source Action. - */ -export interface CodeCommitSourceVariables { - /** The name of the repository this action points to. */ - readonly repositoryName: string; - - /** The name of the branch this action tracks. */ - readonly branchName: string; - - /** The date the currently last commit on the tracked branch was authored, in ISO-8601 format. */ - readonly authorDate: string; - - /** The date the currently last commit on the tracked branch was committed, in ISO-8601 format. */ - readonly committerDate: string; - - /** The SHA1 hash of the currently last commit on the tracked branch. */ - readonly commitId: string; - - /** The message of the currently last commit on the tracked branch. */ - readonly commitMessage: string; -} - -/** - * Construction properties of the `CodeCommitSourceAction CodeCommit source CodePipeline Action`. - */ -export interface CodeCommitSourceActionProps extends codepipeline.CommonAwsActionProps { - /** - * - */ - readonly output: codepipeline.Artifact; - - /** - * @default 'master' - */ - readonly branch?: string; - - /** - * How should CodePipeline detect source changes for this Action. - * - * @default CodeCommitTrigger.EVENTS - */ - readonly trigger?: CodeCommitTrigger; - - /** - * The CodeCommit repository. - */ - readonly repository: codecommit.IRepository; - - /** - * Role to be used by on commit event rule. - * Used only when trigger value is CodeCommitTrigger.EVENTS. - * - * @default a new role will be created. - */ - readonly eventRole?: iam.IRole; - - /** - * Whether the output should be the contents of the repository - * (which is the default), - * or a link that allows CodeBuild to clone the repository before building. - * - * **Note**: if this option is true, - * then only CodeBuild actions can use the resulting `output`. - * - * @default false - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodeCommit.html - */ - readonly codeBuildCloneOutput?: boolean; -} - -/** - * CodePipeline Source that is provided by an AWS CodeCommit repository. - * - * If the CodeCommit repository is in a different account, you must use - * `CodeCommitTrigger.EVENTS` to trigger the pipeline. - * - * (That is because the Pipeline structure normally only has a `RepositoryName` - * field, and that is not enough for the pipeline to locate the repository's - * source account. However, if the pipeline is triggered via an EventBridge - * event, the event itself has the full repository ARN in there, allowing the - * pipeline to locate the repository). - */ -export class CodeCommitSourceAction extends Action { - /** - * The name of the property that holds the ARN of the CodeCommit Repository - * inside of the CodePipeline Artifact's metadata. - * - * @internal - */ - public static readonly _FULL_CLONE_ARN_PROPERTY = 'CodeCommitCloneRepositoryArn'; - - private readonly branch: string; - private readonly props: CodeCommitSourceActionProps; - - constructor(props: CodeCommitSourceActionProps) { - const branch = props.branch ?? 'master'; - if (!branch) { - throw new Error("'branch' parameter cannot be an empty string"); - } - - if (props.codeBuildCloneOutput === true) { - props.output.setMetadata(CodeCommitSourceAction._FULL_CLONE_ARN_PROPERTY, props.repository.repositoryArn); - } - - super({ - ...props, - resource: props.repository, - category: codepipeline.ActionCategory.SOURCE, - provider: 'CodeCommit', - artifactBounds: sourceArtifactBounds(), - outputs: [props.output], - }); - - this.branch = branch; - this.props = props; - } - - /** The variables emitted by this action. */ - public get variables(): CodeCommitSourceVariables { - return { - repositoryName: this.variableExpression('RepositoryName'), - branchName: this.variableExpression('BranchName'), - authorDate: this.variableExpression('AuthorDate'), - committerDate: this.variableExpression('CommitterDate'), - commitId: this.variableExpression('CommitId'), - commitMessage: this.variableExpression('CommitMessage'), - }; - } - - protected bound(_scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - const createEvent = this.props.trigger === undefined || - this.props.trigger === CodeCommitTrigger.EVENTS; - if (createEvent) { - const eventId = this.generateEventId(stage); - this.props.repository.onCommit(eventId, { - target: new targets.CodePipeline(stage.pipeline, { - eventRole: this.props.eventRole, - }), - branches: [this.branch], - crossStackScope: stage.pipeline as unknown as Construct, - }); - } - - // the Action will write the contents of the Git repository to the Bucket, - // so its Role needs write permissions to the Pipeline Bucket - options.bucket.grantReadWrite(options.role); - // when this action is cross-account, - // the Role needs the s3:PutObjectAcl permission for some not yet fully understood reason - if (Token.compareStrings(this.props.repository.env.account, Stack.of(stage.pipeline).account) === TokenComparison.DIFFERENT) { - options.bucket.grantPutAcl(options.role); - } - - // https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-permissions-reference.html#aa-acp - options.role.addToPrincipalPolicy(new iam.PolicyStatement({ - resources: [this.props.repository.repositoryArn], - actions: [ - 'codecommit:GetBranch', - 'codecommit:GetCommit', - 'codecommit:UploadArchive', - 'codecommit:GetUploadArchiveStatus', - 'codecommit:CancelUploadArchive', - ...(this.props.codeBuildCloneOutput === true ? ['codecommit:GetRepository'] : []), - ], - })); - - return { - configuration: { - RepositoryName: this.props.repository.repositoryName, - BranchName: this.branch, - PollForSourceChanges: this.props.trigger === CodeCommitTrigger.POLL, - OutputArtifactFormat: this.props.codeBuildCloneOutput === true - ? 'CODEBUILD_CLONE_REF' - : undefined, - }, - }; - } - - private generateEventId(stage: codepipeline.IStage): string { - const baseId = Names.nodeUniqueId(stage.pipeline.node); - if (Token.isUnresolved(this.branch)) { - let candidate = ''; - let counter = 0; - do { - candidate = this.eventIdFromPrefix(`${baseId}${counter}`); - counter += 1; - } while (this.props.repository.node.tryFindChild(candidate) !== undefined); - return candidate; - } else { - const branchIdDisambiguator = this.branch === 'master' ? '' : `-${this.branch}-`; - return this.eventIdFromPrefix(`${baseId}${branchIdDisambiguator}`); - } - } - - private eventIdFromPrefix(eventIdPrefix: string) { - return `${eventIdPrefix}EventRule`; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/codestar-connections/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/codestar-connections/source-action.ts deleted file mode 100644 index 0363ae4a30375..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/codestar-connections/source-action.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { sourceArtifactBounds } from '../common'; - -/** - * The CodePipeline variables emitted by CodeStar source Action. - */ -export interface CodeStarSourceVariables { - /** The name of the repository this action points to. */ - readonly fullRepositoryName: string; - /** The name of the branch this action tracks. */ - readonly branchName: string; - /** The date the currently last commit on the tracked branch was authored, in ISO-8601 format. */ - readonly authorDate: string; - /** The SHA1 hash of the currently last commit on the tracked branch. */ - readonly commitId: string; - /** The message of the currently last commit on the tracked branch. */ - readonly commitMessage: string; - /** The connection ARN this source uses. */ - readonly connectionArn: string; -} - -/** - * Construction properties for `CodeStarConnectionsSourceAction`. - */ -export interface CodeStarConnectionsSourceActionProps extends codepipeline.CommonAwsActionProps { - /** - * The output artifact that this action produces. - * Can be used as input for further pipeline actions. - */ - readonly output: codepipeline.Artifact; - - /** - * The ARN of the CodeStar Connection created in the AWS console - * that has permissions to access this GitHub or BitBucket repository. - * - * @example 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh' - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-create.html - */ - readonly connectionArn: string; - - /** - * The owning user or organization of the repository. - * - * @example 'aws' - */ - readonly owner: string; - - /** - * The name of the repository. - * - * @example 'aws-cdk' - */ - readonly repo: string; - - /** - * The branch to build. - * - * @default 'master' - */ - readonly branch?: string; - - // long URL in @see - /** - * Whether the output should be the contents of the repository - * (which is the default), - * or a link that allows CodeBuild to clone the repository before building. - * - * **Note**: if this option is true, - * then only CodeBuild actions can use the resulting `output`. - * - * @default false - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html#action-reference-CodestarConnectionSource-config - */ - readonly codeBuildCloneOutput?: boolean; - - /** - * Controls automatically starting your pipeline when a new commit - * is made on the configured repository and branch. If unspecified, - * the default value is true, and the field does not display by default. - * - * @default true - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html - */ - readonly triggerOnPush?: boolean; -} - -/** - * A CodePipeline source action for the CodeStar Connections source, - * which allows connecting to GitHub and BitBucket. - */ -export class CodeStarConnectionsSourceAction extends Action { - /** - * The name of the property that holds the ARN of the CodeStar Connection - * inside of the CodePipeline Artifact's metadata. - * - * @internal - */ - public static readonly _CONNECTION_ARN_PROPERTY = 'CodeStarConnectionArnProperty'; - - private readonly props: CodeStarConnectionsSourceActionProps; - - constructor(props: CodeStarConnectionsSourceActionProps) { - super({ - ...props, - category: codepipeline.ActionCategory.SOURCE, - owner: 'AWS', // because props also has a (different!) owner property! - provider: 'CodeStarSourceConnection', - artifactBounds: sourceArtifactBounds(), - outputs: [props.output], - }); - - this.props = props; - } - - /** The variables emitted by this action. */ - public get variables(): CodeStarSourceVariables { - return { - fullRepositoryName: this.variableExpression('FullRepositoryName'), - branchName: this.variableExpression('BranchName'), - authorDate: this.variableExpression('AuthorDate'), - commitId: this.variableExpression('CommitId'), - commitMessage: this.variableExpression('CommitMessage'), - connectionArn: this.variableExpression('ConnectionArn'), - }; - } - - protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): codepipeline.ActionConfig { - // https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam.html#how-to-update-role-new-services - options.role.addToPolicy(new iam.PolicyStatement({ - actions: [ - 'codestar-connections:UseConnection', - ], - resources: [ - this.props.connectionArn, - ], - })); - - // the action needs to write the output to the pipeline bucket - options.bucket.grantReadWrite(options.role); - options.bucket.grantPutAcl(options.role); - - // if codeBuildCloneOutput is true, - // save the connectionArn in the Artifact instance - // to be read by the CodeBuildAction later - if (this.props.codeBuildCloneOutput === true) { - this.props.output.setMetadata(CodeStarConnectionsSourceAction._CONNECTION_ARN_PROPERTY, - this.props.connectionArn); - } - - return { - configuration: { - ConnectionArn: this.props.connectionArn, - FullRepositoryId: `${this.props.owner}/${this.props.repo}`, - BranchName: this.props.branch ?? 'master', - OutputArtifactFormat: this.props.codeBuildCloneOutput === true - ? 'CODEBUILD_CLONE_REF' - : undefined, - DetectChanges: this.props.triggerOnPush, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/common.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/common.ts deleted file mode 100644 index c534661e469da..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/common.ts +++ /dev/null @@ -1,38 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { Token } from '@aws-cdk/core'; - -/** - * The ArtifactBounds that make sense for source Actions - - * they don't have any inputs, and have exactly one output. - */ -export function sourceArtifactBounds(): codepipeline.ActionArtifactBounds { - return { - minInputs: 0, - maxInputs: 0, - minOutputs: 1, - maxOutputs: 1, - }; -} - -/** - * The ArtifactBounds that make sense for deploy Actions - - * they have exactly one input, and don't produce any outputs. - */ -export function deployArtifactBounds(): codepipeline.ActionArtifactBounds { - return { - minInputs: 1, - maxInputs: 1, - minOutputs: 0, - maxOutputs: 0, - }; -} - -export function validatePercentage(name: string, value?: number) { - if (value === undefined || Token.isUnresolved(value)) { - return; - } - - if (value < 0 || value > 100 || !Number.isInteger(value)) { - throw new Error(`'${name}': must be a whole number between 0 and 100, got: ${value}`); - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/ecr/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/ecr/source-action.ts deleted file mode 100644 index b792549d486d6..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/ecr/source-action.ts +++ /dev/null @@ -1,122 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { Rule } from '@aws-cdk/aws-events'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as iam from '@aws-cdk/aws-iam'; -import { Names } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { sourceArtifactBounds } from '../common'; - -/** - * The CodePipeline variables emitted by the ECR source Action. - */ -export interface EcrSourceVariables { - /** The identifier of the registry. In ECR, this is usually the ID of the AWS account owning it. */ - readonly registryId: string; - - /** The physical name of the repository that this action tracks. */ - readonly repositoryName: string; - - /** The digest of the current image, in the form ':'. */ - readonly imageDigest: string; - - /** The Docker tag of the current image. */ - readonly imageTag: string; - - /** The full ECR Docker URI of the current image. */ - readonly imageUri: string; -} - -/** - * Construction properties of `EcrSourceAction`. - */ -export interface EcrSourceActionProps extends codepipeline.CommonAwsActionProps { - /** - * The image tag that will be checked for changes. - * - * It is not possible to trigger on changes to more than one tag. - * - * @default 'latest' - */ - readonly imageTag?: string; - - /** - * - */ - readonly output: codepipeline.Artifact; - - /** - * The repository that will be watched for changes. - */ - readonly repository: ecr.IRepository; -} - -/** - * The ECR Repository source CodePipeline Action. - * - * Will trigger the pipeline as soon as the target tag in the repository - * changes, but only if there is a CloudTrail Trail in the account that - * captures the ECR event. - */ -export class EcrSourceAction extends Action { - private readonly props: EcrSourceActionProps; - - constructor(props: EcrSourceActionProps) { - super({ - ...props, - resource: props.repository, - category: codepipeline.ActionCategory.SOURCE, - provider: 'ECR', - artifactBounds: sourceArtifactBounds(), - outputs: [props.output], - }); - - this.props = props; - } - - /** The variables emitted by this action. */ - public get variables(): EcrSourceVariables { - return { - registryId: this.variableExpression('RegistryId'), - repositoryName: this.variableExpression('RepositoryName'), - imageDigest: this.variableExpression('ImageDigest'), - imageTag: this.variableExpression('ImageTag'), - imageUri: this.variableExpression('ImageURI'), - }; - } - - protected bound(scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - options.role.addToPolicy(new iam.PolicyStatement({ - actions: ['ecr:DescribeImages'], - resources: [this.props.repository.repositoryArn], - })); - - new Rule(scope, Names.nodeUniqueId(stage.pipeline.node) + 'SourceEventRule', { - targets: [ - new targets.CodePipeline(stage.pipeline), - ], - eventPattern: { - detailType: ['ECR Image Action'], - source: ['aws.ecr'], - detail: { - 'result': ['SUCCESS'], - 'repository-name': [this.props.repository.repositoryName], - 'image-tag': [this.props.imageTag === '' ? undefined : (this.props.imageTag ?? 'latest')], - 'action-type': ['PUSH'], - }, - }, - }); - - // the Action Role also needs to write to the Pipeline's bucket - options.bucket.grantWrite(options.role); - - return { - configuration: { - RepositoryName: this.props.repository.repositoryName, - ImageTag: this.props.imageTag ? this.props.imageTag : undefined, // `''` is falsy in JS/TS - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/ecs/deploy-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/ecs/deploy-action.ts deleted file mode 100644 index bb55b56b77306..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/ecs/deploy-action.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import { Duration } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { deployArtifactBounds } from '../common'; - -/** - * Construction properties of `EcsDeployAction`. - */ -export interface EcsDeployActionProps extends codepipeline.CommonAwsActionProps { - /** - * The input artifact that contains the JSON image definitions file to use for deployments. - * The JSON file is a list of objects, - * each with 2 keys: `name` is the name of the container in the Task Definition, - * and `imageUri` is the Docker image URI you want to update your service with. - * If you use this property, it's assumed the file is called 'imagedefinitions.json'. - * If your build uses a different file, leave this property empty, - * and use the `imageFile` property instead. - * - * @default - one of this property, or `imageFile`, is required - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html#pipelines-create-image-definitions - */ - readonly input?: codepipeline.Artifact; - - /** - * The name of the JSON image definitions file to use for deployments. - * The JSON file is a list of objects, - * each with 2 keys: `name` is the name of the container in the Task Definition, - * and `imageUri` is the Docker image URI you want to update your service with. - * Use this property if you want to use a different name for this file than the default 'imagedefinitions.json'. - * If you use this property, you don't need to specify the `input` property. - * - * @default - one of this property, or `input`, is required - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html#pipelines-create-image-definitions - */ - readonly imageFile?: codepipeline.ArtifactPath; - - /** - * The ECS Service to deploy. - */ - readonly service: ecs.IBaseService; - - /** - * Timeout for the ECS deployment in minutes. Value must be between 1-60. - * - * @default - 60 minutes - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-ECS.html - */ - readonly deploymentTimeout?: Duration; -} - -/** - * CodePipeline Action to deploy an ECS Service. - */ -export class EcsDeployAction extends Action { - private readonly props: EcsDeployActionProps; - private readonly deploymentTimeout?: number - - constructor(props: EcsDeployActionProps) { - super({ - ...props, - category: codepipeline.ActionCategory.DEPLOY, - provider: 'ECS', - artifactBounds: deployArtifactBounds(), - inputs: [determineInputArtifact(props)], - resource: props.service, - }); - - const deploymentTimeout = props.deploymentTimeout?.toMinutes({ integral: true }); - if (deploymentTimeout !== undefined && (deploymentTimeout < 1 || deploymentTimeout > 60)) { - throw new Error(`Deployment timeout must be between 1 and 60 minutes, got: ${deploymentTimeout}`); - } - - this.props = props; - this.deploymentTimeout = deploymentTimeout; - } - - protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - // permissions based on CodePipeline documentation: - // https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-custom-role.html#how-to-update-role-new-services - options.role.addToPolicy(new iam.PolicyStatement({ - actions: [ - 'ecs:DescribeServices', - 'ecs:DescribeTaskDefinition', - 'ecs:DescribeTasks', - 'ecs:ListTasks', - 'ecs:RegisterTaskDefinition', - 'ecs:UpdateService', - ], - resources: ['*'], - })); - - options.role.addToPolicy(new iam.PolicyStatement({ - actions: ['iam:PassRole'], - resources: ['*'], - conditions: { - StringEqualsIfExists: { - 'iam:PassedToService': [ - 'ec2.amazonaws.com', - 'ecs-tasks.amazonaws.com', - ], - }, - }, - })); - - options.bucket.grantRead(options.role); - - return { - configuration: { - ClusterName: this.props.service.cluster.clusterName, - ServiceName: this.props.service.serviceName, - FileName: this.props.imageFile?.fileName, - DeploymentTimeout: this.deploymentTimeout, - }, - }; - } -} - -function determineInputArtifact(props: EcsDeployActionProps): codepipeline.Artifact { - if (props.imageFile && props.input) { - throw new Error("Exactly one of 'input' or 'imageFile' can be provided in the ECS deploy Action"); - } - if (props.imageFile) { - return props.imageFile.artifact; - } - if (props.input) { - return props.input; - } - throw new Error("Specifying one of 'input' or 'imageFile' is required for the ECS deploy Action"); -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/elastic-beanstalk/deploy-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/elastic-beanstalk/deploy-action.ts deleted file mode 100644 index a36b9b34dc1a7..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/elastic-beanstalk/deploy-action.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { deployArtifactBounds } from '../common'; - -/** - * Construction properties of the `ElasticBeanstalkDeployAction Elastic Beanstalk deploy CodePipeline Action`. - */ -export interface ElasticBeanstalkDeployActionProps extends codepipeline.CommonAwsActionProps { - /** - * The source to use as input for deployment. - */ - readonly input: codepipeline.Artifact; - - /** - * The name of the AWS Elastic Beanstalk application to deploy. - */ - readonly applicationName: string; - - /** - * The name of the AWS Elastic Beanstalk environment to deploy to. - */ - readonly environmentName: string; -} - -/** - * CodePipeline action to deploy an AWS ElasticBeanstalk Application. - */ -export class ElasticBeanstalkDeployAction extends Action { - private readonly applicationName: string; - private readonly environmentName: string; - - constructor(props: ElasticBeanstalkDeployActionProps) { - super({ - ...props, - category: codepipeline.ActionCategory.DEPLOY, - provider: 'ElasticBeanstalk', - artifactBounds: deployArtifactBounds(), - inputs: [props.input], - }); - - this.applicationName = props.applicationName; - this.environmentName = props.environmentName; - } - - protected bound( - _scope: Construct, - _stage: codepipeline.IStage, - options: codepipeline.ActionBindOptions, - ): codepipeline.ActionConfig { - - // Per https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.iam.managed-policies.html - // it doesn't seem we can scope this down further for the codepipeline action. - options.role.addManagedPolicy({ managedPolicyArn: 'arn:aws:iam::aws:policy/AdministratorAccess-AWSElasticBeanstalk' }); - - // the Action's Role needs to read from the Bucket to get artifacts - options.bucket.grantRead(options.role); - - return { - configuration: { - ApplicationName: this.applicationName, - EnvironmentName: this.environmentName, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts deleted file mode 100644 index 962dfba6f4294..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/github/source-action.ts +++ /dev/null @@ -1,160 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { SecretValue } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { sourceArtifactBounds } from '../common'; - -/** - * If and how the GitHub source action should be triggered - */ -export enum GitHubTrigger { - NONE = 'None', - POLL = 'Poll', - WEBHOOK = 'WebHook', -} - -/** - * The CodePipeline variables emitted by GitHub source Action. - */ -export interface GitHubSourceVariables { - /** The name of the repository this action points to. */ - readonly repositoryName: string; - /** The name of the branch this action tracks. */ - readonly branchName: string; - /** The date the currently last commit on the tracked branch was authored, in ISO-8601 format. */ - readonly authorDate: string; - /** The date the currently last commit on the tracked branch was committed, in ISO-8601 format. */ - readonly committerDate: string; - /** The SHA1 hash of the currently last commit on the tracked branch. */ - readonly commitId: string; - /** The message of the currently last commit on the tracked branch. */ - readonly commitMessage: string; - /** The GitHub API URL of the currently last commit on the tracked branch. */ - readonly commitUrl: string; -} - -/** - * Construction properties of the `GitHubSourceAction GitHub source action`. - */ -export interface GitHubSourceActionProps extends codepipeline.CommonActionProps { - /** - * - */ - readonly output: codepipeline.Artifact; - - /** - * The GitHub account/user that owns the repo. - */ - readonly owner: string; - - /** - * The name of the repo, without the username. - */ - readonly repo: string; - - /** - * The branch to use. - * - * @default "master" - */ - readonly branch?: string; - - /** - * A GitHub OAuth token to use for authentication. - * - * It is recommended to use a Secrets Manager `Secret` to obtain the token: - * - * const oauth = cdk.SecretValue.secretsManager('my-github-token'); - * new GitHubSourceAction(this, 'GitHubAction', { oauthToken: oauth, ... }); - * - * If you rotate the value in the Secret, you must also change at least one property - * of the CodePipeline to force CloudFormation to re-read the secret. - * - * The GitHub Personal Access Token should have these scopes: - * - * * **repo** - to read the repository - * * **admin:repo_hook** - if you plan to use webhooks (true by default) - * - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/appendix-github-oauth.html#GitHub-create-personal-token-CLI - */ - readonly oauthToken: SecretValue; - - /** - * How AWS CodePipeline should be triggered - * - * With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action - * With "POLL", CodePipeline periodically checks the source for changes - * With "None", the action is not triggered through changes in the source - * - * To use `WEBHOOK`, your GitHub Personal Access Token should have - * **admin:repo_hook** scope (in addition to the regular **repo** scope). - * - * @default GitHubTrigger.WEBHOOK - */ - readonly trigger?: GitHubTrigger; -} - -/** - * Source that is provided by a GitHub repository. - */ -export class GitHubSourceAction extends Action { - private readonly props: GitHubSourceActionProps; - - constructor(props: GitHubSourceActionProps) { - super({ - ...props, - category: codepipeline.ActionCategory.SOURCE, - owner: 'ThirdParty', - provider: 'GitHub', - artifactBounds: sourceArtifactBounds(), - outputs: [props.output], - }); - - this.props = props; - } - - /** The variables emitted by this action. */ - public get variables(): GitHubSourceVariables { - return { - repositoryName: this.variableExpression('RepositoryName'), - branchName: this.variableExpression('BranchName'), - authorDate: this.variableExpression('AuthorDate'), - committerDate: this.variableExpression('CommitterDate'), - commitId: this.variableExpression('CommitId'), - commitMessage: this.variableExpression('CommitMessage'), - commitUrl: this.variableExpression('CommitUrl'), - }; - } - - protected bound(scope: Construct, stage: codepipeline.IStage, _options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - if (!this.props.trigger || this.props.trigger === GitHubTrigger.WEBHOOK) { - new codepipeline.CfnWebhook(scope, 'WebhookResource', { - authentication: 'GITHUB_HMAC', - authenticationConfiguration: { - secretToken: this.props.oauthToken.unsafeUnwrap(), // Safe usage - }, - filters: [ - { - jsonPath: '$.ref', - matchEquals: 'refs/heads/{Branch}', - }, - ], - targetAction: this.actionProperties.actionName, - targetPipeline: stage.pipeline.pipelineName, - targetPipelineVersion: 1, - registerWithThirdParty: true, - }); - } - - return { - configuration: { - Owner: this.props.owner, - Repo: this.props.repo, - Branch: this.props.branch || 'master', - OAuthToken: this.props.oauthToken.unsafeUnwrap(), - PollForSourceChanges: this.props.trigger === GitHubTrigger.POLL, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts deleted file mode 100644 index bbb911089c9ad..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts +++ /dev/null @@ -1,140 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; - -/** - * Construction properties of the `LambdaInvokeAction Lambda invoke CodePipeline Action`. - */ -export interface LambdaInvokeActionProps extends codepipeline.CommonAwsActionProps { - /** - * The optional input Artifacts of the Action. - * A Lambda Action can have up to 5 inputs. - * The inputs will appear in the event passed to the Lambda, - * under the `'CodePipeline.job'.data.inputArtifacts` path. - * - * @default the Action will not have any inputs - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example - */ - readonly inputs?: codepipeline.Artifact[]; - - /** - * The optional names of the output Artifacts of the Action. - * A Lambda Action can have up to 5 outputs. - * The outputs will appear in the event passed to the Lambda, - * under the `'CodePipeline.job'.data.outputArtifacts` path. - * It is the responsibility of the Lambda to upload ZIP files with the Artifact contents to the provided locations. - * - * @default the Action will not have any outputs - */ - readonly outputs?: codepipeline.Artifact[]; - - /** - * A set of key-value pairs that will be accessible to the invoked Lambda - * inside the event that the Pipeline will call it with. - * - * Only one of `userParameters` or `userParametersString` can be specified. - * - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example - * @default - no user parameters will be passed - */ - readonly userParameters?: { [key: string]: any }; - - /** - * The string representation of the user parameters that will be - * accessible to the invoked Lambda inside the event - * that the Pipeline will call it with. - * - * Only one of `userParametersString` or `userParameters` can be specified. - * - * @default - no user parameters will be passed - */ - readonly userParametersString?: string; - - /** - * The lambda function to invoke. - */ - readonly lambda: lambda.IFunction; -} - -/** - * CodePipeline invoke Action that is provided by an AWS Lambda function. - * - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html - */ -export class LambdaInvokeAction extends Action { - private readonly props: LambdaInvokeActionProps; - - constructor(props: LambdaInvokeActionProps) { - super({ - ...props, - resource: props.lambda, - category: codepipeline.ActionCategory.INVOKE, - provider: 'Lambda', - artifactBounds: { - minInputs: 0, - maxInputs: 5, - minOutputs: 0, - maxOutputs: 5, - }, - }); - - this.props = props; - - if (props.userParameters && props.userParametersString) { - throw new Error('Only one of userParameters or userParametersString can be specified'); - } - } - - /** - * Reference a CodePipeline variable defined by the Lambda function this action points to. - * Variables in Lambda invoke actions are defined by calling the PutJobSuccessResult CodePipeline API call - * with the 'outputVariables' property filled. - * - * @param variableName the name of the variable to reference. - * A variable by this name must be present in the 'outputVariables' section of the PutJobSuccessResult - * request that the Lambda function calls when the action is invoked - * - * @see https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PutJobSuccessResult.html - */ - public variable(variableName: string): string { - return this.variableExpression(variableName); - } - - protected bound(scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - // allow pipeline to list functions - options.role.addToPolicy(new iam.PolicyStatement({ - actions: ['lambda:ListFunctions'], - resources: ['*'], - })); - - // allow pipeline to invoke this lambda functionn - this.props.lambda.grantInvoke(options.role); - - // allow the Role access to the Bucket, if there are any inputs/outputs - if ((this.actionProperties.inputs || []).length > 0) { - options.bucket.grantRead(options.role); - } - if ((this.actionProperties.outputs || []).length > 0) { - options.bucket.grantWrite(options.role); - } - - // allow lambda to put job results for this pipeline - // CodePipeline requires this to be granted to '*' - // (the Pipeline ARN will not be enough) - this.props.lambda.addToRolePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['codepipeline:PutJobSuccessResult', 'codepipeline:PutJobFailureResult'], - })); - - return { - configuration: { - FunctionName: this.props.lambda.functionName, - UserParameters: this.props.userParametersString ?? Stack.of(scope).toJsonString(this.props.userParameters), - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/deploy-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/deploy-action.ts deleted file mode 100644 index c94bb2b19776a..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/deploy-action.ts +++ /dev/null @@ -1,135 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Duration } from '@aws-cdk/core'; -import { kebab as toKebabCase } from 'case'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { deployArtifactBounds } from '../common'; - -// Class copied verbatim from the aws-s3-deployment module. -// Yes, it sucks that we didn't abstract this properly in a common class, -// but having 2 different CacheControl classes that behave differently would be worse I think. -// Something to do when CDK 2.0.0 comes out. -/** - * Used for HTTP cache-control header, which influences downstream caches. - * Use the provided static factory methods to construct instances of this class. - * Used in the `S3DeployActionProps.cacheControl` property. - * - * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 - */ -export class CacheControl { - /** The 'must-revalidate' cache control directive. */ - public static mustRevalidate() { return new CacheControl('must-revalidate'); } - /** The 'no-cache' cache control directive. */ - public static noCache() { return new CacheControl('no-cache'); } - /** The 'no-transform' cache control directive. */ - public static noTransform() { return new CacheControl('no-transform'); } - /** The 'public' cache control directive. */ - public static setPublic() { return new CacheControl('public'); } - /** The 'private' cache control directive. */ - public static setPrivate() { return new CacheControl('private'); } - /** The 'proxy-revalidate' cache control directive. */ - public static proxyRevalidate() { return new CacheControl('proxy-revalidate'); } - /** The 'max-age' cache control directive. */ - public static maxAge(t: Duration) { return new CacheControl(`max-age=${t.toSeconds()}`); } - /** The 's-max-age' cache control directive. */ - public static sMaxAge(t: Duration) { return new CacheControl(`s-maxage=${t.toSeconds()}`); } - /** - * Allows you to create an arbitrary cache control directive, - * in case our support is missing a method for a particular directive. - */ - public static fromString(s: string) { return new CacheControl(s); } - - /** @param value the actual text value of the created directive */ - private constructor(public value: string) {} -} - -/** - * Construction properties of the `S3DeployAction S3 deploy Action`. - */ -export interface S3DeployActionProps extends codepipeline.CommonAwsActionProps { - /** - * Should the deploy action extract the artifact before deploying to Amazon S3. - * - * @default true - */ - readonly extract?: boolean; - - /** - * The key of the target object. This is required if extract is false. - */ - readonly objectKey?: string; - - /** - * The input Artifact to deploy to Amazon S3. - */ - readonly input: codepipeline.Artifact; - - /** - * The Amazon S3 bucket that is the deploy target. - */ - readonly bucket: s3.IBucket; - - /** - * The specified canned ACL to objects deployed to Amazon S3. - * This overwrites any existing ACL that was applied to the object. - * - * @default - the original object ACL - */ - readonly accessControl?: s3.BucketAccessControl; - - /** - * The caching behavior for requests/responses for objects in the bucket. - * The final cache control property will be the result of joining all of the provided array elements with a comma - * (plus a space after the comma). - * - * @default - none, decided by the HTTP client - */ - readonly cacheControl?: CacheControl[]; -} - -/** - * Deploys the sourceArtifact to Amazon S3. - */ -export class S3DeployAction extends Action { - private readonly props: S3DeployActionProps; - - constructor(props: S3DeployActionProps) { - super({ - ...props, - resource: props.bucket, - category: codepipeline.ActionCategory.DEPLOY, - provider: 'S3', - artifactBounds: deployArtifactBounds(), - inputs: [props.input], - }); - - this.props = props; - } - - protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - // pipeline needs permissions to write to the S3 bucket - this.props.bucket.grantWrite(options.role); - - if (this.props.accessControl !== undefined) { - // we need to modify the ACL settings of objects within the Bucket, - // so grant the Action's Role permissions to do that - this.props.bucket.grantPutAcl(options.role); - } - - // the Action Role also needs to read from the Pipeline's bucket - options.bucket.grantRead(options.role); - - const acl = this.props.accessControl; - return { - configuration: { - BucketName: this.props.bucket.bucketName, - Extract: this.props.extract === false ? 'false' : 'true', - ObjectKey: this.props.objectKey, - CannedACL: acl ? toKebabCase(acl.toString()) : undefined, - CacheControl: this.props.cacheControl && this.props.cacheControl.map(ac => ac.value).join(', '), - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts deleted file mode 100644 index b8101c6e148a3..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/s3/source-action.ts +++ /dev/null @@ -1,168 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Names, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; -import { sourceArtifactBounds } from '../common'; - -/** - * How should the S3 Action detect changes. - * This is the type of the `S3SourceAction.trigger` property. - */ -export enum S3Trigger { - /** - * The Action will never detect changes - - * the Pipeline it's part of will only begin a run when explicitly started. - */ - NONE = 'None', - - /** - * CodePipeline will poll S3 to detect changes. - * This is the default method of detecting changes. - */ - POLL = 'Poll', - - /** - * CodePipeline will use CloudWatch Events to be notified of changes. - * Note that the Bucket that the Action uses needs to be part of a CloudTrail Trail - * for the events to be delivered. - */ - EVENTS = 'Events', -} - -/** - * The CodePipeline variables emitted by the S3 source Action. - */ -export interface S3SourceVariables { - /** The identifier of the S3 version of the object that triggered the build. */ - readonly versionId: string; - - /** The e-tag of the S3 version of the object that triggered the build. */ - readonly eTag: string; -} - -/** - * Construction properties of the `S3SourceAction S3 source Action`. - */ -export interface S3SourceActionProps extends codepipeline.CommonAwsActionProps { - /** - * - */ - readonly output: codepipeline.Artifact; - - /** - * The key within the S3 bucket that stores the source code. - * - * @example 'path/to/file.zip' - */ - readonly bucketKey: string; - - /** - * How should CodePipeline detect source changes for this Action. - * Note that if this is S3Trigger.EVENTS, you need to make sure to include the source Bucket in a CloudTrail Trail, - * as otherwise the CloudWatch Events will not be emitted. - * - * @default S3Trigger.POLL - * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/log-s3-data-events.html - */ - readonly trigger?: S3Trigger; - - /** - * The Amazon S3 bucket that stores the source code. - * - * If you import an encrypted bucket in your stack, please specify - * the encryption key at import time by using `Bucket.fromBucketAttributes()` method. - */ - readonly bucket: s3.IBucket; -} - -/** - * Source that is provided by a specific Amazon S3 object. - * - * Will trigger the pipeline as soon as the S3 object changes, but only if there is - * a CloudTrail Trail in the account that captures the S3 event. - */ -export class S3SourceAction extends Action { - private readonly props: S3SourceActionProps; - - constructor(props: S3SourceActionProps) { - super({ - ...props, - resource: props.bucket, - category: codepipeline.ActionCategory.SOURCE, - provider: 'S3', - artifactBounds: sourceArtifactBounds(), - outputs: [props.output], - }); - - if (props.bucketKey.length === 0) { - throw new Error('Property bucketKey cannot be an empty string'); - } - - this.props = props; - } - - /** The variables emitted by this action. */ - public get variables(): S3SourceVariables { - return { - versionId: this.variableExpression('VersionId'), - eTag: this.variableExpression('ETag'), - }; - } - - protected bound(_scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - if (this.props.trigger === S3Trigger.EVENTS) { - const id = this.generateEventId(stage); - this.props.bucket.onCloudTrailWriteObject(id, { - target: new targets.CodePipeline(stage.pipeline), - paths: [this.props.bucketKey], - crossStackScope: stage.pipeline as unknown as Construct, - }); - } - - // we need to read from the source bucket... - this.props.bucket.grantRead(options.role, this.props.bucketKey); - - // ...and write to the Pipeline bucket - options.bucket.grantWrite(options.role); - - return { - configuration: { - S3Bucket: this.props.bucket.bucketName, - S3ObjectKey: this.props.bucketKey, - PollForSourceChanges: this.props.trigger && this.props.trigger === S3Trigger.POLL, - }, - }; - } - - private generateEventId(stage: codepipeline.IStage): string { - let ret: string; - const baseId = Names.nodeUniqueId(stage.pipeline.node) + 'SourceEventRule'; - - if (Token.isUnresolved(this.props.bucketKey)) { - // If bucketKey is a Token, don't include it in the ID. - // Instead, use numbers to differentiate if multiple actions observe the same bucket - let candidate = baseId; - let counter = 0; - while (this.props.bucket.node.tryFindChild(candidate) !== undefined) { - counter += 1; - candidate = baseId + counter; - } - ret = candidate; - } else { - // we can't use Tokens in construct IDs, - // however, if bucketKey is not a Token, - // we want it to differentiate between multiple actions - // observing the same Bucket with different keys - ret = baseId + this.props.bucketKey; - if (this.props.bucket.node.tryFindChild(ret)) { - // this means a duplicate path for the same bucket - error out - throw new Error(`S3 source action with path '${this.props.bucketKey}' is already present in the pipeline for this source bucket`); - } - } - - return ret; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/stepfunctions/invoke-action.ts b/packages/@aws-cdk/aws-codepipeline-actions/lib/stepfunctions/invoke-action.ts deleted file mode 100644 index be2222fe8df5f..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/stepfunctions/invoke-action.ts +++ /dev/null @@ -1,161 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as stepfunction from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Action } from '../action'; - -/** - * Represents the input for the StateMachine. - */ -export class StateMachineInput { - /** - * When the input type is FilePath, input artifact and - * filepath must be specified. - */ - public static filePath(inputFile: codepipeline.ArtifactPath): StateMachineInput { - return new StateMachineInput(inputFile.location, inputFile.artifact, 'FilePath'); - } - - /** - * When the input type is Literal, input value is passed - * directly to the state machine input. - */ - public static literal(object: object): StateMachineInput { - return new StateMachineInput(JSON.stringify(object), undefined, 'Literal'); - } - - /** - * The optional input Artifact of the Action. - * If InputType is set to FilePath, this artifact is required - * and is used to source the input for the state machine execution. - * - * @default - the Action will not have any inputs - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-StepFunctions.html#action-reference-StepFunctions-example - */ - public readonly inputArtifact?: codepipeline.Artifact; - - /** - * Optional StateMachine InputType - * InputType can be Literal or FilePath - * - * @default - Literal - */ - public readonly inputType?: string; - - /** - * When InputType is set to Literal (default), the Input field is used - * directly as the input for the state machine execution. - * Otherwise, the state machine is invoked with an empty JSON object {}. - * - * When InputType is set to FilePath, this field is required. - * An input artifact is also required when InputType is set to FilePath. - * - * @default - none - */ - public readonly input: any; - - private constructor(input: any, inputArtifact: codepipeline.Artifact | undefined, inputType: string) { - this.input = input; - this.inputArtifact = inputArtifact; - this.inputType = inputType; - } -} - -/** - * Construction properties of the `StepFunctionsInvokeAction StepFunction Invoke Action`. - */ -export interface StepFunctionsInvokeActionProps extends codepipeline.CommonAwsActionProps { - /** - * The optional output Artifact of the Action. - * - * @default the Action will not have any outputs - */ - readonly output?: codepipeline.Artifact; - - /** - * The state machine to invoke. - */ - readonly stateMachine: stepfunction.IStateMachine; - - /** - * Represents the input to the StateMachine. - * This includes input artifact, input type and the statemachine input. - * - * @default - none - */ - readonly stateMachineInput?: StateMachineInput; - - /** - * Prefix (optional) - * - * By default, the action execution ID is used as the state machine execution name. - * If a prefix is provided, it is prepended to the action execution ID with a hyphen and - * together used as the state machine execution name. - * - * @default - action execution ID - */ - readonly executionNamePrefix?: string; -} - -/** - * StepFunctionInvokeAction that is provided by an AWS CodePipeline. - */ -export class StepFunctionInvokeAction extends Action { - private readonly props: StepFunctionsInvokeActionProps; - - constructor(props: StepFunctionsInvokeActionProps) { - super({ - ...props, - resource: props.stateMachine, - category: codepipeline.ActionCategory.INVOKE, - provider: 'StepFunctions', - artifactBounds: { - minInputs: 0, - maxInputs: 1, - minOutputs: 0, - maxOutputs: 1, - }, - inputs: (props.stateMachineInput && props.stateMachineInput.inputArtifact) ? [props.stateMachineInput.inputArtifact] : [], - outputs: (props.output) ? [props.output] : [], - }); - this.props = props; - } - - protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): - codepipeline.ActionConfig { - // allow pipeline to invoke this step function - options.role.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['states:StartExecution', 'states:DescribeStateMachine'], - resources: [this.props.stateMachine.stateMachineArn], - })); - - // allow state machine executions to be inspected - options.role.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['states:DescribeExecution'], - resources: [cdk.Stack.of(this.props.stateMachine).formatArn({ - service: 'states', - resource: 'execution', - resourceName: `${cdk.Stack.of(this.props.stateMachine).splitArn(this.props.stateMachine.stateMachineArn, cdk.ArnFormat.COLON_RESOURCE_NAME).resourceName}:${this.props.executionNamePrefix ?? ''}*`, - arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, - })], - })); - - // allow the Role access to the Bucket, if there are any inputs/outputs - if ((this.actionProperties.inputs ?? []).length > 0) { - options.bucket.grantRead(options.role); - } - if ((this.actionProperties.outputs ?? []).length > 0) { - options.bucket.grantWrite(options.role); - } - - return { - configuration: { - StateMachineArn: this.props.stateMachine.stateMachineArn, - Input: this.props.stateMachineInput?.input, - InputType: this.props.stateMachineInput?.inputType, - ExecutionNamePrefix: this.props.executionNamePrefix, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/package.json b/packages/@aws-cdk/aws-codepipeline-actions/package.json deleted file mode 100644 index 8d1eff5f5bf79..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/package.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "name": "@aws-cdk/aws-codepipeline-actions", - "version": "0.0.0", - "private": true, - "description": "Concrete Actions for AWS Code Pipeline", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.codepipeline.actions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codepipeline-actions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodePipeline.Actions", - "packageId": "Amazon.CDK.AWS.CodePipeline.Actions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-codepipeline-actions", - "module": "aws_cdk.aws_codepipeline_actions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codepipeline-actions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "nyc": { - "statements": 70 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "codepipeline", - "pipeline" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-cloudtrail": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-s3-deployment": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/lodash": "^4.14.191", - "jest": "^27.5.1", - "lodash": "^4.17.21" - }, - "dependencies": { - "@aws-cdk/aws-cloudformation": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codedeploy": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticbeanstalk": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0", - "case": "1.6.3", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudformation": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codedeploy": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticbeanstalk": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "bundledDependencies": [ - "case" - ], - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awslint": { - "exclude": [ - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CodeCommitSourceActionProps.output", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.Action.actionProperties", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.Action.onStateChange", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.BaseJenkinsProvider", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.BaseJenkinsProvider.providerName", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.BaseJenkinsProvider.serverUrl", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.BaseJenkinsProvider.version", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CloudFormationCreateReplaceChangeSetAction.deploymentRole", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CloudFormationCreateUpdateStackAction.deploymentRole", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CloudFormationDeleteStackAction.deploymentRole", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CodeDeployServerDeployAction", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.JenkinsProvider.providerName", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.JenkinsProvider.serverUrl", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.ManualApprovalAction.notificationTopic", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.AlexaSkillDeployActionProps.parameterOverridesArtifact", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.CloudFormationCreateReplaceChangeSetActionProps.extraInputs", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.CloudFormationCreateUpdateStackActionProps.extraInputs", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.CloudFormationDeleteStackActionProps.extraInputs", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.CodeBuildActionProps.extraInputs", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CodeCommitSourceActionProps.branch", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.EcrSourceActionProps.output", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.GitHubSourceActionProps.output", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.IJenkinsProvider.providerName", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.IJenkinsProvider.serverUrl", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.IJenkinsProvider.version", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.JenkinsActionProps.inputs", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.JenkinsActionProps.outputs", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.JenkinsActionProps.outputs", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.JenkinsProviderProps", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.LambdaInvokeActionProps.userParameters", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.ManualApprovalActionProps.additionalInformation", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.ManualApprovalActionProps.notificationTopic", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.ManualApprovalActionProps.notifyEmails", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.S3DeployActionProps.objectKey", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.S3SourceActionProps.output", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.GitHubTrigger.NONE", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.GitHubTrigger.POLL", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.GitHubTrigger.WEBHOOK", - "docs-public-apis:@aws-cdk/aws-codepipeline-actions.CodeDeployEcsDeployAction", - "props-default-doc:@aws-cdk/aws-codepipeline-actions.CodeDeployEcsDeployActionProps.containerImageInputs" - ] - }, - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codepipeline-actions/rosetta/default.ts-fixture deleted file mode 100644 index aba6086a1683e..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/rosetta/default.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Arn, Construct, Duration, SecretValue, Stack } from '@aws-cdk/core'; -import codebuild = require('@aws-cdk/aws-codebuild'); -import codedeploy = require('@aws-cdk/aws-codedeploy'); -import codepipeline = require('@aws-cdk/aws-codepipeline'); -import codepipeline_actions = require('@aws-cdk/aws-codepipeline-actions'); -import codecommit = require('@aws-cdk/aws-codecommit'); -import iam = require('@aws-cdk/aws-iam'); -import lambda = require('@aws-cdk/aws-lambda'); -import s3 = require('@aws-cdk/aws-s3'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts deleted file mode 100644 index 3554dc94d4617..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/integ.stacksets.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codedeploy/ecs-deploy-action.test.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/codedeploy/ecs-deploy-action.test.ts deleted file mode 100644 index 50d5ecd9c278c..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/codedeploy/ecs-deploy-action.test.ts +++ /dev/null @@ -1,274 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codedeploy from '@aws-cdk/aws-codedeploy'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../../lib'; - -describe('CodeDeploy ECS Deploy Action', () => { - describe('CodeDeploy ECS Deploy Action', () => { - test('throws an exception if more than 4 container image inputs are provided', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - const artifact = new codepipeline.Artifact('Artifact'); - - const containerImageInputs: cpactions.CodeDeployEcsContainerImageInput[] = []; - for (let i = 0; i < 5; i++) { - containerImageInputs.push({ - input: artifact, - }); - } - - expect(() => { - new cpactions.CodeDeployEcsDeployAction({ - actionName: 'DeployToECS', - deploymentGroup, - taskDefinitionTemplateInput: artifact, - appSpecTemplateInput: artifact, - containerImageInputs, - }); - }).toThrow(/Action cannot have more than 4 container image inputs, got: 5/); - - - }); - - test('throws an exception if both appspec artifact input and file are specified', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - const artifact = new codepipeline.Artifact('Artifact'); - const artifactPath = new codepipeline.ArtifactPath(artifact, 'hello'); - - expect(() => { - new cpactions.CodeDeployEcsDeployAction({ - actionName: 'DeployToECS', - deploymentGroup, - taskDefinitionTemplateInput: artifact, - appSpecTemplateInput: artifact, - appSpecTemplateFile: artifactPath, - }); - }).toThrow(/Exactly one of 'appSpecTemplateInput' or 'appSpecTemplateFile' can be provided in the ECS CodeDeploy Action/); - - - }); - - test('throws an exception if neither appspec artifact input nor file are specified', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.CodeDeployEcsDeployAction({ - actionName: 'DeployToECS', - deploymentGroup, - taskDefinitionTemplateInput: artifact, - }); - }).toThrow(/Specifying one of 'appSpecTemplateInput' or 'appSpecTemplateFile' is required for the ECS CodeDeploy Action/); - - - }); - - test('throws an exception if both task definition artifact input and file are specified', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - const artifact = new codepipeline.Artifact('Artifact'); - const artifactPath = new codepipeline.ArtifactPath(artifact, 'hello'); - - expect(() => { - new cpactions.CodeDeployEcsDeployAction({ - actionName: 'DeployToECS', - deploymentGroup, - taskDefinitionTemplateInput: artifact, - taskDefinitionTemplateFile: artifactPath, - appSpecTemplateInput: artifact, - }); - }).toThrow(/Exactly one of 'taskDefinitionTemplateInput' or 'taskDefinitionTemplateFile' can be provided in the ECS CodeDeploy Action/); - - - }); - - test('throws an exception if neither task definition artifact input nor file are specified', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.CodeDeployEcsDeployAction({ - actionName: 'DeployToECS', - deploymentGroup, - appSpecTemplateInput: artifact, - }); - }).toThrow(/Specifying one of 'taskDefinitionTemplateInput' or 'taskDefinitionTemplateFile' is required for the ECS CodeDeploy Action/); - - - }); - - test('defaults task definition and appspec template paths', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - addCodeDeployECSCodePipeline(stack, { - actionName: 'DeployToECS', - deploymentGroup, - taskDefinitionTemplateInput: new codepipeline.Artifact('TaskDefArtifact'), - appSpecTemplateInput: new codepipeline.Artifact('AppSpecArtifact'), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - {}, - { - Actions: [ - { - Configuration: { - ApplicationName: 'MyApplication', - DeploymentGroupName: 'MyDeploymentGroup', - TaskDefinitionTemplateArtifact: 'TaskDefArtifact', - AppSpecTemplateArtifact: 'AppSpecArtifact', - TaskDefinitionTemplatePath: 'taskdef.json', - AppSpecTemplatePath: 'appspec.yaml', - }, - InputArtifacts: [ - { - Name: 'TaskDefArtifact', - }, - { - Name: 'AppSpecArtifact', - }, - ], - }, - ], - }, - ], - }); - - - }); - - test('defaults task definition placeholder string', () => { - const stack = new cdk.Stack(); - const deploymentGroup = addEcsDeploymentGroup(stack); - const artifact1 = new codepipeline.Artifact(); - const artifact2 = new codepipeline.Artifact(); - addCodeDeployECSCodePipeline(stack, { - actionName: 'DeployToECS', - deploymentGroup, - taskDefinitionTemplateFile: artifact1.atPath('task-definition.json'), - appSpecTemplateFile: artifact2.atPath('appspec-test.yaml'), - containerImageInputs: [ - { - input: artifact1, - }, - { - input: artifact2, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - {}, - { - Actions: [ - { - Configuration: { - ApplicationName: 'MyApplication', - DeploymentGroupName: 'MyDeploymentGroup', - TaskDefinitionTemplateArtifact: 'Artifact_Source_GitHub', - AppSpecTemplateArtifact: 'Artifact_Source_GitHub2', - TaskDefinitionTemplatePath: 'task-definition.json', - AppSpecTemplatePath: 'appspec-test.yaml', - Image1ArtifactName: 'Artifact_Source_GitHub', - Image1ContainerName: 'IMAGE', - Image2ArtifactName: 'Artifact_Source_GitHub2', - Image2ContainerName: 'IMAGE', - }, - InputArtifacts: [ - { - Name: 'Artifact_Source_GitHub', - }, - { - Name: 'Artifact_Source_GitHub2', - }, - ], - }, - ], - }, - ], - }); - - - }); - }); - - test('cross-account cross-region deployment has correct dependency between support stacks', () => { - // GIVEN - const stackEnv: cdk.Environment = { account: '111111111111', region: 'us-east-1' }; - const deployEnv: cdk.Environment = { account: '222222222222', region: 'us-east-2' }; - - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Pipe', { env: stackEnv }); - const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'Group', { - application: codedeploy.EcsApplication.fromEcsApplicationArn(stack, 'Application', - `arn:aws:codedeploy:${deployEnv.region}:${deployEnv.account}:application:MyApplication`), - deploymentGroupName: 'MyGroup', - }); - - // WHEN - addCodeDeployECSCodePipeline(stack, { - actionName: 'DeployECS', - deploymentGroup, - taskDefinitionTemplateInput: new codepipeline.Artifact('Artifact'), - appSpecTemplateInput: new codepipeline.Artifact('Artifact2'), - }); - - // THEN - dependency from region stack to account stack - // (region stack has bucket, account stack has role) - const asm = app.synth(); - - const stacks = Object.fromEntries(asm.stacks.map(s => [s.stackName, s])); - expect(Object.keys(stacks)).toContain('Pipe-support-us-east-2'); - expect(Object.keys(stacks)).toContain('Pipe-support-222222222222'); - - expect(stacks['Pipe-support-us-east-2'].dependencies).toContain(stacks['Pipe-support-222222222222']); - }); -}); - -function addEcsDeploymentGroup(stack: cdk.Stack): codedeploy.IEcsDeploymentGroup { - return codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes( - stack, 'EDG', { - application: codedeploy.EcsApplication.fromEcsApplicationName( - stack, 'EA', 'MyApplication', - ), - deploymentGroupName: 'MyDeploymentGroup', - }); -} - -function addCodeDeployECSCodePipeline(stack: cdk.Stack, props: cpactions.CodeDeployEcsDeployActionProps) { - new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [ - new cpactions.GitHubSourceAction({ - actionName: 'GitHub', - output: props.taskDefinitionTemplateInput || props.taskDefinitionTemplateFile!.artifact, - oauthToken: cdk.SecretValue.unsafePlainText('secret'), - owner: 'awslabs', - repo: 'aws-cdk', - }), - new cpactions.GitHubSourceAction({ - actionName: 'GitHub2', - output: props.appSpecTemplateInput || props.appSpecTemplateFile!.artifact, - oauthToken: cdk.SecretValue.unsafePlainText('secret'), - owner: 'awslabs', - repo: 'aws-cdk-2', - }), - ], - }, - { - stageName: 'Invoke', - actions: [ - new cpactions.CodeDeployEcsDeployAction(props), - ], - }, - ], - }); -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/ecs/ecs-deploy-action.test.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/ecs/ecs-deploy-action.test.ts deleted file mode 100644 index 0841d47946a23..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/ecs/ecs-deploy-action.test.ts +++ /dev/null @@ -1,294 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../../lib'; - -describe('ecs deploy action', () => { - describe('ECS deploy Action', () => { - test('throws an exception if neither inputArtifact nor imageFile were provided', () => { - const service = anyEcsService(); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - }); - }).toThrow(/one of 'input' or 'imageFile' is required/); - - - }); - - test('can be created just by specifying the inputArtifact', () => { - const service = anyEcsService(); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - }); - }).not.toThrow(); - - - }); - - test('can be created just by specifying the imageFile', () => { - const service = anyEcsService(); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - imageFile: artifact.atPath('imageFile.json'), - }); - }).not.toThrow(); - - - }); - - test('throws an exception if both inputArtifact and imageFile were provided', () => { - const service = anyEcsService(); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - imageFile: artifact.atPath('file.json'), - }); - }).toThrow(/one of 'input' or 'imageFile' can be provided/); - - - }); - - test('can be created with deploymentTimeout between 1-60 minutes', () => { - const service = anyEcsService(); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - deploymentTimeout: cdk.Duration.minutes(30), - }); - }).not.toThrow(); - - - }); - - test('throws an exception if deploymentTimeout is out of bounds', () => { - const service = anyEcsService(); - const artifact = new codepipeline.Artifact('Artifact'); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - deploymentTimeout: cdk.Duration.minutes(61), - }); - }).toThrow(/timeout must be between 1 and 60 minutes/); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - deploymentTimeout: cdk.Duration.minutes(0), - }); - }).toThrow(/timeout must be between 1 and 60 minutes/); - - expect(() => { - new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - deploymentTimeout: cdk.Duration.seconds(30), - }); - }).toThrow(/cannot be converted into a whole number/); - - - }); - - test("sets the target service as the action's backing resource", () => { - const service = anyEcsService(); - const artifact = new codepipeline.Artifact('Artifact'); - - const action = new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - input: artifact, - }); - - expect(action.actionProperties.resource).toEqual(service); - - - }); - - test('can be created by existing service', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const service = ecs.FargateService.fromFargateServiceAttributes(stack, 'FargateService', { - serviceName: 'service-name', - cluster: ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { - vpc, - securityGroups: [], - clusterName: 'cluster-name', - }), - }); - const artifact = new codepipeline.Artifact('Artifact'); - const bucket = new s3.Bucket(stack, 'PipelineBucket', { - versioned: true, - removalPolicy: cdk.RemovalPolicy.DESTROY, - }); - const source = new cpactions.S3SourceAction({ - actionName: 'Source', - output: artifact, - bucket, - bucketKey: 'key', - }); - const action = new cpactions.EcsDeployAction({ - actionName: 'ECS', - service, - imageFile: artifact.atPath('imageFile.json'), - }); - new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [source], - }, - { - stageName: 'Deploy', - actions: [action], - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - {}, - { - Actions: [ - { - Name: 'ECS', - ActionTypeId: { - Category: 'Deploy', - Provider: 'ECS', - }, - Configuration: { - ClusterName: 'cluster-name', - ServiceName: 'service-name', - FileName: 'imageFile.json', - }, - }, - ], - }, - ], - }); - - - }); - - test('can be created by existing service with cluster ARN format', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'PipelineStack', { - env: { - region: 'pipeline-region', account: 'pipeline-account', - }, - }); - const clusterName = 'cluster-name'; - const serviceName = 'service-name'; - const region = 'service-region'; - const account = 'service-account'; - const serviceArn = `arn:aws:ecs:${region}:${account}:service/${clusterName}/${serviceName}`; - const service = ecs.BaseService.fromServiceArnWithCluster(stack, 'FargateService', serviceArn); - - const artifact = new codepipeline.Artifact('Artifact'); - const bucket = new s3.Bucket(stack, 'PipelineBucket', { - versioned: true, - removalPolicy: cdk.RemovalPolicy.DESTROY, - }); - const source = new cpactions.S3SourceAction({ - actionName: 'Source', - output: artifact, - bucket, - bucketKey: 'key', - }); - const action = new cpactions.EcsDeployAction({ - actionName: 'ECS', - service: service, - input: artifact, - }); - new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [source], - }, - { - stageName: 'Deploy', - actions: [action], - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - {}, - { - Actions: [ - { - Name: 'ECS', - ActionTypeId: { - Category: 'Deploy', - Provider: 'ECS', - }, - Configuration: { - ClusterName: clusterName, - ServiceName: serviceName, - }, - Region: region, - RoleArn: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - `:iam::${account}:role/pipelinestack-support-serloyecsactionrole49867f847238c85af7c0`, - ], - ], - }, - }, - ], - }, - ], - }); - }); - }); -}); - -function anyEcsService(): ecs.FargateService { - const stack = new cdk.Stack(); - const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDefinition'); - taskDefinition.addContainer('MainContainer', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new ecs.Cluster(stack, 'Cluster', { - vpc, - }); - return new ecs.FargateService(stack, 'FargateService', { - cluster, - taskDefinition, - }); -} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts deleted file mode 100644 index f959806bb023a..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); - -/// !show -// Source stage: read from repository -const repo = new codecommit.Repository(stack, 'TemplateRepo', { - repositoryName: 'template-repo', -}); -const sourceOutput = new codepipeline.Artifact('SourceArtifact'); -const source = new cpactions.CodeCommitSourceAction({ - actionName: 'Source', - repository: repo, - output: sourceOutput, - trigger: cpactions.CodeCommitTrigger.POLL, -}); -const sourceStage = { - stageName: 'Source', - actions: [source], -}; - -// Deployment stage: create and deploy changeset with manual approval -const stackName = 'OurStack'; -const changeSetName = 'StagedChangeSet'; - -const prodStage = { - stageName: 'Deploy', - actions: [ - new cpactions.CloudFormationCreateReplaceChangeSetAction({ - actionName: 'PrepareChanges', - stackName, - changeSetName, - adminPermissions: true, - templatePath: sourceOutput.atPath('template.yaml'), - runOrder: 1, - }), - new cpactions.ManualApprovalAction({ - actionName: 'ApproveChanges', - runOrder: 2, - }), - new cpactions.CloudFormationExecuteChangeSetAction({ - actionName: 'ExecuteChanges', - stackName, - changeSetName, - runOrder: 3, - }), - ], -}; - -new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - sourceStage, - prodStage, - ], -}); -/// !hide - -app.synth(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts deleted file mode 100644 index c8bf98cdf323a..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts +++ /dev/null @@ -1,133 +0,0 @@ -/// !cdk-integ PipelineStack -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as codepipeline_actions from '../lib'; - -const app = new cdk.App(); - -/// !show -const lambdaStack = new cdk.Stack(app, 'LambdaStack'); -const lambdaCode = lambda.Code.fromCfnParameters(); -new lambda.Function(lambdaStack, 'Lambda', { - code: lambdaCode, - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); -// other resources that your Lambda needs, added to the lambdaStack... - -const pipelineStack = new cdk.Stack(app, 'PipelineStack'); -const pipeline = new codepipeline.Pipeline(pipelineStack, 'Pipeline'); - -// add the source code repository containing this code to your Pipeline, -// and the source code of the Lambda Function, if they're separate -const cdkSourceOutput = new codepipeline.Artifact(); -const cdkSourceAction = new codepipeline_actions.CodeCommitSourceAction({ - repository: new codecommit.Repository(pipelineStack, 'CdkCodeRepo', { - repositoryName: 'CdkCodeRepo', - }), - actionName: 'CdkCode_Source', - output: cdkSourceOutput, -}); -const lambdaSourceOutput = new codepipeline.Artifact(); -const lambdaSourceAction = new codepipeline_actions.CodeCommitSourceAction({ - repository: new codecommit.Repository(pipelineStack, 'LambdaCodeRepo', { - repositoryName: 'LambdaCodeRepo', - }), - actionName: 'LambdaCode_Source', - output: lambdaSourceOutput, -}); -pipeline.addStage({ - stageName: 'Source', - actions: [cdkSourceAction, lambdaSourceAction], -}); - -// synthesize the Lambda CDK template, using CodeBuild -// the below values are just examples, assuming your CDK code is in TypeScript/JavaScript - -// adjust the build environment and/or commands accordingly -const cdkBuildProject = new codebuild.Project(pipelineStack, 'CdkBuildProject', { - environment: { - buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, - }, - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - install: { - commands: 'npm install', - }, - build: { - commands: [ - 'npm run build', - 'npm run cdk synth LambdaStack -- -o .', - ], - }, - }, - artifacts: { - files: 'LambdaStack.template.yaml', - }, - }), -}); -const cdkBuildOutput = new codepipeline.Artifact(); -const cdkBuildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'CDK_Build', - project: cdkBuildProject, - input: cdkSourceOutput, - outputs: [cdkBuildOutput], -}); - -// build your Lambda code, using CodeBuild -// again, this example assumes your Lambda is written in TypeScript/JavaScript - -// make sure to adjust the build environment and/or commands if they don't match your specific situation -const lambdaBuildProject = new codebuild.Project(pipelineStack, 'LambdaBuildProject', { - environment: { - buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, - }, - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - install: { - commands: 'npm install', - }, - build: { - commands: 'npm run build', - }, - }, - artifacts: { - files: [ - 'index.js', - 'node_modules/**/*', - ], - }, - }), -}); -const lambdaBuildOutput = new codepipeline.Artifact(); -const lambdaBuildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'Lambda_Build', - project: lambdaBuildProject, - input: lambdaSourceOutput, - outputs: [lambdaBuildOutput], -}); - -pipeline.addStage({ - stageName: 'Build', - actions: [cdkBuildAction, lambdaBuildAction], -}); - -// finally, deploy your Lambda Stack -pipeline.addStage({ - stageName: 'Deploy', - actions: [ - new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - actionName: 'Lambda_CFN_Deploy', - templatePath: cdkBuildOutput.atPath('LambdaStack.template.yaml'), - stackName: 'LambdaStackDeployedName', - adminPermissions: true, - parameterOverrides: lambdaCode.assign(lambdaBuildOutput.s3Location), - extraInputs: [ - lambdaBuildOutput, - ], - }), - ], -}); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.ts deleted file mode 100644 index 0116c3dbc4327..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cdk from '@aws-cdk/core'; -import * as cpactions from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-codecommit'); - -const repo = new codecommit.Repository(stack, 'MyRepo', { - repositoryName: 'my-repo', -}); - -new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'source', - actions: [ - new cpactions.CodeCommitSourceAction({ - actionName: 'source', - repository: repo, - output: new codepipeline.Artifact('SourceArtifact'), - }), - ], - }, - { - stageName: 'build', - actions: [ - new cpactions.ManualApprovalAction({ actionName: 'manual' }), - ], - }, - ], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts deleted file mode 100644 index 48058ad2366da..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts +++ /dev/null @@ -1,221 +0,0 @@ -/// !cdk-integ * - -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as codepipeline_actions from '../lib'; - -/** - * This example demonstrates how to create a CodePipeline that deploys an ECS Service - * from a different source repository than the source repository of your CDK code. - * If your application code and your CDK code are in the same repository, - * use the CDK Pipelines module instead of this method. - */ - -/// !show - -/** - * These are the construction properties for `EcsAppStack`. - * They extend the standard Stack properties, - * but also require providing the ContainerImage that the service will use. - * That Image will be provided from the Stack containing the CodePipeline. - */ -export interface EcsAppStackProps extends cdk.StackProps { - readonly image: ecs.ContainerImage; -} - -/** - * This is the Stack containing a simple ECS Service that uses the provided ContainerImage. - */ -export class EcsAppStack extends cdk.Stack { - constructor(scope: Construct, id: string, props: EcsAppStackProps) { - super(scope, id, props); - - const taskDefinition = new ecs.TaskDefinition(this, 'TaskDefinition', { - compatibility: ecs.Compatibility.FARGATE, - cpu: '1024', - memoryMiB: '2048', - }); - taskDefinition.addContainer('AppContainer', { - image: props.image, - }); - new ecs.FargateService(this, 'EcsService', { - taskDefinition, - cluster: new ecs.Cluster(this, 'Cluster', { - vpc: new ec2.Vpc(this, 'Vpc', { - maxAzs: 1, - }), - }), - }); - } -} - -/** - * This is the Stack containing the CodePipeline definition that deploys an ECS Service. - */ -export class PipelineStack extends cdk.Stack { - public readonly tagParameterContainerImage: ecs.TagParameterContainerImage; - - constructor(scope: Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /* ********** ECS part **************** */ - - // this is the ECR repository where the built Docker image will be pushed - const appEcrRepo = new ecr.Repository(this, 'EcsDeployRepository'); - // the build that creates the Docker image, and pushes it to the ECR repo - const appCodeDockerBuild = new codebuild.PipelineProject(this, 'AppCodeDockerImageBuildAndPushProject', { - environment: { - // we need to run Docker - privileged: true, - }, - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - // login to ECR first - '$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)', - // if your application needs any build steps, they would be invoked here - - // build the image, and tag it with the commit hash - // (CODEBUILD_RESOLVED_SOURCE_VERSION is a special environment variable available in CodeBuild) - 'docker build -t $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION .', - ], - }, - post_build: { - commands: [ - // push the built image into the ECR repository - 'docker push $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION', - // save the declared tag as an environment variable, - // that is then exported below in the 'exported-variables' section as a CodePipeline Variable - 'export imageTag=$CODEBUILD_RESOLVED_SOURCE_VERSION', - ], - }, - }, - env: { - // save the imageTag environment variable as a CodePipeline Variable - 'exported-variables': [ - 'imageTag', - ], - }, - }), - environmentVariables: { - REPOSITORY_URI: { - value: appEcrRepo.repositoryUri, - }, - }, - }); - // needed for `docker push` - appEcrRepo.grantPullPush(appCodeDockerBuild); - // create the ContainerImage used for the ECS application Stack - this.tagParameterContainerImage = new ecs.TagParameterContainerImage(appEcrRepo); - - const cdkCodeBuild = new codebuild.PipelineProject(this, 'CdkCodeBuildProject', { - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - install: { - commands: [ - 'npm install', - ], - }, - build: { - commands: [ - // synthesize the CDK code for the ECS application Stack - 'npx cdk synth --verbose', - ], - }, - }, - artifacts: { - // store the entire Cloud Assembly as the output artifact - 'base-directory': 'cdk.out', - 'files': '**/*', - }, - }), - }); - - /* ********** Pipeline part **************** */ - - const appCodeSourceOutput = new codepipeline.Artifact(); - const cdkCodeSourceOutput = new codepipeline.Artifact(); - const cdkCodeBuildOutput = new codepipeline.Artifact(); - const appCodeBuildAction = new codepipeline_actions.CodeBuildAction({ - actionName: 'AppCodeDockerImageBuildAndPush', - project: appCodeDockerBuild, - input: appCodeSourceOutput, - }); - new codepipeline.Pipeline(this, 'CodePipelineDeployingEcsApplication', { - artifactBucket: new s3.Bucket(this, 'ArtifactBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - }), - stages: [ - { - stageName: 'Source', - actions: [ - // this is the Action that takes the source of your application code - new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'AppCodeSource', - repository: new codecommit.Repository(this, 'AppCodeSourceRepository', { repositoryName: 'AppCodeSourceRepository' }), - output: appCodeSourceOutput, - }), - // this is the Action that takes the source of your CDK code - // (which would probably include this Pipeline code as well) - new codepipeline_actions.CodeCommitSourceAction({ - actionName: 'CdkCodeSource', - repository: new codecommit.Repository(this, 'CdkCodeSourceRepository', { repositoryName: 'CdkCodeSourceRepository' }), - output: cdkCodeSourceOutput, - }), - ], - }, - { - stageName: 'Build', - actions: [ - appCodeBuildAction, - new codepipeline_actions.CodeBuildAction({ - actionName: 'CdkCodeBuildAndSynth', - project: cdkCodeBuild, - input: cdkCodeSourceOutput, - outputs: [cdkCodeBuildOutput], - }), - ], - }, - { - stageName: 'Deploy', - actions: [ - new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - actionName: 'CFN_Deploy', - stackName: 'SampleEcsStackDeployedFromCodePipeline', - // this name has to be the same name as used below in the CDK code for the application Stack - templatePath: cdkCodeBuildOutput.atPath('EcsStackDeployedInPipeline.template.json'), - adminPermissions: true, - parameterOverrides: { - // read the tag pushed to the ECR repository from the CodePipeline Variable saved by the application build step, - // and pass it as the CloudFormation Parameter for the tag - [this.tagParameterContainerImage.tagParameterName]: appCodeBuildAction.variable('imageTag'), - }, - }), - ], - }, - ], - }); - } -} - -const app = new cdk.App(); - -// the CodePipeline Stack needs to be created first -const pipelineStack = new PipelineStack(app, 'aws-cdk-pipeline-ecs-separate-sources'); -// we supply the image to the ECS application Stack from the CodePipeline Stack -new EcsAppStack(app, 'EcsStackDeployedInPipeline', { - image: pipelineStack.tagParameterContainerImage, -}); -/// !hide - -app.synth(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts deleted file mode 100644 index 3554dc94d4617..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-s3-deploy.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/pipeline.test.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/pipeline.test.ts deleted file mode 100644 index a90e4a3a0b996..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/pipeline.test.ts +++ /dev/null @@ -1,1146 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import { App, Aws, CfnParameter, SecretValue, Stack } from '@aws-cdk/core'; -import * as cpactions from '../lib'; - -/* eslint-disable quote-props */ - -describe('pipeline', () => { - test('basic pipeline', () => { - const stack = new Stack(); - - const repository = new codecommit.Repository(stack, 'MyRepo', { - repositoryName: 'my-repo', - }); - - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); - const sourceOutput = new codepipeline.Artifact('SourceArtifact'); - const source = new cpactions.CodeCommitSourceAction({ - actionName: 'source', - output: sourceOutput, - repository, - }); - pipeline.addStage({ - stageName: 'source', - actions: [source], - }); - - const project = new codebuild.PipelineProject(stack, 'MyBuildProject'); - pipeline.addStage({ - stageName: 'build', - actions: [ - new cpactions.CodeBuildAction({ - actionName: 'build', - input: sourceOutput, - project, - }), - ], - }); - - expect(Template.fromStack(stack).toJSON()).not.toEqual({}); - expect([]).toEqual(pipeline.node.validate()); - }); - - test('Tokens can be used as physical names of the Pipeline', () => { - const stack = new Stack(undefined, 'StackName'); - - const p = new codepipeline.Pipeline(stack, 'Pipeline', { - pipelineName: Aws.STACK_NAME, - }); - p.addStage({ - stageName: 'Source', - actions: [ - new cpactions.GitHubSourceAction({ - actionName: 'GH', - runOrder: 8, - output: new codepipeline.Artifact('A'), - branch: 'branch', - oauthToken: SecretValue.unsafePlainText('secret'), - owner: 'foo', - repo: 'bar', - trigger: cpactions.GitHubTrigger.POLL, - }), - ], - }); - - p.addStage({ - stageName: 'Two', - actions: [ - new cpactions.ManualApprovalAction({ actionName: 'Boo' }), - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'Name': { - 'Ref': 'AWS::StackName', - }, - }); - - - }); - - test('pipeline with GitHub source with poll trigger', () => { - const stack = new Stack(); - - const secret = new CfnParameter(stack, 'GitHubToken', { type: 'String', default: 'my-token' }); - - const p = new codepipeline.Pipeline(stack, 'P'); - - p.addStage({ - stageName: 'Source', - actions: [ - new cpactions.GitHubSourceAction({ - actionName: 'GH', - runOrder: 8, - output: new codepipeline.Artifact('A'), - branch: 'branch', - oauthToken: SecretValue.unsafePlainText(secret.valueAsString), - owner: 'foo', - repo: 'bar', - trigger: cpactions.GitHubTrigger.POLL, - }), - ], - }); - - p.addStage({ - stageName: 'Two', - actions: [ - new cpactions.ManualApprovalAction({ actionName: 'Boo' }), - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::CodePipeline::Webhook', 0); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'Stages': [ - { - 'Actions': [ - { - 'Configuration': { - 'PollForSourceChanges': true, - }, - 'Name': 'GH', - }, - ], - 'Name': 'Source', - }, - { - 'Actions': [ - { - 'Name': 'Boo', - }, - ], - 'Name': 'Two', - }, - ], - }); - - - }); - - test('pipeline with GitHub source without triggers', () => { - const stack = new Stack(); - - const secret = new CfnParameter(stack, 'GitHubToken', { type: 'String', default: 'my-token' }); - - const p = new codepipeline.Pipeline(stack, 'P'); - - p.addStage({ - stageName: 'Source', - actions: [ - new cpactions.GitHubSourceAction({ - actionName: 'GH', - runOrder: 8, - output: new codepipeline.Artifact('A'), - branch: 'branch', - oauthToken: SecretValue.unsafePlainText(secret.valueAsString), - owner: 'foo', - repo: 'bar', - trigger: cpactions.GitHubTrigger.NONE, - }), - ], - }); - - p.addStage({ - stageName: 'Two', - actions: [ - new cpactions.ManualApprovalAction({ actionName: 'Boo' }), - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::CodePipeline::Webhook', 0); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'Stages': [ - { - 'Actions': [ - { - 'Configuration': { - 'PollForSourceChanges': false, - }, - 'Name': 'GH', - }, - ], - 'Name': 'Source', - }, - { - 'Actions': [ - { - 'Name': 'Boo', - }, - ], - 'Name': 'Two', - }, - ], - }); - - - }); - - test('github action uses ThirdParty owner', () => { - const stack = new Stack(); - - const secret = new CfnParameter(stack, 'GitHubToken', { type: 'String', default: 'my-token' }); - - const p = new codepipeline.Pipeline(stack, 'P'); - - p.addStage({ - stageName: 'Source', - actions: [ - new cpactions.GitHubSourceAction({ - actionName: 'GH', - runOrder: 8, - output: new codepipeline.Artifact('A'), - branch: 'branch', - oauthToken: SecretValue.unsafePlainText(secret.valueAsString), - owner: 'foo', - repo: 'bar', - }), - ], - }); - - p.addStage({ - stageName: 'Two', - actions: [ - new cpactions.ManualApprovalAction({ actionName: 'Boo' }), - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::CodePipeline::Webhook', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStore': { - 'Location': { - 'Ref': 'PArtifactsBucket5E711C12', - }, - 'Type': 'S3', - }, - 'RoleArn': { - 'Fn::GetAtt': [ - 'PRole07BDC907', - 'Arn', - ], - }, - 'Stages': [ - { - 'Actions': [ - { - 'ActionTypeId': { - 'Category': 'Source', - 'Owner': 'ThirdParty', - 'Provider': 'GitHub', - 'Version': '1', - }, - 'Configuration': { - 'Owner': 'foo', - 'Repo': 'bar', - 'Branch': 'branch', - 'OAuthToken': { - 'Ref': 'GitHubToken', - }, - 'PollForSourceChanges': false, - }, - 'Name': 'GH', - 'OutputArtifacts': [ - { - 'Name': 'A', - }, - ], - 'RunOrder': 8, - }, - ], - 'Name': 'Source', - }, - { - 'Actions': [ - { - 'ActionTypeId': { - 'Category': 'Approval', - 'Owner': 'AWS', - 'Provider': 'Manual', - 'Version': '1', - }, - 'Name': 'Boo', - 'RunOrder': 1, - }, - ], - 'Name': 'Two', - }, - ], - }); - - expect([]).toEqual(p.node.validate()); - }); - - test('onStateChange', () => { - const stack = new Stack(); - - const topic = new sns.Topic(stack, 'Topic'); - - const pipeline = new codepipeline.Pipeline(stack, 'PL'); - - pipeline.addStage({ - stageName: 'S1', - actions: [ - new cpactions.S3SourceAction({ - actionName: 'A1', - output: new codepipeline.Artifact('Artifact'), - bucket: new s3.Bucket(stack, 'Bucket'), - bucketKey: 'Key', - }), - ], - }); - - pipeline.addStage({ - stageName: 'S2', - actions: [ - new cpactions.ManualApprovalAction({ actionName: 'A2' }), - ], - }); - - pipeline.onStateChange('OnStateChange', { - target: new targets.SnsTopic(topic), - description: 'desc', - eventPattern: { - detail: { - state: ['FAILED'], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - 'Description': 'desc', - 'EventPattern': { - 'detail': { - 'state': [ - 'FAILED', - ], - }, - 'detail-type': [ - 'CodePipeline Pipeline Execution State Change', - ], - 'source': [ - 'aws.codepipeline', - ], - 'resources': [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':codepipeline:', - { - 'Ref': 'AWS::Region', - }, - ':', - { - 'Ref': 'AWS::AccountId', - }, - ':', - { - 'Ref': 'PLD5425AEA', - }, - ], - ], - }, - ], - }, - 'State': 'ENABLED', - 'Targets': [ - { - 'Arn': { - 'Ref': 'TopicBFC7AF6E', - }, - 'Id': 'Target0', - }, - ], - }); - - expect([]).toEqual(pipeline.node.validate()); - }); - - describe('PipelineProject', () => { - describe('with a custom Project Name', () => { - test('sets the source and artifacts to CodePipeline', () => { - const stack = new Stack(); - - new codebuild.PipelineProject(stack, 'MyProject', { - projectName: 'MyProject', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { - 'Name': 'MyProject', - 'Source': { - 'Type': 'CODEPIPELINE', - }, - 'Artifacts': { - 'Type': 'CODEPIPELINE', - }, - 'ServiceRole': { - 'Fn::GetAtt': [ - 'MyProjectRole9BBE5233', - 'Arn', - ], - }, - 'Environment': { - 'Type': 'LINUX_CONTAINER', - 'PrivilegedMode': false, - 'Image': 'aws/codebuild/standard:1.0', - 'ComputeType': 'BUILD_GENERAL1_SMALL', - }, - }); - - - }); - }); - }); - - test('Lambda PipelineInvokeAction can be used to invoke Lambda functions from a CodePipeline', () => { - const stack = new Stack(); - - const lambdaFun = new lambda.Function(stack, 'Function', { - code: new lambda.InlineCode('bla'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - const source1Output = new codepipeline.Artifact('sourceArtifact1'); - const source1 = new cpactions.S3SourceAction({ - actionName: 'SourceAction1', - bucketKey: 'some/key', - output: source1Output, - bucket, - }); - const source2Output = new codepipeline.Artifact('sourceArtifact2'); - const source2 = new cpactions.S3SourceAction({ - actionName: 'SourceAction2', - bucketKey: 'another/key', - output: source2Output, - bucket, - }); - pipeline.addStage({ - stageName: 'Source', - actions: [ - source1, - source2, - ], - }); - - const lambdaAction = new cpactions.LambdaInvokeAction({ - actionName: 'InvokeAction', - lambda: lambdaFun, - inputs: [ - source2Output, - source1Output, - ], - outputs: [ - new codepipeline.Artifact('lambdaOutput1'), - new codepipeline.Artifact('lambdaOutput2'), - new codepipeline.Artifact('lambdaOutput3'), - ], - }); - pipeline.addStage({ - stageName: 'Stage', - actions: [lambdaAction], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStore': { - 'Location': { - 'Ref': 'PipelineArtifactsBucket22248F97', - }, - 'Type': 'S3', - }, - 'RoleArn': { - 'Fn::GetAtt': [ - 'PipelineRoleD68726F7', - 'Arn', - ], - }, - 'Stages': [ - { - 'Name': 'Source', - }, - { - 'Actions': [ - { - 'ActionTypeId': { - 'Category': 'Invoke', - 'Owner': 'AWS', - 'Provider': 'Lambda', - 'Version': '1', - }, - 'Configuration': { - 'FunctionName': { - 'Ref': 'Function76856677', - }, - }, - 'InputArtifacts': [ - { 'Name': 'sourceArtifact2' }, - { 'Name': 'sourceArtifact1' }, - ], - 'Name': 'InvokeAction', - 'OutputArtifacts': [ - { 'Name': 'lambdaOutput1' }, - { 'Name': 'lambdaOutput2' }, - { 'Name': 'lambdaOutput3' }, - ], - 'RunOrder': 1, - }, - ], - 'Name': 'Stage', - }, - ], - }); - - expect((lambdaAction.actionProperties.outputs || []).length).toEqual(3); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': [ - 'codepipeline:PutJobSuccessResult', - 'codepipeline:PutJobFailureResult', - ], - 'Effect': 'Allow', - 'Resource': '*', - }, - ], - 'Version': '2012-10-17', - }, - 'PolicyName': 'FunctionServiceRoleDefaultPolicy2F49994A', - 'Roles': [ - { - 'Ref': 'FunctionServiceRole675BB04A', - }, - ], - }); - - - }); - - describe('cross-region Pipeline', () => { - test('generates the required Action & ArtifactStores properties in the template', () => { - const pipelineRegion = 'us-west-2'; - const pipelineAccount = '123'; - - const app = new App(); - - const stack = new Stack(app, 'TestStack', { - env: { - region: pipelineRegion, - account: pipelineAccount, - }, - }); - const pipeline = new codepipeline.Pipeline(stack, 'MyPipeline', { - crossRegionReplicationBuckets: { - 'us-west-1': s3.Bucket.fromBucketName(stack, 'ImportedBucket', 'sfo-replication-bucket'), - }, - }); - - const sourceBucket = new s3.Bucket(stack, 'MyBucket'); - const sourceOutput = new codepipeline.Artifact('SourceOutput'); - const sourceAction = new cpactions.S3SourceAction({ - actionName: 'BucketSource', - bucketKey: '/some/key', - output: sourceOutput, - bucket: sourceBucket, - }); - pipeline.addStage({ - stageName: 'Stage1', - actions: [sourceAction], - }); - - pipeline.addStage({ - stageName: 'Stage2', - actions: [ - new cpactions.CloudFormationCreateReplaceChangeSetAction({ - actionName: 'Action1', - changeSetName: 'ChangeSet', - templatePath: sourceOutput.atPath('template.yaml'), - stackName: 'SomeStack', - region: pipelineRegion, - adminPermissions: false, - }), - new cpactions.CloudFormationCreateUpdateStackAction({ - actionName: 'Action2', - templatePath: sourceOutput.atPath('template.yaml'), - stackName: 'OtherStack', - region: 'us-east-1', - adminPermissions: false, - }), - new cpactions.CloudFormationExecuteChangeSetAction({ - actionName: 'Action3', - changeSetName: 'ChangeSet', - stackName: 'SomeStack', - region: 'us-west-1', - }), - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStores': [ - { - 'Region': 'us-west-1', - 'ArtifactStore': { - 'Type': 'S3', - 'Location': 'sfo-replication-bucket', - }, - }, - { - 'Region': 'us-east-1', - 'ArtifactStore': { - 'Type': 'S3', - 'Location': 'teststack-support-us-easteplicationbucket1a8063b3cdac6e7e0e73', - }, - }, - { - 'Region': 'us-west-2', - 'ArtifactStore': { - 'Type': 'S3', - 'EncryptionKey': { - 'Type': 'KMS', - 'Id': { - }, - }, - }, - }, - ], - 'Stages': [ - { - 'Name': 'Stage1', - }, - { - 'Name': 'Stage2', - 'Actions': [ - { - 'Name': 'Action1', - 'Region': 'us-west-2', - }, - { - 'Name': 'Action2', - 'Region': 'us-east-1', - }, - { - 'Name': 'Action3', - 'Region': 'us-west-1', - }, - ], - }, - ], - }); - - expect(pipeline.crossRegionSupport[pipelineRegion]).toBeDefined(); - expect(pipeline.crossRegionSupport['us-west-1']).toBeDefined(); - - const usEast1Support = pipeline.crossRegionSupport['us-east-1']; - expect(usEast1Support).toBeDefined(); - expect(usEast1Support.stack.region).toEqual('us-east-1'); - expect(usEast1Support.stack.account).toEqual(pipelineAccount); - expect(usEast1Support.stack.node.id.indexOf('us-east-1')).not.toEqual(-1); - - - }); - - test('allows specifying only one of artifactBucket and crossRegionReplicationBuckets', () => { - const stack = new Stack(); - - expect(() => { - new codepipeline.Pipeline(stack, 'Pipeline', { - artifactBucket: new s3.Bucket(stack, 'Bucket'), - crossRegionReplicationBuckets: { - // even an empty map should trigger this validation... - }, - }); - }).toThrow(/Only one of artifactBucket and crossRegionReplicationBuckets can be specified!/); - - }); - - test('does not create a new artifact Bucket if one was provided in the cross-region Buckets for the Pipeline region', () => { - const pipelineRegion = 'us-west-2'; - - const stack = new Stack(undefined, undefined, { - env: { - region: pipelineRegion, - }, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(stack, 'Pipeline', { - crossRegionReplicationBuckets: { - [pipelineRegion]: new s3.Bucket(stack, 'Bucket', { - bucketName: 'my-pipeline-bucket', - }), - }, - stages: [ - { - stageName: 'Source', - actions: [ - new cpactions.CodeCommitSourceAction({ - actionName: 'Source', - output: sourceOutput, - repository: new codecommit.Repository(stack, 'Repo', { repositoryName: 'Repo' }), - }), - ], - }, - { - stageName: 'Build', - actions: [ - new cpactions.CodeBuildAction({ - actionName: 'Build', - input: sourceOutput, - project: new codebuild.PipelineProject(stack, 'Project'), - }), - ], - }, - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::S3::Bucket', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStores': [ - { - 'Region': pipelineRegion, - 'ArtifactStore': { - 'Type': 'S3', - 'Location': { - 'Ref': 'Bucket83908E77', - }, - }, - }, - ], - }); - - - }); - - test('allows providing a resource-backed action from a different region directly', () => { - const account = '123456789012'; - const app = new App(); - - const replicationRegion = 'us-west-1'; - const replicationStack = new Stack(app, 'ReplicationStack', { env: { region: replicationRegion, account } }); - const project = new codebuild.PipelineProject(replicationStack, 'CodeBuildProject', { - projectName: 'MyCodeBuildProject', - }); - - const pipelineRegion = 'us-west-2'; - const pipelineStack = new Stack(app, 'TestStack', { env: { region: pipelineRegion, account } }); - const sourceOutput = new codepipeline.Artifact('SourceOutput'); - new codepipeline.Pipeline(pipelineStack, 'MyPipeline', { - stages: [ - { - stageName: 'Source', - actions: [new cpactions.CodeCommitSourceAction({ - actionName: 'CodeCommitAction', - output: sourceOutput, - repository: codecommit.Repository.fromRepositoryName(pipelineStack, 'Repo', 'my-codecommit-repo'), - })], - }, - { - stageName: 'Build', - actions: [new cpactions.CodeBuildAction({ - actionName: 'CodeBuildAction', - input: sourceOutput, - project, - })], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStores': [ - { - 'Region': replicationRegion, - 'ArtifactStore': { - 'Type': 'S3', - 'Location': 'replicationstackeplicationbucket2464cd5c33b386483b66', - 'EncryptionKey': { - 'Id': { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':kms:us-west-1:123456789012:alias/ionstacktencryptionalias043cb2f8ceac9da9c07c', - ], - ], - }, - 'Type': 'KMS', - }, - }, - }, - { - 'Region': pipelineRegion, - }, - ], - 'Stages': [ - { - 'Name': 'Source', - }, - { - 'Name': 'Build', - 'Actions': [ - { - 'Name': 'CodeBuildAction', - 'Region': replicationRegion, - 'Configuration': { - 'ProjectName': 'MyCodeBuildProject', - }, - }, - ], - }, - ], - }); - - Template.fromStack(replicationStack).hasResourceProperties('AWS::S3::Bucket', { - 'BucketName': 'replicationstackeplicationbucket2464cd5c33b386483b66', - }); - - - }); - }); - - describe('cross-account Pipeline', () => { - test('with a CodeBuild Project in a different account works correctly', () => { - const app = new App(); - - const buildAccount = '901234567890'; - const buildRegion = 'bermuda-triangle-1'; - const buildStack = new Stack(app, 'BuildStack', { - env: { account: buildAccount, region: buildRegion }, - }); - const rolePhysicalName = 'ProjectRolePhysicalName'; - const projectRole = new iam.Role(buildStack, 'ProjectRole', { - assumedBy: new iam.ServicePrincipal('codebuild.amazonaws.com'), - roleName: rolePhysicalName, - }); - const projectPhysicalName = 'ProjectPhysicalName'; - const project = new codebuild.PipelineProject(buildStack, 'Project', { - projectName: projectPhysicalName, - role: projectRole, - }); - - const pipelineStack = new Stack(app, 'PipelineStack', { - env: { account: '123456789012', region: buildRegion }, - }); - const sourceBucket = new s3.Bucket(pipelineStack, 'ArtifactBucket', { - bucketName: 'source-bucket', - encryption: s3.BucketEncryption.KMS, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [ - new cpactions.S3SourceAction({ - actionName: 'S3', - bucket: sourceBucket, - bucketKey: 'path/to/file.zip', - output: sourceOutput, - }), - ], - }, - { - stageName: 'Build', - actions: [ - new cpactions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - }), - ], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'Stages': [ - { - 'Name': 'Source', - }, - { - 'Name': 'Build', - 'Actions': [ - { - 'Name': 'CodeBuild', - 'Configuration': { - 'ProjectName': projectPhysicalName, - }, - 'RoleArn': { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - `:iam::${buildAccount}:role/buildstackebuildactionrole166c75d1d8be701b1ad8`, - ], - ], - }, - }, - ], - }, - ], - }); - - Template.fromStack(buildStack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ - { - // log permissions from the CodeBuild Project Construct... - }, - { - // report group permissions from the CodeBuild Project construct... - }, - { - 'Action': [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - ], - 'Effect': 'Allow', - 'Resource': [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':s3:::pipelinestackeartifactsbucket5409dc84bb108027cb58', - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':s3:::pipelinestackeartifactsbucket5409dc84bb108027cb58/*', - ], - ], - }, - ], - }, - { - 'Action': [ - 'kms:Decrypt', - 'kms:DescribeKey', - ], - 'Effect': 'Allow', - 'Resource': '*', - }, - ], - }, - }); - - - }); - - test('adds a dependency on the Stack containing a new action Role', () => { - const region = 'us-west-2'; - const pipelineAccount = '123456789012'; - const buildAccount = '901234567890'; - const app = new App(); - - const buildStack = new Stack(app, 'BuildStack', { - env: { account: buildAccount, region }, - }); - const actionRolePhysicalName = 'ProjectRolePhysicalName'; - const actionRoleInOtherAccount = new iam.Role(buildStack, 'ProjectRole', { - assumedBy: new iam.AccountPrincipal(pipelineAccount), - roleName: actionRolePhysicalName, - }); - const projectPhysicalName = 'ProjectPhysicalName'; - const project = codebuild.Project.fromProjectName(buildStack, 'Project', - projectPhysicalName); - - const pipelineStack = new Stack(app, 'PipelineStack', { - env: { account: pipelineAccount, region }, - }); - const bucket = new s3.Bucket(pipelineStack, 'ArtifactBucket', { - bucketName: 'source-bucket', - encryption: s3.BucketEncryption.KMS, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - artifactBucket: bucket, - stages: [ - { - stageName: 'Source', - actions: [ - new cpactions.S3SourceAction({ - actionName: 'S3', - bucket, - bucketKey: 'path/to/file.zip', - output: sourceOutput, - }), - ], - }, - { - stageName: 'Build', - actions: [ - new cpactions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - role: actionRoleInOtherAccount, - }), - ], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'Stages': [ - { - 'Name': 'Source', - }, - { - 'Name': 'Build', - 'Actions': [ - { - 'Name': 'CodeBuild', - 'Configuration': { - 'ProjectName': projectPhysicalName, - }, - 'RoleArn': { - 'Fn::Join': ['', [ - 'arn:', - { 'Ref': 'AWS::Partition' }, - `:iam::${buildAccount}:role/${actionRolePhysicalName}`, - ]], - }, - }, - ], - }, - ], - }); - - expect(pipelineStack.dependencies.length).toEqual(1); - - - }); - - test('does not add a dependency on the Stack containing an imported action Role', () => { - const region = 'us-west-2'; - const pipelineAccount = '123456789012'; - const buildAccount = '901234567890'; - const app = new App(); - - const buildStack = new Stack(app, 'BuildStack', { - env: { account: buildAccount, region }, - }); - const actionRolePhysicalName = 'ProjectRolePhysicalName'; - const actionRoleInOtherAccount = iam.Role.fromRoleArn(buildStack, 'ProjectRole', - `arn:aws:iam::${buildAccount}:role/${actionRolePhysicalName}`); - const projectPhysicalName = 'ProjectPhysicalName'; - const project = new codebuild.PipelineProject(buildStack, 'Project', { - projectName: projectPhysicalName, - }); - - const pipelineStack = new Stack(app, 'PipelineStack', { - env: { account: pipelineAccount, region }, - }); - const bucket = new s3.Bucket(pipelineStack, 'ArtifactBucket', { - bucketName: 'source-bucket', - encryption: s3.BucketEncryption.KMS, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - artifactBucket: bucket, - stages: [ - { - stageName: 'Source', - actions: [ - new cpactions.S3SourceAction({ - actionName: 'S3', - bucket, - bucketKey: 'path/to/file.zip', - output: sourceOutput, - }), - ], - }, - { - stageName: 'Build', - actions: [ - new cpactions.CodeBuildAction({ - actionName: 'CodeBuild', - project, - input: sourceOutput, - role: actionRoleInOtherAccount, - }), - ], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'Stages': [ - { - 'Name': 'Source', - }, - { - 'Name': 'Build', - 'Actions': [ - { - 'Name': 'CodeBuild', - 'Configuration': { - 'ProjectName': projectPhysicalName, - }, - 'RoleArn': `arn:aws:iam::${buildAccount}:role/${actionRolePhysicalName}`, - }, - ], - }, - ], - }); - - expect(pipelineStack.dependencies.length).toEqual(0); - - - }); - }); -}); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.ts b/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.ts deleted file mode 100644 index 8d7ac75267597..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/integ.source-bucket-events-cross-stack-same-env.ts +++ /dev/null @@ -1,47 +0,0 @@ -/// !cdk-integ PipelineStack - -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as cpactions from '../../lib'; - -const app = new App(); -const bucketStack = new Stack(app, 'BucketStack'); -const bucket = new s3.Bucket(bucketStack, 'Bucket', { - removalPolicy: RemovalPolicy.DESTROY, -}); - -const pipelineStack = new Stack(app, 'PipelineStack'); -const sourceOutput = new codepipeline.Artifact(); -new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [ - new cpactions.S3SourceAction({ - actionName: 'Source', - bucket, - trigger: cpactions.S3Trigger.EVENTS, - bucketKey: 'file.zip', - output: sourceOutput, - }), - ], - }, - { - stageName: 'Build', - actions: [ - new cpactions.CodeBuildAction({ - actionName: 'Build', - project: new codebuild.PipelineProject(pipelineStack, 'Project'), - input: sourceOutput, - }), - ], - }, - ], -}); - -new integ.IntegTest(app, 'CodePipelineS3SourceTest', { - testCases: [pipelineStack], -}); diff --git a/packages/@aws-cdk/aws-codepipeline/.eslintrc.js b/packages/@aws-cdk/aws-codepipeline/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codepipeline/.gitignore b/packages/@aws-cdk/aws-codepipeline/.gitignore deleted file mode 100644 index 36b39583a585a..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -*.tgz -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codepipeline/.npmignore b/packages/@aws-cdk/aws-codepipeline/.npmignore deleted file mode 100644 index 833dc0917e678..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codepipeline/LICENSE b/packages/@aws-cdk/aws-codepipeline/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codepipeline/NOTICE b/packages/@aws-cdk/aws-codepipeline/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codepipeline/README.md b/packages/@aws-cdk/aws-codepipeline/README.md deleted file mode 100644 index cd3432cd9cfee..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/README.md +++ /dev/null @@ -1,491 +0,0 @@ -# AWS CodePipeline Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -## Pipeline - -To construct an empty Pipeline: - -```ts -// Construct an empty Pipeline -const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline'); -``` - -To give the Pipeline a nice, human-readable name: - -```ts -// Give the Pipeline a nice, human-readable name -const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { - pipelineName: 'MyPipeline', -}); -``` - -Be aware that in the default configuration, the `Pipeline` construct creates -an AWS Key Management Service (AWS KMS) Customer Master Key (CMK) for you to -encrypt the artifacts in the artifact bucket, which incurs a cost of -**$1/month**. This default configuration is necessary to allow cross-account -actions. - -If you do not intend to perform cross-account deployments, you can disable -the creation of the Customer Master Keys by passing `crossAccountKeys: false` -when defining the Pipeline: - -```ts -// Don't create Customer Master Keys -const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { - crossAccountKeys: false, -}); -``` - -If you want to enable key rotation for the generated KMS keys, -you can configure it by passing `enableKeyRotation: true` when creating the pipeline. -Note that key rotation will incur an additional cost of **$1/month**. - -```ts -// Enable key rotation for the generated KMS key -const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { - // ... - enableKeyRotation: true, -}); -``` - -## Stages - -You can provide Stages when creating the Pipeline: - -```ts -// Provide a Stage when creating a pipeline -const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { - stages: [ - { - stageName: 'Source', - actions: [ - // see below... - ], - }, - ], -}); -``` - -Or append a Stage to an existing Pipeline: - -```ts -// Append a Stage to an existing Pipeline -declare const pipeline: codepipeline.Pipeline; -const sourceStage = pipeline.addStage({ - stageName: 'Source', - actions: [ // optional property - // see below... - ], -}); -``` - -You can insert the new Stage at an arbitrary point in the Pipeline: - -```ts -// Insert a new Stage at an arbitrary point -declare const pipeline: codepipeline.Pipeline; -declare const anotherStage: codepipeline.IStage; -declare const yetAnotherStage: codepipeline.IStage; - -const someStage = pipeline.addStage({ - stageName: 'SomeStage', - placement: { - // note: you can only specify one of the below properties - rightBefore: anotherStage, - justAfter: yetAnotherStage, - } -}); -``` - -You can disable transition to a Stage: - -```ts -// Disable transition to a stage -declare const pipeline: codepipeline.Pipeline; - -const someStage = pipeline.addStage({ - stageName: 'SomeStage', - transitionToEnabled: false, - transitionDisabledReason: 'Manual transition only', // optional reason -}) -``` - -This is useful if you don't want every executions of the pipeline to flow into -this stage automatically. The transition can then be "manually" enabled later on. - -## Actions - -Actions live in a separate package, `@aws-cdk/aws-codepipeline-actions`. - -To add an Action to a Stage, you can provide it when creating the Stage, -in the `actions` property, -or you can use the `IStage.addAction()` method to mutate an existing Stage: - -```ts -// Use the `IStage.addAction()` method to mutate an existing Stage. -declare const sourceStage: codepipeline.IStage; -declare const someAction: codepipeline.Action; -sourceStage.addAction(someAction); -``` - -## Custom Action Registration - -To make your own custom CodePipeline Action requires registering the action provider. Look to the `JenkinsProvider` in `@aws-cdk/aws-codepipeline-actions` for an implementation example. - -```ts -// Make a custom CodePipeline Action -new codepipeline.CustomActionRegistration(this, 'GenericGitSourceProviderResource', { - category: codepipeline.ActionCategory.SOURCE, - artifactBounds: { minInputs: 0, maxInputs: 0, minOutputs: 1, maxOutputs: 1 }, - provider: 'GenericGitSource', - version: '1', - entityUrl: 'https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html', - executionUrl: 'https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html', - actionProperties: [ - { - name: 'Branch', - required: true, - key: false, - secret: false, - queryable: false, - description: 'Git branch to pull', - type: 'String', - }, - { - name: 'GitUrl', - required: true, - key: false, - secret: false, - queryable: false, - description: 'SSH git clone URL', - type: 'String', - }, - ], -}); -``` - -## Cross-account CodePipelines - -> Cross-account Pipeline actions require that the Pipeline has *not* been -> created with `crossAccountKeys: false`. - -Most pipeline Actions accept an AWS resource object to operate on. For example: - -* `S3DeployAction` accepts an `s3.IBucket`. -* `CodeBuildAction` accepts a `codebuild.IProject`. -* etc. - -These resources can be either newly defined (`new s3.Bucket(...)`) or imported -(`s3.Bucket.fromBucketAttributes(...)`) and identify the resource that should -be changed. - -These resources can be in different accounts than the pipeline itself. For -example, the following action deploys to an imported S3 bucket from a -different account: - -```ts -// Deploy an imported S3 bucket from a different account -declare const stage: codepipeline.IStage; -declare const input: codepipeline.Artifact; -stage.addAction(new codepipeline_actions.S3DeployAction({ - bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', { - account: '123456789012', - // ... - }), - input: input, - actionName: 's3-deploy-action', - // ... -})); -``` - -Actions that don't accept a resource object accept an explicit `account` parameter: - -```ts -// Actions that don't accept a resource objet accept an explicit `account` parameter -declare const stage: codepipeline.IStage; -declare const templatePath: codepipeline.ArtifactPath; -stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - account: '123456789012', - templatePath, - adminPermissions: false, - stackName: Stack.of(this).stackName, - actionName: 'cloudformation-create-update', - // ... -})); -``` - -The `Pipeline` construct automatically defines an **IAM Role** for you in the -target account which the pipeline will assume to perform that action. This -Role will be defined in a **support stack** named -`-support-`, that will automatically be deployed -before the stack containing the pipeline. - -If you do not want to use the generated role, you can also explicitly pass a -`role` when creating the action. In that case, the action will operate in the -account the role belongs to: - -```ts -// Explicitly pass in a `role` when creating an action. -declare const stage: codepipeline.IStage; -declare const templatePath: codepipeline.ArtifactPath; -stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - templatePath, - adminPermissions: false, - stackName: Stack.of(this).stackName, - actionName: 'cloudformation-create-update', - // ... - role: iam.Role.fromRoleArn(this, 'ActionRole', '...'), -})); -``` - -## Cross-region CodePipelines - -Similar to how you set up a cross-account Action, the AWS resource object you -pass to actions can also be in different *Regions*. For example, the -following Action deploys to an imported S3 bucket from a different Region: - -```ts -// Deploy to an imported S3 bucket from a different Region. -declare const stage: codepipeline.IStage; -declare const input: codepipeline.Artifact; -stage.addAction(new codepipeline_actions.S3DeployAction({ - bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', { - region: 'us-west-1', - // ... - }), - input: input, - actionName: 's3-deploy-action', - // ... -})); -``` - -Actions that don't take an AWS resource will accept an explicit `region` -parameter: - -```ts -// Actions that don't take an AWS resource will accept an explicit `region` parameter. -declare const stage: codepipeline.IStage; -declare const templatePath: codepipeline.ArtifactPath; -stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({ - templatePath, - adminPermissions: false, - stackName: Stack.of(this).stackName, - actionName: 'cloudformation-create-update', - // ... - region: 'us-west-1', -})); -``` - -The `Pipeline` construct automatically defines a **replication bucket** for -you in the target region, which the pipeline will replicate artifacts to and -from. This Bucket will be defined in a **support stack** named -`-support-`, that will automatically be deployed -before the stack containing the pipeline. - -If you don't want to use these support stacks, and already have buckets in -place to serve as replication buckets, you can supply these at Pipeline definition -time using the `crossRegionReplicationBuckets` parameter. Example: - -```ts -// Supply replication buckets for the Pipeline instead of using the generated support stack -const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { - // ... - - crossRegionReplicationBuckets: { - // note that a physical name of the replication Bucket must be known at synthesis time - 'us-west-1': s3.Bucket.fromBucketAttributes(this, 'UsWest1ReplicationBucket', { - bucketName: 'my-us-west-1-replication-bucket', - // optional KMS key - encryptionKey: kms.Key.fromKeyArn(this, 'UsWest1ReplicationKey', - 'arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012' - ), - }), - }, -}); -``` - -See [the AWS docs here](https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-cross-region.html) -for more information on cross-region CodePipelines. - -### Creating an encrypted replication bucket - -If you're passing a replication bucket created in a different stack, -like this: - -```ts -// Passing a replication bucket created in a different stack. -const app = new App(); -const replicationStack = new Stack(app, 'ReplicationStack', { - env: { - region: 'us-west-1', - }, -}); -const key = new kms.Key(replicationStack, 'ReplicationKey'); -const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { - // like was said above - replication buckets need a set physical name - bucketName: PhysicalName.GENERATE_IF_NEEDED, - encryptionKey: key, // does not work! -}); - -// later... -new codepipeline.Pipeline(replicationStack, 'Pipeline', { - crossRegionReplicationBuckets: { - 'us-west-1': replicationBucket, - }, -}); -``` - -When trying to encrypt it -(and note that if any of the cross-region actions happen to be cross-account as well, -the bucket *has to* be encrypted - otherwise the pipeline will fail at runtime), -you cannot use a key directly - KMS keys don't have physical names, -and so you can't reference them across environments. - -In this case, you need to use an alias in place of the key when creating the bucket: - -```ts -// Passing an encrypted replication bucket created in a different stack. -const app = new App(); -const replicationStack = new Stack(app, 'ReplicationStack', { - env: { - region: 'us-west-1', - }, -}); -const key = new kms.Key(replicationStack, 'ReplicationKey'); -const alias = new kms.Alias(replicationStack, 'ReplicationAlias', { - // aliasName is required - aliasName: PhysicalName.GENERATE_IF_NEEDED, - targetKey: key, -}); -const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { - bucketName: PhysicalName.GENERATE_IF_NEEDED, - encryptionKey: alias, -}); -``` - -## Variables - -The library supports the CodePipeline Variables feature. -Each action class that emits variables has a separate variables interface, -accessed as a property of the action instance called `variables`. -You instantiate the action class and assign it to a local variable; -when you want to use a variable in the configuration of a different action, -you access the appropriate property of the interface returned from `variables`, -which represents a single variable. -Example: - -```ts fixture=action -// MyAction is some action type that produces variables, like EcrSourceAction -const myAction = new MyAction({ - // ... - actionName: 'myAction', -}); -new OtherAction({ - // ... - config: myAction.variables.myVariable, - actionName: 'otherAction', -}); -``` - -The namespace name that will be used will be automatically generated by the pipeline construct, -based on the stage and action name; -you can pass a custom name when creating the action instance: - -```ts fixture=action -// MyAction is some action type that produces variables, like EcrSourceAction -const myAction = new MyAction({ - // ... - variablesNamespace: 'MyNamespace', - actionName: 'myAction', -}); -``` - -There are also global variables available, -not tied to any action; -these are accessed through static properties of the `GlobalVariables` class: - -```ts fixture=action -// OtherAction is some action type that produces variables, like EcrSourceAction -new OtherAction({ - // ... - config: codepipeline.GlobalVariables.executionId, - actionName: 'otherAction', -}); -``` - -Check the documentation of the `@aws-cdk/aws-codepipeline-actions` -for details on how to use the variables for each action class. - -See the [CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html) -for more details on how to use the variables feature. - -## Events - -### Using a pipeline as an event target - -A pipeline can be used as a target for a CloudWatch event rule: - -```ts -// A pipeline being used as a target for a CloudWatch event rule. -import * as targets from '@aws-cdk/aws-events-targets'; -import * as events from '@aws-cdk/aws-events'; - -// kick off the pipeline every day -const rule = new events.Rule(this, 'Daily', { - schedule: events.Schedule.rate(Duration.days(1)), -}); - -declare const pipeline: codepipeline.Pipeline; -rule.addTarget(new targets.CodePipeline(pipeline)); -``` - -When a pipeline is used as an event target, the -"codepipeline:StartPipelineExecution" permission is granted to the AWS -CloudWatch Events service. - -### Event sources - -Pipelines emit CloudWatch events. To define event rules for events emitted by -the pipeline, stages or action, use the `onXxx` methods on the respective -construct: - -```ts -// Define event rules for events emitted by the pipeline -import * as events from '@aws-cdk/aws-events'; - -declare const myPipeline: codepipeline.Pipeline; -declare const myStage: codepipeline.IStage; -declare const myAction: codepipeline.Action; -declare const target: events.IRuleTarget; -myPipeline.onStateChange('MyPipelineStateChange', { target: target } ); -myStage.onStateChange('MyStageStateChange', target); -myAction.onStateChange('MyActionStateChange', target); -``` - -## CodeStar Notifications - -To define CodeStar Notification rules for Pipelines, use one of the `notifyOnXxx()` methods. -They are very similar to `onXxx()` methods for CloudWatch events: - -```ts -// Define CodeStar Notification rules for Pipelines -import * as chatbot from '@aws-cdk/aws-chatbot'; -const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { - slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', - slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', - slackChannelId: 'YOUR_SLACK_CHANNEL_ID', -}); - -declare const pipeline: codepipeline.Pipeline; -const rule = pipeline.notifyOnExecutionStateChange('NotifyOnExecutionStateChange', target); -``` diff --git a/packages/@aws-cdk/aws-codepipeline/jest.config.js b/packages/@aws-cdk/aws-codepipeline/jest.config.js deleted file mode 100644 index 6a8dc8ed67646..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - statements: 75, - branches: 65, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-codepipeline/lib/action.ts b/packages/@aws-cdk/aws-codepipeline/lib/action.ts deleted file mode 100644 index 7ef3d5635ceeb..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/lib/action.ts +++ /dev/null @@ -1,562 +0,0 @@ -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { IResource, Lazy } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { Artifact } from './artifact'; - -export enum ActionCategory { - SOURCE = 'Source', - BUILD = 'Build', - TEST = 'Test', - APPROVAL = 'Approval', - DEPLOY = 'Deploy', - INVOKE = 'Invoke' -} - -/** - * Specifies the constraints on the number of input and output - * artifacts an action can have. - * - * The constraints for each action type are documented on the - * [Pipeline Structure Reference](https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html) page. - */ -export interface ActionArtifactBounds { - readonly minInputs: number; - readonly maxInputs: number; - readonly minOutputs: number; - readonly maxOutputs: number; -} - -/** - * The CodePipeline variables that are global, - * not bound to a specific action. - * This class defines a bunch of static fields that represent the different variables. - * These can be used can be used in any action configuration. - */ -export class GlobalVariables { - /** The identifier of the current pipeline execution. */ - public static readonly executionId = '#{codepipeline.PipelineExecutionId}'; -} - -export interface ActionProperties { - readonly actionName: string; - readonly role?: iam.IRole; - - /** - * The AWS region the given Action resides in. - * Note that a cross-region Pipeline requires replication buckets to function correctly. - * You can provide their names with the `PipelineProps#crossRegionReplicationBuckets` property. - * If you don't, the CodePipeline Construct will create new Stacks in your CDK app containing those buckets, - * that you will need to `cdk deploy` before deploying the main, Pipeline-containing Stack. - * - * @default the Action resides in the same region as the Pipeline - */ - readonly region?: string; - - /** - * The account the Action is supposed to live in. - * For Actions backed by resources, - * this is inferred from the Stack `resource` is part of. - * However, some Actions, like the CloudFormation ones, - * are not backed by any resource, and they still might want to be cross-account. - * In general, a concrete Action class should specify either `resource`, - * or `account` - but not both. - */ - readonly account?: string; - - /** - * The optional resource that is backing this Action. - * This is used for automatically handling Actions backed by - * resources from a different account and/or region. - */ - readonly resource?: IResource; - - /** - * The category of the action. - * The category defines which action type the owner - * (the entity that performs the action) performs. - */ - readonly category: ActionCategory; - - /** - * The service provider that the action calls. - */ - readonly provider: string; - readonly owner?: string; - readonly version?: string; - - /** - * The order in which AWS CodePipeline runs this action. - * For more information, see the AWS CodePipeline User Guide. - * - * https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements - */ - readonly runOrder?: number; - readonly artifactBounds: ActionArtifactBounds; - readonly inputs?: Artifact[]; - readonly outputs?: Artifact[]; - - /** - * The name of the namespace to use for variables emitted by this action. - * - * @default - a name will be generated, based on the stage and action names - */ - readonly variablesNamespace?: string; -} - -export interface ActionBindOptions { - readonly role: iam.IRole; - - readonly bucket: s3.IBucket; -} - -export interface ActionConfig { - readonly configuration?: any; -} - -/** - * Additional options to pass to the notification rule. - */ -export interface PipelineNotifyOnOptions extends notifications.NotificationRuleOptions { - /** - * A list of event types associated with this notification rule for CodePipeline Pipeline. - * For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide. - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api - */ - readonly events: PipelineNotificationEvents[]; -} - -/** - * A Pipeline Action. - * If you want to implement this interface, - * consider extending the `Action` class, - * which contains some common logic. - */ -export interface IAction { - /** - * The simple properties of the Action, - * like its Owner, name, etc. - * Note that this accessor will be called before the `bind` callback. - */ - readonly actionProperties: ActionProperties; - - /** - * The callback invoked when this Action is added to a Pipeline. - * - * @param scope the Construct tree scope the Action can use if it needs to create any resources - * @param stage the `IStage` this Action is being added to - * @param options additional options the Action can use, - * like the artifact Bucket of the pipeline it's being added to - */ - bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig; - - /** - * Creates an Event that will be triggered whenever the state of this Action changes. - * - * @param name the name to use for the new Event - * @param target the optional target for the Event - * @param options additional options that can be used to customize the created Event - */ - onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule; -} - -/** - * The abstract view of an AWS CodePipeline as required and used by Actions. - * It extends `events.IRuleTarget`, - * so this interface can be used as a Target for CloudWatch Events. - */ -export interface IPipeline extends IResource, notifications.INotificationRuleSource { - /** - * The name of the Pipeline. - * - * @attribute - */ - readonly pipelineName: string; - - /** - * The ARN of the Pipeline. - * - * @attribute - */ - readonly pipelineArn: string; - - /** - * Define an event rule triggered by this CodePipeline. - * - * @param id Identifier for this event handler. - * @param options Additional options to pass to the event rule. - */ - onEvent(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Define an event rule triggered by the "CodePipeline Pipeline Execution - * State Change" event emitted from this pipeline. - * - * @param id Identifier for this event handler. - * @param options Additional options to pass to the event rule. - */ - onStateChange(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a CodeStar notification rule triggered when the pipeline - * events emitted by you specified, it very similar to `onEvent` API. - * - * You can also use the methods `notifyOnExecutionStateChange`, `notifyOnAnyStageStateChange`, - * `notifyOnAnyActionStateChange` and `notifyOnAnyManualApprovalStateChange` - * to define rules for these specific event emitted. - * - * @param id The id of the CodeStar notification rule - * @param target The target to register for the CodeStar Notifications destination. - * @param options Customization options for CodeStar notification rule - * @returns CodeStar notification rule associated with this build project. - */ - notifyOn( - id: string, - target: notifications.INotificationRuleTarget, - options: PipelineNotifyOnOptions, - ): notifications.INotificationRule; - - /** - * Define an notification rule triggered by the set of the "Pipeline execution" events emitted from this pipeline. - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline - * - * @param id Identifier for this notification handler. - * @param target The target to register for the CodeStar Notifications destination. - * @param options Additional options to pass to the notification rule. - */ - notifyOnExecutionStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Define an notification rule triggered by the set of the "Stage execution" events emitted from this pipeline. - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline - * - * @param id Identifier for this notification handler. - * @param target The target to register for the CodeStar Notifications destination. - * @param options Additional options to pass to the notification rule. - */ - notifyOnAnyStageStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Define an notification rule triggered by the set of the "Action execution" events emitted from this pipeline. - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline - * - * @param id Identifier for this notification handler. - * @param target The target to register for the CodeStar Notifications destination. - * @param options Additional options to pass to the notification rule. - */ - notifyOnAnyActionStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; - - /** - * Define an notification rule triggered by the set of the "Manual approval" events emitted from this pipeline. - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline - * - * @param id Identifier for this notification handler. - * @param target The target to register for the CodeStar Notifications destination. - * @param options Additional options to pass to the notification rule. - */ - notifyOnAnyManualApprovalStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule; -} - -/** - * The abstract interface of a Pipeline Stage that is used by Actions. - */ -export interface IStage { - /** - * The physical, human-readable name of this Pipeline Stage. - */ - readonly stageName: string; - - readonly pipeline: IPipeline; - - /** - * The actions belonging to this stage. - */ - readonly actions: IAction[]; - - addAction(action: IAction): void; - - onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule; -} - -/** - * Common properties shared by all Actions. - */ -export interface CommonActionProps { - /** - * The physical, human-readable name of the Action. - * Note that Action names must be unique within a single Stage. - */ - readonly actionName: string; - - /** - * The runOrder property for this Action. - * RunOrder determines the relative order in which multiple Actions in the same Stage execute. - * - * @default 1 - * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html - */ - readonly runOrder?: number; - - /** - * The name of the namespace to use for variables emitted by this action. - * - * @default - a name will be generated, based on the stage and action names, - * if any of the action's variables were referenced - otherwise, - * no namespace will be set - */ - readonly variablesNamespace?: string; -} - -/** - * Common properties shared by all Actions whose `ActionProperties.owner` field is 'AWS' - * (or unset, as 'AWS' is the default). - */ -export interface CommonAwsActionProps extends CommonActionProps { - /** - * The Role in which context's this Action will be executing in. - * The Pipeline's Role will assume this Role - * (the required permissions for that will be granted automatically) - * right before executing this Action. - * This Action will be passed into your `IAction.bind` - * method in the `ActionBindOptions.role` property. - * - * @default a new Role will be generated - */ - readonly role?: iam.IRole; -} - -/** - * Low-level class for generic CodePipeline Actions implementing the `IAction` interface. - * Contains some common logic that can be re-used by all `IAction` implementations. - * If you're writing your own Action class, - * feel free to extend this class. - */ -export abstract class Action implements IAction { - /** - * This is a renamed version of the `IAction.actionProperties` property. - */ - protected abstract readonly providedActionProperties: ActionProperties; - - private __actionProperties?: ActionProperties; - private __pipeline?: IPipeline; - private __stage?: IStage; - private __scope?: Construct; - private readonly _namespaceToken: string; - private _customerProvidedNamespace?: string; - private _actualNamespace?: string; - - private _variableReferenced = false; - - protected constructor() { - this._namespaceToken = Lazy.string({ - produce: () => { - // make sure the action was bound (= added to a pipeline) - if (this._actualNamespace === undefined) { - throw new Error(`Cannot reference variables of action '${this.actionProperties.actionName}', ` + - 'as that action was never added to a pipeline'); - } else { - return this._customerProvidedNamespace !== undefined - // if a customer passed a namespace explicitly, always use that - ? this._customerProvidedNamespace - // otherwise, only return a namespace if any variable was referenced - : (this._variableReferenced ? this._actualNamespace : undefined); - } - }, - }); - } - - public get actionProperties(): ActionProperties { - if (this.__actionProperties === undefined) { - const actionProperties = this.providedActionProperties; - this._customerProvidedNamespace = actionProperties.variablesNamespace; - this.__actionProperties = { - ...actionProperties, - variablesNamespace: this._customerProvidedNamespace === undefined - ? this._namespaceToken - : this._customerProvidedNamespace, - }; - } - return this.__actionProperties; - } - - public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig { - this.__pipeline = stage.pipeline; - this.__stage = stage; - this.__scope = scope; - - this._actualNamespace = this._customerProvidedNamespace === undefined - // default a namespace name, based on the stage and action names - ? `${stage.stageName}_${this.actionProperties.actionName}_NS` - : this._customerProvidedNamespace; - - return this.bound(scope, stage, options); - } - - public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps) { - const rule = new events.Rule(this._scope, name, options); - rule.addTarget(target); - rule.addEventPattern({ - detailType: ['CodePipeline Action Execution State Change'], - source: ['aws.codepipeline'], - resources: [this._pipeline.pipelineArn], - detail: { - stage: [this._stage.stageName], - action: [this.actionProperties.actionName], - }, - }); - return rule; - } - - protected variableExpression(variableName: string): string { - this._variableReferenced = true; - return `#{${this._namespaceToken}.${variableName}}`; - } - - /** - * This is a renamed version of the `IAction.bind` method. - */ - protected abstract bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig; - - private get _pipeline(): IPipeline { - if (this.__pipeline) { - return this.__pipeline; - } else { - throw new Error('Action must be added to a stage that is part of a pipeline before using onStateChange'); - } - } - - private get _stage(): IStage { - if (this.__stage) { - return this.__stage; - } else { - throw new Error('Action must be added to a stage that is part of a pipeline before using onStateChange'); - } - } - - /** - * Retrieves the Construct scope of this Action. - * Only available after the Action has been added to a Stage, - * and that Stage to a Pipeline. - */ - private get _scope(): Construct { - if (this.__scope) { - return this.__scope; - } else { - throw new Error('Action must be added to a stage that is part of a pipeline first'); - } - } -} - -/** - * The list of event types for AWS Codepipeline Pipeline - * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline - */ -export enum PipelineNotificationEvents { - /** - * Trigger notification when pipeline execution failed - */ - PIPELINE_EXECUTION_FAILED = 'codepipeline-pipeline-pipeline-execution-failed', - - /** - * Trigger notification when pipeline execution canceled - */ - PIPELINE_EXECUTION_CANCELED = 'codepipeline-pipeline-pipeline-execution-canceled', - - /** - * Trigger notification when pipeline execution started - */ - PIPELINE_EXECUTION_STARTED = 'codepipeline-pipeline-pipeline-execution-started', - - /** - * Trigger notification when pipeline execution resumed - */ - PIPELINE_EXECUTION_RESUMED = 'codepipeline-pipeline-pipeline-execution-resumed', - - /** - * Trigger notification when pipeline execution succeeded - */ - PIPELINE_EXECUTION_SUCCEEDED = 'codepipeline-pipeline-pipeline-execution-succeeded', - - /** - * Trigger notification when pipeline execution superseded - */ - PIPELINE_EXECUTION_SUPERSEDED = 'codepipeline-pipeline-pipeline-execution-superseded', - - /** - * Trigger notification when pipeline stage execution started - */ - STAGE_EXECUTION_STARTED = 'codepipeline-pipeline-stage-execution-started', - - /** - * Trigger notification when pipeline stage execution succeeded - */ - STAGE_EXECUTION_SUCCEEDED = 'codepipeline-pipeline-stage-execution-succeeded', - - /** - * Trigger notification when pipeline stage execution resumed - */ - STAGE_EXECUTION_RESUMED = 'codepipeline-pipeline-stage-execution-resumed', - - /** - * Trigger notification when pipeline stage execution canceled - */ - STAGE_EXECUTION_CANCELED = 'codepipeline-pipeline-stage-execution-canceled', - - /** - * Trigger notification when pipeline stage execution failed - */ - STAGE_EXECUTION_FAILED = 'codepipeline-pipeline-stage-execution-failed', - - /** - * Trigger notification when pipeline action execution succeeded - */ - ACTION_EXECUTION_SUCCEEDED = 'codepipeline-pipeline-action-execution-succeeded', - - /** - * Trigger notification when pipeline action execution failed - */ - ACTION_EXECUTION_FAILED = 'codepipeline-pipeline-action-execution-failed', - - /** - * Trigger notification when pipeline action execution canceled - */ - ACTION_EXECUTION_CANCELED = 'codepipeline-pipeline-action-execution-canceled', - - /** - * Trigger notification when pipeline action execution started - */ - ACTION_EXECUTION_STARTED = 'codepipeline-pipeline-action-execution-started', - - /** - * Trigger notification when pipeline manual approval failed - */ - MANUAL_APPROVAL_FAILED = 'codepipeline-pipeline-manual-approval-failed', - - /** - * Trigger notification when pipeline manual approval needed - */ - MANUAL_APPROVAL_NEEDED = 'codepipeline-pipeline-manual-approval-needed', - - /** - * Trigger notification when pipeline manual approval succeeded - */ - MANUAL_APPROVAL_SUCCEEDED = 'codepipeline-pipeline-manual-approval-succeeded', -} diff --git a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts b/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts deleted file mode 100644 index 11d3173baea7d..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/lib/pipeline.ts +++ /dev/null @@ -1,1160 +0,0 @@ -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import { - ArnFormat, - BootstraplessSynthesizer, - DefaultStackSynthesizer, - FeatureFlags, - IStackSynthesizer, - Lazy, - Names, - PhysicalName, - RemovalPolicy, - Resource, - Stack, - Stage as CdkStage, - Token, -} from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { ActionCategory, IAction, IPipeline, IStage, PipelineNotificationEvents, PipelineNotifyOnOptions } from './action'; -import { CfnPipeline } from './codepipeline.generated'; -import { CrossRegionSupportConstruct, CrossRegionSupportStack } from './private/cross-region-support-stack'; -import { FullActionDescriptor } from './private/full-action-descriptor'; -import { RichAction } from './private/rich-action'; -import { Stage } from './private/stage'; -import { validateName, validateNamespaceName, validateSourceAction } from './private/validation'; - -/** - * Allows you to control where to place a new Stage when it's added to the Pipeline. - * Note that you can provide only one of the below properties - - * specifying more than one will result in a validation error. - * - * @see #rightBefore - * @see #justAfter - */ -export interface StagePlacement { - /** - * Inserts the new Stage as a parent of the given Stage - * (changing its current parent Stage, if it had one). - */ - readonly rightBefore?: IStage; - - /** - * Inserts the new Stage as a child of the given Stage - * (changing its current child Stage, if it had one). - */ - readonly justAfter?: IStage; -} - -/** - * Construction properties of a Pipeline Stage. - */ -export interface StageProps { - /** - * The physical, human-readable name to assign to this Pipeline Stage. - */ - readonly stageName: string; - - /** - * The list of Actions to create this Stage with. - * You can always add more Actions later by calling `IStage#addAction`. - */ - readonly actions?: IAction[]; - - /** - * Whether to enable transition to this stage. - * - * @default true - */ - readonly transitionToEnabled?: boolean; - - /** - * The reason for disabling transition to this stage. Only applicable - * if `transitionToEnabled` is set to `false`. - * - * @default 'Transition disabled' - */ - readonly transitionDisabledReason?: string; -} - -export interface StageOptions extends StageProps { - readonly placement?: StagePlacement; -} - -export interface PipelineProps { - /** - * The S3 bucket used by this Pipeline to store artifacts. - * - * @default - A new S3 bucket will be created. - */ - readonly artifactBucket?: s3.IBucket; - - /** - * The IAM role to be assumed by this Pipeline. - * - * @default a new IAM role will be created. - */ - readonly role?: iam.IRole; - - /** - * Indicates whether to rerun the AWS CodePipeline pipeline after you update it. - * - * @default false - */ - readonly restartExecutionOnUpdate?: boolean; - - /** - * Name of the pipeline. - * - * @default - AWS CloudFormation generates an ID and uses that for the pipeline name. - */ - readonly pipelineName?: string; - - /** - * A map of region to S3 bucket name used for cross-region CodePipeline. - * For every Action that you specify targeting a different region than the Pipeline itself, - * if you don't provide an explicit Bucket for that region using this property, - * the construct will automatically create a Stack containing an S3 Bucket in that region. - * - * @default - None. - */ - readonly crossRegionReplicationBuckets?: { [region: string]: s3.IBucket }; - - /** - * The list of Stages, in order, - * to create this Pipeline with. - * You can always add more Stages later by calling `Pipeline#addStage`. - * - * @default - None. - */ - readonly stages?: StageProps[]; - - /** - * Create KMS keys for cross-account deployments. - * - * This controls whether the pipeline is enabled for cross-account deployments. - * - * By default cross-account deployments are enabled, but this feature requires - * that KMS Customer Master Keys are created which have a cost of $1/month. - * - * If you do not need cross-account deployments, you can set this to `false` to - * not create those keys and save on that cost (the artifact bucket will be - * encrypted with an AWS-managed key). However, cross-account deployments will - * no longer be possible. - * - * @default true - */ - readonly crossAccountKeys?: boolean; - - /** - * Enable KMS key rotation for the generated KMS keys. - * - * By default KMS key rotation is disabled, but will add an additional $1/month - * for each year the key exists when enabled. - * - * @default - false (key rotation is disabled) - */ - readonly enableKeyRotation?: boolean; - - /** - * Reuse the same cross region support stack for all pipelines in the App. - * - * @default - true (Use the same support stack for all pipelines in App) - */ - readonly reuseCrossRegionSupportStacks?: boolean; -} - -abstract class PipelineBase extends Resource implements IPipeline { - public abstract readonly pipelineName: string; - public abstract readonly pipelineArn: string; - - /** - * Defines an event rule triggered by this CodePipeline. - * - * @param id Identifier for this event handler. - * @param options Additional options to pass to the event rule. - */ - public onEvent(id: string, options: events.OnEventOptions = {}): events.Rule { - const rule = new events.Rule(this, id, options); - rule.addTarget(options.target); - rule.addEventPattern({ - source: ['aws.codepipeline'], - resources: [this.pipelineArn], - }); - return rule; - } - - /** - * Defines an event rule triggered by the "CodePipeline Pipeline Execution - * State Change" event emitted from this pipeline. - * - * @param id Identifier for this event handler. - * @param options Additional options to pass to the event rule. - */ - public onStateChange(id: string, options: events.OnEventOptions = {}): events.Rule { - const rule = this.onEvent(id, options); - rule.addEventPattern({ - detailType: ['CodePipeline Pipeline Execution State Change'], - }); - return rule; - } - - public bindAsNotificationRuleSource(_scope: Construct): notifications.NotificationRuleSourceConfig { - return { - sourceArn: this.pipelineArn, - }; - } - - public notifyOn( - id: string, - target: notifications.INotificationRuleTarget, - options: PipelineNotifyOnOptions, - ): notifications.INotificationRule { - return new notifications.NotificationRule(this, id, { - ...options, - source: this, - targets: [target], - }); - } - - public notifyOnExecutionStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [ - PipelineNotificationEvents.PIPELINE_EXECUTION_FAILED, - PipelineNotificationEvents.PIPELINE_EXECUTION_CANCELED, - PipelineNotificationEvents.PIPELINE_EXECUTION_STARTED, - PipelineNotificationEvents.PIPELINE_EXECUTION_RESUMED, - PipelineNotificationEvents.PIPELINE_EXECUTION_SUCCEEDED, - PipelineNotificationEvents.PIPELINE_EXECUTION_SUPERSEDED, - ], - }); - } - - public notifyOnAnyStageStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [ - PipelineNotificationEvents.STAGE_EXECUTION_CANCELED, - PipelineNotificationEvents.STAGE_EXECUTION_FAILED, - PipelineNotificationEvents.STAGE_EXECUTION_RESUMED, - PipelineNotificationEvents.STAGE_EXECUTION_STARTED, - PipelineNotificationEvents.STAGE_EXECUTION_SUCCEEDED, - ], - }); - } - - public notifyOnAnyActionStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [ - PipelineNotificationEvents.ACTION_EXECUTION_CANCELED, - PipelineNotificationEvents.ACTION_EXECUTION_FAILED, - PipelineNotificationEvents.ACTION_EXECUTION_STARTED, - PipelineNotificationEvents.ACTION_EXECUTION_SUCCEEDED, - ], - }); - } - - public notifyOnAnyManualApprovalStateChange( - id: string, - target: notifications.INotificationRuleTarget, - options?: notifications.NotificationRuleOptions, - ): notifications.INotificationRule { - return this.notifyOn(id, target, { - ...options, - events: [ - PipelineNotificationEvents.MANUAL_APPROVAL_FAILED, - PipelineNotificationEvents.MANUAL_APPROVAL_NEEDED, - PipelineNotificationEvents.MANUAL_APPROVAL_SUCCEEDED, - ], - }); - } -} - -/** - * An AWS CodePipeline pipeline with its associated IAM role and S3 bucket. - * - * @example - * // create a pipeline - * import * as codecommit from '@aws-cdk/aws-codecommit'; - * - * const pipeline = new codepipeline.Pipeline(this, 'Pipeline'); - * - * // add a stage - * const sourceStage = pipeline.addStage({ stageName: 'Source' }); - * - * // add a source action to the stage - * declare const repo: codecommit.Repository; - * declare const sourceArtifact: codepipeline.Artifact; - * sourceStage.addAction(new codepipeline_actions.CodeCommitSourceAction({ - * actionName: 'Source', - * output: sourceArtifact, - * repository: repo, - * })); - * - * // ... add more stages - */ -export class Pipeline extends PipelineBase { - /** - * Import a pipeline into this app. - * - * @param scope the scope into which to import this pipeline - * @param id the logical ID of the returned pipeline construct - * @param pipelineArn The ARN of the pipeline (e.g. `arn:aws:codepipeline:us-east-1:123456789012:MyDemoPipeline`) - */ - public static fromPipelineArn(scope: Construct, id: string, pipelineArn: string): IPipeline { - class Import extends PipelineBase { - public readonly pipelineName = Stack.of(scope).splitArn(pipelineArn, ArnFormat.SLASH_RESOURCE_NAME).resource; - public readonly pipelineArn = pipelineArn; - } - - return new Import(scope, id); - } - - /** - * The IAM role AWS CodePipeline will use to perform actions or assume roles for actions with - * a more specific IAM role. - */ - public readonly role: iam.IRole; - - /** - * ARN of this pipeline - */ - public readonly pipelineArn: string; - - /** - * The name of the pipeline - */ - public readonly pipelineName: string; - - /** - * The version of the pipeline - * - * @attribute - */ - public readonly pipelineVersion: string; - - /** - * Bucket used to store output artifacts - */ - public readonly artifactBucket: s3.IBucket; - - private readonly _stages = new Array(); - private readonly crossRegionBucketsPassed: boolean; - private readonly _crossRegionSupport: { [region: string]: CrossRegionSupport } = {}; - private readonly _crossAccountSupport: { [account: string]: Stack } = {}; - private readonly crossAccountKeys: boolean; - private readonly enableKeyRotation?: boolean; - private readonly reuseCrossRegionSupportStacks: boolean; - private readonly codePipeline: CfnPipeline; - - constructor(scope: Construct, id: string, props: PipelineProps = {}) { - super(scope, id, { - physicalName: props.pipelineName, - }); - - validateName('Pipeline', this.physicalName); - - // only one of artifactBucket and crossRegionReplicationBuckets can be supplied - if (props.artifactBucket && props.crossRegionReplicationBuckets) { - throw new Error('Only one of artifactBucket and crossRegionReplicationBuckets can be specified!'); - } - - // @deprecated(v2): switch to default false - this.crossAccountKeys = props.crossAccountKeys ?? true; - this.enableKeyRotation = props.enableKeyRotation; - - // Cross account keys must be set for key rotation to be enabled - if (this.enableKeyRotation && !this.crossAccountKeys) { - throw new Error("Setting 'enableKeyRotation' to true also requires 'crossAccountKeys' to be enabled"); - } - - this.reuseCrossRegionSupportStacks = props.reuseCrossRegionSupportStacks ?? true; - - // If a bucket has been provided, use it - otherwise, create a bucket. - let propsBucket = this.getArtifactBucketFromProps(props); - - if (!propsBucket) { - let encryptionKey; - - if (this.crossAccountKeys) { - encryptionKey = new kms.Key(this, 'ArtifactsBucketEncryptionKey', { - // remove the key - there is a grace period of a few days before it's gone for good, - // that should be enough for any emergency access to the bucket artifacts - removalPolicy: RemovalPolicy.DESTROY, - enableKeyRotation: this.enableKeyRotation, - }); - // add an alias to make finding the key in the console easier - new kms.Alias(this, 'ArtifactsBucketEncryptionKeyAlias', { - aliasName: this.generateNameForDefaultBucketKeyAlias(), - targetKey: encryptionKey, - removalPolicy: RemovalPolicy.DESTROY, // destroy the alias along with the key - }); - } - - propsBucket = new s3.Bucket(this, 'ArtifactsBucket', { - bucketName: PhysicalName.GENERATE_IF_NEEDED, - encryptionKey, - encryption: encryptionKey ? s3.BucketEncryption.KMS : s3.BucketEncryption.KMS_MANAGED, - enforceSSL: true, - blockPublicAccess: new s3.BlockPublicAccess(s3.BlockPublicAccess.BLOCK_ALL), - removalPolicy: RemovalPolicy.RETAIN, - }); - } - this.artifactBucket = propsBucket; - - // If a role has been provided, use it - otherwise, create a role. - this.role = props.role || new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('codepipeline.amazonaws.com'), - }); - - this.codePipeline = new CfnPipeline(this, 'Resource', { - artifactStore: Lazy.any({ produce: () => this.renderArtifactStoreProperty() }), - artifactStores: Lazy.any({ produce: () => this.renderArtifactStoresProperty() }), - stages: Lazy.any({ produce: () => this.renderStages() }), - disableInboundStageTransitions: Lazy.any({ produce: () => this.renderDisabledTransitions() }, { omitEmptyArray: true }), - roleArn: this.role.roleArn, - restartExecutionOnUpdate: props && props.restartExecutionOnUpdate, - name: this.physicalName, - }); - - // this will produce a DependsOn for both the role and the policy resources. - this.codePipeline.node.addDependency(this.role); - - this.artifactBucket.grantReadWrite(this.role); - this.pipelineName = this.getResourceNameAttribute(this.codePipeline.ref); - this.pipelineVersion = this.codePipeline.attrVersion; - this.crossRegionBucketsPassed = !!props.crossRegionReplicationBuckets; - - for (const [region, replicationBucket] of Object.entries(props.crossRegionReplicationBuckets || {})) { - this._crossRegionSupport[region] = { - replicationBucket, - stack: Stack.of(replicationBucket), - }; - } - - // Does not expose a Fn::GetAtt for the ARN so we'll have to make it ourselves - this.pipelineArn = Stack.of(this).formatArn({ - service: 'codepipeline', - resource: this.pipelineName, - }); - - for (const stage of props.stages || []) { - this.addStage(stage); - } - - this.node.addValidation({ validate: () => this.validatePipeline() }); - } - - /** - * Creates a new Stage, and adds it to this Pipeline. - * - * @param props the creation properties of the new Stage - * @returns the newly created Stage - */ - public addStage(props: StageOptions): IStage { - // check for duplicate Stages and names - if (this._stages.find(s => s.stageName === props.stageName)) { - throw new Error(`Stage with duplicate name '${props.stageName}' added to the Pipeline`); - } - - const stage = new Stage(props, this); - - const index = props.placement - ? this.calculateInsertIndexFromPlacement(props.placement) - : this.stageCount; - - this._stages.splice(index, 0, stage); - - return stage; - } - - /** - * Adds a statement to the pipeline role. - */ - public addToRolePolicy(statement: iam.PolicyStatement) { - this.role.addToPrincipalPolicy(statement); - } - - /** - * Get the number of Stages in this Pipeline. - */ - public get stageCount(): number { - return this._stages.length; - } - - /** - * Returns the stages that comprise the pipeline. - * - * **Note**: the returned array is a defensive copy, - * so adding elements to it has no effect. - * Instead, use the `addStage` method if you want to add more stages - * to the pipeline. - */ - public get stages(): IStage[] { - return this._stages.slice(); - } - - /** - * Access one of the pipeline's stages by stage name - */ - public stage(stageName: string): IStage { - for (const stage of this._stages) { - if (stage.stageName === stageName) { - return stage; - } - } - throw new Error(`Pipeline does not contain a stage named '${stageName}'. Available stages: ${this._stages.map(s => s.stageName).join(', ')}`); - } - - /** - * Returns all of the `CrossRegionSupportStack`s that were generated automatically - * when dealing with Actions that reside in a different region than the Pipeline itself. - * - */ - public get crossRegionSupport(): { [region: string]: CrossRegionSupport } { - const ret: { [region: string]: CrossRegionSupport } = {}; - Object.keys(this._crossRegionSupport).forEach((key) => { - ret[key] = this._crossRegionSupport[key]; - }); - return ret; - } - - /** @internal */ - public _attachActionToPipeline(stage: Stage, action: IAction, actionScope: Construct): FullActionDescriptor { - const richAction = new RichAction(action, this); - - // handle cross-region actions here - const crossRegionInfo = this.ensureReplicationResourcesExistFor(richAction); - - // get the role for the given action, handling if it's cross-account - const actionRole = this.getRoleForAction(stage, richAction, actionScope); - - // // CodePipeline Variables - validateNamespaceName(richAction.actionProperties.variablesNamespace); - - // bind the Action (type h4x) - const actionConfig = richAction.bind(actionScope, stage, { - role: actionRole ? actionRole : this.role, - bucket: crossRegionInfo.artifactBucket, - }); - - return new FullActionDescriptor({ - // must be 'action', not 'richAction', - // as those are returned by the IStage.actions property, - // and it's important customers of Pipeline get the same instance - // back as they added to the pipeline - action, - actionConfig, - actionRole, - actionRegion: crossRegionInfo.region, - }); - } - - /** - * Validate the pipeline structure - * - * Validation happens according to the rules documented at - * - * https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#pipeline-requirements - */ - private validatePipeline(): string[] { - return [ - ...this.validateSourceActionLocations(), - ...this.validateHasStages(), - ...this.validateStages(), - ...this.validateArtifacts(), - ]; - } - - private ensureReplicationResourcesExistFor(action: RichAction): CrossRegionInfo { - if (!action.isCrossRegion) { - return { - artifactBucket: this.artifactBucket, - }; - } - - // The action has a specific region, - // require the pipeline to have a known region as well. - this.requireRegion(); - - // source actions have to be in the same region as the pipeline - if (action.actionProperties.category === ActionCategory.SOURCE) { - throw new Error(`Source action '${action.actionProperties.actionName}' must be in the same region as the pipeline`); - } - - // check whether we already have a bucket in that region, - // either passed from the outside or previously created - const crossRegionSupport = this.obtainCrossRegionSupportFor(action); - - // the stack containing the replication bucket must be deployed before the pipeline - Stack.of(this).addDependency(crossRegionSupport.stack); - // The Pipeline role must be able to replicate to that bucket - crossRegionSupport.replicationBucket.grantReadWrite(this.role); - - return { - artifactBucket: crossRegionSupport.replicationBucket, - region: action.effectiveRegion, - }; - } - - /** - * Get or create the cross-region support construct for the given action - */ - private obtainCrossRegionSupportFor(action: RichAction) { - // this method is never called for non cross-region actions - const actionRegion = action.effectiveRegion!; - let crossRegionSupport = this._crossRegionSupport[actionRegion]; - if (!crossRegionSupport) { - // we need to create scaffolding resources for this region - const otherStack = action.resourceStack; - crossRegionSupport = this.createSupportResourcesForRegion(otherStack, actionRegion); - this._crossRegionSupport[actionRegion] = crossRegionSupport; - } - return crossRegionSupport; - } - - private createSupportResourcesForRegion(otherStack: Stack | undefined, actionRegion: string): CrossRegionSupport { - // if we have a stack from the resource passed - use that! - if (otherStack) { - // check if the stack doesn't have this magic construct already - const id = `CrossRegionReplicationSupport-d823f1d8-a990-4e5c-be18-4ac698532e65-${actionRegion}`; - let crossRegionSupportConstruct = otherStack.node.tryFindChild(id) as CrossRegionSupportConstruct; - if (!crossRegionSupportConstruct) { - crossRegionSupportConstruct = new CrossRegionSupportConstruct(otherStack, id, { - createKmsKey: this.crossAccountKeys, - enableKeyRotation: this.enableKeyRotation, - }); - } - - return { - replicationBucket: crossRegionSupportConstruct.replicationBucket, - stack: otherStack, - }; - } - - // otherwise - create a stack with the resources needed for replication across regions - const pipelineStack = Stack.of(this); - const pipelineAccount = pipelineStack.account; - if (Token.isUnresolved(pipelineAccount)) { - throw new Error("You need to specify an explicit account when using CodePipeline's cross-region support"); - } - - const app = this.supportScope(); - const supportStackId = `cross-region-stack-${this.reuseCrossRegionSupportStacks ? pipelineAccount : pipelineStack.stackName}:${actionRegion}`; - let supportStack = app.node.tryFindChild(supportStackId) as CrossRegionSupportStack; - if (!supportStack) { - supportStack = new CrossRegionSupportStack(app, supportStackId, { - pipelineStackName: pipelineStack.stackName, - region: actionRegion, - account: pipelineAccount, - synthesizer: this.getCrossRegionSupportSynthesizer(), - createKmsKey: this.crossAccountKeys, - enableKeyRotation: this.enableKeyRotation, - }); - } - - return { - stack: supportStack, - replicationBucket: supportStack.replicationBucket, - }; - } - - private getCrossRegionSupportSynthesizer(): IStackSynthesizer | undefined { - if (this.stack.synthesizer instanceof DefaultStackSynthesizer) { - // if we have the new synthesizer, - // we need a bootstrapless copy of it, - // because we don't want to require bootstrapping the environment - // of the pipeline account in this replication region - return new BootstraplessSynthesizer({ - deployRoleArn: this.stack.synthesizer.deployRoleArn, - cloudFormationExecutionRoleArn: this.stack.synthesizer.cloudFormationExecutionRoleArn, - }); - } else { - // any other synthesizer: just return undefined - // (ie., use the default based on the context settings) - return undefined; - } - } - - private generateNameForDefaultBucketKeyAlias(): string { - const prefix = 'alias/codepipeline-'; - const maxAliasLength = 256; - const maxResourceNameLength = maxAliasLength - prefix.length; - // Names.uniqueId() may have naming collisions when the IDs of resources are similar - // and/or when they are too long and sliced. We do not want to update this and - // automatically change the name of every KMS key already generated so we are putting - // this under a feature flag. - const uniqueId = FeatureFlags.of(this).isEnabled(cxapi.CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME) ? - Names.uniqueResourceName(this, { - separator: '-', - maxLength: maxResourceNameLength, - allowedSpecialCharacters: '/_-', - }) : - Names.uniqueId(this).slice(-maxResourceNameLength); - return prefix + uniqueId.toLowerCase(); - } - - /** - * Gets the role used for this action, - * including handling the case when the action is supposed to be cross-account. - * - * @param stage the stage the action belongs to - * @param action the action to return/create a role for - * @param actionScope the scope, unique to the action, to create new resources in - */ - private getRoleForAction(stage: Stage, action: RichAction, actionScope: Construct): iam.IRole | undefined { - const pipelineStack = Stack.of(this); - - let actionRole = this.getRoleFromActionPropsOrGenerateIfCrossAccount(stage, action); - - if (!actionRole && this.isAwsOwned(action)) { - // generate a Role for this specific Action - actionRole = new iam.Role(actionScope, 'CodePipelineActionRole', { - assumedBy: new iam.AccountPrincipal(pipelineStack.account), - }); - } - - // the pipeline role needs assumeRole permissions to the action role - const grant = actionRole?.grantAssumeRole(this.role); - grant?.applyBefore(this.codePipeline); - return actionRole; - } - - private getRoleFromActionPropsOrGenerateIfCrossAccount(stage: Stage, action: RichAction): iam.IRole | undefined { - const pipelineStack = Stack.of(this); - - // if we have a cross-account action, the pipeline's bucket must have a KMS key - // (otherwise we can't configure cross-account trust policies) - if (action.isCrossAccount) { - const artifactBucket = this.ensureReplicationResourcesExistFor(action).artifactBucket; - if (!artifactBucket.encryptionKey) { - throw new Error( - `Artifact Bucket must have a KMS Key to add cross-account action '${action.actionProperties.actionName}' ` + - `(pipeline account: '${renderEnvDimension(this.env.account)}', action account: '${renderEnvDimension(action.effectiveAccount)}'). ` + - 'Create Pipeline with \'crossAccountKeys: true\' (or pass an existing Bucket with a key)', - ); - } - } - - // if a Role has been passed explicitly, always use it - // (even if the backing resource is from a different account - - // this is how the user can override our default support logic) - if (action.actionProperties.role) { - if (this.isAwsOwned(action)) { - // the role has to be deployed before the pipeline - // (our magical cross-stack dependencies will not work, - // because the role might be from a different environment), - // but _only_ if it's a new Role - - // an imported Role should not add the dependency - if (iam.Role.isRole(action.actionProperties.role)) { - const roleStack = Stack.of(action.actionProperties.role); - pipelineStack.addDependency(roleStack); - } - - return action.actionProperties.role; - } else { - // ...except if the Action is not owned by 'AWS', - // as that would be rejected by CodePipeline at deploy time - throw new Error("Specifying a Role is not supported for actions with an owner different than 'AWS' - " + - `got '${action.actionProperties.owner}' (Action: '${action.actionProperties.actionName}' in Stage: '${stage.stageName}')`); - } - } - - // if we don't have a Role passed, - // and the action is cross-account, - // generate a Role in that other account stack - const otherAccountStack = this.getOtherStackIfActionIsCrossAccount(action); - if (!otherAccountStack) { - return undefined; - } - - // generate a role in the other stack, that the Pipeline will assume for executing this action - const ret = new iam.Role(otherAccountStack, - `${Names.uniqueId(this)}-${stage.stageName}-${action.actionProperties.actionName}-ActionRole`, { - assumedBy: new iam.AccountPrincipal(pipelineStack.account), - roleName: PhysicalName.GENERATE_IF_NEEDED, - }); - // the other stack with the role has to be deployed before the pipeline stack - // (CodePipeline verifies you can assume the action Role on creation) - pipelineStack.addDependency(otherAccountStack); - - return ret; - } - - /** - * Returns the Stack this Action belongs to if this is a cross-account Action. - * If this Action is not cross-account (i.e., it lives in the same account as the Pipeline), - * it returns undefined. - * - * @param action the Action to return the Stack for - */ - private getOtherStackIfActionIsCrossAccount(action: IAction): Stack | undefined { - const targetAccount = action.actionProperties.resource - ? action.actionProperties.resource.env.account - : action.actionProperties.account; - - if (targetAccount === undefined) { - // if the account of the Action is not specified, - // then it defaults to the same account the pipeline itself is in - return undefined; - } - - // check whether the action's account is a static string - if (Token.isUnresolved(targetAccount)) { - if (Token.isUnresolved(this.env.account)) { - // the pipeline is also env-agnostic, so that's fine - return undefined; - } else { - throw new Error(`The 'account' property must be a concrete value (action: '${action.actionProperties.actionName}')`); - } - } - - // At this point, we know that the action's account is a static string. - // In this case, the pipeline's account must also be a static string. - if (Token.isUnresolved(this.env.account)) { - throw new Error('Pipeline stack which uses cross-environment actions must have an explicitly set account'); - } - - // at this point, we know that both the Pipeline's account, - // and the action-backing resource's account are static strings - - // if they are identical - nothing to do (the action is not cross-account) - if (this.env.account === targetAccount) { - return undefined; - } - - // at this point, we know that the action is certainly cross-account, - // so we need to return a Stack in its account to create the helper Role in - - const candidateActionResourceStack = action.actionProperties.resource - ? Stack.of(action.actionProperties.resource) - : undefined; - if (candidateActionResourceStack?.account === targetAccount) { - // we always use the "latest" action-backing resource's Stack for this account, - // even if a different one was used earlier - this._crossAccountSupport[targetAccount] = candidateActionResourceStack; - return candidateActionResourceStack; - } - - let targetAccountStack: Stack | undefined = this._crossAccountSupport[targetAccount]; - if (!targetAccountStack) { - const stackId = `cross-account-support-stack-${targetAccount}`; - const app = this.supportScope(); - targetAccountStack = app.node.tryFindChild(stackId) as Stack; - if (!targetAccountStack) { - const actionRegion = action.actionProperties.resource - ? action.actionProperties.resource.env.region - : action.actionProperties.region; - const pipelineStack = Stack.of(this); - targetAccountStack = new Stack(app, stackId, { - stackName: `${pipelineStack.stackName}-support-${targetAccount}`, - env: { - account: targetAccount, - region: actionRegion ?? pipelineStack.region, - }, - }); - } - this._crossAccountSupport[targetAccount] = targetAccountStack; - } - return targetAccountStack; - } - - private isAwsOwned(action: IAction) { - const owner = action.actionProperties.owner; - return !owner || owner === 'AWS'; - } - - private getArtifactBucketFromProps(props: PipelineProps): s3.IBucket | undefined { - if (props.artifactBucket) { - return props.artifactBucket; - } - if (props.crossRegionReplicationBuckets) { - const pipelineRegion = this.requireRegion(); - return props.crossRegionReplicationBuckets[pipelineRegion]; - } - return undefined; - } - - private calculateInsertIndexFromPlacement(placement: StagePlacement): number { - // check if at most one placement property was provided - const providedPlacementProps = ['rightBefore', 'justAfter', 'atIndex'] - .filter((prop) => (placement as any)[prop] !== undefined); - if (providedPlacementProps.length > 1) { - throw new Error('Error adding Stage to the Pipeline: ' + - 'you can only provide at most one placement property, but ' + - `'${providedPlacementProps.join(', ')}' were given`); - } - - if (placement.rightBefore !== undefined) { - const targetIndex = this.findStageIndex(placement.rightBefore); - if (targetIndex === -1) { - throw new Error('Error adding Stage to the Pipeline: ' + - `the requested Stage to add it before, '${placement.rightBefore.stageName}', was not found`); - } - return targetIndex; - } - - if (placement.justAfter !== undefined) { - const targetIndex = this.findStageIndex(placement.justAfter); - if (targetIndex === -1) { - throw new Error('Error adding Stage to the Pipeline: ' + - `the requested Stage to add it after, '${placement.justAfter.stageName}', was not found`); - } - return targetIndex + 1; - } - - return this.stageCount; - } - - private findStageIndex(targetStage: IStage) { - return this._stages.findIndex(stage => stage === targetStage); - } - - private validateSourceActionLocations(): string[] { - const errors = new Array(); - let firstStage = true; - for (const stage of this._stages) { - const onlySourceActionsPermitted = firstStage; - for (const action of stage.actionDescriptors) { - errors.push(...validateSourceAction(onlySourceActionsPermitted, action.category, action.actionName, stage.stageName)); - } - firstStage = false; - } - return errors; - } - - private validateHasStages(): string[] { - if (this.stageCount < 2) { - return ['Pipeline must have at least two stages']; - } - return []; - } - - private validateStages(): string[] { - const ret = new Array(); - for (const stage of this._stages) { - ret.push(...stage.validate()); - } - return ret; - } - - private validateArtifacts(): string[] { - const ret = new Array(); - - const producers: Record = {}; - const firstConsumers: Record = {}; - - for (const [stageIndex, stage] of enumerate(this._stages)) { - // For every output artifact, get the producer - for (const action of stage.actionDescriptors) { - const actionLoc = new PipelineLocation(stageIndex, stage, action); - - for (const outputArtifact of action.outputs) { - // output Artifacts always have a name set - const name = outputArtifact.artifactName!; - if (producers[name]) { - ret.push(`Both Actions '${producers[name].actionName}' and '${action.actionName}' are producting Artifact '${name}'. Every artifact can only be produced once.`); - continue; - } - - producers[name] = actionLoc; - } - - // For every input artifact, get the first consumer - for (const inputArtifact of action.inputs) { - const name = inputArtifact.artifactName; - if (!name) { - ret.push(`Action '${action.actionName}' is using an unnamed input Artifact, which is not being produced in this pipeline`); - continue; - } - - firstConsumers[name] = firstConsumers[name] ? firstConsumers[name].first(actionLoc) : actionLoc; - } - } - } - - // Now validate that every input artifact is produced before it's - // being consumed. - for (const [artifactName, consumerLoc] of Object.entries(firstConsumers)) { - const producerLoc = producers[artifactName]; - if (!producerLoc) { - ret.push(`Action '${consumerLoc.actionName}' is using input Artifact '${artifactName}', which is not being produced in this pipeline`); - continue; - } - - if (consumerLoc.beforeOrEqual(producerLoc)) { - ret.push(`${consumerLoc} is consuming input Artifact '${artifactName}' before it is being produced at ${producerLoc}`); - } - } - - return ret; - } - - private renderArtifactStoresProperty(): CfnPipeline.ArtifactStoreMapProperty[] | undefined { - if (!this.crossRegion) { return undefined; } - - // add the Pipeline's artifact store - const primaryRegion = this.requireRegion(); - this._crossRegionSupport[primaryRegion] = { - replicationBucket: this.artifactBucket, - stack: Stack.of(this), - }; - - return Object.entries(this._crossRegionSupport).map(([region, support]) => ({ - region, - artifactStore: this.renderArtifactStore(support.replicationBucket), - })); - } - - private renderArtifactStoreProperty(): CfnPipeline.ArtifactStoreProperty | undefined { - if (this.crossRegion) { return undefined; } - return this.renderPrimaryArtifactStore(); - } - - private renderPrimaryArtifactStore(): CfnPipeline.ArtifactStoreProperty { - return this.renderArtifactStore(this.artifactBucket); - } - - private renderArtifactStore(bucket: s3.IBucket): CfnPipeline.ArtifactStoreProperty { - let encryptionKey: CfnPipeline.EncryptionKeyProperty | undefined; - const bucketKey = bucket.encryptionKey; - if (bucketKey) { - encryptionKey = { - type: 'KMS', - id: bucketKey.keyArn, - }; - } - - return { - type: 'S3', - location: bucket.bucketName, - encryptionKey, - }; - } - - private get crossRegion(): boolean { - if (this.crossRegionBucketsPassed) { return true; } - return this._stages.some(stage => stage.actionDescriptors.some(action => action.region !== undefined)); - } - - private renderStages(): CfnPipeline.StageDeclarationProperty[] { - return this._stages.map(stage => stage.render()); - } - - private renderDisabledTransitions(): CfnPipeline.StageTransitionProperty[] { - return this._stages - .filter(stage => !stage.transitionToEnabled) - .map(stage => ({ - reason: stage.transitionDisabledReason, - stageName: stage.stageName, - })); - } - - private requireRegion(): string { - const region = this.env.region; - if (Token.isUnresolved(region)) { - throw new Error('Pipeline stack which uses cross-environment actions must have an explicitly set region'); - } - return region; - } - - private supportScope(): CdkStage { - const scope = CdkStage.of(this); - if (!scope) { - throw new Error('Pipeline stack which uses cross-environment actions must be part of a CDK App or Stage'); - } - return scope; - } -} - -/** - * An interface representing resources generated in order to support - * the cross-region capabilities of CodePipeline. - * You get instances of this interface from the `Pipeline#crossRegionSupport` property. - * - */ -export interface CrossRegionSupport { - /** - * The Stack that has been created to house the replication Bucket - * required for this region. - */ - readonly stack: Stack; - - /** - * The replication Bucket used by CodePipeline to operate in this region. - * Belongs to `stack`. - */ - readonly replicationBucket: s3.IBucket; -} - -interface CrossRegionInfo { - readonly artifactBucket: s3.IBucket; - - readonly region?: string; -} - -function enumerate(xs: A[]): Array<[number, A]> { - const ret = new Array<[number, A]>(); - for (let i = 0; i < xs.length; i++) { - ret.push([i, xs[i]]); - } - return ret; -} - -class PipelineLocation { - constructor(private readonly stageIndex: number, private readonly stage: IStage, private readonly action: FullActionDescriptor) { - } - - public get stageName() { - return this.stage.stageName; - } - - public get actionName() { - return this.action.actionName; - } - - /** - * Returns whether a is before or the same order as b - */ - public beforeOrEqual(rhs: PipelineLocation) { - if (this.stageIndex !== rhs.stageIndex) { return rhs.stageIndex < rhs.stageIndex; } - return this.action.runOrder <= rhs.action.runOrder; - } - - /** - * Returns the first location between this and the other one - */ - public first(rhs: PipelineLocation) { - return this.beforeOrEqual(rhs) ? this : rhs; - } - - public toString() { - // runOrders are 1-based, so make the stageIndex also 1-based otherwise it's going to be confusing. - return `Stage ${this.stageIndex + 1} Action ${this.action.runOrder} ('${this.stageName}'/'${this.actionName}')`; - } -} - -/** - * Render an env dimension without showing the ugly stringified tokens - */ -function renderEnvDimension(s: string | undefined) { - return Token.isUnresolved(s) ? '(current)' : s; -} diff --git a/packages/@aws-cdk/aws-codepipeline/lib/private/stage.ts b/packages/@aws-cdk/aws-codepipeline/lib/private/stage.ts deleted file mode 100644 index 705ed082a5464..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/lib/private/stage.ts +++ /dev/null @@ -1,203 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; -import { Token } from '@aws-cdk/core'; -import { Construct, Node } from 'constructs'; -import { FullActionDescriptor } from './full-action-descriptor'; -import * as validation from './validation'; -import { IAction, IPipeline, IStage } from '../action'; -import { Artifact } from '../artifact'; -import { CfnPipeline } from '../codepipeline.generated'; -import { Pipeline, StageProps } from '../pipeline'; - -/** - * A Stage in a Pipeline. - * - * Stages are added to a Pipeline by calling `Pipeline#addStage`, - * which returns an instance of `codepipeline.IStage`. - * - * This class is private to the CodePipeline module. - */ -export class Stage implements IStage { - /** - * The Pipeline this Stage is a part of. - */ - public readonly stageName: string; - public readonly transitionToEnabled: boolean; - public readonly transitionDisabledReason: string; - private readonly scope: Construct; - private readonly _pipeline: Pipeline; - private readonly _actions = new Array(); - - /** - * Create a new Stage. - */ - constructor(props: StageProps, pipeline: Pipeline) { - validation.validateName('Stage', props.stageName); - - this.stageName = props.stageName; - this.transitionToEnabled = props.transitionToEnabled ?? true; - this.transitionDisabledReason = props.transitionDisabledReason ?? 'Transition disabled'; - this._pipeline = pipeline; - this.scope = new Construct(pipeline, this.stageName); - - for (const action of props.actions || []) { - this.addAction(action); - } - } - - /** - * Get a duplicate of this stage's list of actions. - */ - public get actionDescriptors(): FullActionDescriptor[] { - return this._actions.slice(); - } - - public get actions(): IAction[] { - return this._actions.map(actionDescriptor => actionDescriptor.action); - } - - public get pipeline(): IPipeline { - return this._pipeline; - } - - public render(): CfnPipeline.StageDeclarationProperty { - // first, assign names to output Artifacts who don't have one - for (const action of this._actions) { - const outputArtifacts = action.outputs; - - const unnamedOutputs = outputArtifacts.filter(o => !o.artifactName); - - for (const outputArtifact of outputArtifacts) { - if (!outputArtifact.artifactName) { - const unsanitizedArtifactName = `Artifact_${this.stageName}_${action.actionName}` + (unnamedOutputs.length === 1 - ? '' - : '_' + (unnamedOutputs.indexOf(outputArtifact) + 1)); - const artifactName = sanitizeArtifactName(unsanitizedArtifactName); - (outputArtifact as any)._setName(artifactName); - } - } - } - - return { - name: this.stageName, - actions: this._actions.map(action => this.renderAction(action)), - }; - } - - public addAction(action: IAction): void { - const actionName = action.actionProperties.actionName; - // validate the name - validation.validateName('Action', actionName); - - // check for duplicate Actions and names - if (this._actions.find(a => a.actionName === actionName)) { - throw new Error(`Stage ${this.stageName} already contains an action with name '${actionName}'`); - } - - this._actions.push(this.attachActionToPipeline(action)); - } - - public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule { - const rule = new events.Rule(this.scope, name, options); - rule.addTarget(target); - rule.addEventPattern({ - detailType: ['CodePipeline Stage Execution State Change'], - source: ['aws.codepipeline'], - resources: [this.pipeline.pipelineArn], - detail: { - stage: [this.stageName], - }, - }); - return rule; - } - - public validate(): string[] { - return [ - ...this.validateHasActions(), - ...this.validateActions(), - ]; - } - - private validateHasActions(): string[] { - if (this._actions.length === 0) { - return [`Stage '${this.stageName}' must have at least one action`]; - } - return []; - } - - private validateActions(): string[] { - const ret = new Array(); - for (const action of this.actionDescriptors) { - ret.push(...this.validateAction(action)); - } - return ret; - } - - private validateAction(action: FullActionDescriptor): string[] { - return validation.validateArtifactBounds('input', action.inputs, action.artifactBounds.minInputs, - action.artifactBounds.maxInputs, action.category, action.provider) - .concat(validation.validateArtifactBounds('output', action.outputs, action.artifactBounds.minOutputs, - action.artifactBounds.maxOutputs, action.category, action.provider), - ); - } - - private attachActionToPipeline(action: IAction): FullActionDescriptor { - // notify the Pipeline of the new Action - // - // It may be that a construct already exists with the given action name (CDK Pipelines - // may do this to maintain construct tree compatibility between versions). - // - // If so, we simply reuse it. - let actionScope = Node.of(this.scope).tryFindChild(action.actionProperties.actionName) as Construct | undefined; - if (!actionScope) { - let id = action.actionProperties.actionName; - if (Token.isUnresolved(id)) { - id = findUniqueConstructId(this.scope, action.actionProperties.provider); - } - actionScope = new Construct(this.scope, id); - } - return this._pipeline._attachActionToPipeline(this, action, actionScope); - } - - private renderAction(action: FullActionDescriptor): CfnPipeline.ActionDeclarationProperty { - const outputArtifacts = cdk.Lazy.any({ produce: () => this.renderArtifacts(action.outputs) }, { omitEmptyArray: true }); - const inputArtifacts = cdk.Lazy.any({ produce: () => this.renderArtifacts(action.inputs) }, { omitEmptyArray: true }); - return { - name: action.actionName, - inputArtifacts, - outputArtifacts, - actionTypeId: { - category: action.category.toString(), - version: action.version, - owner: action.owner, - provider: action.provider, - }, - configuration: action.configuration, - runOrder: action.runOrder, - roleArn: action.role ? action.role.roleArn : undefined, - region: action.region, - namespace: action.namespace, - }; - } - - private renderArtifacts(artifacts: Artifact[]): CfnPipeline.InputArtifactProperty[] { - return artifacts - .filter(a => a.artifactName) - .map(a => ({ name: a.artifactName! })); - } -} - -function sanitizeArtifactName(artifactName: string): string { - // strip out some characters that are legal in Stage and Action names, - // but not in Artifact names - return artifactName.replace(/[@.]/g, ''); -} - -function findUniqueConstructId(scope: Construct, prefix: string) { - let current = prefix; - let ctr = 1; - while (Node.of(scope).tryFindChild(current) !== undefined) { - current = `${prefix}${++ctr}`; - } - return current; -} diff --git a/packages/@aws-cdk/aws-codepipeline/lib/private/validation.ts b/packages/@aws-cdk/aws-codepipeline/lib/private/validation.ts deleted file mode 100644 index d44ea7b745fef..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/lib/private/validation.ts +++ /dev/null @@ -1,70 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { ActionCategory } from '../action'; -import { Artifact } from '../artifact'; - -/** - * Validation function that checks if the number of artifacts is within the given bounds - */ -export function validateArtifactBounds( - type: string, artifacts: Artifact[], - min: number, max: number, - category: string, provider: string): string[] { - const ret: string[] = []; - - if (artifacts.length < min) { - ret.push(`${category}/${provider} must have at least ${min} ${type} artifacts`); - } - - if (artifacts.length > max) { - ret.push(`${category}/${provider} cannot have more than ${max} ${type} artifacts`); - } - - return ret; -} - -/** - * Validation function that guarantees that an action is or is not a source action. This is useful because Source actions can only be - * in the first stage of a pipeline, and the first stage can only contain source actions. - */ -export function validateSourceAction(mustBeSource: boolean, category: string, actionName: string, stageName: string): string[] { - if (mustBeSource !== (category === ActionCategory.SOURCE)) { - return [`Action ${actionName} in stage ${stageName}: ` + (mustBeSource ? 'first stage may only contain Source actions' - : 'Source actions may only occur in first stage')]; - } - return []; -} - -/** - * Regex to validate Pipeline, Stage, Action names - * - * https://docs.aws.amazon.com/codepipeline/latest/userguide/limits.html - */ -const VALID_IDENTIFIER_REGEX = /^[a-zA-Z0-9.@_-]{1,100}$/; - -/** - * Validate the given name of a pipeline component. Pipeline component names all have the same restrictions. - * This can be used to validate the name of all components of a pipeline. - */ -export function validateName(thing: string, name: string | undefined): void { - validateAgainstRegex(VALID_IDENTIFIER_REGEX, thing, name); -} - -export function validateArtifactName(artifactName: string | undefined): void { - // https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_Artifact.html#CodePipeline-Type-Artifact-name - validateAgainstRegex(/^[a-zA-Z0-9_-]{1,100}$/, 'Artifact', artifactName); -} - -export function validateNamespaceName(namespaceName: string | undefined): void { - validateAgainstRegex(/^[A-Za-z0-9@_-]{1,100}$/, 'Namespace', namespaceName); -} - -function validateAgainstRegex(regex: RegExp, thing: string, name: string | undefined) { - // name could be a Token - in that case, skip validation altogether - if (cdk.Token.isUnresolved(name)) { - return; - } - - if (name !== undefined && !regex.test(name)) { - throw new Error(`${thing} name must match regular expression: ${regex.toString()}, got '${name}'`); - } -} diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json deleted file mode 100644 index 89f0519235440..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "name": "@aws-cdk/aws-codepipeline", - "version": "0.0.0", - "private": true, - "description": "Better interface to AWS Code Pipeline", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.codepipeline", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codepipeline" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodePipeline", - "packageId": "Amazon.CDK.AWS.CodePipeline", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-codepipeline", - "module": "aws_cdk.aws_codepipeline", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codepipeline" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodePipeline", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "statements": 50, - "lines": 50 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "codepipeline", - "pipeline" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "construct-ctor:@aws-cdk/aws-codepipeline.CrossRegionScaffoldStack..params[0]", - "construct-ctor:@aws-cdk/aws-codepipeline.CrossRegionScaffoldStack..params[1]", - "export:@aws-cdk/aws-codepipeline.IPipeline", - "import-props-interface:@aws-cdk/aws-codepipeline.PipelineImportProps", - "no-unused-type:@aws-cdk/aws-codepipeline.CommonActionProps", - "no-unused-type:@aws-cdk/aws-codepipeline.CommonAwsActionProps", - "resource-attribute:@aws-cdk/aws-codepipeline.IPipeline.pipelineVersion", - "from-method:@aws-cdk/aws-codepipeline.Pipeline", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.owner", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory.INVOKE", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory.DEPLOY", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory.APPROVAL", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory.TEST", - "docs-public-apis:@aws-cdk/aws-codepipeline.Artifact.artifactName", - "docs-public-apis:@aws-cdk/aws-codepipeline.Artifact.toString", - "docs-public-apis:@aws-cdk/aws-codepipeline.ArtifactPath.artifact", - "docs-public-apis:@aws-cdk/aws-codepipeline.ArtifactPath.fileName", - "docs-public-apis:@aws-cdk/aws-codepipeline.ArtifactPath.location", - "docs-public-apis:@aws-cdk/aws-codepipeline.ArtifactPath.artifactPath", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionArtifactBounds.maxInputs", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionArtifactBounds.maxOutputs", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionArtifactBounds.minInputs", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionArtifactBounds.minOutputs", - "public-static-props-all-caps:@aws-cdk/aws-codepipeline.GlobalVariables.executionId", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionBindOptions", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionBindOptions.bucket", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionBindOptions.role", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionConfig", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionConfig.configuration", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionConfig.configuration", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.actionName", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.artifactBounds", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.account", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.inputs", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.inputs", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.outputs", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.outputs", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory.BUILD", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.owner", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.resource", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.role", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.role", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.runOrder", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionProperties.version", - "props-default-doc:@aws-cdk/aws-codepipeline.ActionProperties.version", - "docs-public-apis:@aws-cdk/aws-codepipeline.IStage.pipeline", - "docs-public-apis:@aws-cdk/aws-codepipeline.IStage.addAction", - "docs-public-apis:@aws-cdk/aws-codepipeline.IStage.onStateChange", - "docs-public-apis:@aws-cdk/aws-codepipeline.PipelineProps", - "docs-public-apis:@aws-cdk/aws-codepipeline.StageOptions", - "docs-public-apis:@aws-cdk/aws-codepipeline.StageOptions.placement", - "props-default-doc:@aws-cdk/aws-codepipeline.StageOptions.placement", - "props-default-doc:@aws-cdk/aws-codepipeline.StagePlacement.justAfter", - "props-default-doc:@aws-cdk/aws-codepipeline.StagePlacement.rightBefore", - "props-default-doc:@aws-cdk/aws-codepipeline.StageProps.actions", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory", - "docs-public-apis:@aws-cdk/aws-codepipeline.ActionCategory.SOURCE" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codepipeline/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codepipeline/rosetta/default.ts-fixture deleted file mode 100644 index b46720fa572c4..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -import { Construct } from 'constructs'; -import { App, Duration, PhysicalName, Stack } from '@aws-cdk/core'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; - -class Context extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-codepipeline/test/notification-rule.test.ts b/packages/@aws-cdk/aws-codepipeline/test/notification-rule.test.ts deleted file mode 100644 index 135c595b3231f..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/test/notification-rule.test.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { FakeBuildAction } from './fake-build-action'; -import { FakeSourceAction } from './fake-source-action'; -import * as codepipeline from '../lib'; - -describe('pipeline with codestar notification integration', () => { - let stack: cdk.Stack; - let pipeline: codepipeline.Pipeline; - let sourceArtifact: codepipeline.Artifact; - beforeEach(() => { - stack = new cdk.Stack(); - sourceArtifact = new codepipeline.Artifact(); - pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ actionName: 'Fetch', output: sourceArtifact })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ actionName: 'Gcc', input: sourceArtifact })], - }, - ], - }); - }); - - test('On "Pipeline" execution events emitted notification rule', () => { - const target = { - bindAsNotificationRuleTarget: () => ({ - targetType: 'AWSChatbotSlack', - targetAddress: 'SlackID', - }), - }; - - pipeline.notifyOnExecutionStateChange('NotifyOnExecutionStateChange', target); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'PipelineNotifyOnExecutionStateChange9FE60973', - DetailType: 'FULL', - EventTypeIds: [ - 'codepipeline-pipeline-pipeline-execution-failed', - 'codepipeline-pipeline-pipeline-execution-canceled', - 'codepipeline-pipeline-pipeline-execution-started', - 'codepipeline-pipeline-pipeline-execution-resumed', - 'codepipeline-pipeline-pipeline-execution-succeeded', - 'codepipeline-pipeline-pipeline-execution-superseded', - ], - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':codepipeline:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'PipelineC660917D' }, - ]], - }, - Targets: [ - { - TargetAddress: 'SlackID', - TargetType: 'AWSChatbotSlack', - }, - ], - }); - }); - - test('On any "Stage" execution events emitted notification rule in pipeline', () => { - const target = { - bindAsNotificationRuleTarget: () => ({ - targetType: 'AWSChatbotSlack', - targetAddress: 'SlackID', - }), - }; - - pipeline.notifyOnAnyStageStateChange('NotifyOnAnyStageStateChange', target); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'PipelineNotifyOnAnyStageStateChange05355CCD', - DetailType: 'FULL', - EventTypeIds: [ - 'codepipeline-pipeline-stage-execution-canceled', - 'codepipeline-pipeline-stage-execution-failed', - 'codepipeline-pipeline-stage-execution-resumed', - 'codepipeline-pipeline-stage-execution-started', - 'codepipeline-pipeline-stage-execution-succeeded', - ], - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':codepipeline:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'PipelineC660917D' }, - ]], - }, - Targets: [ - { - TargetAddress: 'SlackID', - TargetType: 'AWSChatbotSlack', - }, - ], - }); - }); - - test('On any "Action" execution events emitted notification rule in pipeline', () => { - const target = { - bindAsNotificationRuleTarget: () => ({ - targetType: 'AWSChatbotSlack', - targetAddress: 'SlackID', - }), - }; - - pipeline.notifyOnAnyActionStateChange('NotifyOnAnyActionStateChange', target); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'PipelineNotifyOnAnyActionStateChange64D5B2AA', - DetailType: 'FULL', - EventTypeIds: [ - 'codepipeline-pipeline-action-execution-canceled', - 'codepipeline-pipeline-action-execution-failed', - 'codepipeline-pipeline-action-execution-started', - 'codepipeline-pipeline-action-execution-succeeded', - ], - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':codepipeline:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'PipelineC660917D' }, - ]], - }, - Targets: [ - { - TargetAddress: 'SlackID', - TargetType: 'AWSChatbotSlack', - }, - ], - }); - }); - - test('On any "Manual approval" execution events emitted notification rule in pipeline', () => { - const target = { - bindAsNotificationRuleTarget: () => ({ - targetType: 'AWSChatbotSlack', - targetAddress: 'SlackID', - }), - }; - - pipeline.notifyOnAnyManualApprovalStateChange('NotifyOnAnyManualApprovalStateChange', target); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'PipelineNotifyOnAnyManualApprovalStateChangeE60778F7', - DetailType: 'FULL', - EventTypeIds: [ - 'codepipeline-pipeline-manual-approval-failed', - 'codepipeline-pipeline-manual-approval-needed', - 'codepipeline-pipeline-manual-approval-succeeded', - ], - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':codepipeline:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':', - { Ref: 'PipelineC660917D' }, - ]], - }, - Targets: [ - { - TargetAddress: 'SlackID', - TargetType: 'AWSChatbotSlack', - }, - ], - }); - }); -}); diff --git a/packages/@aws-cdk/aws-codepipeline/test/pipeline.test.ts b/packages/@aws-cdk/aws-codepipeline/test/pipeline.test.ts deleted file mode 100644 index 4520275fa7379..0000000000000 --- a/packages/@aws-cdk/aws-codepipeline/test/pipeline.test.ts +++ /dev/null @@ -1,899 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { FakeBuildAction } from './fake-build-action'; -import { FakeSourceAction } from './fake-source-action'; -import * as codepipeline from '../lib'; - -/* eslint-disable quote-props */ - -describe('', () => { - describe('Pipeline', () => { - test('can be passed an IAM role during pipeline creation', () => { - const stack = new cdk.Stack(); - const role = new iam.Role(stack, 'Role', { - assumedBy: new iam.ServicePrincipal('codepipeline.amazonaws.com'), - }); - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { - role, - }); - - // Adding 2 stages with actions so pipeline validation will pass - const sourceArtifact = new codepipeline.Artifact(); - pipeline.addStage({ - stageName: 'Source', - actions: [new FakeSourceAction({ - actionName: 'FakeSource', - output: sourceArtifact, - })], - }); - - pipeline.addStage({ - stageName: 'Build', - actions: [new FakeBuildAction({ - actionName: 'FakeBuild', - input: sourceArtifact, - })], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'RoleArn': { - 'Fn::GetAtt': [ - 'Role1ABCC5F0', - 'Arn', - ], - }, - }); - }); - - test('can be imported by ARN', () => { - const stack = new cdk.Stack(); - - const pipeline = codepipeline.Pipeline.fromPipelineArn(stack, 'Pipeline', - 'arn:aws:codepipeline:us-east-1:123456789012:MyPipeline'); - - expect(pipeline.pipelineArn).toEqual('arn:aws:codepipeline:us-east-1:123456789012:MyPipeline'); - expect(pipeline.pipelineName).toEqual('MyPipeline'); - }); - - describe('that is cross-region', () => { - test('validates that source actions are in the same region as the pipeline', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'PipelineStack', { env: { region: 'us-west-1', account: '123456789012' } }); - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); - const sourceStage = pipeline.addStage({ - stageName: 'Source', - }); - const sourceAction = new FakeSourceAction({ - actionName: 'FakeSource', - output: new codepipeline.Artifact(), - region: 'ap-southeast-1', - }); - - expect(() => { - sourceStage.addAction(sourceAction); - }).toThrow(/Source action 'FakeSource' must be in the same region as the pipeline/); - }); - - test('allows passing an Alias in place of the KMS Key in the replication Bucket', () => { - const app = new cdk.App(); - - const replicationRegion = 'us-west-1'; - const replicationStack = new cdk.Stack(app, 'ReplicationStack', { - env: { region: replicationRegion, account: '123456789012' }, - }); - const replicationKey = new kms.Key(replicationStack, 'ReplicationKey'); - const replicationAlias = replicationKey.addAlias('alias/my-replication-alias'); - const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { - encryptionKey: replicationAlias, - bucketName: cdk.PhysicalName.GENERATE_IF_NEEDED, - }); - - const pipelineRegion = 'us-west-2'; - const pipelineStack = new cdk.Stack(app, 'PipelineStack', { - env: { region: pipelineRegion, account: '123456789012' }, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - crossRegionReplicationBuckets: { - [replicationRegion]: replicationBucket, - }, - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ - actionName: 'Source', - output: sourceOutput, - })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ - actionName: 'Build', - input: sourceOutput, - region: replicationRegion, - })], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStores': [ - { - 'Region': replicationRegion, - 'ArtifactStore': { - 'Type': 'S3', - 'EncryptionKey': { - 'Type': 'KMS', - 'Id': { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':kms:us-west-1:123456789012:alias/my-replication-alias', - ], - ], - }, - }, - }, - }, - { - 'Region': pipelineRegion, - }, - ], - }); - - Template.fromStack(replicationStack).hasResourceProperties('AWS::KMS::Key', { - 'KeyPolicy': { - 'Statement': [ - { - // owning account management permissions - we don't care about them in this test - }, - { - // KMS verifies whether the principal given in its key policy exists when creating that key. - // Since the replication bucket must be deployed before the pipeline, - // we cannot put the pipeline role as the principal here - - // hence, we put the account itself - 'Action': [ - 'kms:Decrypt', - 'kms:DescribeKey', - 'kms:Encrypt', - 'kms:ReEncrypt*', - 'kms:GenerateDataKey*', - ], - 'Effect': 'Allow', - 'Principal': { - 'AWS': { - 'Fn::Join': ['', [ - 'arn:', - { 'Ref': 'AWS::Partition' }, - ':iam::123456789012:root', - ]], - }, - }, - 'Resource': '*', - }, - ], - }, - }); - }); - - test('generates ArtifactStores with the alias ARN as the KeyID', () => { - const app = new cdk.App(); - const replicationRegion = 'us-west-1'; - - const pipelineRegion = 'us-west-2'; - const pipelineStack = new cdk.Stack(app, 'MyStack', { - env: { region: pipelineRegion, account: '123456789012' }, - }); - const sourceOutput = new codepipeline.Artifact(); - const pipeline = new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ - actionName: 'Source', - output: sourceOutput, - })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ - actionName: 'Build', - input: sourceOutput, - region: replicationRegion, - })], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStores': [ - { - 'Region': replicationRegion, - 'ArtifactStore': { - 'Type': 'S3', - 'EncryptionKey': { - 'Type': 'KMS', - 'Id': { - 'Fn::Join': [ - '', - [ - 'arn:', - { - 'Ref': 'AWS::Partition', - }, - ':kms:us-west-1:123456789012:alias/s-west-1tencryptionalias9b344b2b8e6825cb1f7d', - ], - ], - }, - }, - }, - }, - { - 'Region': pipelineRegion, - }, - ], - }); - - Template.fromStack(pipeline.crossRegionSupport[replicationRegion].stack).hasResource('AWS::KMS::Alias', { - 'DeletionPolicy': 'Delete', - 'UpdateReplacePolicy': 'Delete', - }); - }); - - test('allows passing an imported Bucket and Key for the replication Bucket', () => { - const replicationRegion = 'us-west-1'; - - const pipelineRegion = 'us-west-2'; - const pipelineStack = new cdk.Stack(undefined, undefined, { - env: { region: pipelineRegion }, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - crossRegionReplicationBuckets: { - [replicationRegion]: s3.Bucket.fromBucketAttributes(pipelineStack, 'ReplicationBucket', { - bucketArn: 'arn:aws:s3:::my-us-west-1-replication-bucket', - encryptionKey: kms.Key.fromKeyArn(pipelineStack, 'ReplicationKey', - `arn:aws:kms:${replicationRegion}:123456789012:key/1234-5678-9012`, - ), - }), - }, - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ - actionName: 'Source', - output: sourceOutput, - })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ - actionName: 'Build', - input: sourceOutput, - })], - }, - ], - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - 'ArtifactStores': [ - { - 'Region': replicationRegion, - 'ArtifactStore': { - 'Type': 'S3', - 'Location': 'my-us-west-1-replication-bucket', - 'EncryptionKey': { - 'Type': 'KMS', - 'Id': 'arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012', - }, - }, - }, - { - 'Region': pipelineRegion, - }, - ], - }); - }); - - test('generates the support stack containing the replication Bucket without the need to bootstrap in that environment', () => { - const app = new cdk.App({ - treeMetadata: false, // we can't set the context otherwise, because App will have a child - }); - app.node.setContext(cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT, true); - - const pipelineStack = new cdk.Stack(app, 'PipelineStack', { - env: { region: 'us-west-2', account: '123456789012' }, - }); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(pipelineStack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ - actionName: 'Source', - output: sourceOutput, - })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ - actionName: 'Build', - input: sourceOutput, - region: 'eu-south-1', - })], - }, - ], - }); - - const assembly = app.synth(); - const supportStackArtifact = assembly.getStackByName('PipelineStack-support-eu-south-1'); - expect(supportStackArtifact.assumeRoleArn).toEqual( - 'arn:${AWS::Partition}:iam::123456789012:role/cdk-hnb659fds-deploy-role-123456789012-us-west-2'); - expect(supportStackArtifact.cloudFormationExecutionRoleArn).toEqual( - 'arn:${AWS::Partition}:iam::123456789012:role/cdk-hnb659fds-cfn-exec-role-123456789012-us-west-2'); - - }); - - test('generates the same support stack containing the replication Bucket without the need to bootstrap in that environment for multiple pipelines', () => { - const app = new cdk.App(); - - new ReusePipelineStack(app, 'PipelineStackA', { - env: { region: 'us-west-2', account: '123456789012' }, - }); - new ReusePipelineStack(app, 'PipelineStackB', { - env: { region: 'us-west-2', account: '123456789012' }, - }); - - const assembly = app.synth(); - // 2 Pipeline Stacks and 1 support stack for both pipeline stacks. - expect(assembly.stacks.length).toEqual(3); - assembly.getStackByName('PipelineStackA-support-eu-south-1'); - expect(() => { - assembly.getStackByName('PipelineStackB-support-eu-south-1'); - }).toThrowError(/Unable to find stack with stack name/); - - }); - - test('generates the unique support stack containing the replication Bucket without the need to bootstrap in that environment for multiple pipelines', () => { - const app = new cdk.App(); - - new ReusePipelineStack(app, 'PipelineStackA', { - env: { region: 'us-west-2', account: '123456789012' }, - reuseCrossRegionSupportStacks: false, - }); - new ReusePipelineStack(app, 'PipelineStackB', { - env: { region: 'us-west-2', account: '123456789012' }, - reuseCrossRegionSupportStacks: false, - }); - - const assembly = app.synth(); - // 2 Pipeline Stacks and 1 support stack for each pipeline stack. - expect(assembly.stacks.length).toEqual(4); - const supportStackAArtifact = assembly.getStackByName('PipelineStackA-support-eu-south-1'); - const supportStackBArtifact = assembly.getStackByName('PipelineStackB-support-eu-south-1'); - - const supportStackATemplate = supportStackAArtifact.template; - Template.fromJSON(supportStackATemplate).hasResourceProperties('AWS::S3::Bucket', { - BucketName: 'pipelinestacka-support-eueplicationbucket8934e91f26961aa6cbfa', - }); - Template.fromJSON(supportStackATemplate).hasResourceProperties('AWS::KMS::Alias', { - AliasName: 'alias/pport-eutencryptionalias02f1cda3732942f6c529', - }); - - const supportStackBTemplate = supportStackBArtifact.template; - Template.fromJSON(supportStackBTemplate).hasResourceProperties('AWS::S3::Bucket', { - BucketName: 'pipelinestackb-support-eueplicationbucketdf7c0e10245faa377228', - }); - Template.fromJSON(supportStackBTemplate).hasResourceProperties('AWS::KMS::Alias', { - AliasName: 'alias/pport-eutencryptionaliasdef3fd3fec63bc54980e', - }); - }); - }); - - describe('that is cross-account', () => { - test('does not allow passing a dynamic value in the Action account property', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'PipelineStack', { env: { account: '123456789012' } }); - const sourceOutput = new codepipeline.Artifact(); - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ actionName: 'Source', output: sourceOutput })], - }, - ], - }); - const buildStage = pipeline.addStage({ stageName: 'Build' }); - - expect(() => { - buildStage.addAction(new FakeBuildAction({ - actionName: 'FakeBuild', - input: sourceOutput, - account: cdk.Aws.ACCOUNT_ID, - })); - }).toThrow(/The 'account' property must be a concrete value \(action: 'FakeBuild'\)/); - }); - - test('does not allow an env-agnostic Pipeline Stack if an Action account has been provided', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'PipelineStack'); - const sourceOutput = new codepipeline.Artifact(); - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ actionName: 'Source', output: sourceOutput })], - }, - ], - }); - const buildStage = pipeline.addStage({ stageName: 'Build' }); - - expect(() => { - buildStage.addAction(new FakeBuildAction({ - actionName: 'FakeBuild', - input: sourceOutput, - account: '123456789012', - })); - }).toThrow(/Pipeline stack which uses cross-environment actions must have an explicitly set account/); - }); - - test('does not allow enabling key rotation if cross account keys have been disabled', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'PipelineStack'); - - expect(() => { - new codepipeline.Pipeline(stack, 'Pipeline', { - crossAccountKeys: false, - enableKeyRotation: true, - }); - }).toThrow("Setting 'enableKeyRotation' to true also requires 'crossAccountKeys' to be enabled"); - }); - - test("enabling key rotation sets 'EnableKeyRotation' to 'true' in the main generated KMS key", () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'PipelineStack'); - const sourceOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(stack, 'Pipeline', { - enableKeyRotation: true, - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ actionName: 'Source', output: sourceOutput })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ actionName: 'Build', input: sourceOutput })], - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', { - 'EnableKeyRotation': true, - }); - }); - }); - }); - - describe('cross account key alias name tests', () => { - const kmsAliasResource = 'AWS::KMS::Alias'; - - test('cross account key alias is named with stack name instead of ID when feature flag is enabled', () => { - const stack = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name', - stackId: 'PipelineStack', - }); - - Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-name-pipeline-0a412eb5', - }); - }); - - test('cross account key alias is named with stack ID when feature flag is not enabled', () => { - const stack = createPipelineStack({ - suffix: 'Name', - stackId: 'PipelineStack', - }); - - Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-pipelinestackpipeline9db740af', - }); - }); - - test('cross account key alias is named with generated stack name when stack name is undefined and feature flag is enabled', () => { - const stack = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name', - stackId: 'PipelineStack', - undefinedStackName: true, - }); - - Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-pipelinestack-pipeline-9db740af', - }); - }); - - test('cross account key alias is named with stack ID when stack name is not present and feature flag is not enabled', () => { - const stack = createPipelineStack({ - suffix: 'Name', - stackId: 'PipelineStack', - undefinedStackName: true, - }); - - Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-pipelinestackpipeline9db740af', - }); - }); - - test('cross account key alias is named with stack name and nested stack ID when feature flag is enabled', () => { - const stack = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name', - stackId: 'TopLevelStack', - nestedStackId: 'NestedPipelineStack', - pipelineId: 'ActualPipeline', - }); - - Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-name-nestedpipelinestack-actualpipeline-23a98110', - }); - }); - - test('cross account key alias is named with stack ID and nested stack ID when stack name is present and feature flag is not enabled', () => { - const stack = createPipelineStack({ - suffix: 'Name', - stackId: 'TopLevelStack', - nestedStackId: 'NestedPipelineStack', - pipelineId: 'ActualPipeline', - }); - - Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-toplevelstacknestedpipelinestackactualpipeline3161a537', - }); - }); - - test('cross account key alias is named with generated stack name and nested stack ID when stack name is undefined and feature flag is enabled', () => { - const stack = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name', - stackId: 'TopLevelStack', - nestedStackId: 'NestedPipelineStack', - pipelineId: 'ActualPipeline', - undefinedStackName: true, - }); - - Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-toplevelstack-nestedpipelinestack-actualpipeline-3161a537', - }); - }); - - test('cross account key alias is named with stack ID and nested stack ID when stack name is not present and feature flag is not enabled', () => { - const stack = createPipelineStack({ - suffix: 'Name', - stackId: 'TopLevelStack', - nestedStackId: 'NestedPipelineStack', - pipelineId: 'ActualPipeline', - undefinedStackName: true, - }); - - Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-toplevelstacknestedpipelinestackactualpipeline3161a537', - }); - }); - - test('cross account key alias is properly shortened to 256 characters when stack name is too long and feature flag is enabled', () => { - const stack = createPipelineStack({ - withFeatureFlag: true, - suffix: 'NeedsToBeShortenedDueToTheLengthOfThisAbsurdNameThatNoOneShouldUseButItStillMightHappenSoWeMustTestForTheTestCase', - stackId: 'too-long', - pipelineId: 'ActualPipelineWithExtraSuperLongNameThatWillNeedToBeShortenedDueToTheAlsoVerySuperExtraLongNameOfTheStack-AlsoWithSomeDifferentCharactersAddedToTheEnd', - }); - - Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-needstobeshortenedduetothelengthofthisabsurdnamethatnooneshouldusebutitstillmighthappensowemusttestfohatwillneedtobeshortenedduetothealsoverysuperextralongnameofthestack-alsowithsomedifferentcharactersaddedtotheend-384b9343', - }); - }); - - test('cross account key alias is properly shortened to 256 characters when stack name is too long and feature flag is not enabled', () => { - const stack = createPipelineStack({ - suffix: 'too-long', - stackId: 'NeedsToBeShortenedDueToTheLengthOfThisAbsurdNameThatNoOneShouldUseButItStillMightHappenSoWeMustTestForTheTestCase', - pipelineId: 'ActualPipelineWithExtraSuperLongNameThatWillNeedToBeShortenedDueToTheAlsoVerySuperExtraLongNameOfTheStack-AlsoWithSomeDifferentCharactersAddedToTheEnd', - }); - - Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-ortenedduetothelengthofthisabsurdnamethatnooneshouldusebutitstillmighthappensowemusttestforthetestcaseactualpipelinewithextrasuperlongnamethatwillneedtobeshortenedduetothealsoverysuperextralongnameofthestackalsowithsomedifferentc498e0672', - }); - }); - - test('cross account key alias names do not conflict when the stack ID is the same and pipeline ID is the same and feature flag is enabled', () => { - const stack1 = createPipelineStack({ - withFeatureFlag: true, - suffix: '1', - stackId: 'STACK-ID', - }); - - const stack2 = createPipelineStack({ - withFeatureFlag: true, - suffix: '2', - stackId: 'STACK-ID', - }); - - expect(Template.fromStack(stack1).findResources(kmsAliasResource)).not.toEqual(Template.fromStack(stack2).findResources(kmsAliasResource)); - - Template.fromStack(stack1).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-1-pipeline-b09fefee', - }); - - Template.fromStack(stack2).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-2-pipeline-f46258fe', - }); - }); - - test('cross account key alias names do conflict when the stack ID is the same and pipeline ID is the same when feature flag is not enabled', () => { - const stack1 = createPipelineStack({ - suffix: '1', - stackId: 'STACK-ID', - }); - - const stack2 = createPipelineStack({ - suffix: '2', - stackId: 'STACK-ID', - }); - - expect(Template.fromStack(stack1).findResources(kmsAliasResource)).toEqual(Template.fromStack(stack2).findResources(kmsAliasResource)); - - Template.fromStack(stack1).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-stackidpipeline32fb88b3', - }); - - Template.fromStack(stack2).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-stackidpipeline32fb88b3', - }); - }); - - test('cross account key alias names do not conflict for nested stacks when pipeline ID is the same and nested stacks have the same ID when feature flag is enabled', () => { - const stack1 = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name-1', - stackId: 'STACK-ID', - nestedStackId: 'Nested', - pipelineId: 'PIPELINE-ID', - }); - const stack2 = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name-2', - stackId: 'STACK-ID', - nestedStackId: 'Nested', - pipelineId: 'PIPELINE-ID', - }); - - expect(Template.fromStack(stack1.nestedStack!).findResources(kmsAliasResource)) - .not.toEqual(Template.fromStack(stack2.nestedStack!).findResources(kmsAliasResource)); - - Template.fromStack(stack1.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-name-1-nested-pipeline-id-c8c9f252', - }); - - Template.fromStack(stack2.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-name-2-nested-pipeline-id-aff6dd63', - }); - }); - - test('cross account key alias names do conflict for nested stacks when pipeline ID is the same and nested stacks have the same ID when feature flag is not enabled', () => { - const stack1 = createPipelineStack({ - suffix: '1', - stackId: 'STACK-ID', - nestedStackId: 'Nested', - pipelineId: 'PIPELINE-ID', - }); - const stack2 = createPipelineStack({ - suffix: '2', - stackId: 'STACK-ID', - nestedStackId: 'Nested', - pipelineId: 'PIPELINE-ID', - }); - - expect(Template.fromStack(stack1.nestedStack!).findResources(kmsAliasResource)) - .toEqual(Template.fromStack(stack2.nestedStack!).findResources(kmsAliasResource)); - - Template.fromStack(stack1.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-stackidnestedpipelineid3e91360a', - }); - - Template.fromStack(stack2.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-stackidnestedpipelineid3e91360a', - }); - }); - - test('cross account key alias names do not conflict for nested stacks when in the same stack but nested stacks have different IDs when feature flag is enabled', () => { - const stack = createPipelineStack({ - withFeatureFlag: true, - suffix: 'Name-1', - stackId: 'STACK-ID', - nestedStackId: 'First', - pipelineId: 'PIPELINE-ID', - }); - const nestedStack2 = new cdk.NestedStack(stack, 'Second'); - createPipelineWithSourceAndBuildStages(nestedStack2, 'Actual-Pipeline-Name-2', 'PIPELINE-ID'); - - expect(Template.fromStack(stack.nestedStack!).findResources(kmsAliasResource)) - .not.toEqual(Template.fromStack(nestedStack2).findResources(kmsAliasResource)); - - Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-name-1-first-pipeline-id-3c59cb88', - }); - - Template.fromStack(nestedStack2).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-actual-stack-name-1-second-pipeline-id-16143d12', - }); - }); - - test('cross account key alias names do not conflict for nested stacks when in the same stack but nested stacks have different IDs when feature flag is not enabled', () => { - const stack = createPipelineStack({ - suffix: 'Name-1', - stackId: 'STACK-ID', - nestedStackId: 'First', - pipelineId: 'PIPELINE-ID', - }); - const nestedStack2 = new cdk.NestedStack(stack, 'Second'); - createPipelineWithSourceAndBuildStages(nestedStack2, 'Actual-Pipeline-Name-2', 'PIPELINE-ID'); - - expect(Template.fromStack(stack.nestedStack!).findResources(kmsAliasResource)) - .not.toEqual(Template.fromStack(nestedStack2).findResources(kmsAliasResource)); - - Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-stackidfirstpipelineid5abca693', - }); - - Template.fromStack(nestedStack2).hasResourceProperties(kmsAliasResource, { - AliasName: 'alias/codepipeline-stackidsecondpipelineid288ce778', - }); - }); - }); -}); - -describe('test with shared setup', () => { - let stack: cdk.Stack; - let sourceArtifact: codepipeline.Artifact; - beforeEach(() => { - stack = new cdk.Stack(); - sourceArtifact = new codepipeline.Artifact(); - }); - - test('can add actions to stages after creation', () => { - // GIVEN - const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ actionName: 'Fetch', output: sourceArtifact })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ actionName: 'Gcc', input: sourceArtifact })], - }, - ], - }); - - // WHEN - pipeline.stage('Build').addAction(new FakeBuildAction({ actionName: 'debug.com', input: sourceArtifact })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: Match.arrayWith([{ - Name: 'Build', - Actions: [ - Match.objectLike({ Name: 'Gcc' }), - Match.objectLike({ Name: 'debug.com' }), - ], - }]), - }); - }); -}); - -interface ReusePipelineStackProps extends cdk.StackProps { - reuseCrossRegionSupportStacks?: boolean; -} - -class ReusePipelineStack extends cdk.Stack { - public constructor(scope: Construct, id: string, props: ReusePipelineStackProps ) { - super(scope, id, props); - const sourceOutput = new codepipeline.Artifact(); - const buildOutput = new codepipeline.Artifact(); - new codepipeline.Pipeline(this, 'Pipeline', { - reuseCrossRegionSupportStacks: props.reuseCrossRegionSupportStacks, - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ - actionName: 'Source', - output: sourceOutput, - })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ - actionName: 'Build', - input: sourceOutput, - region: 'eu-south-1', - output: buildOutput, - })], - }, - { - stageName: 'Deploy', - actions: [new FakeBuildAction({ - actionName: 'Deploy', - input: buildOutput, - region: 'eu-south-1', - })], - }, - ], - }); - } -} - -interface PipelineStackProps extends cdk.StackProps { - readonly nestedStackId?: string; - readonly pipelineName: string; - readonly pipelineId?: string; -} - -class PipelineStack extends cdk.Stack { - nestedStack?: cdk.NestedStack; - pipeline: codepipeline.Pipeline; - - constructor(scope?: Construct, id?: string, props?: PipelineStackProps) { - super (scope, id, props); - - props?.nestedStackId ? this.nestedStack = new cdk.NestedStack(this, props!.nestedStackId!) : undefined; - this.pipeline = createPipelineWithSourceAndBuildStages(this.nestedStack || this, props?.pipelineName, props?.pipelineId); - } -} - -function createPipelineWithSourceAndBuildStages(scope: Construct, pipelineName?: string, pipelineId: string = 'Pipeline') { - const artifact = new codepipeline.Artifact(); - return new codepipeline.Pipeline(scope, pipelineId, { - pipelineName, - crossAccountKeys: true, - reuseCrossRegionSupportStacks: false, - stages: [ - { - stageName: 'Source', - actions: [new FakeSourceAction({ actionName: 'Source', output: artifact })], - }, - { - stageName: 'Build', - actions: [new FakeBuildAction({ actionName: 'Build', input: artifact })], - }, - ], - }); -}; - -interface CreatePipelineStackOptions { - readonly withFeatureFlag?: boolean, - readonly suffix: string, - readonly stackId?: string, - readonly pipelineId?: string, - readonly undefinedStackName?: boolean, - readonly nestedStackId?: string, -} - -function createPipelineStack(options: CreatePipelineStackOptions): PipelineStack { - const context = options.withFeatureFlag ? { context: { [cxapi.CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME]: true } } : undefined; - return new PipelineStack(new cdk.App(context), options.stackId, { - stackName: options.undefinedStackName ? undefined : `Actual-Stack-${options.suffix}`, - nestedStackId: options.nestedStackId, - pipelineName: `Actual-Pipeline-${options.suffix}`.substring(0, 100), - pipelineId: options.pipelineId, - }); -}; diff --git a/packages/@aws-cdk/aws-codestar/.eslintrc.js b/packages/@aws-cdk/aws-codestar/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-codestar/.eslintrc.js +++ b/packages/@aws-cdk/aws-codestar/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codestar/.gitignore b/packages/@aws-cdk/aws-codestar/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-codestar/.gitignore +++ b/packages/@aws-cdk/aws-codestar/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-codestar/README.md b/packages/@aws-cdk/aws-codestar/README.md index 6bdf425aab1d1..d588bf7760055 100644 --- a/packages/@aws-cdk/aws-codestar/README.md +++ b/packages/@aws-cdk/aws-codestar/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -26,8 +20,8 @@ To create a new GitHub Repository and commit the assets from S3 bucket into the repository after it is created: ```ts -import * as codestar from '@aws-cdk/aws-codestar'; -import * as s3 from '@aws-cdk/aws-s3' +import * as codestar from '@aws-cdk/aws-codestar-alpha'; +import * as s3 from 'aws-cdk-lib/aws-s3' new codestar.GitHubRepository(this, 'GitHubRepo', { owner: 'aws', diff --git a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts index 3b530f25d799c..38db0c0d4fce6 100644 --- a/packages/@aws-cdk/aws-codestar/lib/github-repository.ts +++ b/packages/@aws-cdk/aws-codestar/lib/github-repository.ts @@ -1,7 +1,7 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as codestar from './codestar.generated'; +import * as codestar from 'aws-cdk-lib/aws-codestar'; /** * GitHubRepository resource interface diff --git a/packages/@aws-cdk/aws-codestar/lib/index.ts b/packages/@aws-cdk/aws-codestar/lib/index.ts index ff8a544388441..7a253be51e9e8 100644 --- a/packages/@aws-cdk/aws-codestar/lib/index.ts +++ b/packages/@aws-cdk/aws-codestar/lib/index.ts @@ -1,3 +1,2 @@ // AWS::CodeStar CloudFormation Resources: -export * from './codestar.generated'; export * from './github-repository'; diff --git a/packages/@aws-cdk/aws-codestar/package.json b/packages/@aws-cdk/aws-codestar/package.json index e90591084cb05..3015998c5ae89 100644 --- a/packages/@aws-cdk/aws-codestar/package.json +++ b/packages/@aws-cdk/aws-codestar/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-codestar", + "name": "@aws-cdk/aws-codestar-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::CodeStar", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Codestar", - "packageId": "Amazon.CDK.AWS.CodeStar", + "namespace": "Amazon.CDK.AWS.Codestar.Alpha", + "packageId": "Amazon.CDK.AWS.CodeStar.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.codestar", + "package": "software.amazon.awscdk.services.codestar.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "codestar" + "artifactId": "codestar-alpha" } }, "python": { - "distName": "aws-cdk.aws-codestar", - "module": "aws_cdk.aws_codestar", + "distName": "aws-cdk.aws-codestar-alpha", + "module": "aws_cdk.aws_codestar_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkcodestaralpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "pkglint": "pkglint -f", "test": "cdk-test", "watch": "cdk-watch", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::CodeStar", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -82,21 +83,17 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -104,7 +101,7 @@ }, "awslint": { "exclude": [ - "props-physical-name:@aws-cdk/aws-codestar.GitHubRepositoryProps" + "*:*" ] }, "stability": "experimental", @@ -114,5 +111,11 @@ }, "publishConfig": { "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-codestar/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codestar/rosetta/default.ts-fixture index 439308f8c0176..4a1a344e6cc02 100644 --- a/packages/@aws-cdk/aws-codestar/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-codestar/rosetta/default.ts-fixture @@ -1,5 +1,5 @@ // Fixture with packages imported, but nothing else -import { SecretValue, Stack } from '@aws-cdk/core'; +import { SecretValue, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; class Fixture extends Stack { diff --git a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts index c1af7348d849c..1a3e337f18dda 100644 --- a/packages/@aws-cdk/aws-codestar/test/codestar.test.ts +++ b/packages/@aws-cdk/aws-codestar/test/codestar.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Bucket } from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { GitHubRepository, RepositoryVisibility } from '../lib'; describe('GitHub Repository', () => { diff --git a/packages/@aws-cdk/aws-codestarconnections/.eslintrc.js b/packages/@aws-cdk/aws-codestarconnections/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codestarconnections/.gitignore b/packages/@aws-cdk/aws-codestarconnections/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codestarconnections/.npmignore b/packages/@aws-cdk/aws-codestarconnections/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codestarconnections/LICENSE b/packages/@aws-cdk/aws-codestarconnections/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codestarconnections/NOTICE b/packages/@aws-cdk/aws-codestarconnections/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codestarconnections/README.md b/packages/@aws-cdk/aws-codestarconnections/README.md deleted file mode 100644 index ccc883cf06152..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::CodeStarConnections Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as codestarconnections from '@aws-cdk/aws-codestarconnections'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for CodeStarConnections construct libraries](https://constructs.dev/search?q=codestarconnections) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeStarConnections resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeStarConnections.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeStarConnections](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeStarConnections.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-codestarconnections/jest.config.js b/packages/@aws-cdk/aws-codestarconnections/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codestarconnections/lib/index.ts b/packages/@aws-cdk/aws-codestarconnections/lib/index.ts deleted file mode 100644 index e677233fbb954..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::CodeStarConnections CloudFormation Resources: -export * from './codestarconnections.generated'; diff --git a/packages/@aws-cdk/aws-codestarconnections/package.json b/packages/@aws-cdk/aws-codestarconnections/package.json deleted file mode 100644 index 77181ad09d6ce..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-codestarconnections", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeStarConnections", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeStarConnections", - "packageId": "Amazon.CDK.AWS.CodeStarConnections", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.codestarconnections", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codestarconnections" - } - }, - "python": { - "distName": "aws-cdk.aws-codestarconnections", - "module": "aws_cdk.aws_codestarconnections", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codestarconnections" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeStarConnections", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CodeStarConnections", - "aws-codestarconnections" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codestarconnections/test/codestarconnections.test.ts b/packages/@aws-cdk/aws-codestarconnections/test/codestarconnections.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-codestarconnections/test/codestarconnections.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-codestarnotifications/.eslintrc.js b/packages/@aws-cdk/aws-codestarnotifications/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codestarnotifications/.gitignore b/packages/@aws-cdk/aws-codestarnotifications/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-codestarnotifications/.npmignore b/packages/@aws-cdk/aws-codestarnotifications/.npmignore deleted file mode 100644 index b8abeff418a53..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo -tsconfig.json -!.jsii -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-codestarnotifications/LICENSE b/packages/@aws-cdk/aws-codestarnotifications/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codestarnotifications/NOTICE b/packages/@aws-cdk/aws-codestarnotifications/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codestarnotifications/README.md b/packages/@aws-cdk/aws-codestarnotifications/README.md deleted file mode 100644 index ba1da9ced0026..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# AWS CodeStarNotifications Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## NotificationRule - -The `NotificationRule` construct defines an AWS CodeStarNotifications rule. -The rule specifies the events you want notifications about and the targets -(such as Amazon SNS topics or AWS Chatbot clients configured for Slack) -where you want to receive them. -Notification targets are objects that implement the `INotificationRuleTarget` -interface and notification source is object that implement the `INotificationRuleSource` interface. - -## Notification Targets - -This module includes classes that implement the `INotificationRuleTarget` interface for SNS and slack in AWS Chatbot. - -The following targets are supported: - -* `SNS`: specify event and notify to SNS topic. -* `AWS Chatbot`: specify event and notify to slack channel and only support `SlackChannelConfiguration`. - -## Examples - -```ts -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as sns from '@aws-cdk/aws-sns'; -import * as chatbot from '@aws-cdk/aws-chatbot'; - -const project = new codebuild.PipelineProject(this, 'MyProject'); - -const topic = new sns.Topic(this, 'MyTopic1'); - -const slack = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { - slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', - slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', - slackChannelId: 'YOUR_SLACK_CHANNEL_ID', -}); - -const rule = new notifications.NotificationRule(this, 'NotificationRule', { - source: project, - events: [ - 'codebuild-project-build-state-succeeded', - 'codebuild-project-build-state-failed', - ], - targets: [topic], -}); -rule.addTarget(slack); -``` - -## Notification Source - -This module includes classes that implement the `INotificationRuleSource` interface for AWS CodeBuild, -AWS CodePipeline and will support AWS CodeCommit, AWS CodeDeploy in future. - -The following sources are supported: - -* `AWS CodeBuild`: support codebuild project to trigger notification when event specified. -* `AWS CodePipeline`: support codepipeline to trigger notification when event specified. - -## Events - -For the complete list of supported event types for CodeBuild and CodePipeline, see: - -* [Events for notification rules on build projects](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-buildproject). -* [Events for notification rules on pipelines](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline). diff --git a/packages/@aws-cdk/aws-codestarnotifications/jest.config.js b/packages/@aws-cdk/aws-codestarnotifications/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-codestarnotifications/package.json b/packages/@aws-cdk/aws-codestarnotifications/package.json deleted file mode 100644 index 2e1c1c568b347..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/package.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "@aws-cdk/aws-codestarnotifications", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::CodeStarNotifications", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeStarNotifications", - "packageId": "Amazon.CDK.AWS.CodeStarNotifications", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.codestarnotifications", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codestarnotifications" - } - }, - "python": { - "distName": "aws-cdk.aws-codestarnotifications", - "module": "aws_cdk.aws_codestarnotifications", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codestarnotifications" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "compat": "cdk-compat", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CodeStarNotifications", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CodeStarNotifications", - "aws-codestarnotifications" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-codestarnotifications/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-codestarnotifications/rosetta/default.ts-fixture deleted file mode 100644 index 50d86e8a055ce..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/rosetta/default.ts-fixture +++ /dev/null @@ -1,10 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codestarnotifications/test/notification-rule.test.ts b/packages/@aws-cdk/aws-codestarnotifications/test/notification-rule.test.ts deleted file mode 100644 index f73773586b5ab..0000000000000 --- a/packages/@aws-cdk/aws-codestarnotifications/test/notification-rule.test.ts +++ /dev/null @@ -1,239 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { - FakeCodeBuild, - FakeCodePipeline, - FakeCodeCommit, - FakeSlackTarget, - FakeSnsTopicTarget, -} from './helpers'; -import * as notifications from '../lib'; - -describe('NotificationRule', () => { - let stack: cdk.Stack; - - beforeEach(() => { - stack = new cdk.Stack(); - }); - - test('created new notification rule with source', () => { - const project = new FakeCodeBuild(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: project, - events: ['codebuild-project-build-state-succeeded'], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - }); - }); - - test('created new notification rule from repository source', () => { - const repository = new FakeCodeCommit(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: repository, - events: [ - 'codecommit-repository-pull-request-created', - 'codecommit-repository-pull-request-merged', - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Resource: repository.repositoryArn, - EventTypeIds: [ - 'codecommit-repository-pull-request-created', - 'codecommit-repository-pull-request-merged', - ], - }); - }); - - test('created new notification rule with all parameters in constructor props', () => { - const project = new FakeCodeBuild(); - const slack = new FakeSlackTarget(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - notificationRuleName: 'MyNotificationRule', - detailType: notifications.DetailType.FULL, - events: [ - 'codebuild-project-build-state-succeeded', - 'codebuild-project-build-state-failed', - ], - source: project, - targets: [slack], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyNotificationRule', - DetailType: 'FULL', - EventTypeIds: [ - 'codebuild-project-build-state-succeeded', - 'codebuild-project-build-state-failed', - ], - Resource: project.projectArn, - Targets: [ - { - TargetAddress: slack.slackChannelConfigurationArn, - TargetType: 'AWSChatbotSlack', - }, - ], - }); - }); - - test('created new notification rule without name and will generate from the `id`', () => { - const project = new FakeCodeBuild(); - - new notifications.NotificationRule(stack, 'MyNotificationRuleGeneratedFromId', { - source: project, - events: ['codebuild-project-build-state-succeeded'], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyNotificationRuleGeneratedFromId', - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - }); - }); - - test('generating name will cut if id length is over than 64 charts', () => { - const project = new FakeCodeBuild(); - - new notifications.NotificationRule(stack, 'MyNotificationRuleGeneratedFromIdIsToooooooooooooooooooooooooooooLong', { - source: project, - events: ['codebuild-project-build-state-succeeded'], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'ificationRuleGeneratedFromIdIsToooooooooooooooooooooooooooooLong', - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - }); - }); - - test('created new notification rule without detailType', () => { - const project = new FakeCodeBuild(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - notificationRuleName: 'MyNotificationRule', - source: project, - events: ['codebuild-project-build-state-succeeded'], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyNotificationRule', - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - DetailType: 'FULL', - }); - }); - - test('created new notification rule with status DISABLED', () => { - const project = new FakeCodeBuild(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: project, - events: ['codebuild-project-build-state-succeeded'], - enabled: false, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyNotificationRule', - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - Status: 'DISABLED', - }); - }); - - test('created new notification rule with status ENABLED', () => { - const project = new FakeCodeBuild(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: project, - events: ['codebuild-project-build-state-succeeded'], - enabled: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Name: 'MyNotificationRule', - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - Status: 'ENABLED', - }); - }); - - test('notification added targets', () => { - const project = new FakeCodeBuild(); - const topic = new FakeSnsTopicTarget(); - const slack = new FakeSlackTarget(); - - const rule = new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: project, - events: ['codebuild-project-build-state-succeeded'], - }); - - rule.addTarget(slack); - - expect(rule.addTarget(topic)).toEqual(true); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Resource: project.projectArn, - EventTypeIds: ['codebuild-project-build-state-succeeded'], - Targets: [ - { - TargetAddress: slack.slackChannelConfigurationArn, - TargetType: 'AWSChatbotSlack', - }, - { - TargetAddress: topic.topicArn, - TargetType: 'SNS', - }, - ], - }); - }); - - test('will not add if notification added duplicating event', () => { - const pipeline = new FakeCodePipeline(); - - new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: pipeline, - events: [ - 'codepipeline-pipeline-pipeline-execution-succeeded', - 'codepipeline-pipeline-pipeline-execution-failed', - 'codepipeline-pipeline-pipeline-execution-succeeded', - 'codepipeline-pipeline-pipeline-execution-canceled', - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { - Resource: pipeline.pipelineArn, - EventTypeIds: [ - 'codepipeline-pipeline-pipeline-execution-succeeded', - 'codepipeline-pipeline-pipeline-execution-failed', - 'codepipeline-pipeline-pipeline-execution-canceled', - ], - }); - }); -}); - -describe('NotificationRule from imported', () => { - let stack: cdk.Stack; - - beforeEach(() => { - stack = new cdk.Stack(); - }); - - test('from notification rule ARN', () => { - const imported = notifications.NotificationRule.fromNotificationRuleArn(stack, 'MyNotificationRule', - 'arn:aws:codestar-notifications::1234567890:notificationrule/1234567890abcdef'); - expect(imported.notificationRuleArn).toEqual('arn:aws:codestar-notifications::1234567890:notificationrule/1234567890abcdef'); - }); - - test('will not effect and return false when added targets if notification from imported', () => { - const imported = notifications.NotificationRule.fromNotificationRuleArn(stack, 'MyNotificationRule', - 'arn:aws:codestar-notifications::1234567890:notificationrule/1234567890abcdef'); - const slack = new FakeSlackTarget(); - expect(imported.addTarget(slack)).toEqual(false); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito-identitypool/.eslintrc.js b/packages/@aws-cdk/aws-cognito-identitypool/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/.eslintrc.js +++ b/packages/@aws-cdk/aws-cognito-identitypool/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cognito-identitypool/.gitignore b/packages/@aws-cdk/aws-cognito-identitypool/.gitignore index 3e895fc51317c..8ab7624e63416 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/.gitignore +++ b/packages/@aws-cdk/aws-cognito-identitypool/.gitignore @@ -21,3 +21,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-cognito-identitypool/README.md b/packages/@aws-cdk/aws-cognito-identitypool/README.md index f41791b0e2e34..f9cf1200cd7a1 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/README.md +++ b/packages/@aws-cdk/aws-cognito-identitypool/README.md @@ -32,7 +32,7 @@ sign-in options for your app users. This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. ```ts nofixture -import { IdentityPool, UserPoolAuthenticationProvider } from '@aws-cdk/aws-cognito-identitypool'; +import { IdentityPool, UserPoolAuthenticationProvider } from '@aws-cdk/aws-cognito-identitypool-alpha'; ``` ## Table of Contents @@ -77,7 +77,7 @@ By default, both the authenticated and unauthenticated roles will have no permis to roles using the public `authenticatedRole` and `unauthenticatedRole` properties: ```ts -import * as dynamodb from '@aws-cdk/aws-dynamodb'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; const identityPool = new IdentityPool(this, 'myIdentityPool'); declare const table: dynamodb.Table; @@ -259,7 +259,7 @@ Using a [token-based approach](https://docs.aws.amazon.com/cognito/latest/develo `cognito:preferred_role` claims from the identity provider: ```ts -import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool'; +import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool-alpha'; new IdentityPool(this, 'myidentitypool', { identityPoolName: 'myidentitypool', @@ -273,7 +273,7 @@ new IdentityPool(this, 'myidentitypool', { Using a rule-based approach to role mapping allows roles to be assigned based on custom claims passed from the identity provider: ```ts -import { IdentityPoolProviderUrl, RoleMappingMatchType } from '@aws-cdk/aws-cognito-identitypool'; +import { IdentityPoolProviderUrl, RoleMappingMatchType } from '@aws-cdk/aws-cognito-identitypool-alpha'; declare const adminRole: iam.Role; declare const nonAdminRole: iam.Role; @@ -302,7 +302,7 @@ new IdentityPool(this, 'myidentitypool', { Role mappings can also be added after instantiation with the Identity Pool's `addRoleMappings` method: ```ts -import { IdentityPoolRoleMapping } from '@aws-cdk/aws-cognito-identitypool'; +import { IdentityPoolRoleMapping } from '@aws-cdk/aws-cognito-identitypool-alpha'; declare const identityPool: IdentityPool; declare const myAddedRoleMapping1: IdentityPoolRoleMapping; @@ -318,7 +318,7 @@ Role mappings must be associated with the url of an Identity Provider which can `IdentityPoolProviderUrl`. Supported Providers have static Urls that can be used: ```ts -import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool'; +import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool-alpha'; new IdentityPool(this, 'myidentitypool', { identityPoolName: 'myidentitypool', @@ -332,7 +332,7 @@ new IdentityPool(this, 'myidentitypool', { For identity providers that don't have static Urls, a custom Url or User Pool Client Url can be supplied: ```ts -import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool'; +import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool-alpha'; new IdentityPool(this, 'myidentitypool', { identityPoolName: 'myidentitypool', @@ -354,8 +354,8 @@ This is because by default, the key in the Cloudformation role mapping hash is t cannot be references. For example: ```ts -import { UserPool } from '@aws-cdk/aws-cognito'; -import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool'; +import { UserPool } from 'aws-cdk-lib/aws-cognito'; +import { IdentityPoolProviderUrl } from '@aws-cdk/aws-cognito-identitypool-alpha'; declare const userPool : UserPool; new IdentityPool(this, 'myidentitypool', { diff --git a/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-role-attachment.ts b/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-role-attachment.ts index 961ef576a1f7a..0d719a7bd4dc7 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-role-attachment.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-role-attachment.ts @@ -1,14 +1,14 @@ import { CfnIdentityPoolRoleAttachment, -} from '@aws-cdk/aws-cognito'; +} from 'aws-cdk-lib/aws-cognito'; import { IRole, -} from '@aws-cdk/aws-iam'; +} from 'aws-cdk-lib/aws-iam'; import { Resource, IResource, Token, -} from '@aws-cdk/core'; +} from 'aws-cdk-lib'; import { Construct, } from 'constructs'; diff --git a/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-user-pool-authentication-provider.ts b/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-user-pool-authentication-provider.ts index 831d223250258..cad1a858e8454 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-user-pool-authentication-provider.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool-user-pool-authentication-provider.ts @@ -1,8 +1,8 @@ import { IUserPool, IUserPoolClient, -} from '@aws-cdk/aws-cognito'; -import { Stack } from '@aws-cdk/core'; +} from 'aws-cdk-lib/aws-cognito'; +import { Stack } from 'aws-cdk-lib'; import { Construct, Node, } from 'constructs'; diff --git a/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool.ts b/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool.ts index 1fd89f238e0b0..7dd469a745a1c 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool/lib/identitypool.ts @@ -1,20 +1,20 @@ import { CfnIdentityPool, -} from '@aws-cdk/aws-cognito'; +} from 'aws-cdk-lib/aws-cognito'; import { IOpenIdConnectProvider, ISamlProvider, Role, FederatedPrincipal, IRole, -} from '@aws-cdk/aws-iam'; +} from 'aws-cdk-lib/aws-iam'; import { Resource, IResource, Stack, ArnFormat, Lazy, -} from '@aws-cdk/core'; +} from 'aws-cdk-lib'; import { Construct, } from 'constructs'; diff --git a/packages/@aws-cdk/aws-cognito-identitypool/package.json b/packages/@aws-cdk/aws-cognito-identitypool/package.json index 13517e97c2491..8d974095091b1 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/package.json +++ b/packages/@aws-cdk/aws-cognito-identitypool/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-cdk/aws-cognito-identitypool", + "name": "@aws-cdk/aws-cognito-identitypool-alpha", "version": "0.0.0", "description": "The CDK Construct Library for AWS::Cognito Identity Pools", "main": "lib/index.js", @@ -8,24 +8,28 @@ "outdir": "dist", "targets": { "java": { - "package": "software.amazon.awscdk.services.cognito.identitypool", + "package": "software.amazon.awscdk.services.cognito.identitypool.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "cognito-identitypool" + "artifactId": "cognito-identitypool-alpha" } }, "dotnet": { - "namespace": "Amazon.CDK.AWS.Cognito.IdentityPool", - "packageId": "Amazon.CDK.AWS.Cognito.IdentityPool", + "namespace": "Amazon.CDK.AWS.Cognito.IdentityPool.Alpha", + "packageId": "Amazon.CDK.AWS.Cognito.IdentityPool.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "python": { - "distName": "aws-cdk.aws-cognito-identitypool", - "module": "aws_cdk.aws_cognito_identitypool", + "distName": "aws-cdk.aws-cognito-identitypool-alpha", + "module": "aws_cdk.aws_cognito_identitypool_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkcognitoidentitypoolalpha" } }, "projectReferences": true, @@ -77,24 +81,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", + "jest": "^27.5.1", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -102,8 +100,7 @@ }, "awslint": { "exclude": [ - "no-unused-type:@aws-cdk/aws-cognito.IdentityPoolProviderType", - "props-physical-name:@aws-cdk/aws-cognito-identitypool.IdentityPoolRoleAttachmentProps" + "*:*" ] }, "stability": "experimental", @@ -114,5 +111,11 @@ "publishConfig": { "tag": "latest" }, - "private": true + "private": false, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + } } diff --git a/packages/@aws-cdk/aws-cognito-identitypool/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cognito-identitypool/rosetta/default.ts-fixture index a362c0eca88f3..9806479210eba 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-cognito-identitypool/rosetta/default.ts-fixture @@ -1,9 +1,9 @@ // Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as cognito from '@aws-cdk/aws-cognito'; -import * as iam from '@aws-cdk/aws-iam'; -import { IdentityPool, UserPoolAuthenticationProvider } from '@aws-cdk/aws-cognito-identitypool'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { IdentityPool, UserPoolAuthenticationProvider } from '@aws-cdk/aws-cognito-identitypool-alpha'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-cognito-identitypool/test/identitypool.test.ts b/packages/@aws-cdk/aws-cognito-identitypool/test/identitypool.test.ts index f600278fe9de8..d751c2d2476cc 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/test/identitypool.test.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool/test/identitypool.test.ts @@ -1,10 +1,10 @@ import { Template, -} from '@aws-cdk/assertions'; +} from 'aws-cdk-lib/assertions'; import { UserPool, UserPoolIdentityProvider, -} from '@aws-cdk/aws-cognito'; +} from 'aws-cdk-lib/aws-cognito'; import { Role, ServicePrincipal, @@ -16,11 +16,11 @@ import { PolicyStatement, Effect, PolicyDocument, -} from '@aws-cdk/aws-iam'; +} from 'aws-cdk-lib/aws-iam'; import { Fn, Stack, -} from '@aws-cdk/core'; +} from 'aws-cdk-lib'; import { IdentityPool, IdentityPoolProviderUrl, diff --git a/packages/@aws-cdk/aws-cognito-identitypool/test/integ.identitypool.ts b/packages/@aws-cdk/aws-cognito-identitypool/test/integ.identitypool.ts index 0767f07c9b955..277b0cbe201da 100644 --- a/packages/@aws-cdk/aws-cognito-identitypool/test/integ.identitypool.ts +++ b/packages/@aws-cdk/aws-cognito-identitypool/test/integ.identitypool.ts @@ -3,15 +3,15 @@ import { UserPoolIdentityProviderGoogle, UserPoolIdentityProviderAmazon, ProviderAttribute, -} from '@aws-cdk/aws-cognito'; +} from 'aws-cdk-lib/aws-cognito'; import { Effect, PolicyStatement, -} from '@aws-cdk/aws-iam'; +} from 'aws-cdk-lib/aws-iam'; import { App, Stack, -} from '@aws-cdk/core'; +} from 'aws-cdk-lib'; import { IdentityPool, IdentityPoolProviderUrl, diff --git a/packages/@aws-cdk/aws-cognito/.eslintrc.js b/packages/@aws-cdk/aws-cognito/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cognito/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cognito/.gitignore b/packages/@aws-cdk/aws-cognito/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-cognito/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cognito/.npmignore b/packages/@aws-cdk/aws-cognito/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-cognito/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cognito/LICENSE b/packages/@aws-cdk/aws-cognito/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cognito/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cognito/NOTICE b/packages/@aws-cdk/aws-cognito/NOTICE deleted file mode 100644 index 88523779a2ff1..0000000000000 --- a/packages/@aws-cdk/aws-cognito/NOTICE +++ /dev/null @@ -1,30 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** punycode - https://www.npmjs.com/package/punycode -Copyright Mathias Bynens - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/README.md b/packages/@aws-cdk/aws-cognito/README.md deleted file mode 100644 index ab9313678f671..0000000000000 --- a/packages/@aws-cdk/aws-cognito/README.md +++ /dev/null @@ -1,933 +0,0 @@ -# Amazon Cognito Construct Library - - ---- - -Features | Stability --------------------------------------------|-------------------------------------------------------- -CFN Resources | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) -Higher level constructs for User Pools | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) -Higher level constructs for Identity Pools | ![Not Implemented](https://img.shields.io/badge/not--implemented-black.svg?style=for-the-badge) - -> **CFN Resources:** All classes with the `Cfn` prefix in this module ([CFN Resources]) are always -> stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - - - -> **Stable:** Higher level constructs in this module that are marked stable will not undergo any -> breaking changes. They will strictly follow the [Semantic Versioning](https://semver.org/) model. - ---- - - - -[Amazon Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html) provides -authentication, authorization, and user management for your web and mobile apps. Your users can sign in directly with a -user name and password, or through a third party such as Facebook, Amazon, Google or Apple. - -The two main components of Amazon Cognito are [user -pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html) and [identity -pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html). User pools are user directories -that provide sign-up and sign-in options for your app users. Identity pools enable you to grant your users access to -other AWS services. Identity Pool L2 Constructs can be found [here](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cognito-identitypool-alpha-readme.html). - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Table of Contents - -- [User Pools](#user-pools) - - [Sign Up](#sign-up) - - [Sign In](#sign-in) - - [Attributes](#attributes) - - [Security](#security) - - [Multi-factor Authentication](#multi-factor-authentication-mfa) - - [Account Recovery Settings](#account-recovery-settings) - - [Emails](#emails) - - [Device Tracking](#device-tracking) - - [Lambda Triggers](#lambda-triggers) - - [Trigger Permissions](#trigger-permissions) - - [Import](#importing-user-pools) - - [Identity Providers](#identity-providers) - - [App Clients](#app-clients) - - [Resource Servers](#resource-servers) - - [Domains](#domains) - - [Deletion protection](#deletion-protection) - -## User Pools - -User pools allow creating and managing your own directory of users that can sign up and sign in. They enable easy -integration with social identity providers such as Facebook, Google, Amazon, Microsoft Active Directory, etc. through -SAML. - -Using the CDK, a new user pool can be created as part of the stack using the construct's constructor. You may specify -the `userPoolName` to give your own identifier to the user pool. If not, CloudFormation will generate a name. - -```ts -new cognito.UserPool(this, 'myuserpool', { - userPoolName: 'myawesomeapp-userpool', - signInCaseSensitive: false, // case insensitive is preferred in most situations -}); -``` - -By default, usernames and email addresses in user pools are case sensitive, which means `user@example.com` and `User@example.com` -are considered different. In most situations it is preferred to have usernames and email addresses be case insensitive so that -capitalization differences are ignored. As shown above, you can make a user pool case insensitive by setting `signInCaseSensitive` -to `false`. The case sensitivity cannot be changed once a user pool is created. - -The default set up for the user pool is configured such that only administrators will be allowed -to create users. Features such as Multi-factor authentication (MFAs) and Lambda Triggers are not -configured by default. - -Use the `grant()` method to add an IAM policy statement associated with the user pool to an -IAM principal's policy. - -```ts -const userPool = new cognito.UserPool(this, 'myuserpool'); -const role = new iam.Role(this, 'role', { - assumedBy: new iam.ServicePrincipal('foo'), -}); -userPool.grant(role, 'cognito-idp:AdminCreateUser'); -``` - -### Sign Up - -Users can either be signed up by the app's administrators or can sign themselves up. Once a user has signed up, their -account needs to be confirmed. Cognito provides several ways to sign users up and confirm their accounts. Learn more -about [user sign up here](https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html). - -When a user signs up, email and SMS messages are used to verify their account and contact methods. The following code -snippet configures a user pool with properties relevant to these verification messages - - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - selfSignUpEnabled: true, - userVerification: { - emailSubject: 'Verify your email for our awesome app!', - emailBody: 'Thanks for signing up to our awesome app! Your verification code is {####}', - emailStyle: cognito.VerificationEmailStyle.CODE, - smsMessage: 'Thanks for signing up to our awesome app! Your verification code is {####}', - }, -}); -``` - -By default, self sign up is disabled. Learn more about [email and SMS verification messages -here](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-customizations.html). - -Besides users signing themselves up, an administrator of any user pool can sign users up. The user then receives an -invitation to join the user pool. The following code snippet configures a user pool with properties relevant to the -invitation messages - - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - userInvitation: { - emailSubject: 'Invite to join our awesome app!', - emailBody: 'Hello {username}, you have been invited to join our awesome app! Your temporary password is {####}', - smsMessage: 'Hello {username}, your temporary password for our awesome app is {####}', - }, -}); -``` - -All email subjects, bodies and SMS messages for both invitation and verification support Cognito's message templating. -Learn more about [message templates -here](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-templates.html). - -### Sign In - -Users registering or signing in into your application can do so with multiple identifiers. There are 4 options -available: - -- `username`: Allow signing in using the one time immutable user name that the user chose at the time of sign up. -- `email`: Allow signing in using the email address that is associated with the account. -- `phone`: Allow signing in using the phone number that is associated with the account. -- `preferredUsername`: Allow signing in with an alternate user name that the user can change at any time. However, this - is not available if the `username` option is not chosen. - -The following code sets up a user pool so that the user can sign in with either their username or their email address - - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - // ... - signInAliases: { - username: true, - email: true, - }, -}); -``` - -User pools can either be configured so that user name is primary sign in form, but also allows for the other three to be -used additionally; or it can be configured so that email and/or phone numbers are the only ways a user can register and -sign in. Read more about this -[here](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases-settings). - -⚠️ The Cognito service prevents changing the `signInAlias` property for an existing user pool. - -To match with 'Option 1' in the above link, with a verified email, `signInAliases` should be set to -`{ username: true, email: true }`. To match with 'Option 2' in the above link with both a verified -email and phone number, this property should be set to `{ email: true, phone: true }`. - -Cognito recommends that email and phone number be automatically verified, if they are one of the sign in methods for -the user pool. Read more about that -[here](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases). -The CDK does this by default, when email and/or phone number are specified as part of `signInAliases`. This can be -overridden by specifying the `autoVerify` property. - -The following code snippet sets up only email as a sign in alias, but both email and phone number to be auto-verified. - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - // ... - signInAliases: { username: true, email: true }, - autoVerify: { email: true, phone: true }, -}); -``` - -A user pool can optionally ignore case when evaluating sign-ins. When `signInCaseSensitive` is false, Cognito will not -check the capitalization of the alias when signing in. Default is true. - -### Attributes - -Attributes represent the various properties of each user that's collected and stored in the user pool. Cognito -provides a set of standard attributes that are available for all user pools. Users are allowed to select any of these -standard attributes to be required. Users will not be able to sign up to the user pool without providing the required -attributes. Besides these, additional attributes can be further defined, and are known as custom attributes. - -Learn more on [attributes in Cognito's -documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html). - -The following code configures a user pool with two standard attributes (name and address) as required and mutable, and adds -four custom attributes. - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - standardAttributes: { - fullname: { - required: true, - mutable: false, - }, - address: { - required: false, - mutable: true, - }, - }, - customAttributes: { - 'myappid': new cognito.StringAttribute({ minLen: 5, maxLen: 15, mutable: false }), - 'callingcode': new cognito.NumberAttribute({ min: 1, max: 3, mutable: true }), - 'isEmployee': new cognito.BooleanAttribute({ mutable: true }), - 'joinedOn': new cognito.DateTimeAttribute(), - }, -}); -``` - -As shown in the code snippet, there are data types that are available for custom attributes. The 'String' and 'Number' -data types allow for further constraints on their length and values, respectively. - -Custom attributes cannot be marked as required. - -All custom attributes share the property `mutable` that specifies whether the value of the attribute can be changed. -The default value is `false`. - -User pools come with two 'built-in' attributes - `email_verified` and `phone_number_verified`. These cannot be -configured (required-ness or mutability) as part of user pool creation. However, user pool administrators can modify -them for specific users using the [AdminUpdateUserAttributes API]. - -[AdminUpdateUserAttributes API]: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminUpdateUserAttributes.html - -### Attribute verification - -When your user updates an email address or phone number attribute, Amazon Cognito marks it unverified until they verify the new value. -You can’t send messages to an unverified email address or phone number. -Your user can’t sign in with an unverified alias attribute. -You can choose how Amazon Cognito handles an updated email address or phone number after the update and before the verification. - -Learn more on [configuring email or phone verification in Cognito's documentation.](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html?icmpid=docs_cognito_console_help_panel) - -The following code configures a user pool that keeps the original value for the two standard attributes (email and phone_number) until the new values are verified. - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - signInAliases: { username: true }, - autoVerify: { email: true, phone: true }, - keepOriginal: { - email: true, - phone: true, - }, -}); -``` - - -### Security - -Cognito sends various messages to its users via SMS, for different actions, ranging from account verification to -marketing. In order to send SMS messages, Cognito needs an IAM role that it can assume, with permissions that allow it -to send SMS messages. - -By default, the CDK looks at all of the specified properties (and their defaults when not explicitly specified) and -automatically creates an SMS role, when needed. For example, if MFA second factor by SMS is enabled, the CDK will -create a new role. The `smsRole` property can be used to specify the user supplied role that should be used instead. -Additionally, the property `enableSmsRole` can be used to override the CDK's default behaviour to either enable or -suppress automatic role creation. - -```ts -const poolSmsRole = new iam.Role(this, 'userpoolsmsrole', { - assumedBy: new iam.ServicePrincipal('foo'), -}); - -new cognito.UserPool(this, 'myuserpool', { - // ... - smsRole: poolSmsRole, - smsRoleExternalId: 'c87467be-4f34-11ea-b77f-2e728ce88125', -}); -``` - -When the `smsRole` property is specified, the `smsRoleExternalId` may also be specified. The value of -`smsRoleExternalId` will be used as the `sts:ExternalId` when the Cognito service assumes the role. In turn, the role's -assume role policy should be configured to accept this value as the ExternalId. Learn more about [ExternalId -here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html). - -#### Multi-factor Authentication (MFA) - -User pools can be configured to enable multi-factor authentication (MFA). It can either be turned off, set to optional -or made required. Setting MFA to optional means that individual users can choose to enable it. -Additionally, the MFA code can be sent either via SMS text message or via a time-based software token. -See the [documentation on MFA](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa.html) to -learn more. - -The following code snippet marks MFA for the user pool as required. This means that all users are required to -configure an MFA token and use it for sign in. It also allows for the users to use both SMS based MFA, as well, -[time-based one time password -(TOTP)](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa-totp.html). - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - mfa: cognito.Mfa.REQUIRED, - mfaSecondFactor: { - sms: true, - otp: true, - }, -}); -``` - -User pools can be configured with policies around a user's password. This includes the password length and the -character sets that they must contain. - -Further to this, it can also be configured with the validity of the auto-generated temporary password. A temporary -password is generated by the user pool either when an admin signs up a user or when a password reset is requested. -The validity of this password dictates how long to give the user to use this password before expiring it. - -The following code snippet configures these properties - - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - passwordPolicy: { - minLength: 12, - requireLowercase: true, - requireUppercase: true, - requireDigits: true, - requireSymbols: true, - tempPasswordValidity: Duration.days(3), - }, -}); -``` - -Note that, `tempPasswordValidity` can be specified only in whole days. Specifying fractional days would throw an error. - -#### Account Recovery Settings - -User pools can be configured on which method a user should use when recovering the password for their account. This -can either be email and/or SMS. Read more at [Recovering User Accounts](https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-recover-a-user-account.html) - -```ts -new cognito.UserPool(this, 'UserPool', { - // ... - accountRecovery: cognito.AccountRecovery.EMAIL_ONLY, -}) -``` - -The default for account recovery is by phone if available and by email otherwise. -A user will not be allowed to reset their password via phone if they are also using it for MFA. - -#### Advanced Security Mode - -User pools can be configured to use Advanced security. You can turn the user pool advanced security features on, and customize the actions that are taken in response to different risks. Or you can use audit mode to gather metrics on detected risks without taking action. In audit mode, the advanced security features publish metrics to Amazon CloudWatch. See the [documentation on Advanced security](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) to learn more. - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - advancedSecurityMode: cognito.AdvancedSecurityMode.ENFORCED, -}); -``` - -### Emails - -Cognito sends emails to users in the user pool, when particular actions take place, such as welcome emails, invitation -emails, password resets, etc. The address from which these emails are sent can be configured on the user pool. -Read more at [Email settings for User Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-email.html). - -By default, user pools are configured to use Cognito's built in email capability, which will send emails -from `no-reply@verificationemail.com`. If you want to use a custom email address you can configure -Cognito to send emails through Amazon SES, which is detailed below. - -```ts -new cognito.UserPool(this, 'myuserpool', { - email: cognito.UserPoolEmail.withCognito('support@myawesomeapp.com'), -}); -``` - -For typical production environments, the default email limit is below the required delivery volume. -To enable a higher delivery volume, you can configure the UserPool to send emails through Amazon SES. To do -so, follow the steps in the [Cognito Developer Guide](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-email.html#user-pool-email-developer) -to verify an email address, move the account out of the SES sandbox, and grant Cognito email permissions via an -authorization policy. - -Once the SES setup is complete, the UserPool can be configured to use the SES email. - -```ts -new cognito.UserPool(this, 'myuserpool', { - email: cognito.UserPoolEmail.withSES({ - fromEmail: 'noreply@myawesomeapp.com', - fromName: 'Awesome App', - replyTo: 'support@myawesomeapp.com', - }), -}); -``` - -Sending emails through SES requires that SES be configured (as described above) in a valid SES region. -If the UserPool is being created in a different region, `sesRegion` must be used to specify the correct SES region. - -```ts -new cognito.UserPool(this, 'myuserpool', { - email: cognito.UserPoolEmail.withSES({ - sesRegion: 'us-east-1', - fromEmail: 'noreply@myawesomeapp.com', - fromName: 'Awesome App', - replyTo: 'support@myawesomeapp.com', - }), -}); - -``` - -When sending emails from an SES verified domain, `sesVerifiedDomain` can be used to specify the domain. -The email address does not need to be verified when sending emails from a verified domain, because the identity of the email configuration is can be determined from the domain alone. - -```ts -new cognito.UserPool(this, 'myuserpool', { - email: cognito.UserPoolEmail.withSES({ - sesRegion: 'us-east-1', - fromEmail: 'noreply@myawesomeapp.com', - fromName: 'Awesome App', - replyTo: 'support@myawesomeapp.com', - sesVerifiedDomain: 'myawesomeapp.com', - }), -}); -``` - -If `fromName` does not comply RFC 5322 atom or quoted-string, it will be quoted or mime-encoded. - -```ts -new cognito.UserPool(this, 'myuserpool', { - email: cognito.UserPoolEmail.withSES({ - fromEmail: 'noreply@myawesomeapp.com', - fromName: 'myname@mycompany.com', - }), -}); -// => From: "myname@mycompany.com" -``` - -### Device Tracking - -User pools can be configured to track devices that users have logged in to. -Read more at [Device Tracking](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-device-tracking.html) - -```ts -new cognito.UserPool(this, 'myuserpool', { - // ... - deviceTracking: { - challengeRequiredOnNewDevice: true, - deviceOnlyRememberedOnUserPrompt: true, - }, -}); -``` - -The default is to not track devices. - -### Lambda Triggers - -User pools can be configured such that AWS Lambda functions can be triggered when certain user operations or actions -occur, such as, sign up, user confirmation, sign in, etc. They can also be used to add custom authentication -challenges, user migrations and custom verification messages. Learn more about triggers at [User Pool Workflows with -Triggers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html). - -Lambda triggers can either be specified as part of the `UserPool` initialization, or it can be added later, via methods -on the construct, as so - - -```ts -const authChallengeFn = new lambda.Function(this, 'authChallengeFn', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'path/to/asset')), -}); - -const userpool = new cognito.UserPool(this, 'myuserpool', { - // ... - lambdaTriggers: { - createAuthChallenge: authChallengeFn, - // ... - }, -}); - -userpool.addTrigger(cognito.UserPoolOperation.USER_MIGRATION, new lambda.Function(this, 'userMigrationFn', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'path/to/asset')), -})); -``` - -The following table lists the set of triggers available, and their corresponding method to add it to the user pool. -For more information on the function of these triggers and how to configure them, read [User Pool Workflows with -Triggers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html). - -#### Trigger Permissions - -The `function.attachToRolePolicy()` API can be used to add additional IAM permissions to the lambda trigger -as necessary. - -⚠️ Using the `attachToRolePolicy` API to provide permissions to your user pool will result in a circular dependency. See [aws/aws-cdk#7016](https://github.com/aws/aws-cdk/issues/7016). -Error message when running `cdk synth` or `cdk deploy`: -> Circular dependency between resources: [pool056F3F7E, fnPostAuthFnCognitoA630A2B1, ...] - -To work around the circular dependency issue, use the `attachInlinePolicy()` API instead, as shown below. - -```ts -declare const postAuthFn: lambda.Function; - -const userpool = new cognito.UserPool(this, 'myuserpool', { - lambdaTriggers: { - postAuthentication: postAuthFn, - }, -}); - -// provide permissions to describe the user pool scoped to the ARN the user pool -postAuthFn.role?.attachInlinePolicy(new iam.Policy(this, 'userpool-policy', { - statements: [new iam.PolicyStatement({ - actions: ['cognito-idp:DescribeUserPool'], - resources: [userpool.userPoolArn], - })], -})); -``` - -### Importing User Pools - -Any user pool that has been created outside of this stack, can be imported into the CDK app. Importing a user pool -allows for it to be used in other parts of the CDK app that reference an `IUserPool`. However, imported user pools have -limited configurability. As a rule of thumb, none of the properties that are part of the -[`AWS::Cognito::UserPool`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html) -CloudFormation resource can be configured. - -User pools can be imported either using their id via the `UserPool.fromUserPoolId()`, or by using their ARN, via the -`UserPool.fromUserPoolArn()` API. - -```ts -const awesomePool = cognito.UserPool.fromUserPoolId(this, 'awesome-user-pool', 'us-east-1_oiuR12Abd'); - -const otherAwesomePool = cognito.UserPool.fromUserPoolArn(this, 'other-awesome-user-pool', - 'arn:aws:cognito-idp:eu-west-1:123456789012:userpool/us-east-1_mtRyYQ14D'); -``` - -### Identity Providers - -Users that are part of a user pool can sign in either directly through a user pool, or federate through a third-party -identity provider. Once configured, the Cognito backend will take care of integrating with the third-party provider. -Read more about [Adding User Pool Sign-in Through a Third -Party](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-identity-federation.html). - -The following third-party identity providers are currently supported in the CDK - - -- [Login With Amazon](https://developer.amazon.com/apps-and-games/login-with-amazon) -- [Facebook Login](https://developers.facebook.com/docs/facebook-login/) -- [Google Login](https://developers.google.com/identity/sign-in/web/sign-in) -- [Sign In With Apple](https://developer.apple.com/sign-in-with-apple/get-started/) -- [OpenID Connect](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-oidc-idp.html) -- [SAML](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-saml-idp.html) - -The following code configures a user pool to federate with the third party provider, 'Login with Amazon'. The identity -provider needs to be configured with a set of credentials that the Cognito backend can use to federate with the -third-party identity provider. - -```ts -const userpool = new cognito.UserPool(this, 'Pool'); - -const provider = new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', { - clientId: 'amzn-client-id', - clientSecret: 'amzn-client-secret', - userPool: userpool, -}); -``` - -Using Google identity provider is possible to use clientSecretValue with SecretValue from secrets manager. - -```ts -const userpool = new cognito.UserPool(this, 'Pool'); -const secret = secretsManager.Secret.fromSecretAttributes(this, "CognitoClientSecret", { - secretCompleteArn: "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx" -}).secretValue - -const provider = new cognito.UserPoolIdentityProviderGoogle(this, 'Google', { - clientId: 'amzn-client-id', - clientSecretValue: secret, - userPool: userpool, -}); -``` - -Attribute mapping allows mapping attributes provided by the third-party identity providers to [standard and custom -attributes](#Attributes) of the user pool. Learn more about [Specifying Identity Provider Attribute Mappings for Your -User Pool](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html). - -The following code shows how different attributes provided by 'Login With Amazon' can be mapped to standard and custom -user pool attributes. - -```ts -const userpool = new cognito.UserPool(this, 'Pool'); - -new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', { - clientId: 'amzn-client-id', - clientSecret: 'amzn-client-secret', - userPool: userpool, - attributeMapping: { - email: cognito.ProviderAttribute.AMAZON_EMAIL, - website: cognito.ProviderAttribute.other('url'), // use other() when an attribute is not pre-defined in the CDK - custom: { - // custom user pool attributes go here - uniqueId: cognito.ProviderAttribute.AMAZON_USER_ID, - }, - }, -}); -``` - -### App Clients - -An app is an entity within a user pool that has permission to call unauthenticated APIs (APIs that do not have an -authenticated user), such as APIs to register, sign in, and handle forgotten passwords. To call these APIs, you need an -app client ID and an optional client secret. Read [Configuring a User Pool App -Client](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html) to learn more. - -The following code creates an app client and retrieves the client id - - -```ts -const pool = new cognito.UserPool(this, 'pool'); -const client = pool.addClient('customer-app-client'); -const clientId = client.userPoolClientId; -``` - -Existing app clients can be imported into the CDK app using the `UserPoolClient.fromUserPoolClientId()` API. For new -and imported user pools, clients can also be created via the `UserPoolClient` constructor, as so - - -```ts -const importedPool = cognito.UserPool.fromUserPoolId(this, 'imported-pool', 'us-east-1_oiuR12Abd'); -new cognito.UserPoolClient(this, 'customer-app-client', { - userPool: importedPool, -}); -``` - -Clients can be configured with authentication flows. Authentication flows allow users on a client to be authenticated -with a user pool. Cognito user pools provide several different types of authentication, such as, SRP (Secure -Remote Password) authentication, username-and-password authentication, etc. Learn more about this at [UserPool Authentication -Flow](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html). - -The following code configures a client to use both SRP and username-and-password authentication - - -```ts -const pool = new cognito.UserPool(this, 'pool'); -pool.addClient('app-client', { - authFlows: { - userPassword: true, - userSrp: true, - }, -}); -``` - -Custom authentication protocols can be configured by setting the `custom` property under `authFlow` and defining lambda -functions for the corresponding user pool [triggers](#lambda-triggers). Learn more at [Custom Authentication -Flow](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#amazon-cognito-user-pools-custom-authentication-flow). - -In addition to these authentication mechanisms, Cognito user pools also support using OAuth 2.0 framework for -authenticating users. User pool clients can be configured with OAuth 2.0 authorization flows and scopes. Learn more -about the [OAuth 2.0 authorization framework](https://tools.ietf.org/html/rfc6749) and [Cognito user pool's -implementation of -OAuth2.0](https://aws.amazon.com/blogs/mobile/understanding-amazon-cognito-user-pool-oauth-2-0-grants/). - -The following code configures an app client with the authorization code grant flow and registers the the app's welcome -page as a callback (or redirect) URL. It also configures the access token scope to 'openid'. All of these concepts can -be found in the [OAuth 2.0 RFC](https://tools.ietf.org/html/rfc6749). - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -pool.addClient('app-client', { - oAuth: { - flows: { - authorizationCodeGrant: true, - }, - scopes: [ cognito.OAuthScope.OPENID ], - callbackUrls: [ 'https://my-app-domain.com/welcome' ], - logoutUrls: [ 'https://my-app-domain.com/signin' ], - }, -}); -``` - -An app client can be configured to prevent user existence errors. This -instructs the Cognito authentication API to return generic authentication -failure responses instead of an UserNotFoundException. By default, the flag -is not set, which means the CloudFormation default (false) will be used. See the -[documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-managing-errors.html) -for the full details on the behavior of this flag. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -pool.addClient('app-client', { - preventUserExistenceErrors: true, -}); -``` - -All identity providers created in the CDK app are automatically registered into the corresponding user pool. All app -clients created in the CDK have all of the identity providers enabled by default. The 'Cognito' identity provider, -that allows users to register and sign in directly with the Cognito user pool, is also enabled by default. -Alternatively, the list of supported identity providers for a client can be explicitly specified - - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -pool.addClient('app-client', { - // ... - supportedIdentityProviders: [ - cognito.UserPoolClientIdentityProvider.AMAZON, - cognito.UserPoolClientIdentityProvider.COGNITO, - ], -}); -``` - -If the identity provider and the app client are created in the same stack, specify the dependency between both constructs to -make sure that the identity provider already exists when the app client will be created. The app client cannot handle the -dependency to the identity provider automatically because the client does not have access to the provider's construct. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -const provider = new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', { - userPool: pool, - clientId: 'amzn-client-id', - clientSecret: 'amzn-client-secret', -}); - -const client = pool.addClient('app-client', { - // ... - supportedIdentityProviders: [ - cognito.UserPoolClientIdentityProvider.AMAZON, - ], -}); - -client.node.addDependency(provider); -``` - -The property `authSessionValidity` is the session token for each API request in the authentication flow. -Valid duration is from 3 to 15 minutes. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -pool.addClient('app-client', { - // ... - authSessionValidity: Duration.minutes(15), -}); -``` - -In accordance with the OIDC open standard, Cognito user pool clients provide access tokens, ID tokens and refresh tokens. -More information is available at [Using Tokens with User Pools](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html). -The expiration time for these tokens can be configured as shown below. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -pool.addClient('app-client', { - // ... - accessTokenValidity: Duration.minutes(60), - idTokenValidity: Duration.minutes(60), - refreshTokenValidity: Duration.days(30), -}); -``` - -Clients can (and should) be allowed to read and write relevant user attributes only. Usually every client can be allowed to -read the `given_name` attribute but not every client should be allowed to set the `email_verified` attribute. -The same criteria applies for both standard and custom attributes, more info is available at -[Attribute Permissions and Scopes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-attribute-permissions-and-scopes). -The default behaviour is to allow read and write permissions on all attributes. The following code shows how this can be -configured for a client. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); - -const clientWriteAttributes = (new cognito.ClientAttributes()) - .withStandardAttributes({fullname: true, email: true}) - .withCustomAttributes('favouritePizza', 'favouriteBeverage'); - -const clientReadAttributes = clientWriteAttributes - .withStandardAttributes({emailVerified: true}) - .withCustomAttributes('pointsEarned'); - -pool.addClient('app-client', { - // ... - readAttributes: clientReadAttributes, - writeAttributes: clientWriteAttributes, -}); -``` - -[Token revocation](https://docs.aws.amazon.com/cognito/latest/developerguide/token-revocation.html) -can be configured to be able to revoke refresh tokens in app clients. By default, token revocation is enabled for new user -pools. The property can be used to enable the token revocation in existing app clients or to change the default behavior. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); -pool.addClient('app-client', { - // ... - enableTokenRevocation: true, -}); -``` - -User Pool clients can generate a client ID as well as a client secret, to support more advanced authentication workflows. - -To create a client with an autogenerated client secret, pass the `generateSecret: true` prop: - -```ts -const userPoolClient = new cognito.UserPoolClient(this, 'UserPoolClient', { - userPool: importedPool, - generateSecret: true, -}); - -// Allows you to pass the generated secret to other pieces of infrastructure -const secret = userPoolClient.userPoolClientSecret; -``` - -### Resource Servers - -A resource server is a server for access-protected resources. It handles authenticated requests from an app that has an -access token. See [Defining Resource -Servers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-define-resource-servers.html) -for more information. - -An application may choose to model custom permissions via OAuth. Resource Servers provide this capability via custom scopes -that are attached to an app client. The following example sets up a resource server for the 'users' resource for two different -app clients and configures the clients to use these scopes. - -```ts -const pool = new cognito.UserPool(this, 'Pool'); - -const readOnlyScope = new cognito.ResourceServerScope({ scopeName: 'read', scopeDescription: 'Read-only access' }); -const fullAccessScope = new cognito.ResourceServerScope({ scopeName: '*', scopeDescription: 'Full access' }); - -const userServer = pool.addResourceServer('ResourceServer', { - identifier: 'users', - scopes: [ readOnlyScope, fullAccessScope ], -}); - -const readOnlyClient = pool.addClient('read-only-client', { - // ... - oAuth: { - // ... - scopes: [ cognito.OAuthScope.resourceServer(userServer, readOnlyScope) ], - }, -}); - -const fullAccessClient = pool.addClient('full-access-client', { - // ... - oAuth: { - // ... - scopes: [ cognito.OAuthScope.resourceServer(userServer, fullAccessScope) ], - }, -}); -``` - - -### Domains - -After setting up an [app client](#app-clients), the address for the user pool's sign-up and sign-in webpages can be -configured using domains. There are two ways to set up a domain - either the Amazon Cognito hosted domain can be chosen -with an available domain prefix, or a custom domain name can be chosen. The custom domain must be one that is already -owned, and whose certificate is registered in AWS Certificate Manager. - -The following code sets up a user pool domain in Amazon Cognito hosted domain with the prefix 'my-awesome-app', and -another domain with the custom domain 'user.myapp.com' - - -```ts -const pool = new cognito.UserPool(this, 'Pool'); - -pool.addDomain('CognitoDomain', { - cognitoDomain: { - domainPrefix: 'my-awesome-app', - }, -}); - -const certificateArn = 'arn:aws:acm:us-east-1:123456789012:certificate/11-3336f1-44483d-adc7-9cd375c5169d'; - -const domainCert = certificatemanager.Certificate.fromCertificateArn(this, 'domainCert', certificateArn); -pool.addDomain('CustomDomain', { - customDomain: { - domainName: 'user.myapp.com', - certificate: domainCert, - }, -}); -``` - -Read more about [Using the Amazon Cognito -Domain](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-assign-domain-prefix.html) and [Using Your Own -Domain](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-add-custom-domain.html). - -The `signInUrl()` methods returns the fully qualified URL to the login page for the user pool. This page comes from the -hosted UI configured with Cognito. Learn more at [Hosted UI with the Amazon Cognito -Console](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-integration.html#cognito-user-pools-create-an-app-integration). - -```ts -const userpool = new cognito.UserPool(this, 'UserPool', { - // ... -}); -const client = userpool.addClient('Client', { - // ... - oAuth: { - flows: { - implicitCodeGrant: true, - }, - callbackUrls: [ - 'https://myapp.com/home', - 'https://myapp.com/users', - ], - }, -}); -const domain = userpool.addDomain('Domain', { - // ... -}); -const signInUrl = domain.signInUrl(client, { - redirectUri: 'https://myapp.com/home', // must be a URL configured under 'callbackUrls' with the client -}); -``` - -Existing domains can be imported into CDK apps using `UserPoolDomain.fromDomainName()` API - -```ts -const myUserPoolDomain = cognito.UserPoolDomain.fromDomainName(this, 'my-user-pool-domain', 'domain-name'); -``` - -### Deletion protection - -Deletion protection can be enabled on a user pool to prevent accidental deletion: - -```ts -const userpool = new cognito.UserPool(this, 'UserPool', { - // ... - deletionProtection: true, -}); -``` - -By default deletion protection is disabled. diff --git a/packages/@aws-cdk/aws-cognito/jest.config.js b/packages/@aws-cdk/aws-cognito/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-cognito/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cognito/package.json b/packages/@aws-cdk/aws-cognito/package.json deleted file mode 100644 index f75c5a5b34c3c..0000000000000 --- a/packages/@aws-cdk/aws-cognito/package.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "name": "@aws-cdk/aws-cognito", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Cognito", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.cognito", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cognito" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Cognito", - "packageId": "Amazon.CDK.AWS.Cognito", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-cognito", - "module": "aws_cdk.aws_cognito", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cognito" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Cognito", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cognito" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/punycode": "^2.1.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0", - "punycode": "^2.3.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "bundledDependencies": [ - "punycode" - ], - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "attribute-tag:@aws-cdk/aws-cognito.UserPoolClient.userPoolClientName", - "resource-attribute:@aws-cdk/aws-cognito.UserPoolClient.userPoolClientClientSecret", - "resource-attribute:@aws-cdk/aws-cognito.UserPoolDomain.userPoolDomainCloudFrontDistribution", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolDomainProps", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderFacebookProps", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderAmazonProps", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderGoogleProps", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderAppleProps", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderOidcProps", - "props-physical-name:@aws-cdk/aws-cognito.UserPoolIdentityProviderSamlProps" - ] - }, - "stability": "stable", - "maturity": "stable", - "features": [ - { - "name": "Higher level constructs for User Pools", - "stability": "Stable" - }, - { - "name": "Higher level constructs for Identity Pools", - "stability": "Not Implemented" - } - ], - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-cognito/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-cognito/rosetta/default.ts-fixture deleted file mode 100644 index 996a448f8bfc6..0000000000000 --- a/packages/@aws-cdk/aws-cognito/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as certificatemanager from '@aws-cdk/aws-certificatemanager'; -import * as cognito from '@aws-cdk/aws-cognito'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as path from 'path'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.ts b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.ts deleted file mode 100644 index 6dfe94496cab3..0000000000000 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-client-secret.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Construct } from 'constructs'; -import { UserPool } from '../lib'; - -class TestStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - const userpool = new UserPool(this, 'pool', { - removalPolicy: RemovalPolicy.DESTROY, - }); - - const client = userpool.addClient('client', { generateSecret: true }); - const secret = new secretsmanager.Secret(this, 'secret', { - secretStringValue: client.userPoolClientSecret, - }); - - new CfnOutput(this, 'ClientSecretName', { - value: secret.secretName, - }); - } -} - -const app = new App(); -const testCase = new TestStack(app, 'integ-user-pool-client-secret'); - -new IntegTest(app, 'integ-user-pool-client-secret-test', { - testCases: [testCase], -}); diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.ts b/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.ts deleted file mode 100644 index d4064158ff784..0000000000000 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool-ses-email.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { UserPool, UserPoolEmail } from '../lib'; - -const app = new App(); -const stack = new Stack(app, 'integ-user-ses-email'); - -const userpool = new UserPool(stack, 'myuserpool', { - removalPolicy: RemovalPolicy.DESTROY, - userPoolName: 'MyUserPool', - email: UserPoolEmail.withSES({ - sesRegion: 'us-east-1', - fromEmail: 'noreply@example.com', - fromName: 'myname@mycompany.com', - replyTo: 'support@example.com', - sesVerifiedDomain: 'example.com', - }), -}); - -new CfnOutput(stack, 'user-pool-id', { - value: userpool.userPoolId, -}); - -new IntegTest(app, 'IntegTest', { testCases: [stack] }); diff --git a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts b/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts deleted file mode 100644 index 7fe2fd03b06a8..0000000000000 --- a/packages/@aws-cdk/aws-cognito/test/integ.user-pool.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { UserPool } from '../lib'; - -const app = new App(); -const stack = new Stack(app, 'integ-user-pool'); - -const userpool = new UserPool(stack, 'myuserpool', { - userPoolName: 'MyUserPool', - removalPolicy: RemovalPolicy.DESTROY, - deletionProtection: false, -}); - -new CfnOutput(stack, 'user-pool-id', { - value: userpool.userPoolId, -}); diff --git a/packages/@aws-cdk/aws-comprehend/.eslintrc.js b/packages/@aws-cdk/aws-comprehend/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-comprehend/.gitignore b/packages/@aws-cdk/aws-comprehend/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-comprehend/.npmignore b/packages/@aws-cdk/aws-comprehend/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-comprehend/LICENSE b/packages/@aws-cdk/aws-comprehend/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-comprehend/NOTICE b/packages/@aws-cdk/aws-comprehend/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-comprehend/README.md b/packages/@aws-cdk/aws-comprehend/README.md deleted file mode 100644 index 01922f86e026d..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Comprehend Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as comprehend from '@aws-cdk/aws-comprehend'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Comprehend construct libraries](https://constructs.dev/search?q=comprehend) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Comprehend resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Comprehend.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Comprehend](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Comprehend.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-comprehend/jest.config.js b/packages/@aws-cdk/aws-comprehend/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-comprehend/lib/index.ts b/packages/@aws-cdk/aws-comprehend/lib/index.ts deleted file mode 100644 index 9d43a700973e6..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Comprehend CloudFormation Resources: -export * from './comprehend.generated'; diff --git a/packages/@aws-cdk/aws-comprehend/package.json b/packages/@aws-cdk/aws-comprehend/package.json deleted file mode 100644 index 046ba79285ae0..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-comprehend", - "version": "0.0.0", - "description": "AWS::Comprehend Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Comprehend", - "packageId": "Amazon.CDK.AWS.Comprehend", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.comprehend", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "comprehend" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-comprehend", - "module": "aws_cdk.aws_comprehend" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-comprehend" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Comprehend", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Comprehend", - "aws-comprehend" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-comprehend/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-comprehend/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-comprehend/test/comprehend.test.ts b/packages/@aws-cdk/aws-comprehend/test/comprehend.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-comprehend/test/comprehend.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-config/.eslintrc.js b/packages/@aws-cdk/aws-config/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-config/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-config/.gitignore b/packages/@aws-cdk/aws-config/.gitignore deleted file mode 100644 index f7a205e2c9fa4..0000000000000 --- a/packages/@aws-cdk/aws-config/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml - -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-config/.npmignore b/packages/@aws-cdk/aws-config/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-config/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-config/LICENSE b/packages/@aws-cdk/aws-config/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-config/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-config/NOTICE b/packages/@aws-cdk/aws-config/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-config/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-config/README.md b/packages/@aws-cdk/aws-config/README.md deleted file mode 100644 index 81959aa8c7bf1..0000000000000 --- a/packages/@aws-cdk/aws-config/README.md +++ /dev/null @@ -1,292 +0,0 @@ -# AWS Config Construct Library - - ---- - -Features | Stability ----------------------------------------------------------------------------------------|------------ -CFN Resources | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) -Higher level constructs for Config Rules | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) -Higher level constructs for initial set-up (delivery channel & configuration recorder) | ![Not Implemented](https://img.shields.io/badge/not--implemented-black.svg?style=for-the-badge) - -> **CFN Resources:** All classes with the `Cfn` prefix in this module ([CFN Resources]) are always -> stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - - - -> **Stable:** Higher level constructs in this module that are marked stable will not undergo any -> breaking changes. They will strictly follow the [Semantic Versioning](https://semver.org/) model. - ---- - - - -[AWS Config](https://docs.aws.amazon.com/config/latest/developerguide/WhatIsConfig.html) provides a detailed view of the configuration of AWS resources in your AWS account. -This includes how the resources are related to one another and how they were configured in the -past so that you can see how the configurations and relationships change over time. - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Initial Setup - -Before using the constructs provided in this module, you need to set up AWS Config -in the region in which it will be used. This setup includes the one-time creation of the -following resources per region: - -- `ConfigurationRecorder`: Configure which resources will be recorded for config changes. -- `DeliveryChannel`: Configure where to store the recorded data. - -The following guides provide the steps for getting started with AWS Config: - -- [Using the AWS Console](https://docs.aws.amazon.com/config/latest/developerguide/gs-console.html) -- [Using the AWS CLI](https://docs.aws.amazon.com/config/latest/developerguide/gs-cli.html) - -## Rules - -AWS Config can evaluate the configuration settings of your AWS resources by creating AWS Config rules, -which represent your ideal configuration settings. - -See [Evaluating Resources with AWS Config Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) to learn more about AWS Config rules. - -### AWS Managed Rules - -AWS Config provides AWS managed rules, which are predefined, customizable rules that AWS Config -uses to evaluate whether your AWS resources comply with common best practices. - -For example, you could create a managed rule that checks whether active access keys are rotated -within the number of days specified. - -```ts -// https://docs.aws.amazon.com/config/latest/developerguide/access-keys-rotated.html -new config.ManagedRule(this, 'AccessKeysRotated', { - identifier: config.ManagedRuleIdentifiers.ACCESS_KEYS_ROTATED, - inputParameters: { - maxAccessKeyAge: 60, // default is 90 days - }, - - // default is 24 hours - maximumExecutionFrequency: config.MaximumExecutionFrequency.TWELVE_HOURS, -}); -``` - -Identifiers for AWS managed rules are available through static constants in the `ManagedRuleIdentifiers` class. -You can find supported input parameters in the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html). - -The following higher level constructs for AWS managed rules are available. - -#### Access Key rotation - -Checks whether your active access keys are rotated within the number of days specified. - -```ts -// compliant if access keys have been rotated within the last 90 days -new config.AccessKeysRotated(this, 'AccessKeyRotated'); -``` - -#### CloudFormation Stack drift detection - -Checks whether your CloudFormation stack's actual configuration differs, or has drifted, -from it's expected configuration. - -```ts -// compliant if stack's status is 'IN_SYNC' -// non-compliant if the stack's drift status is 'DRIFTED' -new config.CloudFormationStackDriftDetectionCheck(this, 'Drift', { - ownStackOnly: true, // checks only the stack containing the rule -}); -``` - -#### CloudFormation Stack notifications - -Checks whether your CloudFormation stacks are sending event notifications to a SNS topic. - -```ts -// topics to which CloudFormation stacks may send event notifications -const topic1 = new sns.Topic(this, 'AllowedTopic1'); -const topic2 = new sns.Topic(this, 'AllowedTopic2'); - -// non-compliant if CloudFormation stack does not send notifications to 'topic1' or 'topic2' -new config.CloudFormationStackNotificationCheck(this, 'NotificationCheck', { - topics: [topic1, topic2], -}); -``` - -### Custom rules - -You can develop custom rules and add them to AWS Config. You associate each custom rule with an -AWS Lambda function and Guard. - -#### Custom Lambda Rules - -Lambda function which contains the logic that evaluates whether your AWS resources comply with the rule. - -```ts -// Lambda function containing logic that evaluates compliance with the rule. -const evalComplianceFn = new lambda.Function(this, "CustomFunction", { - code: lambda.AssetCode.fromInline( - "exports.handler = (event) => console.log(event);" - ), - handler: "index.handler", - runtime: lambda.Runtime.NODEJS_14_X, -}); - -// A custom rule that runs on configuration changes of EC2 instances -const customRule = new config.CustomRule(this, "Custom", { - configurationChanges: true, - lambdaFunction: evalComplianceFn, - ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE), -}); -``` - -#### Custom Policy Rules - -Guard which contains the logic that evaluates whether your AWS resources comply with the rule. - -```ts -const samplePolicyText = ` -# This rule checks if point in time recovery (PITR) is enabled on active Amazon DynamoDB tables -let status = ['ACTIVE'] - -rule tableisactive when - resourceType == "AWS::DynamoDB::Table" { - configuration.tableStatus == %status -} - -rule checkcompliance when - resourceType == "AWS::DynamoDB::Table" - tableisactive { - let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus - %pitr == "ENABLED" -} -`; - -new config.CustomPolicy(stack, "Custom", { - policyText: samplePolicyText, - enableDebugLog: true, - ruleScope: config.RuleScope.fromResources([ - config.ResourceType.DYNAMODB_TABLE, - ]), -}); -``` - -### Triggers - -AWS Lambda executes functions in response to events that are published by AWS Services. -The function for a custom Config rule receives an event that is published by AWS Config, -and is responsible for evaluating the compliance of the rule. - -Evaluations can be triggered by configuration changes, periodically, or both. -To create a custom rule, define a `CustomRule` and specify the Lambda Function -to run and the trigger types. - -```ts -declare const evalComplianceFn: lambda.Function; - -new config.CustomRule(this, 'CustomRule', { - lambdaFunction: evalComplianceFn, - configurationChanges: true, - periodic: true, - - // default is 24 hours - maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, -}); -``` - -When the trigger for a rule occurs, the Lambda function is invoked by publishing an event. -See [example events for AWS Config Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_example-events.html) - -The AWS documentation has examples of Lambda functions for evaluations that are -[triggered by configuration changes](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_nodejs-sample.html#event-based-example-rule) and [triggered periodically](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_nodejs-sample.html#periodic-example-rule) - - -### Scope - -By default rules are triggered by changes to all [resources](https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html#supported-resources). - -Use the `RuleScope` APIs (`fromResource()`, `fromResources()` or `fromTag()`) to restrict -the scope of both managed and custom rules: - -```ts -const sshRule = new config.ManagedRule(this, 'SSH', { - identifier: config.ManagedRuleIdentifiers.EC2_SECURITY_GROUPS_INCOMING_SSH_DISABLED, - ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_SECURITY_GROUP, 'sg-1234567890abcdefgh'), // restrict to specific security group -}); - -declare const evalComplianceFn: lambda.Function; -const customRule = new config.CustomRule(this, 'Lambda', { - lambdaFunction: evalComplianceFn, - configurationChanges: true, - ruleScope: config.RuleScope.fromResources([config.ResourceType.CLOUDFORMATION_STACK, config.ResourceType.S3_BUCKET]), // restrict to all CloudFormation stacks and S3 buckets -}); - -const tagRule = new config.CustomRule(this, 'CostCenterTagRule', { - lambdaFunction: evalComplianceFn, - configurationChanges: true, - ruleScope: config.RuleScope.fromTag('Cost Center', 'MyApp'), // restrict to a specific tag -}); -``` - -### Events - -You can define Amazon EventBridge event rules which trigger when a compliance check fails -or when a rule is re-evaluated. - -Use the `onComplianceChange()` APIs to trigger an EventBridge event when a compliance check -of your AWS Config Rule fails: - -```ts -// Topic to which compliance notification events will be published -const complianceTopic = new sns.Topic(this, 'ComplianceTopic'); - -const rule = new config.CloudFormationStackDriftDetectionCheck(this, 'Drift'); -rule.onComplianceChange('TopicEvent', { - target: new targets.SnsTopic(complianceTopic), -}); -``` - -Use the `onReEvaluationStatus()` status to trigger an EventBridge event when an AWS Config -rule is re-evaluated. - -```ts -// Topic to which re-evaluation notification events will be published -const reEvaluationTopic = new sns.Topic(this, 'ComplianceTopic'); - -const rule = new config.CloudFormationStackDriftDetectionCheck(this, 'Drift'); -rule.onReEvaluationStatus('ReEvaluationEvent', { - target: new targets.SnsTopic(reEvaluationTopic), -}); -``` - -### Example - -The following example creates a custom rule that evaluates whether EC2 instances are compliant. -Compliance events are published to an SNS topic. - -```ts -// Lambda function containing logic that evaluates compliance with the rule. -const evalComplianceFn = new lambda.Function(this, 'CustomFunction', { - code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); - -// A custom rule that runs on configuration changes of EC2 instances -const customRule = new config.CustomRule(this, 'Custom', { - configurationChanges: true, - lambdaFunction: evalComplianceFn, - ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE), -}); - -// A rule to detect stack drifts -const driftRule = new config.CloudFormationStackDriftDetectionCheck(this, 'Drift'); - -// Topic to which compliance notification events will be published -const complianceTopic = new sns.Topic(this, 'ComplianceTopic'); - -// Send notification on compliance change events -driftRule.onComplianceChange('ComplianceChange', { - target: new targets.SnsTopic(complianceTopic), -}); -``` diff --git a/packages/@aws-cdk/aws-config/jest.config.js b/packages/@aws-cdk/aws-config/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-config/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-config/lib/rule.ts b/packages/@aws-cdk/aws-config/lib/rule.ts deleted file mode 100644 index 846006d990de1..0000000000000 --- a/packages/@aws-cdk/aws-config/lib/rule.ts +++ /dev/null @@ -1,2576 +0,0 @@ -import { createHash } from 'crypto'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnConfigRule } from './config.generated'; - -/** - * Interface representing an AWS Config rule - */ -export interface IRule extends IResource { - /** - * The name of the rule. - * - * @attribute - */ - readonly configRuleName: string; - - /** - * Defines an EventBridge event rule which triggers for rule events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - onEvent(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a EventBridge event rule which triggers for rule compliance events. - */ - onComplianceChange(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines a EventBridge event rule which triggers for rule re-evaluation status events. - */ - onReEvaluationStatus(id: string, options?: events.OnEventOptions): events.Rule; -} - -/** - * A new or imported rule. - */ -abstract class RuleBase extends Resource implements IRule { - public abstract readonly configRuleName: string; - - /** - * Defines an EventBridge event rule which triggers for rule events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - public onEvent(id: string, options: events.OnEventOptions = {}) { - const rule = new events.Rule(this, id, options); - rule.addEventPattern({ - source: ['aws.config'], - detail: { - configRuleName: [this.configRuleName], - }, - }); - rule.addTarget(options.target); - return rule; - } - - /** - * Defines an EventBridge event rule which triggers for rule compliance events. - */ - public onComplianceChange(id: string, options: events.OnEventOptions = {}): events.Rule { - const rule = this.onEvent(id, options); - rule.addEventPattern({ - detailType: ['Config Rules Compliance Change'], - }); - return rule; - } - - /** - * Defines an EventBridge event rule which triggers for rule re-evaluation status events. - */ - public onReEvaluationStatus(id: string, options: events.OnEventOptions = {}): events.Rule { - const rule = this.onEvent(id, options); - rule.addEventPattern({ - detailType: ['Config Rules Re-evaluation Status'], - }); - return rule; - } -} - -/** - * A new managed or custom rule. - */ -abstract class RuleNew extends RuleBase { - /** - * Imports an existing rule. - * - * @param configRuleName the name of the rule - */ - public static fromConfigRuleName(scope: Construct, id: string, configRuleName: string): IRule { - class Import extends RuleBase { - public readonly configRuleName = configRuleName; - } - - return new Import(scope, id); - } - - /** - * The arn of the rule. - */ - public abstract readonly configRuleArn: string; - - /** - * The id of the rule. - */ - public abstract readonly configRuleId: string; - - /** - * The compliance status of the rule. - */ - public abstract readonly configRuleComplianceType: string; - - protected ruleScope?: RuleScope; - protected isManaged?: boolean; - protected isCustomWithChanges?: boolean; -} - -/** - * Determines which resources trigger an evaluation of an AWS Config rule. - */ -export class RuleScope { - /** restricts scope of changes to a specific resource type or resource identifier */ - public static fromResource(resourceType: ResourceType, resourceId?: string) { - return new RuleScope(resourceId, [resourceType]); - } - /** restricts scope of changes to specific resource types */ - public static fromResources(resourceTypes: ResourceType[]) { - return new RuleScope(undefined, resourceTypes); - } - /** restricts scope of changes to a specific tag */ - public static fromTag(key: string, value?: string) { - return new RuleScope(undefined, undefined, key, value); - } - - /** Resource types that will trigger evaluation of a rule */ - public readonly resourceTypes?: ResourceType[]; - - /** ID of the only AWS resource that will trigger evaluation of a rule */ - public readonly resourceId?: string; - - /** tag key applied to resources that will trigger evaluation of a rule */ - public readonly key?: string; - - /** tag value applied to resources that will trigger evaluation of a rule */ - public readonly value?: string; - - private constructor(resourceId?: string, resourceTypes?: ResourceType[], tagKey?: string, tagValue?: string) { - this.resourceTypes = resourceTypes; - this.resourceId = resourceId; - this.key = tagKey; - this.value = tagValue; - } -} - -/** - * The maximum frequency at which the AWS Config rule runs evaluations. - */ -export enum MaximumExecutionFrequency { - - /** - * 1 hour. - */ - ONE_HOUR = 'One_Hour', - - /** - * 3 hours. - */ - THREE_HOURS = 'Three_Hours', - - /** - * 6 hours. - */ - SIX_HOURS = 'Six_Hours', - - /** - * 12 hours. - */ - TWELVE_HOURS = 'Twelve_Hours', - - /** - * 24 hours. - */ - TWENTY_FOUR_HOURS = 'TwentyFour_Hours' -} - -/** - * Construction properties for a new rule. - */ -export interface RuleProps { - /** - * A name for the AWS Config rule. - * - * @default - CloudFormation generated name - */ - readonly configRuleName?: string; - - /** - * A description about this AWS Config rule. - * - * @default - No description - */ - readonly description?: string; - - /** - * Input parameter values that are passed to the AWS Config rule. - * - * @default - No input parameters - */ - readonly inputParameters?: { [key: string]: any }; - - /** - * The maximum frequency at which the AWS Config rule runs evaluations. - * - * @default MaximumExecutionFrequency.TWENTY_FOUR_HOURS - */ - readonly maximumExecutionFrequency?: MaximumExecutionFrequency; - - /** - * Defines which resources trigger an evaluation for an AWS Config rule. - * - * @default - evaluations for the rule are triggered when any resource in the recording group changes. - */ - readonly ruleScope?: RuleScope; -} - -/** - * Construction properties for a ManagedRule. - */ -export interface ManagedRuleProps extends RuleProps { - /** - * The identifier of the AWS managed rule. - * - * @see https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html - */ - readonly identifier: string; -} - -/** - * A new managed rule. - * - * @resource AWS::Config::ConfigRule - */ -export class ManagedRule extends RuleNew { - /** @attribute */ - public readonly configRuleName: string; - - /** @attribute */ - public readonly configRuleArn: string; - - /** @attribute */ - public readonly configRuleId: string; - - /** @attribute */ - public readonly configRuleComplianceType: string; - - constructor(scope: Construct, id: string, props: ManagedRuleProps) { - super(scope, id, { - physicalName: props.configRuleName, - }); - - this.ruleScope = props.ruleScope; - - const rule = new CfnConfigRule(this, 'Resource', { - configRuleName: this.physicalName, - description: props.description, - inputParameters: props.inputParameters, - maximumExecutionFrequency: props.maximumExecutionFrequency, - scope: Lazy.any({ produce: () => renderScope(this.ruleScope) }), // scope can use values such as stack id (see CloudFormationStackDriftDetectionCheck) - source: { - owner: 'AWS', - sourceIdentifier: props.identifier, - }, - }); - - this.configRuleName = rule.ref; - this.configRuleArn = rule.attrArn; - this.configRuleId = rule.attrConfigRuleId; - this.configRuleComplianceType = rule.attrComplianceType; - - this.isManaged = true; - } -} - -/** - * The source of the event, such as an AWS service, - * that triggers AWS Config to evaluate your AWS resources. - */ -enum EventSource { - - /* from aws.config */ - AWS_CONFIG = 'aws.config', - -} - -/** - * The type of notification that triggers AWS Config to run an evaluation for a rule. - */ -enum MessageType { - - /** - * Triggers an evaluation when AWS Config delivers a configuration item as a result of a resource change. - */ - CONFIGURATION_ITEM_CHANGE_NOTIFICATION = 'ConfigurationItemChangeNotification', - - /** - * Triggers an evaluation when AWS Config delivers an oversized configuration item. - */ - OVERSIZED_CONFIGURATION_ITEM_CHANGE_NOTIFICATION = 'OversizedConfigurationItemChangeNotification', - - /** - * Triggers a periodic evaluation at the frequency specified for MaximumExecutionFrequency. - */ - SCHEDULED_NOTIFICATION = 'ScheduledNotification', - - /** - * Triggers a periodic evaluation when AWS Config delivers a configuration snapshot. - */ - CONFIGURATION_SNAPSHOT_DELIVERY_COMPLETED = 'ConfigurationSnapshotDeliveryCompleted', -} - -/** - * Construction properties for a CustomRule. - */ -interface SourceDetail { - /** - * The source of the event, such as an AWS service, - * that triggers AWS Config to evaluate your AWS resources. - * - */ - readonly eventSource: EventSource; - /** - * The frequency at which you want AWS Config to run evaluations for a custom rule with a periodic trigger. - */ - readonly maximumExecutionFrequency?: MaximumExecutionFrequency; - /** - * The type of notification that triggers AWS Config to run an evaluation for a rule. - */ - readonly messageType: MessageType; -} - -/** - * Construction properties for a CustomRule. - */ -export interface CustomRuleProps extends RuleProps { - /** - * The Lambda function to run. - */ - readonly lambdaFunction: lambda.IFunction; - - /** - * Whether to run the rule on configuration changes. - * - * @default false - */ - readonly configurationChanges?: boolean; - - /** - * Whether to run the rule on a fixed frequency. - * - * @default false - */ - readonly periodic?: boolean; -} -/** - * A new custom rule. - * - * @resource AWS::Config::ConfigRule - */ -export class CustomRule extends RuleNew { - /** @attribute */ - public readonly configRuleName: string; - - /** @attribute */ - public readonly configRuleArn: string; - - /** @attribute */ - public readonly configRuleId: string; - - /** @attribute */ - public readonly configRuleComplianceType: string; - - constructor(scope: Construct, id: string, props: CustomRuleProps) { - super(scope, id, { - physicalName: props.configRuleName, - }); - - if (!props.configurationChanges && !props.periodic) { - throw new Error('At least one of `configurationChanges` or `periodic` must be set to true.'); - } - - const sourceDetails: SourceDetail[] = []; - this.ruleScope = props.ruleScope; - if (props.configurationChanges) { - sourceDetails.push({ - eventSource: EventSource.AWS_CONFIG, - messageType: MessageType.CONFIGURATION_ITEM_CHANGE_NOTIFICATION, - }); - sourceDetails.push({ - eventSource: EventSource.AWS_CONFIG, - messageType: MessageType.OVERSIZED_CONFIGURATION_ITEM_CHANGE_NOTIFICATION, - }); - } - - if (props.periodic) { - sourceDetails.push({ - eventSource: EventSource.AWS_CONFIG, - maximumExecutionFrequency: props.maximumExecutionFrequency, - messageType: MessageType.SCHEDULED_NOTIFICATION, - }); - } - const hash = createHash('sha256') - .update(JSON.stringify({ - fnName: props.lambdaFunction.functionName.toString, - accountId: Stack.of(this).resolve(this.env.account), - region: Stack.of(this).resolve(this.env.region), - }), 'utf8') - .digest('base64'); - const customRulePermissionId: string = `CustomRulePermission${hash}`; - if (!props.lambdaFunction.permissionsNode.tryFindChild(customRulePermissionId)) { - props.lambdaFunction.addPermission(customRulePermissionId, { - principal: new iam.ServicePrincipal('config.amazonaws.com'), - sourceAccount: this.env.account, - }); - }; - - if (props.lambdaFunction.role) { - props.lambdaFunction.role.addManagedPolicy( - iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSConfigRulesExecutionRole'), - ); - } - - // The lambda permission must be created before the rule - this.node.addDependency(props.lambdaFunction); - - const rule = new CfnConfigRule(this, 'Resource', { - configRuleName: this.physicalName, - description: props.description, - inputParameters: props.inputParameters, - maximumExecutionFrequency: props.maximumExecutionFrequency, - scope: Lazy.any({ produce: () => renderScope(this.ruleScope) }), // scope can use values such as stack id (see CloudFormationStackDriftDetectionCheck) - source: { - owner: 'CUSTOM_LAMBDA', - sourceDetails, - sourceIdentifier: props.lambdaFunction.functionArn, - }, - }); - - this.configRuleName = rule.ref; - this.configRuleArn = rule.attrArn; - this.configRuleId = rule.attrConfigRuleId; - this.configRuleComplianceType = rule.attrComplianceType; - - if (props.configurationChanges) { - this.isCustomWithChanges = true; - } - } -} - -/** - * Construction properties for a CustomPolicy. - */ -export interface CustomPolicyProps extends RuleProps { - /** - * The policy definition containing the logic for your AWS Config Custom Policy rule. - */ - readonly policyText: string; - - /** - * The boolean expression for enabling debug logging for your AWS Config Custom Policy rule. - * - * @default false - */ - readonly enableDebugLog?: boolean; -} - -/** - * A new custom policy. - * - * @resource AWS::Config::ConfigRule - */ -export class CustomPolicy extends RuleNew { - /** @attribute */ - public readonly configRuleName: string; - - /** @attribute */ - public readonly configRuleArn: string; - - /** @attribute */ - public readonly configRuleId: string; - - /** @attribute */ - public readonly configRuleComplianceType: string; - - constructor(scope: Construct, id: string, props: CustomPolicyProps) { - super(scope, id, { - physicalName: props.configRuleName, - }); - - if (!props.policyText || [...props.policyText].length === 0) { - throw new Error('Policy Text cannot be empty.'); - } - if ( [...props.policyText].length > 10000 ) { - throw new Error('Policy Text is limited to 10,000 characters or less.'); - } - - const sourceDetails: SourceDetail[] = []; - this.ruleScope = props.ruleScope; - - sourceDetails.push({ - eventSource: EventSource.AWS_CONFIG, - messageType: MessageType.CONFIGURATION_ITEM_CHANGE_NOTIFICATION, - }); - sourceDetails.push({ - eventSource: EventSource.AWS_CONFIG, - messageType: MessageType.OVERSIZED_CONFIGURATION_ITEM_CHANGE_NOTIFICATION, - }); - const rule = new CfnConfigRule(this, 'Resource', { - configRuleName: this.physicalName, - description: props.description, - inputParameters: props.inputParameters, - scope: Lazy.any({ produce: () => renderScope(this.ruleScope) }), // scope can use values such as stack id (see CloudFormationStackDriftDetectionCheck) - source: { - owner: 'CUSTOM_POLICY', - sourceDetails, - customPolicyDetails: { - enableDebugLogDelivery: props.enableDebugLog, - policyRuntime: 'guard-2.x.x', - policyText: props.policyText, - }, - }, - }); - - this.configRuleName = rule.ref; - this.configRuleArn = rule.attrArn; - this.configRuleId = rule.attrConfigRuleId; - this.configRuleComplianceType = rule.attrComplianceType; - this.isCustomWithChanges = true; - } -} - -/** - * Managed rules that are supported by AWS Config. - * @see https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html - */ -export class ManagedRuleIdentifiers { - /** - * Checks that the inline policies attached to your AWS Identity and Access Management users, - * roles, and groups do not allow blocked actions on all AWS Key Management Service keys. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-inline-policy-blocked-kms-actions.html - */ - public static readonly IAM_INLINE_POLICY_BLOCKED_KMS_ACTIONS = 'IAM_INLINE_POLICY_BLOCKED_KMS_ACTIONS'; - /** - * Checks that the managed AWS Identity and Access Management policies that you create do not - * allow blocked actions on all AWS AWS KMS keys. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-customer-policy-blocked-kms-actions.html - */ - public static readonly IAM_CUSTOMER_POLICY_BLOCKED_KMS_ACTIONS = 'IAM_CUSTOMER_POLICY_BLOCKED_KMS_ACTIONS'; - /** - * Checks whether the active access keys are rotated within the number of days specified in maxAccessKeyAge. - * @see https://docs.aws.amazon.com/config/latest/developerguide/access-keys-rotated.html - */ - public static readonly ACCESS_KEYS_ROTATED = 'ACCESS_KEYS_ROTATED'; - /** - * Checks whether AWS account is part of AWS Organizations. - * @see https://docs.aws.amazon.com/config/latest/developerguide/account-part-of-organizations.html - */ - public static readonly ACCOUNT_PART_OF_ORGANIZATIONS = 'ACCOUNT_PART_OF_ORGANIZATIONS'; - /** - * Checks whether ACM Certificates in your account are marked for expiration within the specified number of days. - * @see https://docs.aws.amazon.com/config/latest/developerguide/acm-certificate-expiration-check.html - */ - public static readonly ACM_CERTIFICATE_EXPIRATION_CHECK = 'ACM_CERTIFICATE_EXPIRATION_CHECK'; - /** - * Checks if an Application Load Balancer (ALB) is configured with a user defined desync mitigation mode. - * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-desync-mode-check.html - */ - public static readonly ALB_DESYNC_MODE_CHECK = 'ALB_DESYNC_MODE_CHECK'; - /** - * Checks if rule evaluates Application Load Balancers (ALBs) to ensure they are configured to drop http headers. - * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-http-drop-invalid-header-enabled.html - */ - public static readonly ALB_HTTP_DROP_INVALID_HEADER_ENABLED = 'ALB_HTTP_DROP_INVALID_HEADER_ENABLED'; - /** - * Checks whether HTTP to HTTPS redirection is configured on all HTTP listeners of Application Load Balancer. - * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-http-to-https-redirection-check.html - */ - public static readonly ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK = 'ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK'; - /** - * Checks if Web Application Firewall (WAF) is enabled on Application Load Balancers (ALBs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-waf-enabled.html - */ - public static readonly ALB_WAF_ENABLED = 'ALB_WAF_ENABLED'; - /** - * Checks if Amazon API Gateway V2 stages have access logging enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gwv2-access-logs-enabled.html - */ - public static readonly API_GWV2_ACCESS_LOGS_ENABLED = 'API_GWV2_ACCESS_LOGS_ENABLED'; - /** - * Checks if Amazon API Gatewayv2 API routes have an authorization type set. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gwv2-authorization-type-configured.html - */ - public static readonly API_GWV2_AUTHORIZATION_TYPE_CONFIGURED = 'API_GWV2_AUTHORIZATION_TYPE_CONFIGURED'; - /** - * Checks if an Amazon API Gateway API stage is using an AWS WAF Web ACL. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-associated-with-waf.html - */ - public static readonly API_GW_ASSOCIATED_WITH_WAF = 'API_GW_ASSOCIATED_WITH_WAF'; - /** - * Checks that all methods in Amazon API Gateway stages have caching enabled and encrypted. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-cache-enabled-and-encrypted.html - */ - public static readonly API_GW_CACHE_ENABLED_AND_ENCRYPTED = 'API_GW_CACHE_ENABLED_AND_ENCRYPTED'; - /** - * Checks that Amazon API Gateway APIs are of the type specified in the rule parameter endpointConfigurationType. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-endpoint-type-check.html - */ - public static readonly API_GW_ENDPOINT_TYPE_CHECK = 'API_GW_ENDPOINT_TYPE_CHECK'; - /** - * Checks that all methods in Amazon API Gateway stage has logging enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-execution-logging-enabled.html - */ - public static readonly API_GW_EXECUTION_LOGGING_ENABLED = 'API_GW_EXECUTION_LOGGING_ENABLED'; - /** - * Checks if a REST API stage uses an Secure Sockets Layer (SSL) certificate. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-ssl-enabled.html - */ - public static readonly API_GW_SSL_ENABLED = 'API_GW_SSL_ENABLED'; - /** - * Checks if AWS X-Ray tracing is enabled on Amazon API Gateway REST APIs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-xray-enabled.html - */ - public static readonly API_GW_XRAY_ENABLED = 'API_GW_XRAY_ENABLED'; - /** - * Checks whether running instances are using specified AMIs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/approved-amis-by-id.html - */ - public static readonly APPROVED_AMIS_BY_ID = 'APPROVED_AMIS_BY_ID'; - /** - * Checks whether running instances are using specified AMIs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/approved-amis-by-tag.html - */ - public static readonly APPROVED_AMIS_BY_TAG = 'APPROVED_AMIS_BY_TAG'; - /** - * Checks if a recovery point was created for Amazon Aurora DB clusters. - * @see https://docs.aws.amazon.com/config/latest/developerguide/aurora-last-backup-recovery-point-created.html - */ - public static readonly AURORA_LAST_BACKUP_RECOVERY_POINT_CREATED = 'AURORA_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks if an Amazon Aurora MySQL cluster has backtracking enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/aurora-mysql-backtracking-enabled.html - */ - public static readonly AURORA_MYSQL_BACKTRACKING_ENABLED = 'AURORA_MYSQL_BACKTRACKING_ENABLED'; - /** - * Checks if Amazon Aurora DB clusters are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/aurora-resources-protected-by-backup-plan.html - */ - public static readonly AURORA_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'AURORA_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks if Capacity Rebalancing is enabled for Amazon EC2 Auto Scaling groups that use multiple instance types. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-capacity-rebalancing.html - */ - public static readonly AUTOSCALING_CAPACITY_REBALANCING = 'AUTOSCALING_CAPACITY_REBALANCING'; - /** - * Checks whether your Auto Scaling groups that are associated with a load balancer are using - * Elastic Load Balancing health checks. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-group-elb-healthcheck-required.html - */ - public static readonly AUTOSCALING_GROUP_ELB_HEALTHCHECK_REQUIRED = 'AUTOSCALING_GROUP_ELB_HEALTHCHECK_REQUIRED'; - /** - * Checks whether only IMDSv2 is enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launchconfig-requires-imdsv2.html - */ - public static readonly AUTOSCALING_LAUNCHCONFIG_REQUIRES_IMDSV2 = 'AUTOSCALING_LAUNCHCONFIG_REQUIRES_IMDSV2'; - /** - * Checks the number of network hops that the metadata token can travel. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launch-config-hop-limit.html - */ - public static readonly AUTOSCALING_LAUNCH_CONFIG_HOP_LIMIT = 'AUTOSCALING_LAUNCH_CONFIG_HOP_LIMIT'; - /** - * Checks if Amazon EC2 Auto Scaling groups have public IP addresses enabled through Launch Configurations. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launch-config-public-ip-disabled.html - */ - public static readonly AUTOSCALING_LAUNCH_CONFIG_PUBLIC_IP_DISABLED = 'AUTOSCALING_LAUNCH_CONFIG_PUBLIC_IP_DISABLED'; - /** - * Checks if an Amazon Elastic Compute Cloud (EC2) Auto Scaling group is created from an EC2 launch template. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launch-template.html - */ - public static readonly AUTOSCALING_LAUNCH_TEMPLATE = 'AUTOSCALING_LAUNCH_TEMPLATE'; - /** - * Checks if the Auto Scaling group spans multiple Availability Zones. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-multiple-az.html - */ - public static readonly AUTOSCALING_MULTIPLE_AZ = 'AUTOSCALING_MULTIPLE_AZ'; - /** - * Checks if an Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling group uses multiple instance types. - * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-multiple-instance-types.html - */ - public static readonly AUTOSCALING_MULTIPLE_INSTANCE_TYPES = 'AUTOSCALING_MULTIPLE_INSTANCE_TYPES'; - /** - * Checks if a backup plan has a backup rule that satisfies the required frequency and retention period. - * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-plan-min-frequency-and-min-retention-check.html - */ - public static readonly BACKUP_PLAN_MIN_FREQUENCY_AND_MIN_RETENTION_CHECK = 'BACKUP_PLAN_MIN_FREQUENCY_AND_MIN_RETENTION_CHECK'; - /** - * Checks if a recovery point is encrypted. - * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-recovery-point-encrypted.html - */ - public static readonly BACKUP_RECOVERY_POINT_ENCRYPTED = 'BACKUP_RECOVERY_POINT_ENCRYPTED'; - /** - * Checks if a backup vault has an attached resource-based policy which prevents deletion of recovery points. - * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-recovery-point-manual-deletion-disabled.html - */ - public static readonly BACKUP_RECOVERY_POINT_MANUAL_DELETION_DISABLED = 'BACKUP_RECOVERY_POINT_MANUAL_DELETION_DISABLED'; - /** - * Checks if a recovery point expires no earlier than after the specified period. - * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-recovery-point-minimum-retention-check.html - */ - public static readonly BACKUP_RECOVERY_POINT_MINIMUM_RETENTION_CHECK = 'BACKUP_RECOVERY_POINT_MINIMUM_RETENTION_CHECK'; - /** - * Checks if an AWS Elastic Beanstalk environment is configured for enhanced health reporting. - * @see https://docs.aws.amazon.com/config/latest/developerguide/beanstalk-enhanced-health-reporting-enabled.html - */ - public static readonly BEANSTALK_ENHANCED_HEALTH_REPORTING_ENABLED = 'BEANSTALK_ENHANCED_HEALTH_REPORTING_ENABLED'; - /** - * Checks if Classic Load Balancers (CLB) are configured with a user defined Desync mitigation mode. - * @see https://docs.aws.amazon.com/config/latest/developerguide/clb-desync-mode-check.html - */ - public static readonly CLB_DESYNC_MODE_CHECK = 'CLB_DESYNC_MODE_CHECK'; - /** - * Checks if a Classic Load Balancer spans multiple Availability Zones (AZs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/clb-multiple-az.html - */ - public static readonly CLB_MULTIPLE_AZ = 'CLB_MULTIPLE_AZ'; - /** - * Checks whether an AWS CloudFormation stack's actual configuration differs, or has drifted, - * from it's expected configuration. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudformation-stack-drift-detection-check.html - */ - public static readonly CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK = 'CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK'; - /** - * Checks whether your CloudFormation stacks are sending event notifications to an SNS topic. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudformation-stack-notification-check.html - */ - public static readonly CLOUDFORMATION_STACK_NOTIFICATION_CHECK = 'CLOUDFORMATION_STACK_NOTIFICATION_CHECK'; - /** - * Checks if Amazon CloudFront distributions are configured to capture information from - * Amazon Simple Storage Service (Amazon S3) server access logs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-accesslogs-enabled.html - */ - public static readonly CLOUDFRONT_ACCESSLOGS_ENABLED = 'CLOUDFRONT_ACCESSLOGS_ENABLED'; - /** - * Checks if Amazon CloudFront distributions are associated with either WAF or WAFv2 web access control lists (ACLs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-associated-with-waf.html - */ - public static readonly CLOUDFRONT_ASSOCIATED_WITH_WAF = 'CLOUDFRONT_ASSOCIATED_WITH_WAF'; - /** - * Checks if the certificate associated with an Amazon CloudFront distribution is the default Secure Sockets Layer (SSL) certificate. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-custom-ssl-certificate.html - */ - public static readonly CLOUDFRONT_CUSTOM_SSL_CERTIFICATE = 'CLOUDFRONT_CUSTOM_SSL_CERTIFICATE'; - /** - * Checks if an Amazon CloudFront distribution is configured to return a specific object that is the default root object. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-default-root-object-configured.html - */ - public static readonly CLOUDFRONT_DEFAULT_ROOT_OBJECT_CONFIGURED = 'CLOUDFRONT_DEFAULT_ROOT_OBJECT_CONFIGURED'; - /** - * Checks if CloudFront distributions are using deprecated SSL protocols for HTTPS communication between - * CloudFront edge locations and custom origins. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-no-deprecated-ssl-protocols.html - */ - public static readonly CLOUDFRONT_NO_DEPRECATED_SSL_PROTOCOLS = 'CLOUDFRONT_NO_DEPRECATED_SSL_PROTOCOLS'; - /** - * Checks that Amazon CloudFront distribution with Amazon S3 Origin type has Origin Access Identity (OAI) configured. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-origin-access-identity-enabled.html - */ - public static readonly CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ENABLED = 'CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ENABLED'; - /** - * Checks whether an origin group is configured for the distribution of at least 2 origins in the - * origin group for Amazon CloudFront. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-origin-failover-enabled.html - */ - public static readonly CLOUDFRONT_ORIGIN_FAILOVER_ENABLED = 'CLOUDFRONT_ORIGIN_FAILOVER_ENABLED'; - /** - * Checks if Amazon CloudFront distributions are using a minimum security policy and cipher suite of TLSv1.2 or - * greater for viewer connections. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-security-policy-check.html - */ - public static readonly CLOUDFRONT_SECURITY_POLICY_CHECK = 'CLOUDFRONT_SECURITY_POLICY_CHECK' - /** - * Checks if Amazon CloudFront distributions are using a custom SSL certificate and are configured - * to use SNI to serve HTTPS requests. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-sni-enabled.html - */ - public static readonly CLOUDFRONT_SNI_ENABLED = 'CLOUDFRONT_SNI_ENABLED'; - /** - * Checks if Amazon CloudFront distributions are encrypting traffic to custom origins. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-traffic-to-origin-encrypted.html - */ - public static readonly CLOUDFRONT_TRAFFIC_TO_ORIGIN_ENCRYPTED = 'CLOUDFRONT_TRAFFIC_TO_ORIGIN_ENCRYPTED'; - /** - * Checks whether your Amazon CloudFront distributions use HTTPS (directly or via a redirection). - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-viewer-policy-https.html - */ - public static readonly CLOUDFRONT_VIEWER_POLICY_HTTPS = 'CLOUDFRONT_VIEWER_POLICY_HTTPS'; - /** - * Checks whether AWS CloudTrail trails are configured to send logs to Amazon CloudWatch Logs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloud-trail-cloud-watch-logs-enabled.html - */ - public static readonly CLOUD_TRAIL_CLOUD_WATCH_LOGS_ENABLED = 'CLOUD_TRAIL_CLOUD_WATCH_LOGS_ENABLED'; - /** - * Checks whether AWS CloudTrail is enabled in your AWS account. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudtrail-enabled.html - */ - public static readonly CLOUD_TRAIL_ENABLED = 'CLOUD_TRAIL_ENABLED'; - /** - * Checks whether AWS CloudTrail is configured to use the server side encryption (SSE) - * AWS Key Management Service (AWS KMS) customer master key (CMK) encryption. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloud-trail-encryption-enabled.html - */ - public static readonly CLOUD_TRAIL_ENCRYPTION_ENABLED = 'CLOUD_TRAIL_ENCRYPTION_ENABLED'; - /** - * Checks whether AWS CloudTrail creates a signed digest file with logs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloud-trail-log-file-validation-enabled.html - */ - public static readonly CLOUD_TRAIL_LOG_FILE_VALIDATION_ENABLED = 'CLOUD_TRAIL_LOG_FILE_VALIDATION_ENABLED'; - /** - * Checks whether at least one AWS CloudTrail trail is logging Amazon S3 data events for all S3 buckets. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudtrail-s3-dataevents-enabled.html - */ - public static readonly CLOUDTRAIL_S3_DATAEVENTS_ENABLED = 'CLOUDTRAIL_S3_DATAEVENTS_ENABLED'; - /** - * Checks that there is at least one AWS CloudTrail trail defined with security best practices. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudtrail-security-trail-enabled.html - */ - public static readonly CLOUDTRAIL_SECURITY_TRAIL_ENABLED = 'CLOUDTRAIL_SECURITY_TRAIL_ENABLED'; - /** - * Checks whether CloudWatch alarms have at least one alarm action, one INSUFFICIENT_DATA action, - * or one OK action enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-action-check.html - */ - public static readonly CLOUDWATCH_ALARM_ACTION_CHECK = 'CLOUDWATCH_ALARM_ACTION_CHECK'; - /** - * Checks if Amazon CloudWatch alarms actions are in enabled state. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-action-enabled-check.html - */ - public static readonly CLOUDWATCH_ALARM_ACTION_ENABLED_CHECK = 'CLOUDWATCH_ALARM_ACTION_ENABLED_CHECK'; - /** - * Checks whether the specified resource type has a CloudWatch alarm for the specified metric. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-resource-check.html - */ - public static readonly CLOUDWATCH_ALARM_RESOURCE_CHECK = 'CLOUDWATCH_ALARM_RESOURCE_CHECK'; - /** - * Checks whether CloudWatch alarms with the given metric name have the specified settings. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-settings-check.html - */ - public static readonly CLOUDWATCH_ALARM_SETTINGS_CHECK = 'CLOUDWATCH_ALARM_SETTINGS_CHECK'; - /** - * Checks whether a log group in Amazon CloudWatch Logs is encrypted with - * a AWS Key Management Service (KMS) managed Customer Master Keys (CMK). - * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-log-group-encrypted.html - */ - public static readonly CLOUDWATCH_LOG_GROUP_ENCRYPTED = 'CLOUDWATCH_LOG_GROUP_ENCRYPTED'; - /** - * Checks that key rotation is enabled for each key and matches to the key ID of the - * customer created customer master key (CMK). - * @see https://docs.aws.amazon.com/config/latest/developerguide/cmk-backing-key-rotation-enabled.html - */ - public static readonly CMK_BACKING_KEY_ROTATION_ENABLED = 'CMK_BACKING_KEY_ROTATION_ENABLED'; - /** - * Checks if an AWS CodeBuild project has encryption enabled for all of its artifacts. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-artifact-encryption.html - */ - public static readonly CODEBUILD_PROJECT_ARTIFACT_ENCRYPTION = 'CODEBUILD_PROJECT_ARTIFACT_ENCRYPTION'; - /** - * Checks if an AWS CodeBuild project environment has privileged mode enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-environment-privileged-check.html - */ - public static readonly CODEBUILD_PROJECT_ENVIRONMENT_PRIVILEGED_CHECK = 'CODEBUILD_PROJECT_ENVIRONMENT_PRIVILEGED_CHECK'; - /** - * Checks whether the project contains environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-envvar-awscred-check.html - */ - public static readonly CODEBUILD_PROJECT_ENVVAR_AWSCRED_CHECK = 'CODEBUILD_PROJECT_ENVVAR_AWSCRED_CHECK'; - /** - * Checks if an AWS CodeBuild project environment has at least one log option enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-logging-enabled.html - */ - public static readonly CODEBUILD_PROJECT_LOGGING_ENABLED = 'CODEBUILD_PROJECT_LOGGING_ENABLED'; - /** - * Checks if a AWS CodeBuild project configured with Amazon S3 Logs has encryption enabled for its logs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-s3-logs-encrypted.html - */ - public static readonly CODEBUILD_PROJECT_S3_LOGS_ENCRYPTED = 'CODEBUILD_PROJECT_S3_LOGS_ENCRYPTED'; - /** - * Checks whether the GitHub or Bitbucket source repository URL contains either personal access tokens - * or user name and password. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-source-repo-url-check.html - */ - public static readonly CODEBUILD_PROJECT_SOURCE_REPO_URL_CHECK = 'CODEBUILD_PROJECT_SOURCE_REPO_URL_CHECK'; - /** - * Checks if the deployment group is configured with automatic deployment rollback and - * deployment monitoring with alarms attached. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codedeploy-auto-rollback-monitor-enabled.html - */ - public static readonly CODEDEPLOY_AUTO_ROLLBACK_MONITOR_ENABLED = 'CODEDEPLOY_AUTO_ROLLBACK_MONITOR_ENABLED'; - /** - * Checks if the deployment group for EC2/On-Premises Compute Platform is configured with - * a minimum healthy hosts fleet percentage or host count greater than or equal to the input threshold. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codedeploy-ec2-minimum-healthy-hosts-configured.html - */ - public static readonly CODEDEPLOY_EC2_MINIMUM_HEALTHY_HOSTS_CONFIGURED = 'CODEDEPLOY_EC2_MINIMUM_HEALTHY_HOSTS_CONFIGURED'; - /** - * Checks if the deployment group for Lambda Compute Platform is not using the default deployment configuration. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codedeploy-lambda-allatonce-traffic-shift-disabled.html - */ - public static readonly CODEDEPLOY_LAMBDA_ALLATONCE_TRAFFIC_SHIFT_DISABLED = 'CODEDEPLOY_LAMBDA_ALLATONCE_TRAFFIC_SHIFT_DISABLED'; - /** - * Checks whether the first deployment stage of the AWS CodePipeline performs more than one deployment. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codepipeline-deployment-count-check.html - */ - public static readonly CODEPIPELINE_DEPLOYMENT_COUNT_CHECK = 'CODEPIPELINE_DEPLOYMENT_COUNT_CHECK'; - /** - * Checks whether each stage in the AWS CodePipeline deploys to more than N times the number of - * the regions the AWS CodePipeline has deployed in all the previous combined stages, - * where N is the region fanout number. - * @see https://docs.aws.amazon.com/config/latest/developerguide/codepipeline-region-fanout-check.html - */ - public static readonly CODEPIPELINE_REGION_FANOUT_CHECK = 'CODEPIPELINE_REGION_FANOUT_CHECK'; - /** - * Checks whether Amazon CloudWatch LogGroup retention period is set to specific number of days. - * @see https://docs.aws.amazon.com/config/latest/developerguide/cw-loggroup-retention-period-check.html - */ - public static readonly CW_LOGGROUP_RETENTION_PERIOD_CHECK = 'CW_LOGGROUP_RETENTION_PERIOD_CHECK'; - /** - * Checks that DynamoDB Accelerator (DAX) clusters are encrypted. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dax-encryption-enabled.html - */ - public static readonly DAX_ENCRYPTION_ENABLED = 'DAX_ENCRYPTION_ENABLED'; - /** - * Checks whether RDS DB instances have backups enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/db-instance-backup-enabled.html - */ - public static readonly RDS_DB_INSTANCE_BACKUP_ENABLED = 'DB_INSTANCE_BACKUP_ENABLED'; - /** - * Checks instances for specified tenancy. - * @see https://docs.aws.amazon.com/config/latest/developerguide/desired-instance-tenancy.html - */ - public static readonly EC2_DESIRED_INSTANCE_TENANCY = 'DESIRED_INSTANCE_TENANCY'; - /** - * Checks whether your EC2 instances are of the specified instance types. - * @see https://docs.aws.amazon.com/config/latest/developerguide/desired-instance-type.html - */ - public static readonly EC2_DESIRED_INSTANCE_TYPE = 'DESIRED_INSTANCE_TYPE'; - /** - * Checks whether AWS Database Migration Service replication instances are public. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dms-replication-not-public.html - */ - public static readonly DMS_REPLICATION_NOT_PUBLIC = 'DMS_REPLICATION_NOT_PUBLIC'; - /** - * Checks whether Auto Scaling or On-Demand is enabled on your DynamoDB tables and/or global secondary indexes. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-autoscaling-enabled.html - */ - public static readonly DYNAMODB_AUTOSCALING_ENABLED = 'DYNAMODB_AUTOSCALING_ENABLED'; - /** - * Checks whether Amazon DynamoDB table is present in AWS Backup plans. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-in-backup-plan.html - */ - public static readonly DYNAMODB_IN_BACKUP_PLAN = 'DYNAMODB_IN_BACKUP_PLAN'; - /** - * Checks if a recovery point was created for Amazon DynamoDB Tables within the specified period. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-last-backup-recovery-point-created.html - */ - public static readonly DYNAMODB_LAST_BACKUP_RECOVERY_POINT_CREATED = 'DYNAMODB_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks that point in time recovery (PITR) is enabled for Amazon DynamoDB tables. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-pitr-enabled.html - */ - public static readonly DYNAMODB_PITR_ENABLED = 'DYNAMODB_PITR_ENABLED'; - /** - * Checks if Amazon DynamoDB tables are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-resources-protected-by-backup-plan.html - */ - public static readonly DYNAMODB_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'DYNAMODB_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks whether Amazon DynamoDB table is encrypted with AWS Key Management Service (KMS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-table-encrypted-kms.html - */ - public static readonly DYNAMODB_TABLE_ENCRYPTED_KMS = 'DYNAMODB_TABLE_ENCRYPTED_KMS'; - /** - * Checks whether the Amazon DynamoDB tables are encrypted and checks their status. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-table-encryption-enabled.html - */ - public static readonly DYNAMODB_TABLE_ENCRYPTION_ENABLED = 'DYNAMODB_TABLE_ENCRYPTION_ENABLED'; - /** - * Checks whether provisioned DynamoDB throughput is approaching the maximum limit for your account. - * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-throughput-limit-check.html - */ - public static readonly DYNAMODB_THROUGHPUT_LIMIT_CHECK = 'DYNAMODB_THROUGHPUT_LIMIT_CHECK'; - /** - * Checks if Amazon Elastic Block Store (Amazon EBS) volumes are added in backup plans of AWS Backup. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-in-backup-plan.html - */ - public static readonly EBS_IN_BACKUP_PLAN = 'EBS_IN_BACKUP_PLAN'; - /** - * Checks whether Amazon Elastic File System (Amazon EFS) file systems are added - * in the backup plans of AWS Backup. - * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-in-backup-plan.html - */ - public static readonly EFS_IN_BACKUP_PLAN = 'EFS_IN_BACKUP_PLAN'; - /** - * Check that Amazon Elastic Block Store (EBS) encryption is enabled by default. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-ebs-encryption-by-default.html - */ - public static readonly EC2_EBS_ENCRYPTION_BY_DEFAULT = 'EC2_EBS_ENCRYPTION_BY_DEFAULT'; - /** - * Checks whether EBS optimization is enabled for your EC2 instances that can be EBS-optimized. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-optimized-instance.html - */ - public static readonly EBS_OPTIMIZED_INSTANCE = 'EBS_OPTIMIZED_INSTANCE'; - /** - * Checks if Amazon Elastic Block Store (Amazon EBS) volumes are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-resources-protected-by-backup-plan.html - */ - public static readonly EBS_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'EBS_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks whether Amazon Elastic Block Store snapshots are not publicly restorable. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-snapshot-public-restorable-check.html - */ - public static readonly EBS_SNAPSHOT_PUBLIC_RESTORABLE_CHECK = 'EBS_SNAPSHOT_PUBLIC_RESTORABLE_CHECK'; - /** - * Checks whether detailed monitoring is enabled for EC2 instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-detailed-monitoring-enabled.html - */ - public static readonly EC2_INSTANCE_DETAILED_MONITORING_ENABLED = 'EC2_INSTANCE_DETAILED_MONITORING_ENABLED'; - /** - * Checks whether the Amazon EC2 instances in your account are managed by AWS Systems Manager. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-managed-by-systems-manager.html - */ - public static readonly EC2_INSTANCE_MANAGED_BY_SSM = 'EC2_INSTANCE_MANAGED_BY_SSM'; - /** - * Checks if an Amazon Elastic Compute Cloud (Amazon EC2) instance has an Identity and Access - * Management (IAM) profile attached to it. This rule is NON_COMPLIANT if no IAM profile is - * attached to the Amazon EC2 instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-profile-attached.html - */ - public static readonly EC2_INSTANCE_PROFILE_ATTACHED = 'EC2_INSTANCE_PROFILE_ATTACHED'; - /** - * Checks if Amazon Elastic Compute Cloud (Amazon EC2) uses multiple ENIs (Elastic Network Interfaces) - * or Elastic Fabric Adapters (EFAs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-multiple-eni-check.html - */ - public static readonly EC2_INSTANCE_MULTIPLE_ENI_CHECK = 'EC2_INSTANCE_MULTIPLE_ENI_CHECK'; - /** - * Checks whether Amazon Elastic Compute Cloud (Amazon EC2) instances have a public IP association. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-no-public-ip.html - */ - public static readonly EC2_INSTANCE_NO_PUBLIC_IP = 'EC2_INSTANCE_NO_PUBLIC_IP'; - /** - * Checks if a recovery point was created for Amazon Elastic Compute Cloud (Amazon EC2) instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-last-backup-recovery-point-created.html - */ - public static readonly EC2_LAST_BACKUP_RECOVERY_POINT_CREATED = 'EC2_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks whether your EC2 instances belong to a virtual private cloud (VPC). - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instances-in-vpc.html - */ - public static readonly EC2_INSTANCES_IN_VPC = 'INSTANCES_IN_VPC'; - /** - * Checks that none of the specified applications are installed on the instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-applications-blacklisted.html - */ - public static readonly EC2_MANAGED_INSTANCE_APPLICATIONS_BLOCKED = 'EC2_MANAGEDINSTANCE_APPLICATIONS_BLACKLISTED'; - /** - * Checks whether all of the specified applications are installed on the instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-applications-required.html - */ - public static readonly EC2_MANAGED_INSTANCE_APPLICATIONS_REQUIRED = 'EC2_MANAGEDINSTANCE_APPLICATIONS_REQUIRED'; - /** - * Checks whether the compliance status of AWS Systems Manager association compliance is COMPLIANT - * or NON_COMPLIANT after the association execution on the instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-association-compliance-status-check.html - */ - public static readonly EC2_MANAGED_INSTANCE_ASSOCIATION_COMPLIANCE_STATUS_CHECK = 'EC2_MANAGEDINSTANCE_ASSOCIATION_COMPLIANCE_STATUS_CHECK'; - /** - * Checks whether instances managed by AWS Systems Manager are configured to collect blocked inventory types. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-inventory-blacklisted.html - */ - public static readonly EC2_MANAGED_INSTANCE_INVENTORY_BLOCKED = 'EC2_MANAGEDINSTANCE_INVENTORY_BLACKLISTED'; - /** - * Checks whether the compliance status of the Amazon EC2 Systems Manager patch compliance is - * COMPLIANT or NON_COMPLIANT after the patch installation on the instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-patch-compliance-status-check.html - */ - public static readonly EC2_MANAGED_INSTANCE_PATCH_COMPLIANCE_STATUS_CHECK = 'EC2_MANAGEDINSTANCE_PATCH_COMPLIANCE_STATUS_CHECK'; - /** - * Checks whether EC2 managed instances have the desired configurations. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-platform-check.html - */ - public static readonly EC2_MANAGED_INSTANCE_PLATFORM_CHECK = 'EC2_MANAGEDINSTANCE_PLATFORM_CHECK'; - /** - * Checks if running Amazon Elastic Compute Cloud (EC2) instances are launched using amazon key pairs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-no-amazon-key-pair.html - */ - public static readonly EC2_NO_AMAZON_KEY_PAIR = 'EC2_NO_AMAZON_KEY_PAIR'; - /** - * Checks if the virtualization type of an EC2 instance is paravirtual. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-paravirtual-instance-check.html - */ - public static readonly EC2_PARAVIRTUAL_INSTANCE_CHECK = 'EC2_PARAVIRTUAL_INSTANCE_CHECK'; - /** - * Checks if Amazon Elastic Compute Cloud (Amazon EC2) instances are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-resources-protected-by-backup-plan.html - */ - public static readonly EC2_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'EC2_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks that security groups are attached to Amazon Elastic Compute Cloud (Amazon EC2) instances - * or to an elastic network interface. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-security-group-attached-to-eni.html - */ - public static readonly EC2_SECURITY_GROUP_ATTACHED_TO_ENI = 'EC2_SECURITY_GROUP_ATTACHED_TO_ENI'; - /** - * Checks if non-default security groups are attached to Elastic network interfaces (ENIs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-security-group-attached-to-eni-periodic.html - */ - public static readonly EC2_SECURITY_GROUP_ATTACHED_TO_ENI_PERIODIC = 'EC2_SECURITY_GROUP_ATTACHED_TO_ENI_PERIODIC'; - /** - * Checks whether there are instances stopped for more than the allowed number of days. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-stopped-instance.html - */ - public static readonly EC2_STOPPED_INSTANCE = 'EC2_STOPPED_INSTANCE'; - /** - * Checks if an Amazon Elastic Compute Cloud (EC2) instance metadata - * has a specified token hop limit that is below the desired limit. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-token-hop-limit-check.html - */ - public static readonly EC2_TOKEN_HOP_LIMIT_CHECK = 'EC2_TOKEN_HOP_LIMIT_CHECK'; - /** - * Checks if Amazon Elastic Compute Cloud (Amazon EC2) Transit Gateways have 'AutoAcceptSharedAttachments' enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-transit-gateway-auto-vpc-attach-disabled.html - */ - public static readonly EC2_TRANSIT_GATEWAY_AUTO_VPC_ATTACH_DISABLED = 'EC2_TRANSIT_GATEWAY_AUTO_VPC_ATTACH_DISABLED'; - /** - * Checks whether EBS volumes are attached to EC2 instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-volume-inuse-check.html - */ - public static readonly EC2_VOLUME_INUSE_CHECK = 'EC2_VOLUME_INUSE_CHECK'; - /** - * Checks if a private Amazon Elastic Container Registry (ECR) repository has image scanning enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecr-private-image-scanning-enabled.html - */ - public static readonly ECR_PRIVATE_IMAGE_SCANNING_ENABLED = 'ECR_PRIVATE_IMAGE_SCANNING_ENABLED'; - /** - * Checks if a private Amazon Elastic Container Registry (ECR) repository has at least one lifecycle policy configured. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecr-private-lifecycle-policy-configured.html - */ - public static readonly ECR_PRIVATE_LIFECYCLE_POLICY_CONFIGURED = 'ECR_PRIVATE_LIFECYCLE_POLICY_CONFIGURED'; - /** - * Checks if a private Amazon Elastic Container Registry (ECR) repository has tag immutability enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecr-private-tag-immutability-enabled.html - */ - public static readonly ECR_PRIVATE_TAG_IMMUTABILITY_ENABLED = 'ECR_PRIVATE_TAG_IMMUTABILITY_ENABLED'; - /** - * Checks if the networking mode for active ECSTaskDefinitions is set to ‘awsvpc’. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-awsvpc-networking-enabled.html - */ - public static readonly ECS_AWSVPC_NETWORKING_ENABLED = 'ECS_AWSVPC_NETWORKING_ENABLED'; - /** - * Checks if the privileged parameter in the container definition of ECSTaskDefinitions is set to ‘true’. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instances-in-vpc.html - */ - public static readonly ECS_CONTAINERS_NONPRIVILEGED = 'ECS_CONTAINERS_NONPRIVILEGED'; - /** - * Checks if Amazon Elastic Container Service (Amazon ECS) Containers only have read-only access to its root filesystems. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-containers-readonly-access.html - */ - public static readonly ECS_CONTAINERS_READONLY_ACCESS = 'ECS_CONTAINERS_READONLY_ACCESS'; - /** - * Checks if Amazon Elastic Container Service clusters have container insights enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-container-insights-enabled.html - */ - public static readonly ECS_CONTAINER_INSIGHTS_ENABLED = 'ECS_CONTAINER_INSIGHTS_ENABLED'; - /** - * Checks if Amazon Elastic Container Service (ECS) Fargate Services - * is running on the latest Fargate platform version. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-fargate-latest-platform-version.html - */ - public static readonly ECS_FARGATE_LATEST_PLATFORM_VERSION = 'ECS_FARGATE_LATEST_PLATFORM_VERSION'; - /** - * Checks if secrets are passed as container environment variables. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-no-environment-secrets.html - */ - public static readonly ECS_NO_ENVIRONMENT_SECRETS = 'ECS_NO_ENVIRONMENT_SECRETS'; - /** - * Checks if logConfiguration is set on active ECS Task Definitions. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-task-definition-log-configuration.html - */ - public static readonly ECS_TASK_DEFINITION_LOG_CONFIGURATION = 'ECS_TASK_DEFINITION_LOG_CONFIGURATION'; - /** - * Checks if Amazon Elastic Container Service (ECS) task definitions have a set memory limit for its container definitions. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-task-definition-memory-hard-limit.html - */ - public static readonly ECS_TASK_DEFINITION_MEMORY_HARD_LIMIT = 'ECS_TASK_DEFINITION_MEMORY_HARD_LIMIT'; - /** - * Checks if ECSTaskDefinitions specify a user - * for Amazon Elastic Container Service (Amazon ECS) EC2 launch type containers to run on. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-task-definition-nonroot-user.html - */ - public static readonly ECS_TASK_DEFINITION_NONROOT_USER = 'ECS_TASK_DEFINITION_NONROOT_USER'; - /** - * Checks if ECSTaskDefinitions are configured to share a host’s process namespace - * with its Amazon Elastic Container Service (Amazon ECS) containers. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-stopped-instance.html - */ - public static readonly ECS_TASK_DEFINITION_PID_MODE_CHECK = 'ECS_TASK_DEFINITION_PID_MODE_CHECK'; - /** - * Checks if an Amazon Elastic Container Service (Amazon ECS) task definition - * with host networking mode has 'privileged' or 'user' container definitions. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-volume-inuse-check.html - */ - public static readonly EC2_VOLUME_IECS_TASK_DEFINITION_USER_FOR_HOST_MODE_CHECKNUSE_CHECK = 'ECS_TASK_DEFINITION_USER_FOR_HOST_MODE_CHECK'; - /** - * Checks if Amazon Elastic File System (Amazon EFS) access points are configured to enforce a root directory. - * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-access-point-enforce-root-directory.html - */ - public static readonly EFS_ACCESS_POINT_ENFORCE_ROOT_DIRECTORY = 'EFS_ACCESS_POINT_ENFORCE_ROOT_DIRECTORY'; - /** - * Checks if Amazon Elastic File System (Amazon EFS) access points are configured to enforce a user identity. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-volume-inuse-check.html - */ - public static readonly EFS_ACCESS_POINT_ENFORCE_USER_IDENTITY = 'EFS_ACCESS_POINT_ENFORCE_USER_IDENTITY'; - /** - * hecks whether Amazon Elastic File System (Amazon EFS) is configured to encrypt the file data - * using AWS Key Management Service (AWS KMS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-encrypted-check.html - */ - public static readonly EFS_ENCRYPTED_CHECK = 'EFS_ENCRYPTED_CHECK'; - /** - * Checks if a recovery point was created for Amazon Elastic File System (Amazon EFS) File Systems. - * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-last-backup-recovery-point-created.html - */ - public static readonly EFS_LAST_BACKUP_RECOVERY_POINT_CREATED = 'EFS_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks if Amazon Elastic File System (Amazon EFS) File Systems are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-resources-protected-by-backup-plan.html - */ - public static readonly EFS_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'EFS_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks whether all Elastic IP addresses that are allocated to a VPC are attached to - * EC2 instances or in-use elastic network interfaces (ENIs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/eip-attached.html - */ - public static readonly EIP_ATTACHED = 'EIP_ATTACHED'; - /** - * Checks whether Amazon Elasticsearch Service (Amazon ES) domains have encryption - * at rest configuration enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticsearch-encrypted-at-rest.html - */ - public static readonly ELASTICSEARCH_ENCRYPTED_AT_REST = 'ELASTICSEARCH_ENCRYPTED_AT_REST'; - /** - * Checks whether Amazon Elasticsearch Service (Amazon ES) domains are in - * Amazon Virtual Private Cloud (Amazon VPC). - * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticsearch-in-vpc-only.html - */ - public static readonly ELASTICSEARCH_IN_VPC_ONLY = 'ELASTICSEARCH_IN_VPC_ONLY'; - /** - * Check if the Amazon ElastiCache Redis clusters have automatic backup turned on. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticache-redis-cluster-automatic-backup-check.html - */ - public static readonly ELASTICACHE_REDIS_CLUSTER_AUTOMATIC_BACKUP_CHECK = 'ELASTICACHE_REDIS_CLUSTER_AUTOMATIC_BACKUP_CHECK'; - /** - * Checks whether your Amazon Elastic Compute Cloud (Amazon EC2) instance metadata version - * is configured with Instance Metadata Service Version 2 (IMDSv2). - * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-imdsv2-check.html - */ - public static readonly EC2_IMDSV2_CHECK = 'EC2_IMDSV2_CHECK'; - /** - * Checks if an Amazon Elastic Kubernetes Service (EKS) cluster is running the oldest supported version. - * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-oldest-supported-version.html - */ - public static readonly EKS_CLUSTER_OLDEST_SUPPORTED_VERSION = 'EKS_CLUSTER_OLDEST_SUPPORTED_VERSION'; - /** - * Checks if an Amazon Elastic Kubernetes Service (EKS) cluster is running a supported Kubernetes version. - * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-supported-version.html - */ - public static readonly EKS_CLUSTER_SUPPORTED_VERSION = 'EKS_CLUSTER_SUPPORTED_VERSION'; - /** - * Checks whether Amazon Elastic Kubernetes Service (Amazon EKS) endpoint is not publicly accessible. - * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-endpoint-no-public-access.html - */ - public static readonly EKS_ENDPOINT_NO_PUBLIC_ACCESS = 'EKS_ENDPOINT_NO_PUBLIC_ACCESS'; - /** - * Checks whether Amazon Elastic Kubernetes Service clusters are configured to have Kubernetes - * secrets encrypted using AWS Key Management Service (KMS) keys. - * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-secrets-encrypted.html - */ - public static readonly EKS_SECRETS_ENCRYPTED = 'EKS_SECRETS_ENCRYPTED'; - /** - * Check that Amazon ElasticSearch Service nodes are encrypted end to end. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticsearch-node-to-node-encryption-check.html - */ - public static readonly ELASTICSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK = 'ELASTICSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK'; - /** - * Checks if managed platform updates in an AWS Elastic Beanstalk environment is enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elastic-beanstalk-managed-updates-enabled.html - */ - public static readonly ELASTIC_BEANSTALK_MANAGED_UPDATES_ENABLED = 'ELASTIC_BEANSTALK_MANAGED_UPDATES_ENABLED'; - /** - * Checks if Application Load Balancers and Network Load Balancers - * have listeners that are configured to use certificates from AWS Certificate Manager (ACM). - * @see https://docs.aws.amazon.com/config/latest/developerguide/elbv2-acm-certificate-required.html - */ - public static readonly ELBV2_ACM_CERTIFICATE_REQUIRED = 'ELBV2_ACM_CERTIFICATE_REQUIRED'; - /** - * Checks if an Elastic Load Balancer V2 (Application, Network, or Gateway Load Balancer) - * has registered instances from multiple Availability Zones (AZ's). - * @see https://docs.aws.amazon.com/config/latest/developerguide/elbv2-multiple-az.html - */ - public static readonly ELBV2_MULTIPLE_AZ = 'ELBV2_MULTIPLE_AZ'; - /** - * Checks if cross-zone load balancing is enabled for the Classic Load Balancers (CLBs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-cross-zone-load-balancing-enabled.html - */ - public static readonly ELB_CROSS_ZONE_LOAD_BALANCING_ENABLED = 'ELB_CROSS_ZONE_LOAD_BALANCING_ENABLED'; - /** - * Checks whether your Classic Load Balancer is configured with SSL or HTTPS listeners. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-tls-https-listeners-only.html - */ - public static readonly ELB_TLS_HTTPS_LISTENERS_ONLY = 'ELB_TLS_HTTPS_LISTENERS_ONLY'; - /** - * Checks whether the Classic Load Balancers use SSL certificates provided by AWS Certificate Manager. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-acm-certificate-required.html - */ - public static readonly ELB_ACM_CERTIFICATE_REQUIRED = 'ELB_ACM_CERTIFICATE_REQUIRED'; - /** - * Checks whether your Classic Load Balancer SSL listeners are using a custom policy. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-custom-security-policy-ssl-check.html - */ - public static readonly ELB_CUSTOM_SECURITY_POLICY_SSL_CHECK = 'ELB_CUSTOM_SECURITY_POLICY_SSL_CHECK'; - /** - * Checks whether Elastic Load Balancing has deletion protection enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-deletion-protection-enabled.html - */ - public static readonly ELB_DELETION_PROTECTION_ENABLED = 'ELB_DELETION_PROTECTION_ENABLED'; - /** - * Checks whether the Application Load Balancer and the Classic Load Balancer have logging enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-logging-enabled.html - */ - public static readonly ELB_LOGGING_ENABLED = 'ELB_LOGGING_ENABLED'; - /** - * Checks whether your Classic Load Balancer SSL listeners are using a predefined policy. - * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-predefined-security-policy-ssl-check.html - */ - public static readonly ELB_PREDEFINED_SECURITY_POLICY_SSL_CHECK = 'ELB_PREDEFINED_SECURITY_POLICY_SSL_CHECK'; - /** - * Checks that Amazon EMR clusters have Kerberos enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/emr-kerberos-enabled.html - */ - public static readonly EMR_KERBEROS_ENABLED = 'EMR_KERBEROS_ENABLED'; - /** - * Checks whether Amazon Elastic MapReduce (EMR) clusters' master nodes have public IPs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/emr-master-no-public-ip.html - */ - public static readonly EMR_MASTER_NO_PUBLIC_IP = 'EMR_MASTER_NO_PUBLIC_IP'; - /** - * Checks whether the EBS volumes that are in an attached state are encrypted. - * @see https://docs.aws.amazon.com/config/latest/developerguide/encrypted-volumes.html - */ - public static readonly EBS_ENCRYPTED_VOLUMES = 'ENCRYPTED_VOLUMES'; - /** - * Checks whether the security groups associated inScope resources are compliant with the - * master security groups at each rule level based on allowSecurityGroup and denySecurityGroup flag. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-security-group-audit-policy-check.html - * - * @deprecated Inactive managed rule - * - */ - public static readonly FMS_SECURITY_GROUP_AUDIT_POLICY_CHECK = 'FMS_SECURITY_GROUP_AUDIT_POLICY_CHECK'; - /** - * Checks whether AWS Firewall Manager created security groups content is the same as the master security groups. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-security-group-content-check.html - * - * @deprecated Inactive managed rule - * - */ - public static readonly FMS_SECURITY_GROUP_CONTENT_CHECK = 'FMS_SECURITY_GROUP_CONTENT_CHECK'; - /** - * Checks whether Amazon EC2 or an elastic network interface is associated with AWS Firewall Manager security groups. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-security-group-resource-association-check.html - * - * @deprecated Inactive managed rule - * - */ - public static readonly FMS_SECURITY_GROUP_RESOURCE_ASSOCIATION_CHECK = 'FMS_SECURITY_GROUP_RESOURCE_ASSOCIATION_CHECK'; - /** - * Checks whether an Application Load Balancer, Amazon CloudFront distributions, - * Elastic Load Balancer or Elastic IP has AWS Shield protection. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-shield-resource-policy-check.html - */ - public static readonly FMS_SHIELD_RESOURCE_POLICY_CHECK = 'FMS_SHIELD_RESOURCE_POLICY_CHECK'; - /** - * Checks whether the web ACL is associated with an Application Load Balancer, API Gateway stage, - * or Amazon CloudFront distributions. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-webacl-resource-policy-check.html - */ - public static readonly FMS_WEBACL_RESOURCE_POLICY_CHECK = 'FMS_WEBACL_RESOURCE_POLICY_CHECK'; - /** - * Checks that the rule groups associate with the web ACL at the correct priority. - * The correct priority is decided by the rank of the rule groups in the ruleGroups parameter. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-webacl-rulegroup-association-check.html - */ - public static readonly FMS_WEBACL_RULEGROUP_ASSOCIATION_CHECK = 'FMS_WEBACL_RULEGROUP_ASSOCIATION_CHECK'; - /** - * Checks if a recovery point was created for Amazon FSx File Systems. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fsx-last-backup-recovery-point-created.html - */ - public static readonly FSX_LAST_BACKUP_RECOVERY_POINT_CREATED = 'FSX_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks if Amazon FSx File Systems are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/fsx-resources-protected-by-backup-plan.html - */ - public static readonly FSX_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'FSX_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks whether Amazon GuardDuty is enabled in your AWS account and region. If you provide an AWS account for centralization, - * the rule evaluates the Amazon GuardDuty results in the centralized account. - * @see https://docs.aws.amazon.com/config/latest/developerguide/guardduty-enabled-centralized.html - */ - public static readonly GUARDDUTY_ENABLED_CENTRALIZED = 'GUARDDUTY_ENABLED_CENTRALIZED'; - /** - * Checks whether the Amazon GuardDuty has findings that are non archived. - * @see https://docs.aws.amazon.com/config/latest/developerguide/guardduty-non-archived-findings.html - */ - public static readonly GUARDDUTY_NON_ARCHIVED_FINDINGS = 'GUARDDUTY_NON_ARCHIVED_FINDINGS'; - /** - * Checks that inline policy feature is not in use. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-no-inline-policy-check.html - */ - public static readonly IAM_NO_INLINE_POLICY_CHECK = 'IAM_NO_INLINE_POLICY_CHECK'; - /** - * Checks whether IAM groups have at least one IAM user. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-group-has-users-check.html - */ - public static readonly IAM_GROUP_HAS_USERS_CHECK = 'IAM_GROUP_HAS_USERS_CHECK'; - /** - * Checks whether the account password policy for IAM users meets the specified requirements - * indicated in the parameters. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-password-policy.html - */ - public static readonly IAM_PASSWORD_POLICY = 'IAM_PASSWORD_POLICY'; - /** - * Checks whether for each IAM resource, a policy ARN in the input parameter is attached to the IAM resource. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-blacklisted-check.html - */ - public static readonly IAM_POLICY_BLOCKED_CHECK = 'IAM_POLICY_BLACKLISTED_CHECK'; - /** - * Checks whether the IAM policy ARN is attached to an IAM user, or an IAM group with one or more IAM users, - * or an IAM role with one or more trusted entity. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-in-use.html - */ - public static readonly IAM_POLICY_IN_USE = 'IAM_POLICY_IN_USE'; - /** - * Checks the IAM policies that you create for Allow statements that grant permissions to all actions on all resources. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-no-statements-with-admin-access.html - */ - public static readonly IAM_POLICY_NO_STATEMENTS_WITH_ADMIN_ACCESS = 'IAM_POLICY_NO_STATEMENTS_WITH_ADMIN_ACCESS'; - /** - * Checks if AWS Identity and Access Management (IAM) policies that you create grant permissions to all actions on individual AWS resources. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-no-statements-with-full-access.html - */ - public static readonly IAM_POLICY_NO_STATEMENTS_WITH_FULL_ACCESS = 'IAM_POLICY_NO_STATEMENTS_WITH_FULL_ACCESS'; - /** - * Checks that AWS Identity and Access Management (IAM) policies in a list of policies are attached to all AWS roles. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-role-managed-policy-check.html - */ - public static readonly IAM_ROLE_MANAGED_POLICY_CHECK = 'IAM_ROLE_MANAGED_POLICY_CHECK'; - /** - * Checks whether the root user access key is available. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-root-access-key-check.html - */ - public static readonly IAM_ROOT_ACCESS_KEY_CHECK = 'IAM_ROOT_ACCESS_KEY_CHECK'; - /** - * Checks whether IAM users are members of at least one IAM group. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-group-membership-check.html - */ - public static readonly IAM_USER_GROUP_MEMBERSHIP_CHECK = 'IAM_USER_GROUP_MEMBERSHIP_CHECK'; - /** - * Checks whether the AWS Identity and Access Management users have multi-factor authentication (MFA) enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-mfa-enabled.html - */ - public static readonly IAM_USER_MFA_ENABLED = 'IAM_USER_MFA_ENABLED'; - /** - * Checks that none of your IAM users have policies attached. IAM users must inherit permissions from IAM groups or roles. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-no-policies-check.html - */ - public static readonly IAM_USER_NO_POLICIES_CHECK = 'IAM_USER_NO_POLICIES_CHECK'; - /** - * Checks whether your AWS Identity and Access Management (IAM) users have passwords or - * active access keys that have not been used within the specified number of days you provided. - * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-unused-credentials-check.html - */ - public static readonly IAM_USER_UNUSED_CREDENTIALS_CHECK = 'IAM_USER_UNUSED_CREDENTIALS_CHECK'; - /** - * Checks that Internet gateways (IGWs) are only attached to an authorized Amazon Virtual Private Cloud (VPCs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/internet-gateway-authorized-vpc-only.html - */ - public static readonly INTERNET_GATEWAY_AUTHORIZED_VPC_ONLY = 'INTERNET_GATEWAY_AUTHORIZED_VPC_ONLY'; - /** - * Checks if Amazon Kinesis streams are encrypted at rest with server-side encryption. - * @see https://docs.aws.amazon.com/config/latest/developerguide/kinesis-stream-encrypted.html - */ - public static readonly KINESIS_STREAM_ENCRYPTED = 'KINESIS_STREAM_ENCRYPTED'; - /** - * Checks whether customer master keys (CMKs) are not scheduled for deletion in AWS Key Management Service (KMS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/kms-cmk-not-scheduled-for-deletion.html - */ - public static readonly KMS_CMK_NOT_SCHEDULED_FOR_DELETION = 'KMS_CMK_NOT_SCHEDULED_FOR_DELETION'; - /** - * Checks whether the AWS Lambda function is configured with function-level concurrent execution limit. - * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-concurrency-check.html - */ - public static readonly LAMBDA_CONCURRENCY_CHECK = 'LAMBDA_CONCURRENCY_CHECK'; - /** - * Checks whether an AWS Lambda function is configured with a dead-letter queue. - * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-dlq-check.html - */ - public static readonly LAMBDA_DLQ_CHECK = 'LAMBDA_DLQ_CHECK'; - /** - * Checks whether the AWS Lambda function policy attached to the Lambda resource prohibits public access. - * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-function-public-access-prohibited.html - */ - public static readonly LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED = 'LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED'; - /** - * Checks that the lambda function settings for runtime, role, timeout, and memory size match the expected values. - * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-function-settings-check.html - */ - public static readonly LAMBDA_FUNCTION_SETTINGS_CHECK = 'LAMBDA_FUNCTION_SETTINGS_CHECK'; - /** - * Checks whether an AWS Lambda function is in an Amazon Virtual Private Cloud. - * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-inside-vpc.html - */ - public static readonly LAMBDA_INSIDE_VPC = 'LAMBDA_INSIDE_VPC'; - /** - * Checks if Lambda has more than 1 availability zone associated. - * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-vpc-multi-az-check.html - */ - public static readonly LAMBDA_VPC_MULTI_AZ_CHECK = 'LAMBDA_VPC_MULTI_AZ_CHECK'; - /** - * Checks whether AWS Multi-Factor Authentication (MFA) is enabled for all IAM users that use a console password. - * @see https://docs.aws.amazon.com/config/latest/developerguide/mfa-enabled-for-iam-console-access.html - */ - public static readonly MFA_ENABLED_FOR_IAM_CONSOLE_ACCESS = 'MFA_ENABLED_FOR_IAM_CONSOLE_ACCESS'; - /** - * Checks that there is at least one multi-region AWS CloudTrail. - * @see https://docs.aws.amazon.com/config/latest/developerguide/multi-region-cloudtrail-enabled.html - */ - public static readonly CLOUDTRAIL_MULTI_REGION_ENABLED = 'MULTI_REGION_CLOUD_TRAIL_ENABLED'; - /** - * Checks if default ports for SSH/RDP ingress traffic for network access control lists (NACLs) is unrestricted. - * @see https://docs.aws.amazon.com/config/latest/developerguide/nacl-no-unrestricted-ssh-rdp.html - */ - public static readonly NACL_NO_UNRESTRICTED_SSH_RDP = 'NACL_NO_UNRESTRICTED_SSH_RDP'; - /** - * Checks if an AWS Network Firewall policy is configured with a user defined stateless default action for fragmented packets. - * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-policy-default-action-fragment-packets.html - */ - public static readonly NETFW_POLICY_DEFAULT_ACTION_FRAGMENT_PACKETS = 'NETFW_POLICY_DEFAULT_ACTION_FRAGMENT_PACKETS'; - /** - * Checks if an AWS Network Firewall policy is configured with a user defined default stateless action for full packets. - * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-policy-default-action-full-packets.html - */ - public static readonly NETFW_POLICY_DEFAULT_ACTION_FULL_PACKETS = 'NETFW_POLICY_DEFAULT_ACTION_FULL_PACKETS'; - /** - * Check AWS Network Firewall policy is associated with stateful OR stateless rule groups. - * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-policy-rule-group-associated.html - */ - public static readonly NETFW_POLICY_RULE_GROUP_ASSOCIATED = 'NETFW_POLICY_RULE_GROUP_ASSOCIATED'; - /** - * Checks if a Stateless Network Firewall Rule Group contains rules. - * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-stateless-rule-group-not-empty.html - */ - public static readonly NETFW_STATELESS_RULE_GROUP_NOT_EMPTY = 'NETFW_STATELESS_RULE_GROUP_NOT_EMPTY'; - /** - * Checks if cross-zone load balancing is enabled on Network Load Balancers (NLBs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/nlb-cross-zone-load-balancing-enabled.html - */ - public static readonly NLB_CROSS_ZONE_LOAD_BALANCING_ENABLED = 'NLB_CROSS_ZONE_LOAD_BALANCING_ENABLED'; - /** - * Checks if Amazon OpenSearch Service domains have fine-grained access control enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-access-control-enabled.html - */ - public static readonly OPENSEARCH_ACCESS_CONTROL_ENABLED = 'OPENSEARCH_ACCESS_CONTROL_ENABLED'; - /** - * Checks if Amazon OpenSearch Service domains have audit logging enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-audit-logging-enabled.html - */ - public static readonly OPENSEARCH_AUDIT_LOGGING_ENABLED = 'OPENSEARCH_AUDIT_LOGGING_ENABLED'; - /** - * Checks if Amazon OpenSearch Service domains are configured with at least three data nodes and zoneAwarenessEnabled is true. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-data-node-fault-tolerance.html - */ - public static readonly OPENSEARCH_DATA_NODE_FAULT_TOLERANCE = 'OPENSEARCH_DATA_NODE_FAULT_TOLERANCE'; - /** - * Checks if Amazon OpenSearch Service domains have encryption at rest configuration enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-encrypted-at-rest.html - */ - public static readonly OPENSEARCH_ENCRYPTED_AT_REST = 'OPENSEARCH_ENCRYPTED_AT_REST'; - /** - * Checks whether connections to OpenSearch domains are using HTTPS. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-https-required.html - */ - public static readonly OPENSEARCH_HTTPS_REQUIRED = 'OPENSEARCH_HTTPS_REQUIRED'; - /** - * Checks if Amazon OpenSearch Service domains are in an Amazon Virtual Private Cloud (VPC). - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-in-vpc-only.html - */ - public static readonly OPENSEARCH_IN_VPC_ONLY = 'OPENSEARCH_IN_VPC_ONLY'; - /** - * Checks if Amazon OpenSearch Service domains are configured to send logs to Amazon CloudWatch Logs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-logs-to-cloudwatch.html - */ - public static readonly OPENSEARCH_LOGS_TO_CLOUDWATCH = 'OPENSEARCH_LOGS_TO_CLOUDWATCH'; - /** - * Check if Amazon OpenSearch Service nodes are encrypted end to end. - * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-node-to-node-encryption-check.html - */ - public static readonly OPENSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK = 'OPENSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK'; - /** - * Checks if Amazon Relational Database Service (RDS) database instances are configured for automatic minor version upgrades. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-automatic-minor-version-upgrade-enabled.html - */ - public static readonly RDS_AUTOMATIC_MINOR_VERSION_UPGRADE_ENABLED = 'RDS_AUTOMATIC_MINOR_VERSION_UPGRADE_ENABLED'; - /** - * Checks if an Amazon Relational Database Service (Amazon RDS) database cluster has changed the admin username from its default value. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-default-admin-check.html - */ - public static readonly RDS_CLUSTER_DEFAULT_ADMIN_CHECK = 'RDS_CLUSTER_DEFAULT_ADMIN_CHECK'; - /** - * Checks if an Amazon Relational Database Service (Amazon RDS) cluster has deletion protection enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-deletion-protection-enabled.html - */ - public static readonly RDS_CLUSTER_DELETION_PROTECTION_ENABLED = 'RDS_CLUSTER_DELETION_PROTECTION_ENABLED'; - /** - * Checks if an Amazon RDS Cluster has AWS Identity and Access Management (IAM) authentication enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-iam-authentication-enabled.html - */ - public static readonly RDS_CLUSTER_IAM_AUTHENTICATION_ENABLED = 'RDS_CLUSTER_IAM_AUTHENTICATION_ENABLED'; - /** - * Checks if Multi-AZ replication is enabled on Amazon Aurora and Hermes clusters managed by Amazon Relational Database Service (Amazon RDS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-multi-az-enabled.html - */ - public static readonly RDS_CLUSTER_MULTI_AZ_ENABLED = 'RDS_CLUSTER_MULTI_AZ_ENABLED'; - /** - * Checks if an Amazon Relational Database Service (Amazon RDS) database has changed the admin username from its default value. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-default-admin-check.html - */ - public static readonly RDS_INSTANCE_DEFAULT_ADMIN_CHECK = 'RDS_INSTANCE_DEFAULT_ADMIN_CHECK'; - /** - *Checks if there are any Amazon Relational Database Service (RDS) DB security groups that are not the default DB security group. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-db-security-group-not-allowed.html - */ - public static readonly RDS_DB_SECURITY_GROUP_NOT_ALLOWED = 'RDS_DB_SECURITY_GROUP_NOT_ALLOWED'; - /** - * Checks if an Amazon Relational Database Service (Amazon RDS) instance has deletion protection enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-deletion-protection-enabled.html - */ - public static readonly RDS_INSTANCE_DELETION_PROTECTION_ENABLED = 'RDS_INSTANCE_DELETION_PROTECTION_ENABLED'; - /** - * Checks if an Amazon RDS instance has AWS Identity and Access Management (IAM) authentication enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-iam-authentication-enabled.html - */ - public static readonly RDS_INSTANCE_IAM_AUTHENTICATION_ENABLED = 'RDS_INSTANCE_IAM_AUTHENTICATION_ENABLED'; - /** - * Checks that respective logs of Amazon Relational Database Service (Amazon RDS) are enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-logging-enabled.html - */ - public static readonly RDS_LOGGING_ENABLED = 'RDS_LOGGING_ENABLED'; - /** - * Checks that Amazon Redshift automated snapshots are enabled for clusters. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-backup-enabled.html - */ - public static readonly REDSHIFT_BACKUP_ENABLED = 'REDSHIFT_BACKUP_ENABLED'; - /** - * Checks whether enhanced monitoring is enabled for Amazon Relational Database Service (Amazon RDS) instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-enhanced-monitoring-enabled.html - */ - public static readonly RDS_ENHANCED_MONITORING_ENABLED = 'RDS_ENHANCED_MONITORING_ENABLED'; - /** - * Checks whether Amazon Relational Database Service (Amazon RDS) DB snapshots are encrypted. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-snapshot-encrypted.html - */ - public static readonly RDS_SNAPSHOT_ENCRYPTED = 'RDS_SNAPSHOT_ENCRYPTED'; - /** - * Checks whether Amazon Redshift clusters require TLS/SSL encryption to connect to SQL clients. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-require-tls-ssl.html - */ - public static readonly REDSHIFT_REQUIRE_TLS_SSL = 'REDSHIFT_REQUIRE_TLS_SSL'; - /** - * Checks whether Amazon RDS database is present in back plans of AWS Backup. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-in-backup-plan.html - */ - public static readonly RDS_IN_BACKUP_PLAN = 'RDS_IN_BACKUP_PLAN'; - /** - * Checks if a recovery point was created for Amazon Relational Database Service (Amazon RDS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-last-backup-recovery-point-created.html - */ - public static readonly RDS_LAST_BACKUP_RECOVERY_POINT_CREATED = 'RDS_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Check whether the Amazon Relational Database Service instances are not publicly accessible. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-public-access-check.html - */ - public static readonly RDS_INSTANCE_PUBLIC_ACCESS_CHECK = 'RDS_INSTANCE_PUBLIC_ACCESS_CHECK'; - /** - * Checks whether high availability is enabled for your RDS DB instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-multi-az-support.html - */ - public static readonly RDS_MULTI_AZ_SUPPORT = 'RDS_MULTI_AZ_SUPPORT'; - /** - * Checks if Amazon Relational Database Service (Amazon RDS) instances are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-resources-protected-by-backup-plan.html - */ - public static readonly RDS_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'RDS_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks if Amazon Relational Database Service (Amazon RDS) snapshots are public. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-snapshots-public-prohibited.html - */ - public static readonly RDS_SNAPSHOTS_PUBLIC_PROHIBITED = 'RDS_SNAPSHOTS_PUBLIC_PROHIBITED'; - /** - * Checks whether storage encryption is enabled for your RDS DB instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-storage-encrypted.html - */ - public static readonly RDS_STORAGE_ENCRYPTED = 'RDS_STORAGE_ENCRYPTED'; - /** - * Checks if Amazon Redshift clusters are logging audits to a specific bucket. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-audit-logging-enabled.html - */ - public static readonly REDSHIFT_AUDIT_LOGGING_ENABLED = 'REDSHIFT_AUDIT_LOGGING_ENABLED'; - /** - * Checks whether Amazon Redshift clusters have the specified settings. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-configuration-check.html - */ - public static readonly REDSHIFT_CLUSTER_CONFIGURATION_CHECK = 'REDSHIFT_CLUSTER_CONFIGURATION_CHECK'; - /** - * Checks if Amazon Redshift clusters are using a specified AWS Key Management Service (AWS KMS) key for encryption. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-kms-enabled.html - */ - public static readonly REDSHIFT_CLUSTER_KMS_ENABLED = 'REDSHIFT_CLUSTER_KMS_ENABLED'; - /** - * Checks whether Amazon Redshift clusters have the specified maintenance settings. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-maintenancesettings-check.html - */ - public static readonly REDSHIFT_CLUSTER_MAINTENANCE_SETTINGS_CHECK = 'REDSHIFT_CLUSTER_MAINTENANCESETTINGS_CHECK'; - /** - * Checks whether Amazon Redshift clusters are not publicly accessible. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-public-access-check.html - */ - public static readonly REDSHIFT_CLUSTER_PUBLIC_ACCESS_CHECK = 'REDSHIFT_CLUSTER_PUBLIC_ACCESS_CHECK'; - /** - * Checks if an Amazon Redshift cluster has changed the admin username from its default value. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-default-admin-check.html - */ - public static readonly REDSHIFT_DEFAULT_ADMIN_CHECK = 'REDSHIFT_DEFAULT_ADMIN_CHECK'; - /** - * Checks if a Redshift cluster has changed its database name from the default value. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-default-db-name-check.html - */ - public static readonly REDSHIFT_DEFAULT_DB_NAME_CHECK = 'REDSHIFT_DEFAULT_DB_NAME_CHECK'; - /** - * Checks if Amazon Redshift cluster has 'enhancedVpcRouting' enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-enhanced-vpc-routing-enabled.html - */ - public static readonly REDSHIFT_ENHANCED_VPC_ROUTING_ENABLED = 'REDSHIFT_ENHANCED_VPC_ROUTING_ENABLED'; - /** - * Checks whether your resources have the tags that you specify. - * For example, you can check whether your Amazon EC2 instances have the CostCenter tag. - * @see https://docs.aws.amazon.com/config/latest/developerguide/required-tags.html - */ - public static readonly REQUIRED_TAGS = 'REQUIRED_TAGS'; - /** - * Checks whether the security groups in use do not allow unrestricted incoming TCP traffic to the specified ports. - * @see https://docs.aws.amazon.com/config/latest/developerguide/restricted-common-ports.html - */ - public static readonly EC2_SECURITY_GROUPS_RESTRICTED_INCOMING_TRAFFIC = 'RESTRICTED_INCOMING_TRAFFIC'; - /** - * Checks whether the incoming SSH traffic for the security groups is accessible. - * @see https://docs.aws.amazon.com/config/latest/developerguide/restricted-ssh.html - */ - public static readonly EC2_SECURITY_GROUPS_INCOMING_SSH_DISABLED = 'INCOMING_SSH_DISABLED'; - /** - * Checks whether your AWS account is enabled to use multi-factor authentication (MFA) hardware - * device to sign in with root credentials. - * @see https://docs.aws.amazon.com/config/latest/developerguide/root-account-hardware-mfa-enabled.html - */ - public static readonly ROOT_ACCOUNT_HARDWARE_MFA_ENABLED = 'ROOT_ACCOUNT_HARDWARE_MFA_ENABLED'; - /** - * Checks whether users of your AWS account require a multi-factor authentication (MFA) device - * to sign in with root credentials. - * @see https://docs.aws.amazon.com/config/latest/developerguide/root-account-mfa-enabled.html - */ - public static readonly ROOT_ACCOUNT_MFA_ENABLED = 'ROOT_ACCOUNT_MFA_ENABLED'; - /** - * Checks whether Amazon Simple Storage Service (Amazon S3) bucket has lock enabled, by default. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-default-lock-enabled.html - */ - public static readonly S3_BUCKET_DEFAULT_LOCK_ENABLED = 'S3_BUCKET_DEFAULT_LOCK_ENABLED'; - /** - * Checks whether the Amazon Simple Storage Service (Amazon S3) buckets are encrypted - * with AWS Key Management Service (AWS KMS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-default-encryption-kms.html - */ - public static readonly S3_DEFAULT_ENCRYPTION_KMS = 'S3_DEFAULT_ENCRYPTION_KMS'; - /** - * Checks that AWS Security Hub is enabled for an AWS account. - * @see https://docs.aws.amazon.com/config/latest/developerguide/securityhub-enabled.html - */ - public static readonly SECURITYHUB_ENABLED = 'SECURITYHUB_ENABLED'; - /** - * Checks whether Amazon SNS topic is encrypted with AWS Key Management Service (AWS KMS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/sns-encrypted-kms.html - */ - public static readonly SNS_ENCRYPTED_KMS = 'SNS_ENCRYPTED_KMS'; - /** - * Checks if Amazon Simple Notification Service (SNS) logging is enabled - * for the delivery status of notification messages sent to a topic for the endpoints. - * @see https://docs.aws.amazon.com/config/latest/developerguide/sns-topic-message-delivery-notification-enabled.html - */ - public static readonly SNS_TOPIC_MESSAGE_DELIVERY_NOTIFICATION_ENABLED = 'SNS_TOPIC_MESSAGE_DELIVERY_NOTIFICATION_ENABLED'; - /** - * Checks if AWS Systems Manager documents owned by the account are public. - * @see https://docs.aws.amazon.com/config/latest/developerguide/ssm-document-not-public.html - */ - public static readonly SSM_DOCUMENT_NOT_PUBLIC = 'SSM_DOCUMENT_NOT_PUBLIC'; - /** - * Checks if a recovery point was created for AWS Storage Gateway volumes. - * @see https://docs.aws.amazon.com/config/latest/developerguide/storagegateway-last-backup-recovery-point-created.html - */ - public static readonly STORAGEGATEWAY_LAST_BACKUP_RECOVERY_POINT_CREATED = 'STORAGEGATEWAY_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * hecks if Amazon Virtual Private Cloud (Amazon VPC) subnets are assigned a public IP address. - * @see https://docs.aws.amazon.com/config/latest/developerguide/subnet-auto-assign-public-ip-disabled.html - */ - public static readonly SUBNET_AUTO_ASSIGN_PUBLIC_IP_DISABLED = 'SUBNET_AUTO_ASSIGN_PUBLIC_IP_DISABLED'; - /** - * Checks whether the required public access block settings are configured from account level. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-account-level-public-access-blocks.html - */ - public static readonly S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS = 'S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS'; - /** - * Checks if the required public access block settings are configured from account level. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-account-level-public-access-blocks-periodic.html - */ - public static readonly S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS_PERIODIC = 'S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS_PERIODIC'; - /** - * Checks if Amazon Simple Storage Service (Amazon S3) Buckets allow user permissions through access control lists (ACLs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-acl-prohibited.html - */ - public static readonly S3_BUCKET_ACL_PROHIBITED = 'S3_BUCKET_ACL_PROHIBITED'; - /** - * Checks if the Amazon Simple Storage Service bucket policy does not allow blacklisted bucket-level - * and object-level actions on resources in the bucket for principals from other AWS accounts. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-blacklisted-actions-prohibited.html - */ - public static readonly S3_BUCKET_BLOCKED_ACTIONS_PROHIBITED = 'S3_BUCKET_BLACKLISTED_ACTIONS_PROHIBITED'; - /** - * Checks if Amazon Simple Storage Service (Amazon S3) buckets are publicly accessible. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-level-public-access-prohibited.html - */ - public static readonly S3_BUCKET_LEVEL_PUBLIC_ACCESS_PROHIBITED = 'S3_BUCKET_LEVEL_PUBLIC_ACCESS_PROHIBITED'; - /** - * Checks whether logging is enabled for your S3 buckets. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-logging-enabled.html - */ - public static readonly S3_BUCKET_LOGGING_ENABLED = 'S3_BUCKET_LOGGING_ENABLED'; - /** - * Checks that the access granted by the Amazon S3 bucket is restricted by any of the AWS principals, federated users, - * service principals, IP addresses, or VPCs that you provide. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-policy-grantee-check.html - */ - public static readonly S3_BUCKET_POLICY_GRANTEE_CHECK = 'S3_BUCKET_POLICY_GRANTEE_CHECK'; - /** - * Checks if your Amazon Simple Storage Service bucket policies do not allow other inter-account permissions - * than the control Amazon S3 bucket policy that you provide. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-policy-not-more-permissive.html - */ - public static readonly S3_BUCKET_POLICY_NOT_MORE_PERMISSIVE = 'S3_BUCKET_POLICY_NOT_MORE_PERMISSIVE'; - /** - * Checks if your Amazon S3 buckets do not allow public read access. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-public-read-prohibited.html - */ - public static readonly S3_BUCKET_PUBLIC_READ_PROHIBITED = 'S3_BUCKET_PUBLIC_READ_PROHIBITED'; - /** - * Checks that your Amazon S3 buckets do not allow public write access. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-public-write-prohibited.html - */ - public static readonly S3_BUCKET_PUBLIC_WRITE_PROHIBITED = 'S3_BUCKET_PUBLIC_WRITE_PROHIBITED'; - /** - * Checks whether S3 buckets have cross-region replication enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-replication-enabled.html - */ - public static readonly S3_BUCKET_REPLICATION_ENABLED = 'S3_BUCKET_REPLICATION_ENABLED'; - /** - * Checks that your Amazon S3 bucket either has Amazon S3 default encryption enabled or that the - * S3 bucket policy explicitly denies put-object requests without server side encryption that - * uses AES-256 or AWS Key Management Service. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-server-side-encryption-enabled.html - */ - public static readonly S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED = 'S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED'; - /** - * Checks whether S3 buckets have policies that require requests to use Secure Socket Layer (SSL). - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-ssl-requests-only.html - */ - public static readonly S3_BUCKET_SSL_REQUESTS_ONLY= 'S3_BUCKET_SSL_REQUESTS_ONLY'; - /** - * Checks whether versioning is enabled for your S3 buckets. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-versioning-enabled.html - */ - public static readonly S3_BUCKET_VERSIONING_ENABLED = 'S3_BUCKET_VERSIONING_ENABLED'; - /** - * Checks if Amazon S3 Events Notifications are enabled on an S3 bucket. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-event-notifications-enabled.html - */ - public static readonly S3_EVENT_NOTIFICATIONS_ENABLED = 'S3_EVENT_NOTIFICATIONS_ENABLED'; - /** - * Checks if a recovery point was created for Amazon Simple Storage Service (Amazon S3). - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-last-backup-recovery-point-created.html - */ - public static readonly S3_LAST_BACKUP_RECOVERY_POINT_CREATED = 'S3_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks if a lifecycle rule is configured for an Amazon Simple Storage Service (Amazon S3) bucket. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-lifecycle-policy-check.html - */ - public static readonly S3_LIFECYCLE_POLICY_CHECK = 'S3_LIFECYCLE_POLICY_CHECK'; - /** - * Checks if Amazon Simple Storage Service (Amazon S3) buckets are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-resources-protected-by-backup-plan.html - */ - public static readonly S3_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'S3_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks if Amazon Simple Storage Service (Amazon S3) version enabled buckets have lifecycle policy configured. - * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-version-lifecycle-policy-check.html - */ - public static readonly S3_VERSION_LIFECYCLE_POLICY_CHECK = 'S3_VERSION_LIFECYCLE_POLICY_CHECK'; - /** - * Checks whether AWS Key Management Service (KMS) key is configured for an Amazon SageMaker endpoint configuration. - * @see https://docs.aws.amazon.com/config/latest/developerguide/sagemaker-endpoint-configuration-kms-key-configured.html - */ - public static readonly SAGEMAKER_ENDPOINT_CONFIGURATION_KMS_KEY_CONFIGURED = 'SAGEMAKER_ENDPOINT_CONFIGURATION_KMS_KEY_CONFIGURED'; - /** - * Check whether an AWS Key Management Service (KMS) key is configured for SageMaker notebook instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/sagemaker-notebook-instance-kms-key-configured.html - */ - public static readonly SAGEMAKER_NOTEBOOK_INSTANCE_KMS_KEY_CONFIGURED = 'SAGEMAKER_NOTEBOOK_INSTANCE_KMS_KEY_CONFIGURED'; - /** - * Checks whether direct internet access is disabled for an Amazon SageMaker notebook instance. - * @see https://docs.aws.amazon.com/config/latest/developerguide/sagemaker-notebook-no-direct-internet-access.html - */ - public static readonly SAGEMAKER_NOTEBOOK_NO_DIRECT_INTERNET_ACCESS = 'SAGEMAKER_NOTEBOOK_NO_DIRECT_INTERNET_ACCESS'; - /** - * Checks whether AWS Secrets Manager secret has rotation enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-rotation-enabled-check.html - */ - public static readonly SECRETSMANAGER_ROTATION_ENABLED_CHECK = 'SECRETSMANAGER_ROTATION_ENABLED_CHECK'; - /** - * Checks whether AWS Secrets Manager secret rotation has rotated successfully as per the rotation schedule. - * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-scheduled-rotation-success-check.html - */ - public static readonly SECRETSMANAGER_SCHEDULED_ROTATION_SUCCESS_CHECK = 'SECRETSMANAGER_SCHEDULED_ROTATION_SUCCESS_CHECK'; - /** - * Checks if AWS Secrets Manager secrets have been rotated in the past specified number of days. - * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-secret-periodic-rotation.html - */ - public static readonly SECRETSMANAGER_SECRET_PERIODIC_ROTATION = 'SECRETSMANAGER_SECRET_PERIODIC_ROTATION'; - /** - * Checks if AWS Secrets Manager secrets have been accessed within a specified number of days. - * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-secret-unused.html - */ - public static readonly SECRETSMANAGER_SECRET_UNUSED = 'SECRETSMANAGER_SECRET_UNUSED'; - /** - * Checks if all secrets in AWS Secrets Manager are encrypted using the AWS managed key (aws/secretsmanager) - * or a customer managed key that was created in AWS Key Management Service (AWS KMS). - * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-using-cmk.html - */ - public static readonly SECRETSMANAGER_USING_CMK = 'SECRETSMANAGER_USING_CMK'; - /** - * Checks whether Service Endpoint for the service provided in rule parameter is created for each Amazon VPC. - * @see https://docs.aws.amazon.com/config/latest/developerguide/service-vpc-endpoint-enabled.html - */ - public static readonly SERVICE_VPC_ENDPOINT_ENABLED = 'SERVICE_VPC_ENDPOINT_ENABLED'; - /** - * Checks whether EBS volumes are attached to EC2 instances. - * @see https://docs.aws.amazon.com/config/latest/developerguide/shield-advanced-enabled-autorenew.html - */ - public static readonly SHIELD_ADVANCED_ENABLED_AUTO_RENEW = 'SHIELD_ADVANCED_ENABLED_AUTORENEW'; - /** - * Verify that DDoS response team (DRT) can access AWS account. - * @see https://docs.aws.amazon.com/config/latest/developerguide/shield-drt-access.html - */ - public static readonly SHIELD_DRT_ACCESS = 'SHIELD_DRT_ACCESS'; - /** - * Checks if a recovery point was created for AWS Backup-Gateway VirtualMachines. - * @see https://docs.aws.amazon.com/config/latest/developerguide/virtualmachine-last-backup-recovery-point-created.html - */ - public static readonly VIRTUALMACHINE_LAST_BACKUP_RECOVERY_POINT_CREATED = 'VIRTUALMACHINE_LAST_BACKUP_RECOVERY_POINT_CREATED'; - /** - * Checks if AWS Backup-Gateway VirtualMachines are protected by a backup plan. - * @see https://docs.aws.amazon.com/config/latest/developerguide/virtualmachine-resources-protected-by-backup-plan.html - */ - public static readonly VIRTUALMACHINE_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'VIRTUALMACHINE_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; - /** - * Checks that the default security group of any Amazon Virtual Private Cloud (VPC) does not - * allow inbound or outbound traffic. The rule returns NOT_APPLICABLE if the security group - * is not default. - * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-default-security-group-closed.html - */ - public static readonly VPC_DEFAULT_SECURITY_GROUP_CLOSED = 'VPC_DEFAULT_SECURITY_GROUP_CLOSED'; - /** - * Checks whether Amazon Virtual Private Cloud flow logs are found and enabled for Amazon VPC. - * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-flow-logs-enabled.html - */ - public static readonly VPC_FLOW_LOGS_ENABLED = 'VPC_FLOW_LOGS_ENABLED'; - /** - * Checks if there are unused network access control lists (network ACLs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-network-acl-unused-check.html - */ - public static readonly VPC_NETWORK_ACL_UNUSED_CHECK = 'VPC_NETWORK_ACL_UNUSED_CHECK'; - /** - * Checks if DNS resolution from accepter/requester VPC to private IP is enabled. - * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-peering-dns-resolution-check.html - */ - public static readonly VPC_PEERING_DNS_RESOLUTION_CHECK = 'VPC_PEERING_DNS_RESOLUTION_CHECK'; - /** - * Checks whether the security group with 0.0.0.0/0 of any Amazon Virtual Private Cloud (Amazon VPC) - * allows only specific inbound TCP or UDP traffic. - * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-sg-open-only-to-authorized-ports.html - */ - public static readonly VPC_SG_OPEN_ONLY_TO_AUTHORIZED_PORTS = 'VPC_SG_OPEN_ONLY_TO_AUTHORIZED_PORTS'; - /** - * Checks that both AWS Virtual Private Network tunnels provided by AWS Site-to-Site VPN are in - * UP status. - * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-vpn-2-tunnels-up.html - */ - public static readonly VPC_VPN_2_TUNNELS_UP = 'VPC_VPN_2_TUNNELS_UP'; - /** - * Checks if logging is enabled on AWS Web Application Firewall (WAF) classic global web ACLs. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-classic-logging-enabled.html - */ - public static readonly WAF_CLASSIC_LOGGING_ENABLED = 'WAF_CLASSIC_LOGGING_ENABLED'; - /** - * Checks whether logging is enabled on AWS Web Application Firewall (WAFV2) regional and global - * web access control list (ACLs). - * @see https://docs.aws.amazon.com/config/latest/developerguide/wafv2-logging-enabled.html - */ - public static readonly WAFV2_LOGGING_ENABLED = 'WAFV2_LOGGING_ENABLED'; - /** - * Checks if an AWS WAF Classic rule group contains any rules. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-global-rulegroup-not-empty.html - */ - public static readonly WAF_GLOBAL_RULEGROUP_NOT_EMPTY = 'WAF_GLOBAL_RULEGROUP_NOT_EMPTY'; - /** - * Checks if an AWS WAF global rule contains any conditions. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-global-rule-not-empty.html - */ - public static readonly WAF_GLOBAL_RULE_NOT_EMPTY = 'WAF_GLOBAL_RULE_NOT_EMPTY'; - /** - * Checks whether a WAF Global Web ACL contains any WAF rules or rule groups. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-global-webacl-not-empty.html - */ - public static readonly WAF_GLOBAL_WEBACL_NOT_EMPTY = 'WAF_GLOBAL_WEBACL_NOT_EMPTY'; - /** - * Checks if WAF Regional rule groups contain any rules. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-regional-rulegroup-not-empty.html - */ - public static readonly WAF_REGIONAL_RULEGROUP_NOT_EMPTY = 'WAF_REGIONAL_RULEGROUP_NOT_EMPTY'; - /** - * Checks whether WAF regional rule contains conditions. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-regional-rule-not-empty.html - */ - public static readonly WAF_REGIONAL_RULE_NOT_EMPTY = 'WAF_REGIONAL_RULE_NOT_EMPTY'; - /** - * Checks if a WAF regional Web ACL contains any WAF rules or rule groups. - * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-regional-webacl-not-empty.html - */ - public static readonly WAF_REGIONAL_WEBACL_NOT_EMPTY = 'WAF_REGIONAL_WEBACL_NOT_EMPTY'; - - // utility class - private constructor() { } -} - -/** - * Resources types that are supported by AWS Config - * @see https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html - */ -export class ResourceType { - /** API Gateway Stage */ - public static readonly APIGATEWAY_STAGE = new ResourceType('AWS::ApiGateway::Stage'); - /** API Gatewayv2 Stage */ - public static readonly APIGATEWAYV2_STAGE = new ResourceType('AWS::ApiGatewayV2::Stage'); - /** API Gateway REST API */ - public static readonly APIGATEWAY_REST_API = new ResourceType('AWS::ApiGateway::RestApi'); - /** API Gatewayv2 API */ - public static readonly APIGATEWAYV2_API = new ResourceType('AWS::ApiGatewayV2::Api'); - /** Amazon CloudFront Distribution */ - public static readonly CLOUDFRONT_DISTRIBUTION = new ResourceType('AWS::CloudFront::Distribution'); - /** Amazon CloudFront streaming distribution */ - public static readonly CLOUDFRONT_STREAMING_DISTRIBUTION = new ResourceType('AWS::CloudFront::StreamingDistribution'); - /** Amazon CloudWatch Alarm */ - public static readonly CLOUDWATCH_ALARM = new ResourceType('AWS::CloudWatch::Alarm'); - /** Amazon CloudWatch RUM */ - public static readonly CLOUDWATCH_RUM_APP_MONITOR = new ResourceType('AWS::RUM::AppMonitor'); - /** Amazon DynamoDB Table */ - public static readonly DYNAMODB_TABLE = new ResourceType('AWS::DynamoDB::Table'); - /** Elastic Block Store (EBS) volume */ - public static readonly EBS_VOLUME = new ResourceType('AWS::EC2::Volume'); - /** EC2 host */ - public static readonly EC2_HOST = new ResourceType('AWS::EC2::Host'); - /** EC2 Elastic IP */ - public static readonly EC2_EIP = new ResourceType('AWS::EC2::EIP'); - /** EC2 instance */ - public static readonly EC2_INSTANCE = new ResourceType('AWS::EC2::Instance'); - /** EC2 Network Interface */ - public static readonly EC2_NETWORK_INTERFACE = new ResourceType('AWS::EC2::NetworkInterface'); - /** EC2 security group */ - public static readonly EC2_SECURITY_GROUP = new ResourceType('AWS::EC2::SecurityGroup'); - /** EC2 NAT gateway */ - public static readonly EC2_NAT_GATEWAY = new ResourceType('AWS::EC2::NatGateway'); - /** EC2 Egress only internet gateway */ - public static readonly EC2_EGRESS_ONLY_INTERNET_GATEWAY = new ResourceType('AWS::EC2::EgressOnlyInternetGateway'); - /** EC2 flow log */ - public static readonly EC2_FLOW_LOG = new ResourceType('AWS::EC2::FlowLog'); - /** EC2 transit gateway */ - public static readonly EC2_TRANSIT_GATEWAY = new ResourceType('AWS::EC2::TransitGateway'); - /** EC2 transit gateway attachment */ - public static readonly EC2_TRANSIT_GATEWAY_ATTACHMENT = new ResourceType('AWS::EC2::TransitGatewayAttachment'); - /** EC2 transit gateway route table */ - public static readonly EC2_TRANSIT_GATEWAY_ROUTE_TABLE = new ResourceType('AWS::EC2::TransitGatewayRouteTable'); - /** EC2 VPC endpoint */ - public static readonly EC2_VPC_ENDPOINT = new ResourceType('AWS::EC2::VPCEndpoint'); - /** EC2 VPC endpoint service */ - public static readonly EC2_VPC_ENDPOINT_SERVICE = new ResourceType('AWS::EC2::VPCEndpointService'); - /** EC2 VPC peering connection */ - public static readonly EC2_VPC_PEERING_CONNECTION = new ResourceType('AWS::EC2::VPCPeeringConnection'); - /** EC2 registered HA instance */ - public static readonly EC2_REGISTERED_HA_INSTANCE = new ResourceType('AWS::EC2::RegisteredHAInstance'); - /** EC2 launch template */ - public static readonly EC2_LAUNCH_TEMPLATE = new ResourceType('AWS::EC2::LaunchTemplate'); - /** EC2 Network Insights Access Scope Analysis */ - public static readonly EC2_NETWORK_INSIGHTS_ACCESS_SCOPE_ANALYSIS = new ResourceType('AWS::EC2::NetworkInsightsAccessScopeAnalysis'); - /** EC2 Image Builder ContainerRecipe */ - public static readonly IMAGEBUILDER_CONTAINER_RECIPE = new ResourceType('AWS::ImageBuilder::ContainerRecipe'); - /** EC2 Image Builder DistributionConfiguration */ - public static readonly IMAGEBUILDER_DISTRIBUTION_CONFIGURATION = new ResourceType('AWS::ImageBuilder::DistributionConfiguration'); - /** EC2 Image Builder InfrastructureConfiguration */ - public static readonly IMAGEBUILDER_INFRASTRUCTURE_CONFIGURATION = new ResourceType('AWS::ImageBuilder::InfrastructureConfiguration'); - /** Amazon ECR repository */ - public static readonly ECR_REPOSITORY = new ResourceType('AWS::ECR::Repository'); - /** Amazon ECR registry policy */ - public static readonly ECR_REGISTRY_POLICY = new ResourceType('AWS::ECR::RegistryPolicy'); - /** Amazon ECR public repository */ - public static readonly ECR_PUBLIC_REPOSITORY = new ResourceType('AWS::ECR::PublicRepository'); - /** Amazon ECS cluster */ - public static readonly ECS_CLUSTER = new ResourceType('AWS::ECS::Cluster'); - /** Amazon ECS task definition */ - public static readonly ECS_TASK_DEFINITION = new ResourceType('AWS::ECS::TaskDefinition'); - /** Amazon ECS service */ - public static readonly ECS_SERVICE = new ResourceType('AWS::ECS::Service'); - /** Amazon EFS file system */ - public static readonly EFS_FILE_SYSTEM = new ResourceType('AWS::EFS::FileSystem'); - /** Amazon EFS access point */ - public static readonly EFS_ACCESS_POINT = new ResourceType('AWS::EFS::AccessPoint'); - /** Amazon Elastic Kubernetes Service cluster */ - public static readonly EKS_CLUSTER = new ResourceType('AWS::EKS::Cluster'); - /** Amazon Elastic Kubernetes Service identity provider config */ - public static readonly EKS_IDENTITY_PROVIDER_CONFIG = new ResourceType('AWS::EKS::IdentityProviderConfig'); - /** Amazon Elastic Kubernetes Service addon */ - public static readonly EKS_ADDON = new ResourceType('AWS::EKS::Addon'); - /** Amazon EMR security configuration */ - public static readonly EMR_SECURITY_CONFIGURATION = new ResourceType('AWS::EMR::SecurityConfiguration'); - /** Amazon EventBridge EventBus */ - public static readonly EVENTBRIDGE_EVENTBUS = new ResourceType('AWS::Events::EventBus'); - /** Amazon EventBridge Api Destination */ - public static readonly EVENTBRIDGE_API_DESTINATION = new ResourceType('AWS::Events::ApiDestination'); - /** Amazon EventBridge Archive */ - public static readonly EVENTBRIDGE_ARCHIVE = new ResourceType('AWS::Events::Archive'); - /** Amazon EventBridge Endpoint */ - public static readonly EVENTBRIDGE_ENDPOINT = new ResourceType('AWS::Events::Endpoint'); - /** Amazon EventBridge EventSchemas registry */ - public static readonly EVENTSCHEMAS_REGISTRY = new ResourceType('AWS::EventSchemas::Registry'); - /** Amazon EventBridge EventSchemas registry policy */ - public static readonly EVENTSCHEMAS_REGISTRY_POLICY = new ResourceType('AWS::EventSchemas::RegistryPolicy'); - /** Amazon EventBridge EventSchemas discoverer */ - public static readonly EVENTSCHEMAS_DISCOVERER = new ResourceType('AWS::EventSchemas::Discoverer'); - /** AWS FraudDetector label */ - public static readonly FRAUDDETECTOR_LABEL = new ResourceType('AWS::FraudDetector::Label'); - /** AWS FraudDetector entity type */ - public static readonly FRAUDDETECTOR_ENTITY_TYPE = new ResourceType('AWS::FraudDetector::EntityType'); - /** AWS FraudDetector variable */ - public static readonly FRAUDDETECTOR_VARIABLE = new ResourceType('AWS::FraudDetector::Variable'); - /** AWS FraudDetector outcome */ - public static readonly FRAUDDETECTOR_OUTCOME = new ResourceType('AWS::FraudDetector::Outcome'); - /** Amazon GuardDuty detector */ - public static readonly GUARDDUTY_DETECTOR = new ResourceType('AWS::GuardDuty::Detector'); - /** Amazon GuardDuty Threat Intel Set */ - public static readonly GUARDDUTY_THREAT_INTEL_SET = new ResourceType('AWS::GuardDuty::ThreatIntelSet'); - /** Amazon GuardDuty IP Set */ - public static readonly GUARDDUTY_IP_SET = new ResourceType(' AWS::GuardDuty::IPSet'); - /** Amazon GuardDuty Filter */ - public static readonly GUARDDUTY_FILTER = new ResourceType('AWS::GuardDuty::Filter'); - /** Amazon ElasticSearch domain */ - public static readonly ELASTICSEARCH_DOMAIN = new ResourceType('AWS::Elasticsearch::Domain'); - /** Amazon Interactive Video Service (IVS) channel */ - public static readonly IVS_CHANNEL = new ResourceType('AWS::IVS::Channel'); - /** Amazon Interactive Video Service (IVS) recording configuration */ - public static readonly IVS_RECORDING_CONFIGURATION = new ResourceType('AWS::IVS::RecordingConfiguration'); - /** Amazon Interactive Video Service (IVS) playback key pair */ - public static readonly IVS_PLAYBACK_KEYPAIR = new ResourceType('AWS::IVS::PlaybackKeyPair'); - /** Amazon OpenSearch domain */ - public static readonly OPENSEARCH_DOMAIN = new ResourceType('AWS::OpenSearch::Domain'); - /** Amazon QLDB ledger */ - public static readonly QLDB_LEDGER = new ResourceType('AWS::QLDB::Ledger'); - /** Amazon Kinesis stream */ - public static readonly KINESIS_STREAM = new ResourceType('AWS::Kinesis::Stream'); - /** Amazon Kinesis stream consumer */ - public static readonly KINESIS_STREAM_CONSUMER = new ResourceType('AWS::Kinesis::StreamConsumer'); - /** Amazon Kinesis Analytics V2 application */ - public static readonly KINESIS_ANALYTICS_V2_APPLICATION = new ResourceType('AWS::KinesisAnalyticsV2::Application'); - /** Amazon Lightsail Certificate */ - public static readonly LIGHTSAIL_CERTIFICATE = new ResourceType('AWS::Lightsail::Certificate'); - /** Amazon Lightsail Disk */ - public static readonly LIGHTSAIL_DISK = new ResourceType('AWS::Lightsail::Disk'); - /** AWS Lightsail bucket */ - public static readonly LIGHTSAIL_BUCKET = new ResourceType('AWS::Lightsail::Bucket'); - /** AWS Lightsail static IP */ - public static readonly LIGHTSAIL_STATIC_IP = new ResourceType('AWS::Lightsail::StaticIp'); - /** Amazon MQ broker */ - public static readonly AMAZON_MQ_BROKER = new ResourceType('AWS::AmazonMQ::Broker'); - /** Amazon MSK cluster */ - public static readonly MSK_CLUSTER = new ResourceType('AWS::MSK::Cluster'); - /** Amazon Redshift cluster */ - public static readonly REDSHIFT_CLUSTER = new ResourceType('AWS::Redshift::Cluster'); - /** Amazon Redshift cluster parameter group */ - public static readonly REDSHIFT_CLUSTER_PARAMETER_GROUP = new ResourceType('AWS::Redshift::ClusterParameterGroup'); - /** Amazon Redshift cluster security group */ - public static readonly REDSHIFT_CLUSTER_SECURITY_GROUP = new ResourceType('AWS::Redshift::ClusterSecurityGroup'); - /** Amazon Redshift cluster snapshot */ - public static readonly REDSHIFT_CLUSTER_SNAPSHOT = new ResourceType('AWS::Redshift::ClusterSnapshot'); - /** Amazon Redshift cluster subnet group */ - public static readonly REDSHIFT_CLUSTER_SUBNET_GROUP = new ResourceType('AWS::Redshift::ClusterSubnetGroup'); - /** Amazon Redshift event subscription */ - public static readonly REDSHIFT_EVENT_SUBSCRIPTION = new ResourceType('AWS::Redshift::EventSubscription'); - /** Amazon RDS database instance */ - public static readonly RDS_DB_INSTANCE = new ResourceType('AWS::RDS::DBInstance'); - /** Amazon RDS database security group */ - public static readonly RDS_DB_SECURITY_GROUP = new ResourceType('AWS::RDS::DBSecurityGroup'); - /** Amazon RDS database snapshot */ - public static readonly RDS_DB_SNAPSHOT = new ResourceType('AWS::RDS::DBSnapshot'); - /** Amazon RDS database subnet group */ - public static readonly RDS_DB_SUBNET_GROUP = new ResourceType('AWS::RDS::DBSubnetGroup'); - /** Amazon RDS event subscription */ - public static readonly RDS_EVENT_SUBSCRIPTION = new ResourceType('AWS::RDS::EventSubscription'); - /** Amazon RDS database cluster */ - public static readonly RDS_DB_CLUSTER = new ResourceType('AWS::RDS::DBCluster'); - /** Amazon RDS database cluster snapshot */ - public static readonly RDS_DB_CLUSTER_SNAPSHOT = new ResourceType('AWS::RDS::DBClusterSnapshot'); - /** Amazon RDS global cluster */ - public static readonly RDS_GLOBAL_CLUSTER = new ResourceType('AWS::RDS::GlobalCluster'); - /** Amazon Route53 Hosted Zone */ - public static readonly ROUTE53_HOSTED_ZONE= new ResourceType('AWS::Route53::HostedZone'); - /** Amazon Route53 Health Check */ - public static readonly ROUTE53_HEALTH_CHECK = new ResourceType('AWS::Route53::HealthCheck'); - /** Amazon Route53 resolver resolver endpoint */ - public static readonly ROUTE53_RESOLVER_RESOLVER_ENDPOINT = new ResourceType('AWS::Route53Resolver::ResolverEndpoint'); - /** Amazon Route53 resolver resolver rule */ - public static readonly ROUTE53_RESOLVER_RESOLVER_RULE = new ResourceType('AWS::Route53Resolver::ResolverRule'); - /** Amazon Route53 resolver resolver rule association */ - public static readonly ROUTE53_RESOLVER_RESOLVER_RULE_ASSOCIATION = new ResourceType('AWS::Route53Resolver::ResolverRuleAssociation'); - /** Amazon Route 53 Application Recovery Controller Cell */ - public static readonly ROUTE53_RECOVERY_READINESS_CELL = new ResourceType('AWS::Route53RecoveryReadiness::Cell'); - /** Amazon Route 53 Application Recovery Controller Readiness Check */ - public static readonly ROUTE53_RECOVERY_READINESS_READINESS_CHECK = new ResourceType('AWS::Route53RecoveryReadiness::ReadinessCheck'); - /** Amazon Route53 recovery readiness recovery group */ - public static readonly ROUTE53_RECOVERY_READINESS_RECOVERY_GROUP = new ResourceType('AWS::Route53RecoveryReadiness::RecoveryGroup'); - /** Amazon SQS queue */ - public static readonly SQS_QUEUE = new ResourceType('AWS::SQS::Queue'); - /** Amazon SNS topic */ - public static readonly SNS_TOPIC = new ResourceType('AWS::SNS::Topic'); - /** Amazon S3 bucket */ - public static readonly S3_BUCKET = new ResourceType('AWS::S3::Bucket'); - /** Amazon S3 Multi-Region Access Point */ - public static readonly S3_MULTIREGION_ACCESS_POINT = new ResourceType('AWS::S3::MultiRegionAccessPoint'); - /** Amazon SageMaker code repository */ - public static readonly SAGEMAKER_CODE_REPOSITORY = new ResourceType('AWS::SageMaker::CodeRepository'); - /** Amazon SageMaker model */ - public static readonly SAGEMAKER_MODEL = new ResourceType('AWS::SageMaker::Model'); - /** Amazon SageMaker notebook instance */ - public static readonly SAGEMAKER_NOTEBOOK_INSTANCE = new ResourceType('AWS::SageMaker::NotebookInstance'); - /** Amazon SageMaker workteam */ - public static readonly SAGEMAKER_WORKTEAM = new ResourceType('AWS::SageMaker::Workteam'); - /** Amazon SES Configuration Set */ - public static readonly SES_CONFIGURATION_SET = new ResourceType('AWS::SES::ConfigurationSet'); - /** Amazon SES Contact List */ - public static readonly SES_CONTACT_LIST = new ResourceType('AWS::SES::ContactList'); - /** Amazon SES Template */ - public static readonly SES_TEMPLATE = new ResourceType('AWS::SES::Template'); - /** Amazon SES ReceiptFilter */ - public static readonly SES_RECEIPT_FILTER = new ResourceType('AWS::SES::ReceiptFilter'); - /** Amazon SES ReceiptRuleSet */ - public static readonly SES_RECEIPT_RECEIPT_RULE_SET = new ResourceType('AWS::SES::ReceiptRuleSet'); - /** Amazon S3 account public access block */ - public static readonly S3_ACCOUNT_PUBLIC_ACCESS_BLOCK = new ResourceType('AWS::S3::AccountPublicAccessBlock'); - /** Amazon EC2 customer gateway */ - public static readonly EC2_CUSTOMER_GATEWAY = new ResourceType('AWS::EC2::CustomerGateway'); - /** Amazon EC2 internet gateway */ - public static readonly EC2_INTERNET_GATEWAY = new ResourceType('AWS::EC2::InternetGateway'); - /** Amazon EC2 network ACL */ - public static readonly EC2_NETWORK_ACL = new ResourceType('AWS::EC2::NetworkAcl'); - /** Amazon EC2 route table */ - public static readonly EC2_ROUTE_TABLE = new ResourceType('AWS::EC2::RouteTable'); - /** Amazon EC2 subnet table */ - public static readonly EC2_SUBNET = new ResourceType('AWS::EC2::Subnet'); - /** Amazon EC2 VPC */ - public static readonly EC2_VPC = new ResourceType('AWS::EC2::VPC'); - /** Amazon EC2 VPN connection */ - public static readonly EC2_VPN_CONNECTION = new ResourceType('AWS::EC2::VPNConnection'); - /** Amazon EC2 VPN gateway */ - public static readonly EC2_VPN_GATEWAY = new ResourceType('AWS::EC2::VPNGateway'); - /** AWS Auto Scaling group */ - public static readonly AUTO_SCALING_GROUP = new ResourceType('AWS::AutoScaling::AutoScalingGroup'); - /** AWS Auto Scaling launch configuration */ - public static readonly AUTO_SCALING_LAUNCH_CONFIGURATION = new ResourceType('AWS::AutoScaling::LaunchConfiguration'); - /** AWS Auto Scaling policy */ - public static readonly AUTO_SCALING_POLICY = new ResourceType('AWS::AutoScaling::ScalingPolicy'); - /** AWS Auto Scaling scheduled action */ - public static readonly AUTO_SCALING_SCHEDULED_ACTION = new ResourceType('AWS::AutoScaling::ScheduledAction'); - /** Amazon WorkSpaces connection alias */ - public static readonly WORKSPACES_CONNECTION_ALIAS = new ResourceType('AWS::WorkSpaces::ConnectionAlias'); - /** Amazon WorkSpaces workSpace */ - public static readonly WORKSPACES_WORKSPACE = new ResourceType('AWS::WorkSpaces::Workspace'); - /** AWS AppConfig application */ - public static readonly APPCONFIG_APPLICATION = new ResourceType('AWS::AppConfig::Application'); - /** AWS AppConfig environment */ - public static readonly APPCONFIG_ENVIRONMENT = new ResourceType('AWS::AppConfig::Environment'); - /** AWS AppConfig configuration profile */ - public static readonly APPCONFIG_CONFIGURATION_PROFILE = new ResourceType('AWS::AppConfig::ConfigurationProfile'); - /** AWS AppSync GraphQL Api */ - public static readonly APPSYNC_GRAPHQL_API = new ResourceType('AWS::AppSync::GraphQLApi'); - /** AWS Backup backup plan */ - public static readonly BACKUP_BACKUP_PLAN = new ResourceType('AWS::Backup::BackupPlan'); - /** AWS Backup backup selection */ - public static readonly BACKUP_BACKUP_SELECTION = new ResourceType('AWS::Backup::BackupSelection'); - /** AWS Backup backup vault */ - public static readonly BACKUP_BACKUP_VAULT = new ResourceType('AWS::Backup::BackupVault'); - /** AWS Backup recovery point */ - public static readonly BACKUP_RECOVERY_POINT = new ResourceType('AWS::Backup::RecoveryPoint'); - /** AWS Backup report plan */ - public static readonly BACKUP_REPORT_PLAN = new ResourceType('AWS::Backup::ReportPlan'); - /** AWS Batch job queue */ - public static readonly BATCH_JOB_QUEUE = new ResourceType('AWS::Batch::JobQueue'); - /** AWS Batch compute environment */ - public static readonly BATCH_COMPUTE_ENVIRONMENT = new ResourceType('AWS::Batch::ComputeEnvironment'); - /** AWS Certificate manager certificate */ - public static readonly ACM_CERTIFICATE = new ResourceType('AWS::ACM::Certificate'); - /** AWS CloudFormation stack */ - public static readonly CLOUDFORMATION_STACK = new ResourceType('AWS::CloudFormation::Stack'); - /** AWS CloudTrail trail */ - public static readonly CLOUDTRAIL_TRAIL = new ResourceType('AWS::CloudTrail::Trail'); - /** AWS Cloud9 environment EC2 */ - public static readonly CLOUD9_ENVIRONMENT_EC2 = new ResourceType('AWS::Cloud9::EnvironmentEC2'); - /** AWS Cloud Map(ServiceDiscovery) service */ - public static readonly SERVICEDISCOVERY_SERVICE = new ResourceType('AWS::ServiceDiscovery::Service'); - /** AWS Cloud Map(ServiceDiscovery) Public Dns Namespace */ - public static readonly SERVICEDISCOVERY_PUBLIC_DNS_NAMESPACE = new ResourceType('AWS::ServiceDiscovery::PublicDnsNamespace'); - /** AWS Cloud Map(ServiceDiscovery) Http Namespace */ - public static readonly SERVICEDISCOVERY_HTTP_NAMESPACE = new ResourceType('AWS::ServiceDiscovery::HttpNamespace'); - /** AWS CodeBuild project */ - public static readonly CODEBUILD_PROJECT = new ResourceType('AWS::CodeBuild::Project'); - /** AWS CodeDeploy application */ - public static readonly CODEDEPLOY_APPLICATION = new ResourceType('AWS::CodeDeploy::Application'); - /** AWS CodeDeploy deployment config */ - public static readonly CODEDEPLOY_DEPLOYMENT_CONFIG = new ResourceType('AWS::CodeDeploy::DeploymentConfig'); - /** AWS CodeDeploy deployment group */ - public static readonly CODEDEPLOY_DEPLOYMENT_GROUP = new ResourceType('AWS::CodeDeploy::DeploymentGroup'); - /** AWS CodePipeline pipeline */ - public static readonly CODEPIPELINE_PIPELINE = new ResourceType('AWS::CodePipeline::Pipeline'); - /** AWS Config resource compliance */ - public static readonly CONFIG_RESOURCE_COMPLIANCE = new ResourceType('AWS::Config::ResourceCompliance'); - /** AWS Config conformance pack compliance */ - public static readonly CONFIG_CONFORMANCE_PACK_COMPLIANCE = new ResourceType('AWS::Config::ConformancePackCompliance'); - /** AWS DMS event subscription */ - public static readonly DMS_EVENT_SUBSCRIPTION = new ResourceType('AWS::DMS::EventSubscription'); - /** AWS DMS replication subnet group */ - public static readonly DMS_REPLICATION_SUBNET_GROUP = new ResourceType('AWS::DMS::ReplicationSubnetGroup'); - /** AWS DataSync location SMB */ - public static readonly DATASYNC_LOCATION_SMB = new ResourceType('AWS::DataSync::LocationSMB'); - /** AWS DataSync location FSx Lustre */ - public static readonly DATASYNC_LOCATION_FSX_LUSTRE = new ResourceType('AWS::DataSync::LocationFSxLustre'); - /** AWS DataSync location FSx Windows */ - public static readonly DATASYNC_LOCATION_FSX_WINDOWS = new ResourceType('AWS::DataSync::LocationFSxWindows'); - /** AWS DataSync location S3 */ - public static readonly DATASYNC_LOCATION_S3 = new ResourceType('AWS::DataSync::LocationS3'); - /** AWS DataSync location EFS */ - public static readonly DATASYNC_LOCATION_EFS = new ResourceType('AWS::DataSync::LocationEFS'); - /** AWS DataSync task */ - public static readonly DATASYNC_TASK = new ResourceType('AWS::DataSync::Task'); - /** AWS DataSync location NFS */ - public static readonly DATASYNC_LOCATION_NFS = new ResourceType('AWS::DataSync::LocationNFS'); - /** AWS DataSync location object storage */ - public static readonly DATASYNC_LOCATION_OBJECT_STORAGE = new ResourceType('AWS::DataSync::LocationObjectStorage'); - /** AWS DataSync location HDFS */ - public static readonly DATASYNC_LOCATION_HDFS = new ResourceType('AWS::DataSync::LocationHDFS'); - /** AWS Elastic Beanstalk (EB) application */ - public static readonly ELASTIC_BEANSTALK_APPLICATION = new ResourceType('AWS::ElasticBeanstalk::Application'); - /** AWS Elastic Beanstalk (EB) application version */ - public static readonly ELASTIC_BEANSTALK_APPLICATION_VERSION = new ResourceType('AWS::ElasticBeanstalk::ApplicationVersion'); - /** AWS Elastic Beanstalk (EB) environment */ - public static readonly ELASTIC_BEANSTALK_ENVIRONMENT = new ResourceType('AWS::ElasticBeanstalk::Environment'); - /** AWS Fault Injection Simulator Experiment_Template */ - public static readonly FIS_EXPERIMENT_TEMPLATE = new ResourceType('AWS::FIS::ExperimentTemplate'); - /** AWS GlobalAccelerator listener */ - public static readonly GLOBALACCELERATOR_LISTENER = new ResourceType('AWS::GlobalAccelerator::Listener'); - /** AWS GlobalAccelerator endpoint group */ - public static readonly GLOBALACCELERATOR_ENDPOINT_GROUP = new ResourceType('AWS::GlobalAccelerator::EndpointGroup'); - /** AWS GlobalAccelerator accelerator */ - public static readonly GLOBALACCELERATOR_ACCELERATOR = new ResourceType('AWS::GlobalAccelerator::Accelerator'); - /** AWS Glue Job */ - public static readonly GLUE_JOB = new ResourceType('AWS::Glue::Job'); - /** AWS Glue Classifier */ - public static readonly GLUE_CLASSIFIER = new ResourceType('AWS::Glue::Classifier'); - /** AWS Glue machine learning transform */ - public static readonly GLUE_ML_TRANSFORM = new ResourceType('AWS::Glue::MLTransform'); - /** AWS IAM user */ - public static readonly IAM_USER = new ResourceType('AWS::IAM::User'); - /** AWS IAM group */ - public static readonly IAM_GROUP = new ResourceType('AWS::IAM::Group'); - /** AWS IAM role */ - public static readonly IAM_ROLE = new ResourceType('AWS::IAM::Role'); - /** AWS IAM policy */ - public static readonly IAM_POLICY = new ResourceType('AWS::IAM::Policy'); - /** AWS IAM AccessAnalyzer analyzer */ - public static readonly IAM_ACCESSANALYZER_ANALYZER = new ResourceType('AWS::AccessAnalyzer::Analyzer'); - /** AWS IoT authorizer */ - public static readonly IOT_AUTHORIZER = new ResourceType('AWS::IoT::Authorizer'); - /** AWS IoT security profile */ - public static readonly IOT_SECURITY_PROFILE = new ResourceType('AWS::IoT::SecurityProfile'); - /** AWS IoT role alias */ - public static readonly IOT_ROLE_ALIAS = new ResourceType('AWS::IoT::RoleAlias'); - /** AWS IoT dimension */ - public static readonly IOT_DIMENSION = new ResourceType('AWS::IoT::Dimension'); - /** AWS IoT policy */ - public static readonly IOT_POLICY = new ResourceType('AWS::IoT::Policy'); - /** AWS IoT mitigation action */ - public static readonly IOT_MITIGATION_ACTION = new ResourceType('AWS::IoT::MitigationAction'); - /** AWS IoT TwinMaker workspace */ - public static readonly IOT_TWINMAKER_WORKSPACE = new ResourceType('AWS::IoTwinMaker::Workspace'); - /** AWS IoT TwinMaker entity */ - public static readonly IOT_TWINMAKER_ENTITY = new ResourceType('AWS::IoTTwinMaker::Entity'); - /** AWS IoT Analytics datastore */ - public static readonly IOT_ANALYTICS_DATASTORE = new ResourceType('AWS::IoTAnalytics::Datastore'); - /** AWS IoT Analytics dataset */ - public static readonly IOT_ANALYTICS_DATASET = new ResourceType('AWS::IoTAnalytics::Dataset'); - /** AWS IoT Analytics pipeline */ - public static readonly IOT_ANALYTICS_PIPELINE = new ResourceType('AWS::IoTAnalytics::Pipeline'); - /** AWS IoT Analytics channel */ - public static readonly IOT_ANALYTICS_CHANNEL = new ResourceType('AWS::IoTAnalytics::Channel'); - /** AWS IoT Events Input */ - public static readonly IOT_EVENTS_INPUT = new ResourceType('AWS::IoTEvents::Input'); - /** AWS IoT Events Detector Model */ - public static readonly IOT_EVENTS_DETECTOR_MODEL = new ResourceType('AWS::IoTEvents::DetectorModel'); - /** AWS IoT Events Alarm Model */ - public static readonly IOT_EVENTS_ALARM_MODEL = new ResourceType('AWS::IoTEvents::AlarmModel'); - /** AWS IoT SiteWise dashboard */ - public static readonly IOT_SITEWISE_DASHBOARD = new ResourceType('AWS::IoTSiteWise::Dashboard'); - /** AWS IoT SiteWise project */ - public static readonly IOT_SITEWISE_PROJECT = new ResourceType('AWS::IoTSiteWise::Project'); - /** AWS IoT SiteWise portal */ - public static readonly IOT_SITEWISE_PORTAL = new ResourceType('AWS::IoTSiteWise::Portal'); - /** AWS IoT SiteWise asset model */ - public static readonly IOT_SITEWISE_ASSETMODEL = new ResourceType('AWS::IoTSiteWise::AssetModel'); - /** AWS KMS Key */ - public static readonly KMS_KEY = new ResourceType('AWS::KMS::Key'); - /** AWS Lambda function */ - public static readonly LAMBDA_FUNCTION = new ResourceType('AWS::Lambda::Function'); - /** AWS Network Firewall Firewall */ - public static readonly NETWORK_FIREWALL_FIREWALL = new ResourceType('AWS::NetworkFirewall::Firewall'); - /** AWS Network Firewall Firewall Policy */ - public static readonly NETWORK_FIREWALL_FIREWALL_POLICY = new ResourceType('AWS::NetworkFirewall::FirewallPolicy'); - /** AWS Network Firewall Rule Group */ - public static readonly NETWORK_FIREWALL_RULE_GROUP = new ResourceType('AWS::NetworkFirewall::RuleGroup'); - /** AWS ResilienceHub resiliency policy */ - public static readonly RESILIENCEHUB_RESILIENCY_POLICY = new ResourceType('AWS::ResilienceHub::ResiliencyPolicy'); - /**AWS Secrets Manager secret */ - public static readonly SECRETS_MANAGER_SECRET = new ResourceType('AWS::SecretsManager::Secret'); - /** AWS Service Catalog CloudFormation product */ - public static readonly SERVICE_CATALOG_CLOUDFORMATION_PRODUCT = new ResourceType('AWS::ServiceCatalog::CloudFormationProduct'); - /** AWS Service Catalog CloudFormation provisioned product */ - public static readonly SERVICE_CATALOG_CLOUDFORMATION_PROVISIONED_PRODUCT = new ResourceType( - 'AWS::ServiceCatalog::CloudFormationProvisionedProduct'); - /** AWS Service Catalog portfolio */ - public static readonly SERVICE_CATALOG_PORTFOLIO = new ResourceType('AWS::ServiceCatalog::Portfolio'); - /** AWS Shield protection */ - public static readonly SHIELD_PROTECTION = new ResourceType('AWS::Shield::Protection'); - /** AWS Shield regional protection */ - public static readonly SHIELD_REGIONAL_PROTECTION = new ResourceType('AWS::ShieldRegional::Protection'); - /** AWS StepFunctions activity */ - public static readonly STEPFUNCTIONS_ACTIVITY = new ResourceType('AWS::StepFunctions::Activity'); - /** AWS StepFunctions state machine */ - public static readonly STEPFUNCTIONS_STATE_MACHINE = new ResourceType('AWS::StepFunctions::StateMachine'); - /** AWS Systems Manager managed instance inventory */ - public static readonly SYSTEMS_MANAGER_MANAGED_INSTANCE_INVENTORY = new ResourceType('AWS::SSM::ManagedInstanceInventory'); - /** AWS Systems Manager patch compliance */ - public static readonly SYSTEMS_MANAGER_PATCH_COMPLIANCE = new ResourceType('AWS::SSM::PatchCompliance'); - /** AWS Systems Manager association compliance */ - public static readonly SYSTEMS_MANAGER_ASSOCIATION_COMPLIANCE = new ResourceType('AWS::SSM::AssociationCompliance'); - /** AWS Systems Manager file data */ - public static readonly SYSTEMS_MANAGER_FILE_DATA = new ResourceType('AWS::SSM::FileData'); - /** AWS Transfer workflow */ - public static readonly TRANSFER_WORKFLOW = new ResourceType('AWS::Transfer::Workflow'); - /** AWS WAF rate based rule */ - public static readonly WAF_RATE_BASED_RULE = new ResourceType('AWS::WAF::RateBasedRule'); - /** AWS WAF rule */ - public static readonly WAF_RULE = new ResourceType('AWS::WAF::Rule'); - /** AWS WAF web ACL */ - public static readonly WAF_WEB_ACL = new ResourceType('AWS::WAF::WebACL'); - /** AWS WAF rule group */ - public static readonly WAF_RULE_GROUP = new ResourceType('AWS::WAF::RuleGroup'); - /** AWS WAF regional rate based rule */ - public static readonly WAF_REGIONAL_RATE_BASED_RULE = new ResourceType('AWS::WAFRegional::RateBasedRule'); - /** AWS WAF regional rule */ - public static readonly WAF_REGIONAL_RULE = new ResourceType('AWS::WAFRegional::Rule'); - /** AWS WAF web ACL */ - public static readonly WAF_REGIONAL_WEB_ACL = new ResourceType('AWS::WAFRegional::WebACL'); - /** AWS WAF regional rule group */ - public static readonly WAF_REGIONAL_RULE_GROUP = new ResourceType('AWS::WAFRegional::RuleGroup'); - /** AWS WAFv2 web ACL */ - public static readonly WAFV2_WEB_ACL = new ResourceType('AWS::WAFv2::WebACL'); - /** AWS WAFv2 rule group */ - public static readonly WAFV2_RULE_GROUP = new ResourceType('AWS::WAFv2::RuleGroup'); - /** AWS WAFv2 managed rule set */ - public static readonly WAFV2_MANAGED_RULE_SET = new ResourceType('AWS::WAFv2::ManagedRuleSet'); - /** AWS WAFv2 ip set */ - public static readonly WAFV2_IP_SET = new ResourceType('AWS::WAFv2::IPSet'); - /** AWS WAFv2 regex pattern set */ - public static readonly WAFV2_REGEX_PATTERN_SET = new ResourceType('AWS::WAFv2::RegexPatternSet'); - /** AWS X-Ray encryption configuration */ - public static readonly XRAY_ENCRYPTION_CONFIGURATION = new ResourceType('AWS::XRay::EncryptionConfig'); - /** AWS ELB classic load balancer */ - public static readonly ELB_LOAD_BALANCER = new ResourceType('AWS::ElasticLoadBalancing::LoadBalancer'); - /** AWS ELBv2 network load balancer or AWS ELBv2 application load balancer */ - public static readonly ELBV2_LOAD_BALANCER = new ResourceType('AWS::ElasticLoadBalancingV2::LoadBalancer'); - /** AWS ELBv2 application load balancer listener */ - public static readonly ELBV2_LISTENER = new ResourceType('AWS::ElasticLoadBalancingV2::Listener'); - /** AWS Elemental MediaPackage packaging group */ - public static readonly MEDIAPACKAGE_PACKAGING_GROUP = new ResourceType('AWS::MediaPackage::PackagingGroup'); - - /** A custom resource type to support future cases. */ - public static of(type: string): ResourceType { - return new ResourceType(type); - } - - /** - * Valid value of resource type. - */ - public readonly complianceResourceType: string; - - private constructor(type: string) { - this.complianceResourceType = type; - } - -} - -function renderScope(ruleScope?: RuleScope): CfnConfigRule.ScopeProperty | undefined { - return ruleScope ? { - complianceResourceId: ruleScope.resourceId, - complianceResourceTypes: ruleScope.resourceTypes?.map(resource => resource.complianceResourceType), - tagKey: ruleScope.key, - tagValue: ruleScope.value, - } : undefined; -} diff --git a/packages/@aws-cdk/aws-config/package.json b/packages/@aws-cdk/aws-config/package.json deleted file mode 100644 index 6cb36fa4c3ada..0000000000000 --- a/packages/@aws-cdk/aws-config/package.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "name": "@aws-cdk/aws-config", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Config", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.config", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "config" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Config", - "packageId": "Amazon.CDK.AWS.Config", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-config", - "module": "aws_cdk.aws_config", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-config" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Config", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "config" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "features": [ - { - "name": "Higher level constructs for Config Rules", - "stability": "Stable" - }, - { - "name": "Higher level constructs for initial set-up (delivery channel & configuration recorder)", - "stability": "Not Implemented" - } - ], - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-config/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-config/rosetta/default.ts-fixture deleted file mode 100644 index f644a3f9c8157..0000000000000 --- a/packages/@aws-cdk/aws-config/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as config from '@aws-cdk/aws-config'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as sns from '@aws-cdk/aws-sns'; -import * as lambda from '@aws-cdk/aws-lambda'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.ts b/packages/@aws-cdk/aws-config/test/integ.rule.ts deleted file mode 100644 index 8588f101491a0..0000000000000 --- a/packages/@aws-cdk/aws-config/test/integ.rule.ts +++ /dev/null @@ -1,38 +0,0 @@ -import * as targets from '@aws-cdk/aws-events-targets'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as config from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-config-custompolicy'); - -// A custom rule that runs on configuration changes of EC2 instances -const fn = new lambda.Function(stack, 'CustomFunction', { - code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); - -new config.CustomRule(stack, 'Custom', { - configurationChanges: true, - lambdaFunction: fn, - ruleScope: config.RuleScope.fromResources([config.ResourceType.EC2_INSTANCE]), -}); - -// A rule to detect stacks drifts -const driftRule = new config.CloudFormationStackDriftDetectionCheck(stack, 'Drift'); - -// Topic for compliance events -const complianceTopic = new sns.Topic(stack, 'ComplianceTopic'); - -// Send notification on compliance change -driftRule.onComplianceChange('ComplianceChange', { - target: new targets.SnsTopic(complianceTopic), -}); - - -new integ.IntegTest(app, 'aws-cdk-config-rule-integ', { - testCases: [stack], -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/test/rule.test.ts b/packages/@aws-cdk/aws-config/test/rule.test.ts deleted file mode 100644 index ae037c19df4ce..0000000000000 --- a/packages/@aws-cdk/aws-config/test/rule.test.ts +++ /dev/null @@ -1,522 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as config from '../lib'; - -describe('rule', () => { - test('create a managed rule', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new config.ManagedRule(stack, 'Rule', { - description: 'really cool rule', - identifier: 'AWS_SUPER_COOL', - inputParameters: { - key: 'value', - }, - maximumExecutionFrequency: config.MaximumExecutionFrequency.THREE_HOURS, - configRuleName: 'cool rule', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { - Source: { - Owner: 'AWS', - SourceIdentifier: 'AWS_SUPER_COOL', - }, - ConfigRuleName: 'cool rule', - Description: 'really cool rule', - InputParameters: { - key: 'value', - }, - MaximumExecutionFrequency: 'Three_Hours', - }); - }); - - test('create a custom rule', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.AssetCode.fromInline('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - new config.CustomRule(stack, 'Rule', { - configurationChanges: true, - description: 'really cool rule', - inputParameters: { - key: 'value', - }, - lambdaFunction: fn, - maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, - configRuleName: 'cool rule', - periodic: true, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::Config::ConfigRule', { - Properties: { - Source: { - Owner: 'CUSTOM_LAMBDA', - SourceDetails: [ - { - EventSource: 'aws.config', - MessageType: 'ConfigurationItemChangeNotification', - }, - { - EventSource: 'aws.config', - MessageType: 'OversizedConfigurationItemChangeNotification', - }, - { - EventSource: 'aws.config', - MaximumExecutionFrequency: 'Six_Hours', - MessageType: 'ScheduledNotification', - }, - ], - SourceIdentifier: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - }, - ConfigRuleName: 'cool rule', - Description: 'really cool rule', - InputParameters: { - key: 'value', - }, - MaximumExecutionFrequency: 'Six_Hours', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Principal: 'config.amazonaws.com', - SourceAccount: { - Ref: 'AWS::AccountId', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AWSConfigRulesExecutionRole', - ], - ], - }, - ], - }); - }); - - test('scope to resource', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new config.ManagedRule(stack, 'Rule', { - identifier: 'AWS_SUPER_COOL', - ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE, 'i-1234'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { - Scope: { - ComplianceResourceId: 'i-1234', - ComplianceResourceTypes: [ - 'AWS::EC2::Instance', - ], - }, - }); - }); - - test('scope to resources', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new config.ManagedRule(stack, 'Rule', { - identifier: 'AWS_SUPER_COOL', - ruleScope: config.RuleScope.fromResources([config.ResourceType.S3_BUCKET, config.ResourceType.CLOUDFORMATION_STACK]), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { - Scope: { - ComplianceResourceTypes: [ - 'AWS::S3::Bucket', - 'AWS::CloudFormation::Stack', - ], - }, - }); - }), - - test('scope to tag', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new config.ManagedRule(stack, 'Rule', { - identifier: 'RULE', - ruleScope: config.RuleScope.fromTag('key', 'value'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { - Scope: { - TagKey: 'key', - TagValue: 'value', - }, - }); - }), - - test('allows scoping a custom rule without configurationChanges enabled', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.AssetCode.fromInline('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // THEN - expect(() => new config.CustomRule(stack, 'Rule', { - lambdaFunction: fn, - periodic: true, - ruleScope: config.RuleScope.fromResources([config.ResourceType.of('resource')]), - })).not.toThrow(); - }), - - test('throws when both configurationChanges and periodic are falsy', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.AssetCode.fromInline('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // THEN - expect(() => new config.CustomRule(stack, 'Rule', { - lambdaFunction: fn, - })).toThrow(/`configurationChanges`.*`periodic`/); - }), - - test('on compliance change event', () => { - // GIVEN - const stack = new cdk.Stack(); - const rule = new config.ManagedRule(stack, 'Rule', { - identifier: 'RULE', - }); - - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('dummy'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - rule.onComplianceChange('ComplianceChange', { - target: new targets.LambdaFunction(fn), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - EventPattern: { - 'source': [ - 'aws.config', - ], - 'detail': { - configRuleName: [ - { - Ref: 'Rule4C995B7F', - }, - ], - }, - 'detail-type': [ - 'Config Rules Compliance Change', - ], - }, - }); - }); - - test('Add EKS Cluster check to ManagedRule', () => { - // GIVEN - const stack1 = new cdk.Stack(); - const stack2 = new cdk.Stack(); - - // WHEN - new config.ManagedRule(stack1, 'RuleEksClusterOldest', { - identifier: config.ManagedRuleIdentifiers.EKS_CLUSTER_OLDEST_SUPPORTED_VERSION, - ruleScope: config.RuleScope.fromResource(config.ResourceType.EKS_CLUSTER), - }); - new config.ManagedRule(stack2, 'RuleEksClusterVersion', { - identifier: config.ManagedRuleIdentifiers.EKS_CLUSTER_SUPPORTED_VERSION, - ruleScope: config.RuleScope.fromResources([config.ResourceType.EKS_CLUSTER]), - }); - - // THEN - Template.fromStack(stack1).hasResourceProperties('AWS::Config::ConfigRule', { - Source: { - SourceIdentifier: 'EKS_CLUSTER_OLDEST_SUPPORTED_VERSION', - }, - Scope: { - ComplianceResourceTypes: ['AWS::EKS::Cluster'], - }, - }); - Template.fromStack(stack2).hasResourceProperties('AWS::Config::ConfigRule', { - Source: { - SourceIdentifier: 'EKS_CLUSTER_SUPPORTED_VERSION', - }, - Scope: { - ComplianceResourceTypes: ['AWS::EKS::Cluster'], - }, - }); - }); - - test('scope to resource', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new config.ManagedRule(stack, 'Rule', { - identifier: 'AWS_SUPER_COOL', - ruleScope: config.RuleScope.fromResources([ - config.ResourceType.EC2_NETWORK_INTERFACE, - config.ResourceType.EC2_TRANSIT_GATEWAY, - config.ResourceType.EC2_TRANSIT_GATEWAY_ATTACHMENT, - config.ResourceType.EC2_TRANSIT_GATEWAY_ROUTE_TABLE, - config.ResourceType.EC2_REGISTERED_HA_INSTANCE, - config.ResourceType.EC2_LAUNCH_TEMPLATE, - config.ResourceType.ECR_REPOSITORY, - config.ResourceType.ECR_PUBLIC_REPOSITORY, - config.ResourceType.ECS_CLUSTER, - config.ResourceType.ECS_TASK_DEFINITION, - config.ResourceType.ECS_SERVICE, - config.ResourceType.EFS_FILE_SYSTEM, - config.ResourceType.EFS_ACCESS_POINT, - config.ResourceType.EMR_SECURITY_CONFIGURATION, - config.ResourceType.GUARDDUTY_DETECTOR, - config.ResourceType.OPENSEARCH_DOMAIN, - config.ResourceType.KINESIS_STREAM, - config.ResourceType.KINESIS_STREAM_CONSUMER, - config.ResourceType.MSK_CLUSTER, - config.ResourceType.ROUTE53_RESOLVER_RESOLVER_ENDPOINT, - config.ResourceType.ROUTE53_RESOLVER_RESOLVER_RULE, - config.ResourceType.ROUTE53_RESOLVER_RESOLVER_RULE_ASSOCIATION, - config.ResourceType.SAGEMAKER_CODE_REPOSITORY, - config.ResourceType.SAGEMAKER_MODEL, - config.ResourceType.SAGEMAKER_NOTEBOOK_INSTANCE, - config.ResourceType.WORKSPACES_CONNECTION_ALIAS, - config.ResourceType.WORKSPACES_WORKSPACE, - config.ResourceType.BACKUP_BACKUP_PLAN, - config.ResourceType.BACKUP_BACKUP_SELECTION, - config.ResourceType.BACKUP_BACKUP_VAULT, - config.ResourceType.BACKUP_RECOVERY_POINT, - config.ResourceType.BATCH_JOB_QUEUE, - config.ResourceType.BATCH_COMPUTE_ENVIRONMENT, - config.ResourceType.CODEDEPLOY_APPLICATION, - config.ResourceType.CODEDEPLOY_DEPLOYMENT_CONFIG, - config.ResourceType.CODEDEPLOY_DEPLOYMENT_GROUP, - config.ResourceType.CONFIG_RESOURCE_COMPLIANCE, - config.ResourceType.CONFIG_CONFORMANCE_PACK_COMPLIANCE, - config.ResourceType.DMS_EVENT_SUBSCRIPTION, - config.ResourceType.DMS_REPLICATION_SUBNET_GROUP, - config.ResourceType.GLOBALACCELERATOR_LISTENER, - config.ResourceType.GLOBALACCELERATOR_ENDPOINT_GROUP, - config.ResourceType.GLOBALACCELERATOR_ACCELERATOR, - config.ResourceType.IAM_ACCESSANALYZER_ANALYZER, - config.ResourceType.STEPFUNCTIONS_ACTIVITY, - config.ResourceType.STEPFUNCTIONS_STATE_MACHINE, - config.ResourceType.WAFV2_IP_SET, - config.ResourceType.WAFV2_REGEX_PATTERN_SET, - config.ResourceType.ELBV2_LISTENER, - ]), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { - Scope: { - ComplianceResourceTypes: [ - 'AWS::EC2::NetworkInterface', - 'AWS::EC2::TransitGateway', - 'AWS::EC2::TransitGatewayAttachment', - 'AWS::EC2::TransitGatewayRouteTable', - 'AWS::EC2::RegisteredHAInstance', - 'AWS::EC2::LaunchTemplate', - 'AWS::ECR::Repository', - 'AWS::ECR::PublicRepository', - 'AWS::ECS::Cluster', - 'AWS::ECS::TaskDefinition', - 'AWS::ECS::Service', - 'AWS::EFS::FileSystem', - 'AWS::EFS::AccessPoint', - 'AWS::EMR::SecurityConfiguration', - 'AWS::GuardDuty::Detector', - 'AWS::OpenSearch::Domain', - 'AWS::Kinesis::Stream', - 'AWS::Kinesis::StreamConsumer', - 'AWS::MSK::Cluster', - 'AWS::Route53Resolver::ResolverEndpoint', - 'AWS::Route53Resolver::ResolverRule', - 'AWS::Route53Resolver::ResolverRuleAssociation', - 'AWS::SageMaker::CodeRepository', - 'AWS::SageMaker::Model', - 'AWS::SageMaker::NotebookInstance', - 'AWS::WorkSpaces::ConnectionAlias', - 'AWS::WorkSpaces::Workspace', - 'AWS::Backup::BackupPlan', - 'AWS::Backup::BackupSelection', - 'AWS::Backup::BackupVault', - 'AWS::Backup::RecoveryPoint', - 'AWS::Batch::JobQueue', - 'AWS::Batch::ComputeEnvironment', - 'AWS::CodeDeploy::Application', - 'AWS::CodeDeploy::DeploymentConfig', - 'AWS::CodeDeploy::DeploymentGroup', - 'AWS::Config::ResourceCompliance', - 'AWS::Config::ConformancePackCompliance', - 'AWS::DMS::EventSubscription', - 'AWS::DMS::ReplicationSubnetGroup', - 'AWS::GlobalAccelerator::Listener', - 'AWS::GlobalAccelerator::EndpointGroup', - 'AWS::GlobalAccelerator::Accelerator', - 'AWS::AccessAnalyzer::Analyzer', - 'AWS::StepFunctions::Activity', - 'AWS::StepFunctions::StateMachine', - 'AWS::WAFv2::IPSet', - 'AWS::WAFv2::RegexPatternSet', - 'AWS::ElasticLoadBalancingV2::Listener', - ], - }, - }); - }); - test('create a custom policy', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new config.CustomPolicy(stack, 'Rule', { - policyText: ` - let status = ['ACTIVE'] - - rule tableisactive when - resourceType == "AWS::DynamoDB::Table" { - configuration.tableStatus == %status - } - - rule checkcompliance when - resourceType == "AWS::DynamoDB::Table" - tableisactive { - let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus - %pitr == "ENABLED" - }`, - description: 'really cool rule', - configRuleName: 'cool rule', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { - Source: { - Owner: 'CUSTOM_POLICY', - SourceDetails: [ - { - EventSource: 'aws.config', - MessageType: 'ConfigurationItemChangeNotification', - }, - { - EventSource: 'aws.config', - MessageType: 'OversizedConfigurationItemChangeNotification', - }, - ], - }, - ConfigRuleName: 'cool rule', - Description: 'really cool rule', - }); - }); - - test('create two custom rules and one function', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.AssetCode.fromInline('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - new config.CustomRule(stack, 'Rule1', { - configurationChanges: true, - description: 'really cool rule', - lambdaFunction: fn, - maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, - configRuleName: 'cool rule 1', - periodic: true, - }); - new config.CustomRule(stack, 'Rule2', { - configurationChanges: true, - description: 'really cool rule', - lambdaFunction: fn, - configRuleName: 'cool rule 2', - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::Config::ConfigRule', 2); - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: 'config.amazonaws.com', - SourceAccount: { - Ref: 'AWS::AccountId', - }, - }); - }); - test('create a 0 charactor policy', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - // THEN - expect(() => new config.CustomPolicy(stack, 'Rule', { - policyText: '', - })).toThrow('Policy Text cannot be empty.'); - }); - - test('create over 10000 charactor policy', () => { - // GIVEN - const stack = new cdk.Stack(); - const stringLen10001 = '0123456789'.repeat(1000) + 'a'; - // WHEN - // THEN - expect(() => new config.CustomPolicy(stack, 'Rule', { - policyText: stringLen10001, - })).toThrow('Policy Text is limited to 10,000 characters or less.'); - }); -}); diff --git a/packages/@aws-cdk/aws-connect/.eslintrc.js b/packages/@aws-cdk/aws-connect/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-connect/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-connect/.gitignore b/packages/@aws-cdk/aws-connect/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-connect/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-connect/.npmignore b/packages/@aws-cdk/aws-connect/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-connect/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-connect/LICENSE b/packages/@aws-cdk/aws-connect/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-connect/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-connect/NOTICE b/packages/@aws-cdk/aws-connect/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-connect/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-connect/README.md b/packages/@aws-cdk/aws-connect/README.md deleted file mode 100644 index 10db2d90558e8..0000000000000 --- a/packages/@aws-cdk/aws-connect/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Connect Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as connect from '@aws-cdk/aws-connect'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Connect construct libraries](https://constructs.dev/search?q=connect) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Connect resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Connect.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Connect](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Connect.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-connect/jest.config.js b/packages/@aws-cdk/aws-connect/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-connect/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-connect/lib/index.ts b/packages/@aws-cdk/aws-connect/lib/index.ts deleted file mode 100644 index b23864769ccf4..0000000000000 --- a/packages/@aws-cdk/aws-connect/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Connect CloudFormation Resources: -export * from './connect.generated'; diff --git a/packages/@aws-cdk/aws-connect/package.json b/packages/@aws-cdk/aws-connect/package.json deleted file mode 100644 index 58b4221310200..0000000000000 --- a/packages/@aws-cdk/aws-connect/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-connect", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Connect", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Connect", - "packageId": "Amazon.CDK.AWS.Connect", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.connect", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "connect" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-connect", - "module": "aws_cdk.aws_connect" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-connect" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Connect", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Connect", - "aws-connect" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-connect/test/connect.test.ts b/packages/@aws-cdk/aws-connect/test/connect.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-connect/test/connect.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-connectcampaigns/.eslintrc.js b/packages/@aws-cdk/aws-connectcampaigns/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-connectcampaigns/.gitignore b/packages/@aws-cdk/aws-connectcampaigns/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-connectcampaigns/.npmignore b/packages/@aws-cdk/aws-connectcampaigns/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-connectcampaigns/LICENSE b/packages/@aws-cdk/aws-connectcampaigns/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-connectcampaigns/NOTICE b/packages/@aws-cdk/aws-connectcampaigns/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-connectcampaigns/README.md b/packages/@aws-cdk/aws-connectcampaigns/README.md deleted file mode 100644 index 9907005b69233..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ConnectCampaigns Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as connectcampaigns from '@aws-cdk/aws-connectcampaigns'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ConnectCampaigns construct libraries](https://constructs.dev/search?q=connectcampaigns) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ConnectCampaigns resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ConnectCampaigns.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ConnectCampaigns](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ConnectCampaigns.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-connectcampaigns/jest.config.js b/packages/@aws-cdk/aws-connectcampaigns/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-connectcampaigns/lib/index.ts b/packages/@aws-cdk/aws-connectcampaigns/lib/index.ts deleted file mode 100644 index 499bff43d3f05..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ConnectCampaigns CloudFormation Resources: -export * from './connectcampaigns.generated'; diff --git a/packages/@aws-cdk/aws-connectcampaigns/package.json b/packages/@aws-cdk/aws-connectcampaigns/package.json deleted file mode 100644 index d44f1f3ecf094..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-connectcampaigns", - "version": "0.0.0", - "description": "AWS::ConnectCampaigns Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ConnectCampaigns", - "packageId": "Amazon.CDK.AWS.ConnectCampaigns", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.connectcampaigns", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "connectcampaigns" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-connectcampaigns", - "module": "aws_cdk.aws_connectcampaigns" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-connectcampaigns" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ConnectCampaigns", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ConnectCampaigns", - "aws-connectcampaigns" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-connectcampaigns/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-connectcampaigns/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-connectcampaigns/test/connectcampaigns.test.ts b/packages/@aws-cdk/aws-connectcampaigns/test/connectcampaigns.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-connectcampaigns/test/connectcampaigns.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-controltower/.eslintrc.js b/packages/@aws-cdk/aws-controltower/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-controltower/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-controltower/.gitignore b/packages/@aws-cdk/aws-controltower/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-controltower/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-controltower/.npmignore b/packages/@aws-cdk/aws-controltower/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-controltower/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-controltower/LICENSE b/packages/@aws-cdk/aws-controltower/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-controltower/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-controltower/NOTICE b/packages/@aws-cdk/aws-controltower/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-controltower/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-controltower/README.md b/packages/@aws-cdk/aws-controltower/README.md deleted file mode 100644 index f8b306098adcf..0000000000000 --- a/packages/@aws-cdk/aws-controltower/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ControlTower Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as controltower from '@aws-cdk/aws-controltower'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ControlTower construct libraries](https://constructs.dev/search?q=controltower) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ControlTower resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ControlTower.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ControlTower](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ControlTower.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-controltower/jest.config.js b/packages/@aws-cdk/aws-controltower/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-controltower/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-controltower/lib/index.ts b/packages/@aws-cdk/aws-controltower/lib/index.ts deleted file mode 100644 index 14a988ef4d08a..0000000000000 --- a/packages/@aws-cdk/aws-controltower/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ControlTower CloudFormation Resources: -export * from './controltower.generated'; diff --git a/packages/@aws-cdk/aws-controltower/package.json b/packages/@aws-cdk/aws-controltower/package.json deleted file mode 100644 index e84bec091fd81..0000000000000 --- a/packages/@aws-cdk/aws-controltower/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-controltower", - "version": "0.0.0", - "description": "AWS::ControlTower Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ControlTower", - "packageId": "Amazon.CDK.AWS.ControlTower", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.controltower", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "controltower" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-controltower", - "module": "aws_cdk.aws_controltower" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-controltower" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ControlTower", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ControlTower", - "aws-controltower" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-controltower/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-controltower/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-controltower/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-controltower/test/controltower.test.ts b/packages/@aws-cdk/aws-controltower/test/controltower.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-controltower/test/controltower.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-cur/.eslintrc.js b/packages/@aws-cdk/aws-cur/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-cur/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cur/.gitignore b/packages/@aws-cdk/aws-cur/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-cur/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-cur/.npmignore b/packages/@aws-cdk/aws-cur/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-cur/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-cur/LICENSE b/packages/@aws-cdk/aws-cur/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-cur/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-cur/NOTICE b/packages/@aws-cdk/aws-cur/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-cur/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-cur/README.md b/packages/@aws-cdk/aws-cur/README.md deleted file mode 100644 index 915ac7210ebfc..0000000000000 --- a/packages/@aws-cdk/aws-cur/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::CUR Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as cur from '@aws-cdk/aws-cur'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for CUR construct libraries](https://constructs.dev/search?q=cur) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CUR resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CUR.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CUR](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CUR.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-cur/jest.config.js b/packages/@aws-cdk/aws-cur/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-cur/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-cur/lib/index.ts b/packages/@aws-cdk/aws-cur/lib/index.ts deleted file mode 100644 index 9ccbf7b4f2ab0..0000000000000 --- a/packages/@aws-cdk/aws-cur/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::CUR CloudFormation Resources: -export * from './cur.generated'; diff --git a/packages/@aws-cdk/aws-cur/package.json b/packages/@aws-cdk/aws-cur/package.json deleted file mode 100644 index ecdd4b63ef019..0000000000000 --- a/packages/@aws-cdk/aws-cur/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-cur", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::CUR", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CUR", - "packageId": "Amazon.CDK.AWS.CUR", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.cur", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cur" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-cur", - "module": "aws_cdk.aws_cur" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-cur" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CUR", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CUR", - "aws-cur" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-cur/test/cur.test.ts b/packages/@aws-cdk/aws-cur/test/cur.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-cur/test/cur.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-customerprofiles/.eslintrc.js b/packages/@aws-cdk/aws-customerprofiles/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-customerprofiles/.gitignore b/packages/@aws-cdk/aws-customerprofiles/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-customerprofiles/.npmignore b/packages/@aws-cdk/aws-customerprofiles/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-customerprofiles/LICENSE b/packages/@aws-cdk/aws-customerprofiles/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-customerprofiles/NOTICE b/packages/@aws-cdk/aws-customerprofiles/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-customerprofiles/README.md b/packages/@aws-cdk/aws-customerprofiles/README.md deleted file mode 100644 index fc555471d862b..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::CustomerProfiles Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as customerprofiles from '@aws-cdk/aws-customerprofiles'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for CustomerProfiles construct libraries](https://constructs.dev/search?q=customerprofiles) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CustomerProfiles resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CustomerProfiles.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CustomerProfiles](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CustomerProfiles.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-customerprofiles/jest.config.js b/packages/@aws-cdk/aws-customerprofiles/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-customerprofiles/lib/index.ts b/packages/@aws-cdk/aws-customerprofiles/lib/index.ts deleted file mode 100644 index 7c0cb8f7868a4..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::CustomerProfiles CloudFormation Resources: -export * from './customerprofiles.generated'; diff --git a/packages/@aws-cdk/aws-customerprofiles/package.json b/packages/@aws-cdk/aws-customerprofiles/package.json deleted file mode 100644 index 7ca006f5bc627..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-customerprofiles", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::CustomerProfiles", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.CustomerProfiles", - "packageId": "Amazon.CDK.AWS.CustomerProfiles", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.customerprofiles", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "customerprofiles" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-customerprofiles", - "module": "aws_cdk.aws_customerprofiles" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-customerprofiles" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CustomerProfiles", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::CustomerProfiles", - "aws-customerprofiles" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-customerprofiles/test/customerprofiles.test.ts b/packages/@aws-cdk/aws-customerprofiles/test/customerprofiles.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-customerprofiles/test/customerprofiles.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-databrew/.eslintrc.js b/packages/@aws-cdk/aws-databrew/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-databrew/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-databrew/.gitignore b/packages/@aws-cdk/aws-databrew/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-databrew/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-databrew/.npmignore b/packages/@aws-cdk/aws-databrew/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-databrew/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-databrew/LICENSE b/packages/@aws-cdk/aws-databrew/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-databrew/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-databrew/NOTICE b/packages/@aws-cdk/aws-databrew/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-databrew/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-databrew/README.md b/packages/@aws-cdk/aws-databrew/README.md deleted file mode 100644 index 43be6aac60fdb..0000000000000 --- a/packages/@aws-cdk/aws-databrew/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::DataBrew Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as databrew from '@aws-cdk/aws-databrew'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DataBrew construct libraries](https://constructs.dev/search?q=databrew) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DataBrew resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataBrew.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DataBrew](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataBrew.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-databrew/jest.config.js b/packages/@aws-cdk/aws-databrew/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-databrew/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-databrew/lib/index.ts b/packages/@aws-cdk/aws-databrew/lib/index.ts deleted file mode 100644 index 1e8de6dfda21a..0000000000000 --- a/packages/@aws-cdk/aws-databrew/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DataBrew CloudFormation Resources: -export * from './databrew.generated'; diff --git a/packages/@aws-cdk/aws-databrew/package.json b/packages/@aws-cdk/aws-databrew/package.json deleted file mode 100644 index 7e3a9edb7aca7..0000000000000 --- a/packages/@aws-cdk/aws-databrew/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-databrew", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::DataBrew", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DataBrew", - "packageId": "Amazon.CDK.AWS.DataBrew", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.databrew", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "databrew" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-databrew", - "module": "aws_cdk.aws_databrew" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-databrew" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DataBrew", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::DataBrew", - "aws-databrew" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-databrew/test/databrew.test.ts b/packages/@aws-cdk/aws-databrew/test/databrew.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-databrew/test/databrew.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-datapipeline/.eslintrc.js b/packages/@aws-cdk/aws-datapipeline/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-datapipeline/.gitignore b/packages/@aws-cdk/aws-datapipeline/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-datapipeline/.npmignore b/packages/@aws-cdk/aws-datapipeline/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-datapipeline/LICENSE b/packages/@aws-cdk/aws-datapipeline/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-datapipeline/NOTICE b/packages/@aws-cdk/aws-datapipeline/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-datapipeline/README.md b/packages/@aws-cdk/aws-datapipeline/README.md deleted file mode 100644 index bc8e4286a7688..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Data Pipeline Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as datapipeline from '@aws-cdk/aws-datapipeline'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DataPipeline construct libraries](https://constructs.dev/search?q=datapipeline) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DataPipeline resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataPipeline.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DataPipeline](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataPipeline.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-datapipeline/jest.config.js b/packages/@aws-cdk/aws-datapipeline/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-datapipeline/lib/index.ts b/packages/@aws-cdk/aws-datapipeline/lib/index.ts deleted file mode 100644 index aeec956c06306..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DataPipeline CloudFormation Resources: -export * from './datapipeline.generated'; diff --git a/packages/@aws-cdk/aws-datapipeline/package.json b/packages/@aws-cdk/aws-datapipeline/package.json deleted file mode 100644 index 7ed2a4f40b3ee..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-datapipeline", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DataPipeline", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.datapipeline", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "datapipeline" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.DataPipeline", - "packageId": "Amazon.CDK.AWS.DataPipeline", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-datapipeline", - "module": "aws_cdk.aws_datapipeline", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-datapipeline" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DataPipeline", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "datapipeline" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-datapipeline/test/datapipeline.test.ts b/packages/@aws-cdk/aws-datapipeline/test/datapipeline.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-datapipeline/test/datapipeline.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-datasync/.eslintrc.js b/packages/@aws-cdk/aws-datasync/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-datasync/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-datasync/.gitignore b/packages/@aws-cdk/aws-datasync/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-datasync/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-datasync/.npmignore b/packages/@aws-cdk/aws-datasync/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-datasync/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-datasync/LICENSE b/packages/@aws-cdk/aws-datasync/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-datasync/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-datasync/NOTICE b/packages/@aws-cdk/aws-datasync/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-datasync/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-datasync/README.md b/packages/@aws-cdk/aws-datasync/README.md deleted file mode 100644 index f6fc016a2c0a1..0000000000000 --- a/packages/@aws-cdk/aws-datasync/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::DataSync Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as datasync from '@aws-cdk/aws-datasync'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DataSync construct libraries](https://constructs.dev/search?q=datasync) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DataSync resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataSync.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DataSync](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataSync.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-datasync/jest.config.js b/packages/@aws-cdk/aws-datasync/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-datasync/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-datasync/lib/index.ts b/packages/@aws-cdk/aws-datasync/lib/index.ts deleted file mode 100644 index e6edd2b3a8a5f..0000000000000 --- a/packages/@aws-cdk/aws-datasync/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DataSync CloudFormation Resources: -export * from './datasync.generated'; diff --git a/packages/@aws-cdk/aws-datasync/package.json b/packages/@aws-cdk/aws-datasync/package.json deleted file mode 100644 index 0a5fececa8806..0000000000000 --- a/packages/@aws-cdk/aws-datasync/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-datasync", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::DataSync", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DataSync", - "packageId": "Amazon.CDK.AWS.DataSync", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.datasync", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "datasync" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-datasync", - "module": "aws_cdk.aws_datasync" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-datasync" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DataSync", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::DataSync", - "aws-datasync" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-datasync/test/datasync.test.ts b/packages/@aws-cdk/aws-datasync/test/datasync.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-datasync/test/datasync.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-dax/.eslintrc.js b/packages/@aws-cdk/aws-dax/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-dax/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dax/.gitignore b/packages/@aws-cdk/aws-dax/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-dax/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-dax/.npmignore b/packages/@aws-cdk/aws-dax/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-dax/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-dax/LICENSE b/packages/@aws-cdk/aws-dax/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-dax/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-dax/NOTICE b/packages/@aws-cdk/aws-dax/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-dax/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-dax/README.md b/packages/@aws-cdk/aws-dax/README.md deleted file mode 100644 index 2a2903402fd36..0000000000000 --- a/packages/@aws-cdk/aws-dax/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon DynamoDB Accelerator Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as dax from '@aws-cdk/aws-dax'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DAX construct libraries](https://constructs.dev/search?q=dax) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DAX resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DAX.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DAX](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DAX.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-dax/jest.config.js b/packages/@aws-cdk/aws-dax/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-dax/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dax/lib/index.ts b/packages/@aws-cdk/aws-dax/lib/index.ts deleted file mode 100644 index 96839bc0c2e2f..0000000000000 --- a/packages/@aws-cdk/aws-dax/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DAX CloudFormation Resources: -export * from './dax.generated'; diff --git a/packages/@aws-cdk/aws-dax/package.json b/packages/@aws-cdk/aws-dax/package.json deleted file mode 100644 index 0f14ca476b570..0000000000000 --- a/packages/@aws-cdk/aws-dax/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-dax", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DAX", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.dax", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "dax" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.DAX", - "packageId": "Amazon.CDK.AWS.DAX", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-dax", - "module": "aws_cdk.aws_dax", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-dax" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DAX", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "dax" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-dax/test/dax.test.ts b/packages/@aws-cdk/aws-dax/test/dax.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-dax/test/dax.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-detective/.eslintrc.js b/packages/@aws-cdk/aws-detective/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-detective/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-detective/.gitignore b/packages/@aws-cdk/aws-detective/.gitignore deleted file mode 100644 index 147a6c1ef79db..0000000000000 --- a/packages/@aws-cdk/aws-detective/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-detective/.npmignore b/packages/@aws-cdk/aws-detective/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-detective/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-detective/LICENSE b/packages/@aws-cdk/aws-detective/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-detective/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-detective/NOTICE b/packages/@aws-cdk/aws-detective/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-detective/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-detective/README.md b/packages/@aws-cdk/aws-detective/README.md deleted file mode 100644 index 8dcbff9922c1b..0000000000000 --- a/packages/@aws-cdk/aws-detective/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Detective Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as detective from '@aws-cdk/aws-detective'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Detective construct libraries](https://constructs.dev/search?q=detective) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Detective resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Detective.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Detective](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Detective.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-detective/jest.config.js b/packages/@aws-cdk/aws-detective/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-detective/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-detective/lib/index.ts b/packages/@aws-cdk/aws-detective/lib/index.ts deleted file mode 100644 index d16eeefc81c4b..0000000000000 --- a/packages/@aws-cdk/aws-detective/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Detective CloudFormation Resources: -export * from './detective.generated'; diff --git a/packages/@aws-cdk/aws-detective/package.json b/packages/@aws-cdk/aws-detective/package.json deleted file mode 100644 index dd6a89f0ac5da..0000000000000 --- a/packages/@aws-cdk/aws-detective/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-detective", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Detective", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Detective", - "packageId": "Amazon.CDK.AWS.Detective", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.detective", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "detective" - } - }, - "python": { - "distName": "aws-cdk.aws-detective", - "module": "aws_cdk.aws_detective", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-detective" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Detective", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Detective", - "aws-detective" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "awscdkio": { - "announce": false - }, - "maturity": "cfn-only", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-detective/test/detective.test.ts b/packages/@aws-cdk/aws-detective/test/detective.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-detective/test/detective.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-devicefarm/.eslintrc.js b/packages/@aws-cdk/aws-devicefarm/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-devicefarm/.gitignore b/packages/@aws-cdk/aws-devicefarm/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-devicefarm/.npmignore b/packages/@aws-cdk/aws-devicefarm/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-devicefarm/LICENSE b/packages/@aws-cdk/aws-devicefarm/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-devicefarm/NOTICE b/packages/@aws-cdk/aws-devicefarm/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-devicefarm/README.md b/packages/@aws-cdk/aws-devicefarm/README.md deleted file mode 100644 index 928814064d86e..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::DeviceFarm Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as devicefarm from '@aws-cdk/aws-devicefarm'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DeviceFarm construct libraries](https://constructs.dev/search?q=devicefarm) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DeviceFarm resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DeviceFarm.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DeviceFarm](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DeviceFarm.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-devicefarm/jest.config.js b/packages/@aws-cdk/aws-devicefarm/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-devicefarm/lib/index.ts b/packages/@aws-cdk/aws-devicefarm/lib/index.ts deleted file mode 100644 index e4bdf462723f2..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DeviceFarm CloudFormation Resources: -export * from './devicefarm.generated'; diff --git a/packages/@aws-cdk/aws-devicefarm/package.json b/packages/@aws-cdk/aws-devicefarm/package.json deleted file mode 100644 index af76e7899ece0..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-devicefarm", - "version": "0.0.0", - "description": "AWS::DeviceFarm Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DeviceFarm", - "packageId": "Amazon.CDK.AWS.DeviceFarm", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.devicefarm", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "devicefarm" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-devicefarm", - "module": "aws_cdk.aws_devicefarm" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-devicefarm" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DeviceFarm", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::DeviceFarm", - "aws-devicefarm" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-devicefarm/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-devicefarm/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-devicefarm/test/devicefarm.test.ts b/packages/@aws-cdk/aws-devicefarm/test/devicefarm.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-devicefarm/test/devicefarm.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-devopsguru/.eslintrc.js b/packages/@aws-cdk/aws-devopsguru/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-devopsguru/.gitignore b/packages/@aws-cdk/aws-devopsguru/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-devopsguru/.npmignore b/packages/@aws-cdk/aws-devopsguru/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-devopsguru/LICENSE b/packages/@aws-cdk/aws-devopsguru/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-devopsguru/NOTICE b/packages/@aws-cdk/aws-devopsguru/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-devopsguru/README.md b/packages/@aws-cdk/aws-devopsguru/README.md deleted file mode 100644 index 1b48152d5b735..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::DevOpsGuru Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as devopsguru from '@aws-cdk/aws-devopsguru'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DevOpsGuru construct libraries](https://constructs.dev/search?q=devopsguru) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DevOpsGuru resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DevOpsGuru.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DevOpsGuru](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DevOpsGuru.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-devopsguru/jest.config.js b/packages/@aws-cdk/aws-devopsguru/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-devopsguru/lib/index.ts b/packages/@aws-cdk/aws-devopsguru/lib/index.ts deleted file mode 100644 index 77dda1bffb780..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DevOpsGuru CloudFormation Resources: -export * from './devopsguru.generated'; diff --git a/packages/@aws-cdk/aws-devopsguru/package.json b/packages/@aws-cdk/aws-devopsguru/package.json deleted file mode 100644 index 9668bbdcaa510..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-devopsguru", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::DevOpsGuru", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DevOpsGuru", - "packageId": "Amazon.CDK.AWS.DevOpsGuru", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.devopsguru", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "devopsguru" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-devopsguru", - "module": "aws_cdk.aws_devopsguru" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-devopsguru" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DevOpsGuru", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::DevOpsGuru", - "aws-devopsguru" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-devopsguru/test/devopsguru.test.ts b/packages/@aws-cdk/aws-devopsguru/test/devopsguru.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-devopsguru/test/devopsguru.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-directoryservice/.eslintrc.js b/packages/@aws-cdk/aws-directoryservice/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-directoryservice/.gitignore b/packages/@aws-cdk/aws-directoryservice/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-directoryservice/.npmignore b/packages/@aws-cdk/aws-directoryservice/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-directoryservice/LICENSE b/packages/@aws-cdk/aws-directoryservice/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-directoryservice/NOTICE b/packages/@aws-cdk/aws-directoryservice/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-directoryservice/README.md b/packages/@aws-cdk/aws-directoryservice/README.md deleted file mode 100644 index 41fb59844c060..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Directory Service Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as directoryservice from '@aws-cdk/aws-directoryservice'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DirectoryService construct libraries](https://constructs.dev/search?q=directoryservice) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DirectoryService resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DirectoryService.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DirectoryService](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DirectoryService.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-directoryservice/jest.config.js b/packages/@aws-cdk/aws-directoryservice/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-directoryservice/lib/index.ts b/packages/@aws-cdk/aws-directoryservice/lib/index.ts deleted file mode 100644 index f09fe04e797b5..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DirectoryService CloudFormation Resources: -export * from './directoryservice.generated'; diff --git a/packages/@aws-cdk/aws-directoryservice/package.json b/packages/@aws-cdk/aws-directoryservice/package.json deleted file mode 100644 index 514d7e1caa167..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-directoryservice", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DirectoryService", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.directoryservice", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "directoryservice" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.DirectoryService", - "packageId": "Amazon.CDK.AWS.DirectoryService", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-directoryservice", - "module": "aws_cdk.aws_directoryservice", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-directoryservice" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DirectoryService", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "directoryservice" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-directoryservice/test/directoryservice.test.ts b/packages/@aws-cdk/aws-directoryservice/test/directoryservice.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-directoryservice/test/directoryservice.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-dlm/.eslintrc.js b/packages/@aws-cdk/aws-dlm/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-dlm/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dlm/.gitignore b/packages/@aws-cdk/aws-dlm/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-dlm/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-dlm/.npmignore b/packages/@aws-cdk/aws-dlm/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/aws-dlm/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-dlm/LICENSE b/packages/@aws-cdk/aws-dlm/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-dlm/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-dlm/NOTICE b/packages/@aws-cdk/aws-dlm/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-dlm/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-dlm/README.md b/packages/@aws-cdk/aws-dlm/README.md deleted file mode 100644 index 8fc2f6fc75b3a..0000000000000 --- a/packages/@aws-cdk/aws-dlm/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon Data Lifecycle Manager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as dlm from '@aws-cdk/aws-dlm'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DLM construct libraries](https://constructs.dev/search?q=dlm) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DLM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DLM.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DLM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DLM.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-dlm/jest.config.js b/packages/@aws-cdk/aws-dlm/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-dlm/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dlm/lib/index.ts b/packages/@aws-cdk/aws-dlm/lib/index.ts deleted file mode 100644 index ba1bf2ee8caf3..0000000000000 --- a/packages/@aws-cdk/aws-dlm/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DLM CloudFormation Resources: -export * from './dlm.generated'; diff --git a/packages/@aws-cdk/aws-dlm/package.json b/packages/@aws-cdk/aws-dlm/package.json deleted file mode 100644 index 46b0c112120dd..0000000000000 --- a/packages/@aws-cdk/aws-dlm/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-dlm", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DLM", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DLM", - "packageId": "Amazon.CDK.AWS.DLM", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.dlm", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "dlm" - } - }, - "python": { - "distName": "aws-cdk.aws-dlm", - "module": "aws_cdk.aws_dlm", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-dlm" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DLM", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "aws-dlm" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-dlm/test/dlm.test.ts b/packages/@aws-cdk/aws-dlm/test/dlm.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-dlm/test/dlm.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-dms/.eslintrc.js b/packages/@aws-cdk/aws-dms/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-dms/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dms/.gitignore b/packages/@aws-cdk/aws-dms/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-dms/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-dms/.npmignore b/packages/@aws-cdk/aws-dms/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-dms/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-dms/LICENSE b/packages/@aws-cdk/aws-dms/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-dms/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-dms/NOTICE b/packages/@aws-cdk/aws-dms/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-dms/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-dms/README.md b/packages/@aws-cdk/aws-dms/README.md deleted file mode 100644 index 3f7b0cf4ddb73..0000000000000 --- a/packages/@aws-cdk/aws-dms/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Database Migration Service Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as dms from '@aws-cdk/aws-dms'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DMS construct libraries](https://constructs.dev/search?q=dms) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DMS resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DMS.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DMS](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DMS.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-dms/jest.config.js b/packages/@aws-cdk/aws-dms/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-dms/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dms/lib/index.ts b/packages/@aws-cdk/aws-dms/lib/index.ts deleted file mode 100644 index cc2298668c883..0000000000000 --- a/packages/@aws-cdk/aws-dms/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DMS CloudFormation Resources: -export * from './dms.generated'; diff --git a/packages/@aws-cdk/aws-dms/package.json b/packages/@aws-cdk/aws-dms/package.json deleted file mode 100644 index ec64846b90bb0..0000000000000 --- a/packages/@aws-cdk/aws-dms/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-dms", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DMS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.dms", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "dms" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.DMS", - "packageId": "Amazon.CDK.AWS.DMS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-dms", - "module": "aws_cdk.aws_dms", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-dms" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DMS", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "dms" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-dms/test/dms.test.ts b/packages/@aws-cdk/aws-dms/test/dms.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-dms/test/dms.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-docdb/.eslintrc.js b/packages/@aws-cdk/aws-docdb/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-docdb/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-docdb/.gitignore b/packages/@aws-cdk/aws-docdb/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-docdb/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-docdb/.npmignore b/packages/@aws-cdk/aws-docdb/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/aws-docdb/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-docdb/LICENSE b/packages/@aws-cdk/aws-docdb/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-docdb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-docdb/NOTICE b/packages/@aws-cdk/aws-docdb/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-docdb/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-docdb/README.md b/packages/@aws-cdk/aws-docdb/README.md deleted file mode 100644 index 509959c8b186d..0000000000000 --- a/packages/@aws-cdk/aws-docdb/README.md +++ /dev/null @@ -1,183 +0,0 @@ -# Amazon DocumentDB Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -## Starting a Clustered Database - -To set up a clustered DocumentDB database, define a `DatabaseCluster`. You must -always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether -your instances will be launched privately or publicly: - -```ts -declare const vpc: ec2.Vpc; -const cluster = new docdb.DatabaseCluster(this, 'Database', { - masterUser: { - username: 'myuser', // NOTE: 'admin' is reserved by DocumentDB - excludeCharacters: '\"@/:', // optional, defaults to the set "\"@/" and is also used for eventually created rotations - secretName: '/myapp/mydocdb/masteruser', // optional, if you prefer to specify the secret name - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - vpc, -}); -``` - -By default, the master password will be generated and stored in AWS Secrets Manager with auto-generated description. - -Your cluster will be empty by default. - -## Connecting - -To control who can access the cluster, use the `.connections` attribute. DocumentDB databases have a default port, so -you don't need to specify the port: - -```ts -declare const cluster: docdb.DatabaseCluster; -cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); -``` - -The endpoints to access your database cluster will be available as the `.clusterEndpoint` and `.clusterReadEndpoint` -attributes: - -```ts -declare const cluster: docdb.DatabaseCluster; -const writeAddress = cluster.clusterEndpoint.socketAddress; // "HOSTNAME:PORT" -``` - -If you have existing security groups you would like to add to the cluster, use the `addSecurityGroups` method. Security -groups added in this way will not be managed by the `Connections` object of the cluster. - -```ts -declare const vpc: ec2.Vpc; -declare const cluster: docdb.DatabaseCluster; - -const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { - vpc, -}); -cluster.addSecurityGroups(securityGroup); -``` - -## Deletion protection - -Deletion protection can be enabled on an Amazon DocumentDB cluster to prevent accidental deletion of the cluster: - -```ts -declare const vpc: ec2.Vpc; -const cluster = new docdb.DatabaseCluster(this, 'Database', { - masterUser: { - username: 'myuser', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - vpc, - deletionProtection: true, // Enable deletion protection. -}); -``` - -## Rotating credentials - -When the master password is generated and stored in AWS Secrets Manager, it can be rotated automatically: - -```ts -declare const cluster: docdb.DatabaseCluster; -cluster.addRotationSingleUser(); // Will rotate automatically after 30 days -``` - -[example of setting up master password rotation for a cluster](test/integ.cluster-rotation.lit.ts) - -The multi user rotation scheme is also available: - -```ts -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; - -declare const myImportedSecret: secretsmanager.Secret; -declare const cluster: docdb.DatabaseCluster; - -cluster.addRotationMultiUser('MyUser', { - secret: myImportedSecret, // This secret must have the `masterarn` key -}); -``` - -It's also possible to create user credentials together with the cluster and add rotation: - -```ts -declare const cluster: docdb.DatabaseCluster; -const myUserSecret = new docdb.DatabaseSecret(this, 'MyUserSecret', { - username: 'myuser', - masterSecret: cluster.secret, -}); -const myUserSecretAttached = myUserSecret.attach(cluster); // Adds DB connections information in the secret - -cluster.addRotationMultiUser('MyUser', { // Add rotation using the multi user scheme - secret: myUserSecretAttached, // This secret must have the `masterarn` key -}); -``` - -**Note**: This user must be created manually in the database using the master credentials. -The rotation will start as soon as this user exists. - -See also [@aws-cdk/aws-secretsmanager](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-secretsmanager/README.md) for credentials rotation of existing clusters. - -## Audit and profiler Logs - -Sending audit or profiler needs to be configured in two places: - -1. Check / create the needed options in your ParameterGroup for [audit](https://docs.aws.amazon.com/documentdb/latest/developerguide/event-auditing.html#event-auditing-enabling-auditing) and -[profiler](https://docs.aws.amazon.com/documentdb/latest/developerguide/profiling.html#profiling.enable-profiling) logs. -2. Enable the corresponding option(s) when creating the `DatabaseCluster`: - -```ts -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from'@aws-cdk/aws-logs'; - -declare const myLogsPublishingRole: iam.Role; -declare const vpc: ec2.Vpc; - -const cluster = new docdb.DatabaseCluster(this, 'Database', { - masterUser: { - username: 'myuser', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - vpc, - exportProfilerLogsToCloudWatch: true, // Enable sending profiler logs - exportAuditLogsToCloudWatch: true, // Enable sending audit logs - cloudWatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs - cloudWatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided -}); -``` - -## Enable Performance Insights - -By enabling this feature it will be cascaded and enabled in all instances inside the cluster: - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new docdb.DatabaseCluster(this, 'Database', { - masterUser: { - username: 'myuser', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - vpc, - enablePerformanceInsights: true, // Enable Performance Insights in all instances under this cluster -}); -``` diff --git a/packages/@aws-cdk/aws-docdb/jest.config.js b/packages/@aws-cdk/aws-docdb/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-docdb/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-docdb/lib/cluster-ref.ts b/packages/@aws-cdk/aws-docdb/lib/cluster-ref.ts deleted file mode 100644 index c4aa2e2215132..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/cluster-ref.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { IConnectable, ISecurityGroup } from '@aws-cdk/aws-ec2'; -import { ISecretAttachmentTarget } from '@aws-cdk/aws-secretsmanager'; -import { IResource } from '@aws-cdk/core'; -import { Endpoint } from './endpoint'; - -/** - * Create a clustered database with a given number of instances. - */ -export interface IDatabaseCluster extends IResource, IConnectable, ISecretAttachmentTarget { - /** - * Identifier of the cluster - */ - readonly clusterIdentifier: string; - - /** - * Identifiers of the replicas - */ - readonly instanceIdentifiers: string[]; - - /** - * The endpoint to use for read/write operations - * @attribute Endpoint,Port - */ - readonly clusterEndpoint: Endpoint; - - /** - * Endpoint to use for load-balanced read-only operations. - * @attribute ReadEndpoint - */ - readonly clusterReadEndpoint: Endpoint; - - /** - * Endpoints which address each individual replica. - */ - readonly instanceEndpoints: Endpoint[]; - - /** - * The security group for this database cluster - */ - readonly securityGroupId: string; -} - -/** - * Properties that describe an existing cluster instance - */ -export interface DatabaseClusterAttributes { - /** - * The database port - * @default - none - */ - readonly port?: number; - - /** - * The security group of the database cluster - * @default - no security groups - */ - readonly securityGroup?: ISecurityGroup; - - /** - * Identifier for the cluster - */ - readonly clusterIdentifier: string; - - /** - * Identifier for the instances - * @default - no instance identifiers - */ - readonly instanceIdentifiers?: string[]; - // Actual underlying type: DBInstanceId[], but we have to type it more loosely for Java's benefit. - - /** - * Cluster endpoint address - * @default - no cluster endpoint address - */ - readonly clusterEndpointAddress?: string; - - /** - * Reader endpoint address - * @default - no reader endpoint address - */ - readonly readerEndpointAddress?: string; - - /** - * Endpoint addresses of individual instances - * @default - no instance endpoint addresses - */ - readonly instanceEndpointAddresses?: string[]; -} diff --git a/packages/@aws-cdk/aws-docdb/lib/cluster.ts b/packages/@aws-cdk/aws-docdb/lib/cluster.ts deleted file mode 100644 index c26a8a63cbae5..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/cluster.ts +++ /dev/null @@ -1,619 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IRole } from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { CfnResource, Duration, RemovalPolicy, Resource, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { DatabaseClusterAttributes, IDatabaseCluster } from './cluster-ref'; -import { DatabaseSecret } from './database-secret'; -import { CfnDBCluster, CfnDBInstance, CfnDBSubnetGroup } from './docdb.generated'; -import { Endpoint } from './endpoint'; -import { IClusterParameterGroup } from './parameter-group'; -import { BackupProps, Login, RotationMultiUserOptions } from './props'; - -/** - * Properties for a new database cluster - */ -export interface DatabaseClusterProps { - /** - * What version of the database to start - * - * @default - The default engine version. - */ - readonly engineVersion?: string; - - /** - * The port the DocumentDB cluster will listen on - * - * @default DatabaseCluster.DEFAULT_PORT - */ - readonly port?: number; - - /** - * Username and password for the administrative user - */ - readonly masterUser: Login; - - /** - * Backup settings - * - * @default - Backup retention period for automated backups is 1 day. - * Backup preferred window is set to a 30-minute window selected at random from an - * 8-hour block of time for each AWS Region, occurring on a random day of the week. - * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/backup-restore.db-cluster-snapshots.html#backup-restore.backup-window - */ - readonly backup?: BackupProps; - - /** - * The KMS key for storage encryption. - * - * @default - default master key. - */ - readonly kmsKey?: kms.IKey; - - /** - * Whether to enable storage encryption - * - * @default true - */ - readonly storageEncrypted?: boolean; - - /** - * Number of DocDB compute instances - * - * @default 1 - */ - readonly instances?: number; - - /** - * An optional identifier for the cluster - * - * @default - A name is automatically generated. - */ - readonly dbClusterName?: string; - - /** - * Base identifier for instances - * - * Every replica is named by appending the replica number to this string, 1-based. - * - * @default - `dbClusterName` is used with the word "Instance" appended. If `dbClusterName` is not provided, the - * identifier is automatically generated. - */ - readonly instanceIdentifierBase?: string; - - /** - * What type of instance to start for the replicas - */ - readonly instanceType: ec2.InstanceType; - - /** - * What subnets to run the DocumentDB instances in. - * - * Must be at least 2 subnets in two different AZs. - */ - readonly vpc: ec2.IVpc; - - /** - * Where to place the instances within the VPC - * - * @default private subnets - */ - readonly vpcSubnets?: ec2.SubnetSelection; - - /** - * Security group. - * - * @default a new security group is created. - */ - readonly securityGroup?: ec2.ISecurityGroup; - - /** - * The DB parameter group to associate with the instance. - * - * @default no parameter group - */ - readonly parameterGroup?: IClusterParameterGroup; - - /** - * A weekly time range in which maintenance should preferably execute. - * - * Must be at least 30 minutes long. - * - * Example: 'tue:04:17-tue:04:47' - * - * @default - 30-minute window selected at random from an 8-hour block of time for - * each AWS Region, occurring on a random day of the week. - * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-maintain.html#maintenance-window - */ - readonly preferredMaintenanceWindow?: string; - - /** - * The removal policy to apply when the cluster and its instances are removed - * or replaced during a stack update, or when the stack is deleted. This - * removal policy also applies to the implicit security group created for the - * cluster if one is not supplied as a parameter. - * - * @default - Retain cluster. - */ - readonly removalPolicy?: RemovalPolicy - - /** - * Specifies whether this cluster can be deleted. If deletionProtection is - * enabled, the cluster cannot be deleted unless it is modified and - * deletionProtection is disabled. deletionProtection protects clusters from - * being accidentally deleted. - * - * @default - false - */ - readonly deletionProtection?: boolean; - - /** - * Whether the profiler logs should be exported to CloudWatch. - * Note that you also have to configure the profiler log export in the Cluster's Parameter Group. - * - * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/profiling.html#profiling.enable-profiling - * @default false - */ - readonly exportProfilerLogsToCloudWatch?: boolean; - - /** - * Whether the audit logs should be exported to CloudWatch. - * Note that you also have to configure the audit log export in the Cluster's Parameter Group. - * - * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/event-auditing.html#event-auditing-enabling-auditing - * @default false - */ - readonly exportAuditLogsToCloudWatch?: boolean; - - /** - * The number of days log events are kept in CloudWatch Logs. When updating - * this property, unsetting it doesn't remove the log retention policy. To - * remove the retention policy, set the value to `Infinity`. - * - * @default - logs never expire - */ - readonly cloudWatchLogsRetention?: logs.RetentionDays; - - /** - * The IAM role for the Lambda function associated with the custom resource - * that sets the retention policy. - * - * @default - a new role is created. - */ - readonly cloudWatchLogsRetentionRole?: IRole; - - /** - * A value that indicates whether to enable Performance Insights for the instances in the DB Cluster. - * - * @default - false - */ - readonly enablePerformanceInsights?: boolean; -} - -/** - * A new or imported clustered database. - */ -abstract class DatabaseClusterBase extends Resource implements IDatabaseCluster { - /** - * Identifier of the cluster - */ - public abstract readonly clusterIdentifier: string; - /** - * Identifiers of the replicas - */ - public abstract readonly instanceIdentifiers: string[]; - - /** - * The endpoint to use for read/write operations - */ - public abstract readonly clusterEndpoint: Endpoint; - - /** - * Endpoint to use for load-balanced read-only operations. - */ - public abstract readonly clusterReadEndpoint: Endpoint; - - /** - * Endpoints which address each individual replica. - */ - public abstract readonly instanceEndpoints: Endpoint[]; - - /** - * Access to the network connections - */ - public abstract readonly connections: ec2.Connections; - - /** - * Security group identifier of this database - */ - public abstract readonly securityGroupId: string; - - /** - * Renders the secret attachment target specifications. - */ - public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { - return { - targetId: this.clusterIdentifier, - targetType: secretsmanager.AttachmentTargetType.DOCDB_DB_CLUSTER, - }; - } -} - -/** - * Create a clustered database with a given number of instances. - * - * @resource AWS::DocDB::DBCluster - */ -export class DatabaseCluster extends DatabaseClusterBase { - - /** - * The default number of instances in the DocDB cluster if none are - * specified - */ - public static readonly DEFAULT_NUM_INSTANCES = 1; - - /** - * The default port Document DB listens on - */ - public static readonly DEFAULT_PORT = 27017; - - /** - * Import an existing DatabaseCluster from properties - */ - public static fromDatabaseClusterAttributes(scope: Construct, id: string, attrs: DatabaseClusterAttributes): IDatabaseCluster { - class Import extends DatabaseClusterBase implements IDatabaseCluster { - public readonly defaultPort = typeof attrs.port !== 'undefined' ? ec2.Port.tcp(attrs.port) : undefined; - public readonly connections = new ec2.Connections({ - securityGroups: attrs.securityGroup ? [attrs.securityGroup] : undefined, - defaultPort: this.defaultPort, - }); - public readonly clusterIdentifier = attrs.clusterIdentifier; - private readonly _instanceIdentifiers = attrs.instanceIdentifiers; - private readonly _clusterEndpoint = attrs.clusterEndpointAddress && typeof attrs.port !== 'undefined' ? - new Endpoint(attrs.clusterEndpointAddress, attrs.port) : undefined; - private readonly _clusterReadEndpoint = attrs.readerEndpointAddress && typeof attrs.port !== 'undefined' ? - new Endpoint(attrs.readerEndpointAddress, attrs.port) : undefined; - private readonly _instanceEndpoints = attrs.instanceEndpointAddresses && typeof attrs.port !== 'undefined' ? - attrs.instanceEndpointAddresses.map(addr => new Endpoint(addr, attrs.port!)) : undefined; - private readonly _securityGroupId = attrs.securityGroup?.securityGroupId; - - public get instanceIdentifiers(): string[] { - if (!this._instanceIdentifiers) { - throw new Error('Cannot access `instanceIdentifiers` of an imported cluster without provided instanceIdentifiers'); - } - return this._instanceIdentifiers; - } - - public get clusterEndpoint(): Endpoint { - if (!this._clusterEndpoint) { - throw new Error('Cannot access `clusterEndpoint` of an imported cluster without an endpoint address and port'); - } - return this._clusterEndpoint; - } - - public get clusterReadEndpoint(): Endpoint { - if (!this._clusterReadEndpoint) { - throw new Error('Cannot access `clusterReadEndpoint` of an imported cluster without a readerEndpointAddress and port'); - } - return this._clusterReadEndpoint; - } - - public get instanceEndpoints(): Endpoint[] { - if (!this._instanceEndpoints) { - throw new Error('Cannot access `instanceEndpoints` of an imported cluster without instanceEndpointAddresses and port'); - } - return this._instanceEndpoints; - } - - public get securityGroupId(): string { - if (!this._securityGroupId) { - throw new Error('Cannot access `securityGroupId` of an imported cluster without securityGroupId'); - } - return this._securityGroupId; - } - } - - return new Import(scope, id); - } - - /** - * The single user secret rotation application. - */ - private static readonly SINGLE_USER_ROTATION_APPLICATION = secretsmanager.SecretRotationApplication.MONGODB_ROTATION_SINGLE_USER; - - /** - * The multi user secret rotation application. - */ - private static readonly MULTI_USER_ROTATION_APPLICATION = secretsmanager.SecretRotationApplication.MONGODB_ROTATION_MULTI_USER; - - /** - * Identifier of the cluster - */ - public readonly clusterIdentifier: string; - - /** - * The endpoint to use for read/write operations - */ - public readonly clusterEndpoint: Endpoint; - - /** - * Endpoint to use for load-balanced read-only operations. - */ - public readonly clusterReadEndpoint: Endpoint; - - /** - * The resource id for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. The cluster ID uniquely - * identifies the cluster and is used in things like IAM authentication policies. - * @attribute ClusterResourceId - */ - public readonly clusterResourceIdentifier: string; - - /** - * The connections object to implement IConnectable - */ - public readonly connections: ec2.Connections; - - /** - * Identifiers of the replicas - */ - public readonly instanceIdentifiers: string[] = []; - - /** - * Endpoints which address each individual replica. - */ - public readonly instanceEndpoints: Endpoint[] = []; - - /** - * Security group identifier of this database - */ - public readonly securityGroupId: string; - - /** - * The secret attached to this cluster - */ - public readonly secret?: secretsmanager.ISecret; - - /** - * The underlying CloudFormation resource for a database cluster. - */ - private readonly cluster: CfnDBCluster; - - /** - * The VPC where the DB subnet group is created. - */ - private readonly vpc: ec2.IVpc; - - /** - * The subnets used by the DB subnet group. - */ - private readonly vpcSubnets?: ec2.SubnetSelection; - - constructor(scope: Construct, id: string, props: DatabaseClusterProps) { - super(scope, id); - - this.vpc = props.vpc; - this.vpcSubnets = props.vpcSubnets; - - // Determine the subnet(s) to deploy the DocDB cluster to - const { subnetIds, internetConnectivityEstablished } = this.vpc.selectSubnets(this.vpcSubnets); - - // DocDB clusters require a subnet group with subnets from at least two AZs. - // We cannot test whether the subnets are in different AZs, but at least we can test the amount. - // See https://docs.aws.amazon.com/documentdb/latest/developerguide/replication.html#replication.high-availability - if (subnetIds.length < 2) { - throw new Error(`Cluster requires at least 2 subnets, got ${subnetIds.length}`); - } - - const subnetGroup = new CfnDBSubnetGroup(this, 'Subnets', { - dbSubnetGroupDescription: `Subnets for ${id} database`, - subnetIds, - }); - - // Create the security group for the DB cluster - let securityGroup: ec2.ISecurityGroup; - if (props.securityGroup) { - securityGroup = props.securityGroup; - } else { - securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { - description: 'DocumentDB security group', - vpc: this.vpc, - }); - // HACK: Use an escape-hatch to apply a consistent removal policy to the - // security group so we don't get errors when trying to delete the stack - (securityGroup.node.defaultChild as CfnResource).applyRemovalPolicy(props.removalPolicy, { - applyToUpdateReplacePolicy: true, - }); - } - this.securityGroupId = securityGroup.securityGroupId; - - // Create the CloudwatchLogsConfiguratoin - const enableCloudwatchLogsExports: string[] = []; - if (props.exportAuditLogsToCloudWatch) { - enableCloudwatchLogsExports.push('audit'); - } - if (props.exportProfilerLogsToCloudWatch) { - enableCloudwatchLogsExports.push('profiler'); - } - - // Create the secret manager secret if no password is specified - let secret: DatabaseSecret | undefined; - if (!props.masterUser.password) { - secret = new DatabaseSecret(this, 'Secret', { - username: props.masterUser.username, - encryptionKey: props.masterUser.kmsKey, - excludeCharacters: props.masterUser.excludeCharacters, - secretName: props.masterUser.secretName, - }); - } - - // Default to encrypted storage - const storageEncrypted = props.storageEncrypted ?? true; - - if (props.kmsKey && !storageEncrypted) { - throw new Error('KMS key supplied but storageEncrypted is false'); - } - - // Create the DocDB cluster - this.cluster = new CfnDBCluster(this, 'Resource', { - // Basic - engineVersion: props.engineVersion, - dbClusterIdentifier: props.dbClusterName, - dbSubnetGroupName: subnetGroup.ref, - port: props.port, - vpcSecurityGroupIds: [this.securityGroupId], - dbClusterParameterGroupName: props.parameterGroup?.parameterGroupName, - deletionProtection: props.deletionProtection, - // Admin - masterUsername: secret ? secret.secretValueFromJson('username').unsafeUnwrap() : props.masterUser.username, - masterUserPassword: secret - ? secret.secretValueFromJson('password').unsafeUnwrap() - : props.masterUser.password!.unsafeUnwrap(), // Safe usage - // Backup - backupRetentionPeriod: props.backup?.retention?.toDays(), - preferredBackupWindow: props.backup?.preferredWindow, - preferredMaintenanceWindow: props.preferredMaintenanceWindow, - // EnableCloudwatchLogsExports - enableCloudwatchLogsExports: enableCloudwatchLogsExports.length > 0 ? enableCloudwatchLogsExports : undefined, - // Encryption - kmsKeyId: props.kmsKey?.keyArn, - storageEncrypted, - }); - - this.cluster.applyRemovalPolicy(props.removalPolicy, { - applyToUpdateReplacePolicy: true, - }); - - this.clusterIdentifier = this.cluster.ref; - this.clusterResourceIdentifier = this.cluster.attrClusterResourceId; - - const port = Token.asNumber(this.cluster.attrPort); - this.clusterEndpoint = new Endpoint(this.cluster.attrEndpoint, port); - this.clusterReadEndpoint = new Endpoint(this.cluster.attrReadEndpoint, port); - - this.setLogRetention(this, props, enableCloudwatchLogsExports); - - if (secret) { - this.secret = secret.attach(this); - } - - // Create the instances - const instanceCount = props.instances ?? DatabaseCluster.DEFAULT_NUM_INSTANCES; - if (instanceCount < 1) { - throw new Error('At least one instance is required'); - } - - for (let i = 0; i < instanceCount; i++) { - const instanceIndex = i + 1; - - const instanceIdentifier = props.instanceIdentifierBase != null ? `${props.instanceIdentifierBase}${instanceIndex}` - : props.dbClusterName != null ? `${props.dbClusterName}instance${instanceIndex}` : undefined; - - const instance = new CfnDBInstance(this, `Instance${instanceIndex}`, { - // Link to cluster - dbClusterIdentifier: this.cluster.ref, - dbInstanceIdentifier: instanceIdentifier, - // Instance properties - dbInstanceClass: databaseInstanceType(props.instanceType), - enablePerformanceInsights: props.enablePerformanceInsights, - }); - - instance.applyRemovalPolicy(props.removalPolicy, { - applyToUpdateReplacePolicy: true, - }); - - // We must have a dependency on the NAT gateway provider here to create - // things in the right order. - instance.node.addDependency(internetConnectivityEstablished); - - this.instanceIdentifiers.push(instance.ref); - this.instanceEndpoints.push(new Endpoint(instance.attrEndpoint, port)); - } - - this.connections = new ec2.Connections({ - defaultPort: ec2.Port.tcp(port), - securityGroups: [securityGroup], - }); - } - - /** - * Sets up CloudWatch log retention if configured. - */ - private setLogRetention(cluster: DatabaseCluster, props: DatabaseClusterProps, cloudwatchLogsExports: string[]) { - if (props.cloudWatchLogsRetention) { - for (const log of cloudwatchLogsExports) { - new logs.LogRetention(cluster, `LogRetention${log}`, { - logGroupName: `/aws/docdb/${cluster.clusterIdentifier}/${log}`, - retention: props.cloudWatchLogsRetention, - role: props.cloudWatchLogsRetentionRole, - }); - } - } - } - - /** - * Adds the single user rotation of the master password to this cluster. - * - * @param [automaticallyAfter=Duration.days(30)] Specifies the number of days after the previous rotation - * before Secrets Manager triggers the next automatic rotation. - */ - public addRotationSingleUser(automaticallyAfter?: Duration): secretsmanager.SecretRotation { - if (!this.secret) { - throw new Error('Cannot add single user rotation for a cluster without secret.'); - } - - const id = 'RotationSingleUser'; - const existing = this.node.tryFindChild(id); - if (existing) { - throw new Error('A single user rotation was already added to this cluster.'); - } - - return new secretsmanager.SecretRotation(this, id, { - secret: this.secret, - automaticallyAfter, - application: DatabaseCluster.SINGLE_USER_ROTATION_APPLICATION, - excludeCharacters: (this.node.tryFindChild('Secret') as DatabaseSecret)._excludedCharacters, - vpc: this.vpc, - vpcSubnets: this.vpcSubnets, - target: this, - }); - } - - /** - * Adds the multi user rotation to this cluster. - */ - public addRotationMultiUser(id: string, options: RotationMultiUserOptions): secretsmanager.SecretRotation { - if (!this.secret) { - throw new Error('Cannot add multi user rotation for a cluster without secret.'); - } - return new secretsmanager.SecretRotation(this, id, { - secret: options.secret, - masterSecret: this.secret, - automaticallyAfter: options.automaticallyAfter, - excludeCharacters: (this.node.tryFindChild('Secret') as DatabaseSecret)._excludedCharacters, - application: DatabaseCluster.MULTI_USER_ROTATION_APPLICATION, - vpc: this.vpc, - vpcSubnets: this.vpcSubnets, - target: this, - }); - } - - /** - * Adds security groups to this cluster. - * @param securityGroups The security groups to add. - */ - public addSecurityGroups(...securityGroups: ec2.ISecurityGroup[]): void { - if (this.cluster.vpcSecurityGroupIds === undefined) { - this.cluster.vpcSecurityGroupIds = []; - } - this.cluster.vpcSecurityGroupIds.push(...securityGroups.map(sg => sg.securityGroupId)); - } -} - -/** - * Turn a regular instance type into a database instance type - */ -function databaseInstanceType(instanceType: ec2.InstanceType) { - return 'db.' + instanceType.toString(); -} diff --git a/packages/@aws-cdk/aws-docdb/lib/database-secret.ts b/packages/@aws-cdk/aws-docdb/lib/database-secret.ts deleted file mode 100644 index 97b1f7bff1df0..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/database-secret.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { IKey } from '@aws-cdk/aws-kms'; -import { ISecret, Secret } from '@aws-cdk/aws-secretsmanager'; -import { Aws } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Construction properties for a DatabaseSecret. - */ -export interface DatabaseSecretProps { - /** - * The username. - */ - readonly username: string; - - /** - * The KMS key to use to encrypt the secret. - * - * @default default master key - */ - readonly encryptionKey?: IKey; - - /** - * The physical name of the secret - * - * @default Secretsmanager will generate a physical name for the secret - */ - readonly secretName?: string; - - /** - * The master secret which will be used to rotate this secret. - * - * @default - no master secret information will be included - */ - readonly masterSecret?: ISecret; - - /** - * Characters to not include in the generated password. - * - * @default "\"@/" - */ - readonly excludeCharacters?: string; -} - -/** - * - * A database secret. - * - * @resource AWS::SecretsManager::Secret - */ -export class DatabaseSecret extends Secret { - - /** - * the excluded characters for this Secret - * @internal - */ - public readonly _excludedCharacters: string; - - constructor(scope: Construct, id: string, props: DatabaseSecretProps) { - const excludedCharacters = props.excludeCharacters ?? '"@/'; - - super(scope, id, { - secretName: props.secretName, - description: `Generated by the CDK for stack: ${Aws.STACK_NAME}`, - encryptionKey: props.encryptionKey, - // The CloudFormation resource provider for AWS::DocDB::DBCluster currently limits the DocDB master password to - // 41 characters when pulling the password from secrets manager using a CloudFormation reference. This does not - // line up with the CloudFormation resource specification which states a maximum of 100 characters: - // - // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-docdb-dbcluster.html#cfn-docdb-dbcluster-masteruserpassword - // - // When attempting to exceed 41 characters, a deployment fails with the message: - // Length of value for property {/MasterUserPassword} is greater than maximum allowed length {41} - generateSecretString: { - passwordLength: 41, - secretStringTemplate: JSON.stringify({ - username: props.username, - masterarn: props.masterSecret?.secretArn, - }), - generateStringKey: 'password', - excludeCharacters: excludedCharacters, - }, - }); - - this._excludedCharacters = excludedCharacters; - } -} diff --git a/packages/@aws-cdk/aws-docdb/lib/endpoint.ts b/packages/@aws-cdk/aws-docdb/lib/endpoint.ts deleted file mode 100644 index aa5b6587d8c3f..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/endpoint.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Token } from '@aws-cdk/core'; - -/** - * Connection endpoint of a database cluster or instance - * - * Consists of a combination of hostname and port. - */ -export class Endpoint { - /** - * The minimum port value - */ - private static readonly MIN_PORT = 1; - - /** - * The maximum port value - */ - private static readonly MAX_PORT = 65535; - - /** - * Determines if a port is valid - * - * @param port: The port number - * @returns boolean whether the port is valid - */ - private static isValidPort(port: number): boolean { - return Number.isInteger(port) && port >= Endpoint.MIN_PORT && port <= Endpoint.MAX_PORT; - } - - /** - * The hostname of the endpoint - */ - public readonly hostname: string; - - /** - * The port number of the endpoint. - * - * This can potentially be a CDK token. If you need to embed the port in a string (e.g. instance user data script), - * use `Endpoint.portAsString`. - */ - public readonly port: number; - - /** - * The combination of ``HOSTNAME:PORT`` for this endpoint. - */ - public readonly socketAddress: string; - - /** - * Constructs an Endpoint instance. - * - * @param address - The hostname or address of the endpoint - * @param port - The port number of the endpoint - */ - constructor(address: string, port: number) { - if (!Token.isUnresolved(port) && !Endpoint.isValidPort(port)) { - throw new Error(`Port must be an integer between [${Endpoint.MIN_PORT}, ${Endpoint.MAX_PORT}] but got: ${port}`); - } - - this.hostname = address; - this.port = port; - - const portDesc = Token.isUnresolved(port) ? Token.asString(port) : port; - this.socketAddress = `${address}:${portDesc}`; - } - - /** - * Returns the port number as a string representation that can be used for embedding within other strings. - * - * This is intended to deal with CDK's token system. Numeric CDK tokens are not expanded when their string - * representation is embedded in a string. This function returns the port either as an unresolved string token or - * as a resolved string representation of the port value. - * - * @returns {string} An (un)resolved string representation of the endpoint's port number - */ - public portAsString(): string { - if (Token.isUnresolved(this.port)) { - return Token.asString(this.port); - } else { - return this.port.toString(); - } - } -} diff --git a/packages/@aws-cdk/aws-docdb/lib/instance.ts b/packages/@aws-cdk/aws-docdb/lib/instance.ts deleted file mode 100644 index 2acf386893b4a..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/instance.ts +++ /dev/null @@ -1,234 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { ArnFormat } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IDatabaseCluster } from './cluster-ref'; -import { CfnDBInstance } from './docdb.generated'; -import { Endpoint } from './endpoint'; - -/** - * A database instance - */ -export interface IDatabaseInstance extends cdk.IResource { - /** - * The instance identifier. - */ - readonly instanceIdentifier: string; - - /** - * The instance arn. - */ - readonly instanceArn: string; - - /** - * The instance endpoint address. - * - * @attribute Endpoint - */ - readonly dbInstanceEndpointAddress: string; - - /** - * The instance endpoint port. - * - * @attribute Port - */ - readonly dbInstanceEndpointPort: string; - - /** - * The instance endpoint. - */ - readonly instanceEndpoint: Endpoint; -} - -/** - * Properties that describe an existing instance - */ -export interface DatabaseInstanceAttributes { - /** - * The instance identifier. - */ - readonly instanceIdentifier: string; - - /** - * The endpoint address. - */ - readonly instanceEndpointAddress: string; - - /** - * The database port. - */ - readonly port: number; -} - -/** - * A new or imported database instance. - */ -abstract class DatabaseInstanceBase extends cdk.Resource implements IDatabaseInstance { - /** - * Import an existing database instance. - */ - public static fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance { - class Import extends DatabaseInstanceBase implements IDatabaseInstance { - public readonly defaultPort = ec2.Port.tcp(attrs.port); - public readonly instanceIdentifier = attrs.instanceIdentifier; - public readonly dbInstanceEndpointAddress = attrs.instanceEndpointAddress; - public readonly dbInstanceEndpointPort = attrs.port.toString(); - public readonly instanceEndpoint = new Endpoint(attrs.instanceEndpointAddress, attrs.port); - } - - return new Import(scope, id); - } - - /** - * @inheritdoc - */ - public abstract readonly instanceIdentifier: string; - /** - * @inheritdoc - */ - public abstract readonly dbInstanceEndpointAddress: string; - /** - * @inheritdoc - */ - public abstract readonly dbInstanceEndpointPort: string; - /** - * @inheritdoc - */ - public abstract readonly instanceEndpoint: Endpoint; - - /** - * The instance arn. - */ - public get instanceArn(): string { - return cdk.Stack.of(this).formatArn({ - service: 'rds', - resource: 'db', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - resourceName: this.instanceIdentifier, - }); - } -} - -/** - * Construction properties for a DatabaseInstanceNew - */ -export interface DatabaseInstanceProps { - /** - * The DocumentDB database cluster the instance should launch into. - */ - readonly cluster: IDatabaseCluster; - - /** - * The name of the compute and memory capacity classes. - */ - readonly instanceType: ec2.InstanceType; - - /** - * The name of the Availability Zone where the DB instance will be located. - * - * @default - no preference - */ - readonly availabilityZone?: string; - - /** - * A name for the DB instance. If you specify a name, AWS CloudFormation - * converts it to lowercase. - * - * @default - a CloudFormation generated name - */ - readonly dbInstanceName?: string; - - /** - * Indicates that minor engine upgrades are applied automatically to the - * DB instance during the maintenance window. - * - * @default true - */ - readonly autoMinorVersionUpgrade?: boolean; - - /** - * The weekly time range (in UTC) during which system maintenance can occur. - * - * Format: `ddd:hh24:mi-ddd:hh24:mi` - * Constraint: Minimum 30-minute window - * - * @default - a 30-minute window selected at random from an 8-hour block of - * time for each AWS Region, occurring on a random day of the week. To see - * the time blocks available, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-maintain.html#maintenance-window - */ - readonly preferredMaintenanceWindow?: string; - - /** - * The CloudFormation policy to apply when the instance is removed from the - * stack or replaced during an update. - * - * @default RemovalPolicy.Retain - */ - readonly removalPolicy?: cdk.RemovalPolicy - - /** - * A value that indicates whether to enable Performance Insights for the DB Instance. - * - * @default - false - */ - readonly enablePerformanceInsights?: boolean; -} - -/** - * A database instance - * - * @resource AWS::DocDB::DBInstance - */ -export class DatabaseInstance extends DatabaseInstanceBase implements IDatabaseInstance { - /** - * The instance's database cluster - */ - public readonly cluster: IDatabaseCluster; - - /** - * @inheritdoc - */ - public readonly instanceIdentifier: string; - - /** - * @inheritdoc - */ - public readonly dbInstanceEndpointAddress: string; - - /** - * @inheritdoc - */ - public readonly dbInstanceEndpointPort: string; - - /** - * @inheritdoc - */ - public readonly instanceEndpoint: Endpoint; - - constructor(scope: Construct, id: string, props: DatabaseInstanceProps) { - super(scope, id); - - const instance = new CfnDBInstance(this, 'Resource', { - dbClusterIdentifier: props.cluster.clusterIdentifier, - dbInstanceClass: `db.${props.instanceType}`, - autoMinorVersionUpgrade: props.autoMinorVersionUpgrade ?? true, - availabilityZone: props.availabilityZone, - dbInstanceIdentifier: props.dbInstanceName, - preferredMaintenanceWindow: props.preferredMaintenanceWindow, - enablePerformanceInsights: props.enablePerformanceInsights, - }); - - this.cluster = props.cluster; - this.instanceIdentifier = instance.ref; - this.dbInstanceEndpointAddress = instance.attrEndpoint; - this.dbInstanceEndpointPort = instance.attrPort; - - // create a number token that represents the port of the instance - const portAttribute = cdk.Token.asNumber(instance.attrPort); - this.instanceEndpoint = new Endpoint(instance.attrEndpoint, portAttribute); - - instance.applyRemovalPolicy(props.removalPolicy, { - applyToUpdateReplacePolicy: true, - }); - } -} diff --git a/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts b/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts deleted file mode 100644 index 5a9e377916f2d..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/parameter-group.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { IResource, Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnDBClusterParameterGroup } from './docdb.generated'; - -/** - * A parameter group - */ -export interface IClusterParameterGroup extends IResource { - /** - * The name of this parameter group - */ - readonly parameterGroupName: string; -} - -/** - * A new cluster or instance parameter group - */ -abstract class ClusterParameterGroupBase extends Resource implements IClusterParameterGroup { - /** - * Imports a parameter group - */ - public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IClusterParameterGroup { - class Import extends Resource implements IClusterParameterGroup { - public readonly parameterGroupName = parameterGroupName; - } - return new Import(scope, id); - } - - /** - * The name of the parameter group - */ - public abstract readonly parameterGroupName: string; -} - -/** - * Properties for a cluster parameter group - */ -export interface ClusterParameterGroupProps { - /** - * Description for this parameter group - * - * @default a CDK generated description - */ - readonly description?: string; - - /** - * Database family of this parameter group - */ - readonly family: string; - - /** - * The name of the cluster parameter group - * - * @default A CDK generated name for the cluster parameter group - */ - readonly dbClusterParameterGroupName?: string; - - /** - * The parameters in this parameter group - */ - readonly parameters: { [key: string]: string }; -} - -/** - * A cluster parameter group - * - * @resource AWS::DocDB::DBClusterParameterGroup - */ -export class ClusterParameterGroup extends ClusterParameterGroupBase implements IClusterParameterGroup { - /** - * The name of the parameter group - */ - public readonly parameterGroupName: string; - - constructor(scope: Construct, id: string, props: ClusterParameterGroupProps) { - super(scope, id); - - const resource = new CfnDBClusterParameterGroup(this, 'Resource', { - name: props.dbClusterParameterGroupName, - description: props.description || `Cluster parameter group for ${props.family}`, - family: props.family, - parameters: props.parameters, - }); - - this.parameterGroupName = resource.ref; - } -} diff --git a/packages/@aws-cdk/aws-docdb/lib/props.ts b/packages/@aws-cdk/aws-docdb/lib/props.ts deleted file mode 100644 index e6abe3deba14c..0000000000000 --- a/packages/@aws-cdk/aws-docdb/lib/props.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Duration, SecretValue } from '@aws-cdk/core'; - -/** - * Backup configuration for DocumentDB databases - * - * @default - The retention period for automated backups is 1 day. - * The preferred backup window will be a 30-minute window selected at random - * from an 8-hour block of time for each AWS Region. - * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/backup-restore.db-cluster-snapshots.html#backup-restore.backup-window - */ -export interface BackupProps { - - /** - * How many days to retain the backup - */ - readonly retention: Duration; - - /** - * A daily time range in 24-hours UTC format in which backups preferably execute. - * - * Must be at least 30 minutes long. - * - * Example: '01:00-02:00' - * - * @default - a 30-minute window selected at random from an 8-hour block of - * time for each AWS Region. To see the time blocks available, see - * https://docs.aws.amazon.com/documentdb/latest/developerguide/backup-restore.db-cluster-snapshots.html#backup-restore.backup-window - */ - readonly preferredWindow?: string; -} - -/** - * Login credentials for a database cluster - */ -export interface Login { - /** - * Username - */ - readonly username: string; - /** - * Password - * - * Do not put passwords in your CDK code directly. - * - * @default a Secrets Manager generated password - */ - readonly password?: SecretValue; - /** - * KMS encryption key to encrypt the generated secret. - * - * @default default master key - */ - readonly kmsKey?: kms.IKey; - - /** - * Specifies characters to not include in generated passwords. - * - * @default "\"@/" - */ - readonly excludeCharacters?: string; - - /** - * The physical name of the secret, that will be generated. - * - * @default Secretsmanager will generate a physical name for the secret - */ - readonly secretName?: string; -} - -/** - * Options to add the multi user rotation - */ -export interface RotationMultiUserOptions { - /** - * The secret to rotate. It must be a JSON string with the following format: - * ``` - * { - * "engine": , - * "host": , - * "username": , - * "password": , - * "dbname": , - * "port": , - * "masterarn": - * "ssl": - * } - * ``` - */ - readonly secret: secretsmanager.ISecret; - - /** - * Specifies the number of days after the previous rotation before - * Secrets Manager triggers the next automatic rotation. - * - * @default Duration.days(30) - */ - readonly automaticallyAfter?: Duration; -} diff --git a/packages/@aws-cdk/aws-docdb/package.json b/packages/@aws-cdk/aws-docdb/package.json deleted file mode 100644 index b5ef394339857..0000000000000 --- a/packages/@aws-cdk/aws-docdb/package.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "name": "@aws-cdk/aws-docdb", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DocDB", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DocDB", - "packageId": "Amazon.CDK.AWS.DocDB", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.docdb", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "docdb" - } - }, - "python": { - "distName": "aws-cdk.aws-docdb", - "module": "aws_cdk.aws_docdb", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-docdb" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DocDB", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::DocDB", - "aws-docdb" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "attribute-tag:@aws-cdk/aws-docdb.DatabaseSecret.secretFullArn", - "attribute-tag:@aws-cdk/aws-docdb.DatabaseSecret.secretName" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-docdb/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-docdb/rosetta/default.ts-fixture deleted file mode 100644 index f5b4d71caa2a5..0000000000000 --- a/packages/@aws-cdk/aws-docdb/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as docdb from '@aws-cdk/aws-docdb'; -import * as ec2 from '@aws-cdk/aws-ec2'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-docdb/test/cluster.test.ts b/packages/@aws-cdk/aws-docdb/test/cluster.test.ts deleted file mode 100644 index 7e07f33f7d39f..0000000000000 --- a/packages/@aws-cdk/aws-docdb/test/cluster.test.ts +++ /dev/null @@ -1,965 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { ClusterParameterGroup, DatabaseCluster, DatabaseSecret } from '../lib'; - -describe('DatabaseCluster', () => { - test('check that instantiation works', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::DocDB::DBCluster', { - Properties: { - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - MasterUsername: 'admin', - MasterUserPassword: 'tooshort', - VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], - StorageEncrypted: true, - }, - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }); - - Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBSubnetGroup', { - SubnetIds: [ - { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, - { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, - { Ref: 'VPCPrivateSubnet3Subnet3EDCD457' }, - ], - }); - }); - - test('can create a cluster with a single instance', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - instances: 1, - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - MasterUsername: 'admin', - MasterUserPassword: 'tooshort', - VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], - }); - }); - - test('errors when less than one instance is specified', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - expect(() => { - new DatabaseCluster(stack, 'Database', { - instances: 0, - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), - }); - }).toThrowError('At least one instance is required'); - }); - - test('errors when only one subnet is specified', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 1, - }); - - // WHEN - expect(() => { - new DatabaseCluster(stack, 'Database', { - instances: 1, - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - }); - }).toThrowError('Cluster requires at least 2 subnets, got 1'); - }); - - test('secret attachment target type is correct', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - instances: 1, - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::SecretTargetAttachment', { - SecretId: { Ref: 'DatabaseSecret3B817195' }, - TargetId: { Ref: 'DatabaseB269D8BB' }, - TargetType: 'AWS::DocDB::DBCluster', - }); - }); - - test('can create a cluster with imported vpc and security group', () => { - // GIVEN - const stack = testStack(); - const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { - vpcId: 'VPC12345', - }); - const sg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'SecurityGroupId12345'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - instances: 1, - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - securityGroup: sg, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - MasterUsername: 'admin', - MasterUserPassword: 'tooshort', - VpcSecurityGroupIds: ['SecurityGroupId12345'], - }); - }); - - test('can configure cluster deletion protection', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - deletionProtection: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - DeletionProtection: true, - }); - }); - - test('cluster with parameter group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const group = new ClusterParameterGroup(stack, 'Params', { - family: 'hello', - description: 'bye', - parameters: { - param: 'value', - }, - }); - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - parameterGroup: group, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - DBClusterParameterGroupName: { Ref: 'ParamsA8366201' }, - }); - }); - - test('cluster with imported parameter group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const group = ClusterParameterGroup.fromParameterGroupName(stack, 'Params', 'ParamGroupName'); - - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - parameterGroup: group, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - DBClusterParameterGroupName: 'ParamGroupName', - }); - }); - - test('creates a secret when master credentials are not specified', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - MasterUsername: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DatabaseSecret3B817195', - }, - ':SecretString:username::}}', - ], - ], - }, - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DatabaseSecret3B817195', - }, - ':SecretString:password::}}', - ], - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: { - ExcludeCharacters: '\"@/', - GenerateStringKey: 'password', - PasswordLength: 41, - SecretStringTemplate: '{"username":"admin"}', - }, - }); - }); - - test('creates a secret with excludeCharacters', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - excludeCharacters: '"@/()[]', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: Match.objectLike({ - ExcludeCharacters: '\"@/()[]', - }), - }); - }); - - test('creates a secret with secretName set', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - secretName: '/myapp/mydocdb/masteruser', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Name: '/myapp/mydocdb/masteruser', - }); - }); - - test('create an encrypted cluster with custom KMS key', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - kmsKey: new kms.Key(stack, 'Key'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - KmsKeyId: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - StorageEncrypted: true, - }); - }); - - test('creating a cluster defaults to using encryption', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - StorageEncrypted: true, - }); - }); - - test('supplying a KMS key with storageEncryption false throws an error', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - function action() { - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - kmsKey: new kms.Key(stack, 'Key'), - storageEncrypted: false, - }); - } - - // THEN - expect(action).toThrow(); - }); - - test('cluster exposes different read and write endpoints', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const cluster = new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // THEN - expect(stack.resolve(cluster.clusterEndpoint)).not.toBe(stack.resolve(cluster.clusterReadEndpoint)); - }); - - test('instance identifier used when present', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const instanceIdentifierBase = 'instanceidentifierbase-'; - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - instanceIdentifierBase, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBInstance', { - DBInstanceIdentifier: `${instanceIdentifierBase}1`, - }); - }); - - test('cluster identifier used', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const clusterIdentifier = 'clusteridentifier-'; - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - dbClusterName: clusterIdentifier, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBInstance', { - DBInstanceIdentifier: `${clusterIdentifier}instance1`, - }); - }); - - test('imported cluster has supplied attributes', () => { - // GIVEN - const stack = testStack(); - - // WHEN - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterEndpointAddress: 'addr', - clusterIdentifier: 'identifier', - instanceEndpointAddresses: ['addr'], - instanceIdentifiers: ['identifier'], - port: 3306, - readerEndpointAddress: 'reader-address', - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - }), - }); - - // THEN - expect(cluster.clusterEndpoint.hostname).toEqual('addr'); - expect(cluster.clusterEndpoint.port).toEqual(3306); - expect(cluster.clusterIdentifier).toEqual('identifier'); - expect(cluster.instanceIdentifiers).toEqual(['identifier']); - expect(cluster.clusterReadEndpoint.hostname).toEqual('reader-address'); - expect(cluster.securityGroupId).toEqual('sg-123456789'); - }); - - test('imported cluster with imported security group honors allowAllOutbound', () => { - // GIVEN - const stack = testStack(); - - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterEndpointAddress: 'addr', - clusterIdentifier: 'identifier', - instanceEndpointAddresses: ['addr'], - instanceIdentifiers: ['identifier'], - port: 3306, - readerEndpointAddress: 'reader-address', - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - }), - }); - - // WHEN - cluster.connections.allowToAnyIpv4(ec2.Port.tcp(443)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: 'sg-123456789', - }); - }); - - test('minimal imported cluster throws on accessing attributes for unprovided parameters', () => { - const stack = testStack(); - - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterIdentifier: 'identifier', - }); - - expect(cluster.clusterIdentifier).toEqual('identifier'); - expect(() => cluster.clusterEndpoint).toThrow(/Cannot access `clusterEndpoint` of an imported cluster/); - expect(() => cluster.clusterReadEndpoint).toThrow(/Cannot access `clusterReadEndpoint` of an imported cluster/); - expect(() => cluster.instanceIdentifiers).toThrow(/Cannot access `instanceIdentifiers` of an imported cluster/); - expect(() => cluster.instanceEndpoints).toThrow(/Cannot access `instanceEndpoints` of an imported cluster/); - expect(() => cluster.securityGroupId).toThrow(/Cannot access `securityGroupId` of an imported cluster/); - }); - - test('backup retention period respected', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - backup: { - retention: cdk.Duration.days(20), - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - BackupRetentionPeriod: 20, - }); - }); - - test('backup maintenance window respected', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - backup: { - retention: cdk.Duration.days(20), - preferredWindow: '07:34-08:04', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - BackupRetentionPeriod: 20, - PreferredBackupWindow: '07:34-08:04', - }); - }); - - test('regular maintenance window respected', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - preferredMaintenanceWindow: '07:34-08:04', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - PreferredMaintenanceWindow: '07:34-08:04', - }); - }); - - test('can configure CloudWatchLogs for audit', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - exportAuditLogsToCloudWatch: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - EnableCloudwatchLogsExports: ['audit'], - }); - }); - - test('can configure CloudWatchLogs for profiler', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - exportProfilerLogsToCloudWatch: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - EnableCloudwatchLogsExports: ['profiler'], - }); - }); - - test('can configure CloudWatchLogs for all logs', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - exportAuditLogsToCloudWatch: true, - exportProfilerLogsToCloudWatch: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - EnableCloudwatchLogsExports: ['audit', 'profiler'], - }); - }); - - test('can set CloudWatch log retention', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - exportAuditLogsToCloudWatch: true, - exportProfilerLogsToCloudWatch: true, - cloudWatchLogsRetention: logs.RetentionDays.THREE_MONTHS, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { - ServiceToken: { - 'Fn::GetAtt': [ - 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', - 'Arn', - ], - }, - LogGroupName: { 'Fn::Join': ['', ['/aws/docdb/', { Ref: 'DatabaseB269D8BB' }, '/audit']] }, - RetentionInDays: 90, - }); - Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { - ServiceToken: { - 'Fn::GetAtt': [ - 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', - 'Arn', - ], - }, - LogGroupName: { 'Fn::Join': ['', ['/aws/docdb/', { Ref: 'DatabaseB269D8BB' }, '/profiler']] }, - RetentionInDays: 90, - }); - }); - - test('can enable Performance Insights on instances', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - enablePerformanceInsights: true, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { - Properties: { - EnablePerformanceInsights: true, - }, - }); - }); - - test('single user rotation', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - }); - - // WHEN - cluster.addRotationSingleUser(cdk.Duration.days(5)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Location: { - ApplicationId: { 'Fn::FindInMap': ['DatabaseRotationSingleUserSARMapping9AEB3E55', { Ref: 'AWS::Partition' }, 'applicationId'] }, - SemanticVersion: { 'Fn::FindInMap': ['DatabaseRotationSingleUserSARMapping9AEB3E55', { Ref: 'AWS::Partition' }, 'semanticVersion'] }, - }, - Parameters: { - endpoint: { - 'Fn::Join': [ - '', - [ - 'https://secretsmanager.us-test-1.', - { Ref: 'AWS::URLSuffix' }, - ], - ], - }, - functionName: 'DatabaseRotationSingleUser458A45BE', - excludeCharacters: '\"@/', - vpcSubnetIds: { - 'Fn::Join': [ - '', - [ - { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, - ',', - { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, - ',', - { Ref: 'VPCPrivateSubnet3Subnet3EDCD457' }, - ], - ], - }, - vpcSecurityGroupIds: { - 'Fn::GetAtt': ['DatabaseRotationSingleUserSecurityGroupAC6E0E73', 'GroupId'], - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { Ref: 'DatabaseSecretAttachmentE5D1B020' }, - RotationLambdaARN: { - 'Fn::GetAtt': ['DatabaseRotationSingleUser65F55654', 'Outputs.RotationLambdaARN'], - }, - RotationRules: { - AutomaticallyAfterDays: 5, - }, - }); - }); - - test('single user rotation requires secret', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('secret'), - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - }); - - // WHEN - function addSingleUserRotation() { - cluster.addRotationSingleUser(cdk.Duration.days(10)); - } - - // THEN - expect(addSingleUserRotation).toThrow(); - }); - - test('no multiple single user rotations', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - }); - - // WHEN - cluster.addRotationSingleUser(cdk.Duration.days(5)); - function addSecondRotation() { - cluster.addRotationSingleUser(cdk.Duration.days(10)); - } - - // THEN - expect(addSecondRotation).toThrow(); - }); - - test('multi user rotation', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - }); - const userSecret = new DatabaseSecret(stack, 'UserSecret', { - username: 'seconduser', - masterSecret: cluster.secret, - }); - userSecret.attach(cluster); - - // WHEN - cluster.addRotationMultiUser('Rotation', { - secret: userSecret, - automaticallyAfter: cdk.Duration.days(5), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Location: { - ApplicationId: { 'Fn::FindInMap': ['DatabaseRotationSARMappingE46CFA92', { Ref: 'AWS::Partition' }, 'applicationId'] }, - SemanticVersion: { 'Fn::FindInMap': ['DatabaseRotationSARMappingE46CFA92', { Ref: 'AWS::Partition' }, 'semanticVersion'] }, - }, - Parameters: { - endpoint: { - 'Fn::Join': [ - '', - [ - 'https://secretsmanager.us-test-1.', - { Ref: 'AWS::URLSuffix' }, - ], - ], - }, - functionName: 'DatabaseRotation0D47EBD2', - excludeCharacters: '\"@/', - vpcSubnetIds: { - 'Fn::Join': [ - '', - [ - { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, - ',', - { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, - ',', - { Ref: 'VPCPrivateSubnet3Subnet3EDCD457' }, - ], - ], - }, - vpcSecurityGroupIds: { - 'Fn::GetAtt': ['DatabaseRotationSecurityGroup17736B63', 'GroupId'], - }, - masterSecretArn: { Ref: 'DatabaseSecretAttachmentE5D1B020' }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { Ref: 'UserSecret0463E4F5' }, - RotationLambdaARN: { - 'Fn::GetAtt': ['DatabaseRotation6B6E1D86', 'Outputs.RotationLambdaARN'], - }, - RotationRules: { - AutomaticallyAfterDays: 5, - }, - }); - }); - - test('multi user rotation requires secret', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('secret'), - }, - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - }); - const userSecret = new DatabaseSecret(stack, 'UserSecret', { - username: 'seconduser', - masterSecret: cluster.secret, - }); - userSecret.attach(cluster); - - // WHEN - function addMultiUserRotation() { - cluster.addRotationMultiUser('Rotation', { - secret: userSecret, - }); - } - - // THEN - expect(addMultiUserRotation).toThrow(); - }); - - test('adds security groups', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - vpc, - masterUser: { - username: 'admin', - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), - }); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc, - }); - - // WHEN - cluster.addSecurityGroups(securityGroup); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { - VpcSecurityGroupIds: Match.arrayWith([stack.resolve(securityGroup.securityGroupId)]), - }); - }); -}); - -function testStack() { - const stack = new cdk.Stack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } }); - stack.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']); - return stack; -} diff --git a/packages/@aws-cdk/aws-docdb/test/instance.test.ts b/packages/@aws-cdk/aws-docdb/test/instance.test.ts deleted file mode 100644 index 761c842efce56..0000000000000 --- a/packages/@aws-cdk/aws-docdb/test/instance.test.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as constructs from 'constructs'; -import { DatabaseCluster, DatabaseInstance } from '../lib'; - -const CLUSTER_INSTANCE_TYPE = ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE); -const SINGLE_INSTANCE_TYPE = ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.XLARGE); -const EXPECTED_SYNTH_INSTANCE_TYPE = `db.${SINGLE_INSTANCE_TYPE}`; - -describe('DatabaseInstance', () => { - test('check that instantiation works', () => { - // GIVEN - const stack = testStack(); - - // WHEN - new DatabaseInstance(stack, 'Instance', { - cluster: stack.cluster, - instanceType: SINGLE_INSTANCE_TYPE, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { - Properties: { - DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' }, - DBInstanceClass: EXPECTED_SYNTH_INSTANCE_TYPE, - AutoMinorVersionUpgrade: true, - }, - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }); - }); - - test.each([ - [undefined, true], - [true, true], - [false, false], - ])('check that autoMinorVersionUpdate works: %p', (given: boolean | undefined, expected: boolean) => { - // GIVEN - const stack = testStack(); - - // WHEN - new DatabaseInstance(stack, 'Instance', { - cluster: stack.cluster, - instanceType: SINGLE_INSTANCE_TYPE, - autoMinorVersionUpgrade: given, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { - Properties: { - DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' }, - DBInstanceClass: EXPECTED_SYNTH_INSTANCE_TYPE, - AutoMinorVersionUpgrade: expected, - }, - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }); - }); - - test('check that the endpoint works', () => { - // GIVEN - const stack = testStack(); - const instance = new DatabaseInstance(stack, 'Instance', { - cluster: stack.cluster, - instanceType: SINGLE_INSTANCE_TYPE, - }); - const exportName = 'DbInstanceEndpoint'; - - // WHEN - new cdk.CfnOutput(stack, exportName, { - exportName, - value: instance.instanceEndpoint.socketAddress, - }); - - // THEN - Template.fromStack(stack).hasOutput(exportName, { - Export: { - Name: exportName, - }, - Value: { - 'Fn::Join': [ - '', - [ - { 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint'] }, - ':', - { 'Fn::GetAtt': ['InstanceC1063A87', 'Port'] }, - ], - ], - }, - }); - }); - - test('check that instanceArn property works', () => { - // GIVEN - const stack = testStack(); - const instance = new DatabaseInstance(stack, 'Instance', { - cluster: stack.cluster, - instanceType: SINGLE_INSTANCE_TYPE, - }); - const exportName = 'DbInstanceArn'; - - // WHEN - new cdk.CfnOutput(stack, exportName, { - exportName, - value: instance.instanceArn, - }); - - // THEN - Template.fromStack(stack).hasOutput(exportName, { - Export: { - Name: exportName, - }, - Value: { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':rds:us-test-1:12345:db:', - { Ref: 'InstanceC1063A87' }, - ], - ], - }, - }); - }); - - test('check importing works as expected', () => { - // GIVEN - const stack = testStack(); - const arnExportName = 'DbInstanceArn'; - const endpointExportName = 'DbInstanceEndpoint'; - const instanceEndpointAddress = '127.0.0.1'; - const instanceIdentifier = 'InstanceID'; - const port = 8888; - - // WHEN - const instance = DatabaseInstance.fromDatabaseInstanceAttributes(stack, 'Instance', { - instanceEndpointAddress, - instanceIdentifier, - port, - }); - new cdk.CfnOutput(stack, 'ArnOutput', { - exportName: arnExportName, - value: instance.instanceArn, - }); - new cdk.CfnOutput(stack, 'EndpointOutput', { - exportName: endpointExportName, - value: instance.instanceEndpoint.socketAddress, - }); - - // THEN - Template.fromStack(stack).hasOutput('ArnOutput', { - Export: { - Name: arnExportName, - }, - Value: { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - `:rds:us-test-1:12345:db:${instanceIdentifier}`, - ], - ], - }, - }); - Template.fromStack(stack).hasOutput('EndpointOutput', { - Export: { - Name: endpointExportName, - }, - Value: `${instanceEndpointAddress}:${port}`, - }); - }); - - test('can enable performance insights on instances', () => { - // GIVEN - const stack = testStack(); - - // WHEN - new DatabaseInstance(stack, 'Instance', { - cluster: stack.cluster, - instanceType: SINGLE_INSTANCE_TYPE, - enablePerformanceInsights: true, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { - Properties: { - EnablePerformanceInsights: true, - }, - }); - }); -}); - -class TestStack extends cdk.Stack { - public readonly vpc: ec2.Vpc; - public readonly cluster: DatabaseCluster; - - constructor(scope?: constructs.Construct, id?: string, props: cdk.StackProps = {}) { - super(scope, id, props); - - this.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']); - - this.vpc = new ec2.Vpc(this, 'VPC'); - this.cluster = new DatabaseCluster(this, 'Database', { - masterUser: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceType: CLUSTER_INSTANCE_TYPE, - vpc: this.vpc, - }); - } -} - -function testStack() { - const stack = new TestStack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } }); - return stack; -} diff --git a/packages/@aws-cdk/aws-docdb/test/integ.cluster-rotation.lit.ts b/packages/@aws-cdk/aws-docdb/test/integ.cluster-rotation.lit.ts deleted file mode 100644 index ae655dd213a4d..0000000000000 --- a/packages/@aws-cdk/aws-docdb/test/integ.cluster-rotation.lit.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as docdb from '../lib'; - -/* - * Stack verification steps: - * * aws secretsmanager describe-secret --secret-id - * * aws lambda get-function --function-name - */ - -class TestStack extends cdk.Stack { - constructor(scope: constructs.Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); - - const params = new ClusterParameterGroup(this, 'Params', { - family: 'docdb3.6', - description: 'A nice parameter group', - parameters: { - audit_logs: 'disabled', - tls: 'enabled', - ttl_monitor: 'enabled', - }, - }); - - const kmsKey = new kms.Key(this, 'DbSecurity', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - }); - - const cluster = new DatabaseCluster(this, 'Database', { - engineVersion: '3.6.0', - masterUser: { - username: 'docdb', - password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6'), - }, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, - vpc, - parameterGroup: params, - kmsKey, - removalPolicy: cdk.RemovalPolicy.DESTROY, - enablePerformanceInsights: true, - }); - - cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); - } -} - -const app = new cdk.App(); - -new TestStack(app, 'aws-cdk-docdb-integ'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-docdb/test/parameter-group.test.ts b/packages/@aws-cdk/aws-docdb/test/parameter-group.test.ts deleted file mode 100644 index 03aaff0fb2e77..0000000000000 --- a/packages/@aws-cdk/aws-docdb/test/parameter-group.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; -import { ClusterParameterGroup } from '../lib'; - -describe('ClusterParameterGroup', () => { - test('check that instantiation works', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - new ClusterParameterGroup(stack, 'Params', { - family: 'hello', - description: 'desc', - parameters: { - key: 'value', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBClusterParameterGroup', { - Description: 'desc', - Family: 'hello', - Parameters: { - key: 'value', - }, - }); - }); - - test('check automatically generated descriptions', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - new ClusterParameterGroup(stack, 'Params', { - family: 'hello', - parameters: { - key: 'value', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBClusterParameterGroup', { - Description: 'Cluster parameter group for hello', - Family: 'hello', - Parameters: { - key: 'value', - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-docdbelastic/.eslintrc.js b/packages/@aws-cdk/aws-docdbelastic/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-docdbelastic/.gitignore b/packages/@aws-cdk/aws-docdbelastic/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-docdbelastic/.npmignore b/packages/@aws-cdk/aws-docdbelastic/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-docdbelastic/LICENSE b/packages/@aws-cdk/aws-docdbelastic/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-docdbelastic/NOTICE b/packages/@aws-cdk/aws-docdbelastic/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-docdbelastic/README.md b/packages/@aws-cdk/aws-docdbelastic/README.md deleted file mode 100644 index 96e22284eb6c0..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::DocDBElastic Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as docdbelastic from '@aws-cdk/aws-docdbelastic'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for DocDBElastic construct libraries](https://constructs.dev/search?q=docdbelastic) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DocDBElastic resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DocDBElastic.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DocDBElastic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DocDBElastic.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-docdbelastic/jest.config.js b/packages/@aws-cdk/aws-docdbelastic/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-docdbelastic/lib/index.ts b/packages/@aws-cdk/aws-docdbelastic/lib/index.ts deleted file mode 100644 index 8881ebf3296aa..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::DocDBElastic CloudFormation Resources: -export * from './docdbelastic.generated'; diff --git a/packages/@aws-cdk/aws-docdbelastic/package.json b/packages/@aws-cdk/aws-docdbelastic/package.json deleted file mode 100644 index cee416ec0b4d2..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-docdbelastic", - "version": "0.0.0", - "description": "AWS::DocDBElastic Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.DocDBElastic", - "packageId": "Amazon.CDK.AWS.DocDBElastic", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.docdbelastic", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "docdbelastic" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-docdbelastic", - "module": "aws_cdk.aws_docdbelastic" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-docdbelastic" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DocDBElastic", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::DocDBElastic", - "aws-docdbelastic" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-docdbelastic/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-docdbelastic/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-docdbelastic/test/docdbelastic.test.ts b/packages/@aws-cdk/aws-docdbelastic/test/docdbelastic.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-docdbelastic/test/docdbelastic.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-dynamodb/.eslintrc.js b/packages/@aws-cdk/aws-dynamodb/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dynamodb/.gitignore b/packages/@aws-cdk/aws-dynamodb/.gitignore deleted file mode 100644 index 1a33df4fbc1be..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -*.generated.ts -dist -tsconfig.json - -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-dynamodb/.npmignore b/packages/@aws-cdk/aws-dynamodb/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-dynamodb/LICENSE b/packages/@aws-cdk/aws-dynamodb/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-dynamodb/NOTICE b/packages/@aws-cdk/aws-dynamodb/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-dynamodb/README.md b/packages/@aws-cdk/aws-dynamodb/README.md deleted file mode 100644 index 21429e7bf530c..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/README.md +++ /dev/null @@ -1,250 +0,0 @@ -# Amazon DynamoDB Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Here is a minimal deployable DynamoDB table definition: - -```ts -const table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, -}); -``` - -## Importing existing tables - -To import an existing table into your CDK application, use the `Table.fromTableName`, `Table.fromTableArn` or `Table.fromTableAttributes` -factory method. This method accepts table name or table ARN which describes the properties of an already -existing table: - -```ts -declare const user: iam.User; -const table = dynamodb.Table.fromTableArn(this, 'ImportedTable', 'arn:aws:dynamodb:us-east-1:111111111:table/my-table'); -// now you can just call methods on the table -table.grantReadWriteData(user); -``` - -If you intend to use the `tableStreamArn` (including indirectly, for example by creating an -`@aws-cdk/aws-lambda-event-source.DynamoEventSource` on the imported table), you *must* use the -`Table.fromTableAttributes` method and the `tableStreamArn` property *must* be populated. - -In order to grant permissions to indexes on imported tables you can either set `grantIndexPermissions` to `true`, or you can provide the indexes via the `globalIndexes` or `localIndexes` properties. This will enable `grant*` methods to also grant permissions to *all* table indexes. - -## Keys - -When a table is defined, you must define it's schema using the `partitionKey` -(required) and `sortKey` (optional) properties. - -## Billing Mode - -DynamoDB supports two billing modes: - -* PROVISIONED - the default mode where the table and global secondary indexes have configured read and write capacity. -* PAY_PER_REQUEST - on-demand pricing and scaling. You only pay for what you use and there is no read and write capacity for the table or its global secondary indexes. - -```ts -const table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, -}); -``` - -Further reading: -https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode. - -## Table Class - -DynamoDB supports two table classes: - -* STANDARD - the default mode, and is recommended for the vast majority of workloads. -* STANDARD_INFREQUENT_ACCESS - optimized for tables where storage is the dominant cost. - -```ts -const table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - tableClass: dynamodb.TableClass.STANDARD_INFREQUENT_ACCESS, -}); -``` - -Further reading: -https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.TableClasses.html - -## Configure AutoScaling for your table - -You can have DynamoDB automatically raise and lower the read and write capacities -of your table by setting up autoscaling. You can use this to either keep your -tables at a desired utilization level, or by scaling up and down at pre-configured -times of the day: - -Auto-scaling is only relevant for tables with the billing mode, PROVISIONED. - -[Example of configuring autoscaling](test/integ.autoscaling.lit.ts) - -Further reading: -https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.html -https://aws.amazon.com/blogs/database/how-to-use-aws-cloudformation-to-configure-auto-scaling-for-amazon-dynamodb-tables-and-indexes/ - -## Amazon DynamoDB Global Tables - -You can create DynamoDB Global Tables by setting the `replicationRegions` property on a `Table`: - -```ts -const globalTable = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'], -}); -``` - -When doing so, a CloudFormation Custom Resource will be added to the stack in order to create the replica tables in the -selected regions. - -The default billing mode for Global Tables is `PAY_PER_REQUEST`. -If you want to use `PROVISIONED`, -you have to make sure write auto-scaling is enabled for that Table: - -```ts -const globalTable = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'], - billingMode: dynamodb.BillingMode.PROVISIONED, -}); - -globalTable.autoScaleWriteCapacity({ - minCapacity: 1, - maxCapacity: 10, -}).scaleOnUtilization({ targetUtilizationPercent: 75 }); -``` - -When adding a replica region for a large table, you might want to increase the -timeout for the replication operation: - -```ts -const globalTable = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'], - replicationTimeout: Duration.hours(2), // defaults to Duration.minutes(30) -}); -``` - -A maximum of 10 tables with replication can be added to a stack without a limit increase for -[managed policies attached to an IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entities). -This is because more than 10 managed policies will be attached to the DynamoDB service replication role - one policy per replication table. -Consider splitting your tables across multiple stacks if your reach this limit. - -## Encryption - -All user data stored in Amazon DynamoDB is fully encrypted at rest. When creating a new table, you can choose to encrypt using the following customer master keys (CMK) to encrypt your table: - -* AWS owned CMK - By default, all tables are encrypted under an AWS owned customer master key (CMK) in the DynamoDB service account (no additional charges apply). -* AWS managed CMK - AWS KMS keys (one per region) are created in your account, managed, and used on your behalf by AWS DynamoDB (AWS KMS charges apply). -* Customer managed CMK - You have full control over the KMS key used to encrypt the DynamoDB Table (AWS KMS charges apply). - -Creating a Table encrypted with a customer managed CMK: - -```ts -const table = new dynamodb.Table(this, 'MyTable', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - encryption: dynamodb.TableEncryption.CUSTOMER_MANAGED, -}); - -// You can access the CMK that was added to the stack on your behalf by the Table construct via: -const tableEncryptionKey = table.encryptionKey; -``` - -You can also supply your own key: - -```ts -import * as kms from '@aws-cdk/aws-kms'; - -const encryptionKey = new kms.Key(this, 'Key', { - enableKeyRotation: true, -}); -const table = new dynamodb.Table(this, 'MyTable', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - encryption: dynamodb.TableEncryption.CUSTOMER_MANAGED, - encryptionKey, // This will be exposed as table.encryptionKey -}); -``` - -In order to use the AWS managed CMK instead, change the code to: - -```ts -const table = new dynamodb.Table(this, 'MyTable', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - encryption: dynamodb.TableEncryption.AWS_MANAGED, -}); - -// In this case, the CMK _cannot_ be accessed through table.encryptionKey. -``` - -## Get schema of table or secondary indexes - -To get the partition key and sort key of the table or indexes you have configured: - -```ts -declare const table: dynamodb.Table; -const schema = table.schema(); -const partitionKey = schema.partitionKey; -const sortKey = schema.sortKey; - -// In case you want to get schema details for any secondary index -// const { partitionKey, sortKey } = table.schema(INDEX_NAME); -``` - -## Kinesis Stream - -A Kinesis Data Stream can be configured on the DynamoDB table to capture item-level changes. - -```ts -import * as kinesis from '@aws-cdk/aws-kinesis'; - -const stream = new kinesis.Stream(this, 'Stream'); - -const table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - kinesisStream: stream, -}); -``` - -## Alarm metrics - -Alarms can be configured on the DynamoDB table to captured metric data - -```ts -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; - -const table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, -}); - -const metric = table.metricThrottledRequestsForOperations({ - operations: [dynamodb.Operation.PUT_ITEM], - period: Duration.minutes(1), -}); - -new cloudwatch.Alarm(stack, 'Alarm', { - metric: metric, - evaluationPeriods: 1, - threshold: 1, -}); -``` - -## Deletion Protection for Tables - -You can enable deletion protection for a table by setting the `deletionProtection` property to `true`. -When deletion protection is enabled for a table, it cannot be deleted by anyone. By default, deletion protection is disabled. - -```ts -const table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, - deletionProtection: true, -}); -``` diff --git a/packages/@aws-cdk/aws-dynamodb/jest.config.js b/packages/@aws-cdk/aws-dynamodb/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts b/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts deleted file mode 100644 index bd90499a1732b..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/lib/replica-handler/index.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable no-console */ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies - -export async function onEventHandler(event: OnEventRequest): Promise { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - - const dynamodb = new DynamoDB(); - - const tableName = event.ResourceProperties.TableName; - const region = event.ResourceProperties.Region; - - let updateTableAction: 'Create' | 'Update' | 'Delete' | undefined; - if (event.RequestType === 'Create' || event.RequestType === 'Delete') { - updateTableAction = event.RequestType; - } else { // Update - // There are two cases where an Update can happen: - // 1. A table replacement. In that case, we need to create the replica in the new Table - // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). - // 2. A customer has changed one of the properties of the Custom Resource, - // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. - // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. - const describeTableResult = await dynamodb.describeTable({ - TableName: tableName, - }).promise(); - console.log('Describe table: %j', describeTableResult); - const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); - updateTableAction = replicaExists ? undefined : 'Create'; - } - - if (updateTableAction) { - const data = await dynamodb.updateTable({ - TableName: tableName, - ReplicaUpdates: [ - { - [updateTableAction]: { - RegionName: region, - }, - }, - ], - }).promise(); - console.log('Update table: %j', data); - } else { - console.log("Skipping updating Table, as a replica in '%s' already exists", region); - } - - return event.RequestType === 'Create' || event.RequestType === 'Update' - ? { PhysicalResourceId: `${tableName}-${region}` } - : {}; -} - -export async function isCompleteHandler(event: IsCompleteRequest): Promise { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - - const dynamodb = new DynamoDB(); - - const data = await dynamodb.describeTable({ - TableName: event.ResourceProperties.TableName, - }).promise(); - console.log('Describe table: %j', data); - - const tableActive = data.Table?.TableStatus === 'ACTIVE'; - const replicas = data.Table?.Replicas ?? []; - const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); - const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; - const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; - - switch (event.RequestType) { - case 'Create': - case 'Update': - // Complete when replica is reported as ACTIVE - return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; - case 'Delete': - // Complete when replica is gone - return { IsComplete: tableActive && regionReplica === undefined }; - } -} diff --git a/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts b/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts deleted file mode 100644 index f3afb57e6b050..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/lib/scalable-attribute-api.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; - -/** - * Interface for scalable attributes - */ -export interface IScalableTableAttribute { - /** - * Add scheduled scaling for this scaling attribute - */ - scaleOnSchedule(id: string, actions: appscaling.ScalingSchedule): void; - - /** - * Scale out or in to keep utilization at a given level - */ - scaleOnUtilization(props: UtilizationScalingProps): void; -} - -/** - * Properties for enabling DynamoDB capacity scaling - */ -export interface EnableScalingProps { - /** - * Minimum capacity to scale to - */ - readonly minCapacity: number; - - /** - * Maximum capacity to scale to - */ - readonly maxCapacity: number; -} - -/** - * Properties for enabling DynamoDB utilization tracking - */ -export interface UtilizationScalingProps extends appscaling.BaseTargetTrackingProps { - /** - * Target utilization percentage for the attribute - */ - readonly targetUtilizationPercent: number; -} diff --git a/packages/@aws-cdk/aws-dynamodb/package.json b/packages/@aws-cdk/aws-dynamodb/package.json deleted file mode 100644 index 473081a3bb8da..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/package.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "name": "@aws-cdk/aws-dynamodb", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::DynamoDB", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.dynamodb", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "dynamodb" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.DynamoDB", - "packageId": "Amazon.CDK.AWS.DynamoDB", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-dynamodb", - "module": "aws_cdk.aws_dynamodb", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-dynamodb" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::DynamoDB", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "dynamodb" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "@types/sinon": "^9.0.11", - "aws-sdk": "^2.1329.0", - "aws-sdk-mock": "5.6.0", - "jest": "^27.5.1", - "sinon": "^9.2.4", - "ts-jest": "^27.1.5" - }, - "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-dynamodb/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-dynamodb/rosetta/default.ts-fixture deleted file mode 100644 index 1f9bb33819183..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import dynamodb = require('@aws-cdk/aws-dynamodb'); -import iam = require('@aws-cdk/aws-iam'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.ts deleted file mode 100644 index c75b4be4733b3..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.autoscaling.lit.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cdk from '@aws-cdk/core'; -import * as dynamodb from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-dynamodb'); - -const table = new dynamodb.Table(stack, 'Table', { - partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -/// !show -const readScaling = table.autoScaleReadCapacity({ minCapacity: 1, maxCapacity: 50 }); - -readScaling.scaleOnUtilization({ - targetUtilizationPercent: 50, -}); - -readScaling.scaleOnSchedule('ScaleUpInTheMorning', { - schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), - minCapacity: 20, -}); - -readScaling.scaleOnSchedule('ScaleDownAtNight', { - schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), - maxCapacity: 20, -}); -/// !hide - -app.synth(); diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.ts deleted file mode 100644 index ea1c2650c7758..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.kinesis-stream.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as cdk from '@aws-cdk/core'; -import * as dynamodb from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-dynamodb-kinesis-stream'); - -const stream = new kinesis.Stream(stack, 'Stream'); - -new dynamodb.Table(stack, 'Table', { - partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, - removalPolicy: cdk.RemovalPolicy.DESTROY, - kinesisStream: stream, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts deleted file mode 100644 index 762e513df1cd1..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.dynamodb.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { App, RemovalPolicy, Stack, Tags } from '@aws-cdk/core'; -import { Attribute, AttributeType, ProjectionType, StreamViewType, Table, TableEncryption } from '../lib'; - -// CDK parameters -const STACK_NAME = 'aws-cdk-dynamodb'; - -// DynamoDB table parameters -const TABLE = 'Table'; -const TABLE_WITH_CMK = 'TableWithCustomerManagedKey'; -const TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX = 'TableWithGlobalAndLocalSecondaryIndex'; -const TABLE_WITH_GLOBAL_SECONDARY_INDEX = 'TableWithGlobalSecondaryIndex'; -const TABLE_WITH_LOCAL_SECONDARY_INDEX = 'TableWithLocalSecondaryIndex'; -const TABLE_PARTITION_KEY: Attribute = { name: 'hashKey', type: AttributeType.STRING }; -const TABLE_SORT_KEY: Attribute = { name: 'sortKey', type: AttributeType.NUMBER }; - -// DynamoDB global secondary index parameters -const GSI_TEST_CASE_1 = 'GSI-PartitionKeyOnly'; -const GSI_TEST_CASE_2 = 'GSI-PartitionAndSortKeyWithReadAndWriteCapacity'; -const GSI_TEST_CASE_3 = 'GSI-ProjectionTypeKeysOnly'; -const GSI_TEST_CASE_4 = 'GSI-ProjectionTypeInclude'; -const GSI_TEST_CASE_5 = 'GSI-InverseTableKeySchema'; -const GSI_PARTITION_KEY: Attribute = { name: 'gsiHashKey', type: AttributeType.STRING }; -const GSI_SORT_KEY: Attribute = { name: 'gsiSortKey', type: AttributeType.NUMBER }; -const GSI_NON_KEY: string[] = []; -for (let i = 0; i < 10; i++) { // 'A' to 'J' - GSI_NON_KEY.push(String.fromCharCode(65 + i)); -} - -// DynamoDB local secondary index parameters -const LSI_TEST_CASE_1 = 'LSI-PartitionAndSortKey'; -const LSI_TEST_CASE_2 = 'LSI-PartitionAndTableSortKey'; -const LSI_TEST_CASE_3 = 'LSI-ProjectionTypeKeysOnly'; -const LSI_TEST_CASE_4 = 'LSI-ProjectionTypeInclude'; -const LSI_SORT_KEY: Attribute = { name: 'lsiSortKey', type: AttributeType.NUMBER }; -const LSI_NON_KEY: string[] = []; -for (let i = 0; i < 10; i++) { // 'K' to 'T' - LSI_NON_KEY.push(String.fromCharCode(75 + i)); -} - -const app = new App(); - -const stack = new Stack(app, STACK_NAME); - -const table = new Table(stack, TABLE, { - partitionKey: TABLE_PARTITION_KEY, - removalPolicy: RemovalPolicy.DESTROY, -}); - -const tableWithGlobalAndLocalSecondaryIndex = new Table(stack, TABLE_WITH_GLOBAL_AND_LOCAL_SECONDARY_INDEX, { - pointInTimeRecovery: true, - encryption: TableEncryption.AWS_MANAGED, - stream: StreamViewType.KEYS_ONLY, - timeToLiveAttribute: 'timeToLive', - partitionKey: TABLE_PARTITION_KEY, - sortKey: TABLE_SORT_KEY, - removalPolicy: RemovalPolicy.DESTROY, -}); - -Tags.of(tableWithGlobalAndLocalSecondaryIndex).add('Environment', 'Production'); -tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ - indexName: GSI_TEST_CASE_1, - partitionKey: GSI_PARTITION_KEY, -}); -tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ - indexName: GSI_TEST_CASE_2, - partitionKey: GSI_PARTITION_KEY, - sortKey: GSI_SORT_KEY, - readCapacity: 10, - writeCapacity: 10, -}); -tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ - indexName: GSI_TEST_CASE_3, - partitionKey: GSI_PARTITION_KEY, - sortKey: GSI_SORT_KEY, - projectionType: ProjectionType.KEYS_ONLY, -}); -tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ - indexName: GSI_TEST_CASE_4, - partitionKey: GSI_PARTITION_KEY, - sortKey: GSI_SORT_KEY, - projectionType: ProjectionType.INCLUDE, - nonKeyAttributes: GSI_NON_KEY, -}); -tableWithGlobalAndLocalSecondaryIndex.addGlobalSecondaryIndex({ - indexName: GSI_TEST_CASE_5, - partitionKey: TABLE_SORT_KEY, - sortKey: TABLE_PARTITION_KEY, -}); - -tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ - indexName: LSI_TEST_CASE_2, - sortKey: LSI_SORT_KEY, -}); -tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ - indexName: LSI_TEST_CASE_1, - sortKey: TABLE_SORT_KEY, -}); -tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ - indexName: LSI_TEST_CASE_3, - sortKey: LSI_SORT_KEY, - projectionType: ProjectionType.KEYS_ONLY, -}); -tableWithGlobalAndLocalSecondaryIndex.addLocalSecondaryIndex({ - indexName: LSI_TEST_CASE_4, - sortKey: LSI_SORT_KEY, - projectionType: ProjectionType.INCLUDE, - nonKeyAttributes: LSI_NON_KEY, -}); - -const tableWithGlobalSecondaryIndex = new Table(stack, TABLE_WITH_GLOBAL_SECONDARY_INDEX, { - partitionKey: TABLE_PARTITION_KEY, - removalPolicy: RemovalPolicy.DESTROY, -}); -tableWithGlobalSecondaryIndex.addGlobalSecondaryIndex({ - indexName: GSI_TEST_CASE_1, - partitionKey: GSI_PARTITION_KEY, -}); - -const tableWithLocalSecondaryIndex = new Table(stack, TABLE_WITH_LOCAL_SECONDARY_INDEX, { - partitionKey: TABLE_PARTITION_KEY, - sortKey: TABLE_SORT_KEY, - removalPolicy: RemovalPolicy.DESTROY, -}); - -tableWithLocalSecondaryIndex.addLocalSecondaryIndex({ - indexName: LSI_TEST_CASE_1, - sortKey: LSI_SORT_KEY, -}); - -const encryptionKey = new kms.Key(stack, 'Key', { - enableKeyRotation: true, -}); - -const tableWithCMK = new Table(stack, TABLE_WITH_CMK, { - partitionKey: TABLE_PARTITION_KEY, - removalPolicy: RemovalPolicy.DESTROY, - stream: StreamViewType.NEW_AND_OLD_IMAGES, - encryptionKey: encryptionKey, -}); - -const role = new iam.Role(stack, 'Role', { - assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), -}); -tableWithCMK.grantStreamRead(role); - -const user = new iam.User(stack, 'User'); -table.grantReadData(user); -tableWithGlobalAndLocalSecondaryIndex.grantReadData(user); - -app.synth(); diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.d.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.d.ts deleted file mode 100644 index a64fd5d9eb2dc..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEventHandler(event: OnEventRequest): Promise; -export declare function isCompleteHandler(event: IsCompleteRequest): Promise; diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.js b/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.js deleted file mode 100644 index 064ec8d2bd574..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCompleteHandler = exports.onEventHandler = void 0; -const aws_sdk_1 = require("aws-sdk"); // eslint-disable-line import/no-extraneous-dependencies -async function onEventHandler(event) { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - const dynamodb = new aws_sdk_1.DynamoDB(); - const tableName = event.ResourceProperties.TableName; - const region = event.ResourceProperties.Region; - let updateTableAction; - if (event.RequestType === 'Create' || event.RequestType === 'Delete') { - updateTableAction = event.RequestType; - } - else { // Update - // There are two cases where an Update can happen: - // 1. A table replacement. In that case, we need to create the replica in the new Table - // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). - // 2. A customer has changed one of the properties of the Custom Resource, - // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. - // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. - const describeTableResult = await dynamodb.describeTable({ - TableName: tableName, - }).promise(); - console.log('Describe table: %j', describeTableResult); - const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); - updateTableAction = replicaExists ? undefined : 'Create'; - } - if (updateTableAction) { - const data = await dynamodb.updateTable({ - TableName: tableName, - ReplicaUpdates: [ - { - [updateTableAction]: { - RegionName: region, - }, - }, - ], - }).promise(); - console.log('Update table: %j', data); - } - else { - console.log("Skipping updating Table, as a replica in '%s' already exists", region); - } - return event.RequestType === 'Create' || event.RequestType === 'Update' - ? { PhysicalResourceId: `${tableName}-${region}` } - : {}; -} -exports.onEventHandler = onEventHandler; -async function isCompleteHandler(event) { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - const dynamodb = new aws_sdk_1.DynamoDB(); - const data = await dynamodb.describeTable({ - TableName: event.ResourceProperties.TableName, - }).promise(); - console.log('Describe table: %j', data); - const tableActive = data.Table?.TableStatus === 'ACTIVE'; - const replicas = data.Table?.Replicas ?? []; - const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); - const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; - const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; - switch (event.RequestType) { - case 'Create': - case 'Update': - // Complete when replica is reported as ACTIVE - return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; - case 'Delete': - // Complete when replica is gone - return { IsComplete: tableActive && regionReplica === undefined }; - } -} -exports.isCompleteHandler = isCompleteHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxxQ0FBbUMsQ0FBQyx3REFBd0Q7QUFFckYsS0FBSyxVQUFVLGNBQWMsQ0FBQyxLQUFxQjtJQUN4RCxPQUFPLENBQUMsR0FBRyxDQUFDLFdBQVcsRUFBRSxFQUFFLEdBQUcsS0FBSyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDO0lBRTNELE1BQU0sUUFBUSxHQUFHLElBQUksa0JBQVEsRUFBRSxDQUFDO0lBRWhDLE1BQU0sU0FBUyxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxTQUFTLENBQUM7SUFDckQsTUFBTSxNQUFNLEdBQUcsS0FBSyxDQUFDLGtCQUFrQixDQUFDLE1BQU0sQ0FBQztJQUUvQyxJQUFJLGlCQUE2RCxDQUFDO0lBQ2xFLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLEVBQUU7UUFDcEUsaUJBQWlCLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztLQUN2QztTQUFNLEVBQUUsU0FBUztRQUNoQixrREFBa0Q7UUFDbEQsdUZBQXVGO1FBQ3ZGLG9IQUFvSDtRQUNwSCwwRUFBMEU7UUFDMUUsaUZBQWlGO1FBQ2pGLDZHQUE2RztRQUM3Ry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9IGV2ZW50LlJlc291cmNlUHJvcGVydGllcy5Ta2lwUmVwbGljYXRpb25Db21wbGV0ZWRXYWl0ID09PSAndHJ1ZSc7XG5cbiAgc3dpdGNoIChldmVudC5SZXF1ZXN0VHlwZSkge1xuICAgIGNhc2UgJ0NyZWF0ZSc6XG4gICAgY2FzZSAnVXBkYXRlJzpcbiAgICAgIC8vIENvbXBsZXRlIHdoZW4gcmVwbGljYSBpcyByZXBvcnRlZCBhcyBBQ1RJVkVcbiAgICAgIHJldHVybiB7IElzQ29tcGxldGU6IHRhYmxlQWN0aXZlICYmIChyZXBsaWNhQWN0aXZlIHx8IHNraXBSZXBsaWNhdGlvbkNvbXBsZXRlZFdhaXQpIH07XG4gICAgY2FzZSAnRGVsZXRlJzpcbiAgICAgIC8vIENvbXBsZXRlIHdoZW4gcmVwbGljYSBpcyBnb25lXG4gICAgICByZXR1cm4geyBJc0NvbXBsZXRlOiB0YWJsZUFjdGl2ZSAmJiByZWdpb25SZXBsaWNhID09PSB1bmRlZmluZWQgfTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts deleted file mode 100644 index bd90499a1732b..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global-replicas-provisioned.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable no-console */ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies - -export async function onEventHandler(event: OnEventRequest): Promise { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - - const dynamodb = new DynamoDB(); - - const tableName = event.ResourceProperties.TableName; - const region = event.ResourceProperties.Region; - - let updateTableAction: 'Create' | 'Update' | 'Delete' | undefined; - if (event.RequestType === 'Create' || event.RequestType === 'Delete') { - updateTableAction = event.RequestType; - } else { // Update - // There are two cases where an Update can happen: - // 1. A table replacement. In that case, we need to create the replica in the new Table - // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). - // 2. A customer has changed one of the properties of the Custom Resource, - // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. - // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. - const describeTableResult = await dynamodb.describeTable({ - TableName: tableName, - }).promise(); - console.log('Describe table: %j', describeTableResult); - const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); - updateTableAction = replicaExists ? undefined : 'Create'; - } - - if (updateTableAction) { - const data = await dynamodb.updateTable({ - TableName: tableName, - ReplicaUpdates: [ - { - [updateTableAction]: { - RegionName: region, - }, - }, - ], - }).promise(); - console.log('Update table: %j', data); - } else { - console.log("Skipping updating Table, as a replica in '%s' already exists", region); - } - - return event.RequestType === 'Create' || event.RequestType === 'Update' - ? { PhysicalResourceId: `${tableName}-${region}` } - : {}; -} - -export async function isCompleteHandler(event: IsCompleteRequest): Promise { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - - const dynamodb = new DynamoDB(); - - const data = await dynamodb.describeTable({ - TableName: event.ResourceProperties.TableName, - }).promise(); - console.log('Describe table: %j', data); - - const tableActive = data.Table?.TableStatus === 'ACTIVE'; - const replicas = data.Table?.Replicas ?? []; - const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); - const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; - const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; - - switch (event.RequestType) { - case 'Create': - case 'Update': - // Complete when replica is reported as ACTIVE - return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; - case 'Delete': - // Complete when replica is gone - return { IsComplete: tableActive && regionReplica === undefined }; - } -} diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.d.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.d.ts deleted file mode 100644 index a64fd5d9eb2dc..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEventHandler(event: OnEventRequest): Promise; -export declare function isCompleteHandler(event: IsCompleteRequest): Promise; diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.js b/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.js deleted file mode 100644 index 064ec8d2bd574..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCompleteHandler = exports.onEventHandler = void 0; -const aws_sdk_1 = require("aws-sdk"); // eslint-disable-line import/no-extraneous-dependencies -async function onEventHandler(event) { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - const dynamodb = new aws_sdk_1.DynamoDB(); - const tableName = event.ResourceProperties.TableName; - const region = event.ResourceProperties.Region; - let updateTableAction; - if (event.RequestType === 'Create' || event.RequestType === 'Delete') { - updateTableAction = event.RequestType; - } - else { // Update - // There are two cases where an Update can happen: - // 1. A table replacement. In that case, we need to create the replica in the new Table - // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). - // 2. A customer has changed one of the properties of the Custom Resource, - // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. - // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. - const describeTableResult = await dynamodb.describeTable({ - TableName: tableName, - }).promise(); - console.log('Describe table: %j', describeTableResult); - const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); - updateTableAction = replicaExists ? undefined : 'Create'; - } - if (updateTableAction) { - const data = await dynamodb.updateTable({ - TableName: tableName, - ReplicaUpdates: [ - { - [updateTableAction]: { - RegionName: region, - }, - }, - ], - }).promise(); - console.log('Update table: %j', data); - } - else { - console.log("Skipping updating Table, as a replica in '%s' already exists", region); - } - return event.RequestType === 'Create' || event.RequestType === 'Update' - ? { PhysicalResourceId: `${tableName}-${region}` } - : {}; -} -exports.onEventHandler = onEventHandler; -async function isCompleteHandler(event) { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - const dynamodb = new aws_sdk_1.DynamoDB(); - const data = await dynamodb.describeTable({ - TableName: event.ResourceProperties.TableName, - }).promise(); - console.log('Describe table: %j', data); - const tableActive = data.Table?.TableStatus === 'ACTIVE'; - const replicas = data.Table?.Replicas ?? []; - const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); - const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; - const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; - switch (event.RequestType) { - case 'Create': - case 'Update': - // Complete when replica is reported as ACTIVE - return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; - case 'Delete': - // Complete when replica is gone - return { IsComplete: tableActive && regionReplica === undefined }; - } -} -exports.isCompleteHandler = isCompleteHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxxQ0FBbUMsQ0FBQyx3REFBd0Q7QUFFckYsS0FBSyxVQUFVLGNBQWMsQ0FBQyxLQUFxQjtJQUN4RCxPQUFPLENBQUMsR0FBRyxDQUFDLFdBQVcsRUFBRSxFQUFFLEdBQUcsS0FBSyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsQ0FBQyxDQUFDO0lBRTNELE1BQU0sUUFBUSxHQUFHLElBQUksa0JBQVEsRUFBRSxDQUFDO0lBRWhDLE1BQU0sU0FBUyxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxTQUFTLENBQUM7SUFDckQsTUFBTSxNQUFNLEdBQUcsS0FBSyxDQUFDLGtCQUFrQixDQUFDLE1BQU0sQ0FBQztJQUUvQyxJQUFJLGlCQUE2RCxDQUFDO0lBQ2xFLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLEVBQUU7UUFDcEUsaUJBQWlCLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztLQUN2QztTQUFNLEVBQUUsU0FBUztRQUNoQixrREFBa0Q7UUFDbEQsdUZBQXVGO1FBQ3ZGLG9IQUFvSDtRQUNwSCwwRUFBMEU7UUFDMUUsaUZBQWlGO1FBQ2pGLDZHQUE2RztRQUM3RyxNQUFNLG1CQUFtQixHQUFHLE1BQU0sUUFBUSxDQUFDLGFBQWEsQ0FBQztZQUN2RCxTQUFTLEVB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AndHJ1ZSc7XG5cbiAgc3dpdGNoIChldmVudC5SZXF1ZXN0VHlwZSkge1xuICAgIGNhc2UgJ0NyZWF0ZSc6XG4gICAgY2FzZSAnVXBkYXRlJzpcbiAgICAgIC8vIENvbXBsZXRlIHdoZW4gcmVwbGljYSBpcyByZXBvcnRlZCBhcyBBQ1RJVkVcbiAgICAgIHJldHVybiB7IElzQ29tcGxldGU6IHRhYmxlQWN0aXZlICYmIChyZXBsaWNhQWN0aXZlIHx8IHNraXBSZXBsaWNhdGlvbkNvbXBsZXRlZFdhaXQpIH07XG4gICAgY2FzZSAnRGVsZXRlJzpcbiAgICAgIC8vIENvbXBsZXRlIHdoZW4gcmVwbGljYSBpcyBnb25lXG4gICAgICByZXR1cm4geyBJc0NvbXBsZXRlOiB0YWJsZUFjdGl2ZSAmJiByZWdpb25SZXBsaWNhID09PSB1bmRlZmluZWQgfTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts b/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts deleted file mode 100644 index bd90499a1732b..0000000000000 --- a/packages/@aws-cdk/aws-dynamodb/test/integ.global.js.snapshot/asset.f56f8a42c5f6a3526d8ee9803f5ba6bc681c4ee9ed5a8507f7d4e0d2ca9b0542/index.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable no-console */ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies - -export async function onEventHandler(event: OnEventRequest): Promise { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - - const dynamodb = new DynamoDB(); - - const tableName = event.ResourceProperties.TableName; - const region = event.ResourceProperties.Region; - - let updateTableAction: 'Create' | 'Update' | 'Delete' | undefined; - if (event.RequestType === 'Create' || event.RequestType === 'Delete') { - updateTableAction = event.RequestType; - } else { // Update - // There are two cases where an Update can happen: - // 1. A table replacement. In that case, we need to create the replica in the new Table - // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). - // 2. A customer has changed one of the properties of the Custom Resource, - // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. - // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. - const describeTableResult = await dynamodb.describeTable({ - TableName: tableName, - }).promise(); - console.log('Describe table: %j', describeTableResult); - const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); - updateTableAction = replicaExists ? undefined : 'Create'; - } - - if (updateTableAction) { - const data = await dynamodb.updateTable({ - TableName: tableName, - ReplicaUpdates: [ - { - [updateTableAction]: { - RegionName: region, - }, - }, - ], - }).promise(); - console.log('Update table: %j', data); - } else { - console.log("Skipping updating Table, as a replica in '%s' already exists", region); - } - - return event.RequestType === 'Create' || event.RequestType === 'Update' - ? { PhysicalResourceId: `${tableName}-${region}` } - : {}; -} - -export async function isCompleteHandler(event: IsCompleteRequest): Promise { - console.log('Event: %j', { ...event, ResponseURL: '...' }); - - const dynamodb = new DynamoDB(); - - const data = await dynamodb.describeTable({ - TableName: event.ResourceProperties.TableName, - }).promise(); - console.log('Describe table: %j', data); - - const tableActive = data.Table?.TableStatus === 'ACTIVE'; - const replicas = data.Table?.Replicas ?? []; - const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); - const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; - const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; - - switch (event.RequestType) { - case 'Create': - case 'Update': - // Complete when replica is reported as ACTIVE - return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; - case 'Delete': - // Complete when replica is gone - return { IsComplete: tableActive && regionReplica === undefined }; - } -} diff --git a/packages/@aws-cdk/aws-ec2/.eslintrc.js b/packages/@aws-cdk/aws-ec2/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ec2/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ec2/.gitignore b/packages/@aws-cdk/aws-ec2/.gitignore deleted file mode 100644 index f97f272c59261..0000000000000 --- a/packages/@aws-cdk/aws-ec2/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -test/cdk.json -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -!jest.config.js -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ec2/.npmignore b/packages/@aws-cdk/aws-ec2/.npmignore deleted file mode 100644 index a59f043eedc1f..0000000000000 --- a/packages/@aws-cdk/aws-ec2/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -jest.config.js -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ec2/LICENSE b/packages/@aws-cdk/aws-ec2/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ec2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ec2/NOTICE b/packages/@aws-cdk/aws-ec2/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ec2/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ec2/README.md b/packages/@aws-cdk/aws-ec2/README.md deleted file mode 100644 index 0640d3c63a2f4..0000000000000 --- a/packages/@aws-cdk/aws-ec2/README.md +++ /dev/null @@ -1,1784 +0,0 @@ -# Amazon EC2 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -The `@aws-cdk/aws-ec2` package contains primitives for setting up networking and -instances. - -```ts nofixture -import * as ec2 from '@aws-cdk/aws-ec2'; -``` - -## VPC - -Most projects need a Virtual Private Cloud to provide security by means of -network partitioning. This is achieved by creating an instance of -`Vpc`: - -```ts -const vpc = new ec2.Vpc(this, 'VPC'); -``` - -All default constructs require EC2 instances to be launched inside a VPC, so -you should generally start by defining a VPC whenever you need to launch -instances for your project. - -### Subnet Types - -A VPC consists of one or more subnets that instances can be placed into. CDK -distinguishes three different subnet types: - -* **Public (`SubnetType.PUBLIC`)** - public subnets connect directly to the Internet using an - Internet Gateway. If you want your instances to have a public IP address - and be directly reachable from the Internet, you must place them in a - public subnet. -* **Private with Internet Access (`SubnetType.PRIVATE_WITH_EGRESS`)** - instances in private subnets are not directly routable from the - Internet, and you must provide a way to connect out to the Internet. - By default, a NAT gateway is created in every public subnet for maximum availability. Be - aware that you will be charged for NAT gateways. - Alternatively you can set `natGateways:0` and provide your own egress configuration (i.e through Transit Gateway) -* **Isolated (`SubnetType.PRIVATE_ISOLATED`)** - isolated subnets do not route from or to the Internet, and - as such do not require NAT gateways. They can only connect to or be - connected to from other instances in the same VPC. A default VPC configuration - will not include isolated subnets, - -A default VPC configuration will create public and **private** subnets. However, if -`natGateways:0` **and** `subnetConfiguration` is undefined, default VPC configuration -will create public and **isolated** subnets. See [*Advanced Subnet Configuration*](#advanced-subnet-configuration) -below for information on how to change the default subnet configuration. - -Constructs using the VPC will "launch instances" (or more accurately, create -Elastic Network Interfaces) into one or more of the subnets. They all accept -a property called `subnetSelection` (sometimes called `vpcSubnets`) to allow -you to select in what subnet to place the ENIs, usually defaulting to -*private* subnets if the property is omitted. - -If you would like to save on the cost of NAT gateways, you can use -*isolated* subnets instead of *private* subnets (as described in Advanced -*Subnet Configuration*). If you need private instances to have -internet connectivity, another option is to reduce the number of NAT gateways -created by setting the `natGateways` property to a lower value (the default -is one NAT gateway per availability zone). Be aware that this may have -availability implications for your application. - -[Read more about -subnets](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html). - -### Control over availability zones - -By default, a VPC will spread over at most 3 Availability Zones available to -it. To change the number of Availability Zones that the VPC will spread over, -specify the `maxAzs` property when defining it. - -The number of Availability Zones that are available depends on the *region* -and *account* of the Stack containing the VPC. If the [region and account are -specified](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) on -the Stack, the CLI will [look up the existing Availability -Zones](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#using-regions-availability-zones-describe) -and get an accurate count. If region and account are not specified, the stack -could be deployed anywhere and it will have to make a safe choice, limiting -itself to 2 Availability Zones. - -Therefore, to get the VPC to spread over 3 or more availability zones, you -must specify the environment where the stack will be deployed. - -You can gain full control over the availability zones selection strategy by overriding the Stack's [`get availabilityZones()`](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/core/lib/stack.ts) method: - -```text -// This example is only available in TypeScript - -class MyStack extends Stack { - - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - // ... - } - - get availabilityZones(): string[] { - return ['us-west-2a', 'us-west-2b']; - } - -} -``` - -Note that overriding the `get availabilityZones()` method will override the default behavior for all constructs defined within the Stack. - -### Choosing subnets for resources - -When creating resources that create Elastic Network Interfaces (such as -databases or instances), there is an option to choose which subnets to place -them in. For example, a VPC endpoint by default is placed into a subnet in -every availability zone, but you can override which subnets to use. The property -is typically called one of `subnets`, `vpcSubnets` or `subnetSelection`. - -The example below will place the endpoint into two AZs (`us-east-1a` and `us-east-1c`), -in Isolated subnets: - -```ts -declare const vpc: ec2.Vpc; - -new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { - vpc, - service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), - subnets: { - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - availabilityZones: ['us-east-1a', 'us-east-1c'] - } -}); -``` - -You can also specify specific subnet objects for granular control: - -```ts -declare const vpc: ec2.Vpc; -declare const subnet1: ec2.Subnet; -declare const subnet2: ec2.Subnet; - -new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { - vpc, - service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), - subnets: { - subnets: [subnet1, subnet2] - } -}); -``` - -Which subnets are selected is evaluated as follows: - -* `subnets`: if specific subnet objects are supplied, these are selected, and no other - logic is used. -* `subnetType`/`subnetGroupName`: otherwise, a set of subnets is selected by - supplying either type or name: - * `subnetType` will select all subnets of the given type. - * `subnetGroupName` should be used to distinguish between multiple groups of subnets of - the same type (for example, you may want to separate your application instances and your - RDS instances into two distinct groups of Isolated subnets). - * If neither are given, the first available subnet group of a given type that - exists in the VPC will be used, in this order: Private, then Isolated, then Public. - In short: by default ENIs will preferentially be placed in subnets not connected to - the Internet. -* `availabilityZones`/`onePerAz`: finally, some availability-zone based filtering may be done. - This filtering by availability zones will only be possible if the VPC has been created or - looked up in a non-environment agnostic stack (so account and region have been set and - availability zones have been looked up). - * `availabilityZones`: only the specific subnets from the selected subnet groups that are - in the given availability zones will be returned. - * `onePerAz`: per availability zone, a maximum of one subnet will be returned (Useful for resource - types that do not allow creating two ENIs in the same availability zone). -* `subnetFilters`: additional filtering on subnets using any number of user-provided filters which - extend `SubnetFilter`. The following methods on the `SubnetFilter` class can be used to create - a filter: - * `byIds`: chooses subnets from a list of ids - * `availabilityZones`: chooses subnets in the provided list of availability zones - * `onePerAz`: chooses at most one subnet per availability zone - * `containsIpAddresses`: chooses a subnet which contains *any* of the listed ip addresses - * `byCidrMask`: chooses subnets that have the provided CIDR netmask - -### Using NAT instances - -By default, the `Vpc` construct will create NAT *gateways* for you, which -are managed by AWS. If you would prefer to use your own managed NAT -*instances* instead, specify a different value for the `natGatewayProvider` -property, as follows: - -[using NAT instances](test/integ.nat-instances.lit.ts) - -The construct will automatically search for the most recent NAT gateway AMI. -If you prefer to use a custom AMI, use `machineImage: -MachineImage.genericLinux({ ... })` and configure the right AMI ID for the -regions you want to deploy to. - -By default, the NAT instances will route all traffic. To control what traffic -gets routed, pass a custom value for `defaultAllowedTraffic` and access the -`NatInstanceProvider.connections` member after having passed the NAT provider to -the VPC: - -```ts -declare const instanceType: ec2.InstanceType; - -const provider = ec2.NatProvider.instance({ - instanceType, - defaultAllowedTraffic: ec2.NatTrafficDirection.OUTBOUND_ONLY, -}); -new ec2.Vpc(this, 'TheVPC', { - natGatewayProvider: provider, -}); -provider.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/8'), ec2.Port.tcp(80)); -``` - -### Ip Address Management - -The VPC spans a supernet IP range, which contains the non-overlapping IPs of its contained subnets. Possible sources for this IP range are: - -* You specify an IP range directly by specifying a CIDR -* You allocate an IP range of a given size automatically from AWS IPAM - -By default the Vpc will allocate the `10.0.0.0/16` address range which will be exhaustively spread across all subnets in the subnet configuration. This behavior can be changed by passing an object that implements `IIpAddresses` to the `ipAddress` property of a Vpc. See the subsequent sections for the options. - -Be aware that if you don't explicitly reserve subnet groups in `subnetConfiguration`, the address space will be fully allocated! If you predict you may need to add more subnet groups later, add them early on and set `reserved: true` (see the "Advanced Subnet Configuration" section for more information). - -#### Specifying a CIDR directly - -Use `IpAddresses.cidr` to define a Cidr range for your Vpc directly in code: - -```ts -import { IpAddresses } from '@aws-cdk/aws-ec2'; - -new ec2.Vpc(stack, 'TheVPC', { - ipAddresses: ec2.IpAddresses.cidr('10.0.1.0/20') -}); -``` - -Space will be allocated to subnets in the following order: - -* First, spaces is allocated for all subnets groups that explicitly have a `cidrMask` set as part of their configuration (including reserved subnets). -* Afterwards, any remaining space is divided evenly between the rest of the subnets (if any). - -The argument to `IpAddresses.cidr` may not be a token, and concrete Cidr values are generated in the synthesized CloudFormation template. - -#### Allocating an IP range from AWS IPAM - -Amazon VPC IP Address Manager (IPAM) manages a large IP space, from which chunks can be allocated for use in the Vpc. For information on Amazon VPC IP Address Manager please see the [official documentation](https://docs.aws.amazon.com/vpc/latest/ipam/what-it-is-ipam.html). An example of allocating from AWS IPAM looks like this: - -```ts -import { IpAddresses } from '@aws-cdk/aws-ec2'; - -declare const pool: ec2.CfnIPAMPool; - -new ec2.Vpc(stack, 'TheVPC', { - ipAddresses: ec2.IpAddresses.awsIpamAllocation({ - ipv4IpamPoolId: pool.ref, - ipv4NetmaskLength: 18, - defaultSubnetIpv4NetmaskLength: 24 - }) -}); -``` - -`IpAddresses.awsIpamAllocation` requires the following: - -* `ipv4IpamPoolId`, the id of an IPAM Pool from which the VPC range should be allocated. -* `ipv4NetmaskLength`, the size of the IP range that will be requested from the Pool at deploy time. -* `defaultSubnetIpv4NetmaskLength`, the size of subnets in groups that don't have `cidrMask` set. - -With this method of IP address management, no attempt is made to guess at subnet group sizes or to exhaustively allocate the IP range. All subnet groups must have an explicit `cidrMask` set as part of their subnet configuration, or `defaultSubnetIpv4NetmaskLength` must be set for a default size. If not, synthesis will fail and you must provide one or the other. - -### Reserving availability zones - -There are situations where the IP space for availability zones will -need to be reserved. This is useful in situations where availability -zones would need to be added after the vpc is originally deployed, -without causing IP renumbering for availability zones subnets. The IP -space for reserving `n` availability zones can be done by setting the -`reservedAzs` to `n` in vpc props, as shown below: - -```ts -const vpc = new ec2.Vpc(this, 'TheVPC', { - cidr: '10.0.0.0/21', - maxAzs: 3, - reservedAzs: 1, -}); -``` - -In the example above, the subnets for reserved availability zones is not -actually provisioned but its IP space is still reserved. If, in the future, -new availability zones needs to be provisioned, then we would decrement -the value of `reservedAzs` and increment the `maxAzs` or `availabilityZones` -accordingly. This action would not cause the IP address of subnets to get -renumbered, but rather the IP space that was previously reserved will be -used for the new availability zones subnets. - -### Advanced Subnet Configuration - -If the default VPC configuration (public and private subnets spanning the -size of the VPC) don't suffice for you, you can configure what subnets to -create by specifying the `subnetConfiguration` property. It allows you -to configure the number and size of all subnets. Specifying an advanced -subnet configuration could look like this: - -```ts -const vpc = new ec2.Vpc(this, 'TheVPC', { - // 'IpAddresses' configures the IP range and size of the entire VPC. - // The IP space will be divided based on configuration for the subnets. - ipAddresses: IpAddresses.cidr('10.0.0.0/21'), - - // 'maxAzs' configures the maximum number of availability zones to use. - // If you want to specify the exact availability zones you want the VPC - // to use, use `availabilityZones` instead. - maxAzs: 3, - - // 'subnetConfiguration' specifies the "subnet groups" to create. - // Every subnet group will have a subnet for each AZ, so this - // configuration will create `3 groups × 3 AZs = 9` subnets. - subnetConfiguration: [ - { - // 'subnetType' controls Internet access, as described above. - subnetType: ec2.SubnetType.PUBLIC, - - // 'name' is used to name this particular subnet group. You will have to - // use the name for subnet selection if you have more than one subnet - // group of the same type. - name: 'Ingress', - - // 'cidrMask' specifies the IP addresses in the range of of individual - // subnets in the group. Each of the subnets in this group will contain - // `2^(32 address bits - 24 subnet bits) - 2 reserved addresses = 254` - // usable IP addresses. - // - // If 'cidrMask' is left out the available address space is evenly - // divided across the remaining subnet groups. - cidrMask: 24, - }, - { - cidrMask: 24, - name: 'Application', - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - { - cidrMask: 28, - name: 'Database', - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - - // 'reserved' can be used to reserve IP address space. No resources will - // be created for this subnet, but the IP range will be kept available for - // future creation of this subnet, or even for future subdivision. - reserved: true - } - ], -}); -``` - -The example above is one possible configuration, but the user can use the -constructs above to implement many other network configurations. - -The `Vpc` from the above configuration in a Region with three -availability zones will be the following: - -Subnet Name |Type |IP Block |AZ|Features -------------------|----------|--------------|--|-------- -IngressSubnet1 |`PUBLIC` |`10.0.0.0/24` |#1|NAT Gateway -IngressSubnet2 |`PUBLIC` |`10.0.1.0/24` |#2|NAT Gateway -IngressSubnet3 |`PUBLIC` |`10.0.2.0/24` |#3|NAT Gateway -ApplicationSubnet1|`PRIVATE` |`10.0.3.0/24` |#1|Route to NAT in IngressSubnet1 -ApplicationSubnet2|`PRIVATE` |`10.0.4.0/24` |#2|Route to NAT in IngressSubnet2 -ApplicationSubnet3|`PRIVATE` |`10.0.5.0/24` |#3|Route to NAT in IngressSubnet3 -DatabaseSubnet1 |`ISOLATED`|`10.0.6.0/28` |#1|Only routes within the VPC -DatabaseSubnet2 |`ISOLATED`|`10.0.6.16/28`|#2|Only routes within the VPC -DatabaseSubnet3 |`ISOLATED`|`10.0.6.32/28`|#3|Only routes within the VPC - -### Accessing the Internet Gateway - -If you need access to the internet gateway, you can get its ID like so: - -```ts -declare const vpc: ec2.Vpc; - -const igwId = vpc.internetGatewayId; -``` - -For a VPC with only `ISOLATED` subnets, this value will be undefined. - -This is only supported for VPCs created in the stack - currently you're -unable to get the ID for imported VPCs. To do that you'd have to specifically -look up the Internet Gateway by name, which would require knowing the name -beforehand. - -This can be useful for configuring routing using a combination of gateways: -for more information see [Routing](#routing) below. - -#### Routing - -It's possible to add routes to any subnets using the `addRoute()` method. If for -example you want an isolated subnet to have a static route via the default -Internet Gateway created for the public subnet - perhaps for routing a VPN -connection - you can do so like this: - -```ts -const vpc = new ec2.Vpc(this, "VPC", { - subnetConfiguration: [{ - subnetType: ec2.SubnetType.PUBLIC, - name: 'Public', - },{ - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - name: 'Isolated', - }] -}); - -(vpc.isolatedSubnets[0] as ec2.Subnet).addRoute("StaticRoute", { - routerId: vpc.internetGatewayId!, - routerType: ec2.RouterType.GATEWAY, - destinationCidrBlock: "8.8.8.8/32", -}) -``` - -*Note that we cast to `Subnet` here because the list of subnets only returns an -`ISubnet`.* - -### Reserving subnet IP space - -There are situations where the IP space for a subnet or number of subnets -will need to be reserved. This is useful in situations where subnets would -need to be added after the vpc is originally deployed, without causing IP -renumbering for existing subnets. The IP space for a subnet may be reserved -by setting the `reserved` subnetConfiguration property to true, as shown -below: - -```ts -const vpc = new ec2.Vpc(this, 'TheVPC', { - natGateways: 1, - subnetConfiguration: [ - { - cidrMask: 26, - name: 'Public', - subnetType: ec2.SubnetType.PUBLIC, - }, - { - cidrMask: 26, - name: 'Application1', - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - { - cidrMask: 26, - name: 'Application2', - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - reserved: true, // <---- This subnet group is reserved - }, - { - cidrMask: 27, - name: 'Database', - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - } - ], -}); -``` - -In the example above, the subnet for Application2 is not actually provisioned -but its IP space is still reserved. If in the future this subnet needs to be -provisioned, then the `reserved: true` property should be removed. Reserving -parts of the IP space prevents the other subnets from getting renumbered. - -### Sharing VPCs between stacks - -If you are creating multiple `Stack`s inside the same CDK application, you -can reuse a VPC defined in one Stack in another by simply passing the VPC -instance around: - -[sharing VPCs between stacks](test/integ.share-vpcs.lit.ts) - -### Importing an existing VPC - -If your VPC is created outside your CDK app, you can use `Vpc.fromLookup()`. -The CDK CLI will search for the specified VPC in the the stack's region and -account, and import the subnet configuration. Looking up can be done by VPC -ID, but more flexibly by searching for a specific tag on the VPC. - -Subnet types will be determined from the `aws-cdk:subnet-type` tag on the -subnet if it exists, or the presence of a route to an Internet Gateway -otherwise. Subnet names will be determined from the `aws-cdk:subnet-name` tag -on the subnet if it exists, or will mirror the subnet type otherwise (i.e. -a public subnet will have the name `"Public"`). - -The result of the `Vpc.fromLookup()` operation will be written to a file -called `cdk.context.json`. You must commit this file to source control so -that the lookup values are available in non-privileged environments such -as CI build steps, and to ensure your template builds are repeatable. - -Here's how `Vpc.fromLookup()` can be used: - -[importing existing VPCs](test/integ.import-default-vpc.lit.ts) - -`Vpc.fromLookup` is the recommended way to import VPCs. If for whatever -reason you do not want to use the context mechanism to look up a VPC at -synthesis time, you can also use `Vpc.fromVpcAttributes`. This has the -following limitations: - -* Every subnet group in the VPC must have a subnet in each availability zone - (for example, each AZ must have both a public and private subnet). Asymmetric - VPCs are not supported. -* All VpcId, SubnetId, RouteTableId, ... parameters must either be known at - synthesis time, or they must come from deploy-time list parameters whose - deploy-time lengths are known at synthesis time. - -Using `Vpc.fromVpcAttributes()` looks like this: - -```ts -const vpc = ec2.Vpc.fromVpcAttributes(this, 'VPC', { - vpcId: 'vpc-1234', - availabilityZones: ['us-east-1a', 'us-east-1b'], - - // Either pass literals for all IDs - publicSubnetIds: ['s-12345', 's-67890'], - - // OR: import a list of known length - privateSubnetIds: Fn.importListValue('PrivateSubnetIds', 2), - - // OR: split an imported string to a list of known length - isolatedSubnetIds: Fn.split(',', ssm.StringParameter.valueForStringParameter(this, `MyParameter`), 2), -}); -``` - -For each subnet group the import function accepts optional parameters for subnet -names, route table ids and IPv4 CIDR blocks. When supplied, the length of these -lists are required to match the length of the list of subnet ids, allowing the -lists to be zipped together to form `ISubnet` instances. - -Public subnet group example (for private or isolated subnet groups, use the properties with the respective prefix): - -```ts -const vpc = ec2.Vpc.fromVpcAttributes(this, 'VPC', { - vpcId: 'vpc-1234', - availabilityZones: ['us-east-1a', 'us-east-1b', 'us-east-1c'], - publicSubnetIds: ['s-12345', 's-34567', 's-56789'], - publicSubnetNames: ['Subnet A', 'Subnet B', 'Subnet C'], - publicSubnetRouteTableIds: ['rt-12345', 'rt-34567', 'rt-56789'], - publicSubnetIpv4CidrBlocks: ['10.0.0.0/24', '10.0.1.0/24', '10.0.2.0/24'], -}); -``` - -The above example will create an `IVpc` instance with three public subnets: - -| Subnet id | Availability zone | Subnet name | Route table id | IPv4 CIDR | -| --------- | ----------------- | ----------- | -------------- | ----------- | -| s-12345 | us-east-1a | Subnet A | rt-12345 | 10.0.0.0/24 | -| s-34567 | us-east-1b | Subnet B | rt-34567 | 10.0.1.0/24 | -| s-56789 | us-east-1c | Subnet B | rt-56789 | 10.0.2.0/24 | - -## Allowing Connections - -In AWS, all network traffic in and out of **Elastic Network Interfaces** (ENIs) -is controlled by **Security Groups**. You can think of Security Groups as a -firewall with a set of rules. By default, Security Groups allow no incoming -(ingress) traffic and all outgoing (egress) traffic. You can add ingress rules -to them to allow incoming traffic streams. To exert fine-grained control over -egress traffic, set `allowAllOutbound: false` on the `SecurityGroup`, after -which you can add egress traffic rules. - -You can manipulate Security Groups directly: - -```ts fixture=with-vpc -const mySecurityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { - vpc, - description: 'Allow ssh access to ec2 instances', - allowAllOutbound: true // Can be set to false -}); -mySecurityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(22), 'allow ssh access from the world'); -``` - -All constructs that create ENIs on your behalf (typically constructs that create -EC2 instances or other VPC-connected resources) will all have security groups -automatically assigned. Those constructs have an attribute called -**connections**, which is an object that makes it convenient to update the -security groups. If you want to allow connections between two constructs that -have security groups, you have to add an **Egress** rule to one Security Group, -and an **Ingress** rule to the other. The connections object will automatically -take care of this for you: - -```ts -declare const loadBalancer: elbv2.ApplicationLoadBalancer; -declare const appFleet: autoscaling.AutoScalingGroup; -declare const dbFleet: autoscaling.AutoScalingGroup; - -// Allow connections from anywhere -loadBalancer.connections.allowFromAnyIpv4(ec2.Port.tcp(443), 'Allow inbound HTTPS'); - -// The same, but an explicit IP address -loadBalancer.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/32'), ec2.Port.tcp(443), 'Allow inbound HTTPS'); - -// Allow connection between AutoScalingGroups -appFleet.connections.allowTo(dbFleet, ec2.Port.tcp(443), 'App can call database'); -``` - -### Connection Peers - -There are various classes that implement the connection peer part: - -```ts -declare const appFleet: autoscaling.AutoScalingGroup; -declare const dbFleet: autoscaling.AutoScalingGroup; - -// Simple connection peers -let peer = ec2.Peer.ipv4('10.0.0.0/16'); -peer = ec2.Peer.anyIpv4(); -peer = ec2.Peer.ipv6('::0/0'); -peer = ec2.Peer.anyIpv6(); -peer = ec2.Peer.prefixList('pl-12345'); -appFleet.connections.allowTo(peer, ec2.Port.tcp(443), 'Allow outbound HTTPS'); -``` - -Any object that has a security group can itself be used as a connection peer: - -```ts -declare const fleet1: autoscaling.AutoScalingGroup; -declare const fleet2: autoscaling.AutoScalingGroup; -declare const appFleet: autoscaling.AutoScalingGroup; - -// These automatically create appropriate ingress and egress rules in both security groups -fleet1.connections.allowTo(fleet2, ec2.Port.tcp(80), 'Allow between fleets'); - -appFleet.connections.allowFromAnyIpv4(ec2.Port.tcp(80), 'Allow from load balancer'); -``` - -### Port Ranges - -The connections that are allowed are specified by port ranges. A number of classes provide -the connection specifier: - -```ts -ec2.Port.tcp(80) -ec2.Port.tcpRange(60000, 65535) -ec2.Port.allTcp() -ec2.Port.allIcmp() -ec2.Port.allIcmpV6() -ec2.Port.allTraffic() -``` - -> NOTE: Not all protocols have corresponding helper methods. In the absence of a helper method, -> you can instantiate `Port` yourself with your own settings. You are also welcome to contribute -> new helper methods. - -### Default Ports - -Some Constructs have default ports associated with them. For example, the -listener of a load balancer does (it's the public port), or instances of an -RDS database (it's the port the database is accepting connections on). - -If the object you're calling the peering method on has a default port associated with it, you can call -`allowDefaultPortFrom()` and omit the port specifier. If the argument has an associated default port, call -`allowDefaultPortTo()`. - -For example: - -```ts -declare const listener: elbv2.ApplicationListener; -declare const appFleet: autoscaling.AutoScalingGroup; -declare const rdsDatabase: rds.DatabaseCluster; - -// Port implicit in listener -listener.connections.allowDefaultPortFromAnyIpv4('Allow public'); - -// Port implicit in peer -appFleet.connections.allowDefaultPortTo(rdsDatabase, 'Fleet can access database'); -``` - -### Security group rules - -By default, security group wills be added inline to the security group in the output cloud formation -template, if applicable. This includes any static rules by ip address and port range. This -optimization helps to minimize the size of the template. - -In some environments this is not desirable, for example if your security group access is controlled -via tags. You can disable inline rules per security group or globally via the context key -`@aws-cdk/aws-ec2.securityGroupDisableInlineRules`. - -```ts fixture=with-vpc -const mySecurityGroupWithoutInlineRules = new ec2.SecurityGroup(this, 'SecurityGroup', { - vpc, - description: 'Allow ssh access to ec2 instances', - allowAllOutbound: true, - disableInlineRules: true -}); -//This will add the rule as an external cloud formation construct -mySecurityGroupWithoutInlineRules.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(22), 'allow ssh access from the world'); -``` - -### Importing an existing security group - -If you know the ID and the configuration of the security group to import, you can use `SecurityGroup.fromSecurityGroupId`: - -```ts -const sg = ec2.SecurityGroup.fromSecurityGroupId(this, 'SecurityGroupImport', 'sg-1234', { - allowAllOutbound: true, -}); -``` - -Alternatively, use lookup methods to import security groups if you do not know the ID or the configuration details. Method `SecurityGroup.fromLookupByName` looks up a security group if the security group ID is unknown. - -```ts fixture=with-vpc -const sg = ec2.SecurityGroup.fromLookupByName(this, 'SecurityGroupLookup', 'security-group-name', vpc); -``` - -If the security group ID is known and configuration details are unknown, use method `SecurityGroup.fromLookupById` instead. This method will lookup property `allowAllOutbound` from the current configuration of the security group. - -```ts -const sg = ec2.SecurityGroup.fromLookupById(this, 'SecurityGroupLookup', 'sg-1234'); -``` - -The result of `SecurityGroup.fromLookupByName` and `SecurityGroup.fromLookupById` operations will be written to a file called `cdk.context.json`. You must commit this file to source control so that the lookup values are available in non-privileged environments such as CI build steps, and to ensure your template builds are repeatable. - -### Cross Stack Connections - -If you are attempting to add a connection from a peer in one stack to a peer in a different stack, sometimes it is necessary to ensure that you are making the connection in -a specific stack in order to avoid a cyclic reference. If there are no other dependencies between stacks then it will not matter in which stack you make -the connection, but if there are existing dependencies (i.e. stack1 already depends on stack2), then it is important to make the connection in the dependent stack (i.e. stack1). - -Whenever you make a `connections` function call, the ingress and egress security group rules will be added to the stack that the calling object exists in. -So if you are doing something like `peer1.connections.allowFrom(peer2)`, then the security group rules (both ingress and egress) will be created in `peer1`'s Stack. - -As an example, if we wanted to allow a connection from a security group in one stack (egress) to a security group in a different stack (ingress), -we would make the connection like: - -**If Stack1 depends on Stack2** - -```ts fixture=with-vpc -// Stack 1 -declare const stack1: Stack; -declare const stack2: Stack; - -const sg1 = new ec2.SecurityGroup(stack1, 'SG1', { - allowAllOutbound: false, // if this is `true` then no egress rule will be created - vpc, -}); - -// Stack 2 -const sg2 = new ec2.SecurityGroup(stack2, 'SG2', { - allowAllOutbound: false, // if this is `true` then no egress rule will be created - vpc, -}); - - -// `connections.allowTo` on `sg1` since we want the -// rules to be created in Stack1 -sg1.connections.allowTo(sg2, ec2.Port.tcp(3333)); -``` - -In this case both the Ingress Rule for `sg2` and the Egress Rule for `sg1` will both be created -in `Stack 1` which avoids the cyclic reference. - - -**If Stack2 depends on Stack1** - -```ts fixture=with-vpc -// Stack 1 -declare const stack1: Stack; -declare const stack2: Stack; - -const sg1 = new ec2.SecurityGroup(stack1, 'SG1', { - allowAllOutbound: false, // if this is `true` then no egress rule will be created - vpc, -}); - -// Stack 2 -const sg2 = new ec2.SecurityGroup(stack2, 'SG2', { - allowAllOutbound: false, // if this is `true` then no egress rule will be created - vpc, -}); - - -// `connections.allowFrom` on `sg2` since we want the -// rules to be created in Stack2 -sg2.connections.allowFrom(sg1, ec2.Port.tcp(3333)); -``` - -In this case both the Ingress Rule for `sg2` and the Egress Rule for `sg1` will both be created -in `Stack 2` which avoids the cyclic reference. - -## Machine Images (AMIs) - -AMIs control the OS that gets launched when you start your EC2 instance. The EC2 -library contains constructs to select the AMI you want to use. - -Depending on the type of AMI, you select it a different way. Here are some -examples of images you might want to use: - -[example of creating images](test/example.images.lit.ts) - -> NOTE: The AMIs selected by `MachineImage.lookup()` will be cached in -> `cdk.context.json`, so that your AutoScalingGroup instances aren't replaced while -> you are making unrelated changes to your CDK app. -> -> To query for the latest AMI again, remove the relevant cache entry from -> `cdk.context.json`, or use the `cdk context` command. For more information, see -> [Runtime Context](https://docs.aws.amazon.com/cdk/latest/guide/context.html) in the CDK -> developer guide. -> -> `MachineImage.genericLinux()`, `MachineImage.genericWindows()` will use `CfnMapping` in -> an agnostic stack. - -## Special VPC configurations - -### VPN connections to a VPC - -Create your VPC with VPN connections by specifying the `vpnConnections` props (keys are construct `id`s): - -```ts -const vpc = new ec2.Vpc(this, 'MyVpc', { - vpnConnections: { - dynamic: { // Dynamic routing (BGP) - ip: '1.2.3.4' - }, - static: { // Static routing - ip: '4.5.6.7', - staticRoutes: [ - '192.168.10.0/24', - '192.168.20.0/24' - ] - } - } -}); -``` - -To create a VPC that can accept VPN connections, set `vpnGateway` to `true`: - -```ts -const vpc = new ec2.Vpc(this, 'MyVpc', { - vpnGateway: true -}); -``` - -VPN connections can then be added: - -```ts fixture=with-vpc -vpc.addVpnConnection('Dynamic', { - ip: '1.2.3.4' -}); -``` - -By default, routes will be propagated on the route tables associated with the private subnets. If no -private subnets exist, isolated subnets are used. If no isolated subnets exist, public subnets are -used. Use the `Vpc` property `vpnRoutePropagation` to customize this behavior. - -VPN connections expose [metrics (cloudwatch.Metric)](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-cloudwatch/README.md) across all tunnels in the account/region and per connection: - -```ts fixture=with-vpc -// Across all tunnels in the account/region -const allDataOut = ec2.VpnConnection.metricAllTunnelDataOut(); - -// For a specific vpn connection -const vpnConnection = vpc.addVpnConnection('Dynamic', { - ip: '1.2.3.4' -}); -const state = vpnConnection.metricTunnelState(); -``` - -### VPC endpoints - -A VPC endpoint enables you to privately connect your VPC to supported AWS services and VPC endpoint services powered by PrivateLink without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Instances in your VPC do not require public IP addresses to communicate with resources in the service. Traffic between your VPC and the other service does not leave the Amazon network. - -Endpoints are virtual devices. They are horizontally scaled, redundant, and highly available VPC components that allow communication between instances in your VPC and services without imposing availability risks or bandwidth constraints on your network traffic. - -[example of setting up VPC endpoints](test/integ.vpc-endpoint.lit.ts) - -By default, CDK will place a VPC endpoint in one subnet per AZ. If you wish to override the AZs CDK places the VPC endpoint in, -use the `subnets` parameter as follows: - -```ts -declare const vpc: ec2.Vpc; - -new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { - vpc, - service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), - // Choose which availability zones to place the VPC endpoint in, based on - // available AZs - subnets: { - availabilityZones: ['us-east-1a', 'us-east-1c'] - } -}); -``` - -Per the [AWS documentation](https://aws.amazon.com/premiumsupport/knowledge-center/interface-endpoint-availability-zone/), not all -VPC endpoint services are available in all AZs. If you specify the parameter `lookupSupportedAzs`, CDK attempts to discover which -AZs an endpoint service is available in, and will ensure the VPC endpoint is not placed in a subnet that doesn't match those AZs. -These AZs will be stored in cdk.context.json. - -```ts -declare const vpc: ec2.Vpc; - -new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { - vpc, - service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), - // Choose which availability zones to place the VPC endpoint in, based on - // available AZs - lookupSupportedAzs: true -}); -``` - -Pre-defined AWS services are defined in the [InterfaceVpcEndpointAwsService](lib/vpc-endpoint.ts) class, and can be used to -create VPC endpoints without having to configure name, ports, etc. For example, a Keyspaces endpoint can be created for -use in your VPC: - -``` ts -declare const vpc: ec2.Vpc; - -new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { - vpc, - service: ec2.InterfaceVpcEndpointAwsService.KEYSPACES, -}); -``` - -#### Security groups for interface VPC endpoints - -By default, interface VPC endpoints create a new security group and traffic is **not** -automatically allowed from the VPC CIDR. - -Use the `connections` object to allow traffic to flow to the endpoint: - -```ts -declare const myEndpoint: ec2.InterfaceVpcEndpoint; - -myEndpoint.connections.allowDefaultPortFromAnyIpv4(); -``` - -Alternatively, existing security groups can be used by specifying the `securityGroups` prop. - -### VPC endpoint services - -A VPC endpoint service enables you to expose a Network Load Balancer(s) as a provider service to consumers, who connect to your service over a VPC endpoint. You can restrict access to your service via allowed principals (anything that extends ArnPrincipal), and require that new connections be manually accepted. - -```ts -declare const networkLoadBalancer1: elbv2.NetworkLoadBalancer; -declare const networkLoadBalancer2: elbv2.NetworkLoadBalancer; - -new ec2.VpcEndpointService(this, 'EndpointService', { - vpcEndpointServiceLoadBalancers: [networkLoadBalancer1, networkLoadBalancer2], - acceptanceRequired: true, - allowedPrincipals: [new iam.ArnPrincipal('arn:aws:iam::123456789012:root')] -}); -``` - -Endpoint services support private DNS, which makes it easier for clients to connect to your service by automatically setting up DNS in their VPC. -You can enable private DNS on an endpoint service like so: - -```ts -import { HostedZone, VpcEndpointServiceDomainName } from '@aws-cdk/aws-route53'; -declare const zone: HostedZone; -declare const vpces: ec2.VpcEndpointService; - -new VpcEndpointServiceDomainName(this, 'EndpointDomain', { - endpointService: vpces, - domainName: 'my-stuff.aws-cdk.dev', - publicHostedZone: zone, -}); -``` - -Note: The domain name must be owned (registered through Route53) by the account the endpoint service is in, or delegated to the account. -The VpcEndpointServiceDomainName will handle the AWS side of domain verification, the process for which can be found -[here](https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-services-dns-validation.html) - -### Client VPN endpoint - -AWS Client VPN is a managed client-based VPN service that enables you to securely access your AWS -resources and resources in your on-premises network. With Client VPN, you can access your resources -from any location using an OpenVPN-based VPN client. - -Use the `addClientVpnEndpoint()` method to add a client VPN endpoint to a VPC: - -```ts fixture=client-vpn -vpc.addClientVpnEndpoint('Endpoint', { - cidr: '10.100.0.0/16', - serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id', - // Mutual authentication - clientCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/client-certificate-id', - // User-based authentication - userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider), -}); -``` - -The endpoint must use at least one [authentication method](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/client-authentication.html): - -* Mutual authentication with a client certificate -* User-based authentication (directory or federated) - -If user-based authentication is used, the [self-service portal URL](https://docs.aws.amazon.com/vpn/latest/clientvpn-user/self-service-portal.html) -is made available via a CloudFormation output. - -By default, a new security group is created, and logging is enabled. Moreover, a rule to -authorize all users to the VPC CIDR is created. - -To customize authorization rules, set the `authorizeAllUsersToVpcCidr` prop to `false` -and use `addAuthorizationRule()`: - -```ts fixture=client-vpn -const endpoint = vpc.addClientVpnEndpoint('Endpoint', { - cidr: '10.100.0.0/16', - serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id', - userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider), - authorizeAllUsersToVpcCidr: false, -}); - -endpoint.addAuthorizationRule('Rule', { - cidr: '10.0.10.0/32', - groupId: 'group-id', -}); -``` - -Use `addRoute()` to configure network routes: - -```ts fixture=client-vpn -const endpoint = vpc.addClientVpnEndpoint('Endpoint', { - cidr: '10.100.0.0/16', - serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id', - userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider), -}); - -// Client-to-client access -endpoint.addRoute('Route', { - cidr: '10.100.0.0/16', - target: ec2.ClientVpnRouteTarget.local(), -}); -``` - -Use the `connections` object of the endpoint to allow traffic to other security groups. - -## Instances - -You can use the `Instance` class to start up a single EC2 instance. For production setups, we recommend -you use an `AutoScalingGroup` from the `aws-autoscaling` module instead, as AutoScalingGroups will take -care of restarting your instance if it ever fails. - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; - -// Amazon Linux 1 -new ec2.Instance(this, 'Instance1', { - vpc, - instanceType, - machineImage: ec2.MachineImage.latestAmazonLinux(), -}); - -// Amazon Linux 2 -new ec2.Instance(this, 'Instance2', { - vpc, - instanceType, - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }), -}); - -// Amazon Linux 2 with kernel 5.x -new ec2.Instance(this, 'Instance3', { - vpc, - instanceType, - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - kernel: ec2.AmazonLinuxKernel.KERNEL5_X, - }), -}); - -// AWS Linux 2022 -new ec2.Instance(this, 'Instance4', { - vpc, - instanceType, - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022, - }), -}); - -// Graviton 3 Processor -new ec2.Instance(this, 'Instance5', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE), - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - cpuType: ec2.AmazonLinuxCpuType.ARM_64, - }), -}); -``` - -### Configuring Instances using CloudFormation Init (cfn-init) - -CloudFormation Init allows you to configure your instances by writing files to them, installing software -packages, starting services and running arbitrary commands. By default, if any of the instance setup -commands throw an error; the deployment will fail and roll back to the previously known good state. -The following documentation also applies to `AutoScalingGroup`s. - -For the full set of capabilities of this system, see the documentation for -[`AWS::CloudFormation::Init`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html). -Here is an example of applying some configuration to an instance: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new ec2.Instance(this, 'Instance', { - vpc, - instanceType, - machineImage, - - // Showing the most complex setup, if you have simpler requirements - // you can use `CloudFormationInit.fromElements()`. - init: ec2.CloudFormationInit.fromConfigSets({ - configSets: { - // Applies the configs below in this order - default: ['yumPreinstall', 'config'], - }, - configs: { - yumPreinstall: new ec2.InitConfig([ - // Install an Amazon Linux package using yum - ec2.InitPackage.yum('git'), - ]), - config: new ec2.InitConfig([ - // Create a JSON file from tokens (can also create other files) - ec2.InitFile.fromObject('/etc/stack.json', { - stackId: Stack.of(this).stackId, - stackName: Stack.of(this).stackName, - region: Stack.of(this).region, - }), - - // Create a group and user - ec2.InitGroup.fromName('my-group'), - ec2.InitUser.fromName('my-user'), - - // Install an RPM from the internet - ec2.InitPackage.rpm('http://mirrors.ukfast.co.uk/sites/dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/r/rubygem-git-1.5.0-2.el8.noarch.rpm'), - ]), - }, - }), - initOptions: { - // Optional, which configsets to activate (['default'] by default) - configSets: ['default'], - - // Optional, how long the installation is expected to take (5 minutes by default) - timeout: Duration.minutes(30), - - // Optional, whether to include the --url argument when running cfn-init and cfn-signal commands (false by default) - includeUrl: true, - - // Optional, whether to include the --role argument when running cfn-init and cfn-signal commands (false by default) - includeRole: true, - }, -}); -``` - -`InitCommand` can not be used to start long-running processes. At deploy time, -`cfn-init` will always wait for the process to exit before continuing, causing -the CloudFormation deployment to fail because the signal hasn't been received -within the expected timeout. - -Instead, you should install a service configuration file onto your machine `InitFile`, -and then use `InitService` to start it. - -If your Linux OS is using SystemD (like Amazon Linux 2 or higher), the CDK has -helpers to create a long-running service using CFN Init. You can create a -SystemD-compatible config file using `InitService.systemdConfigFile()`, and -start it immediately. The following examples shows how to start a trivial Python -3 web server: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; - -new ec2.Instance(this, 'Instance', { - vpc, - instanceType, - machineImage: ec2.MachineImage.latestAmazonLinux({ - // Amazon Linux 2 uses SystemD - generation: ec2.AmazonLinuxGeneration: AMAZON_LINUX_2, - }), - - init: ec2.CloudFormationInit.fromElements([ - // Create a simple config file that runs a Python web server - ec2.InitService.systemdConfigFile('simpleserver', { - command: '/usr/bin/python3 -m http.server 8080', - cwd: '/var/www/html', - }), - // Start the server using SystemD - ec2.InitService.enable('simpleserver', { - serviceManager: ec2.ServiceManager.SYSTEMD, - }), - // Drop an example file to show the web server working - ec2.InitFile.fromString('/var/www/html/index.html', 'Hello! It\'s working!'), - ]), -}); -``` - -You can have services restarted after the init process has made changes to the system. -To do that, instantiate an `InitServiceRestartHandle` and pass it to the config elements -that need to trigger the restart and the service itself. For example, the following -config writes a config file for nginx, extracts an archive to the root directory, and then -restarts nginx so that it picks up the new config and files: - -```ts -declare const myBucket: s3.Bucket; - -const handle = new ec2.InitServiceRestartHandle(); - -ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromString('/etc/nginx/nginx.conf', '...', { serviceRestartHandles: [handle] }), - ec2.InitSource.fromS3Object('/var/www/html', myBucket, 'html.zip', { serviceRestartHandles: [handle] }), - ec2.InitService.enable('nginx', { - serviceRestartHandle: handle, - }) -); -``` - -### Bastion Hosts - -A bastion host functions as an instance used to access servers and resources in a VPC without open up the complete VPC on a network level. -You can use bastion hosts using a standard SSH connection targeting port 22 on the host. As an alternative, you can connect the SSH connection -feature of AWS Systems Manager Session Manager, which does not need an opened security group. (https://aws.amazon.com/about-aws/whats-new/2019/07/session-manager-launches-tunneling-support-for-ssh-and-scp/) - -A default bastion host for use via SSM can be configured like: - -```ts fixture=with-vpc -const host = new ec2.BastionHostLinux(this, 'BastionHost', { vpc }); -``` - -If you want to connect from the internet using SSH, you need to place the host into a public subnet. You can then configure allowed source hosts. - -```ts fixture=with-vpc -const host = new ec2.BastionHostLinux(this, 'BastionHost', { - vpc, - subnetSelection: { subnetType: ec2.SubnetType.PUBLIC }, -}); -host.allowSshAccessFrom(ec2.Peer.ipv4('1.2.3.4/32')); -``` - -As there are no SSH public keys deployed on this machine, you need to use [EC2 Instance Connect](https://aws.amazon.com/de/blogs/compute/new-using-amazon-ec2-instance-connect-for-ssh-access-to-your-ec2-instances/) -with the command `aws ec2-instance-connect send-ssh-public-key` to provide your SSH public key. - -EBS volume for the bastion host can be encrypted like: - -```ts fixture=with-vpc -const host = new ec2.BastionHostLinux(this, 'BastionHost', { - vpc, - blockDevices: [{ - deviceName: 'EBSBastionHost', - volume: ec2.BlockDeviceVolume.ebs(10, { - encrypted: true, - }), - }], -}); -``` - -### Block Devices - -To add EBS block device mappings, specify the `blockDevices` property. The following example sets the EBS-backed -root device (`/dev/sda1`) size to 50 GiB, and adds another EBS-backed device mapped to `/dev/sdm` that is 100 GiB in -size: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new ec2.Instance(this, 'Instance', { - vpc, - instanceType, - machineImage, - - // ... - - blockDevices: [ - { - deviceName: '/dev/sda1', - volume: ec2.BlockDeviceVolume.ebs(50), - }, - { - deviceName: '/dev/sdm', - volume: ec2.BlockDeviceVolume.ebs(100), - }, - ], -}); - -``` - -It is also possible to encrypt the block devices. In this example we will create an customer managed key encrypted EBS-backed root device: - -```ts -import { Key } from '@aws-cdk/aws-kms'; - -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -const kmsKey = new Key(this, 'KmsKey') - -new ec2.Instance(this, 'Instance', { - vpc, - instanceType, - machineImage, - - // ... - - blockDevices: [ - { - deviceName: '/dev/sda1', - volume: ec2.BlockDeviceVolume.ebs(50, { - encrypted: true, - kmsKey: kmsKey, - }), - }, - ], -}); - -``` - -### Volumes - -Whereas a `BlockDeviceVolume` is an EBS volume that is created and destroyed as part of the creation and destruction of a specific instance. A `Volume` is for when you want an EBS volume separate from any particular instance. A `Volume` is an EBS block device that can be attached to, or detached from, any instance at any time. Some types of `Volume`s can also be attached to multiple instances at the same time to allow you to have shared storage between those instances. - -A notable restriction is that a Volume can only be attached to instances in the same availability zone as the Volume itself. - -The following demonstrates how to create a 500 GiB encrypted Volume in the `us-west-2a` availability zone, and give a role the ability to attach that Volume to a specific instance: - -```ts -declare const instance: ec2.Instance; -declare const role: iam.Role; - -const volume = new ec2.Volume(this, 'Volume', { - availabilityZone: 'us-west-2a', - size: Size.gibibytes(500), - encrypted: true, -}); - -volume.grantAttachVolume(role, [instance]); -``` - -#### Instances Attaching Volumes to Themselves - -If you need to grant an instance the ability to attach/detach an EBS volume to/from itself, then using `grantAttachVolume` and `grantDetachVolume` as outlined above -will lead to an unresolvable circular reference between the instance role and the instance. In this case, use `grantAttachVolumeByResourceTag` and `grantDetachVolumeByResourceTag` as follows: - -```ts -declare const instance: ec2.Instance; -declare const volume: ec2.Volume; - -const attachGrant = volume.grantAttachVolumeByResourceTag(instance.grantPrincipal, [instance]); -const detachGrant = volume.grantDetachVolumeByResourceTag(instance.grantPrincipal, [instance]); -``` - -#### Attaching Volumes - -The Amazon EC2 documentation for -[Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) and -[Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-volumes.html) contains information on how -to attach and detach your Volumes to/from instances, and how to format them for use. - -The following is a sample skeleton of EC2 UserData that can be used to attach a Volume to the Linux instance that it is running on: - -```ts -declare const instance: ec2.Instance; -declare const volume: ec2.Volume; - -volume.grantAttachVolumeByResourceTag(instance.grantPrincipal, [instance]); -const targetDevice = '/dev/xvdz'; -instance.userData.addCommands( - // Retrieve token for accessing EC2 instance metadata (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html) - `TOKEN=$(curl -SsfX PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")`, - // Retrieve the instance Id of the current EC2 instance - `INSTANCE_ID=$(curl -SsfH "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id)`, - // Attach the volume to /dev/xvdz - `aws --region ${Stack.of(this).region} ec2 attach-volume --volume-id ${volume.volumeId} --instance-id $INSTANCE_ID --device ${targetDevice}`, - // Wait until the volume has attached - `while ! test -e ${targetDevice}; do sleep 1; done` - // The volume will now be mounted. You may have to add additional code to format the volume if it has not been prepared. -); -``` - -#### Tagging Volumes - -You can configure [tag propagation on volume creation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-propagatetagstovolumeoncreation). - -```ts - declare const vpc: ec2.Vpc; - declare const instanceType: ec2.InstanceType; - declare const machineImage: ec2.IMachineImage; - - new ec2.Instance(this, 'Instance', { - vpc, - machineImage, - instanceType, - propagateTagsToVolumeOnCreation: true, - }); -``` - -#### Throughput on GP3 Volumes - -You can specify the `throughput` of a GP3 volume from 125 (default) to 1000. - -```ts -new ec2.Volume(this, 'Volume', { - availabilityZone: 'us-east-1a', - size: cdk.Size.gibibytes(125), - volumeType: EbsDeviceVolumeType.GP3, - throughput: 125, -}); -``` - -### Configuring Instance Metadata Service (IMDS) - -#### Toggling IMDSv1 - -You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options to either -allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS. - -To do this for a single `Instance`, you can use the `requireImdsv2` property. -The example below demonstrates IMDSv2 being required on a single `Instance`: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; -declare const machineImage: ec2.IMachineImage; - -new ec2.Instance(this, 'Instance', { - vpc, - instanceType, - machineImage, - - // ... - - requireImdsv2: true, -}); -``` - -You can also use the either the `InstanceRequireImdsv2Aspect` for EC2 instances or the `LaunchTemplateRequireImdsv2Aspect` for EC2 launch templates -to apply the operation to multiple instances or launch templates, respectively. - -The following example demonstrates how to use the `InstanceRequireImdsv2Aspect` to require IMDSv2 for all EC2 instances in a stack: - -```ts -const aspect = new ec2.InstanceRequireImdsv2Aspect(); -Aspects.of(this).add(aspect); -``` - -## VPC Flow Logs - -VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Flow log data can be published to Amazon CloudWatch Logs and Amazon S3. After you've created a flow log, you can retrieve and view its data in the chosen destination. (). - -By default, a flow log will be created with CloudWatch Logs as the destination. - -You can create a flow log like this: - -```ts -declare const vpc: ec2.Vpc; - -new ec2.FlowLog(this, 'FlowLog', { - resourceType: ec2.FlowLogResourceType.fromVpc(vpc) -}) -``` - -Or you can add a Flow Log to a VPC by using the addFlowLog method like this: - -```ts -const vpc = new ec2.Vpc(this, 'Vpc'); - -vpc.addFlowLog('FlowLog'); -``` - -You can also add multiple flow logs with different destinations. - -```ts -const vpc = new ec2.Vpc(this, 'Vpc'); - -vpc.addFlowLog('FlowLogS3', { - destination: ec2.FlowLogDestination.toS3() -}); - -// Only reject traffic and interval every minute. -vpc.addFlowLog('FlowLogCloudWatch', { - trafficType: ec2.FlowLogTrafficType.REJECT, - maxAggregationInterval: FlowLogMaxAggregationInterval.ONE_MINUTE, -}); -``` - -### Custom Formatting - -You can also custom format flow logs. - -```ts -const vpc = new ec2.Vpc(this, 'Vpc'); - -vpc.addFlowLog('FlowLog', { - logFormat: [ - ec2.LogFormat.DST_PORT, - ec2.LogFormat.SRC_PORT, - ], -}); - -// If you just want to add a field to the default field -vpc.addFlowLog('FlowLog', { - logFormat: [ - ec2.LogFormat.VERSION, - ec2.LogFormat.ALL_DEFAULT_FIELDS, - ], -}); - -// If AWS CDK does not support the new fields -vpc.addFlowLog('FlowLog', { - logFormat: [ - ec2.LogFormat.SRC_PORT, - ec2.LogFormat.custom('${new-field}'), - ], -}); -``` - - -By default, the CDK will create the necessary resources for the destination. For the CloudWatch Logs destination -it will create a CloudWatch Logs Log Group as well as the IAM role with the necessary permissions to publish to -the log group. In the case of an S3 destination, it will create the S3 bucket. - -If you want to customize any of the destination resources you can provide your own as part of the `destination`. - -*CloudWatch Logs* - -```ts -declare const vpc: ec2.Vpc; - -const logGroup = new logs.LogGroup(this, 'MyCustomLogGroup'); - -const role = new iam.Role(this, 'MyCustomRole', { - assumedBy: new iam.ServicePrincipal('vpc-flow-logs.amazonaws.com') -}); - -new ec2.FlowLog(this, 'FlowLog', { - resourceType: ec2.FlowLogResourceType.fromVpc(vpc), - destination: ec2.FlowLogDestination.toCloudWatchLogs(logGroup, role) -}); -``` - -*S3* - -```ts -declare const vpc: ec2.Vpc; - -const bucket = new s3.Bucket(this, 'MyCustomBucket'); - -new ec2.FlowLog(this, 'FlowLog', { - resourceType: ec2.FlowLogResourceType.fromVpc(vpc), - destination: ec2.FlowLogDestination.toS3(bucket) -}); - -new ec2.FlowLog(this, 'FlowLogWithKeyPrefix', { - resourceType: ec2.FlowLogResourceType.fromVpc(vpc), - destination: ec2.FlowLogDestination.toS3(bucket, 'prefix/') -}); -``` - -When the S3 destination is configured, AWS will automatically create an S3 bucket policy -that allows the service to write logs to the bucket. This makes it impossible to later update -that bucket policy. To have CDK create the bucket policy so that future updates can be made, -the `@aws-cdk/aws-s3:createDefaultLoggingPolicy` [feature flag](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html) can be used. This can be set -in the `cdk.json` file. - -```json -{ - "context": { - "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true - } -} -``` - -## User Data - -User data enables you to run a script when your instances start up. In order to configure these scripts you can add commands directly to the script - or you can use the UserData's convenience functions to aid in the creation of your script. - -A user data could be configured to run a script found in an asset through the following: - -```ts -import { Asset } from '@aws-cdk/aws-s3-assets'; - -declare const instance: ec2.Instance; - -const asset = new Asset(this, 'Asset', { - path: './configure.sh' -}); - -const localPath = instance.userData.addS3DownloadCommand({ - bucket:asset.bucket, - bucketKey:asset.s3ObjectKey, - region: 'us-east-1', // Optional -}); -instance.userData.addExecuteFileCommand({ - filePath:localPath, - arguments: '--verbose -y' -}); -asset.grantRead(instance.role); -``` - -### Persisting user data - -By default, EC2 UserData is run once on only the first time that an instance is started. It is possible to make the -user data script run on every start of the instance. - -When creating a Windows UserData you can use the `persist` option to set whether or not to add -`true` [to the user data script](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts). it can be used as follows: - -```ts -const windowsUserData = UserData.forWindows({ persist: true }); -``` - -For a Linux instance, this can be accomplished by using a Multipart user data to configure cloud-config as detailed -in: https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/ - -### Multipart user data - -In addition, to above the `MultipartUserData` can be used to change instance startup behavior. Multipart user data are composed -from separate parts forming archive. The most common parts are scripts executed during instance set-up. However, there are other -kinds, too. - -The advantage of multipart archive is in flexibility when it's needed to add additional parts or to use specialized parts to -fine tune instance startup. Some services (like AWS Batch) support only `MultipartUserData`. - -The parts can be executed at different moment of instance start-up and can serve a different purpose. This is controlled by `contentType` property. -For common scripts, `text/x-shellscript; charset="utf-8"` can be used as content type. - -In order to create archive the `MultipartUserData` has to be instantiated. Than, user can add parts to multipart archive using `addPart`. The `MultipartBody` contains methods supporting creation of body parts. - -If the very custom part is required, it can be created using `MultipartUserData.fromRawBody`, in this case full control over content type, -transfer encoding, and body properties is given to the user. - -Below is an example for creating multipart user data with single body part responsible for installing `awscli` and configuring maximum size -of storage used by Docker containers: - -```ts -const bootHookConf = ec2.UserData.forLinux(); -bootHookConf.addCommands('cloud-init-per once docker_options echo \'OPTIONS="${OPTIONS} --storage-opt dm.basesize=40G"\' >> /etc/sysconfig/docker'); - -const setupCommands = ec2.UserData.forLinux(); -setupCommands.addCommands('sudo yum install awscli && echo Packages installed らと > /var/tmp/setup'); - -const multipartUserData = new ec2.MultipartUserData(); -// The docker has to be configured at early stage, so content type is overridden to boothook -multipartUserData.addPart(ec2.MultipartBody.fromUserData(bootHookConf, 'text/cloud-boothook; charset="us-ascii"')); -// Execute the rest of setup -multipartUserData.addPart(ec2.MultipartBody.fromUserData(setupCommands)); - -new ec2.LaunchTemplate(this, '', { - userData: multipartUserData, - blockDevices: [ - // Block device configuration rest - ] -}); -``` - -For more information see -[Specifying Multiple User Data Blocks Using a MIME Multi Part Archive](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bootstrap_container_instance.html#multi-part_user_data) - -#### Using add*Command on MultipartUserData - -To use the `add*Command` methods, that are inherited from the `UserData` interface, on `MultipartUserData` you must add a part -to the `MultipartUserData` and designate it as the receiver for these methods. This is accomplished by using the `addUserDataPart()` -method on `MultipartUserData` with the `makeDefault` argument set to `true`: - -```ts -const multipartUserData = new ec2.MultipartUserData(); -const commandsUserData = ec2.UserData.forLinux(); -multipartUserData.addUserDataPart(commandsUserData, ec2.MultipartBody.SHELL_SCRIPT, true); - -// Adding commands to the multipartUserData adds them to commandsUserData, and vice-versa. -multipartUserData.addCommands('touch /root/multi.txt'); -commandsUserData.addCommands('touch /root/userdata.txt'); -``` - -When used on an EC2 instance, the above `multipartUserData` will create both `multi.txt` and `userdata.txt` in `/root`. - -## Importing existing subnet - -To import an existing Subnet, call `Subnet.fromSubnetAttributes()` or -`Subnet.fromSubnetId()`. Only if you supply the subnet's Availability Zone -and Route Table Ids when calling `Subnet.fromSubnetAttributes()` will you be -able to use the CDK features that use these values (such as selecting one -subnet per AZ). - -Importing an existing subnet looks like this: - -```ts -// Supply all properties -const subnet1 = ec2.Subnet.fromSubnetAttributes(this, 'SubnetFromAttributes', { - subnetId: 's-1234', - availabilityZone: 'pub-az-4465', - routeTableId: 'rt-145' -}); - -// Supply only subnet id -const subnet2 = ec2.Subnet.fromSubnetId(this, 'SubnetFromId', 's-1234'); -``` - -## Launch Templates - -A Launch Template is a standardized template that contains the configuration information to launch an instance. -They can be used when launching instances on their own, through Amazon EC2 Auto Scaling, EC2 Fleet, and Spot Fleet. -Launch templates enable you to store launch parameters so that you do not have to specify them every time you launch -an instance. For information on Launch Templates please see the -[official documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html). - -The following demonstrates how to create a launch template with an Amazon Machine Image, and security group. - -```ts -declare const vpc: ec2.Vpc; - -const template = new ec2.LaunchTemplate(this, 'LaunchTemplate', { - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }), - securityGroup: new ec2.SecurityGroup(this, 'LaunchTemplateSG', { - vpc: vpc, - }), -}); -``` - -And the following demonstrates how to enable metadata options support. - -```ts -new ec2.LaunchTemplate(this, 'LaunchTemplate', { - httpEndpoint: true, - httpProtocolIpv6: true, - httpPutResponseHopLimit: 1, - httpTokens: ec2.LaunchTemplateHttpTokens.REQUIRED, - instanceMetadataTags: true, -}); -``` - -## Detailed Monitoring - -The following demonstrates how to enable [Detailed Monitoring](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html) for an EC2 instance. Keep in mind that Detailed Monitoring results in [additional charges](http://aws.amazon.com/cloudwatch/pricing/). - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; - -new ec2.Instance(this, 'Instance1', { - vpc, - instanceType, - machineImage: ec2.MachineImage.latestAmazonLinux(), - detailedMonitoring: true, -}); -``` - -## Connecting to your instances using SSM Session Manager - -SSM Session Manager makes it possible to connect to your instances from the -AWS Console, without preparing SSH keys. - -To do so, you need to: - -* Use an image with [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) installed - and configured. [Many images come with SSM Agent - preinstalled](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html), otherwise you - may need to manually put instructions to [install SSM - Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) into your - instance's UserData or use EC2 Init). -* Create the instance with `ssmSessionPermissions: true`. - -If these conditions are met, you can connect to the instance from the EC2 Console. Example: - -```ts -declare const vpc: ec2.Vpc; -declare const instanceType: ec2.InstanceType; - -new ec2.Instance(this, 'Instance1', { - vpc, - instanceType, - - // Amazon Linux 2 comes with SSM Agent by default - machineImage: ec2.MachineImage.latestAmazonLinux({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }), - - // Turn on SSM - ssmSessionPermissions: true, -}); -``` diff --git a/packages/@aws-cdk/aws-ec2/jest.config.js b/packages/@aws-cdk/aws-ec2/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-ec2/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ec2/lib/aspects/require-imdsv2-aspect.ts b/packages/@aws-cdk/aws-ec2/lib/aspects/require-imdsv2-aspect.ts deleted file mode 100644 index 05a8f5e1e4e69..0000000000000 --- a/packages/@aws-cdk/aws-ec2/lib/aspects/require-imdsv2-aspect.ts +++ /dev/null @@ -1,155 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { IConstruct } from 'constructs'; -import { CfnLaunchTemplate } from '../ec2.generated'; -import { Instance } from '../instance'; -import { LaunchTemplate } from '../launch-template'; - -/** - * Properties for `RequireImdsv2Aspect`. - */ -interface RequireImdsv2AspectProps { - /** - * Whether warning annotations from this Aspect should be suppressed or not. - * - * @default - false - */ - readonly suppressWarnings?: boolean; -} - -/** - * Base class for Aspect that makes IMDSv2 required. - */ -abstract class RequireImdsv2Aspect implements cdk.IAspect { - protected readonly suppressWarnings: boolean; - - constructor(props?: RequireImdsv2AspectProps) { - this.suppressWarnings = props?.suppressWarnings ?? false; - } - - abstract visit(node: IConstruct): void; - - /** - * Adds a warning annotation to a node, unless `suppressWarnings` is true. - * - * @param node The scope to add the warning to. - * @param message The warning message. - */ - protected warn(node: IConstruct, message: string) { - if (this.suppressWarnings !== true) { - cdk.Annotations.of(node).addWarning(`${RequireImdsv2Aspect.name} failed on node ${node.node.id}: ${message}`); - } - } -} - -/** - * Properties for `InstanceRequireImdsv2Aspect`. - */ -export interface InstanceRequireImdsv2AspectProps extends RequireImdsv2AspectProps { - /** - * Whether warnings that would be raised when an Instance is associated with an existing Launch Template - * should be suppressed or not. - * - * You can set this to `true` if `LaunchTemplateImdsAspect` is being used alongside this Aspect to - * suppress false-positive warnings because any Launch Templates associated with Instances will still be covered. - * - * @default - false - */ - readonly suppressLaunchTemplateWarning?: boolean; -} - -/** - * Aspect that applies IMDS configuration on EC2 Instance constructs. - * - * This aspect configures IMDS on an EC2 instance by creating a Launch Template with the - * IMDS configuration and associating that Launch Template with the instance. If an Instance - * is already associated with a Launch Template, a warning will (optionally) be added to the - * construct node and it will be skipped. - * - * To cover Instances already associated with Launch Templates, use `LaunchTemplateImdsAspect`. - */ -export class InstanceRequireImdsv2Aspect extends RequireImdsv2Aspect { - private readonly suppressLaunchTemplateWarning: boolean; - - constructor(props?: InstanceRequireImdsv2AspectProps) { - super(props); - this.suppressLaunchTemplateWarning = props?.suppressLaunchTemplateWarning ?? false; - } - - visit(node: IConstruct): void { - if (!(node instanceof Instance)) { - return; - } - if (node.instance.launchTemplate !== undefined) { - this.warn(node, 'Cannot toggle IMDSv1 because this Instance is associated with an existing Launch Template.'); - return; - } - - const launchTemplate = new CfnLaunchTemplate(node, 'LaunchTemplate', { - launchTemplateData: { - metadataOptions: { - httpTokens: 'required', - }, - }, - }); - if (cdk.FeatureFlags.of(node).isEnabled(cxapi.EC2_UNIQUE_IMDSV2_LAUNCH_TEMPLATE_NAME)) { - launchTemplate.launchTemplateName = cdk.Names.uniqueId(launchTemplate); - } else { - launchTemplate.launchTemplateName = `${node.node.id}LaunchTemplate`; - } - node.instance.launchTemplate = { - launchTemplateName: launchTemplate.launchTemplateName, - version: launchTemplate.getAtt('LatestVersionNumber').toString(), - }; - } - - protected warn(node: IConstruct, message: string) { - if (this.suppressLaunchTemplateWarning !== true) { - super.warn(node, message); - } - } -} - -/** - * Properties for `LaunchTemplateRequireImdsv2Aspect`. - */ -export interface LaunchTemplateRequireImdsv2AspectProps extends RequireImdsv2AspectProps {} - -/** - * Aspect that applies IMDS configuration on EC2 Launch Template constructs. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html - */ -export class LaunchTemplateRequireImdsv2Aspect extends RequireImdsv2Aspect { - constructor(props?: LaunchTemplateRequireImdsv2AspectProps) { - super(props); - } - - visit(node: IConstruct): void { - if (!(node instanceof LaunchTemplate)) { - return; - } - - const launchTemplate = node.node.tryFindChild('Resource') as CfnLaunchTemplate; - const data = launchTemplate.launchTemplateData; - if (cdk.isResolvableObject(data)) { - this.warn(node, 'LaunchTemplateData is a CDK token.'); - return; - } - - const metadataOptions = (data as CfnLaunchTemplate.LaunchTemplateDataProperty).metadataOptions; - if (cdk.isResolvableObject(metadataOptions)) { - this.warn(node, 'LaunchTemplateData.MetadataOptions is a CDK token.'); - return; - } - - const newData: CfnLaunchTemplate.LaunchTemplateDataProperty = { - ...data, - metadataOptions: { - ...metadataOptions, - httpTokens: 'required', - }, - }; - launchTemplate.launchTemplateData = newData; - } -} diff --git a/packages/@aws-cdk/aws-ec2/lib/instance.ts b/packages/@aws-cdk/aws-ec2/lib/instance.ts deleted file mode 100644 index b02e62ecafdaa..0000000000000 --- a/packages/@aws-cdk/aws-ec2/lib/instance.ts +++ /dev/null @@ -1,632 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; - -import { Annotations, Aspects, Duration, Fn, IResource, Lazy, Resource, Stack, Tags } from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; -import { Construct } from 'constructs'; -import { InstanceRequireImdsv2Aspect } from './aspects'; -import { CloudFormationInit } from './cfn-init'; -import { Connections, IConnectable } from './connections'; -import { CfnInstance } from './ec2.generated'; -import { InstanceType } from './instance-types'; -import { IMachineImage, OperatingSystemType } from './machine-image'; -import { instanceBlockDeviceMappings } from './private/ebs-util'; -import { ISecurityGroup, SecurityGroup } from './security-group'; -import { UserData } from './user-data'; -import { BlockDevice } from './volume'; -import { IVpc, Subnet, SubnetSelection } from './vpc'; - -/** - * Name tag constant - */ -const NAME_TAG: string = 'Name'; - -export interface IInstance extends IResource, IConnectable, iam.IGrantable { - /** - * The instance's ID - * - * @attribute - */ - readonly instanceId: string; - - /** - * The availability zone the instance was launched in - * - * @attribute - */ - readonly instanceAvailabilityZone: string; - - /** - * Private DNS name for this instance - * @attribute - */ - readonly instancePrivateDnsName: string; - - /** - * Private IP for this instance - * - * @attribute - */ - readonly instancePrivateIp: string; - - /** - * Publicly-routable DNS name for this instance. - * - * (May be an empty string if the instance does not have a public name). - * - * @attribute - */ - readonly instancePublicDnsName: string; - - /** - * Publicly-routable IP address for this instance. - * - * (May be an empty string if the instance does not have a public IP). - * - * @attribute - */ - readonly instancePublicIp: string; -} - -/** - * Properties of an EC2 Instance - */ -export interface InstanceProps { - - /** - * Name of SSH keypair to grant access to instance - * - * @default - No SSH access will be possible. - */ - readonly keyName?: string; - - /** - * Where to place the instance within the VPC - * - * @default - Private subnets. - */ - readonly vpcSubnets?: SubnetSelection; - - /** - * In which AZ to place the instance within the VPC - * - * @default - Random zone. - */ - readonly availabilityZone?: string; - - /** - * Whether the instance could initiate connections to anywhere by default. - * This property is only used when you do not provide a security group. - * - * @default true - */ - readonly allowAllOutbound?: boolean; - - /** - * The length of time to wait for the resourceSignalCount - * - * The maximum value is 43200 (12 hours). - * - * @default Duration.minutes(5) - */ - readonly resourceSignalTimeout?: Duration; - - /** - * VPC to launch the instance in. - */ - readonly vpc: IVpc; - - /** - * Security Group to assign to this instance - * - * @default - create new security group - */ - readonly securityGroup?: ISecurityGroup; - - /** - * Type of instance to launch - */ - readonly instanceType: InstanceType; - - /** - * AMI to launch - */ - readonly machineImage: IMachineImage; - - /** - * Specific UserData to use - * - * The UserData may still be mutated after creation. - * - * @default - A UserData object appropriate for the MachineImage's - * Operating System is created. - */ - readonly userData?: UserData; - - /** - * Changes to the UserData force replacement - * - * Depending the EC2 instance type, changing UserData either - * restarts the instance or replaces the instance. - * - * - Instance store-backed instances are replaced. - * - EBS-backed instances are restarted. - * - * By default, restarting does not execute the new UserData so you - * will need a different mechanism to ensure the instance is restarted. - * - * Setting this to `true` will make the instance's Logical ID depend on the - * UserData, which will cause CloudFormation to replace it if the UserData - * changes. - * - * @default - true iff `initOptions` is specified, false otherwise. - */ - readonly userDataCausesReplacement?: boolean; - - /** - * An IAM role to associate with the instance profile assigned to this Auto Scaling Group. - * - * The role must be assumable by the service principal `ec2.amazonaws.com`: - * - * @example - * const role = new iam.Role(this, 'MyRole', { - * assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com') - * }); - * - * @default - A role will automatically be created, it can be accessed via the `role` property - */ - readonly role?: iam.IRole; - - /** - * The name of the instance - * - * @default - CDK generated name - */ - readonly instanceName?: string; - - /** - * Specifies whether to enable an instance launched in a VPC to perform NAT. - * This controls whether source/destination checking is enabled on the instance. - * A value of true means that checking is enabled, and false means that checking is disabled. - * The value must be false for the instance to perform NAT. - * - * @default true - */ - readonly sourceDestCheck?: boolean; - - /** - * Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. - * - * Each instance that is launched has an associated root device volume, - * either an Amazon EBS volume or an instance store volume. - * You can use block device mappings to specify additional EBS volumes or - * instance store volumes to attach to an instance when it is launched. - * - * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html - * - * @default - Uses the block device mapping of the AMI - */ - readonly blockDevices?: BlockDevice[]; - - /** - * Defines a private IP address to associate with an instance. - * - * Private IP should be available within the VPC that the instance is build within. - * - * @default - no association - */ - readonly privateIpAddress?: string; - - /** - * Propagate the EC2 instance tags to the EBS volumes. - * - * @default - false - */ - readonly propagateTagsToVolumeOnCreation?: boolean; - - /** - * Apply the given CloudFormation Init configuration to the instance at startup - * - * @default - no CloudFormation init - */ - readonly init?: CloudFormationInit; - - /** - * Use the given options for applying CloudFormation Init - * - * Describes the configsets to use and the timeout to wait - * - * @default - default options - */ - readonly initOptions?: ApplyCloudFormationInitOptions; - - /** - * Whether IMDSv2 should be required on this instance. - * - * @default - false - */ - readonly requireImdsv2?: boolean; - - /** - * Whether "Detailed Monitoring" is enabled for this instance - * Keep in mind that Detailed Monitoring results in extra charges - * - * @see http://aws.amazon.com/cloudwatch/pricing/ - * @default - false - */ - readonly detailedMonitoring?: boolean; - - /** - * Add SSM session permissions to the instance role - * - * Setting this to `true` adds the necessary permissions to connect - * to the instance using SSM Session Manager. You can do this - * from the AWS Console. - * - * NOTE: Setting this flag to `true` may not be enough by itself. - * You must also use an AMI that comes with the SSM Agent, or install - * the SSM Agent yourself. See - * [Working with SSM Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) - * in the SSM Developer Guide. - * - * @default false - */ - readonly ssmSessionPermissions?: boolean; -} - -/** - * This represents a single EC2 instance - */ -export class Instance extends Resource implements IInstance { - - /** - * The type of OS the instance is running. - */ - public readonly osType: OperatingSystemType; - - /** - * Allows specify security group connections for the instance. - */ - public readonly connections: Connections; - - /** - * The IAM role assumed by the instance. - */ - public readonly role: iam.IRole; - - /** - * The principal to grant permissions to - */ - public readonly grantPrincipal: iam.IPrincipal; - - /** - * UserData for the instance - */ - public readonly userData: UserData; - - /** - * the underlying instance resource - */ - public readonly instance: CfnInstance; - /** - * @attribute - */ - public readonly instanceId: string; - /** - * @attribute - */ - public readonly instanceAvailabilityZone: string; - /** - * @attribute - */ - public readonly instancePrivateDnsName: string; - /** - * @attribute - */ - public readonly instancePrivateIp: string; - /** - * @attribute - */ - public readonly instancePublicDnsName: string; - /** - * @attribute - */ - public readonly instancePublicIp: string; - - private readonly securityGroup: ISecurityGroup; - private readonly securityGroups: ISecurityGroup[] = []; - - constructor(scope: Construct, id: string, props: InstanceProps) { - super(scope, id); - - if (props.initOptions && !props.init) { - throw new Error('Setting \'initOptions\' requires that \'init\' is also set'); - } - - if (props.securityGroup) { - this.securityGroup = props.securityGroup; - } else { - this.securityGroup = new SecurityGroup(this, 'InstanceSecurityGroup', { - vpc: props.vpc, - allowAllOutbound: props.allowAllOutbound !== false, - }); - } - this.connections = new Connections({ securityGroups: [this.securityGroup] }); - this.securityGroups.push(this.securityGroup); - Tags.of(this).add(NAME_TAG, props.instanceName || this.node.path); - - this.role = props.role || new iam.Role(this, 'InstanceRole', { - assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), - }); - this.grantPrincipal = this.role; - - if (props.ssmSessionPermissions) { - this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSSMManagedInstanceCore')); - } - - const iamProfile = new iam.CfnInstanceProfile(this, 'InstanceProfile', { - roles: [this.role.roleName], - }); - - // use delayed evaluation - const imageConfig = props.machineImage.getImage(this); - this.userData = props.userData ?? imageConfig.userData; - const userDataToken = Lazy.string({ produce: () => Fn.base64(this.userData.render()) }); - const securityGroupsToken = Lazy.list({ produce: () => this.securityGroups.map(sg => sg.securityGroupId) }); - - const { subnets } = props.vpc.selectSubnets(props.vpcSubnets); - let subnet; - if (props.availabilityZone) { - const selected = subnets.filter(sn => sn.availabilityZone === props.availabilityZone); - if (selected.length === 1) { - subnet = selected[0]; - } else { - Annotations.of(this).addError(`Need exactly 1 subnet to match AZ '${props.availabilityZone}', found ${selected.length}. Use a different availabilityZone.`); - } - } else { - if (subnets.length > 0) { - subnet = subnets[0]; - } else { - Annotations.of(this).addError(`Did not find any subnets matching '${JSON.stringify(props.vpcSubnets)}', please use a different selection.`); - } - } - if (!subnet) { - // We got here and we don't have a subnet because of validation errors. - // Invent one on the spot so the code below doesn't fail. - subnet = Subnet.fromSubnetAttributes(this, 'DummySubnet', { - subnetId: 's-notfound', - availabilityZone: 'az-notfound', - }); - } - - this.instance = new CfnInstance(this, 'Resource', { - imageId: imageConfig.imageId, - keyName: props.keyName, - instanceType: props.instanceType.toString(), - securityGroupIds: securityGroupsToken, - iamInstanceProfile: iamProfile.ref, - userData: userDataToken, - subnetId: subnet.subnetId, - availabilityZone: subnet.availabilityZone, - sourceDestCheck: props.sourceDestCheck, - blockDeviceMappings: props.blockDevices !== undefined ? instanceBlockDeviceMappings(this, props.blockDevices) : undefined, - privateIpAddress: props.privateIpAddress, - propagateTagsToVolumeOnCreation: props.propagateTagsToVolumeOnCreation, - monitoring: props.detailedMonitoring, - }); - this.instance.node.addDependency(this.role); - - this.osType = imageConfig.osType; - this.node.defaultChild = this.instance; - - this.instanceId = this.instance.ref; - this.instanceAvailabilityZone = this.instance.attrAvailabilityZone; - this.instancePrivateDnsName = this.instance.attrPrivateDnsName; - this.instancePrivateIp = this.instance.attrPrivateIp; - this.instancePublicDnsName = this.instance.attrPublicDnsName; - this.instancePublicIp = this.instance.attrPublicIp; - - if (props.init) { - this.applyCloudFormationInit(props.init, props.initOptions); - } - - this.applyUpdatePolicies(props); - - // Trigger replacement (via new logical ID) on user data change, if specified or cfn-init is being used. - // - // This is slightly tricky -- we need to resolve the UserData string (in order to get at actual Asset hashes, - // instead of the Token stringifications of them ('${Token[1234]}'). However, in the case of CFN Init usage, - // a UserData is going to contain the logicalID of the resource itself, which means infinite recursion if we - // try to naively resolve. We need a recursion breaker in this. - const originalLogicalId = Stack.of(this).getLogicalId(this.instance); - let recursing = false; - this.instance.overrideLogicalId(Lazy.uncachedString({ - produce: (context) => { - if (recursing) { return originalLogicalId; } - if (!(props.userDataCausesReplacement ?? props.initOptions)) { return originalLogicalId; } - - const fragments = new Array(); - recursing = true; - try { - fragments.push(JSON.stringify(context.resolve(this.userData.render()))); - } finally { - recursing = false; - } - const digest = md5hash(fragments.join('')).slice(0, 16); - return `${originalLogicalId}${digest}`; - }, - })); - - if (props.requireImdsv2) { - Aspects.of(this).add(new InstanceRequireImdsv2Aspect()); - } - } - - /** - * Add the security group to the instance. - * - * @param securityGroup: The security group to add - */ - public addSecurityGroup(securityGroup: ISecurityGroup): void { - this.securityGroups.push(securityGroup); - } - - /** - * Add command to the startup script of the instance. - * The command must be in the scripting language supported by the instance's OS (i.e. Linux/Windows). - */ - public addUserData(...commands: string[]) { - this.userData.addCommands(...commands); - } - - /** - * Adds a statement to the IAM role assumed by the instance. - */ - public addToRolePolicy(statement: iam.PolicyStatement) { - this.role.addToPrincipalPolicy(statement); - } - - /** - * Use a CloudFormation Init configuration at instance startup - * - * This does the following: - * - * - Attaches the CloudFormation Init metadata to the Instance resource. - * - Add commands to the instance UserData to run `cfn-init` and `cfn-signal`. - * - Update the instance's CreationPolicy to wait for the `cfn-signal` commands. - */ - private applyCloudFormationInit(init: CloudFormationInit, options: ApplyCloudFormationInitOptions = {}) { - init.attach(this.instance, { - platform: this.osType, - instanceRole: this.role, - userData: this.userData, - configSets: options.configSets, - embedFingerprint: options.embedFingerprint, - printLog: options.printLog, - ignoreFailures: options.ignoreFailures, - includeRole: options.includeRole, - includeUrl: options.includeUrl, - }); - this.waitForResourceSignal(options.timeout ?? Duration.minutes(5)); - } - - /** - * Wait for a single additional resource signal - * - * Add 1 to the current ResourceSignal Count and add the given timeout to the current timeout. - * - * Use this to pause the CloudFormation deployment to wait for the instances - * in the AutoScalingGroup to report successful startup during - * creation and updates. The UserData script needs to invoke `cfn-signal` - * with a success or failure code after it is done setting up the instance. - */ - private waitForResourceSignal(timeout: Duration) { - const oldResourceSignal = this.instance.cfnOptions.creationPolicy?.resourceSignal; - this.instance.cfnOptions.creationPolicy = { - ...this.instance.cfnOptions.creationPolicy, - resourceSignal: { - count: (oldResourceSignal?.count ?? 0) + 1, - timeout: (oldResourceSignal?.timeout ? Duration.parse(oldResourceSignal?.timeout).plus(timeout) : timeout).toIsoString(), - }, - }; - } - - /** - * Apply CloudFormation update policies for the instance - */ - private applyUpdatePolicies(props: InstanceProps) { - if (props.resourceSignalTimeout !== undefined) { - this.instance.cfnOptions.creationPolicy = { - ...this.instance.cfnOptions.creationPolicy, - resourceSignal: { - timeout: props.resourceSignalTimeout && props.resourceSignalTimeout.toIsoString(), - }, - }; - } - } -} - -/** - * Options for applying CloudFormation init to an instance or instance group - */ -export interface ApplyCloudFormationInitOptions { - /** - * ConfigSet to activate - * - * @default ['default'] - */ - readonly configSets?: string[]; - - /** - * Timeout waiting for the configuration to be applied - * - * @default Duration.minutes(5) - */ - readonly timeout?: Duration; - - /** - * Force instance replacement by embedding a config fingerprint - * - * If `true` (the default), a hash of the config will be embedded into the - * UserData, so that if the config changes, the UserData changes. - * - * - If the EC2 instance is instance-store backed or - * `userDataCausesReplacement` is set, this will cause the instance to be - * replaced and the new configuration to be applied. - * - If the instance is EBS-backed and `userDataCausesReplacement` is not - * set, the change of UserData will make the instance restart but not be - * replaced, and the configuration will not be applied automatically. - * - * If `false`, no hash will be embedded, and if the CloudFormation Init - * config changes nothing will happen to the running instance. If a - * config update introduces errors, you will not notice until after the - * CloudFormation deployment successfully finishes and the next instance - * fails to launch. - * - * @default true - */ - readonly embedFingerprint?: boolean; - - /** - * Print the results of running cfn-init to the Instance System Log - * - * By default, the output of running cfn-init is written to a log file - * on the instance. Set this to `true` to print it to the System Log - * (visible from the EC2 Console), `false` to not print it. - * - * (Be aware that the system log is refreshed at certain points in - * time of the instance life cycle, and successful execution may - * not always show up). - * - * @default true - */ - readonly printLog?: boolean; - - /** - * Don't fail the instance creation when cfn-init fails - * - * You can use this to prevent CloudFormation from rolling back when - * instances fail to start up, to help in debugging. - * - * @default false - */ - readonly ignoreFailures?: boolean; - - /** - * Include --url argument when running cfn-init and cfn-signal commands - * - * This will be the cloudformation endpoint in the deployed region - * e.g. https://cloudformation.us-east-1.amazonaws.com - * - * @default false - */ - readonly includeUrl?: boolean; - - /** - * Include --role argument when running cfn-init and cfn-signal commands - * - * This will be the IAM instance profile attached to the EC2 instance - * - * @default false - */ - readonly includeRole?: boolean; -} diff --git a/packages/@aws-cdk/aws-ec2/lib/security-group.ts b/packages/@aws-cdk/aws-ec2/lib/security-group.ts deleted file mode 100644 index b77b0057f6ee7..0000000000000 --- a/packages/@aws-cdk/aws-ec2/lib/security-group.ts +++ /dev/null @@ -1,846 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Annotations, ContextProvider, IResource, Lazy, Names, Resource, ResourceProps, Stack, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { Connections } from './connections'; -import { CfnSecurityGroup, CfnSecurityGroupEgress, CfnSecurityGroupIngress } from './ec2.generated'; -import { IPeer, Peer } from './peer'; -import { Port } from './port'; -import { IVpc } from './vpc'; - -const SECURITY_GROUP_SYMBOL = Symbol.for('@aws-cdk/iam.SecurityGroup'); - -const SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY = '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'; - -/** - * Interface for security group-like objects - */ -export interface ISecurityGroup extends IResource, IPeer { - /** - * ID for the current security group - * @attribute - */ - readonly securityGroupId: string; - - /** - * Whether the SecurityGroup has been configured to allow all outbound traffic - */ - readonly allowAllOutbound: boolean; - - /** - * Add an ingress rule for the current security group - * - * `remoteRule` controls where the Rule object is created if the peer is also a - * securityGroup and they are in different stack. If false (default) the - * rule object is created under the current SecurityGroup object. If true and the - * peer is also a SecurityGroup, the rule object is created under the remote - * SecurityGroup object. - */ - addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean): void; - - /** - * Add an egress rule for the current security group - * - * `remoteRule` controls where the Rule object is created if the peer is also a - * securityGroup and they are in different stack. If false (default) the - * rule object is created under the current SecurityGroup object. If true and the - * peer is also a SecurityGroup, the rule object is created under the remote - * SecurityGroup object. - */ - addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean): void; -} - -/** - * A SecurityGroup that is not created in this template - */ -abstract class SecurityGroupBase extends Resource implements ISecurityGroup { - /** - * Return whether the indicated object is a security group - */ - public static isSecurityGroup(x: any): x is SecurityGroupBase { - return SECURITY_GROUP_SYMBOL in x; - } - - public abstract readonly securityGroupId: string; - public abstract readonly allowAllOutbound: boolean; - public abstract readonly allowAllIpv6Outbound: boolean; - - public readonly canInlineRule = false; - public readonly connections: Connections = new Connections({ securityGroups: [this] }); - public readonly defaultPort?: Port; - - private peerAsTokenCount: number = 0; - - constructor(scope: Construct, id: string, props?: ResourceProps) { - super(scope, id, props); - - Object.defineProperty(this, SECURITY_GROUP_SYMBOL, { value: true }); - } - - public get uniqueId() { - return Names.nodeUniqueId(this.node); - } - - public addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { - if (description === undefined) { - description = `from ${peer.uniqueId}:${connection}`; - } - - const { scope, id } = this.determineRuleScope(peer, connection, 'from', remoteRule); - - // Skip duplicates - if (scope.node.tryFindChild(id) === undefined) { - new CfnSecurityGroupIngress(scope, id, { - groupId: this.securityGroupId, - ...peer.toIngressRuleConfig(), - ...connection.toRuleJson(), - description, - }); - } - } - - public addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { - if (description === undefined) { - description = `to ${peer.uniqueId}:${connection}`; - } - - const { scope, id } = this.determineRuleScope(peer, connection, 'to', remoteRule); - - // Skip duplicates - if (scope.node.tryFindChild(id) === undefined) { - new CfnSecurityGroupEgress(scope, id, { - groupId: this.securityGroupId, - ...peer.toEgressRuleConfig(), - ...connection.toRuleJson(), - description, - }); - } - } - - public toIngressRuleConfig(): any { - return { sourceSecurityGroupId: this.securityGroupId }; - } - - public toEgressRuleConfig(): any { - return { destinationSecurityGroupId: this.securityGroupId }; - } - - /** - * Determine where to parent a new ingress/egress rule - * - * A SecurityGroup rule is parented under the group it's related to, UNLESS - * we're in a cross-stack scenario with another Security Group. In that case, - * we respect the 'remoteRule' flag and will parent under the other security - * group. - * - * This is necessary to avoid cyclic dependencies between stacks, since both - * ingress and egress rules will reference both security groups, and a naive - * parenting will lead to the following situation: - * - * ╔════════════════════╗ ╔════════════════════╗ - * ║ ┌───────────┐ ║ ║ ┌───────────┐ ║ - * ║ │ GroupA │◀────╬─┐ ┌───╬───▶│ GroupB │ ║ - * ║ └───────────┘ ║ │ │ ║ └───────────┘ ║ - * ║ ▲ ║ │ │ ║ ▲ ║ - * ║ │ ║ │ │ ║ │ ║ - * ║ │ ║ │ │ ║ │ ║ - * ║ ┌───────────┐ ║ └───┼───╬────┌───────────┐ ║ - * ║ │ EgressA │─────╬─────┘ ║ │ IngressB │ ║ - * ║ └───────────┘ ║ ║ └───────────┘ ║ - * ║ ║ ║ ║ - * ╚════════════════════╝ ╚════════════════════╝ - * - * By having the ability to switch the parent, we avoid the cyclic reference by - * keeping all rules in a single stack. - * - * If this happens, we also have to change the construct ID, because - * otherwise we might have two objects with the same ID if we have - * multiple reversed security group relationships. - * - * ╔═══════════════════════════════════╗ - * ║┌───────────┐ ║ - * ║│ GroupB │ ║ - * ║└───────────┘ ║ - * ║ ▲ ║ - * ║ │ ┌───────────┐ ║ - * ║ ├────"from A"──│ IngressB │ ║ - * ║ │ └───────────┘ ║ - * ║ │ ┌───────────┐ ║ - * ║ ├─────"to B"───│ EgressA │ ║ - * ║ │ └───────────┘ ║ - * ║ │ ┌───────────┐ ║ - * ║ └─────"to B"───│ EgressC │ ║ <-- oops - * ║ └───────────┘ ║ - * ╚═══════════════════════════════════╝ - */ - - protected determineRuleScope( - peer: IPeer, - connection: Port, - fromTo: 'from' | 'to', - remoteRule?: boolean): RuleScope { - - if (remoteRule && SecurityGroupBase.isSecurityGroup(peer) && differentStacks(this, peer)) { - // Reversed - const reversedFromTo = fromTo === 'from' ? 'to' : 'from'; - return { scope: peer, id: `${this.uniqueId}:${connection} ${reversedFromTo}` }; - } else { - // Regular (do old ID escaping to in order to not disturb existing deployments) - return { scope: this, id: `${fromTo} ${this.renderPeer(peer)}:${connection}`.replace('/', '_') }; - } - } - - private renderPeer(peer: IPeer) { - if (Token.isUnresolved(peer.uniqueId)) { - // Need to return a unique value each time a peer - // is an unresolved token, else the duplicate skipper - // in `sg.addXxxRule` can detect unique rules as duplicates - return this.peerAsTokenCount++ ? `'{IndirectPeer${this.peerAsTokenCount}}'` : '{IndirectPeer}'; - } else { - return peer.uniqueId; - } - } -} - -/** - * The scope and id in which a given SecurityGroup rule should be defined. - */ -export interface RuleScope { - /** - * The SecurityGroup in which a rule should be scoped. - */ - readonly scope: ISecurityGroup; - /** - * The construct ID to use for the rule. - */ - readonly id: string; -} - -function differentStacks(group1: SecurityGroupBase, group2: SecurityGroupBase) { - return Stack.of(group1) !== Stack.of(group2); -} - -export interface SecurityGroupProps { - /** - * The name of the security group. For valid values, see the GroupName - * parameter of the CreateSecurityGroup action in the Amazon EC2 API - * Reference. - * - * It is not recommended to use an explicit group name. - * - * @default If you don't specify a GroupName, AWS CloudFormation generates a - * unique physical ID and uses that ID for the group name. - */ - readonly securityGroupName?: string; - - /** - * A description of the security group. - * - * @default The default name will be the construct's CDK path. - */ - readonly description?: string; - - /** - * The VPC in which to create the security group. - */ - readonly vpc: IVpc; - - /** - * Whether to allow all outbound traffic by default. - * - * If this is set to true, there will only be a single egress rule which allows all - * outbound traffic. If this is set to false, no outbound traffic will be allowed by - * default and all egress traffic must be explicitly authorized. - * - * To allow all ipv6 traffic use allowAllIpv6Outbound - * - * @default true - */ - readonly allowAllOutbound?: boolean; - - /** - * Whether to allow all outbound ipv6 traffic by default. - * - * If this is set to true, there will only be a single egress rule which allows all - * outbound ipv6 traffic. If this is set to false, no outbound traffic will be allowed by - * default and all egress ipv6 traffic must be explicitly authorized. - * - * To allow all ipv4 traffic use allowAllOutbound - * - * @default false - */ - readonly allowAllIpv6Outbound?: boolean; - - /** - * Whether to disable inline ingress and egress rule optimization. - * - * If this is set to true, ingress and egress rules will not be declared under the - * SecurityGroup in cloudformation, but will be separate elements. - * - * Inlining rules is an optimization for producing smaller stack templates. Sometimes - * this is not desirable, for example when security group access is managed via tags. - * - * The default value can be overriden globally by setting the context variable - * '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'. - * - * @default false - */ - readonly disableInlineRules?: boolean; -} - -/** - * Additional options for imported security groups - */ -export interface SecurityGroupImportOptions { - /** - * Mark the SecurityGroup as having been created allowing all outbound traffic - * - * Only if this is set to false will egress rules be added to this security - * group. Be aware, this would undo any potential "all outbound traffic" - * default. - * - * - * @default true - */ - readonly allowAllOutbound?: boolean; - - /** - * Mark the SecurityGroup as having been created allowing all outbound ipv6 traffic - * - * Only if this is set to false will egress rules for ipv6 be added to this security - * group. Be aware, this would undo any potential "all outbound traffic" - * default. - * - * @default false - */ - readonly allowAllIpv6Outbound?: boolean; - - /** - * If a SecurityGroup is mutable CDK can add rules to existing groups - * - * Beware that making a SecurityGroup immutable might lead to issue - * due to missing ingress/egress rules for new resources. - * - * - * @default true - */ - readonly mutable?: boolean; -} - -/** - * Creates an Amazon EC2 security group within a VPC. - * - * Security Groups act like a firewall with a set of rules, and are associated - * with any AWS resource that has or creates Elastic Network Interfaces (ENIs). - * A typical example of a resource that has a security group is an Instance (or - * Auto Scaling Group of instances) - * - * If you are defining new infrastructure in CDK, there is a good chance you - * won't have to interact with this class at all. Like IAM Roles, Security - * Groups need to exist to control access between AWS resources, but CDK will - * automatically generate and populate them with least-privilege permissions - * for you so you can concentrate on your business logic. - * - * All Constructs that require Security Groups will create one for you if you - * don't specify one at construction. After construction, you can selectively - * allow connections to and between constructs via--for example-- the `instance.connections` - * object. Think of it as "allowing connections to your instance", rather than - * "adding ingress rules a security group". See the [Allowing - * Connections](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#allowing-connections) - * section in the library documentation for examples. - * - * Direct manipulation of the Security Group through `addIngressRule` and - * `addEgressRule` is possible, but mutation through the `.connections` object - * is recommended. If you peer two constructs with security groups this way, - * appropriate rules will be created in both. - * - * If you have an existing security group you want to use in your CDK application, - * you would import it like this: - * - * ```ts - * const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'SG', 'sg-12345', { - * mutable: false - * }); - * ``` - */ -export class SecurityGroup extends SecurityGroupBase { - /** - * Look up a security group by id. - * - * @deprecated Use `fromLookupById()` instead - */ - public static fromLookup(scope: Construct, id: string, securityGroupId: string) { - return this.fromLookupAttributes(scope, id, { securityGroupId }); - } - - /** - * Look up a security group by id. - */ - public static fromLookupById(scope: Construct, id: string, securityGroupId: string) { - return this.fromLookupAttributes(scope, id, { securityGroupId }); - } - - /** - * Look up a security group by name. - */ - public static fromLookupByName(scope: Construct, id: string, securityGroupName: string, vpc: IVpc) { - return this.fromLookupAttributes(scope, id, { securityGroupName, vpc }); - } - - /** - * Import an existing security group into this app. - * - * This method will assume that the Security Group has a rule in it which allows - * all outbound traffic, and so will not add egress rules to the imported Security - * Group (only ingress rules). - * - * If your existing Security Group needs to have egress rules added, pass the - * `allowAllOutbound: false` option on import. - */ - public static fromSecurityGroupId(scope: Construct, id: string, securityGroupId: string, options: SecurityGroupImportOptions = {}): ISecurityGroup { - class MutableImport extends SecurityGroupBase { - public securityGroupId = securityGroupId; - public allowAllOutbound = options.allowAllOutbound ?? true; - public allowAllIpv6Outbound = options.allowAllIpv6Outbound ?? false; - - public addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { - // Only if allowAllOutbound has been disabled - if (options.allowAllOutbound === false) { - super.addEgressRule(peer, connection, description, remoteRule); - } - } - } - - class ImmutableImport extends SecurityGroupBase { - public securityGroupId = securityGroupId; - public allowAllOutbound = options.allowAllOutbound ?? true; - public allowAllIpv6Outbound = options.allowAllIpv6Outbound ?? false; - - public addEgressRule(_peer: IPeer, _connection: Port, _description?: string, _remoteRule?: boolean) { - // do nothing - } - - public addIngressRule(_peer: IPeer, _connection: Port, _description?: string, _remoteRule?: boolean) { - // do nothing - } - } - - return options.mutable !== false - ? new MutableImport(scope, id) - : new ImmutableImport(scope, id); - } - - /** - * Look up a security group. - */ - private static fromLookupAttributes(scope: Construct, id: string, options: SecurityGroupLookupOptions) { - if (Token.isUnresolved(options.securityGroupId) || Token.isUnresolved(options.securityGroupName) || Token.isUnresolved(options.vpc?.vpcId)) { - throw new Error('All arguments to look up a security group must be concrete (no Tokens)'); - } - - const attributes: cxapi.SecurityGroupContextResponse = ContextProvider.getValue(scope, { - provider: cxschema.ContextProvider.SECURITY_GROUP_PROVIDER, - props: { - securityGroupId: options.securityGroupId, - securityGroupName: options.securityGroupName, - vpcId: options.vpc?.vpcId, - }, - dummyValue: { - securityGroupId: 'sg-12345678', - allowAllOutbound: true, - } as cxapi.SecurityGroupContextResponse, - }).value; - - return SecurityGroup.fromSecurityGroupId(scope, id, attributes.securityGroupId, { - allowAllOutbound: attributes.allowAllOutbound, - mutable: true, - }); - } - - /** - * An attribute that represents the security group name. - * - * @attribute - * @deprecated returns the security group ID, rather than the name. - */ - public readonly securityGroupName: string; - - /** - * The ID of the security group - * - * @attribute - */ - public readonly securityGroupId: string; - - /** - * The VPC ID this security group is part of. - * - * @attribute - */ - public readonly securityGroupVpcId: string; - - /** - * Whether the SecurityGroup has been configured to allow all outbound traffic - */ - public readonly allowAllOutbound: boolean; - - /** - * Whether the SecurityGroup has been configured to allow all outbound ipv6 traffic - */ - public readonly allowAllIpv6Outbound: boolean; - - private readonly securityGroup: CfnSecurityGroup; - private readonly directIngressRules: CfnSecurityGroup.IngressProperty[] = []; - private readonly directEgressRules: CfnSecurityGroup.EgressProperty[] = []; - - /** - * Whether to disable optimization for inline security group rules. - */ - private readonly disableInlineRules: boolean; - - constructor(scope: Construct, id: string, props: SecurityGroupProps) { - super(scope, id, { - physicalName: props.securityGroupName, - }); - - const groupDescription = props.description || this.node.path; - - this.allowAllOutbound = props.allowAllOutbound !== false; - this.allowAllIpv6Outbound = props.allowAllIpv6Outbound ?? false; - - this.disableInlineRules = props.disableInlineRules !== undefined ? - !!props.disableInlineRules : - !!this.node.tryGetContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY); - - this.securityGroup = new CfnSecurityGroup(this, 'Resource', { - groupName: this.physicalName, - groupDescription, - securityGroupIngress: Lazy.any({ produce: () => this.directIngressRules }, { omitEmptyArray: true } ), - securityGroupEgress: Lazy.any({ produce: () => this.directEgressRules }, { omitEmptyArray: true } ), - vpcId: props.vpc.vpcId, - }); - - this.securityGroupId = this.securityGroup.attrGroupId; - this.securityGroupVpcId = this.securityGroup.attrVpcId; - this.securityGroupName = this.securityGroup.ref; - - this.addDefaultEgressRule(); - this.addDefaultIpv6EgressRule(); - } - - public addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { - if (!peer.canInlineRule || !connection.canInlineRule || this.disableInlineRules) { - super.addIngressRule(peer, connection, description, remoteRule); - return; - } - - if (description === undefined) { - description = `from ${peer.uniqueId}:${connection}`; - } - - this.addDirectIngressRule({ - ...peer.toIngressRuleConfig(), - ...connection.toRuleJson(), - description, - }); - } - - public addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { - const isIpv6 = peer.toEgressRuleConfig().hasOwnProperty('cidrIpv6'); - - if (!isIpv6 && this.allowAllOutbound) { - // In the case of "allowAllOutbound", we don't add any more rules. There - // is only one rule which allows all traffic and that subsumes any other - // rule. - if (!remoteRule) { // Warn only if addEgressRule() was explicitely called - Annotations.of(this).addWarning('Ignoring Egress rule since \'allowAllOutbound\' is set to true; To add customized rules, set allowAllOutbound=false on the SecurityGroup'); - } - return; - } else if (!isIpv6 && !this.allowAllOutbound) { - // Otherwise, if the bogus rule exists we can now remove it because the - // presence of any other rule will get rid of EC2's implicit "all - // outbound" rule anyway. - this.removeNoTrafficRule(); - } - - if (isIpv6 && this.allowAllIpv6Outbound) { - // In the case of "allowAllIpv6Outbound", we don't add any more rules. There - // is only one rule which allows all traffic and that subsumes any other - // rule. - if (!remoteRule) { // Warn only if addEgressRule() was explicitely called - Annotations.of(this).addWarning('Ignoring Egress rule since \'allowAllIpv6Outbound\' is set to true; To add customized rules, set allowAllIpv6Outbound=false on the SecurityGroup'); - } - return; - } - - if (!peer.canInlineRule || !connection.canInlineRule || this.disableInlineRules) { - super.addEgressRule(peer, connection, description, remoteRule); - return; - } - - if (description === undefined) { - description = `from ${peer.uniqueId}:${connection}`; - } - - const rule = { - ...peer.toEgressRuleConfig(), - ...connection.toRuleJson(), - description, - }; - - if (isAllTrafficRule(rule)) { - // We cannot allow this; if someone adds the rule in this way, it will be - // removed again if they add other rules. We also can't automatically switch - // to "allOutbound=true" mode, because we might have already emitted - // EgressRule objects (which count as rules added later) and there's no way - // to recall those. Better to prevent this for now. - throw new Error('Cannot add an "all traffic" egress rule in this way; set allowAllOutbound=true (for ipv6) or allowAllIpv6Outbound=true (for ipv6) on the SecurityGroup instead.'); - } - - this.addDirectEgressRule(rule); - } - - /** - * Add a direct ingress rule - */ - private addDirectIngressRule(rule: CfnSecurityGroup.IngressProperty) { - if (!this.hasIngressRule(rule)) { - this.directIngressRules.push(rule); - } - } - - /** - * Return whether the given ingress rule exists on the group - */ - private hasIngressRule(rule: CfnSecurityGroup.IngressProperty): boolean { - return this.directIngressRules.findIndex(r => ingressRulesEqual(r, rule)) > -1; - } - - /** - * Add a direct egress rule - */ - private addDirectEgressRule(rule: CfnSecurityGroup.EgressProperty) { - if (!this.hasEgressRule(rule)) { - this.directEgressRules.push(rule); - } - } - - /** - * Return whether the given egress rule exists on the group - */ - private hasEgressRule(rule: CfnSecurityGroup.EgressProperty): boolean { - return this.directEgressRules.findIndex(r => egressRulesEqual(r, rule)) > -1; - } - - /** - * Add the default egress rule to the securityGroup - * - * This depends on allowAllOutbound: - * - * - If allowAllOutbound is true, we *TECHNICALLY* don't need to do anything, because - * EC2 is going to create this default rule anyway. But, for maximum readability - * of the template, we will add one anyway. - * - If allowAllOutbound is false, we add a bogus rule that matches no traffic in - * order to get rid of the default "all outbound" rule that EC2 creates by default. - * If other rules happen to get added later, we remove the bogus rule again so - * that it doesn't clutter up the template too much (even though that's not - * strictly necessary). - */ - private addDefaultEgressRule() { - if (this.disableInlineRules) { - const peer = this.allowAllOutbound ? ALL_TRAFFIC_PEER : NO_TRAFFIC_PEER; - const port = this.allowAllOutbound ? ALL_TRAFFIC_PORT : NO_TRAFFIC_PORT; - const description = this.allowAllOutbound ? ALLOW_ALL_RULE.description : MATCH_NO_TRAFFIC.description; - super.addEgressRule(peer, port, description, false); - } else { - const rule = this.allowAllOutbound? ALLOW_ALL_RULE : MATCH_NO_TRAFFIC; - this.directEgressRules.push(rule); - } - } - - /** - * Add a allow all ipv6 egress rule to the securityGroup - * - * This depends on allowAllIpv6Outbound: - * - * - If allowAllIpv6Outbound is true, we will add an allow all rule. - * - If allowAllOutbound is false, we don't do anything since EC2 does not add - * a default allow all ipv6 rule. - */ - private addDefaultIpv6EgressRule() { - const description = 'Allow all outbound ipv6 traffic by default'; - const peer = Peer.anyIpv6(); - if (this.allowAllIpv6Outbound) { - if (this.disableInlineRules) { - super.addEgressRule(peer, Port.allTraffic(), description, false); - } else { - this.directEgressRules.push({ - ipProtocol: '-1', - cidrIpv6: peer.uniqueId, - description, - }); - } - } - } - - /** - * Remove the bogus rule if it exists - */ - private removeNoTrafficRule() { - if (this.disableInlineRules) { - const { scope, id } = this.determineRuleScope( - NO_TRAFFIC_PEER, - NO_TRAFFIC_PORT, - 'to', - false, - ); - scope.node.tryRemoveChild(id); - } else { - const i = this.directEgressRules.findIndex(r => egressRulesEqual(r, MATCH_NO_TRAFFIC)); - if (i > -1) { - this.directEgressRules.splice(i, 1); - } - } - } -} - -/** - * Egress rule that purposely matches no traffic - * - * This is used in order to disable the "all traffic" default of Security Groups. - * - * No machine can ever actually have the 255.255.255.255 IP address, but - * in order to lock it down even more we'll restrict to a nonexistent - * ICMP traffic type. - */ -const MATCH_NO_TRAFFIC = { - cidrIp: '255.255.255.255/32', - description: 'Disallow all traffic', - ipProtocol: 'icmp', - fromPort: 252, - toPort: 86, -}; - -const NO_TRAFFIC_PEER = Peer.ipv4(MATCH_NO_TRAFFIC.cidrIp); -const NO_TRAFFIC_PORT = Port.icmpTypeAndCode(MATCH_NO_TRAFFIC.fromPort, MATCH_NO_TRAFFIC.toPort); - -/** - * Egress rule that matches all traffic - */ -const ALLOW_ALL_RULE = { - cidrIp: '0.0.0.0/0', - description: 'Allow all outbound traffic by default', - ipProtocol: '-1', -}; - -const ALL_TRAFFIC_PEER = Peer.anyIpv4(); -const ALL_TRAFFIC_PORT = Port.allTraffic(); - -export interface ConnectionRule { - /** - * The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). - * Use -1 to specify all protocols. If you specify -1, or a protocol number - * other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is - * allowed, regardless of any ports you specify. For tcp, udp, and icmp, you - * must specify a port range. For protocol 58 (ICMPv6), you can optionally - * specify a port range; if you don't, traffic for all types and codes is - * allowed. - * - * @default tcp - */ - readonly protocol?: string; - - /** - * Start of port range for the TCP and UDP protocols, or an ICMP type number. - * - * If you specify icmp for the IpProtocol property, you can specify - * -1 as a wildcard (i.e., any ICMP type number). - */ - readonly fromPort: number; - - /** - * End of port range for the TCP and UDP protocols, or an ICMP code. - * - * If you specify icmp for the IpProtocol property, you can specify -1 as a - * wildcard (i.e., any ICMP code). - * - * @default If toPort is not specified, it will be the same as fromPort. - */ - readonly toPort?: number; - - /** - * Description of this connection. It is applied to both the ingress rule - * and the egress rule. - * - * @default No description - */ - readonly description?: string; -} - -/** - * Compare two ingress rules for equality the same way CloudFormation would (discarding description) - */ -function ingressRulesEqual(a: CfnSecurityGroup.IngressProperty, b: CfnSecurityGroup.IngressProperty) { - return a.cidrIp === b.cidrIp - && a.cidrIpv6 === b.cidrIpv6 - && a.fromPort === b.fromPort - && a.toPort === b.toPort - && a.ipProtocol === b.ipProtocol - && a.sourceSecurityGroupId === b.sourceSecurityGroupId - && a.sourceSecurityGroupName === b.sourceSecurityGroupName - && a.sourceSecurityGroupOwnerId === b.sourceSecurityGroupOwnerId; -} - -/** - * Compare two egress rules for equality the same way CloudFormation would (discarding description) - */ -function egressRulesEqual(a: CfnSecurityGroup.EgressProperty, b: CfnSecurityGroup.EgressProperty) { - return a.cidrIp === b.cidrIp - && a.cidrIpv6 === b.cidrIpv6 - && a.fromPort === b.fromPort - && a.toPort === b.toPort - && a.ipProtocol === b.ipProtocol - && a.destinationPrefixListId === b.destinationPrefixListId - && a.destinationSecurityGroupId === b.destinationSecurityGroupId; -} - -/** - * Whether this rule refers to all traffic - */ -function isAllTrafficRule(rule: any) { - return (rule.cidrIp === '0.0.0.0/0' || rule.cidrIpv6 === '::/0') && rule.ipProtocol === '-1'; -} - -/** - * Properties for looking up an existing SecurityGroup. - * - * Either `securityGroupName` or `securityGroupId` has to be specified. - */ -interface SecurityGroupLookupOptions { - /** - * The name of the security group - * - * If given, will import the SecurityGroup with this name. - * - * @default Don't filter on securityGroupName - */ - readonly securityGroupName?: string; - - /** - * The ID of the security group - * - * If given, will import the SecurityGroup with this ID. - * - * @default Don't filter on securityGroupId - */ - readonly securityGroupId?: string; - - /** - * The VPC of the security group - * - * If given, will filter the SecurityGroup based on the VPC. - * - * @default Don't filter on VPC - */ - readonly vpc?: IVpc, -} diff --git a/packages/@aws-cdk/aws-ec2/lib/user-data.ts b/packages/@aws-cdk/aws-ec2/lib/user-data.ts deleted file mode 100644 index ddb60fe2fe7ff..0000000000000 --- a/packages/@aws-cdk/aws-ec2/lib/user-data.ts +++ /dev/null @@ -1,594 +0,0 @@ -import { IBucket } from '@aws-cdk/aws-s3'; -import { Fn, Resource, Stack, CfnResource } from '@aws-cdk/core'; -import { OperatingSystemType } from './machine-image'; - -/** - * Options when constructing UserData for Linux - */ -export interface LinuxUserDataOptions { - /** - * Shebang for the UserData script - * - * @default "#!/bin/bash" - */ - readonly shebang?: string; -} - -/** - * Options when constructing UserData for Windows - */ -export interface WindowsUserDataOptions { - /** - * Set to true to set this userdata to persist through an instance reboot; allowing - * it to run on every instance start. - * By default, UserData is run only once during the first instance launch. - * - * For more information, see: - * https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/ - * https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts - * - * @default false - */ - readonly persist?: boolean; -} - -/** - * Options when downloading files from S3 - */ -export interface S3DownloadOptions { - - /** - * Name of the S3 bucket to download from - */ - readonly bucket: IBucket; - - /** - * The key of the file to download - */ - readonly bucketKey: string; - - /** - * The name of the local file. - * - * @default Linux - /tmp/bucketKey - * Windows - %TEMP%/bucketKey - */ - readonly localFile?: string; - - /** - * The region of the S3 Bucket (needed for access via VPC Gateway) - * @default none - */ - readonly region?: string - -} - -/** - * Options when executing a file. - */ -export interface ExecuteFileOptions { - - /** - * The path to the file. - */ - readonly filePath: string; - - /** - * The arguments to be passed to the file. - * - * @default No arguments are passed to the file. - */ - readonly arguments?: string; - -} - -/** - * Instance User Data - */ -export abstract class UserData { - /** - * Create a userdata object for Linux hosts - */ - public static forLinux(options: LinuxUserDataOptions = {}): UserData { - return new LinuxUserData(options); - } - - /** - * Create a userdata object for Windows hosts - */ - public static forWindows(options: WindowsUserDataOptions = {}): UserData { - return new WindowsUserData(options); - } - - /** - * Create a userdata object with custom content - */ - public static custom(content: string): UserData { - const userData = new CustomUserData(); - userData.addCommands(content); - return userData; - } - - public static forOperatingSystem(os: OperatingSystemType): UserData { - switch (os) { - case OperatingSystemType.LINUX: return UserData.forLinux(); - case OperatingSystemType.WINDOWS: return UserData.forWindows(); - case OperatingSystemType.UNKNOWN: throw new Error('Cannot determine UserData for unknown operating system type'); - } - } - - /** - * Add one or more commands to the user data - */ - public abstract addCommands(...commands: string[]): void; - - /** - * Add one or more commands to the user data that will run when the script exits. - */ - public abstract addOnExitCommands(...commands: string[]): void; - - /** - * Render the UserData for use in a construct - */ - public abstract render(): string; - - /** - * Adds commands to download a file from S3 - * - * @returns: The local path that the file will be downloaded to - */ - public abstract addS3DownloadCommand(params: S3DownloadOptions): string; - - /** - * Adds commands to execute a file - */ - public abstract addExecuteFileCommand( params: ExecuteFileOptions): void; - - /** - * Adds a command which will send a cfn-signal when the user data script ends - */ - public abstract addSignalOnExitCommand( resource: Resource ): void; - -} - -/** - * Linux Instance User Data - */ -class LinuxUserData extends UserData { - private readonly lines: string[] = []; - private readonly onExitLines: string[] = []; - - constructor(private readonly props: LinuxUserDataOptions = {}) { - super(); - } - - public addCommands(...commands: string[]) { - this.lines.push(...commands); - } - - public addOnExitCommands(...commands: string[]) { - this.onExitLines.push(...commands); - } - - public render(): string { - const shebang = this.props.shebang ?? '#!/bin/bash'; - return [shebang, ...(this.renderOnExitLines()), ...this.lines].join('\n'); - } - - public addS3DownloadCommand(params: S3DownloadOptions): string { - const s3Path = `s3://${params.bucket.bucketName}/${params.bucketKey}`; - const localPath = ( params.localFile && params.localFile.length !== 0 ) ? params.localFile : `/tmp/${ params.bucketKey }`; - this.addCommands( - `mkdir -p $(dirname '${localPath}')`, - `aws s3 cp '${s3Path}' '${localPath}'` + (params.region !== undefined ? ` --region ${params.region}` : ''), - ); - - return localPath; - } - - public addExecuteFileCommand( params: ExecuteFileOptions): void { - this.addCommands( - 'set -e', - `chmod +x '${params.filePath}'`, - `'${params.filePath}' ${params.arguments ?? ''}`.trim(), - ); - } - - public addSignalOnExitCommand( resource: Resource ): void { - const stack = Stack.of(resource); - const resourceID = (resource.node.defaultChild as CfnResource).logicalId; - this.addOnExitCommands(`/opt/aws/bin/cfn-signal --stack ${stack.stackName} --resource ${resourceID} --region ${stack.region} -e $exitCode || echo 'Failed to send Cloudformation Signal'`); - } - - private renderOnExitLines(): string[] { - if ( this.onExitLines.length > 0 ) { - return ['function exitTrap(){', 'exitCode=$?', ...this.onExitLines, '}', 'trap exitTrap EXIT']; - } - return []; - } -} - -/** - * Windows Instance User Data - */ -class WindowsUserData extends UserData { - private readonly lines: string[] = []; - private readonly onExitLines: string[] = []; - - constructor(private readonly props: WindowsUserDataOptions = {}) { - super(); - } - - public addCommands(...commands: string[]) { - this.lines.push(...commands); - } - - public addOnExitCommands(...commands: string[]) { - this.onExitLines.push(...commands); - } - - public render(): string { - return `${ - [...(this.renderOnExitLines()), - ...this.lines, - ...( this.onExitLines.length > 0 ? ['throw "Success"'] : [] )].join('\n') - }${(this.props.persist ?? false) ? 'true' : ''}`; - } - - public addS3DownloadCommand(params: S3DownloadOptions): string { - const localPath = ( params.localFile && params.localFile.length !== 0 ) ? params.localFile : `C:/temp/${ params.bucketKey }`; - this.addCommands( - `mkdir (Split-Path -Path '${localPath}' ) -ea 0`, - `Read-S3Object -BucketName '${params.bucket.bucketName}' -key '${params.bucketKey}' -file '${localPath}' -ErrorAction Stop` + (params.region !== undefined ? ` -Region ${params.region}` : ''), - ); - return localPath; - } - - public addExecuteFileCommand( params: ExecuteFileOptions): void { - this.addCommands( - `&'${params.filePath}' ${params.arguments ?? ''}`.trim(), - `if (!$?) { Write-Error 'Failed to execute the file "${params.filePath}"' -ErrorAction Stop }`, - ); - } - - public addSignalOnExitCommand( resource: Resource ): void { - const stack = Stack.of(resource); - const resourceID = (resource.node.defaultChild as CfnResource).logicalId; - - this.addOnExitCommands(`cfn-signal --stack ${stack.stackName} --resource ${resourceID} --region ${stack.region} --success ($success.ToString().ToLower())`); - } - - private renderOnExitLines(): string[] { - if ( this.onExitLines.length > 0 ) { - return ['trap {', '$success=($PSItem.Exception.Message -eq "Success")', ...this.onExitLines, 'break', '}']; - } - return []; - } -} - -/** - * Custom Instance User Data - */ -class CustomUserData extends UserData { - private readonly lines: string[] = []; - - constructor() { - super(); - } - - public addCommands(...commands: string[]) { - this.lines.push(...commands); - } - - public addOnExitCommands(): void { - throw new Error('CustomUserData does not support addOnExitCommands, use UserData.forLinux() or UserData.forWindows() instead.'); - } - - public render(): string { - return this.lines.join('\n'); - } - - public addS3DownloadCommand(): string { - throw new Error('CustomUserData does not support addS3DownloadCommand, use UserData.forLinux() or UserData.forWindows() instead.'); - } - - public addExecuteFileCommand(): void { - throw new Error('CustomUserData does not support addExecuteFileCommand, use UserData.forLinux() or UserData.forWindows() instead.'); - } - - public addSignalOnExitCommand(): void { - throw new Error('CustomUserData does not support addSignalOnExitCommand, use UserData.forLinux() or UserData.forWindows() instead.'); - } -} - -/** - * Options when creating `MultipartBody`. - */ -export interface MultipartBodyOptions { - - /** - * `Content-Type` header of this part. - * - * Some examples of content types: - * * `text/x-shellscript; charset="utf-8"` (shell script) - * * `text/cloud-boothook; charset="utf-8"` (shell script executed during boot phase) - * - * For Linux shell scripts use `text/x-shellscript`. - */ - readonly contentType: string; - - /** - * `Content-Transfer-Encoding` header specifying part encoding. - * - * @default undefined - body is not encoded - */ - readonly transferEncoding?: string; - - /** - * The body of message. - * - * @default undefined - body will not be added to part - */ - readonly body?: string, -} - -/** - * The base class for all classes which can be used as `MultipartUserData`. - */ -export abstract class MultipartBody { - /** - * Content type for shell scripts - */ - public static readonly SHELL_SCRIPT = 'text/x-shellscript; charset="utf-8"'; - - /** - * Content type for boot hooks - */ - public static readonly CLOUD_BOOTHOOK = 'text/cloud-boothook; charset="utf-8"'; - - /** - * Constructs the new `MultipartBody` wrapping existing `UserData`. Modification to `UserData` are reflected - * in subsequent renders of the part. - * - * For more information about content types see `MultipartBodyOptions.contentType`. - * - * @param userData user data to wrap into body part - * @param contentType optional content type, if default one should not be used - */ - public static fromUserData(userData: UserData, contentType?: string): MultipartBody { - return new MultipartBodyUserDataWrapper(userData, contentType); - } - - /** - * Constructs the raw `MultipartBody` using specified body, content type and transfer encoding. - * - * When transfer encoding is specified (typically as Base64), it's caller responsibility to convert body to - * Base64 either by wrapping with `Fn.base64` or by converting it by other converters. - */ - public static fromRawBody(opts: MultipartBodyOptions): MultipartBody { - return new MultipartBodyRaw(opts); - } - - public constructor() { - } - - /** - * Render body part as the string. - * - * Subclasses should not add leading nor trailing new line characters (\r \n) - */ - public abstract renderBodyPart(): string[]; -} - -/** - * The raw part of multi-part user data, which can be added to `MultipartUserData`. - */ -class MultipartBodyRaw extends MultipartBody { - public constructor(private readonly props: MultipartBodyOptions) { - super(); - } - - /** - * Render body part as the string. - */ - public renderBodyPart(): string[] { - const result: string[] = []; - - result.push(`Content-Type: ${this.props.contentType}`); - - if (this.props.transferEncoding != null) { - result.push(`Content-Transfer-Encoding: ${this.props.transferEncoding}`); - } - // One line free after separator - result.push(''); - - if (this.props.body != null) { - result.push(this.props.body); - // The new line added after join will be consumed by encapsulating or closing boundary - } - - return result; - } -} - -/** - * Wrapper for `UserData`. - */ -class MultipartBodyUserDataWrapper extends MultipartBody { - private readonly contentType: string; - - public constructor(private readonly userData: UserData, contentType?: string) { - super(); - - this.contentType = contentType || MultipartBody.SHELL_SCRIPT; - } - - /** - * Render body part as the string. - */ - public renderBodyPart(): string[] { - const result: string[] = []; - - result.push(`Content-Type: ${this.contentType}`); - result.push('Content-Transfer-Encoding: base64'); - result.push(''); - result.push(Fn.base64(this.userData.render())); - - return result; - } -} - -/** - * Options for creating `MultipartUserData` - */ -export interface MultipartUserDataOptions { - /** - * The string used to separate parts in multipart user data archive (it's like MIME boundary). - * - * This string should contain [a-zA-Z0-9()+,-./:=?] characters only, and should not be present in any part, or in text content of archive. - * - * @default `+AWS+CDK+User+Data+Separator==` - */ - readonly partsSeparator?: string; -} - -/** - * Mime multipart user data. - * - * This class represents MIME multipart user data, as described in. - * [Specifying Multiple User Data Blocks Using a MIME Multi Part Archive](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bootstrap_container_instance.html#multi-part_user_data) - * - */ -export class MultipartUserData extends UserData { - private static readonly USE_PART_ERROR = 'MultipartUserData only supports this operation if it has a default UserData. Call addUserDataPart with makeDefault=true.'; - private static readonly BOUNDRY_PATTERN = '[^a-zA-Z0-9()+,-./:=?]'; - - private parts: MultipartBody[] = []; - - private opts: MultipartUserDataOptions; - - private defaultUserData?: UserData; - - constructor(opts?: MultipartUserDataOptions) { - super(); - - let partsSeparator: string; - - // Validate separator - if (opts?.partsSeparator != null) { - if (new RegExp(MultipartUserData.BOUNDRY_PATTERN).test(opts!.partsSeparator)) { - throw new Error(`Invalid characters in separator. Separator has to match pattern ${MultipartUserData.BOUNDRY_PATTERN}`); - } else { - partsSeparator = opts!.partsSeparator; - } - } else { - partsSeparator = '+AWS+CDK+User+Data+Separator=='; - } - - this.opts = { - partsSeparator: partsSeparator, - }; - } - - /** - * Adds a part to the list of parts. - */ - public addPart(part: MultipartBody) { - this.parts.push(part); - } - - /** - * Adds a multipart part based on a UserData object. - * - * If `makeDefault` is true, then the UserData added by this method - * will also be the target of calls to the `add*Command` methods on - * this MultipartUserData object. - * - * If `makeDefault` is false, then this is the same as calling: - * - * ```ts - * declare const multiPart: ec2.MultipartUserData; - * declare const userData: ec2.UserData; - * declare const contentType: string; - * - * multiPart.addPart(ec2.MultipartBody.fromUserData(userData, contentType)); - * ``` - * - * An undefined `makeDefault` defaults to either: - * - `true` if no default UserData has been set yet; or - * - `false` if there is no default UserData set. - */ - public addUserDataPart(userData: UserData, contentType?: string, makeDefault?: boolean) { - this.addPart(MultipartBody.fromUserData(userData, contentType)); - makeDefault = makeDefault ?? (this.defaultUserData === undefined ? true : false); - if (makeDefault) { - this.defaultUserData = userData; - } - } - - public render(): string { - const boundary = this.opts.partsSeparator; - // Now build final MIME archive - there are few changes from MIME message which are accepted by cloud-init: - // - MIME RFC uses CRLF to separate lines - cloud-init is fine with LF \n only - // Note: new lines matters, matters a lot. - var resultArchive = new Array(); - resultArchive.push(`Content-Type: multipart/mixed; boundary="${boundary}"`); - resultArchive.push('MIME-Version: 1.0'); - - // Add new line, the next one will be boundary (encapsulating or closing) - // so this line will count into it. - resultArchive.push(''); - - // Add parts - each part starts with boundary - this.parts.forEach(part => { - resultArchive.push(`--${boundary}`); - resultArchive.push(...part.renderBodyPart()); - }); - - // Add closing boundary - resultArchive.push(`--${boundary}--`); - resultArchive.push(''); // Force new line at the end - - return resultArchive.join('\n'); - } - - public addS3DownloadCommand(params: S3DownloadOptions): string { - if (this.defaultUserData) { - return this.defaultUserData.addS3DownloadCommand(params); - } else { - throw new Error(MultipartUserData.USE_PART_ERROR); - } - } - - public addExecuteFileCommand(params: ExecuteFileOptions): void { - if (this.defaultUserData) { - this.defaultUserData.addExecuteFileCommand(params); - } else { - throw new Error(MultipartUserData.USE_PART_ERROR); - } - } - - public addSignalOnExitCommand(resource: Resource): void { - if (this.defaultUserData) { - this.defaultUserData.addSignalOnExitCommand(resource); - } else { - throw new Error(MultipartUserData.USE_PART_ERROR); - } - } - - public addCommands(...commands: string[]): void { - if (this.defaultUserData) { - this.defaultUserData.addCommands(...commands); - } else { - throw new Error(MultipartUserData.USE_PART_ERROR); - } - } - - public addOnExitCommands(...commands: string[]): void { - if (this.defaultUserData) { - this.defaultUserData.addOnExitCommands(...commands); - } else { - throw new Error(MultipartUserData.USE_PART_ERROR); - } - } -} diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts deleted file mode 100644 index a0125a8f17800..0000000000000 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ /dev/null @@ -1,2430 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { - Arn, Annotations, ContextProvider, - IResource, Lazy, Resource, Stack, Token, Tags, Names, -} from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct, Dependable, DependencyGroup, IConstruct, IDependable, Node } from 'constructs'; -import { ClientVpnEndpoint, ClientVpnEndpointOptions } from './client-vpn-endpoint'; -import { - CfnEIP, CfnInternetGateway, CfnNatGateway, CfnRoute, CfnRouteTable, CfnSubnet, - CfnSubnetRouteTableAssociation, CfnVPC, CfnVPCGatewayAttachment, CfnVPNGatewayRoutePropagation, -} from './ec2.generated'; -import { AllocatedSubnet, IIpAddresses, RequestedSubnet, IpAddresses } from './ip-addresses'; -import { NatProvider } from './nat'; -import { INetworkAcl, NetworkAcl, SubnetNetworkAclAssociation } from './network-acl'; -import { SubnetFilter } from './subnet'; -import { allRouteTableIds, defaultSubnetName, flatten, ImportSubnetGroup, subnetGroupNameFromConstructId, subnetId } from './util'; -import { GatewayVpcEndpoint, GatewayVpcEndpointAwsService, GatewayVpcEndpointOptions, InterfaceVpcEndpoint, InterfaceVpcEndpointOptions } from './vpc-endpoint'; -import { FlowLog, FlowLogOptions, FlowLogResourceType } from './vpc-flow-logs'; -import { VpcLookupOptions } from './vpc-lookup'; -import { EnableVpnGatewayOptions, VpnConnection, VpnConnectionOptions, VpnConnectionType, VpnGateway } from './vpn'; - -const VPC_SUBNET_SYMBOL = Symbol.for('@aws-cdk/aws-ec2.VpcSubnet'); -const FAKE_AZ_NAME = 'fake-az'; - -export interface ISubnet extends IResource { - /** - * The Availability Zone the subnet is located in - */ - readonly availabilityZone: string; - - /** - * The subnetId for this particular subnet - * @attribute - */ - readonly subnetId: string; - - /** - * Dependable that can be depended upon to force internet connectivity established on the VPC - */ - readonly internetConnectivityEstablished: IDependable; - - /** - * The IPv4 CIDR block for this subnet - */ - readonly ipv4CidrBlock: string; - - /** - * The route table for this subnet - */ - readonly routeTable: IRouteTable; - - /** - * Associate a Network ACL with this subnet - * - * @param acl The Network ACL to associate - */ - associateNetworkAcl(id: string, acl: INetworkAcl): void; -} - -/** - * An abstract route table - */ -export interface IRouteTable { - /** - * Route table ID - */ - readonly routeTableId: string; -} - -export interface IVpc extends IResource { - /** - * Identifier for this VPC - * @attribute - */ - readonly vpcId: string; - - /** - * ARN for this VPC - * @attribute - */ - readonly vpcArn: string; - - /** - * CIDR range for this VPC - * - * @attribute - */ - readonly vpcCidrBlock: string; - - /** - * List of public subnets in this VPC - */ - readonly publicSubnets: ISubnet[]; - - /** - * List of private subnets in this VPC - */ - readonly privateSubnets: ISubnet[]; - - /** - * List of isolated subnets in this VPC - */ - readonly isolatedSubnets: ISubnet[]; - - /** - * AZs for this VPC - */ - readonly availabilityZones: string[]; - - /** - * Identifier for the VPN gateway - */ - readonly vpnGatewayId?: string; - - /** - * Dependable that can be depended upon to force internet connectivity established on the VPC - */ - readonly internetConnectivityEstablished: IDependable; - - /** - * Return information on the subnets appropriate for the given selection strategy - * - * Requires that at least one subnet is matched, throws a descriptive - * error message otherwise. - */ - selectSubnets(selection?: SubnetSelection): SelectedSubnets; - - /** - * Adds a VPN Gateway to this VPC - */ - enableVpnGateway(options: EnableVpnGatewayOptions): void; - - /** - * Adds a new VPN connection to this VPC - */ - addVpnConnection(id: string, options: VpnConnectionOptions): VpnConnection; - - /** - * Adds a new client VPN endpoint to this VPC - */ - addClientVpnEndpoint(id: string, options: ClientVpnEndpointOptions): ClientVpnEndpoint; - - /** - * Adds a new gateway endpoint to this VPC - */ - addGatewayEndpoint(id: string, options: GatewayVpcEndpointOptions): GatewayVpcEndpoint - - /** - * Adds a new interface endpoint to this VPC - */ - addInterfaceEndpoint(id: string, options: InterfaceVpcEndpointOptions): InterfaceVpcEndpoint - - /** - * Adds a new Flow Log to this VPC - */ - addFlowLog(id: string, options?: FlowLogOptions): FlowLog -} - -/** - * The type of Subnet - */ -export enum SubnetType { - /** - * Isolated Subnets do not route traffic to the Internet (in this VPC), - * and as such, do not require NAT gateways. - * - * Isolated subnets can only connect to or be connected to from other - * instances in the same VPC. A default VPC configuration will not include - * isolated subnets. - * - * This can be good for subnets with RDS or Elasticache instances, - * or which route Internet traffic through a peer VPC. - */ - PRIVATE_ISOLATED = 'Isolated', - - /** - * Isolated Subnets do not route traffic to the Internet (in this VPC), - * and as such, do not require NAT gateways. - * - * Isolated subnets can only connect to or be connected to from other - * instances in the same VPC. A default VPC configuration will not include - * isolated subnets. - * - * This can be good for subnets with RDS or Elasticache instances, - * or which route Internet traffic through a peer VPC. - * - * @deprecated use `SubnetType.PRIVATE_ISOLATED` - */ - ISOLATED = 'Deprecated_Isolated', - - /** - * Subnet that routes to the internet, but not vice versa. - * - * Instances in a private subnet can connect to the Internet, but will not - * allow connections to be initiated from the Internet. Egress to the internet will - * need to be provided. - * NAT Gateway(s) are the default solution to providing this subnet type the ability to route Internet traffic. - * If a NAT Gateway is not required or desired, set `natGateways:0` or use - * `SubnetType.PRIVATE_ISOLATED` instead. - * - * By default, a NAT gateway is created in every public subnet for maximum availability. - * Be aware that you will be charged for NAT gateways. - * - * Normally a Private subnet will use a NAT gateway in the same AZ, but - * if `natGateways` is used to reduce the number of NAT gateways, a NAT - * gateway from another AZ will be used instead. - */ - PRIVATE_WITH_EGRESS = 'Private', - - /** - * Subnet that routes to the internet (via a NAT gateway), but not vice versa. - * - * Instances in a private subnet can connect to the Internet, but will not - * allow connections to be initiated from the Internet. NAT Gateway(s) are - * required with this subnet type to route the Internet traffic through. - * If a NAT Gateway is not required or desired, use `SubnetType.PRIVATE_ISOLATED` instead. - * - * By default, a NAT gateway is created in every public subnet for maximum availability. - * Be aware that you will be charged for NAT gateways. - * - * Normally a Private subnet will use a NAT gateway in the same AZ, but - * if `natGateways` is used to reduce the number of NAT gateways, a NAT - * gateway from another AZ will be used instead. - * @deprecated use `PRIVATE_WITH_EGRESS` - */ - PRIVATE_WITH_NAT = 'Deprecated_Private_NAT', - - /** - * Subnet that routes to the internet, but not vice versa. - * - * Instances in a private subnet can connect to the Internet, but will not - * allow connections to be initiated from the Internet. NAT Gateway(s) are - * required with this subnet type to route the Internet traffic through. - * If a NAT Gateway is not required or desired, use `SubnetType.PRIVATE_ISOLATED` instead. - * - * By default, a NAT gateway is created in every public subnet for maximum availability. - * Be aware that you will be charged for NAT gateways. - * - * Normally a Private subnet will use a NAT gateway in the same AZ, but - * if `natGateways` is used to reduce the number of NAT gateways, a NAT - * gateway from another AZ will be used instead. - * - * @deprecated use `PRIVATE_WITH_EGRESS` - */ - PRIVATE = 'Deprecated_Private', - - /** - * Subnet connected to the Internet - * - * Instances in a Public subnet can connect to the Internet and can be - * connected to from the Internet as long as they are launched with public - * IPs (controlled on the AutoScalingGroup or other constructs that launch - * instances). - * - * Public subnets route outbound traffic via an Internet Gateway. - */ - PUBLIC = 'Public' -} - -/** - * Customize subnets that are selected for placement of ENIs - * - * Constructs that allow customization of VPC placement use parameters of this - * type to provide placement settings. - * - * By default, the instances are placed in the private subnets. - */ -export interface SubnetSelection { - /** - * Select all subnets of the given type - * - * At most one of `subnetType` and `subnetGroupName` can be supplied. - * - * @default SubnetType.PRIVATE_WITH_EGRESS (or ISOLATED or PUBLIC if there are no PRIVATE_WITH_EGRESS subnets) - */ - readonly subnetType?: SubnetType; - - /** - * Select subnets only in the given AZs. - * - * @default no filtering on AZs is done - */ - readonly availabilityZones?: string[]; - - /** - * Select the subnet group with the given name - * - * Select the subnet group with the given name. This only needs - * to be used if you have multiple subnet groups of the same type - * and you need to distinguish between them. Otherwise, prefer - * `subnetType`. - * - * This field does not select individual subnets, it selects all subnets that - * share the given subnet group name. This is the name supplied in - * `subnetConfiguration`. - * - * At most one of `subnetType` and `subnetGroupName` can be supplied. - * - * @default - Selection by type instead of by name - */ - readonly subnetGroupName?: string; - - /** - * Alias for `subnetGroupName` - * - * Select the subnet group with the given name. This only needs - * to be used if you have multiple subnet groups of the same type - * and you need to distinguish between them. - * - * @deprecated Use `subnetGroupName` instead - */ - readonly subnetName?: string; - - /** - * If true, return at most one subnet per AZ - * - * @default false - */ - readonly onePerAz?: boolean; - - /** - * List of provided subnet filters. - * - * @default - none - */ - readonly subnetFilters?: SubnetFilter[]; - - /** - * Explicitly select individual subnets - * - * Use this if you don't want to automatically use all subnets in - * a group, but have a need to control selection down to - * individual subnets. - * - * Cannot be specified together with `subnetType` or `subnetGroupName`. - * - * @default - Use all subnets in a selected group (all private subnets by default) - */ - readonly subnets?: ISubnet[] -} - -/** - * Result of selecting a subset of subnets from a VPC - */ -export interface SelectedSubnets { - /** - * The subnet IDs - */ - readonly subnetIds: string[]; - - /** - * The respective AZs of each subnet - */ - readonly availabilityZones: string[]; - - /** - * Dependency representing internet connectivity for these subnets - */ - readonly internetConnectivityEstablished: IDependable; - - /** - * Selected subnet objects - */ - readonly subnets: ISubnet[]; - - /** - * Whether any of the given subnets are from the VPC's public subnets. - */ - readonly hasPublic: boolean; - - /** - * The subnet selection is not actually real yet - * - * If this value is true, don't validate anything about the subnets. The count - * or identities are not known yet, and the validation will most likely fail - * which will prevent a successful lookup. - * - * @default false - */ - readonly isPendingLookup?: boolean; -} - -/** - * A new or imported VPC - */ -abstract class VpcBase extends Resource implements IVpc { - - /** - * Identifier for this VPC - */ - public abstract readonly vpcId: string; - - /** - * Arn of this VPC - */ - public abstract readonly vpcArn: string; - - /** - * CIDR range for this VPC - */ - public abstract readonly vpcCidrBlock: string; - - /** - * List of public subnets in this VPC - */ - public abstract readonly publicSubnets: ISubnet[]; - - /** - * List of private subnets in this VPC - */ - public abstract readonly privateSubnets: ISubnet[]; - - /** - * List of isolated subnets in this VPC - */ - public abstract readonly isolatedSubnets: ISubnet[]; - - /** - * AZs for this VPC - */ - public abstract readonly availabilityZones: string[]; - - /** - * Dependencies for internet connectivity - */ - public abstract readonly internetConnectivityEstablished: IDependable; - - /** - * Dependencies for NAT connectivity - * - * @deprecated - This value is no longer used. - */ - protected readonly natDependencies = new Array(); - - /** - * If this is set to true, don't error out on trying to select subnets - */ - protected incompleteSubnetDefinition: boolean = false; - - /** - * Mutable private field for the vpnGatewayId - * - * @internal - */ - protected _vpnGatewayId?: string; - - /** - * Returns IDs of selected subnets - */ - public selectSubnets(selection: SubnetSelection = {}): SelectedSubnets { - const subnets = this.selectSubnetObjects(selection); - const pubs = new Set(this.publicSubnets); - - return { - subnetIds: subnets.map(s => s.subnetId), - get availabilityZones(): string[] { return subnets.map(s => s.availabilityZone); }, - internetConnectivityEstablished: tap(new CompositeDependable(), d => subnets.forEach(s => d.add(s.internetConnectivityEstablished))), - subnets, - hasPublic: subnets.some(s => pubs.has(s)), - isPendingLookup: this.incompleteSubnetDefinition, - }; - } - - /** - * Adds a VPN Gateway to this VPC - */ - public enableVpnGateway(options: EnableVpnGatewayOptions): void { - if (this.vpnGatewayId) { - throw new Error('The VPN Gateway has already been enabled.'); - } - - const vpnGateway = new VpnGateway(this, 'VpnGateway', { - amazonSideAsn: options.amazonSideAsn, - type: VpnConnectionType.IPSEC_1, - }); - - this._vpnGatewayId = vpnGateway.gatewayId; - - const attachment = new CfnVPCGatewayAttachment(this, 'VPCVPNGW', { - vpcId: this.vpcId, - vpnGatewayId: this._vpnGatewayId, - }); - - // Propagate routes on route tables associated with the right subnets - const vpnRoutePropagation = options.vpnRoutePropagation ?? [{}]; - const routeTableIds = allRouteTableIds(flatten(vpnRoutePropagation.map(s => this.selectSubnets(s).subnets))); - - if (routeTableIds.length === 0) { - Annotations.of(this).addError(`enableVpnGateway: no subnets matching selection: '${JSON.stringify(vpnRoutePropagation)}'. Select other subnets to add routes to.`); - } - - const routePropagation = new CfnVPNGatewayRoutePropagation(this, 'RoutePropagation', { - routeTableIds, - vpnGatewayId: this._vpnGatewayId, - }); - // The AWS::EC2::VPNGatewayRoutePropagation resource cannot use the VPN gateway - // until it has successfully attached to the VPC. - // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html - routePropagation.node.addDependency(attachment); - } - - /** - * Adds a new VPN connection to this VPC - */ - public addVpnConnection(id: string, options: VpnConnectionOptions): VpnConnection { - return new VpnConnection(this, id, { - vpc: this, - ...options, - }); - } - - /** - * Adds a new client VPN endpoint to this VPC - */ - public addClientVpnEndpoint(id: string, options: ClientVpnEndpointOptions): ClientVpnEndpoint { - return new ClientVpnEndpoint(this, id, { - ...options, - vpc: this, - }); - } - - /** - * Adds a new interface endpoint to this VPC - */ - public addInterfaceEndpoint(id: string, options: InterfaceVpcEndpointOptions): InterfaceVpcEndpoint { - return new InterfaceVpcEndpoint(this, id, { - vpc: this, - ...options, - }); - } - - /** - * Adds a new gateway endpoint to this VPC - */ - public addGatewayEndpoint(id: string, options: GatewayVpcEndpointOptions): GatewayVpcEndpoint { - return new GatewayVpcEndpoint(this, id, { - vpc: this, - ...options, - }); - } - - /** - * Adds a new flow log to this VPC - */ - public addFlowLog(id: string, options?: FlowLogOptions): FlowLog { - return new FlowLog(this, id, { - resourceType: FlowLogResourceType.fromVpc(this), - ...options, - }); - } - - /** - * Returns the id of the VPN Gateway (if enabled) - */ - public get vpnGatewayId(): string | undefined { - return this._vpnGatewayId; - } - - /** - * Return the subnets appropriate for the placement strategy - */ - protected selectSubnetObjects(selection: SubnetSelection = {}): ISubnet[] { - selection = this.reifySelectionDefaults(selection); - - if (selection.subnets !== undefined) { - return selection.subnets; - } - - let subnets; - - if (selection.subnetGroupName !== undefined) { // Select by name - subnets = this.selectSubnetObjectsByName(selection.subnetGroupName); - - } else { // Or specify by type - const type = selection.subnetType || SubnetType.PRIVATE_WITH_EGRESS; - subnets = this.selectSubnetObjectsByType(type); - } - - // Apply all the filters - subnets = this.applySubnetFilters(subnets, selection.subnetFilters ?? []); - - return subnets; - } - - private applySubnetFilters(subnets: ISubnet[], filters: SubnetFilter[]): ISubnet[] { - let filtered = subnets; - // Apply each filter in sequence - for (const filter of filters) { - filtered = filter.selectSubnets(filtered); - } - return filtered; - } - - private selectSubnetObjectsByName(groupName: string) { - const allSubnets = [...this.publicSubnets, ...this.privateSubnets, ...this.isolatedSubnets]; - const subnets = allSubnets.filter(s => subnetGroupNameFromConstructId(s) === groupName); - - if (subnets.length === 0 && !this.incompleteSubnetDefinition) { - const names = Array.from(new Set(allSubnets.map(subnetGroupNameFromConstructId))); - throw new Error(`There are no subnet groups with name '${groupName}' in this VPC. Available names: ${names}`); - } - - return subnets; - } - - private selectSubnetObjectsByType(subnetType: SubnetType) { - const allSubnets = { - [SubnetType.PRIVATE_ISOLATED]: this.isolatedSubnets, - [SubnetType.ISOLATED]: this.isolatedSubnets, - [SubnetType.PRIVATE_WITH_NAT]: this.privateSubnets, - [SubnetType.PRIVATE_WITH_EGRESS]: this.privateSubnets, - [SubnetType.PRIVATE]: this.privateSubnets, - [SubnetType.PUBLIC]: this.publicSubnets, - }; - - const subnets = allSubnets[subnetType]; - - // Force merge conflict here with https://github.com/aws/aws-cdk/pull/4089 - // see ImportedVpc - - if (subnets.length === 0 && !this.incompleteSubnetDefinition) { - const availableTypes = Object.entries(allSubnets).filter(([_, subs]) => subs.length > 0).map(([typeName, _]) => typeName); - throw new Error(`There are no '${subnetType}' subnet groups in this VPC. Available types: ${availableTypes}`); - } - - return subnets; - } - - /** - * Validate the fields in a SubnetSelection object, and reify defaults if necessary - * - * In case of default selection, select the first type of PRIVATE, ISOLATED, - * PUBLIC (in that order) that has any subnets. - */ - private reifySelectionDefaults(placement: SubnetSelection): SubnetSelection { - - if (placement.subnetName !== undefined) { - if (placement.subnetGroupName !== undefined) { - throw new Error('Please use only \'subnetGroupName\' (\'subnetName\' is deprecated and has the same behavior)'); - } else { - Annotations.of(this).addWarning('Usage of \'subnetName\' in SubnetSelection is deprecated, use \'subnetGroupName\' instead'); - } - placement = { ...placement, subnetGroupName: placement.subnetName }; - } - - const exclusiveSelections: Array = ['subnets', 'subnetType', 'subnetGroupName']; - const providedSelections = exclusiveSelections.filter(key => placement[key] !== undefined); - if (providedSelections.length > 1) { - throw new Error(`Only one of '${providedSelections}' can be supplied to subnet selection.`); - } - - if (placement.subnetType === undefined && placement.subnetGroupName === undefined && placement.subnets === undefined) { - // Return default subnet type based on subnets that actually exist - let subnetType = this.privateSubnets.length - ? SubnetType.PRIVATE_WITH_EGRESS : this.isolatedSubnets.length ? SubnetType.PRIVATE_ISOLATED : SubnetType.PUBLIC; - placement = { ...placement, subnetType: subnetType }; - } - - // Establish which subnet filters are going to be used - let subnetFilters = placement.subnetFilters ?? []; - - // Backwards compatibility with existing `availabilityZones` and `onePerAz` functionality - if (placement.availabilityZones !== undefined) { // Filter by AZs, if specified - subnetFilters.push(SubnetFilter.availabilityZones(placement.availabilityZones)); - } - if (!!placement.onePerAz) { // Ensure one per AZ if specified - subnetFilters.push(SubnetFilter.onePerAz()); - } - - // Overwrite the provided placement filters and remove the availabilityZones and onePerAz properties - placement = { ...placement, subnetFilters: subnetFilters, availabilityZones: undefined, onePerAz: undefined }; - const { availabilityZones, onePerAz, ...rest } = placement; - - return rest; - } -} - -/** - * Properties that reference an external Vpc - */ -export interface VpcAttributes { - /** - * VPC's identifier - */ - readonly vpcId: string; - - /** - * VPC's CIDR range - * - * @default - Retrieving the CIDR from the VPC will fail - */ - readonly vpcCidrBlock?: string; - - /** - * List of availability zones for the subnets in this VPC. - */ - readonly availabilityZones: string[]; - - /** - * List of public subnet IDs - * - * Must be undefined or match the availability zones in length and order. - * - * @default - The VPC does not have any public subnets - */ - readonly publicSubnetIds?: string[]; - - /** - * List of names for the public subnets - * - * Must be undefined or have a name for every public subnet group. - * - * @default - All public subnets will have the name `Public` - */ - readonly publicSubnetNames?: string[]; - - /** - * List of IDs of route tables for the public subnets. - * - * Must be undefined or have a name for every public subnet group. - * - * @default - Retrieving the route table ID of any public subnet will fail - */ - readonly publicSubnetRouteTableIds?: string[]; - - /** - * List of IPv4 CIDR blocks for the public subnets. - * - * Must be undefined or have an entry for every public subnet group. - * - * @default - Retrieving the IPv4 CIDR block of any public subnet will fail - */ - readonly publicSubnetIpv4CidrBlocks?: string[]; - - /** - * List of private subnet IDs - * - * Must be undefined or match the availability zones in length and order. - * - * @default - The VPC does not have any private subnets - */ - readonly privateSubnetIds?: string[]; - - /** - * List of names for the private subnets - * - * Must be undefined or have a name for every private subnet group. - * - * @default - All private subnets will have the name `Private` - */ - readonly privateSubnetNames?: string[]; - - /** - * List of IDs of route tables for the private subnets. - * - * Must be undefined or have a name for every private subnet group. - * - * @default - Retrieving the route table ID of any private subnet will fail - */ - readonly privateSubnetRouteTableIds?: string[]; - - /** - * List of IPv4 CIDR blocks for the private subnets. - * - * Must be undefined or have an entry for every private subnet group. - * - * @default - Retrieving the IPv4 CIDR block of any private subnet will fail - */ - readonly privateSubnetIpv4CidrBlocks?: string[]; - - /** - * List of isolated subnet IDs - * - * Must be undefined or match the availability zones in length and order. - * - * @default - The VPC does not have any isolated subnets - */ - readonly isolatedSubnetIds?: string[]; - - /** - * List of names for the isolated subnets - * - * Must be undefined or have a name for every isolated subnet group. - * - * @default - All isolated subnets will have the name `Isolated` - */ - readonly isolatedSubnetNames?: string[]; - - /** - * List of IDs of route tables for the isolated subnets. - * - * Must be undefined or have a name for every isolated subnet group. - * - * @default - Retrieving the route table ID of any isolated subnet will fail - */ - readonly isolatedSubnetRouteTableIds?: string[]; - - /** - * List of IPv4 CIDR blocks for the isolated subnets. - * - * Must be undefined or have an entry for every isolated subnet group. - * - * @default - Retrieving the IPv4 CIDR block of any isolated subnet will fail - */ - readonly isolatedSubnetIpv4CidrBlocks?: string[]; - - /** - * VPN gateway's identifier - */ - readonly vpnGatewayId?: string; - - /** - * The region the VPC is in - * - * @default - The region of the stack where the VPC belongs to - */ - readonly region?: string; -} - -export interface SubnetAttributes { - - /** - * The Availability Zone the subnet is located in - * - * @default - No AZ information, cannot use AZ selection features - */ - readonly availabilityZone?: string; - - /** - * The IPv4 CIDR block associated with the subnet - * - * @default - No CIDR information, cannot use CIDR filter features - */ - readonly ipv4CidrBlock?: string; - - /** - * The ID of the route table for this particular subnet - * - * @default - No route table information, cannot create VPC endpoints - */ - readonly routeTableId?: string; - - /** - * The subnetId for this particular subnet - */ - readonly subnetId: string; -} - -/** - * Name tag constant - */ -const NAME_TAG: string = 'Name'; - -/** - * Configuration for Vpc - */ -export interface VpcProps { - - /** - * The Provider to use to allocate IP Space to your VPC. - * - * Options include static allocation or from a pool. - * - * @default ec2.IpAddresses.cidr - */ - readonly ipAddresses?: IIpAddresses; - - /** - * The CIDR range to use for the VPC, e.g. '10.0.0.0/16'. - * - * Should be a minimum of /28 and maximum size of /16. The range will be - * split across all subnets per Availability Zone. - * - * @default Vpc.DEFAULT_CIDR_RANGE - * - * @deprecated Use ipAddresses instead - */ - readonly cidr?: string; - - /** - * Indicates whether the instances launched in the VPC get public DNS hostnames. - * - * If this attribute is true, instances in the VPC get public DNS hostnames, - * but only if the enableDnsSupport attribute is also set to true. - * - * @default true - */ - readonly enableDnsHostnames?: boolean; - - /** - * Indicates whether the DNS resolution is supported for the VPC. - * - * If this attribute is false, the Amazon-provided DNS server in the VPC that - * resolves public DNS hostnames to IP addresses is not enabled. If this - * attribute is true, queries to the Amazon provided DNS server at the - * 169.254.169.253 IP address, or the reserved IP address at the base of the - * VPC IPv4 network range plus two will succeed. - * - * @default true - */ - readonly enableDnsSupport?: boolean; - - /** - * The default tenancy of instances launched into the VPC. - * - * By setting this to dedicated tenancy, instances will be launched on - * hardware dedicated to a single AWS customer, unless specifically specified - * at instance launch time. Please note, not all instance types are usable - * with Dedicated tenancy. - * - * @default DefaultInstanceTenancy.Default (shared) tenancy - */ - readonly defaultInstanceTenancy?: DefaultInstanceTenancy; - - /** - * Define the maximum number of AZs to use in this region - * - * If the region has more AZs than you want to use (for example, because of - * EIP limits), pick a lower number here. The AZs will be sorted and picked - * from the start of the list. - * - * If you pick a higher number than the number of AZs in the region, all AZs - * in the region will be selected. To use "all AZs" available to your - * account, use a high number (such as 99). - * - * Be aware that environment-agnostic stacks will be created with access to - * only 2 AZs, so to use more than 2 AZs, be sure to specify the account and - * region on your stack. - * - * Specify this option only if you do not specify `availabilityZones`. - * - * @default 3 - */ - readonly maxAzs?: number; - - /** - * Define the number of AZs to reserve. - * - * When specified, the IP space is reserved for the azs but no actual - * resources are provisioned. - * - * @default 0 - */ - readonly reservedAzs?: number; - - /** - * Availability zones this VPC spans. - * - * Specify this option only if you do not specify `maxAzs`. - * - * @default - a subset of AZs of the stack - */ - readonly availabilityZones?: string[]; - - /** - * The number of NAT Gateways/Instances to create. - * - * The type of NAT gateway or instance will be determined by the - * `natGatewayProvider` parameter. - * - * You can set this number lower than the number of Availability Zones in your - * VPC in order to save on NAT cost. Be aware you may be charged for - * cross-AZ data traffic instead. - * - * @default - One NAT gateway/instance per Availability Zone - */ - readonly natGateways?: number; - - /** - * Configures the subnets which will have NAT Gateways/Instances - * - * You can pick a specific group of subnets by specifying the group name; - * the picked subnets must be public subnets. - * - * Only necessary if you have more than one public subnet group. - * - * @default - All public subnets. - */ - readonly natGatewaySubnets?: SubnetSelection; - - /** - * What type of NAT provider to use - * - * Select between NAT gateways or NAT instances. NAT gateways - * may not be available in all AWS regions. - * - * @default NatProvider.gateway() - * - */ - readonly natGatewayProvider?: NatProvider; - - /** - * Configure the subnets to build for each AZ - * - * Each entry in this list configures a Subnet Group; each group will contain a - * subnet for each Availability Zone. - * - * For example, if you want 1 public subnet, 1 private subnet, and 1 isolated - * subnet in each AZ provide the following: - * - * ```ts - * new ec2.Vpc(this, 'VPC', { - * subnetConfiguration: [ - * { - * cidrMask: 24, - * name: 'ingress', - * subnetType: ec2.SubnetType.PUBLIC, - * }, - * { - * cidrMask: 24, - * name: 'application', - * subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - * }, - * { - * cidrMask: 28, - * name: 'rds', - * subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - * } - * ] - * }); - * ``` - * - * @default - The VPC CIDR will be evenly divided between 1 public and 1 - * private subnet per AZ. - */ - readonly subnetConfiguration?: SubnetConfiguration[]; - - /** - * Indicates whether a VPN gateway should be created and attached to this VPC. - * - * @default - true when vpnGatewayAsn or vpnConnections is specified - */ - readonly vpnGateway?: boolean; - - /** - * The private Autonomous System Number (ASN) for the VPN gateway. - * - * @default - Amazon default ASN. - */ - readonly vpnGatewayAsn?: number; - - /** - * VPN connections to this VPC. - * - * @default - No connections. - */ - readonly vpnConnections?: { [id: string]: VpnConnectionOptions } - - /** - * Where to propagate VPN routes. - * - * @default - On the route tables associated with private subnets. If no - * private subnets exists, isolated subnets are used. If no isolated subnets - * exists, public subnets are used. - */ - readonly vpnRoutePropagation?: SubnetSelection[] - - /** - * Gateway endpoints to add to this VPC. - * - * @default - None. - */ - readonly gatewayEndpoints?: { [id: string]: GatewayVpcEndpointOptions } - - /** - * Flow logs to add to this VPC. - * - * @default - No flow logs. - */ - readonly flowLogs?: { [id: string]: FlowLogOptions } - - /** - * The VPC name. - * - * Since the VPC resource doesn't support providing a physical name, the value provided here will be recorded in the `Name` tag - * - * @default this.node.path - */ - readonly vpcName?: string; -} - -/** - * The default tenancy of instances launched into the VPC. - */ -export enum DefaultInstanceTenancy { - /** - * Instances can be launched with any tenancy. - */ - DEFAULT = 'default', - - /** - * Any instance launched into the VPC automatically has dedicated tenancy, unless you launch it with the default tenancy. - */ - DEDICATED = 'dedicated' -} - -/** - * Specify configuration parameters for a single subnet group in a VPC. - */ -export interface SubnetConfiguration { - /** - * The number of leading 1 bits in the routing mask. - * - * The number of available IP addresses in each subnet of this group - * will be equal to `2^(32 - cidrMask) - 2`. - * - * Valid values are `16--28`. - * - * @default - Available IP space is evenly divided across subnets. - */ - readonly cidrMask?: number; - - /** - * The type of Subnet to configure. - * - * The Subnet type will control the ability to route and connect to the - * Internet. - */ - readonly subnetType: SubnetType; - - /** - * Logical name for the subnet group. - * - * This name can be used when selecting VPC subnets to distinguish - * between different subnet groups of the same type. - */ - readonly name: string; - - /** - * Controls if subnet IP space needs to be reserved. - * - * When true, the IP space for the subnet is reserved but no actual - * resources are provisioned. This space is only dependent on the - * number of availability zones and on `cidrMask` - all other subnet - * properties are ignored. - * - * @default false - */ - readonly reserved?: boolean; - - /** - * Controls if a public IP is associated to an instance at launch - * - * @default true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. - */ - readonly mapPublicIpOnLaunch?: boolean; -} - -/** - * Define an AWS Virtual Private Cloud - * - * See the package-level documentation of this package for an overview - * of the various dimensions in which you can configure your VPC. - * - * For example: - * - * ```ts - * const vpc = new ec2.Vpc(this, 'TheVPC', { - * ipAddresses: IpAddresses.cidr('10.0.0.0/16'), - * }) - * - * // Iterate the private subnets - * const selection = vpc.selectSubnets({ - * subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS - * }); - * - * for (const subnet of selection.subnets) { - * // ... - * } - * ``` - * - * @resource AWS::EC2::VPC - */ -export class Vpc extends VpcBase { - /** - * The default CIDR range used when creating VPCs. - * This can be overridden using VpcProps when creating a VPCNetwork resource. - * e.g. new VpcResource(this, { cidr: '192.168.0.0./16' }) - */ - public static readonly DEFAULT_CIDR_RANGE: string = '10.0.0.0/16'; - - /** - * The default subnet configuration - * - * 1 Public and 1 Private subnet per AZ evenly split - */ - public static readonly DEFAULT_SUBNETS: SubnetConfiguration[] = [ - { - subnetType: SubnetType.PUBLIC, - name: defaultSubnetName(SubnetType.PUBLIC), - }, - { - subnetType: SubnetType.PRIVATE_WITH_EGRESS, - name: defaultSubnetName(SubnetType.PRIVATE_WITH_EGRESS), - }, - ]; - - /** - * The default subnet configuration if natGateways specified to be 0 - * - * 1 Public and 1 Isolated Subnet per AZ evenly split - */ - public static readonly DEFAULT_SUBNETS_NO_NAT: SubnetConfiguration[] = [ - { - subnetType: SubnetType.PUBLIC, - name: defaultSubnetName(SubnetType.PUBLIC), - }, - { - subnetType: SubnetType.PRIVATE_ISOLATED, - name: defaultSubnetName(SubnetType.PRIVATE_ISOLATED), - }, - ]; - - /** - * Import a VPC by supplying all attributes directly - * - * NOTE: using `fromVpcAttributes()` with deploy-time parameters (like a `Fn.importValue()` or - * `CfnParameter` to represent a list of subnet IDs) sometimes accidentally works. It happens - * to work for constructs that need a list of subnets (like `AutoScalingGroup` and `eks.Cluster`) - * but it does not work for constructs that need individual subnets (like - * `Instance`). See https://github.com/aws/aws-cdk/issues/4118 for more - * information. - * - * Prefer to use `Vpc.fromLookup()` instead. - */ - public static fromVpcAttributes(scope: Construct, id: string, attrs: VpcAttributes): IVpc { - return new ImportedVpc(scope, id, attrs, false); - } - - /** - * Import an existing VPC by querying the AWS environment this stack is deployed to. - * - * This function only needs to be used to use VPCs not defined in your CDK - * application. If you are looking to share a VPC between stacks, you can - * pass the `Vpc` object between stacks and use it as normal. - * - * Calling this method will lead to a lookup when the CDK CLI is executed. - * You can therefore not use any values that will only be available at - * CloudFormation execution time (i.e., Tokens). - * - * The VPC information will be cached in `cdk.context.json` and the same VPC - * will be used on future runs. To refresh the lookup, you will have to - * evict the value from the cache using the `cdk context` command. See - * https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. - */ - public static fromLookup(scope: Construct, id: string, options: VpcLookupOptions): IVpc { - if (Token.isUnresolved(options.vpcId) - || Token.isUnresolved(options.vpcName) - || Object.values(options.tags || {}).some(Token.isUnresolved) - || Object.keys(options.tags || {}).some(Token.isUnresolved)) { - throw new Error('All arguments to Vpc.fromLookup() must be concrete (no Tokens)'); - } - - const filter: {[key: string]: string} = makeTagFilter(options.tags); - - // We give special treatment to some tags - if (options.vpcId) { filter['vpc-id'] = options.vpcId; } - if (options.vpcName) { filter['tag:Name'] = options.vpcName; } - if (options.isDefault !== undefined) { - filter.isDefault = options.isDefault ? 'true' : 'false'; - } - - const overrides: {[key: string]: string} = {}; - if (options.region) { - overrides.region = options.region; - } - - const attributes: cxapi.VpcContextResponse = ContextProvider.getValue(scope, { - provider: cxschema.ContextProvider.VPC_PROVIDER, - props: { - ...overrides, - filter, - returnAsymmetricSubnets: true, - returnVpnGateways: options.returnVpnGateways, - subnetGroupNameTag: options.subnetGroupNameTag, - } as cxschema.VpcContextQuery, - dummyValue: undefined, - }).value; - - return new LookedUpVpc(scope, id, attributes ?? DUMMY_VPC_PROPS, attributes === undefined); - - /** - * Prefixes all keys in the argument with `tag:`.` - */ - function makeTagFilter(tags: { [name: string]: string } | undefined): { [name: string]: string } { - const result: { [name: string]: string } = {}; - for (const [name, value] of Object.entries(tags || {})) { - result[`tag:${name}`] = value; - } - return result; - } - } - - /** - * Identifier for this VPC - */ - public readonly vpcId: string; - - /** - * @attribute - */ - public readonly vpcArn: string; - - /** - * @attribute - */ - public readonly vpcCidrBlock: string; - - /** - * @attribute - */ - public readonly vpcDefaultNetworkAcl: string; - - /** - * @attribute - */ - public readonly vpcCidrBlockAssociations: string[]; - - /** - * @attribute - */ - public readonly vpcDefaultSecurityGroup: string; - - /** - * @attribute - */ - public readonly vpcIpv6CidrBlocks: string[]; - - /** - * List of public subnets in this VPC - */ - public readonly publicSubnets: ISubnet[] = []; - - /** - * List of private subnets in this VPC - */ - public readonly privateSubnets: ISubnet[] = []; - - /** - * List of isolated subnets in this VPC - */ - public readonly isolatedSubnets: ISubnet[] = []; - - /** - * AZs for this VPC - */ - public readonly availabilityZones: string[]; - - /** - * Internet Gateway for the VPC. Note that in case the VPC is configured only - * with ISOLATED subnets, this attribute will be `undefined`. - */ - public readonly internetGatewayId?: string; - - public readonly internetConnectivityEstablished: IDependable; - - /** - * Indicates if instances launched in this VPC will have public DNS hostnames. - */ - public readonly dnsHostnamesEnabled: boolean; - - /** - * Indicates if DNS support is enabled for this VPC. - */ - public readonly dnsSupportEnabled: boolean; - - /** - * The VPC resource - */ - private readonly resource: CfnVPC; - - /** - * The provider of ip addresses - */ - private readonly ipAddresses: IIpAddresses; - - /** - * Subnet configurations for this VPC - */ - private subnetConfiguration: SubnetConfiguration[] = []; - - private readonly _internetConnectivityEstablished = new DependencyGroup(); - - /** - * Vpc creates a VPC that spans a whole region. - * It will automatically divide the provided VPC CIDR range, and create public and private subnets per Availability Zone. - * Network routing for the public subnets will be configured to allow outbound access directly via an Internet Gateway. - * Network routing for the private subnets will be configured to allow outbound access via a set of resilient NAT Gateways (one per AZ). - */ - constructor(scope: Construct, id: string, props: VpcProps = {}) { - super(scope, id); - - const stack = Stack.of(this); - - // Can't have enabledDnsHostnames without enableDnsSupport - if (props.enableDnsHostnames && !props.enableDnsSupport) { - throw new Error('To use DNS Hostnames, DNS Support must be enabled, however, it was explicitly disabled.'); - } - - if (props.availabilityZones && props.maxAzs) { - throw new Error('Vpc supports \'availabilityZones\' or \'maxAzs\', but not both.'); - } - - const cidrBlock = ifUndefined(props.cidr, Vpc.DEFAULT_CIDR_RANGE); - if (Token.isUnresolved(cidrBlock)) { - throw new Error('\'cidr\' property must be a concrete CIDR string, got a Token (we need to parse it for automatic subdivision)'); - } - - if (props.ipAddresses && props.cidr) { - throw new Error('supply at most one of ipAddresses or cidr'); - } - - this.ipAddresses = props.ipAddresses ?? IpAddresses.cidr(cidrBlock); - - this.dnsHostnamesEnabled = props.enableDnsHostnames == null ? true : props.enableDnsHostnames; - this.dnsSupportEnabled = props.enableDnsSupport == null ? true : props.enableDnsSupport; - const instanceTenancy = props.defaultInstanceTenancy || 'default'; - this.internetConnectivityEstablished = this._internetConnectivityEstablished; - - const vpcIpAddressOptions = this.ipAddresses.allocateVpcCidr(); - - // Define a VPC using the provided CIDR range - this.resource = new CfnVPC(this, 'Resource', { - cidrBlock: vpcIpAddressOptions.cidrBlock, - ipv4IpamPoolId: vpcIpAddressOptions.ipv4IpamPoolId, - ipv4NetmaskLength: vpcIpAddressOptions.ipv4NetmaskLength, - enableDnsHostnames: this.dnsHostnamesEnabled, - enableDnsSupport: this.dnsSupportEnabled, - instanceTenancy, - }); - - this.vpcDefaultNetworkAcl = this.resource.attrDefaultNetworkAcl; - this.vpcCidrBlockAssociations = this.resource.attrCidrBlockAssociations; - this.vpcCidrBlock = this.resource.attrCidrBlock; - this.vpcDefaultSecurityGroup = this.resource.attrDefaultSecurityGroup; - this.vpcIpv6CidrBlocks = this.resource.attrIpv6CidrBlocks; - - Tags.of(this).add(NAME_TAG, props.vpcName || this.node.path); - - if (props.availabilityZones) { - // If given AZs and stack AZs are both resolved, then validate their compatibility. - const resolvedStackAzs = stack.availabilityZones.filter(az => !Token.isUnresolved(az)); - const areGivenAzsSubsetOfStack = resolvedStackAzs.length === 0 // stack AZs are tokenized, so we cannot validate it - || props.availabilityZones.every( - az => Token.isUnresolved(az) // given AZ is tokenized, such as in integ tests, so we cannot validate it - || resolvedStackAzs.includes(az)); - if (!areGivenAzsSubsetOfStack) { - throw new Error(`Given VPC 'availabilityZones' ${props.availabilityZones} must be a subset of the stack's availability zones ${stack.availabilityZones}`); - } - this.availabilityZones = props.availabilityZones; - } else { - const maxAZs = props.maxAzs ?? 3; - this.availabilityZones = stack.availabilityZones.slice(0, maxAZs); - } - for (let i = 0; props.reservedAzs && i < props.reservedAzs; i++) { - this.availabilityZones.push(FAKE_AZ_NAME); - } - - - this.vpcId = this.resource.ref; - this.vpcArn = Arn.format({ - service: 'ec2', - resource: 'vpc', - resourceName: this.vpcId, - }, stack); - - const defaultSubnet = props.natGateways === 0 ? Vpc.DEFAULT_SUBNETS_NO_NAT : Vpc.DEFAULT_SUBNETS; - this.subnetConfiguration = ifUndefined(props.subnetConfiguration, defaultSubnet); - - const natGatewayPlacement = props.natGatewaySubnets || { subnetType: SubnetType.PUBLIC }; - const natGatewayCount = determineNatGatewayCount(props.natGateways, this.subnetConfiguration, this.availabilityZones.length); - - // subnetConfiguration must be set before calling createSubnets - this.createSubnets(); - - const allowOutbound = this.subnetConfiguration.filter( - subnet => (subnet.subnetType !== SubnetType.PRIVATE_ISOLATED && subnet.subnetType !== SubnetType.ISOLATED)).length > 0; - - // Create an Internet Gateway and attach it if necessary - if (allowOutbound) { - const igw = new CfnInternetGateway(this, 'IGW', { - }); - - this.internetGatewayId = igw.ref; - - this._internetConnectivityEstablished.add(igw); - const att = new CfnVPCGatewayAttachment(this, 'VPCGW', { - internetGatewayId: igw.ref, - vpcId: this.resource.ref, - }); - - (this.publicSubnets as PublicSubnet[]).forEach(publicSubnet => { - publicSubnet.addDefaultInternetRoute(igw.ref, att); - }); - - // if gateways are needed create them - if (natGatewayCount > 0) { - const provider = props.natGatewayProvider || NatProvider.gateway(); - this.createNatGateways(provider, natGatewayCount, natGatewayPlacement); - } - } - - if (props.vpnGateway && this.publicSubnets.length === 0 && this.privateSubnets.length === 0 && this.isolatedSubnets.length === 0) { - throw new Error('Can not enable the VPN gateway while the VPC has no subnets at all'); - } - - if ((props.vpnConnections || props.vpnGatewayAsn) && props.vpnGateway === false) { - throw new Error('Cannot specify `vpnConnections` or `vpnGatewayAsn` when `vpnGateway` is set to false.'); - } - - if (props.vpnGateway || props.vpnConnections || props.vpnGatewayAsn) { - this.enableVpnGateway({ - amazonSideAsn: props.vpnGatewayAsn, - type: VpnConnectionType.IPSEC_1, - vpnRoutePropagation: props.vpnRoutePropagation, - }); - - const vpnConnections = props.vpnConnections || {}; - for (const [connectionId, connection] of Object.entries(vpnConnections)) { - this.addVpnConnection(connectionId, connection); - } - } - - // Allow creation of gateway endpoints on VPC instantiation as those can be - // immediately functional without further configuration. This is not the case - // for interface endpoints where the security group must be configured. - if (props.gatewayEndpoints) { - const gatewayEndpoints = props.gatewayEndpoints || {}; - for (const [endpointId, endpoint] of Object.entries(gatewayEndpoints)) { - this.addGatewayEndpoint(endpointId, endpoint); - } - } - - // Add flow logs to the VPC - if (props.flowLogs) { - const flowLogs = props.flowLogs || {}; - for (const [flowLogId, flowLog] of Object.entries(flowLogs)) { - this.addFlowLog(flowLogId, flowLog); - } - } - } - - /** - * Adds a new S3 gateway endpoint to this VPC - * - * @deprecated use `addGatewayEndpoint()` instead - */ - public addS3Endpoint(id: string, subnets?: SubnetSelection[]): GatewayVpcEndpoint { - return new GatewayVpcEndpoint(this, id, { - service: GatewayVpcEndpointAwsService.S3, - vpc: this, - subnets, - }); - } - - /** - * Adds a new DynamoDB gateway endpoint to this VPC - * - * @deprecated use `addGatewayEndpoint()` instead - */ - public addDynamoDbEndpoint(id: string, subnets?: SubnetSelection[]): GatewayVpcEndpoint { - return new GatewayVpcEndpoint(this, id, { - service: GatewayVpcEndpointAwsService.DYNAMODB, - vpc: this, - subnets, - }); - } - - private createNatGateways(provider: NatProvider, natCount: number, placement: SubnetSelection): void { - const natSubnets: PublicSubnet[] = this.selectSubnetObjects(placement) as PublicSubnet[]; - for (const sub of natSubnets) { - if (this.publicSubnets.indexOf(sub) === -1) { - throw new Error(`natGatewayPlacement ${placement} contains non public subnet ${sub}`); - } - } - - provider.configureNat({ - vpc: this, - natSubnets: natSubnets.slice(0, natCount), - privateSubnets: this.privateSubnets as PrivateSubnet[], - }); - } - - /** - * createSubnets creates the subnets specified by the subnet configuration - * array or creates the `DEFAULT_SUBNETS` configuration - */ - private createSubnets() { - - const requestedSubnets: RequestedSubnet[] = []; - - this.subnetConfiguration.forEach((configuration)=> ( - this.availabilityZones.forEach((az, index) => { - requestedSubnets.push({ - availabilityZone: az, - subnetConstructId: subnetId(configuration.name, index), - configuration, - }); - }, - ))); - - const { allocatedSubnets } = this.ipAddresses.allocateSubnetsCidr({ - vpcCidr: this.vpcCidrBlock, - requestedSubnets, - }); - - if (allocatedSubnets.length != requestedSubnets.length) { - throw new Error('Incomplete Subnet Allocation; response array dose not equal input array'); - } - - this.createSubnetResources(requestedSubnets, allocatedSubnets); - } - - private createSubnetResources(requestedSubnets: RequestedSubnet[], allocatedSubnets: AllocatedSubnet[]) { - allocatedSubnets.forEach((allocated, i) => { - - const { configuration: subnetConfig, subnetConstructId, availabilityZone } = requestedSubnets[i]; - - if (subnetConfig.reserved === true) { - // For reserved subnets, do not create any resources - return; - } - if (availabilityZone === FAKE_AZ_NAME) { - // For reserved azs, do not create any resources - return; - } - - // mapPublicIpOnLaunch true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. - let mapPublicIpOnLaunch = false; - if (subnetConfig.subnetType !== SubnetType.PUBLIC && subnetConfig.mapPublicIpOnLaunch !== undefined) { - throw new Error(`${subnetConfig.subnetType} subnet cannot include mapPublicIpOnLaunch parameter`); - } - if (subnetConfig.subnetType === SubnetType.PUBLIC) { - mapPublicIpOnLaunch = (subnetConfig.mapPublicIpOnLaunch !== undefined) - ? subnetConfig.mapPublicIpOnLaunch - : true; - } - - const subnetProps: SubnetProps = { - availabilityZone, - vpcId: this.vpcId, - cidrBlock: allocated.cidr, - mapPublicIpOnLaunch: mapPublicIpOnLaunch, - }; - - let subnet: Subnet; - switch (subnetConfig.subnetType) { - case SubnetType.PUBLIC: - const publicSubnet = new PublicSubnet(this, subnetConstructId, subnetProps); - this.publicSubnets.push(publicSubnet); - subnet = publicSubnet; - break; - case SubnetType.PRIVATE_WITH_EGRESS: - case SubnetType.PRIVATE_WITH_NAT: - case SubnetType.PRIVATE: - const privateSubnet = new PrivateSubnet(this, subnetConstructId, subnetProps); - this.privateSubnets.push(privateSubnet); - subnet = privateSubnet; - break; - case SubnetType.PRIVATE_ISOLATED: - case SubnetType.ISOLATED: - const isolatedSubnet = new PrivateSubnet(this, subnetConstructId, subnetProps); - this.isolatedSubnets.push(isolatedSubnet); - subnet = isolatedSubnet; - break; - default: - throw new Error(`Unrecognized subnet type: ${subnetConfig.subnetType}`); - } - - // These values will be used to recover the config upon provider import - const includeResourceTypes = [CfnSubnet.CFN_RESOURCE_TYPE_NAME]; - Tags.of(subnet).add(SUBNETNAME_TAG, subnetConfig.name, { includeResourceTypes }); - Tags.of(subnet).add(SUBNETTYPE_TAG, subnetTypeTagValue(subnetConfig.subnetType), { includeResourceTypes }); - }); - } -} - -const SUBNETTYPE_TAG = 'aws-cdk:subnet-type'; -const SUBNETNAME_TAG = 'aws-cdk:subnet-name'; - -function subnetTypeTagValue(type: SubnetType) { - switch (type) { - case SubnetType.PUBLIC: return 'Public'; - case SubnetType.PRIVATE_WITH_EGRESS: - case SubnetType.PRIVATE_WITH_NAT: - case SubnetType.PRIVATE: - return 'Private'; - case SubnetType.PRIVATE_ISOLATED: - case SubnetType.ISOLATED: - return 'Isolated'; - } -} - -/** - * Specify configuration parameters for a VPC subnet - */ -export interface SubnetProps { - - /** - * The availability zone for the subnet - */ - readonly availabilityZone: string; - - /** - * The VPC which this subnet is part of - */ - readonly vpcId: string; - - /** - * The CIDR notation for this subnet - */ - readonly cidrBlock: string; - - /** - * Controls if a public IP is associated to an instance at launch - * - * @default true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. - */ - readonly mapPublicIpOnLaunch?: boolean; -} - -/** - * Represents a new VPC subnet resource - * - * @resource AWS::EC2::Subnet - */ -export class Subnet extends Resource implements ISubnet { - - public static isVpcSubnet(x: any): x is Subnet { - return VPC_SUBNET_SYMBOL in x; - } - - public static fromSubnetAttributes(scope: Construct, id: string, attrs: SubnetAttributes): ISubnet { - return new ImportedSubnet(scope, id, attrs); - } - - /** - * Import existing subnet from id. - */ - // eslint-disable-next-line @typescript-eslint/no-shadow - public static fromSubnetId(scope: Construct, id: string, subnetId: string): ISubnet { - return this.fromSubnetAttributes(scope, id, { subnetId }); - } - - /** - * The Availability Zone the subnet is located in - */ - public readonly availabilityZone: string; - - /** - * @attribute - */ - public readonly ipv4CidrBlock: string; - - /** - * The subnetId for this particular subnet - */ - public readonly subnetId: string; - - /** - * @attribute - */ - public readonly subnetVpcId: string; - - /** - * @attribute - */ - public readonly subnetAvailabilityZone: string; - - /** - * @attribute - */ - public readonly subnetIpv6CidrBlocks: string[]; - - /** - * The Amazon Resource Name (ARN) of the Outpost for this subnet (if one exists). - * @attribute - */ - public readonly subnetOutpostArn: string; - - /** - * @attribute - */ - public readonly subnetNetworkAclAssociationId: string; - - /** - * Parts of this VPC subnet - */ - public readonly dependencyElements: IDependable[] = []; - - /** - * The routeTableId attached to this subnet. - */ - public readonly routeTable: IRouteTable; - - public readonly internetConnectivityEstablished: IDependable; - - private readonly _internetConnectivityEstablished = new DependencyGroup(); - - private _networkAcl: INetworkAcl; - - constructor(scope: Construct, id: string, props: SubnetProps) { - super(scope, id); - - Object.defineProperty(this, VPC_SUBNET_SYMBOL, { value: true }); - - Tags.of(this).add(NAME_TAG, this.node.path); - - this.availabilityZone = props.availabilityZone; - this.ipv4CidrBlock = props.cidrBlock; - const subnet = new CfnSubnet(this, 'Subnet', { - vpcId: props.vpcId, - cidrBlock: props.cidrBlock, - availabilityZone: props.availabilityZone, - mapPublicIpOnLaunch: props.mapPublicIpOnLaunch, - }); - this.subnetId = subnet.ref; - this.subnetVpcId = subnet.attrVpcId; - this.subnetAvailabilityZone = subnet.attrAvailabilityZone; - this.subnetIpv6CidrBlocks = subnet.attrIpv6CidrBlocks; - this.subnetOutpostArn = subnet.attrOutpostArn; - - // subnet.attrNetworkAclAssociationId is the default ACL after the subnet - // was just created. However, the ACL can be replaced at a later time. - this._networkAcl = NetworkAcl.fromNetworkAclId(this, 'Acl', subnet.attrNetworkAclAssociationId); - this.subnetNetworkAclAssociationId = Lazy.string({ produce: () => this._networkAcl.networkAclId }); - this.node.defaultChild = subnet; - - const table = new CfnRouteTable(this, 'RouteTable', { - vpcId: props.vpcId, - }); - this.routeTable = { routeTableId: table.ref }; - - // Associate the public route table for this subnet, to this subnet - const routeAssoc = new CfnSubnetRouteTableAssociation(this, 'RouteTableAssociation', { - subnetId: this.subnetId, - routeTableId: table.ref, - }); - this._internetConnectivityEstablished.add(routeAssoc); - - this.internetConnectivityEstablished = this._internetConnectivityEstablished; - } - - /** - * Create a default route that points to a passed IGW, with a dependency - * on the IGW's attachment to the VPC. - * - * @param gatewayId the logical ID (ref) of the gateway attached to your VPC - * @param gatewayAttachment the gateway attachment construct to be added as a dependency - */ - public addDefaultInternetRoute(gatewayId: string, gatewayAttachment: IDependable) { - const route = new CfnRoute(this, 'DefaultRoute', { - routeTableId: this.routeTable.routeTableId, - destinationCidrBlock: '0.0.0.0/0', - gatewayId, - }); - route.node.addDependency(gatewayAttachment); - - // Since the 'route' depends on the gateway attachment, just - // depending on the route is enough. - this._internetConnectivityEstablished.add(route); - } - - /** - * Network ACL associated with this Subnet - * - * Upon creation, this is the default ACL which allows all traffic, except - * explicit DENY entries that you add. - * - * You can replace it with a custom ACL which denies all traffic except - * the explicit ALLOW entries that you add by creating a `NetworkAcl` - * object and calling `associateNetworkAcl()`. - */ - public get networkAcl(): INetworkAcl { - return this._networkAcl; - } - - /** - * Adds an entry to this subnets route table that points to the passed NATGatewayId - * @param natGatewayId The ID of the NAT gateway - */ - public addDefaultNatRoute(natGatewayId: string) { - this.addRoute('DefaultRoute', { - routerType: RouterType.NAT_GATEWAY, - routerId: natGatewayId, - enablesInternetConnectivity: true, - }); - } - - /** - * Adds an entry to this subnets route table - */ - public addRoute(id: string, options: AddRouteOptions) { - if (options.destinationCidrBlock && options.destinationIpv6CidrBlock) { - throw new Error('Cannot specify both \'destinationCidrBlock\' and \'destinationIpv6CidrBlock\''); - } - - const route = new CfnRoute(this, id, { - routeTableId: this.routeTable.routeTableId, - destinationCidrBlock: options.destinationCidrBlock || (options.destinationIpv6CidrBlock === undefined ? '0.0.0.0/0' : undefined), - destinationIpv6CidrBlock: options.destinationIpv6CidrBlock, - [routerTypeToPropName(options.routerType)]: options.routerId, - }); - - if (options.enablesInternetConnectivity) { - this._internetConnectivityEstablished.add(route); - } - } - - public associateNetworkAcl(id: string, networkAcl: INetworkAcl) { - this._networkAcl = networkAcl; - - const scope = networkAcl instanceof Construct ? networkAcl : this; - const other = networkAcl instanceof Construct ? this : networkAcl; - new SubnetNetworkAclAssociation(scope, id + Names.nodeUniqueId(other.node), { - networkAcl, - subnet: this, - }); - } -} - -/** - * Options for adding a new route to a subnet - */ -export interface AddRouteOptions { - /** - * IPv4 range this route applies to - * - * @default '0.0.0.0/0' - */ - readonly destinationCidrBlock?: string; - - /** - * IPv6 range this route applies to - * - * @default - Uses IPv6 - */ - readonly destinationIpv6CidrBlock?: string; - - /** - * What type of router to route this traffic to - */ - readonly routerType: RouterType; - - /** - * The ID of the router - * - * Can be an instance ID, gateway ID, etc, depending on the router type. - */ - readonly routerId: string; - - /** - * Whether this route will enable internet connectivity - * - * If true, this route will be added before any AWS resources that depend - * on internet connectivity in the VPC will be created. - * - * @default false - */ - readonly enablesInternetConnectivity?: boolean; -} - -/** - * Type of router used in route - */ -export enum RouterType { - /** - * Carrier gateway - */ - CARRIER_GATEWAY = 'CarrierGateway', - - /** - * Egress-only Internet Gateway - */ - EGRESS_ONLY_INTERNET_GATEWAY = 'EgressOnlyInternetGateway', - - /** - * Internet Gateway - */ - GATEWAY = 'Gateway', - - /** - * Instance - */ - INSTANCE = 'Instance', - - /** - * Local Gateway - */ - LOCAL_GATEWAY = 'LocalGateway', - - /** - * NAT Gateway - */ - NAT_GATEWAY = 'NatGateway', - - /** - * Network Interface - */ - NETWORK_INTERFACE = 'NetworkInterface', - - /** - * Transit Gateway - */ - TRANSIT_GATEWAY = 'TransitGateway', - - /** - * VPC peering connection - */ - VPC_PEERING_CONNECTION = 'VpcPeeringConnection', - - /** - * VPC Endpoint for gateway load balancers - */ - VPC_ENDPOINT = 'VpcEndpoint', -} - -function routerTypeToPropName(routerType: RouterType) { - return ({ - [RouterType.CARRIER_GATEWAY]: 'carrierGatewayId', - [RouterType.EGRESS_ONLY_INTERNET_GATEWAY]: 'egressOnlyInternetGatewayId', - [RouterType.GATEWAY]: 'gatewayId', - [RouterType.INSTANCE]: 'instanceId', - [RouterType.LOCAL_GATEWAY]: 'localGatewayId', - [RouterType.NAT_GATEWAY]: 'natGatewayId', - [RouterType.NETWORK_INTERFACE]: 'networkInterfaceId', - [RouterType.TRANSIT_GATEWAY]: 'transitGatewayId', - [RouterType.VPC_PEERING_CONNECTION]: 'vpcPeeringConnectionId', - [RouterType.VPC_ENDPOINT]: 'vpcEndpointId', - })[routerType]; -} - -export interface PublicSubnetProps extends SubnetProps { - -} - -export interface IPublicSubnet extends ISubnet { } - -export interface PublicSubnetAttributes extends SubnetAttributes { } - -/** - * Represents a public VPC subnet resource - */ -export class PublicSubnet extends Subnet implements IPublicSubnet { - - public static fromPublicSubnetAttributes(scope: Construct, id: string, attrs: PublicSubnetAttributes): IPublicSubnet { - return new ImportedSubnet(scope, id, attrs); - } - - constructor(scope: Construct, id: string, props: PublicSubnetProps) { - super(scope, id, props); - } - - /** - * Creates a new managed NAT gateway attached to this public subnet. - * Also adds the EIP for the managed NAT. - * @returns A ref to the the NAT Gateway ID - */ - public addNatGateway(eipAllocationId?: string) { - // Create a NAT Gateway in this public subnet - const ngw = new CfnNatGateway(this, 'NATGateway', { - subnetId: this.subnetId, - allocationId: eipAllocationId ?? new CfnEIP(this, 'EIP', { - domain: 'vpc', - }).attrAllocationId, - }); - ngw.node.addDependency(this.internetConnectivityEstablished); - return ngw; - } -} - -export interface PrivateSubnetProps extends SubnetProps { - -} - -export interface IPrivateSubnet extends ISubnet { } - -export interface PrivateSubnetAttributes extends SubnetAttributes { } - -/** - * Represents a private VPC subnet resource - */ -export class PrivateSubnet extends Subnet implements IPrivateSubnet { - - public static fromPrivateSubnetAttributes(scope: Construct, id: string, attrs: PrivateSubnetAttributes): IPrivateSubnet { - return new ImportedSubnet(scope, id, attrs); - } - - constructor(scope: Construct, id: string, props: PrivateSubnetProps) { - super(scope, id, props); - } -} - -function ifUndefined(value: T | undefined, defaultValue: T): T { - return value ?? defaultValue; -} - -class ImportedVpc extends VpcBase { - public readonly vpcId: string; - public readonly vpcArn: string; - public readonly publicSubnets: ISubnet[]; - public readonly privateSubnets: ISubnet[]; - public readonly isolatedSubnets: ISubnet[]; - public readonly availabilityZones: string[]; - public readonly internetConnectivityEstablished: IDependable = new DependencyGroup(); - private readonly cidr?: string | undefined; - - constructor(scope: Construct, id: string, props: VpcAttributes, isIncomplete: boolean) { - super(scope, id, { - region: props.region, - }); - - this.vpcId = props.vpcId; - this.vpcArn = Arn.format({ - service: 'ec2', - resource: 'vpc', - resourceName: this.vpcId, - }, Stack.of(this)); - this.cidr = props.vpcCidrBlock; - this.availabilityZones = props.availabilityZones; - this._vpnGatewayId = props.vpnGatewayId; - this.incompleteSubnetDefinition = isIncomplete; - - // None of the values may be unresolved list tokens - for (const k of Object.keys(props) as Array) { - if (Array.isArray(props[k]) && Token.isUnresolved(props[k])) { - Annotations.of(this).addWarning(`fromVpcAttributes: '${k}' is a list token: the imported VPC will not work with constructs that require a list of subnets at synthesis time. Use 'Vpc.fromLookup()' or 'Fn.importListValue' instead.`); - } - } - - /* eslint-disable max-len */ - const pub = new ImportSubnetGroup(props.publicSubnetIds, props.publicSubnetNames, props.publicSubnetRouteTableIds, props.publicSubnetIpv4CidrBlocks, SubnetType.PUBLIC, this.availabilityZones, 'publicSubnetIds', 'publicSubnetNames', 'publicSubnetRouteTableIds', 'publicSubnetIpv4CidrBlocks'); - const priv = new ImportSubnetGroup(props.privateSubnetIds, props.privateSubnetNames, props.privateSubnetRouteTableIds, props.privateSubnetIpv4CidrBlocks, SubnetType.PRIVATE_WITH_EGRESS, this.availabilityZones, 'privateSubnetIds', 'privateSubnetNames', 'privateSubnetRouteTableIds', 'privateSubnetIpv4CidrBlocks'); - const iso = new ImportSubnetGroup(props.isolatedSubnetIds, props.isolatedSubnetNames, props.isolatedSubnetRouteTableIds, props.isolatedSubnetIpv4CidrBlocks, SubnetType.PRIVATE_ISOLATED, this.availabilityZones, 'isolatedSubnetIds', 'isolatedSubnetNames', 'isolatedSubnetRouteTableIds', 'isolatedSubnetIpv4CidrBlocks'); - /* eslint-enable max-len */ - - this.publicSubnets = pub.import(this); - this.privateSubnets = priv.import(this); - this.isolatedSubnets = iso.import(this); - } - - public get vpcCidrBlock(): string { - if (this.cidr === undefined) { - throw new Error('Cannot perform this operation: \'vpcCidrBlock\' was not supplied when creating this VPC'); - } - return this.cidr; - } -} - -class LookedUpVpc extends VpcBase { - public readonly vpcId: string; - public readonly vpcArn: string; - public readonly internetConnectivityEstablished: IDependable = new DependencyGroup(); - public readonly availabilityZones: string[]; - public readonly publicSubnets: ISubnet[]; - public readonly privateSubnets: ISubnet[]; - public readonly isolatedSubnets: ISubnet[]; - private readonly cidr?: string | undefined; - - constructor(scope: Construct, id: string, props: cxapi.VpcContextResponse, isIncomplete: boolean) { - super(scope, id, { - region: props.region, - }); - - this.vpcId = props.vpcId; - this.vpcArn = Arn.format({ - service: 'ec2', - resource: 'vpc', - resourceName: this.vpcId, - }, Stack.of(this)); - this.cidr = props.vpcCidrBlock; - this._vpnGatewayId = props.vpnGatewayId; - this.incompleteSubnetDefinition = isIncomplete; - - const subnetGroups = props.subnetGroups || []; - const availabilityZones = Array.from(new Set(flatMap(subnetGroups, subnetGroup => { - return subnetGroup.subnets.map(subnet => subnet.availabilityZone); - }))); - availabilityZones.sort((az1, az2) => az1.localeCompare(az2)); - this.availabilityZones = availabilityZones; - - this.publicSubnets = this.extractSubnetsOfType(subnetGroups, cxapi.VpcSubnetGroupType.PUBLIC); - this.privateSubnets = this.extractSubnetsOfType(subnetGroups, cxapi.VpcSubnetGroupType.PRIVATE); - this.isolatedSubnets = this.extractSubnetsOfType(subnetGroups, cxapi.VpcSubnetGroupType.ISOLATED); - } - - public get vpcCidrBlock(): string { - if (this.cidr === undefined) { - // Value might be cached from an old CLI version, so bumping the CX API protocol to - // force the value to exist would not have helped. - throw new Error('Cannot perform this operation: \'vpcCidrBlock\' was not found when looking up this VPC. Use a newer version of the CDK CLI and clear the old context value.'); - } - return this.cidr; - } - - private extractSubnetsOfType(subnetGroups: cxapi.VpcSubnetGroup[], subnetGroupType: cxapi.VpcSubnetGroupType): ISubnet[] { - return flatMap(subnetGroups.filter(subnetGroup => subnetGroup.type === subnetGroupType), - subnetGroup => this.subnetGroupToSubnets(subnetGroup)); - } - - private subnetGroupToSubnets(subnetGroup: cxapi.VpcSubnetGroup): ISubnet[] { - const ret = new Array(); - for (let i = 0; i < subnetGroup.subnets.length; i++) { - const vpcSubnet = subnetGroup.subnets[i]; - ret.push(Subnet.fromSubnetAttributes(this, `${subnetGroup.name}Subnet${i + 1}`, { - availabilityZone: vpcSubnet.availabilityZone, - subnetId: vpcSubnet.subnetId, - routeTableId: vpcSubnet.routeTableId, - ipv4CidrBlock: vpcSubnet.cidr, - })); - } - return ret; - } -} - -function flatMap(xs: T[], fn: (x: T) => U[]): U[] { - const ret = new Array(); - for (const x of xs) { - ret.push(...fn(x)); - } - return ret; -} - -class CompositeDependable implements IDependable { - private readonly dependables = new Array(); - - constructor() { - const self = this; - Dependable.implement(this, { - get dependencyRoots() { - const ret = new Array(); - for (const dep of self.dependables) { - ret.push(...Dependable.of(dep).dependencyRoots); - } - return ret; - }, - }); - } - - /** - * Add a construct to the dependency roots - */ - public add(dep: IDependable) { - this.dependables.push(dep); - } -} - -/** - * Invoke a function on a value (for its side effect) and return the value - */ -function tap(x: T, fn: (x: T) => void): T { - fn(x); - return x; -} - -class ImportedSubnet extends Resource implements ISubnet, IPublicSubnet, IPrivateSubnet { - public readonly internetConnectivityEstablished: IDependable = new DependencyGroup(); - public readonly subnetId: string; - public readonly routeTable: IRouteTable; - private readonly _availabilityZone?: string; - private readonly _ipv4CidrBlock?: string; - - constructor(scope: Construct, id: string, attrs: SubnetAttributes) { - super(scope, id); - - if (!attrs.routeTableId) { - // The following looks a little weird, but comes down to: - // - // * Is the subnetId itself unresolved ({ Ref: Subnet }); or - // * Was it the accidentally extracted first element of a list-encoded - // token? ({ Fn::ImportValue: Subnets } => ['#{Token[1234]}'] => - // '#{Token[1234]}' - // - // There's no other API to test for the second case than to the string back into - // a list and see if the combination is Unresolved. - // - // In both cases we can't output the subnetId literally into the metadata (because it'll - // be useless). In the 2nd case even, if we output it to metadata, the `resolve()` call - // that gets done on the metadata will even `throw`, because the '#{Token}' value will - // occur in an illegal position (not in a list context). - const ref = Token.isUnresolved(attrs.subnetId) || Token.isUnresolved([attrs.subnetId]) - ? `at '${Node.of(scope).path}/${id}'` - : `'${attrs.subnetId}'`; - // eslint-disable-next-line max-len - Annotations.of(this).addWarning(`No routeTableId was provided to the subnet ${ref}. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)`); - } - - this._ipv4CidrBlock = attrs.ipv4CidrBlock; - this._availabilityZone = attrs.availabilityZone; - this.subnetId = attrs.subnetId; - this.routeTable = { - // Forcing routeTableId to pretend non-null to maintain backwards-compatibility. See https://github.com/aws/aws-cdk/pull/3171 - routeTableId: attrs.routeTableId!, - }; - } - - public get availabilityZone(): string { - if (!this._availabilityZone) { - // eslint-disable-next-line max-len - throw new Error('You cannot reference a Subnet\'s availability zone if it was not supplied. Add the availabilityZone when importing using Subnet.fromSubnetAttributes()'); - } - return this._availabilityZone; - } - - public get ipv4CidrBlock(): string { - if (!this._ipv4CidrBlock) { - // tslint:disable-next-line: max-line-length - throw new Error('You cannot reference an imported Subnet\'s IPv4 CIDR if it was not supplied. Add the ipv4CidrBlock when importing using Subnet.fromSubnetAttributes()'); - } - return this._ipv4CidrBlock; - } - - public associateNetworkAcl(id: string, networkAcl: INetworkAcl): void { - const scope = networkAcl instanceof Construct ? networkAcl : this; - const other = networkAcl instanceof Construct ? this : networkAcl; - new SubnetNetworkAclAssociation(scope, id + Names.nodeUniqueId(other.node), { - networkAcl, - subnet: this, - }); - } -} - -/** - * Determine (and validate) the NAT gateway count w.r.t. the rest of the subnet configuration - * - * We have the following requirements: - * - * - NatGatewayCount = 0 ==> there are no private subnets - * - NatGatewayCount > 0 ==> there must be public subnets - * - * Do we want to require that there are private subnets if there are NatGateways? - * They seem pointless but I see no reason to prevent it. - */ -function determineNatGatewayCount(requestedCount: number | undefined, subnetConfig: SubnetConfiguration[], azCount: number) { - const hasPrivateSubnets = subnetConfig.some(c => (c.subnetType === SubnetType.PRIVATE_WITH_EGRESS - || c.subnetType === SubnetType.PRIVATE || c.subnetType === SubnetType.PRIVATE_WITH_NAT) && !c.reserved); - const hasPublicSubnets = subnetConfig.some(c => c.subnetType === SubnetType.PUBLIC); - const hasCustomEgress = subnetConfig.some(c => c.subnetType === SubnetType.PRIVATE_WITH_EGRESS); - - const count = requestedCount !== undefined ? Math.min(requestedCount, azCount) : (hasPrivateSubnets ? azCount : 0); - - if (count === 0 && hasPrivateSubnets && !hasCustomEgress) { - // eslint-disable-next-line max-len - throw new Error('If you do not want NAT gateways (natGateways=0), make sure you don\'t configure any PRIVATE(_WITH_NAT) subnets in \'subnetConfiguration\' (make them PUBLIC or ISOLATED instead)'); - } - - if (count > 0 && !hasPublicSubnets) { - // eslint-disable-next-line max-len - throw new Error(`If you configure PRIVATE subnets in 'subnetConfiguration', you must also configure PUBLIC subnets to put the NAT gateways into (got ${JSON.stringify(subnetConfig)}.`); - } - - return count; -} - -/** - * There are returned when the provider has not supplied props yet - * - * It's only used for testing and on the first run-through. - */ -const DUMMY_VPC_PROPS: cxapi.VpcContextResponse = { - availabilityZones: [], - vpcCidrBlock: '1.2.3.4/5', - isolatedSubnetIds: undefined, - isolatedSubnetNames: undefined, - isolatedSubnetRouteTableIds: undefined, - privateSubnetIds: undefined, - privateSubnetNames: undefined, - privateSubnetRouteTableIds: undefined, - publicSubnetIds: undefined, - publicSubnetNames: undefined, - publicSubnetRouteTableIds: undefined, - subnetGroups: [ - { - name: 'Public', - type: cxapi.VpcSubnetGroupType.PUBLIC, - subnets: [ - { - availabilityZone: 'dummy1a', - subnetId: 's-12345', - routeTableId: 'rtb-12345s', - cidr: '1.2.3.4/5', - }, - { - availabilityZone: 'dummy1b', - subnetId: 's-67890', - routeTableId: 'rtb-67890s', - cidr: '1.2.3.4/5', - }, - ], - }, - { - name: 'Private', - type: cxapi.VpcSubnetGroupType.PRIVATE, - subnets: [ - { - availabilityZone: 'dummy1a', - subnetId: 'p-12345', - routeTableId: 'rtb-12345p', - cidr: '1.2.3.4/5', - }, - { - availabilityZone: 'dummy1b', - subnetId: 'p-67890', - routeTableId: 'rtb-57890p', - cidr: '1.2.3.4/5', - }, - ], - }, - { - name: 'Isolated', - type: cxapi.VpcSubnetGroupType.ISOLATED, - subnets: [ - { - availabilityZone: 'dummy1a', - subnetId: 'p-12345', - routeTableId: 'rtb-12345p', - cidr: '1.2.3.4/5', - }, - { - availabilityZone: 'dummy1b', - subnetId: 'p-67890', - routeTableId: 'rtb-57890p', - cidr: '1.2.3.4/5', - }, - ], - }, - ], - vpcId: 'vpc-12345', -}; diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json deleted file mode 100644 index 83b78f1dacaf2..0000000000000 --- a/packages/@aws-cdk/aws-ec2/package.json +++ /dev/null @@ -1,864 +0,0 @@ -{ - "name": "@aws-cdk/aws-ec2", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::EC2", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ec2", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ec2" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.EC2", - "packageId": "Amazon.CDK.AWS.EC2", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ec2", - "module": "aws_cdk.aws_ec2", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ec2" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::EC2", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ec2" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "resource-attribute:@aws-cdk/aws-ec2.NetworkAclEntry.networkAclEntryId", - "resource-attribute:@aws-cdk/aws-ec2.ISecurityGroup.securityGroupVpcId", - "no-unused-type:@aws-cdk/aws-ec2.ConnectionRule", - "no-unused-type:@aws-cdk/aws-ec2.Protocol", - "no-unused-type:@aws-cdk/aws-ec2.VpcEndpointType", - "no-unused-type:@aws-cdk/aws-ec2.VpnConnectionType", - "props-physical-name:@aws-cdk/aws-ec2.VpnConnectionProps", - "props-physical-name:@aws-cdk/aws-ec2.GatewayVpcEndpointProps", - "props-physical-name:@aws-cdk/aws-ec2.PrivateSubnetProps", - "props-physical-name:@aws-cdk/aws-ec2.PublicSubnetProps", - "props-physical-name:@aws-cdk/aws-ec2.SubnetProps", - "props-physical-name:@aws-cdk/aws-ec2.VpcProps", - "props-physical-name:@aws-cdk/aws-ec2.InterfaceVpcEndpointProps", - "props-physical-name:@aws-cdk/aws-ec2.VpcEndpointServiceProps", - "from-method:@aws-cdk/aws-ec2.Instance", - "from-method:@aws-cdk/aws-ec2.NetworkAclEntry", - "from-method:@aws-cdk/aws-ec2.VpcEndpointService", - "attribute-tag:@aws-cdk/aws-ec2.BastionHostLinux.instance", - "attribute-tag:@aws-cdk/aws-ec2.Instance.instance", - "from-signature:@aws-cdk/aws-ec2.SecurityGroup.fromSecurityGroupId", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_DEEP_LEARNING", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_CHINESE_TRADITIONAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_RUSSIAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_KOREAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_HYPERV", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_SWEDISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_PORTUGESE_PORTUGAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_PORTUGUESE_PORTUGAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_SPANISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_P3", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SHAREPOINT_2010_SP2_FOUNDATION", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_PORTUGESE_BRAZIL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_PORTUGUESE_BRAZIL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_DUTCH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_KOREAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_DUTCH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_CZECH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGESE_PORTUGAL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_PORTUGESE_BRAZIL_32BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_PORTUGUESE_BRAZIL_32BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_61BIT_SQL_2012_RTM_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_1709_ENGLISH_CORE_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_SPANISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_POLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_TURKISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_SQL_2005_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_1809_ENGLISH_CORE_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_1809_ENGLISH_CORE_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_CZECH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_FRENCH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2008_R2_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_SQL_2005_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_GERMAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2016_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2019_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_PORTUGUESE_BRAZIL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ITALIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_RUSSIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2019_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_POLISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_CORE_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_HUNGARIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2017_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_GERMAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_CORE_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2019_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2017_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2017_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_KOREAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2017_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2019_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_CHINESE_SIMPLIFIED_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2019_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_SPANISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_CORE_ECS_OPTIMIZED", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2017_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_CHINESE_TRADITIONAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2019_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_FRENCH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2017_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2019_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_TURKISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_SQL_2017_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_PORTUGUESE_PORTUGAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_CZECH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_ECS_OPTIMIZED", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_DUTCH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2022_SWEDISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.AclCidr.toCidrConfig", - "docs-public-apis:@aws-cdk/aws-ec2.AclTraffic.toTrafficConfig", - "docs-public-apis:@aws-cdk/aws-ec2.Connections.connections", - "docs-public-apis:@aws-cdk/aws-ec2.Connections.securityGroups", - "docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpoint.vpcEndpointDnsEntries", - "docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpoint.vpcEndpointNetworkInterfaceIds", - "docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpoint.fromGatewayVpcEndpointId", - "docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService.DYNAMODB", - "docs-public-apis:@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService.S3", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ACCESS_ANALYZER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ACCOUNT_MANAGEMENT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APIGATEWAY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APP_MESH", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APP_RUNNER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APPLICATION_AUTOSCALING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APPLICATION_MIGRATION_SERVICE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUDIT_MANAGER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUTOSCALING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AUTOSCALING_PLANS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ATHENA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BILLING_CONDUCTOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BRAKET", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUD_DIRECTORY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDFORMATION", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDHSM", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDTRAIL", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_EVENTS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_LOGS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEARTIFACT_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEARTIFACT_REPOSITORIES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEBUILD", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEBUILD_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODECOMMIT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODECOMMIT_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODECOMMIT_GIT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODECOMMIT_GIT_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEGURU_PROFILER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEGURU_REVIEWER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEPIPELINE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODESTAR_CONNECTIONS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONNECT_CASES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONFIG", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.COMPREHEND", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.COMPREHEND_MEDICAL", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.DATA_EXCHANGE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.DATASYNC", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.DEVOPS_GURU", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BATCH", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EBS_DIRECT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EC2", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EC2_MESSAGES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECS_AGENT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ECS_TELEMETRY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EKS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTICACHE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_DISASTER_RECOVERY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_FILESYSTEM", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_FILESYSTEM_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_INFERENCE_RUNTIME", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_LOAD_BALANCING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EMR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EMR_EKS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EMR_SERVERLESS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FAULT_INJECTION_SIMULATOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FRAUD_DETECTOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.GLUE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.GLUE_DATABREW", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.GRAFANA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.GRAFANA_WORKSPACE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.GROUNDSTATION", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KENDRA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KENDRA_RANKING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KEYSPACES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KINESIS_STREAMS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KINESIS_FIREHOSE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KMS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KMS_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.HEALTHLAKE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IAM_IDENTITY_CENTER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IAM_ROLES_ANYWHERE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IMAGE_BUILDER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.INSPECTOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_CORE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_GREENGRASS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_CORE_DEVICE_ADVISOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_ROBORUNNER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.OMICS_ANALYTICS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.OMICS_CONTROL_STORAGE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.OMICS_STORAGE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.OMICS_TAGS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.OMICS_WORKFLOWS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PRIVATE_CERTIFICATE_AUTHORITY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.POLLY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PRIVATE_5G", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.RDS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.RDS_DATA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.S3", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_NOTEBOOK", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_RUNTIME", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_RUNTIME_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_STUDIO", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SERVICE_CATALOG", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SNS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SQS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SSM", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SSM_MESSAGES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.STS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TEXTRACT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TEXTRACT_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TRANSFER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.STORAGE_GATEWAY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.REKOGNITION", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.REKOGNITION_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ROBOMAKER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.S3_OUTPOSTS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.S3_MULTI_REGION_ACCESS_POINTS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_METRICS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SNOW_DEVICE_MANAGEMENT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.STEP_FUNCTIONS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LAMBDA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TRANSCRIBE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.XRAY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SECURITYHUB", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EMAIL_SMTP", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.WORKSPACES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AIRFLOW_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AIRFLOW_ENV", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.AIRFLOW_OPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APP_RUNNER_REQUESTS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APPSTREAM_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.APPSTREAM_STREAMING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BACKUP", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.BACKUP_GATEWAY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUD_CONTROL_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUD_CONTROL_API_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_EVIDENTLY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_EVIDENTLY_DATAPLANE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_MONITORING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_RUM", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_RUM_DATAPLANE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CLOUDWATCH_SYNTHETICS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEDEPLOY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CODEDEPLOY_COMMANDS_SECURE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONNECT_APP_INTEGRATIONS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONNECT_CONNECT_CAMPAIGNS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONNECT_PROFILE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONNECT_VOICEID", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.CONNECT_WISDOM", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.DATABASE_MIGRATION_SERVICE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.DATABASE_MIGRATION_SERVICE_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_BEANSTALK", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTIC_BEANSTALK_HEALTH", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.ELASTICACHE_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.EVENTBRIDGE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FINSPACE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FINSPACE_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FORECAST", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FORECAST_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FORECAST_QUERY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FORECAST_QUERY_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FSX", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.FSX_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_CORE_FOR_LORAWAN", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_LORAWAN_CUPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_LORAWAN_LNS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_SITEWISE_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_SITEWISE_DATA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_TWINMAKER_API", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.IOT_TWINMAKER_DATA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.KEYSPACES_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LAKE_FORMATION", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LEX_MODELS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LEX_RUNTIME", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LICENSE_MANAGER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LICENSE_MANAGER_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LOOKOUT_EQUIPMENT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LOOKOUT_METRICS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.LOOKOUT_VISION", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MACIE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MAINFRAME_MODERNIZATION", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MEMORY_DB", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MEMORY_DB_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MIGRATIONHUB_ORCHESTRATOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MIGRATIONHUB_REFACTOR_SPACES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.MIGRATIONHUB_STRATEGY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.NIMBLE_STUDIO", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PANORAMA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PINPOINT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PROMETHEUS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PROMETHEUS_WORKSPACES", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.PROTON", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.QLDB", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.REDSHIFT", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.REDSHIFT_DATA", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.REDSHIFT_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SAGEMAKER_FEATURESTORE_RUNTIME", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SERVER_MIGRATION_SERVICE", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SERVER_MIGRATION_SERVICE_AWSCONNECTOR", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SERVER_MIGRATION_SERVICE_FIPS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SERVICE_CATALOG_APPREGISTRY", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SSM_CONTACTS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.SSM_INCIDENTS", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.STEP_FUNCTIONS_SYNC", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TRANSCRIBE_STREAMING", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TRANSFER_SERVER", - "docs-public-apis:@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService.TRANSLATE", - "docs-public-apis:@aws-cdk/aws-ec2.LogFormat.value", - "docs-public-apis:@aws-cdk/aws-ec2.Port.toString", - "docs-public-apis:@aws-cdk/aws-ec2.PrivateSubnet.fromPrivateSubnetAttributes", - "docs-public-apis:@aws-cdk/aws-ec2.PublicSubnet.fromPublicSubnetAttributes", - "docs-public-apis:@aws-cdk/aws-ec2.SecurityGroup.connections", - "docs-public-apis:@aws-cdk/aws-ec2.SecurityGroup.defaultPort", - "docs-public-apis:@aws-cdk/aws-ec2.Subnet.subnetAvailabilityZone", - "docs-public-apis:@aws-cdk/aws-ec2.Subnet.subnetIpv6CidrBlocks", - "docs-public-apis:@aws-cdk/aws-ec2.Subnet.subnetNetworkAclAssociationId", - "docs-public-apis:@aws-cdk/aws-ec2.Subnet.subnetVpcId", - "docs-public-apis:@aws-cdk/aws-ec2.Subnet.fromSubnetAttributes", - "docs-public-apis:@aws-cdk/aws-ec2.Subnet.isVpcSubnet", - "docs-public-apis:@aws-cdk/aws-ec2.SubnetNetworkAclAssociation", - "docs-public-apis:@aws-cdk/aws-ec2.SubnetNetworkAclAssociation.fromSubnetNetworkAclAssociationAssociationId", - "docs-public-apis:@aws-cdk/aws-ec2.UserData.forOperatingSystem", - "docs-public-apis:@aws-cdk/aws-ec2.Vpc.vpcCidrBlock", - "docs-public-apis:@aws-cdk/aws-ec2.Vpc.vpcCidrBlockAssociations", - "docs-public-apis:@aws-cdk/aws-ec2.Vpc.vpcDefaultNetworkAcl", - "docs-public-apis:@aws-cdk/aws-ec2.Vpc.vpcDefaultSecurityGroup", - "docs-public-apis:@aws-cdk/aws-ec2.Vpc.vpcIpv6CidrBlocks", - "docs-public-apis:@aws-cdk/aws-ec2.VpcEndpoint", - "props-default-doc:@aws-cdk/aws-ec2.AclCidrConfig.cidrBlock", - "props-default-doc:@aws-cdk/aws-ec2.AclCidrConfig.ipv6CidrBlock", - "props-default-doc:@aws-cdk/aws-ec2.AclIcmp.code", - "props-default-doc:@aws-cdk/aws-ec2.AclIcmp.type", - "props-default-doc:@aws-cdk/aws-ec2.AclPortRange.from", - "props-default-doc:@aws-cdk/aws-ec2.AclPortRange.to", - "docs-public-apis:@aws-cdk/aws-ec2.ConnectionRule", - "docs-public-apis:@aws-cdk/aws-ec2.IInstance", - "docs-public-apis:@aws-cdk/aws-ec2.IPrivateSubnet", - "docs-public-apis:@aws-cdk/aws-ec2.IPublicSubnet", - "docs-public-apis:@aws-cdk/aws-ec2.ISecurityGroup", - "docs-public-apis:@aws-cdk/aws-ec2.ISubnet", - "docs-public-apis:@aws-cdk/aws-ec2.IVpc", - "docs-public-apis:@aws-cdk/aws-ec2.IVpnConnection", - "docs-public-apis:@aws-cdk/aws-ec2.PrivateSubnetAttributes", - "docs-public-apis:@aws-cdk/aws-ec2.PrivateSubnetProps", - "docs-public-apis:@aws-cdk/aws-ec2.PublicSubnetAttributes", - "docs-public-apis:@aws-cdk/aws-ec2.PublicSubnetProps", - "docs-public-apis:@aws-cdk/aws-ec2.SecurityGroupProps", - "docs-public-apis:@aws-cdk/aws-ec2.SubnetAttributes", - "props-default-doc:@aws-cdk/aws-ec2.SubnetAttributes.routeTableId", - "props-default-doc:@aws-cdk/aws-ec2.SubnetSelection.subnetName", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.isolatedSubnetIds", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.isolatedSubnetNames", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.isolatedSubnetRouteTableIds", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.privateSubnetIds", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.privateSubnetNames", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.privateSubnetRouteTableIds", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.publicSubnetIds", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.publicSubnetNames", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.publicSubnetRouteTableIds", - "props-default-doc:@aws-cdk/aws-ec2.VpcAttributes.vpnGatewayId", - "docs-public-apis:@aws-cdk/aws-ec2.VpnConnectionOptions", - "docs-public-apis:@aws-cdk/aws-ec2.VpnConnectionProps", - "docs-public-apis:@aws-cdk/aws-ec2.VpnTunnelOption", - "docs-public-apis:@aws-cdk/aws-ec2.AmazonLinuxStorage", - "docs-public-apis:@aws-cdk/aws-ec2.OperatingSystemType.LINUX", - "docs-public-apis:@aws-cdk/aws-ec2.OperatingSystemType.WINDOWS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.AH", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ALL", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ANY_0_HOP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ANY_DFS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ANY_ENC", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ANY_LOCAL", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ARIS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.AX_25", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.A_N", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.BBN_RCC_MON", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.BNA", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.BR_SAT_MON", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CBT", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CFTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CHAOS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.COMPAQ_PEER", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CPHB", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CPNX", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CRTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.CRUDP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.DCCP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.DCN_MEAS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.DDP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.DDX", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.DGP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.DSR", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.EGP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.EIGRP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.EMCON", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ENCAP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ESP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ETHERIP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ETHERNET", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.EXPERIMENT_1", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.EXPERIMENT_2", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.FC", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.FIRE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.GGP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.GMTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.GRE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.HIP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.HMP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.HOPOPT", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IATP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ICMP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ICMPV6", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IDPR", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IDPR_CMTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IDRP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IFMP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IGMP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IGP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IL", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPCOMP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPCV", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPIP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPLT", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPPC", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPTM", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPV4", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPV6", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPV6_FRAG", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPV6_NONXT", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPV6_OPTS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPV6_ROUTE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IPX_IN_IP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.IRTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ISIS_IPV4", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ISO_IP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ISO_TP4", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.I_NLSP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.KRYPTOLAN", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.L2_T_P", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.LARP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.LEAF_1", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.LEAF_2", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MANET", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MERIT_INP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MFE_NSP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MICP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MOBILE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MOBILITY_HEADER", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MPLS_IN_IP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.MUX", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.NARP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.NETBLT", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.NSFNET_IGP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.NVP_II", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.OSPFIGP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PGM", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PIM", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PIPE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PNNI", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PRM", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PUP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.PVP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.QNX", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.RDP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.RESERVED", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ROHC", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.RSVP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.RSVP_E2E_IGNORE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.RVD", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SAT_EXPAK", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SAT_MON", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SCC_SP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SCPS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SCTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SDRP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SECURE_VMTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SHIM6", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SKIP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SM", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SMP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SNP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SPRITE_RPC", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SPS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SRP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SSCOPMCE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.ST", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.STP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SUN_ND", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.SWIPE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TCF", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TCP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.THREEPC", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TLSP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TPPLUSPLUS", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TRUNK_1", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TRUNK_2", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.TTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.UDP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.UDPLITE", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.UTI", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.VINES", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.VISA", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.VMTP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.VRRP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.WB_EXPAK", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.WB_MON", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.WESP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.WSN", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.XNET", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.XNS_IDP", - "docs-public-apis:@aws-cdk/aws-ec2.Protocol.XTP", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_CHINESE_SIMPLIFIED_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_DUTCH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_HUNGARIAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_GERMAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_GERMAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_32BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_SP1_PORTUGESE_BRAZIL_64BIT_CORE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_SP1_PORTUGUESE_BRAZIL_64BIT_CORE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ITALIAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ITALIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_KOREAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_FQL_2016_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_KOREAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_PORTUGESE_PORTUGAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_PORTUGUESE_PORTUGAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_FRENCH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_KOREAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_CHINESE_HONG_KONG_SAR_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_CHINESE_PRC_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_FRENCH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_CONTAINERS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_RUSSIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_CHINESE_SIMPLIFIED_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_HUNGARIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2007_R2_SP1_LANGUAGE_PACKS_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_ENGLISH_32BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_CHINESE_TRADITIONAL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2008_R2_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_POLISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_DEEP_LEARNING", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_GERMAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_RUSSIAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_CHINESE_TRADITIONAL_HONG_KONG_SAR_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_HUNGARIAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_HYPERV", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_SQL_2005_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_GERMAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2008_R2_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_JAPANESE_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_RUSSIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ITALIAN_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_HYPERV", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_CHINESE_TRADITIONAL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_CORE_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_CORE_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_FRENCH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_POLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_2012_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_TURKISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_PORTUGAL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_SWEDISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ITALIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_SPANISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_SQL_2005_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2007_R2_SP3_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_PORTUGESE_BRAZIL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_PORTUGUESE_BRAZIL_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_ENGLISH_32BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_CZECH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_SWEDISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_TURKISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE_SQL_2012_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_CZECH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_TURKISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_DUTCH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_HUNGARIAN_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP1_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_SPANISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_SP2_PORTUGESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_SP2_PORTUGUESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_1709_ENGLISH_CORE_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_1803_ENGLISH_CORE_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGUESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_P3", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_HONG_KONG_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_CHINESE_SIMPLIFIED_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_EXPRESS", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_1803_ENGLISH_CORE_CONTAINERSLATEST", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2012_SP4_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_CORE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_ENTERPRISE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_STANDARD", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_2014_SP3_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2012_RTM_SWEDISH_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2016_CHINESE_SIMPLIFIED_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2019_POLISH_FULL_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_WEB", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_PORTUGESE_BRAZIL_64BIT_BASE", - "docs-public-apis:@aws-cdk/aws-ec2.WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_PORTUGUESE_BRAZIL_64BIT_BASE", - "props-default-doc:@aws-cdk/aws-ec2.InterfaceVpcEndpointAttributes.securityGroupId", - "props-default-doc:@aws-cdk/aws-ec2.InterfaceVpcEndpointAttributes.securityGroups", - "props-physical-name:@aws-cdk/aws-ec2.VpnGatewayProps", - "props-physical-name:@aws-cdk/aws-ec2.ClientVpnEndpointProps", - "props-physical-name:@aws-cdk/aws-ec2.ClientVpnAuthorizationRuleProps", - "props-physical-name:@aws-cdk/aws-ec2.ClientVpnRouteProps", - "duration-prop-type:@aws-cdk/aws-ec2.ClientVpnEndpointOptions.sessionTimeout", - "duration-prop-type:@aws-cdk/aws-ec2.ClientVpnEndpointProps.sessionTimeout", - "resource-attribute:@aws-cdk/aws-ec2.VpnGateway.vpnGatewayId", - "docs-public-apis:@aws-cdk/aws-ec2.LogFormatField.value" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ec2/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ec2/rosetta/default.ts-fixture deleted file mode 100644 index df2d29f125b46..0000000000000 --- a/packages/@aws-cdk/aws-ec2/rosetta/default.ts-fixture +++ /dev/null @@ -1,18 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Aspects, Construct, Duration, Fn, Size, Stack, StackProps } from '@aws-cdk/core'; -import ec2 = require('@aws-cdk/aws-ec2'); -import s3 = require('@aws-cdk/aws-s3'); -import iam = require('@aws-cdk/aws-iam'); -import logs = require('@aws-cdk/aws-logs'); -import ssm = require('@aws-cdk/aws-ssm'); -import autoscaling = require('@aws-cdk/aws-autoscaling'); -import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2'); -import rds = require('@aws-cdk/aws-rds'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-ec2/test/aspects/require-imdsv2-aspect.test.ts b/packages/@aws-cdk/aws-ec2/test/aspects/require-imdsv2-aspect.test.ts deleted file mode 100644 index 80d5a7165391f..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/aspects/require-imdsv2-aspect.test.ts +++ /dev/null @@ -1,209 +0,0 @@ -import { Annotations, Template, Match } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { - CfnLaunchTemplate, - Instance, - InstanceRequireImdsv2Aspect, - InstanceType, - LaunchTemplate, - LaunchTemplateRequireImdsv2Aspect, - MachineImage, - Vpc, -} from '../../lib'; - -describe('RequireImdsv2Aspect', () => { - let app: cdk.App; - let stack: cdk.Stack; - let vpc: Vpc; - - beforeEach(() => { - app = new cdk.App(); - stack = new cdk.Stack(app, 'Stack'); - vpc = new Vpc(stack, 'Vpc'); - }); - - test('suppresses warnings', () => { - // GIVEN - const aspect = new LaunchTemplateRequireImdsv2Aspect({ - suppressWarnings: true, - }); - const errmsg = 'ERROR'; - const visitMock = jest.spyOn(aspect, 'visit').mockImplementation((node) => { - // @ts-ignore - aspect.warn(node, errmsg); - }); - const construct = new Construct(stack, 'Construct'); - - // WHEN - aspect.visit(construct); - - // THEN - expect(visitMock).toHaveBeenCalled(); - Annotations.fromStack(stack).hasNoWarning('/Stack/Construct', errmsg); - }); - - describe('InstanceRequireImdsv2Aspect', () => { - test('requires IMDSv2', () => { - // GIVEN - const instance = new Instance(stack, 'Instance', { - vpc, - instanceType: new InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }); - const aspect = new InstanceRequireImdsv2Aspect(); - - // WHEN - cdk.Aspects.of(stack).add(aspect); - app.synth(); - - // THEN - const launchTemplate = instance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; - expect(launchTemplate).toBeDefined(); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::LaunchTemplate', { - LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), - LaunchTemplateData: { - MetadataOptions: { - HttpTokens: 'required', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - LaunchTemplate: { - LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), - }, - }); - }); - - test('does not toggle when Instance has a LaunchTemplate', () => { - // GIVEN - const instance = new Instance(stack, 'Instance', { - vpc, - instanceType: new InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }); - instance.instance.launchTemplate = { - launchTemplateName: 'name', - version: 'version', - }; - const aspect = new InstanceRequireImdsv2Aspect(); - - // WHEN - cdk.Aspects.of(stack).add(aspect); - - // THEN - // Aspect normally creates a LaunchTemplate for the Instance to toggle IMDSv1, - // so we can assert that one was not created - Template.fromStack(stack).resourceCountIs('AWS::EC2::LaunchTemplate', 0); - Annotations.fromStack(stack).hasWarning('/Stack/Instance', Match.stringLikeRegexp('.*Cannot toggle IMDSv1 because this Instance is associated with an existing Launch Template.')); - }); - - test('suppresses Launch Template warnings', () => { - // GIVEN - const instance = new Instance(stack, 'Instance', { - vpc, - instanceType: new InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }); - instance.instance.launchTemplate = { - launchTemplateName: 'name', - version: 'version', - }; - const aspect = new InstanceRequireImdsv2Aspect({ - suppressLaunchTemplateWarning: true, - }); - - // WHEN - aspect.visit(instance); - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Stack/Instance', 'Cannot toggle IMDSv1 because this Instance is associated with an existing Launch Template.'); - }); - - test('launch template name is unique with feature flag', () => { - // GIVEN - const app2 = new cdk.App(); - const otherStack = new cdk.Stack(app2, 'OtherStack'); - const otherVpc = new Vpc(otherStack, 'OtherVpc'); - const otherInstance = new Instance(otherStack, 'OtherInstance', { - vpc: otherVpc, - instanceType: new InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }); - const imdsv2Stack = new cdk.Stack(app2, 'RequireImdsv2Stack'); - const imdsv2Vpc = new Vpc(imdsv2Stack, 'Vpc'); - const instance = new Instance(imdsv2Stack, 'Instance', { - vpc: imdsv2Vpc, - instanceType: new InstanceType('t2.micro'), - machineImage: MachineImage.latestAmazonLinux(), - }); - const aspect = new InstanceRequireImdsv2Aspect(); - - // WHEN - cdk.Aspects.of(imdsv2Stack).add(aspect); - cdk.Aspects.of(otherStack).add(aspect); - app2.synth(); - - // THEN - const launchTemplate = instance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; - const otherLaunchTemplate = otherInstance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; - expect(launchTemplate).toBeDefined(); - expect(otherLaunchTemplate).toBeDefined(); - expect(launchTemplate.launchTemplateName !== otherLaunchTemplate.launchTemplateName); - }); - }); - - describe('LaunchTemplateRequireImdsv2Aspect', () => { - test('warns when LaunchTemplateData is a CDK token', () => { - // GIVEN - const launchTemplate = new LaunchTemplate(stack, 'LaunchTemplate'); - const cfnLaunchTemplate = launchTemplate.node.tryFindChild('Resource') as CfnLaunchTemplate; - cfnLaunchTemplate.launchTemplateData = cdk.Token.asAny({ - kernelId: 'asfd', - } as CfnLaunchTemplate.LaunchTemplateDataProperty); - const aspect = new LaunchTemplateRequireImdsv2Aspect(); - - // WHEN - aspect.visit(launchTemplate); - - // THEN - Annotations.fromStack(stack).hasWarning('/Stack/LaunchTemplate', Match.stringLikeRegexp('.*LaunchTemplateData is a CDK token.')); - }); - - test('warns when MetadataOptions is a CDK token', () => { - // GIVEN - const launchTemplate = new LaunchTemplate(stack, 'LaunchTemplate'); - const cfnLaunchTemplate = launchTemplate.node.tryFindChild('Resource') as CfnLaunchTemplate; - cfnLaunchTemplate.launchTemplateData = { - metadataOptions: cdk.Token.asAny({ - httpEndpoint: 'http://bla', - } as CfnLaunchTemplate.MetadataOptionsProperty), - } as CfnLaunchTemplate.LaunchTemplateDataProperty; - const aspect = new LaunchTemplateRequireImdsv2Aspect(); - - // WHEN - aspect.visit(launchTemplate); - - // THEN - Annotations.fromStack(stack).hasWarning('/Stack/LaunchTemplate', Match.stringLikeRegexp('.*LaunchTemplateData.MetadataOptions is a CDK token.')); - }); - - test('requires IMDSv2', () => { - // GIVEN - new LaunchTemplate(stack, 'LaunchTemplate'); - const aspect = new LaunchTemplateRequireImdsv2Aspect(); - - // WHEN - cdk.Aspects.of(stack).add(aspect); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::LaunchTemplate', { - LaunchTemplateData: { - MetadataOptions: { - HttpTokens: 'required', - }, - }, - }); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-ec2/test/cfn-init.test.ts b/packages/@aws-cdk/aws-ec2/test/cfn-init.test.ts deleted file mode 100644 index f094f9b6b5390..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/cfn-init.test.ts +++ /dev/null @@ -1,682 +0,0 @@ -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { AssetStaging, App, Aws, CfnResource, Stack, DefaultStackSynthesizer, IStackSynthesizer, FileAssetSource, FileAssetLocation } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { stringLike } from './util'; -import * as ec2 from '../lib'; - -let app: App; -let stack: Stack; -let instanceRole: iam.Role; -let resource: CfnResource; -let linuxUserData: ec2.UserData; -let signalResource: CfnResource; - -function resetState() { - resetStateWithSynthesizer(); -} - -function resetStateWithSynthesizer(customSynthesizer?: IStackSynthesizer) { - app = new App({ - context: { - [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false, - }, - }); - stack = new Stack(app, 'Stack', { - env: { account: '1234', region: 'testregion' }, - synthesizer: customSynthesizer, - }); - instanceRole = new iam.Role(stack, 'InstanceRole', { - assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), - }); - resource = new CfnResource(stack, 'Resource', { - type: 'CDK::Test::Resource', - }); - signalResource = new CfnResource(stack, 'SignalResource', { - type: 'CDK::Test::Resource', - }); - linuxUserData = ec2.UserData.forLinux(); -}; - -beforeEach(resetState); - -test('whole config with restart handles', () => { - // WHEN - const handle = new ec2.InitServiceRestartHandle(); - const config = new ec2.InitConfig([ - ec2.InitFile.fromString('/etc/my.cnf', '[mysql]\ngo_fast=true', { serviceRestartHandles: [handle] }), - ec2.InitSource.fromUrl('/tmp/foo', 'https://amazon.com/foo.zip', { serviceRestartHandles: [handle] }), - ec2.InitPackage.yum('httpd', { serviceRestartHandles: [handle] }), - ec2.InitCommand.argvCommand(['/bin/true'], { serviceRestartHandles: [handle] }), - ec2.InitService.enable('httpd', { serviceRestartHandle: handle }), - ]); - - // THEN - expect(config._bind(stack, linuxOptions()).config).toEqual(expect.objectContaining({ - services: { - sysvinit: { - httpd: { - enabled: true, - ensureRunning: true, - commands: ['000'], - files: ['/etc/my.cnf'], - packages: { - yum: ['httpd'], - }, - sources: ['/tmp/foo'], - }, - }, - }, - })); -}); - -test('CloudFormationInit can be added to after instantiation', () => { - // GIVEN - const config = new ec2.InitConfig([]); - const init = ec2.CloudFormationInit.fromConfig(config); - - // WHEN - config.add(ec2.InitCommand.argvCommand(['/bin/true'])); - init.attach(resource, linuxOptions()); - - // THEN - expectMetadataLike({ - 'AWS::CloudFormation::Init': { - config: { - commands: { - '000': { command: ['/bin/true'] }, - }, - }, - }, - }); -}); - -test('CloudFormationInit cannot be attached twice', () => { - // GIVEN - const init = ec2.CloudFormationInit.fromElements(); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - expect(() => { init.attach(resource, linuxOptions()); }).toThrow(/already has/); -}); - -test('empty configs are not rendered', () => { - // GIVEN - const config1 = new ec2.InitConfig([]); - const config2 = new ec2.InitConfig([ - ec2.InitCommand.argvCommand(['/bin/true']), - ]); - - // WHEN - const init = ec2.CloudFormationInit.fromConfigSets({ - configSets: { default: ['config2', 'config1'] }, - configs: { config1, config2 }, - }); - init.attach(resource, linuxOptions()); - - // THEN - expectMetadataLike({ - 'AWS::CloudFormation::Init': { - configSets: { - default: ['config2'], - }, - config2: { - commands: { - '000': { command: ['/bin/true'] }, - }, - }, - }, - }); -}); - -describe('userdata', () => { - let simpleInit: ec2.CloudFormationInit; - beforeEach(() => { - simpleInit = ec2.CloudFormationInit.fromElements( - ec2.InitCommand.argvCommand(['/bin/true']), - ); - }); - - function linuxUserDataTest(signalLogicalId: string) { - const lines = linuxUserData.render().split('\n'); - expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`)); - expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`)); - expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`)); - expectLine(lines, cmdArg('cfn-init', '-c default')); - expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`)); - expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`)); - expectLine(lines, cmdArg('cfn-signal', `--resource ${signalLogicalId}`)); - expectLine(lines, cmdArg('cfn-signal', '-e $?')); - expectLine(lines, cmdArg('cat', 'cfn-init.log')); - expectLine(lines, /fingerprint/); - } - - function windowsUserDataTest( - windowsUserData: ec2.UserData, - signalLogicalId: string, - ) { - const lines = windowsUserData.render().split('\n'); - expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`)); - expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`)); - expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`)); - expectLine(lines, cmdArg('cfn-init', '-c default')); - expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`)); - expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`)); - expectLine(lines, cmdArg('cfn-signal', `--resource ${signalLogicalId}`)); - expectLine(lines, cmdArg('cfn-signal', '-e $LASTEXITCODE')); - expectLine(lines, cmdArg('type', 'cfn-init.log')); - expectLine(lines, /fingerprint/); - } - - test('linux userdata contains right commands', () => { - // WHEN - simpleInit.attach(resource, linuxOptions()); - - // THEN - linuxUserDataTest(resource.logicalId); - }); - - test('linux userdata contains right commands with different signal resource', () => { - // WHEN - simpleInit.attach(resource, { - ...linuxOptions(), - signalResource, - }); - - // THEN - linuxUserDataTest(signalResource.logicalId); - }); - - test('linux userdata contains right commands when url and role included', () => { - // WHEN - simpleInit.attach(resource, { - platform: ec2.OperatingSystemType.LINUX, - instanceRole, - includeUrl: true, - includeRole: true, - userData: linuxUserData, - }); - - // THEN - const lines = linuxUserData.render().split('\n'); - expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`)); - expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`)); - expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`)); - expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole.roleName}`)); - expectLine(lines, cmdArg('cfn-init', `--url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`)); - expectLine(lines, cmdArg('cfn-init', '-c default')); - expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`)); - expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`)); - expectLine(lines, cmdArg('cfn-signal', `--resource ${resource.logicalId}`)); - expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole.roleName}`)); - expectLine(lines, cmdArg('cfn-init', `--url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`)); - expectLine(lines, cmdArg('cfn-signal', '-e $?')); - expectLine(lines, cmdArg('cat', 'cfn-init.log')); - expectLine(lines, /fingerprint/); - }); - - test('Windows userdata contains right commands', () => { - // WHEN - const windowsUserData = ec2.UserData.forWindows(); - - simpleInit.attach(resource, { - platform: ec2.OperatingSystemType.WINDOWS, - instanceRole, - userData: windowsUserData, - }); - - // THEN - windowsUserDataTest(windowsUserData, resource.logicalId); - }); - - test('Windows userdata contains right commands with different signal resource', () => { - // WHEN - const windowsUserData = ec2.UserData.forWindows(); - - simpleInit.attach(resource, { - platform: ec2.OperatingSystemType.WINDOWS, - instanceRole, - userData: windowsUserData, - signalResource, - }); - - // THEN - windowsUserDataTest(windowsUserData, signalResource.logicalId); - }); - - test('ignoreFailures disables result code reporting', () => { - // WHEN - simpleInit.attach(resource, { - ...linuxOptions(), - ignoreFailures: true, - }); - - // THEN - const lines = linuxUserData.render().split('\n'); - dontExpectLine(lines, cmdArg('cfn-signal', '-e $?')); - expectLine(lines, cmdArg('cfn-signal', '-e 0')); - }); - - test('can disable log printing', () => { - // WHEN - simpleInit.attach(resource, { - ...linuxOptions(), - printLog: false, - }); - - // THEN - const lines = linuxUserData.render().split('\n'); - dontExpectLine(lines, cmdArg('cat', 'cfn-init.log')); - }); - - test('can disable fingerprinting', () => { - // WHEN - simpleInit.attach(resource, { - ...linuxOptions(), - embedFingerprint: false, - }); - - // THEN - const lines = linuxUserData.render().split('\n'); - dontExpectLine(lines, /fingerprint/); - }); - - test('can request multiple different configsets to be used', () => { - // WHEN - simpleInit.attach(resource, { - ...linuxOptions(), - configSets: ['banana', 'peach'], - }); - - // THEN - const lines = linuxUserData.render().split('\n'); - expectLine(lines, cmdArg('cfn-init', '-c banana,peach')); - }); -}); - -const ASSET_STATEMENT = { - Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], - Effect: 'Allow', - Resource: [ - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':s3:::', - { Ref: stringLike(/AssetParameter.*S3Bucket.*/) }, - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':s3:::', - { Ref: stringLike(/AssetParameter.*S3Bucket.*/) }, - '/*', - ]], - }, - ], -}; - -describe('assets n buckets', () => { - - test.each([ - ['Existing'], - [''], - ])('InitFile.from%sAsset', (existing: string) => { - // GIVEN - const asset = new Asset(stack, 'Asset', { path: __filename }); - const init = ec2.CloudFormationInit.fromElements( - existing - ? ec2.InitFile.fromExistingAsset('/etc/fun.js', asset) - : ec2.InitFile.fromAsset('/etc/fun.js', __filename), - ); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([ASSET_STATEMENT]), - Version: '2012-10-17', - }, - }); - expectMetadataLike({ - 'AWS::CloudFormation::Init': { - config: { - files: { - '/etc/fun.js': { - source: { - 'Fn::Join': ['', [ - 'https://s3.testregion.', - { Ref: 'AWS::URLSuffix' }, - '/', - { Ref: stringLike(/AssetParameters.*/) }, - '/', - { 'Fn::Select': [0, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, - { 'Fn::Select': [1, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, - ]], - }, - }, - }, - }, - }, - 'AWS::CloudFormation::Authentication': { - S3AccessCreds: { - type: 'S3', - roleName: { Ref: 'InstanceRole3CCE2F1D' }, - buckets: [ - { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, - ], - }, - }, - }); - }); - - test.each([ - ['Existing'], - [''], - ])('InitSource.from%sAsset', (existing: string) => { - // GIVEN - const asset = new Asset(stack, 'Asset', { path: path.join(__dirname, 'asset-fixture') }); - const init = ec2.CloudFormationInit.fromElements( - existing - ? ec2.InitSource.fromExistingAsset('/etc/fun', asset) - : ec2.InitSource.fromAsset('/etc/fun', path.join(__dirname, 'asset-fixture')), - ); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([ASSET_STATEMENT]), - Version: '2012-10-17', - }, - }); - expectMetadataLike({ - 'AWS::CloudFormation::Init': { - config: { - sources: { - '/etc/fun': { - 'Fn::Join': ['', [ - 'https://s3.testregion.', - { Ref: 'AWS::URLSuffix' }, - '/', - { Ref: stringLike(/AssetParameters.*/) }, - '/', - { 'Fn::Select': [0, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, - { 'Fn::Select': [1, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, - ]], - }, - }, - }, - }, - 'AWS::CloudFormation::Authentication': { - S3AccessCreds: { - type: 'S3', - roleName: { Ref: 'InstanceRole3CCE2F1D' }, - buckets: [ - { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, - ], - }, - }, - }); - }); - - test('InitFile.fromS3Object', () => { - const bucket = s3.Bucket.fromBucketName(stack, 'Bucket', 'my-bucket'); - const init = ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromS3Object('/etc/fun.js', bucket, 'file.js'), - ); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], - Effect: 'Allow', - Resource: [ - { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket']] }, - { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket/file.js']] }, - ], - }]), - Version: '2012-10-17', - }, - }); - expectMetadataLike({ - 'AWS::CloudFormation::Init': { - config: { - files: { - '/etc/fun.js': { - source: { 'Fn::Join': ['', ['https://s3.testregion.', { Ref: 'AWS::URLSuffix' }, '/my-bucket/file.js']] }, - }, - }, - }, - }, - 'AWS::CloudFormation::Authentication': { - S3AccessCreds: { - type: 'S3', - roleName: { Ref: 'InstanceRole3CCE2F1D' }, - buckets: ['my-bucket'], - }, - }, - }); - }); - - test('InitSource.fromS3Object', () => { - const bucket = s3.Bucket.fromBucketName(stack, 'Bucket', 'my-bucket'); - const init = ec2.CloudFormationInit.fromElements( - ec2.InitSource.fromS3Object('/etc/fun', bucket, 'file.zip'), - ); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], - Effect: 'Allow', - Resource: [ - { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket']] }, - { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket/file.zip']] }, - ], - }]), - Version: '2012-10-17', - }, - }); - expectMetadataLike({ - 'AWS::CloudFormation::Init': { - config: { - sources: { - '/etc/fun': { 'Fn::Join': ['', ['https://s3.testregion.', { Ref: 'AWS::URLSuffix' }, '/my-bucket/file.zip']] }, - }, - }, - }, - 'AWS::CloudFormation::Authentication': { - S3AccessCreds: { - type: 'S3', - roleName: { Ref: 'InstanceRole3CCE2F1D' }, - buckets: ['my-bucket'], - }, - }, - }); - }); - - test('no duplication of bucket names when using multiple assets', () => { - // GIVEN - const init = ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromAsset('/etc/fun.js', __filename), - ec2.InitSource.fromAsset('/etc/fun', path.join(__dirname, 'asset-fixture')), - ); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - expectMetadataLike({ - 'AWS::CloudFormation::Authentication': { - S3AccessCreds: { - type: 'S3', - roleName: { Ref: 'InstanceRole3CCE2F1D' }, - buckets: Match.arrayWith([ - { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, - ]), - }, - }, - }); - }); - - test('multiple buckets appear in the same auth block', () => { - // GIVEN - const bucket = s3.Bucket.fromBucketName(stack, 'Bucket', 'my-bucket'); - const init = ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromS3Object('/etc/fun.js', bucket, 'file.js'), - ec2.InitSource.fromAsset('/etc/fun', path.join(__dirname, 'asset-fixture')), - ); - - // WHEN - init.attach(resource, linuxOptions()); - - // THEN - expectMetadataLike({ - 'AWS::CloudFormation::Authentication': { - S3AccessCreds: { - type: 'S3', - roleName: { Ref: 'InstanceRole3CCE2F1D' }, - buckets: Match.arrayWith([ - { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, - 'my-bucket', - ]), - }, - }, - }); - }); - - test('fingerprint data changes on asset hash update', () => { - function calculateFingerprint(assetFilePath: string): string | undefined { - resetState(); // Needed so the same resources/assets/filenames can be used. - AssetStaging.clearAssetHashCache(); // Needed so changing the content of the file will update the hash - const init = ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromAsset('/etc/myFile', assetFilePath), - ); - init.attach(resource, linuxOptions()); - - return linuxUserData.render().split('\n').find(line => line.match(/# fingerprint:/)); - } - - // Setup initial asset file - const assetFileDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cfn-init-test')); - const assetFilePath = path.join(assetFileDir, 'fingerprint-test'); - fs.writeFileSync(assetFilePath, 'hello'); - - const fingerprintOne = calculateFingerprint(assetFilePath); - const fingerprintOneAgain = calculateFingerprint(assetFilePath); - // Consistent without changes. - expect(fingerprintOneAgain).toEqual(fingerprintOne); - - // Change asset file content/hash - fs.writeFileSync(assetFilePath, ' world'); - - const fingerprintTwo = calculateFingerprint(assetFilePath); - - expect(fingerprintTwo).not.toEqual(fingerprintOne); - }); - - test('fingerprint data changes on existing asset update, even for assets with unchanging URLs', () => { - function calculateFingerprint(assetFilePath: string): string | undefined { - resetStateWithSynthesizer(new SingletonLocationSythesizer()); - AssetStaging.clearAssetHashCache(); // Needed so changing the content of the file will update the hash - const init = ec2.CloudFormationInit.fromElements( - ec2.InitFile.fromExistingAsset('/etc/myFile', new Asset(stack, 'FileAsset', { path: assetFilePath })), - ); - init.attach(resource, linuxOptions()); - - return linuxUserData.render().split('\n').find(line => line.match(/# fingerprint:/)); - } - - // Setup initial asset file - const assetFileDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cfn-init-test')); - const assetFilePath = path.join(assetFileDir, 'fingerprint-test'); - fs.writeFileSync(assetFilePath, 'hello'); - - const fingerprintOne = calculateFingerprint(assetFilePath); - const fingerprintOneAgain = calculateFingerprint(assetFilePath); - // Consistent without changes. - expect(fingerprintOneAgain).toEqual(fingerprintOne); - - // Change asset file content/hash - fs.writeFileSync(assetFilePath, ' world'); - - const fingerprintTwo = calculateFingerprint(assetFilePath); - - expect(fingerprintTwo).not.toEqual(fingerprintOne); - }); -}); - -function linuxOptions() { - return { - platform: ec2.OperatingSystemType.LINUX, - instanceRole, - userData: linuxUserData, - }; -} - -function expectMetadataLike(pattern: any) { - Template.fromStack(stack).hasResource('CDK::Test::Resource', { - Metadata: pattern, - }); -} - -function expectLine(lines: string[], re: RegExp) { - for (const line of lines) { - if (re.test(line)) { return; } - } - - throw new Error(`None of the lines matched '${re}': ${lines.join('\n')}`); -} - -function dontExpectLine(lines: string[], re: RegExp) { - try { - expectLine(lines, re); - } catch (e) { - return; - } - throw new Error(`Found unexpected line matching '${re}': ${lines.join('\n')}`); -} - -function cmdArg(command: string, argument: string) { - return new RegExp(`${escapeRegex(command)}(\.exe)? .*${escapeRegex(argument)}`); -} - -function escapeRegex(s: string) { - return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string -} - -/** Creates file assets that have a hard-coded asset url, rather than the default based on asset hash */ -class SingletonLocationSythesizer extends DefaultStackSynthesizer { - public addFileAsset(_asset: FileAssetSource): FileAssetLocation { - const httpUrl = 'https://MyBucket.s3.amazonaws.com/MyAsset'; - return { - bucketName: 'myassetbucket', - objectKey: 'MyAssetFile', - httpUrl, - s3ObjectUrl: httpUrl, - s3Url: httpUrl, - }; - } -} diff --git a/packages/@aws-cdk/aws-ec2/test/instance.test.ts b/packages/@aws-cdk/aws-ec2/test/instance.test.ts deleted file mode 100644 index 6329a65be5332..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/instance.test.ts +++ /dev/null @@ -1,627 +0,0 @@ -import * as path from 'path'; -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import { Key } from '@aws-cdk/aws-kms'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { StringParameter } from '@aws-cdk/aws-ssm'; -import { App, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { - AmazonLinuxImage, - BlockDeviceVolume, - CloudFormationInit, - EbsDeviceVolumeType, - InitCommand, - Instance, - InstanceArchitecture, - InstanceClass, - InstanceSize, - InstanceType, - LaunchTemplate, - UserData, - Vpc, -} from '../lib'; - -let stack: Stack; -let vpc: Vpc; -beforeEach(() => { - stack = new Stack(); - vpc = new Vpc(stack, 'VPC'); -}); - -describe('instance', () => { - test('instance is created with source/dest check switched off', () => { - // WHEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - sourceDestCheck: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - InstanceType: 't3.large', - SourceDestCheck: false, - }); - - - }); - test('instance is grantable', () => { - // GIVEN - const param = new StringParameter(stack, 'Param', { stringValue: 'Foobar' }); - const instance = new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - }); - - // WHEN - param.grantRead(instance); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'ssm:DescribeParameters', - 'ssm:GetParameters', - 'ssm:GetParameter', - 'ssm:GetParameterHistory', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':ssm:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':parameter/', - { - Ref: 'Param165332EC', - }, - ], - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - - }); - test('instance architecture is correctly discerned for arm instances', () => { - // GIVEN - const sampleInstanceClasses = [ - 'a1', 't4g', 'c6g', 'c7g', 'c6gd', 'c6gn', 'm6g', 'm6gd', 'm7g', 'r6g', 'r6gd', 'r7g', 'g5g', 'im4gn', 'is4gen', // current Graviton-based instance classes - 'a13', 't11g', 'y10ng', 'z11ngd', // theoretical future Graviton-based instance classes - ]; - - for (const instanceClass of sampleInstanceClasses) { - // WHEN - const instanceType = InstanceType.of(instanceClass as InstanceClass, InstanceSize.XLARGE18); - - // THEN - expect(instanceType.architecture).toBe(InstanceArchitecture.ARM_64); - } - - - }); - test('instance architecture is correctly discerned for x86-64 instance', () => { - // GIVEN - const sampleInstanceClasses = ['c5', 'm5ad', 'r5n', 'm6', 't3a', 'r6i', 'r6a', 'p4de']; // A sample of x86-64 instance classes - - for (const instanceClass of sampleInstanceClasses) { - // WHEN - const instanceType = InstanceType.of(instanceClass as InstanceClass, InstanceSize.XLARGE18); - - // THEN - expect(instanceType.architecture).toBe(InstanceArchitecture.X86_64); - } - - - }); - - test('instances with local NVME drive are correctly named', () => { - // GIVEN - const sampleInstanceClassKeys = [{ - key: InstanceClass.R5D, - value: 'r5d', - }, { - key: InstanceClass.MEMORY5_NVME_DRIVE, - value: 'r5d', - }, { - key: InstanceClass.R5AD, - value: 'r5ad', - }, { - key: InstanceClass.MEMORY5_AMD_NVME_DRIVE, - value: 'r5ad', - }, { - key: InstanceClass.M5AD, - value: 'm5ad', - }, { - key: InstanceClass.STANDARD5_AMD_NVME_DRIVE, - value: 'm5ad', - }]; // A sample of instances with NVME drives - - for (const instanceClass of sampleInstanceClassKeys) { - // WHEN - const instanceType = InstanceType.of(instanceClass.key, InstanceSize.LARGE); - // THEN - expect(instanceType.toString().split('.')[0]).toBe(instanceClass.value); - } - }); - test('instance architecture throws an error when instance type is invalid', () => { - // GIVEN - const malformedInstanceTypes = ['t4', 't4g.nano.', 't4gnano', '']; - - for (const malformedInstanceType of malformedInstanceTypes) { - // WHEN - const instanceType = new InstanceType(malformedInstanceType); - - // THEN - expect(() => instanceType.architecture).toThrow('Malformed instance type identifier'); - } - - - }); - test('can propagate EBS volume tags', () => { - // WHEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - propagateTagsToVolumeOnCreation: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - PropagateTagsToVolumeOnCreation: true, - }); - }); - describe('blockDeviceMappings', () => { - test('can set blockDeviceMappings', () => { - // WHEN - const kmsKey = new Key(stack, 'EbsKey'); - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - blockDevices: [{ - deviceName: 'ebs', - mappingEnabled: true, - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - volumeType: EbsDeviceVolumeType.IO1, - iops: 5000, - }), - }, { - deviceName: 'ebs-gp3', - mappingEnabled: true, - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - volumeType: EbsDeviceVolumeType.GP3, - iops: 5000, - }), - }, { - deviceName: 'ebs-cmk', - mappingEnabled: true, - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - kmsKey: kmsKey, - volumeType: EbsDeviceVolumeType.IO1, - iops: 5000, - }), - }, { - deviceName: 'ebs-snapshot', - mappingEnabled: false, - volume: BlockDeviceVolume.ebsFromSnapshot('snapshot-id', { - volumeSize: 500, - deleteOnTermination: false, - volumeType: EbsDeviceVolumeType.SC1, - }), - }, { - deviceName: 'ephemeral', - volume: BlockDeviceVolume.ephemeral(0), - }], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - BlockDeviceMappings: [ - { - DeviceName: 'ebs', - Ebs: { - DeleteOnTermination: true, - Encrypted: true, - Iops: 5000, - VolumeSize: 15, - VolumeType: 'io1', - }, - }, - { - DeviceName: 'ebs-gp3', - Ebs: { - DeleteOnTermination: true, - Encrypted: true, - Iops: 5000, - VolumeSize: 15, - VolumeType: 'gp3', - }, - }, - { - DeviceName: 'ebs-cmk', - Ebs: { - DeleteOnTermination: true, - Encrypted: true, - KmsKeyId: { - 'Fn::GetAtt': [ - 'EbsKeyD3FEE551', - 'Arn', - ], - }, - Iops: 5000, - VolumeSize: 15, - VolumeType: 'io1', - }, - }, - { - DeviceName: 'ebs-snapshot', - Ebs: { - DeleteOnTermination: false, - SnapshotId: 'snapshot-id', - VolumeSize: 500, - VolumeType: 'sc1', - }, - NoDevice: {}, - }, - { - DeviceName: 'ephemeral', - VirtualName: 'ephemeral0', - }, - ], - }); - - - }); - - test('throws if ephemeral volumeIndex < 0', () => { - // THEN - expect(() => { - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - blockDevices: [{ - deviceName: 'ephemeral', - volume: BlockDeviceVolume.ephemeral(-1), - }], - }); - }).toThrow(/volumeIndex must be a number starting from 0/); - - - }); - - test('throws if volumeType === IO1 without iops', () => { - // THEN - expect(() => { - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - blockDevices: [{ - deviceName: 'ebs', - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - volumeType: EbsDeviceVolumeType.IO1, - }), - }], - }); - }).toThrow(/ops property is required with volumeType: EbsDeviceVolumeType.IO1/); - }); - - test('throws if volumeType === IO2 without iops', () => { - // THEN - expect(() => { - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - blockDevices: [{ - deviceName: 'ebs', - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - volumeType: EbsDeviceVolumeType.IO2, - }), - }], - }); - }).toThrow(/ops property is required with volumeType: EbsDeviceVolumeType.IO1 and EbsDeviceVolumeType.IO2/); - }); - - test('warning if iops without volumeType', () => { - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - blockDevices: [{ - deviceName: 'ebs', - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - iops: 5000, - }), - }], - }); - - // THEN - Annotations.fromStack(stack).hasWarning('/Default/Instance', 'iops will be ignored without volumeType: IO1, IO2, or GP3'); - }); - - test('warning if iops and invalid volumeType', () => { - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - blockDevices: [{ - deviceName: 'ebs', - volume: BlockDeviceVolume.ebs(15, { - deleteOnTermination: true, - encrypted: true, - volumeType: EbsDeviceVolumeType.GP2, - iops: 5000, - }), - }], - }); - - // THEN - Annotations.fromStack(stack).hasWarning('/Default/Instance', 'iops will be ignored without volumeType: IO1, IO2, or GP3'); - }); - }); - - test('instance can be created with Private IP Address', () => { - // WHEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - privateIpAddress: '10.0.0.2', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - InstanceType: 't3.large', - PrivateIpAddress: '10.0.0.2', - }); - - - }); - - test('instance requires IMDSv2', () => { - // WHEN - const instance = new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: new InstanceType('t2.micro'), - requireImdsv2: true, - }); - - // Force stack synth so the InstanceRequireImdsv2Aspect is applied - Template.fromStack(stack); - - // THEN - const launchTemplate = instance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; - expect(launchTemplate).toBeDefined(); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::LaunchTemplate', { - LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), - LaunchTemplateData: { - MetadataOptions: { - HttpTokens: 'required', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - LaunchTemplate: { - LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), - }, - }); - }); - - describe('Detailed Monitoring', () => { - test('instance with Detailed Monitoring enabled', () => { - // WHEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: new InstanceType('t2.micro'), - detailedMonitoring: true, - }); - - // Force stack synth so the Instance is applied - Template.fromStack(stack); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - Monitoring: true, - }); - }); - - test('instance with Detailed Monitoring disabled', () => { - // WHEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: new InstanceType('t2.micro'), - detailedMonitoring: false, - }); - - // Force stack synth so the Instance is applied - Template.fromStack(stack); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - Monitoring: false, - }); - }); - - test('instance with Detailed Monitoring unset falls back to disabled', () => { - // WHEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: new InstanceType('t2.micro'), - }); - - // Force stack synth so the Instance is applied - Template.fromStack(stack); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - Monitoring: Match.absent(), - }); - }); - }); - -}); - -test('add CloudFormation Init to instance', () => { - // GIVEN - new Instance(stack, 'Instance', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - init: CloudFormationInit.fromElements( - InitCommand.shellCommand('echo hello'), - ), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { - UserData: { - 'Fn::Base64': { - 'Fn::Join': ['', [ - '#!/bin/bash\n# fingerprint: 85ac432b1de1144f\n(\n set +e\n /opt/aws/bin/cfn-init -v --region ', - { Ref: 'AWS::Region' }, - ' --stack ', - { Ref: 'AWS::StackName' }, - ' --resource InstanceC1063A87 -c default\n /opt/aws/bin/cfn-signal -e $? --region ', - { Ref: 'AWS::Region' }, - ' --stack ', - { Ref: 'AWS::StackName' }, - ' --resource InstanceC1063A87\n cat /var/log/cfn-init.log >&2\n)', - ]], - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['cloudformation:DescribeStackResource', 'cloudformation:SignalResource'], - Effect: 'Allow', - Resource: { Ref: 'AWS::StackId' }, - }]), - Version: '2012-10-17', - }, - }); - Template.fromStack(stack).hasResource('AWS::EC2::Instance', { - CreationPolicy: { - ResourceSignal: { - Count: 1, - Timeout: 'PT5M', - }, - }, - }); -}); - -test('cause replacement from s3 asset in userdata', () => { - // GIVEN - const app = new App({ - context: { - [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false, - }, - }); - stack = new Stack(app); - vpc = new Vpc(stack, 'Vpc)'); - const userData1 = UserData.forLinux(); - const asset1 = new Asset(stack, 'UserDataAssets1', { - path: path.join(__dirname, 'asset-fixture', 'data.txt'), - }); - userData1.addS3DownloadCommand({ bucket: asset1.bucket, bucketKey: asset1.s3ObjectKey }); - - const userData2 = UserData.forLinux(); - const asset2 = new Asset(stack, 'UserDataAssets2', { - path: path.join(__dirname, 'asset-fixture', 'data.txt'), - }); - userData2.addS3DownloadCommand({ bucket: asset2.bucket, bucketKey: asset2.s3ObjectKey }); - - // WHEN - new Instance(stack, 'InstanceOne', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - userData: userData1, - userDataCausesReplacement: true, - }); - new Instance(stack, 'InstanceTwo', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - userData: userData2, - userDataCausesReplacement: true, - }); - - // THEN -- both instances have the same userData hash, telling us the hash is based - // on the actual asset hash and not accidentally on the token stringification of them. - // (which would base the hash on '${Token[1234.bla]}' - const hash = 'f88eace39faf39d7'; - Template.fromStack(stack).templateMatches(Match.objectLike({ - Resources: Match.objectLike({ - [`InstanceOne5B821005${hash}`]: Match.objectLike({ - Type: 'AWS::EC2::Instance', - Properties: Match.anyValue(), - }), - [`InstanceTwoDC29A7A7${hash}`]: Match.objectLike({ - Type: 'AWS::EC2::Instance', - Properties: Match.anyValue(), - }), - }), - })); -}); - -test('ssm permissions adds right managed policy', () => { - // WHEN - new Instance(stack, 'InstanceOne', { - vpc, - machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), - ssmSessionPermissions: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - ManagedPolicyArns: [ - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AmazonSSMManagedInstanceCore', - ]], - }, - ], - }); -}); - diff --git a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts b/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts deleted file mode 100644 index 96493e5be8573..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.import-default-vpc.lit.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// !cdk-integ * pragma:enable-lookups -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; - -const app = new cdk.App(); - -// we associate this stack with an explicit environment since this is required by the -// environmental context provider used in `fromLookup`. CDK_INTEG_XXX are set -// when producing the .expected file and CDK_DEFAULT_XXX is passed in through from -// the CLI in actual deployment. -const env = { - account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, - region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, -}; - -const stack = new cdk.Stack(app, 'aws-cdk-ec2-import', { env }); - -/// !show -const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { - // This imports the default VPC but you can also - // specify a 'vpcName' or 'tags'. - isDefault: true, -}); -/// !hide - -// The only thing in this library that takes a VPC as an argument :) -new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc, -}); - -// Try subnet selection -new cdk.CfnOutput(stack, 'PublicSubnets', { value: 'ids:' + vpc.publicSubnets.map(s => s.subnetId).join(',') }); -new cdk.CfnOutput(stack, 'PrivateSubnets', { value: 'ids:' + vpc.privateSubnets.map(s => s.subnetId).join(',') }); - -// Route table IDs -new cdk.CfnOutput(stack, 'PublicRouteTables', { value: 'ids: ' + vpc.publicSubnets.map(s => s.routeTable.routeTableId).join(', ') }); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.ts b/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.ts deleted file mode 100644 index 601b2859e6c7e..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.nat-instances.lit.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// !cdk-integ pragma:enable-lookups -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; - -class NatInstanceStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /// !show - // Configure the `natGatewayProvider` when defining a Vpc - const natGatewayProvider = ec2.NatProvider.instance({ - instanceType: new ec2.InstanceType('t3.small'), - }); - - const vpc = new ec2.Vpc(this, 'MyVpc', { - natGatewayProvider, - - // The 'natGateways' parameter now controls the number of NAT instances - natGateways: 2, - }); - /// !hide - - Array.isArray(vpc); - Array.isArray(natGatewayProvider.configuredGateways); - } -} - -const app = new cdk.App(); -new NatInstanceStack(app, 'aws-cdk-vpc-nat-instances', { - env: { - account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, - region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, - }, -}); -app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.ts b/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.ts deleted file mode 100644 index 805830d3f8fa8..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.share-vpcs.lit.ts +++ /dev/null @@ -1,63 +0,0 @@ -/// !cdk-integ * -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as ec2 from '../lib'; - -const app = new cdk.App(); - -interface ConstructThatTakesAVpcProps { - vpc: ec2.IVpc; -} - -class ConstructThatTakesAVpc extends Construct { - constructor(scope: Construct, id: string, _props: ConstructThatTakesAVpcProps) { - super(scope, id); - - // new ec2.CfnInstance(this, 'Instance', { - // subnetId: props.vpc.privateSubnets[0].subnetId, - // imageId: new ec2.AmazonLinuxImage().getImage(this).imageId, - // }); - } -} - -/// !show -/** - * Stack1 creates the VPC - */ -class Stack1 extends cdk.Stack { - public readonly vpc: ec2.Vpc; - - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - this.vpc = new ec2.Vpc(this, 'VPC'); - } -} - -interface Stack2Props extends cdk.StackProps { - vpc: ec2.IVpc; -} - -/** - * Stack2 consumes the VPC - */ -class Stack2 extends cdk.Stack { - constructor(scope: cdk.App, id: string, props: Stack2Props) { - super(scope, id, props); - - // Pass the VPC to a construct that needs it - new ConstructThatTakesAVpc(this, 'Construct', { - vpc: props.vpc, - }); - } -} - -const stack1 = new Stack1(app, 'Stack1'); -const stack2 = new Stack2(app, 'Stack2', { - vpc: stack1.vpc, -}); -/// !hide - -Array.isArray(stack2); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts b/packages/@aws-cdk/aws-ec2/test/integ.volume.ts deleted file mode 100644 index 59dbafb2b6f26..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.volume.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-ec2-volume-1'); - -new ec2.Volume(stack, 'TestVolume', { - availabilityZone: 'us-east-1a', - size: cdk.Size.gibibytes(1), - volumeType: ec2.EbsDeviceVolumeType.GP3, - throughput: 200, -}); - -new integ.IntegTest(app, 'VolumeTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.ts b/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.ts deleted file mode 100644 index 434a50b143f16..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-azs.ts +++ /dev/null @@ -1,11 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-ec2-vpc-azs'); - -new ec2.Vpc(stack, 'MyVpc', { - availabilityZones: [stack.availabilityZones[1]], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.ts b/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.ts deleted file mode 100644 index 1124f9a20d60c..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-endpoint.lit.ts +++ /dev/null @@ -1,47 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as ec2 from '../lib'; - -const app = new cdk.App(); - -class VpcEndpointStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /// !show - // Add gateway endpoints when creating the VPC - const vpc = new ec2.Vpc(this, 'MyVpc', { - gatewayEndpoints: { - S3: { - service: ec2.GatewayVpcEndpointAwsService.S3, - }, - }, - }); - - // Alternatively gateway endpoints can be added on the VPC - const dynamoDbEndpoint = vpc.addGatewayEndpoint('DynamoDbEndpoint', { - service: ec2.GatewayVpcEndpointAwsService.DYNAMODB, - }); - - // This allows to customize the endpoint policy - dynamoDbEndpoint.addToPolicy( - new iam.PolicyStatement({ // Restrict to listing and describing tables - principals: [new iam.AnyPrincipal()], - actions: ['dynamodb:DescribeTable', 'dynamodb:ListTables'], - resources: ['*'], - })); - - // Add an interface endpoint - vpc.addInterfaceEndpoint('EcrDockerEndpoint', { - service: ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER, - - // Uncomment the following to allow more fine-grained control over - // who can access the endpoint via the '.connections' object. - // open: false - }); - /// !hide - } -} - -new VpcEndpointStack(app, 'aws-cdk-ec2-vpc-endpoint'); -app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.ts b/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.ts deleted file mode 100644 index f434db8a52527..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/integ.vpc-reserved-azs.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ec2 from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integtest-vpc-reserved-azs'); - -new ec2.Vpc(stack, 'MyVpc', { - reservedAzs: 2, - maxAzs: 3, -}); - -new IntegTest(app, 'vpc-reserved-azs', { - testCases: [stack], -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/test/security-group.test.ts b/packages/@aws-cdk/aws-ec2/test/security-group.test.ts deleted file mode 100644 index 5a5e6e41a8009..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/security-group.test.ts +++ /dev/null @@ -1,1111 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Intrinsic, Lazy, Stack, Token } from '@aws-cdk/core'; -import { Peer, Port, SecurityGroup, SecurityGroupProps, Vpc } from '../lib'; - -const SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY = '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'; - -describe('security group', () => { - test('security group can allows all outbound traffic by default', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: true }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - }); - }); - - test('security group can allows all ipv6 outbound traffic by default', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - new SecurityGroup(stack, 'SG1', { vpc, allowAllIpv6Outbound: true }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - { - CidrIpv6: '::/0', - Description: 'Allow all outbound ipv6 traffic by default', - IpProtocol: '-1', - }, - ], - }); - }); - - test('can add ipv6 rules even if allowAllOutbound=true', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', { vpc }); - sg.addEgressRule(Peer.ipv6('2001:db8::/128'), Port.tcp(80)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - { - CidrIpv6: '2001:db8::/128', - Description: 'from 2001:db8::/128:80', - FromPort: 80, - ToPort: 80, - IpProtocol: 'tcp', - }, - ], - }); - - }); - - test('no new outbound rule is added if we are allowing all traffic anyway', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: true }); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'This does not show up'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - }); - - - }); - - test('security group disallow outbound traffic by default', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '255.255.255.255/32', - Description: 'Disallow all traffic', - FromPort: 252, - IpProtocol: 'icmp', - ToPort: 86, - }, - ], - }); - - - }); - - test('bogus outbound rule disappears if another rule is added', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'This replaces the other one'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'This replaces the other one', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }, - ], - }); - }); - - test('all outbound rule cannot be added after creation', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); - expect(() => { - sg.addEgressRule(Peer.anyIpv4(), Port.allTraffic(), 'All traffic'); - }).toThrow(/Cannot add/); - }); - - test('all ipv6 outbound rule cannot be added after creation', () => { - // GIVEN - const stack = new Stack(); - const vpc = new Vpc(stack, 'VPC'); - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); - expect(() => { - sg.addEgressRule(Peer.anyIpv6(), Port.allTraffic(), 'All traffic'); - }).toThrow(/Cannot add/); - }); - - test('immutable imports do not add rules', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const sg = SecurityGroup.fromSecurityGroupId(stack, 'SG1', 'test-id', { mutable: false }); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'This rule was not added'); - sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'This rule was not added'); - - const openEgressRules = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'This rule was not added', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }, - ], - }); - expect(Object.keys(openEgressRules).length).toBe(0); - - const openIngressRules = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'This rule was not added', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }, - ], - }); - expect(Object.keys(openIngressRules).length).toBe(0); - }); - - describe('Inline Rule Control', () => { - //Not inlined - describe('When props.disableInlineRules is true', () => { testRulesAreNotInlined(undefined, true); }); - describe('When context.disableInlineRules is true', () => { testRulesAreNotInlined(true, undefined); }); - describe('When context.disableInlineRules is true and props.disableInlineRules is true', () => { testRulesAreNotInlined(true, true); }); - describe('When context.disableInlineRules is false and props.disableInlineRules is true', () => { testRulesAreNotInlined(false, true); }); - describe('When props.disableInlineRules is true and context.disableInlineRules is null', () => { testRulesAreNotInlined(null, true); }); - //Inlined - describe('When context.disableInlineRules is false and props.disableInlineRules is false', () => { testRulesAreInlined(false, false); }); - describe('When context.disableInlineRules is true and props.disableInlineRules is false', () => { testRulesAreInlined(true, false); }); - describe('When context.disableInlineRules is false', () => { testRulesAreInlined(false, undefined); }); - describe('When props.disableInlineRules is false', () => { testRulesAreInlined(undefined, false); }); - describe('When neither props.disableInlineRules nor context.disableInlineRules are defined', () => { testRulesAreInlined(undefined, undefined); }); - describe('When props.disableInlineRules is undefined and context.disableInlineRules is null', () => { testRulesAreInlined(null, undefined); }); - describe('When props.disableInlineRules is false and context.disableInlineRules is null', () => { testRulesAreInlined(null, false); }); - }); - - test('peer between all types of peers and port range types', () => { - // GIVEN - const stack = new Stack(undefined, 'TestStack', { env: { account: '12345678', region: 'dummy' } }); - const vpc = new Vpc(stack, 'VPC'); - const sg = new SecurityGroup(stack, 'SG', { vpc, allowAllIpv6Outbound: true }); - - const peers = [ - new SecurityGroup(stack, 'PeerGroup', { vpc }), - Peer.anyIpv4(), - Peer.anyIpv6(), - Peer.prefixList('pl-012345'), - Peer.securityGroupId('sg-012345678'), - ]; - - const ports = [ - Port.tcp(1234), - Port.tcp(Lazy.number({ produce: () => 5000 })), - Port.allTcp(), - Port.tcpRange(80, 90), - Port.udp(2345), - Port.udp(Lazy.number({ produce: () => 7777 })), - Port.allUdp(), - Port.udpRange(85, 95), - Port.icmpTypeAndCode(5, 1), - Port.icmpType(8), - Port.allIcmp(), - Port.icmpPing(), - Port.allTraffic(), - ]; - - // WHEN - for (const peer of peers) { - for (const port of ports) { - sg.connections.allowTo(peer, port); - sg.connections.allowFrom(peer, port); - } - } - - // THEN -- no crash - - - }); - - test('can add multiple rules using tokens on same security group', () => { - // GIVEN - const stack = new Stack(undefined, 'TestStack', { env: { account: '12345678', region: 'dummy' } }); - const vpc = new Vpc(stack, 'VPC'); - const sg = new SecurityGroup(stack, 'SG', { vpc }); - - const p1 = Lazy.string({ produce: () => 'dummyid1' }); - const p2 = Lazy.string({ produce: () => 'dummyid2' }); - const peer1 = Peer.prefixList(p1); - const peer2 = Peer.prefixList(p2); - - // WHEN - sg.addIngressRule(peer1, Port.tcp(5432), 'Rule 1'); - sg.addIngressRule(peer2, Port.tcp(5432), 'Rule 2'); - - // THEN -- no crash - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - Description: 'Rule 1', - }); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - Description: 'Rule 2', - }); - }); - - test('if tokens are used in ports, `canInlineRule` should be false to avoid cycles', () => { - // GIVEN - const p1 = Lazy.number({ produce: () => 80 }); - const p2 = Lazy.number({ produce: () => 5000 }); - - // WHEN - const ports = [ - Port.tcp(p1), - Port.tcp(p2), - Port.tcpRange(p1, 90), - Port.tcpRange(80, p2), - Port.tcpRange(p1, p2), - Port.udp(p1), - Port.udpRange(p1, 95), - Port.udpRange(85, p2), - Port.udpRange(p1, p2), - Port.icmpTypeAndCode(p1, 1), - Port.icmpTypeAndCode(5, p1), - Port.icmpTypeAndCode(p1, p2), - Port.icmpType(p1), - ]; - - // THEN - for (const range of ports) { - expect(range.canInlineRule).toEqual(false); - } - - - }); - - describe('Peer IP CIDR validation', () => { - test('passes with valid IPv4 CIDR block', () => { - // GIVEN - const cidrIps = ['0.0.0.0/0', '192.168.255.255/24']; - - // THEN - for (const cidrIp of cidrIps) { - expect(Peer.ipv4(cidrIp).uniqueId).toEqual(cidrIp); - } - - - }); - - test('passes with unresolved IP CIDR token', () => { - // GIVEN - Token.asString(new Intrinsic('ip')); - - // THEN: don't throw - - - }); - - test('throws if invalid IPv4 CIDR block', () => { - // THEN - expect(() => { - Peer.ipv4('invalid'); - }).toThrow(/Invalid IPv4 CIDR/); - - - }); - - test('throws if missing mask in IPv4 CIDR block', () => { - expect(() => { - Peer.ipv4('0.0.0.0'); - }).toThrow(/CIDR mask is missing in IPv4/); - - - }); - - test('passes with valid IPv6 CIDR block', () => { - // GIVEN - const cidrIps = [ - '::/0', - '2001:db8::/32', - '2001:0db8:0000:0000:0000:8a2e:0370:7334/32', - '2001:db8::8a2e:370:7334/32', - ]; - - // THEN - for (const cidrIp of cidrIps) { - expect(Peer.ipv6(cidrIp).uniqueId).toEqual(cidrIp); - } - - - }); - - test('throws if invalid IPv6 CIDR block', () => { - // THEN - expect(() => { - Peer.ipv6('invalid'); - }).toThrow(/Invalid IPv6 CIDR/); - - - }); - - test('throws if missing mask in IPv6 CIDR block', () => { - expect(() => { - Peer.ipv6('::'); - }).toThrow(/IDR mask is missing in IPv6/); - - - }); - }); - - describe('Peer security group ID validation', () => { - test('passes with valid security group ID', () => { - //GIVEN - const securityGroupIds = ['sg-12345678', 'sg-0123456789abcdefg']; - - // THEN - for (const securityGroupId of securityGroupIds) { - expect(Peer.securityGroupId(securityGroupId).uniqueId).toEqual(securityGroupId); - } - }); - - test('passes with valid security group ID and source owner id', () => { - //GIVEN - const securityGroupIds = ['sg-12345678', 'sg-0123456789abcdefg']; - const ownerIds = ['000000000000', '000000000001']; - - // THEN - for (const securityGroupId of securityGroupIds) { - for (const ownerId of ownerIds) { - expect(Peer.securityGroupId(securityGroupId, ownerId).uniqueId).toEqual(securityGroupId); - } - } - }); - - test('passes with unresolved security group id token or owner id token', () => { - // GIVEN - Token.asString('securityGroupId'); - - const securityGroupId = Lazy.string({ produce: () => 'sg-01234567' }); - const ownerId = Lazy.string({ produce: () => '000000000000' }); - Peer.securityGroupId(securityGroupId); - Peer.securityGroupId(securityGroupId, ownerId); - - // THEN: don't throw - }); - - test('throws if invalid security group ID', () => { - // THEN - expect(() => { - Peer.securityGroupId('invalid'); - }).toThrow(/Invalid security group ID/); - - - }); - - test('throws if invalid source security group id', () => { - // THEN - expect(() => { - Peer.securityGroupId('sg-12345678', 'invalid'); - }).toThrow(/Invalid security group owner ID/); - }); - }); - - describe('SourceSecurityGroupOwnerId property validation', () => { - test('SourceSecurityGroupOwnerId property is not present when value is not provided to ingress rule', () => { - // GIVEN - const stack = new Stack(undefined, 'TestStack'); - const vpc = new Vpc(stack, 'VPC'); - const sg = new SecurityGroup(stack, 'SG', { vpc }); - - //WHEN - sg.addIngressRule(Peer.securityGroupId('sg-123456789'), Port.allTcp(), 'no owner id property'); - - //THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [{ - SourceSecurityGroupId: 'sg-123456789', - Description: 'no owner id property', - FromPort: 0, - ToPort: 65535, - IpProtocol: 'tcp', - }], - }); - }); - - test('SourceSecurityGroupOwnerId property is present when value is provided to ingress rule', () => { - // GIVEN - const stack = new Stack(undefined, 'TestStack'); - const vpc = new Vpc(stack, 'VPC'); - const sg = new SecurityGroup(stack, 'SG', { vpc }); - - //WHEN - sg.addIngressRule(Peer.securityGroupId('sg-123456789', '000000000000'), Port.allTcp(), 'contains owner id property'); - - //THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [{ - SourceSecurityGroupId: 'sg-123456789', - SourceSecurityGroupOwnerId: '000000000000', - Description: 'contains owner id property', - FromPort: 0, - ToPort: 65535, - IpProtocol: 'tcp', - }], - }); - }); - - test('SourceSecurityGroupOwnerId property is not present when value is provided to egress rule', () => { - // GIVEN - const stack = new Stack(undefined, 'TestStack'); - const vpc = new Vpc(stack, 'VPC'); - const sg = new SecurityGroup(stack, 'SG', { vpc, allowAllOutbound: false }); - - //WHEN - sg.addEgressRule(Peer.securityGroupId('sg-123456789', '000000000000'), Port.allTcp(), 'no owner id property'); - - //THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupEgress: [{ - DestinationSecurityGroupId: 'sg-123456789', - Description: 'no owner id property', - FromPort: 0, - ToPort: 65535, - IpProtocol: 'tcp', - }], - }); - }); - }); -}); - -describe('security group lookup', () => { - testDeprecated('can look up a security group', () => { - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - const securityGroup = SecurityGroup.fromLookup(stack, 'stack', 'sg-1234'); - - expect(securityGroup.securityGroupId).toEqual('sg-12345678'); - expect(securityGroup.allowAllOutbound).toEqual(true); - - }); - - test('can look up a security group by id', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - // WHEN - const securityGroup = SecurityGroup.fromLookupById(stack, 'SG1', 'sg-12345'); - - // THEN - expect(securityGroup.securityGroupId).toEqual('sg-12345678'); - expect(securityGroup.allowAllOutbound).toEqual(true); - - }); - - test('can look up a security group by name and vpc', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { - vpcId: 'vpc-1234', - availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], - }); - - // WHEN - const securityGroup = SecurityGroup.fromLookupByName(stack, 'SG1', 'sg-12345', vpc); - - // THEN - expect(securityGroup.securityGroupId).toEqual('sg-12345678'); - expect(securityGroup.allowAllOutbound).toEqual(true); - - }); - - test('can look up a security group by id and vpc', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { - vpcId: 'vpc-1234', - availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], - }); - - // WHEN - const securityGroup = SecurityGroup.fromLookupByName(stack, 'SG1', 'my-security-group', vpc); - - // THEN - expect(securityGroup.securityGroupId).toEqual('sg-12345678'); - expect(securityGroup.allowAllOutbound).toEqual(true); - - }); - - test('can look up a security group and use it as a peer', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { - vpcId: 'vpc-1234', - availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], - }); - - // WHEN - const securityGroup = SecurityGroup.fromLookupByName(stack, 'SG1', 'my-security-group', vpc); - - // THEN - expect(() => { - Peer.securityGroupId(securityGroup.securityGroupId); - }).not.toThrow(); - }); - - test('throws if securityGroupId is tokenized', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - // WHEN - expect(() => { - SecurityGroup.fromLookupById(stack, 'stack', Lazy.string({ produce: () => 'sg-12345' })); - }).toThrow('All arguments to look up a security group must be concrete (no Tokens)'); - - }); - - test('throws if securityGroupName is tokenized', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - // WHEN - expect(() => { - SecurityGroup.fromLookupById(stack, 'stack', Lazy.string({ produce: () => 'my-security-group' })); - }).toThrow('All arguments to look up a security group must be concrete (no Tokens)'); - - }); - - test('throws if vpc id is tokenized', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { - account: '1234', - region: 'us-east-1', - }, - }); - - const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { - vpcId: Lazy.string({ produce: () => 'vpc-1234' }), - availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], - }); - - // WHEN - expect(() => { - SecurityGroup.fromLookupByName(stack, 'stack', 'my-security-group', vpc); - }).toThrow('All arguments to look up a security group must be concrete (no Tokens)'); - - }); - -}); - -function testRulesAreInlined(contextDisableInlineRules: boolean | undefined | null, optionsDisableInlineRules: boolean | undefined) { - - describe('When allowAllOutbound', () => { - test('new SecurityGroup will create an inline SecurityGroupEgress rule to allow all traffic', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - new SecurityGroup(stack, 'SG1', props); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - }); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - - test('addEgressRule rule will not modify egress rules', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - - test('addIngressRule will add a new ingress rule', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - SecurityGroupIngress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'An external Rule', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }, - ], - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - }); - - }); - }); - - describe('When do not allowAllOutbound', () => { - test('new SecurityGroup rule will create an egress rule that denies all traffic', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - new SecurityGroup(stack, 'SG1', props); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - SecurityGroupEgress: [ - { - CidrIp: '255.255.255.255/32', - Description: 'Disallow all traffic', - IpProtocol: 'icmp', - FromPort: 252, - ToPort: 86, - }, - ], - }); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - - }); - test('addEgressRule rule will add a new inline egress rule and remove the denyAllTraffic rule', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An inline Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'An inline Rule', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }, - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - - test('addIngressRule will add a new ingress rule', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - SecurityGroupIngress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'An external Rule', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }, - ], - SecurityGroupEgress: [ - { - CidrIp: '255.255.255.255/32', - Description: 'Disallow all traffic', - IpProtocol: 'icmp', - FromPort: 252, - ToPort: 86, - }, - ], - }); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - }); - -}; - - -function testRulesAreNotInlined(contextDisableInlineRules: boolean | undefined | null, optionsDisableInlineRules: boolean | undefined) { - - describe('When allowAllOutbound', () => { - test('new SecurityGroup will create an external SecurityGroupEgress rule', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - - test('addIngressRule rule will not remove external allowAllOutbound rule', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - - test('addIngressRule rule will not add a new egress rule', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - - const egressGroups = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - Description: 'An external Rule', - }); - expect(Object.keys(egressGroups).length).toBe(0); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - }); - - test('addIngressRule rule will add a new external ingress rule even if it could have been inlined', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '0.0.0.0/0', - Description: 'An external Rule', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }); - - }); - }); - - describe('When do not allowAllOutbound', () => { - test('new SecurityGroup rule will create an external egress rule that denies all traffic', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '255.255.255.255/32', - Description: 'Disallow all traffic', - IpProtocol: 'icmp', - FromPort: 252, - ToPort: 86, - }); - - }); - - test('addEgressRule rule will remove the rule that denies all traffic if another egress rule is added', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - const egressGroups = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '255.255.255.255/32', - }); - expect(Object.keys(egressGroups).length).toBe(0); - }); - - test('addEgressRule rule will add a new external egress rule even if it could have been inlined', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '0.0.0.0/0', - Description: 'An external Rule', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); - - }); - - test('addIngressRule will add a new external ingress rule even if it could have been inlined', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); - const vpc = new Vpc(stack, 'VPC'); - const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; - - // WHEN - const sg = new SecurityGroup(stack, 'SG1', props); - sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/SG1', - VpcId: stack.resolve(vpc.vpcId), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '0.0.0.0/0', - Description: 'An external Rule', - FromPort: 86, - IpProtocol: 'tcp', - ToPort: 86, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: stack.resolve(sg.securityGroupId), - CidrIp: '255.255.255.255/32', - Description: 'Disallow all traffic', - IpProtocol: 'icmp', - FromPort: 252, - ToPort: 86, - }); - - }); - }); - -} diff --git a/packages/@aws-cdk/aws-ec2/test/util.ts b/packages/@aws-cdk/aws-ec2/test/util.ts deleted file mode 100644 index 9eabad6658a2a..0000000000000 --- a/packages/@aws-cdk/aws-ec2/test/util.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Matcher, MatchResult } from '@aws-cdk/assertions'; - -export function stringLike(pattern: string | RegExp): Matcher { - return new RegexMatcher(new RegExp(pattern)); -} - -export class RegexMatcher extends Matcher { - constructor(private readonly pattern: RegExp, public readonly name: string = 'RegexMatch') { super(); } - public test(actual: any): MatchResult { - const result = new MatchResult(actual); - if (!this.pattern.test(actual)) { - result.recordFailure({ - matcher: this, - path: [], - message: `Expected ${actual} to match ${this.pattern}`, - }); - } - return result; - } -} diff --git a/packages/@aws-cdk/aws-ecr-assets/.eslintrc.js b/packages/@aws-cdk/aws-ecr-assets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ecr-assets/.gitignore b/packages/@aws-cdk/aws-ecr-assets/.gitignore deleted file mode 100644 index 70bcd18f54d33..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -dist -tsconfig.json - -.LAST_BUILD -.nyc_output -coverage - -.jsii - -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml - -!jest.config.js - -!test/allow-listed-image/node_modules - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ecr-assets/.npmignore b/packages/@aws-cdk/aws-ecr-assets/.npmignore deleted file mode 100644 index 3c1ceb7605a65..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -jest.config.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ecr-assets/LICENSE b/packages/@aws-cdk/aws-ecr-assets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ecr-assets/NOTICE b/packages/@aws-cdk/aws-ecr-assets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ecr-assets/README.md b/packages/@aws-cdk/aws-ecr-assets/README.md deleted file mode 100644 index 26c3963afbe05..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/README.md +++ /dev/null @@ -1,202 +0,0 @@ -# AWS CDK Docker Image Assets - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module allows bundling Docker images as assets. - -## Images from Dockerfile - -Images are built from a local Docker context directory (with a `Dockerfile`), -uploaded to Amazon Elastic Container Registry (ECR) by the CDK toolkit -and/or your app's CI/CD pipeline, and can be naturally referenced in your CDK app. - -```ts -import { DockerImageAsset } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), -}); -``` - -The directory `my-image` must include a `Dockerfile`. - -This will instruct the toolkit to build a Docker image from `my-image`, push it -to an Amazon ECR repository and wire the name of the repository as CloudFormation -parameters to your stack. - -By default, all files in the given directory will be copied into the docker -*build context*. If there is a large directory that you know you definitely -don't need in the build context you can improve the performance by adding the -names of files and directories to ignore to a file called `.dockerignore`, or -pass them via the `exclude` property. If both are available, the patterns -found in `exclude` are appended to the patterns found in `.dockerignore`. - -The `ignoreMode` property controls how the set of ignore patterns is -interpreted. The recommended setting for Docker image assets is -`IgnoreMode.DOCKER`. If the context flag -`@aws-cdk/aws-ecr-assets:dockerIgnoreSupport` is set to `true` in your -`cdk.json` (this is by default for new projects, but must be set manually for -old projects) then `IgnoreMode.DOCKER` is the default and you don't need to -configure it on the asset itself. - -Use `asset.imageUri` to reference the image. It includes both the ECR image URL -and tag. - -Use `asset.imageTag` to reference only the image tag. - -You can optionally pass build args to the `docker build` command by specifying -the `buildArgs` property. It is recommended to skip hashing of `buildArgs` for -values that can change between different machines to maintain a consistent -asset hash. - -Additionally, you can supply `buildSecrets`. Your system must have Buildkit -enabled, see https://docs.docker.com/build/buildkit/. - -```ts -import { DockerImageAsset } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), - buildArgs: { - HTTP_PROXY: 'http://10.20.30.2:1234', - }, - invalidation: { - buildArgs: false, - }, -}); -``` - -You can optionally pass a target to the `docker build` command by specifying -the `target` property: - -```ts -import { DockerImageAsset } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), - target: 'a-target', -}); -``` - -You can optionally pass networking mode to the `docker build` command by specifying -the `networkMode` property: - -```ts -import { DockerImageAsset, NetworkMode } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), - networkMode: NetworkMode.HOST, -}) -``` - -You can optionally pass an alternate platform to the `docker build` command by specifying -the `platform` property: - -```ts -import { DockerImageAsset, Platform } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), - platform: Platform.LINUX_ARM64, -}) -``` - -You can optionally pass an array of outputs to the `docker build` command by specifying -the `outputs` property: - -```ts -import { DockerImageAsset, Platform } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), - outputs: ['type=local,dest=out'], -}) -``` - -You can optionally pass cache from and cache to options to cache images: - -```ts -import { DockerImageAsset, Platform } from '@aws-cdk/aws-ecr-assets'; - -const asset = new DockerImageAsset(this, 'MyBuildImage', { - directory: path.join(__dirname, 'my-image'), - cacheFrom: [{ type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache' }}], - cacheTo: { type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache', mode: 'max', compression: 'zstd' }} -}) -``` - -## Images from Tarball - -Images are loaded from a local tarball, uploaded to ECR by the CDK toolkit and/or your app's CI-CD pipeline, and can be -naturally referenced in your CDK app. - -```ts -import { TarballImageAsset } from '@aws-cdk/aws-ecr-assets'; - -const asset = new TarballImageAsset(this, 'MyBuildImage', { - tarballFile: 'local-image.tar', -}); -``` - -This will instruct the toolkit to add the tarball as a file asset. During deployment it will load the container image -from `local-image.tar`, push it to an Amazon ECR repository and wire the name of the repository as CloudFormation parameters -to your stack. - -## Publishing images to ECR repositories - -`DockerImageAsset` is designed for seamless build & consumption of image assets by CDK code deployed to multiple environments -through the CDK CLI or through CI/CD workflows. To that end, the ECR repository behind this construct is controlled by the AWS CDK. -The mechanics of where these images are published and how are intentionally kept as an implementation detail, and the construct -does not support customizations such as specifying the ECR repository name or tags. - -If you are looking for a way to _publish_ image assets to an ECR repository in your control, you should consider using -[cdklabs/cdk-ecr-deployment], which is able to replicate an image asset from the CDK-controlled ECR repository to a repository of -your choice. - -Here an example from the [cdklabs/cdk-ecr-deployment] project: - -```text -// This example available in TypeScript only - -import { DockerImageAsset } from '@aws-cdk/aws-ecr-assets'; -import * as ecrdeploy from 'cdk-ecr-deployment'; - -const image = new DockerImageAsset(this, 'CDKDockerImage', { - directory: path.join(__dirname, 'docker'), -}); - -new ecrdeploy.ECRDeployment(this, 'DeployDockerImage', { - src: new ecrdeploy.DockerImageName(image.imageUri), - dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/test:nginx`), -}); -``` - -⚠️ Please note that this is a 3rd-party construct library and is not officially supported by AWS. -You are welcome to +1 [this GitHub issue](https://github.com/aws/aws-cdk/issues/12597) if you would like to see -native support for this use-case in the AWS CDK. - -[cdklabs/cdk-ecr-deployment]: https://github.com/cdklabs/cdk-ecr-deployment - -## Pull Permissions - -Depending on the consumer of your image asset, you will need to make sure -the principal has permissions to pull the image. - -In most cases, you should use the `asset.repository.grantPull(principal)` -method. This will modify the IAM policy of the principal to allow it to -pull images from this repository. - -If the pulling principal is not in the same account or is an AWS service that -doesn't assume a role in your account (e.g. AWS CodeBuild), pull permissions -must be granted on the __resource policy__ (and not on the principal's policy). -To do that, you can use `asset.repository.addToResourcePolicy(statement)` to -grant the desired principal the following permissions: "ecr:GetDownloadUrlForLayer", -"ecr:BatchGetImage" and "ecr:BatchCheckLayerAvailability". diff --git a/packages/@aws-cdk/aws-ecr-assets/jest.config.js b/packages/@aws-cdk/aws-ecr-assets/jest.config.js deleted file mode 100644 index da69fabe154d9..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 75, - statements: 80, - } - } -}; diff --git a/packages/@aws-cdk/aws-ecr-assets/package.json b/packages/@aws-cdk/aws-ecr-assets/package.json deleted file mode 100644 index fe5a11e20b6ba..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/package.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "name": "@aws-cdk/aws-ecr-assets", - "version": "0.0.0", - "private": true, - "description": "Docker image assets deployed to ECR", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ecr.assets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ecr-assets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Ecr.Assets", - "packageId": "Amazon.CDK.ECR.Assets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ecr-assets", - "module": "aws_cdk.aws_ecr_assets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ecr-assets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "assets", - "docker" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/proxyquire": "^1.3.28", - "aws-cdk": "0.0.0", - "jest": "^27.5.1", - "proxyquire": "^2.1.3" - }, - "dependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "nyc": { - "statements": 70 - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-ecr-assets/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ecr-assets/rosetta/default.ts-fixture deleted file mode 100644 index 0770e89346bb9..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as path from 'path'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/custom-synthesis.test.ts b/packages/@aws-cdk/aws-ecr-assets/test/custom-synthesis.test.ts deleted file mode 100644 index 3005145ee52cd..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/test/custom-synthesis.test.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * This file asserts that it is possible to write a custom stacksynthesizer that will synthesize - * ONE thing to the asset manifest, while returning another thing (including tokens) to the - * CloudFormation template -- without reaching into the library internals - */ - -import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { StackSynthesizer, FileAssetSource, FileAssetLocation, DockerImageAssetSource, DockerImageAssetLocation, ISynthesisSession, App, Stack, AssetManifestBuilder, CfnParameter, CfnResource } from '@aws-cdk/core'; -import { AssetManifestArtifact } from '@aws-cdk/cx-api'; -import { DockerImageAsset } from '../lib'; - -test('use custom synthesizer', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'Stack', { - synthesizer: new CustomSynthesizer(), - }); - - // WHEN - const asset = new DockerImageAsset(stack, 'MyAsset', { - directory: path.join(__dirname, 'demo-image'), - }); - new CfnResource(stack, 'TestResource', { - type: 'CDK::TestResource', - properties: { - ImageUri: asset.imageUri, - ImageTag: asset.imageTag, - }, - }); - - // THEN - const assembly = app.synth(); - const stackArtifact = assembly.getStackArtifact(stack.artifactId); - const assetArtifact = stackArtifact.dependencies[0] as AssetManifestArtifact; - - const stackTemplate = Template.fromJSON(stackArtifact.template); - stackTemplate.hasResourceProperties('CDK::TestResource', { - ImageUri: { 'Fn::Sub': '${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/${RepositoryName}:0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14' }, - ImageTag: '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14', - }); - - expect(assetArtifact.contents).toEqual(expect.objectContaining({ - dockerImages: expect.objectContaining({ - '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14': { - destinations: { - 'current_account-current_region': { - repositoryName: 'write-repo', - imageTag: '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14', - }, - }, - source: { - directory: 'asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14', - }, - }, - }), - })); -}); - -class CustomSynthesizer extends StackSynthesizer { - private readonly manifest = new AssetManifestBuilder(); - private parameter?: CfnParameter; - - override bind(stack: Stack) { - super.bind(stack); - - this.parameter = new CfnParameter(stack, 'RepositoryName'); - } - - addFileAsset(asset: FileAssetSource): FileAssetLocation { - void(asset); - throw new Error('file assets not supported here'); - } - - addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation { - const dest = this.manifest.defaultAddDockerImageAsset(this.boundStack, asset, { - repositoryName: 'write-repo', - }); - return this.cloudFormationLocationFromDockerImageAsset({ - ...dest, - repositoryName: ['${', this.parameter!.logicalId, '}'].join(''), - }); - } - - synthesize(session: ISynthesisSession): void { - // NOTE: Explicitly not adding template to asset manifest - this.synthesizeTemplate(session); - const assetManifestId = this.manifest.emitManifest(this.boundStack, session); - - this.emitArtifact(session, { - additionalDependencies: [assetManifestId], - }); - } -} diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/asset.a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474.tar b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/asset.a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474.tar deleted file mode 100644 index 2e9b55a25a8a7..0000000000000 Binary files a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/asset.a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474.tar and /dev/null differ diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.assets.json b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.assets.json deleted file mode 100644 index ad93a80114888..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ-assets-tarball.assets.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "version": "22.0.0", - "files": { - "7e85363095650cdc9e77b849e3afda82da3123dd43f5d237b9601f816ddf583e": { - "source": { - "path": "integ-assets-tarball.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7e85363095650cdc9e77b849e3afda82da3123dd43f5d237b9601f816ddf583e.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": { - "a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474": { - "source": { - "executable": [ - "sh", - "-c", - "docker load -i asset.a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474.tar | tail -n 1 | sed \"s/Loaded image: //g\"" - ] - }, - "destinations": { - "current_account-current_region": { - "repositoryName": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}", - "imageTag": "a5fbe3aa4a0e49fac7d3fbe7b913cf022d307bfad6ef1e88e06cc2a229523474", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ.json b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ.json deleted file mode 100644 index 0f4dded2efe13..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "22.0.0", - "testCases": { - "LoadFromTarball/DefaultTest": { - "stacks": [ - "integ-assets-tarball" - ], - "assertionStack": "LoadFromTarball/DefaultTest/DeployAssert", - "assertionStackName": "LoadFromTarballDefaultTestDeployAssert46673615" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/manifest.json b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/manifest.json deleted file mode 100644 index f5c1d20d76c84..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/manifest.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "version": "22.0.0", - "artifacts": { - "integ-assets-tarball.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "integ-assets-tarball.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "integ-assets-tarball": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "integ-assets-tarball.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7e85363095650cdc9e77b849e3afda82da3123dd43f5d237b9601f816ddf583e.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "integ-assets-tarball.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "integ-assets-tarball.assets" - ], - "metadata": { - "/integ-assets-tarball/MyUser/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "MyUserDC45028B" - } - ], - "/integ-assets-tarball/MyUser/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "MyUserDefaultPolicy7B897426" - } - ], - "/integ-assets-tarball/ImageUri": [ - { - "type": "aws:cdk:logicalId", - "data": "ImageUri" - } - ], - "/integ-assets-tarball/ImageUri2": [ - { - "type": "aws:cdk:logicalId", - "data": "ImageUri2" - } - ], - "/integ-assets-tarball/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/integ-assets-tarball/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "integ-assets-tarball" - }, - "LoadFromTarballDefaultTestDeployAssert46673615.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "LoadFromTarballDefaultTestDeployAssert46673615.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "LoadFromTarballDefaultTestDeployAssert46673615": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "LoadFromTarballDefaultTestDeployAssert46673615.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "LoadFromTarballDefaultTestDeployAssert46673615.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "LoadFromTarballDefaultTestDeployAssert46673615.assets" - ], - "metadata": { - "/LoadFromTarball/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/LoadFromTarball/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "LoadFromTarball/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/tree.json b/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/tree.json deleted file mode 100644 index 3c7e326c73b0d..0000000000000 --- a/packages/@aws-cdk/aws-ecr-assets/test/integ.assets-tarball.js.snapshot/tree.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "integ-assets-tarball": { - "id": "integ-assets-tarball", - "path": "integ-assets-tarball", - "children": { - "DockerImage": { - "id": "DockerImage", - "path": "integ-assets-tarball/DockerImage", - "children": { - "Staging": { - "id": "Staging", - "path": "integ-assets-tarball/DockerImage/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Repository": { - "id": "Repository", - "path": "integ-assets-tarball/DockerImage/Repository", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr-assets.TarballImageAsset", - "version": "0.0.0" - } - }, - "DockerImage2": { - "id": "DockerImage2", - "path": "integ-assets-tarball/DockerImage2", - "children": { - "Staging": { - "id": "Staging", - "path": "integ-assets-tarball/DockerImage2/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Repository": { - "id": "Repository", - "path": "integ-assets-tarball/DockerImage2/Repository", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr-assets.TarballImageAsset", - "version": "0.0.0" - } - }, - "MyUser": { - "id": "MyUser", - "path": "integ-assets-tarball/MyUser", - "children": { - "Resource": { - "id": "Resource", - "path": "integ-assets-tarball/MyUser/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::User", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnUser", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "integ-assets-tarball/MyUser/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "integ-assets-tarball/MyUser/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ecr:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":repository/", - { - "Fn::Sub": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}" - } - ] - ] - } - }, - { - "Action": "ecr:GetAuthorizationToken", - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "MyUserDefaultPolicy7B897426", - "users": [ - { - "Ref": "MyUserDC45028B" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.User", - "version": "0.0.0" - } - }, - "ImageUri": { - "id": "ImageUri", - "path": "integ-assets-tarball/ImageUri", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "ImageUri2": { - "id": "ImageUri2", - "path": "integ-assets-tarball/ImageUri2", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "integ-assets-tarball/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "integ-assets-tarball/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - }, - "LoadFromTarball": { - "id": "LoadFromTarball", - "path": "LoadFromTarball", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "LoadFromTarball/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "LoadFromTarball/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "LoadFromTarball/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "LoadFromTarball/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "LoadFromTarball/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.189" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr/.eslintrc.js b/packages/@aws-cdk/aws-ecr/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ecr/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ecr/.gitignore b/packages/@aws-cdk/aws-ecr/.gitignore deleted file mode 100644 index 5416b7824aee9..0000000000000 --- a/packages/@aws-cdk/aws-ecr/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ecr/.npmignore b/packages/@aws-cdk/aws-ecr/.npmignore deleted file mode 100644 index faeddcf211369..0000000000000 --- a/packages/@aws-cdk/aws-ecr/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ecr/LICENSE b/packages/@aws-cdk/aws-ecr/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ecr/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ecr/NOTICE b/packages/@aws-cdk/aws-ecr/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ecr/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ecr/README.md b/packages/@aws-cdk/aws-ecr/README.md deleted file mode 100644 index fdfbe2319f9d3..0000000000000 --- a/packages/@aws-cdk/aws-ecr/README.md +++ /dev/null @@ -1,138 +0,0 @@ -# Amazon ECR Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This package contains constructs for working with Amazon Elastic Container Registry. - -## Repositories - -Define a repository by creating a new instance of `Repository`. A repository -holds multiple versions of a single container image. - -```ts -const repository = new ecr.Repository(this, 'Repository'); -``` - -## Image scanning - -Amazon ECR image scanning helps in identifying software vulnerabilities in your container images. You can manually scan container images stored in Amazon ECR, or you can configure your repositories to scan images when you push them to a repository. To create a new repository to scan on push, simply enable `imageScanOnPush` in the properties - -```ts -const repository = new ecr.Repository(this, 'Repo', { - imageScanOnPush: true, -}); -``` - -To create an `onImageScanCompleted` event rule and trigger the event target - -```ts -declare const repository: ecr.Repository; -declare const target: SomeTarget; - -repository.onImageScanCompleted('ImageScanComplete') - .addTarget(target); -``` - -### Authorization Token - -Besides the Amazon ECR APIs, ECR also allows the Docker CLI or a language-specific Docker library to push and pull -images from an ECR repository. However, the Docker CLI does not support native IAM authentication methods and -additional steps must be taken so that Amazon ECR can authenticate and authorize Docker push and pull requests. -More information can be found at at [Registry Authentication](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth). - -A Docker authorization token can be obtained using the `GetAuthorizationToken` ECR API. The following code snippets -grants an IAM user access to call this API. - -```ts -const user = new iam.User(this, 'User'); -ecr.AuthorizationToken.grantRead(user); -``` - -If you access images in the [Public ECR Gallery](https://gallery.ecr.aws/) as well, it is recommended you authenticate to the registry to benefit from -higher rate and bandwidth limits. - -> See `Pricing` in https://aws.amazon.com/blogs/aws/amazon-ecr-public-a-new-public-container-registry/ and [Service quotas](https://docs.aws.amazon.com/AmazonECR/latest/public/public-service-quotas.html). - -The following code snippet grants an IAM user access to retrieve an authorization token for the public gallery. - -```ts -const user = new iam.User(this, 'User'); -ecr.PublicGalleryAuthorizationToken.grantRead(user); -``` - -This user can then proceed to login to the registry using one of the [authentication methods](https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#public-registry-auth). - -### Image tag immutability - -You can set tag immutability on images in our repository using the `imageTagMutability` construct prop. - -```ts -new ecr.Repository(this, 'Repo', { imageTagMutability: ecr.TagMutability.IMMUTABLE }); -``` - -### Encryption - -By default, Amazon ECR uses server-side encryption with Amazon S3-managed encryption keys which encrypts your data at rest using an AES-256 encryption algorithm. For more control over the encryption for your Amazon ECR repositories, you can use server-side encryption with KMS keys stored in AWS Key Management Service (AWS KMS). Read more about this feature in the [ECR Developer Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html). - -When you use AWS KMS to encrypt your data, you can either use the default AWS managed key, which is managed by Amazon ECR, by specifying `RepositoryEncryption.KMS` in the `encryption` property. Or specify your own customer managed KMS key, by specifying the `encryptionKey` property. - -When `encryptionKey` is set, the `encryption` property must be `KMS` or empty. - -In the case `encryption` is set to `KMS` but no `encryptionKey` is set, an AWS managed KMS key is used. - -```ts -new ecr.Repository(this, 'Repo', { - encryption: ecr.RepositoryEncryption.KMS -}); -``` - -Otherwise, a customer-managed KMS key is used if `encryptionKey` was set and `encryption` was optionally set to `KMS`. - -```ts -import * as kms from '@aws-cdk/aws-kms'; - -new ecr.Repository(this, 'Repo', { - encryptionKey: new kms.Key(this, 'Key'), -}); -``` - -## Automatically clean up repositories - -You can set life cycle rules to automatically clean up old images from your -repository. The first life cycle rule that matches an image will be applied -against that image. For example, the following deletes images older than -30 days, while keeping all images tagged with prod (note that the order -is important here): - -```ts -declare const repository: ecr.Repository; -repository.addLifecycleRule({ tagPrefixList: ['prod'], maxImageCount: 9999 }); -repository.addLifecycleRule({ maxImageAge: Duration.days(30) }); -``` - -### Repository deletion - -When a repository is removed from a stack (or the stack is deleted), the ECR -repository will be removed according to its removal policy (which by default will -simply orphan the repository and leave it in your AWS account). If the removal -policy is set to `RemovalPolicy.DESTROY`, the repository will be deleted as long -as it does not contain any images. - -To override this and force all images to get deleted during repository deletion, -enable the`autoDeleteImages` option. - -```ts -const repository = new Repository(this, 'MyTempRepo', { - removalPolicy: RemovalPolicy.DESTROY, - autoDeleteImages: true, -}); -``` diff --git a/packages/@aws-cdk/aws-ecr/jest.config.js b/packages/@aws-cdk/aws-ecr/jest.config.js deleted file mode 100644 index 09efb83e68e72..0000000000000 --- a/packages/@aws-cdk/aws-ecr/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - ...baseConfig.coverageThreshold.global, - branches: 70, - statements: 78, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-ecr/lib/repository.ts b/packages/@aws-cdk/aws-ecr/lib/repository.ts deleted file mode 100644 index 7992af2774b30..0000000000000 --- a/packages/@aws-cdk/aws-ecr/lib/repository.ts +++ /dev/null @@ -1,900 +0,0 @@ -import { EOL } from 'os'; -import * as path from 'path'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { - ArnFormat, - IResource, - Lazy, - RemovalPolicy, - Resource, - Stack, - Tags, - Token, - TokenComparison, - CustomResource, - CustomResourceProvider, - CustomResourceProviderRuntime, -} from '@aws-cdk/core'; -import { IConstruct, Construct } from 'constructs'; -import { CfnRepository } from './ecr.generated'; -import { LifecycleRule, TagStatus } from './lifecycle'; - -const AUTO_DELETE_IMAGES_RESOURCE_TYPE = 'Custom::ECRAutoDeleteImages'; -const AUTO_DELETE_IMAGES_TAG = 'aws-cdk:auto-delete-images'; - -/** - * Represents an ECR repository. - */ -export interface IRepository extends IResource { - /** - * The name of the repository - * @attribute - */ - readonly repositoryName: string; - - /** - * The ARN of the repository - * @attribute - */ - readonly repositoryArn: string; - - /** - * The URI of this repository (represents the latest image): - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY - * - * @attribute - */ - readonly repositoryUri: string; - - /** - * Returns the URI of the repository for a certain tag. Can be used in `docker push/pull`. - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] - * - * @param tag Image tag to use (tools usually default to "latest" if omitted) - */ - repositoryUriForTag(tag?: string): string; - - /** - * Returns the URI of the repository for a certain digest. Can be used in `docker push/pull`. - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] - * - * @param digest Image digest to use (tools usually default to the image with the "latest" tag if omitted) - */ - repositoryUriForDigest(digest?: string): string; - - /** - * Returns the URI of the repository for a certain tag or digest, inferring based on the syntax of the tag. Can be used in `docker push/pull`. - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] - * - * @param tagOrDigest Image tag or digest to use (tools usually default to the image with the "latest" tag if omitted) - */ - repositoryUriForTagOrDigest(tagOrDigest?: string): string; - - /** - * Add a policy statement to the repository's resource policy - */ - addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult; - - /** - * Grant the given principal identity permissions to perform the actions on this repository - */ - grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant; - - /** - * Grant the given identity permissions to pull images in this repository. - */ - grantPull(grantee: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity permissions to pull and push images to this repository. - */ - grantPullPush(grantee: iam.IGrantable): iam.Grant; - - /** - * Define a CloudWatch event that triggers when something happens to this repository - * - * Requires that there exists at least one CloudTrail Trail in your account - * that captures the event. This method will not create the Trail. - * - * @param id The id of the rule - * @param options Options for adding the rule - */ - onCloudTrailEvent(id: string, options?: events.OnEventOptions): events.Rule; - - /** - * Defines an AWS CloudWatch event rule that can trigger a target when an image is pushed to this - * repository. - * - * Requires that there exists at least one CloudTrail Trail in your account - * that captures the event. This method will not create the Trail. - * - * @param id The id of the rule - * @param options Options for adding the rule - */ - onCloudTrailImagePushed(id: string, options?: OnCloudTrailImagePushedOptions): events.Rule; - - /** - * Defines an AWS CloudWatch event rule that can trigger a target when the image scan is completed - * - * - * @param id The id of the rule - * @param options Options for adding the rule - */ - onImageScanCompleted(id: string, options?: OnImageScanCompletedOptions): events.Rule; - - /** - * Defines a CloudWatch event rule which triggers for repository events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - onEvent(id: string, options?: events.OnEventOptions): events.Rule; -} - -/** - * Base class for ECR repository. Reused between imported repositories and owned repositories. - */ -export abstract class RepositoryBase extends Resource implements IRepository { - /** - * The name of the repository - */ - public abstract readonly repositoryName: string; - - /** - * The ARN of the repository - */ - public abstract readonly repositoryArn: string; - - /** - * Add a policy statement to the repository's resource policy - */ - public abstract addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult; - - /** - * The URI of this repository (represents the latest image): - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY - * - */ - public get repositoryUri() { - return this.repositoryUriForTag(); - } - - /** - * Returns the URL of the repository. Can be used in `docker push/pull`. - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] - * - * @param tag Optional image tag - */ - public repositoryUriForTag(tag?: string): string { - const tagSuffix = tag ? `:${tag}` : ''; - return this.repositoryUriWithSuffix(tagSuffix); - } - - /** - * Returns the URL of the repository. Can be used in `docker push/pull`. - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] - * - * @param digest Optional image digest - */ - public repositoryUriForDigest(digest?: string): string { - const digestSuffix = digest ? `@${digest}` : ''; - return this.repositoryUriWithSuffix(digestSuffix); - } - - /** - * Returns the URL of the repository. Can be used in `docker push/pull`. - * - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] - * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] - * - * @param tagOrDigest Optional image tag or digest (digests must start with `sha256:`) - */ - public repositoryUriForTagOrDigest(tagOrDigest?: string): string { - if (tagOrDigest?.startsWith('sha256:')) { - return this.repositoryUriForDigest(tagOrDigest); - } else { - return this.repositoryUriForTag(tagOrDigest); - } - } - - /** - * Returns the repository URI, with an appended suffix, if provided. - * @param suffix An image tag or an image digest. - * @private - */ - private repositoryUriWithSuffix(suffix?: string): string { - const parts = this.stack.splitArn(this.repositoryArn, ArnFormat.SLASH_RESOURCE_NAME); - return `${parts.account}.dkr.ecr.${parts.region}.${this.stack.urlSuffix}/${this.repositoryName}${suffix}`; - } - - /** - * Define a CloudWatch event that triggers when something happens to this repository - * - * Requires that there exists at least one CloudTrail Trail in your account - * that captures the event. This method will not create the Trail. - * - * @param id The id of the rule - * @param options Options for adding the rule - */ - public onCloudTrailEvent(id: string, options: events.OnEventOptions = {}): events.Rule { - const rule = new events.Rule(this, id, options); - rule.addTarget(options.target); - rule.addEventPattern({ - source: ['aws.ecr'], - detailType: ['AWS API Call via CloudTrail'], - detail: { - requestParameters: { - repositoryName: [this.repositoryName], - }, - }, - }); - return rule; - } - - /** - * Defines an AWS CloudWatch event rule that can trigger a target when an image is pushed to this - * repository. - * - * Requires that there exists at least one CloudTrail Trail in your account - * that captures the event. This method will not create the Trail. - * - * @param id The id of the rule - * @param options Options for adding the rule - */ - public onCloudTrailImagePushed(id: string, options: OnCloudTrailImagePushedOptions = {}): events.Rule { - const rule = this.onCloudTrailEvent(id, options); - rule.addEventPattern({ - detail: { - eventName: ['PutImage'], - requestParameters: { - imageTag: options.imageTag ? [options.imageTag] : undefined, - }, - }, - }); - return rule; - } - /** - * Defines an AWS CloudWatch event rule that can trigger a target when an image scan is completed - * - * - * @param id The id of the rule - * @param options Options for adding the rule - */ - public onImageScanCompleted(id: string, options: OnImageScanCompletedOptions = {}): events.Rule { - const rule = new events.Rule(this, id, options); - rule.addTarget(options.target); - rule.addEventPattern({ - source: ['aws.ecr'], - detailType: ['ECR Image Scan'], - detail: { - 'repository-name': [this.repositoryName], - 'scan-status': ['COMPLETE'], - 'image-tags': options.imageTags ?? undefined, - }, - }); - return rule; - } - - /** - * Defines a CloudWatch event rule which triggers for repository events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - public onEvent(id: string, options: events.OnEventOptions = {}) { - const rule = new events.Rule(this, id, options); - rule.addEventPattern({ - source: ['aws.ecr'], - resources: [this.repositoryArn], - }); - rule.addTarget(options.target); - return rule; - } - - /** - * Grant the given principal identity permissions to perform the actions on this repository - */ - public grant(grantee: iam.IGrantable, ...actions: string[]) { - const crossAccountPrincipal = this.unsafeCrossAccountResourcePolicyPrincipal(grantee); - if (crossAccountPrincipal) { - // If the principal is from a different account, - // that means addToPrincipalOrResource() will update the Resource Policy of this repo to trust that principal. - // However, ECR verifies that the principal used in the Policy exists, - // and will error out if it doesn't. - // Because of that, if the principal is a newly created resource, - // and there is not a dependency relationship between the Stacks of this repo and the principal, - // trust the entire account of the principal instead - // (otherwise, deploying this repo will fail). - // To scope down the permissions as much as possible, - // only trust principals from that account with a specific tag - const crossAccountPrincipalStack = Stack.of(crossAccountPrincipal); - const roleTag = `${crossAccountPrincipalStack.stackName}_${crossAccountPrincipal.node.addr}`; - Tags.of(crossAccountPrincipal).add('aws-cdk:id', roleTag); - this.addToResourcePolicy(new iam.PolicyStatement({ - actions, - principals: [new iam.AccountPrincipal(crossAccountPrincipalStack.account)], - conditions: { - StringEquals: { 'aws:PrincipalTag/aws-cdk:id': roleTag }, - }, - })); - - return iam.Grant.addToPrincipal({ - grantee, - actions, - resourceArns: [this.repositoryArn], - scope: this, - }); - } else { - return iam.Grant.addToPrincipalOrResource({ - grantee, - actions, - resourceArns: [this.repositoryArn], - resourceSelfArns: [], - resource: this, - }); - } - } - - /** - * Grant the given identity permissions to use the images in this repository - */ - public grantPull(grantee: iam.IGrantable) { - const ret = this.grant(grantee, 'ecr:BatchCheckLayerAvailability', 'ecr:GetDownloadUrlForLayer', 'ecr:BatchGetImage'); - - iam.Grant.addToPrincipal({ - grantee, - actions: ['ecr:GetAuthorizationToken'], - resourceArns: ['*'], - scope: this, - }); - - return ret; - } - - /** - * Grant the given identity permissions to pull and push images to this repository. - */ - public grantPullPush(grantee: iam.IGrantable) { - this.grantPull(grantee); - return this.grant(grantee, - 'ecr:PutImage', - 'ecr:InitiateLayerUpload', - 'ecr:UploadLayerPart', - 'ecr:CompleteLayerUpload'); - } - - /** - * Returns the resource that backs the given IAM grantee if we cannot put a direct reference - * to the grantee in the resource policy of this ECR repository, - * and 'undefined' in case we can. - */ - private unsafeCrossAccountResourcePolicyPrincipal(grantee: iam.IGrantable): IConstruct | undefined { - // A principal cannot be safely added to the Resource Policy of this ECR repository, if: - // 1. The principal is from a different account, and - // 2. The principal is a new resource (meaning, not just referenced), and - // 3. The Stack this repo belongs to doesn't depend on the Stack the principal belongs to. - - // condition #1 - const principal = grantee.grantPrincipal; - const principalAccount = principal.principalAccount; - if (!principalAccount) { - return undefined; - } - const repoAndPrincipalAccountCompare = Token.compareStrings(this.env.account, principalAccount); - if (repoAndPrincipalAccountCompare === TokenComparison.BOTH_UNRESOLVED || - repoAndPrincipalAccountCompare === TokenComparison.SAME) { - return undefined; - } - - // condition #2 - if (!iam.principalIsOwnedResource(principal)) { - return undefined; - } - - // condition #3 - const principalStack = Stack.of(principal); - if (this.stack.dependencies.includes(principalStack)) { - return undefined; - } - - return principal; - } -} - -/** - * Options for the onCloudTrailImagePushed method - */ -export interface OnCloudTrailImagePushedOptions extends events.OnEventOptions { - /** - * Only watch changes to this image tag - * - * @default - Watch changes to all tags - */ - readonly imageTag?: string; -} - -/** - * Options for the OnImageScanCompleted method - */ -export interface OnImageScanCompletedOptions extends events.OnEventOptions { - /** - * Only watch changes to the image tags spedified. - * Leave it undefined to watch the full repository. - * - * @default - Watch the changes to the repository with all image tags - */ - readonly imageTags?: string[]; -} - -export interface RepositoryProps { - /** - * Name for this repository - * - * @default Automatically generated name. - */ - readonly repositoryName?: string; - - /** - * The kind of server-side encryption to apply to this repository. - * - * If you choose KMS, you can specify a KMS key via `encryptionKey`. If - * encryptionKey is not specified, an AWS managed KMS key is used. - * - * @default - `KMS` if `encryptionKey` is specified, or `AES256` otherwise. - */ - readonly encryption?: RepositoryEncryption; - - /** - * External KMS key to use for repository encryption. - * - * The 'encryption' property must be either not specified or set to "KMS". - * An error will be emitted if encryption is set to "AES256". - * - * @default - If encryption is set to `KMS` and this property is undefined, - * an AWS managed KMS key is used. - */ - readonly encryptionKey?: kms.IKey; - - /** - * Life cycle rules to apply to this registry - * - * @default No life cycle rules - */ - readonly lifecycleRules?: LifecycleRule[]; - - /** - * The AWS account ID associated with the registry that contains the repository. - * - * @see https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutLifecyclePolicy.html - * @default The default registry is assumed. - */ - readonly lifecycleRegistryId?: string; - - /** - * Determine what happens to the repository when the resource/stack is deleted. - * - * @default RemovalPolicy.Retain - */ - readonly removalPolicy?: RemovalPolicy; - - /** - * Enable the scan on push when creating the repository - * - * @default false - */ - readonly imageScanOnPush?: boolean; - - /** - * The tag mutability setting for the repository. If this parameter is omitted, the default setting of MUTABLE will be used which will allow image tags to be overwritten. - * - * @default TagMutability.MUTABLE - */ - readonly imageTagMutability?: TagMutability; - - /** - * Whether all images should be automatically deleted when the repository is - * removed from the stack or when the stack is deleted. - * - * Requires the `removalPolicy` to be set to `RemovalPolicy.DESTROY`. - * - * @default false - */ - readonly autoDeleteImages?: boolean; -} - -export interface RepositoryAttributes { - readonly repositoryName: string; - readonly repositoryArn: string; -} - -/** - * Define an ECR repository - */ -export class Repository extends RepositoryBase { - /** - * Import a repository - */ - public static fromRepositoryAttributes(scope: Construct, id: string, attrs: RepositoryAttributes): IRepository { - class Import extends RepositoryBase { - public readonly repositoryName = attrs.repositoryName; - public readonly repositoryArn = attrs.repositoryArn; - - public addToResourcePolicy(_statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { - // dropped - return { statementAdded: false }; - } - } - - return new Import(scope, id); - } - - public static fromRepositoryArn(scope: Construct, id: string, repositoryArn: string): IRepository { - - // if repositoryArn is a token, the repository name is also required. this is because - // repository names can include "/" (e.g. foo/bar/myrepo) and it is impossible to - // parse the name from an ARN using CloudFormation's split/select. - if (Token.isUnresolved(repositoryArn)) { - throw new Error('"repositoryArn" is a late-bound value, and therefore "repositoryName" is required. Use `fromRepositoryAttributes` instead'); - } - - const repositoryName = repositoryArn.split('/').slice(1).join('/'); - - class Import extends RepositoryBase { - public repositoryName = repositoryName; - public repositoryArn = repositoryArn; - - public addToResourcePolicy(_statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { - // dropped - return { statementAdded: false }; - } - } - - return new Import(scope, id, { - environmentFromArn: repositoryArn, - }); - } - - public static fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository { - class Import extends RepositoryBase { - public repositoryName = repositoryName; - public repositoryArn = Repository.arnForLocalRepository(repositoryName, scope); - - public addToResourcePolicy(_statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { - // dropped - return { statementAdded: false }; - } - } - - return new Import(scope, id); - } - - /** - * Returns an ECR ARN for a repository that resides in the same account/region - * as the current stack. - */ - public static arnForLocalRepository(repositoryName: string, scope: IConstruct, account?: string): string { - return Stack.of(scope).formatArn({ - account, - service: 'ecr', - resource: 'repository', - resourceName: repositoryName, - }); - } - - private static validateRepositoryName(physicalName: string) { - const repositoryName = physicalName; - if (!repositoryName || Token.isUnresolved(repositoryName)) { - // the name is a late-bound value, not a defined string, - // so skip validation - return; - } - - const errors: string[] = []; - - // Rules codified from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html - if (repositoryName.length < 2 || repositoryName.length > 256) { - errors.push('Repository name must be at least 2 and no more than 256 characters'); - } - const isPatternMatch = /^(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)*[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(repositoryName); - if (!isPatternMatch) { - errors.push('Repository name must follow the specified pattern: (?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*'); - } - - if (errors.length > 0) { - throw new Error(`Invalid ECR repository name (value: ${repositoryName})${EOL}${errors.join(EOL)}`); - } - } - - public readonly repositoryName: string; - public readonly repositoryArn: string; - private readonly lifecycleRules = new Array(); - private readonly registryId?: string; - private policyDocument?: iam.PolicyDocument; - private readonly _resource: CfnRepository; - - constructor(scope: Construct, id: string, props: RepositoryProps = {}) { - super(scope, id, { - physicalName: props.repositoryName, - }); - - Repository.validateRepositoryName(this.physicalName); - - const resource = new CfnRepository(this, 'Resource', { - repositoryName: this.physicalName, - // It says "Text", but they actually mean "Object". - repositoryPolicyText: Lazy.any({ produce: () => this.policyDocument }), - lifecyclePolicy: Lazy.any({ produce: () => this.renderLifecyclePolicy() }), - imageScanningConfiguration: props.imageScanOnPush !== undefined ? { scanOnPush: props.imageScanOnPush } : undefined, - imageTagMutability: props.imageTagMutability || undefined, - encryptionConfiguration: this.parseEncryption(props), - }); - this._resource = resource; - - if (props.autoDeleteImages) { - if (props.removalPolicy !== RemovalPolicy.DESTROY) { - throw new Error('Cannot use \'autoDeleteImages\' property on a repository without setting removal policy to \'DESTROY\'.'); - } - this.enableAutoDeleteImages(); - } - - resource.applyRemovalPolicy(props.removalPolicy); - - this.registryId = props.lifecycleRegistryId; - if (props.lifecycleRules) { - props.lifecycleRules.forEach(this.addLifecycleRule.bind(this)); - } - - this.repositoryName = this.getResourceNameAttribute(resource.ref); - this.repositoryArn = this.getResourceArnAttribute(resource.attrArn, { - service: 'ecr', - resource: 'repository', - resourceName: this.physicalName, - }); - - this.node.addValidation({ validate: () => this.policyDocument?.validateForResourcePolicy() ?? [] }); - } - - public addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { - if (this.policyDocument === undefined) { - this.policyDocument = new iam.PolicyDocument(); - } - this.policyDocument.addStatements(statement); - return { statementAdded: true, policyDependable: this.policyDocument }; - } - - /** - * Add a life cycle rule to the repository - * - * Life cycle rules automatically expire images from the repository that match - * certain conditions. - */ - public addLifecycleRule(rule: LifecycleRule) { - // Validate rule here so users get errors at the expected location - if (rule.tagStatus === undefined) { - rule = { ...rule, tagStatus: rule.tagPrefixList === undefined ? TagStatus.ANY : TagStatus.TAGGED }; - } - - if (rule.tagStatus === TagStatus.TAGGED && (rule.tagPrefixList === undefined || rule.tagPrefixList.length === 0)) { - throw new Error('TagStatus.Tagged requires the specification of a tagPrefixList'); - } - if (rule.tagStatus !== TagStatus.TAGGED && rule.tagPrefixList !== undefined) { - throw new Error('tagPrefixList can only be specified when tagStatus is set to Tagged'); - } - if ((rule.maxImageAge !== undefined) === (rule.maxImageCount !== undefined)) { - throw new Error(`Life cycle rule must contain exactly one of 'maxImageAge' and 'maxImageCount', got: ${JSON.stringify(rule)}`); - } - - if (rule.tagStatus === TagStatus.ANY && this.lifecycleRules.filter(r => r.tagStatus === TagStatus.ANY).length > 0) { - throw new Error('Life cycle can only have one TagStatus.Any rule'); - } - - this.lifecycleRules.push({ ...rule }); - } - - /** - * Render the life cycle policy object - */ - private renderLifecyclePolicy(): CfnRepository.LifecyclePolicyProperty | undefined { - const stack = Stack.of(this); - let lifecyclePolicyText: any; - - if (this.lifecycleRules.length === 0 && !this.registryId) { return undefined; } - - if (this.lifecycleRules.length > 0) { - lifecyclePolicyText = JSON.stringify(stack.resolve({ - rules: this.orderedLifecycleRules().map(renderLifecycleRule), - })); - } - - return { - lifecyclePolicyText, - registryId: this.registryId, - }; - } - - /** - * Return life cycle rules with automatic ordering applied. - * - * Also applies validation of the 'any' rule. - */ - private orderedLifecycleRules(): LifecycleRule[] { - if (this.lifecycleRules.length === 0) { return []; } - - const prioritizedRules = this.lifecycleRules.filter(r => r.rulePriority !== undefined && r.tagStatus !== TagStatus.ANY); - const autoPrioritizedRules = this.lifecycleRules.filter(r => r.rulePriority === undefined && r.tagStatus !== TagStatus.ANY); - const anyRules = this.lifecycleRules.filter(r => r.tagStatus === TagStatus.ANY); - if (anyRules.length > 0 && anyRules[0].rulePriority !== undefined && autoPrioritizedRules.length > 0) { - // Supporting this is too complex for very little value. We just prohibit it. - throw new Error("Cannot combine prioritized TagStatus.Any rule with unprioritized rules. Remove rulePriority from the 'Any' rule."); - } - - const prios = prioritizedRules.map(r => r.rulePriority!); - let autoPrio = (prios.length > 0 ? Math.max(...prios) : 0) + 1; - - const ret = new Array(); - for (const rule of prioritizedRules.concat(autoPrioritizedRules).concat(anyRules)) { - ret.push({ - ...rule, - rulePriority: rule.rulePriority ?? autoPrio++, - }); - } - - // Do validation on the final array--might still be wrong because the user supplied all prios, but incorrectly. - validateAnyRuleLast(ret); - return ret; - } - - /** - * Set up key properties and return the Repository encryption property from the - * user's configuration. - */ - private parseEncryption(props: RepositoryProps): CfnRepository.EncryptionConfigurationProperty | undefined { - - // default based on whether encryptionKey is specified - const encryptionType = props.encryption ?? (props.encryptionKey ? RepositoryEncryption.KMS : RepositoryEncryption.AES_256); - - // if encryption key is set, encryption must be set to KMS. - if (encryptionType !== RepositoryEncryption.KMS && props.encryptionKey) { - throw new Error(`encryptionKey is specified, so 'encryption' must be set to KMS (value: ${encryptionType.value})`); - } - - if (encryptionType === RepositoryEncryption.AES_256) { - return undefined; - } - - if (encryptionType === RepositoryEncryption.KMS) { - return { - encryptionType: 'KMS', - kmsKey: props.encryptionKey?.keyArn, - }; - } - - throw new Error(`Unexpected 'encryptionType': ${encryptionType}`); - } - - private enableAutoDeleteImages() { - // Use a iam policy to allow the custom resource to list & delete - // images in the repository and the ability to get all repositories to find the arn needed on delete. - const provider = CustomResourceProvider.getOrCreateProvider(this, AUTO_DELETE_IMAGES_RESOURCE_TYPE, { - codeDirectory: path.join(__dirname, 'auto-delete-images-handler'), - runtime: CustomResourceProviderRuntime.NODEJS_14_X, - description: `Lambda function for auto-deleting images in ${this.repositoryName} repository.`, - policyStatements: [ - { - Effect: 'Allow', - Action: [ - 'ecr:BatchDeleteImage', - 'ecr:DescribeRepositories', - 'ecr:ListImages', - 'ecr:ListTagsForResource', - ], - Resource: [this._resource.attrArn], - }, - ], - }); - - const customResource = new CustomResource(this, 'AutoDeleteImagesCustomResource', { - resourceType: AUTO_DELETE_IMAGES_RESOURCE_TYPE, - serviceToken: provider.serviceToken, - properties: { - RepositoryName: Lazy.any({ produce: () => this.repositoryName }), - }, - }); - customResource.node.addDependency(this); - - // We also tag the repository to record the fact that we want it autodeleted. - // The custom resource will check this tag before actually doing the delete. - // Because tagging and untagging will ALWAYS happen before the CR is deleted, - // we can set `autoDeleteImages: false` without the removal of the CR emptying - // the repository as a side effect. - Tags.of(this._resource).add(AUTO_DELETE_IMAGES_TAG, 'true'); - } -} - -function validateAnyRuleLast(rules: LifecycleRule[]) { - const anyRules = rules.filter(r => r.tagStatus === TagStatus.ANY); - if (anyRules.length === 1) { - const maxPrio = Math.max(...rules.map(r => r.rulePriority!)); - if (anyRules[0].rulePriority !== maxPrio) { - throw new Error(`TagStatus.Any rule must have highest priority, has ${anyRules[0].rulePriority} which is smaller than ${maxPrio}`); - } - } -} - -/** - * Render the lifecycle rule to JSON - */ -function renderLifecycleRule(rule: LifecycleRule) { - return { - rulePriority: rule.rulePriority, - description: rule.description, - selection: { - tagStatus: rule.tagStatus || TagStatus.ANY, - tagPrefixList: rule.tagPrefixList, - countType: rule.maxImageAge !== undefined ? CountType.SINCE_IMAGE_PUSHED : CountType.IMAGE_COUNT_MORE_THAN, - countNumber: rule.maxImageAge?.toDays() ?? rule.maxImageCount, - countUnit: rule.maxImageAge !== undefined ? 'days' : undefined, - }, - action: { - type: 'expire', - }, - }; -} - -/** - * Select images based on counts - */ -const enum CountType { - /** - * Set a limit on the number of images in your repository - */ - IMAGE_COUNT_MORE_THAN = 'imageCountMoreThan', - - /** - * Set an age limit on the images in your repository - */ - SINCE_IMAGE_PUSHED = 'sinceImagePushed', -} - -/** - * The tag mutability setting for your repository. - */ -export enum TagMutability { - /** - * allow image tags to be overwritten. - */ - MUTABLE = 'MUTABLE', - - /** - * all image tags within the repository will be immutable which will prevent them from being overwritten. - */ - IMMUTABLE = 'IMMUTABLE', - -} - -/** - * Indicates whether server-side encryption is enabled for the object, and whether that encryption is - * from the AWS Key Management Service (AWS KMS) or from Amazon S3 managed encryption (SSE-S3). - * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata - */ -export class RepositoryEncryption { - /** - * 'AES256' - */ - public static readonly AES_256 = new RepositoryEncryption('AES256'); - /** - * 'KMS' - */ - public static readonly KMS = new RepositoryEncryption('KMS'); - - /** - * @param value the string value of the encryption - */ - protected constructor(public readonly value: string) { } -} diff --git a/packages/@aws-cdk/aws-ecr/package.json b/packages/@aws-cdk/aws-ecr/package.json deleted file mode 100644 index 12125c1ca334b..0000000000000 --- a/packages/@aws-cdk/aws-ecr/package.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "name": "@aws-cdk/aws-ecr", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ECR", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ecr", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ecr" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ECR", - "packageId": "Amazon.CDK.AWS.ECR", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ecr", - "module": "aws_cdk.aws_ecr", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ecr" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ECR", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "lines": 78, - "statements": 79 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ecr" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "import:@aws-cdk/aws-ecr.Repository", - "construct-base-is-private:@aws-cdk/aws-ecr.RepositoryBase", - "docs-public-apis:@aws-cdk/aws-ecr.Repository.fromRepositoryArn", - "docs-public-apis:@aws-cdk/aws-ecr.Repository.imageTagMutability", - "docs-public-apis:@aws-cdk/aws-ecr.Repository.fromRepositoryName", - "props-default-doc:@aws-cdk/aws-ecr.LifecycleRule.maxImageAge", - "props-default-doc:@aws-cdk/aws-ecr.LifecycleRule.maxImageCount", - "props-default-doc:@aws-cdk/aws-ecr.LifecycleRule.tagPrefixList", - "docs-public-apis:@aws-cdk/aws-ecr.RepositoryAttributes", - "docs-public-apis:@aws-cdk/aws-ecr.RepositoryAttributes.repositoryArn", - "docs-public-apis:@aws-cdk/aws-ecr.RepositoryAttributes.repositoryName", - "docs-public-apis:@aws-cdk/aws-ecr.RepositoryProps" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ecr/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ecr/rosetta/default.ts-fixture deleted file mode 100644 index 6381522ef9b78..0000000000000 --- a/packages/@aws-cdk/aws-ecr/rosetta/default.ts-fixture +++ /dev/null @@ -1,23 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; - -class SomeTarget implements events.IRuleTarget { - public bind(): events.RuleTargetConfig { - return { - arn: 'ARN1', - }; - } -} - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - diff --git a/packages/@aws-cdk/aws-ecr/test/integ.basic.ts b/packages/@aws-cdk/aws-ecr/test/integ.basic.ts deleted file mode 100644 index 94e5294cc6b50..0000000000000 --- a/packages/@aws-cdk/aws-ecr/test/integ.basic.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as ecr from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecr-integ-stack'); - -const repo = new ecr.Repository(stack, 'Repo'); -repo.addLifecycleRule({ maxImageCount: 5 }); - -new cdk.CfnOutput(stack, 'RepositoryURI', { - value: repo.repositoryUri, -}); - -new IntegTest(app, 'cdk-ecr-integ-test-basic', { - testCases: [stack], -}); diff --git a/packages/@aws-cdk/aws-ecs-patterns/.eslintrc.js b/packages/@aws-cdk/aws-ecs-patterns/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ecs-patterns/.gitignore b/packages/@aws-cdk/aws-ecs-patterns/.gitignore deleted file mode 100644 index 1f6a2603bdf03..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ecs-patterns/.npmignore b/packages/@aws-cdk/aws-ecs-patterns/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ecs-patterns/LICENSE b/packages/@aws-cdk/aws-ecs-patterns/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ecs-patterns/NOTICE b/packages/@aws-cdk/aws-ecs-patterns/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ecs-patterns/README.md b/packages/@aws-cdk/aws-ecs-patterns/README.md deleted file mode 100644 index a95b2a6cf0803..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/README.md +++ /dev/null @@ -1,992 +0,0 @@ -# CDK Construct library for higher-level ECS Constructs - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library provides higher-level Amazon ECS constructs which follow common architectural patterns. It contains: - -* Application Load Balanced Services -* Network Load Balanced Services -* Queue Processing Services -* Scheduled Tasks (cron jobs) -* Additional Examples - -## Application Load Balanced Services - -To define an Amazon ECS service that is behind an application load balancer, instantiate one of the following: - -* `ApplicationLoadBalancedEc2Service` - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedEcsService = new ecsPatterns.ApplicationLoadBalancedEc2Service(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('test'), - environment: { - TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", - TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", - }, - command: ['command'], - entryPoint: ['entry', 'point'], - }, - desiredCount: 2, -}); -``` - -* `ApplicationLoadBalancedFargateService` - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - command: ['command'], - entryPoint: ['entry', 'point'], - }, -}); - -loadBalancedFargateService.targetGroup.configureHealthCheck({ - path: "/custom-health-path", -}); -``` - -Instead of providing a cluster you can specify a VPC and CDK will create a new ECS cluster. -If you deploy multiple services CDK will only create one cluster per VPC. - -You can omit `cluster` and `vpc` to let CDK create a new VPC with two AZs and create a cluster inside this VPC. - -You can customize the health check for your target group; otherwise it defaults to `HTTP` over port `80` hitting path `/`. - -Fargate services will use the `LATEST` platform version by default, but you can override by providing a value for the `platformVersion` property in the constructor. - -Fargate services use the default VPC Security Group unless one or more are provided using the `securityGroups` property in the constructor. - -By setting `redirectHTTP` to true, CDK will automatically create a listener on port 80 that redirects HTTP traffic to the HTTPS port. - -If you specify the option `recordType` you can decide if you want the construct to use CNAME or Route53-Aliases as record sets. - -If you need to encrypt the traffic between the load balancer and the ECS tasks, you can set the `targetProtocol` to `HTTPS`. - -Additionally, if more than one application target group are needed, instantiate one of the following: - -* `ApplicationMultipleTargetGroupsEc2Service` - -```ts -// One application load balancer with one listener and two target groups. -declare const cluster: ecs.Cluster; -const loadBalancedEc2Service = new ecsPatterns.ApplicationMultipleTargetGroupsEc2Service(this, 'Service', { - cluster, - memoryLimitMiB: 256, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - targetGroups: [ - { - containerPort: 80, - }, - { - containerPort: 90, - pathPattern: 'a/b/c', - priority: 10, - }, - ], -}); -``` - -* `ApplicationMultipleTargetGroupsFargateService` - -```ts -// One application load balancer with one listener and two target groups. -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - targetGroups: [ - { - containerPort: 80, - }, - { - containerPort: 90, - pathPattern: 'a/b/c', - priority: 10, - }, - ], -}); -``` - -## Network Load Balanced Services - -To define an Amazon ECS service that is behind a network load balancer, instantiate one of the following: - -* `NetworkLoadBalancedEc2Service` - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedEcsService = new ecsPatterns.NetworkLoadBalancedEc2Service(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('test'), - environment: { - TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", - TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", - }, - }, - desiredCount: 2, -}); -``` - -* `NetworkLoadBalancedFargateService` - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, -}); -``` - -The CDK will create a new Amazon ECS cluster if you specify a VPC and omit `cluster`. If you deploy multiple services the CDK will only create one cluster per VPC. - -If `cluster` and `vpc` are omitted, the CDK creates a new VPC with subnets in two Availability Zones and a cluster within this VPC. - -If you specify the option `recordType` you can decide if you want the construct to use CNAME or Route53-Aliases as record sets. - -Additionally, if more than one network target group is needed, instantiate one of the following: - -* NetworkMultipleTargetGroupsEc2Service - -```ts -// Two network load balancers, each with their own listener and target group. -declare const cluster: ecs.Cluster; -const loadBalancedEc2Service = new ecsPatterns.NetworkMultipleTargetGroupsEc2Service(this, 'Service', { - cluster, - memoryLimitMiB: 256, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - loadBalancers: [ - { - name: 'lb1', - listeners: [ - { - name: 'listener1', - }, - ], - }, - { - name: 'lb2', - listeners: [ - { - name: 'listener2', - }, - ], - }, - ], - targetGroups: [ - { - containerPort: 80, - listener: 'listener1', - }, - { - containerPort: 90, - listener: 'listener2', - }, - ], -}); -``` - -* NetworkMultipleTargetGroupsFargateService - -```ts -// Two network load balancers, each with their own listener and target group. -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - loadBalancers: [ - { - name: 'lb1', - listeners: [ - { - name: 'listener1', - }, - ], - }, - { - name: 'lb2', - listeners: [ - { - name: 'listener2', - }, - ], - }, - ], - targetGroups: [ - { - containerPort: 80, - listener: 'listener1', - }, - { - containerPort: 90, - listener: 'listener2', - }, - ], -}); -``` - -## Queue Processing Services - -To define a service that creates a queue and reads from that queue, instantiate one of the following: - -* `QueueProcessingEc2Service` - -```ts -declare const cluster: ecs.Cluster; -const queueProcessingEc2Service = new ecsPatterns.QueueProcessingEc2Service(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - image: ecs.ContainerImage.fromRegistry('test'), - command: ["-c", "4", "amazon.com"], - enableLogging: false, - desiredTaskCount: 2, - environment: { - TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", - TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", - }, - maxScalingCapacity: 5, - containerName: 'test', -}); -``` - -* `QueueProcessingFargateService` - -```ts -declare const cluster: ecs.Cluster; -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - command: ["-c", "4", "amazon.com"], - enableLogging: false, - desiredTaskCount: 2, - environment: { - TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", - TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", - }, - maxScalingCapacity: 5, - containerName: 'test', -}); -``` - -when queue not provided by user, CDK will create a primary queue and a dead letter queue with default redrive policy and attach permission to the task to be able to access the primary queue. - -## Scheduled Tasks - -To define a task that runs periodically, there are 2 options: - -* `ScheduledEc2Task` - -```ts -// Instantiate an Amazon EC2 Task to run at a scheduled interval -declare const cluster: ecs.Cluster; -const ecsScheduledTask = new ecsPatterns.ScheduledEc2Task(this, 'ScheduledTask', { - cluster, - scheduledEc2TaskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 256, - environment: { name: 'TRIGGER', value: 'CloudWatch Events' }, - }, - schedule: appscaling.Schedule.expression('rate(1 minute)'), - enabled: true, - ruleName: 'sample-scheduled-task-rule', -}); -``` - -* `ScheduledFargateTask` - -```ts -declare const cluster: ecs.Cluster; -const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { - cluster, - scheduledFargateTaskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 512, - }, - schedule: appscaling.Schedule.expression('rate(1 minute)'), - platformVersion: ecs.FargatePlatformVersion.LATEST, -}); -``` - -## Additional Examples - -In addition to using the constructs, users can also add logic to customize these constructs: - -### Configure HTTPS on an ApplicationLoadBalancedFargateService - -```ts -import { HostedZone } from '@aws-cdk/aws-route53'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { SslPolicy } from '@aws-cdk/aws-elasticloadbalancingv2'; - -const domainZone = HostedZone.fromLookup(this, 'Zone', { domainName: 'example.com' }); -const certificate = Certificate.fromCertificateArn(this, 'Cert', 'arn:aws:acm:us-east-1:123456:certificate/abcdefg'); - -declare const vpc: ec2.Vpc; -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - vpc, - cluster, - certificate, - sslPolicy: SslPolicy.RECOMMENDED, - domainName: 'api.example.com', - domainZone, - redirectHTTP: true, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, -}); -``` - -### Set capacityProviderStrategies for ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -cluster.enableFargateCapacityProviders(); - -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - capacityProviderStrategies: [ - { - capacityProvider: 'FARGATE_SPOT', - weight: 2, - base: 0, - }, - { - capacityProvider: 'FARGATE', - weight: 1, - base: 1, - }, - ], -}); -``` - -### Add Schedule-Based Auto-Scaling to an ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, -}); - -const scalableTarget = loadBalancedFargateService.service.autoScaleTaskCount({ - minCapacity: 5, - maxCapacity: 20, -}); - -scalableTarget.scaleOnSchedule('DaytimeScaleDown', { - schedule: appscaling.Schedule.cron({ hour: '8', minute: '0'}), - minCapacity: 1, -}); - -scalableTarget.scaleOnSchedule('EveningRushScaleUp', { - schedule: appscaling.Schedule.cron({ hour: '20', minute: '0'}), - minCapacity: 10, -}); -``` - -### Add Metric-Based Auto-Scaling to an ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, -}); - -const scalableTarget = loadBalancedFargateService.service.autoScaleTaskCount({ - minCapacity: 1, - maxCapacity: 20, -}); - -scalableTarget.scaleOnCpuUtilization('CpuScaling', { - targetUtilizationPercent: 50, -}); - -scalableTarget.scaleOnMemoryUtilization('MemoryScaling', { - targetUtilizationPercent: 50, -}); -``` - -### Change the default Deployment Controller - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - deploymentController: { - type: ecs.DeploymentControllerType.CODE_DEPLOY, - }, -}); -``` - -### Deployment circuit breaker and rollback - -Amazon ECS [deployment circuit breaker](https://aws.amazon.com/tw/blogs/containers/announcing-amazon-ecs-deployment-circuit-breaker/) -automatically rolls back unhealthy service deployments without the need for manual intervention. Use `circuitBreaker` to enable -deployment circuit breaker and optionally enable `rollback` for automatic rollback. See [Using the deployment circuit breaker](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html) -for more details. - -```ts -declare const cluster: ecs.Cluster; -const service = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - circuitBreaker: { rollback: true }, -}); -``` - -### Set deployment configuration on QueueProcessingService - -```ts -declare const cluster: ecs.Cluster; -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - command: ["-c", "4", "amazon.com"], - enableLogging: false, - desiredTaskCount: 2, - environment: {}, - maxScalingCapacity: 5, - maxHealthyPercent: 200, - minHealthyPercent: 66, -}); -``` - -### Set taskSubnets and securityGroups for QueueProcessingFargateService - -```ts -declare const vpc: ec2.Vpc; -declare const securityGroup: ec2.SecurityGroup; -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - vpc, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - securityGroups: [securityGroup], - taskSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, -}); -``` - -### Define tasks with public IPs for QueueProcessingFargateService - -```ts -declare const vpc: ec2.Vpc; -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - vpc, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - assignPublicIp: true, -}); -``` - -### Define tasks with custom queue parameters for QueueProcessingFargateService - -```ts -declare const vpc: ec2.Vpc; -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - vpc, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - maxReceiveCount: 42, - retentionPeriod: Duration.days(7), - visibilityTimeout: Duration.minutes(5), -}); -``` - -### Set capacityProviderStrategies for QueueProcessingFargateService - -```ts -declare const cluster: ecs.Cluster; -cluster.enableFargateCapacityProviders(); - -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - capacityProviderStrategies: [ - { - capacityProvider: 'FARGATE_SPOT', - weight: 2, - }, - { - capacityProvider: 'FARGATE', - weight: 1, - }, - ], -}); -``` - -### Set a custom container-level Healthcheck for QueueProcessingFargateService - -```ts -declare const vpc: ec2.Vpc; -declare const securityGroup: ec2.SecurityGroup; -const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { - vpc, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - healthCheck: { - command: [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ], - // the properties below are optional - interval: Duration.minutes(30), - retries: 123, - startPeriod: Duration.minutes(30), - timeout: Duration.minutes(30), - }, -}); -``` - -### Set capacityProviderStrategies for QueueProcessingEc2Service - -```ts -import * as autoscaling from '@aws-cdk/aws-autoscaling'; - -const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); -const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'asg', { - vpc, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), -}); -const capacityProvider = new ecs.AsgCapacityProvider(this, 'provider', { - autoScalingGroup, -}); -cluster.addAsgCapacityProvider(capacityProvider); - -const queueProcessingEc2Service = new ecsPatterns.QueueProcessingEc2Service(this, 'Service', { - cluster, - memoryLimitMiB: 512, - image: ecs.ContainerImage.fromRegistry('test'), - capacityProviderStrategies: [ - { - capacityProvider: capacityProvider.capacityProviderName, - }, - ], -}); -``` - -### Select specific vpc subnets for ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - taskSubnets: { - subnets: [ec2.Subnet.fromSubnetId(this, 'subnet', 'VpcISOLATEDSubnet1Subnet80F07FA0')], - }, -}); -``` - -### Select idleTimeout for ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - idleTimeout: Duration.seconds(120), -}); -``` - -### Select idleTimeout for ApplicationMultipleTargetGroupsFargateService - -```ts -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { InstanceType } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { ApplicationProtocol, SslPolicy } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); -const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'myService', { - cluster: new ecs.Cluster(this, 'EcsCluster', { vpc }), - memoryLimitMiB: 256, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - enableExecuteCommand: true, - loadBalancers: [ - { - name: 'lb', - idleTimeout: Duration.seconds(400), - domainName: 'api.example.com', - domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'example.com' }), - listeners: [ - { - name: 'listener', - protocol: ApplicationProtocol.HTTPS, - certificate: Certificate.fromCertificateArn(this, 'Cert', 'helloworld'), - sslPolicy: SslPolicy.TLS12_EXT, - }, - ], - }, - { - name: 'lb2', - idleTimeout: Duration.seconds(120), - domainName: 'frontend.com', - domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'frontend.com' }), - listeners: [ - { - name: 'listener2', - protocol: ApplicationProtocol.HTTPS, - certificate: Certificate.fromCertificateArn(this, 'Cert2', 'helloworld'), - sslPolicy: SslPolicy.TLS12_EXT, - }, - ], - }, - ], - targetGroups: [ - { - containerPort: 80, - listener: 'listener', - }, - { - containerPort: 90, - pathPattern: 'a/b/c', - priority: 10, - listener: 'listener', - }, - { - containerPort: 443, - listener: 'listener2', - }, - { - containerPort: 80, - pathPattern: 'a/b/c', - priority: 10, - listener: 'listener2', - }, - ], -}); -``` - -### Set health checks for ApplicationMultipleTargetGroupsFargateService - -```ts -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { InstanceType } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { ApplicationProtocol,Protocol, SslPolicy } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); - -const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'myService', { - cluster: new ecs.Cluster(this, 'EcsCluster', { vpc }), - memoryLimitMiB: 256, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - enableExecuteCommand: true, - loadBalancers: [ - { - name: 'lb', - idleTimeout: Duration.seconds(400), - domainName: 'api.example.com', - domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'example.com' }), - listeners: [ - { - name: 'listener', - protocol: ApplicationProtocol.HTTPS, - certificate: Certificate.fromCertificateArn(this, 'Cert', 'helloworld'), - sslPolicy: SslPolicy.TLS12_EXT, - }, - ], - }, - { - name: 'lb2', - idleTimeout: Duration.seconds(120), - domainName: 'frontend.com', - domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'frontend.com' }), - listeners: [ - { - name: 'listener2', - protocol: ApplicationProtocol.HTTPS, - certificate: Certificate.fromCertificateArn(this, 'Cert2', 'helloworld'), - sslPolicy: SslPolicy.TLS12_EXT, - }, - ], - }, - ], - targetGroups: [ - { - containerPort: 80, - listener: 'listener', - }, - { - containerPort: 90, - pathPattern: 'a/b/c', - priority: 10, - listener: 'listener', - }, - { - containerPort: 443, - listener: 'listener2', - }, - { - containerPort: 80, - pathPattern: 'a/b/c', - priority: 10, - listener: 'listener2', - }, - ], -}); - -loadBalancedFargateService.targetGroups[0].configureHealthCheck({ - port: '8050', - protocol: Protocol.HTTP, - healthyThresholdCount: 2, - unhealthyThresholdCount: 2, - timeout: Duration.seconds(10), - interval: Duration.seconds(30), - healthyHttpCodes: '200', -}); - - -loadBalancedFargateService.targetGroups[1].configureHealthCheck({ - port: '8050', - protocol: Protocol.HTTP, - healthyThresholdCount: 2, - unhealthyThresholdCount: 2, - timeout: Duration.seconds(10), - interval: Duration.seconds(30), - healthyHttpCodes: '200', -}); - -``` - -### Set runtimePlatform for ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -const applicationLoadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - runtimePlatform: { - cpuArchitecture: ecs.CpuArchitecture.ARM64, - operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, - }, -}); -``` - -### Set PlatformVersion for ScheduledFargateTask - -```ts -declare const cluster: ecs.Cluster; -const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { - cluster, - scheduledFargateTaskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 512, - }, - schedule: appscaling.Schedule.expression('rate(1 minute)'), - platformVersion: ecs.FargatePlatformVersion.VERSION1_4, -}); -``` - -### Set SecurityGroups for ScheduledFargateTask - -```ts -const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); -const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); -const securityGroup = new ec2.SecurityGroup(this, 'SG', { vpc }); - -const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { - cluster, - scheduledFargateTaskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 512, - }, - schedule: appscaling.Schedule.expression('rate(1 minute)'), - securityGroups: [securityGroup], -}); -``` - -### Use the REMOVE_DEFAULT_DESIRED_COUNT feature flag - -The REMOVE_DEFAULT_DESIRED_COUNT feature flag is used to override the default desiredCount that is autogenerated by the CDK. This will set the desiredCount of any service created by any of the following constructs to be undefined. - -* ApplicationLoadBalancedEc2Service -* ApplicationLoadBalancedFargateService -* NetworkLoadBalancedEc2Service -* NetworkLoadBalancedFargateService -* QueueProcessingEc2Service -* QueueProcessingFargateService - -If a desiredCount is not passed in as input to the above constructs, CloudFormation will either create a new service to start up with a desiredCount of 1, or update an existing service to start up with the same desiredCount as prior to the update. - -To enable the feature flag, ensure that the REMOVE_DEFAULT_DESIRED_COUNT flag within an application stack context is set to true, like so: - -```ts -declare const stack: Stack; -stack.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true); -``` - -The following is an example of an application with the REMOVE_DEFAULT_DESIRED_COUNT feature flag enabled: - -```ts nofixture -import { App, Stack } from '@aws-cdk/core'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as ecsPatterns from '@aws-cdk/aws-ecs-patterns'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as path from 'path'; - -const app = new App(); - -const stack = new Stack(app, 'aws-ecs-patterns-queue'); -stack.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true); - -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 2, -}); - -new ecsPatterns.QueueProcessingFargateService(stack, 'QueueProcessingService', { - vpc, - memoryLimitMiB: 512, - image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), -}); -``` - -### Deploy application and metrics sidecar - -The following is an example of deploying an application along with a metrics sidecar container that utilizes `dockerLabels` for discovery: - -```ts -declare const cluster: ecs.Cluster; -declare const vpc: ec2.Vpc; -const service = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - vpc, - desiredCount: 1, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - dockerLabels: { - 'application.label.one': 'first_label', - 'application.label.two': 'second_label', - }, - }, -}); - -service.taskDefinition.addContainer('Sidecar', { - image: ecs.ContainerImage.fromRegistry('example/metrics-sidecar'), -}); -``` - -### Select specific load balancer name ApplicationLoadBalancedFargateService - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - taskSubnets: { - subnets: [ec2.Subnet.fromSubnetId(this, 'subnet', 'VpcISOLATEDSubnet1Subnet80F07FA0')], - }, - loadBalancerName: 'application-lb-name', -}); -``` - -### ECS Exec - -You can use ECS Exec to run commands in or get a shell to a container running on an Amazon EC2 instance or on -AWS Fargate. Enable ECS Exec, by setting `enableExecuteCommand` to `true`. - -ECS Exec is supported by all Services i.e. `ApplicationLoadBalanced(Fargate|Ec2)Service`, `ApplicationMultipleTargetGroups(Fargate|Ec2)Service`, `NetworkLoadBalanced(Fargate|Ec2)Service`, `NetworkMultipleTargetGroups(Fargate|Ec2)Service`, `QueueProcessing(Fargate|Ec2)Service`. It is not supported for `ScheduledTask`s. - -Read more about ECS Exec in the [ECS Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html). - -Example: - -```ts -declare const cluster: ecs.Cluster; -const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { - cluster, - memoryLimitMiB: 1024, - desiredCount: 1, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - }, - enableExecuteCommand: true -}); -``` - -Please note, ECS Exec leverages AWS Systems Manager (SSM). So as a prerequisite for the exec command -to work, you need to have the SSM plugin for the AWS CLI installed locally. For more information, see -[Install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html). diff --git a/packages/@aws-cdk/aws-ecs-patterns/jest.config.js b/packages/@aws-cdk/aws-ecs-patterns/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ecs-patterns/package.json b/packages/@aws-cdk/aws-ecs-patterns/package.json deleted file mode 100644 index 6769fe7b786cf..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/package.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "name": "@aws-cdk/aws-ecs-patterns", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ECS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ecs.patterns", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ecs-patterns" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ECS.Patterns", - "packageId": "Amazon.CDK.AWS.ECS.Patterns", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ecs-patterns", - "module": "aws_cdk.aws_ecs_patterns", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ecs-patterns" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ecs", - "ecs-patterns" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awslint": { - "exclude": [ - "docs-public-apis:@aws-cdk/aws-ecs-patterns.NetworkLoadBalancedFargateService.assignPublicIp", - "docs-public-apis:@aws-cdk/aws-ecs-patterns.ApplicationLoadBalancedTaskImageOptions", - "docs-public-apis:@aws-cdk/aws-ecs-patterns.NetworkLoadBalancedTaskImageOptions", - "docs-public-apis:@aws-cdk/aws-ecs-patterns.ScheduledTaskImageProps", - "docs-public-apis:@aws-cdk/aws-ecs-patterns.FargateServiceBase", - "docs-public-apis:@aws-cdk/aws-ecs-patterns.FargateServiceBaseProps" - ] - }, - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ecs-patterns/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ecs-patterns/rosetta/default.ts-fixture deleted file mode 100644 index e998fef0a9210..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/rosetta/default.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as ecsPatterns from '@aws-cdk/aws-ecs-patterns'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cxapi from '@aws-cdk/cx-api'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.ts b/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.ts deleted file mode 100644 index 93d42c9b76c73..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/integ.multiple-application-load-balanced-ecs-service.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { InstanceType, Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { ApplicationMultipleTargetGroupsEc2Service } from '../../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-integ-multiple-alb'); -const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); -const cluster = new Cluster(stack, 'Cluster', { vpc }); -cluster.addCapacity('DefaultAutoScalingGroup', { instanceType: new InstanceType('t2.micro') }); - -// One load balancer with one listener and two target groups. -new ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', { - cluster, - memoryLimitMiB: 256, - taskImageOptions: { - image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - enableExecuteCommand: true, - targetGroups: [ - { - containerPort: 80, - }, - { - containerPort: 90, - pathPattern: 'a/b/c', - priority: 10, - }, - ], -}); - -new integ.IntegTest(app, 'applicationMultipleTargetGroupsEc2ServiceTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.ts deleted file mode 100644 index 6ee3081285b9f..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { ApplicationProtocol } from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as route53 from '@aws-cdk/aws-route53'; -import { App, Duration, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; - -import { ApplicationLoadBalancedFargateService } from '../../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-integ-alb-fg-idletimeout'); -const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); -const cluster = new Cluster(stack, 'Cluster', { vpc }); - -// Loadbalancer with idleTimeout set to 120 seconds -new ApplicationLoadBalancedFargateService(stack, 'myService', { - cluster, - memoryLimitMiB: 512, - taskImageOptions: { - image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - protocol: ApplicationProtocol.HTTPS, - enableECSManagedTags: true, - enableExecuteCommand: true, - domainName: 'test.example.com', - domainZone: route53.HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'fakeId', - zoneName: 'example.com.', - }), - redirectHTTP: true, - idleTimeout: Duration.seconds(120), -}); - -new integ.IntegTest(app, 'idleTimeoutTest', { - testCases: [stack], -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.ts deleted file mode 100644 index 97c12fd9aa13d..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { ApplicationProtocol } from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as route53 from '@aws-cdk/aws-route53'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { ApplicationLoadBalancedFargateService } from '../../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-integ-alb-fg-https'); -const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); -const cluster = new Cluster(stack, 'Cluster', { vpc }); - -// Loadbalancer with HTTPS -new ApplicationLoadBalancedFargateService(stack, 'myService', { - cluster, - memoryLimitMiB: 512, - taskImageOptions: { - image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - protocol: ApplicationProtocol.HTTPS, - enableECSManagedTags: true, - enableExecuteCommand: true, - domainName: 'test.example.com', - domainZone: route53.HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'fakeId', - zoneName: 'example.com.', - }), - redirectHTTP: true, -}); - -new integ.IntegTest(app, 'albFargateServiceTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.ts deleted file mode 100644 index f7acf839fc584..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as integ from '@aws-cdk/integ-tests'; -import { ApplicationLoadBalancedFargateService } from '../../lib'; - -const app = new App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } }); -const stack = new Stack(app, 'aws-ecs-integ-circuit-breaker'); -const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); -const cluster = new Cluster(stack, 'Cluster', { vpc }); - -new ApplicationLoadBalancedFargateService(stack, 'myService', { - cluster, - memoryLimitMiB: 512, - taskImageOptions: { - image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - circuitBreaker: { rollback: true }, -}); - -new integ.IntegTest(app, 'circuitBreakerAlbFargateTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.ts deleted file mode 100644 index 34455347c4e31..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { ApplicationLoadBalancedFargateService } from '../../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-integ-circuit-breaker-no-dc'); -const vpc = new Vpc(stack, 'Vpc', { maxAzs: 2 }); -const cluster = new Cluster(stack, 'Cluster', { vpc }); - -new ApplicationLoadBalancedFargateService(stack, 'myService', { - cluster, - memoryLimitMiB: 512, - taskImageOptions: { - image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - }, - circuitBreaker: { rollback: true }, -}); - -new integ.IntegTest(app, 'circuitBreakerNoDeploymentControllerFargateTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.ts deleted file mode 100644 index b8c733f016aed..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.circuit-breaker-queue-processing-fargate-service.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as integ from '@aws-cdk/integ-tests'; -import { QueueProcessingFargateService } from '../../lib'; - -const app = new App({ postCliContext: { [cxapi.ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: false } }); -const stack = new Stack(app, 'aws-ecs-patterns-queue'); -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 2, -}); - -new QueueProcessingFargateService(stack, 'QueueProcessingService', { - vpc, - memoryLimitMiB: 512, - circuitBreaker: { rollback: true }, - image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), -}); - -new integ.IntegTest(app, 'circuitBreakerQueueProcessingFargateTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.ts deleted file mode 100644 index e8bf0f6118122..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecsPatterns from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ-fargate-execrole'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); - -new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'L3', { - cluster, - memoryLimitMiB: 1024, - cpu: 512, - taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - executionRole: new iam.Role(stack, 'ExecutionRole', { - assumedBy: new iam.CompositePrincipal( - new iam.ServicePrincipal('ecs.amazonaws.com'), - new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), - ), - }), - }, -}); - -new integ.IntegTest(app, 'executionRoleAlbFargateTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.ts deleted file mode 100644 index 2f3ad8d026ad3..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-public.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { App, Stack, Duration } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { QueueProcessingFargateService } from '../../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-patterns-queue-public'); -const vpc = new ec2.Vpc(stack, 'VPC'); - -new QueueProcessingFargateService(stack, 'PublicQueueService', { - vpc, - memoryLimitMiB: 512, - image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), - assignPublicIp: true, - healthCheck: { - command: ['CMD-SHELL', 'curl -f http://localhost/ || exit 1'], - interval: Duration.seconds(6), - retries: 10, - }, -}); - -new integ.IntegTest(app, 'publicQueueProcessingFargateServiceTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.ts deleted file mode 100644 index e44a3680426b4..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service.ts +++ /dev/null @@ -1,25 +0,0 @@ -import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { QueueProcessingFargateService } from '../../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-ecs-patterns-queue'); -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 2, -}); - -new QueueProcessingFargateService(stack, 'QueueProcessingService', { - vpc, - memoryLimitMiB: 512, - image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), - minScalingCapacity: 0, -}); - -new integ.IntegTest(app, 'queueProcessingFargateServiceTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.ts b/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.ts deleted file mode 100644 index 91161784e0424..0000000000000 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.ts +++ /dev/null @@ -1,36 +0,0 @@ -import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; - -import { ScheduledFargateTask } from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-runtime-integ'); - - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 1 }); -const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); - -// Create the scheduled task -new ScheduledFargateTask(stack, 'ScheduledFargateTask', { - cluster, - scheduledFargateTaskImageOptions: { - image: new ecs.AssetImage(path.join(__dirname, '..', 'demo-image')), - memoryLimitMiB: 512, - cpu: 256, - environment: { TRIGGER: 'CloudWatch Events' }, - runtimePlatform: { - cpuArchitecture: ecs.CpuArchitecture.X86_64, - operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, - }, - }, - desiredTaskCount: 2, - schedule: events.Schedule.rate(cdk.Duration.minutes(2)), -}); - -new IntegTest(app, 'Integ', { testCases: [stack] }); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/.eslintrc.js b/packages/@aws-cdk/aws-ecs/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ecs/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ecs/.gitignore b/packages/@aws-cdk/aws-ecs/.gitignore deleted file mode 100644 index 5caf6e2594bda..0000000000000 --- a/packages/@aws-cdk/aws-ecs/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -!lib/images/adopt-repository/* -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ecs/.npmignore b/packages/@aws-cdk/aws-ecs/.npmignore deleted file mode 100644 index 777a6edf81d01..0000000000000 --- a/packages/@aws-cdk/aws-ecs/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii -!lib/adopt-repository/* -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -jest.config.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ecs/LICENSE b/packages/@aws-cdk/aws-ecs/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ecs/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ecs/NOTICE b/packages/@aws-cdk/aws-ecs/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ecs/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ecs/README.md b/packages/@aws-cdk/aws-ecs/README.md deleted file mode 100644 index 6024d15180308..0000000000000 --- a/packages/@aws-cdk/aws-ecs/README.md +++ /dev/null @@ -1,1377 +0,0 @@ -# Amazon ECS Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This package contains constructs for working with **Amazon Elastic Container -Service** (Amazon ECS). - -Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service. - -For further information on Amazon ECS, -see the [Amazon ECS documentation](https://docs.aws.amazon.com/ecs) - -The following example creates an Amazon ECS cluster, adds capacity to it, and -runs a service on it: - -```ts -declare const vpc: ec2.Vpc; - -// Create an ECS cluster -const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); - -// Add capacity to it -cluster.addCapacity('DefaultAutoScalingGroupCapacity', { - instanceType: new ec2.InstanceType("t2.xlarge"), - desiredCapacity: 3, -}); - -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); - -taskDefinition.addContainer('DefaultContainer', { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 512, -}); - -// Instantiate an Amazon ECS Service -const ecsService = new ecs.Ec2Service(this, 'Service', { - cluster, - taskDefinition, -}); -``` - -For a set of constructs defining common ECS architectural patterns, see the `@aws-cdk/aws-ecs-patterns` package. - -## Launch Types: AWS Fargate vs Amazon EC2 vs AWS ECS Anywhere - -There are three sets of constructs in this library: - -- Use the `Ec2TaskDefinition` and `Ec2Service` constructs to run tasks on Amazon EC2 instances running in your account. -- Use the `FargateTaskDefinition` and `FargateService` constructs to run tasks on - instances that are managed for you by AWS. -- Use the `ExternalTaskDefinition` and `ExternalService` constructs to run AWS ECS Anywhere tasks on self-managed infrastructure. - -Here are the main differences: - -- **Amazon EC2**: instances are under your control. Complete control of task to host - allocation. Required to specify at least a memory reservation or limit for - every container. Can use Host, Bridge and AwsVpc networking modes. Can attach - Classic Load Balancer. Can share volumes between container and host. -- **AWS Fargate**: tasks run on AWS-managed instances, AWS manages task to host - allocation for you. Requires specification of memory and cpu sizes at the - taskdefinition level. Only supports AwsVpc networking modes and - Application/Network Load Balancers. Only the AWS log driver is supported. - Many host features are not supported such as adding kernel capabilities - and mounting host devices/volumes inside the container. -- **AWS ECS Anywhere**: tasks are run and managed by AWS ECS Anywhere on infrastructure - owned by the customer. Bridge, Host and None networking modes are supported. Does not - support autoscaling, load balancing, cloudmap or attachment of volumes. - -For more information on Amazon EC2 vs AWS Fargate, networking and ECS Anywhere see the AWS Documentation: -[AWS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html), -[Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html), -[ECS Anywhere](https://aws.amazon.com/ecs/anywhere/) - -## Clusters - -A `Cluster` defines the infrastructure to run your -tasks on. You can run many tasks on a single cluster. - -The following code creates a cluster that can run AWS Fargate tasks: - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new ecs.Cluster(this, 'Cluster', { - vpc, -}); -``` - -The following code imports an existing cluster using the ARN which can be used to -import an Amazon ECS service either EC2 or Fargate. - -```ts -const clusterArn = 'arn:aws:ecs:us-east-1:012345678910:cluster/clusterName'; - -const cluster = ecs.Cluster.fromClusterArn(this, 'Cluster', clusterArn); -``` - -To use tasks with Amazon EC2 launch-type, you have to add capacity to -the cluster in order for tasks to be scheduled on your instances. Typically, -you add an AutoScalingGroup with instances running the latest -Amazon ECS-optimized AMI to the cluster. There is a method to build and add such an -AutoScalingGroup automatically, or you can supply a customized AutoScalingGroup -that you construct yourself. It's possible to add multiple AutoScalingGroups -with various instance types. - -The following example creates an Amazon ECS cluster and adds capacity to it: - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new ecs.Cluster(this, 'Cluster', { - vpc, -}); - -// Either add default capacity -cluster.addCapacity('DefaultAutoScalingGroupCapacity', { - instanceType: new ec2.InstanceType("t2.xlarge"), - desiredCapacity: 3, -}); - -// Or add customized capacity. Be sure to start the Amazon ECS-optimized AMI. -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType: new ec2.InstanceType('t2.xlarge'), - machineImage: ecs.EcsOptimizedImage.amazonLinux(), - // Or use Amazon ECS-Optimized Amazon Linux 2 AMI - // machineImage: EcsOptimizedImage.amazonLinux2(), - desiredCapacity: 3, - // ... other options here ... -}); - -const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider', { - autoScalingGroup, -}); -cluster.addAsgCapacityProvider(capacityProvider); -``` - -If you omit the property `vpc`, the construct will create a new VPC with two AZs. - -By default, all machine images will auto-update to the latest version -on each deployment, causing a replacement of the instances in your AutoScalingGroup -if the AMI has been updated since the last deployment. - -If task draining is enabled, ECS will transparently reschedule tasks on to the new -instances before terminating your old instances. If you have disabled task draining, -the tasks will be terminated along with the instance. To prevent that, you -can pick a non-updating AMI by passing `cacheInContext: true`, but be sure -to periodically update to the latest AMI manually by using the [CDK CLI -context management commands](https://docs.aws.amazon.com/cdk/latest/guide/context.html): - -```ts -declare const vpc: ec2.Vpc; -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { - machineImage: ecs.EcsOptimizedImage.amazonLinux({ cachedInContext: true }), - vpc, - instanceType: new ec2.InstanceType('t2.micro'), -}); -``` - -To use `LaunchTemplate` with `AsgCapacityProvider`, make sure to specify the `userData` in the `LaunchTemplate`: - -```ts -declare const vpc: ec2.Vpc; -const launchTemplate = new ec2.LaunchTemplate(this, 'ASG-LaunchTemplate', { - instanceType: new ec2.InstanceType('t3.medium'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - userData: ec2.UserData.forLinux(), -}); - -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - mixedInstancesPolicy: { - instancesDistribution: { - onDemandPercentageAboveBaseCapacity: 50, - }, - launchTemplate: launchTemplate, - }, -}); - -const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); - -const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider', { - autoScalingGroup, - machineImageType: ecs.MachineImageType.AMAZON_LINUX_2, -}); - -cluster.addAsgCapacityProvider(capacityProvider); -``` - - -### Bottlerocket - -[Bottlerocket](https://aws.amazon.com/bottlerocket/) is a Linux-based open source operating system that is -purpose-built by AWS for running containers. You can launch Amazon ECS container instances with the Bottlerocket AMI. - -The following example will create a capacity with self-managed Amazon EC2 capacity of 2 `c5.large` Linux instances running with `Bottlerocket` AMI. - -The following example adds Bottlerocket capacity to the cluster: - -```ts -declare const cluster: ecs.Cluster; - -cluster.addCapacity('bottlerocket-asg', { - minCapacity: 2, - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), -}); -``` - -### ARM64 (Graviton) Instances - -To launch instances with ARM64 hardware, you can use the Amazon ECS-optimized -Amazon Linux 2 (arm64) AMI. Based on Amazon Linux 2, this AMI is recommended -for use when launching your EC2 instances that are powered by Arm-based AWS -Graviton Processors. - -```ts -declare const cluster: ecs.Cluster; - -cluster.addCapacity('graviton-cluster', { - minCapacity: 2, - instanceType: new ec2.InstanceType('c6g.large'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM), -}); -``` - -Bottlerocket is also supported: - -```ts -declare const cluster: ecs.Cluster; - -cluster.addCapacity('graviton-cluster', { - minCapacity: 2, - instanceType: new ec2.InstanceType('c6g.large'), - machineImageType: ecs.MachineImageType.BOTTLEROCKET, -}); -``` - -### Spot Instances - -To add spot instances into the cluster, you must specify the `spotPrice` in the `ecs.AddCapacityOptions` and optionally enable the `spotInstanceDraining` property. - -```ts -declare const cluster: ecs.Cluster; - -// Add an AutoScalingGroup with spot instances to the existing cluster -cluster.addCapacity('AsgSpot', { - maxCapacity: 2, - minCapacity: 2, - desiredCapacity: 2, - instanceType: new ec2.InstanceType('c5.xlarge'), - spotPrice: '0.0735', - // Enable the Automated Spot Draining support for Amazon ECS - spotInstanceDraining: true, -}); -``` - -### SNS Topic Encryption - -When the `ecs.AddCapacityOptions` that you provide has a non-zero `taskDrainTime` (the default) then an SNS topic and Lambda are created to ensure that the -cluster's instances have been properly drained of tasks before terminating. The SNS Topic is sent the instance-terminating lifecycle event from the AutoScalingGroup, -and the Lambda acts on that event. If you wish to engage [server-side encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for this SNS Topic -then you may do so by providing a KMS key for the `topicEncryptionKey` property of `ecs.AddCapacityOptions`. - -```ts -// Given -declare const cluster: ecs.Cluster; -declare const key: kms.Key; -// Then, use that key to encrypt the lifecycle-event SNS Topic. -cluster.addCapacity('ASGEncryptedSNS', { - instanceType: new ec2.InstanceType("t2.xlarge"), - desiredCapacity: 3, - topicEncryptionKey: key, -}); -``` - -## Task definitions - -A task definition describes what a single copy of a **task** should look like. -A task definition has one or more containers; typically, it has one -main container (the *default container* is the first one that's added -to the task definition, and it is marked *essential*) and optionally -some supporting containers which are used to support the main container, -doings things like upload logs or metrics to monitoring services. - -To run a task or service with Amazon EC2 launch type, use the `Ec2TaskDefinition`. For AWS Fargate tasks/services, use the -`FargateTaskDefinition`. For AWS ECS Anywhere use the `ExternalTaskDefinition`. These classes -provide simplified APIs that only contain properties relevant for each specific launch type. - -For a `FargateTaskDefinition`, specify the task size (`memoryLimitMiB` and `cpu`): - -```ts -const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { - memoryLimitMiB: 512, - cpu: 256, -}); -``` - -On Fargate Platform Version 1.4.0 or later, you may specify up to 200GiB of -[ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): - -```ts -const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { - memoryLimitMiB: 512, - cpu: 256, - ephemeralStorageGiB: 100, -}); -``` - -To add containers to a task definition, call `addContainer()`: - -```ts -const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { - memoryLimitMiB: 512, - cpu: 256, -}); -const container = fargateTaskDefinition.addContainer("WebContainer", { - // Use an image from DockerHub - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - // ... other options here ... -}); -``` - -For an `Ec2TaskDefinition`: - -```ts -const ec2TaskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef', { - networkMode: ecs.NetworkMode.BRIDGE, -}); - -const container = ec2TaskDefinition.addContainer("WebContainer", { - // Use an image from DockerHub - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 1024, - // ... other options here ... -}); -``` - -For an `ExternalTaskDefinition`: - -```ts -const externalTaskDefinition = new ecs.ExternalTaskDefinition(this, 'TaskDef'); - -const container = externalTaskDefinition.addContainer("WebContainer", { - // Use an image from DockerHub - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 1024, - // ... other options here ... -}); -``` - -You can specify container properties when you add them to the task definition, or with various methods, e.g.: - -To add a port mapping when adding a container to the task definition, specify the `portMappings` option: - -```ts -declare const taskDefinition: ecs.TaskDefinition; - -taskDefinition.addContainer("WebContainer", { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 1024, - portMappings: [{ containerPort: 3000 }], -}); -``` - -To add port mappings directly to a container definition, call `addPortMappings()`: - -```ts -declare const container: ecs.ContainerDefinition; - -container.addPortMappings({ - containerPort: 3000, -}); -``` - -To add data volumes to a task definition, call `addVolume()`: - -```ts -const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { - memoryLimitMiB: 512, - cpu: 256, -}); -const volume = { - // Use an Elastic FileSystem - name: "mydatavolume", - efsVolumeConfiguration: { - fileSystemId: "EFS", - // ... other options here ... - }, -}; - -const container = fargateTaskDefinition.addVolume(volume); -``` - -> Note: ECS Anywhere doesn't support volume attachments in the task definition. - -To use a TaskDefinition that can be used with either Amazon EC2 or -AWS Fargate launch types, use the `TaskDefinition` construct. - -When creating a task definition you have to specify what kind of -tasks you intend to run: Amazon EC2, AWS Fargate, or both. -The following example uses both: - -```ts -const taskDefinition = new ecs.TaskDefinition(this, 'TaskDef', { - memoryMiB: '512', - cpu: '256', - networkMode: ecs.NetworkMode.AWS_VPC, - compatibility: ecs.Compatibility.EC2_AND_FARGATE, -}); -``` - -To grant a principal permission to run your `TaskDefinition`, you can use the `TaskDefinition.grantRun()` method: - -```ts -declare const role: iam.IGrantable; -const taskDef = new ecs.TaskDefinition(this, 'TaskDef', { - cpu: '512', - memoryMiB: '512', - compatibility: ecs.Compatibility.EC2_AND_FARGATE, -}); - -// Gives role required permissions to run taskDef -taskDef.grantRun(role); -``` - -### Images - -Images supply the software that runs inside the container. Images can be -obtained from either DockerHub or from ECR repositories, built directly from a local Dockerfile, or use an existing tarball. - -- `ecs.ContainerImage.fromRegistry(imageName)`: use a public image. -- `ecs.ContainerImage.fromRegistry(imageName, { credentials: mySecret })`: use a private image that requires credentials. -- `ecs.ContainerImage.fromEcrRepository(repo, tagOrDigest)`: use the given ECR repository as the image - to start. If no tag or digest is provided, "latest" is assumed. -- `ecs.ContainerImage.fromAsset('./image')`: build and upload an - image directly from a `Dockerfile` in your source directory. -- `ecs.ContainerImage.fromDockerImageAsset(asset)`: uses an existing - `@aws-cdk/aws-ecr-assets.DockerImageAsset` as a container image. -- `ecs.ContainerImage.fromTarball(file)`: use an existing tarball. -- `new ecs.TagParameterContainerImage(repository)`: use the given ECR repository as the image - but a CloudFormation parameter as the tag. - -### Environment variables - -To pass environment variables to the container, you can use the `environment`, `environmentFiles`, and `secrets` props. - -```ts -declare const secret: secretsmanager.Secret; -declare const dbSecret: secretsmanager.Secret; -declare const parameter: ssm.StringParameter; -declare const taskDefinition: ecs.TaskDefinition; -declare const s3Bucket: s3.Bucket; - -const newContainer = taskDefinition.addContainer('container', { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 1024, - environment: { // clear text, not for sensitive data - STAGE: 'prod', - }, - environmentFiles: [ // list of environment files hosted either on local disk or S3 - ecs.EnvironmentFile.fromAsset('./demo-env-file.env'), - ecs.EnvironmentFile.fromBucket(s3Bucket, 'assets/demo-env-file.env'), - ], - secrets: { // Retrieved from AWS Secrets Manager or AWS Systems Manager Parameter Store at container start-up. - SECRET: ecs.Secret.fromSecretsManager(secret), - DB_PASSWORD: ecs.Secret.fromSecretsManager(dbSecret, 'password'), // Reference a specific JSON field, (requires platform version 1.4.0 or later for Fargate tasks) - API_KEY: ecs.Secret.fromSecretsManagerVersion(secret, { versionId: '12345' }, 'apiKey'), // Reference a specific version of the secret by its version id or version stage (requires platform version 1.4.0 or later for Fargate tasks) - PARAMETER: ecs.Secret.fromSsmParameter(parameter), - }, -}); -newContainer.addEnvironment('QUEUE_NAME', 'MyQueue'); -newContainer.addSecret('API_KEY', ecs.Secret.fromSecretsManager(secret)); -newContainer.addSecret('DB_PASSWORD', ecs.Secret.fromSecretsManager(secret, 'password')); -``` - -The task execution role is automatically granted read permissions on the secrets/parameters. Support for environment -files is restricted to the EC2 launch type for files hosted on S3. Further details provided in the AWS documentation -about [specifying environment variables](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html). - -### Linux parameters - -To apply additional linux-specific options related to init process and memory management to the container, use the `linuxParameters` property: - -```ts -declare const taskDefinition: ecs.TaskDefinition; - -taskDefinition.addContainer('container', { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 1024, - linuxParameters: new ecs.LinuxParameters(this, 'LinuxParameters', { - initProcessEnabled: true, - sharedMemorySize: 1024, - maxSwap: Size.mebibytes(5000), - swappiness: 90, - }), -}); -``` - -### System controls - -To set system controls (kernel parameters) on the container, use the `systemControls` prop: - -```ts -declare const taskDefinition: ecs.TaskDefinition; - -taskDefinition.addContainer('container', { - image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), - memoryLimitMiB: 1024, - systemControls: [ - { - namespace: 'net.ipv6.conf.all.default.disable_ipv6', - value: '1', - }, - ], -}); -``` - -### Using Windows containers on Fargate - -AWS Fargate supports Amazon ECS Windows containers. For more details, please see this [blog post](https://aws.amazon.com/tw/blogs/containers/running-windows-containers-with-amazon-ecs-on-aws-fargate/) - -```ts -// Create a Task Definition for the Windows container to start -const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { - runtimePlatform: { - operatingSystemFamily: ecs.OperatingSystemFamily.WINDOWS_SERVER_2019_CORE, - cpuArchitecture: ecs.CpuArchitecture.X86_64, - }, - cpu: 1024, - memoryLimitMiB: 2048, -}); - -taskDefinition.addContainer('windowsservercore', { - logging: ecs.LogDriver.awsLogs({ streamPrefix: 'win-iis-on-fargate' }), - portMappings: [{ containerPort: 80 }], - image: ecs.ContainerImage.fromRegistry('mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019'), -}); -``` - -### Using Graviton2 with Fargate - -AWS Graviton2 supports AWS Fargate. For more details, please see this [blog post](https://aws.amazon.com/blogs/aws/announcing-aws-graviton2-support-for-aws-fargate-get-up-to-40-better-price-performance-for-your-serverless-containers/) - -```ts -// Create a Task Definition for running container on Graviton Runtime. -const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { - runtimePlatform: { - operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, - cpuArchitecture: ecs.CpuArchitecture.ARM64, - }, - cpu: 1024, - memoryLimitMiB: 2048, -}); - -taskDefinition.addContainer('webarm64', { - logging: ecs.LogDriver.awsLogs({ streamPrefix: 'graviton2-on-fargate' }), - portMappings: [{ containerPort: 80 }], - image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:latest-arm64v8'), -}); -``` - -## Service - -A `Service` instantiates a `TaskDefinition` on a `Cluster` a given number of -times, optionally associating them with a load balancer. -If a task fails, -Amazon ECS automatically restarts the task. - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; - -const service = new ecs.FargateService(this, 'Service', { - cluster, - taskDefinition, - desiredCount: 5, -}); -``` - -ECS Anywhere service definition looks like: - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; - -const service = new ecs.ExternalService(this, 'Service', { - cluster, - taskDefinition, - desiredCount: 5, -}); -``` - -`Services` by default will create a security group if not provided. -If you'd like to specify which security groups to use you can override the `securityGroups` property. - -### Deployment circuit breaker and rollback - -Amazon ECS [deployment circuit breaker](https://aws.amazon.com/tw/blogs/containers/announcing-amazon-ecs-deployment-circuit-breaker/) -automatically rolls back unhealthy service deployments without the need for manual intervention. Use `circuitBreaker` to enable -deployment circuit breaker and optionally enable `rollback` for automatic rollback. See [Using the deployment circuit breaker](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html) -for more details. - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; -const service = new ecs.FargateService(this, 'Service', { - cluster, - taskDefinition, - circuitBreaker: { rollback: true }, -}); -``` - -> Note: ECS Anywhere doesn't support deployment circuit breakers and rollback. - -### Include an application/network load balancer - -`Services` are load balancing targets and can be added to a target group, which will be attached to an application/network load balancers: - -```ts -declare const vpc: ec2.Vpc; -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; -const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition }); - -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true }); -const listener = lb.addListener('Listener', { port: 80 }); -const targetGroup1 = listener.addTargets('ECS1', { - port: 80, - targets: [service], -}); -const targetGroup2 = listener.addTargets('ECS2', { - port: 80, - targets: [service.loadBalancerTarget({ - containerName: 'MyContainer', - containerPort: 8080 - })], -}); -``` - -> Note: ECS Anywhere doesn't support application/network load balancers. - -Note that in the example above, the default `service` only allows you to register the first essential container or the first mapped port on the container as a target and add it to a new target group. To have more control over which container and port to register as targets, you can use `service.loadBalancerTarget()` to return a load balancing target for a specific container and port. - -Alternatively, you can also create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly. - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; -declare const vpc: ec2.Vpc; -const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition }); - -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true }); -const listener = lb.addListener('Listener', { port: 80 }); -service.registerLoadBalancerTargets( - { - containerName: 'web', - containerPort: 80, - newTargetGroupId: 'ECS', - listener: ecs.ListenerConfig.applicationListener(listener, { - protocol: elbv2.ApplicationProtocol.HTTPS - }), - }, -); -``` - -### Using a Load Balancer from a different Stack - -If you want to put your Load Balancer and the Service it is load balancing to in -different stacks, you may not be able to use the convenience methods -`loadBalancer.addListener()` and `listener.addTargets()`. - -The reason is that these methods will create resources in the same Stack as the -object they're called on, which may lead to cyclic references between stacks. -Instead, you will have to create an `ApplicationListener` in the service stack, -or an empty `TargetGroup` in the load balancer stack that you attach your -service to. - -See the [ecs/cross-stack-load-balancer example](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/ecs/cross-stack-load-balancer/) -for the alternatives. - -### Include a classic load balancer - -`Services` can also be directly attached to a classic load balancer as targets: - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; -declare const vpc: ec2.Vpc; -const service = new ecs.Ec2Service(this, 'Service', { cluster, taskDefinition }); - -const lb = new elb.LoadBalancer(this, 'LB', { vpc }); -lb.addListener({ externalPort: 80 }); -lb.addTarget(service); -``` - -Similarly, if you want to have more control over load balancer targeting: - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; -declare const vpc: ec2.Vpc; -const service = new ecs.Ec2Service(this, 'Service', { cluster, taskDefinition }); - -const lb = new elb.LoadBalancer(this, 'LB', { vpc }); -lb.addListener({ externalPort: 80 }); -lb.addTarget(service.loadBalancerTarget({ - containerName: 'MyContainer', - containerPort: 80, -})); -``` - -There are two higher-level constructs available which include a load balancer for you that can be found in the aws-ecs-patterns module: - -- `LoadBalancedFargateService` -- `LoadBalancedEc2Service` - -### Import existing services - -`Ec2Service` and `FargateService` provide methods to import existing EC2/Fargate services. -The ARN of the existing service has to be specified to import the service. - -Since AWS has changed the [ARN format for ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids), -feature flag `@aws-cdk/aws-ecs:arnFormatIncludesClusterName` must be enabled to use the new ARN format. -The feature flag changes behavior for the entire CDK project. Therefore it is not possible to mix the old and the new format in one CDK project. - -```tss -declare const cluster: ecs.Cluster; - -// Import service from EC2 service attributes -const service = ecs.Ec2Service.fromEc2ServiceAttributes(stack, 'EcsService', { - serviceArn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service', - cluster, -}); - -// Import service from EC2 service ARN -const service = ecs.Ec2Service.fromEc2ServiceArn(stack, 'EcsService', 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service'); - -// Import service from Fargate service attributes -const service = ecs.FargateService.fromFargateServiceAttributes(stack, 'EcsService', { - serviceArn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service', - cluster, -}); - -// Import service from Fargate service ARN -const service = ecs.FargateService.fromFargateServiceArn(stack, 'EcsService', 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service'); -``` - -## Task Auto-Scaling - -You can configure the task count of a service to match demand. Task auto-scaling is -configured by calling `autoScaleTaskCount()`: - -```ts -declare const target: elbv2.ApplicationTargetGroup; -declare const service: ecs.BaseService; -const scaling = service.autoScaleTaskCount({ maxCapacity: 10 }); -scaling.scaleOnCpuUtilization('CpuScaling', { - targetUtilizationPercent: 50, -}); - -scaling.scaleOnRequestCount('RequestScaling', { - requestsPerTarget: 10000, - targetGroup: target, -}); -``` - -Task auto-scaling is powered by *Application Auto-Scaling*. -See that section for details. - -## Integration with CloudWatch Events - -To start an Amazon ECS task on an Amazon EC2-backed Cluster, instantiate an -`@aws-cdk/aws-events-targets.EcsTask` instead of an `Ec2Service`: - -```ts -declare const cluster: ecs.Cluster; -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, '..', 'eventhandler-image')), - memoryLimitMiB: 256, - logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo', mode: ecs.AwsLogDriverMode.NON_BLOCKING }), -}); - -// An Rule that describes the event trigger (in this case a scheduled run) -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.expression('rate(1 min)'), -}); - -// Pass an environment variable to the container 'TheContainer' in the task -rule.addTarget(new targets.EcsTask({ - cluster, - taskDefinition, - taskCount: 1, - containerOverrides: [{ - containerName: 'TheContainer', - environment: [{ - name: 'I_WAS_TRIGGERED', - value: 'From CloudWatch Events' - }], - }], -})); -``` - -## Log Drivers - -Currently Supported Log Drivers: - -- awslogs -- fluentd -- gelf -- journald -- json-file -- splunk -- syslog -- awsfirelens -- Generic - -### awslogs Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.awsLogs({ streamPrefix: 'EventDemo' }), -}); -``` - -### fluentd Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.fluentd(), -}); -``` - -### gelf Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.gelf({ address: 'my-gelf-address' }), -}); -``` - -### journald Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.journald(), -}); -``` - -### json-file Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.jsonFile(), -}); -``` - -### splunk Log Driver - -```ts -declare const secret: ecs.Secret; - -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.splunk({ - secretToken: secret, - url: 'my-splunk-url', - }), -}); -``` - -### syslog Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.syslog(), -}); -``` - -### firelens Log Driver - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.firelens({ - options: { - Name: 'firehose', - region: 'us-west-2', - delivery_stream: 'my-stream', - }, - }), -}); -``` - -To pass secrets to the log configuration, use the `secretOptions` property of the log configuration. The task execution role is automatically granted read permissions on the secrets/parameters. - -```ts -declare const secret: secretsmanager.Secret; -declare const parameter: ssm.StringParameter; - -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: ecs.LogDrivers.firelens({ - options: { - // ... log driver options here ... - }, - secretOptions: { // Retrieved from AWS Secrets Manager or AWS Systems Manager Parameter Store - apikey: ecs.Secret.fromSecretsManager(secret), - host: ecs.Secret.fromSsmParameter(parameter), - }, - }), -}); -``` - -### Generic Log Driver - -A generic log driver object exists to provide a lower level abstraction of the log driver configuration. - -```ts -// Create a Task Definition for the container to start -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - memoryLimitMiB: 256, - logging: new ecs.GenericLogDriver({ - logDriver: 'fluentd', - options: { - tag: 'example-tag', - }, - }), -}); -``` - -## CloudMap Service Discovery - -To register your ECS service with a CloudMap Service Registry, you may add the -`cloudMapOptions` property to your service: - -```ts -declare const taskDefinition: ecs.TaskDefinition; -declare const cluster: ecs.Cluster; - -const service = new ecs.Ec2Service(this, 'Service', { - cluster, - taskDefinition, - cloudMapOptions: { - // Create A records - useful for AWSVPC network mode. - dnsRecordType: cloudmap.DnsRecordType.A, - }, -}); -``` - -With `bridge` or `host` network modes, only `SRV` DNS record types are supported. -By default, `SRV` DNS record types will target the default container and default -port. However, you may target a different container and port on the same ECS task: - -```ts -declare const taskDefinition: ecs.TaskDefinition; -declare const cluster: ecs.Cluster; - -// Add a container to the task definition -const specificContainer = taskDefinition.addContainer('Container', { - image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), - memoryLimitMiB: 2048, -}); - -// Add a port mapping -specificContainer.addPortMappings({ - containerPort: 7600, - protocol: ecs.Protocol.TCP, -}); - -new ecs.Ec2Service(this, 'Service', { - cluster, - taskDefinition, - cloudMapOptions: { - // Create SRV records - useful for bridge networking - dnsRecordType: cloudmap.DnsRecordType.SRV, - // Targets port TCP port 7600 `specificContainer` - container: specificContainer, - containerPort: 7600, - }, -}); -``` - -### Associate With a Specific CloudMap Service - -You may associate an ECS service with a specific CloudMap service. To do -this, use the service's `associateCloudMapService` method: - -```ts -declare const cloudMapService: cloudmap.Service; -declare const ecsService: ecs.FargateService; - -ecsService.associateCloudMapService({ - service: cloudMapService, -}); -``` - -## Capacity Providers - -There are two major families of Capacity Providers: [AWS -Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-capacity-providers.html) -(including Fargate Spot) and EC2 [Auto Scaling -Group](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html) -Capacity Providers. Both are supported. - -### Fargate Capacity Providers - -To enable Fargate capacity providers, you can either set -`enableFargateCapacityProviders` to `true` when creating your cluster, or by -invoking the `enableFargateCapacityProviders()` method after creating your -cluster. This will add both `FARGATE` and `FARGATE_SPOT` as available capacity -providers on your cluster. - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new ecs.Cluster(this, 'FargateCPCluster', { - vpc, - enableFargateCapacityProviders: true, -}); - -const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef'); - -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), -}); - -new ecs.FargateService(this, 'FargateService', { - cluster, - taskDefinition, - capacityProviderStrategies: [ - { - capacityProvider: 'FARGATE_SPOT', - weight: 2, - }, - { - capacityProvider: 'FARGATE', - weight: 1, - }, - ], -}); -``` - -### Auto Scaling Group Capacity Providers - -To add an Auto Scaling Group Capacity Provider, first create an EC2 Auto Scaling -Group. Then, create an `AsgCapacityProvider` and pass the Auto Scaling Group to -it in the constructor. Then add the Capacity Provider to the cluster. Finally, -you can refer to the Provider by its name in your service's or task's Capacity -Provider strategy. - -By default, Auto Scaling Group Capacity Providers will manage the scale-in and -scale-out behavior of the auto scaling group based on the load your tasks put on -the cluster, this is called [Managed Scaling](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-managed-scaling). If you'd -rather manage scaling behavior yourself set `enableManagedScaling` to `false`. - -Additionally [Managed Termination Protection](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-auto-scaling.html#managed-termination-protection) is enabled by default to -prevent scale-in behavior from terminating instances that have non-daemon tasks -running on them. This is ideal for tasks that should be ran to completion. If your -tasks are safe to interrupt then this protection can be disabled by setting -`enableManagedTerminationProtection` to `false`. Managed Scaling must be enabled for -Managed Termination Protection to work. - -> Currently there is a known [CloudFormation issue](https://github.com/aws/containers-roadmap/issues/631) -> that prevents CloudFormation from automatically deleting Auto Scaling Groups that -> have Managed Termination Protection enabled. To work around this issue you could set -> `enableManagedTerminationProtection` to `false` on the Auto Scaling Group Capacity -> Provider. If you'd rather not disable Managed Termination Protection, you can [manually -> delete the Auto Scaling Group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-process-shutdown.html). -> For other workarounds, see [this GitHub issue](https://github.com/aws/aws-cdk/issues/18179). - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new ecs.Cluster(this, 'Cluster', { - vpc, -}); - -const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { - vpc, - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - minCapacity: 0, - maxCapacity: 100, -}); - -const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider', { - autoScalingGroup, -}); -cluster.addAsgCapacityProvider(capacityProvider); - -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); - -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryReservationMiB: 256, -}); - -new ecs.Ec2Service(this, 'EC2Service', { - cluster, - taskDefinition, - capacityProviderStrategies: [ - { - capacityProvider: capacityProvider.capacityProviderName, - weight: 1, - }, - ], -}); -``` - -### Cluster Default Provider Strategy - -A capacity provider strategy determines whether ECS tasks are launched on EC2 instances or Fargate/Fargate Spot. It can be specified at the cluster, service, or task level, and consists of one or more capacity providers. You can specify an optional base and weight value for finer control of how tasks are launched. The `base` specifies a minimum number of tasks on one capacity provider, and the `weight`s of each capacity provider determine how tasks are distributed after `base` is satisfied. - -You can associate a default capacity provider strategy with an Amazon ECS cluster. After you do this, a default capacity provider strategy is used when creating a service or running a standalone task in the cluster and whenever a custom capacity provider strategy or a launch type isn't specified. We recommend that you define a default capacity provider strategy for each cluster. - -For more information visit https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html - -When the service does not have a capacity provider strategy, the cluster's default capacity provider strategy will be used. Default Capacity Provider Strategy can be added by using the method `addDefaultCapacityProviderStrategy`. A capacity provider strategy cannot contain a mix of EC2 Autoscaling Group capacity providers and Fargate providers. - -```ts -declare const capacityProvider: ecs.CapacityProvider; - -const cluster = new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, -}); -cluster.addAsgCapacityProvider(capacityProvider); - -cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: 'FARGATE', base: 10, weight: 50 }, - { capacityProvider: 'FARGATE_SPOT', weight: 50 }, -]); -``` - -```ts -declare const capacityProvider: ecs.CapacityProvider; - -const cluster = new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, -}); -cluster.addAsgCapacityProvider(capacityProvider); - -cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: capacityProvider.capacityProviderName }, -]); -``` - -## Elastic Inference Accelerators - -Currently, this feature is only supported for services with EC2 launch types. - -To add elastic inference accelerators to your EC2 instance, first add -`inferenceAccelerators` field to the Ec2TaskDefinition and set the `deviceName` -and `deviceType` properties. - -```ts -const inferenceAccelerators = [{ - deviceName: 'device1', - deviceType: 'eia2.medium', -}]; - -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'Ec2TaskDef', { - inferenceAccelerators, -}); -``` - -To enable using the inference accelerators in the containers, add `inferenceAcceleratorResources` -field and set it to a list of device names used for the inference accelerators. Each value in the -list should match a `DeviceName` for an `InferenceAccelerator` specified in the task definition. - -```ts -declare const taskDefinition: ecs.TaskDefinition; -const inferenceAcceleratorResources = ['device1']; - -taskDefinition.addContainer('cont', { - image: ecs.ContainerImage.fromRegistry('test'), - memoryLimitMiB: 1024, - inferenceAcceleratorResources, -}); -``` - -## ECS Exec command - -Please note, ECS Exec leverages AWS Systems Manager (SSM). So as a prerequisite for the exec command -to work, you need to have the SSM plugin for the AWS CLI installed locally. For more information, see -[Install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html). - -To enable the ECS Exec feature for your containers, set the boolean flag `enableExecuteCommand` to `true` in -your `Ec2Service` or `FargateService`. - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; - -const service = new ecs.Ec2Service(this, 'Service', { - cluster, - taskDefinition, - enableExecuteCommand: true, -}); -``` - -### Enabling logging - -You can enable sending logs of your execute session commands to a CloudWatch log group or S3 bucket by configuring -the `executeCommandConfiguration` property for your cluster. The default configuration will send the -logs to the CloudWatch Logs using the `awslogs` log driver that is configured in your task definition. Please note, -when using your own `logConfiguration` the log group or S3 Bucket specified must already be created. - -To encrypt data using your own KMS Customer Key (CMK), you must create a CMK and provide the key in the `kmsKey` field -of the `executeCommandConfiguration`. To use this key for encrypting CloudWatch log data or S3 bucket, make sure to associate the key -to these resources on creation. - -```ts -declare const vpc: ec2.Vpc; -const kmsKey = new kms.Key(this, 'KmsKey'); - -// Pass the KMS key in the `encryptionKey` field to associate the key to the log group -const logGroup = new logs.LogGroup(this, 'LogGroup', { - encryptionKey: kmsKey, -}); - -// Pass the KMS key in the `encryptionKey` field to associate the key to the S3 bucket -const execBucket = new s3.Bucket(this, 'EcsExecBucket', { - encryptionKey: kmsKey, -}); - -const cluster = new ecs.Cluster(this, 'Cluster', { - vpc, - executeCommandConfiguration: { - kmsKey, - logConfiguration: { - cloudWatchLogGroup: logGroup, - cloudWatchEncryptionEnabled: true, - s3Bucket: execBucket, - s3EncryptionEnabled: true, - s3KeyPrefix: 'exec-command-output', - }, - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, -}); -``` - -## Amazon ECS Service Connect - -Service Connect is a managed AWS mesh network offering. It simplifies DNS queries and inter-service communication for -ECS Services by allowing customers to set up simple DNS aliases for their services, which are accessible to all -services that have enabled Service Connect. - -To enable Service Connect, you must have created a CloudMap namespace. The CDK can infer your cluster's default CloudMap namespace, -or you can specify a custom namespace. You must also have created a named port mapping on at least one container in your Task Definition. - -```ts -declare const cluster: ecs.Cluster; -declare const taskDefinition: ecs.TaskDefinition; -declare const container: ecs.ContainerDefinition; - -container.addPortMappings({ - name: 'api', - containerPort: 8080, -}); - -taskDefinition.addContainer(container); - -cluster.addDefaultCloudMapNamespace({ - name: 'local', -}); - -const service = new ecs.FargateService(this, 'Service', { - cluster, - taskDefinition, - serviceConnectConfiguration: { - services: [ - { - portMappingName: 'api', - dnsName: 'http-api', - port: 80, - }, - ], - }, -}); -``` - -Service Connect-enabled services may now reach this service at `http-api:80`. Traffic to this endpoint will -be routed to the container's port 8080. - -To opt a service into using service connect without advertising a port, simply call the 'enableServiceConnect' method on an initialized service. - -```ts -const service = new ecs.FargateService(this, 'Service', { - cluster, - taskDefinition -) -service.enableServiceConnect(); -``` - -Service Connect also allows custom logging, Service Discovery name, and configuration of the port where service connect traffic is received. - -```ts -const customService = new ecs.FargateService(this, 'CustomizedService', { - cluster, - taskDefinition, - serviceConnectConfiguration: { - logDriver: ecs.LogDrivers.awslogs({ - streamPrefix: 'sc-traffic', - }), - services: [ - { - portMappingName: 'api', - dnsName: 'customized-api', - port: 80, - ingressPortOverride: 20040, - discoveryName: 'custom', - }, - ], - }, -}); -``` - -## Enable pseudo-terminal (TTY) allocation - -You can allocate a pseudo-terminal (TTY) for a container passing `pseudoTerminal` option while adding the container -to the task definition. -This maps to Tty option in the ["Create a container section"](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate) -of the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/) and the --tty option to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/). - -```ts -const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('example-image'), - pseudoTerminal: true -}); -``` diff --git a/packages/@aws-cdk/aws-ecs/jest.config.js b/packages/@aws-cdk/aws-ecs/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-ecs/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ecs/lib/cluster.ts b/packages/@aws-cdk/aws-ecs/lib/cluster.ts deleted file mode 100644 index 24df141c77b42..0000000000000 --- a/packages/@aws-cdk/aws-ecs/lib/cluster.ts +++ /dev/null @@ -1,1288 +0,0 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import { Duration, IResource, Resource, Stack, Aspects, ArnFormat, IAspect } from '@aws-cdk/core'; -import { Construct, IConstruct } from 'constructs'; -import { BottleRocketImage, EcsOptimizedAmi } from './amis'; -import { InstanceDrainHook } from './drain-hook/instance-drain-hook'; -import { ECSMetrics } from './ecs-canned-metrics.generated'; -import { CfnCluster, CfnCapacityProvider, CfnClusterCapacityProviderAssociations } from './ecs.generated'; - -const CLUSTER_SYMBOL = Symbol.for('@aws-cdk/aws-ecs/lib/cluster.Cluster'); - -/** - * The properties used to define an ECS cluster. - */ -export interface ClusterProps { - /** - * The name for the cluster. - * - * @default CloudFormation-generated name - */ - readonly clusterName?: string; - - /** - * The VPC where your ECS instances will be running or your ENIs will be deployed - * - * @default - creates a new VPC with two AZs - */ - readonly vpc?: ec2.IVpc; - - /** - * The service discovery namespace created in this cluster - * - * @default - no service discovery namespace created, you can use `addDefaultCloudMapNamespace` to add a - * default service discovery namespace later. - */ - readonly defaultCloudMapNamespace?: CloudMapNamespaceOptions; - - /** - * The ec2 capacity to add to the cluster - * - * @default - no EC2 capacity will be added, you can use `addCapacity` to add capacity later. - */ - readonly capacity?: AddCapacityOptions; - - /** - * The capacity providers to add to the cluster - * - * @default - None. Currently only FARGATE and FARGATE_SPOT are supported. - * @deprecated Use `ClusterProps.enableFargateCapacityProviders` instead. - */ - readonly capacityProviders?: string[]; - - /** - * Whether to enable Fargate Capacity Providers - * - * @default false - */ - readonly enableFargateCapacityProviders?: boolean; - - /** - * If true CloudWatch Container Insights will be enabled for the cluster - * - * @default - Container Insights will be disabled for this cluster. - */ - readonly containerInsights?: boolean; - - /** - * The execute command configuration for the cluster - * - * @default - no configuration will be provided. - */ - readonly executeCommandConfiguration?: ExecuteCommandConfiguration; -} - -/** - * The machine image type - */ -export enum MachineImageType { - /** - * Amazon ECS-optimized Amazon Linux 2 AMI - */ - AMAZON_LINUX_2, - /** - * Bottlerocket AMI - */ - BOTTLEROCKET -} - -/** - * A regional grouping of one or more container instances on which you can run tasks and services. - */ -export class Cluster extends Resource implements ICluster { - - /** - * Return whether the given object is a Cluster - */ - public static isCluster(x: any) : x is Cluster { - return x !== null && typeof(x) === 'object' && CLUSTER_SYMBOL in x; - } - - /** - * Import an existing cluster to the stack from its attributes. - */ - public static fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster { - return new ImportedCluster(scope, id, attrs); - } - - /** - * Import an existing cluster to the stack from the cluster ARN. - * This does not provide access to the vpc, hasEc2Capacity, or connections - - * use the `fromClusterAttributes` method to access those properties. - */ - public static fromClusterArn(scope: Construct, id: string, clusterArn: string): ICluster { - const stack = Stack.of(scope); - const arn = stack.splitArn(clusterArn, ArnFormat.SLASH_RESOURCE_NAME); - const clusterName = arn.resourceName; - - if (!clusterName) { - throw new Error(`Missing required Cluster Name from Cluster ARN: ${clusterArn}`); - } - - const errorSuffix = 'is not available for a Cluster imported using fromClusterArn(), please use fromClusterAttributes() instead.'; - - class Import extends Resource implements ICluster { - public readonly clusterArn = clusterArn; - public readonly clusterName = clusterName!; - get hasEc2Capacity(): boolean { - throw new Error(`hasEc2Capacity ${errorSuffix}`); - } - get connections(): ec2.Connections { - throw new Error(`connections ${errorSuffix}`); - } - get vpc(): ec2.IVpc { - throw new Error(`vpc ${errorSuffix}`); - } - } - - return new Import(scope, id, { - environmentFromArn: clusterArn, - }); - } - - /** - * Manage the allowed network connections for the cluster with Security Groups. - */ - public readonly connections: ec2.Connections = new ec2.Connections(); - - /** - * The VPC associated with the cluster. - */ - public readonly vpc: ec2.IVpc; - - /** - * The Amazon Resource Name (ARN) that identifies the cluster. - */ - public readonly clusterArn: string; - - /** - * The name of the cluster. - */ - public readonly clusterName: string; - - /** - * The names of both ASG and Fargate capacity providers associated with the cluster. - */ - private _capacityProviderNames: string[] = []; - - /** - * The cluster default capacity provider strategy. This takes the form of a list of CapacityProviderStrategy objects. - */ - private _defaultCapacityProviderStrategy: CapacityProviderStrategy[] = []; - - /** - * The AWS Cloud Map namespace to associate with the cluster. - */ - private _defaultCloudMapNamespace?: cloudmap.INamespace; - - /** - * Specifies whether the cluster has EC2 instance capacity. - */ - private _hasEc2Capacity: boolean = false; - - /** - * The autoscaling group for added Ec2 capacity - */ - private _autoscalingGroup?: autoscaling.IAutoScalingGroup; - - /** - * The execute command configuration for the cluster - */ - private _executeCommandConfiguration?: ExecuteCommandConfiguration; - - /** - * CfnCluster instance - */ - private _cfnCluster: CfnCluster; - - /** - * Constructs a new instance of the Cluster class. - */ - constructor(scope: Construct, id: string, props: ClusterProps = {}) { - super(scope, id, { - physicalName: props.clusterName, - }); - - /** - * clusterSettings needs to be undefined if containerInsights is not explicitly set in order to allow any - * containerInsights settings on the account to apply. See: - * https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-clustersettings.html#cfn-ecs-cluster-clustersettings-value - */ - let clusterSettings = undefined; - if (props.containerInsights !== undefined) { - clusterSettings = [{ name: 'containerInsights', value: props.containerInsights ? ContainerInsights.ENABLED : ContainerInsights.DISABLED }]; - } - - this._capacityProviderNames = props.capacityProviders ?? []; - if (props.enableFargateCapacityProviders) { - this.enableFargateCapacityProviders(); - } - - if (props.executeCommandConfiguration) { - if ((props.executeCommandConfiguration.logging === ExecuteCommandLogging.OVERRIDE) !== - (props.executeCommandConfiguration.logConfiguration !== undefined)) { - throw new Error('Execute command log configuration must only be specified when logging is OVERRIDE.'); - } - this._executeCommandConfiguration = props.executeCommandConfiguration; - } - - this._cfnCluster = new CfnCluster(this, 'Resource', { - clusterName: this.physicalName, - clusterSettings, - configuration: this._executeCommandConfiguration && this.renderExecuteCommandConfiguration(), - }); - - this.clusterArn = this.getResourceArnAttribute(this._cfnCluster.attrArn, { - service: 'ecs', - resource: 'cluster', - resourceName: this.physicalName, - }); - this.clusterName = this.getResourceNameAttribute(this._cfnCluster.ref); - - this.vpc = props.vpc || new ec2.Vpc(this, 'Vpc', { maxAzs: 2 }); - - this._defaultCloudMapNamespace = props.defaultCloudMapNamespace !== undefined - ? this.addDefaultCloudMapNamespace(props.defaultCloudMapNamespace) - : undefined; - - this._autoscalingGroup = props.capacity !== undefined - ? this.addCapacity('DefaultAutoScalingGroup', props.capacity) - : undefined; - - // Only create cluster capacity provider associations if there are any EC2 - // capacity providers. Ordinarily we'd just add the construct to the tree - // since it's harmless, but we'd prefer not to add unexpected new - // resources to the stack which could surprise users working with - // brown-field CDK apps and stacks. - Aspects.of(this).add(new MaybeCreateCapacityProviderAssociations(this, id)); - } - - /** - * Enable the Fargate capacity providers for this cluster. - */ - public enableFargateCapacityProviders() { - for (const provider of ['FARGATE', 'FARGATE_SPOT']) { - if (!this._capacityProviderNames.includes(provider)) { - this._capacityProviderNames.push(provider); - } - } - } - - /** - * Add default capacity provider strategy for this cluster. - * - * @param defaultCapacityProviderStrategy cluster default capacity provider strategy. This takes the form of a list of CapacityProviderStrategy objects. - * - * For example - * [ - * { - * capacityProvider: 'FARGATE', - * base: 10, - * weight: 50 - * } - * ] - */ - public addDefaultCapacityProviderStrategy(defaultCapacityProviderStrategy: CapacityProviderStrategy[]) { - if (this._defaultCapacityProviderStrategy.length > 0) { - throw new Error('Cluster default capacity provider strategy is already set.'); - } - - if (defaultCapacityProviderStrategy.some(dcp => dcp.capacityProvider.includes('FARGATE')) && defaultCapacityProviderStrategy.some(dcp => !dcp.capacityProvider.includes('FARGATE'))) { - throw new Error('A capacity provider strategy cannot contain a mix of capacity providers using Auto Scaling groups and Fargate providers. Specify one or the other and try again.'); - } - - defaultCapacityProviderStrategy.forEach(dcp => { - if (!this._capacityProviderNames.includes(dcp.capacityProvider)) { - throw new Error(`Capacity provider ${dcp.capacityProvider} must be added to the cluster with addAsgCapacityProvider() before it can be used in a default capacity provider strategy.`); - } - }); - - const defaultCapacityProvidersWithBase = defaultCapacityProviderStrategy.filter(dcp => !!dcp.base); - if (defaultCapacityProvidersWithBase.length > 1) { - throw new Error('Only 1 capacity provider in a capacity provider strategy can have a nonzero base.'); - } - this._defaultCapacityProviderStrategy = defaultCapacityProviderStrategy; - } - - private renderExecuteCommandConfiguration(): CfnCluster.ClusterConfigurationProperty { - return { - executeCommandConfiguration: { - kmsKeyId: this._executeCommandConfiguration?.kmsKey?.keyArn, - logConfiguration: this._executeCommandConfiguration?.logConfiguration && this.renderExecuteCommandLogConfiguration(), - logging: this._executeCommandConfiguration?.logging, - }, - }; - } - - private renderExecuteCommandLogConfiguration(): CfnCluster.ExecuteCommandLogConfigurationProperty { - const logConfiguration = this._executeCommandConfiguration?.logConfiguration; - if (logConfiguration?.s3EncryptionEnabled && !logConfiguration?.s3Bucket) { - throw new Error('You must specify an S3 bucket name in the execute command log configuration to enable S3 encryption.'); - } - if (logConfiguration?.cloudWatchEncryptionEnabled && !logConfiguration?.cloudWatchLogGroup) { - throw new Error('You must specify a CloudWatch log group in the execute command log configuration to enable CloudWatch encryption.'); - } - return { - cloudWatchEncryptionEnabled: logConfiguration?.cloudWatchEncryptionEnabled, - cloudWatchLogGroupName: logConfiguration?.cloudWatchLogGroup?.logGroupName, - s3BucketName: logConfiguration?.s3Bucket?.bucketName, - s3EncryptionEnabled: logConfiguration?.s3EncryptionEnabled, - s3KeyPrefix: logConfiguration?.s3KeyPrefix, - }; - } - - /** - * Add an AWS Cloud Map DNS namespace for this cluster. - * NOTE: HttpNamespaces are supported only for use cases involving Service Connect. For use cases involving both Service- - * Discovery and Service Connect, customers should manage the HttpNamespace outside of the Cluster.addDefaultCloudMapNamespace method. - */ - public addDefaultCloudMapNamespace(options: CloudMapNamespaceOptions): cloudmap.INamespace { - if (this._defaultCloudMapNamespace !== undefined) { - throw new Error('Can only add default namespace once.'); - } - - const namespaceType = options.type !== undefined - ? options.type - : cloudmap.NamespaceType.DNS_PRIVATE; - - let sdNamespace; - switch (namespaceType) { - case cloudmap.NamespaceType.DNS_PRIVATE: - sdNamespace = new cloudmap.PrivateDnsNamespace(this, 'DefaultServiceDiscoveryNamespace', { - name: options.name, - vpc: this.vpc, - }); - break; - case cloudmap.NamespaceType.DNS_PUBLIC: - sdNamespace = new cloudmap.PublicDnsNamespace(this, 'DefaultServiceDiscoveryNamespace', { - name: options.name, - }); - break; - case cloudmap.NamespaceType.HTTP: - sdNamespace = new cloudmap.HttpNamespace(this, 'DefaultServiceDiscoveryNamespace', { - name: options.name, - }); - break; - default: - throw new Error(`Namespace type ${namespaceType} is not supported.`); - } - - this._defaultCloudMapNamespace = sdNamespace; - if (options.useForServiceConnect) { - this._cfnCluster.serviceConnectDefaults = { - namespace: options.name, - }; - } - - return sdNamespace; - } - - /** - * Getter for _defaultCapacityProviderStrategy. This is necessary to correctly create Capacity Provider Associations. - */ - public get defaultCapacityProviderStrategy() { - return this._defaultCapacityProviderStrategy; - } - - /** - * Getter for _capacityProviderNames added to cluster - */ - public get capacityProviderNames() { - return this._capacityProviderNames; - } - - /** - * Getter for namespace added to cluster - */ - public get defaultCloudMapNamespace(): cloudmap.INamespace | undefined { - return this._defaultCloudMapNamespace; - } - - /** - * It is highly recommended to use `Cluster.addAsgCapacityProvider` instead of this method. - * - * This method adds compute capacity to a cluster by creating an AutoScalingGroup with the specified options. - * - * Returns the AutoScalingGroup so you can add autoscaling settings to it. - */ - public addCapacity(id: string, options: AddCapacityOptions): autoscaling.AutoScalingGroup { - // Do 2-way defaulting here: if the machineImageType is BOTTLEROCKET, pick the right AMI. - // Otherwise, determine the machineImageType from the given AMI. - const machineImage = options.machineImage ?? - (options.machineImageType === MachineImageType.BOTTLEROCKET ? new BottleRocketImage({ - architecture: options.instanceType.architecture, - }) : new EcsOptimizedAmi()); - - const machineImageType = options.machineImageType ?? - (BottleRocketImage.isBottleRocketImage(machineImage) ? MachineImageType.BOTTLEROCKET : MachineImageType.AMAZON_LINUX_2); - - const autoScalingGroup = new autoscaling.AutoScalingGroup(this, id, { - vpc: this.vpc, - machineImage, - updateType: !!options.updatePolicy ? undefined : options.updateType || autoscaling.UpdateType.REPLACING_UPDATE, - ...options, - }); - - this.addAutoScalingGroup(autoScalingGroup, { - machineImageType: machineImageType, - ...options, - }); - - return autoScalingGroup; - } - - /** - * This method adds an Auto Scaling Group Capacity Provider to a cluster. - * - * @param provider the capacity provider to add to this cluster. - */ - public addAsgCapacityProvider(provider: AsgCapacityProvider, options: AddAutoScalingGroupCapacityOptions = {}) { - // Don't add the same capacity provider more than once. - if (this._capacityProviderNames.includes(provider.capacityProviderName)) { - return; - } - this._hasEc2Capacity = true; - this.configureAutoScalingGroup(provider.autoScalingGroup, { - ...options, - machineImageType: provider.machineImageType, - // Don't enable the instance-draining lifecycle hook if managed termination protection is enabled - taskDrainTime: provider.enableManagedTerminationProtection ? Duration.seconds(0) : options.taskDrainTime, - canContainersAccessInstanceRole: options.canContainersAccessInstanceRole ?? provider.canContainersAccessInstanceRole, - }); - - this._capacityProviderNames.push(provider.capacityProviderName); - } - - /** - * This method adds compute capacity to a cluster using the specified AutoScalingGroup. - * - * @deprecated Use `Cluster.addAsgCapacityProvider` instead. - * @param autoScalingGroup the ASG to add to this cluster. - * [disable-awslint:ref-via-interface] is needed in order to install the ECS - * agent by updating the ASGs user data. - */ - public addAutoScalingGroup(autoScalingGroup: autoscaling.AutoScalingGroup, options: AddAutoScalingGroupCapacityOptions = {}) { - this._hasEc2Capacity = true; - this.connections.connections.addSecurityGroup(...autoScalingGroup.connections.securityGroups); - this.configureAutoScalingGroup(autoScalingGroup, options); - } - - private configureAutoScalingGroup(autoScalingGroup: autoscaling.AutoScalingGroup, options: AddAutoScalingGroupCapacityOptions = {}) { - if (autoScalingGroup.osType === ec2.OperatingSystemType.WINDOWS) { - this.configureWindowsAutoScalingGroup(autoScalingGroup, options); - } else { - // Tie instances to cluster - switch (options.machineImageType) { - // Bottlerocket AMI - case MachineImageType.BOTTLEROCKET: { - autoScalingGroup.addUserData( - // Connect to the cluster - // Source: https://github.com/bottlerocket-os/bottlerocket/blob/develop/QUICKSTART-ECS.md#connecting-to-your-cluster - '[settings.ecs]', - `cluster = "${this.clusterName}"`, - ); - // Enabling SSM - // Source: https://github.com/bottlerocket-os/bottlerocket/blob/develop/QUICKSTART-ECS.md#enabling-ssm - autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSSMManagedInstanceCore')); - // required managed policy - autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonEC2ContainerServiceforEC2Role')); - break; - } - default: - // Amazon ECS-optimized AMI for Amazon Linux 2 - autoScalingGroup.addUserData(`echo ECS_CLUSTER=${this.clusterName} >> /etc/ecs/ecs.config`); - if (!options.canContainersAccessInstanceRole) { - // Deny containers access to instance metadata service - // Source: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html - autoScalingGroup.addUserData('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - autoScalingGroup.addUserData('sudo service iptables save'); - // The following is only for AwsVpc networking mode, but doesn't hurt for the other modes. - autoScalingGroup.addUserData('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - } - - if (autoScalingGroup.spotPrice && options.spotInstanceDraining) { - autoScalingGroup.addUserData('echo ECS_ENABLE_SPOT_INSTANCE_DRAINING=true >> /etc/ecs/ecs.config'); - } - } - } - - // ECS instances must be able to do these things - // Source: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html - // But, scoped down to minimal permissions required. - // Notes: - // - 'ecs:CreateCluster' removed. The cluster already exists. - autoScalingGroup.addToRolePolicy(new iam.PolicyStatement({ - actions: [ - 'ecs:DeregisterContainerInstance', - 'ecs:RegisterContainerInstance', - 'ecs:Submit*', - ], - resources: [ - this.clusterArn, - ], - })); - autoScalingGroup.addToRolePolicy(new iam.PolicyStatement({ - actions: [ - // These act on a cluster instance, and the instance doesn't exist until the service starts. - // Thus, scope to the cluster using a condition. - // See: https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonelasticcontainerservice.html - 'ecs:Poll', - 'ecs:StartTelemetrySession', - ], - resources: ['*'], - conditions: { - ArnEquals: { 'ecs:cluster': this.clusterArn }, - }, - })); - autoScalingGroup.addToRolePolicy(new iam.PolicyStatement({ - actions: [ - // These do not support resource constraints, and must be resource '*' - 'ecs:DiscoverPollEndpoint', - 'ecr:GetAuthorizationToken', - // Preserved for backwards compatibility. - // Users are able to enable cloudwatch agent using CDK. Existing - // customers might be installing CW agent as part of user-data so if we - // remove these permissions we will break that customer use cases. - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - resources: ['*'], - })); - - // 0 disables, otherwise forward to underlying implementation which picks the sane default - if (!options.taskDrainTime || options.taskDrainTime.toSeconds() !== 0) { - new InstanceDrainHook(autoScalingGroup, 'DrainECSHook', { - autoScalingGroup, - cluster: this, - drainTime: options.taskDrainTime, - topicEncryptionKey: options.topicEncryptionKey, - }); - } - } - - /** - * This method enables the Fargate or Fargate Spot capacity providers on the cluster. - * - * @param provider the capacity provider to add to this cluster. - * @deprecated Use `enableFargateCapacityProviders` instead. - * @see `addAsgCapacityProvider` to add an Auto Scaling Group capacity provider to the cluster. - */ - public addCapacityProvider(provider: string) { - if (!(provider === 'FARGATE' || provider === 'FARGATE_SPOT')) { - throw new Error('CapacityProvider not supported'); - } - - if (!this._capacityProviderNames.includes(provider)) { - this._capacityProviderNames.push(provider); - } - } - - private configureWindowsAutoScalingGroup(autoScalingGroup: autoscaling.AutoScalingGroup, options: AddAutoScalingGroupCapacityOptions = {}) { - // clear the cache of the agent - autoScalingGroup.addUserData('Remove-Item -Recurse C:\\ProgramData\\Amazon\\ECS\\Cache'); - - // pull the latest ECS Tools - autoScalingGroup.addUserData('Import-Module ECSTools'); - - // set the cluster name environment variable - autoScalingGroup.addUserData(`[Environment]::SetEnvironmentVariable("ECS_CLUSTER", "${this.clusterName}", "Machine")`); - autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_ENABLE_AWSLOGS_EXECUTIONROLE_OVERRIDE", "true", "Machine")'); - // tslint:disable-next-line: max-line-length - autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_AVAILABLE_LOGGING_DRIVERS", \'["json-file","awslogs"]\', "Machine")'); - - // enable instance draining - if (autoScalingGroup.spotPrice && options.spotInstanceDraining) { - autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_ENABLE_SPOT_INSTANCE_DRAINING", "true", "Machine")'); - } - - // enable task iam role - if (!options.canContainersAccessInstanceRole) { - autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_ENABLE_TASK_IAM_ROLE", "true", "Machine")'); - autoScalingGroup.addUserData(`Initialize-ECSAgent -Cluster '${this.clusterName}' -EnableTaskIAMRole`); - } else { - autoScalingGroup.addUserData(`Initialize-ECSAgent -Cluster '${this.clusterName}'`); - } - } - - /** - * Getter for autoscaling group added to cluster - */ - public get autoscalingGroup(): autoscaling.IAutoScalingGroup | undefined { - return this._autoscalingGroup; - } - - /** - * Whether the cluster has EC2 capacity associated with it - */ - public get hasEc2Capacity(): boolean { - return this._hasEc2Capacity; - } - - /** - * Getter for execute command configuration associated with the cluster. - */ - public get executeCommandConfiguration(): ExecuteCommandConfiguration | undefined { - return this._executeCommandConfiguration; - } - - /** - * This method returns the CloudWatch metric for this clusters CPU reservation. - * - * @default average over 5 minutes - */ - public metricCpuReservation(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ECSMetrics.cpuReservationAverage, props); - } - - /** - * This method returns the CloudWatch metric for this clusters CPU utilization. - * - * @default average over 5 minutes - */ - public metricCpuUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ECSMetrics.cpuUtilizationAverage, props); - } - - /** - * This method returns the CloudWatch metric for this clusters memory reservation. - * - * @default average over 5 minutes - */ - public metricMemoryReservation(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ECSMetrics.memoryReservationAverage, props); - } - - /** - * This method returns the CloudWatch metric for this clusters memory utilization. - * - * @default average over 5 minutes - */ - public metricMemoryUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(ECSMetrics.memoryUtilizationAverage, props); - } - - /** - * This method returns the specifed CloudWatch metric for this cluster. - */ - public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return new cloudwatch.Metric({ - namespace: 'AWS/ECS', - metricName, - dimensionsMap: { ClusterName: this.clusterName }, - ...props, - }).attachTo(this); - } - - private cannedMetric( - fn: (dims: { ClusterName: string }) => cloudwatch.MetricProps, - props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return new cloudwatch.Metric({ - ...fn({ ClusterName: this.clusterName }), - ...props, - }).attachTo(this); - } -} - -Object.defineProperty(Cluster.prototype, CLUSTER_SYMBOL, { - value: true, - enumerable: false, - writable: false, -}); - -/** - * A regional grouping of one or more container instances on which you can run tasks and services. - */ -export interface ICluster extends IResource { - /** - * The name of the cluster. - * @attribute - */ - readonly clusterName: string; - - /** - * The Amazon Resource Name (ARN) that identifies the cluster. - * @attribute - */ - readonly clusterArn: string; - - /** - * The VPC associated with the cluster. - */ - readonly vpc: ec2.IVpc; - - /** - * Manage the allowed network connections for the cluster with Security Groups. - */ - readonly connections: ec2.Connections; - - /** - * Specifies whether the cluster has EC2 instance capacity. - */ - readonly hasEc2Capacity: boolean; - - /** - * The AWS Cloud Map namespace to associate with the cluster. - */ - readonly defaultCloudMapNamespace?: cloudmap.INamespace; - - /** - * The autoscaling group added to the cluster if capacity is associated to the cluster - */ - readonly autoscalingGroup?: autoscaling.IAutoScalingGroup; - - /** - * The execute command configuration for the cluster - */ - readonly executeCommandConfiguration?: ExecuteCommandConfiguration; -} - -/** - * The properties to import from the ECS cluster. - */ -export interface ClusterAttributes { - /** - * The name of the cluster. - */ - readonly clusterName: string; - - /** - * The Amazon Resource Name (ARN) that identifies the cluster. - * - * @default Derived from clusterName - */ - readonly clusterArn?: string; - - /** - * The VPC associated with the cluster. - */ - readonly vpc: ec2.IVpc; - - /** - * The security groups associated with the container instances registered to the cluster. - */ - readonly securityGroups: ec2.ISecurityGroup[]; - - /** - * Specifies whether the cluster has EC2 instance capacity. - * - * @default true - */ - readonly hasEc2Capacity?: boolean; - - /** - * The AWS Cloud Map namespace to associate with the cluster. - * - * @default - No default namespace - */ - readonly defaultCloudMapNamespace?: cloudmap.INamespace; - - /** - * Autoscaling group added to the cluster if capacity is added - * - * @default - No default autoscaling group - */ - readonly autoscalingGroup?: autoscaling.IAutoScalingGroup; - - /** - * The execute command configuration for the cluster - * - * @default - none. - */ - readonly executeCommandConfiguration?: ExecuteCommandConfiguration; -} - -/** - * An Cluster that has been imported - */ -class ImportedCluster extends Resource implements ICluster { - /** - * Name of the cluster - */ - public readonly clusterName: string; - - /** - * ARN of the cluster - */ - public readonly clusterArn: string; - - /** - * VPC that the cluster instances are running in - */ - public readonly vpc: ec2.IVpc; - - /** - * Security group of the cluster instances - */ - public readonly connections = new ec2.Connections(); - - /** - * Whether the cluster has EC2 capacity - */ - public readonly hasEc2Capacity: boolean; - - /** - * Cloudmap namespace created in the cluster - */ - private _defaultCloudMapNamespace?: cloudmap.INamespace; - - /** - * The execute command configuration for the cluster - */ - private _executeCommandConfiguration?: ExecuteCommandConfiguration; - - /** - * Constructs a new instance of the ImportedCluster class. - */ - constructor(scope: Construct, id: string, props: ClusterAttributes) { - super(scope, id); - this.clusterName = props.clusterName; - this.vpc = props.vpc; - this.hasEc2Capacity = props.hasEc2Capacity !== false; - this._defaultCloudMapNamespace = props.defaultCloudMapNamespace; - this._executeCommandConfiguration = props.executeCommandConfiguration; - - this.clusterArn = props.clusterArn ?? Stack.of(this).formatArn({ - service: 'ecs', - resource: 'cluster', - resourceName: props.clusterName, - }); - - this.connections = new ec2.Connections({ - securityGroups: props.securityGroups, - }); - } - - public get defaultCloudMapNamespace(): cloudmap.INamespace | undefined { - return this._defaultCloudMapNamespace; - } - - public get executeCommandConfiguration(): ExecuteCommandConfiguration | undefined { - return this._executeCommandConfiguration; - } -} - -/** - * The properties for adding an AutoScalingGroup. - */ -export interface AddAutoScalingGroupCapacityOptions { - /** - * Specifies whether the containers can access the container instance role. - * - * @default false - */ - readonly canContainersAccessInstanceRole?: boolean; - - /** - * The time period to wait before force terminating an instance that is draining. - * - * This creates a Lambda function that is used by a lifecycle hook for the - * AutoScalingGroup that will delay instance termination until all ECS tasks - * have drained from the instance. Set to 0 to disable task draining. - * - * Set to 0 to disable task draining. - * - * @deprecated The lifecycle draining hook is not configured if using the EC2 Capacity Provider. Enable managed termination protection instead. - * @default Duration.minutes(5) - */ - readonly taskDrainTime?: Duration; - - /** - * Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services. - * For more information, see [Using Spot Instances](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-spot.html). - * - * @default false - */ - readonly spotInstanceDraining?: boolean - - /** - * If `AddAutoScalingGroupCapacityOptions.taskDrainTime` is non-zero, then the ECS cluster creates an - * SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. - * If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. - * See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information. - * - * @default The SNS Topic will not be encrypted. - */ - readonly topicEncryptionKey?: kms.IKey; - - /** - * What type of machine image this is - * - * Depending on the setting, different UserData will automatically be added - * to the `AutoScalingGroup` to configure it properly for use with ECS. - * - * If you create an `AutoScalingGroup` yourself and are adding it via - * `addAutoScalingGroup()`, you must specify this value. If you are adding an - * `autoScalingGroup` via `addCapacity`, this value will be determined - * from the `machineImage` you pass. - * - * @default - Automatically determined from `machineImage`, if available, otherwise `MachineImageType.AMAZON_LINUX_2`. - */ - readonly machineImageType?: MachineImageType; -} - -/** - * The properties for adding instance capacity to an AutoScalingGroup. - */ -export interface AddCapacityOptions extends AddAutoScalingGroupCapacityOptions, autoscaling.CommonAutoScalingGroupProps { - /** - * The EC2 instance type to use when launching instances into the AutoScalingGroup. - */ - readonly instanceType: ec2.InstanceType; - - /** - * The ECS-optimized AMI variant to use - * - * The default is to use an ECS-optimized AMI of Amazon Linux 2 which is - * automatically updated to the latest version on every deployment. This will - * replace the instances in the AutoScalingGroup. Make sure you have not disabled - * task draining, to avoid downtime when the AMI updates. - * - * To use an image that does not update on every deployment, pass: - * - * ```ts - * const machineImage = ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.STANDARD, { - * cachedInContext: true, - * }); - * ``` - * - * For more information, see [Amazon ECS-optimized - * AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html). - * - * You must define either `machineImage` or `machineImageType`, not both. - * - * @default - Automatically updated, ECS-optimized Amazon Linux 2 - */ - readonly machineImage?: ec2.IMachineImage; -} - -/** - * The options for creating an AWS Cloud Map namespace. - */ -export interface CloudMapNamespaceOptions { - /** - * The name of the namespace, such as example.com. - */ - readonly name: string; - - /** - * The type of CloudMap Namespace to create. - * - * @default PrivateDns - */ - readonly type?: cloudmap.NamespaceType; - - /** - * The VPC to associate the namespace with. This property is required for private DNS namespaces. - * - * @default VPC of the cluster for Private DNS Namespace, otherwise none - */ - readonly vpc?: ec2.IVpc; - - /** - * This property specifies whether to set the provided namespace as the service connect default in the cluster properties. - * - * @default false - */ - readonly useForServiceConnect?: boolean; - -} - -enum ContainerInsights { - /** - * Enable CloudWatch Container Insights for the cluster - */ - - ENABLED = 'enabled', - - /** - * Disable CloudWatch Container Insights for the cluster - */ - DISABLED = 'disabled', -} - -/** - * A Capacity Provider strategy to use for the service. - */ -export interface CapacityProviderStrategy { - /** - * The name of the capacity provider. - */ - readonly capacityProvider: string; - - /** - * The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one - * capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default - * value of 0 is used. - * - * @default - none - */ - readonly base?: number; - - /** - * The weight value designates the relative percentage of the total number of tasks launched that should use the - * specified -capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied. - * - * @default - 0 - */ - readonly weight?: number; -} - -/** - * The details of the execute command configuration. For more information, see - * [ExecuteCommandConfiguration] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandconfiguration.html - */ -export interface ExecuteCommandConfiguration { - /** - * The AWS Key Management Service key ID to encrypt the data between the local client and the container. - * - * @default - none - */ - readonly kmsKey?: kms.IKey, - - /** - * The log configuration for the results of the execute command actions. The logs can be sent to CloudWatch Logs or an Amazon S3 bucket. - * - * @default - none - */ - readonly logConfiguration?: ExecuteCommandLogConfiguration, - - /** - * The log settings to use for logging the execute command session. - * - * @default - none - */ - readonly logging?: ExecuteCommandLogging, -} - -/** - * The log settings to use to for logging the execute command session. For more information, see - * [Logging] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandconfiguration.html#cfn-ecs-cluster-executecommandconfiguration-logging - */ -export enum ExecuteCommandLogging { - /** - * The execute command session is not logged. - */ - NONE = 'NONE', - - /** - * The awslogs configuration in the task definition is used. If no logging parameter is specified, it defaults to this value. If no awslogs log driver is configured in the task definition, the output won't be logged. - */ - DEFAULT = 'DEFAULT', - - /** - * Specify the logging details as a part of logConfiguration. - */ - OVERRIDE = 'OVERRIDE', -} - -/** - * The log configuration for the results of the execute command actions. The logs can be sent to CloudWatch Logs and/ or an Amazon S3 bucket. - * For more information, see [ExecuteCommandLogConfiguration] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandlogconfiguration.html - */ -export interface ExecuteCommandLogConfiguration { - /** - * Whether or not to enable encryption on the CloudWatch logs. - * - * @default - encryption will be disabled. - */ - readonly cloudWatchEncryptionEnabled?: boolean, - - /** - * The name of the CloudWatch log group to send logs to. The CloudWatch log group must already be created. - * @default - none - */ - readonly cloudWatchLogGroup?: logs.ILogGroup, - - /** - * The name of the S3 bucket to send logs to. The S3 bucket must already be created. - * - * @default - none - */ - readonly s3Bucket?: s3.IBucket, - - /** - * Whether or not to enable encryption on the CloudWatch logs. - * - * @default - encryption will be disabled. - */ - readonly s3EncryptionEnabled?: boolean, - - /** - * An optional folder in the S3 bucket to place logs in. - * - * @default - none - */ - readonly s3KeyPrefix?: string -} - -/** - * The options for creating an Auto Scaling Group Capacity Provider. - */ -export interface AsgCapacityProviderProps extends AddAutoScalingGroupCapacityOptions { - /** - * The name of the capacity provider. If a name is specified, - * it cannot start with `aws`, `ecs`, or `fargate`. If no name is specified, - * a default name in the CFNStackName-CFNResourceName-RandomString format is used. - * - * @default CloudFormation-generated name - */ - readonly capacityProviderName?: string; - - /** - * The autoscaling group to add as a Capacity Provider. - */ - readonly autoScalingGroup: autoscaling.IAutoScalingGroup; - - /** - * When enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you. - * This means your cluster will automatically scale instances based on the load your tasks put on the cluster. - * For more information, see [Using Managed Scaling](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-managed-scaling) in the ECS Developer Guide. - * - * @default true - */ - readonly enableManagedScaling?: boolean; - - /** - * When enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon - * tasks. - * - * Scale-in protection will be automatically enabled on instances. When all non-daemon tasks are - * stopped on an instance, ECS initiates the scale-in process and turns off scale-in protection for the - * instance. The Auto Scaling Group can then terminate the instance. For more information see [Managed termination - * protection](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-auto-scaling.html#managed-termination-protection) - * in the ECS Developer Guide. - * - * Managed scaling must also be enabled. - * - * @default true - */ - readonly enableManagedTerminationProtection?: boolean; - - /** - * Maximum scaling step size. In most cases this should be left alone. - * - * @default 1000 - */ - readonly maximumScalingStepSize?: number; - - /** - * Minimum scaling step size. In most cases this should be left alone. - * - * @default 1 - */ - readonly minimumScalingStepSize?: number; - - /** - * Target capacity percent. In most cases this should be left alone. - * - * @default 100 - */ - readonly targetCapacityPercent?: number; -} - -/** - * An Auto Scaling Group Capacity Provider. This allows an ECS cluster to target - * a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and - * recommended), ECS can manage the number of instances in the ASG to fit the - * tasks, and can ensure that instances are not prematurely terminated while - * there are still tasks running on them. - */ -export class AsgCapacityProvider extends Construct { - /** - * Capacity provider name - * @default Chosen by CloudFormation - */ - readonly capacityProviderName: string; - - /** - * Auto Scaling Group - */ - readonly autoScalingGroup: autoscaling.AutoScalingGroup; - - /** - * Auto Scaling Group machineImageType. - */ - readonly machineImageType: MachineImageType; - - /** - * Whether managed termination protection is enabled. - */ - readonly enableManagedTerminationProtection?: boolean; - - /** - * Specifies whether the containers can access the container instance role. - * - * @default false - */ - readonly canContainersAccessInstanceRole?: boolean; - - constructor(scope: Construct, id: string, props: AsgCapacityProviderProps) { - super(scope, id); - this.autoScalingGroup = props.autoScalingGroup as autoscaling.AutoScalingGroup; - this.machineImageType = props.machineImageType ?? MachineImageType.AMAZON_LINUX_2; - this.canContainersAccessInstanceRole = props.canContainersAccessInstanceRole; - this.enableManagedTerminationProtection = props.enableManagedTerminationProtection ?? true; - - if (this.enableManagedTerminationProtection && props.enableManagedScaling === false) { - throw new Error('Cannot enable Managed Termination Protection on a Capacity Provider when Managed Scaling is disabled. Either enable Managed Scaling or disable Managed Termination Protection.'); - } - if (this.enableManagedTerminationProtection) { - this.autoScalingGroup.protectNewInstancesFromScaleIn(); - } - - if (props.capacityProviderName) { - if (!(/^(?!aws|ecs|fargate).+/gm.test(props.capacityProviderName))) { - throw new Error(`Invalid Capacity Provider Name: ${props.capacityProviderName}, If a name is specified, it cannot start with aws, ecs, or fargate.`); - } - } - const capacityProvider = new CfnCapacityProvider(this, id, { - name: props.capacityProviderName, - autoScalingGroupProvider: { - autoScalingGroupArn: this.autoScalingGroup.autoScalingGroupName, - managedScaling: props.enableManagedScaling === false ? undefined : { - status: 'ENABLED', - targetCapacity: props.targetCapacityPercent || 100, - maximumScalingStepSize: props.maximumScalingStepSize, - minimumScalingStepSize: props.minimumScalingStepSize, - }, - managedTerminationProtection: this.enableManagedTerminationProtection ? 'ENABLED' : 'DISABLED', - }, - }); - - this.capacityProviderName = capacityProvider.ref; - } -} - -/** - * A visitor that adds a capacity provider association to a Cluster only if - * the caller created any EC2 Capacity Providers. - */ -class MaybeCreateCapacityProviderAssociations implements IAspect { - private scope: Cluster; - private id: string; - private resource?: CfnClusterCapacityProviderAssociations; - - constructor(scope: Cluster, id: string) { - this.scope = scope; - this.id = id; - } - - public visit(node: IConstruct): void { - if (Cluster.isCluster(node)) { - if ((this.scope.defaultCapacityProviderStrategy.length > 0 || this.scope.capacityProviderNames.length > 0 && !this.resource)) { - this.resource = new CfnClusterCapacityProviderAssociations(this.scope, this.id, { - cluster: node.clusterName, - defaultCapacityProviderStrategy: this.scope.defaultCapacityProviderStrategy, - capacityProviders: this.scope.capacityProviderNames, - }); - } - } - } -} diff --git a/packages/@aws-cdk/aws-ecs/lib/images/repository.ts b/packages/@aws-cdk/aws-ecs/lib/images/repository.ts deleted file mode 100644 index 359888e7ccd92..0000000000000 --- a/packages/@aws-cdk/aws-ecs/lib/images/repository.ts +++ /dev/null @@ -1,54 +0,0 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Annotations, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { ContainerDefinition } from '../container-definition'; -import { ContainerImage, ContainerImageConfig } from '../container-image'; - -/** - * Regex pattern to check if it is an ECR image URL. - * - */ -const ECR_IMAGE_REGEX = /(^[a-zA-Z0-9][a-zA-Z0-9-_]*).dkr.ecr.([a-zA-Z0-9][a-zA-Z0-9-_]*).amazonaws.com(.cn)?\/.*/; - -/** - * The properties for an image hosted in a public or private repository. - */ -export interface RepositoryImageProps { - /** - * The secret to expose to the container that contains the credentials for the image repository. - * The supported value is the full ARN of an AWS Secrets Manager secret. - */ - readonly credentials?: secretsmanager.ISecret; -} - -/** - * An image hosted in a public or private repository. For images hosted in Amazon ECR, see - * [EcrImage](https://docs.aws.amazon.com/AmazonECR/latest/userguide/images.html). - */ -export class RepositoryImage extends ContainerImage { - - /** - * Constructs a new instance of the RepositoryImage class. - */ - constructor(private readonly imageName: string, private readonly props: RepositoryImageProps = {}) { - super(); - } - - public bind(scope: Construct, containerDefinition: ContainerDefinition): ContainerImageConfig { - // name could be a Token - in that case, skip validation altogether - if (!Token.isUnresolved(this.imageName) && ECR_IMAGE_REGEX.test(this.imageName)) { - Annotations.of(scope).addWarning("Proper policies need to be attached before pulling from ECR repository, or use 'fromEcrRepository'."); - } - - if (this.props.credentials) { - this.props.credentials.grantRead(containerDefinition.taskDefinition.obtainExecutionRole()); - } - - return { - imageName: this.imageName, - repositoryCredentials: this.props.credentials && { - credentialsParameter: this.props.credentials.secretArn, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/utils.ts b/packages/@aws-cdk/aws-ecs/lib/log-drivers/utils.ts deleted file mode 100644 index bbcd67da2fcda..0000000000000 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/utils.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Duration, SecretValue, Token } from '@aws-cdk/core'; -import { BaseLogDriverProps } from './base-log-driver'; -import { TaskDefinition } from '../base/task-definition'; -import { Secret } from '../container-definition'; -import { CfnTaskDefinition } from '../ecs.generated'; - -/** - * Remove undefined values from a dictionary - */ -export function removeEmpty(x: { [key: string]: (T | undefined | string) }): { [key: string]: string } { - for (const key of Object.keys(x)) { - if (x[key] === undefined) { - delete x[key]; - } - } - return x as any; -} - -/** - * Checks that a value is a positive integer - */ -export function ensurePositiveInteger(val: number) { - if (!Token.isUnresolved(val) && Number.isInteger(val) && val < 0) { - throw new Error(`\`${val}\` must be a positive integer.`); - } -} - -/** - * Checks that a value is contained in a range of two other values - */ -export function ensureInRange(val: number, start: number, end: number) { - if (!Token.isUnresolved(val) && !(val >= start && val <= end)) { - throw new Error(`\`${val}\` must be within range ${start}:${end}`); - } -} - -export function stringifyOptions(options: { [key: string]: (SecretValue | Duration | string | string[] | number | boolean | undefined) }) { - const _options: { [key: string]: string } = {}; - const filteredOptions = removeEmpty(options); - - for (const [key, value] of Object.entries(filteredOptions)) { - // Convert value to string - _options[key] = SecretValue.isSecretValue(value) ? value.unsafeUnwrap() : `${value}`; - } - - return _options; -} - -export function renderCommonLogDriverOptions(opts: BaseLogDriverProps) { - return { - 'tag': opts.tag, - 'labels': joinWithCommas(opts.labels), - 'env': joinWithCommas(opts.env), - 'env-regex': opts.envRegex, - }; -} - -export function joinWithCommas(xs?: string[]): string | undefined { - return xs && xs.join(','); -} - -export function renderLogDriverSecretOptions(secretValue: { [key: string]: Secret }, taskDefinition: TaskDefinition): -CfnTaskDefinition.SecretProperty[] { - const secrets = []; - for (const [name, secret] of Object.entries(secretValue)) { - secret.grantRead(taskDefinition.obtainExecutionRole()); - secrets.push({ - name, - valueFrom: secret.arn, - }); - } - return secrets; -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/package.json b/packages/@aws-cdk/aws-ecs/package.json deleted file mode 100644 index 83eed6d6ecb81..0000000000000 --- a/packages/@aws-cdk/aws-ecs/package.json +++ /dev/null @@ -1,292 +0,0 @@ -{ - "name": "@aws-cdk/aws-ecs", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ECS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ecs", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ecs" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ECS", - "packageId": "Amazon.CDK.AWS.ECS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ecs", - "module": "aws_cdk.aws_ecs", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ecs" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ECS", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ecs" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-s3-deployment": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/proxyquire": "^1.3.28", - "jest": "^27.5.1", - "proxyquire": "^2.1.3" - }, - "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling-hooktargets": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling-hooktargets": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-ecs.TaskDefinitionProps", - "props-physical-name:@aws-cdk/aws-ecs.Ec2TaskDefinitionProps", - "props-physical-name:@aws-cdk/aws-ecs.FargateTaskDefinitionProps", - "props-physical-name:@aws-cdk/aws-ecs.ExternalTaskDefinitionProps", - "docs-public-apis:@aws-cdk/aws-ecs.GelfCompressionType.GZIP", - "docs-public-apis:@aws-cdk/aws-ecs.WindowsOptimizedVersion.SERVER_2016", - "docs-public-apis:@aws-cdk/aws-ecs.WindowsOptimizedVersion.SERVER_2019", - "props-default-doc:@aws-cdk/aws-ecs.AppMeshProxyConfigurationProps.egressIgnoredIPs", - "props-default-doc:@aws-cdk/aws-ecs.AppMeshProxyConfigurationProps.egressIgnoredPorts", - "props-default-doc:@aws-cdk/aws-ecs.AppMeshProxyConfigurationProps.ignoredGID", - "props-default-doc:@aws-cdk/aws-ecs.AppMeshProxyConfigurationProps.ignoredUID", - "docs-public-apis:@aws-cdk/aws-ecs.BaseLogDriverProps", - "props-default-doc:@aws-cdk/aws-ecs.CloudMapOptions.failureThreshold", - "docs-public-apis:@aws-cdk/aws-ecs.ContainerDefinitionOptions", - "props-default-doc:@aws-cdk/aws-ecs.ContainerImageConfig.repositoryCredentials", - "docs-public-apis:@aws-cdk/aws-ecs.EcsTarget", - "props-default-doc:@aws-cdk/aws-ecs.Host.sourcePath", - "props-default-doc:@aws-cdk/aws-ecs.LogDriverConfig.options", - "props-default-doc:@aws-cdk/aws-ecs.PortMapping.hostPort", - "props-default-doc:@aws-cdk/aws-ecs.RepositoryImageProps.credentials", - "docs-public-apis:@aws-cdk/aws-ecs.ScratchSpace.sourcePath", - "props-default-doc:@aws-cdk/aws-ecs.Tmpfs.mountOptions", - "props-default-doc:@aws-cdk/aws-ecs.Volume.dockerVolumeConfiguration", - "props-default-doc:@aws-cdk/aws-ecs.Volume.efsVolumeConfiguration", - "props-default-doc:@aws-cdk/aws-ecs.Volume.host", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.ALL", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.AUDIT_CONTROL", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.AUDIT_WRITE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.BLOCK_SUSPEND", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.CHOWN", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.DAC_OVERRIDE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.DAC_READ_SEARCH", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.FOWNER", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.FSETID", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.IPC_LOCK", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.IPC_OWNER", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.KILL", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.LEASE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.LINUX_IMMUTABLE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.MAC_ADMIN", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.MAC_OVERRIDE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.MKNOD", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.NET_ADMIN", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.NET_BIND_SERVICE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.NET_BROADCAST", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.NET_RAW", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SETFCAP", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SETGID", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SETPCAP", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SETUID", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_ADMIN", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_BOOT", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_CHROOT", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_MODULE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_NICE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_PACCT", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_PTRACE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_RAWIO", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_RESOURCE", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_TIME", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYS_TTY_CONFIG", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.SYSLOG", - "docs-public-apis:@aws-cdk/aws-ecs.Capability.WAKE_ALARM", - "docs-public-apis:@aws-cdk/aws-ecs.ContainerDependencyCondition", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.STACK", - "docs-public-apis:@aws-cdk/aws-ecs.GelfCompressionType.ZLIB", - "docs-public-apis:@aws-cdk/aws-ecs.GelfCompressionType.NONE", - "docs-public-apis:@aws-cdk/aws-ecs.SplunkLogFormat.INLINE", - "docs-public-apis:@aws-cdk/aws-ecs.SplunkLogFormat.JSON", - "docs-public-apis:@aws-cdk/aws-ecs.SplunkLogFormat.RAW", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.DEFAULTS", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RO", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RW", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.SUID", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NOSUID", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.DEV", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NODEV", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.EXEC", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NOEXEC", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.SYNC", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.ASYNC", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.DIRSYNC", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.REMOUNT", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.MAND", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NOMAND", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.ATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NOATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.DIRATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NODIRATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.BIND", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RBIND", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.UNBINDABLE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RUNBINDABLE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.PRIVATE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RPRIVATE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.SHARED", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RSHARED", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.SLAVE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RSLAVE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.RELATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NORELATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.STRICTATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NOSTRICTATIME", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.MODE", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.UID", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.GID", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NR_INODES", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.NR_BLOCKS", - "docs-public-apis:@aws-cdk/aws-ecs.TmpfsMountOption.MPOL", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.CORE", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.CPU", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.DATA", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.FSIZE", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.LOCKS", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.MEMLOCK", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.MSGQUEUE", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.NICE", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.NOFILE", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.NPROC", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.RSS", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.RTPRIO", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.RTTIME", - "docs-public-apis:@aws-cdk/aws-ecs.UlimitName.SIGPENDING" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-ecs/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ecs/rosetta/default.ts-fixture deleted file mode 100644 index f2c611523a7d5..0000000000000 --- a/packages/@aws-cdk/aws-ecs/rosetta/default.ts-fixture +++ /dev/null @@ -1,26 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { SecretValue, Stack, Size } from '@aws-cdk/core'; -import autoscaling = require('@aws-cdk/aws-autoscaling'); -import cloudmap = require('@aws-cdk/aws-servicediscovery'); -import ecs = require('@aws-cdk/aws-ecs'); -import ec2 = require('@aws-cdk/aws-ec2'); -import elb = require('@aws-cdk/aws-elasticloadbalancing'); -import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2'); -import events = require('@aws-cdk/aws-events'); -import kms = require('@aws-cdk/aws-kms'); -import logs = require('@aws-cdk/aws-logs'); -import s3 = require('@aws-cdk/aws-s3'); -import secretsmanager = require('@aws-cdk/aws-secretsmanager'); -import ssm = require('@aws-cdk/aws-ssm'); -import targets = require('@aws-cdk/aws-events-targets'); -import iam = require('@aws-cdk/aws-iam'); -import path = require('path'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-ecs/test/.gitignore b/packages/@aws-cdk/aws-ecs/test/.gitignore deleted file mode 100644 index 30531cc5fb503..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cdk.json diff --git a/packages/@aws-cdk/aws-ecs/test/cluster.test.ts b/packages/@aws-cdk/aws-ecs/test/cluster.test.ts deleted file mode 100644 index f0a052ef73a71..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/cluster.test.ts +++ /dev/null @@ -1,2912 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as ecs from '../lib'; - -describe('cluster', () => { - describe('isCluster() returns', () => { - test('true if given cluster instance', () => { - // GIVEN - const stack = new cdk.Stack(); - // WHEN - const createdCluster = new ecs.Cluster(stack, 'EcsCluster'); - // THEN - expect(ecs.Cluster.isCluster(createdCluster)).toBe(true); - }); - - test('false if given imported cluster instance', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - const importedSg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG1', 'sg-1', { allowAllOutbound: false }); - // WHEN - const importedCluster = ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster-name', - securityGroups: [importedSg], - vpc, - }); - // THEN - expect(ecs.Cluster.isCluster(importedCluster)).toBe(false); - }); - - test('false if given undefined', () => { - // THEN - expect(ecs.Cluster.isCluster(undefined)).toBe(false); - }); - }); - - describe('When creating an ECS Cluster', () => { - testDeprecated('with no properties set, it correctly sets default properties', () => { - // GIVEN - const stack = new cdk.Stack(); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - }); - - Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { - CidrBlock: '10.0.0.0/16', - EnableDnsHostnames: true, - EnableDnsSupport: true, - InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, - Tags: [ - { - Key: 'Name', - Value: 'Default/EcsCluster/Vpc', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - InstanceType: 't2.micro', - IamInstanceProfile: { - Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', - }, - SecurityGroups: [ - { - 'Fn::GetAtt': [ - 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', - 'GroupId', - ], - }, - ], - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - }, - // eslint-disable-next-line max-len - ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - MaxSize: '1', - MinSize: '1', - LaunchConfigurationName: { - Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', - }, - Tags: [ - { - Key: 'Name', - PropagateAtLaunch: true, - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VPCZoneIdentifier: [ - { - Ref: 'EcsClusterVpcPrivateSubnet1SubnetFAB0E487', - }, - { - Ref: 'EcsClusterVpcPrivateSubnet2SubnetC2B7B1BA', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - Tags: [ - { - Key: 'Name', - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VpcId: { - Ref: 'EcsClusterVpc779914AB', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'ec2.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'ecs:DeregisterContainerInstance', - 'ecs:RegisterContainerInstance', - 'ecs:Submit*', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - { - Action: [ - 'ecs:Poll', - 'ecs:StartTelemetrySession', - ], - Effect: 'Allow', - Resource: '*', - Condition: { - ArnEquals: { - 'ecs:cluster': { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - }, - }, - { - Action: [ - 'ecs:DiscoverPollEndpoint', - 'ecr:GetAuthorizationToken', - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - }); - }); - - testDeprecated('with only vpc set, it correctly sets default properties', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { - vpc, - }); - - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - }); - - Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { - CidrBlock: '10.0.0.0/16', - EnableDnsHostnames: true, - EnableDnsSupport: true, - InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, - Tags: [ - { - Key: 'Name', - Value: 'Default/MyVpc', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - InstanceType: 't2.micro', - IamInstanceProfile: { - Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', - }, - SecurityGroups: [ - { - 'Fn::GetAtt': [ - 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', - 'GroupId', - ], - }, - ], - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - }, - // eslint-disable-next-line max-len - ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - MaxSize: '1', - MinSize: '1', - LaunchConfigurationName: { - Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', - }, - Tags: [ - { - Key: 'Name', - PropagateAtLaunch: true, - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VPCZoneIdentifier: [ - { - Ref: 'MyVpcPrivateSubnet1Subnet5057CF7E', - }, - { - Ref: 'MyVpcPrivateSubnet2Subnet0040C983', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - Tags: [ - { - Key: 'Name', - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VpcId: { - Ref: 'MyVpcF9F0CA6F', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'ec2.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'ecs:DeregisterContainerInstance', - 'ecs:RegisterContainerInstance', - 'ecs:Submit*', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - { - Action: [ - 'ecs:Poll', - 'ecs:StartTelemetrySession', - ], - Effect: 'Allow', - Resource: '*', - Condition: { - ArnEquals: { - 'ecs:cluster': { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - }, - }, - { - Action: [ - 'ecs:DiscoverPollEndpoint', - 'ecr:GetAuthorizationToken', - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - }); - - - }); - - testDeprecated('multiple clusters with default capacity', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - // WHEN - for (let i = 0; i < 2; i++) { - const cluster = new ecs.Cluster(stack, `EcsCluster${i}`, { vpc }); - cluster.addCapacity('MyCapacity', { - instanceType: new ec2.InstanceType('m3.medium'), - }); - } - - - }); - - testDeprecated('lifecycle hook is automatically added', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { - vpc, - }); - - // WHEN - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LifecycleHook', { - AutoScalingGroupName: { Ref: 'EcsClusterDefaultAutoScalingGroupASGC1A785DB' }, - LifecycleTransition: 'autoscaling:EC2_INSTANCE_TERMINATING', - DefaultResult: 'CONTINUE', - HeartbeatTimeout: 300, - NotificationTargetARN: { Ref: 'EcsClusterDefaultAutoScalingGroupLifecycleHookDrainHookTopicACD2D4A4' }, - RoleARN: { 'Fn::GetAtt': ['EcsClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleA38EC83B', 'Arn'] }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Timeout: 310, - Environment: { - Variables: { - CLUSTER: { - Ref: 'EcsCluster97242B84', - }, - }, - }, - Handler: 'index.lambda_handler', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'ec2:DescribeInstances', - 'ec2:DescribeInstanceAttribute', - 'ec2:DescribeInstanceStatus', - 'ec2:DescribeHosts', - ], - Effect: 'Allow', - Resource: '*', - }, - { - Action: 'autoscaling:CompleteLifecycleAction', - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':autoscaling:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':autoScalingGroup:*:autoScalingGroupName/', - { - Ref: 'EcsClusterDefaultAutoScalingGroupASGC1A785DB', - }, - ], - ], - }, - }, - { - Action: [ - 'ecs:DescribeContainerInstances', - 'ecs:DescribeTasks', - ], - Effect: 'Allow', - Resource: '*', - Condition: { - ArnEquals: { - 'ecs:cluster': { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - }, - }, - { - Action: [ - 'ecs:ListContainerInstances', - 'ecs:SubmitContainerStateChange', - 'ecs:SubmitTaskStateChange', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - { - Action: [ - 'ecs:UpdateContainerInstancesState', - 'ecs:ListTasks', - ], - Condition: { - ArnEquals: { - 'ecs:cluster': { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - }, - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'EcsClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicyA45BF396', - Roles: [ - { - Ref: 'EcsClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole94543EDA', - }, - ], - }); - - - }); - - testDeprecated('lifecycle hook with encrypted SNS is added correctly', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { - vpc, - }); - const key = new kms.Key(stack, 'Key'); - - // WHEN - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - topicEncryptionKey: key, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - KmsMasterKeyId: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - }); - - - }); - - testDeprecated('with capacity and cloudmap namespace properties set', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - new ecs.Cluster(stack, 'EcsCluster', { - vpc, - capacity: { - instanceType: new ec2.InstanceType('t2.micro'), - }, - defaultCloudMapNamespace: { - name: 'foo.com', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::PrivateDnsNamespace', { - Name: 'foo.com', - Vpc: { - Ref: 'MyVpcF9F0CA6F', - }, - }); - - Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { - CidrBlock: '10.0.0.0/16', - EnableDnsHostnames: true, - EnableDnsSupport: true, - InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, - Tags: [ - { - Key: 'Name', - Value: 'Default/MyVpc', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - InstanceType: 't2.micro', - IamInstanceProfile: { - Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', - }, - SecurityGroups: [ - { - 'Fn::GetAtt': [ - 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', - 'GroupId', - ], - }, - ], - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - }, - // eslint-disable-next-line max-len - ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - MaxSize: '1', - MinSize: '1', - LaunchConfigurationName: { - Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', - }, - Tags: [ - { - Key: 'Name', - PropagateAtLaunch: true, - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VPCZoneIdentifier: [ - { - Ref: 'MyVpcPrivateSubnet1Subnet5057CF7E', - }, - { - Ref: 'MyVpcPrivateSubnet2Subnet0040C983', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - Tags: [ - { - Key: 'Name', - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VpcId: { - Ref: 'MyVpcF9F0CA6F', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'ec2.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'ecs:DeregisterContainerInstance', - 'ecs:RegisterContainerInstance', - 'ecs:Submit*', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - { - Action: [ - 'ecs:Poll', - 'ecs:StartTelemetrySession', - ], - Effect: 'Allow', - Resource: '*', - Condition: { - ArnEquals: { - 'ecs:cluster': { - 'Fn::GetAtt': [ - 'EcsCluster97242B84', - 'Arn', - ], - }, - }, - }, - }, - { - Action: [ - 'ecs:DiscoverPollEndpoint', - 'ecr:GetAuthorizationToken', - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - }); - - - }); - }); - - testDeprecated('allows specifying instance type', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('m3.large'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - InstanceType: 'm3.large', - }); - - - }); - - testDeprecated('allows specifying cluster size', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - desiredCapacity: 3, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - MaxSize: '3', - }); - - - }); - - testDeprecated('configures userdata with powershell if windows machine image is specified', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('WindowsAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: new ecs.EcsOptimizedAmi({ - windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiwindowsserver2019englishfullrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - InstanceType: 't2.micro', - IamInstanceProfile: { - Ref: 'EcsClusterWindowsAutoScalingGroupInstanceProfile65DFA6BB', - }, - SecurityGroups: [ - { - 'Fn::GetAtt': [ - 'EcsClusterWindowsAutoScalingGroupInstanceSecurityGroupDA468DF1', - 'GroupId', - ], - }, - ], - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - 'Remove-Item -Recurse C:\\ProgramData\\Amazon\\ECS\\Cache\nImport-Module ECSTools\n[Environment]::SetEnvironmentVariable("ECS_CLUSTER", "', - { - Ref: 'EcsCluster97242B84', - }, - "\", \"Machine\")\n[Environment]::SetEnvironmentVariable(\"ECS_ENABLE_AWSLOGS_EXECUTIONROLE_OVERRIDE\", \"true\", \"Machine\")\n[Environment]::SetEnvironmentVariable(\"ECS_AVAILABLE_LOGGING_DRIVERS\", '[\"json-file\",\"awslogs\"]', \"Machine\")\n[Environment]::SetEnvironmentVariable(\"ECS_ENABLE_TASK_IAM_ROLE\", \"true\", \"Machine\")\nInitialize-ECSAgent -Cluster '", - { - Ref: 'EcsCluster97242B84', - }, - "' -EnableTaskIAMRole", - ], - ], - }, - }, - }); - - - }); - - /* - * TODO:v2.0.0 BEGINNING OF OBSOLETE BLOCK - */ - testDeprecated('allows specifying special HW AMI Type', () => { - // GIVEN - const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('GpuAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: new ecs.EcsOptimizedAmi({ - hardwareType: ecs.AmiHardwareType.GPU, - }), - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - }); - - expect(template.Parameters).toEqual({ - SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { - Type: 'AWS::SSM::Parameter::Value', - Default: '/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id', - }, - }); - - - }); - - testDeprecated('errors if amazon linux given with special HW type', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // THEN - expect(() => { - cluster.addCapacity('GpuAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: new ecs.EcsOptimizedAmi({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX, - hardwareType: ecs.AmiHardwareType.GPU, - }), - }); - }).toThrow(/Amazon Linux does not support special hardware type/); - - - }); - - testDeprecated('allows specifying windows image', () => { - // GIVEN - const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('WindowsAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: new ecs.EcsOptimizedAmi({ - windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, - }), - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Parameters).toEqual({ - SsmParameterValueawsserviceecsoptimizedamiwindowsserver2019englishfullrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { - Type: 'AWS::SSM::Parameter::Value', - Default: '/aws/service/ecs/optimized-ami/windows_server/2019/english/full/recommended/image_id', - }, - }); - - - }); - - testDeprecated('errors if windows given with special HW type', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // THEN - expect(() => { - cluster.addCapacity('WindowsGpuAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: new ecs.EcsOptimizedAmi({ - windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, - hardwareType: ecs.AmiHardwareType.GPU, - }), - }); - }).toThrow(/Windows Server does not support special hardware type/); - - - }); - - testDeprecated('errors if windowsVersion and linux generation are set', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // THEN - expect(() => { - cluster.addCapacity('WindowsScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: new ecs.EcsOptimizedAmi({ - windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX, - }), - }); - }).toThrow(/"windowsVersion" and Linux image "generation" cannot be both set/); - - - }); - - testDeprecated('allows returning the correct image for windows for EcsOptimizedAmi', () => { - // GIVEN - const stack = new cdk.Stack(); - const ami = new ecs.EcsOptimizedAmi({ - windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, - }); - - expect(ami.getImage(stack).osType).toEqual(ec2.OperatingSystemType.WINDOWS); - - - }); - - testDeprecated('allows returning the correct image for linux for EcsOptimizedAmi', () => { - // GIVEN - const stack = new cdk.Stack(); - const ami = new ecs.EcsOptimizedAmi({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX, - }); - - expect(ami.getImage(stack).osType).toEqual(ec2.OperatingSystemType.LINUX); - - - }); - - testDeprecated('allows returning the correct image for linux 2 for EcsOptimizedAmi', () => { - // GIVEN - const stack = new cdk.Stack(); - const ami = new ecs.EcsOptimizedAmi({ - generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, - }); - - expect(ami.getImage(stack).osType).toEqual(ec2.OperatingSystemType.LINUX); - - - }); - - test('allows returning the correct image for linux for EcsOptimizedImage', () => { - // GIVEN - const stack = new cdk.Stack(); - - expect(ecs.EcsOptimizedImage.amazonLinux().getImage(stack).osType).toEqual( - ec2.OperatingSystemType.LINUX); - - - }); - - test('allows returning the correct image for linux 2 for EcsOptimizedImage', () => { - // GIVEN - const stack = new cdk.Stack(); - - expect(ecs.EcsOptimizedImage.amazonLinux2().getImage(stack).osType).toEqual( - ec2.OperatingSystemType.LINUX); - - - }); - - test('allows returning the correct image for linux 2 for EcsOptimizedImage with ARM hardware', () => { - // GIVEN - const stack = new cdk.Stack(); - - expect(ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM).getImage(stack).osType).toEqual( - ec2.OperatingSystemType.LINUX); - - - }); - - - test('allows returning the correct image for windows for EcsOptimizedImage', () => { - // GIVEN - const stack = new cdk.Stack(); - - expect(ecs.EcsOptimizedImage.windows(ecs.WindowsOptimizedVersion.SERVER_2019).getImage(stack).osType).toEqual( - ec2.OperatingSystemType.WINDOWS); - - - }); - - test('allows setting cluster ServiceConnectDefaults.Namespace property when useAsServiceConnectDefault is true', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // WHEN - cluster.addDefaultCloudMapNamespace({ - name: 'foo.com', - useForServiceConnect: true, - }); - - // THEN - expect((cluster as any)._cfnCluster.serviceConnectDefaults.namespace).toBe('foo.com'); - }); - - test('allows setting cluster _defaultCloudMapNamespace for HTTP namespace', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - // WHEN - const namespace = cluster.addDefaultCloudMapNamespace({ - name: 'foo', - type: cloudmap.NamespaceType.HTTP, - }); - // THEN - expect(namespace.namespaceName).toBe('foo'); - }); - - /* - * TODO:v2.0.0 END OF OBSOLETE BLOCK - */ - - testDeprecated('allows specifying special HW AMI Type v2', () => { - // GIVEN - const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('GpuAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.GPU), - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - }); - - expect(template.Parameters).toEqual({ - SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { - Type: 'AWS::SSM::Parameter::Value', - Default: '/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id', - }, - }); - - - }); - - testDeprecated('allows specifying Amazon Linux v1 AMI', () => { - // GIVEN - const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('GpuAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: ecs.EcsOptimizedImage.amazonLinux(), - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinuxrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - }); - - expect(template.Parameters).toEqual({ - SsmParameterValueawsserviceecsoptimizedamiamazonlinuxrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { - Type: 'AWS::SSM::Parameter::Value', - Default: '/aws/service/ecs/optimized-ami/amazon-linux/recommended/image_id', - }, - }); - - - }); - - testDeprecated('allows specifying windows image v2', () => { - // GIVEN - const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('WindowsAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - machineImage: ecs.EcsOptimizedImage.windows(ecs.WindowsOptimizedVersion.SERVER_2019), - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Parameters).toEqual({ - SsmParameterValueawsserviceecsoptimizedamiwindowsserver2019englishfullrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { - Type: 'AWS::SSM::Parameter::Value', - Default: '/aws/service/ecs/optimized-ami/windows_server/2019/english/full/recommended/image_id', - }, - }); - - - }); - - testDeprecated('allows specifying spot fleet', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - spotPrice: '0.31', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - SpotPrice: '0.31', - }); - - - }); - - testDeprecated('allows specifying drain time', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - taskDrainTime: cdk.Duration.minutes(1), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LifecycleHook', { - HeartbeatTimeout: 60, - }); - - - }); - - testDeprecated('allows specifying automated spot draining', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('c5.xlarge'), - spotPrice: '0.0735', - spotInstanceDraining: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - }, - ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config\necho ECS_ENABLE_SPOT_INSTANCE_DRAINING=true >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - - }); - - testDeprecated('allows containers access to instance metadata service', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - canContainersAccessInstanceRole: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - }, - ' >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - - }); - - testDeprecated('allows adding default service discovery namespace', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - }); - - // WHEN - cluster.addDefaultCloudMapNamespace({ - name: 'foo.com', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::PrivateDnsNamespace', { - Name: 'foo.com', - Vpc: { - Ref: 'MyVpcF9F0CA6F', - }, - }); - - - }); - - testDeprecated('allows adding public service discovery namespace', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - }); - - // WHEN - cluster.addDefaultCloudMapNamespace({ - name: 'foo.com', - type: cloudmap.NamespaceType.DNS_PUBLIC, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::PublicDnsNamespace', { - Name: 'foo.com', - }); - - expect(cluster.defaultCloudMapNamespace!.type).toEqual(cloudmap.NamespaceType.DNS_PUBLIC); - - - }); - - testDeprecated('throws if default service discovery namespace added more than once', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - }); - - // WHEN - cluster.addDefaultCloudMapNamespace({ - name: 'foo.com', - }); - - // THEN - expect(() => { - cluster.addDefaultCloudMapNamespace({ - name: 'foo.com', - }); - }).toThrow(/Can only add default namespace once./); - - - }); - - - test('export/import of a cluster with a namespace', () => { - // GIVEN - const stack1 = new cdk.Stack(); - const vpc1 = new ec2.Vpc(stack1, 'Vpc'); - const cluster1 = new ecs.Cluster(stack1, 'Cluster', { vpc: vpc1 }); - cluster1.addDefaultCloudMapNamespace({ - name: 'hello.com', - }); - - const stack2 = new cdk.Stack(); - - // WHEN - const cluster2 = ecs.Cluster.fromClusterAttributes(stack2, 'Cluster', { - vpc: vpc1, - securityGroups: cluster1.connections.securityGroups, - defaultCloudMapNamespace: cloudmap.PrivateDnsNamespace.fromPrivateDnsNamespaceAttributes(stack2, 'ns', { - namespaceId: 'import-namespace-id', - namespaceArn: 'import-namespace-arn', - namespaceName: 'import-namespace-name', - }), - clusterName: 'cluster-name', - }); - - // THEN - expect(cluster2.defaultCloudMapNamespace!.type).toEqual(cloudmap.NamespaceType.DNS_PRIVATE); - expect(stack2.resolve(cluster2.defaultCloudMapNamespace!.namespaceId)).toEqual('import-namespace-id'); - - // Can retrieve subnets from VPC - will throw 'There are no 'Private' subnets in this VPC. Use a different VPC subnet selection.' if broken. - cluster2.vpc.selectSubnets(); - - - }); - - test('imported cluster with imported security groups honors allowAllOutbound', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - const importedSg1 = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG1', 'sg-1', { allowAllOutbound: false }); - const importedSg2 = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG2', 'sg-2'); - - const cluster = ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster-name', - securityGroups: [importedSg1, importedSg2], - vpc, - }); - - // WHEN - cluster.connections.allowToAnyIpv4(ec2.Port.tcp(443)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: 'sg-1', - }); - - Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 1); - - - }); - - test('Metric', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc', {}); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // THEN - expect(stack.resolve(cluster.metricCpuReservation())).toEqual({ - dimensions: { - ClusterName: { Ref: 'EcsCluster97242B84' }, - }, - namespace: 'AWS/ECS', - metricName: 'CPUReservation', - period: cdk.Duration.minutes(5), - statistic: 'Average', - }); - - expect(stack.resolve(cluster.metricMemoryReservation())).toEqual({ - dimensions: { - ClusterName: { Ref: 'EcsCluster97242B84' }, - }, - namespace: 'AWS/ECS', - metricName: 'MemoryReservation', - period: cdk.Duration.minutes(5), - statistic: 'Average', - }); - - expect(stack.resolve(cluster.metric('myMetric'))).toEqual({ - dimensions: { - ClusterName: { Ref: 'EcsCluster97242B84' }, - }, - namespace: 'AWS/ECS', - metricName: 'myMetric', - period: cdk.Duration.minutes(5), - statistic: 'Average', - }); - - - }); - - testDeprecated('ASG with a public VPC without NAT Gateways', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyPublicVpc', { - natGateways: 0, - subnetConfiguration: [ - { cidrMask: 24, name: 'ingress', subnetType: ec2.SubnetType.PUBLIC }, - ], - }); - - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - - // WHEN - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - associatePublicIpAddress: true, - vpcSubnets: { - onePerAz: true, - subnetType: ec2.SubnetType.PUBLIC, - }, - }); - - Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { - CidrBlock: '10.0.0.0/16', - EnableDnsHostnames: true, - EnableDnsSupport: true, - InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, - Tags: [ - { - Key: 'Name', - Value: 'Default/MyPublicVpc', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - InstanceType: 't2.micro', - AssociatePublicIpAddress: true, - IamInstanceProfile: { - Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', - }, - SecurityGroups: [ - { - 'Fn::GetAtt': [ - 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', - 'GroupId', - ], - }, - ], - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - }, - // eslint-disable-next-line max-len - ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - MaxSize: '1', - MinSize: '1', - LaunchConfigurationName: { - Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', - }, - Tags: [ - { - Key: 'Name', - PropagateAtLaunch: true, - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VPCZoneIdentifier: [ - { - Ref: 'MyPublicVpcingressSubnet1Subnet9191044C', - }, - { - Ref: 'MyPublicVpcingressSubnet2SubnetD2F2E034', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', - SecurityGroupEgress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow all outbound traffic by default', - IpProtocol: '-1', - }, - ], - Tags: [ - { - Key: 'Name', - Value: 'Default/EcsCluster/DefaultAutoScalingGroup', - }, - ], - VpcId: { - Ref: 'MyPublicVpcA2BF6CDA', - }, - }); - - // THEN - - }); - - test('enable container insights', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - new ecs.Cluster(stack, 'EcsCluster', { containerInsights: true }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - ClusterSettings: [ - { - Name: 'containerInsights', - Value: 'enabled', - }, - ], - }); - - - }); - - test('disable container insights', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - new ecs.Cluster(stack, 'EcsCluster', { containerInsights: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - ClusterSettings: [ - { - Name: 'containerInsights', - Value: 'disabled', - }, - ], - }); - - - }); - - test('default container insights is undefined', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - new ecs.Cluster(stack, 'EcsCluster'); - - // THEN - const assembly = app.synth(); - const stackAssembly = assembly.getStackByName(stack.stackName); - const template = stackAssembly.template; - - expect( - template.Resources.EcsCluster97242B84.Properties === undefined || - template.Resources.EcsCluster97242B84.Properties.ClusterSettings === undefined, - ).toEqual(true); - - - }); - - test('BottleRocketImage() returns correct AMI', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // WHEN - new ecs.BottleRocketImage().getImage(stack); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketawsecs') && - (v as any).Default.includes('/bottlerocket/'), - )).toEqual(true); - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketawsecs') && - (v as any).Default.includes('/aws-ecs-1/'), - )).toEqual(true); - - }); - - describe('isBottleRocketImage() returns', () => { - test('true if given bottleRocketImage instance', () => { - // WHEN - const bottleRockectImage = new ecs.BottleRocketImage(); - // THEN - expect(ecs.BottleRocketImage.isBottleRocketImage(bottleRockectImage)).toBe(true); - }); - - test('false if given amazonLinux instance', () => { - // GIVEN - const wrongImage = ec2.MachineImage.latestAmazonLinux(); - // THEN - expect(ecs.BottleRocketImage.isBottleRocketImage(wrongImage)).toBe(false); - }); - - test('false if given undefined', () => { - // THEN - expect(ecs.BottleRocketImage.isBottleRocketImage(undefined)).toBe(false); - }); - }); - - testDeprecated('cluster capacity with bottlerocket AMI, by setting machineImageType', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImageType: ecs.MachineImageType.BOTTLEROCKET, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); - Template.fromStack(stack).resourceCountIs('AWS::AutoScaling::AutoScalingGroup', 1); - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsservicebottlerocketawsecs1x8664latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '\n[settings.ecs]\ncluster = "', - { - Ref: 'EcsCluster97242B84', - }, - '"', - ], - ], - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'ec2.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/AmazonSSMManagedInstanceCore', - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role', - ], - ], - }, - ], - Tags: [ - { - Key: 'Name', - Value: 'test/EcsCluster/bottlerocket-asg', - }, - ], - }); - }); - - testDeprecated('correct bottlerocket AMI for ARM64 architecture', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('m6g.large'), - machineImageType: ecs.MachineImageType.BOTTLEROCKET, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsservicebottlerocketawsecs1arm64latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - }); - - Template.fromStack(stack).hasParameter('SsmParameterValueawsservicebottlerocketawsecs1arm64latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', { - Type: 'AWS::SSM::Parameter::Value', - Default: '/aws/service/bottlerocket/aws-ecs-1/arm64/latest/image_id', - }); - }); - - testDeprecated('throws when machineImage and machineImageType both specified', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '\n[settings.ecs]\ncluster = "', - { - Ref: 'EcsCluster97242B84', - }, - '"', - ], - ], - }, - }, - }); - - }); - - testDeprecated('updatePolicy set when passed without updateType', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingReplacingUpdate: { - WillReplace: true, - }, - }, - }); - }); - - testDeprecated('undefined updateType & updatePolicy replaced by default updatePolicy', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingReplacingUpdate: { - WillReplace: true, - }, - }, - }); - }); - - testDeprecated('updateType.NONE replaced by updatePolicy equivalent', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - updateType: autoscaling.UpdateType.NONE, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingScheduledAction: { - IgnoreUnmodifiedGroupSizeProperties: true, - }, - }, - }); - }); - - testDeprecated('updateType.REPLACING_UPDATE replaced by updatePolicy equivalent', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - updateType: autoscaling.UpdateType.REPLACING_UPDATE, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingReplacingUpdate: { - WillReplace: true, - }, - }, - }); - }); - - testDeprecated('updateType.ROLLING_UPDATE replaced by updatePolicy equivalent', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - updateType: autoscaling.UpdateType.ROLLING_UPDATE, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { - AutoScalingRollingUpdate: { - WaitOnResourceSignals: false, - PauseTime: 'PT0S', - SuspendProcesses: [ - 'HealthCheck', - 'ReplaceUnhealthy', - 'AZRebalance', - 'AlarmNotification', - 'ScheduledActions', - ], - }, - AutoScalingScheduledAction: { - IgnoreUnmodifiedGroupSizeProperties: true, - }, - }, - }); - }); - - testDeprecated('throws when updatePolicy and updateType both specified', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - expect(() => { - cluster.addCapacity('bottlerocket-asg', { - instanceType: new ec2.InstanceType('c5.large'), - machineImage: new ecs.BottleRocketImage(), - updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), - updateType: autoscaling.UpdateType.REPLACING_UPDATE, - }); - }).toThrow("Cannot set 'signals'/'updatePolicy' and 'updateType' together. Prefer 'signals'/'updatePolicy'"); - }); - - testDeprecated('allows specifying capacityProviders (deprecated)', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // WHEN - new ecs.Cluster(stack, 'EcsCluster', { capacityProviders: ['FARGATE_SPOT'] }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - CapacityProviders: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - CapacityProviders: ['FARGATE_SPOT'], - }); - - - }); - - test('allows specifying Fargate capacityProviders', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // WHEN - new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - CapacityProviders: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - CapacityProviders: ['FARGATE', 'FARGATE_SPOT'], - }); - - - }); - - test('allows specifying capacityProviders (alternate method)', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // WHEN - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - cluster.enableFargateCapacityProviders(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - CapacityProviders: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - CapacityProviders: ['FARGATE', 'FARGATE_SPOT'], - }); - - - }); - - testDeprecated('allows adding capacityProviders post-construction (deprecated)', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - cluster.addCapacityProvider('FARGATE'); - cluster.addCapacityProvider('FARGATE'); // does not add twice - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - CapacityProviders: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - CapacityProviders: ['FARGATE'], - }); - - - }); - - testDeprecated('allows adding capacityProviders post-construction', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - cluster.addCapacityProvider('FARGATE'); - cluster.addCapacityProvider('FARGATE'); // does not add twice - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - CapacityProviders: Match.absent(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - CapacityProviders: ['FARGATE'], - }); - - - }); - - testDeprecated('throws for unsupported capacity providers', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // THEN - expect(() => { - cluster.addCapacityProvider('HONK'); - }).toThrow(/CapacityProvider not supported/); - - - }); - - test('creates ASG capacity providers with expected defaults', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::CapacityProvider', { - AutoScalingGroupProvider: { - AutoScalingGroupArn: { - Ref: 'asgASG4D014670', - }, - ManagedScaling: { - Status: 'ENABLED', - TargetCapacity: 100, - }, - ManagedTerminationProtection: 'ENABLED', - }, - }); - - }); - - test('can disable Managed Scaling and Managed Termination Protection for ASG capacity provider', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedScaling: false, - enableManagedTerminationProtection: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::CapacityProvider', { - AutoScalingGroupProvider: { - AutoScalingGroupArn: { - Ref: 'asgASG4D014670', - }, - ManagedScaling: Match.absent(), - ManagedTerminationProtection: 'DISABLED', - }, - }); - }); - - test('can disable Managed Termination Protection for ASG capacity provider', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedTerminationProtection: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::CapacityProvider', { - AutoScalingGroupProvider: { - AutoScalingGroupArn: { - Ref: 'asgASG4D014670', - }, - ManagedScaling: { - Status: 'ENABLED', - TargetCapacity: 100, - }, - ManagedTerminationProtection: 'DISABLED', - }, - }); - }); - - test('throws error, when ASG capacity provider has Managed Scaling disabled and Managed Termination Protection is undefined (defaults to true)', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // THEN - expect(() => { - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedScaling: false, - }); - }).toThrowError('Cannot enable Managed Termination Protection on a Capacity Provider when Managed Scaling is disabled. Either enable Managed Scaling or disable Managed Termination Protection.'); - }); - - test('throws error, when Managed Scaling is disabled and Managed Termination Protection is enabled.', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // THEN - expect(() => { - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedScaling: false, - enableManagedTerminationProtection: true, - }); - }).toThrowError('Cannot enable Managed Termination Protection on a Capacity Provider when Managed Scaling is disabled. Either enable Managed Scaling or disable Managed Termination Protection.'); - }); - - test('capacity provider enables ASG new instance scale-in protection by default', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - NewInstancesProtectedFromScaleIn: true, - }); - - }); - - test('capacity provider disables ASG new instance scale-in protection', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedTerminationProtection: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - NewInstancesProtectedFromScaleIn: Match.absent(), - }); - }); - - test('can add ASG capacity via Capacity Provider', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedTerminationProtection: false, - }); - - cluster.enableFargateCapacityProviders(); - - // Ensure not added twice - cluster.addAsgCapacityProvider(capacityProvider); - cluster.addAsgCapacityProvider(capacityProvider); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - Cluster: { - Ref: 'EcsCluster97242B84', - }, - CapacityProviders: [ - 'FARGATE', - 'FARGATE_SPOT', - { - Ref: 'providerD3FF4D3A', - }, - ], - DefaultCapacityProviderStrategy: [], - }); - - }); - - test('should throw an error if capacity provider with default strategy is not present in capacity providers', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, - }).addDefaultCapacityProviderStrategy([ - { capacityProvider: 'test capacityProvider', base: 10, weight: 50 }, - ]); - }).toThrow('Capacity provider test capacityProvider must be added to the cluster with addAsgCapacityProvider() before it can be used in a default capacity provider strategy.'); - }); - - test('should throw an error when capacity providers is length 0 and default capacity provider startegy specified', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: false, - }).addDefaultCapacityProviderStrategy([ - { capacityProvider: 'test capacityProvider', base: 10, weight: 50 }, - ]); - }).toThrow('Capacity provider test capacityProvider must be added to the cluster with addAsgCapacityProvider() before it can be used in a default capacity provider strategy.'); - }); - - test('should throw an error when more than 1 default capacity provider have base specified', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, - }).addDefaultCapacityProviderStrategy([ - { capacityProvider: 'FARGATE', base: 10, weight: 50 }, - { capacityProvider: 'FARGATE_SPOT', base: 10, weight: 50 }, - ]); - }).toThrow(/Only 1 capacity provider in a capacity provider strategy can have a nonzero base./); - }); - - test('should throw an error when a capacity provider strategy contains a mix of Auto Scaling groups and Fargate providers', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, - }); - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedTerminationProtection: false, - }); - cluster.addAsgCapacityProvider(capacityProvider); - - // THEN - expect(() => { - cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: 'FARGATE', base: 10, weight: 50 }, - { capacityProvider: 'FARGATE_SPOT' }, - { capacityProvider: capacityProvider.capacityProviderName }, - ]); - }).toThrow(/A capacity provider strategy cannot contain a mix of capacity providers using Auto Scaling groups and Fargate providers. Specify one or the other and try again./); - }); - - test('should throw an error if addDefaultCapacityProviderStrategy is called more than once', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - const cluster = new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, - }); - cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: 'FARGATE', base: 10, weight: 50 }, - { capacityProvider: 'FARGATE_SPOT' }, - ]); - cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: 'FARGATE', base: 10, weight: 50 }, - { capacityProvider: 'FARGATE_SPOT' }, - ]); - }).toThrow(/Cluster default capacity provider strategy is already set./); - }); - - test('can add ASG capacity via Capacity Provider with default capacity provider', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { - enableFargateCapacityProviders: true, - }); - - cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: 'FARGATE', base: 10, weight: 50 }, - { capacityProvider: 'FARGATE_SPOT' }, - ]); - - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedTerminationProtection: false, - }); - - cluster.addAsgCapacityProvider(capacityProvider); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - Cluster: { - Ref: 'EcsCluster97242B84', - }, - CapacityProviders: [ - 'FARGATE', - 'FARGATE_SPOT', - { - Ref: 'providerD3FF4D3A', - }, - ], - DefaultCapacityProviderStrategy: [ - { CapacityProvider: 'FARGATE', Base: 10, Weight: 50 }, - { CapacityProvider: 'FARGATE_SPOT' }, - ], - }); - }); - - test('can add ASG default capacity provider', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { - autoScalingGroup, - enableManagedTerminationProtection: false, - }); - - cluster.addAsgCapacityProvider(capacityProvider); - - cluster.addDefaultCapacityProviderStrategy([ - { capacityProvider: capacityProvider.capacityProviderName }, - ]); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - Cluster: { - Ref: 'EcsCluster97242B84', - }, - CapacityProviders: [ - { - Ref: 'providerD3FF4D3A', - }, - ], - DefaultCapacityProviderStrategy: [ - { - CapacityProvider: { - Ref: 'providerD3FF4D3A', - }, - }, - ], - }); - }); - - test('correctly sets log configuration for execute command', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const kmsKey = new kms.Key(stack, 'KmsKey'); - - const logGroup = new logs.LogGroup(stack, 'LogGroup', { - encryptionKey: kmsKey, - }); - - const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { - encryptionKey: kmsKey, - }); - - // WHEN - new ecs.Cluster(stack, 'EcsCluster', { - executeCommandConfiguration: { - kmsKey: kmsKey, - logConfiguration: { - cloudWatchLogGroup: logGroup, - cloudWatchEncryptionEnabled: true, - s3Bucket: execBucket, - s3EncryptionEnabled: true, - s3KeyPrefix: 'exec-output', - }, - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { - Configuration: { - ExecuteCommandConfiguration: { - KmsKeyId: { - 'Fn::GetAtt': [ - 'KmsKey46693ADD', - 'Arn', - ], - }, - LogConfiguration: { - CloudWatchEncryptionEnabled: true, - CloudWatchLogGroupName: { - Ref: 'LogGroupF5B46931', - }, - S3BucketName: { - Ref: 'EcsExecBucket4F468651', - }, - S3EncryptionEnabled: true, - S3KeyPrefix: 'exec-output', - }, - Logging: 'OVERRIDE', - }, - }, - }); - - - }); - - test('throws when no log configuration is provided when logging is set to OVERRIDE', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - executeCommandConfiguration: { - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, - }); - }).toThrow(/Execute command log configuration must only be specified when logging is OVERRIDE./); - - - }); - - test('throws when log configuration provided but logging is set to DEFAULT', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - const logGroup = new logs.LogGroup(stack, 'LogGroup'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - executeCommandConfiguration: { - logConfiguration: { - cloudWatchLogGroup: logGroup, - }, - logging: ecs.ExecuteCommandLogging.DEFAULT, - }, - }); - }).toThrow(/Execute command log configuration must only be specified when logging is OVERRIDE./); - - - }); - - test('throws when CloudWatchEncryptionEnabled without providing CloudWatch Logs log group name', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - executeCommandConfiguration: { - logConfiguration: { - cloudWatchEncryptionEnabled: true, - }, - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, - }); - }).toThrow(/You must specify a CloudWatch log group in the execute command log configuration to enable CloudWatch encryption./); - - - }); - - test('throws when S3EncryptionEnabled without providing S3 Bucket name', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - - // THEN - expect(() => { - new ecs.Cluster(stack, 'EcsCluster', { - executeCommandConfiguration: { - logConfiguration: { - s3EncryptionEnabled: true, - }, - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, - }); - }).toThrow(/You must specify an S3 bucket name in the execute command log configuration to enable S3 encryption./); - - - }); - - test('When importing ECS Cluster via Arn', () => { - // GIVEN - const stack = new cdk.Stack(); - const clusterName = 'my-cluster'; - const region = 'service-region'; - const account = 'service-account'; - const cluster = ecs.Cluster.fromClusterArn(stack, 'Cluster', `arn:aws:ecs:${region}:${account}:cluster/${clusterName}`); - - // THEN - expect(cluster.clusterName).toEqual(clusterName); - expect(cluster.env.region).toEqual(region); - expect(cluster.env.account).toEqual(account); - }); - - test('throws error when import ECS Cluster without resource name in arn', () => { - // GIVEN - const stack = new cdk.Stack(); - - // THEN - expect(() => { - ecs.Cluster.fromClusterArn(stack, 'Cluster', 'arn:aws:ecs:service-region:service-account:cluster'); - }).toThrowError(/Missing required Cluster Name from Cluster ARN: /); - }); -}); - -test('can add ASG capacity via Capacity Provider by not specifying machineImageType', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - const autoScalingGroupAl2 = new autoscaling.AutoScalingGroup(stack, 'asgal2', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - const autoScalingGroupBottlerocket = new autoscaling.AutoScalingGroup(stack, 'asgBottlerocket', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: new ecs.BottleRocketImage(), - }); - - // WHEN - const capacityProviderAl2 = new ecs.AsgCapacityProvider(stack, 'provideral2', { - autoScalingGroup: autoScalingGroupAl2, - enableManagedTerminationProtection: false, - }); - - const capacityProviderBottlerocket = new ecs.AsgCapacityProvider(stack, 'providerBottlerocket', { - autoScalingGroup: autoScalingGroupBottlerocket, - enableManagedTerminationProtection: false, - machineImageType: ecs.MachineImageType.BOTTLEROCKET, - }); - - cluster.enableFargateCapacityProviders(); - - // Ensure not added twice - cluster.addAsgCapacityProvider(capacityProviderAl2); - cluster.addAsgCapacityProvider(capacityProviderAl2); - - // Add Bottlerocket ASG Capacity Provider - cluster.addAsgCapacityProvider(capacityProviderBottlerocket); - - - // THEN Bottlerocket LaunchConfiguration - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsservicebottlerocketawsecs1x8664latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - - }, - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '\n[settings.ecs]\ncluster = \"', - { - Ref: 'EcsCluster97242B84', - }, - '\"', - ], - ], - }, - }, - }); - - // THEN AmazonLinux2 LaunchConfiguration - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - ImageId: { - Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', - }, - UserData: { - 'Fn::Base64': { - 'Fn::Join': [ - '', - [ - '#!/bin/bash\necho ECS_CLUSTER=', - { - Ref: 'EcsCluster97242B84', - - }, - ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', - ], - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { - CapacityProviders: [ - 'FARGATE', - 'FARGATE_SPOT', - { - Ref: 'provideral2A427CBC0', - }, - { - Ref: 'providerBottlerocket90C039FA', - }, - ], - Cluster: { - Ref: 'EcsCluster97242B84', - }, - DefaultCapacityProviderStrategy: [], - }); - -}); - -test('throws when ASG Capacity Provider with capacityProviderName starting with aws, ecs or faragte', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - const autoScalingGroupAl2 = new autoscaling.AutoScalingGroup(stack, 'asgal2', { - vpc, - instanceType: new ec2.InstanceType('bogus'), - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - }); - - // THEN - expect(() => { - // WHEN Capacity Provider define capacityProviderName start with aws. - const capacityProviderAl2 = new ecs.AsgCapacityProvider(stack, 'provideral2', { - autoScalingGroup: autoScalingGroupAl2, - enableManagedTerminationProtection: false, - capacityProviderName: 'awscp', - }); - - cluster.addAsgCapacityProvider(capacityProviderAl2); - }).toThrow(/Invalid Capacity Provider Name: awscp, If a name is specified, it cannot start with aws, ecs, or fargate./); - - expect(() => { - // WHEN Capacity Provider define capacityProviderName start with ecs. - const capacityProviderAl2 = new ecs.AsgCapacityProvider(stack, 'provideral2-2', { - autoScalingGroup: autoScalingGroupAl2, - enableManagedTerminationProtection: false, - capacityProviderName: 'ecscp', - }); - - cluster.addAsgCapacityProvider(capacityProviderAl2); - }).toThrow(/Invalid Capacity Provider Name: ecscp, If a name is specified, it cannot start with aws, ecs, or fargate./); -}); - -describe('Accessing container instance role', function () { - - const addUserDataMock = jest.fn(); - const autoScalingGroup: autoscaling.AutoScalingGroup = { - addUserData: addUserDataMock, - addToRolePolicy: jest.fn(), - protectNewInstancesFromScaleIn: jest.fn(), - } as unknown as autoscaling.AutoScalingGroup; - - afterEach(() => { - addUserDataMock.mockClear(); - }); - - test('block ecs from accessing metadata service when canContainersAccessInstanceRole not set', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: autoScalingGroup, - }); - - cluster.addAsgCapacityProvider(capacityProvider); - - // THEN - expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo service iptables save'); - expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - }); - - test('allow ecs accessing metadata service when canContainersAccessInstanceRole is set on addAsgCapacityProvider', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: autoScalingGroup, - }); - - cluster.addAsgCapacityProvider(capacityProvider, { - canContainersAccessInstanceRole: true, - }); - - // THEN - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - }); - - test('allow ecs accessing metadata service when canContainersAccessInstanceRole is set on AsgCapacityProvider instantiation', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: autoScalingGroup, - canContainersAccessInstanceRole: true, - }); - - cluster.addAsgCapacityProvider(capacityProvider); - - // THEN - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - }); - - test('allow ecs accessing metadata service when canContainersAccessInstanceRole is set on constructor and method', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: autoScalingGroup, - canContainersAccessInstanceRole: true, - }); - - cluster.addAsgCapacityProvider(capacityProvider, { - canContainersAccessInstanceRole: true, - }); - - // THEN - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - }); - - test('block ecs from accessing metadata service when canContainersAccessInstanceRole set on constructor and not set on method', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: autoScalingGroup, - canContainersAccessInstanceRole: true, - }); - - cluster.addAsgCapacityProvider(capacityProvider, { - canContainersAccessInstanceRole: false, - }); - - // THEN - expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo service iptables save'); - expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - }); - - test('allow ecs accessing metadata service when canContainersAccessInstanceRole is not set on constructor and set on method', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'test'); - const cluster = new ecs.Cluster(stack, 'EcsCluster'); - - // WHEN - const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { - autoScalingGroup: autoScalingGroup, - canContainersAccessInstanceRole: false, - }); - - cluster.addAsgCapacityProvider(capacityProvider, { - canContainersAccessInstanceRole: true, - }); - - // THEN - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); - expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); - }); -}); diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts deleted file mode 100644 index 3554dc94d4617..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.d.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.d.ts deleted file mode 100644 index 3554dc94d4617..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.js b/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.js deleted file mode 100644 index bf260b9069cd1..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.environment-file.js.snapshot/asset.bb426cfb5fed5237e5928f871893b243ddf86a591a592b558bd29f60e28bad9d/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sdUJBQXVCLEdBQUcsNkJB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uICBjb25zdCByZXNwb25zZSA9IGF3YWl0IHMzLmdldEJ1Y2tldFRhZ2dpbmcoeyBCdWNrZXQ6IGJ1Y2tldE5hbWUgfSkucHJvbWlzZSgpO1xuICByZXR1cm4gcmVzcG9uc2UuVGFnU2V0LnNvbWUodGFnID0+IHRhZy5LZXkgPT09IEFVVE9fREVMRVRFX09CSkVDVFNfVEFHICYmIHRhZy5WYWx1ZSA9PT0gJ3RydWUnKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.ts deleted file mode 100644 index ce48860fc4e6b..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.exec-command.ts +++ /dev/null @@ -1,54 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const kmsKey = new kms.Key(stack, 'KmsKey'); - -const logGroup = new logs.LogGroup(stack, 'LogGroup', { - encryptionKey: kmsKey, -}); - -const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { - encryptionKey: kmsKey, -}); - -const cluster = new ecs.Cluster(stack, 'Ec2Cluster', { - vpc, - executeCommandConfiguration: { - kmsKey, - logConfiguration: { - cloudWatchLogGroup: logGroup, - cloudWatchEncryptionEnabled: true, - s3Bucket: execBucket, - s3EncryptionEnabled: true, - s3KeyPrefix: 'exec-output', - }, - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, -}); -cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), -}); - -const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); - -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 256, -}); - -new ecs.Ec2Service(stack, 'Ec2Service', { - cluster, - taskDefinition, - enableExecuteCommand: true, -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts deleted file mode 100644 index a2dad64892a47..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.lb-awsvpc-nw.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); -cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), -}); - -const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { - networkMode: ecs.NetworkMode.AWS_VPC, -}); - -const container = taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 256, -}); - -container.addPortMappings({ - containerPort: 80, - protocol: ecs.Protocol.TCP, -}); - -const service = new ecs.Ec2Service(stack, 'Service', { - cluster, - taskDefinition, -}); - -const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); -const listener = lb.addListener('PublicListener', { port: 80, open: true }); -listener.addTargets('ECS', { - port: 80, - targets: [service], -}); - -new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.ts b/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.ts deleted file mode 100644 index 344659c44d219..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/ec2/integ.pseudo-terminal.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ-pseudo-terminal'); - -// Create a cluster -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); -cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), -}); - -const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef', { - networkMode: ecs.NetworkMode.AWS_VPC, -}); - -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 256, - pseudoTerminal: true, -}); - -new ecs.Ec2Service(stack, 'Service', { - cluster, - taskDefinition, -}); -new integ.IntegTest(app, 'PseudoTerminal', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts b/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts deleted file mode 100644 index 0af518dfa6b11..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.exec-command.ts +++ /dev/null @@ -1,67 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ-exec-command'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const kmsKey = new kms.Key(stack, 'KmsKey'); - -const logGroup = new logs.LogGroup(stack, 'LogGroup', { - encryptionKey: kmsKey, -}); - -const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { - encryptionKey: kmsKey, -}); - -const cluster = new ecs.Cluster(stack, 'FargateCluster', { - vpc, - executeCommandConfiguration: { - kmsKey, - logConfiguration: { - cloudWatchLogGroup: logGroup, - cloudWatchEncryptionEnabled: true, - s3Bucket: execBucket, - s3EncryptionEnabled: true, - s3KeyPrefix: 'exec-output', - }, - logging: ecs.ExecuteCommandLogging.OVERRIDE, - }, -}); - -const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); - -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - healthCheck: { - command: ['CMD-SHELL', 'curl localhost:8000'], - interval: Duration.seconds(60), - timeout: Duration.seconds(40), - }, -}); - -new ecs.FargateService(stack, 'FargateService', { - cluster, - taskDefinition, - enableExecuteCommand: true, -}); - -new integ.IntegTest(app, 'exec-command-integ-test', { - testCases: [stack], - diffAssets: true, - cdkCommandOptions: { - deploy: { - args: { - rollback: true, - }, - }, - }, -}); diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts b/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts deleted file mode 100644 index e2d40e4ef52f6..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.lb-awsvpc-nw.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-ecs-integ'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); - -const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { - memoryLimitMiB: 1024, - cpu: 512, -}); - -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - portMappings: [{ - containerPort: 80, - protocol: ecs.Protocol.TCP, - }], -}); - -const service = new ecs.FargateService(stack, 'Service', { - cluster, - taskDefinition, -}); - -const scaling = service.autoScaleTaskCount({ maxCapacity: 10 }); -// Quite low to try and force it to scale -scaling.scaleOnCpuUtilization('ReasonableCpu', { targetUtilizationPercent: 10 }); - -const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); -const listener = lb.addListener('PublicListener', { port: 80, open: true }); -listener.addTargets('Fargate', { - port: 80, - targets: [service], -}); - -new cdk.CfnOutput(stack, 'LoadBalancerDNS', { value: lb.loadBalancerDnsName }); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.ts b/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.ts deleted file mode 100644 index e860fa9a7147f..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/fargate/integ.pseudo-terminal.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as ecs from '../../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'integ-pseudo-terminal'); - -// Create a cluster -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); -const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef', { - cpu: 256, - memoryLimitMiB: 512, -}); -taskDefinition.addContainer('web', { - image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), - memoryLimitMiB: 512, - cpu: 256, - pseudoTerminal: true, -}); - -new ecs.FargateService(stack, 'Service', { - cluster, - taskDefinition, -}); -new integ.IntegTest(app, 'PseudoTerminal', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ecs/test/util.ts b/packages/@aws-cdk/aws-ecs/test/util.ts deleted file mode 100644 index cdfe38403422e..0000000000000 --- a/packages/@aws-cdk/aws-ecs/test/util.ts +++ /dev/null @@ -1,21 +0,0 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as ecs from '../lib'; - -export function addDefaultCapacityProvider(cluster: ecs.Cluster, - stack: cdk.Stack, - vpc: ec2.Vpc, - props?: Omit) { - const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { - vpc, - machineImage: ecs.EcsOptimizedImage.amazonLinux2(), - instanceType: new ec2.InstanceType('t2.micro'), - }); - const provider = new ecs.AsgCapacityProvider(stack, 'AsgCapacityProvider', { - ...props, - autoScalingGroup, - }); - cluster.addAsgCapacityProvider(provider); - cluster.connections.addSecurityGroup(...autoScalingGroup.connections.securityGroups); -} diff --git a/packages/@aws-cdk/aws-efs/.eslintrc.js b/packages/@aws-cdk/aws-efs/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-efs/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-efs/.gitignore b/packages/@aws-cdk/aws-efs/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-efs/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-efs/.npmignore b/packages/@aws-cdk/aws-efs/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-efs/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-efs/LICENSE b/packages/@aws-cdk/aws-efs/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-efs/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-efs/NOTICE b/packages/@aws-cdk/aws-efs/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-efs/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-efs/README.md b/packages/@aws-cdk/aws-efs/README.md deleted file mode 100644 index d49d39ffd2a8d..0000000000000 --- a/packages/@aws-cdk/aws-efs/README.md +++ /dev/null @@ -1,208 +0,0 @@ -# Amazon Elastic File System Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -[Amazon Elastic File System](https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html) (Amazon EFS) provides a simple, scalable, -fully managed elastic NFS file system for use with AWS Cloud services and on-premises resources. -Amazon EFS provides file storage in the AWS Cloud. With Amazon EFS, you can create a file system, -mount the file system on an Amazon EC2 instance, and then read and write data to and from your file system. - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## File Systems - -Amazon EFS provides elastic, shared file storage that is POSIX-compliant. The file system you create -supports concurrent read and write access from multiple Amazon EC2 instances and is accessible from -all of the Availability Zones in the AWS Region where it is created. Learn more about [EFS file systems](https://docs.aws.amazon.com/efs/latest/ug/creating-using.html) - -### Create an Amazon EFS file system - -A Virtual Private Cloud (VPC) is required to create an Amazon EFS file system. -The following example creates a file system that is encrypted at rest, running in `General Purpose` -performance mode, and `Bursting` throughput mode and does not transition files to the Infrequent -Access (IA) storage class. - -```ts -const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { - vpc: new ec2.Vpc(this, 'VPC'), - lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS, // files are not transitioned to infrequent access (IA) storage by default - performanceMode: efs.PerformanceMode.GENERAL_PURPOSE, // default - outOfInfrequentAccessPolicy: efs.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS, // files are not transitioned back from (infrequent access) IA to primary storage by default -}); -``` - -⚠️ An Amazon EFS file system's performance mode can't be MAX_IO when its throughputMode is ELASTIC. - -⚠️ An Amazon EFS file system's performance mode can't be changed after the file system has been created. -Updating this property will replace the file system. - -Any file system that has been created outside the stack can be imported into your CDK app. - -Use the `fromFileSystemAttributes()` API to import an existing file system. -Here is an example of giving a role write permissions on a file system. - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -const importedFileSystem = efs.FileSystem.fromFileSystemAttributes(this, 'existingFS', { - fileSystemId: 'fs-12345678', // You can also use fileSystemArn instead of fileSystemId. - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(this, 'SG', 'sg-123456789', { - allowAllOutbound: false, - }), -}); -``` - -### IAM to control file system data access - -You can use both IAM identity policies and resource policies to control client access to Amazon EFS resources in a way that is scalable and optimized for cloud environments. Using IAM, you can permit clients to perform specific actions on a file system, including read-only, write, and root access. - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -const myFileSystemPolicy = new iam.PolicyDocument({ - statements: [new iam.PolicyStatement({ - actions: [ - 'elasticfilesystem:ClientWrite', - 'elasticfilesystem:ClientMount', - ], - principals: [new iam.AccountRootPrincipal()], - resources: ['*'], - conditions: { - Bool: { - 'elasticfilesystem:AccessedViaMountTarget': 'true', - }, - }, - })], -}); - -const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { - vpc: new ec2.Vpc(this, 'VPC'), - fileSystemPolicy: myFileSystemPolicy, -}); -``` - -Alternatively, a resource policy can be added later using `addToResourcePolicy(statement)`. Note that this will not work with imported FileSystem. - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -declare const statement: iam.PolicyStatement; -const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { - vpc: new ec2.Vpc(this, 'VPC'), -}); - -fileSystem.addToResourcePolicy(statement); -``` - -### Permissions - -If you need to grant file system permissions to another resource, you can use the `.grant()` API. -As an example, the following code gives `elasticfilesystem:ClientWrite` permissions to an IAM role. - -```ts fixture=with-filesystem-instance -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.AnyPrincipal(), -}); - -fileSystem.grant(role, 'elasticfilesystem:ClientWrite'); -``` - -### Access Point - -An access point is an application-specific view into an EFS file system that applies an operating -system user and group, and a file system path, to any file system request made through the access -point. The operating system user and group override any identity information provided by the NFS -client. The file system path is exposed as the access point's root directory. Applications using -the access point can only access data in its own directory and below. To learn more, see [Mounting a File System Using EFS Access Points](https://docs.aws.amazon.com/efs/latest/ug/efs-access-points.html). - -Use the `addAccessPoint` API to create an access point from a fileSystem. - -```ts fixture=with-filesystem-instance -fileSystem.addAccessPoint('AccessPoint'); -``` - -By default, when you create an access point, the root(`/`) directory is exposed to the client -connecting to the access point. You can specify a custom path with the `path` property. - -If `path` does not exist, it will be created with the settings defined in the `creationInfo`. -See [Creating Access Points](https://docs.aws.amazon.com/efs/latest/ug/create-access-point.html) for more details. - -Any access point that has been created outside the stack can be imported into your CDK app. - -Use the `fromAccessPointAttributes()` API to import an existing access point. - -```ts -efs.AccessPoint.fromAccessPointAttributes(this, 'ap', { - accessPointId: 'fsap-1293c4d9832fo0912', - fileSystem: efs.FileSystem.fromFileSystemAttributes(this, 'efs', { - fileSystemId: 'fs-099d3e2f', - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(this, 'sg', 'sg-51530134'), - }), -}); -``` - -⚠️ Notice: When importing an Access Point using `fromAccessPointAttributes()`, you must make sure -the mount targets are deployed and their lifecycle state is `available`. Otherwise, you may encounter -the following error when deploying: -> EFS file system <ARN of efs> referenced by access point <ARN of access point of EFS> has -> mount targets created in all availability zones the function will execute in, but not all -> are in the available life cycle state yet. Please wait for them to become available and -> try the request again. - -### Connecting - -To control who can access the EFS, use the `.connections` attribute. EFS has -a fixed default port, so you don't need to specify the port: - -```ts fixture=with-filesystem-instance -fileSystem.connections.allowDefaultPortFrom(instance); -``` - -Learn more about [managing file system network accessibility](https://docs.aws.amazon.com/efs/latest/ug/manage-fs-access.html) - -### Mounting the file system using User Data - -After you create a file system, you can create mount targets. Then you can mount the file system on -EC2 instances, containers, and Lambda functions in your virtual private cloud (VPC). - -The following example automatically mounts a file system during instance launch. - -```ts fixture=with-filesystem-instance -fileSystem.connections.allowDefaultPortFrom(instance); - -instance.userData.addCommands("yum check-update -y", // Ubuntu: apt-get -y update - "yum upgrade -y", // Ubuntu: apt-get -y upgrade - "yum install -y amazon-efs-utils", // Ubuntu: apt-get -y install amazon-efs-utils - "yum install -y nfs-utils", // Ubuntu: apt-get -y install nfs-common - "file_system_id_1=" + fileSystem.fileSystemId, - "efs_mount_point_1=/mnt/efs/fs1", - "mkdir -p \"${efs_mount_point_1}\"", - "test -f \"/sbin/mount.efs\" && echo \"${file_system_id_1}:/ ${efs_mount_point_1} efs defaults,_netdev\" >> /etc/fstab || " + - "echo \"${file_system_id_1}.efs." + Stack.of(this).region + ".amazonaws.com:/ ${efs_mount_point_1} nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0\" >> /etc/fstab", - "mount -a -t efs,nfs4 defaults"); -``` - -Learn more about [mounting EFS file systems](https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html) - -### Deleting - -Since file systems are stateful resources, by default the file system will not be deleted when your -stack is deleted. - -You can configure the file system to be destroyed on stack deletion by setting a `removalPolicy` - -```ts -const fileSystem = new efs.FileSystem(this, 'EfsFileSystem', { - vpc: new ec2.Vpc(this, 'VPC'), - removalPolicy: RemovalPolicy.DESTROY, -}); -``` diff --git a/packages/@aws-cdk/aws-efs/jest.config.js b/packages/@aws-cdk/aws-efs/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-efs/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json deleted file mode 100644 index 3a054aed93565..0000000000000 --- a/packages/@aws-cdk/aws-efs/package.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "name": "@aws-cdk/aws-efs", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::EFS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.efs", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "efs" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.EFS", - "packageId": "Amazon.CDK.AWS.EFS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-efs", - "module": "aws_cdk.aws_efs", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-efs" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::EFS", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "efs" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-efs.AccessPointProps", - "resource-attribute:@aws-cdk/aws-efs.FileSystem.fileSystemArn" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-efs/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-efs/rosetta/default.ts-fixture deleted file mode 100644 index d3667dedefca0..0000000000000 --- a/packages/@aws-cdk/aws-efs/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as efs from '@aws-cdk/aws-efs'; -import * as ec2 from '@aws-cdk/aws-ec2'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-eks/.eslintrc.js b/packages/@aws-cdk/aws-eks/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-eks/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-eks/.gitignore b/packages/@aws-cdk/aws-eks/.gitignore deleted file mode 100644 index dba3a2dfd86e9..0000000000000 --- a/packages/@aws-cdk/aws-eks/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk - -.nycrc -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-eks/.npmignore b/packages/@aws-cdk/aws-eks/.npmignore deleted file mode 100644 index 957b49a56a825..0000000000000 --- a/packages/@aws-cdk/aws-eks/.npmignore +++ /dev/null @@ -1,33 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js - -# Don't include lambda node_modules. These are installed at build time. -lib/cluster-resource-handler/node_modules - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-eks/LICENSE b/packages/@aws-cdk/aws-eks/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-eks/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-eks/NOTICE b/packages/@aws-cdk/aws-eks/NOTICE deleted file mode 100644 index a5a290d6cbe2e..0000000000000 --- a/packages/@aws-cdk/aws-eks/NOTICE +++ /dev/null @@ -1,23 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** yaml - https://www.npmjs.com/package/yaml -Copyright 2018 Eemeli Aro - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - ----------------- \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/README.md b/packages/@aws-cdk/aws-eks/README.md deleted file mode 100644 index 2f6e897350de6..0000000000000 --- a/packages/@aws-cdk/aws-eks/README.md +++ /dev/null @@ -1,1507 +0,0 @@ -# Amazon EKS Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This construct library allows you to define [Amazon Elastic Container Service for Kubernetes (EKS)](https://aws.amazon.com/eks/) clusters. -In addition, the library also supports defining Kubernetes resource manifests within EKS clusters. - -## Table Of Contents - -* [Quick Start](#quick-start) -* [API Reference](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-eks-readme.html) -* [Architectural Overview](#architectural-overview) -* [Provisioning clusters](#provisioning-clusters) - * [Managed node groups](#managed-node-groups) - * [Fargate Profiles](#fargate-profiles) - * [Self-managed nodes](#self-managed-nodes) - * [Endpoint Access](#endpoint-access) - * [ALB Controller](#alb-controller) - * [VPC Support](#vpc-support) - * [Kubectl Support](#kubectl-support) - * [ARM64 Support](#arm64-support) - * [Masters Role](#masters-role) - * [Encryption](#encryption) -* [Permissions and Security](#permissions-and-security) -* [Applying Kubernetes Resources](#applying-kubernetes-resources) - * [Kubernetes Manifests](#kubernetes-manifests) - * [Helm Charts](#helm-charts) - * [CDK8s Charts](#cdk8s-charts) -* [Patching Kubernetes Resources](#patching-kubernetes-resources) -* [Querying Kubernetes Resources](#querying-kubernetes-resources) -* [Using existing clusters](#using-existing-clusters) -* [Known Issues and Limitations](#known-issues-and-limitations) - -## Quick Start - -This example defines an Amazon EKS cluster with the following configuration: - -* Dedicated VPC with default configuration (Implicitly created using [ec2.Vpc](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#vpc)) -* A Kubernetes pod with a container based on the [paulbouwer/hello-kubernetes](https://github.com/paulbouwer/hello-kubernetes) image. - -```ts -// provisiong a cluster -const cluster = new eks.Cluster(this, 'hello-eks', { - version: eks.KubernetesVersion.V1_25, - kubectlLayer: new KubectlV25Layer(this, 'kubectl'), -}); - -// apply a kubernetes manifest to the cluster -cluster.addManifest('mypod', { - apiVersion: 'v1', - kind: 'Pod', - metadata: { name: 'mypod' }, - spec: { - containers: [ - { - name: 'hello', - image: 'paulbouwer/hello-kubernetes:1.5', - ports: [ { containerPort: 8080 } ], - }, - ], - }, -}); -``` - -In order to interact with your cluster through `kubectl`, you can use the `aws eks update-kubeconfig` [AWS CLI command](https://docs.aws.amazon.com/cli/latest/reference/eks/update-kubeconfig.html) -to configure your local kubeconfig. The EKS module will define a CloudFormation output in your stack which contains the command to run. For example: - -```plaintext -Outputs: -ClusterConfigCommand43AAE40F = aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy -``` - -Execute the `aws eks update-kubeconfig ...` command in your terminal to create or update a local kubeconfig context: - -```console -$ aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy -Added new context arn:aws:eks:rrrrr:112233445566:cluster/cluster-xxxxx to /home/boom/.kube/config -``` - -And now you can simply use `kubectl`: - -```console -$ kubectl get all -n kube-system -NAME READY STATUS RESTARTS AGE -pod/aws-node-fpmwv 1/1 Running 0 21m -pod/aws-node-m9htf 1/1 Running 0 21m -pod/coredns-5cb4fb54c7-q222j 1/1 Running 0 23m -pod/coredns-5cb4fb54c7-v9nxx 1/1 Running 0 23m -... -``` - -## Architectural Overview - -The following is a qualitative diagram of the various possible components involved in the cluster deployment. - -```text - +-----------------------------------------------+ +-----------------+ - | EKS Cluster | kubectl | | - |-----------------------------------------------|<-------------+| Kubectl Handler | - | | | | - | | +-----------------+ - | +--------------------+ +-----------------+ | - | | | | | | - | | Managed Node Group | | Fargate Profile | | +-----------------+ - | | | | | | | | - | +--------------------+ +-----------------+ | | Cluster Handler | - | | | | - +-----------------------------------------------+ +-----------------+ - ^ ^ + - | | | - | connect self managed capacity | | aws-sdk - | | create/update/delete | - + | v - +--------------------+ + +-------------------+ - | | --------------+| eks.amazonaws.com | - | Auto Scaling Group | +-------------------+ - | | - +--------------------+ -``` - -In a nutshell: - -* `EKS Cluster` - The cluster endpoint created by EKS. -* `Managed Node Group` - EC2 worker nodes managed by EKS. -* `Fargate Profile` - Fargate worker nodes managed by EKS. -* `Auto Scaling Group` - EC2 worker nodes managed by the user. -* `KubectlHandler` - Lambda function for invoking `kubectl` commands on the cluster - created by CDK. -* `ClusterHandler` - Lambda function for interacting with EKS API to manage the cluster lifecycle - created by CDK. - -A more detailed breakdown of each is provided further down this README. - -## Provisioning clusters - -Creating a new cluster is done using the `Cluster` or `FargateCluster` constructs. The only required property is the kubernetes `version`. - -```ts -new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, -}); -``` - -You can also use `FargateCluster` to provision a cluster that uses only fargate workers. - -```ts -new eks.FargateCluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, -}); -``` - -> **NOTE: Only 1 cluster per stack is supported.** If you have a use-case for multiple clusters per stack, or would like to understand more about this limitation, see . - -Below you'll find a few important cluster configuration options. First of which is Capacity. -Capacity is the amount and the type of worker nodes that are available to the cluster for deploying resources. Amazon EKS offers 3 ways of configuring capacity, which you can combine as you like: - -### Managed node groups - -Amazon EKS managed node groups automate the provisioning and lifecycle management of nodes (Amazon EC2 instances) for Amazon EKS Kubernetes clusters. -With Amazon EKS managed node groups, you don’t need to separately provision or register the Amazon EC2 instances that provide compute capacity to run your Kubernetes applications. You can create, update, or terminate nodes for your cluster with a single operation. Nodes run using the latest Amazon EKS optimized AMIs in your AWS account while node updates and terminations gracefully drain nodes to ensure that your applications stay available. - -> For more details visit [Amazon EKS Managed Node Groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html). - -**Managed Node Groups are the recommended way to allocate cluster capacity.** - -By default, this library will allocate a managed node group with 2 *m5.large* instances (this instance type suits most common use-cases, and is good value for money). - -At cluster instantiation time, you can customize the number of instances and their type: - -```ts -new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, - defaultCapacity: 5, - defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.SMALL), -}); -``` - -To access the node group that was created on your behalf, you can use `cluster.defaultNodegroup`. - -Additional customizations are available post instantiation. To apply them, set the default capacity to 0, and use the `cluster.addNodegroupCapacity` method: - -```ts -const cluster = new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, - defaultCapacity: 0, -}); - -cluster.addNodegroupCapacity('custom-node-group', { - instanceTypes: [new ec2.InstanceType('m5.large')], - minSize: 4, - diskSize: 100, - amiType: eks.NodegroupAmiType.AL2_X86_64_GPU, -}); -``` - -To set node taints, you can set `taints` option. - -```ts -declare const cluster: eks.Cluster; -cluster.addNodegroupCapacity('custom-node-group', { - instanceTypes: [new ec2.InstanceType('m5.large')], - taints: [ - { - effect: eks.TaintEffect.NO_SCHEDULE, - key: 'foo', - value: 'bar', - }, - ], -}); -``` - -#### Spot Instances Support - -Use `capacityType` to create managed node groups comprised of spot instances. To maximize the availability of your applications while using -Spot Instances, we recommend that you configure a Spot managed node group to use multiple instance types with the `instanceTypes` property. - -> For more details visit [Managed node group capacity types](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types). - - -```ts -declare const cluster: eks.Cluster; -cluster.addNodegroupCapacity('extra-ng-spot', { - instanceTypes: [ - new ec2.InstanceType('c5.large'), - new ec2.InstanceType('c5a.large'), - new ec2.InstanceType('c5d.large'), - ], - minSize: 3, - capacityType: eks.CapacityType.SPOT, -}); - -``` - -#### Launch Template Support - -You can specify a launch template that the node group will use. For example, this can be useful if you want to use -a custom AMI or add custom user data. - -When supplying a custom user data script, it must be encoded in the MIME multi-part archive format, since Amazon EKS merges with its own user data. Visit the [Launch Template Docs](https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html#launch-template-user-data) -for mode details. - -```ts -declare const cluster: eks.Cluster; - -const userData = `MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="==MYBOUNDARY==" - ---==MYBOUNDARY== -Content-Type: text/x-shellscript; charset="us-ascii" - -#!/bin/bash -echo "Running custom user data script" - ---==MYBOUNDARY==--\\ -`; -const lt = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', { - launchTemplateData: { - instanceType: 't3.small', - userData: Fn.base64(userData), - }, -}); - -cluster.addNodegroupCapacity('extra-ng', { - launchTemplateSpec: { - id: lt.ref, - version: lt.attrLatestVersionNumber, - }, -}); - -``` - -Note that when using a custom AMI, Amazon EKS doesn't merge any user data. Which means you do not need the multi-part encoding. and are responsible for supplying the required bootstrap commands for nodes to join the cluster. -In the following example, `/ect/eks/bootstrap.sh` from the AMI will be used to bootstrap the node. - -```ts -declare const cluster: eks.Cluster; -const userData = ec2.UserData.forLinux(); -userData.addCommands( - 'set -o xtrace', - `/etc/eks/bootstrap.sh ${cluster.clusterName}`, -); -const lt = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', { - launchTemplateData: { - imageId: 'some-ami-id', // custom AMI - instanceType: 't3.small', - userData: Fn.base64(userData.render()), - }, -}); -cluster.addNodegroupCapacity('extra-ng', { - launchTemplateSpec: { - id: lt.ref, - version: lt.attrLatestVersionNumber, - }, -}); -``` - -You may specify one `instanceType` in the launch template or multiple `instanceTypes` in the node group, **but not both**. - -> For more details visit [Launch Template Support](https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html). - -Graviton 2 instance types are supported including `c6g`, `m6g`, `r6g` and `t4g`. -Graviton 3 instance types are supported including `c7g`. - -### Fargate profiles - -AWS Fargate is a technology that provides on-demand, right-sized compute -capacity for containers. With AWS Fargate, you no longer have to provision, -configure, or scale groups of virtual machines to run containers. This removes -the need to choose server types, decide when to scale your node groups, or -optimize cluster packing. - -You can control which pods start on Fargate and how they run with Fargate -Profiles, which are defined as part of your Amazon EKS cluster. - -See [Fargate Considerations](https://docs.aws.amazon.com/eks/latest/userguide/fargate.html#fargate-considerations) in the AWS EKS User Guide. - -You can add Fargate Profiles to any EKS cluster defined in your CDK app -through the `addFargateProfile()` method. The following example adds a profile -that will match all pods from the "default" namespace: - -```ts -declare const cluster: eks.Cluster; -cluster.addFargateProfile('MyProfile', { - selectors: [ { namespace: 'default' } ], -}); -``` - -You can also directly use the `FargateProfile` construct to create profiles under different scopes: - -```ts -declare const cluster: eks.Cluster; -new eks.FargateProfile(this, 'MyProfile', { - cluster, - selectors: [ { namespace: 'default' } ], -}); -``` - -To create an EKS cluster that **only** uses Fargate capacity, you can use `FargateCluster`. -The following code defines an Amazon EKS cluster with a default Fargate Profile that matches all pods from the "kube-system" and "default" namespaces. It is also configured to [run CoreDNS on Fargate](https://docs.aws.amazon.com/eks/latest/userguide/fargate-getting-started.html#fargate-gs-coredns). - -```ts -const cluster = new eks.FargateCluster(this, 'MyCluster', { - version: eks.KubernetesVersion.V1_21, -}); -``` - -`FargateCluster` will create a default `FargateProfile` which can be accessed via the cluster's `defaultProfile` property. The created profile can also be customized by passing options as with `addFargateProfile`. - -**NOTE**: Classic Load Balancers and Network Load Balancers are not supported on -pods running on Fargate. For ingress, we recommend that you use the [ALB Ingress -Controller](https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html) -on Amazon EKS (minimum version v1.1.4). - -### Self-managed nodes - -Another way of allocating capacity to an EKS cluster is by using self-managed nodes. -EC2 instances that are part of the auto-scaling group will serve as worker nodes for the cluster. -This type of capacity is also commonly referred to as *EC2 Capacity** or *EC2 Nodes*. - -For a detailed overview please visit [Self Managed Nodes](https://docs.aws.amazon.com/eks/latest/userguide/worker.html). - -Creating an auto-scaling group and connecting it to the cluster is done using the `cluster.addAutoScalingGroupCapacity` method: - -```ts -declare const cluster: eks.Cluster; -cluster.addAutoScalingGroupCapacity('frontend-nodes', { - instanceType: new ec2.InstanceType('t2.medium'), - minCapacity: 3, - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, -}); -``` - -To connect an already initialized auto-scaling group, use the `cluster.connectAutoScalingGroupCapacity()` method: - -```ts -declare const cluster: eks.Cluster; -declare const asg: autoscaling.AutoScalingGroup; -cluster.connectAutoScalingGroupCapacity(asg, {}); -``` - -To connect a self-managed node group to an imported cluster, use the `cluster.connectAutoScalingGroupCapacity()` method: - -```ts -declare const cluster: eks.Cluster; -declare const asg: autoscaling.AutoScalingGroup; -const importedCluster = eks.Cluster.fromClusterAttributes(this, 'ImportedCluster', { - clusterName: cluster.clusterName, - clusterSecurityGroupId: cluster.clusterSecurityGroupId, -}); - -importedCluster.connectAutoScalingGroupCapacity(asg, {}); -``` - -In both cases, the [cluster security group](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html#cluster-sg) will be automatically attached to -the auto-scaling group, allowing for traffic to flow freely between managed and self-managed nodes. - -> **Note:** The default `updateType` for auto-scaling groups does not replace existing nodes. Since security groups are determined at launch time, self-managed nodes that were provisioned with version `1.78.0` or lower, will not be updated. -> To apply the new configuration on all your self-managed nodes, you'll need to replace the nodes using the `UpdateType.REPLACING_UPDATE` policy for the [`updateType`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-autoscaling.AutoScalingGroup.html#updatetypespan-classapi-icon-api-icon-deprecated-titlethis-api-element-is-deprecated-its-use-is-not-recommended%EF%B8%8Fspan) property. - -You can customize the [/etc/eks/boostrap.sh](https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh) script, which is responsible -for bootstrapping the node to the EKS cluster. For example, you can use `kubeletExtraArgs` to add custom node labels or taints. - -```ts -declare const cluster: eks.Cluster; -cluster.addAutoScalingGroupCapacity('spot', { - instanceType: new ec2.InstanceType('t3.large'), - minCapacity: 2, - bootstrapOptions: { - kubeletExtraArgs: '--node-labels foo=bar,goo=far', - awsApiRetryAttempts: 5, - }, -}); -``` - -To disable bootstrapping altogether (i.e. to fully customize user-data), set `bootstrapEnabled` to `false`. -You can also configure the cluster to use an auto-scaling group as the default capacity: - -```ts -const cluster = new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, - defaultCapacityType: eks.DefaultCapacityType.EC2, -}); -``` - -This will allocate an auto-scaling group with 2 *m5.large* instances (this instance type suits most common use-cases, and is good value for money). -To access the `AutoScalingGroup` that was created on your behalf, you can use `cluster.defaultCapacity`. -You can also independently create an `AutoScalingGroup` and connect it to the cluster using the `cluster.connectAutoScalingGroupCapacity` method: - -```ts -declare const cluster: eks.Cluster; -declare const asg: autoscaling.AutoScalingGroup; -cluster.connectAutoScalingGroupCapacity(asg, {}); -``` - -This will add the necessary user-data to access the apiserver and configure all connections, roles, and tags needed for the instances in the auto-scaling group to properly join the cluster. - -#### Spot Instances - -When using self-managed nodes, you can configure the capacity to use spot instances, greatly reducing capacity cost. -To enable spot capacity, use the `spotPrice` property: - -```ts -declare const cluster: eks.Cluster; -cluster.addAutoScalingGroupCapacity('spot', { - spotPrice: '0.1094', - instanceType: new ec2.InstanceType('t3.large'), - maxCapacity: 10, -}); -``` - -> Spot instance nodes will be labeled with `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. - -The [AWS Node Termination Handler](https://github.com/aws/aws-node-termination-handler) `DaemonSet` will be -installed from [Amazon EKS Helm chart repository](https://github.com/aws/eks-charts/tree/master/stable/aws-node-termination-handler) on these nodes. -The termination handler ensures that the Kubernetes control plane responds appropriately to events that -can cause your EC2 instance to become unavailable, such as [EC2 maintenance events](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html) -and [EC2 Spot interruptions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html) and helps gracefully stop all pods running on spot nodes that are about to be -terminated. - -> Handler Version: [1.7.0](https://github.com/aws/aws-node-termination-handler/releases/tag/v1.7.0) -> -> Chart Version: [0.9.5](https://github.com/aws/eks-charts/blob/v0.0.28/stable/aws-node-termination-handler/Chart.yaml) - -To disable the installation of the termination handler, set the `spotInterruptHandler` property to `false`. This applies both to `addAutoScalingGroupCapacity` and `connectAutoScalingGroupCapacity`. - -#### Bottlerocket - -[Bottlerocket](https://aws.amazon.com/bottlerocket/) is a Linux-based open-source operating system that is purpose-built by Amazon Web Services for running containers on virtual machines or bare metal hosts. - -`Bottlerocket` is supported when using managed nodegroups or self-managed auto-scaling groups. - -To create a Bottlerocket managed nodegroup: - -```ts -declare const cluster: eks.Cluster; -cluster.addNodegroupCapacity('BottlerocketNG', { - amiType: eks.NodegroupAmiType.BOTTLEROCKET_X86_64, -}); -``` - -The following example will create an auto-scaling group of 2 `t3.small` Linux instances running with the `Bottlerocket` AMI. - -```ts -declare const cluster: eks.Cluster; -cluster.addAutoScalingGroupCapacity('BottlerocketNodes', { - instanceType: new ec2.InstanceType('t3.small'), - minCapacity: 2, - machineImageType: eks.MachineImageType.BOTTLEROCKET, -}); -``` - -The specific Bottlerocket AMI variant will be auto selected according to the k8s version for the `x86_64` architecture. -For example, if the Amazon EKS cluster version is `1.17`, the Bottlerocket AMI variant will be auto selected as -`aws-k8s-1.17` behind the scene. - -> See [Variants](https://github.com/bottlerocket-os/bottlerocket/blob/develop/README.md#variants) for more details. - -Please note Bottlerocket does not allow to customize bootstrap options and `bootstrapOptions` properties is not supported when you create the `Bottlerocket` capacity. - -For more details about Bottlerocket, see [Bottlerocket FAQs](https://aws.amazon.com/bottlerocket/faqs/) and [Bottlerocket Open Source Blog](https://aws.amazon.com/blogs/opensource/announcing-the-general-availability-of-bottlerocket-an-open-source-linux-distribution-purpose-built-to-run-containers/). - -### Endpoint Access - -When you create a new cluster, Amazon EKS creates an endpoint for the managed Kubernetes API server that you use to communicate with your cluster (using Kubernetes management tools such as `kubectl`) - -By default, this API server endpoint is public to the internet, and access to the API server is secured using a combination of -AWS Identity and Access Management (IAM) and native Kubernetes [Role Based Access Control](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) (RBAC). - -You can configure the [cluster endpoint access](https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html) by using the `endpointAccess` property: - -```ts -const cluster = new eks.Cluster(this, 'hello-eks', { - version: eks.KubernetesVersion.V1_21, - endpointAccess: eks.EndpointAccess.PRIVATE, // No access outside of your VPC. -}); -``` - -The default value is `eks.EndpointAccess.PUBLIC_AND_PRIVATE`. Which means the cluster endpoint is accessible from outside of your VPC, but worker node traffic and `kubectl` commands issued by this library stay within your VPC. - -### Alb Controller - -Some Kubernetes resources are commonly implemented on AWS with the help of the [ALB Controller](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.3/). - -From the docs: - -> AWS Load Balancer Controller is a controller to help manage Elastic Load Balancers for a Kubernetes cluster. -> -> * It satisfies Kubernetes Ingress resources by provisioning Application Load Balancers. -> * It satisfies Kubernetes Service resources by provisioning Network Load Balancers. - -To deploy the controller on your EKS cluster, configure the `albController` property: - -```ts -new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, - albController: { - version: eks.AlbControllerVersion.V2_4_1, - }, -}); -``` - -Querying the controller pods should look something like this: - -```console -❯ kubectl get pods -n kube-system -NAME READY STATUS RESTARTS AGE -aws-load-balancer-controller-76bd6c7586-d929p 1/1 Running 0 109m -aws-load-balancer-controller-76bd6c7586-fqxph 1/1 Running 0 109m -... -... -``` - -Every Kubernetes manifest that utilizes the ALB Controller is effectively dependant on the controller. -If the controller is deleted before the manifest, it might result in dangling ELB/ALB resources. -Currently, the EKS construct library does not detect such dependencies, and they should be done explicitly. - -For example: - -```ts -declare const cluster: eks.Cluster; -const manifest = cluster.addManifest('manifest', {/* ... */}); -if (cluster.albController) { - manifest.node.addDependency(cluster.albController); -} -``` - -### VPC Support - -You can specify the VPC of the cluster using the `vpc` and `vpcSubnets` properties: - -```ts -declare const vpc: ec2.Vpc; - -new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, - vpc, - vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }], -}); -``` - -> Note: Isolated VPCs (i.e with no internet access) are not currently supported. See https://github.com/aws/aws-cdk/issues/12171 - -If you do not specify a VPC, one will be created on your behalf, which you can then access via `cluster.vpc`. The cluster VPC will be associated to any EKS managed capacity (i.e Managed Node Groups and Fargate Profiles). - -Please note that the `vpcSubnets` property defines the subnets where EKS will place the _control plane_ ENIs. To choose -the subnets where EKS will place the worker nodes, please refer to the **Provisioning clusters** section above. - -If you allocate self managed capacity, you can specify which subnets should the auto-scaling group use: - -```ts -declare const vpc: ec2.Vpc; -declare const cluster: eks.Cluster; -cluster.addAutoScalingGroupCapacity('nodes', { - vpcSubnets: { subnets: vpc.privateSubnets }, - instanceType: new ec2.InstanceType('t2.medium'), -}); -``` - -There are two additional components you might want to provision within the VPC. - -#### Kubectl Handler - -The `KubectlHandler` is a Lambda function responsible to issuing `kubectl` and `helm` commands against the cluster when you add resource manifests to the cluster. - -The handler association to the VPC is derived from the `endpointAccess` configuration. The rule of thumb is: *If the cluster VPC can be associated, it will be*. - -Breaking this down, it means that if the endpoint exposes private access (via `EndpointAccess.PRIVATE` or `EndpointAccess.PUBLIC_AND_PRIVATE`), and the VPC contains **private** subnets, the Lambda function will be provisioned inside the VPC and use the private subnets to interact with the cluster. This is the common use-case. - -If the endpoint does not expose private access (via `EndpointAccess.PUBLIC`) **or** the VPC does not contain private subnets, the function will not be provisioned within the VPC. - -If your use-case requires control over the IAM role that the KubeCtl Handler assumes, a custom role can be passed through the ClusterProps (as `kubectlLambdaRole`) of the EKS Cluster construct. - -#### Cluster Handler - -The `ClusterHandler` is a set of Lambda functions (`onEventHandler`, `isCompleteHandler`) responsible for interacting with the EKS API in order to control the cluster lifecycle. To provision these functions inside the VPC, set the `placeClusterHandlerInVpc` property to `true`. This will place the functions inside the private subnets of the VPC based on the selection strategy specified in the [`vpcSubnets`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-eks.Cluster.html#vpcsubnetsspan-classapi-icon-api-icon-experimental-titlethis-api-element-is-experimental-it-may-change-without-noticespan) property. - -You can configure the environment of the Cluster Handler functions by specifying it at cluster instantiation. For example, this can be useful in order to configure an http proxy: - -```ts -declare const proxyInstanceSecurityGroup: ec2.SecurityGroup; -const cluster = new eks.Cluster(this, 'hello-eks', { - version: eks.KubernetesVersion.V1_21, - clusterHandlerEnvironment: { - https_proxy: 'http://proxy.myproxy.com', - }, - /** - * If the proxy is not open publicly, you can pass a security group to the - * Cluster Handler Lambdas so that it can reach the proxy. - */ - clusterHandlerSecurityGroup: proxyInstanceSecurityGroup, -}); -``` - -### Kubectl Support - -The resources are created in the cluster by running `kubectl apply` from a python lambda function. - -By default, CDK will create a new python lambda function to apply your k8s manifests. If you want to use an existing kubectl provider function, for example with tight trusted entities on your IAM Roles - you can import the existing provider and then use the imported provider when importing the cluster: - -```ts -const handlerRole = iam.Role.fromRoleArn(this, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); -const kubectlProvider = eks.KubectlProvider.fromKubectlProviderAttributes(this, 'KubectlProvider', { - functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', - kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', - handlerRole, -}); - -const cluster = eks.Cluster.fromClusterAttributes(this, 'Cluster', { - clusterName: 'cluster', - kubectlProvider, -}); -``` - -#### Environment - -You can configure the environment of this function by specifying it at cluster instantiation. For example, this can be useful in order to configure an http proxy: - -```ts -const cluster = new eks.Cluster(this, 'hello-eks', { - version: eks.KubernetesVersion.V1_21, - kubectlEnvironment: { - 'http_proxy': 'http://proxy.myproxy.com', - }, -}); -``` - -#### Runtime - -The kubectl handler uses `kubectl`, `helm` and the `aws` CLI in order to -interact with the cluster. These are bundled into AWS Lambda layers included in -the `@aws-cdk/lambda-layer-awscli` and `@aws-cdk/lambda-layer-kubectl` modules. - -The version of kubectl used must be compatible with the Kubernetes version of the -cluster. kubectl is supported within one minor version (older or newer) of Kubernetes -(see [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/#kubectl)). -Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a different -version, you will need to use one of the `@aws-cdk/lambda-layer-kubectl-vXY` packages. - -```ts -import { KubectlV25Layer } from '@aws-cdk/lambda-layer-kubectl-v25'; - -const cluster = new eks.Cluster(this, 'hello-eks', { - version: eks.KubernetesVersion.V1_25, - kubectlLayer: new KubectlV25Layer(this, 'kubectl'), -}); -``` - -You can also specify a custom `lambda.LayerVersion` if you wish to use a -different version of these tools, or a version not available in any of the -`@aws-cdk/lambda-layer-kubectl-vXY` packages. The handler expects the layer to -include the following two executables: - -```text -helm/helm -kubectl/kubectl -``` - -See more information in the -[Dockerfile](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/lambda-layer-awscli/layer) for @aws-cdk/lambda-layer-awscli -and the -[Dockerfile](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/lambda-layer-kubectl/layer) for @aws-cdk/lambda-layer-kubectl. - -```ts -const layer = new lambda.LayerVersion(this, 'KubectlLayer', { - code: lambda.Code.fromAsset('layer.zip'), -}); -``` - -Now specify when the cluster is defined: - -```ts -declare const layer: lambda.LayerVersion; -declare const vpc: ec2.Vpc; - -const cluster1 = new eks.Cluster(this, 'MyCluster', { - kubectlLayer: layer, - vpc, - clusterName: 'cluster-name', - version: eks.KubernetesVersion.V1_21, -}); - -// or -const cluster2 = eks.Cluster.fromClusterAttributes(this, 'MyCluster', { - kubectlLayer: layer, - vpc, - clusterName: 'cluster-name', -}); -``` - -#### Memory - -By default, the kubectl provider is configured with 1024MiB of memory. You can use the `kubectlMemory` option to specify the memory size for the AWS Lambda function: - -```ts -new eks.Cluster(this, 'MyCluster', { - kubectlMemory: Size.gibibytes(4), - version: eks.KubernetesVersion.V1_21, -}); - -// or -declare const vpc: ec2.Vpc; -eks.Cluster.fromClusterAttributes(this, 'MyCluster', { - kubectlMemory: Size.gibibytes(4), - vpc, - clusterName: 'cluster-name', -}); -``` - -### ARM64 Support - -Instance types with `ARM64` architecture are supported in both managed nodegroup and self-managed capacity. Simply specify an ARM64 `instanceType` (such as `m6g.medium`), and the latest -Amazon Linux 2 AMI for ARM64 will be automatically selected. - -```ts -declare const cluster: eks.Cluster; -// add a managed ARM64 nodegroup -cluster.addNodegroupCapacity('extra-ng-arm', { - instanceTypes: [new ec2.InstanceType('m6g.medium')], - minSize: 2, -}); - -// add a self-managed ARM64 nodegroup -cluster.addAutoScalingGroupCapacity('self-ng-arm', { - instanceType: new ec2.InstanceType('m6g.medium'), - minCapacity: 2, -}) -``` - -### Masters Role - -When you create a cluster, you can specify a `mastersRole`. The `Cluster` construct will associate this role with the `system:masters` [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) group, giving it super-user access to the cluster. - -```ts -declare const role: iam.Role; -new eks.Cluster(this, 'HelloEKS', { - version: eks.KubernetesVersion.V1_21, - mastersRole: role, -}); -``` - -If you do not specify it, a default role will be created on your behalf, that can be assumed by anyone in the account with `sts:AssumeRole` permissions for this role. - -This is the role you see as part of the stack outputs mentioned in the [Quick Start](#quick-start). - -```console -$ aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy -Added new context arn:aws:eks:rrrrr:112233445566:cluster/cluster-xxxxx to /home/boom/.kube/config -``` - -### Encryption - -When you create an Amazon EKS cluster, envelope encryption of Kubernetes secrets using the AWS Key Management Service (AWS KMS) can be enabled. -The documentation on [creating a cluster](https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html) -can provide more details about the customer master key (CMK) that can be used for the encryption. - -You can use the `secretsEncryptionKey` to configure which key the cluster will use to encrypt Kubernetes secrets. By default, an AWS Managed key will be used. - -> This setting can only be specified when the cluster is created and cannot be updated. - -```ts -const secretsKey = new kms.Key(this, 'SecretsKey'); -const cluster = new eks.Cluster(this, 'MyCluster', { - secretsEncryptionKey: secretsKey, - version: eks.KubernetesVersion.V1_21, -}); -``` - -You can also use a similar configuration for running a cluster built using the FargateCluster construct. - -```ts -const secretsKey = new kms.Key(this, 'SecretsKey'); -const cluster = new eks.FargateCluster(this, 'MyFargateCluster', { - secretsEncryptionKey: secretsKey, - version: eks.KubernetesVersion.V1_21, -}); -``` - -The Amazon Resource Name (ARN) for that CMK can be retrieved. - -```ts -declare const cluster: eks.Cluster; -const clusterEncryptionConfigKeyArn = cluster.clusterEncryptionConfigKeyArn; -``` - -## Permissions and Security - -Amazon EKS provides several mechanism of securing the cluster and granting permissions to specific IAM users and roles. - -### AWS IAM Mapping - -As described in the [Amazon EKS User Guide](https://docs.aws.amazon.com/en_us/eks/latest/userguide/add-user-role.html), you can map AWS IAM users and roles to [Kubernetes Role-based access control (RBAC)](https://kubernetes.io/docs/reference/access-authn-authz/rbac). - -The Amazon EKS construct manages the *aws-auth* `ConfigMap` Kubernetes resource on your behalf and exposes an API through the `cluster.awsAuth` for mapping -users, roles and accounts. - -Furthermore, when auto-scaling group capacity is added to the cluster, the IAM instance role of the auto-scaling group will be automatically mapped to RBAC so nodes can connect to the cluster. No manual mapping is required. - -For example, let's say you want to grant an IAM user administrative privileges on your cluster: - -```ts -declare const cluster: eks.Cluster; -const adminUser = new iam.User(this, 'Admin'); -cluster.awsAuth.addUserMapping(adminUser, { groups: [ 'system:masters' ]}); -``` - -A convenience method for mapping a role to the `system:masters` group is also available: - -```ts -declare const cluster: eks.Cluster; -declare const role: iam.Role; -cluster.awsAuth.addMastersRole(role); -``` - -### Cluster Security Group - -When you create an Amazon EKS cluster, a [cluster security group](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html) -is automatically created as well. This security group is designed to allow all traffic from the control plane and managed node groups to flow freely -between each other. - -The ID for that security group can be retrieved after creating the cluster. - -```ts -declare const cluster: eks.Cluster; -const clusterSecurityGroupId = cluster.clusterSecurityGroupId; -``` - -### Node SSH Access - -If you want to be able to SSH into your worker nodes, you must already have an SSH key in the region you're connecting to and pass it when -you add capacity to the cluster. You must also be able to connect to the hosts (meaning they must have a public IP and you -should be allowed to connect to them on port 22): - -See [SSH into nodes](test/example.ssh-into-nodes.lit.ts) for a code example. - -If you want to SSH into nodes in a private subnet, you should set up a bastion host in a public subnet. That setup is recommended, but is -unfortunately beyond the scope of this documentation. - -### Service Accounts - -With services account you can provide Kubernetes Pods access to AWS resources. - -```ts -declare const cluster: eks.Cluster; -// add service account -const serviceAccount = cluster.addServiceAccount('MyServiceAccount'); - -const bucket = new s3.Bucket(this, 'Bucket'); -bucket.grantReadWrite(serviceAccount); - -const mypod = cluster.addManifest('mypod', { - apiVersion: 'v1', - kind: 'Pod', - metadata: { name: 'mypod' }, - spec: { - serviceAccountName: serviceAccount.serviceAccountName, - containers: [ - { - name: 'hello', - image: 'paulbouwer/hello-kubernetes:1.5', - ports: [ { containerPort: 8080 } ], - }, - ], - }, -}); - -// create the resource after the service account. -mypod.node.addDependency(serviceAccount); - -// print the IAM role arn for this service account -new CfnOutput(this, 'ServiceAccountIamRole', { value: serviceAccount.role.roleArn }); -``` - -Note that using `serviceAccount.serviceAccountName` above **does not** translate into a resource dependency. -This is why an explicit dependency is needed. See for more details. - -It is possible to pass annotations and labels to the service account. - -```ts -declare const cluster: eks.Cluster; -// add service account with annotations and labels -const serviceAccount = cluster.addServiceAccount('MyServiceAccount', { - annotations: { - 'eks.amazonaws.com/sts-regional-endpoints': 'false', - }, - labels: { - 'some-label': 'with-some-value', - }, -}); -``` - -You can also add service accounts to existing clusters. -To do so, pass the `openIdConnectProvider` property when you import the cluster into the application. - -```ts -// you can import an existing provider -const provider = eks.OpenIdConnectProvider.fromOpenIdConnectProviderArn(this, 'Provider', 'arn:aws:iam::123456:oidc-provider/oidc.eks.eu-west-1.amazonaws.com/id/AB123456ABC'); - -// or create a new one using an existing issuer url -declare const issuerUrl: string; -const provider2 = new eks.OpenIdConnectProvider(this, 'Provider', { - url: issuerUrl, -}); - -const cluster = eks.Cluster.fromClusterAttributes(this, 'MyCluster', { - clusterName: 'Cluster', - openIdConnectProvider: provider, - kubectlRoleArn: 'arn:aws:iam::123456:role/service-role/k8sservicerole', -}); - -const serviceAccount = cluster.addServiceAccount('MyServiceAccount'); - -const bucket = new s3.Bucket(this, 'Bucket'); -bucket.grantReadWrite(serviceAccount); -``` - -Note that adding service accounts requires running `kubectl` commands against the cluster. -This means you must also pass the `kubectlRoleArn` when importing the cluster. -See [Using existing Clusters](https://github.com/aws/aws-cdk/tree/main/packages/@aws-cdk/aws-eks#using-existing-clusters). - -## Applying Kubernetes Resources - -The library supports several popular resource deployment mechanisms, among which are: - -### Kubernetes Manifests - -The `KubernetesManifest` construct or `cluster.addManifest` method can be used -to apply Kubernetes resource manifests to this cluster. - -> When using `cluster.addManifest`, the manifest construct is defined within the cluster's stack scope. If the manifest contains -> attributes from a different stack which depend on the cluster stack, a circular dependency will be created and you will get a synth time error. -> To avoid this, directly use `new KubernetesManifest` to create the manifest in the scope of the other stack. - -The following examples will deploy the [paulbouwer/hello-kubernetes](https://github.com/paulbouwer/hello-kubernetes) -service on the cluster: - -```ts -declare const cluster: eks.Cluster; -const appLabel = { app: "hello-kubernetes" }; - -const deployment = { - apiVersion: "apps/v1", - kind: "Deployment", - metadata: { name: "hello-kubernetes" }, - spec: { - replicas: 3, - selector: { matchLabels: appLabel }, - template: { - metadata: { labels: appLabel }, - spec: { - containers: [ - { - name: "hello-kubernetes", - image: "paulbouwer/hello-kubernetes:1.5", - ports: [ { containerPort: 8080 } ], - }, - ], - }, - }, - }, -}; - -const service = { - apiVersion: "v1", - kind: "Service", - metadata: { name: "hello-kubernetes" }, - spec: { - type: "LoadBalancer", - ports: [ { port: 80, targetPort: 8080 } ], - selector: appLabel, - } -}; - -// option 1: use a construct -new eks.KubernetesManifest(this, 'hello-kub', { - cluster, - manifest: [ deployment, service ], -}); - -// or, option2: use `addManifest` -cluster.addManifest('hello-kub', service, deployment); -``` - -#### ALB Controller Integration - -The `KubernetesManifest` construct can detect ingress resources inside your manifest and automatically add the necessary annotations -so they are picked up by the ALB Controller. - -> See [Alb Controller](#alb-controller) - -To that end, it offers the following properties: - -* `ingressAlb` - Signal that the ingress detection should be done. -* `ingressAlbScheme` - Which ALB scheme should be applied. Defaults to `internal`. - -#### Adding resources from a URL - -The following example will deploy the resource manifest hosting on remote server: - -```text -// This example is only available in TypeScript - -import * as yaml from 'js-yaml'; -import * as request from 'sync-request'; - -declare const cluster: eks.Cluster; -const manifestUrl = 'https://url/of/manifest.yaml'; -const manifest = yaml.safeLoadAll(request('GET', manifestUrl).getBody()); -cluster.addManifest('my-resource', manifest); -``` - -#### Dependencies - -There are cases where Kubernetes resources must be deployed in a specific order. -For example, you cannot define a resource in a Kubernetes namespace before the -namespace was created. - -You can represent dependencies between `KubernetesManifest`s using -`resource.node.addDependency()`: - -```ts -declare const cluster: eks.Cluster; -const namespace = cluster.addManifest('my-namespace', { - apiVersion: 'v1', - kind: 'Namespace', - metadata: { name: 'my-app' }, -}); - -const service = cluster.addManifest('my-service', { - metadata: { - name: 'myservice', - namespace: 'my-app', - }, - spec: { }, // ... -}); - -service.node.addDependency(namespace); // will apply `my-namespace` before `my-service`. -``` - -**NOTE:** when a `KubernetesManifest` includes multiple resources (either directly -or through `cluster.addManifest()`) (e.g. `cluster.addManifest('foo', r1, r2, -r3,...)`), these resources will be applied as a single manifest via `kubectl` -and will be applied sequentially (the standard behavior in `kubectl`). - ---- - -Since Kubernetes manifests are implemented as CloudFormation resources in the -CDK. This means that if the manifest is deleted from your code (or the stack is -deleted), the next `cdk deploy` will issue a `kubectl delete` command and the -Kubernetes resources in that manifest will be deleted. - -#### Resource Pruning - -When a resource is deleted from a Kubernetes manifest, the EKS module will -automatically delete these resources by injecting a _prune label_ to all -manifest resources. This label is then passed to [`kubectl apply --prune`]. - -[`kubectl apply --prune`]: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/#alternative-kubectl-apply-f-directory-prune-l-your-label - -Pruning is enabled by default but can be disabled through the `prune` option -when a cluster is defined: - -```ts -new eks.Cluster(this, 'MyCluster', { - version: eks.KubernetesVersion.V1_21, - prune: false, -}); -``` - -#### Manifests Validation - -The `kubectl` CLI supports applying a manifest by skipping the validation. -This can be accomplished by setting the `skipValidation` flag to `true` in the `KubernetesManifest` props. - -```ts -declare const cluster: eks.Cluster; -new eks.KubernetesManifest(this, 'HelloAppWithoutValidation', { - cluster, - manifest: [{ foo: 'bar' }], - skipValidation: true, -}); -``` - -### Helm Charts - -The `HelmChart` construct or `cluster.addHelmChart` method can be used -to add Kubernetes resources to this cluster using Helm. - -> When using `cluster.addHelmChart`, the manifest construct is defined within the cluster's stack scope. If the manifest contains -> attributes from a different stack which depend on the cluster stack, a circular dependency will be created and you will get a synth time error. -> To avoid this, directly use `new HelmChart` to create the chart in the scope of the other stack. - -The following example will install the [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx/) to your cluster using Helm. - -```ts -declare const cluster: eks.Cluster; -// option 1: use a construct -new eks.HelmChart(this, 'NginxIngress', { - cluster, - chart: 'nginx-ingress', - repository: 'https://helm.nginx.com/stable', - namespace: 'kube-system', -}); - -// or, option2: use `addHelmChart` -cluster.addHelmChart('NginxIngress', { - chart: 'nginx-ingress', - repository: 'https://helm.nginx.com/stable', - namespace: 'kube-system', -}); -``` - -Helm charts will be installed and updated using `helm upgrade --install`, where a few parameters -are being passed down (such as `repo`, `values`, `version`, `namespace`, `wait`, `timeout`, etc). -This means that if the chart is added to CDK with the same release name, it will try to update -the chart in the cluster. - -Additionally, the `chartAsset` property can be an `aws-s3-assets.Asset`. This allows the use of local, private helm charts. - -```ts -import * as s3Assets from '@aws-cdk/aws-s3-assets'; - -declare const cluster: eks.Cluster; -const chartAsset = new s3Assets.Asset(this, 'ChartAsset', { - path: '/path/to/asset' -}); - -cluster.addHelmChart('test-chart', { - chartAsset: chartAsset, -}); -``` - -Nested values passed to the `values` parameter should be provided as a nested dictionary: - -```ts -cluster.addHelmChart('ExternalSecretsOperator', { - chart: 'external-secrets', - release: 'external-secrets', - repository: 'https://charts.external-secrets.io', - namespace: 'external-secrets', - values: { - installCRDs: true, - webhook: { - port: 9443 - } - }, -}); -``` - -Helm chart can come with Custom Resource Definitions (CRDs) defined that by default will be installed by helm as well. However in special cases it might be needed to skip the installation of CRDs, for that the property `skipCrds` can be used. - -```ts -declare const cluster: eks.Cluster; -// option 1: use a construct -new eks.HelmChart(this, 'NginxIngress', { - cluster, - chart: 'nginx-ingress', - repository: 'https://helm.nginx.com/stable', - namespace: 'kube-system', - skipCrds: true, -}); -``` - -### OCI Charts - -OCI charts are also supported. -Also replace the `${VARS}` with appropriate values. - -```ts -declare const cluster: eks.Cluster; -// option 1: use a construct -new eks.HelmChart(this, 'MyOCIChart', { - cluster, - chart: 'some-chart', - repository: 'oci://${ACCOUNT_ID}.dkr.ecr.${ACCOUNT_REGION}.amazonaws.com/${REPO_NAME}', - namespace: 'oci', - version: '0.0.1' -}); - -``` - -Helm charts are implemented as CloudFormation resources in CDK. -This means that if the chart is deleted from your code (or the stack is -deleted), the next `cdk deploy` will issue a `helm uninstall` command and the -Helm chart will be deleted. - -When there is no `release` defined, a unique ID will be allocated for the release based -on the construct path. - -By default, all Helm charts will be installed concurrently. In some cases, this -could cause race conditions where two Helm charts attempt to deploy the same -resource or if Helm charts depend on each other. You can use -`chart.node.addDependency()` in order to declare a dependency order between -charts: - -```ts -declare const cluster: eks.Cluster; -const chart1 = cluster.addHelmChart('MyChart', { - chart: 'foo', -}); -const chart2 = cluster.addHelmChart('MyChart', { - chart: 'bar', -}); - -chart2.node.addDependency(chart1); -``` - -### CDK8s Charts - -[CDK8s](https://cdk8s.io/) is an open-source library that enables Kubernetes manifest authoring using familiar programming languages. It is founded on the same technologies as the AWS CDK, such as [`constructs`](https://github.com/aws/constructs) and [`jsii`](https://github.com/aws/jsii). - -> To learn more about cdk8s, visit the [Getting Started](https://cdk8s.io/docs/latest/getting-started/) tutorials. - -The EKS module natively integrates with cdk8s and allows you to apply cdk8s charts on AWS EKS clusters via the `cluster.addCdk8sChart` method. - -In addition to `cdk8s`, you can also use [`cdk8s+`](https://cdk8s.io/docs/latest/plus/), which provides higher level abstraction for the core kubernetes api objects. -You can think of it like the `L2` constructs for Kubernetes. Any other `cdk8s` based libraries are also supported, for example [`cdk8s-debore`](https://github.com/toricls/cdk8s-debore). - -To get started, add the following dependencies to your `package.json` file: - -```json -"dependencies": { - "cdk8s": "^2.0.0", - "cdk8s-plus-22": "^2.0.0-rc.30", - "constructs": "^10.0.0" -} -``` - -Note that here we are using `cdk8s-plus-22` as we are targeting Kubernetes version 1.22.0. If you operate a different kubernetes version, you should -use the corresponding `cdk8s-plus-XX` library. -See [Select the appropriate cdk8s+ library](https://cdk8s.io/docs/latest/plus/#i-operate-kubernetes-version-1xx-which-cdk8s-library-should-i-be-using) -for more details. - -Similarly to how you would create a stack by extending `aws-cdk-lib.Stack`, we recommend you create a chart of your own that extends `cdk8s.Chart`, -and add your kubernetes resources to it. You can use `aws-cdk` construct attributes and properties inside your `cdk8s` construct freely. - -In this example we create a chart that accepts an `s3.Bucket` and passes its name to a kubernetes pod as an environment variable. - -`+ my-chart.ts` - -```ts nofixture -import { aws_s3 as s3 } from 'aws-cdk-lib'; -import * as constructs from 'constructs'; -import * as cdk8s from 'cdk8s'; -import * as kplus from 'cdk8s-plus-22'; - -export interface MyChartProps { - readonly bucket: s3.Bucket; -} - -export class MyChart extends cdk8s.Chart { - constructor(scope: constructs.Construct, id: string, props: MyChartProps) { - super(scope, id); - - new kplus.Pod(this, 'Pod', { - containers: [ - { - image: 'my-image', - env: { - BUCKET_NAME: kplus.EnvValue.fromValue(props.bucket.bucketName), - }, - } - ], - }); - } -} -``` - -Then, in your AWS CDK app: - -```ts fixture=cdk8schart -declare const cluster: eks.Cluster; - -// some bucket.. -const bucket = new s3.Bucket(this, 'Bucket'); - -// create a cdk8s chart and use `cdk8s.App` as the scope. -const myChart = new MyChart(new cdk8s.App(), 'MyChart', { bucket }); - -// add the cdk8s chart to the cluster -cluster.addCdk8sChart('my-chart', myChart); -``` - -#### Custom CDK8s Constructs - -You can also compose a few stock `cdk8s+` constructs into your own custom construct. However, since mixing scopes between `aws-cdk` and `cdk8s` is currently not supported, the `Construct` class -you'll need to use is the one from the [`constructs`](https://github.com/aws/constructs) module, and not from `@aws-cdk/core` like you normally would. -This is why we used `new cdk8s.App()` as the scope of the chart above. - -```ts nofixture -import * as constructs from 'constructs'; -import * as cdk8s from 'cdk8s'; -import * as kplus from 'cdk8s-plus-21'; - -export interface LoadBalancedWebService { - readonly port: number; - readonly image: string; - readonly replicas: number; -} - -const app = new cdk8s.App(); -const chart = new cdk8s.Chart(app, 'my-chart'); - -export class LoadBalancedWebService extends constructs.Construct { - constructor(scope: constructs.Construct, id: string, props: LoadBalancedWebService) { - super(scope, id); - - const deployment = new kplus.Deployment(chart, 'Deployment', { - replicas: props.replicas, - containers: [ new kplus.Container({ image: props.image }) ], - }); - - deployment.exposeViaService({ - port: props.port, - serviceType: kplus.ServiceType.LOAD_BALANCER, - }); - } -} -``` - -#### Manually importing k8s specs and CRD's - -If you find yourself unable to use `cdk8s+`, or just like to directly use the `k8s` native objects or CRD's, you can do so by manually importing them using the `cdk8s-cli`. - -See [Importing kubernetes objects](https://cdk8s.io/docs/latest/cli/import/) for detailed instructions. - -## Patching Kubernetes Resources - -The `KubernetesPatch` construct can be used to update existing kubernetes -resources. The following example can be used to patch the `hello-kubernetes` -deployment from the example above with 5 replicas. - -```ts -declare const cluster: eks.Cluster; -new eks.KubernetesPatch(this, 'hello-kub-deployment-label', { - cluster, - resourceName: "deployment/hello-kubernetes", - applyPatch: { spec: { replicas: 5 } }, - restorePatch: { spec: { replicas: 3 } }, -}) -``` - -## Querying Kubernetes Resources - -The `KubernetesObjectValue` construct can be used to query for information about kubernetes objects, -and use that as part of your CDK application. - -For example, you can fetch the address of a [`LoadBalancer`](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) type service: - -```ts -declare const cluster: eks.Cluster; -// query the load balancer address -const myServiceAddress = new eks.KubernetesObjectValue(this, 'LoadBalancerAttribute', { - cluster: cluster, - objectType: 'service', - objectName: 'my-service', - jsonPath: '.status.loadBalancer.ingress[0].hostname', // https://kubernetes.io/docs/reference/kubectl/jsonpath/ -}); - -// pass the address to a lambda function -const proxyFunction = new lambda.Function(this, 'ProxyFunction', { - handler: 'index.handler', - code: lambda.Code.fromInline('my-code'), - runtime: lambda.Runtime.NODEJS_14_X, - environment: { - myServiceAddress: myServiceAddress.value, - }, -}) -``` - -Specifically, since the above use-case is quite common, there is an easier way to access that information: - -```ts -declare const cluster: eks.Cluster; -const loadBalancerAddress = cluster.getServiceLoadBalancerAddress('my-service'); -``` - -## Using existing clusters - -The Amazon EKS library allows defining Kubernetes resources such as [Kubernetes -manifests](#kubernetes-resources) and [Helm charts](#helm-charts) on clusters -that are not defined as part of your CDK app. - -First, you'll need to "import" a cluster to your CDK app. To do that, use the -`eks.Cluster.fromClusterAttributes()` static method: - -```ts -const cluster = eks.Cluster.fromClusterAttributes(this, 'MyCluster', { - clusterName: 'my-cluster-name', - kubectlRoleArn: 'arn:aws:iam::1111111:role/iam-role-that-has-masters-access', -}); -``` - -Then, you can use `addManifest` or `addHelmChart` to define resources inside -your Kubernetes cluster. For example: - -```ts -declare const cluster: eks.Cluster; -cluster.addManifest('Test', { - apiVersion: 'v1', - kind: 'ConfigMap', - metadata: { - name: 'myconfigmap', - }, - data: { - Key: 'value', - Another: '123454', - }, -}); -``` - -At the minimum, when importing clusters for `kubectl` management, you will need -to specify: - -* `clusterName` - the name of the cluster. -* `kubectlRoleArn` - the ARN of an IAM role mapped to the `system:masters` RBAC - role. If the cluster you are importing was created using the AWS CDK, the - CloudFormation stack has an output that includes an IAM role that can be used. - Otherwise, you can create an IAM role and map it to `system:masters` manually. - The trust policy of this role should include the the - `arn:aws::iam::${accountId}:root` principal in order to allow the execution - role of the kubectl resource to assume it. - -If the cluster is configured with private-only or private and restricted public -Kubernetes [endpoint access](#endpoint-access), you must also specify: - -* `kubectlSecurityGroupId` - the ID of an EC2 security group that is allowed - connections to the cluster's control security group. For example, the EKS managed [cluster security group](#cluster-security-group). -* `kubectlPrivateSubnetIds` - a list of private VPC subnets IDs that will be used - to access the Kubernetes endpoint. - -## Logging - -EKS supports cluster logging for 5 different types of events: - -* API requests to the cluster. -* Cluster access via the Kubernetes API. -* Authentication requests into the cluster. -* State of cluster controllers. -* Scheduling decisions. - -You can enable logging for each one separately using the `clusterLogging` -property. For example: - -```ts -const cluster = new eks.Cluster(this, 'Cluster', { - // ... - version: eks.KubernetesVersion.V1_21, - clusterLogging: [ - eks.ClusterLoggingTypes.API, - eks.ClusterLoggingTypes.AUTHENTICATOR, - eks.ClusterLoggingTypes.SCHEDULER, - ], -}); -``` - -## Known Issues and Limitations - -* [One cluster per stack](https://github.com/aws/aws-cdk/issues/10073) -* [Service Account dependencies](https://github.com/aws/aws-cdk/issues/9910) -* [Support isolated VPCs](https://github.com/aws/aws-cdk/issues/12171) diff --git a/packages/@aws-cdk/aws-eks/jest.config.js b/packages/@aws-cdk/aws-eks/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-eks/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts deleted file mode 100644 index 229fbc2c10cd6..0000000000000 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/cluster.ts +++ /dev/null @@ -1,349 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -import { compareLoggingProps } from './compareLogging'; - - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - // compare newProps and oldProps and update the newProps by appending disabled LogSetup if any - const compared: Partial = compareLoggingProps(this.oldProps, this.newProps); - this.newProps.logging = compared.logging; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts b/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster.ts b/packages/@aws-cdk/aws-eks/lib/cluster.ts deleted file mode 100644 index e0eaa39cf4293..0000000000000 --- a/packages/@aws-cdk/aws-eks/lib/cluster.ts +++ /dev/null @@ -1,2382 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as ssm from '@aws-cdk/aws-ssm'; -import { Annotations, CfnOutput, CfnResource, IResource, Resource, Stack, Tags, Token, Duration, Size } from '@aws-cdk/core'; -import { Construct, Node } from 'constructs'; -import * as semver from 'semver'; -import * as YAML from 'yaml'; -import { AlbController, AlbControllerOptions } from './alb-controller'; -import { AwsAuth } from './aws-auth'; -import { ClusterResource, clusterArnComponents } from './cluster-resource'; -import { FargateProfile, FargateProfileOptions } from './fargate-profile'; -import { HelmChart, HelmChartOptions } from './helm-chart'; -import { INSTANCE_TYPES } from './instance-types'; -import { KubernetesManifest, KubernetesManifestOptions } from './k8s-manifest'; -import { KubernetesObjectValue } from './k8s-object-value'; -import { KubernetesPatch } from './k8s-patch'; -import { IKubectlProvider, KubectlProvider } from './kubectl-provider'; -import { Nodegroup, NodegroupOptions } from './managed-nodegroup'; -import { OpenIdConnectProvider } from './oidc-provider'; -import { BottleRocketImage } from './private/bottlerocket'; -import { ServiceAccount, ServiceAccountOptions } from './service-account'; -import { LifecycleLabel, renderAmazonLinuxUserData, renderBottlerocketUserData } from './user-data'; - -// defaults are based on https://eksctl.io -const DEFAULT_CAPACITY_COUNT = 2; -const DEFAULT_CAPACITY_TYPE = ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE); - -/** - * An EKS cluster - */ -export interface ICluster extends IResource, ec2.IConnectable { - /** - * The VPC in which this Cluster was created - */ - readonly vpc: ec2.IVpc; - - /** - * The physical name of the Cluster - * @attribute - */ - readonly clusterName: string; - - /** - * The unique ARN assigned to the service by AWS - * in the form of arn:aws:eks: - * @attribute - */ - readonly clusterArn: string; - - /** - * The API Server endpoint URL - * @attribute - */ - readonly clusterEndpoint: string; - - /** - * The certificate-authority-data for your cluster. - * @attribute - */ - readonly clusterCertificateAuthorityData: string; - - /** - * The id of the cluster security group that was created by Amazon EKS for the cluster. - * @attribute - */ - readonly clusterSecurityGroupId: string; - - /** - * The cluster security group that was created by Amazon EKS for the cluster. - * @attribute - */ - readonly clusterSecurityGroup: ec2.ISecurityGroup; - - /** - * Amazon Resource Name (ARN) or alias of the customer master key (CMK). - * @attribute - */ - readonly clusterEncryptionConfigKeyArn: string; - - /** - * The Open ID Connect Provider of the cluster used to configure Service Accounts. - */ - readonly openIdConnectProvider: iam.IOpenIdConnectProvider; - - /** - * An IAM role that can perform kubectl operations against this cluster. - * - * The role should be mapped to the `system:masters` Kubernetes RBAC role. - */ - readonly kubectlRole?: iam.IRole; - - /** - * Custom environment variables when running `kubectl` against this cluster. - */ - readonly kubectlEnvironment?: { [key: string]: string }; - - /** - * A security group to use for `kubectl` execution. - * - * If this is undefined, the k8s endpoint is expected to be accessible - * publicly. - */ - readonly kubectlSecurityGroup?: ec2.ISecurityGroup; - - /** - * Subnets to host the `kubectl` compute resources. - * - * If this is undefined, the k8s endpoint is expected to be accessible - * publicly. - */ - readonly kubectlPrivateSubnets?: ec2.ISubnet[]; - - /** - * An IAM role that can perform kubectl operations against this cluster. - * - * The role should be mapped to the `system:masters` Kubernetes RBAC role. - * - * This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster. - */ - readonly kubectlLambdaRole?: iam.IRole; - - /** - * An AWS Lambda layer that includes `kubectl` and `helm` - * - * If not defined, a default layer will be used containing Kubectl 1.20 and Helm 3.8 - */ - readonly kubectlLayer?: lambda.ILayerVersion; - - /** - * An AWS Lambda layer that contains the `aws` CLI. - * - * If not defined, a default layer will be used containing the AWS CLI 1.x. - */ - readonly awscliLayer?: lambda.ILayerVersion; - - /** - * Kubectl Provider for issuing kubectl commands against it - * - * If not defined, a default provider will be used - */ - readonly kubectlProvider?: IKubectlProvider; - - /** - * Amount of memory to allocate to the provider's lambda function. - */ - readonly kubectlMemory?: Size; - - /** - * A security group to associate with the Cluster Handler's Lambdas. - * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. - * - * Requires `placeClusterHandlerInVpc` to be set to true. - * - * @default - No security group. - * @attribute - */ - readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; - - /** - * An AWS Lambda layer that includes the NPM dependency `proxy-agent`. - * - * If not defined, a default layer will be used. - */ - readonly onEventLayer?: lambda.ILayerVersion; - - /** - * Indicates whether Kubernetes resources can be automatically pruned. When - * this is enabled (default), prune labels will be allocated and injected to - * each resource. These labels will then be used when issuing the `kubectl - * apply` operation with the `--prune` switch. - */ - readonly prune: boolean; - - /** - * Creates a new service account with corresponding IAM Role (IRSA). - * - * @param id logical id of service account - * @param options service account options - */ - addServiceAccount(id: string, options?: ServiceAccountOptions): ServiceAccount; - - /** - * Defines a Kubernetes resource in this cluster. - * - * The manifest will be applied/deleted using kubectl as needed. - * - * @param id logical id of this manifest - * @param manifest a list of Kubernetes resource specifications - * @returns a `KubernetesManifest` object. - */ - addManifest(id: string, ...manifest: Record[]): KubernetesManifest; - - /** - * Defines a Helm chart in this cluster. - * - * @param id logical id of this chart. - * @param options options of this chart. - * @returns a `HelmChart` construct - */ - addHelmChart(id: string, options: HelmChartOptions): HelmChart; - - /** - * Defines a CDK8s chart in this cluster. - * - * @param id logical id of this chart. - * @param chart the cdk8s chart. - * @returns a `KubernetesManifest` construct representing the chart. - */ - addCdk8sChart(id: string, chart: Construct, options?: KubernetesManifestOptions): KubernetesManifest; - - /** - * Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster. - * - * The AutoScalingGroup must be running an EKS-optimized AMI containing the - * /etc/eks/bootstrap.sh script. This method will configure Security Groups, - * add the right policies to the instance role, apply the right tags, and add - * the required user data to the instance's launch configuration. - * - * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. - * If kubectl is enabled, the - * [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) - * daemon will be installed on all spot instances to handle - * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). - * - * Prefer to use `addAutoScalingGroupCapacity` if possible. - * - * @see https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html - * @param autoScalingGroup [disable-awslint:ref-via-interface] - * @param options options for adding auto scaling groups, like customizing the bootstrap script - */ - connectAutoScalingGroupCapacity(autoScalingGroup: autoscaling.AutoScalingGroup, options: AutoScalingGroupOptions): void; -} - -/** - * Attributes for EKS clusters. - */ -export interface ClusterAttributes { - /** - * The VPC in which this Cluster was created - * @default - if not specified `cluster.vpc` will throw an error - */ - readonly vpc?: ec2.IVpc; - - /** - * The physical name of the Cluster - */ - readonly clusterName: string; - - /** - * The API Server endpoint URL - * @default - if not specified `cluster.clusterEndpoint` will throw an error. - */ - readonly clusterEndpoint?: string; - - /** - * The certificate-authority-data for your cluster. - * @default - if not specified `cluster.clusterCertificateAuthorityData` will - * throw an error - */ - readonly clusterCertificateAuthorityData?: string; - - /** - * The cluster security group that was created by Amazon EKS for the cluster. - * @default - if not specified `cluster.clusterSecurityGroupId` will throw an - * error - */ - readonly clusterSecurityGroupId?: string; - - /** - * Amazon Resource Name (ARN) or alias of the customer master key (CMK). - * @default - if not specified `cluster.clusterEncryptionConfigKeyArn` will - * throw an error - */ - readonly clusterEncryptionConfigKeyArn?: string; - - /** - * Additional security groups associated with this cluster. - * @default - if not specified, no additional security groups will be - * considered in `cluster.connections`. - */ - readonly securityGroupIds?: string[]; - - /** - * An IAM role with cluster administrator and "system:masters" permissions. - * @default - if not specified, it not be possible to issue `kubectl` commands - * against an imported cluster. - */ - readonly kubectlRoleArn?: string; - - /** - * An IAM role that can perform kubectl operations against this cluster. - * - * The role should be mapped to the `system:masters` Kubernetes RBAC role. - * - * This role is directly passed to the lambda handler that sends Kube Ctl commands - * to the cluster. - * @default - if not specified, the default role created by a lambda function will - * be used. - */ - readonly kubectlLambdaRole?: iam.IRole; - - /** - * Environment variables to use when running `kubectl` against this cluster. - * @default - no additional variables - */ - readonly kubectlEnvironment?: { [name: string]: string }; - - /** - * A security group to use for `kubectl` execution. If not specified, the k8s - * endpoint is expected to be accessible publicly. - * @default - k8s endpoint is expected to be accessible publicly - */ - readonly kubectlSecurityGroupId?: string; - - /** - * Subnets to host the `kubectl` compute resources. If not specified, the k8s - * endpoint is expected to be accessible publicly. - * @default - k8s endpoint is expected to be accessible publicly - */ - readonly kubectlPrivateSubnetIds?: string[]; - - /** - * An Open ID Connect provider for this cluster that can be used to configure service accounts. - * You can either import an existing provider using `iam.OpenIdConnectProvider.fromProviderArn`, - * or create a new provider using `new eks.OpenIdConnectProvider` - * @default - if not specified `cluster.openIdConnectProvider` and `cluster.addServiceAccount` will throw an error. - */ - readonly openIdConnectProvider?: iam.IOpenIdConnectProvider; - - /** - * An AWS Lambda Layer which includes `kubectl` and Helm. - * - * This layer is used by the kubectl handler to apply manifests and install - * helm charts. You must pick an appropriate releases of one of the - * `@aws-cdk/layer-kubectl-vXX` packages, that works with the version of - * Kubernetes you have chosen. If you don't supply this value `kubectl` - * 1.20 will be used, but that version is most likely too old. - * - * The handler expects the layer to include the following executables: - * - * ``` - * /opt/helm/helm - * /opt/kubectl/kubectl - * ``` - * - * @default - a default layer with Kubectl 1.20 and helm 3.8. - */ - readonly kubectlLayer?: lambda.ILayerVersion; - - /** - * An AWS Lambda layer that contains the `aws` CLI. - * - * The handler expects the layer to include the following executables: - * - * ``` - * /opt/awscli/aws - * ``` - * - * @default - a default layer with the AWS CLI 1.x - */ - readonly awscliLayer?: lambda.ILayerVersion; - - /** - * KubectlProvider for issuing kubectl commands. - * - * @default - Default CDK provider - */ - readonly kubectlProvider?: IKubectlProvider; - - /** - * Amount of memory to allocate to the provider's lambda function. - * - * @default Size.gibibytes(1) - */ - readonly kubectlMemory?: Size; - - /** - * A security group id to associate with the Cluster Handler's Lambdas. - * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. - * - * @default - No security group. - */ - readonly clusterHandlerSecurityGroupId?: string; - - /** - * An AWS Lambda Layer which includes the NPM dependency `proxy-agent`. This layer - * is used by the onEvent handler to route AWS SDK requests through a proxy. - * - * The handler expects the layer to include the following node_modules: - * - * proxy-agent - * - * @default - a layer bundled with this module. - */ - readonly onEventLayer?: lambda.ILayerVersion; - - /** - * Indicates whether Kubernetes resources added through `addManifest()` can be - * automatically pruned. When this is enabled (default), prune labels will be - * allocated and injected to each resource. These labels will then be used - * when issuing the `kubectl apply` operation with the `--prune` switch. - * - * @default true - */ - readonly prune?: boolean; -} - -/** - * Options for configuring an EKS cluster. - */ -export interface CommonClusterOptions { - /** - * The VPC in which to create the Cluster. - * - * @default - a VPC with default configuration will be created and can be accessed through `cluster.vpc`. - */ - readonly vpc?: ec2.IVpc; - - /** - * Where to place EKS Control Plane ENIs - * - * If you want to create public load balancers, this must include public subnets. - * - * For example, to only select private subnets, supply the following: - * - * `vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]` - * - * @default - All public and private subnets - */ - readonly vpcSubnets?: ec2.SubnetSelection[]; - - /** - * Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf. - * - * @default - A role is automatically created for you - */ - readonly role?: iam.IRole; - - /** - * Name for the cluster. - * - * @default - Automatically generated name - */ - readonly clusterName?: string; - - /** - * Security Group to use for Control Plane ENIs - * - * @default - A security group is automatically created - */ - readonly securityGroup?: ec2.ISecurityGroup; - - /** - * The Kubernetes version to run in the cluster - */ - readonly version: KubernetesVersion; - - /** - * Determines whether a CloudFormation output with the name of the cluster - * will be synthesized. - * - * @default false - */ - readonly outputClusterName?: boolean; - - /** - * Determines whether a CloudFormation output with the `aws eks - * update-kubeconfig` command will be synthesized. This command will include - * the cluster name and, if applicable, the ARN of the masters IAM role. - * - * @default true - */ - readonly outputConfigCommand?: boolean; -} - -/** - * Options for EKS clusters. - */ -export interface ClusterOptions extends CommonClusterOptions { - /** - * An IAM role that will be added to the `system:masters` Kubernetes RBAC - * group. - * - * @see https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings - * - * @default - a role that assumable by anyone with permissions in the same - * account will automatically be defined - */ - readonly mastersRole?: iam.IRole; - - /** - * Controls the "eks.amazonaws.com/compute-type" annotation in the CoreDNS - * configuration on your cluster to determine which compute type to use - * for CoreDNS. - * - * @default CoreDnsComputeType.EC2 (for `FargateCluster` the default is FARGATE) - */ - readonly coreDnsComputeType?: CoreDnsComputeType; - - /** - * Determines whether a CloudFormation output with the ARN of the "masters" - * IAM role will be synthesized (if `mastersRole` is specified). - * - * @default false - */ - readonly outputMastersRoleArn?: boolean; - - /** - * Configure access to the Kubernetes API server endpoint.. - * - * @see https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html - * - * @default EndpointAccess.PUBLIC_AND_PRIVATE - */ - readonly endpointAccess?: EndpointAccess; - - /** - * Environment variables for the kubectl execution. Only relevant for kubectl enabled clusters. - * - * @default - No environment variables. - */ - readonly kubectlEnvironment?: { [key: string]: string }; - - /** - * An AWS Lambda Layer which includes `kubectl` and Helm. - * - * This layer is used by the kubectl handler to apply manifests and install - * helm charts. You must pick an appropriate releases of one of the - * `@aws-cdk/layer-kubectl-vXX` packages, that works with the version of - * Kubernetes you have chosen. If you don't supply this value `kubectl` - * 1.20 will be used, but that version is most likely too old. - * - * The handler expects the layer to include the following executables: - * - * ``` - * /opt/helm/helm - * /opt/kubectl/kubectl - * ``` - * - * @default - a default layer with Kubectl 1.20. - */ - readonly kubectlLayer?: lambda.ILayerVersion; - - /** - * An AWS Lambda layer that contains the `aws` CLI. - * - * The handler expects the layer to include the following executables: - * - * ``` - * /opt/awscli/aws - * ``` - * - * @default - a default layer with the AWS CLI 1.x - */ - readonly awscliLayer?: lambda.ILayerVersion; - - /** - * Amount of memory to allocate to the provider's lambda function. - * - * @default Size.gibibytes(1) - */ - readonly kubectlMemory?: Size; - - /** - * Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle. - * - * @default - No environment variables. - */ - readonly clusterHandlerEnvironment?: { [key: string]: string }; - - /** - * A security group to associate with the Cluster Handler's Lambdas. - * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. - * - * Requires `placeClusterHandlerInVpc` to be set to true. - * - * @default - No security group. - */ - readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; - - /** - * An AWS Lambda Layer which includes the NPM dependency `proxy-agent`. This layer - * is used by the onEvent handler to route AWS SDK requests through a proxy. - * - * By default, the provider will use the layer included in the - * "aws-lambda-layer-node-proxy-agent" SAR application which is available in all - * commercial regions. - * - * To deploy the layer locally define it in your app as follows: - * - * ```ts - * const layer = new lambda.LayerVersion(this, 'proxy-agent-layer', { - * code: lambda.Code.fromAsset(`${__dirname}/layer.zip`), - * compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], - * }); - * ``` - * - * @default - a layer bundled with this module. - */ - readonly onEventLayer?: lambda.ILayerVersion; - - /** - * Indicates whether Kubernetes resources added through `addManifest()` can be - * automatically pruned. When this is enabled (default), prune labels will be - * allocated and injected to each resource. These labels will then be used - * when issuing the `kubectl apply` operation with the `--prune` switch. - * - * @default true - */ - readonly prune?: boolean; - - /** - * If set to true, the cluster handler functions will be placed in the private subnets - * of the cluster vpc, subject to the `vpcSubnets` selection strategy. - * - * @default false - */ - readonly placeClusterHandlerInVpc?: boolean; - - /** - * KMS secret for envelope encryption for Kubernetes secrets. - * - * @default - By default, Kubernetes stores all secret object data within etcd and - * all etcd volumes used by Amazon EKS are encrypted at the disk-level - * using AWS-Managed encryption keys. - */ - readonly secretsEncryptionKey?: kms.IKey; - - /** - * The CIDR block to assign Kubernetes service IP addresses from. - * - * @default - Kubernetes assigns addresses from either the - * 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks - * @see https://docs.aws.amazon.com/eks/latest/APIReference/API_KubernetesNetworkConfigRequest.html#AmazonEKS-Type-KubernetesNetworkConfigRequest-serviceIpv4Cidr - */ - readonly serviceIpv4Cidr?: string; - - /** - * Install the AWS Load Balancer Controller onto the cluster. - * - * @see https://kubernetes-sigs.github.io/aws-load-balancer-controller - * - * @default - The controller is not installed. - */ - readonly albController?: AlbControllerOptions; - /** - * The cluster log types which you want to enable. - * - * @default - none - */ - readonly clusterLogging?: ClusterLoggingTypes[]; -} - -/** - * Group access configuration together. - */ -interface EndpointAccessConfig { - - /** - * Indicates if private access is enabled. - */ - readonly privateAccess: boolean; - - /** - * Indicates if public access is enabled. - */ - readonly publicAccess: boolean; - /** - * Public access is allowed only from these CIDR blocks. - * An empty array means access is open to any address. - * - * @default - No restrictions. - */ - readonly publicCidrs?: string[]; - -} - -/** - * Endpoint access characteristics. - */ -export class EndpointAccess { - - /** - * The cluster endpoint is accessible from outside of your VPC. - * Worker node traffic will leave your VPC to connect to the endpoint. - * - * By default, the endpoint is exposed to all adresses. You can optionally limit the CIDR blocks that can access the public endpoint using the `PUBLIC.onlyFrom` method. - * If you limit access to specific CIDR blocks, you must ensure that the CIDR blocks that you - * specify include the addresses that worker nodes and Fargate pods (if you use them) - * access the public endpoint from. - * - * @param cidr The CIDR blocks. - */ - public static readonly PUBLIC = new EndpointAccess({ privateAccess: false, publicAccess: true }); - - /** - * The cluster endpoint is only accessible through your VPC. - * Worker node traffic to the endpoint will stay within your VPC. - */ - public static readonly PRIVATE = new EndpointAccess({ privateAccess: true, publicAccess: false }); - - /** - * The cluster endpoint is accessible from outside of your VPC. - * Worker node traffic to the endpoint will stay within your VPC. - * - * By default, the endpoint is exposed to all adresses. You can optionally limit the CIDR blocks that can access the public endpoint using the `PUBLIC_AND_PRIVATE.onlyFrom` method. - * If you limit access to specific CIDR blocks, you must ensure that the CIDR blocks that you - * specify include the addresses that worker nodes and Fargate pods (if you use them) - * access the public endpoint from. - * - * @param cidr The CIDR blocks. - */ - public static readonly PUBLIC_AND_PRIVATE = new EndpointAccess({ privateAccess: true, publicAccess: true }); - - private constructor( - /** - * Configuration properties. - * - * @internal - */ - public readonly _config: EndpointAccessConfig) { - if (!_config.publicAccess && _config.publicCidrs && _config.publicCidrs.length > 0) { - throw new Error('CIDR blocks can only be configured when public access is enabled'); - } - } - - - /** - * Restrict public access to specific CIDR blocks. - * If public access is disabled, this method will result in an error. - * - * @param cidr CIDR blocks. - */ - public onlyFrom(...cidr: string[]) { - if (!this._config.privateAccess) { - // when private access is disabled, we can't restric public - // access since it will render the kubectl provider unusable. - throw new Error('Cannot restric public access to endpoint when private access is disabled. Use PUBLIC_AND_PRIVATE.onlyFrom() instead.'); - } - return new EndpointAccess({ - ...this._config, - // override CIDR - publicCidrs: cidr, - }); - } -} - -/** - * Common configuration props for EKS clusters. - */ -export interface ClusterProps extends ClusterOptions { - - /** - * Number of instances to allocate as an initial capacity for this cluster. - * Instance type can be configured through `defaultCapacityInstanceType`, - * which defaults to `m5.large`. - * - * Use `cluster.addAutoScalingGroupCapacity` to add additional customized capacity. Set this - * to `0` is you wish to avoid the initial capacity allocation. - * - * @default 2 - */ - readonly defaultCapacity?: number; - - /** - * The instance type to use for the default capacity. This will only be taken - * into account if `defaultCapacity` is > 0. - * - * @default m5.large - */ - readonly defaultCapacityInstance?: ec2.InstanceType; - - /** - * The default capacity type for the cluster. - * - * @default NODEGROUP - */ - readonly defaultCapacityType?: DefaultCapacityType; - - /** - * The IAM role to pass to the Kubectl Lambda Handler. - * - * @default - Default Lambda IAM Execution Role - */ - readonly kubectlLambdaRole?: iam.IRole; - - /** - * The tags assigned to the EKS cluster - * - * @default - none - */ - readonly tags?: { [key: string]: string }; -} - -/** - * Kubernetes cluster version - * @see https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html#kubernetes-release-calendar - */ -export class KubernetesVersion { - /** - * Kubernetes version 1.14 - * @deprecated Use newer version of EKS - */ - public static readonly V1_14 = KubernetesVersion.of('1.14'); - - /** - * Kubernetes version 1.15 - * @deprecated Use newer version of EKS - */ - public static readonly V1_15 = KubernetesVersion.of('1.15'); - - /** - * Kubernetes version 1.16 - * @deprecated Use newer version of EKS - */ - public static readonly V1_16 = KubernetesVersion.of('1.16'); - - /** - * Kubernetes version 1.17 - * @deprecated Use newer version of EKS - */ - public static readonly V1_17 = KubernetesVersion.of('1.17'); - - /** - * Kubernetes version 1.18 - * @deprecated Use newer version of EKS - */ - public static readonly V1_18 = KubernetesVersion.of('1.18'); - - /** - * Kubernetes version 1.19 - * @deprecated Use newer version of EKS - */ - public static readonly V1_19 = KubernetesVersion.of('1.19'); - - /** - * Kubernetes version 1.20 - * @deprecated Use newer version of EKS - */ - public static readonly V1_20 = KubernetesVersion.of('1.20'); - - /** - * Kubernetes version 1.21 - */ - public static readonly V1_21 = KubernetesVersion.of('1.21'); - - /** - * Kubernetes version 1.22 - * - * When creating a `Cluster` with this version, you need to also specify the - * `kubectlLayer` property with a `KubectlV22Layer` from - * `@aws-cdk/lambda-layer-kubectl-v22`. - */ - public static readonly V1_22 = KubernetesVersion.of('1.22'); - - /** - * Kubernetes version 1.23 - * - * When creating a `Cluster` with this version, you need to also specify the - * `kubectlLayer` property with a `KubectlV23Layer` from - * `@aws-cdk/lambda-layer-kubectl-v23`. - */ - public static readonly V1_23 = KubernetesVersion.of('1.23'); - - /** - * Kubernetes version 1.24 - * - * When creating a `Cluster` with this version, you need to also specify the - * `kubectlLayer` property with a `KubectlV24Layer` from - * `@aws-cdk/lambda-layer-kubectl-v24`. - */ - public static readonly V1_24 = KubernetesVersion.of('1.24'); - - /** - * Kubernetes version 1.25 - * - * When creating a `Cluster` with this version, you need to also specify the - * `kubectlLayer` property with a `KubectlV25Layer` from - * `@aws-cdk/lambda-layer-kubectl-v25`. - */ - public static readonly V1_25 = KubernetesVersion.of('1.25'); - - /** - * Custom cluster version - * @param version custom version number - */ - public static of(version: string) { return new KubernetesVersion(version); } - /** - * - * @param version cluster version number - */ - private constructor(public readonly version: string) { } -} - -/** - * EKS cluster logging types - */ -export enum ClusterLoggingTypes { - /** - * Logs pertaining to API requests to the cluster. - */ - API = 'api', - /** - * Logs pertaining to cluster access via the Kubernetes API. - */ - AUDIT = 'audit', - /** - * Logs pertaining to authentication requests into the cluster. - */ - AUTHENTICATOR = 'authenticator', - /** - * Logs pertaining to state of cluster controllers. - */ - CONTROLLER_MANAGER = 'controllerManager', - /** - * Logs pertaining to scheduling decisions. - */ - SCHEDULER = 'scheduler', -} - -abstract class ClusterBase extends Resource implements ICluster { - public abstract readonly connections: ec2.Connections; - public abstract readonly vpc: ec2.IVpc; - public abstract readonly clusterName: string; - public abstract readonly clusterArn: string; - public abstract readonly clusterEndpoint: string; - public abstract readonly clusterCertificateAuthorityData: string; - public abstract readonly clusterSecurityGroupId: string; - public abstract readonly clusterSecurityGroup: ec2.ISecurityGroup; - public abstract readonly clusterEncryptionConfigKeyArn: string; - public abstract readonly kubectlRole?: iam.IRole; - public abstract readonly kubectlLambdaRole?: iam.IRole; - public abstract readonly kubectlEnvironment?: { [key: string]: string }; - public abstract readonly kubectlSecurityGroup?: ec2.ISecurityGroup; - public abstract readonly kubectlPrivateSubnets?: ec2.ISubnet[]; - public abstract readonly kubectlMemory?: Size; - public abstract readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; - public abstract readonly prune: boolean; - public abstract readonly openIdConnectProvider: iam.IOpenIdConnectProvider; - public abstract readonly awsAuth: AwsAuth; - - private _spotInterruptHandler?: HelmChart; - - /** - * Manages the aws-auth config map. - * - * @internal - */ - protected _awsAuth?: AwsAuth; - - /** - * Defines a Kubernetes resource in this cluster. - * - * The manifest will be applied/deleted using kubectl as needed. - * - * @param id logical id of this manifest - * @param manifest a list of Kubernetes resource specifications - * @returns a `KubernetesResource` object. - */ - public addManifest(id: string, ...manifest: Record[]): KubernetesManifest { - return new KubernetesManifest(this, `manifest-${id}`, { cluster: this, manifest }); - } - - /** - * Defines a Helm chart in this cluster. - * - * @param id logical id of this chart. - * @param options options of this chart. - * @returns a `HelmChart` construct - */ - public addHelmChart(id: string, options: HelmChartOptions): HelmChart { - return new HelmChart(this, `chart-${id}`, { cluster: this, ...options }); - } - - /** - * Defines a CDK8s chart in this cluster. - * - * @param id logical id of this chart. - * @param chart the cdk8s chart. - * @returns a `KubernetesManifest` construct representing the chart. - */ - public addCdk8sChart(id: string, chart: Construct, options: KubernetesManifestOptions = {}): KubernetesManifest { - - const cdk8sChart = chart as any; - - // see https://github.com/awslabs/cdk8s/blob/master/packages/cdk8s/src/chart.ts#L84 - if (typeof cdk8sChart.toJson !== 'function') { - throw new Error(`Invalid cdk8s chart. Must contain a 'toJson' method, but found ${typeof cdk8sChart.toJson}`); - } - - const manifest = new KubernetesManifest(this, id, { - cluster: this, - manifest: cdk8sChart.toJson(), - ...options, - }); - - return manifest; - } - - public addServiceAccount(id: string, options: ServiceAccountOptions = {}): ServiceAccount { - return new ServiceAccount(this, id, { - ...options, - cluster: this, - }); - } - - /** - * Installs the AWS spot instance interrupt handler on the cluster if it's not - * already added. - */ - private addSpotInterruptHandler() { - if (!this._spotInterruptHandler) { - this._spotInterruptHandler = this.addHelmChart('spot-interrupt-handler', { - chart: 'aws-node-termination-handler', - version: '0.18.0', - repository: 'https://aws.github.io/eks-charts', - namespace: 'kube-system', - values: { - nodeSelector: { - lifecycle: LifecycleLabel.SPOT, - }, - }, - }); - } - - return this._spotInterruptHandler; - } - - /** - * Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster. - * - * The AutoScalingGroup must be running an EKS-optimized AMI containing the - * /etc/eks/bootstrap.sh script. This method will configure Security Groups, - * add the right policies to the instance role, apply the right tags, and add - * the required user data to the instance's launch configuration. - * - * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. - * If kubectl is enabled, the - * [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) - * daemon will be installed on all spot instances to handle - * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). - * - * Prefer to use `addAutoScalingGroupCapacity` if possible. - * - * @see https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html - * @param autoScalingGroup [disable-awslint:ref-via-interface] - * @param options options for adding auto scaling groups, like customizing the bootstrap script - */ - public connectAutoScalingGroupCapacity(autoScalingGroup: autoscaling.AutoScalingGroup, options: AutoScalingGroupOptions) { - // self rules - autoScalingGroup.connections.allowInternally(ec2.Port.allTraffic()); - - // Cluster to:nodes rules - autoScalingGroup.connections.allowFrom(this, ec2.Port.tcp(443)); - autoScalingGroup.connections.allowFrom(this, ec2.Port.tcpRange(1025, 65535)); - - // Allow HTTPS from Nodes to Cluster - autoScalingGroup.connections.allowTo(this, ec2.Port.tcp(443)); - - // Allow all node outbound traffic - autoScalingGroup.connections.allowToAnyIpv4(ec2.Port.allTcp()); - autoScalingGroup.connections.allowToAnyIpv4(ec2.Port.allUdp()); - autoScalingGroup.connections.allowToAnyIpv4(ec2.Port.allIcmp()); - - // allow traffic to/from managed node groups (eks attaches this security group to the managed nodes) - autoScalingGroup.addSecurityGroup(this.clusterSecurityGroup); - - const bootstrapEnabled = options.bootstrapEnabled ?? true; - if (options.bootstrapOptions && !bootstrapEnabled) { - throw new Error('Cannot specify "bootstrapOptions" if "bootstrapEnabled" is false'); - } - - if (bootstrapEnabled) { - const userData = options.machineImageType === MachineImageType.BOTTLEROCKET ? - renderBottlerocketUserData(this) : - renderAmazonLinuxUserData(this, autoScalingGroup, options.bootstrapOptions); - autoScalingGroup.addUserData(...userData); - } - - autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEKSWorkerNodePolicy')); - autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEKS_CNI_Policy')); - autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEC2ContainerRegistryReadOnly')); - - // EKS Required Tags - // https://docs.aws.amazon.com/eks/latest/userguide/worker.html - Tags.of(autoScalingGroup).add(`kubernetes.io/cluster/${this.clusterName}`, 'owned', { - applyToLaunchedInstances: true, - // exclude security groups to avoid multiple "owned" security groups. - // (the cluster security group already has this tag) - excludeResourceTypes: ['AWS::EC2::SecurityGroup'], - }); - - // do not attempt to map the role if `kubectl` is not enabled for this - // cluster or if `mapRole` is set to false. By default this should happen. - let mapRole = options.mapRole ?? true; - if (mapRole && !(this instanceof Cluster)) { - // do the mapping... - Annotations.of(autoScalingGroup).addWarning('Auto-mapping aws-auth role for imported cluster is not supported, please map role manually'); - mapRole = false; - } - if (mapRole) { - // see https://docs.aws.amazon.com/en_us/eks/latest/userguide/add-user-role.html - this.awsAuth.addRoleMapping(autoScalingGroup.role, { - username: 'system:node:{{EC2PrivateDNSName}}', - groups: [ - 'system:bootstrappers', - 'system:nodes', - ], - }); - } else { - // since we are not mapping the instance role to RBAC, synthesize an - // output so it can be pasted into `aws-auth-cm.yaml` - new CfnOutput(autoScalingGroup, 'InstanceRoleARN', { - value: autoScalingGroup.role.roleArn, - }); - } - - const addSpotInterruptHandler = options.spotInterruptHandler ?? true; - // if this is an ASG with spot instances, install the spot interrupt handler (only if kubectl is enabled). - if (autoScalingGroup.spotPrice && addSpotInterruptHandler) { - this.addSpotInterruptHandler(); - } - - if (this instanceof Cluster && this.albController) { - // the controller runs on the worker nodes so they cannot - // be deleted before the controller. - Node.of(this.albController).addDependency(autoScalingGroup); - } - } -} - -/** - * Options for fetching a ServiceLoadBalancerAddress. - */ -export interface ServiceLoadBalancerAddressOptions { - - /** - * Timeout for waiting on the load balancer address. - * - * @default Duration.minutes(5) - */ - readonly timeout?: Duration; - - /** - * The namespace the service belongs to. - * - * @default 'default' - */ - readonly namespace?: string; - -} - -/** - * Options for fetching an IngressLoadBalancerAddress. - */ -export interface IngressLoadBalancerAddressOptions extends ServiceLoadBalancerAddressOptions {}; - -/** - * A Cluster represents a managed Kubernetes Service (EKS) - * - * This is a fully managed cluster of API Servers (control-plane) - * The user is still required to create the worker nodes. - */ -export class Cluster extends ClusterBase { - /** - * Import an existing cluster - * - * @param scope the construct scope, in most cases 'this' - * @param id the id or name to import as - * @param attrs the cluster properties to use for importing information - */ - public static fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster { - return new ImportedCluster(scope, id, attrs); - } - - /** - * The VPC in which this Cluster was created - */ - public readonly vpc: ec2.IVpc; - - /** - * The Name of the created EKS Cluster - */ - public readonly clusterName: string; - - /** - * The AWS generated ARN for the Cluster resource - * - * For example, `arn:aws:eks:us-west-2:666666666666:cluster/prod` - */ - public readonly clusterArn: string; - - /** - * The endpoint URL for the Cluster - * - * This is the URL inside the kubeconfig file to use with kubectl - * - * For example, `https://5E1D0CEXAMPLEA591B746AFC5AB30262.yl4.us-west-2.eks.amazonaws.com` - */ - public readonly clusterEndpoint: string; - - /** - * The certificate-authority-data for your cluster. - */ - public readonly clusterCertificateAuthorityData: string; - - /** - * The id of the cluster security group that was created by Amazon EKS for the cluster. - */ - public readonly clusterSecurityGroupId: string; - - /** - * The cluster security group that was created by Amazon EKS for the cluster. - */ - public readonly clusterSecurityGroup: ec2.ISecurityGroup; - - /** - * Amazon Resource Name (ARN) or alias of the customer master key (CMK). - */ - public readonly clusterEncryptionConfigKeyArn: string; - - /** - * Manages connection rules (Security Group Rules) for the cluster - * - * @type {ec2.Connections} - * @memberof Cluster - */ - public readonly connections: ec2.Connections; - - /** - * IAM role assumed by the EKS Control Plane - */ - public readonly role: iam.IRole; - - /** - * The auto scaling group that hosts the default capacity for this cluster. - * This will be `undefined` if the `defaultCapacityType` is not `EC2` or - * `defaultCapacityType` is `EC2` but default capacity is set to 0. - */ - public readonly defaultCapacity?: autoscaling.AutoScalingGroup; - - /** - * The node group that hosts the default capacity for this cluster. - * This will be `undefined` if the `defaultCapacityType` is `EC2` or - * `defaultCapacityType` is `NODEGROUP` but default capacity is set to 0. - */ - public readonly defaultNodegroup?: Nodegroup; - - /** - * An IAM role that can perform kubectl operations against this cluster. - * - * The role should be mapped to the `system:masters` Kubernetes RBAC role. - */ - public readonly kubectlRole?: iam.IRole; - - /** - * An IAM role that can perform kubectl operations against this cluster. - * - * The role should be mapped to the `system:masters` Kubernetes RBAC role. - * - * This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster. - * @default - if not specified, the default role created by a lambda function will - * be used. - */ - - public readonly kubectlLambdaRole?: iam.IRole; - - /** - * Custom environment variables when running `kubectl` against this cluster. - */ - public readonly kubectlEnvironment?: { [key: string]: string }; - - /** - * A security group to use for `kubectl` execution. - * - * @default - If not specified, the k8s endpoint is expected to be accessible - * publicly. - */ - public readonly kubectlSecurityGroup?: ec2.ISecurityGroup; - - /** - * Subnets to host the `kubectl` compute resources. - * - * @default - If not specified, the k8s endpoint is expected to be accessible - * publicly. - */ - public readonly kubectlPrivateSubnets?: ec2.ISubnet[]; - - /** - * An IAM role with administrative permissions to create or update the - * cluster. This role also has `systems:master` permissions. - */ - public readonly adminRole: iam.Role; - - /** - * If the cluster has one (or more) FargateProfiles associated, this array - * will hold a reference to each. - */ - private readonly _fargateProfiles: FargateProfile[] = []; - - /** - * an Open ID Connect Provider instance - */ - private _openIdConnectProvider?: iam.IOpenIdConnectProvider; - - /** - * An AWS Lambda layer that includes `kubectl` and `helm` - * - * If not defined, a default layer will be used containing Kubectl 1.20 and Helm 3.8 - */ - readonly kubectlLayer?: lambda.ILayerVersion; - - /** - * An AWS Lambda layer that contains the `aws` CLI. - * - * If not defined, a default layer will be used containing the AWS CLI 1.x. - */ - readonly awscliLayer?: lambda.ILayerVersion; - - /** - * The amount of memory allocated to the kubectl provider's lambda function. - */ - public readonly kubectlMemory?: Size; - - /** - * A security group to associate with the Cluster Handler's Lambdas. - * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. - * - * Requires `placeClusterHandlerInVpc` to be set to true. - * - * @default - No security group. - */ - public readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; - - /** - * The AWS Lambda layer that contains the NPM dependency `proxy-agent`. If - * undefined, a SAR app that contains this layer will be used. - */ - readonly onEventLayer?: lambda.ILayerVersion; - - /** - * Determines if Kubernetes resources can be pruned automatically. - */ - public readonly prune: boolean; - - /** - * The ALB Controller construct defined for this cluster. - * Will be undefined if `albController` wasn't configured. - */ - public readonly albController?: AlbController; - - /** - * If this cluster is kubectl-enabled, returns the `ClusterResource` object - * that manages it. If this cluster is not kubectl-enabled (i.e. uses the - * stock `CfnCluster`), this is `undefined`. - */ - private readonly _clusterResource: ClusterResource; - - private _neuronDevicePlugin?: KubernetesManifest; - - private readonly endpointAccess: EndpointAccess; - - private readonly vpcSubnets: ec2.SubnetSelection[]; - - private readonly version: KubernetesVersion; - - private readonly logging?: { [key: string]: [ { [key: string]: any } ] }; - - /** - * A dummy CloudFormation resource that is used as a wait barrier which - * represents that the cluster is ready to receive "kubectl" commands. - * - * Specifically, all fargate profiles are automatically added as a dependency - * of this barrier, which means that it will only be "signaled" when all - * fargate profiles have been successfully created. - * - * When kubectl resources call `_attachKubectlResourceScope()`, this resource - * is added as their dependency which implies that they can only be deployed - * after the cluster is ready. - */ - private readonly _kubectlReadyBarrier: CfnResource; - - private readonly _kubectlResourceProvider: KubectlProvider; - - /** - * Initiates an EKS Cluster with the supplied arguments - * - * @param scope a Construct, most likely a cdk.Stack created - * @param id the id of the Construct to create - * @param props properties in the IClusterProps interface - */ - constructor(scope: Construct, id: string, props: ClusterProps) { - super(scope, id, { - physicalName: props.clusterName, - }); - - const stack = Stack.of(this); - - this.prune = props.prune ?? true; - this.vpc = props.vpc || new ec2.Vpc(this, 'DefaultVpc'); - - const kubectlVersion = new semver.SemVer(`${props.version.version}.0`); - if (semver.gte(kubectlVersion, '1.22.0') && !props.kubectlLayer) { - Annotations.of(this).addWarning(`You created a cluster with Kubernetes Version ${props.version.version} without specifying the kubectlLayer property. This may cause failures as the kubectl version provided with aws-cdk-lib is 1.20, which is only guaranteed to be compatible with Kubernetes versions 1.19-1.21. Please provide a kubectlLayer from @aws-cdk/lambda-layer-kubectl-v${kubectlVersion.minor}.`); - }; - this.version = props.version; - this.kubectlLambdaRole = props.kubectlLambdaRole ? props.kubectlLambdaRole : undefined; - - this.tagSubnets(); - - // this is the role used by EKS when interacting with AWS resources - this.role = props.role || new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('eks.amazonaws.com'), - managedPolicies: [ - iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEKSClusterPolicy'), - ], - }); - - const securityGroup = props.securityGroup || new ec2.SecurityGroup(this, 'ControlPlaneSecurityGroup', { - vpc: this.vpc, - description: 'EKS Control Plane Security Group', - }); - - this.vpcSubnets = props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]; - - const selectedSubnetIdsPerGroup = this.vpcSubnets.map(s => this.vpc.selectSubnets(s).subnetIds); - if (selectedSubnetIdsPerGroup.some(Token.isUnresolved) && selectedSubnetIdsPerGroup.length > 1) { - throw new Error('eks.Cluster: cannot select multiple subnet groups from a VPC imported from list tokens with unknown length. Select only one subnet group, pass a length to Fn.split, or switch to Vpc.fromLookup.'); - } - - // Get subnetIds for all selected subnets - const subnetIds = Array.from(new Set(flatten(selectedSubnetIdsPerGroup))); - - this.logging = props.clusterLogging ? { - clusterLogging: [ - { - enabled: true, - types: Object.values(props.clusterLogging), - }, - ], - } : undefined; - - this.endpointAccess = props.endpointAccess ?? EndpointAccess.PUBLIC_AND_PRIVATE; - this.kubectlEnvironment = props.kubectlEnvironment; - this.kubectlLayer = props.kubectlLayer; - this.awscliLayer = props.awscliLayer; - this.kubectlMemory = props.kubectlMemory; - - this.onEventLayer = props.onEventLayer; - this.clusterHandlerSecurityGroup = props.clusterHandlerSecurityGroup; - - const privateSubnets = this.selectPrivateSubnets().slice(0, 16); - const publicAccessDisabled = !this.endpointAccess._config.publicAccess; - const publicAccessRestricted = !publicAccessDisabled - && this.endpointAccess._config.publicCidrs - && this.endpointAccess._config.publicCidrs.length !== 0; - - // validate endpoint access configuration - - if (privateSubnets.length === 0 && publicAccessDisabled) { - // no private subnets and no public access at all, no good. - throw new Error('Vpc must contain private subnets when public endpoint access is disabled'); - } - - if (privateSubnets.length === 0 && publicAccessRestricted) { - // no private subnets and public access is restricted, no good. - throw new Error('Vpc must contain private subnets when public endpoint access is restricted'); - } - - const placeClusterHandlerInVpc = props.placeClusterHandlerInVpc ?? false; - - if (placeClusterHandlerInVpc && privateSubnets.length === 0) { - throw new Error('Cannot place cluster handler in the VPC since no private subnets could be selected'); - } - - if (props.clusterHandlerSecurityGroup && !placeClusterHandlerInVpc) { - throw new Error('Cannot specify clusterHandlerSecurityGroup without placeClusterHandlerInVpc set to true'); - } - - const resource = this._clusterResource = new ClusterResource(this, 'Resource', { - name: this.physicalName, - environment: props.clusterHandlerEnvironment, - roleArn: this.role.roleArn, - version: props.version.version, - resourcesVpcConfig: { - securityGroupIds: [securityGroup.securityGroupId], - subnetIds, - }, - ...(props.secretsEncryptionKey ? { - encryptionConfig: [{ - provider: { - keyArn: props.secretsEncryptionKey.keyArn, - }, - resources: ['secrets'], - }], - } : {}), - kubernetesNetworkConfig: props.serviceIpv4Cidr ? { - serviceIpv4Cidr: props.serviceIpv4Cidr, - } : undefined, - endpointPrivateAccess: this.endpointAccess._config.privateAccess, - endpointPublicAccess: this.endpointAccess._config.publicAccess, - publicAccessCidrs: this.endpointAccess._config.publicCidrs, - secretsEncryptionKey: props.secretsEncryptionKey, - vpc: this.vpc, - subnets: placeClusterHandlerInVpc ? privateSubnets : undefined, - clusterHandlerSecurityGroup: this.clusterHandlerSecurityGroup, - onEventLayer: this.onEventLayer, - tags: props.tags, - logging: this.logging, - }); - - if (this.endpointAccess._config.privateAccess && privateSubnets.length !== 0) { - - // when private access is enabled and the vpc has private subnets, lets connect - // the provider to the vpc so that it will work even when restricting public access. - - // validate VPC properties according to: https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html - if (this.vpc instanceof ec2.Vpc && !(this.vpc.dnsHostnamesEnabled && this.vpc.dnsSupportEnabled)) { - throw new Error('Private endpoint access requires the VPC to have DNS support and DNS hostnames enabled. Use `enableDnsHostnames: true` and `enableDnsSupport: true` when creating the VPC.'); - } - - this.kubectlPrivateSubnets = privateSubnets; - - // the vpc must exist in order to properly delete the cluster (since we run `kubectl delete`). - // this ensures that. - this._clusterResource.node.addDependency(this.vpc); - } - - this.adminRole = resource.adminRole; - - // we use an SSM parameter as a barrier because it's free and fast. - this._kubectlReadyBarrier = new CfnResource(this, 'KubectlReadyBarrier', { - type: 'AWS::SSM::Parameter', - properties: { - Type: 'String', - Value: 'aws:cdk:eks:kubectl-ready', - }, - }); - - // add the cluster resource itself as a dependency of the barrier - this._kubectlReadyBarrier.node.addDependency(this._clusterResource); - - this.clusterName = this.getResourceNameAttribute(resource.ref); - this.clusterArn = this.getResourceArnAttribute(resource.attrArn, clusterArnComponents(this.physicalName)); - - this.clusterEndpoint = resource.attrEndpoint; - this.clusterCertificateAuthorityData = resource.attrCertificateAuthorityData; - this.clusterSecurityGroupId = resource.attrClusterSecurityGroupId; - this.clusterEncryptionConfigKeyArn = resource.attrEncryptionConfigKeyArn; - - this.clusterSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'ClusterSecurityGroup', this.clusterSecurityGroupId); - - this.connections = new ec2.Connections({ - securityGroups: [this.clusterSecurityGroup, securityGroup], - defaultPort: ec2.Port.tcp(443), // Control Plane has an HTTPS API - }); - - // we can use the cluster security group since its already attached to the cluster - // and configured to allow connections from itself. - this.kubectlSecurityGroup = this.clusterSecurityGroup; - - // use the cluster creation role to issue kubectl commands against the cluster because when the - // cluster is first created, that's the only role that has "system:masters" permissions - this.kubectlRole = this.adminRole; - - this._kubectlResourceProvider = this.defineKubectlProvider(); - - const updateConfigCommandPrefix = `aws eks update-kubeconfig --name ${this.clusterName}`; - const getTokenCommandPrefix = `aws eks get-token --cluster-name ${this.clusterName}`; - const commonCommandOptions = [`--region ${stack.region}`]; - - if (props.outputClusterName) { - new CfnOutput(this, 'ClusterName', { value: this.clusterName }); - } - - // if an explicit role is not configured, define a masters role that can - // be assumed by anyone in the account (with sts:AssumeRole permissions of - // course) - const mastersRole = props.mastersRole ?? new iam.Role(this, 'MastersRole', { - assumedBy: new iam.AccountRootPrincipal(), - }); - - // map the IAM role to the `system:masters` group. - this.awsAuth.addMastersRole(mastersRole); - - if (props.outputMastersRoleArn) { - new CfnOutput(this, 'MastersRoleArn', { value: mastersRole.roleArn }); - } - - commonCommandOptions.push(`--role-arn ${mastersRole.roleArn}`); - - if (props.albController) { - this.albController = AlbController.create(this, { ...props.albController, cluster: this }); - } - - // allocate default capacity if non-zero (or default). - const minCapacity = props.defaultCapacity ?? DEFAULT_CAPACITY_COUNT; - if (minCapacity > 0) { - const instanceType = props.defaultCapacityInstance || DEFAULT_CAPACITY_TYPE; - this.defaultCapacity = props.defaultCapacityType === DefaultCapacityType.EC2 ? - this.addAutoScalingGroupCapacity('DefaultCapacity', { instanceType, minCapacity }) : undefined; - - this.defaultNodegroup = props.defaultCapacityType !== DefaultCapacityType.EC2 ? - this.addNodegroupCapacity('DefaultCapacity', { instanceTypes: [instanceType], minSize: minCapacity }) : undefined; - } - - const outputConfigCommand = props.outputConfigCommand ?? true; - if (outputConfigCommand) { - const postfix = commonCommandOptions.join(' '); - new CfnOutput(this, 'ConfigCommand', { value: `${updateConfigCommandPrefix} ${postfix}` }); - new CfnOutput(this, 'GetTokenCommand', { value: `${getTokenCommandPrefix} ${postfix}` }); - } - - this.defineCoreDnsComputeType(props.coreDnsComputeType ?? CoreDnsComputeType.EC2); - - } - - /** - * Fetch the load balancer address of a service of type 'LoadBalancer'. - * - * @param serviceName The name of the service. - * @param options Additional operation options. - */ - public getServiceLoadBalancerAddress(serviceName: string, options: ServiceLoadBalancerAddressOptions = {}): string { - - const loadBalancerAddress = new KubernetesObjectValue(this, `${serviceName}LoadBalancerAddress`, { - cluster: this, - objectType: 'service', - objectName: serviceName, - objectNamespace: options.namespace, - jsonPath: '.status.loadBalancer.ingress[0].hostname', - timeout: options.timeout, - }); - - return loadBalancerAddress.value; - - } - - /** - * Fetch the load balancer address of an ingress backed by a load balancer. - * - * @param ingressName The name of the ingress. - * @param options Additional operation options. - */ - public getIngressLoadBalancerAddress(ingressName: string, options: IngressLoadBalancerAddressOptions = {}): string { - - const loadBalancerAddress = new KubernetesObjectValue(this, `${ingressName}LoadBalancerAddress`, { - cluster: this, - objectType: 'ingress', - objectName: ingressName, - objectNamespace: options.namespace, - jsonPath: '.status.loadBalancer.ingress[0].hostname', - timeout: options.timeout, - }); - - return loadBalancerAddress.value; - - } - - /** - * Add nodes to this EKS cluster - * - * The nodes will automatically be configured with the right VPC and AMI - * for the instance type and Kubernetes version. - * - * Note that if you specify `updateType: RollingUpdate` or `updateType: ReplacingUpdate`, your nodes might be replaced at deploy - * time without notice in case the recommended AMI for your machine image type has been updated by AWS. - * The default behavior for `updateType` is `None`, which means only new instances will be launched using the new AMI. - * - * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. - * In addition, the [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) - * daemon will be installed on all spot instances to handle - * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). - */ - public addAutoScalingGroupCapacity(id: string, options: AutoScalingGroupCapacityOptions): autoscaling.AutoScalingGroup { - if (options.machineImageType === MachineImageType.BOTTLEROCKET && options.bootstrapOptions !== undefined) { - throw new Error('bootstrapOptions is not supported for Bottlerocket'); - } - const asg = new autoscaling.AutoScalingGroup(this, id, { - ...options, - vpc: this.vpc, - machineImage: options.machineImageType === MachineImageType.BOTTLEROCKET ? - new BottleRocketImage({ - kubernetesVersion: this.version.version, - }) : - new EksOptimizedImage({ - nodeType: nodeTypeForInstanceType(options.instanceType), - cpuArch: cpuArchForInstanceType(options.instanceType), - kubernetesVersion: this.version.version, - }), - }); - - this.connectAutoScalingGroupCapacity(asg, { - mapRole: options.mapRole, - bootstrapOptions: options.bootstrapOptions, - bootstrapEnabled: options.bootstrapEnabled, - machineImageType: options.machineImageType, - spotInterruptHandler: options.spotInterruptHandler, - }); - - if (nodeTypeForInstanceType(options.instanceType) === NodeType.INFERENTIA) { - this.addNeuronDevicePlugin(); - } - - return asg; - } - - /** - * Add managed nodegroup to this Amazon EKS cluster - * - * This method will create a new managed nodegroup and add into the capacity. - * - * @see https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html - * @param id The ID of the nodegroup - * @param options options for creating a new nodegroup - */ - public addNodegroupCapacity(id: string, options?: NodegroupOptions): Nodegroup { - return new Nodegroup(this, `Nodegroup${id}`, { - cluster: this, - ...options, - }); - } - - /** - * Lazily creates the AwsAuth resource, which manages AWS authentication mapping. - */ - public get awsAuth() { - if (!this._awsAuth) { - this._awsAuth = new AwsAuth(this, 'AwsAuth', { cluster: this }); - } - - return this._awsAuth; - } - - /** - * If this cluster is kubectl-enabled, returns the OpenID Connect issuer url. - * This is because the values is only be retrieved by the API and not exposed - * by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the - * stock `CfnCluster`), this is `undefined`. - * @attribute - */ - public get clusterOpenIdConnectIssuerUrl(): string { - return this._clusterResource.attrOpenIdConnectIssuerUrl; - } - - /** - * If this cluster is kubectl-enabled, returns the OpenID Connect issuer. - * This is because the values is only be retrieved by the API and not exposed - * by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the - * stock `CfnCluster`), this is `undefined`. - * @attribute - */ - public get clusterOpenIdConnectIssuer(): string { - return this._clusterResource.attrOpenIdConnectIssuer; - } - - /** - * An `OpenIdConnectProvider` resource associated with this cluster, and which can be used - * to link this cluster to AWS IAM. - * - * A provider will only be defined if this property is accessed (lazy initialization). - */ - public get openIdConnectProvider() { - if (!this._openIdConnectProvider) { - this._openIdConnectProvider = new OpenIdConnectProvider(this, 'OpenIdConnectProvider', { - url: this.clusterOpenIdConnectIssuerUrl, - }); - } - - return this._openIdConnectProvider; - } - - /** - * Adds a Fargate profile to this cluster. - * @see https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html - * - * @param id the id of this profile - * @param options profile options - */ - public addFargateProfile(id: string, options: FargateProfileOptions) { - return new FargateProfile(this, `fargate-profile-${id}`, { - ...options, - cluster: this, - }); - } - - /** - * Internal API used by `FargateProfile` to keep inventory of Fargate profiles associated with - * this cluster, for the sake of ensuring the profiles are created sequentially. - * - * @returns the list of FargateProfiles attached to this cluster, including the one just attached. - * @internal - */ - public _attachFargateProfile(fargateProfile: FargateProfile): FargateProfile[] { - this._fargateProfiles.push(fargateProfile); - - // add all profiles as a dependency of the "kubectl-ready" barrier because all kubectl- - // resources can only be deployed after all fargate profiles are created. - this._kubectlReadyBarrier.node.addDependency(fargateProfile); - - return this._fargateProfiles; - } - - /** - * Adds a resource scope that requires `kubectl` to this cluster and returns - * the `KubectlProvider` which is the custom resource provider that should be - * used as the resource provider. - * - * Called from `HelmResource` and `KubernetesResource` - * - * @param resourceScope the construct scope in which kubectl resources are defined. - * - * @internal - */ - public _attachKubectlResourceScope(resourceScope: Construct): KubectlProvider { - Node.of(resourceScope).addDependency(this._kubectlReadyBarrier); - return this._kubectlResourceProvider; - } - - private defineKubectlProvider() { - const uid = '@aws-cdk/aws-eks.KubectlProvider'; - - // since we can't have the provider connect to multiple networks, and we - // wanted to avoid resource tear down, we decided for now that we will only - // support a single EKS cluster per CFN stack. - if (this.stack.node.tryFindChild(uid)) { - throw new Error('Only a single EKS cluster can be defined within a CloudFormation stack'); - } - - return new KubectlProvider(this.stack, uid, { cluster: this }); - } - - private selectPrivateSubnets(): ec2.ISubnet[] { - const privateSubnets: ec2.ISubnet[] = []; - const vpcPrivateSubnetIds = this.vpc.privateSubnets.map(s => s.subnetId); - const vpcPublicSubnetIds = this.vpc.publicSubnets.map(s => s.subnetId); - - for (const placement of this.vpcSubnets) { - - for (const subnet of this.vpc.selectSubnets(placement).subnets) { - - if (vpcPrivateSubnetIds.includes(subnet.subnetId)) { - // definitely private, take it. - privateSubnets.push(subnet); - continue; - } - - if (vpcPublicSubnetIds.includes(subnet.subnetId)) { - // definitely public, skip it. - continue; - } - - // neither public and nor private - what is it then? this means its a subnet instance that was explicitly passed - // in the subnet selection. since ISubnet doesn't contain information on type, we have to assume its private and let it - // fail at deploy time :\ (its better than filtering it out and preventing a possibly successful deployment) - privateSubnets.push(subnet); - } - - } - - return privateSubnets; - } - - /** - * Installs the Neuron device plugin on the cluster if it's not - * already added. - */ - private addNeuronDevicePlugin() { - if (!this._neuronDevicePlugin) { - const fileContents = fs.readFileSync(path.join(__dirname, 'addons/neuron-device-plugin.yaml'), 'utf8'); - const sanitized = YAML.parse(fileContents); - this._neuronDevicePlugin = this.addManifest('NeuronDevicePlugin', sanitized); - } - - return this._neuronDevicePlugin; - } - - /** - * Opportunistically tag subnets with the required tags. - * - * If no subnets could be found (because this is an imported VPC), add a warning. - * - * @see https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html - */ - private tagSubnets() { - const tagAllSubnets = (type: string, subnets: ec2.ISubnet[], tag: string) => { - for (const subnet of subnets) { - // if this is not a concrete subnet, attach a construct warning - if (!ec2.Subnet.isVpcSubnet(subnet)) { - // message (if token): "could not auto-tag public/private subnet with tag..." - // message (if not token): "count not auto-tag public/private subnet xxxxx with tag..." - const subnetID = Token.isUnresolved(subnet.subnetId) || Token.isUnresolved([subnet.subnetId]) ? '' : ` ${subnet.subnetId}`; - Annotations.of(this).addWarning(`Could not auto-tag ${type} subnet${subnetID} with "${tag}=1", please remember to do this manually`); - continue; - } - - Tags.of(subnet).add(tag, '1'); - } - }; - - // https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html - tagAllSubnets('private', this.vpc.privateSubnets, 'kubernetes.io/role/internal-elb'); - tagAllSubnets('public', this.vpc.publicSubnets, 'kubernetes.io/role/elb'); - } - - /** - * Patches the CoreDNS deployment configuration and sets the "eks.amazonaws.com/compute-type" - * annotation to either "ec2" or "fargate". Note that if "ec2" is selected, the resource is - * omitted/removed, since the cluster is created with the "ec2" compute type by default. - */ - private defineCoreDnsComputeType(type: CoreDnsComputeType) { - // ec2 is the "built in" compute type of the cluster so if this is the - // requested type we can simply omit the resource. since the resource's - // `restorePatch` is configured to restore the value to "ec2" this means - // that deletion of the resource will change to "ec2" as well. - if (type === CoreDnsComputeType.EC2) { - return; - } - - // this is the json patch we merge into the resource based off of: - // https://docs.aws.amazon.com/eks/latest/userguide/fargate-getting-started.html#fargate-gs-coredns - const renderPatch = (computeType: CoreDnsComputeType) => ({ - spec: { - template: { - metadata: { - annotations: { - 'eks.amazonaws.com/compute-type': computeType, - }, - }, - }, - }, - }); - - new KubernetesPatch(this, 'CoreDnsComputeTypePatch', { - cluster: this, - resourceName: 'deployment/coredns', - resourceNamespace: 'kube-system', - applyPatch: renderPatch(CoreDnsComputeType.FARGATE), - restorePatch: renderPatch(CoreDnsComputeType.EC2), - }); - } -} - -/** - * Options for adding worker nodes - */ -export interface AutoScalingGroupCapacityOptions extends autoscaling.CommonAutoScalingGroupProps { - /** - * Instance type of the instances to start - */ - readonly instanceType: ec2.InstanceType; - - /** - * Will automatically update the aws-auth ConfigMap to map the IAM instance - * role to RBAC. - * - * This cannot be explicitly set to `true` if the cluster has kubectl disabled. - * - * @default - true if the cluster has kubectl enabled (which is the default). - */ - readonly mapRole?: boolean; - - /** - * Configures the EC2 user-data script for instances in this autoscaling group - * to bootstrap the node (invoke `/etc/eks/bootstrap.sh`) and associate it - * with the EKS cluster. - * - * If you wish to provide a custom user data script, set this to `false` and - * manually invoke `autoscalingGroup.addUserData()`. - * - * @default true - */ - readonly bootstrapEnabled?: boolean; - - /** - * EKS node bootstrapping options. - * - * @default - none - */ - readonly bootstrapOptions?: BootstrapOptions; - - /** - * Machine image type - * - * @default MachineImageType.AMAZON_LINUX_2 - */ - readonly machineImageType?: MachineImageType; - - /** - * Installs the AWS spot instance interrupt handler on the cluster if it's not - * already added. Only relevant if `spotPrice` is used. - * - * @default true - */ - readonly spotInterruptHandler?: boolean; -} - -/** - * EKS node bootstrapping options. - */ -export interface BootstrapOptions { - /** - * Sets `--max-pods` for the kubelet based on the capacity of the EC2 instance. - * - * @default true - */ - readonly useMaxPods?: boolean; - - /** - * Restores the docker default bridge network. - * - * @default false - */ - readonly enableDockerBridge?: boolean; - - /** - * Number of retry attempts for AWS API call (DescribeCluster). - * - * @default 3 - */ - readonly awsApiRetryAttempts?: number; - - /** - * The contents of the `/etc/docker/daemon.json` file. Useful if you want a - * custom config differing from the default one in the EKS AMI. - * - * @default - none - */ - readonly dockerConfigJson?: string; - - /** - - * Overrides the IP address to use for DNS queries within the - * cluster. - * - * @default - 10.100.0.10 or 172.20.0.10 based on the IP - * address of the primary interface. - */ - readonly dnsClusterIp?: string; - - /** - * Extra arguments to add to the kubelet. Useful for adding labels or taints. - * - * For example, `--node-labels foo=bar,goo=far`. - * - * @default - none - */ - readonly kubeletExtraArgs?: string; - - /** - * Additional command line arguments to pass to the `/etc/eks/bootstrap.sh` - * command. - * - * @see https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh - * @default - none - */ - readonly additionalArgs?: string; -} - -/** - * Options for adding an AutoScalingGroup as capacity - */ -export interface AutoScalingGroupOptions { - /** - * Will automatically update the aws-auth ConfigMap to map the IAM instance - * role to RBAC. - * - * This cannot be explicitly set to `true` if the cluster has kubectl disabled. - * - * @default - true if the cluster has kubectl enabled (which is the default). - */ - readonly mapRole?: boolean; - - /** - * Configures the EC2 user-data script for instances in this autoscaling group - * to bootstrap the node (invoke `/etc/eks/bootstrap.sh`) and associate it - * with the EKS cluster. - * - * If you wish to provide a custom user data script, set this to `false` and - * manually invoke `autoscalingGroup.addUserData()`. - * - * @default true - */ - readonly bootstrapEnabled?: boolean; - - /** - * Allows options for node bootstrapping through EC2 user data. - * @default - default options - */ - readonly bootstrapOptions?: BootstrapOptions; - - /** - * Allow options to specify different machine image type - * - * @default MachineImageType.AMAZON_LINUX_2 - */ - readonly machineImageType?: MachineImageType; - - /** - * Installs the AWS spot instance interrupt handler on the cluster if it's not - * already added. Only relevant if `spotPrice` is configured on the auto-scaling group. - * - * @default true - */ - readonly spotInterruptHandler?: boolean; -} - -/** - * Import a cluster to use in another stack - */ -class ImportedCluster extends ClusterBase { - public readonly clusterName: string; - public readonly clusterArn: string; - public readonly connections = new ec2.Connections(); - public readonly kubectlRole?: iam.IRole; - public readonly kubectlLambdaRole?: iam.IRole; - public readonly kubectlEnvironment?: { [key: string]: string; } | undefined; - public readonly kubectlSecurityGroup?: ec2.ISecurityGroup | undefined; - public readonly kubectlPrivateSubnets?: ec2.ISubnet[] | undefined; - public readonly kubectlLayer?: lambda.ILayerVersion; - public readonly awscliLayer?: lambda.ILayerVersion; - public readonly kubectlProvider?: IKubectlProvider; - public readonly onEventLayer?: lambda.ILayerVersion; - public readonly kubectlMemory?: Size; - public readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup | undefined; - public readonly prune: boolean; - - // so that `clusterSecurityGroup` on `ICluster` can be configured without optionality, avoiding users from having - // to null check on an instance of `Cluster`, which will always have this configured. - private readonly _clusterSecurityGroup?: ec2.ISecurityGroup; - - constructor(scope: Construct, id: string, private readonly props: ClusterAttributes) { - super(scope, id); - - this.clusterName = props.clusterName; - this.clusterArn = this.stack.formatArn(clusterArnComponents(props.clusterName)); - this.kubectlRole = props.kubectlRoleArn ? iam.Role.fromRoleArn(this, 'KubectlRole', props.kubectlRoleArn) : undefined; - this.kubectlLambdaRole = props.kubectlLambdaRole; - this.kubectlSecurityGroup = props.kubectlSecurityGroupId ? ec2.SecurityGroup.fromSecurityGroupId(this, 'KubectlSecurityGroup', props.kubectlSecurityGroupId) : undefined; - this.kubectlEnvironment = props.kubectlEnvironment; - this.kubectlPrivateSubnets = props.kubectlPrivateSubnetIds ? props.kubectlPrivateSubnetIds.map((subnetid, index) => ec2.Subnet.fromSubnetId(this, `KubectlSubnet${index}`, subnetid)) : undefined; - this.kubectlLayer = props.kubectlLayer; - this.awscliLayer = props.awscliLayer; - this.kubectlMemory = props.kubectlMemory; - this.clusterHandlerSecurityGroup = props.clusterHandlerSecurityGroupId ? ec2.SecurityGroup.fromSecurityGroupId(this, 'ClusterHandlerSecurityGroup', props.clusterHandlerSecurityGroupId) : undefined; - this.kubectlProvider = props.kubectlProvider; - this.onEventLayer = props.onEventLayer; - this.prune = props.prune ?? true; - - let i = 1; - for (const sgid of props.securityGroupIds ?? []) { - this.connections.addSecurityGroup(ec2.SecurityGroup.fromSecurityGroupId(this, `SecurityGroup${i}`, sgid)); - i++; - } - - if (props.clusterSecurityGroupId) { - this._clusterSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'ClusterSecurityGroup', this.clusterSecurityGroupId); - this.connections.addSecurityGroup(this._clusterSecurityGroup); - } - } - - public get vpc() { - if (!this.props.vpc) { - throw new Error('"vpc" is not defined for this imported cluster'); - } - return this.props.vpc; - } - - public get clusterSecurityGroup(): ec2.ISecurityGroup { - if (!this._clusterSecurityGroup) { - throw new Error('"clusterSecurityGroup" is not defined for this imported cluster'); - } - return this._clusterSecurityGroup; - } - - public get clusterSecurityGroupId(): string { - if (!this.props.clusterSecurityGroupId) { - throw new Error('"clusterSecurityGroupId" is not defined for this imported cluster'); - } - return this.props.clusterSecurityGroupId; - } - - public get clusterEndpoint(): string { - if (!this.props.clusterEndpoint) { - throw new Error('"clusterEndpoint" is not defined for this imported cluster'); - } - return this.props.clusterEndpoint; - } - - public get clusterCertificateAuthorityData(): string { - if (!this.props.clusterCertificateAuthorityData) { - throw new Error('"clusterCertificateAuthorityData" is not defined for this imported cluster'); - } - return this.props.clusterCertificateAuthorityData; - } - - public get clusterEncryptionConfigKeyArn(): string { - if (!this.props.clusterEncryptionConfigKeyArn) { - throw new Error('"clusterEncryptionConfigKeyArn" is not defined for this imported cluster'); - } - return this.props.clusterEncryptionConfigKeyArn; - } - - public get openIdConnectProvider(): iam.IOpenIdConnectProvider { - if (!this.props.openIdConnectProvider) { - throw new Error('"openIdConnectProvider" is not defined for this imported cluster'); - } - return this.props.openIdConnectProvider; - } - - public get awsAuth(): AwsAuth { - throw new Error('"awsAuth" is not supported on imported clusters'); - } -} - -/** - * Properties for EksOptimizedImage - */ -export interface EksOptimizedImageProps { - /** - * What instance type to retrieve the image for (standard or GPU-optimized) - * - * @default NodeType.STANDARD - */ - readonly nodeType?: NodeType; - - /** - * What cpu architecture to retrieve the image for (arm64 or x86_64) - * - * @default CpuArch.X86_64 - */ - readonly cpuArch?: CpuArch; - - /** - * The Kubernetes version to use - * - * @default - The latest version - */ - readonly kubernetesVersion?: string; -} - -/** - * Construct an Amazon Linux 2 image from the latest EKS Optimized AMI published in SSM - */ -export class EksOptimizedImage implements ec2.IMachineImage { - private readonly nodeType?: NodeType; - private readonly cpuArch?: CpuArch; - private readonly kubernetesVersion?: string; - private readonly amiParameterName: string; - - /** - * Constructs a new instance of the EcsOptimizedAmi class. - */ - public constructor(props: EksOptimizedImageProps = {}) { - this.nodeType = props.nodeType ?? NodeType.STANDARD; - this.cpuArch = props.cpuArch ?? CpuArch.X86_64; - this.kubernetesVersion = props.kubernetesVersion ?? LATEST_KUBERNETES_VERSION; - - // set the SSM parameter name - this.amiParameterName = `/aws/service/eks/optimized-ami/${this.kubernetesVersion}/` - + (this.nodeType === NodeType.STANDARD ? this.cpuArch === CpuArch.X86_64 ? - 'amazon-linux-2/' : 'amazon-linux-2-arm64/' : '') - + (this.nodeType === NodeType.GPU ? 'amazon-linux-2-gpu/' : '') - + (this.nodeType === NodeType.INFERENTIA ? 'amazon-linux-2-gpu/' : '') - + 'recommended/image_id'; - } - - /** - * Return the correct image - */ - public getImage(scope: Construct): ec2.MachineImageConfig { - const ami = ssm.StringParameter.valueForStringParameter(scope, this.amiParameterName); - return { - imageId: ami, - osType: ec2.OperatingSystemType.LINUX, - userData: ec2.UserData.forLinux(), - }; - } -} - -// MAINTAINERS: use ./scripts/kube_bump.sh to update LATEST_KUBERNETES_VERSION -const LATEST_KUBERNETES_VERSION = '1.24'; - -/** - * Whether the worker nodes should support GPU or just standard instances - */ -export enum NodeType { - /** - * Standard instances - */ - STANDARD = 'Standard', - - /** - * GPU instances - */ - GPU = 'GPU', - - /** - * Inferentia instances - */ - INFERENTIA = 'INFERENTIA', -} - -/** - * CPU architecture - */ -export enum CpuArch { - /** - * arm64 CPU type - */ - ARM_64 = 'arm64', - - /** - * x86_64 CPU type - */ - X86_64 = 'x86_64', -} - -/** - * The type of compute resources to use for CoreDNS. - */ -export enum CoreDnsComputeType { - /** - * Deploy CoreDNS on EC2 instances. - */ - EC2 = 'ec2', - - /** - * Deploy CoreDNS on Fargate-managed instances. - */ - FARGATE = 'fargate', -} - -/** - * The default capacity type for the cluster - */ -export enum DefaultCapacityType { - /** - * managed node group - */ - NODEGROUP, - /** - * EC2 autoscaling group - */ - EC2, -} - -/** - * The machine image type - */ -export enum MachineImageType { - /** - * Amazon EKS-optimized Linux AMI - */ - AMAZON_LINUX_2, - /** - * Bottlerocket AMI - */ - BOTTLEROCKET, -} - -function nodeTypeForInstanceType(instanceType: ec2.InstanceType) { - return INSTANCE_TYPES.gpu.includes(instanceType.toString().substring(0, 2)) ? NodeType.GPU : - INSTANCE_TYPES.inferentia.includes(instanceType.toString().substring(0, 4)) ? NodeType.INFERENTIA : - NodeType.STANDARD; -} - -function cpuArchForInstanceType(instanceType: ec2.InstanceType) { - return INSTANCE_TYPES.graviton2.includes(instanceType.toString().substring(0, 3)) ? CpuArch.ARM_64 : - INSTANCE_TYPES.graviton3.includes(instanceType.toString().substring(0, 3)) ? CpuArch.ARM_64 : - INSTANCE_TYPES.graviton.includes(instanceType.toString().substring(0, 2)) ? CpuArch.ARM_64 : - CpuArch.X86_64; -} - -function flatten(xss: A[][]): A[] { - return Array.prototype.concat.call([], ...xss); -} diff --git a/packages/@aws-cdk/aws-eks/lib/oidc-provider.ts b/packages/@aws-cdk/aws-eks/lib/oidc-provider.ts deleted file mode 100644 index 53a532eae5db1..0000000000000 --- a/packages/@aws-cdk/aws-eks/lib/oidc-provider.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Construct } from 'constructs'; - -/** - * Initialization properties for `OpenIdConnectProvider`. - */ -export interface OpenIdConnectProviderProps { - /** - * The URL of the identity provider. The URL must begin with https:// and - * should correspond to the iss claim in the provider's OpenID Connect ID - * tokens. Per the OIDC standard, path components are allowed but query - * parameters are not. Typically the URL consists of only a hostname, like - * https://server.example.org or https://example.com. - * - * You can find your OIDC Issuer URL by: - * aws eks describe-cluster --name %cluster_name% --query "cluster.identity.oidc.issuer" --output text - */ - readonly url: string; -} - -/** - * IAM OIDC identity providers are entities in IAM that describe an external - * identity provider (IdP) service that supports the OpenID Connect (OIDC) - * standard, such as Google or Salesforce. You use an IAM OIDC identity provider - * when you want to establish trust between an OIDC-compatible IdP and your AWS - * account. - * - * This implementation has default values for thumbprints and clientIds props - * that will be compatible with the eks cluster - * - * @see http://openid.net/connect - * @see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html - * - * @resource AWS::CloudFormation::CustomResource - */ -export class OpenIdConnectProvider extends iam.OpenIdConnectProvider { - /** - * Defines an OpenID Connect provider. - * @param scope The definition scope - * @param id Construct ID - * @param props Initialization properties - */ - public constructor(scope: Construct, id: string, props: OpenIdConnectProviderProps) { - - const clientIds = ['sts.amazonaws.com']; - - super(scope, id, { - url: props.url, - clientIds, - }); - } -} diff --git a/packages/@aws-cdk/aws-eks/lib/user-data.ts b/packages/@aws-cdk/aws-eks/lib/user-data.ts deleted file mode 100644 index f14c254b1f24f..0000000000000 --- a/packages/@aws-cdk/aws-eks/lib/user-data.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import { Stack } from '@aws-cdk/core'; -import { BootstrapOptions, ICluster } from './cluster'; - -// eslint-disable-next-line max-len -export function renderAmazonLinuxUserData(cluster: ICluster, autoScalingGroup: autoscaling.AutoScalingGroup, options: BootstrapOptions = {}): string[] { - - const stack = Stack.of(autoScalingGroup); - - // determine logical id of ASG so we can signal cloudformation - const cfn = autoScalingGroup.node.defaultChild as autoscaling.CfnAutoScalingGroup; - const asgLogicalId = cfn.logicalId; - - const extraArgs = new Array(); - - try { - const clusterEndpoint = cluster.clusterEndpoint; - const clusterCertificateAuthorityData = - cluster.clusterCertificateAuthorityData; - extraArgs.push(`--apiserver-endpoint '${clusterEndpoint}'`); - extraArgs.push(`--b64-cluster-ca '${clusterCertificateAuthorityData}'`); - } catch (e) { - /** - * Errors are ignored here. - * apiserver-endpoint and b64-cluster-ca arguments are added in #12659 to make nodes join the cluster faster. - * As these are not necessary arguments, we don't need to pass these arguments when they don't exist. - * - * @see https://github.com/aws/aws-cdk/pull/12659 - */ - } - - extraArgs.push(`--use-max-pods ${options.useMaxPods ?? true}`); - - if (options.awsApiRetryAttempts) { - extraArgs.push(`--aws-api-retry-attempts ${options.awsApiRetryAttempts}`); - } - - if (options.enableDockerBridge) { - extraArgs.push('--enable-docker-bridge true'); - } - - if (options.dockerConfigJson) { - extraArgs.push(`--docker-config-json '${options.dockerConfigJson}'`); - } - - if (options.dnsClusterIp) { - extraArgs.push(`--dns-cluster-ip ${options.dnsClusterIp}`); - } - - if (options.additionalArgs) { - extraArgs.push(options.additionalArgs); - } - - const commandLineSuffix = extraArgs.join(' '); - const kubeletExtraArgsSuffix = options.kubeletExtraArgs || ''; - - // determine lifecycle label based on whether the ASG has a spot price. - const lifecycleLabel = autoScalingGroup.spotPrice ? LifecycleLabel.SPOT : LifecycleLabel.ON_DEMAND; - const withTaints = autoScalingGroup.spotPrice ? '--register-with-taints=spotInstance=true:PreferNoSchedule' : ''; - const kubeletExtraArgs = `--node-labels lifecycle=${lifecycleLabel} ${withTaints} ${kubeletExtraArgsSuffix}`.trim(); - - return [ - 'set -o xtrace', - `/etc/eks/bootstrap.sh ${cluster.clusterName} --kubelet-extra-args "${kubeletExtraArgs}" ${commandLineSuffix}`.trim(), - `/opt/aws/bin/cfn-signal --exit-code $? --stack ${stack.stackName} --resource ${asgLogicalId} --region ${stack.region}`, - ]; -} - -export function renderBottlerocketUserData(cluster: ICluster): string[] { - return [ - '[settings.kubernetes]', - `api-server="${cluster.clusterEndpoint}"`, - `cluster-certificate="${cluster.clusterCertificateAuthorityData}"`, - `cluster-name="${cluster.clusterName}"`, - ]; -} - -/** - * The lifecycle label for node selector - */ -export enum LifecycleLabel { - /** - * on-demand instances - */ - ON_DEMAND = 'OnDemand', - /** - * spot instances - */ - SPOT = 'Ec2Spot' -} diff --git a/packages/@aws-cdk/aws-eks/package.json b/packages/@aws-cdk/aws-eks/package.json deleted file mode 100644 index ee606a5321ee1..0000000000000 --- a/packages/@aws-cdk/aws-eks/package.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "name": "@aws-cdk/aws-eks", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::EKS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.eks", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "eks" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.EKS", - "packageId": "Amazon.CDK.AWS.EKS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-eks", - "module": "aws_cdk.aws_eks", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-eks" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::EKS", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "eks" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/lambda-layer-kubectl-v24": "^2.0.121", - "aws-cdk-lib": "2.47.0", - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "@types/sinon": "^9.0.11", - "@types/yaml": "1.9.6", - "aws-sdk": "^2.1329.0", - "cdk8s": "^2.7.23", - "cdk8s-plus-24": "2.4.46", - "jest": "^27.5.1", - "sinon": "^9.2.4" - }, - "dependencies": { - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "@aws-cdk/lambda-layer-kubectl": "0.0.0", - "@aws-cdk/lambda-layer-node-proxy-agent": "0.0.0", - "constructs": "^10.0.0", - "semver": "^7.3.8", - "yaml": "1.10.2" - }, - "bundledDependencies": [ - "semver", - "yaml" - ], - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "@aws-cdk/lambda-layer-kubectl": "0.0.0", - "@aws-cdk/lambda-layer-node-proxy-agent": "0.0.0", - "constructs": "^10.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-no-arn-refs:@aws-cdk/aws-eks.ClusterProps.outputMastersRoleArn", - "props-physical-name:@aws-cdk/aws-eks.OpenIdConnectProviderProps", - "resource-attribute:@aws-cdk/aws-eks.Cluster.clusterKubernetesNetworkConfigServiceIpv6Cidr", - "resource-attribute:@aws-cdk/aws-eks.FargateCluster.clusterKubernetesNetworkConfigServiceIpv6Cidr", - "resource-attribute:@aws-cdk/aws-eks.Nodegroup.nodegroupId", - "resource-attribute:@aws-cdk/aws-eks.Cluster.clusterId", - "resource-attribute:@aws-cdk/aws-eks.FargateCluster.clusterId" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-eks/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-eks/rosetta/default.ts-fixture deleted file mode 100644 index a18b3f87d0f3d..0000000000000 --- a/packages/@aws-cdk/aws-eks/rosetta/default.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -import { Construct } from 'constructs'; -import { CfnOutput, Fn, Size, Stack } from '@aws-cdk/core'; -import * as eks from '@aws-cdk/aws-eks'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; - -class Context extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-eks/test/bucket-pinger/bucket-pinger.ts b/packages/@aws-cdk/aws-eks/test/bucket-pinger/bucket-pinger.ts deleted file mode 100644 index 1159a54f6a480..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/bucket-pinger/bucket-pinger.ts +++ /dev/null @@ -1,49 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { CustomResource, Token, Duration } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import { Construct } from 'constructs'; - -export interface BucketPingerProps { - readonly bucketName: string; - readonly timeout?: Duration; -} -export class BucketPinger extends Construct { - - private _resource: CustomResource; - - constructor(scope: Construct, id: string, props: BucketPingerProps) { - super(scope, id); - - const func = new lambda.Function(this, 'Function', { - code: lambda.Code.fromAsset(`${__dirname}/function`), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - timeout: props.timeout ?? Duration.minutes(1), - environment: { - BUCKET_NAME: props.bucketName, - }, - }); - - if (!func.role) { - throw new Error('pinger lambda has no execution role!'); - } - - func.role.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['s3:DeleteBucket', 's3:ListBucket'], - resources: [`arn:aws:s3:::${props.bucketName}`], - })); - - const provider = new cr.Provider(this, 'Provider', { - onEventHandler: func, - }); - - this._resource = new CustomResource(this, 'Resource', { - serviceToken: provider.serviceToken, - }); - } - - public get response() { - return Token.asString(this._resource.getAtt('Value')); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/cluster.test.ts b/packages/@aws-cdk/aws-eks/test/cluster.test.ts deleted file mode 100644 index f94034a4bef0d..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/cluster.test.ts +++ /dev/null @@ -1,3190 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as asg from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import * as cdk8s from 'cdk8s'; -import { Construct } from 'constructs'; -import * as YAML from 'yaml'; -import { testFixture, testFixtureNoVpc } from './util'; -import * as eks from '../lib'; -import { HelmChart } from '../lib'; -import { KubectlProvider } from '../lib/kubectl-provider'; -import { BottleRocketImage } from '../lib/private/bottlerocket'; - -/* eslint-disable max-len */ - -const CLUSTER_VERSION = eks.KubernetesVersion.V1_25; - -describe('cluster', () => { - test('can configure and access ALB controller', () => { - const { stack } = testFixture(); - - const cluster = new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - albController: { - version: eks.AlbControllerVersion.V2_4_1, - }, - }); - - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-HelmChart', { - Chart: 'aws-load-balancer-controller', - }); - expect(cluster.albController).toBeDefined(); - }); - - test('can specify custom environment to cluster resource handler', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - clusterHandlerEnvironment: { - foo: 'bar', - }, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; - - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - Environment: { Variables: { foo: 'bar' } }, - }); - }); - - test('can specify security group to cluster resource handler', () => { - const { stack, vpc } = testFixture(); - const securityGroup = new ec2.SecurityGroup(stack, 'ProxyInstanceSG', { - vpc, - allowAllOutbound: false, - }); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - placeClusterHandlerInVpc: true, - clusterHandlerSecurityGroup: securityGroup, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; - - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { - SecurityGroupIds: [{ Ref: 'referencetoStackProxyInstanceSG80B79D87GroupId' }], - }, - }); - }); - - test('throws when trying to place cluster handlers in a vpc with no private subnets', () => { - const { stack } = testFixture(); - - const vpc = new ec2.Vpc(stack, 'Vpc'); - - expect(() => { - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - placeClusterHandlerInVpc: true, - vpc: vpc, - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], - }); - }).toThrow(/Cannot place cluster handler in the VPC since no private subnets could be selected/); - }); - - test('throws when provided `clusterHandlerSecurityGroup` without `placeClusterHandlerInVpc: true`', () => { - const { stack, vpc } = testFixture(); - const securityGroup = new ec2.SecurityGroup(stack, 'ProxyInstanceSG', { - vpc, - allowAllOutbound: false, - }); - - expect(() => { - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - clusterHandlerSecurityGroup: securityGroup, - }); - }).toThrow(/Cannot specify clusterHandlerSecurityGroup without placeClusterHandlerInVpc set to true/); - }); - - describe('imported Vpc from unparseable list tokens', () => { - let stack: cdk.Stack; - let vpc: ec2.IVpc; - - beforeEach(() => { - stack = new cdk.Stack(); - const vpcId = cdk.Fn.importValue('myVpcId'); - const availabilityZones = cdk.Fn.split(',', cdk.Fn.importValue('myAvailabilityZones')); - const publicSubnetIds = cdk.Fn.split(',', cdk.Fn.importValue('myPublicSubnetIds')); - const privateSubnetIds = cdk.Fn.split(',', cdk.Fn.importValue('myPrivateSubnetIds')); - const isolatedSubnetIds = cdk.Fn.split(',', cdk.Fn.importValue('myIsolatedSubnetIds')); - - vpc = ec2.Vpc.fromVpcAttributes(stack, 'importedVpc', { - vpcId, - availabilityZones, - publicSubnetIds, - privateSubnetIds, - isolatedSubnetIds, - }); - }); - - test('throws if selecting more than one subnet group', () => { - expect(() => new eks.Cluster(stack, 'Cluster', { - vpc: vpc, - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }], - defaultCapacity: 0, - version: eks.KubernetesVersion.V1_21, - })).toThrow(/cannot select multiple subnet groups/); - }); - - test('synthesis works if only one subnet group is selected', () => { - // WHEN - new eks.Cluster(stack, 'Cluster', { - vpc: vpc, - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], - defaultCapacity: 0, - version: eks.KubernetesVersion.V1_21, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { - Config: { - resourcesVpcConfig: { - subnetIds: { - 'Fn::Split': [ - ',', - { 'Fn::ImportValue': 'myPublicSubnetIds' }, - ], - }, - }, - }, - }); - }); - }); - - test('throws when accessing cluster security group for imported cluster without cluster security group id', () => { - const { stack } = testFixture(); - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - }); - - expect(() => cluster.clusterSecurityGroup).toThrow(/"clusterSecurityGroup" is not defined for this imported cluster/); - }); - - test('can place cluster handlers in the cluster vpc', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - placeClusterHandlerInVpc: true, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; - const template = Template.fromStack(nested); - const resources = template.findResources('AWS::Lambda::Function'); - - function assertFunctionPlacedInVpc(id: string) { - expect(resources[id].Properties.VpcConfig.SubnetIds).toEqual([ - { Ref: 'referencetoStackClusterDefaultVpcPrivateSubnet1SubnetA64D1BF0Ref' }, - { Ref: 'referencetoStackClusterDefaultVpcPrivateSubnet2Subnet32D85AB8Ref' }, - ]); - } - - assertFunctionPlacedInVpc('OnEventHandler42BEBAE0'); - assertFunctionPlacedInVpc('IsCompleteHandler7073F4DA'); - assertFunctionPlacedInVpc('ProviderframeworkonEvent83C1D0A7'); - assertFunctionPlacedInVpc('ProviderframeworkisComplete26D7B0CB'); - assertFunctionPlacedInVpc('ProviderframeworkonTimeout0B47CA38'); - }); - - test('can access cluster security group for imported cluster with cluster security group id', () => { - const { stack } = testFixture(); - - const clusterSgId = 'cluster-sg-id'; - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - clusterSecurityGroupId: clusterSgId, - }); - - const clusterSg = cluster.clusterSecurityGroup; - - expect(clusterSg.securityGroupId).toEqual(clusterSgId); - }); - - test('cluster security group is attached when adding self-managed nodes', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('self-managed', { - instanceType: new ec2.InstanceType('t2.medium'), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - SecurityGroups: [ - { 'Fn::GetAtt': ['ClusterselfmanagedInstanceSecurityGroup64468C3A', 'GroupId'] }, - { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, - ], - }); - }); - - test('security group of self-managed asg is not tagged with owned', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - version: CLUSTER_VERSION, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('self-managed', { - instanceType: new ec2.InstanceType('t2.medium'), - }); - - let template = Template.fromStack(stack); - template.hasResourceProperties('AWS::EC2::SecurityGroup', { - Tags: [{ Key: 'Name', Value: 'Stack/Cluster/self-managed' }], - }); - }); - - test('connect autoscaling group with imported cluster', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - const importedCluster = eks.Cluster.fromClusterAttributes(stack, 'ImportedCluster', { - clusterName: cluster.clusterName, - clusterSecurityGroupId: cluster.clusterSecurityGroupId, - }); - - const selfManaged = new asg.AutoScalingGroup(stack, 'self-managed', { - instanceType: new ec2.InstanceType('t2.medium'), - vpc: vpc, - machineImage: new ec2.AmazonLinuxImage(), - }); - - // WHEN - importedCluster.connectAutoScalingGroupCapacity(selfManaged, {}); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - SecurityGroups: [ - { 'Fn::GetAtt': ['selfmanagedInstanceSecurityGroupEA6D80C9', 'GroupId'] }, - { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, - ], - }); - }); - - test('cluster security group is attached when connecting self-managed nodes', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - const selfManaged = new asg.AutoScalingGroup(stack, 'self-managed', { - instanceType: new ec2.InstanceType('t2.medium'), - vpc: vpc, - machineImage: new ec2.AmazonLinuxImage(), - }); - - // WHEN - cluster.connectAutoScalingGroupCapacity(selfManaged, {}); - - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { - SecurityGroups: [ - { 'Fn::GetAtt': ['selfmanagedInstanceSecurityGroupEA6D80C9', 'GroupId'] }, - { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, - ], - }); - }); - - test('spot interrupt handler is not added if spotInterruptHandler is false when connecting self-managed nodes', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - const selfManaged = new asg.AutoScalingGroup(stack, 'self-managed', { - instanceType: new ec2.InstanceType('t2.medium'), - vpc: vpc, - machineImage: new ec2.AmazonLinuxImage(), - spotPrice: '0.1', - }); - - // WHEN - cluster.connectAutoScalingGroupCapacity(selfManaged, { spotInterruptHandler: false }); - - expect(cluster.node.findAll().filter(c => c.node.id === 'chart-spot-interrupt-handler').length).toEqual(0); - }); - - test('throws when a non cdk8s chart construct is added as cdk8s chart', () => { - const { stack } = testFixture(); - - const cluster = new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - - // create a plain construct, not a cdk8s chart - const someConstruct = new Construct(stack, 'SomeConstruct'); - - expect(() => cluster.addCdk8sChart('chart', someConstruct)).toThrow(/Invalid cdk8s chart. Must contain a \'toJson\' method, but found undefined/); - }); - - test('throws when a core construct is added as cdk8s chart', () => { - const { stack } = testFixture(); - - const cluster = new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - - // create a plain construct, not a cdk8s chart - const someConstruct = new Construct(stack, 'SomeConstruct'); - - expect(() => cluster.addCdk8sChart('chart', someConstruct)).toThrow(/Invalid cdk8s chart. Must contain a \'toJson\' method, but found undefined/); - }); - - test('cdk8s chart can be added to cluster', () => { - const { stack } = testFixture(); - - const cluster = new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - - const app = new cdk8s.App(); - const chart = new cdk8s.Chart(app, 'Chart'); - - new cdk8s.ApiObject(chart, 'FakePod', { - apiVersion: 'v1', - kind: 'Pod', - metadata: { - name: 'fake-pod', - labels: { - // adding aws-cdk token to cdk8s chart - clusterName: cluster.clusterName, - }, - }, - }); - - cluster.addCdk8sChart('cdk8s-chart', chart); - - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesResource', { - Manifest: { - 'Fn::Join': [ - '', - [ - '[{"apiVersion":"v1","kind":"Pod","metadata":{"labels":{"clusterName":"', - { - Ref: 'Cluster9EE0221C', - }, - '"},"name":"fake-pod"}}]', - ], - ], - }, - }); - }); - - test('cluster connections include both control plane and cluster security group', () => { - const { stack } = testFixture(); - - const cluster = new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - - expect(cluster.connections.securityGroups.map(sg => stack.resolve(sg.securityGroupId))).toEqual([ - { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, - { 'Fn::GetAtt': ['ClusterControlPlaneSecurityGroupD274242C', 'GroupId'] }, - ]); - }); - - test('can declare a security group from a different stack', () => { - class ClusterStack extends cdk.Stack { - public eksCluster: eks.Cluster; - - constructor(scope: Construct, id: string, props: { sg: ec2.ISecurityGroup, vpc: ec2.IVpc }) { - super(scope, id); - this.eksCluster = new eks.Cluster(this, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - securityGroup: props.sg, - vpc: props.vpc, - }); - } - } - - class NetworkStack extends cdk.Stack { - public readonly securityGroup: ec2.ISecurityGroup; - public readonly vpc: ec2.IVpc; - - constructor(scope: Construct, id: string) { - super(scope, id); - this.vpc = new ec2.Vpc(this, 'Vpc'); - this.securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc: this.vpc }); - } - } - - const { app } = testFixture(); - const networkStack = new NetworkStack(app, 'NetworkStack'); - new ClusterStack(app, 'ClusterStack', { sg: networkStack.securityGroup, vpc: networkStack.vpc }); - - // make sure we can synth (no circular dependencies between the stacks) - app.synth(); - }); - - test('can declare a manifest with a token from a different stack than the cluster that depends on the cluster stack', () => { - class ClusterStack extends cdk.Stack { - public eksCluster: eks.Cluster; - - constructor(scope: Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - this.eksCluster = new eks.Cluster(this, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - } - } - - class ManifestStack extends cdk.Stack { - constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { - super(scope, id, props); - - // this role creates a dependency between this stack and the cluster stack - const role = new iam.Role(this, 'CrossRole', { - assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), - roleName: props.cluster.clusterArn, - }); - - // make sure this manifest doesn't create a dependency between the cluster stack - // and this stack - new eks.KubernetesManifest(this, 'cross-stack', { - manifest: [{ - kind: 'ConfigMap', - apiVersion: 'v1', - metadata: { - name: 'config-map', - }, - data: { - foo: role.roleArn, - }, - }], - cluster: props.cluster, - }); - } - } - - const { app } = testFixture(); - const clusterStack = new ClusterStack(app, 'ClusterStack'); - new ManifestStack(app, 'ManifestStack', { cluster: clusterStack.eksCluster }); - - // make sure we can synth (no circular dependencies between the stacks) - app.synth(); - }); - - test('can declare a chart with a token from a different stack than the cluster that depends on the cluster stack', () => { - class ClusterStack extends cdk.Stack { - public eksCluster: eks.Cluster; - - constructor(scope: Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - this.eksCluster = new eks.Cluster(this, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - } - } - - class ChartStack extends cdk.Stack { - constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { - super(scope, id, props); - - // this role creates a dependency between this stack and the cluster stack - const role = new iam.Role(this, 'CrossRole', { - assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), - roleName: props.cluster.clusterArn, - }); - - // make sure this chart doesn't create a dependency between the cluster stack - // and this stack - new eks.HelmChart(this, 'cross-stack', { - chart: role.roleArn, - cluster: props.cluster, - }); - } - } - - const { app } = testFixture(); - const clusterStack = new ClusterStack(app, 'ClusterStack'); - new ChartStack(app, 'ChartStack', { cluster: clusterStack.eksCluster }); - - // make sure we can synth (no circular dependencies between the stacks) - app.synth(); - }); - - test('can declare a HelmChart in a different stack than the cluster', () => { - class ClusterStack extends cdk.Stack { - public eksCluster: eks.Cluster; - - constructor(scope: Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - this.eksCluster = new eks.Cluster(this, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - } - } - - class ChartStack extends cdk.Stack { - constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { - super(scope, id, props); - - const resource = new cdk.CfnResource(this, 'resource', { type: 'MyType' }); - new eks.HelmChart(this, `chart-${id}`, { cluster: props.cluster, chart: resource.ref }); - - } - } - - const { app } = testFixture(); - const clusterStack = new ClusterStack(app, 'ClusterStack'); - new ChartStack(app, 'ChartStack', { cluster: clusterStack.eksCluster }); - - // make sure we can synth (no circular dependencies between the stacks) - app.synth(); - }); - - test('throws when declaring an ASG role in a different stack than the cluster', () => { - class ClusterStack extends cdk.Stack { - public eksCluster: eks.Cluster; - - constructor(scope: Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - this.eksCluster = new eks.Cluster(this, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - }); - } - } - - class CapacityStack extends cdk.Stack { - - public group: asg.AutoScalingGroup; - - constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { - super(scope, id, props); - - // the role is create in this stack implicitly by the ASG - this.group = new asg.AutoScalingGroup(this, 'autoScaling', { - instanceType: new ec2.InstanceType('t3.medium'), - vpc: props.cluster.vpc, - machineImage: new eks.EksOptimizedImage({ - kubernetesVersion: CLUSTER_VERSION.version, - nodeType: eks.NodeType.STANDARD, - }), - }); - } - } - - const { app } = testFixture(); - const clusterStack = new ClusterStack(app, 'ClusterStack'); - const capacityStack = new CapacityStack(app, 'CapacityStack', { cluster: clusterStack.eksCluster }); - - expect(() => { - clusterStack.eksCluster.connectAutoScalingGroupCapacity(capacityStack.group, {}); - }).toThrow( - 'CapacityStack/autoScaling/InstanceRole should be defined in the scope of the ClusterStack stack to prevent circular dependencies', - ); - }); - - test('can declare a ServiceAccount in a different stack than the cluster', () => { - class ClusterStack extends cdk.Stack { - public eksCluster: eks.Cluster; - - constructor(scope: Construct, id: string, props?: cdk.StackProps) { - super(scope, id, props); - this.eksCluster = new eks.Cluster(this, 'EKSCluster', { - version: CLUSTER_VERSION, - prune: false, - }); - } - } - - class AppStack extends cdk.Stack { - constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { - super(scope, id, props); - - new eks.ServiceAccount(this, 'testAccount', { cluster: props.cluster, name: 'test-account', namespace: 'test' }); - } - } - - const { app } = testFixture(); - const clusterStack = new ClusterStack(app, 'EKSCluster'); - new AppStack(app, 'KubeApp', { cluster: clusterStack.eksCluster }); - - // make sure we can synth (no circular dependencies between the stacks) - app.synth(); - }); - - test('a default cluster spans all subnets', () => { - // GIVEN - const { stack, vpc } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { - Config: { - roleArn: { 'Fn::GetAtt': ['ClusterRoleFA261979', 'Arn'] }, - version: CLUSTER_VERSION.version, - resourcesVpcConfig: { - securityGroupIds: [{ 'Fn::GetAtt': ['ClusterControlPlaneSecurityGroupD274242C', 'GroupId'] }], - subnetIds: [ - { Ref: 'VPCPublicSubnet1SubnetB4246D30' }, - { Ref: 'VPCPublicSubnet2Subnet74179F39' }, - { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, - { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, - ], - }, - }, - }); - }); - - test('cluster handler gets created with STS regional endpoint configuration', () => { - // This is necessary to make aws-sdk-jsv2 work in opt-in regions - - // GIVEN - const { stack, vpc } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // THEN - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - AWS_STS_REGIONAL_ENDPOINTS: 'regional', - }, - }, - }); - }); - - test('if "vpc" is not specified, vpc with default configuration will be created', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { version: CLUSTER_VERSION, prune: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', Match.anyValue()); - }); - - describe('default capacity', () => { - test('x2 m5.large by default', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - const cluster = new eks.Cluster(stack, 'cluster', { version: CLUSTER_VERSION, prune: false }); - - // THEN - expect(cluster.defaultNodegroup).toBeDefined(); - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - InstanceTypes: [ - 'm5.large', - ], - ScalingConfig: { - DesiredSize: 2, - MaxSize: 2, - MinSize: 2, - }, - }); - }); - - test('quantity and type can be customized', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - const cluster = new eks.Cluster(stack, 'cluster', { - defaultCapacity: 10, - defaultCapacityInstance: new ec2.InstanceType('m2.xlarge'), - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - expect(cluster.defaultNodegroup).toBeDefined(); - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - ScalingConfig: { - DesiredSize: 10, - MaxSize: 10, - MinSize: 10, - }, - }); - // expect(stack).toHaveResource('AWS::AutoScaling::LaunchConfiguration', { InstanceType: 'm2.xlarge' })); - }); - - test('defaultCapacity=0 will not allocate at all', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - const cluster = new eks.Cluster(stack, 'cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // THEN - expect(cluster.defaultCapacity).toBeUndefined(); - Template.fromStack(stack).resourceCountIs('AWS::AutoScaling::AutoScalingGroup', 0); - Template.fromStack(stack).resourceCountIs('AWS::AutoScaling::LaunchConfiguration', 0); - }); - }); - - test('creating a cluster tags the private VPC subnets', () => { - // GIVEN - const { stack, vpc } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', { - Tags: [ - { Key: 'aws-cdk:subnet-name', Value: 'Private' }, - { Key: 'aws-cdk:subnet-type', Value: 'Private' }, - { Key: 'kubernetes.io/role/internal-elb', Value: '1' }, - { Key: 'Name', Value: 'Stack/VPC/PrivateSubnet1' }, - ], - }); - }); - - test('creating a cluster tags the public VPC subnets', () => { - // GIVEN - const { stack, vpc } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', { - MapPublicIpOnLaunch: true, - Tags: [ - { Key: 'aws-cdk:subnet-name', Value: 'Public' }, - { Key: 'aws-cdk:subnet-type', Value: 'Public' }, - { Key: 'kubernetes.io/role/elb', Value: '1' }, - { Key: 'Name', Value: 'Stack/VPC/PublicSubnet1' }, - ], - }); - }); - - test('adding capacity creates an ASG without a rolling update policy', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('Default', { - instanceType: new ec2.InstanceType('t2.medium'), - }); - - Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { - UpdatePolicy: { AutoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: true } }, - }); - }); - - test('adding capacity creates an ASG with tags', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('Default', { - instanceType: new ec2.InstanceType('t2.medium'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - Tags: [ - { - Key: { 'Fn::Join': ['', ['kubernetes.io/cluster/', { Ref: 'Cluster9EE0221C' }]] }, - PropagateAtLaunch: true, - Value: 'owned', - }, - { - Key: 'Name', - PropagateAtLaunch: true, - Value: 'Stack/Cluster/Default', - }, - ], - }); - }); - - test('create nodegroup with existing role', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - const cluster = new eks.Cluster(stack, 'cluster', { - defaultCapacity: 10, - defaultCapacityInstance: new ec2.InstanceType('m2.xlarge'), - version: CLUSTER_VERSION, - prune: false, - }); - - const existingRole = new iam.Role(stack, 'ExistingRole', { - assumedBy: new iam.AccountRootPrincipal(), - }); - - new eks.Nodegroup(stack, 'Nodegroup', { - cluster, - nodeRole: existingRole, - }); - - // THEN - expect(cluster.defaultNodegroup).toBeDefined(); - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - ScalingConfig: { - DesiredSize: 10, - MaxSize: 10, - MinSize: 10, - }, - }); - }); - - test('adding bottlerocket capacity creates an ASG with tags', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('Bottlerocket', { - instanceType: new ec2.InstanceType('t2.medium'), - machineImageType: eks.MachineImageType.BOTTLEROCKET, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { - Tags: [ - { - Key: { 'Fn::Join': ['', ['kubernetes.io/cluster/', { Ref: 'Cluster9EE0221C' }]] }, - PropagateAtLaunch: true, - Value: 'owned', - }, - { - Key: 'Name', - PropagateAtLaunch: true, - Value: 'Stack/Cluster/Bottlerocket', - }, - ], - }); - }); - - test('adding bottlerocket capacity with bootstrapOptions throws error', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - expect(() => cluster.addAutoScalingGroupCapacity('Bottlerocket', { - instanceType: new ec2.InstanceType('t2.medium'), - machineImageType: eks.MachineImageType.BOTTLEROCKET, - bootstrapOptions: {}, - })).toThrow(/bootstrapOptions is not supported for Bottlerocket/); - }); - - test('import cluster with existing kubectl provider function', () => { - const { stack } = testFixture(); - - const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); - const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { - functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', - kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', - handlerRole: handlerRole, - }); - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - kubectlProvider: kubectlProvider, - }); - - expect(cluster.kubectlProvider).toEqual(kubectlProvider); - }); - - describe('import cluster with existing kubectl provider function should work as expected with resources relying on kubectl getOrCreate', () => { - test('creates helm chart', () => { - const { stack } = testFixture(); - - const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); - const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { - functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', - kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', - handlerRole: handlerRole, - }); - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - kubectlProvider: kubectlProvider, - }); - - new eks.HelmChart(stack, 'Chart', { - cluster: cluster, - chart: 'chart', - }); - - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-HelmChart', { - ServiceToken: kubectlProvider.serviceToken, - RoleArn: kubectlProvider.roleArn, - }); - }); - - test('creates Kubernetes patch', () => { - const { stack } = testFixture(); - - const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); - const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { - functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', - kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', - handlerRole: handlerRole, - }); - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - kubectlProvider: kubectlProvider, - }); - - new eks.HelmChart(stack, 'Chart', { - cluster: cluster, - chart: 'chart', - }); - - new eks.KubernetesPatch(stack, 'Patch', { - cluster: cluster, - applyPatch: {}, - restorePatch: {}, - resourceName: 'PatchResource', - }); - - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesPatch', { - ServiceToken: kubectlProvider.serviceToken, - RoleArn: kubectlProvider.roleArn, - }); - }); - - test('creates Kubernetes object value', () => { - const { stack } = testFixture(); - - const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); - const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { - functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', - kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', - handlerRole: handlerRole, - }); - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - kubectlProvider: kubectlProvider, - }); - - new eks.HelmChart(stack, 'Chart', { - cluster: cluster, - chart: 'chart', - }); - - new eks.KubernetesPatch(stack, 'Patch', { - cluster: cluster, - applyPatch: {}, - restorePatch: {}, - resourceName: 'PatchResource', - }); - - new eks.KubernetesManifest(stack, 'Manifest', { - cluster: cluster, - manifest: [], - }); - - new eks.KubernetesObjectValue(stack, 'ObjectValue', { - cluster: cluster, - jsonPath: '', - objectName: 'name', - objectType: 'type', - }); - - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesObjectValue', { - ServiceToken: kubectlProvider.serviceToken, - RoleArn: kubectlProvider.roleArn, - }); - - expect(cluster.kubectlProvider).not.toBeInstanceOf(eks.KubectlProvider); - }); - }); - - test('import cluster with new kubectl private subnets', () => { - const { stack, vpc } = testFixture(); - - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { - clusterName: 'cluster', - kubectlPrivateSubnetIds: vpc.privateSubnets.map(s => s.subnetId), - }); - - expect(cluster.kubectlPrivateSubnets?.map(s => stack.resolve(s.subnetId))).toEqual([ - { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, - { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, - ]); - - expect(cluster.kubectlPrivateSubnets?.map(s => s.node.id)).toEqual([ - 'KubectlSubnet0', - 'KubectlSubnet1', - ]); - }); - - test('exercise export/import', () => { - // GIVEN - const { stack: stack1, vpc, app } = testFixture(); - const stack2 = new cdk.Stack(app, 'stack2', { env: { region: 'us-east-1' } }); - const cluster = new eks.Cluster(stack1, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - const imported = eks.Cluster.fromClusterAttributes(stack2, 'Imported', { - vpc: cluster.vpc, - clusterEndpoint: cluster.clusterEndpoint, - clusterName: cluster.clusterName, - securityGroupIds: cluster.connections.securityGroups.map(x => x.securityGroupId), - clusterCertificateAuthorityData: cluster.clusterCertificateAuthorityData, - clusterSecurityGroupId: cluster.clusterSecurityGroupId, - clusterEncryptionConfigKeyArn: cluster.clusterEncryptionConfigKeyArn, - }); - - // this should cause an export/import - new cdk.CfnOutput(stack2, 'ClusterARN', { value: imported.clusterArn }); - - // THEN - Template.fromStack(stack2).templateMatches({ - Outputs: { - ClusterARN: { - Value: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':eks:us-east-1:', - { - Ref: 'AWS::AccountId', - }, - ':cluster/', - { - 'Fn::ImportValue': 'Stack:ExportsOutputRefCluster9EE0221C4853B4C3', - }, - ], - ], - }, - }, - }, - }); - }); - - test('mastersRole can be used to map an IAM role to "system:masters"', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const role = new iam.Role(stack, 'role', { assumedBy: new iam.AnyPrincipal() }); - - // WHEN - new eks.Cluster(stack, 'Cluster', { - vpc, - mastersRole: role, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { - Manifest: { - 'Fn::Join': [ - '', - [ - '[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"aws-auth","namespace":"kube-system"},"data":{"mapRoles":"[{\\"rolearn\\":\\"', - { - 'Fn::GetAtt': [ - 'roleC7B7E775', - 'Arn', - ], - }, - '\\",\\"username\\":\\"', - { - 'Fn::GetAtt': [ - 'roleC7B7E775', - 'Arn', - ], - }, - '\\",\\"groups\\":[\\"system:masters\\"]}]","mapUsers":"[]","mapAccounts":"[]"}}]', - ], - ], - }, - }); - }); - - test('addManifest can be used to apply k8s manifests on this cluster', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addManifest('manifest1', { foo: 123 }); - cluster.addManifest('manifest2', { bar: 123 }, { boor: [1, 2, 3] }); - - // THEN - Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { - Manifest: '[{"foo":123}]', - }); - - Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { - Manifest: '[{"bar":123},{"boor":[1,2,3]}]', - }); - }); - - test('kubectl resources can be created in a separate stack', () => { - // GIVEN - const { stack, app } = testFixture(); - const cluster = new eks.Cluster(stack, 'cluster', { version: CLUSTER_VERSION, prune: false }); // cluster is under stack2 - - // WHEN resource is under stack2 - const stack2 = new cdk.Stack(app, 'stack2', { env: { account: stack.account, region: stack.region } }); - new eks.KubernetesManifest(stack2, 'myresource', { - cluster, - manifest: [{ foo: 'bar' }], - }); - - // THEN - app.synth(); // no cyclic dependency (see https://github.com/aws/aws-cdk/issues/7231) - - // expect a single resource in the 2nd stack - Template.fromStack(stack2).templateMatches({ - Resources: { - myresource49C6D325: { - Type: 'Custom::AWSCDK-EKS-KubernetesResource', - Properties: { - ServiceToken: { - 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttawscdkawseksKubectlProviderNestedStackawscdkawseksKubectlProviderNestedStackResourceA7AEBA6BOutputsStackawscdkawseksKubectlProviderframeworkonEvent8897FD9BArn49BEF20C', - }, - Manifest: '[{\"foo\":\"bar\"}]', - ClusterName: { 'Fn::ImportValue': 'Stack:ExportsOutputRefclusterC5B25D0D98D553F5' }, - RoleArn: { 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttclusterCreationRole2B3B5002ArnF05122FC' }, - }, - UpdateReplacePolicy: 'Delete', - DeletionPolicy: 'Delete', - }, - }, - }); - }); - - test('adding capacity will automatically map its IAM role', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('default', { - instanceType: new ec2.InstanceType('t2.nano'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { - Manifest: { - 'Fn::Join': [ - '', - [ - '[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"aws-auth","namespace":"kube-system"},"data":{"mapRoles":"[{\\"rolearn\\":\\"', - { - 'Fn::GetAtt': [ - 'ClusterMastersRole9AA35625', - 'Arn', - ], - }, - '\\",\\"username\\":\\"', - { - 'Fn::GetAtt': [ - 'ClusterMastersRole9AA35625', - 'Arn', - ], - }, - '\\",\\"groups\\":[\\"system:masters\\"]},{\\"rolearn\\":\\"', - { - 'Fn::GetAtt': [ - 'ClusterdefaultInstanceRoleF20A29CD', - 'Arn', - ], - }, - '\\",\\"username\\":\\"system:node:{{EC2PrivateDNSName}}\\",\\"groups\\":[\\"system:bootstrappers\\",\\"system:nodes\\"]}]","mapUsers":"[]","mapAccounts":"[]"}}]', - ], - ], - }, - }); - }); - - test('addAutoScalingGroupCapacity will *not* map the IAM role if mapRole is false', () => { - // GIVEN - const { stack, vpc } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { - vpc, - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addAutoScalingGroupCapacity('default', { - instanceType: new ec2.InstanceType('t2.nano'), - mapRole: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { - Manifest: { - 'Fn::Join': [ - '', - [ - '[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"aws-auth","namespace":"kube-system"},"data":{"mapRoles":"[{\\"rolearn\\":\\"', - { - 'Fn::GetAtt': [ - 'ClusterMastersRole9AA35625', - 'Arn', - ], - }, - '\\",\\"username\\":\\"', - { - 'Fn::GetAtt': [ - 'ClusterMastersRole9AA35625', - 'Arn', - ], - }, - '\\",\\"groups\\":[\\"system:masters\\"]}]","mapUsers":"[]","mapAccounts":"[]"}}]', - ], - ], - }, - }); - }); - - describe('outputs', () => { - test('aws eks update-kubeconfig is the only output synthesized by default', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { version: CLUSTER_VERSION, prune: false }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Outputs).toEqual({ - ClusterConfigCommand43AAE40F: { Value: { 'Fn::Join': ['', ['aws eks update-kubeconfig --name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['ClusterMastersRole9AA35625', 'Arn'] }]] } }, - ClusterGetTokenCommand06AE992E: { Value: { 'Fn::Join': ['', ['aws eks get-token --cluster-name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['ClusterMastersRole9AA35625', 'Arn'] }]] } }, - }); - }); - - test('if masters role is defined, it should be included in the config command', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - const mastersRole = new iam.Role(stack, 'masters', { assumedBy: new iam.AccountRootPrincipal() }); - new eks.Cluster(stack, 'Cluster', { - mastersRole, - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Outputs).toEqual({ - ClusterConfigCommand43AAE40F: { Value: { 'Fn::Join': ['', ['aws eks update-kubeconfig --name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['masters0D04F23D', 'Arn'] }]] } }, - ClusterGetTokenCommand06AE992E: { Value: { 'Fn::Join': ['', ['aws eks get-token --cluster-name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['masters0D04F23D', 'Arn'] }]] } }, - }); - }); - - test('if `outputConfigCommand=false` will disabled the output', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - const mastersRole = new iam.Role(stack, 'masters', { assumedBy: new iam.AccountRootPrincipal() }); - new eks.Cluster(stack, 'Cluster', { - mastersRole, - outputConfigCommand: false, - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Outputs).toBeUndefined(); // no outputs - }); - - test('`outputClusterName` can be used to synthesize an output with the cluster name', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { - outputConfigCommand: false, - outputClusterName: true, - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Outputs).toEqual({ - ClusterClusterNameEB26049E: { Value: { Ref: 'Cluster9EE0221C' } }, - }); - }); - - test('`outputMastersRoleArn` can be used to synthesize an output with the arn of the masters role if defined', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { - outputConfigCommand: false, - outputMastersRoleArn: true, - mastersRole: new iam.Role(stack, 'masters', { assumedBy: new iam.AccountRootPrincipal() }), - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - const assembly = app.synth(); - const template = assembly.getStackByName(stack.stackName).template; - expect(template.Outputs).toEqual({ - ClusterMastersRoleArnB15964B1: { Value: { 'Fn::GetAtt': ['masters0D04F23D', 'Arn'] } }, - }); - }); - - describe('boostrap user-data', () => { - test('rendered by default for ASGs', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('MyCapcity', { instanceType: new ec2.InstanceType('m3.xlargs') }); - - // THEN - const template = app.synth().getStackByName(stack.stackName).template; - const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; - expect(userData).toEqual({ 'Fn::Base64': { 'Fn::Join': ['', ['#!/bin/bash\nset -o xtrace\n/etc/eks/bootstrap.sh ', { Ref: 'Cluster9EE0221C' }, ' --kubelet-extra-args "--node-labels lifecycle=OnDemand" --apiserver-endpoint \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'Endpoint'] }, '\' --b64-cluster-ca \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'CertificateAuthorityData'] }, '\' --use-max-pods true\n/opt/aws/bin/cfn-signal --exit-code $? --stack Stack --resource ClusterMyCapcityASGD4CD8B97 --region us-east-1']] } }); - }); - - test('not rendered if bootstrap is disabled', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('MyCapcity', { - instanceType: new ec2.InstanceType('m3.xlargs'), - bootstrapEnabled: false, - }); - - // THEN - const template = app.synth().getStackByName(stack.stackName).template; - const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; - expect(userData).toEqual({ 'Fn::Base64': '#!/bin/bash' }); - }); - - // cursory test for options: see test.user-data.ts for full suite - test('bootstrap options', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('MyCapcity', { - instanceType: new ec2.InstanceType('m3.xlargs'), - bootstrapOptions: { - kubeletExtraArgs: '--node-labels FOO=42', - }, - }); - - // THEN - const template = app.synth().getStackByName(stack.stackName).template; - const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; - expect(userData).toEqual({ 'Fn::Base64': { 'Fn::Join': ['', ['#!/bin/bash\nset -o xtrace\n/etc/eks/bootstrap.sh ', { Ref: 'Cluster9EE0221C' }, ' --kubelet-extra-args "--node-labels lifecycle=OnDemand --node-labels FOO=42" --apiserver-endpoint \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'Endpoint'] }, '\' --b64-cluster-ca \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'CertificateAuthorityData'] }, '\' --use-max-pods true\n/opt/aws/bin/cfn-signal --exit-code $? --stack Stack --resource ClusterMyCapcityASGD4CD8B97 --region us-east-1']] } }); - }); - - describe('spot instances', () => { - - test('nodes labeled an tainted accordingly', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('MyCapcity', { - instanceType: new ec2.InstanceType('m3.xlargs'), - spotPrice: '0.01', - }); - - // THEN - const template = app.synth().getStackByName(stack.stackName).template; - const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; - expect(userData).toEqual({ 'Fn::Base64': { 'Fn::Join': ['', ['#!/bin/bash\nset -o xtrace\n/etc/eks/bootstrap.sh ', { Ref: 'Cluster9EE0221C' }, ' --kubelet-extra-args "--node-labels lifecycle=Ec2Spot --register-with-taints=spotInstance=true:PreferNoSchedule" --apiserver-endpoint \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'Endpoint'] }, '\' --b64-cluster-ca \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'CertificateAuthorityData'] }, '\' --use-max-pods true\n/opt/aws/bin/cfn-signal --exit-code $? --stack Stack --resource ClusterMyCapcityASGD4CD8B97 --region us-east-1']] } }); - }); - - test('interrupt handler is added', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('MyCapcity', { - instanceType: new ec2.InstanceType('m3.xlarge'), - spotPrice: '0.01', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties(eks.HelmChart.RESOURCE_TYPE, { - Release: 'stackclusterchartspotinterrupthandlerdec62e07', - Chart: 'aws-node-termination-handler', - Values: '{\"nodeSelector\":{\"lifecycle\":\"Ec2Spot\"}}', - Namespace: 'kube-system', - Repository: 'https://aws.github.io/eks-charts', - }); - }); - - test('interrupt handler is not added when spotInterruptHandler is false', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('MyCapcity', { - instanceType: new ec2.InstanceType('m3.xlarge'), - spotPrice: '0.01', - spotInterruptHandler: false, - }); - - // THEN - expect(cluster.node.findAll().filter(c => c.node.id === 'chart-spot-interrupt-handler').length).toEqual(0); - }); - - test('its possible to add two capacities with spot instances and only one stop handler will be installed', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('Spot1', { - instanceType: new ec2.InstanceType('m3.xlarge'), - spotPrice: '0.01', - }); - - cluster.addAutoScalingGroupCapacity('Spot2', { - instanceType: new ec2.InstanceType('m4.xlarge'), - spotPrice: '0.01', - }); - - // THEN - Template.fromStack(stack).resourceCountIs(eks.HelmChart.RESOURCE_TYPE, 1); - }); - }); - }); - - test('if bootstrap is disabled cannot specify options', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // THEN - expect(() => cluster.addAutoScalingGroupCapacity('MyCapcity', { - instanceType: new ec2.InstanceType('m3.xlargs'), - bootstrapEnabled: false, - bootstrapOptions: { awsApiRetryAttempts: 10 }, - })).toThrow(/Cannot specify "bootstrapOptions" if "bootstrapEnabled" is false/); - }); - - test('EksOptimizedImage() with no nodeType always uses STANDARD with LATEST_KUBERNETES_VERSION', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - const LATEST_KUBERNETES_VERSION = '1.24'; - - // WHEN - new eks.EksOptimizedImage().getImage(stack); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && - (v as any).Default.includes('/amazon-linux-2/'), - )).toEqual(true); - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && - (v as any).Default.includes(LATEST_KUBERNETES_VERSION), - )).toEqual(true); - }); - - test('EksOptimizedImage() with specific kubernetesVersion return correct AMI', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.EksOptimizedImage({ kubernetesVersion: CLUSTER_VERSION.version }).getImage(stack); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && - (v as any).Default.includes('/amazon-linux-2/'), - )).toEqual(true); - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && - (v as any).Default.includes('/1.25/'), - )).toEqual(true); - }); - - test('default cluster capacity with ARM64 instance type comes with nodegroup with correct AmiType', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 1, - version: CLUSTER_VERSION, - prune: false, - defaultCapacityInstance: new ec2.InstanceType('m6g.medium'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - AmiType: 'AL2_ARM_64', - }); - }); - - test('addNodegroup with ARM64 instance type comes with nodegroup with correct AmiType', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - defaultCapacityInstance: new ec2.InstanceType('m6g.medium'), - }).addNodegroupCapacity('ng', { - instanceTypes: [new ec2.InstanceType('m6g.medium')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - AmiType: 'AL2_ARM_64', - }); - }); - - test('addNodegroupCapacity with T4g instance type comes with nodegroup with correct AmiType', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - defaultCapacityInstance: new ec2.InstanceType('t4g.medium'), - }).addNodegroupCapacity('ng', { - instanceTypes: [new ec2.InstanceType('t4g.medium')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - AmiType: 'AL2_ARM_64', - }); - }); - - test('addAutoScalingGroupCapacity with T4g instance type comes with nodegroup with correct AmiType', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }).addAutoScalingGroupCapacity('ng', { - instanceType: new ec2.InstanceType('t4g.medium'), - }); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && - (v as any).Default.includes('amazon-linux-2-arm64/'), - )).toEqual(true); - }); - - test('addNodegroupCapacity with C7g instance type comes with nodegroup with correct AmiType', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - defaultCapacityInstance: new ec2.InstanceType('c7g.large'), - }).addNodegroupCapacity('ng', { - instanceTypes: [new ec2.InstanceType('c7g.large')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { - AmiType: 'AL2_ARM_64', - }); - }); - - test('addAutoScalingGroupCapacity with C7g instance type comes with nodegroup with correct AmiType', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }).addAutoScalingGroupCapacity('ng', { - instanceType: new ec2.InstanceType('c7g.large'), - }); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && - (v as any).Default.includes('amazon-linux-2-arm64/'), - )).toEqual(true); - }); - - test('EKS-Optimized AMI with GPU support when addAutoScalingGroupCapacity', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }).addAutoScalingGroupCapacity('GPUCapacity', { - instanceType: new ec2.InstanceType('g4dn.xlarge'), - }); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && (v as any).Default.includes('amazon-linux-2-gpu'), - )).toEqual(true); - }); - - test('EKS-Optimized AMI with ARM64 when addAutoScalingGroupCapacity', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new eks.Cluster(stack, 'cluster', { - defaultCapacity: 0, - version: CLUSTER_VERSION, - prune: false, - }).addAutoScalingGroupCapacity('ARMCapacity', { - instanceType: new ec2.InstanceType('m6g.medium'), - }); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && (v as any).Default.includes('/amazon-linux-2-arm64/'), - )).toEqual(true); - }); - - test('BottleRocketImage() with specific kubernetesVersion return correct AMI', () => { - // GIVEN - const { app, stack } = testFixtureNoVpc(); - - // WHEN - new BottleRocketImage({ kubernetesVersion: CLUSTER_VERSION.version }).getImage(stack); - - // THEN - const assembly = app.synth(); - const parameters = assembly.getStackByName(stack.stackName).template.Parameters; - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketaws') && - (v as any).Default.includes('/bottlerocket/'), - )).toEqual(true); - expect(Object.entries(parameters).some( - ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketaws') && - (v as any).Default.includes('/aws-k8s-1.25/'), - )).toEqual(true); - }); - - test('when using custom resource a creation role & policy is defined', () => { - // GIVEN - const { stack } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'MyCluster', { - clusterName: 'my-cluster-name', - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { - Config: { - name: 'my-cluster-name', - roleArn: { 'Fn::GetAtt': ['MyClusterRoleBA20FE72', 'Arn'] }, - version: CLUSTER_VERSION.version, - resourcesVpcConfig: { - securityGroupIds: [ - { 'Fn::GetAtt': ['MyClusterControlPlaneSecurityGroup6B658F79', 'GroupId'] }, - ], - subnetIds: [ - { Ref: 'MyClusterDefaultVpcPublicSubnet1SubnetFAE5A9B6' }, - { Ref: 'MyClusterDefaultVpcPublicSubnet2SubnetF6D028A0' }, - { Ref: 'MyClusterDefaultVpcPrivateSubnet1SubnetE1D0DCDB' }, - { Ref: 'MyClusterDefaultVpcPrivateSubnet2Subnet11FEA8D0' }, - ], - endpointPrivateAccess: true, - endpointPublicAccess: true, - }, - }, - }); - - // role can be assumed by 3 lambda handlers (2 for the cluster resource and 1 for the kubernetes resource) - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - AWS: { - 'Fn::Join': [ - '', - ['arn:', { Ref: 'AWS::Partition' }, ':iam::', { Ref: 'AWS::AccountId' }, ':root'], - ], - }, - }, - }, - ], - Version: '2012-10-17', - }, - }); - - // policy allows creation role to pass the cluster role and to interact with the cluster (given we know the explicit cluster name) - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'iam:PassRole', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'MyClusterRoleBA20FE72', - 'Arn', - ], - }, - }, - { - Action: [ - 'eks:CreateCluster', - 'eks:DescribeCluster', - 'eks:DescribeUpdate', - 'eks:DeleteCluster', - 'eks:UpdateClusterVersion', - 'eks:UpdateClusterConfig', - 'eks:CreateFargateProfile', - 'eks:TagResource', - 'eks:UntagResource', - ], - Effect: 'Allow', - Resource: [{ - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':eks:us-east-1:', - { - Ref: 'AWS::AccountId', - }, - ':cluster/my-cluster-name', - ], - ], - }, { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':eks:us-east-1:', - { - Ref: 'AWS::AccountId', - }, - ':cluster/my-cluster-name/*', - ], - ], - }], - }, - { - Action: [ - 'eks:DescribeFargateProfile', - 'eks:DeleteFargateProfile', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':eks:us-east-1:', - { - Ref: 'AWS::AccountId', - }, - ':fargateprofile/my-cluster-name/*', - ], - ], - }, - }, - { - Action: ['iam:GetRole', 'iam:listAttachedRolePolicies'], - Effect: 'Allow', - Resource: '*', - }, - { - Action: 'iam:CreateServiceLinkedRole', - Effect: 'Allow', - Resource: '*', - }, - { - Action: [ - 'ec2:DescribeInstances', - 'ec2:DescribeNetworkInterfaces', - 'ec2:DescribeSecurityGroups', - 'ec2:DescribeSubnets', - 'ec2:DescribeRouteTables', - 'ec2:DescribeDhcpOptions', - 'ec2:DescribeVpcs', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - }); - }); - - test('if an explicit cluster name is not provided, the creation role policy is wider (allows interacting with all clusters)', () => { - // GIVEN - const { stack } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'MyCluster', { version: CLUSTER_VERSION, prune: false }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'iam:PassRole', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'MyClusterRoleBA20FE72', - 'Arn', - ], - }, - }, - { - Action: [ - 'eks:CreateCluster', - 'eks:DescribeCluster', - 'eks:DescribeUpdate', - 'eks:DeleteCluster', - 'eks:UpdateClusterVersion', - 'eks:UpdateClusterConfig', - 'eks:CreateFargateProfile', - 'eks:TagResource', - 'eks:UntagResource', - ], - Effect: 'Allow', - Resource: ['*'], - }, - { - Action: [ - 'eks:DescribeFargateProfile', - 'eks:DeleteFargateProfile', - ], - Effect: 'Allow', - Resource: '*', - }, - { - Action: ['iam:GetRole', 'iam:listAttachedRolePolicies'], - Effect: 'Allow', - Resource: '*', - }, - { - Action: 'iam:CreateServiceLinkedRole', - Effect: 'Allow', - Resource: '*', - }, - { - Action: [ - 'ec2:DescribeInstances', - 'ec2:DescribeNetworkInterfaces', - 'ec2:DescribeSecurityGroups', - 'ec2:DescribeSubnets', - 'ec2:DescribeRouteTables', - 'ec2:DescribeDhcpOptions', - 'ec2:DescribeVpcs', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - }); - }); - - test('if helm charts are used, the provider role is allowed to assume the creation role', () => { - // GIVEN - const { stack } = testFixture(); - const cluster = new eks.Cluster(stack, 'MyCluster', { - clusterName: 'my-cluster-name', - version: CLUSTER_VERSION, - prune: false, - }); - - // WHEN - cluster.addHelmChart('MyChart', { - chart: 'foo', - }); - - // THEN - const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'eks:DescribeCluster', - Effect: 'Allow', - Resource: { - Ref: 'referencetoStackMyClusterD33CAEABArn', - }, - }, - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Resource: { - Ref: 'referencetoStackMyClusterCreationRoleA67486E4Arn', - }, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'HandlerServiceRoleDefaultPolicyCBD0CC91', - Roles: [ - { - Ref: 'HandlerServiceRoleFCDC14AE', - }, - ], - }); - - Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { Service: 'lambda.amazonaws.com' }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole', - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AmazonEC2ContainerRegistryReadOnly', - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AmazonElasticContainerRegistryPublicReadOnly', - ]], - }, - ], - }); - }); - - test('coreDnsComputeType will patch the coreDNS configuration to use a "fargate" compute type and restore to "ec2" upon removal', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new eks.Cluster(stack, 'MyCluster', { - coreDnsComputeType: eks.CoreDnsComputeType.FARGATE, - version: CLUSTER_VERSION, - prune: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesPatch', { - ResourceName: 'deployment/coredns', - ResourceNamespace: 'kube-system', - ApplyPatchJson: '{"spec":{"template":{"metadata":{"annotations":{"eks.amazonaws.com/compute-type":"fargate"}}}}}', - RestorePatchJson: '{"spec":{"template":{"metadata":{"annotations":{"eks.amazonaws.com/compute-type":"ec2"}}}}}', - ClusterName: { - Ref: 'MyCluster8AD82BF8', - }, - RoleArn: { - 'Fn::GetAtt': [ - 'MyClusterCreationRoleB5FA4FF3', - 'Arn', - ], - }, - }); - }); - - test('if openIDConnectProvider a new OpenIDConnectProvider resource is created and exposed', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - const provider = cluster.openIdConnectProvider; - - // THEN - expect(provider).toEqual(cluster.openIdConnectProvider); - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDKOpenIdConnectProvider', { - ServiceToken: { - 'Fn::GetAtt': [ - 'CustomAWSCDKOpenIdConnectProviderCustomResourceProviderHandlerF2C543E0', - 'Arn', - ], - }, - ClientIDList: [ - 'sts.amazonaws.com', - ], - Url: { - 'Fn::GetAtt': [ - 'Cluster9EE0221C', - 'OpenIdConnectIssuerUrl', - ], - }, - }); - }); - test('inference instances are supported', () => { - // GIVEN - const { stack } = testFixtureNoVpc(); - const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addAutoScalingGroupCapacity('InferenceInstances', { - instanceType: new ec2.InstanceType('inf1.2xlarge'), - minCapacity: 1, - }); - const fileContents = fs.readFileSync(path.join(__dirname, '../lib', 'addons/neuron-device-plugin.yaml'), 'utf8'); - const sanitized = YAML.parse(fileContents); - - // THEN - Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { - Manifest: JSON.stringify([sanitized]), - }); - }); - - test('kubectl resources are always created after all fargate profiles', () => { - // GIVEN - const { stack, app } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster', { version: CLUSTER_VERSION, prune: false }); - - // WHEN - cluster.addFargateProfile('profile1', { selectors: [{ namespace: 'profile1' }] }); - cluster.addManifest('resource1', { foo: 123 }); - cluster.addFargateProfile('profile2', { selectors: [{ namespace: 'profile2' }] }); - new eks.HelmChart(stack, 'chart', { cluster, chart: 'mychart' }); - cluster.addFargateProfile('profile3', { selectors: [{ namespace: 'profile3' }] }); - new eks.KubernetesPatch(stack, 'patch1', { - cluster, - applyPatch: { foo: 123 }, - restorePatch: { bar: 123 }, - resourceName: 'foo/bar', - }); - cluster.addFargateProfile('profile4', { selectors: [{ namespace: 'profile4' }] }); - - // THEN - const template = app.synth().getStackArtifact(stack.artifactId).template; - - const barrier = template.Resources.ClusterKubectlReadyBarrier200052AF; - - expect(barrier.DependsOn).toEqual([ - 'Clusterfargateprofileprofile1PodExecutionRoleE85F87B5', - 'Clusterfargateprofileprofile129AEA3C6', - 'Clusterfargateprofileprofile2PodExecutionRole22670AF8', - 'Clusterfargateprofileprofile233B9A117', - 'Clusterfargateprofileprofile3PodExecutionRole475C0D8F', - 'Clusterfargateprofileprofile3D06F3076', - 'Clusterfargateprofileprofile4PodExecutionRole086057FB', - 'Clusterfargateprofileprofile4A0E3BBE8', - 'ClusterCreationRoleDefaultPolicyE8BDFC7B', - 'ClusterCreationRole360249B6', - 'Cluster9EE0221C', - ]); - - const kubectlResources = ['chartF2447AFC', 'patch1B964AC93', 'Clustermanifestresource10B1C9505', 'ClusterAwsAuthmanifestFE51F8AE']; - - // check that all kubectl resources depend on the barrier - for (const r of kubectlResources) { - expect(template.Resources[r].DependsOn).toEqual(['ClusterKubectlReadyBarrier200052AF']); - } - }); - - test('kubectl provider role can assume creation role', () => { - // GIVEN - const { stack } = testFixture(); - const c1 = new eks.Cluster(stack, 'Cluster1', { version: CLUSTER_VERSION, prune: false }); - - // WHEN - - // activate kubectl provider - c1.addManifest('c1a', { foo: 123 }); - c1.addManifest('c1b', { foo: 123 }); - - // THEN - const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'eks:DescribeCluster', - Effect: 'Allow', - Resource: { - Ref: 'referencetoStackCluster18DFEAC17Arn', - }, - }, - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Resource: { - Ref: 'referencetoStackCluster1CreationRoleEF7C9BBCArn', - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { Service: 'lambda.amazonaws.com' }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole', - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AmazonEC2ContainerRegistryReadOnly', - ]], - }, - { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':iam::aws:policy/AmazonElasticContainerRegistryPublicReadOnly', - ]], - }, - ], - }); - }); - }); - - test('kubectl provider passes security group to provider', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - kubectlEnvironment: { - Foo: 'Bar', - }, - }); - - // the kubectl provider is inside a nested stack. - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { - SecurityGroupIds: [{ Ref: 'referencetoStackCluster18DFEAC17ClusterSecurityGroupId' }], - }, - }); - }); - - test('kubectl provider passes environment to lambda', () => { - const { stack } = testFixture(); - - const cluster = new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - kubectlEnvironment: { - Foo: 'Bar', - }, - }); - - cluster.addManifest('resource', { - kind: 'ConfigMap', - apiVersion: 'v1', - data: { - hello: 'world', - }, - metadata: { - name: 'config-map', - }, - }); - - // the kubectl provider is inside a nested stack. - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - Foo: 'Bar', - }, - }, - }); - }); - - describe('kubectl provider passes iam role environment to kube ctl lambda', ()=>{ - test('new cluster', () => { - const { stack } = testFixture(); - - const kubectlRole = new iam.Role(stack, 'KubectlIamRole', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // using _ syntax to silence warning about _cluster not being used, when it is - const cluster = new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - kubectlLambdaRole: kubectlRole, - }); - - cluster.addManifest('resource', { - kind: 'ConfigMap', - apiVersion: 'v1', - data: { - hello: 'world', - }, - metadata: { - name: 'config-map', - }, - }); - - // the kubectl provider is inside a nested stack. - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - Role: { - Ref: 'referencetoStackKubectlIamRole02F8947EArn', - }, - }); - }); - - test('imported cluster', ()=> { - const clusterName = 'my-cluster'; - const stack = new cdk.Stack(); - const kubectlLambdaRole = new iam.Role(stack, 'KubectlLambdaRole', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Imported', { - clusterName, - kubectlRoleArn: 'arn:aws:iam::1111111:role/iam-role-that-has-masters-access', - kubectlLambdaRole: kubectlLambdaRole, - }); - - const chart = 'hello-world'; - cluster.addHelmChart('test-chart', { - chart, - }); - - const nested = stack.node.tryFindChild('Imported-KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - Role: { - Ref: 'referencetoKubectlLambdaRole7D084D94Arn', - }, - }); - Template.fromStack(stack).hasResourceProperties(HelmChart.RESOURCE_TYPE, { - ClusterName: clusterName, - RoleArn: 'arn:aws:iam::1111111:role/iam-role-that-has-masters-access', - Release: 'importedcharttestchartf3acd6e5', - Chart: chart, - Namespace: 'default', - CreateNamespace: true, - }); - }); - }); - - describe('endpoint access', () => { - test('public restricted', () => { - expect(() => { - eks.EndpointAccess.PUBLIC.onlyFrom('1.2.3.4/32'); - }).toThrow(/Cannot restric public access to endpoint when private access is disabled. Use PUBLIC_AND_PRIVATE.onlyFrom\(\) instead./); - }); - - test('public non restricted without private subnets', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PUBLIC, - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - - // we don't attach vpc config in case endpoint is public only, regardless of whether - // the vpc has private subnets or not. - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: Match.absent(), - }); - }); - - test('public non restricted with private subnets', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PUBLIC, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - - // we don't attach vpc config in case endpoint is public only, regardless of whether - // the vpc has private subnets or not. - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: Match.absent(), - }); - }); - - test('private without private subnets', () => { - const { stack } = testFixture(); - - expect(() => { - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], - }); - }).toThrow(/Vpc must contain private subnets when public endpoint access is disabled/); - }); - - test('private with private subnets', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - - const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); - expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).not.toEqual(0); - expect(functions.Handler886CB40B.Properties.VpcConfig.SecurityGroupIds.length).not.toEqual(0); - }); - - test('private and non restricted public without private subnets', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE, - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - - // we don't have private subnets, but we don't need them since public access - // is not restricted. - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: Match.absent(), - }); - }); - - test('private and non restricted public with private subnets', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - - // we have private subnets so we should use them. - const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); - expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).not.toEqual(0); - expect(functions.Handler886CB40B.Properties.VpcConfig.SecurityGroupIds.length).not.toEqual(0); - }); - - test('private and restricted public without private subnets', () => { - const { stack } = testFixture(); - - expect(() => { - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE.onlyFrom('1.2.3.4/32'), - vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], - }); - }).toThrow(/Vpc must contain private subnets when public endpoint access is restricted/); - }); - - test('private and restricted public with private subnets', () => { - const { stack } = testFixture(); - - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE.onlyFrom('1.2.3.4/32'), - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - - // we have private subnets so we should use them. - const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); - expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).not.toEqual(0); - expect(functions.Handler886CB40B.Properties.VpcConfig.SecurityGroupIds.length).not.toEqual(0); - }); - - test('private endpoint access selects only private subnets from looked up vpc', () => { - const vpcId = 'vpc-12345'; - // can't use the regular fixture because it also adds a VPC to the stack, which prevents - // us from setting context. - const stack = new cdk.Stack(new cdk.App(), 'Stack', { - env: { - account: '11112222', - region: 'us-east-1', - }, - }); - stack.node.setContext(`vpc-provider:account=${stack.account}:filter.vpc-id=${vpcId}:region=${stack.region}:returnAsymmetricSubnets=true`, { - vpcId: vpcId, - vpcCidrBlock: '10.0.0.0/16', - subnetGroups: [ - { - name: 'Private', - type: 'Private', - subnets: [ - { - subnetId: 'subnet-private-in-us-east-1a', - cidr: '10.0.1.0/24', - availabilityZone: 'us-east-1a', - routeTableId: 'rtb-06068e4c4049921ef', - }, - ], - }, - { - name: 'Public', - type: 'Public', - subnets: [ - { - subnetId: 'subnet-public-in-us-east-1c', - cidr: '10.0.0.0/24', - availabilityZone: 'us-east-1c', - routeTableId: 'rtb-0ff08e62195198dbb', - }, - ], - }, - ], - }); - const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { - vpcId: vpcId, - }); - - new eks.Cluster(stack, 'Cluster', { - vpc, - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { SubnetIds: ['subnet-private-in-us-east-1a'] }, - }); - }); - - test('private endpoint access selects only private subnets from looked up vpc with concrete subnet selection', () => { - const vpcId = 'vpc-12345'; - // can't use the regular fixture because it also adds a VPC to the stack, which prevents - // us from setting context. - const stack = new cdk.Stack(new cdk.App(), 'Stack', { - env: { - account: '11112222', - region: 'us-east-1', - }, - }); - - stack.node.setContext(`vpc-provider:account=${stack.account}:filter.vpc-id=${vpcId}:region=${stack.region}:returnAsymmetricSubnets=true`, { - vpcId: vpcId, - vpcCidrBlock: '10.0.0.0/16', - subnetGroups: [ - { - name: 'Private', - type: 'Private', - subnets: [ - { - subnetId: 'subnet-private-in-us-east-1a', - cidr: '10.0.1.0/24', - availabilityZone: 'us-east-1a', - routeTableId: 'rtb-06068e4c4049921ef', - }, - ], - }, - { - name: 'Public', - type: 'Public', - subnets: [ - { - subnetId: 'subnet-public-in-us-east-1c', - cidr: '10.0.0.0/24', - availabilityZone: 'us-east-1c', - routeTableId: 'rtb-0ff08e62195198dbb', - }, - ], - }, - ], - }); - - const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { - vpcId: vpcId, - }); - - new eks.Cluster(stack, 'Cluster', { - vpc, - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - vpcSubnets: [{ - subnets: [ - ec2.Subnet.fromSubnetId(stack, 'Private', 'subnet-private-in-us-east-1a'), - ec2.Subnet.fromSubnetId(stack, 'Public', 'subnet-public-in-us-east-1c'), - ], - }], - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { SubnetIds: ['subnet-private-in-us-east-1a'] }, - }); - }); - - test('private endpoint access selects only private subnets from managed vpc with concrete subnet selection', () => { - const { stack } = testFixture(); - - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new eks.Cluster(stack, 'Cluster', { - vpc, - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - vpcSubnets: [{ - subnets: [ - vpc.privateSubnets[0], - vpc.publicSubnets[1], - ec2.Subnet.fromSubnetId(stack, 'Private', 'subnet-unknown'), - ], - }], - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { - SubnetIds: [ - { Ref: 'referencetoStackVpcPrivateSubnet1Subnet8E6A14CBRef' }, - 'subnet-unknown', - ], - }, - }); - }); - - test('private endpoint access considers specific subnet selection', () => { - const { stack } = testFixture(); - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: - eks.EndpointAccess.PRIVATE, - vpcSubnets: [{ - subnets: [ec2.PrivateSubnet.fromSubnetAttributes(stack, 'Private1', { - subnetId: 'subnet1', - availabilityZone: 'us-east-1a', - })], - }], - }); - - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { SubnetIds: ['subnet1'] }, - }); - }); - - test('can configure private endpoint access', () => { - // GIVEN - const { stack } = testFixture(); - new eks.Cluster(stack, 'Cluster1', { version: CLUSTER_VERSION, endpointAccess: eks.EndpointAccess.PRIVATE, prune: false }); - - const app = stack.node.root as cdk.App; - const template = app.synth().getStackArtifact(stack.stackName).template; - expect(template.Resources.Cluster1B02DD5A2.Properties.Config.resourcesVpcConfig.endpointPrivateAccess).toEqual(true); - expect(template.Resources.Cluster1B02DD5A2.Properties.Config.resourcesVpcConfig.endpointPublicAccess).toEqual(false); - }); - - test('kubectl provider chooses only private subnets', () => { - const { stack } = testFixture(); - - const vpc = new ec2.Vpc(stack, 'Vpc', { - maxAzs: 2, - natGateways: 1, - subnetConfiguration: [ - { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - name: 'Private1', - }, - { - subnetType: ec2.SubnetType.PUBLIC, - name: 'Public1', - }, - ], - }); - - const cluster = new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - vpc, - }); - - cluster.addManifest('resource', { - kind: 'ConfigMap', - apiVersion: 'v1', - data: { - hello: 'world', - }, - metadata: { - name: 'config-map', - }, - }); - - // the kubectl provider is inside a nested stack. - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { - SecurityGroupIds: [ - { - Ref: 'referencetoStackCluster18DFEAC17ClusterSecurityGroupId', - }, - ], - SubnetIds: [ - { - Ref: 'referencetoStackVpcPrivate1Subnet1Subnet6764A0F6Ref', - }, - { - Ref: 'referencetoStackVpcPrivate1Subnet2SubnetDFD49645Ref', - }, - ], - }, - }); - }); - - test('kubectl provider limits number of subnets to 16', () => { - const { stack } = testFixture(); - - const subnetConfiguration: ec2.SubnetConfiguration[] = []; - - for (let i = 0; i < 20; i++) { - subnetConfiguration.push({ - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - name: `Private${i}`, - }, - ); - } - - subnetConfiguration.push({ - subnetType: ec2.SubnetType.PUBLIC, - name: 'Public1', - }); - - const vpc2 = new ec2.Vpc(stack, 'Vpc', { - maxAzs: 2, - natGateways: 1, - subnetConfiguration, - }); - - const cluster = new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - vpc: vpc2, - }); - - cluster.addManifest('resource', { - kind: 'ConfigMap', - apiVersion: 'v1', - data: { - hello: 'world', - }, - metadata: { - name: 'config-map', - }, - }); - - // the kubectl provider is inside a nested stack. - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); - expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).toEqual(16); - }); - - test('kubectl provider considers vpc subnet selection', () => { - const { stack } = testFixture(); - - const subnetConfiguration: ec2.SubnetConfiguration[] = []; - - for (let i = 0; i < 20; i++) { - subnetConfiguration.push({ - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - name: `Private${i}`, - }, - ); - } - - subnetConfiguration.push({ - subnetType: ec2.SubnetType.PUBLIC, - name: 'Public1', - }); - - const vpc2 = new ec2.Vpc(stack, 'Vpc', { - maxAzs: 2, - natGateways: 1, - subnetConfiguration, - }); - - const cluster = new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - endpointAccess: eks.EndpointAccess.PRIVATE, - vpc: vpc2, - vpcSubnets: [{ subnetGroupName: 'Private1' }, { subnetGroupName: 'Private2' }], - }); - - cluster.addManifest('resource', { - kind: 'ConfigMap', - apiVersion: 'v1', - data: { - hello: 'world', - }, - metadata: { - name: 'config-map', - }, - }); - - // the kubectl provider is inside a nested stack. - const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { - VpcConfig: { - SecurityGroupIds: [ - { - Ref: 'referencetoStackCluster18DFEAC17ClusterSecurityGroupId', - }, - ], - SubnetIds: [ - { - Ref: 'referencetoStackVpcPrivate1Subnet1Subnet6764A0F6Ref', - }, - { - Ref: 'referencetoStackVpcPrivate1Subnet2SubnetDFD49645Ref', - }, - { - Ref: 'referencetoStackVpcPrivate2Subnet1Subnet586AD392Ref', - }, - { - Ref: 'referencetoStackVpcPrivate2Subnet2SubnetE42148C0Ref', - }, - ], - }, - }); - }); - - test('throw when private access is configured without dns support enabled for the VPC', () => { - const { stack } = testFixture(); - - expect(() => { - new eks.Cluster(stack, 'Cluster', { - vpc: new ec2.Vpc(stack, 'Vpc', { - enableDnsSupport: false, - }), - version: CLUSTER_VERSION, - prune: false, - }); - }).toThrow(/Private endpoint access requires the VPC to have DNS support and DNS hostnames enabled/); - }); - - test('throw when private access is configured without dns hostnames enabled for the VPC', () => { - const { stack } = testFixture(); - - expect(() => { - new eks.Cluster(stack, 'Cluster', { - vpc: new ec2.Vpc(stack, 'Vpc', { - enableDnsHostnames: false, - }), - version: CLUSTER_VERSION, - prune: false, - }); - }).toThrow(/Private endpoint access requires the VPC to have DNS support and DNS hostnames enabled/); - }); - - test('throw when cidrs are configured without public access endpoint', () => { - expect(() => { - eks.EndpointAccess.PRIVATE.onlyFrom('1.2.3.4/5'); - }).toThrow(/CIDR blocks can only be configured when public access is enabled/); - }); - }); - - test('getServiceLoadBalancerAddress', () => { - const { stack } = testFixture(); - const cluster = new eks.Cluster(stack, 'Cluster1', { version: CLUSTER_VERSION, prune: false }); - - const loadBalancerAddress = cluster.getServiceLoadBalancerAddress('myservice'); - - new cdk.CfnOutput(stack, 'LoadBalancerAddress', { - value: loadBalancerAddress, - }); - - const expectedKubernetesGetId = 'Cluster1myserviceLoadBalancerAddress198CCB03'; - - let template = Template.fromStack(stack); - const resources = template.findResources('Custom::AWSCDK-EKS-KubernetesObjectValue'); - - // make sure the custom resource is created correctly - expect(resources[expectedKubernetesGetId].Properties).toEqual({ - ServiceToken: { - 'Fn::GetAtt': [ - 'awscdkawseksKubectlProviderNestedStackawscdkawseksKubectlProviderNestedStackResourceA7AEBA6B', - 'Outputs.StackawscdkawseksKubectlProviderframeworkonEvent8897FD9BArn', - ], - }, - ClusterName: { - Ref: 'Cluster1B02DD5A2', - }, - RoleArn: { - 'Fn::GetAtt': [ - 'Cluster1CreationRoleA231BE8D', - 'Arn', - ], - }, - ObjectType: 'service', - ObjectName: 'myservice', - ObjectNamespace: 'default', - JsonPath: '.status.loadBalancer.ingress[0].hostname', - TimeoutSeconds: 300, - }); - - // make sure the attribute points to the expected custom resource and extracts the correct attribute - template.hasOutput('LoadBalancerAddress', { - Value: { 'Fn::GetAtt': [expectedKubernetesGetId, 'Value'] }, - }); - }); - - test('custom kubectl layer can be provided', () => { - // GIVEN - const { stack } = testFixture(); - - // WHEN - const layer = lambda.LayerVersion.fromLayerVersionArn(stack, 'MyLayer', 'arn:of:layer'); - new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - kubectlLayer: layer, - }); - - // THEN - const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(providerStack).hasResourceProperties('AWS::Lambda::Function', { - Layers: [ - { Ref: 'AwsCliLayerF44AAF94' }, - 'arn:of:layer', - ], - }); - }); - - describe('kubectlLayer annotation', () => { - function message(version: string) { - return [ - `You created a cluster with Kubernetes Version 1.${version} without specifying the kubectlLayer property.`, - 'This may cause failures as the kubectl version provided with aws-cdk-lib is 1.20, which is only guaranteed to be compatible with Kubernetes versions 1.19-1.21.', - `Please provide a kubectlLayer from @aws-cdk/lambda-layer-kubectl-v${version}.`, - ].join(' '); - } - - test('not added when version < 1.22 and no kubectl layer provided', () => { - // GIVEN - const { stack } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster1', { - version: eks.KubernetesVersion.V1_21, - prune: false, - }); - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Stack/Cluster1', message('21')); - }); - - test('added when version >= 1.22 and no kubectl layer provided', () => { - // GIVEN - const { stack } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster1', { - version: eks.KubernetesVersion.V1_24, - prune: false, - }); - - // THEN - Annotations.fromStack(stack).hasWarning('/Stack/Cluster1', message('24')); - }); - }); - - test('custom awscli layer can be provided', () => { - // GIVEN - const { stack } = testFixture(); - - // WHEN - const layer = lambda.LayerVersion.fromLayerVersionArn(stack, 'MyLayer', 'arn:of:layer'); - new eks.Cluster(stack, 'Cluster1', { - version: CLUSTER_VERSION, - prune: false, - awscliLayer: layer, - }); - - // THEN - const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; - Template.fromStack(providerStack).hasResourceProperties('AWS::Lambda::Function', { - Layers: [ - 'arn:of:layer', - { Ref: 'KubectlLayer600207B5' }, - ], - }); - }); - - test('create a cluster using custom resource with secrets encryption using KMS CMK', () => { - // GIVEN - const { stack, vpc } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { - vpc, - version: CLUSTER_VERSION, - prune: false, - secretsEncryptionKey: new kms.Key(stack, 'Key'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { - Config: { - encryptionConfig: [{ - provider: { - keyArn: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - }, - resources: ['secrets'], - }], - }, - }); - }); - - test('custom memory size for kubectl provider', () => { - // GIVEN - const { stack, vpc, app } = testFixture(); - - // WHEN - new eks.Cluster(stack, 'Cluster', { - vpc, - version: CLUSTER_VERSION, - kubectlMemory: cdk.Size.gibibytes(2), - }); - - // THEN - const casm = app.synth(); - const providerNestedStackTemplate = JSON.parse(fs.readFileSync(path.join(casm.directory, 'StackawscdkawseksKubectlProvider7346F799.nested.template.json'), 'utf-8')); - expect(providerNestedStackTemplate?.Resources?.Handler886CB40B?.Properties?.MemorySize).toEqual(2048); - }); - - test('custom memory size for imported clusters', () => { - // GIVEN - const { stack, app } = testFixture(); - - // WHEN - const cluster = eks.Cluster.fromClusterAttributes(stack, 'Imported', { - clusterName: 'my-cluster', - kubectlRoleArn: 'arn:aws:iam::123456789012:role/MyRole', - kubectlMemory: cdk.Size.gibibytes(4), - }); - - cluster.addManifest('foo', { bar: 123 }); - - // THEN - const casm = app.synth(); - const providerNestedStackTemplate = JSON.parse(fs.readFileSync(path.join(casm.directory, 'StackStackImported1CBA9C50KubectlProviderAA00BA49.nested.template.json'), 'utf-8')); - expect(providerNestedStackTemplate?.Resources?.Handler886CB40B?.Properties?.MemorySize).toEqual(4096); - }); - - test('create a cluster using custom kubernetes network config', () => { - // GIVEN - const { stack } = testFixture(); - const customCidr = '172.16.0.0/12'; - - // WHEN - new eks.Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - serviceIpv4Cidr: customCidr, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { - Config: { - kubernetesNetworkConfig: { - serviceIpv4Cidr: customCidr, - }, - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQUMvRTtRQUVELE9BQU8sSUFBSSxDQUFDLGtCQUFrQixDQUFDO0tBQ2h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HRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcs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vZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxR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zO1xuXG4gICAgICBpZiAoc3RhdHVzID09PSAnQ1JFQVRFX0ZBSUxFRCcgfHwgc3RhdHVzID09PSAnREVMRVRFX0ZBSUxFRCcpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKHN0YXR1cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzdGF0dXM7XG4gICAgfSBjYXRjaCAoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksR0FBd0IsQ0FBQztBQUU3QixNQUFNLGdCQUFnQixHQUFjO0lBQ2xDLGFBQWEsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQU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xuICByZXR1cm4gcHJvdmlkZXIub25FdmVudCgpO1xufVxuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaXNDb21wbGV0ZShldmVudDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCk6IFByb21pc2U8SXNDb21wbGV0ZVJlc3BvbnNlPiB7XG4gIGNvbnN0IHByb3ZpZGVyID0gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50KTtcbiAgcmV0dXJuIHByb3ZpZGVyLmlzQ29tcGxldGUoKTtcbn1cblxuZnVuY3Rpb24gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.alb-controller.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFl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NpZHJzKSxcbiAgICByZXBsYWNlUm9sZTogbmV3UHJvcHMucm9sZUFybiAhPT0gb2xkUHJvcHMucm9sZUFybixcbiAgICB1cGRhdGVWZXJzaW9uOiBuZXdQcm9wcy52ZXJzaW9uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoi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0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlVXBkYXRlUmVzcG9uc2U+O1xuICBjcmVhdGVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkNyZWF0ZUZhcmdhdGVQcm9maWxlUmVxdWVzdCk6IFByb21pc2U8YXdzLkVLUy5DcmVhdGVGYXJnYXRlUHJvZmlsZVJlc3BvbnNlPjtcbiAgZGVzY3JpYmVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFakgsTUFBTSxvQkFBb0IsR0FBd0M7WUFDaEUsa0JBQWtCO1lBQ2xCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNO1NBQ3hDLENBQUM7UUFFRixJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsb0JBQW9CLEVBQUUsQ0FBQyxDQUFDO1FBQ25DLE1BQU0sNEJBQTRCLEdBQUcsTUFBTSxJQUFJLENBQUMsR0FBRyxDQUFDLG9CQUFvQixDQUFDLG9CQUFvQixDQUFDLENBQUM7UUFDL0YsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLDRCQUE0QixFQUFFLENBQUMsQ0FBQztRQUUzQyxJQUFJLENBQUMsNEJBQTRCLENBQUMsY0FBYyxFQUFFO1lBQ2hELE1BQU0sSUFBSSxLQUFLLENBQUMsdUNBQXVDLENBQUMsQ0FBQztTQUMxRDtRQUVELE9BQU87WUFDTCxrQkFBa0IsRUFBRSw0QkFBNEIsQ0FBQyxjQUFjLENBQ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= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRT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NPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQUMvRTtRQUVELE9BQU8sSUFBSSxDQUFDLGtCQUFrQixDQUFDO0tBQ2hDO0lBS0QsWUFBWSxHQUFjLEVBQUUsS0FBb0I7UUFDOUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUVsQixJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLGtCQUFrQixDQUFDLENBQUM7UUFDMUQsSUFBSSxDQUFDLFFBQVEsR0FBRyxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7S0FDL0Y7SUFFRCxTQUFTO0lBQ1QsU0FBUztJQUNULFNBQVM7SUFFQyxLQUFLLENBQUMsUUFBUTtRQUN0Q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aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLENBQUMsa0JBQWtCLEdBQUksS0FBYSxDQUFDLGtCQUFrQixDQUFDO1FBQzVELElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO1FBRW5CLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxhQUFhLENBQUM7UUFDNUQsSUFBSSxDQUFDLFlBQVksRUFBRTtZ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eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFakgsTUFBTSxvQkFBb0IsR0FBd0M7WUFDaEUsa0JBQWtCO1lBQ2xCLEdBQUcsSUFBSS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nYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksR0FBd0IsQ0FBQztBQUU3QixNQUFNLGdCQUFnQixHQUFjO0lBQ2xDLGFBQWEsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLEVBQUU7SUFDakUsYUFBYSxFQUFFLEdBQUcsQ0FBQyxFQUFFLENBQUMsWUFBWSxFQUFFLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8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c2U8SXNDb21wbGV0ZVJlc3BvbnNlPiB7XG4gIGNvbnN0IHByb3ZpZGVyID0gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50KTtcbiAgcmV0dXJuIHByb3ZpZGVyLmlzQ29tcGxldGUoKTtcbn1cblxuZnVuY3Rpb24gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-handlers-vpc.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQ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uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFl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ZWF0ZUZhcmdhdGVQcm9maWxlUmVxdWVzdCk6IFByb21pc2U8YXdzLkVLUy5DcmVhdGVGYXJnYXRlUHJvZmlsZVJlc3BvbnNlPjtcbiAgZGVzY3JpYmVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ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oaXMuZWtzLmRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGUoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZSk7XG4gICAgICB0aGlzLmxvZyh7IGRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZSB9KTtcbiAgICAgIGNvbnN0IHN0YXR1cyA9IGRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZS5mYXJnYXRlUHJvZmlsZT8uc3RhdHVzO1xuXG4gICAgICBpZiAoc3RhdHVzID09PSAnQ1JFQVRFX0ZBSUxFRCcgfHwgc3RhdHVzID09PSAnREVMRVRFX0ZBSUxFRCcpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKHN0YXR1cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzdGF0dXM7XG4gICAgfSBjYXRjaCAoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1B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2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size &&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gICAgIG5ld1ZwY1Byb3BzLmVuZHBvaW50UHJpdmF0ZUFjY2VzcyAhPT0gb2xkVnBjUHJvcHMuZW5kcG9pbnRQcml2YXRlQWNjZXNzIHx8XG4gICAgICBuZXdWcGNQcm9wcy5lbmRwb2ludFB1YmxpY0FjY2VzcyAhPT0gb2xkVnBjUHJvcHMuZW5kcG9pbnRQdWJsaWNBY2Nlc3MgfHxcbiAgICAgICFzZXRzRXF1YWwobmV3UHVibGljQWNjZXNzQ2lkcnMsIG9sZFB1YmxpY0FjY2Vzc0NpZHJzKSxcbiAgICByZXBsYWNlUm9sZTogbmV3UHJvcHMucm9sZUFybiAhPT0gb2xkUHJvcHMucm9sZUFybixcbiAgICB1cGRhdGVWZXJzaW9uOiBuZXdQcm9wcy52ZXJzaW9uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLENBQUMsa0JBQWtCLEdBQUksS0FBYSxDQUFDLGtCQUFrQixDQUFDO1FBQzVELElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO1FBRW5CLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxhQUFhLENBQUM7UUFDNUQsSUFBSSxDQUFDLFlBQVksRUFBRTtZQUNqQixNQUFNLElBQUksS0FBSyxDQUFDLGdDQUFnQyxDQUFDLENBQUM7U0FDbkQ7UUFFRCxHQUFHLENBQUMsbUJBQW1CLENBQUM7WUFDdEIsT0FBTyxFQUFFLFlBQVk7WUFDckIsZUFBZSxFQUFFLHFCQUFxQixJQUFJLENBQUMsV0FBVyxJQUFJLElBQUksQ0FBQyxTQUFTLEVBQUU7U0FDM0Us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gIHVwZGF0ZUNsdXN0ZXJWZXJzaW9uKHJlcXVlc3Q6IGF3cy5FS1MuVXBkYXRlQ2x1c3RlclZlcnNpb25SZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLlVwZGF0ZUNsdXN0ZXJWZXJzaW9uUmVzcG9uc2U+O1xuICBkZXNjcmliZVVwZGF0ZShyZXE6IGF3cy5FS1MuRGVzY3JpYmVVcGRhdGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlVXBkYXRlUmVzcG9uc2U+O1xuICBjcmVhdGVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkNyZWF0ZUZhcmdhdGVQcm9maWxlUmVxdWVzdCk6IFByb21pc2U8YXdzLkVLUy5DcmVhdGVGYXJnYXRlUHJvZmlsZVJlc3BvbnNlPjtcbiAgZGVzY3JpYmVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFakgsTUFBTSxvQkFBb0IsR0FBd0M7WUFDaEUsa0JBQWtCO1lBQ2xCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNO1NBQ3hDLENBQUM7UUFFRixJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsb0JBQW9CLEVBQUUsQ0FBQyxDQUFDO1FBQ25DLE1BQU0sNEJBQTRCLEdBQUcsTUFBTSxJQUFJLENBQUMsR0FBRyxDQUFDLG9CQUFvQixDQUFDLG9CQUFvQixDQUFDLENBQUM7UUFDL0YsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLDRCQUE0QixFQUFFLENBQUMsQ0FBQztRQUUzQyxJQUFJLENBQUMsNEJBQTRCLENBQUMs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xuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpb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XJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQUMvRTtRQUVELE9BQU8sSUFBSSxDQUFDLGtCQUFrQixDQUFDO0tBQ2hDO0lBS0QsWUFBWSxHQUFjLEVBQUUsS0FBb0I7UUFDOUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUVsQixJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLGtCQUFrQixDQUFDLENBQUM7UUFDMUQsSUFBSSxDQUFDLFFBQVEsR0FBRyxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7S0FDL0Y7SUFFRCxTQUFTO0lBQ1QsU0F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5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLENBQUMsa0JBQWtCLEdBQUksS0FBYSxDQUFDLGtCQUFrQixDQUFDO1FBQzVELElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO1FBRW5CLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxhQUFhLENBQUM7UUFDNUQsSUFBSSxDQUFDLFlBQVksRUFBRTtZQUNqQixN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set.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFakgsTUFBTSxvQkFBb0IsR0FBd0M7WUFDaEUsa0JBQWtCO1lBQ2xCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNO1NBQ3hDLENBQUM7UUFFRixJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUs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c291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksR0FBd0IsQ0FBQztBQUU3QixNQUFNLGdCQUFnQixHQUFjO0lBQ2xDLGFBQWEsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLEVBQUU7SUFDakUsYUFBYSxFQUFFLEdBQUcsQ0FBQyxFQUFFLENBQUMsWUFBWSxFQUFFLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8sRUFBRTtJQUNqRSxlQUFlLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQyxZQUFZLEVBQUUsQ0FBQyxlQUFlLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxFQUFFO0lBQ3JFLGN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xldGUoKTtcbn1cblxuZnVuY3Rpb24gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQUMvRTtRQUVELE9BQU8sSUFBSSxDQUFDLGtCQUFrQixDQUFDO0tBQ2hDO0lBS0QsWUFBWSxHQUFjLEVBQUUsS0FBb0I7UUFDOUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUVsQixJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENB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3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLEN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lbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFak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B9XG5cbiAgICAgIHJldHVybiBzdGF0dXM7XG4gICAgfSBjYXRjaCAoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksR0FBd0IsQ0FBQztBQUU3QixNQUFNLGdCQUFnQixHQUFjO0lBQ2xDLGFBQWEsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLEVBQUU7SUFDakUsYUFBYSxFQUFFLEdBQUcsQ0FBQyxFQUFFLENBQUMsWUFBWSxFQUFFLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FBQyxD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VudCk6IFByb21pc2U8SXNDb21wbGV0ZVJlc3BvbnNlPiB7XG4gIGNvbnN0IHByb3ZpZGVyID0gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50KTtcbiAgcmV0dXJuIHByb3ZpZGVyLmlzQ29tcGxldGUoKTtcbn1cblxuZnVuY3Rpb24gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-inference.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.ts deleted file mode 100644 index e00b3e9910d0e..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-oidc-provider.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as eks from '../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-eks-oidc-provider-test'); - -new eks.OpenIdConnectProvider(stack, 'NoClientsNoThumbprint', { - url: `https://oidc.eks.${Stack.of(stack).region}.amazonaws.com/id/test2`, -}); - -new integ.IntegTest(app, 'aws-cdk-eks-oidc-provider', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=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W50UHJpdmF0ZUFjY2VzcyAhPT0gb2xkVnBjUHJvcHMuZW5kcG9pbnRQcml2YXRlQWNjZXNzIHx8XG4gICAgICBuZXdWcGNQcm9wcy5lbmRwb2ludFB1YmxpY0FjY2VzcyAhPT0gb2xkVnBjUHJvcHMuZW5kcG9pbnRQdWJsaWNBY2Nlc3MgfHxcbiAgICAgICFzZXRzRXF1YWwobmV3UHVibGljQWNjZXNzQ2lkcnMsIG9sZFB1YmxpY0FjY2Vzc0NpZHJzKSxcbiAgICByZXBsYWNlUm9sZTogbmV3UHJvcHMucm9sZUFybiAhPT0gb2xkUHJvcHMucm9sZUFybixcbiAgICB1cGRhdGVWZXJzaW9uOiBuZXdQcm9wcy52ZXJzaW9uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLENBQUMsa0JBQWtCLEdBQUksS0FBYSxDQUFDLGtCQUFrQixDQUFDO1FBQzVELElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO1FBRW5CLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxhQUFhLENBQUM7UUFDNUQsSUFBSSxDQUFDLFlBQVksRUFBRTtZQUNqQixNQUFNLElBQUksS0FBSyxDQUFDLGdDQUFnQyxDQUFDLENBQUM7U0FDbkQ7UUFFRCxHQUFHLENBQUMsbUJBQW1CLENBQUM7WUFDdEIsT0FBTyxFQUFFLFlBQVk7WUFDckIsZUFBZSxFQUFFLHFCQUFxQixJQUFJLENBQUMsV0FBVyxJQUFJLElBQUksQ0FB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ZXJDb25maWdSZXNwb25zZT47XG4gIHVwZGF0ZUNsdXN0ZXJWZXJzaW9uKHJlcXVlc3Q6IGF3cy5FS1MuVXBkYXRlQ2x1c3RlclZlcnNpb25SZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLlVwZGF0ZUNsdXN0ZXJWZXJzaW9uUmVzcG9uc2U+O1xuICBkZXNjcmliZVVwZGF0ZShyZXE6IGF3cy5FS1MuRGVzY3JpYmVVcGRhdGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlVXBkYXRlUmVzcG9uc2U+O1xuICBjcmVhdGVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkNyZWF0ZUZhcmdhdGVQcm9maWxlUmVxdWVzdCk6IFByb21pc2U8YXdzLkVLUy5DcmVhdGVGYXJnYXRlUHJvZmlsZVJlc3BvbnNlPjtcbiAgZGVzY3JpYmVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFakgsTUFBTSxvQkFBb0IsR0FBd0M7WUFDaEUsa0JBQWtCO1lBQ2xCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNO1NBQ3hDLENBQUM7UUFFRixJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsb0JBQW9CLEVBQUUsQ0FBQyxDQUFDO1FBQ25DLE1BQU0sNEJBQTRCLEdBQUcsTUFBTSxJQUFJLENBQUMsR0FBRyxDQUFDLG9CQUFvQixDQUFDLG9CQUFvQixDQU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oZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Uns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pb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package.json b/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package.json deleted file mode 100644 index e8c7bde1b56a1..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.eks-service-account-sdk-call.js.snapshot/asset.81dc0a300ef19edd3977004717c7bf8f1581de17da3a5c7b4accd0997716b14b/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "eks-service-account-sdk-call-integ-test", - "private": "true", - "dependencies": { - "aws-sdk": "^2.1313.0" - } -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQ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zc0NpZHJzKSxcbiAgICByZXBsYWNlUm9sZTogbmV3UHJvcHMucm9sZUFybiAhPT0gb2xkUHJvcHMucm9sZUFybixcbiAgICB1cGRhdGVWZXJzaW9uOiBuZXdQcm9wcy52ZXJzaW9uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXM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RlUmVzcG9uc2U+O1xuICBjcmVhdGVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkNyZWF0ZUZhcmdhdGVQcm9maWxlUmVxdWVzdCk6IFByb21pc2U8YXdzLkVLUy5DcmVhdGVGYXJnYXRlUHJvZmlsZVJlc3BvbnNlPjtcbiAgZGVzY3JpYmVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJm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aWJlRmFyZ2F0ZVByb2ZpbGUoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZSk7XG4gICAgICB0aGlzLmxvZyh7IGRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZSB9KTtcbiAgICAgIGNvbnN0IHN0YXR1cyA9IGRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZS5mYXJnYXRlUHJvZmlsZT8uc3RhdHVzO1xuXG4gICAgICBpZiAoc3RhdHVzID09PSAnQ1JFQVRFX0ZBSUxFRCcgfHwgc3RhdHVzID09PSAnREVMRVRFX0ZBSUxFRCcpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKHN0YXR1cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzdGF0dXM7XG4gICAgfSBjYXRjaCAoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcs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KGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/integ.fargate-cluster.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/pinger/pinger.ts b/packages/@aws-cdk/aws-eks/test/pinger/pinger.ts deleted file mode 100644 index 16f92d31ca2f6..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/pinger/pinger.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { CustomResource, Token, Duration } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import { Construct } from 'constructs'; - -export interface PingerProps { - readonly url: string; - readonly securityGroup?: ec2.SecurityGroup; - readonly vpc?: ec2.IVpc; - readonly subnets?: ec2.ISubnet[]; -} -export class Pinger extends Construct { - - private _resource: CustomResource; - - constructor(scope: Construct, id: string, props: PingerProps) { - super(scope, id); - - const func = new lambda.Function(this, 'Function', { - code: lambda.Code.fromAsset(`${__dirname}/function`), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - vpc: props.vpc, - vpcSubnets: props.subnets ? { subnets: props.subnets } : undefined, - securityGroups: props.securityGroup ? [props.securityGroup] : undefined, - timeout: Duration.minutes(10), - }); - - const provider = new cr.Provider(this, 'Provider', { - onEventHandler: func, - }); - - this._resource = new CustomResource(this, 'Resource', { - serviceToken: provider.serviceToken, - properties: { - Url: props.url, - }, - }); - } - - public get response() { - return Token.asString(this._resource.getAtt('Value')); - } -} diff --git a/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/package.json b/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/package.json deleted file mode 100644 index 65e9857efb409..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/sdk-call-integ-test-docker-app/app/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "eks-service-account-sdk-call-integ-test", - "private": "true", - "dependencies": { - "aws-sdk": "^2.1329.0" - } -} diff --git a/packages/@aws-cdk/aws-eks/test/util.ts b/packages/@aws-cdk/aws-eks/test/util.ts deleted file mode 100644 index cf02330cea795..0000000000000 --- a/packages/@aws-cdk/aws-eks/test/util.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, Stack } from '@aws-cdk/core'; -import { Cluster, ClusterProps, KubernetesVersion } from '../lib'; - -const CLUSTER_VERSION = KubernetesVersion.V1_25; - -export function testFixture() { - const { stack, app } = testFixtureNoVpc(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - return { stack, vpc, app }; -} - -export function testFixtureNoVpc() { - const app = new App(); - const stack = new Stack(app, 'Stack', { env: { region: 'us-east-1' } }); - return { stack, app }; -} - -export function testFixtureCluster(props: Omit = {}) { - const { stack, app } = testFixtureNoVpc(); - const cluster = new Cluster(stack, 'Cluster', { - version: CLUSTER_VERSION, - prune: false, // mainly because this feature was added later and we wanted to avoid having to update all test expectations.... - ...props, - }); - - return { stack, app, cluster }; -} diff --git a/packages/@aws-cdk/aws-elasticache/.eslintrc.js b/packages/@aws-cdk/aws-elasticache/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticache/.gitignore b/packages/@aws-cdk/aws-elasticache/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticache/.npmignore b/packages/@aws-cdk/aws-elasticache/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticache/LICENSE b/packages/@aws-cdk/aws-elasticache/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticache/NOTICE b/packages/@aws-cdk/aws-elasticache/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticache/README.md b/packages/@aws-cdk/aws-elasticache/README.md deleted file mode 100644 index 326b503a2765a..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon ElastiCache Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as elasticache from '@aws-cdk/aws-elasticache'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ElastiCache construct libraries](https://constructs.dev/search?q=elasticache) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ElastiCache resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElastiCache.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ElastiCache](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElastiCache.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-elasticache/jest.config.js b/packages/@aws-cdk/aws-elasticache/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticache/lib/index.ts b/packages/@aws-cdk/aws-elasticache/lib/index.ts deleted file mode 100644 index ce5e23047a4c9..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ElastiCache CloudFormation Resources: -export * from './elasticache.generated'; diff --git a/packages/@aws-cdk/aws-elasticache/package.json b/packages/@aws-cdk/aws-elasticache/package.json deleted file mode 100644 index 1729eb81b009a..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticache", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ElastiCache", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticache", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticache" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ElastiCache", - "packageId": "Amazon.CDK.AWS.ElastiCache", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticache", - "module": "aws_cdk.aws_elasticache", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticache" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ElastiCache", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "elasticache" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-elasticache/test/elasticache.test.ts b/packages/@aws-cdk/aws-elasticache/test/elasticache.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-elasticache/test/elasticache.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/.eslintrc.js b/packages/@aws-cdk/aws-elasticbeanstalk/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/.gitignore b/packages/@aws-cdk/aws-elasticbeanstalk/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/.npmignore b/packages/@aws-cdk/aws-elasticbeanstalk/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/LICENSE b/packages/@aws-cdk/aws-elasticbeanstalk/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/NOTICE b/packages/@aws-cdk/aws-elasticbeanstalk/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/README.md b/packages/@aws-cdk/aws-elasticbeanstalk/README.md deleted file mode 100644 index e0adc334db4bd..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Elastic Beanstalk Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as elasticbeanstalk from '@aws-cdk/aws-elasticbeanstalk'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ElasticBeanstalk construct libraries](https://constructs.dev/search?q=elasticbeanstalk) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ElasticBeanstalk resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElasticBeanstalk.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ElasticBeanstalk](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElasticBeanstalk.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/jest.config.js b/packages/@aws-cdk/aws-elasticbeanstalk/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/lib/index.ts b/packages/@aws-cdk/aws-elasticbeanstalk/lib/index.ts deleted file mode 100644 index 925781065558f..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ElasticBeanstalk CloudFormation Resources: -export * from './elasticbeanstalk.generated'; diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/package.json b/packages/@aws-cdk/aws-elasticbeanstalk/package.json deleted file mode 100644 index 69480ac079eec..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticbeanstalk", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ElasticBeanstalk", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticbeanstalk", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticbeanstalk" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ElasticBeanstalk", - "packageId": "Amazon.CDK.AWS.ElasticBeanstalk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticbeanstalk", - "module": "aws_cdk.aws_elasticbeanstalk", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticbeanstalk" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ElasticBeanstalk", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "elasticbeanstalk" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/test/elasticbeanstalk.test.ts b/packages/@aws-cdk/aws-elasticbeanstalk/test/elasticbeanstalk.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-elasticbeanstalk/test/elasticbeanstalk.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/.eslintrc.js b/packages/@aws-cdk/aws-elasticloadbalancing/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/.gitignore b/packages/@aws-cdk/aws-elasticloadbalancing/.gitignore deleted file mode 100644 index 06316f8f696f5..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/.npmignore b/packages/@aws-cdk/aws-elasticloadbalancing/.npmignore deleted file mode 100644 index 40308877b4d66..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -jest.config.js - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/LICENSE b/packages/@aws-cdk/aws-elasticloadbalancing/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/NOTICE b/packages/@aws-cdk/aws-elasticloadbalancing/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/README.md b/packages/@aws-cdk/aws-elasticloadbalancing/README.md deleted file mode 100644 index 676646f8efa6c..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Amazon Elastic Load Balancing Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -The `@aws-cdk/aws-elasticloadbalancing` package provides constructs for configuring -classic load balancers. - -## Configuring a Load Balancer - -Load balancers send traffic to one or more AutoScalingGroups. Create a load -balancer, set up listeners and a health check, and supply the fleet(s) you want -to load balance to in the `targets` property. - -```ts -declare const vpc: ec2.IVpc; -const lb = new elb.LoadBalancer(this, 'LB', { - vpc, - internetFacing: true, - healthCheck: { - port: 80, - }, -}); - -declare const myAutoScalingGroup: autoscaling.AutoScalingGroup; -lb.addTarget(myAutoScalingGroup); -lb.addListener({ - externalPort: 80, -}); -``` - -The load balancer allows all connections by default. If you want to change that, -pass the `allowConnectionsFrom` property while setting up the listener: - -```ts -declare const mySecurityGroup: ec2.SecurityGroup; -declare const lb: elb.LoadBalancer; -lb.addListener({ - externalPort: 80, - allowConnectionsFrom: [mySecurityGroup], -}); -``` - -### Adding Ec2 Instance as a target for the load balancer - -You can add an EC2 instance to the load balancer by calling using `new InstanceTarget` as the argument to `addTarget()`: - -```ts -const lb = new elb.LoadBalancer(this, 'LB', { - vpc, -}); -// instance to add as the target for load balancer. -const instance = new Instance(stack, 'targetInstance', { - vpc: vpc, - instanceType: InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO), - machineImage: new AmazonLinuxImage(), -}); -lb.addTarget(elb.InstanceTarget(instance)); -``` diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/jest.config.js b/packages/@aws-cdk/aws-elasticloadbalancing/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts b/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts deleted file mode 100644 index 4fec4bad91fa3..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts +++ /dev/null @@ -1,511 +0,0 @@ -import { - Connections, IConnectable, Instance, ISecurityGroup, IVpc, Peer, Port, - SecurityGroup, SelectedSubnets, SubnetSelection, SubnetType, -} from '@aws-cdk/aws-ec2'; -import { Duration, Lazy, Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnLoadBalancer } from './elasticloadbalancing.generated'; - -/** - * Construction properties for a LoadBalancer - */ -export interface LoadBalancerProps { - /** - * VPC network of the fleet instances - */ - readonly vpc: IVpc; - - /** - * Whether this is an internet-facing Load Balancer - * - * This controls whether the LB has a public IP address assigned. It does - * not open up the Load Balancer's security groups to public internet access. - * - * @default false - */ - readonly internetFacing?: boolean; - - /** - * What listeners to set up for the load balancer. - * - * Can also be added by .addListener() - * - * @default - - */ - readonly listeners?: LoadBalancerListener[]; - - /** - * What targets to load balance to. - * - * Can also be added by .addTarget() - * - * @default - None. - */ - readonly targets?: ILoadBalancerTarget[]; - - /** - * Health check settings for the load balancing targets. - * - * Not required but recommended. - * - * @default - None. - */ - readonly healthCheck?: HealthCheck; - - /** - * Whether cross zone load balancing is enabled - * - * This controls whether the load balancer evenly distributes requests - * across each availability zone - * - * @default true - */ - readonly crossZone?: boolean; - - /** - * Which subnets to deploy the load balancer - * - * Can be used to define a specific set of subnets to deploy the load balancer to. - * Useful multiple public or private subnets are covering the same availability zone. - * - * @default - Public subnets if internetFacing, Private subnets otherwise - */ - readonly subnetSelection?: SubnetSelection; - - /** - * Enable Loadbalancer access logs - * Can be used to avoid manual work as aws console - * Required S3 bucket name , enabled flag - * Can add interval for pushing log - * Can set bucket prefix in order to provide folder name inside bucket - * @default - disabled - */ - readonly accessLoggingPolicy?: CfnLoadBalancer.AccessLoggingPolicyProperty; - -} - -/** - * Describe the health check to a load balancer - */ -export interface HealthCheck { - /** - * What port number to health check on - */ - readonly port: number; - - /** - * What protocol to use for health checking - * - * The protocol is automatically determined from the port if it's not supplied. - * - * @default Automatic - */ - readonly protocol?: LoadBalancingProtocol; - - /** - * What path to use for HTTP or HTTPS health check (must return 200) - * - * For SSL and TCP health checks, accepting connections is enough to be considered - * healthy. - * - * @default "/" - */ - readonly path?: string; - - /** - * After how many successful checks is an instance considered healthy - * - * @default 2 - */ - readonly healthyThreshold?: number; - - /** - * After how many unsuccessful checks is an instance considered unhealthy - * - * @default 5 - */ - readonly unhealthyThreshold?: number; - - /** - * Number of seconds between health checks - * - * @default Duration.seconds(30) - */ - readonly interval?: Duration; - - /** - * Health check timeout - * - * @default Duration.seconds(5) - */ - readonly timeout?: Duration; -} - -/** - * Interface that is going to be implemented by constructs that you can load balance to - */ -export interface ILoadBalancerTarget extends IConnectable { - /** - * Attach load-balanced target to a classic ELB - * @param loadBalancer [disable-awslint:ref-via-interface] The load balancer to attach the target to - */ - attachToClassicLB(loadBalancer: LoadBalancer): void; -} - -/** - * Add a backend to the load balancer - */ -export interface LoadBalancerListener { - /** - * External listening port - */ - readonly externalPort: number; - - /** - * What public protocol to use for load balancing - * - * Either 'tcp', 'ssl', 'http' or 'https'. - * - * May be omitted if the external port is either 80 or 443. - */ - readonly externalProtocol?: LoadBalancingProtocol; - - /** - * Instance listening port - * - * Same as the externalPort if not specified. - * - * @default externalPort - */ - readonly internalPort?: number; - - /** - * What public protocol to use for load balancing - * - * Either 'tcp', 'ssl', 'http' or 'https'. - * - * May be omitted if the internal port is either 80 or 443. - * - * The instance protocol is 'tcp' if the front-end protocol - * is 'tcp' or 'ssl', the instance protocol is 'http' if the - * front-end protocol is 'https'. - */ - readonly internalProtocol?: LoadBalancingProtocol; - - /** - * SSL policy names - */ - readonly policyNames?: string[]; - - /** - * the ARN of the SSL certificate - * @deprecated - use sslCertificateArn instead - */ - readonly sslCertificateId?: string; - - /** - * the ARN of the SSL certificate - * - * @default - none - */ - readonly sslCertificateArn?: string; - - /** - * Allow connections to the load balancer from the given set of connection peers - * - * By default, connections will be allowed from anywhere. Set this to an empty list - * to deny connections, or supply a custom list of peers to allow connections from - * (IP ranges or security groups). - * - * @default Anywhere - */ - readonly allowConnectionsFrom?: IConnectable[]; -} - -export enum LoadBalancingProtocol { - TCP = 'tcp', - SSL = 'ssl', - HTTP = 'http', - HTTPS = 'https' -} - -/** - * A load balancer with a single listener - * - * Routes to a fleet of of instances in a VPC. - */ -export class LoadBalancer extends Resource implements IConnectable { - /** - * Control all connections from and to this load balancer - */ - public readonly connections: Connections; - - /** - * An object controlling specifically the connections for each listener added to this load balancer - */ - public readonly listenerPorts: ListenerPort[] = []; - - private readonly elb: CfnLoadBalancer; - private readonly securityGroup: SecurityGroup; - private readonly listeners: CfnLoadBalancer.ListenersProperty[] = []; - - private readonly instancePorts: number[] = []; - private readonly targets: ILoadBalancerTarget[] = []; - private readonly instanceIds: string[] = []; - - constructor(scope: Construct, id: string, props: LoadBalancerProps) { - super(scope, id); - - this.securityGroup = new SecurityGroup(this, 'SecurityGroup', { vpc: props.vpc, allowAllOutbound: false }); - this.connections = new Connections({ securityGroups: [this.securityGroup] }); - // Depending on whether the ELB has public or internal IPs, pick the right backend subnets - const selectedSubnets: SelectedSubnets = loadBalancerSubnets(props); - - this.elb = new CfnLoadBalancer(this, 'Resource', { - securityGroups: [this.securityGroup.securityGroupId], - subnets: selectedSubnets.subnetIds, - listeners: Lazy.any({ produce: () => this.listeners }), - instances: Lazy.list({ produce: () => this.instanceIds }, { omitEmpty: true }), - scheme: props.internetFacing ? 'internet-facing' : 'internal', - healthCheck: props.healthCheck && healthCheckToJSON(props.healthCheck), - crossZone: props.crossZone ?? true, - }); - if (props.internetFacing) { - this.elb.node.addDependency(selectedSubnets.internetConnectivityEstablished); - } - - if (props.accessLoggingPolicy !== undefined) { - this.elb.accessLoggingPolicy = props.accessLoggingPolicy; - } - - ifUndefined(props.listeners, []).forEach(b => this.addListener(b)); - ifUndefined(props.targets, []).forEach(t => this.addTarget(t)); - } - - /** - * Add a backend to the load balancer - * - * @returns A ListenerPort object that controls connections to the listener port - */ - public addListener(listener: LoadBalancerListener): ListenerPort { - if (listener.sslCertificateArn && listener.sslCertificateId) { - throw new Error('"sslCertificateId" is deprecated, please use "sslCertificateArn" only.'); - } - const protocol = ifUndefinedLazy(listener.externalProtocol, () => wellKnownProtocol(listener.externalPort)); - const instancePort = listener.internalPort || listener.externalPort; - const sslCertificateArn = listener.sslCertificateArn || listener.sslCertificateId; - const instanceProtocol = ifUndefined(listener.internalProtocol, - ifUndefined(tryWellKnownProtocol(instancePort), - isHttpProtocol(protocol) ? LoadBalancingProtocol.HTTP : LoadBalancingProtocol.TCP)); - - this.listeners.push({ - loadBalancerPort: listener.externalPort.toString(), - protocol, - instancePort: instancePort.toString(), - instanceProtocol, - sslCertificateId: sslCertificateArn, - policyNames: listener.policyNames, - }); - - const port = new ListenerPort(this.securityGroup, Port.tcp(listener.externalPort)); - - // Allow connections on the public port for all supplied peers (default: everyone) - ifUndefined(listener.allowConnectionsFrom, [Peer.anyIpv4()]).forEach(peer => { - port.connections.allowDefaultPortFrom(peer, `Default rule allow on ${listener.externalPort}`); - }); - - this.newInstancePort(instancePort); - - // Keep track using array so user can get to them even if they were all supplied in the constructor - this.listenerPorts.push(port); - - return port; - } - - public addTarget(target: ILoadBalancerTarget) { - target.attachToClassicLB(this); - - this.newTarget(target); - } - - /** - * @attribute - */ - public get loadBalancerName() { - return this.elb.ref; - } - - /** - * @attribute - */ - public get loadBalancerCanonicalHostedZoneNameId() { - return this.elb.attrCanonicalHostedZoneNameId; - } - - /** - * @attribute - */ - public get loadBalancerCanonicalHostedZoneName() { - return this.elb.attrCanonicalHostedZoneName; - } - - /** - * @attribute - */ - public get loadBalancerDnsName() { - return this.elb.attrDnsName; - } - - /** - * @attribute - */ - public get loadBalancerSourceSecurityGroupGroupName() { - return this.elb.attrSourceSecurityGroupGroupName; - } - - /** - * @attribute - */ - public get loadBalancerSourceSecurityGroupOwnerAlias() { - return this.elb.attrSourceSecurityGroupOwnerAlias; - } - - /** - * Allow connections to all existing targets on new instance port - */ - private newInstancePort(instancePort: number) { - this.targets.forEach(t => this.allowTargetConnection(instancePort, t)); - - // Keep track of port for future targets - this.instancePorts.push(instancePort); - } - - /** - * Allow connections to target on all existing instance ports - */ - private newTarget(target: ILoadBalancerTarget) { - this.instancePorts.forEach(p => this.allowTargetConnection(p, target)); - - // Keep track of target for future listeners. - this.targets.push(target); - } - - /** - * Allow connections for a single (port, target) pair - */ - private allowTargetConnection(instancePort: number, target: ILoadBalancerTarget) { - this.connections.allowTo( - target, - Port.tcp(instancePort), - `Port ${instancePort} LB to fleet`); - } - - /** - * Add instance to the load balancer. - * @internal - */ - public _addInstanceId(instanceId: string) { - this.instanceIds.push(instanceId); - } -} - -/** - * An EC2 instance that is the target for load balancing - */ -export class InstanceTarget implements ILoadBalancerTarget { - readonly connections: Connections; - /** - * Create a new Instance target. - * - * @param instance Instance to register to. - */ - constructor(public readonly instance: Instance) { - this.connections = instance.connections; - } - - public attachToClassicLB(loadBalancer: LoadBalancer): void { - loadBalancer._addInstanceId(this.instance.instanceId); - } -} - -/** - * Reference to a listener's port just created. - * - * This implements IConnectable with a default port (the port that an ELB - * listener was just created on) for a given security group so that it can be - * conveniently used just like any Connectable. E.g: - * - * const listener = elb.addListener(...); - * - * listener.connections.allowDefaultPortFromAnyIPv4(); - * // or - * instance.connections.allowToDefaultPort(listener); - */ -export class ListenerPort implements IConnectable { - public readonly connections: Connections; - - constructor(securityGroup: ISecurityGroup, defaultPort: Port) { - this.connections = new Connections({ securityGroups: [securityGroup], defaultPort }); - } -} - -function wellKnownProtocol(port: number): LoadBalancingProtocol { - const proto = tryWellKnownProtocol(port); - if (!proto) { - throw new Error(`Please supply protocol to go with port ${port}`); - } - return proto; -} - -function tryWellKnownProtocol(port: number): LoadBalancingProtocol | undefined { - if (port === 80) { return LoadBalancingProtocol.HTTP; } - if (port === 443) { return LoadBalancingProtocol.HTTPS; } - return undefined; -} - -function isHttpProtocol(proto: LoadBalancingProtocol): boolean { - return proto === LoadBalancingProtocol.HTTPS || proto === LoadBalancingProtocol.HTTP; -} - -function ifUndefined(x: T | undefined, def: T): T { - return x != null ? x : def; -} - -function ifUndefinedLazy(x: T | undefined, def: () => T): T { - return x != null ? x : def(); -} - -/** - * Turn health check parameters into a parameter blob for the LB - */ -function healthCheckToJSON(healthCheck: HealthCheck): CfnLoadBalancer.HealthCheckProperty { - const protocol = ifUndefined(healthCheck.protocol, - ifUndefined(tryWellKnownProtocol(healthCheck.port), - LoadBalancingProtocol.TCP)); - - const path = protocol === LoadBalancingProtocol.HTTP || protocol === LoadBalancingProtocol.HTTPS ? ifUndefined(healthCheck.path, '/') : ''; - - const target = `${protocol.toUpperCase()}:${healthCheck.port}${path}`; - - return { - healthyThreshold: ifUndefined(healthCheck.healthyThreshold, 2).toString(), - interval: (healthCheck.interval || Duration.seconds(30)).toSeconds().toString(), - target, - timeout: (healthCheck.timeout || Duration.seconds(5)).toSeconds().toString(), - unhealthyThreshold: ifUndefined(healthCheck.unhealthyThreshold, 5).toString(), - }; -} - -function loadBalancerSubnets(props: LoadBalancerProps): SelectedSubnets { - if (props.subnetSelection !== undefined) { - return props.vpc.selectSubnets(props.subnetSelection); - } else if (props.internetFacing) { - return props.vpc.selectSubnets({ - subnetType: SubnetType.PUBLIC, - }); - } else { - return props.vpc.selectSubnets({ - subnetType: SubnetType.PRIVATE_WITH_EGRESS, - }); - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/package.json b/packages/@aws-cdk/aws-elasticloadbalancing/package.json deleted file mode 100644 index 7651b907d9554..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/package.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticloadbalancing", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ElasticLoadBalancing", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticloadbalancing", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticloadbalancing" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ElasticLoadBalancing", - "packageId": "Amazon.CDK.AWS.ElasticLoadBalancing", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticloadbalancing", - "module": "aws_cdk.aws_elasticloadbalancing", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticloadbalancing" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ElasticLoadBalancing", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "elasticloadbalancing" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "nyc": { - "statements": 75 - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-elasticloadbalancing.LoadBalancerProps", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.addTarget", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancingProtocol.HTTPS", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.ListenerPort.connections", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.loadBalancerCanonicalHostedZoneName", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.loadBalancerCanonicalHostedZoneNameId", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.loadBalancerDnsName", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.loadBalancerName", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.loadBalancerSourceSecurityGroupGroupName", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancer.loadBalancerSourceSecurityGroupOwnerAlias", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancingProtocol.HTTP", - "props-default-doc:@aws-cdk/aws-elasticloadbalancing.LoadBalancerListener.externalProtocol", - "props-default-doc:@aws-cdk/aws-elasticloadbalancing.LoadBalancerListener.internalProtocol", - "props-default-doc:@aws-cdk/aws-elasticloadbalancing.LoadBalancerListener.policyNames", - "props-default-doc:@aws-cdk/aws-elasticloadbalancing.LoadBalancerListener.sslCertificateId", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancingProtocol", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancingProtocol.TCP", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancing.LoadBalancingProtocol.SSL" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-elasticloadbalancing/rosetta/default.ts-fixture deleted file mode 100644 index 036e5ddf38c1b..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts b/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts deleted file mode 100644 index a0baab04e5883..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancing/test/integ.elb.ts +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as elb from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-elb-integ'); - -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 1, -}); - -new elb.LoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - listeners: [{ - externalPort: 80, - allowConnectionsFrom: [ec2.Peer.anyIpv4()], - }], - healthCheck: { - port: 80, - }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.eslintrc.js b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.eslintrc.js deleted file mode 100644 index 1a3b4ca2b6aec..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.eslintrc.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.gitignore b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.gitignore deleted file mode 100644 index 62a5270ce7857..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -.cdk.staging -!.eslintrc.js - -!jest.config.js -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.npmignore b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.npmignore deleted file mode 100644 index 2b08446cbf265..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -jest.config.js -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/LICENSE b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/NOTICE b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/README.md b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/README.md deleted file mode 100644 index d39cf3c6bc843..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# Actions for AWS Elastic Load Balancing V2 - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This package contains integration actions for ELBv2. See the README of the `@aws-cdk/aws-elasticloadbalancingv2` library. - -## Cognito - -ELB allows for requests to be authenticated against a Cognito user pool using -the `AuthenticateCognitoAction`. For details on the setup's requirements, -read [Prepare to use Amazon -Cognito](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html#cognito-requirements). -Here's an example: - -```ts -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { - vpc, - internetFacing: true, -}); - -const userPool = new cognito.UserPool(this, 'UserPool'); -const userPoolClient = new cognito.UserPoolClient(this, 'Client', { - userPool, - - // Required minimal configuration for use with an ELB - generateSecret: true, - authFlows: { - userPassword: true, - }, - oAuth: { - flows: { - authorizationCodeGrant: true, - }, - scopes: [cognito.OAuthScope.EMAIL], - callbackUrls: [ - `https://${lb.loadBalancerDnsName}/oauth2/idpresponse`, - ], - }, -}); -const cfnClient = userPoolClient.node.defaultChild as cognito.CfnUserPoolClient; -cfnClient.addPropertyOverride('RefreshTokenValidity', 1); -cfnClient.addPropertyOverride('SupportedIdentityProviders', ['COGNITO']); - -const userPoolDomain = new cognito.UserPoolDomain(this, 'Domain', { - userPool, - cognitoDomain: { - domainPrefix: 'test-cdk-prefix', - }, -}); - -lb.addListener('Listener', { - port: 443, - certificates: [certificate], - defaultAction: new actions.AuthenticateCognitoAction({ - userPool, - userPoolClient, - userPoolDomain, - next: elbv2.ListenerAction.fixedResponse(200, { - contentType: 'text/plain', - messageBody: 'Authenticated', - }), - }), -}); - -new CfnOutput(this, 'DNS', { - value: lb.loadBalancerDnsName, -}); - -``` diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/jest.config.js b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/jest.config.js deleted file mode 100644 index 751c263a6e75c..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - ...baseConfig.coverageThreshold.global, - branches: 70, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json deleted file mode 100644 index 908a21a0b66a3..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/package.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticloadbalancingv2-actions", - "version": "0.0.0", - "private": true, - "description": "Integration actions for AWS ElasticLoadBalancingV2", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticloadbalancingv2.actions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticloadbalancingv2-actions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ElasticLoadBalancingV2.Actions", - "packageId": "Amazon.CDK.AWS.ElasticLoadBalancingV2.Actions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticloadbalancingv2-actions", - "module": "aws_cdk.aws_elasticloadbalancingv2_actions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticloadbalancingv2-actions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "cloudlib", - "aws-cloudlib", - "aws-clib" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awslint": {}, - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/cognito.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/cognito.test.ts deleted file mode 100644 index e747c60980660..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/test/cognito.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cognito from '@aws-cdk/aws-cognito'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Stack } from '@aws-cdk/core'; -import * as actions from '../lib'; - -test('Cognito Action', () => { - // GIVEN - const stack = new Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - const userPool = new cognito.UserPool(stack, 'UserPool'); - const userPoolClient = new cognito.UserPoolClient(stack, 'Client', { userPool }); - const userPoolDomain = new cognito.UserPoolDomain(stack, 'Domain', { - userPool, - cognitoDomain: { - domainPrefix: 'prefix', - }, - }); - - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: new actions.AuthenticateCognitoAction({ - userPool, - userPoolClient, - userPoolDomain, - next: elbv2.ListenerAction.fixedResponse(200, { - contentType: 'text/plain', - messageBody: 'Authenticated', - }), - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - AuthenticateCognitoConfig: { - UserPoolArn: { 'Fn::GetAtt': ['UserPool6BA7E5F2', 'Arn'] }, - UserPoolClientId: { Ref: 'Client4A7F64DF' }, - UserPoolDomain: { Ref: 'Domain66AC69E0' }, - }, - Order: 1, - Type: 'authenticate-cognito', - }, - { - FixedResponseConfig: { - ContentType: 'text/plain', - MessageBody: 'Authenticated', - StatusCode: '200', - }, - Order: 2, - Type: 'fixed-response', - }, - ], - }); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.eslintrc.js b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.gitignore b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.gitignore deleted file mode 100644 index 24b6aacaee731..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -.cdk.staging -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.npmignore b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.npmignore deleted file mode 100644 index 8ea92f72c8fab..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/LICENSE b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/NOTICE b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/README.md b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/README.md deleted file mode 100644 index b94a08b0c478a..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Targets for AWS Elastic Load Balancing V2 - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This package contains targets for ELBv2. See the README of the `@aws-cdk/aws-elasticloadbalancingv2` library. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/jest.config.js b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json deleted file mode 100644 index b7d5624db9351..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/package.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticloadbalancingv2-targets", - "version": "0.0.0", - "private": true, - "description": "Integration targets for AWS ElasticLoadBalancingV2", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticloadbalancingv2.targets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticloadbalancingv2-targets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets", - "packageId": "Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticloadbalancingv2-targets", - "module": "aws_cdk.aws_elasticloadbalancingv2_targets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticloadbalancingv2-targets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "elasticloadbalancing", - "elb" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-ecs-patterns": "0.0.0" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awslint": { - "exclude": [ - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2-targets.InstanceTarget", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2-targets.LambdaTarget" - ] - }, - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/.eslintrc.js b/packages/@aws-cdk/aws-elasticloadbalancingv2/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/.gitignore b/packages/@aws-cdk/aws-elasticloadbalancingv2/.gitignore deleted file mode 100644 index 5416b7824aee9..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/.npmignore b/packages/@aws-cdk/aws-elasticloadbalancingv2/.npmignore deleted file mode 100644 index 40308877b4d66..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -jest.config.js - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/LICENSE b/packages/@aws-cdk/aws-elasticloadbalancingv2/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/NOTICE b/packages/@aws-cdk/aws-elasticloadbalancingv2/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md b/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md deleted file mode 100644 index 87572898730b8..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/README.md +++ /dev/null @@ -1,653 +0,0 @@ -# Amazon Elastic Load Balancing V2 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -The `@aws-cdk/aws-elasticloadbalancingv2` package provides constructs for -configuring application and network load balancers. - -For more information, see the AWS documentation for -[Application Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html) -and [Network Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html). - -## Defining an Application Load Balancer - -You define an application load balancer by creating an instance of -`ApplicationLoadBalancer`, adding a Listener to the load balancer -and adding Targets to the Listener: - -```ts -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -declare const asg: AutoScalingGroup; - -declare const vpc: ec2.Vpc; - -// Create the load balancer in a VPC. 'internetFacing' is 'false' -// by default, which creates an internal load balancer. -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { - vpc, - internetFacing: true -}); - -// Add a listener and open up the load balancer's security group -// to the world. -const listener = lb.addListener('Listener', { - port: 80, - - // 'open: true' is the default, you can leave it out if you want. Set it - // to 'false' and use `listener.connections` if you want to be selective - // about who can access the load balancer. - open: true, -}); - -// Create an AutoScaling group and add it as a load balancing -// target to the listener. -listener.addTargets('ApplicationFleet', { - port: 8080, - targets: [asg] -}); -``` - -The security groups of the load balancer and the target are automatically -updated to allow the network traffic. - -One (or more) security groups can be associated with the load balancer; -if a security group isn't provided, one will be automatically created. - -```ts -declare const vpc: ec2.Vpc; - -const securityGroup1 = new ec2.SecurityGroup(this, 'SecurityGroup1', { vpc }); -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { - vpc, - internetFacing: true, - securityGroup: securityGroup1, // Optional - will be automatically created otherwise -}); - -const securityGroup2 = new ec2.SecurityGroup(this, 'SecurityGroup2', { vpc }); -lb.addSecurityGroup(securityGroup2); -``` - -### Conditions - -It's possible to route traffic to targets based on conditions in the incoming -HTTP request. For example, the following will route requests to the indicated -AutoScalingGroup only if the requested host in the request is either for -`example.com/ok` or `example.com/path`: - -```ts -declare const listener: elbv2.ApplicationListener; -declare const asg: autoscaling.AutoScalingGroup; - -listener.addTargets('Example.Com Fleet', { - priority: 10, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['example.com']), - elbv2.ListenerCondition.pathPatterns(['/ok', '/path']), - ], - port: 8080, - targets: [asg] -}); -``` - -A target with a condition contains either `pathPatterns` or `hostHeader`, or -both. If both are specified, both conditions must be met for the requests to -be routed to the given target. `priority` is a required field when you add -targets with conditions. The lowest number wins. - -Every listener must have at least one target without conditions, which is -where all requests that didn't match any of the conditions will be sent. - -### Convenience methods and more complex Actions - -Routing traffic from a Load Balancer to a Target involves the following steps: - -- Create a Target Group, register the Target into the Target Group -- Add an Action to the Listener which forwards traffic to the Target Group. - -A new listener can be added to the Load Balancer by calling `addListener()`. -Listeners that have been added to the load balancer can be listed using the -`listeners` property. Note that the `listeners` property will throw an Error -for imported or looked up Load Balancers. - -Various methods on the `Listener` take care of this work for you to a greater -or lesser extent: - -- `addTargets()` performs both steps: automatically creates a Target Group and the - required Action. -- `addTargetGroups()` gives you more control: you create the Target Group (or - Target Groups) yourself and the method creates Action that routes traffic to - the Target Groups. -- `addAction()` gives you full control: you supply the Action and wire it up - to the Target Groups yourself (or access one of the other ELB routing features). - -Using `addAction()` gives you access to some of the features of an Elastic Load -Balancer that the other two convenience methods don't: - -- **Routing stickiness**: use `ListenerAction.forward()` and supply a - `stickinessDuration` to make sure requests are routed to the same target group - for a given duration. -- **Weighted Target Groups**: use `ListenerAction.weightedForward()` - to give different weights to different target groups. -- **Fixed Responses**: use `ListenerAction.fixedResponse()` to serve - a static response (ALB only). -- **Redirects**: use `ListenerAction.redirect()` to serve an HTTP - redirect response (ALB only). -- **Authentication**: use `ListenerAction.authenticateOidc()` to - perform OpenID authentication before serving a request (see the - `@aws-cdk/aws-elasticloadbalancingv2-actions` package for direct authentication - integration with Cognito) (ALB only). - -Here's an example of serving a fixed response at the `/ok` URL: - -```ts -declare const listener: elbv2.ApplicationListener; - -listener.addAction('Fixed', { - priority: 10, - conditions: [ - elbv2.ListenerCondition.pathPatterns(['/ok']), - ], - action: elbv2.ListenerAction.fixedResponse(200, { - contentType: 'text/plain', - messageBody: 'OK', - }) -}); -``` - -Here's an example of using OIDC authentication before forwarding to a TargetGroup: - -```ts -declare const listener: elbv2.ApplicationListener; -declare const myTargetGroup: elbv2.ApplicationTargetGroup; - -listener.addAction('DefaultAction', { - action: elbv2.ListenerAction.authenticateOidc({ - authorizationEndpoint: 'https://example.com/openid', - // Other OIDC properties here - clientId: '...', - clientSecret: SecretValue.secretsManager('...'), - issuer: '...', - tokenEndpoint: '...', - userInfoEndpoint: '...', - - // Next - next: elbv2.ListenerAction.forward([myTargetGroup]), - }), -}); -``` - -If you just want to redirect all incoming traffic on one port to another port, you can use the following code: - -```ts -declare const lb: elbv2.ApplicationLoadBalancer; - -lb.addRedirect({ - sourceProtocol: elbv2.ApplicationProtocol.HTTPS, - sourcePort: 8443, - targetProtocol: elbv2.ApplicationProtocol.HTTP, - targetPort: 8080, -}); -``` - -If you do not provide any options for this method, it redirects HTTP port 80 to HTTPS port 443. - -By default all ingress traffic will be allowed on the source port. If you want to be more selective with your -ingress rules then set `open: false` and use the listener's `connections` object to selectively grant access to the listener. - -### Load Balancer attributes - -You can modify attributes of Application Load Balancers: - -```ts -const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { - vpc, - internetFacing: true, - - // Whether HTTP/2 is enabled - http2Enabled: false, - - // The idle timeout value, in seconds - idleTimeout: cdk.Duration.seconds(1000), - - // Whether HTTP headers with header fields thatare not valid - // are removed by the load balancer (true), or routed to targets - dropInvalidHeaderFields: true, - - // How the load balancer handles requests that might - // pose a security risk to your application - desyncMitigationMode: elbv2.DesyncMitigationMode.DEFENSIVE, -}); -``` - -For more information, see [Load balancer attributes](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes) - -## Defining a Network Load Balancer - -Network Load Balancers are defined in a similar way to Application Load -Balancers: - -```ts -declare const vpc: ec2.Vpc; -declare const asg: autoscaling.AutoScalingGroup; - -// Create the load balancer in a VPC. 'internetFacing' is 'false' -// by default, which creates an internal load balancer. -const lb = new elbv2.NetworkLoadBalancer(this, 'LB', { - vpc, - internetFacing: true -}); - -// Add a listener on a particular port. -const listener = lb.addListener('Listener', { - port: 443, -}); - -// Add targets on a particular port. -listener.addTargets('AppFleet', { - port: 443, - targets: [asg] -}); -``` - -One thing to keep in mind is that network load balancers do not have security -groups, and no automatic security group configuration is done for you. You will -have to configure the security groups of the target yourself to allow traffic by -clients and/or load balancer instances, depending on your target types. See -[Target Groups for your Network Load -Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html) -and [Register targets with your Target -Group](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-register-targets.html) -for more information. - -## Targets and Target Groups - -Application and Network Load Balancers organize load balancing targets in Target -Groups. If you add your balancing targets (such as AutoScalingGroups, ECS -services or individual instances) to your listener directly, the appropriate -`TargetGroup` will be automatically created for you. - -If you need more control over the Target Groups created, create an instance of -`ApplicationTargetGroup` or `NetworkTargetGroup`, add the members you desire, -and add it to the listener by calling `addTargetGroups` instead of `addTargets`. - -`addTargets()` will always return the Target Group it just created for you: - -```ts -declare const listener: elbv2.NetworkListener; -declare const asg1: autoscaling.AutoScalingGroup; -declare const asg2: autoscaling.AutoScalingGroup; - -const group = listener.addTargets('AppFleet', { - port: 443, - targets: [asg1], -}); - -group.addTarget(asg2); -``` - -### Sticky sessions for your Application Load Balancer - -By default, an Application Load Balancer routes each request independently to a registered target based on the chosen load-balancing algorithm. However, you can use the sticky session feature (also known as session affinity) to enable the load balancer to bind a user's session to a specific target. This ensures that all requests from the user during the session are sent to the same target. This feature is useful for servers that maintain state information in order to provide a continuous experience to clients. To use sticky sessions, the client must support cookies. - -Application Load Balancers support both duration-based cookies (`lb_cookie`) and application-based cookies (`app_cookie`). The key to managing sticky sessions is determining how long your load balancer should consistently route the user's request to the same target. Sticky sessions are enabled at the target group level. You can use a combination of duration-based stickiness, application-based stickiness, and no stickiness across all of your target groups. - -```ts -declare const vpc: ec2.Vpc; - -// Target group with duration-based stickiness with load-balancer generated cookie -const tg1 = new elbv2.ApplicationTargetGroup(this, 'TG1', { - targetType: elbv2.TargetType.INSTANCE, - port: 80, - stickinessCookieDuration: Duration.minutes(5), - vpc, -}); - -// Target group with application-based stickiness -const tg2 = new elbv2.ApplicationTargetGroup(this, 'TG2', { - targetType: elbv2.TargetType.INSTANCE, - port: 80, - stickinessCookieDuration: Duration.minutes(5), - stickinessCookieName: 'MyDeliciousCookie', - vpc, -}); -``` - -For more information see: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html#application-based-stickiness - -### Setting the target group protocol version - -By default, Application Load Balancers send requests to targets using HTTP/1.1. You can use the [protocol version](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-protocol-version) to send requests to targets using HTTP/2 or gRPC. - -```ts -declare const vpc: ec2.Vpc; - -const tg = new elbv2.ApplicationTargetGroup(this, 'TG', { - targetType: elbv2.TargetType.IP, - port: 50051, - protocol: elbv2.ApplicationProtocol.HTTP, - protocolVersion: elbv2.ApplicationProtocolVersion.GRPC, - healthCheck: { - enabled: true, - healthyGrpcCodes: '0-99', - }, - vpc, -}); -``` - -## Using Lambda Targets - -To use a Lambda Function as a target, use the integration class in the -`@aws-cdk/aws-elasticloadbalancingv2-targets` package: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; -import * as targets from '@aws-cdk/aws-elasticloadbalancingv2-targets'; - -declare const lambdaFunction: lambda.Function; -declare const lb: elbv2.ApplicationLoadBalancer; - -const listener = lb.addListener('Listener', { port: 80 }); -listener.addTargets('Targets', { - targets: [new targets.LambdaTarget(lambdaFunction)], - - // For Lambda Targets, you need to explicitly enable health checks if you - // want them. - healthCheck: { - enabled: true, - } -}); -``` - -Only a single Lambda function can be added to a single listener rule. - -## Using Application Load Balancer Targets - -To use a single application load balancer as a target for the network load balancer, use the integration class in the -`@aws-cdk/aws-elasticloadbalancingv2-targets` package: - -```ts -import * as targets from '@aws-cdk/aws-elasticloadbalancingv2-targets'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as patterns from '@aws-cdk/aws-ecs-patterns'; - -declare const vpc: ec2.Vpc; - -const task = new ecs.FargateTaskDefinition(this, 'Task', { cpu: 256, memoryLimitMiB: 512 }); -task.addContainer('nginx', { - image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:latest'), - portMappings: [{ containerPort: 80 }], -}); - -const svc = new patterns.ApplicationLoadBalancedFargateService(this, 'Service', { - vpc, - taskDefinition: task, - publicLoadBalancer: false, -}); - -const nlb = new elbv2.NetworkLoadBalancer(this, 'Nlb', { - vpc, - crossZoneEnabled: true, - internetFacing: true, -}); - -const listener = nlb.addListener('listener', { port: 80 }); - -listener.addTargets('Targets', { - targets: [new targets.AlbTarget(svc.loadBalancer, 80)], - port: 80, -}); - -new CfnOutput(this, 'NlbEndpoint', { value: `http://${nlb.loadBalancerDnsName}`}) -``` - -Only the network load balancer is allowed to add the application load balancer as the target. - -## Configuring Health Checks - -Health checks are configured upon creation of a target group: - -```ts -declare const listener: elbv2.ApplicationListener; -declare const asg: autoscaling.AutoScalingGroup; - -listener.addTargets('AppFleet', { - port: 8080, - targets: [asg], - healthCheck: { - path: '/ping', - interval: Duration.minutes(1), - } -}); -``` - -The health check can also be configured after creation by calling -`configureHealthCheck()` on the created object. - -No attempts are made to configure security groups for the port you're -configuring a health check for, but if the health check is on the same port -you're routing traffic to, the security group already allows the traffic. -If not, you will have to configure the security groups appropriately: - -```ts -declare const lb: elbv2.ApplicationLoadBalancer; -declare const listener: elbv2.ApplicationListener; -declare const asg: autoscaling.AutoScalingGroup; - -listener.addTargets('AppFleet', { - port: 8080, - targets: [asg], - healthCheck: { - port: '8088', - } -}); - -asg.connections.allowFrom(lb, ec2.Port.tcp(8088)); -``` - -## Using a Load Balancer from a different Stack - -If you want to put your Load Balancer and the Targets it is load balancing to in -different stacks, you may not be able to use the convenience methods -`loadBalancer.addListener()` and `listener.addTargets()`. - -The reason is that these methods will create resources in the same Stack as the -object they're called on, which may lead to cyclic references between stacks. -Instead, you will have to create an `ApplicationListener` in the target stack, -or an empty `TargetGroup` in the load balancer stack that you attach your -service to. - -For an example of the alternatives while load balancing to an ECS service, see the -[ecs/cross-stack-load-balancer -example](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/ecs/cross-stack-load-balancer/). - -## Protocol for Load Balancer Targets - -Constructs that want to be a load balancer target should implement -`IApplicationLoadBalancerTarget` and/or `INetworkLoadBalancerTarget`, and -provide an implementation for the function `attachToXxxTargetGroup()`, which can -call functions on the load balancer and should return metadata about the -load balancing target: - -```ts -class MyTarget implements elbv2.IApplicationLoadBalancerTarget { - public attachToApplicationTargetGroup(targetGroup: elbv2.ApplicationTargetGroup): elbv2.LoadBalancerTargetProps { - // If we need to add security group rules - // targetGroup.registerConnectable(...); - return { - targetType: elbv2.TargetType.IP, - targetJson: { id: '1.2.3.4', port: 8080 }, - }; - } -} -``` - -`targetType` should be one of `Instance` or `Ip`. If the target can be -directly added to the target group, `targetJson` should contain the `id` of -the target (either instance ID or IP address depending on the type) and -optionally a `port` or `availabilityZone` override. - -Application load balancer targets can call `registerConnectable()` on the -target group to register themselves for addition to the load balancer's security -group rules. - -If your load balancer target requires that the TargetGroup has been -associated with a LoadBalancer before registration can happen (such as is the -case for ECS Services for example), take a resource dependency on -`targetGroup.loadBalancerAttached` as follows: - -```ts -declare const resource: Resource; -declare const targetGroup: elbv2.ApplicationTargetGroup; - -// Make sure that the listener has been created, and so the TargetGroup -// has been associated with the LoadBalancer, before 'resource' is created. - -Node.of(resource).addDependency(targetGroup.loadBalancerAttached); -``` - -## Looking up Load Balancers and Listeners - -You may look up load balancers and load balancer listeners by using one of the -following lookup methods: - -- `ApplicationLoadBalancer.fromlookup(options)` - Look up an application load - balancer. -- `ApplicationListener.fromLookup(options)` - Look up an application load - balancer listener. -- `NetworkLoadBalancer.fromLookup(options)` - Look up a network load balancer. -- `NetworkListener.fromLookup(options)` - Look up a network load balancer - listener. - -### Load Balancer lookup options - -You may look up a load balancer by ARN or by associated tags. When you look a -load balancer up by ARN, that load balancer will be returned unless CDK detects -that the load balancer is of the wrong type. When you look up a load balancer by -tags, CDK will return the load balancer matching all specified tags. If more -than one load balancer matches, CDK will throw an error requesting that you -provide more specific criteria. - -**Look up a Application Load Balancer by ARN** - -```ts -const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(this, 'ALB', { - loadBalancerArn: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456', -}); -``` - -**Look up an Application Load Balancer by tags** - -```ts -const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(this, 'ALB', { - loadBalancerTags: { - // Finds a load balancer matching all tags. - some: 'tag', - someother: 'tag', - }, -}); -``` - -## Load Balancer Listener lookup options - -You may look up a load balancer listener by the following criteria: - -- Associated load balancer ARN -- Associated load balancer tags -- Listener ARN -- Listener port -- Listener protocol - -The lookup method will return the matching listener. If more than one listener -matches, CDK will throw an error requesting that you specify additional -criteria. - -**Look up a Listener by associated Load Balancer, Port, and Protocol** - -```ts -const listener = elbv2.ApplicationListener.fromLookup(this, 'ALBListener', { - loadBalancerArn: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456', - listenerProtocol: elbv2.ApplicationProtocol.HTTPS, - listenerPort: 443, -}); -``` - -**Look up a Listener by associated Load Balancer Tag, Port, and Protocol** - -```ts -const listener = elbv2.ApplicationListener.fromLookup(this, 'ALBListener', { - loadBalancerTags: { - Cluster: 'MyClusterName', - }, - listenerProtocol: elbv2.ApplicationProtocol.HTTPS, - listenerPort: 443, -}); -``` - -**Look up a Network Listener by associated Load Balancer Tag, Port, and Protocol** - -```ts -const listener = elbv2.NetworkListener.fromLookup(this, 'ALBListener', { - loadBalancerTags: { - Cluster: 'MyClusterName', - }, - listenerProtocol: elbv2.Protocol.TCP, - listenerPort: 12345, -}); -``` - -## Metrics - -You may create metrics for Load Balancers and Target Groups through the `metrics` attribute: - -**Load Balancer:** - -```ts -declare const alb: elbv2.IApplicationLoadBalancer; - -const albMetrics: elbv2.IApplicationLoadBalancerMetrics = alb.metrics; -const metricConnectionCount: cloudwatch.Metric = albMetrics.activeConnectionCount(); -``` - -**Target Group:** - -```ts -declare const targetGroup: elbv2.IApplicationTargetGroup; - -const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; -const metricHealthyHostCount: cloudwatch.Metric = targetGroupMetrics.healthyHostCount(); -``` - -Metrics are also available to imported resources: - -```ts -declare const stack: Stack; - -const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'MyTargetGroup', { - targetGroupArn: Fn.importValue('TargetGroupArn'), - loadBalancerArns: Fn.importValue('LoadBalancerArn'), -}); - -const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; -``` - -Notice that TargetGroups must be imported by supplying the Load Balancer too, otherwise accessing the `metrics` will -throw an error: - -```ts -declare const stack: Stack; -const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'MyTargetGroup', { - targetGroupArn: Fn.importValue('TargetGroupArn'), -}); - -const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; // throws an Error() -``` diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/jest.config.js b/packages/@aws-cdk/aws-elasticloadbalancingv2/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts deleted file mode 100644 index b52d6ba09ea23..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/util.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Arn, ArnFormat, Fn, Token } from '@aws-cdk/core'; -import { ApplicationProtocol, Protocol } from './enums'; - -export type Attributes = { [key: string]: string | undefined }; - -/** - * Render an attribute dict to a list of { key, value } pairs - */ -export function renderAttributes(attributes: Attributes) { - const ret: any[] = []; - for (const [key, value] of Object.entries(attributes)) { - if (value !== undefined) { - ret.push({ key, value }); - } - } - return ret; -} - -/** - * Return the appropriate default port for a given protocol - */ -export function defaultPortForProtocol(proto: ApplicationProtocol): number { - switch (proto) { - case ApplicationProtocol.HTTP: return 80; - case ApplicationProtocol.HTTPS: return 443; - default: - throw new Error(`Unrecognized protocol: ${proto}`); - } -} - -/** - * Return the appropriate default protocol for a given port - */ -export function defaultProtocolForPort(port: number): ApplicationProtocol { - switch (port) { - case 80: - case 8000: - case 8008: - case 8080: - return ApplicationProtocol.HTTP; - - case 443: - case 8443: - return ApplicationProtocol.HTTPS; - - default: - throw new Error(`Don't know default protocol for port: ${port}; please supply a protocol`); - } -} - -/** - * Given a protocol and a port, try to guess the other one if it's undefined - */ -// eslint-disable-next-line max-len -export function determineProtocolAndPort(protocol: ApplicationProtocol | undefined, port: number | undefined): [ApplicationProtocol | undefined, number | undefined] { - if (protocol === undefined && port === undefined) { - return [undefined, undefined]; - } - - if (protocol === undefined) { protocol = defaultProtocolForPort(port!); } - if (port === undefined) { port = defaultPortForProtocol(protocol!); } - - return [protocol, port]; -} - -/** - * Helper function to default undefined input props - */ -export function ifUndefined(x: T | undefined, def: T) { - return x ?? def; -} - -/** - * Helper function for ensuring network listeners and target groups only accept valid - * protocols. - */ -export function validateNetworkProtocol(protocol: Protocol) { - const NLB_PROTOCOLS = [Protocol.TCP, Protocol.TLS, Protocol.UDP, Protocol.TCP_UDP]; - - if (NLB_PROTOCOLS.indexOf(protocol) === -1) { - throw new Error(`The protocol must be one of ${NLB_PROTOCOLS.join(', ')}. Found ${protocol}`); - } -} - -/** - * Helper to map a map of tags to cxschema tag format. - * @internal - */ -export function mapTagMapToCxschema(tagMap: Record): cxschema.Tag[] { - return Object.entries(tagMap) - .map(([key, value]) => ({ key, value })); -} - -export function parseLoadBalancerFullName(arn: string): string { - if (Token.isUnresolved(arn)) { - // Unfortunately it is not possible to use Arn.split() because the ARNs have this shape: - // - // arn:...:loadbalancer/net/my-load-balancer/123456 - // - // And the way that Arn.split() handles this situation is not enough to obtain the full name - const arnParts = Fn.split('/', arn); - return `${Fn.select(1, arnParts)}/${Fn.select(2, arnParts)}/${Fn.select(3, arnParts)}`; - } else { - const arnComponents = Arn.split(arn, ArnFormat.SLASH_RESOURCE_NAME); - const resourceName = arnComponents.resourceName; - if (!resourceName) { - throw new Error(`Provided ARN does not belong to a load balancer: ${arn}`); - } - return resourceName; - } -} - -/** - * Transforms: - * - * arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/my-target-group/da693d633af407a0 - * - * Into: - * - * targetgroup/my-target-group/da693d633af407a0 - */ -export function parseTargetGroupFullName(arn: string): string { - const arnComponents = Arn.split(arn, ArnFormat.NO_RESOURCE_NAME); - const resource = arnComponents.resource; - if (!resource) { - throw new Error(`Provided ARN does not belong to a target group: ${arn}`); - } - return resource; -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json deleted file mode 100644 index 0bc217f3d422c..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticloadbalancingv2", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ElasticLoadBalancingV2", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticloadbalancingv2", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticloadbalancingv2" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ElasticLoadBalancingV2", - "packageId": "Amazon.CDK.AWS.ElasticLoadBalancingV2", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticloadbalancingv2", - "module": "aws_cdk.aws_elasticloadbalancingv2", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticloadbalancingv2" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ElasticLoadBalancingV2", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "elasticloadbalancingv2" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "no-unused-type:@aws-cdk/aws-elasticloadbalancingv2.INetworkListenerCertificateProps", - "construct-ctor:@aws-cdk/aws-elasticloadbalancingv2.BaseListener..params[2]", - "construct-ctor:@aws-cdk/aws-elasticloadbalancingv2.BaseLoadBalancer.", - "construct-ctor:@aws-cdk/aws-elasticloadbalancingv2.TargetGroupBase.", - "props-physical-name:@aws-cdk/aws-elasticloadbalancingv2.ApplicationListenerProps", - "props-physical-name:@aws-cdk/aws-elasticloadbalancingv2.NetworkListenerProps", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.ApplicationListenerAttributes.defaultPort", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ContentType.APPLICATION_JSON", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ContentType.APPLICATION_JAVASCRIPT", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ContentType.TEXT_HTML", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ContentType.TEXT_CSS", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ApplicationLoadBalancer.connections", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.BaseListener.listenerArn", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.BaseLoadBalancer.loadBalancerSecurityGroups", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.TargetGroupBase.healthCheck", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.AddApplicationTargetsProps.targets", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.AddNetworkTargetsProps.targets", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ContentType.TEXT_PLAIN", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.ApplicationListenerAttributes.securityGroup", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.ApplicationListenerAttributes.securityGroupId", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.HealthCheck.healthyHttpCodes", - "docs-public-apis:@aws-cdk/aws-elasticloadbalancingv2.ILoadBalancerV2", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.LoadBalancerTargetProps.targetJson", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.TargetGroupImportProps.loadBalancerArns", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.TargetGroupAttributes.defaultPort", - "props-default-doc:@aws-cdk/aws-elasticloadbalancingv2.TargetGroupAttributes.loadBalancerArns" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-elasticloadbalancingv2/rosetta/default.ts-fixture deleted file mode 100644 index 8a21c6ec4d9a6..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/rosetta/default.ts-fixture +++ /dev/null @@ -1,17 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct, Node } from 'constructs'; -import { CfnOutput, Stack, Duration, Resource, SecretValue } from '@aws-cdk/core'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - - - diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/actions.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/actions.test.ts deleted file mode 100644 index 2344d492178d2..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/actions.test.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; - -let stack: cdk.Stack; -let group1: elbv2.ApplicationTargetGroup; -let group2: elbv2.ApplicationTargetGroup; -let lb: elbv2.ApplicationLoadBalancer; - -beforeEach(() => { - stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - group1 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup1', { vpc, port: 80 }); - group2 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 }); - lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); -}); - -describe('tests', () => { - test('Forward action legacy rendering', () => { - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: elbv2.ListenerAction.forward([group1]), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, - Type: 'forward', - }, - ], - }); - }); - - test('Forward to multiple targetgroups with an Action and stickiness', () => { - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: elbv2.ListenerAction.forward([group1, group2], { - stickinessDuration: cdk.Duration.hours(1), - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - ForwardConfig: { - TargetGroupStickinessConfig: { - DurationSeconds: 3600, - Enabled: true, - }, - TargetGroups: [ - { - TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, - }, - { - TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, - }, - ], - }, - Type: 'forward', - }, - ], - }); - }); - - test('Weighted forward to multiple targetgroups with an Action', () => { - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: elbv2.ListenerAction.weightedForward([ - { targetGroup: group1, weight: 10 }, - { targetGroup: group2, weight: 50 }, - ], { - stickinessDuration: cdk.Duration.hours(1), - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - ForwardConfig: { - TargetGroupStickinessConfig: { - DurationSeconds: 3600, - Enabled: true, - }, - TargetGroups: [ - { - TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, - Weight: 10, - }, - { - TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, - Weight: 50, - }, - ], - }, - Type: 'forward', - }, - ], - }); - }); - - test('Chaining OIDC authentication action', () => { - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: elbv2.ListenerAction.authenticateOidc({ - authorizationEndpoint: 'A', - clientId: 'B', - clientSecret: cdk.SecretValue.unsafePlainText('C'), - issuer: 'D', - tokenEndpoint: 'E', - userInfoEndpoint: 'F', - next: elbv2.ListenerAction.forward([group1]), - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - AuthenticateOidcConfig: { - AuthorizationEndpoint: 'A', - ClientId: 'B', - ClientSecret: 'C', - Issuer: 'D', - TokenEndpoint: 'E', - UserInfoEndpoint: 'F', - }, - Order: 1, - Type: 'authenticate-oidc', - }, - { - Order: 2, - TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, - Type: 'forward', - }, - ], - }); - }); - - test('Add default Action and add Action with conditions', () => { - // GIVEN - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - listener.addAction('Action1', { - action: elbv2.ListenerAction.forward([group1]), - }); - - listener.addAction('Action2', { - conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], - priority: 10, - action: elbv2.ListenerAction.forward([group2]), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Actions: [ - { - TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, - Type: 'forward', - }, - ], - }); - }); - - test('Add Action with multiple Conditions', () => { - // GIVEN - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - listener.addAction('Action1', { - action: elbv2.ListenerAction.forward([group1]), - }); - - listener.addAction('Action2', { - conditions: [ - elbv2.ListenerCondition.hostHeaders(['example.com']), - elbv2.ListenerCondition.sourceIps(['1.1.1.1/32']), - ], - priority: 10, - action: elbv2.ListenerAction.forward([group2]), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Actions: [ - { - TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, - Type: 'forward', - }, - ], - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: [ - 'example.com', - ], - }, - }, - { - Field: 'source-ip', - SourceIpConfig: { - Values: [ - '1.1.1.1/32', - ], - }, - }, - ], - }); - }); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/listener.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/listener.test.ts deleted file mode 100644 index 025680b8ca1ad..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/listener.test.ts +++ /dev/null @@ -1,1798 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Metric } from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import { SecretValue } from '@aws-cdk/core'; -import * as constructs from 'constructs'; -import * as elbv2 from '../../lib'; -import { FakeSelfRegisteringTarget } from '../helpers'; - -describe('tests', () => { - test('Listener guesses protocol from port', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.addListener('Listener', { - port: 443, - certificates: [importedCertificate(stack)], - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'HTTPS', - }); - }); - - test('Listener guesses port from protocol', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.addListener('Listener', { - protocol: elbv2.ApplicationProtocol.HTTP, - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Port: 80, - }); - }); - - test('Listener default to open - IPv4', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - loadBalancer.addListener('MyListener', { - port: 80, - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [ - { - Description: 'Allow from anyone on port 80', - CidrIp: '0.0.0.0/0', - FromPort: 80, - IpProtocol: 'tcp', - ToPort: 80, - }, - ], - }); - }); - - test('Listener default to open - IPv4 and IPv6 (dual stack)', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, ipAddressType: elbv2.IpAddressType.DUAL_STACK }); - - // WHEN - loadBalancer.addListener('MyListener', { - port: 80, - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [ - { - Description: 'Allow from anyone on port 80', - CidrIp: '0.0.0.0/0', - FromPort: 80, - IpProtocol: 'tcp', - ToPort: 80, - }, - { - Description: 'Allow from anyone on port 80', - CidrIpv6: '::/0', - FromPort: 80, - IpProtocol: 'tcp', - ToPort: 80, - }, - ], - }); - }); - - test('HTTPS listener requires certificate', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - const errors = listener.node.validate(); - expect(errors).toEqual(['HTTPS Listener needs at least one certificate (call addCertificates)']); - }); - - test('HTTPS listener can add certificate after construction', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - listener.addCertificates('Certs', [importedCertificate(stack, 'cert')]); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Certificates: [ - { CertificateArn: 'cert' }, - ], - }); - }); - - test('HTTPS listener can add more than two certificates', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - defaultTargetGroups: [ - new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 }), - ], - certificates: [ - elbv2.ListenerCertificate.fromArn('cert1'), - elbv2.ListenerCertificate.fromArn('cert2'), - elbv2.ListenerCertificate.fromArn('cert3'), - ], - }); - - expect(listener.node.tryFindChild('DefaultCertificates1')).toBeDefined(); - expect(listener.node.tryFindChild('DefaultCertificates2')).toBeDefined(); - expect(listener.node.tryFindChild('DefaultCertificates3')).not.toBeDefined(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Certificates: [{ CertificateArn: 'cert1' }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert2' }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert3' }], - }); - }); - - test('Can configure targetType on TargetGroups', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - targetType: elbv2.TargetType.IP, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetType: 'ip', - }); - }); - - test('Can configure name on TargetGroups', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - targetGroupName: 'foo', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - Name: 'foo', - }); - }); - - test('Can add target groups with and without conditions', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - - // WHEN - listener.addTargetGroups('Default', { - targetGroups: [group], - }); - listener.addTargetGroups('WithPath', { - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - targetGroups: [group], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, - Type: 'forward', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 10, - Conditions: [ - { - Field: 'path-pattern', - PathPatternConfig: { Values: ['/hello'] }, - }, - ], - Actions: [ - { - TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, - Type: 'forward', - }, - ], - }); - }); - - test('bind is called for all next targets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - const fake = new FakeSelfRegisteringTarget(stack, 'FakeTG', vpc); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - targets: [fake], - }); - - // WHEN - listener.addAction('first-action', { - action: elbv2.ListenerAction.authenticateOidc({ - next: elbv2.ListenerAction.forward([group]), - issuer: 'dummy', - clientId: 'dummy', - clientSecret: SecretValue.unsafePlainText('dummy'), - tokenEndpoint: 'dummy', - userInfoEndpoint: 'dummy', - authorizationEndpoint: 'dummy', - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - IpProtocol: 'tcp', - Description: 'Load balancer to target', - FromPort: 80, - ToPort: 80, - GroupId: { - 'Fn::GetAtt': [ - 'FakeTGSG50E257DF', - 'GroupId', - ], - }, - SourceSecurityGroupId: { - 'Fn::GetAtt': [ - 'LBSecurityGroup8A41EA2B', - 'GroupId', - ], - }, - }); - }); - - testDeprecated('Can implicitly create target groups with and without conditions', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - listener.addTargets('Targets', { - port: 80, - targets: [new elbv2.InstanceTarget('i-12345')], - }); - listener.addTargets('WithPath', { - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - port: 80, - targets: [new elbv2.InstanceTarget('i-5678')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, - Type: 'forward', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - VpcId: { Ref: 'Stack8A423254' }, - Port: 80, - Protocol: 'HTTP', - Targets: [ - { Id: 'i-12345' }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Actions: [ - { - TargetGroupArn: { Ref: 'LBListenerWithPathGroupE889F9E5' }, - Type: 'forward', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - VpcId: { Ref: 'Stack8A423254' }, - Port: 80, - Protocol: 'HTTP', - Targets: [ - { Id: 'i-5678' }, - ], - }); - }); - - testDeprecated('Add certificate to constructed listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 443 }); - - // WHEN - listener.addCertificates('Certs', [importedCertificate(stack, 'cert')]); - listener.addTargets('Targets', { port: 8080, targets: [new elbv2.IpTarget('1.2.3.4')] }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Certificates: [ - { CertificateArn: 'cert' }, - ], - }); - }); - - test('Add certificate to imported listener', () => { - // GIVEN - const stack2 = new cdk.Stack(); - const listener2 = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'Listener', { - listenerArn: 'listener-arn', - defaultPort: 443, - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SG', 'security-group-id'), - }); - - // WHEN - listener2.addCertificates('Certs', [importedCertificate(stack2, 'cert')]); - - // THEN - Template.fromStack(stack2).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [ - { CertificateArn: 'cert' }, - ], - }); - }); - - test('Enable alb stickiness for targets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - const group = listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - group.enableCookieStickiness(cdk.Duration.hours(1)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - Value: 'true', - }, - { - Key: 'stickiness.type', - Value: 'lb_cookie', - }, - { - Key: 'stickiness.lb_cookie.duration_seconds', - Value: '3600', - }, - ], - }); - }); - - test('Enable app stickiness for targets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - const group = listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - group.enableCookieStickiness(cdk.Duration.hours(1), 'MyDeliciousCookie'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - Value: 'true', - }, - { - Key: 'stickiness.type', - Value: 'app_cookie', - }, - { - Key: 'stickiness.app_cookie.cookie_name', - Value: 'MyDeliciousCookie', - }, - { - Key: 'stickiness.app_cookie.duration_seconds', - Value: '3600', - }, - ], - }); - }); - - test('Enable health check for targets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - const group = listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - group.configureHealthCheck({ - unhealthyThresholdCount: 3, - timeout: cdk.Duration.seconds(30), - interval: cdk.Duration.seconds(60), - path: '/test', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - UnhealthyThresholdCount: 3, - HealthCheckIntervalSeconds: 60, - HealthCheckPath: '/test', - HealthCheckTimeoutSeconds: 30, - }); - }); - - test('validation error if invalid health check protocol', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - const group = listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - - group.configureHealthCheck({ - unhealthyThresholdCount: 3, - timeout: cdk.Duration.seconds(30), - interval: cdk.Duration.seconds(60), - path: '/test', - protocol: elbv2.Protocol.TCP, - }); - - // THEN - const validationErrors: string[] = group.node.validate(); - expect(validationErrors).toEqual(["Health check protocol 'TCP' is not supported. Must be one of [HTTP, HTTPS]"]); - }); - - test('adding targets passes in provided protocol version', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 443, certificates: [importedCertificate(stack, 'arn:someCert')] }); - - // WHEN - listener.addTargets('Group', { - port: 443, - protocolVersion: elbv2.ApplicationProtocolVersion.GRPC, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - ProtocolVersion: 'GRPC', - }); - }); - - test('Can call addTargetGroups on imported listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { - listenerArn: 'ieks', - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-12345'), - }); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - - // WHEN - listener.addTargetGroups('Gruuup', { - priority: 30, - conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], - targetGroups: [group], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - ListenerArn: 'ieks', - Priority: 30, - Actions: [ - { - TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, - Type: 'forward', - }, - ], - }); - }); - - test('Can call addTargetGroups on imported listener with conditions prop', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { - listenerArn: 'ieks', - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-12345'), - }); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - - // WHEN - listener.addTargetGroups('Gruuup', { - priority: 30, - conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], - targetGroups: [group], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - ListenerArn: 'ieks', - Priority: 30, - Actions: [ - { - TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, - Type: 'forward', - }, - ], - }); - }); - - test('Can depend on eventual listener via TargetGroup', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { vpc }); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - - // WHEN - new ResourceWithLBDependency(stack, 'SomeResource', group); - - loadBalancer.addListener('Listener', { - port: 80, - defaultTargetGroups: [group], - }); - - // THEN - Template.fromStack(stack).templateMatches(Match.objectLike({ - Resources: { - SomeResource: { - Type: 'Test::Resource', - DependsOn: ['LoadBalancerListenerE1A099B9'], - }, - }, - })); - }); - - test('Exercise metrics', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - lb.addListener('SomeListener', { - port: 80, - defaultTargetGroups: [group], - }); - - // WHEN - const metrics = new Array(); - metrics.push(group.metrics.httpCodeTarget(elbv2.HttpCodeTarget.TARGET_3XX_COUNT)); - metrics.push(group.metrics.ipv6RequestCount()); - metrics.push(group.metrics.unhealthyHostCount()); - metrics.push(group.metrics.unhealthyHostCount()); - metrics.push(group.metrics.requestCount()); - metrics.push(group.metrics.targetConnectionErrorCount()); - metrics.push(group.metrics.targetResponseTime()); - metrics.push(group.metrics.targetTLSNegotiationErrorCount()); - - for (const metric of metrics) { - expect(metric.namespace).toEqual('AWS/ApplicationELB'); - const loadBalancerArn = { Ref: 'LBSomeListenerCA01F1A0' }; - - expect(stack.resolve(metric.dimensions)).toEqual({ - TargetGroup: { 'Fn::GetAtt': ['TargetGroup3D7CD9B8', 'TargetGroupFullName'] }, - LoadBalancer: { - 'Fn::Join': - ['', - [{ 'Fn::Select': [1, { 'Fn::Split': ['/', loadBalancerArn] }] }, - '/', - { 'Fn::Select': [2, { 'Fn::Split': ['/', loadBalancerArn] }] }, - '/', - { 'Fn::Select': [3, { 'Fn::Split': ['/', loadBalancerArn] }] }]], - }, - }); - } - }); - - test('Can add dependency on ListenerRule via TargetGroup', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { vpc }); - const group1 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup1', { vpc, port: 80 }); - const group2 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 }); - const listener = loadBalancer.addListener('Listener', { - port: 80, - defaultTargetGroups: [group1], - }); - - // WHEN - new ResourceWithLBDependency(stack, 'SomeResource', group2); - - listener.addTargetGroups('SecondGroup', { - conditions: [elbv2.ListenerCondition.pathPatterns(['/bla'])], - priority: 10, - targetGroups: [group2], - }); - - // THEN - Template.fromStack(stack).templateMatches(Match.objectLike({ - Resources: { - SomeResource: { - Type: 'Test::Resource', - DependsOn: ['LoadBalancerListenerSecondGroupRuleF5FDC196'], - }, - }, - })); - }); - - test('Can add fixed responses', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // WHEN - listener.addAction('Default', { - action: elbv2.ListenerAction.fixedResponse(404, { - contentType: 'text/plain', - messageBody: 'Not Found', - }), - }); - listener.addAction('Hello', { - action: elbv2.ListenerAction.fixedResponse(503), - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - priority: 10, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - FixedResponseConfig: { - ContentType: 'text/plain', - MessageBody: 'Not Found', - StatusCode: '404', - }, - Type: 'fixed-response', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Actions: [ - { - FixedResponseConfig: { - StatusCode: '503', - }, - Type: 'fixed-response', - }, - ], - }); - }); - - test('imported listener only need securityGroup and listenerArn as attributes', () => { - // GIVEN - const stack = new cdk.Stack(); - - const importedListener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'listener', { - listenerArn: 'listener-arn', - defaultPort: 443, - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id', { - allowAllOutbound: false, - }), - }); - importedListener.addAction('Hello', { - action: elbv2.ListenerAction.fixedResponse(503), - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - priority: 10, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - ListenerArn: 'listener-arn', - Priority: 10, - Actions: [ - { - FixedResponseConfig: { - StatusCode: '503', - }, - Type: 'fixed-response', - }, - ], - }); - }); - - test('Can add actions to an imported listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const stack2 = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // WHEN - listener.addAction('Default', { - action: elbv2.ListenerAction.fixedResponse(404, { - contentType: 'text/plain', - messageBody: 'Not Found', - }), - }); - - const importedListener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'listener', { - listenerArn: 'listener-arn', - defaultPort: 443, - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SG', 'security-group-id', { - allowAllOutbound: false, - }), - }); - importedListener.addAction('Hello', { - action: elbv2.ListenerAction.fixedResponse(503), - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - priority: 10, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - FixedResponseConfig: { - ContentType: 'text/plain', - MessageBody: 'Not Found', - StatusCode: '404', - }, - Type: 'fixed-response', - }, - ], - }); - - Template.fromStack(stack2).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - ListenerArn: 'listener-arn', - Priority: 10, - Actions: [ - { - FixedResponseConfig: { - StatusCode: '503', - }, - Type: 'fixed-response', - }, - ], - }); - }); - - test('actions added to an imported listener must have a priority', () => { - // GIVEN - const stack = new cdk.Stack(); - - const importedListener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'listener', { - listenerArn: 'listener-arn', - defaultPort: 443, - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id', { - allowAllOutbound: false, - }), - }); - expect(() => { - importedListener.addAction('Hello', { - action: elbv2.ListenerAction.fixedResponse(503), - }); - }).toThrow(/priority must be set for actions added to an imported listener/); - }); - - testDeprecated('Can add redirect responses', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // WHEN - listener.addRedirectResponse('Default', { - statusCode: 'HTTP_301', - port: '443', - protocol: 'HTTPS', - }); - listener.addRedirectResponse('Hello', { - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - path: '/new/#{path}', - statusCode: 'HTTP_302', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - RedirectConfig: { - Port: '443', - Protocol: 'HTTPS', - StatusCode: 'HTTP_301', - }, - Type: 'redirect', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Actions: [ - { - RedirectConfig: { - Path: '/new/#{path}', - StatusCode: 'HTTP_302', - }, - Type: 'redirect', - }, - ], - }); - }); - - test('Can add simple redirect responses', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - - // WHEN - lb.addRedirect(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Port: 80, - Protocol: 'HTTP', - DefaultActions: [ - { - RedirectConfig: { - Port: '443', - Protocol: 'HTTPS', - StatusCode: 'HTTP_301', - }, - Type: 'redirect', - }, - ], - }); - }); - - test('Can supress default ingress rules on a simple redirect response', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - }); - - // WHEN - loadBalancer.addRedirect({ open: false }); - - // THEN - const matchingGroups = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Allow from anyone on port 80', - IpProtocol: 'tcp', - }, - ], - }); - expect(Object.keys(matchingGroups).length).toBe(0); - }); - - test('Can add simple redirect responses with custom values', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - - // WHEN - const listener = lb.addRedirect({ - sourceProtocol: elbv2.ApplicationProtocol.HTTPS, - sourcePort: 8443, - targetProtocol: elbv2.ApplicationProtocol.HTTP, - targetPort: 8080, - }); - listener.addCertificates('ListenerCertificateX', [importedCertificate(stack, 'cert3')]); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Port: 8443, - Protocol: 'HTTPS', - DefaultActions: [ - { - RedirectConfig: { - Port: '8080', - Protocol: 'HTTP', - StatusCode: 'HTTP_301', - }, - Type: 'redirect', - }, - ], - }); - }); - - test('Can configure deregistration_delay for targets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - deregistrationDelay: cdk.Duration.seconds(30), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'deregistration_delay.timeout_seconds', - Value: '30', - }, - { - Key: 'stickiness.enabled', - Value: 'false', - }, - ], - }); - }); - - test('Custom Load balancer algorithm type', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - // WHEN - listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - loadBalancingAlgorithmType: elbv2.TargetGroupLoadBalancingAlgorithmType.LEAST_OUTSTANDING_REQUESTS, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - Value: 'false', - }, - { - Key: 'load_balancing.algorithm.type', - Value: 'least_outstanding_requests', - }, - ], - }); - }); - - describeDeprecated('Throws with bad fixed responses', () => { - - test('status code', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => listener.addFixedResponse('Default', { - statusCode: '301', - })).toThrow(/`statusCode`/); - }); - - test('message body', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => listener.addFixedResponse('Default', { - messageBody: 'a'.repeat(1025), - statusCode: '500', - })).toThrow(/`messageBody`/); - }); - }); - - describeDeprecated('Throws with bad redirect responses', () => { - - test('status code', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => listener.addRedirectResponse('Default', { - statusCode: '301', - })).toThrow(/`statusCode`/); - }); - - test('protocol', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => listener.addRedirectResponse('Default', { - protocol: 'tcp', - statusCode: 'HTTP_301', - })).toThrow(/`protocol`/); - }); - }); - - test('Throws when specifying both target groups and an action', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { - action: elbv2.ListenerAction.fixedResponse(500), - listener, - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - targetGroups: [new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 })], - })).toThrow(/'action,targetGroups'.*/); - }); - - test('Throws when specifying priority 0', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { - action: elbv2.ListenerAction.fixedResponse(500), - listener, - priority: 0, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - })).toThrowError('Priority must have value greater than or equal to 1'); - }); - - test('Accepts unresolved priority', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { - listener, - priority: new cdk.CfnParameter(stack, 'PriorityParam', { type: 'Number' }).valueAsNumber, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - fixedResponse: { - statusCode: '500', - }, - })).not.toThrowError('Priority must have value greater than or equal to 1'); - }); - - testDeprecated('Throws when specifying both target groups and redirect response', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { - vpc, - }); - const listener = lb.addListener('Listener', { - port: 80, - }); - - // THEN - expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { - listener, - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - targetGroups: [new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 })], - redirectResponse: { - statusCode: 'HTTP_301', - }, - })).toThrow(/'targetGroups,redirectResponse'.*/); - - expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule2', { - listener, - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - targetGroups: [new elbv2.ApplicationTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 })], - fixedResponse: { - statusCode: '500', - }, - redirectResponse: { - statusCode: 'HTTP_301', - }, - })).toThrow(/'targetGroups,fixedResponse,redirectResponse'.*/); - }); - - test('Imported listener with imported security group and allowAllOutbound set to false', () => { - // GIVEN - const stack = new cdk.Stack(); - const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { - listenerArn: 'listener-arn', - defaultPort: 443, - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id', { - allowAllOutbound: false, - }), - }); - - // WHEN - listener.connections.allowToAnyIpv4(ec2.Port.tcp(443)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: 'security-group-id', - }); - }); - - test('Can pass multiple certificate arns to application listener constructor', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.addListener('Listener', { - port: 443, - certificates: [ - importedCertificate(stack, 'cert1'), - importedCertificate(stack, 'cert2'), - ], - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'HTTPS', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert2' }], - }); - }); - - test('Can use certificate wrapper class', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.addListener('Listener', { - port: 443, - certificates: [elbv2.ListenerCertificate.fromArn('cert1'), elbv2.ListenerCertificate.fromArn('cert2')], - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'HTTPS', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert2' }], - }); - }); - - testDeprecated('Can add additional certificates via addCertificateArns to application listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificateArns: ['cert1', 'cert2'], - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - listener.addCertificateArns('ListenerCertificateX', ['cert3']); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'HTTPS', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert2' }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert3' }], - }); - }); - - test('Can add multiple path patterns to listener rule', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificates: [importedCertificate(stack, 'cert1'), importedCertificate(stack, 'cert2')], - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - listener.addTargets('Target1', { - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/test/path/1', '/test/path/2'])], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 10, - Conditions: [ - { - Field: 'path-pattern', - PathPatternConfig: { Values: ['/test/path/1', '/test/path/2'] }, - }, - ], - }); - }); - - testDeprecated('Cannot add pathPattern and pathPatterns to listener rule', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificates: [importedCertificate(stack, 'cert1'), importedCertificate(stack, 'cert2')], - defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - expect(() => listener.addTargets('Target1', { - priority: 10, - pathPatterns: ['/test/path/1', '/test/path/2'], - pathPattern: '/test/path/3', - })).toThrowError('Both `pathPatterns` and `pathPattern` are specified, specify only one'); - }); - - test('Add additional condition to listener rule', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const group1 = new elbv2.ApplicationTargetGroup(stack, 'Group1', { vpc, port: 80 }); - const group2 = new elbv2.ApplicationTargetGroup(stack, 'Group2', { vpc, port: 81, protocol: elbv2.ApplicationProtocol.HTTP }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificates: [importedCertificate(stack, 'cert1')], - defaultTargetGroups: [group2], - }); - listener.addTargetGroups('TargetGroup1', { - priority: 10, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['app.test']), - elbv2.ListenerCondition.httpHeader('Accept', ['application/vnd.myapp.v2+json']), - ], - targetGroups: [group1], - }); - listener.addTargetGroups('TargetGroup2', { - priority: 20, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['app.test']), - ], - targetGroups: [group2], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 10, - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: ['app.test'], - }, - }, - { - Field: 'http-header', - HttpHeaderConfig: { - HttpHeaderName: 'Accept', - Values: ['application/vnd.myapp.v2+json'], - }, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 20, - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: ['app.test'], - }, - }, - ], - }); - }); - - test('Add multiple additonal condition to listener rule', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const group1 = new elbv2.ApplicationTargetGroup(stack, 'Group1', { vpc, port: 80 }); - const group2 = new elbv2.ApplicationTargetGroup(stack, 'Group2', { vpc, port: 81, protocol: elbv2.ApplicationProtocol.HTTP }); - const group3 = new elbv2.ApplicationTargetGroup(stack, 'Group3', { vpc, port: 82, protocol: elbv2.ApplicationProtocol.HTTP }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificates: [importedCertificate(stack, 'cert1')], - defaultTargetGroups: [group3], - }); - listener.addTargetGroups('TargetGroup1', { - priority: 10, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['app.test']), - elbv2.ListenerCondition.sourceIps(['192.0.2.0/24']), - elbv2.ListenerCondition.queryStrings([{ key: 'version', value: '2' }, { value: 'foo*' }]), - ], - targetGroups: [group1], - }); - listener.addTargetGroups('TargetGroup2', { - priority: 20, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['app.test']), - elbv2.ListenerCondition.httpHeader('Accept', ['application/vnd.myapp.v2+json']), - ], - targetGroups: [group1], - }); - listener.addTargetGroups('TargetGroup3', { - priority: 30, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['app.test']), - elbv2.ListenerCondition.httpRequestMethods(['PUT', 'COPY', 'LOCK', 'MKCOL', 'MOVE', 'PROPFIND', 'PROPPATCH', 'UNLOCK']), - ], - targetGroups: [group2], - }); - listener.addTargetGroups('TargetGroup4', { - priority: 40, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['app.test']), - ], - targetGroups: [group3], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 10, - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: ['app.test'], - }, - }, - { - Field: 'source-ip', - SourceIpConfig: { - Values: ['192.0.2.0/24'], - }, - }, - { - Field: 'query-string', - QueryStringConfig: { - Values: [ - { - Key: 'version', - Value: '2', - }, - { - Value: 'foo*', - }, - ], - }, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 20, - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: ['app.test'], - }, - }, - { - Field: 'http-header', - HttpHeaderConfig: { - HttpHeaderName: 'Accept', - Values: ['application/vnd.myapp.v2+json'], - }, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 30, - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: ['app.test'], - }, - }, - { - Field: 'http-request-method', - HttpRequestMethodConfig: { - Values: ['PUT', 'COPY', 'LOCK', 'MKCOL', 'MOVE', 'PROPFIND', 'PROPPATCH', 'UNLOCK'], - }, - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 40, - Conditions: [ - { - Field: 'host-header', - HostHeaderConfig: { - Values: ['app.test'], - }, - }, - ], - }); - }); - - testDeprecated('Can exist together legacy style conditions and modern style conditions', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const group1 = new elbv2.ApplicationTargetGroup(stack, 'Group1', { vpc, port: 80 }); - const group2 = new elbv2.ApplicationTargetGroup(stack, 'Group2', { vpc, port: 81, protocol: elbv2.ApplicationProtocol.HTTP }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificates: [importedCertificate(stack, 'cert1')], - defaultTargetGroups: [group2], - }); - listener.addTargetGroups('TargetGroup1', { - hostHeader: 'app.test', - pathPattern: '/test', - conditions: [ - elbv2.ListenerCondition.sourceIps(['192.0.2.0/24']), - ], - priority: 10, - targetGroups: [group1], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 10, - Conditions: [ - { - Field: 'host-header', - Values: ['app.test'], - }, - { - Field: 'path-pattern', - Values: ['/test'], - }, - { - Field: 'source-ip', - SourceIpConfig: { - Values: ['192.0.2.0/24'], - }, - }, - ], - }); - }); - - test('Add condition to imported application listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { - listenerArn: 'listener-arn', - defaultPort: 443, - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id'), - }); - - // WHEN - listener.addTargetGroups('OtherTG', { - targetGroups: [group], - priority: 1, - conditions: [elbv2.ListenerCondition.pathPatterns(['/path1', '/path2'])], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 1, - Conditions: [ - { - Field: 'path-pattern', - PathPatternConfig: { Values: ['/path1', '/path2'] }, - }, - ], - }); - }); - - testDeprecated('not allowed to combine action specifiers when instantiating a Rule directly', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 80 }); - - const baseProps = { listener, priority: 1, pathPatterns: ['/path1', '/path2'] }; - - // WHEN - expect(() => { - new elbv2.ApplicationListenerRule(stack, 'Rule1', { - ...baseProps, - fixedResponse: { statusCode: '200' }, - action: elbv2.ListenerAction.fixedResponse(200), - }); - }).toThrow(/specify only one/); - - expect(() => { - new elbv2.ApplicationListenerRule(stack, 'Rule2', { - ...baseProps, - targetGroups: [group], - action: elbv2.ListenerAction.fixedResponse(200), - }); - }).toThrow(/specify only one/); - }); - - test('not allowed to specify defaultTargetGroups and defaultAction together', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - expect(() => { - lb.addListener('Listener1', { - port: 80, - defaultTargetGroups: [group], - defaultAction: elbv2.ListenerAction.fixedResponse(200), - }); - }).toThrow(/Specify at most one/); - }); - - describe('lookup', () => { - test('Can look up an ApplicationListener', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - // WHEN - const listener = elbv2.ApplicationListener.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 0); - expect(listener.listenerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/application/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2'); - expect(listener.connections.securityGroups[0].securityGroupId).toEqual('sg-12345678'); - }); - - test('Can add rules to a looked-up ApplicationListener', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - const listener = elbv2.ApplicationListener.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // WHEN - new elbv2.ApplicationListenerRule(stack, 'rule', { - listener, - conditions: [ - elbv2.ListenerCondition.hostHeaders(['example.com']), - ], - action: elbv2.ListenerAction.fixedResponse(200), - priority: 5, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { - Priority: 5, - }); - }); - - test('Can add certificates to a looked-up ApplicationListener', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - const listener = elbv2.ApplicationListener.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // WHEN - listener.addCertificates('certs', [ - importedCertificate(stack, 'arn:something'), - ]); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [ - { CertificateArn: 'arn:something' }, - ], - }); - }); - }); -}); - -class ResourceWithLBDependency extends cdk.CfnResource { - constructor(scope: constructs.Construct, id: string, targetGroup: elbv2.ITargetGroup) { - super(scope, id, { type: 'Test::Resource' }); - this.node.addDependency(targetGroup.loadBalancerAttached); - } -} - -function importedCertificate(stack: cdk.Stack, - certificateArn = 'arn:aws:certificatemanager:123456789012:testregion:certificate/fd0b8392-3c0e-4704-81b6-8edf8612c852') { - return acm.Certificate.fromCertificateArn(stack, certificateArn, certificateArn); -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts deleted file mode 100644 index 679239f0c94cd..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts +++ /dev/null @@ -1,658 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Metric } from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; - - -describe('tests', () => { - test('Trivial construction: internet facing', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internet-facing', - Subnets: [ - { Ref: 'StackPublicSubnet1Subnet0AD81D22' }, - { Ref: 'StackPublicSubnet2Subnet3C7D2288' }, - ], - Type: 'application', - }); - }); - - test('internet facing load balancer has dependency on IGW', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::ElasticLoadBalancingV2::LoadBalancer', { - DependsOn: [ - 'StackPublicSubnet1DefaultRoute16154E3D', - 'StackPublicSubnet1RouteTableAssociation74F1C1B6', - 'StackPublicSubnet2DefaultRoute0319539B', - 'StackPublicSubnet2RouteTableAssociation5E8F73F1', - ], - }); - }); - - test('Trivial construction: internal', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internal', - Subnets: [ - { Ref: 'StackPrivateSubnet1Subnet47AC2BC7' }, - { Ref: 'StackPrivateSubnet2SubnetA2F8EDD8' }, - ], - Type: 'application', - }); - }); - - test('Attributes', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - deletionProtection: true, - http2Enabled: false, - idleTimeout: cdk.Duration.seconds(1000), - dropInvalidHeaderFields: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: [ - { - Key: 'deletion_protection.enabled', - Value: 'true', - }, - { - Key: 'routing.http2.enabled', - Value: 'false', - }, - { - Key: 'idle_timeout.timeout_seconds', - Value: '1000', - }, - { - Key: 'routing.http.drop_invalid_header_fields.enabled', - Value: 'true', - }, - ], - }); - }); - - describe('Desync mitigation mode', () => { - test('Defensive', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - desyncMitigationMode: elbv2.DesyncMitigationMode.DEFENSIVE, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: [ - { - Key: 'deletion_protection.enabled', - Value: 'false', - }, - { - Key: 'routing.http.desync_mitigation_mode', - Value: 'defensive', - }, - ], - }); - }); - test('Monitor', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - desyncMitigationMode: elbv2.DesyncMitigationMode.MONITOR, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: [ - { - Key: 'deletion_protection.enabled', - Value: 'false', - }, - { - Key: 'routing.http.desync_mitigation_mode', - Value: 'monitor', - }, - ], - }); - }); - test('Strictest', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - desyncMitigationMode: elbv2.DesyncMitigationMode.STRICTEST, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: [ - { - Key: 'deletion_protection.enabled', - Value: 'false', - }, - { - Key: 'routing.http.desync_mitigation_mode', - Value: 'strictest', - }, - ], - }); - }); - }); - - test('Deletion protection false', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - deletionProtection: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: Match.arrayWith([ - { - Key: 'deletion_protection.enabled', - Value: 'false', - }, - ]), - }); - }); - - test('Can add and list listeners for an owned ApplicationLoadBalancer', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - }); - - const listener = loadBalancer.addListener('listener', { - protocol: elbv2.ApplicationProtocol.HTTP, - defaultAction: elbv2.ListenerAction.fixedResponse(200), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); - expect(loadBalancer.listeners).toContain(listener); - }); - - describe('logAccessLogs', () => { - - function loggingSetup(): { stack: cdk.Stack, bucket: s3.Bucket, lb: elbv2.ApplicationLoadBalancer } { - const app = new cdk.App(); - const stack = new cdk.Stack(app, undefined, { env: { region: 'us-east-1' } }); - const vpc = new ec2.Vpc(stack, 'Stack'); - const bucket = new s3.Bucket(stack, 'AccessLoggingBucket'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - return { stack, bucket, lb }; - } - - test('sets load balancer attributes', () => { - // GIVEN - const { stack, bucket, lb } = loggingSetup(); - - // WHEN - lb.logAccessLogs(bucket); - - //THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: Match.arrayWith([ - { - Key: 'access_logs.s3.enabled', - Value: 'true', - }, - { - Key: 'access_logs.s3.bucket', - Value: { Ref: 'AccessLoggingBucketA6D88F29' }, - }, - { - Key: 'access_logs.s3.prefix', - Value: '', - }, - ]), - }); - }); - - test('adds a dependency on the bucket', () => { - // GIVEN - const { stack, bucket, lb } = loggingSetup(); - - // WHEN - lb.logAccessLogs(bucket); - - // THEN - // verify the ALB depends on the bucket *and* the bucket policy - Template.fromStack(stack).hasResource('AWS::ElasticLoadBalancingV2::LoadBalancer', { - DependsOn: ['AccessLoggingBucketPolicy700D7CC6', 'AccessLoggingBucketA6D88F29'], - }); - }); - - test('logging bucket permissions', () => { - // GIVEN - const { stack, bucket, lb } = loggingSetup(); - - // WHEN - lb.logAccessLogs(bucket); - - // THEN - // verify the bucket policy allows the ALB to put objects in the bucket - Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: [ - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - }, - { - Action: 's3:PutObject', - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, - }, - { - Action: 's3:GetBucketAcl', - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], - }, - }, - ], - }, - }); - }); - - test('access logging with prefix', () => { - // GIVEN - const { stack, bucket, lb } = loggingSetup(); - - // WHEN - lb.logAccessLogs(bucket, 'prefix-of-access-logs'); - - // THEN - // verify that the LB attributes reference the bucket - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: Match.arrayWith([ - { - Key: 'access_logs.s3.enabled', - Value: 'true', - }, - { - Key: 'access_logs.s3.bucket', - Value: { Ref: 'AccessLoggingBucketA6D88F29' }, - }, - { - Key: 'access_logs.s3.prefix', - Value: 'prefix-of-access-logs', - }, - ]), - }); - - // verify the bucket policy allows the ALB to put objects in the bucket - Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: [ - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - }, - { - Action: 's3:PutObject', - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, - }, - { - Action: 's3:GetBucketAcl', - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], - }, - }, - ], - }, - }); - }); - }); - - test('Exercise metrics', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const metrics = new Array(); - metrics.push(lb.metrics.activeConnectionCount()); - metrics.push(lb.metrics.clientTlsNegotiationErrorCount()); - metrics.push(lb.metrics.consumedLCUs()); - metrics.push(lb.metrics.elbAuthError()); - metrics.push(lb.metrics.elbAuthFailure()); - metrics.push(lb.metrics.elbAuthLatency()); - metrics.push(lb.metrics.elbAuthSuccess()); - metrics.push(lb.metrics.httpCodeElb(elbv2.HttpCodeElb.ELB_3XX_COUNT)); - metrics.push(lb.metrics.httpCodeTarget(elbv2.HttpCodeTarget.TARGET_3XX_COUNT)); - metrics.push(lb.metrics.httpFixedResponseCount()); - metrics.push(lb.metrics.httpRedirectCount()); - metrics.push(lb.metrics.httpRedirectUrlLimitExceededCount()); - metrics.push(lb.metrics.ipv6ProcessedBytes()); - metrics.push(lb.metrics.ipv6RequestCount()); - metrics.push(lb.metrics.newConnectionCount()); - metrics.push(lb.metrics.processedBytes()); - metrics.push(lb.metrics.rejectedConnectionCount()); - metrics.push(lb.metrics.requestCount()); - metrics.push(lb.metrics.ruleEvaluations()); - metrics.push(lb.metrics.targetConnectionErrorCount()); - metrics.push(lb.metrics.targetResponseTime()); - metrics.push(lb.metrics.targetTLSNegotiationErrorCount()); - - for (const metric of metrics) { - expect(metric.namespace).toEqual('AWS/ApplicationELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: { 'Fn::GetAtt': ['LB8A12904C', 'LoadBalancerFullName'] }, - }); - } - }); - - test('loadBalancerName', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.ApplicationLoadBalancer(stack, 'ALB', { - loadBalancerName: 'myLoadBalancer', - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Name: 'myLoadBalancer', - }); - }); - - test('imported load balancer with no vpc throws error when calling addTargets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const sg = new ec2.SecurityGroup(stack, 'sg', { - vpc, - securityGroupName: 'mySg', - }); - const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { - loadBalancerArn: albArn, - securityGroupId: sg.securityGroupId, - }); - - // WHEN - const listener = alb.addListener('Listener', { port: 80 }); - expect(() => listener.addTargets('Targets', { port: 8080 })).toThrow(); - }); - - test('imported load balancer with vpc does not throw error when calling addTargets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const sg = new ec2.SecurityGroup(stack, 'sg', { - vpc, - securityGroupName: 'mySg', - }); - const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { - loadBalancerArn: albArn, - securityGroupId: sg.securityGroupId, - vpc, - }); - - // WHEN - const listener = alb.addListener('Listener', { port: 80 }); - expect(() => listener.addTargets('Targets', { port: 8080 })).not.toThrow(); - }); - - test('imported load balancer with vpc can add but not list listeners', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const sg = new ec2.SecurityGroup(stack, 'sg', { - vpc, - securityGroupName: 'mySg', - }); - const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { - loadBalancerArn: albArn, - securityGroupId: sg.securityGroupId, - vpc, - }); - - // WHEN - const listener = alb.addListener('Listener', { port: 80 }); - listener.addTargets('Targets', { port: 8080 }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); - expect(() => alb.listeners).toThrow(); - }); - - test('imported load balancer knows its region', () => { - const stack = new cdk.Stack(); - - // WHEN - const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { - loadBalancerArn: albArn, - securityGroupId: 'sg-1234', - }); - - // THEN - expect(alb.env.region).toEqual('us-west-2'); - }); - - test('imported load balancer can produce metrics', () => { - const stack = new cdk.Stack(); - - // WHEN - const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { - loadBalancerArn: albArn, - securityGroupId: 'sg-1234', - }); - - // THEN - const metric = alb.metrics.activeConnectionCount(); - expect(metric.namespace).toEqual('AWS/ApplicationELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: 'app/my-load-balancer/50dc6c495c0c9188', - }); - expect(alb.env.region).toEqual('us-west-2'); - }); - - test('can add secondary security groups', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - const alb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - securityGroup: new ec2.SecurityGroup(stack, 'SecurityGroup1', { vpc }), - }); - alb.addSecurityGroup(new ec2.SecurityGroup(stack, 'SecurityGroup2', { vpc })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - SecurityGroups: [ - { 'Fn::GetAtt': ['SecurityGroup1F554B36F', 'GroupId'] }, - { 'Fn::GetAtt': ['SecurityGroup23BE86BB7', 'GroupId'] }, - ], - Type: 'application', - }); - }); - - describe('lookup', () => { - test('Can look up an ApplicationLoadBalancer', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - // WHEN - const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::ApplicationLoadBalancer', 0); - expect(loadBalancer.loadBalancerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/application/my-load-balancer/50dc6c495c0c9188'); - expect(loadBalancer.loadBalancerCanonicalHostedZoneId).toEqual('Z3DZXE0EXAMPLE'); - expect(loadBalancer.loadBalancerDnsName).toEqual('my-load-balancer-1234567890.us-west-2.elb.amazonaws.com'); - expect(loadBalancer.ipAddressType).toEqual(elbv2.IpAddressType.DUAL_STACK); - expect(loadBalancer.connections.securityGroups[0].securityGroupId).toEqual('sg-12345678'); - expect(loadBalancer.env.region).toEqual('us-west-2'); - }); - - test('Can add but not list listeners for a looked-up ApplicationLoadBalancer', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // WHEN - loadBalancer.addListener('listener', { - protocol: elbv2.ApplicationProtocol.HTTP, - defaultAction: elbv2.ListenerAction.fixedResponse(200), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); - expect(() => loadBalancer.listeners).toThrow(); - }); - - test('Can create metrics for a looked-up ApplicationLoadBalancer', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // WHEN - const metric = loadBalancer.metrics.activeConnectionCount(); - - // THEN - expect(metric.namespace).toEqual('AWS/ApplicationELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: 'application/my-load-balancer/50dc6c495c0c9188', - }); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/security-group.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/security-group.test.ts deleted file mode 100644 index e0aeafb44ee75..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/security-group.test.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; -import { FakeSelfRegisteringTarget } from '../helpers'; - -describe('tests', () => { - test('security groups are automatically opened bidi for default rule', () => { - // GIVEN - const fixture = new TestFixture(); - const target = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); - - // WHEN - fixture.listener.addTargets('TargetGroup', { - port: 8008, - targets: [target], - }); - - // THEN - expectSameStackSGRules(fixture.stack); - }); - - test('security groups are automatically opened bidi for additional rule', () => { - // GIVEN - const fixture = new TestFixture(); - const target1 = new FakeSelfRegisteringTarget(fixture.stack, 'DefaultTarget', fixture.vpc); - const target2 = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); - - // WHEN - fixture.listener.addTargets('TargetGroup1', { - port: 80, - targets: [target1], - }); - - fixture.listener.addTargetGroups('Rule', { - priority: 10, - conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], - targetGroups: [new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup2', { - vpc: fixture.vpc, - port: 8008, - targets: [target2], - })], - }); - - // THEN - expectSameStackSGRules(fixture.stack); - }); - - test('adding the same targets twice also works', () => { - // GIVEN - const fixture = new TestFixture(); - const target = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); - - // WHEN - const group = new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup', { - vpc: fixture.vpc, - port: 8008, - targets: [target], - }); - - fixture.listener.addTargetGroups('Default', { - targetGroups: [group], - }); - fixture.listener.addTargetGroups('WithPath', { - priority: 10, - conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], - targetGroups: [group], - }); - - // THEN - expectSameStackSGRules(fixture.stack); - }); - - test('same result if target is added to group after assigning to listener', () => { - // GIVEN - const fixture = new TestFixture(); - const group = new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup', { - vpc: fixture.vpc, - port: 8008, - }); - fixture.listener.addTargetGroups('Default', { - targetGroups: [group], - }); - - // WHEN - const target = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); - group.addTarget(target); - - // THEN - expectSameStackSGRules(fixture.stack); - }); - - test('ingress is added to child stack SG instead of parent stack', () => { - // GIVEN - const fixture = new TestFixture(true); - - const parentGroup = new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup', { - vpc: fixture.vpc, - port: 8008, - targets: [new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc)], - }); - - // listener requires at least one rule for ParentStack to create - fixture.listener.addTargetGroups('Default', { targetGroups: [parentGroup] }); - - const childStack = new cdk.Stack(fixture.app, 'childStack'); - - // WHEN - const childGroup = new elbv2.ApplicationTargetGroup(childStack, 'TargetGroup', { - // We're assuming the 2nd VPC is peered to the 1st, or something. - vpc: fixture.vpc, - port: 8008, - targets: [new FakeSelfRegisteringTarget(childStack, 'Target', fixture.vpc)], - }); - - new elbv2.ApplicationListenerRule(childStack, 'ListenerRule', { - listener: fixture.listener, - targetGroups: [childGroup], - priority: 100, - conditions: [elbv2.ListenerCondition.hostHeaders(['www.foo.com'])], - }); - - // THEN - expectSameStackSGRules(fixture.stack); - expectedImportedSGRules(childStack); - }); - - test('SG peering works on exported/imported load balancer', () => { - // GIVEN - const fixture = new TestFixture(false); - const stack2 = new cdk.Stack(fixture.app, 'stack2'); - const vpc2 = new ec2.Vpc(stack2, 'VPC'); - const group = new elbv2.ApplicationTargetGroup(stack2, 'TargetGroup', { - // We're assuming the 2nd VPC is peered to the 1st, or something. - vpc: vpc2, - port: 8008, - targets: [new FakeSelfRegisteringTarget(stack2, 'Target', vpc2)], - }); - - // WHEN - const lb2 = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack2, 'LB', { - loadBalancerArn: fixture.lb.loadBalancerArn, - securityGroupId: fixture.lb.connections.securityGroups[0].securityGroupId, - securityGroupAllowsAllOutbound: false, - }); - const listener2 = lb2.addListener('YetAnotherListener', { port: 80 }); - listener2.addTargetGroups('Default', { targetGroups: [group] }); - - // THEN - expectedImportedSGRules(stack2); - }); - - test('SG peering works on exported/imported listener', () => { - // GIVEN - const fixture = new TestFixture(); - const stack2 = new cdk.Stack(fixture.app, 'stack2'); - const vpc2 = new ec2.Vpc(stack2, 'VPC'); - const group = new elbv2.ApplicationTargetGroup(stack2, 'TargetGroup', { - // We're assuming the 2nd VPC is peered to the 1st, or something. - vpc: vpc2, - port: 8008, - targets: [new FakeSelfRegisteringTarget(stack2, 'Target', vpc2)], - }); - fixture.listener.addTargets('default', { port: 80 }); - - // WHEN - const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SecurityGroup', - fixture.listener.connections.securityGroups[0].securityGroupId, - { allowAllOutbound: false }); - const listener2 = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'YetAnotherListener', { - defaultPort: 8008, - listenerArn: fixture.listener.listenerArn, - securityGroup, - }); - listener2.addTargetGroups('Default', { - // Must be a non-default target - priority: 10, - conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], - targetGroups: [group], - }); - - // THEN - expectedImportedSGRules(stack2); - }); - - testDeprecated('default port peering works on constructed listener', () => { - // GIVEN - const fixture = new TestFixture(); - fixture.listener.addTargets('Default', { port: 8080, targets: [new elbv2.InstanceTarget('i-12345')] }); - - // WHEN - fixture.listener.connections.allowDefaultPortFromAnyIpv4('Open to the world'); - - // THEN - Template.fromStack(fixture.stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - SecurityGroupIngress: [ - { - CidrIp: '0.0.0.0/0', - Description: 'Open to the world', - FromPort: 80, - IpProtocol: 'tcp', - ToPort: 80, - }, - ], - }); - }); - - test('default port peering works on imported listener', () => { - // GIVEN - const stack2 = new cdk.Stack(); - const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SecurityGroup', 'imported-security-group-id'); - - // WHEN - const listener2 = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'YetAnotherListener', { - listenerArn: 'listener-arn', - securityGroup, - defaultPort: 8080, - }); - listener2.connections.allowDefaultPortFromAnyIpv4('Open to the world'); - - // THEN - Template.fromStack(stack2).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - CidrIp: '0.0.0.0/0', - Description: 'Open to the world', - IpProtocol: 'tcp', - FromPort: 8080, - ToPort: 8080, - GroupId: 'imported-security-group-id', - }); - }); -}); - -const LB_SECURITY_GROUP = { 'Fn::GetAtt': ['LBSecurityGroup8A41EA2B', 'GroupId'] }; -const IMPORTED_LB_SECURITY_GROUP = { 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttLBSecurityGroup8A41EA2BGroupId851EE1F6' }; - -function expectSameStackSGRules(stack: cdk.Stack) { - expectSGRules(stack, LB_SECURITY_GROUP); -} - -function expectedImportedSGRules(stack: cdk.Stack) { - expectSGRules(stack, IMPORTED_LB_SECURITY_GROUP); -} - -function expectSGRules(stack: cdk.Stack, lbGroup: any) { - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: lbGroup, - IpProtocol: 'tcp', - Description: 'Load balancer to target', - DestinationSecurityGroupId: { 'Fn::GetAtt': ['TargetSGDB98152D', 'GroupId'] }, - FromPort: 8008, - ToPort: 8008, - }); - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - IpProtocol: 'tcp', - Description: 'Load balancer to target', - FromPort: 8008, - GroupId: { 'Fn::GetAtt': ['TargetSGDB98152D', 'GroupId'] }, - SourceSecurityGroupId: lbGroup, - ToPort: 8008, - }); -} - -class TestFixture { - public readonly app: cdk.App; - public readonly stack: cdk.Stack; - public readonly vpc: ec2.Vpc; - public readonly lb: elbv2.ApplicationLoadBalancer; - public readonly _listener: elbv2.ApplicationListener | undefined; - - constructor(createListener?: boolean) { - this.app = new cdk.App(); - this.stack = new cdk.Stack(this.app, 'Stack'); - this.vpc = new ec2.Vpc(this.stack, 'VPC', { - maxAzs: 2, - }); - this.lb = new elbv2.ApplicationLoadBalancer(this.stack, 'LB', { vpc: this.vpc }); - - createListener = createListener ?? true; - if (createListener) { - this._listener = this.lb.addListener('Listener', { port: 80, open: false }); - } - } - - public get listener(): elbv2.ApplicationListener { - if (this._listener === undefined) { throw new Error('Did not create a listener'); } - return this._listener; - } -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/target-group.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/target-group.test.ts deleted file mode 100644 index 33e31eb57e375..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/target-group.test.ts +++ /dev/null @@ -1,646 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; -import { FakeSelfRegisteringTarget } from '../helpers'; - -describe('tests', () => { - test('Empty target Group without type still requires a VPC', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'LB', {}); - - // THEN - expect(() => { - app.synth(); - }).toThrow(/'vpc' is required for a non-Lambda TargetGroup/); - }); - - test('Lambda target should not have stickiness.enabled set', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - new elbv2.ApplicationTargetGroup(stack, 'TG', { - targetType: elbv2.TargetType.LAMBDA, - }); - - const tg = new elbv2.ApplicationTargetGroup(stack, 'TG2'); - tg.addTarget({ - attachToApplicationTargetGroup(_targetGroup: elbv2.IApplicationTargetGroup): elbv2.LoadBalancerTargetProps { - return { - targetType: elbv2.TargetType.LAMBDA, - targetJson: { id: 'arn:aws:lambda:eu-west-1:123456789012:function:myFn' }, - }; - }, - }); - - const matches = Template.fromStack(stack).findResources('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - }, - ], - }); - expect(Object.keys(matches).length).toBe(0); - }); - - test('Lambda target should not have port set', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - const tg = new elbv2.ApplicationTargetGroup(stack, 'TG2', { - protocol: elbv2.ApplicationProtocol.HTTPS, - }); - tg.addTarget({ - attachToApplicationTargetGroup(_targetGroup: elbv2.IApplicationTargetGroup): elbv2.LoadBalancerTargetProps { - return { - targetType: elbv2.TargetType.LAMBDA, - targetJson: { id: 'arn:aws:lambda:eu-west-1:123456789012:function:myFn' }, - }; - }, - }); - expect(() => app.synth()).toThrow(/port\/protocol should not be specified for Lambda targets/); - }); - - test('Lambda target should not have protocol set', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - new elbv2.ApplicationTargetGroup(stack, 'TG', { - port: 443, - targetType: elbv2.TargetType.LAMBDA, - }); - expect(() => app.synth()).toThrow(/port\/protocol should not be specified for Lambda targets/); - }); - - test('Can add self-registering target to imported TargetGroup', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - const tg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'TG', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', - }); - tg.addTarget(new FakeSelfRegisteringTarget(stack, 'Target', vpc)); - }); - - testDeprecated('Cannot add direct target to imported TargetGroup', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const tg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'TG', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', - }); - - // WHEN - expect(() => { - tg.addTarget(new elbv2.InstanceTarget('i-1234')); - }).toThrow(/Cannot add a non-self registering target to an imported TargetGroup/); - }); - - testDeprecated('HealthCheck fields set if provided', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const alb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', { vpc }); - const listener = new elbv2.ApplicationListener(stack, 'Listener', { - port: 80, - loadBalancer: alb, - open: false, - }); - - // WHEN - const ipTarget = new elbv2.IpTarget('10.10.12.12'); - listener.addTargets('TargetGroup', { - targets: [ipTarget], - port: 80, - healthCheck: { - enabled: true, - healthyHttpCodes: '255', - interval: cdk.Duration.seconds(255), - timeout: cdk.Duration.seconds(192), - healthyThresholdCount: 29, - unhealthyThresholdCount: 27, - path: '/arbitrary', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - HealthCheckEnabled: true, - HealthCheckIntervalSeconds: 255, - HealthCheckPath: '/arbitrary', - HealthCheckTimeoutSeconds: 192, - HealthyThresholdCount: 29, - Matcher: { - HttpCode: '255', - }, - Port: 80, - UnhealthyThresholdCount: 27, - }); - }); - - test('Load balancer duration cookie stickiness', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - stickinessCookieDuration: cdk.Duration.minutes(5), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - Value: 'true', - }, - { - Key: 'stickiness.type', - Value: 'lb_cookie', - }, - { - Key: 'stickiness.lb_cookie.duration_seconds', - Value: '300', - }, - ], - }); - }); - - test('Load balancer app cookie stickiness', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - stickinessCookieDuration: cdk.Duration.minutes(5), - stickinessCookieName: 'MyDeliciousCookie', - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - Value: 'true', - }, - { - Key: 'stickiness.type', - Value: 'app_cookie', - }, - { - Key: 'stickiness.app_cookie.cookie_name', - Value: 'MyDeliciousCookie', - }, - { - Key: 'stickiness.app_cookie.duration_seconds', - Value: '300', - }, - ], - }); - }); - - test('Custom Load balancer algorithm type', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - loadBalancingAlgorithmType: elbv2.TargetGroupLoadBalancingAlgorithmType.LEAST_OUTSTANDING_REQUESTS, - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'stickiness.enabled', - Value: 'false', - }, - { - Key: 'load_balancing.algorithm.type', - Value: 'least_outstanding_requests', - }, - ], - }); - }); - - test('Can set a protocol version', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - protocolVersion: elbv2.ApplicationProtocolVersion.GRPC, - healthCheck: { - enabled: true, - healthyGrpcCodes: '0-99', - interval: cdk.Duration.seconds(255), - timeout: cdk.Duration.seconds(192), - healthyThresholdCount: 29, - unhealthyThresholdCount: 27, - path: '/arbitrary', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - ProtocolVersion: 'GRPC', - HealthCheckEnabled: true, - HealthCheckIntervalSeconds: 255, - HealthCheckPath: '/arbitrary', - HealthCheckTimeoutSeconds: 192, - HealthyThresholdCount: 29, - Matcher: { - GrpcCode: '0-99', - }, - UnhealthyThresholdCount: 27, - }); - }); - - test('Bad stickiness cookie names', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const errMessage = 'App cookie names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they\'re reserved for use by the load balancer'; - - // THEN - ['AWSALBCookieName', 'AWSALBstickinessCookieName', 'AWSALBTGCookieName'].forEach((badCookieName, i) => { - expect(() => { - new elbv2.ApplicationTargetGroup(stack, `TargetGroup${i}`, { - stickinessCookieDuration: cdk.Duration.minutes(5), - stickinessCookieName: badCookieName, - vpc, - }); - }).toThrow(errMessage); - }); - }); - - test('Empty stickiness cookie name', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // THEN - expect(() => { - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - stickinessCookieDuration: cdk.Duration.minutes(5), - stickinessCookieName: '', - vpc, - }); - }).toThrow(/App cookie name cannot be an empty string./); - }); - - test('Bad stickiness duration value', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // THEN - expect(() => { - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - stickinessCookieDuration: cdk.Duration.days(8), - vpc, - }); - }).toThrow(/Stickiness cookie duration value must be between 1 second and 7 days \(604800 seconds\)./); - }); - - test('Bad slow start duration value', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // THEN - [cdk.Duration.minutes(16), cdk.Duration.seconds(29)].forEach((badDuration, i) => { - expect(() => { - new elbv2.ApplicationTargetGroup(stack, `TargetGroup${i}`, { - slowStart: badDuration, - vpc, - }); - }).toThrow(/Slow start duration value must be between 30 and 900 seconds./); - }); - }); - - test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( - 'Throws validation error, when `healthCheck` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - healthCheck: { - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS]`); - }); - - test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( - 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - }); - - // WHEN - tg.configureHealthCheck({ - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS]`); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Does not throw validation error, when `healthCheck` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - healthCheck: { - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Does not throw validation error, when `configureHealthCheck()` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - }); - - // WHEN - tg.configureHealthCheck({ - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Throws validation error, when `healthCheck` has `protocol` set to %s and `interval` is equal to `timeout`', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - healthCheck: { - interval: cdk.Duration.seconds(60), - timeout: cdk.Duration.seconds(60), - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 1 minute'); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Throws validation error, when `healthCheck` has `protocol` set to %s and `interval` is smaller than `timeout`', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - healthCheck: { - interval: cdk.Duration.seconds(60), - timeout: cdk.Duration.seconds(120), - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 2 minutes'); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s and `interval` is equal to `timeout`', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - }); - - // WHEN - tg.configureHealthCheck({ - interval: cdk.Duration.seconds(60), - timeout: cdk.Duration.seconds(60), - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 1 minute'); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s and `interval` is smaller than `timeout`', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - }); - - // WHEN - tg.configureHealthCheck({ - interval: cdk.Duration.seconds(60), - timeout: cdk.Duration.seconds(120), - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 2 minutes'); - }); - - test('Throws validation error, when `configureHealthCheck()`protocol is undefined and `interval` is smaller than `timeout`', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { - vpc, - }); - - // WHEN - tg.configureHealthCheck({ - interval: cdk.Duration.seconds(60), - timeout: cdk.Duration.seconds(120), - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 2 minute'); - }); - - test('imported targetGroup has targetGroupName', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', - }); - - // THEN - expect(importedTg.targetGroupName).toEqual('myAlbTargetGroup'); - }); - - test('imported targetGroup with imported ARN has targetGroupName', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const importedTgArn = cdk.Fn.importValue('ImportTargetGroupArn'); - const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: importedTgArn, - }); - new cdk.CfnOutput(stack, 'TargetGroupOutput', { - value: importedTg.targetGroupName, - }); - - // THEN - Template.fromStack(stack).hasOutput('TargetGroupOutput', { - Value: { - 'Fn::Select': [ - // myAlbTargetGroup - 1, - { - 'Fn::Split': [ - // [targetgroup, myAlbTargetGroup, 73e2d6bc24d8a067] - '/', - { - 'Fn::Select': [ - // targetgroup/myAlbTargetGroup/73e2d6bc24d8a067 - 5, - { - 'Fn::Split': [ - // [arn, aws, elasticloadbalancing, us-west-2, 123456789012, targetgroup/myAlbTargetGroup/73e2d6bc24d8a067] - ':', - { - // arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067 - 'Fn::ImportValue': 'ImportTargetGroupArn', - }, - ], - }, - ], - }, - ], - }, - ], - }, - }); - }); - - test('imported targetGroup has metrics', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', - loadBalancerArns: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/73e2d6bc24d8a067', - }); - - const metric = targetGroup.metrics.custom('MetricName'); - - // THEN - expect(metric.namespace).toEqual('AWS/ApplicationELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: 'app/my-load-balancer/73e2d6bc24d8a067', - TargetGroup: 'targetgroup/my-target-group/50dc6c495c0c9188', - }); - }); - - test('imported targetGroup without load balancer cannot have metrics', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', - }); - - expect(() => targetGroup.metrics.custom('MetricName')).toThrow(); - }); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/actions.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/actions.test.ts deleted file mode 100644 index d01b0cd666db0..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/actions.test.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; - -let stack: cdk.Stack; -let group1: elbv2.NetworkTargetGroup; -let group2: elbv2.NetworkTargetGroup; -let lb: elbv2.NetworkLoadBalancer; - -beforeEach(() => { - stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - group1 = new elbv2.NetworkTargetGroup(stack, 'TargetGroup1', { vpc, port: 80 }); - group2 = new elbv2.NetworkTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 }); - lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); -}); - -describe('tests', () => { - test('Forward to multiple targetgroups with an Action and stickiness', () => { - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: elbv2.NetworkListenerAction.forward([group1, group2], { - stickinessDuration: cdk.Duration.hours(1), - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - ForwardConfig: { - TargetGroupStickinessConfig: { - DurationSeconds: 3600, - Enabled: true, - }, - TargetGroups: [ - { - TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, - }, - { - TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, - }, - ], - }, - Type: 'forward', - }, - ], - }); - }); - - test('Weighted forward to multiple targetgroups with an Action', () => { - // WHEN - lb.addListener('Listener', { - port: 80, - defaultAction: elbv2.NetworkListenerAction.weightedForward([ - { targetGroup: group1, weight: 10 }, - { targetGroup: group2, weight: 50 }, - ], { - stickinessDuration: cdk.Duration.hours(1), - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - ForwardConfig: { - TargetGroupStickinessConfig: { - DurationSeconds: 3600, - Enabled: true, - }, - TargetGroups: [ - { - TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, - Weight: 10, - }, - { - TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, - Weight: 50, - }, - ], - }, - Type: 'forward', - }, - ], - }); - }); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/listener.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/listener.test.ts deleted file mode 100644 index 886fd7a6a884c..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/listener.test.ts +++ /dev/null @@ -1,525 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as constructs from 'constructs'; -import * as elbv2 from '../../lib'; -import { FakeSelfRegisteringTarget } from '../helpers'; - -describe('tests', () => { - test('Trivial add listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.addListener('Listener', { - port: 443, - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'TCP', - Port: 443, - }); - }); - - test('Can add target groups', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 443 }); - const group = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - - // WHEN - listener.addTargetGroups('Default', group); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, - Type: 'forward', - }, - ], - }); - }); - - testDeprecated('Can implicitly create target groups', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 443 }); - - // WHEN - listener.addTargets('Targets', { - port: 80, - targets: [new elbv2.InstanceTarget('i-12345')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, - Type: 'forward', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - VpcId: { Ref: 'Stack8A423254' }, - Port: 80, - Protocol: 'TCP', - Targets: [ - { Id: 'i-12345' }, - ], - }); - }); - - testDeprecated('implicitly created target group inherits protocol', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 9700, protocol: elbv2.Protocol.TCP_UDP }); - - // WHEN - listener.addTargets('Targets', { - port: 9700, - targets: [new elbv2.InstanceTarget('i-12345')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - DefaultActions: [ - { - TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, - Type: 'forward', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - VpcId: { Ref: 'Stack8A423254' }, - Port: 9700, - Protocol: 'TCP_UDP', - Targets: [ - { Id: 'i-12345' }, - ], - }); - }); - - testDeprecated('implicitly created target group but overrides inherited protocol', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const cert = new acm.Certificate(stack, 'Certificate', { - domainName: 'example.com', - }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.TLS, - certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)], - sslPolicy: elbv2.SslPolicy.TLS12, - }); - - // WHEN - listener.addTargets('Targets', { - port: 80, - protocol: elbv2.Protocol.TCP, - targets: [new elbv2.InstanceTarget('i-12345')], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'TLS', - Port: 443, - Certificates: [ - { CertificateArn: { Ref: 'Certificate4E7ABB08' } }, - ], - SslPolicy: 'ELBSecurityPolicy-TLS-1-2-2017-01', - DefaultActions: [ - { - TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, - Type: 'forward', - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - VpcId: { Ref: 'Stack8A423254' }, - Port: 80, - Protocol: 'TCP', - Targets: [ - { Id: 'i-12345' }, - ], - }); - }); - - test('Enable health check for targets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 443 }); - - // WHEN - const group = listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - group.configureHealthCheck({ - interval: cdk.Duration.seconds(30), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - HealthCheckIntervalSeconds: 30, - }); - }); - - test('Enable taking a dependency on an NLB target group\'s load balancer', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('Listener', { port: 443 }); - const group = listener.addTargets('Group', { - port: 80, - targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], - }); - - // WHEN - new ResourceWithLBDependency(stack, 'MyResource', group); - - // THEN - Template.fromStack(stack).templateMatches(Match.objectLike({ - Resources: { - MyResource: { - Type: 'Test::Resource', - DependsOn: [ - // 2nd dependency is there because of the structure of the construct tree. - // It does not harm. - 'LBListenerGroupGroup79B304FF', - 'LBListener49E825B4', - ], - }, - }, - })); - }); - - test('Trivial add TLS listener', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const cert = new acm.Certificate(stack, 'Certificate', { - domainName: 'example.com', - }); - - // WHEN - lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.TLS, - certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)], - sslPolicy: elbv2.SslPolicy.TLS12, - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'TLS', - Port: 443, - Certificates: [ - { CertificateArn: { Ref: 'Certificate4E7ABB08' } }, - ], - SslPolicy: 'ELBSecurityPolicy-TLS-1-2-2017-01', - }); - }); - - test('Trivial add TLS listener with ALPN', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const cert = new acm.Certificate(stack, 'Certificate', { - domainName: 'example.com', - }); - - // WHEN - lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.TLS, - alpnPolicy: elbv2.AlpnPolicy.HTTP2_ONLY, - certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)], - sslPolicy: elbv2.SslPolicy.TLS12, - defaultTargetGroups: [ - new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 }), - ], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'TLS', - Port: 443, - AlpnPolicy: ['HTTP2Only'], - Certificates: [{ CertificateArn: { Ref: 'Certificate4E7ABB08' } }], - SslPolicy: 'ELBSecurityPolicy-TLS-1-2-2017-01', - }); - }); - - test('Incompatible Protocol with ALPN', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - expect(() => lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.TCP, - alpnPolicy: elbv2.AlpnPolicy.HTTP2_OPTIONAL, - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - })).toThrow(/Protocol must be TLS when alpnPolicy have been specified/); - }); - - test('Invalid Protocol listener', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - expect(() => lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.HTTP, - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - })).toThrow(/The protocol must be one of TCP, TLS, UDP, TCP_UDP\. Found HTTP/); - }); - - test('Invalid Listener Target Healthcheck Interval', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('PublicListener', { port: 80 }); - const targetGroup = listener.addTargets('ECS', { - port: 80, - healthCheck: { - interval: cdk.Duration.seconds(350), - }, - }); - - const validationErrors: string[] = targetGroup.node.validate(); - const intervalError = validationErrors.find((err) => /Health check interval '350' not supported. Must be between/.test(err)); - expect(intervalError).toBeDefined(); - }); - - test('validation error if invalid health check protocol', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('PublicListener', { port: 80 }); - const targetGroup = listener.addTargets('ECS', { - port: 80, - healthCheck: { - interval: cdk.Duration.seconds(60), - }, - }); - - targetGroup.configureHealthCheck({ - interval: cdk.Duration.seconds(30), - protocol: elbv2.Protocol.UDP, - }); - - // THEN - const validationErrors: string[] = targetGroup.node.validate(); - expect(validationErrors).toEqual(["Health check protocol 'UDP' is not supported. Must be one of [HTTP, HTTPS, TCP]"]); - }); - - test('validation error if invalid path health check protocol', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('PublicListener', { port: 80 }); - const targetGroup = listener.addTargets('ECS', { - port: 80, - healthCheck: { - interval: cdk.Duration.seconds(60), - }, - }); - - targetGroup.configureHealthCheck({ - interval: cdk.Duration.seconds(30), - protocol: elbv2.Protocol.TCP, - path: '/', - }); - - // THEN - const validationErrors: string[] = targetGroup.node.validate(); - expect(validationErrors).toEqual([ - "'TCP' health checks do not support the path property. Must be one of [HTTP, HTTPS]", - ]); - }); - - test('validation error if invalid timeout health check', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = lb.addListener('PublicListener', { port: 80 }); - const targetGroup = listener.addTargets('ECS', { - port: 80, - healthCheck: { - interval: cdk.Duration.seconds(60), - }, - }); - - targetGroup.configureHealthCheck({ - interval: cdk.Duration.seconds(30), - protocol: elbv2.Protocol.HTTP, - timeout: cdk.Duration.seconds(10), - }); - - // THEN - const validationErrors: string[] = targetGroup.node.validate(); - expect(validationErrors).toEqual([ - 'Custom health check timeouts are not supported for Network Load Balancer health checks. Expected 6 seconds for HTTP, got 10', - ]); - }); - - test('Protocol & certs TLS listener', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - expect(() => lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.TLS, - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - })).toThrow(/When the protocol is set to TLS, you must specify certificates/); - }); - - test('TLS and certs specified listener', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const cert = new acm.Certificate(stack, 'Certificate', { - domainName: 'example.com', - }); - - expect(() => lb.addListener('Listener', { - port: 443, - protocol: elbv2.Protocol.TCP, - certificates: [{ certificateArn: cert.certificateArn }], - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - })).toThrow(/Protocol must be TLS when certificates have been specified/); - }); - - test('Can pass multiple certificates to network listener constructor', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.addListener('Listener', { - port: 443, - certificates: [ - importedCertificate(stack, 'cert1'), - importedCertificate(stack, 'cert2'), - ], - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'TLS', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert2' }], - }); - }); - - test('Can add multiple certificates to network listener after construction', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - const listener = lb.addListener('Listener', { - port: 443, - certificates: [ - importedCertificate(stack, 'cert1'), - ], - defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], - }); - - listener.addCertificates('extra', [ - importedCertificate(stack, 'cert2'), - ]); - - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { - Protocol: 'TLS', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { - Certificates: [{ CertificateArn: 'cert2' }], - }); - }); - - test('not allowed to specify defaultTargetGroups and defaultAction together', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const group = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - expect(() => { - lb.addListener('Listener1', { - port: 80, - defaultTargetGroups: [group], - defaultAction: elbv2.NetworkListenerAction.forward([group]), - }); - }).toThrow(/Specify at most one/); - }); - - test('Can look up an NetworkListener', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - // WHEN - const listener = elbv2.NetworkListener.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 0); - expect(listener.listenerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/network/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2'); - }); -}); - -class ResourceWithLBDependency extends cdk.CfnResource { - constructor(scope: constructs.Construct, id: string, targetGroup: elbv2.ITargetGroup) { - super(scope, id, { type: 'Test::Resource' }); - this.node.addDependency(targetGroup.loadBalancerAttached); - } -} - -function importedCertificate(stack: cdk.Stack, - certificateArn = 'arn:aws:certificatemanager:123456789012:testregion:certificate/fd0b8392-3c0e-4704-81b6-8edf8612c852') { - return acm.Certificate.fromCertificateArn(stack, certificateArn, certificateArn); -} diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts deleted file mode 100644 index 89cab6aa1e773..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts +++ /dev/null @@ -1,654 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; - -describe('tests', () => { - test('Trivial construction: internet facing', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internet-facing', - Subnets: [ - { Ref: 'StackPublicSubnet1Subnet0AD81D22' }, - { Ref: 'StackPublicSubnet2Subnet3C7D2288' }, - ], - Type: 'network', - }); - }); - - test('Trivial construction: internal', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internal', - Subnets: [ - { Ref: 'StackPrivateSubnet1Subnet47AC2BC7' }, - { Ref: 'StackPrivateSubnet2SubnetA2F8EDD8' }, - ], - Type: 'network', - }); - }); - - test('VpcEndpointService with Domain Name imported from public hosted zone', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const nlb = new elbv2.NetworkLoadBalancer(stack, 'Nlb', { vpc }); - const endpointService = new ec2.VpcEndpointService(stack, 'EndpointService', { vpcEndpointServiceLoadBalancers: [nlb] }); - - // WHEN - const importedPHZ = route53.PublicHostedZone.fromPublicHostedZoneAttributes(stack, 'MyPHZ', { - hostedZoneId: 'sampleid', - zoneName: 'MyZone', - }); - new route53.VpcEndpointServiceDomainName(stack, 'EndpointServiceDomainName', { - endpointService, - domainName: 'MyDomain', - publicHostedZone: importedPHZ, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - HostedZoneId: 'sampleid', - }); - }); - - test('Attributes', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - crossZoneEnabled: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: Match.arrayWith([ - { - Key: 'load_balancing.cross_zone.enabled', - Value: 'true', - }, - ]), - }); - }); - - test('Access logging', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, undefined, { env: { region: 'us-east-1' } }); - const vpc = new ec2.Vpc(stack, 'Stack'); - const bucket = new s3.Bucket(stack, 'AccessLoggingBucket'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.logAccessLogs(bucket); - - // THEN - - // verify that the LB attributes reference the bucket - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: Match.arrayWith([ - { - Key: 'access_logs.s3.enabled', - Value: 'true', - }, - { - Key: 'access_logs.s3.bucket', - Value: { Ref: 'AccessLoggingBucketA6D88F29' }, - }, - { - Key: 'access_logs.s3.prefix', - Value: '', - }, - ]), - }); - - // verify the bucket policy allows the ALB to put objects in the bucket - Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: [ - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - }, - { - Action: 's3:PutObject', - Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - }, - { - Action: 's3:GetBucketAcl', - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], - }, - }, - ], - }, - }); - - // verify the ALB depends on the bucket *and* the bucket policy - Template.fromStack(stack).hasResource('AWS::ElasticLoadBalancingV2::LoadBalancer', { - DependsOn: ['AccessLoggingBucketPolicy700D7CC6', 'AccessLoggingBucketA6D88F29'], - }); - }); - - test('access logging with prefix', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, undefined, { env: { region: 'us-east-1' } }); - const vpc = new ec2.Vpc(stack, 'Stack'); - const bucket = new s3.Bucket(stack, 'AccessLoggingBucket'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - - // WHEN - lb.logAccessLogs(bucket, 'prefix-of-access-logs'); - - // THEN - // verify that the LB attributes reference the bucket - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - LoadBalancerAttributes: Match.arrayWith([ - { - Key: 'access_logs.s3.enabled', - Value: 'true', - }, - { - Key: 'access_logs.s3.bucket', - Value: { Ref: 'AccessLoggingBucketA6D88F29' }, - }, - { - Key: 'access_logs.s3.prefix', - Value: 'prefix-of-access-logs', - }, - ]), - }); - - // verify the bucket policy allows the ALB to put objects in the bucket - Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: [ - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - }, - { - Action: 's3:PutObject', - Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', - { Ref: 'AWS::AccountId' }, '/*']], - }, - }, - { - Action: 's3:GetBucketAcl', - Effect: 'Allow', - Principal: { Service: 'delivery.logs.amazonaws.com' }, - Resource: { - 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], - }, - }, - ], - }, - }); - }); - - test('loadBalancerName', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'ALB', { - loadBalancerName: 'myLoadBalancer', - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Name: 'myLoadBalancer', - }); - }); - - test('loadBalancerName unallowed: more than 32 characters', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'NLB', { - loadBalancerName: 'a'.repeat(33), - vpc, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Load balancer name: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" can have a maximum of 32 characters.'); - }); - - test('loadBalancerName unallowed: starts with "internal-"', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'NLB', { - loadBalancerName: 'internal-myLoadBalancer', - vpc, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Load balancer name: "internal-myLoadBalancer" must not begin with "internal-".'); - }); - - test('loadBalancerName unallowed: starts with hyphen', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'NLB', { - loadBalancerName: '-myLoadBalancer', - vpc, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Load balancer name: "-myLoadBalancer" must not begin or end with a hyphen.'); - }); - - test('loadBalancerName unallowed: ends with hyphen', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'NLB', { - loadBalancerName: 'myLoadBalancer-', - vpc, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Load balancer name: "myLoadBalancer-" must not begin or end with a hyphen.'); - }); - - test('loadBalancerName unallowed: unallowed characters', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'NLB', { - loadBalancerName: 'my load balancer', - vpc, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Load balancer name: "my load balancer" must contain only alphanumeric characters or hyphens.'); - }); - - test('imported network load balancer with no vpc specified throws error when calling addTargets', () => { - // GIVEN - const stack = new cdk.Stack(); - const nlbArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const nlb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'NLB', { - loadBalancerArn: nlbArn, - }); - // WHEN - const listener = nlb.addListener('Listener', { port: 80 }); - expect(() => listener.addTargets('targetgroup', { port: 8080 })).toThrow(); - }); - - test('imported network load balancer with vpc does not throw error when calling addTargets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - const nlbArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const nlb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'NLB', { - loadBalancerArn: nlbArn, - vpc, - }); - // WHEN - const listener = nlb.addListener('Listener', { port: 80 }); - expect(() => listener.addTargets('targetgroup', { port: 8080 })).not.toThrow(); - }); - - test('imported load balancer knows its region', () => { - const stack = new cdk.Stack(); - - // WHEN - const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; - const alb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'ALB', { - loadBalancerArn: albArn, - }); - - // THEN - expect(alb.env.region).toEqual('us-west-2'); - }); - - test('imported load balancer can have metrics', () => { - const stack = new cdk.Stack(); - - // WHEN - const arn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188'; - const nlb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'NLB', { - loadBalancerArn: arn, - }); - - const metric = nlb.metrics.custom('MetricName'); - - // THEN - expect(metric.namespace).toEqual('AWS/NetworkELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: 'network/my-load-balancer/50dc6c495c0c9188', - }); - }); - - test('Trivial construction: internal with Isolated subnets only', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC', { - subnetConfiguration: [{ - cidrMask: 20, - name: 'Isolated', - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - }], - }); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - internetFacing: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internal', - Subnets: [ - { Ref: 'VPCIsolatedSubnet1SubnetEBD00FC6' }, - { Ref: 'VPCIsolatedSubnet2Subnet4B1C8CAA' }, - ], - Type: 'network', - }); - }); - test('Internal with Public, Private, and Isolated subnets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC', { - subnetConfiguration: [{ - cidrMask: 24, - name: 'Public', - subnetType: ec2.SubnetType.PUBLIC, - }, { - cidrMask: 24, - name: 'Private', - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, { - cidrMask: 28, - name: 'Isolated', - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - }], - }); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - internetFacing: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internal', - Subnets: [ - { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, - { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, - ], - Type: 'network', - }); - }); - test('Internet-facing with Public, Private, and Isolated subnets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC', { - subnetConfiguration: [{ - cidrMask: 24, - name: 'Public', - subnetType: ec2.SubnetType.PUBLIC, - }, { - cidrMask: 24, - name: 'Private', - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, { - cidrMask: 28, - name: 'Isolated', - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - }], - }); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internet-facing', - Subnets: [ - { Ref: 'VPCPublicSubnet1SubnetB4246D30' }, - { Ref: 'VPCPublicSubnet2Subnet74179F39' }, - ], - Type: 'network', - }); - }); - test('Internal load balancer supplying public subnets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - internetFacing: false, - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internal', - Subnets: [ - { Ref: 'VPCPublicSubnet1SubnetB4246D30' }, - { Ref: 'VPCPublicSubnet2Subnet74179F39' }, - ], - Type: 'network', - }); - }); - test('Internal load balancer supplying isolated subnets', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC', { - subnetConfiguration: [{ - cidrMask: 24, - name: 'Public', - subnetType: ec2.SubnetType.PUBLIC, - }, { - cidrMask: 24, - name: 'Private', - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, { - cidrMask: 28, - name: 'Isolated', - subnetType: ec2.SubnetType.PRIVATE_ISOLATED, - }], - }); - - // WHEN - new elbv2.NetworkLoadBalancer(stack, 'LB', { - vpc, - internetFacing: false, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { - Scheme: 'internal', - Subnets: [ - { Ref: 'VPCIsolatedSubnet1SubnetEBD00FC6' }, - { Ref: 'VPCIsolatedSubnet2Subnet4B1C8CAA' }, - ], - Type: 'network', - }); - }); - - describe('lookup', () => { - test('Can look up a NetworkLoadBalancer', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - // WHEN - const loadBalancer = elbv2.NetworkLoadBalancer.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::NetworkLoadBalancer', 0); - expect(loadBalancer.loadBalancerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188'); - expect(loadBalancer.loadBalancerCanonicalHostedZoneId).toEqual('Z3DZXE0EXAMPLE'); - expect(loadBalancer.loadBalancerDnsName).toEqual('my-load-balancer-1234567890.us-west-2.elb.amazonaws.com'); - expect(loadBalancer.env.region).toEqual('us-west-2'); - }); - - test('Can add listeners to a looked-up NetworkLoadBalancer', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - const loadBalancer = elbv2.NetworkLoadBalancer.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - const targetGroup = new elbv2.NetworkTargetGroup(stack, 'tg', { - vpc: loadBalancer.vpc, - port: 3000, - }); - - // WHEN - loadBalancer.addListener('listener', { - protocol: elbv2.Protocol.TCP_UDP, - port: 3000, - defaultAction: elbv2.NetworkListenerAction.forward([targetGroup]), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::NetworkLoadBalancer', 0); - Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); - }); - test('Can create metrics from a looked-up NetworkLoadBalancer', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'stack', { - env: { - account: '123456789012', - region: 'us-west-2', - }, - }); - - const loadBalancer = elbv2.NetworkLoadBalancer.fromLookup(stack, 'a', { - loadBalancerTags: { - some: 'tag', - }, - }); - - // WHEN - const metric = loadBalancer.metrics.custom('MetricName'); - - // THEN - expect(metric.namespace).toEqual('AWS/NetworkELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: 'network/my-load-balancer/50dc6c495c0c9188', - }); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts b/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts deleted file mode 100644 index 8d705c7fee746..0000000000000 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts +++ /dev/null @@ -1,719 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as elbv2 from '../../lib'; - -describe('tests', () => { - test('Enable proxy protocol v2 attribute for target group', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - proxyProtocolV2: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'proxy_protocol_v2.enabled', - Value: 'true', - }, - ], - }); - }); - - test('Enable preserve_client_ip attribute for target group', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - preserveClientIp: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'preserve_client_ip.enabled', - Value: 'true', - }, - ], - }); - }); - - test('Disable proxy protocol v2 for attribute target group', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - proxyProtocolV2: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'proxy_protocol_v2.enabled', - Value: 'false', - }, - ], - }); - }); - - test('Disable preserve_client_ip attribute for target group', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - preserveClientIp: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'preserve_client_ip.enabled', - Value: 'false', - }, - ], - }); - }); - - test('Configure protocols for target group', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - protocol: elbv2.Protocol.UDP, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - Protocol: 'UDP', - }); - }); - - test('Target group defaults to TCP', () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - Protocol: 'TCP', - }); - }); - - test('Throws error for invalid health check interval', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - healthCheck: { - interval: cdk.Duration.seconds(3), - }, - }); - - expect(() => { - app.synth(); - }).toThrow(/Health check interval '3' not supported. Must be between 5 and 300./); - }); - - test('targetGroupName unallowed: more than 32 characters', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - targetGroupName: 'a'.repeat(33), - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Target group name: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" can have a maximum of 32 characters.'); - }); - - test('targetGroupName unallowed: starts with hyphen', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - targetGroupName: '-myTargetGroup', - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Target group name: "-myTargetGroup" must not begin or end with a hyphen.'); - }); - - test('targetGroupName unallowed: ends with hyphen', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - targetGroupName: 'myTargetGroup-', - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Target group name: "myTargetGroup-" must not begin or end with a hyphen.'); - }); - - test('targetGroupName unallowed: unallowed characters', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - const vpc = new ec2.Vpc(stack, 'Stack'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - targetGroupName: 'my target group', - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow('Target group name: "my target group" must contain only alphanumeric characters or hyphens.'); - }); - - test('Disable deregistration_delay.connection_termination.enabled attribute for target group', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - connectionTermination: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'deregistration_delay.connection_termination.enabled', - Value: 'false', - }, - ], - }); - }); - - test('Enable deregistration_delay.connection_termination.enabled attribute for target group', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - connectionTermination: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { - TargetGroupAttributes: [ - { - Key: 'deregistration_delay.connection_termination.enabled', - Value: 'true', - }, - ], - }); - }); - - test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( - 'Throws validation error, when `healthCheck` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - healthCheck: { - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS, TCP]`); - }); - - test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( - 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - }); - - // WHEN - tg.configureHealthCheck({ - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS, TCP]`); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS, elbv2.Protocol.TCP])( - 'Does not throw validation error, when `healthCheck` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - healthCheck: { - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS, elbv2.Protocol.TCP])( - 'Does not throw validation error, when `configureHealthCheck()` has `protocol` set to %s', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - }); - - // WHEN - tg.configureHealthCheck({ - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.TCP, elbv2.Protocol.HTTPS])( - 'Does not throw a validation error, when `healthCheck` has `protocol` set to %s and `interval` is equal to `timeout`', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - healthCheck: { - interval: cdk.Duration.seconds(10), - timeout: cdk.Duration.seconds(10), - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.TCP, elbv2.Protocol.HTTPS])( - 'Does not throw a validation error, when `configureHealthCheck()` has `protocol` set to %s and `interval` is equal to `timeout`', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - }); - - // WHEN - tg.configureHealthCheck({ - interval: cdk.Duration.seconds(10), - timeout: cdk.Duration.seconds(10), - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( - 'Throws validation error,`healthCheck` has `protocol` set to %s and `path` is provided', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - healthCheck: { - path: '/my-path', - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow(`'${protocol}' health checks do not support the path property. Must be one of [HTTP, HTTPS]`); - }); - - test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( - 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s and `path` is provided', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - }); - - // WHEN - tg.configureHealthCheck({ - path: '/my-path', - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).toThrow(`'${protocol}' health checks do not support the path property. Must be one of [HTTP, HTTPS]`); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Does not throw validation error, when `healthCheck` has `protocol` set to %s and `path` is provided', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - - // WHEN - new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - healthCheck: { - path: '/my-path', - protocol: protocol, - }, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( - 'Does not throw validation error, when `configureHealthCheck()` has `protocol` set to %s and `path` is provided', - (protocol) => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'VPC', {}); - const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { - vpc, - port: 80, - }); - - // WHEN - tg.configureHealthCheck({ - path: '/my-path', - protocol: protocol, - }); - - // THEN - expect(() => { - app.synth(); - }).not.toThrowError(); - }); - - test('Throws error for invalid health check healthy threshold', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - healthCheck: { - protocol: elbv2.Protocol.TCP, - healthyThresholdCount: 11, - }, - }); - - expect(() => { - app.synth(); - }).toThrow(/Healthy Threshold Count '11' not supported. Must be a number between 2 and 10./); - }); - - test('Throws error for invalid health check unhealthy threshold', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - healthCheck: { - protocol: elbv2.Protocol.TCP, - unhealthyThresholdCount: 1, - }, - }); - - expect(() => { - app.synth(); - }).toThrow(/Unhealthy Threshold Count '1' not supported. Must be a number between 2 and 10./); - }); - - test('Throws error for unequal healthy and unhealthy threshold counts', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - healthCheck: { - protocol: elbv2.Protocol.TCP, - healthyThresholdCount: 5, - unhealthyThresholdCount: 3, - }, - }); - - expect(() => { - app.synth(); - }).toThrow(/Healthy and Unhealthy Threshold Counts must be the same: 5 is not equal to 3./); - }); - - test('Exercise metrics', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); - const listener = new elbv2.NetworkListener(stack, 'Listener', { - loadBalancer: lb, - port: 80, - }); - const targetGroup = new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - }); - listener.addTargetGroups('unused', targetGroup); - - // WHEN - const metrics = new Array(); - metrics.push(targetGroup.metrics.healthyHostCount()); - metrics.push(targetGroup.metrics.unHealthyHostCount()); - - // THEN - - // Ideally, this would just be a GetAtt of the LB name, but the target group - // doesn't have a direct reference to the LB, and instead builds up the LB name - // from the listener ARN. - const splitListenerName = { 'Fn::Split': ['/', { Ref: 'Listener828B0E81' }] }; - const loadBalancerNameFromListener = { - 'Fn::Join': ['', - [ - { 'Fn::Select': [1, splitListenerName] }, - '/', - { 'Fn::Select': [2, splitListenerName] }, - '/', - { 'Fn::Select': [3, splitListenerName] }, - ]], - }; - - for (const metric of metrics) { - expect(metric.namespace).toEqual('AWS/NetworkELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: loadBalancerNameFromListener, - TargetGroup: { 'Fn::GetAtt': ['GroupC77FDACD', 'TargetGroupFullName'] }, - }); - } - }); - - test('Metrics requires a listener to be present', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Stack'); - const targetGroup = new elbv2.NetworkTargetGroup(stack, 'Group', { - vpc, - port: 80, - }); - - // THEN - expect(() => targetGroup.metrics.healthyHostCount()).toThrow(/The TargetGroup needs to be attached to a LoadBalancer/); - expect(() => targetGroup.metrics.unHealthyHostCount()).toThrow(/The TargetGroup needs to be attached to a LoadBalancer/); - }); - - test('imported targetGroup has targetGroupName', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const importedTg = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myNlbTargetGroup/73e2d6bc24d8a067', - }); - - // THEN - expect(importedTg.targetGroupName).toEqual('myNlbTargetGroup'); - }); - - test('imported targetGroup with imported ARN has targetGroupName', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const importedTgArn = cdk.Fn.importValue('ImportTargetGroupArn'); - const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: importedTgArn, - }); - new cdk.CfnOutput(stack, 'TargetGroupOutput', { - value: importedTg.targetGroupName, - }); - - // THEN - Template.fromStack(stack).hasOutput('TargetGroupOutput', { - Value: { - 'Fn::Select': [ - // myNlbTargetGroup - 1, - { - 'Fn::Split': [ - // [targetgroup, myNlbTargetGroup, 73e2d6bc24d8a067] - '/', - { - 'Fn::Select': [ - // targetgroup/myNlbTargetGroup/73e2d6bc24d8a067 - 5, - { - 'Fn::Split': [ - // [arn, aws, elasticloadbalancing, us-west-2, 123456789012, targetgroup/myNlbTargetGroup/73e2d6bc24d8a067] - ':', - { - // arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myNlbTargetGroup/73e2d6bc24d8a067 - 'Fn::ImportValue': 'ImportTargetGroupArn', - }, - ], - }, - ], - }, - ], - }, - ], - }, - }); - }); - - test('imported targetGroup has metrics', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const targetGroup = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', - loadBalancerArns: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/net/my-load-balancer/73e2d6bc24d8a067', - }); - - const metric = targetGroup.metrics.custom('MetricName'); - - // THEN - expect(metric.namespace).toEqual('AWS/NetworkELB'); - expect(stack.resolve(metric.dimensions)).toEqual({ - LoadBalancer: 'net/my-load-balancer/73e2d6bc24d8a067', - TargetGroup: 'targetgroup/my-target-group/50dc6c495c0c9188', - }); - }); - - test('imported targetGroup without load balancer cannot have metrics', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Stack'); - - // WHEN - const targetGroup = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { - targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', - }); - - expect(() => targetGroup.metrics.custom('MetricName')).toThrow(); - }); -}); diff --git a/packages/@aws-cdk/aws-elasticsearch/.eslintrc.js b/packages/@aws-cdk/aws-elasticsearch/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticsearch/.gitignore b/packages/@aws-cdk/aws-elasticsearch/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-elasticsearch/.npmignore b/packages/@aws-cdk/aws-elasticsearch/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-elasticsearch/LICENSE b/packages/@aws-cdk/aws-elasticsearch/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-elasticsearch/NOTICE b/packages/@aws-cdk/aws-elasticsearch/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-elasticsearch/README.md b/packages/@aws-cdk/aws-elasticsearch/README.md deleted file mode 100644 index 2a4f0b49c55b8..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/README.md +++ /dev/null @@ -1,451 +0,0 @@ -# Amazon OpenSearch Service Construct Library - - ---- - -![Deprecated](https://img.shields.io/badge/deprecated-critical.svg?style=for-the-badge) - -> This API may emit warnings. Backward compatibility is not guaranteed. - ---- - - - -> Instead of this module, we recommend using the [@aws-cdk/aws-opensearchservice](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-opensearchservice-readme.html) module. See [Amazon OpenSearch Service FAQs](https://aws.amazon.com/opensearch-service/faqs/#Name_change) for details. See [Migrating to OpenSearch](#migrating-to-opensearch) for migration instructions. - -## Quick start - -Create a development cluster by simply specifying the version: - -```ts -const devDomain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, -}); -``` - -To perform version upgrades without replacing the entire domain, specify the `enableVersionUpgrade` property. - -```ts -const devDomain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_10, - enableVersionUpgrade: true, // defaults to false -}); -``` - -Create a production grade cluster by also specifying things like capacity and az distribution - -```ts -const prodDomain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, - capacity: { - masterNodes: 5, - dataNodes: 20, - }, - ebs: { - volumeSize: 20, - }, - zoneAwareness: { - availabilityZoneCount: 3, - }, - logging: { - slowSearchLogEnabled: true, - appLogEnabled: true, - slowIndexLogEnabled: true, - }, -}); -``` - -This creates an Elasticsearch cluster and automatically sets up log groups for -logging the domain logs and slow search logs. - -## A note about SLR - -Some cluster configurations (e.g VPC access) require the existence of the [`AWSServiceRoleForAmazonElasticsearchService`](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/slr.html) service-linked role. - -When performing such operations via the AWS Console, this SLR is created automatically when needed. However, this is not the behavior when using CloudFormation. If an SLR is needed, but doesn't exist, you will encounter a failure message similar to: - -```console -Before you can proceed, you must enable a service-linked role to give Amazon ES... -``` - -To resolve this, you need to [create](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#create-service-linked-role) the SLR. We recommend using the AWS CLI: - -```console -aws iam create-service-linked-role --aws-service-name es.amazonaws.com -``` - -You can also create it using the CDK, **but note that only the first application deploying this will succeed**: - -```ts -const slr = new iam.CfnServiceLinkedRole(this, 'ElasticSLR', { - awsServiceName: 'es.amazonaws.com', -}); -``` - -## Importing existing domains - -To import an existing domain into your CDK application, use the `Domain.fromDomainEndpoint` factory method. -This method accepts a domain endpoint of an already existing domain: - -```ts -const domainEndpoint = 'https://my-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com'; -const domain = es.Domain.fromDomainEndpoint(this, 'ImportedDomain', domainEndpoint); -``` - -## Permissions - -### IAM - -Helper methods also exist for managing access to the domain. - -```ts -declare const fn: lambda.Function; -declare const domain: es.Domain; - -// Grant write access to the app-search index -domain.grantIndexWrite('app-search', fn); - -// Grant read access to the 'app-search/_search' path -domain.grantPathRead('app-search/_search', fn); -``` - -## Encryption - -The domain can also be created with encryption enabled: - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_4, - ebs: { - volumeSize: 100, - volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, - }, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, -}); -``` - -This sets up the domain with node to node encryption and encryption at -rest. You can also choose to supply your own KMS key to use for encryption at -rest. - -## VPC Support - -Elasticsearch domains can be placed inside a VPC, providing a secure communication between Amazon ES and other services within the VPC without the need for an internet gateway, NAT device, or VPN connection. - -> See [Launching your Amazon OpenSearch Service domains within a VPC](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html) for more details. - -```ts -const vpc = new ec2.Vpc(this, 'Vpc'); -const domainProps: es.DomainProps = { - version: es.ElasticsearchVersion.V7_1, - removalPolicy: RemovalPolicy.DESTROY, - vpc, - // must be enabled since our VPC contains multiple private subnets. - zoneAwareness: { - enabled: true, - }, - capacity: { - // must be an even number since the default az count is 2. - dataNodes: 2, - }, -}; -new es.Domain(this, 'Domain', domainProps); -``` - -In addition, you can use the `vpcSubnets` property to control which specific subnets will be used, and the `securityGroups` property to control -which security groups will be attached to the domain. By default, CDK will select all *private* subnets in the VPC, and create one dedicated security group. - -## Metrics - -Helper methods exist to access common domain metrics for example: - -```ts -declare const domain: es.Domain; -const freeStorageSpace = domain.metricFreeStorageSpace(); -const masterSysMemoryUtilization = domain.metric('MasterSysMemoryUtilization'); -``` - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Fine grained access control - -The domain can also be created with a master user configured. The password can -be supplied or dynamically created if not supplied. - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, - enforceHttps: true, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - fineGrainedAccessControl: { - masterUserName: 'master-user', - }, -}); - -const masterUserPassword = domain.masterUserPassword; -``` - -## Using unsigned basic auth - -For convenience, the domain can be configured to allow unsigned HTTP requests -that use basic auth. Unless the domain is configured to be part of a VPC this -means anyone can access the domain using the configured master username and -password. - -To enable unsigned basic auth access the domain is configured with an access -policy that allows anonymous requests, HTTPS required, node to node encryption, -encryption at rest and fine grained access control. - -If the above settings are not set they will be configured as part of enabling -unsigned basic auth. If they are set with conflicting values, an error will be -thrown. - -If no master user is configured a default master user is created with the -username `admin`. - -If no password is configured a default master user password is created and -stored in the AWS Secrets Manager as secret. The secret has the prefix -`MasterUser`. - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, - useUnsignedBasicAuth: true, -}); - -const masterUserPassword = domain.masterUserPassword; -``` - -## Custom access policies - -If the domain requires custom access control it can be configured either as a -constructor property, or later by means of a helper method. - -For simple permissions the `accessPolicies` constructor may be sufficient: - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, - accessPolicies: [ - new iam.PolicyStatement({ - actions: ['es:*ESHttpPost', 'es:ESHttpPut*'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('123456789012')], - resources: ['*'], - }), - ] -}); -``` - -For more complex use-cases, for example, to set the domain up to receive data from a -[cross-account Kinesis Firehose](https://aws.amazon.com/premiumsupport/knowledge-center/kinesis-firehose-cross-account-streaming/) the `addAccessPolicies` helper method -allows for policies that include the explicit domain ARN. - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, -}); - -domain.addAccessPolicies( - new iam.PolicyStatement({ - actions: ['es:ESHttpPost', 'es:ESHttpPut'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('123456789012')], - resources: [domain.domainArn, `${domain.domainArn}/*`], - }), - new iam.PolicyStatement({ - actions: ['es:ESHttpGet'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('123456789012')], - resources: [ - `${domain.domainArn}/_all/_settings`, - `${domain.domainArn}/_cluster/stats`, - `${domain.domainArn}/index-name*/_mapping/type-name`, - `${domain.domainArn}/roletest*/_mapping/roletest`, - `${domain.domainArn}/_nodes`, - `${domain.domainArn}/_nodes/stats`, - `${domain.domainArn}/_nodes/*/stats`, - `${domain.domainArn}/_stats`, - `${domain.domainArn}/index-name*/_stats`, - `${domain.domainArn}/roletest*/_stat`, - ], - }), -); -``` - -## Audit logs - -Audit logs can be enabled for a domain, but only when fine-grained access control is enabled. - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_1, - enforceHttps: true, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - fineGrainedAccessControl: { - masterUserName: 'master-user', - }, - logging: { - auditLogEnabled: true, - slowSearchLogEnabled: true, - appLogEnabled: true, - slowIndexLogEnabled: true, - }, -}); -``` - -## UltraWarm - -UltraWarm nodes can be enabled to provide a cost-effective way to store large amounts of read-only data. - -```ts -const domain = new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_10, - capacity: { - masterNodes: 2, - warmNodes: 2, - warmInstanceType: 'ultrawarm1.medium.elasticsearch', - }, -}); -``` - -## Custom endpoint - -Custom endpoints can be configured to reach the ES domain under a custom domain name. - -```ts -new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_7, - customEndpoint: { - domainName: 'search.example.com', - }, -}); -``` - -It is also possible to specify a custom certificate instead of the auto-generated one. - -Additionally, an automatic CNAME-Record is created if a hosted zone is provided for the custom endpoint - -## Advanced options - -[Advanced cluster settings](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options) can used to configure additional options. - -```ts -new es.Domain(this, 'Domain', { - version: es.ElasticsearchVersion.V7_7, - advancedOptions: { - 'rest.action.multi.allow_explicit_index': 'false', - 'indices.fielddata.cache.size': '25', - 'indices.query.bool.max_clause_count': '2048', - }, -}); -``` - -## Migrating to OpenSearch - -To migrate from this module (`@aws-cdk/aws-elasticsearch`) to the new `@aws-cdk/aws-opensearchservice` module, you must modify your CDK application to refer to the new module (including some associated changes) and then perform a CloudFormation resource deletion/import. - -### Necessary CDK Modifications - -Make the following modifications to your CDK application to migrate to the `@aws-cdk/aws-opensearchservice` module. - -- Rewrite module imports to use `'@aws-cdk/aws-opensearchservice` to `'@aws-cdk/aws-elasticsearch`. - For example: - - ```ts nofixture - import * as es from '@aws-cdk/aws-elasticsearch'; - import { Domain } from '@aws-cdk/aws-elasticsearch'; - ``` - - ...becomes... - - ```ts nofixture - import * as opensearch from '@aws-cdk/aws-opensearchservice'; - import { Domain } from '@aws-cdk/aws-opensearchservice'; - ``` - -- Replace instances of `es.ElasticsearchVersion` with `opensearch.EngineVersion`. - For example: - - ```ts fixture=migrate-opensearch - const version = es.ElasticsearchVersion.V7_1; - ``` - - ...becomes... - - ```ts fixture=migrate-opensearch - const version = opensearch.EngineVersion.ELASTICSEARCH_7_1; - ``` - -- Replace the `cognitoKibanaAuth` property of `DomainProps` with `cognitoDashboardsAuth`. - For example: - - ```ts fixture=migrate-opensearch - new es.Domain(this, 'Domain', { - cognitoKibanaAuth: { - identityPoolId: 'test-identity-pool-id', - userPoolId: 'test-user-pool-id', - role: role, - }, - version: elasticsearchVersion, - }); - ``` - - ...becomes... - - ```ts fixture=migrate-opensearch - new opensearch.Domain(this, 'Domain', { - cognitoDashboardsAuth: { - identityPoolId: 'test-identity-pool-id', - userPoolId: 'test-user-pool-id', - role: role, - }, - version: openSearchVersion, - }); - ``` - -- Rewrite instance type suffixes from `.elasticsearch` to `.search`. - For example: - - ```ts fixture=migrate-opensearch - new es.Domain(this, 'Domain', { - capacity: { - masterNodeInstanceType: 'r5.large.elasticsearch', - }, - version: elasticsearchVersion, - }); - ``` - - ...becomes... - - ```ts fixture=migrate-opensearch - new opensearch.Domain(this, 'Domain', { - capacity: { - masterNodeInstanceType: 'r5.large.search', - }, - version: openSearchVersion, - }); - ``` - -- Any `CfnInclude`'d domains will need to be re-written in their original template in - order to be successfully included as a `opensearch.CfnDomain` - -### CloudFormation Migration - -Follow these steps to migrate your application without data loss: - -- Ensure that the [removal policy](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.RemovalPolicy.html) on your domains are set to `RemovalPolicy.RETAIN`. This is the default for the domain construct, so nothing is required unless you have specifically set the removal policy to some other value. -- Remove the domain resource from your CloudFormation stacks by manually modifying the synthesized templates used to create the CloudFormation stacks. This may also involve modifying or deleting dependent resources, such as the custom resources that CDK creates to manage the domain's access policy or any other resource you have connected to the domain. You will need to search for references to each domain's logical ID to determine which other resources refer to it and replace or delete those references. Do not remove resources that are dependencies of the domain or you will have to recreate or import them before importing the domain. After modification, deploy the stacks through the AWS Management Console or using the AWS CLI. -- Migrate your CDK application to use the new `@aws-cdk/aws-opensearchservice` module by applying the necessary modifications listed above. Synthesize your application and obtain the resulting stack templates. -- Copy just the definition of the domain from the "migrated" templates to the corresponding "stripped" templates that you deployed above. [Import](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-existing-stack.html) the orphaned domains into your CloudFormation stacks using these templates. -- Synthesize and deploy your CDK application to reconfigure/recreate the modified dependent resources. The CloudFormation stacks should now contain the same resources as existed prior to migration. -- Proceed with development as normal! diff --git a/packages/@aws-cdk/aws-elasticsearch/jest.config.js b/packages/@aws-cdk/aws-elasticsearch/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-elasticsearch/lib/domain.ts b/packages/@aws-cdk/aws-elasticsearch/lib/domain.ts deleted file mode 100644 index d0dc1e12ae0ad..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/lib/domain.ts +++ /dev/null @@ -1,2049 +0,0 @@ -import { URL } from 'url'; - -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Metric, MetricOptions, Statistic } from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -import { ElasticsearchAccessPolicy } from './elasticsearch-access-policy'; -import { CfnDomain } from './elasticsearch.generated'; -import { LogGroupResourcePolicy } from './log-group-resource-policy'; -import * as perms from './perms'; - -/** - * Elasticsearch version - */ -export class ElasticsearchVersion { - /** - * AWS Elasticsearch 1.5 - */ - public static readonly V1_5 = ElasticsearchVersion.of('1.5'); - - /** - * AWS Elasticsearch 2.3 - */ - public static readonly V2_3 = ElasticsearchVersion.of('2.3'); - - /** - * AWS Elasticsearch 5.1 - */ - public static readonly V5_1 = ElasticsearchVersion.of('5.1'); - - /** - * AWS Elasticsearch 5.3 - */ - public static readonly V5_3 = ElasticsearchVersion.of('5.3'); - - /** - * AWS Elasticsearch 5.5 - */ - public static readonly V5_5 = ElasticsearchVersion.of('5.5'); - - /** - * AWS Elasticsearch 5.6 - */ - public static readonly V5_6 = ElasticsearchVersion.of('5.6'); - - /** - * AWS Elasticsearch 6.0 - */ - public static readonly V6_0 = ElasticsearchVersion.of('6.0'); - - /** - * AWS Elasticsearch 6.2 - */ - public static readonly V6_2 = ElasticsearchVersion.of('6.2'); - - /** - * AWS Elasticsearch 6.3 - */ - public static readonly V6_3 = ElasticsearchVersion.of('6.3'); - - /** - * AWS Elasticsearch 6.4 - */ - public static readonly V6_4 = ElasticsearchVersion.of('6.4'); - - /** - * AWS Elasticsearch 6.5 - */ - public static readonly V6_5 = ElasticsearchVersion.of('6.5'); - - /** - * AWS Elasticsearch 6.7 - */ - public static readonly V6_7 = ElasticsearchVersion.of('6.7'); - - /** - * AWS Elasticsearch 6.8 - */ - public static readonly V6_8 = ElasticsearchVersion.of('6.8'); - - /** - * AWS Elasticsearch 7.1 - */ - public static readonly V7_1 = ElasticsearchVersion.of('7.1'); - - /** - * AWS Elasticsearch 7.4 - */ - public static readonly V7_4 = ElasticsearchVersion.of('7.4'); - - /** - * AWS Elasticsearch 7.7 - */ - public static readonly V7_7 = ElasticsearchVersion.of('7.7'); - - /** - * AWS Elasticsearch 7.8 - */ - public static readonly V7_8 = ElasticsearchVersion.of('7.8'); - - /** - * AWS Elasticsearch 7.9 - */ - public static readonly V7_9 = ElasticsearchVersion.of('7.9'); - - /** - * AWS Elasticsearch 7.10 - */ - public static readonly V7_10 = ElasticsearchVersion.of('7.10'); - - /** - * Custom Elasticsearch version - * @param version custom version number - */ - public static of(version: string) { return new ElasticsearchVersion(version); } - - /** - * - * @param version Elasticsearch version number - */ - private constructor(public readonly version: string) { } -} - -/** - * Configures the capacity of the cluster such as the instance type and the - * number of instances. - * - * @deprecated use opensearchservice module instead - */ -export interface CapacityConfig { - /** - * The number of instances to use for the master node. - * - * @default - no dedicated master nodes - * @deprecated use opensearchservice module instead - */ - readonly masterNodes?: number; - - /** - * The hardware configuration of the computer that hosts the dedicated master - * node, such as `m3.medium.elasticsearch`. For valid values, see [Supported - * Instance Types] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-instance-types.html) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default - r5.large.elasticsearch - * @deprecated use opensearchservice module instead - */ - readonly masterNodeInstanceType?: string; - - /** - * The number of data nodes (instances) to use in the Amazon ES domain. - * - * @default - 1 - * @deprecated use opensearchservice module instead - */ - readonly dataNodes?: number; - - /** - * The instance type for your data nodes, such as - * `m3.medium.elasticsearch`. For valid values, see [Supported Instance - * Types](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-instance-types.html) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default - r5.large.elasticsearch - * @deprecated use opensearchservice module instead - */ - readonly dataNodeInstanceType?: string; - - /** - * The number of UltraWarm nodes (instances) to use in the Amazon ES domain. - * - * @default - no UltraWarm nodes - * @deprecated use opensearchservice module instead - */ - readonly warmNodes?: number; - - /** - * The instance type for your UltraWarm node, such as `ultrawarm1.medium.elasticsearch`. - * For valid values, see [UltraWarm Storage Limits] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-limits.html#limits-ultrawarm) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default - ultrawarm1.medium.elasticsearch - * @deprecated use opensearchservice module instead - */ - readonly warmInstanceType?: string; - -} - -/** - * Specifies zone awareness configuration options. - * - * @deprecated use opensearchservice module instead - */ -export interface ZoneAwarenessConfig { - /** - * Indicates whether to enable zone awareness for the Amazon ES domain. - * When you enable zone awareness, Amazon ES allocates the nodes and replica - * index shards that belong to a cluster across two Availability Zones (AZs) - * in the same region to prevent data loss and minimize downtime in the event - * of node or data center failure. Don't enable zone awareness if your cluster - * has no replica index shards or is a single-node cluster. For more information, - * see [Configuring a Multi-AZ Domain] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-managedomains-multiaz) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly enabled?: boolean; - - /** - * If you enabled multiple Availability Zones (AZs), the number of AZs that you - * want the domain to use. Valid values are 2 and 3. - * - * @default - 2 if zone awareness is enabled. - * @deprecated use opensearchservice module instead - */ - readonly availabilityZoneCount?: number; -} - -/** - * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that - * are attached to data nodes in the Amazon ES domain. For more information, see - * [Configuring EBS-based Storage] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @deprecated use opensearchservice module instead - */ -export interface EbsOptions { - /** - * Specifies whether Amazon EBS volumes are attached to data nodes in the - * Amazon ES domain. - * - * @default - true - * @deprecated use opensearchservice module instead - */ - readonly enabled?: boolean; - - /** - * The number of I/O operations per second (IOPS) that the volume - * supports. This property applies only to the Provisioned IOPS (SSD) EBS - * volume type. - * - * @default - iops are not set. - * @deprecated use opensearchservice module instead - */ - readonly iops?: number; - - /** - * The size (in GiB) of the EBS volume for each data node. The minimum and - * maximum size of an EBS volume depends on the EBS volume type and the - * instance type to which it is attached. For more information, see - * [Configuring EBS-based Storage] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default 10 - * @deprecated use opensearchservice module instead - */ - readonly volumeSize?: number; - - /** - * The EBS volume type to use with the Amazon ES domain, such as standard, gp2, io1. - * For more information, see[Configuring EBS-based Storage] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default gp2 - * @deprecated use opensearchservice module instead - */ - readonly volumeType?: ec2.EbsDeviceVolumeType; -} - -/** - * Configures log settings for the domain. - * - * @deprecated use opensearchservice module instead - */ -export interface LoggingOptions { - /** - * Specify if slow search logging should be set up. - * Requires Elasticsearch version 5.1 or later. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly slowSearchLogEnabled?: boolean; - - /** - * Log slow searches to this log group. - * - * @default - a new log group is created if slow search logging is enabled - * @deprecated use opensearchservice module instead - */ - readonly slowSearchLogGroup?: logs.ILogGroup; - - /** - * Specify if slow index logging should be set up. - * Requires Elasticsearch version 5.1 or later. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly slowIndexLogEnabled?: boolean; - - /** - * Log slow indices to this log group. - * - * @default - a new log group is created if slow index logging is enabled - * @deprecated use opensearchservice module instead - */ - readonly slowIndexLogGroup?: logs.ILogGroup; - - /** - * Specify if Elasticsearch application logging should be set up. - * Requires Elasticsearch version 5.1 or later. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly appLogEnabled?: boolean; - - /** - * Log Elasticsearch application logs to this log group. - * - * @default - a new log group is created if app logging is enabled - * @deprecated use opensearchservice module instead - */ - readonly appLogGroup?: logs.ILogGroup; - - /** - * Specify if Elasticsearch audit logging should be set up. - * Requires Elasticsearch version 6.7 or later and fine grained access control to be enabled. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly auditLogEnabled?: boolean; - - /** - * Log Elasticsearch audit logs to this log group. - * - * @default - a new log group is created if audit logging is enabled - * @deprecated use opensearchservice module instead - */ - readonly auditLogGroup?: logs.ILogGroup; -} - -/** - * Whether the domain should encrypt data at rest, and if so, the AWS Key - * Management Service (KMS) key to use. Can only be used to create a new domain, - * not update an existing one. Requires Elasticsearch version 5.1 or later. - * - * @deprecated use opensearchservice module instead - */ -export interface EncryptionAtRestOptions { - /** - * Specify true to enable encryption at rest. - * - * @default - encryption at rest is disabled. - * @deprecated use opensearchservice module instead - */ - readonly enabled?: boolean; - - /** - * Supply if using KMS key for encryption at rest. - * - * @default - uses default aws/es KMS key. - * @deprecated use opensearchservice module instead - */ - readonly kmsKey?: kms.IKey; -} - -/** - * Configures Amazon ES to use Amazon Cognito authentication for Kibana. - * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-cognito-auth.html - * @deprecated use opensearchservice module instead - */ -export interface CognitoOptions { - /** - * The Amazon Cognito identity pool ID that you want Amazon ES to use for Kibana authentication. - * - * @deprecated use opensearchservice module instead - */ - readonly identityPoolId: string; - - /** - * A role that allows Amazon ES to configure your user pool and identity pool. It must have the `AmazonESCognitoAccess` policy attached to it. - * - * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-cognito-auth.html#es-cognito-auth-prereq - * @deprecated use opensearchservice module instead - */ - readonly role: iam.IRole; - - /** - * The Amazon Cognito user pool ID that you want Amazon ES to use for Kibana authentication. - * - * @deprecated use opensearchservice module instead - */ - readonly userPoolId: string; -} - -/** - * The minimum TLS version required for traffic to the domain. - * - * @deprecated use opensearchservice module instead - */ -export enum TLSSecurityPolicy { - /** Cipher suite TLS 1.0 */ - TLS_1_0 = 'Policy-Min-TLS-1-0-2019-07', - /** Cipher suite TLS 1.2 */ - TLS_1_2 = 'Policy-Min-TLS-1-2-2019-07' -} - -/** - * Specifies options for fine-grained access control. - * - * @deprecated use opensearchservice module instead - */ -export interface AdvancedSecurityOptions { - /** - * ARN for the master user. Only specify this or masterUserName, but not both. - * - * @default - fine-grained access control is disabled - * @deprecated use opensearchservice module instead - */ - readonly masterUserArn?: string; - - /** - * Username for the master user. Only specify this or masterUserArn, but not both. - * - * @default - fine-grained access control is disabled - * @deprecated use opensearchservice module instead - */ - readonly masterUserName?: string; - - /** - * Password for the master user. - * - * You can use `SecretValue.unsafePlainText` to specify a password in plain text or - * use `secretsmanager.Secret.fromSecretAttributes` to reference a secret in - * Secrets Manager. - * - * @default - A Secrets Manager generated password - * @deprecated use opensearchservice module instead - */ - readonly masterUserPassword?: cdk.SecretValue; -} - -/** - * Configures a custom domain endpoint for the ES domain - * - * @deprecated use opensearchservice module instead - */ -export interface CustomEndpointOptions { - /** - * The custom domain name to assign - * - * @deprecated use opensearchservice module instead - */ - readonly domainName: string; - - /** - * The certificate to use - * @default - create a new one - * @deprecated use opensearchservice module instead - */ - readonly certificate?: acm.ICertificate; - - /** - * The hosted zone in Route53 to create the CNAME record in - * @default - do not create a CNAME - * @deprecated use opensearchservice module instead - */ - readonly hostedZone?: route53.IHostedZone; -} - -/** - * Properties for an AWS Elasticsearch Domain. - * - * @deprecated use opensearchservice module instead - */ -export interface DomainProps { - /** - * Domain Access policies. - * - * @default - No access policies. - * @deprecated use opensearchservice module instead - */ - readonly accessPolicies?: iam.PolicyStatement[]; - - /** - * Additional options to specify for the Amazon ES domain. - * - * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-advanced-options - * @default - no advanced options are specified - * @deprecated use opensearchservice module instead - */ - readonly advancedOptions?: { [key: string]: (string) }; - - /** - * Configures Amazon ES to use Amazon Cognito authentication for Kibana. - * - * @default - Cognito not used for authentication to Kibana. - * @deprecated use opensearchservice module instead - */ - readonly cognitoKibanaAuth?: CognitoOptions; - - /** - * Enforces a particular physical domain name. - * - * @default - A name will be auto-generated. - * @deprecated use opensearchservice module instead - */ - readonly domainName?: string; - - /** - * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that - * are attached to data nodes in the Amazon ES domain. For more information, see - * [Configuring EBS-based Storage] - * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) - * in the Amazon Elasticsearch Service Developer Guide. - * - * @default - 10 GiB General Purpose (SSD) volumes per node. - * @deprecated use opensearchservice module instead - */ - readonly ebs?: EbsOptions; - - /** - * The cluster capacity configuration for the Amazon ES domain. - * - * @default - 1 r5.large.elasticsearch data node; no dedicated master nodes. - * @deprecated use opensearchservice module instead - */ - readonly capacity?: CapacityConfig; - - /** - * The cluster zone awareness configuration for the Amazon ES domain. - * - * @default - no zone awareness (1 AZ) - * @deprecated use opensearchservice module instead - */ - readonly zoneAwareness?: ZoneAwarenessConfig; - - /** - * The Elasticsearch version that your domain will leverage. - * - * @deprecated use opensearchservice module instead - */ - readonly version: ElasticsearchVersion; - - /** - * Encryption at rest options for the cluster. - * - * @default - No encryption at rest - * @deprecated use opensearchservice module instead - */ - readonly encryptionAtRest?: EncryptionAtRestOptions; - - /** - * Configuration log publishing configuration options. - * - * @default - No logs are published - * @deprecated use opensearchservice module instead - */ - readonly logging?: LoggingOptions; - - /** - * Specify true to enable node to node encryption. - * Requires Elasticsearch version 6.0 or later. - * - * @default - Node to node encryption is not enabled. - * @deprecated use opensearchservice module instead - */ - readonly nodeToNodeEncryption?: boolean; - - /** - * The hour in UTC during which the service takes an automated daily snapshot - * of the indices in the Amazon ES domain. Only applies for Elasticsearch - * versions below 5.3. - * - * @default - Hourly automated snapshots not used - * @deprecated use opensearchservice module instead - */ - readonly automatedSnapshotStartHour?: number; - - /** - * Place the domain inside this VPC. - * - * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html - * @default - Domain is not placed in a VPC. - * @deprecated use opensearchservice module instead - */ - readonly vpc?: ec2.IVpc; - - /** - * The list of security groups that are associated with the VPC endpoints - * for the domain. - * - * Only used if `vpc` is specified. - * - * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html - * @default - One new security group is created. - * @deprecated use opensearchservice module instead - */ - readonly securityGroups?: ec2.ISecurityGroup[]; - - /** - * The specific vpc subnets the domain will be placed in. You must provide one subnet for each Availability Zone - * that your domain uses. For example, you must specify three subnet IDs for a three Availability Zone - * domain. - * - * Only used if `vpc` is specified. - * - * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html - * @default - All private subnets. - * @deprecated use opensearchservice module instead - */ - readonly vpcSubnets?: ec2.SubnetSelection[]; - - /** - * True to require that all traffic to the domain arrive over HTTPS. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly enforceHttps?: boolean; - - /** - * The minimum TLS version required for traffic to the domain. - * - * @default - TLSSecurityPolicy.TLS_1_0 - * @deprecated use opensearchservice module instead - */ - readonly tlsSecurityPolicy?: TLSSecurityPolicy; - - /** - * Specifies options for fine-grained access control. - * Requires Elasticsearch version 6.7 or later. Enabling fine-grained access control - * also requires encryption of data at rest and node-to-node encryption, along with - * enforced HTTPS. - * - * @default - fine-grained access control is disabled - * @deprecated use opensearchservice module instead - */ - readonly fineGrainedAccessControl?: AdvancedSecurityOptions; - - /** - * Configures the domain so that unsigned basic auth is enabled. If no master user is provided a default master user - * with username `admin` and a dynamically generated password stored in KMS is created. The password can be retrieved - * by getting `masterUserPassword` from the domain instance. - * - * Setting this to true will also add an access policy that allows unsigned - * access, enable node to node encryption, encryption at rest. If conflicting - * settings are encountered (like disabling encryption at rest) enabling this - * setting will cause a failure. - * - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly useUnsignedBasicAuth?: boolean; - - /** - * To upgrade an Amazon ES domain to a new version of Elasticsearch rather than replacing the entire - * domain resource, use the EnableVersionUpgrade update policy. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-upgradeelasticsearchdomain - * @default - false - * @deprecated use opensearchservice module instead - */ - readonly enableVersionUpgrade?: boolean; - - /** - * Policy to apply when the domain is removed from the stack - * - * @default RemovalPolicy.RETAIN - * @deprecated use opensearchservice module instead - */ - readonly removalPolicy?: cdk.RemovalPolicy; - - /** - * To configure a custom domain configure these options - * - * If you specify a Route53 hosted zone it will create a CNAME record and use DNS validation for the certificate - * @default - no custom domain endpoint will be configured - * @deprecated use opensearchservice module instead - */ - readonly customEndpoint?: CustomEndpointOptions; -} - -/** - * An interface that represents an Elasticsearch domain - either created with the CDK, or an existing one. - * - * @deprecated use opensearchservice module instead - */ -export interface IDomain extends cdk.IResource { - /** - * Arn of the Elasticsearch domain. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - readonly domainArn: string; - - /** - * Domain name of the Elasticsearch domain. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - readonly domainName: string; - - /** - * Endpoint of the Elasticsearch domain. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - readonly domainEndpoint: string; - - /** - * Grant read permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantRead(identity: iam.IGrantable): iam.Grant; - - /** - * Grant write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantWrite(identity: iam.IGrantable): iam.Grant; - - /** - * Grant read/write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantReadWrite(identity: iam.IGrantable): iam.Grant; - - /** - * Grant read permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant read/write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant read permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantPathRead(path: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant read/write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant; - - /** - * Return the given named metric for this Domain. - * - * @deprecated use opensearchservice module instead - */ - metric(metricName: string, props?: MetricOptions): Metric; - - /** - * Metric for the time the cluster status is red. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricClusterStatusRed(props?: MetricOptions): Metric; - - /** - * Metric for the time the cluster status is yellow. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricClusterStatusYellow(props?: MetricOptions): Metric; - - /** - * Metric for the storage space of nodes in the cluster. - * - * @default minimum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricFreeStorageSpace(props?: MetricOptions): Metric; - - /** - * Metric for the cluster blocking index writes. - * - * @default maximum over 1 minute - * @deprecated use opensearchservice module instead - */ - metricClusterIndexWritesBlocked(props?: MetricOptions): Metric; - - /** - * Metric for the number of nodes. - * - * @default minimum over 1 hour - * @deprecated use opensearchservice module instead - */ - metricNodes(props?: MetricOptions): Metric; - - /** - * Metric for automated snapshot failures. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricAutomatedSnapshotFailure(props?: MetricOptions): Metric; - - /** - * Metric for CPU utilization. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricCPUUtilization(props?: MetricOptions): Metric; - - /** - * Metric for JVM memory pressure. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricJVMMemoryPressure(props?: MetricOptions): Metric; - - /** - * Metric for master CPU utilization. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricMasterCPUUtilization(props?: MetricOptions): Metric; - - /** - * Metric for master JVM memory pressure. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricMasterJVMMemoryPressure(props?: MetricOptions): Metric; - - /** - * Metric for KMS key errors. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricKMSKeyError(props?: MetricOptions): Metric; - - /** - * Metric for KMS key being inaccessible. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricKMSKeyInaccessible(props?: MetricOptions): Metric; - - /** - * Metric for number of searchable documents. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricSearchableDocuments(props?: MetricOptions): Metric; - - /** - * Metric for search latency. - * - * @default p99 over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricSearchLatency(props?: MetricOptions): Metric; - - /** - * Metric for indexing latency. - * - * @default p99 over 5 minutes - * @deprecated use opensearchservice module instead - */ - metricIndexingLatency(props?: MetricOptions): Metric; -} - - -/** - * A new or imported domain. - */ -abstract class DomainBase extends cdk.Resource implements IDomain { - public abstract readonly domainArn: string; - public abstract readonly domainName: string; - public abstract readonly domainEndpoint: string; - - /** - * Grant read permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantRead(identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_ACTIONS, - this.domainArn, - `${this.domainArn}/*`, - ); - } - - /** - * Grant write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantWrite(identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_WRITE_ACTIONS, - this.domainArn, - `${this.domainArn}/*`, - ); - } - - /** - * Grant read/write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantReadWrite(identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_WRITE_ACTIONS, - this.domainArn, - `${this.domainArn}/*`, - ); - } - - /** - * Grant read permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_ACTIONS, - `${this.domainArn}/${index}`, - `${this.domainArn}/${index}/*`, - ); - } - - /** - * Grant write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_WRITE_ACTIONS, - `${this.domainArn}/${index}`, - `${this.domainArn}/${index}/*`, - ); - } - - /** - * Grant read/write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_WRITE_ACTIONS, - `${this.domainArn}/${index}`, - `${this.domainArn}/${index}/*`, - ); - } - - /** - * Grant read permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantPathRead(path: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_ACTIONS, - `${this.domainArn}/${path}`, - ); - } - - /** - * Grant write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_WRITE_ACTIONS, - `${this.domainArn}/${path}`, - ); - } - - /** - * Grant read/write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - * @deprecated use opensearchservice module instead - */ - grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_WRITE_ACTIONS, - `${this.domainArn}/${path}`, - ); - } - - /** - * Return the given named metric for this Domain. - * - * @deprecated use opensearchservice module instead - */ - public metric(metricName: string, props?: MetricOptions): Metric { - return new Metric({ - namespace: 'AWS/ES', - metricName, - dimensionsMap: { - DomainName: this.domainName, - ClientId: this.env.account, - }, - ...props, - }).attachTo(this); - } - - /** - * Metric for the time the cluster status is red. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricClusterStatusRed(props?: MetricOptions): Metric { - return this.metric('ClusterStatus.red', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for the time the cluster status is yellow. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricClusterStatusYellow(props?: MetricOptions): Metric { - return this.metric('ClusterStatus.yellow', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for the storage space of nodes in the cluster. - * - * @default minimum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricFreeStorageSpace(props?: MetricOptions): Metric { - return this.metric('FreeStorageSpace', { - statistic: Statistic.MINIMUM, - ...props, - }); - } - - /** - * Metric for the cluster blocking index writes. - * - * @default maximum over 1 minute - * @deprecated use opensearchservice module instead - */ - public metricClusterIndexWritesBlocked(props?: MetricOptions): Metric { - return this.metric('ClusterIndexWritesBlocked', { - statistic: Statistic.MAXIMUM, - period: cdk.Duration.minutes(1), - ...props, - }); - } - - /** - * Metric for the number of nodes. - * - * @default minimum over 1 hour - * @deprecated use opensearchservice module instead - */ - public metricNodes(props?: MetricOptions): Metric { - return this.metric('Nodes', { - statistic: Statistic.MINIMUM, - period: cdk.Duration.hours(1), - ...props, - }); - } - - /** - * Metric for automated snapshot failures. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricAutomatedSnapshotFailure(props?: MetricOptions): Metric { - return this.metric('AutomatedSnapshotFailure', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for CPU utilization. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricCPUUtilization(props?: MetricOptions): Metric { - return this.metric('CPUUtilization', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for JVM memory pressure. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricJVMMemoryPressure(props?: MetricOptions): Metric { - return this.metric('JVMMemoryPressure', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for master CPU utilization. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricMasterCPUUtilization(props?: MetricOptions): Metric { - return this.metric('MasterCPUUtilization', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for master JVM memory pressure. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricMasterJVMMemoryPressure(props?: MetricOptions): Metric { - return this.metric('MasterJVMMemoryPressure', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for KMS key errors. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricKMSKeyError(props?: MetricOptions): Metric { - return this.metric('KMSKeyError', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for KMS key being inaccessible. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricKMSKeyInaccessible(props?: MetricOptions): Metric { - return this.metric('KMSKeyInaccessible', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for number of searchable documents. - * - * @default maximum over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricSearchableDocuments(props?: MetricOptions): Metric { - return this.metric('SearchableDocuments', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for search latency. - * - * @default p99 over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricSearchLatency(props?: MetricOptions): Metric { - return this.metric('SearchLatency', { statistic: 'p99', ...props }); - } - - /** - * Metric for indexing latency. - * - * @default p99 over 5 minutes - * @deprecated use opensearchservice module instead - */ - public metricIndexingLatency(props?: MetricOptions): Metric { - return this.metric('IndexingLatency', { statistic: 'p99', ...props }); - } - - private grant( - grantee: iam.IGrantable, - domainActions: string[], - resourceArn: string, - ...otherResourceArns: string[] - ): iam.Grant { - const resourceArns = [resourceArn, ...otherResourceArns]; - - const grant = iam.Grant.addToPrincipal({ - grantee, - actions: domainActions, - resourceArns, - scope: this, - }); - - return grant; - } - -} - - -/** - * Reference to an Elasticsearch domain. - * - * @deprecated use opensearchservice module instead - */ -export interface DomainAttributes { - /** - * The ARN of the Elasticsearch domain. - * - * @deprecated use opensearchservice module instead - */ - readonly domainArn: string; - - /** - * The domain endpoint of the Elasticsearch domain. - * - * @deprecated use opensearchservice module instead - */ - readonly domainEndpoint: string; -} - - -/** - * Provides an Elasticsearch domain. - * - * @deprecated use opensearchservice module instead - */ -export class Domain extends DomainBase implements IDomain, ec2.IConnectable { - /** - * Creates a Domain construct that represents an external domain via domain endpoint. - * - * @param scope The parent creating construct (usually `this`). - * @param id The construct's name. - * @param domainEndpoint The domain's endpoint. - * @deprecated use opensearchservice module instead - */ - public static fromDomainEndpoint( - scope: Construct, - id: string, - domainEndpoint: string, - ): IDomain { - const stack = cdk.Stack.of(scope); - const domainName = extractNameFromEndpoint(domainEndpoint); - const domainArn = stack.formatArn({ - service: 'es', - resource: 'domain', - resourceName: domainName, - }); - - return Domain.fromDomainAttributes(scope, id, { - domainArn, - domainEndpoint, - }); - } - - /** - * Creates a Domain construct that represents an external domain. - * - * @param scope The parent creating construct (usually `this`). - * @param id The construct's name. - * @param attrs A `DomainAttributes` object. - * @deprecated use opensearchservice module instead - */ - public static fromDomainAttributes(scope: Construct, id: string, attrs: DomainAttributes): IDomain { - const { domainArn, domainEndpoint } = attrs; - const domainName = cdk.Stack.of(scope).splitArn(domainArn, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName - ?? extractNameFromEndpoint(domainEndpoint); - - return new class extends DomainBase { - public readonly domainArn = domainArn; - public readonly domainName = domainName; - public readonly domainEndpoint = domainEndpoint.replace(/^https?:\/\//, ''); - - constructor() { super(scope, id); } - }; - } - - /** - * @deprecated use opensearchservice module instead - */ - public readonly domainArn: string; - - /** - * @deprecated use opensearchservice module instead - */ - public readonly domainName: string; - - /** - * @deprecated use opensearchservice module instead - */ - public readonly domainEndpoint: string; - - /** - * Log group that slow searches are logged to. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - public readonly slowSearchLogGroup?: logs.ILogGroup; - - /** - * Log group that slow indices are logged to. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - public readonly slowIndexLogGroup?: logs.ILogGroup; - - /** - * Log group that application logs are logged to. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - public readonly appLogGroup?: logs.ILogGroup; - - /** - * Log group that audit logs are logged to. - * - * @attribute - * @deprecated use opensearchservice module instead - */ - public readonly auditLogGroup?: logs.ILogGroup; - - /** - * Master user password if fine grained access control is configured. - * - * @deprecated use opensearchservice module instead - */ - public readonly masterUserPassword?: cdk.SecretValue; - - - private readonly domain: CfnDomain; - - private accessPolicy?: ElasticsearchAccessPolicy - private encryptionAtRestOptions?: EncryptionAtRestOptions - - private readonly _connections: ec2.Connections | undefined; - - constructor(scope: Construct, id: string, props: DomainProps) { - super(scope, id, { - physicalName: props.domainName, - }); - - const defaultInstanceType = 'r5.large.elasticsearch'; - const warmDefaultInstanceType = 'ultrawarm1.medium.elasticsearch'; - - const dedicatedMasterType = initializeInstanceType(defaultInstanceType, props.capacity?.masterNodeInstanceType); - const dedicatedMasterCount = props.capacity?.masterNodes ?? 0; - const dedicatedMasterEnabled = cdk.Token.isUnresolved(dedicatedMasterCount) ? true : dedicatedMasterCount > 0; - - const instanceType = initializeInstanceType(defaultInstanceType, props.capacity?.dataNodeInstanceType); - const instanceCount = props.capacity?.dataNodes ?? 1; - - const warmType = initializeInstanceType(warmDefaultInstanceType, props.capacity?.warmInstanceType); - const warmCount = props.capacity?.warmNodes ?? 0; - const warmEnabled = cdk.Token.isUnresolved(warmCount) ? true : warmCount > 0; - - const availabilityZoneCount = - props.zoneAwareness?.availabilityZoneCount ?? 2; - - if (![2, 3].includes(availabilityZoneCount)) { - throw new Error('Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3'); - } - - const zoneAwarenessEnabled = - props.zoneAwareness?.enabled ?? - props.zoneAwareness?.availabilityZoneCount != null; - - - let securityGroups: ec2.ISecurityGroup[] | undefined; - let subnets: ec2.ISubnet[] | undefined; - - if (props.vpc) { - subnets = selectSubnets(props.vpc, props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]); - securityGroups = props.securityGroups ?? [new ec2.SecurityGroup(this, 'SecurityGroup', { - vpc: props.vpc, - description: `Security group for domain ${this.node.id}`, - })]; - this._connections = new ec2.Connections({ securityGroups }); - } - - // If VPC options are supplied ensure that the number of subnets matches the number AZ - if (subnets && zoneAwarenessEnabled && new Set(subnets.map((subnet) => subnet.availabilityZone)).size < availabilityZoneCount) { - throw new Error('When providing vpc options you need to provide a subnet for each AZ you are using'); - } - - if ([dedicatedMasterType, instanceType, warmType].some(t => (!cdk.Token.isUnresolved(t) && !t.endsWith('.elasticsearch')))) { - throw new Error('Master, data and UltraWarm node instance types must end with ".elasticsearch".'); - } - - if (!cdk.Token.isUnresolved(warmType) && !warmType.startsWith('ultrawarm')) { - throw new Error('UltraWarm node instance type must start with "ultrawarm".'); - } - - const elasticsearchVersion = props.version.version; - const elasticsearchVersionNum = parseVersion(props.version); - - if ( - elasticsearchVersionNum <= 7.7 && - ![ - 1.5, 2.3, 5.1, 5.3, 5.5, 5.6, 6.0, - 6.2, 6.3, 6.4, 6.5, 6.7, 6.8, 7.1, 7.4, - 7.7, - ].includes(elasticsearchVersionNum) - ) { - throw new Error(`Unknown Elasticsearch version: ${elasticsearchVersion}`); - } - - const unsignedBasicAuthEnabled = props.useUnsignedBasicAuth ?? false; - - if (unsignedBasicAuthEnabled) { - if (props.enforceHttps == false) { - throw new Error('You cannot disable HTTPS and use unsigned basic auth'); - } - if (props.nodeToNodeEncryption == false) { - throw new Error('You cannot disable node to node encryption and use unsigned basic auth'); - } - if (props.encryptionAtRest?.enabled == false) { - throw new Error('You cannot disable encryption at rest and use unsigned basic auth'); - } - } - - const unsignedAccessPolicy = new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['es:ESHttp*'], - principals: [new iam.AnyPrincipal()], - resources: [cdk.Lazy.string({ produce: () => `${this.domainArn}/*` })], - }); - - const masterUserArn = props.fineGrainedAccessControl?.masterUserArn; - const masterUserNameProps = props.fineGrainedAccessControl?.masterUserName; - // If basic auth is enabled set the user name to admin if no other user info is supplied. - const masterUserName = unsignedBasicAuthEnabled - ? (masterUserArn == null ? (masterUserNameProps ?? 'admin') : undefined) - : masterUserNameProps; - - if (masterUserArn != null && masterUserName != null) { - throw new Error('Invalid fine grained access control settings. Only provide one of master user ARN or master user name. Not both.'); - } - - const advancedSecurityEnabled = (masterUserArn ?? masterUserName) != null; - const internalUserDatabaseEnabled = masterUserName != null; - const masterUserPasswordProp = props.fineGrainedAccessControl?.masterUserPassword; - const createMasterUserPassword = (): cdk.SecretValue => { - return new secretsmanager.Secret(this, 'MasterUser', { - generateSecretString: { - secretStringTemplate: JSON.stringify({ - username: masterUserName, - }), - generateStringKey: 'password', - excludeCharacters: "{}'\\*[]()`", - }, - }) - .secretValueFromJson('password'); - }; - this.masterUserPassword = internalUserDatabaseEnabled ? - (masterUserPasswordProp ?? createMasterUserPassword()) - : undefined; - - const encryptionAtRestEnabled = - props.encryptionAtRest?.enabled ?? (props.encryptionAtRest?.kmsKey != null || unsignedBasicAuthEnabled); - const nodeToNodeEncryptionEnabled = props.nodeToNodeEncryption ?? unsignedBasicAuthEnabled; - const volumeSize = props.ebs?.volumeSize ?? 10; - const volumeType = props.ebs?.volumeType ?? ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD; - const ebsEnabled = props.ebs?.enabled ?? true; - const enforceHttps = props.enforceHttps ?? unsignedBasicAuthEnabled; - - function isInstanceType(t: string): Boolean { - return dedicatedMasterType.startsWith(t) || instanceType.startsWith(t); - }; - - function isSomeInstanceType(...instanceTypes: string[]): Boolean { - return instanceTypes.some(isInstanceType); - }; - - function isEveryDatanodeInstanceType(...instanceTypes: string[]): Boolean { - return instanceTypes.some(t => instanceType.startsWith(t)); - }; - - // Validate feature support for the given Elasticsearch version, per - // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-features-by-version.html - if (elasticsearchVersionNum < 5.1) { - if (props.logging?.appLogEnabled) { - throw new Error('Error logs publishing requires Elasticsearch version 5.1 or later.'); - } - if (props.encryptionAtRest?.enabled) { - throw new Error('Encryption of data at rest requires Elasticsearch version 5.1 or later.'); - } - if (props.cognitoKibanaAuth != null) { - throw new Error('Cognito authentication for Kibana requires Elasticsearch version 5.1 or later.'); - } - if (isSomeInstanceType('c5', 'i3', 'm5', 'r5')) { - throw new Error('C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later.'); - } - } - - if (elasticsearchVersionNum < 6.0) { - if (props.nodeToNodeEncryption) { - throw new Error('Node-to-node encryption requires Elasticsearch version 6.0 or later.'); - } - } - - if (elasticsearchVersionNum < 6.7) { - if (unsignedBasicAuthEnabled) { - throw new Error('Using unsigned basic auth requires Elasticsearch version 6.7 or later.'); - } - if (advancedSecurityEnabled) { - throw new Error('Fine-grained access control requires Elasticsearch version 6.7 or later.'); - } - } - - if (elasticsearchVersionNum < 6.8 && warmEnabled) { - throw new Error('UltraWarm requires Elasticsearch 6.8 or later.'); - } - - // Validate against instance type restrictions, per - // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-instance-types.html - if (isSomeInstanceType('i3', 'r6gd') && ebsEnabled) { - throw new Error('I3 and R6GD instance types do not support EBS storage volumes.'); - } - - if (isSomeInstanceType('m3', 'r3', 't2') && encryptionAtRestEnabled) { - throw new Error('M3, R3, and T2 instance types do not support encryption of data at rest.'); - } - - if (isInstanceType('t2.micro') && elasticsearchVersionNum > 2.3) { - throw new Error('The t2.micro.elasticsearch instance type supports only Elasticsearch 1.5 and 2.3.'); - } - - if (isSomeInstanceType('t2', 't3') && warmEnabled) { - throw new Error('T2 and T3 instance types do not support UltraWarm storage.'); - } - - // Only R3, I3 and r6gd support instance storage, per - // https://aws.amazon.com/elasticsearch-service/pricing/ - if (!ebsEnabled && !isEveryDatanodeInstanceType('r3', 'i3', 'r6gd')) { - throw new Error('EBS volumes are required when using instance types other than r3, i3 or r6gd.'); - } - - // Fine-grained access control requires node-to-node encryption, encryption at rest, - // and enforced HTTPS. - if (advancedSecurityEnabled) { - if (!nodeToNodeEncryptionEnabled) { - throw new Error('Node-to-node encryption is required when fine-grained access control is enabled.'); - } - if (!encryptionAtRestEnabled) { - throw new Error('Encryption-at-rest is required when fine-grained access control is enabled.'); - } - if (!enforceHttps) { - throw new Error('Enforce HTTPS is required when fine-grained access control is enabled.'); - } - } - - // Validate fine grained access control enabled for audit logs, per - // https://aws.amazon.com/about-aws/whats-new/2020/09/elasticsearch-audit-logs-now-available-on-amazon-elasticsearch-service/ - if (props.logging?.auditLogEnabled && !advancedSecurityEnabled) { - throw new Error('Fine-grained access control is required when audit logs publishing is enabled.'); - } - - // Validate UltraWarm requirement for dedicated master nodes, per - // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/ultrawarm.html - if (warmEnabled && !dedicatedMasterEnabled) { - throw new Error('Dedicated master node is required when UltraWarm storage is enabled.'); - } - - let cfnVpcOptions: CfnDomain.VPCOptionsProperty | undefined; - - if (securityGroups && subnets) { - cfnVpcOptions = { - securityGroupIds: securityGroups.map((sg) => sg.securityGroupId), - subnetIds: subnets.map((subnet) => subnet.subnetId), - }; - } - - // Setup logging - const logGroups: logs.ILogGroup[] = []; - - if (props.logging?.slowSearchLogEnabled) { - this.slowSearchLogGroup = props.logging.slowSearchLogGroup ?? - new logs.LogGroup(this, 'SlowSearchLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.slowSearchLogGroup); - }; - - if (props.logging?.slowIndexLogEnabled) { - this.slowIndexLogGroup = props.logging.slowIndexLogGroup ?? - new logs.LogGroup(this, 'SlowIndexLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.slowIndexLogGroup); - }; - - if (props.logging?.appLogEnabled) { - this.appLogGroup = props.logging.appLogGroup ?? - new logs.LogGroup(this, 'AppLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.appLogGroup); - }; - - if (props.logging?.auditLogEnabled) { - this.auditLogGroup = props.logging.auditLogGroup ?? - new logs.LogGroup(this, 'AuditLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.auditLogGroup); - }; - - let logGroupResourcePolicy: LogGroupResourcePolicy | null = null; - if (logGroups.length > 0) { - const logPolicyStatement = new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], - resources: logGroups.map((lg) => lg.logGroupArn), - principals: [new iam.ServicePrincipal('es.amazonaws.com')], - }); - - // Use a custom resource to set the log group resource policy since it is not supported by CDK and cfn. - // https://github.com/aws/aws-cdk/issues/5343 - logGroupResourcePolicy = new LogGroupResourcePolicy(this, `ESLogGroupPolicy${this.node.addr}`, { - // create a cloudwatch logs resource policy name that is unique to this domain instance - policyName: `ESLogPolicy${this.node.addr}`, - policyStatements: [logPolicyStatement], - }); - } - - const logPublishing: Record = {}; - - if (this.appLogGroup) { - logPublishing.ES_APPLICATION_LOGS = { - enabled: true, - cloudWatchLogsLogGroupArn: this.appLogGroup.logGroupArn, - }; - } - - if (this.slowSearchLogGroup) { - logPublishing.SEARCH_SLOW_LOGS = { - enabled: true, - cloudWatchLogsLogGroupArn: this.slowSearchLogGroup.logGroupArn, - }; - } - - if (this.slowIndexLogGroup) { - logPublishing.INDEX_SLOW_LOGS = { - enabled: true, - cloudWatchLogsLogGroupArn: this.slowIndexLogGroup.logGroupArn, - }; - } - - if (this.auditLogGroup) { - logPublishing.AUDIT_LOGS = { - enabled: this.auditLogGroup != null, - cloudWatchLogsLogGroupArn: this.auditLogGroup?.logGroupArn, - }; - } - - let customEndpointCertificate: acm.ICertificate | undefined; - if (props.customEndpoint) { - if (props.customEndpoint.certificate) { - customEndpointCertificate = props.customEndpoint.certificate; - } else { - customEndpointCertificate = new acm.Certificate(this, 'CustomEndpointCertificate', { - domainName: props.customEndpoint.domainName, - validation: props.customEndpoint.hostedZone ? acm.CertificateValidation.fromDns(props.customEndpoint.hostedZone) : undefined, - }); - } - } - - // Create the domain - this.domain = new CfnDomain(this, 'Resource', { - domainName: this.physicalName, - elasticsearchVersion, - elasticsearchClusterConfig: { - dedicatedMasterEnabled, - dedicatedMasterCount: dedicatedMasterEnabled - ? dedicatedMasterCount - : undefined, - dedicatedMasterType: dedicatedMasterEnabled - ? dedicatedMasterType - : undefined, - instanceCount, - instanceType, - warmEnabled: warmEnabled - ? warmEnabled - : undefined, - warmCount: warmEnabled - ? warmCount - : undefined, - warmType: warmEnabled - ? warmType - : undefined, - zoneAwarenessEnabled, - zoneAwarenessConfig: zoneAwarenessEnabled - ? { availabilityZoneCount } - : undefined, - }, - ebsOptions: { - ebsEnabled, - volumeSize: ebsEnabled ? volumeSize : undefined, - volumeType: ebsEnabled ? volumeType : undefined, - iops: ebsEnabled ? props.ebs?.iops : undefined, - }, - encryptionAtRestOptions: { - enabled: encryptionAtRestEnabled, - kmsKeyId: encryptionAtRestEnabled - ? props.encryptionAtRest?.kmsKey?.keyId - : undefined, - }, - nodeToNodeEncryptionOptions: { enabled: nodeToNodeEncryptionEnabled }, - logPublishingOptions: logPublishing, - cognitoOptions: { - enabled: props.cognitoKibanaAuth != null, - identityPoolId: props.cognitoKibanaAuth?.identityPoolId, - roleArn: props.cognitoKibanaAuth?.role.roleArn, - userPoolId: props.cognitoKibanaAuth?.userPoolId, - }, - vpcOptions: cfnVpcOptions, - snapshotOptions: props.automatedSnapshotStartHour - ? { automatedSnapshotStartHour: props.automatedSnapshotStartHour } - : undefined, - domainEndpointOptions: { - enforceHttps, - tlsSecurityPolicy: props.tlsSecurityPolicy ?? TLSSecurityPolicy.TLS_1_0, - ...props.customEndpoint && { - customEndpointEnabled: true, - customEndpoint: props.customEndpoint.domainName, - customEndpointCertificateArn: customEndpointCertificate!.certificateArn, - }, - }, - advancedSecurityOptions: advancedSecurityEnabled - ? { - enabled: true, - internalUserDatabaseEnabled, - masterUserOptions: { - masterUserArn: masterUserArn, - masterUserName: masterUserName, - masterUserPassword: this.masterUserPassword?.unsafeUnwrap(), // Safe usage - }, - } - : undefined, - advancedOptions: props.advancedOptions, - }); - this.domain.applyRemovalPolicy(props.removalPolicy); - - if (props.enableVersionUpgrade) { - this.domain.cfnOptions.updatePolicy = { - ...this.domain.cfnOptions.updatePolicy, - enableVersionUpgrade: props.enableVersionUpgrade, - }; - } - - if (logGroupResourcePolicy) { this.domain.node.addDependency(logGroupResourcePolicy); } - - if (props.domainName) { - if (!cdk.Token.isUnresolved(props.domainName)) { - // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/configuration-api.html#configuration-api-datatypes-domainname - if (!props.domainName.match(/^[a-z0-9\-]+$/)) { - throw new Error(`Invalid domainName '${props.domainName}'. Valid characters are a-z (lowercase only), 0-9, and – (hyphen).`); - } - if (props.domainName.length < 3 || props.domainName.length > 28) { - throw new Error(`Invalid domainName '${props.domainName}'. It must be between 3 and 28 characters`); - } - if (props.domainName[0] < 'a' || props.domainName[0] > 'z') { - throw new Error(`Invalid domainName '${props.domainName}'. It must start with a lowercase letter`); - } - } - this.node.addMetadata('aws:cdk:hasPhysicalName', props.domainName); - } - - this.domainName = this.getResourceNameAttribute(this.domain.ref); - - this.domainEndpoint = this.domain.getAtt('DomainEndpoint').toString(); - - this.domainArn = this.getResourceArnAttribute(this.domain.attrArn, { - service: 'es', - resource: 'domain', - resourceName: this.physicalName, - }); - - if (props.customEndpoint?.hostedZone) { - new route53.CnameRecord(this, 'CnameRecord', { - recordName: props.customEndpoint.domainName, - zone: props.customEndpoint.hostedZone, - domainName: this.domainEndpoint, - }); - } - - this.encryptionAtRestOptions = props.encryptionAtRest; - if (props.accessPolicies) { - this.addAccessPolicies(...props.accessPolicies); - } - if (unsignedBasicAuthEnabled) { - this.addAccessPolicies(unsignedAccessPolicy); - } - } - - /** - * Manages network connections to the domain. This will throw an error in case the domain - * is not placed inside a VPC. - * - * @deprecated use opensearchservice module instead - */ - public get connections(): ec2.Connections { - if (!this._connections) { - throw new Error("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); - } - return this._connections; - } - - /** - * Add policy statements to the domain access policy - * - * @deprecated use opensearchservice module instead - */ - public addAccessPolicies(...accessPolicyStatements: iam.PolicyStatement[]) { - if (accessPolicyStatements.length > 0) { - if (!this.accessPolicy) { - // Only create the custom resource after there are statements to set. - this.accessPolicy = new ElasticsearchAccessPolicy(this, 'ESAccessPolicy', { - domainName: this.domainName, - domainArn: this.domainArn, - accessPolicies: accessPolicyStatements, - }); - - if (this.encryptionAtRestOptions?.kmsKey) { - // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/encryption-at-rest.html - - // these permissions are documented as required during domain creation. - // while not strictly documented for updates as well, it stands to reason that an update - // operation might require these in case the cluster uses a kms key. - // empircal evidence shows this is indeed required: https://github.com/aws/aws-cdk/issues/11412 - this.accessPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['kms:List*', 'kms:Describe*', 'kms:CreateGrant'], - resources: [this.encryptionAtRestOptions.kmsKey.keyArn], - effect: iam.Effect.ALLOW, - })); - } - } else { - this.accessPolicy.addAccessPolicies(...accessPolicyStatements); - } - } - } -} - -/** - * Given an Elasticsearch domain endpoint, returns a CloudFormation expression that - * extracts the domain name. - * - * Domain endpoints look like this: - * - * https://example-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com - * https://-..es.amazonaws.com - * - * ..which means that in order to extract the domain name from the endpoint, we can - * split the endpoint using "-" and select the component in index 0. - * - * @param domainEndpoint The Elasticsearch domain endpoint - */ -function extractNameFromEndpoint(domainEndpoint: string) { - const { hostname } = new URL(domainEndpoint); - const domain = hostname.split('.')[0]; - const suffix = '-' + domain.split('-').slice(-1)[0]; - return domain.split(suffix)[0]; -} - -/** - * Converts an Elasticsearch version into a into a decimal number with major and minor version i.e x.y. - * - * @param version The Elasticsearch version object - */ -function parseVersion(version: ElasticsearchVersion): number { - const versionStr = version.version; - const firstDot = versionStr.indexOf('.'); - - if (firstDot < 1) { - throw new Error(`Invalid Elasticsearch version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); - } - - const secondDot = versionStr.indexOf('.', firstDot + 1); - - try { - if (secondDot == -1) { - return parseFloat(versionStr); - } else { - return parseFloat(versionStr.substring(0, secondDot)); - } - } catch { - throw new Error(`Invalid Elasticsearch version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); - } -} - -function selectSubnets(vpc: ec2.IVpc, vpcSubnets: ec2.SubnetSelection[]): ec2.ISubnet[] { - const selected = []; - for (const selection of vpcSubnets) { - selected.push(...vpc.selectSubnets(selection).subnets); - } - return selected; -} - -/** - * Initializes an instance type. - * - * @param defaultInstanceType Default instance type which is used if no instance type is provided - * @param instanceType Instance type - * @returns Instance type in lowercase (if provided) or default instance type - */ -function initializeInstanceType(defaultInstanceType: string, instanceType?: string): string { - if (instanceType) { - return cdk.Token.isUnresolved(instanceType) ? instanceType : instanceType.toLowerCase(); - } else { - return defaultInstanceType; - } -} diff --git a/packages/@aws-cdk/aws-elasticsearch/lib/log-group-resource-policy.ts b/packages/@aws-cdk/aws-elasticsearch/lib/log-group-resource-policy.ts deleted file mode 100644 index 0fd9c98464335..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/lib/log-group-resource-policy.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cr from '@aws-cdk/custom-resources'; -import { Construct } from 'constructs'; - -/** - * Construction properties for LogGroupResourcePolicy - */ -export interface LogGroupResourcePolicyProps { - /** - * The log group resource policy name - */ - readonly policyName: string; - /** - * The policy statements for the log group resource logs - */ - readonly policyStatements: [iam.PolicyStatement]; -} - -/** - * Creates LogGroup resource policies. - */ -export class LogGroupResourcePolicy extends cr.AwsCustomResource { - constructor(scope: Construct, id: string, props: LogGroupResourcePolicyProps) { - const policyDocument = new iam.PolicyDocument({ - statements: props.policyStatements, - }); - - super(scope, id, { - resourceType: 'Custom::CloudwatchLogResourcePolicy', - onUpdate: { - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: props.policyName, - policyDocument: JSON.stringify(policyDocument), - }, - physicalResourceId: cr.PhysicalResourceId.of(id), - }, - onDelete: { - service: 'CloudWatchLogs', - action: 'deleteResourcePolicy', - parameters: { - policyName: props.policyName, - }, - ignoreErrorCodesMatching: 'ResourceNotFoundException', - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: ['*'] }), - }); - } -} diff --git a/packages/@aws-cdk/aws-elasticsearch/package.json b/packages/@aws-cdk/aws-elasticsearch/package.json deleted file mode 100644 index a91d8b75246c4..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/package.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "name": "@aws-cdk/aws-elasticsearch", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Elasticsearch", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.elasticsearch", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "elasticsearch" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Elasticsearch", - "packageId": "Amazon.CDK.AWS.Elasticsearch", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-elasticsearch", - "module": "aws_cdk.aws_elasticsearch", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-elasticsearch" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Elasticsearch", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "elasticsearch" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-elasticsearch/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-elasticsearch/rosetta/default.ts-fixture deleted file mode 100644 index d0c3bec94ce39..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as es from '@aws-cdk/aws-elasticsearch'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-elasticsearch/rosetta/migrate-opensearch.ts-fixture b/packages/@aws-cdk/aws-elasticsearch/rosetta/migrate-opensearch.ts-fixture deleted file mode 100644 index bb93c1d40f369..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/rosetta/migrate-opensearch.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as es from '@aws-cdk/aws-elasticsearch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as opensearch from '@aws-cdk/aws-opensearchservice'; - -declare const role: iam.IRole; -declare const elasticsearchVersion: es.ElasticsearchVersion; -declare const openSearchVersion: opensearch.EngineVersion; - -class Fixture extends cdk.Construct { - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-elasticsearch/test/domain.test.ts b/packages/@aws-cdk/aws-elasticsearch/test/domain.test.ts deleted file mode 100644 index 3f040e74efcf2..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/test/domain.test.ts +++ /dev/null @@ -1,1903 +0,0 @@ -/* eslint-disable jest/expect-expect */ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Metric, Statistic } from '@aws-cdk/aws-cloudwatch'; -import { Vpc, EbsDeviceVolumeType, SecurityGroup } from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as route53 from '@aws-cdk/aws-route53'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Stack, Duration, SecretValue, CfnParameter, Token } from '@aws-cdk/core'; - -import { Domain, ElasticsearchVersion } from '../lib/domain'; - -let app: App; -let stack: Stack; - -beforeEach(() => { - app = new App(); - stack = new Stack(app, 'Stack', { - env: { account: '1234', region: 'testregion' }, - }); - - jest.resetAllMocks(); -}); - -const readActions = ['ESHttpGet', 'ESHttpHead']; -const writeActions = ['ESHttpDelete', 'ESHttpPost', 'ESHttpPut', 'ESHttpPatch']; -const readWriteActions = [ - ...readActions, - ...writeActions, -]; - -testDeprecated('connections throws if domain is placed inside a vpc', () => { - - expect(() => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - }).connections; - }).toThrowError("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); -}); - -testDeprecated('subnets and security groups can be provided when vpc is used', () => { - - const vpc = new Vpc(stack, 'Vpc'); - const securityGroup = new SecurityGroup(stack, 'CustomSecurityGroup', { - vpc, - }); - const domain = new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_10, - vpc, - vpcSubnets: [{ subnets: [vpc.privateSubnets[0]] }], - securityGroups: [securityGroup], - }); - - expect(domain.connections.securityGroups[0].securityGroupId).toEqual(securityGroup.securityGroupId); - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - VPCOptions: { - SecurityGroupIds: [ - { - 'Fn::GetAtt': [ - 'CustomSecurityGroupE5E500E5', - 'GroupId', - ], - }, - ], - SubnetIds: [ - { - Ref: 'VpcPrivateSubnet1Subnet536B997A', - }, - ], - }, - }); -}); - -testDeprecated('default subnets and security group when vpc is used', () => { - - const vpc = new Vpc(stack, 'Vpc'); - const domain = new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_10, - vpc, - }); - - expect(stack.resolve(domain.connections.securityGroups[0].securityGroupId)).toEqual({ 'Fn::GetAtt': ['DomainSecurityGroup48AA5FD6', 'GroupId'] }); - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - VPCOptions: { - SecurityGroupIds: [ - { - 'Fn::GetAtt': [ - 'DomainSecurityGroup48AA5FD6', - 'GroupId', - ], - }, - ], - SubnetIds: [ - { - Ref: 'VpcPrivateSubnet1Subnet536B997A', - }, - { - Ref: 'VpcPrivateSubnet2Subnet3788AAA1', - }, - { - Ref: 'VpcPrivateSubnet3SubnetF258B56E', - }, - ], - }, - }); -}); - -testDeprecated('default removalpolicy is retain', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - }); - - Template.fromStack(stack).hasResource('AWS::Elasticsearch::Domain', { - DeletionPolicy: 'Retain', - }); -}); - -testDeprecated('grants kms permissions if needed', () => { - - const key = new kms.Key(stack, 'Key'); - - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - encryptionAtRest: { - kmsKey: key, - }, - // so that the access policy custom resource will be used. - useUnsignedBasicAuth: true, - }); - - const expectedPolicy = { - Statement: [ - { - Action: [ - 'kms:List*', - 'kms:Describe*', - 'kms:CreateGrant', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }; - - const resources = Template.fromStack(stack).toJSON().Resources; - expect(resources.AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E.Properties.PolicyDocument).toStrictEqual(expectedPolicy); - -}); - -testDeprecated('minimal example renders correctly', () => { - new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_1 }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - CognitoOptions: { - Enabled: false, - }, - EBSOptions: { - EBSEnabled: true, - VolumeSize: 10, - VolumeType: 'gp2', - }, - ElasticsearchClusterConfig: { - DedicatedMasterEnabled: false, - InstanceCount: 1, - InstanceType: 'r5.large.elasticsearch', - ZoneAwarenessEnabled: false, - }, - ElasticsearchVersion: '7.1', - EncryptionAtRestOptions: { - Enabled: false, - }, - LogPublishingOptions: { - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - NodeToNodeEncryptionOptions: { - Enabled: false, - }, - }); -}); - -testDeprecated('can enable version upgrade update policy', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - enableVersionUpgrade: true, - }); - - Template.fromStack(stack).hasResource('AWS::Elasticsearch::Domain', { - UpdatePolicy: { - EnableVersionUpgrade: true, - }, - }); -}); - -testDeprecated('can set a self-referencing custom policy', () => { - const domain = new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - }); - - domain.addAccessPolicies( - new iam.PolicyStatement({ - actions: ['es:ESHttpPost', 'es:ESHttpPut'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('5678')], - resources: [domain.domainArn, `${domain.domainArn}/*`], - }), - ); - - const expectedPolicy = { - 'Fn::Join': [ - '', - [ - '{"action":"updateElasticsearchDomainConfig","service":"ES","parameters":{"DomainName":"', - { - Ref: 'Domain66AC69E0', - }, - '","AccessPolicies":"{\\"Statement\\":[{\\"Action\\":[\\"es:ESHttpPost\\",\\"es:ESHttpPut\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"AWS\\":\\"arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::5678:root\\"},\\"Resource\\":[\\"', - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'Arn', - ], - }, - '\\",\\"', - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'Arn', - ], - }, - '/*\\"]}],\\"Version\\":\\"2012-10-17\\"}"},"outputPaths":["DomainConfig.ElasticsearchClusterConfig.AccessPolicies"],"physicalResourceId":{"id":"', - { - Ref: 'Domain66AC69E0', - }, - 'AccessPolicy"}}', - ], - ], - }; - Template.fromStack(stack).hasResourceProperties('Custom::ElasticsearchAccessPolicy', { - ServiceToken: { - 'Fn::GetAtt': [ - 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', - 'Arn', - ], - }, - Create: expectedPolicy, - Update: expectedPolicy, - }); -}); - - -describe('UltraWarm instances', () => { - - testDeprecated('can enable UltraWarm instances', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - capacity: { - masterNodes: 2, - warmNodes: 2, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - ElasticsearchClusterConfig: { - DedicatedMasterEnabled: true, - WarmEnabled: true, - WarmCount: 2, - WarmType: 'ultrawarm1.medium.elasticsearch', - }, - }); - }); - - testDeprecated('can enable UltraWarm instances with specific instance type', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - capacity: { - masterNodes: 2, - warmNodes: 2, - warmInstanceType: 'ultrawarm1.large.elasticsearch', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - ElasticsearchClusterConfig: { - DedicatedMasterEnabled: true, - WarmEnabled: true, - WarmCount: 2, - WarmType: 'ultrawarm1.large.elasticsearch', - }, - }); - }); - -}); - -testDeprecated('can use tokens in capacity configuration', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_10, - capacity: { - dataNodeInstanceType: Token.asString({ Ref: 'dataNodeInstanceType' }), - dataNodes: Token.asNumber({ Ref: 'dataNodes' }), - masterNodeInstanceType: Token.asString({ Ref: 'masterNodeInstanceType' }), - masterNodes: Token.asNumber({ Ref: 'masterNodes' }), - warmInstanceType: Token.asString({ Ref: 'warmInstanceType' }), - warmNodes: Token.asNumber({ Ref: 'warmNodes' }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - ElasticsearchClusterConfig: { - InstanceCount: { - Ref: 'dataNodes', - }, - InstanceType: { - Ref: 'dataNodeInstanceType', - }, - DedicatedMasterEnabled: true, - DedicatedMasterCount: { - Ref: 'masterNodes', - }, - DedicatedMasterType: { - Ref: 'masterNodeInstanceType', - }, - WarmEnabled: true, - WarmCount: { - Ref: 'warmNodes', - }, - WarmType: { - Ref: 'warmInstanceType', - }, - }, - }); -}); - -describe('log groups', () => { - - testDeprecated('slowSearchLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - slowSearchLogEnabled: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainSlowSearchLogs5B35A97A', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('slowIndexLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - slowIndexLogEnabled: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainSlowIndexLogsFE2F1061', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('appLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - appLogEnabled: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainAppLogs21698C1B', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('auditLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - auditLogEnabled: true, - }, - fineGrainedAccessControl: { - masterUserName: 'username', - }, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - AUDIT_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainAuditLogs608E0FA6', - 'Arn', - ], - }, - Enabled: true, - }, - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('two domains with logging enabled can be created in same stack', () => { - new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_7, - logging: { - appLogEnabled: true, - slowSearchLogEnabled: true, - slowIndexLogEnabled: true, - }, - }); - new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_7, - logging: { - appLogEnabled: true, - slowSearchLogEnabled: true, - slowIndexLogEnabled: true, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain1AppLogs6E8D1D67', - 'Arn', - ], - }, - Enabled: true, - }, - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain1SlowSearchLogs8F3B0506', - 'Arn', - ], - }, - Enabled: true, - }, - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain1SlowIndexLogs9354D098', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain2AppLogs810876E2', - 'Arn', - ], - }, - Enabled: true, - }, - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain2SlowSearchLogs0C75F64B', - 'Arn', - ], - }, - Enabled: true, - }, - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain2SlowIndexLogs0CB900D0', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('log group policy is uniquely named for each domain', () => { - new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - logging: { - appLogEnabled: true, - }, - }); - new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - logging: { - appLogEnabled: true, - }, - }); - - // Domain1 - Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { - Create: { - 'Fn::Join': [ - '', - [ - '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', - { - 'Fn::GetAtt': [ - 'Domain1AppLogs6E8D1D67', - 'Arn', - ], - }, - '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391"}}', - ], - ], - }, - }); - // Domain2 - Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { - Create: { - 'Fn::Join': [ - '', - [ - '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', - { - 'Fn::GetAtt': [ - 'Domain2AppLogs810876E2', - 'Arn', - ], - }, - '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2"}}', - ], - ], - }, - }); - }); - - testDeprecated('enabling audit logs throws without fine grained access control enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V6_7, - logging: { - auditLogEnabled: true, - }, - })).toThrow(/Fine-grained access control is required when audit logs publishing is enabled\./); - }); - - testDeprecated('slowSearchLogGroup should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - slowSearchLogEnabled: true, - slowSearchLogGroup: new logs.LogGroup(stack, 'SlowSearchLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'SlowSearchLogsE00DC2E7', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('slowIndexLogEnabled should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - slowIndexLogEnabled: true, - slowIndexLogGroup: new logs.LogGroup(stack, 'SlowIndexLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'SlowIndexLogsAD49DED0', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('appLogGroup should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - logging: { - appLogEnabled: true, - appLogGroup: new logs.LogGroup(stack, 'AppLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'AppLogsC5DF83A6', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - testDeprecated('auditLOgGroup should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - fineGrainedAccessControl: { - masterUserName: 'username', - }, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - enforceHttps: true, - logging: { - auditLogEnabled: true, - auditLogGroup: new logs.LogGroup(stack, 'AuditLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - LogPublishingOptions: { - AUDIT_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'AuditLogsB945E340', - 'Arn', - ], - }, - Enabled: true, - }, - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - -}); - -describe('grants', () => { - - testDeprecated('"grantRead" allows read actions associated with this domain resource', () => { - testGrant(readActions, (p, d) => d.grantRead(p)); - }); - - testDeprecated('"grantWrite" allows write actions associated with this domain resource', () => { - testGrant(writeActions, (p, d) => d.grantWrite(p)); - }); - - testDeprecated('"grantReadWrite" allows read and write actions associated with this domain resource', () => { - testGrant(readWriteActions, (p, d) => d.grantReadWrite(p)); - }); - - testDeprecated('"grantIndexRead" allows read actions associated with an index in this domain resource', () => { - testGrant( - readActions, - (p, d) => d.grantIndexRead('my-index', p), - false, - ['/my-index', '/my-index/*'], - ); - }); - - testDeprecated('"grantIndexWrite" allows write actions associated with an index in this domain resource', () => { - testGrant( - writeActions, - (p, d) => d.grantIndexWrite('my-index', p), - false, - ['/my-index', '/my-index/*'], - ); - }); - - testDeprecated('"grantIndexReadWrite" allows read and write actions associated with an index in this domain resource', () => { - testGrant( - readWriteActions, - (p, d) => d.grantIndexReadWrite('my-index', p), - false, - ['/my-index', '/my-index/*'], - ); - }); - - testDeprecated('"grantPathRead" allows read actions associated with a given path in this domain resource', () => { - testGrant( - readActions, - (p, d) => d.grantPathRead('my-index/my-path', p), - false, - ['/my-index/my-path'], - ); - }); - - testDeprecated('"grantPathWrite" allows write actions associated with a given path in this domain resource', () => { - testGrant( - writeActions, - (p, d) => d.grantPathWrite('my-index/my-path', p), - false, - ['/my-index/my-path'], - ); - }); - - testDeprecated('"grantPathReadWrite" allows read and write actions associated with a given path in this domain resource', () => { - testGrant( - readWriteActions, - (p, d) => d.grantPathReadWrite('my-index/my-path', p), - false, - ['/my-index/my-path'], - ); - }); - - testDeprecated('"grant" for an imported domain', () => { - const domainEndpoint = 'https://test-domain-2w2x2u3tifly-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com'; - const domain = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); - const user = new iam.User(stack, 'user'); - - domain.grantReadWrite(user); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'es:ESHttpGet', - 'es:ESHttpHead', - 'es:ESHttpDelete', - 'es:ESHttpPost', - 'es:ESHttpPut', - 'es:ESHttpPatch', - ], - Effect: 'Allow', - Resource: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':es:testregion:1234:domain/test-domain-2w2x2u3tifly', - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':es:testregion:1234:domain/test-domain-2w2x2u3tifly/*', - ], - ], - }, - ], - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'userDefaultPolicy083DF682', - Users: [ - { - Ref: 'user2C2B57AE', - }, - ], - }); - }); - -}); - -describe('metrics', () => { - - testDeprecated('Can use metricClusterStatusRed on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricClusterStatusRed(), - 'ClusterStatus.red', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricClusterStatusYellow on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricClusterStatusYellow(), - 'ClusterStatus.yellow', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricFreeStorageSpace on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricFreeStorageSpace(), - 'FreeStorageSpace', - Statistic.MINIMUM, - ); - }); - - testDeprecated('Can use metricClusterIndexWriteBlocked on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricClusterIndexWritesBlocked(), - 'ClusterIndexWritesBlocked', - Statistic.MAXIMUM, - Duration.minutes(1), - ); - }); - - testDeprecated('Can use metricNodes on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricNodes(), - 'Nodes', - Statistic.MINIMUM, - Duration.hours(1), - ); - }); - - testDeprecated('Can use metricAutomatedSnapshotFailure on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricAutomatedSnapshotFailure(), - 'AutomatedSnapshotFailure', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricCPUUtilization on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricCPUUtilization(), - 'CPUUtilization', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricJVMMemoryPressure on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricJVMMemoryPressure(), - 'JVMMemoryPressure', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricMasterCPUUtilization on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricMasterCPUUtilization(), - 'MasterCPUUtilization', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricMasterJVMMemoryPressure on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricMasterJVMMemoryPressure(), - 'MasterJVMMemoryPressure', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricKMSKeyError on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricKMSKeyError(), - 'KMSKeyError', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricKMSKeyInaccessible on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricKMSKeyInaccessible(), - 'KMSKeyInaccessible', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricSearchableDocuments on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricSearchableDocuments(), - 'SearchableDocuments', - Statistic.MAXIMUM, - ); - }); - - testDeprecated('Can use metricSearchLatency on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricSearchLatency(), - 'SearchLatency', - 'p99', - ); - }); - - testDeprecated('Can use metricIndexingLatency on an Elasticsearch Domain', () => { - testMetric( - (domain) => domain.metricIndexingLatency(), - 'IndexingLatency', - 'p99', - ); - }); - -}); - -describe('import', () => { - - testDeprecated('static fromDomainEndpoint(endpoint) allows importing an external/existing domain', () => { - const domainName = 'test-domain-2w2x2u3tifly'; - const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; - const domainEndpoint = `https://${domainEndpointWithoutHttps}`; - const imported = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); - - expect(imported.domainName).toEqual(domainName); - expect(imported.domainArn).toMatch(RegExp(`es:testregion:1234:domain/${domainName}$`)); - expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); - - Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 0); - }); - - testDeprecated('static fromDomainAttributes(attributes) allows importing an external/existing domain', () => { - const domainName = 'test-domain-2w2x2u3tifly'; - const domainArn = `arn:aws:es:testregion:1234:domain/${domainName}`; - const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; - const domainEndpoint = `https://${domainEndpointWithoutHttps}`; - const imported = Domain.fromDomainAttributes(stack, 'Domain', { - domainArn, - domainEndpoint, - }); - - expect(imported.domainName).toEqual(domainName); - expect(imported.domainArn).toEqual(domainArn); - expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); - - Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 0); - }); - - testDeprecated('static fromDomainAttributes(attributes) allows importing with token arn and endpoint', () => { - const domainArn = new CfnParameter(stack, 'domainArn', { type: 'String' }).valueAsString; - const domainEndpoint = new CfnParameter(stack, 'domainEndpoint', { type: 'String' }).valueAsString; - const imported = Domain.fromDomainAttributes(stack, 'Domain', { - domainArn, - domainEndpoint, - }); - const expectedDomainName = { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - '/', - { - 'Fn::Select': [ - 5, - { - 'Fn::Split': [ - ':', - { - Ref: 'domainArn', - }, - ], - }, - ], - }, - ], - }, - ], - }; - - expect(stack.resolve(imported.domainName)).toEqual(expectedDomainName); - expect(imported.domainArn).toEqual(domainArn); - expect(imported.domainEndpoint).toEqual(domainEndpoint); - - Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 0); - }); -}); - -describe('advanced security options', () => { - const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; - const masterUserName = 'JohnDoe'; - const password = 'password'; - const masterUserPassword = SecretValue.unsafePlainText(password); - - testDeprecated('enable fine-grained access control with a master user ARN', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: false, - MasterUserOptions: { - MasterUserARN: masterUserArn, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - testDeprecated('enable fine-grained access control with a master user name and password', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - fineGrainedAccessControl: { - masterUserName, - masterUserPassword, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: masterUserName, - MasterUserPassword: password, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - testDeprecated('enable fine-grained access control with a master user name and dynamically generated password', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - fineGrainedAccessControl: { - masterUserName, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: masterUserName, - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DomainMasterUserBFAFA7D9', - }, - ':SecretString:password::}}', - ], - ], - }, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: { - GenerateStringKey: 'password', - }, - }); - }); - - testDeprecated('enabling fine-grained access control throws with Elasticsearch < 6.7', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V6_5, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - })).toThrow(/Fine-grained access control requires Elasticsearch version 6\.7 or later/); - }); - - testDeprecated('enabling fine-grained access control throws without node-to-node encryption enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: false, - enforceHttps: true, - })).toThrow(/Node-to-node encryption is required when fine-grained access control is enabled/); - }); - - testDeprecated('enabling fine-grained access control throws without encryption-at-rest enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: false, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - })).toThrow(/Encryption-at-rest is required when fine-grained access control is enabled/); - }); - - testDeprecated('enabling fine-grained access control throws without enforceHttps enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: false, - })).toThrow(/Enforce HTTPS is required when fine-grained access control is enabled/); - }); -}); - -describe('custom endpoints', () => { - const customDomainName = 'search.example.com'; - - testDeprecated('custom domain without hosted zone and default cert', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - nodeToNodeEncryption: true, - enforceHttps: true, - customEndpoint: { - domainName: customDomainName, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - DomainEndpointOptions: { - EnforceHTTPS: true, - CustomEndpointEnabled: true, - CustomEndpoint: customDomainName, - CustomEndpointCertificateArn: { - Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: customDomainName, - ValidationMethod: 'EMAIL', - }); - }); - - testDeprecated('custom domain with hosted zone and default cert', () => { - const zone = new route53.HostedZone(stack, 'DummyZone', { zoneName: 'example.com' }); - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - nodeToNodeEncryption: true, - enforceHttps: true, - customEndpoint: { - domainName: customDomainName, - hostedZone: zone, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - DomainEndpointOptions: { - EnforceHTTPS: true, - CustomEndpointEnabled: true, - CustomEndpoint: customDomainName, - CustomEndpointCertificateArn: { - Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: customDomainName, - DomainValidationOptions: [ - { - DomainName: customDomainName, - HostedZoneId: { - Ref: 'DummyZone03E0FE81', - }, - }, - ], - ValidationMethod: 'DNS', - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Name: 'search.example.com.', - Type: 'CNAME', - HostedZoneId: { - Ref: 'DummyZone03E0FE81', - }, - ResourceRecords: [ - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'DomainEndpoint', - ], - }, - ], - }); - }); - - testDeprecated('custom domain with hosted zone and given cert', () => { - const zone = new route53.HostedZone(stack, 'DummyZone', { - zoneName: 'example.com', - }); - const certificate = new acm.Certificate(stack, 'DummyCert', { - domainName: customDomainName, - }); - - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - nodeToNodeEncryption: true, - enforceHttps: true, - customEndpoint: { - domainName: customDomainName, - hostedZone: zone, - certificate, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - DomainEndpointOptions: { - EnforceHTTPS: true, - CustomEndpointEnabled: true, - CustomEndpoint: customDomainName, - CustomEndpointCertificateArn: { - Ref: 'DummyCertFA37670B', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Name: 'search.example.com.', - Type: 'CNAME', - HostedZoneId: { - Ref: 'DummyZone03E0FE81', - }, - ResourceRecords: [ - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'DomainEndpoint', - ], - }, - ], - }); - }); - -}); - -describe('custom error responses', () => { - - testDeprecated('error when availabilityZoneCount does not match vpcOptions.subnets length', () => { - const vpc = new Vpc(stack, 'Vpc', { - maxAzs: 1, - }); - - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_4, - zoneAwareness: { - enabled: true, - availabilityZoneCount: 2, - }, - vpc, - })).toThrow(/you need to provide a subnet for each AZ you are using/); - }); - - testDeprecated('error when master, data or Ultra Warm instance types do not end with .elasticsearch', () => { - const error = /instance types must end with ".elasticsearch"/; - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - capacity: { - masterNodeInstanceType: 'c5.large', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - capacity: { - dataNodeInstanceType: 'c5.2xlarge', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain3', { - version: ElasticsearchVersion.V7_4, - capacity: { - warmInstanceType: 'ultrawarm1.medium', - }, - })).toThrow(error); - }); - - testDeprecated('error when Ultra Warm instance types do not start with ultrawarm', () => { - const error = /UltraWarm node instance type must start with "ultrawarm"./; - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - capacity: { - warmInstanceType: 't3.small.elasticsearch', - }, - })).toThrow(error); - }); - - testDeprecated('error when elasticsearchVersion is unsupported/unknown', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.of('5.4'), - })).toThrow(/Unknown Elasticsearch version: 5\.4/); - }); - - testDeprecated('error when invalid domain name is given', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - domainName: 'InvalidName', - })).toThrow(/Valid characters are a-z/); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - domainName: 'a'.repeat(29), - })).toThrow(/It must be between 3 and 28 characters/); - expect(() => new Domain(stack, 'Domain3', { - version: ElasticsearchVersion.V7_4, - domainName: '123domain', - })).toThrow(/It must start with a lowercase letter/); - }); - - testDeprecated('error when error log publishing is enabled for elasticsearch version < 5.1', () => { - const error = /Error logs publishing requires Elasticsearch version 5.1 or later/; - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V2_3, - logging: { - appLogEnabled: true, - }, - })).toThrow(error); - }); - - testDeprecated('error when encryption at rest is enabled for elasticsearch version < 5.1', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V2_3, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(/Encryption of data at rest requires Elasticsearch version 5.1 or later/); - }); - - testDeprecated('error when cognito for kibana is enabled for elasticsearch version < 5.1', () => { - const user = new iam.User(stack, 'user'); - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V2_3, - cognitoKibanaAuth: { - identityPoolId: 'test-identity-pool-id', - role: new iam.Role(stack, 'Role', { assumedBy: user }), - userPoolId: 'test-user-pool-id', - }, - })).toThrow(/Cognito authentication for Kibana requires Elasticsearch version 5.1 or later/); - }); - - testDeprecated('error when C5, I3, M5, or R5 instance types are specified for elasticsearch version < 5.1', () => { - const error = /C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later/; - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V2_3, - capacity: { - masterNodeInstanceType: 'c5.medium.elasticsearch', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V1_5, - capacity: { - dataNodeInstanceType: 'i3.2xlarge.elasticsearch', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain3', { - version: ElasticsearchVersion.V1_5, - capacity: { - dataNodeInstanceType: 'm5.2xlarge.elasticsearch', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain4', { - version: ElasticsearchVersion.V1_5, - capacity: { - masterNodeInstanceType: 'r5.2xlarge.elasticsearch', - }, - })).toThrow(error); - }); - - testDeprecated('error when node to node encryption is enabled for elasticsearch version < 6.0', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V5_6, - nodeToNodeEncryption: true, - })).toThrow(/Node-to-node encryption requires Elasticsearch version 6.0 or later/); - }); - - testDeprecated('error when i3 or r6g instance types are specified with EBS enabled', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - capacity: { - dataNodeInstanceType: 'i3.2xlarge.elasticsearch', - }, - ebs: { - volumeSize: 100, - volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, - }, - })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - capacity: { - dataNodeInstanceType: 'r6gd.large.elasticsearch', - }, - ebs: { - volumeSize: 100, - volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, - }, - })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); - }); - - testDeprecated('error when m3, r3, or t2 instance types are specified with encryption at rest enabled', () => { - const error = /M3, R3, and T2 instance types do not support encryption of data at rest/; - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - capacity: { - masterNodeInstanceType: 'm3.2xlarge.elasticsearch', - }, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - capacity: { - dataNodeInstanceType: 'r3.2xlarge.elasticsearch', - }, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain3', { - version: ElasticsearchVersion.V7_4, - capacity: { - masterNodeInstanceType: 't2.2xlarge.elasticsearch', - }, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(error); - }); - - testDeprecated('error when t2.micro is specified with elasticsearch version > 2.3', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V6_7, - capacity: { - masterNodeInstanceType: 't2.micro.elasticsearch', - }, - })).toThrow(/t2.micro.elasticsearch instance type supports only Elasticsearch 1.5 and 2.3/); - }); - - testDeprecated('error when any instance type other than R3, I3 and R6GD are specified without EBS enabled', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - ebs: { - enabled: false, - }, - capacity: { - masterNodeInstanceType: 'm5.large.elasticsearch', - }, - })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - ebs: { - enabled: false, - }, - capacity: { - dataNodeInstanceType: 'm5.large.elasticsearch', - }, - })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); - }); - - testDeprecated('can use compatible master instance types that does not have local storage when data node type is i3 or r6gd', () => { - new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - ebs: { - enabled: false, - }, - capacity: { - masterNodeInstanceType: 'c5.2xlarge.elasticsearch', - dataNodeInstanceType: 'i3.2xlarge.elasticsearch', - }, - }); - new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - ebs: { - enabled: false, - }, - capacity: { - masterNodes: 3, - masterNodeInstanceType: 'c6g.large.elasticsearch', - dataNodeInstanceType: 'r6gd.large.elasticsearch', - }, - }); - // both configurations pass synth-time validation - Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 2); - }); - - testDeprecated('error when availabilityZoneCount is not 2 or 3', () => { - const vpc = new Vpc(stack, 'Vpc'); - - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - vpc, - zoneAwareness: { - availabilityZoneCount: 4, - }, - })).toThrow(/Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3/); - }); - - testDeprecated('error when UltraWarm instance is used and not supported by elasticsearchVersion', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V6_7, - capacity: { - masterNodes: 1, - warmNodes: 1, - }, - })).toThrow(/UltraWarm requires Elasticsearch 6\.8 or later/); - }); - - testDeprecated('error when t2 or t3 instance types are specified with UltramWarm enabled', () => { - const error = /T2 and T3 instance types do not support UltraWarm storage/; - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - capacity: { - masterNodeInstanceType: 't2.2xlarge.elasticsearch', - warmNodes: 1, - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: ElasticsearchVersion.V7_4, - capacity: { - masterNodeInstanceType: 't3.2xlarge.elasticsearch', - warmNodes: 1, - }, - })).toThrow(error); - }); - - testDeprecated('error when UltraWarm instance is used and no dedicated master instance specified', () => { - expect(() => new Domain(stack, 'Domain1', { - version: ElasticsearchVersion.V7_4, - capacity: { - warmNodes: 1, - masterNodes: 0, - }, - })).toThrow(/Dedicated master node is required when UltraWarm storage is enabled/); - }); - -}); - -testDeprecated('can specify future version', () => { - new Domain(stack, 'Domain', { version: ElasticsearchVersion.of('8.2') }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - ElasticsearchVersion: '8.2', - }); -}); - -describe('unsigned basic auth', () => { - testDeprecated('can create a domain with unsigned basic auth', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - useUnsignedBasicAuth: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: 'admin', - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - testDeprecated('does not overwrite master user ARN configuration', () => { - const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; - - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - fineGrainedAccessControl: { - masterUserArn, - }, - useUnsignedBasicAuth: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: false, - MasterUserOptions: { - MasterUserARN: masterUserArn, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - testDeprecated('does not overwrite master user name and password', () => { - const masterUserName = 'JohnDoe'; - const password = 'password'; - const masterUserPassword = SecretValue.unsafePlainText(password); - - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - fineGrainedAccessControl: { - masterUserName, - masterUserPassword, - }, - useUnsignedBasicAuth: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: masterUserName, - MasterUserPassword: password, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - testDeprecated('fails to create a domain with unsigned basic auth when enforce HTTPS is disabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - useUnsignedBasicAuth: true, - enforceHttps: false, - })).toThrow(/You cannot disable HTTPS and use unsigned basic auth/); - }); - - testDeprecated('fails to create a domain with unsigned basic auth when node to node encryption is disabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - useUnsignedBasicAuth: true, - nodeToNodeEncryption: false, - })).toThrow(/You cannot disable node to node encryption and use unsigned basic auth/); - }); - - testDeprecated('fails to create a domain with unsigned basic auth when encryption at rest is disabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_7, - useUnsignedBasicAuth: true, - encryptionAtRest: { enabled: false }, - })).toThrow(/You cannot disable encryption at rest and use unsigned basic auth/); - }); - - testDeprecated('using unsigned basic auth throws with Elasticsearch < 6.7', () => { - expect(() => new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V6_5, - useUnsignedBasicAuth: true, - })).toThrow(/Using unsigned basic auth requires Elasticsearch version 6\.7 or later./); - }); -}); - -describe('advanced options', () => { - testDeprecated('use advanced options', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - advancedOptions: { - 'rest.action.multi.allow_explicit_index': 'true', - 'indices.fielddata.cache.size': '50', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedOptions: { - 'rest.action.multi.allow_explicit_index': 'true', - 'indices.fielddata.cache.size': '50', - }, - }); - }); - - testDeprecated('advanced options absent by default', () => { - new Domain(stack, 'Domain', { - version: ElasticsearchVersion.V7_1, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { - AdvancedOptions: Match.absent(), - }); - }); -}); - -function testGrant( - expectedActions: string[], - invocation: (user: iam.IPrincipal, domain: Domain) => void, - appliesToDomainRoot: Boolean = true, - paths: string[] = ['/*'], -) { - const domain = new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_4 }); - const user = new iam.User(stack, 'user'); - - invocation(user, domain); - - const action = expectedActions.length > 1 ? expectedActions.map(a => `es:${a}`) : `es:${expectedActions[0]}`; - const domainArn = { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'Arn', - ], - }; - const resolvedPaths = paths.map(path => { - return { - 'Fn::Join': [ - '', - [ - domainArn, - path, - ], - ], - }; - }); - const resource = appliesToDomainRoot - ? [domainArn, ...resolvedPaths] - : resolvedPaths.length > 1 - ? resolvedPaths - : resolvedPaths[0]; - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: action, - Effect: 'Allow', - Resource: resource, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'userDefaultPolicy083DF682', - Users: [ - { - Ref: 'user2C2B57AE', - }, - ], - }); -} - -function testMetric( - invocation: (domain: Domain) => Metric, - metricName: string, - statistic: string = Statistic.SUM, - period: Duration = Duration.minutes(5), -) { - const domain = new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_4 }); - - const metric = invocation(domain); - - expect(metric).toMatchObject({ - metricName, - namespace: 'AWS/ES', - period, - statistic, - dimensions: { - ClientId: '1234', - }, - }); - expect(metric.dimensions).toHaveProperty('DomainName'); -} diff --git a/packages/@aws-cdk/aws-elasticsearch/test/log-group-resource-policy.test.ts b/packages/@aws-cdk/aws-elasticsearch/test/log-group-resource-policy.test.ts deleted file mode 100644 index bbfa0c37a23c4..0000000000000 --- a/packages/@aws-cdk/aws-elasticsearch/test/log-group-resource-policy.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; -import { LogGroupResourcePolicy } from '../lib/log-group-resource-policy'; - -let app: App; -let stack: Stack; - -beforeEach(() => { - app = new App(); - stack = new Stack(app, 'Stack', { - env: { account: '1234', region: 'testregion' }, - }); -}); - -test('minimal example renders correctly', () => { - new LogGroupResourcePolicy(stack, 'LogGroupResourcePolicy', { - policyName: 'TestPolicy', - policyStatements: [new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], - resources: ['*'], - principals: [new iam.ServicePrincipal('es.amazonaws.com')], - })], - }); - - Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { - ServiceToken: { - 'Fn::GetAtt': [ - 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', - 'Arn', - ], - }, - Create: JSON.stringify({ - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: 'TestPolicy', - policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', - }, - physicalResourceId: { - id: 'LogGroupResourcePolicy', - }, - }), - Update: JSON.stringify({ - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: 'TestPolicy', - policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', - }, - physicalResourceId: { - id: 'LogGroupResourcePolicy', - }, - }), - Delete: JSON.stringify({ - service: 'CloudWatchLogs', - action: 'deleteResourcePolicy', - parameters: { - policyName: 'TestPolicy', - }, - ignoreErrorCodesMatching: 'ResourceNotFoundException', - }), - }); -}); diff --git a/packages/@aws-cdk/aws-emr/.eslintrc.js b/packages/@aws-cdk/aws-emr/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-emr/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-emr/.gitignore b/packages/@aws-cdk/aws-emr/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-emr/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-emr/.npmignore b/packages/@aws-cdk/aws-emr/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-emr/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-emr/LICENSE b/packages/@aws-cdk/aws-emr/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-emr/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-emr/NOTICE b/packages/@aws-cdk/aws-emr/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-emr/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-emr/README.md b/packages/@aws-cdk/aws-emr/README.md deleted file mode 100644 index d79662a7d4e9b..0000000000000 --- a/packages/@aws-cdk/aws-emr/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon EMR Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as emr from '@aws-cdk/aws-emr'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for EMR construct libraries](https://constructs.dev/search?q=emr) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::EMR resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMR.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::EMR](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMR.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-emr/jest.config.js b/packages/@aws-cdk/aws-emr/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-emr/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-emr/lib/index.ts b/packages/@aws-cdk/aws-emr/lib/index.ts deleted file mode 100644 index 51d78c1ad13fc..0000000000000 --- a/packages/@aws-cdk/aws-emr/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::EMR CloudFormation Resources: -export * from './emr.generated'; diff --git a/packages/@aws-cdk/aws-emr/package.json b/packages/@aws-cdk/aws-emr/package.json deleted file mode 100644 index 6fc65096d5f36..0000000000000 --- a/packages/@aws-cdk/aws-emr/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-emr", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::EMR", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.emr", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "emr" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.EMR", - "packageId": "Amazon.CDK.AWS.EMR", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-emr", - "module": "aws_cdk.aws_emr", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-emr" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::EMR", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "emr" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-emr/test/emr.test.ts b/packages/@aws-cdk/aws-emr/test/emr.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-emr/test/emr.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-emrcontainers/.eslintrc.js b/packages/@aws-cdk/aws-emrcontainers/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-emrcontainers/.gitignore b/packages/@aws-cdk/aws-emrcontainers/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-emrcontainers/.npmignore b/packages/@aws-cdk/aws-emrcontainers/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-emrcontainers/LICENSE b/packages/@aws-cdk/aws-emrcontainers/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-emrcontainers/NOTICE b/packages/@aws-cdk/aws-emrcontainers/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-emrcontainers/README.md b/packages/@aws-cdk/aws-emrcontainers/README.md deleted file mode 100644 index 2f06eb48f1857..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::EMRContainers Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as emrcontainers from '@aws-cdk/aws-emrcontainers'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for EMRContainers construct libraries](https://constructs.dev/search?q=emrcontainers) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::EMRContainers resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRContainers.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::EMRContainers](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRContainers.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-emrcontainers/jest.config.js b/packages/@aws-cdk/aws-emrcontainers/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-emrcontainers/lib/index.ts b/packages/@aws-cdk/aws-emrcontainers/lib/index.ts deleted file mode 100644 index 507c55d362969..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::EMRContainers CloudFormation Resources: -export * from './emrcontainers.generated'; diff --git a/packages/@aws-cdk/aws-emrcontainers/package.json b/packages/@aws-cdk/aws-emrcontainers/package.json deleted file mode 100644 index b77bfcb504faa..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-emrcontainers", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::EMRContainers", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.EMRContainers", - "packageId": "Amazon.CDK.AWS.EMRContainers", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.emrcontainers", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "emrcontainers" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-emrcontainers", - "module": "aws_cdk.aws_emrcontainers" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-emrcontainers" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::EMRContainers", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::EMRContainers", - "aws-emrcontainers" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-emrcontainers/test/emrcontainers.test.ts b/packages/@aws-cdk/aws-emrcontainers/test/emrcontainers.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-emrcontainers/test/emrcontainers.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-emrserverless/.eslintrc.js b/packages/@aws-cdk/aws-emrserverless/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-emrserverless/.gitignore b/packages/@aws-cdk/aws-emrserverless/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-emrserverless/.npmignore b/packages/@aws-cdk/aws-emrserverless/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-emrserverless/LICENSE b/packages/@aws-cdk/aws-emrserverless/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-emrserverless/NOTICE b/packages/@aws-cdk/aws-emrserverless/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-emrserverless/README.md b/packages/@aws-cdk/aws-emrserverless/README.md deleted file mode 100644 index 4705ca8e42317..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::EMRServerless Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as emrserverless from '@aws-cdk/aws-emrserverless'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for EMRServerless construct libraries](https://constructs.dev/search?q=emrserverless) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::EMRServerless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRServerless.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::EMRServerless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRServerless.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-emrserverless/jest.config.js b/packages/@aws-cdk/aws-emrserverless/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-emrserverless/lib/index.ts b/packages/@aws-cdk/aws-emrserverless/lib/index.ts deleted file mode 100644 index 5f9aa0dc65390..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::EMRServerless CloudFormation Resources: -export * from './emrserverless.generated'; diff --git a/packages/@aws-cdk/aws-emrserverless/package.json b/packages/@aws-cdk/aws-emrserverless/package.json deleted file mode 100644 index b3b334c5528d3..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-emrserverless", - "version": "0.0.0", - "description": "AWS::EMRServerless Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.EMRServerless", - "packageId": "Amazon.CDK.AWS.EMRServerless", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.emrserverless", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "emrserverless" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-emrserverless", - "module": "aws_cdk.aws_emrserverless" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-emrserverless" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::EMRServerless", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::EMRServerless", - "aws-emrserverless" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-emrserverless/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-emrserverless/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-emrserverless/test/emrserverless.test.ts b/packages/@aws-cdk/aws-emrserverless/test/emrserverless.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-emrserverless/test/emrserverless.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-events-targets/.eslintrc.js b/packages/@aws-cdk/aws-events-targets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-events-targets/.gitignore b/packages/@aws-cdk/aws-events-targets/.gitignore deleted file mode 100644 index 402f2541a4f30..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -.cdk.staging - -lib/sdk-api-metadata.json -!.eslintrc.js -!jest.config.js -!build-tools/*.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-events-targets/.npmignore b/packages/@aws-cdk/aws-events-targets/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-events-targets/LICENSE b/packages/@aws-cdk/aws-events-targets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-events-targets/NOTICE b/packages/@aws-cdk/aws-events-targets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-events-targets/README.md b/packages/@aws-cdk/aws-events-targets/README.md deleted file mode 100644 index 7dc1c9116b720..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/README.md +++ /dev/null @@ -1,347 +0,0 @@ -# Event Targets for Amazon EventBridge - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library contains integration classes to send Amazon EventBridge to any -number of supported AWS Services. Instances of these classes should be passed -to the `rule.addTarget()` method. - -Currently supported are: - -* [Start a CodeBuild build](#start-a-codebuild-build) -* [Start a CodePipeline pipeline](#start-a-codepipeline-pipeline) -* Run an ECS task -* [Invoke a Lambda function](#invoke-a-lambda-function) -* [Invoke a API Gateway REST API](#invoke-an-api-gateway-rest-api) -* Publish a message to an SNS topic -* Send a message to an SQS queue -* [Start a StepFunctions state machine](#start-a-stepfunctions-state-machine) -* [Queue a Batch job](#queue-a-batch-job) -* Make an AWS API call -* Put a record to a Kinesis stream -* [Log an event into a LogGroup](#log-an-event-into-a-loggroup) -* Put a record to a Kinesis Data Firehose stream -* [Put an event on an EventBridge bus](#put-an-event-on-an-eventbridge-bus) -* [Send an event to EventBridge API Destination](#invoke-an-api-destination) - -See the README of the `@aws-cdk/aws-events` library for more information on -EventBridge. - -## Event retry policy and using dead-letter queues - -The Codebuild, CodePipeline, Lambda, StepFunctions, LogGroup, SQSQueue, SNSTopic and ECSTask targets support attaching a [dead letter queue and setting retry policies](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html). See the [lambda example](#invoke-a-lambda-function). -Use [escape hatches](https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html) for the other target types. - -## Invoke a Lambda function - -Use the `LambdaFunction` target to invoke a lambda function. - -The code snippet below creates an event rule with a Lambda function as a target -triggered for every events from `aws.ec2` source. You can optionally attach a -[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html). - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -const fn = new lambda.Function(this, 'MyFunc', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline(`exports.handler = handler.toString()`), -}); - -const rule = new events.Rule(this, 'rule', { - eventPattern: { - source: ["aws.ec2"], - }, -}); - -const queue = new sqs.Queue(this, 'Queue'); - -rule.addTarget(new targets.LambdaFunction(fn, { - deadLetterQueue: queue, // Optional: add a dead letter queue - maxEventAge: cdk.Duration.hours(2), // Optional: set the maxEventAge retry policy - retryAttempts: 2, // Optional: set the max number of retry attempts -})); -``` - -## Log an event into a LogGroup - -Use the `LogGroup` target to log your events in a CloudWatch LogGroup. - -For example, the following code snippet creates an event rule with a CloudWatch LogGroup as a target. -Every events sent from the `aws.ec2` source will be sent to the CloudWatch LogGroup. - -```ts -import * as logs from '@aws-cdk/aws-logs'; - -const logGroup = new logs.LogGroup(this, 'MyLogGroup', { - logGroupName: 'MyLogGroup', -}); - -const rule = new events.Rule(this, 'rule', { - eventPattern: { - source: ["aws.ec2"], - }, -}); - -rule.addTarget(new targets.CloudWatchLogGroup(logGroup)); -``` - -A rule target input can also be specified to modify the event that is sent to the log group. -Unlike other event targets, CloudWatchLogs requires a specific input template format. - -```ts -import * as logs from '@aws-cdk/aws-logs'; -declare const logGroup: logs.LogGroup; -declare const rule: events.Rule; - -rule.addTarget(new targets.CloudWatchLogGroup(logGroup, { - logEvent: targets.LogGroupTargetInput({ - timestamp: events.EventField.from('$.time'), - message: events.EventField.from('$.detail-type'), - }), -})); -``` - -If you want to use static values to overwrite the `message` make sure that you provide a `string` -value. - -```ts -import * as logs from '@aws-cdk/aws-logs'; -declare const logGroup: logs.LogGroup; -declare const rule: events.Rule; - -rule.addTarget(new targets.CloudWatchLogGroup(logGroup, { - logEvent: targets.LogGroupTargetInput({ - message: JSON.stringify({ - CustomField: 'CustomValue', - }), - }), -})); -``` - -## Start a CodeBuild build - -Use the `CodeBuildProject` target to trigger a CodeBuild project. - -The code snippet below creates a CodeCommit repository that triggers a CodeBuild project -on commit to the master branch. You can optionally attach a -[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html). - -```ts -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; - -const repo = new codecommit.Repository(this, 'MyRepo', { - repositoryName: 'aws-cdk-codebuild-events', -}); - -const project = new codebuild.Project(this, 'MyProject', { - source: codebuild.Source.codeCommit({ repository: repo }), -}); - -const deadLetterQueue = new sqs.Queue(this, 'DeadLetterQueue'); - -// trigger a build when a commit is pushed to the repo -const onCommitRule = repo.onCommit('OnCommit', { - target: new targets.CodeBuildProject(project, { - deadLetterQueue: deadLetterQueue, - }), - branches: ['master'], -}); -``` - -## Start a CodePipeline pipeline - -Use the `CodePipeline` target to trigger a CodePipeline pipeline. - -The code snippet below creates a CodePipeline pipeline that is triggered every hour - -```ts -import * as codepipeline from '@aws-cdk/aws-codepipeline'; - -const pipeline = new codepipeline.Pipeline(this, 'Pipeline'); - -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.expression('rate(1 hour)'), -}); - -rule.addTarget(new targets.CodePipeline(pipeline)); -``` - -## Start a StepFunctions state machine - -Use the `SfnStateMachine` target to trigger a State Machine. - -The code snippet below creates a Simple StateMachine that is triggered every minute with a -dummy object as input. -You can optionally attach a -[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html) -to the target. - -```ts -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; - -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.rate(cdk.Duration.minutes(1)), -}); - -const dlq = new sqs.Queue(this, 'DeadLetterQueue'); - -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('events.amazonaws.com'), -}); -const stateMachine = new sfn.StateMachine(this, 'SM', { - definition: new sfn.Wait(this, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) }) -}); - -rule.addTarget(new targets.SfnStateMachine(stateMachine, { - input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }), - deadLetterQueue: dlq, - role: role -})); -``` - -## Queue a Batch job - -Use the `BatchJob` target to queue a Batch job. - -The code snippet below creates a Simple JobQueue that is triggered every hour with a -dummy object as input. -You can optionally attach a -[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html) -to the target. - -```ts -import * as batch from '@aws-cdk/aws-batch'; -import { ContainerImage } from '@aws-cdk/aws-ecs'; - -const jobQueue = new batch.JobQueue(this, 'MyQueue', { - computeEnvironments: [ - { - computeEnvironment: new batch.ComputeEnvironment(this, 'ComputeEnvironment', { - managed: false, - }), - order: 1, - }, - ], -}); - -const jobDefinition = new batch.JobDefinition(this, 'MyJob', { - container: { - image: ContainerImage.fromRegistry('test-repo'), - }, -}); - -const queue = new sqs.Queue(this, 'Queue'); - -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.rate(cdk.Duration.hours(1)), -}); - -rule.addTarget(new targets.BatchJob( - jobQueue.jobQueueArn, - jobQueue, - jobDefinition.jobDefinitionArn, - jobDefinition, { - deadLetterQueue: queue, - event: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }), - retryAttempts: 2, - maxEventAge: cdk.Duration.hours(2), - }, -)); -``` - -## Invoke an API Gateway REST API - -Use the `ApiGateway` target to trigger a REST API. - -The code snippet below creates a Api Gateway REST API that is invoked every hour. - -```ts -import * as api from '@aws-cdk/aws-apigateway'; -import * as lambda from '@aws-cdk/aws-lambda'; - -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.rate(cdk.Duration.minutes(1)), -}); - -const fn = new lambda.Function( this, 'MyFunc', { - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline( 'exports.handler = e => {}' ), -} ); - -const restApi = new api.LambdaRestApi( this, 'MyRestAPI', { handler: fn } ); - -const dlq = new sqs.Queue(this, 'DeadLetterQueue'); - -rule.addTarget( - new targets.ApiGateway( restApi, { - path: '/*/test', - method: 'GET', - stage: 'prod', - pathParameterValues: ['path-value'], - headerParameters: { - Header1: 'header1', - }, - queryStringParameters: { - QueryParam1: 'query-param-1', - }, - deadLetterQueue: dlq - } ), -) -``` - -## Invoke an API Destination - -Use the `targets.ApiDestination` target to trigger an external API. You need to -create an `events.Connection` and `events.ApiDestination` as well. - -The code snippet below creates an external destination that is invoked every hour. - -```ts -const connection = new events.Connection(this, 'Connection', { - authorization: events.Authorization.apiKey('x-api-key', SecretValue.secretsManager('ApiSecretName')), - description: 'Connection with API Key x-api-key', -}); - -const destination = new events.ApiDestination(this, 'Destination', { - connection, - endpoint: 'https://example.com', - description: 'Calling example.com with API key x-api-key', -}); - -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.rate(cdk.Duration.minutes(1)), - targets: [new targets.ApiDestination(destination)], -}); -``` - -## Put an event on an EventBridge bus - -Use the `EventBus` target to route event to a different EventBus. - -The code snippet below creates the scheduled event rule that route events to an imported event bus. - -```ts -const rule = new events.Rule(this, 'Rule', { - schedule: events.Schedule.expression('rate(1 minute)'), -}); - -rule.addTarget(new targets.EventBus( - events.EventBus.fromEventBusArn( - this, - 'External', - `arn:aws:events:eu-west-1:999999999999:event-bus/test-bus`, - ), -)); -``` diff --git a/packages/@aws-cdk/aws-events-targets/jest.config.js b/packages/@aws-cdk/aws-events-targets/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-events-targets/lib/api-destination.ts b/packages/@aws-cdk/aws-events-targets/lib/api-destination.ts deleted file mode 100644 index 675077f44dcf6..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/api-destination.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { addToDeadLetterQueueResourcePolicy, bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; - -/** - * Customize the EventBridge Api Destinations Target - */ -export interface ApiDestinationProps extends TargetBaseProps { - /** - * The event to send - * - * @default - the entire EventBridge event - */ - readonly event?: events.RuleTargetInput; - - /** - * The role to assume before invoking the target - * - * @default - a new role will be created - */ - readonly eventRole?: iam.IRole; - - /** - * Additional headers sent to the API Destination - * - * These are merged with headers specified on the Connection, with - * the headers on the Connection taking precedence. - * - * You can only specify secret values on the Connection. - * - * @default - none - */ - readonly headerParameters?: Record; - - /** - * Path parameters to insert in place of path wildcards (`*`). - * - * If the API destination has a wilcard in the path, these path parts - * will be inserted in that place. - * - * @default - none - */ - readonly pathParameterValues?: string[] - - /** - * Additional query string parameters sent to the API Destination - * - * These are merged with headers specified on the Connection, with - * the headers on the Connection taking precedence. - * - * You can only specify secret values on the Connection. - * - * @default - none - */ - readonly queryStringParameters?: Record; -} - -/** - * Use an API Destination rule target. - */ -export class ApiDestination implements events.IRuleTarget { - constructor( - private readonly apiDestination: events.IApiDestination, - private readonly props: ApiDestinationProps = {}, - ) { } - - /** - * Returns a RuleTarget that can be used to trigger API destinations - * from an EventBridge event. - */ - public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { - const httpParameters: events.CfnRule.HttpParametersProperty | undefined = - this.props.headerParameters ?? - this.props.pathParameterValues ?? - this.props.queryStringParameters - ? { - headerParameters: this.props.headerParameters, - pathParameterValues: this.props.pathParameterValues, - queryStringParameters: this.props.queryStringParameters, - } : undefined; - - if (this.props?.deadLetterQueue) { - addToDeadLetterQueueResourcePolicy(_rule, this.props.deadLetterQueue); - } - - const role = this.props?.eventRole ?? singletonEventRole(this.apiDestination); - role.addToPrincipalPolicy(new iam.PolicyStatement({ - resources: [this.apiDestination.apiDestinationArn], - actions: ['events:InvokeApiDestination'], - })); - - return { - ...(this.props ? bindBaseTargetConfig(this.props) : {}), - arn: this.apiDestination.apiDestinationArn, - role, - input: this.props.event, - targetResource: this.apiDestination, - httpParameters, - }; - } -} diff --git a/packages/@aws-cdk/aws-events-targets/lib/codepipeline.ts b/packages/@aws-cdk/aws-events-targets/lib/codepipeline.ts deleted file mode 100644 index 1f197d4565a3f..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/codepipeline.ts +++ /dev/null @@ -1,43 +0,0 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; - -/** - * Customization options when creating a `CodePipeline` event target. - */ -export interface CodePipelineTargetOptions extends TargetBaseProps { - /** - * The role to assume before invoking the target - * (i.e., the pipeline) when the given rule is triggered. - * - * @default - a new role will be created - */ - readonly eventRole?: iam.IRole; -} - -/** - * Allows the pipeline to be used as an EventBridge rule target. - */ -export class CodePipeline implements events.IRuleTarget { - constructor( - private readonly pipeline: codepipeline.IPipeline, - private readonly options: CodePipelineTargetOptions = {}) { - } - - public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { - const role = this.options.eventRole || singletonEventRole(this.pipeline); - role.addToPrincipalPolicy(new iam.PolicyStatement({ - resources: [this.pipeline.pipelineArn], - actions: ['codepipeline:StartPipelineExecution'], - })); - - return { - ...bindBaseTargetConfig(this.options), - id: '', - arn: this.pipeline.pipelineArn, - role, - targetResource: this.pipeline, - }; - } -} diff --git a/packages/@aws-cdk/aws-events-targets/lib/event-bus.ts b/packages/@aws-cdk/aws-events-targets/lib/event-bus.ts deleted file mode 100644 index eb739c0b37296..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/event-bus.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { singletonEventRole, addToDeadLetterQueueResourcePolicy } from './util'; - -/** - * Configuration properties of an Event Bus event - * - * Cannot extend TargetBaseProps. Retry policy is not supported for Event bus targets. - */ -export interface EventBusProps { - /** - * Role to be used to publish the event - * - * @default a new role is created. - */ - readonly role?: iam.IRole; - - /** - * The SQS queue to be used as deadLetterQueue. - * Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). - * - * The events not successfully delivered are automatically retried for a specified period of time, - * depending on the retry policy of the target. - * If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue. - * - * @default - no dead-letter queue - */ - readonly deadLetterQueue?: sqs.IQueue; -} - -/** - * Notify an existing Event Bus of an event - */ -export class EventBus implements events.IRuleTarget { - constructor(private readonly eventBus: events.IEventBus, private readonly props: EventBusProps = {}) { } - - bind(rule: events.IRule, _id?: string): events.RuleTargetConfig { - const role = this.props.role ?? singletonEventRole(rule); - role.addToPrincipalPolicy(this.putEventStatement()); - - if (this.props.deadLetterQueue) { - addToDeadLetterQueueResourcePolicy(rule, this.props.deadLetterQueue); - } - - return { - arn: this.eventBus.eventBusArn, - deadLetterConfig: this.props.deadLetterQueue ? { arn: this.props.deadLetterQueue?.queueArn } : undefined, - role, - }; - } - - private putEventStatement() { - return new iam.PolicyStatement({ - actions: ['events:PutEvents'], - resources: [this.eventBus.eventBusArn], - }); - } -} diff --git a/packages/@aws-cdk/aws-events-targets/lib/lambda.ts b/packages/@aws-cdk/aws-events-targets/lib/lambda.ts deleted file mode 100644 index 8dd455ce51056..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/lambda.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { addLambdaPermission, addToDeadLetterQueueResourcePolicy, TargetBaseProps, bindBaseTargetConfig } from './util'; - -/** - * Customize the Lambda Event Target - */ -export interface LambdaFunctionProps extends TargetBaseProps { - /** - * The event to send to the Lambda - * - * This will be the payload sent to the Lambda Function. - * - * @default the entire EventBridge event - */ - readonly event?: events.RuleTargetInput; -} - -/** - * Use an AWS Lambda function as an event rule target. - */ -export class LambdaFunction implements events.IRuleTarget { - constructor(private readonly handler: lambda.IFunction, private readonly props: LambdaFunctionProps = {}) { - - } - - /** - * Returns a RuleTarget that can be used to trigger this Lambda as a - * result from an EventBridge event. - */ - public bind(rule: events.IRule, _id?: string): events.RuleTargetConfig { - // Allow handler to be called from rule - addLambdaPermission(rule, this.handler); - - if (this.props.deadLetterQueue) { - addToDeadLetterQueueResourcePolicy(rule, this.props.deadLetterQueue); - } - - return { - ...bindBaseTargetConfig(this.props), - arn: this.handler.functionArn, - input: this.props.event, - targetResource: this.handler, - }; - } -} diff --git a/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts b/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts deleted file mode 100644 index eb45c9d234144..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/log-group-resource-policy.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import { Construct } from 'constructs'; - -/** - * Properties to configure a log group resource policy - */ -export interface LogGroupResourcePolicyProps { - /** - * The log group resource policy name - */ - readonly policyName?: string; - /** - * The policy statements for the log group resource logs - */ - readonly policyStatements: [iam.PolicyStatement]; -} - -/** - * Creates LogGroup resource policies. - */ -export class LogGroupResourcePolicy extends cr.AwsCustomResource { - constructor(scope: Construct, id: string, props: LogGroupResourcePolicyProps) { - const policyDocument = new iam.PolicyDocument({ - statements: props.policyStatements, - }); - - let policyName = props.policyName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }); - - super(scope, id, { - resourceType: 'Custom::CloudwatchLogResourcePolicy', - onUpdate: { - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: policyName, - policyDocument: JSON.stringify(policyDocument), - }, - physicalResourceId: cr.PhysicalResourceId.of(id), - }, - onDelete: { - service: 'CloudWatchLogs', - action: 'deleteResourcePolicy', - parameters: { - policyName: policyName, - }, - ignoreErrorCodesMatching: '400', - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - // putResourcePolicy and deleteResourcePolicy don't support resource-level permissions. We must specify all resources ("*"). - // https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatchlogs.html - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), - }); - } -} diff --git a/packages/@aws-cdk/aws-events-targets/lib/log-group.ts b/packages/@aws-cdk/aws-events-targets/lib/log-group.ts deleted file mode 100644 index 4374a85a74630..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/log-group.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import { RuleTargetInputProperties, RuleTargetInput, EventField, IRule } from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { ArnFormat, Stack } from '@aws-cdk/core'; -import { LogGroupResourcePolicy } from './log-group-resource-policy'; -import { TargetBaseProps, bindBaseTargetConfig } from './util'; - -/** - * Options used when creating a target input template - */ -export interface LogGroupTargetInputOptions { - /** - * The timestamp that will appear in the CloudWatch Logs record - * - * @default EventField.time - */ - readonly timestamp?: any; - - /** - * The value provided here will be used in the Log "message" field. - * - * This field must be a string. If an object is passed (e.g. JSON data) - * it will not throw an error, but the message that makes it to - * CloudWatch logs will be incorrect. This is a likely scenario if - * doing something like: EventField.fromPath('$.detail') since in most cases - * the `detail` field contains JSON data. - * - * @default EventField.detailType - */ - readonly message?: any; -} - -/** - * The input to send to the CloudWatch LogGroup target - */ -export abstract class LogGroupTargetInput { - - /** - * Pass a JSON object to the the log group event target - * - * May contain strings returned by `EventField.from()` to substitute in parts of the - * matched event. - */ - public static fromObject(options?: LogGroupTargetInputOptions): RuleTargetInput { - return RuleTargetInput.fromObject({ - timestamp: options?.timestamp ?? EventField.time, - message: options?.message ?? EventField.detailType, - }); - }; - - /** - * Return the input properties for this input object - */ - public abstract bind(rule: IRule): RuleTargetInputProperties; -} - -/** - * Customize the CloudWatch LogGroup Event Target - */ -export interface LogGroupProps extends TargetBaseProps { - /** - * The event to send to the CloudWatch LogGroup - * - * This will be the event logged into the CloudWatch LogGroup - * - * @default - the entire EventBridge event - * @deprecated use logEvent instead - */ - readonly event?: events.RuleTargetInput; - - /** - * The event to send to the CloudWatch LogGroup - * - * This will be the event logged into the CloudWatch LogGroup - * - * @default - the entire EventBridge event - */ - readonly logEvent?: LogGroupTargetInput; -} - -/** - * Use an AWS CloudWatch LogGroup as an event rule target. - */ -export class CloudWatchLogGroup implements events.IRuleTarget { - private target?: RuleTargetInputProperties; - constructor(private readonly logGroup: logs.ILogGroup, private readonly props: LogGroupProps = {}) {} - - /** - * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup - */ - public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { - // Use a custom resource to set the log group resource policy since it is not supported by CDK and cfn. - const resourcePolicyId = `EventsLogGroupPolicy${cdk.Names.nodeUniqueId(_rule.node)}`; - - const logGroupStack = cdk.Stack.of(this.logGroup); - - if (this.props.event && this.props.logEvent) { - throw new Error('Only one of "event" or "logEvent" can be specified'); - } - - this.target = this.props.event?.bind(_rule); - if (this.target?.inputPath || this.target?.input) { - throw new Error('CloudWatchLogGroup targets does not support input or inputPath'); - } - - _rule.node.addValidation({ validate: () => this.validateInputTemplate() }); - - if (!this.logGroup.node.tryFindChild(resourcePolicyId)) { - new LogGroupResourcePolicy(logGroupStack, resourcePolicyId, { - policyStatements: [new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], - resources: [this.logGroup.logGroupArn], - principals: [new iam.ServicePrincipal('events.amazonaws.com')], - })], - }); - } - - return { - ...bindBaseTargetConfig(this.props), - arn: logGroupStack.formatArn({ - service: 'logs', - resource: 'log-group', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - resourceName: this.logGroup.logGroupName, - }), - input: this.props.event ?? this.props.logEvent, - targetResource: this.logGroup, - }; - } - - /** - * Validate that the target event input template has the correct format. - * The CloudWatchLogs target only supports a template with the format of: - * {"timestamp": (struct: A): A | undefined { - const allUndefined = Object.values(struct).every(val => val === undefined); - return allUndefined ? undefined : struct; -} - -/** - * Aspect for upgrading function versions when the feature flag - * provided feature flag present. This can be necessary when the feature flag - * changes the function hash, as such changes must be associated with a new - * version. This aspect will change the function description in these cases, - * which "validates" the new function hash. - */ -export class FunctionVersionUpgrade implements IAspect { - constructor(private readonly featureFlag: string, private readonly enabled=true) {} - - public visit(node: IConstruct): void { - if (node instanceof Function && - this.enabled === FeatureFlags.of(node).isEnabled(this.featureFlag)) { - const cfnFunction = node.node.defaultChild as CfnFunction; - const desc = cfnFunction.description ? `${cfnFunction.description} ` : ''; - cfnFunction.addPropertyOverride('Description', `${desc}version-hash:${calculateFunctionHash(node)}`); - } - }; -} diff --git a/packages/@aws-cdk/aws-lambda/lib/log-retention.ts b/packages/@aws-cdk/aws-lambda/lib/log-retention.ts deleted file mode 100644 index 3fe6db5e81880..0000000000000 --- a/packages/@aws-cdk/aws-lambda/lib/log-retention.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as logs from '@aws-cdk/aws-logs'; -import { Construct } from 'constructs'; - -/** - * Retry options for all AWS API calls. - */ -export interface LogRetentionRetryOptions extends logs.LogRetentionRetryOptions { -} - -/** - * Construction properties for a LogRetention. - * - * @deprecated use `LogRetentionProps` from '@aws-cdk/aws-logs' instead - */ -export interface LogRetentionProps extends logs.LogRetentionProps { -} - -/** - * Creates a custom resource to control the retention policy of a CloudWatch Logs - * log group. The log group is created if it doesn't already exist. The policy - * is removed when `retentionDays` is `undefined` or equal to `Infinity`. - * - * @deprecated use `LogRetention` from '@aws-cdk/aws-logs' instead - */ -export class LogRetention extends logs.LogRetention { - constructor(scope: Construct, id: string, props: LogRetentionProps) { - super(scope, id, { ...props }); - } -} diff --git a/packages/@aws-cdk/aws-lambda/lib/scalable-attribute-api.ts b/packages/@aws-cdk/aws-lambda/lib/scalable-attribute-api.ts deleted file mode 100644 index de1501cdee0f1..0000000000000 --- a/packages/@aws-cdk/aws-lambda/lib/scalable-attribute-api.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import { IConstruct } from 'constructs'; - -/** - * Interface for scalable attributes - */ -export interface IScalableFunctionAttribute extends IConstruct { - /** - * Scale out or in to keep utilization at a given level. The utilization is tracked by the - * LambdaProvisionedConcurrencyUtilization metric, emitted by lambda. See: - * https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency - */ - scaleOnUtilization(options: UtilizationScalingOptions): void; - /** - * Scale out or in based on schedule. - */ - scaleOnSchedule(id: string, actions: appscaling.ScalingSchedule): void; -} - -/** - * Options for enabling Lambda utilization tracking - */ -export interface UtilizationScalingOptions extends appscaling.BaseTargetTrackingProps { - /** - * Utilization target for the attribute. For example, .5 indicates that 50 percent of allocated provisioned concurrency is in use. - */ - readonly utilizationTarget: number; -} - -/** - * Properties for enabling Lambda autoscaling - */ -export interface AutoScalingOptions { - /** - * Minimum capacity to scale to - * - * @default 1 - */ - readonly minCapacity?: number; - - /** - * Maximum capacity to scale to - */ - readonly maxCapacity: number; -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/package.json b/packages/@aws-cdk/aws-lambda/package.json deleted file mode 100644 index 9c5efe90094cd..0000000000000 --- a/packages/@aws-cdk/aws-lambda/package.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "name": "@aws-cdk/aws-lambda", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Lambda", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.lambda", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "lambda" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Lambda", - "packageId": "Amazon.CDK.AWS.Lambda", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-lambda", - "module": "aws_cdk.aws_lambda", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-lambda" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Lambda", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "nyc": { - "statements": 75, - "lines": 75 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "lambda" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/cfnspec": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "@types/lodash": "^4.14.191", - "@aws-cdk/aws-ssm": "0.0.0", - "jest": "^27.5.1", - "lodash": "^4.17.21" - }, - "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codeguruprofiler": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-signer": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codeguruprofiler": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-signer": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "integ-return-type:@aws-cdk/aws-lambda.IEventSource.bind", - "props-physical-name:@aws-cdk/aws-lambda.VersionProps", - "props-physical-name:@aws-cdk/aws-lambda.EventSourceMappingProps", - "docs-public-apis:@aws-cdk/aws-lambda.Runtime.runtimeEquals", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.OTHER", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.RUBY", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.GO", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.DOTNET_CORE", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.PYTHON", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.JAVA", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily.NODEJS", - "docs-public-apis:@aws-cdk/aws-lambda.Alias.lambda", - "docs-public-apis:@aws-cdk/aws-lambda.Alias.fromAliasAttributes", - "docs-public-apis:@aws-cdk/aws-lambda.FunctionBase", - "docs-public-apis:@aws-cdk/aws-lambda.QualifiedFunctionBase", - "docs-public-apis:@aws-cdk/aws-lambda.QualifiedFunctionBase.lambda", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeFamily", - "docs-public-apis:@aws-cdk/aws-lambda.Runtime.toString", - "docs-public-apis:@aws-cdk/aws-lambda.Version.fromVersionAttributes", - "docs-public-apis:@aws-cdk/aws-lambda.AliasAttributes", - "docs-public-apis:@aws-cdk/aws-lambda.AliasAttributes.aliasName", - "docs-public-apis:@aws-cdk/aws-lambda.AliasAttributes.aliasVersion", - "docs-public-apis:@aws-cdk/aws-lambda.EventSourceMappingOptions", - "props-default-doc:@aws-cdk/aws-lambda.FunctionAttributes.role", - "props-default-doc:@aws-cdk/aws-lambda.FunctionAttributes.securityGroup", - "props-default-doc:@aws-cdk/aws-lambda.FunctionAttributes.securityGroupId", - "docs-public-apis:@aws-cdk/aws-lambda.FunctionProps", - "docs-public-apis:@aws-cdk/aws-lambda.IAlias", - "docs-public-apis:@aws-cdk/aws-lambda.IFunction", - "docs-public-apis:@aws-cdk/aws-lambda.ILayerVersion", - "docs-public-apis:@aws-cdk/aws-lambda.IVersion", - "docs-public-apis:@aws-cdk/aws-lambda.LambdaRuntimeProps", - "props-default-doc:@aws-cdk/aws-lambda.LayerVersionAttributes.compatibleRuntimes", - "props-default-doc:@aws-cdk/aws-lambda.LayerVersionPermission.organizationId", - "docs-public-apis:@aws-cdk/aws-lambda.LayerVersionProps", - "props-default-doc:@aws-cdk/aws-lambda.Permission.sourceAccount", - "props-default-doc:@aws-cdk/aws-lambda.Permission.sourceArn", - "docs-public-apis:@aws-cdk/aws-lambda.ResourceBindOptions", - "docs-public-apis:@aws-cdk/aws-lambda.VersionAttributes", - "props-physical-name:@aws-cdk/aws-lambda.EventInvokeConfigProps", - "props-physical-name:@aws-cdk/aws-lambda.CodeSigningConfigProps", - "props-physical-name:@aws-cdk/aws-lambda.FunctionUrlProps", - "from-method:@aws-cdk/aws-lambda.FunctionUrl", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeManagementMode.mode", - "docs-public-apis:@aws-cdk/aws-lambda.RuntimeManagementMode.arn" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "nozem": { - "ostools": [ - "docker" - ] - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-lambda/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-lambda/rosetta/default.ts-fixture deleted file mode 100644 index 3519cb4d48595..0000000000000 --- a/packages/@aws-cdk/aws-lambda/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -// Fixture with packages imported, but nothing else -import * as path from 'path'; -import { Construct } from 'constructs'; -import { Aspects, CfnOutput, DockerImage, Duration, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as iam from '@aws-cdk/aws-iam'; -import { LAMBDA_RECOGNIZE_VERSION_PROPS, LAMBDA_RECOGNIZE_LAYER_VERSION } from '@aws-cdk/cx-api'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-lambda/test/alias.test.ts b/packages/@aws-cdk/aws-lambda/test/alias.test.ts deleted file mode 100644 index 5b0179a40abf4..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/alias.test.ts +++ /dev/null @@ -1,660 +0,0 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Lazy, Stack } from '@aws-cdk/core'; -import * as lambda from '../lib'; - -describe('alias', () => { - testDeprecated('version and aliases', () => { - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.addVersion('1'); - - new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Version', { - FunctionName: { Ref: 'MyLambdaCCE802FB' }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - FunctionName: { Ref: 'MyLambdaCCE802FB' }, - FunctionVersion: stack.resolve(version.version), - Name: 'prod', - }); - }); - - test('can create an alias to $LATEST', () => { - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - new lambda.Alias(stack, 'Alias', { - aliasName: 'latest', - version: fn.latestVersion, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - FunctionName: { Ref: 'MyLambdaCCE802FB' }, - FunctionVersion: '$LATEST', - Name: 'latest', - }); - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Version', 0); - }); - - testDeprecated('can use newVersion to create a new Version', () => { - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.addVersion('NewVersion'); - - new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Version', { - FunctionName: { Ref: 'MyLambdaCCE802FB' }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - FunctionName: { Ref: 'MyLambdaCCE802FB' }, - Name: 'prod', - }); - }); - - testDeprecated('can add additional versions to alias', () => { - const stack = new Stack(); - - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version1 = fn.addVersion('1'); - const version2 = fn.addVersion('2'); - - new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: version1, - additionalVersions: [{ version: version2, weight: 0.1 }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - FunctionVersion: stack.resolve(version1.version), - RoutingConfig: { - AdditionalVersionWeights: [ - { - FunctionVersion: stack.resolve(version2.version), - FunctionWeight: 0.1, - }, - ], - }, - }); - }); - - testDeprecated('version and aliases with provisioned execution', () => { - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const pce = 5; - const version = fn.addVersion('1', undefined, 'testing', pce); - - new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version, - provisionedConcurrentExecutions: pce, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Version', { - ProvisionedConcurrencyConfig: { - ProvisionedConcurrentExecutions: 5, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - FunctionVersion: stack.resolve(version.version), - Name: 'prod', - ProvisionedConcurrencyConfig: { - ProvisionedConcurrentExecutions: 5, - }, - }); - }); - - test('sanity checks on version weights', () => { - const stack = new Stack(); - - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.currentVersion; - - // WHEN: Individual weight too high - expect(() => { - new lambda.Alias(stack, 'Alias1', { - aliasName: 'prod', - version, - additionalVersions: [{ version, weight: 5 }], - }); - }).toThrow(); - - // WHEN: Sum too high - expect(() => { - new lambda.Alias(stack, 'Alias2', { - aliasName: 'prod', - version, - additionalVersions: [{ version, weight: 0.5 }, { version, weight: 0.6 }], - }); - }).toThrow(); - }); - - test('metric adds Resource: aliasArn to dimensions', () => { - const stack = new Stack(); - - // GIVEN - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.currentVersion; - const alias = new lambda.Alias(stack, 'Alias', { aliasName: 'prod', version }); - - // WHEN - new cloudwatch.Alarm(stack, 'Alarm', { - metric: alias.metric('Test'), - alarmName: 'Test', - threshold: 1, - evaluationPeriods: 1, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { - Dimensions: [{ - Name: 'FunctionName', - Value: { - Ref: 'MyLambdaCCE802FB', - }, - }, { - Name: 'Resource', - Value: { - 'Fn::Join': [ - '', - [ - { Ref: 'MyLambdaCCE802FB' }, - ':prod', - ], - ], - }, - }], - }); - }); - - testDeprecated('sanity checks provisionedConcurrentExecutions', () => { - const stack = new Stack(); - const pce = -1; - - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN: Alias provisionedConcurrencyConfig less than 0 - expect(() => { - new lambda.Alias(stack, 'Alias1', { - aliasName: 'prod', - version: fn.currentVersion, - provisionedConcurrentExecutions: pce, - }); - }).toThrow(); - - // WHEN: Version provisionedConcurrencyConfig less than 0 - expect(() => { - new lambda.Version(stack, 'Version 1', { - lambda: fn, - codeSha256: undefined, - description: undefined, - provisionedConcurrentExecutions: pce, - }); - }).toThrow(); - - // WHEN: Adding a version provisionedConcurrencyConfig less than 0 - expect(() => { - fn.addVersion('1', undefined, undefined, pce); - }).toThrow(); - }); - - test('alias exposes real Lambdas role', () => { - const stack = new Stack(); - - // GIVEN - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.currentVersion; - const alias = new lambda.Alias(stack, 'Alias', { aliasName: 'prod', version }); - - // THEN - expect(alias.role).toEqual(fn.role); - }); - - test('functionName is derived from the aliasArn so that dependencies are sound', () => { - const stack = new Stack(); - - // GIVEN - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.currentVersion; - const alias = new lambda.Alias(stack, 'Alias', { aliasName: 'prod', version }); - - // WHEN - expect(stack.resolve(alias.functionName)).toEqual({ - 'Fn::Join': [ - '', - [ - { - 'Fn::Select': [ - 6, - { - 'Fn::Split': [ - ':', - { - Ref: 'Alias325C5727', - }, - ], - }, - ], - }, - ':prod', - ], - ], - }); - }); - - test('with event invoke config', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - onSuccess: { - bind: () => ({ - destination: 'on-success-arn', - }), - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { - FunctionName: { - Ref: 'fn5FF616E3', - }, - Qualifier: { - 'Fn::Select': [ - 7, - { - 'Fn::Split': [ - ':', - { - Ref: 'Alias325C5727', - }, - ], - }, - ], - }, - DestinationConfig: { - OnSuccess: { - Destination: 'on-success-arn', - }, - }, - }); - }); - - test('throws when calling configureAsyncInvoke on already configured alias', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - onSuccess: { - bind: () => ({ - destination: 'on-success-arn', - }), - }, - }); - - // THEN - expect(() => alias.configureAsyncInvoke({ retryAttempts: 0 })).toThrow(/An EventInvokeConfig has already been configured/); - }); - - test('event invoke config on imported alias', () => { - // GIVEN - const stack = new Stack(); - const fn = lambda.Version.fromVersionArn(stack, 'Fn', 'arn:aws:lambda:region:account-id:function:function-name:version'); - const alias = lambda.Alias.fromAliasAttributes(stack, 'Alias', { aliasName: 'alias-name', aliasVersion: fn }); - - // WHEN - alias.configureAsyncInvoke({ - retryAttempts: 1, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { - FunctionName: 'function-name', - Qualifier: 'alias-name', - MaximumRetryAttempts: 1, - }); - }); - - testDeprecated('can enable AutoScaling on aliases', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - }); - - // WHEN - alias.addAutoScaling({ maxCapacity: 5 }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MinCapacity: 1, - MaxCapacity: 5, - ResourceId: Match.objectLike({ - 'Fn::Join': Match.arrayWith([Match.arrayWith([ - 'function:', - Match.objectLike({ - 'Fn::Select': Match.arrayWith([ - { - 'Fn::Split': Match.arrayWith([ - { Ref: 'Alias325C5727' }, - ]), - }, - ]), - }), - ':prod', - ])]), - }), - }); - }); - - test('can enable AutoScaling on aliases with Provisioned Concurrency set', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - provisionedConcurrentExecutions: 10, - }); - - // WHEN - alias.addAutoScaling({ maxCapacity: 5 }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - MinCapacity: 1, - MaxCapacity: 5, - ResourceId: Match.objectLike({ - 'Fn::Join': Match.arrayWith([Match.arrayWith([ - 'function:', - Match.objectLike({ - 'Fn::Select': Match.arrayWith([ - { - 'Fn::Split': Match.arrayWith([ - { Ref: 'Alias325C5727' }, - ]), - }, - ]), - }), - ':prod', - ])]), - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - ProvisionedConcurrencyConfig: { - ProvisionedConcurrentExecutions: 10, - }, - }); - }); - - test('validation for utilizationTarget does not fail when using Tokens', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - provisionedConcurrentExecutions: 10, - }); - - // WHEN - const target = alias.addAutoScaling({ maxCapacity: 5 }); - - target.scaleOnUtilization({ utilizationTarget: Lazy.number({ produce: () => 0.95 }) }); - - // THEN: no exception - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { - PolicyType: 'TargetTrackingScaling', - TargetTrackingScalingPolicyConfiguration: { - PredefinedMetricSpecification: { PredefinedMetricType: 'LambdaProvisionedConcurrencyUtilization' }, - TargetValue: 0.95, - }, - }); - }); - - test('cannot enable AutoScaling twice on same property', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - }); - - // WHEN - alias.addAutoScaling({ maxCapacity: 5 }); - - // THEN - expect(() => alias.addAutoScaling({ maxCapacity: 8 })).toThrow(/AutoScaling already enabled for this alias/); - }); - - test('error when specifying invalid utilization value when AutoScaling on utilization', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - }); - - // WHEN - const target = alias.addAutoScaling({ maxCapacity: 5 }); - - // THEN - expect(() => target.scaleOnUtilization({ utilizationTarget: 0.95 })).toThrow(/Utilization Target should be between 0.1 and 0.9. Found 0.95/); - }); - - test('can autoscale on a schedule', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - }); - - // WHEN - const target = alias.addAutoScaling({ maxCapacity: 5 }); - target.scaleOnSchedule('Scheduling', { - schedule: appscaling.Schedule.cron({}), - maxCapacity: 10, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { - ScheduledActions: [ - { - ScalableTargetAction: { MaxCapacity: 10 }, - Schedule: 'cron(* * * * ? *)', - ScheduledActionName: 'Scheduling', - }, - ], - }); - }); - - test('scheduled scaling shows warning when minute is not defined in cron', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - }); - - // WHEN - const target = alias.addAutoScaling({ maxCapacity: 5 }); - target.scaleOnSchedule('Scheduling', { - schedule: appscaling.Schedule.cron({}), - maxCapacity: 10, - }); - - // THEN - Annotations.fromStack(stack).hasWarning('/Default/Alias/AliasScaling/Target', "cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead."); - }); - - test('scheduled scaling shows no warning when minute is * in cron', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version: fn.currentVersion, - }); - - // WHEN - const target = alias.addAutoScaling({ maxCapacity: 5 }); - target.scaleOnSchedule('Scheduling', { - schedule: appscaling.Schedule.cron({ minute: '*' }), - maxCapacity: 10, - }); - - // THEN - const annotations = Annotations.fromStack(stack).findWarning('*', Match.anyValue()); - expect(annotations.length).toBe(0); - }); - - test('addFunctionUrl creates a function url', () => { - // GIVEN - const stack = new Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const aliasName = 'prod'; - const alias = new lambda.Alias(stack, 'Alias', { - aliasName, - version: fn.currentVersion, - }); - - // WHEN - alias.addFunctionUrl(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Url', { - AuthType: 'AWS_IAM', - TargetFunctionArn: { - 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'], - }, - Qualifier: aliasName, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-lambda/test/function.test.ts b/packages/@aws-cdk/aws-lambda/test/function.test.ts deleted file mode 100644 index a3db177a812f4..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/function.test.ts +++ /dev/null @@ -1,3212 +0,0 @@ -import * as path from 'path'; -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import { ProfilingGroup } from '@aws-cdk/aws-codeguruprofiler'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as signer from '@aws-cdk/aws-signer'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import { Aspects, Lazy, Size } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as constructs from 'constructs'; -import * as _ from 'lodash'; -import * as lambda from '../lib'; -import { AdotLambdaLayerJavaSdkVersion } from '../lib/adot-layers'; -import { calculateFunctionHash } from '../lib/function-hash'; - -describe('function', () => { - const dockerLambdaHandlerPath = path.join(__dirname, 'docker-lambda-handler'); - test('default function', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: - { - Statement: - [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { Service: 'lambda.amazonaws.com' }, - }], - Version: '2012-10-17', - }, - ManagedPolicyArns: - [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: - { - Code: { ZipFile: 'foo' }, - Handler: 'index.handler', - Role: { 'Fn::GetAtt': ['MyLambdaServiceRole4539ECB6', 'Arn'] }, - Runtime: 'nodejs14.x', - }, - DependsOn: ['MyLambdaServiceRole4539ECB6'], - }); - }); - - test('adds policy permissions', () => { - const stack = new cdk.Stack(); - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - initialPolicy: [new iam.PolicyStatement({ actions: ['*'], resources: ['*'] })], - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: - { - Statement: - [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { Service: 'lambda.amazonaws.com' }, - }], - Version: '2012-10-17', - }, - ManagedPolicyArns: - // eslint-disable-next-line max-len - [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: '*', - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - Roles: [ - { - Ref: 'MyLambdaServiceRole4539ECB6', - }, - ], - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: { - Code: { ZipFile: 'foo' }, - Handler: 'index.handler', - Role: { 'Fn::GetAtt': ['MyLambdaServiceRole4539ECB6', 'Arn'] }, - Runtime: 'nodejs14.x', - }, - DependsOn: ['MyLambdaServiceRoleDefaultPolicy5BBC6F68', 'MyLambdaServiceRole4539ECB6'], - }); - }); - - test('fails if inline code is used for an invalid runtime', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'bar', - runtime: lambda.Runtime.DOTNET_CORE_2, - })).toThrow(); - }); - - describe('addPermissions', () => { - test('can be used to add permissions to the Lambda function', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - - fn.addPermission('S3Permission', { - action: 'lambda:*', - principal: new iam.ServicePrincipal('s3.amazonaws.com'), - sourceAccount: stack.account, - sourceArn: 'arn:aws:s3:::my_bucket', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'lambda.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: - // eslint-disable-next-line max-len - [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: { - Code: { - ZipFile: 'foo', - }, - Handler: 'bar', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'python3.9', - }, - DependsOn: [ - 'MyLambdaServiceRole4539ECB6', - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:*', - FunctionName: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - Principal: 's3.amazonaws.com', - SourceAccount: { - Ref: 'AWS::AccountId', - }, - SourceArn: 'arn:aws:s3:::my_bucket', - }); - }); - - test('can supply principalOrgID via permission property', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - const org = new iam.OrganizationPrincipal('o-xxxxxxxxxx'); - const account = new iam.AccountPrincipal('123456789012'); - - fn.addPermission('S3Permission', { - action: 'lambda:*', - principal: account, - organizationId: org.organizationId, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:*', - FunctionName: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - Principal: account.accountId, - PrincipalOrgID: org.organizationId, - }); - }); - - test('fails if the principal is not a service, account, arn, or organization principal', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - - expect(() => fn.addPermission('F1', { principal: new iam.CanonicalUserPrincipal('org') })) - .toThrow(/Invalid principal type for Lambda permission statement/); - - fn.addPermission('S1', { principal: new iam.ServicePrincipal('my-service') }); - fn.addPermission('S2', { principal: new iam.AccountPrincipal('account') }); - fn.addPermission('S3', { principal: new iam.ArnPrincipal('my:arn') }); - fn.addPermission('S4', { principal: new iam.OrganizationPrincipal('my:org') }); - }); - - test('applies source account/ARN conditions if the principal has conditions', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - const sourceAccount = 'some-account'; - const sourceArn = 'some-arn'; - const service = 'my-service'; - const principal = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { - ArnLike: { - 'aws:SourceArn': sourceArn, - }, - StringEquals: { - 'aws:SourceAccount': sourceAccount, - }, - }); - - fn.addPermission('S1', { principal: principal }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - Principal: service, - SourceAccount: sourceAccount, - SourceArn: sourceArn, - }); - }); - - test('applies source arn condition if principal has conditions', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - const sourceArn = 'some-arn'; - const service = 'my-service'; - const principal = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { - ArnLike: { - 'aws:SourceArn': sourceArn, - }, - }); - - fn.addPermission('S1', { principal: principal }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - Principal: service, - SourceArn: sourceArn, - }); - }); - - test('applies principal org id conditions if the principal has conditions', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - const principalOrgId = 'org-xxxxxxxxxx'; - const service = 'my-service'; - const principal = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { - StringEquals: { - 'aws:PrincipalOrgID': principalOrgId, - }, - }); - - fn.addPermission('S1', { principal: principal }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - Principal: service, - PrincipalOrgID: principalOrgId, - }); - }); - - test('fails if the principal has conditions that are not supported', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - - expect(() => fn.addPermission('F1', { - principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { - ArnEquals: { - 'aws:SourceArn': 'source-arn', - }, - }), - })).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/); - expect(() => fn.addPermission('F2', { - principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { - StringLike: { - 'aws:SourceAccount': 'source-account', - }, - }), - })).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/); - expect(() => fn.addPermission('F3', { - principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { - ArnLike: { - 's3:DataAccessPointArn': 'data-access-point-arn', - }, - }), - })).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/); - }); - - test('fails if the principal has condition combinations that are not supported', () => { - const stack = new cdk.Stack(); - const fn = newTestLambda(stack); - - expect(() => fn.addPermission('F2', { - principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { - StringEquals: { - 'aws:SourceAccount': 'source-account', - 'aws:PrincipalOrgID': 'principal-org-id', - }, - ArnLike: { - 'aws:SourceArn': 'source-arn', - }, - }), - })).toThrow(/PrincipalWithConditions had unsupported condition combinations for Lambda permission statement/); - }); - - test('BYORole', () => { - // GIVEN - const stack = new cdk.Stack(); - const role = new iam.Role(stack, 'SomeRole', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - role.addToPolicy(new iam.PolicyStatement({ actions: ['confirm:itsthesame'], resources: ['*'] })); - - // WHEN - const fn = new lambda.Function(stack, 'Function', { - code: new lambda.InlineCode('test'), - runtime: lambda.Runtime.PYTHON_3_9, - handler: 'index.test', - role, - initialPolicy: [ - new iam.PolicyStatement({ actions: ['inline:inline'], resources: ['*'] }), - ], - }); - - fn.addToRolePolicy(new iam.PolicyStatement({ actions: ['explicit:explicit'], resources: ['*'] })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { Action: 'confirm:itsthesame', Effect: 'Allow', Resource: '*' }, - { Action: 'inline:inline', Effect: 'Allow', Resource: '*' }, - { Action: 'explicit:explicit', Effect: 'Allow', Resource: '*' }, - ], - }, - }); - }); - }); - - test('fromFunctionArn', () => { - // GIVEN - const stack2 = new cdk.Stack(); - - // WHEN - const imported = lambda.Function.fromFunctionArn(stack2, 'Imported', 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords'); - - // THEN - expect(imported.functionArn).toEqual('arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords'); - expect(imported.functionName).toEqual('ProcessKinesisRecords'); - }); - - test('Function.fromFunctionName', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const imported = lambda.Function.fromFunctionName(stack, 'Imported', 'my-function'); - - // THEN - expect(stack.resolve(imported.functionArn)).toStrictEqual({ - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':lambda:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':function:my-function', - ]], - }); - expect(stack.resolve(imported.functionName)).toStrictEqual({ - 'Fn::Select': [6, { - 'Fn::Split': [':', { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':lambda:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':function:my-function', - ]], - }], - }], - }); - }); - - describe('Function.fromFunctionAttributes()', () => { - let stack: cdk.Stack; - - beforeEach(() => { - const app = new cdk.App(); - stack = new cdk.Stack(app, 'Base', { - env: { account: '111111111111', region: 'stack-region' }, - }); - }); - - describe('for a function in a different account and region', () => { - let func: lambda.IFunction; - - beforeEach(() => { - func = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { - functionArn: 'arn:aws:lambda:function-region:222222222222:function:function-name', - }); - }); - - test("the function's region is taken from the ARN", () => { - expect(func.env.region).toBe('function-region'); - }); - - test("the function's account is taken from the ARN", () => { - expect(func.env.account).toBe('222222222222'); - }); - }); - }); - - describe('addPermissions', () => { - test('imported Function w/ resolved account and function arn', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Imports', { - env: { account: '123456789012', region: 'us-east-1' }, - }); - - // WHEN - const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', - }); - iFunc.addPermission('iFunc', { - principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); - }); - - test('imported Function w/ unresolved account', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Imports'); - - // WHEN - const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', - }); - iFunc.addPermission('iFunc', { - principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); - }); - - test('imported Function w/ unresolved account & allowPermissions set', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Imports'); - - // WHEN - const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', - sameEnvironment: true, // since this is false, by default, for env agnostic stacks - }); - iFunc.addPermission('iFunc', { - principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); - }); - - test('imported Function w/different account', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Base', { - env: { account: '111111111111' }, - }); - - // WHEN - const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', - }); - iFunc.addPermission('iFunc', { - principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); - }); - - describe('annotations on different IFunctions', () => { - let stack: cdk.Stack; - let fn: lambda.Function; - let warningMessage: string; - beforeEach(() => { - warningMessage = 'AWS Lambda has changed their authorization strategy'; - stack = new cdk.Stack(); - fn = new lambda.Function(stack, 'MyLambda', { - code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - }); - }); - - describe('permissions on functions', () => { - test('without lambda:InvokeFunction', () => { - // WHEN - fn.addPermission('MyPermission', { - action: 'lambda.GetFunction', - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // Simulate a workflow where a user has created a currentVersion with the intent to invoke it later. - fn.currentVersion; - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); - }); - - describe('with lambda:InvokeFunction', () => { - test('without invoking currentVersion', () => { - // WHEN - fn.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); - }); - - test('with currentVersion invoked first', () => { - // GIVEN - // Simulate a workflow where a user has created a currentVersion with the intent to invoke it later. - fn.currentVersion; - - // WHEN - fn.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // THEN - Annotations.fromStack(stack).hasWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); - }); - - test('with currentVersion invoked after permissions created', () => { - // WHEN - fn.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // Simulate a workflow where a user has created a currentVersion after adding permissions to the function. - fn.currentVersion; - - // THEN - Annotations.fromStack(stack).hasWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); - }); - - test('multiple currentVersion calls does not result in multiple warnings', () => { - // WHEN - fn.currentVersion; - - fn.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - fn.currentVersion; - - // THEN - const warns = Annotations.fromStack(stack).findWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); - expect(warns).toHaveLength(1); - }); - }); - }); - - test('permission on versions', () => { - // GIVEN - const version = new lambda.Version(stack, 'MyVersion', { - lambda: fn.currentVersion, - }); - - // WHEN - version.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Default/MyVersion', Match.stringLikeRegexp(warningMessage)); - }); - - test('permission on latest version', () => { - // WHEN - fn.latestVersion.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // THEN - // cannot add permissions on latest version, so no warning necessary - Annotations.fromStack(stack).hasNoWarning('/Default/MyLambda/$LATEST', Match.stringLikeRegexp(warningMessage)); - }); - - test('function.addAlias', () => { - // WHEN - fn.addAlias('prod'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { - Name: 'prod', - FunctionName: { Ref: 'MyLambdaCCE802FB' }, - FunctionVersion: { 'Fn::GetAtt': ['MyLambdaCurrentVersionE7A382CCe2d14849ae02766d3abd365a8a0f12ae', 'Version'] }, - }); - }); - - describe('permission on alias', () => { - test('of current version', () => { - // GIVEN - const version = new lambda.Version(stack, 'MyVersion', { - lambda: fn.currentVersion, - }); - const alias = new lambda.Alias(stack, 'MyAlias', { - aliasName: 'alias', - version, - }); - - // WHEN - alias.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Default/MyAlias', Match.stringLikeRegexp(warningMessage)); - }); - - test('of latest version', () => { - // GIVEN - const alias = new lambda.Alias(stack, 'MyAlias', { - aliasName: 'alias', - version: fn.latestVersion, - }); - - // WHEN - alias.addPermission('MyPermission', { - principal: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - // THEN - Annotations.fromStack(stack).hasNoWarning('/Default/MyAlias', Match.stringLikeRegexp(warningMessage)); - }); - }); - }); - }); - - test('Lambda code can be read from a local directory via an asset', () => { - // GIVEN - const app = new cdk.App({ - context: { - [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false, - }, - }); - const stack = new cdk.Stack(app); - new lambda.Function(stack, 'MyLambda', { - code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Code: { - S3Bucket: { - Ref: 'AssetParameters9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232S3Bucket1354C645', - }, - S3Key: { - 'Fn::Join': ['', [ - { 'Fn::Select': [0, { 'Fn::Split': ['||', { Ref: 'AssetParameters9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232S3VersionKey5D873FAC' }] }] }, - { 'Fn::Select': [1, { 'Fn::Split': ['||', { Ref: 'AssetParameters9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232S3VersionKey5D873FAC' }] }] }, - ]], - }, - }, - Handler: 'index.handler', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'python3.9', - }); - }); - - test('default function with SQS DLQ when client sets deadLetterQueueEnabled to true and functionName defined by client', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - functionName: 'OneFunctionToRuleThemAll', - deadLetterQueueEnabled: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'lambda.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', - ], - ], - }, - ], - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'sqs:SendMessage', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'MyLambdaDeadLetterQueue399EEA2D', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - Roles: [ - { - Ref: 'MyLambdaServiceRole4539ECB6', - }, - ], - }); - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: { - Code: { - ZipFile: 'foo', - }, - Handler: 'index.handler', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'nodejs14.x', - DeadLetterConfig: { - TargetArn: { - 'Fn::GetAtt': [ - 'MyLambdaDeadLetterQueue399EEA2D', - 'Arn', - ], - }, - }, - FunctionName: 'OneFunctionToRuleThemAll', - }, - DependsOn: [ - 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - 'MyLambdaServiceRole4539ECB6', - ], - }); - }); - - test('default function with SQS DLQ when client sets deadLetterQueueEnabled to true and functionName not defined by client', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueueEnabled: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - MessageRetentionPeriod: 1209600, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - DeadLetterConfig: { - TargetArn: { - 'Fn::GetAtt': [ - 'MyLambdaDeadLetterQueue399EEA2D', - 'Arn', - ], - }, - }, - }); - }); - - test('default function with SQS DLQ when client sets deadLetterQueueEnabled to false', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueueEnabled: false, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Code: { - ZipFile: 'foo', - }, - Handler: 'index.handler', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'nodejs14.x', - }); - }); - - test('default function with SQS DLQ when client provides Queue to be used as DLQ', () => { - const stack = new cdk.Stack(); - - const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { - queueName: 'MyLambda_DLQ', - retentionPeriod: cdk.Duration.days(14), - }); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueue: dlQueue, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'sqs:SendMessage', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'DeadLetterQueue9F481546', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - DeadLetterConfig: { - TargetArn: { - 'Fn::GetAtt': [ - 'DeadLetterQueue9F481546', - 'Arn', - ], - }, - }, - }); - }); - - test('default function with SQS DLQ when client provides Queue to be used as DLQ and deadLetterQueueEnabled set to true', () => { - const stack = new cdk.Stack(); - - const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { - queueName: 'MyLambda_DLQ', - retentionPeriod: cdk.Duration.days(14), - }); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueueEnabled: true, - deadLetterQueue: dlQueue, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'sqs:SendMessage', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'DeadLetterQueue9F481546', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - DeadLetterConfig: { - TargetArn: { - 'Fn::GetAtt': [ - 'DeadLetterQueue9F481546', - 'Arn', - ], - }, - }, - }); - }); - - test('error when default function with SQS DLQ when client provides Queue to be used as DLQ and deadLetterQueueEnabled set to false', () => { - const stack = new cdk.Stack(); - - const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { - queueName: 'MyLambda_DLQ', - retentionPeriod: cdk.Duration.days(14), - }); - - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueueEnabled: false, - deadLetterQueue: dlQueue, - })).toThrow(/deadLetterQueue defined but deadLetterQueueEnabled explicitly set to false/); - }); - - test('default function with SNS DLQ when client provides Topic to be used as DLQ', () => { - const stack = new cdk.Stack(); - - const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterTopic: dlTopic, - }); - - const template = Template.fromStack(stack); - template.hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([ - { - Action: 'sns:Publish', - Effect: 'Allow', - Resource: { - Ref: 'DeadLetterTopicC237650B', - }, - }, - ]), - }, - }); - template.hasResourceProperties('AWS::Lambda::Function', { - DeadLetterConfig: { - TargetArn: { - Ref: 'DeadLetterTopicC237650B', - }, - }, - }); - }); - - test('error when default function with SNS DLQ when client provides Topic to be used as DLQ and deadLetterQueueEnabled set to false', () => { - const stack = new cdk.Stack(); - - const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); - - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueueEnabled: false, - deadLetterTopic: dlTopic, - })).toThrow(/deadLetterQueue and deadLetterTopic cannot be specified together at the same time/); - }); - - test('error when default function with SNS DLQ when client provides Topic to be used as DLQ and deadLetterQueueEnabled set to true', () => { - const stack = new cdk.Stack(); - - const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); - - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueueEnabled: true, - deadLetterTopic: dlTopic, - })).toThrow(/deadLetterQueue and deadLetterTopic cannot be specified together at the same time/); - }); - - test('error when both topic and queue are presented as DLQ', () => { - const stack = new cdk.Stack(); - - const dlQueue = new sqs.Queue(stack, 'DLQ'); - const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); - - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - deadLetterQueue: dlQueue, - deadLetterTopic: dlTopic, - })).toThrow(/deadLetterQueue and deadLetterTopic cannot be specified together at the same time/); - }); - - test('default function with Active tracing', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - tracing: lambda.Tracing.ACTIVE, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'xray:PutTraceSegments', - 'xray:PutTelemetryRecords', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - Roles: [ - { - Ref: 'MyLambdaServiceRole4539ECB6', - }, - ], - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: { - Code: { - ZipFile: 'foo', - }, - Handler: 'index.handler', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'nodejs14.x', - TracingConfig: { - Mode: 'Active', - }, - }, - DependsOn: [ - 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - 'MyLambdaServiceRole4539ECB6', - ], - }); - }); - - test('default function with PassThrough tracing', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - tracing: lambda.Tracing.PASS_THROUGH, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'xray:PutTraceSegments', - 'xray:PutTelemetryRecords', - ], - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - Roles: [ - { - Ref: 'MyLambdaServiceRole4539ECB6', - }, - ], - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: { - Code: { - ZipFile: 'foo', - }, - Handler: 'index.handler', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'nodejs14.x', - TracingConfig: { - Mode: 'PassThrough', - }, - }, - DependsOn: [ - 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - 'MyLambdaServiceRole4539ECB6', - ], - }); - }); - - test('default function with Disabled tracing', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - tracing: lambda.Tracing.DISABLED, - }); - - Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: { - Code: { - ZipFile: 'foo', - }, - Handler: 'index.handler', - Role: { - 'Fn::GetAtt': [ - 'MyLambdaServiceRole4539ECB6', - 'Arn', - ], - }, - Runtime: 'nodejs14.x', - }, - DependsOn: [ - 'MyLambdaServiceRole4539ECB6', - ], - }); - }); - - test('runtime and handler set to FROM_IMAGE are set to undefined in CloudFormation', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), - handler: lambda.Handler.FROM_IMAGE, - runtime: lambda.Runtime.FROM_IMAGE, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Runtime: Match.absent(), - Handler: Match.absent(), - PackageType: 'Image', - }); - }); - - describe('grantInvoke', () => { - test('adds iam:InvokeFunction', () => { - // GIVEN - const stack = new cdk.Stack(); - const role = new iam.Role(stack, 'Role', { - assumedBy: new iam.AccountPrincipal('1234'), - }); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - fn.grantInvoke(role); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: 'lambda:InvokeFunction', - Effect: 'Allow', - Resource: [ - { 'Fn::GetAtt': ['Function76856677', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['Function76856677', 'Arn'] }, ':*']] }, - ], - }, - ], - }, - }); - }); - - test('with a service principal', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const service = new iam.ServicePrincipal('apigateway.amazonaws.com'); - - // WHEN - fn.grantInvoke(service); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: 'apigateway.amazonaws.com', - }); - }); - - test('with an account principal', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const account = new iam.AccountPrincipal('123456789012'); - - // WHEN - fn.grantInvoke(account); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: '123456789012', - }); - }); - - test('with an arn principal', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const account = new iam.ArnPrincipal('arn:aws:iam::123456789012:role/someRole'); - - // WHEN - fn.grantInvoke(account); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: 'arn:aws:iam::123456789012:role/someRole', - }); - }); - - test('with an organization principal', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const org = new iam.OrganizationPrincipal('my-org-id'); - - // WHEN - fn.grantInvoke(org); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: '*', - PrincipalOrgID: 'my-org-id', - }); - }); - - test('can be called twice for the same service principal', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const service = new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com'); - - // WHEN - fn.grantInvoke(service); - fn.grantInvoke(service); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: 'elasticloadbalancing.amazonaws.com', - }); - }); - - test('with an imported role (in the same account)', () => { - // GIVEN - const stack = new cdk.Stack(undefined, undefined, { - env: { account: '123456789012' }, - }); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - fn.grantInvoke(iam.Role.fromRoleArn(stack, 'ForeignRole', 'arn:aws:iam::123456789012:role/someRole')); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'lambda:InvokeFunction', - Effect: 'Allow', - Resource: [ - { 'Fn::GetAtt': ['Function76856677', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['Function76856677', 'Arn'] }, ':*']] }, - ], - }, - ], - }, - Roles: ['someRole'], - }); - }); - - test('with an imported role (from a different account)', () => { - // GIVEN - const stack = new cdk.Stack(undefined, undefined, { - env: { account: '3333' }, - }); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - fn.grantInvoke(iam.Role.fromRoleArn(stack, 'ForeignRole', 'arn:aws:iam::123456789012:role/someRole')); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: 'arn:aws:iam::123456789012:role/someRole', - }); - }); - - test('on an imported function (same account)', () => { - // GIVEN - const stack = new cdk.Stack(undefined, undefined, { - env: { account: '123456789012' }, - }); - const fn = lambda.Function.fromFunctionArn(stack, 'Function', 'arn:aws:lambda:us-east-1:123456789012:function:MyFn'); - - // WHEN - fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', - Principal: 'elasticloadbalancing.amazonaws.com', - }); - }); - - test('on an imported function (unresolved account)', () => { - const stack = new cdk.Stack(); - const fn = lambda.Function.fromFunctionArn(stack, 'Function', 'arn:aws:lambda:us-east-1:123456789012:function:MyFn'); - - expect( - () => fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')), - ).toThrow(/Cannot modify permission to lambda function/); - }); - - test('on an imported function (unresolved account & w/ allowPermissions)', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = lambda.Function.fromFunctionAttributes(stack, 'Function', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', - sameEnvironment: true, - }); - - // WHEN - fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', - Principal: 'elasticloadbalancing.amazonaws.com', - }); - }); - - test('on an imported function (different account)', () => { - // GIVEN - const stack = new cdk.Stack(undefined, undefined, { - env: { account: '111111111111' }, // Different account - }); - const fn = lambda.Function.fromFunctionArn(stack, 'Function', 'arn:aws:lambda:us-east-1:123456789012:function:MyFn'); - - // THEN - expect(() => { - fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); - }).toThrow(/Cannot modify permission to lambda function/); - }); - - test('on an imported function (different account & w/ skipPermissions', () => { - // GIVEN - const stack = new cdk.Stack(undefined, undefined, { - env: { account: '111111111111' }, // Different account - }); - const fn = lambda.Function.fromFunctionAttributes(stack, 'Function', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', - skipPermissions: true, - }); - - // THEN - expect(() => { - fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); - }).not.toThrow(); - }); - }); - - test('Can use metricErrors on a lambda Function', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // THEN - expect(stack.resolve(fn.metricErrors())).toEqual({ - dimensions: { FunctionName: { Ref: 'Function76856677' } }, - namespace: 'AWS/Lambda', - metricName: 'Errors', - period: cdk.Duration.minutes(5), - statistic: 'Sum', - }); - }); - - test('addEventSource calls bind', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - let bindTarget; - - class EventSourceMock implements lambda.IEventSource { - public bind(target: lambda.IFunction) { - bindTarget = target; - } - } - - // WHEN - fn.addEventSource(new EventSourceMock()); - - // THEN - expect(bindTarget).toEqual(fn); - }); - - test('layer is baked into the function version', () => { - // GIVEN - const stack = new cdk.Stack(undefined, 'TestStack'); - const bucket = new s3.Bucket(stack, 'Bucket'); - const code = new lambda.S3Code(bucket, 'ObjectKey'); - - const fn = new lambda.Function(stack, 'fn', { - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), - handler: 'index.main', - }); - - const fnHash = calculateFunctionHash(fn); - - // WHEN - const layer = new lambda.LayerVersion(stack, 'LayerVersion', { - code, - compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], - }); - - fn.addLayers(layer); - - const newFnHash = calculateFunctionHash(fn); - - expect(fnHash).not.toEqual(newFnHash); - }); - - test('with feature flag, layer version is baked into function version', () => { - // GIVEN - const app = new cdk.App({ context: { [cxapi.LAMBDA_RECOGNIZE_LAYER_VERSION]: true } }); - const stack = new cdk.Stack(app, 'TestStack'); - const bucket = new s3.Bucket(stack, 'Bucket'); - const code = new lambda.S3Code(bucket, 'ObjectKey'); - const layer = new lambda.LayerVersion(stack, 'LayerVersion', { - code, - compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], - }); - - // function with layer - const fn = new lambda.Function(stack, 'fn', { - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), - handler: 'index.main', - layers: [layer], - }); - - const fnHash = calculateFunctionHash(fn); - - // use escape hatch to change the content of the layer - // this simulates updating the layer code which changes the version. - const cfnLayer = layer.node.defaultChild as lambda.CfnLayerVersion; - const newCode = (new lambda.S3Code(bucket, 'NewObjectKey')).bind(layer); - cfnLayer.content = { - s3Bucket: newCode.s3Location!.bucketName, - s3Key: newCode.s3Location!.objectKey, - s3ObjectVersion: newCode.s3Location!.objectVersion, - }; - - const newFnHash = calculateFunctionHash(fn); - - expect(fnHash).not.toEqual(newFnHash); - }); - - test('using an incompatible layer', () => { - // GIVEN - const stack = new cdk.Stack(undefined, 'TestStack'); - const layer = lambda.LayerVersion.fromLayerVersionAttributes(stack, 'TestLayer', { - layerVersionArn: 'arn:aws:...', - compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], - }); - - // THEN - expect(() => new lambda.Function(stack, 'Function', { - layers: [layer], - runtime: lambda.Runtime.NODEJS_16_X, - code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), - handler: 'index.main', - })).toThrow(/nodejs16.x is not in \[nodejs14.x\]/); - }); - - test('using more than 5 layers', () => { - // GIVEN - const stack = new cdk.Stack(undefined, 'TestStack'); - const layers = new Array(6).fill(lambda.LayerVersion.fromLayerVersionAttributes(stack, 'TestLayer', { - layerVersionArn: 'arn:aws:...', - compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], - })); - - // THEN - expect(() => new lambda.Function(stack, 'Function', { - layers, - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), - handler: 'index.main', - })).toThrow(/Unable to add layer:/); - }); - - test('environment variables work in China', () => { - // GIVEN - const stack = new cdk.Stack(undefined, undefined, { env: { region: 'cn-north-1' } }); - - // WHEN - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS, - environment: { - SOME: 'Variable', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - SOME: 'Variable', - }, - }, - }); - }); - - test('environment variables work in an unspecified region', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS, - environment: { - SOME: 'Variable', - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - SOME: 'Variable', - }, - }, - }); - }); - - test('support reserved concurrent executions', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS, - reservedConcurrentExecutions: 10, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - ReservedConcurrentExecutions: 10, - }); - }); - - test('its possible to specify event sources upon creation', () => { - // GIVEN - const stack = new cdk.Stack(); - - let bindCount = 0; - - class EventSource implements lambda.IEventSource { - public bind(_fn: lambda.IFunction): void { - bindCount++; - } - } - - // WHEN - new lambda.Function(stack, 'fn', { - code: lambda.Code.fromInline('boom'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.bam', - events: [ - new EventSource(), - new EventSource(), - ], - }); - - // THEN - expect(bindCount).toEqual(2); - }); - - test('Provided Runtime returns the right values', () => { - const rt = lambda.Runtime.PROVIDED; - - expect(rt.name).toEqual('provided'); - expect(rt.supportsInlineCode).toEqual(false); - }); - - test('specify log retention', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS, - logRetention: logs.RetentionDays.ONE_MONTH, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { - LogGroupName: { - 'Fn::Join': [ - '', - [ - '/aws/lambda/', - { - Ref: 'MyLambdaCCE802FB', - }, - ], - ], - }, - RetentionInDays: 30, - }); - }); - - test('imported lambda with imported security group and allowAllOutbound set to false', () => { - // GIVEN - const stack = new cdk.Stack(); - - const fn = lambda.Function.fromFunctionAttributes(stack, 'fn', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:my-function', - securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - }), - }); - - // WHEN - fn.connections.allowToAnyIpv4(ec2.Port.tcp(443)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: 'sg-123456789', - }); - }); - - test('with event invoke config', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - onFailure: { - bind: () => ({ destination: 'on-failure-arn' }), - }, - onSuccess: { - bind: () => ({ destination: 'on-success-arn' }), - }, - maxEventAge: cdk.Duration.hours(1), - retryAttempts: 0, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { - FunctionName: { - Ref: 'fn5FF616E3', - }, - Qualifier: '$LATEST', - DestinationConfig: { - OnFailure: { - Destination: 'on-failure-arn', - }, - OnSuccess: { - Destination: 'on-success-arn', - }, - }, - MaximumEventAgeInSeconds: 3600, - MaximumRetryAttempts: 0, - }); - }); - - test('throws when calling configureAsyncInvoke on already configured function', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - maxEventAge: cdk.Duration.hours(1), - }); - - // THEN - expect(() => fn.configureAsyncInvoke({ retryAttempts: 0 })).toThrow(/An EventInvokeConfig has already been configured/); - }); - - test('event invoke config on imported lambda', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = lambda.Function.fromFunctionAttributes(stack, 'fn', { - functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:my-function', - }); - - // WHEN - fn.configureAsyncInvoke({ - retryAttempts: 1, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { - FunctionName: 'my-function', - Qualifier: '$LATEST', - MaximumRetryAttempts: 1, - }); - }); - - testDeprecated('add a version with event invoke config', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - fn.addVersion('1', 'sha256', 'desc', undefined, { - retryAttempts: 0, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { - FunctionName: { - Ref: 'fn5FF616E3', - }, - Qualifier: { - 'Fn::GetAtt': [ - 'fnVersion197FA813F', - 'Version', - ], - }, - MaximumRetryAttempts: 0, - }); - }); - - test('check edge compatibility with env vars that can be removed', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - fn.addEnvironment('KEY', 'value', { removeInEdge: true }); - - // WHEN - fn._checkEdgeCompatibility(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Environment: Match.absent(), - }); - }); - - test('check edge compatibility with env vars that cannot be removed', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - environment: { - KEY: 'value', - }, - }); - fn.addEnvironment('OTHER_KEY', 'other_value', { removeInEdge: true }); - - // THEN - expect(() => fn._checkEdgeCompatibility()).toThrow(/The function Default\/fn contains environment variables \[KEY\] and is not compatible with Lambda@Edge/); - }); - - test('add incompatible layer', () => { - // GIVEN - const stack = new cdk.Stack(undefined, 'TestStack'); - const bucket = new s3.Bucket(stack, 'Bucket'); - const code = new lambda.S3Code(bucket, 'ObjectKey'); - - const func = new lambda.Function(stack, 'myFunc', { - runtime: lambda.Runtime.PYTHON_3_7, - handler: 'index.handler', - code, - }); - const layer = new lambda.LayerVersion(stack, 'myLayer', { - code, - compatibleRuntimes: [lambda.Runtime.NODEJS], - }); - - // THEN - expect(() => func.addLayers(layer)).toThrow( - /This lambda function uses a runtime that is incompatible with this layer/); - }); - - test('add compatible layer', () => { - // GIVEN - const stack = new cdk.Stack(undefined, 'TestStack'); - const bucket = new s3.Bucket(stack, 'Bucket'); - const code = new lambda.S3Code(bucket, 'ObjectKey'); - - const func = new lambda.Function(stack, 'myFunc', { - runtime: lambda.Runtime.PYTHON_3_7, - handler: 'index.handler', - code, - }); - const layer = new lambda.LayerVersion(stack, 'myLayer', { - code, - compatibleRuntimes: [lambda.Runtime.PYTHON_3_7], - }); - - // THEN - // should not throw - expect(() => func.addLayers(layer)).not.toThrow(); - }); - - test('add compatible layer for deep clone', () => { - // GIVEN - const stack = new cdk.Stack(undefined, 'TestStack'); - const bucket = new s3.Bucket(stack, 'Bucket'); - const code = new lambda.S3Code(bucket, 'ObjectKey'); - - const runtime = lambda.Runtime.PYTHON_3_7; - const func = new lambda.Function(stack, 'myFunc', { - runtime, - handler: 'index.handler', - code, - }); - const clone = _.cloneDeep(runtime); - const layer = new lambda.LayerVersion(stack, 'myLayer', { - code, - compatibleRuntimes: [clone], - }); - - // THEN - // should not throw - expect(() => func.addLayers(layer)).not.toThrow(); - }); - - test('empty inline code is not allowed', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN/THEN - expect(() => new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline(''), - })).toThrow(/Lambda inline code cannot be empty/); - }); - - test('logGroup is correctly returned', () => { - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - }); - const logGroup = fn.logGroup; - expect(logGroup.logGroupName).toBeDefined(); - expect(logGroup.logGroupArn).toBeDefined(); - }); - - test('dlq is returned when provided by user and is Queue', () => { - const stack = new cdk.Stack(); - - const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { - queueName: 'MyLambda_DLQ', - retentionPeriod: cdk.Duration.days(14), - }); - - const fn = new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - deadLetterQueue: dlQueue, - }); - const deadLetterQueue = fn.deadLetterQueue; - const deadLetterTopic = fn.deadLetterTopic; - - expect(deadLetterTopic).toBeUndefined(); - - expect(deadLetterQueue).toBeDefined(); - expect(deadLetterQueue).toBeInstanceOf(sqs.Queue); - }); - - test('dlq is returned when provided by user and is Topic', () => { - const stack = new cdk.Stack(); - - const dlTopic = new sns.Topic(stack, 'DeadLetterQueue', { - topicName: 'MyLambda_DLQ', - }); - - const fn = new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - deadLetterTopic: dlTopic, - }); - const deadLetterQueue = fn.deadLetterQueue; - const deadLetterTopic = fn.deadLetterTopic; - - expect(deadLetterQueue).toBeUndefined(); - - expect(deadLetterTopic).toBeDefined(); - expect(deadLetterTopic).toBeInstanceOf(sns.Topic); - }); - - test('dlq is returned when setup by cdk and is Queue', () => { - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - deadLetterQueueEnabled: true, - }); - const deadLetterQueue = fn.deadLetterQueue; - const deadLetterTopic = fn.deadLetterTopic; - - expect(deadLetterTopic).toBeUndefined(); - - expect(deadLetterQueue).toBeDefined(); - expect(deadLetterQueue).toBeInstanceOf(sqs.Queue); - }); - - test('dlq is undefined when not setup', () => { - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - }); - const deadLetterQueue = fn.deadLetterQueue; - const deadLetterTopic = fn.deadLetterTopic; - - expect(deadLetterQueue).toBeUndefined(); - expect(deadLetterTopic).toBeUndefined(); - }); - - test('one and only one child LogRetention construct will be created', () => { - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromInline('foo'), - logRetention: logs.RetentionDays.FIVE_DAYS, - }); - - // Call logGroup a few times. If more than one instance of LogRetention was created, - // the second call will fail on duplicate constructs. - fn.logGroup; - fn.logGroup; - fn.logGroup; - }); - - test('fails when inline code is specified on an incompatible runtime', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'fn', { - handler: 'foo', - runtime: lambda.Runtime.PROVIDED, - code: lambda.Code.fromInline('foo'), - })).toThrow(/Inline source not allowed for/); - }); - - test('multiple calls to latestVersion returns the same version', () => { - const stack = new cdk.Stack(); - - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version1 = fn.latestVersion; - const version2 = fn.latestVersion; - - const expectedArn = { - 'Fn::Join': ['', [ - { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - ':$LATEST', - ]], - }; - expect(version1).toEqual(version2); - expect(stack.resolve(version1.functionArn)).toEqual(expectedArn); - expect(stack.resolve(version2.functionArn)).toEqual(expectedArn); - }); - - test('default function with kmsKeyArn, environmentEncryption passed as props', () => { - // GIVEN - const stack = new cdk.Stack(); - const key: kms.IKey = new kms.Key(stack, 'EnvVarEncryptKey', { - description: 'sample key', - }); - - // WHEN - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - environment: { - SOME: 'Variable', - }, - environmentEncryption: key, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - SOME: 'Variable', - }, - }, - KmsKeyArn: { - 'Fn::GetAtt': [ - 'EnvVarEncryptKey1A7CABDB', - 'Arn', - ], - }, - }); - }); - - describe('profiling group', () => { - test('default function with CDK created Profiling Group', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - profiling: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CodeGuruProfiler::ProfilingGroup', { - ProfilingGroupName: 'MyLambdaProfilingGroupC5B6CCD8', - ComputePlatform: 'AWSLambda', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'codeguru-profiler:ConfigureAgent', - 'codeguru-profiler:PostAgentProfile', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': ['MyLambdaProfilingGroupEC6DE32F', 'Arn'], - }, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - Roles: [ - { - Ref: 'MyLambdaServiceRole4539ECB6', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - AWS_CODEGURU_PROFILER_GROUP_ARN: { 'Fn::GetAtt': ['MyLambdaProfilingGroupEC6DE32F', 'Arn'] }, - AWS_CODEGURU_PROFILER_ENABLED: 'TRUE', - }, - }, - }); - }); - - test('default function with client provided Profiling Group', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'codeguru-profiler:ConfigureAgent', - 'codeguru-profiler:PostAgentProfile', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': ['ProfilingGroup26979FD7', 'Arn'], - }, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', - Roles: [ - { - Ref: 'MyLambdaServiceRole4539ECB6', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Environment: { - Variables: { - AWS_CODEGURU_PROFILER_GROUP_ARN: { - 'Fn::Join': [ - '', - [ - 'arn:', { Ref: 'AWS::Partition' }, ':codeguru-profiler:', { Ref: 'AWS::Region' }, - ':', { Ref: 'AWS::AccountId' }, ':profilingGroup/', { Ref: 'ProfilingGroup26979FD7' }, - ], - ], - }, - AWS_CODEGURU_PROFILER_ENABLED: 'TRUE', - }, - }, - }); - }); - - test('default function with client provided Profiling Group but profiling set to false', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - profiling: false, - profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), - }); - - Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', Match.not({ - Environment: { - Variables: { - AWS_CODEGURU_PROFILER_GROUP_ARN: { - 'Fn::Join': [ - '', - [ - 'arn:', { Ref: 'AWS::Partition' }, ':codeguru-profiler:', { Ref: 'AWS::Region' }, - ':', { Ref: 'AWS::AccountId' }, ':profilingGroup/', { Ref: 'ProfilingGroup26979FD7' }, - ], - ], - }, - AWS_CODEGURU_PROFILER_ENABLED: 'TRUE', - }, - }, - })); - }); - - test('default function with profiling enabled and client provided env vars', () => { - const stack = new cdk.Stack(); - - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - profiling: true, - environment: { - AWS_CODEGURU_PROFILER_GROUP_ARN: 'profiler_group_arn', - AWS_CODEGURU_PROFILER_ENABLED: 'yes', - }, - })).toThrow(/AWS_CODEGURU_PROFILER_GROUP_ARN and AWS_CODEGURU_PROFILER_ENABLED must not be set when profiling options enabled/); - }); - - test('default function with client provided Profiling Group and client provided env vars', () => { - const stack = new cdk.Stack(); - - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), - environment: { - AWS_CODEGURU_PROFILER_GROUP_ARN: 'profiler_group_arn', - AWS_CODEGURU_PROFILER_ENABLED: 'yes', - }, - })).toThrow(/AWS_CODEGURU_PROFILER_GROUP_ARN and AWS_CODEGURU_PROFILER_ENABLED must not be set when profiling options enabled/); - }); - - test('throws an error when used with an unsupported runtime', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), - environment: { - AWS_CODEGURU_PROFILER_GROUP_ARN: 'profiler_group_arn', - AWS_CODEGURU_PROFILER_ENABLED: 'yes', - }, - })).toThrow(/not supported by runtime/); - }); - }); - - describe('lambda.Function timeout', () => { - test('should be a cdk.Duration when defined', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const { timeout } = new lambda.Function(stack, 'MyFunction', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - timeout: cdk.Duration.minutes(2), - }); - - // THEN - expect(timeout).toEqual(cdk.Duration.minutes(2)); - }); - - test('should be optional', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const { timeout } = new lambda.Function(stack, 'MyFunction', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - }); - - // THEN - expect(timeout).not.toBeDefined(); - }); - }); - - describe('currentVersion', () => { - // see test.function-hash.ts for more coverage for this - test('logical id of version is based on the function hash', () => { - // GIVEN - const stack1 = new cdk.Stack(); - const fn1 = new lambda.Function(stack1, 'MyFunction', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - environment: { - FOO: 'bar', - }, - }); - const stack2 = new cdk.Stack(); - const fn2 = new lambda.Function(stack2, 'MyFunction', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - environment: { - FOO: 'bear', - }, - }); - - // WHEN - new cdk.CfnOutput(stack1, 'CurrentVersionArn', { - value: fn1.currentVersion.functionArn, - }); - new cdk.CfnOutput(stack2, 'CurrentVersionArn', { - value: fn2.currentVersion.functionArn, - }); - - // THEN - const template1 = Template.fromStack(stack1).toJSON(); - const template2 = Template.fromStack(stack2).toJSON(); - - // these functions are different in their configuration but the original - // logical ID of the version would be the same unless the logical ID - // includes the hash of function's configuration. - expect(template1.Outputs.CurrentVersionArn.Value).not.toEqual(template2.Outputs.CurrentVersionArn.Value); - }); - }); - - describe('filesystem', () => { - - test('mount efs filesystem', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc', { - maxAzs: 3, - natGateways: 1, - }); - - const fs = new efs.FileSystem(stack, 'Efs', { - vpc, - }); - const accessPoint = fs.addAccessPoint('AccessPoint'); - // WHEN - new lambda.Function(stack, 'MyFunction', { - vpc, - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - FileSystemConfigs: [ - { - Arn: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':elasticfilesystem:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':access-point/', - { - Ref: 'EfsAccessPointE419FED9', - }, - ], - ], - }, - LocalMountPath: '/mnt/msg', - }, - ], - }); - }); - - test('throw error mounting efs with no vpc', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc', { - maxAzs: 3, - natGateways: 1, - }); - - const fs = new efs.FileSystem(stack, 'Efs', { - vpc, - }); - const accessPoint = fs.addAccessPoint('AccessPoint'); - - // THEN - expect(() => { - new lambda.Function(stack, 'MyFunction', { - handler: 'foo', - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), - }); - }).toThrow(); - }); - - test('verify deps when mounting efs', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc', { - maxAzs: 3, - natGateways: 1, - }); - const securityGroup = new ec2.SecurityGroup(stack, 'LambdaSG', { - vpc, - allowAllOutbound: false, - }); - - const fs = new efs.FileSystem(stack, 'Efs', { - vpc, - }); - const accessPoint = fs.addAccessPoint('AccessPoint'); - // WHEN - new lambda.Function(stack, 'MyFunction', { - vpc, - handler: 'foo', - securityGroups: [securityGroup], - runtime: lambda.Runtime.NODEJS_14_X, - code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), - filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - DependsOn: [ - 'EfsEfsMountTarget195B2DD2E', - 'EfsEfsMountTarget2315C927F', - 'EfsEfsSecurityGroupfromLambdaSG20491B2F751D', - 'LambdaSGtoEfsEfsSecurityGroupFCE2954020499719694A', - 'MyFunctionServiceRoleDefaultPolicyB705ABD4', - 'MyFunctionServiceRole3C357FF2', - 'VpcPrivateSubnet1DefaultRouteBE02A9ED', - 'VpcPrivateSubnet1RouteTableAssociation70C59FA6', - 'VpcPrivateSubnet2DefaultRoute060D2087', - 'VpcPrivateSubnet2RouteTableAssociationA89CAD56', - ], - }); - }); - }); - - describe('code config', () => { - class MyCode extends lambda.Code { - public readonly isInline: boolean; - constructor(private readonly config: lambda.CodeConfig) { - super(); - this.isInline = 'inlineCode' in config; - } - - public bind(_scope: constructs.Construct): lambda.CodeConfig { - return this.config; - } - } - - test('only one of inline, s3 or imageConfig are allowed', () => { - const stack = new cdk.Stack(); - - expect(() => new lambda.Function(stack, 'Fn1', { - code: new MyCode({}), - handler: 'index.handler', - runtime: lambda.Runtime.GO_1_X, - })).toThrow(/lambda.Code must specify exactly one of/); - - expect(() => new lambda.Function(stack, 'Fn2', { - code: new MyCode({ - inlineCode: 'foo', - image: { imageUri: 'bar' }, - }), - handler: 'index.handler', - runtime: lambda.Runtime.GO_1_X, - })).toThrow(/lambda.Code must specify exactly one of/); - - expect(() => new lambda.Function(stack, 'Fn3', { - code: new MyCode({ - image: { imageUri: 'baz' }, - s3Location: { bucketName: 's3foo', objectKey: 's3bar' }, - }), - handler: 'index.handler', - runtime: lambda.Runtime.GO_1_X, - })).toThrow(/lambda.Code must specify exactly one of/); - - expect(() => new lambda.Function(stack, 'Fn4', { - code: new MyCode({ inlineCode: 'baz', s3Location: { bucketName: 's3foo', objectKey: 's3bar' } }), - handler: 'index.handler', - runtime: lambda.Runtime.GO_1_X, - })).toThrow(/lambda.Code must specify exactly one of/); - }); - - test('handler must be FROM_IMAGE when image asset is specified', () => { - const stack = new cdk.Stack(); - - expect(() => new lambda.Function(stack, 'Fn1', { - code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), - handler: lambda.Handler.FROM_IMAGE, - runtime: lambda.Runtime.FROM_IMAGE, - })).not.toThrow(); - - expect(() => new lambda.Function(stack, 'Fn2', { - code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), - handler: 'index.handler', - runtime: lambda.Runtime.FROM_IMAGE, - })).toThrow(/handler must be.*FROM_IMAGE/); - }); - - test('runtime must be FROM_IMAGE when image asset is specified', () => { - const stack = new cdk.Stack(); - - expect(() => new lambda.Function(stack, 'Fn1', { - code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), - handler: lambda.Handler.FROM_IMAGE, - runtime: lambda.Runtime.FROM_IMAGE, - })).not.toThrow(); - - expect(() => new lambda.Function(stack, 'Fn2', { - code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), - handler: lambda.Handler.FROM_IMAGE, - runtime: lambda.Runtime.GO_1_X, - })).toThrow(/runtime must be.*FROM_IMAGE/); - }); - - test('imageUri is correctly configured', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'Fn1', { - code: new MyCode({ - image: { - imageUri: 'ecr image uri', - }, - }), - handler: lambda.Handler.FROM_IMAGE, - runtime: lambda.Runtime.FROM_IMAGE, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Code: { - ImageUri: 'ecr image uri', - }, - ImageConfig: Match.absent(), - }); - }); - - test('imageConfig is correctly configured', () => { - const stack = new cdk.Stack(); - - new lambda.Function(stack, 'Fn1', { - code: new MyCode({ - image: { - imageUri: 'ecr image uri', - cmd: ['cmd', 'param1'], - entrypoint: ['entrypoint', 'param2'], - workingDirectory: '/some/path', - }, - }), - handler: lambda.Handler.FROM_IMAGE, - runtime: lambda.Runtime.FROM_IMAGE, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - ImageConfig: { - Command: ['cmd', 'param1'], - EntryPoint: ['entrypoint', 'param2'], - WorkingDirectory: '/some/path', - }, - }); - }); - }); - - describe('code signing config', () => { - test('default', () => { - const stack = new cdk.Stack(); - - const signingProfile = new signer.SigningProfile(stack, 'SigningProfile', { - platform: signer.Platform.AWS_LAMBDA_SHA384_ECDSA, - }); - - const codeSigningConfig = new lambda.CodeSigningConfig(stack, 'CodeSigningConfig', { - signingProfiles: [signingProfile], - }); - - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - codeSigningConfig, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - CodeSigningConfigArn: { - 'Fn::GetAtt': [ - 'CodeSigningConfigD8D41C10', - 'CodeSigningConfigArn', - ], - }, - }); - }); - }); - - test('error when layers set in a container function', () => { - const stack = new cdk.Stack(); - const bucket = new s3.Bucket(stack, 'Bucket'); - const code = new lambda.S3Code(bucket, 'ObjectKey'); - - const layer = new lambda.LayerVersion(stack, 'Layer', { - code, - }); - - expect(() => new lambda.DockerImageFunction(stack, 'MyLambda', { - code: lambda.DockerImageCode.fromImageAsset(dockerLambdaHandlerPath), - layers: [layer], - })).toThrow(/Layers are not supported for container image functions/); - }); - - testDeprecated('specified architectures is recognized', () => { - const stack = new cdk.Stack(); - new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - - architectures: [lambda.Architecture.ARM_64], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Architectures: ['arm64'], - }); - }); - - test('specified architecture is recognized', () => { - const stack = new cdk.Stack(); - new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - - architecture: lambda.Architecture.ARM_64, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Architectures: ['arm64'], - }); - }); - - testDeprecated('both architectures and architecture are not recognized', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - - architecture: lambda.Architecture.ARM_64, - architectures: [lambda.Architecture.X86_64], - })).toThrow(/architecture or architectures must be specified/); - }); - - testDeprecated('Only one architecture allowed', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - - architectures: [lambda.Architecture.X86_64, lambda.Architecture.ARM_64], - })).toThrow(/one architecture must be specified/); - }); - - test('Architecture is properly readable from the function', () => { - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - architecture: lambda.Architecture.ARM_64, - }); - expect(fn.architecture?.name).toEqual('arm64'); - }); - - test('Error when function name is longer than 64 chars', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - functionName: 'a'.repeat(65), - })).toThrow(/Function name can not be longer than 64 characters/); - }); - - test('Error when function name contains invalid characters', () => { - const stack = new cdk.Stack(); - [' ', '\n', '\r', '[', ']', '<', '>', '$'].forEach(invalidChar => { - expect(() => { - new lambda.Function(stack, `foo${invalidChar}`, { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - functionName: `foo${invalidChar}`, - }); - }).toThrow(/can contain only letters, numbers, hyphens, or underscores with no spaces./); - }); - }); - - test('No error when function name is Tokenized and Unresolved', () => { - const stack = new cdk.Stack(); - expect(() => { - const realFunctionName = 'a'.repeat(141); - const tokenizedFunctionName = cdk.Token.asString(new cdk.Intrinsic(realFunctionName)); - - new lambda.Function(stack, 'foo', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - functionName: tokenizedFunctionName, - }); - }).not.toThrow(); - }); - - test('Error when function description is longer than 256 chars', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyFunction', { - code: lambda.Code.fromInline('foo'), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - description: 'a'.repeat(257), - })).toThrow(/Function description can not be longer than 256 characters/); - }); - - test('No error when function name is Tokenized and Unresolved', () => { - const stack = new cdk.Stack(); - expect(() => { - const realFunctionDescription = 'a'.repeat(257); - const tokenizedFunctionDescription = cdk.Token.asString(new cdk.Intrinsic(realFunctionDescription)); - - new lambda.Function(stack, 'foo', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - description: tokenizedFunctionDescription, - }); - }).not.toThrow(); - }); - - describe('FunctionUrl', () => { - test('addFunctionUrl creates a function url with default options', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - fn.addFunctionUrl(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Url', { - AuthType: 'AWS_IAM', - TargetFunctionArn: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - }); - }); - - test('addFunctionUrl creates a function url with all options', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - fn.addFunctionUrl({ - authType: lambda.FunctionUrlAuthType.NONE, - cors: { - allowCredentials: true, - allowedOrigins: ['https://example.com'], - allowedMethods: [lambda.HttpMethod.GET], - allowedHeaders: ['X-Custom-Header'], - maxAge: cdk.Duration.seconds(300), - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Url', { - AuthType: 'NONE', - TargetFunctionArn: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - Cors: { - AllowCredentials: true, - AllowHeaders: [ - 'X-Custom-Header', - ], - AllowMethods: [ - 'GET', - ], - AllowOrigins: [ - 'https://example.com', - ], - MaxAge: 300, - }, - }); - }); - - test('grantInvokeUrl: adds appropriate permissions', () => { - // GIVEN - const stack = new cdk.Stack(); - const role = new iam.Role(stack, 'Role', { - assumedBy: new iam.AccountPrincipal('1234'), - }); - const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('hello()'), - handler: 'index.hello', - runtime: lambda.Runtime.NODEJS_14_X, - }); - fn.addFunctionUrl(); - - // WHEN - fn.grantInvokeUrl(role); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: 'lambda:InvokeFunctionUrl', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'MyLambdaCCE802FB', - 'Arn', - ], - }, - }, - ], - }, - }); - }); - }); - - test('called twice for the same service principal but with different conditions', () => { - // GIVEN - const stack = new cdk.Stack(); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('xxx'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - const sourceArnA = 'some-arn-a'; - const sourceArnB = 'some-arn-b'; - const service = 's3.amazonaws.com'; - const conditionalPrincipalA = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { - ArnLike: { - 'aws:SourceArn': sourceArnA, - }, - StringEquals: { - 'aws:SourceAccount': stack.account, - }, - }); - const conditionalPrincipalB = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { - ArnLike: { - 'aws:SourceArn': sourceArnB, - }, - StringEquals: { - 'aws:SourceAccount': stack.account, - }, - }); - - // WHEN - fn.grantInvoke(conditionalPrincipalA); - fn.grantInvoke(conditionalPrincipalB); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 2); - Template.fromStack(stack).hasResource('AWS::Lambda::Permission', { - Properties: { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: service, - SourceAccount: { - Ref: 'AWS::AccountId', - }, - SourceArn: sourceArnA, - }, - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Permission', { - Properties: { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: service, - SourceAccount: { - Ref: 'AWS::AccountId', - }, - SourceArn: sourceArnB, - }, - }); - }); - - test('adds ADOT instrumentation to a ZIP Lambda function', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Base', { - env: { account: '111111111111', region: 'us-west-2' }, - }); - - // WHEN - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - adotInstrumentation: { - layerVersion: lambda.AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_19_0), - execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1'], - Environment: { - Variables: { - AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler', - }, - }, - }); - }); - - test('adds ADOT instrumentation to a container image Lambda function', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'Base', { - env: { account: '111111111111', region: 'us-west-2' }, - }); - - // WHEN - expect( - () => - new lambda.DockerImageFunction(stack, 'MyLambda', { - code: lambda.DockerImageCode.fromImageAsset(dockerLambdaHandlerPath), - adotInstrumentation: { - layerVersion: lambda.AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_19_0), - execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER, - }, - }), - ).toThrow(/ADOT Lambda layer can't be configured with container image package type/); - }); -}); - -test('throws if ephemeral storage size is out of bound', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'bar', - runtime: lambda.Runtime.NODEJS_14_X, - ephemeralStorageSize: Size.mebibytes(511), - })).toThrow(/Ephemeral storage size must be between 512 and 10240 MB/); -}); - -test('set ephemeral storage to desired size', () => { - const stack = new cdk.Stack(); - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'bar', - runtime: lambda.Runtime.NODEJS_14_X, - ephemeralStorageSize: Size.mebibytes(1024), - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: - { - Code: { ZipFile: 'foo' }, - Handler: 'bar', - Runtime: 'nodejs14.x', - EphemeralStorage: { - Size: 1024, - }, - }, - }); -}); - -test('ephemeral storage allows unresolved tokens', () => { - const stack = new cdk.Stack(); - expect(() => { - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'bar', - runtime: lambda.Runtime.NODEJS_14_X, - ephemeralStorageSize: Size.mebibytes(Lazy.number({ produce: () => 1024 })), - }); - }).not.toThrow(); -}); - -test('FunctionVersionUpgrade adds new description to function', () => { - const app = new cdk.App({ context: { [cxapi.LAMBDA_RECOGNIZE_LAYER_VERSION]: true } }); - const stack = new cdk.Stack(app); - new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'bar', - runtime: lambda.Runtime.NODEJS_14_X, - description: 'my description', - }); - - Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(cxapi.LAMBDA_RECOGNIZE_LAYER_VERSION)); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: - { - Code: { ZipFile: 'foo' }, - Handler: 'bar', - Runtime: 'nodejs14.x', - Description: 'my description version-hash:54f18c47346ed84843c2dac547de81fa', - }, - }); -}); - -test('function using a reserved environment variable', () => { - const stack = new cdk.Stack(); - expect(() => new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.PYTHON_3_9, - environment: { - AWS_REGION: 'ap-southeast-2', - }, - })).toThrow(/AWS_REGION environment variable is reserved/); -}); - -test('set SnapStart to desired value', () => { - const stack = new cdk.Stack(); - new lambda.CfnFunction(stack, 'MyLambda', { - code: { - zipFile: 'java11-test-function.zip', - }, - functionName: 'MyCDK-SnapStart-Function', - handler: 'example.Handler::handleRequest', - role: 'testRole', - runtime: 'java11', - snapStart: { applyOn: 'PublishedVersions' }, - }); - - Template.fromStack(stack).hasResource('AWS::Lambda::Function', { - Properties: - { - Code: { ZipFile: 'java11-test-function.zip' }, - Handler: 'example.Handler::handleRequest', - Runtime: 'java11', - SnapStart: { - ApplyOn: 'PublishedVersions', - }, - }, - }); -}); - -function newTestLambda(scope: constructs.Construct) { - return new lambda.Function(scope, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'bar', - runtime: lambda.Runtime.PYTHON_3_9, - }); -} diff --git a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts b/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts deleted file mode 100644 index 9c99d4cd7d768..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.assets.lit.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - /// !show - new lambda.Function(this, 'MyLambda', { - code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), - handler: 'index.main', - runtime: lambda.Runtime.PYTHON_3_9, - }); - /// !hide - } -} - -const app = new cdk.App(); - -new TestStack(app, 'lambda-test-assets'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.ts b/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.ts deleted file mode 100644 index 6203e718caafc..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.autoscaling.lit.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cdk from '@aws-cdk/core'; -import { LAMBDA_RECOGNIZE_LAYER_VERSION } from '@aws-cdk/cx-api'; -import * as lambda from '../lib'; - -/** -* Stack verification steps: -* aws application-autoscaling describe-scalable-targets --service-namespace lambda --resource-ids function::prod -* has a minCapacity of 3 and maxCapacity of 50 -*/ -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - const fn = new lambda.Function(this, 'MyLambda', { - code: new lambda.InlineCode('exports.handler = async () => { console.log(\'hello world\'); };'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const version = fn.currentVersion; - - const alias = new lambda.Alias(this, 'Alias', { - aliasName: 'prod', - version, - }); - - const scalingTarget = alias.addAutoScaling({ minCapacity: 3, maxCapacity: 50 }); - - scalingTarget.scaleOnUtilization({ - utilizationTarget: 0.5, - }); - - scalingTarget.scaleOnSchedule('ScaleUpInTheMorning', { - schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), - minCapacity: 20, - }); - - scalingTarget.scaleOnSchedule('ScaleDownAtNight', { - schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), - maxCapacity: 20, - }); - - new cdk.CfnOutput(this, 'FunctionName', { - value: fn.functionName, - }); - } -} - -const app = new cdk.App(); - -const stack = new TestStack(app, 'aws-lambda-autoscaling'); - -// Changes the function description when the feature flag is present -// to validate the changed function hash. -cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(LAMBDA_RECOGNIZE_LAYER_VERSION)); - -app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts b/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts deleted file mode 100644 index c00e9d141a4f6..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.lambda.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { LAMBDA_RECOGNIZE_LAYER_VERSION } from '@aws-cdk/cx-api'; -import * as lambda from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-lambda-1'); - -const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); - -fn.addToRolePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['*'], -})); -fn.addFunctionUrl(); - -const version = fn.currentVersion; - -const alias = new lambda.Alias(stack, 'Alias', { - aliasName: 'prod', - version, -}); -alias.addPermission('AliasPermission', { - principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), -}); -alias.addFunctionUrl({ - authType: lambda.FunctionUrlAuthType.NONE, -}); - -// Changes the function description when the feature flag is present -// to validate the changed function hash. -cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(LAMBDA_RECOGNIZE_LAYER_VERSION)); - -app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.d.ts b/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.d.ts deleted file mode 100644 index 62d2eeab03274..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function main(_event: any, _context: any): Promise; diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.js b/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.js deleted file mode 100644 index dbe4f6ee3ee40..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.js.snapshot/asset.8811a2632ac5564a08fd269e159298f7e497f259578b0dc5e927a1f48ab24d34/layer.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = void 0; -async function main(_event, _context) { - return 'Done!'; -} -exports.main = main; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF5ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJsYXllci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBTyxLQUFLLFVBQVUsSUFBSSxDQUFDLE1BQVcsRUFBRSxRQUFhO0lBQ25ELE9BQU8sT0FBTyxDQUFDO0FBQ2pCLENBQUM7QUFGRCxvQkFFQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBhc3luYyBmdW5jdGlvbiBtYWluKF9ldmVudDogYW55LCBfY29udGV4dDogYW55KSB7XG4gIHJldHVybiAnRG9uZSEnO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts b/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts deleted file mode 100644 index 49ba7c75a8675..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.layer-version.lit.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-layer-version-1'); - -// Just for the example - granting to the current account is not necessary. -const awsAccountId = stack.account; - -/// !show -const layer = new lambda.LayerVersion(stack, 'MyLayer', { - code: lambda.Code.fromAsset(path.join(__dirname, 'layer-code')), - compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], - license: 'Apache-2.0', - description: 'A layer to test the L2 construct', -}); - -// To grant usage by other AWS accounts -layer.addPermission('remote-account-grant', { accountId: awsAccountId }); - -// To grant usage to all accounts in some AWS Ogranization -// layer.grantUsage({ accountId: '*', organizationId }); - -new lambda.Function(stack, 'MyLayeredLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - layers: [layer], -}); -/// !hide - -app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdBQUcsT0FBTyxFQUFFLFVBQVUsSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUM1RSxNQUFNLEtBQUssR0FBRyxPQUFPLEVBQUUsWUFBWSxFQUFFLElBQUksSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUM7SUFDeEYsR0FBRztRQUNELElBQUk7WUFDRixNQUFNLGNBQWMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsRUFBRSxVQUFVLEVBQUUsWUFBWSxFQUFFLE1BQU0sRUFBRSxHQUFH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ICAgICAgYmFzZTogcGFyc2VJbnQocmF3T3B0aW9ucy5iYXNlLCAxMCksXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXRyeU9wdGlvbnM7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts b/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts deleted file mode 100644 index 7fd38e6395683..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.log-retention.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-lambda-log-retention'); - -new lambda.Function(stack, 'OneWeek', { - code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - logRetention: logs.RetentionDays.ONE_WEEK, -}); - -new lambda.Function(stack, 'OneMonth', { - code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - logRetention: logs.RetentionDays.ONE_MONTH, -}); - -new lambda.Function(stack, 'OneYear', { - code: new lambda.InlineCode('exports.handler = (event) => console.log(JSON.stringify(event));'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - logRetention: logs.RetentionDays.ONE_YEAR, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.permissions.ts b/packages/@aws-cdk/aws-lambda/test/integ.permissions.ts deleted file mode 100644 index 92a9964dd76d2..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.permissions.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'lambda-permissions'); - -const fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, -}); - -fn.grantInvoke(new iam.AnyPrincipal().inOrganization('o-yyyyyyyyyy')); - -fn.grantInvoke(new iam.OrganizationPrincipal('o-xxxxxxxxxx')); diff --git a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts b/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts deleted file mode 100644 index 1c7c994c28bd9..0000000000000 --- a/packages/@aws-cdk/aws-lambda/test/integ.vpc-lambda.ts +++ /dev/null @@ -1,17 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as lambda from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-vpc-lambda'); -const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); - -new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('def main(event, context): pass'), - handler: 'index.main', - runtime: lambda.Runtime.PYTHON_3_9, - vpc, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-lex/.eslintrc.js b/packages/@aws-cdk/aws-lex/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-lex/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lex/.gitignore b/packages/@aws-cdk/aws-lex/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-lex/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-lex/.npmignore b/packages/@aws-cdk/aws-lex/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-lex/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-lex/LICENSE b/packages/@aws-cdk/aws-lex/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-lex/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-lex/NOTICE b/packages/@aws-cdk/aws-lex/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-lex/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-lex/README.md b/packages/@aws-cdk/aws-lex/README.md deleted file mode 100644 index 91d95ca9a314c..0000000000000 --- a/packages/@aws-cdk/aws-lex/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Lex Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as lex from '@aws-cdk/aws-lex'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Lex construct libraries](https://constructs.dev/search?q=lex) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Lex resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lex.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Lex](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lex.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-lex/jest.config.js b/packages/@aws-cdk/aws-lex/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-lex/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lex/lib/index.ts b/packages/@aws-cdk/aws-lex/lib/index.ts deleted file mode 100644 index b8085185a8f7f..0000000000000 --- a/packages/@aws-cdk/aws-lex/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Lex CloudFormation Resources: -export * from './lex.generated'; diff --git a/packages/@aws-cdk/aws-lex/package.json b/packages/@aws-cdk/aws-lex/package.json deleted file mode 100644 index 9fc3429bf0566..0000000000000 --- a/packages/@aws-cdk/aws-lex/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-lex", - "version": "0.0.0", - "description": "AWS::Lex Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Lex", - "packageId": "Amazon.CDK.AWS.Lex", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.lex", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "lex" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-lex", - "module": "aws_cdk.aws_lex" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-lex" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Lex", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Lex", - "aws-lex" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-lex/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-lex/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-lex/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-lex/test/lex.test.ts b/packages/@aws-cdk/aws-lex/test/lex.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-lex/test/lex.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-licensemanager/.eslintrc.js b/packages/@aws-cdk/aws-licensemanager/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-licensemanager/.gitignore b/packages/@aws-cdk/aws-licensemanager/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-licensemanager/.npmignore b/packages/@aws-cdk/aws-licensemanager/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-licensemanager/LICENSE b/packages/@aws-cdk/aws-licensemanager/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-licensemanager/NOTICE b/packages/@aws-cdk/aws-licensemanager/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-licensemanager/README.md b/packages/@aws-cdk/aws-licensemanager/README.md deleted file mode 100644 index a99555c37dc4e..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::LicenseManager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as licensemanager from '@aws-cdk/aws-licensemanager'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for LicenseManager construct libraries](https://constructs.dev/search?q=licensemanager) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LicenseManager resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LicenseManager.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LicenseManager](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LicenseManager.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-licensemanager/jest.config.js b/packages/@aws-cdk/aws-licensemanager/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-licensemanager/lib/index.ts b/packages/@aws-cdk/aws-licensemanager/lib/index.ts deleted file mode 100644 index 8f0c132b6e5ef..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::LicenseManager CloudFormation Resources: -export * from './licensemanager.generated'; diff --git a/packages/@aws-cdk/aws-licensemanager/package.json b/packages/@aws-cdk/aws-licensemanager/package.json deleted file mode 100644 index 38b88aacf36c2..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-licensemanager", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::LicenseManager", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.LicenseManager", - "packageId": "Amazon.CDK.AWS.LicenseManager", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.licensemanager", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "licensemanager" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-licensemanager", - "module": "aws_cdk.aws_licensemanager" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-licensemanager" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::LicenseManager", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::LicenseManager", - "aws-licensemanager" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-licensemanager/test/licensemanager.test.ts b/packages/@aws-cdk/aws-licensemanager/test/licensemanager.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-licensemanager/test/licensemanager.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-lightsail/.eslintrc.js b/packages/@aws-cdk/aws-lightsail/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lightsail/.gitignore b/packages/@aws-cdk/aws-lightsail/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-lightsail/.npmignore b/packages/@aws-cdk/aws-lightsail/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-lightsail/LICENSE b/packages/@aws-cdk/aws-lightsail/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-lightsail/NOTICE b/packages/@aws-cdk/aws-lightsail/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-lightsail/README.md b/packages/@aws-cdk/aws-lightsail/README.md deleted file mode 100644 index c1905532dba7f..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Lightsail Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as lightsail from '@aws-cdk/aws-lightsail'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Lightsail construct libraries](https://constructs.dev/search?q=lightsail) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Lightsail resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lightsail.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Lightsail](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lightsail.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-lightsail/jest.config.js b/packages/@aws-cdk/aws-lightsail/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lightsail/lib/index.ts b/packages/@aws-cdk/aws-lightsail/lib/index.ts deleted file mode 100644 index f7da3b26e282a..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Lightsail CloudFormation Resources: -export * from './lightsail.generated'; diff --git a/packages/@aws-cdk/aws-lightsail/package.json b/packages/@aws-cdk/aws-lightsail/package.json deleted file mode 100644 index 9ffa9f6cd6998..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-lightsail", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Lightsail", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Lightsail", - "packageId": "Amazon.CDK.AWS.Lightsail", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.lightsail", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "lightsail" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-lightsail", - "module": "aws_cdk.aws_lightsail" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-lightsail" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Lightsail", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Lightsail", - "aws-lightsail" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-lightsail/test/lightsail.test.ts b/packages/@aws-cdk/aws-lightsail/test/lightsail.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-lightsail/test/lightsail.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-location/.eslintrc.js b/packages/@aws-cdk/aws-location/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-location/.eslintrc.js +++ b/packages/@aws-cdk/aws-location/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-location/.gitignore b/packages/@aws-cdk/aws-location/.gitignore index a103aefa2bfbb..276e2e169d01b 100644 --- a/packages/@aws-cdk/aws-location/.gitignore +++ b/packages/@aws-cdk/aws-location/.gitignore @@ -22,3 +22,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-location/README.md b/packages/@aws-cdk/aws-location/README.md index 9221ecf549270..5d0a8bd1b624d 100644 --- a/packages/@aws-cdk/aws-location/README.md +++ b/packages/@aws-cdk/aws-location/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. diff --git a/packages/@aws-cdk/aws-location/lib/index.ts b/packages/@aws-cdk/aws-location/lib/index.ts index d281a498ac7cc..845bf77540edf 100644 --- a/packages/@aws-cdk/aws-location/lib/index.ts +++ b/packages/@aws-cdk/aws-location/lib/index.ts @@ -1,4 +1,3 @@ export * from './place-index'; // AWS::Location CloudFormation Resources: -export * from './location.generated'; diff --git a/packages/@aws-cdk/aws-location/lib/place-index.ts b/packages/@aws-cdk/aws-location/lib/place-index.ts index 767ce402a42c0..e4af4bd9c50d0 100644 --- a/packages/@aws-cdk/aws-location/lib/place-index.ts +++ b/packages/@aws-cdk/aws-location/lib/place-index.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, IResource, Lazy, Names, Resource, Stack, Token } from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { ArnFormat, IResource, Lazy, Names, Resource, Stack, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnPlaceIndex } from './location.generated'; +import { CfnPlaceIndex } from 'aws-cdk-lib/aws-location'; /** * A Place Index diff --git a/packages/@aws-cdk/aws-location/package.json b/packages/@aws-cdk/aws-location/package.json index a7157e8e78847..3efd9934896ea 100644 --- a/packages/@aws-cdk/aws-location/package.json +++ b/packages/@aws-cdk/aws-location/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-cdk/aws-location", + "name": "@aws-cdk/aws-location-alpha", "version": "0.0.0", "description": "The CDK Construct Library for AWS::Location", "main": "lib/index.js", @@ -9,17 +9,17 @@ "projectReferences": true, "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Location", - "packageId": "Amazon.CDK.AWS.Location", + "namespace": "Amazon.CDK.AWS.Location.Alpha", + "packageId": "Amazon.CDK.AWS.Location.Alpha", "signAssembly": true, "assemblyOriginatorKeyFile": "../../key.snk", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.location", + "package": "software.amazon.awscdk.services.location.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "location" + "artifactId": "location-alpha" } }, "python": { @@ -27,8 +27,12 @@ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ], - "distName": "aws-cdk.aws-location", - "module": "aws_cdk.aws_location" + "distName": "aws-cdk.aws-location-alpha", + "module": "aws_cdk.aws_location_alpha" + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdklocationalpha" } }, "metadata": { @@ -54,17 +58,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Location", "env": { "AWSLINT_BASE_CONSTRUCT": "true" } @@ -83,22 +84,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "constructs": "^10.0.0" + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -110,7 +107,18 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" + }, + "private": false, + "awslint": { + "exclude": [ + "*:*" + ] }, - "private": true + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + } } diff --git a/packages/@aws-cdk/aws-location/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-location/rosetta/default.ts-fixture index 107841df19d1e..4dfb2134f19d1 100644 --- a/packages/@aws-cdk/aws-location/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-location/rosetta/default.ts-fixture @@ -1,8 +1,8 @@ // Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as location from '@aws-cdk/aws-location'; -import * as iam from '@aws-cdk/aws-iam'; +import * as location from '@aws-cdk/aws-location-alpha'; +import * as iam from 'aws-cdk-lib/aws-iam'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-location/test/integ.place-index.ts b/packages/@aws-cdk/aws-location/test/integ.place-index.ts index 1e6a50f403451..ec7b4274795fd 100644 --- a/packages/@aws-cdk/aws-location/test/integ.place-index.ts +++ b/packages/@aws-cdk/aws-location/test/integ.place-index.ts @@ -1,5 +1,5 @@ -import { App, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import { App, Stack } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import { PlaceIndex } from '../lib'; diff --git a/packages/@aws-cdk/aws-location/test/place-index.test.ts b/packages/@aws-cdk/aws-location/test/place-index.test.ts index e44cc79db7f9d..763ff44c573f6 100644 --- a/packages/@aws-cdk/aws-location/test/place-index.test.ts +++ b/packages/@aws-cdk/aws-location/test/place-index.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Stack } from 'aws-cdk-lib'; import { DataSource, IntendedUse, PlaceIndex } from '../lib/place-index'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-logs-destinations/.eslintrc.js b/packages/@aws-cdk/aws-logs-destinations/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-logs-destinations/.gitignore b/packages/@aws-cdk/aws-logs-destinations/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-logs-destinations/.npmignore b/packages/@aws-cdk/aws-logs-destinations/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-logs-destinations/LICENSE b/packages/@aws-cdk/aws-logs-destinations/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-logs-destinations/NOTICE b/packages/@aws-cdk/aws-logs-destinations/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-logs-destinations/README.md b/packages/@aws-cdk/aws-logs-destinations/README.md deleted file mode 100644 index 599963c35ece4..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# AWS CloudWatch Logs Subscription Destination Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library contains destinations for AWS CloudWatch Logs SubscriptionFilters. You -can send log data to Kinesis Streams or Lambda Functions. - -See the documentation of the `logs` module for more information. diff --git a/packages/@aws-cdk/aws-logs-destinations/jest.config.js b/packages/@aws-cdk/aws-logs-destinations/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-logs-destinations/lib/kinesis.ts b/packages/@aws-cdk/aws-logs-destinations/lib/kinesis.ts deleted file mode 100644 index 06ccd31bf926d..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/lib/kinesis.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as logs from '@aws-cdk/aws-logs'; -import { Construct } from 'constructs'; - -/** - * Customize the Kinesis Logs Destination - */ -export interface KinesisDestinationProps { - /** - * The role to assume to write log events to the destination - * - * @default - A new Role is created - */ - readonly role?: iam.IRole; -} - -/** - * Use a Kinesis stream as the destination for a log subscription - */ -export class KinesisDestination implements logs.ILogSubscriptionDestination { - /** - * @param stream The Kinesis stream to use as destination - * @param props The Kinesis Destination properties - * - */ - constructor(private readonly stream: kinesis.IStream, private readonly props: KinesisDestinationProps = {}) { - } - - public bind(scope: Construct, _sourceLogGroup: logs.ILogGroup): logs.LogSubscriptionDestinationConfig { - // Following example from https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#DestinationKinesisExample - // Create a role to be assumed by CWL that can write to this stream and pass itself. - const id = 'CloudWatchLogsCanPutRecords'; - const role = this.props.role ?? scope.node.tryFindChild(id) as iam.IRole ?? new iam.Role(scope, id, { - assumedBy: new iam.ServicePrincipal('logs.amazonaws.com'), - }); - this.stream.grantWrite(role); - role.grantPassRole(role); - - const policy = role.node.tryFindChild('DefaultPolicy') as iam.CfnPolicy; - if (policy) { - // Remove circular dependency - const cfnRole = role.node.defaultChild as iam.CfnRole; - cfnRole.addOverride('DependsOn', undefined); - - // Ensure policy is created before subscription filter - scope.node.addDependency(policy); - } - - return { arn: this.stream.streamArn, role }; - } -} diff --git a/packages/@aws-cdk/aws-logs-destinations/lib/lambda.ts b/packages/@aws-cdk/aws-logs-destinations/lib/lambda.ts deleted file mode 100644 index bf7b3c09029b1..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/lib/lambda.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import { Construct } from 'constructs'; - -/** - * Options that may be provided to LambdaDestination - */ -export interface LambdaDestinationOptions { - /** Whether or not to add Lambda Permissions. - * @default true - */ - readonly addPermissions?: boolean; -} - -/** - * Use a Lambda Function as the destination for a log subscription - */ -export class LambdaDestination implements logs.ILogSubscriptionDestination { - /** LambdaDestinationOptions */ - constructor(private readonly fn: lambda.IFunction, private readonly options: LambdaDestinationOptions = {}) { - } - - public bind(scope: Construct, logGroup: logs.ILogGroup): logs.LogSubscriptionDestinationConfig { - const arn = logGroup.logGroupArn; - if (this.options.addPermissions !== false) { - const permissionId = 'CanInvokeLambda'; - this.fn.addPermission(permissionId, { - principal: new iam.ServicePrincipal('logs.amazonaws.com'), - sourceArn: arn, - // Using SubScription Filter as scope is okay, since every Subscription Filter has only - // one destination. - scope, - }); - // Need to add a dependency, otherwise the SubscriptionFilter can be created before the - // Permission that allows the interaction. - const cfnPermission = scope.node.tryFindChild( - permissionId, - ) as lambda.CfnPermission; - if (cfnPermission) { - scope.node.addDependency(cfnPermission); - } - } - return { arn: this.fn.functionArn }; - } -} diff --git a/packages/@aws-cdk/aws-logs-destinations/package.json b/packages/@aws-cdk/aws-logs-destinations/package.json deleted file mode 100644 index 6b181461cec78..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/package.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "name": "@aws-cdk/aws-logs-destinations", - "version": "0.0.0", - "private": true, - "description": "Log Destinations for AWS CloudWatch Logs", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.logs.destinations", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "logs-destinations" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Logs.Destinations", - "packageId": "Amazon.CDK.AWS.Logs.Destinations", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-logs-destinations", - "module": "aws_cdk.aws_logs_destinations", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-logs-destinations" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "logs" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-lambda-destinations": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.ts b/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.ts deleted file mode 100644 index 59280e55ffad5..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/test/integ.kinesis.ts +++ /dev/null @@ -1,35 +0,0 @@ -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as logs from '@aws-cdk/aws-logs'; -import { App, Stack, RemovalPolicy } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as constructs from 'constructs'; -import * as dests from '../lib'; - - -class KinesisEnv extends Stack { - constructor(scope: constructs.Construct, id: string) { - super(scope, id); - - const stream = new kinesis.Stream(this, 'MyStream'); - const logGroup = new logs.LogGroup(this, 'LogGroup', { removalPolicy: RemovalPolicy.DESTROY }); - const kinesisDestination = new dests.KinesisDestination(stream); - - new logs.SubscriptionFilter(this, 'Subscription', { - logGroup: logGroup, - destination: kinesisDestination, - filterPattern: logs.FilterPattern.allEvents(), - }); - } -} - -const app = new App(); -const stack = new KinesisEnv(app, 'kinesis-logsubscription-integ'); - -// If the proper dependency is not set, then the deployment fails with: -// Resource handler returned message: "Could not deliver test message to specified -// Kinesis stream. Check if the given kinesis stream is in ACTIVE state. -// (Service: CloudWatchLogs, Status Code: 400, Request ID: [...])" -new IntegTest(app, 'KinesisInteg', { - testCases: [stack], -}); -app.synth(); diff --git a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.ts b/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.ts deleted file mode 100644 index 4a8c26a51bfcf..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/test/integ.lambda.ts +++ /dev/null @@ -1,91 +0,0 @@ -import * as events from '@aws-cdk/aws-events'; -import { CloudWatchLogGroup, LogGroupTargetInput } from '@aws-cdk/aws-events-targets'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { SqsDestination } from '@aws-cdk/aws-lambda-destinations'; -import * as logs from '@aws-cdk/aws-logs'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, Stack, RemovalPolicy } from '@aws-cdk/core'; -import { IntegTest, ExpectedResult, Match } from '@aws-cdk/integ-tests'; -import * as constructs from 'constructs'; -import { LambdaDestination } from '../lib'; - -class LambdaStack extends Stack { - - public readonly queue: sqs.Queue; - - constructor(scope: constructs.Construct, id: string) { - super(scope, id); - - this.queue = new sqs.Queue(this, 'Queue'); - - const fn = new lambda.Function(this, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_16_X, - handler: 'index.handler', - code: lambda.Code.fromInline(`exports.handler = async (event) => { - return 'success'; - };`), - onSuccess: new SqsDestination(this.queue), - }); - - const logGroup = new logs.LogGroup(this, 'LogGroup', { removalPolicy: RemovalPolicy.DESTROY }); - const lambdaDestination = new LambdaDestination(fn); - - new logs.SubscriptionFilter(this, 'Subscription', { - logGroup: logGroup, - destination: lambdaDestination, - filterPattern: logs.FilterPattern.allEvents(), - }); - - const customRule = new events.Rule(this, 'CustomRule', { - eventPattern: { - source: ['cdk-lambda-integ'], - detailType: ['cdk-integ-custom-rule'], - }, - }); - customRule.addTarget(new CloudWatchLogGroup(logGroup, { - logEvent: LogGroupTargetInput.fromObject({ - message: 'Howdy Ho!', - }), - })); - } -} - -const app = new App(); -const stack = new LambdaStack(app, 'lambda-logssubscription-integ'); - -const integ = new IntegTest(app, 'LambdaInteg', { - testCases: [stack], -}); - -const putEvents = integ.assertions.awsApiCall('EventBridge', 'putEvents', { - Entries: [ - { - Detail: JSON.stringify({ - foo: 'bar', - }), - DetailType: 'cdk-integ-custom-rule', - Source: 'cdk-lambda-integ', - }, - ], -}); -putEvents.provider.addToRolePolicy({ - Effect: 'Allow', - Action: ['events:PutEvents'], - Resource: ['*'], -}); - -const receiveMessage = integ.assertions.awsApiCall('SQS', 'receiveMessage', { - QueueUrl: stack.queue.queueUrl, - WaitTimeSeconds: 20, -}); - -// TODO: Replace with `receiveMessage.assertAtPath('Messages.0.Body', ExpectedResult.objectLike({...` -// when issue #24215 is addressed -receiveMessage.expect(ExpectedResult.objectLike( { - Messages: - [{ - Body: Match.stringLikeRegexp( '"responsePayload":"success"' ), - }], -})); - -app.synth(); diff --git a/packages/@aws-cdk/aws-logs-destinations/test/kinesis.test.ts b/packages/@aws-cdk/aws-logs-destinations/test/kinesis.test.ts deleted file mode 100644 index 9f0e5b863be7d..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/test/kinesis.test.ts +++ /dev/null @@ -1,195 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as dests from '../lib'; - -test('stream can be subscription destination', () => { - // GIVEN - const stack = new cdk.Stack(); - const stream = new kinesis.Stream(stack, 'MyStream'); - const logGroup = new logs.LogGroup(stack, 'LogGroup'); - - // WHEN - new logs.SubscriptionFilter(stack, 'Subscription', { - logGroup, - destination: new dests.KinesisDestination(stream), - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN: subscription target is Stream - Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { - DestinationArn: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, - RoleArn: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, - }); - - // THEN: we have a role to write to the Stream - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Version: '2012-10-17', - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: { - 'Fn::Join': ['', [ - 'logs.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - }, - }], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: [ - 'kinesis:ListShards', - 'kinesis:PutRecord', - 'kinesis:PutRecords', - ], - Effect: 'Allow', - Resource: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, - }, - { - Action: 'iam:PassRole', - Effect: 'Allow', - Resource: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, - }, - ], - }, - }); -}); - -test('stream can be subscription destination twice, without duplicating permissions', () => { - // GIVEN - const stack = new cdk.Stack(); - const stream = new kinesis.Stream(stack, 'MyStream'); - const logGroup1 = new logs.LogGroup(stack, 'LogGroup'); - const logGroup2 = new logs.LogGroup(stack, 'LogGroup2'); - - // WHEN - new logs.SubscriptionFilter(stack, 'Subscription', { - logGroup: logGroup1, - destination: new dests.KinesisDestination(stream), - filterPattern: logs.FilterPattern.allEvents(), - }); - - new logs.SubscriptionFilter(stack, 'Subscription2', { - logGroup: logGroup2, - destination: new dests.KinesisDestination(stream), - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN: subscription target is Stream - Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { - DestinationArn: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, - RoleArn: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, - }); - - // THEN: we have a role to write to the Stream - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Version: '2012-10-17', - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: { - 'Fn::Join': ['', [ - 'logs.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - }, - }], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [ - { - Action: [ - 'kinesis:ListShards', - 'kinesis:PutRecord', - 'kinesis:PutRecords', - ], - Effect: 'Allow', - Resource: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, - }, - { - Action: 'iam:PassRole', - Effect: 'Allow', - Resource: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, - }, - ], - }, - }); -}); - -test('an existing IAM role can be passed to new destination instance instead of auto-created ', ()=> { - // GIVEN - const stack = new cdk.Stack(); - const stream = new kinesis.Stream(stack, 'MyStream'); - const logGroup = new logs.LogGroup(stack, 'LogGroup'); - - const importedRole = iam.Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::123456789012:role/ImportedRoleKinesisDestinationTest'); - - const kinesisDestination = new dests.KinesisDestination(stream, { role: importedRole }); - - new logs.SubscriptionFilter(logGroup, 'MySubscriptionFilter', { - logGroup: logGroup, - destination: kinesisDestination, - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN - const template = Template.fromStack(stack); - template.resourceCountIs('AWS::IAM::Role', 0); - template.hasResourceProperties('AWS::Logs::SubscriptionFilter', { - RoleArn: importedRole.roleArn, - }); -}); - -test('creates a new IAM Role if not passed on new destination instance', ()=> { - // GIVEN - const stack = new cdk.Stack(); - const stream = new kinesis.Stream(stack, 'MyStream'); - const logGroup = new logs.LogGroup(stack, 'LogGroup'); - - const kinesisDestination = new dests.KinesisDestination(stream); - - new logs.SubscriptionFilter(logGroup, 'MySubscriptionFilter', { - logGroup: logGroup, - destination: kinesisDestination, - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN - const template = Template.fromStack(stack); - template.resourceCountIs('AWS::IAM::Role', 1); - template.hasResourceProperties('AWS::Logs::SubscriptionFilter', { - RoleArn: { - 'Fn::GetAtt': [ - 'LogGroupMySubscriptionFilterCloudWatchLogsCanPutRecords9112BD02', - 'Arn', - ], - }, - }); - - // THEN: SubscriptionFilter depends on the default Role's Policy - template.hasResource('AWS::Logs::SubscriptionFilter', { - DependsOn: ['LogGroupMySubscriptionFilterCloudWatchLogsCanPutRecordsDefaultPolicyEC6729D5'], - }); -}); diff --git a/packages/@aws-cdk/aws-logs-destinations/test/lambda.test.ts b/packages/@aws-cdk/aws-logs-destinations/test/lambda.test.ts deleted file mode 100644 index a4ef98281d92f..0000000000000 --- a/packages/@aws-cdk/aws-logs-destinations/test/lambda.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as dests from '../lib'; - -let stack: cdk.Stack; -let fn: lambda.Function; -let logGroup: logs.LogGroup; - -beforeEach(() => { - // GIVEN - stack = new cdk.Stack(); - fn = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - logGroup = new logs.LogGroup(stack, 'LogGroup'); -}); - -test('lambda can be used as metric subscription destination', () => { - // WHEN - new logs.SubscriptionFilter(stack, 'Subscription', { - logGroup, - destination: new dests.LambdaDestination(fn), - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN: subscription target is Lambda - Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { - DestinationArn: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - }); - - // THEN: Lambda has permissions to be invoked by CWL - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - Principal: 'logs.amazonaws.com', - }); -}); - -test('can have multiple subscriptions use the same Lambda', () => { - // WHEN - new logs.SubscriptionFilter(stack, 'Subscription', { - logGroup, - destination: new dests.LambdaDestination(fn), - filterPattern: logs.FilterPattern.allEvents(), - }); - - new logs.SubscriptionFilter(stack, 'Subscription2', { - logGroup: new logs.LogGroup(stack, 'LG2'), - destination: new dests.LambdaDestination(fn), - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN: Lambda has permissions to be invoked by CWL from both Source Arns - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - SourceArn: { 'Fn::GetAtt': ['LogGroupF5B46931', 'Arn'] }, - Principal: 'logs.amazonaws.com', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - SourceArn: { 'Fn::GetAtt': ['LG224A94C8F', 'Arn'] }, - Principal: 'logs.amazonaws.com', - }); -}); - -test('lambda permissions are not added when addPermissions is false', () => { - // WHEN - new logs.SubscriptionFilter(stack, 'Subscription', { - logGroup, - destination: new dests.LambdaDestination(fn, { addPermissions: false }), - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN: subscription target is Lambda - Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { - DestinationArn: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - }); - - // THEN: Lambda does not have permissions to be invoked by CWL - expect(Template.fromStack(stack).findResources('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, - Principal: 'logs.amazonaws.com', - })).toEqual({}); -}); - -test('subscription depends on lambda\'s permission', () => { - // WHEN - new logs.SubscriptionFilter(stack, 'Subscription', { - logGroup, - destination: new dests.LambdaDestination(fn), - filterPattern: logs.FilterPattern.allEvents(), - }); - - // THEN: Subscription filter depends on Lambda's Permission - Template.fromStack(stack).hasResource('AWS::Logs::SubscriptionFilter', { - DependsOn: ['SubscriptionCanInvokeLambdaD31DEAD2'], - }); -}); diff --git a/packages/@aws-cdk/aws-logs/.eslintrc.js b/packages/@aws-cdk/aws-logs/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-logs/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-logs/.gitignore b/packages/@aws-cdk/aws-logs/.gitignore deleted file mode 100644 index a0575d838326c..0000000000000 --- a/packages/@aws-cdk/aws-logs/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -.jsii -dist -lib/generated/resources.ts -node_modules -tsconfig.json - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-logs/.npmignore b/packages/@aws-cdk/aws-logs/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-logs/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-logs/LICENSE b/packages/@aws-cdk/aws-logs/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-logs/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-logs/NOTICE b/packages/@aws-cdk/aws-logs/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-logs/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-logs/README.md b/packages/@aws-cdk/aws-logs/README.md deleted file mode 100644 index 5a6a28f74547d..0000000000000 --- a/packages/@aws-cdk/aws-logs/README.md +++ /dev/null @@ -1,351 +0,0 @@ -# Amazon CloudWatch Logs Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library supplies constructs for working with CloudWatch Logs. - -## Log Groups/Streams - -The basic unit of CloudWatch is a *Log Group*. Every log group typically has the -same kind of data logged to it, in the same format. If there are multiple -applications or services logging into the Log Group, each of them creates a new -*Log Stream*. - -Every log operation creates a "log event", which can consist of a simple string -or a single-line JSON object. JSON objects have the advantage that they afford -more filtering abilities (see below). - -The only configurable attribute for log streams is the retention period, which -configures after how much time the events in the log stream expire and are -deleted. - -The default retention period if not supplied is 2 years, but it can be set to -one of the values in the `RetentionDays` enum to configure a different -retention period (including infinite retention). - -[retention example](test/example.retention.lit.ts) - -## LogRetention - -The `LogRetention` construct is a way to control the retention period of log groups that are created outside of the CDK. The construct is usually -used on log groups that are auto created by AWS services, such as [AWS -lambda](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html). - -This is implemented using a [CloudFormation custom -resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html) -which pre-creates the log group if it doesn't exist, and sets the specified log retention period (never expire, by default). - -By default, the log group will be created in the same region as the stack. The `logGroupRegion` property can be used to configure -log groups in other regions. This is typically useful when controlling retention for log groups auto-created by global services that -publish their log group to a specific region, such as AWS Chatbot creating a log group in `us-east-1`. - -By default, the log group created by LogRetention will be retained after the stack is deleted. If the RemovalPolicy is set to DESTROY, then the log group will be deleted when the stack is deleted. - -## Resource Policy - -CloudWatch Resource Policies allow other AWS services or IAM Principals to put log events into the log groups. -A resource policy is automatically created when `addToResourcePolicy` is called on the LogGroup for the first time: - -```ts -const logGroup = new logs.LogGroup(this, 'LogGroup'); -logGroup.addToResourcePolicy(new iam.PolicyStatement({ - actions: ['logs:CreateLogStream', 'logs:PutLogEvents'], - principals: [new iam.ServicePrincipal('es.amazonaws.com')], - resources: [logGroup.logGroupArn], -})); -``` - -Or more conveniently, write permissions to the log group can be granted as follows which gives same result as in the above example. - -```ts -const logGroup = new logs.LogGroup(this, 'LogGroup'); -logGroup.grantWrite(new iam.ServicePrincipal('es.amazonaws.com')); -``` - -Similarily, read permissions can be granted to the log group as follows. - -```ts -const logGroup = new logs.LogGroup(this, 'LogGroup'); -logGroup.grantRead(new iam.ServicePrincipal('es.amazonaws.com')); -``` - -Be aware that any ARNs or tokenized values passed to the resource policy will be converted into AWS Account IDs. -This is because CloudWatch Logs Resource Policies do not accept ARNs as principals, but they do accept -Account ID strings. Non-ARN principals, like Service principals or Any principals, are accepted by CloudWatch. - -## Encrypting Log Groups - -By default, log group data is always encrypted in CloudWatch Logs. You have the -option to encrypt log group data using a AWS KMS customer master key (CMK) should -you not wish to use the default AWS encryption. Keep in mind that if you decide to -encrypt a log group, any service or IAM identity that needs to read the encrypted -log streams in the future will require the same CMK to decrypt the data. - -Here's a simple example of creating an encrypted Log Group using a KMS CMK. - -```ts -import * as kms from '@aws-cdk/aws-kms'; - -new logs.LogGroup(this, 'LogGroup', { - encryptionKey: new kms.Key(this, 'Key'), -}); -``` - -See the AWS documentation for more detailed information about [encrypting CloudWatch -Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html). - -## Subscriptions and Destinations - -Log events matching a particular filter can be sent to either a Lambda function -or a Kinesis stream. - -If the Kinesis stream lives in a different account, a `CrossAccountDestination` -object needs to be added in the destination account which will act as a proxy -for the remote Kinesis stream. This object is automatically created for you -if you use the CDK Kinesis library. - -Create a `SubscriptionFilter`, initialize it with an appropriate `Pattern` (see -below) and supply the intended destination: - -```ts -import * as destinations from '@aws-cdk/aws-logs-destinations'; -declare const fn: lambda.Function; -declare const logGroup: logs.LogGroup; - -new logs.SubscriptionFilter(this, 'Subscription', { - logGroup, - destination: new destinations.LambdaDestination(fn), - filterPattern: logs.FilterPattern.allTerms("ERROR", "MainThread"), -}); -``` - -## Metric Filters - -CloudWatch Logs can extract and emit metrics based on a textual log stream. -Depending on your needs, this may be a more convenient way of generating metrics -for you application than making calls to CloudWatch Metrics yourself. - -A `MetricFilter` either emits a fixed number every time it sees a log event -matching a particular pattern (see below), or extracts a number from the log -event and uses that as the metric value. - -Example: - -[metricfilter example](test/integ.metricfilter.lit.ts) - -Remember that if you want to use a value from the log event as the metric value, -you must mention it in your pattern somewhere. - -A very simple MetricFilter can be created by using the `logGroup.extractMetric()` -helper function: - -```ts -declare const logGroup: logs.LogGroup; -logGroup.extractMetric('$.jsonField', 'Namespace', 'MetricName'); -``` - -Will extract the value of `jsonField` wherever it occurs in JSON-structured -log records in the LogGroup, and emit them to CloudWatch Metrics under -the name `Namespace/MetricName`. - -### Exposing Metric on a Metric Filter - -You can expose a metric on a metric filter by calling the `MetricFilter.metric()` API. -This has a default of `statistic = 'avg'` if the statistic is not set in the `props`. - -```ts -declare const logGroup: logs.LogGroup; -const mf = new logs.MetricFilter(this, 'MetricFilter', { - logGroup, - metricNamespace: 'MyApp', - metricName: 'Latency', - filterPattern: logs.FilterPattern.exists('$.latency'), - metricValue: '$.latency', - dimensions: { - ErrorCode: '$.errorCode', - }, - unit: Unit.MILLISECONDS, -}); - -//expose a metric from the metric filter -const metric = mf.metric(); - -//you can use the metric to create a new alarm -new cloudwatch.Alarm(this, 'alarm from metric filter', { - metric, - threshold: 100, - evaluationPeriods: 2, -}); -``` - -## Patterns - -Patterns describe which log events match a subscription or metric filter. There -are three types of patterns: - -* Text patterns -* JSON patterns -* Space-delimited table patterns - -All patterns are constructed by using static functions on the `FilterPattern` -class. - -In addition to the patterns above, the following special patterns exist: - -* `FilterPattern.allEvents()`: matches all log events. -* `FilterPattern.literal(string)`: if you already know what pattern expression to - use, this function takes a string and will use that as the log pattern. For - more information, see the [Filter and Pattern - Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). - -### Text Patterns - -Text patterns match if the literal strings appear in the text form of the log -line. - -* `FilterPattern.allTerms(term, term, ...)`: matches if all of the given terms - (substrings) appear in the log event. -* `FilterPattern.anyTerm(term, term, ...)`: matches if all of the given terms - (substrings) appear in the log event. -* `FilterPattern.anyTermGroup([term, term, ...], [term, term, ...], ...)`: matches if - all of the terms in any of the groups (specified as arrays) matches. This is - an OR match. - -Examples: - -```ts -// Search for lines that contain both "ERROR" and "MainThread" -const pattern1 = logs.FilterPattern.allTerms('ERROR', 'MainThread'); - -// Search for lines that either contain both "ERROR" and "MainThread", or -// both "WARN" and "Deadlock". -const pattern2 = logs.FilterPattern.anyTermGroup( - ['ERROR', 'MainThread'], - ['WARN', 'Deadlock'], -); -``` - -## JSON Patterns - -JSON patterns apply if the log event is the JSON representation of an object -(without any other characters, so it cannot include a prefix such as timestamp -or log level). JSON patterns can make comparisons on the values inside the -fields. - -* **Strings**: the comparison operators allowed for strings are `=` and `!=`. - String values can start or end with a `*` wildcard. -* **Numbers**: the comparison operators allowed for numbers are `=`, `!=`, - `<`, `<=`, `>`, `>=`. - -Fields in the JSON structure are identified by identifier the complete object as `$` -and then descending into it, such as `$.field` or `$.list[0].field`. - -* `FilterPattern.stringValue(field, comparison, string)`: matches if the given - field compares as indicated with the given string value. -* `FilterPattern.numberValue(field, comparison, number)`: matches if the given - field compares as indicated with the given numerical value. -* `FilterPattern.isNull(field)`: matches if the given field exists and has the - value `null`. -* `FilterPattern.notExists(field)`: matches if the given field is not in the JSON - structure. -* `FilterPattern.exists(field)`: matches if the given field is in the JSON - structure. -* `FilterPattern.booleanValue(field, boolean)`: matches if the given field - is exactly the given boolean value. -* `FilterPattern.all(jsonPattern, jsonPattern, ...)`: matches if all of the - given JSON patterns match. This makes an AND combination of the given - patterns. -* `FilterPattern.any(jsonPattern, jsonPattern, ...)`: matches if any of the - given JSON patterns match. This makes an OR combination of the given - patterns. - -Example: - -```ts -// Search for all events where the component field is equal to -// "HttpServer" and either error is true or the latency is higher -// than 1000. -const pattern = logs.FilterPattern.all( - logs.FilterPattern.stringValue('$.component', '=', 'HttpServer'), - logs.FilterPattern.any( - logs.FilterPattern.booleanValue('$.error', true), - logs.FilterPattern.numberValue('$.latency', '>', 1000), - ), -); -``` - -## Space-delimited table patterns - -If the log events are rows of a space-delimited table, this pattern can be used -to identify the columns in that structure and add conditions on any of them. The -canonical example where you would apply this type of pattern is Apache server -logs. - -Text that is surrounded by `"..."` quotes or `[...]` square brackets will -be treated as one column. - -* `FilterPattern.spaceDelimited(column, column, ...)`: construct a - `SpaceDelimitedTextPattern` object with the indicated columns. The columns - map one-by-one the columns found in the log event. The string `"..."` may - be used to specify an arbitrary number of unnamed columns anywhere in the - name list (but may only be specified once). - -After constructing a `SpaceDelimitedTextPattern`, you can use the following -two members to add restrictions: - -* `pattern.whereString(field, comparison, string)`: add a string condition. - The rules are the same as for JSON patterns. -* `pattern.whereNumber(field, comparison, number)`: add a numerical condition. - The rules are the same as for JSON patterns. - -Multiple restrictions can be added on the same column; they must all apply. - -Example: - -```ts -// Search for all events where the component is "HttpServer" and the -// result code is not equal to 200. -const pattern = logs.FilterPattern.spaceDelimited('time', 'component', '...', 'result_code', 'latency') - .whereString('component', '=', 'HttpServer') - .whereNumber('result_code', '!=', 200); -``` - -## Logs Insights Query Definition - -Creates a query definition for CloudWatch Logs Insights. - -Example: - -```ts -new logs.QueryDefinition(this, 'QueryDefinition', { - queryDefinitionName: 'MyQuery', - queryString: new logs.QueryString({ - fields: ['@timestamp', '@message'], - parseStatements: [ - '@message "[*] *" as loggingType, loggingMessage', - '@message "<*>: *" as differentLoggingType, differentLoggingMessage', - ], - filterStatements: [ - 'loggingType = "ERROR"', - 'loggingMessage = "A very strange error occurred!"', - ], - sort: '@timestamp desc', - limit: 20, - }), -}); -``` - -## Notes - -Be aware that Log Group ARNs will always have the string `:*` appended to -them, to match the behavior of [the CloudFormation `AWS::Logs::LogGroup` -resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#aws-resource-logs-loggroup-return-values). diff --git a/packages/@aws-cdk/aws-logs/jest.config.js b/packages/@aws-cdk/aws-logs/jest.config.js deleted file mode 100644 index 6adf60b166cac..0000000000000 --- a/packages/@aws-cdk/aws-logs/jest.config.js +++ /dev/null @@ -1,9 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 75 - } - } -} diff --git a/packages/@aws-cdk/aws-logs/lib/log-group.ts b/packages/@aws-cdk/aws-logs/lib/log-group.ts deleted file mode 100644 index 5db7a29ed3ac0..0000000000000 --- a/packages/@aws-cdk/aws-logs/lib/log-group.ts +++ /dev/null @@ -1,579 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { Arn, ArnFormat, RemovalPolicy, Resource, Stack, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { LogStream } from './log-stream'; -import { CfnLogGroup } from './logs.generated'; -import { MetricFilter } from './metric-filter'; -import { FilterPattern, IFilterPattern } from './pattern'; -import { ResourcePolicy } from './policy'; -import { ILogSubscriptionDestination, SubscriptionFilter } from './subscription-filter'; - -export interface ILogGroup extends iam.IResourceWithPolicy { - /** - * The ARN of this log group, with ':*' appended - * - * @attribute - */ - readonly logGroupArn: string; - - /** - * The name of this log group - * @attribute - */ - readonly logGroupName: string; - - /** - * Create a new Log Stream for this Log Group - * - * @param id Unique identifier for the construct in its parent - * @param props Properties for creating the LogStream - */ - addStream(id: string, props?: StreamOptions): LogStream; - - /** - * Create a new Subscription Filter on this Log Group - * - * @param id Unique identifier for the construct in its parent - * @param props Properties for creating the SubscriptionFilter - */ - addSubscriptionFilter(id: string, props: SubscriptionFilterOptions): SubscriptionFilter; - - /** - * Create a new Metric Filter on this Log Group - * - * @param id Unique identifier for the construct in its parent - * @param props Properties for creating the MetricFilter - */ - addMetricFilter(id: string, props: MetricFilterOptions): MetricFilter; - - /** - * Extract a metric from structured log events in the LogGroup - * - * Creates a MetricFilter on this LogGroup that will extract the value - * of the indicated JSON field in all records where it occurs. - * - * The metric will be available in CloudWatch Metrics under the - * indicated namespace and name. - * - * @param jsonField JSON field to extract (example: '$.myfield') - * @param metricNamespace Namespace to emit the metric under - * @param metricName Name to emit the metric under - * @returns A Metric object representing the extracted metric - */ - extractMetric(jsonField: string, metricNamespace: string, metricName: string): cloudwatch.Metric; - - /** - * Give permissions to write to create and write to streams in this log group - */ - grantWrite(grantee: iam.IGrantable): iam.Grant; - - /** - * Give permissions to read from this log group and streams - */ - grantRead(grantee: iam.IGrantable): iam.Grant; - - /** - * Give the indicated permissions on this log group and all streams - */ - grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant; - - /** - * Public method to get the physical name of this log group - */ - logGroupPhysicalName(): string; -} - -/** - * An CloudWatch Log Group - */ -abstract class LogGroupBase extends Resource implements ILogGroup { - /** - * The ARN of this log group, with ':*' appended - */ - public abstract readonly logGroupArn: string; - - /** - * The name of this log group - */ - public abstract readonly logGroupName: string; - - - private policy?: ResourcePolicy; - - /** - * Create a new Log Stream for this Log Group - * - * @param id Unique identifier for the construct in its parent - * @param props Properties for creating the LogStream - */ - public addStream(id: string, props: StreamOptions = {}): LogStream { - return new LogStream(this, id, { - logGroup: this, - ...props, - }); - } - - /** - * Create a new Subscription Filter on this Log Group - * - * @param id Unique identifier for the construct in its parent - * @param props Properties for creating the SubscriptionFilter - */ - public addSubscriptionFilter(id: string, props: SubscriptionFilterOptions): SubscriptionFilter { - return new SubscriptionFilter(this, id, { - logGroup: this, - ...props, - }); - } - - /** - * Create a new Metric Filter on this Log Group - * - * @param id Unique identifier for the construct in its parent - * @param props Properties for creating the MetricFilter - */ - public addMetricFilter(id: string, props: MetricFilterOptions): MetricFilter { - return new MetricFilter(this, id, { - logGroup: this, - ...props, - }); - } - - /** - * Extract a metric from structured log events in the LogGroup - * - * Creates a MetricFilter on this LogGroup that will extract the value - * of the indicated JSON field in all records where it occurs. - * - * The metric will be available in CloudWatch Metrics under the - * indicated namespace and name. - * - * @param jsonField JSON field to extract (example: '$.myfield') - * @param metricNamespace Namespace to emit the metric under - * @param metricName Name to emit the metric under - * @returns A Metric object representing the extracted metric - */ - public extractMetric(jsonField: string, metricNamespace: string, metricName: string) { - new MetricFilter(this, `${metricNamespace}_${metricName}`, { - logGroup: this, - metricNamespace, - metricName, - filterPattern: FilterPattern.exists(jsonField), - metricValue: jsonField, - }); - - return new cloudwatch.Metric({ metricName, namespace: metricNamespace }).attachTo(this); - } - - /** - * Give permissions to create and write to streams in this log group - */ - public grantWrite(grantee: iam.IGrantable) { - return this.grant(grantee, 'logs:CreateLogStream', 'logs:PutLogEvents'); - } - - /** - * Give permissions to read and filter events from this log group - */ - public grantRead(grantee: iam.IGrantable) { - return this.grant(grantee, - 'logs:FilterLogEvents', - 'logs:GetLogEvents', - 'logs:GetLogGroupFields', - 'logs:DescribeLogGroups', - 'logs:DescribeLogStreams', - ); - } - - /** - * Give the indicated permissions on this log group and all streams - */ - public grant(grantee: iam.IGrantable, ...actions: string[]) { - return iam.Grant.addToPrincipalOrResource({ - grantee, - actions, - // A LogGroup ARN out of CloudFormation already includes a ':*' at the end to include the log streams under the group. - // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#w2ab1c21c10c63c43c11 - resourceArns: [this.logGroupArn], - resource: this, - }); - } - - /** - * Public method to get the physical name of this log group - * @returns Physical name of log group - */ - public logGroupPhysicalName(): string { - return this.physicalName; - } - - /** - * Adds a statement to the resource policy associated with this log group. - * A resource policy will be automatically created upon the first call to `addToResourcePolicy`. - * - * Any ARN Principals inside of the statement will be converted into AWS Account ID strings - * because CloudWatch Logs Resource Policies do not accept ARN principals. - * - * @param statement The policy statement to add - */ - public addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { - if (!this.policy) { - this.policy = new ResourcePolicy(this, 'Policy'); - } - this.policy.document.addStatements(statement.copy({ - principals: statement.principals.map(p => this.convertArnPrincpalToAccountId(p)), - })); - return { statementAdded: true, policyDependable: this.policy }; - } - - private convertArnPrincpalToAccountId(principal: iam.IPrincipal) { - if (principal.principalAccount) { - // we use ArnPrincipal here because the constructor inserts the argument - // into the template without mutating it, which means that there is no - // ARN created by this call. - return new iam.ArnPrincipal(principal.principalAccount); - } - - if (principal instanceof iam.ArnPrincipal) { - const parsedArn = Arn.split(principal.arn, ArnFormat.SLASH_RESOURCE_NAME); - if (parsedArn.account) { - return new iam.ArnPrincipal(parsedArn.account); - } - } - - return principal; - } -} - -/** - * How long, in days, the log contents will be retained. - */ -export enum RetentionDays { - /** - * 1 day - */ - ONE_DAY = 1, - - /** - * 3 days - */ - THREE_DAYS = 3, - - /** - * 5 days - */ - FIVE_DAYS = 5, - - /** - * 1 week - */ - ONE_WEEK = 7, - - /** - * 2 weeks - */ - TWO_WEEKS = 14, - - /** - * 1 month - */ - ONE_MONTH = 30, - - /** - * 2 months - */ - TWO_MONTHS = 60, - - /** - * 3 months - */ - THREE_MONTHS = 90, - - /** - * 4 months - */ - FOUR_MONTHS = 120, - - /** - * 5 months - */ - FIVE_MONTHS = 150, - - /** - * 6 months - */ - SIX_MONTHS = 180, - - /** - * 1 year - */ - ONE_YEAR = 365, - - /** - * 13 months - */ - THIRTEEN_MONTHS = 400, - - /** - * 18 months - */ - EIGHTEEN_MONTHS = 545, - - /** - * 2 years - */ - TWO_YEARS = 731, - - /** - * 3 years - */ - THREE_YEARS = 1096, - - /** - * 5 years - */ - FIVE_YEARS = 1827, - - /** - * 6 years - */ - SIX_YEARS = 2192, - - /** - * 7 years - */ - SEVEN_YEARS = 2557, - - /** - * 8 years - */ - EIGHT_YEARS = 2922, - - /** - * 9 years - */ - NINE_YEARS = 3288, - - /** - * 10 years - */ - TEN_YEARS = 3653, - - /** - * Retain logs forever - */ - INFINITE = 9999, -} - -/** - * Properties for a LogGroup - */ -export interface LogGroupProps { - /** - * The KMS customer managed key to encrypt the log group with. - * - * @default Server-side encrpytion managed by the CloudWatch Logs service - */ - readonly encryptionKey?: kms.IKey; - - /** - * Name of the log group. - * - * @default Automatically generated - */ - readonly logGroupName?: string; - - /** - * How long, in days, the log contents will be retained. - * - * To retain all logs, set this value to RetentionDays.INFINITE. - * - * @default RetentionDays.TWO_YEARS - */ - readonly retention?: RetentionDays; - - /** - * Determine the removal policy of this log group. - * - * Normally you want to retain the log group so you can diagnose issues - * from logs even after a deployment that no longer includes the log group. - * In that case, use the normal date-based retention policy to age out your - * logs. - * - * @default RemovalPolicy.Retain - */ - readonly removalPolicy?: RemovalPolicy; -} - -/** - * Define a CloudWatch Log Group - */ -export class LogGroup extends LogGroupBase { - /** - * Import an existing LogGroup given its ARN - */ - public static fromLogGroupArn(scope: Construct, id: string, logGroupArn: string): ILogGroup { - const baseLogGroupArn = logGroupArn.replace(/:\*$/, ''); - - class Import extends LogGroupBase { - public readonly logGroupArn = `${baseLogGroupArn}:*`; - public readonly logGroupName = Stack.of(scope).splitArn(baseLogGroupArn, ArnFormat.COLON_RESOURCE_NAME).resourceName!; - } - - return new Import(scope, id, { - environmentFromArn: baseLogGroupArn, - }); - } - - /** - * Import an existing LogGroup given its name - */ - public static fromLogGroupName(scope: Construct, id: string, logGroupName: string): ILogGroup { - const baseLogGroupName = logGroupName.replace(/:\*$/, ''); - - class Import extends LogGroupBase { - public readonly logGroupName = baseLogGroupName; - public readonly logGroupArn = Stack.of(scope).formatArn({ - service: 'logs', - resource: 'log-group', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - resourceName: baseLogGroupName + ':*', - }); - } - - return new Import(scope, id); - } - - /** - * The ARN of this log group - */ - public readonly logGroupArn: string; - - /** - * The name of this log group - */ - public readonly logGroupName: string; - - constructor(scope: Construct, id: string, props: LogGroupProps = {}) { - super(scope, id, { - physicalName: props.logGroupName, - }); - - let retentionInDays = props.retention; - if (retentionInDays === undefined) { retentionInDays = RetentionDays.TWO_YEARS; } - if (retentionInDays === Infinity || retentionInDays === RetentionDays.INFINITE) { retentionInDays = undefined; } - - if (retentionInDays !== undefined && !Token.isUnresolved(retentionInDays) && retentionInDays <= 0) { - throw new Error(`retentionInDays must be positive, got ${retentionInDays}`); - } - - const resource = new CfnLogGroup(this, 'Resource', { - kmsKeyId: props.encryptionKey?.keyArn, - logGroupName: this.physicalName, - retentionInDays, - }); - - resource.applyRemovalPolicy(props.removalPolicy); - - this.logGroupArn = this.getResourceArnAttribute(resource.attrArn, { - service: 'logs', - resource: 'log-group', - resourceName: this.physicalName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - this.logGroupName = this.getResourceNameAttribute(resource.ref); - } -} - -/** - * Properties for a new LogStream created from a LogGroup - */ -export interface StreamOptions { - /** - * The name of the log stream to create. - * - * The name must be unique within the log group. - * - * @default Automatically generated - */ - readonly logStreamName?: string; -} - -/** - * Properties for a new SubscriptionFilter created from a LogGroup - */ -export interface SubscriptionFilterOptions { - /** - * The destination to send the filtered events to. - * - * For example, a Kinesis stream or a Lambda function. - */ - readonly destination: ILogSubscriptionDestination; - - /** - * Log events matching this pattern will be sent to the destination. - */ - readonly filterPattern: IFilterPattern; -} - -/** - * Properties for a MetricFilter created from a LogGroup - */ -export interface MetricFilterOptions { - /** - * Pattern to search for log events. - */ - readonly filterPattern: IFilterPattern; - - /** - * The namespace of the metric to emit. - */ - readonly metricNamespace: string; - - /** - * The name of the metric to emit. - */ - readonly metricName: string; - - /** - * The value to emit for the metric. - * - * Can either be a literal number (typically "1"), or the name of a field in the structure - * to take the value from the matched event. If you are using a field value, the field - * value must have been matched using the pattern. - * - * If you want to specify a field from a matched JSON structure, use '$.fieldName', - * and make sure the field is in the pattern (if only as '$.fieldName = *'). - * - * If you want to specify a field from a matched space-delimited structure, - * use '$fieldName'. - * - * @default "1" - */ - readonly metricValue?: string; - - /** - * The value to emit if the pattern does not match a particular event. - * - * @default No metric emitted. - */ - readonly defaultValue?: number; - - /** - * The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-logs-metricfilter-metrictransformation-dimensions - * @default - No dimensions attached to metrics. - */ - readonly dimensions?: Record; - - /** - * The unit to assign to the metric. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-logs-metricfilter-metrictransformation-unit - * @default - No unit attached to metrics. - */ - readonly unit?: cloudwatch.Unit; -} diff --git a/packages/@aws-cdk/aws-logs/lib/log-retention.ts b/packages/@aws-cdk/aws-logs/lib/log-retention.ts deleted file mode 100644 index 7350d089488c3..0000000000000 --- a/packages/@aws-cdk/aws-logs/lib/log-retention.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as cdk from '@aws-cdk/core'; -import { ArnFormat } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { RetentionDays } from './log-group'; - -/** - * Construction properties for a LogRetention. - */ -export interface LogRetentionProps { - /** - * The log group name. - */ - readonly logGroupName: string; - - /** - * The region where the log group should be created - * @default - same region as the stack - */ - readonly logGroupRegion?: string; - - /** - * The number of days log events are kept in CloudWatch Logs. - */ - readonly retention: RetentionDays; - - /** - * The IAM role for the Lambda function associated with the custom resource. - * - * @default - A new role is created - */ - readonly role?: iam.IRole; - - /** - * Retry options for all AWS API calls. - * - * @default - AWS SDK default retry options - */ - readonly logRetentionRetryOptions?: LogRetentionRetryOptions; - - /** - * The removalPolicy for the log group when the stack is deleted - * @default RemovalPolicy.RETAIN - */ - readonly removalPolicy?: cdk.RemovalPolicy; -} - -/** - * Retry options for all AWS API calls. - */ -export interface LogRetentionRetryOptions { - /** - * The maximum amount of retries. - * - * @default 3 (AWS SDK default) - */ - readonly maxRetries?: number; - /** - * The base duration to use in the exponential backoff for operation retries. - * - * @default Duration.millis(100) (AWS SDK default) - */ - readonly base?: cdk.Duration; -} - -/** - * Creates a custom resource to control the retention policy of a CloudWatch Logs - * log group. The log group is created if it doesn't already exist. The policy - * is removed when `retentionDays` is `undefined` or equal to `Infinity`. - * Log group can be created in the region that is different from stack region by - * specifying `logGroupRegion` - */ -export class LogRetention extends Construct { - - /** - * The ARN of the LogGroup. - */ - public readonly logGroupArn: string; - - constructor(scope: Construct, id: string, props: LogRetentionProps) { - super(scope, id); - - // Custom resource provider - const provider = this.ensureSingletonLogRetentionFunction(props); - - // if removalPolicy is DESTROY, add action for DeleteLogGroup - if (props.removalPolicy === cdk.RemovalPolicy.DESTROY) { - provider.grantDeleteLogGroup(props.logGroupName); - } - - // Need to use a CfnResource here to prevent lerna dependency cycles - // @aws-cdk/aws-cloudformation -> @aws-cdk/aws-lambda -> @aws-cdk/aws-cloudformation - const retryOptions = props.logRetentionRetryOptions; - const resource = new cdk.CfnResource(this, 'Resource', { - type: 'Custom::LogRetention', - properties: { - ServiceToken: provider.functionArn, - LogGroupName: props.logGroupName, - LogGroupRegion: props.logGroupRegion, - SdkRetry: retryOptions ? { - maxRetries: retryOptions.maxRetries, - base: retryOptions.base?.toMilliseconds(), - } : undefined, - RetentionInDays: props.retention === RetentionDays.INFINITE ? undefined : props.retention, - RemovalPolicy: props.removalPolicy, - }, - }); - - const logGroupName = resource.getAtt('LogGroupName').toString(); - // Append ':*' at the end of the ARN to match with how CloudFormation does this for LogGroup ARNs - // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#aws-resource-logs-loggroup-return-values - this.logGroupArn = cdk.Stack.of(this).formatArn({ - region: props.logGroupRegion, - service: 'logs', - resource: 'log-group', - resourceName: `${logGroupName}:*`, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - } - - /** - * Helper method to ensure that only one instance of LogRetentionFunction resources are in the stack mimicking the - * behaviour of @aws-cdk/aws-lambda's SingletonFunction to prevent circular dependencies - */ - private ensureSingletonLogRetentionFunction(props: LogRetentionProps) { - const functionLogicalId = 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a'; - const existing = cdk.Stack.of(this).node.tryFindChild(functionLogicalId); - if (existing) { - return existing as LogRetentionFunction; - } - return new LogRetentionFunction(cdk.Stack.of(this), functionLogicalId, props); - } -} - -/** - * Private provider Lambda function to support the log retention custom resource. - */ -class LogRetentionFunction extends Construct implements cdk.ITaggable { - public readonly functionArn: cdk.Reference; - - public readonly tags: cdk.TagManager = new cdk.TagManager(cdk.TagType.KEY_VALUE, 'AWS::Lambda::Function'); - - private readonly role: iam.IRole; - - constructor(scope: Construct, id: string, props: LogRetentionProps) { - super(scope, id); - - const asset = new s3_assets.Asset(this, 'Code', { - path: path.join(__dirname, 'log-retention-provider'), - }); - - const role = props.role || new iam.Role(this, 'ServiceRole', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), - managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaBasicExecutionRole')], - }); - // Duplicate statements will be deduplicated by `PolicyDocument` - role.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['logs:PutRetentionPolicy', 'logs:DeleteRetentionPolicy'], - // We need '*' here because we will also put a retention policy on - // the log group of the provider function. Referencing its name - // creates a CF circular dependency. - resources: ['*'], - })); - this.role = role; - - // Lambda function - const resource = new cdk.CfnResource(this, 'Resource', { - type: 'AWS::Lambda::Function', - properties: { - Handler: 'index.handler', - Runtime: 'nodejs14.x', // Equivalent to Runtime.NODEJS_14_X - Code: { - S3Bucket: asset.s3BucketName, - S3Key: asset.s3ObjectKey, - }, - Role: role.roleArn, - Tags: this.tags.renderedTags, - }, - }); - this.functionArn = resource.getAtt('Arn'); - - asset.addResourceMetadata(resource, 'Code'); - - // Function dependencies - role.node.children.forEach((child) => { - if (cdk.CfnResource.isCfnResource(child)) { - resource.addDependency(child); - } - if (Construct.isConstruct(child) && child.node.defaultChild && cdk.CfnResource.isCfnResource(child.node.defaultChild)) { - resource.addDependency(child.node.defaultChild); - } - }); - } - - /** - * @internal - */ - public grantDeleteLogGroup(logGroupName: string) { - this.role.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['logs:DeleteLogGroup'], - //Only allow deleting the specific log group. - resources: [cdk.Stack.of(this).formatArn({ - service: 'logs', - resource: 'log-group', - resourceName: `${logGroupName}:*`, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - })], - })); - } -} diff --git a/packages/@aws-cdk/aws-logs/lib/policy.ts b/packages/@aws-cdk/aws-logs/lib/policy.ts deleted file mode 100644 index 4032d17488931..0000000000000 --- a/packages/@aws-cdk/aws-logs/lib/policy.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { PolicyDocument, PolicyStatement } from '@aws-cdk/aws-iam'; -import { Resource, Lazy, Names } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnResourcePolicy } from './logs.generated'; - -/** - * Properties to define Cloudwatch log group resource policy - */ -export interface ResourcePolicyProps { - /** - * Name of the log group resource policy - * @default - Uses a unique id based on the construct path - */ - readonly resourcePolicyName?: string; - - /** - * Initial statements to add to the resource policy - * - * @default - No statements - */ - readonly policyStatements?: PolicyStatement[]; -} - -/** - * Resource Policy for CloudWatch Log Groups - * - * Policies define the operations that are allowed on this resource. - * - * You almost never need to define this construct directly. - * - * All AWS resources that support resource policies have a method called - * `addToResourcePolicy()`, which will automatically create a new resource - * policy if one doesn't exist yet, otherwise it will add to the existing - * policy. - * - * Prefer to use `addToResourcePolicy()` instead. - */ -export class ResourcePolicy extends Resource { - /** - * The IAM policy document for this resource policy. - */ - public readonly document = new PolicyDocument(); - - constructor(scope: Construct, id: string, props?: ResourcePolicyProps) { - super(scope, id, { - physicalName: props?.resourcePolicyName, - }); - - const l1 = new CfnResourcePolicy(this, 'ResourcePolicy', { - policyName: Lazy.string({ - produce: () => props?.resourcePolicyName ?? Names.uniqueId(this), - }), - policyDocument: Lazy.string({ - produce: () => JSON.stringify(this.document), - }), - }); - - this.node.defaultChild = l1; - - if (props?.policyStatements) { - this.document.addStatements(...props.policyStatements); - } - } -} diff --git a/packages/@aws-cdk/aws-logs/package.json b/packages/@aws-cdk/aws-logs/package.json deleted file mode 100644 index 695355472f6c0..0000000000000 --- a/packages/@aws-cdk/aws-logs/package.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "name": "@aws-cdk/aws-logs", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Logs", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.logs", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "logs" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Logs", - "packageId": "Amazon.CDK.AWS.Logs", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-logs", - "module": "aws_cdk.aws_logs", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-logs" - }, - "scripts": { - "build": "cdk-build", - "lint": "cdk-lint", - "watch": "cdk-watch", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Logs", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "logs" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "@types/sinon": "^9.0.11", - "aws-sdk": "^2.1329.0", - "aws-sdk-mock": "5.6.0", - "jest": "^27.5.1", - "nock": "^13.3.0", - "sinon": "^9.2.4" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-no-arn-refs:@aws-cdk/aws-logs.CrossAccountDestinationProps.targetArn", - "props-physical-name:@aws-cdk/aws-logs.MetricFilterProps", - "props-physical-name:@aws-cdk/aws-logs.SubscriptionFilterProps", - "docs-public-apis:@aws-cdk/aws-logs.JsonPattern.logPatternString", - "docs-public-apis:@aws-cdk/aws-logs.ILogStream", - "docs-public-apis:@aws-cdk/aws-logs.ILogGroup", - "docs-public-apis:@aws-cdk/aws-logs.IFilterPattern.logPatternString", - "props-default-doc:@aws-cdk/aws-logs.ColumnRestriction.stringValue", - "props-default-doc:@aws-cdk/aws-logs.ColumnRestriction.numberValue", - "docs-public-apis:@aws-cdk/aws-logs.CrossAccountDestination.addToPolicy", - "docs-public-apis:@aws-cdk/aws-logs.JsonPattern.jsonPatternString", - "docs-public-apis:@aws-cdk/aws-logs.ColumnRestriction", - "docs-public-apis:@aws-cdk/aws-logs.SpaceDelimitedTextPattern.logPatternString", - "resource-attribute:@aws-cdk/aws-logs.SubscriptionFilter.subscriptionFilterFilterName" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-logs/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-logs/rosetta/default.ts-fixture deleted file mode 100644 index 6c34f60674f19..0000000000000 --- a/packages/@aws-cdk/aws-logs/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as logs from '@aws-cdk/aws-logs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as lambda from '@aws-cdk/aws-lambda'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/integ.log-retention.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdB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ZnVuY3Rpb24gcGFyc2VSZXRyeU9wdGlvbnMocmF3T3B0aW9uczogYW55KTogU2RrUmV0cnlPcHRpb25zIHtcbiAgICBjb25zdCByZXRyeU9wdGlvbnM6IFNka1JldHJ5T3B0aW9ucyA9IHt9O1xuICAgIGlmIChyYXdPcHRpb25zKSB7XG4gICAgICBpZiAocmF3T3B0aW9ucy5tYXhSZXRyaWVzKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5tYXhSZXRyaWVzID0gcGFyc2VJbnQocmF3T3B0aW9ucy5tYXhSZXRyaWVzLCAxMCk7XG4gICAgICB9XG4gICAgICBpZiAocmF3T3B0aW9ucy5iYXNlKSB7XG4gICAgICAgIHJldHJ5T3B0aW9ucy5yZXRyeU9wdGlvbnMgPSB7XG4gICAgICAgICAgYmFzZTogcGFyc2VJbnQocmF3T3B0aW9ucy5iYXNlLCAxMCksXG4gICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiByZXRyeU9wdGlvbnM7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.log-retention.ts b/packages/@aws-cdk/aws-logs/test/integ.log-retention.ts deleted file mode 100644 index 03f27144b5a92..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/integ.log-retention.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { App, Stack, StackProps, RemovalPolicy } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { LogRetention, RetentionDays } from '../lib'; - -class LogRetentionIntegStack extends Stack { - constructor(scope: App, id: string, props?: StackProps) { - super(scope, id, props); - - new LogRetention(this, 'MyLambda', { - logGroupName: 'logRetentionLogGroup', - retention: RetentionDays.ONE_DAY, - removalPolicy: RemovalPolicy.DESTROY, - }); - - new LogRetention(this, 'MyLambda2', { - logGroupName: 'logRetentionLogGroup2', - retention: RetentionDays.ONE_DAY, - removalPolicy: RemovalPolicy.DESTROY, - }); - } -} - -const app = new App(); -const stack = new LogRetentionIntegStack(app, 'aws-cdk-log-retention-integ'); -new IntegTest(app, 'LogRetentionInteg', { testCases: [stack] }); -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.ts b/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.ts deleted file mode 100644 index 2659e406939c1..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/integ.loggroup-grantread.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ServicePrincipal } from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { LogGroup } from '../lib'; - -const app = new App(); -const stack = new Stack(app, 'aws-cdk-loggroup-grantreads-integ'); - -const logGroup = new LogGroup(stack, 'LogGroup'); -logGroup.grantRead(new ServicePrincipal('es.amazonaws.com')); - -new IntegTest(app, 'loggroup-grantreads', { - testCases: [stack], -}); -app.synth(); diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.ts b/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.ts deleted file mode 100644 index 249a668c4750b..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/integ.metricfilter-unit.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Unit } from '@aws-cdk/aws-cloudwatch'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { FilterPattern, LogGroup, MetricFilter } from '../lib'; - -class TestStack extends Stack { - constructor(scope: App, id: string, props?: StackProps) { - super(scope, id, props); - - const logGroup = new LogGroup(this, 'LogGroup', { - removalPolicy: RemovalPolicy.DESTROY, - }); - - new MetricFilter(this, 'MetricFilter', { - logGroup, - metricNamespace: 'MyApp', - metricName: 'Latency', - filterPattern: FilterPattern.exists('$.latency'), - metricValue: '$.latency', - dimensions: { - ErrorCode: '$.errorCode', - }, - unit: Unit.MILLISECONDS, - }); - } -} - -const app = new App(); -const testCase = new TestStack(app, 'aws-cdk-metricfilter-unit-integ'); - -new IntegTest(app, 'metricfilter-unit', { - testCases: [testCase], -}); -app.synth(); diff --git a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts b/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts deleted file mode 100644 index 92298ee1cbebf..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/integ.metricfilter.lit.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import { FilterPattern, LogGroup, MetricFilter } from '../lib'; - -class MetricFilterIntegStack extends Stack { - constructor(scope: App, id: string, props?: StackProps) { - super(scope, id, props); - - const logGroup = new LogGroup(this, 'LogGroup', { - removalPolicy: RemovalPolicy.DESTROY, - }); - - /// !show - new MetricFilter(this, 'MetricFilter', { - logGroup, - metricNamespace: 'MyApp', - metricName: 'Latency', - filterPattern: FilterPattern.exists('$.latency'), - metricValue: '$.latency', - }); - /// !hide - } -} - -const app = new App(); -new MetricFilterIntegStack(app, 'aws-cdk-metricfilter-integ'); -app.synth(); diff --git a/packages/@aws-cdk/aws-logs/test/policy.test.ts b/packages/@aws-cdk/aws-logs/test/policy.test.ts deleted file mode 100644 index 325d9ac059a85..0000000000000 --- a/packages/@aws-cdk/aws-logs/test/policy.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import { PolicyStatement, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; -import { LogGroup, ResourcePolicy } from '../lib'; - -describe('resource policy', () => { - test('ResourcePolicy is added to stack, when .addToResourcePolicy() is provided a valid Statement', () => { - // GIVEN - const stack = new Stack(); - const logGroup = new LogGroup(stack, 'LogGroup'); - - // WHEN - logGroup.addToResourcePolicy(new PolicyStatement({ - actions: ['logs:CreateLogStream'], - resources: ['*'], - })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Logs::ResourcePolicy', { - PolicyName: 'LogGroupPolicy643B329C', - PolicyDocument: JSON.stringify({ - Statement: [ - { - Action: 'logs:CreateLogStream', - Effect: 'Allow', - Resource: '*', - }, - ], - Version: '2012-10-17', - }), - }); - }); - - test('ResourcePolicy is added to stack, when created manually/directly', () => { - // GIVEN - const stack = new Stack(); - const logGroup = new LogGroup(stack, 'LogGroup'); - - // WHEN - const resourcePolicy = new ResourcePolicy(stack, 'ResourcePolicy'); - resourcePolicy.document.addStatements(new PolicyStatement({ - actions: ['logs:CreateLogStream', 'logs:PutLogEvents'], - principals: [new ServicePrincipal('es.amazonaws.com')], - resources: [logGroup.logGroupArn], - })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Logs::ResourcePolicy', { - PolicyName: 'ResourcePolicy', - }); - }); - - test('ResourcePolicy has a defaultChild', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const resourcePolicy = new ResourcePolicy(stack, 'ResourcePolicy'); - - // THEN - expect(resourcePolicy.node.defaultChild).toBeDefined(); - }); -}); diff --git a/packages/@aws-cdk/aws-lookoutequipment/.eslintrc.js b/packages/@aws-cdk/aws-lookoutequipment/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lookoutequipment/.gitignore b/packages/@aws-cdk/aws-lookoutequipment/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-lookoutequipment/.npmignore b/packages/@aws-cdk/aws-lookoutequipment/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-lookoutequipment/LICENSE b/packages/@aws-cdk/aws-lookoutequipment/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-lookoutequipment/NOTICE b/packages/@aws-cdk/aws-lookoutequipment/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-lookoutequipment/README.md b/packages/@aws-cdk/aws-lookoutequipment/README.md deleted file mode 100644 index b3032e4bc6f6e..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::LookoutEquipment Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as lookoutequipment from '@aws-cdk/aws-lookoutequipment'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for LookoutEquipment construct libraries](https://constructs.dev/search?q=lookoutequipment) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LookoutEquipment resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutEquipment.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LookoutEquipment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutEquipment.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-lookoutequipment/jest.config.js b/packages/@aws-cdk/aws-lookoutequipment/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lookoutequipment/lib/index.ts b/packages/@aws-cdk/aws-lookoutequipment/lib/index.ts deleted file mode 100644 index c90623c23ff71..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::LookoutEquipment CloudFormation Resources: -export * from './lookoutequipment.generated'; diff --git a/packages/@aws-cdk/aws-lookoutequipment/package.json b/packages/@aws-cdk/aws-lookoutequipment/package.json deleted file mode 100644 index c0a274aa4f321..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-lookoutequipment", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::LookoutEquipment", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.LookoutEquipment", - "packageId": "Amazon.CDK.AWS.LookoutEquipment", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.lookoutequipment", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "lookoutequipment" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-lookoutequipment", - "module": "aws_cdk.aws_lookoutequipment" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-lookoutequipment" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::LookoutEquipment", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::LookoutEquipment", - "aws-lookoutequipment" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-lookoutequipment/test/lookoutequipment.test.ts b/packages/@aws-cdk/aws-lookoutequipment/test/lookoutequipment.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-lookoutequipment/test/lookoutequipment.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-lookoutmetrics/.eslintrc.js b/packages/@aws-cdk/aws-lookoutmetrics/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lookoutmetrics/.gitignore b/packages/@aws-cdk/aws-lookoutmetrics/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-lookoutmetrics/.npmignore b/packages/@aws-cdk/aws-lookoutmetrics/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-lookoutmetrics/LICENSE b/packages/@aws-cdk/aws-lookoutmetrics/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-lookoutmetrics/NOTICE b/packages/@aws-cdk/aws-lookoutmetrics/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-lookoutmetrics/README.md b/packages/@aws-cdk/aws-lookoutmetrics/README.md deleted file mode 100644 index e7d1240ea623f..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::LookoutMetrics Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as lookoutmetrics from '@aws-cdk/aws-lookoutmetrics'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for LookoutMetrics construct libraries](https://constructs.dev/search?q=lookoutmetrics) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LookoutMetrics resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutMetrics.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LookoutMetrics](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutMetrics.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-lookoutmetrics/jest.config.js b/packages/@aws-cdk/aws-lookoutmetrics/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lookoutmetrics/lib/index.ts b/packages/@aws-cdk/aws-lookoutmetrics/lib/index.ts deleted file mode 100644 index 2e57104cd8582..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::LookoutMetrics CloudFormation Resources: -export * from './lookoutmetrics.generated'; diff --git a/packages/@aws-cdk/aws-lookoutmetrics/package.json b/packages/@aws-cdk/aws-lookoutmetrics/package.json deleted file mode 100644 index d64925f7e1eb7..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-lookoutmetrics", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::LookoutMetrics", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.LookoutMetrics", - "packageId": "Amazon.CDK.AWS.LookoutMetrics", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.lookoutmetrics", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "lookoutmetrics" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-lookoutmetrics", - "module": "aws_cdk.aws_lookoutmetrics" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-lookoutmetrics" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::LookoutMetrics", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::LookoutMetrics", - "aws-lookoutmetrics" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-lookoutmetrics/test/lookoutmetrics.test.ts b/packages/@aws-cdk/aws-lookoutmetrics/test/lookoutmetrics.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-lookoutmetrics/test/lookoutmetrics.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-lookoutvision/.eslintrc.js b/packages/@aws-cdk/aws-lookoutvision/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lookoutvision/.gitignore b/packages/@aws-cdk/aws-lookoutvision/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-lookoutvision/.npmignore b/packages/@aws-cdk/aws-lookoutvision/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-lookoutvision/LICENSE b/packages/@aws-cdk/aws-lookoutvision/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-lookoutvision/NOTICE b/packages/@aws-cdk/aws-lookoutvision/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-lookoutvision/README.md b/packages/@aws-cdk/aws-lookoutvision/README.md deleted file mode 100644 index 0e97e03c3d477..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::LookoutVision Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as lookoutvision from '@aws-cdk/aws-lookoutvision'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for LookoutVision construct libraries](https://constructs.dev/search?q=lookoutvision) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LookoutVision resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutVision.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LookoutVision](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutVision.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-lookoutvision/jest.config.js b/packages/@aws-cdk/aws-lookoutvision/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-lookoutvision/lib/index.ts b/packages/@aws-cdk/aws-lookoutvision/lib/index.ts deleted file mode 100644 index 1be824f5b354f..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::LookoutVision CloudFormation Resources: -export * from './lookoutvision.generated'; diff --git a/packages/@aws-cdk/aws-lookoutvision/package.json b/packages/@aws-cdk/aws-lookoutvision/package.json deleted file mode 100644 index f56f1753ffe60..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-lookoutvision", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::LookoutVision", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.LookoutVision", - "packageId": "Amazon.CDK.AWS.LookoutVision", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.lookoutvision", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "lookoutvision" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-lookoutvision", - "module": "aws_cdk.aws_lookoutvision" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-lookoutvision" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::LookoutVision", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::LookoutVision", - "aws-lookoutvision" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-lookoutvision/test/lookoutvision.test.ts b/packages/@aws-cdk/aws-lookoutvision/test/lookoutvision.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-lookoutvision/test/lookoutvision.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-m2/.eslintrc.js b/packages/@aws-cdk/aws-m2/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-m2/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-m2/.gitignore b/packages/@aws-cdk/aws-m2/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-m2/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-m2/.npmignore b/packages/@aws-cdk/aws-m2/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-m2/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-m2/LICENSE b/packages/@aws-cdk/aws-m2/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-m2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-m2/NOTICE b/packages/@aws-cdk/aws-m2/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-m2/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-m2/README.md b/packages/@aws-cdk/aws-m2/README.md deleted file mode 100644 index 9bbf365ccc171..0000000000000 --- a/packages/@aws-cdk/aws-m2/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::M2 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as m2 from '@aws-cdk/aws-m2'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for M2 construct libraries](https://constructs.dev/search?q=m2) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::M2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_M2.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::M2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_M2.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-m2/jest.config.js b/packages/@aws-cdk/aws-m2/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-m2/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-m2/lib/index.ts b/packages/@aws-cdk/aws-m2/lib/index.ts deleted file mode 100644 index 5cf50c3301697..0000000000000 --- a/packages/@aws-cdk/aws-m2/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::M2 CloudFormation Resources: -export * from './m2.generated'; diff --git a/packages/@aws-cdk/aws-m2/package.json b/packages/@aws-cdk/aws-m2/package.json deleted file mode 100644 index 3bb212cb3bb4f..0000000000000 --- a/packages/@aws-cdk/aws-m2/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-m2", - "version": "0.0.0", - "description": "AWS::M2 Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.M2", - "packageId": "Amazon.CDK.AWS.M2", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.m2", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "m2" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-m2", - "module": "aws_cdk.aws_m2" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-m2" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::M2", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::M2", - "aws-m2" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-m2/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-m2/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-m2/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-m2/test/m2.test.ts b/packages/@aws-cdk/aws-m2/test/m2.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-m2/test/m2.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-macie/.eslintrc.js b/packages/@aws-cdk/aws-macie/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-macie/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-macie/.gitignore b/packages/@aws-cdk/aws-macie/.gitignore deleted file mode 100644 index 147a6c1ef79db..0000000000000 --- a/packages/@aws-cdk/aws-macie/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-macie/.npmignore b/packages/@aws-cdk/aws-macie/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-macie/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-macie/LICENSE b/packages/@aws-cdk/aws-macie/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-macie/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-macie/NOTICE b/packages/@aws-cdk/aws-macie/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-macie/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-macie/README.md b/packages/@aws-cdk/aws-macie/README.md deleted file mode 100644 index 81869c7e974f1..0000000000000 --- a/packages/@aws-cdk/aws-macie/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Macie Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as macie from '@aws-cdk/aws-macie'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Macie construct libraries](https://constructs.dev/search?q=macie) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Macie resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Macie.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Macie](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Macie.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-macie/jest.config.js b/packages/@aws-cdk/aws-macie/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-macie/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-macie/lib/index.ts b/packages/@aws-cdk/aws-macie/lib/index.ts deleted file mode 100644 index 3e9701436c653..0000000000000 --- a/packages/@aws-cdk/aws-macie/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Macie CloudFormation Resources: -export * from './macie.generated'; diff --git a/packages/@aws-cdk/aws-macie/package.json b/packages/@aws-cdk/aws-macie/package.json deleted file mode 100644 index 7def204a7b38b..0000000000000 --- a/packages/@aws-cdk/aws-macie/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-macie", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Macie", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Macie", - "packageId": "Amazon.CDK.AWS.Macie", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.macie", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "macie" - } - }, - "python": { - "distName": "aws-cdk.aws-macie", - "module": "aws_cdk.aws_macie", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-macie" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Macie", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Macie", - "aws-macie" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-macie/test/macie.test.ts b/packages/@aws-cdk/aws-macie/test/macie.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-macie/test/macie.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-managedblockchain/.eslintrc.js b/packages/@aws-cdk/aws-managedblockchain/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-managedblockchain/.gitignore b/packages/@aws-cdk/aws-managedblockchain/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-managedblockchain/.npmignore b/packages/@aws-cdk/aws-managedblockchain/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-managedblockchain/LICENSE b/packages/@aws-cdk/aws-managedblockchain/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-managedblockchain/NOTICE b/packages/@aws-cdk/aws-managedblockchain/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-managedblockchain/README.md b/packages/@aws-cdk/aws-managedblockchain/README.md deleted file mode 100644 index 3b62d7a57b0b9..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ManagedBlockchain Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as managedblockchain from '@aws-cdk/aws-managedblockchain'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ManagedBlockchain construct libraries](https://constructs.dev/search?q=managedblockchain) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ManagedBlockchain resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ManagedBlockchain.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ManagedBlockchain](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ManagedBlockchain.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-managedblockchain/jest.config.js b/packages/@aws-cdk/aws-managedblockchain/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-managedblockchain/lib/index.ts b/packages/@aws-cdk/aws-managedblockchain/lib/index.ts deleted file mode 100644 index 28431046283f0..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ManagedBlockchain CloudFormation Resources: -export * from './managedblockchain.generated'; diff --git a/packages/@aws-cdk/aws-managedblockchain/package.json b/packages/@aws-cdk/aws-managedblockchain/package.json deleted file mode 100644 index 14db81849a826..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-managedblockchain", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ManagedBlockchain", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ManagedBlockchain", - "packageId": "Amazon.CDK.AWS.ManagedBlockchain", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.managedblockchain", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "managedblockchain" - } - }, - "python": { - "distName": "aws-cdk.aws-managedblockchain", - "module": "aws_cdk.aws_managedblockchain", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-managedblockchain" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ManagedBlockchain", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ManagedBlockchain", - "aws-managedblockchain" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-managedblockchain/test/managedblockchain.test.ts b/packages/@aws-cdk/aws-managedblockchain/test/managedblockchain.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-managedblockchain/test/managedblockchain.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-mediaconnect/.eslintrc.js b/packages/@aws-cdk/aws-mediaconnect/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediaconnect/.gitignore b/packages/@aws-cdk/aws-mediaconnect/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-mediaconnect/.npmignore b/packages/@aws-cdk/aws-mediaconnect/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-mediaconnect/LICENSE b/packages/@aws-cdk/aws-mediaconnect/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-mediaconnect/NOTICE b/packages/@aws-cdk/aws-mediaconnect/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-mediaconnect/README.md b/packages/@aws-cdk/aws-mediaconnect/README.md deleted file mode 100644 index 3cbca7614ee4a..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::MediaConnect Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as mediaconnect from '@aws-cdk/aws-mediaconnect'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MediaConnect construct libraries](https://constructs.dev/search?q=mediaconnect) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaConnect resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConnect.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaConnect](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConnect.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-mediaconnect/jest.config.js b/packages/@aws-cdk/aws-mediaconnect/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediaconnect/lib/index.ts b/packages/@aws-cdk/aws-mediaconnect/lib/index.ts deleted file mode 100644 index ffee08204e7b6..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MediaConnect CloudFormation Resources: -export * from './mediaconnect.generated'; diff --git a/packages/@aws-cdk/aws-mediaconnect/package.json b/packages/@aws-cdk/aws-mediaconnect/package.json deleted file mode 100644 index 3f1a69217b408..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-mediaconnect", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::MediaConnect", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MediaConnect", - "packageId": "Amazon.CDK.AWS.MediaConnect", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.mediaconnect", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "mediaconnect" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-mediaconnect", - "module": "aws_cdk.aws_mediaconnect" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-mediaconnect" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MediaConnect", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MediaConnect", - "aws-mediaconnect" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-mediaconnect/test/mediaconnect.test.ts b/packages/@aws-cdk/aws-mediaconnect/test/mediaconnect.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-mediaconnect/test/mediaconnect.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-mediaconvert/.eslintrc.js b/packages/@aws-cdk/aws-mediaconvert/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediaconvert/.gitignore b/packages/@aws-cdk/aws-mediaconvert/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-mediaconvert/.npmignore b/packages/@aws-cdk/aws-mediaconvert/.npmignore deleted file mode 100644 index b8abeff418a53..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo -tsconfig.json -!.jsii -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-mediaconvert/LICENSE b/packages/@aws-cdk/aws-mediaconvert/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-mediaconvert/NOTICE b/packages/@aws-cdk/aws-mediaconvert/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-mediaconvert/README.md b/packages/@aws-cdk/aws-mediaconvert/README.md deleted file mode 100644 index a8b39a0bf1181..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::MediaConvert Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as mediaconvert from '@aws-cdk/aws-mediaconvert'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MediaConvert construct libraries](https://constructs.dev/search?q=mediaconvert) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaConvert resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConvert.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaConvert](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConvert.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-mediaconvert/jest.config.js b/packages/@aws-cdk/aws-mediaconvert/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediaconvert/lib/index.ts b/packages/@aws-cdk/aws-mediaconvert/lib/index.ts deleted file mode 100644 index 38c5b90bad231..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MediaConvert CloudFormation Resources: -export * from './mediaconvert.generated'; diff --git a/packages/@aws-cdk/aws-mediaconvert/package.json b/packages/@aws-cdk/aws-mediaconvert/package.json deleted file mode 100644 index 90ec63e8965b4..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-mediaconvert", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::MediaConvert", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MediaConvert", - "packageId": "Amazon.CDK.AWS.MediaConvert", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.mediaconvert", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "mediaconvert" - } - }, - "python": { - "distName": "aws-cdk.aws-mediaconvert", - "module": "aws_cdk.aws_mediaconvert", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-mediaconvert" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "compat": "cdk-compat", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MediaConvert", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MediaConvert", - "aws-mediaconvert" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-mediaconvert/test/mediaconvert.test.ts b/packages/@aws-cdk/aws-mediaconvert/test/mediaconvert.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-mediaconvert/test/mediaconvert.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-medialive/.eslintrc.js b/packages/@aws-cdk/aws-medialive/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-medialive/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-medialive/.gitignore b/packages/@aws-cdk/aws-medialive/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-medialive/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-medialive/.npmignore b/packages/@aws-cdk/aws-medialive/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-medialive/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-medialive/LICENSE b/packages/@aws-cdk/aws-medialive/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-medialive/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-medialive/NOTICE b/packages/@aws-cdk/aws-medialive/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-medialive/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-medialive/README.md b/packages/@aws-cdk/aws-medialive/README.md deleted file mode 100644 index 8f5ef59795478..0000000000000 --- a/packages/@aws-cdk/aws-medialive/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Elemental MediaLive Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as medialive from '@aws-cdk/aws-medialive'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MediaLive construct libraries](https://constructs.dev/search?q=medialive) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaLive resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaLive.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaLive](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaLive.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-medialive/jest.config.js b/packages/@aws-cdk/aws-medialive/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-medialive/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-medialive/lib/index.ts b/packages/@aws-cdk/aws-medialive/lib/index.ts deleted file mode 100644 index f973e4f619da4..0000000000000 --- a/packages/@aws-cdk/aws-medialive/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MediaLive CloudFormation Resources: -export * from './medialive.generated'; diff --git a/packages/@aws-cdk/aws-medialive/package.json b/packages/@aws-cdk/aws-medialive/package.json deleted file mode 100644 index 7a2b65d0b3199..0000000000000 --- a/packages/@aws-cdk/aws-medialive/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-medialive", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::MediaLive", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MediaLive", - "packageId": "Amazon.CDK.AWS.MediaLive", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.medialive", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "medialive" - } - }, - "python": { - "distName": "aws-cdk.aws-medialive", - "module": "aws_cdk.aws_medialive", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-medialive" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MediaLive", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MediaLive", - "aws-medialive" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-medialive/test/medialive.test.ts b/packages/@aws-cdk/aws-medialive/test/medialive.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-medialive/test/medialive.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-mediapackage/.eslintrc.js b/packages/@aws-cdk/aws-mediapackage/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediapackage/.gitignore b/packages/@aws-cdk/aws-mediapackage/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-mediapackage/.npmignore b/packages/@aws-cdk/aws-mediapackage/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-mediapackage/LICENSE b/packages/@aws-cdk/aws-mediapackage/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-mediapackage/NOTICE b/packages/@aws-cdk/aws-mediapackage/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-mediapackage/README.md b/packages/@aws-cdk/aws-mediapackage/README.md deleted file mode 100644 index 7220e7028183b..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::MediaPackage Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as mediapackage from '@aws-cdk/aws-mediapackage'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MediaPackage construct libraries](https://constructs.dev/search?q=mediapackage) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaPackage resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaPackage.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaPackage](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaPackage.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-mediapackage/jest.config.js b/packages/@aws-cdk/aws-mediapackage/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediapackage/lib/index.ts b/packages/@aws-cdk/aws-mediapackage/lib/index.ts deleted file mode 100644 index 730abc4ac52fc..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MediaPackage CloudFormation Resources: -export * from './mediapackage.generated'; diff --git a/packages/@aws-cdk/aws-mediapackage/package.json b/packages/@aws-cdk/aws-mediapackage/package.json deleted file mode 100644 index 28924b352c725..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-mediapackage", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::MediaPackage", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "private": true, - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MediaPackage", - "packageId": "Amazon.CDK.AWS.MediaPackage", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.mediapackage", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "mediapackage" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-mediapackage", - "module": "aws_cdk.aws_mediapackage" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-mediapackage" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MediaPackage", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MediaPackage", - "aws-mediapackage" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-mediapackage/test/mediapackage.test.ts b/packages/@aws-cdk/aws-mediapackage/test/mediapackage.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-mediapackage/test/mediapackage.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-mediastore/.eslintrc.js b/packages/@aws-cdk/aws-mediastore/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediastore/.gitignore b/packages/@aws-cdk/aws-mediastore/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-mediastore/.npmignore b/packages/@aws-cdk/aws-mediastore/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-mediastore/LICENSE b/packages/@aws-cdk/aws-mediastore/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-mediastore/NOTICE b/packages/@aws-cdk/aws-mediastore/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-mediastore/README.md b/packages/@aws-cdk/aws-mediastore/README.md deleted file mode 100644 index 366e0345e62a8..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Elemental MediaStore Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as mediastore from '@aws-cdk/aws-mediastore'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MediaStore construct libraries](https://constructs.dev/search?q=mediastore) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaStore resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaStore.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaStore](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaStore.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-mediastore/jest.config.js b/packages/@aws-cdk/aws-mediastore/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediastore/lib/index.ts b/packages/@aws-cdk/aws-mediastore/lib/index.ts deleted file mode 100644 index 687322e357501..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MediaStore CloudFormation Resources: -export * from './mediastore.generated'; diff --git a/packages/@aws-cdk/aws-mediastore/package.json b/packages/@aws-cdk/aws-mediastore/package.json deleted file mode 100644 index 6761f03adee0a..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-mediastore", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::MediaStore", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MediaStore", - "packageId": "Amazon.CDK.AWS.MediaStore", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.mediastore", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "mediastore" - } - }, - "python": { - "distName": "aws-cdk.aws-mediastore", - "module": "aws_cdk.aws_mediastore", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-mediastore" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MediaStore", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MediaStore", - "aws-mediastore" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-mediastore/test/mediastore.test.ts b/packages/@aws-cdk/aws-mediastore/test/mediastore.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-mediastore/test/mediastore.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-mediatailor/.eslintrc.js b/packages/@aws-cdk/aws-mediatailor/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediatailor/.gitignore b/packages/@aws-cdk/aws-mediatailor/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-mediatailor/.npmignore b/packages/@aws-cdk/aws-mediatailor/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-mediatailor/LICENSE b/packages/@aws-cdk/aws-mediatailor/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-mediatailor/NOTICE b/packages/@aws-cdk/aws-mediatailor/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-mediatailor/README.md b/packages/@aws-cdk/aws-mediatailor/README.md deleted file mode 100644 index 3dd7575d807ed..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::MediaTailor Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as mediatailor from '@aws-cdk/aws-mediatailor'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MediaTailor construct libraries](https://constructs.dev/search?q=mediatailor) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaTailor resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaTailor.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaTailor](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaTailor.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-mediatailor/jest.config.js b/packages/@aws-cdk/aws-mediatailor/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mediatailor/lib/index.ts b/packages/@aws-cdk/aws-mediatailor/lib/index.ts deleted file mode 100644 index 3790d445c3529..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MediaTailor CloudFormation Resources: -export * from './mediatailor.generated'; diff --git a/packages/@aws-cdk/aws-mediatailor/package.json b/packages/@aws-cdk/aws-mediatailor/package.json deleted file mode 100644 index c8428261ec8d3..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-mediatailor", - "version": "0.0.0", - "description": "AWS::MediaTailor Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MediaTailor", - "packageId": "Amazon.CDK.AWS.MediaTailor", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.mediatailor", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "mediatailor" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-mediatailor", - "module": "aws_cdk.aws_mediatailor" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-mediatailor" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MediaTailor", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MediaTailor", - "aws-mediatailor" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-mediatailor/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-mediatailor/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-mediatailor/test/mediatailor.test.ts b/packages/@aws-cdk/aws-mediatailor/test/mediatailor.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-mediatailor/test/mediatailor.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-memorydb/.eslintrc.js b/packages/@aws-cdk/aws-memorydb/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-memorydb/.gitignore b/packages/@aws-cdk/aws-memorydb/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-memorydb/.npmignore b/packages/@aws-cdk/aws-memorydb/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-memorydb/LICENSE b/packages/@aws-cdk/aws-memorydb/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-memorydb/NOTICE b/packages/@aws-cdk/aws-memorydb/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-memorydb/README.md b/packages/@aws-cdk/aws-memorydb/README.md deleted file mode 100644 index 30caed3d9a2c8..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::MemoryDB Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as memorydb from '@aws-cdk/aws-memorydb'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MemoryDB construct libraries](https://constructs.dev/search?q=memorydb) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MemoryDB resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MemoryDB.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MemoryDB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MemoryDB.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-memorydb/jest.config.js b/packages/@aws-cdk/aws-memorydb/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-memorydb/lib/index.ts b/packages/@aws-cdk/aws-memorydb/lib/index.ts deleted file mode 100644 index 99e822affff5c..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MemoryDB CloudFormation Resources: -export * from './memorydb.generated'; diff --git a/packages/@aws-cdk/aws-memorydb/package.json b/packages/@aws-cdk/aws-memorydb/package.json deleted file mode 100644 index 6668e92cdce16..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-memorydb", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::MemoryDB", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MemoryDB", - "packageId": "Amazon.CDK.AWS.MemoryDB", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.memorydb", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "memorydb" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-memorydb", - "module": "aws_cdk.aws_memorydb" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-memorydb" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MemoryDB", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MemoryDB", - "aws-memorydb" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-memorydb/test/memorydb.test.ts b/packages/@aws-cdk/aws-memorydb/test/memorydb.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-memorydb/test/memorydb.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-msk/.eslintrc.js b/packages/@aws-cdk/aws-msk/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-msk/.eslintrc.js +++ b/packages/@aws-cdk/aws-msk/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-msk/.gitignore b/packages/@aws-cdk/aws-msk/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-msk/.gitignore +++ b/packages/@aws-cdk/aws-msk/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-msk/README.md b/packages/@aws-cdk/aws-msk/README.md index 3702ca47e9b17..9bacd98e514b8 100644 --- a/packages/@aws-cdk/aws-msk/README.md +++ b/packages/@aws-cdk/aws-msk/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -89,7 +83,7 @@ const cluster = msk.Cluster.fromClusterArn(this, 'Cluster', To enable client authentication with TLS set the `certificateAuthorityArns` property to reference your ACM Private CA. [More info on Private CAs.](https://docs.aws.amazon.com/msk/latest/developerguide/msk-authentication.html) ```ts -import * as acmpca from '@aws-cdk/aws-acmpca'; +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; declare const vpc: ec2.Vpc; const cluster = new msk.Cluster(this, 'Cluster', { @@ -156,7 +150,7 @@ Enable client authentication with [IAM](https://docs.aws.amazon.com/msk/latest/d as well as enable client authentication with TLS by setting the `certificateAuthorityArns` property to reference your ACM Private CA. [More info on Private CAs.](https://docs.aws.amazon.com/msk/latest/developerguide/msk-authentication.html) ```ts -import * as acmpca from '@aws-cdk/aws-acmpca'; +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; declare const vpc: ec2.Vpc; const cluster = new msk.Cluster(this, 'Cluster', { diff --git a/packages/@aws-cdk/aws-msk/lib/cluster.ts b/packages/@aws-cdk/aws-msk/lib/cluster.ts index 4f4a7c2bed201..18f90da02ae82 100644 --- a/packages/@aws-cdk/aws-msk/lib/cluster.ts +++ b/packages/@aws-cdk/aws-msk/lib/cluster.ts @@ -1,18 +1,18 @@ -import * as acmpca from '@aws-cdk/aws-acmpca'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as core from '@aws-cdk/core'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import { S3_CREATE_DEFAULT_LOGGING_POLICY } from '@aws-cdk/cx-api'; +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as core from 'aws-cdk-lib'; +import { FeatureFlags } from 'aws-cdk-lib'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import { S3_CREATE_DEFAULT_LOGGING_POLICY } from 'aws-cdk-lib/cx-api'; import * as constructs from 'constructs'; import { addressOf } from 'constructs/lib/private/uniqueid'; import { KafkaVersion } from './'; -import { CfnCluster } from './msk.generated'; +import { CfnCluster } from 'aws-cdk-lib/aws-msk'; /** * Represents a MSK Cluster diff --git a/packages/@aws-cdk/aws-msk/lib/index.ts b/packages/@aws-cdk/aws-msk/lib/index.ts index 137ac89880f81..674fd3b2e451d 100644 --- a/packages/@aws-cdk/aws-msk/lib/index.ts +++ b/packages/@aws-cdk/aws-msk/lib/index.ts @@ -2,4 +2,3 @@ export * from './cluster'; export * from './cluster-version'; // AWS::MSK CloudFormation Resources: -export * from './msk.generated'; diff --git a/packages/@aws-cdk/aws-msk/package.json b/packages/@aws-cdk/aws-msk/package.json index e11470b17d92c..237e949f7820b 100644 --- a/packages/@aws-cdk/aws-msk/package.json +++ b/packages/@aws-cdk/aws-msk/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-msk", + "name": "@aws-cdk/aws-msk-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::MSK", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.MSK", - "packageId": "Amazon.CDK.AWS.MSK", + "namespace": "Amazon.CDK.AWS.MSK.Alpha", + "packageId": "Amazon.CDK.AWS.MSK.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.msk", + "package": "software.amazon.awscdk.services.msk.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "msk" + "artifactId": "msk-alpha" } }, "python": { - "distName": "aws-cdk.aws-msk", - "module": "aws_cdk.aws_msk", + "distName": "aws-cdk.aws-msk-alpha", + "module": "aws_cdk.aws_msk_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkmskalpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "pkglint": "pkglint -f", "test": "cdk-test", "watch": "cdk-watch", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::MSK", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -82,39 +83,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" + "jest": "^27.5.1", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -126,6 +107,17 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" + }, + "awslint": { + "exclude": [ + "*:*" + ] + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-msk/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-msk/rosetta/default.ts-fixture index 3bbdf64fe3ceb..3a9cc62446ebb 100644 --- a/packages/@aws-cdk/aws-msk/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-msk/rosetta/default.ts-fixture @@ -1,9 +1,9 @@ // Fixture with packages imported, but nothing else -import { CfnOutput, Stack } from '@aws-cdk/core'; +import { CfnOutput, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as msk from '@aws-cdk/aws-msk'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; +import * as msk from '@aws-cdk/aws-msk-alpha'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-msk/test/cluster.test.ts b/packages/@aws-cdk/aws-msk/test/cluster.test.ts index be4f6e92679ca..bc8e9823fd941 100644 --- a/packages/@aws-cdk/aws-msk/test/cluster.test.ts +++ b/packages/@aws-cdk/aws-msk/test/cluster.test.ts @@ -1,10 +1,10 @@ -import { Template } from '@aws-cdk/assertions'; -import * as acmpca from '@aws-cdk/aws-acmpca'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as core from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as core from 'aws-cdk-lib'; import * as msk from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-msk/test/integ.cluster.ts b/packages/@aws-cdk/aws-msk/test/integ.cluster.ts index af0e9ddd8677c..85a77256ebc08 100644 --- a/packages/@aws-cdk/aws-msk/test/integ.cluster.ts +++ b/packages/@aws-cdk/aws-msk/test/integ.cluster.ts @@ -3,11 +3,11 @@ import { CfnCertificate, CfnCertificateAuthority, CfnCertificateAuthorityActivation, -} from '@aws-cdk/aws-acmpca'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest, AssertionsProvider, ExpectedResult } from '@aws-cdk/integ-tests'; +} from 'aws-cdk-lib/aws-acmpca'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest, AssertionsProvider, ExpectedResult } from '@aws-cdk/integ-tests-alpha'; import * as msk from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-mwaa/.eslintrc.js b/packages/@aws-cdk/aws-mwaa/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mwaa/.gitignore b/packages/@aws-cdk/aws-mwaa/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-mwaa/.npmignore b/packages/@aws-cdk/aws-mwaa/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-mwaa/LICENSE b/packages/@aws-cdk/aws-mwaa/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-mwaa/NOTICE b/packages/@aws-cdk/aws-mwaa/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-mwaa/README.md b/packages/@aws-cdk/aws-mwaa/README.md deleted file mode 100644 index 16cbac30602cf..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::MWAA Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as mwaa from '@aws-cdk/aws-mwaa'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for MWAA construct libraries](https://constructs.dev/search?q=mwaa) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MWAA resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MWAA.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MWAA](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MWAA.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-mwaa/jest.config.js b/packages/@aws-cdk/aws-mwaa/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-mwaa/lib/index.ts b/packages/@aws-cdk/aws-mwaa/lib/index.ts deleted file mode 100644 index b07d35a50e475..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::MWAA CloudFormation Resources: -export * from './mwaa.generated'; diff --git a/packages/@aws-cdk/aws-mwaa/package.json b/packages/@aws-cdk/aws-mwaa/package.json deleted file mode 100644 index 90cb8698f95c7..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-mwaa", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::MWAA", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.MWAA", - "packageId": "Amazon.CDK.AWS.MWAA", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.mwaa", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "mwaa" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-mwaa", - "module": "aws_cdk.aws_mwaa" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-mwaa" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::MWAA", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::MWAA", - "aws-mwaa" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-mwaa/test/mwaa.test.ts b/packages/@aws-cdk/aws-mwaa/test/mwaa.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-mwaa/test/mwaa.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-neptune/.eslintrc.js b/packages/@aws-cdk/aws-neptune/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-neptune/.eslintrc.js +++ b/packages/@aws-cdk/aws-neptune/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-neptune/.gitignore b/packages/@aws-cdk/aws-neptune/.gitignore index ac4ba3ab6a8a9..2d5f0169c1eb3 100644 --- a/packages/@aws-cdk/aws-neptune/.gitignore +++ b/packages/@aws-cdk/aws-neptune/.gitignore @@ -20,3 +20,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-neptune/README.md b/packages/@aws-cdk/aws-neptune/README.md index cc11a50e94e04..f941c6873e671 100644 --- a/packages/@aws-cdk/aws-neptune/README.md +++ b/packages/@aws-cdk/aws-neptune/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -26,7 +20,7 @@ Amazon Neptune is a fast, reliable, fully managed graph database service that ma The `@aws-cdk/aws-neptune` package contains primitives for setting up Neptune database clusters and instances. ```ts nofixture -import * as neptune from '@aws-cdk/aws-neptune'; +import * as neptune from '@aws-cdk/aws-neptune-alpha'; ``` ## Starting a Neptune Database diff --git a/packages/@aws-cdk/aws-neptune/lib/cluster.ts b/packages/@aws-cdk/aws-neptune/lib/cluster.ts index ee3effb699ef4..c2086430b8814 100644 --- a/packages/@aws-cdk/aws-neptune/lib/cluster.ts +++ b/packages/@aws-cdk/aws-neptune/lib/cluster.ts @@ -1,13 +1,13 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import { Aws, Duration, IResource, Lazy, RemovalPolicy, Resource, Token } from '@aws-cdk/core'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import { Aws, Duration, IResource, Lazy, RemovalPolicy, Resource, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { Endpoint } from './endpoint'; import { InstanceType } from './instance'; -import { CfnDBCluster, CfnDBInstance } from './neptune.generated'; +import { CfnDBCluster, CfnDBInstance } from 'aws-cdk-lib/aws-neptune'; import { IClusterParameterGroup, IParameterGroup } from './parameter-group'; import { ISubnetGroup, SubnetGroup } from './subnet-group'; diff --git a/packages/@aws-cdk/aws-neptune/lib/endpoint.ts b/packages/@aws-cdk/aws-neptune/lib/endpoint.ts index fc92942416b7d..3d20dbdd42445 100644 --- a/packages/@aws-cdk/aws-neptune/lib/endpoint.ts +++ b/packages/@aws-cdk/aws-neptune/lib/endpoint.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from 'aws-cdk-lib'; /** * Connection endpoint of a neptune cluster or instance diff --git a/packages/@aws-cdk/aws-neptune/lib/index.ts b/packages/@aws-cdk/aws-neptune/lib/index.ts index 35257958b20aa..af3c17a473758 100644 --- a/packages/@aws-cdk/aws-neptune/lib/index.ts +++ b/packages/@aws-cdk/aws-neptune/lib/index.ts @@ -5,4 +5,3 @@ export * from './parameter-group'; export * from './subnet-group'; // AWS::Neptune CloudFormation Resources: -export * from './neptune.generated'; diff --git a/packages/@aws-cdk/aws-neptune/lib/instance.ts b/packages/@aws-cdk/aws-neptune/lib/instance.ts index 8cc255d9c8e00..0270c1f2243ab 100644 --- a/packages/@aws-cdk/aws-neptune/lib/instance.ts +++ b/packages/@aws-cdk/aws-neptune/lib/instance.ts @@ -1,10 +1,10 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IDatabaseCluster } from './cluster'; import { Endpoint } from './endpoint'; -import { CfnDBInstance } from './neptune.generated'; +import { CfnDBInstance } from 'aws-cdk-lib/aws-neptune'; import { IParameterGroup } from './parameter-group'; /** diff --git a/packages/@aws-cdk/aws-neptune/lib/parameter-group.ts b/packages/@aws-cdk/aws-neptune/lib/parameter-group.ts index 0f8ffeb76d2ab..08dc90b04d236 100644 --- a/packages/@aws-cdk/aws-neptune/lib/parameter-group.ts +++ b/packages/@aws-cdk/aws-neptune/lib/parameter-group.ts @@ -1,6 +1,6 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from './neptune.generated'; +import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from 'aws-cdk-lib/aws-neptune'; /** * The DB parameter group family that a DB parameter group is compatible with diff --git a/packages/@aws-cdk/aws-neptune/lib/subnet-group.ts b/packages/@aws-cdk/aws-neptune/lib/subnet-group.ts index 1141460a94238..9cafd87feafc7 100644 --- a/packages/@aws-cdk/aws-neptune/lib/subnet-group.ts +++ b/packages/@aws-cdk/aws-neptune/lib/subnet-group.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { IResource, RemovalPolicy, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnDBSubnetGroup } from './neptune.generated'; +import { CfnDBSubnetGroup } from 'aws-cdk-lib/aws-neptune'; /** * Interface for a subnet group. diff --git a/packages/@aws-cdk/aws-neptune/package.json b/packages/@aws-cdk/aws-neptune/package.json index c63290eaa732a..e3fa2e7c3f855 100644 --- a/packages/@aws-cdk/aws-neptune/package.json +++ b/packages/@aws-cdk/aws-neptune/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-neptune", + "name": "@aws-cdk/aws-neptune-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Neptune", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Neptune", - "packageId": "Amazon.CDK.AWS.Neptune", + "namespace": "Amazon.CDK.AWS.Neptune.Alpha", + "packageId": "Amazon.CDK.AWS.Neptune.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.neptune", + "package": "software.amazon.awscdk.services.neptune.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "neptune" + "artifactId": "neptune-alpha" } }, "python": { - "distName": "aws-cdk.aws-neptune", - "module": "aws_cdk.aws_neptune", + "distName": "aws-cdk.aws-neptune-alpha", + "module": "aws_cdk.aws_neptune_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkneptunealpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "test": "cdk-test", "watch": "cdk-watch", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Neptune", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -81,30 +82,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -112,9 +101,7 @@ }, "awslint": { "exclude": [ - "props-physical-name:@aws-cdk/aws-neptune.ParameterGroupProps", - "props-physical-name:@aws-cdk/aws-neptune.ClusterParameterGroupProps", - "props-physical-name:@aws-cdk/aws-neptune.SubnetGroupProps" + "*:*" ] }, "stability": "experimental", @@ -124,5 +111,11 @@ }, "publishConfig": { "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-neptune/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-neptune/rosetta/default.ts-fixture index c42645f4be506..1108df008e2f4 100644 --- a/packages/@aws-cdk/aws-neptune/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-neptune/rosetta/default.ts-fixture @@ -1,9 +1,9 @@ -import { Duration, Stack } from '@aws-cdk/core'; +import { Duration, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as logs from '@aws-cdk/aws-logs'; -import * as neptune from '@aws-cdk/aws-neptune'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as neptune from '@aws-cdk/aws-neptune-alpha'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-neptune/rosetta/with-cluster.ts-fixture b/packages/@aws-cdk/aws-neptune/rosetta/with-cluster.ts-fixture index c638d8b4d04fa..c4b5a45e5153e 100644 --- a/packages/@aws-cdk/aws-neptune/rosetta/with-cluster.ts-fixture +++ b/packages/@aws-cdk/aws-neptune/rosetta/with-cluster.ts-fixture @@ -1,7 +1,7 @@ -import { Duration, Stack } from '@aws-cdk/core'; +import { Duration, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as neptune from '@aws-cdk/aws-neptune'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as neptune from '@aws-cdk/aws-neptune-alpha'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-neptune/test/cluster.test.ts b/packages/@aws-cdk/aws-neptune/test/cluster.test.ts index 650a36fb3e28a..79f7a2be65e06 100644 --- a/packages/@aws-cdk/aws-neptune/test/cluster.test.ts +++ b/packages/@aws-cdk/aws-neptune/test/cluster.test.ts @@ -1,10 +1,10 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; import { ClusterParameterGroup, DatabaseCluster, EngineVersion, InstanceType, LogType } from '../lib'; diff --git a/packages/@aws-cdk/aws-neptune/test/instance.test.ts b/packages/@aws-cdk/aws-neptune/test/instance.test.ts index 95e6e27d3f4ed..111d971b8cfcc 100644 --- a/packages/@aws-cdk/aws-neptune/test/instance.test.ts +++ b/packages/@aws-cdk/aws-neptune/test/instance.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import * as constructs from 'constructs'; import { DatabaseCluster, DatabaseInstance, InstanceType, ParameterGroup } from '../lib'; diff --git a/packages/@aws-cdk/aws-neptune/test/integ.cluster-ev12.ts b/packages/@aws-cdk/aws-neptune/test/integ.cluster-ev12.ts index f23606920a7f6..24b88bb3520ac 100644 --- a/packages/@aws-cdk/aws-neptune/test/integ.cluster-ev12.ts +++ b/packages/@aws-cdk/aws-neptune/test/integ.cluster-ev12.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { DatabaseCluster, EngineVersion, InstanceType, ParameterGroupFamily } from '../lib'; import { ClusterParameterGroup } from '../lib/parameter-group'; diff --git a/packages/@aws-cdk/aws-neptune/test/integ.cluster.ts b/packages/@aws-cdk/aws-neptune/test/integ.cluster.ts index 08fe4a0232db9..5d6e5b95ea9e6 100644 --- a/packages/@aws-cdk/aws-neptune/test/integ.cluster.ts +++ b/packages/@aws-cdk/aws-neptune/test/integ.cluster.ts @@ -1,9 +1,9 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { DatabaseCluster, InstanceType, LogType } from '../lib'; import { ClusterParameterGroup } from '../lib/parameter-group'; diff --git a/packages/@aws-cdk/aws-neptune/test/parameter-group.test.ts b/packages/@aws-cdk/aws-neptune/test/parameter-group.test.ts index 37dd8635bf127..fa3a64daeff20 100644 --- a/packages/@aws-cdk/aws-neptune/test/parameter-group.test.ts +++ b/packages/@aws-cdk/aws-neptune/test/parameter-group.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Stack } from 'aws-cdk-lib'; import { ClusterParameterGroup, ParameterGroup, ParameterGroupFamily } from '../lib'; describe('ClusterParameterGroup', () => { diff --git a/packages/@aws-cdk/aws-neptune/test/subnet-group.test.ts b/packages/@aws-cdk/aws-neptune/test/subnet-group.test.ts index f2dcb268fceaf..ef1f23e2c77e1 100644 --- a/packages/@aws-cdk/aws-neptune/test/subnet-group.test.ts +++ b/packages/@aws-cdk/aws-neptune/test/subnet-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Stack } from 'aws-cdk-lib'; import { SubnetGroup } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-networkfirewall/.eslintrc.js b/packages/@aws-cdk/aws-networkfirewall/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-networkfirewall/.gitignore b/packages/@aws-cdk/aws-networkfirewall/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-networkfirewall/.npmignore b/packages/@aws-cdk/aws-networkfirewall/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-networkfirewall/LICENSE b/packages/@aws-cdk/aws-networkfirewall/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-networkfirewall/NOTICE b/packages/@aws-cdk/aws-networkfirewall/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-networkfirewall/README.md b/packages/@aws-cdk/aws-networkfirewall/README.md deleted file mode 100644 index 143b0f512399e..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::NetworkFirewall Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as networkfirewall from '@aws-cdk/aws-networkfirewall'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for NetworkFirewall construct libraries](https://constructs.dev/search?q=networkfirewall) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::NetworkFirewall resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkFirewall.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::NetworkFirewall](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkFirewall.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-networkfirewall/jest.config.js b/packages/@aws-cdk/aws-networkfirewall/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-networkfirewall/lib/index.ts b/packages/@aws-cdk/aws-networkfirewall/lib/index.ts deleted file mode 100644 index 1aa22b2582738..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::NetworkFirewall CloudFormation Resources: -export * from './networkfirewall.generated'; diff --git a/packages/@aws-cdk/aws-networkfirewall/package.json b/packages/@aws-cdk/aws-networkfirewall/package.json deleted file mode 100644 index 224391c8110e0..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-networkfirewall", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::NetworkFirewall", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.NetworkFirewall", - "packageId": "Amazon.CDK.AWS.NetworkFirewall", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.networkfirewall", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "networkfirewall" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-networkfirewall", - "module": "aws_cdk.aws_networkfirewall" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-networkfirewall" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::NetworkFirewall", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::NetworkFirewall", - "aws-networkfirewall" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-networkfirewall/test/networkfirewall.test.ts b/packages/@aws-cdk/aws-networkfirewall/test/networkfirewall.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-networkfirewall/test/networkfirewall.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-networkmanager/.eslintrc.js b/packages/@aws-cdk/aws-networkmanager/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-networkmanager/.gitignore b/packages/@aws-cdk/aws-networkmanager/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-networkmanager/.npmignore b/packages/@aws-cdk/aws-networkmanager/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-networkmanager/LICENSE b/packages/@aws-cdk/aws-networkmanager/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-networkmanager/NOTICE b/packages/@aws-cdk/aws-networkmanager/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-networkmanager/README.md b/packages/@aws-cdk/aws-networkmanager/README.md deleted file mode 100644 index c86235f9e19ff..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::NetworkManager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as networkmanager from '@aws-cdk/aws-networkmanager'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for NetworkManager construct libraries](https://constructs.dev/search?q=networkmanager) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::NetworkManager resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkManager.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::NetworkManager](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkManager.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-networkmanager/jest.config.js b/packages/@aws-cdk/aws-networkmanager/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-networkmanager/lib/index.ts b/packages/@aws-cdk/aws-networkmanager/lib/index.ts deleted file mode 100644 index d39cb0c0acb5e..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::NetworkManager CloudFormation Resources: -export * from './networkmanager.generated'; diff --git a/packages/@aws-cdk/aws-networkmanager/package.json b/packages/@aws-cdk/aws-networkmanager/package.json deleted file mode 100644 index e34badecda783..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-networkmanager", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::NetworkManager", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.NetworkManager", - "packageId": "Amazon.CDK.AWS.NetworkManager", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.networkmanager", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "networkmanager" - } - }, - "python": { - "distName": "aws-cdk.aws-networkmanager", - "module": "aws_cdk.aws_networkmanager", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-networkmanager" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::NetworkManager", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::NetworkManager", - "aws-networkmanager" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-networkmanager/test/networkmanager.test.ts b/packages/@aws-cdk/aws-networkmanager/test/networkmanager.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-networkmanager/test/networkmanager.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-nimblestudio/.eslintrc.js b/packages/@aws-cdk/aws-nimblestudio/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-nimblestudio/.gitignore b/packages/@aws-cdk/aws-nimblestudio/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-nimblestudio/.npmignore b/packages/@aws-cdk/aws-nimblestudio/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-nimblestudio/LICENSE b/packages/@aws-cdk/aws-nimblestudio/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-nimblestudio/NOTICE b/packages/@aws-cdk/aws-nimblestudio/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-nimblestudio/README.md b/packages/@aws-cdk/aws-nimblestudio/README.md deleted file mode 100644 index 30ea9785bc29a..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::NimbleStudio Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as nimblestudio from '@aws-cdk/aws-nimblestudio'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for NimbleStudio construct libraries](https://constructs.dev/search?q=nimblestudio) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::NimbleStudio resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NimbleStudio.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::NimbleStudio](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NimbleStudio.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-nimblestudio/jest.config.js b/packages/@aws-cdk/aws-nimblestudio/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-nimblestudio/lib/index.ts b/packages/@aws-cdk/aws-nimblestudio/lib/index.ts deleted file mode 100644 index 15c195efc6e6a..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::NimbleStudio CloudFormation Resources: -export * from './nimblestudio.generated'; diff --git a/packages/@aws-cdk/aws-nimblestudio/package.json b/packages/@aws-cdk/aws-nimblestudio/package.json deleted file mode 100644 index 007496038a611..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-nimblestudio", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::NimbleStudio", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.NimbleStudio", - "packageId": "Amazon.CDK.AWS.NimbleStudio", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.nimblestudio", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "nimblestudio" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-nimblestudio", - "module": "aws_cdk.aws_nimblestudio" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-nimblestudio" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::NimbleStudio", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::NimbleStudio", - "aws-nimblestudio" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-nimblestudio/test/nimblestudio.test.ts b/packages/@aws-cdk/aws-nimblestudio/test/nimblestudio.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-nimblestudio/test/nimblestudio.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-oam/.eslintrc.js b/packages/@aws-cdk/aws-oam/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-oam/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-oam/.gitignore b/packages/@aws-cdk/aws-oam/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-oam/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-oam/.npmignore b/packages/@aws-cdk/aws-oam/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-oam/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-oam/LICENSE b/packages/@aws-cdk/aws-oam/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-oam/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-oam/NOTICE b/packages/@aws-cdk/aws-oam/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-oam/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-oam/README.md b/packages/@aws-cdk/aws-oam/README.md deleted file mode 100644 index 19659a3ab7980..0000000000000 --- a/packages/@aws-cdk/aws-oam/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Oam Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as oam from '@aws-cdk/aws-oam'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Oam construct libraries](https://constructs.dev/search?q=oam) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Oam resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Oam.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Oam](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Oam.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-oam/jest.config.js b/packages/@aws-cdk/aws-oam/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-oam/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-oam/lib/index.ts b/packages/@aws-cdk/aws-oam/lib/index.ts deleted file mode 100644 index 88fe5b529373b..0000000000000 --- a/packages/@aws-cdk/aws-oam/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Oam CloudFormation Resources: -export * from './oam.generated'; diff --git a/packages/@aws-cdk/aws-oam/package.json b/packages/@aws-cdk/aws-oam/package.json deleted file mode 100644 index 5102c955f6509..0000000000000 --- a/packages/@aws-cdk/aws-oam/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-oam", - "version": "0.0.0", - "description": "AWS::Oam Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Oam", - "packageId": "Amazon.CDK.AWS.Oam", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.oam", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "oam" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-oam", - "module": "aws_cdk.aws_oam" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-oam" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Oam", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Oam", - "aws-oam" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-oam/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-oam/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-oam/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-oam/test/oam.test.ts b/packages/@aws-cdk/aws-oam/test/oam.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-oam/test/oam.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-omics/.eslintrc.js b/packages/@aws-cdk/aws-omics/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-omics/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-omics/.gitignore b/packages/@aws-cdk/aws-omics/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-omics/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-omics/.npmignore b/packages/@aws-cdk/aws-omics/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-omics/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-omics/LICENSE b/packages/@aws-cdk/aws-omics/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-omics/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-omics/NOTICE b/packages/@aws-cdk/aws-omics/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-omics/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-omics/README.md b/packages/@aws-cdk/aws-omics/README.md deleted file mode 100644 index 291af1cba3bb8..0000000000000 --- a/packages/@aws-cdk/aws-omics/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Omics Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as omics from '@aws-cdk/aws-omics'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Omics construct libraries](https://constructs.dev/search?q=omics) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Omics resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Omics.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Omics](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Omics.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-omics/jest.config.js b/packages/@aws-cdk/aws-omics/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-omics/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-omics/lib/index.ts b/packages/@aws-cdk/aws-omics/lib/index.ts deleted file mode 100644 index d3d4ee15cf498..0000000000000 --- a/packages/@aws-cdk/aws-omics/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Omics CloudFormation Resources: -export * from './omics.generated'; diff --git a/packages/@aws-cdk/aws-omics/package.json b/packages/@aws-cdk/aws-omics/package.json deleted file mode 100644 index eb8734ad85b88..0000000000000 --- a/packages/@aws-cdk/aws-omics/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-omics", - "version": "0.0.0", - "description": "AWS::Omics Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Omics", - "packageId": "Amazon.CDK.AWS.Omics", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.omics", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "omics" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-omics", - "module": "aws_cdk.aws_omics" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-omics" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Omics", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Omics", - "aws-omics" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-omics/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-omics/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-omics/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-omics/test/omics.test.ts b/packages/@aws-cdk/aws-omics/test/omics.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-omics/test/omics.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-opensearchserverless/.eslintrc.js b/packages/@aws-cdk/aws-opensearchserverless/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opensearchserverless/.gitignore b/packages/@aws-cdk/aws-opensearchserverless/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-opensearchserverless/.npmignore b/packages/@aws-cdk/aws-opensearchserverless/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-opensearchserverless/LICENSE b/packages/@aws-cdk/aws-opensearchserverless/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-opensearchserverless/NOTICE b/packages/@aws-cdk/aws-opensearchserverless/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-opensearchserverless/README.md b/packages/@aws-cdk/aws-opensearchserverless/README.md deleted file mode 100644 index 5cb981bb37e81..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::OpenSearchServerless Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as opensearchserverless from '@aws-cdk/aws-opensearchserverless'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for OpenSearchServerless construct libraries](https://constructs.dev/search?q=opensearchserverless) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::OpenSearchServerless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpenSearchServerless.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::OpenSearchServerless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpenSearchServerless.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-opensearchserverless/jest.config.js b/packages/@aws-cdk/aws-opensearchserverless/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opensearchserverless/lib/index.ts b/packages/@aws-cdk/aws-opensearchserverless/lib/index.ts deleted file mode 100644 index 8baf8a08b7489..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::OpenSearchServerless CloudFormation Resources: -export * from './opensearchserverless.generated'; diff --git a/packages/@aws-cdk/aws-opensearchserverless/package.json b/packages/@aws-cdk/aws-opensearchserverless/package.json deleted file mode 100644 index 185609c787fce..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-opensearchserverless", - "version": "0.0.0", - "description": "AWS::OpenSearchServerless Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.OpenSearchServerless", - "packageId": "Amazon.CDK.AWS.OpenSearchServerless", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.opensearchserverless", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "opensearchserverless" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-opensearchserverless", - "module": "aws_cdk.aws_opensearchserverless" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-opensearchserverless" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::OpenSearchServerless", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::OpenSearchServerless", - "aws-opensearchserverless" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-opensearchserverless/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-opensearchserverless/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-opensearchserverless/test/opensearchserverless.test.ts b/packages/@aws-cdk/aws-opensearchserverless/test/opensearchserverless.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-opensearchserverless/test/opensearchserverless.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-opensearchservice/.eslintrc.js b/packages/@aws-cdk/aws-opensearchservice/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opensearchservice/.gitignore b/packages/@aws-cdk/aws-opensearchservice/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-opensearchservice/.npmignore b/packages/@aws-cdk/aws-opensearchservice/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-opensearchservice/LICENSE b/packages/@aws-cdk/aws-opensearchservice/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-opensearchservice/NOTICE b/packages/@aws-cdk/aws-opensearchservice/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-opensearchservice/README.md b/packages/@aws-cdk/aws-opensearchservice/README.md deleted file mode 100644 index 5b68e6e770214..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/README.md +++ /dev/null @@ -1,397 +0,0 @@ -# Amazon OpenSearch Service Construct Library - - ---- - -Features | Stability ------------------------------------|---------------------------------------------------------------- -CFN Resources | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) -Higher level constructs for Domain | ![Stable](https://img.shields.io/badge/stable-success.svg?style=for-the-badge) - -> **CFN Resources:** All classes with the `Cfn` prefix in this module ([CFN Resources]) are always -> stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - - - -> **Stable:** Higher level constructs in this module that are marked stable will not undergo any -> breaking changes. They will strictly follow the [Semantic Versioning](https://semver.org/) model. - ---- - - - -See [Migrating to OpenSearch](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-elasticsearch-readme.html#migrating-to-opensearch) for migration instructions from `@aws-cdk/aws-elasticsearch` to this module, `@aws-cdk/aws-opensearchservice`. - -## Quick start - -Create a development cluster by simply specifying the version: - -```ts -const devDomain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, -}); -``` - -To perform version upgrades without replacing the entire domain, specify the `enableVersionUpgrade` property. - -```ts -const devDomain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - enableVersionUpgrade: true, // defaults to false -}); -``` - -Create a production grade cluster by also specifying things like capacity and az distribution - -```ts -const prodDomain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - capacity: { - masterNodes: 5, - dataNodes: 20, - }, - ebs: { - volumeSize: 20, - }, - zoneAwareness: { - availabilityZoneCount: 3, - }, - logging: { - slowSearchLogEnabled: true, - appLogEnabled: true, - slowIndexLogEnabled: true, - }, -}); -``` - -This creates an Amazon OpenSearch Service cluster and automatically sets up log groups for -logging the domain logs and slow search logs. - -## A note about SLR - -Some cluster configurations (e.g VPC access) require the existence of the [`AWSServiceRoleForAmazonElasticsearchService`](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/slr.html) Service-Linked Role. - -When performing such operations via the AWS Console, this SLR is created automatically when needed. However, this is not the behavior when using CloudFormation. If an SLR is needed, but doesn't exist, you will encounter a failure message similar to: - -```console -Before you can proceed, you must enable a service-linked role to give Amazon OpenSearch Service... -``` - -To resolve this, you need to [create](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#create-service-linked-role) the SLR. We recommend using the AWS CLI: - -```console -aws iam create-service-linked-role --aws-service-name es.amazonaws.com -``` - -You can also create it using the CDK, **but note that only the first application deploying this will succeed**: - -```ts -const slr = new iam.CfnServiceLinkedRole(this, 'Service Linked Role', { - awsServiceName: 'es.amazonaws.com', -}); -``` - -## Importing existing domains - -### Using a known domain endpoint - -To import an existing domain into your CDK application, use the `Domain.fromDomainEndpoint` factory method. -This method accepts a domain endpoint of an already existing domain: - -```ts -const domainEndpoint = 'https://my-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com'; -const domain = Domain.fromDomainEndpoint(this, 'ImportedDomain', domainEndpoint); -``` - -### Using the output of another CloudFormation stack - -To import an existing domain with the help of an exported value from another CloudFormation stack, -use the `Domain.fromDomainAttributes` factory method. This will accept tokens. - -```ts -const domainArn = Fn.importValue(`another-cf-stack-export-domain-arn`); -const domainEndpoint = Fn.importValue(`another-cf-stack-export-domain-endpoint`); -const domain = Domain.fromDomainAttributes(this, 'ImportedDomain', { - domainArn, - domainEndpoint, -}); -``` - -## Permissions - -### IAM - -Helper methods also exist for managing access to the domain. - -```ts -declare const fn: lambda.Function; -declare const domain: Domain; - -// Grant write access to the app-search index -domain.grantIndexWrite('app-search', fn); - -// Grant read access to the 'app-search/_search' path -domain.grantPathRead('app-search/_search', fn); -``` - -## Encryption - -The domain can also be created with encryption enabled: - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - ebs: { - volumeSize: 100, - volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, - }, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, -}); -``` - -This sets up the domain with node to node encryption and encryption at -rest. You can also choose to supply your own KMS key to use for encryption at -rest. - -## VPC Support - -Domains can be placed inside a VPC, providing a secure communication between Amazon OpenSearch Service and other services within the VPC without the need for an internet gateway, NAT device, or VPN connection. - -> Visit [VPC Support for Amazon OpenSearch Service Domains](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html) for more details. - -```ts -const vpc = new ec2.Vpc(this, 'Vpc'); -const domainProps: DomainProps = { - version: EngineVersion.OPENSEARCH_1_0, - removalPolicy: RemovalPolicy.DESTROY, - vpc, - // must be enabled since our VPC contains multiple private subnets. - zoneAwareness: { - enabled: true, - }, - capacity: { - // must be an even number since the default az count is 2. - dataNodes: 2, - }, -}; -new Domain(this, 'Domain', domainProps); -``` - -In addition, you can use the `vpcSubnets` property to control which specific subnets will be used, and the `securityGroups` property to control -which security groups will be attached to the domain. By default, CDK will select all *private* subnets in the VPC, and create one dedicated security group. - -## Metrics - -Helper methods exist to access common domain metrics for example: - -```ts -declare const domain: Domain; -const freeStorageSpace = domain.metricFreeStorageSpace(); -const masterSysMemoryUtilization = domain.metric('MasterSysMemoryUtilization'); -``` - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Fine grained access control - -The domain can also be created with a master user configured. The password can -be supplied or dynamically created if not supplied. - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - enforceHttps: true, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - fineGrainedAccessControl: { - masterUserName: 'master-user', - }, -}); - -const masterUserPassword = domain.masterUserPassword; -``` - -## Using unsigned basic auth - -For convenience, the domain can be configured to allow unsigned HTTP requests -that use basic auth. Unless the domain is configured to be part of a VPC this -means anyone can access the domain using the configured master username and -password. - -To enable unsigned basic auth access the domain is configured with an access -policy that allows anonymous requests, HTTPS required, node to node encryption, -encryption at rest and fine grained access control. - -If the above settings are not set they will be configured as part of enabling -unsigned basic auth. If they are set with conflicting values, an error will be -thrown. - -If no master user is configured a default master user is created with the -username `admin`. - -If no password is configured a default master user password is created and -stored in the AWS Secrets Manager as secret. The secret has the prefix -`MasterUser`. - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - useUnsignedBasicAuth: true, -}); - -const masterUserPassword = domain.masterUserPassword; -``` - -## Custom access policies - -If the domain requires custom access control it can be configured either as a -constructor property, or later by means of a helper method. - -For simple permissions the `accessPolicies` constructor may be sufficient: - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - accessPolicies: [ - new iam.PolicyStatement({ - actions: ['es:*ESHttpPost', 'es:ESHttpPut*'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('123456789012')], - resources: ['*'], - }), - ] -}); -``` - -For more complex use-cases, for example, to set the domain up to receive data from a -[cross-account Kinesis Firehose](https://aws.amazon.com/premiumsupport/knowledge-center/kinesis-firehose-cross-account-streaming/) the `addAccessPolicies` helper method -allows for policies that include the explicit domain ARN. - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, -}); -domain.addAccessPolicies( - new iam.PolicyStatement({ - actions: ['es:ESHttpPost', 'es:ESHttpPut'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('123456789012')], - resources: [domain.domainArn, `${domain.domainArn}/*`], - }), - new iam.PolicyStatement({ - actions: ['es:ESHttpGet'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('123456789012')], - resources: [ - `${domain.domainArn}/_all/_settings`, - `${domain.domainArn}/_cluster/stats`, - `${domain.domainArn}/index-name*/_mapping/type-name`, - `${domain.domainArn}/roletest*/_mapping/roletest`, - `${domain.domainArn}/_nodes`, - `${domain.domainArn}/_nodes/stats`, - `${domain.domainArn}/_nodes/*/stats`, - `${domain.domainArn}/_stats`, - `${domain.domainArn}/index-name*/_stats`, - `${domain.domainArn}/roletest*/_stat`, - ], - }), -); -``` - - -## Audit logs - -Audit logs can be enabled for a domain, but only when fine grained access control is enabled. - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - enforceHttps: true, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - fineGrainedAccessControl: { - masterUserName: 'master-user', - }, - logging: { - auditLogEnabled: true, - slowSearchLogEnabled: true, - appLogEnabled: true, - slowIndexLogEnabled: true, - }, -}); -``` - -## UltraWarm - -UltraWarm nodes can be enabled to provide a cost-effective way to store large amounts of read-only data. - -```ts -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - capacity: { - masterNodes: 2, - warmNodes: 2, - warmInstanceType: 'ultrawarm1.medium.search', - }, -}); -``` - -## Custom endpoint - -Custom endpoints can be configured to reach the domain under a custom domain name. - -```ts -new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - customEndpoint: { - domainName: 'search.example.com', - }, -}); -``` - -It is also possible to specify a custom certificate instead of the auto-generated one. - -Additionally, an automatic CNAME-Record is created if a hosted zone is provided for the custom endpoint - -## Advanced options - -[Advanced options](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options) can used to configure additional options. - -```ts -new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - advancedOptions: { - 'rest.action.multi.allow_explicit_index': 'false', - 'indices.fielddata.cache.size': '25', - 'indices.query.bool.max_clause_count': '2048', - }, -}); -``` - -## Amazon Cognito authentication for OpenSearch Dashboards - -The domain can be configured to use Amazon Cognito authentication for OpenSearch Dashboards. - -> Visit [Configuring Amazon Cognito authentication for OpenSearch Dashboards](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html) for more details. - -```ts -declare const cognitoConfigurationRole: iam.Role; - -const domain = new Domain(this, 'Domain', { - version: EngineVersion.OPENSEARCH_1_0, - cognitoDashboardsAuth: { - role: cognitoConfigurationRole, - identityPoolId: 'example-identity-pool-id', - userPoolId: 'example-user-pool-id', - }, -}); -``` diff --git a/packages/@aws-cdk/aws-opensearchservice/jest.config.js b/packages/@aws-cdk/aws-opensearchservice/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts b/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts deleted file mode 100644 index 09a78c1e52520..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/lib/domain.ts +++ /dev/null @@ -1,1815 +0,0 @@ -import { URL } from 'url'; - -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Metric, MetricOptions, Statistic } from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -import { LogGroupResourcePolicy } from './log-group-resource-policy'; -import { OpenSearchAccessPolicy } from './opensearch-access-policy'; -import { CfnDomain } from './opensearchservice.generated'; -import * as perms from './perms'; -import { EngineVersion } from './version'; - -/** - * Configures the capacity of the cluster such as the instance type and the - * number of instances. - */ -export interface CapacityConfig { - /** - * The number of instances to use for the master node. - * - * @default - no dedicated master nodes - */ - readonly masterNodes?: number; - - /** - * The hardware configuration of the computer that hosts the dedicated master - * node, such as `m3.medium.search`. For valid values, see [Supported - * Instance Types] - * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html) - * in the Amazon OpenSearch Service Developer Guide. - * - * @default - r5.large.search - */ - readonly masterNodeInstanceType?: string; - - /** - * The number of data nodes (instances) to use in the Amazon OpenSearch Service domain. - * - * @default - 1 - */ - readonly dataNodes?: number; - - /** - * The instance type for your data nodes, such as - * `m3.medium.search`. For valid values, see [Supported Instance - * Types](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html) - * in the Amazon OpenSearch Service Developer Guide. - * - * @default - r5.large.search - */ - readonly dataNodeInstanceType?: string; - - /** - * The number of UltraWarm nodes (instances) to use in the Amazon OpenSearch Service domain. - * - * @default - no UltraWarm nodes - */ - readonly warmNodes?: number; - - /** - * The instance type for your UltraWarm node, such as `ultrawarm1.medium.search`. - * For valid values, see [UltraWarm Storage Limits] - * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#limits-ultrawarm) - * in the Amazon OpenSearch Service Developer Guide. - * - * @default - ultrawarm1.medium.search - */ - readonly warmInstanceType?: string; - -} - -/** - * Specifies zone awareness configuration options. - */ -export interface ZoneAwarenessConfig { - /** - * Indicates whether to enable zone awareness for the Amazon OpenSearch Service domain. - * When you enable zone awareness, Amazon OpenSearch Service allocates the nodes and replica - * index shards that belong to a cluster across two Availability Zones (AZs) - * in the same region to prevent data loss and minimize downtime in the event - * of node or data center failure. Don't enable zone awareness if your cluster - * has no replica index shards or is a single-node cluster. For more information, - * see [Configuring a Multi-AZ Domain] - * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html) - * in the Amazon OpenSearch Service Developer Guide. - * - * @default - false - */ - readonly enabled?: boolean; - - /** - * If you enabled multiple Availability Zones (AZs), the number of AZs that you - * want the domain to use. Valid values are 2 and 3. - * - * @default - 2 if zone awareness is enabled. - */ - readonly availabilityZoneCount?: number; -} - -/** - * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that - * are attached to data nodes in the Amazon OpenSearch Service domain. For more information, see - * [Amazon EBS] - * (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) - * in the Amazon Elastic Compute Cloud Developer Guide. - */ -export interface EbsOptions { - /** - * Specifies whether Amazon EBS volumes are attached to data nodes in the - * Amazon OpenSearch Service domain. - * - * @default - true - */ - readonly enabled?: boolean; - - /** - * The number of I/O operations per second (IOPS) that the volume - * supports. This property applies only to the Provisioned IOPS (SSD) EBS - * volume type. - * - * @default - iops are not set. - */ - readonly iops?: number; - - /** - * The size (in GiB) of the EBS volume for each data node. The minimum and - * maximum size of an EBS volume depends on the EBS volume type and the - * instance type to which it is attached. For valid values, see - * [EBS volume size limits] - * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#ebsresource) - * in the Amazon OpenSearch Service Developer Guide. - * - * @default 10 - */ - readonly volumeSize?: number; - - /** - * The EBS volume type to use with the Amazon OpenSearch Service domain, such as standard, gp2, io1. - * - * @default gp2 - */ - readonly volumeType?: ec2.EbsDeviceVolumeType; -} - -/** - * Configures log settings for the domain. - */ -export interface LoggingOptions { - /** - * Specify if slow search logging should be set up. - * Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. - * - * @default - false - */ - readonly slowSearchLogEnabled?: boolean; - - /** - * Log slow searches to this log group. - * - * @default - a new log group is created if slow search logging is enabled - */ - readonly slowSearchLogGroup?: logs.ILogGroup; - - /** - * Specify if slow index logging should be set up. - * Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. - * - * @default - false - */ - readonly slowIndexLogEnabled?: boolean; - - /** - * Log slow indices to this log group. - * - * @default - a new log group is created if slow index logging is enabled - */ - readonly slowIndexLogGroup?: logs.ILogGroup; - - /** - * Specify if Amazon OpenSearch Service application logging should be set up. - * Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. - * - * @default - false - */ - readonly appLogEnabled?: boolean; - - /** - * Log Amazon OpenSearch Service application logs to this log group. - * - * @default - a new log group is created if app logging is enabled - */ - readonly appLogGroup?: logs.ILogGroup; - - /** - * Specify if Amazon OpenSearch Service audit logging should be set up. - * Requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later and fine grained access control to be enabled. - * - * @default - false - */ - readonly auditLogEnabled?: boolean; - - /** - * Log Amazon OpenSearch Service audit logs to this log group. - * - * @default - a new log group is created if audit logging is enabled - */ - readonly auditLogGroup?: logs.ILogGroup; -} - -/** - * Whether the domain should encrypt data at rest, and if so, the AWS Key - * Management Service (KMS) key to use. Can only be used to create a new domain, - * not update an existing one. Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. - */ -export interface EncryptionAtRestOptions { - /** - * Specify true to enable encryption at rest. - * - * @default - encryption at rest is disabled. - */ - readonly enabled?: boolean; - - /** - * Supply if using KMS key for encryption at rest. - * - * @default - uses default aws/es KMS key. - */ - readonly kmsKey?: kms.IKey; -} - -/** - * Configures Amazon OpenSearch Service to use Amazon Cognito authentication for OpenSearch Dashboards. - * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html - */ -export interface CognitoOptions { - /** - * The Amazon Cognito identity pool ID that you want Amazon OpenSearch Service to use for OpenSearch Dashboards authentication. - */ - readonly identityPoolId: string; - - /** - * A role that allows Amazon OpenSearch Service to configure your user pool and identity pool. It must have the `AmazonESCognitoAccess` policy attached to it. - * - * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html#cognito-auth-prereq - */ - readonly role: iam.IRole; - - /** - * The Amazon Cognito user pool ID that you want Amazon OpenSearch Service to use for OpenSearch Dashboards authentication. - */ - readonly userPoolId: string; -} - -/** - * The minimum TLS version required for traffic to the domain. - */ -export enum TLSSecurityPolicy { - /** Cipher suite TLS 1.0 */ - TLS_1_0 = 'Policy-Min-TLS-1-0-2019-07', - /** Cipher suite TLS 1.2 */ - TLS_1_2 = 'Policy-Min-TLS-1-2-2019-07' -} - -/** - * Specifies options for fine-grained access control. - */ -export interface AdvancedSecurityOptions { - /** - * ARN for the master user. Only specify this or masterUserName, but not both. - * - * @default - fine-grained access control is disabled - */ - readonly masterUserArn?: string; - - /** - * Username for the master user. Only specify this or masterUserArn, but not both. - * - * @default - fine-grained access control is disabled - */ - readonly masterUserName?: string; - - /** - * Password for the master user. - * - * You can use `SecretValue.unsafePlainText` to specify a password in plain text or - * use `secretsmanager.Secret.fromSecretAttributes` to reference a secret in - * Secrets Manager. - * - * @default - A Secrets Manager generated password - */ - readonly masterUserPassword?: cdk.SecretValue; -} - -/** - * Configures a custom domain endpoint for the Amazon OpenSearch Service domain - */ -export interface CustomEndpointOptions { - /** - * The custom domain name to assign - */ - readonly domainName: string; - - /** - * The certificate to use - * @default - create a new one - */ - readonly certificate?: acm.ICertificate; - - /** - * The hosted zone in Route53 to create the CNAME record in - * @default - do not create a CNAME - */ - readonly hostedZone?: route53.IHostedZone; -} - -/** - * Properties for an Amazon OpenSearch Service domain. - */ -export interface DomainProps { - /** - * Domain access policies. - * - * @default - No access policies. - */ - readonly accessPolicies?: iam.PolicyStatement[]; - - /** - * Additional options to specify for the Amazon OpenSearch Service domain. - * - * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options - * @default - no advanced options are specified - */ - readonly advancedOptions?: { [key: string]: (string) }; - - /** - * Configures Amazon OpenSearch Service to use Amazon Cognito authentication for OpenSearch Dashboards. - * - * @default - Cognito not used for authentication to OpenSearch Dashboards. - */ - readonly cognitoDashboardsAuth?: CognitoOptions; - - /** - * Enforces a particular physical domain name. - * - * @default - A name will be auto-generated. - */ - readonly domainName?: string; - - /** - * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that - * are attached to data nodes in the Amazon OpenSearch Service domain. - * - * @default - 10 GiB General Purpose (SSD) volumes per node. - */ - readonly ebs?: EbsOptions; - - /** - * The cluster capacity configuration for the Amazon OpenSearch Service domain. - * - * @default - 1 r5.large.search data node; no dedicated master nodes. - */ - readonly capacity?: CapacityConfig; - - /** - * The cluster zone awareness configuration for the Amazon OpenSearch Service domain. - * - * @default - no zone awareness (1 AZ) - */ - readonly zoneAwareness?: ZoneAwarenessConfig; - - /** - * The Elasticsearch/OpenSearch version that your domain will leverage. - */ - readonly version: EngineVersion; - - /** - * Encryption at rest options for the cluster. - * - * @default - No encryption at rest - */ - readonly encryptionAtRest?: EncryptionAtRestOptions; - - /** - * Configuration log publishing configuration options. - * - * @default - No logs are published - */ - readonly logging?: LoggingOptions; - - /** - * Specify true to enable node to node encryption. - * Requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later. - * - * @default - Node to node encryption is not enabled. - */ - readonly nodeToNodeEncryption?: boolean; - - /** - * The hour in UTC during which the service takes an automated daily snapshot - * of the indices in the Amazon OpenSearch Service domain. Only applies for Elasticsearch versions - * below 5.3. - * - * @default - Hourly automated snapshots not used - */ - readonly automatedSnapshotStartHour?: number; - - /** - * Place the domain inside this VPC. - * - * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html - * @default - Domain is not placed in a VPC. - */ - readonly vpc?: ec2.IVpc; - - /** - * The list of security groups that are associated with the VPC endpoints - * for the domain. - * - * Only used if `vpc` is specified. - * - * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html - * @default - One new security group is created. - */ - readonly securityGroups?: ec2.ISecurityGroup[]; - - /** - * The specific vpc subnets the domain will be placed in. You must provide one subnet for each Availability Zone - * that your domain uses. For example, you must specify three subnet IDs for a three Availability Zone - * domain. - * - * Only used if `vpc` is specified. - * - * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html - * @default - All private subnets. - */ - readonly vpcSubnets?: ec2.SubnetSelection[]; - - /** - * True to require that all traffic to the domain arrive over HTTPS. - * - * @default - false - */ - readonly enforceHttps?: boolean; - - /** - * The minimum TLS version required for traffic to the domain. - * - * @default - TLSSecurityPolicy.TLS_1_0 - */ - readonly tlsSecurityPolicy?: TLSSecurityPolicy; - - /** - * Specifies options for fine-grained access control. - * Requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later. Enabling fine-grained access control - * also requires encryption of data at rest and node-to-node encryption, along with - * enforced HTTPS. - * - * @default - fine-grained access control is disabled - */ - readonly fineGrainedAccessControl?: AdvancedSecurityOptions; - - /** - * Configures the domain so that unsigned basic auth is enabled. If no master user is provided a default master user - * with username `admin` and a dynamically generated password stored in KMS is created. The password can be retrieved - * by getting `masterUserPassword` from the domain instance. - * - * Setting this to true will also add an access policy that allows unsigned - * access, enable node to node encryption, encryption at rest. If conflicting - * settings are encountered (like disabling encryption at rest) enabling this - * setting will cause a failure. - * - * @default - false - */ - readonly useUnsignedBasicAuth?: boolean; - - /** - * To upgrade an Amazon OpenSearch Service domain to a new version, rather than replacing the entire - * domain resource, use the EnableVersionUpgrade update policy. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-upgradeopensearchdomain - * @default - false - */ - readonly enableVersionUpgrade?: boolean; - - /** - * Policy to apply when the domain is removed from the stack - * - * @default RemovalPolicy.RETAIN - */ - readonly removalPolicy?: cdk.RemovalPolicy; - - /** - * To configure a custom domain configure these options - * - * If you specify a Route53 hosted zone it will create a CNAME record and use DNS validation for the certificate - * @default - no custom domain endpoint will be configured - */ - readonly customEndpoint?: CustomEndpointOptions; -} - -/** - * An interface that represents an Amazon OpenSearch Service domain - either created with the CDK, or an existing one. - */ -export interface IDomain extends cdk.IResource { - /** - * Arn of the Amazon OpenSearch Service domain. - * - * @attribute - */ - readonly domainArn: string; - - /** - * Domain name of the Amazon OpenSearch Service domain. - * - * @attribute - */ - readonly domainName: string; - - /** - * Identifier of the Amazon OpenSearch Service domain. - * - * @attribute - */ - readonly domainId: string; - - /** - * Endpoint of the Amazon OpenSearch Service domain. - * - * @attribute - */ - readonly domainEndpoint: string; - - /** - * Grant read permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - */ - grantRead(identity: iam.IGrantable): iam.Grant; - - /** - * Grant write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - */ - grantWrite(identity: iam.IGrantable): iam.Grant; - - /** - * Grant read/write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - */ - grantReadWrite(identity: iam.IGrantable): iam.Grant; - - /** - * Grant read permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - */ - grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - */ - grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant read/write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - */ - grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant read permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - */ - grantPathRead(path: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - */ - grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant; - - /** - * Grant read/write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - */ - grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant; - - /** - * Return the given named metric for this domain. - */ - metric(metricName: string, props?: MetricOptions): Metric; - - /** - * Metric for the time the cluster status is red. - * - * @default maximum over 5 minutes - */ - metricClusterStatusRed(props?: MetricOptions): Metric; - - /** - * Metric for the time the cluster status is yellow. - * - * @default maximum over 5 minutes - */ - metricClusterStatusYellow(props?: MetricOptions): Metric; - - /** - * Metric for the storage space of nodes in the cluster. - * - * @default minimum over 5 minutes - */ - metricFreeStorageSpace(props?: MetricOptions): Metric; - - /** - * Metric for the cluster blocking index writes. - * - * @default maximum over 1 minute - */ - metricClusterIndexWritesBlocked(props?: MetricOptions): Metric; - - /** - * Metric for the number of nodes. - * - * @default minimum over 1 hour - */ - metricNodes(props?: MetricOptions): Metric; - - /** - * Metric for automated snapshot failures. - * - * @default maximum over 5 minutes - */ - metricAutomatedSnapshotFailure(props?: MetricOptions): Metric; - - /** - * Metric for CPU utilization. - * - * @default maximum over 5 minutes - */ - metricCPUUtilization(props?: MetricOptions): Metric; - - /** - * Metric for JVM memory pressure. - * - * @default maximum over 5 minutes - */ - metricJVMMemoryPressure(props?: MetricOptions): Metric; - - /** - * Metric for master CPU utilization. - * - * @default maximum over 5 minutes - */ - metricMasterCPUUtilization(props?: MetricOptions): Metric; - - /** - * Metric for master JVM memory pressure. - * - * @default maximum over 5 minutes - */ - metricMasterJVMMemoryPressure(props?: MetricOptions): Metric; - - /** - * Metric for KMS key errors. - * - * @default maximum over 5 minutes - */ - metricKMSKeyError(props?: MetricOptions): Metric; - - /** - * Metric for KMS key being inaccessible. - * - * @default maximum over 5 minutes - */ - metricKMSKeyInaccessible(props?: MetricOptions): Metric; - - /** - * Metric for number of searchable documents. - * - * @default maximum over 5 minutes - */ - metricSearchableDocuments(props?: MetricOptions): Metric; - - /** - * Metric for search latency. - * - * @default p99 over 5 minutes - */ - metricSearchLatency(props?: MetricOptions): Metric; - - /** - * Metric for indexing latency. - * - * @default p99 over 5 minutes - */ - metricIndexingLatency(props?: MetricOptions): Metric; -} - - -/** - * A new or imported domain. - */ -abstract class DomainBase extends cdk.Resource implements IDomain { - public abstract readonly domainArn: string; - public abstract readonly domainName: string; - public abstract readonly domainId: string; - public abstract readonly domainEndpoint: string; - - /** - * Grant read permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - */ - grantRead(identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_ACTIONS, - this.domainArn, - `${this.domainArn}/*`, - ); - } - - /** - * Grant write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - */ - grantWrite(identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_WRITE_ACTIONS, - this.domainArn, - `${this.domainArn}/*`, - ); - } - - /** - * Grant read/write permissions for this domain and its contents to an IAM - * principal (Role/Group/User). - * - * @param identity The principal - */ - grantReadWrite(identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_WRITE_ACTIONS, - this.domainArn, - `${this.domainArn}/*`, - ); - } - - /** - * Grant read permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - */ - grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_ACTIONS, - `${this.domainArn}/${index}`, - `${this.domainArn}/${index}/*`, - ); - } - - /** - * Grant write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - */ - grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_WRITE_ACTIONS, - `${this.domainArn}/${index}`, - `${this.domainArn}/${index}/*`, - ); - } - - /** - * Grant read/write permissions for an index in this domain to an IAM - * principal (Role/Group/User). - * - * @param index The index to grant permissions for - * @param identity The principal - */ - grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_WRITE_ACTIONS, - `${this.domainArn}/${index}`, - `${this.domainArn}/${index}/*`, - ); - } - - /** - * Grant read permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - */ - grantPathRead(path: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_ACTIONS, - `${this.domainArn}/${path}`, - ); - } - - /** - * Grant write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - */ - grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_WRITE_ACTIONS, - `${this.domainArn}/${path}`, - ); - } - - /** - * Grant read/write permissions for a specific path in this domain to an IAM - * principal (Role/Group/User). - * - * @param path The path to grant permissions for - * @param identity The principal - */ - grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant { - return this.grant( - identity, - perms.ES_READ_WRITE_ACTIONS, - `${this.domainArn}/${path}`, - ); - } - - /** - * Return the given named metric for this domain. - */ - public metric(metricName: string, props?: MetricOptions): Metric { - return new Metric({ - namespace: 'AWS/ES', - metricName, - dimensionsMap: { - DomainName: this.domainName, - ClientId: this.env.account, - }, - ...props, - }).attachTo(this); - } - - /** - * Metric for the time the cluster status is red. - * - * @default maximum over 5 minutes - */ - public metricClusterStatusRed(props?: MetricOptions): Metric { - return this.metric('ClusterStatus.red', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for the time the cluster status is yellow. - * - * @default maximum over 5 minutes - */ - public metricClusterStatusYellow(props?: MetricOptions): Metric { - return this.metric('ClusterStatus.yellow', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for the storage space of nodes in the cluster. - * - * @default minimum over 5 minutes - */ - public metricFreeStorageSpace(props?: MetricOptions): Metric { - return this.metric('FreeStorageSpace', { - statistic: Statistic.MINIMUM, - ...props, - }); - } - - /** - * Metric for the cluster blocking index writes. - * - * @default maximum over 1 minute - */ - public metricClusterIndexWritesBlocked(props?: MetricOptions): Metric { - return this.metric('ClusterIndexWritesBlocked', { - statistic: Statistic.MAXIMUM, - period: cdk.Duration.minutes(1), - ...props, - }); - } - - /** - * Metric for the number of nodes. - * - * @default minimum over 1 hour - */ - public metricNodes(props?: MetricOptions): Metric { - return this.metric('Nodes', { - statistic: Statistic.MINIMUM, - period: cdk.Duration.hours(1), - ...props, - }); - } - - /** - * Metric for automated snapshot failures. - * - * @default maximum over 5 minutes - */ - public metricAutomatedSnapshotFailure(props?: MetricOptions): Metric { - return this.metric('AutomatedSnapshotFailure', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for CPU utilization. - * - * @default maximum over 5 minutes - */ - public metricCPUUtilization(props?: MetricOptions): Metric { - return this.metric('CPUUtilization', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for JVM memory pressure. - * - * @default maximum over 5 minutes - */ - public metricJVMMemoryPressure(props?: MetricOptions): Metric { - return this.metric('JVMMemoryPressure', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for master CPU utilization. - * - * @default maximum over 5 minutes - */ - public metricMasterCPUUtilization(props?: MetricOptions): Metric { - return this.metric('MasterCPUUtilization', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for master JVM memory pressure. - * - * @default maximum over 5 minutes - */ - public metricMasterJVMMemoryPressure(props?: MetricOptions): Metric { - return this.metric('MasterJVMMemoryPressure', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for KMS key errors. - * - * @default maximum over 5 minutes - */ - public metricKMSKeyError(props?: MetricOptions): Metric { - return this.metric('KMSKeyError', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for KMS key being inaccessible. - * - * @default maximum over 5 minutes - */ - public metricKMSKeyInaccessible(props?: MetricOptions): Metric { - return this.metric('KMSKeyInaccessible', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for number of searchable documents. - * - * @default maximum over 5 minutes - */ - public metricSearchableDocuments(props?: MetricOptions): Metric { - return this.metric('SearchableDocuments', { - statistic: Statistic.MAXIMUM, - ...props, - }); - } - - /** - * Metric for search latency. - * - * @default p99 over 5 minutes - */ - public metricSearchLatency(props?: MetricOptions): Metric { - return this.metric('SearchLatency', { statistic: 'p99', ...props }); - } - - /** - * Metric for indexing latency. - * - * @default p99 over 5 minutes - */ - public metricIndexingLatency(props?: MetricOptions): Metric { - return this.metric('IndexingLatency', { statistic: 'p99', ...props }); - } - - private grant( - grantee: iam.IGrantable, - domainActions: string[], - resourceArn: string, - ...otherResourceArns: string[] - ): iam.Grant { - const resourceArns = [resourceArn, ...otherResourceArns]; - - const grant = iam.Grant.addToPrincipal({ - grantee, - actions: domainActions, - resourceArns, - scope: this, - }); - - return grant; - } - -} - - -/** - * Reference to an Amazon OpenSearch Service domain. - */ -export interface DomainAttributes { - /** - * The ARN of the Amazon OpenSearch Service domain. - */ - readonly domainArn: string; - - /** - * The domain endpoint of the Amazon OpenSearch Service domain. - */ - readonly domainEndpoint: string; -} - - -/** - * Provides an Amazon OpenSearch Service domain. - */ -export class Domain extends DomainBase implements IDomain, ec2.IConnectable { - /** - * Creates a domain construct that represents an external domain via domain endpoint. - * - * @param scope The parent creating construct (usually `this`). - * @param id The construct's name. - * @param domainEndpoint The domain's endpoint. - */ - public static fromDomainEndpoint( - scope: Construct, - id: string, - domainEndpoint: string, - ): IDomain { - const stack = cdk.Stack.of(scope); - const domainName = extractNameFromEndpoint(domainEndpoint); - const domainArn = stack.formatArn({ - service: 'es', - resource: 'domain', - resourceName: domainName, - }); - - return Domain.fromDomainAttributes(scope, id, { - domainArn, - domainEndpoint, - }); - } - - /** - * Creates a domain construct that represents an external domain. - * - * @param scope The parent creating construct (usually `this`). - * @param id The construct's name. - * @param attrs A `DomainAttributes` object. - */ - public static fromDomainAttributes(scope: Construct, id: string, attrs: DomainAttributes): IDomain { - const { domainArn, domainEndpoint } = attrs; - const domainName = cdk.Stack.of(scope).splitArn(domainArn, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName - ?? extractNameFromEndpoint(domainEndpoint); - - return new class extends DomainBase { - public readonly domainArn = domainArn; - public readonly domainName = domainName; - public readonly domainId = domainName; - public readonly domainEndpoint = domainEndpoint.replace(/^https?:\/\//, ''); - - constructor() { super(scope, id); } - }; - } - - public readonly domainArn: string; - public readonly domainName: string; - public readonly domainId: string; - public readonly domainEndpoint: string; - - /** - * Log group that slow searches are logged to. - * - * @attribute - */ - public readonly slowSearchLogGroup?: logs.ILogGroup; - - /** - * Log group that slow indices are logged to. - * - * @attribute - */ - public readonly slowIndexLogGroup?: logs.ILogGroup; - - /** - * Log group that application logs are logged to. - * - * @attribute - */ - public readonly appLogGroup?: logs.ILogGroup; - - /** - * Log group that audit logs are logged to. - * - * @attribute - */ - public readonly auditLogGroup?: logs.ILogGroup; - - /** - * Master user password if fine grained access control is configured. - */ - public readonly masterUserPassword?: cdk.SecretValue; - - - private readonly domain: CfnDomain; - - private accessPolicy?: OpenSearchAccessPolicy - - private encryptionAtRestOptions?: EncryptionAtRestOptions - - private readonly _connections: ec2.Connections | undefined; - - constructor(scope: Construct, id: string, props: DomainProps) { - super(scope, id, { - physicalName: props.domainName, - }); - - const defaultInstanceType = 'r5.large.search'; - const warmDefaultInstanceType = 'ultrawarm1.medium.search'; - - const dedicatedMasterType = initializeInstanceType(defaultInstanceType, props.capacity?.masterNodeInstanceType); - const dedicatedMasterCount = props.capacity?.masterNodes ?? 0; - const dedicatedMasterEnabled = cdk.Token.isUnresolved(dedicatedMasterCount) ? true : dedicatedMasterCount > 0; - - const instanceType = initializeInstanceType(defaultInstanceType, props.capacity?.dataNodeInstanceType); - const instanceCount = props.capacity?.dataNodes ?? 1; - - const warmType = initializeInstanceType(warmDefaultInstanceType, props.capacity?.warmInstanceType); - const warmCount = props.capacity?.warmNodes ?? 0; - const warmEnabled = cdk.Token.isUnresolved(warmCount) ? true : warmCount > 0; - - const availabilityZoneCount = - props.zoneAwareness?.availabilityZoneCount ?? 2; - - if (![2, 3].includes(availabilityZoneCount)) { - throw new Error('Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3'); - } - - const zoneAwarenessEnabled = - props.zoneAwareness?.enabled ?? - props.zoneAwareness?.availabilityZoneCount != null; - - - let securityGroups: ec2.ISecurityGroup[] | undefined; - let subnets: ec2.ISubnet[] | undefined; - - let skipZoneAwarenessCheck: boolean = false; - if (props.vpc) { - const subnetSelections = props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]; - subnets = selectSubnets(props.vpc, subnetSelections); - skipZoneAwarenessCheck = zoneAwarenessCheckShouldBeSkipped(props.vpc, subnetSelections); - securityGroups = props.securityGroups ?? [new ec2.SecurityGroup(this, 'SecurityGroup', { - vpc: props.vpc, - description: `Security group for domain ${this.node.id}`, - })]; - if (props.enforceHttps) { - this._connections = new ec2.Connections({ securityGroups, defaultPort: ec2.Port.tcp(443) }); - } else { - this._connections = new ec2.Connections({ securityGroups }); - } - } - - // If VPC options are supplied ensure that the number of subnets matches the number AZ (only if the vpc is not imported from another stack) - if (subnets && - zoneAwarenessEnabled && - !skipZoneAwarenessCheck && - new Set(subnets.map((subnet) => subnet.availabilityZone)).size < availabilityZoneCount - ) { - throw new Error('When providing vpc options you need to provide a subnet for each AZ you are using'); - } - - if ([dedicatedMasterType, instanceType, warmType].some(t => (!cdk.Token.isUnresolved(t) && !t.endsWith('.search')))) { - throw new Error('Master, data and UltraWarm node instance types must end with ".search".'); - } - - if (!cdk.Token.isUnresolved(warmType) && !warmType.startsWith('ultrawarm')) { - throw new Error('UltraWarm node instance type must start with "ultrawarm".'); - } - - const unsignedBasicAuthEnabled = props.useUnsignedBasicAuth ?? false; - - if (unsignedBasicAuthEnabled) { - if (props.enforceHttps == false) { - throw new Error('You cannot disable HTTPS and use unsigned basic auth'); - } - if (props.nodeToNodeEncryption == false) { - throw new Error('You cannot disable node to node encryption and use unsigned basic auth'); - } - if (props.encryptionAtRest?.enabled == false) { - throw new Error('You cannot disable encryption at rest and use unsigned basic auth'); - } - } - - const unsignedAccessPolicy = new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['es:ESHttp*'], - principals: [new iam.AnyPrincipal()], - resources: [cdk.Lazy.string({ produce: () => `${this.domainArn}/*` })], - }); - - const masterUserArn = props.fineGrainedAccessControl?.masterUserArn; - const masterUserNameProps = props.fineGrainedAccessControl?.masterUserName; - // If basic auth is enabled set the user name to admin if no other user info is supplied. - const masterUserName = unsignedBasicAuthEnabled - ? (masterUserArn == null ? (masterUserNameProps ?? 'admin') : undefined) - : masterUserNameProps; - - if (masterUserArn != null && masterUserName != null) { - throw new Error('Invalid fine grained access control settings. Only provide one of master user ARN or master user name. Not both.'); - } - - const advancedSecurityEnabled = (masterUserArn ?? masterUserName) != null; - const internalUserDatabaseEnabled = masterUserName != null; - const masterUserPasswordProp = props.fineGrainedAccessControl?.masterUserPassword; - const createMasterUserPassword = (): cdk.SecretValue => { - return new secretsmanager.Secret(this, 'MasterUser', { - generateSecretString: { - secretStringTemplate: JSON.stringify({ - username: masterUserName, - }), - generateStringKey: 'password', - excludeCharacters: "{}'\\*[]()`", - }, - }) - .secretValueFromJson('password'); - }; - this.masterUserPassword = internalUserDatabaseEnabled ? - (masterUserPasswordProp ?? createMasterUserPassword()) - : undefined; - - const encryptionAtRestEnabled = - props.encryptionAtRest?.enabled ?? (props.encryptionAtRest?.kmsKey != null || unsignedBasicAuthEnabled); - const nodeToNodeEncryptionEnabled = props.nodeToNodeEncryption ?? unsignedBasicAuthEnabled; - const volumeSize = props.ebs?.volumeSize ?? 10; - const volumeType = props.ebs?.volumeType ?? ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD; - const ebsEnabled = props.ebs?.enabled ?? true; - const enforceHttps = props.enforceHttps ?? unsignedBasicAuthEnabled; - - function isInstanceType(t: string): Boolean { - return dedicatedMasterType.startsWith(t) || instanceType.startsWith(t); - }; - - function isSomeInstanceType(...instanceTypes: string[]): Boolean { - return instanceTypes.some(isInstanceType); - }; - - function isEveryDatanodeInstanceType(...instanceTypes: string[]): Boolean { - return instanceTypes.some(t => instanceType.startsWith(t)); - }; - - // Validate feature support for the given Elasticsearch/OpenSearch version, per - // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/features-by-version.html - const { versionNum: versionNum, isElasticsearchVersion } = parseVersion(props.version); - if (isElasticsearchVersion) { - - if ( - versionNum <= 7.7 && - ![ - 1.5, 2.3, 5.1, 5.3, 5.5, 5.6, 6.0, - 6.2, 6.3, 6.4, 6.5, 6.7, 6.8, 7.1, 7.4, - 7.7, - ].includes(versionNum) - ) { - throw new Error(`Unknown Elasticsearch version: ${versionNum}`); - } - - if (versionNum < 5.1) { - if (props.logging?.appLogEnabled) { - throw new Error('Error logs publishing requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); - } - if (props.encryptionAtRest?.enabled) { - throw new Error('Encryption of data at rest requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); - } - if (props.cognitoDashboardsAuth != null) { - throw new Error('Cognito authentication for OpenSearch Dashboards requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); - } - if (isSomeInstanceType('c5', 'i3', 'm5', 'r5')) { - throw new Error('C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); - } - } - - if (versionNum < 6.0) { - if (props.nodeToNodeEncryption) { - throw new Error('Node-to-node encryption requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later.'); - } - } - - if (versionNum < 6.7) { - if (unsignedBasicAuthEnabled) { - throw new Error('Using unsigned basic auth requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later.'); - } - if (advancedSecurityEnabled) { - throw new Error('Fine-grained access control requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later.'); - } - } - - if (versionNum < 6.8 && warmEnabled) { - throw new Error('UltraWarm requires Elasticsearch version 6.8 or later or OpenSearch version 1.0 or later.'); - } - } - - // Validate against instance type restrictions, per - // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html - if (isSomeInstanceType('i3', 'r6gd') && ebsEnabled) { - throw new Error('I3 and R6GD instance types do not support EBS storage volumes.'); - } - - if (isSomeInstanceType('m3', 'r3', 't2') && encryptionAtRestEnabled) { - throw new Error('M3, R3, and T2 instance types do not support encryption of data at rest.'); - } - - if (isInstanceType('t2.micro') && !(isElasticsearchVersion && versionNum <= 2.3)) { - throw new Error('The t2.micro.search instance type supports only Elasticsearch versions 1.5 and 2.3.'); - } - - if (isSomeInstanceType('t2', 't3') && warmEnabled) { - throw new Error('T2 and T3 instance types do not support UltraWarm storage.'); - } - - // Only R3, I3 and r6gd support instance storage, per - // https://aws.amazon.com/opensearch-service/pricing/ - if (!ebsEnabled && !isEveryDatanodeInstanceType('r3', 'i3', 'r6gd')) { - throw new Error('EBS volumes are required when using instance types other than r3, i3 or r6gd.'); - } - - // Fine-grained access control requires node-to-node encryption, encryption at rest, - // and enforced HTTPS. - if (advancedSecurityEnabled) { - if (!nodeToNodeEncryptionEnabled) { - throw new Error('Node-to-node encryption is required when fine-grained access control is enabled.'); - } - if (!encryptionAtRestEnabled) { - throw new Error('Encryption-at-rest is required when fine-grained access control is enabled.'); - } - if (!enforceHttps) { - throw new Error('Enforce HTTPS is required when fine-grained access control is enabled.'); - } - } - - // Validate fine grained access control enabled for audit logs, per - // https://aws.amazon.com/about-aws/whats-new/2020/09/elasticsearch-audit-logs-now-available-on-amazon-elasticsearch-service/ - if (props.logging?.auditLogEnabled && !advancedSecurityEnabled) { - throw new Error('Fine-grained access control is required when audit logs publishing is enabled.'); - } - - // Validate UltraWarm requirement for dedicated master nodes, per - // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ultrawarm.html - if (warmEnabled && !dedicatedMasterEnabled) { - throw new Error('Dedicated master node is required when UltraWarm storage is enabled.'); - } - - let cfnVpcOptions: CfnDomain.VPCOptionsProperty | undefined; - - if (securityGroups && subnets) { - cfnVpcOptions = { - securityGroupIds: securityGroups.map((sg) => sg.securityGroupId), - subnetIds: subnets.map((subnet) => subnet.subnetId), - }; - } - - // Setup logging - const logGroups: logs.ILogGroup[] = []; - - if (props.logging?.slowSearchLogEnabled) { - this.slowSearchLogGroup = props.logging.slowSearchLogGroup ?? - new logs.LogGroup(this, 'SlowSearchLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.slowSearchLogGroup); - }; - - if (props.logging?.slowIndexLogEnabled) { - this.slowIndexLogGroup = props.logging.slowIndexLogGroup ?? - new logs.LogGroup(this, 'SlowIndexLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.slowIndexLogGroup); - }; - - if (props.logging?.appLogEnabled) { - this.appLogGroup = props.logging.appLogGroup ?? - new logs.LogGroup(this, 'AppLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.appLogGroup); - }; - - if (props.logging?.auditLogEnabled) { - this.auditLogGroup = props.logging.auditLogGroup ?? - new logs.LogGroup(this, 'AuditLogs', { - retention: logs.RetentionDays.ONE_MONTH, - }); - - logGroups.push(this.auditLogGroup); - }; - - let logGroupResourcePolicy: LogGroupResourcePolicy | null = null; - if (logGroups.length > 0) { - const logPolicyStatement = new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], - resources: logGroups.map((lg) => lg.logGroupArn), - principals: [new iam.ServicePrincipal('es.amazonaws.com')], - }); - - // Use a custom resource to set the log group resource policy since it is not supported by CDK and cfn. - // https://github.com/aws/aws-cdk/issues/5343 - logGroupResourcePolicy = new LogGroupResourcePolicy(this, `ESLogGroupPolicy${this.node.addr}`, { - // create a cloudwatch logs resource policy name that is unique to this domain instance - policyName: `ESLogPolicy${this.node.addr}`, - policyStatements: [logPolicyStatement], - }); - } - - const logPublishing: Record = {}; - - if (this.appLogGroup) { - logPublishing.ES_APPLICATION_LOGS = { - enabled: true, - cloudWatchLogsLogGroupArn: this.appLogGroup.logGroupArn, - }; - } - - if (this.slowSearchLogGroup) { - logPublishing.SEARCH_SLOW_LOGS = { - enabled: true, - cloudWatchLogsLogGroupArn: this.slowSearchLogGroup.logGroupArn, - }; - } - - if (this.slowIndexLogGroup) { - logPublishing.INDEX_SLOW_LOGS = { - enabled: true, - cloudWatchLogsLogGroupArn: this.slowIndexLogGroup.logGroupArn, - }; - } - - if (this.auditLogGroup) { - logPublishing.AUDIT_LOGS = { - enabled: this.auditLogGroup != null, - cloudWatchLogsLogGroupArn: this.auditLogGroup?.logGroupArn, - }; - } - - let customEndpointCertificate: acm.ICertificate | undefined; - if (props.customEndpoint) { - if (props.customEndpoint.certificate) { - customEndpointCertificate = props.customEndpoint.certificate; - } else { - customEndpointCertificate = new acm.Certificate(this, 'CustomEndpointCertificate', { - domainName: props.customEndpoint.domainName, - validation: props.customEndpoint.hostedZone ? acm.CertificateValidation.fromDns(props.customEndpoint.hostedZone) : undefined, - }); - } - } - - // Create the domain - this.domain = new CfnDomain(this, 'Resource', { - domainName: this.physicalName, - engineVersion: props.version.version, - clusterConfig: { - dedicatedMasterEnabled, - dedicatedMasterCount: dedicatedMasterEnabled - ? dedicatedMasterCount - : undefined, - dedicatedMasterType: dedicatedMasterEnabled - ? dedicatedMasterType - : undefined, - instanceCount, - instanceType, - warmEnabled: warmEnabled - ? warmEnabled - : undefined, - warmCount: warmEnabled - ? warmCount - : undefined, - warmType: warmEnabled - ? warmType - : undefined, - zoneAwarenessEnabled, - zoneAwarenessConfig: zoneAwarenessEnabled - ? { availabilityZoneCount } - : undefined, - }, - ebsOptions: { - ebsEnabled, - volumeSize: ebsEnabled ? volumeSize : undefined, - volumeType: ebsEnabled ? volumeType : undefined, - iops: ebsEnabled ? props.ebs?.iops : undefined, - }, - encryptionAtRestOptions: { - enabled: encryptionAtRestEnabled, - kmsKeyId: encryptionAtRestEnabled - ? props.encryptionAtRest?.kmsKey?.keyId - : undefined, - }, - nodeToNodeEncryptionOptions: { enabled: nodeToNodeEncryptionEnabled }, - logPublishingOptions: logPublishing, - cognitoOptions: props.cognitoDashboardsAuth ? { - enabled: true, - identityPoolId: props.cognitoDashboardsAuth?.identityPoolId, - roleArn: props.cognitoDashboardsAuth?.role.roleArn, - userPoolId: props.cognitoDashboardsAuth?.userPoolId, - }: undefined, - vpcOptions: cfnVpcOptions, - snapshotOptions: props.automatedSnapshotStartHour - ? { automatedSnapshotStartHour: props.automatedSnapshotStartHour } - : undefined, - domainEndpointOptions: { - enforceHttps, - tlsSecurityPolicy: props.tlsSecurityPolicy ?? TLSSecurityPolicy.TLS_1_0, - ...props.customEndpoint && { - customEndpointEnabled: true, - customEndpoint: props.customEndpoint.domainName, - customEndpointCertificateArn: customEndpointCertificate!.certificateArn, - }, - }, - advancedSecurityOptions: advancedSecurityEnabled - ? { - enabled: true, - internalUserDatabaseEnabled, - masterUserOptions: { - masterUserArn: masterUserArn, - masterUserName: masterUserName, - masterUserPassword: this.masterUserPassword?.unsafeUnwrap(), // Safe usage - }, - } - : undefined, - advancedOptions: props.advancedOptions, - }); - this.domain.applyRemovalPolicy(props.removalPolicy); - - if (props.enableVersionUpgrade) { - this.domain.cfnOptions.updatePolicy = { - ...this.domain.cfnOptions.updatePolicy, - enableVersionUpgrade: props.enableVersionUpgrade, - }; - } - - if (logGroupResourcePolicy) { this.domain.node.addDependency(logGroupResourcePolicy); } - - if (props.domainName) { - if (!cdk.Token.isUnresolved(props.domainName)) { - // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/configuration-api.html#configuration-api-datatypes-domainname - if (!props.domainName.match(/^[a-z0-9\-]+$/)) { - throw new Error(`Invalid domainName '${props.domainName}'. Valid characters are a-z (lowercase only), 0-9, and – (hyphen).`); - } - if (props.domainName.length < 3 || props.domainName.length > 28) { - throw new Error(`Invalid domainName '${props.domainName}'. It must be between 3 and 28 characters`); - } - if (props.domainName[0] < 'a' || props.domainName[0] > 'z') { - throw new Error(`Invalid domainName '${props.domainName}'. It must start with a lowercase letter`); - } - } - this.node.addMetadata('aws:cdk:hasPhysicalName', props.domainName); - } - - this.domainName = this.getResourceNameAttribute(this.domain.ref); - - this.domainId = this.domain.getAtt('Id').toString(); - - this.domainEndpoint = this.domain.getAtt('DomainEndpoint').toString(); - - this.domainArn = this.getResourceArnAttribute(this.domain.attrArn, { - service: 'es', - resource: 'domain', - resourceName: this.physicalName, - }); - - if (props.customEndpoint?.hostedZone) { - new route53.CnameRecord(this, 'CnameRecord', { - recordName: props.customEndpoint.domainName, - zone: props.customEndpoint.hostedZone, - domainName: this.domainEndpoint, - }); - } - - this.encryptionAtRestOptions = props.encryptionAtRest; - if (props.accessPolicies) { - this.addAccessPolicies(...props.accessPolicies); - } - if (unsignedBasicAuthEnabled) { - this.addAccessPolicies(unsignedAccessPolicy); - } - } - - /** - * Manages network connections to the domain. This will throw an error in case the domain - * is not placed inside a VPC. - */ - public get connections(): ec2.Connections { - if (!this._connections) { - throw new Error("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); - } - return this._connections; - } - - - /** - * Add policy statements to the domain access policy - */ - public addAccessPolicies(...accessPolicyStatements: iam.PolicyStatement[]) { - if (accessPolicyStatements.length > 0) { - if (!this.accessPolicy) { - // Only create the custom resource after there are statements to set. - this.accessPolicy = new OpenSearchAccessPolicy(this, 'AccessPolicy', { - domainName: this.domainName, - domainArn: this.domainArn, - accessPolicies: accessPolicyStatements, - }); - - if (this.encryptionAtRestOptions?.kmsKey) { - // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/encryption-at-rest.html - - // these permissions are documented as required during domain creation. - // while not strictly documented for updates as well, it stands to reason that an update - // operation might require these in case the cluster uses a kms key. - // empircal evidence shows this is indeed required: https://github.com/aws/aws-cdk/issues/11412 - this.accessPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: ['kms:List*', 'kms:Describe*', 'kms:CreateGrant'], - resources: [this.encryptionAtRestOptions.kmsKey.keyArn], - effect: iam.Effect.ALLOW, - })); - } - } else { - this.accessPolicy.addAccessPolicies(...accessPolicyStatements); - } - } - } -} - -/** - * Given an Amazon OpenSearch Service domain endpoint, returns a CloudFormation expression that - * extracts the domain name. - * - * Domain endpoints look like this: - * - * https://example-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com - * https://-..es.amazonaws.com - * - * ..which means that in order to extract the domain name from the endpoint, we can - * split the endpoint using "-" and select the component in index 0. - * - * @param domainEndpoint The Amazon OpenSearch Service domain endpoint - */ -function extractNameFromEndpoint(domainEndpoint: string) { - const { hostname } = new URL(domainEndpoint); - const domain = hostname.split('.')[0]; - const suffix = '-' + domain.split('-').slice(-1)[0]; - return domain.split(suffix)[0]; -} - -/** - * Converts an engine version into a into a decimal number with major and minor version i.e x.y. - * - * @param version The engine version object - */ -function parseVersion(version: EngineVersion): { versionNum: number, isElasticsearchVersion: boolean } { - const elasticsearchPrefix = 'Elasticsearch_'; - const openSearchPrefix = 'OpenSearch_'; - const isElasticsearchVersion = version.version.startsWith(elasticsearchPrefix); - const versionStr = isElasticsearchVersion - ? version.version.substring(elasticsearchPrefix.length) - : version.version.substring(openSearchPrefix.length); - const firstDot = versionStr.indexOf('.'); - - if (firstDot < 1) { - throw new Error(`Invalid engine version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); - } - - const secondDot = versionStr.indexOf('.', firstDot + 1); - - try { - if (secondDot == -1) { - return { versionNum: parseFloat(versionStr), isElasticsearchVersion }; - } else { - return { versionNum: parseFloat(versionStr.substring(0, secondDot)), isElasticsearchVersion }; - } - } catch { - throw new Error(`Invalid engine version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); - } -} - -function selectSubnets(vpc: ec2.IVpc, vpcSubnets: ec2.SubnetSelection[]): ec2.ISubnet[] { - const selected = []; - for (const selection of vpcSubnets) { - selected.push(...vpc.selectSubnets(selection).subnets); - } - return selected; -} - -/** - * Check if any of the subnets are pending lookups. If so, the zone awareness check should be skipped, otherwise it will always throw an error - * - * @param vpc The vpc to which the subnets apply - * @param vpcSubnets The vpc subnets that should be checked - * @returns true if there are pending lookups for the subnets - */ -function zoneAwarenessCheckShouldBeSkipped(vpc: ec2.IVpc, vpcSubnets: ec2.SubnetSelection[]): boolean { - for (const selection of vpcSubnets) { - if (vpc.selectSubnets(selection).isPendingLookup) { - return true; - }; - } - return false; -} - -/** - * Initializes an instance type. - * - * @param defaultInstanceType Default instance type which is used if no instance type is provided - * @param instanceType Instance type - * @returns Instance type in lowercase (if provided) or default instance type - */ -function initializeInstanceType(defaultInstanceType: string, instanceType?: string): string { - if (instanceType) { - return cdk.Token.isUnresolved(instanceType) ? instanceType : instanceType.toLowerCase(); - } else { - return defaultInstanceType; - } -} diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/log-group-resource-policy.ts b/packages/@aws-cdk/aws-opensearchservice/lib/log-group-resource-policy.ts deleted file mode 100644 index 0fd9c98464335..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/lib/log-group-resource-policy.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cr from '@aws-cdk/custom-resources'; -import { Construct } from 'constructs'; - -/** - * Construction properties for LogGroupResourcePolicy - */ -export interface LogGroupResourcePolicyProps { - /** - * The log group resource policy name - */ - readonly policyName: string; - /** - * The policy statements for the log group resource logs - */ - readonly policyStatements: [iam.PolicyStatement]; -} - -/** - * Creates LogGroup resource policies. - */ -export class LogGroupResourcePolicy extends cr.AwsCustomResource { - constructor(scope: Construct, id: string, props: LogGroupResourcePolicyProps) { - const policyDocument = new iam.PolicyDocument({ - statements: props.policyStatements, - }); - - super(scope, id, { - resourceType: 'Custom::CloudwatchLogResourcePolicy', - onUpdate: { - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: props.policyName, - policyDocument: JSON.stringify(policyDocument), - }, - physicalResourceId: cr.PhysicalResourceId.of(id), - }, - onDelete: { - service: 'CloudWatchLogs', - action: 'deleteResourcePolicy', - parameters: { - policyName: props.policyName, - }, - ignoreErrorCodesMatching: 'ResourceNotFoundException', - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: ['*'] }), - }); - } -} diff --git a/packages/@aws-cdk/aws-opensearchservice/package.json b/packages/@aws-cdk/aws-opensearchservice/package.json deleted file mode 100644 index dd84092858001..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/package.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "name": "@aws-cdk/aws-opensearchservice", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::OpenSearchService", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.OpenSearchService", - "packageId": "Amazon.CDK.AWS.OpenSearchService", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.opensearchservice", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "opensearchservice" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-opensearchservice", - "module": "aws_cdk.aws_opensearchservice" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-opensearchservice" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::OpenSearchService", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::OpenSearchService", - "aws-opensearchservice", - "opensearchservice" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@types/jest": "^27.5.2", - "jest-each": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "features": [ - { - "name": "Higher level constructs for Domain", - "stability": "Stable" - } - ], - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture deleted file mode 100644 index 0bf08b6ca9abd..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { RemovalPolicy, Stack, Fn } from '@aws-cdk/core'; -import { Domain, DomainProps, EngineVersion } from '@aws-cdk/aws-opensearchservice'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts b/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts deleted file mode 100644 index 76ee62713c58c..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/test/domain.test.ts +++ /dev/null @@ -1,2024 +0,0 @@ -/* eslint-disable jest/expect-expect */ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Metric, Statistic } from '@aws-cdk/aws-cloudwatch'; -import { Vpc, EbsDeviceVolumeType, Port, SecurityGroup, SubnetType } from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as route53 from '@aws-cdk/aws-route53'; -import { App, Stack, Duration, SecretValue, CfnParameter, Token } from '@aws-cdk/core'; -import each from 'jest-each'; -import { Domain, EngineVersion } from '../lib'; - -let app: App; -let stack: Stack; - -beforeEach(() => { - app = new App(); - stack = new Stack(app, 'Stack', { - env: { account: '1234', region: 'testregion' }, - }); - - jest.resetAllMocks(); -}); - -const readActions = ['ESHttpGet', 'ESHttpHead']; -const writeActions = ['ESHttpDelete', 'ESHttpPost', 'ESHttpPut', 'ESHttpPatch']; -const readWriteActions = [ - ...readActions, - ...writeActions, -]; - -const testedOpenSearchVersions = [ - EngineVersion.OPENSEARCH_1_0, - EngineVersion.OPENSEARCH_1_1, - EngineVersion.OPENSEARCH_1_2, - EngineVersion.OPENSEARCH_1_3, - EngineVersion.OPENSEARCH_2_3, -]; - -each(testedOpenSearchVersions).test('connections throws if domain is not placed inside a vpc', (engineVersion) => { - - expect(() => { - new Domain(stack, 'Domain', { - version: engineVersion, - }).connections; - }).toThrowError("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); -}); - -each(testedOpenSearchVersions).test('subnets and security groups can be provided when vpc is used', (engineVersion) => { - - const vpc = new Vpc(stack, 'Vpc'); - const securityGroup = new SecurityGroup(stack, 'CustomSecurityGroup', { - vpc, - }); - const domain = new Domain(stack, 'Domain', { - version: engineVersion, - vpc, - vpcSubnets: [{ subnets: [vpc.privateSubnets[0]] }], - securityGroups: [securityGroup], - }); - - expect(domain.connections.securityGroups[0].securityGroupId).toEqual(securityGroup.securityGroupId); - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - VPCOptions: { - SecurityGroupIds: [ - { - 'Fn::GetAtt': [ - 'CustomSecurityGroupE5E500E5', - 'GroupId', - ], - }, - ], - SubnetIds: [ - { - Ref: 'VpcPrivateSubnet1Subnet536B997A', - }, - ], - }, - }); - -}); - -each(testedOpenSearchVersions).test('default subnets and security group when vpc is used', (engineVersion) => { - - const vpc = new Vpc(stack, 'Vpc'); - const domain = new Domain(stack, 'Domain', { - version: engineVersion, - vpc, - }); - - expect(stack.resolve(domain.connections.securityGroups[0].securityGroupId)).toEqual({ 'Fn::GetAtt': ['DomainSecurityGroup48AA5FD6', 'GroupId'] }); - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - VPCOptions: { - SecurityGroupIds: [ - { - 'Fn::GetAtt': [ - 'DomainSecurityGroup48AA5FD6', - 'GroupId', - ], - }, - ], - SubnetIds: [ - { - Ref: 'VpcPrivateSubnet1Subnet536B997A', - }, - { - Ref: 'VpcPrivateSubnet2Subnet3788AAA1', - }, - { - Ref: 'VpcPrivateSubnet3SubnetF258B56E', - }, - ], - }, - }); - -}); - -each(testedOpenSearchVersions).test('connections has no default port if enforceHttps is false', (engineVersion) => { - - const vpc = new Vpc(stack, 'Vpc'); - const domain = new Domain(stack, 'Domain', { - version: engineVersion, - vpc, - enforceHttps: false, - }); - - expect(domain.connections.defaultPort).toBeUndefined(); - -}); - -each(testedOpenSearchVersions).test('connections has default port 443 if enforceHttps is true', (engineVersion) => { - - const vpc = new Vpc(stack, 'Vpc'); - const domain = new Domain(stack, 'Domain', { - version: engineVersion, - vpc, - enforceHttps: true, - }); - - expect(domain.connections.defaultPort).toEqual(Port.tcp(443)); - -}); - -each(testedOpenSearchVersions).test('default removalpolicy is retain', (engineVersion) => { - new Domain(stack, 'Domain', { - version: engineVersion, - }); - - Template.fromStack(stack).hasResource('AWS::OpenSearchService::Domain', { - DeletionPolicy: 'Retain', - }); -}); - -each([testedOpenSearchVersions]).test('grants kms permissions if needed', (engineVersion) => { - - const key = new kms.Key(stack, 'Key'); - - new Domain(stack, 'Domain', { - version: engineVersion, - encryptionAtRest: { - kmsKey: key, - }, - // so that the access policy custom resource will be used. - useUnsignedBasicAuth: true, - }); - - const expectedPolicy = { - Statement: [ - { - Action: [ - 'kms:List*', - 'kms:Describe*', - 'kms:CreateGrant', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - }, - ], - Version: '2012-10-17', - }; - - const resources = Template.fromStack(stack).toJSON().Resources; - expect(resources.AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E.Properties.PolicyDocument).toStrictEqual(expectedPolicy); - -}); - -each([ - [EngineVersion.OPENSEARCH_1_0, 'OpenSearch_1.0'], - [EngineVersion.OPENSEARCH_1_1, 'OpenSearch_1.1'], - [EngineVersion.OPENSEARCH_1_2, 'OpenSearch_1.2'], - [EngineVersion.OPENSEARCH_1_3, 'OpenSearch_1.3'], - [EngineVersion.OPENSEARCH_2_3, 'OpenSearch_2.3'], -]).test('minimal example renders correctly', (engineVersion, expectedCfVersion) => { - new Domain(stack, 'Domain', { version: engineVersion }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - EBSOptions: { - EBSEnabled: true, - VolumeSize: 10, - VolumeType: 'gp2', - }, - ClusterConfig: { - DedicatedMasterEnabled: false, - InstanceCount: 1, - InstanceType: 'r5.large.search', - ZoneAwarenessEnabled: false, - }, - EngineVersion: expectedCfVersion, - EncryptionAtRestOptions: { - Enabled: false, - }, - LogPublishingOptions: { - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - NodeToNodeEncryptionOptions: { - Enabled: false, - }, - }); -}); - -each([testedOpenSearchVersions]).test('can enable version upgrade update policy', (engineVersion) => { - new Domain(stack, 'Domain', { - version: engineVersion, - enableVersionUpgrade: true, - }); - - Template.fromStack(stack).hasResource('AWS::OpenSearchService::Domain', { - UpdatePolicy: { - EnableVersionUpgrade: true, - }, - }); -}); - -each([testedOpenSearchVersions]).test('can set a self-referencing custom policy', (engineVersion) => { - const domain = new Domain(stack, 'Domain', { - version: engineVersion, - }); - - domain.addAccessPolicies( - new iam.PolicyStatement({ - actions: ['es:ESHttpPost', 'es:ESHttpPut'], - effect: iam.Effect.ALLOW, - principals: [new iam.AccountPrincipal('5678')], - resources: [domain.domainArn, `${domain.domainArn}/*`], - }), - ); - - const expectedPolicy = { - 'Fn::Join': [ - '', - [ - '{"action":"updateDomainConfig","service":"OpenSearch","parameters":{"DomainName":"', - { - Ref: 'Domain66AC69E0', - }, - '","AccessPolicies":"{\\"Statement\\":[{\\"Action\\":[\\"es:ESHttpPost\\",\\"es:ESHttpPut\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"AWS\\":\\"arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::5678:root\\"},\\"Resource\\":[\\"', - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'Arn', - ], - }, - '\\",\\"', - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'Arn', - ], - }, - '/*\\"]}],\\"Version\\":\\"2012-10-17\\"}"},"outputPaths":["DomainConfig.AccessPolicies"],"physicalResourceId":{"id":"', - { - Ref: 'Domain66AC69E0', - }, - 'AccessPolicy"}}', - ], - ], - }; - Template.fromStack(stack).hasResourceProperties('Custom::OpenSearchAccessPolicy', { - ServiceToken: { - 'Fn::GetAtt': [ - 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', - 'Arn', - ], - }, - Create: expectedPolicy, - Update: expectedPolicy, - }); -}); - -each([testedOpenSearchVersions]).describe('UltraWarm instances', (engineVersion) => { - - test('can enable UltraWarm instances', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - capacity: { - masterNodes: 2, - warmNodes: 2, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - ClusterConfig: { - DedicatedMasterEnabled: true, - WarmEnabled: true, - WarmCount: 2, - WarmType: 'ultrawarm1.medium.search', - }, - }); - }); - - test('can enable UltraWarm instances with specific instance type', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - capacity: { - masterNodes: 2, - warmNodes: 2, - warmInstanceType: 'ultrawarm1.large.search', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - ClusterConfig: { - DedicatedMasterEnabled: true, - WarmEnabled: true, - WarmCount: 2, - WarmType: 'ultrawarm1.large.search', - }, - }); - }); - -}); - -each([testedOpenSearchVersions]).test('can use tokens in capacity configuration', (engineVersion) => { - new Domain(stack, 'Domain', { - version: engineVersion, - capacity: { - dataNodeInstanceType: Token.asString({ Ref: 'dataNodeInstanceType' }), - dataNodes: Token.asNumber({ Ref: 'dataNodes' }), - masterNodeInstanceType: Token.asString({ Ref: 'masterNodeInstanceType' }), - masterNodes: Token.asNumber({ Ref: 'masterNodes' }), - warmInstanceType: Token.asString({ Ref: 'warmInstanceType' }), - warmNodes: Token.asNumber({ Ref: 'warmNodes' }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - ClusterConfig: { - InstanceCount: { - Ref: 'dataNodes', - }, - InstanceType: { - Ref: 'dataNodeInstanceType', - }, - DedicatedMasterEnabled: true, - DedicatedMasterCount: { - Ref: 'masterNodes', - }, - DedicatedMasterType: { - Ref: 'masterNodeInstanceType', - }, - WarmEnabled: true, - WarmCount: { - Ref: 'warmNodes', - }, - WarmType: { - Ref: 'warmInstanceType', - }, - }, - }); -}); - -each([testedOpenSearchVersions]).describe('log groups', (engineVersion) => { - - test('slowSearchLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - slowSearchLogEnabled: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainSlowSearchLogs5B35A97A', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('slowIndexLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - slowIndexLogEnabled: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainSlowIndexLogsFE2F1061', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('appLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - appLogEnabled: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainAppLogs21698C1B', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('auditLogEnabled should create a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - auditLogEnabled: true, - }, - fineGrainedAccessControl: { - masterUserName: 'username', - }, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - AUDIT_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'DomainAuditLogs608E0FA6', - 'Arn', - ], - }, - Enabled: true, - }, - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('two domains with logging enabled can be created in same stack', () => { - new Domain(stack, 'Domain1', { - version: engineVersion, - logging: { - appLogEnabled: true, - slowSearchLogEnabled: true, - slowIndexLogEnabled: true, - }, - }); - new Domain(stack, 'Domain2', { - version: engineVersion, - logging: { - appLogEnabled: true, - slowSearchLogEnabled: true, - slowIndexLogEnabled: true, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain1AppLogs6E8D1D67', - 'Arn', - ], - }, - Enabled: true, - }, - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain1SlowSearchLogs8F3B0506', - 'Arn', - ], - }, - Enabled: true, - }, - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain1SlowIndexLogs9354D098', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain2AppLogs810876E2', - 'Arn', - ], - }, - Enabled: true, - }, - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain2SlowSearchLogs0C75F64B', - 'Arn', - ], - }, - Enabled: true, - }, - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'Domain2SlowIndexLogs0CB900D0', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - }, - }); - }); - - test('log group policy is uniquely named for each domain', () => { - new Domain(stack, 'Domain1', { - version: engineVersion, - logging: { - appLogEnabled: true, - }, - }); - new Domain(stack, 'Domain2', { - version: engineVersion, - logging: { - appLogEnabled: true, - }, - }); - - // Domain1 - Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { - Create: { - 'Fn::Join': [ - '', - [ - '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', - { - 'Fn::GetAtt': [ - 'Domain1AppLogs6E8D1D67', - 'Arn', - ], - }, - '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391"}}', - ], - ], - }, - }); - // Domain2 - Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { - Create: { - 'Fn::Join': [ - '', - [ - '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', - { - 'Fn::GetAtt': [ - 'Domain2AppLogs810876E2', - 'Arn', - ], - }, - '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2"}}', - ], - ], - }, - }); - }); - - test('enabling audit logs throws without fine grained access control enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - auditLogEnabled: true, - }, - })).toThrow(/Fine-grained access control is required when audit logs publishing is enabled\./); - }); - - test('slowSearchLogGroup should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - slowSearchLogEnabled: true, - slowSearchLogGroup: new logs.LogGroup(stack, 'SlowSearchLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - SEARCH_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'SlowSearchLogsE00DC2E7', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('slowIndexLogEnabled should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - slowIndexLogEnabled: true, - slowIndexLogGroup: new logs.LogGroup(stack, 'SlowIndexLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - INDEX_SLOW_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'SlowIndexLogsAD49DED0', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('appLogGroup should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - logging: { - appLogEnabled: true, - appLogGroup: new logs.LogGroup(stack, 'AppLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - ES_APPLICATION_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'AppLogsC5DF83A6', - 'Arn', - ], - }, - Enabled: true, - }, - AUDIT_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - - test('auditLOgGroup should use a custom log group', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserName: 'username', - }, - nodeToNodeEncryption: true, - encryptionAtRest: { - enabled: true, - }, - enforceHttps: true, - logging: { - auditLogEnabled: true, - auditLogGroup: new logs.LogGroup(stack, 'AuditLogs', { - retention: logs.RetentionDays.THREE_MONTHS, - }), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - LogPublishingOptions: { - AUDIT_LOGS: { - CloudWatchLogsLogGroupArn: { - 'Fn::GetAtt': [ - 'AuditLogsB945E340', - 'Arn', - ], - }, - Enabled: true, - }, - ES_APPLICATION_LOGS: Match.absent(), - SEARCH_SLOW_LOGS: Match.absent(), - INDEX_SLOW_LOGS: Match.absent(), - }, - }); - }); - -}); - -each(testedOpenSearchVersions).describe('grants', (engineVersion) => { - - test('"grantRead" allows read actions associated with this domain resource', () => { - testGrant(readActions, (p, d) => d.grantRead(p), engineVersion); - }); - - test('"grantWrite" allows write actions associated with this domain resource', () => { - testGrant(writeActions, (p, d) => d.grantWrite(p), engineVersion); - }); - - test('"grantReadWrite" allows read and write actions associated with this domain resource', () => { - testGrant(readWriteActions, (p, d) => d.grantReadWrite(p), engineVersion); - }); - - test('"grantIndexRead" allows read actions associated with an index in this domain resource', () => { - testGrant( - readActions, - (p, d) => d.grantIndexRead('my-index', p), - engineVersion, - false, - ['/my-index', '/my-index/*'], - ); - }); - - test('"grantIndexWrite" allows write actions associated with an index in this domain resource', () => { - testGrant( - writeActions, - (p, d) => d.grantIndexWrite('my-index', p), - engineVersion, - false, - ['/my-index', '/my-index/*'], - ); - }); - - test('"grantIndexReadWrite" allows read and write actions associated with an index in this domain resource', () => { - testGrant( - readWriteActions, - (p, d) => d.grantIndexReadWrite('my-index', p), - engineVersion, - false, - ['/my-index', '/my-index/*'], - ); - }); - - test('"grantPathRead" allows read actions associated with a given path in this domain resource', () => { - testGrant( - readActions, - (p, d) => d.grantPathRead('my-index/my-path', p), - engineVersion, - false, - ['/my-index/my-path'], - ); - }); - - test('"grantPathWrite" allows write actions associated with a given path in this domain resource', () => { - testGrant( - writeActions, - (p, d) => d.grantPathWrite('my-index/my-path', p), - engineVersion, - false, - ['/my-index/my-path'], - ); - }); - - test('"grantPathReadWrite" allows read and write actions associated with a given path in this domain resource', () => { - testGrant( - readWriteActions, - (p, d) => d.grantPathReadWrite('my-index/my-path', p), - engineVersion, - false, - ['/my-index/my-path'], - ); - }); - - test('"grant" for an imported domain', () => { - const domainEndpoint = 'https://test-domain-2w2x2u3tifly-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com'; - const domain = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); - const user = new iam.User(stack, 'user'); - - domain.grantReadWrite(user); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 'es:ESHttpGet', - 'es:ESHttpHead', - 'es:ESHttpDelete', - 'es:ESHttpPost', - 'es:ESHttpPut', - 'es:ESHttpPatch', - ], - Effect: 'Allow', - Resource: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':es:testregion:1234:domain/test-domain-2w2x2u3tifly', - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':es:testregion:1234:domain/test-domain-2w2x2u3tifly/*', - ], - ], - }, - ], - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'userDefaultPolicy083DF682', - Users: [ - { - Ref: 'user2C2B57AE', - }, - ], - }); - }); - -}); - -each(testedOpenSearchVersions).describe('metrics', (engineVersion) => { - - test('metricClusterStatusRed', () => { - testMetric( - (domain) => domain.metricClusterStatusRed(), - 'ClusterStatus.red', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricClusterStatusYellow', () => { - testMetric( - (domain) => domain.metricClusterStatusYellow(), - 'ClusterStatus.yellow', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricFreeStorageSpace', () => { - testMetric( - (domain) => domain.metricFreeStorageSpace(), - 'FreeStorageSpace', - engineVersion, - Statistic.MINIMUM, - ); - }); - - test('metricClusterIndexWriteBlocked', () => { - testMetric( - (domain) => domain.metricClusterIndexWritesBlocked(), - 'ClusterIndexWritesBlocked', - engineVersion, - Statistic.MAXIMUM, - Duration.minutes(1), - ); - }); - - test('metricNodes', () => { - testMetric( - (domain) => domain.metricNodes(), - 'Nodes', - engineVersion, - Statistic.MINIMUM, - Duration.hours(1), - ); - }); - - test('metricAutomatedSnapshotFailure', () => { - testMetric( - (domain) => domain.metricAutomatedSnapshotFailure(), - 'AutomatedSnapshotFailure', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricCPUUtilization', () => { - testMetric( - (domain) => domain.metricCPUUtilization(), - 'CPUUtilization', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricJVMMemoryPressure', () => { - testMetric( - (domain) => domain.metricJVMMemoryPressure(), - 'JVMMemoryPressure', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricMasterCPUUtilization', () => { - testMetric( - (domain) => domain.metricMasterCPUUtilization(), - 'MasterCPUUtilization', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricMasterJVMMemoryPressure', () => { - testMetric( - (domain) => domain.metricMasterJVMMemoryPressure(), - 'MasterJVMMemoryPressure', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricKMSKeyError', () => { - testMetric( - (domain) => domain.metricKMSKeyError(), - 'KMSKeyError', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricKMSKeyInaccessible', () => { - testMetric( - (domain) => domain.metricKMSKeyInaccessible(), - 'KMSKeyInaccessible', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricSearchableDocuments', () => { - testMetric( - (domain) => domain.metricSearchableDocuments(), - 'SearchableDocuments', - engineVersion, - Statistic.MAXIMUM, - ); - }); - - test('metricSearchLatency', () => { - testMetric( - (domain) => domain.metricSearchLatency(), - 'SearchLatency', - engineVersion, - 'p99', - ); - }); - - test('metricIndexingLatency', () => { - testMetric( - (domain) => domain.metricIndexingLatency(), - 'IndexingLatency', - engineVersion, - 'p99', - ); - }); - -}); - -describe('import', () => { - - test('static fromDomainEndpoint(endpoint) allows importing an external/existing domain', () => { - const domainName = 'test-domain-2w2x2u3tifly'; - const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; - const domainEndpoint = `https://${domainEndpointWithoutHttps}`; - const imported = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); - - expect(imported.domainName).toEqual(domainName); - expect(imported.domainArn).toMatch(RegExp(`es:testregion:1234:domain/${domainName}$`)); - expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); - - Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 0); - }); - - test('static fromDomainAttributes(attributes) allows importing an external/existing domain', () => { - const domainName = 'test-domain-2w2x2u3tifly'; - const domainArn = `arn:aws:es:testregion:1234:domain/${domainName}`; - const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; - const domainEndpoint = `https://${domainEndpointWithoutHttps}`; - const imported = Domain.fromDomainAttributes(stack, 'Domain', { - domainArn, - domainEndpoint, - }); - - expect(imported.domainName).toEqual(domainName); - expect(imported.domainArn).toEqual(domainArn); - expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); - - Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 0); - }); - - test('static fromDomainAttributes(attributes) allows importing with token arn and endpoint', () => { - const domainArn = new CfnParameter(stack, 'domainArn', { type: 'String' }).valueAsString; - const domainEndpoint = new CfnParameter(stack, 'domainEndpoint', { type: 'String' }).valueAsString; - const imported = Domain.fromDomainAttributes(stack, 'Domain', { - domainArn, - domainEndpoint, - }); - const expectedDomainName = { - 'Fn::Select': [ - 1, - { - 'Fn::Split': [ - '/', - { - 'Fn::Select': [ - 5, - { - 'Fn::Split': [ - ':', - { - Ref: 'domainArn', - }, - ], - }, - ], - }, - ], - }, - ], - }; - - expect(stack.resolve(imported.domainName)).toEqual(expectedDomainName); - expect(imported.domainArn).toEqual(domainArn); - expect(imported.domainEndpoint).toEqual(domainEndpoint); - - Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 0); - }); -}); - -each(testedOpenSearchVersions).describe('advanced security options', (engineVersion) => { - const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; - const masterUserName = 'JohnDoe'; - const password = 'password'; - const masterUserPassword = SecretValue.unsafePlainText(password); - - test('enable fine-grained access control with a master user ARN', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: false, - MasterUserOptions: { - MasterUserARN: masterUserArn, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - test('enable fine-grained access control with a master user name and password', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserName, - masterUserPassword, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: masterUserName, - MasterUserPassword: password, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - test('enable fine-grained access control with a master user name and dynamically generated password', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserName, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: masterUserName, - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DomainMasterUserBFAFA7D9', - }, - ':SecretString:password::}}', - ], - ], - }, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: { - GenerateStringKey: 'password', - }, - }); - }); - - test('enabling fine-grained access control throws with Elasticsearch version < 6.7', () => { - expect(() => new Domain(stack, 'Domain', { - version: EngineVersion.ELASTICSEARCH_6_5, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - })).toThrow(/Fine-grained access control requires Elasticsearch version 6\.7 or later or OpenSearch version 1\.0 or later/); - }); - - test('enabling fine-grained access control throws without node-to-node encryption enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: false, - enforceHttps: true, - })).toThrow(/Node-to-node encryption is required when fine-grained access control is enabled/); - }); - - test('enabling fine-grained access control throws without encryption-at-rest enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: false, - }, - nodeToNodeEncryption: true, - enforceHttps: true, - })).toThrow(/Encryption-at-rest is required when fine-grained access control is enabled/); - }); - - test('enabling fine-grained access control throws without enforceHttps enabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserArn, - }, - encryptionAtRest: { - enabled: true, - }, - nodeToNodeEncryption: true, - enforceHttps: false, - })).toThrow(/Enforce HTTPS is required when fine-grained access control is enabled/); - }); -}); - -each(testedOpenSearchVersions).describe('custom endpoints', (engineVersion) => { - const customDomainName = 'search.example.com'; - - test('custom domain without hosted zone and default cert', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - nodeToNodeEncryption: true, - enforceHttps: true, - customEndpoint: { - domainName: customDomainName, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - DomainEndpointOptions: { - EnforceHTTPS: true, - CustomEndpointEnabled: true, - CustomEndpoint: customDomainName, - CustomEndpointCertificateArn: { - Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: customDomainName, - ValidationMethod: 'EMAIL', - }); - }); - - test('custom domain with hosted zone and default cert', () => { - const zone = new route53.HostedZone(stack, 'DummyZone', { zoneName: 'example.com' }); - new Domain(stack, 'Domain', { - version: engineVersion, - nodeToNodeEncryption: true, - enforceHttps: true, - customEndpoint: { - domainName: customDomainName, - hostedZone: zone, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - DomainEndpointOptions: { - EnforceHTTPS: true, - CustomEndpointEnabled: true, - CustomEndpoint: customDomainName, - CustomEndpointCertificateArn: { - Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: customDomainName, - DomainValidationOptions: [ - { - DomainName: customDomainName, - HostedZoneId: { - Ref: 'DummyZone03E0FE81', - }, - }, - ], - ValidationMethod: 'DNS', - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Name: 'search.example.com.', - Type: 'CNAME', - HostedZoneId: { - Ref: 'DummyZone03E0FE81', - }, - ResourceRecords: [ - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'DomainEndpoint', - ], - }, - ], - }); - }); - - test('custom domain with hosted zone and given cert', () => { - const zone = new route53.HostedZone(stack, 'DummyZone', { - zoneName: 'example.com', - }); - const certificate = new acm.Certificate(stack, 'DummyCert', { - domainName: customDomainName, - }); - - new Domain(stack, 'Domain', { - version: engineVersion, - nodeToNodeEncryption: true, - enforceHttps: true, - customEndpoint: { - domainName: customDomainName, - hostedZone: zone, - certificate, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - DomainEndpointOptions: { - EnforceHTTPS: true, - CustomEndpointEnabled: true, - CustomEndpoint: customDomainName, - CustomEndpointCertificateArn: { - Ref: 'DummyCertFA37670B', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Name: 'search.example.com.', - Type: 'CNAME', - HostedZoneId: { - Ref: 'DummyZone03E0FE81', - }, - ResourceRecords: [ - { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'DomainEndpoint', - ], - }, - ], - }); - }); - -}); - -each(testedOpenSearchVersions).describe('custom error responses', (engineVersion) => { - - test('error when availabilityZoneCount does not match vpcOptions.subnets length', () => { - const vpc = new Vpc(stack, 'Vpc', { - maxAzs: 1, - }); - - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - zoneAwareness: { - enabled: true, - availabilityZoneCount: 2, - }, - vpc, - })).toThrow(/you need to provide a subnet for each AZ you are using/); - }); - - test('Imported VPC with subnets that are still pending lookup won\'t throw Az count mismatch', () => { - const vpc = Vpc.fromLookup(stack, 'ExampleVpc', { - vpcId: 'vpc-123', - }); - let subnets = vpc.selectSubnets({ - subnetType: SubnetType.PRIVATE_WITH_EGRESS, - }); - - new Domain(stack, 'Domain1', { - version: engineVersion, - vpc, - vpcSubnets: [subnets], - zoneAwareness: { - enabled: true, - availabilityZoneCount: 3, - }, - }); - - Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 1); - }); - - test('error when master, data or Ultra Warm instance types do not end with .search', () => { - const error = /instance types must end with ".search"/; - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - masterNodeInstanceType: 'c5.large', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: engineVersion, - capacity: { - dataNodeInstanceType: 'c5.2xlarge', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain3', { - version: engineVersion, - capacity: { - warmInstanceType: 'ultrawarm1.medium', - }, - })).toThrow(error); - }); - - test('error when Ultra Warm instance types do not start with ultrawarm', () => { - const error = /UltraWarm node instance type must start with "ultrawarm"./; - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - warmInstanceType: 't3.small.search', - }, - })).toThrow(error); - }); - - test('error when Elasticsearch version is unsupported/unknown', () => { - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.elasticsearch('5.4'), - })).toThrow('Unknown Elasticsearch version: 5.4'); - }); - - test('error when invalid domain name is given', () => { - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.OPENSEARCH_1_0, - domainName: 'InvalidName', - })).toThrow(/Valid characters are a-z/); - expect(() => new Domain(stack, 'Domain2', { - version: EngineVersion.OPENSEARCH_1_0, - domainName: 'a'.repeat(29), - })).toThrow(/It must be between 3 and 28 characters/); - expect(() => new Domain(stack, 'Domain3', { - version: EngineVersion.OPENSEARCH_1_0, - domainName: '123domain', - })).toThrow(/It must start with a lowercase letter/); - }); - - test('error when error log publishing is enabled for Elasticsearch version < 5.1', () => { - const error = /Error logs publishing requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/; - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.ELASTICSEARCH_2_3, - logging: { - appLogEnabled: true, - }, - })).toThrow(error); - }); - - test('error when encryption at rest is enabled for Elasticsearch version < 5.1', () => { - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.ELASTICSEARCH_2_3, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(/Encryption of data at rest requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/); - }); - - test('error when cognito for OpenSearch Dashboards is enabled for elasticsearch version < 5.1', () => { - const user = new iam.User(stack, 'user'); - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.ELASTICSEARCH_2_3, - cognitoDashboardsAuth: { - identityPoolId: 'test-identity-pool-id', - role: new iam.Role(stack, 'Role', { assumedBy: user }), - userPoolId: 'test-user-pool-id', - }, - })).toThrow(/Cognito authentication for OpenSearch Dashboards requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/); - }); - - test('error when C5, I3, M5, or R5 instance types are specified for Elasticsearch version < 5.1', () => { - const error = /C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/; - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.ELASTICSEARCH_2_3, - capacity: { - masterNodeInstanceType: 'c5.medium.search', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: EngineVersion.ELASTICSEARCH_1_5, - capacity: { - dataNodeInstanceType: 'i3.2xlarge.search', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain3', { - version: EngineVersion.ELASTICSEARCH_1_5, - capacity: { - dataNodeInstanceType: 'm5.2xlarge.search', - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain4', { - version: EngineVersion.ELASTICSEARCH_1_5, - capacity: { - masterNodeInstanceType: 'r5.2xlarge.search', - }, - })).toThrow(error); - }); - - test('error when node to node encryption is enabled for Elasticsearch version < 6.0', () => { - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.ELASTICSEARCH_5_6, - nodeToNodeEncryption: true, - })).toThrow(/Node-to-node encryption requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later/); - }); - - test('error when i3 or r6g instance types are specified with EBS enabled', () => { - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - dataNodeInstanceType: 'i3.2xlarge.search', - }, - ebs: { - volumeSize: 100, - volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, - }, - })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); - expect(() => new Domain(stack, 'Domain2', { - version: engineVersion, - capacity: { - dataNodeInstanceType: 'r6gd.large.search', - }, - ebs: { - volumeSize: 100, - volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, - }, - })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); - }); - - test('error when m3, r3, or t2 instance types are specified with encryption at rest enabled', () => { - const error = /M3, R3, and T2 instance types do not support encryption of data at rest/; - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - masterNodeInstanceType: 'm3.2xlarge.search', - }, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: engineVersion, - capacity: { - dataNodeInstanceType: 'r3.2xlarge.search', - }, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain3', { - version: engineVersion, - capacity: { - masterNodeInstanceType: 't2.2xlarge.search', - }, - encryptionAtRest: { - enabled: true, - }, - })).toThrow(error); - }); - - test('error when t2.micro is specified with Elasticsearch version > 2.3', () => { - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - masterNodeInstanceType: 't2.micro.search', - }, - })).toThrow(/t2.micro.search instance type supports only Elasticsearch versions 1.5 and 2.3/); - }); - - test('error when any instance type other than R3, I3 and R6GD are specified without EBS enabled', () => { - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - ebs: { - enabled: false, - }, - capacity: { - masterNodeInstanceType: 'm5.large.search', - }, - })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); - expect(() => new Domain(stack, 'Domain2', { - version: engineVersion, - ebs: { - enabled: false, - }, - capacity: { - dataNodeInstanceType: 'm5.large.search', - }, - })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); - }); - - test('can use compatible master instance types that does not have local storage when data node type is i3 or r6gd', () => { - new Domain(stack, 'Domain1', { - version: engineVersion, - ebs: { - enabled: false, - }, - capacity: { - masterNodeInstanceType: 'c5.2xlarge.search', - dataNodeInstanceType: 'i3.2xlarge.search', - }, - }); - new Domain(stack, 'Domain2', { - version: engineVersion, - ebs: { - enabled: false, - }, - capacity: { - masterNodes: 3, - masterNodeInstanceType: 'c6g.large.search', - dataNodeInstanceType: 'r6gd.large.search', - }, - }); - // both configurations pass synth-time validation - Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 2); - }); - - test('error when availabilityZoneCount is not 2 or 3', () => { - const vpc = new Vpc(stack, 'Vpc'); - - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - vpc, - zoneAwareness: { - availabilityZoneCount: 4, - }, - })).toThrow(/Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3/); - }); - - test('error when UltraWarm instance is used with Elasticsearch version < 6.8', () => { - expect(() => new Domain(stack, 'Domain1', { - version: EngineVersion.ELASTICSEARCH_6_7, - capacity: { - masterNodes: 1, - warmNodes: 1, - }, - })).toThrow(/UltraWarm requires Elasticsearch version 6\.8 or later or OpenSearch version 1.0 or later/); - }); - - test('error when t2 or t3 instance types are specified with UltramWarm enabled', () => { - const error = /T2 and T3 instance types do not support UltraWarm storage/; - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - masterNodeInstanceType: 't2.2xlarge.search', - warmNodes: 1, - }, - })).toThrow(error); - expect(() => new Domain(stack, 'Domain2', { - version: engineVersion, - capacity: { - masterNodeInstanceType: 't3.2xlarge.search', - warmNodes: 1, - }, - })).toThrow(error); - }); - - test('error when UltraWarm instance is used and no dedicated master instance specified', () => { - expect(() => new Domain(stack, 'Domain1', { - version: engineVersion, - capacity: { - warmNodes: 1, - masterNodes: 0, - }, - })).toThrow(/Dedicated master node is required when UltraWarm storage is enabled/); - }); - -}); - -test('can specify future version', () => { - new Domain(stack, 'Domain', { version: EngineVersion.elasticsearch('8.2') }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - EngineVersion: 'Elasticsearch_8.2', - }); -}); - -each(testedOpenSearchVersions).describe('unsigned basic auth', (engineVersion) => { - test('can create a domain with unsigned basic auth', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - useUnsignedBasicAuth: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: 'admin', - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - test('does not overwrite master user ARN configuration', () => { - const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; - - new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserArn, - }, - useUnsignedBasicAuth: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: false, - MasterUserOptions: { - MasterUserARN: masterUserArn, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - test('does not overwrite master user name and password', () => { - const masterUserName = 'JohnDoe'; - const password = 'password'; - const masterUserPassword = SecretValue.unsafePlainText(password); - - new Domain(stack, 'Domain', { - version: engineVersion, - fineGrainedAccessControl: { - masterUserName, - masterUserPassword, - }, - useUnsignedBasicAuth: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedSecurityOptions: { - Enabled: true, - InternalUserDatabaseEnabled: true, - MasterUserOptions: { - MasterUserName: masterUserName, - MasterUserPassword: password, - }, - }, - EncryptionAtRestOptions: { - Enabled: true, - }, - NodeToNodeEncryptionOptions: { - Enabled: true, - }, - DomainEndpointOptions: { - EnforceHTTPS: true, - }, - }); - }); - - test('fails to create a domain with unsigned basic auth when enforce HTTPS is disabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - useUnsignedBasicAuth: true, - enforceHttps: false, - })).toThrow(/You cannot disable HTTPS and use unsigned basic auth/); - }); - - test('fails to create a domain with unsigned basic auth when node to node encryption is disabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - useUnsignedBasicAuth: true, - nodeToNodeEncryption: false, - })).toThrow(/You cannot disable node to node encryption and use unsigned basic auth/); - }); - - test('fails to create a domain with unsigned basic auth when encryption at rest is disabled', () => { - expect(() => new Domain(stack, 'Domain', { - version: engineVersion, - useUnsignedBasicAuth: true, - encryptionAtRest: { enabled: false }, - })).toThrow(/You cannot disable encryption at rest and use unsigned basic auth/); - }); - - test('using unsigned basic auth throws with Elasticsearch < 6.7', () => { - expect(() => new Domain(stack, 'Domain', { - version: EngineVersion.ELASTICSEARCH_6_5, - useUnsignedBasicAuth: true, - })).toThrow(/Using unsigned basic auth requires Elasticsearch version 6\.7 or later or OpenSearch version 1.0 or later/); - }); -}); - -each(testedOpenSearchVersions).describe('advanced options', (engineVersion) => { - test('use advanced options', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - advancedOptions: { - 'rest.action.multi.allow_explicit_index': 'true', - 'indices.fielddata.cache.size': '50', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedOptions: { - 'rest.action.multi.allow_explicit_index': 'true', - 'indices.fielddata.cache.size': '50', - }, - }); - }); - - test('advanced options absent by default', () => { - new Domain(stack, 'Domain', { - version: engineVersion, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - AdvancedOptions: Match.absent(), - }); - }); -}); - -each(testedOpenSearchVersions).describe('cognito dashboards auth', (engineVersion) => { - test('cognito dashboards auth is not configured by default', () => { - new Domain(stack, 'Domain', { version: engineVersion }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - CognitoOptions: Match.absent(), - }); - }); - - test('cognito dashboards auth can be configured', () => { - const identityPoolId = 'test-identity-pool-id'; - const userPoolId = 'test-user-pool-id'; - const user = new iam.User(stack, 'testuser'); - const role = new iam.Role(stack, 'testrole', { assumedBy: user }); - - new Domain(stack, 'Domain', { - version: engineVersion, - cognitoDashboardsAuth: { - role, - identityPoolId, - userPoolId, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { - CognitoOptions: { - Enabled: true, - IdentityPoolId: identityPoolId, - RoleArn: { - 'Fn::GetAtt': [ - 'testroleFAA56B58', - 'Arn', - ], - }, - UserPoolId: userPoolId, - }, - }); - }); -}); - -function testGrant( - expectedActions: string[], - invocation: (user: iam.IPrincipal, domain: Domain) => void, - engineVersion: EngineVersion, - appliesToDomainRoot: Boolean = true, - paths: string[] = ['/*'], -) { - const domain = new Domain(stack, 'Domain', { version: engineVersion }); - const user = new iam.User(stack, 'user'); - - invocation(user, domain); - - const action = expectedActions.length > 1 ? expectedActions.map(a => `es:${a}`) : `es:${expectedActions[0]}`; - const domainArn = { - 'Fn::GetAtt': [ - 'Domain66AC69E0', - 'Arn', - ], - }; - const resolvedPaths = paths.map(path => { - return { - 'Fn::Join': [ - '', - [ - domainArn, - path, - ], - ], - }; - }); - const resource = appliesToDomainRoot - ? [domainArn, ...resolvedPaths] - : resolvedPaths.length > 1 - ? resolvedPaths - : resolvedPaths[0]; - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: action, - Effect: 'Allow', - Resource: resource, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'userDefaultPolicy083DF682', - Users: [ - { - Ref: 'user2C2B57AE', - }, - ], - }); -} - -function testMetric( - invocation: (domain: Domain) => Metric, - metricName: string, - engineVersion: EngineVersion, - statistic: string = Statistic.SUM, - period: Duration = Duration.minutes(5), -) { - const domain = new Domain(stack, 'Domain', { version: engineVersion }); - - const metric = invocation(domain); - - expect(metric).toMatchObject({ - metricName, - namespace: 'AWS/ES', - period, - statistic, - dimensions: { - ClientId: '1234', - }, - }); - expect(metric.dimensions).toHaveProperty('DomainName'); -} diff --git a/packages/@aws-cdk/aws-opensearchservice/test/log-group-resource-policy.test.ts b/packages/@aws-cdk/aws-opensearchservice/test/log-group-resource-policy.test.ts deleted file mode 100644 index bbfa0c37a23c4..0000000000000 --- a/packages/@aws-cdk/aws-opensearchservice/test/log-group-resource-policy.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; -import { LogGroupResourcePolicy } from '../lib/log-group-resource-policy'; - -let app: App; -let stack: Stack; - -beforeEach(() => { - app = new App(); - stack = new Stack(app, 'Stack', { - env: { account: '1234', region: 'testregion' }, - }); -}); - -test('minimal example renders correctly', () => { - new LogGroupResourcePolicy(stack, 'LogGroupResourcePolicy', { - policyName: 'TestPolicy', - policyStatements: [new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], - resources: ['*'], - principals: [new iam.ServicePrincipal('es.amazonaws.com')], - })], - }); - - Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { - ServiceToken: { - 'Fn::GetAtt': [ - 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', - 'Arn', - ], - }, - Create: JSON.stringify({ - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: 'TestPolicy', - policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', - }, - physicalResourceId: { - id: 'LogGroupResourcePolicy', - }, - }), - Update: JSON.stringify({ - service: 'CloudWatchLogs', - action: 'putResourcePolicy', - parameters: { - policyName: 'TestPolicy', - policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', - }, - physicalResourceId: { - id: 'LogGroupResourcePolicy', - }, - }), - Delete: JSON.stringify({ - service: 'CloudWatchLogs', - action: 'deleteResourcePolicy', - parameters: { - policyName: 'TestPolicy', - }, - ignoreErrorCodesMatching: 'ResourceNotFoundException', - }), - }); -}); diff --git a/packages/@aws-cdk/aws-opsworks/.eslintrc.js b/packages/@aws-cdk/aws-opsworks/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opsworks/.gitignore b/packages/@aws-cdk/aws-opsworks/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-opsworks/.npmignore b/packages/@aws-cdk/aws-opsworks/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-opsworks/LICENSE b/packages/@aws-cdk/aws-opsworks/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-opsworks/NOTICE b/packages/@aws-cdk/aws-opsworks/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-opsworks/README.md b/packages/@aws-cdk/aws-opsworks/README.md deleted file mode 100644 index f2fe2e451e6bd..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS OpsWorks Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as opsworks from '@aws-cdk/aws-opsworks'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for OpsWorks construct libraries](https://constructs.dev/search?q=opsworks) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::OpsWorks resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorks.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::OpsWorks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorks.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-opsworks/jest.config.js b/packages/@aws-cdk/aws-opsworks/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opsworks/lib/index.ts b/packages/@aws-cdk/aws-opsworks/lib/index.ts deleted file mode 100644 index 155231f31c103..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::OpsWorks CloudFormation Resources: -export * from './opsworks.generated'; diff --git a/packages/@aws-cdk/aws-opsworks/package.json b/packages/@aws-cdk/aws-opsworks/package.json deleted file mode 100644 index 24301faa74e00..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-opsworks", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::OpsWorks", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.opsworks", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "opsworks" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.OpsWorks", - "packageId": "Amazon.CDK.AWS.OpsWorks", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-opsworks", - "module": "aws_cdk.aws_opsworks", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-opsworks" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::OpsWorks", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "opsworks" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-opsworks/test/opsworks.test.ts b/packages/@aws-cdk/aws-opsworks/test/opsworks.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-opsworks/test/opsworks.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-opsworkscm/.eslintrc.js b/packages/@aws-cdk/aws-opsworkscm/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opsworkscm/.gitignore b/packages/@aws-cdk/aws-opsworkscm/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-opsworkscm/.npmignore b/packages/@aws-cdk/aws-opsworkscm/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-opsworkscm/LICENSE b/packages/@aws-cdk/aws-opsworkscm/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-opsworkscm/NOTICE b/packages/@aws-cdk/aws-opsworkscm/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-opsworkscm/README.md b/packages/@aws-cdk/aws-opsworkscm/README.md deleted file mode 100644 index 9e7df96327df3..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS OpsWorks CM Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as opsworkscm from '@aws-cdk/aws-opsworkscm'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for OpsWorksCM construct libraries](https://constructs.dev/search?q=opsworkscm) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::OpsWorksCM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorksCM.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::OpsWorksCM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorksCM.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-opsworkscm/jest.config.js b/packages/@aws-cdk/aws-opsworkscm/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-opsworkscm/lib/index.ts b/packages/@aws-cdk/aws-opsworkscm/lib/index.ts deleted file mode 100644 index e0fdb4ad65d52..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::OpsWorksCM CloudFormation Resources: -export * from './opsworkscm.generated'; diff --git a/packages/@aws-cdk/aws-opsworkscm/package.json b/packages/@aws-cdk/aws-opsworkscm/package.json deleted file mode 100644 index 0c1412313422e..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-opsworkscm", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::OpsWorksCM", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.OpsWorksCM", - "packageId": "Amazon.CDK.AWS.OpsWorksCM", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.opsworkscm", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "opsworkscm" - } - }, - "python": { - "distName": "aws-cdk.aws-opsworkscm", - "module": "aws_cdk.aws_opsworkscm", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-opsworkscm" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::OpsWorksCM", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::OpsWorksCM", - "aws-opsworkscm" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-opsworkscm/test/opsworkscm.test.ts b/packages/@aws-cdk/aws-opsworkscm/test/opsworkscm.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-opsworkscm/test/opsworkscm.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-organizations/.eslintrc.js b/packages/@aws-cdk/aws-organizations/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-organizations/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-organizations/.gitignore b/packages/@aws-cdk/aws-organizations/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-organizations/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-organizations/.npmignore b/packages/@aws-cdk/aws-organizations/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-organizations/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-organizations/LICENSE b/packages/@aws-cdk/aws-organizations/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-organizations/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-organizations/NOTICE b/packages/@aws-cdk/aws-organizations/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-organizations/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-organizations/README.md b/packages/@aws-cdk/aws-organizations/README.md deleted file mode 100644 index 520603c972d9b..0000000000000 --- a/packages/@aws-cdk/aws-organizations/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Organizations Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as organizations from '@aws-cdk/aws-organizations'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Organizations construct libraries](https://constructs.dev/search?q=organizations) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Organizations resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Organizations.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Organizations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Organizations.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-organizations/jest.config.js b/packages/@aws-cdk/aws-organizations/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-organizations/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-organizations/lib/index.ts b/packages/@aws-cdk/aws-organizations/lib/index.ts deleted file mode 100644 index 005459110e711..0000000000000 --- a/packages/@aws-cdk/aws-organizations/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Organizations CloudFormation Resources: -export * from './organizations.generated'; diff --git a/packages/@aws-cdk/aws-organizations/package.json b/packages/@aws-cdk/aws-organizations/package.json deleted file mode 100644 index d554c7e9dca20..0000000000000 --- a/packages/@aws-cdk/aws-organizations/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-organizations", - "version": "0.0.0", - "description": "AWS::Organizations Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Organizations", - "packageId": "Amazon.CDK.AWS.Organizations", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.organizations", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "organizations" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-organizations", - "module": "aws_cdk.aws_organizations" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-organizations" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Organizations", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Organizations", - "aws-organizations" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-organizations/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-organizations/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-organizations/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-organizations/test/organizations.test.ts b/packages/@aws-cdk/aws-organizations/test/organizations.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-organizations/test/organizations.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-panorama/.eslintrc.js b/packages/@aws-cdk/aws-panorama/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-panorama/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-panorama/.gitignore b/packages/@aws-cdk/aws-panorama/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-panorama/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-panorama/.npmignore b/packages/@aws-cdk/aws-panorama/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-panorama/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-panorama/LICENSE b/packages/@aws-cdk/aws-panorama/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-panorama/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-panorama/NOTICE b/packages/@aws-cdk/aws-panorama/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-panorama/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-panorama/README.md b/packages/@aws-cdk/aws-panorama/README.md deleted file mode 100644 index f5993512611ce..0000000000000 --- a/packages/@aws-cdk/aws-panorama/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Panorama Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as panorama from '@aws-cdk/aws-panorama'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Panorama construct libraries](https://constructs.dev/search?q=panorama) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Panorama resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Panorama.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Panorama](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Panorama.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-panorama/jest.config.js b/packages/@aws-cdk/aws-panorama/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-panorama/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-panorama/lib/index.ts b/packages/@aws-cdk/aws-panorama/lib/index.ts deleted file mode 100644 index 1ef8b1378379a..0000000000000 --- a/packages/@aws-cdk/aws-panorama/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Panorama CloudFormation Resources: -export * from './panorama.generated'; diff --git a/packages/@aws-cdk/aws-panorama/package.json b/packages/@aws-cdk/aws-panorama/package.json deleted file mode 100644 index bd841dd1832f1..0000000000000 --- a/packages/@aws-cdk/aws-panorama/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-panorama", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Panorama", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Panorama", - "packageId": "Amazon.CDK.AWS.Panorama", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.panorama", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "panorama" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-panorama", - "module": "aws_cdk.aws_panorama" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-panorama" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Panorama", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Panorama", - "aws-panorama" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-panorama/test/aws-panorama.test.ts b/packages/@aws-cdk/aws-panorama/test/aws-panorama.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-panorama/test/aws-panorama.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-personalize/.eslintrc.js b/packages/@aws-cdk/aws-personalize/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-personalize/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-personalize/.gitignore b/packages/@aws-cdk/aws-personalize/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-personalize/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-personalize/.npmignore b/packages/@aws-cdk/aws-personalize/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-personalize/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-personalize/LICENSE b/packages/@aws-cdk/aws-personalize/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-personalize/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-personalize/NOTICE b/packages/@aws-cdk/aws-personalize/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-personalize/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-personalize/README.md b/packages/@aws-cdk/aws-personalize/README.md deleted file mode 100644 index 34e951305d828..0000000000000 --- a/packages/@aws-cdk/aws-personalize/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Personalize Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as personalize from '@aws-cdk/aws-personalize'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Personalize construct libraries](https://constructs.dev/search?q=personalize) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Personalize resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Personalize.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Personalize](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Personalize.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-personalize/jest.config.js b/packages/@aws-cdk/aws-personalize/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-personalize/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-personalize/lib/index.ts b/packages/@aws-cdk/aws-personalize/lib/index.ts deleted file mode 100644 index a573bd0456934..0000000000000 --- a/packages/@aws-cdk/aws-personalize/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Personalize CloudFormation Resources: -export * from './personalize.generated'; diff --git a/packages/@aws-cdk/aws-personalize/package.json b/packages/@aws-cdk/aws-personalize/package.json deleted file mode 100644 index bc8f75e01ac7b..0000000000000 --- a/packages/@aws-cdk/aws-personalize/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-personalize", - "version": "0.0.0", - "description": "AWS::Personalize Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Personalize", - "packageId": "Amazon.CDK.AWS.Personalize", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.personalize", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "personalize" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-personalize", - "module": "aws_cdk.aws_personalize" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-personalize" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Personalize", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Personalize", - "aws-personalize" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-personalize/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-personalize/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-personalize/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-personalize/test/personalize.test.ts b/packages/@aws-cdk/aws-personalize/test/personalize.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-personalize/test/personalize.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-pinpoint/.eslintrc.js b/packages/@aws-cdk/aws-pinpoint/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-pinpoint/.gitignore b/packages/@aws-cdk/aws-pinpoint/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-pinpoint/.npmignore b/packages/@aws-cdk/aws-pinpoint/.npmignore deleted file mode 100644 index 115d01c3c9529..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/.npmignore +++ /dev/null @@ -1,33 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-pinpoint/LICENSE b/packages/@aws-cdk/aws-pinpoint/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-pinpoint/NOTICE b/packages/@aws-cdk/aws-pinpoint/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-pinpoint/README.md b/packages/@aws-cdk/aws-pinpoint/README.md deleted file mode 100644 index b20e5f411560e..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon Pinpoint Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as pinpoint from '@aws-cdk/aws-pinpoint'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Pinpoint construct libraries](https://constructs.dev/search?q=pinpoint) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Pinpoint resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pinpoint.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Pinpoint](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pinpoint.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-pinpoint/jest.config.js b/packages/@aws-cdk/aws-pinpoint/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-pinpoint/lib/index.ts b/packages/@aws-cdk/aws-pinpoint/lib/index.ts deleted file mode 100644 index 860ecbd39cac3..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Pinpoint CloudFormation Resources: -export * from './pinpoint.generated'; diff --git a/packages/@aws-cdk/aws-pinpoint/package.json b/packages/@aws-cdk/aws-pinpoint/package.json deleted file mode 100644 index b9fd44e6c28a6..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-pinpoint", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Pinpoint", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Pinpoint", - "packageId": "Amazon.CDK.AWS.Pinpoint", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.pinpoint", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "pinpoint" - } - }, - "python": { - "distName": "aws-cdk.aws-pinpoint", - "module": "aws_cdk.aws_pinpoint", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-pinpoint" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Pinpoint", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Pinpoint", - "aws-pinpoint" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-pinpoint/test/pinpoint.test.ts b/packages/@aws-cdk/aws-pinpoint/test/pinpoint.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-pinpoint/test/pinpoint.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-pinpointemail/.eslintrc.js b/packages/@aws-cdk/aws-pinpointemail/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-pinpointemail/.gitignore b/packages/@aws-cdk/aws-pinpointemail/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-pinpointemail/.npmignore b/packages/@aws-cdk/aws-pinpointemail/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-pinpointemail/LICENSE b/packages/@aws-cdk/aws-pinpointemail/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-pinpointemail/NOTICE b/packages/@aws-cdk/aws-pinpointemail/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-pinpointemail/README.md b/packages/@aws-cdk/aws-pinpointemail/README.md deleted file mode 100644 index 039a6605389ab..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon Pinpoint Email Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as pinpointemail from '@aws-cdk/aws-pinpointemail'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for PinpointEmail construct libraries](https://constructs.dev/search?q=pinpointemail) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::PinpointEmail resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_PinpointEmail.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::PinpointEmail](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_PinpointEmail.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-pinpointemail/jest.config.js b/packages/@aws-cdk/aws-pinpointemail/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-pinpointemail/lib/index.ts b/packages/@aws-cdk/aws-pinpointemail/lib/index.ts deleted file mode 100644 index 99c25f25d6bfa..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::PinpointEmail CloudFormation Resources: -export * from './pinpointemail.generated'; diff --git a/packages/@aws-cdk/aws-pinpointemail/package.json b/packages/@aws-cdk/aws-pinpointemail/package.json deleted file mode 100644 index 5f1c39fecd1ab..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-pinpointemail", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::PinpointEmail", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.PinpointEmail", - "packageId": "Amazon.CDK.AWS.PinpointEmail", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.pinpointemail", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "pinpointemail" - } - }, - "python": { - "distName": "aws-cdk.aws-pinpointemail", - "module": "aws_cdk.aws_pinpointemail", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-pinpointemail" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::PinpointEmail", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::PinpointEmail", - "aws-pinpointemail" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-pinpointemail/test/pinpointemail.test.ts b/packages/@aws-cdk/aws-pinpointemail/test/pinpointemail.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-pinpointemail/test/pinpointemail.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-pipes/.eslintrc.js b/packages/@aws-cdk/aws-pipes/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-pipes/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-pipes/.gitignore b/packages/@aws-cdk/aws-pipes/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-pipes/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-pipes/.npmignore b/packages/@aws-cdk/aws-pipes/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-pipes/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-pipes/LICENSE b/packages/@aws-cdk/aws-pipes/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-pipes/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-pipes/NOTICE b/packages/@aws-cdk/aws-pipes/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-pipes/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-pipes/README.md b/packages/@aws-cdk/aws-pipes/README.md deleted file mode 100644 index e2f26a95a16a9..0000000000000 --- a/packages/@aws-cdk/aws-pipes/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Pipes Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as pipes from '@aws-cdk/aws-pipes'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Pipes construct libraries](https://constructs.dev/search?q=pipes) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Pipes resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pipes.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Pipes](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pipes.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-pipes/jest.config.js b/packages/@aws-cdk/aws-pipes/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-pipes/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-pipes/lib/index.ts b/packages/@aws-cdk/aws-pipes/lib/index.ts deleted file mode 100644 index 3dab377f93b15..0000000000000 --- a/packages/@aws-cdk/aws-pipes/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Pipes CloudFormation Resources: -export * from './pipes.generated'; diff --git a/packages/@aws-cdk/aws-pipes/package.json b/packages/@aws-cdk/aws-pipes/package.json deleted file mode 100644 index 811b5c54f3034..0000000000000 --- a/packages/@aws-cdk/aws-pipes/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-pipes", - "version": "0.0.0", - "description": "AWS::Pipes Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Pipes", - "packageId": "Amazon.CDK.AWS.Pipes", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.pipes", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "pipes" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-pipes", - "module": "aws_cdk.aws_pipes" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-pipes" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Pipes", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Pipes", - "aws-pipes" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-pipes/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-pipes/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-pipes/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-pipes/test/pipes.test.ts b/packages/@aws-cdk/aws-pipes/test/pipes.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-pipes/test/pipes.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-qldb/.eslintrc.js b/packages/@aws-cdk/aws-qldb/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-qldb/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-qldb/.gitignore b/packages/@aws-cdk/aws-qldb/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-qldb/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-qldb/.npmignore b/packages/@aws-cdk/aws-qldb/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-qldb/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-qldb/LICENSE b/packages/@aws-cdk/aws-qldb/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-qldb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-qldb/NOTICE b/packages/@aws-cdk/aws-qldb/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-qldb/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-qldb/README.md b/packages/@aws-cdk/aws-qldb/README.md deleted file mode 100644 index b6b2064f663de..0000000000000 --- a/packages/@aws-cdk/aws-qldb/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::QLDB Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as qldb from '@aws-cdk/aws-qldb'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for QLDB construct libraries](https://constructs.dev/search?q=qldb) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::QLDB resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QLDB.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::QLDB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QLDB.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-qldb/jest.config.js b/packages/@aws-cdk/aws-qldb/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-qldb/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-qldb/lib/index.ts b/packages/@aws-cdk/aws-qldb/lib/index.ts deleted file mode 100644 index dad0d33b698fe..0000000000000 --- a/packages/@aws-cdk/aws-qldb/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::QLDB CloudFormation Resources: -export * from './qldb.generated'; diff --git a/packages/@aws-cdk/aws-qldb/package.json b/packages/@aws-cdk/aws-qldb/package.json deleted file mode 100644 index 8b4e079fe8258..0000000000000 --- a/packages/@aws-cdk/aws-qldb/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-qldb", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::QLDB", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.QLDB", - "packageId": "Amazon.CDK.AWS.QLDB", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.qldb", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "qldb" - } - }, - "python": { - "distName": "aws-cdk.aws-qldb", - "module": "aws_cdk.aws_qldb", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-qldb" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::QLDB", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::QLDB", - "aws-qldb" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-qldb/test/qldb.test.ts b/packages/@aws-cdk/aws-qldb/test/qldb.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-qldb/test/qldb.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-quicksight/.eslintrc.js b/packages/@aws-cdk/aws-quicksight/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-quicksight/.gitignore b/packages/@aws-cdk/aws-quicksight/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-quicksight/.npmignore b/packages/@aws-cdk/aws-quicksight/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-quicksight/LICENSE b/packages/@aws-cdk/aws-quicksight/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-quicksight/NOTICE b/packages/@aws-cdk/aws-quicksight/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-quicksight/README.md b/packages/@aws-cdk/aws-quicksight/README.md deleted file mode 100644 index 046d361146c0e..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::QuickSight Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as quicksight from '@aws-cdk/aws-quicksight'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for QuickSight construct libraries](https://constructs.dev/search?q=quicksight) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::QuickSight resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QuickSight.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::QuickSight](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QuickSight.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-quicksight/jest.config.js b/packages/@aws-cdk/aws-quicksight/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-quicksight/lib/index.ts b/packages/@aws-cdk/aws-quicksight/lib/index.ts deleted file mode 100644 index e09acb1d288d8..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::QuickSight CloudFormation Resources: -export * from './quicksight.generated'; diff --git a/packages/@aws-cdk/aws-quicksight/package.json b/packages/@aws-cdk/aws-quicksight/package.json deleted file mode 100644 index 3a6a46e68fbf4..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-quicksight", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::QuickSight", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.QuickSight", - "packageId": "Amazon.CDK.AWS.QuickSight", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.quicksight", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "quicksight" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-quicksight", - "module": "aws_cdk.aws_quicksight" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-quicksight" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::QuickSight", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::QuickSight", - "aws-quicksight" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-quicksight/test/quicksight.test.ts b/packages/@aws-cdk/aws-quicksight/test/quicksight.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-quicksight/test/quicksight.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-ram/.eslintrc.js b/packages/@aws-cdk/aws-ram/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ram/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ram/.gitignore b/packages/@aws-cdk/aws-ram/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-ram/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ram/.npmignore b/packages/@aws-cdk/aws-ram/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/aws-ram/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ram/LICENSE b/packages/@aws-cdk/aws-ram/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ram/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ram/NOTICE b/packages/@aws-cdk/aws-ram/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ram/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ram/README.md b/packages/@aws-cdk/aws-ram/README.md deleted file mode 100644 index 771f77ea357b1..0000000000000 --- a/packages/@aws-cdk/aws-ram/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Resource Access Manager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as ram from '@aws-cdk/aws-ram'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for RAM construct libraries](https://constructs.dev/search?q=ram) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RAM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RAM.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RAM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RAM.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-ram/jest.config.js b/packages/@aws-cdk/aws-ram/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-ram/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ram/lib/index.ts b/packages/@aws-cdk/aws-ram/lib/index.ts deleted file mode 100644 index d3fafe0c7bf37..0000000000000 --- a/packages/@aws-cdk/aws-ram/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::RAM CloudFormation Resources: -export * from './ram.generated'; diff --git a/packages/@aws-cdk/aws-ram/package.json b/packages/@aws-cdk/aws-ram/package.json deleted file mode 100644 index d778818124a6b..0000000000000 --- a/packages/@aws-cdk/aws-ram/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-ram", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::RAM", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.RAM", - "packageId": "Amazon.CDK.AWS.RAM", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.ram", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ram" - } - }, - "python": { - "distName": "aws-cdk.aws-ram", - "module": "aws_cdk.aws_ram", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ram" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RAM", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::RAM", - "aws-ram" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ram/test/ram.test.ts b/packages/@aws-cdk/aws-ram/test/ram.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-ram/test/ram.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-rds/.eslintrc.js b/packages/@aws-cdk/aws-rds/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-rds/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rds/.gitignore b/packages/@aws-cdk/aws-rds/.gitignore deleted file mode 100644 index 1f6a2603bdf03..0000000000000 --- a/packages/@aws-cdk/aws-rds/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-rds/.npmignore b/packages/@aws-cdk/aws-rds/.npmignore deleted file mode 100644 index 3c1ceb7605a65..0000000000000 --- a/packages/@aws-cdk/aws-rds/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -jest.config.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-rds/LICENSE b/packages/@aws-cdk/aws-rds/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-rds/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-rds/NOTICE b/packages/@aws-cdk/aws-rds/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-rds/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-rds/README.md b/packages/@aws-cdk/aws-rds/README.md deleted file mode 100644 index dfe869c045543..0000000000000 --- a/packages/@aws-cdk/aws-rds/README.md +++ /dev/null @@ -1,769 +0,0 @@ -# Amazon Relational Database Service Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -```ts nofixture -import * as rds from '@aws-cdk/aws-rds'; -``` - -## Starting a clustered database - -To set up a clustered database (like Aurora), define a `DatabaseCluster`. You must -always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether -your instances will be launched privately or publicly: - -```ts -declare const vpc: ec2.Vpc; -const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), - credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'), // Optional - will default to 'admin' username and generated password - instanceProps: { - // optional , defaults to t3.medium - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - vpc, - }, -}); -``` - -If there isn't a constant for the exact version you want to use, -all of the `Version` classes have a static `of` method that can be used to create an arbitrary version. - -```ts -const customEngineVersion = rds.AuroraMysqlEngineVersion.of('5.7.mysql_aurora.2.08.1'); -``` - -By default, the master password will be generated and stored in AWS Secrets Manager with auto-generated description. - -Your cluster will be empty by default. To add a default database upon construction, specify the -`defaultDatabaseName` attribute. - -To use dual-stack mode, specify `NetworkType.DUAL` on the `networkType` property: - -```ts -declare const vpc: ec2.Vpc; // VPC and subnets must have IPv6 CIDR blocks -const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_02_1 }), - instanceProps: { - vpc, - publiclyAccessible: false, - }, - networkType: rds.NetworkType.DUAL, -}); -``` - -For more information about dual-stack mode, see [Working with a DB cluster in a VPC](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html). - -Use `DatabaseClusterFromSnapshot` to create a cluster from a snapshot: - -```ts -declare const vpc: ec2.Vpc; -new rds.DatabaseClusterFromSnapshot(this, 'Database', { - engine: rds.DatabaseClusterEngine.aurora({ version: rds.AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', -}); -``` - -### Updating the database instances in a cluster - -Database cluster instances may be updated in bulk or on a rolling basis. - -An update to all instances in a cluster may cause significant downtime. To reduce the downtime, set the `instanceUpdateBehavior` property in `DatabaseClusterBaseProps` to `InstanceUpdateBehavior.ROLLING`. This adds a dependency between each instance so the update is performed on only one instance at a time. - -Use `InstanceUpdateBehavior.BULK` to update all instances at once. - -```ts -declare const vpc: ec2.Vpc; -const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_01_0 }), - instances: 2, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpc, - }, - instanceUpdateBehaviour: rds.InstanceUpdateBehaviour.ROLLING, // Optional - defaults to rds.InstanceUpdateBehaviour.BULK -}); -``` - -## Starting an instance database - -To set up an instance database, define a `DatabaseInstance`. You must -always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether -your instances will be launched privately or publicly: - -```ts -declare const vpc: ec2.Vpc; -const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), - // optional, defaults to m5.large - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - credentials: rds.Credentials.fromGeneratedSecret('syscdk'), // Optional - will default to 'admin' username and generated password - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - } -}); -``` - -If there isn't a constant for the exact engine version you want to use, -all of the `Version` classes have a static `of` method that can be used to create an arbitrary version. - -```ts -const customEngineVersion = rds.OracleEngineVersion.of('19.0.0.0.ru-2020-04.rur-2020-04.r1', '19'); -``` - -By default, the master password will be generated and stored in AWS Secrets Manager. - -To use the storage auto scaling option of RDS you can specify the maximum allocated storage. -This is the upper limit to which RDS can automatically scale the storage. More info can be found -[here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling) -Example for max storage configuration: - -```ts -declare const vpc: ec2.Vpc; -const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - // optional, defaults to m5.large - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - maxAllocatedStorage: 200, -}); -``` - -To use dual-stack mode, specify `NetworkType.DUAL` on the `networkType` property: - -```ts -declare const vpc: ec2.Vpc; // VPC and subnets must have IPv6 CIDR blocks -const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - networkType: rds.NetworkType.DUAL, - publiclyAccessible: false, -}); -``` - -For more information about dual-stack mode, see [Working with a DB instance in a VPC](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html). - -Use `DatabaseInstanceFromSnapshot` and `DatabaseInstanceReadReplica` to create an instance from snapshot or -a source database respectively: - -```ts -declare const vpc: ec2.Vpc; -new rds.DatabaseInstanceFromSnapshot(this, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - // optional, defaults to m5.large - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), - vpc, -}); - -declare const sourceInstance: rds.DatabaseInstance; -new rds.DatabaseInstanceReadReplica(this, 'ReadReplica', { - sourceDatabaseInstance: sourceInstance, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), - vpc, -}); -``` - -Automatic backups of read replica instances are only supported for MySQL and MariaDB. By default, -automatic backups are disabled for read replicas and can only be enabled (using `backupRetention`) -if also enabled on the source instance. - -Creating a "production" Oracle database instance with option and parameter groups: - -[example of setting up a production oracle instance](test/integ.instance.lit.ts) - -Use the `storageType` property to specify the [type of storage](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html) -to use for the instance: - -```ts -declare const vpc: ec2.Vpc; - -const iopsInstance = new rds.DatabaseInstance(this, 'IopsInstance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: MysqlEngineVersion.VER_8_0_30 }), - vpc, - storageType: rds.StorageType.IO1, - iops: 5000, -}); - -const gp3Instance = new rds.DatabaseInstance(this, 'Gp3Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: MysqlEngineVersion.VER_8_0_30 }), - vpc, - allocatedStorage: 500, - storageType: rds.StorageType.GP3, - storageThroughput: 500, // only applicable for GP3 -}); -``` - -## Setting Public Accessibility - -You can set public accessibility for the database instance or cluster using the `publiclyAccessible` property. -If you specify `true`, it creates an instance with a publicly resolvable DNS name, which resolves to a public IP address. -If you specify `false`, it creates an internal instance with a DNS name that resolves to a private IP address. -The default value depends on `vpcSubnets`. -It will be `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise. - -```ts -declare const vpc: ec2.Vpc; -// Setting public accessibility for DB instance -new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - publiclyAccessible: true, -}); - -// Setting public accessibility for DB cluster -new rds.DatabaseCluster(this, 'DatabaseCluster', { - engine: rds.DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - publiclyAccessible: true, - }, -}); -``` - -## Instance events - -To define Amazon CloudWatch event rules for database instances, use the `onEvent` -method: - -```ts -declare const instance: rds.DatabaseInstance; -declare const fn: lambda.Function; -const rule = instance.onEvent('InstanceEvent', { target: new targets.LambdaFunction(fn) }); -``` - -## Login credentials - -By default, database instances and clusters (with the exception of `DatabaseInstanceFromSnapshot` and `ServerlessClusterFromSnapshot`) will have `admin` user with an auto-generated password. -An alternative username (and password) may be specified for the admin user instead of the default. - -The following examples use a `DatabaseInstance`, but the same usage is applicable to `DatabaseCluster`. - -```ts -declare const vpc: ec2.Vpc; -const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); -new rds.DatabaseInstance(this, 'InstanceWithUsername', { - engine, - vpc, - credentials: rds.Credentials.fromGeneratedSecret('postgres'), // Creates an admin user of postgres with a generated password -}); - -new rds.DatabaseInstance(this, 'InstanceWithUsernameAndPassword', { - engine, - vpc, - credentials: rds.Credentials.fromPassword('postgres', SecretValue.ssmSecure('/dbPassword', '1')), // Use password from SSM -}); - -const mySecret = secretsmanager.Secret.fromSecretName(this, 'DBSecret', 'myDBLoginInfo'); -new rds.DatabaseInstance(this, 'InstanceWithSecretLogin', { - engine, - vpc, - credentials: rds.Credentials.fromSecret(mySecret), // Get both username and password from existing secret -}); -``` - -Secrets generated by `fromGeneratedSecret()` can be customized: - -```ts -declare const vpc: ec2.Vpc; -const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); -const myKey = new kms.Key(this, 'MyKey'); - -new rds.DatabaseInstance(this, 'InstanceWithCustomizedSecret', { - engine, - vpc, - credentials: rds.Credentials.fromGeneratedSecret('postgres', { - secretName: 'my-cool-name', - encryptionKey: myKey, - excludeCharacters: '!&*^#@()', - replicaRegions: [{ region: 'eu-west-1' }, { region: 'eu-west-2' }], - }), -}); -``` - -### Snapshot credentials - -As noted above, Databases created with `DatabaseInstanceFromSnapshot` or `ServerlessClusterFromSnapshot` will not create user and auto-generated password by default because it's not possible to change the master username for a snapshot. Instead, they will use the existing username and password from the snapshot. You can still generate a new password - to generate a secret similarly to the other constructs, pass in credentials with `fromGeneratedSecret()` or `fromGeneratedPassword()`. - -```ts -declare const vpc: ec2.Vpc; -const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); -const myKey = new kms.Key(this, 'MyKey'); - -new rds.DatabaseInstanceFromSnapshot(this, 'InstanceFromSnapshotWithCustomizedSecret', { - engine, - vpc, - snapshotIdentifier: 'mySnapshot', - credentials: rds.SnapshotCredentials.fromGeneratedSecret('username', { - encryptionKey: myKey, - excludeCharacters: '!&*^#@()', - replicaRegions: [{ region: 'eu-west-1' }, { region: 'eu-west-2' }], - }), -}); -``` - -## Connecting - -To control who can access the cluster or instance, use the `.connections` attribute. RDS databases have -a default port, so you don't need to specify the port: - -```ts -declare const cluster: rds.DatabaseCluster; -cluster.connections.allowFromAnyIpv4(ec2.Port.allTraffic(), 'Open to the world'); -``` - -The endpoints to access your database cluster will be available as the `.clusterEndpoint` and `.readerEndpoint` -attributes: - -```ts -declare const cluster: rds.DatabaseCluster; -const writeAddress = cluster.clusterEndpoint.socketAddress; // "HOSTNAME:PORT" -``` - -For an instance database: - -```ts -declare const instance: rds.DatabaseInstance; -const address = instance.instanceEndpoint.socketAddress; // "HOSTNAME:PORT" -``` - -## Rotating credentials - -When the master password is generated and stored in AWS Secrets Manager, it can be rotated automatically: - -```ts -import * as cdk from '@aws-cdk/core'; - -declare const instance: rds.DatabaseInstance; -declare const mySecurityGroup: ec2.SecurityGroup; -instance.addRotationSingleUser({ - automaticallyAfter: cdk.Duration.days(7), // defaults to 30 days - excludeCharacters: '!@#$%^&*', // defaults to the set " %+~`#$&*()|[]{}:;<>?!'/@\"\\" - securityGroup: mySecurityGroup, // defaults to an auto-created security group -}); -``` - -[example of setting up master password rotation for a cluster](test/integ.cluster-rotation.lit.ts) - -The multi user rotation scheme is also available: - -```ts -declare const instance: rds.DatabaseInstance; -declare const myImportedSecret: rds.DatabaseSecret; -instance.addRotationMultiUser('MyUser', { - secret: myImportedSecret, // This secret must have the `masterarn` key -}); -``` - -It's also possible to create user credentials together with the instance/cluster and add rotation: - -```ts -declare const instance: rds.DatabaseInstance; -const myUserSecret = new rds.DatabaseSecret(this, 'MyUserSecret', { - username: 'myuser', - secretName: 'my-user-secret', // optional, defaults to a CloudFormation-generated name - dbname: 'mydb', //optional, defaults to the main database of the RDS cluster this secret gets attached to - masterSecret: instance.secret, - excludeCharacters: '{}[]()\'"/\\', // defaults to the set " %+~`#$&*()|[]{}:;<>?!'/@\"\\" -}); -const myUserSecretAttached = myUserSecret.attach(instance); // Adds DB connections information in the secret - -instance.addRotationMultiUser('MyUser', { // Add rotation using the multi user scheme - secret: myUserSecretAttached, -}); -``` - -**Note**: This user must be created manually in the database using the master credentials. -The rotation will start as soon as this user exists. - -Access to the Secrets Manager API is required for the secret rotation. This can be achieved either with -internet connectivity (through NAT) or with a VPC interface endpoint. By default, the rotation Lambda function -is deployed in the same subnets as the instance/cluster. If access to the Secrets Manager API is not possible from -those subnets or using the default API endpoint, use the `vpcSubnets` and/or `endpoint` options: - -```ts -declare const instance: rds.DatabaseInstance; -declare const myEndpoint: ec2.InterfaceVpcEndpoint; - -instance.addRotationSingleUser({ - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, // Place rotation Lambda in private subnets - endpoint: myEndpoint, // Use VPC interface endpoint -}); -``` - -See also [@aws-cdk/aws-secretsmanager](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-secretsmanager/README.md) for credentials rotation of existing clusters/instances. - -## IAM Authentication - -You can also authenticate to a database instance using AWS Identity and Access Management (IAM) database authentication; -See for more information -and a list of supported versions and limitations. - -**Note**: `grantConnect()` does not currently work - see [this GitHub issue](https://github.com/aws/aws-cdk/issues/11851). - -The following example shows enabling IAM authentication for a database instance and granting connection access to an IAM role. - -```ts -declare const vpc: ec2.Vpc; -const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - iamAuthentication: true, // Optional - will be automatically set if you call grantConnect(). -}); -const role = new iam.Role(this, 'DBRole', { assumedBy: new iam.AccountPrincipal(this.account) }); -instance.grantConnect(role); // Grant the role connection access to the DB. -``` - -The following example shows granting connection access for RDS Proxy to an IAM role. - -```ts -declare const vpc: ec2.Vpc; -const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.AURORA, - instanceProps: { vpc }, -}); - -const proxy = new rds.DatabaseProxy(this, 'Proxy', { - proxyTarget: rds.ProxyTarget.fromCluster(cluster), - secrets: [cluster.secret!], - vpc, -}); - -const role = new iam.Role(this, 'DBProxyRole', { assumedBy: new iam.AccountPrincipal(this.account) }); -proxy.grantConnect(role, 'admin'); // Grant the role connection access to the DB Proxy for database user 'admin'. -``` - -**Note**: In addition to the setup above, a database user will need to be created to support IAM auth. -See for setup instructions. - -## Kerberos Authentication - -You can also authenticate using Kerberos to a database instance using AWS Managed Microsoft AD for authentication; -See for more information -and a list of supported versions and limitations. - -The following example shows enabling domain support for a database instance and creating an IAM role to access -Directory Services. - -```ts -declare const vpc: ec2.Vpc; -const role = new iam.Role(this, 'RDSDirectoryServicesRole', { - assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), - managedPolicies: [ - iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSDirectoryServiceAccess'), - ], -}); -const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - domain: 'd-????????', // The ID of the domain for the instance to join. - domainRole: role, // Optional - will be create automatically if not provided. -}); -``` - -**Note**: In addition to the setup above, you need to make sure that the database instance has network connectivity -to the domain controllers. This includes enabling cross-VPC traffic if in a different VPC and setting up the -appropriate security groups/network ACL to allow traffic between the database instance and domain controllers. -Once configured, see for details -on configuring users for each available database engine. - -## Metrics - -Database instances and clusters both expose metrics (`cloudwatch.Metric`): - -```ts -// The number of database connections in use (average over 5 minutes) -declare const instance: rds.DatabaseInstance; -const dbConnections = instance.metricDatabaseConnections(); - -// Average CPU utilization over 5 minutes -declare const cluster: rds.DatabaseCluster; -const cpuUtilization = cluster.metricCPUUtilization(); - -// The average amount of time taken per disk I/O operation (average over 1 minute) -const readLatency = instance.metric('ReadLatency', { statistic: 'Average', period: Duration.seconds(60) }); -``` - -## Enabling S3 integration - -Data in S3 buckets can be imported to and exported from certain database engines using SQL queries. To enable this -functionality, set the `s3ImportBuckets` and `s3ExportBuckets` properties for import and export respectively. When -configured, the CDK automatically creates and configures IAM roles as required. -Additionally, the `s3ImportRole` and `s3ExportRole` properties can be used to set this role directly. - -You can read more about loading data to (or from) S3 here: - -* Aurora MySQL - [import](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html) - and [export](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html). -* Aurora PostgreSQL - [import](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html#USER_PostgreSQL.S3Import) - and [export](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html). -* Microsoft SQL Server - [import and export](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html) -* PostgreSQL - [import](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html) - and [export](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) -* Oracle - [import and export](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html) - -The following snippet sets up a database cluster with different S3 buckets where the data is imported and exported - - -```ts -import * as s3 from '@aws-cdk/aws-s3'; - -declare const vpc: ec2.Vpc; -const importBucket = new s3.Bucket(this, 'importbucket'); -const exportBucket = new s3.Bucket(this, 'exportbucket'); -new rds.DatabaseCluster(this, 'dbcluster', { - engine: rds.DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - }, - s3ImportBuckets: [importBucket], - s3ExportBuckets: [exportBucket], -}); -``` - -## Creating a Database Proxy - -Amazon RDS Proxy sits between your application and your relational database to efficiently manage -connections to the database and improve scalability of the application. Learn more about at [Amazon RDS Proxy](https://aws.amazon.com/rds/proxy/) - -The following code configures an RDS Proxy for a `DatabaseInstance`. - -```ts -declare const vpc: ec2.Vpc; -declare const securityGroup: ec2.SecurityGroup; -declare const secrets: secretsmanager.Secret[]; -declare const dbInstance: rds.DatabaseInstance; - -const proxy = dbInstance.addProxy('proxy', { - borrowTimeout: Duration.seconds(30), - maxConnectionsPercent: 50, - secrets, - vpc, -}); -``` - -## Exporting Logs - -You can publish database logs to Amazon CloudWatch Logs. With CloudWatch Logs, you can perform real-time analysis of the log data, -store the data in highly durable storage, and manage the data with the CloudWatch Logs Agent. This is available for both database -instances and clusters; the types of logs available depend on the database type and engine being used. - -```ts -import * as logs from '@aws-cdk/aws-logs'; -declare const myLogsPublishingRole: iam.Role; -declare const vpc: ec2.Vpc; - -// Exporting logs from a cluster -const cluster = new rds.DatabaseCluster(this, 'Database', { - engine: rds.DatabaseClusterEngine.aurora({ - version: rds.AuroraEngineVersion.VER_1_17_9, // different version class for each engine type - }), - instanceProps: { - vpc, - }, - cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], // Export all available MySQL-based logs - cloudwatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs - cloudwatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided - // ... -}); - -// Exporting logs from an instance -const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.postgres({ - version: rds.PostgresEngineVersion.VER_15_2, - }), - vpc, - cloudwatchLogsExports: ['postgresql'], // Export the PostgreSQL logs - // ... -}); -``` - -## Option Groups - -Some DB engines offer additional features that make it easier to manage data and databases, and to provide additional security for your database. -Amazon RDS uses option groups to enable and configure these features. An option group can specify features, called options, -that are available for a particular Amazon RDS DB instance. - -```ts -declare const vpc: ec2.Vpc; -declare const securityGroup: ec2.SecurityGroup; - -new rds.OptionGroup(this, 'Options', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ - version: rds.OracleEngineVersion.VER_19, - }), - configurations: [ - { - name: 'OEM', - port: 5500, - vpc, - securityGroups: [securityGroup], // Optional - a default group will be created if not provided. - }, - ], -}); -``` - -## Parameter Groups - -Database parameters specify how the database is configured. -For example, database parameters can specify the amount of resources, such as memory, to allocate to a database. -You manage your database configuration by associating your DB instances with parameter groups. -Amazon RDS defines parameter groups with default settings. - -You can create your own parameter group for your cluster or instance and associate it with your database: - -```ts -declare const vpc: ec2.Vpc; - -const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ - version: rds.SqlServerEngineVersion.VER_11, - }), - parameters: { - locks: '100', - }, -}); - -new rds.DatabaseInstance(this, 'Database', { - engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, - vpc, - parameterGroup, -}); -``` - -Another way to specify parameters is to use the inline field `parameters` that creates an RDS parameter group for you. -You can use this if you do not want to reuse the parameter group instance for different instances: - -```ts -declare const vpc: ec2.Vpc; - -new rds.DatabaseInstance(this, 'Database', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_11 }), - vpc, - parameters: { - locks: '100', - }, -}); -``` - -You cannot specify a parameter map and a parameter group at the same time. - -## Serverless - -[Amazon Aurora Serverless](https://aws.amazon.com/rds/aurora/serverless/) is an on-demand, auto-scaling configuration for Amazon -Aurora. The database will automatically start up, shut down, and scale capacity -up or down based on your application's needs. It enables you to run your database -in the cloud without managing any database instances. - -The following example initializes an Aurora Serverless PostgreSql cluster. -Aurora Serverless clusters can specify scaling properties which will be used to -automatically scale the database cluster seamlessly based on the workload. - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', { - engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL, - copyTagsToSnapshot: true, // whether to save the cluster tags when creating the snapshot. Default is 'true' - parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql10'), - vpc, - scaling: { - autoPause: Duration.minutes(10), // default is to pause after 5 minutes of idle time - minCapacity: rds.AuroraCapacityUnit.ACU_8, // default is 2 Aurora capacity units (ACUs) - maxCapacity: rds.AuroraCapacityUnit.ACU_32, // default is 16 Aurora capacity units (ACUs) - } -}); -``` - -Aurora Serverless Clusters do not support the following features: - -* Loading data from an Amazon S3 bucket -* Saving data to an Amazon S3 bucket -* Invoking an AWS Lambda function with an Aurora MySQL native function -* Aurora replicas -* Backtracking -* Multi-master clusters -* Database cloning -* IAM database cloning -* IAM database authentication -* Restoring a snapshot from MySQL DB instance -* Performance Insights -* RDS Proxy - -Read more about the [limitations of Aurora Serverless](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html#aurora-serverless.limitations) - -Learn more about using Amazon Aurora Serverless by reading the [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html) - -Use `ServerlessClusterFromSnapshot` to create a serverless cluster from a snapshot: - -```ts -declare const vpc: ec2.Vpc; -new rds.ServerlessClusterFromSnapshot(this, 'Cluster', { - engine: rds.DatabaseClusterEngine.AURORA_MYSQL, - vpc, - snapshotIdentifier: 'mySnapshot', -}); -``` - -### Data API - -You can access your Aurora Serverless DB cluster using the built-in Data API. The Data API doesn't require a persistent connection to the DB cluster. Instead, it provides a secure HTTP endpoint and integration with AWS SDKs. - -The following example shows granting Data API access to a Lamba function. - -```ts -declare const vpc: ec2.Vpc; - -const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', { - engine: rds.DatabaseClusterEngine.AURORA_MYSQL, - vpc, // this parameter is optional for serverless Clusters - enableDataApi: true, // Optional - will be automatically set if you call grantDataApiAccess() -}); - -declare const code: lambda.Code; -const fn = new lambda.Function(this, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code, - environment: { - CLUSTER_ARN: cluster.clusterArn, - SECRET_ARN: cluster.secret!.secretArn, - }, -}); -cluster.grantDataApiAccess(fn); -``` - -**Note**: To invoke the Data API, the resource will need to read the secret associated with the cluster. - -To learn more about using the Data API, see the [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html). - -### Default VPC - -The `vpc` parameter is optional. - -If not provided, the cluster will be created in the default VPC of the account and region. -As this VPC is not deployed with AWS CDK, you can't configure the `vpcSubnets`, `subnetGroup` or `securityGroups` of the Aurora Serverless Cluster. -If you want to provide one of `vpcSubnets`, `subnetGroup` or `securityGroups` parameter, please provide a `vpc`. diff --git a/packages/@aws-cdk/aws-rds/jest.config.js b/packages/@aws-cdk/aws-rds/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-rds/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts b/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts deleted file mode 100644 index c5f5a0155dd2e..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts +++ /dev/null @@ -1,125 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { IResource } from '@aws-cdk/core'; -import { IClusterEngine } from './cluster-engine'; -import { Endpoint } from './endpoint'; -import { DatabaseProxy, DatabaseProxyOptions } from './proxy'; - -/** - * Create a clustered database with a given number of instances. - */ -export interface IDatabaseCluster extends IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { - /** - * Identifier of the cluster - */ - readonly clusterIdentifier: string; - - /** - * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. - * - * This AWS Region-unique identifier is used in things like IAM authentication policies. - */ - readonly clusterResourceIdentifier: string; - - /** - * Identifiers of the replicas - */ - readonly instanceIdentifiers: string[]; - - /** - * The endpoint to use for read/write operations - * @attribute EndpointAddress,EndpointPort - */ - readonly clusterEndpoint: Endpoint; - - /** - * Endpoint to use for load-balanced read-only operations. - * @attribute ReadEndpointAddress - */ - readonly clusterReadEndpoint: Endpoint; - - /** - * Endpoints which address each individual replica. - */ - readonly instanceEndpoints: Endpoint[]; - - /** - * The engine of this Cluster. - * May be not known for imported Clusters if it wasn't provided explicitly. - */ - readonly engine?: IClusterEngine; - - /** - * Add a new db proxy to this cluster. - */ - addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy; -} - -/** - * Properties that describe an existing cluster instance - */ -export interface DatabaseClusterAttributes { - /** - * Identifier for the cluster - */ - readonly clusterIdentifier: string; - - /** - * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. - * - * This AWS Region-unique identifier is used to grant access to the cluster. - * - * @default none - */ - readonly clusterResourceIdentifier?: string; - - /** - * The database port - * - * @default - none - */ - readonly port?: number; - - /** - * The security groups of the database cluster - * - * @default - no security groups - */ - readonly securityGroups?: ec2.ISecurityGroup[]; - - /** - * Identifier for the instances - * - * @default - no instance identifiers - */ - readonly instanceIdentifiers?: string[]; - // Actual underlying type: DBInstanceId[], but we have to type it more loosely for Java's benefit. - - /** - * Cluster endpoint address - * - * @default - no endpoint address - */ - readonly clusterEndpointAddress?: string; - - /** - * Reader endpoint address - * - * @default - no reader address - */ - readonly readerEndpointAddress?: string; - - /** - * Endpoint addresses of individual instances - * - * @default - no instance endpoints - */ - readonly instanceEndpointAddresses?: string[]; - - /** - * The engine of the existing Cluster. - * - * @default - the imported Cluster's engine is unknown - */ - readonly engine?: IClusterEngine; -} diff --git a/packages/@aws-cdk/aws-rds/lib/cluster.ts b/packages/@aws-cdk/aws-rds/lib/cluster.ts deleted file mode 100644 index af6b42629f803..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/cluster.ts +++ /dev/null @@ -1,973 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IRole, ManagedPolicy, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Annotations, Duration, FeatureFlags, RemovalPolicy, Resource, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { IClusterEngine } from './cluster-engine'; -import { DatabaseClusterAttributes, IDatabaseCluster } from './cluster-ref'; -import { DatabaseSecret } from './database-secret'; -import { Endpoint } from './endpoint'; -import { NetworkType } from './instance'; -import { IParameterGroup, ParameterGroup } from './parameter-group'; -import { applyDefaultRotationOptions, defaultDeletionProtection, renderCredentials, setupS3ImportExport, helperRemovalPolicy, renderUnless } from './private/util'; -import { BackupProps, Credentials, InstanceProps, PerformanceInsightRetention, RotationSingleUserOptions, RotationMultiUserOptions, SnapshotCredentials } from './props'; -import { DatabaseProxy, DatabaseProxyOptions, ProxyTarget } from './proxy'; -import { CfnDBCluster, CfnDBClusterProps, CfnDBInstance } from './rds.generated'; -import { ISubnetGroup, SubnetGroup } from './subnet-group'; - -/** - * Common properties for a new database cluster or cluster from snapshot. - */ -interface DatabaseClusterBaseProps { - /** - * What kind of database to start - */ - readonly engine: IClusterEngine; - - /** - * How many replicas/instances to create - * - * Has to be at least 1. - * - * @default 2 - */ - readonly instances?: number; - - /** - * Settings for the individual instances that are launched - */ - readonly instanceProps: InstanceProps; - - /** - * The ordering of updates for instances - * - * @default InstanceUpdateBehaviour.BULK - */ - readonly instanceUpdateBehaviour?: InstanceUpdateBehaviour; - - /** - * The number of seconds to set a cluster's target backtrack window to. - * This feature is only supported by the Aurora MySQL database engine and - * cannot be enabled on existing clusters. - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html - * @default 0 seconds (no backtrack) - */ - readonly backtrackWindow?: Duration - - /** - * Backup settings - * - * @default - Backup retention period for automated backups is 1 day. - * Backup preferred window is set to a 30-minute window selected at random from an - * 8-hour block of time for each AWS Region, occurring on a random day of the week. - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow - */ - readonly backup?: BackupProps; - - /** - * What port to listen on - * - * @default - The default for the engine is used. - */ - readonly port?: number; - - /** - * An optional identifier for the cluster - * - * @default - A name is automatically generated. - */ - readonly clusterIdentifier?: string; - - /** - * Base identifier for instances - * - * Every replica is named by appending the replica number to this string, 1-based. - * - * @default - clusterIdentifier is used with the word "Instance" appended. - * If clusterIdentifier is not provided, the identifier is automatically generated. - */ - readonly instanceIdentifierBase?: string; - - /** - * Name of a database which is automatically created inside the cluster - * - * @default - Database is not created in cluster. - */ - readonly defaultDatabaseName?: string; - - /** - * Indicates whether the DB cluster should have deletion protection enabled. - * - * @default - true if ``removalPolicy`` is RETAIN, false otherwise - */ - readonly deletionProtection?: boolean; - - /** - * A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). - * - * Example: 'Sun:23:45-Mon:00:15' - * - * @default - 30-minute window selected at random from an 8-hour block of time for - * each AWS Region, occurring on a random day of the week. - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance - */ - readonly preferredMaintenanceWindow?: string; - - /** - * Additional parameters to pass to the database engine - * - * @default - No parameter group. - */ - readonly parameterGroup?: IParameterGroup; - - /** - * The parameters in the DBClusterParameterGroup to create automatically - * - * You can only specify parameterGroup or parameters but not both. - * You need to use a versioned engine to auto-generate a DBClusterParameterGroup. - * - * @default - None - */ - readonly parameters?: { [key: string]: string }; - - /** - * The removal policy to apply when the cluster and its instances are removed - * from the stack or replaced during an update. - * - * @default - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data) - */ - readonly removalPolicy?: RemovalPolicy; - - /** - * The list of log types that need to be enabled for exporting to - * CloudWatch Logs. - * - * @default - no log exports - */ - readonly cloudwatchLogsExports?: string[]; - - /** - * The number of days log events are kept in CloudWatch Logs. When updating - * this property, unsetting it doesn't remove the log retention policy. To - * remove the retention policy, set the value to `Infinity`. - * - * @default - logs never expire - */ - readonly cloudwatchLogsRetention?: logs.RetentionDays; - - /** - * The IAM role for the Lambda function associated with the custom resource - * that sets the retention policy. - * - * @default - a new role is created. - */ - readonly cloudwatchLogsRetentionRole?: IRole; - - /** - * The interval, in seconds, between points when Amazon RDS collects enhanced - * monitoring metrics for the DB instances. - * - * @default no enhanced monitoring - */ - readonly monitoringInterval?: Duration; - - /** - * Role that will be used to manage DB instances monitoring. - * - * @default - A role is automatically created for you - */ - readonly monitoringRole?: IRole; - - /** - * Role that will be associated with this DB cluster to enable S3 import. - * This feature is only supported by the Aurora database engine. - * - * This property must not be used if `s3ImportBuckets` is used. - * - * For MySQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html - * - * For PostgreSQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html - * - * @default - New role is created if `s3ImportBuckets` is set, no role is defined otherwise - */ - readonly s3ImportRole?: IRole; - - /** - * S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. - * - * This property must not be used if `s3ImportRole` is used. - * - * For MySQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html - * - * For PostgreSQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html - * - * @default - None - */ - readonly s3ImportBuckets?: s3.IBucket[]; - - /** - * Role that will be associated with this DB cluster to enable S3 export. - * This feature is only supported by the Aurora database engine. - * - * This property must not be used if `s3ExportBuckets` is used. - * - * For MySQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html - * - * For PostgreSQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html - * - * @default - New role is created if `s3ExportBuckets` is set, no role is defined otherwise - */ - readonly s3ExportRole?: IRole; - - /** - * S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. - * - * This property must not be used if `s3ExportRole` is used. - * - * For MySQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html - * - * For PostgreSQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html - * - * @default - None - */ - readonly s3ExportBuckets?: s3.IBucket[]; - - /** - * Existing subnet group for the cluster. - * - * @default - a new subnet group will be created. - */ - readonly subnetGroup?: ISubnetGroup; - - /** - * Whether to enable mapping of AWS Identity and Access Management (IAM) accounts - * to database accounts. - * - * @default false - */ - readonly iamAuthentication?: boolean; - - /** - * Whether to enable storage encryption. - * - * @default - true if storageEncryptionKey is provided, false otherwise - */ - readonly storageEncrypted?: boolean - - /** - * The KMS key for storage encryption. - * If specified, `storageEncrypted` will be set to `true`. - * - * @default - if storageEncrypted is true then the default master key, no key otherwise - */ - readonly storageEncryptionKey?: kms.IKey; - - /** - * Whether to copy tags to the snapshot when a snapshot is created. - * - * @default - true - */ - readonly copyTagsToSnapshot?: boolean; - - /** - * The network type of the DB instance. - * - * @default - IPV4 - */ - readonly networkType?: NetworkType; -} - -/** - * The orchestration of updates of multiple instances - */ -export enum InstanceUpdateBehaviour { - /** - * In a bulk update, all instances of the cluster are updated at the same time. - * This results in a faster update procedure. - * During the update, however, all instances might be unavailable at the same time and thus a downtime might occur. - */ - BULK = 'BULK', - - /** - * In a rolling update, one instance after another is updated. - * This results in at most one instance being unavailable during the update. - * If your cluster consists of more than 1 instance, the downtime periods are limited to the time a primary switch needs. - */ - ROLLING = 'ROLLING' -} - -/** - * A new or imported clustered database. - */ -export abstract class DatabaseClusterBase extends Resource implements IDatabaseCluster { - // only required because of JSII bug: https://github.com/aws/jsii/issues/2040 - public abstract readonly engine?: IClusterEngine; - - /** - * Identifier of the cluster - */ - public abstract readonly clusterIdentifier: string; - - /** - * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. - * - * This AWS Region-unique identifier is used in things like IAM authentication policies. - */ - public abstract readonly clusterResourceIdentifier: string; - - /** - * Identifiers of the replicas - */ - public abstract readonly instanceIdentifiers: string[]; - - /** - * The endpoint to use for read/write operations - */ - public abstract readonly clusterEndpoint: Endpoint; - - /** - * Endpoint to use for load-balanced read-only operations. - */ - public abstract readonly clusterReadEndpoint: Endpoint; - - /** - * Endpoints which address each individual replica. - */ - public abstract readonly instanceEndpoints: Endpoint[]; - - /** - * Access to the network connections - */ - public abstract readonly connections: ec2.Connections; - - /** - * Add a new db proxy to this cluster. - */ - public addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy { - return new DatabaseProxy(this, id, { - proxyTarget: ProxyTarget.fromCluster(this), - ...options, - }); - } - - /** - * Renders the secret attachment target specifications. - */ - public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { - return { - targetId: this.clusterIdentifier, - targetType: secretsmanager.AttachmentTargetType.RDS_DB_CLUSTER, - }; - } -} - -/** - * Abstract base for ``DatabaseCluster`` and ``DatabaseClusterFromSnapshot`` - */ -abstract class DatabaseClusterNew extends DatabaseClusterBase { - /** - * The engine for this Cluster. - * Never undefined. - */ - public readonly engine?: IClusterEngine; - - protected readonly newCfnProps: CfnDBClusterProps; - protected readonly securityGroups: ec2.ISecurityGroup[]; - protected readonly subnetGroup: ISubnetGroup; - - /** - * Secret in SecretsManager to store the database cluster user credentials. - */ - public abstract readonly secret?: secretsmanager.ISecret; - - /** - * The VPC network to place the cluster in. - */ - public readonly vpc: ec2.IVpc; - - /** - * The cluster's subnets. - */ - public readonly vpcSubnets?: ec2.SubnetSelection; - - /** - * Application for single user rotation of the master password to this cluster. - */ - public readonly singleUserRotationApplication: secretsmanager.SecretRotationApplication; - - /** - * Application for multi user rotation to this cluster. - */ - public readonly multiUserRotationApplication: secretsmanager.SecretRotationApplication; - - constructor(scope: Construct, id: string, props: DatabaseClusterBaseProps) { - super(scope, id); - - this.vpc = props.instanceProps.vpc; - this.vpcSubnets = props.instanceProps.vpcSubnets; - - this.singleUserRotationApplication = props.engine.singleUserRotationApplication; - this.multiUserRotationApplication = props.engine.multiUserRotationApplication; - - const { subnetIds } = props.instanceProps.vpc.selectSubnets(props.instanceProps.vpcSubnets); - - // Cannot test whether the subnets are in different AZs, but at least we can test the amount. - if (subnetIds.length < 2) { - Annotations.of(this).addError(`Cluster requires at least 2 subnets, got ${subnetIds.length}`); - } - - this.subnetGroup = props.subnetGroup ?? new SubnetGroup(this, 'Subnets', { - description: `Subnets for ${id} database`, - vpc: props.instanceProps.vpc, - vpcSubnets: props.instanceProps.vpcSubnets, - removalPolicy: renderUnless(helperRemovalPolicy(props.removalPolicy), RemovalPolicy.DESTROY), - }); - - this.securityGroups = props.instanceProps.securityGroups ?? [ - new ec2.SecurityGroup(this, 'SecurityGroup', { - description: 'RDS security group', - vpc: props.instanceProps.vpc, - }), - ]; - - const combineRoles = props.engine.combineImportAndExportRoles ?? false; - let { s3ImportRole, s3ExportRole } = setupS3ImportExport(this, props, combineRoles); - - if (props.parameterGroup && props.parameters) { - throw new Error('You cannot specify both parameterGroup and parameters'); - } - const parameterGroup = props.parameterGroup ?? ( - props.parameters - ? new ParameterGroup(this, 'ParameterGroup', { - engine: props.engine, - parameters: props.parameters, - }) - : undefined - ); - // bind the engine to the Cluster - const clusterEngineBindConfig = props.engine.bindToCluster(this, { - s3ImportRole, - s3ExportRole, - parameterGroup, - }); - - const clusterAssociatedRoles: CfnDBCluster.DBClusterRoleProperty[] = []; - if (s3ImportRole) { - clusterAssociatedRoles.push({ roleArn: s3ImportRole.roleArn, featureName: clusterEngineBindConfig.features?.s3Import }); - } - if (s3ExportRole && - // only add the second associated Role if it's different than the first - // (duplicates in the associated Roles array are not allowed by the RDS service) - (s3ExportRole !== s3ImportRole || - clusterEngineBindConfig.features?.s3Import !== clusterEngineBindConfig.features?.s3Export)) { - clusterAssociatedRoles.push({ roleArn: s3ExportRole.roleArn, featureName: clusterEngineBindConfig.features?.s3Export }); - } - - const clusterParameterGroup = props.parameterGroup ?? clusterEngineBindConfig.parameterGroup; - const clusterParameterGroupConfig = clusterParameterGroup?.bindToCluster({}); - this.engine = props.engine; - - const clusterIdentifier = FeatureFlags.of(this).isEnabled(cxapi.RDS_LOWERCASE_DB_IDENTIFIER) && !Token.isUnresolved(props.clusterIdentifier) - ? props.clusterIdentifier?.toLowerCase() - : props.clusterIdentifier; - - this.newCfnProps = { - // Basic - engine: props.engine.engineType, - engineVersion: props.engine.engineVersion?.fullVersion, - dbClusterIdentifier: clusterIdentifier, - dbSubnetGroupName: this.subnetGroup.subnetGroupName, - vpcSecurityGroupIds: this.securityGroups.map(sg => sg.securityGroupId), - port: props.port ?? clusterEngineBindConfig.port, - dbClusterParameterGroupName: clusterParameterGroupConfig?.parameterGroupName, - associatedRoles: clusterAssociatedRoles.length > 0 ? clusterAssociatedRoles : undefined, - deletionProtection: defaultDeletionProtection(props.deletionProtection, props.removalPolicy), - enableIamDatabaseAuthentication: props.iamAuthentication, - networkType: props.networkType, - // Admin - backtrackWindow: props.backtrackWindow?.toSeconds(), - backupRetentionPeriod: props.backup?.retention?.toDays(), - preferredBackupWindow: props.backup?.preferredWindow, - preferredMaintenanceWindow: props.preferredMaintenanceWindow, - databaseName: props.defaultDatabaseName, - enableCloudwatchLogsExports: props.cloudwatchLogsExports, - // Encryption - kmsKeyId: props.storageEncryptionKey?.keyArn, - storageEncrypted: props.storageEncryptionKey ? true : props.storageEncrypted, - // Tags - copyTagsToSnapshot: props.copyTagsToSnapshot ?? true, - }; - } - - /** - * Adds the single user rotation of the master password to this cluster. - * See [Single user rotation strategy](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-one-user-one-password) - */ - public addRotationSingleUser(options: RotationSingleUserOptions = {}): secretsmanager.SecretRotation { - if (!this.secret) { - throw new Error('Cannot add a single user rotation for a cluster without a secret.'); - } - - const id = 'RotationSingleUser'; - const existing = this.node.tryFindChild(id); - if (existing) { - throw new Error('A single user rotation was already added to this cluster.'); - } - - return new secretsmanager.SecretRotation(this, id, { - ...applyDefaultRotationOptions(options, this.vpcSubnets), - secret: this.secret, - application: this.singleUserRotationApplication, - vpc: this.vpc, - target: this, - }); - } - - /** - * Adds the multi user rotation to this cluster. - * See [Alternating users rotation strategy](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-two-users) - */ - public addRotationMultiUser(id: string, options: RotationMultiUserOptions): secretsmanager.SecretRotation { - if (!this.secret) { - throw new Error('Cannot add a multi user rotation for a cluster without a secret.'); - } - - return new secretsmanager.SecretRotation(this, id, { - ...applyDefaultRotationOptions(options, this.vpcSubnets), - secret: options.secret, - masterSecret: this.secret, - application: this.multiUserRotationApplication, - vpc: this.vpc, - target: this, - }); - } -} - -/** - * Represents an imported database cluster. - */ -class ImportedDatabaseCluster extends DatabaseClusterBase implements IDatabaseCluster { - public readonly clusterIdentifier: string; - public readonly connections: ec2.Connections; - public readonly engine?: IClusterEngine; - - private readonly _clusterResourceIdentifier?: string; - private readonly _clusterEndpoint?: Endpoint; - private readonly _clusterReadEndpoint?: Endpoint; - private readonly _instanceIdentifiers?: string[]; - private readonly _instanceEndpoints?: Endpoint[]; - - constructor(scope: Construct, id: string, attrs: DatabaseClusterAttributes) { - super(scope, id); - - this.clusterIdentifier = attrs.clusterIdentifier; - this._clusterResourceIdentifier = attrs.clusterResourceIdentifier; - - const defaultPort = attrs.port ? ec2.Port.tcp(attrs.port) : undefined; - this.connections = new ec2.Connections({ - securityGroups: attrs.securityGroups, - defaultPort, - }); - this.engine = attrs.engine; - - this._clusterEndpoint = (attrs.clusterEndpointAddress && attrs.port) ? new Endpoint(attrs.clusterEndpointAddress, attrs.port) : undefined; - this._clusterReadEndpoint = (attrs.readerEndpointAddress && attrs.port) ? new Endpoint(attrs.readerEndpointAddress, attrs.port) : undefined; - this._instanceIdentifiers = attrs.instanceIdentifiers; - this._instanceEndpoints = (attrs.instanceEndpointAddresses && attrs.port) - ? attrs.instanceEndpointAddresses.map(addr => new Endpoint(addr, attrs.port!)) - : undefined; - } - - public get clusterResourceIdentifier() { - if (!this._clusterResourceIdentifier) { - throw new Error('Cannot access `clusterResourceIdentifier` of an imported cluster without a clusterResourceIdentifier'); - } - return this._clusterResourceIdentifier; - } - - public get clusterEndpoint() { - if (!this._clusterEndpoint) { - throw new Error('Cannot access `clusterEndpoint` of an imported cluster without an endpoint address and port'); - } - return this._clusterEndpoint; - } - - public get clusterReadEndpoint() { - if (!this._clusterReadEndpoint) { - throw new Error('Cannot access `clusterReadEndpoint` of an imported cluster without a readerEndpointAddress and port'); - } - return this._clusterReadEndpoint; - } - - public get instanceIdentifiers() { - if (!this._instanceIdentifiers) { - throw new Error('Cannot access `instanceIdentifiers` of an imported cluster without provided instanceIdentifiers'); - } - return this._instanceIdentifiers; - } - - public get instanceEndpoints() { - if (!this._instanceEndpoints) { - throw new Error('Cannot access `instanceEndpoints` of an imported cluster without instanceEndpointAddresses and port'); - } - return this._instanceEndpoints; - } -} - -/** - * Properties for a new database cluster - */ -export interface DatabaseClusterProps extends DatabaseClusterBaseProps { - /** - * Credentials for the administrative user - * - * @default - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password - */ - readonly credentials?: Credentials; -} - -/** - * Create a clustered database with a given number of instances. - * - * @resource AWS::RDS::DBCluster - */ -export class DatabaseCluster extends DatabaseClusterNew { - /** - * Import an existing DatabaseCluster from properties - */ - public static fromDatabaseClusterAttributes(scope: Construct, id: string, attrs: DatabaseClusterAttributes): IDatabaseCluster { - return new ImportedDatabaseCluster(scope, id, attrs); - } - - public readonly clusterIdentifier: string; - public readonly clusterResourceIdentifier: string; - public readonly clusterEndpoint: Endpoint; - public readonly clusterReadEndpoint: Endpoint; - public readonly connections: ec2.Connections; - public readonly instanceIdentifiers: string[]; - public readonly instanceEndpoints: Endpoint[]; - - /** - * The secret attached to this cluster - */ - public readonly secret?: secretsmanager.ISecret; - - constructor(scope: Construct, id: string, props: DatabaseClusterProps) { - super(scope, id, props); - - const credentials = renderCredentials(this, props.engine, props.credentials); - const secret = credentials.secret; - - const cluster = new CfnDBCluster(this, 'Resource', { - ...this.newCfnProps, - // Admin - masterUsername: credentials.username, - masterUserPassword: credentials.password?.unsafeUnwrap(), - }); - - this.clusterIdentifier = cluster.ref; - this.clusterResourceIdentifier = cluster.attrDbClusterResourceId; - - if (secret) { - this.secret = secret.attach(this); - } - - // create a number token that represents the port of the cluster - const portAttribute = Token.asNumber(cluster.attrEndpointPort); - this.clusterEndpoint = new Endpoint(cluster.attrEndpointAddress, portAttribute); - this.clusterReadEndpoint = new Endpoint(cluster.attrReadEndpointAddress, portAttribute); - this.connections = new ec2.Connections({ - securityGroups: this.securityGroups, - defaultPort: ec2.Port.tcp(this.clusterEndpoint.port), - }); - - cluster.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); - - setLogRetention(this, props); - const createdInstances = createInstances(this, props, this.subnetGroup); - this.instanceIdentifiers = createdInstances.instanceIdentifiers; - this.instanceEndpoints = createdInstances.instanceEndpoints; - } -} - -/** - * Properties for ``DatabaseClusterFromSnapshot`` - */ -export interface DatabaseClusterFromSnapshotProps extends DatabaseClusterBaseProps { - /** - * The identifier for the DB instance snapshot or DB cluster snapshot to restore from. - * You can use either the name or the Amazon Resource Name (ARN) to specify a DB cluster snapshot. - * However, you can use only the ARN to specify a DB instance snapshot. - */ - readonly snapshotIdentifier: string; - - /** - * Credentials for the administrative user - * - * Note - using this prop only works with `Credentials.fromPassword()` with the - * username of the snapshot, `Credentials.fromUsername()` with the username and - * password of the snapshot or `Credentials.fromSecret()` with a secret containing - * the username and password of the snapshot. - * - * @default - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password - * that **will not be applied** to the cluster, use `snapshotCredentials` for the correct behavior. - * - * @deprecated use `snapshotCredentials` which allows to generate a new password - */ - readonly credentials?: Credentials; - - /** - * Master user credentials. - * - * Note - It is not possible to change the master username for a snapshot; - * however, it is possible to provide (or generate) a new password. - * - * @default - The existing username and password from the snapshot will be used. - */ - readonly snapshotCredentials?: SnapshotCredentials; -} - -/** - * A database cluster restored from a snapshot. - * - * @resource AWS::RDS::DBInstance - */ -export class DatabaseClusterFromSnapshot extends DatabaseClusterNew { - public readonly clusterIdentifier: string; - public readonly clusterResourceIdentifier: string; - public readonly clusterEndpoint: Endpoint; - public readonly clusterReadEndpoint: Endpoint; - public readonly connections: ec2.Connections; - public readonly instanceIdentifiers: string[]; - public readonly instanceEndpoints: Endpoint[]; - - /** - * The secret attached to this cluster - */ - public readonly secret?: secretsmanager.ISecret; - - constructor(scope: Construct, id: string, props: DatabaseClusterFromSnapshotProps) { - super(scope, id, props); - - if (props.credentials && !props.credentials.password && !props.credentials.secret) { - Annotations.of(this).addWarning('Use `snapshotCredentials` to modify password of a cluster created from a snapshot.'); - } - if (!props.credentials && !props.snapshotCredentials) { - Annotations.of(this).addWarning('Generated credentials will not be applied to cluster. Use `snapshotCredentials` instead. `addRotationSingleUser()` and `addRotationMultiUser()` cannot be used on this cluster.'); - } - const deprecatedCredentials = renderCredentials(this, props.engine, props.credentials); - - let credentials = props.snapshotCredentials; - let secret = credentials?.secret; - if (!secret && credentials?.generatePassword) { - if (!credentials.username) { - throw new Error('`snapshotCredentials` `username` must be specified when `generatePassword` is set to true'); - } - - secret = new DatabaseSecret(this, 'SnapshotSecret', { - username: credentials.username, - encryptionKey: credentials.encryptionKey, - excludeCharacters: credentials.excludeCharacters, - replaceOnPasswordCriteriaChanges: credentials.replaceOnPasswordCriteriaChanges, - replicaRegions: credentials.replicaRegions, - }); - } - - const cluster = new CfnDBCluster(this, 'Resource', { - ...this.newCfnProps, - snapshotIdentifier: props.snapshotIdentifier, - masterUserPassword: secret?.secretValueFromJson('password')?.unsafeUnwrap() ?? credentials?.password?.unsafeUnwrap(), // Safe usage - }); - - this.clusterIdentifier = cluster.ref; - this.clusterResourceIdentifier = cluster.attrDbClusterResourceId; - - if (secret) { - this.secret = secret.attach(this); - } - - if (deprecatedCredentials.secret) { - const deprecatedSecret = deprecatedCredentials.secret.attach(this); - if (!this.secret) { - this.secret = deprecatedSecret; - } - } - - // create a number token that represents the port of the cluster - const portAttribute = Token.asNumber(cluster.attrEndpointPort); - this.clusterEndpoint = new Endpoint(cluster.attrEndpointAddress, portAttribute); - this.clusterReadEndpoint = new Endpoint(cluster.attrReadEndpointAddress, portAttribute); - this.connections = new ec2.Connections({ - securityGroups: this.securityGroups, - defaultPort: ec2.Port.tcp(this.clusterEndpoint.port), - }); - - cluster.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); - - setLogRetention(this, props); - const createdInstances = createInstances(this, props, this.subnetGroup); - this.instanceIdentifiers = createdInstances.instanceIdentifiers; - this.instanceEndpoints = createdInstances.instanceEndpoints; - } -} - -/** - * Sets up CloudWatch log retention if configured. - * A function rather than protected member to prevent exposing ``DatabaseClusterBaseProps``. - */ -function setLogRetention(cluster: DatabaseClusterNew, props: DatabaseClusterBaseProps) { - if (props.cloudwatchLogsExports) { - const unsupportedLogTypes = props.cloudwatchLogsExports.filter(logType => !props.engine.supportedLogTypes.includes(logType)); - if (unsupportedLogTypes.length > 0) { - throw new Error(`Unsupported logs for the current engine type: ${unsupportedLogTypes.join(',')}`); - } - - if (props.cloudwatchLogsRetention) { - for (const log of props.cloudwatchLogsExports) { - new logs.LogRetention(cluster, `LogRetention${log}`, { - logGroupName: `/aws/rds/cluster/${cluster.clusterIdentifier}/${log}`, - retention: props.cloudwatchLogsRetention, - role: props.cloudwatchLogsRetentionRole, - }); - } - } - } -} - -/** Output from the createInstances method; used to set instance identifiers and endpoints */ -interface InstanceConfig { - readonly instanceIdentifiers: string[]; - readonly instanceEndpoints: Endpoint[]; -} - -/** - * Creates the instances for the cluster. - * A function rather than a protected method on ``DatabaseClusterNew`` to avoid exposing - * ``DatabaseClusterNew`` and ``DatabaseClusterBaseProps`` in the API. - */ -function createInstances(cluster: DatabaseClusterNew, props: DatabaseClusterBaseProps, subnetGroup: ISubnetGroup): InstanceConfig { - const instanceCount = props.instances != null ? props.instances : 2; - const instanceUpdateBehaviour = props.instanceUpdateBehaviour ?? InstanceUpdateBehaviour.BULK; - if (Token.isUnresolved(instanceCount)) { - throw new Error('The number of instances an RDS Cluster consists of cannot be provided as a deploy-time only value!'); - } - if (instanceCount < 1) { - throw new Error('At least one instance is required'); - } - - const instanceIdentifiers: string[] = []; - const instanceEndpoints: Endpoint[] = []; - const portAttribute = cluster.clusterEndpoint.port; - const instanceProps = props.instanceProps; - - // Get the actual subnet objects so we can depend on internet connectivity. - const internetConnected = instanceProps.vpc.selectSubnets(instanceProps.vpcSubnets).internetConnectivityEstablished; - - let monitoringRole; - if (props.monitoringInterval && props.monitoringInterval.toSeconds()) { - monitoringRole = props.monitoringRole || new Role(cluster, 'MonitoringRole', { - assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [ - ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), - ], - }); - } - - const enablePerformanceInsights = instanceProps.enablePerformanceInsights - || instanceProps.performanceInsightRetention !== undefined || instanceProps.performanceInsightEncryptionKey !== undefined; - if (enablePerformanceInsights && instanceProps.enablePerformanceInsights === false) { - throw new Error('`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set'); - } - - const instanceType = instanceProps.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM); - - if (instanceProps.parameterGroup && instanceProps.parameters) { - throw new Error('You cannot specify both parameterGroup and parameters'); - } - - const instanceParameterGroup = instanceProps.parameterGroup ?? ( - instanceProps.parameters - ? new ParameterGroup(cluster, 'InstanceParameterGroup', { - engine: props.engine, - parameters: instanceProps.parameters, - }) - : undefined - ); - const instanceParameterGroupConfig = instanceParameterGroup?.bindToInstance({}); - - const instances: CfnDBInstance[] = []; - - for (let i = 0; i < instanceCount; i++) { - const instanceIndex = i + 1; - const instanceIdentifier = props.instanceIdentifierBase != null ? `${props.instanceIdentifierBase}${instanceIndex}` : - props.clusterIdentifier != null ? `${props.clusterIdentifier}instance${instanceIndex}` : - undefined; - - const instance = new CfnDBInstance(cluster, `Instance${instanceIndex}`, { - // Link to cluster - engine: props.engine.engineType, - dbClusterIdentifier: cluster.clusterIdentifier, - dbInstanceIdentifier: instanceIdentifier, - // Instance properties - dbInstanceClass: databaseInstanceType(instanceType), - publiclyAccessible: instanceProps.publiclyAccessible ?? - (instanceProps.vpcSubnets && instanceProps.vpcSubnets.subnetType === ec2.SubnetType.PUBLIC), - enablePerformanceInsights: enablePerformanceInsights || instanceProps.enablePerformanceInsights, // fall back to undefined if not set - performanceInsightsKmsKeyId: instanceProps.performanceInsightEncryptionKey?.keyArn, - performanceInsightsRetentionPeriod: enablePerformanceInsights - ? (instanceProps.performanceInsightRetention || PerformanceInsightRetention.DEFAULT) - : undefined, - // This is already set on the Cluster. Unclear to me whether it should be repeated or not. Better yes. - dbSubnetGroupName: subnetGroup.subnetGroupName, - dbParameterGroupName: instanceParameterGroupConfig?.parameterGroupName, - monitoringInterval: props.monitoringInterval && props.monitoringInterval.toSeconds(), - monitoringRoleArn: monitoringRole && monitoringRole.roleArn, - autoMinorVersionUpgrade: props.instanceProps.autoMinorVersionUpgrade, - allowMajorVersionUpgrade: props.instanceProps.allowMajorVersionUpgrade, - deleteAutomatedBackups: props.instanceProps.deleteAutomatedBackups, - }); - - // For instances that are part of a cluster: - // - // Cluster DESTROY or SNAPSHOT -> DESTROY (snapshot is good enough to recreate) - // Cluster RETAIN -> RETAIN (otherwise cluster state will disappear) - instance.applyRemovalPolicy(helperRemovalPolicy(props.removalPolicy)); - - // We must have a dependency on the NAT gateway provider here to create - // things in the right order. - instance.node.addDependency(internetConnected); - - instanceIdentifiers.push(instance.ref); - instanceEndpoints.push(new Endpoint(instance.attrEndpointAddress, portAttribute)); - instances.push(instance); - } - - // Adding dependencies here to ensure that the instances are updated one after the other. - if (instanceUpdateBehaviour === InstanceUpdateBehaviour.ROLLING) { - for (let i = 1; i < instanceCount; i++) { - instances[i].node.addDependency(instances[i-1]); - } - } - - return { instanceEndpoints, instanceIdentifiers }; -} - -/** - * Turn a regular instance type into a database instance type - */ -function databaseInstanceType(instanceType: ec2.InstanceType) { - return 'db.' + instanceType.toString(); -} diff --git a/packages/@aws-cdk/aws-rds/lib/database-secret.ts b/packages/@aws-cdk/aws-rds/lib/database-secret.ts deleted file mode 100644 index 5359cf5bc8da6..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/database-secret.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Aws, Names } from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; -import { Construct } from 'constructs'; -import { DEFAULT_PASSWORD_EXCLUDE_CHARS } from './private/util'; - -/** - * Construction properties for a DatabaseSecret. - */ -export interface DatabaseSecretProps { - /** - * The username. - */ - readonly username: string; - - /** - * The database name, if not using the default one - * - * @default - whatever the secret generates after the attach method is run - */ - readonly dbname?: string; - - /** - * A name for the secret. - * - * @default - A name is generated by CloudFormation. - */ - readonly secretName?: string; - - /** - * The KMS key to use to encrypt the secret. - * - * @default default master key - */ - readonly encryptionKey?: kms.IKey; - - /** - * The master secret which will be used to rotate this secret. - * - * @default - no master secret information will be included - */ - readonly masterSecret?: secretsmanager.ISecret; - - /** - * Characters to not include in the generated password. - * - * @default " %+~`#$&*()|[]{}:;<>?!'/@\"\\" - */ - readonly excludeCharacters?: string; - - /** - * Whether to replace this secret when the criteria for the password change. - * - * This is achieved by overriding the logical id of the AWS::SecretsManager::Secret - * with a hash of the options that influence the password generation. This - * way a new secret will be created when the password is regenerated and the - * cluster or instance consuming this secret will have its credentials updated. - * - * @default false - */ - readonly replaceOnPasswordCriteriaChanges?: boolean; - - /** - * A list of regions where to replicate this secret. - * - * @default - Secret is not replicated - */ - readonly replicaRegions?: secretsmanager.ReplicaRegion[]; -} - -/** - * A database secret. - * - * @resource AWS::SecretsManager::Secret - */ -export class DatabaseSecret extends secretsmanager.Secret { - constructor(scope: Construct, id: string, props: DatabaseSecretProps) { - const excludeCharacters = props.excludeCharacters ?? DEFAULT_PASSWORD_EXCLUDE_CHARS; - - super(scope, id, { - encryptionKey: props.encryptionKey, - description: `Generated by the CDK for stack: ${Aws.STACK_NAME}`, - secretName: props.secretName, - generateSecretString: { - passwordLength: 30, // Oracle password cannot have more than 30 characters - secretStringTemplate: JSON.stringify({ - username: props.username, - dbname: props.dbname, - masterarn: props.masterSecret?.secretArn, - }), - generateStringKey: 'password', - excludeCharacters, - }, - replicaRegions: props.replicaRegions, - }); - - if (props.replaceOnPasswordCriteriaChanges) { - const hash = md5hash(JSON.stringify({ - // Use here the options that influence the password generation. - // If at some point we add other password customization options - // they sould be added here below (e.g. `passwordLength`). - excludeCharacters, - })); - const logicalId = `${Names.uniqueId(this)}${hash}`; - - const secret = this.node.defaultChild as secretsmanager.CfnSecret; - secret.overrideLogicalId(logicalId.slice(-255)); // Take last 255 chars - } - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/endpoint.ts b/packages/@aws-cdk/aws-rds/lib/endpoint.ts deleted file mode 100644 index 56081166bcf73..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/endpoint.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Token } from '@aws-cdk/core'; - -/** - * Connection endpoint of a database cluster or instance - * - * Consists of a combination of hostname and port. - */ -export class Endpoint { - /** - * The hostname of the endpoint - */ - public readonly hostname: string; - - /** - * The port of the endpoint - */ - public readonly port: number; - - /** - * The combination of "HOSTNAME:PORT" for this endpoint - */ - public readonly socketAddress: string; - - constructor(address: string, port: number) { - this.hostname = address; - this.port = port; - - const portDesc = Token.isUnresolved(port) ? Token.asString(port) : port; - this.socketAddress = `${address}:${portDesc}`; - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/instance.ts b/packages/@aws-cdk/aws-rds/lib/instance.ts deleted file mode 100644 index f9dd2e7e235f8..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/instance.ts +++ /dev/null @@ -1,1295 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { ArnComponents, ArnFormat, Duration, FeatureFlags, IResource, Lazy, RemovalPolicy, Resource, Stack, Token, Tokenization } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { DatabaseSecret } from './database-secret'; -import { Endpoint } from './endpoint'; -import { IInstanceEngine } from './instance-engine'; -import { IOptionGroup } from './option-group'; -import { IParameterGroup, ParameterGroup } from './parameter-group'; -import { applyDefaultRotationOptions, defaultDeletionProtection, engineDescription, renderCredentials, setupS3ImportExport, helperRemovalPolicy, renderUnless } from './private/util'; -import { Credentials, PerformanceInsightRetention, RotationMultiUserOptions, RotationSingleUserOptions, SnapshotCredentials } from './props'; -import { DatabaseProxy, DatabaseProxyOptions, ProxyTarget } from './proxy'; -import { CfnDBInstance, CfnDBInstanceProps } from './rds.generated'; -import { ISubnetGroup, SubnetGroup } from './subnet-group'; - -/** - * A database instance - */ -export interface IDatabaseInstance extends IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { - /** - * The instance identifier. - */ - readonly instanceIdentifier: string; - - /** - * The instance arn. - */ - readonly instanceArn: string; - - /** - * The instance endpoint address. - * - * @attribute EndpointAddress - */ - readonly dbInstanceEndpointAddress: string; - - /** - * The instance endpoint port. - * - * @attribute EndpointPort - */ - readonly dbInstanceEndpointPort: string; - - /** - * The instance endpoint. - */ - readonly instanceEndpoint: Endpoint; - - /** - * The engine of this database Instance. - * May be not known for imported Instances if it wasn't provided explicitly, - * or for read replicas. - */ - readonly engine?: IInstanceEngine; - - /** - * Add a new db proxy to this instance. - */ - addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy; - - /** - * Grant the given identity connection access to the database. - * **Note**: this method does not currently work, see https://github.com/aws/aws-cdk/issues/11851 for details. - * @see https://github.com/aws/aws-cdk/issues/11851 - */ - grantConnect(grantee: iam.IGrantable): iam.Grant; - - /** - * Defines a CloudWatch event rule which triggers for instance events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - onEvent(id: string, options?: events.OnEventOptions): events.Rule; -} - -/** - * Properties that describe an existing instance - */ -export interface DatabaseInstanceAttributes { - /** - * The instance identifier. - */ - readonly instanceIdentifier: string; - - /** - * The endpoint address. - */ - readonly instanceEndpointAddress: string; - - /** - * The database port. - */ - readonly port: number; - - /** - * The security groups of the instance. - */ - readonly securityGroups: ec2.ISecurityGroup[]; - - /** - * The engine of the existing database Instance. - * - * @default - the imported Instance's engine is unknown - */ - readonly engine?: IInstanceEngine; -} - -/** - * A new or imported database instance. - */ -export abstract class DatabaseInstanceBase extends Resource implements IDatabaseInstance { - /** - * Import an existing database instance. - */ - public static fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance { - class Import extends DatabaseInstanceBase implements IDatabaseInstance { - public readonly defaultPort = ec2.Port.tcp(attrs.port); - public readonly connections = new ec2.Connections({ - securityGroups: attrs.securityGroups, - defaultPort: this.defaultPort, - }); - public readonly instanceIdentifier = attrs.instanceIdentifier; - public readonly dbInstanceEndpointAddress = attrs.instanceEndpointAddress; - public readonly dbInstanceEndpointPort = Tokenization.stringifyNumber(attrs.port); - public readonly instanceEndpoint = new Endpoint(attrs.instanceEndpointAddress, attrs.port); - public readonly engine = attrs.engine; - protected enableIamAuthentication = true; - } - - return new Import(scope, id); - } - - public abstract readonly instanceIdentifier: string; - public abstract readonly dbInstanceEndpointAddress: string; - public abstract readonly dbInstanceEndpointPort: string; - public abstract readonly instanceEndpoint: Endpoint; - // only required because of JSII bug: https://github.com/aws/jsii/issues/2040 - public abstract readonly engine?: IInstanceEngine; - protected abstract enableIamAuthentication?: boolean; - - /** - * Access to network connections. - */ - public abstract readonly connections: ec2.Connections; - - /** - * Add a new db proxy to this instance. - */ - public addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy { - return new DatabaseProxy(this, id, { - proxyTarget: ProxyTarget.fromInstance(this), - ...options, - }); - } - - public grantConnect(grantee: iam.IGrantable): iam.Grant { - if (this.enableIamAuthentication === false) { - throw new Error('Cannot grant connect when IAM authentication is disabled'); - } - - this.enableIamAuthentication = true; - return iam.Grant.addToPrincipal({ - grantee, - actions: ['rds-db:connect'], - resourceArns: [this.instanceArn], - }); - } - - /** - * Defines a CloudWatch event rule which triggers for instance events. Use - * `rule.addEventPattern(pattern)` to specify a filter. - */ - public onEvent(id: string, options: events.OnEventOptions = {}) { - const rule = new events.Rule(this, id, options); - rule.addEventPattern({ - source: ['aws.rds'], - resources: [this.instanceArn], - }); - rule.addTarget(options.target); - return rule; - } - - /** - * The instance arn. - */ - public get instanceArn(): string { - const commonAnComponents: ArnComponents = { - service: 'rds', - resource: 'db', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }; - const localArn = Stack.of(this).formatArn({ - ...commonAnComponents, - resourceName: this.instanceIdentifier, - }); - return this.getResourceArnAttribute(localArn, { - ...commonAnComponents, - resourceName: this.physicalName, - }); - } - - /** - * Renders the secret attachment target specifications. - */ - public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { - return { - targetId: this.instanceIdentifier, - targetType: secretsmanager.AttachmentTargetType.RDS_DB_INSTANCE, - }; - } -} - -/** - * The license model. - */ -export enum LicenseModel { - /** - * License included. - */ - LICENSE_INCLUDED = 'license-included', - - /** - * Bring your own licencse. - */ - BRING_YOUR_OWN_LICENSE = 'bring-your-own-license', - - /** - * General public license. - */ - GENERAL_PUBLIC_LICENSE = 'general-public-license' -} - -/** - * The processor features. - */ -export interface ProcessorFeatures { - /** - * The number of CPU core. - * - * @default - the default number of CPU cores for the chosen instance class. - */ - readonly coreCount?: number; - - /** - * The number of threads per core. - * - * @default - the default number of threads per core for the chosen instance class. - */ - readonly threadsPerCore?: number; -} - -/** - * The type of storage. - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html - */ -export enum StorageType { - /** - * Standard. - * - * Amazon RDS supports magnetic storage for backward compatibility. It is recommended to use - * General Purpose SSD or Provisioned IOPS SSD for any new storage needs. - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#CHAP_Storage.Magnetic - */ - STANDARD = 'standard', - - /** - * General purpose SSD (gp2). - * - * Baseline performance determined by volume size - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD - */ - GP2 = 'gp2', - - /** - * General purpose SSD (gp3). - * - * Performance scales independently from storage - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD - */ - GP3 = 'gp3', - - /** - * Provisioned IOPS (SSD). - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS - */ - IO1 = 'io1' -} - -/** - * The network type of the DB instance. - */ -export enum NetworkType { - /** - * IPv4 only network type. - */ - IPV4 = 'IPV4', - - /** - * Dual-stack network type. - */ - DUAL = 'DUAL' -} - -/** - * Construction properties for a DatabaseInstanceNew - */ -export interface DatabaseInstanceNewProps { - /** - * Specifies if the database instance is a multiple Availability Zone deployment. - * - * @default false - */ - readonly multiAz?: boolean; - - /** - * The name of the Availability Zone where the DB instance will be located. - * - * @default - no preference - */ - readonly availabilityZone?: string; - - /** - * The storage type. Storage types supported are gp2, io1, standard. - * - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD - * - * @default GP2 - */ - readonly storageType?: StorageType; - - /** - * The storage throughput, specified in mebibytes per second (MiBps). - * - * Only applicable for GP3. - * - * @see https://docs.aws.amazon.com//AmazonRDS/latest/UserGuide/CHAP_Storage.html#gp3-storage - * - * @default - 125 MiBps if allocated storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, - * less than 200 GiB for Oracle and less than 20 GiB for SQL Server. 500 MiBps otherwise (except for - * SQL Server where the default is always 125 MiBps). - */ - readonly storageThroughput?: number; - - /** - * The number of I/O operations per second (IOPS) that the database provisions. - * The value must be equal to or greater than 1000. - * - * @default - no provisioned iops if storage type is not specified. For GP3: 3,000 IOPS if allocated - * storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, less than 200 GiB for Oracle and - * less than 20 GiB for SQL Server. 12,000 IOPS otherwise (except for SQL Server where the default is - * always 3,000 IOPS). - */ - readonly iops?: number; - - /** - * The number of CPU cores and the number of threads per core. - * - * @default - the default number of CPU cores and threads per core for the - * chosen instance class. - * - * See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessor - */ - readonly processorFeatures?: ProcessorFeatures; - - /** - * A name for the DB instance. If you specify a name, AWS CloudFormation - * converts it to lowercase. - * - * @default - a CloudFormation generated name - */ - readonly instanceIdentifier?: string; - - /** - * The VPC network where the DB subnet group should be created. - */ - readonly vpc: ec2.IVpc; - - /** - * The type of subnets to add to the created DB subnet group. - * - * @deprecated use `vpcSubnets` - * @default - private subnets - */ - readonly vpcPlacement?: ec2.SubnetSelection; - - /** - * The type of subnets to add to the created DB subnet group. - * - * @default - private subnets - */ - readonly vpcSubnets?: ec2.SubnetSelection; - - /** - * The security groups to assign to the DB instance. - * - * @default - a new security group is created - */ - readonly securityGroups?: ec2.ISecurityGroup[]; - - /** - * The port for the instance. - * - * @default - the default port for the chosen engine. - */ - readonly port?: number; - - /** - * The DB parameter group to associate with the instance. - * - * @default - no parameter group - */ - readonly parameterGroup?: IParameterGroup; - - /** - * The option group to associate with the instance. - * - * @default - no option group - */ - readonly optionGroup?: IOptionGroup; - - /** - * Whether to enable mapping of AWS Identity and Access Management (IAM) accounts - * to database accounts. - * - * @default false - */ - readonly iamAuthentication?: boolean; - - /** - * The number of days during which automatic DB snapshots are retained. - * Set to zero to disable backups. - * When creating a read replica, you must enable automatic backups on the source - * database instance by setting the backup retention to a value other than zero. - * - * @default - Duration.days(1) for source instances, disabled for read replicas - */ - readonly backupRetention?: Duration; - - /** - * The daily time range during which automated backups are performed. - * - * Constraints: - * - Must be in the format `hh24:mi-hh24:mi`. - * - Must be in Universal Coordinated Time (UTC). - * - Must not conflict with the preferred maintenance window. - * - Must be at least 30 minutes. - * - * @default - a 30-minute window selected at random from an 8-hour block of - * time for each AWS Region. To see the time blocks available, see - * https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow - */ - readonly preferredBackupWindow?: string; - - /** - * Indicates whether to copy all of the user-defined tags from the - * DB instance to snapshots of the DB instance. - * - * @default true - */ - readonly copyTagsToSnapshot?: boolean; - - /** - * Indicates whether automated backups should be deleted or retained when - * you delete a DB instance. - * - * @default false - */ - readonly deleteAutomatedBackups?: boolean; - - /** - * The interval, in seconds, between points when Amazon RDS collects enhanced - * monitoring metrics for the DB instance. - * - * @default - no enhanced monitoring - */ - readonly monitoringInterval?: Duration; - - /** - * Role that will be used to manage DB instance monitoring. - * - * @default - A role is automatically created for you - */ - readonly monitoringRole?: iam.IRole; - - /** - * Whether to enable Performance Insights for the DB instance. - * - * @default - false, unless ``performanceInsightRentention`` or ``performanceInsightEncryptionKey`` is set. - */ - readonly enablePerformanceInsights?: boolean; - - /** - * The amount of time, in days, to retain Performance Insights data. - * - * @default 7 - */ - readonly performanceInsightRetention?: PerformanceInsightRetention; - - /** - * The AWS KMS key for encryption of Performance Insights data. - * - * @default - default master key - */ - readonly performanceInsightEncryptionKey?: kms.IKey; - - /** - * The list of log types that need to be enabled for exporting to - * CloudWatch Logs. - * - * @default - no log exports - */ - readonly cloudwatchLogsExports?: string[]; - - /** - * The number of days log events are kept in CloudWatch Logs. When updating - * this property, unsetting it doesn't remove the log retention policy. To - * remove the retention policy, set the value to `Infinity`. - * - * @default - logs never expire - */ - readonly cloudwatchLogsRetention?: logs.RetentionDays; - - /** - * The IAM role for the Lambda function associated with the custom resource - * that sets the retention policy. - * - * @default - a new role is created. - */ - readonly cloudwatchLogsRetentionRole?: iam.IRole; - - /** - * Indicates that minor engine upgrades are applied automatically to the - * DB instance during the maintenance window. - * - * @default true - */ - readonly autoMinorVersionUpgrade?: boolean; - - /** - * The weekly time range (in UTC) during which system maintenance can occur. - * - * Format: `ddd:hh24:mi-ddd:hh24:mi` - * Constraint: Minimum 30-minute window - * - * @default - a 30-minute window selected at random from an 8-hour block of - * time for each AWS Region, occurring on a random day of the week. To see - * the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance - */ - readonly preferredMaintenanceWindow?: string; - - /** - * Indicates whether the DB instance should have deletion protection enabled. - * - * @default - true if ``removalPolicy`` is RETAIN, false otherwise - */ - readonly deletionProtection?: boolean; - - /** - * The CloudFormation policy to apply when the instance is removed from the - * stack or replaced during an update. - * - * @default - RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data) - */ - readonly removalPolicy?: RemovalPolicy; - - /** - * Upper limit to which RDS can scale the storage in GiB(Gibibyte). - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling - * @default - No autoscaling of RDS instance - */ - readonly maxAllocatedStorage?: number; - - /** - * The Active Directory directory ID to create the DB instance in. - * - * @default - Do not join domain - */ - readonly domain?: string; - - /** - * The IAM role to be used when making API calls to the Directory Service. The role needs the AWS-managed policy - * AmazonRDSDirectoryServiceAccess or equivalent. - * - * @default - The role will be created for you if `DatabaseInstanceNewProps#domain` is specified - */ - readonly domainRole?: iam.IRole; - - /** - * Existing subnet group for the instance. - * - * @default - a new subnet group will be created. - */ - readonly subnetGroup?: ISubnetGroup; - - /** - * Role that will be associated with this DB instance to enable S3 import. - * This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. - * - * This property must not be used if `s3ImportBuckets` is used. - * - * For Microsoft SQL Server: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html - * For Oracle: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html - * For PostgreSQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html - * - * @default - New role is created if `s3ImportBuckets` is set, no role is defined otherwise - */ - readonly s3ImportRole?: iam.IRole; - - /** - * S3 buckets that you want to load data from. - * This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. - * - * This property must not be used if `s3ImportRole` is used. - * - * For Microsoft SQL Server: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html - * For Oracle: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html - * For PostgreSQL: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html - * - * @default - None - */ - readonly s3ImportBuckets?: s3.IBucket[]; - - /** - * Role that will be associated with this DB instance to enable S3 export. - * - * This property must not be used if `s3ExportBuckets` is used. - * - * For Microsoft SQL Server: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html - * For Oracle: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html - * - * @default - New role is created if `s3ExportBuckets` is set, no role is defined otherwise - */ - readonly s3ExportRole?: iam.IRole; - - /** - * S3 buckets that you want to load data into. - * - * This property must not be used if `s3ExportRole` is used. - * - * For Microsoft SQL Server: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html - * For Oracle: - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html - * - * @default - None - */ - readonly s3ExportBuckets?: s3.IBucket[]; - - /** - * Indicates whether the DB instance is an internet-facing instance. - * - * @default - `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise - */ - readonly publiclyAccessible?: boolean; - - /** - * The network type of the DB instance. - * - * @default - IPV4 - */ - readonly networkType?: NetworkType; -} - -/** - * A new database instance. - */ -abstract class DatabaseInstanceNew extends DatabaseInstanceBase implements IDatabaseInstance { - /** - * The VPC where this database instance is deployed. - */ - public readonly vpc: ec2.IVpc; - - public readonly connections: ec2.Connections; - - protected abstract readonly instanceType: ec2.InstanceType; - - protected readonly vpcPlacement?: ec2.SubnetSelection; - protected readonly newCfnProps: CfnDBInstanceProps; - - private readonly cloudwatchLogsExports?: string[]; - private readonly cloudwatchLogsRetention?: logs.RetentionDays; - private readonly cloudwatchLogsRetentionRole?: iam.IRole; - - private readonly domainId?: string; - private readonly domainRole?: iam.IRole; - - protected enableIamAuthentication?: boolean; - - constructor(scope: Construct, id: string, props: DatabaseInstanceNewProps) { - // RDS always lower-cases the ID of the database, so use that for the physical name - // (which is the name used for cross-environment access, so it needs to be correct, - // regardless of the feature flag that changes it in the template for the L1) - const instancePhysicalName = Token.isUnresolved(props.instanceIdentifier) - ? props.instanceIdentifier - : props.instanceIdentifier?.toLowerCase(); - super(scope, id, { - physicalName: instancePhysicalName, - }); - - this.vpc = props.vpc; - if (props.vpcSubnets && props.vpcPlacement) { - throw new Error('Only one of `vpcSubnets` or `vpcPlacement` can be specified'); - } - this.vpcPlacement = props.vpcSubnets ?? props.vpcPlacement; - - if (props.multiAz === true && props.availabilityZone) { - throw new Error('Requesting a specific availability zone is not valid for Multi-AZ instances'); - } - - const subnetGroup = props.subnetGroup ?? new SubnetGroup(this, 'SubnetGroup', { - description: `Subnet group for ${this.node.id} database`, - vpc: this.vpc, - vpcSubnets: this.vpcPlacement, - removalPolicy: renderUnless(helperRemovalPolicy(props.removalPolicy), RemovalPolicy.DESTROY), - }); - - const securityGroups = props.securityGroups || [new ec2.SecurityGroup(this, 'SecurityGroup', { - description: `Security group for ${this.node.id} database`, - vpc: props.vpc, - })]; - - this.connections = new ec2.Connections({ - securityGroups, - defaultPort: ec2.Port.tcp(Lazy.number({ produce: () => this.instanceEndpoint.port })), - }); - - let monitoringRole; - if (props.monitoringInterval && props.monitoringInterval.toSeconds()) { - monitoringRole = props.monitoringRole || new iam.Role(this, 'MonitoringRole', { - assumedBy: new iam.ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole')], - }); - } - - const storageType = props.storageType ?? StorageType.GP2; - const iops = defaultIops(storageType, props.iops); - if (props.storageThroughput && storageType !== StorageType.GP3) { - throw new Error(`The storage throughput can only be specified with GP3 storage type. Got ${storageType}.`); - } - if (storageType === StorageType.GP3 && props.storageThroughput && iops - && !Token.isUnresolved(props.storageThroughput) && !Token.isUnresolved(iops) - && props.storageThroughput/iops > 0.25) { - throw new Error(`The maximum ratio of storage throughput to IOPS is 0.25. Got ${props.storageThroughput/iops}.`); - } - - this.cloudwatchLogsExports = props.cloudwatchLogsExports; - this.cloudwatchLogsRetention = props.cloudwatchLogsRetention; - this.cloudwatchLogsRetentionRole = props.cloudwatchLogsRetentionRole; - this.enableIamAuthentication = props.iamAuthentication; - - const enablePerformanceInsights = props.enablePerformanceInsights - || props.performanceInsightRetention !== undefined || props.performanceInsightEncryptionKey !== undefined; - if (enablePerformanceInsights && props.enablePerformanceInsights === false) { - throw new Error('`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set'); - } - - if (props.domain) { - this.domainId = props.domain; - this.domainRole = props.domainRole || new iam.Role(this, 'RDSDirectoryServiceRole', { - assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), - managedPolicies: [ - iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSDirectoryServiceAccess'), - ], - }); - } - - const maybeLowercasedInstanceId = FeatureFlags.of(this).isEnabled(cxapi.RDS_LOWERCASE_DB_IDENTIFIER) - && !Token.isUnresolved(props.instanceIdentifier) - ? props.instanceIdentifier?.toLowerCase() - : props.instanceIdentifier; - - const instanceParameterGroupConfig = props.parameterGroup?.bindToInstance({}); - this.newCfnProps = { - autoMinorVersionUpgrade: props.autoMinorVersionUpgrade, - availabilityZone: props.multiAz ? undefined : props.availabilityZone, - backupRetentionPeriod: props.backupRetention?.toDays(), - copyTagsToSnapshot: props.copyTagsToSnapshot ?? true, - dbInstanceClass: Lazy.string({ produce: () => `db.${this.instanceType}` }), - dbInstanceIdentifier: Token.isUnresolved(props.instanceIdentifier) - // if the passed identifier is a Token, - // we need to use the physicalName of the database - // (we cannot change its case anyway), - // as it might be used in a cross-environment fashion - ? this.physicalName - : maybeLowercasedInstanceId, - dbSubnetGroupName: subnetGroup.subnetGroupName, - deleteAutomatedBackups: props.deleteAutomatedBackups, - deletionProtection: defaultDeletionProtection(props.deletionProtection, props.removalPolicy), - enableCloudwatchLogsExports: this.cloudwatchLogsExports, - enableIamDatabaseAuthentication: Lazy.any({ produce: () => this.enableIamAuthentication }), - enablePerformanceInsights: enablePerformanceInsights || props.enablePerformanceInsights, // fall back to undefined if not set, - iops, - monitoringInterval: props.monitoringInterval?.toSeconds(), - monitoringRoleArn: monitoringRole?.roleArn, - multiAz: props.multiAz, - dbParameterGroupName: instanceParameterGroupConfig?.parameterGroupName, - optionGroupName: props.optionGroup?.optionGroupName, - performanceInsightsKmsKeyId: props.performanceInsightEncryptionKey?.keyArn, - performanceInsightsRetentionPeriod: enablePerformanceInsights - ? (props.performanceInsightRetention || PerformanceInsightRetention.DEFAULT) - : undefined, - port: props.port !== undefined ? Tokenization.stringifyNumber(props.port) : undefined, - preferredBackupWindow: props.preferredBackupWindow, - preferredMaintenanceWindow: props.preferredMaintenanceWindow, - processorFeatures: props.processorFeatures && renderProcessorFeatures(props.processorFeatures), - publiclyAccessible: props.publiclyAccessible ?? (this.vpcPlacement && this.vpcPlacement.subnetType === ec2.SubnetType.PUBLIC), - storageType, - storageThroughput: props.storageThroughput, - vpcSecurityGroups: securityGroups.map(s => s.securityGroupId), - maxAllocatedStorage: props.maxAllocatedStorage, - domain: this.domainId, - domainIamRoleName: this.domainRole?.roleName, - networkType: props.networkType, - }; - } - - protected setLogRetention() { - if (this.cloudwatchLogsExports && this.cloudwatchLogsRetention) { - for (const log of this.cloudwatchLogsExports) { - new logs.LogRetention(this, `LogRetention${log}`, { - logGroupName: `/aws/rds/instance/${this.instanceIdentifier}/${log}`, - retention: this.cloudwatchLogsRetention, - role: this.cloudwatchLogsRetentionRole, - }); - } - } - } -} - -/** - * Construction properties for a DatabaseInstanceSource - */ -export interface DatabaseInstanceSourceProps extends DatabaseInstanceNewProps { - /** - * The database engine. - */ - readonly engine: IInstanceEngine; - - /** - * The name of the compute and memory capacity for the instance. - * - * @default - m5.large (or, more specifically, db.m5.large) - */ - readonly instanceType?: ec2.InstanceType; - - /** - * The license model. - * - * @default - RDS default license model - */ - readonly licenseModel?: LicenseModel; - - /** - * Whether to allow major version upgrades. - * - * @default false - */ - readonly allowMajorVersionUpgrade?: boolean; - - /** - * The time zone of the instance. This is currently supported only by Microsoft Sql Server. - * - * @default - RDS default timezone - */ - readonly timezone?: string; - - /** - * The allocated storage size, specified in gibibytes (GiB). - * - * @default 100 - */ - readonly allocatedStorage?: number; - - /** - * The name of the database. - * - * @default - no name - */ - readonly databaseName?: string; - - /** - * The parameters in the DBParameterGroup to create automatically - * - * You can only specify parameterGroup or parameters but not both. - * You need to use a versioned engine to auto-generate a DBParameterGroup. - * - * @default - None - */ - readonly parameters?: { [key: string]: string }; -} - -/** - * A new source database instance (not a read replica) - */ -abstract class DatabaseInstanceSource extends DatabaseInstanceNew implements IDatabaseInstance { - public readonly engine?: IInstanceEngine; - /** - * The AWS Secrets Manager secret attached to the instance. - */ - public abstract readonly secret?: secretsmanager.ISecret; - - protected readonly sourceCfnProps: CfnDBInstanceProps; - protected readonly instanceType: ec2.InstanceType; - - private readonly singleUserRotationApplication: secretsmanager.SecretRotationApplication; - private readonly multiUserRotationApplication: secretsmanager.SecretRotationApplication; - - constructor(scope: Construct, id: string, props: DatabaseInstanceSourceProps) { - super(scope, id, props); - - this.singleUserRotationApplication = props.engine.singleUserRotationApplication; - this.multiUserRotationApplication = props.engine.multiUserRotationApplication; - this.engine = props.engine; - - const engineType = props.engine.engineType; - // only Oracle and SQL Server require the import and export Roles to be the same - const combineRoles = engineType.startsWith('oracle-') || engineType.startsWith('sqlserver-'); - let { s3ImportRole, s3ExportRole } = setupS3ImportExport(this, props, combineRoles); - const engineConfig = props.engine.bindToInstance(this, { - ...props, - s3ImportRole, - s3ExportRole, - }); - - const instanceAssociatedRoles: CfnDBInstance.DBInstanceRoleProperty[] = []; - const engineFeatures = engineConfig.features; - if (s3ImportRole) { - if (!engineFeatures?.s3Import) { - throw new Error(`Engine '${engineDescription(props.engine)}' does not support S3 import`); - } - instanceAssociatedRoles.push({ roleArn: s3ImportRole.roleArn, featureName: engineFeatures?.s3Import }); - } - if (s3ExportRole) { - if (!engineFeatures?.s3Export) { - throw new Error(`Engine '${engineDescription(props.engine)}' does not support S3 export`); - } - // only add the export feature if it's different from the import feature - if (engineFeatures.s3Import !== engineFeatures?.s3Export) { - instanceAssociatedRoles.push({ roleArn: s3ExportRole.roleArn, featureName: engineFeatures?.s3Export }); - } - } - - this.instanceType = props.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE); - - if (props.parameterGroup && props.parameters) { - throw new Error('You cannot specify both parameterGroup and parameters'); - } - - const dbParameterGroupName = props.parameters - ? new ParameterGroup(this, 'ParameterGroup', { - engine: props.engine, - parameters: props.parameters, - }).bindToInstance({}).parameterGroupName - : this.newCfnProps.dbParameterGroupName; - - this.sourceCfnProps = { - ...this.newCfnProps, - associatedRoles: instanceAssociatedRoles.length > 0 ? instanceAssociatedRoles : undefined, - optionGroupName: engineConfig.optionGroup?.optionGroupName, - allocatedStorage: props.allocatedStorage?.toString() ?? '100', - allowMajorVersionUpgrade: props.allowMajorVersionUpgrade, - dbName: props.databaseName, - engine: engineType, - engineVersion: props.engine.engineVersion?.fullVersion, - licenseModel: props.licenseModel, - timezone: props.timezone, - dbParameterGroupName, - }; - } - - /** - * Adds the single user rotation of the master password to this instance. - * - * @param options the options for the rotation, - * if you want to override the defaults - */ - public addRotationSingleUser(options: RotationSingleUserOptions = {}): secretsmanager.SecretRotation { - if (!this.secret) { - throw new Error('Cannot add single user rotation for an instance without secret.'); - } - - const id = 'RotationSingleUser'; - const existing = this.node.tryFindChild(id); - if (existing) { - throw new Error('A single user rotation was already added to this instance.'); - } - - return new secretsmanager.SecretRotation(this, id, { - ...applyDefaultRotationOptions(options, this.vpcPlacement), - secret: this.secret, - application: this.singleUserRotationApplication, - vpc: this.vpc, - target: this, - }); - } - - /** - * Adds the multi user rotation to this instance. - */ - public addRotationMultiUser(id: string, options: RotationMultiUserOptions): secretsmanager.SecretRotation { - if (!this.secret) { - throw new Error('Cannot add multi user rotation for an instance without secret.'); - } - - return new secretsmanager.SecretRotation(this, id, { - ...applyDefaultRotationOptions(options, this.vpcPlacement), - secret: options.secret, - masterSecret: this.secret, - application: this.multiUserRotationApplication, - vpc: this.vpc, - target: this, - }); - } -} - -/** - * Construction properties for a DatabaseInstance. - */ -export interface DatabaseInstanceProps extends DatabaseInstanceSourceProps { - /** - * Credentials for the administrative user - * - * @default - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password - */ - readonly credentials?: Credentials; - - /** - * For supported engines, specifies the character set to associate with the - * DB instance. - * - * @default - RDS default character set name - */ - readonly characterSetName?: string; - - /** - * Indicates whether the DB instance is encrypted. - * - * @default - true if storageEncryptionKey has been provided, false otherwise - */ - readonly storageEncrypted?: boolean; - - /** - * The KMS key that's used to encrypt the DB instance. - * - * @default - default master key if storageEncrypted is true, no key otherwise - */ - readonly storageEncryptionKey?: kms.IKey; -} - -/** - * A database instance - * - * @resource AWS::RDS::DBInstance - */ -export class DatabaseInstance extends DatabaseInstanceSource implements IDatabaseInstance { - public readonly instanceIdentifier: string; - public readonly dbInstanceEndpointAddress: string; - public readonly dbInstanceEndpointPort: string; - public readonly instanceEndpoint: Endpoint; - public readonly secret?: secretsmanager.ISecret; - - constructor(scope: Construct, id: string, props: DatabaseInstanceProps) { - super(scope, id, props); - - const credentials = renderCredentials(this, props.engine, props.credentials); - const secret = credentials.secret; - - const instance = new CfnDBInstance(this, 'Resource', { - ...this.sourceCfnProps, - characterSetName: props.characterSetName, - kmsKeyId: props.storageEncryptionKey && props.storageEncryptionKey.keyArn, - masterUsername: credentials.username, - masterUserPassword: credentials.password?.unsafeUnwrap(), - storageEncrypted: props.storageEncryptionKey ? true : props.storageEncrypted, - }); - - this.instanceIdentifier = this.getResourceNameAttribute(instance.ref); - this.dbInstanceEndpointAddress = instance.attrEndpointAddress; - this.dbInstanceEndpointPort = instance.attrEndpointPort; - - // create a number token that represents the port of the instance - const portAttribute = Token.asNumber(instance.attrEndpointPort); - this.instanceEndpoint = new Endpoint(instance.attrEndpointAddress, portAttribute); - - instance.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); - - if (secret) { - this.secret = secret.attach(this); - } - - this.setLogRetention(); - } -} - -/** - * Construction properties for a DatabaseInstanceFromSnapshot. - */ -export interface DatabaseInstanceFromSnapshotProps extends DatabaseInstanceSourceProps { - /** - * The name or Amazon Resource Name (ARN) of the DB snapshot that's used to - * restore the DB instance. If you're restoring from a shared manual DB - * snapshot, you must specify the ARN of the snapshot. - */ - readonly snapshotIdentifier: string; - - /** - * Master user credentials. - * - * Note - It is not possible to change the master username for a snapshot; - * however, it is possible to provide (or generate) a new password. - * - * @default - The existing username and password from the snapshot will be used. - */ - readonly credentials?: SnapshotCredentials; -} - -/** - * A database instance restored from a snapshot. - * - * @resource AWS::RDS::DBInstance - */ -export class DatabaseInstanceFromSnapshot extends DatabaseInstanceSource implements IDatabaseInstance { - public readonly instanceIdentifier: string; - public readonly dbInstanceEndpointAddress: string; - public readonly dbInstanceEndpointPort: string; - public readonly instanceEndpoint: Endpoint; - public readonly secret?: secretsmanager.ISecret; - - constructor(scope: Construct, id: string, props: DatabaseInstanceFromSnapshotProps) { - super(scope, id, props); - - let credentials = props.credentials; - let secret = credentials?.secret; - if (!secret && credentials?.generatePassword) { - if (!credentials.username) { - throw new Error('`credentials` `username` must be specified when `generatePassword` is set to true'); - } - - secret = new DatabaseSecret(this, 'Secret', { - username: credentials.username, - encryptionKey: credentials.encryptionKey, - excludeCharacters: credentials.excludeCharacters, - replaceOnPasswordCriteriaChanges: credentials.replaceOnPasswordCriteriaChanges, - replicaRegions: credentials.replicaRegions, - }); - } - - const instance = new CfnDBInstance(this, 'Resource', { - ...this.sourceCfnProps, - dbSnapshotIdentifier: props.snapshotIdentifier, - masterUserPassword: secret?.secretValueFromJson('password')?.unsafeUnwrap() ?? credentials?.password?.unsafeUnwrap(), // Safe usage - }); - - this.instanceIdentifier = instance.ref; - this.dbInstanceEndpointAddress = instance.attrEndpointAddress; - this.dbInstanceEndpointPort = instance.attrEndpointPort; - - // create a number token that represents the port of the instance - const portAttribute = Token.asNumber(instance.attrEndpointPort); - this.instanceEndpoint = new Endpoint(instance.attrEndpointAddress, portAttribute); - - instance.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); - - if (secret) { - this.secret = secret.attach(this); - } - - this.setLogRetention(); - } -} - -/** - * Construction properties for a DatabaseInstanceReadReplica. - */ -export interface DatabaseInstanceReadReplicaProps extends DatabaseInstanceNewProps { - /** - * The name of the compute and memory capacity classes. - */ - readonly instanceType: ec2.InstanceType; - - /** - * The source database instance. - * - * Each DB instance can have a limited number of read replicas. For more - * information, see https://docs.aws.amazon.com/AmazonRDS/latest/DeveloperGuide/USER_ReadRepl.html. - * - */ - readonly sourceDatabaseInstance: IDatabaseInstance; - - /** - * Indicates whether the DB instance is encrypted. - * - * @default - true if storageEncryptionKey has been provided, false otherwise - */ - readonly storageEncrypted?: boolean; - - /** - * The KMS key that's used to encrypt the DB instance. - * - * @default - default master key if storageEncrypted is true, no key otherwise - */ - readonly storageEncryptionKey?: kms.IKey; -} - -/** - * A read replica database instance. - * - * @resource AWS::RDS::DBInstance - */ -export class DatabaseInstanceReadReplica extends DatabaseInstanceNew implements IDatabaseInstance { - public readonly instanceIdentifier: string; - public readonly dbInstanceEndpointAddress: string; - public readonly dbInstanceEndpointPort: string; - public readonly instanceEndpoint: Endpoint; - public readonly engine?: IInstanceEngine = undefined; - protected readonly instanceType: ec2.InstanceType; - - constructor(scope: Construct, id: string, props: DatabaseInstanceReadReplicaProps) { - super(scope, id, props); - - if (props.sourceDatabaseInstance.engine - && !props.sourceDatabaseInstance.engine.supportsReadReplicaBackups - && props.backupRetention) { - throw new Error(`Cannot set 'backupRetention', as engine '${engineDescription(props.sourceDatabaseInstance.engine)}' does not support automatic backups for read replicas`); - } - - // The read replica instance always uses the same engine as the source instance - // but some CF validations require the engine to be explicitely passed when some - // properties are specified. - const shouldPassEngine = props.domain != null; - - const instance = new CfnDBInstance(this, 'Resource', { - ...this.newCfnProps, - // this must be ARN, not ID, because of https://github.com/terraform-providers/terraform-provider-aws/issues/528#issuecomment-391169012 - sourceDbInstanceIdentifier: props.sourceDatabaseInstance.instanceArn, - kmsKeyId: props.storageEncryptionKey?.keyArn, - storageEncrypted: props.storageEncryptionKey ? true : props.storageEncrypted, - engine: shouldPassEngine ? props.sourceDatabaseInstance.engine?.engineType : undefined, - }); - - this.instanceType = props.instanceType; - this.instanceIdentifier = instance.ref; - this.dbInstanceEndpointAddress = instance.attrEndpointAddress; - this.dbInstanceEndpointPort = instance.attrEndpointPort; - - // create a number token that represents the port of the instance - const portAttribute = Token.asNumber(instance.attrEndpointPort); - this.instanceEndpoint = new Endpoint(instance.attrEndpointAddress, portAttribute); - - instance.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); - - this.setLogRetention(); - } -} - -/** - * Renders the processor features specifications - * - * @param features the processor features - */ -function renderProcessorFeatures(features: ProcessorFeatures): CfnDBInstance.ProcessorFeatureProperty[] | undefined { - const featuresList = Object.entries(features).map(([name, value]) => ({ name, value: value.toString() })); - - return featuresList.length === 0 ? undefined : featuresList; -} - -function defaultIops(storageType: StorageType, iops?: number): number | undefined { - switch (storageType) { - case StorageType.STANDARD: - case StorageType.GP2: - return undefined; - case StorageType.GP3: - return iops; - case StorageType.IO1: - return iops ?? 1000; - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/parameter-group.ts b/packages/@aws-cdk/aws-rds/lib/parameter-group.ts deleted file mode 100644 index 19e93eeda4bcd..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/parameter-group.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { IResource, Lazy, Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IEngine } from './engine'; -import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from './rds.generated'; - -/** - * Options for `IParameterGroup.bindToCluster`. - * Empty for now, but can be extended later. - */ -export interface ParameterGroupClusterBindOptions { -} - -/** - * The type returned from `IParameterGroup.bindToCluster`. - */ -export interface ParameterGroupClusterConfig { - /** The name of this parameter group. */ - readonly parameterGroupName: string; -} - -/** - * Options for `IParameterGroup.bindToInstance`. - * Empty for now, but can be extended later. - */ -export interface ParameterGroupInstanceBindOptions { -} - -/** - * The type returned from `IParameterGroup.bindToInstance`. - */ -export interface ParameterGroupInstanceConfig { - /** The name of this parameter group. */ - readonly parameterGroupName: string; -} - -/** - * A parameter group. - * Represents both a cluster parameter group, - * and an instance parameter group. - */ -export interface IParameterGroup extends IResource { - /** - * Method called when this Parameter Group is used when defining a database cluster. - */ - bindToCluster(options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig; - - /** - * Method called when this Parameter Group is used when defining a database instance. - */ - bindToInstance(options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig; - - /** - * Adds a parameter to this group. - * If this is an imported parameter group, - * this method does nothing. - * - * @returns true if the parameter was actually added - * (i.e., this ParameterGroup is not imported), - * false otherwise - */ - addParameter(key: string, value: string): boolean; -} - -/** - * Properties for a parameter group - */ -export interface ParameterGroupProps { - /** - * The database engine for this parameter group. - */ - readonly engine: IEngine; - - /** - * Description for this parameter group - * - * @default a CDK generated description - */ - readonly description?: string; - - /** - * The parameters in this parameter group - * - * @default - None - */ - readonly parameters?: { [key: string]: string }; -} - -/** - * A parameter group. - * Represents both a cluster parameter group, - * and an instance parameter group. - * - * @resource AWS::RDS::DBParameterGroup - */ -export class ParameterGroup extends Resource implements IParameterGroup { - /** - * Imports a parameter group - */ - public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IParameterGroup { - class Import extends Resource implements IParameterGroup { - public bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig { - return { parameterGroupName }; - } - - public bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig { - return { parameterGroupName }; - } - - public addParameter(_key: string, _value: string): boolean { - return false; - } - } - - return new Import(scope, id); - } - - private readonly parameters: { [key: string]: string }; - private readonly family: string; - private readonly description?: string; - - private clusterCfnGroup?: CfnDBClusterParameterGroup; - private instanceCfnGroup?: CfnDBParameterGroup; - - constructor(scope: Construct, id: string, props: ParameterGroupProps) { - super(scope, id); - - const family = props.engine.parameterGroupFamily; - if (!family) { - throw new Error("ParameterGroup cannot be used with an engine that doesn't specify a version"); - } - this.family = family; - this.description = props.description; - this.parameters = props.parameters ?? {}; - } - - public bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig { - if (!this.clusterCfnGroup) { - const id = this.instanceCfnGroup ? 'ClusterParameterGroup' : 'Resource'; - this.clusterCfnGroup = new CfnDBClusterParameterGroup(this, id, { - description: this.description || `Cluster parameter group for ${this.family}`, - family: this.family, - parameters: Lazy.any({ produce: () => this.parameters }), - }); - } - return { - parameterGroupName: this.clusterCfnGroup.ref, - }; - } - - public bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig { - if (!this.instanceCfnGroup) { - const id = this.clusterCfnGroup ? 'InstanceParameterGroup' : 'Resource'; - this.instanceCfnGroup = new CfnDBParameterGroup(this, id, { - description: this.description || `Parameter group for ${this.family}`, - family: this.family, - parameters: Lazy.any({ produce: () => this.parameters }), - }); - } - return { - parameterGroupName: this.instanceCfnGroup.ref, - }; - } - - /** - * Add a parameter to this parameter group - * - * @param key The key of the parameter to be added - * @param value The value of the parameter to be added - */ - public addParameter(key: string, value: string): boolean { - this.parameters[key] = value; - return true; - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/private/util.ts b/packages/@aws-cdk/aws-rds/lib/private/util.ts deleted file mode 100644 index c96d781abe049..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/private/util.ts +++ /dev/null @@ -1,145 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { RemovalPolicy } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { DatabaseSecret } from '../database-secret'; -import { IEngine } from '../engine'; -import { CommonRotationUserOptions, Credentials } from '../props'; - -/** - * The default set of characters we exclude from generated passwords for database users. - * It's a combination of characters that have a tendency to cause problems in shell scripts, - * some engine-specific characters (for example, Oracle doesn't like '@' in its passwords), - * and some that trip up other services, like DMS. - * - * This constant is private to the RDS module. - */ -export const DEFAULT_PASSWORD_EXCLUDE_CHARS = " %+~`#$&*()|[]{}:;<>?!'/@\"\\"; - -/** Common base of `DatabaseInstanceProps` and `DatabaseClusterBaseProps` that has only the S3 props */ -export interface DatabaseS3ImportExportProps { - readonly s3ImportRole?: iam.IRole; - readonly s3ImportBuckets?: s3.IBucket[]; - readonly s3ExportRole?: iam.IRole; - readonly s3ExportBuckets?: s3.IBucket[]; -} - -/** - * Validates the S3 import/export props and returns the import/export roles, if any. - * If `combineRoles` is true, will reuse the import role for export (or vice versa) if possible. - * - * Notably, `combineRoles` is set to true for instances, but false for clusters. - * This is because the `combineRoles` functionality is most applicable to instances and didn't exist - * for the initial clusters implementation. To maintain backwards compatibility, it is set to false for clusters. - */ -export function setupS3ImportExport( - scope: Construct, - props: DatabaseS3ImportExportProps, - combineRoles: boolean): { s3ImportRole?: iam.IRole, s3ExportRole?: iam.IRole } { - - let s3ImportRole = props.s3ImportRole; - let s3ExportRole = props.s3ExportRole; - - if (props.s3ImportBuckets && props.s3ImportBuckets.length > 0) { - if (props.s3ImportRole) { - throw new Error('Only one of s3ImportRole or s3ImportBuckets must be specified, not both.'); - } - - s3ImportRole = (combineRoles && s3ExportRole) ? s3ExportRole : new iam.Role(scope, 'S3ImportRole', { - assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), - }); - for (const bucket of props.s3ImportBuckets) { - bucket.grantRead(s3ImportRole); - } - } - - if (props.s3ExportBuckets && props.s3ExportBuckets.length > 0) { - if (props.s3ExportRole) { - throw new Error('Only one of s3ExportRole or s3ExportBuckets must be specified, not both.'); - } - - s3ExportRole = (combineRoles && s3ImportRole) ? s3ImportRole : new iam.Role(scope, 'S3ExportRole', { - assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), - }); - for (const bucket of props.s3ExportBuckets) { - bucket.grantReadWrite(s3ExportRole); - } - } - - return { s3ImportRole, s3ExportRole }; -} - -export function engineDescription(engine: IEngine) { - return engine.engineType + (engine.engineVersion?.fullVersion ? `-${engine.engineVersion.fullVersion}` : ''); -} - -/** - * By default, deletion protection is disabled. - * Enable if explicitly provided or if the RemovalPolicy has been set to RETAIN - */ -export function defaultDeletionProtection(deletionProtection?: boolean, removalPolicy?: RemovalPolicy): boolean | undefined { - return deletionProtection ?? (removalPolicy === RemovalPolicy.RETAIN ? true : undefined); -} - -/** - * Renders the credentials for an instance or cluster - */ -export function renderCredentials(scope: Construct, engine: IEngine, credentials?: Credentials): Credentials { - let renderedCredentials = credentials ?? Credentials.fromUsername(engine.defaultUsername ?? 'admin'); // For backwards compatibilty - - if (!renderedCredentials.secret && !renderedCredentials.password) { - renderedCredentials = Credentials.fromSecret( - new DatabaseSecret(scope, 'Secret', { - username: renderedCredentials.username, - secretName: renderedCredentials.secretName, - encryptionKey: renderedCredentials.encryptionKey, - excludeCharacters: renderedCredentials.excludeCharacters, - // if username must be referenced as a string we can safely replace the - // secret when customization options are changed without risking a replacement - replaceOnPasswordCriteriaChanges: credentials?.usernameAsString, - replicaRegions: renderedCredentials.replicaRegions, - }), - // pass username if it must be referenced as a string - credentials?.usernameAsString ? renderedCredentials.username : undefined, - ); - } - - return renderedCredentials; -} - -/** - * The RemovalPolicy that should be applied to a "helper" resource, if the base resource has the given removal policy - * - * - For Clusters, this determines the RemovalPolicy for Instances/SubnetGroups. - * - For Instances, this determines the RemovalPolicy for SubnetGroups. - * - * If the basePolicy is: - * - * DESTROY or SNAPSHOT -> DESTROY (snapshot is good enough to recreate) - * RETAIN -> RETAIN (anything else will lose data or fail to deploy) - * (undefined) -> DESTROY (base policy is assumed to be SNAPSHOT) - */ -export function helperRemovalPolicy(basePolicy?: RemovalPolicy): RemovalPolicy { - return basePolicy === RemovalPolicy.RETAIN - ? RemovalPolicy.RETAIN - : RemovalPolicy.DESTROY; -} - -/** - * Return a given value unless it's the same as another value - */ -export function renderUnless(value: A, suppressValue: A): A | undefined { - return value === suppressValue ? undefined : value; -} - -/** - * Applies defaults for rotation options - */ -export function applyDefaultRotationOptions(options: CommonRotationUserOptions, defaultvpcSubnets?: ec2.SubnetSelection): CommonRotationUserOptions { - return { - excludeCharacters: DEFAULT_PASSWORD_EXCLUDE_CHARS, - vpcSubnets: defaultvpcSubnets, - ...options, - }; -} diff --git a/packages/@aws-cdk/aws-rds/lib/props.ts b/packages/@aws-cdk/aws-rds/lib/props.ts deleted file mode 100644 index 4563f11ac75ef..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/props.ts +++ /dev/null @@ -1,544 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Duration, SecretValue } from '@aws-cdk/core'; -import { IParameterGroup } from './parameter-group'; - -/** - * Instance properties for database instances - */ -export interface InstanceProps { - /** - * What type of instance to start for the replicas. - * - * @default - t3.medium (or, more precisely, db.t3.medium) - */ - readonly instanceType?: ec2.InstanceType; - - /** - * What subnets to run the RDS instances in. - * - * Must be at least 2 subnets in two different AZs. - */ - readonly vpc: ec2.IVpc; - - /** - * Where to place the instances within the VPC - * - * @default - the Vpc default strategy if not specified. - */ - readonly vpcSubnets?: ec2.SubnetSelection; - - /** - * Security group. - * - * @default a new security group is created. - */ - readonly securityGroups?: ec2.ISecurityGroup[]; - - /** - * The DB parameter group to associate with the instance. - * - * @default no parameter group - */ - readonly parameterGroup?: IParameterGroup; - - /** - * The parameters in the DBParameterGroup to create automatically - * - * You can only specify parameterGroup or parameters but not both. - * You need to use a versioned engine to auto-generate a DBParameterGroup. - * - * @default - None - */ - readonly parameters?: { [key: string]: string }; - - /** - * Whether to enable Performance Insights for the DB instance. - * - * @default - false, unless ``performanceInsightRentention`` or ``performanceInsightEncryptionKey`` is set. - */ - readonly enablePerformanceInsights?: boolean; - - /** - * The amount of time, in days, to retain Performance Insights data. - * - * @default 7 - */ - readonly performanceInsightRetention?: PerformanceInsightRetention; - - /** - * The AWS KMS key for encryption of Performance Insights data. - * - * @default - default master key - */ - readonly performanceInsightEncryptionKey?: kms.IKey; - - /** - * Whether to enable automatic upgrade of minor version for the DB instance. - * - * @default - true - */ - readonly autoMinorVersionUpgrade?: boolean; - - /** - * Whether to allow upgrade of major version for the DB instance. - * - * @default - false - */ - readonly allowMajorVersionUpgrade?: boolean; - - /** - * Whether to remove automated backups immediately after the DB instance is deleted for the DB instance. - * - * @default - true - */ - readonly deleteAutomatedBackups?: boolean; - - /** - * Indicates whether the DB instance is an internet-facing instance. - * - * @default - `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise - */ - readonly publiclyAccessible?: boolean; -} - -/** - * Backup configuration for RDS databases - * - * @default - The retention period for automated backups is 1 day. - * The preferred backup window will be a 30-minute window selected at random - * from an 8-hour block of time for each AWS Region. - * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow - */ -export interface BackupProps { - - /** - * How many days to retain the backup - */ - readonly retention: Duration; - - /** - * A daily time range in 24-hours UTC format in which backups preferably execute. - * - * Must be at least 30 minutes long. - * - * Example: '01:00-02:00' - * - * @default - a 30-minute window selected at random from an 8-hour block of - * time for each AWS Region. To see the time blocks available, see - * https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow - */ - readonly preferredWindow?: string; -} - -/** - * Base options for creating Credentials. - */ -export interface CredentialsBaseOptions { - /** - * The name of the secret. - * - * @default - A name is generated by CloudFormation. - */ - readonly secretName?: string; - - /** - * KMS encryption key to encrypt the generated secret. - * - * @default - default master key - */ - readonly encryptionKey?: kms.IKey; - - /** - * The characters to exclude from the generated password. - * Has no effect if `password` has been provided. - * - * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") - */ - readonly excludeCharacters?: string; - - /** - * A list of regions where to replicate this secret. - * - * @default - Secret is not replicated - */ - readonly replicaRegions?: secretsmanager.ReplicaRegion[]; -} - -/** - * Options for creating Credentials from a username. - */ -export interface CredentialsFromUsernameOptions extends CredentialsBaseOptions { - /** - * Password - * - * Do not put passwords in your CDK code directly. - * - * @default - a Secrets Manager generated password - */ - readonly password?: SecretValue; -} - -/** - * Username and password combination - */ -export abstract class Credentials { - /** - * Creates Credentials with a password generated and stored in Secrets Manager. - */ - public static fromGeneratedSecret(username: string, options: CredentialsBaseOptions = {}): Credentials { - return { - ...options, - username, - usernameAsString: true, - }; - } - - /** - * Creates Credentials from a password - * - * Do not put passwords in your CDK code directly. - */ - public static fromPassword(username: string, password: SecretValue): Credentials { - return { - username, - password, - usernameAsString: true, - }; - } - - /** - * Creates Credentials for the given username, and optional password and key. - * If no password is provided, one will be generated and stored in Secrets Manager. - */ - public static fromUsername(username: string, options: CredentialsFromUsernameOptions = {}): Credentials { - return { - ...options, - username, - }; - } - - /** - * Creates Credentials from an existing Secrets Manager ``Secret`` (or ``DatabaseSecret``) - * - * The Secret must be a JSON string with a ``username`` and ``password`` field: - * ``` - * { - * ... - * "username": , - * "password": , - * } - * ``` - * - * @param secret The secret where the credentials are stored - * @param username The username defined in the secret. If specified the username - * will be referenced as a string and not a dynamic reference to the username - * field in the secret. This allows to replace the secret without replacing the - * instance or cluster. - */ - public static fromSecret(secret: secretsmanager.ISecret, username?: string): Credentials { - return { - username: username ?? secret.secretValueFromJson('username').unsafeUnwrap(), - password: secret.secretValueFromJson('password'), - encryptionKey: secret.encryptionKey, - secret, - }; - } - - /** - * Username - */ - public abstract readonly username: string; - - /** - * The name to use for the Secret if a new Secret is to be generated in - * SecretsManager for these Credentials. - * - * @default - A name is generated by CloudFormation. - */ - public abstract readonly secretName?: string; - - /** - * Whether the username should be referenced as a string and not as a dynamic - * reference to the username in the secret. - * - * @default false - */ - public abstract readonly usernameAsString?: boolean; - - /** - * Password - * - * Do not put passwords in your CDK code directly. - * - * @default - a Secrets Manager generated password - */ - public abstract readonly password?: SecretValue; - - /** - * KMS encryption key to encrypt the generated secret. - * - * @default - default master key - */ - public abstract readonly encryptionKey?: kms.IKey; - - /** - * Secret used to instantiate this Login. - * - * @default - none - */ - public abstract readonly secret?: secretsmanager.ISecret; - - /** - * The characters to exclude from the generated password. - * Only used if `password` has not been set. - * - * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") - */ - public abstract readonly excludeCharacters?: string; - - /** - * A list of regions where to replicate the generated secret. - * - * @default - Secret is not replicated - */ - public abstract readonly replicaRegions?: secretsmanager.ReplicaRegion[]; -} - -/** - * Options used in the `SnapshotCredentials.fromGeneratedPassword` method. - */ -export interface SnapshotCredentialsFromGeneratedPasswordOptions { - /** - * KMS encryption key to encrypt the generated secret. - * - * @default - default master key - */ - readonly encryptionKey?: kms.IKey; - - /** - * The characters to exclude from the generated password. - * - * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") - */ - readonly excludeCharacters?: string; - - /** - * A list of regions where to replicate this secret. - * - * @default - Secret is not replicated - */ - readonly replicaRegions?: secretsmanager.ReplicaRegion[]; -} - -/** - * Credentials to update the password for a ``DatabaseInstanceFromSnapshot``. - */ -export abstract class SnapshotCredentials { - /** - * Generate a new password for the snapshot, using the existing username and an optional encryption key. - * The new credentials are stored in Secrets Manager. - * - * Note - The username must match the existing master username of the snapshot. - */ - public static fromGeneratedSecret(username: string, options: SnapshotCredentialsFromGeneratedPasswordOptions = {}): SnapshotCredentials { - return { - ...options, - generatePassword: true, - replaceOnPasswordCriteriaChanges: true, - username, - }; - } - - /** - * Generate a new password for the snapshot, using the existing username and an optional encryption key. - * - * Note - The username must match the existing master username of the snapshot. - * - * NOTE: use `fromGeneratedSecret()` for new Clusters and Instances. Switching from - * `fromGeneratedPassword()` to `fromGeneratedSecret()` for already deployed Clusters - * or Instances will update their master password. - */ - public static fromGeneratedPassword(username: string, options: SnapshotCredentialsFromGeneratedPasswordOptions = {}): SnapshotCredentials { - return { - ...options, - generatePassword: true, - username, - }; - } - - /** - * Update the snapshot login with an existing password. - */ - public static fromPassword(password: SecretValue): SnapshotCredentials { - return { generatePassword: false, password }; - } - - /** - * Update the snapshot login with an existing password from a Secret. - * - * The Secret must be a JSON string with a ``password`` field: - * ``` - * { - * ... - * "password": , - * } - * ``` - */ - public static fromSecret(secret: secretsmanager.ISecret): SnapshotCredentials { - return { - generatePassword: false, - password: secret.secretValueFromJson('password'), - secret, - }; - } - - /** - * The master user name. - * - * Must be the **current** master user name of the snapshot. - * It is not possible to change the master user name of a RDS instance. - * - * @default - the existing username from the snapshot - */ - public abstract readonly username?: string; - - /** - * Whether a new password should be generated. - */ - public abstract readonly generatePassword: boolean; - - /** - * Whether to replace the generated secret when the criteria for the password change. - * - * @default false - */ - public abstract readonly replaceOnPasswordCriteriaChanges?: boolean; - - /** - * The master user password. - * - * Do not put passwords in your CDK code directly. - * - * @default - the existing password from the snapshot - */ - public abstract readonly password?: SecretValue; - - /** - * KMS encryption key to encrypt the generated secret. - * - * @default - default master key - */ - public abstract readonly encryptionKey?: kms.IKey; - - /** - * Secret used to instantiate this Login. - * - * @default - none - */ - public abstract readonly secret?: secretsmanager.ISecret; - - /** - * The characters to exclude from the generated password. - * Only used if `generatePassword` if true. - * - * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") - */ - public abstract readonly excludeCharacters?: string; - - /** - * A list of regions where to replicate the generated secret. - * - * @default - Secret is not replicated - */ - public abstract readonly replicaRegions?: secretsmanager.ReplicaRegion[]; -} - -/** - * Properties common to single-user and multi-user rotation options. - */ -export interface CommonRotationUserOptions { - /** - * Specifies the number of days after the previous rotation - * before Secrets Manager triggers the next automatic rotation. - * - * @default - 30 days - */ - readonly automaticallyAfter?: Duration; - - /** - * Specifies characters to not include in generated passwords. - * - * @default " %+~`#$&*()|[]{}:;<>?!'/@\"\\" - */ - readonly excludeCharacters?: string; - - /** - * Where to place the rotation Lambda function - * - * @default - same placement as instance or cluster - */ - readonly vpcSubnets?: ec2.SubnetSelection; - - /** - * The VPC interface endpoint to use for the Secrets Manager API - * - * If you enable private DNS hostnames for your VPC private endpoint (the default), you don't - * need to specify an endpoint. The standard Secrets Manager DNS hostname the Secrets Manager - * CLI and SDKs use by default (https://secretsmanager..amazonaws.com) automatically - * resolves to your VPC endpoint. - * - * @default https://secretsmanager..amazonaws.com - */ - readonly endpoint?: ec2.IInterfaceVpcEndpoint; - - /** - * The security group for the Lambda rotation function - * - * @default - a new security group is created - */ - readonly securityGroup?: ec2.ISecurityGroup; -} - -/** - * Options to add the multi user rotation - */ -export interface RotationSingleUserOptions extends CommonRotationUserOptions { -} - -/** - * Options to add the multi user rotation - */ -export interface RotationMultiUserOptions extends CommonRotationUserOptions { - /** - * The secret to rotate. It must be a JSON string with the following format: - * ``` - * { - * "engine": , - * "host": , - * "username": , - * "password": , - * "dbname": , - * "port": , - * "masterarn": - * } - * ``` - */ - readonly secret: secretsmanager.ISecret; -} - -/** - * The retention period for Performance Insight. - */ -export enum PerformanceInsightRetention { - /** - * Default retention period of 7 days. - */ - DEFAULT = 7, - - /** - * Long term retention period of 2 years. - */ - LONG_TERM = 731 -} diff --git a/packages/@aws-cdk/aws-rds/package.json b/packages/@aws-cdk/aws-rds/package.json deleted file mode 100644 index 4244cd3725b29..0000000000000 --- a/packages/@aws-cdk/aws-rds/package.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "name": "@aws-cdk/aws-rds", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::RDS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.rds", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "rds" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.RDS", - "packageId": "Amazon.CDK.AWS.RDS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-rds", - "module": "aws_cdk.aws_rds", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-rds" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RDS", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "rds" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "attribute-tag:@aws-cdk/aws-rds.DatabaseSecret.secretFullArn", - "attribute-tag:@aws-cdk/aws-rds.DatabaseSecret.secretName", - "resource-attribute:@aws-cdk/aws-rds.DatabaseClusterFromSnapshot.dbInstanceEndpointHostedZoneId", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstance.dbInstanceEndpointHostedZoneId", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstanceFromSnapshot.dbInstanceEndpointHostedZoneId", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstanceReadReplica.dbInstanceEndpointHostedZoneId", - "props-physical-name:@aws-cdk/aws-rds.ParameterGroupProps", - "props-physical-name:@aws-cdk/aws-rds.DatabaseClusterProps", - "props-physical-name:@aws-cdk/aws-rds.DatabaseClusterFromSnapshotProps", - "props-physical-name:@aws-cdk/aws-rds.DatabaseInstanceProps", - "props-physical-name:@aws-cdk/aws-rds.DatabaseInstanceFromSnapshotProps", - "props-physical-name:@aws-cdk/aws-rds.DatabaseInstanceReadReplicaProps", - "props-physical-name:@aws-cdk/aws-rds.DatabaseSecretProps", - "props-physical-name:@aws-cdk/aws-rds.ServerlessClusterProps", - "props-physical-name:@aws-cdk/aws-rds.ServerlessClusterFromSnapshotProps", - "props-physical-name:@aws-cdk/aws-rds.OptionGroupProps", - "props-physical-name:@aws-cdk/aws-rds.SubnetGroupProps", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.semanticVersion", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.applicationId", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.SQLSERVER_ROTATION_SINGLE_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.SQLSERVER_ROTATION_MULTI_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.POSTGRES_ROTATION_SINGLE_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.POSTGRES_ROTATION_MULTI_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.ORACLE_ROTATION_SINGLE_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.ORACLE_ROTATION_MULTI_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.MYSQL_ROTATION_SINGLE_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.MYSQL_ROTATION_MULTI_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.MARIADB_ROTATION_SINGLE_USER", - "docs-public-apis:@aws-cdk/aws-rds.SecretRotationApplication.MARIADB_ROTATION_MULTI_USER", - "resource-attribute:@aws-cdk/aws-rds.DatabaseProxy.dbProxyVpcId", - "resource-attribute:@aws-cdk/aws-rds.ParameterGroup.dbParameterGroupName", - "resource-attribute:@aws-cdk/aws-rds.DatabaseCluster.dbClusterArn", - "resource-attribute:@aws-cdk/aws-rds.DatabaseClusterFromSnapshot.dbInstanceArn", - "resource-attribute:@aws-cdk/aws-rds.DatabaseClusterFromSnapshot.dbInstanceDbiResourceId", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstance.dbInstanceArn", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstance.dbInstanceDbiResourceId", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstanceFromSnapshot.dbInstanceArn", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstanceFromSnapshot.dbInstanceDbiResourceId", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstanceReadReplica.dbInstanceArn", - "resource-attribute:@aws-cdk/aws-rds.DatabaseInstanceReadReplica.dbInstanceDbiResourceId", - "resource-attribute:@aws-cdk/aws-rds.ServerlessCluster.dbClusterArn", - "resource-attribute:@aws-cdk/aws-rds.ServerlessClusterFromSnapshot.dbClusterArn" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-rds/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-rds/rosetta/default.ts-fixture deleted file mode 100644 index 7e78fde1372a1..0000000000000 --- a/packages/@aws-cdk/aws-rds/rosetta/default.ts-fixture +++ /dev/null @@ -1,18 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, SecretValue, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import ec2 = require('@aws-cdk/aws-ec2'); -import rds = require('@aws-cdk/aws-rds'); -import targets = require('@aws-cdk/aws-events-targets'); -import lambda = require('@aws-cdk/aws-lambda'); -import kms = require('@aws-cdk/aws-kms'); -import iam = require('@aws-cdk/aws-iam'); -import secretsmanager = require('@aws-cdk/aws-secretsmanager'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-rds/test/cluster.test.ts b/packages/@aws-cdk/aws-rds/test/cluster.test.ts deleted file mode 100644 index fd60567e0eb44..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/cluster.test.ts +++ /dev/null @@ -1,2756 +0,0 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { ManagedPolicy, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { - AuroraEngineVersion, AuroraMysqlEngineVersion, AuroraPostgresEngineVersion, CfnDBCluster, Credentials, DatabaseCluster, - DatabaseClusterEngine, DatabaseClusterFromSnapshot, ParameterGroup, PerformanceInsightRetention, SubnetGroup, DatabaseSecret, - DatabaseInstanceEngine, SqlServerEngineVersion, SnapshotCredentials, InstanceUpdateBehaviour, NetworkType, -} from '../lib'; - -describe('cluster', () => { - test('creating a Cluster also creates 2 DB Instances', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - iamAuthentication: true, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { - Properties: { - Engine: 'aurora', - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - MasterUsername: 'admin', - MasterUserPassword: 'tooshort', - VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], - EnableIAMDatabaseAuthentication: true, - CopyTagsToSnapshot: true, - }, - DeletionPolicy: 'Snapshot', - UpdateReplacePolicy: 'Snapshot', - }); - - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBInstance', 2); - Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { - DeletionPolicy: 'Delete', - UpdateReplacePolicy: 'Delete', - }); - }); - - test('validates that the number of instances is not a deploy-time value', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const parameter = new cdk.CfnParameter(stack, 'Param', { type: 'Number' }); - - expect(() => { - new DatabaseCluster(stack, 'Database', { - instances: parameter.valueAsNumber, - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - }, - }); - }).toThrow('The number of instances an RDS Cluster consists of cannot be provided as a deploy-time only value!'); - }); - - test('can create a cluster with a single instance', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - Engine: 'aurora', - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - MasterUsername: 'admin', - MasterUserPassword: 'tooshort', - VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], - }); - - expect(stack.resolve(cluster.clusterResourceIdentifier)).toEqual({ 'Fn::GetAtt': ['DatabaseB269D8BB', 'DBClusterResourceId'] }); - expect(cluster.instanceIdentifiers).toHaveLength(1); - expect(stack.resolve(cluster.instanceIdentifiers[0])).toEqual({ - Ref: 'DatabaseInstance1844F58FD', - }); - - expect(cluster.instanceEndpoints).toHaveLength(1); - expect(stack.resolve(cluster.instanceEndpoints[0])).toEqual({ - hostname: { - 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'], - }, - port: { - 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'], - }, - socketAddress: { - 'Fn::Join': ['', [ - { 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'] }, - ':', - { 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'] }, - ]], - }, - }); - }); - - test('can create a cluster with ROLLING instance update behaviour', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 5, - instanceProps: { - vpc, - }, - instanceUpdateBehaviour: InstanceUpdateBehaviour.ROLLING, - }); - - // THEN - const instanceResources = Template.fromStack(stack).findResources('AWS::RDS::DBInstance'); - const instances = Object.keys(instanceResources); - const instanceDependencies = Object.values(instanceResources) - .map(properties => (properties.DependsOn as string[]).filter(dependency => instances.includes(dependency))); - // check that there are only required dependencies to form a chain of dependant instances - for (const dependencies of instanceDependencies) { - expect(dependencies.length).toBeLessThanOrEqual(1); - } - // check that all but one instance are a dependency of another instance - const dependantInstances = instanceDependencies.flat(); - expect(dependantInstances).toHaveLength(instances.length - 1); - expect(instances.filter(it => !dependantInstances.includes(it))).toHaveLength(1); - }); - - test('can create a cluster with imported vpc and security group', () => { - // GIVEN - const stack = testStack(); - const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { - vpcId: 'VPC12345', - }); - const sg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'SecurityGroupId12345'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - securityGroups: [sg], - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - Engine: 'aurora', - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - MasterUsername: 'admin', - MasterUserPassword: 'tooshort', - VpcSecurityGroupIds: ['SecurityGroupId12345'], - }); - }); - - test('cluster with parameter group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const group = new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'bye', - parameters: { - param: 'value', - }, - }); - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - parameterGroup: group, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DBClusterParameterGroupName: { Ref: 'ParamsA8366201' }, - }); - }); - - test("sets the retention policy of the SubnetGroup to 'Retain' if the Cluster is created with 'Retain'", () => { - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc'); - - new DatabaseCluster(stack, 'Cluster', { - credentials: { username: 'admin' }, - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), - vpc, - }, - removalPolicy: cdk.RemovalPolicy.RETAIN, - }); - - Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }); - }); - - test('creates a secret when master credentials are not specified', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - credentials: { - username: 'admin', - excludeCharacters: '"@/\\', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - MasterUsername: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DatabaseSecret3B817195', - }, - ':SecretString:username::}}', - ], - ], - }, - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DatabaseSecret3B817195', - }, - ':SecretString:password::}}', - ], - ], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: { - ExcludeCharacters: '\"@/\\', - GenerateStringKey: 'password', - PasswordLength: 30, - SecretStringTemplate: '{"username":"admin"}', - }, - }); - }); - - test('create an encrypted cluster with custom KMS key', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - storageEncryptionKey: new kms.Key(stack, 'Key'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - KmsKeyId: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - }); - }); - - test('cluster with instance parameter group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { - engine: DatabaseClusterEngine.AURORA, - parameters: { - key: 'value', - }, - }); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - parameterGroup, - vpc, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBParameterGroupName: { - Ref: 'ParameterGroup5E32DECB', - }, - }); - }); - - test('cluster with inline parameter group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - parameters: { - locks: '100', - }, - instanceProps: { - vpc, - parameters: { - locks: '200', - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DBClusterParameterGroupName: { - Ref: 'DatabaseParameterGroup2A921026', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - locks: '100', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBParameterGroupName: { - Ref: 'DatabaseInstanceParameterGroup6968C5BF', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBParameterGroup', { - Family: 'aurora5.6', - Parameters: { - locks: '200', - }, - }); - }); - - test('cluster with inline parameter group and parameterGroup arg fails', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { - engine: DatabaseInstanceEngine.sqlServerEe({ - version: SqlServerEngineVersion.VER_11, - }), - parameters: { - locks: '50', - }, - }); - - expect(() => { - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - parameters: { - locks: '100', - }, - parameterGroup, - instanceProps: { - vpc, - parameters: { - locks: '200', - }, - }, - }); - }).toThrow(/You cannot specify both parameterGroup and parameters/); - }); - - test('instance with inline parameter group and parameterGroup arg fails', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { - engine: DatabaseInstanceEngine.sqlServerEe({ - version: SqlServerEngineVersion.VER_11, - }), - parameters: { - locks: '50', - }, - }); - - expect(() => { - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - parameters: { - locks: '100', - }, - instanceProps: { - vpc, - parameterGroup, - parameters: { - locks: '200', - }, - }, - }); - }).toThrow(/You cannot specify both parameterGroup and parameters/); - }); - - test('instance with IPv4 network type', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - vpc, - }, - networkType: NetworkType.IPV4, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - NetworkType: 'IPV4', - }); - }); - - test('instance with dual-stack network type', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - vpc, - }, - networkType: NetworkType.DUAL, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - NetworkType: 'DUAL', - }); - }); - - describe('performance insights', () => { - test('cluster with all performance insights properties', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - }, - instanceProps: { - vpc, - enablePerformanceInsights: true, - performanceInsightRetention: PerformanceInsightRetention.LONG_TERM, - performanceInsightEncryptionKey: new kms.Key(stack, 'Key'), - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EnablePerformanceInsights: true, - PerformanceInsightsRetentionPeriod: 731, - PerformanceInsightsKMSKeyId: { 'Fn::GetAtt': ['Key961B73FD', 'Arn'] }, - }); - }); - - test('setting performance insights fields enables performance insights', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - }, - instanceProps: { - vpc, - performanceInsightRetention: PerformanceInsightRetention.LONG_TERM, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EnablePerformanceInsights: true, - PerformanceInsightsRetentionPeriod: 731, - }); - }); - - test('throws if performance insights fields are set but performance insights is disabled', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - expect(() => { - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - }, - instanceProps: { - vpc, - enablePerformanceInsights: false, - performanceInsightRetention: PerformanceInsightRetention.DEFAULT, - }, - }); - }).toThrow(/`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set/); - }); - }); - - test('cluster with disable automatic upgrade of minor version', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - autoMinorVersionUpgrade: false, - vpc, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - AutoMinorVersionUpgrade: false, - }); - }); - - test('cluster with allow upgrade of major version', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - allowMajorVersionUpgrade: true, - vpc, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - AllowMajorVersionUpgrade: true, - }); - }); - - test('cluster with disallow remove backups', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - deleteAutomatedBackups: false, - vpc, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DeleteAutomatedBackups: false, - }); - }); - - test('create a cluster using a specific version of MySQL', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraMysql({ - version: AuroraMysqlEngineVersion.VER_2_04_4, - }), - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - Engine: 'aurora-mysql', - EngineVersion: '5.7.mysql_aurora.2.04.4', - }); - }); - - test('create a cluster using a specific version of Postgresql', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_10_7, - }), - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - Engine: 'aurora-postgresql', - EngineVersion: '10.7', - }); - }); - - test('cluster exposes different read and write endpoints', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - expect(stack.resolve(cluster.clusterEndpoint)).not.toEqual(stack.resolve(cluster.clusterReadEndpoint)); - }); - - test('imported cluster with imported security group honors allowAllOutbound', () => { - // GIVEN - const stack = testStack(); - - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterEndpointAddress: 'addr', - clusterIdentifier: 'identifier', - instanceEndpointAddresses: ['addr'], - instanceIdentifiers: ['identifier'], - port: 3306, - readerEndpointAddress: 'reader-address', - securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - })], - }); - - // WHEN - cluster.connections.allowToAnyIpv4(ec2.Port.tcp(443)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: 'sg-123456789', - }); - }); - - test('can import a cluster with minimal attributes', () => { - const stack = testStack(); - - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterIdentifier: 'identifier', - }); - - expect(cluster.clusterIdentifier).toEqual('identifier'); - }); - - test('minimal imported cluster throws on accessing attributes for unprovided parameters', () => { - const stack = testStack(); - - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterIdentifier: 'identifier', - }); - - expect(() => cluster.clusterResourceIdentifier).toThrow(/Cannot access `clusterResourceIdentifier` of an imported cluster/); - expect(() => cluster.clusterEndpoint).toThrow(/Cannot access `clusterEndpoint` of an imported cluster/); - expect(() => cluster.clusterReadEndpoint).toThrow(/Cannot access `clusterReadEndpoint` of an imported cluster/); - expect(() => cluster.instanceIdentifiers).toThrow(/Cannot access `instanceIdentifiers` of an imported cluster/); - expect(() => cluster.instanceEndpoints).toThrow(/Cannot access `instanceEndpoints` of an imported cluster/); - }); - - test('imported cluster can access properties if attributes are provided', () => { - const stack = testStack(); - - const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { - clusterEndpointAddress: 'addr', - clusterIdentifier: 'identifier', - clusterResourceIdentifier: 'identifier', - instanceEndpointAddresses: ['instance-addr'], - instanceIdentifiers: ['identifier'], - port: 3306, - readerEndpointAddress: 'reader-address', - securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - })], - }); - - expect(cluster.clusterResourceIdentifier).toEqual('identifier'); - expect(cluster.clusterEndpoint.socketAddress).toEqual('addr:3306'); - expect(cluster.clusterReadEndpoint.socketAddress).toEqual('reader-address:3306'); - expect(cluster.instanceIdentifiers).toEqual(['identifier']); - expect(cluster.instanceEndpoints.map(endpoint => endpoint.socketAddress)).toEqual(['instance-addr:3306']); - }); - - test('cluster supports metrics', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_02_0 }), - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - vpc, - }, - }); - - expect(stack.resolve(cluster.metricCPUUtilization())).toEqual({ - dimensions: { DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' } }, - namespace: 'AWS/RDS', - metricName: 'CPUUtilization', - period: cdk.Duration.minutes(5), - statistic: 'Average', - account: '12345', - region: 'us-test-1', - }); - }); - - test('cluster with enabled monitoring', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - monitoringInterval: cdk.Duration.minutes(1), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'monitoring.rds.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', - ], - ], - }, - ], - }); - }); - - test('create a cluster with imported monitoring role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const monitoringRole = new Role(stack, 'MonitoringRole', { - assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [ - ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), - ], - }); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - monitoringInterval: cdk.Duration.minutes(1), - monitoringRole, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': ['MonitoringRole90457BF9', 'Arn'], - }, - }); - }); - - test('addRotationSingleUser()', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // WHEN - cluster.addRotationSingleUser(); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { - Ref: 'DatabaseSecretAttachmentE5D1B020', - }, - RotationLambdaARN: { - 'Fn::GetAtt': [ - 'DatabaseRotationSingleUser65F55654', - 'Outputs.RotationLambdaARN', - ], - }, - RotationRules: { - AutomaticallyAfterDays: 30, - }, - }); - }); - - test('addRotationMultiUser()', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - const userSecret = new DatabaseSecret(stack, 'UserSecret', { username: 'user' }); - cluster.addRotationMultiUser('user', { secret: userSecret.attach(cluster) }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { - Ref: 'UserSecretAttachment16ACBE6D', - }, - RotationLambdaARN: { - 'Fn::GetAtt': [ - 'DatabaseuserECD1FB0C', - 'Outputs.RotationLambdaARN', - ], - }, - RotationRules: { - AutomaticallyAfterDays: 30, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - masterSecretArn: { - Ref: 'DatabaseSecretAttachmentE5D1B020', - }, - }, - }); - }); - - test('addRotationSingleUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { - vpcId: 'vpc-id', - availabilityZones: ['az1'], - publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], - publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], - privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], - privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], - isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], - isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], - }); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc: vpcWithIsolated, - }); - - // WHEN - // DB in isolated subnet (no internet connectivity) - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc: vpcWithIsolated, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }, - }); - - // Rotation in private subnet (internet via NAT) - cluster.addRotationSingleUser({ - automaticallyAfter: cdk.Duration.days(15), - excludeCharacters: '°_@', - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - securityGroup, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - RotationRules: { - AutomaticallyAfterDays: 15, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - endpoint: { - 'Fn::Join': ['', [ - 'https://secretsmanager.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', - excludeCharacters: '°_@', - vpcSecurityGroupIds: { - 'Fn::GetAtt': [ - stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), - 'GroupId', - ], - }, - }, - }); - }); - - test('addRotationMultiUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { - vpcId: 'vpc-id', - availabilityZones: ['az1'], - publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], - publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], - privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], - privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], - isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], - isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], - }); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc: vpcWithIsolated, - }); - const userSecret = new DatabaseSecret(stack, 'UserSecret', { username: 'user' }); - - // WHEN - // DB in isolated subnet (no internet connectivity) - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc: vpcWithIsolated, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }, - }); - - // Rotation in private subnet (internet via NAT) - cluster.addRotationMultiUser('user', { - secret: userSecret.attach(cluster), - automaticallyAfter: cdk.Duration.days(15), - excludeCharacters: '°_@', - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - securityGroup, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - RotationRules: { - AutomaticallyAfterDays: 15, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - endpoint: { - 'Fn::Join': ['', [ - 'https://secretsmanager.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', - excludeCharacters: '°_@', - vpcSecurityGroupIds: { - 'Fn::GetAtt': [ - stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), - 'GroupId', - ], - }, - }, - }); - }); - - test('addRotationSingleUser() with VPC interface endpoint', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpcIsolatedOnly = new ec2.Vpc(stack, 'Vpc', { natGateways: 0 }); - - const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { - service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, - vpc: vpcIsolatedOnly, - subnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }); - - // DB in isolated subnet (no internet connectivity) - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc: vpcIsolatedOnly, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }, - }); - - // Rotation in isolated subnet with access to Secrets Manager API via endpoint - cluster.addRotationSingleUser({ endpoint }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - endpoint: { - 'Fn::Join': ['', [ - 'https://', - { Ref: 'EndpointEEF1FD8F' }, - '.secretsmanager.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - functionName: 'DatabaseRotationSingleUser458A45BE', - vpcSubnetIds: { - 'Fn::Join': ['', [ - { Ref: 'VpcIsolatedSubnet1SubnetE48C5737' }, - ',', - { Ref: 'VpcIsolatedSubnet2Subnet16364B91' }, - ]], - }, - vpcSecurityGroupIds: { - 'Fn::GetAtt': [ - 'DatabaseRotationSingleUserSecurityGroupAC6E0E73', - 'GroupId', - ], - }, - excludeCharacters: " %+~`#$&*()|[]{}:;<>?!'/@\"\\", - }, - }); - }); - - test('throws when trying to add rotation to a cluster without secret', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - expect(() => cluster.addRotationSingleUser()).toThrow(/without a secret/); - }); - - test('throws when trying to add single user rotation multiple times', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - credentials: { username: 'admin' }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // WHEN - cluster.addRotationSingleUser(); - - // THEN - expect(() => cluster.addRotationSingleUser()).toThrow(/A single user rotation was already added to this cluster/); - }); - - test('create a cluster with s3 import role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const associatedRole = new Role(stack, 'AssociatedRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ImportRole: associatedRole, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'AssociatedRole824CFCD3', - 'Arn', - ], - }, - }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - aurora_load_from_s3_role: { - 'Fn::GetAtt': [ - 'AssociatedRole824CFCD3', - 'Arn', - ], - }, - }, - }); - }); - - test('create a cluster with s3 import buckets', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ImportBuckets: [bucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - aurora_load_from_s3_role: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - ], - Effect: 'Allow', - Resource: [ - { - 'Fn::GetAtt': [ - 'Bucket83908E77', - 'Arn', - ], - }, - { - 'Fn::Join': [ - '', - [ - { - 'Fn::GetAtt': [ - 'Bucket83908E77', - 'Arn', - ], - }, - '/*', - ], - ], - }, - ], - }, - ], - Version: '2012-10-17', - }, - }); - }); - - test('cluster with s3 import bucket adds supported feature name to IAM role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_10_12, - }), - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ImportBuckets: [bucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - FeatureName: 's3Import', - }], - }); - }); - - test('throws when s3 import bucket or s3 export bucket is supplied for a Postgres version that does not support it', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN / THEN - expect(() => { - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_10_4, - }), - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ImportBuckets: [bucket], - }); - }).toThrow(/s3Import is not supported for Postgres version: 10.4. Use a version that supports the s3Import feature./); - - expect(() => { - new DatabaseCluster(stack, 'AnotherDatabase', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_10_4, - }), - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ExportBuckets: [bucket], - }); - }).toThrow(/s3Export is not supported for Postgres version: 10.4. Use a version that supports the s3Export feature./); - }); - - test('cluster with s3 export bucket adds supported feature name to IAM role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_10_12, - }), - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ExportBuckets: [bucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - FeatureName: 's3Export', - }], - }); - }); - - test('create a cluster with s3 export role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const associatedRole = new Role(stack, 'AssociatedRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ExportRole: associatedRole, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'AssociatedRole824CFCD3', - 'Arn', - ], - }, - }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - aurora_select_into_s3_role: { - 'Fn::GetAtt': [ - 'AssociatedRole824CFCD3', - 'Arn', - ], - }, - }, - }); - }); - - test('create a cluster with s3 export buckets', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ExportBuckets: [bucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - aurora_select_into_s3_role: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - 's3:DeleteObject*', - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Resource: [ - { - 'Fn::GetAtt': [ - 'Bucket83908E77', - 'Arn', - ], - }, - { - 'Fn::Join': [ - '', - [ - { - 'Fn::GetAtt': [ - 'Bucket83908E77', - 'Arn', - ], - }, - '/*', - ], - ], - }, - ], - }, - ], - Version: '2012-10-17', - }, - }); - }); - - test('create a cluster with s3 import and export buckets', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const importBucket = new s3.Bucket(stack, 'ImportBucket'); - const exportBucket = new s3.Bucket(stack, 'ExportBucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ImportBuckets: [importBucket], - s3ExportBuckets: [exportBucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - }, - { - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - aurora_load_from_s3_role: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - aurora_select_into_s3_role: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }, - }); - }); - - test('create a cluster with s3 import and export buckets and custom parameter group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { - engine: DatabaseClusterEngine.AURORA, - parameters: { - key: 'value', - }, - }); - - const importBucket = new s3.Bucket(stack, 'ImportBucket'); - const exportBucket = new s3.Bucket(stack, 'ExportBucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - parameterGroup, - s3ImportBuckets: [importBucket], - s3ExportBuckets: [exportBucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - }, - { - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora5.6', - Parameters: { - key: 'value', - aurora_load_from_s3_role: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - aurora_select_into_s3_role: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }, - }); - }); - - test('PostgreSQL cluster with s3 export buckets does not generate custom parameter group and specifies the correct port', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_11_6, - }), - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ExportBuckets: [bucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [{ - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }], - DBClusterParameterGroupName: 'default.aurora-postgresql11', - Port: 5432, - }); - - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 0); - }); - - test('unversioned PostgreSQL cluster can be used with s3 import and s3 export buckets', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const bucket = new s3.Bucket(stack, 'Bucket'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_POSTGRESQL, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - parameterGroup: ParameterGroup.fromParameterGroupName(stack, 'ParameterGroup', 'default.aurora-postgresql11'), - s3ImportBuckets: [bucket], - s3ExportBuckets: [bucket], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - AssociatedRoles: [ - { - FeatureName: 's3Import', - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ImportRole377BC9C0', - 'Arn', - ], - }, - }, - { - FeatureName: 's3Export', - RoleArn: { - 'Fn::GetAtt': [ - 'DatabaseS3ExportRole9E328562', - 'Arn', - ], - }, - }, - ], - }); - }); - - test("Aurora PostgreSQL cluster uses a different default master username than 'admin', which is a reserved word", () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ - version: AuroraPostgresEngineVersion.VER_9_6_12, - }), - instanceProps: { vpc }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: { - SecretStringTemplate: '{"username":"postgres"}', - }, - }); - }); - - test('MySQL cluster without S3 exports or imports references the correct default ParameterGroup', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DBClusterParameterGroupName: 'default.aurora-mysql5.7', - }); - - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 0); - }); - - test('MySQL cluster in version 8.0 uses aws_default_s3_role as a Parameter for S3 import/export, instead of aurora_load/select_from_s3_role', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - instanceProps: { vpc }, - engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_01_0 }), - s3ImportBuckets: [new s3.Bucket(stack, 'ImportBucket')], - s3ExportBuckets: [new s3.Bucket(stack, 'ExportBucket')], - }); - - const assert = Template.fromStack(stack); - assert.hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Family: 'aurora-mysql8.0', - Parameters: { - aws_default_s3_role: { - 'Fn::GetAtt': ['DatabaseS3ImportRole377BC9C0', 'Arn'], - }, - aurora_load_from_s3_role: Match.absent(), - aurora_select_into_s3_role: Match.absent(), - }, - }); - assert.resourceCountIs('AWS::IAM::Role', 1); - }); - - test('throws when s3ExportRole and s3ExportBuckets properties are both specified', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const exportRole = new Role(stack, 'ExportRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - const exportBucket = new s3.Bucket(stack, 'ExportBucket'); - - // THEN - expect(() => new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ExportRole: exportRole, - s3ExportBuckets: [exportBucket], - })).toThrow(); - }); - - test('throws when s3ImportRole and s3ImportBuckets properties are both specified', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const importRole = new Role(stack, 'ImportRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - const importBucket = new s3.Bucket(stack, 'ImportBucket'); - - // THEN - expect(() => new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - s3ImportRole: importRole, - s3ImportBuckets: [importBucket], - })).toThrow(); - }); - - test('can set CloudWatch log exports', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - EnableCloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], - }); - }); - - test('can set CloudWatch log retention', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - cloudwatchLogsExports: ['error', 'general'], - cloudwatchLogsRetention: logs.RetentionDays.THREE_MONTHS, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { - ServiceToken: { - 'Fn::GetAtt': [ - 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', - 'Arn', - ], - }, - LogGroupName: { 'Fn::Join': ['', ['/aws/rds/cluster/', { Ref: 'DatabaseB269D8BB' }, '/error']] }, - RetentionInDays: 90, - }); - Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { - ServiceToken: { - 'Fn::GetAtt': [ - 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', - 'Arn', - ], - }, - LogGroupName: { 'Fn::Join': ['', ['/aws/rds/cluster/', { Ref: 'DatabaseB269D8BB' }, '/general']] }, - RetentionInDays: 90, - }); - }); - - test('throws if given unsupported CloudWatch log exports', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - expect(() => { - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit', 'thislogdoesnotexist', 'neitherdoesthisone'], - }); - }).toThrow(/Unsupported logs for the current engine type: thislogdoesnotexist,neitherdoesthisone/); - }); - - test('can set deletion protection', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: { - username: 'admin', - password: cdk.SecretValue.unsafePlainText('tooshort'), - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }, - deletionProtection: true, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DeletionProtection: true, - }); - }); - - test('does not throw (but adds a node error) if a (dummy) VPC does not have sufficient subnets', () => { - // GIVEN - const app = new cdk.App(); - const stack = testStack(app, 'TestStack'); - const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { isDefault: true }); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instances: 1, - credentials: { - username: 'admin', - }, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - vpcSubnets: { - subnetName: 'DefinitelyDoesNotExist', - }, - }, - }); - - // THEN - const art = app.synth().getStackArtifact('TestStack'); - const meta = art.findMetadataByType('aws:cdk:error'); - expect(meta[0].data).toEqual('Cluster requires at least 2 subnets, got 0'); - }); - - test('create a cluster from a snapshot', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - iamAuthentication: true, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { - Properties: { - Engine: 'aurora', - EngineVersion: '5.6.mysql_aurora.1.22.2', - DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, - VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], - SnapshotIdentifier: 'mySnapshot', - EnableIAMDatabaseAuthentication: true, - CopyTagsToSnapshot: true, - }, - DeletionPolicy: 'Snapshot', - UpdateReplacePolicy: 'Snapshot', - }); - - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBInstance', 2); - - expect(stack.resolve(cluster.clusterResourceIdentifier)).toEqual({ 'Fn::GetAtt': ['DatabaseB269D8BB', 'DBClusterResourceId'] }); - expect(cluster.instanceIdentifiers).toHaveLength(2); - expect(stack.resolve(cluster.instanceIdentifiers[0])).toEqual({ - Ref: 'DatabaseInstance1844F58FD', - }); - - expect(cluster.instanceEndpoints).toHaveLength(2); - expect(stack.resolve(cluster.instanceEndpoints[0])).toEqual({ - hostname: { - 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'], - }, - port: { - 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'], - }, - socketAddress: { - 'Fn::Join': ['', [ - { 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'] }, - ':', - { 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'] }, - ]], - }, - }); - - Annotations.fromStack(stack).hasWarning('/Default/Database', Match.stringLikeRegexp('Generated credentials will not be applied to cluster')); - }); - - test('can generate a new snapshot password', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - snapshotCredentials: SnapshotCredentials.fromGeneratedSecret('admin', { - excludeCharacters: '"@/\\', - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - MasterUsername: Match.absent(), - MasterUserPassword: { - 'Fn::Join': ['', [ - '{{resolve:secretsmanager:', - { Ref: 'DatabaseSnapshotSecret2B5748BB8ee0a797cad8a68dbeb85f8698cdb5bb' }, - ':SecretString:password::}}', - ]], - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Description: { - 'Fn::Join': ['', ['Generated by the CDK for stack: ', { Ref: 'AWS::StackName' }]], - }, - GenerateSecretString: { - ExcludeCharacters: '\"@/\\', - GenerateStringKey: 'password', - PasswordLength: 30, - SecretStringTemplate: '{"username":"admin"}', - }, - }); - }); - - test('fromGeneratedSecret with replica regions', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - snapshotCredentials: SnapshotCredentials.fromGeneratedSecret('admin', { - replicaRegions: [{ region: 'eu-west-1' }], - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - ReplicaRegions: [ - { - Region: 'eu-west-1', - }, - ], - }); - }); - - test('throws if generating a new password without a username', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - expect(() => new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - snapshotCredentials: { generatePassword: true }, - })).toThrow(/`snapshotCredentials` `username` must be specified when `generatePassword` is set to true/); - }); - - test('can set a new snapshot password from an existing Secret', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const secret = new DatabaseSecret(stack, 'DBSecret', { - username: 'admin', - encryptionKey: new kms.Key(stack, 'PasswordKey'), - }); - new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - snapshotCredentials: SnapshotCredentials.fromSecret(secret), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - MasterUsername: Match.absent(), - MasterUserPassword: { - 'Fn::Join': ['', ['{{resolve:secretsmanager:', { Ref: 'DBSecretD58955BC' }, ':SecretString:password::}}']], - }, - }); - }); - - test('create a cluster from a snapshot with encrypted storage', () => { - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - storageEncryptionKey: kms.Key.fromKeyArn(stack, 'Key', 'arn:aws:kms:us-east-1:456:key/my-key'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - KmsKeyId: 'arn:aws:kms:us-east-1:456:key/my-key', - StorageEncrypted: true, - }); - }); - - test('create a cluster from a snapshot with single user secret rotation', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - }); - - // WHEN - cluster.addRotationSingleUser(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - RotationRules: { - AutomaticallyAfterDays: 30, - }, - }); - }); - - test('throws when trying to add single user rotation multiple times on cluster from snapshot', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - }); - - // WHEN - cluster.addRotationSingleUser(); - - // THEN - expect(() => cluster.addRotationSingleUser()).toThrow(/A single user rotation was already added to this cluster/); - }); - - test('create a cluster from a snapshot with multi user secret rotation', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - instanceProps: { - vpc, - }, - snapshotIdentifier: 'mySnapshot', - }); - - // WHEN - const userSecret = new DatabaseSecret(stack, 'UserSecret', { username: 'user' }); - cluster.addRotationMultiUser('user', { secret: userSecret.attach(cluster) }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { - Ref: 'UserSecretAttachment16ACBE6D', - }, - RotationLambdaARN: { - 'Fn::GetAtt': [ - 'DatabaseuserECD1FB0C', - 'Outputs.RotationLambdaARN', - ], - }, - RotationRules: { - AutomaticallyAfterDays: 30, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - masterSecretArn: { - Ref: 'DatabaseSecretAttachmentE5D1B020', - }, - }, - }); - }); - - test('reuse an existing subnet group', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - credentials: { - username: 'admin', - }, - instanceProps: { - vpc, - }, - subnetGroup: SubnetGroup.fromSubnetGroupName(stack, 'SubnetGroup', 'my-subnet-group'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DBSubnetGroupName: 'my-subnet-group', - }); - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBSubnetGroup', 0); - }); - - test('defaultChild returns the DB Cluster', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - credentials: { - username: 'admin', - }, - instanceProps: { - vpc, - }, - }); - - // THEN - expect(cluster.node.defaultChild instanceof CfnDBCluster).toBeTruthy(); - }); - - test('fromGeneratedSecret', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - credentials: Credentials.fromGeneratedSecret('admin'), - instanceProps: { - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - MasterUsername: 'admin', // username is a string - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DatabaseSecretC9203AE33fdaad7efa858a3daf9490cf0a702aeb', // logical id is a hash - }, - ':SecretString:password::}}', - ], - ], - }, - }); - }); - - test('fromGeneratedSecret with replica regions', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - credentials: Credentials.fromGeneratedSecret('admin', { - replicaRegions: [{ region: 'eu-west-1' }], - }), - instanceProps: { - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - ReplicaRegions: [ - { - Region: 'eu-west-1', - }, - ], - }); - }); - - test('can set custom name to database secret by fromSecret', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const secretName = 'custom-secret-name'; - const secret = new DatabaseSecret(stack, 'Secret', { - username: 'admin', - secretName, - } ); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - credentials: Credentials.fromSecret(secret), - instanceProps: { - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Name: secretName, - }); - }); - - test('can set custom name to database secret by fromGeneratedSecret', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - const secretName = 'custom-secret-name'; - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), - credentials: Credentials.fromGeneratedSecret('admin', { secretName }), - instanceProps: { - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Name: secretName, - }); - }); - - test('can set public accessibility for database cluster with instances in private subnet', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - publiclyAccessible: true, - }, - }); - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Engine: 'aurora', - PubliclyAccessible: true, - }); - }); - - test('can set public accessibility for database cluster with instances in public subnet', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - publiclyAccessible: false, - }, - }); - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Engine: 'aurora', - PubliclyAccessible: false, - }); - }); - - test('database cluster instances in public subnet should by default have publiclyAccessible set to true', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - }, - }); - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Engine: 'aurora', - PubliclyAccessible: true, - }); - }); - - test('changes the case of the cluster identifier', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const clusterIdentifier = 'TestClusterIdentifier'; - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { vpc }, - clusterIdentifier, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DBClusterIdentifier: clusterIdentifier.toLowerCase(), - }); - }); - - test('does not changes the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled', () => { - // GIVEN - const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } }); - const stack = testStack(app); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - const clusterIdentifier = 'TestClusterIdentifier'; - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { vpc }, - clusterIdentifier, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - DBClusterIdentifier: clusterIdentifier, - }); - }); - - test('cluster with copyTagsToSnapshot default', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - CopyTagsToSnapshot: true, - }); - }); - - test('cluster with copyTagsToSnapshot disabled', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - }, - copyTagsToSnapshot: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - CopyTagsToSnapshot: false, - }); - }); - - test('cluster with copyTagsToSnapshot enabled', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - copyTagsToSnapshot: true, - instanceProps: { - vpc, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - CopyTagsToSnapshot: true, - }); - }); - - test('cluster has BacktrackWindow in seconds', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - vpc, - }, - backtrackWindow: cdk.Duration.days(1), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { - BacktrackWindow: 24 * 60 * 60, - }); - }); - - test('DB instances should not have engine version set when part of a cluster', () => { - // GIVEN - const stack = testStack(); - const vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.auroraPostgres({ version: AuroraPostgresEngineVersion.VER_14_3 }), - instanceProps: { vpc }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EngineVersion: Match.absent(), - }); - }); -}); - -test.each([ - [cdk.RemovalPolicy.RETAIN, 'Retain', 'Retain', 'Retain'], - [cdk.RemovalPolicy.SNAPSHOT, 'Snapshot', 'Delete', Match.absent()], - [cdk.RemovalPolicy.DESTROY, 'Delete', 'Delete', Match.absent()], -])('if Cluster RemovalPolicy is \'%s\', the DBCluster has DeletionPolicy \'%s\', the DBInstance has \'%s\' and the DBSubnetGroup has \'%s\'', (clusterRemovalPolicy, clusterValue, instanceValue, subnetValue) => { - const stack = new cdk.Stack(); - - // WHEN - new DatabaseCluster(stack, 'Cluster', { - credentials: { username: 'admin' }, - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), - vpc: new ec2.Vpc(stack, 'Vpc'), - }, - removalPolicy: clusterRemovalPolicy, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { - DeletionPolicy: clusterValue, - UpdateReplacePolicy: clusterValue, - }); - - Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { - DeletionPolicy: instanceValue, - UpdateReplacePolicy: instanceValue, - }); - - Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { - DeletionPolicy: subnetValue, - }); -}); - -test.each([ - [cdk.RemovalPolicy.RETAIN, 'Retain', 'Retain', 'Retain'], - [cdk.RemovalPolicy.SNAPSHOT, 'Snapshot', 'Delete', Match.absent()], - [cdk.RemovalPolicy.DESTROY, 'Delete', 'Delete', Match.absent()], -])('if Cluster RemovalPolicy is \'%s\', the DBCluster has DeletionPolicy \'%s\', the DBInstance has \'%s\' and the DBSubnetGroup has \'%s\'', (clusterRemovalPolicy, clusterValue, instanceValue, subnetValue) => { - const stack = new cdk.Stack(); - - // WHEN - new DatabaseCluster(stack, 'Cluster', { - credentials: { username: 'admin' }, - engine: DatabaseClusterEngine.AURORA, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), - vpc: new ec2.Vpc(stack, 'Vpc'), - }, - removalPolicy: clusterRemovalPolicy, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { - DeletionPolicy: clusterValue, - UpdateReplacePolicy: clusterValue, - }); - - Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { - DeletionPolicy: instanceValue, - UpdateReplacePolicy: instanceValue, - }); - - Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { - DeletionPolicy: subnetValue, - UpdateReplacePolicy: subnetValue, - }); -}); - -function testStack(app?: cdk.App, stackId?: string) { - const stack = new cdk.Stack(app, stackId, { env: { account: '12345', region: 'us-test-1' } }); - stack.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']); - return stack; -} diff --git a/packages/@aws-cdk/aws-rds/test/instance.test.ts b/packages/@aws-cdk/aws-rds/test/instance.test.ts deleted file mode 100644 index ccb93a86d90f4..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/instance.test.ts +++ /dev/null @@ -1,1847 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as targets from '@aws-cdk/aws-events-targets'; -import { ManagedPolicy, Role, ServicePrincipal, AccountPrincipal } from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; - -let stack: cdk.Stack; -let vpc: ec2.Vpc; - -describe('instance', () => { - beforeEach(() => { - stack = new cdk.Stack(); - vpc = new ec2.Vpc(stack, 'VPC'); - }); - - test('create a DB instance', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), - licenseModel: rds.LicenseModel.BRING_YOUR_OWN_LICENSE, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MEDIUM), - multiAz: true, - storageType: rds.StorageType.IO1, - credentials: rds.Credentials.fromUsername('syscdk', { - excludeCharacters: '"@/\\', - }), - vpc, - databaseName: 'ORCL', - storageEncrypted: true, - backupRetention: cdk.Duration.days(7), - monitoringInterval: cdk.Duration.minutes(1), - enablePerformanceInsights: true, - cloudwatchLogsExports: [ - 'trace', - 'audit', - 'alert', - 'listener', - ], - cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH, - autoMinorVersionUpgrade: false, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { - Properties: { - DBInstanceClass: 'db.t2.medium', - AllocatedStorage: '100', - AutoMinorVersionUpgrade: false, - BackupRetentionPeriod: 7, - CopyTagsToSnapshot: true, - DBName: 'ORCL', - DBSubnetGroupName: { - Ref: 'InstanceSubnetGroupF2CBA54F', - }, - EnableCloudwatchLogsExports: [ - 'trace', - 'audit', - 'alert', - 'listener', - ], - EnablePerformanceInsights: true, - Engine: 'oracle-se2', - EngineVersion: '19.0.0.0.ru-2020-04.rur-2020-04.r1', - Iops: 1000, - LicenseModel: 'bring-your-own-license', - MasterUsername: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'InstanceSecret478E0A47', - }, - ':SecretString:username::}}', - ], - ], - }, - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'InstanceSecret478E0A47', - }, - ':SecretString:password::}}', - ], - ], - }, - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': [ - 'InstanceMonitoringRole3E2B4286', - 'Arn', - ], - }, - MultiAZ: true, - PerformanceInsightsRetentionPeriod: 7, - StorageEncrypted: true, - StorageType: 'io1', - VPCSecurityGroups: [ - { - 'Fn::GetAtt': [ - 'InstanceSecurityGroupB4E5FA83', - 'GroupId', - ], - }, - ], - }, - DeletionPolicy: 'Snapshot', - UpdateReplacePolicy: 'Snapshot', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBSubnetGroup', { - DBSubnetGroupDescription: 'Subnet group for Instance database', - SubnetIds: [ - { - Ref: 'VPCPrivateSubnet1Subnet8BCA10E0', - }, - { - Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A', - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { - GroupDescription: 'Security group for Instance database', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'monitoring.rds.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', - ], - ], - }, - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Description: { - 'Fn::Join': [ - '', - [ - 'Generated by the CDK for stack: ', - { - Ref: 'AWS::StackName', - }, - ], - ], - }, - GenerateSecretString: { - ExcludeCharacters: '\"@/\\', - GenerateStringKey: 'password', - PasswordLength: 30, - SecretStringTemplate: '{"username":"syscdk"}', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::SecretTargetAttachment', { - SecretId: { - Ref: 'InstanceSecret478E0A47', - }, - TargetId: { - Ref: 'InstanceC1063A87', - }, - TargetType: 'AWS::RDS::DBInstance', - }); - - Template.fromStack(stack).resourceCountIs('Custom::LogRetention', 4); - }); - - test('throws when create database with specific AZ and multiAZ enabled', () => { - expect(() => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - multiAz: true, - availabilityZone: 'ew-west-1a', - }); - }).toThrow(/Requesting a specific availability zone is not valid for Multi-AZ instances/); - }); - - test('instance with option and parameter group', () => { - const optionGroup = new rds.OptionGroup(stack, 'OptionGroup', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), - configurations: [ - { - name: 'XMLDB', - }, - ], - }); - - const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ - version: rds.SqlServerEngineVersion.VER_11, - }), - description: 'desc', - parameters: { - key: 'value', - }, - }); - - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - optionGroup, - parameterGroup, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBParameterGroupName: { - Ref: 'ParameterGroup5E32DECB', - }, - OptionGroupName: { - Ref: 'OptionGroupACA43DC1', - }, - }); - }); - - test('instance with inline parameter group', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_11 }), - vpc, - parameters: { - locks: '100', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBParameterGroupName: { - Ref: 'DatabaseParameterGroup2A921026', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBParameterGroup', { - Family: 'sqlserver-ee-11.0', - Parameters: { - locks: '100', - }, - }); - }); - - test('instance with inline parameter group and parameterGroup arg fails', () => { - const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ - version: rds.SqlServerEngineVersion.VER_11, - }), - parameters: { - key: 'value', - }, - }); - - expect(() => { - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_11 }), - vpc, - parameters: { - locks: '100', - }, - parameterGroup, - }); - }).toThrow(/You cannot specify both parameterGroup and parameters/); - }); - - test('can specify subnet type', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - credentials: rds.Credentials.fromUsername('syscdk'), - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBSubnetGroupName: { - Ref: 'InstanceSubnetGroupF2CBA54F', - }, - PubliclyAccessible: false, - }); - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBSubnetGroup', { - DBSubnetGroupDescription: 'Subnet group for Instance database', - SubnetIds: [ - { - Ref: 'VPCPrivateSubnet1Subnet8BCA10E0', - }, - { - Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A', - }, - ], - }); - }); - - test('instance with IPv4 network type', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - networkType: rds.NetworkType.IPV4, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - NetworkType: 'IPV4', - }); - }); - - test('instance with dual-stack network type', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - networkType: rds.NetworkType.DUAL, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - NetworkType: 'DUAL', - }); - }); - - describe('DatabaseInstanceFromSnapshot', () => { - test('create an instance from snapshot', () => { - new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), - vpc, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBSnapshotIdentifier: 'my-snapshot', - }); - }); - - test('can generate a new snapshot password', () => { - new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - credentials: rds.SnapshotCredentials.fromGeneratedSecret('admin', { - excludeCharacters: '"@/\\', - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MasterUsername: Match.absent(), - MasterUserPassword: { - 'Fn::Join': ['', [ - '{{resolve:secretsmanager:', - { Ref: 'InstanceSecretB6DFA6BE8ee0a797cad8a68dbeb85f8698cdb5bb' }, - ':SecretString:password::}}', - ]], - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Description: { - 'Fn::Join': ['', ['Generated by the CDK for stack: ', { Ref: 'AWS::StackName' }]], - }, - GenerateSecretString: { - ExcludeCharacters: '\"@/\\', - GenerateStringKey: 'password', - PasswordLength: 30, - SecretStringTemplate: '{"username":"admin"}', - }, - }); - }); - - test('fromGeneratedSecret with replica regions', () => { - new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - credentials: rds.SnapshotCredentials.fromGeneratedSecret('admin', { - replicaRegions: [{ region: 'eu-west-1' }], - }), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - ReplicaRegions: [ - { - Region: 'eu-west-1', - }, - ], - }); - }); - - test('throws if generating a new password without a username', () => { - expect(() => new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - credentials: { generatePassword: true }, - })).toThrow(/`credentials` `username` must be specified when `generatePassword` is set to true/); - }); - - test('can set a new snapshot password from an existing SecretValue', () => { - new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - credentials: rds.SnapshotCredentials.fromPassword(cdk.SecretValue.unsafePlainText('mysecretpassword')), - }); - - // TODO - Expect this to be broken - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MasterUsername: Match.absent(), - MasterUserPassword: 'mysecretpassword', - }); - }); - - test('can set a new snapshot password from an existing Secret', () => { - const secret = new rds.DatabaseSecret(stack, 'DBSecret', { - username: 'admin', - encryptionKey: new kms.Key(stack, 'PasswordKey'), - }); - new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - credentials: rds.SnapshotCredentials.fromSecret(secret), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MasterUsername: Match.absent(), - MasterUserPassword: { - 'Fn::Join': ['', ['{{resolve:secretsmanager:', { Ref: 'DBSecretD58955BC' }, ':SecretString:password::}}']], - }, - }); - }); - - test('can create a new database instance with fromDatabaseInstanceAttributes using a token for the port', () => { - // GIVEN - const databasePort = new cdk.CfnParameter(stack, 'DatabasePort', { - type: 'Number', - default: 5432, - }).valueAsNumber; - - // WHEN - const instance = rds.DatabaseInstance.fromDatabaseInstanceAttributes(stack, 'DatabaseInstance', { - instanceIdentifier: '', - securityGroups: [], - instanceEndpointAddress: '', - port: databasePort, - }); - - new cdk.CfnOutput(stack, 'portOutput', { - exportName: 'databaseUrl', - value: `${instance.dbInstanceEndpointPort}`, - }); - - // THEN - Template.fromStack(stack).hasOutput('portOutput', { - Export: { Name: 'databaseUrl' }, - Value: { - Ref: 'DatabasePort', - }, - }); - }); - }); - - test('create a read replica in the same region - with the subnet group name', () => { - const sourceInstance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - }); - - // WHEN - new rds.DatabaseInstanceReadReplica(stack, 'ReadReplica', { - sourceDatabaseInstance: sourceInstance, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - SourceDBInstanceIdentifier: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':rds:', - { Ref: 'AWS::Region' }, - ':', - { Ref: 'AWS::AccountId' }, - ':db:', - { Ref: 'InstanceC1063A87' }, - ]], - }, - DBSubnetGroupName: { - Ref: 'ReadReplicaSubnetGroup680C605C', - }, - }); - }); - - test('on event', () => { - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - }); - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('dummy'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - // WHEN - instance.onEvent('InstanceEvent', { target: new targets.LambdaFunction(fn) }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - EventPattern: { - source: [ - 'aws.rds', - ], - resources: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':rds:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':db:', - { - Ref: 'InstanceC1063A87', - }, - ], - ], - }, - ], - }, - Targets: [ - { - Arn: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Id: 'Target0', - }, - ], - }); - }); - - test('on event without target', () => { - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - }); - - // WHEN - instance.onEvent('InstanceEvent'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { - EventPattern: { - source: [ - 'aws.rds', - ], - resources: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':rds:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':db:', - { - Ref: 'InstanceC1063A87', - }, - ], - ], - }, - ], - }, - }); - }); - - test('can use metricCPUUtilization', () => { - // WHEN - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - }); - - // THEN - expect(stack.resolve(instance.metricCPUUtilization())).toEqual({ - dimensions: { DBInstanceIdentifier: { Ref: 'InstanceC1063A87' } }, - namespace: 'AWS/RDS', - metricName: 'CPUUtilization', - period: cdk.Duration.minutes(5), - statistic: 'Average', - }); - }); - - test('can resolve endpoint port and socket address', () => { - // WHEN - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - }); - - expect(stack.resolve(instance.instanceEndpoint.port)).toEqual({ - 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint.Port'], - }); - - expect(stack.resolve(instance.instanceEndpoint.socketAddress)).toEqual({ - 'Fn::Join': [ - '', - [ - { 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint.Address'] }, - ':', - { 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint.Port'] }, - ], - ], - }); - }); - - test('can deactivate backup', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - backupRetention: cdk.Duration.seconds(0), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - BackupRetentionPeriod: 0, - }); - }); - - test('imported instance with imported security group with allowAllOutbound set to false', () => { - const instance = rds.DatabaseInstance.fromDatabaseInstanceAttributes(stack, 'Database', { - instanceEndpointAddress: 'address', - instanceIdentifier: 'identifier', - port: 3306, - securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - })], - }); - - // WHEN - instance.connections.allowToAnyIpv4(ec2.Port.tcp(443)); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { - GroupId: 'sg-123456789', - }); - }); - - test('create an instance with imported monitoring role', () => { - const monitoringRole = new Role(stack, 'MonitoringRole', { - assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), - managedPolicies: [ - ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), - ], - }); - - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - monitoringInterval: cdk.Duration.minutes(1), - monitoringRole, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MonitoringInterval: 60, - MonitoringRoleArn: { - 'Fn::GetAtt': ['MonitoringRole90457BF9', 'Arn'], - }, - }); - }); - - test('create an instance with an existing security group', () => { - const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { - allowAllOutbound: false, - }); - - // WHEN - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - securityGroups: [securityGroup], - }); - instance.connections.allowDefaultPortFromAnyIpv4(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - VPCSecurityGroups: ['sg-123456789'], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { - FromPort: { - 'Fn::GetAtt': [ - 'InstanceC1063A87', - 'Endpoint.Port', - ], - }, - GroupId: 'sg-123456789', - ToPort: { - 'Fn::GetAtt': [ - 'InstanceC1063A87', - 'Endpoint.Port', - ], - }, - }); - }); - - test('addRotationSingleUser()', () => { - // GIVEN - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - }); - - // WHEN - instance.addRotationSingleUser(); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { - Ref: 'DatabaseSecretAttachmentE5D1B020', - }, - RotationLambdaARN: { - 'Fn::GetAtt': [ - 'DatabaseRotationSingleUser65F55654', - 'Outputs.RotationLambdaARN', - ], - }, - RotationRules: { - AutomaticallyAfterDays: 30, - }, - }); - }); - - test('addRotationMultiUser()', () => { - // GIVEN - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - }); - - // WHEN - const userSecret = new rds.DatabaseSecret(stack, 'UserSecret', { username: 'user' }); - instance.addRotationMultiUser('user', { secret: userSecret.attach(instance) }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - SecretId: { - Ref: 'UserSecretAttachment16ACBE6D', - }, - RotationLambdaARN: { - 'Fn::GetAtt': [ - 'DatabaseuserECD1FB0C', - 'Outputs.RotationLambdaARN', - ], - }, - RotationRules: { - AutomaticallyAfterDays: 30, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - masterSecretArn: { - Ref: 'DatabaseSecretAttachmentE5D1B020', - }, - }, - }); - }); - - test('addRotationSingleUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { - // GIVEN - const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { - vpcId: 'vpc-id', - availabilityZones: ['az1'], - publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], - publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], - privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], - privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], - isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], - isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], - }); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc: vpcWithIsolated, - }); - - // WHEN - // DB in isolated subnet (no internet connectivity) - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc: vpcWithIsolated, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }); - - // Rotation in private subnet (internet via NAT) - instance.addRotationSingleUser({ - automaticallyAfter: cdk.Duration.days(15), - excludeCharacters: '°_@', - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - securityGroup, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - RotationRules: { - AutomaticallyAfterDays: 15, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - endpoint: { - 'Fn::Join': ['', [ - 'https://secretsmanager.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', - excludeCharacters: '°_@', - vpcSecurityGroupIds: { - 'Fn::GetAtt': [ - stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), - 'GroupId', - ], - }, - }, - }); - }); - - test('addRotationMultiUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { - // GIVEN - const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { - vpcId: 'vpc-id', - availabilityZones: ['az1'], - publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], - publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], - privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], - privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], - isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], - isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], - }); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc: vpcWithIsolated, - }); - const userSecret = new rds.DatabaseSecret(stack, 'UserSecret', { username: 'user' }); - - // WHEN - // DB in isolated subnet (no internet connectivity) - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc: vpcWithIsolated, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }); - - // Rotation in private subnet (internet via NAT) - instance.addRotationMultiUser('user', { - secret: userSecret.attach(instance), - automaticallyAfter: cdk.Duration.days(15), - excludeCharacters: '°_@', - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - securityGroup, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { - RotationRules: { - AutomaticallyAfterDays: 15, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - endpoint: { - 'Fn::Join': ['', [ - 'https://secretsmanager.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', - excludeCharacters: '°_@', - vpcSecurityGroupIds: { - 'Fn::GetAtt': [ - stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), - 'GroupId', - ], - }, - }, - }); - }); - - test('addRotationSingleUser() with VPC interface endpoint', () => { - // GIVEN - const vpcIsolatedOnly = new ec2.Vpc(stack, 'Vpc', { natGateways: 0 }); - - const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { - service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, - vpc: vpcIsolatedOnly, - subnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }); - - // WHEN - // DB in isolated subnet (no internet connectivity) - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc: vpcIsolatedOnly, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, - }); - - // Rotation in isolated subnet with access to Secrets Manager API via endpoint - instance.addRotationSingleUser({ endpoint }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { - Parameters: { - endpoint: { - 'Fn::Join': ['', [ - 'https://', - { Ref: 'EndpointEEF1FD8F' }, - '.secretsmanager.', - { Ref: 'AWS::Region' }, - '.', - { Ref: 'AWS::URLSuffix' }, - ]], - }, - functionName: 'DatabaseRotationSingleUser458A45BE', - vpcSubnetIds: { - 'Fn::Join': ['', [ - { Ref: 'VpcIsolatedSubnet1SubnetE48C5737' }, - ',', - { Ref: 'VpcIsolatedSubnet2Subnet16364B91' }, - ]], - }, - vpcSecurityGroupIds: { - 'Fn::GetAtt': [ - 'DatabaseRotationSingleUserSecurityGroupAC6E0E73', - 'GroupId', - ], - }, - excludeCharacters: " %+~`#$&*()|[]{}:;<>?!'/@\"\\", - }, - }); - }); - - test('throws when trying to add rotation to an instance without secret', () => { - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, - credentials: rds.Credentials.fromUsername('syscdk', { password: cdk.SecretValue.unsafePlainText('tooshort') }), - vpc, - }); - - // THEN - expect(() => instance.addRotationSingleUser()).toThrow(/without secret/); - }); - - test('throws when trying to add single user rotation multiple times', () => { - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - credentials: rds.Credentials.fromUsername('syscdk'), - vpc, - }); - - // WHEN - instance.addRotationSingleUser(); - - // THEN - expect(() => instance.addRotationSingleUser()).toThrow(/A single user rotation was already added to this instance/); - }); - - test('throws when timezone is set for non-sqlserver database engine', () => { - const tzSupportedEngines = [rds.DatabaseInstanceEngine.SQL_SERVER_EE, rds.DatabaseInstanceEngine.SQL_SERVER_EX, - rds.DatabaseInstanceEngine.SQL_SERVER_SE, rds.DatabaseInstanceEngine.SQL_SERVER_WEB]; - const tzUnsupportedEngines = [rds.DatabaseInstanceEngine.MYSQL, rds.DatabaseInstanceEngine.POSTGRES, - rds.DatabaseInstanceEngine.ORACLE_EE, rds.DatabaseInstanceEngine.MARIADB]; - - // THEN - tzSupportedEngines.forEach((engine) => { - expect(new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { - engine, - timezone: 'Europe/Zurich', - vpc, - })).toBeDefined(); - }); - - tzUnsupportedEngines.forEach((engine) => { - expect(() => new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { - engine, - timezone: 'Europe/Zurich', - vpc, - })).toThrow(/timezone property can not be configured for/); - }); - }); - - test('create an instance from snapshot with maximum allocated storage', () => { - // WHEN - new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { - snapshotIdentifier: 'my-snapshot', - engine: rds.DatabaseInstanceEngine.POSTGRES, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), - vpc, - maxAllocatedStorage: 200, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBSnapshotIdentifier: 'my-snapshot', - MaxAllocatedStorage: 200, - }); - }); - - test('create a DB instance with maximum allocated storage', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.MYSQL, - vpc, - backupRetention: cdk.Duration.seconds(0), - maxAllocatedStorage: 250, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - BackupRetentionPeriod: 0, - MaxAllocatedStorage: 250, - }); - }); - - test('iam authentication - off by default', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EnableIAMDatabaseAuthentication: Match.absent(), - }); - }); - - test('createGrant - creates IAM policy and enables IAM auth', () => { - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - }); - const role = new Role(stack, 'DBRole', { - assumedBy: new AccountPrincipal(stack.account), - }); - instance.grantConnect(role); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EnableIAMDatabaseAuthentication: true, - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Effect: 'Allow', - Action: 'rds-db:connect', - Resource: { - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':rds:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':db:', { Ref: 'InstanceC1063A87' }]], - }, - }], - Version: '2012-10-17', - }, - }); - }); - - test('createGrant - throws if IAM auth disabled', () => { - const instance = new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - iamAuthentication: false, - }); - const role = new Role(stack, 'DBRole', { - assumedBy: new AccountPrincipal(stack.account), - }); - - expect(() => { instance.grantConnect(role); }).toThrow(/Cannot grant connect when IAM authentication is disabled/); - }); - - test('domain - sets domain property', () => { - const domain = 'd-90670a8d36'; - - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.sqlServerWeb({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), - vpc, - domain: domain, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Domain: domain, - }); - }); - - test('domain - uses role if provided', () => { - const domain = 'd-90670a8d36'; - - // WHEN - const role = new Role(stack, 'DomainRole', { assumedBy: new ServicePrincipal('rds.amazonaws.com') }); - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.sqlServerWeb({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), - vpc, - domain: domain, - domainRole: role, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Domain: domain, - DomainIAMRoleName: stack.resolve(role.roleName), - }); - }); - - test('domain - creates role if not provided', () => { - const domain = 'd-90670a8d36'; - - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.sqlServerWeb({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), - vpc, - domain: domain, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Domain: domain, - DomainIAMRoleName: Match.anyValue(), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'rds.amazonaws.com', - }, - }, - ], - Version: '2012-10-17', - }, - ManagedPolicyArns: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':iam::aws:policy/service-role/AmazonRDSDirectoryServiceAccess', - ], - ], - }, - ], - }); - }); - - test('throws when domain is set for mariadb database engine', () => { - const domainSupportedEngines = [rds.DatabaseInstanceEngine.SQL_SERVER_EE, rds.DatabaseInstanceEngine.SQL_SERVER_EX, - rds.DatabaseInstanceEngine.SQL_SERVER_SE, rds.DatabaseInstanceEngine.SQL_SERVER_WEB, rds.DatabaseInstanceEngine.MYSQL, - rds.DatabaseInstanceEngine.POSTGRES, rds.DatabaseInstanceEngine.ORACLE_EE]; - const domainUnsupportedEngines = [rds.DatabaseInstanceEngine.MARIADB]; - - // THEN - domainSupportedEngines.forEach((engine) => { - expect(() => new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { - engine, - domain: 'd-90670a8d36', - vpc, - })).not.toThrow(); - }); - - domainUnsupportedEngines.forEach((engine) => { - const expectedError = new RegExp(`domain property cannot be configured for ${engine.engineType}`); - - expect(() => new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { - engine, - domain: 'd-90670a8d36', - vpc, - })).toThrow(expectedError); - }); - }); - - describe('performance insights', () => { - test('instance with all performance insights properties', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - enablePerformanceInsights: true, - performanceInsightRetention: rds.PerformanceInsightRetention.LONG_TERM, - performanceInsightEncryptionKey: new kms.Key(stack, 'Key'), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EnablePerformanceInsights: true, - PerformanceInsightsRetentionPeriod: 731, - PerformanceInsightsKMSKeyId: { 'Fn::GetAtt': ['Key961B73FD', 'Arn'] }, - }); - }); - - test('setting performance insights fields enables performance insights', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - performanceInsightRetention: rds.PerformanceInsightRetention.LONG_TERM, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - EnablePerformanceInsights: true, - PerformanceInsightsRetentionPeriod: 731, - }); - }); - - test('throws if performance insights fields are set but performance insights is disabled', () => { - expect(() => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - enablePerformanceInsights: false, - performanceInsightRetention: rds.PerformanceInsightRetention.DEFAULT, - }); - }).toThrow(/`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set/); - }); - }); - - test('reuse an existing subnet group', () => { - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - subnetGroup: rds.SubnetGroup.fromSubnetGroupName(stack, 'SubnetGroup', 'my-subnet-group'), - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBSubnetGroupName: 'my-subnet-group', - }); - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBSubnetGroup', 0); - }); - - test('defaultChild returns the DB Instance', () => { - const instance = new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - }); - - // THEN - expect(instance.node.defaultChild instanceof rds.CfnDBInstance).toBeTruthy(); - }); - - test("PostgreSQL database instance uses a different default master username than 'admin', which is a reserved word", () => { - new rds.DatabaseInstance(stack, 'Instance', { - vpc, - engine: rds.DatabaseInstanceEngine.postgres({ - version: rds.PostgresEngineVersion.VER_15_2, - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - GenerateSecretString: { - SecretStringTemplate: '{"username":"postgres"}', - }, - }); - }); - - describe('S3 Import/Export', () => { - test('instance with s3 import and export buckets', () => { - stack = new cdk.Stack(); - vpc = new ec2.Vpc(stack, 'VPC'); - new rds.DatabaseInstance(stack, 'DB', { - engine: rds.DatabaseInstanceEngine.sqlServerSe({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), - vpc, - s3ImportBuckets: [new s3.Bucket(stack, 'S3Import')], - s3ExportBuckets: [new s3.Bucket(stack, 'S3Export')], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - AssociatedRoles: [ - { - FeatureName: 'S3_INTEGRATION', - RoleArn: { 'Fn::GetAtt': ['DBS3ImportRoleEF69B7D7', 'Arn'] }, - }, - ], - OptionGroupName: { Ref: 'DBInstanceOptionGroup46C68006' }, - }); - - // Can read from import bucket, and read/write from export bucket - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - ], - Effect: 'Allow', - Resource: [ - { 'Fn::GetAtt': ['S3ImportD5D5F2EB', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['S3ImportD5D5F2EB', 'Arn'] }, '/*']] }, - ], - }, - { - Action: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - 's3:DeleteObject*', - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Resource: [ - { 'Fn::GetAtt': ['S3Export390B8694', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['S3Export390B8694', 'Arn'] }, '/*']] }, - ], - }], - Version: '2012-10-17', - }, - }); - }); - - test('throws if using s3 import on unsupported engine', () => { - const s3ImportRole = new Role(stack, 'S3ImportRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - - expect(() => { - new rds.DatabaseInstance(stack, 'DBWithImportBucket', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - s3ImportBuckets: [new s3.Bucket(stack, 'S3Import')], - }); - }).toThrow(/Engine 'mysql-8.0.19' does not support S3 import/); - expect(() => { - new rds.DatabaseInstance(stack, 'DBWithImportRole', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - s3ImportRole, - }); - }).toThrow(/Engine 'mysql-8.0.19' does not support S3 import/); - }); - - test('throws if using s3 export on unsupported engine', () => { - const s3ExportRole = new Role(stack, 'S3ExportRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - - expect(() => { - new rds.DatabaseInstance(stack, 'DBWithExportBucket', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - s3ExportBuckets: [new s3.Bucket(stack, 'S3Export')], - }); - }).toThrow(/Engine 'mysql-8.0.19' does not support S3 export/); - expect(() => { - new rds.DatabaseInstance(stack, 'DBWithExportRole', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), - vpc, - s3ExportRole: s3ExportRole, - }); - }).toThrow(/Engine 'mysql-8.0.19' does not support S3 export/); - }); - - test('throws if provided two different roles for import/export', () => { - const s3ImportRole = new Role(stack, 'S3ImportRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - const s3ExportRole = new Role(stack, 'S3ExportRole', { - assumedBy: new ServicePrincipal('rds.amazonaws.com'), - }); - - expect(() => { - new rds.DatabaseInstance(stack, 'DBWithExportBucket', { - engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), - vpc, - s3ImportRole, - s3ExportRole, - }); - }).toThrow(/S3 import and export roles must be the same/); - }); - }); - - test('fromGeneratedSecret', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - credentials: rds.Credentials.fromGeneratedSecret('postgres'), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MasterUsername: 'postgres', // username is a string - MasterUserPassword: { - 'Fn::Join': [ - '', - [ - '{{resolve:secretsmanager:', - { - Ref: 'DatabaseSecretC9203AE33fdaad7efa858a3daf9490cf0a702aeb', // logical id is a hash - }, - ':SecretString:password::}}', - ], - ], - }, - }); - }); - - test('fromGeneratedSecret with replica regions', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - credentials: rds.Credentials.fromGeneratedSecret('postgres', { - replicaRegions: [{ region: 'eu-west-1' }], - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - ReplicaRegions: [ - { - Region: 'eu-west-1', - }, - ], - }); - }); - - test('fromPassword', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - vpc, - credentials: rds.Credentials.fromPassword('postgres', cdk.SecretValue.ssmSecure('/dbPassword', '1')), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - MasterUsername: 'postgres', // username is a string - MasterUserPassword: '{{resolve:ssm-secure:/dbPassword:1}}', // reference to SSM - }); - }); - - test('can set custom name to database secret by fromSecret', () => { - // WHEN - const secretName = 'custom-secret-name'; - const secret = new rds.DatabaseSecret(stack, 'Secret', { - username: 'admin', - secretName, - } ); - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - credentials: rds.Credentials.fromSecret(secret), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Name: secretName, - }); - }); - - test('can set custom name to database secret by fromGeneratedSecret', () => { - // WHEN - const secretName = 'custom-secret-name'; - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - credentials: rds.Credentials.fromGeneratedSecret('admin', { secretName }), - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { - Name: secretName, - }); - }); - - test('can set publiclyAccessible to false with public subnets', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PUBLIC, - }, - publiclyAccessible: false, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - PubliclyAccessible: false, - }); - }); - - test('can set publiclyAccessible to true with private subnets', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - vpc, - vpcSubnets: { - subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, - }, - publiclyAccessible: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - PubliclyAccessible: true, - }); - }); - - test('changes the case of the cluster identifier', () => { - // GIVEN - const app = new cdk.App(); - stack = new cdk.Stack( app ); - vpc = new ec2.Vpc( stack, 'VPC' ); - - // WHEN - const instanceIdentifier = 'TestInstanceIdentifier'; - new rds.DatabaseInstance( stack, 'DB', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - vpc, - instanceIdentifier, - } ); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBInstanceIdentifier: instanceIdentifier.toLowerCase(), - }); - }); - - test( 'does not changes the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled', () => { - // GIVEN - const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } }); - stack = new cdk.Stack(app); - vpc = new ec2.Vpc( stack, 'VPC' ); - - // WHEN - const instanceIdentifier = 'TestInstanceIdentifier'; - new rds.DatabaseInstance( stack, 'DB', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - vpc, - instanceIdentifier, - } ); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBInstanceIdentifier: instanceIdentifier, - }); - }); - - test('throws with backupRetention on a read replica if engine does not support it', () => { - // GIVEN - const instanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL); - const backupRetention = cdk.Duration.days(5); - const source = new rds.DatabaseInstance(stack, 'Source', { - engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), - backupRetention, - instanceType, - vpc, - }); - - expect(() => { - new rds.DatabaseInstanceReadReplica(stack, 'Replica', { - sourceDatabaseInstance: source, - backupRetention, - instanceType, - vpc, - }); - }).toThrow(/Cannot set 'backupRetention', as engine 'postgres-15.2' does not support automatic backups for read replicas/); - }); - - test('can set parameter group on read replica', () => { - // GIVEN - const instanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL); - const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); - const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { engine }); - const source = new rds.DatabaseInstance(stack, 'Source', { - engine, - instanceType, - vpc, - }); - - // WHEN - new rds.DatabaseInstanceReadReplica(stack, 'Replica', { - sourceDatabaseInstance: source, - parameterGroup, - instanceType, - vpc, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - DBParameterGroupName: { - Ref: 'ParameterGroup5E32DECB', - }, - }); - }); - - test('instance with port provided as a number', () => { - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.MYSQL, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - port: 3306, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Port: '3306', - }); - }); - - test('instance with port provided as a CloudFormation parameter', () => { - // GIVEN - const port = new cdk.CfnParameter(stack, 'Port', { - type: 'Number', - }).valueAsNumber; - - // WHEN - new rds.DatabaseInstance(stack, 'Database', { - engine: rds.DatabaseInstanceEngine.MYSQL, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), - vpc, - port, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - Port: { - Ref: 'Port', - }, - }); - }); - - test('engine is specified for read replica using domain', () => { - // GIVEN - const instanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL); - const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); - const source = new rds.DatabaseInstance(stack, 'Source', { - engine, - instanceType, - vpc, - }); - - // WHEN - new rds.DatabaseInstanceReadReplica(stack, 'Replica', { - sourceDatabaseInstance: source, - instanceType, - vpc, - domain: 'my-domain', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - SourceDBInstanceIdentifier: Match.anyValue(), - Engine: 'postgres', - }); - }); - - test('gp3 storage type', () => { - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpc, - allocatedStorage: 500, - storageType: rds.StorageType.GP3, - storageThroughput: 500, - iops: 4000, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { - StorageType: 'gp3', - StorageThroughput: 500, - Iops: 4000, - }); - }); - - test('throws with storage throughput and not GP3', () => { - expect(() => new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpc, - storageType: rds.StorageType.GP2, - storageThroughput: 500, - })).toThrow(/storage throughput can only be specified with GP3 storage type/); - }); - - test('throws with a ratio of storage throughput to IOPS greater than 0.25', () => { - expect(() => new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }), - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpc, - allocatedStorage: 1000, - storageType: rds.StorageType.GP3, - iops: 5000, - storageThroughput: 2500, - })).toThrow(/maximum ratio of storage throughput to IOPS is 0.25/); - }); -}); - -test.each([ - [cdk.RemovalPolicy.RETAIN, 'Retain', 'Retain'], - [cdk.RemovalPolicy.SNAPSHOT, 'Snapshot', Match.absent()], - [cdk.RemovalPolicy.DESTROY, 'Delete', Match.absent()], -])('if Instance RemovalPolicy is \'%s\', the instance has DeletionPolicy \'%s\' and the DBSubnetGroup has \'%s\'', (instanceRemovalPolicy, instanceValue, subnetValue) => { - // GIVEN - stack = new cdk.Stack(); - vpc = new ec2.Vpc(stack, 'VPC'); - - // WHEN - new rds.DatabaseInstance(stack, 'Instance', { - engine: rds.DatabaseInstanceEngine.mysql({ - version: rds.MysqlEngineVersion.VER_8_0_19, - }), - vpc, - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, - removalPolicy: instanceRemovalPolicy, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { - DeletionPolicy: instanceValue, - UpdateReplacePolicy: instanceValue, - }); - - Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { - DeletionPolicy: subnetValue, - UpdateReplacePolicy: subnetValue, - }); -}); - -describe('cross-account instance', () => { - test.each([ - ['MyInstance', 'MyInstance', 'myinstance'], - ['PhysicalName.GENERATE_IF_NEEDED', cdk.PhysicalName.GENERATE_IF_NEEDED, 'instancestackncestackinstancec830ba83756a6dfc7154'], - ])("with database identifier '%s' can be referenced from a Stack in a different account", (_, providedInstanceId, expectedInstanceId) => { - const app = new cdk.App(); - const instanceStack = new cdk.Stack(app, 'InstanceStack', { - env: { account: '123', region: 'my-region' }, - }); - const instance = new rds.DatabaseInstance(instanceStack, 'Instance', { - vpc: new ec2.Vpc(instanceStack, 'Vpc'), - engine: rds.DatabaseInstanceEngine.mariaDb({ version: rds.MariaDbEngineVersion.VER_10_5 }), - // physical name set - instanceIdentifier: providedInstanceId, - }); - - const outputStack = new cdk.Stack(app, 'OutputStack', { - env: { account: '456', region: 'my-region' }, - }); - new cdk.CfnOutput(outputStack, 'DatabaseInstanceArn', { - value: instance.instanceArn, - }); - new cdk.CfnOutput(outputStack, 'DatabaseInstanceName', { - value: instance.instanceIdentifier, - }); - - Template.fromStack(outputStack).templateMatches({ - Outputs: { - DatabaseInstanceArn: { - Value: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - `:rds:my-region:123:db:${expectedInstanceId}`, - ]], - }, - }, - DatabaseInstanceName: { - Value: expectedInstanceId, - }, - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.ts b/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.ts deleted file mode 100644 index 60be82027d5ad..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as rds from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-rotation'); - -const vpc = new ec2.Vpc(stack, 'VPC'); -const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc }); -const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { - vpc, - service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, -}); - -/// !show -const cluster = new rds.DatabaseCluster(stack, 'Database', { - engine: rds.DatabaseClusterEngine.AURORA, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpc, - }, -}); - -cluster.addRotationSingleUser(); - -const clusterWithCustomRotationOptions = new rds.DatabaseCluster(stack, 'CustomRotationOptions', { - engine: rds.DatabaseClusterEngine.AURORA, - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpc, - }, -}); -clusterWithCustomRotationOptions.addRotationSingleUser({ - automaticallyAfter: cdk.Duration.days(7), - excludeCharacters: '!@#$%^&*', - securityGroup, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - endpoint: endpoint, -}); -/// !hide - -app.synth(); diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.d.ts b/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.d.ts deleted file mode 100644 index a64fd5d9eb2dc..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEventHandler(event: OnEventRequest): Promise; -export declare function isCompleteHandler(event: IsCompleteRequest): Promise; diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.js b/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.js deleted file mode 100644 index 289af2986d2ff..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isCompleteHandler = exports.onEventHandler = void 0; -const aws_sdk_1 = require("aws-sdk"); // eslint-disable-line import/no-extraneous-dependencies -async function onEventHandler(event) { - console.log('Event: %j', event); - const rds = new aws_sdk_1.RDS(); - const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - const data = await rds.createDBClusterSnapshot({ - DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, - DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, - }).promise(); - return { - PhysicalResourceId: physicalResourceId, - Data: { - DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, - }, - }; - } - if (event.RequestType === 'Delete') { - await rds.deleteDBClusterSnapshot({ - DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, - }).promise(); - } - return { - PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, - }; -} -exports.onEventHandler = onEventHandler; -async function isCompleteHandler(event) { - console.log('Event: %j', event); - const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); - switch (event.RequestType) { - case 'Create': - case 'Update': - return { IsComplete: snapshotStatus === 'available' }; - case 'Delete': - return { IsComplete: snapshotStatus === undefined }; - } -} -exports.isCompleteHandler = isCompleteHandler; -async function tryGetClusterSnapshotStatus(identifier) { - try { - const rds = new aws_sdk_1.RDS(); - const data = await rds.describeDBClusterSnapshots({ - DBClusterSnapshotIdentifier: identifier, - }).promise(); - return data.DBClusterSnapshots?.[0].Status; - } - catch (err) { - if (err.code === 'DBClusterSnapshotNotFoundFault') { - return undefined; - } - throw err; - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxxQ0FBOEIsQ0FBQyx3REFBd0Q7QUFFaEYsS0FBSyxVQUFVLGNBQWMsQ0FBQyxLQUFxQjtJQUN4RCxPQUFPLENBQUMsR0FBRyxDQUFDLFdBQVcsRUFBRSxLQUFLLENBQUMsQ0FBQztJQUVoQyxNQUFNLEdBQUcsR0FBRyxJQUFJLGFBQUcsRUFBRSxDQUFDO0lBRXRCLE1BQU0sa0JBQWtCLEdBQUcsR0FBRyxLQUFLLENBQUMsa0JBQWtCLENBQUMsbUJBQW1CLElBQUksS0FBSyxDQUFDLGtCQUFrQixDQUFDLG1CQUFtQixFQUFFLENBQUM7SUFFN0gsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsRUFBRTtRQUNwRSxNQUFNLElBQUksR0FBRyxNQUFNLEdBQUcsQ0FBQyx1QkFBdUIsQ0FBQztZQUM3QyxtQkFBbUIsRUFBRSxLQUFLLENBQUMsa0JBQWtCLENBQUMsbUJBQW1CO1lBQ2pFLDJCQUEyQixFQUFFLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQywyQkFBMkI7U0FDbEYsQ0FBQyxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ2IsT0FBTztZQUNMLGtCQUFrQixFQUFFLGtCQUFrQjtZQUN0QyxJQ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uYXBzaG90SWRlbnRpZmllcjogaWRlbnRpZmllcixcbiAgICB9KS5wcm9taXNlKCk7XG4gICAgcmV0dXJuIGRhdGEuREJDbHVzdGVyU25hcHNob3RzPy5bMF0uU3RhdHVzO1xuICB9IGNhdGNoIChlcnI6IGFueSkge1xuICAgIGlmIChlcnIuY29kZSA9PT0gJ0RCQ2x1c3RlclNuYXBzaG90Tm90Rm91bmRGYXVsdCcpIHtcbiAgICAgIHJldHVybiB1bmRlZmluZWQ7XG4gICAgfVxuICAgIHRocm93IGVycjtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.ts b/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.ts deleted file mode 100644 index bddd9cdfc8870..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-snapshot.js.snapshot/asset.2e7ee01d9005281c0784e709cad69500591734343d1cb95da2fb4a3f5076aadd/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable no-console */ -import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { RDS } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies - -export async function onEventHandler(event: OnEventRequest): Promise { - console.log('Event: %j', event); - - const rds = new RDS(); - - const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; - - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - const data = await rds.createDBClusterSnapshot({ - DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, - DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, - }).promise(); - return { - PhysicalResourceId: physicalResourceId, - Data: { - DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, - }, - }; - } - - if (event.RequestType === 'Delete') { - await rds.deleteDBClusterSnapshot({ - DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, - }).promise(); - } - - return { - PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, - }; -} - -export async function isCompleteHandler(event: IsCompleteRequest): Promise { - console.log('Event: %j', event); - - const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); - - switch (event.RequestType) { - case 'Create': - case 'Update': - return { IsComplete: snapshotStatus === 'available' }; - case 'Delete': - return { IsComplete: snapshotStatus === undefined }; - } -} - -async function tryGetClusterSnapshotStatus(identifier: string): Promise { - try { - const rds = new RDS(); - const data = await rds.describeDBClusterSnapshots({ - DBClusterSnapshotIdentifier: identifier, - }).promise(); - return data.DBClusterSnapshots?.[0].Status; - } catch (err: any) { - if (err.code === 'DBClusterSnapshotNotFoundFault') { - return undefined; - } - throw err; - } -} diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.ts b/packages/@aws-cdk/aws-rds/test/integ.cluster.ts deleted file mode 100644 index 1b136ea59a55c..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; -import { Credentials, DatabaseCluster, DatabaseClusterEngine, ParameterGroup } from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); - -const vpc = new ec2.Vpc(stack, 'VPC', { maxAzs: 2 }); - -const params = new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'A nice parameter group', - parameters: { - character_set_database: 'utf8mb4', - }, -}); - -const kmsKey = new kms.Key(stack, 'DbSecurity'); - -const cluster = new DatabaseCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA, - credentials: Credentials.fromUsername('admin', { password: cdk.SecretValue.unsafePlainText('7959866cacc02c2d243ecfe177464fe6') }), - instanceProps: { - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, - vpc, - }, - parameterGroup: params, - storageEncryptionKey: kmsKey, -}); - -cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); - -const role = new iam.Role(stack, 'ClusterIamAccess', { - assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'), -}); -const clusterIamAuthArn = stack.formatArn({ - service: 'rds-db', - resource: `dbuser:${cluster.clusterResourceIdentifier}`, - resourceName: 'db_user', -}); -role.addToPolicy( - new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: ['rds-db:connect'], - resources: [clusterIamAuthArn], - }), -); - -app.synth(); diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts deleted file mode 100644 index 9bbf5854684b6..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise; diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js deleted file mode 100644 index abe5256da850c..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -/** - * Creates a log group and doesn't throw if it exists. - * - * @param logGroupName the name of the log group to create. - * @param region to create the log group in - * @param options CloudWatch API SDK options. - */ -async function createLogGroupSafe(logGroupName, region, options) { - // If we set the log retention for a lambda, then due to the async nature of - // Lambda logging there could be a race condition when the same log group is - // already being created by the lambda execution. This can sometime result in - // an error "OperationAbortedException: A conflicting operation is currently - // in progress...Please try again." - // To avoid an error, we do as requested and try again. - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.createLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceAlreadyExistsException') { - // The log group is already created by the lambda execution - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -//delete a log group -async function deleteLogGroup(logGroupName, region, options) { - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - await cloudwatchlogs.deleteLogGroup({ logGroupName }).promise(); - return; - } - catch (error) { - if (error.code === 'ResourceNotFoundException') { - // The log group doesn't exist - return; - } - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being deleted by another execution but we are out of retries - throw new Error('Out of attempts to delete a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -/** - * Puts or deletes a retention policy on a log group. - * - * @param logGroupName the name of the log group to create - * @param region the region of the log group - * @param options CloudWatch API SDK options. - * @param retentionInDays the number of days to retain the log events in the specified log group. - */ -async function setRetentionPolicy(logGroupName, region, options, retentionInDays) { - // The same as in createLogGroupSafe(), here we could end up with the race - // condition where a log group is either already being created or its retention - // policy is being updated. This would result in an OperationAbortedException, - // which we will try to catch and retry the command a number of times before failing - let retryCount = options?.maxRetries == undefined ? 10 : options.maxRetries; - const delay = options?.retryOptions?.base == undefined ? 10 : options.retryOptions.base; - do { - try { - const cloudwatchlogs = new AWS.CloudWatchLogs({ apiVersion: '2014-03-28', region, ...options }); - if (!retentionInDays) { - await cloudwatchlogs.deleteRetentionPolicy({ logGroupName }).promise(); - } - else { - await cloudwatchlogs.putRetentionPolicy({ logGroupName, retentionInDays }).promise(); - } - return; - } - catch (error) { - if (error.code === 'OperationAbortedException') { - if (retryCount > 0) { - retryCount--; - await new Promise(resolve => setTimeout(resolve, delay)); - continue; - } - else { - // The log group is still being created by another execution but we are out of retries - throw new Error('Out of attempts to create a logGroup'); - } - } - throw error; - } - } while (true); // exit happens on retry count check -} -async function handler(event, context) { - try { - console.log(JSON.stringify({ ...event, ResponseURL: '...' })); - // The target log group - const logGroupName = event.ResourceProperties.LogGroupName; - // The region of the target log group - const logGroupRegion = event.ResourceProperties.LogGroupRegion; - // Parse to AWS SDK retry options - const retryOptions = parseRetryOptions(event.ResourceProperties.SdkRetry); - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - // Act on the target log group - await createLogGroupSafe(logGroupName, logGroupRegion, retryOptions); - await setRetentionPolicy(logGroupName, logGroupRegion, retryOptions, parseInt(event.ResourceProperties.RetentionInDays, 10)); - if (event.RequestType === 'Create') { - // Set a retention policy of 1 day on the logs of this very function. - // Due to the async nature of the log group creation, the log group for this function might - // still be not created yet at this point. Therefore we attempt to create it. - // In case it is being created, createLogGroupSafe will handle the conflict. - const region = process.env.AWS_REGION; - await createLogGroupSafe(`/aws/lambda/${context.functionName}`, region, retryOptions); - // If createLogGroupSafe fails, the log group is not created even after multiple attempts. - // In this case we have nothing to set the retention policy on but an exception will skip - // the next line. - await setRetentionPolicy(`/aws/lambda/${context.functionName}`, region, retryOptions, 1); - } - } - //When the requestType is delete, delete the log group if the removal policy is delete - if (event.RequestType === 'Delete' && event.ResourceProperties.RemovalPolicy === 'destroy') { - await deleteLogGroup(logGroupName, logGroupRegion, retryOptions); - //else retain the log group - } - await respond('SUCCESS', 'OK', logGroupName); - } - catch (e) { - console.log(e); - await respond('FAILED', e.message, event.ResourceProperties.LogGroupName); - } - function respond(responseStatus, reason, physicalResourceId) { - const responseBody = JSON.stringify({ - Status: responseStatus, - Reason: reason, - PhysicalResourceId: physicalResourceId, - StackId: event.StackId, - RequestId: event.RequestId, - LogicalResourceId: event.LogicalResourceId, - Data: { - // Add log group name as part of the response so that it's available via Fn::GetAtt - LogGroupName: event.ResourceProperties.LogGroupName, - }, - }); - console.log('Responding', responseBody); - // eslint-disable-next-line @typescript-eslint/no-require-imports - const parsedUrl = require('url').parse(event.ResponseURL); - const requestOptions = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - return new Promise((resolve, reject) => { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const request = require('https').request(requestOptions, resolve); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); - } - function parseRetryOptions(rawOptions) { - const retryOptions = {}; - if (rawOptions) { - if (rawOptions.maxRetries) { - retryOptions.maxRetries = parseInt(rawOptions.maxRetries, 10); - } - if (rawOptions.base) { - retryOptions.retryOptions = { - base: parseInt(rawOptions.base, 10), - }; - } - } - return retryOptions; - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsNkRBQTZEO0FBQzdELCtCQUErQjtBQVMvQjs7Ozs7O0dBTUc7QUFDSCxLQUFLLFVBQVUsa0JBQWtCLENBQUMsWUFBb0IsRUFBRSxNQUFlLEVBQUUsT0FBeUI7SUFDaEcsNEVBQTRFO0lBQzVFLDRFQUE0RTtJQUM1RSw2RUFBNkU7SUFDN0UsNEVBQTRFO0lBQzVFLG1DQUFtQztJQUNuQyx1REFBdUQ7SUFDdkQsSUFBSSxVQUFVLEdBQUcsT0FBTyxFQUFFLFVBQVUsSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUM1RSxNQUFNLEtBQUssR0FBRyxPQUFPLEVBQUUsWUFBWSxFQUFFLElBQUksSUFBSSxTQUFTLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsT0FBTyxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUM7SUFDeEYsR0FBRztRQUNELElBQUk7WUFDRixNQUFNLGNBQWMsR0FBRyxJQUFJLEdBQUcsQ0FBQyxjQUFjLENBQUMsRUFBRSxVQUFVLEVBQUUsWUFBWSxFQUFFLE1BQU0sRUFBRSxHQUFHLE9BQU8sRUFBRSxDQUFDLENBQUM7WUFDaEcsTUFBTSxjQUFjLENBQUMsY0FBYyxDQUFDLEVBQUUsWUFBWSxFQUFFLENBQUMsQ0FBQyxPQUFPLEVBQUUsQ0FBQztZQUNoRSxPQUFPO1N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line at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts deleted file mode 100644 index 4fb96853335d9..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as targets from '@aws-cdk/aws-events-targets'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { RemovalPolicy } from '@aws-cdk/core'; -import * as rds from '../lib'; - -const app = new cdk.App(); - -class DatabaseInstanceStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); - - /// !show - // Set open cursors with parameter group - const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), - parameters: { - open_cursors: '2500', - }, - }); - - /// Add XMLDB and OEM with option group - const optionGroup = new rds.OptionGroup(this, 'OptionGroup', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), - configurations: [ - { - name: 'LOCATOR', - }, - { - name: 'OEM', - port: 1158, - vpc, - }, - ], - }); - - // Allow connections to OEM - optionGroup.optionConnections.OEM.connections.allowDefaultPortFromAnyIpv4(); - - // Database instance with production values - const instance = new rds.DatabaseInstance(this, 'Instance', { - engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), - licenseModel: rds.LicenseModel.BRING_YOUR_OWN_LICENSE, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), - multiAz: true, - storageType: rds.StorageType.IO1, - credentials: rds.Credentials.fromUsername('syscdk'), - vpc, - databaseName: 'ORCL', - storageEncrypted: true, - backupRetention: cdk.Duration.days(7), - monitoringInterval: cdk.Duration.seconds(60), - enablePerformanceInsights: true, - cloudwatchLogsExports: [ - 'trace', - 'audit', - 'alert', - 'listener', - ], - cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH, - autoMinorVersionUpgrade: true, // required to be true if LOCATOR is used in the option group - optionGroup, - parameterGroup, - removalPolicy: RemovalPolicy.DESTROY, - }); - - // Allow connections on default port from any IPV4 - instance.connections.allowDefaultPortFromAnyIpv4(); - - // Rotate the master user password every 30 days - instance.addRotationSingleUser(); - - // Add alarm for high CPU - new cloudwatch.Alarm(this, 'HighCPU', { - metric: instance.metricCPUUtilization(), - threshold: 90, - evaluationPeriods: 1, - }); - - // Trigger Lambda function on instance availability events - const fn = new lambda.Function(this, 'Function', { - code: lambda.Code.fromInline('exports.handler = (event) => console.log(event);'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const availabilityRule = instance.onEvent('Availability', { target: new targets.LambdaFunction(fn) }); - availabilityRule.addEventPattern({ - detail: { - EventCategories: [ - 'availability', - ], - }, - }); - /// !hide - } -} - -new DatabaseInstanceStack(app, 'aws-cdk-rds-instance'); -app.synth(); diff --git a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.ts b/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.ts deleted file mode 100644 index af00df5d5ce99..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/integ.serverless-cluster-secret-rotation.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Credentials, ServerlessCluster, DatabaseClusterEngine, DatabaseSecret } from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-rds-integ-secret-rotation'); - -const kmsKey = new kms.Key(stack, 'DbSecurity'); -const secret = new DatabaseSecret(stack, 'test-secret', { - username: 'admin', -}); - -const cluster = new ServerlessCluster(stack, 'Database', { - engine: DatabaseClusterEngine.AURORA_MYSQL, - credentials: Credentials.fromSecret(secret), - storageEncryptionKey: kmsKey, -}); - -secret.addRotationSchedule('test-schedule', { - hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), -}); - -cluster.grantDataApiAccess(new iam.AccountRootPrincipal()); -cluster.grantDataApiAccess(new iam.ServicePrincipal('ecs-tasks.amazonaws.com')); - -new IntegTest(app, 'cdk-rds-integ-secret-rotation', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-rds/test/parameter-group.test.ts b/packages/@aws-cdk/aws-rds/test/parameter-group.test.ts deleted file mode 100644 index 594fab914310a..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/parameter-group.test.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { DatabaseClusterEngine, ParameterGroup } from '../lib'; - -describe('parameter group', () => { - test("does not create a parameter group if it wasn't bound to a cluster or instance", () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'desc', - parameters: { - key: 'value', - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBParameterGroup', 0); - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 0); - }); - - test('create a parameter group when bound to an instance', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const parameterGroup = new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'desc', - parameters: { - key: 'value', - }, - }); - parameterGroup.bindToInstance({}); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBParameterGroup', { - Description: 'desc', - Family: 'aurora5.6', - Parameters: { - key: 'value', - }, - }); - }); - - test('create a parameter group when bound to a cluster', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const parameterGroup = new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'desc', - parameters: { - key: 'value', - }, - }); - parameterGroup.bindToCluster({}); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Description: 'desc', - Family: 'aurora5.6', - Parameters: { - key: 'value', - }, - }); - }); - - test('creates 2 parameter groups when bound to a cluster and an instance', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const parameterGroup = new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'desc', - parameters: { - key: 'value', - }, - }); - parameterGroup.bindToCluster({}); - parameterGroup.bindToInstance({}); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBParameterGroup', 1); - Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 1); - }); - - test('Add an additional parameter to an existing parameter group', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const clusterParameterGroup = new ParameterGroup(stack, 'Params', { - engine: DatabaseClusterEngine.AURORA, - description: 'desc', - parameters: { - key1: 'value1', - }, - }); - clusterParameterGroup.bindToCluster({}); - - clusterParameterGroup.addParameter('key2', 'value2'); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { - Description: 'desc', - Family: 'aurora5.6', - Parameters: { - key1: 'value1', - key2: 'value2', - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-rds/test/snapshot-handler/index.ts b/packages/@aws-cdk/aws-rds/test/snapshot-handler/index.ts deleted file mode 100644 index dea29d4fc0fec..0000000000000 --- a/packages/@aws-cdk/aws-rds/test/snapshot-handler/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable no-console */ -import * as AWSCDKAsyncCustomResource from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { RDS } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies - -export async function onEventHandler(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise { - console.log('Event: %j', event); - - const rds = new RDS(); - - const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; - - if (event.RequestType === 'Create' || event.RequestType === 'Update') { - const data = await rds.createDBClusterSnapshot({ - DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, - DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, - }).promise(); - return { - PhysicalResourceId: physicalResourceId, - Data: { - DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, - }, - }; - } - - if (event.RequestType === 'Delete') { - await rds.deleteDBClusterSnapshot({ - DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, - }).promise(); - } - - return { - PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, - }; -} - -export async function isCompleteHandler(event: AWSCDKAsyncCustomResource.IsCompleteRequest): Promise { - console.log('Event: %j', event); - - const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); - - switch (event.RequestType) { - case 'Create': - case 'Update': - return { IsComplete: snapshotStatus === 'available' }; - case 'Delete': - return { IsComplete: snapshotStatus === undefined }; - } -} - -async function tryGetClusterSnapshotStatus(identifier: string): Promise { - try { - const rds = new RDS(); - const data = await rds.describeDBClusterSnapshots({ - DBClusterSnapshotIdentifier: identifier, - }).promise(); - return data.DBClusterSnapshots?.[0].Status; - } catch (err: any) { - if (err.code === 'DBClusterSnapshotNotFoundFault') { - return undefined; - } - throw err; - } -} diff --git a/packages/@aws-cdk/aws-redshift/.eslintrc.js b/packages/@aws-cdk/aws-redshift/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-redshift/.eslintrc.js +++ b/packages/@aws-cdk/aws-redshift/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-redshift/.gitignore b/packages/@aws-cdk/aws-redshift/.gitignore index 3e895fc51317c..8ab7624e63416 100644 --- a/packages/@aws-cdk/aws-redshift/.gitignore +++ b/packages/@aws-cdk/aws-redshift/.gitignore @@ -21,3 +21,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-redshift/README.md b/packages/@aws-cdk/aws-redshift/README.md index ba8680aaade4d..ee06f1e1278f5 100644 --- a/packages/@aws-cdk/aws-redshift/README.md +++ b/packages/@aws-cdk/aws-redshift/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -27,7 +21,7 @@ To set up a Redshift cluster, define a `Cluster`. It will be launched in a VPC. You can specify a VPC, otherwise one will be created. The nodes are always launched in private subnets and are encrypted by default. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const vpc = new ec2.Vpc(this, 'Vpc'); const cluster = new Cluster(this, 'Redshift', { @@ -50,8 +44,8 @@ Depending on your use case, you can make the cluster publicly accessible with th Amazon Redshift logs information about connections and user activities in your database. These logs help you to monitor the database for security and troubleshooting purposes, a process called database auditing. To send these logs to an S3 bucket, specify the `loggingProperties` when creating a new cluster. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const vpc = new ec2.Vpc(this, 'Vpc'); const bucket = s3.Bucket.fromBucketName(this, 'bucket', 'logging-bucket'); @@ -125,7 +119,7 @@ Manager encryption key. You can specify the encryption key used for this purpose supplying a key in the `encryptionKey` property. ```ts fixture=cluster -import * as kms from '@aws-cdk/aws-kms'; +import * as kms from 'aws-cdk-lib/aws-kms'; const encryptionKey = new kms.Key(this, 'Key'); new User(this, 'User', { @@ -217,7 +211,7 @@ new Table(this, 'Table', { Table columns can be configured to use a specific compression encoding: ```ts fixture=cluster -import { ColumnEncoding } from '@aws-cdk/aws-redshift'; +import { ColumnEncoding } from '@aws-cdk/aws-redshift-alpha'; new Table(this, 'Table', { tableColumns: [ @@ -349,7 +343,7 @@ cluster.addRotationMultiUser('MultiUserRotation', { You can add a parameter to a parameter group with`ClusterParameterGroup.addParameter()`. ```ts -import { ClusterParameterGroup } from '@aws-cdk/aws-redshift'; +import { ClusterParameterGroup } from '@aws-cdk/aws-redshift-alpha'; const params = new ClusterParameterGroup(this, 'Params', { description: 'desc', @@ -364,8 +358,8 @@ params.addParameter('enable_user_activity_logging', 'true'); Additionally, you can add a parameter to the cluster's associated parameter group with `Cluster.addToParameterGroup()`. If the cluster does not have an associated parameter group, a new parameter group is created. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; declare const vpc: ec2.Vpc; const cluster = new Cluster(this, 'Cluster', { @@ -384,8 +378,8 @@ cluster.addToParameterGroup('enable_user_activity_logging', 'true'); In most cases, existing clusters [must be manually rebooted](https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html) to apply parameter changes. You can automate parameter related reboots by setting the cluster's `rebootForParameterChanges` property to `true` , or by using `Cluster.enableRebootForParameterChanges()`. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; declare const vpc: ec2.Vpc; const cluster = new Cluster(this, 'Cluster', { @@ -405,8 +399,8 @@ cluster.enableRebootForParameterChanges() If you configure your cluster to be publicly accessible, you can optionally select an *elastic IP address* to use for the external IP address. An elastic IP address is a static IP address that is associated with your AWS account. You can use an elastic IP address to connect to your cluster from outside the VPC. An elastic IP address gives you the ability to change your underlying configuration without affecting the IP address that clients use to connect to your cluster. This approach can be helpful for situations such as recovery after a failure. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; declare const vpc: ec2.Vpc; new Cluster(this, 'Redshift', { @@ -423,7 +417,7 @@ new Cluster(this, 'Redshift', { If the Cluster is in a VPC and you want to connect to it using the private IP address from within the cluster, it is important to enable *DNS resolution* and *DNS hostnames* in the VPC config. If these parameters would not be set, connections from within the VPC would connect to the elastic IP address and not the private IP address. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; const vpc = new ec2.Vpc(this, 'VPC', { enableDnsSupport: true, enableDnsHostnames: true, @@ -445,8 +439,8 @@ In some cases, you might want to associate the cluster with an elastic IP addres When you use Amazon Redshift enhanced VPC routing, Amazon Redshift forces all COPY and UNLOAD traffic between your cluster and your data repositories through your virtual private cloud (VPC) based on the Amazon VPC service. By using enhanced VPC routing, you can use standard VPC features, such as VPC security groups, network access control lists (ACLs), VPC endpoints, VPC endpoint policies, internet gateways, and Domain Name System (DNS) servers, as described in the Amazon VPC User Guide. You use these features to tightly manage the flow of data between your Amazon Redshift cluster and other resources. When you use enhanced VPC routing to route traffic through your VPC, you can also use VPC flow logs to monitor COPY and UNLOAD traffic. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; declare const vpc: ec2.Vpc; new Cluster(this, 'Redshift', { @@ -468,8 +462,8 @@ Some Amazon Redshift features require Amazon Redshift to access other AWS servic When you create an IAM role and set it as the default for the cluster using console, you don't have to provide the IAM role's Amazon Resource Name (ARN) to perform authentication and authorization. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const vpc: ec2.Vpc; const defaultRole = new iam.Role(this, 'DefaultRole', { @@ -490,8 +484,8 @@ new Cluster(this, 'Redshift', { A default role can also be added to a cluster using the `addDefaultIamRole` method. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const vpc: ec2.Vpc; const defaultRole = new iam.Role(this, 'DefaultRole', { @@ -515,8 +509,8 @@ redshiftCluster.addDefaultIamRole(defaultRole); Attaching IAM roles to a Redshift Cluster grants permissions to the Redshift service to perform actions on your behalf. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const vpc: ec2.Vpc const role = new iam.Role(this, 'Role', { @@ -534,8 +528,8 @@ const cluster = new Cluster(this, 'Redshift', { Additional IAM roles can be attached to a cluster using the `addIamRole` method. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const vpc: ec2.Vpc const role = new iam.Role(this, 'Role', { diff --git a/packages/@aws-cdk/aws-redshift/lib/cluster.ts b/packages/@aws-cdk/aws-redshift/lib/cluster.ts index 3e415604d035a..e4da33d1b58fd 100644 --- a/packages/@aws-cdk/aws-redshift/lib/cluster.ts +++ b/packages/@aws-cdk/aws-redshift/lib/cluster.ts @@ -1,17 +1,17 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { ArnFormat, CustomResource, Duration, IResource, Lazy, RemovalPolicy, Resource, SecretValue, Stack, Token } from '@aws-cdk/core'; -import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId, Provider } from '@aws-cdk/custom-resources'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import { ArnFormat, CustomResource, Duration, IResource, Lazy, RemovalPolicy, Resource, SecretValue, Stack, Token } from 'aws-cdk-lib'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId, Provider } from 'aws-cdk-lib/custom-resources'; import { Construct } from 'constructs'; import { DatabaseSecret } from './database-secret'; import { Endpoint } from './endpoint'; import { ClusterParameterGroup, IClusterParameterGroup } from './parameter-group'; -import { CfnCluster } from './redshift.generated'; +import { CfnCluster } from 'aws-cdk-lib/aws-redshift'; import { ClusterSubnetGroup, IClusterSubnetGroup } from './subnet-group'; /** * Possible Node Types to use in the cluster diff --git a/packages/@aws-cdk/aws-redshift/lib/database-options.ts b/packages/@aws-cdk/aws-redshift/lib/database-options.ts index b7eb21e57e24c..a7526d87a15fa 100644 --- a/packages/@aws-cdk/aws-redshift/lib/database-options.ts +++ b/packages/@aws-cdk/aws-redshift/lib/database-options.ts @@ -1,4 +1,4 @@ -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; import { ICluster } from './cluster'; /** diff --git a/packages/@aws-cdk/aws-redshift/lib/database-secret.ts b/packages/@aws-cdk/aws-redshift/lib/database-secret.ts index 2476bfef3f7e0..dd307f9d8de7c 100644 --- a/packages/@aws-cdk/aws-redshift/lib/database-secret.ts +++ b/packages/@aws-cdk/aws-redshift/lib/database-secret.ts @@ -1,5 +1,5 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-redshift/lib/endpoint.ts b/packages/@aws-cdk/aws-redshift/lib/endpoint.ts index 0ee19b8d82113..23f59080a584d 100644 --- a/packages/@aws-cdk/aws-redshift/lib/endpoint.ts +++ b/packages/@aws-cdk/aws-redshift/lib/endpoint.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from 'aws-cdk-lib'; /** * Connection endpoint of a redshift cluster diff --git a/packages/@aws-cdk/aws-redshift/lib/index.ts b/packages/@aws-cdk/aws-redshift/lib/index.ts index ec552d2da8c3c..b905682bcf03c 100644 --- a/packages/@aws-cdk/aws-redshift/lib/index.ts +++ b/packages/@aws-cdk/aws-redshift/lib/index.ts @@ -8,4 +8,3 @@ export * from './table'; export * from './user'; // AWS::Redshift CloudFormation Resources: -export * from './redshift.generated'; diff --git a/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts b/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts index 831b79d42dc46..2b466453c0597 100644 --- a/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts +++ b/packages/@aws-cdk/aws-redshift/lib/parameter-group.ts @@ -1,6 +1,6 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnClusterParameterGroup } from './redshift.generated'; +import { CfnClusterParameterGroup } from 'aws-cdk-lib/aws-redshift'; /** * A parameter group diff --git a/packages/@aws-cdk/aws-redshift/lib/private/database-query.ts b/packages/@aws-cdk/aws-redshift/lib/private/database-query.ts index 8e2f793724d8a..ad3be76785ee2 100644 --- a/packages/@aws-cdk/aws-redshift/lib/private/database-query.ts +++ b/packages/@aws-cdk/aws-redshift/lib/private/database-query.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as customresources from '@aws-cdk/custom-resources'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; +import * as customresources from 'aws-cdk-lib/custom-resources'; import { Construct } from 'constructs'; import { DatabaseQueryHandlerProps } from './handler-props'; import { Cluster } from '../cluster'; diff --git a/packages/@aws-cdk/aws-redshift/lib/private/privileges.ts b/packages/@aws-cdk/aws-redshift/lib/private/privileges.ts index b9975d7fdec7c..201778776d5f8 100644 --- a/packages/@aws-cdk/aws-redshift/lib/private/privileges.ts +++ b/packages/@aws-cdk/aws-redshift/lib/private/privileges.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { DatabaseQuery } from './database-query'; import { HandlerName } from './database-query-provider/handler-name'; diff --git a/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts b/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts index ca2b3c80c3841..bc0f49aa7ce55 100644 --- a/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts +++ b/packages/@aws-cdk/aws-redshift/lib/subnet-group.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { IResource, RemovalPolicy, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnClusterSubnetGroup } from './redshift.generated'; +import { CfnClusterSubnetGroup } from 'aws-cdk-lib/aws-redshift'; /** * Interface for a cluster subnet group. diff --git a/packages/@aws-cdk/aws-redshift/lib/table.ts b/packages/@aws-cdk/aws-redshift/lib/table.ts index 634e07f3fd819..949aee8394f37 100644 --- a/packages/@aws-cdk/aws-redshift/lib/table.ts +++ b/packages/@aws-cdk/aws-redshift/lib/table.ts @@ -1,6 +1,6 @@ /* eslint-disable import/no-extraneous-dependencies */ -import * as cdk from '@aws-cdk/core'; -import { REDSHIFT_COLUMN_ID } from '@aws-cdk/cx-api'; +import * as cdk from 'aws-cdk-lib'; +import { REDSHIFT_COLUMN_ID } from 'aws-cdk-lib/cx-api'; import { Construct, IConstruct } from 'constructs'; import { ICluster } from './cluster'; import { DatabaseOptions } from './database-options'; diff --git a/packages/@aws-cdk/aws-redshift/lib/user.ts b/packages/@aws-cdk/aws-redshift/lib/user.ts index 717cdc82ce024..fcdfee37637af 100644 --- a/packages/@aws-cdk/aws-redshift/lib/user.ts +++ b/packages/@aws-cdk/aws-redshift/lib/user.ts @@ -1,6 +1,6 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; import { Construct, IConstruct } from 'constructs'; import { ICluster } from './cluster'; import { DatabaseOptions } from './database-options'; diff --git a/packages/@aws-cdk/aws-redshift/package.json b/packages/@aws-cdk/aws-redshift/package.json index ec00d85ccf7b2..157e901e25aa7 100644 --- a/packages/@aws-cdk/aws-redshift/package.json +++ b/packages/@aws-cdk/aws-redshift/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-redshift", + "name": "@aws-cdk/aws-redshift-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Redshift", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "java": { - "package": "software.amazon.awscdk.services.redshift", + "package": "software.amazon.awscdk.services.redshift.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "redshift" + "artifactId": "redshift-alpha" } }, "dotnet": { - "namespace": "Amazon.CDK.AWS.Redshift", - "packageId": "Amazon.CDK.AWS.Redshift", + "namespace": "Amazon.CDK.AWS.Redshift.Alpha", + "packageId": "Amazon.CDK.AWS.Redshift.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "python": { - "distName": "aws-cdk.aws-redshift", - "module": "aws_cdk.aws_redshift", + "distName": "aws-cdk.aws-redshift-alpha", + "module": "aws_cdk.aws_redshift_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkredshiftalpha" } }, "projectReferences": true, @@ -52,17 +56,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Redshift", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -80,37 +81,21 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@types/jest": "^27.5.2", "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" + "jest": "^27.5.1", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -118,16 +103,7 @@ }, "awslint": { "exclude": [ - "attribute-tag:@aws-cdk/aws-redshift.DatabaseSecret.secretFullArn", - "attribute-tag:@aws-cdk/aws-redshift.DatabaseSecret.secretName", - "docs-public-apis:@aws-cdk/aws-redshift.ParameterGroupParameters.parameterName", - "docs-public-apis:@aws-cdk/aws-redshift.ParameterGroupParameters.parameterValue", - "props-physical-name:@aws-cdk/aws-redshift.ClusterParameterGroupProps", - "props-physical-name:@aws-cdk/aws-redshift.ClusterSubnetGroupProps", - "props-physical-name:@aws-cdk/aws-redshift.DatabaseSecretProps", - "resource-attribute:@aws-cdk/aws-redshift.Cluster.clusterId", - "resource-attribute:@aws-cdk/aws-redshift.Cluster.clusterDeferMaintenanceIdentifier", - "resource-attribute:@aws-cdk/aws-redshift.ClusterParameterGroup.clusterParameterGroupParameterGroupName" + "*:*" ] }, "stability": "experimental", @@ -137,5 +113,11 @@ }, "publishConfig": { "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-redshift/rosetta/cluster.ts-fixture b/packages/@aws-cdk/aws-redshift/rosetta/cluster.ts-fixture index 5370187ca48b4..cd984e6fe2e10 100644 --- a/packages/@aws-cdk/aws-redshift/rosetta/cluster.ts-fixture +++ b/packages/@aws-cdk/aws-redshift/rosetta/cluster.ts-fixture @@ -1,7 +1,7 @@ // Fixture with cluster already created -import { SecretValue, Stack } from '@aws-cdk/core'; -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Cluster, Table, TableAction, TableDistStyle, TableSortStyle, User } from '@aws-cdk/aws-redshift'; +import { SecretValue, Stack } from 'aws-cdk-lib'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, Table, TableAction, TableDistStyle, TableSortStyle, User } from '@aws-cdk/aws-redshift-alpha'; import { Construct } from 'constructs'; class Fixture extends Stack { diff --git a/packages/@aws-cdk/aws-redshift/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-redshift/rosetta/default.ts-fixture index 9fbb38dff8177..1d8d960ca6616 100644 --- a/packages/@aws-cdk/aws-redshift/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-redshift/rosetta/default.ts-fixture @@ -1,6 +1,6 @@ // Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Cluster } from '@aws-cdk/aws-redshift'; +import { Stack } from 'aws-cdk-lib'; +import { Cluster } from '@aws-cdk/aws-redshift-alpha'; import { Construct } from 'constructs'; class Fixture extends Stack { diff --git a/packages/@aws-cdk/aws-redshift/test/cluster.test.ts b/packages/@aws-cdk/aws-redshift/test/cluster.test.ts index 45b71e307a6b8..a8d8b1f0dc8df 100644 --- a/packages/@aws-cdk/aws-redshift/test/cluster.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/cluster.test.ts @@ -1,11 +1,11 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { Cluster, ClusterParameterGroup, ClusterSubnetGroup, ClusterType } from '../lib'; -import { CfnCluster } from '../lib/redshift.generated'; +import { CfnCluster } from 'aws-cdk-lib/aws-redshift'; let stack: cdk.Stack; let vpc: ec2.IVpc; diff --git a/packages/@aws-cdk/aws-redshift/test/database-query.test.ts b/packages/@aws-cdk/aws-redshift/test/database-query.test.ts index 90bddb1413c36..226aaa0a77c7e 100644 --- a/packages/@aws-cdk/aws-redshift/test/database-query.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/database-query.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; import * as redshift from '../lib'; import { DatabaseQuery, DatabaseQueryProps } from '../lib/private/database-query'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.ts index 58a9ffa56ded2..5c5d729e6b9f9 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-defaultiamrole.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Stack, App, StackProps, RemovalPolicy } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { Stack, App, StackProps, RemovalPolicy } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts index 72c8f9cbc7a44..60f83ea4853bc 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-elasticip.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts index 394e334ecdd45..2e9dc12e34fc1 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack, App, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Stack, App, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-iamrole.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-iamrole.ts index cb664b04c87fa..f3c8b819e37d0 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-iamrole.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-iamrole.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, RemovalPolicy, Stack, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { App, RemovalPolicy, Stack, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-loggingbucket.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-loggingbucket.ts index a92fadd51280a..b5efdce2f457f 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-loggingbucket.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-loggingbucket.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack, App, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { Stack, App, StackProps } from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-reboot.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-reboot.ts index 2645ee74dd686..8cfca371ccb1d 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.cluster-reboot.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-reboot.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Match } from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; +import { Match } from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.ts b/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.ts index 71061883dc908..8ee91591ff1a2 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.database-columnid.ts @@ -1,10 +1,10 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; // eslint-disable-next-line import/no-extraneous-dependencies -import { REDSHIFT_COLUMN_ID } from '@aws-cdk/cx-api'; -import * as integ from '@aws-cdk/integ-tests'; +import { REDSHIFT_COLUMN_ID } from 'aws-cdk-lib/cx-api'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/integ.database.ts b/packages/@aws-cdk/aws-redshift/test/integ.database.ts index 1474e8811d459..3d5f8cf8e5074 100644 --- a/packages/@aws-cdk/aws-redshift/test/integ.database.ts +++ b/packages/@aws-cdk/aws-redshift/test/integ.database.ts @@ -1,10 +1,10 @@ #!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; // eslint-disable-next-line import/no-extraneous-dependencies -import { REDSHIFT_COLUMN_ID } from '@aws-cdk/cx-api'; -import * as integ from '@aws-cdk/integ-tests'; +import { REDSHIFT_COLUMN_ID } from 'aws-cdk-lib/cx-api'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as constructs from 'constructs'; import * as redshift from '../lib'; diff --git a/packages/@aws-cdk/aws-redshift/test/parameter-group.test.ts b/packages/@aws-cdk/aws-redshift/test/parameter-group.test.ts index 115c19cc603a8..60e508ca49726 100644 --- a/packages/@aws-cdk/aws-redshift/test/parameter-group.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/parameter-group.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as cdk from 'aws-cdk-lib'; import { ClusterParameterGroup } from '../lib'; test('create a cluster parameter group', () => { diff --git a/packages/@aws-cdk/aws-redshift/test/privileges.test.ts b/packages/@aws-cdk/aws-redshift/test/privileges.test.ts index 91419b2eaa709..a188c5c7ade59 100644 --- a/packages/@aws-cdk/aws-redshift/test/privileges.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/privileges.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import * as redshift from '../lib'; describe('table privileges', () => { diff --git a/packages/@aws-cdk/aws-redshift/test/subnet-group.test.ts b/packages/@aws-cdk/aws-redshift/test/subnet-group.test.ts index 0fb5c6b17f21d..af23bbf49a6be 100644 --- a/packages/@aws-cdk/aws-redshift/test/subnet-group.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/subnet-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import { Stack } from 'aws-cdk-lib'; import { ClusterSubnetGroup } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-redshift/test/table.test.ts b/packages/@aws-cdk/aws-redshift/test/table.test.ts index f9c25397c2956..6ec19f537190a 100644 --- a/packages/@aws-cdk/aws-redshift/test/table.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/table.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; // eslint-disable-next-line import/no-extraneous-dependencies -import { REDSHIFT_COLUMN_ID } from '@aws-cdk/cx-api'; +import { REDSHIFT_COLUMN_ID } from 'aws-cdk-lib/cx-api'; import * as redshift from '../lib'; describe('cluster table', () => { diff --git a/packages/@aws-cdk/aws-redshift/test/user.test.ts b/packages/@aws-cdk/aws-redshift/test/user.test.ts index 79144d5c37cd3..2040e4deadf49 100644 --- a/packages/@aws-cdk/aws-redshift/test/user.test.ts +++ b/packages/@aws-cdk/aws-redshift/test/user.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as cdk from 'aws-cdk-lib'; import * as redshift from '../lib'; describe('cluster user', () => { diff --git a/packages/@aws-cdk/aws-redshiftserverless/.eslintrc.js b/packages/@aws-cdk/aws-redshiftserverless/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-redshiftserverless/.gitignore b/packages/@aws-cdk/aws-redshiftserverless/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-redshiftserverless/.npmignore b/packages/@aws-cdk/aws-redshiftserverless/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-redshiftserverless/LICENSE b/packages/@aws-cdk/aws-redshiftserverless/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-redshiftserverless/NOTICE b/packages/@aws-cdk/aws-redshiftserverless/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-redshiftserverless/README.md b/packages/@aws-cdk/aws-redshiftserverless/README.md deleted file mode 100644 index cea24c4f7ebb9..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::RedshiftServerless Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as redshiftserverless from '@aws-cdk/aws-redshiftserverless'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for RedshiftServerless construct libraries](https://constructs.dev/search?q=redshiftserverless) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RedshiftServerless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RedshiftServerless.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RedshiftServerless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RedshiftServerless.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-redshiftserverless/jest.config.js b/packages/@aws-cdk/aws-redshiftserverless/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-redshiftserverless/lib/index.ts b/packages/@aws-cdk/aws-redshiftserverless/lib/index.ts deleted file mode 100644 index 4c3f8e5598ee1..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::RedshiftServerless CloudFormation Resources: -export * from './redshiftserverless.generated'; diff --git a/packages/@aws-cdk/aws-redshiftserverless/package.json b/packages/@aws-cdk/aws-redshiftserverless/package.json deleted file mode 100644 index c1823c415e9e1..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-redshiftserverless", - "version": "0.0.0", - "private": true, - "description": "AWS::RedshiftServerless Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.RedshiftServerless", - "packageId": "Amazon.CDK.AWS.RedshiftServerless", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.redshiftserverless", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "redshiftserverless" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-redshiftserverless", - "module": "aws_cdk.aws_redshiftserverless" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-redshiftserverless" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RedshiftServerless", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::RedshiftServerless", - "aws-redshiftserverless" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-redshiftserverless/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-redshiftserverless/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-redshiftserverless/test/redshiftserverless.test.ts b/packages/@aws-cdk/aws-redshiftserverless/test/redshiftserverless.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-redshiftserverless/test/redshiftserverless.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-refactorspaces/.eslintrc.js b/packages/@aws-cdk/aws-refactorspaces/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-refactorspaces/.gitignore b/packages/@aws-cdk/aws-refactorspaces/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-refactorspaces/.npmignore b/packages/@aws-cdk/aws-refactorspaces/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-refactorspaces/LICENSE b/packages/@aws-cdk/aws-refactorspaces/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-refactorspaces/NOTICE b/packages/@aws-cdk/aws-refactorspaces/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-refactorspaces/README.md b/packages/@aws-cdk/aws-refactorspaces/README.md deleted file mode 100644 index 1dbbc272f5130..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::RefactorSpaces Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as refactorspaces from '@aws-cdk/aws-refactorspaces'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for RefactorSpaces construct libraries](https://constructs.dev/search?q=refactorspaces) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RefactorSpaces resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RefactorSpaces.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RefactorSpaces](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RefactorSpaces.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-refactorspaces/jest.config.js b/packages/@aws-cdk/aws-refactorspaces/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-refactorspaces/lib/index.ts b/packages/@aws-cdk/aws-refactorspaces/lib/index.ts deleted file mode 100644 index aa70ca7946387..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::RefactorSpaces CloudFormation Resources: -export * from './refactorspaces.generated'; diff --git a/packages/@aws-cdk/aws-refactorspaces/package.json b/packages/@aws-cdk/aws-refactorspaces/package.json deleted file mode 100644 index 6e7f0634a4927..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-refactorspaces", - "version": "0.0.0", - "description": "AWS::RefactorSpaces Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.RefactorSpaces", - "packageId": "Amazon.CDK.AWS.RefactorSpaces", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.refactorspaces", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "refactorspaces" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-refactorspaces", - "module": "aws_cdk.aws_refactorspaces" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-refactorspaces" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RefactorSpaces", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::RefactorSpaces", - "aws-refactorspaces" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-refactorspaces/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-refactorspaces/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-refactorspaces/test/refactorspaces.test.ts b/packages/@aws-cdk/aws-refactorspaces/test/refactorspaces.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-refactorspaces/test/refactorspaces.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-rekognition/.eslintrc.js b/packages/@aws-cdk/aws-rekognition/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rekognition/.gitignore b/packages/@aws-cdk/aws-rekognition/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-rekognition/.npmignore b/packages/@aws-cdk/aws-rekognition/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-rekognition/LICENSE b/packages/@aws-cdk/aws-rekognition/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-rekognition/NOTICE b/packages/@aws-cdk/aws-rekognition/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-rekognition/README.md b/packages/@aws-cdk/aws-rekognition/README.md deleted file mode 100644 index 6d3d8076803c1..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Rekognition Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as rekognition from '@aws-cdk/aws-rekognition'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Rekognition construct libraries](https://constructs.dev/search?q=rekognition) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Rekognition resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Rekognition.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Rekognition](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Rekognition.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-rekognition/jest.config.js b/packages/@aws-cdk/aws-rekognition/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rekognition/lib/index.ts b/packages/@aws-cdk/aws-rekognition/lib/index.ts deleted file mode 100644 index a0fee8d99d632..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Rekognition CloudFormation Resources: -export * from './rekognition.generated'; diff --git a/packages/@aws-cdk/aws-rekognition/package.json b/packages/@aws-cdk/aws-rekognition/package.json deleted file mode 100644 index b3e85c3cf6523..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-rekognition", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Rekognition", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Rekognition", - "packageId": "Amazon.CDK.AWS.Rekognition", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.rekognition", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "rekognition" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-rekognition", - "module": "aws_cdk.aws_rekognition" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-rekognition" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Rekognition", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Rekognition", - "aws-rekognition" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-rekognition/test/aws-rekognition.test.ts b/packages/@aws-cdk/aws-rekognition/test/aws-rekognition.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-rekognition/test/aws-rekognition.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-resiliencehub/.eslintrc.js b/packages/@aws-cdk/aws-resiliencehub/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-resiliencehub/.gitignore b/packages/@aws-cdk/aws-resiliencehub/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-resiliencehub/.npmignore b/packages/@aws-cdk/aws-resiliencehub/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-resiliencehub/LICENSE b/packages/@aws-cdk/aws-resiliencehub/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-resiliencehub/NOTICE b/packages/@aws-cdk/aws-resiliencehub/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-resiliencehub/README.md b/packages/@aws-cdk/aws-resiliencehub/README.md deleted file mode 100644 index b7088eb8d26fc..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ResilienceHub Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as resiliencehub from '@aws-cdk/aws-resiliencehub'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ResilienceHub construct libraries](https://constructs.dev/search?q=resiliencehub) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ResilienceHub resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResilienceHub.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ResilienceHub](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResilienceHub.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-resiliencehub/jest.config.js b/packages/@aws-cdk/aws-resiliencehub/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-resiliencehub/lib/index.ts b/packages/@aws-cdk/aws-resiliencehub/lib/index.ts deleted file mode 100644 index e0ba4f5f043fc..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ResilienceHub CloudFormation Resources: -export * from './resiliencehub.generated'; diff --git a/packages/@aws-cdk/aws-resiliencehub/package.json b/packages/@aws-cdk/aws-resiliencehub/package.json deleted file mode 100644 index a89ce4e9596b2..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-resiliencehub", - "version": "0.0.0", - "description": "AWS::ResilienceHub Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ResilienceHub", - "packageId": "Amazon.CDK.AWS.ResilienceHub", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.resiliencehub", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "resiliencehub" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-resiliencehub", - "module": "aws_cdk.aws_resiliencehub" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-resiliencehub" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ResilienceHub", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ResilienceHub", - "aws-resiliencehub" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-resiliencehub/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-resiliencehub/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-resiliencehub/test/resiliencehub.test.ts b/packages/@aws-cdk/aws-resiliencehub/test/resiliencehub.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-resiliencehub/test/resiliencehub.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-resourceexplorer2/.eslintrc.js b/packages/@aws-cdk/aws-resourceexplorer2/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-resourceexplorer2/.gitignore b/packages/@aws-cdk/aws-resourceexplorer2/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-resourceexplorer2/.npmignore b/packages/@aws-cdk/aws-resourceexplorer2/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-resourceexplorer2/LICENSE b/packages/@aws-cdk/aws-resourceexplorer2/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-resourceexplorer2/NOTICE b/packages/@aws-cdk/aws-resourceexplorer2/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-resourceexplorer2/README.md b/packages/@aws-cdk/aws-resourceexplorer2/README.md deleted file mode 100644 index a79b264115d9f..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ResourceExplorer2 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as resourceexplorer2 from '@aws-cdk/aws-resourceexplorer2'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ResourceExplorer2 construct libraries](https://constructs.dev/search?q=resourceexplorer2) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ResourceExplorer2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceExplorer2.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ResourceExplorer2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceExplorer2.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-resourceexplorer2/jest.config.js b/packages/@aws-cdk/aws-resourceexplorer2/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-resourceexplorer2/lib/index.ts b/packages/@aws-cdk/aws-resourceexplorer2/lib/index.ts deleted file mode 100644 index 64dc0face87f6..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ResourceExplorer2 CloudFormation Resources: -export * from './resourceexplorer2.generated'; diff --git a/packages/@aws-cdk/aws-resourceexplorer2/package.json b/packages/@aws-cdk/aws-resourceexplorer2/package.json deleted file mode 100644 index fab17d54ebb0a..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-resourceexplorer2", - "version": "0.0.0", - "description": "AWS::ResourceExplorer2 Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ResourceExplorer2", - "packageId": "Amazon.CDK.AWS.ResourceExplorer2", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.resourceexplorer2", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "resourceexplorer2" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-resourceexplorer2", - "module": "aws_cdk.aws_resourceexplorer2" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-resourceexplorer2" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ResourceExplorer2", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ResourceExplorer2", - "aws-resourceexplorer2" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-resourceexplorer2/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-resourceexplorer2/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-resourceexplorer2/test/resourceexplorer2.test.ts b/packages/@aws-cdk/aws-resourceexplorer2/test/resourceexplorer2.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-resourceexplorer2/test/resourceexplorer2.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-resourcegroups/.eslintrc.js b/packages/@aws-cdk/aws-resourcegroups/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-resourcegroups/.gitignore b/packages/@aws-cdk/aws-resourcegroups/.gitignore deleted file mode 100644 index 1783c7fbbb37c..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-resourcegroups/.npmignore b/packages/@aws-cdk/aws-resourcegroups/.npmignore deleted file mode 100644 index bff536581af5f..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-resourcegroups/LICENSE b/packages/@aws-cdk/aws-resourcegroups/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-resourcegroups/NOTICE b/packages/@aws-cdk/aws-resourcegroups/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-resourcegroups/README.md b/packages/@aws-cdk/aws-resourcegroups/README.md deleted file mode 100644 index 9c187f3e15afe..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::ResourceGroups Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as resourcegroups from '@aws-cdk/aws-resourcegroups'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for ResourceGroups construct libraries](https://constructs.dev/search?q=resourcegroups) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ResourceGroups resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceGroups.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ResourceGroups](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceGroups.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-resourcegroups/jest.config.js b/packages/@aws-cdk/aws-resourcegroups/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-resourcegroups/lib/index.ts b/packages/@aws-cdk/aws-resourcegroups/lib/index.ts deleted file mode 100644 index 0dad84c84d64d..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::ResourceGroups CloudFormation Resources: -export * from './resourcegroups.generated'; diff --git a/packages/@aws-cdk/aws-resourcegroups/package.json b/packages/@aws-cdk/aws-resourcegroups/package.json deleted file mode 100644 index afd14cfb4e7de..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-resourcegroups", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ResourceGroups", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.ResourceGroups", - "packageId": "Amazon.CDK.AWS.ResourceGroups", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.resourcegroups", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "resourcegroups" - } - }, - "python": { - "distName": "aws-cdk.aws-resourcegroups", - "module": "aws_cdk.aws_resourcegroups", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-resourcegroups" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ResourceGroups", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::ResourceGroups", - "aws-resourcegroups" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-resourcegroups/test/resourcegroups.test.ts b/packages/@aws-cdk/aws-resourcegroups/test/resourcegroups.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-resourcegroups/test/resourcegroups.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-robomaker/.eslintrc.js b/packages/@aws-cdk/aws-robomaker/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-robomaker/.gitignore b/packages/@aws-cdk/aws-robomaker/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-robomaker/.npmignore b/packages/@aws-cdk/aws-robomaker/.npmignore deleted file mode 100644 index 4f45e282279e1..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-robomaker/LICENSE b/packages/@aws-cdk/aws-robomaker/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-robomaker/NOTICE b/packages/@aws-cdk/aws-robomaker/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-robomaker/README.md b/packages/@aws-cdk/aws-robomaker/README.md deleted file mode 100644 index ed8d8790d3596..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS RoboMaker Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as robomaker from '@aws-cdk/aws-robomaker'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for RoboMaker construct libraries](https://constructs.dev/search?q=robomaker) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RoboMaker resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RoboMaker.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RoboMaker](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RoboMaker.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-robomaker/jest.config.js b/packages/@aws-cdk/aws-robomaker/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-robomaker/lib/index.ts b/packages/@aws-cdk/aws-robomaker/lib/index.ts deleted file mode 100644 index ca4533a96156a..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::RoboMaker CloudFormation Resources: -export * from './robomaker.generated'; diff --git a/packages/@aws-cdk/aws-robomaker/package.json b/packages/@aws-cdk/aws-robomaker/package.json deleted file mode 100644 index 361353f00f836..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-robomaker", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::RoboMaker", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.RoboMaker", - "packageId": "Amazon.CDK.AWS.RoboMaker", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.robomaker", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "robomaker" - } - }, - "python": { - "distName": "aws-cdk.aws-robomaker", - "module": "aws_cdk.aws_robomaker", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-robomaker" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RoboMaker", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::RoboMaker", - "aws-robomaker" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-robomaker/test/robomaker.test.ts b/packages/@aws-cdk/aws-robomaker/test/robomaker.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-robomaker/test/robomaker.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-rolesanywhere/.eslintrc.js b/packages/@aws-cdk/aws-rolesanywhere/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rolesanywhere/.gitignore b/packages/@aws-cdk/aws-rolesanywhere/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-rolesanywhere/.npmignore b/packages/@aws-cdk/aws-rolesanywhere/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-rolesanywhere/LICENSE b/packages/@aws-cdk/aws-rolesanywhere/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-rolesanywhere/NOTICE b/packages/@aws-cdk/aws-rolesanywhere/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-rolesanywhere/README.md b/packages/@aws-cdk/aws-rolesanywhere/README.md deleted file mode 100644 index c532af2542813..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::RolesAnywhere Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as rolesanywhere from '@aws-cdk/aws-rolesanywhere'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for RolesAnywhere construct libraries](https://constructs.dev/search?q=rolesanywhere) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RolesAnywhere resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RolesAnywhere.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RolesAnywhere](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RolesAnywhere.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-rolesanywhere/jest.config.js b/packages/@aws-cdk/aws-rolesanywhere/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rolesanywhere/lib/index.ts b/packages/@aws-cdk/aws-rolesanywhere/lib/index.ts deleted file mode 100644 index f6a46d6ee3c94..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::RolesAnywhere CloudFormation Resources: -export * from './rolesanywhere.generated'; diff --git a/packages/@aws-cdk/aws-rolesanywhere/package.json b/packages/@aws-cdk/aws-rolesanywhere/package.json deleted file mode 100644 index bd962a1be422b..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-rolesanywhere", - "version": "0.0.0", - "description": "AWS::RolesAnywhere Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.RolesAnywhere", - "packageId": "Amazon.CDK.AWS.RolesAnywhere", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.rolesanywhere", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "rolesanywhere" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-rolesanywhere", - "module": "aws_cdk.aws_rolesanywhere" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-rolesanywhere" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RolesAnywhere", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::RolesAnywhere", - "aws-rolesanywhere" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-rolesanywhere/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-rolesanywhere/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-rolesanywhere/test/rolesanywhere.test.ts b/packages/@aws-cdk/aws-rolesanywhere/test/rolesanywhere.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-rolesanywhere/test/rolesanywhere.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-route53-patterns/.eslintrc.js b/packages/@aws-cdk/aws-route53-patterns/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53-patterns/.gitignore b/packages/@aws-cdk/aws-route53-patterns/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-route53-patterns/.npmignore b/packages/@aws-cdk/aws-route53-patterns/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-route53-patterns/LICENSE b/packages/@aws-cdk/aws-route53-patterns/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-route53-patterns/NOTICE b/packages/@aws-cdk/aws-route53-patterns/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-route53-patterns/README.md b/packages/@aws-cdk/aws-route53-patterns/README.md deleted file mode 100644 index cf34a9c6e1276..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# CDK Construct library for higher-level Route 53 Constructs - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library provides higher-level Amazon Route 53 constructs which follow common -architectural patterns. - -## HTTPS Redirect - -If you want to speed up delivery of your web content, you can use Amazon CloudFront, -the AWS content delivery network (CDN). CloudFront can deliver your entire website -—including dynamic, static, streaming, and interactive content—by using a global -network of edge locations. Requests for your content are automatically routed to the -edge location that gives your users the lowest latency. - -This construct allows creating a redirect from domainA to domainB using Amazon -CloudFront and Amazon S3. You can specify multiple domains to be redirected. -[Learn more](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html) about routing traffic to a CloudFront web distribution. - -The `HttpsRedirect` constructs creates: - -* Amazon CloudFront distribution - makes website available from data centres - around the world -* Amazon S3 bucket - empty bucket used for website hosting redirect (`websiteRedirect`) capabilities. -* Amazon Route 53 A/AAAA Alias records - routes traffic to the CloudFront distribution -* AWS Certificate Manager certificate - SSL/TLS certificate used by - CloudFront for your domain - -⚠️ The stack/construct can be used in any region for configuring an HTTPS redirect. -The certificate created in Amazon Certificate Manager (ACM) will be in US East (N. Virginia) -region. If you use an existing certificate, the AWS region of the certificate -must be in US East (N. Virginia). - -The following example creates an HTTPS redirect from `foo.example.com` to `bar.example.com` -As an existing certificate is not provided, one will be created in `us-east-1` by the CDK. - -```ts -new patterns.HttpsRedirect(this, 'Redirect', { - recordNames: ['foo.example.com'], - targetDomain: 'bar.example.com', - zone: route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), -}); -``` - -To have `HttpsRedirect` use the `Certificate` construct as the default -created certificate instead of the deprecated `DnsValidatedCertificate` -construct, enable the `@aws-cdk/aws-route53-patters:useCertificate` -feature flag. If you are creating the stack in a region other than `us-east-1` -you must also enable `crossRegionReferences` on the stack. - -```ts -declare const app: App; -const stack = new Stack(app, 'Stack', { - crossRegionReferences: true, - env: { - region: 'us-east-2', - }, -}); - -new patterns.HttpsRedirect(this, 'Redirect', { - recordNames: ['foo.example.com'], - targetDomain: 'bar.example.com', - zone: route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), -}); -``` - -It is safe to upgrade to `@aws-cdk/aws-route53-patterns:useCertificate` since -the new certificate will be created and updated on the CloudFront distribution -before the old certificate is deleted. diff --git a/packages/@aws-cdk/aws-route53-patterns/jest.config.js b/packages/@aws-cdk/aws-route53-patterns/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53-patterns/package.json b/packages/@aws-cdk/aws-route53-patterns/package.json deleted file mode 100644 index 8b2d298daf4ed..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/package.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "name": "@aws-cdk/aws-route53-patterns", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS Route53 patterns", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.route53.patterns", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "route53-patterns" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Route53.Patterns", - "packageId": "Amazon.CDK.AWS.Route53.Patterns", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-route53-patterns", - "module": "aws_cdk.aws_route53_patterns", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-route53-patterns" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "route53", - "route53-patterns" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-route53-patterns/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-route53-patterns/rosetta/default.ts-fixture deleted file mode 100644 index e3c0d143d05a6..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack, App } from '@aws-cdk/core'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as patterns from '@aws-cdk/aws-route53-patterns'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-route53-patterns/test/bucket-website-target.test.ts b/packages/@aws-cdk/aws-route53-patterns/test/bucket-website-target.test.ts deleted file mode 100644 index 145ee1c48b5f1..0000000000000 --- a/packages/@aws-cdk/aws-route53-patterns/test/bucket-website-target.test.ts +++ /dev/null @@ -1,297 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { HostedZone } from '@aws-cdk/aws-route53'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Stack } from '@aws-cdk/core'; -import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '@aws-cdk/cx-api'; -import { HttpsRedirect } from '../lib'; - -testDeprecated('create HTTPS redirect', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); - - // WHEN - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com', 'baz.example.com'], - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - WebsiteConfiguration: { - RedirectAllRequestsTo: { - HostName: 'bar.example.com', - Protocol: 'https', - }, - }, - PublicAccessBlockConfiguration: { - BlockPublicAcls: true, - BlockPublicPolicy: true, - IgnorePublicAcls: true, - RestrictPublicBuckets: true, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { - DistributionConfig: { - Aliases: ['foo.example.com', 'baz.example.com'], - DefaultRootObject: '', - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Type: 'A', - Name: 'foo.example.com.', - HostedZoneId: 'ID', - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Type: 'AAAA', - Name: 'foo.example.com.', - HostedZoneId: 'ID', - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Type: 'A', - Name: 'baz.example.com.', - HostedZoneId: 'ID', - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Type: 'AAAA', - Name: 'baz.example.com.', - HostedZoneId: 'ID', - }); -}); - -testDeprecated('create HTTPS redirect for apex', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); - - // WHEN - new HttpsRedirect(stack, 'Redirect', { - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - WebsiteConfiguration: { - RedirectAllRequestsTo: { - HostName: 'bar.example.com', - Protocol: 'https', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Type: 'A', - Name: 'example.com.', - }); - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Type: 'AAAA', - Name: 'example.com.', - }); -}); - -testDeprecated('create HTTPS redirect with existing cert', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); - - // WHEN - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com'], - certificate: Certificate.fromCertificateArn( - stack, 'Certificate', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', - ), - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - WebsiteConfiguration: { - RedirectAllRequestsTo: { - HostName: 'bar.example.com', - Protocol: 'https', - }, - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { - DistributionConfig: { - ViewerCertificate: { - AcmCertificateArn: 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', - }, - }, - }); -}); - -test('throws when certificate in region other than us-east-1 is supplied', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); - const certificate = Certificate.fromCertificateArn( - stack, 'Certificate', 'arn:aws:acm:us-east-2:123456789012:certificate/11-3336f1-44483d-adc7-9cd375c5169d', - ); - - // WHEN / THEN - expect(() => { - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com'], - certificate, - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - }).toThrow(/The certificate must be in the us-east-1 region and the certificate you provided is in us-east-2./); -}); - -describe('Uses Certificate when @aws-cdk/aws-route53-patters:useCertificate=true', () => { - test('explicit different region', () => { - // GIVEN - const app = new App({ - context: { - [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, - }, - }); - - // WHEN - const stack = new Stack(app, 'test', { env: { region: 'us-east-2' }, crossRegionReferences: true }); - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com'], - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - // THEN - const certStack = app.node.findChild(`certificate-redirect-stack-${stack.node.addr}`) as Stack; - Template.fromStack(certStack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: 'foo.example.com', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { - DistributionConfig: { - ViewerCertificate: { - AcmCertificateArn: { - 'Fn::GetAtt': [ - 'ExportsReader8B249524', - '/cdk/exports/test/certificateredirectstackc8e2763df63c0f7e0c9afe0394e299bb731e281e8euseast1RefRedirectCertificatec8693e36481e135aa76e35c2db892ec6a33a94c7461E1B6E15A36EB7DA', - ], - }, - }, - }, - }); - }); - - test('explicit same region', () => { - // GIVEN - const app = new App({ - context: { - [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, - }, - }); - - // WHEN - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' }, crossRegionReferences: true }); - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com'], - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - // THEN - const certStack = app.node.tryFindChild(`certificate-redirect-stack-${stack.node.addr}`); - expect(certStack).toBeUndefined(); - Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: 'foo.example.com', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { - DistributionConfig: { - ViewerCertificate: { - AcmCertificateArn: { - Ref: 'RedirectRedirectCertificateB4F2F130', - }, - }, - }, - }); - }); - - test('same support stack used for multiple certificates', () => { - // GIVEN - const app = new App({ - context: { - [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, - }, - }); - - // WHEN - const stack = new Stack(app, 'test', { env: { region: 'us-east-2' }, crossRegionReferences: true }); - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com'], - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - new HttpsRedirect(stack, 'Redirect2', { - recordNames: ['foo2.example.com'], - targetDomain: 'bar2.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone2', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - // THEN - const certStack = app.node.tryFindChild(`certificate-redirect-stack-${stack.node.addr}`) as Stack; - Template.fromStack(certStack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: 'foo.example.com', - }); - Template.fromStack(certStack).hasResourceProperties('AWS::CertificateManager::Certificate', { - DomainName: 'foo2.example.com', - }); - }); - - test('unresolved region throws', () => { - // GIVEN - const app = new App({ - context: { - [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, - }, - }); - - // WHEN - const stack = new Stack(app, 'test'); - - // THEN - expect(() => { - new HttpsRedirect(stack, 'Redirect', { - recordNames: ['foo.example.com'], - targetDomain: 'bar.example.com', - zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'ID', - zoneName: 'example.com', - }), - }); - - }).toThrow(/When @aws-cdk\/aws-route53-patters:useCertificate is enabled, a region must be defined on the Stack/); - }); -}); diff --git a/packages/@aws-cdk/aws-route53-targets/.eslintrc.js b/packages/@aws-cdk/aws-route53-targets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53-targets/.gitignore b/packages/@aws-cdk/aws-route53-targets/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-route53-targets/.npmignore b/packages/@aws-cdk/aws-route53-targets/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-route53-targets/LICENSE b/packages/@aws-cdk/aws-route53-targets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-route53-targets/NOTICE b/packages/@aws-cdk/aws-route53-targets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-route53-targets/README.md b/packages/@aws-cdk/aws-route53-targets/README.md deleted file mode 100644 index 925b07048a59b..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/README.md +++ /dev/null @@ -1,189 +0,0 @@ -# Route53 Alias Record Targets for the CDK Route53 Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library contains Route53 Alias Record targets for: - -* API Gateway custom domains - - ```ts - import * as apigw from '@aws-cdk/aws-apigateway'; - - declare const zone: route53.HostedZone; - declare const restApi: apigw.LambdaRestApi; - - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.ApiGateway(restApi)), - // or - route53.RecordTarget.fromAlias(new alias.ApiGatewayDomain(domainName)), - }); - ``` - -* API Gateway V2 custom domains - - ```ts - import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; - - declare const zone: route53.HostedZone; - declare const domainName: apigwv2.DomainName; - - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.ApiGatewayv2DomainProperties(domainName.regionalDomainName, domainName.regionalHostedZoneId)), - }); - ``` - -* CloudFront distributions - - ```ts - import * as cloudfront from '@aws-cdk/aws-cloudfront'; - - declare const zone: route53.HostedZone; - declare const distribution: cloudfront.CloudFrontWebDistribution; - - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), - }); - ``` - -* ELBv2 load balancers - - ```ts - import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; - - declare const zone: route53.HostedZone; - declare const lb: elbv2.ApplicationLoadBalancer; - - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.LoadBalancerTarget(lb)), - // or - route53.RecordTarget.fromAlias(new targets.ApiGatewayDomain(domainName)), - }); - ``` - -* Classic load balancers - - ```ts - import * as elb from '@aws-cdk/aws-elasticloadbalancing'; - - declare const zone: route53.HostedZone; - declare const lb: elb.LoadBalancer; - - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.ClassicLoadBalancerTarget(lb)), - // or - route53.RecordTarget.fromAlias(new alias.ApiGatewayDomain(domainName)), - }); - ``` - -**Important:** Based on [AWS documentation](https://aws.amazon.com/de/premiumsupport/knowledge-center/alias-resource-record-set-route53-cli/), all alias record in Route 53 that points to a Elastic Load Balancer will always include *dualstack* for the DNSName to resolve IPv4/IPv6 addresses (without *dualstack* IPv6 will not resolve). - -For example, if the Amazon-provided DNS for the load balancer is `ALB-xxxxxxx.us-west-2.elb.amazonaws.com`, CDK will create alias target in Route 53 will be `dualstack.ALB-xxxxxxx.us-west-2.elb.amazonaws.com`. - -* GlobalAccelerator - - ```ts - import * as globalaccelerator from '@aws-cdk/aws-globalaccelerator'; - - declare const zone: route53.HostedZone; - declare const accelerator: globalaccelerator.Accelerator; - - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.GlobalAcceleratorTarget(accelerator)), - // or - route53.RecordTarget.fromAlias(new targets.GlobalAcceleratorDomainTarget('xyz.awsglobalaccelerator.com')), - }); - ``` - -**Important:** If you use GlobalAcceleratorDomainTarget, passing a string rather than an instance of IAccelerator, ensure that the string is a valid domain name of an existing Global Accelerator instance. -See [the documentation on DNS addressing](https://docs.aws.amazon.com/global-accelerator/latest/dg/dns-addressing-custom-domains.dns-addressing.html) with Global Accelerator for more info. - -* InterfaceVpcEndpoints - -**Important:** Based on the CFN docs for VPCEndpoints - [see here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#aws-resource-ec2-vpcendpoint-return-values) - the attributes returned for DnsEntries in CloudFormation is a combination of the hosted zone ID and the DNS name. The entries are ordered as follows: regional public DNS, zonal public DNS, private DNS, and wildcard DNS. This order is not enforced for AWS Marketplace services, and therefore this CDK construct is ONLY guaranteed to work with non-marketplace services. - - ```ts - import * as ec2 from '@aws-cdk/aws-ec2'; - - declare const zone: route53.HostedZone; - declare const interfaceVpcEndpoint: ec2.InterfaceVpcEndpoint; - - new route53.ARecord(this, "AliasRecord", { - zone, - target: route53.RecordTarget.fromAlias(new targets.InterfaceVpcEndpointTarget(interfaceVpcEndpoint)), - }); - ``` - -* S3 Bucket Website: - -**Important:** The Bucket name must strictly match the full DNS name. -See [the Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) for more info. - - ```ts - import * as s3 from '@aws-cdk/aws-s3'; - - const recordName = 'www'; - const domainName = 'example.com'; - - const bucketWebsite = new s3.Bucket(this, 'BucketWebsite', { - bucketName: [recordName, domainName].join('.'), // www.example.com - publicReadAccess: true, - websiteIndexDocument: 'index.html', - }); - - const zone = route53.HostedZone.fromLookup(this, 'Zone', {domainName}); // example.com - - new route53.ARecord(this, 'AliasRecord', { - zone, - recordName, // www - target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), - }); - ``` - -* User pool domain - - ```ts - import * as cognito from '@aws-cdk/aws-cognito'; - - declare const zone: route53.HostedZone; - declare const domain: cognito.UserPoolDomain; - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.UserPoolDomainTarget(domain)), - }); - ``` - -* Route 53 record - - ```ts - declare const zone: route53.HostedZone; - declare const record: route53.ARecord; - new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.Route53RecordTarget(record)), - }); - ``` - -* Elastic Beanstalk environment: - -**Important:** Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint. - -```ts -declare const zone: route53.HostedZone; -declare const ebsEnvironmentUrl: string; - -new route53.ARecord(this, 'AliasRecord', { - zone, - target: route53.RecordTarget.fromAlias(new targets.ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl)), -}); -``` - -See the documentation of `@aws-cdk/aws-route53` for more information. diff --git a/packages/@aws-cdk/aws-route53-targets/jest.config.js b/packages/@aws-cdk/aws-route53-targets/jest.config.js deleted file mode 100644 index 53d601eeeff94..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 70, - statements: 80, - } - } -}; diff --git a/packages/@aws-cdk/aws-route53-targets/package.json b/packages/@aws-cdk/aws-route53-targets/package.json deleted file mode 100644 index 3cda914f25011..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/package.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "name": "@aws-cdk/aws-route53-targets", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS Route53 Alias Targets", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.route53.targets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "route53-targets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Route53.Targets", - "packageId": "Amazon.CDK.AWS.Route53.Targets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-route53-targets", - "module": "aws_cdk.aws_route53_targets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-route53-targets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "route53" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-globalaccelerator": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-globalaccelerator": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-route53-targets/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-route53-targets/rosetta/default.ts-fixture deleted file mode 100644 index 6274dd0805499..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as targets from '@aws-cdk/aws-route53-targets'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-route53-targets/test/apigatewayv2-target.test.ts b/packages/@aws-cdk/aws-route53-targets/test/apigatewayv2-target.test.ts deleted file mode 100644 index 1d8df0eb756b7..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/test/apigatewayv2-target.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; -import * as targets from '../lib'; - -test('targets.ApiGatewayv2Domain can be used to directly reference a domain', () => { - // GIVEN - const stack = new Stack(); - const name = 'example.com'; - const cert = new acm.Certificate(stack, 'cert', { domainName: name }); - const domainName = new apigwv2.DomainName(stack, 'DN', { - domainName: name, - certificate: cert, - }); - const zone = new route53.HostedZone(stack, 'zone', { - zoneName: 'example.com', - }); - - // WHEN - new route53.ARecord(stack, 'A', { - zone, - target: route53.RecordTarget.fromAlias(new targets.ApiGatewayv2DomainProperties(domainName.regionalDomainName, domainName.regionalHostedZoneId)), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - Name: 'example.com.', - Type: 'A', - AliasTarget: { - DNSName: { - 'Fn::GetAtt': [ - 'DNFDC76583', - 'RegionalDomainName', - ], - }, - HostedZoneId: { - 'Fn::GetAtt': [ - 'DNFDC76583', - 'RegionalHostedZoneId', - ], - }, - }, - HostedZoneId: { - Ref: 'zoneEB40FF1E', - }, - }); -}); diff --git a/packages/@aws-cdk/aws-route53-targets/test/bucket-website-target.test.ts b/packages/@aws-cdk/aws-route53-targets/test/bucket-website-target.test.ts deleted file mode 100644 index 2d4e77210abdf..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/test/bucket-website-target.test.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; -import * as targets from '../lib'; - -const [recordName, zoneName] = ['foo', 'test.public']; -const bucketName = [recordName, zoneName].join('.'); - -test('use S3 bucket website as record target', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); - - const bucketWebsite = new s3.Bucket(stack, 'Bucket', { bucketName }); - - // WHEN - const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); - new route53.ARecord(zone, 'Alias', { - zone, - recordName, - target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - AliasTarget: { - DNSName: 's3-website-us-east-1.amazonaws.com', - HostedZoneId: 'Z3AQBSTGFYJSTF', - }, - }); -}); - -test('use S3 bucket website as record target (fromBucketName)', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); - - const bucketWebsite = s3.Bucket.fromBucketName(stack, 'Bucket', bucketName); - - // WHEN - const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); - new route53.ARecord(zone, 'Alias', { - zone, - recordName, - target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { - AliasTarget: { - DNSName: 's3-website-us-east-1.amazonaws.com', - HostedZoneId: 'Z3AQBSTGFYJSTF', - }, - }); -}); - -test('throws if region agnostic', () => { - // GIVEN - const stack = new Stack(); - - const bucketWebsite = new s3.Bucket(stack, 'Bucket', { bucketName }); - - // WHEN - const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); - - // THEN - expect(() => { - new route53.ARecord(zone, 'Alias', { - zone, - recordName, - target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), - }); - }).toThrow(/Cannot use an S3 record alias in region-agnostic stacks/); -}); - -test('throws if bucket website hosting is unavailable (cn-north-1)', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'test', { env: { region: 'cn-north-1' } }); - - const bucketWebsite = new s3.Bucket(stack, 'Bucket'); - - // WHEN - const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); - - // THEN - expect(() => { - new route53.ARecord(zone, 'Alias', { - zone, - recordName, - target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), - }); - }).toThrow(/Bucket website target is not supported/); -}); diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.ts b/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.ts deleted file mode 100644 index 2d1b5d268e4df..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.alb-alias-target.ts +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env node -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-elbv2-integ'); - -const vpc = new ec2.Vpc(stack, 'VPC', { - maxAzs: 2, -}); - -const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { - vpc, - internetFacing: true, -}); - -const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); - -new route53.ARecord(zone, 'Alias', { - zone, - recordName: '_foo', - target: route53.RecordTarget.fromAlias(new targets.LoadBalancerTarget(lb)), -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts b/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts deleted file mode 100644 index 74248a38de6b7..0000000000000 --- a/packages/@aws-cdk/aws-route53-targets/test/integ.cloudfront-alias-target.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as targets from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); - -const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); - -const sourceBucket = new s3.Bucket(stack, 'Bucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -const distribution = new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { - originConfigs: [ - { - s3OriginSource: { - s3BucketSource: sourceBucket, - }, - behaviors: [{ isDefaultBehavior: true }], - }, - ], -}); - -new route53.ARecord(zone, 'Alias', { - zone, - recordName: '_foo', - target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-route53/.eslintrc.js b/packages/@aws-cdk/aws-route53/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-route53/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53/.gitignore b/packages/@aws-cdk/aws-route53/.gitignore deleted file mode 100644 index e025f81c8fde3..0000000000000 --- a/packages/@aws-cdk/aws-route53/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -*.generated.ts -dist -tsconfig.json -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-route53/.npmignore b/packages/@aws-cdk/aws-route53/.npmignore deleted file mode 100644 index 3c1ceb7605a65..0000000000000 --- a/packages/@aws-cdk/aws-route53/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -jest.config.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-route53/LICENSE b/packages/@aws-cdk/aws-route53/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-route53/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-route53/NOTICE b/packages/@aws-cdk/aws-route53/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-route53/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-route53/README.md b/packages/@aws-cdk/aws-route53/README.md deleted file mode 100644 index e8b9acaa30793..0000000000000 --- a/packages/@aws-cdk/aws-route53/README.md +++ /dev/null @@ -1,303 +0,0 @@ -# Amazon Route53 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -To add a public hosted zone: - -```ts -new route53.PublicHostedZone(this, 'HostedZone', { - zoneName: 'fully.qualified.domain.com', -}); -``` - -To add a private hosted zone, use `PrivateHostedZone`. Note that -`enableDnsHostnames` and `enableDnsSupport` must have been enabled for the -VPC you're configuring for private hosted zones. - -```ts -declare const vpc: ec2.Vpc; - -const zone = new route53.PrivateHostedZone(this, 'HostedZone', { - zoneName: 'fully.qualified.domain.com', - vpc, // At least one VPC has to be added to a Private Hosted Zone. -}); -``` - -Additional VPCs can be added with `zone.addVpc()`. - -## Adding Records - -To add a TXT record to your zone: - -```ts -declare const myZone: route53.HostedZone; - -new route53.TxtRecord(this, 'TXTRecord', { - zone: myZone, - recordName: '_foo', // If the name ends with a ".", it will be used as-is; - // if it ends with a "." followed by the zone name, a trailing "." will be added automatically; - // otherwise, a ".", the zone name, and a trailing "." will be added automatically. - // Defaults to zone root if not specified. - values: [ // Will be quoted for you, and " will be escaped automatically. - 'Bar!', - 'Baz?', - ], - ttl: Duration.minutes(90), // Optional - default is 30 minutes -}); -``` - -To add a NS record to your zone: - -```ts -declare const myZone: route53.HostedZone; - -new route53.NsRecord(this, 'NSRecord', { - zone: myZone, - recordName: 'foo', - values: [ - 'ns-1.awsdns.co.uk.', - 'ns-2.awsdns.com.', - ], - ttl: Duration.minutes(90), // Optional - default is 30 minutes -}); -``` - -To add a DS record to your zone: - -```ts -declare const myZone: route53.HostedZone; - -new route53.DsRecord(this, 'DSRecord', { - zone: myZone, - recordName: 'foo', - values: [ - '12345 3 1 123456789abcdef67890123456789abcdef67890', - ], - ttl: Duration.minutes(90), // Optional - default is 30 minutes -}); -``` - -To add an A record to your zone: - -```ts -declare const myZone: route53.HostedZone; - -new route53.ARecord(this, 'ARecord', { - zone: myZone, - target: route53.RecordTarget.fromIpAddresses('1.2.3.4', '5.6.7.8'), -}); -``` - -To add an A record for an EC2 instance with an Elastic IP (EIP) to your zone: - -```ts -declare const instance: ec2.Instance; - -const elasticIp = new ec2.CfnEIP(this, 'EIP', { - domain: 'vpc', - instanceId: instance.instanceId, -}); - -declare const myZone: route53.HostedZone; -new route53.ARecord(this, 'ARecord', { - zone: myZone, - target: route53.RecordTarget.fromIpAddresses(elasticIp.ref), -}); -``` - -To add an AAAA record pointing to a CloudFront distribution: - -```ts -import * as cloudfront from '@aws-cdk/aws-cloudfront'; - -declare const myZone: route53.HostedZone; -declare const distribution: cloudfront.CloudFrontWebDistribution; -new route53.AaaaRecord(this, 'Alias', { - zone: myZone, - target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), -}); -``` - -Constructs are available for A, AAAA, CAA, CNAME, MX, NS, SRV and TXT records. - -Use the `CaaAmazonRecord` construct to easily restrict certificate authorities -allowed to issue certificates for a domain to Amazon only. - -### Replacing existing record sets (dangerous!) - -Use the `deleteExisting` prop to delete an existing record set before deploying the new one. -This is useful if you want to minimize downtime and avoid "manual" actions while deploying a -stack with a record set that already exists. This is typically the case for record sets that -are not already "owned" by CloudFormation or "owned" by another stack or construct that is -going to be deleted (migration). - -> **N.B.:** this feature is dangerous, use with caution! It can only be used safely when -> `deleteExisting` is set to `true` as soon as the resource is added to the stack. Changing -> an existing Record Set's `deleteExisting` property from `false -> true` after deployment -> will delete the record! - -```ts -declare const myZone: route53.HostedZone; - -new route53.ARecord(this, 'ARecord', { - zone: myZone, - target: route53.RecordTarget.fromIpAddresses('1.2.3.4', '5.6.7.8'), - deleteExisting: true, -}); -``` - -### Cross Account Zone Delegation - -If you want to have your root domain hosted zone in one account and your subdomain hosted -zone in a diferent one, you can use `CrossAccountZoneDelegationRecord` to set up delegation -between them. - -In the account containing the parent hosted zone: - -```ts -const parentZone = new route53.PublicHostedZone(this, 'HostedZone', { - zoneName: 'someexample.com', -}); -const crossAccountRole = new iam.Role(this, 'CrossAccountRole', { - // The role name must be predictable - roleName: 'MyDelegationRole', - // The other account - assumedBy: new iam.AccountPrincipal('12345678901'), -}); -parentZone.grantDelegation(crossAccountRole); -``` - -In the account containing the child zone to be delegated: - -```ts -const subZone = new route53.PublicHostedZone(this, 'SubZone', { - zoneName: 'sub.someexample.com', -}); - -// import the delegation role by constructing the roleArn -const delegationRoleArn = Stack.of(this).formatArn({ - region: '', // IAM is global in each partition - service: 'iam', - account: 'parent-account-id', - resource: 'role', - resourceName: 'MyDelegationRole', -}); -const delegationRole = iam.Role.fromRoleArn(this, 'DelegationRole', delegationRoleArn); - -// create the record -new route53.CrossAccountZoneDelegationRecord(this, 'delegate', { - delegatedZone: subZone, - parentHostedZoneName: 'someexample.com', // or you can use parentHostedZoneId - delegationRole, -}); -``` - -## Imports - -If you don't know the ID of the Hosted Zone to import, you can use the -`HostedZone.fromLookup`: - -```ts -route53.HostedZone.fromLookup(this, 'MyZone', { - domainName: 'example.com', -}); -``` - -`HostedZone.fromLookup` requires an environment to be configured. Check -out the [documentation](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) for more documentation and examples. CDK -automatically looks into your `~/.aws/config` file for the `[default]` profile. -If you want to specify a different account run `cdk deploy --profile [profile]`. - -```text -new MyDevStack(app, 'dev', { - env: { - account: process.env.CDK_DEFAULT_ACCOUNT, - region: process.env.CDK_DEFAULT_REGION, - }, -}); -``` - -If you know the ID and Name of a Hosted Zone, you can import it directly: - -```ts -const zone = route53.HostedZone.fromHostedZoneAttributes(this, 'MyZone', { - zoneName: 'example.com', - hostedZoneId: 'ZOJJZC49E0EPZ', -}); -``` - -Alternatively, use the `HostedZone.fromHostedZoneId` to import hosted zones if -you know the ID and the retrieval for the `zoneName` is undesirable. - -```ts -const zone = route53.HostedZone.fromHostedZoneId(this, 'MyZone', 'ZOJJZC49E0EPZ'); -``` - -You can import a Public Hosted Zone as well with the similar `PublicHostedZone.fromPublicHostedZoneId` and `PublicHostedZone.fromPublicHostedZoneAttributes` methods: - -```ts -const zoneFromAttributes = route53.PublicHostedZone.fromPublicHostedZoneAttributes(this, 'MyZone', { - zoneName: 'example.com', - hostedZoneId: 'ZOJJZC49E0EPZ', -}); - -// Does not know zoneName -const zoneFromId = route53.PublicHostedZone.fromPublicHostedZoneId(this, 'MyZone', 'ZOJJZC49E0EPZ'); -``` - -## VPC Endpoint Service Private DNS - -When you create a VPC endpoint service, AWS generates endpoint-specific DNS hostnames that consumers use to communicate with the service. -For example, vpce-1234-abcdev-us-east-1.vpce-svc-123345.us-east-1.vpce.amazonaws.com. -By default, your consumers access the service with that DNS name. -This can cause problems with HTTPS traffic because the DNS will not match the backend certificate: - -```console -curl: (60) SSL: no alternative certificate subject name matches target host name 'vpce-abcdefghijklmnopq-rstuvwx.vpce-svc-abcdefghijklmnopq.us-east-1.vpce.amazonaws.com' -``` - -Effectively, the endpoint appears untrustworthy. To mitigate this, clients have to create an alias for this DNS name in Route53. - -Private DNS for an endpoint service lets you configure a private DNS name so consumers can -access the service using an existing DNS name without creating this Route53 DNS alias -This DNS name can also be guaranteed to match up with the backend certificate. - -Before consumers can use the private DNS name, you must verify that you have control of the domain/subdomain. - -Assuming your account has ownership of the particular domain/subdomain, -this construct sets up the private DNS configuration on the endpoint service, -creates all the necessary Route53 entries, and verifies domain ownership. - -```ts nofixture -import { Stack } from '@aws-cdk/core'; -import { Vpc, VpcEndpointService } from '@aws-cdk/aws-ec2'; -import { NetworkLoadBalancer } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { PublicHostedZone, VpcEndpointServiceDomainName } from '@aws-cdk/aws-route53'; - -const stack = new Stack(); -const vpc = new Vpc(stack, 'VPC'); -const nlb = new NetworkLoadBalancer(stack, 'NLB', { - vpc, -}); -const vpces = new VpcEndpointService(stack, 'VPCES', { - vpcEndpointServiceLoadBalancers: [nlb], -}); -// You must use a public hosted zone so domain ownership can be verified -const zone = new PublicHostedZone(stack, 'PHZ', { - zoneName: 'aws-cdk.dev', -}); -new VpcEndpointServiceDomainName(stack, 'EndpointDomain', { - endpointService: vpces, - domainName: 'my-stuff.aws-cdk.dev', - publicHostedZone: zone, -}); -``` diff --git a/packages/@aws-cdk/aws-route53/jest.config.js b/packages/@aws-cdk/aws-route53/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-route53/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53/lib/util.ts b/packages/@aws-cdk/aws-route53/lib/util.ts deleted file mode 100644 index 285a5d46b3646..0000000000000 --- a/packages/@aws-cdk/aws-route53/lib/util.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IHostedZone } from './hosted-zone-ref'; - -/** - * Validates a zone name is valid by Route53 specifc naming rules, - * and that there is no trailing dot in the name. - * - * @param zoneName the zone name to be validated. - * @returns +zoneName+ - * @throws ValidationError if the name is not valid. - */ -export function validateZoneName(zoneName: string) { - if (zoneName.endsWith('.')) { - throw new ValidationError('zone name must not end with a trailing dot'); - } - if (zoneName.length > 255) { - throw new ValidationError('zone name cannot be more than 255 bytes long'); - } - if (zoneName.split('.').find(label => label.length > 63)) { - throw new ValidationError('zone name labels cannot be more than 63 bytes long'); - } - if (!zoneName.match(/^[a-z0-9!"#$%&'()*+,/:;<=>?@[\\\]^_`{|}~.-]+$/i)) { - throw new ValidationError('zone names can only contain a-z, 0-9, -, ! " # $ % & \' ( ) * + , - / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .'); - } -} - -class ValidationError extends Error { - constructor(message: string) { - super(message); - } -} - -/** - * Route53 requires the record names are specified as fully qualified names, but this - * forces lots of redundant work on the user (repeating the zone name over and over). - * This function allows the user to be lazier and offers a nicer experience, by - * qualifying relative names appropriately: - * - * @param providedName the user-specified name of the record. - * @param zoneName the fully-qualified name of the zone the record will be created in. - * - * @returns
    - *
  • If +providedName+ ends with a +.+, use it as-is
  • - *
  • If +providedName+ ends with or equals +zoneName+, append a trailing +.+
  • - *
  • Otherwise, append +.+, +zoneName+ and a trailing +.+
  • - *
- */ -export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone): string { - if (providedName.endsWith('.')) { - return providedName; - } - - const hostedZoneName = hostedZone.zoneName.endsWith('.') - ? hostedZone.zoneName.substring(0, hostedZone.zoneName.length - 1) - : hostedZone.zoneName; - - const suffix = `.${hostedZoneName}`; - if (providedName.endsWith(suffix) || providedName === hostedZoneName) { - return `${providedName}.`; - } - - return `${providedName}${suffix}.`; -} - -export function makeHostedZoneArn(construct: Construct, hostedZoneId: string): string { - return Stack.of(construct).formatArn({ - account: '', - region: '', - service: 'route53', - resource: 'hostedzone', - resourceName: hostedZoneId, - }); -} diff --git a/packages/@aws-cdk/aws-route53/package.json b/packages/@aws-cdk/aws-route53/package.json deleted file mode 100644 index ee825a123eb31..0000000000000 --- a/packages/@aws-cdk/aws-route53/package.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "name": "@aws-cdk/aws-route53", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Route53", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.route53", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "route53" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Route53", - "packageId": "Amazon.CDK.AWS.Route53", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-route53", - "module": "aws_cdk.aws_route53", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-route53" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Route53", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "route53" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-route53.ZoneDelegationRecordProps", - "props-physical-name:@aws-cdk/aws-route53.ARecordProps", - "props-physical-name:@aws-cdk/aws-route53.CaaAmazonRecordProps", - "props-physical-name:@aws-cdk/aws-route53.CaaRecordProps", - "props-physical-name:@aws-cdk/aws-route53.CnameRecordProps", - "props-physical-name:@aws-cdk/aws-route53.DsRecordProps", - "props-physical-name:@aws-cdk/aws-route53.HostedZoneProps", - "props-physical-name:@aws-cdk/aws-route53.MxRecordProps", - "props-physical-name:@aws-cdk/aws-route53.NsRecordProps", - "props-physical-name:@aws-cdk/aws-route53.PrivateHostedZoneProps", - "props-physical-name:@aws-cdk/aws-route53.PublicHostedZoneProps", - "props-physical-name:@aws-cdk/aws-route53.RecordSetProps", - "props-physical-name:@aws-cdk/aws-route53.SrvRecordProps", - "props-physical-name:@aws-cdk/aws-route53.TxtRecordProps", - "props-physical-name:@aws-cdk/aws-route53.AaaaRecordProps" - ] - }, - "stability": "stable", - "nyc": { - "statements": 60, - "lines": 60, - "branches": 60 - }, - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-route53/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-route53/rosetta/default.ts-fixture deleted file mode 100644 index 6473005fda521..0000000000000 --- a/packages/@aws-cdk/aws-route53/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as targets from '@aws-cdk/aws-route53-targets'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.d.ts b/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.d.ts deleted file mode 100644 index 7fa040ea49e70..0000000000000 --- a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise<{ - PhysicalResourceId: string; -} | undefined>; diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.js b/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.js deleted file mode 100644 index 756818637b4d6..0000000000000 --- a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -const aws_sdk_1 = require("aws-sdk"); // eslint-disable-line import/no-extraneous-dependencies -async function handler(event) { - const resourceProps = event.ResourceProperties; - // Only delete the existing record when the new one gets created - if (event.RequestType !== 'Create') { - return; - } - const route53 = new aws_sdk_1.Route53({ apiVersion: '2013-04-01' }); - const listResourceRecordSets = await route53.listResourceRecordSets({ - HostedZoneId: resourceProps.HostedZoneId, - StartRecordName: resourceProps.RecordName, - StartRecordType: resourceProps.RecordType, - }).promise(); - const existingRecord = listResourceRecordSets.ResourceRecordSets - .find(r => r.Name === resourceProps.RecordName && r.Type === resourceProps.RecordType); - if (!existingRecord) { - // There is no existing record, we can safely return - return; - } - const changeResourceRecordSets = await route53.changeResourceRecordSets({ - HostedZoneId: resourceProps.HostedZoneId, - ChangeBatch: { - Changes: [{ - Action: 'DELETE', - ResourceRecordSet: removeUndefinedAndEmpty({ - Name: existingRecord.Name, - Type: existingRecord.Type, - TTL: existingRecord.TTL, - AliasTarget: existingRecord.AliasTarget, - ResourceRecords: existingRecord.ResourceRecords, - }), - }], - }, - }).promise(); - await route53.waitFor('resourceRecordSetsChanged', { Id: changeResourceRecordSets.ChangeInfo.Id }).promise(); - return { - PhysicalResourceId: `${existingRecord.Name}-${existingRecord.Type}`, - }; -} -exports.handler = handler; -// https://github.com/aws/aws-sdk-js/issues/3411 -// https://github.com/aws/aws-sdk-js/issues/3506 -function removeUndefinedAndEmpty(obj) { - const ret = {}; - for (const [k, v] of Object.entries(obj)) { - if (v && (!Array.isArray(v) || v.length !== 0)) { - ret[k] = v; - } - } - return ret; -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbm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gfSxcbiAgfSkucHJvbWlzZSgpO1xuXG4gIGF3YWl0IHJvdXRlNTMud2FpdEZvcigncmVzb3VyY2VSZWNvcmRTZXRzQ2hhbmdlZCcsIHsgSWQ6IGNoYW5nZVJlc291cmNlUmVjb3JkU2V0cy5DaGFuZ2VJbmZvLklkIH0pLnByb21pc2UoKTtcblxuICByZXR1cm4ge1xuICAgIFBoeXNpY2FsUmVzb3VyY2VJZDogYCR7ZXhpc3RpbmdSZWNvcmQuTmFtZX0tJHtleGlzdGluZ1JlY29yZC5UeXBlfWAsXG4gIH07XG59XG5cbi8vIGh0dHBzOi8vZ2l0aHViLmNvbS9hd3MvYXdzLXNkay1qcy9pc3N1ZXMvMzQxMVxuLy8gaHR0cHM6Ly9naXRodWIuY29tL2F3cy9hd3Mtc2RrLWpzL2lzc3Vlcy8zNTA2XG5mdW5jdGlvbiByZW1vdmVVbmRlZmluZWRBbmRFbXB0eTxUIGV4dGVuZHMgeyBba2V5OiBzdHJpbmddOiB1bmtub3duIH0+KG9iajogVCk6IFQge1xuICBjb25zdCByZXQ6IHsgW2tleTogc3RyaW5nXTogYW55IH0gPSB7fTtcblxuICBmb3IgKGNvbnN0IFtrLCB2XSBvZiBPYmplY3QuZW50cmllcyhvYmopKSB7XG4gICAgaWYgKHYgJiYgKCFBcnJheS5pc0FycmF5KHYpIHx8IHYubGVuZ3RoICE9PSAwKSkge1xuICAgICAgcmV0W2tdID0gdjtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gcmV0IGFzIFQ7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/util.test.ts b/packages/@aws-cdk/aws-route53/test/util.test.ts deleted file mode 100644 index 3f791d1a5bb63..0000000000000 --- a/packages/@aws-cdk/aws-route53/test/util.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { HostedZone } from '../lib'; -import * as util from '../lib/util'; - -describe('util', () => { - test('throws when zone name ending with a \'.\'', () => { - expect(() => util.validateZoneName('zone.name.')).toThrow(/trailing dot/); - }); - - test('accepts a valid domain name', () => { - const domainName = 'amazonaws.com'; - util.validateZoneName(domainName); - }); - - test('providedName ending with a dot returns the name', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const providedName = 'test.domain.com.'; - const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'fakeId', - zoneName: 'ignored', - })); - - // THEN - expect(qualified).toEqual('test.domain.com.'); - }); - - test('providedName that matches zoneName returns providedName with a trailing dot', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const providedName = 'test.domain.com'; - const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'fakeId', - zoneName: 'test.domain.com.', - })); - - // THEN - expect(qualified).toEqual('test.domain.com.'); - }); - - test('providedName that ends with zoneName returns providedName with a trailing dot', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const providedName = 'test.domain.com'; - const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'fakeId', - zoneName: 'domain.com.', - })); - - // THEN - expect(qualified).toEqual('test.domain.com.'); - }); - - test('providedName that does not match zoneName concatenates providedName and zoneName', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const providedName = 'test'; - const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { - hostedZoneId: 'fakeId', - zoneName: 'domain.com.', - })); - - // THEN - expect(qualified).toEqual('test.domain.com.'); - }); -}); diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/.eslintrc.js b/packages/@aws-cdk/aws-route53recoverycontrol/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/.gitignore b/packages/@aws-cdk/aws-route53recoverycontrol/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/.npmignore b/packages/@aws-cdk/aws-route53recoverycontrol/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/LICENSE b/packages/@aws-cdk/aws-route53recoverycontrol/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/NOTICE b/packages/@aws-cdk/aws-route53recoverycontrol/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/README.md b/packages/@aws-cdk/aws-route53recoverycontrol/README.md deleted file mode 100644 index 53277a97e44c6..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Route53RecoveryControl Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as route53recoverycontrol from '@aws-cdk/aws-route53recoverycontrol'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Route53RecoveryControl construct libraries](https://constructs.dev/search?q=route53recoverycontrol) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Route53RecoveryControl resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryControl.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Route53RecoveryControl](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryControl.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/jest.config.js b/packages/@aws-cdk/aws-route53recoverycontrol/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/lib/index.ts b/packages/@aws-cdk/aws-route53recoverycontrol/lib/index.ts deleted file mode 100644 index ca032e47c0b98..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Route53RecoveryControl CloudFormation Resources: -export * from './route53recoverycontrol.generated'; diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/package.json b/packages/@aws-cdk/aws-route53recoverycontrol/package.json deleted file mode 100644 index e4090466dc0df..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-route53recoverycontrol", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Route53RecoveryControl", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Route53RecoveryControl", - "packageId": "Amazon.CDK.AWS.Route53RecoveryControl", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.route53recoverycontrol", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "route53recoverycontrol" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-route53recoverycontrol", - "module": "aws_cdk.aws_route53recoverycontrol" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-route53recoverycontrol" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Route53RecoveryControl", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Route53RecoveryControl", - "aws-route53recoverycontrol" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-route53recoverycontrol/test/route53recoverycontrol.test.ts b/packages/@aws-cdk/aws-route53recoverycontrol/test/route53recoverycontrol.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-route53recoverycontrol/test/route53recoverycontrol.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/.eslintrc.js b/packages/@aws-cdk/aws-route53recoveryreadiness/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/.gitignore b/packages/@aws-cdk/aws-route53recoveryreadiness/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/.npmignore b/packages/@aws-cdk/aws-route53recoveryreadiness/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/LICENSE b/packages/@aws-cdk/aws-route53recoveryreadiness/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/NOTICE b/packages/@aws-cdk/aws-route53recoveryreadiness/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/README.md b/packages/@aws-cdk/aws-route53recoveryreadiness/README.md deleted file mode 100644 index d2c8514896ed9..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Route53RecoveryReadiness Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as route53recoveryreadiness from '@aws-cdk/aws-route53recoveryreadiness'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Route53RecoveryReadiness construct libraries](https://constructs.dev/search?q=route53recoveryreadiness) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Route53RecoveryReadiness resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryReadiness.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Route53RecoveryReadiness](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryReadiness.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/jest.config.js b/packages/@aws-cdk/aws-route53recoveryreadiness/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/lib/index.ts b/packages/@aws-cdk/aws-route53recoveryreadiness/lib/index.ts deleted file mode 100644 index 92d4e5587a6c6..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Route53RecoveryReadiness CloudFormation Resources: -export * from './route53recoveryreadiness.generated'; diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/package.json b/packages/@aws-cdk/aws-route53recoveryreadiness/package.json deleted file mode 100644 index 65e35c41182eb..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-route53recoveryreadiness", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Route53RecoveryReadiness", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Route53RecoveryReadiness", - "packageId": "Amazon.CDK.AWS.Route53RecoveryReadiness", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.route53recoveryreadiness", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "route53recoveryreadiness" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-route53recoveryreadiness", - "module": "aws_cdk.aws_route53recoveryreadiness" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-route53recoveryreadiness" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Route53RecoveryReadiness", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Route53RecoveryReadiness", - "aws-route53recoveryreadiness" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-route53recoveryreadiness/test/route53recoveryreadiness.test.ts b/packages/@aws-cdk/aws-route53recoveryreadiness/test/route53recoveryreadiness.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-route53recoveryreadiness/test/route53recoveryreadiness.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-route53resolver/.eslintrc.js b/packages/@aws-cdk/aws-route53resolver/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-route53resolver/.eslintrc.js +++ b/packages/@aws-cdk/aws-route53resolver/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-route53resolver/.gitignore b/packages/@aws-cdk/aws-route53resolver/.gitignore index 557ed6adc3f75..78ecf3c609e39 100644 --- a/packages/@aws-cdk/aws-route53resolver/.gitignore +++ b/packages/@aws-cdk/aws-route53resolver/.gitignore @@ -19,3 +19,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-route53resolver/README.md b/packages/@aws-cdk/aws-route53resolver/README.md index b4cef6765d7bf..a618804d1a403 100644 --- a/packages/@aws-cdk/aws-route53resolver/README.md +++ b/packages/@aws-cdk/aws-route53resolver/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -110,7 +104,7 @@ ruleGroup.addRule({ Use `associate()` to associate a rule group with a VPC: ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; declare const ruleGroup: route53resolver.FirewallRuleGroup; declare const myVpc: ec2.Vpc; diff --git a/packages/@aws-cdk/aws-route53resolver/lib/firewall-domain-list.ts b/packages/@aws-cdk/aws-route53resolver/lib/firewall-domain-list.ts index 80f211ab07f66..7ee514343f621 100644 --- a/packages/@aws-cdk/aws-route53resolver/lib/firewall-domain-list.ts +++ b/packages/@aws-cdk/aws-route53resolver/lib/firewall-domain-list.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { IBucket } from '@aws-cdk/aws-s3'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { IResource, Resource, Token } from '@aws-cdk/core'; +import { IBucket } from 'aws-cdk-lib/aws-s3'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; +import { IResource, Resource, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnFirewallDomainList } from './route53resolver.generated'; +import { CfnFirewallDomainList } from 'aws-cdk-lib/aws-route53resolver'; /** * A Firewall Domain List diff --git a/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group-association.ts b/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group-association.ts index 10281eba1dda1..62dbf3192bdcf 100644 --- a/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group-association.ts +++ b/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group-association.ts @@ -1,8 +1,8 @@ -import { IVpc } from '@aws-cdk/aws-ec2'; -import { Resource, Token } from '@aws-cdk/core'; +import { IVpc } from 'aws-cdk-lib/aws-ec2'; +import { Resource, Token } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IFirewallRuleGroup } from './firewall-rule-group'; -import { CfnFirewallRuleGroupAssociation } from './route53resolver.generated'; +import { CfnFirewallRuleGroupAssociation } from 'aws-cdk-lib/aws-route53resolver'; /** * Options for a Firewall Rule Group Association diff --git a/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group.ts b/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group.ts index 4346e23e46435..85b7245888a4d 100644 --- a/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group.ts +++ b/packages/@aws-cdk/aws-route53resolver/lib/firewall-rule-group.ts @@ -1,8 +1,8 @@ -import { Duration, IResource, Lazy, Resource } from '@aws-cdk/core'; +import { Duration, IResource, Lazy, Resource } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IFirewallDomainList } from './firewall-domain-list'; import { FirewallRuleGroupAssociation, FirewallRuleGroupAssociationOptions } from './firewall-rule-group-association'; -import { CfnFirewallRuleGroup } from './route53resolver.generated'; +import { CfnFirewallRuleGroup } from 'aws-cdk-lib/aws-route53resolver'; /** * A Firewall Rule Group diff --git a/packages/@aws-cdk/aws-route53resolver/lib/index.ts b/packages/@aws-cdk/aws-route53resolver/lib/index.ts index 97baf0759d24a..2d47b57f5906d 100644 --- a/packages/@aws-cdk/aws-route53resolver/lib/index.ts +++ b/packages/@aws-cdk/aws-route53resolver/lib/index.ts @@ -3,4 +3,3 @@ export * from './firewall-rule-group'; export * from './firewall-rule-group-association'; // AWS::Route53Resolver CloudFormation Resources: -export * from './route53resolver.generated'; diff --git a/packages/@aws-cdk/aws-route53resolver/package.json b/packages/@aws-cdk/aws-route53resolver/package.json index 3b472bf92118b..6979aa2c10c26 100644 --- a/packages/@aws-cdk/aws-route53resolver/package.json +++ b/packages/@aws-cdk/aws-route53resolver/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-route53resolver", + "name": "@aws-cdk/aws-route53resolver-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Route53Resolver", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Route53Resolver", - "packageId": "Amazon.CDK.AWS.Route53Resolver", + "namespace": "Amazon.CDK.AWS.Route53Resolver.Alpha", + "packageId": "Amazon.CDK.AWS.Route53Resolver.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.route53resolver", + "package": "software.amazon.awscdk.services.route53resolver.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "route53resolver" + "artifactId": "route53resolver-alpha" } }, "python": { - "distName": "aws-cdk.aws-route53resolver", - "module": "aws_cdk.aws_route53resolver", + "distName": "aws-cdk.aws-route53resolver-alpha", + "module": "aws_cdk.aws_route53resolver_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkroute53resolveralpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "test": "cdk-test", "watch": "cdk-watch", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Route53Resolver", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -81,25 +82,17 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -109,9 +102,7 @@ "maturity": "experimental", "awslint": { "exclude": [ - "props-physical-name:@aws-cdk/aws-route53resolver.FirewallDomainListProps", - "props-physical-name:@aws-cdk/aws-route53resolver.FirewallRuleGroupProps", - "props-physical-name:@aws-cdk/aws-route53resolver.FirewallRuleGroupAssociationProps" + "*:*" ] }, "awscdkio": { @@ -119,5 +110,11 @@ }, "publishConfig": { "tag": "latest" + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-route53resolver/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-route53resolver/rosetta/default.ts-fixture index fa40ebdd01cc4..d16b9128fb2ca 100644 --- a/packages/@aws-cdk/aws-route53resolver/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-route53resolver/rosetta/default.ts-fixture @@ -1,7 +1,7 @@ // Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as route53resolver from '@aws-cdk/aws-route53resolver'; +import * as route53resolver from '@aws-cdk/aws-route53resolver-alpha'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-route53resolver/test/firewall-domain-list.test.ts b/packages/@aws-cdk/aws-route53resolver/test/firewall-domain-list.test.ts index b574403a3fbed..43783abb2e5ff 100644 --- a/packages/@aws-cdk/aws-route53resolver/test/firewall-domain-list.test.ts +++ b/packages/@aws-cdk/aws-route53resolver/test/firewall-domain-list.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { Bucket } from '@aws-cdk/aws-s3'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; +import { Stack } from 'aws-cdk-lib'; import { FirewallDomainList, FirewallDomains } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-route53resolver/test/firewall-rule-group.test.ts b/packages/@aws-cdk/aws-route53resolver/test/firewall-rule-group.test.ts index f8868d2bb31d9..12bfab2aea828 100644 --- a/packages/@aws-cdk/aws-route53resolver/test/firewall-rule-group.test.ts +++ b/packages/@aws-cdk/aws-route53resolver/test/firewall-rule-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Vpc } from '@aws-cdk/aws-ec2'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Duration, Stack } from 'aws-cdk-lib'; import { DnsBlockResponse, FirewallDomainList, FirewallRuleAction, FirewallRuleGroup, IFirewallDomainList } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-route53resolver/test/integ.firewall.ts b/packages/@aws-cdk/aws-route53resolver/test/integ.firewall.ts index 7c4b2498af6f5..e0e71164b4c27 100644 --- a/packages/@aws-cdk/aws-route53resolver/test/integ.firewall.ts +++ b/packages/@aws-cdk/aws-route53resolver/test/integ.firewall.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import { Vpc } from '@aws-cdk/aws-ec2'; -import { App, Stack, StackProps } from '@aws-cdk/core'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { App, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import * as route53resolver from '../lib'; diff --git a/packages/@aws-cdk/aws-rum/.eslintrc.js b/packages/@aws-cdk/aws-rum/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-rum/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rum/.gitignore b/packages/@aws-cdk/aws-rum/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-rum/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-rum/.npmignore b/packages/@aws-cdk/aws-rum/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-rum/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-rum/LICENSE b/packages/@aws-cdk/aws-rum/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-rum/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-rum/NOTICE b/packages/@aws-cdk/aws-rum/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-rum/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-rum/README.md b/packages/@aws-cdk/aws-rum/README.md deleted file mode 100644 index bba075a2e768d..0000000000000 --- a/packages/@aws-cdk/aws-rum/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::RUM Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as rum from '@aws-cdk/aws-rum'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for RUM construct libraries](https://constructs.dev/search?q=rum) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RUM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RUM.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RUM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RUM.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-rum/jest.config.js b/packages/@aws-cdk/aws-rum/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-rum/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-rum/lib/index.ts b/packages/@aws-cdk/aws-rum/lib/index.ts deleted file mode 100644 index 0689c0aa0f40b..0000000000000 --- a/packages/@aws-cdk/aws-rum/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::RUM CloudFormation Resources: -export * from './rum.generated'; diff --git a/packages/@aws-cdk/aws-rum/package.json b/packages/@aws-cdk/aws-rum/package.json deleted file mode 100644 index 59aec192506b1..0000000000000 --- a/packages/@aws-cdk/aws-rum/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-rum", - "version": "0.0.0", - "description": "AWS::RUM Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.RUM", - "packageId": "Amazon.CDK.AWS.RUM", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.rum", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "rum" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-rum", - "module": "aws_cdk.aws_rum" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-rum" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::RUM", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::RUM", - "aws-rum" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-rum/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-rum/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-rum/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-rum/test/rum.test.ts b/packages/@aws-cdk/aws-rum/test/rum.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-rum/test/rum.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-s3-assets/.eslintrc.js b/packages/@aws-cdk/aws-s3-assets/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3-assets/.gitignore b/packages/@aws-cdk/aws-s3-assets/.gitignore deleted file mode 100644 index b73bd4231bfff..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -dist -tsconfig.json - -.LAST_BUILD -.nyc_output -coverage - -.jsii - -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-s3-assets/.npmignore b/packages/@aws-cdk/aws-s3-assets/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-s3-assets/LICENSE b/packages/@aws-cdk/aws-s3-assets/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-s3-assets/NOTICE b/packages/@aws-cdk/aws-s3-assets/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-s3-assets/README.md b/packages/@aws-cdk/aws-s3-assets/README.md deleted file mode 100644 index d9044b045bb73..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/README.md +++ /dev/null @@ -1,193 +0,0 @@ -# AWS CDK Assets - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Assets are local files or directories which are needed by a CDK app. A common -example is a directory which contains the handler code for a Lambda function, -but assets can represent any artifact that is needed for the app's operation. - -When deploying a CDK app that includes constructs with assets, the CDK toolkit -will first upload all the assets to S3, and only then deploy the stacks. The S3 -locations of the uploaded assets will be passed in as CloudFormation Parameters -to the relevant stacks. - -The following JavaScript example defines a directory asset which is archived as -a .zip file and uploaded to S3 during deployment. - -[Example of a ZipDirectoryAsset](./test/integ.assets.directory.lit.ts) - -The following JavaScript example defines a file asset, which is uploaded as-is -to an S3 bucket during deployment. - -[Example of a FileAsset](./test/integ.assets.file.lit.ts) - -## Attributes - -`Asset` constructs expose the following deploy-time attributes: - - * `s3BucketName` - the name of the assets S3 bucket. - * `s3ObjectKey` - the S3 object key of the asset file (whether it's a file or a zip archive) - * `s3ObjectUrl` - the S3 object URL of the asset (i.e. s3://mybucket/mykey.zip) - * `httpUrl` - the S3 HTTP URL of the asset (i.e. https://s3.us-east-1.amazonaws.com/mybucket/mykey.zip) - -In the following example, the various asset attributes are exported as stack outputs: - -[Example of referencing an asset](./test/integ.assets.refs.lit.ts) - -## Permissions - -IAM roles, users or groups which need to be able to read assets in runtime will should be -granted IAM permissions. To do that use the `asset.grantRead(principal)` method: - -The following example grants an IAM group read permissions on an asset: - -[Example of granting read access to an asset](./test/integ.assets.permissions.lit.ts) - -## How does it work - -When an asset is defined in a construct, a construct metadata entry -`aws:cdk:asset` is emitted with instructions on where to find the asset and what -type of packaging to perform (`zip` or `file`). Furthermore, the synthesized -CloudFormation template will also include two CloudFormation parameters: one for -the asset's bucket and one for the asset S3 key. Those parameters are used to -reference the deploy-time values of the asset (using `{ Ref: "Param" }`). - -Then, when the stack is deployed, the toolkit will package the asset (i.e. zip -the directory), calculate an MD5 hash of the contents and will render an S3 key -for this asset within the toolkit's asset store. If the file doesn't exist in -the asset store, it is uploaded during deployment. - -> The toolkit's asset store is an S3 bucket created by the toolkit for each - environment the toolkit operates in (environment = account + region). - -Now, when the toolkit deploys the stack, it will set the relevant CloudFormation -Parameters to point to the actual bucket and key for each asset. - -## Asset Bundling - -When defining an asset, you can use the `bundling` option to specify a command -to run inside a docker container. The command can read the contents of the asset -source from `/asset-input` and is expected to write files under `/asset-output` -(directories mapped inside the container). The files under `/asset-output` will -be zipped and uploaded to S3 as the asset. - -The following example uses custom asset bundling to convert a markdown file to html: - -[Example of using asset bundling](./test/integ.assets.bundling.lit.ts). - -The bundling docker image (`image`) can either come from a registry (`DockerImage.fromRegistry`) -or it can be built from a `Dockerfile` located inside your project (`DockerImage.fromBuild`). - -You can set the `CDK_DOCKER` environment variable in order to provide a custom -docker program to execute. This may sometime be needed when building in -environments where the standard docker cannot be executed (see -https://github.com/aws/aws-cdk/issues/8460 for details). - -Use `local` to specify a local bundling provider. The provider implements a -method `tryBundle()` which should return `true` if local bundling was performed. -If `false` is returned, docker bundling will be done: - -```ts -import * as cdk from '@aws-cdk/core'; - -class MyBundle implements cdk.ILocalBundling { - public tryBundle(outputDir: string, options: cdk.BundlingOptions) { - const canRunLocally = true // replace with actual logic - if (canRunLocally) { - // perform local bundling here - return true; - } - return false; - } -} - -new Asset(this, 'BundledAsset', { - path: '/path/to/asset', - bundling: { - local: new MyBundle(), - // Docker bundling fallback - image: cdk.DockerImage.fromRegistry('alpine'), - entrypoint: ['/bin/sh', '-c'], - command: ['bundle'], - }, -}); -``` - -Although optional, it's recommended to provide a local bundling method which can -greatly improve performance. - -If the bundling output contains a single archive file (zip or jar) it will be -uploaded to S3 as-is and will not be zipped. Otherwise the contents of the -output directory will be zipped and the zip file will be uploaded to S3. This -is the default behavior for `bundling.outputType` (`BundlingOutput.AUTO_DISCOVER`). - -Use `BundlingOutput.NOT_ARCHIVED` if the bundling output must always be zipped: - -```ts -import * as cdk from '@aws-cdk/core'; - -const asset = new Asset(this, 'BundledAsset', { - path: '/path/to/asset', - bundling: { - image: cdk.DockerImage.fromRegistry('alpine'), - command: ['command-that-produces-an-archive.sh'], - outputType: cdk.BundlingOutput.NOT_ARCHIVED, // Bundling output will be zipped even though it produces a single archive file. - }, -}); -``` - -Use `BundlingOutput.ARCHIVED` if the bundling output contains a single archive file and -you don't want it to be zipped. - -### Docker options - -Depending on your build environment, you may need to pass certain docker options to the `docker run` command that bundles assets. -This can be done using [BundlingOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html) properties. - -Some optional properties to pass to the docker bundling - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -const asset = new Asset(this, 'BundledAsset', { - path: '/path/to/asset', - bundling: { - image: lambda.Runtime.PYTHON_3_9.bundlingImage, - command: [ - 'bash', '-c', - 'pip install -r requirements.txt -t /asset-output && cp -au . /asset-output' - ], - securityOpt: 'no-new-privileges:true', // https://docs.docker.com/engine/reference/commandline/run/#optional-security-options---security-opt - network: 'host', //https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network---network - }, -}); -``` - -## CloudFormation Resource Metadata - -> NOTE: This section is relevant for authors of AWS Resource Constructs. - -In certain situations, it is desirable for tools to be able to know that a certain CloudFormation -resource is using a local asset. For example, SAM CLI can be used to invoke AWS Lambda functions -locally for debugging purposes. - -To enable such use cases, external tools will consult a set of metadata entries on AWS CloudFormation -resources: - -* `aws:asset:path` points to the local path of the asset. -* `aws:asset:property` is the name of the resource property where the asset is used - -Using these two metadata entries, tools will be able to identify that assets are used -by a certain resource, and enable advanced local experiences. - -To add these metadata entries to a resource, use the -`asset.addResourceMetadata(resource, property)` method. - -See https://github.com/aws/aws-cdk/issues/1432 for more details diff --git a/packages/@aws-cdk/aws-s3-assets/jest.config.js b/packages/@aws-cdk/aws-s3-assets/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3-assets/lib/compat.ts b/packages/@aws-cdk/aws-s3-assets/lib/compat.ts deleted file mode 100644 index af080a15615a2..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/lib/compat.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { FollowMode } from '@aws-cdk/assets'; -import { SymlinkFollowMode } from '@aws-cdk/core'; - -export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined { - if (!follow) { - return undefined; - } - - switch (follow) { - case FollowMode.NEVER: return SymlinkFollowMode.NEVER; - case FollowMode.ALWAYS: return SymlinkFollowMode.ALWAYS; - case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL; - case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL; - default: - throw new Error(`unknown follow mode: ${follow}`); - } -} diff --git a/packages/@aws-cdk/aws-s3-assets/package.json b/packages/@aws-cdk/aws-s3-assets/package.json deleted file mode 100644 index c6cbf52593674..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/package.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "name": "@aws-cdk/aws-s3-assets", - "version": "0.0.0", - "private": true, - "description": "Deploy local files and directories to S3", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.s3.assets", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "s3-assets" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.S3.Assets", - "packageId": "Amazon.CDK.AWS.S3.Assets", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-s3-assets", - "module": "aws_cdk.aws_s3_assets", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-s3-assets" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "s3", - "constructs", - "assets" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awslint": { - "exclude": [ - "docs-public-apis:@aws-cdk/aws-s3-assets.AssetOptions", - "docs-public-apis:@aws-cdk/aws-s3-assets.AssetProps" - ] - }, - "awscdkio": { - "announce": false - }, - "nozem": { - "ostools": [ - "docker" - ] - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-s3-assets/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-s3-assets/rosetta/default.ts-fixture deleted file mode 100644 index b537eeb882c64..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import { Asset } from '@aws-cdk/aws-s3-assets'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-s3-assets/test/compat.test.ts b/packages/@aws-cdk/aws-s3-assets/test/compat.test.ts deleted file mode 100644 index 41fbf0b57ac53..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/compat.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { FollowMode } from '@aws-cdk/assets'; -import { SymlinkFollowMode } from '@aws-cdk/core'; -import { toSymlinkFollow } from '../lib/compat'; - -test('FollowMode compatibility', () => { - expect(toSymlinkFollow(undefined)).toBeUndefined(); - expect(toSymlinkFollow(FollowMode.ALWAYS)).toBe(SymlinkFollowMode.ALWAYS); - expect(toSymlinkFollow(FollowMode.BLOCK_EXTERNAL)).toBe(SymlinkFollowMode.BLOCK_EXTERNAL); - expect(toSymlinkFollow(FollowMode.EXTERNAL)).toBe(SymlinkFollowMode.EXTERNAL); - expect(toSymlinkFollow(FollowMode.NEVER)).toBe(SymlinkFollowMode.NEVER); -}); diff --git a/packages/@aws-cdk/aws-s3-assets/test/custom-synthesis.test.ts b/packages/@aws-cdk/aws-s3-assets/test/custom-synthesis.test.ts deleted file mode 100644 index 525db538127c6..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/custom-synthesis.test.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * This file asserts that it is possible to write a custom stacksynthesizer that will synthesize - * ONE thing to the asset manifest, while returning another thing (including tokens) to the - * CloudFormation template -- without reaching into the library internals - */ - -import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { StackSynthesizer, FileAssetSource, FileAssetLocation, DockerImageAssetSource, DockerImageAssetLocation, ISynthesisSession, App, Stack, AssetManifestBuilder, CfnParameter, CfnResource } from '@aws-cdk/core'; -import { AssetManifestArtifact } from '@aws-cdk/cx-api'; -import { Asset } from '../lib'; - -test('use custom synthesizer', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'Stack', { - synthesizer: new CustomSynthesizer(), - }); - - // WHEN - const asset = new Asset(stack, 'MyAsset', { - path: path.join(__dirname, 'file-asset.txt'), - }); - new CfnResource(stack, 'TestResource', { - type: 'CDK::TestResource', - properties: { - Bucket: asset.s3BucketName, - ObjectKey: asset.s3ObjectKey, - S3Url: asset.s3ObjectUrl, - HttpUrl: asset.httpUrl, - }, - }); - - // THEN - const assembly = app.synth(); - const stackArtifact = assembly.getStackArtifact(stack.artifactId); - const assetArtifact = stackArtifact.dependencies[0] as AssetManifestArtifact; - - const stackTemplate = Template.fromJSON(stackArtifact.template); - stackTemplate.hasResourceProperties('CDK::TestResource', { - Bucket: { 'Fn::Sub': '${BucketName}' }, - ObjectKey: '78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt', - S3Url: { 'Fn::Sub': 's3://${BucketName}/78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt' }, - HttpUrl: { 'Fn::Sub': 'https://s3.${AWS::Region}.${AWS::URLSuffix}/${BucketName}/78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt' }, - }); - - expect(assetArtifact.contents).toEqual(expect.objectContaining({ - files: expect.objectContaining({ - '78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197': { - destinations: { - 'current_account-current_region': { - bucketName: 'write-bucket', - objectKey: '78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt', - }, - }, - source: { - packaging: 'file', - path: 'asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt', - }, - }, - }), - })); -}); - -class CustomSynthesizer extends StackSynthesizer { - private readonly manifest = new AssetManifestBuilder(); - private parameter?: CfnParameter; - - override bind(stack: Stack) { - super.bind(stack); - - this.parameter = new CfnParameter(stack, 'BucketName'); - } - - addFileAsset(asset: FileAssetSource): FileAssetLocation { - const dest = this.manifest.defaultAddFileAsset(this.boundStack, asset, { - bucketName: 'write-bucket', - }); - return this.cloudFormationLocationFromFileAsset({ - ...dest, - bucketName: ['${', this.parameter!.logicalId, '}'].join(''), - }); - } - - addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation { - void(asset); - throw new Error('Docker images are not supported here'); - } - - synthesize(session: ISynthesisSession): void { - const templateAsset = this.addFileAsset(this.synthesizeTemplate(session)); - const assetManifestId = this.manifest.emitManifest(this.boundStack, session); - - this.emitArtifact(session, { - stackTemplateAssetObjectUrl: templateAsset.s3ObjectUrlWithPlaceholders, - additionalDependencies: [assetManifestId], - }); - } -} diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts deleted file mode 100644 index a62554bab726a..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.bundling.lit.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, DockerImage, Stack, StackProps } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as assets from '../lib'; - -class TestStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - /// !show - const asset = new assets.Asset(this, 'BundledAsset', { - path: path.join(__dirname, 'markdown-asset'), // /asset-input and working directory in the container - bundling: { - image: DockerImage.fromBuild(path.join(__dirname, 'alpine-markdown')), // Build an image - command: [ - 'sh', '-c', ` - markdown index.md > /asset-output/index.html - `, - ], - }, - }); - /// !hide - - const user = new iam.User(this, 'MyUser'); - asset.grantRead(user); - } -} - -const app = new App(); -new TestStack(app, 'cdk-integ-assets-bundling'); -app.synth(); diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts deleted file mode 100644 index e0470ea814e92..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.directory.lit.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as assets from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /// !show - const asset = new assets.Asset(this, 'SampleAsset', { - path: path.join(__dirname, 'sample-asset-directory'), - }); - /// !hide - - const user = new iam.User(this, 'MyUser'); - asset.grantRead(user); - } -} - -const app = new cdk.App(); -new TestStack(app, 'aws-cdk-asset-test'); -app.synth(); diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts deleted file mode 100644 index 7e9c8544bac21..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.file.lit.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as assets from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /// !show - const asset = new assets.Asset(this, 'SampleAsset', { - path: path.join(__dirname, 'file-asset.txt'), - }); - /// !hide - - const user = new iam.User(this, 'MyUser'); - asset.grantRead(user); - } -} - -const app = new cdk.App(); -new TestStack(app, 'aws-cdk-asset-file-test'); -app.synth(); diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts deleted file mode 100644 index 3432cf744fbb0..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.permissions.lit.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as assets from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - const asset = new assets.Asset(this, 'MyFile', { - path: path.join(__dirname, 'file-asset.txt'), - }); - - /// !show - const group = new iam.Group(this, 'MyUserGroup'); - asset.grantRead(group); - /// !hide - } -} - -const app = new cdk.App(); -new TestStack(app, 'aws-cdk-asset-refs'); -app.synth(); diff --git a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts b/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts deleted file mode 100644 index df5e43865e307..0000000000000 --- a/packages/@aws-cdk/aws-s3-assets/test/integ.assets.refs.lit.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as assets from '../lib'; - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /// !show - const asset = new assets.Asset(this, 'SampleAsset', { - path: path.join(__dirname, 'sample-asset-directory'), - }); - - new cdk.CfnOutput(this, 'S3BucketName', { value: asset.s3BucketName }); - new cdk.CfnOutput(this, 'S3ObjectKey', { value: asset.s3ObjectKey }); - new cdk.CfnOutput(this, 'S3HttpURL', { value: asset.httpUrl }); - new cdk.CfnOutput(this, 'S3ObjectURL', { value: asset.s3ObjectUrl }); - /// !hide - - // we need at least one resource - asset.grantRead(new iam.User(this, 'MyUser')); - } -} - -const app = new cdk.App(); -new TestStack(app, 'aws-cdk-asset-refs'); -app.synth(); diff --git a/packages/@aws-cdk/aws-s3-deployment/.eslintrc.js b/packages/@aws-cdk/aws-s3-deployment/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3-deployment/.gitignore b/packages/@aws-cdk/aws-s3-deployment/.gitignore deleted file mode 100644 index 4ad0691ca6cbe..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -lambda/bundle.zip - -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii -lib/*.zip - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE - -*.snk -!.eslintrc.js - -!jest.config.js -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-s3-deployment/.npmignore b/packages/@aws-cdk/aws-s3-deployment/.npmignore deleted file mode 100644 index 6099f6799cd5d..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -lambda/test -lambda/*.sh -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -jest.config.js -# exclude cdk artifacts -**/cdk.out - -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-s3-deployment/LICENSE b/packages/@aws-cdk/aws-s3-deployment/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-s3-deployment/NOTICE b/packages/@aws-cdk/aws-s3-deployment/NOTICE deleted file mode 100644 index 096ec7d8eb081..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/NOTICE +++ /dev/null @@ -1,32 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** case - https://www.npmjs.com/package/case -Copyright (c) 2013 Nathan Bubna - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - ----------------- diff --git a/packages/@aws-cdk/aws-s3-deployment/README.md b/packages/@aws-cdk/aws-s3-deployment/README.md deleted file mode 100644 index 9cad6df9e5515..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/README.md +++ /dev/null @@ -1,395 +0,0 @@ -# AWS S3 Deployment Construct Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library allows populating an S3 bucket with the contents of .zip files -from other S3 buckets or from local disk. - -The following example defines a publicly accessible S3 bucket with web hosting -enabled and populates it from a local directory on disk. - -```ts -const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', { - websiteIndexDocument: 'index.html', - publicReadAccess: true, -}); - -new s3deploy.BucketDeployment(this, 'DeployWebsite', { - sources: [s3deploy.Source.asset('./website-dist')], - destinationBucket: websiteBucket, - destinationKeyPrefix: 'web/static', // optional prefix in destination bucket -}); -``` - -This is what happens under the hood: - -1. When this stack is deployed (either via `cdk deploy` or via CI/CD), the - contents of the local `website-dist` directory will be archived and uploaded - to an intermediary assets bucket. If there is more than one source, they will - be individually uploaded. -2. The `BucketDeployment` construct synthesizes a custom CloudFormation resource - of type `Custom::CDKBucketDeployment` into the template. The source bucket/key - is set to point to the assets bucket. -3. The custom resource downloads the .zip archive, extracts it and issues `aws - s3 sync --delete` against the destination bucket (in this case - `websiteBucket`). If there is more than one source, the sources will be - downloaded and merged pre-deployment at this step. - -If you are referencing the filled bucket in another construct that depends on -the files already be there, be sure to use `deployment.deployedBucket`. This -will ensure the bucket deployment has finished before the resource that uses -the bucket is created: - -```ts -declare const websiteBucket: s3.Bucket; - -const deployment = new s3deploy.BucketDeployment(this, 'DeployWebsite', { - sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], - destinationBucket: websiteBucket, -}); - -new ConstructThatReadsFromTheBucket(this, 'Consumer', { - // Use 'deployment.deployedBucket' instead of 'websiteBucket' here - bucket: deployment.deployedBucket, -}); -``` - -It is also possible to add additional sources using the `addSource` method. - -```ts -declare const websiteBucket: s3.IBucket; - -const deployment = new s3deploy.BucketDeployment(this, 'DeployWebsite', { - sources: [s3deploy.Source.asset('./website-dist')], - destinationBucket: websiteBucket, - destinationKeyPrefix: 'web/static', // optional prefix in destination bucket -}); - -deployment.addSource(s3deploy.Source.asset('./another-asset')); -``` - -## Supported sources - -The following source types are supported for bucket deployments: - -- Local .zip file: `s3deploy.Source.asset('/path/to/local/file.zip')` -- Local directory: `s3deploy.Source.asset('/path/to/local/directory')` -- Another bucket: `s3deploy.Source.bucket(bucket, zipObjectKey)` -- String data: `s3deploy.Source.data('object-key.txt', 'hello, world!')` - (supports [deploy-time values](#data-with-deploy-time-values)) -- JSON data: `s3deploy.Source.jsonData('object-key.json', { json: 'object' })` - (supports [deploy-time values](#data-with-deploy-time-values)) -- YAML data: `s3deploy.Source.yamlData('object-key.yaml', { yaml: 'object' })` - (supports [deploy-time values](#data-with-deploy-time-values)) - -To create a source from a single file, you can pass `AssetOptions` to exclude -all but a single file: - -- Single file: `s3deploy.Source.asset('/path/to/local/directory', { exclude: ['**', '!onlyThisFile.txt'] })` - -**IMPORTANT** The `aws-s3-deployment` module is only intended to be used with -zip files from trusted sources. Directories bundled by the CDK CLI (by using -`Source.asset()` on a directory) are safe. If you are using `Source.asset()` or -`Source.bucket()` to reference an existing zip file, make sure you trust the -file you are referencing. Zips from untrusted sources might be able to execute -arbitrary code in the Lambda Function used by this module, and use its permissions -to read or write unexpected files in the S3 bucket. - -## Retain on Delete - -By default, the contents of the destination bucket will **not** be deleted when the -`BucketDeployment` resource is removed from the stack or when the destination is -changed. You can use the option `retainOnDelete: false` to disable this behavior, -in which case the contents will be deleted. - -Configuring this has a few implications you should be aware of: - -- **Logical ID Changes** - - Changing the logical ID of the `BucketDeployment` construct, without changing the destination - (for example due to refactoring, or intentional ID change) **will result in the deletion of the objects**. - This is because CloudFormation will first create the new resource, which will have no affect, - followed by a deletion of the old resource, which will cause a deletion of the objects, - since the destination hasn't changed, and `retainOnDelete` is `false`. - -- **Destination Changes** - - When the destination bucket or prefix is changed, all files in the previous destination will **first** be - deleted and then uploaded to the new destination location. This could have availability implications - on your users. - -### General Recommendations - -#### Shared Bucket - -If the destination bucket **is not** dedicated to the specific `BucketDeployment` construct (i.e shared by other entities), -we recommend to always configure the `destinationKeyPrefix` property. This will prevent the deployment from -accidentally deleting data that wasn't uploaded by it. - -#### Dedicated Bucket - -If the destination bucket **is** dedicated, it might be reasonable to skip the prefix configuration, -in which case, we recommend to remove `retainOnDelete: false`, and instead, configure the -[`autoDeleteObjects`](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-readme.html#bucket-deletion) -property on the destination bucket. This will avoid the logical ID problem mentioned above. - -## Prune - -By default, files in the destination bucket that don't exist in the source will be deleted -when the `BucketDeployment` resource is created or updated. You can use the option `prune: false` to disable -this behavior, in which case the files will not be deleted. - -```ts -declare const destinationBucket: s3.Bucket; -new s3deploy.BucketDeployment(this, 'DeployMeWithoutDeletingFilesOnDestination', { - sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], - destinationBucket, - prune: false, -}); -``` - -This option also enables you to -multiple bucket deployments for the same destination bucket & prefix, -each with its own characteristics. For example, you can set different cache-control headers -based on file extensions: - -```ts -declare const destinationBucket: s3.Bucket; -new s3deploy.BucketDeployment(this, 'BucketDeployment', { - sources: [s3deploy.Source.asset('./website', { exclude: ['index.html'] })], - destinationBucket, - cacheControl: [s3deploy.CacheControl.fromString('max-age=31536000,public,immutable')], - prune: false, -}); - -new s3deploy.BucketDeployment(this, 'HTMLBucketDeployment', { - sources: [s3deploy.Source.asset('./website', { exclude: ['*', '!index.html'] })], - destinationBucket, - cacheControl: [s3deploy.CacheControl.fromString('max-age=0,no-cache,no-store,must-revalidate')], - prune: false, -}); -``` - -## Exclude and Include Filters - -There are two points at which filters are evaluated in a deployment: asset bundling and the actual deployment. If you simply want to exclude files in the asset bundling process, you should leverage the `exclude` property of `AssetOptions` when defining your source: - -```ts -declare const destinationBucket: s3.Bucket; -new s3deploy.BucketDeployment(this, 'HTMLBucketDeployment', { - sources: [s3deploy.Source.asset('./website', { exclude: ['*', '!index.html'] })], - destinationBucket, -}); -``` - -If you want to specify filters to be used in the deployment process, you can use the `exclude` and `include` filters on `BucketDeployment`. If excluded, these files will not be deployed to the destination bucket. In addition, if the file already exists in the destination bucket, it will not be deleted if you are using the `prune` option: - -```ts -declare const destinationBucket: s3.Bucket; -new s3deploy.BucketDeployment(this, 'DeployButExcludeSpecificFiles', { - sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], - destinationBucket, - exclude: ['*.txt'], -}); -``` - -These filters follow the same format that is used for the AWS CLI. See the CLI documentation for information on [Using Include and Exclude Filters](https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters). - -## Objects metadata - -You can specify metadata to be set on all the objects in your deployment. -There are 2 types of metadata in S3: system-defined metadata and user-defined metadata. -System-defined metadata have a special purpose, for example cache-control defines how long to keep an object cached. -User-defined metadata are not used by S3 and keys always begin with `x-amz-meta-` (this prefix is added automatically). - -System defined metadata keys include the following: - -- cache-control (`--cache-control` in `aws s3 sync`) -- content-disposition (`--content-disposition` in `aws s3 sync`) -- content-encoding (`--content-encoding` in `aws s3 sync`) -- content-language (`--content-language` in `aws s3 sync`) -- content-type (`--content-type` in `aws s3 sync`) -- expires (`--expires` in `aws s3 sync`) -- x-amz-storage-class (`--storage-class` in `aws s3 sync`) -- x-amz-website-redirect-location (`--website-redirect` in `aws s3 sync`) -- x-amz-server-side-encryption (`--sse` in `aws s3 sync`) -- x-amz-server-side-encryption-aws-kms-key-id (`--sse-kms-key-id` in `aws s3 sync`) -- x-amz-server-side-encryption-customer-algorithm (`--sse-c-copy-source` in `aws s3 sync`) -- x-amz-acl (`--acl` in `aws s3 sync`) - -You can find more information about system defined metadata keys in -[S3 PutObject documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) -and [`aws s3 sync` documentation](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html). - -```ts -const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', { - websiteIndexDocument: 'index.html', - publicReadAccess: true, -}); - -new s3deploy.BucketDeployment(this, 'DeployWebsite', { - sources: [s3deploy.Source.asset('./website-dist')], - destinationBucket: websiteBucket, - destinationKeyPrefix: 'web/static', // optional prefix in destination bucket - metadata: { A: "1", b: "2" }, // user-defined metadata - - // system-defined metadata - contentType: "text/html", - contentLanguage: "en", - storageClass: s3deploy.StorageClass.INTELLIGENT_TIERING, - serverSideEncryption: s3deploy.ServerSideEncryption.AES_256, - cacheControl: [ - s3deploy.CacheControl.setPublic(), - s3deploy.CacheControl.maxAge(Duration.hours(1)), - ], - accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL, -}); -``` - -## CloudFront Invalidation - -You can provide a CloudFront distribution and optional paths to invalidate after the bucket deployment finishes. - -```ts -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as origins from '@aws-cdk/aws-cloudfront-origins'; - -const bucket = new s3.Bucket(this, 'Destination'); - -// Handles buckets whether or not they are configured for website hosting. -const distribution = new cloudfront.Distribution(this, 'Distribution', { - defaultBehavior: { origin: new origins.S3Origin(bucket) }, -}); - -new s3deploy.BucketDeployment(this, 'DeployWithInvalidation', { - sources: [s3deploy.Source.asset('./website-dist')], - destinationBucket: bucket, - distribution, - distributionPaths: ['/images/*.png'], -}); -``` - -## Size Limits - -The default memory limit for the deployment resource is 128MiB. If you need to -copy larger files, you can use the `memoryLimit` configuration to increase the -size of the AWS Lambda resource handler. - -The default ephemeral storage size for the deployment resource is 512MiB. If you -need to upload larger files, you may hit this limit. You can use the -`ephemeralStorageSize` configuration to increase the storage size of the AWS Lambda -resource handler. - -> NOTE: a new AWS Lambda handler will be created in your stack for each combination -> of memory and storage size. - -## EFS Support - -If your workflow needs more disk space than default (512 MB) disk space, you may attach an EFS storage to underlying -lambda function. To Enable EFS support set `efs` and `vpc` props for BucketDeployment. - -Check sample usage below. -Please note that creating VPC inline may cause stack deletion failures. It is shown as below for simplicity. -To avoid such condition, keep your network infra (VPC) in a separate stack and pass as props. - -```ts -declare const destinationBucket: s3.Bucket; -declare const vpc: ec2.Vpc; - -new s3deploy.BucketDeployment(this, 'DeployMeWithEfsStorage', { - sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], - destinationBucket, - destinationKeyPrefix: 'efs/', - useEfs: true, - vpc, - retainOnDelete: false, -}); -``` - -## Data with deploy-time values - -The content passed to `Source.data()`, `Source.jsonData()`, or `Source.yamlData()` can include -references that will get resolved only during deployment. - -For example: - -```ts -import * as sns from '@aws-cdk/aws-sns'; - -declare const destinationBucket: s3.Bucket; -declare const topic: sns.Topic; - -const appConfig = { - topic_arn: topic.topicArn, - base_url: 'https://my-endpoint', -}; - -new s3deploy.BucketDeployment(this, 'BucketDeployment', { - sources: [s3deploy.Source.jsonData('config.json', appConfig)], - destinationBucket, -}); -``` - -The value in `topic.topicArn` is a deploy-time value. It only gets resolved -during deployment by placing a marker in the generated source file and -substituting it when its deployed to the destination with the actual value. - -## Keep Files Zipped - -By default, files are zipped, then extracted into the destination bucket. - -You can use the option `extract: false` to disable this behavior, in which case, files will remain in a zip file when deployed to S3. To reference the object keys, or filenames, which will be deployed to the bucket, you can use the `objectKeys` getter on the bucket deployment. - -```ts -import * as cdk from 'aws-cdk-lib'; - -declare const destinationBucket: s3.Bucket; - -const myBucketDeployment = new s3deploy.BucketDeployment(this, 'DeployMeWithoutExtractingFilesOnDestination', { - sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], - destinationBucket, - extract: false, -}); - -new cdk.CfnOutput(this, 'ObjectKey', { - value: cdk.Fn.select(0, myBucketDeployment.objectKeys), -}); -``` - -## Notes - -- This library uses an AWS CloudFormation custom resource which is about 10MiB in - size. The code of this resource is bundled with this library. -- AWS Lambda execution time is limited to 15min. This limits the amount of data - which can be deployed into the bucket by this timeout. -- When the `BucketDeployment` is removed from the stack, the contents are retained - in the destination bucket ([#952](https://github.com/aws/aws-cdk/issues/952)). -- If you are using `s3deploy.Source.bucket()` to take the file source from - another bucket: the deployed files will only be updated if the key (file name) - of the file in the source bucket changes. Mutating the file in place will not - be good enough: the custom resource will simply not run if the properties don't - change. - - If you use assets (`s3deploy.Source.asset()`) you don't need to worry - about this: the asset system will make sure that if the files have changed, - the file name is unique and the deployment will run. - -## Development - -The custom resource is implemented in Python 3.9 in order to be able to leverage -the AWS CLI for "aws s3 sync". The code is under [`lib/lambda`](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-s3-deployment/lib/lambda) and -unit tests are under [`test/lambda`](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-s3-deployment/test/lambda). - -This package requires Python 3.9 during build time in order to create the custom -resource Lambda bundle and test it. It also relies on a few bash scripts, so -might be tricky to build on Windows. - -## Roadmap - -- [ ] Support "blue/green" deployments ([#954](https://github.com/aws/aws-cdk/issues/954)) diff --git a/packages/@aws-cdk/aws-s3-deployment/jest.config.js b/packages/@aws-cdk/aws-s3-deployment/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/source.ts b/packages/@aws-cdk/aws-s3-deployment/lib/source.ts deleted file mode 100644 index 05791088332e5..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/lib/source.ts +++ /dev/null @@ -1,188 +0,0 @@ -import * as fs from 'fs'; -import { join, dirname } from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import { FileSystem, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { renderData } from './render-data'; - -/** - * Source information. - */ -export interface SourceConfig { - /** - * The source bucket to deploy from. - */ - readonly bucket: s3.IBucket; - - /** - * An S3 object key in the source bucket that points to a zip file. - */ - readonly zipObjectKey: string; - - /** - * A set of markers to substitute in the source content. - * @default - no markers - */ - readonly markers?: Record; -} - -/** - * Bind context for ISources - */ -export interface DeploymentSourceContext { - /** - * The role for the handler - */ - readonly handlerRole: iam.IRole; -} - -/** - * Represents a source for bucket deployments. - */ -export interface ISource { - /** - * Binds the source to a bucket deployment. - * @param scope The construct tree context. - */ - bind(scope: Construct, context?: DeploymentSourceContext): SourceConfig; -} - -/** - * Specifies bucket deployment source. - * - * Usage: - * - * Source.bucket(bucket, key) - * Source.asset('/local/path/to/directory') - * Source.asset('/local/path/to/a/file.zip') - * Source.data('hello/world/file.txt', 'Hello, world!') - * Source.dataJson('config.json', { baz: topic.topicArn }) - * Source.dataYaml('config.yaml', { baz: topic.topicArn }) - * - */ -export class Source { - /** - * Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents. - * - * Make sure you trust the producer of the archive. - * - * @param bucket The S3 Bucket - * @param zipObjectKey The S3 object key of the zip file with contents - */ - public static bucket(bucket: s3.IBucket, zipObjectKey: string): ISource { - return { - bind: (_: Construct, context?: DeploymentSourceContext) => { - if (!context) { - throw new Error('To use a Source.bucket(), context must be provided'); - } - - bucket.grantRead(context.handlerRole); - return { bucket, zipObjectKey }; - }, - }; - } - - /** - * Uses a local asset as the deployment source. - * - * If the local asset is a .zip archive, make sure you trust the - * producer of the archive. - * - * @param path The path to a local .zip file or a directory - */ - public static asset(path: string, options?: s3_assets.AssetOptions): ISource { - return { - bind(scope: Construct, context?: DeploymentSourceContext): SourceConfig { - if (!context) { - throw new Error('To use a Source.asset(), context must be provided'); - } - - let id = 1; - while (scope.node.tryFindChild(`Asset${id}`)) { - id++; - } - const asset = new s3_assets.Asset(scope, `Asset${id}`, { - path, - ...options, - }); - if (!asset.isZipArchive) { - throw new Error('Asset path must be either a .zip file or a directory'); - } - asset.grantRead(context.handlerRole); - - return { - bucket: asset.bucket, - zipObjectKey: asset.s3ObjectKey, - }; - }, - }; - } - - /** - * Deploys an object with the specified string contents into the bucket. The - * content can include deploy-time values (such as `snsTopic.topicArn`) that - * will get resolved only during deployment. - * - * To store a JSON object use `Source.jsonData()`. - * To store YAML content use `Source.yamlData()`. - * - * @param objectKey The destination S3 object key (relative to the root of the - * S3 deployment). - * @param data The data to be stored in the object. - */ - public static data(objectKey: string, data: string): ISource { - return { - bind: (scope: Construct, context?: DeploymentSourceContext) => { - const workdir = FileSystem.mkdtemp('s3-deployment'); - const outputPath = join(workdir, objectKey); - const rendered = renderData(scope, data); - fs.mkdirSync(dirname(outputPath), { recursive: true }); - fs.writeFileSync(outputPath, rendered.text); - const asset = this.asset(workdir).bind(scope, context); - return { - bucket: asset.bucket, - zipObjectKey: asset.zipObjectKey, - markers: rendered.markers, - }; - }, - }; - } - - /** - * Deploys an object with the specified JSON object into the bucket. The - * object can include deploy-time values (such as `snsTopic.topicArn`) that - * will get resolved only during deployment. - * - * @param objectKey The destination S3 object key (relative to the root of the - * S3 deployment). - * @param obj A JSON object. - */ - public static jsonData(objectKey: string, obj: any): ISource { - return { - bind: (scope: Construct, context?: DeploymentSourceContext) => { - return Source.data(objectKey, Stack.of(scope).toJsonString(obj)).bind(scope, context); - }, - }; - } - - /** - * Deploys an object with the specified JSON object formatted as YAML into the bucket. - * The object can include deploy-time values (such as `snsTopic.topicArn`) that - * will get resolved only during deployment. - * - * @param objectKey The destination S3 object key (relative to the root of the - * S3 deployment). - * @param obj A JSON object. - */ - public static yamlData(objectKey: string, obj: any): ISource { - return { - bind: (scope: Construct, context?: DeploymentSourceContext) => { - return Source.data(objectKey, Stack.of(scope).toYamlString(obj)).bind(scope, context); - }, - }; - } - - private constructor() { } -} diff --git a/packages/@aws-cdk/aws-s3-deployment/package.json b/packages/@aws-cdk/aws-s3-deployment/package.json deleted file mode 100644 index 5175f324d1d5b..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/package.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "name": "@aws-cdk/aws-s3-deployment", - "version": "0.0.0", - "private": true, - "description": "Constructs for deploying contents to S3 buckets", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.s3.deployment", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "s3-deployment" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.S3.Deployment", - "packageId": "Amazon.CDK.AWS.S3.Deployment", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-s3-deployment", - "module": "aws_cdk.aws_s3_deployment", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-s3-deployment" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "s3" - ], - "nyc": { - "exclude": [ - "coverage/**", - "test/**", - "examples/**", - "lib/*.generated.js", - "build-tools/**" - ] - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "case": "1.6.3", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "constructs": "^10.0.0" - }, - "bundledDependencies": [ - "case" - ], - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "nozem": { - "ostools": [ - "dirname", - "mktemp", - "mkdir", - "cp", - "docker" - ] - }, - "publishConfig": { - "tag": "next" - }, - "awslint": { - "exclude": [ - "no-unused-type:@aws-cdk/aws-s3-deployment.UserDefinedObjectMetadata" - ] - } -} diff --git a/packages/@aws-cdk/aws-s3-deployment/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-s3-deployment/rosetta/default.ts-fixture deleted file mode 100644 index 8733f436c5e29..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/rosetta/default.ts-fixture +++ /dev/null @@ -1,20 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as s3deploy from '@aws-cdk/aws-s3-deployment'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as ec2 from'@aws-cdk/aws-ec2'; -import * as path from 'path'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} - -class ConstructThatReadsFromTheBucket { - constructor(...args: any[]) { - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts deleted file mode 100644 index 3554dc94d4617..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js b/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js deleted file mode 100644 index bf260b9069cd1..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/test/integ.bucket-deployment-cloudfront.js.snapshot/asset.60767da3831353fede3cfe92efef10580a600592dec8ccbb06c051e95b9c1b26/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sdUJBQXVCLEdBQUcsNkJBQTZCLENBQUM7QUFFOUQsTUFBTSxFQUFFLEdBQUcsSUFBSSxZQUFFLEVBQUU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eyBCdWNrZXQ6IGJ1Y2tldE5hbWUgfSkucHJvbWlzZSgpO1xuICByZXR1cm4gcmVzcG9uc2UuVGFnU2V0LnNvbWUodGFnID0+IHRhZy5LZXkgPT09IEFVVE9fREVMRVRFX09CSkVDVFNfVEFHICYmIHRhZy5WYWx1ZSA9PT0gJ3RydWUnKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda.test.ts b/packages/@aws-cdk/aws-s3-deployment/test/lambda.test.ts deleted file mode 100644 index 830938b3811b3..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/test/lambda.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { spawnSync } from 'child_process'; -import * as path from 'path'; - -test('lambda python pytest', () => { - const result = spawnSync(path.join(__dirname, 'lambda', 'test.sh'), { stdio: 'inherit' }); - expect(result.status).toBe(0); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/.gitignore b/packages/@aws-cdk/aws-s3-deployment/test/lambda/.gitignore deleted file mode 100644 index 3a5f4f826d408..0000000000000 --- a/packages/@aws-cdk/aws-s3-deployment/test/lambda/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# symlinked by debug.sh -index.py -__pycache__ -aws.out \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-notifications/.eslintrc.js b/packages/@aws-cdk/aws-s3-notifications/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3-notifications/.gitignore b/packages/@aws-cdk/aws-s3-notifications/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-s3-notifications/.npmignore b/packages/@aws-cdk/aws-s3-notifications/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-s3-notifications/LICENSE b/packages/@aws-cdk/aws-s3-notifications/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-s3-notifications/NOTICE b/packages/@aws-cdk/aws-s3-notifications/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-s3-notifications/README.md b/packages/@aws-cdk/aws-s3-notifications/README.md deleted file mode 100644 index c16b206f52854..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# S3 Bucket Notifications Destinations - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module includes integration classes for using Topics, Queues or Lambdas -as S3 Notification Destinations. - -## Examples - -The following example shows how to send a notification to an SNS -topic when an object is created in an S3 bucket: - -```ts -import * as sns from '@aws-cdk/aws-sns'; - -const bucket = new s3.Bucket(this, 'Bucket'); -const topic = new sns.Topic(this, 'Topic'); - -bucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.SnsDestination(topic)); -``` - -The following example shows how to send a notification to an SQS queue -when an object is created in an S3 bucket: - -```ts -import * as sqs from '@aws-cdk/aws-sqs'; - -const bucket = new s3.Bucket(this, 'Bucket'); -const queue = new sqs.Queue(this, 'Queue'); - -bucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.SqsDestination(queue)); -``` - -The following example shows how to send a notification to a Lambda function when an object is created in an S3 bucket: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -const bucket = new s3.Bucket(this, 'Bucket'); -const fn = new lambda.Function(this, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), -}); - -bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(fn)); -``` diff --git a/packages/@aws-cdk/aws-s3-notifications/jest.config.js b/packages/@aws-cdk/aws-s3-notifications/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3-notifications/lib/lambda.ts b/packages/@aws-cdk/aws-s3-notifications/lib/lambda.ts deleted file mode 100644 index 7bec8f04d2170..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/lib/lambda.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { CfnResource, Names, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Use a Lambda function as a bucket notification destination - */ -export class LambdaDestination implements s3.IBucketNotificationDestination { - constructor(private readonly fn: lambda.IFunction) { - } - - public bind(_scope: Construct, bucket: s3.IBucket): s3.BucketNotificationDestinationConfig { - const permissionId = `AllowBucketNotificationsTo${Names.nodeUniqueId(this.fn.permissionsNode)}`; - - if (!(bucket instanceof Construct)) { - throw new Error(`LambdaDestination for function ${Names.nodeUniqueId(this.fn.permissionsNode)} can only be configured on a - bucket construct (Bucket ${bucket.bucketName})`); - } - - if (bucket.node.tryFindChild(permissionId) === undefined) { - this.fn.addPermission(permissionId, { - sourceAccount: Stack.of(bucket).account, - principal: new iam.ServicePrincipal('s3.amazonaws.com'), - sourceArn: bucket.bucketArn, - // Placing the permissions node in the same scope as the s3 bucket. - // Otherwise, there is a circular dependency when the s3 bucket - // and lambda functions declared in different stacks. - scope: bucket, - }); - } - - // if we have a permission resource for this relationship, add it as a dependency - // to the bucket notifications resource, so it will be created first. - const permission = bucket.node.tryFindChild(permissionId) as CfnResource | undefined; - - return { - type: s3.BucketNotificationDestinationType.LAMBDA, - arn: this.fn.functionArn, - dependencies: permission ? [permission] : undefined, - }; - } -} diff --git a/packages/@aws-cdk/aws-s3-notifications/lib/sns.ts b/packages/@aws-cdk/aws-s3-notifications/lib/sns.ts deleted file mode 100644 index 38a83e6e2f445..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/lib/sns.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import { Construct } from 'constructs'; - -/** - * Use an SNS topic as a bucket notification destination - */ -export class SnsDestination implements s3.IBucketNotificationDestination { - constructor(private readonly topic: sns.ITopic) { - } - - public bind(_scope: Construct, bucket: s3.IBucket): s3.BucketNotificationDestinationConfig { - this.topic.addToResourcePolicy(new iam.PolicyStatement({ - principals: [new iam.ServicePrincipal('s3.amazonaws.com')], - actions: ['sns:Publish'], - resources: [this.topic.topicArn], - conditions: { - ArnLike: { 'aws:SourceArn': bucket.bucketArn }, - }, - })); - - return { - arn: this.topic.topicArn, - type: s3.BucketNotificationDestinationType.TOPIC, - dependencies: [this.topic], // make sure the topic policy resource is created before the notification config - }; - } -} diff --git a/packages/@aws-cdk/aws-s3-notifications/lib/sqs.ts b/packages/@aws-cdk/aws-s3-notifications/lib/sqs.ts deleted file mode 100644 index 442c1f6c1331d..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/lib/sqs.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { Annotations } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Use an SQS queue as a bucket notification destination - */ -export class SqsDestination implements s3.IBucketNotificationDestination { - constructor(private readonly queue: sqs.IQueue) { - } - - /** - * Allows using SQS queues as destinations for bucket notifications. - * Use `bucket.onEvent(event, queue)` to subscribe. - */ - public bind(_scope: Construct, bucket: s3.IBucket): s3.BucketNotificationDestinationConfig { - this.queue.grantSendMessages(new iam.ServicePrincipal('s3.amazonaws.com', { - conditions: { - ArnLike: { 'aws:SourceArn': bucket.bucketArn }, - }, - })); - - // if this queue is encrypted, we need to allow S3 to read messages since that's how - // it verifies that the notification destination configuration is valid. - if (this.queue.encryptionMasterKey) { - const statement = new iam.PolicyStatement({ - principals: [new iam.ServicePrincipal('s3.amazonaws.com')], - actions: ['kms:GenerateDataKey*', 'kms:Decrypt'], - resources: ['*'], - }); - const addResult = this.queue.encryptionMasterKey.addToResourcePolicy(statement, /* allowNoOp */ true); - if (!addResult.statementAdded) { - Annotations.of(this.queue.encryptionMasterKey).addWarning(`Can not change key policy of imported kms key. Ensure that your key policy contains the following permissions: \n${JSON.stringify(statement.toJSON(), null, 2)}`); - } - } - - return { - arn: this.queue.queueArn, - type: s3.BucketNotificationDestinationType.QUEUE, - dependencies: [this.queue], - }; - } - -} diff --git a/packages/@aws-cdk/aws-s3-notifications/package.json b/packages/@aws-cdk/aws-s3-notifications/package.json deleted file mode 100644 index 4272fbebfea58..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "@aws-cdk/aws-s3-notifications", - "version": "0.0.0", - "private": true, - "description": "Bucket Notifications API for AWS S3", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.s3.notifications", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "s3-notifications" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.S3.Notifications", - "packageId": "Amazon.CDK.AWS.S3.Notifications", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-s3-notifications", - "module": "aws_cdk.aws_s3_notifications", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-s3-notifications" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "s3", - "notifications" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-s3-notifications/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-s3-notifications/rosetta/default.ts-fixture deleted file mode 100644 index 36e2218e03d06..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as s3n from '@aws-cdk/aws-s3-notifications'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as path from 'path'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts b/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts deleted file mode 100644 index 1493e29176362..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/test/lambda/integ.bucket-notifications.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as s3n from '../../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'lambda-bucket-notifications'); - -const bucketA = new s3.Bucket(stack, 'MyBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -const fn = new lambda.Function(stack, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`), -}); - -const bucketB = new s3.Bucket(stack, 'YourBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); -bucketB.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.LambdaDestination(fn)); - -app.synth(); - -/* eslint-disable no-console */ -function handler(event: any, _context: any, callback: any) { - console.log(JSON.stringify(event, undefined, 2)); - return callback(null, event); -} diff --git a/packages/@aws-cdk/aws-s3-notifications/test/lambda/lambda.test.ts b/packages/@aws-cdk/aws-s3-notifications/test/lambda/lambda.test.ts deleted file mode 100644 index 1b886de0f157c..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/test/lambda/lambda.test.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack, App } from '@aws-cdk/core'; -import * as s3n from '../../lib'; - -test('add notifications to multiple functions', () => { - - const stack = new Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const fn1 = new lambda.Function(stack, 'MyFunction1', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('foo'), - }); - - const fn2 = new lambda.Function(stack, 'MyFunction2', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('foo'), - }); - - const lambdaDestination1 = new s3n.LambdaDestination(fn1); - const lambdaDestination2 = new s3n.LambdaDestination(fn2); - - bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination1, { prefix: 'v1/' }); - bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination2, { prefix: 'v2/' }); - - // expecting notification configuration to have both events - Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { - NotificationConfiguration: Match.objectLike({ - LambdaFunctionConfigurations: [ - Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v1/' }] } } }), - Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v2/' }] } } }), - ], - }), - }); - - // expecting one permission for each function - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 2); - - // make sure each permission points to the correct function - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - FunctionName: { - 'Fn::GetAtt': [ - 'MyFunction12A744C2E', - 'Arn', - ], - }, - SourceArn: { - 'Fn::GetAtt': [ - 'MyBucketF68F3FF0', - 'Arn', - ], - }, - }); - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - FunctionName: { - 'Fn::GetAtt': [ - 'MyFunction2F2A964CA', - 'Arn', - ], - }, - SourceArn: { - 'Fn::GetAtt': [ - 'MyBucketF68F3FF0', - 'Arn', - ], - }, - }); - -}); - -test('lambda in a different stack as notification target', () => { - - const app = new App(); - const lambdaStack = new Stack(app, 'stack1'); - const bucketStack = new Stack(app, 'stack2'); - - const lambdaFunction = new lambda.Function(lambdaStack, 'lambdaFunction', { - code: lambda.Code.fromInline('whatever'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - const bucket = new s3.Bucket(bucketStack, 'bucket'); - bucket.addObjectCreatedNotification(new s3n.LambdaDestination(lambdaFunction)); - - // permission should be in the bucket stack - Template.fromStack(bucketStack).hasResourceProperties('AWS::Lambda::Permission', { - FunctionName: { - 'Fn::ImportValue': 'stack1:ExportsOutputFnGetAttlambdaFunction940E68ADArn6B2878AF', - }, - SourceArn: { - 'Fn::GetAtt': [ - 'bucket43879C71', - 'Arn', - ], - }, - }); -}); - -test('imported lambda in a different account as notification target', () => { - const app = new App(); - const stack = new Stack(app, 'stack', { - env: { account: '111111111111' }, - }); - - // Lambda account and stack account differ; no permissions should be created. - const lambdaFunction = lambda.Function.fromFunctionArn(stack, 'lambdaFunction', 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction'); - const bucket = new s3.Bucket(stack, 'bucket'); - - bucket.addObjectCreatedNotification(new s3n.LambdaDestination(lambdaFunction)); - - // no permissions created - Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); -}); - -test('lambda as notification target', () => { - // GIVEN - const stack = new Stack(); - const bucketA = new s3.Bucket(stack, 'MyBucket'); - const fn = new lambda.Function(stack, 'MyFunction', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('foo'), - }); - - // WHEN - bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { 'Fn::GetAtt': ['MyFunction3BAA72D1', 'Arn'] }, - Principal: 's3.amazonaws.com', - SourceAccount: { Ref: 'AWS::AccountId' }, - SourceArn: { 'Fn::GetAtt': ['MyBucketF68F3FF0', 'Arn'] }, - }); - - Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { - NotificationConfiguration: { - LambdaFunctionConfigurations: [ - { - Events: ['s3:ObjectCreated:*'], - Filter: { - Key: { - FilterRules: [{ Name: 'suffix', Value: '.png' }], - }, - }, - LambdaFunctionArn: { 'Fn::GetAtt': ['MyFunction3BAA72D1', 'Arn'] }, - }, - ], - }, - }); -}); - -test('lambda as notification target specified by function arn', () => { - // GIVEN - const stack = new Stack(); - const bucketA = new s3.Bucket(stack, 'MyBucket'); - const fn = lambda.Function.fromFunctionArn(stack, 'MyFunction', 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords'); - - // WHEN - bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { - NotificationConfiguration: { - LambdaFunctionConfigurations: [ - { - Events: ['s3:ObjectCreated:*'], - Filter: { - Key: { - FilterRules: [{ Name: 'suffix', Value: '.png' }], - }, - }, - LambdaFunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords', - }, - ], - }, - }); -}); - -test('permissions are added as a dependency to the notifications resource when using singleton function', () => { - - const stack = new Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const fn = new lambda.SingletonFunction(stack, 'MyFunction', { - uuid: 'uuid', - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('foo'), - }); - - const lambdaDestination = new s3n.LambdaDestination(fn); - - bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination, { prefix: 'v1/' }); - - Template.fromStack(stack).hasResource('Custom::S3BucketNotifications', { - DependsOn: ['MyBucketAllowBucketNotificationsToSingletonLambdauuid28C96883'], - }); -}); - -test('add multiple event notifications using a singleton function', () => { - - const stack = new Stack(); - const bucket = new s3.Bucket(stack, 'MyBucket'); - const fn = new lambda.SingletonFunction(stack, 'MyFunction', { - uuid: 'uuid', - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('foo'), - }); - - const lambdaDestination = new s3n.LambdaDestination(fn); - - bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination, { prefix: 'v1/' }); - bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination, { prefix: 'v2/' }); - - Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { - NotificationConfiguration: Match.objectLike({ - LambdaFunctionConfigurations: [ - Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v1/' }] } } }), - Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v2/' }] } } }), - ], - }), - }); - -}); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts b/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts deleted file mode 100644 index 8a1d607113059..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/test/sns.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; -import * as notif from '../lib'; - -test('asBucketNotificationDestination adds bucket permissions only once for each bucket', () => { - const stack = new cdk.Stack(); - - const topic = new sns.Topic(stack, 'MyTopic'); - const bucket = new s3.Bucket(stack, 'Bucket'); - const bucket2 = new s3.Bucket(stack, 'Bucket2'); - - new notif.SnsDestination(topic).bind(bucket, bucket); - new notif.SnsDestination(topic).bind(bucket, bucket); - // another bucket will be added to the topic policy - new notif.SnsDestination(topic).bind(bucket2, bucket2); - - Template.fromStack(stack).templateMatches({ - Resources: { - Bucket83908E77: { - Type: 'AWS::S3::Bucket', - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }, - Bucket25524B414: { - Type: 'AWS::S3::Bucket', - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Retain', - }, - MyTopic86869434: { - Type: 'AWS::SNS::Topic', - }, - MyTopicPolicy12A5EC17: { - Type: 'AWS::SNS::TopicPolicy', - Properties: { - PolicyDocument: { - Statement: [ - { - Action: 'sns:Publish', - Condition: { - ArnLike: { - 'aws:SourceArn': { 'Fn::GetAtt': ['Bucket83908E77', 'Arn'] }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 's3.amazonaws.com', - }, - Resource: { - Ref: 'MyTopic86869434', - }, - Sid: '0', - }, - { - Action: 'sns:Publish', - Condition: { - ArnLike: { - 'aws:SourceArn': { 'Fn::GetAtt': ['Bucket25524B414', 'Arn'] }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 's3.amazonaws.com', - }, - Resource: { - Ref: 'MyTopic86869434', - }, - Sid: '1', - }, - ], - Version: '2012-10-17', - }, - Topics: [ - { - Ref: 'MyTopic86869434', - }, - ], - }, - }, - }, - }); -}); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.ts b/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.ts deleted file mode 100644 index 3d6a11354182c..0000000000000 --- a/packages/@aws-cdk/aws-s3-notifications/test/sqs/integ.bucket-notifications.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as s3n from '../../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'sqs-bucket-notifications'); - -const bucket1 = new s3.Bucket(stack, 'Bucket1', { - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); -const queue = new sqs.Queue(stack, 'MyQueue'); - -bucket1.addObjectCreatedNotification(new s3n.SqsDestination(queue)); - -const bucket2 = new s3.Bucket(stack, 'Bucket2', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - autoDeleteObjects: true, -}); -bucket2.addObjectCreatedNotification(new s3n.SqsDestination(queue), { suffix: '.png' }); - -const encryptedQueue = new sqs.Queue(stack, 'EncryptedQueue', { encryption: sqs.QueueEncryption.KMS }); -bucket1.addObjectRemovedNotification(new s3n.SqsDestination(encryptedQueue)); - - -const integTest = new integ.IntegTest(app, 'SQSBucketNotificationsTest', { - testCases: [stack], -}); - -integTest.assertions - // First remove the test notifications - .awsApiCall('SQS', 'purgeQueue', { - QueueUrl: queue.queueUrl, - }) - .next(integTest.assertions - .awsApiCall('S3', 'putObject', { - Bucket: bucket2.bucketName, - Key: 'image.png', - Body: 'Some content', - })) - .next(integTest.assertions - .awsApiCall('SQS', 'receiveMessage', { - QueueUrl: queue.queueUrl, - WaitTimeSeconds: 20, - }) - .assertAtPath('Messages.0.Body.Records.0.s3.object.key', integ.ExpectedResult.stringLikeRegexp('image\\.png'))); - -app.synth(); diff --git a/packages/@aws-cdk/aws-s3/.eslintrc.js b/packages/@aws-cdk/aws-s3/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-s3/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3/.gitignore b/packages/@aws-cdk/aws-s3/.gitignore deleted file mode 100644 index 1f6a2603bdf03..0000000000000 --- a/packages/@aws-cdk/aws-s3/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-s3/.npmignore b/packages/@aws-cdk/aws-s3/.npmignore deleted file mode 100644 index 3c1ceb7605a65..0000000000000 --- a/packages/@aws-cdk/aws-s3/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -jest.config.js -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-s3/LICENSE b/packages/@aws-cdk/aws-s3/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-s3/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-s3/NOTICE b/packages/@aws-cdk/aws-s3/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-s3/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-s3/README.md b/packages/@aws-cdk/aws-s3/README.md deleted file mode 100644 index 05e313b39dfc9..0000000000000 --- a/packages/@aws-cdk/aws-s3/README.md +++ /dev/null @@ -1,703 +0,0 @@ -# Amazon S3 Construct Library - - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Define an unencrypted S3 bucket. - -```ts -const bucket = new s3.Bucket(this, 'MyFirstBucket'); -``` - -`Bucket` constructs expose the following deploy-time attributes: - -- `bucketArn` - the ARN of the bucket (i.e. `arn:aws:s3:::bucket_name`) -- `bucketName` - the name of the bucket (i.e. `bucket_name`) -- `bucketWebsiteUrl` - the Website URL of the bucket (i.e. - `http://bucket_name.s3-website-us-west-1.amazonaws.com`) -- `bucketDomainName` - the URL of the bucket (i.e. `bucket_name.s3.amazonaws.com`) -- `bucketDualStackDomainName` - the dual-stack URL of the bucket (i.e. - `bucket_name.s3.dualstack.eu-west-1.amazonaws.com`) -- `bucketRegionalDomainName` - the regional URL of the bucket (i.e. - `bucket_name.s3.eu-west-1.amazonaws.com`) -- `arnForObjects(pattern)` - the ARN of an object or objects within the bucket (i.e. - `arn:aws:s3:::bucket_name/exampleobject.png` or - `arn:aws:s3:::bucket_name/Development/*`) -- `urlForObject(key)` - the HTTP URL of an object within the bucket (i.e. - `https://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey`) -- `virtualHostedUrlForObject(key)` - the virtual-hosted style HTTP URL of an object - within the bucket (i.e. `https://china-bucket-s3.cn-north-1.amazonaws.com.cn/mykey`) -- `s3UrlForObject(key)` - the S3 URL of an object within the bucket (i.e. - `s3://bucket/mykey`) - -## Encryption - -Define a KMS-encrypted bucket: - -```ts -const bucket = new s3.Bucket(this, 'MyEncryptedBucket', { - encryption: s3.BucketEncryption.KMS, -}); - -// you can access the encryption key: -assert(bucket.encryptionKey instanceof kms.Key); -``` - -You can also supply your own key: - -```ts -const myKmsKey = new kms.Key(this, 'MyKey'); - -const bucket = new s3.Bucket(this, 'MyEncryptedBucket', { - encryption: s3.BucketEncryption.KMS, - encryptionKey: myKmsKey, -}); - -assert(bucket.encryptionKey === myKmsKey); -``` - -Enable KMS-SSE encryption via [S3 Bucket Keys](https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html): - -```ts -const bucket = new s3.Bucket(this, 'MyEncryptedBucket', { - encryption: s3.BucketEncryption.KMS, - bucketKeyEnabled: true, -}); -``` - -Use `BucketEncryption.ManagedKms` to use the S3 master KMS key: - -```ts -const bucket = new s3.Bucket(this, 'Buck', { - encryption: s3.BucketEncryption.KMS_MANAGED, -}); - -assert(bucket.encryptionKey == null); -``` - -## Permissions - -A bucket policy will be automatically created for the bucket upon the first call to -`addToResourcePolicy(statement)`: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket'); -const result = bucket.addToResourcePolicy( - new iam.PolicyStatement({ - actions: ['s3:GetObject'], - resources: [bucket.arnForObjects('file.txt')], - principals: [new iam.AccountRootPrincipal()], - }) -); -``` - -If you try to add a policy statement to an existing bucket, this method will -not do anything: - -```ts -const bucket = s3.Bucket.fromBucketName(this, 'existingBucket', 'bucket-name'); - -// No policy statement will be added to the resource -const result = bucket.addToResourcePolicy( - new iam.PolicyStatement({ - actions: ['s3:GetObject'], - resources: [bucket.arnForObjects('file.txt')], - principals: [new iam.AccountRootPrincipal()], - }) -); -``` - -That's because it's not possible to tell whether the bucket -already has a policy attached, let alone to re-use that policy to add more -statements to it. We recommend that you always check the result of the call: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket'); -const result = bucket.addToResourcePolicy( - new iam.PolicyStatement({ - actions: ['s3:GetObject'], - resources: [bucket.arnForObjects('file.txt')], - principals: [new iam.AccountRootPrincipal()], - }) -); - -if (!result.statementAdded) { - // Uh-oh! Someone probably made a mistake here. -} -``` - -The bucket policy can be directly accessed after creation to add statements or -adjust the removal policy. - -```ts -const bucket = new s3.Bucket(this, 'MyBucket'); -bucket.policy?.applyRemovalPolicy(cdk.RemovalPolicy.RETAIN); -``` - -Most of the time, you won't have to manipulate the bucket policy directly. -Instead, buckets have "grant" methods called to give prepackaged sets of permissions -to other resources. For example: - -```ts -declare const myLambda: lambda.Function; - -const bucket = new s3.Bucket(this, 'MyBucket'); -bucket.grantReadWrite(myLambda); -``` - -Will give the Lambda's execution role permissions to read and write -from the bucket. - -## AWS Foundational Security Best Practices - -### Enforcing SSL - -To require all requests use Secure Socket Layer (SSL): - -```ts -const bucket = new s3.Bucket(this, 'Bucket', { - enforceSSL: true, -}); -``` - -## Sharing buckets between stacks - -To use a bucket in a different stack in the same CDK application, pass the object to the other stack: - -```ts -/** - * Stack that defines the bucket - */ -class Producer extends cdk.Stack { - public readonly myBucket: s3.Bucket; - - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - const bucket = new s3.Bucket(this, 'MyBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - }); - this.myBucket = bucket; - } -} - -interface ConsumerProps extends cdk.StackProps { - userBucket: s3.IBucket; -} - -/** - * Stack that consumes the bucket - */ -class Consumer extends cdk.Stack { - constructor(scope: cdk.App, id: string, props: ConsumerProps) { - super(scope, id, props); - - const user = new iam.User(this, 'MyUser'); - props.userBucket.grantReadWrite(user); - } -} - -const producer = new Producer(app, 'ProducerStack'); -new Consumer(app, 'ConsumerStack', { userBucket: producer.myBucket }); -``` - -## Importing existing buckets - -To import an existing bucket into your CDK application, use the `Bucket.fromBucketAttributes` -factory method. This method accepts `BucketAttributes` which describes the properties of an already -existing bucket: - -```ts -declare const myLambda: lambda.Function; -const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', { - bucketArn: 'arn:aws:s3:::my-bucket', -}); - -// now you can just call methods on the bucket -bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(myLambda), { - prefix: 'home/myusername/*', -}); -``` - -Alternatively, short-hand factories are available as `Bucket.fromBucketName` and -`Bucket.fromBucketArn`, which will derive all bucket attributes from the bucket -name or ARN respectively: - -```ts -const byName = s3.Bucket.fromBucketName(this, 'BucketByName', 'my-bucket'); -const byArn = s3.Bucket.fromBucketArn(this, 'BucketByArn', 'arn:aws:s3:::my-bucket'); -``` - -The bucket's region defaults to the current stack's region, but can also be explicitly set in cases where one of the bucket's -regional properties needs to contain the correct values. - -```ts -const myCrossRegionBucket = s3.Bucket.fromBucketAttributes(this, 'CrossRegionImport', { - bucketArn: 'arn:aws:s3:::my-bucket', - region: 'us-east-1', -}); -// myCrossRegionBucket.bucketRegionalDomainName === 'my-bucket.s3.us-east-1.amazonaws.com' -``` - -## Bucket Notifications - -The Amazon S3 notification feature enables you to receive notifications when -certain events happen in your bucket as described under [S3 Bucket -Notifications] of the S3 Developer Guide. - -To subscribe for bucket notifications, use the `bucket.addEventNotification` method. The -`bucket.addObjectCreatedNotification` and `bucket.addObjectRemovedNotification` can also be used for -these common use cases. - -The following example will subscribe an SNS topic to be notified of all `s3:ObjectCreated:*` events: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket'); -const topic = new sns.Topic(this, 'MyTopic'); -bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.SnsDestination(topic)); -``` - -This call will also ensure that the topic policy can accept notifications for -this specific bucket. - -Supported S3 notification targets are exposed by the `@aws-cdk/aws-s3-notifications` package. - -It is also possible to specify S3 object key filters when subscribing. The -following example will notify `myQueue` when objects prefixed with `foo/` and -have the `.jpg` suffix are removed from the bucket. - -```ts -declare const myQueue: sqs.Queue; -const bucket = new s3.Bucket(this, 'MyBucket'); -bucket.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.SqsDestination(myQueue), { - prefix: 'foo/', - suffix: '.jpg', -}); -``` - -Adding notifications on existing buckets: - -```ts -declare const topic: sns.Topic; -const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', { - bucketArn: 'arn:aws:s3:::my-bucket', -}); -bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.SnsDestination(topic)); -``` - -When you add an event notification to a bucket, a custom resource is created to -manage the notifications. By default, a new role is created for the Lambda -function that implements this feature. If you want to use your own role instead, -you should provide it in the `Bucket` constructor: - -```ts -declare const myRole: iam.IRole; -const bucket = new s3.Bucket(this, 'MyBucket', { - notificationsHandlerRole: myRole, -}); -``` - -Whatever role you provide, the CDK will try to modify it by adding the -permissions from `AWSLambdaBasicExecutionRole` (an AWS managed policy) as well -as the permissions `s3:PutBucketNotification` and `s3:GetBucketNotification`. -If you’re passing an imported role, and you don’t want this to happen, configure -it to be immutable: - -```ts -const importedRole = iam.Role.fromRoleArn(this, 'role', 'arn:aws:iam::123456789012:role/RoleName', { - mutable: false, -}); -``` - -> If you provide an imported immutable role, make sure that it has at least all -> the permissions mentioned above. Otherwise, the deployment will fail! - -[s3 bucket notifications]: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html - -### EventBridge notifications - -Amazon S3 can send events to Amazon EventBridge whenever certain events happen in your bucket. -Unlike other destinations, you don't need to select which event types you want to deliver. - -The following example will enable EventBridge notifications: - -```ts -const bucket = new s3.Bucket(this, 'MyEventBridgeBucket', { - eventBridgeEnabled: true, -}); -``` - -[s3 eventbridge notifications]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html - -## Block Public Access - -Use `blockPublicAccess` to specify [block public access settings] on the bucket. - -Enable all block public access settings: - -```ts -const bucket = new s3.Bucket(this, 'MyBlockedBucket', { - blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL, -}); -``` - -Block and ignore public ACLs: - -```ts -const bucket = new s3.Bucket(this, 'MyBlockedBucket', { - blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS, -}); -``` - -Alternatively, specify the settings manually: - -```ts -const bucket = new s3.Bucket(this, 'MyBlockedBucket', { - blockPublicAccess: new s3.BlockPublicAccess({ blockPublicPolicy: true }), -}); -``` - -When `blockPublicPolicy` is set to `true`, `grantPublicRead()` throws an error. - -[block public access settings]: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html - -## Logging configuration - -Use `serverAccessLogsBucket` to describe where server access logs are to be stored. - -```ts -const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket'); - -const bucket = new s3.Bucket(this, 'MyBucket', { - serverAccessLogsBucket: accessLogsBucket, -}); -``` - -It's also possible to specify a prefix for Amazon S3 to assign to all log object keys. - -```ts -const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket'); - -const bucket = new s3.Bucket(this, 'MyBucket', { - serverAccessLogsBucket: accessLogsBucket, - serverAccessLogsPrefix: 'logs', -}); -``` - -### Allowing access log delivery using a Bucket Policy (recommended) - -When possible, it is recommended to use a bucket policy to grant access instead of -using ACLs. When the `@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy` feature flag -is enabled, this is done by default for server access logs. If S3 Server Access Logs -are the only logs delivered to your bucket (or if all other services logging to the -bucket support using bucket policy instead of ACLs), you can set object ownership -to [bucket owner enforced](#bucket-owner-enforced-recommended), as is recommended. - -```ts -const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket', { - objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED, -}); - -const bucket = new s3.Bucket(this, 'MyBucket', { - serverAccessLogsBucket: accessLogsBucket, - serverAccessLogsPrefix: 'logs', -}); -``` - -## S3 Inventory - -An [inventory](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) contains a list of the objects in the source bucket and metadata for each object. The inventory lists are stored in the destination bucket as a CSV file compressed with GZIP, as an Apache optimized row columnar (ORC) file compressed with ZLIB, or as an Apache Parquet (Parquet) file compressed with Snappy. - -You can configure multiple inventory lists for a bucket. You can configure what object metadata to include in the inventory, whether to list all object versions or only current versions, where to store the inventory list file output, and whether to generate the inventory on a daily or weekly basis. - -```ts -const inventoryBucket = new s3.Bucket(this, 'InventoryBucket'); - -const dataBucket = new s3.Bucket(this, 'DataBucket', { - inventories: [ - { - frequency: s3.InventoryFrequency.DAILY, - includeObjectVersions: s3.InventoryObjectVersion.CURRENT, - destination: { - bucket: inventoryBucket, - }, - }, - { - frequency: s3.InventoryFrequency.WEEKLY, - includeObjectVersions: s3.InventoryObjectVersion.ALL, - destination: { - bucket: inventoryBucket, - prefix: 'with-all-versions', - }, - }, - ], -}); -``` - -If the destination bucket is created as part of the same CDK application, the necessary permissions will be automatically added to the bucket policy. -However, if you use an imported bucket (i.e `Bucket.fromXXX()`), you'll have to make sure it contains the following policy document: - -```json -{ - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "InventoryAndAnalyticsExamplePolicy", - "Effect": "Allow", - "Principal": { "Service": "s3.amazonaws.com" }, - "Action": "s3:PutObject", - "Resource": ["arn:aws:s3:::destinationBucket/*"] - } - ] -} -``` - -## Website redirection - -You can use the two following properties to specify the bucket [redirection policy]. Please note that these methods cannot both be applied to the same bucket. - -[redirection policy]: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html#advanced-conditional-redirects - -### Static redirection - -You can statically redirect a to a given Bucket URL or any other host name with `websiteRedirect`: - -```ts -const bucket = new s3.Bucket(this, 'MyRedirectedBucket', { - websiteRedirect: { hostName: 'www.example.com' }, -}); -``` - -### Routing rules - -Alternatively, you can also define multiple `websiteRoutingRules`, to define complex, conditional redirections: - -```ts -const bucket = new s3.Bucket(this, 'MyRedirectedBucket', { - websiteRoutingRules: [ - { - hostName: 'www.example.com', - httpRedirectCode: '302', - protocol: s3.RedirectProtocol.HTTPS, - replaceKey: s3.ReplaceKey.prefixWith('test/'), - condition: { - httpErrorCodeReturnedEquals: '200', - keyPrefixEquals: 'prefix', - }, - }, - ], -}); -``` - -## Filling the bucket as part of deployment - -To put files into a bucket as part of a deployment (for example, to host a -website), see the `@aws-cdk/aws-s3-deployment` package, which provides a -resource that can do just that. - -## The URL for objects - -S3 provides two types of URLs for accessing objects via HTTP(S). Path-Style and -[Virtual Hosted-Style](https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html) -URL. Path-Style is a classic way and will be -[deprecated](https://aws.amazon.com/jp/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story). -We recommend to use Virtual Hosted-Style URL for newly made bucket. - -You can generate both of them. - -```ts -const bucket = new s3.Bucket(this, 'MyBucket'); -bucket.urlForObject('objectname'); // Path-Style URL -bucket.virtualHostedUrlForObject('objectname'); // Virtual Hosted-Style URL -bucket.virtualHostedUrlForObject('objectname', { regional: false }); // Virtual Hosted-Style URL but non-regional -``` - -## Object Ownership - -You can use one of following properties to specify the bucket [object Ownership]. - -[object ownership]: https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html - -### Object writer - -The Uploading account will own the object. - -```ts -new s3.Bucket(this, 'MyBucket', { - objectOwnership: s3.ObjectOwnership.OBJECT_WRITER, -}); -``` - -### Bucket owner preferred - -The bucket owner will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. Without this setting and canned ACL, the object is uploaded and remains owned by the uploading account. - -```ts -new s3.Bucket(this, 'MyBucket', { - objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_PREFERRED, -}); -``` - -### Bucket owner enforced (recommended) - -ACLs are disabled, and the bucket owner automatically owns and has full control -over every object in the bucket. ACLs no longer affect permissions to data in the -S3 bucket. The bucket uses policies to define access control. - -```ts -new s3.Bucket(this, 'MyBucket', { - objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED, -}); -``` - -Some services may not not support log delivery to buckets that have object ownership -set to bucket owner enforced, such as -[S3 buckets using ACLs](#allowing-access-log-delivery-using-a-bucket-policy-recommended) -or [CloudFront Distributions][cloudfront s3 bucket]. - -[cloudfront s3 bucket]: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html#AccessLogsBucketAndFileOwnership - -## Bucket deletion - -When a bucket is removed from a stack (or the stack is deleted), the S3 -bucket will be removed according to its removal policy (which by default will -simply orphan the bucket and leave it in your AWS account). If the removal -policy is set to `RemovalPolicy.DESTROY`, the bucket will be deleted as long -as it does not contain any objects. - -To override this and force all objects to get deleted during bucket deletion, -enable the`autoDeleteObjects` option. - -```ts -const bucket = new s3.Bucket(this, 'MyTempFileBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - autoDeleteObjects: true, -}); -``` - -**Warning** if you have deployed a bucket with `autoDeleteObjects: true`, -switching this to `false` in a CDK version _before_ `1.126.0` will lead to -all objects in the bucket being deleted. Be sure to update your bucket resources -by deploying with CDK version `1.126.0` or later **before** switching this value to `false`. - -## Transfer Acceleration - -[Transfer Acceleration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html) can be configured to enable fast, easy, and secure transfers of files over long distances: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket', { - transferAcceleration: true, -}); -``` - -To access the bucket that is enabled for Transfer Acceleration, you must use a special endpoint. The URL can be generated using method `transferAccelerationUrlForObject`: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket', { - transferAcceleration: true, -}); -bucket.transferAccelerationUrlForObject('objectname'); -``` - -## Intelligent Tiering - -[Intelligent Tiering](https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html) can be configured to automatically move files to glacier: - -```ts -new s3.Bucket(this, 'MyBucket', { - intelligentTieringConfigurations: [ - { - name: 'foo', - prefix: 'folder/name', - archiveAccessTierTime: cdk.Duration.days(90), - deepArchiveAccessTierTime: cdk.Duration.days(180), - tags: [{ key: 'tagname', value: 'tagvalue' }], - }, - ], -}); -``` - -## Lifecycle Rule - -[Managing lifecycle](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) can be configured transition or expiration actions. - -```ts -const bucket = new s3.Bucket(this, 'MyBucket', { - lifecycleRules: [ - { - abortIncompleteMultipartUploadAfter: cdk.Duration.minutes(30), - enabled: false, - expiration: cdk.Duration.days(30), - expirationDate: new Date(), - expiredObjectDeleteMarker: false, - id: 'id', - noncurrentVersionExpiration: cdk.Duration.days(30), - - // the properties below are optional - noncurrentVersionsToRetain: 123, - noncurrentVersionTransitions: [ - { - storageClass: s3.StorageClass.GLACIER, - transitionAfter: cdk.Duration.days(30), - - // the properties below are optional - noncurrentVersionsToRetain: 123, - }, - ], - objectSizeGreaterThan: 500, - prefix: 'prefix', - objectSizeLessThan: 10000, - transitions: [ - { - storageClass: s3.StorageClass.GLACIER, - - // the properties below are optional - transitionAfter: cdk.Duration.days(30), - transitionDate: new Date(), - }, - ], - }, - ], -}); -``` - -## Object Lock Configuration - -[Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html) -can be configured to enable a write-once-read-many model for an S3 bucket. Object Lock must be -configured when a bucket is created; if a bucket is created without Object Lock, it cannot be -enabled later via the CDK. - -Object Lock can be enabled on an S3 bucket by specifying: - -```ts -const bucket = new s3.Bucket(this, 'MyBucket', { - objectLockEnabled: true, -}); -``` - -Usually, it is desired to not just enable Object Lock for a bucket but to also configure a -[retention mode](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html#object-lock-retention-modes) -and a [retention period](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html#object-lock-retention-periods). -These can be specified by providing `objectLockDefaultRetention`: - -```ts -// Configure for governance mode with a duration of 7 years -new s3.Bucket(this, 'Bucket1', { - objectLockDefaultRetention: s3.ObjectLockRetention.governance(cdk.Duration.days(7 * 365)), -}); - -// Configure for compliance mode with a duration of 1 year -new s3.Bucket(this, 'Bucket2', { - objectLockDefaultRetention: s3.ObjectLockRetention.compliance(cdk.Duration.days(365)), -}); -``` diff --git a/packages/@aws-cdk/aws-s3/jest.config.js b/packages/@aws-cdk/aws-s3/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-s3/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3/lib/rule.ts b/packages/@aws-cdk/aws-s3/lib/rule.ts deleted file mode 100644 index 63715342e503d..0000000000000 --- a/packages/@aws-cdk/aws-s3/lib/rule.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { Duration } from '@aws-cdk/core'; - -/** - * Declaration of a Life cycle rule - */ -export interface LifecycleRule { - /** - * A unique identifier for this rule. The value cannot be more than 255 characters. - */ - readonly id?: string; - - /** - * Whether this rule is enabled. - * - * @default true - */ - readonly enabled?: boolean; - - /** - * Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. - * - * The AbortIncompleteMultipartUpload property type creates a lifecycle - * rule that aborts incomplete multipart uploads to an Amazon S3 bucket. - * When Amazon S3 aborts a multipart upload, it deletes all parts - * associated with the multipart upload. - * - * The underlying configuration is expressed in whole numbers of days. Providing a Duration that - * does not represent a whole number of days will result in a runtime or deployment error. - * - * @default - Incomplete uploads are never aborted - */ - readonly abortIncompleteMultipartUploadAfter?: Duration; - - /** - * Indicates when objects are deleted from Amazon S3 and Amazon Glacier. - * - * The date value must be in ISO 8601 format. The time is always midnight UTC. - * - * If you specify an expiration and transition time, you must use the same - * time unit for both properties (either in days or by date). The - * expiration time must also be later than the transition time. - * - * @default - No expiration date - */ - readonly expirationDate?: Date; - - /** - * Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier. - * - * If you specify an expiration and transition time, you must use the same - * time unit for both properties (either in days or by date). The - * expiration time must also be later than the transition time. - * - * The underlying configuration is expressed in whole numbers of days. Providing a Duration that - * does not represent a whole number of days will result in a runtime or deployment error. - * - * @default - No expiration timeout - */ - readonly expiration?: Duration; - - /** - * Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire. - * - * For buckets with versioning enabled (or suspended), specifies the time, - * in days, between when a new version of the object is uploaded to the - * bucket and when old versions of the object expire. When object versions - * expire, Amazon S3 permanently deletes them. If you specify a transition - * and expiration time, the expiration time must be later than the - * transition time. - * - * The underlying configuration is expressed in whole numbers of days. Providing a Duration that - * does not represent a whole number of days will result in a runtime or deployment error. - * - * @default - No noncurrent version expiration - */ - readonly noncurrentVersionExpiration?: Duration; - - /** - * Indicates a maximum number of noncurrent versions to retain. - * - * If there are this many more noncurrent versions, - * Amazon S3 permanently deletes them. - * - * @default - No noncurrent versions to retain - */ - readonly noncurrentVersionsToRetain?: number; - - /** - * One or more transition rules that specify when non-current objects transition to a specified storage class. - * - * Only for for buckets with versioning enabled (or suspended). - * - * If you specify a transition and expiration time, the expiration time - * must be later than the transition time. - */ - readonly noncurrentVersionTransitions?: NoncurrentVersionTransition[]; - - /** - * One or more transition rules that specify when an object transitions to a specified storage class. - * - * If you specify an expiration and transition time, you must use the same - * time unit for both properties (either in days or by date). The - * expiration time must also be later than the transition time. - * - * @default - No transition rules - */ - readonly transitions?: Transition[]; - - /** - * Object key prefix that identifies one or more objects to which this rule applies. - * - * @default - Rule applies to all objects - */ - readonly prefix?: string; - - /** - * The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket. - * - * @default - Rule applies to all objects - */ - readonly tagFilters?: {[tag: string]: any}; - - /** - * Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. - * If set to true, the delete marker will be expired. - * - * @default false - */ - readonly expiredObjectDeleteMarker?: boolean; - - /** - * Specifies the maximum object size in bytes for this rule to apply to. - * - * @default - No rule - */ - readonly objectSizeLessThan?: number; - - /** Specifies the minimum object size in bytes for this rule to apply to. - * - * @default - No rule - */ - readonly objectSizeGreaterThan?: number; -} - -/** - * Describes when an object transitions to a specified storage class. - */ -export interface Transition { - /** - * The storage class to which you want the object to transition. - */ - readonly storageClass: StorageClass; - - /** - * Indicates when objects are transitioned to the specified storage class. - * - * The date value must be in ISO 8601 format. The time is always midnight UTC. - * - * @default - No transition date. - */ - readonly transitionDate?: Date; - - /** - * Indicates the number of days after creation when objects are transitioned to the specified storage class. - * - * @default - No transition count. - */ - readonly transitionAfter?: Duration; -} - -/** - * Describes when noncurrent versions transition to a specified storage class. - */ -export interface NoncurrentVersionTransition { - /** - * The storage class to which you want the object to transition. - */ - readonly storageClass: StorageClass; - - /** - * Indicates the number of days after creation when objects are transitioned to the specified storage class. - * - * @default - No transition count. - */ - readonly transitionAfter: Duration; - - /** - * Indicates the number of noncurrent version objects to be retained. Can be up to 100 noncurrent versions retained. - * - * @default - No noncurrent version retained. - */ - readonly noncurrentVersionsToRetain?: number; -} - -/** - * Storage class to move an object to - */ -export class StorageClass { - /** - * Storage class for data that is accessed less frequently, but requires rapid - * access when needed. - * - * Has lower availability than Standard storage. - */ - public static readonly INFREQUENT_ACCESS = new StorageClass('STANDARD_IA'); - - /** - * Infrequent Access that's only stored in one availability zone. - * - * Has lower availability than standard InfrequentAccess. - */ - public static readonly ONE_ZONE_INFREQUENT_ACCESS = new StorageClass('ONEZONE_IA'); - - /** - * Storage class for long-term archival that can take between minutes and - * hours to access. - * - * Use for archives where portions of the data might need to be retrieved in - * minutes. Data stored in the GLACIER storage class has a minimum storage - * duration period of 90 days and can be accessed in as little as 1-5 minutes - * using expedited retrieval. If you delete an object before the 90-day - * minimum, you are charged for 90 days. - */ - public static readonly GLACIER = new StorageClass('GLACIER'); - - /** - * Storage class for long-term archival that can be accessed in a few milliseconds. - * - * It is ideal for data that is accessed once or twice per quarter, and - * that requires immediate access. Data stored in the GLACIER_IR storage class - * has a minimum storage duration period of 90 days and can be accessed in - * as milliseconds. If you delete an object before the 90-day minimum, - * you are charged for 90 days. - */ - public static readonly GLACIER_INSTANT_RETRIEVAL = new StorageClass('GLACIER_IR'); - - /** - * Use for archiving data that rarely needs to be accessed. Data stored in the - * DEEP_ARCHIVE storage class has a minimum storage duration period of 180 - * days and a default retrieval time of 12 hours. If you delete an object - * before the 180-day minimum, you are charged for 180 days. For pricing - * information, see Amazon S3 Pricing. - */ - public static readonly DEEP_ARCHIVE = new StorageClass('DEEP_ARCHIVE'); - - /** - * The INTELLIGENT_TIERING storage class is designed to optimize storage costs - * by automatically moving data to the most cost-effective storage access - * tier, without performance impact or operational overhead. - * INTELLIGENT_TIERING delivers automatic cost savings by moving data on a - * granular object level between two access tiers, a frequent access tier and - * a lower-cost infrequent access tier, when access patterns change. The - * INTELLIGENT_TIERING storage class is ideal if you want to optimize storage - * costs automatically for long-lived data when access patterns are unknown or - * unpredictable. - */ - public static readonly INTELLIGENT_TIERING = new StorageClass('INTELLIGENT_TIERING'); - - constructor(public readonly value: string) { } - - public toString() { return this.value; } -} diff --git a/packages/@aws-cdk/aws-s3/lib/util.ts b/packages/@aws-cdk/aws-s3/lib/util.ts deleted file mode 100644 index 43bf816be6840..0000000000000 --- a/packages/@aws-cdk/aws-s3/lib/util.ts +++ /dev/null @@ -1,40 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { IConstruct } from 'constructs'; -import { BucketAttributes } from './bucket'; - -export function parseBucketArn(construct: IConstruct, props: BucketAttributes): string { - - // if we have an explicit bucket ARN, use it. - if (props.bucketArn) { - return props.bucketArn; - } - - if (props.bucketName) { - return cdk.Stack.of(construct).formatArn({ - // S3 Bucket names are globally unique in a partition, - // and so their ARNs have empty region and account components - region: '', - account: '', - service: 's3', - resource: props.bucketName, - }); - } - - throw new Error('Cannot determine bucket ARN. At least `bucketArn` or `bucketName` is needed'); -} - -export function parseBucketName(construct: IConstruct, props: BucketAttributes): string | undefined { - - // if we have an explicit bucket name, use it. - if (props.bucketName) { - return props.bucketName; - } - - // extract bucket name from bucket arn - if (props.bucketArn) { - return cdk.Stack.of(construct).splitArn(props.bucketArn, cdk.ArnFormat.SLASH_RESOURCE_NAME).resource; - } - - // no bucket name is okay since it's optional. - return undefined; -} diff --git a/packages/@aws-cdk/aws-s3/package.json b/packages/@aws-cdk/aws-s3/package.json deleted file mode 100644 index 3a40c7e810fdc..0000000000000 --- a/packages/@aws-cdk/aws-s3/package.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "name": "@aws-cdk/aws-s3", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::S3", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "private": true, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.s3", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "s3" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.S3", - "packageId": "Amazon.CDK.AWS.S3", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-s3", - "module": "aws_cdk.aws_s3", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-s3" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::S3", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "s3" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-s3.BucketPolicyProps", - "no-unused-type:@aws-cdk/aws-s3.Location", - "props-default-doc:@aws-cdk/aws-s3.BucketAttributes.bucketDualStackDomainName", - "docs-public-apis:@aws-cdk/aws-s3.RedirectProtocol.HTTPS", - "docs-public-apis:@aws-cdk/aws-s3.RedirectProtocol.HTTP", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess.BLOCK_ACLS", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess.BLOCK_ALL", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess.blockPublicAcls", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess.blockPublicPolicy", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess.ignorePublicAcls", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccess.restrictPublicBuckets", - "docs-public-apis:@aws-cdk/aws-s3.Bucket.fromBucketArn", - "docs-public-apis:@aws-cdk/aws-s3.Bucket.fromBucketName", - "docs-public-apis:@aws-cdk/aws-s3.ReplaceKey", - "docs-public-apis:@aws-cdk/aws-s3.ReplaceKey.prefixWithKey", - "docs-public-apis:@aws-cdk/aws-s3.ReplaceKey.withKey", - "docs-public-apis:@aws-cdk/aws-s3.StorageClass.value", - "docs-public-apis:@aws-cdk/aws-s3.StorageClass.toString", - "docs-public-apis:@aws-cdk/aws-s3.BlockPublicAccessOptions", - "props-default-doc:@aws-cdk/aws-s3.BlockPublicAccessOptions.blockPublicAcls", - "props-default-doc:@aws-cdk/aws-s3.BlockPublicAccessOptions.blockPublicPolicy", - "props-default-doc:@aws-cdk/aws-s3.BlockPublicAccessOptions.ignorePublicAcls", - "props-default-doc:@aws-cdk/aws-s3.BlockPublicAccessOptions.restrictPublicBuckets", - "props-default-doc:@aws-cdk/aws-s3.BucketAttributes.bucketArn", - "docs-public-apis:@aws-cdk/aws-s3.BucketNotificationDestinationType.TOPIC", - "props-default-doc:@aws-cdk/aws-s3.BucketAttributes.bucketName", - "props-default-doc:@aws-cdk/aws-s3.BucketAttributes.bucketRegionalDomainName", - "docs-public-apis:@aws-cdk/aws-s3.BucketAttributes.encryptionKey", - "props-default-doc:@aws-cdk/aws-s3.BucketAttributes.encryptionKey", - "props-default-doc:@aws-cdk/aws-s3.BucketMetrics.prefix", - "props-default-doc:@aws-cdk/aws-s3.BucketMetrics.tagFilters", - "props-default-doc:@aws-cdk/aws-s3.BucketNotificationDestinationConfig.dependencies", - "docs-public-apis:@aws-cdk/aws-s3.BucketPolicyProps", - "docs-public-apis:@aws-cdk/aws-s3.BucketProps", - "docs-public-apis:@aws-cdk/aws-s3.IBucket", - "props-default-doc:@aws-cdk/aws-s3.LifecycleRule.id", - "props-default-doc:@aws-cdk/aws-s3.LifecycleRule.noncurrentVersionTransitions", - "props-default-doc:@aws-cdk/aws-s3.Location.objectVersion", - "docs-public-apis:@aws-cdk/aws-s3.NotificationKeyFilter", - "props-default-doc:@aws-cdk/aws-s3.NotificationKeyFilter.prefix", - "props-default-doc:@aws-cdk/aws-s3.NotificationKeyFilter.suffix", - "docs-public-apis:@aws-cdk/aws-s3.RoutingRuleCondition", - "docs-public-apis:@aws-cdk/aws-s3.BucketNotificationDestinationType.LAMBDA", - "docs-public-apis:@aws-cdk/aws-s3.BucketNotificationDestinationType.QUEUE" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-s3/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-s3/rosetta/default.ts-fixture deleted file mode 100644 index de01c16af1e9a..0000000000000 --- a/packages/@aws-cdk/aws-s3/rosetta/default.ts-fixture +++ /dev/null @@ -1,18 +0,0 @@ -// Fixture with packages imported, but nothing else -import cdk = require('@aws-cdk/core'); -import s3 = require('@aws-cdk/aws-s3'); -import kms = require('@aws-cdk/aws-kms'); -import iam = require('@aws-cdk/aws-iam'); -import lambda = require('@aws-cdk/aws-lambda'); -import s3n = require('@aws-cdk/aws-s3-notifications'); -import sns = require('@aws-cdk/aws-sns'); -import sqs = require('@aws-cdk/aws-sqs'); -import assert = require('assert'); - -class Fixture extends cdk.Stack { - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-s3/test/aspect.test.ts b/packages/@aws-cdk/aws-s3/test/aspect.test.ts deleted file mode 100644 index dd0acd0b8a65e..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/aspect.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Annotations } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { IConstruct } from 'constructs'; -import * as s3 from '../lib'; - -describe('aspect', () => { - test('bucket must have versioning: failure', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new s3.Bucket(stack, 'MyBucket'); - - // WHEN - cdk.Aspects.of(stack).add(new BucketVersioningChecker()); - - // THEN - Annotations.fromStack(stack).hasError('/Default/MyBucket/Resource', 'Bucket versioning is not enabled'); - }); - - test('bucket must have versioning: success', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app); - new s3.Bucket(stack, 'MyBucket', { - versioned: true, - }); - - // WHEN - cdk.Aspects.of(stack).add(new BucketVersioningChecker()); - - // THEN - Annotations.fromStack(stack).hasNoError('/Default/MyBucket/Resource', 'Bucket versioning is not enabled'); - }); -}); - -class BucketVersioningChecker implements cdk.IAspect { - public visit(node: IConstruct): void { - if (node instanceof s3.CfnBucket) { - if (!node.versioningConfiguration || - (!cdk.Tokenization.isResolvable(node.versioningConfiguration) && node.versioningConfiguration.status !== 'Enabled')) { - cdk.Annotations.of(node).addError('Bucket versioning is not enabled'); - } - } - } -} diff --git a/packages/@aws-cdk/aws-s3/test/cors.test.ts b/packages/@aws-cdk/aws-s3/test/cors.test.ts deleted file mode 100644 index 3d625a3bd4bf5..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/cors.test.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; -import { Bucket, HttpMethods } from '../lib'; - -describe('cors', () => { - test('Can use addCors() to add a CORS configuration', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const bucket = new Bucket(stack, 'Bucket'); - bucket.addCorsRule({ - allowedMethods: [HttpMethods.GET, HttpMethods.HEAD], - allowedOrigins: ['https://example.com'], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - CorsConfiguration: { - CorsRules: [{ - AllowedMethods: ['GET', 'HEAD'], - AllowedOrigins: ['https://example.com'], - }], - }, - }); - }); - - test('Bucket with multiple cors configurations', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - new Bucket(stack, 'Bucket', { - cors: [ - { - allowedHeaders: [ - '*', - ], - allowedMethods: [ - HttpMethods.GET, - ], - allowedOrigins: [ - '*', - ], - exposedHeaders: [ - 'Date', - ], - id: 'myCORSRuleId1', - maxAge: 3600, - }, - { - allowedHeaders: [ - 'x-amz-*', - ], - allowedMethods: [ - HttpMethods.DELETE, - ], - allowedOrigins: [ - 'http://www.example1.com', - 'http://www.example2.com', - ], - exposedHeaders: [ - 'Connection', - 'Server', - 'Date', - ], - id: 'myCORSRuleId2', - maxAge: 1800, - }, - ], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - CorsConfiguration: { - CorsRules: [ - { - AllowedHeaders: [ - '*', - ], - AllowedMethods: [ - 'GET', - ], - AllowedOrigins: [ - '*', - ], - ExposedHeaders: [ - 'Date', - ], - Id: 'myCORSRuleId1', - MaxAge: 3600, - }, - { - AllowedHeaders: [ - 'x-amz-*', - ], - AllowedMethods: [ - 'DELETE', - ], - AllowedOrigins: [ - 'http://www.example1.com', - 'http://www.example2.com', - ], - ExposedHeaders: [ - 'Connection', - 'Server', - 'Date', - ], - Id: 'myCORSRuleId2', - MaxAge: 1800, - }, - ], - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.ts deleted file mode 100644 index c7c07620fc9fb..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-grant-write.ts +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env node -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-s3'); - -const bucket = new s3.Bucket(stack, 'MyBucket', { - encryption: s3.BucketEncryption.S3_MANAGED, - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -const user = new iam.User(stack, 'MyUser'); - -bucket.grantWrite(user, '*', ['s3:PutObject', 's3:DeleteObject*']); - -new integ.IntegTest(app, 'BucketGrantWriteTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.ts deleted file mode 100644 index 8faecb66bb2bf..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-grantdelete-kms.ts +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env node -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-s3'); - -const key = new kms.Key(stack, 'MyKey'); -const deleter = new iam.User(stack, 'Deleter'); -const bucket = new s3.Bucket(stack, 'MyBucket', { - encryptionKey: key, - encryption: s3.BucketEncryption.KMS, -}); - -// when -bucket.grantDelete(deleter); - -new IntegTest(app, 'cdk-integ-s3-grant-delete-kms', { - testCases: [stack], -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.ts deleted file mode 100644 index 1419e1d0e0b64..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket-intelligent-tiering.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { App, Duration, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import * as s3 from '../lib/index'; - -const app = new App(); - -const stack = new Stack(app, 'aws-cdk-s3'); - -new s3.Bucket(stack, 'MyBucket', { - intelligentTieringConfigurations: [{ - name: 'foo', - prefix: 'bar', - archiveAccessTierTime: Duration.days(90), - deepArchiveAccessTierTime: Duration.days(180), - tags: [{ key: 'test', value: 'bazz' }], - }], -}); - - -new IntegTest(app, 'cdk-integ-intelligent-tiering', { - testCases: [stack], -}); diff --git a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.ts b/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.ts deleted file mode 100644 index c8a16e067d8a6..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/integ.bucket.notifications.ts +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env node -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import * as s3 from '../lib'; - -const app = new cdk.App(); - -const stack = new cdk.Stack(app, 'aws-cdk-s3-notifications'); - -new s3.Bucket(stack, 'MyEventBridgeBucket', { - eventBridgeEnabled: true, - removalPolicy: cdk.RemovalPolicy.DESTROY, -}); - -new integ.IntegTest(app, 'NotificationTest', { - testCases: [stack], -}); diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.ts b/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.ts deleted file mode 100644 index eaaab2e6f25db..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/integ.lifecycle-expiration.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { App, Duration, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Bucket } from '../lib'; - -const app = new App(); - -const stack = new Stack(app, 'aws-cdk-s3'); - -new Bucket(stack, 'MyBucket', { - lifecycleRules: [{ - noncurrentVersionExpiration: Duration.days(30), - noncurrentVersionsToRetain: 123, - }], -}); - -new IntegTest(app, 'cdk-integ-lifecycle-expiration', { - testCases: [stack], -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts b/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts deleted file mode 100644 index af506cbdd658e..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/integ.lifecycle.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { App, RemovalPolicy, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Bucket } from '../lib'; - -const app = new App(); - -const stack = new Stack(app, 'aws-cdk-s3'); - -// Test a lifecycle rule with an expiration DATE -new Bucket(stack, 'MyBucket', { - lifecycleRules: [ - { - expirationDate: new Date('2019-10-01'), - }, - { - expirationDate: new Date('2019-10-01'), - objectSizeLessThan: 600, - objectSizeGreaterThan: 500, - }, - ], - removalPolicy: RemovalPolicy.DESTROY, -}); - -new IntegTest(app, 'cdk-integ-lifecycle', { - testCases: [stack], -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/metrics.test.ts b/packages/@aws-cdk/aws-s3/test/metrics.test.ts deleted file mode 100644 index 8f0b47c5c076c..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/metrics.test.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; -import { Bucket } from '../lib'; - -describe('metrics', () => { - test('Can use addMetrics() to add a metric configuration', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const bucket = new Bucket(stack, 'Bucket'); - bucket.addMetric({ - id: 'test', - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - MetricsConfigurations: [{ - Id: 'test', - }], - }); - }); - - test('Bucket with metrics on prefix', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - new Bucket(stack, 'Bucket', { - metrics: [{ - id: 'test', - prefix: 'prefix', - }], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - MetricsConfigurations: [{ - Id: 'test', - Prefix: 'prefix', - }], - }); - }); - - test('Bucket with metrics on tag filter', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - new Bucket(stack, 'Bucket', { - metrics: [{ - id: 'test', - tagFilters: { tagname1: 'tagvalue1', tagname2: 'tagvalue2' }, - }], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - MetricsConfigurations: [{ - Id: 'test', - TagFilters: [ - { Key: 'tagname1', Value: 'tagvalue1' }, - { Key: 'tagname2', Value: 'tagvalue2' }, - ], - }], - }); - }); - - test('Bucket with multiple metric configurations', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - new Bucket(stack, 'Bucket', { - metrics: [ - { - id: 'test', - tagFilters: { tagname1: 'tagvalue1', tagname2: 'tagvalue2' }, - - }, - { - id: 'test2', - prefix: 'prefix', - }, - ], - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { - MetricsConfigurations: [{ - Id: 'test', - TagFilters: [ - { Key: 'tagname1', Value: 'tagvalue1' }, - { Key: 'tagname2', Value: 'tagvalue2' }, - ], - }, - { - Id: 'test2', - Prefix: 'prefix', - }], - }); - }); -}); diff --git a/packages/@aws-cdk/aws-s3/test/notifications-resource.lambda.test.ts b/packages/@aws-cdk/aws-s3/test/notifications-resource.lambda.test.ts deleted file mode 100644 index 7a5e043993614..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/notifications-resource.lambda.test.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { spawnSync } from 'child_process'; -import * as path from 'path'; - -test('notifications handler', () => { - const testScript = path.join(__dirname, 'notifications-resource-handler', 'test.sh'); - const result = spawnSync(testScript, { stdio: 'inherit' }); - expect(result.status).toBe(0); -}); diff --git a/packages/@aws-cdk/aws-s3/test/util.test.ts b/packages/@aws-cdk/aws-s3/test/util.test.ts deleted file mode 100644 index c04c8a3bafa19..0000000000000 --- a/packages/@aws-cdk/aws-s3/test/util.test.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import { parseBucketArn, parseBucketName } from '../lib/util'; - -describe('utils', () => { - describe('parseBucketArn', () => { - test('explicit arn', () => { - const stack = new cdk.Stack(); - const bucketArn = 'my:bucket:arn'; - expect(parseBucketArn(stack, { bucketArn })).toEqual(bucketArn); - }); - - test('produce arn from bucket name', () => { - const stack = new cdk.Stack(); - const bucketName = 'hello'; - expect(stack.resolve(parseBucketArn(stack, { bucketName }))).toEqual({ - 'Fn::Join': - ['', - ['arn:', - { Ref: 'AWS::Partition' }, - ':s3:::hello']], - }); - }); - - test('fails if neither arn nor name are provided', () => { - const stack = new cdk.Stack(); - expect(() => parseBucketArn(stack, {})).toThrow(/Cannot determine bucket ARN. At least `bucketArn` or `bucketName` is needed/); - }); - }); - - describe('parseBucketName', () => { - - test('explicit name', () => { - const stack = new cdk.Stack(); - const bucketName = 'foo'; - expect(stack.resolve(parseBucketName(stack, { bucketName }))).toEqual('foo'); - }); - - test('extract bucket name from string arn', () => { - const stack = new cdk.Stack(); - const bucketArn = 'arn:aws:s3:::my-bucket'; - expect(stack.resolve(parseBucketName(stack, { bucketArn }))).toEqual('my-bucket'); - }); - - test('can parse bucket name even if it contains a token', () => { - const stack = new cdk.Stack(); - const bucketArn = `arn:aws:s3:::${cdk.Token.asString({ Ref: 'my-bucket' })}`; - - expect( - stack.resolve(parseBucketName(stack, { bucketArn })), - ).toEqual( - { Ref: 'my-bucket' }, - ); - }); - - test('fails if ARN has invalid format', () => { - const stack = new cdk.Stack(); - const bucketArn = 'invalid-arn'; - expect(() => parseBucketName(stack, { bucketArn })).toThrow(/ARNs must/); - }); - }); -}); diff --git a/packages/@aws-cdk/aws-s3objectlambda/.eslintrc.js b/packages/@aws-cdk/aws-s3objectlambda/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/.eslintrc.js +++ b/packages/@aws-cdk/aws-s3objectlambda/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3objectlambda/.gitignore b/packages/@aws-cdk/aws-s3objectlambda/.gitignore index a103aefa2bfbb..276e2e169d01b 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/.gitignore +++ b/packages/@aws-cdk/aws-s3objectlambda/.gitignore @@ -22,3 +22,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-s3objectlambda/README.md b/packages/@aws-cdk/aws-s3objectlambda/README.md index 35deed15685a9..a1c2e7d632401 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/README.md +++ b/packages/@aws-cdk/aws-s3objectlambda/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -24,10 +18,10 @@ This construct library allows you to define S3 object lambda access points. ```ts -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda'; -import * as cdk from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha'; +import * as cdk from 'aws-cdk-lib'; const stack = new cdk.Stack(); const bucket = new s3.Bucket(stack, 'MyBucket'); @@ -51,10 +45,10 @@ new s3objectlambda.AccessPoint(stack, 'MyObjectLambda', { Lambdas are currently limited to only transforming `GetObject` requests. However, they can additionally support `GetObject-Range` and `GetObject-PartNumber` requests, which needs to be specified in the access point configuration: ```ts -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda'; -import * as cdk from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha'; +import * as cdk from 'aws-cdk-lib'; const stack = new cdk.Stack(); const bucket = new s3.Bucket(stack, 'MyBucket'); @@ -77,10 +71,10 @@ new s3objectlambda.AccessPoint(stack, 'MyObjectLambda', { You can specify an additional object that provides supplemental data to the Lambda function used to transform objects. The data is delivered as a JSON payload to the Lambda: ```ts -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda'; -import * as cdk from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3objectlambda from '@aws-cdk/aws-s3objectlambda-alpha'; +import * as cdk from 'aws-cdk-lib'; const stack = new cdk.Stack(); const bucket = new s3.Bucket(stack, 'MyBucket'); diff --git a/packages/@aws-cdk/aws-s3objectlambda/lib/access-point.ts b/packages/@aws-cdk/aws-s3objectlambda/lib/access-point.ts index 43012979e2863..7ece7df575980 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/lib/access-point.ts +++ b/packages/@aws-cdk/aws-s3objectlambda/lib/access-point.ts @@ -1,9 +1,9 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as core from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as core from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { CfnAccessPoint } from './s3objectlambda.generated'; +import { CfnAccessPoint } from 'aws-cdk-lib/aws-s3objectlambda'; /** * The interface that represents the AccessPoint resource. diff --git a/packages/@aws-cdk/aws-s3objectlambda/lib/index.ts b/packages/@aws-cdk/aws-s3objectlambda/lib/index.ts index e3c96c8d8be85..a40b5b3b142c0 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/lib/index.ts +++ b/packages/@aws-cdk/aws-s3objectlambda/lib/index.ts @@ -1,4 +1,3 @@ export * from './access-point'; // AWS::S3ObjectLambda CloudFormation Resources: -export * from './s3objectlambda.generated'; diff --git a/packages/@aws-cdk/aws-s3objectlambda/package.json b/packages/@aws-cdk/aws-s3objectlambda/package.json index 4350a6bf9cc77..84afe2c60bd9c 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/package.json +++ b/packages/@aws-cdk/aws-s3objectlambda/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-cdk/aws-s3objectlambda", + "name": "@aws-cdk/aws-s3objectlambda-alpha", "version": "0.0.0", "description": "The CDK Construct Library for AWS::S3ObjectLambda", "main": "lib/index.js", @@ -9,17 +9,17 @@ "projectReferences": true, "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.S3ObjectLambda", - "packageId": "Amazon.CDK.AWS.S3ObjectLambda", + "namespace": "Amazon.CDK.AWS.S3ObjectLambda.Alpha", + "packageId": "Amazon.CDK.AWS.S3ObjectLambda.Alpha", "signAssembly": true, "assemblyOriginatorKeyFile": "../../key.snk", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.s3objectlambda", + "package": "software.amazon.awscdk.services.s3objectlambda.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "s3objectlambda" + "artifactId": "s3objectlambda-alpha" } }, "python": { @@ -27,8 +27,12 @@ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ], - "distName": "aws-cdk.aws-s3objectlambda", - "module": "aws_cdk.aws_s3objectlambda" + "distName": "aws-cdk.aws-s3objectlambda-alpha", + "module": "aws_cdk.aws_s3objectlambda_alpha" + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdks3objectlambdaalpha" } }, "metadata": { @@ -54,17 +58,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::S3ObjectLambda", "env": { "AWSLINT_BASE_CONSTRUCT": "true" } @@ -83,26 +84,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "jest": "^27.5.1", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -114,12 +107,18 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" }, "awslint": { "exclude": [ - "attribute-tag:@aws-cdk/aws-s3objectlambda.AccessPoint.accessPointName" + "*:*" ] }, - "private": true + "private": false, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + } } diff --git a/packages/@aws-cdk/aws-s3objectlambda/test/integ.s3objectlambda.ts b/packages/@aws-cdk/aws-s3objectlambda/test/integ.s3objectlambda.ts index 79173d72d19c5..ff85858ee0592 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/test/integ.s3objectlambda.ts +++ b/packages/@aws-cdk/aws-s3objectlambda/test/integ.s3objectlambda.ts @@ -1,6 +1,6 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { AccessPoint } from '../lib'; class TestStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-s3objectlambda/test/s3objectlambda.test.ts b/packages/@aws-cdk/aws-s3objectlambda/test/s3objectlambda.test.ts index 3e62fd370f039..c0f1171ccef7a 100644 --- a/packages/@aws-cdk/aws-s3objectlambda/test/s3objectlambda.test.ts +++ b/packages/@aws-cdk/aws-s3objectlambda/test/s3objectlambda.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { AccessPoint } from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-s3outposts/.eslintrc.js b/packages/@aws-cdk/aws-s3outposts/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3outposts/.gitignore b/packages/@aws-cdk/aws-s3outposts/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-s3outposts/.npmignore b/packages/@aws-cdk/aws-s3outposts/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-s3outposts/LICENSE b/packages/@aws-cdk/aws-s3outposts/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-s3outposts/NOTICE b/packages/@aws-cdk/aws-s3outposts/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-s3outposts/README.md b/packages/@aws-cdk/aws-s3outposts/README.md deleted file mode 100644 index f14dbb78f5d19..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::S3Outposts Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as s3outposts from '@aws-cdk/aws-s3outposts'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for S3Outposts construct libraries](https://constructs.dev/search?q=s3outposts) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::S3Outposts resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_S3Outposts.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::S3Outposts](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_S3Outposts.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-s3outposts/jest.config.js b/packages/@aws-cdk/aws-s3outposts/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-s3outposts/lib/index.ts b/packages/@aws-cdk/aws-s3outposts/lib/index.ts deleted file mode 100644 index 06c96e7c920bc..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::S3Outposts CloudFormation Resources: -export * from './s3outposts.generated'; diff --git a/packages/@aws-cdk/aws-s3outposts/package.json b/packages/@aws-cdk/aws-s3outposts/package.json deleted file mode 100644 index 3def157cb2d2c..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-s3outposts", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::S3Outposts", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.S3Outposts", - "packageId": "Amazon.CDK.AWS.S3Outposts", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.s3outposts", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "s3outposts" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-s3outposts", - "module": "aws_cdk.aws_s3outposts" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-s3outposts" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::S3Outposts", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::S3Outposts", - "aws-s3outposts" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-s3outposts/test/s3outposts.test.ts b/packages/@aws-cdk/aws-s3outposts/test/s3outposts.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-s3outposts/test/s3outposts.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-sagemaker/.eslintrc.js b/packages/@aws-cdk/aws-sagemaker/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-sagemaker/.eslintrc.js +++ b/packages/@aws-cdk/aws-sagemaker/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sagemaker/.gitignore b/packages/@aws-cdk/aws-sagemaker/.gitignore index ac4ba3ab6a8a9..2d5f0169c1eb3 100644 --- a/packages/@aws-cdk/aws-sagemaker/.gitignore +++ b/packages/@aws-cdk/aws-sagemaker/.gitignore @@ -20,3 +20,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-sagemaker/README.md b/packages/@aws-cdk/aws-sagemaker/README.md index c68562d7759fe..6acf7a591524a 100644 --- a/packages/@aws-cdk/aws-sagemaker/README.md +++ b/packages/@aws-cdk/aws-sagemaker/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -41,7 +35,7 @@ In the event that a single container is sufficient for your inference use-case, single-container model: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; import * as path from 'path'; const image = sagemaker.ContainerImage.fromAsset(path.join('path', 'to', 'Dockerfile', 'directory')); @@ -66,7 +60,7 @@ more about SageMaker inference pipelines. To define an inference pipeline, you c additional containers for your model: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; declare const image1: sagemaker.ContainerImage; declare const modelData1: sagemaker.ModelData; @@ -95,7 +89,7 @@ abstract base class. Reference a local directory containing a Dockerfile: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; import * as path from 'path'; const image = sagemaker.ContainerImage.fromAsset(path.join('path', 'to', 'Dockerfile', 'directory')); @@ -106,8 +100,8 @@ const image = sagemaker.ContainerImage.fromAsset(path.join('path', 'to', 'Docker Reference an image available within ECR: ```typescript -import * as ecr from '@aws-cdk/aws-ecr'; -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; const repository = ecr.Repository.fromRepositoryName(this, 'Repository', 'repo'); const image = sagemaker.ContainerImage.fromEcrRepository(repository, 'tag'); @@ -125,7 +119,7 @@ base class. The default is to have no model artifacts associated with a model. Reference local model data: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; import * as path from 'path'; const modelData = sagemaker.ModelData.fromAsset(path.join('path', 'to', 'artifact', 'file.tar.gz')); @@ -136,8 +130,8 @@ const modelData = sagemaker.ModelData.fromAsset(path.join('path', 'to', 'artifac Reference an S3 bucket and object key as the artifacts for a model: ```typescript -import * as s3 from '@aws-cdk/aws-s3'; -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; const bucket = new s3.Bucket(this, 'MyBucket'); const modelData = sagemaker.ModelData.fromBucket(bucket, 'path/to/artifact/file.tar.gz'); @@ -161,7 +155,7 @@ for model B. Amazon SageMaker distributes two-thirds of the traffic to Model A, model B: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; declare const modelA: sagemaker.Model; declare const modelB: sagemaker.Model; @@ -192,7 +186,7 @@ more information about the API, see the API. Defining an endpoint requires at minimum the associated endpoint configuration: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; declare const endpointConfig: sagemaker.EndpointConfig; @@ -204,7 +198,7 @@ const endpoint = new sagemaker.Endpoint(this, 'Endpoint', { endpointConfig }); To enable autoscaling on the production variant, use the `autoScaleInstanceCount` method: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; declare const model: sagemaker.Model; @@ -237,7 +231,7 @@ To monitor CloudWatch metrics for a production variant, use one or more of the m methods: ```typescript -import * as sagemaker from '@aws-cdk/aws-sagemaker'; +import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha'; declare const endpointConfig: sagemaker.EndpointConfig; diff --git a/packages/@aws-cdk/aws-sagemaker/lib/accelerator-type.ts b/packages/@aws-cdk/aws-sagemaker/lib/accelerator-type.ts index cec364b4e9c1d..3c013782c3734 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/accelerator-type.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/accelerator-type.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; /** * Supported Elastic Inference (EI) instance types for SageMaker instance-based production variants. diff --git a/packages/@aws-cdk/aws-sagemaker/lib/container-image.ts b/packages/@aws-cdk/aws-sagemaker/lib/container-image.ts index d803ca82578eb..cab4de60c20a7 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/container-image.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/container-image.ts @@ -1,5 +1,5 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import * as assets from '@aws-cdk/aws-ecr-assets'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as assets from 'aws-cdk-lib/aws-ecr-assets'; import { Construct } from 'constructs'; import { Model } from './model'; import { hashcode } from './private/util'; diff --git a/packages/@aws-cdk/aws-sagemaker/lib/endpoint-config.ts b/packages/@aws-cdk/aws-sagemaker/lib/endpoint-config.ts index 3a148b420708f..40585f2f0e615 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/endpoint-config.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/endpoint-config.ts @@ -1,12 +1,12 @@ import { EOL } from 'os'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { AcceleratorType } from './accelerator-type'; import { InstanceType } from './instance-type'; import { IModel } from './model'; import { sameEnv } from './private/util'; -import { CfnEndpointConfig } from './sagemaker.generated'; +import { CfnEndpointConfig } from 'aws-cdk-lib/aws-sagemaker'; /** * The interface for a SageMaker EndpointConfig resource. diff --git a/packages/@aws-cdk/aws-sagemaker/lib/endpoint.ts b/packages/@aws-cdk/aws-sagemaker/lib/endpoint.ts index ab6debccd1695..9ccbf039890f9 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/endpoint.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/endpoint.ts @@ -1,14 +1,14 @@ import { EOL } from 'os'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as appscaling from 'aws-cdk-lib/aws-applicationautoscaling'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { EndpointConfig, IEndpointConfig, InstanceProductionVariant } from './endpoint-config'; import { InstanceType } from './instance-type'; import { sameEnv } from './private/util'; -import { CfnEndpoint } from './sagemaker.generated'; +import { CfnEndpoint } from 'aws-cdk-lib/aws-sagemaker'; import { ScalableInstanceCount } from './scalable-instance-count'; /* diff --git a/packages/@aws-cdk/aws-sagemaker/lib/index.ts b/packages/@aws-cdk/aws-sagemaker/lib/index.ts index 7e1c8abccbacd..3d2b2e1341b3c 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/index.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/index.ts @@ -8,4 +8,3 @@ export * from './model-data'; export * from './scalable-instance-count'; // AWS::SageMaker CloudFormation Resources: -export * from './sagemaker.generated'; diff --git a/packages/@aws-cdk/aws-sagemaker/lib/instance-type.ts b/packages/@aws-cdk/aws-sagemaker/lib/instance-type.ts index 08ee041b278bf..bb8351de4bb8b 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/instance-type.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/instance-type.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; /** * Supported instance types for SageMaker instance-based production variants. diff --git a/packages/@aws-cdk/aws-sagemaker/lib/model-data.ts b/packages/@aws-cdk/aws-sagemaker/lib/model-data.ts index 2d46a4d8762ad..8dd23619a1150 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/model-data.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/model-data.ts @@ -1,5 +1,5 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as assets from '@aws-cdk/aws-s3-assets'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as assets from 'aws-cdk-lib/aws-s3-assets'; import { Construct } from 'constructs'; import { IModel } from './model'; import { hashcode } from './private/util'; diff --git a/packages/@aws-cdk/aws-sagemaker/lib/model.ts b/packages/@aws-cdk/aws-sagemaker/lib/model.ts index 78b952647c235..ab04c28ca11ca 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/model.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/model.ts @@ -1,10 +1,10 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { ContainerImage } from './container-image'; import { ModelData } from './model-data'; -import { CfnModel } from './sagemaker.generated'; +import { CfnModel } from 'aws-cdk-lib/aws-sagemaker'; /** * Interface that defines a Model resource. diff --git a/packages/@aws-cdk/aws-sagemaker/lib/private/util.ts b/packages/@aws-cdk/aws-sagemaker/lib/private/util.ts index 3419c14f0d950..eab1ad1dbf6d2 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/private/util.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/private/util.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; +import * as cdk from 'aws-cdk-lib'; +import { md5hash } from 'aws-cdk-lib/core/lib/helpers-internal'; /** * Generates a hash from the provided string for the purposes of avoiding construct ID collision diff --git a/packages/@aws-cdk/aws-sagemaker/lib/scalable-instance-count.ts b/packages/@aws-cdk/aws-sagemaker/lib/scalable-instance-count.ts index 1bd2cb5f80158..3cbae1594088f 100644 --- a/packages/@aws-cdk/aws-sagemaker/lib/scalable-instance-count.ts +++ b/packages/@aws-cdk/aws-sagemaker/lib/scalable-instance-count.ts @@ -1,4 +1,4 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; +import * as appscaling from 'aws-cdk-lib/aws-applicationautoscaling'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-sagemaker/package.json b/packages/@aws-cdk/aws-sagemaker/package.json index 4de9941f99eec..3185ff0549321 100644 --- a/packages/@aws-cdk/aws-sagemaker/package.json +++ b/packages/@aws-cdk/aws-sagemaker/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-sagemaker", + "name": "@aws-cdk/aws-sagemaker-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::SageMaker", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "java": { - "package": "software.amazon.awscdk.services.sagemaker", + "package": "software.amazon.awscdk.services.sagemaker.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "sagemaker" + "artifactId": "sagemaker-alpha" } }, "dotnet": { - "namespace": "Amazon.CDK.AWS.Sagemaker", - "packageId": "Amazon.CDK.AWS.Sagemaker", + "namespace": "Amazon.CDK.AWS.Sagemaker.Alpha", + "packageId": "Amazon.CDK.AWS.Sagemaker.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "python": { - "distName": "aws-cdk.aws-sagemaker", - "module": "aws_cdk.aws_sagemaker", + "distName": "aws-cdk.aws-sagemaker-alpha", + "module": "aws_cdk.aws_sagemaker_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdksagemakeralpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "test": "cdk-test", "watch": "cdk-watch", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::SageMaker", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -81,41 +82,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" + "jest": "^27.5.1", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -128,5 +107,16 @@ }, "publishConfig": { "tag": "latest" + }, + "awslint": { + "exclude": [ + "*:*" + ] + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-sagemaker/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-sagemaker/rosetta/default.ts-fixture index 739d5078a0c5b..e4fae5f06e628 100644 --- a/packages/@aws-cdk/aws-sagemaker/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-sagemaker/rosetta/default.ts-fixture @@ -1,5 +1,5 @@ // Fixture with packages imported, but nothing else -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; class Fixture extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-sagemaker/test/endpoint-config.test.ts b/packages/@aws-cdk/aws-sagemaker/test/endpoint-config.test.ts index 681db3d5c2aaf..81c130b79068a 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/endpoint-config.test.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/endpoint-config.test.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as sagemaker from '../lib'; describe('When synthesizing a stack containing an EndpointConfig', () => { diff --git a/packages/@aws-cdk/aws-sagemaker/test/endpoint.test.ts b/packages/@aws-cdk/aws-sagemaker/test/endpoint.test.ts index 95cb9c97685bb..78e5082d9b357 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/endpoint.test.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/endpoint.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as sagemaker from '../lib'; describe('When searching an Endpoint for a production variant', () => { diff --git a/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint-config.ts b/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint-config.ts index c5f982a7d1297..b34de6977e109 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint-config.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint-config.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as sagemaker from '../lib'; /* diff --git a/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.alarms.ts b/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.alarms.ts index fd2bd60d80a75..32096989b6f9c 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.alarms.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.alarms.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as sagemaker from '../lib'; /* diff --git a/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.ts b/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.ts index e605096385bcc..164543d493b7c 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/integ.endpoint.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; +import { ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as sagemaker from '../lib'; /* diff --git a/packages/@aws-cdk/aws-sagemaker/test/integ.model.ts b/packages/@aws-cdk/aws-sagemaker/test/integ.model.ts index 60b7eab698472..f2d2a3ce09505 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/integ.model.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/integ.model.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr_assets from '@aws-cdk/aws-ecr-assets'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as cdk from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr_assets from 'aws-cdk-lib/aws-ecr-assets'; +import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as sagemaker from '../lib'; /* diff --git a/packages/@aws-cdk/aws-sagemaker/test/model.test.ts b/packages/@aws-cdk/aws-sagemaker/test/model.test.ts index 043d6e858d489..7b4f33fa46cb1 100644 --- a/packages/@aws-cdk/aws-sagemaker/test/model.test.ts +++ b/packages/@aws-cdk/aws-sagemaker/test/model.test.ts @@ -1,10 +1,10 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import * as constructs from 'constructs'; import * as sagemaker from '../lib'; diff --git a/packages/@aws-cdk/aws-sam/.eslintrc.js b/packages/@aws-cdk/aws-sam/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-sam/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sam/.gitignore b/packages/@aws-cdk/aws-sam/.gitignore deleted file mode 100644 index ac4ba3ab6a8a9..0000000000000 --- a/packages/@aws-cdk/aws-sam/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json - -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-sam/.npmignore b/packages/@aws-cdk/aws-sam/.npmignore deleted file mode 100644 index 83cbb853b0cea..0000000000000 --- a/packages/@aws-cdk/aws-sam/.npmignore +++ /dev/null @@ -1,33 +0,0 @@ -# The basics -*.ts -*.tgz -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.snk - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-sam/LICENSE b/packages/@aws-cdk/aws-sam/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-sam/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-sam/NOTICE b/packages/@aws-cdk/aws-sam/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-sam/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-sam/README.md b/packages/@aws-cdk/aws-sam/README.md deleted file mode 100644 index 943c39c4b57ac..0000000000000 --- a/packages/@aws-cdk/aws-sam/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Serverless Application Model Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as serverless from '@aws-cdk/aws-sam'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Serverless construct libraries](https://constructs.dev/search?q=serverless) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Serverless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Serverless.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Serverless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Serverless.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-sam/jest.config.js b/packages/@aws-cdk/aws-sam/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-sam/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sam/lib/index.ts b/packages/@aws-cdk/aws-sam/lib/index.ts deleted file mode 100644 index 7431d9e9031b7..0000000000000 --- a/packages/@aws-cdk/aws-sam/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Serverless CloudFormation Resources: -export * from './sam.generated'; diff --git a/packages/@aws-cdk/aws-sam/package.json b/packages/@aws-cdk/aws-sam/package.json deleted file mode 100644 index 18b6505f50ac7..0000000000000 --- a/packages/@aws-cdk/aws-sam/package.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "@aws-cdk/aws-sam", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for the AWS Serverless Application Model (SAM) resources", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SAM", - "packageId": "Amazon.CDK.AWS.SAM", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.sam", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "sam" - } - }, - "python": { - "distName": "aws-cdk.aws-sam", - "module": "aws_cdk.aws_sam", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-sam" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Serverless", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "aws-sam" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1", - "ts-jest": "^27.1.5" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-sam/test/api.test.ts b/packages/@aws-cdk/aws-sam/test/api.test.ts deleted file mode 100644 index 6b2fd6853ba8a..0000000000000 --- a/packages/@aws-cdk/aws-sam/test/api.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as sam from '../lib'; - -describe('AWS::Serverless::Api', () => { - let stack: cdk.Stack; - beforeEach(() => { - stack = new cdk.Stack(); - }); - - test('can be created by passing a complex type to EndpointConfiguration', () => { - new sam.CfnApi(stack, 'Api', { - stageName: 'prod', - definitionBody: { - body: 'definitionBody', - }, - endpointConfiguration: { - type: 'GLOBAL', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Api', { - StageName: 'prod', - EndpointConfiguration: { - Type: 'GLOBAL', - }, - }); - }); - - test('can be created by passing a string to EndpointConfiguration', () => { - new sam.CfnApi(stack, 'Api', { - stageName: 'prod', - definitionBody: { - body: 'definitionBody', - }, - endpointConfiguration: 'GLOBAL', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Api', { - StageName: 'prod', - EndpointConfiguration: 'GLOBAL', - }); - }); -}); diff --git a/packages/@aws-cdk/aws-sam/test/application.test.ts b/packages/@aws-cdk/aws-sam/test/application.test.ts deleted file mode 100644 index 760c485ae6130..0000000000000 --- a/packages/@aws-cdk/aws-sam/test/application.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import { CfnApplication } from '../lib'; - -test('construct an AWS::Serverless::Application', () => { - const app = new cdk.App({ - context: { - '@aws-cdk/core:newStyleStackSynthesis': false, - }, - }); - const stack = new cdk.Stack(app); - - new CfnApplication(stack, 'App', { - location: { - applicationId: 'arn:aws:serverlessrepo:us-east-1:077246666028:applications/aws-serverless-twitter-event-source', - semanticVersion: '2.0.0', - }, - parameters: { - SearchText: '#serverless -filter:nativeretweets', - TweetProcessorFunctionName: 'test', - }, - }); - - Template.fromStack(stack).templateMatches({ - Transform: 'AWS::Serverless-2016-10-31', - Resources: { - App: { - Type: 'AWS::Serverless::Application', - Properties: { - Location: { - ApplicationId: 'arn:aws:serverlessrepo:us-east-1:077246666028:applications/aws-serverless-twitter-event-source', - SemanticVersion: '2.0.0', - }, - Parameters: { - SearchText: '#serverless -filter:nativeretweets', - TweetProcessorFunctionName: 'test', - }, - }, - }, - }, - }); -}); diff --git a/packages/@aws-cdk/aws-sam/test/function.test.ts b/packages/@aws-cdk/aws-sam/test/function.test.ts deleted file mode 100644 index b709465e9992e..0000000000000 --- a/packages/@aws-cdk/aws-sam/test/function.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; -import * as sam from '../lib'; - -test("correctly chooses a string array from the type unions of the 'policies' property", () => { - const stack = new cdk.Stack(); - - new sam.CfnFunction(stack, 'MyFunction', { - codeUri: { - bucket: 'my-bucket', - key: 'my-key', - }, - runtime: 'nodejs-12.x', - handler: 'index.handler', - policies: ['AWSLambdaExecute'], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Function', { - CodeUri: { - Bucket: 'my-bucket', - Key: 'my-key', - }, - Handler: 'index.handler', - Runtime: 'nodejs-12.x', - Policies: ['AWSLambdaExecute'], - }); -}); - -test('has the correct deployment preference hooks structure', () => { - const stack = new cdk.Stack(); - - new sam.CfnFunction(stack, 'MyFunction', { - deploymentPreference: { - enabled: true, - type: 'AllAtOnce', - hooks: { - preTraffic: 'pre-traffic-hook-arn', - postTraffic: 'post-traffic-hook-arn', - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Function', { - DeploymentPreference: { - Enabled: true, - Type: 'AllAtOnce', - Hooks: { - PreTraffic: 'pre-traffic-hook-arn', - PostTraffic: 'post-traffic-hook-arn', - }, - }, - }); -}); diff --git a/packages/@aws-cdk/aws-scheduler/.eslintrc.js b/packages/@aws-cdk/aws-scheduler/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-scheduler/.gitignore b/packages/@aws-cdk/aws-scheduler/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-scheduler/.npmignore b/packages/@aws-cdk/aws-scheduler/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-scheduler/LICENSE b/packages/@aws-cdk/aws-scheduler/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-scheduler/NOTICE b/packages/@aws-cdk/aws-scheduler/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-scheduler/README.md b/packages/@aws-cdk/aws-scheduler/README.md deleted file mode 100644 index 83099cd2569dc..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Scheduler Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as scheduler from '@aws-cdk/aws-scheduler'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Scheduler construct libraries](https://constructs.dev/search?q=scheduler) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Scheduler resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Scheduler.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Scheduler](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Scheduler.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-scheduler/jest.config.js b/packages/@aws-cdk/aws-scheduler/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-scheduler/lib/index.ts b/packages/@aws-cdk/aws-scheduler/lib/index.ts deleted file mode 100644 index 7d631b8506ee9..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Scheduler CloudFormation Resources: -export * from './scheduler.generated'; diff --git a/packages/@aws-cdk/aws-scheduler/package.json b/packages/@aws-cdk/aws-scheduler/package.json deleted file mode 100644 index 3326d93084e85..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-scheduler", - "version": "0.0.0", - "description": "AWS::Scheduler Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Scheduler", - "packageId": "Amazon.CDK.AWS.Scheduler", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.scheduler", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "scheduler" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-scheduler", - "module": "aws_cdk.aws_scheduler" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-scheduler" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Scheduler", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Scheduler", - "aws-scheduler" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-scheduler/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-scheduler/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-scheduler/test/scheduler.test.ts b/packages/@aws-cdk/aws-scheduler/test/scheduler.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-scheduler/test/scheduler.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-sdb/.eslintrc.js b/packages/@aws-cdk/aws-sdb/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-sdb/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sdb/.gitignore b/packages/@aws-cdk/aws-sdb/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-sdb/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-sdb/.npmignore b/packages/@aws-cdk/aws-sdb/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-sdb/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-sdb/LICENSE b/packages/@aws-cdk/aws-sdb/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-sdb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-sdb/NOTICE b/packages/@aws-cdk/aws-sdb/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-sdb/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-sdb/README.md b/packages/@aws-cdk/aws-sdb/README.md deleted file mode 100644 index 9b4b42b5ca25f..0000000000000 --- a/packages/@aws-cdk/aws-sdb/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon SimpleDB Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as sdb from '@aws-cdk/aws-sdb'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SDB construct libraries](https://constructs.dev/search?q=sdb) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SDB resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SDB.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SDB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SDB.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-sdb/jest.config.js b/packages/@aws-cdk/aws-sdb/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-sdb/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sdb/lib/index.ts b/packages/@aws-cdk/aws-sdb/lib/index.ts deleted file mode 100644 index 19bd925866be0..0000000000000 --- a/packages/@aws-cdk/aws-sdb/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SDB CloudFormation Resources: -export * from './sdb.generated'; diff --git a/packages/@aws-cdk/aws-sdb/package.json b/packages/@aws-cdk/aws-sdb/package.json deleted file mode 100644 index 9a24e894f7ada..0000000000000 --- a/packages/@aws-cdk/aws-sdb/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-sdb", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SDB", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.sdb", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "sdb" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SDB", - "packageId": "Amazon.CDK.AWS.SDB", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-sdb", - "module": "aws_cdk.aws_sdb", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-sdb" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SDB", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "sdb" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-sdb/test/sdb.test.ts b/packages/@aws-cdk/aws-sdb/test/sdb.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-sdb/test/sdb.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-secretsmanager/.eslintrc.js b/packages/@aws-cdk/aws-secretsmanager/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-secretsmanager/.gitignore b/packages/@aws-cdk/aws-secretsmanager/.gitignore deleted file mode 100644 index b9b7998d9f34a..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-secretsmanager/.npmignore b/packages/@aws-cdk/aws-secretsmanager/.npmignore deleted file mode 100644 index 7c082568e402d..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/.npmignore +++ /dev/null @@ -1,33 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -# Include .jsii -!.jsii - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-secretsmanager/LICENSE b/packages/@aws-cdk/aws-secretsmanager/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-secretsmanager/NOTICE b/packages/@aws-cdk/aws-secretsmanager/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-secretsmanager/README.md b/packages/@aws-cdk/aws-secretsmanager/README.md deleted file mode 100644 index c169590edbb1b..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/README.md +++ /dev/null @@ -1,295 +0,0 @@ -# AWS Secrets Manager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -```ts nofixture -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -``` - -## Create a new Secret in a Stack - -To have SecretsManager generate a new secret value automatically, -follow this example: - -```ts -declare const vpc: ec2.Vpc; - -// Simple secret -const secret = new secretsmanager.Secret(this, 'Secret'); -// Using the secret -const instance1 = new rds.DatabaseInstance(this, "PostgresInstance1", { - engine: rds.DatabaseInstanceEngine.POSTGRES, - credentials: rds.Credentials.fromSecret(secret), - vpc -}); -// Templated secret with username and password fields -const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { - generateSecretString: { - secretStringTemplate: JSON.stringify({ username: 'postgres' }), - generateStringKey: 'password', - }, -}); -// Using the templated secret as credentials -const instance2 = new rds.DatabaseInstance(this, "PostgresInstance2", { - engine: rds.DatabaseInstanceEngine.POSTGRES, - credentials: { - username: templatedSecret.secretValueFromJson('username').toString(), - password: templatedSecret.secretValueFromJson('password') - }, - vpc -}); -``` - -If you need to use a pre-existing secret, the recommended way is to manually -provision the secret in *AWS SecretsManager* and use the `Secret.fromSecretArn` -or `Secret.fromSecretAttributes` method to make it available in your CDK Application: - -```ts -declare const encryptionKey: kms.Key; -const secret = secretsmanager.Secret.fromSecretAttributes(this, 'ImportedSecret', { - secretArn: 'arn:aws:secretsmanager:::secret:-', - // If the secret is encrypted using a KMS-hosted CMK, either import or reference that key: - encryptionKey, -}); -``` - -SecretsManager secret values can only be used in select set of properties. For the -list of properties, see [the CloudFormation Dynamic References documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html). - -A secret can set `RemovalPolicy`. If it set to `RETAIN`, removing that secret will fail. - -## Grant permission to use the secret to a role - -You must grant permission to a resource for that resource to be allowed to -use a secret. This can be achieved with the `Secret.grantRead` and/or `Secret.grantWrite` - method, depending on your need: - -```ts -const role = new iam.Role(this, 'SomeRole', { assumedBy: new iam.AccountRootPrincipal() }); -const secret = new secretsmanager.Secret(this, 'Secret'); -secret.grantRead(role); -secret.grantWrite(role); -``` - -If, as in the following example, your secret was created with a KMS key: - -```ts -declare const role: iam.Role; -const key = new kms.Key(this, 'KMS'); -const secret = new secretsmanager.Secret(this, 'Secret', { encryptionKey: key }); -secret.grantRead(role); -secret.grantWrite(role); -``` - -then `Secret.grantRead` and `Secret.grantWrite` will also grant the role the -relevant encrypt and decrypt permissions to the KMS key through the -SecretsManager service principal. - -The principal is automatically added to Secret resource policy and KMS Key policy for cross account access: - -```ts -const otherAccount = new iam.AccountPrincipal('1234'); -const key = new kms.Key(this, 'KMS'); -const secret = new secretsmanager.Secret(this, 'Secret', { encryptionKey: key }); -secret.grantRead(otherAccount); -``` - -## Rotating a Secret - -### Using a Custom Lambda Function - -A rotation schedule can be added to a Secret using a custom Lambda function: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -declare const fn: lambda.Function; -const secret = new secretsmanager.Secret(this, 'Secret'); - -secret.addRotationSchedule('RotationSchedule', { - rotationLambda: fn, - automaticallyAfter: Duration.days(15), -}); -``` - -Note: The required permissions for Lambda to call SecretsManager and the other way round are automatically granted based on [AWS Documentation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions.html) as long as the Lambda is not imported. - -See [Overview of the Lambda Rotation Function](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-lambda-function-overview.html) on how to implement a Lambda Rotation Function. - -### Using a Hosted Lambda Function - -Use the `hostedRotation` prop to rotate a secret with a hosted Lambda function: - -```ts -const secret = new secretsmanager.Secret(this, 'Secret'); - -secret.addRotationSchedule('RotationSchedule', { - hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), -}); -``` - -Hosted rotation is available for secrets representing credentials for MySQL, PostgreSQL, Oracle, -MariaDB, SQLServer, Redshift and MongoDB (both for the single and multi user schemes). - -When deployed in a VPC, the hosted rotation implements `ec2.IConnectable`: - -```ts -declare const myVpc: ec2.Vpc; -declare const dbConnections: ec2.Connections; -declare const secret: secretsmanager.Secret; - -const myHostedRotation = secretsmanager.HostedRotation.mysqlSingleUser({ vpc: myVpc }); -secret.addRotationSchedule('RotationSchedule', { hostedRotation: myHostedRotation }); -dbConnections.allowDefaultPortFrom(myHostedRotation); -``` - -Use the `excludeCharacters` option to customize the characters excluded from -the generated password when it is rotated. By default, the rotation excludes -the same characters as the ones excluded for the secret. If none are defined -then the following set is used: ``% +~`#$&*()|[]{}:;<>?!'/@"\``. - - -See also [Automating secret creation in AWS CloudFormation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/integrating_cloudformation.html). - -## Rotating database credentials - -Define a `SecretRotation` to rotate database credentials: - -```ts -declare const mySecret: secretsmanager.Secret; -declare const myDatabase: ec2.IConnectable; -declare const myVpc: ec2.Vpc; - -new secretsmanager.SecretRotation(this, 'SecretRotation', { - application: secretsmanager.SecretRotationApplication.MYSQL_ROTATION_SINGLE_USER, // MySQL single user scheme - secret: mySecret, - target: myDatabase, // a Connectable - vpc: myVpc, // The VPC where the secret rotation application will be deployed - excludeCharacters: ' %+:;{}', // characters to never use when generating new passwords; - // by default, no characters are excluded, - // which might cause problems with some services, like DMS -}); -``` - -The secret must be a JSON string with the following format: - -```json -{ - "engine": "", - "host": "", - "username": "", - "password": "", - "dbname": "", - "port": "", - "masterarn": "" -} -``` - -For the multi user scheme, a `masterSecret` must be specified: - -```ts -declare const myUserSecret: secretsmanager.Secret; -declare const myMasterSecret: secretsmanager.Secret; -declare const myDatabase: ec2.IConnectable; -declare const myVpc: ec2.Vpc; - -new secretsmanager.SecretRotation(this, 'SecretRotation', { - application: secretsmanager.SecretRotationApplication.MYSQL_ROTATION_MULTI_USER, - secret: myUserSecret, // The secret that will be rotated - masterSecret: myMasterSecret, // The secret used for the rotation - target: myDatabase, - vpc: myVpc, -}); -``` - -See also [aws-rds](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-rds/README.md) where -credentials generation and rotation is integrated. - -## Importing Secrets - -Existing secrets can be imported by ARN, name, and other attributes (including the KMS key used to encrypt the secret). -Secrets imported by name should use the short-form of the name (without the SecretsManager-provided suffix); -the secret name must exist in the same account and region as the stack. -Importing by name makes it easier to reference secrets created in different regions, each with their own suffix and ARN. - -```ts -const secretCompleteArn = 'arn:aws:secretsmanager:eu-west-1:111111111111:secret:MySecret-f3gDy9'; -const secretPartialArn = 'arn:aws:secretsmanager:eu-west-1:111111111111:secret:MySecret'; // No Secrets Manager suffix -const encryptionKey = kms.Key.fromKeyArn(this, 'MyEncKey', 'arn:aws:kms:eu-west-1:111111111111:key/21c4b39b-fde2-4273-9ac0-d9bb5c0d0030'); -const mySecretFromCompleteArn = secretsmanager.Secret.fromSecretCompleteArn(this, 'SecretFromCompleteArn', secretCompleteArn); -const mySecretFromPartialArn = secretsmanager.Secret.fromSecretPartialArn(this, 'SecretFromPartialArn', secretPartialArn); -const mySecretFromName = secretsmanager.Secret.fromSecretNameV2(this, 'SecretFromName', 'MySecret') -const mySecretFromAttrs = secretsmanager.Secret.fromSecretAttributes(this, 'SecretFromAttributes', { - secretCompleteArn, - encryptionKey, -}); -``` - -## Replicating secrets - -Secrets can be replicated to multiple regions by specifying `replicaRegions`: - -```ts -declare const myKey: kms.Key; -new secretsmanager.Secret(this, 'Secret', { - replicaRegions: [ - { - region: 'eu-west-1', - }, - { - region: 'eu-central-1', - encryptionKey: myKey, - } - ] -}); -``` - -Alternatively, use `addReplicaRegion()`: - -```ts -const secret = new secretsmanager.Secret(this, 'Secret'); -secret.addReplicaRegion('eu-west-1'); -``` - -## Creating JSON Secrets - -Sometimes it is necessary to create a secret in SecretsManager that contains a JSON object. -For example: - -```json -{ - "username": "myUsername", - "database": "foo", - "password": "mypassword" -} -``` - -In order to create this type of secret, use the `secretObjectValue` input prop. - -```ts -const user = new iam.User(stack, 'User'); -const accessKey = new iam.AccessKey(stack, 'AccessKey', { user }); -declare const stack: Stack; - -new secretsmanager.Secret(stack, 'Secret', { - secretObjectValue: { - username: SecretValue.unsafePlainText(user.userName), - database: SecretValue.unsafePlainText('foo'), - password: accessKey.secretAccessKey, - }, -}) -``` - -In this case both the `username` and `database` are not a `Secret` so `SecretValue.unsafePlainText` needs to be used. -This means that they will be rendered as plain text in the template, but in this case neither of those -are actual "secrets". diff --git a/packages/@aws-cdk/aws-secretsmanager/jest.config.js b/packages/@aws-cdk/aws-secretsmanager/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts b/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts deleted file mode 100644 index 0e39e78d79c29..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/lib/policy.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { ISecret } from './secret'; -import { CfnResourcePolicy } from './secretsmanager.generated'; - -/** - * Construction properties for a ResourcePolicy - */ -export interface ResourcePolicyProps { - /** - * The secret to attach a resource-based permissions policy - */ - readonly secret: ISecret; -} - -/** - * Resource Policy for SecretsManager Secrets - * - * Policies define the operations that are allowed on this resource. - * - * You almost never need to define this construct directly. - * - * All AWS resources that support resource policies have a method called - * `addToResourcePolicy()`, which will automatically create a new resource - * policy if one doesn't exist yet, otherwise it will add to the existing - * policy. - * - * Prefer to use `addToResourcePolicy()` instead. - */ -export class ResourcePolicy extends Resource { - /** - * The IAM policy document for this policy. - */ - public readonly document = new iam.PolicyDocument(); - - constructor(scope: Construct, id: string, props: ResourcePolicyProps) { - super(scope, id); - - new CfnResourcePolicy(this, 'Resource', { - resourcePolicy: this.document, - secretId: props.secret.secretArn, - }); - } -} diff --git a/packages/@aws-cdk/aws-secretsmanager/package.json b/packages/@aws-cdk/aws-secretsmanager/package.json deleted file mode 100644 index 4ff6ba0c1bd2e..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/package.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "name": "@aws-cdk/aws-secretsmanager", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SecretsManager", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SecretsManager", - "packageId": "Amazon.CDK.AWS.SecretsManager", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.secretsmanager", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "secretsmanager" - } - }, - "python": { - "distName": "aws-cdk.aws-secretsmanager", - "module": "aws_cdk.aws_secretsmanager", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-secretsmanager" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SecretsManager", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "aws-secretsmanager" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "attribute-tag:@aws-cdk/aws-secretsmanager.Secret.secretName", - "attribute-tag:@aws-cdk/aws-secretsmanager.Secret.secretFullArn", - "from-signature:@aws-cdk/aws-secretsmanager.Secret.fromSecretNameV2", - "from-signature:@aws-cdk/aws-secretsmanager.Secret.fromSecretNameV2.params[2]", - "props-default-doc:@aws-cdk/aws-secretsmanager.SecretAttributes.secretArn", - "props-default-doc:@aws-cdk/aws-secretsmanager.SecretAttributes.secretCompleteArn", - "props-default-doc:@aws-cdk/aws-secretsmanager.SecretAttributes.secretPartialArn", - "from-signature:@aws-cdk/aws-secretsmanager.SecretTargetAttachment.fromSecretTargetAttachmentSecretArn", - "from-attributes:fromSecretTargetAttachmentAttributes", - "props-physical-name:@aws-cdk/aws-secretsmanager.RotationScheduleProps", - "props-physical-name:@aws-cdk/aws-secretsmanager.SecretTargetAttachmentProps", - "docs-public-apis:@aws-cdk/aws-secretsmanager.Secret.fromSecretArn", - "props-default-doc:@aws-cdk/aws-secretsmanager.SecretStringGenerator.secretStringTemplate", - "props-default-doc:@aws-cdk/aws-secretsmanager.SecretStringGenerator.generateStringKey", - "props-default-doc:@aws-cdk/aws-secretsmanager.SecretAttributes.encryptionKey", - "docs-public-apis:@aws-cdk/aws-secretsmanager.ISecretTargetAttachment", - "docs-public-apis:@aws-cdk/aws-secretsmanager.SecretTargetAttachment.fromSecretTargetAttachmentSecretArn", - "props-physical-name:@aws-cdk/aws-secretsmanager.ResourcePolicyProps" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture deleted file mode 100644 index 4e66468a44ec6..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack, SecretValue } from '@aws-cdk/core'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as kms from '@aws-cdk/aws-kms'; -import * as iam from '@aws-cdk/aws-iam'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as rds from '@aws-cdk/aws-rds'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.handler/.gitignore b/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.handler/.gitignore deleted file mode 100644 index 033e6722bb6e0..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.handler/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!index.js diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/.gitignore b/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/.gitignore deleted file mode 100644 index 033e6722bb6e0..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret-name-parsed.js.snapshot/asset.3457452f641c1ca5c1e19a921fee42f695d632fe3200b2f5ed8da685bc286ebc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!index.js diff --git a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.ts b/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.ts deleted file mode 100644 index 3c511c03ee8ca..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/test/integ.secret.lit.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { SecretValue } from '@aws-cdk/core'; -import * as secretsmanager from '../lib'; - -class SecretsManagerStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - const role = new iam.Role(this, 'TestRole', { assumedBy: new iam.AccountRootPrincipal() }); - - /// !show - // Default secret - const secret = new secretsmanager.Secret(this, 'Secret'); - secret.grantRead(role); - - const user = new iam.User(this, 'User', { - password: secret.secretValue, - }); - - // Templated secret - const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { - generateSecretString: { - secretStringTemplate: JSON.stringify({ username: 'user' }), - generateStringKey: 'password', - }, - }); - - new iam.User(this, 'OtherUser', { - // 'userName' is not actually a secret, so it's okay to use `unsafeUnwrap` to convert - // the `SecretValue` into a 'string'. - userName: templatedSecret.secretValueFromJson('username').unsafeUnwrap(), - password: templatedSecret.secretValueFromJson('password'), - }); - - // Secret with predefined value - const accessKey = new iam.AccessKey(this, 'AccessKey', { user }); - new secretsmanager.Secret(this, 'PredefinedSecret', { - secretStringValue: accessKey.secretAccessKey, - }); - - // JSON secret - new secretsmanager.Secret(this, 'JSONSecret', { - secretObjectValue: { - username: SecretValue.unsafePlainText(user.userName), - database: SecretValue.unsafePlainText('foo'), - password: accessKey.secretAccessKey, - }, - }); - /// !hide - } -} - -const app = new cdk.App(); -new SecretsManagerStack(app, 'Integ-SecretsManager-Secret'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-secretsmanager/test/policy.test.ts b/packages/@aws-cdk/aws-secretsmanager/test/policy.test.ts deleted file mode 100644 index a40c409b007b5..0000000000000 --- a/packages/@aws-cdk/aws-secretsmanager/test/policy.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as secretsmanager from '../lib'; -import { AttachmentTargetType, ISecretAttachmentTarget } from '../lib'; - -class MockAttachmentTarget extends cdk.Resource implements ISecretAttachmentTarget { - asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { - return { - targetId: 'mock-id', - targetType: AttachmentTargetType.RDS_DB_INSTANCE, - }; - } -} - -describe.each([ - [false, 2], - [true, 1], -])('@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments=%s', (featureFlagValue, expectedResourcePolicyCount) => { - const app = new cdk.App({ - context: { - [cxapi.SECRETS_MANAGER_TARGET_ATTACHMENT_RESOURCE_POLICY]: featureFlagValue, - }, - }); - const stack = new cdk.Stack(app); - - test('using addToResourcePolicy on a Secret and on a SecretAttachmentTarget attaching this Secret', () => { - // GIVEN - - const secret = new secretsmanager.Secret(stack, 'Secret'); - const servicePrincipalOne = new iam.ServicePrincipal('some-service-a'); - const servicePrincipalTwo = new iam.ServicePrincipal('some-service-b'); - const secretAttachment = secret.attach(new MockAttachmentTarget(stack, 'mock-target')); - - // WHEN - secret.grantRead(servicePrincipalOne); - secretAttachment.grantRead(servicePrincipalTwo); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::SecretsManager::ResourcePolicy', expectedResourcePolicyCount); - }); -}); diff --git a/packages/@aws-cdk/aws-securityhub/.eslintrc.js b/packages/@aws-cdk/aws-securityhub/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-securityhub/.gitignore b/packages/@aws-cdk/aws-securityhub/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-securityhub/.npmignore b/packages/@aws-cdk/aws-securityhub/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-securityhub/LICENSE b/packages/@aws-cdk/aws-securityhub/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-securityhub/NOTICE b/packages/@aws-cdk/aws-securityhub/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-securityhub/README.md b/packages/@aws-cdk/aws-securityhub/README.md deleted file mode 100644 index c0bffae7a1fc9..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Security Hub Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as securityhub from '@aws-cdk/aws-securityhub'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SecurityHub construct libraries](https://constructs.dev/search?q=securityhub) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SecurityHub resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SecurityHub.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SecurityHub](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SecurityHub.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-securityhub/jest.config.js b/packages/@aws-cdk/aws-securityhub/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-securityhub/lib/index.ts b/packages/@aws-cdk/aws-securityhub/lib/index.ts deleted file mode 100644 index 4e9cbb22c6bcb..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SecurityHub CloudFormation Resources: -export * from './securityhub.generated'; diff --git a/packages/@aws-cdk/aws-securityhub/package.json b/packages/@aws-cdk/aws-securityhub/package.json deleted file mode 100644 index 52c309ebbfcfb..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-securityhub", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SecurityHub", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SecurityHub", - "packageId": "Amazon.CDK.AWS.SecurityHub", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.securityhub", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "securityhub" - } - }, - "python": { - "distName": "aws-cdk.aws-securityhub", - "module": "aws_cdk.aws_securityhub", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-securityhub" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SecurityHub", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SecurityHub", - "aws-securityhub" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-securityhub/test/securityhub.test.ts b/packages/@aws-cdk/aws-securityhub/test/securityhub.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-securityhub/test/securityhub.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-servicecatalog/.eslintrc.js b/packages/@aws-cdk/aws-servicecatalog/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-servicecatalog/.gitignore b/packages/@aws-cdk/aws-servicecatalog/.gitignore deleted file mode 100644 index befabb7e18407..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -product-stack-snapshots -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-servicecatalog/.npmignore b/packages/@aws-cdk/aws-servicecatalog/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-servicecatalog/LICENSE b/packages/@aws-cdk/aws-servicecatalog/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-servicecatalog/NOTICE b/packages/@aws-cdk/aws-servicecatalog/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-servicecatalog/README.md b/packages/@aws-cdk/aws-servicecatalog/README.md deleted file mode 100644 index 105dd795667e1..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/README.md +++ /dev/null @@ -1,604 +0,0 @@ -# AWS Service Catalog Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -[AWS Service Catalog](https://docs.aws.amazon.com/servicecatalog/latest/dg/what-is-service-catalog.html) -enables organizations to create and manage catalogs of products for their end users that are approved for use on AWS. - -## Table Of Contents - -- [Portfolio](#portfolio) - - [Granting access to a portfolio](#granting-access-to-a-portfolio) - - [Sharing a portfolio with another AWS account](#sharing-a-portfolio-with-another-aws-account) -- [Product](#product) - - [Creating a product from a local asset](#creating-a-product-from-local-asset) - - [Creating a product from a stack](#creating-a-product-from-a-stack) - - [Using Assets in your Product Stack](#using-aseets-in-your-product-stack) - - [Creating a Product from a stack with a history of previous versions](#creating-a-product-from-a-stack-with-a-history-of-all-previous-versions) - - [Adding a product to a portfolio](#adding-a-product-to-a-portfolio) -- [TagOptions](#tag-options) -- [Constraints](#constraints) - - [Tag update constraint](#tag-update-constraint) - - [Notify on stack events](#notify-on-stack-events) - - [CloudFormation template parameters constraint](#cloudformation-template-parameters-constraint) - - [Set launch role](#set-launch-role) - - [Deploy with StackSets](#deploy-with-stacksets) - - -The `@aws-cdk/aws-servicecatalog` package contains resources that enable users to automate governance and management of their AWS resources at scale. - -```ts nofixture -import * as servicecatalog from '@aws-cdk/aws-servicecatalog'; -``` - -## Portfolio - -AWS Service Catalog portfolios allow administrators to organize, manage, and distribute cloud resources for their end users. -Using the CDK, a new portfolio can be created with the `Portfolio` construct: - -```ts -new servicecatalog.Portfolio(this, 'Portfolio', { - displayName: 'MyPortfolio', - providerName: 'MyTeam', -}); -``` - -You can also specify optional metadata properties such as `description` and `messageLanguage` -to help better catalog and manage your portfolios. - -```ts -new servicecatalog.Portfolio(this, 'Portfolio', { - displayName: 'MyFirstPortfolio', - providerName: 'SCAdmin', - description: 'Portfolio for a project', - messageLanguage: servicecatalog.MessageLanguage.EN, -}); -``` - -Read more at [Creating and Managing Portfolios](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/catalogs_portfolios.html). - -To reference an existing portfolio into your CDK application, use the `Portfolio.fromPortfolioArn()` factory method: - -```ts -const portfolio = servicecatalog.Portfolio.fromPortfolioArn(this, 'ReferencedPortfolio', - 'arn:aws:catalog:region:account-id:portfolio/port-abcdefghi'); -``` - -### Granting access to a portfolio - -You can grant access to and manage the `IAM` users, groups, or roles that have access to the products within a portfolio. -Entities with granted access will be able to utilize the portfolios resources and products via the console or AWS CLI. -Once resources are deployed end users will be able to access them via the console or service catalog CLI. - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -declare const portfolio: servicecatalog.Portfolio; - -const user = new iam.User(this, 'User'); -portfolio.giveAccessToUser(user); - -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.AccountRootPrincipal(), -}); -portfolio.giveAccessToRole(role); - -const group = new iam.Group(this, 'Group'); -portfolio.giveAccessToGroup(group); -``` - -### Sharing a portfolio with another AWS account - -You can use account-to-account sharing to distribute a reference to your portfolio to other AWS accounts by passing the recipient account number. -After the share is initiated, the recipient account can accept the share via CLI or console by importing the portfolio ID. -Changes made to the shared portfolio will automatically propagate to recipients. - -```ts -declare const portfolio: servicecatalog.Portfolio; -portfolio.shareWithAccount('012345678901'); -``` - -## Product - -Products are version friendly infrastructure-as-code templates that admins create and add to portfolios for end users to provision and create AWS resources. -Service Catalog supports products from AWS Marketplace or ones defined by a CloudFormation template. -The CDK currently only supports adding products of type CloudFormation. -Using the CDK, a new Product can be created with the `CloudFormationProduct` construct. -You can use `CloudFormationTemplate.fromUrl` to create a Product from a CloudFormation template directly from a URL that points to the template in S3, GitHub, or CodeCommit: - -```ts -const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', { - productName: "My Product", - owner: "Product Owner", - productVersions: [ - { - productVersionName: "v1", - cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromUrl( - 'https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/ServiceCatalog/Product.yaml'), - }, - ], -}); -``` - -### Creating a product from a local asset - -A `CloudFormationProduct` can also be created by using a CloudFormation template held locally on disk using Assets. -Assets are files that are uploaded to an S3 Bucket before deployment. -`CloudFormationTemplate.fromAsset` can be utilized to create a Product by passing the path to a local template file on your disk: - -```ts -import * as path from 'path'; - -const product = new servicecatalog.CloudFormationProduct(this, 'Product', { - productName: "My Product", - owner: "Product Owner", - productVersions: [ - { - productVersionName: "v1", - cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromUrl( - 'https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/ServiceCatalog/Product.yaml'), - }, - { - productVersionName: "v2", - cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromAsset(path.join(__dirname, 'development-environment.template.json')), - }, - ], -}); -``` - -### Creating a product from a stack - -You can create a Service Catalog `CloudFormationProduct` entirely defined with CDK code using a service catalog `ProductStack`. -A separate child stack for your product is created and you can add resources like you would for any other CDK stack, -such as an S3 Bucket, IAM roles, and EC2 instances. This stack is passed in as a product version to your -product. This will not create a separate CloudFormation stack during deployment. - -```ts -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; - -class S3BucketProduct extends servicecatalog.ProductStack { - constructor(scope: Construct, id: string) { - super(scope, id); - - new s3.Bucket(this, 'BucketProduct'); - } -} - -const product = new servicecatalog.CloudFormationProduct(this, 'Product', { - productName: "My Product", - owner: "Product Owner", - productVersions: [ - { - productVersionName: "v1", - cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new S3BucketProduct(this, 'S3BucketProduct')), - }, - ], -}); -``` - -### Using Assets in your Product Stack - -You can reference assets in a Product Stack. For example, we can add a handler to a Lambda function or a S3 Asset directly from a local asset file. -In this case, you must provide a S3 Bucket with a bucketName to store your assets. - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Bucket } from "@aws-cdk/aws-s3"; - -class LambdaProduct extends servicecatalog.ProductStack { - constructor(scope: Construct, id: string) { - super(scope, id); - - new lambda.Function(this, 'LambdaProduct', { - runtime: lambda.Runtime.PYTHON_3_9, - code: lambda.Code.fromAsset("./assets"), - handler: 'index.handler' - }); - } -} - -const userDefinedBucket = new Bucket(this, `UserDefinedBucket`, { - bucketName: 'user-defined-bucket-for-product-stack-assets', -}); - -const product = new servicecatalog.CloudFormationProduct(this, 'Product', { - productName: "My Product", - owner: "Product Owner", - productVersions: [ - { - productVersionName: "v1", - cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new LambdaProduct(this, 'LambdaFunctionProduct', { - assetBucket: userDefinedBucket, - })), - }, - ], -}); -``` - -When a product containing an asset is shared with a spoke account, the corresponding asset bucket -will automatically grant read permissions to the spoke account. -Note, it is not recommended using a referenced bucket as permissions cannot be added from CDK. -In this case, it will be your responsibility to grant read permissions for the asset bucket to -the spoke account. -If you want to provide your own bucket policy or scope down your bucket policy further to only allow -reads from a specific launch role, refer to the following example policy: - -```ts -new iam.PolicyStatement({ - actions: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', ], - effect: iam.Effect.ALLOW, - resources: [ - bucket.bucketArn, - bucket.arnForObjects('*'), - ], - principals: [ - new iam.ArnPrincipal(cdk.Stack.of(this).formatArn({ - service: 'iam', - region: '', - sharedAccount, - resource: 'role', - resourceName: launchRoleName, - })) - ], - conditions: { - 'ForAnyValue:StringEquals': { - 'aws:CalledVia': ['cloudformation.amazonaws.com'], - }, - 'Bool': { - 'aws:ViaAWSService': true, - }, - }, -}); -``` - -Furthermore, in order for a spoke account to provision a product with an asset, the role launching -the product needs permissions to read from the asset bucket. -We recommend you utilize a launch role with permissions to read from the asset bucket. -For example your launch role would need to include at least the following policy: - -```json -{ - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:GetObject" - ], - "Resource": "*" - } - ] -} -``` - -Please refer to [Set launch role](#set-launch-role) for additional details about launch roles. -See [Launch Constraint](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/constraints-launch.html) documentation -to understand the permissions that launch roles need. - -### Creating a Product from a stack with a history of previous versions - -The default behavior of Service Catalog is to overwrite each product version upon deployment. -This applies to Product Stacks as well, where only the latest changes to your Product Stack will -be deployed. -To keep a history of the revisions of a ProductStack available in Service Catalog, -you would need to define a ProductStack for each historical copy. - -You can instead create a `ProductStackHistory` to maintain snapshots of all previous versions. -The `ProductStackHistory` can be created by passing the base `productStack`, -a `currentVersionName` for your current version and a `locked` boolean. -The `locked` boolean which when set to true will prevent your `currentVersionName` -from being overwritten when there is an existing snapshot for that version. - -```ts -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; - -class S3BucketProduct extends servicecatalog.ProductStack { - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - new s3.Bucket(this, 'BucketProduct'); - } -} - -const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', { - productStack: new S3BucketProduct(this, 'S3BucketProduct'), - currentVersionName: 'v1', - currentVersionLocked: true -}); -``` - -We can deploy the current version `v1` by using `productStackHistory.currentVersion()` - -```ts -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; - -class S3BucketProduct extends servicecatalog.ProductStack { - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - new s3.Bucket(this, 'BucketProductV2'); - } -} - -const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', { - productStack: new S3BucketProduct(this, 'S3BucketProduct'), - currentVersionName: 'v2', - currentVersionLocked: true -}); - -const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', { - productName: "My Product", - owner: "Product Owner", - productVersions: [ - productStackHistory.currentVersion(), - ], -}); -``` - -Using `ProductStackHistory` all deployed templates for the ProductStack will be written to disk, -so that they will still be available in the future as the definition of the `ProductStack` subclass changes over time. -**It is very important** that you commit these old versions to source control as these versions -determine whether a version has already been deployed and can also be deployed themselves. - -After using `ProductStackHistory` to deploy version `v1` of your `ProductStack`, we -make changes to the `ProductStack` and update the `currentVersionName` to `v2`. -We still want our `v1` version to still be deployed, so we reference it by calling `productStackHistory.versionFromSnapshot('v1')`. - -```ts -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; - -class S3BucketProduct extends servicecatalog.ProductStack { - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - new s3.Bucket(this, 'BucketProductV2'); - } -} - -const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', { - productStack: new S3BucketProduct(this, 'S3BucketProduct'), - currentVersionName: 'v2', - currentVersionLocked: true -}); - -const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', { - productName: "My Product", - owner: "Product Owner", - productVersions: [ - productStackHistory.currentVersion(), - productStackHistory.versionFromSnapshot('v1') - ], -}); -``` - -### Adding a product to a portfolio - -You add products to a portfolio to organize and distribute your catalog at scale. Adding a product to a portfolio creates an association, -and the product will become visible within the portfolio side in both the Service Catalog console and AWS CLI. -You can add a product to multiple portfolios depending on your organizational structure and how you would like to group access to products. - -```ts -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -portfolio.addProduct(product); -``` - -## Tag Options - -TagOptions allow administrators to easily manage tags on provisioned products by providing a template for a selection of tags that end users choose from. -TagOptions are created by specifying a tag key with a set of allowed values and can be associated with both portfolios and products. -When launching a product, both the TagOptions associated with the product and the containing portfolio are made available. - -At the moment, TagOptions can only be deactivated in the console. - -```ts -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -const tagOptionsForPortfolio = new servicecatalog.TagOptions(this, 'OrgTagOptions', { - allowedValuesForTags: { - Group: ['finance', 'engineering', 'marketing', 'research'], - CostCenter: ['01', '02','03'], - }, -}); -portfolio.associateTagOptions(tagOptionsForPortfolio); - -const tagOptionsForProduct = new servicecatalog.TagOptions(this, 'ProductTagOptions', { - allowedValuesForTags: { - Environment: ['dev', 'alpha', 'prod'], - }, -}); -product.associateTagOptions(tagOptionsForProduct); -``` - -## Constraints - -Constraints are governance gestures that you place on product-portfolio associations that allow you to manage minimal launch permissions, notifications, and other optional actions that end users can perform on products. -Using the CDK, if you do not explicitly associate a product to a portfolio and add a constraint, it will automatically add an association for you. - -There are rules around how constraints are applied to portfolio-product associations. -For example, you can only have a single "launch role" constraint applied to a portfolio-product association. -If a misconfigured constraint is added, `synth` will fail with an error message. - -Read more at [Service Catalog Constraints](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/constraints.html). - -### Tag update constraint - -Tag update constraints allow or disallow end users to update tags on resources associated with an AWS Service Catalog product upon provisioning. -By default, if a Tag Update constraint is not configured, tag updating is not permitted. -If tag updating is allowed, then new tags associated with the product or portfolio will be applied to provisioned resources during a provisioned product update. - -```ts -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -portfolio.addProduct(product); -portfolio.constrainTagUpdates(product); -``` - -If you want to disable this feature later on, you can update it by setting the "allow" parameter to `false`: - -```ts -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -// to disable tag updates: -portfolio.constrainTagUpdates(product, { - allow: false, -}); -``` - -### Notify on stack events - -Allows users to subscribe an AWS `SNS` topic to a provisioned product's CloudFormation stack events. -When an end user provisions a product it creates a CloudFormation stack that notifies the subscribed topic on creation, edit, and delete events. -An individual `SNS` topic may only have a single subscription to any given portfolio-product association. - -```ts -import * as sns from '@aws-cdk/aws-sns'; - -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -const topic1 = new sns.Topic(this, 'Topic1'); -portfolio.notifyOnStackEvents(product, topic1); - -const topic2 = new sns.Topic(this, 'Topic2'); -portfolio.notifyOnStackEvents(product, topic2, { - description: 'description for topic2', // description is an optional field. -}); -``` - -### CloudFormation template parameters constraint - -CloudFormation template parameter constraints allow you to configure the provisioning parameters that are available to end users when they launch a product. -Template constraint rules consist of one or more assertions that define the default and/or allowable values for a product’s provisioning parameters. -You can configure multiple parameter constraints to govern the different provisioning parameters within your products. -For example, a rule might define the `EC2` instance types that users can choose from when launching a product that includes one or more `EC2` instances. -Parameter rules have an optional `condition` field that allow for rule application to consider conditional evaluations. -If a `condition` is specified, all assertions will be applied if the condition evaluates to true. -For information on rule-specific intrinsic functions to define rule conditions and assertions, -see [AWS Rule Functions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html). - -```ts -import * as cdk from '@aws-cdk/core'; - -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -portfolio.constrainCloudFormationParameters(product, { - rule: { - ruleName: 'testInstanceType', - condition: cdk.Fn.conditionEquals(cdk.Fn.ref('Environment'), 'test'), - assertions: [{ - assert: cdk.Fn.conditionContains(['t2.micro', 't2.small'], cdk.Fn.ref('InstanceType')), - description: 'For test environment, the instance type should be small', - }], - }, -}); -``` - -### Set launch role - -Allows you to configure a specific `IAM` role that Service Catalog assumes on behalf of the end user when launching a product. -By setting a launch role constraint, you can maintain least permissions for an end user when launching a product. -For example, a launch role can grant permissions for specific resource creation like an `S3` bucket that the user. -The launch role must be assumed by the Service Catalog principal. -You can only have one launch role set for a portfolio-product association, -and you cannot set a launch role on a product that already has a StackSets deployment configured. - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -const launchRole = new iam.Role(this, 'LaunchRole', { - assumedBy: new iam.ServicePrincipal('servicecatalog.amazonaws.com'), -}); - -portfolio.setLaunchRole(product, launchRole); -``` - -You can also set the launch role using just the name of a role which is locally deployed in end user accounts. -This is useful for when roles and users are separately managed outside of the CDK. -The given role must exist in both the account that creates the launch role constraint, -as well as in any end user accounts that wish to provision a product with the launch role. - -You can do this by passing in the role with an explicitly set name: - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -const launchRole = new iam.Role(this, 'LaunchRole', { - roleName: 'MyRole', - assumedBy: new iam.ServicePrincipal('servicecatalog.amazonaws.com'), -}); - -portfolio.setLocalLaunchRole(product, launchRole); -``` - -Or you can simply pass in a role name and CDK will create a role with that name that trusts service catalog in the account: - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -const roleName = 'MyRole'; -const launchRole: iam.IRole = portfolio.setLocalLaunchRoleName(product, roleName); -``` - -See [Launch Constraint](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/constraints-launch.html) documentation -to understand the permissions that launch roles need. - -### Deploy with StackSets - -A StackSets deployment constraint allows you to configure product deployment options using -[AWS CloudFormation StackSets](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/using-stacksets.html). -You can specify one or more accounts and regions into which stack instances will launch when the product is provisioned. -There is an additional field `allowStackSetInstanceOperations` that sets ability for end users to create, edit, or delete the stacks created by the StackSet. -By default, this field is set to `false`. -When launching a StackSets product, end users can select from the list of accounts and regions configured in the constraint to determine where the Stack Instances will deploy and the order of deployment. -You can only define one StackSets deployment configuration per portfolio-product association, -and you cannot both set a launch role and StackSets deployment configuration for an assocation. - -```ts -import * as iam from '@aws-cdk/aws-iam'; - -declare const portfolio: servicecatalog.Portfolio; -declare const product: servicecatalog.CloudFormationProduct; - -const adminRole = new iam.Role(this, 'AdminRole', { - assumedBy: new iam.AccountRootPrincipal(), -}); - -portfolio.deployWithStackSets(product, { - accounts: ['012345678901', '012345678902', '012345678903'], - regions: ['us-west-1', 'us-east-1', 'us-west-2', 'us-east-1'], - adminRole: adminRole, - executionRoleName: 'SCStackSetExecutionRole', // Name of role deployed in end users accounts. - allowStackSetInstanceOperations: true, -}); -``` diff --git a/packages/@aws-cdk/aws-servicecatalog/jest.config.js b/packages/@aws-cdk/aws-servicecatalog/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/private/validation.ts b/packages/@aws-cdk/aws-servicecatalog/lib/private/validation.ts deleted file mode 100644 index cd70006fbe373..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/lib/private/validation.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; - -/** - * Class to validate that inputs match requirements. - */ -export class InputValidator { - /** - * Validates length is between allowed min and max lengths. - */ - public static validateLength(resourceName: string, inputName: string, minLength: number, maxLength: number, inputString?: string): void { - if (!cdk.Token.isUnresolved(inputString) && inputString !== undefined && (inputString.length < minLength || inputString.length > maxLength)) { - throw new Error(`Invalid ${inputName} for resource ${resourceName}, must have length between ${minLength} and ${maxLength}, got: '${this.truncateString(inputString, 100)}'`); - } - } - - /** - * Validates string matches the allowed regex pattern. - */ - public static validateRegex(resourceName: string, inputName: string, regexp: RegExp, inputString?: string): void { - if (!cdk.Token.isUnresolved(inputString) && inputString !== undefined && !regexp.test(inputString)) { - throw new Error(`Invalid ${inputName} for resource ${resourceName}, must match regex pattern ${regexp}, got: '${this.truncateString(inputString, 100)}'`); - } - } - - /** - * Validates string matches the valid URL regex pattern. - */ - public static validateUrl(resourceName: string, inputName: string, inputString?: string): void { - this.validateRegex(resourceName, inputName, /^https?:\/\/.*/, inputString); - } - - /** - * Validates string matches the valid email regex pattern. - */ - public static validateEmail(resourceName: string, inputName: string, inputString?: string): void { - this.validateRegex(resourceName, inputName, /^[\w\d.%+\-]+@[a-z\d.\-]+\.[a-z]{2,4}$/i, inputString); - } - - /** - * Validates that a role being used as a local launch role has the role name set - */ - public static validateRoleNameSetForLocalLaunchRole(role: iam.IRole): void { - if (role.node.defaultChild) { - if (cdk.Token.isUnresolved((role.node.defaultChild as iam.CfnRole).roleName)) { - throw new Error(`Role ${role.node.id} used for Local Launch Role must have roleName explicitly set`); - } - } - } - - private static truncateString(string: string, maxLength: number): string { - if (string.length > maxLength) { - return string.substring(0, maxLength) + '[truncated]'; - } - return string; - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/package.json b/packages/@aws-cdk/aws-servicecatalog/package.json deleted file mode 100644 index 10aedf006399f..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/package.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "name": "@aws-cdk/aws-servicecatalog", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ServiceCatalog", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.servicecatalog", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "servicecatalog" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.Servicecatalog", - "packageId": "Amazon.CDK.AWS.ServiceCatalog", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-servicecatalog", - "module": "aws_cdk.aws_servicecatalog", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-servicecatalog" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ServiceCatalog", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "servicecatalog" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-s3-deployment": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-s3-deployment": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "resource-attribute:@aws-cdk/aws-servicecatalog.CloudFormationProduct.cloudFormationProductProductName", - "resource-attribute:@aws-cdk/aws-servicecatalog.CloudFormationProduct.cloudFormationProductProvisioningArtifactIds", - "resource-attribute:@aws-cdk/aws-servicecatalog.CloudFormationProduct.cloudFormationProductProvisioningArtifactNames", - "props-physical-name:@aws-cdk/aws-servicecatalog.CloudFormationProductProps", - "resource-attribute:@aws-cdk/aws-servicecatalog.Portfolio.portfolioName", - "props-physical-name:@aws-cdk/aws-servicecatalog.PortfolioProps", - "props-physical-name:@aws-cdk/aws-servicecatalog.ProductStack", - "props-struct-name:@aws-cdk/aws-servicecatalog.ITagOptions", - "props-physical-name:@aws-cdk/aws-servicecatalog.TagOptionsProps", - "ref-via-interface:@aws-cdk/aws-servicecatalog.CloudFormationProductProps.tagOptions", - "ref-via-interface:@aws-cdk/aws-servicecatalog.IProduct.associateTagOptions.tagOptions", - "ref-via-interface:@aws-cdk/aws-servicecatalog.IPortfolio.associateTagOptions.tagOptions", - "ref-via-interface:@aws-cdk/aws-servicecatalog.PortfolioProps.tagOptions" - ] - }, - "maturity": "stable", - "stability": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-servicecatalog/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-servicecatalog/rosetta/default.ts-fixture deleted file mode 100644 index 0f3ccd34192b2..0000000000000 --- a/packages/@aws-cdk/aws-servicecatalog/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as servicecatalog from '@aws-cdk/aws-servicecatalog'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/.eslintrc.js b/packages/@aws-cdk/aws-servicecatalogappregistry/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/.eslintrc.js +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/.gitignore b/packages/@aws-cdk/aws-servicecatalogappregistry/.gitignore index a103aefa2bfbb..276e2e169d01b 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/.gitignore +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/.gitignore @@ -22,3 +22,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/README.md b/packages/@aws-cdk/aws-servicecatalogappregistry/README.md index b0d8609b1f749..7bfa375911de8 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/README.md +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) > The APIs of higher level constructs in this module are experimental and under active development. @@ -39,7 +33,7 @@ enables organizations to create and manage repositories of applications and asso The `@aws-cdk/aws-servicecatalogappregistry` package contains resources that enable users to automate governance and management of their AWS resources at scale. ```ts nofixture -import * as appreg from '@aws-cdk/aws-servicecatalogappregistry'; +import * as appreg from '@aws-cdk/aws-servicecatalogappregistry-alpha'; ``` ## Application @@ -122,7 +116,7 @@ const associatedApp = new appreg.ApplicationAssociator(app, 'AssociatedApplicati If you want to associate an Attribute Group with application created by `ApplicationAssociator`, then use as shown in the example below: ```ts -import * as cdk from "@aws-cdk/core"; +import * as cdk from "aws-cdk-lib"; const app = new App(); @@ -151,9 +145,9 @@ ApplicationAssociator will not be able to find them. Call `associateStage` on ea Pipeline, as shown in the example below: ```ts -import * as cdk from "@aws-cdk/core"; -import * as codepipeline from "@aws-cdk/pipelines"; -import * as codecommit from "@aws-cdk/aws-codecommit"; +import * as cdk from "aws-cdk-lib"; +import * as codepipeline from "aws-cdk-lib/pipelines"; +import * as codecommit from "aws-cdk-lib/aws-codecommit"; declare const repo: codecommit.Repository; declare const pipeline: codepipeline.CodePipeline; declare const beta: cdk.Stage; @@ -285,7 +279,7 @@ You can share your AppRegistry applications and attribute groups with AWS Organi ### Sharing an application ```ts -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const application: appreg.Application; declare const myRole: iam.IRole; declare const myUser: iam.IUser; @@ -301,7 +295,7 @@ application.shareApplication('MyShareId', { E.g., sharing an application with multiple accounts and allowing the accounts to associate resources to the application. ```ts -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const application: appreg.Application; application.shareApplication('MyShareId', { name: 'MyShare', @@ -313,7 +307,7 @@ application.shareApplication('MyShareId', { ### Sharing an attribute group ```ts -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const attributeGroup: appreg.AttributeGroup; declare const myRole: iam.IRole; declare const myUser: iam.IUser; @@ -329,7 +323,7 @@ attributeGroup.shareAttributeGroup('MyShareId', { E.g., sharing an application with multiple accounts and allowing the accounts to associate applications to the attribute group. ```ts -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from 'aws-cdk-lib/aws-iam'; declare const attributeGroup: appreg.AttributeGroup; attributeGroup.shareAttributeGroup('MyShareId', { name: 'MyShare', diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application-associator.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application-associator.ts index 7c8ae60bc8e3e..8bbb614e805f0 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application-associator.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application-associator.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IApplication } from './application'; import { CheckedStageStackAssociator } from './aspects/stack-associator'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application.ts index eef57ebb7598f..fea31574909f6 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/application.ts @@ -1,12 +1,12 @@ -import { CfnResourceShare } from '@aws-cdk/aws-ram'; -import * as cdk from '@aws-cdk/core'; +import { CfnResourceShare } from 'aws-cdk-lib/aws-ram'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { StageStackAssociator } from './aspects/stack-associator'; import { AttributeGroup, IAttributeGroup } from './attribute-group'; import { getPrincipalsforSharing, hashValues, ShareOptions, SharePermission } from './common'; import { isAccountUnresolved } from './private/utils'; import { InputValidator } from './private/validation'; -import { CfnApplication, CfnAttributeGroupAssociation, CfnResourceAssociation } from './servicecatalogappregistry.generated'; +import { CfnApplication, CfnAttributeGroupAssociation, CfnResourceAssociation } from 'aws-cdk-lib/aws-servicecatalogappregistry'; const APPLICATION_READ_ONLY_RAM_PERMISSION_ARN = 'arn:aws:ram::aws:permission/AWSRAMPermissionServiceCatalogAppRegistryApplicationReadOnly'; const APPLICATION_ALLOW_ACCESS_RAM_PERMISSION_ARN = 'arn:aws:ram::aws:permission/AWSRAMPermissionServiceCatalogAppRegistryApplicationAllowAssociation'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/aspects/stack-associator.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/aspects/stack-associator.ts index ad33664411791..79a608a44e176 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/aspects/stack-associator.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/aspects/stack-associator.ts @@ -1,4 +1,4 @@ -import { IAspect, Stack, Stage, Annotations, Names } from '@aws-cdk/core'; +import { IAspect, Stack, Stage, Annotations, Names } from 'aws-cdk-lib'; import { IConstruct } from 'constructs'; import { IApplication } from '../application'; import { ApplicationAssociator } from '../application-associator'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/attribute-group.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/attribute-group.ts index 2ad1e51bd28fc..52681adc08371 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/attribute-group.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/attribute-group.ts @@ -1,10 +1,10 @@ -import { CfnResourceShare } from '@aws-cdk/aws-ram'; -import * as cdk from '@aws-cdk/core'; +import { CfnResourceShare } from 'aws-cdk-lib/aws-ram'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IApplication } from './application'; import { getPrincipalsforSharing, hashValues, ShareOptions, SharePermission } from './common'; import { InputValidator } from './private/validation'; -import { CfnAttributeGroup, CfnAttributeGroupAssociation } from './servicecatalogappregistry.generated'; +import { CfnAttributeGroup, CfnAttributeGroupAssociation } from 'aws-cdk-lib/aws-servicecatalogappregistry'; const ATTRIBUTE_GROUP_READ_ONLY_RAM_PERMISSION_ARN = 'arn:aws:ram::aws:permission/AWSRAMPermissionServiceCatalogAppRegistryAttributeGroupReadOnly'; const ATTRIBUTE_GROUP_ALLOW_ACCESS_RAM_PERMISSION_ARN = 'arn:aws:ram::aws:permission/AWSRAMPermissionServiceCatalogAppRegistryAttributeGroupAllowAssociation'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/common.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/common.ts index 6bbb2daabe801..039104b074b1c 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/common.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/common.ts @@ -1,5 +1,5 @@ import * as crypto from 'crypto'; -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from 'aws-cdk-lib/aws-iam'; /** * Supported permissions for sharing applications or attribute groups with principals using AWS RAM. diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/index.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/index.ts index 57a975bc64d64..c0d289435bac5 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/index.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/index.ts @@ -5,4 +5,3 @@ export * from './target-application'; export * from './common'; // AWS::ServiceCatalogAppRegistry CloudFormation Resources: -export * from './servicecatalogappregistry.generated'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/utils.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/utils.ts index cdbf97a0f7337..897ac49ccce67 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/utils.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/utils.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from 'aws-cdk-lib'; /** diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/validation.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/validation.ts index efee933061c3f..7ad7d8b6d0bfd 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/validation.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/private/validation.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; /** * Class to validate that inputs match requirements. diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/target-application.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/target-application.ts index e2e0bb124b57a..02bd6654b4c83 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/lib/target-application.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/lib/target-application.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IApplication, Application } from './application'; import { hashValues } from './common'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/package.json b/packages/@aws-cdk/aws-servicecatalogappregistry/package.json index ddee116e8670f..9d3a1e1cb532f 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/package.json +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/package.json @@ -1,5 +1,5 @@ { - "name": "@aws-cdk/aws-servicecatalogappregistry", + "name": "@aws-cdk/aws-servicecatalogappregistry-alpha", "version": "0.0.0", "description": "The CDK Construct Library for AWS::ServiceCatalogAppRegistry", "main": "lib/index.js", @@ -16,17 +16,17 @@ }, "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Servicecatalogappregistry", - "packageId": "Amazon.CDK.AWS.ServiceCatalogAppRegistry", + "namespace": "Amazon.CDK.AWS.Servicecatalogappregistry.Alpha", + "packageId": "Amazon.CDK.AWS.ServiceCatalogAppRegistry.Alpha", "signAssembly": true, "assemblyOriginatorKeyFile": "../../key.snk", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.servicecatalogappregistry", + "package": "software.amazon.awscdk.services.servicecatalogappregistry.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "servicecatalogappregistry" + "artifactId": "servicecatalogappregistry-alpha" } }, "python": { @@ -34,8 +34,12 @@ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ], - "distName": "aws-cdk.aws-servicecatalogappregistry", - "module": "aws_cdk.aws_servicecatalogappregistry" + "distName": "aws-cdk.aws-servicecatalogappregistry-alpha", + "module": "aws_cdk.aws_servicecatalogappregistry_alpha" + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkservicecatalogappregistryalpha" } } }, @@ -54,17 +58,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test": "yarn build && yarn test", "build+test+package": "yarn build+test && yarn package", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::ServiceCatalogAppRegistry", "env": { "AWSLINT_BASE_CONSTRUCT": "true" } @@ -83,30 +84,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-ram": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/pipelines": "0.0.0", - "constructs": "^10.0.0" + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", + "constructs": "^10.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-ram": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "constructs": "^10.0.0", - "@aws-cdk/pipelines": "0.0.0" + "aws-cdk-lib": "^0.0.0", + "constructs": "^10.0.0" }, "engines": { "node": ">= 14.15.0" @@ -121,8 +111,14 @@ }, "awslint": { "exclude": [ - "construct-ctor:@aws-cdk/aws-servicecatalogappregistry.ApplicationAssociator..params[0]" + "*:*" ] }, - "private": true + "private": false, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + } } diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-servicecatalogappregistry/rosetta/default.ts-fixture index 45174ea8d63ed..b03bbb217c5e8 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/rosetta/default.ts-fixture @@ -1,7 +1,7 @@ // Fixture with packages imported, but nothing else -import { App, Stack } from '@aws-cdk/core'; +import { App, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as appreg from '@aws-cdk/aws-servicecatalogappregistry'; +import * as appreg from '@aws-cdk/aws-servicecatalogappregistry-alpha'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/application-associator.test.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/application-associator.test.ts index db2540a32b7ba..4e975579d062f 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/application-associator.test.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/application-associator.test.ts @@ -1,7 +1,7 @@ -import { Annotations, Template } from '@aws-cdk/assertions'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as cdk from '@aws-cdk/core'; -import * as codepipeline from '@aws-cdk/pipelines'; +import { Annotations, Template } from 'aws-cdk-lib/assertions'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as cdk from 'aws-cdk-lib'; +import * as codepipeline from 'aws-cdk-lib/pipelines'; import { Construct } from 'constructs'; import * as appreg from '../lib'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/application.test.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/application.test.ts index a54d5ed2c2323..ad99f664c158a 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/application.test.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/application.test.ts @@ -1,6 +1,6 @@ -import { Annotations, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Annotations, Template } from 'aws-cdk-lib/assertions'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import * as appreg from '../lib'; diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/attribute-group.test.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/attribute-group.test.ts index 2435060850a28..fcee2de79ac16 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/attribute-group.test.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/attribute-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import * as appreg from '../lib'; describe('Attribute Group', () => { diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association-no-stack-id-or-name.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association-no-stack-id-or-name.ts index b8251b9998b31..38343f541cdcb 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association-no-stack-id-or-name.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association-no-stack-id-or-name.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as appreg from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association.ts index c6c70bcfac07b..2a875cd62dd98 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.all-stacks-association.ts @@ -1,5 +1,5 @@ /// !cdk-integ integ-servicecatalogappregistry-application -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; import * as appreg from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.cross-account-stack-association-enabled.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.cross-account-stack-association-enabled.ts index e07ae464f5696..18d49fff030e6 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.cross-account-stack-association-enabled.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.cross-account-stack-association-enabled.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as appreg from '../lib'; // When doing a deployment for these stacks, specify stack `env` properties and use diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.disable-url.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.disable-url.ts index 67d35fe3cb2a5..68b67e682efa3 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.disable-url.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application-associator.disable-url.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; +import * as cdk from 'aws-cdk-lib'; +import * as integ from '@aws-cdk/integ-tests-alpha'; import * as appreg from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application.ts index d657a320ee50d..998f831c76daf 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.application.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import * as appreg from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.attribute-group.ts b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.attribute-group.ts index 1963f85fb5ee8..c17d21a7a4a8c 100644 --- a/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.attribute-group.ts +++ b/packages/@aws-cdk/aws-servicecatalogappregistry/test/integ.attribute-group.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cdk from 'aws-cdk-lib'; import * as appreg from '../lib'; const app = new cdk.App(); diff --git a/packages/@aws-cdk/aws-servicediscovery/.eslintrc.js b/packages/@aws-cdk/aws-servicediscovery/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-servicediscovery/.gitignore b/packages/@aws-cdk/aws-servicediscovery/.gitignore deleted file mode 100644 index a44eba2329f2d..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-servicediscovery/.npmignore b/packages/@aws-cdk/aws-servicediscovery/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-servicediscovery/LICENSE b/packages/@aws-cdk/aws-servicediscovery/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-servicediscovery/NOTICE b/packages/@aws-cdk/aws-servicediscovery/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-servicediscovery/README.md b/packages/@aws-cdk/aws-servicediscovery/README.md deleted file mode 100644 index 6b20e6a6fb115..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Amazon ECS Service Discovery Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -This package contains constructs for working with **AWS Cloud Map** - -AWS Cloud Map is a fully managed service that you can use to create and -maintain a map of the backend services and resources that your applications -depend on. - -For further information on AWS Cloud Map, -see the [AWS Cloud Map documentation](https://docs.aws.amazon.com/cloud-map) - -## HTTP Namespace Example - -The following example creates an AWS Cloud Map namespace that -supports API calls, creates a service in that namespace, and -registers an instance to it: - -[Creating a Cloud Map service within an HTTP namespace](test/integ.service-with-http-namespace.lit.ts) - -## Private DNS Namespace Example - -The following example creates an AWS Cloud Map namespace that -supports both API calls and DNS queries within a vpc, creates a -service in that namespace, and registers a loadbalancer as an -instance. - -A secondary service is also configured which only supports API based discovery, a -non ip based resource is registered to this service: - -[Creating a Cloud Map service within a Private DNS namespace](test/integ.service-with-private-dns-namespace.lit.ts) - -## Public DNS Namespace Example - -The following example creates an AWS Cloud Map namespace that -supports both API calls and public DNS queries, creates a service in -that namespace, and registers an IP instance: - -[Creating a Cloud Map service within a Public namespace](test/integ.service-with-public-dns-namespace.lit.ts) - -For DNS namespaces, you can also register instances to services with CNAME records: - -[Creating a Cloud Map service within a Public namespace](test/integ.service-with-cname-record.lit.ts) diff --git a/packages/@aws-cdk/aws-servicediscovery/jest.config.js b/packages/@aws-cdk/aws-servicediscovery/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts b/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts deleted file mode 100644 index 76cbf171f8ae9..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/lib/instance.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { IResource, Names, Resource } from '@aws-cdk/core'; -import { IService } from './service'; - -export interface IInstance extends IResource { - /** - * The id of the instance resource - * @attribute - */ - readonly instanceId: string; - - /** - * The Cloudmap service this resource is registered to. - */ - readonly service: IService; -} - -/** - * Used when the resource that's associated with the service instance is accessible using values other than an IP - * address or a domain name (CNAME), i.e. for non-ip-instances - */ -export interface BaseInstanceProps { - /** - * The id of the instance resource - * - * @default Automatically generated name - */ - readonly instanceId?: string; - - /** - * Custom attributes of the instance. - * - * @default none - */ - readonly customAttributes?: { [key: string]: string }; -} - -export abstract class InstanceBase extends Resource implements IInstance { - /** - * The Id of the instance - */ - public abstract readonly instanceId: string; - - /** - * The Cloudmap service to which the instance is registered. - */ - public abstract readonly service: IService; - - /** - * Generate a unique instance Id that is safe to pass to CloudMap - */ - protected uniqueInstanceId() { - // Max length of 64 chars, get the last 64 chars - const id = Names.uniqueId(this); - return id.substring(Math.max(id.length - 64, 0), id.length); - } -} diff --git a/packages/@aws-cdk/aws-servicediscovery/package.json b/packages/@aws-cdk/aws-servicediscovery/package.json deleted file mode 100644 index eaf6f46e877a6..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/package.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "name": "@aws-cdk/aws-servicediscovery", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::ServiceDiscovery", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.servicediscovery", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "servicediscovery" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.ServiceDiscovery", - "packageId": "Amazon.CDK.AWS.ServiceDiscovery", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-servicediscovery", - "module": "aws_cdk.aws_servicediscovery", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-servicediscovery" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::ServiceDiscovery", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nyc": { - "statements": 75 - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "servicediscovery" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-servicediscovery.HttpNamespaceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.PublicDnsNamespaceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.PrivateDnsNamespaceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.AliasTargetInstanceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.CnameInstanceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.IpInstanceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.NonIpInstanceProps", - "props-physical-name:@aws-cdk/aws-servicediscovery.ServiceProps", - "props-default-doc:@aws-cdk/aws-servicediscovery.ServiceAttributes.discoveryType", - "docs-public-apis:@aws-cdk/aws-servicediscovery.CnameInstanceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.RoutingPolicy", - "docs-public-apis:@aws-cdk/aws-servicediscovery.NamespaceType", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HealthCheckType", - "docs-public-apis:@aws-cdk/aws-servicediscovery.DnsRecordType", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.serviceName", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.serviceId", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.serviceArn", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.routingPolicy", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.namespace", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.dnsRecordType", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes.discoveryType", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HttpNamespace.httpNamespaceArn", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HttpNamespace.httpNamespaceId", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HttpNamespace.httpNamespaceName", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HttpNamespace.fromHttpNamespaceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.InstanceBase", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PrivateDnsNamespace.privateDnsNamespaceArn", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PrivateDnsNamespace.privateDnsNamespaceId", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PrivateDnsNamespace.privateDnsNamespaceName", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PrivateDnsNamespace.fromPrivateDnsNamespaceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PublicDnsNamespace.publicDnsNamespaceArn", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PublicDnsNamespace.publicDnsNamespaceId", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PublicDnsNamespace.publicDnsNamespaceName", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PublicDnsNamespace.fromPublicDnsNamespaceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.Service.fromServiceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.AliasTargetInstanceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.BaseNamespaceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.CnameInstanceBaseProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.ServiceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HttpNamespaceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.HttpNamespaceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IHttpNamespace", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IInstance", - "docs-public-apis:@aws-cdk/aws-servicediscovery.INamespace", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IPrivateDnsNamespace", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IPublicDnsNamespace", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IService", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IpInstanceBaseProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.IpInstanceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.NonIpInstanceBaseProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.NonIpInstanceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PrivateDnsNamespaceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PrivateDnsNamespaceProps", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PublicDnsNamespaceAttributes", - "docs-public-apis:@aws-cdk/aws-servicediscovery.PublicDnsNamespaceProps", - "resource-attribute:@aws-cdk/aws-servicediscovery.PrivateDnsNamespace.privateDnsNamespaceHostedZoneId", - "resource-attribute:@aws-cdk/aws-servicediscovery.PublicDnsNamespace.publicDnsNamespaceHostedZoneId" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-servicediscovery/test/instance.test.ts b/packages/@aws-cdk/aws-servicediscovery/test/instance.test.ts deleted file mode 100644 index 00f8498e14606..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/test/instance.test.ts +++ /dev/null @@ -1,534 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as servicediscovery from '../lib'; - -describe('instance', () => { - test('IpInstance for service in HTTP namespace', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = namespace.createService('MyService', { - name: 'service', - }); - - service.registerIpInstance('IpInstance', { - ipv4: '10.0.0.0', - ipv6: '0:0:0:0:0:ffff:a00:0', - port: 443, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { - InstanceAttributes: { - AWS_INSTANCE_IPV4: '10.0.0.0', - AWS_INSTANCE_IPV6: '0:0:0:0:0:ffff:a00:0', - AWS_INSTANCE_PORT: '443', - }, - ServiceId: { - 'Fn::GetAtt': [ - 'MyNamespaceMyService365E2470', - 'Id', - ], - }, - InstanceId: 'MyNamespaceMyServiceIpInstanceBACEB9D2', - }); - - - }); - - test('IpInstance for service in PublicDnsNamespace', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'public', - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, - }); - - service.registerIpInstance('IpInstance', { - ipv4: '54.239.25.192', - ipv6: '0:0:0:0:0:ffff:a00:0', - port: 443, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { - InstanceAttributes: { - AWS_INSTANCE_IPV4: '54.239.25.192', - AWS_INSTANCE_IPV6: '0:0:0:0:0:ffff:a00:0', - AWS_INSTANCE_PORT: '443', - }, - ServiceId: { - 'Fn::GetAtt': [ - 'MyNamespaceMyService365E2470', - 'Id', - ], - }, - InstanceId: 'MyNamespaceMyServiceIpInstanceBACEB9D2', - }); - - - }); - - test('IpInstance for service in PrivateDnsNamespace', () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'MyVpc'); - - const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'MyNamespace', { - name: 'public', - vpc, - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, - }); - - service.registerIpInstance('IpInstance', { - ipv4: '10.0.0.0', - ipv6: '0:0:0:0:0:ffff:a00:0', - port: 443, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { - InstanceAttributes: { - AWS_INSTANCE_IPV4: '10.0.0.0', - AWS_INSTANCE_IPV6: '0:0:0:0:0:ffff:a00:0', - AWS_INSTANCE_PORT: '443', - }, - ServiceId: { - 'Fn::GetAtt': [ - 'MyNamespaceMyService365E2470', - 'Id', - ], - }, - InstanceId: 'MyNamespaceMyServiceIpInstanceBACEB9D2', - }); - - - }); - - test('Registering IpInstance throws when omitting port for a service using SRV', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'public', - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.SRV, - }); - - // THEN - expect(() => { - service.registerIpInstance('IpInstance', { - instanceId: 'id', - }); - }).toThrow(/A `port` must be specified for a service using a `SRV` record./); - - - }); - - test('Registering IpInstance throws when omitting ipv4 and ipv6 for a service using SRV', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'dns', - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.SRV, - }); - - // THEN - expect(() => { - service.registerIpInstance('IpInstance', { - port: 3306, - }); - }).toThrow(/At least `ipv4` or `ipv6` must be specified for a service using a `SRV` record./); - - - }); - - test('Registering IpInstance throws when omitting ipv4 for a service using A records', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'dns', - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.A, - }); - - // THEN - expect(() => { - service.registerIpInstance('IpInstance', { - port: 3306, - }); - }).toThrow(/An `ipv4` must be specified for a service using a `A` record./); - - - }); - - test('Registering IpInstance throws when omitting ipv6 for a service using AAAA records', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'dns', - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.AAAA, - }); - - // THEN - expect(() => { - service.registerIpInstance('IpInstance', { - port: 3306, - }); - }).toThrow(/An `ipv6` must be specified for a service using a `AAAA` record./); - - - }); - - test('Registering IpInstance throws with wrong DNS record type', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'dns', - }); - - const service = namespace.createService('MyService', { - name: 'service', - dnsRecordType: servicediscovery.DnsRecordType.CNAME, - }); - - // THEN - expect(() => { - service.registerIpInstance('IpInstance', { - port: 3306, - }); - }).toThrow(/Service must support `A`, `AAAA` or `SRV` records to register this instance type./); - - - }); - - test('Registering AliasTargetInstance', () => { - // GIVEN - const stack = new cdk.Stack(); - - const vpc = new ec2.Vpc(stack, 'MyVPC'); - const alb = new elbv2.ApplicationLoadBalancer(stack, 'MyALB', { vpc }); - - const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'MyNamespace', { - name: 'dns', - vpc, - }); - - const service = namespace.createService('MyService', { - name: 'service', - loadBalancer: true, - }); - const customAttributes = { foo: 'bar' }; - - service.registerLoadBalancer('Loadbalancer', alb, customAttributes); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { - InstanceAttributes: { - AWS_ALIAS_DNS_NAME: { - 'Fn::GetAtt': [ - 'MyALB911A8556', - 'DNSName', - ], - }, - foo: 'bar', - }, - ServiceId: { - 'Fn::GetAtt': [ - 'MyNamespaceMyService365E2470', - 'Id', - ], - }, - InstanceId: 'MyNamespaceMyServiceLoadbalancerD1112A76', - }); - - - }); - - test('Throws when registering AliasTargetInstance with Http Namespace', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = new servicediscovery.Service(stack, 'MyService', { - namespace, - }); - - const vpc = new ec2.Vpc(stack, 'MyVPC'); - const alb = new elbv2.ApplicationLoadBalancer(stack, 'MyALB', { vpc }); - - // THEN - expect(() => { - service.registerLoadBalancer('Loadbalancer', alb); - }).toThrow(/Namespace associated with Service must be a DNS Namespace./); - - - }); - - // TODO shouldn't be allowed to do this if loadbalancer on ServiceProps is not set to true. - test('Throws when registering AliasTargetInstance with wrong Routing Policy', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = namespace.createService('MyService', { - routingPolicy: servicediscovery.RoutingPolicy.MULTIVALUE, - }); - - const vpc = new ec2.Vpc(stack, 'MyVPC'); - const alb = new elbv2.ApplicationLoadBalancer(stack, 'MyALB', { vpc }); - - // THEN - expect(() => { - service.registerLoadBalancer('Loadbalancer', alb); - }).toThrow(/Service must use `WEIGHTED` routing policy./); - - - }); - - test('Register CnameInstance', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'dns', - }); - - const service = namespace.createService('MyService', { - dnsRecordType: servicediscovery.DnsRecordType.CNAME, - }); - - service.registerCnameInstance('CnameInstance', { - instanceCname: 'foo.com', - customAttributes: { dogs: 'good' }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { - InstanceAttributes: { - AWS_INSTANCE_CNAME: 'foo.com', - dogs: 'good', - }, - ServiceId: { - 'Fn::GetAtt': [ - 'MyNamespaceMyService365E2470', - 'Id', - ], - }, - InstanceId: 'MyNamespaceMyServiceCnameInstance0EB1C98D', - }); - - - }); - - test('Throws when registering CnameInstance for an HTTP namespace', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = new servicediscovery.Service(stack, 'MyService', { - namespace, - }); - - // THEN - expect(() => { - service.registerCnameInstance('CnameInstance', { - instanceCname: 'foo.com', - }); - }).toThrow(/Namespace associated with Service must be a DNS Namespace/); - - - }); - - test('Register NonIpInstance', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = namespace.createService('MyService'); - - service.registerNonIpInstance('NonIpInstance', { - customAttributes: { dogs: 'good' }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { - InstanceAttributes: { - dogs: 'good', - }, - ServiceId: { - 'Fn::GetAtt': [ - 'MyNamespaceMyService365E2470', - 'Id', - ], - }, - InstanceId: 'MyNamespaceMyServiceNonIpInstance7EFD703A', - }); - - - }); - - test('Register NonIpInstance, DNS Namespace, API Only service', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace( - stack, - 'MyNamespace', - { - name: 'http', - }, - ); - - const service = namespace.createService('MyService', { discoveryType: servicediscovery.DiscoveryType.API } ); - - service.registerNonIpInstance('NonIpInstance', { - customAttributes: { dogs: 'good' }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties( - 'AWS::ServiceDiscovery::Instance', - { - InstanceAttributes: { - dogs: 'good', - }, - ServiceId: { - 'Fn::GetAtt': ['MyNamespaceMyService365E2470', 'Id'], - }, - InstanceId: 'MyNamespaceMyServiceNonIpInstance7EFD703A', - }, - ); - }); - - test('Throws when registering NonIpInstance for an DNS discoverable service', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = namespace.createService('MyService'); - - // THEN - expect(() => { - service.registerNonIpInstance('NonIpInstance', { - instanceId: 'nonIp', - }); - }).toThrow(/This type of instance can only be registered for HTTP namespaces./); - - - }); - - test('Throws when no custom attribues specified for NonIpInstance', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = namespace.createService('MyService'); - - // THEN - expect(() => { - service.registerNonIpInstance('NonIpInstance', { - instanceId: 'nonIp', - }); - }).toThrow(/You must specify at least one custom attribute for this instance type./); - - - }); - - test('Throws when custom attribues are emptyfor NonIpInstance', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'http', - }); - - const service = namespace.createService('MyService'); - - // THEN - expect(() => { - service.registerNonIpInstance('NonIpInstance', { - instanceId: 'nonIp', - customAttributes: {}, - }); - }).toThrow(/You must specify at least one custom attribute for this instance type./); - - - }); - - test('Register multiple instances on the same service', () => { - // GIVEN - const stack = new cdk.Stack(); - - const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { - name: 'public', - }); - - const service = namespace.createService('MyService'); - - // WHEN - service.registerIpInstance('First', { - ipv4: '10.0.0.0', - }); - - service.registerIpInstance('Second', { - ipv4: '10.0.0.1', - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::ServiceDiscovery::Instance', 2); - - - }); -}); diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts b/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts deleted file mode 100644 index eeebfa81f9158..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts +++ /dev/null @@ -1,21 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as servicediscovery from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); - -const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { - name: 'foobar.com', -}); - -const service = namespace.createService('Service', { - name: 'foo', - dnsRecordType: servicediscovery.DnsRecordType.CNAME, - dnsTtl: cdk.Duration.seconds(30), -}); - -service.registerCnameInstance('CnameInstance', { - instanceCname: 'service.pizza', -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts b/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts deleted file mode 100644 index 81c65c353ed77..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts +++ /dev/null @@ -1,31 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as servicediscovery from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); - -const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { - name: 'MyHTTPNamespace', -}); - -const service1 = namespace.createService('NonIpService', { - description: 'service registering non-ip instances', -}); - -service1.registerNonIpInstance('NonIpInstance', { - customAttributes: { arn: 'arn:aws:s3:::mybucket' }, -}); - -const service2 = namespace.createService('IpService', { - description: 'service registering ip instances', - healthCheck: { - type: servicediscovery.HealthCheckType.HTTP, - resourcePath: '/check', - }, -}); - -service2.registerIpInstance('IpInstance', { - ipv4: '54.239.25.192', -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts b/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts deleted file mode 100644 index 391b253cd6152..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts +++ /dev/null @@ -1,34 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; -import * as servicediscovery from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); - -const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); - -const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'Namespace', { - name: 'boobar.com', - vpc, -}); - -const service = namespace.createService('Service', { - dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, - dnsTtl: cdk.Duration.seconds(30), - loadBalancer: true, -}); - -const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); - -service.registerLoadBalancer('Loadbalancer', loadbalancer); - -const arnService = namespace.createService('ArnService', { - discoveryType: servicediscovery.DiscoveryType.API, -}); - -arnService.registerNonIpInstance('NonIpInstance', { - customAttributes: { arn: 'arn://' }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts b/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts deleted file mode 100644 index d48fa555a4cdd..0000000000000 --- a/packages/@aws-cdk/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as cdk from '@aws-cdk/core'; -import * as servicediscovery from '../lib'; - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); - -const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { - name: 'foobar.com', -}); - -const service = namespace.createService('Service', { - name: 'foo', - dnsRecordType: servicediscovery.DnsRecordType.A, - dnsTtl: cdk.Duration.seconds(30), - healthCheck: { - type: servicediscovery.HealthCheckType.HTTPS, - resourcePath: '/healthcheck', - failureThreshold: 2, - }, -}); - -service.registerIpInstance('IpInstance', { - ipv4: '54.239.25.192', - port: 443, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ses-actions/.eslintrc.js b/packages/@aws-cdk/aws-ses-actions/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ses-actions/.gitignore b/packages/@aws-cdk/aws-ses-actions/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ses-actions/.npmignore b/packages/@aws-cdk/aws-ses-actions/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ses-actions/LICENSE b/packages/@aws-cdk/aws-ses-actions/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ses-actions/NOTICE b/packages/@aws-cdk/aws-ses-actions/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ses-actions/README.md b/packages/@aws-cdk/aws-ses-actions/README.md deleted file mode 100644 index 62ad3d397fb26..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Amazon Simple Email Service Actions Library - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module contains integration classes to add action to SES email receiving rules. -Instances of these classes should be passed to the `rule.addAction()` method. - -Currently supported are: - -* [Add header](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-add-header.html) -* [Bounce](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-bounce.html) -* [Lambda](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda.html) -* [S3](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-s3.html) -* [SNS](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-sns.html) -* [Stop](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-stop.html) - -See the README of `@aws-cdk/aws-ses` for more information. diff --git a/packages/@aws-cdk/aws-ses-actions/jest.config.js b/packages/@aws-cdk/aws-ses-actions/jest.config.js deleted file mode 100644 index d052cbb29f05d..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - ...baseConfig.coverageThreshold.global, - branches: 60, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts b/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts deleted file mode 100644 index d6be68f92ce24..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/lib/lambda.ts +++ /dev/null @@ -1,85 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; - -/** - * The type of invocation to use for a Lambda Action. - */ -export enum LambdaInvocationType { - /** - * The function will be invoked asynchronously. - */ - EVENT = 'Event', - - /** - * The function will be invoked sychronously. Use RequestResponse only when - * you want to make a mail flow decision, such as whether to stop the receipt - * rule or the receipt rule set. - */ - REQUEST_RESPONSE = 'RequestResponse', -} - -/** - * Construction properties for a Lambda action. - */ -export interface LambdaProps { - /** - * The Lambda function to invoke. - */ - readonly function: lambda.IFunction - - /** - * The invocation type of the Lambda function. - * - * @default Event - */ - readonly invocationType?: LambdaInvocationType; - - /** - * The SNS topic to notify when the Lambda action is taken. - * - * @default no notification - */ - readonly topic?: sns.ITopic; -} - -/** - * Calls an AWS Lambda function, and optionally, publishes a notification to - * Amazon SNS. - */ -export class Lambda implements ses.IReceiptRuleAction { - constructor(private readonly props: LambdaProps) { - } - - public bind(rule: ses.IReceiptRule): ses.ReceiptRuleActionConfig { - // Allow SES to invoke Lambda function - // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-lambda - const permissionId = 'AllowSes'; - if (!this.props.function.permissionsNode.tryFindChild(permissionId)) { - this.props.function.addPermission(permissionId, { - action: 'lambda:InvokeFunction', - principal: new iam.ServicePrincipal('ses.amazonaws.com'), - sourceAccount: cdk.Aws.ACCOUNT_ID, - }); - } - - // Ensure permission is deployed before rule - const permission = this.props.function.permissionsNode.tryFindChild(permissionId) as lambda.CfnPermission; - if (permission) { // The Lambda could be imported - rule.node.addDependency(permission); - } else { - // eslint-disable-next-line max-len - cdk.Annotations.of(rule).addWarning('This rule is using a Lambda action with an imported function. Ensure permission is given to SES to invoke that function.'); - } - - return { - lambdaAction: { - functionArn: this.props.function.functionArn, - invocationType: this.props.invocationType, - topicArn: this.props.topic?.topicArn, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-ses-actions/lib/s3.ts b/packages/@aws-cdk/aws-ses-actions/lib/s3.ts deleted file mode 100644 index 1f288afe2a887..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/lib/s3.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; - -/** - * Construction properties for a S3 action. - */ -export interface S3Props { - /** - * The S3 bucket that incoming email will be saved to. - */ - readonly bucket: s3.IBucket; - - /** - * The master key that SES should use to encrypt your emails before saving - * them to the S3 bucket. - * - * @default no encryption - */ - readonly kmsKey?: kms.IKey; - - /** - * The key prefix of the S3 bucket. - * - * @default no prefix - */ - readonly objectKeyPrefix?: string; - - /** - * The SNS topic to notify when the S3 action is taken. - * - * @default no notification - */ - readonly topic?: sns.ITopic; -} - -/** - * Saves the received message to an Amazon S3 bucket and, optionally, publishes - * a notification to Amazon SNS. - */ -export class S3 implements ses.IReceiptRuleAction { - constructor(private readonly props: S3Props) { - } - - public bind(rule: ses.IReceiptRule): ses.ReceiptRuleActionConfig { - // Allow SES to write to S3 bucket - // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-s3 - const keyPattern = this.props.objectKeyPrefix || ''; - const s3Statement = new iam.PolicyStatement({ - actions: ['s3:PutObject'], - principals: [new iam.ServicePrincipal('ses.amazonaws.com')], - resources: [this.props.bucket.arnForObjects(`${keyPattern}*`)], - conditions: { - StringEquals: { - 'aws:Referer': cdk.Aws.ACCOUNT_ID, - }, - }, - }); - this.props.bucket.addToResourcePolicy(s3Statement); - - const policy = this.props.bucket.node.tryFindChild('Policy') as s3.BucketPolicy; - if (policy) { // The bucket could be imported - rule.node.addDependency(policy); - } else { - cdk.Annotations.of(rule).addWarning('This rule is using a S3 action with an imported bucket. Ensure permission is given to SES to write to that bucket.'); - } - - // Allow SES to use KMS master key - // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-kms - if (this.props.kmsKey && !/alias\/aws\/ses$/.test(this.props.kmsKey.keyArn)) { - const kmsStatement = new iam.PolicyStatement({ - actions: ['kms:Encrypt', 'kms:GenerateDataKey'], - principals: [new iam.ServicePrincipal('ses.amazonaws.com')], - resources: ['*'], - conditions: { - Null: { - 'kms:EncryptionContext:aws:ses:rule-name': 'false', - 'kms:EncryptionContext:aws:ses:message-id': 'false', - }, - StringEquals: { - 'kms:EncryptionContext:aws:ses:source-account': cdk.Aws.ACCOUNT_ID, - }, - }, - }); - - this.props.kmsKey.addToResourcePolicy(kmsStatement); - } - - return { - s3Action: { - bucketName: this.props.bucket.bucketName, - kmsKeyArn: this.props.kmsKey?.keyArn, - objectKeyPrefix: this.props.objectKeyPrefix, - topicArn: this.props.topic?.topicArn, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-ses-actions/lib/sns.ts b/packages/@aws-cdk/aws-ses-actions/lib/sns.ts deleted file mode 100644 index b29a9dda5a7d5..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/lib/sns.ts +++ /dev/null @@ -1,51 +0,0 @@ -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; - -/** - * The type of email encoding to use for a SNS action. - */ -export enum EmailEncoding { - /** - * Base 64 - */ - BASE64 = 'Base64', - - /** - * UTF-8 - */ - UTF8 = 'UTF-8', -} - -/** - * Construction properties for a SNS action. - */ -export interface SnsProps { - /** - * The encoding to use for the email within the Amazon SNS notification. - * - * @default UTF-8 - */ - readonly encoding?: EmailEncoding; - - /** - * The SNS topic to notify. - */ - readonly topic: sns.ITopic; -} - -/** - * Publishes the email content within a notification to Amazon SNS. - */ -export class Sns implements ses.IReceiptRuleAction { - constructor(private readonly props: SnsProps) { - } - - public bind(_rule: ses.IReceiptRule): ses.ReceiptRuleActionConfig { - return { - snsAction: { - encoding: this.props.encoding, - topicArn: this.props.topic.topicArn, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-ses-actions/package.json b/packages/@aws-cdk/aws-ses-actions/package.json deleted file mode 100644 index 993af52439974..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/package.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "name": "@aws-cdk/aws-ses-actions", - "version": "0.0.0", - "private": true, - "description": "Receipt rule actions for AWS SES", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ses.actions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ses-actions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SES.Actions", - "packageId": "Amazon.CDK.AWS.SES.Actions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ses-actions", - "module": "aws_cdk.aws_ses_actions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ses-actions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ses", - "actions" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-ses": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-ses": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awslint": { - "exclude": [ - "docs-public-apis:@aws-cdk/aws-ses-actions.BounceTemplate.MAILBOX_DOES_NOT_EXIST", - "docs-public-apis:@aws-cdk/aws-ses-actions.BounceTemplate.MAILBOX_FULL", - "docs-public-apis:@aws-cdk/aws-ses-actions.BounceTemplate.MESSAGE_CONTENT_REJECTED", - "docs-public-apis:@aws-cdk/aws-ses-actions.BounceTemplate.MESSAGE_TOO_LARGE", - "docs-public-apis:@aws-cdk/aws-ses-actions.BounceTemplate.TEMPORARY_FAILURE", - "docs-public-apis:@aws-cdk/aws-ses-actions.BounceTemplate.props", - "props-default-doc:@aws-cdk/aws-ses-actions.BounceTemplateProps.statusCode", - "props-default-doc:@aws-cdk/aws-ses-actions.StopProps.topic" - ] - }, - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ses-actions/test/actions.test.ts b/packages/@aws-cdk/aws-ses-actions/test/actions.test.ts deleted file mode 100644 index 1c278eb93c92f..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/test/actions.test.ts +++ /dev/null @@ -1,296 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; -import { Stack } from '@aws-cdk/core'; -import * as actions from '../lib'; - -let stack: Stack; -let rule: ses.ReceiptRule; -let topic: sns.Topic; - -beforeEach(() => { - stack = new Stack(); - const ruleSet = new ses.ReceiptRuleSet(stack, 'RuleSet'); - rule = ruleSet.addRule('Rule'); - topic = new sns.Topic(stack, 'Topic'); -}); - -test('add header action', () => { - rule.addAction(new actions.AddHeader({ - name: 'X-My-Header', - value: 'value', - })); - - Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { - Rule: { - Actions: [ - { - AddHeaderAction: { - HeaderName: 'X-My-Header', - HeaderValue: 'value', - }, - }, - ], - Enabled: true, - }, - }); -}); - -test('add header action with invalid header name', () => { - expect(() => rule.addAction(new actions.AddHeader({ - name: 'He@der', - value: 'value', - }))).toThrow(/`name`/); -}); - -test('add header action with invalid header value', () => { - expect(() => rule.addAction(new actions.AddHeader({ - name: 'Header', - value: `va - lu`, - }))).toThrow(/`value`/); -}); - -test('add bounce action', () => { - rule.addAction(new actions.Bounce({ - sender: 'noreply@aws.com', - template: actions.BounceTemplate.MESSAGE_CONTENT_REJECTED, - topic, - })); - - Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { - Rule: { - Actions: [ - { - BounceAction: { - Message: 'Message content rejected', - Sender: 'noreply@aws.com', - SmtpReplyCode: '500', - TopicArn: { - Ref: 'TopicBFC7AF6E', - }, - StatusCode: '5.6.1', - }, - }, - ], - Enabled: true, - }, - }); -}); - -test('add lambda action', () => { - const fn = new lambda.Function(stack, 'Function', { - code: lambda.Code.fromInline('boom'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_14_X, - }); - - rule.addAction(new actions.Lambda({ - function: fn, - invocationType: actions.LambdaInvocationType.REQUEST_RESPONSE, - topic, - })); - - Template.fromStack(stack).hasResource('AWS::SES::ReceiptRule', { - Properties: { - Rule: { - Actions: [ - { - LambdaAction: { - FunctionArn: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - InvocationType: 'RequestResponse', - TopicArn: { - Ref: 'TopicBFC7AF6E', - }, - }, - }, - ], - Enabled: true, - }, - RuleSetName: { - Ref: 'RuleSetE30C6C48', - }, - }, - DependsOn: [ - 'FunctionAllowSes1829904A', - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { - Action: 'lambda:InvokeFunction', - FunctionName: { - 'Fn::GetAtt': [ - 'Function76856677', - 'Arn', - ], - }, - Principal: 'ses.amazonaws.com', - SourceAccount: { - Ref: 'AWS::AccountId', - }, - }); -}); - -test('add s3 action', () => { - const bucket = new s3.Bucket(stack, 'Bucket'); - const kmsKey = new kms.Key(stack, 'Key'); - - rule.addAction(new actions.S3({ - bucket, - kmsKey, - objectKeyPrefix: 'emails/', - topic, - })); - - Template.fromStack(stack).hasResource('AWS::SES::ReceiptRule', { - Properties: { - Rule: { - Actions: [ - { - S3Action: { - BucketName: { - Ref: 'Bucket83908E77', - }, - KmsKeyArn: { - 'Fn::GetAtt': [ - 'Key961B73FD', - 'Arn', - ], - }, - ObjectKeyPrefix: 'emails/', - TopicArn: { - Ref: 'TopicBFC7AF6E', - }, - }, - }, - ], - Enabled: true, - }, - RuleSetName: { - Ref: 'RuleSetE30C6C48', - }, - }, - DependsOn: [ - 'BucketPolicyE9A3008A', - ], - }); - - Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { - Bucket: { - Ref: 'Bucket83908E77', - }, - PolicyDocument: { - Statement: [ - { - Action: 's3:PutObject', - Condition: { - StringEquals: { - 'aws:Referer': { - Ref: 'AWS::AccountId', - }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 'ses.amazonaws.com', - }, - Resource: { - 'Fn::Join': [ - '', - [ - { - 'Fn::GetAtt': [ - 'Bucket83908E77', - 'Arn', - ], - }, - '/emails/*', - ], - ], - }, - }, - ], - Version: '2012-10-17', - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', { - KeyPolicy: { - Statement: Match.arrayWith([{ - Action: [ - 'kms:Encrypt', - 'kms:GenerateDataKey', - ], - Condition: { - Null: { - 'kms:EncryptionContext:aws:ses:rule-name': 'false', - 'kms:EncryptionContext:aws:ses:message-id': 'false', - }, - StringEquals: { - 'kms:EncryptionContext:aws:ses:source-account': { - Ref: 'AWS::AccountId', - }, - }, - }, - Effect: 'Allow', - Principal: { - Service: 'ses.amazonaws.com', - }, - Resource: '*', - }]), - }, - }); -}); - -test('add sns action', () => { - rule.addAction(new actions.Sns({ - encoding: actions.EmailEncoding.BASE64, - topic, - })); - - Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { - Rule: { - Actions: [ - { - SNSAction: { - Encoding: 'Base64', - TopicArn: { - Ref: 'TopicBFC7AF6E', - }, - }, - }, - ], - Enabled: true, - }, - }); -}); - -test('add stop action', () => { - rule.addAction(new actions.Stop({ - topic, - })); - - Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { - Rule: { - Actions: [ - { - StopAction: { - Scope: 'RuleSet', - TopicArn: { - Ref: 'TopicBFC7AF6E', - }, - }, - }, - ], - Enabled: true, - }, - }); -}); diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.d.ts b/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.d.ts deleted file mode 100644 index 2cd579eef56f1..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function handler(event: AWSLambda.SESEvent): Promise<{ - disposition: string; -} | null>; diff --git a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.js b/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.js deleted file mode 100644 index c633477efc64d..0000000000000 --- a/packages/@aws-cdk/aws-ses-actions/test/integ.actions.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// Adapted from https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html -async function handler(event) { - console.log('Spam filter'); - const sesNotification = event.Records[0].ses; - console.log('SES Notification: %j', sesNotification); - // Check if any spam check failed - if (sesNotification.receipt.spfVerdict.status === 'FAIL' - || sesNotification.receipt.dkimVerdict.status === 'FAIL' - || sesNotification.receipt.spamVerdict.status === 'FAIL' - || sesNotification.receipt.virusVerdict.status === 'FAIL') { - console.log('Dropping spam'); - // Stop processing rule set, dropping message - return { disposition: 'STOP_RULE_SET' }; - } - return null; -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsMEhBQTBIO0FBQ25ILEtBQUssVUFBVSxPQUFPLENBQUMsS0FBeUI7SUFDckQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQztJQUUzQixNQUFNLGVBQWUsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQztJQUM3QyxPQUFPLENBQUMsR0FBRyxDQUFDLHNCQUFzQixFQUFFLGVBQWUsQ0FBQyxDQUFDO0lBRXJELGlDQUFpQztJQUNqQyxJQUFJLGVBQWUsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLE1BQU0sS0FBSyxNQUFNO1dBQ2pELGVBQWUsQ0FBQyxPQU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PT0gJ0ZBSUwnXG4gICAgICB8fCBzZXNOb3RpZmljYXRpb24ucmVjZWlwdC5ka2ltVmVyZGljdC5zdGF0dXMgPT09ICdGQUlMJ1xuICAgICAgfHwgc2VzTm90aWZpY2F0aW9uLnJlY2VpcHQuc3BhbVZlcmRpY3Quc3RhdHVzID09PSAnRkFJTCdcbiAgICAgIHx8IHNlc05vdGlmaWNhdGlvbi5yZWNlaXB0LnZpcnVzVmVyZGljdC5zdGF0dXMgPT09ICdGQUlMJykge1xuICAgIGNvbnNvbGUubG9nKCdEcm9wcGluZyBzcGFtJyk7XG5cbiAgICAvLyBTdG9wIHByb2Nlc3NpbmcgcnVsZSBzZXQsIGRyb3BwaW5nIG1lc3NhZ2VcbiAgICByZXR1cm4geyBkaXNwb3NpdGlvbjogJ1NUT1BfUlVMRV9TRVQnIH07XG4gIH1cblxuICByZXR1cm4gbnVsbDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/.eslintrc.js b/packages/@aws-cdk/aws-ses/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ses/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ses/.gitignore b/packages/@aws-cdk/aws-ses/.gitignore deleted file mode 100644 index a44eba2329f2d..0000000000000 --- a/packages/@aws-cdk/aws-ses/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ses/.npmignore b/packages/@aws-cdk/aws-ses/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-ses/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ses/LICENSE b/packages/@aws-cdk/aws-ses/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ses/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ses/NOTICE b/packages/@aws-cdk/aws-ses/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ses/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ses/README.md b/packages/@aws-cdk/aws-ses/README.md deleted file mode 100644 index 39debdea04391..0000000000000 --- a/packages/@aws-cdk/aws-ses/README.md +++ /dev/null @@ -1,218 +0,0 @@ -# Amazon Simple Email Service Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Email receiving - -Create a receipt rule set with rules and actions (actions can be found in the -`@aws-cdk/aws-ses-actions` package): - -```ts -import * as s3 from '@aws-cdk/aws-s3'; -import * as actions from '@aws-cdk/aws-ses-actions'; - -const bucket = new s3.Bucket(this, 'Bucket'); -const topic = new sns.Topic(this, 'Topic'); - -new ses.ReceiptRuleSet(this, 'RuleSet', { - rules: [ - { - recipients: ['hello@aws.com'], - actions: [ - new actions.AddHeader({ - name: 'X-Special-Header', - value: 'aws', - }), - new actions.S3({ - bucket, - objectKeyPrefix: 'emails/', - topic, - }), - ], - }, - { - recipients: ['aws.com'], - actions: [ - new actions.Sns({ - topic, - }), - ], - }, - ], -}); -``` - -Alternatively, rules can be added to a rule set: - -```ts -const ruleSet = new ses.ReceiptRuleSet(this, 'RuleSet'); - -const awsRule = ruleSet.addRule('Aws', { - recipients: ['aws.com'], -}); -``` - -And actions to rules: - -```ts -import * as actions from '@aws-cdk/aws-ses-actions'; - -declare const awsRule: ses.ReceiptRule; -declare const topic: sns.Topic; -awsRule.addAction(new actions.Sns({ - topic, -})); -``` - -When using `addRule`, the new rule is added after the last added rule unless `after` is specified. - -### Drop spams - -A rule to drop spam can be added by setting `dropSpam` to `true`: - -```ts -new ses.ReceiptRuleSet(this, 'RuleSet', { - dropSpam: true, -}); -``` - -This will add a rule at the top of the rule set with a Lambda action that stops processing messages that have at least one spam indicator. See [Lambda Function Examples](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html). - - -### Receipt filter - -Create a receipt filter: - -```ts -new ses.ReceiptFilter(this, 'Filter', { - ip: '1.2.3.4/16', // Will be blocked -}); -``` - -An allow list filter is also available: - -```ts -new ses.AllowListReceiptFilter(this, 'AllowList', { - ips: [ - '10.0.0.0/16', - '1.2.3.4/16', - ], -}); -``` - -This will first create a block all filter and then create allow filters for the listed ip addresses. - -## Email sending - -### Dedicated IP pools - -When you create a new Amazon SES account, your emails are sent from IP addresses that are shared with other -Amazon SES users. For [an additional monthly charge](https://aws.amazon.com/ses/pricing/), you can lease -dedicated IP addresses that are reserved for your exclusive use. - -Use the `DedicatedIpPool` construct to create a pool of dedicated IP addresses: - -```ts -new ses.DedicatedIpPool(this, 'Pool'); -``` - -The pool can then be used in a configuration set. - -### Configuration sets - -Configuration sets are groups of rules that you can apply to your verified identities. A verified identity is -a domain, subdomain, or email address you use to send email through Amazon SES. When you apply a configuration -set to an email, all of the rules in that configuration set are applied to the email. - -Use the `ConfigurationSet` construct to create a configuration set: - -```ts -declare const myPool: ses.IDedicatedIpPool; - -new ses.ConfigurationSet(this, 'ConfigurationSet', { - customTrackingRedirectDomain: 'track.cdk.dev', - suppressionReasons: ses.SuppressionReasons.COMPLAINTS_ONLY, - tlsPolicy: ses.ConfigurationSetTlsPolicy.REQUIRE, - dedicatedIpPool: myPool, -}); -``` - -### Email identity - -In Amazon SES, a verified identity is a domain or email address that you use to send or receive email. Before you -can send an email using Amazon SES, you must create and verify each identity that you're going to use as a `From`, -`Source`, `Sender`, or `Return-Path` address. Verifying an identity with Amazon SES confirms that you own it and -helps prevent unauthorized use. - -To verify an identity for a hosted zone, you create an `EmailIdentity`: - -```ts -declare const myHostedZone: route53.IPublicHostedZone; - -const identity = new ses.EmailIdentity(stack, 'Identity', { - identity: ses.Identity.publicHostedZone(myHostedZone), - mailFromDomain: 'mail.cdk.dev', -}); -``` - -By default, [Easy DKIM](https://docs.aws.amazon.com/ses/latest/dg/send-email-authentication-dkim-easy.html) with -a 2048-bit DKIM key is used. - -You can instead configure DKIM authentication by using your own public-private key pair. This process is known -as [Bring Your Own DKIM (BYODKIM)](https://docs.aws.amazon.com/ses/latest/dg/send-email-authentication-dkim-bring-your-own.html): - -```ts -declare const myHostedZone: route53.IPublicHostedZone; - -new ses.EmailIdentity(stack, 'Identity', { - identity: ses.Identity.publicHostedZone(myHostedZone), - dkimIdentity: DkimIdentity.byoDkim({ - privateKey: SecretValue.secretsManager('dkim-private-key'), - publicKey: '...base64-encoded-public-key...', - selector: 'selector', - }), -}); -``` - -When using `publicHostedZone()` for the identity, all necessary Amazon Route 53 records are created automatically: - -* CNAME records for Easy DKIM -* TXT record for BYOD DKIM -* MX and TXT records for the custom MAIL FROM - -When working with `domain()`, records must be created manually: - -```ts -const identity = new ses.EmailIdentity(stack, 'Identity', { - identity: ses.Identity.domain('cdk.dev'), -}); - -for (const record of identity.dkimRecords) { - // create CNAME records using `record.name` and `record.value` -} -``` - -### Virtual Deliverability Manager (VDM) - -Virtual Deliverability Manager is an Amazon SES feature that helps you enhance email deliverability, -like increasing inbox deliverability and email conversions, by providing insights into your sending -and delivery data, and giving advice on how to fix the issues that are negatively affecting your -delivery success rate and reputation. - -Use the `VdmAttributes` construct to configure the Virtual Deliverability Manager for your account: - -```ts -// Enables engagement tracking and optimized shared delivery by default -new ses.VdmAttributes(this, 'Vdm'); -``` diff --git a/packages/@aws-cdk/aws-ses/jest.config.js b/packages/@aws-cdk/aws-ses/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-ses/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ses/package.json b/packages/@aws-cdk/aws-ses/package.json deleted file mode 100644 index 01bfcb1c416f4..0000000000000 --- a/packages/@aws-cdk/aws-ses/package.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "name": "@aws-cdk/aws-ses", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SES", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ses", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ses" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SES", - "packageId": "Amazon.CDK.AWS.SES", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ses", - "module": "aws_cdk.aws_ses", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ses" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SES", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ses" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awslint": { - "exclude": [ - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.addHeaderAction", - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.workmailAction", - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.stopAction", - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.snsAction", - "docs-public-apis:@aws-cdk/aws-ses.DropSpamReceiptRule.rule", - "docs-public-apis:@aws-cdk/aws-ses.ReceiptRule.fromReceiptRuleName", - "docs-public-apis:@aws-cdk/aws-ses.DropSpamReceiptRuleProps", - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.s3Action", - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.bounceAction", - "props-default-doc:@aws-cdk/aws-ses.ReceiptRuleActionConfig.lambdaAction", - "props-physical-name:@aws-cdk/aws-ses.EmailIdentityProps", - "props-physical-name:@aws-cdk/aws-ses.VdmAttributesProps" - ] - }, - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-ses/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ses/rosetta/default.ts-fixture deleted file mode 100644 index 344e962cb852d..0000000000000 --- a/packages/@aws-cdk/aws-ses/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; -import * as route53 from '@aws-cdk/aws-route53'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.ts b/packages/@aws-cdk/aws-ses/test/integ.configuration-set.ts deleted file mode 100644 index ad13af5ea47eb..0000000000000 --- a/packages/@aws-cdk/aws-ses/test/integ.configuration-set.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Construct } from 'constructs'; -import * as ses from '../lib'; - -class TestStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - new ses.ConfigurationSet(this, 'ConfigurationSet'); - } -} - -const app = new App(); - -new integ.IntegTest(app, 'ConfigurationSetInteg', { - testCases: [new TestStack(app, 'cdk-ses-configuration-set-integ')], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ses/test/integ.email-identity.ts b/packages/@aws-cdk/aws-ses/test/integ.email-identity.ts deleted file mode 100644 index 0e82eaf575642..0000000000000 --- a/packages/@aws-cdk/aws-ses/test/integ.email-identity.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Construct } from 'constructs'; -import * as ses from '../lib'; - -class TestStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - const hostedZone = new PublicHostedZone(this, 'HostedZone', { - zoneName: 'cdk.dev', - }); - - new ses.EmailIdentity(this, 'EmailIdentity', { - identity: ses.Identity.publicHostedZone(hostedZone), - mailFromDomain: 'mail.cdk.dev', - }); - } -} - -const app = new App(); - -new integ.IntegTest(app, 'EmailIdentityInteg', { - testCases: [new TestStack(app, 'cdk-ses-email-identity-integ')], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.d.ts b/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.d.ts deleted file mode 100644 index 2cd579eef56f1..0000000000000 --- a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function handler(event: AWSLambda.SESEvent): Promise<{ - disposition: string; -} | null>; diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.js b/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.js deleted file mode 100644 index c633477efc64d..0000000000000 --- a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// Adapted from https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html -async function handler(event) { - console.log('Spam filter'); - const sesNotification = event.Records[0].ses; - console.log('SES Notification: %j', sesNotification); - // Check if any spam check failed - if (sesNotification.receipt.spfVerdict.status === 'FAIL' - || sesNotification.receipt.dkimVerdict.status === 'FAIL' - || sesNotification.receipt.spamVerdict.status === 'FAIL' - || sesNotification.receipt.virusVerdict.status === 'FAIL') { - console.log('Dropping spam'); - // Stop processing rule set, dropping message - return { disposition: 'STOP_RULE_SET' }; - } - return null; -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0JBQStCOzs7QUFFL0IsMEhBQTBIO0FBQ25ILEtBQUssVUFBVSxPQUFPLENBQUMsS0FBeUI7SUFDckQsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQztJQUUzQixNQUFNLGVBQWUsR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQztJQUM3QyxPQUFPLENBQUMsR0FBRyxDQUFDLHNCQUFzQixFQUFFLGVBQWUsQ0FBQyxDQUFDO0lBRXJELGlDQUFpQztJQUNqQyxJQUFJLGVBQWUsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLE1BQU0sS0FBSyxNQUFNO1dBQ2pELGVBQWUsQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLE1BQU0sS0FBSyxNQUFNO1dBQ3JELGVBQWUsQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLE1BQU0sS0FBSyxNQUFNO1dBQ3JELGVBQWUsQ0FBQyxPQUFPLENBQUMsWUFBWSxDQUFDLE1BQU0sS0FBSyxNQUFNLEVBQUU7UUFDN0QsT0FBTyxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ0FBQztRQUU3Qiw2Q0FBNkM7UUFDN0MsT0FBTyxFQUFFLFdBQVcsRUFBRSxlQUFlLEVBQUUsQ0FBQztLQUN6QztJQUVELE9BQU8sSUFBSSxDQUFDO0FBQ2QsQ0FBQztBQWxCRCwwQkFrQkMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1jb25zb2xl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cblxuICByZXR1cm4gbnVsbDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.ts b/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.ts deleted file mode 100644 index 2e6d8a126cd04..0000000000000 --- a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { App, Stack, StackProps } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { Construct } from 'constructs'; -import { VdmAttributes } from '../lib'; - -class TestStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - new VdmAttributes(this, 'Vdm'); - } -} - -const app = new App(); - -new integ.IntegTest(app, 'VdmAttribtuesInteg', { - testCases: [new TestStack(app, 'cdk-integ-ses-vdm-attributes')], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-signer/.eslintrc.js b/packages/@aws-cdk/aws-signer/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-signer/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-signer/.gitignore b/packages/@aws-cdk/aws-signer/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-signer/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-signer/.npmignore b/packages/@aws-cdk/aws-signer/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-signer/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-signer/LICENSE b/packages/@aws-cdk/aws-signer/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-signer/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-signer/NOTICE b/packages/@aws-cdk/aws-signer/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-signer/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-signer/README.md b/packages/@aws-cdk/aws-signer/README.md deleted file mode 100644 index 6c95da4668e7a..0000000000000 --- a/packages/@aws-cdk/aws-signer/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# AWS::Signer Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -AWS Signer is a fully managed code-signing service to ensure the trust and integrity of your code. Organizations validate code against -a digital signature to confirm that the code is unaltered and from a trusted publisher. For more information, see [What Is AWS -Signer?](https://docs.aws.amazon.com/signer/latest/developerguide/Welcome.html) - -## Table of Contents - -- [Signing Platform](#signing-platform) -- [Signing Profile](#signing-profile) - -## Signing Platform - -A signing platform is a predefined set of instructions that specifies the signature format and signing algorithms that AWS Signer should use -to sign a zip file. For more information go to [Signing Platforms in AWS Signer](https://docs.aws.amazon.com/signer/latest/developerguide/gs-platform.html). - -AWS Signer provides a pre-defined set of signing platforms. They are available in the CDK as - - -```text -Platform.AWS_IOT_DEVICE_MANAGEMENT_SHA256_ECDSA -Platform.AWS_LAMBDA_SHA384_ECDSA -Platform.AMAZON_FREE_RTOS_TI_CC3220SF -Platform.AMAZON_FREE_RTOS_DEFAULT -``` - -## Signing Profile - -A signing profile is a code-signing template that can be used to pre-define the signature specifications for a signing job. -A signing profile includes a signing platform to designate the file type to be signed, the signature format, and the signature algorithms. -For more information, visit [Signing Profiles in AWS Signer](https://docs.aws.amazon.com/signer/latest/developerguide/gs-profile.html). - -The following code sets up a signing profile for signing lambda code bundles - - -```ts -const signingProfile = new signer.SigningProfile(this, 'SigningProfile', { - platform: signer.Platform.AWS_LAMBDA_SHA384_ECDSA, -}); -``` - -A signing profile is valid by default for 135 months. This can be modified by specifying the `signatureValidityPeriod` property. diff --git a/packages/@aws-cdk/aws-signer/jest.config.js b/packages/@aws-cdk/aws-signer/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-signer/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-signer/package.json b/packages/@aws-cdk/aws-signer/package.json deleted file mode 100644 index f357f3850ae41..0000000000000 --- a/packages/@aws-cdk/aws-signer/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-signer", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Signer", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Signer", - "packageId": "Amazon.CDK.AWS.Signer", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.signer", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "signer" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-signer", - "module": "aws_cdk.aws_signer" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-signer" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Signer", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Signer", - "aws-signer" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-signer/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-signer/rosetta/default.ts-fixture deleted file mode 100644 index 443e1e88b241a..0000000000000 --- a/packages/@aws-cdk/aws-signer/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as signer from '@aws-cdk/aws-signer'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-simspaceweaver/.eslintrc.js b/packages/@aws-cdk/aws-simspaceweaver/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-simspaceweaver/.gitignore b/packages/@aws-cdk/aws-simspaceweaver/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-simspaceweaver/.npmignore b/packages/@aws-cdk/aws-simspaceweaver/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-simspaceweaver/LICENSE b/packages/@aws-cdk/aws-simspaceweaver/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-simspaceweaver/NOTICE b/packages/@aws-cdk/aws-simspaceweaver/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-simspaceweaver/README.md b/packages/@aws-cdk/aws-simspaceweaver/README.md deleted file mode 100644 index c8d5e511bc634..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::SimSpaceWeaver Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as simspaceweaver from '@aws-cdk/aws-simspaceweaver'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SimSpaceWeaver construct libraries](https://constructs.dev/search?q=simspaceweaver) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SimSpaceWeaver resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SimSpaceWeaver.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SimSpaceWeaver](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SimSpaceWeaver.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-simspaceweaver/jest.config.js b/packages/@aws-cdk/aws-simspaceweaver/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-simspaceweaver/lib/index.ts b/packages/@aws-cdk/aws-simspaceweaver/lib/index.ts deleted file mode 100644 index dcac65b8d156e..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SimSpaceWeaver CloudFormation Resources: -export * from './simspaceweaver.generated'; diff --git a/packages/@aws-cdk/aws-simspaceweaver/package.json b/packages/@aws-cdk/aws-simspaceweaver/package.json deleted file mode 100644 index 46ed41f3b9000..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-simspaceweaver", - "version": "0.0.0", - "description": "AWS::SimSpaceWeaver Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SimSpaceWeaver", - "packageId": "Amazon.CDK.AWS.SimSpaceWeaver", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.simspaceweaver", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "simspaceweaver" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-simspaceweaver", - "module": "aws_cdk.aws_simspaceweaver" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-simspaceweaver" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SimSpaceWeaver", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SimSpaceWeaver", - "aws-simspaceweaver" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-simspaceweaver/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-simspaceweaver/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-simspaceweaver/test/simspaceweaver.test.ts b/packages/@aws-cdk/aws-simspaceweaver/test/simspaceweaver.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-simspaceweaver/test/simspaceweaver.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-sns-subscriptions/.eslintrc.js b/packages/@aws-cdk/aws-sns-subscriptions/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sns-subscriptions/.gitignore b/packages/@aws-cdk/aws-sns-subscriptions/.gitignore deleted file mode 100644 index 3c75e6dc9f7ea..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-sns-subscriptions/.npmignore b/packages/@aws-cdk/aws-sns-subscriptions/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-sns-subscriptions/LICENSE b/packages/@aws-cdk/aws-sns-subscriptions/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-sns-subscriptions/NOTICE b/packages/@aws-cdk/aws-sns-subscriptions/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-sns-subscriptions/README.md b/packages/@aws-cdk/aws-sns-subscriptions/README.md deleted file mode 100644 index 048ca4dd9fdda..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# CDK Construct Library for Amazon Simple Notification Service Subscriptions - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This library provides constructs for adding subscriptions to an Amazon SNS topic. -Subscriptions can be added by calling the `.addSubscription(...)` method on the topic. - -## Subscriptions - -Subscriptions can be added to the following endpoints: - -* HTTPS -* Amazon SQS -* AWS Lambda -* Email -* SMS - -Subscriptions to Amazon SQS and AWS Lambda can be added on topics across regions. - -Create an Amazon SNS Topic to add subscriptions. - -```ts -const myTopic = new sns.Topic(this, 'MyTopic'); -``` - -### HTTPS - -Add an HTTP or HTTPS Subscription to your topic: - -```ts -const myTopic = new sns.Topic(this, 'MyTopic'); - -myTopic.addSubscription(new subscriptions.UrlSubscription('https://foobar.com/')); -``` - -The URL being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve -to a URL during deployment. A typical use case is when the URL is passed in as a [CloudFormation -parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The -following code defines a CloudFormation parameter and uses it in a URL subscription. - -```ts -const myTopic = new sns.Topic(this, 'MyTopic'); -const url = new CfnParameter(this, 'url-param'); - -myTopic.addSubscription(new subscriptions.UrlSubscription(url.valueAsString)); -``` - -### Amazon SQS - -Subscribe a queue to your topic: - -```ts -const myQueue = new sqs.Queue(this, 'MyQueue'); -const myTopic = new sns.Topic(this, 'MyTopic'); - -myTopic.addSubscription(new subscriptions.SqsSubscription(myQueue)); -``` - -KMS key permissions will automatically be granted to SNS when a subscription is made to -an encrypted queue. - -Note that subscriptions of queues in different accounts need to be manually confirmed by -reading the initial message from the queue and visiting the link found in it. - -### AWS Lambda - -Subscribe an AWS Lambda function to your topic: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -const myTopic = new sns.Topic(this, 'myTopic'); -declare const myFunction: lambda.Function; -myTopic.addSubscription(new subscriptions.LambdaSubscription(myFunction)); -``` - -### Email - -Subscribe an email address to your topic: - -```ts -const myTopic = new sns.Topic(this, 'MyTopic'); -myTopic.addSubscription(new subscriptions.EmailSubscription('foo@bar.com')); -``` - -The email being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve -to an email address during deployment. A typical use case is when the email address is passed in as a [CloudFormation -parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The -following code defines a CloudFormation parameter and uses it in an email subscription. - -```ts -const myTopic = new sns.Topic(this, 'Topic'); -const emailAddress = new CfnParameter(this, 'email-param'); - -myTopic.addSubscription(new subscriptions.EmailSubscription(emailAddress.valueAsString)); -``` - -Note that email subscriptions require confirmation by visiting the link sent to the -email address. - -### SMS - -Subscribe an sms number to your topic: - -```ts -const myTopic = new sns.Topic(this, 'Topic'); - -myTopic.addSubscription(new subscriptions.SmsSubscription('+15551231234')); -``` - -The number being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve -to a number during deployment. A typical use case is when the number is passed in as a [CloudFormation -parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The -following code defines a CloudFormation parameter and uses it in an sms subscription. - -```ts -const myTopic = new sns.Topic(this, 'Topic'); -const smsNumber = new CfnParameter(this, 'sms-param'); - -myTopic.addSubscription(new subscriptions.SmsSubscription(smsNumber.valueAsString)); -``` diff --git a/packages/@aws-cdk/aws-sns-subscriptions/jest.config.js b/packages/@aws-cdk/aws-sns-subscriptions/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/lambda.ts b/packages/@aws-cdk/aws-sns-subscriptions/lib/lambda.ts deleted file mode 100644 index a4b0cde12704c..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/lib/lambda.ts +++ /dev/null @@ -1,69 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import { ArnFormat, Names, Stack, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { SubscriptionProps } from './subscription'; - -/** - * Properties for a Lambda subscription - */ -export interface LambdaSubscriptionProps extends SubscriptionProps { - -} -/** - * Use a Lambda function as a subscription target - */ -export class LambdaSubscription implements sns.ITopicSubscription { - constructor(private readonly fn: lambda.IFunction, private readonly props: LambdaSubscriptionProps = {}) { - } - - /** - * Returns a configuration for a Lambda function to subscribe to an SNS topic - */ - public bind(topic: sns.ITopic): sns.TopicSubscriptionConfig { - // Create subscription under *consuming* construct to make sure it ends up - // in the correct stack in cases of cross-stack subscriptions. - if (!(this.fn instanceof Construct)) { - throw new Error('The supplied lambda Function object must be an instance of Construct'); - } - - this.fn.addPermission(`AllowInvoke:${Names.nodeUniqueId(topic.node)}`, { - sourceArn: topic.topicArn, - principal: new iam.ServicePrincipal('sns.amazonaws.com'), - }); - - // if the topic and function are created in different stacks - // then we need to make sure the topic is created first - if (topic instanceof sns.Topic && topic.stack !== this.fn.stack) { - this.fn.stack.addDependency(topic.stack); - } - - return { - subscriberScope: this.fn, - subscriberId: topic.node.id, - endpoint: this.fn.functionArn, - protocol: sns.SubscriptionProtocol.LAMBDA, - filterPolicy: this.props.filterPolicy, - filterPolicyWithMessageBody: this.props.filterPolicyWithMessageBody, - region: this.regionFromArn(topic), - deadLetterQueue: this.props.deadLetterQueue, - }; - } - - private regionFromArn(topic: sns.ITopic): string | undefined { - // no need to specify `region` for topics defined within the same stack. - if (topic instanceof sns.Topic) { - if (topic.stack !== this.fn.stack) { - // only if we know the region, will not work for - // env agnostic stacks - if (!Token.isUnresolved(topic.env.region) && - (topic.env.region !== this.fn.env.region)) { - return topic.env.region; - } - } - return undefined; - } - return Stack.of(topic).splitArn(topic.topicArn, ArnFormat.SLASH_RESOURCE_NAME).region; - } -} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/sqs.ts b/packages/@aws-cdk/aws-sns-subscriptions/lib/sqs.ts deleted file mode 100644 index 340643632876c..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/lib/sqs.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { ArnFormat, FeatureFlags, Names, Stack, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { SubscriptionProps } from './subscription'; - -/** - * Properties for an SQS subscription - */ -export interface SqsSubscriptionProps extends SubscriptionProps { - /** - * The message to the queue is the same as it was sent to the topic - * - * If false, the message will be wrapped in an SNS envelope. - * - * @default false - */ - readonly rawMessageDelivery?: boolean; -} - -/** - * Use an SQS queue as a subscription target - */ -export class SqsSubscription implements sns.ITopicSubscription { - constructor(private readonly queue: sqs.IQueue, private readonly props: SqsSubscriptionProps = {}) { - } - - /** - * Returns a configuration for an SQS queue to subscribe to an SNS topic - */ - public bind(topic: sns.ITopic): sns.TopicSubscriptionConfig { - // Create subscription under *consuming* construct to make sure it ends up - // in the correct stack in cases of cross-stack subscriptions. - if (!(this.queue instanceof Construct)) { - throw new Error('The supplied Queue object must be an instance of Construct'); - } - const snsServicePrincipal = new iam.ServicePrincipal('sns.amazonaws.com'); - - // add a statement to the queue resource policy which allows this topic - // to send messages to the queue. - const queuePolicyDependable = this.queue.addToResourcePolicy(new iam.PolicyStatement({ - resources: [this.queue.queueArn], - actions: ['sqs:SendMessage'], - principals: [snsServicePrincipal], - conditions: { - ArnEquals: { 'aws:SourceArn': topic.topicArn }, - }, - })).policyDependable; - - // if the queue is encrypted, add a statement to the key resource policy - // which allows this topic to decrypt KMS keys - if (this.queue.encryptionMasterKey) { - this.queue.encryptionMasterKey.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['kms:Decrypt', 'kms:GenerateDataKey'], - principals: [snsServicePrincipal], - conditions: FeatureFlags.of(topic).isEnabled(cxapi.SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY) - ? { ArnEquals: { 'aws:SourceArn': topic.topicArn } } - : undefined, - })); - } - - // if the topic and queue are created in different stacks - // then we need to make sure the topic is created first - if (topic instanceof sns.Topic && topic.stack !== this.queue.stack) { - this.queue.stack.addDependency(topic.stack); - } - - return { - subscriberScope: this.queue, - subscriberId: Names.nodeUniqueId(topic.node), - endpoint: this.queue.queueArn, - protocol: sns.SubscriptionProtocol.SQS, - rawMessageDelivery: this.props.rawMessageDelivery, - filterPolicy: this.props.filterPolicy, - filterPolicyWithMessageBody: this.props.filterPolicyWithMessageBody, - region: this.regionFromArn(topic), - deadLetterQueue: this.props.deadLetterQueue, - subscriptionDependency: queuePolicyDependable, - }; - } - - private regionFromArn(topic: sns.ITopic): string | undefined { - // no need to specify `region` for topics defined within the same stack - if (topic instanceof sns.Topic) { - if (topic.stack !== this.queue.stack) { - // only if we know the region, will not work for - // env agnostic stacks - if (!Token.isUnresolved(topic.env.region) && - (topic.env.region !== this.queue.env.region)) { - return topic.env.region; - } - } - return undefined; - } - return Stack.of(topic).splitArn(topic.topicArn, ArnFormat.SLASH_RESOURCE_NAME).region; - } -} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/subscription.ts b/packages/@aws-cdk/aws-sns-subscriptions/lib/subscription.ts deleted file mode 100644 index 291699ca304f1..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/lib/subscription.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as sns from '@aws-cdk/aws-sns'; -import { IQueue } from '@aws-cdk/aws-sqs'; - -/** - * Options to subscribing to an SNS topic - */ -export interface SubscriptionProps { - /** - * The filter policy. - * - * @default - all messages are delivered - */ - readonly filterPolicy?: { [attribute: string]: sns.SubscriptionFilter }; - /** - * The filter policy that is applied on the message body. - * To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. - * - * @default - all messages are delivered - */ - readonly filterPolicyWithMessageBody?: { [attribute: string]: sns.FilterOrPolicy }; - /** - * Queue to be used as dead letter queue. - * If not passed no dead letter queue is enabled. - * - * @default - No dead letter queue enabled. - */ - readonly deadLetterQueue?: IQueue; -} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/package.json b/packages/@aws-cdk/aws-sns-subscriptions/package.json deleted file mode 100644 index 9bc3d86788313..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "@aws-cdk/aws-sns-subscriptions", - "version": "0.0.0", - "private": true, - "description": "CDK Subscription Constructs for AWS SNS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.sns.subscriptions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "sns-subscriptions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SNS.Subscriptions", - "packageId": "Amazon.CDK.AWS.SNS.Subscriptions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-sns-subscriptions", - "module": "aws_cdk.aws_sns_subscriptions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-sns-subscriptions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "sns" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-sns-subscriptions/rosetta/default.ts-fixture deleted file mode 100644 index 8fd7cde78ac48..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { CfnParameter, Duration, Stack } from '@aws-cdk/core'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as subscriptions from '@aws-cdk/aws-sns-subscriptions'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts deleted file mode 100644 index 2ac3eeab7bc99..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts +++ /dev/null @@ -1,28 +0,0 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as subs from '../lib'; - -/// !cdk-integ * pragma:enable-lookups -const app = new cdk.App(); - -/// !show -const topicStack = new cdk.Stack(app, 'TopicStack', { - env: { - account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, - region: 'us-east-1', - }, -}); -const topic = new sns.Topic(topicStack, 'MyTopic', { - topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, -}); - -const queueStack = new cdk.Stack(app, 'QueueStack', { - env: { region: 'us-east-2' }, -}); -const queue = new sqs.Queue(queueStack, 'MyQueue'); - -topic.addSubscription(new subs.SqsSubscription(queue)); -/// !hide - -app.synth(); diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/cdk.out b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/cdk.out deleted file mode 100644 index 145739f539580..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"22.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts b/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts deleted file mode 100755 index cb3f4d8e27151..0000000000000 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as subs from '../lib'; - -const restrictSqsDescryption = { [cxapi.SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY]: true }; - -class SnsToSqs extends cdk.Stack { - constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { - super(scope, id, props); - - /// !show - const topic = new sns.Topic(this, 'MyTopic'); - const queue = new sqs.Queue(this, 'MyQueue', { - encryptionMasterKey: new kms.Key(this, 'EncryptionMasterKey'), - }); - - topic.addSubscription(new subs.SqsSubscription(queue, { - deadLetterQueue: new sqs.Queue(this, 'DeadLetterQueue'), - })); - /// !hide - } -} - -const app = new cdk.App({ - context: restrictSqsDescryption, -}); - -new SnsToSqs(app, 'aws-cdk-sns-sqs'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-sns/.eslintrc.js b/packages/@aws-cdk/aws-sns/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-sns/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sns/.gitignore b/packages/@aws-cdk/aws-sns/.gitignore deleted file mode 100644 index e025f81c8fde3..0000000000000 --- a/packages/@aws-cdk/aws-sns/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -*.generated.ts -dist -tsconfig.json -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-sns/.npmignore b/packages/@aws-cdk/aws-sns/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-sns/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-sns/LICENSE b/packages/@aws-cdk/aws-sns/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-sns/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-sns/NOTICE b/packages/@aws-cdk/aws-sns/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-sns/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-sns/README.md b/packages/@aws-cdk/aws-sns/README.md deleted file mode 100644 index 0b03c87d5821a..0000000000000 --- a/packages/@aws-cdk/aws-sns/README.md +++ /dev/null @@ -1,218 +0,0 @@ -# Amazon Simple Notification Service Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Add an SNS Topic to your stack: - -```ts -const topic = new sns.Topic(this, 'Topic', { - displayName: 'Customer subscription topic', -}); -``` - -Add a FIFO SNS topic with content-based de-duplication to your stack: - -```ts -const topic = new sns.Topic(this, 'Topic', { - contentBasedDeduplication: true, - displayName: 'Customer subscription topic', - fifo: true, -}); -``` - -Note that FIFO topics require a topic name to be provided. The required `.fifo` suffix will be automatically generated and added to the topic name if it is not explicitly provided. - -## Subscriptions - -Various subscriptions can be added to the topic by calling the -`.addSubscription(...)` method on the topic. It accepts a *subscription* object, -default implementations of which can be found in the -`@aws-cdk/aws-sns-subscriptions` package: - -Add an HTTPS Subscription to your topic: - -```ts -const myTopic = new sns.Topic(this, 'MyTopic'); - -myTopic.addSubscription(new subscriptions.UrlSubscription('https://foobar.com/')); -``` - -Subscribe a queue to the topic: - -```ts -declare const queue: sqs.Queue; -const myTopic = new sns.Topic(this, 'MyTopic'); - -myTopic.addSubscription(new subscriptions.SqsSubscription(queue)); -``` - -Note that subscriptions of queues in different accounts need to be manually confirmed by -reading the initial message from the queue and visiting the link found in it. - -### Filter policy - -A filter policy can be specified when subscribing an endpoint to a topic. - -Example with a Lambda subscription: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -const myTopic = new sns.Topic(this, 'MyTopic'); -declare const fn: lambda.Function; - -// Lambda should receive only message matching the following conditions on attributes: -// color: 'red' or 'orange' or begins with 'bl' -// size: anything but 'small' or 'medium' -// price: between 100 and 200 or greater than 300 -// store: attribute must be present -myTopic.addSubscription(new subscriptions.LambdaSubscription(fn, { - filterPolicy: { - color: sns.SubscriptionFilter.stringFilter({ - allowlist: ['red', 'orange'], - matchPrefixes: ['bl'], - }), - size: sns.SubscriptionFilter.stringFilter({ - denylist: ['small', 'medium'], - }), - price: sns.SubscriptionFilter.numericFilter({ - between: { start: 100, stop: 200 }, - greaterThan: 300, - }), - store: sns.SubscriptionFilter.existsFilter(), - }, -})); -``` - -#### Payload-based filtering - -To filter messages based on the payload or body of the message, use the `filterPolicyWithMessageBody` property. This type of filter policy supports creating filters on nested objects. - -Example with a Lambda subscription: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -const myTopic = new sns.Topic(this, 'MyTopic'); -declare const fn: lambda.Function; - -// Lambda should receive only message matching the following conditions on message body: -// color: 'red' or 'orange' -myTopic.addSubscription(new subscriptions.LambdaSubscription(fn, { - filterPolicyWithMessageBody: { - background: sns.FilterOrPolicy.policy({ - color: sns.FilterOrPolicy.filter(sns.SubscriptionFilter.stringFilter({ - allowlist: ['red', 'orange'], - })), - }), - }, -})); -``` - -### Example of Firehose Subscription - -```ts -import { DeliveryStream } from '@aws-cdk/aws-kinesisfirehose'; - -const topic = new sns.Topic(this, 'Topic'); -declare const stream: DeliveryStream; - -new sns.Subscription(this, 'Subscription', { - topic, - endpoint: stream.deliveryStreamArn, - protocol: sns.SubscriptionProtocol.FIREHOSE, - subscriptionRoleArn: "SAMPLE_ARN", //role with permissions to send messages to a firehose delivery stream -}); -``` - -## DLQ setup for SNS Subscription - -CDK can attach provided Queue as DLQ for your SNS subscription. -See the [SNS DLQ configuration docs](https://docs.aws.amazon.com/sns/latest/dg/sns-configure-dead-letter-queue.html) for more information about this feature. - -Example of usage with user provided DLQ. - -```ts -const topic = new sns.Topic(this, 'Topic'); -const dlQueue = new sqs.Queue(this, 'DeadLetterQueue', { - queueName: 'MySubscription_DLQ', - retentionPeriod: Duration.days(14), -}); - -new sns.Subscription(this, 'Subscription', { - endpoint: 'endpoint', - protocol: sns.SubscriptionProtocol.LAMBDA, - topic, - deadLetterQueue: dlQueue, -}); -``` - -## CloudWatch Event Rule Target - -SNS topics can be used as targets for CloudWatch event rules. - -Use the `@aws-cdk/aws-events-targets.SnsTopic`: - -```ts -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as targets from '@aws-cdk/aws-events-targets'; - -declare const repo: codecommit.Repository; -const myTopic = new sns.Topic(this, 'Topic'); - -repo.onCommit('OnCommit', { - target: new targets.SnsTopic(myTopic), -}); -``` - -This will result in adding a target to the event rule and will also modify the -topic resource policy to allow CloudWatch events to publish to the topic. - -## Topic Policy - -A topic policy is automatically created when `addToResourcePolicy` is called, if -one doesn't already exist. Using `addToResourcePolicy` is the simplest way to -add policies, but a `TopicPolicy` can also be created manually. - -```ts -const topic = new sns.Topic(this, 'Topic'); -const topicPolicy = new sns.TopicPolicy(this, 'TopicPolicy', { - topics: [topic], -}); - -topicPolicy.document.addStatements(new iam.PolicyStatement({ - actions: ["sns:Subscribe"], - principals: [new iam.AnyPrincipal()], - resources: [topic.topicArn], -})); -``` - -A policy document can also be passed on `TopicPolicy` construction - -```ts -const topic = new sns.Topic(this, 'Topic'); -const policyDocument = new iam.PolicyDocument({ - assignSids: true, - statements: [ - new iam.PolicyStatement({ - actions: ["sns:Subscribe"], - principals: [new iam.AnyPrincipal()], - resources: [topic.topicArn], - }), - ], -}); - -const topicPolicy = new sns.TopicPolicy(this, 'Policy', { - topics: [topic], - policyDocument, -}); -``` diff --git a/packages/@aws-cdk/aws-sns/jest.config.js b/packages/@aws-cdk/aws-sns/jest.config.js deleted file mode 100644 index dcc7c22a3aae9..0000000000000 --- a/packages/@aws-cdk/aws-sns/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 70, - statements: 80, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-sns/lib/policy.ts b/packages/@aws-cdk/aws-sns/lib/policy.ts deleted file mode 100644 index e201e39959cb3..0000000000000 --- a/packages/@aws-cdk/aws-sns/lib/policy.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { PolicyDocument } from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnTopicPolicy } from './sns.generated'; -import { ITopic } from './topic-base'; - -/** - * Properties to associate SNS topics with a policy - */ -export interface TopicPolicyProps { - /** - * The set of topics this policy applies to. - */ - readonly topics: ITopic[]; - /** - * IAM policy document to apply to topic(s). - * @default empty policy document - */ - readonly policyDocument?: PolicyDocument; - -} - -/** - * The policy for an SNS Topic - * - * Policies define the operations that are allowed on this resource. - * - * You almost never need to define this construct directly. - * - * All AWS resources that support resource policies have a method called - * `addToResourcePolicy()`, which will automatically create a new resource - * policy if one doesn't exist yet, otherwise it will add to the existing - * policy. - * - * Prefer to use `addToResourcePolicy()` instead. - */ -export class TopicPolicy extends Resource { - /** - * The IAM policy document for this policy. - */ - public readonly document = new PolicyDocument({ - // statements must be unique, so we use the statement index. - // potantially SIDs can change as a result of order change, but this should - // not have an impact on the policy evaluation. - // https://docs.aws.amazon.com/sns/latest/dg/AccessPolicyLanguage_SpecialInfo.html - assignSids: true, - }); - - constructor(scope: Construct, id: string, props: TopicPolicyProps) { - super(scope, id); - - this.document = props.policyDocument ?? this.document; - - new CfnTopicPolicy(this, 'Resource', { - policyDocument: this.document, - topics: props.topics.map(t => t.topicArn), - }); - } -} diff --git a/packages/@aws-cdk/aws-sns/lib/subscription.ts b/packages/@aws-cdk/aws-sns/lib/subscription.ts deleted file mode 100644 index e8e7d0cde84d9..0000000000000 --- a/packages/@aws-cdk/aws-sns/lib/subscription.ts +++ /dev/null @@ -1,352 +0,0 @@ -import { PolicyStatement, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IQueue } from '@aws-cdk/aws-sqs'; -import { Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { CfnSubscription } from './sns.generated'; -import { SubscriptionFilter } from './subscription-filter'; -import { ITopic } from './topic-base'; - -/** - * Options for creating a new subscription - */ -export interface SubscriptionOptions { - /** - * What type of subscription to add. - */ - readonly protocol: SubscriptionProtocol; - - /** - * The subscription endpoint. - * - * The meaning of this value depends on the value for 'protocol'. - */ - readonly endpoint: string; - - /** - * true if raw message delivery is enabled for the subscription. Raw messages are free of JSON formatting and can be - * sent to HTTP/S and Amazon SQS endpoints. For more information, see GetSubscriptionAttributes in the Amazon Simple - * Notification Service API Reference. - * - * @default false - */ - readonly rawMessageDelivery?: boolean; - - /** - * The filter policy. - * - * @default - all messages are delivered - */ - readonly filterPolicy? : { [attribute: string]: SubscriptionFilter }; - - /** - * The filter policy that is applied on the message body. - * To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. - * - * @default - all messages are delivered - */ - readonly filterPolicyWithMessageBody?: { [attribute: string]: FilterOrPolicy }; - - /** - * The region where the topic resides, in the case of cross-region subscriptions - * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-region - * @default - the region where the CloudFormation stack is being deployed. - */ - readonly region?: string; - - /** - * Queue to be used as dead letter queue. - * If not passed no dead letter queue is enabled. - * - * @default - No dead letter queue enabled. - */ - readonly deadLetterQueue?: IQueue; - - /** - * Arn of role allowing access to firehose delivery stream. - * Required for a firehose subscription protocol. - * @default - No subscription role is provided - */ - readonly subscriptionRoleArn?: string; -} -/** - * Properties for creating a new subscription - */ -export interface SubscriptionProps extends SubscriptionOptions { - /** - * The topic to subscribe to. - */ - readonly topic: ITopic; -} - -/** - * A new subscription. - * - * Prefer to use the `ITopic.addSubscription()` methods to create instances of - * this class. - */ -export class Subscription extends Resource { - - /** - * The DLQ associated with this subscription if present. - */ - public readonly deadLetterQueue?: IQueue; - - private readonly filterPolicy?: { [attribute: string]: any[] }; - - private readonly filterPolicyWithMessageBody? : {[attribute: string]: FilterOrPolicy }; - - constructor(scope: Construct, id: string, props: SubscriptionProps) { - super(scope, id); - - if (props.rawMessageDelivery && - [ - SubscriptionProtocol.HTTP, - SubscriptionProtocol.HTTPS, - SubscriptionProtocol.SQS, - SubscriptionProtocol.FIREHOSE, - ] - .indexOf(props.protocol) < 0) { - throw new Error('Raw message delivery can only be enabled for HTTP, HTTPS, SQS, and Firehose subscriptions.'); - } - - if (props.filterPolicy) { - if (Object.keys(props.filterPolicy).length > 5) { - throw new Error('A filter policy can have a maximum of 5 attribute names.'); - } - - this.filterPolicy = Object.entries(props.filterPolicy) - .reduce( - (acc, [k, v]) => ({ ...acc, [k]: v.conditions }), - {}, - ); - - let total = 1; - Object.values(this.filterPolicy).forEach(filter => { total *= filter.length; }); - if (total > 150) { - throw new Error(`The total combination of values (${total}) must not exceed 150.`); - } - } else if (props.filterPolicyWithMessageBody) { - if (Object.keys(props.filterPolicyWithMessageBody).length > 5) { - throw new Error('A filter policy can have a maximum of 5 attribute names.'); - } - this.filterPolicyWithMessageBody = props.filterPolicyWithMessageBody; - } - - if (props.protocol === SubscriptionProtocol.FIREHOSE && !props.subscriptionRoleArn) { - throw new Error('Subscription role arn is required field for subscriptions with a firehose protocol.'); - } - - // Format filter policy - const filterPolicy = this.filterPolicyWithMessageBody - ? buildFilterPolicyWithMessageBody(this.filterPolicyWithMessageBody) - : this.filterPolicy; - - this.deadLetterQueue = this.buildDeadLetterQueue(props); - new CfnSubscription(this, 'Resource', { - endpoint: props.endpoint, - protocol: props.protocol, - topicArn: props.topic.topicArn, - rawMessageDelivery: props.rawMessageDelivery, - filterPolicy, - filterPolicyScope: this.filterPolicyWithMessageBody ? 'MessageBody' : undefined, - region: props.region, - redrivePolicy: this.buildDeadLetterConfig(this.deadLetterQueue), - subscriptionRoleArn: props.subscriptionRoleArn, - }); - - } - - private buildDeadLetterQueue(props: SubscriptionProps) { - if (!props.deadLetterQueue) { - return undefined; - } - - const deadLetterQueue = props.deadLetterQueue; - - deadLetterQueue.addToResourcePolicy(new PolicyStatement({ - resources: [deadLetterQueue.queueArn], - actions: ['sqs:SendMessage'], - principals: [new ServicePrincipal('sns.amazonaws.com')], - conditions: { - ArnEquals: { 'aws:SourceArn': props.topic.topicArn }, - }, - })); - - return deadLetterQueue; - } - - private buildDeadLetterConfig(deadLetterQueue?: IQueue) { - if (deadLetterQueue) { - return { - deadLetterTargetArn: deadLetterQueue.queueArn, - }; - } else { - return undefined; - } - } -} - -/** - * The type of subscription, controlling the type of the endpoint parameter. - */ -export enum SubscriptionProtocol { - /** - * JSON-encoded message is POSTED to an HTTP url. - */ - HTTP = 'http', - - /** - * JSON-encoded message is POSTed to an HTTPS url. - */ - HTTPS = 'https', - - /** - * Notifications are sent via email. - */ - EMAIL = 'email', - - /** - * Notifications are JSON-encoded and sent via mail. - */ - EMAIL_JSON = 'email-json', - - /** - * Notification is delivered by SMS - */ - SMS = 'sms', - - /** - * Notifications are enqueued into an SQS queue. - */ - SQS = 'sqs', - - /** - * JSON-encoded notifications are sent to a mobile app endpoint. - */ - APPLICATION = 'application', - - /** - * Notifications trigger a Lambda function. - */ - LAMBDA = 'lambda', - - /** - * Notifications put records into a firehose delivery stream. - */ - FIREHOSE = 'firehose' -} - -function buildFilterPolicyWithMessageBody( - inputObject: { [key: string]: FilterOrPolicy }, - depth = 1, - totalCombinationValues = [1], -): { [key: string]: any } { - const result: { [key: string]: any } = {}; - - for (const [key, filterOrPolicy] of Object.entries(inputObject)) { - if (filterOrPolicy.isPolicy()) { - result[key] = buildFilterPolicyWithMessageBody(filterOrPolicy.policyDoc, depth + 1, totalCombinationValues); - } else if (filterOrPolicy.isFilter()) { - const filter = filterOrPolicy.filterDoc.conditions; - result[key] = filter; - totalCombinationValues[0] *= filter.length * depth; - } - } - - // https://docs.aws.amazon.com/sns/latest/dg/subscription-filter-policy-constraints.html - if (totalCombinationValues[0] > 150) { - throw new Error(`The total combination of values (${totalCombinationValues}) must not exceed 150.`); - } - - return result; -}; - -/** - * The type of the MessageBody at a given key value pair - */ -export enum FilterOrPolicyType { - /** - * The filter of the MessageBody - */ - FILTER, - /** - * A nested key of the MessageBody - */ - POLICY, -} - -/** - * Class for building the FilterPolicy by avoiding union types - */ -export abstract class FilterOrPolicy { - /** - * Filter of MessageBody - * @param filter - * @returns - */ - public static filter(filter: SubscriptionFilter) { - return new Filter(filter); - } - - /** - * Policy of MessageBody - * @param policy - * @returns - */ - public static policy(policy: { [attribute: string]: FilterOrPolicy }) { - return new Policy(policy); - } - - /** - * Type switch for disambiguating between subclasses - */ - abstract readonly type: FilterOrPolicyType; - - /** - * Check if instance is `Policy` type - */ - public isPolicy(): this is Policy { - return this.type === FilterOrPolicyType.POLICY; - } - - /** - * Check if instance is `Filter` type - */ - public isFilter(): this is Filter { - return this.type === FilterOrPolicyType.FILTER; - } -} - -/** - * Filter implementation of FilterOrPolicy - */ -export class Filter extends FilterOrPolicy { - /** - * Type used in DFS buildFilterPolicyWithMessageBody to determine json value type - */ - public readonly type = FilterOrPolicyType.FILTER; - /** - * Policy constructor - * @param filterDoc filter argument to construct - */ - public constructor(public readonly filterDoc: SubscriptionFilter) { - super(); - } -} - -/** - * Policy Implementation of FilterOrPolicy - */ -export class Policy extends FilterOrPolicy { - /** - * Type used in DFS buildFilterPolicyWithMessageBody to determine json value type - */ - public readonly type = FilterOrPolicyType.POLICY; - /** - * Policy constructor - * @param policyDoc policy argument to construct - */ - public constructor(public readonly policyDoc: { [attribute: string]: FilterOrPolicy }) { - super(); - } -} diff --git a/packages/@aws-cdk/aws-sns/package.json b/packages/@aws-cdk/aws-sns/package.json deleted file mode 100644 index b00ffc01dd2a5..0000000000000 --- a/packages/@aws-cdk/aws-sns/package.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "name": "@aws-cdk/aws-sns", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SNS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.sns", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "sns" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SNS", - "packageId": "Amazon.CDK.AWS.SNS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-sns", - "module": "aws_cdk.aws_sns", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "excludeTypescript": [ - "examples" - ], - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-sns" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SNS", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "sns" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-sns.SubscriptionProps", - "props-physical-name:@aws-cdk/aws-sns.TopicPolicyProps" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-sns/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-sns/rosetta/default.ts-fixture deleted file mode 100644 index 72fda381ecb7a..0000000000000 --- a/packages/@aws-cdk/aws-sns/rosetta/default.ts-fixture +++ /dev/null @@ -1,15 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as subscriptions from '@aws-cdk/aws-sns-subscriptions'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.ts b/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.ts deleted file mode 100644 index 6c12d9bcc7c5a..0000000000000 --- a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { Topic } from '../lib'; - -const app = new App(); - -const stack = new Stack(app, 'aws-cdk-sns-fifo-1'); - -new Topic(stack, 'MyTopic', { - fifo: true, -}); - -new IntegTest(app, 'SnsFifoNoNameTest', { - testCases: [stack], -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.ts b/packages/@aws-cdk/aws-sns/test/integ.sns.ts deleted file mode 100644 index 99d1bd8bd5ec5..0000000000000 --- a/packages/@aws-cdk/aws-sns/test/integ.sns.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Key } from '@aws-cdk/aws-kms'; -import { App, Stack, StackProps } from '@aws-cdk/core'; -import { Topic } from '../lib'; - -class SNSInteg extends Stack { - constructor(scope: App, id: string, props?: StackProps) { - super(scope, id, props); - - const key = new Key(this, 'CustomKey'); - - new Topic(this, 'MyTopic', { - topicName: 'fooTopic', - displayName: 'fooDisplayName', - masterKey: key, - }); - } -} - -const app = new App(); - -new SNSInteg(app, 'SNSInteg'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-sns/test/sns.test.ts b/packages/@aws-cdk/aws-sns/test/sns.test.ts deleted file mode 100644 index 91d28280084d3..0000000000000 --- a/packages/@aws-cdk/aws-sns/test/sns.test.ts +++ /dev/null @@ -1,499 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; -import * as sns from '../lib'; - -/* eslint-disable quote-props */ - -describe('Topic', () => { - describe('topic tests', () => { - test('all defaults', () => { - const stack = new cdk.Stack(); - new sns.Topic(stack, 'MyTopic'); - - Template.fromStack(stack).resourceCountIs('AWS::SNS::Topic', 1); - - }); - - test('specify topicName', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - topicName: 'topicName', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'TopicName': 'topicName', - }); - - - }); - - test('specify displayName', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - displayName: 'displayName', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'DisplayName': 'displayName', - }); - - - }); - - test('specify kmsMasterKey', () => { - const stack = new cdk.Stack(); - const key = new kms.Key(stack, 'CustomKey'); - - new sns.Topic(stack, 'MyTopic', { - masterKey: key, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'KmsMasterKeyId': { 'Fn::GetAtt': ['CustomKey1E6D0D07', 'Arn'] }, - }); - - - }); - - test('specify displayName and topicName', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - topicName: 'topicName', - displayName: 'displayName', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'DisplayName': 'displayName', - 'TopicName': 'topicName', - }); - - - }); - - test('Adds .fifo suffix when no topicName is passed', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - fifo: true, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'FifoTopic': true, - 'TopicName': 'MyTopic.fifo', - }); - - }); - - test('specify fifo without .fifo suffix in topicName', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - fifo: true, - topicName: 'topicName', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'FifoTopic': true, - 'TopicName': 'topicName.fifo', - }); - - - }); - - test('specify fifo with .fifo suffix in topicName', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - fifo: true, - topicName: 'topicName.fifo', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'FifoTopic': true, - 'TopicName': 'topicName.fifo', - }); - - - }); - - test('specify fifo without contentBasedDeduplication', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - fifo: true, - topicName: 'topicName', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'FifoTopic': true, - 'TopicName': 'topicName.fifo', - }); - - - }); - - test('specify fifo with contentBasedDeduplication', () => { - const stack = new cdk.Stack(); - - new sns.Topic(stack, 'MyTopic', { - contentBasedDeduplication: true, - fifo: true, - topicName: 'topicName', - }); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { - 'ContentBasedDeduplication': true, - 'FifoTopic': true, - 'TopicName': 'topicName.fifo', - }); - - - }); - - test('throw with contentBasedDeduplication on non-fifo topic', () => { - const stack = new cdk.Stack(); - - expect(() => new sns.Topic(stack, 'MyTopic', { - contentBasedDeduplication: true, - })).toThrow(/Content based deduplication can only be enabled for FIFO SNS topics./); - - - }); - }); - - test('can add a policy to the topic', () => { - // GIVEN - const stack = new cdk.Stack(); - const topic = new sns.Topic(stack, 'Topic'); - - // WHEN - topic.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['sns:*'], - principals: [new iam.ArnPrincipal('arn')], - })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [{ - 'Sid': '0', - 'Action': 'sns:*', - 'Effect': 'Allow', - 'Principal': { 'AWS': 'arn' }, - 'Resource': '*', - }], - }, - }); - - - }); - - test('give publishing permissions', () => { - // GIVEN - const stack = new cdk.Stack(); - const topic = new sns.Topic(stack, 'Topic'); - const user = new iam.User(stack, 'User'); - - // WHEN - topic.grantPublish(user); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - Version: '2012-10-17', - 'Statement': [ - { - 'Action': 'sns:Publish', - 'Effect': 'Allow', - 'Resource': stack.resolve(topic.topicArn), - }, - ], - }, - }); - - - }); - - test('TopicPolicy passed document', () => { - // GIVEN - const stack = new cdk.Stack(); - const topic = new sns.Topic(stack, 'MyTopic'); - const ps = new iam.PolicyStatement({ - actions: ['service:statement0'], - principals: [new iam.ArnPrincipal('arn')], - }); - - // WHEN - new sns.TopicPolicy(stack, 'topicpolicy', { topics: [topic], policyDocument: new iam.PolicyDocument({ assignSids: true, statements: [ps] }) }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': 'service:statement0', - 'Effect': 'Allow', - 'Principal': { 'AWS': 'arn' }, - 'Sid': '0', - }, - ], - 'Version': '2012-10-17', - }, - 'Topics': [ - { - 'Ref': 'MyTopic86869434', - }, - ], - }); - - - }); - - test('Add statements to policy', () => { - // GIVEN - const stack = new cdk.Stack(); - const topic = new sns.Topic(stack, 'MyTopic'); - - // WHEN - const topicPolicy = new sns.TopicPolicy(stack, 'TopicPolicy', { - topics: [topic], - }); - topicPolicy.document.addStatements(new iam.PolicyStatement({ - actions: ['service:statement0'], - principals: [new iam.ArnPrincipal('arn')], - })); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': 'service:statement0', - 'Effect': 'Allow', - 'Principal': { 'AWS': 'arn' }, - 'Sid': '0', - }, - ], - 'Version': '2012-10-17', - }, - 'Topics': [ - { - 'Ref': 'MyTopic86869434', - }, - ], - }); - - }); - - test('topic resource policy includes unique SIDs', () => { - const stack = new cdk.Stack(); - - const topic = new sns.Topic(stack, 'MyTopic'); - - topic.addToResourcePolicy(new iam.PolicyStatement({ - actions: ['service:statement0'], - principals: [new iam.ArnPrincipal('arn')], - })); - topic.addToResourcePolicy(new iam.PolicyStatement({ - actions: ['service:statement1'], - principals: [new iam.ArnPrincipal('arn')], - })); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': 'service:statement0', - 'Effect': 'Allow', - 'Principal': { 'AWS': 'arn' }, - 'Sid': '0', - }, - { - 'Action': 'service:statement1', - 'Effect': 'Allow', - 'Principal': { 'AWS': 'arn' }, - 'Sid': '1', - }, - ], - 'Version': '2012-10-17', - }, - 'Topics': [ - { - 'Ref': 'MyTopic86869434', - }, - ], - }); - - - }); - - test('fromTopicArn', () => { - // GIVEN - const stack2 = new cdk.Stack(); - - // WHEN - const imported = sns.Topic.fromTopicArn(stack2, 'Imported', 'arn:aws:sns:*:123456789012:my_corporate_topic'); - - // THEN - expect(imported.topicName).toEqual('my_corporate_topic'); - expect(imported.topicArn).toEqual('arn:aws:sns:*:123456789012:my_corporate_topic'); - expect(imported.fifo).toEqual(false); - - }); - - test('fromTopicArn fifo', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const imported = sns.Topic.fromTopicArn(stack, 'Imported', 'arn:aws:sns:*:123456789012:mytopic.fifo'); - - // THEN - expect(imported.topicName).toEqual('mytopic.fifo'); - expect(imported.topicArn).toEqual('arn:aws:sns:*:123456789012:mytopic.fifo'); - expect(imported.fifo).toEqual(true); - }); - - test('test metrics', () => { - // GIVEN - const stack = new cdk.Stack(); - const topic = new sns.Topic(stack, 'Topic'); - - // THEN - expect(stack.resolve(topic.metricNumberOfMessagesPublished())).toEqual({ - dimensions: { TopicName: { 'Fn::GetAtt': ['TopicBFC7AF6E', 'TopicName'] } }, - namespace: 'AWS/SNS', - metricName: 'NumberOfMessagesPublished', - period: cdk.Duration.minutes(5), - statistic: 'Sum', - }); - - expect(stack.resolve(topic.metricPublishSize())).toEqual({ - dimensions: { TopicName: { 'Fn::GetAtt': ['TopicBFC7AF6E', 'TopicName'] } }, - namespace: 'AWS/SNS', - metricName: 'PublishSize', - period: cdk.Duration.minutes(5), - statistic: 'Average', - }); - - - }); - - test('subscription is created under the topic scope by default', () => { - // GIVEN - const stack = new cdk.Stack(); - const topic = new sns.Topic(stack, 'Topic'); - - // WHEN - topic.addSubscription({ - bind: () => ({ - protocol: sns.SubscriptionProtocol.HTTP, - endpoint: 'http://foo/bar', - subscriberId: 'my-subscription', - }), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::SNS::Subscription', 1); - - }); - - test('if "scope" is defined, subscription will be created under that scope', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'A'); - const stack2 = new cdk.Stack(app, 'B'); - const topic = new sns.Topic(stack, 'Topic'); - - // WHEN - topic.addSubscription({ - bind: () => ({ - protocol: sns.SubscriptionProtocol.HTTP, - endpoint: 'http://foo/bar', - subscriberScope: stack2, - subscriberId: 'subscriberId', - }), - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::SNS::Subscription', 0); - Template.fromStack(stack2).resourceCountIs('AWS::SNS::Subscription', 1); - - }); - - test('fails if topic policy has no actions', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'my-stack'); - const topic = new sns.Topic(stack, 'Topic'); - - // WHEN - topic.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - principals: [new iam.ArnPrincipal('arn')], - })); - - // THEN - expect(() => app.synth()).toThrow(/A PolicyStatement must specify at least one \'action\' or \'notAction\'/); - - }); - - test('fails if topic policy has no IAM principals', () => { - // GIVEN - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'my-stack'); - const topic = new sns.Topic(stack, 'Topic'); - - // WHEN - topic.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['sns:*'], - })); - - // THEN - expect(() => app.synth()).toThrow(/A PolicyStatement used in a resource-based policy must specify at least one IAM principal/); - - }); - - test('topic policy should be set if topic as a notifications rule target', () => { - const app = new cdk.App(); - const stack = new cdk.Stack(app, 'my-stack'); - const topic = new sns.Topic(stack, 'Topic'); - const rule = new notifications.NotificationRule(stack, 'MyNotificationRule', { - source: { - bindAsNotificationRuleSource: () => ({ - sourceArn: 'ARN', - }), - }, - events: ['codebuild-project-build-state-succeeded'], - }); - - rule.addTarget(topic); - - Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { - PolicyDocument: { - Version: '2012-10-17', - Statement: [{ - 'Sid': '0', - 'Action': 'sns:Publish', - 'Effect': 'Allow', - 'Principal': { 'Service': 'codestar-notifications.amazonaws.com' }, - 'Resource': { 'Ref': 'TopicBFC7AF6E' }, - }], - }, - Topics: [{ - Ref: 'TopicBFC7AF6E', - }], - }); - - - }); -}); diff --git a/packages/@aws-cdk/aws-sqs/.eslintrc.js b/packages/@aws-cdk/aws-sqs/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-sqs/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sqs/.gitignore b/packages/@aws-cdk/aws-sqs/.gitignore deleted file mode 100644 index ed7a661294a83..0000000000000 --- a/packages/@aws-cdk/aws-sqs/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -*.generated.ts -dist -tsconfig.json - -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-sqs/.npmignore b/packages/@aws-cdk/aws-sqs/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-sqs/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-sqs/LICENSE b/packages/@aws-cdk/aws-sqs/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-sqs/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-sqs/NOTICE b/packages/@aws-cdk/aws-sqs/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-sqs/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-sqs/README.md b/packages/@aws-cdk/aws-sqs/README.md deleted file mode 100644 index 4846725ff73d7..0000000000000 --- a/packages/@aws-cdk/aws-sqs/README.md +++ /dev/null @@ -1,96 +0,0 @@ -# Amazon Simple Queue Service Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Amazon Simple Queue Service (SQS) is a fully managed message queuing service that -enables you to decouple and scale microservices, distributed systems, and serverless -applications. SQS eliminates the complexity and overhead associated with managing and -operating message oriented middleware, and empowers developers to focus on differentiating work. -Using SQS, you can send, store, and receive messages between software components at any volume, -without losing messages or requiring other services to be available. - -## Installation - -Import to your project: - -```ts nofixture -import * as sqs from '@aws-cdk/aws-sqs'; -``` - -## Basic usage - - -Here's how to add a basic queue to your application: - -```ts -new sqs.Queue(this, 'Queue'); -``` - -## Encryption - -By default queues are encrypted using SSE-SQS. If you want to change the encryption mode, set the `encryption` property. -The following encryption modes are supported: - -* KMS key that SQS manages for you -* KMS key that you can managed yourself -* Server-side encryption managed by SQS (SSE-SQS) -* Unencrypted - -To learn more about SSE-SQS on Amazon SQS, please visit the -[Amazon SQS documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html). - -```ts -// Use managed key -new sqs.Queue(this, 'Queue', { - encryption: sqs.QueueEncryption.KMS_MANAGED, -}); - -// Use custom key -const myKey = new kms.Key(this, 'Key'); - -new sqs.Queue(this, 'Queue', { - encryption: sqs.QueueEncryption.KMS, - encryptionMasterKey: myKey, -}); - -// Use SQS managed server side encryption (SSE-SQS) -new sqs.Queue(this, 'Queue', { - encryption: sqs.QueueEncryption.SQS_MANAGED, -}); - -// Unencrypted queue -new sqs.Queue(this, 'Queue', { - encryption: sqs.QueueEncryption.UNENCRYPTED, -}); -``` - -## Encryption in transit - -If you want to enforce encryption of data in transit, set the `enforceSSL` property to `true`. -A resource policy statement that allows only encrypted connections over HTTPS (TLS) -will be added to the queue. - -```ts -new sqs.Queue(this, 'Queue', { - enforceSSL: true, -}); -``` - -## First-In-First-Out (FIFO) queues - -FIFO queues give guarantees on the order in which messages are dequeued, and have additional -features in order to help guarantee exactly-once processing. For more information, see -the SQS manual. Note that FIFO queues are not available in all AWS regions. - -A queue can be made a FIFO queue by either setting `fifo: true`, giving it a name which ends -in `".fifo"`, or by enabling a FIFO specific feature such as: content-based deduplication, -deduplication scope or fifo throughput limit. diff --git a/packages/@aws-cdk/aws-sqs/jest.config.js b/packages/@aws-cdk/aws-sqs/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-sqs/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sqs/lib/policy.ts b/packages/@aws-cdk/aws-sqs/lib/policy.ts deleted file mode 100644 index 5aeccf8b7be13..0000000000000 --- a/packages/@aws-cdk/aws-sqs/lib/policy.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { PolicyDocument } from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { IQueue } from './queue-base'; -import { CfnQueuePolicy } from './sqs.generated'; - -/** - * Properties to associate SQS queues with a policy - */ -export interface QueuePolicyProps { - /** - * The set of queues this policy applies to. - */ - readonly queues: IQueue[]; -} - -/** - * The policy for an SQS Queue - * - * Policies define the operations that are allowed on this resource. - * - * You almost never need to define this construct directly. - * - * All AWS resources that support resource policies have a method called - * `addToResourcePolicy()`, which will automatically create a new resource - * policy if one doesn't exist yet, otherwise it will add to the existing - * policy. - * - * Prefer to use `addToResourcePolicy()` instead. - */ -export class QueuePolicy extends Resource { - /** - * The IAM policy document for this policy. - */ - public readonly document = new PolicyDocument(); - - constructor(scope: Construct, id: string, props: QueuePolicyProps) { - super(scope, id); - - new CfnQueuePolicy(this, 'Resource', { - policyDocument: this.document, - queues: props.queues.map(q => q.queueUrl), - }); - } - - /** - * Not currently supported by AWS CloudFormation. - * - * This attribute temporarily existed in CloudFormation, and then was removed again. - * - * @attribute - */ - public get queuePolicyId(): string { - throw new Error('QueuePolicy.queuePolicyId has been removed from CloudFormation'); - } -} diff --git a/packages/@aws-cdk/aws-sqs/package.json b/packages/@aws-cdk/aws-sqs/package.json deleted file mode 100644 index 956caa11e3d0e..0000000000000 --- a/packages/@aws-cdk/aws-sqs/package.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "name": "@aws-cdk/aws-sqs", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SQS", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.sqs", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "sqs" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SQS", - "packageId": "Amazon.CDK.AWS.SQS", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-sqs", - "module": "aws_cdk.aws_sqs", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-sqs" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SQS", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "sqs" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-sqs.QueuePolicyProps" - ] - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-sqs/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-sqs/rosetta/default.ts-fixture deleted file mode 100644 index 968d51c8ae916..0000000000000 --- a/packages/@aws-cdk/aws-sqs/rosetta/default.ts-fixture +++ /dev/null @@ -1,13 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import sqs = require('@aws-cdk/aws-sqs'); -import kms = require('@aws-cdk/aws-kms'); - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts b/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts deleted file mode 100644 index 61f386c60074b..0000000000000 --- a/packages/@aws-cdk/aws-sqs/test/integ.sqs.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam'; -import { Key } from '@aws-cdk/aws-kms'; -import { App, CfnOutput, RemovalPolicy, Stack } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { DeduplicationScope, FifoThroughputLimit, Queue, QueueEncryption } from '../lib'; - -const app = new App(); - -const stack = new Stack(app, 'aws-cdk-sqs'); - -const dlq = new Queue(stack, 'DeadLetterQueue'); -const queue = new Queue(stack, 'Queue', { - deadLetterQueue: { queue: dlq, maxReceiveCount: 5 }, - encryption: QueueEncryption.KMS_MANAGED, -}); -const fifo = new Queue(stack, 'FifoQueue', { - fifo: true, - encryptionMasterKey: new Key(stack, 'EncryptionKey', { removalPolicy: RemovalPolicy.DESTROY }), -}); -const highThroughputFifo = new Queue(stack, 'HighThroughputFifoQueue', { - fifo: true, - fifoThroughputLimit: FifoThroughputLimit.PER_MESSAGE_GROUP_ID, - deduplicationScope: DeduplicationScope.MESSAGE_GROUP, -}); -const sqsManagedEncryptedQueue = new Queue(stack, 'SqsManagedEncryptedQueue', { - encryption: QueueEncryption.SQS_MANAGED, -}); -const unencryptedQueue = new Queue(stack, 'UnencryptedQueue', { - encryption: QueueEncryption.UNENCRYPTED, -}); -const ssl = new Queue(stack, 'SSLQueue', { enforceSSL: true }); - -const role = new Role(stack, 'Role', { - assumedBy: new AccountRootPrincipal(), -}); - -dlq.grantConsumeMessages(role); -queue.grantConsumeMessages(role); -fifo.grantConsumeMessages(role); -highThroughputFifo.grantConsumeMessages(role); -sqsManagedEncryptedQueue.grantConsumeMessages(role); -unencryptedQueue.grantConsumeMessages(role); -ssl.grantConsumeMessages(role); - -new CfnOutput(stack, 'QueueUrl', { value: queue.queueUrl }); - -new integ.IntegTest(app, 'SqsTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-sqs/test/sqs.test.ts b/packages/@aws-cdk/aws-sqs/test/sqs.test.ts deleted file mode 100644 index 93c1b4a6c8bb9..0000000000000 --- a/packages/@aws-cdk/aws-sqs/test/sqs.test.ts +++ /dev/null @@ -1,696 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { CfnParameter, Duration, Stack, App, Token } from '@aws-cdk/core'; -import * as sqs from '../lib'; - -/* eslint-disable quote-props */ - -test('default properties', () => { - const stack = new Stack(); - const q = new sqs.Queue(stack, 'Queue'); - - expect(q.fifo).toEqual(false); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); - - Template.fromStack(stack).hasResource('AWS::SQS::Queue', { - DeletionPolicy: 'Delete', - }); -}); - -test('with a dead letter queue', () => { - const stack = new Stack(); - const dlq = new sqs.Queue(stack, 'DLQ'); - const dlqProps = { queue: dlq, maxReceiveCount: 3 }; - const queue = new sqs.Queue(stack, 'Queue', { deadLetterQueue: dlqProps }); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'DLQ581697C4': { - 'Type': 'AWS::SQS::Queue', - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'RedrivePolicy': { - 'deadLetterTargetArn': { - 'Fn::GetAtt': [ - 'DLQ581697C4', - 'Arn', - ], - }, - 'maxReceiveCount': 3, - }, - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); - - expect(queue.deadLetterQueue).toEqual(dlqProps); -}); - -test('message retention period must be between 1 minute to 14 days', () => { - // GIVEN - const stack = new Stack(); - - // THEN - expect(() => new sqs.Queue(stack, 'MyQueue', { - retentionPeriod: Duration.seconds(30), - })).toThrow(/message retention period must be 60 seconds or more/); - - expect(() => new sqs.Queue(stack, 'AnotherQueue', { - retentionPeriod: Duration.days(15), - })).toThrow(/message retention period must be 1209600 seconds or less/); -}); - -test('message retention period can be provided as a parameter', () => { - // GIVEN - const stack = new Stack(); - const parameter = new CfnParameter(stack, 'my-retention-period', { - type: 'Number', - default: 30, - }); - - // WHEN - new sqs.Queue(stack, 'MyQueue', { - retentionPeriod: Duration.seconds(parameter.valueAsNumber), - }); - - // THEN - Template.fromStack(stack).templateMatches({ - 'Parameters': { - 'myretentionperiod': { - 'Type': 'Number', - 'Default': 30, - }, - }, - 'Resources': { - 'MyQueueE6CA6235': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'MessageRetentionPeriod': { - 'Ref': 'myretentionperiod', - }, - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); -}); - -test('addToPolicy will automatically create a policy for this queue', () => { - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'MyQueue'); - queue.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['sqs:*'], - principals: [new iam.ArnPrincipal('arn')], - })); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'MyQueueE6CA6235': { - 'Type': 'AWS::SQS::Queue', - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - 'MyQueuePolicy6BBEDDAC': { - 'Type': 'AWS::SQS::QueuePolicy', - 'Properties': { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': 'sqs:*', - 'Effect': 'Allow', - 'Principal': { - 'AWS': 'arn', - }, - 'Resource': '*', - }, - ], - 'Version': '2012-10-17', - }, - 'Queues': [ - { - 'Ref': 'MyQueueE6CA6235', - }, - ], - }, - }, - }, - }); -}); - -describe('export and import', () => { - test('importing works correctly', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const imports = sqs.Queue.fromQueueArn(stack, 'Imported', 'arn:aws:sqs:us-east-1:123456789012:queue1'); - - // THEN - - // "import" returns an IQueue bound to `Fn::ImportValue`s. - expect(stack.resolve(imports.queueArn)).toEqual('arn:aws:sqs:us-east-1:123456789012:queue1'); - expect(stack.resolve(imports.queueUrl)).toEqual({ - 'Fn::Join': - ['', ['https://sqs.us-east-1.', { Ref: 'AWS::URLSuffix' }, '/123456789012/queue1']], - }); - expect(stack.resolve(imports.queueName)).toEqual('queue1'); - }); - - test('importing fifo and standard queues are detected correctly', () => { - const stack = new Stack(); - const stdQueue = sqs.Queue.fromQueueArn(stack, 'StdQueue', 'arn:aws:sqs:us-east-1:123456789012:queue1'); - const fifoQueue = sqs.Queue.fromQueueArn(stack, 'FifoQueue', 'arn:aws:sqs:us-east-1:123456789012:queue2.fifo'); - expect(stdQueue.fifo).toEqual(false); - expect(fifoQueue.fifo).toEqual(true); - }); - - test('import queueArn from token, fifo and standard queues can be defined', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const stdQueue1 = sqs.Queue.fromQueueAttributes(stack, 'StdQueue1', { - queueArn: Token.asString({ Ref: 'ARN' }), - }); - const stdQueue2 = sqs.Queue.fromQueueAttributes(stack, 'StdQueue2', { - queueArn: Token.asString({ Ref: 'ARN' }), - fifo: false, - }); - const fifoQueue = sqs.Queue.fromQueueAttributes(stack, 'FifoQueue', { - queueArn: Token.asString({ Ref: 'ARN' }), - fifo: true, - }); - - // THEN - expect(stdQueue1.fifo).toEqual(false); - expect(stdQueue2.fifo).toEqual(false); - expect(fifoQueue.fifo).toEqual(true); - }); - - test('import queueArn from token, check attributes', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const stdQueue1 = sqs.Queue.fromQueueArn(stack, 'StdQueue', Token.asString({ Ref: 'ARN' })); - - // THEN - expect(stack.resolve(stdQueue1.queueArn)).toEqual({ - Ref: 'ARN', - }); - expect(stack.resolve(stdQueue1.queueName)).toEqual({ - 'Fn::Select': [5, { 'Fn::Split': [':', { Ref: 'ARN' }] }], - }); - expect(stack.resolve(stdQueue1.queueUrl)).toEqual({ - 'Fn::Join': - ['', - ['https://sqs.', - { 'Fn::Select': [3, { 'Fn::Split': [':', { Ref: 'ARN' }] }] }, - '.', - { Ref: 'AWS::URLSuffix' }, - '/', - { 'Fn::Select': [4, { 'Fn::Split': [':', { Ref: 'ARN' }] }] }, - '/', - { 'Fn::Select': [5, { 'Fn::Split': [':', { Ref: 'ARN' }] }] }]], - }); - expect(stdQueue1.fifo).toEqual(false); - }); - - test('fails if fifo flag is set for non fifo queue name', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'my-stack'); - - // THEN - expect(() => sqs.Queue.fromQueueAttributes(stack, 'ImportedStdQueue', { - queueArn: 'arn:aws:sqs:us-west-2:123456789012:queue1', - fifo: true, - })).toThrow(/FIFO queue names must end in '.fifo'/); - }); - - test('fails if fifo flag is false for fifo queue name', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'my-stack'); - - // THEN - expect(() => sqs.Queue.fromQueueAttributes(stack, 'ImportedFifoQueue', { - queueArn: 'arn:aws:sqs:us-west-2:123456789012:queue1.fifo', - fifo: false, - })).toThrow(/Non-FIFO queue name may not end in '.fifo'/); - }); - - test('importing works correctly for cross region queue', () => { - // GIVEN - const stack = new Stack(undefined, 'Stack', { env: { region: 'us-east-1' } }); - - // WHEN - const imports = sqs.Queue.fromQueueArn(stack, 'Imported', 'arn:aws:sqs:us-west-2:123456789012:queue1'); - - // THEN - - // "import" returns an IQueue bound to `Fn::ImportValue`s. - expect(stack.resolve(imports.queueArn)).toEqual('arn:aws:sqs:us-west-2:123456789012:queue1'); - expect(stack.resolve(imports.queueUrl)).toEqual({ - 'Fn::Join': - ['', ['https://sqs.us-west-2.', { Ref: 'AWS::URLSuffix' }, '/123456789012/queue1']], - }); - expect(stack.resolve(imports.queueName)).toEqual('queue1'); - }); -}); - -describe('grants', () => { - test('grantConsumeMessages', () => { - testGrant((q, p) => q.grantConsumeMessages(p), - 'sqs:ReceiveMessage', - 'sqs:ChangeMessageVisibility', - 'sqs:GetQueueUrl', - 'sqs:DeleteMessage', - 'sqs:GetQueueAttributes', - ); - }); - - test('grantSendMessages', () => { - testGrant((q, p) => q.grantSendMessages(p), - 'sqs:SendMessage', - 'sqs:GetQueueAttributes', - 'sqs:GetQueueUrl', - ); - }); - - test('grantPurge', () => { - testGrant((q, p) => q.grantPurge(p), - 'sqs:PurgeQueue', - 'sqs:GetQueueAttributes', - 'sqs:GetQueueUrl', - ); - }); - - test('grant() is general purpose', () => { - testGrant((q, p) => q.grant(p, 'service:hello', 'service:world'), - 'service:hello', - 'service:world', - ); - }); - - test('grants also work on imported queues', () => { - const stack = new Stack(); - const queue = sqs.Queue.fromQueueAttributes(stack, 'Import', { - queueArn: 'arn:aws:sqs:us-east-1:123456789012:queue1', - queueUrl: 'https://queue-url', - }); - - const user = new iam.User(stack, 'User'); - - queue.grantPurge(user); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': [ - 'sqs:PurgeQueue', - 'sqs:GetQueueAttributes', - 'sqs:GetQueueUrl', - ], - 'Effect': 'Allow', - 'Resource': 'arn:aws:sqs:us-east-1:123456789012:queue1', - }, - ], - 'Version': '2012-10-17', - }, - }); - }); -}); - -describe('queue encryption', () => { - test('encryptionMasterKey can be set to a custom KMS key', () => { - const stack = new Stack(); - - const key = new kms.Key(stack, 'CustomKey'); - const queue = new sqs.Queue(stack, 'Queue', { encryptionMasterKey: key }); - - expect(queue.encryptionMasterKey).toEqual(key); - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - 'KmsMasterKeyId': { 'Fn::GetAtt': ['CustomKey1E6D0D07', 'Arn'] }, - }); - }); - - test('a kms key will be allocated if encryption = kms but a master key is not specified', () => { - const stack = new Stack(); - - new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.KMS }); - - Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', Match.anyValue()); - Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { - 'KmsMasterKeyId': { - 'Fn::GetAtt': [ - 'QueueKey39FCBAE6', - 'Arn', - ], - }, - }); - }); - - test('it is possible to use a managed kms key', () => { - const stack = new Stack(); - - new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.KMS_MANAGED }); - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'KmsMasterKeyId': 'alias/aws/sqs', - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); - }); - - test('grant also affects key on encrypted queue', () => { - // GIVEN - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'Queue', { - encryption: sqs.QueueEncryption.KMS, - }); - const role = new iam.Role(stack, 'Role', { - assumedBy: new iam.ServicePrincipal('someone'), - }); - - // WHEN - queue.grantSendMessages(role); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': [ - 'sqs:SendMessage', - 'sqs:GetQueueAttributes', - 'sqs:GetQueueUrl', - ], - 'Effect': 'Allow', - 'Resource': { 'Fn::GetAtt': ['Queue4A7E3555', 'Arn'] }, - }, - { - 'Action': [ - 'kms:Decrypt', - 'kms:Encrypt', - 'kms:ReEncrypt*', - 'kms:GenerateDataKey*', - ], - 'Effect': 'Allow', - 'Resource': { 'Fn::GetAtt': ['QueueKey39FCBAE6', 'Arn'] }, - }, - ], - 'Version': '2012-10-17', - }, - }); - }); - - test('it is possible to use sqs managed server side encryption', () => { - const stack = new Stack(); - - new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.SQS_MANAGED }); - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'SqsManagedSseEnabled': true, - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); - }); - - test('it is possible to disable encryption (unencrypted)', () => { - const stack = new Stack(); - - new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.UNENCRYPTED }); - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'SqsManagedSseEnabled': false, - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); - }); - - test('encryptionMasterKey is not supported if encryption type SQS_MANAGED is used', () => { - // GIVEN - const stack = new Stack(); - const key = new kms.Key(stack, 'CustomKey'); - - // THEN - expect(() => new sqs.Queue(stack, 'Queue', { - encryption: sqs.QueueEncryption.SQS_MANAGED, - encryptionMasterKey: key, - })).toThrow(/'encryptionMasterKey' is not supported if encryption type 'SQS_MANAGED' is used/); - }); -}); - -describe('encryption in transit', () => { - test('enforceSSL can be enabled', () => { - const stack = new Stack(); - new sqs.Queue(stack, 'Queue', { enforceSSL: true }); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - 'QueuePolicy25439813': { - 'Type': 'AWS::SQS::QueuePolicy', - 'Properties': { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': 'sqs:*', - 'Condition': { - 'Bool': { - 'aws:SecureTransport': 'false', - }, - }, - 'Effect': 'Deny', - 'Principal': { - 'AWS': '*', - }, - 'Resource': { - 'Fn::GetAtt': [ - 'Queue4A7E3555', - 'Arn', - ], - }, - }, - ], - 'Version': '2012-10-17', - }, - }, - }, - }, - }); - }); -}); - -test('test ".fifo" suffixed queues register as fifo', () => { - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'Queue', { - queueName: 'MyQueue.fifo', - }); - - expect(queue.fifo).toEqual(true); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'QueueName': 'MyQueue.fifo', - 'FifoQueue': true, - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); -}); - -test('test a fifo queue is observed when the "fifo" property is specified', () => { - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'Queue', { - fifo: true, - }); - - expect(queue.fifo).toEqual(true); - - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'FifoQueue': true, - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); -}); - -test('test a fifo queue is observed when high throughput properties are specified', () => { - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'Queue', { - fifo: true, - fifoThroughputLimit: sqs.FifoThroughputLimit.PER_MESSAGE_GROUP_ID, - deduplicationScope: sqs.DeduplicationScope.MESSAGE_GROUP, - }); - - expect(queue.fifo).toEqual(true); - Template.fromStack(stack).templateMatches({ - 'Resources': { - 'Queue4A7E3555': { - 'Type': 'AWS::SQS::Queue', - 'Properties': { - 'DeduplicationScope': 'messageGroup', - 'FifoQueue': true, - 'FifoThroughputLimit': 'perMessageGroupId', - }, - 'UpdateReplacePolicy': 'Delete', - 'DeletionPolicy': 'Delete', - }, - }, - }); -}); - -test('test a queue throws when fifoThroughputLimit specified on non fifo queue', () => { - const stack = new Stack(); - expect(() => { - new sqs.Queue(stack, 'Queue', { - fifo: false, - fifoThroughputLimit: sqs.FifoThroughputLimit.PER_MESSAGE_GROUP_ID, - }); - }).toThrow(); -}); - -test('test a queue throws when deduplicationScope specified on non fifo queue', () => { - const stack = new Stack(); - expect(() => { - new sqs.Queue(stack, 'Queue', { - fifo: false, - deduplicationScope: sqs.DeduplicationScope.MESSAGE_GROUP, - }); - }).toThrow(); -}); - -test('test metrics', () => { - // GIVEN - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'Queue'); - - // THEN - expect(stack.resolve(queue.metricNumberOfMessagesSent())).toEqual({ - dimensions: { QueueName: { 'Fn::GetAtt': ['Queue4A7E3555', 'QueueName'] } }, - namespace: 'AWS/SQS', - metricName: 'NumberOfMessagesSent', - period: Duration.minutes(5), - statistic: 'Sum', - }); - - expect(stack.resolve(queue.metricSentMessageSize())).toEqual({ - dimensions: { QueueName: { 'Fn::GetAtt': ['Queue4A7E3555', 'QueueName'] } }, - namespace: 'AWS/SQS', - metricName: 'SentMessageSize', - period: Duration.minutes(5), - statistic: 'Average', - }); -}); - -test('fails if queue policy has no actions', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'my-stack'); - const queue = new sqs.Queue(stack, 'Queue'); - - // WHEN - queue.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - principals: [new iam.ArnPrincipal('arn')], - })); - - // THEN - expect(() => app.synth()).toThrow(/A PolicyStatement must specify at least one \'action\' or \'notAction\'/); -}); - -test('fails if queue policy has no IAM principals', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'my-stack'); - const queue = new sqs.Queue(stack, 'Queue'); - - // WHEN - queue.addToResourcePolicy(new iam.PolicyStatement({ - resources: ['*'], - actions: ['sqs:*'], - })); - - // THEN - expect(() => app.synth()).toThrow(/A PolicyStatement used in a resource-based policy must specify at least one IAM principal/); -}); - -function testGrant(action: (q: sqs.Queue, principal: iam.IPrincipal) => void, ...expectedActions: string[]) { - const stack = new Stack(); - const queue = new sqs.Queue(stack, 'MyQueue'); - const principal = new iam.User(stack, 'User'); - - action(queue, principal); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - 'PolicyDocument': { - 'Statement': [ - { - 'Action': expectedActions, - 'Effect': 'Allow', - 'Resource': { - 'Fn::GetAtt': [ - 'MyQueueE6CA6235', - 'Arn', - ], - }, - }, - ], - 'Version': '2012-10-17', - }, - }); -} diff --git a/packages/@aws-cdk/aws-ssm/.eslintrc.js b/packages/@aws-cdk/aws-ssm/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ssm/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ssm/.gitignore b/packages/@aws-cdk/aws-ssm/.gitignore deleted file mode 100644 index a44eba2329f2d..0000000000000 --- a/packages/@aws-cdk/aws-ssm/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ssm/.npmignore b/packages/@aws-cdk/aws-ssm/.npmignore deleted file mode 100644 index c6569b7d6c25a..0000000000000 --- a/packages/@aws-cdk/aws-ssm/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -jest.config.js -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ssm/LICENSE b/packages/@aws-cdk/aws-ssm/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ssm/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ssm/NOTICE b/packages/@aws-cdk/aws-ssm/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ssm/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ssm/README.md b/packages/@aws-cdk/aws-ssm/README.md deleted file mode 100644 index 477403d78224a..0000000000000 --- a/packages/@aws-cdk/aws-ssm/README.md +++ /dev/null @@ -1,152 +0,0 @@ -# AWS Systems Manager Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Using existing SSM Parameters in your CDK app - -You can reference existing SSM Parameter Store values that you want to use in -your CDK app by using `ssm.StringParameter.fromStringParameterAttributes`: - -```ts -// Retrieve the latest value of the non-secret parameter -// with name "/My/String/Parameter". -const stringValue = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValue', { - parameterName: '/My/Public/Parameter', - // 'version' can be specified but is optional. -}).stringValue; -const stringValueVersionFromToken = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValueVersionFromToken', { - parameterName: '/My/Public/Parameter', - // parameter version from token - version: parameterVersion, -}).stringValue; - -// Retrieve a specific version of the secret (SecureString) parameter. -// 'version' is always required. -const secretValue = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValue', { - parameterName: '/My/Secret/Parameter', - version: 5, -}); -const secretValueVersionFromToken = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValueVersionFromToken', { - parameterName: '/My/Secret/Parameter', - // parameter version from token - version: parameterVersion, -}); -``` - -You can also reference an existing SSM Parameter Store value that matches an -[AWS specific parameter type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-specific-parameter-types): - -```ts -ssm.StringParameter.valueForTypedStringParameterV2(stack, '/My/Public/Parameter', ssm.ParameterValueType.AWS_EC2_IMAGE_ID); -``` - -To do the same for a SSM Parameter Store value that is stored as a list: - -```ts -ssm.StringListParameter.valueForTypedListParameter(stack, '/My/Public/Parameter', ssm.ParameterValueType.AWS_EC2_IMAGE_ID); -``` - -### Lookup existing parameters - -You can also use an existing parameter by looking up the parameter from the AWS environment. -This method uses AWS API calls to lookup the value from SSM during synthesis. - -```ts -const stringValue = ssm.StringParameter.valueFromLookup(stack, '/My/Public/Parameter'); -``` - -When using `valueFromLookup` an initial value of 'dummy-value-for-${parameterName}' -(`dummy-value-for-/My/Public/Parameter` in the above example) -is returned prior to the lookup being performed. This can lead to errors if you are using this -value in places that require a certain format. For example if you have stored the ARN for a SNS -topic in a SSM Parameter which you want to lookup and provide to `Topic.fromTopicArn()` - -```ts -const arnLookup = ssm.StringParameter.valueFromLookup(this, '/my/topic/arn'); -sns.Topic.fromTopicArn(this, 'Topic', arnLookup); -``` - -Initially `arnLookup` will be equal to `dummy-value-for-/my/topic/arn` which will cause -`Topic.fromTopicArn` to throw an error indicating that the value is not in `arn` format. - -For these use cases you need to handle the `dummy-value` in your code. For example: - -```ts -const arnLookup = ssm.StringParameter.valueFromLookup(this, '/my/topic/arn'); -let arnLookupValue: string; -if (arnLookup.includes('dummy-value')) { - arnLookupValue = this.formatArn({ - service: 'sns', - resource: 'topic', - resourceName: arnLookup, - }); - -} else { - arnLookupValue = arnLookup; -} - -sns.Topic.fromTopicArn(this, 'Topic', arnLookupValue); -``` - -Alternatively, if the property supports tokens you can convert the parameter value into a token -to be resolved _after_ the lookup has been completed. - -```ts -const arnLookup = ssm.StringParameter.valueFromLookup(this, '/my/role/arn'); -iam.Role.fromRoleArn(this, 'role', Lazy.string({ produce: () => arnLookup })); -``` - -## Creating new SSM Parameters in your CDK app - -You can create either `ssm.StringParameter` or `ssm.StringListParameter`s in -a CDK app. These are public (not secret) values. Parameters of type -*SecureString* cannot be created directly from a CDK application; if you want -to provision secrets automatically, use Secrets Manager Secrets (see the -`@aws-cdk/aws-secretsmanager` package). - -```ts -new ssm.StringParameter(this, 'Parameter', { - allowedPattern: '.*', - description: 'The value Foo', - parameterName: 'FooParameter', - stringValue: 'Foo', - tier: ssm.ParameterTier.ADVANCED, -}); -``` - -```ts -// Create a new SSM Parameter holding a String -const param = new ssm.StringParameter(stack, 'StringParameter', { - // description: 'Some user-friendly description', - // name: 'ParameterName', - stringValue: 'Initial parameter value', - // allowedPattern: '.*', -}); - -// Grant read access to some Role -param.grantRead(role); - -// Create a new SSM Parameter holding a StringList -const listParameter = new ssm.StringListParameter(stack, 'StringListParameter', { - // description: 'Some user-friendly description', - // name: 'ParameterName', - stringListValue: ['Initial parameter value A', 'Initial parameter value B'], - // allowedPattern: '.*', -}); -``` - -When specifying an `allowedPattern`, the values provided as string literals -are validated against the pattern and an exception is raised if a value -provided does not comply. - diff --git a/packages/@aws-cdk/aws-ssm/jest.config.js b/packages/@aws-cdk/aws-ssm/jest.config.js deleted file mode 100644 index 34818e1593f6b..0000000000000 --- a/packages/@aws-cdk/aws-ssm/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('../../../tools/@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ssm/lib/util.ts b/packages/@aws-cdk/aws-ssm/lib/util.ts deleted file mode 100644 index c79a909628629..0000000000000 --- a/packages/@aws-cdk/aws-ssm/lib/util.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { ArnFormat, Stack, Token } from '@aws-cdk/core'; -import { IConstruct } from 'constructs'; - -export const AUTOGEN_MARKER = '$$autogen$$'; - -export interface ArnForParameterNameOptions { - readonly physicalName?: string; - readonly simpleName?: boolean; -} - -/** - * Renders an ARN for an SSM parameter given a parameter name. - * @param scope definition scope - * @param parameterName the parameter name to include in the ARN - * @param physicalName optional physical name specified by the user (to auto-detect separator) - */ -export function arnForParameterName(scope: IConstruct, parameterName: string, options: ArnForParameterNameOptions = { }): string { - const physicalName = options.physicalName; - const nameToValidate = physicalName || parameterName; - - if (!Token.isUnresolved(nameToValidate) && nameToValidate.includes('/') && !nameToValidate.startsWith('/')) { - throw new Error(`Parameter names must be fully qualified (if they include "/" they must also begin with a "/"): ${nameToValidate}`); - } - - if (isSimpleName()) { - return Stack.of(scope).formatArn({ - service: 'ssm', - resource: 'parameter', - arnFormat: ArnFormat.SLASH_RESOURCE_NAME, - resourceName: parameterName, - }); - } else { - return Stack.of(scope).formatArn({ - service: 'ssm', - resource: `parameter${parameterName}`, - }); - } - - /** - * Determines the ARN separator for this parameter: if we have a concrete - * parameter name (or explicitly defined physical name), we will parse them - * and decide whether a "/" is needed or not. Otherwise, users will have to - * explicitly specify `simpleName` when they import the ARN. - */ - function isSimpleName(): boolean { - // look for a concrete name as a hint for determining the separator - const concreteName = !Token.isUnresolved(parameterName) ? parameterName : physicalName; - if (!concreteName || Token.isUnresolved(concreteName)) { - - if (options.simpleName === undefined) { - throw new Error('Unable to determine ARN separator for SSM parameter since the parameter name is an unresolved token. Use "fromAttributes" and specify "simpleName" explicitly'); - } - - return options.simpleName; - } - - const result = !concreteName.startsWith('/'); - - // if users explicitly specify the separator and it conflicts with the one we need, it's an error. - if (options.simpleName !== undefined && options.simpleName !== result) { - - if (concreteName === AUTOGEN_MARKER) { - throw new Error('If "parameterName" is not explicitly defined, "simpleName" must be "true" or undefined since auto-generated parameter names always have simple names'); - } - - throw new Error(`Parameter name "${concreteName}" is ${result ? 'a simple name' : 'not a simple name'}, but "simpleName" was explicitly set to ${options.simpleName}. Either omit it or set it to ${result}`); - } - - return result; - } -} diff --git a/packages/@aws-cdk/aws-ssm/package.json b/packages/@aws-cdk/aws-ssm/package.json deleted file mode 100644 index a39df20f35990..0000000000000 --- a/packages/@aws-cdk/aws-ssm/package.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "name": "@aws-cdk/aws-ssm", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SSM", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.ssm", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ssm" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.SSM", - "packageId": "Amazon.CDK.AWS.SSM", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-ssm", - "module": "aws_cdk.aws_ssm", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ssm" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SSM", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "ssm" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "maturity": "stable", - "publishConfig": { - "tag": "next" - } -} diff --git a/packages/@aws-cdk/aws-ssm/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ssm/rosetta/default.ts-fixture deleted file mode 100644 index de86c8c95a2da..0000000000000 --- a/packages/@aws-cdk/aws-ssm/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack, Lazy } from '@aws-cdk/core'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as sns from '@aws-cdk/aws-sns'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-ssm/test/util.test.ts b/packages/@aws-cdk/aws-ssm/test/util.test.ts deleted file mode 100644 index c467960421538..0000000000000 --- a/packages/@aws-cdk/aws-ssm/test/util.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* eslint-disable max-len */ - -import { Stack, Token } from '@aws-cdk/core'; -import { arnForParameterName } from '../lib/util'; - -describe('arnForParameterName', () => { - describe('simple names', () => { - test('concrete parameterName and no physical name (sep is "/")', () => { - const stack = new Stack(); - expect(stack.resolve(arnForParameterName(stack, 'myParam', undefined))).toEqual({ - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/myParam']], - }); - }); - - test('token parameterName and concrete physical name (no additional "/")', () => { - const stack = new Stack(); - expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { physicalName: 'myParam' }))).toEqual({ - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/', { Ref: 'Boom' }]], - }); - }); - - test('token parameterName, explicit "/" separator', () => { - const stack = new Stack(); - expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { simpleName: true }))).toEqual({ - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/', { Ref: 'Boom' }]], - }); - }); - }); - - describe('path names', () => { - test('concrete parameterName and no physical name (sep is "/")', () => { - const stack = new Stack(); - expect(stack.resolve(arnForParameterName(stack, '/foo/bar', undefined))).toEqual({ - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/foo/bar']], - }); - }); - - test('token parameterName and concrete physical name (no sep)', () => { - const stack = new Stack(); - expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { physicalName: '/foo/bar' }))).toEqual({ - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter', { Ref: 'Boom' }]], - }); - }); - - test('token parameterName, explicit "" separator', () => { - const stack = new Stack(); - expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { simpleName: false }))).toEqual({ - 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter', { Ref: 'Boom' }]], - }); - }); - }); - - test('fails if explicit separator is not defined and parameterName is a token', () => { - const stack = new Stack(); - expect(() => arnForParameterName(stack, Token.asString({ Ref: 'Boom' }))).toThrow(/Unable to determine ARN separator for SSM parameter since the parameter name is an unresolved token. Use "fromAttributes" and specify "simpleName" explicitly/); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ssmcontacts/.eslintrc.js b/packages/@aws-cdk/aws-ssmcontacts/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ssmcontacts/.gitignore b/packages/@aws-cdk/aws-ssmcontacts/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ssmcontacts/.npmignore b/packages/@aws-cdk/aws-ssmcontacts/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ssmcontacts/LICENSE b/packages/@aws-cdk/aws-ssmcontacts/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ssmcontacts/NOTICE b/packages/@aws-cdk/aws-ssmcontacts/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ssmcontacts/README.md b/packages/@aws-cdk/aws-ssmcontacts/README.md deleted file mode 100644 index cac5926e09994..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::SSMContacts Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as ssmcontacts from '@aws-cdk/aws-ssmcontacts'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SSMContacts construct libraries](https://constructs.dev/search?q=ssmcontacts) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SSMContacts resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMContacts.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SSMContacts](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMContacts.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-ssmcontacts/jest.config.js b/packages/@aws-cdk/aws-ssmcontacts/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ssmcontacts/lib/index.ts b/packages/@aws-cdk/aws-ssmcontacts/lib/index.ts deleted file mode 100644 index 9c366102b2dab..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SSMContacts CloudFormation Resources: -export * from './ssmcontacts.generated'; diff --git a/packages/@aws-cdk/aws-ssmcontacts/package.json b/packages/@aws-cdk/aws-ssmcontacts/package.json deleted file mode 100644 index ee59bef788ede..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-ssmcontacts", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::SSMContacts", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SSMContacts", - "packageId": "Amazon.CDK.AWS.SSMContacts", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.ssmcontacts", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ssmcontacts" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-ssmcontacts", - "module": "aws_cdk.aws_ssmcontacts" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ssmcontacts" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SSMContacts", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SSMContacts", - "aws-ssmcontacts" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-ssmcontacts/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ssmcontacts/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-ssmcontacts/test/ssmcontacts.test.ts b/packages/@aws-cdk/aws-ssmcontacts/test/ssmcontacts.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-ssmcontacts/test/ssmcontacts.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-ssmincidents/.eslintrc.js b/packages/@aws-cdk/aws-ssmincidents/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ssmincidents/.gitignore b/packages/@aws-cdk/aws-ssmincidents/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-ssmincidents/.npmignore b/packages/@aws-cdk/aws-ssmincidents/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-ssmincidents/LICENSE b/packages/@aws-cdk/aws-ssmincidents/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-ssmincidents/NOTICE b/packages/@aws-cdk/aws-ssmincidents/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-ssmincidents/README.md b/packages/@aws-cdk/aws-ssmincidents/README.md deleted file mode 100644 index c818a8cf8c365..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::SSMIncidents Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as ssmincidents from '@aws-cdk/aws-ssmincidents'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SSMIncidents construct libraries](https://constructs.dev/search?q=ssmincidents) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SSMIncidents resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMIncidents.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SSMIncidents](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMIncidents.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-ssmincidents/jest.config.js b/packages/@aws-cdk/aws-ssmincidents/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-ssmincidents/lib/index.ts b/packages/@aws-cdk/aws-ssmincidents/lib/index.ts deleted file mode 100644 index 880f8e6be6b58..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SSMIncidents CloudFormation Resources: -export * from './ssmincidents.generated'; diff --git a/packages/@aws-cdk/aws-ssmincidents/package.json b/packages/@aws-cdk/aws-ssmincidents/package.json deleted file mode 100644 index 45335070b3565..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-ssmincidents", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::SSMIncidents", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SSMIncidents", - "packageId": "Amazon.CDK.AWS.SSMIncidents", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.ssmincidents", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "ssmincidents" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-ssmincidents", - "module": "aws_cdk.aws_ssmincidents" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-ssmincidents" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SSMIncidents", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SSMIncidents", - "aws-ssmincidents" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-ssmincidents/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-ssmincidents/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-ssmincidents/test/ssmincidents.test.ts b/packages/@aws-cdk/aws-ssmincidents/test/ssmincidents.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-ssmincidents/test/ssmincidents.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-sso/.eslintrc.js b/packages/@aws-cdk/aws-sso/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-sso/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sso/.gitignore b/packages/@aws-cdk/aws-sso/.gitignore deleted file mode 100644 index 0d7f6c68f5f65..0000000000000 --- a/packages/@aws-cdk/aws-sso/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-sso/.npmignore b/packages/@aws-cdk/aws-sso/.npmignore deleted file mode 100644 index a79536cbbe7e1..0000000000000 --- a/packages/@aws-cdk/aws-sso/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-sso/LICENSE b/packages/@aws-cdk/aws-sso/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-sso/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-sso/NOTICE b/packages/@aws-cdk/aws-sso/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-sso/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-sso/README.md b/packages/@aws-cdk/aws-sso/README.md deleted file mode 100644 index ac48ced91cc45..0000000000000 --- a/packages/@aws-cdk/aws-sso/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::SSO Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as sso from '@aws-cdk/aws-sso'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SSO construct libraries](https://constructs.dev/search?q=sso) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SSO resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSO.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SSO](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSO.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-sso/jest.config.js b/packages/@aws-cdk/aws-sso/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-sso/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-sso/lib/index.ts b/packages/@aws-cdk/aws-sso/lib/index.ts deleted file mode 100644 index 3d6b1e14d0122..0000000000000 --- a/packages/@aws-cdk/aws-sso/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SSO CloudFormation Resources: -export * from './sso.generated'; diff --git a/packages/@aws-cdk/aws-sso/lib/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-sso/lib/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-sso/lib/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-sso/package.json b/packages/@aws-cdk/aws-sso/package.json deleted file mode 100644 index e0671355d6210..0000000000000 --- a/packages/@aws-cdk/aws-sso/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-sso", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::SSO", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SSO", - "packageId": "Amazon.CDK.AWS.SSO", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.sso", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "sso" - } - }, - "python": { - "distName": "aws-cdk.aws-sso", - "module": "aws_cdk.aws_sso", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-sso" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SSO", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SSO", - "aws-sso" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-sso/test/sso.test.ts b/packages/@aws-cdk/aws-sso/test/sso.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-sso/test/sso.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/.eslintrc.js b/packages/@aws-cdk/aws-stepfunctions-tasks/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/.gitignore b/packages/@aws-cdk/aws-stepfunctions-tasks/.gitignore deleted file mode 100644 index 24b6aacaee731..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -.cdk.staging -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/.npmignore b/packages/@aws-cdk/aws-stepfunctions-tasks/.npmignore deleted file mode 100644 index 8ea92f72c8fab..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/LICENSE b/packages/@aws-cdk/aws-stepfunctions-tasks/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/NOTICE b/packages/@aws-cdk/aws-stepfunctions-tasks/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/README.md b/packages/@aws-cdk/aws-stepfunctions-tasks/README.md deleted file mode 100644 index b2ca56076dab8..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/README.md +++ /dev/null @@ -1,1314 +0,0 @@ -# Tasks for AWS Step Functions - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -[AWS Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) is a web service that enables you to coordinate the -components of distributed applications and microservices using visual workflows. -You build applications from individual components that each perform a discrete -function, or task, allowing you to scale and change applications quickly. - -A [Task](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html) state represents a single unit of work performed by a state machine. -All work in your state machine is performed by tasks. This module contains a collection of classes that allow you to call various AWS services -from your Step Functions state machine. - -Be sure to familiarize yourself with the [`aws-stepfunctions` module documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html) first. - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -## Table Of Contents - -- [Tasks for AWS Step Functions](#tasks-for-aws-step-functions) - - [Table Of Contents](#table-of-contents) - - [Evaluate Expression](#evaluate-expression) - - [API Gateway](#api-gateway) - - [Call REST API Endpoint](#call-rest-api-endpoint) - - [Call HTTP API Endpoint](#call-http-api-endpoint) - - [AWS SDK](#aws-sdk) - - [Athena](#athena) - - [StartQueryExecution](#startqueryexecution) - - [GetQueryExecution](#getqueryexecution) - - [GetQueryResults](#getqueryresults) - - [StopQueryExecution](#stopqueryexecution) - - [Batch](#batch) - - [SubmitJob](#submitjob) - - [CodeBuild](#codebuild) - - [StartBuild](#startbuild) - - [DynamoDB](#dynamodb) - - [GetItem](#getitem) - - [PutItem](#putitem) - - [DeleteItem](#deleteitem) - - [UpdateItem](#updateitem) - - [ECS](#ecs) - - [RunTask](#runtask) - - [EC2](#ec2) - - [Fargate](#fargate) - - [EMR](#emr) - - [Create Cluster](#create-cluster) - - [Termination Protection](#termination-protection) - - [Terminate Cluster](#terminate-cluster) - - [Add Step](#add-step) - - [Cancel Step](#cancel-step) - - [Modify Instance Fleet](#modify-instance-fleet) - - [Modify Instance Group](#modify-instance-group) - - [EMR on EKS](#emr-on-eks) - - [Create Virtual Cluster](#create-virtual-cluster) - - [Delete Virtual Cluster](#delete-virtual-cluster) - - [Start Job Run](#start-job-run) - - [EKS](#eks) - - [Call](#call) - - [EventBridge](#eventbridge) - - [Put Events](#put-events) - - [Glue](#glue) - - [Glue DataBrew](#glue-databrew) - - [Lambda](#lambda) - - [SageMaker](#sagemaker) - - [Create Training Job](#create-training-job) - - [Create Transform Job](#create-transform-job) - - [Create Endpoint](#create-endpoint) - - [Create Endpoint Config](#create-endpoint-config) - - [Create Model](#create-model) - - [Update Endpoint](#update-endpoint) - - [SNS](#sns) - - [Step Functions](#step-functions) - - [Start Execution](#start-execution) - - [Invoke Activity](#invoke-activity) - - [SQS](#sqs) - -## Paths - -Learn more about input and output processing in Step Functions [here](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html) - -## Evaluate Expression - -Use the `EvaluateExpression` to perform simple operations referencing state paths. The -`expression` referenced in the task will be evaluated in a Lambda function -(`eval()`). This allows you to not have to write Lambda code for simple operations. - -Example: convert a wait time from milliseconds to seconds, concat this in a message and wait: - -```ts -const convertToSeconds = new tasks.EvaluateExpression(this, 'Convert to seconds', { - expression: '$.waitMilliseconds / 1000', - resultPath: '$.waitSeconds', -}); - -const createMessage = new tasks.EvaluateExpression(this, 'Create message', { - // Note: this is a string inside a string. - expression: '`Now waiting ${$.waitSeconds} seconds...`', - runtime: lambda.Runtime.NODEJS_14_X, - resultPath: '$.message', -}); - -const publishMessage = new tasks.SnsPublish(this, 'Publish message', { - topic: new sns.Topic(this, 'cool-topic'), - message: sfn.TaskInput.fromJsonPathAt('$.message'), - resultPath: '$.sns', -}); - -const wait = new sfn.Wait(this, 'Wait', { - time: sfn.WaitTime.secondsPath('$.waitSeconds'), -}); - -new sfn.StateMachine(this, 'StateMachine', { - definition: convertToSeconds - .next(createMessage) - .next(publishMessage) - .next(wait), -}); -``` - -The `EvaluateExpression` supports a `runtime` prop to specify the Lambda -runtime to use to evaluate the expression. Currently, only runtimes -of the Node.js family are supported. - -## API Gateway - -Step Functions supports [API Gateway](https://docs.aws.amazon.com/step-functions/latest/dg/connect-api-gateway.html) through the service integration pattern. - -HTTP APIs are designed for low-latency, cost-effective integrations with AWS services, including AWS Lambda, and HTTP endpoints. -HTTP APIs support OIDC and OAuth 2.0 authorization, and come with built-in support for CORS and automatic deployments. -Previous-generation REST APIs currently offer more features. More details can be found [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html). - -### Call REST API Endpoint - -The `CallApiGatewayRestApiEndpoint` calls the REST API endpoint. - -```ts -import * as apigateway from '@aws-cdk/aws-apigateway'; -const restApi = new apigateway.RestApi(this, 'MyRestApi'); - -const invokeTask = new tasks.CallApiGatewayRestApiEndpoint(this, 'Call REST API', { - api: restApi, - stageName: 'prod', - method: tasks.HttpMethod.GET, -}); -``` - -Be aware that the header values must be arrays. When passing the Task Token -in the headers field `WAIT_FOR_TASK_TOKEN` integration, use -`JsonPath.array()` to wrap the token in an array: - -```ts -import * as apigateway from '@aws-cdk/aws-apigateway'; -declare const api: apigateway.RestApi; - -new tasks.CallApiGatewayRestApiEndpoint(this, 'Endpoint', { - api, - stageName: 'Stage', - method: tasks.HttpMethod.PUT, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - headers: sfn.TaskInput.fromObject({ - TaskToken: sfn.JsonPath.array(sfn.JsonPath.taskToken), - }), -}); -``` - -### Call HTTP API Endpoint - -The `CallApiGatewayHttpApiEndpoint` calls the HTTP API endpoint. - -```ts -import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; -const httpApi = new apigatewayv2.HttpApi(this, 'MyHttpApi'); - -const invokeTask = new tasks.CallApiGatewayHttpApiEndpoint(this, 'Call HTTP API', { - apiId: httpApi.apiId, - apiStack: Stack.of(httpApi), - method: tasks.HttpMethod.GET, -}); -``` - -### AWS SDK - -Step Functions supports calling [AWS service's API actions](https://docs.aws.amazon.com/step-functions/latest/dg/supported-services-awssdk.html) -through the service integration pattern. - -You can use Step Functions' AWS SDK integrations to call any of the over two hundred AWS services -directly from your state machine, giving you access to over nine thousand API actions. - -```ts -declare const myBucket: s3.Bucket; -const getObject = new tasks.CallAwsService(this, 'GetObject', { - service: 's3', - action: 'getObject', - parameters: { - Bucket: myBucket.bucketName, - Key: sfn.JsonPath.stringAt('$.key') - }, - iamResources: [myBucket.arnForObjects('*')], -}); -``` - -Use camelCase for actions and PascalCase for parameter names. - -The task automatically adds an IAM statement to the state machine role's policy based on the -service and action called. The resources for this statement must be specified in `iamResources`. - -Use the `iamAction` prop to manually specify the IAM action name in the case where the IAM -action name does not match with the API service/action name: - -```ts -const listBuckets = new tasks.CallAwsService(this, 'ListBuckets', { - service: 's3', - action: 'listBuckets', - iamResources: ['*'], - iamAction: 's3:ListAllMyBuckets', -}); -``` - -Use the `additionalIamStatements` prop to pass additional IAM statements that will be added to the -state machine role's policy. Use it in the case where the call requires more than a single statement -to be executed: - -```ts -const detectLabels = new tasks.CallAwsService(this, 'DetectLabels', { - service: 'rekognition', - action: 'detectLabels', - iamResources: ['*'], - additionalIamStatements: [ - new iam.PolicyStatement({ - actions: ['s3:getObject'], - resources: ['arn:aws:s3:::my-bucket/*'], - }), - ], -}); -``` - -## Athena - -Step Functions supports [Athena](https://docs.aws.amazon.com/step-functions/latest/dg/connect-athena.html) through the service integration pattern. - -### StartQueryExecution - -The [StartQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html) API runs the SQL query statement. - -```ts -const startQueryExecutionJob = new tasks.AthenaStartQueryExecution(this, 'Start Athena Query', { - queryString: sfn.JsonPath.stringAt('$.queryString'), - queryExecutionContext: { - databaseName: 'mydatabase', - }, - resultConfiguration: { - encryptionConfiguration: { - encryptionOption: tasks.EncryptionOption.S3_MANAGED, - }, - outputLocation: { - bucketName: 'query-results-bucket', - objectKey: 'folder', - }, - }, -}); -``` - -### GetQueryExecution - -The [GetQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html) API gets information about a single execution of a query. - -```ts -const getQueryExecutionJob = new tasks.AthenaGetQueryExecution(this, 'Get Query Execution', { - queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), -}); -``` - -### GetQueryResults - -The [GetQueryResults](https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryResults.html) API that streams the results of a single query execution specified by QueryExecutionId from S3. - -```ts -const getQueryResultsJob = new tasks.AthenaGetQueryResults(this, 'Get Query Results', { - queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), -}); -``` - -### StopQueryExecution - -The [StopQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_StopQueryExecution.html) API that stops a query execution. - -```ts -const stopQueryExecutionJob = new tasks.AthenaStopQueryExecution(this, 'Stop Query Execution', { - queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), -}); -``` - -## Batch - -Step Functions supports [Batch](https://docs.aws.amazon.com/step-functions/latest/dg/connect-batch.html) through the service integration pattern. - -### SubmitJob - -The [SubmitJob](https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html) API submits an AWS Batch job from a job definition. - -```ts -import * as batch from '@aws-cdk/aws-batch'; -declare const batchJobDefinition: batch.JobDefinition; -declare const batchQueue: batch.JobQueue; - -const task = new tasks.BatchSubmitJob(this, 'Submit Job', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'MyJob', - jobQueueArn: batchQueue.jobQueueArn, -}); -``` - -## CodeBuild - -Step Functions supports [CodeBuild](https://docs.aws.amazon.com/step-functions/latest/dg/connect-codebuild.html) through the service integration pattern. - -### StartBuild - -[StartBuild](https://docs.aws.amazon.com/codebuild/latest/APIReference/API_StartBuild.html) starts a CodeBuild Project by Project Name. - -```ts -import * as codebuild from '@aws-cdk/aws-codebuild'; - -const codebuildProject = new codebuild.Project(this, 'Project', { - projectName: 'MyTestProject', - buildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - phases: { - build: { - commands: [ - 'echo "Hello, CodeBuild!"', - ], - }, - }, - }), -}); - -const task = new tasks.CodeBuildStartBuild(this, 'Task', { - project: codebuildProject, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - environmentVariablesOverride: { - ZONE: { - type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, - value: sfn.JsonPath.stringAt('$.envVariables.zone'), - }, - }, -}); -``` - -## DynamoDB - -You can call DynamoDB APIs from a `Task` state. -Read more about calling DynamoDB APIs [here](https://docs.aws.amazon.com/step-functions/latest/dg/connect-ddb.html) - -### GetItem - -The [GetItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html) operation returns a set of attributes for the item with the given primary key. - -```ts -declare const myTable: dynamodb.Table; -new tasks.DynamoGetItem(this, 'Get Item', { - key: { messageId: tasks.DynamoAttributeValue.fromString('message-007') }, - table: myTable, -}); -``` - -### PutItem - -The [PutItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html) operation creates a new item, or replaces an old item with a new item. - -```ts -declare const myTable: dynamodb.Table; -new tasks.DynamoPutItem(this, 'PutItem', { - item: { - MessageId: tasks.DynamoAttributeValue.fromString('message-007'), - Text: tasks.DynamoAttributeValue.fromString(sfn.JsonPath.stringAt('$.bar')), - TotalCount: tasks.DynamoAttributeValue.fromNumber(10), - }, - table: myTable, -}); -``` - -### DeleteItem - -The [DeleteItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html) operation deletes a single item in a table by primary key. - -```ts -declare const myTable: dynamodb.Table; -new tasks.DynamoDeleteItem(this, 'DeleteItem', { - key: { MessageId: tasks.DynamoAttributeValue.fromString('message-007') }, - table: myTable, - resultPath: sfn.JsonPath.DISCARD, -}); -``` - -### UpdateItem - -The [UpdateItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html) operation edits an existing item's attributes, or adds a new item -to the table if it does not already exist. - -```ts -declare const myTable: dynamodb.Table; -new tasks.DynamoUpdateItem(this, 'UpdateItem', { - key: { - MessageId: tasks.DynamoAttributeValue.fromString('message-007') - }, - table: myTable, - expressionAttributeValues: { - ':val': tasks.DynamoAttributeValue.numberFromString(sfn.JsonPath.stringAt('$.Item.TotalCount.N')), - ':rand': tasks.DynamoAttributeValue.fromNumber(20), - }, - updateExpression: 'SET TotalCount = :val + :rand', -}); -``` - -## ECS - -Step Functions supports [ECS/Fargate](https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html) through the service integration pattern. - -### RunTask - -[RunTask](https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html) starts a new task using the specified task definition. - -#### EC2 - -The EC2 launch type allows you to run your containerized applications on a cluster -of Amazon EC2 instances that you manage. - -When a task that uses the EC2 launch type is launched, Amazon ECS must determine where -to place the task based on the requirements specified in the task definition, such as -CPU and memory. Similarly, when you scale down the task count, Amazon ECS must determine -which tasks to terminate. You can apply task placement strategies and constraints to -customize how Amazon ECS places and terminates tasks. Learn more about [task placement](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement.html) - -The latest ACTIVE revision of the passed task definition is used for running the task. - -The following example runs a job from a task definition on EC2 - -```ts -const vpc = ec2.Vpc.fromLookup(this, 'Vpc', { - isDefault: true, -}); - -const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc }); -cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro'), - vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, -}); - -const taskDefinition = new ecs.TaskDefinition(this, 'TD', { - compatibility: ecs.Compatibility.EC2, -}); - -taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('foo/bar'), - memoryLimitMiB: 256, -}); - -const runTask = new tasks.EcsRunTask(this, 'Run', { - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - cluster, - taskDefinition, - launchTarget: new tasks.EcsEc2LaunchTarget({ - placementStrategies: [ - ecs.PlacementStrategy.spreadAcrossInstances(), - ecs.PlacementStrategy.packedByCpu(), - ecs.PlacementStrategy.randomly(), - ], - placementConstraints: [ - ecs.PlacementConstraint.memberOf('blieptuut'), - ], - }), -}); -``` - -#### Fargate - -AWS Fargate is a serverless compute engine for containers that works with Amazon -Elastic Container Service (ECS). Fargate makes it easy for you to focus on building -your applications. Fargate removes the need to provision and manage servers, lets you -specify and pay for resources per application, and improves security through application -isolation by design. Learn more about [Fargate](https://aws.amazon.com/fargate/) - -The Fargate launch type allows you to run your containerized applications without the need -to provision and manage the backend infrastructure. Just register your task definition and -Fargate launches the container for you. The latest ACTIVE revision of the passed -task definition is used for running the task. Learn more about -[Fargate Versioning](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTaskDefinition.html) - -The following example runs a job from a task definition on Fargate - -```ts -const vpc = ec2.Vpc.fromLookup(this, 'Vpc', { - isDefault: true, -}); - -const cluster = new ecs.Cluster(this, 'FargateCluster', { vpc }); - -const taskDefinition = new ecs.TaskDefinition(this, 'TD', { - memoryMiB: '512', - cpu: '256', - compatibility: ecs.Compatibility.FARGATE, -}); - -const containerDefinition = taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('foo/bar'), - memoryLimitMiB: 256, -}); - -const runTask = new tasks.EcsRunTask(this, 'RunFargate', { - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - cluster, - taskDefinition, - assignPublicIp: true, - containerOverrides: [{ - containerDefinition, - environment: [{ name: 'SOME_KEY', value: sfn.JsonPath.stringAt('$.SomeKey') }], - }], - launchTarget: new tasks.EcsFargateLaunchTarget(), -}); -``` - -## EMR - -Step Functions supports Amazon EMR through the service integration pattern. -The service integration APIs correspond to Amazon EMR APIs but differ in the -parameters that are used. - -[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr.html) about the differences when using these service integrations. - -### Create Cluster - -Creates and starts running a cluster (job flow). -Corresponds to the [`runJobFlow`](https://docs.aws.amazon.com/emr/latest/APIReference/API_RunJobFlow.html) API in EMR. - -```ts -const clusterRole = new iam.Role(this, 'ClusterRole', { - assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), -}); - -const serviceRole = new iam.Role(this, 'ServiceRole', { - assumedBy: new iam.ServicePrincipal('elasticmapreduce.amazonaws.com'), -}); - -const autoScalingRole = new iam.Role(this, 'AutoScalingRole', { - assumedBy: new iam.ServicePrincipal('elasticmapreduce.amazonaws.com'), -}); - -autoScalingRole.assumeRolePolicy?.addStatements( - new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - principals: [ - new iam.ServicePrincipal('application-autoscaling.amazonaws.com'), - ], - actions: [ - 'sts:AssumeRole', - ], - })); -) - -new tasks.EmrCreateCluster(this, 'Create Cluster', { - instances: {}, - clusterRole, - name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value, - serviceRole, - autoScalingRole, -}); -``` - -If you want to run multiple steps in [parallel](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-concurrent-steps.html), -you can specify the `stepConcurrencyLevel` property. The concurrency range is between 1 -and 256 inclusive, where the default concurrency of 1 means no step concurrency is allowed. -`stepConcurrencyLevel` requires the EMR release label to be 5.28.0 or above. - -```ts -new tasks.EmrCreateCluster(this, 'Create Cluster', { - instances: {}, - name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value, - stepConcurrencyLevel: 10, -}); -``` - -### Termination Protection - -Locks a cluster (job flow) so the EC2 instances in the cluster cannot be -terminated by user intervention, an API call, or a job-flow error. - -Corresponds to the [`setTerminationProtection`](https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr.html) API in EMR. - -```ts -new tasks.EmrSetClusterTerminationProtection(this, 'Task', { - clusterId: 'ClusterId', - terminationProtected: false, -}); -``` - -### Terminate Cluster - -Shuts down a cluster (job flow). -Corresponds to the [`terminateJobFlows`](https://docs.aws.amazon.com/emr/latest/APIReference/API_TerminateJobFlows.html) API in EMR. - -```ts -new tasks.EmrTerminateCluster(this, 'Task', { - clusterId: 'ClusterId', -}); -``` - -### Add Step - -Adds a new step to a running cluster. -Corresponds to the [`addJobFlowSteps`](https://docs.aws.amazon.com/emr/latest/APIReference/API_AddJobFlowSteps.html) API in EMR. - -```ts -new tasks.EmrAddStep(this, 'Task', { - clusterId: 'ClusterId', - name: 'StepName', - jar: 'Jar', - actionOnFailure: tasks.ActionOnFailure.CONTINUE, -}); -``` - -### Cancel Step - -Cancels a pending step in a running cluster. -Corresponds to the [`cancelSteps`](https://docs.aws.amazon.com/emr/latest/APIReference/API_CancelSteps.html) API in EMR. - -```ts -new tasks.EmrCancelStep(this, 'Task', { - clusterId: 'ClusterId', - stepId: 'StepId', -}); -``` - -### Modify Instance Fleet - -Modifies the target On-Demand and target Spot capacities for the instance -fleet with the specified InstanceFleetName. - -Corresponds to the [`modifyInstanceFleet`](https://docs.aws.amazon.com/emr/latest/APIReference/API_ModifyInstanceFleet.html) API in EMR. - -```ts -new tasks.EmrModifyInstanceFleetByName(this, 'Task', { - clusterId: 'ClusterId', - instanceFleetName: 'InstanceFleetName', - targetOnDemandCapacity: 2, - targetSpotCapacity: 0, -}); -``` - -### Modify Instance Group - -Modifies the number of nodes and configuration settings of an instance group. - -Corresponds to the [`modifyInstanceGroups`](https://docs.aws.amazon.com/emr/latest/APIReference/API_ModifyInstanceGroups.html) API in EMR. - -```ts -new tasks.EmrModifyInstanceGroupByName(this, 'Task', { - clusterId: 'ClusterId', - instanceGroupName: sfn.JsonPath.stringAt('$.InstanceGroupName'), - instanceGroup: { - instanceCount: 1, - }, -}); -``` - -## EMR on EKS - -Step Functions supports Amazon EMR on EKS through the service integration pattern. -The service integration APIs correspond to Amazon EMR on EKS APIs, but differ in the parameters that are used. - -[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr-eks.html) about the differences when using these service integrations. - -[Setting up](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up.html) the EKS cluster is required. - -### Create Virtual Cluster - -The [CreateVirtualCluster](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_CreateVirtualCluster.html) API creates a single virtual cluster that's mapped to a single Kubernetes namespace. - -The EKS cluster containing the Kubernetes namespace where the virtual cluster will be mapped can be passed in from the task input. - -```ts -new tasks.EmrContainersCreateVirtualCluster(this, 'Create a Virtual Cluster', { - eksCluster: tasks.EksClusterInput.fromTaskInput(sfn.TaskInput.fromText('clusterId')), -}); -``` - -The EKS cluster can also be passed in directly. - -```ts -import * as eks from '@aws-cdk/aws-eks'; - -declare const eksCluster: eks.Cluster; - -new tasks.EmrContainersCreateVirtualCluster(this, 'Create a Virtual Cluster', { - eksCluster: tasks.EksClusterInput.fromCluster(eksCluster), -}); -``` - -By default, the Kubernetes namespace that a virtual cluster maps to is "default", but a specific namespace within an EKS cluster can be selected. - -```ts -new tasks.EmrContainersCreateVirtualCluster(this, 'Create a Virtual Cluster', { - eksCluster: tasks.EksClusterInput.fromTaskInput(sfn.TaskInput.fromText('clusterId')), - eksNamespace: 'specified-namespace', -}); -``` - -### Delete Virtual Cluster - -The [DeleteVirtualCluster](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_DeleteVirtualCluster.html) API deletes a virtual cluster. - -```ts -new tasks.EmrContainersDeleteVirtualCluster(this, 'Delete a Virtual Cluster', { - virtualClusterId: sfn.TaskInput.fromJsonPathAt('$.virtualCluster'), -}); -``` - -### Start Job Run - -The [StartJobRun](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_StartJobRun.html) API starts a job run. A job is a unit of work that you submit to Amazon EMR on EKS for execution. The work performed by the job can be defined by a Spark jar, PySpark script, or SparkSQL query. A job run is an execution of the job on the virtual cluster. - -Required setup: - - - If not done already, follow the [steps](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up.html) to setup EMR on EKS and [create an EKS Cluster](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-eks-readme.html#quick-start). - - Enable [Cluster access](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-cluster-access.html) - - Enable [IAM Role access](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html) - -The following actions must be performed if the virtual cluster ID is supplied from the task input. Otherwise, if it is supplied statically in the state machine definition, these actions will be done automatically. - - - Create an [IAM role](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html) - - Update the [Role Trust Policy](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-trust-policy.html) of the Job Execution Role. - -The job can be configured with spark submit parameters: - -```ts -new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { - virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), - releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', - }, - }, -}); -``` - -Configuring the job can also be done via application configuration: - -```ts -new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { - virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), - releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, - jobName: 'EMR-Containers-Job', - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - }, - }, - applicationConfig: [{ - classification: tasks.Classification.SPARK_DEFAULTS, - properties: { - 'spark.executor.instances': '1', - 'spark.executor.memory': '512M', - }, - }], -}); -``` - -Job monitoring can be enabled if `monitoring.logging` is set true. This automatically generates an S3 bucket and CloudWatch logs. - -```ts -new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { - virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), - releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', - }, - }, - monitoring: { - logging: true, - }, -}); -``` - -Otherwise, providing monitoring for jobs with existing log groups and log buckets is also available. - -```ts -import * as logs from '@aws-cdk/aws-logs'; - -const logGroup = new logs.LogGroup(this, 'Log Group'); -const logBucket = new s3.Bucket(this, 'S3 Bucket') - -new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { - virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), - releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', - }, - }, - monitoring: { - logGroup: logGroup, - logBucket: logBucket, - }, -}); -``` - -Users can provide their own existing Job Execution Role. - -```ts -new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { - virtualCluster:tasks.VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.VirtualClusterId')), - releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, - jobName: 'EMR-Containers-Job', - executionRole: iam.Role.fromRoleArn(this, 'Job-Execution-Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', - }, - }, -}); -``` - -## EKS - -Step Functions supports Amazon EKS through the service integration pattern. -The service integration APIs correspond to Amazon EKS APIs. - -[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html) about the differences when using these service integrations. - -### Call - -Read and write Kubernetes resource objects via a Kubernetes API endpoint. -Corresponds to the [`call`](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html) API in Step Functions Connector. - -The following code snippet includes a Task state that uses eks:call to list the pods. - -```ts -import * as eks from '@aws-cdk/aws-eks'; - -const myEksCluster = new eks.Cluster(this, 'my sample cluster', { - version: eks.KubernetesVersion.V1_18, - clusterName: 'myEksCluster', -}); - -new tasks.EksCall(this, 'Call a EKS Endpoint', { - cluster: myEksCluster, - httpMethod: tasks.HttpMethods.GET, - httpPath: '/api/v1/namespaces/default/pods', -}); -``` - -## EventBridge - -Step Functions supports Amazon EventBridge through the service integration pattern. -The service integration APIs correspond to Amazon EventBridge APIs. - -[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eventbridge.html) about the differences when using these service integrations. - -### Put Events - -Send events to an EventBridge bus. -Corresponds to the [`put-events`](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eventbridge.html) API in Step Functions Connector. - -The following code snippet includes a Task state that uses events:putevents to send an event to the default bus. - -```ts -import * as events from '@aws-cdk/aws-events'; - -const myEventBus = new events.EventBus(this, 'EventBus', { - eventBusName: 'MyEventBus1', -}); - -new tasks.EventBridgePutEvents(this, 'Send an event to EventBridge', { - entries: [{ - detail: sfn.TaskInput.fromObject({ - Message: 'Hello from Step Functions!', - }), - eventBus: myEventBus, - detailType: 'MessageFromStepFunctions', - source: 'step.functions', - }], -}); -``` - -## Glue - -Step Functions supports [AWS Glue](https://docs.aws.amazon.com/step-functions/latest/dg/connect-glue.html) through the service integration pattern. - -You can call the [`StartJobRun`](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html#aws-glue-api-jobs-runs-StartJobRun) API from a `Task` state. - -```ts -new tasks.GlueStartJobRun(this, 'Task', { - glueJobName: 'my-glue-job', - arguments: sfn.TaskInput.fromObject({ - key: 'value', - }), - taskTimeout: sfn.Timeout.duration(Duration.minutes(30)), - notifyDelayAfter: Duration.minutes(5), -}); -``` - -## Glue DataBrew - -Step Functions supports [AWS Glue DataBrew](https://docs.aws.amazon.com/step-functions/latest/dg/connect-databrew.html) through the service integration pattern. - -You can call the [`StartJobRun`](https://docs.aws.amazon.com/databrew/latest/dg/API_StartJobRun.html) API from a `Task` state. - -```ts -new tasks.GlueDataBrewStartJobRun(this, 'Task', { - name: 'databrew-job', -}); -``` - -## Lambda - -[Invoke](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html) a Lambda function. - -You can specify the input to your Lambda function through the `payload` attribute. -By default, Step Functions invokes Lambda function with the state input (JSON path '$') -as the input. - -The following snippet invokes a Lambda Function with the state input as the payload -by referencing the `$` path. - -```ts -declare const fn: lambda.Function; -new tasks.LambdaInvoke(this, 'Invoke with state input', { - lambdaFunction: fn, -}); -``` - -When a function is invoked, the Lambda service sends [these response -elements](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_ResponseElements) -back. - -⚠️ The response from the Lambda function is in an attribute called `Payload` - -The following snippet invokes a Lambda Function by referencing the `$.Payload` path -to reference the output of a Lambda executed before it. - -```ts -declare const fn: lambda.Function; -new tasks.LambdaInvoke(this, 'Invoke with empty object as payload', { - lambdaFunction: fn, - payload: sfn.TaskInput.fromObject({}), -}); - -// use the output of fn as input -new tasks.LambdaInvoke(this, 'Invoke with payload field in the state input', { - lambdaFunction: fn, - payload: sfn.TaskInput.fromJsonPathAt('$.Payload'), -}); -``` - -The following snippet invokes a Lambda and sets the task output to only include -the Lambda function response. - -```ts -declare const fn: lambda.Function; -new tasks.LambdaInvoke(this, 'Invoke and set function response as task output', { - lambdaFunction: fn, - outputPath: '$.Payload', -}); -``` - -If you want to combine the input and the Lambda function response you can use -the `payloadResponseOnly` property and specify the `resultPath`. This will put the -Lambda function ARN directly in the "Resource" string, but it conflicts with the -integrationPattern, invocationType, clientContext, and qualifier properties. - -```ts -declare const fn: lambda.Function; -new tasks.LambdaInvoke(this, 'Invoke and combine function response with task input', { - lambdaFunction: fn, - payloadResponseOnly: true, - resultPath: '$.fn', -}); -``` - -You can have Step Functions pause a task, and wait for an external process to -return a task token. Read more about the [callback pattern](https://docs.aws.amazon.com/step-functions/latest/dg/callback-task-sample-sqs.html#call-back-lambda-example) - -To use the callback pattern, set the `token` property on the task. Call the Step -Functions `SendTaskSuccess` or `SendTaskFailure` APIs with the token to -indicate that the task has completed and the state machine should resume execution. - -The following snippet invokes a Lambda with the task token as part of the input -to the Lambda. - -```ts -declare const fn: lambda.Function; -new tasks.LambdaInvoke(this, 'Invoke with callback', { - lambdaFunction: fn, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - payload: sfn.TaskInput.fromObject({ - token: sfn.JsonPath.taskToken, - input: sfn.JsonPath.stringAt('$.someField'), - }), -}); -``` - -⚠️ The task will pause until it receives that task token back with a `SendTaskSuccess` or `SendTaskFailure` -call. Learn more about [Callback with the Task -Token](https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token). - -AWS Lambda can occasionally experience transient service errors. In this case, invoking Lambda -results in a 500 error, such as `ServiceException`, `AWSLambdaException`, or `SdkClientException`. -As a best practice, the `LambdaInvoke` task will retry on those errors with an interval of 2 seconds, -a back-off rate of 2 and 6 maximum attempts. Set the `retryOnServiceExceptions` prop to `false` to -disable this behavior. - -## SageMaker - -Step Functions supports [AWS SageMaker](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html) through the service integration pattern. - -If your training job or model uses resources from AWS Marketplace, -[network isolation is required](https://docs.aws.amazon.com/sagemaker/latest/dg/mkt-algo-model-internet-free.html). -To do so, set the `enableNetworkIsolation` property to `true` for `SageMakerCreateModel` or `SageMakerCreateTrainingJob`. - -To set environment variables for the Docker container use the `environment` property. - -### Create Training Job - -You can call the [`CreateTrainingJob`](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTrainingJob.html) API from a `Task` state. - -```ts -new tasks.SageMakerCreateTrainingJob(this, 'TrainSagemaker', { - trainingJobName: sfn.JsonPath.stringAt('$.JobName'), - algorithmSpecification: { - algorithmName: 'BlazingText', - trainingInputMode: tasks.InputMode.FILE, - }, - inputDataConfig: [{ - channelName: 'train', - dataSource: { - s3DataSource: { - s3DataType: tasks.S3DataType.S3_PREFIX, - s3Location: tasks.S3Location.fromJsonExpression('$.S3Bucket'), - }, - }, - }], - outputDataConfig: { - s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'mybucket'), 'myoutputpath'), - }, - resourceConfig: { - instanceCount: 1, - instanceType: new ec2.InstanceType(sfn.JsonPath.stringAt('$.InstanceType')), - volumeSize: Size.gibibytes(50), - }, // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume - stoppingCondition: { - maxRuntime: Duration.hours(2), - }, // optional: default is 1 hour -}); -``` - -### Create Transform Job - -You can call the [`CreateTransformJob`](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTransformJob.html) API from a `Task` state. - -```ts -new tasks.SageMakerCreateTransformJob(this, 'Batch Inference', { - transformJobName: 'MyTransformJob', - modelName: 'MyModelName', - modelClientOptions: { - invocationsMaxRetries: 3, // default is 0 - invocationsTimeout: Duration.minutes(5), // default is 60 seconds - }, - transformInput: { - transformDataSource: { - s3DataSource: { - s3Uri: 's3://inputbucket/train', - s3DataType: tasks.S3DataType.S3_PREFIX, - } - } - }, - transformOutput: { - s3OutputPath: 's3://outputbucket/TransformJobOutputPath', - }, - transformResources: { - instanceCount: 1, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE), - } -}); - -``` - -### Create Endpoint - -You can call the [`CreateEndpoint`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html) API from a `Task` state. - -```ts -new tasks.SageMakerCreateEndpoint(this, 'SagemakerEndpoint', { - endpointName: sfn.JsonPath.stringAt('$.EndpointName'), - endpointConfigName: sfn.JsonPath.stringAt('$.EndpointConfigName'), -}); -``` - -### Create Endpoint Config - -You can call the [`CreateEndpointConfig`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html) API from a `Task` state. - -```ts -new tasks.SageMakerCreateEndpointConfig(this, 'SagemakerEndpointConfig', { - endpointConfigName: 'MyEndpointConfig', - productionVariants: [{ - initialInstanceCount: 2, - instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), - modelName: 'MyModel', - variantName: 'awesome-variant', - }], -}); -``` - -### Create Model - -You can call the [`CreateModel`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModel.html) API from a `Task` state. - -```ts -new tasks.SageMakerCreateModel(this, 'Sagemaker', { - modelName: 'MyModel', - primaryContainer: new tasks.ContainerDefinition({ - image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Model.imageName')), - mode: tasks.Mode.SINGLE_MODEL, - modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'), - }), -}); -``` - -### Update Endpoint - -You can call the [`UpdateEndpoint`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateEndpoint.html) API from a `Task` state. - -```ts -new tasks.SageMakerUpdateEndpoint(this, 'SagemakerEndpoint', { - endpointName: sfn.JsonPath.stringAt('$.Endpoint.Name'), - endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.EndpointConfig'), -}); -``` - -## SNS - -Step Functions supports [Amazon SNS](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sns.html) through the service integration pattern. - -You can call the [`Publish`](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html) API from a `Task` state to publish to an SNS topic. - -```ts -const topic = new sns.Topic(this, 'Topic'); - -// Use a field from the execution data as message. -const task1 = new tasks.SnsPublish(this, 'Publish1', { - topic, - integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, - message: sfn.TaskInput.fromDataAt('$.state.message'), - messageAttributes: { - place: { - value: sfn.JsonPath.stringAt('$.place'), - }, - pic: { - // BINARY must be explicitly set - dataType: tasks.MessageAttributeDataType.BINARY, - value: sfn.JsonPath.stringAt('$.pic'), - }, - people: { - value: 4, - }, - handles: { - value: ['@kslater', '@jjf', null, '@mfanning'], - }, - }, -}); - -// Combine a field from the execution data with -// a literal object. -const task2 = new tasks.SnsPublish(this, 'Publish2', { - topic, - message: sfn.TaskInput.fromObject({ - field1: 'somedata', - field2: sfn.JsonPath.stringAt('$.field2'), - }), -}); -``` - -## Step Functions - -### Start Execution - -You can manage [AWS Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/connect-stepfunctions.html) executions. - -AWS Step Functions supports it's own [`StartExecution`](https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html) API as a service integration. - -```ts -// Define a state machine with one Pass state -const child = new sfn.StateMachine(this, 'ChildStateMachine', { - definition: sfn.Chain.start(new sfn.Pass(this, 'PassState')), -}); - -// Include the state machine in a Task state with callback pattern -const task = new tasks.StepFunctionsStartExecution(this, 'ChildTask', { - stateMachine: child, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - input: sfn.TaskInput.fromObject({ - token: sfn.JsonPath.taskToken, - foo: 'bar', - }), - name: 'MyExecutionName', -}); - -// Define a second state machine with the Task state above -new sfn.StateMachine(this, 'ParentStateMachine', { - definition: task, -}); -``` - -You can utilize [Associate Workflow Executions](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-nested-workflows.html#nested-execution-startid) -via the `associateWithParent` property. This allows the Step Functions UI to link child -executions from parent executions, making it easier to trace execution flow across state machines. - -```ts -declare const child: sfn.StateMachine; -const task = new tasks.StepFunctionsStartExecution(this, 'ChildTask', { - stateMachine: child, - associateWithParent: true, -}); -``` - -This will add the payload `AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$: $$.Execution.Id` to the -`input`property for you, which will pass the execution ID from the context object to the -execution input. It requires `input` to be an object or not be set at all. - -### Invoke Activity - -You can invoke a [Step Functions Activity](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html) which enables you to have -a task in your state machine where the work is performed by a *worker* that can -be hosted on Amazon EC2, Amazon ECS, AWS Lambda, basically anywhere. Activities -are a way to associate code running somewhere (known as an activity worker) with -a specific task in a state machine. - -When Step Functions reaches an activity task state, the workflow waits for an -activity worker to poll for a task. An activity worker polls Step Functions by -using GetActivityTask, and sending the ARN for the related activity. - -After the activity worker completes its work, it can provide a report of its -success or failure by using `SendTaskSuccess` or `SendTaskFailure`. These two -calls use the taskToken provided by GetActivityTask to associate the result -with that task. - -The following example creates an activity and creates a task that invokes the activity. - -```ts -const submitJobActivity = new sfn.Activity(this, 'SubmitJob'); - -new tasks.StepFunctionsInvokeActivity(this, 'Submit Job', { - activity: submitJobActivity, -}); -``` - -Use the [Parameters](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters) field to create a collection of key-value pairs that are passed as input. -The values of each can either be static values that you include in your state machine definition, or selected from either the input or the context object with a path. - -```ts -const submitJobActivity = new sfn.Activity(this, 'SubmitJob'); - -new tasks.StepFunctionsInvokeActivity(this, 'Submit Job', { - activity: submitJobActivity, - parameters: { - comment: 'Selecting what I care about.', - MyDetails: { - size: sfn.JsonPath.stringAt('$.product.details.size'), - exists: sfn.JsonPath.stringAt('$.product.availability'), - StaticValue: 'foo' - }, - }, -}); -``` - -## SQS - -Step Functions supports [Amazon SQS](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sqs.html) - -You can call the [`SendMessage`](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html) API from a `Task` state -to send a message to an SQS queue. - -```ts -const queue = new sqs.Queue(this, 'Queue'); - -// Use a field from the execution data as message. -const task1 = new tasks.SqsSendMessage(this, 'Send1', { - queue, - messageBody: sfn.TaskInput.fromJsonPathAt('$.message'), -}); - -// Combine a field from the execution data with -// a literal object. -const task2 = new tasks.SqsSendMessage(this, 'Send2', { - queue, - messageBody: sfn.TaskInput.fromObject({ - field1: 'somedata', - field2: sfn.JsonPath.stringAt('$.field2'), - }), -}); -``` diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/jest.config.js b/packages/@aws-cdk/aws-stepfunctions-tasks/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/base-types.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/base-types.ts deleted file mode 100644 index 64c649063e57c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/base-types.ts +++ /dev/null @@ -1,79 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; - -/** Http Methods that API Gateway supports */ -export enum HttpMethod { - /** Retreive data from a server at the specified resource */ - GET = 'GET', - - /** Send data to the API endpoint to create or udpate a resource */ - POST = 'POST', - - /** Send data to the API endpoint to update or create a resource */ - PUT = 'PUT', - - /** Delete the resource at the specified endpoint */ - DELETE = 'DELETE', - - /** Apply partial modifications to the resource */ - PATCH = 'PATCH', - - /** Retreive data from a server at the specified resource without the response body */ - HEAD = 'HEAD', - - /** Return data describing what other methods and operations the server supports */ - OPTIONS = 'OPTIONS' -} - -/** - * The authentication method used to call the endpoint - */ -export enum AuthType { - /** Call the API direclty with no authorization method */ - NO_AUTH = 'NO_AUTH', - - /** Use the IAM role associated with the current state machine for authorization */ - IAM_ROLE = 'IAM_ROLE', - - /** Use the resource policy of the API for authorization */ - RESOURCE_POLICY = 'RESOURCE_POLICY', -} - -/** - * Base CallApiGatewayEdnpoint Task Props - */ -export interface CallApiGatewayEndpointBaseProps extends sfn.TaskStateBaseProps { - /** - * Http method for the API - */ - readonly method: HttpMethod; - - /** - * HTTP request information that does not relate to contents of the request - * @default - No headers - */ - readonly headers?: sfn.TaskInput; - - /** - * Path parameters appended after API endpoint - * @default - No path - */ - readonly apiPath?: string; - - /** - * Query strings attatched to end of request - * @default - No query parameters - */ - readonly queryParameters?: sfn.TaskInput; - - /** - * HTTP Request body - * @default - No request body - */ - readonly requestBody?: sfn.TaskInput; - - /** - * Authentication methods - * @default AuthType.NO_AUTH - */ - readonly authType?: AuthType; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/databrew/start-job-run.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/databrew/start-job-run.ts deleted file mode 100644 index 538e0392c842e..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/databrew/start-job-run.ts +++ /dev/null @@ -1,77 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; - -/** - * Properties for starting a job run with StartJobRun - */ -export interface GlueDataBrewStartJobRunProps extends sfn.TaskStateBaseProps { - - /** - * Glue DataBrew Job to run - */ - readonly name: string; -} - -/** - * Start a Job run as a Task - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-databrew.html - */ -export class GlueDataBrewStartJobRun extends sfn.TaskStateBase { - - private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ - sfn.IntegrationPattern.REQUEST_RESPONSE, - sfn.IntegrationPattern.RUN_JOB, - ]; - - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - protected readonly taskPolicies?: iam.PolicyStatement[]; - - private readonly integrationPattern: sfn.IntegrationPattern; - - /** - */ - constructor(scope: Construct, id: string, private readonly props: GlueDataBrewStartJobRunProps) { - super(scope, id, props); - this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.REQUEST_RESPONSE; - - validatePatternSupported(this.integrationPattern, GlueDataBrewStartJobRun.SUPPORTED_INTEGRATION_PATTERNS); - - const actions = ['databrew:startJobRun']; - - if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { - actions.push('databrew:stopJobRun', 'databrew:listJobRuns'); - } - - this.taskPolicies = [ - new iam.PolicyStatement({ - resources: [ - cdk.Stack.of(this).formatArn({ - service: 'databrew', - resource: 'job', - // If the name comes from input, we cannot target the policy to a particular ARN prefix reliably. - resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.name) ? '*' : this.props.name, - }), - ], - actions: actions, - }), - ]; - } - - /** - * Provides the Glue DataBrew Start Job Run task configuration - * @internal - */ - protected _renderTask(): any { - return { - Resource: integrationResourceArn('databrew', 'startJobRun', this.integrationPattern), - Parameters: sfn.FieldUtils.renderObject({ - Name: this.props.name, - }), - }; - } -} - diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/private/utils.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/private/utils.ts deleted file mode 100644 index e860f6bd9d0d0..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/private/utils.ts +++ /dev/null @@ -1,30 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { integrationResourceArn } from '../../private/task-utils'; -import { DynamoAttributeValue } from '../shared-types'; - -export enum DynamoMethod { - GET = 'Get', - PUT = 'Put', - DELETE = 'Delete', - UPDATE = 'Update', -} - -export function getDynamoResourceArn(method: DynamoMethod) { - return integrationResourceArn('dynamodb', `${method.toLowerCase()}Item`, sfn.IntegrationPattern.REQUEST_RESPONSE); -} - -export function transformAttributeValueMap(attrMap?: { [key: string]: DynamoAttributeValue }) { - const transformedValue: any = {}; - for (const key in attrMap) { - if (key) { - transformedValue[key] = attrMap[key].toObject(); - } - } - return attrMap ? transformedValue : undefined; -} - -export function validateJsonPath(value: string) { - if (!value.startsWith('$')) { - throw new Error("Data JSON path values must either be exactly equal to '$' or start with '$.'"); - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts deleted file mode 100644 index fb628edf7a3bb..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts +++ /dev/null @@ -1,689 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { TaskInput } from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import * as awscli from '@aws-cdk/lambda-layer-awscli'; -import { Construct } from 'constructs'; -import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; - -/** - * The props for a EMR Containers StartJobRun Task. - */ -export interface EmrContainersStartJobRunProps extends sfn.TaskStateBaseProps { - /** - * The ID of the virtual cluster where the job will be run - */ - readonly virtualCluster: VirtualClusterInput; - - /** - * The name of the job run. - * - * @default - No job run name - */ - readonly jobName?: string; - - /** - * The execution role for the job run. - * - * If `virtualClusterId` is from a JSON input path, an execution role must be provided. - * If an execution role is provided, follow the documentation to update the role trust policy. - * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-trust-policy.html - * - * @default - Automatically generated only when the provided `virtualClusterId` is not an encoded JSON path - */ - readonly executionRole?: iam.IRole; - - /** - * The Amazon EMR release version to use for the job run. - */ - readonly releaseLabel: ReleaseLabel; - - /** - * The configurations for the application running in the job run. - * - * Maximum of 100 items - * - * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_Configuration.html - * - * @default - No application config - */ - readonly applicationConfig?: ApplicationConfiguration[]; - - /** - * The job driver for the job run. - * - * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_JobDriver.html - */ - readonly jobDriver: JobDriver; - - /** - * Configuration for monitoring the job run - * - * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_MonitoringConfiguration.html - * - * @default - logging enabled and resources automatically generated if `monitoring.logging` is set to `true` - */ - readonly monitoring?: Monitoring; - - /** - * The tags assigned to job runs. - * - * @default - None - */ - readonly tags?: { [key: string]: string }; -} - -/** - * Starts a job run. - * - * A job is a unit of work that you submit to Amazon EMR on EKS for execution. - * The work performed by the job can be defined by a Spark jar, PySpark script, or SparkSQL query. - * A job run is an execution of the job on the virtual cluster. - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr-eks.html - */ -export class EmrContainersStartJobRun extends sfn.TaskStateBase implements iam.IGrantable { - private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ - sfn.IntegrationPattern.REQUEST_RESPONSE, - sfn.IntegrationPattern.RUN_JOB, - ]; - - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - protected readonly taskPolicies?: iam.PolicyStatement[]; - - public readonly grantPrincipal: iam.IPrincipal; - private role: iam.IRole; - private readonly logGroup?: logs.ILogGroup; - private readonly logBucket?: s3.IBucket; - private readonly integrationPattern: sfn.IntegrationPattern; - - constructor(scope: Construct, id: string, private readonly props: EmrContainersStartJobRunProps) { - super(scope, id, props); - this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.RUN_JOB; - validatePatternSupported(this.integrationPattern, EmrContainersStartJobRun.SUPPORTED_INTEGRATION_PATTERNS); - - if (this.props.applicationConfig) { - this.validateAppConfig(this.props.applicationConfig); - } - - if (this.props.jobDriver.sparkSubmitJobDriver) { - this.validateSparkSubmitJobDriver(props.jobDriver.sparkSubmitJobDriver); - } - - if (this.props.executionRole === undefined - && sfn.JsonPath.isEncodedJsonPath(props.virtualCluster.id)) { - throw new Error('Execution role cannot be undefined when the virtual cluster ID is not a concrete value. Provide an execution role with the correct trust policy'); - } - - this.logGroup = this.assignLogGroup(); - this.logBucket = this.assignLogBucket(); - this.role = this.props.executionRole ?? this.createJobExecutionRole(); - this.grantPrincipal = this.role; - - this.grantMonitoringPolicies(); - - this.taskPolicies = this.createPolicyStatements(); - } - - /** - * @internal - */ - protected _renderTask(): any { - return { - Resource: integrationResourceArn('emr-containers', 'startJobRun', this.integrationPattern), - Parameters: sfn.FieldUtils.renderObject({ - VirtualClusterId: this.props.virtualCluster.id, - Name: this.props.jobName, - ExecutionRoleArn: this.role.roleArn, - ReleaseLabel: this.props.releaseLabel.label, - JobDriver: { - SparkSubmitJobDriver: { - EntryPoint: this.props.jobDriver.sparkSubmitJobDriver?.entryPoint.value, - EntryPointArguments: this.props.jobDriver.sparkSubmitJobDriver?.entryPointArguments?.value, - SparkSubmitParameters: this.props.jobDriver.sparkSubmitJobDriver?.sparkSubmitParameters, - }, - }, - ConfigurationOverrides: { - ApplicationConfiguration: cdk.listMapper(this.applicationConfigPropertyToJson)(this.props.applicationConfig), - MonitoringConfiguration: { - CloudWatchMonitoringConfiguration: this.logGroup ? { - LogGroupName: this.logGroup.logGroupName, - LogStreamNamePrefix: this.props.monitoring!.logStreamNamePrefix, - } : undefined, - PersistentAppUI: (this.props.monitoring?.persistentAppUI === false) - ? 'DISABLED' - : 'ENABLED', - S3MonitoringConfiguration: this.logBucket ? { - LogUri: this.logBucket.s3UrlForObject(), - } : undefined, - }, - }, - Tags: this.props.tags, - }), - }; - } - - /** - * Render the EMR Containers ConfigurationProperty as JSON - */ - private applicationConfigPropertyToJson = (property: ApplicationConfiguration) => { - return { - Classification: cdk.stringToCloudFormation(property.classification.classificationStatement), - Properties: property.properties ? cdk.objectToCloudFormation(property.properties) : undefined, - Configurations: property.nestedConfig ? cdk.listMapper(this.applicationConfigPropertyToJson)(property.nestedConfig) : undefined, - }; - } - - private validateAppConfigPropertiesLength(appConfig: ApplicationConfiguration) { - if (appConfig?.properties === undefined) { - return; - } else if (Object.keys(appConfig.properties).length > 100) { - throw new Error(`Application configuration properties must have 100 or fewer entries. Received ${Object.keys(appConfig.properties).length}`); - } - } - - private validatePropertiesNestedAppConfigBothNotUndefined(appConfig: ApplicationConfiguration) { - if (appConfig?.properties === undefined && appConfig?.nestedConfig === undefined) { - throw new Error('Application configuration must have either properties or nested app configurations defined.'); - } - } - - private validateAppConfig(config?: ApplicationConfiguration[]) { - if (config === undefined) { - return; - } else if (config.length > 100) { - throw new Error(`Application configuration array must have 100 or fewer entries. Received ${config.length}`); - } else { - config.forEach(element => this.validateAppConfig(element.nestedConfig)); - config.forEach(element => this.validateAppConfigPropertiesLength(element)); - config.forEach(element => this.validatePropertiesNestedAppConfigBothNotUndefined(element)); - } - } - - private isArrayOfStrings(value: any): boolean { - return Array.isArray(value) && value.every(item => typeof item === 'string'); - } - - private validateEntryPointArguments (entryPointArguments:sfn.TaskInput) { - if (typeof entryPointArguments.value === 'string') { - if (!sfn.JsonPath.isEncodedJsonPath(entryPointArguments.value)) { - throw new Error('Entry point arguments must be a string array or an encoded JSON path, but received a non JSON path string'); - } - } else if (!this.isArrayOfStrings(entryPointArguments.value)) { - throw new Error(`Entry point arguments must be a string array or an encoded JSON path but received ${typeof entryPointArguments.value}.`); - } - } - - private validateEntryPointArgumentsLength (entryPointArguments:sfn.TaskInput) { - if (this.isArrayOfStrings(entryPointArguments.value) - && (entryPointArguments.value.length > 10280 || entryPointArguments.value.length < 1)) { - throw new Error(`Entry point arguments must be a string array between 1 and 10280 in length. Received ${entryPointArguments.value.length}.`); - } - } - - private validateSparkSubmitParametersLength (sparkSubmitParameters : string) { - if (sparkSubmitParameters.length > 102400 || sparkSubmitParameters.length < 1) { - throw new Error(`Spark submit parameters must be between 1 and 102400 characters in length. Received ${sparkSubmitParameters.length}.`); - } - } - private validateEntryPoint (entryPoint: TaskInput) { - if (!sfn.JsonPath.isEncodedJsonPath(entryPoint.value) && (entryPoint.value.length > 256|| entryPoint.value.length < 1)) { - throw new Error(`Entry point must be between 1 and 256 characters in length. Received ${entryPoint.value.length}.`); - } - } - - private validateSparkSubmitJobDriver (driver:SparkSubmitJobDriver) { - this.validateEntryPoint(driver.entryPoint); - if (driver.entryPointArguments) { - this.validateEntryPointArguments(driver.entryPointArguments); - this.validateEntryPointArgumentsLength(driver.entryPointArguments); - } - if (driver.sparkSubmitParameters) { - this.validateSparkSubmitParametersLength(driver.sparkSubmitParameters); - } - } - - private assignLogGroup = () : any => { - if (this.props.monitoring?.logGroup) { - return (this.props.monitoring?.logGroup); - } else { - return (this.props.monitoring?.logging ? new logs.LogGroup(this, 'Monitoring Log Group') : undefined); - } - } - - private assignLogBucket = () : any => { - if (this.props.monitoring?.logBucket) { - return (this.props.monitoring?.logBucket); - } else { - return (this.props.monitoring?.logging ? new s3.Bucket(this, 'Monitoring Bucket') : undefined); - } - } - - // https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/creating-job-execution-role.html - private createJobExecutionRole(): iam.Role { - const jobExecutionRole = new iam.Role(this, 'Job-Execution-Role', { - assumedBy: new iam.CompositePrincipal( - new iam.ServicePrincipal('emr-containers.amazonaws.com'), - new iam.ServicePrincipal('states.amazonaws.com'), - ), - }); - - this.logBucket?.grantReadWrite(jobExecutionRole); - this.logGroup?.grantWrite(jobExecutionRole); - this.logGroup?.grant(jobExecutionRole, 'logs:DescribeLogStreams'); - - jobExecutionRole.addToPrincipalPolicy( - new iam.PolicyStatement({ - resources: [ - cdk.Stack.of(this).formatArn({ - service: 'logs', - resource: '*', - }), - ], - actions: [ - 'logs:DescribeLogGroups', - ], - }), - ); - - this.updateRoleTrustPolicy(jobExecutionRole); - - return jobExecutionRole; - } - private grantMonitoringPolicies() { - - this.logBucket?.grantReadWrite(this.role); - this.logGroup?.grantWrite(this.role); - this.logGroup?.grant(this.role, 'logs:DescribeLogStreams'); - - this.role.addToPrincipalPolicy( - new iam.PolicyStatement({ - resources: [ - cdk.Stack.of(this).formatArn({ - service: 'logs', - resource: '*', - }), - ], - actions: [ - 'logs:DescribeLogGroups', - ], - }), - ); - } - - /** - * If an execution role is not provided by user, the automatically generated job execution role must create a trust relationship - * between itself and the identity of the EMR managed service account in order to run jobs on the Kubernetes namespace. - * - * This cannot occur if the user provided virtualClusterId is within an encoded JSON path. - * - * The trust relationship can be created by updating the trust policy of the job execution role. - * - * @param role the automatically generated job execution role - */ - private updateRoleTrustPolicy(role: iam.Role) { - const eksClusterInfo = new cr.AwsCustomResource(this, 'GetEksClusterInfo', { - onCreate: { - service: 'EMRcontainers', - action: 'describeVirtualCluster', - parameters: { - id: this.props.virtualCluster.id, - }, - outputPaths: ['virtualCluster.containerProvider.info.eksInfo.namespace', 'virtualCluster.containerProvider.id'], - physicalResourceId: cr.PhysicalResourceId.of('id'), - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), - // APIs are available in 2.1055.0 - installLatestAwsSdk: false, - }); - /* We make use of custom resources to call update-roll-trust-policy as this command is only available through - * aws cli because this is only used during the initial setup and is not available through the sdk. - * https://awscli.amazonaws.com/v2/documentation/api/latest/reference/emr-containers/update-role-trust-policy.html - * Commands available through SDK: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EMRcontainers.html - * Commands available through CLI: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/emr-containers/index.html - */ - const cliLayer = new awscli.AwsCliLayer(this, 'awsclilayer'); - const shellCliLambda = new lambda.SingletonFunction(this, 'Call Update-Role-Trust-Policy', { - uuid: '8693BB64-9689-44B6-9AAF-B0CC9EB8757C', - runtime: lambda.Runtime.PYTHON_3_9, - handler: 'index.handler', - code: lambda.Code.fromAsset(path.join(__dirname, 'utils/role-policy')), - timeout: cdk.Duration.seconds(30), - memorySize: 256, - layers: [cliLayer], - }); - shellCliLambda.addToRolePolicy( - new iam.PolicyStatement({ - resources: [ - cdk.Stack.of(this).formatArn({ - service: 'eks', - resource: 'cluster', - resourceName: eksClusterInfo.getResponseField('virtualCluster.containerProvider.id'), - }), - ], - actions: [ - 'eks:DescribeCluster', - ], - }), - ); - shellCliLambda.addToRolePolicy( - new iam.PolicyStatement({ - resources: [role.roleArn], - actions: [ - 'iam:GetRole', - 'iam:UpdateAssumeRolePolicy', - ], - }), - ); - const provider = new cr.Provider(this, 'CustomResourceProvider', { - onEventHandler: shellCliLambda, - }); - new cdk.CustomResource(this, 'Custom Resource', { - properties: { - eksNamespace: eksClusterInfo.getResponseField('virtualCluster.containerProvider.info.eksInfo.namespace'), - eksClusterId: eksClusterInfo.getResponseField('virtualCluster.containerProvider.id'), - roleName: role.roleName, - }, - serviceToken: provider.serviceToken, - }); - } - - private createPolicyStatements(): iam.PolicyStatement[] { - const policyStatements = [ - new iam.PolicyStatement({ - resources: [ - cdk.Stack.of(this).formatArn({ - arnFormat: cdk.ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME, - service: 'emr-containers', - resource: 'virtualclusters', - resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.virtualCluster.id) ? '*' : this.props.virtualCluster.id, // Need wild card for dynamic start job run https://docs.aws.amazon.com/step-functions/latest/dg/emr-eks-iam.html - }), - ], - actions: ['emr-containers:StartJobRun'], - conditions: { - StringEquals: { - 'emr-containers:ExecutionRoleArn': this.role.roleArn, - }, - }, - }), - ]; - - if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { - policyStatements.push( - new iam.PolicyStatement({ - resources: [ - cdk.Stack.of(this).formatArn({ - arnFormat: cdk.ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME, - service: 'emr-containers', - resource: 'virtualclusters', - resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.virtualCluster.id) ? '*' : `${this.props.virtualCluster.id}/jobruns/*`, // Need wild card for dynamic start job run https://docs.aws.amazon.com/step-functions/latest/dg/emr-eks-iam.html - }), - ], - actions: [ - 'emr-containers:DescribeJobRun', - 'emr-containers:CancelJobRun', - ], - }), - ); - } - - return policyStatements; - } -} - -/** - * The information about job driver for Spark submit. - */ -export interface SparkSubmitJobDriver { - /** - * The entry point of job application. - * - * Length Constraints: Minimum length of 1. Maximum length of 256. - */ - readonly entryPoint: sfn.TaskInput; - - /** - * The arguments for a job application in a task input object containing an array of strings - * - * Length Constraints: Minimum length of 1. Maximum length of 10280. - * @type sfn.TaskInput which expects payload as an array of strings - * - * @default - No arguments defined - */ - readonly entryPointArguments?: sfn.TaskInput; - - /** - * The Spark submit parameters that are used for job runs. - * - * Length Constraints: Minimum length of 1. Maximum length of 102400. - * - * @default - No spark submit parameters - */ - readonly sparkSubmitParameters?: string; -} - -/** - * Specify the driver that the EMR Containers job runs on. - * The job driver is used to provide an input for the job that will be run. - */ -export interface JobDriver { - /** - * The job driver parameters specified for spark submit. - * - * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_SparkSubmitJobDriver.html - * - */ - readonly sparkSubmitJobDriver: SparkSubmitJobDriver; -} - -/** - * The classification within a EMR Containers application configuration. - * Class can be extended to add other classifications. - * For example, new Classification('xxx-yyy'); - */ -export class Classification { - /** - * Sets the maximizeResourceAllocation property to true or false. - * When true, Amazon EMR automatically configures spark-defaults properties based on cluster hardware configuration. - * - * For more info: - * @see https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-spark-configure.html#emr-spark-maximizeresourceallocation - */ - static readonly SPARK = new Classification('spark'); - - /** - * Sets values in the spark-defaults.conf file. - * - * For more info: - * @see https://spark.apache.org/docs/latest/configuration.html - */ - static readonly SPARK_DEFAULTS = new Classification('spark-defaults'); - - /** - * Sets values in the spark-env.sh file. - * - * For more info: - * @see https://spark.apache.org/docs/latest/configuration.html#environment-variables - */ - static readonly SPARK_ENV = new Classification('spark-env'); - - /** - * Sets values in the hive-site.xml for Spark. - */ - static readonly SPARK_HIVE_SITE = new Classification('spark-hive-site'); - - /** - * Sets values in the log4j.properties file. - * - * For more settings and info: - * @see https://github.com/apache/spark/blob/master/conf/log4j.properties.template - */ - static readonly SPARK_LOG4J = new Classification('spark-log4j'); - - /** - * Sets values in the metrics.properties file. - * - * For more settings and info: - * @see https://github.com/apache/spark/blob/master/conf/metrics.properties.template - */ - static readonly SPARK_METRICS = new Classification('spark-metrics'); - - /** - * Creates a new Classification - * - * @param classificationStatement A literal string in case a new EMR classification is released, if not already defined. - */ - constructor(public readonly classificationStatement: string) { } -} - -/** - * A configuration specification to be used when provisioning virtual clusters, - * which can include configurations for applications and software bundled with Amazon EMR on EKS. - * - * A configuration consists of a classification, properties, and optional nested configurations. - * A classification refers to an application-specific configuration file. - * Properties are the settings you want to change in that file. - * @see https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-configure-apps.html - */ -export interface ApplicationConfiguration { - /** - * The classification within a configuration. - * - * Length Constraints: Minimum length of 1. Maximum length of 1024. - */ - readonly classification: Classification; - - /** - * A list of additional configurations to apply within a configuration object. - * - * Array Members: Maximum number of 100 items. - * - * @default - No other configurations - */ - readonly nestedConfig?: ApplicationConfiguration[]; - - /** - * A set of properties specified within a configuration classification. - * - * Map Entries: Maximum number of 100 items. - * - * @default - No properties - */ - readonly properties?: { [key: string]: string }; -} - -/** - * Configuration setting for monitoring. - */ -export interface Monitoring { - /** - * Enable logging for this job. - * - * If set to true, will automatically create a Cloudwatch Log Group and S3 bucket. - * This will be set to `true` implicitly if values are provided for `logGroup` or `logBucket`. - * - * @default true - true if values are provided for `logGroup` or `logBucket`, false otherwise - */ - readonly logging?: boolean - - /** - * A log group for CloudWatch monitoring. - * - * You can configure your jobs to send log information to CloudWatch Logs. - * - * @default - if `logging` is manually set to `true` and a `logGroup` is not provided, a `logGroup` will be automatically generated`. - */ - readonly logGroup?: logs.ILogGroup; - - /** - * A log stream name prefix for Cloudwatch monitoring. - * - * @default - Log streams created in this log group have no default prefix - */ - readonly logStreamNamePrefix?: string; - - /** - * Amazon S3 Bucket for monitoring log publishing. - * - * You can configure your jobs to send log information to Amazon S3. - * - * @default - if `logging` is manually set to `true` and a `logBucket` is not provided, a `logBucket` will be automatically generated`. - */ - readonly logBucket?: s3.IBucket; - - /** - * Monitoring configurations for the persistent application UI. - * - * @default true - */ - readonly persistentAppUI?: boolean; -} - -/** - * The Amazon EMR release version to use for the job run. - * - * Can be extended to include new EMR releases - * - * For example, `new ReleaseLabel('emr-x.xx.x-latest');` - */ -export class ReleaseLabel { - /** - * EMR Release version 5.32.0 - */ - static readonly EMR_5_32_0 = new ReleaseLabel('emr-5.32.0-latest'); - - /** - * EMR Release version 5.33.0 - */ - static readonly EMR_5_33_0 = new ReleaseLabel('emr-5.33.0-latest'); - - /** - * EMR Release version 6.2.0 - */ - static readonly EMR_6_2_0 = new ReleaseLabel('emr-6.2.0-latest'); - - /** - * EMR Release version 6.3.0 - */ - static readonly EMR_6_3_0 = new ReleaseLabel('emr-6.3.0-latest'); - - /** - * Initializes the label string. - * - * @param label A literal string that contains the release-version ex. 'emr-x.x.x-latest' - */ - constructor(public readonly label: string) { } -} - -/** - * Class that returns a virtual cluster's id depending on input type - */ -export class VirtualClusterInput { - /** - * Input for a virtualClusterId from a Task Input - */ - static fromTaskInput(taskInput: sfn.TaskInput): VirtualClusterInput { - return new VirtualClusterInput(taskInput.value); - } - - /** - * Input for virtualClusterId from a literal string - */ - static fromVirtualClusterId(virtualClusterId: string): VirtualClusterInput { - return new VirtualClusterInput(virtualClusterId); - } - - /** - * Initializes the virtual cluster ID. - * - * @param id The VirtualCluster Id - */ - private constructor(public readonly id: string) { } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/glue/start-job-run.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/glue/start-job-run.ts deleted file mode 100644 index ffbeb42b857db..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/glue/start-job-run.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; - -/** - * Properties for starting an AWS Glue job as a task - */ -export interface GlueStartJobRunProps extends sfn.TaskStateBaseProps { - - /** - * Glue job name - */ - readonly glueJobName: string; - - /** - * The job arguments specifically for this run. - * - * For this job run, they replace the default arguments set in the job - * definition itself. - * - * @default - Default arguments set in the job definition - */ - readonly arguments?: sfn.TaskInput; - - /** - * The name of the SecurityConfiguration structure to be used with this job run. - * - * This must match the Glue API - * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-common.html#aws-glue-api-regex-oneLine - * - * @default - Default configuration set in the job definition - */ - readonly securityConfiguration?: string; - - /** - * After a job run starts, the number of minutes to wait before sending a job run delay notification. - * - * Must be at least 1 minute. - * - * @default - Default delay set in the job definition - */ - readonly notifyDelayAfter?: Duration; -} - -/** - * Starts an AWS Glue job in a Task state - * - * OUTPUT: the output of this task is a JobRun structure, for details consult - * https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html#aws-glue-api-jobs-runs-JobRun - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-glue.html - */ -export class GlueStartJobRun extends sfn.TaskStateBase { - private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ - sfn.IntegrationPattern.REQUEST_RESPONSE, - sfn.IntegrationPattern.RUN_JOB, - ]; - - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - protected readonly taskPolicies?: iam.PolicyStatement[]; - - private readonly integrationPattern: sfn.IntegrationPattern; - - constructor(scope: Construct, id: string, private readonly props: GlueStartJobRunProps) { - super(scope, id, props); - this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.REQUEST_RESPONSE; - - validatePatternSupported(this.integrationPattern, GlueStartJobRun.SUPPORTED_INTEGRATION_PATTERNS); - - this.taskPolicies = this.getPolicies(); - - this.taskMetrics = { - metricPrefixSingular: 'GlueJob', - metricPrefixPlural: 'GlueJobs', - metricDimensions: { GlueJobName: this.props.glueJobName }, - }; - } - - /** - * @internal - */ - protected _renderTask(): any { - const notificationProperty = this.props.notifyDelayAfter ? { NotifyDelayAfter: this.props.notifyDelayAfter.toMinutes() } : null; - - let timeout: number | undefined = undefined; - if (this.props.timeout) { - timeout = this.props.timeout.toMinutes(); - } else if (this.props.taskTimeout?.seconds) { - timeout = Duration.seconds(this.props.taskTimeout.seconds).toMinutes(); - } else if (this.props.taskTimeout?.path) { - timeout = sfn.JsonPath.numberAt(this.props.taskTimeout.path); - } - - return { - Resource: integrationResourceArn('glue', 'startJobRun', this.integrationPattern), - Parameters: sfn.FieldUtils.renderObject({ - JobName: this.props.glueJobName, - Arguments: this.props.arguments?.value, - Timeout: timeout, - SecurityConfiguration: this.props.securityConfiguration, - NotificationProperty: notificationProperty, - }), - TimeoutSeconds: undefined, - TimeoutSecondsPath: undefined, - }; - } - - private getPolicies(): iam.PolicyStatement[] { - let iamActions: string[] | undefined; - if (this.integrationPattern === sfn.IntegrationPattern.REQUEST_RESPONSE) { - iamActions = ['glue:StartJobRun']; - } else if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { - iamActions = [ - 'glue:StartJobRun', - 'glue:GetJobRun', - 'glue:GetJobRuns', - 'glue:BatchStopJobRun', - ]; - } - - return [new iam.PolicyStatement({ - resources: [ - Stack.of(this).formatArn({ - service: 'glue', - resource: 'job', - resourceName: this.props.glueJobName, - }), - ], - actions: iamActions, - })]; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/invoke-activity.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/invoke-activity.ts deleted file mode 100644 index ab88f4681910e..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/invoke-activity.ts +++ /dev/null @@ -1,40 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration } from '@aws-cdk/core'; - -/** - * Properties for FunctionTask - * @deprecated use `StepFunctionsInvokeActivity` and `StepFunctionsInvokeActivityProps`. - */ -export interface InvokeActivityProps { - /** - * Maximum time between heart beats - * - * If the time between heart beats takes longer than this, a 'Timeout' error is raised. - * - * @default No heart beat timeout - */ - readonly heartbeat?: Duration; -} - -/** - * A Step Functions Task to invoke an Activity worker. - * - * An Activity can be used directly as a Resource. - * - * @deprecated use `StepFunctionsInvokeActivity` - */ -export class InvokeActivity implements sfn.IStepFunctionsTask { - constructor(private readonly activity: sfn.IActivity, private readonly props: InvokeActivityProps = {}) { - } - - public bind(_task: sfn.Task): sfn.StepFunctionsTaskConfig { - return { - resourceArn: this.activity.activityArn, - metricDimensions: { ActivityArn: this.activity.activityArn }, - heartbeat: this.props.heartbeat, - // No IAM permissions necessary, execution role implicitly has Activity permissions. - metricPrefixSingular: 'Activity', - metricPrefixPlural: 'Activities', - }; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts deleted file mode 100644 index 460e0f53506e8..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts +++ /dev/null @@ -1,964 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { DockerImageAsset, DockerImageAssetProps } from '@aws-cdk/aws-ecr-assets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Size } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -/** - * Task to train a machine learning model using Amazon SageMaker - */ -export interface ISageMakerTask extends iam.IGrantable {} - -/** - * Specify the training algorithm and algorithm-specific metadata - */ -export interface AlgorithmSpecification { - - /** - * Name of the algorithm resource to use for the training job. - * This must be an algorithm resource that you created or subscribe to on AWS Marketplace. - * If you specify a value for this parameter, you can't specify a value for TrainingImage. - * - * @default - No algorithm is specified - */ - readonly algorithmName?: string; - - /** - * List of metric definition objects. Each object specifies the metric name and regular expressions used to parse algorithm logs. - * - * @default - No metrics - */ - readonly metricDefinitions?: MetricDefinition[]; - - /** - * Registry path of the Docker image that contains the training algorithm. - * - * @default - No Docker image is specified - */ - readonly trainingImage?: DockerImage; - - /** - * Input mode that the algorithm supports. - * - * @default 'File' mode - */ - readonly trainingInputMode?: InputMode; -} - -/** - * Describes the training, validation or test dataset and the Amazon S3 location where it is stored. - * - */ -export interface Channel { - - /** - * Name of the channel - */ - readonly channelName: string; - - /** - * Compression type if training data is compressed - * - * @default - None - */ - readonly compressionType?: CompressionType; - - /** - * The MIME type of the data. - * - * @default - None - */ - readonly contentType?: string; - - /** - * Location of the channel data. - */ - readonly dataSource: DataSource; - - /** - * Input mode to use for the data channel in a training job. - * - * @default - None - */ - readonly inputMode?: InputMode; - - /** - * Specify RecordIO as the value when input data is in raw format but the training algorithm requires the RecordIO format. - * In this case, Amazon SageMaker wraps each individual S3 object in a RecordIO record. - * If the input data is already in RecordIO format, you don't need to set this attribute. - * - * @default - None - */ - readonly recordWrapperType?: RecordWrapperType; - - /** - * Shuffle config option for input data in a channel. - * - * @default - None - */ - readonly shuffleConfig?: ShuffleConfig; -} - -/** - * Configuration for a shuffle option for input data in a channel. - * - */ -export interface ShuffleConfig { - /** - * Determines the shuffling order. - */ - readonly seed: number; -} - -/** - * Location of the channel data. - * - */ -export interface DataSource { - /** - * S3 location of the data source that is associated with a channel. - */ - readonly s3DataSource: S3DataSource; -} - -/** - * S3 location of the channel data. - * - * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_S3DataSource.html - * - */ -export interface S3DataSource { - /** - * List of one or more attribute names to use that are found in a specified augmented manifest file. - * - * @default - No attribute names - */ - readonly attributeNames?: string[]; - - /** - * S3 Data Distribution Type - * - * @default - None - */ - readonly s3DataDistributionType?: S3DataDistributionType; - - /** - * S3 Data Type - * - * @default S3_PREFIX - */ - readonly s3DataType?: S3DataType; - - /** - * S3 Uri - */ - readonly s3Location: S3Location; -} - -/** - * Configures the S3 bucket where SageMaker will save the result of model training - */ -export interface OutputDataConfig { - /** - * Optional KMS encryption key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption. - * - * @default - Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account - */ - readonly encryptionKey?: kms.IKey; - - /** - * Identifies the S3 path where you want Amazon SageMaker to store the model artifacts. - */ - readonly s3OutputLocation: S3Location; -} - -/** - * Specifies a limit to how long a model training job can run. - * When the job reaches the time limit, Amazon SageMaker ends the training job. - * - */ -export interface StoppingCondition { - /** - * The maximum length of time, in seconds, that the training or compilation job can run. - * - * @default - 1 hour - */ - readonly maxRuntime?: Duration; -} - -/** - * Specifies the resources, ML compute instances, and ML storage volumes to deploy for model training. - * - */ -export interface ResourceConfig { - - /** - * The number of ML compute instances to use. - * - * @default 1 instance. - */ - readonly instanceCount: number; - - /** - * ML compute instance type. - * - * To provide an instance type from the task input, supply an instance type in the following way - * where the value in the task input is an EC2 instance type prepended with "ml.": - * - * ```ts - * new ec2.InstanceType(sfn.JsonPath.stringAt('$.path.to.instanceType')); - * ``` - * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ResourceConfig.html#sagemaker-Type-ResourceConfig-InstanceType - * - * @default ec2.InstanceType(ec2.InstanceClass.M4, ec2.InstanceType.XLARGE) - */ - readonly instanceType: ec2.InstanceType; - - /** - * KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job. - * - * @default - Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account - */ - readonly volumeEncryptionKey?: kms.IKey; - - /** - * Size of the ML storage volume that you want to provision. - * - * @default 10 GB EBS volume. - */ - readonly volumeSize: Size; -} - -/** - * Specifies the VPC that you want your Amazon SageMaker training job to connect to. - * - */ -export interface VpcConfig { - /** - * VPC - */ - readonly vpc: ec2.IVpc; - - /** - * VPC subnets. - * - * @default - Private Subnets are selected - */ - readonly subnets?: ec2.SubnetSelection; -} - -/** - * Specifies the metric name and regular expressions used to parse algorithm logs. - * - */ -export interface MetricDefinition { - - /** - * Name of the metric. - */ - readonly name: string; - - /** - * Regular expression that searches the output of a training job and gets the value of the metric. - */ - readonly regex: string; -} - -/** - * Stores information about the location of an object in Amazon S3 - * - */ -export interface S3LocationConfig { - - /** - * Uniquely identifies the resource in Amazon S3 - */ - readonly uri: string; -} - -/** - * Constructs `IS3Location` objects. - * - */ -export abstract class S3Location { - /** - * An `IS3Location` built with a determined bucket and key prefix. - * - * @param bucket is the bucket where the objects are to be stored. - * @param keyPrefix is the key prefix used by the location. - */ - public static fromBucket(bucket: s3.IBucket, keyPrefix: string): S3Location { - return new StandardS3Location({ bucket, keyPrefix, uri: bucket.urlForObject(keyPrefix) }); - } - - /** - * An `IS3Location` determined fully by a JSON Path from the task input. - * - * Due to the dynamic nature of those locations, the IAM grants that will be set by `grantRead` and `grantWrite` - * apply to the `*` resource. - * - * @param expression the JSON expression resolving to an S3 location URI. - */ - public static fromJsonExpression(expression: string): S3Location { - return new StandardS3Location({ uri: sfn.JsonPath.stringAt(expression) }); - } - - /** - * Called when the S3Location is bound to a StepFunctions task. - */ - public abstract bind(task: ISageMakerTask, opts: S3LocationBindOptions): S3LocationConfig; -} - -/** - * Options for binding an S3 Location. - * - */ -export interface S3LocationBindOptions { - /** - * Allow reading from the S3 Location. - * - * @default false - */ - readonly forReading?: boolean; - - /** - * Allow writing to the S3 Location. - * - * @default false - */ - readonly forWriting?: boolean; -} - -/** - * Configuration for a using Docker image. - * - */ -export interface DockerImageConfig { - /** - * The fully qualified URI of the Docker image. - */ - readonly imageUri: string; -} - -/** - * Creates `IDockerImage` instances. - * - */ -export abstract class DockerImage { - /** - * Reference a Docker image stored in an ECR repository. - * - * @param repository the ECR repository where the image is hosted. - * @param tagOrDigest an optional tag or digest (digests must start with `sha256:`) - */ - public static fromEcrRepository(repository: ecr.IRepository, tagOrDigest: string = 'latest'): DockerImage { - return new StandardDockerImage({ repository, imageUri: repository.repositoryUriForTagOrDigest(tagOrDigest) }); - } - - /** - * Reference a Docker image which URI is obtained from the task's input. - * - * @param expression the JSON path expression with the task input. - * @param allowAnyEcrImagePull whether ECR access should be permitted (set to `false` if the image will never be in ECR). - */ - public static fromJsonExpression(expression: string, allowAnyEcrImagePull = true): DockerImage { - return new StandardDockerImage({ imageUri: expression, allowAnyEcrImagePull }); - } - - /** - * Reference a Docker image by it's URI. - * - * When referencing ECR images, prefer using `inEcr`. - * - * @param imageUri the URI to the docker image. - */ - public static fromRegistry(imageUri: string): DockerImage { - return new StandardDockerImage({ imageUri }); - } - - /** - * Reference a Docker image that is provided as an Asset in the current app. - * - * @param scope the scope in which to create the Asset. - * @param id the ID for the asset in the construct tree. - * @param props the configuration props of the asset. - */ - public static fromAsset(scope: Construct, id: string, props: DockerImageAssetProps): DockerImage { - const asset = new DockerImageAsset(scope, id, props); - return new StandardDockerImage({ repository: asset.repository, imageUri: asset.imageUri }); - } - - /** - * Called when the image is used by a SageMaker task. - */ - public abstract bind(task: ISageMakerTask): DockerImageConfig; -} - -/** - * S3 Data Type. - * - */ -export enum S3DataType { - /** - * Manifest File Data Type - */ - MANIFEST_FILE = 'ManifestFile', - - /** - * S3 Prefix Data Type - */ - S3_PREFIX = 'S3Prefix', - - /** - * Augmented Manifest File Data Type - */ - AUGMENTED_MANIFEST_FILE = 'AugmentedManifestFile' -} - -/** - * S3 Data Distribution Type. - * - */ -export enum S3DataDistributionType { - /** - * Fully replicated S3 Data Distribution Type - */ - FULLY_REPLICATED = 'FullyReplicated', - - /** - * Sharded By S3 Key Data Distribution Type - */ - SHARDED_BY_S3_KEY = 'ShardedByS3Key' -} - -/** - * Define the format of the input data. - * - */ -export enum RecordWrapperType { - /** - * None record wrapper type - */ - NONE = 'None', - - /** - * RecordIO record wrapper type - */ - RECORD_IO = 'RecordIO' -} - -/** - * Input mode that the algorithm supports. - * - */ -export enum InputMode { - /** - * Pipe mode - */ - PIPE = 'Pipe', - - /** - * File mode. - */ - FILE = 'File' -} - -/** - * Compression type of the data. - * - */ -export enum CompressionType { - /** - * None compression type - */ - NONE = 'None', - - /** - * Gzip compression type - */ - GZIP = 'Gzip' -} - -// -// Create Transform Job types -// - -/** - * Configures the timeout and maximum number of retries for processing a transform job invocation. - * - */ -export interface ModelClientOptions { - - /** - * The maximum number of retries when invocation requests are failing. - * - * @default 0 - */ - readonly invocationsMaxRetries?: number; - - /** - * The timeout duration for an invocation request. - * - * @default Duration.minutes(1) - */ - readonly invocationsTimeout?: Duration; -} - -/** - * Dataset to be transformed and the Amazon S3 location where it is stored. - * - */ -export interface TransformInput { - - /** - * The compression type of the transform data. - * - * @default NONE - */ - readonly compressionType?: CompressionType; - - /** - * Multipurpose internet mail extension (MIME) type of the data. - * - * @default - None - */ - readonly contentType?: string; - - /** - * S3 location of the channel data - */ - readonly transformDataSource: TransformDataSource; - - /** - * Method to use to split the transform job's data files into smaller batches. - * - * @default NONE - */ - readonly splitType?: SplitType; -} - -/** - * S3 location of the input data that the model can consume. - * - */ -export interface TransformDataSource { - - /** - * S3 location of the input data - */ - readonly s3DataSource: TransformS3DataSource; -} - -/** - * Location of the channel data. - * - */ -export interface TransformS3DataSource { - - /** - * S3 Data Type - * - * @default 'S3Prefix' - */ - readonly s3DataType?: S3DataType; - - /** - * Identifies either a key name prefix or a manifest. - */ - readonly s3Uri: string; -} - -/** - * S3 location where you want Amazon SageMaker to save the results from the transform job. - * - */ -export interface TransformOutput { - - /** - * MIME type used to specify the output data. - * - * @default - None - */ - readonly accept?: string; - - /** - * Defines how to assemble the results of the transform job as a single S3 object. - * - * @default - None - */ - readonly assembleWith?: AssembleWith; - - /** - * AWS KMS key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption. - * - * @default - default KMS key for Amazon S3 for your role's account. - */ - readonly encryptionKey?: kms.IKey; - - /** - * S3 path where you want Amazon SageMaker to store the results of the transform job. - */ - readonly s3OutputPath: string; -} - -/** - * ML compute instances for the transform job. - * - */ -export interface TransformResources { - - /** - * Number of ML compute instances to use in the transform job - */ - readonly instanceCount: number; - - /** - * ML compute instance type for the transform job. - */ - readonly instanceType: ec2.InstanceType; - - /** - * AWS KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s). - * - * @default - None - */ - readonly volumeEncryptionKey?: kms.IKey; -} - -/** - * Properties to define a ContainerDefinition - * - * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html - */ -export interface ContainerDefinitionOptions { - /** - * The Amazon EC2 Container Registry (Amazon ECR) path where inference code is stored. - * - * @default - None - */ - readonly image?: DockerImage; - /** - * The environment variables to set in the Docker container - * - * @default - No variables - */ - readonly environmentVariables?: sfn.TaskInput; - /** - * The name or Amazon Resource Name (ARN) of the model package to use to create the model. - * - * @default - None - */ - readonly modelPackageName?: string; - /** - * Defines how many models the container hosts - * - * @default - Mode.SINGLE_MODEL - */ - readonly mode?: Mode; - /** - * This parameter is ignored for models that contain only a PrimaryContainer. - * When a ContainerDefinition is part of an inference pipeline, - * the value of the parameter uniquely identifies the container for the purposes of logging and metrics. - * - * @default - None - */ - readonly containerHostName?: string; - /** - * The S3 path where the model artifacts, which result from model training, are stored. - * This path must point to a single gzip compressed tar archive (.tar.gz suffix). - * The S3 path is required for Amazon SageMaker built-in algorithms, but not if you use your own algorithms. - * - * @default - None - */ - readonly modelS3Location?: S3Location; -} - -/** - * Describes the container, as part of model definition. - * - * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html - */ -export class ContainerDefinition implements IContainerDefinition { - - constructor(private readonly options: ContainerDefinitionOptions) {} - - /** - * Called when the ContainerDefinition type configured on Sagemaker Task - */ - public bind(task: ISageMakerTask): ContainerDefinitionConfig { - return { - parameters: { - ContainerHostname: this.options.containerHostName, - Image: this.options.image?.bind(task).imageUri, - Mode: this.options.mode, - ModelDataUrl: this.options.modelS3Location?.bind(task, { forReading: true }).uri, - ModelPackageName: this.options.modelPackageName, - Environment: this.options.environmentVariables?.value, - }, - }; - } -} - -/** - * Configuration of the container used to host the model - * - * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html - */ -export interface IContainerDefinition { - /** - * Called when the ContainerDefinition is used by a SageMaker task. - */ - bind(task: ISageMakerTask): ContainerDefinitionConfig; -} - -/** - * Configuration options for the ContainerDefinition - */ -export interface ContainerDefinitionConfig { - /** - * Additional parameters to pass to the base task - * - * @default - No additional parameters passed - */ - readonly parameters?: { [key: string]: any }; -} - -/** - * Specifies how many models the container hosts - * - */ -export enum Mode { - /** - * Container hosts a single model - */ - SINGLE_MODEL = 'SingleModel', - /** - * Container hosts multiple models - * - * @see https://docs.aws.amazon.com/sagemaker/latest/dg/multi-model-endpoints.html - */ - MULTI_MODEL = 'MultiModel', -} - -/** - * Identifies a model that you want to host and the resources to deploy for hosting it. - * - * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ProductionVariant.html - */ -export interface ProductionVariant { - /** - * The size of the Elastic Inference (EI) instance to use for the production variant. - * - * @default - None - */ - readonly acceleratorType?: AcceleratorType; - /** - * Number of instances to launch initially. - * - * @default - 1 - */ - readonly initialInstanceCount?: number; - /** - * Determines initial traffic distribution among all of the models that you specify in the endpoint configuration. - * - * @default - 1.0 - */ - readonly initialVariantWeight?: number; - /** - * The ML compute instance type - */ - readonly instanceType: ec2.InstanceType; - /** - * The name of the production variant. - */ - readonly variantName: string; - /** - * The name of the model that you want to host. This is the name that you specified when creating the model. - */ - readonly modelName: string; -} - -/** - * The generation of Elastic Inference (EI) instance - * - * @see https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html - */ -export class AcceleratorClass { - /** - * Elastic Inference accelerator 1st generation - */ - public static readonly EIA1 = AcceleratorClass.of('eia1'); - /** - * Elastic Inference accelerator 2nd generation - */ - public static readonly EIA2 = AcceleratorClass.of('eia2'); - /** - * Custom AcceleratorType - * @param version - Elastic Inference accelerator generation - */ - public static of(version: string) { return new AcceleratorClass(version); } - /** - * @param version - Elastic Inference accelerator generation - */ - private constructor(public readonly version: string) { } -} - -/** - * The size of the Elastic Inference (EI) instance to use for the production variant. - * EI instances provide on-demand GPU computing for inference - * - * @see https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html - */ -export class AcceleratorType { - /** - * AcceleratorType - * - * This class takes a combination of a class and size. - */ - public static of(acceleratorClass: AcceleratorClass, instanceSize: ec2.InstanceSize) { - return new AcceleratorType(`ml.${acceleratorClass}.${instanceSize}`); - } - - constructor(private readonly instanceTypeIdentifier: string) { - } - - /** - * Return the accelerator type as a dotted string - */ - public toString(): string { - return this.instanceTypeIdentifier; - } -} - -/** - * Specifies the number of records to include in a mini-batch for an HTTP inference request. - * - */ -export enum BatchStrategy { - - /** - * Fits multiple records in a mini-batch. - */ - MULTI_RECORD = 'MultiRecord', - - /** - * Use a single record when making an invocation request. - */ - SINGLE_RECORD = 'SingleRecord' -} - -/** - * Method to use to split the transform job's data files into smaller batches. - * - */ -export enum SplitType { - - /** - * Input data files are not split, - */ - NONE = 'None', - - /** - * Split records on a newline character boundary. - */ - LINE = 'Line', - - /** - * Split using MXNet RecordIO format. - */ - RECORD_IO = 'RecordIO', - - /** - * Split using TensorFlow TFRecord format. - */ - TF_RECORD = 'TFRecord' -} - -/** - * How to assemble the results of the transform job as a single S3 object. - * - */ -export enum AssembleWith { - - /** - * Concatenate the results in binary format. - */ - NONE = 'None', - - /** - * Add a newline character at the end of every transformed record. - */ - LINE = 'Line' - -} - -class StandardDockerImage extends DockerImage { - private readonly allowAnyEcrImagePull: boolean; - private readonly imageUri: string; - private readonly repository?: ecr.IRepository; - - constructor(opts: { allowAnyEcrImagePull?: boolean, imageUri: string, repository?: ecr.IRepository }) { - super(); - - this.allowAnyEcrImagePull = !!opts.allowAnyEcrImagePull; - this.imageUri = opts.imageUri; - this.repository = opts.repository; - } - - public bind(task: ISageMakerTask): DockerImageConfig { - if (this.repository) { - this.repository.grantPull(task); - } - if (this.allowAnyEcrImagePull) { - task.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ - actions: [ - 'ecr:BatchCheckLayerAvailability', - 'ecr:GetDownloadUrlForLayer', - 'ecr:BatchGetImage', - ], - resources: ['*'], - })); - } - return { - imageUri: this.imageUri, - }; - } -} - -class StandardS3Location extends S3Location { - private readonly bucket?: s3.IBucket; - private readonly keyGlob: string; - private readonly uri: string; - - constructor(opts: { bucket?: s3.IBucket, keyPrefix?: string, uri: string }) { - super(); - this.bucket = opts.bucket; - this.keyGlob = `${opts.keyPrefix || ''}*`; - this.uri = opts.uri; - } - - public bind(task: ISageMakerTask, opts: S3LocationBindOptions): S3LocationConfig { - if (this.bucket) { - if (opts.forReading) { - this.bucket.grantRead(task, this.keyGlob); - } - if (opts.forWriting) { - this.bucket.grantWrite(task, this.keyGlob); - } - } else { - const actions = new Array(); - if (opts.forReading) { - actions.push('s3:GetObject', 's3:ListBucket'); - } - if (opts.forWriting) { - actions.push('s3:PutObject'); - } - task.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ actions, resources: ['*'] })); - } - return { uri: this.uri }; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/start-execution.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/start-execution.ts deleted file mode 100644 index d7d5ebdbda79a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/start-execution.ts +++ /dev/null @@ -1,123 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { ArnFormat, Stack } from '@aws-cdk/core'; -import { getResourceArn } from './resource-arn-suffix'; - -/** - * Properties for StartExecution - * - * @deprecated - use 'StepFunctionsStartExecution' - */ -export interface StartExecutionProps { - /** - * The JSON input for the execution, same as that of StartExecution. - * - * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html - * - * @default - No input - */ - readonly input?: { [key: string]: any }; - - /** - * The name of the execution, same as that of StartExecution. - * - * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html - * - * @default - None - */ - readonly name?: string; - - /** - * The service integration pattern indicates different ways to call StartExecution to Step Functions. - * - * @default FIRE_AND_FORGET - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html - */ - readonly integrationPattern?: sfn.ServiceIntegrationPattern; -} - -/** - * A Step Functions Task to call StartExecution on another state machine. - * - * It supports three service integration patterns: FIRE_AND_FORGET, SYNC and WAIT_FOR_TASK_TOKEN. - * - * @deprecated - use 'StepFunctionsStartExecution' - */ -export class StartExecution implements sfn.IStepFunctionsTask { - private readonly integrationPattern: sfn.ServiceIntegrationPattern; - - constructor(private readonly stateMachine: sfn.IStateMachine, private readonly props: StartExecutionProps = {}) { - this.integrationPattern = props.integrationPattern || sfn.ServiceIntegrationPattern.FIRE_AND_FORGET; - - const supportedPatterns = [ - sfn.ServiceIntegrationPattern.FIRE_AND_FORGET, - sfn.ServiceIntegrationPattern.SYNC, - sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, - ]; - - if (!supportedPatterns.includes(this.integrationPattern)) { - throw new Error(`Invalid Service Integration Pattern: ${this.integrationPattern} is not supported to call Step Functions.`); - } - - if (this.integrationPattern === sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN - && !sfn.FieldUtils.containsTaskToken(props.input)) { - throw new Error('Task Token is missing in input (pass JsonPath.taskToken somewhere in input)'); - } - } - - public bind(task: sfn.Task): sfn.StepFunctionsTaskConfig { - return { - resourceArn: getResourceArn('states', 'startExecution', this.integrationPattern), - policyStatements: this.createScopedAccessPolicy(task), - parameters: { - Input: this.props.input, - StateMachineArn: this.stateMachine.stateMachineArn, - Name: this.props.name, - }, - }; - } - - /** - * As StateMachineArn is extracted automatically from the state machine object included in the constructor, - * - * the scoped access policy should be generated accordingly. - * - * This means the action of StartExecution should be restricted on the given state machine, instead of being granted to all the resources (*). - */ - private createScopedAccessPolicy(task: sfn.Task): iam.PolicyStatement[] { - const stack = Stack.of(task); - - const policyStatements = [ - new iam.PolicyStatement({ - actions: ['states:StartExecution'], - resources: [this.stateMachine.stateMachineArn], - }), - ]; - - // Step Functions use Cloud Watch managed rules to deal with synchronous tasks. - if (this.integrationPattern === sfn.ServiceIntegrationPattern.SYNC) { - policyStatements.push(new iam.PolicyStatement({ - actions: ['states:DescribeExecution', 'states:StopExecution'], - // https://docs.aws.amazon.com/step-functions/latest/dg/concept-create-iam-advanced.html#concept-create-iam-advanced-execution - resources: [stack.formatArn({ - service: 'states', - resource: 'execution', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - resourceName: `${stack.splitArn(this.stateMachine.stateMachineArn, ArnFormat.COLON_RESOURCE_NAME).resourceName}*`, - })], - })); - - policyStatements.push(new iam.PolicyStatement({ - actions: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], - resources: [stack.formatArn({ - service: 'events', - resource: 'rule', - resourceName: 'StepFunctionsGetEventsForStepFunctionsExecutionRule', - })], - })); - } - - return policyStatements; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/stepfunctions/invoke-activity.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/stepfunctions/invoke-activity.ts deleted file mode 100644 index a3d123bf04bc7..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/stepfunctions/invoke-activity.ts +++ /dev/null @@ -1,54 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Construct } from 'constructs'; - -/** - * Properties for invoking an Activity worker - */ -export interface StepFunctionsInvokeActivityProps extends sfn.TaskStateBaseProps { - - /** - * Step Functions Activity to invoke - */ - readonly activity: sfn.IActivity - - /** - * Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input. - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters - * - * @default No parameters - */ - readonly parameters?: { [name: string]: any }; -} - -/** - * A Step Functions Task to invoke an Activity worker. - * - * An Activity can be used directly as a Resource. - */ -export class StepFunctionsInvokeActivity extends sfn.TaskStateBase { - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - // No IAM permissions necessary, execution role implicitly has Activity permissions. - protected readonly taskPolicies?: iam.PolicyStatement[]; - - constructor(scope: Construct, id: string, private readonly props: StepFunctionsInvokeActivityProps) { - super(scope, id, props); - - this.taskMetrics = { - metricDimensions: { ActivityArn: this.props.activity.activityArn }, - metricPrefixSingular: 'Activity', - metricPrefixPlural: 'Activities', - }; - } - - /** - * @internal - */ - protected _renderTask(): any { - return { - Resource: this.props.activity.activityArn, - Parameters: this.props.parameters ? sfn.FieldUtils.renderObject(this.props.parameters) : undefined, - }; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/stepfunctions/start-execution.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/stepfunctions/start-execution.ts deleted file mode 100644 index 0916dbb720913..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/stepfunctions/start-execution.ts +++ /dev/null @@ -1,159 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { ArnFormat, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; - -/** - * Properties for StartExecution - */ -export interface StepFunctionsStartExecutionProps extends sfn.TaskStateBaseProps { - /** - * The Step Functions state machine to start the execution on. - */ - readonly stateMachine: sfn.IStateMachine; - - /** - * The JSON input for the execution, same as that of StartExecution. - * - * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html - * - * @default - The state input (JSON path '$') - */ - readonly input?: sfn.TaskInput; - - /** - * The name of the execution, same as that of StartExecution. - * - * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html - * - * @default - None - */ - readonly name?: string; - - /** - * Pass the execution ID from the context object to the execution input. - * This allows the Step Functions UI to link child executions from parent executions, making it easier to trace execution flow across state machines. - * - * If you set this property to `true`, the `input` property must be an object (provided by `sfn.TaskInput.fromObject`) or omitted entirely. - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-nested-workflows.html#nested-execution-startid - * - * @default - false - */ - readonly associateWithParent?: boolean; -} - -/** - * A Step Functions Task to call StartExecution on another state machine. - * - * It supports three service integration patterns: REQUEST_RESPONSE, RUN_JOB, and WAIT_FOR_TASK_TOKEN. - */ -export class StepFunctionsStartExecution extends sfn.TaskStateBase { - private static readonly SUPPORTED_INTEGRATION_PATTERNS = [ - sfn.IntegrationPattern.REQUEST_RESPONSE, - sfn.IntegrationPattern.RUN_JOB, - sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - ]; - - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - protected readonly taskPolicies?: iam.PolicyStatement[]; - - private readonly integrationPattern: sfn.IntegrationPattern; - - constructor(scope: Construct, id: string, private readonly props: StepFunctionsStartExecutionProps) { - super(scope, id, props); - - this.integrationPattern = props.integrationPattern || sfn.IntegrationPattern.REQUEST_RESPONSE; - validatePatternSupported(this.integrationPattern, StepFunctionsStartExecution.SUPPORTED_INTEGRATION_PATTERNS); - - if (this.integrationPattern === sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN && !sfn.FieldUtils.containsTaskToken(props.input)) { - throw new Error('Task Token is required in `input` for callback. Use JsonPath.taskToken to set the token.'); - } - - if (this.props.associateWithParent && props.input && props.input.type !== sfn.InputType.OBJECT) { - throw new Error('Could not enable `associateWithParent` because `input` is taken directly from a JSON path. Use `sfn.TaskInput.fromObject` instead.'); - } - - this.taskPolicies = this.createScopedAccessPolicy(); - } - - /** - * @internal - */ - protected _renderTask(): any { - // suffix of ':2' indicates that the output of the nested state machine should be JSON - // suffix is only applicable when waiting for a nested state machine to complete (RUN_JOB) - // https://docs.aws.amazon.com/step-functions/latest/dg/connect-stepfunctions.html - const suffix = this.integrationPattern === sfn.IntegrationPattern.RUN_JOB ? ':2' : ''; - let input: any; - if (this.props.associateWithParent) { - const associateWithParentEntry = { - AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID: sfn.JsonPath.stringAt('$$.Execution.Id'), - }; - input = this.props.input ? { ...this.props.input.value, ...associateWithParentEntry } : associateWithParentEntry; - } else { - input = this.props.input ? this.props.input.value: sfn.TaskInput.fromJsonPathAt('$').value; - } - - return { - Resource: `${integrationResourceArn('states', 'startExecution', this.integrationPattern)}${suffix}`, - Parameters: sfn.FieldUtils.renderObject({ - Input: input, - StateMachineArn: this.props.stateMachine.stateMachineArn, - Name: this.props.name, - }), - }; - } - - /** - * As StateMachineArn is extracted automatically from the state machine object included in the constructor, - * - * the scoped access policy should be generated accordingly. - * - * This means the action of StartExecution should be restricted on the given state machine, instead of being granted to all the resources (*). - */ - private createScopedAccessPolicy(): iam.PolicyStatement[] { - const stack = Stack.of(this); - - const policyStatements = [ - new iam.PolicyStatement({ - actions: ['states:StartExecution'], - resources: [this.props.stateMachine.stateMachineArn], - }), - ]; - - // Step Functions use Cloud Watch managed rules to deal with synchronous tasks. - if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { - policyStatements.push( - new iam.PolicyStatement({ - actions: ['states:DescribeExecution', 'states:StopExecution'], - // https://docs.aws.amazon.com/step-functions/latest/dg/concept-create-iam-advanced.html#concept-create-iam-advanced-execution - resources: [ - stack.formatArn({ - service: 'states', - resource: 'execution', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - resourceName: `${stack.splitArn(this.props.stateMachine.stateMachineArn, ArnFormat.COLON_RESOURCE_NAME).resourceName}*`, - }), - ], - }), - ); - - policyStatements.push( - new iam.PolicyStatement({ - actions: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], - resources: [ - stack.formatArn({ - service: 'events', - resource: 'rule', - resourceName: 'StepFunctionsGetEventsForStepFunctionsExecutionRule', - }), - ], - }), - ); - } - - return policyStatements; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json deleted file mode 100644 index 8864ffe252dca..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "name": "@aws-cdk/aws-stepfunctions-tasks", - "version": "0.0.0", - "private": true, - "description": "Task integrations for AWS StepFunctions", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.stepfunctions.tasks", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "stepfunctions-tasks" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.StepFunctions.Tasks", - "packageId": "Amazon.CDK.AWS.StepFunctions.Tasks", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-stepfunctions-tasks", - "module": "aws_cdk.aws_stepfunctions_tasks", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-stepfunctions-tasks" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "awslint": { - "exclude": [ - "props-no-arn-refs:@aws-cdk/aws-stepfunctions-tasks.BatchSubmitJobProps.jobDefinitionArn", - "props-no-arn-refs:@aws-cdk/aws-stepfunctions-tasks.BatchSubmitJobProps.jobQueueArn" - ] - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "stepfunctions", - "stepfunctions-tasks" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-batch": "0.0.0", - "@aws-cdk/aws-databrew": "0.0.0", - "@aws-cdk/aws-glue": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "^0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-eks": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/cx-api": "^0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-eks": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-stepfunctions-tasks/rosetta/default.ts-fixture deleted file mode 100644 index 927b8e5fd6886..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/rosetta/default.ts-fixture +++ /dev/null @@ -1,21 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Duration, RemovalPolicy, Size, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as tasks from '@aws-cdk/aws-stepfunctions-tasks'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-http-api.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-http-api.test.ts deleted file mode 100644 index 2eb7846574e38..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-http-api.test.ts +++ /dev/null @@ -1,204 +0,0 @@ -import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { HttpMethod, CallApiGatewayHttpApiEndpoint } from '../../lib'; - -describe('CallApiGatewayHttpApiEndpoint', () => { - test('default', () => { - // GIVEN - const stack = new cdk.Stack(); - const httpApi = new apigatewayv2.HttpApi(stack, 'HttpApi'); - - // WHEN - const task = new CallApiGatewayHttpApiEndpoint(stack, 'Call', { - apiId: httpApi.apiId, - apiStack: cdk.Stack.of(httpApi), - method: HttpMethod.GET, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - End: true, - Parameters: { - ApiEndpoint: { - 'Fn::Join': [ - '', - [ - { - Ref: 'HttpApiF5A9A8A7', - }, - '.execute-api.', - { - Ref: 'AWS::Region', - }, - '.', - { - Ref: 'AWS::URLSuffix', - }, - ], - ], - }, - AuthType: 'NO_AUTH', - Method: 'GET', - }, - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::apigateway:invoke', - ], - ], - }, - }); - }); - - test('wait for task token', () => { - // GIVEN - const stack = new cdk.Stack(); - const httpApi = new apigatewayv2.HttpApi(stack, 'HttpApi'); - - // WHEN - const task = new CallApiGatewayHttpApiEndpoint(stack, 'Call', { - apiId: httpApi.apiId, - apiStack: cdk.Stack.of(httpApi), - method: HttpMethod.GET, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - headers: sfn.TaskInput.fromObject({ TaskToken: sfn.JsonPath.taskToken }), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - End: true, - Parameters: { - ApiEndpoint: { - 'Fn::Join': [ - '', - [ - { - Ref: 'HttpApiF5A9A8A7', - }, - '.execute-api.', - { - Ref: 'AWS::Region', - }, - '.', - { - Ref: 'AWS::URLSuffix', - }, - ], - ], - }, - AuthType: 'NO_AUTH', - Headers: { - 'TaskToken.$': '$$.Task.Token', - }, - Method: 'GET', - }, - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::apigateway:invoke.waitForTaskToken', - ], - ], - }, - }); - }); - - test('wait for task token - missing token', () => { - // GIVEN - const stack = new cdk.Stack(); - const httpApi = new apigatewayv2.HttpApi(stack, 'HttpApi'); - - // THEN - expect(() => { - new CallApiGatewayHttpApiEndpoint(stack, 'Call', { - apiId: httpApi.apiId, - apiStack: cdk.Stack.of(httpApi), - method: HttpMethod.GET, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - }); - }).toThrow(/Task Token is required in `headers` for WAIT_FOR_TASK_TOKEN pattern. Use JsonPath.taskToken to set the token./); - }); - - test('unsupported integration pattern - RUN_JOB', () => { - // GIVEN - const stack = new cdk.Stack(); - const httpApi = new apigatewayv2.HttpApi(stack, 'HttpApi'); - - // THEN - expect(() => { - new CallApiGatewayHttpApiEndpoint(stack, 'Call', { - apiId: httpApi.apiId, - apiStack: cdk.Stack.of(httpApi), - method: HttpMethod.GET, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - }); - }).toThrow(/Unsupported service integration pattern./); - }); - - test('render Stage field', () => { - // GIVEN - const stack = new cdk.Stack(); - const httpApi = new apigatewayv2.HttpApi(stack, 'HttpApi'); - - // WHEN - const task = new CallApiGatewayHttpApiEndpoint(stack, 'Call', { - apiId: httpApi.apiId, - apiStack: cdk.Stack.of(httpApi), - method: HttpMethod.GET, - stageName: 'stage', - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - End: true, - Parameters: { - ApiEndpoint: { - 'Fn::Join': [ - '', - [ - { - Ref: 'HttpApiF5A9A8A7', - }, - '.execute-api.', - { - Ref: 'AWS::Region', - }, - '.', - { - Ref: 'AWS::URLSuffix', - }, - ], - ], - }, - AuthType: 'NO_AUTH', - Method: 'GET', - Stage: 'stage', - }, - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::apigateway:invoke', - ], - ], - }, - }); - }); -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.ts deleted file mode 100644 index 0dd2837e82e3f..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/integ.call-http-api.ts +++ /dev/null @@ -1,47 +0,0 @@ -import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; -import * as integrations from '@aws-cdk/aws-apigatewayv2-integrations'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { AuthType, HttpMethod, CallApiGatewayHttpApiEndpoint } from '../../lib'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --state-machine-arn : should return execution arn - * - * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED - * * aws stepfunctions describe-execution --execution-arn --query 'output': should return the string \"hello, world!\" - */ - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'CallHttpApiInteg'); -const httpApi = new apigatewayv2.HttpApi(stack, 'MyHttpApi'); - -const handler = new lambda.Function(stack, 'HelloHandler', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: new lambda.InlineCode('exports.handler = async function(event, context) { return { statusCode: 200, body: "hello, world!" }; };'), -}); -httpApi.addRoutes({ - path: '/', - integration: new integrations.HttpLambdaIntegration('DefaultIntegration', handler), -}); - -const callEndpointJob = new CallApiGatewayHttpApiEndpoint(stack, 'Call APIGW', { - apiId: httpApi.apiId, - apiStack: cdk.Stack.of(httpApi), - method: HttpMethod.GET, - authType: AuthType.IAM_ROLE, - outputPath: sfn.JsonPath.stringAt('$.ResponseBody'), -}); - -const chain = sfn.Chain.start(callEndpointJob); - -const sm = new sfn.StateMachine(stack, 'StateMachine', { - definition: chain, - timeout: cdk.Duration.seconds(30), -}); - -new cdk.CfnOutput(stack, 'stateMachineArn', { - value: sm.stateMachineArn, -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/index.py b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/index.py deleted file mode 100644 index 337ed86e5f2ec..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/index.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/python -import os -import pprint - -print('Hello from Batch!') -pprint.pprint(dict(os.environ)) diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json deleted file mode 100644 index 9d330591267cf..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "30.0.0", - "files": { - "911fd19ef0dac006ce95e5e937e911a5000341b539da65d789b20d398b5b0750": { - "source": { - "path": "aws-stepfunctions-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "911fd19ef0dac006ce95e5e937e911a5000341b539da65d789b20d398b5b0750.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": { - "8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b": { - "source": { - "directory": "asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b" - }, - "destinations": { - "current_account-current_region": { - "repositoryName": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}", - "imageTag": "8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json deleted file mode 100644 index f9d511dd31f5b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/aws-stepfunctions-integ.template.json +++ /dev/null @@ -1,884 +0,0 @@ -{ - "Resources": { - "vpcA2121C38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "vpcPublicSubnet1Subnet2E65531E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "vpcPublicSubnet1RouteTable48A2DF9B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "vpcPublicSubnet1RouteTableAssociation5D3F4579": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "SubnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - } - } - }, - "vpcPublicSubnet1DefaultRoute10708846": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcPublicSubnet1EIPDA49DCBE": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "vpcPublicSubnet1NATGateway9C16659E": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - }, - "AllocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet1EIPDA49DCBE", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1RouteTableAssociation5D3F4579" - ] - }, - "vpcPublicSubnet2Subnet009B674F": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.64.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "vpcPublicSubnet2RouteTableEB40D4CB": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "vpcPublicSubnet2RouteTableAssociation21F81B59": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "SubnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - } - } - }, - "vpcPublicSubnet2DefaultRouteA1EC0F60": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcPublicSubnet2EIP9B3743B1": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "vpcPublicSubnet2NATGateway9B8AE11A": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - }, - "AllocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet2EIP9B3743B1", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2RouteTableAssociation21F81B59" - ] - }, - "vpcPrivateSubnet1Subnet934893E8": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.128.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "vpcPrivateSubnet1RouteTableB41A48CC": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "vpcPrivateSubnet1RouteTableAssociation67945127": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "SubnetId": { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - } - } - }, - "vpcPrivateSubnet1DefaultRoute1AA8E2E5": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "vpcPublicSubnet1NATGateway9C16659E" - } - } - }, - "vpcPrivateSubnet2Subnet7031C2BA": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.192.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "vpcPrivateSubnet2RouteTable7280F23E": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "vpcPrivateSubnet2RouteTableAssociation007E94D3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "SubnetId": { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - } - }, - "vpcPrivateSubnet2DefaultRouteB0E07F99": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "vpcPublicSubnet2NATGateway9B8AE11A" - } - } - }, - "vpcIGWE57CBDCA": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "vpcVPCGW7984C166": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "InternetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "ComputeEnvResourceSecurityGroupB84CF86B": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "vpcA2121C38" - } - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnvEcsInstanceRoleCFB290F9": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ec2.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role" - ] - ] - } - ] - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnvInstanceProfile81AFCCF2": { - "Type": "AWS::IAM::InstanceProfile", - "Properties": { - "Roles": [ - { - "Ref": "ComputeEnvEcsInstanceRoleCFB290F9" - } - ] - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnvResourceServiceInstanceRoleCF89E9E1": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "batch.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSBatchServiceRole" - ] - ] - } - ] - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnv2C40ACC2": { - "Type": "AWS::Batch::ComputeEnvironment", - "Properties": { - "Type": "MANAGED", - "ComputeResources": { - "AllocationStrategy": "BEST_FIT", - "InstanceRole": { - "Fn::GetAtt": [ - "ComputeEnvInstanceProfile81AFCCF2", - "Arn" - ] - }, - "InstanceTypes": [ - "optimal" - ], - "MaxvCpus": 256, - "MinvCpus": 0, - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "ComputeEnvResourceSecurityGroupB84CF86B", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - }, - { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - ], - "Type": "EC2" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "ComputeEnvResourceServiceInstanceRoleCF89E9E1", - "Arn" - ] - }, - "State": "ENABLED" - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "JobQueueEE3AD499": { - "Type": "AWS::Batch::JobQueue", - "Properties": { - "ComputeEnvironmentOrder": [ - { - "ComputeEnvironment": { - "Ref": "ComputeEnv2C40ACC2" - }, - "Order": 1 - } - ], - "Priority": 1, - "State": "ENABLED" - } - }, - "JobDefinition24FFE3ED": { - "Type": "AWS::Batch::JobDefinition", - "Properties": { - "Type": "container", - "ContainerProperties": { - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "AWS_ACCOUNT", - "Value": { - "Ref": "AWS::AccountId" - } - } - ], - "Image": { - "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b" - }, - "Privileged": false, - "ReadonlyRootFilesystem": false, - "ResourceRequirements": [ - { - "Type": "VCPU", - "Value": "1" - }, - { - "Type": "MEMORY", - "Value": "4" - } - ] - }, - "PlatformCapabilities": [ - "EC2" - ], - "RetryStrategy": { - "Attempts": 1 - }, - "Timeout": {} - } - }, - "StateMachineRoleB840431D": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "states.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "StateMachineRoleDefaultPolicyDF1E6607": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "batch:SubmitJob", - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":batch:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":job-definition/*" - ] - ] - }, - { - "Ref": "JobQueueEE3AD499" - } - ] - }, - { - "Action": [ - "events:DescribeRule", - "events:PutRule", - "events:PutTargets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":events:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":rule/StepFunctionsGetEventsForBatchJobsRule" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", - "Roles": [ - { - "Ref": "StateMachineRoleB840431D" - } - ] - } - }, - "StateMachine2E01A3A5": { - "Type": "AWS::StepFunctions::StateMachine", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "StateMachineRoleB840431D", - "Arn" - ] - }, - "DefinitionString": { - "Fn::Join": [ - "", - [ - "{\"StartAt\":\"Start\",\"States\":{\"Start\":{\"Type\":\"Pass\",\"Result\":{\"bar\":\"SomeValue\"},\"Next\":\"Submit Job\"},\"Submit Job\":{\"End\":true,\"Parameters\":{\"JobDefinition\":\"", - { - "Ref": "JobDefinition24FFE3ED" - }, - "\",\"JobName\":\"MyJob\",\"JobQueue\":\"", - { - "Ref": "JobQueueEE3AD499" - }, - "\",\"Parameters\":{\"foo.$\":\"$.bar\"},\"ContainerOverrides\":{\"Environment\":[{\"Name\":\"key\",\"Value\":\"value\"}],\"Memory\":256,\"Vcpus\":1},\"RetryStrategy\":{\"Attempts\":3},\"Timeout\":{\"AttemptDurationSeconds\":60}},\"Type\":\"Task\",\"Resource\":\"arn:", - { - "Ref": "AWS::Partition" - }, - ":states:::batch:submitJob.sync\"}}}" - ] - ] - } - }, - "DependsOn": [ - "StateMachineRoleDefaultPolicyDF1E6607", - "StateMachineRoleB840431D" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - } - }, - "Outputs": { - "JobQueueArn": { - "Value": { - "Ref": "JobQueueEE3AD499" - } - }, - "StateMachineArn": { - "Value": { - "Ref": "StateMachine2E01A3A5" - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json deleted file mode 100644 index 92166ff8d63cd..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "30.0.0", - "testCases": { - "integ.run-batch-job": { - "stacks": [ - "aws-stepfunctions-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json deleted file mode 100644 index 27ce2ad29fd61..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/manifest.json +++ /dev/null @@ -1,268 +0,0 @@ -{ - "version": "30.0.0", - "artifacts": { - "aws-stepfunctions-integ.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "aws-stepfunctions-integ.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "aws-stepfunctions-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-stepfunctions-integ.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/911fd19ef0dac006ce95e5e937e911a5000341b539da65d789b20d398b5b0750.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "aws-stepfunctions-integ.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "aws-stepfunctions-integ.assets" - ], - "metadata": { - "/aws-stepfunctions-integ/vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcA2121C38" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1Subnet2E65531E" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1RouteTable48A2DF9B" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1RouteTableAssociation5D3F4579" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1DefaultRoute10708846" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1EIPDA49DCBE" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1NATGateway9C16659E" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2Subnet009B674F" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2RouteTableEB40D4CB" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2RouteTableAssociation21F81B59" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2DefaultRouteA1EC0F60" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2EIP9B3743B1" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2NATGateway9B8AE11A" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1Subnet934893E8" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1RouteTableB41A48CC" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1RouteTableAssociation67945127" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1DefaultRoute1AA8E2E5" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2Subnet7031C2BA" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2RouteTable7280F23E" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2RouteTableAssociation007E94D3" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2DefaultRouteB0E07F99" - } - ], - "/aws-stepfunctions-integ/vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcIGWE57CBDCA" - } - ], - "/aws-stepfunctions-integ/vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcVPCGW7984C166" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvResourceSecurityGroupB84CF86B" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvEcsInstanceRoleCFB290F9" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Instance-Profile": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvInstanceProfile81AFCCF2" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvResourceServiceInstanceRoleCF89E9E1" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnv2C40ACC2" - } - ], - "/aws-stepfunctions-integ/JobQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "JobQueueEE3AD499" - } - ], - "/aws-stepfunctions-integ/JobDefinition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "JobDefinition24FFE3ED" - } - ], - "/aws-stepfunctions-integ/StateMachine/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachineRoleB840431D" - } - ], - "/aws-stepfunctions-integ/StateMachine/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachineRoleDefaultPolicyDF1E6607" - } - ], - "/aws-stepfunctions-integ/StateMachine/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachine2E01A3A5" - } - ], - "/aws-stepfunctions-integ/JobQueueArn": [ - { - "type": "aws:cdk:logicalId", - "data": "JobQueueArn" - } - ], - "/aws-stepfunctions-integ/StateMachineArn": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachineArn" - } - ], - "/aws-stepfunctions-integ/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/aws-stepfunctions-integ/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "aws-stepfunctions-integ" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json deleted file mode 100644 index 3dad4d1fbed55..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/tree.json +++ /dev/null @@ -1,1298 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "aws-stepfunctions-integ": { - "id": "aws-stepfunctions-integ", - "path": "aws-stepfunctions-integ", - "children": { - "vpc": { - "id": "vpc", - "path": "aws-stepfunctions-integ/vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/vpc/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPC", - "aws:cdk:cloudformation:props": { - "cidrBlock": "10.0.0.0/16", - "enableDnsHostnames": true, - "enableDnsSupport": true, - "instanceTenancy": "default", - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.0.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "subnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - }, - "allocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet1EIPDA49DCBE", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.64.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "subnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - }, - "allocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet2EIP9B3743B1", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.128.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "subnetId": { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "vpcPublicSubnet1NATGateway9C16659E" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.192.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "subnetId": { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "vpcPublicSubnet2NATGateway9B8AE11A" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-stepfunctions-integ/vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-stepfunctions-integ/vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "internetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "ComputeEnv": { - "id": "ComputeEnv", - "path": "aws-stepfunctions-integ/ComputeEnv", - "children": { - "Resource-Security-Group": { - "id": "Resource-Security-Group", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "vpcA2121C38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "Ecs-Instance-Role": { - "id": "Ecs-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role", - "children": { - "ImportEcs-Instance-Role": { - "id": "ImportEcs-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role/ImportEcs-Instance-Role", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ec2.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Instance-Profile": { - "id": "Instance-Profile", - "path": "aws-stepfunctions-integ/ComputeEnv/Instance-Profile", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", - "aws:cdk:cloudformation:props": { - "roles": [ - { - "Ref": "ComputeEnvEcsInstanceRoleCFB290F9" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnInstanceProfile", - "version": "0.0.0" - } - }, - "Resource-Service-Instance-Role": { - "id": "Resource-Service-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role", - "children": { - "ImportResource-Service-Instance-Role": { - "id": "ImportResource-Service-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "batch.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSBatchServiceRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Batch::ComputeEnvironment", - "aws:cdk:cloudformation:props": { - "type": "MANAGED", - "computeResources": { - "maxvCpus": 256, - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "ComputeEnvResourceSecurityGroupB84CF86B", - "GroupId" - ] - } - ], - "subnets": [ - { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - }, - { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - ], - "type": "EC2", - "allocationStrategy": "BEST_FIT", - "instanceRole": { - "Fn::GetAtt": [ - "ComputeEnvInstanceProfile81AFCCF2", - "Arn" - ] - }, - "instanceTypes": [ - "optimal" - ], - "minvCpus": 0 - }, - "serviceRole": { - "Fn::GetAtt": [ - "ComputeEnvResourceServiceInstanceRoleCF89E9E1", - "Arn" - ] - }, - "state": "ENABLED" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnComputeEnvironment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.ComputeEnvironment", - "version": "0.0.0" - } - }, - "JobQueue": { - "id": "JobQueue", - "path": "aws-stepfunctions-integ/JobQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/JobQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Batch::JobQueue", - "aws:cdk:cloudformation:props": { - "computeEnvironmentOrder": [ - { - "computeEnvironment": { - "Ref": "ComputeEnv2C40ACC2" - }, - "order": 1 - } - ], - "priority": 1, - "state": "ENABLED" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnJobQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.JobQueue", - "version": "0.0.0" - } - }, - "JobDefinition": { - "id": "JobDefinition", - "path": "aws-stepfunctions-integ/JobDefinition", - "children": { - "Resource-Batch-Task-Definition-Role": { - "id": "Resource-Batch-Task-Definition-Role", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Task-Definition-Role", - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.LazyRole", - "version": "0.0.0" - } - }, - "Resource-Batch-Job-Container-Definition": { - "id": "Resource-Batch-Job-Container-Definition", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition", - "children": { - "AssetImage": { - "id": "AssetImage", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition/AssetImage", - "children": { - "Staging": { - "id": "Staging", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition/AssetImage/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Repository": { - "id": "Repository", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition/AssetImage/Repository", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr-assets.DockerImageAsset", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "AssetImage": { - "id": "AssetImage", - "path": "aws-stepfunctions-integ/JobDefinition/AssetImage", - "children": { - "Staging": { - "id": "Staging", - "path": "aws-stepfunctions-integ/JobDefinition/AssetImage/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Repository": { - "id": "Repository", - "path": "aws-stepfunctions-integ/JobDefinition/AssetImage/Repository", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr-assets.DockerImageAsset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/JobDefinition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Batch::JobDefinition", - "aws:cdk:cloudformation:props": { - "type": "container", - "containerProperties": { - "environment": [ - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "AWS_ACCOUNT", - "value": { - "Ref": "AWS::AccountId" - } - } - ], - "image": { - "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b" - }, - "privileged": false, - "readonlyRootFilesystem": false, - "resourceRequirements": [ - { - "type": "VCPU", - "value": "1" - }, - { - "type": "MEMORY", - "value": "4" - } - ] - }, - "platformCapabilities": [ - "EC2" - ], - "retryStrategy": { - "attempts": 1 - }, - "timeout": {} - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnJobDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.JobDefinition", - "version": "0.0.0" - } - }, - "Submit Job": { - "id": "Submit Job", - "path": "aws-stepfunctions-integ/Submit Job", - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.Task", - "version": "0.0.0" - } - }, - "Start": { - "id": "Start", - "path": "aws-stepfunctions-integ/Start", - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.Pass", - "version": "0.0.0" - } - }, - "StateMachine": { - "id": "StateMachine", - "path": "aws-stepfunctions-integ/StateMachine", - "children": { - "Role": { - "id": "Role", - "path": "aws-stepfunctions-integ/StateMachine/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "aws-stepfunctions-integ/StateMachine/Role/ImportRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/StateMachine/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "states.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-stepfunctions-integ/StateMachine/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/StateMachine/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "batch:SubmitJob", - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":batch:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":job-definition/*" - ] - ] - }, - { - "Ref": "JobQueueEE3AD499" - } - ] - }, - { - "Action": [ - "events:DescribeRule", - "events:PutRule", - "events:PutTargets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":events:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":rule/StepFunctionsGetEventsForBatchJobsRule" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "StateMachineRoleDefaultPolicyDF1E6607", - "roles": [ - { - "Ref": "StateMachineRoleB840431D" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/StateMachine/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "StateMachineRoleB840431D", - "Arn" - ] - }, - "definitionString": { - "Fn::Join": [ - "", - [ - "{\"StartAt\":\"Start\",\"States\":{\"Start\":{\"Type\":\"Pass\",\"Result\":{\"bar\":\"SomeValue\"},\"Next\":\"Submit Job\"},\"Submit Job\":{\"End\":true,\"Parameters\":{\"JobDefinition\":\"", - { - "Ref": "JobDefinition24FFE3ED" - }, - "\",\"JobName\":\"MyJob\",\"JobQueue\":\"", - { - "Ref": "JobQueueEE3AD499" - }, - "\",\"Parameters\":{\"foo.$\":\"$.bar\"},\"ContainerOverrides\":{\"Environment\":[{\"Name\":\"key\",\"Value\":\"value\"}],\"Memory\":256,\"Vcpus\":1},\"RetryStrategy\":{\"Attempts\":3},\"Timeout\":{\"AttemptDurationSeconds\":60}},\"Type\":\"Task\",\"Resource\":\"arn:", - { - "Ref": "AWS::Partition" - }, - ":states:::batch:submitJob.sync\"}}}" - ] - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.CfnStateMachine", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.StateMachine", - "version": "0.0.0" - } - }, - "JobQueueArn": { - "id": "JobQueueArn", - "path": "aws-stepfunctions-integ/JobQueueArn", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "StateMachineArn": { - "id": "StateMachineArn", - "path": "aws-stepfunctions-integ/StateMachineArn", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "aws-stepfunctions-integ/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "aws-stepfunctions-integ/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.237" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.ts deleted file mode 100644 index c31aa18cc5fbf..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.ts +++ /dev/null @@ -1,80 +0,0 @@ -import * as path from 'path'; -import * as batch from '@aws-cdk/aws-batch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --state-machine-arn : should return execution arn - * * aws batch list-jobs --job-queue --job-status RUNNABLE : should return jobs-list with size greater than 0 - * * - * * aws batch describe-jobs --jobs --query 'jobs[0].status': wait until the status is 'SUCCEEDED' - * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED - */ - -class RunBatchStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props: cdk.StackProps = {}) { - super(scope, id, props); - - const vpc = new ec2.Vpc(this, 'vpc'); - - const batchQueue = new batch.JobQueue(this, 'JobQueue', { - computeEnvironments: [ - { - order: 1, - computeEnvironment: new batch.ComputeEnvironment(this, 'ComputeEnv', { - computeResources: { vpc }, - }), - }, - ], - }); - - const batchJobDefinition = new batch.JobDefinition(this, 'JobDefinition', { - container: { - image: ecs.ContainerImage.fromAsset( - path.resolve(__dirname, 'batchjob-image'), - ), - }, - }); - - const submitJob = new sfn.Task(this, 'Submit Job', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'MyJob', - jobQueueArn: batchQueue.jobQueueArn, - containerOverrides: { - environment: { key: 'value' }, - memory: 256, - vcpus: 1, - }, - payload: { - foo: sfn.JsonPath.stringAt('$.bar'), - }, - attempts: 3, - timeout: cdk.Duration.seconds(60), - }), - }); - - const definition = new sfn.Pass(this, 'Start', { - result: sfn.Result.fromObject({ bar: 'SomeValue' }), - }).next(submitJob); - - const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, - }); - - new cdk.CfnOutput(this, 'JobQueueArn', { - value: batchQueue.jobQueueArn, - }); - new cdk.CfnOutput(this, 'StateMachineArn', { - value: stateMachine.stateMachineArn, - }); - } -} - -const app = new cdk.App(); -new RunBatchStack(app, 'aws-stepfunctions-integ'); -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/index.py b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/index.py deleted file mode 100644 index 337ed86e5f2ec..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/index.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/python -import os -import pprint - -print('Hello from Batch!') -pprint.pprint(dict(os.environ)) diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json deleted file mode 100644 index d36298cf4d8db..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "30.0.0", - "files": { - "53f3e164ae01ad33e9067c8bef1f719b2c73c2d2be0b1d9acbdc179728ce1fa7": { - "source": { - "path": "aws-stepfunctions-integ.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "53f3e164ae01ad33e9067c8bef1f719b2c73c2d2be0b1d9acbdc179728ce1fa7.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": { - "8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b": { - "source": { - "directory": "asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b" - }, - "destinations": { - "current_account-current_region": { - "repositoryName": "cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}", - "imageTag": "8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json deleted file mode 100644 index f1f6914899bb4..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/aws-stepfunctions-integ.template.json +++ /dev/null @@ -1,884 +0,0 @@ -{ - "Resources": { - "vpcA2121C38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "vpcPublicSubnet1Subnet2E65531E": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "vpcPublicSubnet1RouteTable48A2DF9B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "vpcPublicSubnet1RouteTableAssociation5D3F4579": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "SubnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - } - } - }, - "vpcPublicSubnet1DefaultRoute10708846": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcPublicSubnet1EIPDA49DCBE": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "vpcPublicSubnet1NATGateway9C16659E": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - }, - "AllocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet1EIPDA49DCBE", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1RouteTableAssociation5D3F4579" - ] - }, - "vpcPublicSubnet2Subnet009B674F": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.64.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "vpcPublicSubnet2RouteTableEB40D4CB": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "vpcPublicSubnet2RouteTableAssociation21F81B59": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "SubnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - } - } - }, - "vpcPublicSubnet2DefaultRouteA1EC0F60": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - }, - "DependsOn": [ - "vpcVPCGW7984C166" - ] - }, - "vpcPublicSubnet2EIP9B3743B1": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "vpcPublicSubnet2NATGateway9B8AE11A": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - }, - "AllocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet2EIP9B3743B1", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2RouteTableAssociation21F81B59" - ] - }, - "vpcPrivateSubnet1Subnet934893E8": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.128.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "vpcPrivateSubnet1RouteTableB41A48CC": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "vpcPrivateSubnet1RouteTableAssociation67945127": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "SubnetId": { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - } - } - }, - "vpcPrivateSubnet1DefaultRoute1AA8E2E5": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "vpcPublicSubnet1NATGateway9C16659E" - } - } - }, - "vpcPrivateSubnet2Subnet7031C2BA": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.192.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "vpcPrivateSubnet2RouteTable7280F23E": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "vpcPrivateSubnet2RouteTableAssociation007E94D3": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "SubnetId": { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - } - }, - "vpcPrivateSubnet2DefaultRouteB0E07F99": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "vpcPublicSubnet2NATGateway9B8AE11A" - } - } - }, - "vpcIGWE57CBDCA": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "vpcVPCGW7984C166": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "vpcA2121C38" - }, - "InternetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "ComputeEnvResourceSecurityGroupB84CF86B": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "vpcA2121C38" - } - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnvEcsInstanceRoleCFB290F9": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ec2.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role" - ] - ] - } - ] - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnvInstanceProfile81AFCCF2": { - "Type": "AWS::IAM::InstanceProfile", - "Properties": { - "Roles": [ - { - "Ref": "ComputeEnvEcsInstanceRoleCFB290F9" - } - ] - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnvResourceServiceInstanceRoleCF89E9E1": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "batch.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSBatchServiceRole" - ] - ] - } - ] - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "ComputeEnv2C40ACC2": { - "Type": "AWS::Batch::ComputeEnvironment", - "Properties": { - "Type": "MANAGED", - "ComputeResources": { - "AllocationStrategy": "BEST_FIT", - "InstanceRole": { - "Fn::GetAtt": [ - "ComputeEnvInstanceProfile81AFCCF2", - "Arn" - ] - }, - "InstanceTypes": [ - "optimal" - ], - "MaxvCpus": 256, - "MinvCpus": 0, - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "ComputeEnvResourceSecurityGroupB84CF86B", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - }, - { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - ], - "Type": "EC2" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "ComputeEnvResourceServiceInstanceRoleCF89E9E1", - "Arn" - ] - }, - "State": "ENABLED" - }, - "DependsOn": [ - "vpcIGWE57CBDCA", - "vpcPrivateSubnet1DefaultRoute1AA8E2E5", - "vpcPrivateSubnet1RouteTableB41A48CC", - "vpcPrivateSubnet1RouteTableAssociation67945127", - "vpcPrivateSubnet1Subnet934893E8", - "vpcPrivateSubnet2DefaultRouteB0E07F99", - "vpcPrivateSubnet2RouteTable7280F23E", - "vpcPrivateSubnet2RouteTableAssociation007E94D3", - "vpcPrivateSubnet2Subnet7031C2BA", - "vpcPublicSubnet1DefaultRoute10708846", - "vpcPublicSubnet1EIPDA49DCBE", - "vpcPublicSubnet1NATGateway9C16659E", - "vpcPublicSubnet1RouteTable48A2DF9B", - "vpcPublicSubnet1RouteTableAssociation5D3F4579", - "vpcPublicSubnet1Subnet2E65531E", - "vpcPublicSubnet2DefaultRouteA1EC0F60", - "vpcPublicSubnet2EIP9B3743B1", - "vpcPublicSubnet2NATGateway9B8AE11A", - "vpcPublicSubnet2RouteTableEB40D4CB", - "vpcPublicSubnet2RouteTableAssociation21F81B59", - "vpcPublicSubnet2Subnet009B674F", - "vpcA2121C38", - "vpcVPCGW7984C166" - ] - }, - "JobQueueEE3AD499": { - "Type": "AWS::Batch::JobQueue", - "Properties": { - "ComputeEnvironmentOrder": [ - { - "ComputeEnvironment": { - "Ref": "ComputeEnv2C40ACC2" - }, - "Order": 1 - } - ], - "Priority": 1, - "State": "ENABLED" - } - }, - "JobDefinition24FFE3ED": { - "Type": "AWS::Batch::JobDefinition", - "Properties": { - "Type": "container", - "ContainerProperties": { - "Environment": [ - { - "Name": "AWS_REGION", - "Value": { - "Ref": "AWS::Region" - } - }, - { - "Name": "AWS_ACCOUNT", - "Value": { - "Ref": "AWS::AccountId" - } - } - ], - "Image": { - "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b" - }, - "Privileged": false, - "ReadonlyRootFilesystem": false, - "ResourceRequirements": [ - { - "Type": "VCPU", - "Value": "1" - }, - { - "Type": "MEMORY", - "Value": "4" - } - ] - }, - "PlatformCapabilities": [ - "EC2" - ], - "RetryStrategy": { - "Attempts": 1 - }, - "Timeout": {} - } - }, - "StateMachineRoleB840431D": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "states.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "StateMachineRoleDefaultPolicyDF1E6607": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "batch:SubmitJob", - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":batch:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":job-definition/*" - ] - ] - }, - { - "Ref": "JobQueueEE3AD499" - } - ] - }, - { - "Action": [ - "events:DescribeRule", - "events:PutRule", - "events:PutTargets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":events:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":rule/StepFunctionsGetEventsForBatchJobsRule" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", - "Roles": [ - { - "Ref": "StateMachineRoleB840431D" - } - ] - } - }, - "StateMachine2E01A3A5": { - "Type": "AWS::StepFunctions::StateMachine", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "StateMachineRoleB840431D", - "Arn" - ] - }, - "DefinitionString": { - "Fn::Join": [ - "", - [ - "{\"StartAt\":\"Start\",\"States\":{\"Start\":{\"Type\":\"Pass\",\"Result\":{\"bar\":\"SomeValue\"},\"Next\":\"Submit Job\"},\"Submit Job\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", - { - "Ref": "AWS::Partition" - }, - ":states:::batch:submitJob.sync\",\"Parameters\":{\"JobDefinition\":\"", - { - "Ref": "JobDefinition24FFE3ED" - }, - "\",\"JobName\":\"MyJob\",\"JobQueue\":\"", - { - "Ref": "JobQueueEE3AD499" - }, - "\",\"Parameters\":{\"foo.$\":\"$.bar\"},\"ContainerOverrides\":{\"Environment\":[{\"Name\":\"key\",\"Value\":\"value\"}],\"ResourceRequirements\":[{\"Type\":\"MEMORY\",\"Value\":\"256\"},{\"Type\":\"VCPU\",\"Value\":\"1\"}]},\"RetryStrategy\":{\"Attempts\":3},\"Timeout\":{\"AttemptDurationSeconds\":60}}}}}" - ] - ] - } - }, - "DependsOn": [ - "StateMachineRoleDefaultPolicyDF1E6607", - "StateMachineRoleB840431D" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - } - }, - "Outputs": { - "JobQueueArn": { - "Value": { - "Ref": "JobQueueEE3AD499" - } - }, - "StateMachineArn": { - "Value": { - "Ref": "StateMachine2E01A3A5" - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json deleted file mode 100644 index 2526e894f4803..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/integ.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": "30.0.0", - "testCases": { - "integ.submit-job": { - "stacks": [ - "aws-stepfunctions-integ" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": {}, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json deleted file mode 100644 index 09fc9a0aab7d7..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/manifest.json +++ /dev/null @@ -1,268 +0,0 @@ -{ - "version": "30.0.0", - "artifacts": { - "aws-stepfunctions-integ.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "aws-stepfunctions-integ.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "aws-stepfunctions-integ": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "aws-stepfunctions-integ.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/53f3e164ae01ad33e9067c8bef1f719b2c73c2d2be0b1d9acbdc179728ce1fa7.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "aws-stepfunctions-integ.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "aws-stepfunctions-integ.assets" - ], - "metadata": { - "/aws-stepfunctions-integ/vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcA2121C38" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1Subnet2E65531E" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1RouteTable48A2DF9B" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1RouteTableAssociation5D3F4579" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1DefaultRoute10708846" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1EIPDA49DCBE" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet1NATGateway9C16659E" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2Subnet009B674F" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2RouteTableEB40D4CB" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2RouteTableAssociation21F81B59" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2DefaultRouteA1EC0F60" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2EIP9B3743B1" - } - ], - "/aws-stepfunctions-integ/vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPublicSubnet2NATGateway9B8AE11A" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1Subnet934893E8" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1RouteTableB41A48CC" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1RouteTableAssociation67945127" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet1DefaultRoute1AA8E2E5" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2Subnet7031C2BA" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2RouteTable7280F23E" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2RouteTableAssociation007E94D3" - } - ], - "/aws-stepfunctions-integ/vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcPrivateSubnet2DefaultRouteB0E07F99" - } - ], - "/aws-stepfunctions-integ/vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcIGWE57CBDCA" - } - ], - "/aws-stepfunctions-integ/vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "vpcVPCGW7984C166" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvResourceSecurityGroupB84CF86B" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvEcsInstanceRoleCFB290F9" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Instance-Profile": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvInstanceProfile81AFCCF2" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnvResourceServiceInstanceRoleCF89E9E1" - } - ], - "/aws-stepfunctions-integ/ComputeEnv/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "ComputeEnv2C40ACC2" - } - ], - "/aws-stepfunctions-integ/JobQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "JobQueueEE3AD499" - } - ], - "/aws-stepfunctions-integ/JobDefinition/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "JobDefinition24FFE3ED" - } - ], - "/aws-stepfunctions-integ/StateMachine/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachineRoleB840431D" - } - ], - "/aws-stepfunctions-integ/StateMachine/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachineRoleDefaultPolicyDF1E6607" - } - ], - "/aws-stepfunctions-integ/StateMachine/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachine2E01A3A5" - } - ], - "/aws-stepfunctions-integ/JobQueueArn": [ - { - "type": "aws:cdk:logicalId", - "data": "JobQueueArn" - } - ], - "/aws-stepfunctions-integ/StateMachineArn": [ - { - "type": "aws:cdk:logicalId", - "data": "StateMachineArn" - } - ], - "/aws-stepfunctions-integ/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/aws-stepfunctions-integ/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "aws-stepfunctions-integ" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json deleted file mode 100644 index 36035db6ef9be..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/tree.json +++ /dev/null @@ -1,1298 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "aws-stepfunctions-integ": { - "id": "aws-stepfunctions-integ", - "path": "aws-stepfunctions-integ", - "children": { - "vpc": { - "id": "vpc", - "path": "aws-stepfunctions-integ/vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/vpc/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPC", - "aws:cdk:cloudformation:props": { - "cidrBlock": "10.0.0.0/16", - "enableDnsHostnames": true, - "enableDnsSupport": true, - "instanceTenancy": "default", - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.0.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "subnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet1RouteTable48A2DF9B" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "vpcPublicSubnet1Subnet2E65531E" - }, - "allocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet1EIPDA49DCBE", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.64.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "subnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPublicSubnet2RouteTableEB40D4CB" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "aws-stepfunctions-integ/vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "vpcPublicSubnet2Subnet009B674F" - }, - "allocationId": { - "Fn::GetAtt": [ - "vpcPublicSubnet2EIP9B3743B1", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.128.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "subnetId": { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet1RouteTableB41A48CC" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "vpcPublicSubnet1NATGateway9C16659E" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.192.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "subnetId": { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "aws-stepfunctions-integ/vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "vpcPrivateSubnet2RouteTable7280F23E" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "vpcPublicSubnet2NATGateway9B8AE11A" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "aws-stepfunctions-integ/vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "aws-stepfunctions-integ/vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "aws-stepfunctions-integ/vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "vpcA2121C38" - }, - "internetGatewayId": { - "Ref": "vpcIGWE57CBDCA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "ComputeEnv": { - "id": "ComputeEnv", - "path": "aws-stepfunctions-integ/ComputeEnv", - "children": { - "Resource-Security-Group": { - "id": "Resource-Security-Group", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "aws-stepfunctions-integ/ComputeEnv/Resource-Security-Group", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "vpcA2121C38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "Ecs-Instance-Role": { - "id": "Ecs-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role", - "children": { - "ImportEcs-Instance-Role": { - "id": "ImportEcs-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role/ImportEcs-Instance-Role", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Ecs-Instance-Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "ec2.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Instance-Profile": { - "id": "Instance-Profile", - "path": "aws-stepfunctions-integ/ComputeEnv/Instance-Profile", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", - "aws:cdk:cloudformation:props": { - "roles": [ - { - "Ref": "ComputeEnvEcsInstanceRoleCFB290F9" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnInstanceProfile", - "version": "0.0.0" - } - }, - "Resource-Service-Instance-Role": { - "id": "Resource-Service-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role", - "children": { - "ImportResource-Service-Instance-Role": { - "id": "ImportResource-Service-Instance-Role", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role/ImportResource-Service-Instance-Role", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource-Service-Instance-Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "batch.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "managedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSBatchServiceRole" - ] - ] - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/ComputeEnv/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Batch::ComputeEnvironment", - "aws:cdk:cloudformation:props": { - "type": "MANAGED", - "computeResources": { - "maxvCpus": 256, - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "ComputeEnvResourceSecurityGroupB84CF86B", - "GroupId" - ] - } - ], - "subnets": [ - { - "Ref": "vpcPrivateSubnet1Subnet934893E8" - }, - { - "Ref": "vpcPrivateSubnet2Subnet7031C2BA" - } - ], - "type": "EC2", - "allocationStrategy": "BEST_FIT", - "instanceRole": { - "Fn::GetAtt": [ - "ComputeEnvInstanceProfile81AFCCF2", - "Arn" - ] - }, - "instanceTypes": [ - "optimal" - ], - "minvCpus": 0 - }, - "serviceRole": { - "Fn::GetAtt": [ - "ComputeEnvResourceServiceInstanceRoleCF89E9E1", - "Arn" - ] - }, - "state": "ENABLED" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnComputeEnvironment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.ComputeEnvironment", - "version": "0.0.0" - } - }, - "JobQueue": { - "id": "JobQueue", - "path": "aws-stepfunctions-integ/JobQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/JobQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Batch::JobQueue", - "aws:cdk:cloudformation:props": { - "computeEnvironmentOrder": [ - { - "computeEnvironment": { - "Ref": "ComputeEnv2C40ACC2" - }, - "order": 1 - } - ], - "priority": 1, - "state": "ENABLED" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnJobQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.JobQueue", - "version": "0.0.0" - } - }, - "JobDefinition": { - "id": "JobDefinition", - "path": "aws-stepfunctions-integ/JobDefinition", - "children": { - "Resource-Batch-Task-Definition-Role": { - "id": "Resource-Batch-Task-Definition-Role", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Task-Definition-Role", - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.LazyRole", - "version": "0.0.0" - } - }, - "Resource-Batch-Job-Container-Definition": { - "id": "Resource-Batch-Job-Container-Definition", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition", - "children": { - "AssetImage": { - "id": "AssetImage", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition/AssetImage", - "children": { - "Staging": { - "id": "Staging", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition/AssetImage/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Repository": { - "id": "Repository", - "path": "aws-stepfunctions-integ/JobDefinition/Resource-Batch-Job-Container-Definition/AssetImage/Repository", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr-assets.DockerImageAsset", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecs.ContainerDefinition", - "version": "0.0.0" - } - }, - "AssetImage": { - "id": "AssetImage", - "path": "aws-stepfunctions-integ/JobDefinition/AssetImage", - "children": { - "Staging": { - "id": "Staging", - "path": "aws-stepfunctions-integ/JobDefinition/AssetImage/Staging", - "constructInfo": { - "fqn": "@aws-cdk/core.AssetStaging", - "version": "0.0.0" - } - }, - "Repository": { - "id": "Repository", - "path": "aws-stepfunctions-integ/JobDefinition/AssetImage/Repository", - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr.RepositoryBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ecr-assets.DockerImageAsset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/JobDefinition/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Batch::JobDefinition", - "aws:cdk:cloudformation:props": { - "type": "container", - "containerProperties": { - "environment": [ - { - "name": "AWS_REGION", - "value": { - "Ref": "AWS::Region" - } - }, - { - "name": "AWS_ACCOUNT", - "value": { - "Ref": "AWS::AccountId" - } - } - ], - "image": { - "Fn::Sub": "${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-${AWS::AccountId}-${AWS::Region}:8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b" - }, - "privileged": false, - "readonlyRootFilesystem": false, - "resourceRequirements": [ - { - "type": "VCPU", - "value": "1" - }, - { - "type": "MEMORY", - "value": "4" - } - ] - }, - "platformCapabilities": [ - "EC2" - ], - "retryStrategy": { - "attempts": 1 - }, - "timeout": {} - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.CfnJobDefinition", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-batch.JobDefinition", - "version": "0.0.0" - } - }, - "Submit Job": { - "id": "Submit Job", - "path": "aws-stepfunctions-integ/Submit Job", - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions-tasks.BatchSubmitJob", - "version": "0.0.0" - } - }, - "Start": { - "id": "Start", - "path": "aws-stepfunctions-integ/Start", - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.Pass", - "version": "0.0.0" - } - }, - "StateMachine": { - "id": "StateMachine", - "path": "aws-stepfunctions-integ/StateMachine", - "children": { - "Role": { - "id": "Role", - "path": "aws-stepfunctions-integ/StateMachine/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "aws-stepfunctions-integ/StateMachine/Role/ImportRole", - "constructInfo": { - "fqn": "@aws-cdk/core.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/StateMachine/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "states.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "aws-stepfunctions-integ/StateMachine/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/StateMachine/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "batch:SubmitJob", - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":batch:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":job-definition/*" - ] - ] - }, - { - "Ref": "JobQueueEE3AD499" - } - ] - }, - { - "Action": [ - "events:DescribeRule", - "events:PutRule", - "events:PutTargets" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":events:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":rule/StepFunctionsGetEventsForBatchJobsRule" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "StateMachineRoleDefaultPolicyDF1E6607", - "roles": [ - { - "Ref": "StateMachineRoleB840431D" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "aws-stepfunctions-integ/StateMachine/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "StateMachineRoleB840431D", - "Arn" - ] - }, - "definitionString": { - "Fn::Join": [ - "", - [ - "{\"StartAt\":\"Start\",\"States\":{\"Start\":{\"Type\":\"Pass\",\"Result\":{\"bar\":\"SomeValue\"},\"Next\":\"Submit Job\"},\"Submit Job\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", - { - "Ref": "AWS::Partition" - }, - ":states:::batch:submitJob.sync\",\"Parameters\":{\"JobDefinition\":\"", - { - "Ref": "JobDefinition24FFE3ED" - }, - "\",\"JobName\":\"MyJob\",\"JobQueue\":\"", - { - "Ref": "JobQueueEE3AD499" - }, - "\",\"Parameters\":{\"foo.$\":\"$.bar\"},\"ContainerOverrides\":{\"Environment\":[{\"Name\":\"key\",\"Value\":\"value\"}],\"ResourceRequirements\":[{\"Type\":\"MEMORY\",\"Value\":\"256\"},{\"Type\":\"VCPU\",\"Value\":\"1\"}]},\"RetryStrategy\":{\"Attempts\":3},\"Timeout\":{\"AttemptDurationSeconds\":60}}}}}" - ] - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.CfnStateMachine", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-stepfunctions.StateMachine", - "version": "0.0.0" - } - }, - "JobQueueArn": { - "id": "JobQueueArn", - "path": "aws-stepfunctions-integ/JobQueueArn", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "StateMachineArn": { - "id": "StateMachineArn", - "path": "aws-stepfunctions-integ/StateMachineArn", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnOutput", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "aws-stepfunctions-integ/BootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "aws-stepfunctions-integ/CheckBootstrapVersion", - "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.Stack", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.237" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/core.App", - "version": "0.0.0" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.ts deleted file mode 100644 index 63492d21b8e6b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.ts +++ /dev/null @@ -1,78 +0,0 @@ -import * as path from 'path'; -import * as batch from '@aws-cdk/aws-batch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { BatchSubmitJob } from '../../lib'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --state-machine-arn : should return execution arn - * * aws batch list-jobs --job-queue --job-status RUNNABLE : should return jobs-list with size greater than 0 - * * - * * aws batch describe-jobs --jobs --query 'jobs[0].status': wait until the status is 'SUCCEEDED' - * * aws stepfunctions describe-execution --execution-arn --query 'status': should return status as SUCCEEDED - */ - -class RunBatchStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props: cdk.StackProps = {}) { - super(scope, id, props); - - const vpc = new ec2.Vpc(this, 'vpc'); - - const batchQueue = new batch.JobQueue(this, 'JobQueue', { - computeEnvironments: [ - { - order: 1, - computeEnvironment: new batch.ComputeEnvironment(this, 'ComputeEnv', { - computeResources: { vpc }, - }), - }, - ], - }); - - const batchJobDefinition = new batch.JobDefinition(this, 'JobDefinition', { - container: { - image: ecs.ContainerImage.fromAsset( - path.resolve(__dirname, 'batchjob-image'), - ), - }, - }); - - const submitJob = new BatchSubmitJob(this, 'Submit Job', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobQueueArn: batchQueue.jobQueueArn, - jobName: 'MyJob', - containerOverrides: { - environment: { key: 'value' }, - memory: cdk.Size.mebibytes(256), - vcpus: 1, - }, - payload: sfn.TaskInput.fromObject({ - foo: sfn.JsonPath.stringAt('$.bar'), - }), - attempts: 3, - taskTimeout: sfn.Timeout.duration(cdk.Duration.seconds(60)), - }); - - const definition = new sfn.Pass(this, 'Start', { - result: sfn.Result.fromObject({ bar: 'SomeValue' }), - }).next(submitJob); - - const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, - }); - - new cdk.CfnOutput(this, 'JobQueueArn', { - value: batchQueue.jobQueueArn, - }); - new cdk.CfnOutput(this, 'StateMachineArn', { - value: stateMachine.stateMachineArn, - }); - } -} - -const app = new cdk.App(); -new RunBatchStack(app, 'aws-stepfunctions-integ'); -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/run-batch-job.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/run-batch-job.test.ts deleted file mode 100644 index 9b3e4ab8667af..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/run-batch-job.test.ts +++ /dev/null @@ -1,302 +0,0 @@ -import * as path from 'path'; -import * as batch from '@aws-cdk/aws-batch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as tasks from '../../lib'; - -let stack: cdk.Stack; -let batchJobDefinition: batch.IJobDefinition; -let batchJobQueue: batch.IJobQueue; - -beforeEach(() => { - // GIVEN - stack = new cdk.Stack(); - - batchJobDefinition = new batch.JobDefinition(stack, 'JobDefinition', { - container: { - image: ecs.ContainerImage.fromAsset( - path.join(__dirname, 'batchjob-image'), - ), - }, - }); - - batchJobQueue = new batch.JobQueue(stack, 'JobQueue', { - computeEnvironments: [ - { - order: 1, - computeEnvironment: new batch.ComputeEnvironment(stack, 'ComputeEnv', { - computeResources: { vpc: new ec2.Vpc(stack, 'vpc') }, - }), - }, - ], - }); -}); - -describeDeprecated('RunBatchJob', () => { - test('Task with only the required parameters', () => { - // WHEN - const task = new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - }), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob.sync', - ], - ], - }, - End: true, - Parameters: { - JobDefinition: { Ref: 'JobDefinition24FFE3ED' }, - JobName: 'JobName', - JobQueue: { Ref: 'JobQueueEE3AD499' }, - }, - }); - }); - - test('Task with all the parameters', () => { - // WHEN - const task = new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: 15, - containerOverrides: { - command: ['sudo', 'rm'], - environment: { key: 'value' }, - instanceType: new ec2.InstanceType('MULTI'), - memory: 1024, - gpuCount: 1, - vcpus: 10, - }, - dependsOn: [{ jobId: '1234', type: 'some_type' }], - payload: { - foo: sfn.JsonPath.stringAt('$.bar'), - }, - attempts: 3, - timeout: cdk.Duration.seconds(60), - integrationPattern: sfn.ServiceIntegrationPattern.FIRE_AND_FORGET, - }), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob', - ], - ], - }, - End: true, - Parameters: { - JobDefinition: { Ref: 'JobDefinition24FFE3ED' }, - JobName: 'JobName', - JobQueue: { Ref: 'JobQueueEE3AD499' }, - ArrayProperties: { Size: 15 }, - ContainerOverrides: { - Command: ['sudo', 'rm'], - Environment: [{ Name: 'key', Value: 'value' }], - InstanceType: 'MULTI', - Memory: 1024, - ResourceRequirements: [{ Type: 'GPU', Value: '1' }], - Vcpus: 10, - }, - DependsOn: [{ JobId: '1234', Type: 'some_type' }], - Parameters: { 'foo.$': '$.bar' }, - RetryStrategy: { Attempts: 3 }, - Timeout: { AttemptDurationSeconds: 60 }, - }, - }); - }); - - test('supports tokens', () => { - // WHEN - const task = new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobQueueArn: batchJobQueue.jobQueueArn, - jobName: sfn.JsonPath.stringAt('$.jobName'), - arraySize: sfn.JsonPath.numberAt('$.arraySize'), - timeout: cdk.Duration.seconds(sfn.JsonPath.numberAt('$.timeout')), - attempts: sfn.JsonPath.numberAt('$.attempts'), - }), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob.sync', - ], - ], - }, - End: true, - Parameters: { - 'JobDefinition': { Ref: 'JobDefinition24FFE3ED' }, - 'JobName.$': '$.jobName', - 'JobQueue': { Ref: 'JobQueueEE3AD499' }, - 'ArrayProperties': { - 'Size.$': '$.arraySize', - }, - 'RetryStrategy': { - 'Attempts.$': '$.attempts', - }, - 'Timeout': { - 'AttemptDurationSeconds.$': '$.timeout', - }, - }, - }); - }); - - test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, - }), - }); - }).toThrow( - /Invalid Service Integration Pattern: WAIT_FOR_TASK_TOKEN is not supported to call RunBatchJob./i, - ); - }); - - test('Task throws if environment in containerOverrides contain env with name starting with AWS_BATCH', () => { - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - containerOverrides: { - environment: { AWS_BATCH_MY_NAME: 'MY_VALUE' }, - }, - }), - }); - }).toThrow( - /Invalid environment variable name: AWS_BATCH_MY_NAME. Environment variable names starting with 'AWS_BATCH' are reserved./i, - ); - }); - - test('Task throws if arraySize is out of limits 2-10000', () => { - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: 1, - }), - }); - }).toThrow( - /arraySize must be between 2 and 10,000/, - ); - - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: 10001, - }), - }); - }).toThrow( - /arraySize must be between 2 and 10,000/, - ); - }); - - test('Task throws if dependencies exceeds 20', () => { - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - dependsOn: [...Array(21).keys()].map(i => ({ - jobId: `${i}`, - type: `some_type-${i}`, - })), - }), - }); - }).toThrow( - /dependencies must be 20 or less/, - ); - }); - - test('Task throws if attempts is out of limits 1-10', () => { - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - attempts: 0, - }), - }); - }).toThrow( - /attempts must be between 1 and 10/, - ); - - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - attempts: 11, - }), - }); - }).toThrow( - /attempts must be between 1 and 10/, - ); - }); - - test('Task throws if timeout is less than 60 sec', () => { - expect(() => { - new sfn.Task(stack, 'Task', { - task: new tasks.RunBatchJob({ - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - timeout: cdk.Duration.seconds(59), - }), - }); - }).toThrow( - /timeout must be greater than 60 seconds/, - ); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/submit-job.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/submit-job.test.ts deleted file mode 100644 index 043b55ea4136b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/submit-job.test.ts +++ /dev/null @@ -1,336 +0,0 @@ -import * as path from 'path'; -import * as batch from '@aws-cdk/aws-batch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { BatchSubmitJob } from '../../lib'; - -let stack: cdk.Stack; -let batchJobDefinition: batch.IJobDefinition; -let batchJobQueue: batch.IJobQueue; - -beforeEach(() => { - // GIVEN - stack = new cdk.Stack(); - - batchJobDefinition = new batch.JobDefinition(stack, 'JobDefinition', { - container: { - image: ecs.ContainerImage.fromAsset( - path.join(__dirname, 'batchjob-image'), - ), - }, - }); - - batchJobQueue = new batch.JobQueue(stack, 'JobQueue', { - computeEnvironments: [ - { - order: 1, - computeEnvironment: new batch.ComputeEnvironment(stack, 'ComputeEnv', { - computeResources: { vpc: new ec2.Vpc(stack, 'vpc') }, - }), - }, - ], - }); -}); - -test('Task with only the required parameters', () => { - // WHEN - const task = new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob.sync', - ], - ], - }, - End: true, - Parameters: { - JobDefinition: { Ref: 'JobDefinition24FFE3ED' }, - JobName: 'JobName', - JobQueue: { Ref: 'JobQueueEE3AD499' }, - }, - }); -}); - -test('Task with all the parameters', () => { - // WHEN - const task = new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: 15, - containerOverrides: { - command: ['sudo', 'rm'], - environment: { key: 'value' }, - instanceType: new ec2.InstanceType('MULTI'), - memory: cdk.Size.mebibytes(1024), - gpuCount: 1, - vcpus: 10, - }, - dependsOn: [{ jobId: '1234', type: 'some_type' }], - payload: sfn.TaskInput.fromObject({ - foo: sfn.JsonPath.stringAt('$.bar'), - }), - attempts: 3, - taskTimeout: sfn.Timeout.duration(cdk.Duration.seconds(60)), - integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob', - ], - ], - }, - End: true, - Parameters: { - JobDefinition: { Ref: 'JobDefinition24FFE3ED' }, - JobName: 'JobName', - JobQueue: { Ref: 'JobQueueEE3AD499' }, - ArrayProperties: { Size: 15 }, - ContainerOverrides: { - Command: ['sudo', 'rm'], - Environment: [{ Name: 'key', Value: 'value' }], - InstanceType: 'MULTI', - ResourceRequirements: [{ Type: 'GPU', Value: '1' }, { Type: 'MEMORY', Value: '1024' }, { Type: 'VCPU', Value: '10' }], - }, - DependsOn: [{ JobId: '1234', Type: 'some_type' }], - Parameters: { 'foo.$': '$.bar' }, - RetryStrategy: { Attempts: 3 }, - Timeout: { AttemptDurationSeconds: 60 }, - }, - }); -}); - -test('supports tokens', () => { - // WHEN - const task = new BatchSubmitJob(stack, 'Task', { - jobName: sfn.JsonPath.stringAt('$.jobName'), - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: sfn.JsonPath.numberAt('$.arraySize'), - taskTimeout: sfn.Timeout.at('$.timeout'), - attempts: sfn.JsonPath.numberAt('$.attempts'), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob.sync', - ], - ], - }, - End: true, - Parameters: { - 'JobDefinition': { Ref: 'JobDefinition24FFE3ED' }, - 'JobName.$': '$.jobName', - 'JobQueue': { Ref: 'JobQueueEE3AD499' }, - 'ArrayProperties': { - 'Size.$': '$.arraySize', - }, - 'RetryStrategy': { - 'Attempts.$': '$.attempts', - }, - 'Timeout': { - 'AttemptDurationSeconds.$': '$.timeout', - }, - }, - }); -}); - -test('container overrides are tokens', () => { - // WHEN - const task = new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - containerOverrides: { - memory: cdk.Size.mebibytes(sfn.JsonPath.numberAt('$.asdf')), - }, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':states:::batch:submitJob.sync']] }, - End: true, - Parameters: { - JobDefinition: { Ref: 'JobDefinition24FFE3ED' }, - JobName: 'JobName', - JobQueue: { Ref: 'JobQueueEE3AD499' }, - ContainerOverrides: { - ResourceRequirements: [{ 'Type': 'MEMORY', 'Value.$': '$.asdf' }], - }, - }, - }); -}); - -test('supports passing task input into payload', () => { - // WHEN - const task = new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobQueueArn: batchJobQueue.jobQueueArn, - jobName: sfn.JsonPath.stringAt('$.jobName'), - payload: sfn.TaskInput.fromJsonPathAt('$.foo'), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::batch:submitJob.sync', - ], - ], - }, - End: true, - Parameters: { - 'JobDefinition': { Ref: 'JobDefinition24FFE3ED' }, - 'JobName.$': '$.jobName', - 'JobQueue': { Ref: 'JobQueueEE3AD499' }, - 'Parameters.$': '$.foo', - }, - }); -}); - -test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { - expect(() => { - new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - }); - }).toThrow( - /Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE,RUN_JOB. Received: WAIT_FOR_TASK_TOKEN/, - ); -}); - -test('Task throws if environment in containerOverrides contain env with name starting with AWS_BATCH', () => { - expect(() => { - new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - containerOverrides: { - environment: { AWS_BATCH_MY_NAME: 'MY_VALUE' }, - }, - }); - }).toThrow( - /Invalid environment variable name: AWS_BATCH_MY_NAME. Environment variable names starting with 'AWS_BATCH' are reserved./, - ); -}); - -test('Task throws if arraySize is out of limits 2-10000', () => { - expect(() => { - new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: 1, - }); - }).toThrow( - /arraySize must be between 2 and 10,000/, - ); - - expect(() => { - new BatchSubmitJob(stack, 'Task2', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - arraySize: 10001, - }); - }).toThrow( - /arraySize must be between 2 and 10,000/, - ); -}); - -test('Task throws if dependencies exceeds 20', () => { - expect(() => { - new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - dependsOn: [...Array(21).keys()].map(i => ({ - jobId: `${i}`, - type: `some_type-${i}`, - })), - }); - }).toThrow( - /dependencies must be 20 or less/, - ); -}); - -test('Task throws if attempts is out of limits 1-10', () => { - expect(() => { - new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - attempts: 0, - }); - }).toThrow( - /attempts must be between 1 and 10/, - ); - - expect(() => { - new BatchSubmitJob(stack, 'Task2', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - attempts: 11, - }); - }).toThrow( - /attempts must be between 1 and 10/, - ); -}); - -test('Task throws if attempt duration is less than 60 sec', () => { - expect(() => { - new BatchSubmitJob(stack, 'Task', { - jobDefinitionArn: batchJobDefinition.jobDefinitionArn, - jobName: 'JobName', - jobQueueArn: batchJobQueue.jobQueueArn, - taskTimeout: sfn.Timeout.duration(cdk.Duration.seconds(59)), - }); - }).toThrow( - /attempt duration must be greater than 60 seconds./, - ); -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.ts deleted file mode 100644 index 056d97535a81e..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/integ.start-job-run.ts +++ /dev/null @@ -1,124 +0,0 @@ -import * as databrew from '@aws-cdk/aws-databrew'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { GlueDataBrewStartJobRun } from '../../lib'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --state-machine-arn : should return execution arn - * * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED - */ - -class GlueDataBrewJobStack extends cdk.Stack { - constructor(scope: cdk.App, id: string, props: cdk.StackProps = {}) { - super(scope, id, props); - - const region = this.region; - - const outputBucket = new s3.Bucket(this, 'JobOutputBucket', { - removalPolicy: cdk.RemovalPolicy.DESTROY, - }); - - const role = new iam.Role(this, 'DataBrew Role', { - managedPolicies: [{ - managedPolicyArn: 'arn:aws:iam::aws:policy/service-role/AWSGlueDataBrewServiceRole', - }], - path: '/', - assumedBy: new iam.ServicePrincipal('databrew.amazonaws.com'), - inlinePolicies: { - DataBrewPolicy: iam.PolicyDocument.fromJson({ - Statement: [{ - Effect: 'Allow', - Action: [ - 's3:GetObject', - 's3:PutObject', - 's3:DeleteObject', - 's3:ListBucket', - ], - Resource: [ - `arn:aws:s3:::databrew-public-datasets-${region}/*`, - `arn:aws:s3:::databrew-public-datasets-${region}`, - `${outputBucket.bucketArn}/*`, - `${outputBucket.bucketArn}`, - ], - }], - }), - }, - }); - - const recipe = new databrew.CfnRecipe(this, 'DataBrew Recipe', { - name: 'recipe-1', - steps: [ - { - action: { - operation: 'UPPER_CASE', - parameters: { - sourceColumn: 'description', - }, - }, - }, - { - action: { - operation: 'DELETE', - parameters: { - sourceColumn: 'doc_id', - }, - }, - }, - ], - }); - - const dataset = new databrew.CfnDataset(this, 'DataBrew Dataset', { - input: { - s3InputDefinition: { - bucket: `databrew-public-datasets-${region}`, - key: 'votes.csv', - }, - }, - name: 'dataset-1', - }); - - const project = new databrew.CfnProject(this, 'DataBrew Project', { - name: 'project-1', - roleArn: role.roleArn, - datasetName: dataset.name, - recipeName: recipe.name, - }); - project.addDependency(dataset); - project.addDependency(recipe); - - const job = new databrew.CfnJob(this, 'DataBrew Job', { - name: 'job-1', - type: 'RECIPE', - projectName: project.name, - roleArn: role.roleArn, - outputs: [{ - location: { - bucket: outputBucket.bucketName, - }, - }], - }); - job.addDependency(project); - - const startGlueDataBrewJob = new GlueDataBrewStartJobRun(this, 'Start DataBrew Job run', { - name: job.name, - }); - - const chain = sfn.Chain.start(startGlueDataBrewJob); - - const sm = new sfn.StateMachine(this, 'StateMachine', { - definition: chain, - timeout: cdk.Duration.seconds(30), - }); - - new cdk.CfnOutput(this, 'stateMachineArn', { - value: sm.stateMachineArn, - }); - } -} - -const app = new cdk.App(); -new GlueDataBrewJobStack(app, 'aws-stepfunctions-tasks-databrew-start-job-run-integ'); -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/start-job-run.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/start-job-run.test.ts deleted file mode 100644 index 706ea92041d7a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/databrew/start-job-run.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { GlueDataBrewStartJobRun } from '../../lib/databrew/start-job-run'; - -describe('Start Job Run', () => { - - test('default settings', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const task = new GlueDataBrewStartJobRun(stack, 'JobRun', { - name: 'jobName', - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::databrew:startJobRun', - ], - ], - }, - End: true, - Parameters: { - Name: 'jobName', - }, - }); - }); - - test('create job with input from task', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const task = new GlueDataBrewStartJobRun(stack, 'JobRun', { - name: sfn.JsonPath.stringAt('$.Name'), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::databrew:startJobRun', - ], - ], - }, - End: true, - Parameters: { - 'Name.$': '$.Name', - }, - }); - }); - - test('sync integrationPattern', () => { - // GIVEN - const stack = new cdk.Stack(); - - // WHEN - const task = new GlueDataBrewStartJobRun(stack, 'JobRun', { - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - name: 'jobName', - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::databrew:startJobRun.sync', - ], - ], - }, - End: true, - Parameters: { - Name: 'jobName', - }, - }); - }); - - - test('wait_for_task_token integrationPattern throws an error', () => { - // GIVEN - const stack = new cdk.Stack(); - - expect(() => { - new GlueDataBrewStartJobRun(stack, 'JobRun', { - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - name: 'jobName', - }); - }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE,RUN_JOB. Received: WAIT_FOR_TASK_TOKEN/i); - }); -}); - diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQUMvRTtRQUVELE9BQU8sSUFBSSxDQUFDLGtCQUFrQixDQUFDO0tBQ2hDO0lBS0QsWUFBWSxHQUFjLEVBQUUsS0FBb0I7UUFDOUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0F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2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQU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RUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWS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YXR1cyA9IGRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZS5mYXJnYXRlUHJvZmlsZT8uc3RhdHVzO1xuXG4gICAgICBpZiAoc3RhdHVzID09PSAnQ1JFQVRFX0ZBSUxFRCcgfHwgc3RhdHVzID09PSAnREVMRVRFX0ZBSUxFRCcpIHtcbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKHN0YXR1cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzdGF0dXM7XG4gICAgfSBjYXRjaCAoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ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stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/integ.call.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.ts deleted file mode 100644 index 98e054588d858..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v1-policy.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { App, Stack } from '@aws-cdk/core'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { EmrCreateCluster } from '../../lib'; - -const app = new App(); - -const stack = new Stack(app, 'aws-cdk-emr-create-cluster'); - -new EmrCreateCluster(stack, 'EmrCreateCluster', { - instances: {}, - name: 'Cluster', - integrationPattern: sfn.IntegrationPattern.RUN_JOB, -}); - -new IntegTest(app, 'EmrCreateClusterTest', { - testCases: [stack], -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.ts deleted file mode 100644 index b41d766e42c50..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/integ.emr-create-cluster-with-v2-policy.ts +++ /dev/null @@ -1,26 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { App, Stack } from '@aws-cdk/core'; -// eslint-disable-next-line import/no-extraneous-dependencies -import { ENABLE_EMR_SERVICE_POLICY_V2 } from '@aws-cdk/cx-api'; -import { IntegTest } from '@aws-cdk/integ-tests'; -import { EmrCreateCluster } from '../../lib'; - -const enableEmrServicePolicyV2 = { [ENABLE_EMR_SERVICE_POLICY_V2]: true }; - -const app = new App({ - context: enableEmrServicePolicyV2, -}); - -const stack = new Stack(app, 'aws-cdk-emr-create-cluster'); - -new EmrCreateCluster(stack, 'EmrCreateCluster', { - instances: {}, - name: 'Cluster', - integrationPattern: sfn.IntegrationPattern.RUN_JOB, -}); - -new IntegTest(app, 'EmrCreateClusterTest', { - testCases: [stack], -}); - -app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQUFxRTtBQUVyRSxNQUFNLG9CQUFvQixHQUFHLEdBQUcsQ0FBQztBQUVqQyxNQUFhLHNCQUF1QixTQUFRLHdCQUFlO0lBQ3pELElBQVcsV0FBVztRQUNwQixJQUFJLENBQUMsSUFBSSxDQUFDLGtCQUFrQixFQUFFO1lBQzVCLE1BQU0sSUFBSSxLQUFLLENBQUMsNERBQTRELENBQUMsQ0FBQztTQUMvRTtRQUVELE9BQU8sSUFBSSxDQUFDLGtCQUFrQixDQUFDO0tBQ2hDO0lBS0QsWUFBWSxHQUFjLEVBQUUsS0FBb0I7UUFDOUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUVsQixJQUFJLENBQUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLGtCQUFrQixDQUFDLENBQUM7UUFDMUQsSUFBSSxDQUFDLFFBQVEsR0FBRyxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7S0FDL0Y7SUFFRCxTQUFTO0lBQ1QsU0FBUztJQUNULFNBQVM7SUFFQyxLQUFLLENBQUMsUUFBUTtRQUN0QixPQUFPLENBQUMsR0FBRyxDQUFDLDBDQUEwQyxFQUFFLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRSxTQUFTLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0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2VzczpcbiAgICAgIG5ld1ZwY1Byb3BzLmVuZHBvaW50UHJpdmF0ZUFjY2VzcyAhPT0gb2xkVnBjUHJvcHMuZW5kcG9pbnRQcml2YXRlQWNjZXNzIHx8XG4gICAgICBuZXdWcGNQcm9wcy5lbmRwb2ludFB1YmxpY0FjY2VzcyAhPT0gb2xkVnBjUHJvcHMuZW5kcG9pbnRQdWJsaWNBY2Nlc3MgfHxcbiAgICAgICFzZXRzRXF1YWwobmV3UHVibGljQWNjZXNzQ2lkcnMsIG9sZFB1YmxpY0FjY2Vzc0NpZHJzKSxcbiAgICByZXBsYWNlUm9sZTogbmV3UHJvcHMucm9sZUFybiAhPT0gb2xkUHJvcHMucm9sZUFybixcbiAgICB1cGRhdGVWZXJzaW9uOiBuZXdQcm9wcy52ZXJzaW9uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLENBQUMsa0JBQWtCLEdBQUksS0FBYSxDQUFDLGtCQUFrQixDQUFDO1FBQzVELElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO1FBRW5CLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxhQUFhLENBQUM7UUFDNUQsSUFBSSxDQUFDLFlBQVksRUFBRTtZQUNqQixNQUFNLElBQUksS0FBSyxDQUFDLGdDQUFnQyxDQUFDLENBQ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d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQU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yKHN0YXR1cyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzdGF0dXM7XG4gICAgfSBjYXRjaCAoZGVzY3JpYmVGYXJnYXRlUHJvZmlsZUVycm9yOiBhbnkpIHtcbiAgICAgIGlmIChkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IuY29kZSA9PT0gJ1Jlc291cmNlTm90Rm91bmRFeGNlcHRpb24nKSB7XG4gICAgICAgIHRoaXMubG9nKCdyZWNlaXZlZCBSZXNvdXJjZU5vdEZvdW5kRXhjZXB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksR0FBd0IsQ0FBQztBQUU3QixNQUFNLGdCQUFnQixHQUFjO0lBQ2xDLGFBQWEsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQUFDLGFBQWEsQ0FBQy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mlkZXIub25FdmVudCgpO1xufVxuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gaXNDb21wbGV0ZShldmVudDogQVdTTGFtYmRhLkNsb3VkRm9ybWF0aW9uQ3VzdG9tUmVzb3VyY2VFdmVudCk6IFByb21pc2U8SXNDb21wbGV0ZVJlc3BvbnNlPiB7XG4gIGNvbnN0IHByb3ZpZGVyID0gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50KTtcbiAgcmV0dXJuIHByb3ZpZGVyLmlzQ29tcGxldGUoKTtcbn1cblxuZnVuY3Rpb24gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.job-submission-workflow.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts deleted file mode 100644 index 0c33e131a1887..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; -export declare class ClusterResourceHandler extends ResourceHandler { - get clusterName(): string; - private readonly newProps; - private readonly oldProps; - constructor(eks: EksClient, event: ResourceEvent); - protected onCreate(): Promise; - protected isCreateComplete(): Promise; - protected onDelete(): Promise; - protected isDeleteComplete(): Promise; - protected onUpdate(): Promise; - protected isUpdateComplete(): Promise; - private updateClusterVersion; - private isActive; - private isEksUpdateComplete; - private generateClusterName; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js deleted file mode 100644 index 40c8afaa9129c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.js +++ /dev/null @@ -1,273 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ClusterResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_CLUSTER_NAME_LEN = 100; -class ClusterResourceHandler extends common_1.ResourceHandler { - get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - return this.physicalResourceId; - } - constructor(eks, event) { - super(eks, event); - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - // ------ - // CREATE - // ------ - async onCreate() { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - const clusterName = this.newProps.name || this.generateClusterName(); - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - return { - PhysicalResourceId: resp.cluster.name, - }; - } - async isCreateComplete() { - return this.isActive(); - } - // ------ - // DELETE - // ------ - async onDelete() { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } - catch (e) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } - else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - async isDeleteComplete() { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } - catch (e) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - console.log('describeCluster error:', e); - throw e; - } - return { - IsComplete: false, - }; - } - // ------ - // UPDATE - // ------ - async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - return this.onCreate(); - } - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - return this.updateClusterVersion(this.newProps.version); - } - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - if (updates.updateLogging || updates.updateAccess) { - const config = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - } - ; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - return { EksUpdateId: updateResponse.update?.id }; - } - // no updates - return; - } - async isUpdateComplete() { - console.log('isUpdateComplete'); - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - return this.isActive(); - } - async updateClusterVersion(newVersion) { - console.log(`updating cluster version to ${newVersion}`); - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - async isActive() { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } - else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } - else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - async isEksUpdateComplete(eksUpdateId) { - this.log({ isEksUpdateComplete: eksUpdateId }); - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - this.log({ describeUpdateResponse }); - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} -exports.ClusterResourceHandler = ClusterResourceHandler; -function parseProps(props) { - const parsed = props?.Config ?? {}; - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - return parsed; -} -function analyzeUpdate(oldProps, newProps) { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} -function setsEqual(first, second) { - return first.size === second.size && [...first].every((e) => second.has(e)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2x1c3Rlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImNsdXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBTS9CLHFDQ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BY2Nlc3MgfHxcbiAgICAgICFzZXRzRXF1YWwobmV3UHVibGljQWNjZXNzQ2lkcnMsIG9sZFB1YmxpY0FjY2Vzc0NpZHJzKSxcbiAgICByZXBsYWNlUm9sZTogbmV3UHJvcHMucm9sZUFybiAhPT0gb2xkUHJvcHMucm9sZUFybixcbiAgICB1cGRhdGVWZXJzaW9uOiBuZXdQcm9wcy52ZXJzaW9uICE9PSBvbGRQcm9wcy52ZXJzaW9uLFxuICAgIHVwZGF0ZUVuY3J5cHRpb246IEpTT04uc3RyaW5naWZ5KG5ld0VuYykgIT09IEpTT04uc3RyaW5naWZ5KG9sZEVuYyksXG4gICAgdXBkYXRlTG9nZ2luZzogSlNPTi5zdHJpbmdpZnkobmV3UHJvcHMubG9nZ2luZykgIT09IEpTT04uc3RyaW5naWZ5KG9sZFByb3BzLmxvZ2dpbmcpLFxuICB9O1xufVxuXG5mdW5jdGlvbiBzZXRzRXF1YWwoZmlyc3Q6IFNldDxzdHJpbmc+LCBzZWNvbmQ6IFNldDxzdHJpbmc+KSB7XG4gIHJldHVybiBmaXJzdC5zaXplID09PSBzZWNvbmQuc2l6ZSAmJiBbLi4uZmlyc3RdLmV2ZXJ5KChlOiBzdHJpbmcpID0+IHNlY29uZC5oYXMoZSkpO1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts deleted file mode 100644 index 9be494d195380..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/cluster.ts +++ /dev/null @@ -1,344 +0,0 @@ -/* eslint-disable no-console */ - -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { EksClient, ResourceEvent, ResourceHandler } from './common'; - -const MAX_CLUSTER_NAME_LEN = 100; - -export class ClusterResourceHandler extends ResourceHandler { - public get clusterName() { - if (!this.physicalResourceId) { - throw new Error('Cannot determine cluster name without physical resource ID'); - } - - return this.physicalResourceId; - } - - private readonly newProps: aws.EKS.CreateClusterRequest; - private readonly oldProps: Partial; - - constructor(eks: EksClient, event: ResourceEvent) { - super(eks, event); - - this.newProps = parseProps(this.event.ResourceProperties); - this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; - } - - // ------ - // CREATE - // ------ - - protected async onCreate(): Promise { - console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); - if (!this.newProps.roleArn) { - throw new Error('"roleArn" is required'); - } - - const clusterName = this.newProps.name || this.generateClusterName(); - - const resp = await this.eks.createCluster({ - ...this.newProps, - name: clusterName, - }); - - if (!resp.cluster) { - throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); - } - - return { - PhysicalResourceId: resp.cluster.name, - }; - } - - protected async isCreateComplete() { - return this.isActive(); - } - - // ------ - // DELETE - // ------ - - protected async onDelete(): Promise { - console.log(`onDelete: deleting cluster ${this.clusterName}`); - try { - await this.eks.deleteCluster({ name: this.clusterName }); - } catch (e: any) { - if (e.code !== 'ResourceNotFoundException') { - throw e; - } else { - console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); - } - } - return { - PhysicalResourceId: this.clusterName, - }; - } - - protected async isDeleteComplete(): Promise { - console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); - - try { - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); - } catch (e: any) { - if (e.code === 'ResourceNotFoundException') { - console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); - return { IsComplete: true }; - } - - console.log('describeCluster error:', e); - throw e; - } - - return { - IsComplete: false, - }; - } - - // ------ - // UPDATE - // ------ - - protected async onUpdate() { - const updates = analyzeUpdate(this.oldProps, this.newProps); - console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); - - // updates to encryption config is not supported - if (updates.updateEncryption) { - throw new Error('Cannot update cluster encryption configuration'); - } - - // if there is an update that requires replacement, go ahead and just create - // a new cluster with the new config. The old cluster will automatically be - // deleted by cloudformation upon success. - if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { - - // if we are replacing this cluster and the cluster has an explicit - // physical name, the creation of the new cluster will fail with "there is - // already a cluster with that name". this is a common behavior for - // CloudFormation resources that support specifying a physical name. - if (this.oldProps.name === this.newProps.name && this.oldProps.name) { - throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); - } - - return this.onCreate(); - } - - // if a version update is required, issue the version update - if (updates.updateVersion) { - if (!this.newProps.version) { - throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); - } - - return this.updateClusterVersion(this.newProps.version); - } - - if (updates.updateLogging && updates.updateAccess) { - throw new Error('Cannot update logging and access at the same time'); - } - - if (updates.updateLogging || updates.updateAccess) { - const config: aws.EKS.UpdateClusterConfigRequest = { - name: this.clusterName, - }; - if (updates.updateLogging) { - config.logging = this.newProps.logging; - }; - if (updates.updateAccess) { - // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: - // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) - // will fail, therefore we take only the access fields explicitly - config.resourcesVpcConfig = { - endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, - endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, - publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, - }; - } - const updateResponse = await this.eks.updateClusterConfig(config); - - return { EksUpdateId: updateResponse.update?.id }; - } - - // no updates - return; - } - - protected async isUpdateComplete() { - console.log('isUpdateComplete'); - - // if this is an EKS update, we will monitor the update event itself - if (this.event.EksUpdateId) { - const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); - if (!complete) { - return { IsComplete: false }; - } - - // fall through: if the update is done, we simply delegate to isActive() - // in order to extract attributes and state from the cluster itself, which - // is supposed to be in an ACTIVE state after the update is complete. - } - - return this.isActive(); - } - - private async updateClusterVersion(newVersion: string) { - console.log(`updating cluster version to ${newVersion}`); - - // update-cluster-version will fail if we try to update to the same version, - // so skip in this case. - const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; - if (cluster?.version === newVersion) { - console.log(`cluster already at version ${cluster.version}, skipping version update`); - return; - } - - const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); - return { EksUpdateId: updateResponse.update?.id }; - } - - private async isActive(): Promise { - console.log('waiting for cluster to become ACTIVE'); - const resp = await this.eks.describeCluster({ name: this.clusterName }); - console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); - const cluster = resp.cluster; - - // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are - // not complete. note that the custom resource provider framework forbids - // returning attributes (Data) if isComplete is false. - if (cluster?.status === 'FAILED') { - // not very informative, unfortunately the response doesn't contain any error - // information :\ - throw new Error('Cluster is in a FAILED status'); - } else if (cluster?.status !== 'ACTIVE') { - return { - IsComplete: false, - }; - } else { - return { - IsComplete: true, - Data: { - Name: cluster.name, - Endpoint: cluster.endpoint, - Arn: cluster.arn, - - // IMPORTANT: CFN expects that attributes will *always* have values, - // so return an empty string in case the value is not defined. - // Otherwise, CFN will throw with `Vendor response doesn't contain - // XXXX key`. - - CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', - ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', - OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', - OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url - - // We can safely return the first item from encryption configuration array, because it has a limit of 1 item - // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig - EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', - }, - }; - } - } - - private async isEksUpdateComplete(eksUpdateId: string) { - this.log({ isEksUpdateComplete: eksUpdateId }); - - const describeUpdateResponse = await this.eks.describeUpdate({ - name: this.clusterName, - updateId: eksUpdateId, - }); - - this.log({ describeUpdateResponse }); - - if (!describeUpdateResponse.update) { - throw new Error(`unable to describe update with id "${eksUpdateId}"`); - } - - switch (describeUpdateResponse.update.status) { - case 'InProgress': - return false; - case 'Successful': - return true; - case 'Failed': - case 'Cancelled': - throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); - default: - throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); - } - } - - private generateClusterName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } -} - -function parseProps(props: any): aws.EKS.CreateClusterRequest { - - const parsed = props?.Config ?? {}; - - // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. - // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' - - if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; - } - - if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { - parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; - } - - if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { - parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; - } - - return parsed; - -} - -interface UpdateMap { - replaceName: boolean; // name - replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds - replaceRole: boolean; // roleArn - - updateVersion: boolean; // version - updateLogging: boolean; // logging - updateEncryption: boolean; // encryption (cannot be updated) - updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess -} - -function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { - console.log('old props: ', JSON.stringify(oldProps)); - console.log('new props: ', JSON.stringify(newProps)); - - const newVpcProps = newProps.resourcesVpcConfig || {}; - const oldVpcProps = oldProps.resourcesVpcConfig || {}; - - const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); - const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); - const newEnc = newProps.encryptionConfig || {}; - const oldEnc = oldProps.encryptionConfig || {}; - - return { - replaceName: newProps.name !== oldProps.name, - replaceVpc: - JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || - JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), - updateAccess: - newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || - newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || - !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), - replaceRole: newProps.roleArn !== oldProps.roleArn, - updateVersion: newProps.version !== oldProps.version, - updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), - updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), - }; -} - -function setsEqual(first: Set, second: Set) { - return first.size === second.size && [...first].every((e: string) => second.has(e)); -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts deleted file mode 100644 index 616b4b49cc379..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -import * as aws from 'aws-sdk'; -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string; -} -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; -export declare abstract class ResourceHandler { - protected readonly eks: EksClient; - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - constructor(eks: EksClient, event: ResourceEvent); - onEvent(): Promise; - isComplete(): Promise; - protected log(x: any): void; - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js deleted file mode 100644 index 663280d84b97a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ResourceHandler = void 0; -class ResourceHandler { - constructor(eks, event) { - this.eks = eks; - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = event.PhysicalResourceId; - this.event = event; - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - throw new Error(`Invalid request type ${this.requestType}`); - } - log(x) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } -} -exports.ResourceHandler = ResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29tbW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQWlCQSxNQUFzQixlQUFlO0lBT25DLFlBQStCLEdBQWMsRUFBRSxLQUFvQjtRQUFwQyxRQUFHLEdBQUgsR0FBRyxDQUFXO1FBQzNDLElBQUksQ0FBQyxXQUFXLEdBQUcsS0FBSyxDQUFDLFdBQVcsQ0FBQztRQUNyQyxJQUFJLENBQUMsU0FBUyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUM7UUFDakMsSUFBSSxDQUFDLGlCQUFpQixHQUFHLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQztRQUNqRCxJQUFJLENBQUMsa0JBQWtCLEdBQUksS0FBYSxDQUFDLGtCQUFrQixDQUFDO1FBQzVELElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDO1FBRW5CLE1BQU0sWUFBWSxHQUFHLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxhQUFhLENBQUM7UUFDNUQsSUFBSSxDQUFDLFlBQVksRUFBRTtZQUNqQixNQUFNLElBQUksS0FBSyxDQUFDLGdDQUFnQyxDQUFDLENBQUM7U0FDbkQ7UUFFRCxHQUFHLENBQUMsbUJBQW1CLENBQUM7WUFDdEIsT0FBTyxFQUFFLFlBQVk7WUFDckIsZUFBZSxFQUFFLHFCQUFxQixJQUFJLENBQUMsV0FBVyxJQUFJLElBQUksQ0FBQyxTQUFTLEVBQUU7U0FDM0UsQ0FBQyxDQUFDO0tBQ0o7SUFFTSxPQUFPO1FBQ1osUUFBUSxJQUFJLENBQUMsV0FBVyxFQ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3RlclZlcnNpb25SZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLlVwZGF0ZUNsdXN0ZXJWZXJzaW9uUmVzcG9uc2U+O1xuICBkZXNjcmliZVVwZGF0ZShyZXE6IGF3cy5FS1MuRGVzY3JpYmVVcGRhdGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlVXBkYXRlUmVzcG9uc2U+O1xuICBjcmVhdGVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkNyZWF0ZUZhcmdhdGVQcm9maWxlUmVxdWVzdCk6IFByb21pc2U8YXdzLkVLUy5DcmVhdGVGYXJnYXRlUHJvZmlsZVJlc3BvbnNlPjtcbiAgZGVzY3JpYmVGYXJnYXRlUHJvZmlsZShyZXF1ZXN0OiBhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlc2NyaWJlRmFyZ2F0ZVByb2ZpbGVSZXNwb25zZT47XG4gIGRlbGV0ZUZhcmdhdGVQcm9maWxlKHJlcXVlc3Q6IGF3cy5FS1MuRGVsZXRlRmFyZ2F0ZVByb2ZpbGVSZXF1ZXN0KTogUHJvbWlzZTxhd3MuRUtTLkRlbGV0ZUZhcmdhdGVQcm9maWxlUmVzcG9uc2U+O1xufVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts deleted file mode 100644 index e308ef12c6d1b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/common.ts +++ /dev/null @@ -1,87 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse, OnEventResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; - -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; - -export interface EksUpdateId { - /** - * If this field is included in an event passed to "IsComplete", it means we - * initiated an EKS update that should be monitored using eks:DescribeUpdate - * instead of just looking at the cluster status. - */ - EksUpdateId?: string -} - -export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; - -export abstract class ResourceHandler { - protected readonly requestId: string; - protected readonly logicalResourceId: string; - protected readonly requestType: 'Create' | 'Update' | 'Delete'; - protected readonly physicalResourceId?: string; - protected readonly event: ResourceEvent; - - constructor(protected readonly eks: EksClient, event: ResourceEvent) { - this.requestType = event.RequestType; - this.requestId = event.RequestId; - this.logicalResourceId = event.LogicalResourceId; - this.physicalResourceId = (event as any).PhysicalResourceId; - this.event = event; - - const roleToAssume = event.ResourceProperties.AssumeRoleArn; - if (!roleToAssume) { - throw new Error('AssumeRoleArn must be provided'); - } - - eks.configureAssumeRole({ - RoleArn: roleToAssume, - RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, - }); - } - - public onEvent() { - switch (this.requestType) { - case 'Create': return this.onCreate(); - case 'Update': return this.onUpdate(); - case 'Delete': return this.onDelete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - public isComplete() { - switch (this.requestType) { - case 'Create': return this.isCreateComplete(); - case 'Update': return this.isUpdateComplete(); - case 'Delete': return this.isDeleteComplete(); - } - - throw new Error(`Invalid request type ${this.requestType}`); - } - - protected log(x: any) { - // eslint-disable-next-line no-console - console.log(JSON.stringify(x, undefined, 2)); - } - - protected abstract onCreate(): Promise; - protected abstract onDelete(): Promise; - protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; - protected abstract isCreateComplete(): Promise; - protected abstract isDeleteComplete(): Promise; - protected abstract isUpdateComplete(): Promise; -} - -export interface EksClient { - configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; - createCluster(request: aws.EKS.CreateClusterRequest): Promise; - deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; - describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; - updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; - updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; - describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; - createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; - describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; - deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts deleted file mode 100644 index adf5af28c3a92..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const CLUSTER_RESOURCE_TYPE = "Custom::AWSCDK-EKS-Cluster"; -export declare const FARGATE_PROFILE_RESOURCE_TYPE = "Custom::AWSCDK-EKS-FargateProfile"; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js deleted file mode 100644 index 679526725fb11..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FARGATE_PROFILE_RESOURCE_TYPE = exports.CLUSTER_RESOURCE_TYPE = void 0; -exports.CLUSTER_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-Cluster'; -exports.FARGATE_PROFILE_RESOURCE_TYPE = 'Custom::AWSCDK-EKS-FargateProfile'; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY29uc3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEscUJBQXFCLEdBQUcsNEJBQTRCLENBQUM7QUFDckQsUUFBQSw2QkFBNkIsR0FBRyxtQ0FBbUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBDTFVTVEVSX1JFU09VUkNFX1RZUEUgPSAnQ3VzdG9tOjpBV1NDREstRUtTLUNsdXN0ZXInO1xuZXhwb3J0IGNvbnN0IEZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFID0gJ0N1c3RvbTo6QVdTQ0RLLUVLUy1GYXJnYXRlUHJvZmlsZSc7Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts deleted file mode 100644 index fa0567e50ee7b..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { ResourceHandler } from './common'; -export declare class FargateProfileResourceHandler extends ResourceHandler { - protected onCreate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected onDelete(): Promise; - protected onUpdate(): Promise<{ - PhysicalResourceId: string | undefined; - Data: { - fargateProfileArn: string | undefined; - }; - }>; - protected isCreateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isUpdateComplete(): Promise<{ - IsComplete: boolean; - }>; - protected isDeleteComplete(): Promise<{ - IsComplete: boolean; - }>; - /** - * Generates a fargate profile name. - */ - private generateProfileName; - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - private queryStatus; -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js deleted file mode 100644 index 34ab6ff0ba0e8..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FargateProfileResourceHandler = void 0; -const common_1 = require("./common"); -const MAX_NAME_LEN = 63; -class FargateProfileResourceHandler extends common_1.ResourceHandler { - async onCreate() { - const fargateProfileName = this.event.ResourceProperties.Config.fargateProfileName ?? this.generateProfileName(); - const createFargateProfile = { - fargateProfileName, - ...this.event.ResourceProperties.Config, - }; - this.log({ createFargateProfile }); - const createFargateProfileResponse = await this.eks.createFargateProfile(createFargateProfile); - this.log({ createFargateProfileResponse }); - if (!createFargateProfileResponse.fargateProfile) { - throw new Error('invalid CreateFargateProfile response'); - } - return { - PhysicalResourceId: createFargateProfileResponse.fargateProfile.fargateProfileName, - Data: { - fargateProfileArn: createFargateProfileResponse.fargateProfile.fargateProfileArn, - }, - }; - } - async onDelete() { - if (!this.physicalResourceId) { - throw new Error('Cannot delete a profile without a physical id'); - } - const deleteFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - this.log({ deleteFargateProfile }); - const deleteFargateProfileResponse = await this.eks.deleteFargateProfile(deleteFargateProfile); - this.log({ deleteFargateProfileResponse }); - return; - } - async onUpdate() { - // all updates require a replacement. as long as name is generated, we are - // good. if name is explicit, update will fail, which is common when trying - // to replace cfn resources with explicit physical names - return this.onCreate(); - } - async isCreateComplete() { - return this.isUpdateComplete(); - } - async isUpdateComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'ACTIVE', - }; - } - async isDeleteComplete() { - const status = await this.queryStatus(); - return { - IsComplete: status === 'NOT_FOUND', - }; - } - /** - * Generates a fargate profile name. - */ - generateProfileName() { - const suffix = this.requestId.replace(/-/g, ''); // 32 chars - const offset = MAX_NAME_LEN - suffix.length - 1; - const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); - return `${prefix}-${suffix}`; - } - /** - * Queries the Fargate profile's current status and returns the status or - * NOT_FOUND if the profile doesn't exist (i.e. it has been deleted). - */ - async queryStatus() { - if (!this.physicalResourceId) { - throw new Error('Unable to determine status for fargate profile without a resource name'); - } - const describeFargateProfile = { - clusterName: this.event.ResourceProperties.Config.clusterName, - fargateProfileName: this.physicalResourceId, - }; - try { - this.log({ describeFargateProfile }); - const describeFargateProfileResponse = await this.eks.describeFargateProfile(describeFargateProfile); - this.log({ describeFargateProfileResponse }); - const status = describeFargateProfileResponse.fargateProfile?.status; - if (status === 'CREATE_FAILED' || status === 'DELETE_FAILED') { - throw new Error(status); - } - return status; - } - catch (describeFargateProfileError) { - if (describeFargateProfileError.code === 'ResourceNotFoundException') { - this.log('received ResourceNotFoundException, this means the profile has been deleted (or never existed)'); - return 'NOT_FOUND'; - } - this.log({ describeFargateProfileError }); - throw describeFargateProfileError; - } - } -} -exports.FargateProfileResourceHandler = FargateProfileResourceHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFyZ2F0ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImZhcmdhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EscUNBQTJDO0FBRTNDLE1BQU0sWUFBWSxHQUFHLEVBQUUsQ0FBQztBQUV4QixNQUFhLDZCQUE4QixTQUFRLHdCQUFlO0lBQ3RELEtBQUssQ0FBQyxRQUFRO1FBQ3RCLE1BQU0sa0JBQWtCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNLENBQUMsa0JBQWtCLElBQUksSUFBSSxDQUFDLG1CQUFtQixFQUFFLENBQUM7UUFFakgsTUFBTSxvQkFBb0IsR0FBd0M7WUFDaEUsa0JBQWtCO1lBQ2xCLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsQ0FBQyxNQUFNO1NBQ3hDLENBQUM7UUFFRixJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsb0JBQW9CLEVBQUUsQ0FBQyxDQUFDO1FBQ25DLE1BQU0sNEJBQTRCLEdBQUcsTUFBTSxJQUFJLENBQUMsR0FBRyxDQUFDLG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XB0aW9uLCB0aGlzIG1lYW5zIHRoZSBwcm9maWxlIGhhcyBiZWVuIGRlbGV0ZWQgKG9yIG5ldmVyIGV4aXN0ZWQpJyk7XG4gICAgICAgIHJldHVybiAnTk9UX0ZPVU5EJztcbiAgICAgIH1cblxuICAgICAgdGhpcy5sb2coeyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3IgfSk7XG4gICAgICB0aHJvdyBkZXNjcmliZUZhcmdhdGVQcm9maWxlRXJyb3I7XG4gICAgfVxuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts deleted file mode 100644 index b30d111a6812f..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -export declare function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; -export declare function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js deleted file mode 100644 index b2f5f1c79a43c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isComplete = exports.onEvent = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws = require("aws-sdk"); -const cluster_1 = require("./cluster"); -const consts = require("./consts"); -const fargate_1 = require("./fargate"); -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); -let eks; -const defaultEksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - eks = new aws.EKS({ credentials: creds }); - }, -}; -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - return eks; -} -async function onEvent(event) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} -exports.onEvent = onEvent; -async function isComplete(event) { - const provider = createResourceHandler(event); - return provider.isComplete(); -} -exports.isComplete = isComplete; -function createResourceHandler(event) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new cluster_1.ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new fargate_1.FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBQy9CLHVDQUFtRDtBQUVuRCxtQ0FBbUM7QUFDbkMsdUNBQTBEO0FBRTFELG9HQUFvRztBQUNwRyxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFFMUMsR0FBRyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsT0FBTyxDQUFDO0FBQzVCLEdBQUcsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDO0lBQ2hCLFdBQVcsRUFBRSxFQUFFLEtBQUssRUFBRSxJQUFJLFVBQVUsRUFBRSxFQUFFO0NBQ3pDLENBQUMsQ0FBQztBQUVILElBQUksR0FBd0IsQ0FBQztBQUU3QixNQUFNLGdCQUFnQixHQUFjO0lBQ2xDLGFBQWEsRUFBRSxHQUFHLENBQUMsRUFBRSxDQUFDLFlBQVksRUFBRSxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLEVBQUU7SUFDakUsYUFBYSxFQUFFLEdBQUcsQ0FBQyxFQUFFLENBQUMsWUFBWSxFQUFFLENBQUMsYUFBYSxDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8sRUFBRTtJQUNqRSxlQUFlLEVBQUUsR0FBRyxDQUFDLEVBQUUsQ0FBQyxZQUFZLEVBQUUsQ0FBQyxlQUFlLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyxFQUFFO0lBQ3JFLGNBQWMsRUFBRSxHQUFHLENBQU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Rpb24gY3JlYXRlUmVzb3VyY2VIYW5kbGVyKGV2ZW50OiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZUV2ZW50KSB7XG4gIHN3aXRjaCAoZXZlbnQuUmVzb3VyY2VUeXBlKSB7XG4gICAgY2FzZSBjb25zdHMuQ0xVU1RFUl9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IENsdXN0ZXJSZXNvdXJjZUhhbmRsZXIoZGVmYXVsdEVrc0NsaWVudCwgZXZlbnQpO1xuICAgIGNhc2UgY29uc3RzLkZBUkdBVEVfUFJPRklMRV9SRVNPVVJDRV9UWVBFOiByZXR1cm4gbmV3IEZhcmdhdGVQcm9maWxlUmVzb3VyY2VIYW5kbGVyKGRlZmF1bHRFa3NDbGllbnQsIGV2ZW50KTtcbiAgICBkZWZhdWx0OlxuICAgICAgdGhyb3cgbmV3IEVycm9yKGBVbnN1cHBvcnRlZCByZXNvdXJjZSB0eXBlIFwiJHtldmVudC5SZXNvdXJjZVR5cGV9YCk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts deleted file mode 100644 index f4db036cc6e48..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/index.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable no-console */ -// eslint-disable-next-line import/no-extraneous-dependencies -import { IsCompleteResponse } from '@aws-cdk/custom-resources/lib/provider-framework/types'; -// eslint-disable-next-line import/no-extraneous-dependencies -import * as aws from 'aws-sdk'; -import { ClusterResourceHandler } from './cluster'; -import { EksClient } from './common'; -import * as consts from './consts'; -import { FargateProfileResourceHandler } from './fargate'; - -// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies -const ProxyAgent = require('proxy-agent'); - -aws.config.logger = console; -aws.config.update({ - httpOptions: { agent: new ProxyAgent() }, -}); - -let eks: aws.EKS | undefined; - -const defaultEksClient: EksClient = { - createCluster: req => getEksClient().createCluster(req).promise(), - deleteCluster: req => getEksClient().deleteCluster(req).promise(), - describeCluster: req => getEksClient().describeCluster(req).promise(), - describeUpdate: req => getEksClient().describeUpdate(req).promise(), - updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), - updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), - createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), - deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), - describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), - configureAssumeRole: req => { - console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); - const creds = new aws.ChainableTemporaryCredentials({ - params: req, - stsConfig: { stsRegionalEndpoints: 'regional' }, - }); - - eks = new aws.EKS({ credentials: creds }); - }, -}; - -function getEksClient() { - if (!eks) { - throw new Error('EKS client not initialized (call "configureAssumeRole")'); - } - - return eks; -} - -export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { - const provider = createResourceHandler(event); - return provider.onEvent(); -} - -export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { - const provider = createResourceHandler(event); - return provider.isComplete(); -} - -function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { - switch (event.ResourceType) { - case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); - case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); - default: - throw new Error(`Unsupported resource type "${event.ResourceType}`); - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.ts deleted file mode 100644 index 5e8d36fea46dd..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as eks from '@aws-cdk/aws-eks'; -import { AwsAuthMapping } from '@aws-cdk/aws-eks'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { Aws } from '@aws-cdk/core'; -import * as integ from '@aws-cdk/integ-tests'; -import { EmrContainersStartJobRun, ReleaseLabel, VirtualClusterInput } from '../../lib'; - -/** - * Stack verification steps: - * Everything in the link below must be setup before running the state machine. - * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html - * aws stepfunctions start-execution --state-machine-arn : should return execution arn - * aws stepfunctions describe-execution --execution-arn : should return status as SUCCEEDED - */ - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-stepfunctions-tasks-emr-containers-start-job-run-test'); - -const eksCluster = new eks.Cluster(stack, 'integration-test-eks-cluster', { - version: eks.KubernetesVersion.V1_21, - defaultCapacity: 3, - defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), -}); - -const virtualCluster = new cdk.CfnResource(stack, 'Virtual Cluster', { - type: 'AWS::EMRContainers::VirtualCluster', - properties: { - ContainerProvider: { - Id: eksCluster.clusterName, - Info: { - EksInfo: { - Namespace: 'default', - }, - }, - Type: 'EKS', - }, - Name: 'Virtual-Cluster-Name', - }, -}); - -const emrRole = eksCluster.addManifest('emrRole', { - apiVersion: 'rbac.authorization.k8s.io/v1', - kind: 'Role', - metadata: { name: 'emr-containers', namespace: 'default' }, - rules: [ - { apiGroups: [''], resources: ['namespaces'], verbs: ['get'] }, - { apiGroups: [''], resources: ['serviceaccounts', 'services', 'configmaps', 'events', 'pods', 'pods/log'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'deletecollection', 'annotate', 'patch', 'label'] }, - { apiGroups: [''], resources: ['secrets'], verbs: ['create', 'patch', 'delete', 'watch'] }, - { apiGroups: ['apps'], resources: ['statefulsets', 'deployments'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, - { apiGroups: ['batch'], resources: ['jobs'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, - { apiGroups: ['extensions'], resources: ['ingresses'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'annotate', 'patch', 'label'] }, - { apiGroups: ['rbac.authorization.k8s.io'], resources: ['roles', 'rolebindings'], verbs: ['get', 'list', 'watch', 'describe', 'create', 'edit', 'delete', 'deletecollection', 'annotate', 'patch', 'label'] }, - ], -}); - -const emrRoleBind = eksCluster.addManifest('emrRoleBind', { - apiVersion: 'rbac.authorization.k8s.io/v1', - kind: 'RoleBinding', - metadata: { name: 'emr-containers', namespace: 'default' }, - subjects: [{ kind: 'User', name: 'emr-containers', apiGroup: 'rbac.authorization.k8s.io' }], - roleRef: { kind: 'Role', name: 'emr-containers', apiGroup: 'rbac.authorization.k8s.io' }, -}); - -emrRoleBind.node.addDependency(emrRole); - -const emrServiceRole = iam.Role.fromRoleArn(stack, 'emrServiceRole', 'arn:aws:iam::'+Aws.ACCOUNT_ID+':role/AWSServiceRoleForAmazonEMRContainers'); -const authMapping: AwsAuthMapping = { groups: [], username: 'emr-containers' }; -eksCluster.awsAuth.addRoleMapping(emrServiceRole, authMapping); - -virtualCluster.node.addDependency(emrRoleBind); -virtualCluster.node.addDependency(eksCluster.awsAuth); - -const startJobRunJob = new EmrContainersStartJobRun(stack, 'Start a Job Run', { - virtualCluster: VirtualClusterInput.fromVirtualClusterId(virtualCluster.getAtt('Id').toString()), - releaseLabel: ReleaseLabel.EMR_6_2_0, - jobName: 'EMR-Containers-Job', - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - entryPointArguments: sfn.TaskInput.fromObject(['2']), - sparkSubmitParameters: '--conf spark.driver.memory=512M --conf spark.kubernetes.driver.request.cores=0.2 --conf spark.kubernetes.executor.request.cores=0.2 --conf spark.sql.shuffle.partitions=60 --conf spark.dynamicAllocation.enabled=false', - }, - }, -}); - -const chain = sfn.Chain.start(startJobRunJob); - -const sm = new sfn.StateMachine(stack, 'StateMachine', { - definition: chain, - timeout: cdk.Duration.seconds(1000), -}); - -new cdk.CfnOutput(stack, 'stateMachineArn', { - value: sm.stateMachineArn, -}); - -new integ.IntegTest(app, 'aws-stepfunctions-tasks-emr-containers-start-job-run', { - testCases: [stack], - cdkCommandOptions: { - deploy: { - args: { - rollback: true, - }, - }, - }, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/start-job-run.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/start-job-run.test.ts deleted file mode 100644 index 654ac652ced98..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/start-job-run.test.ts +++ /dev/null @@ -1,1068 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; -import { EmrContainersStartJobRun, VirtualClusterInput, ReleaseLabel, ApplicationConfiguration, Classification, EmrContainersStartJobRunProps } from '../../lib/emrcontainers/start-job-run'; - -let stack: Stack; -let clusterId: string; -let defaultProps: EmrContainersStartJobRunProps; - -beforeEach(() => { - stack = new Stack(); - clusterId = 'clusterId'; - defaultProps = { - virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromText(clusterId)), - releaseLabel: ReleaseLabel.EMR_6_2_0, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), - sparkSubmitParameters: '--conf spark.executor.instances=2', - }, - }, - }; -}); - -describe('Invoke EMR Containers Start Job Run with ', () => { - test('Request/Response integration pattern', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::emr-containers:startJobRun', - ], - ], - }, - }); - }); - - test('.sync integration pattern', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', defaultProps); - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::emr-containers:startJobRun.sync', - ], - ], - }, - }); - }); - - test('virtual cluster id from payload', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.ClusterId')), - executionRole: iam.Role.fromRoleArn(stack, 'Job Execution Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - 'VirtualClusterId.$': '$.ClusterId', - 'ExecutionRoleArn': 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole', - }, - }); - }); - - test('Tags', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - tags: { - key: 'value', - }, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - Tags: { - key: 'value', - }, - }, - }); - }); - - - test('Application Configuration', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - applicationConfig: [{ - classification: Classification.SPARK_DEFAULTS, - properties: { - 'spark.executor.instances': '1', - 'spark.executor.memory': '512M', - }, - }], - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - ConfigurationOverrides: { - ApplicationConfiguration: [{ - Classification: Classification.SPARK_DEFAULTS.classificationStatement, - Properties: { - 'spark.executor.instances': '1', - 'spark.executor.memory': '512M', - }, - }], - }, - }, - }); - }); - - test('Application Configuration with nested app config and no properties', () => { - const properties: { [key: string]: string } = { HADOOP_DATANODE_HEAPSIZE: '2048', HADOOP_NAMENODE_OPTS: '-XX:GCTimeRatio=19' }; - const struct = { classification: new Classification('export'), properties: properties }; - const appConfigNested: ApplicationConfiguration[] = [struct]; - - const mainConfig = { classification: new Classification('hadoop-env'), nestedConfig: appConfigNested }; - const appConfig: ApplicationConfiguration[] = [mainConfig]; - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - applicationConfig: appConfig, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - ConfigurationOverrides: { - ApplicationConfiguration: [{ - Classification: 'hadoop-env', - Configurations: [{ - Classification: 'export', - Properties: { - HADOOP_DATANODE_HEAPSIZE: '2048', - HADOOP_NAMENODE_OPTS: '-XX:GCTimeRatio=19', - }, - }], - }], - }, - }, - }); - }); - - test('Job Driver with Entry Point Arguments', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('entrypoint'), - entryPointArguments: sfn.TaskInput.fromJsonPathAt('$.entrypointArguments'), - }, - }, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - JobDriver: { - SparkSubmitJobDriver: { - 'EntryPoint': 'entrypoint', - 'EntryPointArguments.$': '$.entrypointArguments', - }, - }, - }, - }); - }); - - test('Job Execution Role', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - executionRole: iam.Role.fromRoleArn(stack, 'Job Execution Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - ExecutionRoleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole', - }, - }); - - // THEN - Template.fromStack(stack).resourceCountIs('AWS::CloudFormation::CustomResource', 0); - }); - - test('Virtual Cluster Input from virtualClusterId', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - virtualCluster: VirtualClusterInput.fromVirtualClusterId(clusterId), - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - VirtualClusterId: clusterId, - }, - }); - }); - - describe('Invoke EMR Containers Start Job Run with Monitoring ', () => { - test('generated automatically', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - monitoring: { - logging: true, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - 's3:DeleteObject*', - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Resource: [ - { - 'Fn::GetAtt': [ - 'EMRContainersStartJobRunMonitoringBucket8BB3FC54', - 'Arn', - ], - }, - { - 'Fn::Join': [ - '', - [ - { - 'Fn::GetAtt': [ - 'EMRContainersStartJobRunMonitoringBucket8BB3FC54', - 'Arn', - ], - }, - '/*', - ], - ], - }, - ], - }, - { - Action: [ - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EMRContainersStartJobRunMonitoringLogGroup882D450C', - 'Arn', - ], - }, - }, - { - Action: 'logs:DescribeLogStreams', - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'EMRContainersStartJobRunMonitoringLogGroup882D450C', - 'Arn', - ], - }, - }, - { - Action: 'logs:DescribeLogGroups', - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':logs:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':*', - ], - ], - }, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'EMRContainersStartJobRunJobExecutionRoleDefaultPolicyCDBDF13E', - Roles: [ - { - Ref: 'EMRContainersStartJobRunJobExecutionRole40B8DD81', - }, - ], - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - ConfigurationOverrides: { - MonitoringConfiguration: { - CloudWatchMonitoringConfiguration: { - LogGroupName: { - Ref: 'EMRContainersStartJobRunMonitoringLogGroup882D450C', - }, - }, - PersistentAppUI: 'ENABLED', - S3MonitoringConfiguration: { - LogUri: { - 'Fn::Join': [ - '', - [ - 's3://', - { - Ref: 'EMRContainersStartJobRunMonitoringBucket8BB3FC54', - }, - ], - ], - }, - }, - }, - }, - }, - }); - }); - - test('provided from user', () => { - // WHEN - const logGroup = logs.LogGroup.fromLogGroupName(stack, 'Monitoring Group', 'providedloggroup'); - const s3Bucket = s3.Bucket.fromBucketName(stack, 'Monitoring Bucket', 'providedbucket');; - const prefixName = 'prefix'; - - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - monitoring: { - logBucket: s3Bucket, - logGroup: logGroup, - logStreamNamePrefix: prefixName, - logging: false, - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - 's3:DeleteObject*', - 's3:PutObject', - 's3:PutObjectLegalHold', - 's3:PutObjectRetention', - 's3:PutObjectTagging', - 's3:PutObjectVersionTagging', - 's3:Abort*', - ], - Effect: 'Allow', - Resource: [ - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':s3:::providedbucket', - ], - ], - }, - { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':s3:::providedbucket/*', - ], - ], - }, - ], - }, - { - Action: [ - 'logs:CreateLogStream', - 'logs:PutLogEvents', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':logs:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':log-group:providedloggroup:*', - ], - ], - }, - }, - { - Action: 'logs:DescribeLogStreams', - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':logs:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':log-group:providedloggroup:*', - ], - ], - }, - }, - { - Action: 'logs:DescribeLogGroups', - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':logs:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':*', - ], - ], - }, - }, - ], - Version: '2012-10-17', - }, - PolicyName: 'EMRContainersStartJobRunJobExecutionRoleDefaultPolicyCDBDF13E', - Roles: [ - { - Ref: 'EMRContainersStartJobRunJobExecutionRole40B8DD81', - }, - ], - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - ConfigurationOverrides: { - MonitoringConfiguration: { - CloudWatchMonitoringConfiguration: { - LogGroupName: logGroup.logGroupName, - LogStreamNamePrefix: prefixName, - }, - S3MonitoringConfiguration: { - LogUri: 's3://' + s3Bucket.bucketName, - }, - }, - }, - ExecutionRoleArn: { - 'Fn::GetAtt': [ - 'EMRContainersStartJobRunJobExecutionRole40B8DD81', - 'Arn', - ], - }, - }, - }); - }); - - test('PersistentAppUI to be disabled when set to false', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { - ...defaultProps, - monitoring: { - persistentAppUI: false, - }, - }); - - // THEN - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - ConfigurationOverrides: { - MonitoringConfiguration: { - PersistentAppUI: 'DISABLED', - }, - }, - }, - }); - }); - }); - - describe('Task throws if ', () => { - test('Application Configuration array is larger than 100', () => { - // WHEN - const struct = { classification: Classification.SPARK }; - const appConfig: ApplicationConfiguration[] = new Array(101).fill(struct); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - applicationConfig: appConfig, - }); - }).toThrow(`Application configuration array must have 100 or fewer entries. Received ${appConfig.length}`); - }); - - test('Application Configuration nested configuration array is larger than 100', () => { - // WHEN - const struct = { classification: Classification.SPARK }; - let appConfig: ApplicationConfiguration[] = new Array(101).fill(struct); - - const nestedConfigStruct = { classification: Classification.SPARK, nestedConfig: appConfig }; - appConfig[0] = nestedConfigStruct; - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - applicationConfig: appConfig, - }); - }).toThrow(`Application configuration array must have 100 or fewer entries. Received ${appConfig.length}`); - }); - - test('Application Configuration properties is larger than 100 entries', () => { - // WHEN - const properties: { [key: string]: string } = {}; - for (let index = 0; index <= 100; index++) { - properties[index.toString()] = 'value'; - } - const appConfig: ApplicationConfiguration = { classification: Classification.SPARK, properties: properties }; - - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - applicationConfig: [appConfig], - }); - }).toThrow(`Application configuration properties must have 100 or fewer entries. Received ${Object.keys(properties).length}`); - }); - - test('Application Configuration properties is undefined and nested configuration array is undefined', () => { - // WHEN - const struct = { classification: Classification.SPARK }; - let appConfig: ApplicationConfiguration[] = new Array(1).fill(struct); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - applicationConfig: appConfig, - }); - }).toThrow('Application configuration must have either properties or nested app configurations defined.'); - }); - - test('Entry Point is not between 1 to 256 characters in length', () => { - // WHEN - const entryPointString = 'x'.repeat(257); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Start Job Run Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText(entryPointString), - }, - }, - }); - }).toThrow(`Entry point must be between 1 and 256 characters in length. Received ${entryPointString.length}.`); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText(''), - }, - }, - }); - }).toThrow('Entry point must be between 1 and 256 characters in length. Received 0.'); - }); - - test('Entry Point Arguments is not a string array that is between 1 and 10280 entries in length', () => { - // WHEN - const entryPointArgs = sfn.TaskInput.fromObject(new Array(10281).fill('x', 10281)); - const entryPointArgsNone = sfn.TaskInput.fromObject([]); - const entryPointNumbers = sfn.TaskInput.fromObject(new Array(1).fill(1)); - const entryPointJson = sfn.TaskInput.fromText('x'); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'String array error Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('job-location'), - entryPointArguments: entryPointNumbers, - }, - }, - }); - }).toThrow('Entry point arguments must be a string array or an encoded JSON path but received object'); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'JSON Path error Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('job-location'), - entryPointArguments: entryPointJson, - }, - }, - }); - }).toThrow('Entry point arguments must be a string array or an encoded JSON path, but received a non JSON path string'); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Greater than 256 Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('job-location'), - entryPointArguments: entryPointArgs, - }, - }, - }); - }).toThrow(`Entry point arguments must be a string array between 1 and 10280 in length. Received ${entryPointArgs.value.length}.`); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Less than 1 Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('job-location'), - entryPointArguments: entryPointArgsNone, - }, - }, - }); - }).toThrow(`Entry point arguments must be a string array between 1 and 10280 in length. Received ${entryPointArgsNone.value.length}.`); - }); - - test('Spark Submit Parameters is NOT between 1 characters and 102400 characters in length', () => { - // WHEN - const sparkSubmitParam = 'x'.repeat(102401); - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Spark Submit Parameter Task', { - ...defaultProps, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('job-location'), - sparkSubmitParameters: sparkSubmitParam, - }, - }, - }); - }).toThrow(`Spark submit parameters must be between 1 and 102400 characters in length. Received ${sparkSubmitParam.length}.`); - }); - - test('an execution role is undefined and the virtual cluster ID is not a concrete value', () => { - // WHEN - const jsonPath = '$.ClusterId'; - - // THEN - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt(jsonPath)), - }); - }).toThrow('Execution role cannot be undefined when the virtual cluster ID is not a concrete value. Provide an execution role with the correct trust policy'); - }); - }); - - test('Permitted role actions and resources with Start Job Run for SYNC integration pattern', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', defaultProps); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: 'emr-containers:StartJobRun', - Condition: { - StringEquals: { - 'emr-containers:ExecutionRoleArn': { - 'Fn::GetAtt': [ - 'EMRContainersStartJobRunJobExecutionRole40B8DD81', - 'Arn', - ], - }, - }, - }, - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':emr-containers:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - `:/virtualclusters/${clusterId}`, - ], - ], - }, - }, - { - Action: [ - 'emr-containers:DescribeJobRun', - 'emr-containers:CancelJobRun', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':emr-containers:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - `:/virtualclusters/${clusterId}/jobruns/*`, - ], - ], - }, - }], - }, - }); - }); - - test('Permitted role actions and resources with Start Job Run from payload', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.ClusterId')), - executionRole: iam.Role.fromRoleArn(stack, 'Job Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), - }); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: 'emr-containers:StartJobRun', - Condition: { - StringEquals: { - 'emr-containers:ExecutionRoleArn': 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole', - }, - }, - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':emr-containers:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':/virtualclusters/*', - ], - ], - }, - }, - { - Action: [ - 'emr-containers:DescribeJobRun', - 'emr-containers:CancelJobRun', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':emr-containers:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':/virtualclusters/*', - ], - ], - }, - }], - }, - }); - }); - - test('Permitted role actions for Start Job Run with REQUEST/RESPONSE integration pattern', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'Task', { - ...defaultProps, - integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, - }); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: 'emr-containers:StartJobRun', - Condition: { - StringEquals: { - 'emr-containers:ExecutionRoleArn': { - 'Fn::GetAtt': [ - 'TaskJobExecutionRole5D5BBA5A', - 'Arn', - ], - }, - }, - }, - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':emr-containers:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - `:/virtualclusters/${clusterId}`, - ], - ], - }, - }], - }, - }); - }); - - test('Custom resource is created with EMR Containers Describe Virtual Cluster invocation and has correct IAM policy permissions', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'Task', defaultProps); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('Custom::AWS', { - ServiceToken: { - 'Fn::GetAtt': [ - 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', - 'Arn', - ], - }, - Create: '{\"service\":\"EMRcontainers\",\"action\":\"describeVirtualCluster\",\"parameters\":{\"id\":\"clusterId\"},\"outputPaths\":[\"virtualCluster.containerProvider.info.eksInfo.namespace\",\"virtualCluster.containerProvider.id\"],\"physicalResourceId\":{\"id\":\"id\"}}', - InstallLatestAwsSdk: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: 'emr-containers:DescribeVirtualCluster', - Effect: 'Allow', - Resource: '*', - }], - }, - }); - }); - - test('Custom resource is created that has correct EKS namespace, environment, AWSCLI layer, and IAM policy permissions', () => { - // WHEN - const task = new EmrContainersStartJobRun(stack, 'Task', defaultProps); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'eks:DescribeCluster', - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':eks:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':cluster/', - { - 'Fn::GetAtt': [ - 'TaskGetEksClusterInfo2F156985', - 'virtualCluster.containerProvider.id', - ], - }, - ], - ], - }, - }, - { - Action: [ - 'iam:GetRole', - 'iam:UpdateAssumeRolePolicy', - ], - Effect: 'Allow', - Resource: { - 'Fn::GetAtt': [ - 'TaskJobExecutionRole5D5BBA5A', - 'Arn', - ], - }, - }, - ], - }, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { - Handler: 'index.handler', - Layers: [ - { - Ref: 'TaskawsclilayerB1A11740', - }, - ], - MemorySize: 256, - Runtime: 'python3.9', - Timeout: 30, - }); - }); -}); - -test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { - expect(() => { - new EmrContainersStartJobRun(stack, 'Task', { - virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromText(clusterId)), - releaseLabel: ReleaseLabel.EMR_6_2_0, - jobDriver: { - sparkSubmitJobDriver: { - entryPoint: sfn.TaskInput.fromText('job-location'), - }, - }, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - }); - }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE,RUN_JOB. Received: WAIT_FOR_TASK_TOKEN/); -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.ts deleted file mode 100644 index 6460987f2570f..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/integ.start-job-run.ts +++ /dev/null @@ -1,63 +0,0 @@ -import * as path from 'path'; -import * as glue from '@aws-cdk/aws-glue'; -import * as iam from '@aws-cdk/aws-iam'; -import * as assets from '@aws-cdk/aws-s3-assets'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { GlueStartJobRun } from '../../lib/glue/start-job-run'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --state-machine-arn - * * aws stepfunctions describe-execution --execution-arn - * The "describe-execution" call should eventually return status "SUCCEEDED". - * NOTE: It will take up to 15 minutes for the step function to complete due to the cold start time - * for AWS Glue, which as of 02/2020, is around 10-15 minutes. - */ - -const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-stepfunctions-integ'); - -const codeAsset = new assets.Asset(stack, 'Glue Job Script', { - path: path.join(__dirname, 'my-glue-script/job.py'), -}); - -const jobRole = new iam.Role(stack, 'Glue Job Role', { - assumedBy: new iam.ServicePrincipal('glue'), - managedPolicies: [ - iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSGlueServiceRole'), - ], -}); -codeAsset.grantRead(jobRole); - -const job = new glue.CfnJob(stack, 'Glue Job', { - name: 'My Glue Job', - glueVersion: '1.0', - command: { - name: 'glueetl', - pythonVersion: '3', - scriptLocation: `s3://${codeAsset.s3BucketName}/${codeAsset.s3ObjectKey}`, - }, - role: jobRole.roleArn, -}); - -const jobTask = new GlueStartJobRun(stack, 'Glue Job Task', { - glueJobName: job.name!, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - arguments: sfn.TaskInput.fromObject({ - '--enable-metrics': 'true', - }), -}); - -const startTask = new sfn.Pass(stack, 'Start Task'); -const endTask = new sfn.Pass(stack, 'End Task'); - -const stateMachine = new sfn.StateMachine(stack, 'State Machine', { - definition: sfn.Chain.start(startTask).next(jobTask).next(endTask), -}); - -new cdk.CfnOutput(stack, 'State Machine ARN Output', { - value: stateMachine.stateMachineArn, -}); - -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts deleted file mode 100644 index c4bdec6bc3aa3..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as tasks from '../../lib'; -import { GlueStartJobRun } from '../../lib/glue/start-job-run'; - -const glueJobName = 'GlueJob'; -let stack: Stack; -beforeEach(() => { - stack = new Stack(); -}); - -test('Invoke glue job with just job ARN', () => { - const task = new GlueStartJobRun(stack, 'Task', { - glueJobName, - }); - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::glue:startJobRun', - ], - ], - }, - End: true, - Parameters: { - JobName: glueJobName, - }, - }); -}); - -test('Invoke glue job with full properties', () => { - const jobArguments = { - key: 'value', - }; - const timeoutMinutes = 1440; - const glueJobTimeout = Duration.minutes(timeoutMinutes); - const securityConfiguration = 'securityConfiguration'; - const notifyDelayAfterMinutes = 10; - const notifyDelayAfter = Duration.minutes(notifyDelayAfterMinutes); - const task = new GlueStartJobRun(stack, 'Task', { - glueJobName, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - arguments: sfn.TaskInput.fromObject(jobArguments), - taskTimeout: sfn.Timeout.duration(glueJobTimeout), - securityConfiguration, - notifyDelayAfter, - }); - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::glue:startJobRun.sync', - ], - ], - }, - End: true, - Parameters: { - JobName: glueJobName, - Arguments: jobArguments, - Timeout: timeoutMinutes, - SecurityConfiguration: securityConfiguration, - NotificationProperty: { - NotifyDelayAfter: notifyDelayAfterMinutes, - }, - }, - }); -}); - -test('Invoke glue job with Timeout.at()', () => { - const task = new GlueStartJobRun(stack, 'Task', { - glueJobName, - taskTimeout: sfn.Timeout.at('$.timeout'), - }); - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::glue:startJobRun', - ], - ], - }, - End: true, - Parameters: { - 'JobName': glueJobName, - 'Timeout.$': '$.timeout', - }, - }); -}); - -test('job arguments can reference state input', () => { - const task = new GlueStartJobRun(stack, 'Task', { - glueJobName, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - arguments: sfn.TaskInput.fromJsonPathAt('$.input'), - }); - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::glue:startJobRun.sync', - ], - ], - }, - End: true, - Parameters: { - 'JobName': glueJobName, - 'Arguments.$': '$.input', - }, - }); -}); - -test('permitted role actions limited to start job run if service integration pattern is REQUEST_RESPONSE', () => { - const task = new GlueStartJobRun(stack, 'Task', { - glueJobName, - integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, - }); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [Match.objectLike({ - Action: 'glue:StartJobRun', - })], - }, - }); -}); - -test('permitted role actions include start, get, and stop job run if service integration pattern is RUN_JOB', () => { - const task = new GlueStartJobRun(stack, 'Task', { - glueJobName, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - }); - - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [Match.objectLike({ - Action: [ - 'glue:StartJobRun', - 'glue:GetJobRun', - 'glue:GetJobRuns', - 'glue:BatchStopJobRun', - ], - })], - }, - }); -}); - -test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { - expect(() => { - new tasks.GlueStartJobRun(stack, 'GlueJob', { - glueJobName, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - }); - }).toThrow(/unsupported service integration pattern/i); -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.ts deleted file mode 100644 index 31f0f08f54e89..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.start-execution.ts +++ /dev/null @@ -1,42 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as tasks from '../lib'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --input '{"hello": "world"}' --state-machine-arn - * * aws stepfunctions describe-execution --execution-arn - * * The output here should contain `status: "SUCCEEDED"` and `output:"{...\"Output\":\"{\\\"hello\\\":\\\"world\\\"}\"...}"` - */ - -class TestStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - const child = new sfn.StateMachine(this, 'Child', { - definition: new sfn.Pass(this, 'Pass'), - }); - - const parent = new sfn.StateMachine(this, 'Parent', { - definition: new sfn.Task(this, 'Task', { - task: new tasks.StartExecution(child, { - input: { - hello: sfn.JsonPath.stringAt('$.hello'), - }, - integrationPattern: sfn.ServiceIntegrationPattern.SYNC, - }), - }), - }); - - new CfnOutput(this, 'StateMachineARN', { - value: parent.stateMachineArn, - }); - } -} - -const app = new App(); - -new TestStack(app, 'integ-sfn-start-execution'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/invoke-activity.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/invoke-activity.test.ts deleted file mode 100644 index 6a39717ae11d7..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/invoke-activity.test.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; -import * as tasks from '../lib'; - -describeDeprecated('InvokeActivity', () => { - test('Activity can be used in a Task', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const activity = new sfn.Activity(stack, 'Activity'); - const task = new sfn.Task(stack, 'Task', { task: new tasks.InvokeActivity(activity) }); - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::StepFunctions::StateMachine', { - DefinitionString: { - 'Fn::Join': ['', [ - '{"StartAt":"Task","States":{"Task":{"End":true,"Type":"Task","Resource":"', - { Ref: 'Activity04690B0A' }, - '"}}}', - ]], - }, - }); - }); - - test('Activity Task metrics and Activity metrics are the same', () => { - // GIVEN - const stack = new Stack(); - const activity = new sfn.Activity(stack, 'Activity'); - const task = new sfn.Task(stack, 'Invoke', { task: new tasks.InvokeActivity(activity) }); - - // WHEN - const activityMetrics = [ - activity.metricFailed(), - activity.metricHeartbeatTimedOut(), - activity.metricRunTime(), - activity.metricScheduled(), - activity.metricScheduleTime(), - activity.metricStarted(), - activity.metricSucceeded(), - activity.metricTime(), - activity.metricTimedOut(), - ]; - - const taskMetrics = [ - task.metricFailed(), - task.metricHeartbeatTimedOut(), - task.metricRunTime(), - task.metricScheduled(), - task.metricScheduleTime(), - task.metricStarted(), - task.metricSucceeded(), - task.metricTime(), - task.metricTimedOut(), - ]; - - // THEN - for (let i = 0; i < activityMetrics.length; i++) { - expect(activityMetrics[i]).toEqual(taskMetrics[i]); - } - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/start-execution.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/start-execution.test.ts deleted file mode 100644 index f921a57e5b740..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/start-execution.test.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; -import * as tasks from '../lib'; - -let stack: Stack; -let child: sfn.StateMachine; -beforeEach(() => { - stack = new Stack(); - child = new sfn.StateMachine(stack, 'ChildStateMachine', { - definition: sfn.Chain.start(new sfn.Pass(stack, 'PassState')), - }); -}); - -describeDeprecated('StartExecution', () => { - test('Execute State Machine - Default - Fire and Forget', () => { - const task = new sfn.Task(stack, 'ChildTask', { - task: new tasks.StartExecution(child, { - input: { - foo: 'bar', - }, - name: 'myExecutionName', - }), - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::states:startExecution', - ], - ], - }, - End: true, - Parameters: { - Input: { - foo: 'bar', - }, - Name: 'myExecutionName', - StateMachineArn: { - Ref: 'ChildStateMachine9133117F', - }, - }, - }); - }); - - test('Execute State Machine - Sync', () => { - const task = new sfn.Task(stack, 'ChildTask', { - task: new tasks.StartExecution(child, { - integrationPattern: sfn.ServiceIntegrationPattern.SYNC, - }), - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::states:startExecution.sync', - ], - ], - }, - End: true, - Parameters: { - StateMachineArn: { - Ref: 'ChildStateMachine9133117F', - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'states:StartExecution', - Effect: 'Allow', - Resource: { - Ref: 'ChildStateMachine9133117F', - }, - }, - { - Action: [ - 'states:DescribeExecution', - 'states:StopExecution', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':execution:', - { - 'Fn::Select': [ - 6, - { - 'Fn::Split': [ - ':', - { - Ref: 'ChildStateMachine9133117F', - }, - ], - }, - ], - }, - '*', - ], - ], - }, - }, - { - Action: [ - 'events:PutTargets', - 'events:PutRule', - 'events:DescribeRule', - ], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':events:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':rule/StepFunctionsGetEventsForStepFunctionsExecutionRule', - ], - ], - }, - }, - ], - Version: '2012-10-17', - }, - Roles: [ - { - Ref: 'ParentStateMachineRoleE902D002', - }, - ], - }); - }); - - test('Execute State Machine - Wait For Task Token', () => { - const task = new sfn.Task(stack, 'ChildTask', { - task: new tasks.StartExecution(child, { - integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, - input: { - token: sfn.JsonPath.taskToken, - }, - }), - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::states:startExecution.waitForTaskToken', - ], - ], - }, - End: true, - Parameters: { - Input: { - 'token.$': '$$.Task.Token', - }, - StateMachineArn: { - Ref: 'ChildStateMachine9133117F', - }, - }, - }); - }); - - test('Execute State Machine - Wait For Task Token - Missing Task Token', () => { - expect(() => { - new sfn.Task(stack, 'ChildTask', { - task: new tasks.StartExecution(child, { - integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, - }), - }); - }).toThrow('Task Token is missing in input (pass JsonPath.taskToken somewhere in input'); - }); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.ts deleted file mode 100644 index b0582cee76ce4..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/integ.start-execution.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { StepFunctionsStartExecution } from '../../lib/stepfunctions/start-execution'; - -/* - * Stack verification steps: - * * aws stepfunctions start-execution --input '{"hello": "world"}' --state-machine-arn - * * aws stepfunctions describe-execution --execution-arn - * * The output here should contain `status: "SUCCEEDED"` and `output`: '"Output": { "hello": "world"},' - */ - -class TestStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - const child = new sfn.StateMachine(this, 'Child', { - definition: new sfn.Pass(this, 'Pass'), - }); - - const parent = new sfn.StateMachine(this, 'Parent', { - definition: new StepFunctionsStartExecution(this, 'Task', { - stateMachine: child, - input: sfn.TaskInput.fromObject({ - hello: sfn.JsonPath.stringAt('$.hello'), - }), - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - }), - }); - - new CfnOutput(this, 'StateMachineARN', { - value: parent.stateMachineArn, - }); - } -} - -const app = new App(); - -new TestStack(app, 'integ-sfn-start-execution'); - -app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/invoke-activity.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/invoke-activity.test.ts deleted file mode 100644 index dfcf84183155a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/invoke-activity.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; -import { StepFunctionsInvokeActivity } from '../../lib/stepfunctions/invoke-activity'; - -test('Activity can be used in a Task', () => { - // GIVEN - const stack = new Stack(); - - // WHEN - const activity = new sfn.Activity(stack, 'Activity'); - const task = new StepFunctionsInvokeActivity(stack, 'Task', { activity }); - new sfn.StateMachine(stack, 'SM', { - definition: task, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::StepFunctions::StateMachine', { - DefinitionString: { - 'Fn::Join': ['', [ - '{"StartAt":"Task","States":{"Task":{"End":true,"Type":"Task","Resource":"', - { Ref: 'Activity04690B0A' }, - '"}}}', - ]], - }, - }); -}); - -test('Activity Task metrics and Activity metrics are the same', () => { - // GIVEN - const stack = new Stack(); - const activity = new sfn.Activity(stack, 'Activity'); - const task = new StepFunctionsInvokeActivity(stack, 'Invoke', { activity }); - - // WHEN - const activityMetrics = [ - activity.metricFailed(), - activity.metricHeartbeatTimedOut(), - activity.metricRunTime(), - activity.metricScheduled(), - activity.metricScheduleTime(), - activity.metricStarted(), - activity.metricSucceeded(), - activity.metricTime(), - activity.metricTimedOut(), - ]; - - const taskMetrics = [ - task.metricFailed(), - task.metricHeartbeatTimedOut(), - task.metricRunTime(), - task.metricScheduled(), - task.metricScheduleTime(), - task.metricStarted(), - task.metricSucceeded(), - task.metricTime(), - task.metricTimedOut(), - ]; - - // THEN - for (let i = 0; i < activityMetrics.length; i++) { - expect(activityMetrics[i]).toEqual(taskMetrics[i]); - } -}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/start-execution.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/start-execution.test.ts deleted file mode 100644 index 48e03fca934b9..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/stepfunctions/start-execution.test.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; -import { StepFunctionsStartExecution } from '../../lib/stepfunctions/start-execution'; - -let stack: Stack; -let child: sfn.StateMachine; -beforeEach(() => { - stack = new Stack(); - child = new sfn.StateMachine(stack, 'ChildStateMachine', { - definition: sfn.Chain.start(new sfn.Pass(stack, 'PassState')), - }); -}); - -test('Execute State Machine - Default - Request Response', () => { - const task = new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - input: sfn.TaskInput.fromObject({ - foo: 'bar', - }), - name: 'myExecutionName', - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::states:startExecution', - ], - ], - }, - End: true, - Parameters: { - Input: { - foo: 'bar', - }, - Name: 'myExecutionName', - StateMachineArn: { - Ref: 'ChildStateMachine9133117F', - }, - }, - }); -}); - -test('Execute State Machine - Run Job', () => { - const task = new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - integrationPattern: sfn.IntegrationPattern.RUN_JOB, - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::states:startExecution.sync:2', - ], - ], - }, - End: true, - Parameters: { - 'Input.$': '$', - 'StateMachineArn': { - Ref: 'ChildStateMachine9133117F', - }, - }, - }); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: 'states:StartExecution', - Effect: 'Allow', - Resource: { - Ref: 'ChildStateMachine9133117F', - }, - }, - { - Action: ['states:DescribeExecution', 'states:StopExecution'], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':execution:', - { - 'Fn::Select': [ - 6, - { - 'Fn::Split': [ - ':', - { - Ref: 'ChildStateMachine9133117F', - }, - ], - }, - ], - }, - '*', - ], - ], - }, - }, - { - Action: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':events:', - { - Ref: 'AWS::Region', - }, - ':', - { - Ref: 'AWS::AccountId', - }, - ':rule/StepFunctionsGetEventsForStepFunctionsExecutionRule', - ], - ], - }, - }, - ], - Version: '2012-10-17', - }, - Roles: [ - { - Ref: 'ParentStateMachineRoleE902D002', - }, - ], - }); -}); - -test('Execute State Machine - Wait For Task Token', () => { - const task = new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - input: sfn.TaskInput.fromObject({ - token: sfn.JsonPath.taskToken, - }), - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toEqual({ - Type: 'Task', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { - Ref: 'AWS::Partition', - }, - ':states:::states:startExecution.waitForTaskToken', - ], - ], - }, - End: true, - Parameters: { - Input: { - 'token.$': '$$.Task.Token', - }, - StateMachineArn: { - Ref: 'ChildStateMachine9133117F', - }, - }, - }); -}); - -test('Execute State Machine - Wait For Task Token - Missing Task Token', () => { - expect(() => { - new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, - }); - }).toThrow('Task Token is required in `input` for callback. Use JsonPath.taskToken to set the token.'); -}); - -test('Execute State Machine - Associate With Parent - Input Provided', () => { - const task = new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - input: sfn.TaskInput.fromObject({ - token: sfn.JsonPath.taskToken, - }), - associateWithParent: true, - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - Input: { - 'token.$': '$$.Task.Token', - 'AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$': '$$.Execution.Id', - }, - }, - }); -}); - -test('Execute State Machine - Associate With Parent - Input Not Provided', () => { - const task = new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - associateWithParent: true, - }); - - new sfn.StateMachine(stack, 'ParentStateMachine', { - definition: task, - }); - - expect(stack.resolve(task.toStateJson())).toMatchObject({ - Parameters: { - Input: { - 'AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$': '$$.Execution.Id', - }, - }, - }); -}); - -test('Execute State Machine - Associate With Parent - Incorrect Input Type', () => { - expect(() => { - new StepFunctionsStartExecution(stack, 'ChildTask', { - stateMachine: child, - associateWithParent: true, - input: sfn.TaskInput.fromText('{ "token.$": "$$.Task.Token" }'), - }); - }).toThrow('Could not enable `associateWithParent` because `input` is taken directly from a JSON path. Use `sfn.TaskInput.fromObject` instead.'); -}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/.eslintrc.js b/packages/@aws-cdk/aws-stepfunctions/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-stepfunctions/.gitignore b/packages/@aws-cdk/aws-stepfunctions/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-stepfunctions/.npmignore b/packages/@aws-cdk/aws-stepfunctions/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-stepfunctions/LICENSE b/packages/@aws-cdk/aws-stepfunctions/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-stepfunctions/NOTICE b/packages/@aws-cdk/aws-stepfunctions/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-stepfunctions/README.md b/packages/@aws-cdk/aws-stepfunctions/README.md deleted file mode 100644 index 1c572499da795..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/README.md +++ /dev/null @@ -1,939 +0,0 @@ -# AWS Step Functions Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -The `@aws-cdk/aws-stepfunctions` package contains constructs for building -serverless workflows using objects. Use this in conjunction with the -`@aws-cdk/aws-stepfunctions-tasks` package, which contains classes used -to call other AWS services. - -Defining a workflow looks like this (for the [Step Functions Job Poller -example](https://docs.aws.amazon.com/step-functions/latest/dg/job-status-poller-sample.html)): - -## Example - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -declare const submitLambda: lambda.Function; -declare const getStatusLambda: lambda.Function; - -const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', { - lambdaFunction: submitLambda, - // Lambda's result is in the attribute `guid` - outputPath: '$.guid', -}); - -const waitX = new sfn.Wait(this, 'Wait X Seconds', { - time: sfn.WaitTime.secondsPath('$.waitSeconds'), -}); - -const getStatus = new tasks.LambdaInvoke(this, 'Get Job Status', { - lambdaFunction: getStatusLambda, - // Pass just the field named "guid" into the Lambda, put the - // Lambda's result in a field called "status" in the response - inputPath: '$.guid', - outputPath: '$.status', -}); - -const jobFailed = new sfn.Fail(this, 'Job Failed', { - cause: 'AWS Batch Job Failed', - error: 'DescribeJob returned FAILED', -}); - -const finalStatus = new tasks.LambdaInvoke(this, 'Get Final Job Status', { - lambdaFunction: getStatusLambda, - // Use "guid" field as input - inputPath: '$.guid', - outputPath: '$.Payload', -}); - -const definition = submitJob - .next(waitX) - .next(getStatus) - .next(new sfn.Choice(this, 'Job Complete?') - // Look at the "status" field - .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) - .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus) - .otherwise(waitX)); - -new sfn.StateMachine(this, 'StateMachine', { - definition, - timeout: Duration.minutes(5), -}); -``` - -You can find more sample snippets and learn more about the service integrations -in the `@aws-cdk/aws-stepfunctions-tasks` package. - -## State Machine - -A `stepfunctions.StateMachine` is a resource that takes a state machine -definition. The definition is specified by its start state, and encompasses -all states reachable from the start state: - -```ts -const startState = new sfn.Pass(this, 'StartState'); - -new sfn.StateMachine(this, 'StateMachine', { - definition: startState, -}); -``` - -State machines are made up of a sequence of **Steps**, which represent different actions -taken in sequence. Some of these steps represent *control flow* (like `Choice`, `Map` and `Wait`) -while others represent calls made against other AWS services (like `LambdaInvoke`). -The second category are called `Task`s and they can all be found in the module [`aws-stepfunctions-tasks`]. - -[`aws-stepfunctions-tasks`]: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html - -State machines execute using an IAM Role, which will automatically have all -permissions added that are required to make all state machine tasks execute -properly (for example, permissions to invoke any Lambda functions you add to -your workflow). A role will be created by default, but you can supply an -existing one as well. - -Set the `removalPolicy` prop to `RemovalPolicy.RETAIN` if you want to retain the execution -history when CloudFormation deletes your state machine. - -## State Machine Data - -An Execution represents each time the State Machine is run. Every Execution has [State Machine -Data](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-data.html): -a JSON document containing keys and values that is fed into the state machine, -gets modified by individual steps as the state machine progresses, and finally -is produced as output. - -By default, the entire Data object is passed into every state, and the return data of the step -becomes new the new Data object. This behavior can be modified by supplying values for `inputPath`, -`resultSelector`, `resultPath` and `outputPath`. - -### Manipulating state machine data using inputPath, resultSelector, resultPath and outputPath - -These properties impact how each individual step interacts with the state machine data: - -* `inputPath`: the part of the data object that gets passed to the step (`itemsPath` for `Map` states) -* `resultSelector`: the part of the step result that should be added to the state machine data -* `resultPath`: where in the state machine data the step result should be inserted -* `outputPath`: what part of the state machine data should be retained - -Their values should be a string indicating a [JSON path](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html) into the State Machine Data object (like `"$.MyKey"`). If absent, the values are treated as if they were `"$"`, which means the entire object. - -The following pseudocode shows how AWS Step Functions uses these parameters when executing a step: - -```js -// Schematically show how Step Functions evaluates functions. -// [] represents indexing into an object by a using JSON path. - -input = state[inputPath] - -result = invoke_step(select_parameters(input)) - -state[resultPath] = result[resultSelector] - -state = state[outputPath] -``` - -Instead of a JSON path string, each of these paths can also have the special value `JsonPath.DISCARD`, which causes the corresponding indexing expression to return an empty object (`{}`). Effectively, that means there will be an empty input object, an empty result object, no effect on the state, or an empty state, respectively. - -Some steps (mostly Tasks) have *Parameters*, which are selected differently. See the next section. - -See the official documentation on [input and output processing in Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html). - -### Passing Parameters to Tasks - -Tasks take parameters, whose values can be taken from the State Machine Data object. For example, your -workflow may want to start a CodeBuild with an environment variable that is taken from the State Machine data, or pass part of the State Machine Data into an AWS Lambda Function. - -In the original JSON-based states language used by AWS Step Functions, you would -add `.$` to the end of a key to indicate that a value needs to be interpreted as -a JSON path. In the CDK API you do not change the names of any keys. Instead, you -pass special values. There are 3 types of task inputs to consider: - -* Tasks that accept a "payload" type of input (like AWS Lambda invocations, or posting messages to SNS topics or SQS queues), will take an object of type `TaskInput`, like `TaskInput.fromObject()` or `TaskInput.fromJsonPathAt()`. -* When tasks expect individual string or number values to customize their behavior, you can also pass a value constructed by `JsonPath.stringAt()` or `JsonPath.numberAt()`. -* When tasks expect strongly-typed resources and you want to vary the resource that is referenced based on a name from the State Machine Data, reference the resource as if it was external (using `JsonPath.stringAt()`). For example, for a Lambda function: `Function.fromFunctionName(this, 'ReferencedFunction', JsonPath.stringAt('$.MyFunctionName'))`. - -For example, to pass the value that's in the data key of `OrderId` to a Lambda -function as you invoke it, use `JsonPath.stringAt('$.OrderId')`, like so: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; - -declare const orderFn: lambda.Function; - -const submitJob = new tasks.LambdaInvoke(this, 'InvokeOrderProcessor', { - lambdaFunction: orderFn, - payload: sfn.TaskInput.fromObject({ - OrderId: sfn.JsonPath.stringAt('$.OrderId'), - }), -}); -``` - -The following methods are available: - -| Method | Purpose | -|--------|---------| -| `JsonPath.stringAt('$.Field')` | reference a field, return the type as a `string`. | -| `JsonPath.listAt('$.Field')` | reference a field, return the type as a list of strings. | -| `JsonPath.numberAt('$.Field')` | reference a field, return the type as a number. Use this for functions that expect a number argument. | -| `JsonPath.objectAt('$.Field')` | reference a field, return the type as an `IResolvable`. Use this for functions that expect an object argument. | -| `JsonPath.entirePayload` | reference the entire data object (equivalent to a path of `$`). | -| `JsonPath.taskToken` | reference the [Task Token](https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token), used for integration patterns that need to run for a long time. | - -You can also call [intrinsic functions](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html) using the methods on `JsonPath`: - -| Method | Purpose | -|--------|---------| -| `JsonPath.array(JsonPath.stringAt('$.Field'), ...)` | make an array from other elements. | -| `JsonPath.arrayPartition(JsonPath.listAt('$.inputArray'), 4)` | partition an array. | -| `JsonPath.arrayContains(JsonPath.listAt('$.inputArray'), 5)` | determine if a specific value is present in an array. | -| `JsonPath.arrayRange(1, 9, 2)` | create a new array containing a specific range of elements. | -| `JsonPath.arrayGetItem(JsonPath.listAt('$.inputArray'), 5)` | get a specified index's value in an array. | -| `JsonPath.arrayLength(JsonPath.listAt('$.inputArray'))` | get the length of an array. | -| `JsonPath.arrayUnique(JsonPath.listAt('$.inputArray'))` | remove duplicate values from an array. | -| `JsonPath.base64Encode(JsonPath.stringAt('$.input'))` | encode data based on MIME Base64 encoding scheme. | -| `JsonPath.base64Decode(JsonPath.stringAt('$.base64'))` | decode data based on MIME Base64 decoding scheme. | -| `JsonPath.hash(JsonPath.objectAt('$.Data'), JsonPath.stringAt('$.Algorithm'))` | calculate the hash value of a given input. | -| `JsonPath.jsonMerge(JsonPath.objectAt('$.Obj1'), JsonPath.objectAt('$.Obj2'))` | merge two JSON objects into a single object. | -| `JsonPath.stringToJson(JsonPath.stringAt('$.ObjStr'))` | parse a JSON string to an object | -| `JsonPath.jsonToString(JsonPath.objectAt('$.Obj'))` | stringify an object to a JSON string | -| `JsonPath.mathRandom(1, 999)` | return a random number. | -| `JsonPath.mathAdd(JsonPath.numberAt('$.value1'), JsonPath.numberAt('$.step'))` | return the sum of two numbers. | -| `JsonPath.stringSplit(JsonPath.stringAt('$.inputString'), JsonPath.stringAt('$.splitter'))` | split a string into an array of values. | -| `JsonPath.uuid()` | return a version 4 universally unique identifier (v4 UUID). | -| `JsonPath.format('The value is {}.', JsonPath.stringAt('$.Value'))` | insert elements into a format string. | - -## Amazon States Language - -This library comes with a set of classes that model the [Amazon States -Language](https://states-language.net/spec.html). The following State classes -are supported: - -* [`Task`](#task) -* [`Pass`](#pass) -* [`Wait`](#wait) -* [`Choice`](#choice) -* [`Parallel`](#parallel) -* [`Succeed`](#succeed) -* [`Fail`](#fail) -* [`Map`](#map) -* [`Custom State`](#custom-state) - -An arbitrary JSON object (specified at execution start) is passed from state to -state and transformed during the execution of the workflow. For more -information, see the States Language spec. - -### Task - -A `Task` represents some work that needs to be done. Do not use the `Task` class directly. - -Instead, use one of the classes in the `@aws-cdk/aws-stepfunctions-tasks` module, -which provide a much more ergonomic way to integrate with various AWS services. - -### Pass - -A `Pass` state passes its input to its output, without performing work. -Pass states are useful when constructing and debugging state machines. - -The following example injects some fixed data into the state machine through -the `result` field. The `result` field will be added to the input and the result -will be passed as the state's output. - -```ts -// Makes the current JSON state { ..., "subObject": { "hello": "world" } } -const pass = new sfn.Pass(this, 'Add Hello World', { - result: sfn.Result.fromObject({ hello: 'world' }), - resultPath: '$.subObject', -}); - -// Set the next state -const nextState = new sfn.Pass(this, 'NextState'); -pass.next(nextState); -``` - -The `Pass` state also supports passing key-value pairs as input. Values can -be static, or selected from the input with a path. - -The following example filters the `greeting` field from the state input -and also injects a field called `otherData`. - -```ts -const pass = new sfn.Pass(this, 'Filter input and inject data', { - parameters: { // input to the pass state - input: sfn.JsonPath.stringAt('$.input.greeting'), - otherData: 'some-extra-stuff', - }, -}); -``` - -The object specified in `parameters` will be the input of the `Pass` state. -Since neither `Result` nor `ResultPath` are supplied, the `Pass` state copies -its input through to its output. - -Learn more about the [Pass state](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-pass-state.html) - -### Wait - -A `Wait` state waits for a given number of seconds, or until the current time -hits a particular time. The time to wait may be taken from the execution's JSON -state. - -```ts -// Wait until it's the time mentioned in the the state object's "triggerTime" -// field. -const wait = new sfn.Wait(this, 'Wait For Trigger Time', { - time: sfn.WaitTime.timestampPath('$.triggerTime'), -}); - -// Set the next state -const startTheWork = new sfn.Pass(this, 'StartTheWork'); -wait.next(startTheWork); -``` - -### Choice - -A `Choice` state can take a different path through the workflow based on the -values in the execution's JSON state: - -```ts -const choice = new sfn.Choice(this, 'Did it work?'); - -// Add conditions with .when() -const successState = new sfn.Pass(this, 'SuccessState'); -const failureState = new sfn.Pass(this, 'FailureState'); -choice.when(sfn.Condition.stringEquals('$.status', 'SUCCESS'), successState); -choice.when(sfn.Condition.numberGreaterThan('$.attempts', 5), failureState); - -// Use .otherwise() to indicate what should be done if none of the conditions match -const tryAgainState = new sfn.Pass(this, 'TryAgainState'); -choice.otherwise(tryAgainState); -``` - -If you want to temporarily branch your workflow based on a condition, but have -all branches come together and continuing as one (similar to how an `if ... -then ... else` works in a programming language), use the `.afterwards()` method: - -```ts -const choice = new sfn.Choice(this, 'What color is it?'); -const handleBlueItem = new sfn.Pass(this, 'HandleBlueItem'); -const handleRedItem = new sfn.Pass(this, 'HandleRedItem'); -const handleOtherItemColor = new sfn.Pass(this, 'HanldeOtherItemColor'); -choice.when(sfn.Condition.stringEquals('$.color', 'BLUE'), handleBlueItem); -choice.when(sfn.Condition.stringEquals('$.color', 'RED'), handleRedItem); -choice.otherwise(handleOtherItemColor); - -// Use .afterwards() to join all possible paths back together and continue -const shipTheItem = new sfn.Pass(this, 'ShipTheItem'); -choice.afterwards().next(shipTheItem); -``` - -If your `Choice` doesn't have an `otherwise()` and none of the conditions match -the JSON state, a `NoChoiceMatched` error will be thrown. Wrap the state machine -in a `Parallel` state if you want to catch and recover from this. - -#### Available Conditions - -see [step function comparison operators](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html#amazon-states-language-choice-state-rules) - -* `Condition.isPresent` - matches if a json path is present -* `Condition.isNotPresent` - matches if a json path is not present -* `Condition.isString` - matches if a json path contains a string -* `Condition.isNotString` - matches if a json path is not a string -* `Condition.isNumeric` - matches if a json path is numeric -* `Condition.isNotNumeric` - matches if a json path is not numeric -* `Condition.isBoolean` - matches if a json path is boolean -* `Condition.isNotBoolean` - matches if a json path is not boolean -* `Condition.isTimestamp` - matches if a json path is a timestamp -* `Condition.isNotTimestamp` - matches if a json path is not a timestamp -* `Condition.isNotNull` - matches if a json path is not null -* `Condition.isNull` - matches if a json path is null -* `Condition.booleanEquals` - matches if a boolean field has a given value -* `Condition.booleanEqualsJsonPath` - matches if a boolean field equals a value in a given mapping path -* `Condition.stringEqualsJsonPath` - matches if a string field equals a given mapping path -* `Condition.stringEquals` - matches if a field equals a string value -* `Condition.stringLessThan` - matches if a string field sorts before a given value -* `Condition.stringLessThanJsonPath` - matches if a string field sorts before a value at given mapping path -* `Condition.stringLessThanEquals` - matches if a string field sorts equal to or before a given value -* `Condition.stringLessThanEqualsJsonPath` - matches if a string field sorts equal to or before a given mapping -* `Condition.stringGreaterThan` - matches if a string field sorts after a given value -* `Condition.stringGreaterThanJsonPath` - matches if a string field sorts after a value at a given mapping path -* `Condition.stringGreaterThanEqualsJsonPath` - matches if a string field sorts after or equal to value at a given mapping path -* `Condition.stringGreaterThanEquals` - matches if a string field sorts after or equal to a given value -* `Condition.numberEquals` - matches if a numeric field has the given value -* `Condition.numberEqualsJsonPath` - matches if a numeric field has the value in a given mapping path -* `Condition.numberLessThan` - matches if a numeric field is less than the given value -* `Condition.numberLessThanJsonPath` - matches if a numeric field is less than the value at the given mapping path -* `Condition.numberLessThanEquals` - matches if a numeric field is less than or equal to the given value -* `Condition.numberLessThanEqualsJsonPath` - matches if a numeric field is less than or equal to the numeric value at given mapping path -* `Condition.numberGreaterThan` - matches if a numeric field is greater than the given value -* `Condition.numberGreaterThanJsonPath` - matches if a numeric field is greater than the value at a given mapping path -* `Condition.numberGreaterThanEquals` - matches if a numeric field is greater than or equal to the given value -* `Condition.numberGreaterThanEqualsJsonPath` - matches if a numeric field is greater than or equal to the value at a given mapping path -* `Condition.timestampEquals` - matches if a timestamp field is the same time as the given timestamp -* `Condition.timestampEqualsJsonPath` - matches if a timestamp field is the same time as the timestamp at a given mapping path -* `Condition.timestampLessThan` - matches if a timestamp field is before the given timestamp -* `Condition.timestampLessThanJsonPath` - matches if a timestamp field is before the timestamp at a given mapping path -* `Condition.timestampLessThanEquals` - matches if a timestamp field is before or equal to the given timestamp -* `Condition.timestampLessThanEqualsJsonPath` - matches if a timestamp field is before or equal to the timestamp at a given mapping path -* `Condition.timestampGreaterThan` - matches if a timestamp field is after the timestamp at a given mapping path -* `Condition.timestampGreaterThanJsonPath` - matches if a timestamp field is after the timestamp at a given mapping path -* `Condition.timestampGreaterThanEquals` - matches if a timestamp field is after or equal to the given timestamp -* `Condition.timestampGreaterThanEqualsJsonPath` - matches if a timestamp field is after or equal to the timestamp at a given mapping path -* `Condition.stringMatches` - matches if a field matches a string pattern that can contain a wild card (\*) e.g: log-\*.txt or \*LATEST\*. No other characters other than "\*" have any special meaning - \* can be escaped: \\\\* - -### Parallel - -A `Parallel` state executes one or more subworkflows in parallel. It can also -be used to catch and recover from errors in subworkflows. - -```ts -const parallel = new sfn.Parallel(this, 'Do the work in parallel'); - -// Add branches to be executed in parallel -const shipItem = new sfn.Pass(this, 'ShipItem'); -const sendInvoice = new sfn.Pass(this, 'SendInvoice'); -const restock = new sfn.Pass(this, 'Restock'); -parallel.branch(shipItem); -parallel.branch(sendInvoice); -parallel.branch(restock); - -// Retry the whole workflow if something goes wrong -parallel.addRetry({ maxAttempts: 1 }); - -// How to recover from errors -const sendFailureNotification = new sfn.Pass(this, 'SendFailureNotification'); -parallel.addCatch(sendFailureNotification); - -// What to do in case everything succeeded -const closeOrder = new sfn.Pass(this, 'CloseOrder'); -parallel.next(closeOrder); -``` - -### Succeed - -Reaching a `Succeed` state terminates the state machine execution with a -successful status. - -```ts -const success = new sfn.Succeed(this, 'We did it!'); -``` - -### Fail - -Reaching a `Fail` state terminates the state machine execution with a -failure status. The fail state should report the reason for the failure. -Failures can be caught by encompassing `Parallel` states. - -```ts -const success = new sfn.Fail(this, 'Fail', { - error: 'WorkflowFailure', - cause: "Something went wrong", -}); -``` - -### Map - -A `Map` state can be used to run a set of steps for each element of an input array. -A `Map` state will execute the same steps for multiple entries of an array in the state input. - -While the `Parallel` state executes multiple branches of steps using the same input, a `Map` state will -execute the same steps for multiple entries of an array in the state input. - -```ts -const map = new sfn.Map(this, 'Map State', { - maxConcurrency: 1, - itemsPath: sfn.JsonPath.stringAt('$.inputForMap'), -}); -map.iterator(new sfn.Pass(this, 'Pass State')); -``` - -### Custom State - -It's possible that the high-level constructs for the states or `stepfunctions-tasks` do not have -the states or service integrations you are looking for. The primary reasons for this lack of -functionality are: - -* A [service integration](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-service-integrations.html) is available through Amazon States Language, but not available as construct - classes in the CDK. -* The state or state properties are available through Step Functions, but are not configurable - through constructs - -If a feature is not available, a `CustomState` can be used to supply any Amazon States Language -JSON-based object as the state definition. - -[Code Snippets](https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1) are available and can be plugged in as the state definition. - -Custom states can be chained together with any of the other states to create your state machine -definition. You will also need to provide any permissions that are required to the `role` that -the State Machine uses. - -The following example uses the `DynamoDB` service integration to insert data into a DynamoDB table. - -```ts -import * as dynamodb from '@aws-cdk/aws-dynamodb'; - -// create a table -const table = new dynamodb.Table(this, 'montable', { - partitionKey: { - name: 'id', - type: dynamodb.AttributeType.STRING, - }, -}); - -const finalStatus = new sfn.Pass(this, 'final step'); - -// States language JSON to put an item into DynamoDB -// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1 -const stateJson = { - Type: 'Task', - Resource: 'arn:aws:states:::dynamodb:putItem', - Parameters: { - TableName: table.tableName, - Item: { - id: { - S: 'MyEntry', - }, - }, - }, - ResultPath: null, -}; - -// custom state which represents a task to insert data into DynamoDB -const custom = new sfn.CustomState(this, 'my custom task', { - stateJson, -}); - -const chain = sfn.Chain.start(custom) - .next(finalStatus); - -const sm = new sfn.StateMachine(this, 'StateMachine', { - definition: chain, - timeout: Duration.seconds(30), -}); - -// don't forget permissions. You need to assign them -table.grantWriteData(sm); -``` - -## Task Chaining - -To make defining work flows as convenient (and readable in a top-to-bottom way) -as writing regular programs, it is possible to chain most methods invocations. -In particular, the `.next()` method can be repeated. The result of a series of -`.next()` calls is called a **Chain**, and can be used when defining the jump -targets of `Choice.on` or `Parallel.branch`: - -```ts -const step1 = new sfn.Pass(this, 'Step1'); -const step2 = new sfn.Pass(this, 'Step2'); -const step3 = new sfn.Pass(this, 'Step3'); -const step4 = new sfn.Pass(this, 'Step4'); -const step5 = new sfn.Pass(this, 'Step5'); -const step6 = new sfn.Pass(this, 'Step6'); -const step7 = new sfn.Pass(this, 'Step7'); -const step8 = new sfn.Pass(this, 'Step8'); -const step9 = new sfn.Pass(this, 'Step9'); -const step10 = new sfn.Pass(this, 'Step10'); -const choice = new sfn.Choice(this, 'Choice'); -const condition1 = sfn.Condition.stringEquals('$.status', 'SUCCESS'); -const parallel = new sfn.Parallel(this, 'Parallel'); -const finish = new sfn.Pass(this, 'Finish'); - -const definition = step1 - .next(step2) - .next(choice - .when(condition1, step3.next(step4).next(step5)) - .otherwise(step6) - .afterwards()) - .next(parallel - .branch(step7.next(step8)) - .branch(step9.next(step10))) - .next(finish); - -new sfn.StateMachine(this, 'StateMachine', { - definition, -}); -``` - -If you don't like the visual look of starting a chain directly off the first -step, you can use `Chain.start`: - -```ts -const step1 = new sfn.Pass(this, 'Step1'); -const step2 = new sfn.Pass(this, 'Step2'); -const step3 = new sfn.Pass(this, 'Step3'); - -const definition = sfn.Chain - .start(step1) - .next(step2) - .next(step3) - // ... -``` - -## Task Credentials - -Tasks are executed using the State Machine's execution role. In some cases, e.g. cross-account access, an IAM role can be assumed by the State Machine's execution role to provide access to the resource. -This can be achieved by providing the optional `credentials` property which allows using a fixed role or a json expression to resolve the role at runtime from the task's inputs. - -```ts -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; - -declare const submitLambda: lambda.Function; -declare const iamRole: iam.Role; - -// use a fixed role for all task invocations -const role = sfn.TaskRole.fromRole(iamRole); -// or use a json expression to resolve the role at runtime based on task inputs -//const role = sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn'); - -const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', { - lambdaFunction: submitLambda, - outputPath: '$.Payload', - // use credentials - credentials: { role }, -}); -``` - -See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html) -to learn more about AWS Step Functions support for accessing resources in other AWS accounts. - -## State Machine Fragments - -It is possible to define reusable (or abstracted) mini-state machines by -defining a construct that implements `IChainable`, which requires you to define -two fields: - -* `startState: State`, representing the entry point into this state machine. -* `endStates: INextable[]`, representing the (one or more) states that outgoing - transitions will be added to if you chain onto the fragment. - -Since states will be named after their construct IDs, you may need to prefix the -IDs of states if you plan to instantiate the same state machine fragment -multiples times (otherwise all states in every instantiation would have the same -name). - -The class `StateMachineFragment` contains some helper functions (like -`prefixStates()`) to make it easier for you to do this. If you define your state -machine as a subclass of this, it will be convenient to use: - -```ts nofixture -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; - -interface MyJobProps { - jobFlavor: string; -} - -class MyJob extends sfn.StateMachineFragment { - public readonly startState: sfn.State; - public readonly endStates: sfn.INextable[]; - - constructor(parent: Construct, id: string, props: MyJobProps) { - super(parent, id); - - const choice = new sfn.Choice(this, 'Choice') - .when(sfn.Condition.stringEquals('$.branch', 'left'), new sfn.Pass(this, 'Left Branch')) - .when(sfn.Condition.stringEquals('$.branch', 'right'), new sfn.Pass(this, 'Right Branch')); - - // ... - - this.startState = choice; - this.endStates = choice.afterwards().endStates; - } -} - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - // Do 3 different variants of MyJob in parallel - const parallel = new sfn.Parallel(this, 'All jobs') - .branch(new MyJob(this, 'Quick', { jobFlavor: 'quick' }).prefixStates()) - .branch(new MyJob(this, 'Medium', { jobFlavor: 'medium' }).prefixStates()) - .branch(new MyJob(this, 'Slow', { jobFlavor: 'slow' }).prefixStates()); - - new sfn.StateMachine(this, 'MyStateMachine', { - definition: parallel, - }); - } -} -``` - -A few utility functions are available to parse state machine fragments. - -* `State.findReachableStates`: Retrieve the list of states reachable from a given state. -* `State.findReachableEndStates`: Retrieve the list of end or terminal states reachable from a given state. - -## Activity - -**Activities** represent work that is done on some non-Lambda worker pool. The -Step Functions workflow will submit work to this Activity, and a worker pool -that you run yourself, probably on EC2, will pull jobs from the Activity and -submit the results of individual jobs back. - -You need the ARN to do so, so if you use Activities be sure to pass the Activity -ARN into your worker pool: - -```ts -const activity = new sfn.Activity(this, 'Activity'); - -// Read this CloudFormation Output from your application and use it to poll for work on -// the activity. -new CfnOutput(this, 'ActivityArn', { value: activity.activityArn }); -``` - -### Activity-Level Permissions - -Granting IAM permissions to an activity can be achieved by calling the `grant(principal, actions)` API: - -```ts -const activity = new sfn.Activity(this, 'Activity'); - -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), -}); - -activity.grant(role, 'states:SendTaskSuccess'); -``` - -This will grant the IAM principal the specified actions onto the activity. - -## Metrics - -`Task` object expose various metrics on the execution of that particular task. For example, -to create an alarm on a particular task failing: - -```ts -declare const task: sfn.Task; -new cloudwatch.Alarm(this, 'TaskAlarm', { - metric: task.metricFailed(), - threshold: 1, - evaluationPeriods: 1, -}); -``` - -There are also metrics on the complete state machine: - -```ts -declare const stateMachine: sfn.StateMachine; -new cloudwatch.Alarm(this, 'StateMachineAlarm', { - metric: stateMachine.metricFailed(), - threshold: 1, - evaluationPeriods: 1, -}); -``` - -And there are metrics on the capacity of all state machines in your account: - -```ts -new cloudwatch.Alarm(this, 'ThrottledAlarm', { - metric: sfn.StateTransitionMetric.metricThrottledEvents(), - threshold: 10, - evaluationPeriods: 2, -}); -``` - -## Error names - -Step Functions identifies errors in the Amazon States Language using case-sensitive strings, known as error names. -The Amazon States Language defines a set of built-in strings that name well-known errors, all beginning with the `States.` prefix. - -* `States.ALL` - A wildcard that matches any known error name. -* `States.Runtime` - An execution failed due to some exception that could not be processed. Often these are caused by errors at runtime, such as attempting to apply InputPath or OutputPath on a null JSON payload. A `States.Runtime` error is not retriable, and will always cause the execution to fail. A retry or catch on `States.ALL` will NOT catch States.Runtime errors. -* `States.DataLimitExceeded` - A States.DataLimitExceeded exception will be thrown for the following: - * When the output of a connector is larger than payload size quota. - * When the output of a state is larger than payload size quota. - * When, after Parameters processing, the input of a state is larger than the payload size quota. - * See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/limits-overview.html) to learn more about AWS Step Functions Quotas. -* `States.HeartbeatTimeout` - A Task state failed to send a heartbeat for a period longer than the HeartbeatSeconds value. -* `States.Timeout` - A Task state either ran longer than the TimeoutSeconds value, or failed to send a heartbeat for a period longer than the HeartbeatSeconds value. -* `States.TaskFailed`- A Task state failed during the execution. When used in a retry or catch, `States.TaskFailed` acts as a wildcard that matches any known error name except for `States.Timeout`. - -## Logging - -Enable logging to CloudWatch by passing a logging configuration with a -destination LogGroup: - -```ts -import * as logs from '@aws-cdk/aws-logs'; - -const logGroup = new logs.LogGroup(this, 'MyLogGroup'); - -new sfn.StateMachine(this, 'MyStateMachine', { - definition: sfn.Chain.start(new sfn.Pass(this, 'Pass')), - logs: { - destination: logGroup, - level: sfn.LogLevel.ALL, - }, -}); -``` - -## X-Ray tracing - -Enable X-Ray tracing for StateMachine: - -```ts -new sfn.StateMachine(this, 'MyStateMachine', { - definition: sfn.Chain.start(new sfn.Pass(this, 'Pass')), - tracingEnabled: true, -}); -``` - -See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-xray-tracing.html) -to learn more about AWS Step Functions's X-Ray support. - -## State Machine Permission Grants - -IAM roles, users, or groups which need to be able to work with a State Machine should be granted IAM permissions. - -Any object that implements the `IGrantable` interface (has an associated principal) can be granted permissions by calling: - -* `stateMachine.grantStartExecution(principal)` - grants the principal the ability to execute the state machine -* `stateMachine.grantRead(principal)` - grants the principal read access -* `stateMachine.grantTaskResponse(principal)` - grants the principal the ability to send task tokens to the state machine -* `stateMachine.grantExecution(principal, actions)` - grants the principal execution-level permissions for the IAM actions specified -* `stateMachine.grant(principal, actions)` - grants the principal state-machine-level permissions for the IAM actions specified - -### Start Execution Permission - -Grant permission to start an execution of a state machine by calling the `grantStartExecution()` API. - -```ts -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), -}); - -declare const definition: sfn.IChainable; -const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, -}); - -// Give role permission to start execution of state machine -stateMachine.grantStartExecution(role); -``` - -The following permission is provided to a service principal by the `grantStartExecution()` API: - -* `states:StartExecution` - to state machine - -### Read Permissions - -Grant `read` access to a state machine by calling the `grantRead()` API. - -```ts -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), -}); - -declare const definition: sfn.IChainable; -const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, -}); - -// Give role read access to state machine -stateMachine.grantRead(role); -``` - -The following read permissions are provided to a service principal by the `grantRead()` API: - -* `states:ListExecutions` - to state machine -* `states:ListStateMachines` - to state machine -* `states:DescribeExecution` - to executions -* `states:DescribeStateMachineForExecution` - to executions -* `states:GetExecutionHistory` - to executions -* `states:ListActivities` - to `*` -* `states:DescribeStateMachine` - to `*` -* `states:DescribeActivity` - to `*` - -### Task Response Permissions - -Grant permission to allow task responses to a state machine by calling the `grantTaskResponse()` API: - -```ts -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), -}); - -declare const definition: sfn.IChainable; -const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, -}); - -// Give role task response permissions to the state machine -stateMachine.grantTaskResponse(role); -``` - -The following read permissions are provided to a service principal by the `grantRead()` API: - -* `states:SendTaskSuccess` - to state machine -* `states:SendTaskFailure` - to state machine -* `states:SendTaskHeartbeat` - to state machine - -### Execution-level Permissions - -Grant execution-level permissions to a state machine by calling the `grantExecution()` API: - -```ts -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), -}); - -declare const definition: sfn.IChainable; -const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, -}); - -// Give role permission to get execution history of ALL executions for the state machine -stateMachine.grantExecution(role, 'states:GetExecutionHistory'); -``` - -### Custom Permissions - -You can add any set of permissions to a state machine by calling the `grant()` API. - -```ts -const user = new iam.User(this, 'MyUser'); - -declare const definition: sfn.IChainable; -const stateMachine = new sfn.StateMachine(this, 'StateMachine', { - definition, -}); - -//give user permission to send task success to the state machine -stateMachine.grant(user, 'states:SendTaskSuccess'); -``` - -## Import - -Any Step Functions state machine that has been created outside the stack can be imported -into your CDK stack. - -State machines can be imported by their ARN via the `StateMachine.fromStateMachineArn()` API. -In addition, the StateMachine can be imported via the `StateMachine.fromStateMachineName()` method, as long as they are in the same account/region as the current construct. - -```ts -const app = new App(); -const stack = new Stack(app, 'MyStack'); -sfn.StateMachine.fromStateMachineArn( - stack, - "ViaArnImportedStateMachine", - "arn:aws:states:us-east-1:123456789012:stateMachine:StateMachine2E01A3A5-N5TJppzoevKQ" -); - -sfn.StateMachine.fromStateMachineName( - stack, - "ViaResourceNameImportedStateMachine", - "StateMachine2E01A3A5-N5TJppzoevKQ" -); -``` diff --git a/packages/@aws-cdk/aws-stepfunctions/jest.config.js b/packages/@aws-cdk/aws-stepfunctions/jest.config.js deleted file mode 100644 index 7d20d603251aa..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - ...baseConfig.coverageThreshold, - global: { - ...baseConfig.coverageThreshold.global, - branches: 77, - }, - }, -}; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts b/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts deleted file mode 100644 index 9ea8cef30cdd2..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine.ts +++ /dev/null @@ -1,624 +0,0 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import { Arn, ArnFormat, Duration, IResource, RemovalPolicy, Resource, Stack, Token } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { StateGraph } from './state-graph'; -import { StatesMetrics } from './stepfunctions-canned-metrics.generated'; -import { CfnStateMachine } from './stepfunctions.generated'; -import { IChainable } from './types'; - -/** - * Two types of state machines are available in AWS Step Functions: EXPRESS AND STANDARD. - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html - * - * @default STANDARD - */ -export enum StateMachineType { - /** - * Express Workflows are ideal for high-volume, event processing workloads. - */ - EXPRESS = 'EXPRESS', - - /** - * Standard Workflows are ideal for long-running, durable, and auditable workflows. - */ - STANDARD = 'STANDARD' -} - -/** - * Defines which category of execution history events are logged. - * - * @see https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html - * - * @default ERROR - */ -export enum LogLevel { - /** - * No Logging - */ - OFF = 'OFF', - /** - * Log everything - */ - ALL = 'ALL', - /** - * Log all errors - */ - ERROR = 'ERROR', - /** - * Log fatal errors - */ - FATAL = 'FATAL' -} - -/** - * Defines what execution history events are logged and where they are logged. - */ -export interface LogOptions { - /** - * The log group where the execution history events will be logged. - */ - readonly destination: logs.ILogGroup; - - /** - * Determines whether execution data is included in your log. - * - * @default false - */ - readonly includeExecutionData?: boolean; - - /** - * Defines which category of execution history events are logged. - * - * @default ERROR - */ - readonly level?: LogLevel; -} - -/** - * Properties for defining a State Machine - */ -export interface StateMachineProps { - /** - * A name for the state machine - * - * @default A name is automatically generated - */ - readonly stateMachineName?: string; - - /** - * Definition for this state machine - */ - readonly definition: IChainable; - - /** - * The execution role for the state machine service - * - * @default A role is automatically created - */ - readonly role?: iam.IRole; - - /** - * Maximum run time for this state machine - * - * @default No timeout - */ - readonly timeout?: Duration; - - /** - * Type of the state machine - * - * @default StateMachineType.STANDARD - */ - readonly stateMachineType?: StateMachineType; - - /** - * Defines what execution history events are logged and where they are logged. - * - * @default No logging - */ - readonly logs?: LogOptions; - - /** - * Specifies whether Amazon X-Ray tracing is enabled for this state machine. - * - * @default false - */ - readonly tracingEnabled?: boolean; - - /** - * The removal policy to apply to state machine - * - * @default RemovalPolicy.DESTROY - */ - readonly removalPolicy?: RemovalPolicy; -} - -/** - * A new or imported state machine. - */ -abstract class StateMachineBase extends Resource implements IStateMachine { - - /** - * Import a state machine - */ - public static fromStateMachineArn(scope: Construct, id: string, stateMachineArn: string): IStateMachine { - class Import extends StateMachineBase { - public readonly stateMachineArn = stateMachineArn; - public readonly grantPrincipal = new iam.UnknownPrincipal({ resource: this }); - } - return new Import(scope, id, { - environmentFromArn: stateMachineArn, - }); - } - - /** - * Import a state machine via resource name - */ - public static fromStateMachineName(scope: Construct, id: string, stateMachineName: string): IStateMachine { - const stateMachineArn = Stack.of(scope).formatArn({ - service: 'states', - resource: 'stateMachine', - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - resourceName: stateMachineName, - }); - return this.fromStateMachineArn(scope, id, stateMachineArn); - } - - public abstract readonly stateMachineArn: string; - - /** - * The principal this state machine is running as - */ - public abstract readonly grantPrincipal: iam.IPrincipal; - - /** - * Grant the given identity permissions to start an execution of this state - * machine. - */ - public grantStartExecution(identity: iam.IGrantable): iam.Grant { - return iam.Grant.addToPrincipal({ - grantee: identity, - actions: ['states:StartExecution'], - resourceArns: [this.stateMachineArn], - }); - } - - /** - * Grant the given identity permissions to start a synchronous execution of - * this state machine. - */ - public grantStartSyncExecution(identity: iam.IGrantable): iam.Grant { - return iam.Grant.addToPrincipal({ - grantee: identity, - actions: ['states:StartSyncExecution'], - resourceArns: [this.stateMachineArn], - }); - } - - /** - * Grant the given identity permissions to read results from state - * machine. - */ - public grantRead(identity: iam.IGrantable): iam.Grant { - iam.Grant.addToPrincipal({ - grantee: identity, - actions: [ - 'states:ListExecutions', - 'states:ListStateMachines', - ], - resourceArns: [this.stateMachineArn], - }); - iam.Grant.addToPrincipal({ - grantee: identity, - actions: [ - 'states:DescribeExecution', - 'states:DescribeStateMachineForExecution', - 'states:GetExecutionHistory', - ], - resourceArns: [`${this.executionArn()}:*`], - }); - return iam.Grant.addToPrincipal({ - grantee: identity, - actions: [ - 'states:ListActivities', - 'states:DescribeStateMachine', - 'states:DescribeActivity', - ], - resourceArns: ['*'], - }); - } - - /** - * Grant the given identity task response permissions on a state machine - */ - public grantTaskResponse(identity: iam.IGrantable): iam.Grant { - return iam.Grant.addToPrincipal({ - grantee: identity, - actions: [ - 'states:SendTaskSuccess', - 'states:SendTaskFailure', - 'states:SendTaskHeartbeat', - ], - resourceArns: [this.stateMachineArn], - }); - } - - /** - * Grant the given identity permissions on all executions of the state machine - */ - public grantExecution(identity: iam.IGrantable, ...actions: string[]) { - return iam.Grant.addToPrincipal({ - grantee: identity, - actions, - resourceArns: [`${this.executionArn()}:*`], - }); - } - - /** - * Grant the given identity custom permissions - */ - public grant(identity: iam.IGrantable, ...actions: string[]): iam.Grant { - return iam.Grant.addToPrincipal({ - grantee: identity, - actions, - resourceArns: [this.stateMachineArn], - }); - } - - - /** - * Return the given named metric for this State Machine's executions - * - * @default - sum over 5 minutes - */ - public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return new cloudwatch.Metric({ - namespace: 'AWS/States', - metricName, - dimensionsMap: { StateMachineArn: this.stateMachineArn }, - statistic: 'sum', - ...props, - }).attachTo(this); - } - - /** - * Metric for the number of executions that failed - * - * @default - sum over 5 minutes - */ - public metricFailed(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(StatesMetrics.executionsFailedSum, props); - } - - /** - * Metric for the number of executions that were throttled - * - * @default - sum over 5 minutes - */ - public metricThrottled(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - // There's a typo in the "canned" version of this - return this.metric('ExecutionThrottled', props); - } - - /** - * Metric for the number of executions that were aborted - * - * @default - sum over 5 minutes - */ - public metricAborted(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(StatesMetrics.executionsAbortedSum, props); - } - - /** - * Metric for the number of executions that succeeded - * - * @default - sum over 5 minutes - */ - public metricSucceeded(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(StatesMetrics.executionsSucceededSum, props); - } - - /** - * Metric for the number of executions that timed out - * - * @default - sum over 5 minutes - */ - public metricTimedOut(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(StatesMetrics.executionsTimedOutSum, props); - } - - /** - * Metric for the number of executions that were started - * - * @default - sum over 5 minutes - */ - public metricStarted(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.metric('ExecutionsStarted', props); - } - - /** - * Metric for the interval, in milliseconds, between the time the execution starts and the time it closes - * - * @default - average over 5 minutes - */ - public metricTime(props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return this.cannedMetric(StatesMetrics.executionTimeAverage, props); - } - - /** - * Returns the pattern for the execution ARN's of the state machine - */ - private executionArn(): string { - return Stack.of(this).formatArn({ - resource: 'execution', - service: 'states', - resourceName: Arn.split(this.stateMachineArn, ArnFormat.COLON_RESOURCE_NAME).resourceName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - } - - private cannedMetric( - fn: (dims: { StateMachineArn: string }) => cloudwatch.MetricProps, - props?: cloudwatch.MetricOptions): cloudwatch.Metric { - return new cloudwatch.Metric({ - ...fn({ StateMachineArn: this.stateMachineArn }), - ...props, - }).attachTo(this); - } -} - -/** - * Define a StepFunctions State Machine - */ -export class StateMachine extends StateMachineBase { - /** - * Execution role of this state machine - */ - public readonly role: iam.IRole; - - /** - * The name of the state machine - * @attribute - */ - public readonly stateMachineName: string; - - /** - * The ARN of the state machine - */ - public readonly stateMachineArn: string; - - /** - * Type of the state machine - * @attribute - */ - public readonly stateMachineType: StateMachineType; - - constructor(scope: Construct, id: string, props: StateMachineProps) { - super(scope, id, { - physicalName: props.stateMachineName, - }); - - if (props.stateMachineName !== undefined) { - this.validateStateMachineName(props.stateMachineName); - } - - this.role = props.role || new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('states.amazonaws.com'), - }); - - const graph = new StateGraph(props.definition.startState, `State Machine ${id} definition`); - graph.timeout = props.timeout; - - this.stateMachineType = props.stateMachineType ?? StateMachineType.STANDARD; - - const resource = new CfnStateMachine(this, 'Resource', { - stateMachineName: this.physicalName, - stateMachineType: props.stateMachineType ?? undefined, - roleArn: this.role.roleArn, - definitionString: Stack.of(this).toJsonString(graph.toGraphJson()), - loggingConfiguration: props.logs ? this.buildLoggingConfiguration(props.logs) : undefined, - tracingConfiguration: props.tracingEnabled ? this.buildTracingConfiguration() : undefined, - }); - resource.applyRemovalPolicy(props.removalPolicy, { default: RemovalPolicy.DESTROY }); - - resource.node.addDependency(this.role); - - for (const statement of graph.policyStatements) { - this.addToRolePolicy(statement); - } - - this.stateMachineName = this.getResourceNameAttribute(resource.attrName); - this.stateMachineArn = this.getResourceArnAttribute(resource.ref, { - service: 'states', - resource: 'stateMachine', - resourceName: this.physicalName, - arnFormat: ArnFormat.COLON_RESOURCE_NAME, - }); - } - - /** - * The principal this state machine is running as - */ - public get grantPrincipal() { - return this.role.grantPrincipal; - } - - /** - * Add the given statement to the role's policy - */ - public addToRolePolicy(statement: iam.PolicyStatement) { - this.role.addToPrincipalPolicy(statement); - } - - private validateStateMachineName(stateMachineName: string) { - if (!Token.isUnresolved(stateMachineName)) { - if (stateMachineName.length < 1 || stateMachineName.length > 80) { - throw new Error(`State Machine name must be between 1 and 80 characters. Received: ${stateMachineName}`); - } - - if (!stateMachineName.match(/^[a-z0-9\+\!\@\.\(\)\-\=\_\']+$/i)) { - throw new Error(`State Machine name must match "^[a-z0-9+!@.()-=_']+$/i". Received: ${stateMachineName}`); - } - } - } - - private buildLoggingConfiguration(logOptions: LogOptions): CfnStateMachine.LoggingConfigurationProperty { - // https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html#cloudwatch-iam-policy - this.addToRolePolicy(new iam.PolicyStatement({ - effect: iam.Effect.ALLOW, - actions: [ - 'logs:CreateLogDelivery', - 'logs:GetLogDelivery', - 'logs:UpdateLogDelivery', - 'logs:DeleteLogDelivery', - 'logs:ListLogDeliveries', - 'logs:PutResourcePolicy', - 'logs:DescribeResourcePolicies', - 'logs:DescribeLogGroups', - ], - resources: ['*'], - })); - - return { - destinations: [{ - cloudWatchLogsLogGroup: { logGroupArn: logOptions.destination.logGroupArn }, - }], - includeExecutionData: logOptions.includeExecutionData, - level: logOptions.level || 'ERROR', - }; - } - - private buildTracingConfiguration(): CfnStateMachine.TracingConfigurationProperty { - this.addToRolePolicy(new iam.PolicyStatement({ - // https://docs.aws.amazon.com/xray/latest/devguide/security_iam_id-based-policy-examples.html#xray-permissions-resources - // https://docs.aws.amazon.com/step-functions/latest/dg/xray-iam.html - actions: [ - 'xray:PutTraceSegments', - 'xray:PutTelemetryRecords', - 'xray:GetSamplingRules', - 'xray:GetSamplingTargets', - ], - resources: ['*'], - })); - - return { - enabled: true, - }; - } -} - -/** - * A State Machine - */ -export interface IStateMachine extends IResource, iam.IGrantable { - /** - * The ARN of the state machine - * @attribute - */ - readonly stateMachineArn: string; - - /** - * Grant the given identity permissions to start an execution of this state - * machine. - * - * @param identity The principal - */ - grantStartExecution(identity: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity permissions to start a synchronous execution of - * this state machine. - * - * @param identity The principal - */ - grantStartSyncExecution(identity: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity read permissions for this state machine - * - * @param identity The principal - */ - grantRead(identity: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity read permissions for this state machine - * - * @param identity The principal - */ - grantTaskResponse(identity: iam.IGrantable): iam.Grant; - - /** - * Grant the given identity permissions for all executions of a state machine - * - * @param identity The principal - * @param actions The list of desired actions - */ - grantExecution(identity: iam.IGrantable, ...actions: string[]): iam.Grant; - - /** - * Grant the given identity custom permissions - * - * @param identity The principal - * @param actions The list of desired actions - */ - grant(identity: iam.IGrantable, ...actions: string[]): iam.Grant; - - /** - * Return the given named metric for this State Machine's executions - * - * @default - sum over 5 minutes - */ - metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the number of executions that failed - * - * @default - sum over 5 minutes - */ - metricFailed(props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the number of executions that were throttled - * - * @default sum over 5 minutes - */ - metricThrottled(props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the number of executions that were aborted - * - * @default - sum over 5 minutes - */ - metricAborted(props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the number of executions that succeeded - * - * @default - sum over 5 minutes - */ - metricSucceeded(props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the number of executions that timed out - * - * @default - sum over 5 minutes - */ - metricTimedOut(props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the number of executions that were started - * - * @default - sum over 5 minutes - */ - metricStarted(props?: cloudwatch.MetricOptions): cloudwatch.Metric; - - /** - * Metric for the interval, in milliseconds, between the time the execution starts and the time it closes - * - * @default - sum over 5 minutes - */ - metricTime(props?: cloudwatch.MetricOptions): cloudwatch.Metric; -} diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/types.ts b/packages/@aws-cdk/aws-stepfunctions/lib/types.ts deleted file mode 100644 index d3eee929f09b8..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/lib/types.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { Duration } from '@aws-cdk/core'; -import { Chain } from './chain'; -import { State } from './states/state'; - -/** - * Interface for states that can have 'next' states - */ -export interface INextable { - /** - * Go to the indicated state after this state - * - * @returns The chain of states built up - */ - next(state: IChainable): Chain; -} - -/** - * Interface for objects that can be used in a Chain - */ -export interface IChainable { - /** - * Descriptive identifier for this chainable - */ - readonly id: string; - - /** - * The start state of this chainable - */ - readonly startState: State; - - /** - * The chainable end state(s) of this chainable - */ - readonly endStates: INextable[]; -} - -/** - * Predefined error strings - * Error names in Amazon States Language - https://states-language.net/spec.html#appendix-a - * Error handling in Step Functions - https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html - */ -export class Errors { - /** - * Matches any Error. - */ - public static readonly ALL = 'States.ALL'; - - /** - * A Task State failed to heartbeat for a time longer than the “HeartbeatSeconds” value. - */ - public static readonly HEARTBEAT_TIMEOUT = 'States.HeartbeatTimeout'; - - /** - * A Task State either ran longer than the “TimeoutSeconds” value, or - * failed to heartbeat for a time longer than the “HeartbeatSeconds” value. - */ - public static readonly TIMEOUT = 'States.Timeout'; - - /** - * A Task State failed during the execution. - */ - public static readonly TASKS_FAILED = 'States.TaskFailed'; - - /** - * A Task State failed because it had insufficient privileges to execute - * the specified code. - */ - public static readonly PERMISSIONS = 'States.Permissions'; - - /** - * A Task State’s “ResultPath” field cannot be applied to the input the state received. - */ - public static readonly RESULT_PATH_MATCH_FAILURE = 'States.ResultPathMatchFailure'; - - /** - * Within a state’s “Parameters” field, the attempt to replace a field whose - * name ends in “.$” using a Path failed. - */ - public static readonly PARAMETER_PATH_FAILURE = 'States.ParameterPathFailure'; - - /** - * A branch of a Parallel state failed. - */ - public static readonly BRANCH_FAILED = 'States.BranchFailed'; - - /** - * A Choice state failed to find a match for the condition field extracted - * from its input. - */ - public static readonly NO_CHOICE_MATCHED = 'States.NoChoiceMatched'; -} - -/** - * Retry details - */ -export interface RetryProps { - /** - * Errors to retry - * - * A list of error strings to retry, which can be either predefined errors - * (for example Errors.NoChoiceMatched) or a self-defined error. - * - * @default All errors - */ - readonly errors?: string[]; - - /** - * How many seconds to wait initially before retrying - * - * @default Duration.seconds(1) - */ - readonly interval?: Duration; - - /** - * How many times to retry this particular error. - * - * May be 0 to disable retry for specific errors (in case you have - * a catch-all retry policy). - * - * @default 3 - */ - readonly maxAttempts?: number; - - /** - * Multiplication for how much longer the wait interval gets on every retry - * - * @default 2 - */ - readonly backoffRate?: number; -} - -/** - * Error handler details - */ -export interface CatchProps { - /** - * Errors to recover from by going to the given state - * - * A list of error strings to retry, which can be either predefined errors - * (for example Errors.NoChoiceMatched) or a self-defined error. - * - * @default All errors - */ - readonly errors?: string[]; - - /** - * JSONPath expression to indicate where to inject the error data - * - * May also be the special value DISCARD, which will cause the error - * data to be discarded. - * - * @default $ - */ - readonly resultPath?: string; -} - -/** - * Special string value to discard state input, output or result - */ -export const DISCARD = 'DISCARD'; diff --git a/packages/@aws-cdk/aws-stepfunctions/package.json b/packages/@aws-cdk/aws-stepfunctions/package.json deleted file mode 100644 index 536249cc16f44..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/package.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "name": "@aws-cdk/aws-stepfunctions", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::StepFunctions", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.stepfunctions", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "stepfunctions" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.StepFunctions", - "packageId": "Amazon.CDK.AWS.StepFunctions", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-stepfunctions", - "module": "aws_cdk.aws_stepfunctions", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-stepfunctions" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::StepFunctions", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "stepfunctions" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "^0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "duration-prop-type:@aws-cdk/aws-stepfunctions.Errors.TIMEOUT", - "duration-prop-type:@aws-cdk/aws-stepfunctions.Errors.HEARTBEAT_TIMEOUT", - "no-unused-type:@aws-cdk/aws-stepfunctions.ServiceIntegrationPattern" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-stepfunctions/rosetta/default.ts-fixture deleted file mode 100644 index 01f59d49ec36d..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/rosetta/default.ts-fixture +++ /dev/null @@ -1,14 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { App, CfnOutput, Duration, Stack } from '@aws-cdk/core'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as tasks from '@aws-cdk/aws-stepfunctions-tasks'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions/test/fake-task.ts b/packages/@aws-cdk/aws-stepfunctions/test/fake-task.ts deleted file mode 100644 index e21149408141a..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/test/fake-task.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as constructs from 'constructs'; -import * as sfn from '../lib'; - -export interface FakeTaskProps extends sfn.TaskStateBaseProps { - parameters?: { [key: string]: string }; -} - -/** - * Task extending sfn.TaskStateBase to facilitate integ testing setting credentials - */ -export class FakeTask extends sfn.TaskStateBase { - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - protected readonly taskPolicies?: iam.PolicyStatement[]; - protected readonly parameters?: { [key: string]: string }; - - constructor(scope: constructs.Construct, id: string, props: FakeTaskProps = {}) { - super(scope, id, props); - this.parameters = props.parameters; - } - - protected _renderTask(): any { - return { - Type: 'Task', - Resource: 'arn:aws:states:::dynamodb:putItem', - Parameters: { - TableName: 'my-cool-table', - Item: { - id: { - S: 'my-entry', - }, - }, - ...this.parameters, - }, - }; - } -} diff --git a/packages/@aws-cdk/aws-stepfunctions/test/private/fake-task.ts b/packages/@aws-cdk/aws-stepfunctions/test/private/fake-task.ts deleted file mode 100644 index 01a0c9bfa0da1..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions/test/private/fake-task.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as constructs from 'constructs'; -import * as sfn from '../../lib'; - -export interface FakeTaskProps extends sfn.TaskStateBaseProps { - readonly metrics?: sfn.TaskMetricsConfig; -} - -export class FakeTask extends sfn.TaskStateBase { - protected readonly taskMetrics?: sfn.TaskMetricsConfig; - protected readonly taskPolicies?: iam.PolicyStatement[]; - - constructor(scope: constructs.Construct, id: string, props: FakeTaskProps = {}) { - super(scope, id, props); - this.taskMetrics = props.metrics; - } - - /** - * @internal - */ - protected _renderTask(): any { - return { - Resource: 'my-resource', - Parameters: sfn.FieldUtils.renderObject({ - MyParameter: 'myParameter', - }), - }; - } -} diff --git a/packages/@aws-cdk/aws-supportapp/.eslintrc.js b/packages/@aws-cdk/aws-supportapp/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-supportapp/.gitignore b/packages/@aws-cdk/aws-supportapp/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-supportapp/.npmignore b/packages/@aws-cdk/aws-supportapp/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-supportapp/LICENSE b/packages/@aws-cdk/aws-supportapp/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-supportapp/NOTICE b/packages/@aws-cdk/aws-supportapp/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-supportapp/README.md b/packages/@aws-cdk/aws-supportapp/README.md deleted file mode 100644 index 23a7ff5c4f2a2..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::SupportApp Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as supportapp from '@aws-cdk/aws-supportapp'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SupportApp construct libraries](https://constructs.dev/search?q=supportapp) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SupportApp resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SupportApp.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SupportApp](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SupportApp.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-supportapp/jest.config.js b/packages/@aws-cdk/aws-supportapp/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-supportapp/lib/index.ts b/packages/@aws-cdk/aws-supportapp/lib/index.ts deleted file mode 100644 index 15ae21d666c3b..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SupportApp CloudFormation Resources: -export * from './supportapp.generated'; diff --git a/packages/@aws-cdk/aws-supportapp/package.json b/packages/@aws-cdk/aws-supportapp/package.json deleted file mode 100644 index 6f7f833b3c871..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-supportapp", - "version": "0.0.0", - "description": "AWS::SupportApp Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SupportApp", - "packageId": "Amazon.CDK.AWS.SupportApp", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.supportapp", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "supportapp" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-supportapp", - "module": "aws_cdk.aws_supportapp" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-supportapp" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SupportApp", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SupportApp", - "aws-supportapp" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-supportapp/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-supportapp/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-supportapp/test/supportapp.test.ts b/packages/@aws-cdk/aws-supportapp/test/supportapp.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-supportapp/test/supportapp.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-synthetics/.eslintrc.js b/packages/@aws-cdk/aws-synthetics/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/aws-synthetics/.eslintrc.js +++ b/packages/@aws-cdk/aws-synthetics/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-synthetics/.gitignore b/packages/@aws-cdk/aws-synthetics/.gitignore index cdfd75c518352..33f6e9ba95ab5 100644 --- a/packages/@aws-cdk/aws-synthetics/.gitignore +++ b/packages/@aws-cdk/aws-synthetics/.gitignore @@ -24,3 +24,5 @@ junit.xml !**/*.snapshot/**/asset.*/*.d.ts !**/*.snapshot/**/asset.*/** + +* diff --git a/packages/@aws-cdk/aws-synthetics/README.md b/packages/@aws-cdk/aws-synthetics/README.md index a2507be64277f..e9e2f6ef974bc 100644 --- a/packages/@aws-cdk/aws-synthetics/README.md +++ b/packages/@aws-cdk/aws-synthetics/README.md @@ -3,12 +3,6 @@ --- -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ![cdk-constructs: Developer Preview](https://img.shields.io/badge/cdk--constructs-developer--preview-informational.svg?style=for-the-badge) > The APIs of higher level constructs in this module are in **developer preview** before they @@ -165,7 +159,7 @@ new synthetics.Canary(this, 'Asset Canary', { }); // To supply the code from a S3 bucket: -import * as s3 from '@aws-cdk/aws-s3'; +import * as s3 from 'aws-cdk-lib/aws-s3'; const bucket = new s3.Bucket(this, 'Code Bucket'); new synthetics.Canary(this, 'Bucket Canary', { test: synthetics.Test.custom({ @@ -203,7 +197,7 @@ This can allow for monitoring services that may be internal to a specific VPC. T This will automatically attach the appropriate IAM permissions to attach to the VPC. This will also create a Security Group and attach to the default subnets for the VPC unless specified via `vpcSubnets` and `securityGroups`. ```ts -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; declare const vpc: ec2.IVpc; new synthetics.Canary(this, 'Vpc Canary', { @@ -233,7 +227,7 @@ You can configure a CloudWatch Alarm on a canary metric. Metrics are emitted by Create an alarm that tracks the canary metric: ```ts -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; declare const canary: synthetics.Canary; new cloudwatch.Alarm(this, 'CanaryAlarm', { diff --git a/packages/@aws-cdk/aws-synthetics/lib/canary.ts b/packages/@aws-cdk/aws-synthetics/lib/canary.ts index cb5a043eb2858..83664f03f6c57 100644 --- a/packages/@aws-cdk/aws-synthetics/lib/canary.ts +++ b/packages/@aws-cdk/aws-synthetics/lib/canary.ts @@ -1,15 +1,15 @@ import * as crypto from 'crypto'; -import { Metric, MetricOptions, MetricProps } from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Metric, MetricOptions, MetricProps } from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { Code } from './code'; import { Runtime } from './runtime'; import { Schedule } from './schedule'; -import { CloudWatchSyntheticsMetrics } from './synthetics-canned-metrics.generated'; -import { CfnCanary } from './synthetics.generated'; +import { CloudWatchSyntheticsMetrics } from 'aws-cdk-lib/aws-synthetics/lib/synthetics-canned-metrics.generated'; +import { CfnCanary } from 'aws-cdk-lib/aws-synthetics'; /** * Specify a test that the canary should run diff --git a/packages/@aws-cdk/aws-synthetics/lib/code.ts b/packages/@aws-cdk/aws-synthetics/lib/code.ts index cb6aafa5bc45c..31387b5aadee8 100644 --- a/packages/@aws-cdk/aws-synthetics/lib/code.ts +++ b/packages/@aws-cdk/aws-synthetics/lib/code.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; import { Construct } from 'constructs'; import { RuntimeFamily } from './runtime'; diff --git a/packages/@aws-cdk/aws-synthetics/lib/index.ts b/packages/@aws-cdk/aws-synthetics/lib/index.ts index ee024834f2bf1..86cffd2cd1742 100644 --- a/packages/@aws-cdk/aws-synthetics/lib/index.ts +++ b/packages/@aws-cdk/aws-synthetics/lib/index.ts @@ -4,4 +4,3 @@ export * from './runtime'; export * from './schedule'; // AWS::Synthetics CloudFormation Resources: -export * from './synthetics.generated'; diff --git a/packages/@aws-cdk/aws-synthetics/lib/schedule.ts b/packages/@aws-cdk/aws-synthetics/lib/schedule.ts index 248b44e4c59cb..8ff2ee7c8165e 100644 --- a/packages/@aws-cdk/aws-synthetics/lib/schedule.ts +++ b/packages/@aws-cdk/aws-synthetics/lib/schedule.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from 'aws-cdk-lib'; /** * Schedule for canary runs diff --git a/packages/@aws-cdk/aws-synthetics/package.json b/packages/@aws-cdk/aws-synthetics/package.json index e650e2babad93..cb2b45d64c2b8 100644 --- a/packages/@aws-cdk/aws-synthetics/package.json +++ b/packages/@aws-cdk/aws-synthetics/package.json @@ -1,7 +1,7 @@ { - "name": "@aws-cdk/aws-synthetics", + "name": "@aws-cdk/aws-synthetics-alpha", "version": "0.0.0", - "private": true, + "private": false, "description": "The CDK Construct Library for AWS::Synthetics", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -9,24 +9,28 @@ "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.AWS.Synthetics", - "packageId": "Amazon.CDK.AWS.Synthetics", + "namespace": "Amazon.CDK.AWS.Synthetics.Alpha", + "packageId": "Amazon.CDK.AWS.Synthetics.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.services.synthetics", + "package": "software.amazon.awscdk.services.synthetics.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "synthetics" + "artifactId": "synthetics-alpha" } }, "python": { - "distName": "aws-cdk.aws-synthetics", - "module": "aws_cdk.aws_synthetics", + "distName": "aws-cdk.aws-synthetics-alpha", + "module": "aws_cdk.aws_synthetics_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdksyntheticsalpha" } }, "projectReferences": true, @@ -53,17 +57,14 @@ "pkglint": "pkglint -f", "package": "cdk-package", "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", "build+test+package": "yarn build+test && yarn package", "build+test": "yarn build && yarn test", "compat": "cdk-compat", - "gen": "cfn2ts", "rosetta:extract": "yarn --silent jsii-rosetta extract", "build+extract": "yarn build && yarn rosetta:extract", "build+test+extract": "yarn build+test && yarn rosetta:extract" }, "cdk-build": { - "cloudformation": "AWS::Synthetics", "env": { "AWSLINT_BASE_CONSTRUCT": true } @@ -82,31 +83,17 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", + "@types/jest": "^27.5.2", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "engines": { @@ -118,6 +105,17 @@ "announce": false }, "publishConfig": { - "tag": "next" + "tag": "latest" + }, + "awslint": { + "exclude": [ + "*:*" + ] + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/aws-synthetics/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-synthetics/rosetta/default.ts-fixture index a0a9d5c2a596e..0ae2b7e2d279d 100644 --- a/packages/@aws-cdk/aws-synthetics/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/aws-synthetics/rosetta/default.ts-fixture @@ -1,7 +1,7 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as synthetics from '@aws-cdk/aws-synthetics'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as synthetics from '@aws-cdk/aws-synthetics-alpha'; import * as path from 'path'; class Fixture extends Stack { diff --git a/packages/@aws-cdk/aws-synthetics/test/canary.test.ts b/packages/@aws-cdk/aws-synthetics/test/canary.test.ts index 891aee2a40baf..3b62968514e29 100644 --- a/packages/@aws-cdk/aws-synthetics/test/canary.test.ts +++ b/packages/@aws-cdk/aws-synthetics/test/canary.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Duration, Lazy, Stack } from '@aws-cdk/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { Duration, Lazy, Stack } from 'aws-cdk-lib'; import * as synthetics from '../lib'; test('Basic canary properties work', () => { diff --git a/packages/@aws-cdk/aws-synthetics/test/code.test.ts b/packages/@aws-cdk/aws-synthetics/test/code.test.ts index 316ae6dc5ccfc..ed07eb37cceff 100644 --- a/packages/@aws-cdk/aws-synthetics/test/code.test.ts +++ b/packages/@aws-cdk/aws-synthetics/test/code.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from 'aws-cdk-lib/assertions'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { App, Stack } from 'aws-cdk-lib'; +import * as cxapi from 'aws-cdk-lib/cx-api'; import * as synthetics from '../lib'; import { RuntimeFamily } from '../lib'; diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts b/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts index b1a26949d054a..9ebf0828124e0 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts +++ b/packages/@aws-cdk/aws-synthetics/test/integ.canary.ts @@ -1,8 +1,8 @@ /// !cdk-integ canary-one import * as path from 'path'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; import * as synthetics from '../lib'; /* diff --git a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.ts b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.ts index 2d2d57aaae2f4..2042ea8d36e26 100644 --- a/packages/@aws-cdk/aws-synthetics/test/integ.vpc.ts +++ b/packages/@aws-cdk/aws-synthetics/test/integ.vpc.ts @@ -1,8 +1,8 @@ /// !cdk-integ canary-vpc import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as cdk from 'aws-cdk-lib'; import * as synthetics from '../lib'; /* diff --git a/packages/@aws-cdk/aws-synthetics/test/metric.test.ts b/packages/@aws-cdk/aws-synthetics/test/metric.test.ts index 767ab484e56f9..550d28cdbc8b9 100644 --- a/packages/@aws-cdk/aws-synthetics/test/metric.test.ts +++ b/packages/@aws-cdk/aws-synthetics/test/metric.test.ts @@ -1,4 +1,4 @@ -import { App, Stack } from '@aws-cdk/core'; +import { App, Stack } from 'aws-cdk-lib'; import * as synthetics from '../lib'; test('.metricXxx() methods can be used to obtain Metrics for the canary', () => { diff --git a/packages/@aws-cdk/aws-systemsmanagersap/.eslintrc.js b/packages/@aws-cdk/aws-systemsmanagersap/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-systemsmanagersap/.gitignore b/packages/@aws-cdk/aws-systemsmanagersap/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-systemsmanagersap/.npmignore b/packages/@aws-cdk/aws-systemsmanagersap/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-systemsmanagersap/LICENSE b/packages/@aws-cdk/aws-systemsmanagersap/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-systemsmanagersap/NOTICE b/packages/@aws-cdk/aws-systemsmanagersap/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-systemsmanagersap/README.md b/packages/@aws-cdk/aws-systemsmanagersap/README.md deleted file mode 100644 index f53f61696d979..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::SystemsManagerSAP Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as systemsmanagersap from '@aws-cdk/aws-systemsmanagersap'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for SystemsManagerSAP construct libraries](https://constructs.dev/search?q=systemsmanagersap) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SystemsManagerSAP resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SystemsManagerSAP.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SystemsManagerSAP](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SystemsManagerSAP.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-systemsmanagersap/jest.config.js b/packages/@aws-cdk/aws-systemsmanagersap/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-systemsmanagersap/lib/index.ts b/packages/@aws-cdk/aws-systemsmanagersap/lib/index.ts deleted file mode 100644 index a6672799999c9..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::SystemsManagerSAP CloudFormation Resources: -export * from './systemsmanagersap.generated'; diff --git a/packages/@aws-cdk/aws-systemsmanagersap/package.json b/packages/@aws-cdk/aws-systemsmanagersap/package.json deleted file mode 100644 index d549ad1849e28..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-systemsmanagersap", - "version": "0.0.0", - "description": "AWS::SystemsManagerSAP Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.SystemsManagerSAP", - "packageId": "Amazon.CDK.AWS.SystemsManagerSAP", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.systemsmanagersap", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "systemsmanagersap" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-systemsmanagersap", - "module": "aws_cdk.aws_systemsmanagersap" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-systemsmanagersap" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::SystemsManagerSAP", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::SystemsManagerSAP", - "aws-systemsmanagersap" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-systemsmanagersap/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-systemsmanagersap/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-systemsmanagersap/test/systemsmanagersap.test.ts b/packages/@aws-cdk/aws-systemsmanagersap/test/systemsmanagersap.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-systemsmanagersap/test/systemsmanagersap.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-timestream/.eslintrc.js b/packages/@aws-cdk/aws-timestream/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-timestream/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-timestream/.gitignore b/packages/@aws-cdk/aws-timestream/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-timestream/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-timestream/.npmignore b/packages/@aws-cdk/aws-timestream/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-timestream/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-timestream/LICENSE b/packages/@aws-cdk/aws-timestream/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-timestream/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-timestream/NOTICE b/packages/@aws-cdk/aws-timestream/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-timestream/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-timestream/README.md b/packages/@aws-cdk/aws-timestream/README.md deleted file mode 100644 index b27dfc696a42a..0000000000000 --- a/packages/@aws-cdk/aws-timestream/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Timestream Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as timestream from '@aws-cdk/aws-timestream'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Timestream construct libraries](https://constructs.dev/search?q=timestream) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Timestream resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Timestream.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Timestream](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Timestream.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-timestream/jest.config.js b/packages/@aws-cdk/aws-timestream/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-timestream/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-timestream/lib/index.ts b/packages/@aws-cdk/aws-timestream/lib/index.ts deleted file mode 100644 index 37d9f1ae9e1cd..0000000000000 --- a/packages/@aws-cdk/aws-timestream/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Timestream CloudFormation Resources: -export * from './timestream.generated'; diff --git a/packages/@aws-cdk/aws-timestream/package.json b/packages/@aws-cdk/aws-timestream/package.json deleted file mode 100644 index 1639e6fb346e7..0000000000000 --- a/packages/@aws-cdk/aws-timestream/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-timestream", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Timestream", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Timestream", - "packageId": "Amazon.CDK.AWS.Timestream", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.timestream", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "timestream" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-timestream", - "module": "aws_cdk.aws_timestream" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-timestream" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Timestream", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Timestream", - "aws-timestream" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-timestream/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-timestream/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-timestream/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-timestream/test/timestream.test.ts b/packages/@aws-cdk/aws-timestream/test/timestream.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-timestream/test/timestream.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-transfer/.eslintrc.js b/packages/@aws-cdk/aws-transfer/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-transfer/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-transfer/.gitignore b/packages/@aws-cdk/aws-transfer/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-transfer/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-transfer/.npmignore b/packages/@aws-cdk/aws-transfer/.npmignore deleted file mode 100644 index 432e3a865c0f1..0000000000000 --- a/packages/@aws-cdk/aws-transfer/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo - -# Include .jsii -!.jsii - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-transfer/LICENSE b/packages/@aws-cdk/aws-transfer/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-transfer/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-transfer/NOTICE b/packages/@aws-cdk/aws-transfer/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-transfer/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-transfer/README.md b/packages/@aws-cdk/aws-transfer/README.md deleted file mode 100644 index 2a77fbebd05a7..0000000000000 --- a/packages/@aws-cdk/aws-transfer/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Transfer for SFTP Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as transfer from '@aws-cdk/aws-transfer'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Transfer construct libraries](https://constructs.dev/search?q=transfer) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Transfer resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Transfer.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Transfer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Transfer.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-transfer/jest.config.js b/packages/@aws-cdk/aws-transfer/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-transfer/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-transfer/lib/index.ts b/packages/@aws-cdk/aws-transfer/lib/index.ts deleted file mode 100644 index 25c43222afc81..0000000000000 --- a/packages/@aws-cdk/aws-transfer/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Transfer CloudFormation Resources: -export * from './transfer.generated'; diff --git a/packages/@aws-cdk/aws-transfer/package.json b/packages/@aws-cdk/aws-transfer/package.json deleted file mode 100644 index a639630e22424..0000000000000 --- a/packages/@aws-cdk/aws-transfer/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-transfer", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::Transfer", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Transfer", - "packageId": "Amazon.CDK.AWS.Transfer", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.transfer", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "transfer" - } - }, - "python": { - "distName": "aws-cdk.aws-transfer", - "module": "aws_cdk.aws_transfer", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-transfer" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Transfer", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Transfer", - "aws-transfer" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-transfer/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-transfer/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-transfer/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-transfer/test/transfer.test.ts b/packages/@aws-cdk/aws-transfer/test/transfer.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-transfer/test/transfer.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-voiceid/.eslintrc.js b/packages/@aws-cdk/aws-voiceid/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-voiceid/.gitignore b/packages/@aws-cdk/aws-voiceid/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-voiceid/.npmignore b/packages/@aws-cdk/aws-voiceid/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-voiceid/LICENSE b/packages/@aws-cdk/aws-voiceid/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-voiceid/NOTICE b/packages/@aws-cdk/aws-voiceid/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-voiceid/README.md b/packages/@aws-cdk/aws-voiceid/README.md deleted file mode 100644 index fc846552ef5b8..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::VoiceID Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as voiceid from '@aws-cdk/aws-voiceid'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for VoiceID construct libraries](https://constructs.dev/search?q=voiceid) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::VoiceID resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VoiceID.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::VoiceID](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VoiceID.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-voiceid/jest.config.js b/packages/@aws-cdk/aws-voiceid/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-voiceid/lib/index.ts b/packages/@aws-cdk/aws-voiceid/lib/index.ts deleted file mode 100644 index 8c1b9f5270761..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::VoiceID CloudFormation Resources: -export * from './voiceid.generated'; diff --git a/packages/@aws-cdk/aws-voiceid/package.json b/packages/@aws-cdk/aws-voiceid/package.json deleted file mode 100644 index 340db7e6fab72..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-voiceid", - "version": "0.0.0", - "description": "AWS::VoiceID Construct Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.VoiceID", - "packageId": "Amazon.CDK.AWS.VoiceID", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.voiceid", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "voiceid" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-voiceid", - "module": "aws_cdk.aws_voiceid" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-voiceid" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::VoiceID", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::VoiceID", - "aws-voiceid" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-voiceid/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-voiceid/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-voiceid/test/voiceid.test.ts b/packages/@aws-cdk/aws-voiceid/test/voiceid.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-voiceid/test/voiceid.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-vpclattice/.eslintrc.js b/packages/@aws-cdk/aws-vpclattice/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-vpclattice/.gitignore b/packages/@aws-cdk/aws-vpclattice/.gitignore deleted file mode 100644 index 62ebc95d75ce6..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml diff --git a/packages/@aws-cdk/aws-vpclattice/.npmignore b/packages/@aws-cdk/aws-vpclattice/.npmignore deleted file mode 100644 index f931fede67c44..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts diff --git a/packages/@aws-cdk/aws-vpclattice/LICENSE b/packages/@aws-cdk/aws-vpclattice/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-vpclattice/NOTICE b/packages/@aws-cdk/aws-vpclattice/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-vpclattice/README.md b/packages/@aws-cdk/aws-vpclattice/README.md deleted file mode 100644 index cbea004aac037..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::VpcLattice Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as vpclattice from '@aws-cdk/aws-vpclattice'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for VpcLattice construct libraries](https://constructs.dev/search?q=vpclattice) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::VpcLattice resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VpcLattice.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::VpcLattice](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VpcLattice.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-vpclattice/jest.config.js b/packages/@aws-cdk/aws-vpclattice/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-vpclattice/lib/index.ts b/packages/@aws-cdk/aws-vpclattice/lib/index.ts deleted file mode 100644 index b2778de23f593..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::VpcLattice CloudFormation Resources: -export * from './vpclattice.generated'; diff --git a/packages/@aws-cdk/aws-vpclattice/package.json b/packages/@aws-cdk/aws-vpclattice/package.json deleted file mode 100644 index 87a973d009b51..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-vpclattice", - "version": "0.0.0", - "description": "AWS::VpcLattice Construct Library", - "private": true, - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.VpcLattice", - "packageId": "Amazon.CDK.AWS.VpcLattice", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.vpclattice", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "vpclattice" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-vpclattice", - "module": "aws_cdk.aws_vpclattice" - } - }, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-vpclattice" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::VpcLattice", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::VpcLattice", - "aws-vpclattice" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-vpclattice/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-vpclattice/rosetta/default.ts-fixture deleted file mode 100644 index e208762bca03c..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/rosetta/default.ts-fixture +++ /dev/null @@ -1,8 +0,0 @@ -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - /// here - } -} diff --git a/packages/@aws-cdk/aws-vpclattice/test/vpclattice.test.ts b/packages/@aws-cdk/aws-vpclattice/test/vpclattice.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-vpclattice/test/vpclattice.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-waf/.eslintrc.js b/packages/@aws-cdk/aws-waf/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-waf/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-waf/.gitignore b/packages/@aws-cdk/aws-waf/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-waf/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-waf/.npmignore b/packages/@aws-cdk/aws-waf/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-waf/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-waf/LICENSE b/packages/@aws-cdk/aws-waf/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-waf/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-waf/NOTICE b/packages/@aws-cdk/aws-waf/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-waf/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-waf/README.md b/packages/@aws-cdk/aws-waf/README.md deleted file mode 100644 index 2281405839159..0000000000000 --- a/packages/@aws-cdk/aws-waf/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS Web Application Firewall Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as waf from '@aws-cdk/aws-waf'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for WAF construct libraries](https://constructs.dev/search?q=waf) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WAF resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAF.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WAF](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAF.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-waf/jest.config.js b/packages/@aws-cdk/aws-waf/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-waf/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-waf/lib/index.ts b/packages/@aws-cdk/aws-waf/lib/index.ts deleted file mode 100644 index f82292d42ab61..0000000000000 --- a/packages/@aws-cdk/aws-waf/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::WAF CloudFormation Resources: -export * from './waf.generated'; diff --git a/packages/@aws-cdk/aws-waf/package.json b/packages/@aws-cdk/aws-waf/package.json deleted file mode 100644 index 70e0bd5563094..0000000000000 --- a/packages/@aws-cdk/aws-waf/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-waf", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::WAF", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.waf", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "waf" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.WAF", - "packageId": "Amazon.CDK.AWS.WAF", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-waf", - "module": "aws_cdk.aws_waf", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-waf" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::WAF", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "waf" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-waf/test/waf.test.ts b/packages/@aws-cdk/aws-waf/test/waf.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-waf/test/waf.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-wafregional/.eslintrc.js b/packages/@aws-cdk/aws-wafregional/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-wafregional/.gitignore b/packages/@aws-cdk/aws-wafregional/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-wafregional/.npmignore b/packages/@aws-cdk/aws-wafregional/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-wafregional/LICENSE b/packages/@aws-cdk/aws-wafregional/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-wafregional/NOTICE b/packages/@aws-cdk/aws-wafregional/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-wafregional/README.md b/packages/@aws-cdk/aws-wafregional/README.md deleted file mode 100644 index ad793639ede98..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS WAF Regional Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as wafregional from '@aws-cdk/aws-wafregional'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for WAFRegional construct libraries](https://constructs.dev/search?q=wafregional) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WAFRegional resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFRegional.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WAFRegional](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFRegional.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-wafregional/jest.config.js b/packages/@aws-cdk/aws-wafregional/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-wafregional/lib/index.ts b/packages/@aws-cdk/aws-wafregional/lib/index.ts deleted file mode 100644 index c5ccdeff46989..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::WAFRegional CloudFormation Resources: -export * from './wafregional.generated'; diff --git a/packages/@aws-cdk/aws-wafregional/package.json b/packages/@aws-cdk/aws-wafregional/package.json deleted file mode 100644 index 2d845f82dee6e..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-wafregional", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::WAFRegional", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.waf.regional", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "wafregional" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.WAFRegional", - "packageId": "Amazon.CDK.AWS.WAFRegional", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-wafregional", - "module": "aws_cdk.aws_wafregional", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-wafregional" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::WAFRegional", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "wafregional" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-wafregional/test/wafregional.test.ts b/packages/@aws-cdk/aws-wafregional/test/wafregional.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-wafregional/test/wafregional.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-wafv2/.eslintrc.js b/packages/@aws-cdk/aws-wafv2/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-wafv2/.gitignore b/packages/@aws-cdk/aws-wafv2/.gitignore deleted file mode 100644 index 557ed6adc3f75..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.d.ts -*.generated.ts -*.js -*.js.map -*.snk -.jsii -.LAST_BUILD -.LAST_PACKAGE -nyc.config.js -.nyc_output -coverage -dist -tsconfig.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-wafv2/.npmignore b/packages/@aws-cdk/aws-wafv2/.npmignore deleted file mode 100644 index b8abeff418a53..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE - -*.tsbuildinfo -tsconfig.json -!.jsii -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-wafv2/LICENSE b/packages/@aws-cdk/aws-wafv2/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-wafv2/NOTICE b/packages/@aws-cdk/aws-wafv2/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-wafv2/README.md b/packages/@aws-cdk/aws-wafv2/README.md deleted file mode 100644 index 802fa1d45f778..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::WAFv2 Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as wafv2 from '@aws-cdk/aws-wafv2'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for WAFv2 construct libraries](https://constructs.dev/search?q=wafv2) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WAFv2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFv2.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WAFv2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFv2.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-wafv2/jest.config.js b/packages/@aws-cdk/aws-wafv2/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-wafv2/lib/index.ts b/packages/@aws-cdk/aws-wafv2/lib/index.ts deleted file mode 100644 index dc251f24ea749..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::WAFv2 CloudFormation Resources: -export * from './wafv2.generated'; diff --git a/packages/@aws-cdk/aws-wafv2/package.json b/packages/@aws-cdk/aws-wafv2/package.json deleted file mode 100644 index 3835a65f93337..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "@aws-cdk/aws-wafv2", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::WAFv2", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.WAFv2", - "packageId": "Amazon.CDK.AWS.WAFv2", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.wafv2", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "wafv2" - } - }, - "python": { - "distName": "aws-cdk.aws-wafv2", - "module": "aws_cdk.aws_wafv2", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-wafv2" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "integ": "integ-runner", - "lint": "cdk-lint", - "package": "cdk-package", - "awslint": "cdk-awslint", - "pkglint": "pkglint -f", - "test": "cdk-test", - "watch": "cdk-watch", - "cfn2ts": "cfn2ts", - "compat": "cdk-compat", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::WAFv2", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::WAFv2", - "aws-wafv2" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-wafv2/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-wafv2/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-wafv2/test/wafv2.test.ts b/packages/@aws-cdk/aws-wafv2/test/wafv2.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-wafv2/test/wafv2.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-wisdom/.eslintrc.js b/packages/@aws-cdk/aws-wisdom/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-wisdom/.gitignore b/packages/@aws-cdk/aws-wisdom/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-wisdom/.npmignore b/packages/@aws-cdk/aws-wisdom/.npmignore deleted file mode 100644 index d0640920510e0..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts - -**/*.snapshot diff --git a/packages/@aws-cdk/aws-wisdom/LICENSE b/packages/@aws-cdk/aws-wisdom/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-wisdom/NOTICE b/packages/@aws-cdk/aws-wisdom/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-wisdom/README.md b/packages/@aws-cdk/aws-wisdom/README.md deleted file mode 100644 index 22c17e3b3271d..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::Wisdom Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as wisdom from '@aws-cdk/aws-wisdom'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for Wisdom construct libraries](https://constructs.dev/search?q=wisdom) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Wisdom resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Wisdom.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Wisdom](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Wisdom.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-wisdom/jest.config.js b/packages/@aws-cdk/aws-wisdom/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-wisdom/lib/index.ts b/packages/@aws-cdk/aws-wisdom/lib/index.ts deleted file mode 100644 index 368aee100e245..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::Wisdom CloudFormation Resources: -export * from './wisdom.generated'; diff --git a/packages/@aws-cdk/aws-wisdom/package.json b/packages/@aws-cdk/aws-wisdom/package.json deleted file mode 100644 index 144a386fc7168..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/package.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "name": "@aws-cdk/aws-wisdom", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::Wisdom", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.Wisdom", - "packageId": "Amazon.CDK.AWS.Wisdom", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.wisdom", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "wisdom" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-wisdom", - "module": "aws_cdk.aws_wisdom" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-wisdom" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::Wisdom", - "jest": true, - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::Wisdom", - "aws-wisdom" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-wisdom/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-wisdom/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-wisdom/test/aws-wisdom.test.ts b/packages/@aws-cdk/aws-wisdom/test/aws-wisdom.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-wisdom/test/aws-wisdom.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-workspaces/.eslintrc.js b/packages/@aws-cdk/aws-workspaces/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-workspaces/.gitignore b/packages/@aws-cdk/aws-workspaces/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-workspaces/.npmignore b/packages/@aws-cdk/aws-workspaces/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-workspaces/LICENSE b/packages/@aws-cdk/aws-workspaces/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-workspaces/NOTICE b/packages/@aws-cdk/aws-workspaces/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-workspaces/README.md b/packages/@aws-cdk/aws-workspaces/README.md deleted file mode 100644 index 9246d9293dd53..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Amazon WorkSpaces Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as workspaces from '@aws-cdk/aws-workspaces'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for WorkSpaces construct libraries](https://constructs.dev/search?q=workspaces) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WorkSpaces resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WorkSpaces.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WorkSpaces](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WorkSpaces.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-workspaces/jest.config.js b/packages/@aws-cdk/aws-workspaces/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-workspaces/lib/index.ts b/packages/@aws-cdk/aws-workspaces/lib/index.ts deleted file mode 100644 index ffedaa5887aa8..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::WorkSpaces CloudFormation Resources: -export * from './workspaces.generated'; diff --git a/packages/@aws-cdk/aws-workspaces/package.json b/packages/@aws-cdk/aws-workspaces/package.json deleted file mode 100644 index 9703b1678f18d..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@aws-cdk/aws-workspaces", - "version": "0.0.0", - "private": true, - "description": "The CDK Construct Library for AWS::WorkSpaces", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.workspaces", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "workspaces" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.WorkSpaces", - "packageId": "Amazon.CDK.AWS.WorkSpaces", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.aws-workspaces", - "module": "aws_cdk.aws_workspaces", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-workspaces" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::WorkSpaces", - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "workspaces" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/aws-workspaces/test/workspaces.test.ts b/packages/@aws-cdk/aws-workspaces/test/workspaces.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-workspaces/test/workspaces.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/aws-xray/.eslintrc.js b/packages/@aws-cdk/aws-xray/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/aws-xray/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-xray/.gitignore b/packages/@aws-cdk/aws-xray/.gitignore deleted file mode 100644 index a103aefa2bfbb..0000000000000 --- a/packages/@aws-cdk/aws-xray/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk -nyc.config.js -!.eslintrc.js -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/aws-xray/.npmignore b/packages/@aws-cdk/aws-xray/.npmignore deleted file mode 100644 index d70611c1df0b0..0000000000000 --- a/packages/@aws-cdk/aws-xray/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json - -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/aws-xray/LICENSE b/packages/@aws-cdk/aws-xray/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/aws-xray/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-xray/NOTICE b/packages/@aws-cdk/aws-xray/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/aws-xray/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-xray/README.md b/packages/@aws-cdk/aws-xray/README.md deleted file mode 100644 index 1dbb4e1daa846..0000000000000 --- a/packages/@aws-cdk/aws-xray/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AWS::XRay Construct Library - - ---- - -![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge) - -> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib - ---- - - - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. - -```ts nofixture -import * as xray from '@aws-cdk/aws-xray'; -``` - - - -There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: - -- Search [Construct Hub for XRay construct libraries](https://constructs.dev/search?q=xray) -- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::XRay resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_XRay.html) directly. - - - - -There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. -However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. - -For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::XRay](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_XRay.html). - -(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) - - diff --git a/packages/@aws-cdk/aws-xray/jest.config.js b/packages/@aws-cdk/aws-xray/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/aws-xray/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/aws-xray/lib/index.ts b/packages/@aws-cdk/aws-xray/lib/index.ts deleted file mode 100644 index 9912dab6f0e95..0000000000000 --- a/packages/@aws-cdk/aws-xray/lib/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// AWS::XRay CloudFormation Resources: -export * from './xray.generated'; diff --git a/packages/@aws-cdk/aws-xray/package.json b/packages/@aws-cdk/aws-xray/package.json deleted file mode 100644 index a0b807472562e..0000000000000 --- a/packages/@aws-cdk/aws-xray/package.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "@aws-cdk/aws-xray", - "version": "0.0.0", - "description": "The CDK Construct Library for AWS::XRay", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - }, - "targets": { - "dotnet": { - "namespace": "Amazon.CDK.AWS.XRay", - "packageId": "Amazon.CDK.AWS.XRay", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "java": { - "package": "software.amazon.awscdk.services.xray", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "xray" - } - }, - "python": { - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ], - "distName": "aws-cdk.aws-xray", - "module": "aws_cdk.aws_xray" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-xray" - }, - "homepage": "https://github.com/aws/aws-cdk", - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "cfn2ts": "cfn2ts", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::XRay", - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "AWS::XRay", - "aws-xray" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "peerDependencies": { - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "experimental", - "maturity": "cfn-only", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/aws-xray/rosetta/default.ts-fixture b/packages/@aws-cdk/aws-xray/rosetta/default.ts-fixture deleted file mode 100644 index e8deb6060d76d..0000000000000 --- a/packages/@aws-cdk/aws-xray/rosetta/default.ts-fixture +++ /dev/null @@ -1,11 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/aws-xray/test/xray.test.ts b/packages/@aws-cdk/aws-xray/test/xray.test.ts deleted file mode 100644 index 465c7bdea0693..0000000000000 --- a/packages/@aws-cdk/aws-xray/test/xray.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import '@aws-cdk/assertions'; -import {} from '../lib'; - -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/packages/@aws-cdk/cdk-assets-schema/.eslintrc.js b/packages/@aws-cdk/cdk-assets-schema/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/cdk-assets-schema/.gitignore b/packages/@aws-cdk/cdk-assets-schema/.gitignore deleted file mode 100644 index d93ce1bcf5d13..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -dist -tsconfig.json -.jsii - -.LAST_BUILD -.LAST_PACKAGE -*.snk -.nyc_output -coverage -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/cdk-assets-schema/.npmignore b/packages/@aws-cdk/cdk-assets-schema/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/cdk-assets-schema/LICENSE b/packages/@aws-cdk/cdk-assets-schema/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/cdk-assets-schema/NOTICE b/packages/@aws-cdk/cdk-assets-schema/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/cdk-assets-schema/README.md b/packages/@aws-cdk/cdk-assets-schema/README.md deleted file mode 100644 index e2244353ab879..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# cdk-assets-schema - - ---- - -![Deprecated](https://img.shields.io/badge/deprecated-critical.svg?style=for-the-badge) - -> This API may emit warnings. Backward compatibility is not guaranteed. - ---- - - - -This schema is now part of @aws-cdk/cloud-assembly-schema. diff --git a/packages/@aws-cdk/cdk-assets-schema/jest.config.js b/packages/@aws-cdk/cdk-assets-schema/jest.config.js deleted file mode 100644 index 751c263a6e75c..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - ...baseConfig.coverageThreshold.global, - branches: 70, - }, - }, -}; diff --git a/packages/@aws-cdk/cdk-assets-schema/lib/index.ts b/packages/@aws-cdk/cdk-assets-schema/lib/index.ts deleted file mode 100644 index d016a0a03cf7d..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/lib/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* eslint-disable no-console */ -console.error('error: @aws-cdk/cdk-assets-schema has been merged into @aws-cdk/cloud-assembly-schema'); - -export { }; diff --git a/packages/@aws-cdk/cdk-assets-schema/package.json b/packages/@aws-cdk/cdk-assets-schema/package.json deleted file mode 100644 index efd3e5617c08b..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/package.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "@aws-cdk/cdk-assets-schema", - "version": "0.0.0", - "private": true, - "description": "Schema definition for the Asset Manifest", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.cdkassets.schema", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-assets-schema" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.CdkAssets.Schema", - "packageId": "Amazon.CDK.CdkAssets.Schema", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.cdk-assets-schema", - "module": "aws_cdk.cdk_assets_schema", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "repository": { - "url": "https://github.com/aws/aws-cdk.git", - "type": "git", - "directory": "packages/@aws-cdk/cdk-assets-schema" - }, - "keywords": [ - "aws", - "cdk" - ], - "homepage": "https://github.com/aws/aws-cdk", - "engines": { - "node": ">= 14.15.0" - }, - "stability": "deprecated", - "awscdkio": { - "announce": false - }, - "deprecated": "merged into @aws-cdk/cloud-assembly-schema", - "maturity": "deprecated", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/cdk-assets-schema/test/dummy.test.ts b/packages/@aws-cdk/cdk-assets-schema/test/dummy.test.ts deleted file mode 100644 index bdb221e0c7dc8..0000000000000 --- a/packages/@aws-cdk/cdk-assets-schema/test/dummy.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -test('dummy', () => { - expect(true).toBeTruthy(); -}); diff --git a/packages/@aws-cdk/cli-lib/.eslintrc.js b/packages/@aws-cdk/cli-lib/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/cli-lib/.eslintrc.js +++ b/packages/@aws-cdk/cli-lib/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/cli-lib/.gitignore b/packages/@aws-cdk/cli-lib/.gitignore index 65127280662be..428af05f4b5f3 100644 --- a/packages/@aws-cdk/cli-lib/.gitignore +++ b/packages/@aws-cdk/cli-lib/.gitignore @@ -23,3 +23,5 @@ npm-shrinkwrap.json !jest.config.js junit.xml + +* diff --git a/packages/@aws-cdk/cli-lib/package.json b/packages/@aws-cdk/cli-lib/package.json index 4e80640e2e270..98b6da0ebbe48 100644 --- a/packages/@aws-cdk/cli-lib/package.json +++ b/packages/@aws-cdk/cli-lib/package.json @@ -1,32 +1,36 @@ { - "name": "@aws-cdk/cli-lib", + "name": "@aws-cdk/cli-lib-alpha", "description": "AWS CDK Programmatic CLI library", "version": "0.0.0", - "private": true, + "private": false, "main": "lib/main.js", "types": "lib/index.d.ts", "jsii": { "outdir": "dist", "targets": { "dotnet": { - "namespace": "Amazon.CDK.Cli.Lib", - "packageId": "Amazon.CDK.Cli.Lib", + "namespace": "Amazon.CDK.Cli.Lib.Alpha", + "packageId": "Amazon.CDK.Cli.Lib.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "java": { - "package": "software.amazon.awscdk.cli.lib", + "package": "software.amazon.awscdk.cli.lib.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "cdk-cli-lib" + "artifactId": "cdk-cli-lib-alpha" } }, "python": { - "distName": "aws-cdk.cli-lib", - "module": "aws_cdk.cli_lib", + "distName": "aws-cdk.cli-lib-alpha", + "module": "aws_cdk.cli_lib_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkclilibalpha" } }, "projectReferences": true, @@ -58,7 +62,7 @@ }, "awslint": { "exclude": [ - "construct-ctor:@aws-cdk/cli-lib.AwsCdkCli" + "*:*" ] }, "cdk-build": { @@ -82,8 +86,7 @@ "license": "Apache-2.0", "devDependencies": { "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/node-bundle": "0.0.0", + "aws-cdk-lib": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", "aws-cdk": "0.0.0", @@ -112,5 +115,13 @@ }, "awscdkio": { "announce": false - } + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] + }, + "dependencies": {}, + "peerDependencies": {} } diff --git a/packages/@aws-cdk/cli-lib/rosetta/default.ts-fixture b/packages/@aws-cdk/cli-lib/rosetta/default.ts-fixture index e068db5d7f126..e714a8e55535d 100644 --- a/packages/@aws-cdk/cli-lib/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/cli-lib/rosetta/default.ts-fixture @@ -1,6 +1,6 @@ // Fixture with an AwsCdkCli set up -import * as cdk from '@aws-cdk/core'; -import { AwsCdkCli } from '@aws-cdk/cli-lib'; +import * as cdk from 'aws-cdk-lib'; +import { AwsCdkCli } from '@aws-cdk/cli-lib-alpha'; const cli = AwsCdkCli.fromCloudAssemblyDirectoryProducer({ produce: async (context: Record) => { diff --git a/packages/@aws-cdk/cli-lib/rosetta/imports.ts-fixture b/packages/@aws-cdk/cli-lib/rosetta/imports.ts-fixture index 0baefc25ac1c5..8824253afe9f4 100644 --- a/packages/@aws-cdk/cli-lib/rosetta/imports.ts-fixture +++ b/packages/@aws-cdk/cli-lib/rosetta/imports.ts-fixture @@ -1,5 +1,5 @@ // Fixture with imports, but nothing else -import * as cdk from '@aws-cdk/core'; -import { AwsCdkCli, ICloudAssemblyDirectoryProducer } from '@aws-cdk/cli-lib'; +import * as cdk from 'aws-cdk-lib'; +import { AwsCdkCli, ICloudAssemblyDirectoryProducer } from '@aws-cdk/cli-lib-alpha'; /// here diff --git a/packages/@aws-cdk/cli-lib/rosetta/producer.ts-fixture b/packages/@aws-cdk/cli-lib/rosetta/producer.ts-fixture index 01845e841ee6f..093665648f5b7 100644 --- a/packages/@aws-cdk/cli-lib/rosetta/producer.ts-fixture +++ b/packages/@aws-cdk/cli-lib/rosetta/producer.ts-fixture @@ -1,6 +1,6 @@ // Fixture with imports, but nothing else -import * as cdk from '@aws-cdk/core'; -import { AwsCdkCli, ICloudAssemblyDirectoryProducer } from '@aws-cdk/cli-lib'; +import * as cdk from 'aws-cdk-lib'; +import { AwsCdkCli, ICloudAssemblyDirectoryProducer } from '@aws-cdk/cli-lib-alpha'; class MyProducer implements ICloudAssemblyDirectoryProducer { async produce(context: Record) { diff --git a/packages/@aws-cdk/cli-lib/test/cli.test.ts b/packages/@aws-cdk/cli-lib/test/cli.test.ts index 48f33d712d789..4a152794eaed2 100644 --- a/packages/@aws-cdk/cli-lib/test/cli.test.ts +++ b/packages/@aws-cdk/cli-lib/test/cli.test.ts @@ -1,5 +1,5 @@ import { join } from 'path'; -import * as core from '@aws-cdk/core'; +import * as core from 'aws-cdk-lib'; import * as cli from 'aws-cdk/lib'; import { AwsCdkCli } from '../lib'; diff --git a/packages/@aws-cdk/cli-lib/test/commands.test.ts b/packages/@aws-cdk/cli-lib/test/commands.test.ts index d76c60f5bb156..5fefc5995dc61 100644 --- a/packages/@aws-cdk/cli-lib/test/commands.test.ts +++ b/packages/@aws-cdk/cli-lib/test/commands.test.ts @@ -1,4 +1,4 @@ -import * as core from '@aws-cdk/core'; +import * as core from 'aws-cdk-lib'; import * as cli from 'aws-cdk/lib'; import { AwsCdkCli } from '../lib'; import { RequireApproval, StackActivityProgress } from '../lib/commands'; diff --git a/packages/@aws-cdk/cli-lib/test/test-app/app.ts b/packages/@aws-cdk/cli-lib/test/test-app/app.ts index 340658c632472..5e57c0b34c932 100644 --- a/packages/@aws-cdk/cli-lib/test/test-app/app.ts +++ b/packages/@aws-cdk/cli-lib/test/test-app/app.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; const app = new cdk.App(); new cdk.Stack(app, 'AppStack1'); diff --git a/packages/@aws-cdk/cloudformation-include/.eslintrc.js b/packages/@aws-cdk/cloudformation-include/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/cloudformation-include/.gitignore b/packages/@aws-cdk/cloudformation-include/.gitignore deleted file mode 100644 index 5f6f745d433c6..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -*.js -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -*.tgz -.jsii -tsconfig.json - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk - -!.eslintrc.js -!build.js -cfn-types-2-classes.json -!jest.config.js - -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/cloudformation-include/.npmignore b/packages/@aws-cdk/cloudformation-include/.npmignore deleted file mode 100644 index 0309b1cb10d9c..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js -.eslintrc.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/cloudformation-include/LICENSE b/packages/@aws-cdk/cloudformation-include/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/cloudformation-include/NOTICE b/packages/@aws-cdk/cloudformation-include/NOTICE deleted file mode 100644 index 91f398efbcb4a..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/NOTICE +++ /dev/null @@ -1,23 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** yaml - https://www.npmjs.com/package/yaml -Copyright 2018 Eemeli Aro - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - ----------------- diff --git a/packages/@aws-cdk/cloudformation-include/README.md b/packages/@aws-cdk/cloudformation-include/README.md deleted file mode 100644 index 66e8f1e47e296..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/README.md +++ /dev/null @@ -1,476 +0,0 @@ -# Include CloudFormation templates in the CDK - - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module contains a set of classes whose goal is to facilitate working -with existing CloudFormation templates in the CDK. -It can be thought of as an extension of the capabilities of the -[`CfnInclude` class](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.CfnInclude.html). - -## Basic usage - -Assume we have a file with an existing template. -It could be in JSON format, in a file `my-template.json`: - -```json -{ - "Resources": { - "Bucket": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketName": "some-bucket-name" - } - } - } -} -``` - -Or it could by in YAML format, in a file `my-template.yaml`: - -```yaml -Resources: - Bucket: - Type: AWS::S3::Bucket - Properties: - BucketName: some-bucket-name -``` - -It can be included in a CDK application with the following code: - -```ts -const cfnTemplate = new cfn_inc.CfnInclude(this, 'Template', { - templateFile: 'my-template.json', -}); -``` - -Or, if your template uses YAML: - -```ts -const cfnTemplate = new cfn_inc.CfnInclude(this, 'Template', { - templateFile: 'my-template.yaml', -}); -``` - -**Note**: different YAML parsers sometimes don't agree on what exactly constitutes valid YAML. -If you get a YAML exception when including your template, -try converting it to JSON, and including that file instead. -If you're downloading your template from the CloudFormation AWS Console, -you can easily get it in JSON format by clicking the 'View in Designer' -button on the 'Template' tab - -once in Designer, select JSON in the "Choose template language" -radio buttons on the bottom pane. - -This will add all resources from `my-template.json` / `my-template.yaml` into the CDK application, -preserving their original logical IDs from the template file. - -Any resource from the included template can be retrieved by referring to it by its logical ID from the template. -If you know the class of the CDK object that corresponds to that resource, -you can cast the returned object to the correct type: - -```ts -declare const cfnTemplate: cfn_inc.CfnInclude; -const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; -// cfnBucket is of type s3.CfnBucket -``` - -Note that any resources not present in the latest version of the CloudFormation schema -at the time of publishing the version of this module that you depend on, -including [Custom Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html), -will be returned as instances of the class `CfnResource`, -and so cannot be cast to a different resource type. - -Any modifications made to that resource will be reflected in the resulting CDK template; -for example, the name of the bucket can be changed: - -```ts -declare const cfnTemplate: cfn_inc.CfnInclude; -const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; -cfnBucket.bucketName = 'my-bucket-name'; -``` - -You can also refer to the resource when defining other constructs, -including the higher-level ones -(those whose name does not start with `Cfn`), -for example: - -```ts -declare const cfnTemplate: cfn_inc.CfnInclude; -const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; - -const role = new iam.Role(this, 'Role', { - assumedBy: new iam.AnyPrincipal(), -}); -role.addToPolicy(new iam.PolicyStatement({ - actions: ['s3:*'], - resources: [cfnBucket.attrArn], -})); -``` - -## Migrating templates that use Transforms - -You can use this module to migrate templates that use -[CloudFormation transforms](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-macros.html) - -including the [Serverless transform](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-aws-serverless.html). - -The CDK including process does not execute Transforms, -and the `cdk diff` command by default compares against the original -(meaning, unprocessed) template. -So, if you're downloading the template to include from the CloudFormation AWS Console, -make sure to download the unprocessed template -(the "View processed template" checkbox is left **unchecked**, which is the default): - -![unprocessed template in the CloudFormation AWS Console](doc-images/unprocessed-template.png) - -However, certain unprocessed templates can fail when used with the `CfnInclude` class. -The most common reason for the failure is that the unprocessed template can contain cycles between resources, -which get removed after the Transform is processed, -but is not allowed when being included (as pure CloudFormation does not permit cycles). To enable cycle processing behavior similar -to cloudformation, set `allowCyclicalReferences` of CfnIncludeProps to true. - - -When that happens, you should instead download the processed template from the CloudFormation AWS Console -(make sure the "View processed template" checkbox is **checked** in that case): - -![processed template in the CloudFormation AWS Console](doc-images/processed-template.png) - -When you include that processed template in your CDK application, -running `cdk diff` will now show a lot of differences with the deployed Stack, -because `cdk diff` uses the unprocessed template by default. -To alleviate that problem, you can pass the `--processed` switch to `cdk diff`, -which will make the diff command compare against the processed template of the deployed Stack, -which will give more precise results in this case. - -## Converting L1 resources to L2 - -The resources the `getResource` method returns are what the CDK calls -[Layer 1 resources](https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html#cfn_layer_cfn) -(like `CfnBucket`). -However, in many places in the Construct Library, -the CDK requires so-called Layer 2 resources, like `IBucket`. -There are two ways of going from an L1 to an L2 resource. - -### Using`fromCfn*()` methods - -This is the preferred method of converting an L1 resource to an L2. -It works by invoking a static method of the class of the L2 resource -whose name starts with `fromCfn` - -for example, for KMS Keys, that would be the `Kms.fromCfnKey()` method - -and passing the L1 instance as an argument: - -```ts -declare const cfnTemplate: cfn_inc.CfnInclude; -const cfnKey = cfnTemplate.getResource('Key') as kms.CfnKey; -const key = kms.Key.fromCfnKey(cfnKey); -``` - -This returns an instance of the `kms.IKey` type that can be passed anywhere in the CDK an `IKey` is expected. -What is more, that `IKey` instance will be mutable - -which means calling any mutating methods on it, -like `addToResourcePolicy()`, -will be reflected in the resulting template. - -Note that, in some cases, the `fromCfn*()` method might not be able to create an L2 from the underlying L1. -This can happen when the underlying L1 heavily uses CloudFormation functions. -For example, if you tried to create an L2 `IKey` -from an L1 represented as this CloudFormation template: - -```json -{ - "Resources": { - "Key": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Fn::If": [ - "Condition", - { - "Action": "kms:if-action", - "Resource": "*", - "Principal": "*", - "Effect": "Allow" - }, - { - "Action": "kms:else-action", - "Resource": "*", - "Principal": "*", - "Effect": "Allow" - } - ] - } - ], - "Version": "2012-10-17" - } - } - } - } -} -``` - -The `Key.fromCfnKey()` method does not know how to translate that into CDK L2 concepts, -and would throw an exception. - -In those cases, you need the use the second method of converting an L1 to an L2. - -### Using `from*Name/Arn/Attributes()` methods - -If the resource you need does not have a `fromCfn*()` method, -or if it does, but it throws an exception for your particular L1, -you need to use the second method of converting an L1 resource to L2. - -Each L2 class has static factory methods with names like `from*Name()`, -`from*Arn()`, and/or `from*Attributes()`. -You can obtain an L2 resource from an L1 by passing the correct properties of the L1 as the arguments to those methods: - -```ts -declare const cfnTemplate: cfn_inc.CfnInclude; - -// using from*Name() -const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; -const bucket = s3.Bucket.fromBucketName(this, 'L2Bucket', cfnBucket.ref); - -// using from*Arn() -const cfnKey = cfnTemplate.getResource('Key') as kms.CfnKey; -const key = kms.Key.fromKeyArn(this, 'L2Key', cfnKey.attrArn); - -// using from*Attributes() -declare const privateCfnSubnet1: ec2.CfnSubnet; -declare const privateCfnSubnet2: ec2.CfnSubnet; -const cfnVpc = cfnTemplate.getResource('Vpc') as ec2.CfnVPC; -const vpc = ec2.Vpc.fromVpcAttributes(this, 'L2Vpc', { - vpcId: cfnVpc.ref, - availabilityZones: core.Fn.getAzs(), - privateSubnetIds: [privateCfnSubnet1.ref, privateCfnSubnet2.ref], -}); -``` - -As long as they just need to be referenced, -and not changed in any way, everything should work; -however, note that resources returned from those methods, -unlike those returned by `fromCfn*()` methods, -are immutable, which means calling any mutating methods on them will have no effect. -You will have to mutate the underlying L1 in order to change them. - -## Non-resource template elements - -In addition to resources, -you can also retrieve and mutate all other template elements: - -* [Parameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html): - - ```ts - declare const cfnTemplate: cfn_inc.CfnInclude; - const param: core.CfnParameter = cfnTemplate.getParameter('MyParameter'); - - // mutating the parameter - param.default = 'MyDefault'; - ``` - -* [Conditions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html): - - ```ts - declare const cfnTemplate: cfn_inc.CfnInclude; - const condition: core.CfnCondition = cfnTemplate.getCondition('MyCondition'); - - // mutating the condition - condition.expression = core.Fn.conditionEquals(1, 2); - ``` - -* [Mappings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html): - - ```ts - declare const cfnTemplate: cfn_inc.CfnInclude; - const mapping: core.CfnMapping = cfnTemplate.getMapping('MyMapping'); - - // mutating the mapping - mapping.setValue('my-region', 'AMI', 'ami-04681a1dbd79675a5'); - ``` - -* [Service Catalog template Rules](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html): - - ```ts - declare const cfnTemplate: cfn_inc.CfnInclude; - const rule: core.CfnRule = cfnTemplate.getRule('MyRule'); - - // mutating the rule - declare const myParameter: core.CfnParameter; - rule.addAssertion(core.Fn.conditionContains(['m1.small'], myParameter.valueAsString), - 'MyParameter has to be m1.small'); - ``` - -* [Outputs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html): - - ```ts - declare const cfnTemplate: cfn_inc.CfnInclude; - const output: core.CfnOutput = cfnTemplate.getOutput('MyOutput'); - - // mutating the output - declare const cfnBucket: s3.CfnBucket; - output.value = cfnBucket.attrArn; - ``` - -* [Hooks for blue-green deployments](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/blue-green.html): - - ```ts - declare const cfnTemplate: cfn_inc.CfnInclude; - const hook: core.CfnHook = cfnTemplate.getHook('MyOutput'); - - // mutating the hook - declare const myRole: iam.Role; - const codeDeployHook = hook as core.CfnCodeDeployBlueGreenHook; - codeDeployHook.serviceRole = myRole.roleArn; - ``` - -## Parameter replacement - -If your existing template uses CloudFormation Parameters, -you may want to remove them in favor of build-time values. -You can do that using the `parameters` property: - -```ts -new cfn_inc.CfnInclude(this, 'includeTemplate', { - templateFile: 'path/to/my/template', - parameters: { - 'MyParam': 'my-value', - }, -}); -``` - -This will replace all references to `MyParam` with the string `'my-value'`, -and `MyParam` will be removed from the 'Parameters' section of the resulting template. - -## Nested Stacks - -This module also supports templates that use [nested stacks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html). - -For example, if you have the following parent template: - -```json -{ - "Resources": { - "ChildStack": { - "Type": "AWS::CloudFormation::Stack", - "Properties": { - "TemplateURL": "https://my-s3-template-source.s3.amazonaws.com/child-stack.json" - } - } - } -} -``` - -where the child template pointed to by `https://my-s3-template-source.s3.amazonaws.com/child-stack.json` is: - -```json -{ - "Resources": { - "MyBucket": { - "Type": "AWS::S3::Bucket" - } - } -} -``` - -You can include both the parent stack, -and the nested stack in your CDK application as follows: - -```ts -const parentTemplate = new cfn_inc.CfnInclude(this, 'ParentStack', { - templateFile: 'path/to/my-parent-template.json', - loadNestedStacks: { - 'ChildStack': { - templateFile: 'path/to/my-nested-template.json', - }, - }, -}); -``` - -Here, `path/to/my-nested-template.json` -represents the path on disk to the downloaded template file from the original template URL of the nested stack -(`https://my-s3-template-source.s3.amazonaws.com/child-stack.json`). -In the CDK application, -this file will be turned into an [Asset](https://docs.aws.amazon.com/cdk/latest/guide/assets.html), -and the `TemplateURL` property of the nested stack resource -will be modified to point to that asset. - -The included nested stack can be accessed with the `getNestedStack` method: - -```ts -declare const parentTemplate: cfn_inc.CfnInclude; - -const includedChildStack = parentTemplate.getNestedStack('ChildStack'); -const childStack: core.NestedStack = includedChildStack.stack; -const childTemplate: cfn_inc.CfnInclude = includedChildStack.includedTemplate; -``` - -Now you can reference resources from `ChildStack`, -and modify them like any other included template: - -```ts -declare const childTemplate: cfn_inc.CfnInclude; - -const cfnBucket = childTemplate.getResource('MyBucket') as s3.CfnBucket; -cfnBucket.bucketName = 'my-new-bucket-name'; - -const role = new iam.Role(this, 'MyRole', { - assumedBy: new iam.AccountRootPrincipal(), -}); - -role.addToPolicy(new iam.PolicyStatement({ - actions: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - ], - resources: [cfnBucket.attrArn], -})); -``` - -You can also include the nested stack after the `CfnInclude` object was created, -instead of doing it on construction: - -```ts -declare const parentTemplate: cfn_inc.CfnInclude; -const includedChildStack = parentTemplate.loadNestedStack('ChildTemplate', { - templateFile: 'path/to/my-nested-template.json', -}); -``` - -## Vending CloudFormation templates as Constructs - -In many cases, there are existing CloudFormation templates that are not entire applications, -but more like specialized fragments, implementing a particular pattern or best practice. -If you have templates like that, -you can use the `CfnInclude` class to vend them as CDK Constructs: - -```ts nofixture -import { Construct } from 'constructs'; -import * as cfn_inc from '@aws-cdk/cloudformation-include'; -import * as path from 'path'; - -export class MyConstruct extends Construct { - constructor(scope: Construct, id: string) { - super(scope, id); - - // include a template inside the Construct - new cfn_inc.CfnInclude(this, 'MyConstruct', { - templateFile: path.join(__dirname, 'my-template.json'), - preserveLogicalIds: false, // <--- !!! - }); - } -} -``` - -Notice the `preserveLogicalIds` parameter - -it makes sure the logical IDs of all the included template elements are re-named using CDK's algorithm, -guaranteeing they are unique within your application. -Without that parameter passed, -instantiating `MyConstruct` twice in the same Stack would result in duplicated logical IDs. diff --git a/packages/@aws-cdk/cloudformation-include/build.js b/packages/@aws-cdk/cloudformation-include/build.js deleted file mode 100644 index ab4d071b6cf21..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/build.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This build file has two purposes: - * 1. It adds a dependency on each @aws-cdk/aws-xyz package with L1s to this package. - * 2. It generates the file cfn-types-2-classes.json that contains a mapping - * between the CloudFormation type and the fully-qualified name of the L1 class, - * used in the logic of the CfnInclude class. - */ - -const fs = require('fs'); -const path = require('path'); - -const jsii_reflect = require('jsii-reflect'); - -const packageJson = require('./package.json'); -const dependencies = packageJson.dependencies || {}; -const peerDependencies = packageJson.peerDependencies || {}; - -async function main() { - const constructLibrariesRoot = path.resolve('..'); - const constructLibrariesDirs = fs.readdirSync(constructLibrariesRoot); - let errors = false; - - const typeSystem = new jsii_reflect.TypeSystem(); - const cfnType2L1Class = {}; - // load the @aws-cdk/core assembly first, to find the CfnResource class - await typeSystem.load(path.resolve(constructLibrariesRoot, 'core'), { validate: false }); - const cfnResourceClass = typeSystem.findClass('@aws-cdk/core.CfnResource'); - - for (const constructLibraryDir of constructLibrariesDirs) { - const absConstructLibraryDir = path.resolve(constructLibrariesRoot, constructLibraryDir); - if (!fs.statSync(absConstructLibraryDir).isDirectory()) { continue; } // .DS_Store - - const libraryPackageJson = require(path.join(absConstructLibraryDir, 'package.json')); - - const libraryDependencyVersion = dependencies[libraryPackageJson.name]; - if (libraryPackageJson.maturity === 'deprecated') { - if (libraryDependencyVersion) { - console.error(`Incorrect dependency on deprecated package: ${libraryPackageJson.name}`); - errors = true; - delete dependencies[libraryPackageJson.name]; - delete peerDependencies[libraryPackageJson.name]; - } - // we don't want dependencies on deprecated modules, - // even if they do contain L1s (like eks-legacy) - continue; - } - - // we're not interested in modules that don't use cfn2ts - // (as they don't contain any L1s) - const cfn2ts = (libraryPackageJson['cdk-build'] || {}).cloudformation; - if (!cfn2ts) { - continue; - } - - const libraryVersion = libraryPackageJson.version; - if (!libraryDependencyVersion) { - console.error(`Missing dependency on package: ${libraryPackageJson.name}`); - errors = true; - } else if (libraryDependencyVersion !== libraryVersion) { - console.error(`Incorrect dependency version for package ${libraryPackageJson.name}: expecting '${libraryVersion}', got: '${libraryDependencyVersion}'`); - errors = true; - } - - dependencies[libraryPackageJson.name] = libraryVersion; - // dependencies need to be in both sections to satisfy pkglint - peerDependencies[libraryPackageJson.name] = libraryVersion; - - // load the assembly of this package, - // and find all subclasses of CfnResource to put them in cfnType2L1Class - const assembly = await typeSystem.load(absConstructLibraryDir, { validate: false }); - for (let i = 0; i < assembly.classes.length; i++) { - const classs = assembly.classes[i]; - if (classs.extends(cfnResourceClass)) { - const properties = classs.spec.properties; - const cfnResourceTypeNameProp = (properties || []).find(p => p.name === 'CFN_RESOURCE_TYPE_NAME'); - if (cfnResourceTypeNameProp) { - const [moduleName, ...className] = classs.fqn.split('.'); - const module = require(moduleName); - const jsClassFromModule = module[className.join('.')]; - cfnType2L1Class[jsClassFromModule.CFN_RESOURCE_TYPE_NAME] = classs.fqn; - } - } - } - } - - fs.writeFileSync(path.join(__dirname, 'package.json'), - JSON.stringify(packageJson, undefined, 2) + '\n'); - fs.writeFileSync(path.join(__dirname, 'cfn-types-2-classes.json'), - JSON.stringify(cfnType2L1Class, undefined, 2) + '\n'); - - if (errors) { - console.error('errors found. updated package.json'); - process.exit(1); - } -} - -(async () => { - try { - await main(); - } catch (e) { - console.error(e); - process.exit(1); - } -})(); diff --git a/packages/@aws-cdk/cloudformation-include/jest.config.js b/packages/@aws-cdk/cloudformation-include/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/cloudformation-include/package.json b/packages/@aws-cdk/cloudformation-include/package.json deleted file mode 100644 index eb27d6dd83ce1..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/package.json +++ /dev/null @@ -1,558 +0,0 @@ -{ - "name": "@aws-cdk/cloudformation-include", - "version": "0.0.0", - "private": true, - "description": "A package that facilitates working with existing CloudFormation templates in the CDK", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.cloudformation.include", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-cloudformation-include" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.CloudFormation.Include", - "packageId": "Amazon.CDK.CloudFormation.Include", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.cloudformation-include", - "module": "aws_cdk.cloudformation_include", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/cloudformation-include" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "pre": [ - "node ./build.js" - ], - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "dependencies": { - "@aws-cdk/alexa-ask": "0.0.0", - "@aws-cdk/aws-accessanalyzer": "0.0.0", - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-amazonmq": "0.0.0", - "@aws-cdk/aws-amplify": "0.0.0", - "@aws-cdk/aws-amplifyuibuilder": "0.0.0", - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-appconfig": "0.0.0", - "@aws-cdk/aws-appflow": "0.0.0", - "@aws-cdk/aws-appintegrations": "0.0.0", - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-applicationinsights": "0.0.0", - "@aws-cdk/aws-appmesh": "0.0.0", - "@aws-cdk/aws-apprunner": "0.0.0", - "@aws-cdk/aws-appstream": "0.0.0", - "@aws-cdk/aws-appsync": "0.0.0", - "@aws-cdk/aws-aps": "0.0.0", - "@aws-cdk/aws-athena": "0.0.0", - "@aws-cdk/aws-auditmanager": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-autoscalingplans": "0.0.0", - "@aws-cdk/aws-backup": "0.0.0", - "@aws-cdk/aws-batch": "0.0.0", - "@aws-cdk/aws-billingconductor": "0.0.0", - "@aws-cdk/aws-budgets": "0.0.0", - "@aws-cdk/aws-cassandra": "0.0.0", - "@aws-cdk/aws-ce": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-chatbot": "0.0.0", - "@aws-cdk/aws-cloud9": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-cloudtrail": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codeartifact": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codedeploy": "0.0.0", - "@aws-cdk/aws-codeguruprofiler": "0.0.0", - "@aws-cdk/aws-codegurureviewer": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-codestar": "0.0.0", - "@aws-cdk/aws-codestarconnections": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-comprehend": "0.0.0", - "@aws-cdk/aws-config": "0.0.0", - "@aws-cdk/aws-connect": "0.0.0", - "@aws-cdk/aws-connectcampaigns": "0.0.0", - "@aws-cdk/aws-controltower": "0.0.0", - "@aws-cdk/aws-cur": "0.0.0", - "@aws-cdk/aws-customerprofiles": "0.0.0", - "@aws-cdk/aws-databrew": "0.0.0", - "@aws-cdk/aws-datapipeline": "0.0.0", - "@aws-cdk/aws-datasync": "0.0.0", - "@aws-cdk/aws-dax": "0.0.0", - "@aws-cdk/aws-detective": "0.0.0", - "@aws-cdk/aws-devicefarm": "0.0.0", - "@aws-cdk/aws-devopsguru": "0.0.0", - "@aws-cdk/aws-directoryservice": "0.0.0", - "@aws-cdk/aws-dlm": "0.0.0", - "@aws-cdk/aws-dms": "0.0.0", - "@aws-cdk/aws-docdb": "0.0.0", - "@aws-cdk/aws-docdbelastic": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-eks": "0.0.0", - "@aws-cdk/aws-elasticache": "0.0.0", - "@aws-cdk/aws-elasticbeanstalk": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-elasticsearch": "0.0.0", - "@aws-cdk/aws-emr": "0.0.0", - "@aws-cdk/aws-emrcontainers": "0.0.0", - "@aws-cdk/aws-emrserverless": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-eventschemas": "0.0.0", - "@aws-cdk/aws-evidently": "0.0.0", - "@aws-cdk/aws-finspace": "0.0.0", - "@aws-cdk/aws-fis": "0.0.0", - "@aws-cdk/aws-fms": "0.0.0", - "@aws-cdk/aws-forecast": "0.0.0", - "@aws-cdk/aws-frauddetector": "0.0.0", - "@aws-cdk/aws-fsx": "0.0.0", - "@aws-cdk/aws-gamelift": "0.0.0", - "@aws-cdk/aws-globalaccelerator": "0.0.0", - "@aws-cdk/aws-glue": "0.0.0", - "@aws-cdk/aws-grafana": "0.0.0", - "@aws-cdk/aws-greengrass": "0.0.0", - "@aws-cdk/aws-greengrassv2": "0.0.0", - "@aws-cdk/aws-groundstation": "0.0.0", - "@aws-cdk/aws-guardduty": "0.0.0", - "@aws-cdk/aws-healthlake": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-identitystore": "0.0.0", - "@aws-cdk/aws-imagebuilder": "0.0.0", - "@aws-cdk/aws-inspector": "0.0.0", - "@aws-cdk/aws-inspectorv2": "0.0.0", - "@aws-cdk/aws-internetmonitor": "0.0.0", - "@aws-cdk/aws-iot": "0.0.0", - "@aws-cdk/aws-iot1click": "0.0.0", - "@aws-cdk/aws-iotanalytics": "0.0.0", - "@aws-cdk/aws-iotcoredeviceadvisor": "0.0.0", - "@aws-cdk/aws-iotevents": "0.0.0", - "@aws-cdk/aws-iotfleethub": "0.0.0", - "@aws-cdk/aws-iotfleetwise": "0.0.0", - "@aws-cdk/aws-iotsitewise": "0.0.0", - "@aws-cdk/aws-iotthingsgraph": "0.0.0", - "@aws-cdk/aws-iottwinmaker": "0.0.0", - "@aws-cdk/aws-iotwireless": "0.0.0", - "@aws-cdk/aws-ivs": "0.0.0", - "@aws-cdk/aws-ivschat": "0.0.0", - "@aws-cdk/aws-kafkaconnect": "0.0.0", - "@aws-cdk/aws-kendra": "0.0.0", - "@aws-cdk/aws-kendraranking": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-kinesisanalytics": "0.0.0", - "@aws-cdk/aws-kinesisanalyticsv2": "0.0.0", - "@aws-cdk/aws-kinesisfirehose": "0.0.0", - "@aws-cdk/aws-kinesisvideo": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lakeformation": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lex": "0.0.0", - "@aws-cdk/aws-licensemanager": "0.0.0", - "@aws-cdk/aws-lightsail": "0.0.0", - "@aws-cdk/aws-location": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-lookoutequipment": "0.0.0", - "@aws-cdk/aws-lookoutmetrics": "0.0.0", - "@aws-cdk/aws-lookoutvision": "0.0.0", - "@aws-cdk/aws-m2": "0.0.0", - "@aws-cdk/aws-macie": "0.0.0", - "@aws-cdk/aws-managedblockchain": "0.0.0", - "@aws-cdk/aws-mediaconnect": "0.0.0", - "@aws-cdk/aws-mediaconvert": "0.0.0", - "@aws-cdk/aws-medialive": "0.0.0", - "@aws-cdk/aws-mediapackage": "0.0.0", - "@aws-cdk/aws-mediastore": "0.0.0", - "@aws-cdk/aws-mediatailor": "0.0.0", - "@aws-cdk/aws-memorydb": "0.0.0", - "@aws-cdk/aws-msk": "0.0.0", - "@aws-cdk/aws-mwaa": "0.0.0", - "@aws-cdk/aws-neptune": "0.0.0", - "@aws-cdk/aws-networkfirewall": "0.0.0", - "@aws-cdk/aws-networkmanager": "0.0.0", - "@aws-cdk/aws-nimblestudio": "0.0.0", - "@aws-cdk/aws-oam": "0.0.0", - "@aws-cdk/aws-omics": "0.0.0", - "@aws-cdk/aws-opensearchserverless": "0.0.0", - "@aws-cdk/aws-opensearchservice": "0.0.0", - "@aws-cdk/aws-opsworks": "0.0.0", - "@aws-cdk/aws-opsworkscm": "0.0.0", - "@aws-cdk/aws-organizations": "0.0.0", - "@aws-cdk/aws-panorama": "0.0.0", - "@aws-cdk/aws-personalize": "0.0.0", - "@aws-cdk/aws-pinpoint": "0.0.0", - "@aws-cdk/aws-pinpointemail": "0.0.0", - "@aws-cdk/aws-pipes": "0.0.0", - "@aws-cdk/aws-qldb": "0.0.0", - "@aws-cdk/aws-quicksight": "0.0.0", - "@aws-cdk/aws-ram": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/aws-redshift": "0.0.0", - "@aws-cdk/aws-redshiftserverless": "0.0.0", - "@aws-cdk/aws-refactorspaces": "0.0.0", - "@aws-cdk/aws-rekognition": "0.0.0", - "@aws-cdk/aws-resiliencehub": "0.0.0", - "@aws-cdk/aws-resourceexplorer2": "0.0.0", - "@aws-cdk/aws-resourcegroups": "0.0.0", - "@aws-cdk/aws-robomaker": "0.0.0", - "@aws-cdk/aws-rolesanywhere": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53recoverycontrol": "0.0.0", - "@aws-cdk/aws-route53recoveryreadiness": "0.0.0", - "@aws-cdk/aws-route53resolver": "0.0.0", - "@aws-cdk/aws-rum": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3objectlambda": "0.0.0", - "@aws-cdk/aws-s3outposts": "0.0.0", - "@aws-cdk/aws-sagemaker": "0.0.0", - "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/aws-scheduler": "0.0.0", - "@aws-cdk/aws-sdb": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-securityhub": "0.0.0", - "@aws-cdk/aws-servicecatalog": "0.0.0", - "@aws-cdk/aws-servicecatalogappregistry": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-ses": "0.0.0", - "@aws-cdk/aws-signer": "0.0.0", - "@aws-cdk/aws-simspaceweaver": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/aws-ssmcontacts": "0.0.0", - "@aws-cdk/aws-ssmincidents": "0.0.0", - "@aws-cdk/aws-sso": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/aws-supportapp": "0.0.0", - "@aws-cdk/aws-synthetics": "0.0.0", - "@aws-cdk/aws-systemsmanagersap": "0.0.0", - "@aws-cdk/aws-timestream": "0.0.0", - "@aws-cdk/aws-transfer": "0.0.0", - "@aws-cdk/aws-voiceid": "0.0.0", - "@aws-cdk/aws-vpclattice": "0.0.0", - "@aws-cdk/aws-waf": "0.0.0", - "@aws-cdk/aws-wafregional": "0.0.0", - "@aws-cdk/aws-wafv2": "0.0.0", - "@aws-cdk/aws-wisdom": "0.0.0", - "@aws-cdk/aws-workspaces": "0.0.0", - "@aws-cdk/aws-xray": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0", - "yaml": "1.10.2" - }, - "peerDependencies": { - "@aws-cdk/alexa-ask": "0.0.0", - "@aws-cdk/aws-accessanalyzer": "0.0.0", - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-amazonmq": "0.0.0", - "@aws-cdk/aws-amplify": "0.0.0", - "@aws-cdk/aws-amplifyuibuilder": "0.0.0", - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-appconfig": "0.0.0", - "@aws-cdk/aws-appflow": "0.0.0", - "@aws-cdk/aws-appintegrations": "0.0.0", - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-applicationinsights": "0.0.0", - "@aws-cdk/aws-appmesh": "0.0.0", - "@aws-cdk/aws-apprunner": "0.0.0", - "@aws-cdk/aws-appstream": "0.0.0", - "@aws-cdk/aws-appsync": "0.0.0", - "@aws-cdk/aws-aps": "0.0.0", - "@aws-cdk/aws-athena": "0.0.0", - "@aws-cdk/aws-auditmanager": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-autoscalingplans": "0.0.0", - "@aws-cdk/aws-backup": "0.0.0", - "@aws-cdk/aws-batch": "0.0.0", - "@aws-cdk/aws-billingconductor": "0.0.0", - "@aws-cdk/aws-budgets": "0.0.0", - "@aws-cdk/aws-cassandra": "0.0.0", - "@aws-cdk/aws-ce": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-chatbot": "0.0.0", - "@aws-cdk/aws-cloud9": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-cloudtrail": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-codeartifact": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codedeploy": "0.0.0", - "@aws-cdk/aws-codeguruprofiler": "0.0.0", - "@aws-cdk/aws-codegurureviewer": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-codestar": "0.0.0", - "@aws-cdk/aws-codestarconnections": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-comprehend": "0.0.0", - "@aws-cdk/aws-config": "0.0.0", - "@aws-cdk/aws-connect": "0.0.0", - "@aws-cdk/aws-connectcampaigns": "0.0.0", - "@aws-cdk/aws-controltower": "0.0.0", - "@aws-cdk/aws-cur": "0.0.0", - "@aws-cdk/aws-customerprofiles": "0.0.0", - "@aws-cdk/aws-databrew": "0.0.0", - "@aws-cdk/aws-datapipeline": "0.0.0", - "@aws-cdk/aws-datasync": "0.0.0", - "@aws-cdk/aws-dax": "0.0.0", - "@aws-cdk/aws-detective": "0.0.0", - "@aws-cdk/aws-devicefarm": "0.0.0", - "@aws-cdk/aws-devopsguru": "0.0.0", - "@aws-cdk/aws-directoryservice": "0.0.0", - "@aws-cdk/aws-dlm": "0.0.0", - "@aws-cdk/aws-dms": "0.0.0", - "@aws-cdk/aws-docdb": "0.0.0", - "@aws-cdk/aws-docdbelastic": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-eks": "0.0.0", - "@aws-cdk/aws-elasticache": "0.0.0", - "@aws-cdk/aws-elasticbeanstalk": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-elasticsearch": "0.0.0", - "@aws-cdk/aws-emr": "0.0.0", - "@aws-cdk/aws-emrcontainers": "0.0.0", - "@aws-cdk/aws-emrserverless": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-eventschemas": "0.0.0", - "@aws-cdk/aws-evidently": "0.0.0", - "@aws-cdk/aws-finspace": "0.0.0", - "@aws-cdk/aws-fis": "0.0.0", - "@aws-cdk/aws-fms": "0.0.0", - "@aws-cdk/aws-forecast": "0.0.0", - "@aws-cdk/aws-frauddetector": "0.0.0", - "@aws-cdk/aws-fsx": "0.0.0", - "@aws-cdk/aws-gamelift": "0.0.0", - "@aws-cdk/aws-globalaccelerator": "0.0.0", - "@aws-cdk/aws-glue": "0.0.0", - "@aws-cdk/aws-grafana": "0.0.0", - "@aws-cdk/aws-greengrass": "0.0.0", - "@aws-cdk/aws-greengrassv2": "0.0.0", - "@aws-cdk/aws-groundstation": "0.0.0", - "@aws-cdk/aws-guardduty": "0.0.0", - "@aws-cdk/aws-healthlake": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-identitystore": "0.0.0", - "@aws-cdk/aws-imagebuilder": "0.0.0", - "@aws-cdk/aws-inspector": "0.0.0", - "@aws-cdk/aws-inspectorv2": "0.0.0", - "@aws-cdk/aws-internetmonitor": "0.0.0", - "@aws-cdk/aws-iot": "0.0.0", - "@aws-cdk/aws-iot1click": "0.0.0", - "@aws-cdk/aws-iotanalytics": "0.0.0", - "@aws-cdk/aws-iotcoredeviceadvisor": "0.0.0", - "@aws-cdk/aws-iotevents": "0.0.0", - "@aws-cdk/aws-iotfleethub": "0.0.0", - "@aws-cdk/aws-iotfleetwise": "0.0.0", - "@aws-cdk/aws-iotsitewise": "0.0.0", - "@aws-cdk/aws-iotthingsgraph": "0.0.0", - "@aws-cdk/aws-iottwinmaker": "0.0.0", - "@aws-cdk/aws-iotwireless": "0.0.0", - "@aws-cdk/aws-ivs": "0.0.0", - "@aws-cdk/aws-ivschat": "0.0.0", - "@aws-cdk/aws-kafkaconnect": "0.0.0", - "@aws-cdk/aws-kendra": "0.0.0", - "@aws-cdk/aws-kendraranking": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-kinesisanalytics": "0.0.0", - "@aws-cdk/aws-kinesisanalyticsv2": "0.0.0", - "@aws-cdk/aws-kinesisfirehose": "0.0.0", - "@aws-cdk/aws-kinesisvideo": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lakeformation": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lex": "0.0.0", - "@aws-cdk/aws-licensemanager": "0.0.0", - "@aws-cdk/aws-lightsail": "0.0.0", - "@aws-cdk/aws-location": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-lookoutequipment": "0.0.0", - "@aws-cdk/aws-lookoutmetrics": "0.0.0", - "@aws-cdk/aws-lookoutvision": "0.0.0", - "@aws-cdk/aws-m2": "0.0.0", - "@aws-cdk/aws-macie": "0.0.0", - "@aws-cdk/aws-managedblockchain": "0.0.0", - "@aws-cdk/aws-mediaconnect": "0.0.0", - "@aws-cdk/aws-mediaconvert": "0.0.0", - "@aws-cdk/aws-medialive": "0.0.0", - "@aws-cdk/aws-mediapackage": "0.0.0", - "@aws-cdk/aws-mediastore": "0.0.0", - "@aws-cdk/aws-mediatailor": "0.0.0", - "@aws-cdk/aws-memorydb": "0.0.0", - "@aws-cdk/aws-msk": "0.0.0", - "@aws-cdk/aws-mwaa": "0.0.0", - "@aws-cdk/aws-neptune": "0.0.0", - "@aws-cdk/aws-networkfirewall": "0.0.0", - "@aws-cdk/aws-networkmanager": "0.0.0", - "@aws-cdk/aws-nimblestudio": "0.0.0", - "@aws-cdk/aws-oam": "0.0.0", - "@aws-cdk/aws-omics": "0.0.0", - "@aws-cdk/aws-opensearchserverless": "0.0.0", - "@aws-cdk/aws-opensearchservice": "0.0.0", - "@aws-cdk/aws-opsworks": "0.0.0", - "@aws-cdk/aws-opsworkscm": "0.0.0", - "@aws-cdk/aws-organizations": "0.0.0", - "@aws-cdk/aws-panorama": "0.0.0", - "@aws-cdk/aws-personalize": "0.0.0", - "@aws-cdk/aws-pinpoint": "0.0.0", - "@aws-cdk/aws-pinpointemail": "0.0.0", - "@aws-cdk/aws-pipes": "0.0.0", - "@aws-cdk/aws-qldb": "0.0.0", - "@aws-cdk/aws-quicksight": "0.0.0", - "@aws-cdk/aws-ram": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/aws-redshift": "0.0.0", - "@aws-cdk/aws-redshiftserverless": "0.0.0", - "@aws-cdk/aws-refactorspaces": "0.0.0", - "@aws-cdk/aws-rekognition": "0.0.0", - "@aws-cdk/aws-resiliencehub": "0.0.0", - "@aws-cdk/aws-resourceexplorer2": "0.0.0", - "@aws-cdk/aws-resourcegroups": "0.0.0", - "@aws-cdk/aws-robomaker": "0.0.0", - "@aws-cdk/aws-rolesanywhere": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53recoverycontrol": "0.0.0", - "@aws-cdk/aws-route53recoveryreadiness": "0.0.0", - "@aws-cdk/aws-route53resolver": "0.0.0", - "@aws-cdk/aws-rum": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3objectlambda": "0.0.0", - "@aws-cdk/aws-s3outposts": "0.0.0", - "@aws-cdk/aws-sagemaker": "0.0.0", - "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/aws-scheduler": "0.0.0", - "@aws-cdk/aws-sdb": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-securityhub": "0.0.0", - "@aws-cdk/aws-servicecatalog": "0.0.0", - "@aws-cdk/aws-servicecatalogappregistry": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-ses": "0.0.0", - "@aws-cdk/aws-signer": "0.0.0", - "@aws-cdk/aws-simspaceweaver": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/aws-ssmcontacts": "0.0.0", - "@aws-cdk/aws-ssmincidents": "0.0.0", - "@aws-cdk/aws-sso": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/aws-supportapp": "0.0.0", - "@aws-cdk/aws-synthetics": "0.0.0", - "@aws-cdk/aws-systemsmanagersap": "0.0.0", - "@aws-cdk/aws-timestream": "0.0.0", - "@aws-cdk/aws-transfer": "0.0.0", - "@aws-cdk/aws-voiceid": "0.0.0", - "@aws-cdk/aws-vpclattice": "0.0.0", - "@aws-cdk/aws-waf": "0.0.0", - "@aws-cdk/aws-wafregional": "0.0.0", - "@aws-cdk/aws-wafv2": "0.0.0", - "@aws-cdk/aws-wisdom": "0.0.0", - "@aws-cdk/aws-workspaces": "0.0.0", - "@aws-cdk/aws-xray": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1", - "ts-jest": "^27.1.5" - }, - "bundledDependencies": [ - "yaml" - ], - "keywords": [ - "aws", - "cdk", - "cloudformation", - "template", - "include", - "including", - "migration", - "migrating", - "migrate" - ], - "homepage": "https://github.com/aws/aws-cdk", - "engines": { - "node": ">= 14.15.0" - }, - "awslint": { - "exclude": [ - "props-no-cfn-types:@aws-cdk/cloudformation-include.CfnIncludeProps.loadNestedStacks" - ] - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "nozem": false, - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/cloudformation-include/rosetta/default.ts-fixture b/packages/@aws-cdk/cloudformation-include/rosetta/default.ts-fixture deleted file mode 100644 index 307736228527e..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/rosetta/default.ts-fixture +++ /dev/null @@ -1,18 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as core from '@aws-cdk/core'; -import * as path from 'path'; -import * as cfn_inc from '@aws-cdk/cloudformation-include'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as ec2 from '@aws-cdk/aws-ec2'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/cdk.out b/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/cdk.out deleted file mode 100644 index 588d7b269d34f..0000000000000 --- a/packages/@aws-cdk/cloudformation-include/test/integ.nested-stacks.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"20.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/core/.eslintrc.js b/packages/@aws-cdk/core/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/core/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/core/.gitignore b/packages/@aws-cdk/core/.gitignore deleted file mode 100644 index 1272e8254630e..0000000000000 --- a/packages/@aws-cdk/core/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.js -*.d.ts -tsconfig.json -*.generated.ts -*.js.map -dist -coverage -.nyc_output -.jsii - -.LAST_BUILD -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -junit.xml -!jest.config.js -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/core/.npmignore b/packages/@aws-cdk/core/.npmignore deleted file mode 100644 index 3e0dbdd3fa4ee..0000000000000 --- a/packages/@aws-cdk/core/.npmignore +++ /dev/null @@ -1,32 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -# Work around npm@6.8.0 ignoring 'core' by default -- https://github.com/npm/npm-packlist/issues/24 -!core - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -jest.config.js -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/core/.vscode/tasks.json b/packages/@aws-cdk/core/.vscode/tasks.json deleted file mode 100644 index 3726d98503637..0000000000000 --- a/packages/@aws-cdk/core/.vscode/tasks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "watch", - "problemMatcher": [ - "$tsc-watch" - ], - "group": "build", - "label": "npm: watch", - "detail": "cdk-watch", - "isBackground": true - } - ] -} \ No newline at end of file diff --git a/packages/@aws-cdk/core/LICENSE b/packages/@aws-cdk/core/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/core/NOTICE b/packages/@aws-cdk/core/NOTICE deleted file mode 100644 index 2646a7a22fc0a..0000000000000 --- a/packages/@aws-cdk/core/NOTICE +++ /dev/null @@ -1,230 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** minimatch - https://www.npmjs.com/package/minimatch -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------- - -** fs-extra - https://www.npmjs.com/package/fs-extra -Copyright (c) 2011-2017 JP Richardson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- - -** ignore - https://www.npmjs.com/package/ignore -Copyright (c) 2013 Kael Zhang , contributors -http://kael.me/ - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- - -** @balena/dockerignore - https://www.npmjs.com/package/@balena/dockerignore -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - ----------------- - -** at-least-node - https://www.npmjs.com/package/at-least-node -Copyright (c) 2020 Ryan Zimmerman - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------- - -** graceful-fs - https://www.npmjs.com/package/graceful-fs -Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors - - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ----------------- - -** jsonfile - https://www.npmjs.com/package/jsonfile -Copyright (c) 2012-2015, JP Richardson - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files -(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- - -** universalify - https://www.npmjs.com/package/universalify -Copyright (c) 2017, Ryan Zimmerman - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the 'Software'), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ----------------- - -** brace-expansion - https://www.npmjs.com/package/brace-expansion -Copyright (c) 2013 Julian Gruber - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ----------------- - -** balanced-match - https://www.npmjs.com/package/balanced-match -Copyright (c) 2013 Julian Gruber - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ----------------- - -** concat-map - https://www.npmjs.com/package/concat-map - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ----------------- diff --git a/packages/@aws-cdk/core/README.md b/packages/@aws-cdk/core/README.md deleted file mode 100644 index 860961b8300b9..0000000000000 --- a/packages/@aws-cdk/core/README.md +++ /dev/null @@ -1,1419 +0,0 @@ -# AWS Cloud Development Kit Library - -The AWS CDK construct library provides APIs to define your CDK application and add -CDK constructs to the application. - -## Usage - -### Upgrade from CDK 1.x - -When upgrading from CDK 1.x, remove all dependencies to individual CDK packages -from your dependencies file and follow the rest of the sections. - -### Installation - -To use this package, you need to declare this package and the `constructs` package as -dependencies. - -According to the kind of project you are developing: - -- For projects that are CDK libraries, declare them both under the `devDependencies` - **and** `peerDependencies` sections. -- For CDK apps, declare them under the `dependencies` section only. - -### Use in your code - -#### Classic import - -You can use a classic import to get access to each service namespaces: - -```ts -import { Stack, App, aws_s3 as s3 } from 'aws-cdk-lib'; - -const app = new App(); -const stack = new Stack(app, 'TestStack'); - -new s3.Bucket(stack, 'TestBucket'); -``` - -#### Barrel import - -Alternatively, you can use "barrel" imports: - -```ts -import { App, Stack } from 'aws-cdk-lib'; -import { Bucket } from 'aws-cdk-lib/aws-s3'; - -const app = new App(); -const stack = new Stack(app, 'TestStack'); - -new Bucket(stack, 'TestBucket'); -``` - - - -## Stacks and Stages - -A `Stack` is the smallest physical unit of deployment, and maps directly onto -a CloudFormation Stack. You define a Stack by defining a subclass of `Stack` --- let's call it `MyStack` -- and instantiating the constructs that make up -your application in `MyStack`'s constructor. You then instantiate this stack -one or more times to define different instances of your application. For example, -you can instantiate it once using few and cheap EC2 instances for testing, -and once again using more and bigger EC2 instances for production. - -When your application grows, you may decide that it makes more sense to split it -out across multiple `Stack` classes. This can happen for a number of reasons: - -- You could be starting to reach the maximum number of resources allowed in a single - stack (this is currently 500). -- You could decide you want to separate out stateful resources and stateless resources - into separate stacks, so that it becomes easy to tear down and recreate the stacks - that don't have stateful resources. -- There could be a single stack with resources (like a VPC) that are shared - between multiple instances of other stacks containing your applications. - -As soon as your conceptual application starts to encompass multiple stacks, -it is convenient to wrap them in another construct that represents your -logical application. You can then treat that new unit the same way you used -to be able to treat a single stack: by instantiating it multiple times -for different instances of your application. - -You can define a custom subclass of `Stage`, holding one or more -`Stack`s, to represent a single logical instance of your application. - -As a final note: `Stack`s are not a unit of reuse. They describe physical -deployment layouts, and as such are best left to application builders to -organize their deployments with. If you want to vend a reusable construct, -define it as a subclasses of `Construct`: the consumers of your construct -will decide where to place it in their own stacks. - -## Stack Synthesizers - -Each Stack has a *synthesizer*, an object that determines how and where -the Stack should be synthesized and deployed. The synthesizer controls -aspects like: - -- How does the stack reference assets? (Either through CloudFormation - parameters the CLI supplies, or because the Stack knows a predefined - location where assets will be uploaded). -- What roles are used to deploy the stack? These can be bootstrapped - roles, roles created in some other way, or just the CLI's current - credentials. - -The following synthesizers are available: - -- `DefaultStackSynthesizer`: recommended. Uses predefined asset locations and - roles created by the modern bootstrap template. Access control is done by - controlling who can assume the deploy role. This is the default stack - synthesizer in CDKv2. -- `LegacyStackSynthesizer`: Uses CloudFormation parameters to communicate - asset locations, and the CLI's current permissions to deploy stacks. The - is the default stack synthesizer in CDKv1. -- `CliCredentialsStackSynthesizer`: Uses predefined asset locations, and the - CLI's current permissions. - -Each of these synthesizers takes configuration arguments. To configure -a stack with a synthesizer, pass it as one of its properties: - -```ts -new MyStack(app, 'MyStack', { - synthesizer: new DefaultStackSynthesizer({ - fileAssetsBucketName: 'my-orgs-asset-bucket', - }), -}); -``` - -For more information on bootstrapping accounts and customizing synthesis, -see [Bootstrapping in the CDK Developer Guide](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html). - -## Nested Stacks - -[Nested stacks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) are stacks created as part of other stacks. You create a nested stack within another stack by using the `NestedStack` construct. - -As your infrastructure grows, common patterns can emerge in which you declare the same components in multiple templates. You can separate out these common components and create dedicated templates for them. Then use the resource in your template to reference other templates, creating nested stacks. - -For example, assume that you have a load balancer configuration that you use for most of your stacks. Instead of copying and pasting the same configurations into your templates, you can create a dedicated template for the load balancer. Then, you just use the resource to reference that template from within other templates. - -The following example will define a single top-level stack that contains two nested stacks: each one with a single Amazon S3 bucket: - -```ts -class MyNestedStack extends cfn.NestedStack { - constructor(scope: Construct, id: string, props?: cfn.NestedStackProps) { - super(scope, id, props); - - new s3.Bucket(this, 'NestedBucket'); - } -} - -class MyParentStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - new MyNestedStack(this, 'Nested1'); - new MyNestedStack(this, 'Nested2'); - } -} -``` - -Resources references across nested/parent boundaries (even with multiple levels of nesting) will be wired by the AWS CDK -through CloudFormation parameters and outputs. When a resource from a parent stack is referenced by a nested stack, -a CloudFormation parameter will automatically be added to the nested stack and assigned from the parent; when a resource -from a nested stack is referenced by a parent stack, a CloudFormation output will be automatically be added to the -nested stack and referenced using `Fn::GetAtt "Outputs.Xxx"` from the parent. - -Nested stacks also support the use of Docker image and file assets. - -## Accessing resources in a different stack - -You can access resources in a different stack, as long as they are in the -same account and AWS Region (see [next section](#accessing-resources-in-a-different-stack-and-region) for an exception). -The following example defines the stack `stack1`, -which defines an Amazon S3 bucket. Then it defines a second stack, `stack2`, -which takes the bucket from stack1 as a constructor property. - -```ts -const prod = { account: '123456789012', region: 'us-east-1' }; - -const stack1 = new StackThatProvidesABucket(app, 'Stack1' , { env: prod }); - -// stack2 will take a property { bucket: IBucket } -const stack2 = new StackThatExpectsABucket(app, 'Stack2', { - bucket: stack1.bucket, - env: prod -}); -``` - -If the AWS CDK determines that the resource is in the same account and -Region, but in a different stack, it automatically synthesizes AWS -CloudFormation -[Exports](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.html) -in the producing stack and an -[Fn::ImportValue](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html) -in the consuming stack to transfer that information from one stack to the -other. - -## Accessing resources in a different stack and region - -> **This feature is currently experimental** - -You can enable the Stack property `crossRegionReferences` -in order to access resources in a different stack _and_ region. With this feature flag -enabled it is possible to do something like creating a CloudFront distribution in `us-east-2` and -an ACM certificate in `us-east-1`. - -```ts -const stack1 = new Stack(app, 'Stack1', { - env: { - region: 'us-east-1', - }, - crossRegionReferences: true, -}); -const cert = new acm.Certificate(stack1, 'Cert', { - domainName: '*.example.com', - validation: acm.CertificateValidation.fromDns(route53.PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'Z0329774B51CGXTDQV3X')), -}); - -const stack2 = new Stack(app, 'Stack2', { - env: { - region: 'us-east-2', - }, - crossRegionReferences: true, -}); -new cloudfront.Distribution(stack2, 'Distribution', { - defaultBehavior: { - origin: new origins.HttpOrigin('example.com'), - }, - domainNames: ['dev.example.com'], - certificate: cert, -}); -``` - -When the AWS CDK determines that the resource is in a different stack _and_ is in a different -region, it will "export" the value by creating a custom resource in the producing stack which -creates SSM Parameters in the consuming region for each exported value. The parameters will be -created with the name '/cdk/exports/${consumingStackName}/${export-name}'. -In order to "import" the exports into the consuming stack a [SSM Dynamic reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-ssm) -is used to reference the SSM parameter which was created. - -In order to mimic strong references, a Custom Resource is also created in the consuming -stack which marks the SSM parameters as being "imported". When a parameter has been successfully -imported, the producing stack cannot update the value. - -See the [adr](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/core/adr/cross-region-stack-references) -for more details on this feature. - -### Removing automatic cross-stack references - -The automatic references created by CDK when you use resources across stacks -are convenient, but may block your deployments if you want to remove the -resources that are referenced in this way. You will see an error like: - -```text -Export Stack1:ExportsOutputFnGetAtt-****** cannot be deleted as it is in use by Stack1 -``` - -Let's say there is a Bucket in the `stack1`, and the `stack2` references its -`bucket.bucketName`. You now want to remove the bucket and run into the error above. - -It's not safe to remove `stack1.bucket` while `stack2` is still using it, so -unblocking yourself from this is a two-step process. This is how it works: - -DEPLOYMENT 1: break the relationship - -- Make sure `stack2` no longer references `bucket.bucketName` (maybe the consumer - stack now uses its own bucket, or it writes to an AWS DynamoDB table, or maybe you just - remove the Lambda Function altogether). -- In the `stack1` class, call `this.exportValue(this.bucket.bucketName)`. This - will make sure the CloudFormation Export continues to exist while the relationship - between the two stacks is being broken. -- Deploy (this will effectively only change the `stack2`, but it's safe to deploy both). - -DEPLOYMENT 2: remove the resource - -- You are now free to remove the `bucket` resource from `stack1`. -- Don't forget to remove the `exportValue()` call as well. -- Deploy again (this time only the `stack1` will be changed -- the bucket will be deleted). - -## Durations - -To make specifications of time intervals unambiguous, a single class called -`Duration` is used throughout the AWS Construct Library by all constructs -that that take a time interval as a parameter (be it for a timeout, a -rate, or something else). - -An instance of Duration is constructed by using one of the static factory -methods on it: - -```ts -Duration.seconds(300) // 5 minutes -Duration.minutes(5) // 5 minutes -Duration.hours(1) // 1 hour -Duration.days(7) // 7 days -Duration.parse('PT5M') // 5 minutes -``` - -Durations can be added or subtracted together: - -```ts -Duration.minutes(1).plus(Duration.seconds(60)); // 2 minutes -Duration.minutes(5).minus(Duration.seconds(10)); // 290 secondes -``` - -## Size (Digital Information Quantity) - -To make specification of digital storage quantities unambiguous, a class called -`Size` is available. - -An instance of `Size` is initialized through one of its static factory methods: - -```ts -Size.kibibytes(200) // 200 KiB -Size.mebibytes(5) // 5 MiB -Size.gibibytes(40) // 40 GiB -Size.tebibytes(200) // 200 TiB -Size.pebibytes(3) // 3 PiB -``` - -Instances of `Size` created with one of the units can be converted into others. -By default, conversion to a higher unit will fail if the conversion does not produce -a whole number. This can be overridden by unsetting `integral` property. - -```ts -Size.mebibytes(2).toKibibytes() // yields 2048 -Size.kibibytes(2050).toMebibytes({ rounding: SizeRoundingBehavior.FLOOR }) // yields 2 -``` - -## Secrets - -To help avoid accidental storage of secrets as plain text, we use the `SecretValue` type to -represent secrets. Any construct that takes a value that should be a secret (such as -a password or an access key) will take a parameter of type `SecretValue`. - -The best practice is to store secrets in AWS Secrets Manager and reference them using `SecretValue.secretsManager`: - -```ts -const secret = SecretValue.secretsManager('secretId', { - jsonField: 'password', // optional: key of a JSON field to retrieve (defaults to all content), - versionId: 'id', // optional: id of the version (default AWSCURRENT) - versionStage: 'stage', // optional: version stage name (default AWSCURRENT) -}); -``` - -Using AWS Secrets Manager is the recommended way to reference secrets in a CDK app. -`SecretValue` also supports the following secret sources: - -- `SecretValue.unsafePlainText(secret)`: stores the secret as plain text in your app and the resulting template (not recommended). -- `SecretValue.secretsManager(secret)`: refers to a secret stored in Secrets Manager -- `SecretValue.ssmSecure(param, version)`: refers to a secret stored as a SecureString in the SSM - Parameter Store. If you don't specify the exact version, AWS CloudFormation uses the latest - version of the parameter. -- `SecretValue.cfnParameter(param)`: refers to a secret passed through a CloudFormation parameter (must have `NoEcho: true`). -- `SecretValue.cfnDynamicReference(dynref)`: refers to a secret described by a CloudFormation dynamic reference (used by `ssmSecure` and `secretsManager`). -- `SecretValue.resourceAttribute(attr)`: refers to a secret returned from a CloudFormation resource creation. - -`SecretValue`s should only be passed to constructs that accept properties of type -`SecretValue`. These constructs are written to ensure your secrets will not be -exposed where they shouldn't be. If you try to use a `SecretValue` in a -different location, an error about unsafe secret usage will be thrown at -synthesis time. - -If you rotate the secret's value in Secrets Manager, you must also change at -least one property on the resource where you are using the secret, to force -CloudFormation to re-read the secret. - -`SecretValue.ssmSecure()` is only supported for a limited set of resources. -[Click here for a list of supported resources and properties](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#template-parameters-dynamic-patterns-resources). - -## ARN manipulation - -Sometimes you will need to put together or pick apart Amazon Resource Names -(ARNs). The functions `stack.formatArn()` and `stack.parseArn()` exist for -this purpose. - -`formatArn()` can be used to build an ARN from components. It will automatically -use the region and account of the stack you're calling it on: - -```ts -declare const stack: Stack; - -// Builds "arn::lambda:::function:MyFunction" -stack.formatArn({ - service: 'lambda', - resource: 'function', - sep: ':', - resourceName: 'MyFunction' -}); -``` - -`parseArn()` can be used to get a single component from an ARN. `parseArn()` -will correctly deal with both literal ARNs and deploy-time values (tokens), -but in case of a deploy-time value be aware that the result will be another -deploy-time value which cannot be inspected in the CDK application. - -```ts -declare const stack: Stack; - -// Extracts the function name out of an AWS Lambda Function ARN -const arnComponents = stack.parseArn(arn, ':'); -const functionName = arnComponents.resourceName; -``` - -Note that depending on the service, the resource separator can be either -`:` or `/`, and the resource name can be either the 6th or 7th -component in the ARN. When using these functions, you will need to know -the format of the ARN you are dealing with. - -For an exhaustive list of ARN formats used in AWS, see [AWS ARNs and -Namespaces](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) -in the AWS General Reference. - -## Dependencies - -### Construct Dependencies - -Sometimes AWS resources depend on other resources, and the creation of one -resource must be completed before the next one can be started. - -In general, CloudFormation will correctly infer the dependency relationship -between resources based on the property values that are used. In the cases where -it doesn't, the AWS Construct Library will add the dependency relationship for -you. - -If you need to add an ordering dependency that is not automatically inferred, -you do so by adding a dependency relationship using -`constructA.node.addDependency(constructB)`. This will add a dependency -relationship between all resources in the scope of `constructA` and all -resources in the scope of `constructB`. - -If you want a single object to represent a set of constructs that are not -necessarily in the same scope, you can use a `DependencyGroup`. The -following creates a single object that represents a dependency on two -constructs, `constructB` and `constructC`: - -```ts -// Declare the dependable object -const bAndC = new DependencyGroup(); -bAndC.add(constructB); -bAndC.add(constructC); - -// Take the dependency -constructA.node.addDependency(bAndC); -``` - -### Stack Dependencies - -Two different stack instances can have a dependency on one another. This -happens when an resource from one stack is referenced in another stack. In -that case, CDK records the cross-stack referencing of resources, -automatically produces the right CloudFormation primitives, and adds a -dependency between the two stacks. You can also manually add a dependency -between two stacks by using the `stackA.addDependency(stackB)` method. - -A stack dependency has the following implications: - -- Cyclic dependencies are not allowed, so if `stackA` is using resources from - `stackB`, the reverse is not possible anymore. -- Stacks with dependencies between them are treated specially by the CDK - toolkit: - - If `stackA` depends on `stackB`, running `cdk deploy stackA` will also - automatically deploy `stackB`. - - `stackB`'s deployment will be performed *before* `stackA`'s deployment. - -### CfnResource Dependencies - -To make declaring dependencies between `CfnResource` objects easier, you can declare dependencies from one `CfnResource` object on another by using the `cfnResource1.addDependency(cfnResource2)` method. This method will work for resources both within the same stack and across stacks as it detects the relative location of the two resources and adds the dependency either to the resource or between the relevant stacks, as appropriate. If more complex logic is in needed, you can similarly remove, replace, or view dependencies between `CfnResource` objects with the `CfnResource` `removeDependency`, `replaceDependency`, and `obtainDependencies` methods, respectively. - -## Custom Resources - -Custom Resources are CloudFormation resources that are implemented by arbitrary -user code. They can do arbitrary lookups or modifications during a -CloudFormation deployment. - -Custom resources are backed by *custom resource providers*. Commonly, these are -Lambda Functions that are deployed in the same deployment as the one that -defines the custom resource itself, but they can also be backed by Lambda -Functions deployed previously, or code responding to SNS Topic events running on -EC2 instances in a completely different account. For more information on custom -resource providers, see the next section. - -Once you have a provider, each definition of a `CustomResource` construct -represents one invocation. A single provider can be used for the implementation -of arbitrarily many custom resource definitions. A single definition looks like -this: - -```ts -new CustomResource(this, 'MyMagicalResource', { - resourceType: 'Custom::MyCustomResource', // must start with 'Custom::' - - // the resource properties - properties: { - Property1: 'foo', - Property2: 'bar' - }, - - // the ARN of the provider (SNS/Lambda) which handles - // CREATE, UPDATE or DELETE events for this resource type - // see next section for details - serviceToken: 'ARN' -}); -``` - -### Custom Resource Providers - -Custom resources are backed by a **custom resource provider** which can be -implemented in one of the following ways. The following table compares the -various provider types (ordered from low-level to high-level): - -| Provider | Compute Type | Error Handling | Submit to CloudFormation | Max Timeout | Language | Footprint | -|----------------------------------------------------------------------|:------------:|:--------------:|:------------------------:|:---------------:|:--------:|:---------:| -| [sns.Topic](#amazon-sns-topic) | Self-managed | Manual | Manual | Unlimited | Any | Depends | -| [lambda.Function](#aws-lambda-function) | AWS Lambda | Manual | Manual | 15min | Any | Small | -| [core.CustomResourceProvider](#the-corecustomresourceprovider-class) | AWS Lambda | Auto | Auto | 15min | Node.js | Small | -| [custom-resources.Provider](#the-custom-resource-provider-framework) | AWS Lambda | Auto | Auto | Unlimited Async | Any | Large | - -Legend: - -- **Compute type**: which type of compute can be used to execute the handler. -- **Error Handling**: whether errors thrown by handler code are automatically - trapped and a FAILED response is submitted to CloudFormation. If this is - "Manual", developers must take care of trapping errors. Otherwise, events - could cause stacks to hang. -- **Submit to CloudFormation**: whether the framework takes care of submitting - SUCCESS/FAILED responses to CloudFormation through the event's response URL. -- **Max Timeout**: maximum allows/possible timeout. -- **Language**: which programming languages can be used to implement handlers. -- **Footprint**: how many resources are used by the provider framework itself. - -**A NOTE ABOUT SINGLETONS** - -When defining resources for a custom resource provider, you will likely want to -define them as a *stack singleton* so that only a single instance of the -provider is created in your stack and which is used by all custom resources of -that type. - -Here is a basic pattern for defining stack singletons in the CDK. The following -examples ensures that only a single SNS topic is defined: - -```ts -function getOrCreate(scope: Construct): sns.Topic { - const stack = Stack.of(scope); - const uniqueid = 'GloballyUniqueIdForSingleton'; // For example, a UUID from `uuidgen` - const existing = stack.node.tryFindChild(uniqueid); - if (existing) { - return existing as sns.Topic; - } - return new sns.Topic(stack, uniqueid); -} -``` - -#### Amazon SNS Topic - -Every time a resource event occurs (CREATE/UPDATE/DELETE), an SNS notification -is sent to the SNS topic. Users must process these notifications (e.g. through a -fleet of worker hosts) and submit success/failure responses to the -CloudFormation service. - -> You only need to use this type of provider if your custom resource cannot run on AWS Lambda, for reasons other than the 15 -> minute timeout. If you are considering using this type of provider because you want to write a custom resource provider that may need -> to wait for more than 15 minutes for the API calls to stabilize, have a look at the [`custom-resources`](#the-custom-resource-provider-framework) module first. -> -> Refer to the [CloudFormation Custom Resource documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) for information on the contract your custom resource needs to adhere to. - -Set `serviceToken` to `topic.topicArn` in order to use this provider: - -```ts -const topic = new sns.Topic(this, 'MyProvider'); - -new CustomResource(this, 'MyResource', { - serviceToken: topic.topicArn -}); -``` - -#### AWS Lambda Function - -An AWS lambda function is called *directly* by CloudFormation for all resource -events. The handler must take care of explicitly submitting a success/failure -response to the CloudFormation service and handle various error cases. - -> **We do not recommend you use this provider type.** The CDK has wrappers around Lambda Functions that make them easier to work with. -> -> If you do want to use this provider, refer to the [CloudFormation Custom Resource documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) for information on the contract your custom resource needs to adhere to. - -Set `serviceToken` to `lambda.functionArn` to use this provider: - -```ts -const fn = new lambda.Function(this, 'MyProvider', functionProps); - -new CustomResource(this, 'MyResource', { - serviceToken: fn.functionArn, -}); -``` - -#### The `core.CustomResourceProvider` class - -The class [`@aws-cdk/core.CustomResourceProvider`] offers a basic low-level -framework designed to implement simple and slim custom resource providers. It -currently only supports Node.js-based user handlers, represents permissions as raw -JSON blobs instead of `iam.PolicyStatement` objects, and it does not have -support for asynchronous waiting (handler cannot exceed the 15min lambda -timeout). - -[`@aws-cdk/core.CustomResourceProvider`]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.CustomResourceProvider.html - -> **As an application builder, we do not recommend you use this provider type.** This provider exists purely for custom resources that are part of the AWS Construct Library. -> -> The [`custom-resources`](#the-custom-resource-provider-framework) provider is more convenient to work with and more fully-featured. - -The provider has a built-in singleton method which uses the resource type as a -stack-unique identifier and returns the service token: - -```ts -const serviceToken = CustomResourceProvider.getOrCreate(this, 'Custom::MyCustomResourceType', { - codeDirectory: `${__dirname}/my-handler`, - runtime: CustomResourceProviderRuntime.NODEJS_14_X, - description: "Lambda function created by the custom resource provider", -}); - -new CustomResource(this, 'MyResource', { - resourceType: 'Custom::MyCustomResourceType', - serviceToken: serviceToken -}); -``` - -The directory (`my-handler` in the above example) must include an `index.js` file. It cannot import -external dependencies or files outside this directory. It must export an async -function named `handler`. This function accepts the CloudFormation resource -event object and returns an object with the following structure: - -```js -exports.handler = async function(event) { - const id = event.PhysicalResourceId; // only for "Update" and "Delete" - const props = event.ResourceProperties; - const oldProps = event.OldResourceProperties; // only for "Update"s - - switch (event.RequestType) { - case "Create": - // ... - - case "Update": - // ... - - // if an error is thrown, a FAILED response will be submitted to CFN - throw new Error('Failed!'); - - case "Delete": - // ... - } - - return { - // (optional) the value resolved from `resource.ref` - // defaults to "event.PhysicalResourceId" or "event.RequestId" - PhysicalResourceId: "REF", - - // (optional) calling `resource.getAtt("Att1")` on the custom resource in the CDK app - // will return the value "BAR". - Data: { - Att1: "BAR", - Att2: "BAZ" - }, - - // (optional) user-visible message - Reason: "User-visible message", - - // (optional) hides values from the console - NoEcho: true - }; -} -``` - -Here is an complete example of a custom resource that summarizes two numbers: - -`sum-handler/index.js`: - -```js -exports.handler = async (e) => { - return { - Data: { - Result: e.ResourceProperties.lhs + e.ResourceProperties.rhs, - }, - }; -}; -``` - -`sum.ts`: - -```ts nofixture -import { - Construct, - CustomResource, - CustomResourceProvider, - CustomResourceProviderRuntime, - Token, -} from '@aws-cdk/core'; - -export interface SumProps { - readonly lhs: number; - readonly rhs: number; -} - -export class Sum extends Construct { - public readonly result: number; - - constructor(scope: Construct, id: string, props: SumProps) { - super(scope, id); - - const resourceType = 'Custom::Sum'; - const serviceToken = CustomResourceProvider.getOrCreate(this, resourceType, { - codeDirectory: `${__dirname}/sum-handler`, - runtime: CustomResourceProviderRuntime.NODEJS_14_X, - }); - - const resource = new CustomResource(this, 'Resource', { - resourceType: resourceType, - serviceToken: serviceToken, - properties: { - lhs: props.lhs, - rhs: props.rhs - } - }); - - this.result = Token.asNumber(resource.getAtt('Result')); - } -} -``` - -Usage will look like this: - -```ts fixture=README-custom-resource-provider -const sum = new Sum(this, 'MySum', { lhs: 40, rhs: 2 }); -new CfnOutput(this, 'Result', { value: Token.asString(sum.result) }); -``` - -To access the ARN of the provider's AWS Lambda function role, use the `getOrCreateProvider()` -built-in singleton method: - -```ts -const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', { - codeDirectory: `${__dirname}/my-handler`, - runtime: CustomResourceProviderRuntime.NODEJS_14_X, -}); - -const roleArn = provider.roleArn; -``` - -This role ARN can then be used in resource-based IAM policies. - -To add IAM policy statements to this role, use `addToRolePolicy()`: - -```ts -const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', { - codeDirectory: `${__dirname}/my-handler`, - runtime: CustomResourceProviderRuntime.NODEJS_14_X, -}); -provider.addToRolePolicy({ - Effect: 'Allow', - Action: 's3:GetObject', - Resource: '*', -}) -``` - -Note that `addToRolePolicy()` uses direct IAM JSON policy blobs, *not* a -`iam.PolicyStatement` object like you will see in the rest of the CDK. - -#### The Custom Resource Provider Framework - -The [`@aws-cdk/custom-resources`] module includes an advanced framework for -implementing custom resource providers. - -[`@aws-cdk/custom-resources`]: https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html - -Handlers are implemented as AWS Lambda functions, which means that they can be -implemented in any Lambda-supported runtime. Furthermore, this provider has an -asynchronous mode, which means that users can provide an `isComplete` lambda -function which is called periodically until the operation is complete. This -allows implementing providers that can take up to two hours to stabilize. - -Set `serviceToken` to `provider.serviceToken` to use this type of provider: - -```ts -const provider = new customresources.Provider(this, 'MyProvider', { - onEventHandler, - isCompleteHandler, // optional async waiter -}); - -new CustomResource(this, 'MyResource', { - serviceToken: provider.serviceToken -}); -``` - -See the [documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html) for more details. - -## AWS CloudFormation features - -A CDK stack synthesizes to an AWS CloudFormation Template. This section -explains how this module allows users to access low-level CloudFormation -features when needed. - -### Stack Outputs - -CloudFormation [stack outputs][cfn-stack-output] and exports are created using -the `CfnOutput` class: - -```ts -new CfnOutput(this, 'OutputName', { - value: myBucket.bucketName, - description: 'The name of an S3 bucket', // Optional - exportName: 'TheAwesomeBucket', // Registers a CloudFormation export named "TheAwesomeBucket" -}); -``` - -[cfn-stack-output]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html - -### Parameters - -CloudFormation templates support the use of [Parameters][cfn-parameters] to -customize a template. They enable CloudFormation users to input custom values to -a template each time a stack is created or updated. While the CDK design -philosophy favors using build-time parameterization, users may need to use -CloudFormation in a number of cases (for example, when migrating an existing -stack to the AWS CDK). - -Template parameters can be added to a stack by using the `CfnParameter` class: - -```ts -new CfnParameter(this, 'MyParameter', { - type: 'Number', - default: 1337, - // See the API reference for more configuration props -}); -``` - -The value of parameters can then be obtained using one of the `value` methods. -As parameters are only resolved at deployment time, the values obtained are -placeholder tokens for the real value (`Token.isUnresolved()` would return `true` -for those): - -```ts -const param = new CfnParameter(this, 'ParameterName', { /* config */ }); - -// If the parameter is a String -param.valueAsString; - -// If the parameter is a Number -param.valueAsNumber; - -// If the parameter is a List -param.valueAsList; -``` - -[cfn-parameters]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html - -### Pseudo Parameters - -CloudFormation supports a number of [pseudo parameters][cfn-pseudo-params], -which resolve to useful values at deployment time. CloudFormation pseudo -parameters can be obtained from static members of the `Aws` class. - -It is generally recommended to access pseudo parameters from the scope's `stack` -instead, which guarantees the values produced are qualifying the designated -stack, which is essential in cases where resources are shared cross-stack: - -```ts -// "this" is the current construct -const stack = Stack.of(this); - -stack.account; // Returns the AWS::AccountId for this stack (or the literal value if known) -stack.region; // Returns the AWS::Region for this stack (or the literal value if known) -stack.partition; // Returns the AWS::Partition for this stack (or the literal value if known) -``` - -[cfn-pseudo-params]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html - -### Resource Options - -CloudFormation resources can also specify [resource -attributes][cfn-resource-attributes]. The `CfnResource` class allows -accessing those through the `cfnOptions` property: - -```ts -const rawBucket = new s3.CfnBucket(this, 'Bucket', { /* ... */ }); -// -or- -const rawBucketAlt = myBucket.node.defaultChild as s3.CfnBucket; - -// then -rawBucket.cfnOptions.condition = new CfnCondition(this, 'EnableBucket', { /* ... */ }); -rawBucket.cfnOptions.metadata = { - metadataKey: 'MetadataValue', -}; -``` - -Resource dependencies (the `DependsOn` attribute) is modified using the -`cfnResource.addDependency` method: - -```ts -const resourceA = new CfnResource(this, 'ResourceA', resourceProps); -const resourceB = new CfnResource(this, 'ResourceB', resourceProps); - -resourceB.addDependency(resourceA); -``` - -[cfn-resource-attributes]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-attribute-reference.html - -#### CreationPolicy - -Some resources support a [CreationPolicy][creation-policy] to be specified as a CfnOption. - -The creation policy is invoked only when AWS CloudFormation creates the associated resource. Currently, the only AWS CloudFormation resources that support creation policies are `CfnAutoScalingGroup`, `CfnInstance`, `CfnWaitCondition` and `CfnFleet`. - -The `CfnFleet` resource from the `aws-appstream` module supports specifying `startFleet` as -a property of the creationPolicy on the resource options. Setting it to true will make AWS CloudFormation wait until the fleet is started before continuing with the creation of -resources that depend on the fleet resource. - -```ts -const fleet = new CfnFleet(stack, 'Fleet', { - instanceType: 'stream.standard.small', - name: 'Fleet', - computeCapacity: { - desiredInstances: 1, - }, - imageName: 'AppStream-AmazonLinux2-09-21-2022', -}); -fleet.cfnOptions.creationPolicy = { - startFleet: true, -}; -``` - -The properties passed to the level 2 constructs `AutoScalingGroup` and `Instance` from the -`aws-ec2` module abstract what is passed into the `CfnOption` properties `resourceSignal` and -`autoScalingCreationPolicy`, but when using level 1 constructs you can specify these yourself. - -The CfnWaitCondition resource from the `aws-cloudformation` module suppports the `resourceSignal`. -The format of the timeout is `PT#H#M#S`. In the example below AWS Cloudformation will wait for -3 success signals to occur within 15 minutes before the status of the resource will be set to -`CREATE_COMPLETE`. - -```ts -resource.cfnOptions.resourceSignal = { - count: 3, - timeout: 'PR15M', -} -``` - -[creation-policy]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html - -### Intrinsic Functions and Condition Expressions - -CloudFormation supports [intrinsic functions][cfn-intrinsics]. These functions -can be accessed from the `Fn` class, which provides type-safe methods for each -intrinsic function as well as condition expressions: - -```ts -declare const myObjectOrArray: any; -declare const myArray: any; - -// To use Fn::Base64 -Fn.base64('SGVsbG8gQ0RLIQo='); - -// To compose condition expressions: -const environmentParameter = new CfnParameter(this, 'Environment'); -Fn.conditionAnd( - // The "Environment" CloudFormation template parameter evaluates to "Production" - Fn.conditionEquals('Production', environmentParameter), - // The AWS::Region pseudo-parameter value is NOT equal to "us-east-1" - Fn.conditionNot(Fn.conditionEquals('us-east-1', Aws.REGION)), -); - -// To use Fn::ToJsonString -Fn.toJsonString(myObjectOrArray); - -// To use Fn::Length -Fn.len(Fn.split(',', myArray)); -``` - -When working with deploy-time values (those for which `Token.isUnresolved` -returns `true`), idiomatic conditionals from the programming language cannot be -used (the value will not be known until deployment time). When conditional logic -needs to be expressed with un-resolved values, it is necessary to use -CloudFormation conditions by means of the `CfnCondition` class: - -```ts -const environmentParameter = new CfnParameter(this, 'Environment'); -const isProd = new CfnCondition(this, 'IsProduction', { - expression: Fn.conditionEquals('Production', environmentParameter), -}); - -// Configuration value that is a different string based on IsProduction -const stage = Fn.conditionIf(isProd.logicalId, 'Beta', 'Prod').toString(); - -// Make Bucket creation condition to IsProduction by accessing -// and overriding the CloudFormation resource -const bucket = new s3.Bucket(this, 'Bucket'); -const cfnBucket = myBucket.node.defaultChild as s3.CfnBucket; -cfnBucket.cfnOptions.condition = isProd; -``` - -[cfn-intrinsics]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html - -### Mappings - -CloudFormation [mappings][cfn-mappings] are created and queried using the -`CfnMappings` class: - -```ts -const regionTable = new CfnMapping(this, 'RegionTable', { - mapping: { - 'us-east-1': { - regionName: 'US East (N. Virginia)', - // ... - }, - 'us-east-2': { - regionName: 'US East (Ohio)', - // ... - }, - // ... - } -}); - -regionTable.findInMap(Aws.REGION, 'regionName') -``` - -This will yield the following template: - -```yaml -Mappings: - RegionTable: - us-east-1: - regionName: US East (N. Virginia) - us-east-2: - regionName: US East (Ohio) -``` - -Mappings can also be synthesized "lazily"; lazy mappings will only render a "Mappings" -section in the synthesized CloudFormation template if some `findInMap` call is unable to -immediately return a concrete value due to one or both of the keys being unresolved tokens -(some value only available at deploy-time). - -For example, the following code will not produce anything in the "Mappings" section. The -call to `findInMap` will be able to resolve the value during synthesis and simply return -`'US East (Ohio)'`. - -```ts -const regionTable = new CfnMapping(this, 'RegionTable', { - mapping: { - 'us-east-1': { - regionName: 'US East (N. Virginia)', - }, - 'us-east-2': { - regionName: 'US East (Ohio)', - }, - }, - lazy: true, -}); - -regionTable.findInMap('us-east-2', 'regionName'); -``` - -On the other hand, the following code will produce the "Mappings" section shown above, -since the top-level key is an unresolved token. The call to `findInMap` will return a token that resolves to -`{ "Fn::FindInMap": [ "RegionTable", { "Ref": "AWS::Region" }, "regionName" ] }`. - -```ts -declare const regionTable: CfnMapping; - -regionTable.findInMap(Aws.REGION, 'regionName'); -``` - -[cfn-mappings]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html - -### Dynamic References - -CloudFormation supports [dynamically resolving][cfn-dynamic-references] values -for SSM parameters (including secure strings) and Secrets Manager. Encoding such -references is done using the `CfnDynamicReference` class: - -```ts -new CfnDynamicReference( - CfnDynamicReferenceService.SECRETS_MANAGER, - 'secret-id:secret-string:json-key:version-stage:version-id', -); -``` - -[cfn-dynamic-references]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html - -### Template Options & Transform - -CloudFormation templates support a number of options, including which Macros or -[Transforms][cfn-transform] to use when deploying the stack. Those can be -configured using the `stack.templateOptions` property: - -```ts -const stack = new Stack(app, 'StackName'); - -stack.templateOptions.description = 'This will appear in the AWS console'; -stack.templateOptions.transforms = ['AWS::Serverless-2016-10-31']; -stack.templateOptions.metadata = { - metadataKey: 'MetadataValue', -}; -``` - -[cfn-transform]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html - -### Emitting Raw Resources - -The `CfnResource` class allows emitting arbitrary entries in the -[Resources][cfn-resources] section of the CloudFormation template. - -```ts -new CfnResource(this, 'ResourceId', { - type: 'AWS::S3::Bucket', - properties: { - BucketName: 'bucket-name' - }, -}); -``` - -As for any other resource, the logical ID in the CloudFormation template will be -generated by the AWS CDK, but the type and properties will be copied verbatim in -the synthesized template. - -[cfn-resources]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html - -### Including raw CloudFormation template fragments - -When migrating a CloudFormation stack to the AWS CDK, it can be useful to -include fragments of an existing template verbatim in the synthesized template. -This can be achieved using the `CfnInclude` class. - -```ts -new CfnInclude(this, 'ID', { - template: { - Resources: { - Bucket: { - Type: 'AWS::S3::Bucket', - Properties: { - BucketName: 'my-shiny-bucket' - } - } - } - }, -}); -``` - -### Termination Protection - -You can prevent a stack from being accidentally deleted by enabling termination -protection on the stack. If a user attempts to delete a stack with termination -protection enabled, the deletion fails and the stack--including its status--remains -unchanged. Enabling or disabling termination protection on a stack sets it for any -nested stacks belonging to that stack as well. You can enable termination protection -on a stack by setting the `terminationProtection` prop to `true`. - -```ts -const stack = new Stack(app, 'StackName', { - terminationProtection: true, -}); -``` - -By default, termination protection is disabled. - -### Description - -You can add a description of the stack in the same way as `StackProps`. - -```ts -const stack = new Stack(app, 'StackName', { - description: 'This is a description.', -}); -``` - -### CfnJson - -`CfnJson` allows you to postpone the resolution of a JSON blob from -deployment-time. This is useful in cases where the CloudFormation JSON template -cannot express a certain value. - -A common example is to use `CfnJson` in order to render a JSON map which needs -to use intrinsic functions in keys. Since JSON map keys must be strings, it is -impossible to use intrinsics in keys and `CfnJson` can help. - -The following example defines an IAM role which can only be assumed by -principals that are tagged with a specific tag. - -```ts -const tagParam = new CfnParameter(this, 'TagName'); - -const stringEquals = new CfnJson(this, 'ConditionJson', { - value: { - [`aws:PrincipalTag/${tagParam.valueAsString}`]: true, - }, -}); - -const principal = new iam.AccountRootPrincipal().withConditions({ - StringEquals: stringEquals, -}); - -new iam.Role(this, 'MyRole', { assumedBy: principal }); -``` - -**Explanation**: since in this example we pass the tag name through a parameter, it -can only be resolved during deployment. The resolved value can be represented in -the template through a `{ "Ref": "TagName" }`. However, since we want to use -this value inside a [`aws:PrincipalTag/TAG-NAME`](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltag) -IAM operator, we need it in the *key* of a `StringEquals` condition. JSON keys -*must be* strings, so to circumvent this limitation, we use `CfnJson` -to "delay" the rendition of this template section to deploy-time. This means -that the value of `StringEquals` in the template will be `{ "Fn::GetAtt": [ "ConditionJson", "Value" ] }`, and will only "expand" to the operator we synthesized during deployment. - -### Stack Resource Limit - -When deploying to AWS CloudFormation, it needs to keep in check the amount of resources being added inside a Stack. Currently it's possible to check the limits in the [AWS CloudFormation quotas](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) page. - -It's possible to synthesize the project with more Resources than the allowed (or even reduce the number of Resources). - -Set the context key `@aws-cdk/core:stackResourceLimit` with the proper value, being 0 for disable the limit of resources. - -## App Context - -[Context values](https://docs.aws.amazon.com/cdk/v2/guide/context.html) are key-value pairs that can be associated with an app, stack, or construct. -One common use case for context is to use it for enabling/disabling [feature flags](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html). There are several places -where context can be specified. They are listed below in the order they are evaluated (items at the -top take precedence over those below). - -- The `node.setContext()` method -- The `postCliContext` prop when you create an `App` -- The CLI via the `--context` CLI argument -- The `cdk.json` file via the `context` key: -- The `cdk.context.json` file: -- The `~/.cdk.json` file via the `context` key: -- The `context` prop when you create an `App` - -### Examples of setting context - -```ts -new App({ - context: { - '@aws-cdk/core:newStyleStackSynthesis': true, - }, -}); -``` - -```ts -const app = new App(); -app.node.setContext('@aws-cdk/core:newStyleStackSynthesis', true); -``` - -```ts -new App({ - postCliContext: { - '@aws-cdk/core:newStyleStackSynthesis': true, - }, -}); -``` - -```console -cdk synth --context @aws-cdk/core:newStyleStackSynthesis=true -``` - -_cdk.json_ - -```json -{ - "context": { - "@aws-cdk/core:newStyleStackSynthesis": true - } -} -``` - -_cdk.context.json_ - -```json -{ - "@aws-cdk/core:newStyleStackSynthesis": true -} -``` - -_~/.cdk.json_ - -```json -{ - "context": { - "@aws-cdk/core:newStyleStackSynthesis": true - } -} -``` - -## IAM Permissions Boundary - -It is possible to apply an [IAM permissions boundary](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) -to all roles within a specific construct scope. The most common use case would -be to apply a permissions boundary at the `Stage` level. - -```ts -declare const app: App; - -const prodStage = new Stage(app, 'ProdStage', { - permissionsBoundary: PermissionsBoundary.fromName('cdk-${Qualifier}-PermissionsBoundary'), -}); -``` - -Any IAM Roles or Users created within this Stage will have the default -permissions boundary attached. - -For more details see the [Permissions Boundary](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam-readme.html#permissions-boundaries) section in the IAM guide. - -## Policy Validation - -If you or your organization use (or would like to use) any policy validation tool, such as -[CloudFormation -Guard](https://docs.aws.amazon.com/cfn-guard/latest/ug/what-is-guard.html) or -[OPA](https://www.openpolicyagent.org/), to define constraints on your -CloudFormation template, you can incorporate them into the CDK application. -By using the appropriate plugin, you can make the CDK application check the -generated CloudFormation templates against your policies immediately after -synthesis. If there are any violations, the synthesis will fail and a report -will be printed to the console or to a file (see below). - -> **Note** -> This feature is considered experimental, and both the plugin API and the -> format of the validation report are subject to change in the future. - -### For application developers - -To use one or more validation plugins in your application, use the -`policyValidationBeta1` property of `Stage`: - -```ts -// globally for the entire app (an app is a stage) -const app = new App({ - policyValidationBeta1: [ - // These hypothetical classes implement IValidationPlugin: - new ThirdPartyPluginX(), - new ThirdPartyPluginY(), - ], -}); - -// only apply to a particular stage -const prodStage = new Stage(app, 'ProdStage', { - policyValidationBeta1: [...], -}); -``` - -Immediately after synthesis, all plugins registered this way will be invoked to -validate all the templates generated in the scope you defined. In particular, if -you register the templates in the `App` object, all templates will be subject to -validation. - -> **Warning** -> Other than modifying the cloud assembly, plugins can do anything that your CDK -> application can. They can read data from the filesystem, access the network -> etc. It's your responsibility as the consumer of a plugin to verify that it is -> secure to use. - -By default, the report will be printed in a human readable format. If you want a -report in JSON format, enable it using the `@aws-cdk/core:validationReportJson` -context passing it directly to the application: - -```ts -const app = new App({ - context: { '@aws-cdk/core:validationReportJson': true }, -}); -``` - -Alternatively, you can set this context key-value pair using the `cdk.json` or -`cdk.context.json` files in your project directory (see -[Runtime context](https://docs.aws.amazon.com/cdk/v2/guide/context.html)). - -If you choose the JSON format, the CDK will print the policy validation report -to a file called `policy-validation-report.json` in the cloud assembly -directory. For the default, human-readable format, the report will be printed to -the standard output. - -### For plugin authors - -The communication protocol between the CDK core module and your policy tool is -defined by the `IValidationPluginBeta1` interface. To create a new plugin you must -write a class that implements this interface. There are two things you need to -implement: the plugin name (by overriding the `name` property), and the -`validate()` method. - -The framework will call `validate()`, passing an `IValidationContextBeta1` object. -The location of the templates to be validated is given by `templatePaths`. The -plugin should return an instance of `ValidationPluginReportBeta1`. This object -represents the report that the user wil receive at the end of the synthesis. - -```ts -validate(context: ValidationContextBeta1): ValidationReportBeta1 { - // First read the templates using context.templatePaths... - - // ...then perform the validation, and then compose and return the report. - // Using hard-coded values here for better clarity: - return { - success: false, - violations: [{ - ruleName: 'CKV_AWS_117', - recommendation: 'Ensure that AWS Lambda function is configured inside a VPC', - fix: 'https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1', - violatingResources: [{ - resourceName: 'MyFunction3BAA72D1', - templatePath: '/home/johndoe/myapp/cdk.out/MyService.template.json', - locations: 'Properties/VpcConfig', - }], - }], - }; -} -``` - -Note that plugins are not allowed to modify anything in the cloud assembly. Any -attempt to do so will result in synthesis failure. - -If your plugin depends on an external tool, keep in mind that some developers may -not have that tool installed in their workstations yet. To minimize friction, we -highly recommend that you provide some installation script along with your -plugin package, to automate the whole process. Better yet, run that script as -part of the installation of your package. With `npm`, for example, you can run -add it to the `postinstall` -[script](https://docs.npmjs.com/cli/v9/using-npm/scripts) in the `package.json` -file. - - diff --git a/packages/@aws-cdk/core/jest.config.js b/packages/@aws-cdk/core/jest.config.js deleted file mode 100644 index 93246ea5102e5..0000000000000 --- a/packages/@aws-cdk/core/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - branches: 60, - statements: 75, - } - } -}; diff --git a/packages/@aws-cdk/core/lib/annotations.ts b/packages/@aws-cdk/core/lib/annotations.ts deleted file mode 100644 index 4907f0b7987b0..0000000000000 --- a/packages/@aws-cdk/core/lib/annotations.ts +++ /dev/null @@ -1,97 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; -import { IConstruct } from 'constructs'; - -/** - * Includes API for attaching annotations such as warning messages to constructs. - */ -export class Annotations { - /** - * Returns the annotations API for a construct scope. - * @param scope The scope - */ - public static of(scope: IConstruct) { - return new Annotations(scope); - } - - private readonly stackTraces: boolean; - - private constructor(private readonly scope: IConstruct) { - const disableTrace = - scope.node.tryGetContext(cxapi.DISABLE_METADATA_STACK_TRACE) || - process.env.CDK_DISABLE_STACK_TRACE; - - this.stackTraces = !disableTrace; - } - - /** - * Adds a warning metadata entry to this construct. - * - * The CLI will display the warning when an app is synthesized, or fail if run - * in --strict mode. - * - * @param message The warning message. - */ - public addWarning(message: string) { - this.addMessage(cxschema.ArtifactMetadataEntryType.WARN, message); - } - - /** - * Adds an info metadata entry to this construct. - * - * The CLI will display the info message when apps are synthesized. - * - * @param message The info message. - */ - public addInfo(message: string): void { - this.addMessage(cxschema.ArtifactMetadataEntryType.INFO, message); - } - - /** - * Adds an { "error": } metadata entry to this construct. - * The toolkit will fail deployment of any stack that has errors reported against it. - * @param message The error message. - */ - public addError(message: string) { - this.addMessage(cxschema.ArtifactMetadataEntryType.ERROR, message); - } - - /** - * Adds a deprecation warning for a specific API. - * - * Deprecations will be added only once per construct as a warning and will be - * deduplicated based on the `api`. - * - * If the environment variable `CDK_BLOCK_DEPRECATIONS` is set, this method - * will throw an error instead with the deprecation message. - * - * @param api The API being deprecated in the format `module.Class.property` - * (e.g. `@aws-cdk/core.Construct.node`). - * @param message The deprecation message to display, with information about - * alternatives. - */ - public addDeprecation(api: string, message: string) { - const text = `The API ${api} is deprecated: ${message}. This API will be removed in the next major release`; - - // throw if CDK_BLOCK_DEPRECATIONS is set - if (process.env.CDK_BLOCK_DEPRECATIONS) { - throw new Error(`${this.scope.node.path}: ${text}`); - } - - this.addWarning(text); - } - - /** - * Adds a message metadata entry to the construct node, to be displayed by the CDK CLI. - * - * Records the message once per construct. - * @param level The message level - * @param message The message itself - */ - private addMessage(level: string, message: string) { - const isNew = !this.scope.node.metadata.find((x) => x.data === message); - if (isNew) { - this.scope.node.addMetadata(level, message, { stackTrace: this.stackTraces }); - } - } -} diff --git a/packages/@aws-cdk/core/lib/app.ts b/packages/@aws-cdk/core/lib/app.ts deleted file mode 100644 index fe278ecf1a6a3..0000000000000 --- a/packages/@aws-cdk/core/lib/app.ts +++ /dev/null @@ -1,248 +0,0 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import * as fs from 'fs-extra'; -import { PRIVATE_CONTEXT_DEFAULT_STACK_SYNTHESIZER } from './private/private-context'; -import { addCustomSynthesis, ICustomSynthesis } from './private/synthesis'; -import { IReusableStackSynthesizer } from './stack-synthesizers'; -import { Stage } from './stage'; -import { IPolicyValidationPluginBeta1 } from './validation/validation'; - -const APP_SYMBOL = Symbol.for('@aws-cdk/core.App'); - -/** - * Initialization props for apps. - */ -export interface AppProps { - /** - * Automatically call `synth()` before the program exits. - * - * If you set this, you don't have to call `synth()` explicitly. Note that - * this feature is only available for certain programming languages, and - * calling `synth()` is still recommended. - * - * @default true if running via CDK CLI (`CDK_OUTDIR` is set), `false` - * otherwise - */ - readonly autoSynth?: boolean; - - /** - * The output directory into which to emit synthesized artifacts. - * - * You should never need to set this value. By default, the value you pass to - * the CLI's `--output` flag will be used, and if you change it to a different - * directory the CLI will fail to pick up the generated Cloud Assembly. - * - * This property is intended for internal and testing use. - * - * @default - If this value is _not_ set, considers the environment variable `CDK_OUTDIR`. - * If `CDK_OUTDIR` is not defined, uses a temp directory. - */ - readonly outdir?: string; - - /** - * Include construct creation stack trace in the `aws:cdk:trace` metadata key of all constructs. - * @default true stack traces are included unless `aws:cdk:disable-stack-trace` is set in the context. - */ - readonly stackTraces?: boolean; - - /** - * Include runtime versioning information in the Stacks of this app - * - * @deprecated use `versionReporting` instead - * @default Value of 'aws:cdk:version-reporting' context key - */ - readonly runtimeInfo?: boolean; - - /** - * Include runtime versioning information in the Stacks of this app - * - * @default Value of 'aws:cdk:version-reporting' context key - */ - readonly analyticsReporting?: boolean; - - /** - * Additional context values for the application. - * - * Context set by the CLI or the `context` key in `cdk.json` has precedence. - * - * Context can be read from any construct using `node.getContext(key)`. - * - * @default - no additional context - */ - readonly context?: { [key: string]: any }; - - /** - * Additional context values for the application. - * - * Context provided here has precedence over context set by: - * - * - The CLI via --context - * - The `context` key in `cdk.json` - * - The `AppProps.context` property - * - * This property is recommended over the `AppProps.context` property since you - * can make final decision over which context value to take in your app. - * - * Context can be read from any construct using `node.getContext(key)`. - * - * @example - * // context from the CLI and from `cdk.json` are stored in the - * // CDK_CONTEXT env variable - * const cliContext = JSON.parse(process.env.CDK_CONTEXT!); - * - * // determine whether to take the context passed in the CLI or not - * const determineValue = process.env.PROD ? cliContext.SOMEKEY : 'my-prod-value'; - * new App({ - * postCliContext: { - * SOMEKEY: determineValue, - * }, - * }); - * - * @default - no additional context - */ - readonly postCliContext?: { [key: string]: any }; - - /** - * Include construct tree metadata as part of the Cloud Assembly. - * - * @default true - */ - readonly treeMetadata?: boolean; - - /** - * The stack synthesizer to use by default for all Stacks in the App - * - * The Stack Synthesizer controls aspects of synthesis and deployment, - * like how assets are referenced and what IAM roles to use. For more - * information, see the README of the main CDK package. - * - * @default - A `DefaultStackSynthesizer` with default settings - */ - readonly defaultStackSynthesizer?: IReusableStackSynthesizer; - - /** - * Validation plugins to run after synthesis - * - * @default - no validation plugins - */ - readonly policyValidationBeta1?: IPolicyValidationPluginBeta1[]; -} - -/** - * A construct which represents an entire CDK app. This construct is normally - * the root of the construct tree. - * - * You would normally define an `App` instance in your program's entrypoint, - * then define constructs where the app is used as the parent scope. - * - * After all the child constructs are defined within the app, you should call - * `app.synth()` which will emit a "cloud assembly" from this app into the - * directory specified by `outdir`. Cloud assemblies includes artifacts such as - * CloudFormation templates and assets that are needed to deploy this app into - * the AWS cloud. - * - * @see https://docs.aws.amazon.com/cdk/latest/guide/apps.html - */ -export class App extends Stage { - /** - * Checks if an object is an instance of the `App` class. - * @returns `true` if `obj` is an `App`. - * @param obj The object to evaluate - */ - public static isApp(obj: any): obj is App { - return APP_SYMBOL in obj; - } - - /** - * Include construct tree metadata as part of the Cloud Assembly. - * - * @internal - */ - public readonly _treeMetadata: boolean; - - /** - * Initializes a CDK application. - * @param props initialization properties - */ - constructor(props: AppProps = {}) { - super(undefined as any, '', { - outdir: props.outdir ?? process.env[cxapi.OUTDIR_ENV], - policyValidationBeta1: props.policyValidationBeta1, - }); - - Object.defineProperty(this, APP_SYMBOL, { value: true }); - - this.loadContext(props.context, props.postCliContext); - - if (props.stackTraces === false) { - this.node.setContext(cxapi.DISABLE_METADATA_STACK_TRACE, true); - } - - if (props.defaultStackSynthesizer) { - this.node.setContext(PRIVATE_CONTEXT_DEFAULT_STACK_SYNTHESIZER, props.defaultStackSynthesizer); - } - - const analyticsReporting = props.analyticsReporting ?? props.runtimeInfo; - - if (analyticsReporting !== undefined) { - this.node.setContext(cxapi.ANALYTICS_REPORTING_ENABLED_CONTEXT, analyticsReporting); - } - - const autoSynth = props.autoSynth ?? cxapi.OUTDIR_ENV in process.env; - if (autoSynth) { - // synth() guarantees it will only execute once, so a default of 'true' - // doesn't bite manual calling of the function. - process.once('beforeExit', () => this.synth()); - } - - this._treeMetadata = props.treeMetadata ?? true; - } - - private loadContext(defaults: { [key: string]: string } = { }, final: { [key: string]: string } = {}) { - // prime with defaults passed through constructor - for (const [k, v] of Object.entries(defaults)) { - this.node.setContext(k, v); - } - - // reconstructing the context from the two possible sources: - const context = { - ...this.readContextFromEnvironment(), - ...this.readContextFromTempFile(), - }; - - for (const [k, v] of Object.entries(context)) { - this.node.setContext(k, v); - } - - // finalContext passed through constructor overwrites - for (const [k, v] of Object.entries(final)) { - this.node.setContext(k, v); - } - } - - private readContextFromTempFile() { - const location = process.env[cxapi.CONTEXT_OVERFLOW_LOCATION_ENV]; - return location ? fs.readJSONSync(location) : {}; - } - - private readContextFromEnvironment() { - const contextJson = process.env[cxapi.CONTEXT_ENV]; - return contextJson ? JSON.parse(contextJson) : {}; - } -} - -/** - * Add a custom synthesis for the given construct - * - * When the construct is being synthesized, this allows it to add additional items - * into the Cloud Assembly output. - * - * This feature is intended for use by official AWS CDK libraries only; 3rd party - * library authors and CDK users should not use this function. That's why it's not - * exposed via jsii. - */ -export function attachCustomSynthesis(construct: Construct, synthesis: ICustomSynthesis): void { - // synthesis.ts where the implementation lives is not exported. So - // this function is just a re-export of that function. - addCustomSynthesis(construct, synthesis); -} diff --git a/packages/@aws-cdk/core/lib/nested-stack.ts b/packages/@aws-cdk/core/lib/nested-stack.ts deleted file mode 100644 index 3d6f221fe2d94..0000000000000 --- a/packages/@aws-cdk/core/lib/nested-stack.ts +++ /dev/null @@ -1,279 +0,0 @@ -import * as crypto from 'crypto'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct, Node } from 'constructs'; -import { FileAssetPackaging } from './assets'; -import { Fn } from './cfn-fn'; -import { Aws } from './cfn-pseudo'; -import { CfnResource } from './cfn-resource'; -import { CfnStack } from './cloudformation.generated'; -import { Duration } from './duration'; -import { Lazy } from './lazy'; -import { Names } from './names'; -import { RemovalPolicy } from './removal-policy'; -import { IResolveContext } from './resolvable'; -import { Stack } from './stack'; -import { NestedStackSynthesizer } from './stack-synthesizers'; -import { Token } from './token'; - -const NESTED_STACK_SYMBOL = Symbol.for('@aws-cdk/core.NestedStack'); - -/** - * Initialization props for the `NestedStack` construct. - * - */ -export interface NestedStackProps { - /** - * The set value pairs that represent the parameters passed to CloudFormation - * when this nested stack is created. Each parameter has a name corresponding - * to a parameter defined in the embedded template and a value representing - * the value that you want to set for the parameter. - * - * The nested stack construct will automatically synthesize parameters in order - * to bind references from the parent stack(s) into the nested stack. - * - * @default - no user-defined parameters are passed to the nested stack - */ - readonly parameters?: { [key: string]: string }; - - /** - * The length of time that CloudFormation waits for the nested stack to reach - * the CREATE_COMPLETE state. - * - * When CloudFormation detects that the nested stack has reached the - * CREATE_COMPLETE state, it marks the nested stack resource as - * CREATE_COMPLETE in the parent stack and resumes creating the parent stack. - * If the timeout period expires before the nested stack reaches - * CREATE_COMPLETE, CloudFormation marks the nested stack as failed and rolls - * back both the nested stack and parent stack. - * - * @default - no timeout - */ - readonly timeout?: Duration; - - /** - * The Simple Notification Service (SNS) topics to publish stack related - * events. - * - * @default - notifications are not sent for this stack. - */ - readonly notificationArns?: string[]; - - /** - * Policy to apply when the nested stack is removed - * - * The default is `Destroy`, because all Removal Policies of resources inside the - * Nested Stack should already have been set correctly. You normally should - * not need to set this value. - * - * @default RemovalPolicy.DESTROY - */ - readonly removalPolicy?: RemovalPolicy; - - /** - * A description of the stack. - * - * @default - No description. - */ - readonly description?: string; -} - -/** - * A CloudFormation nested stack. - * - * When you apply template changes to update a top-level stack, CloudFormation - * updates the top-level stack and initiates an update to its nested stacks. - * CloudFormation updates the resources of modified nested stacks, but does not - * update the resources of unmodified nested stacks. - * - * Furthermore, this stack will not be treated as an independent deployment - * artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), - * but rather only synthesized as a template and uploaded as an asset to S3. - * - * Cross references of resource attributes between the parent stack and the - * nested stack will automatically be translated to stack parameters and - * outputs. - * - */ -export class NestedStack extends Stack { - - /** - * Checks if `x` is an object of type `NestedStack`. - */ - public static isNestedStack(x: any): x is NestedStack { - return x != null && typeof(x) === 'object' && NESTED_STACK_SYMBOL in x; - } - - public readonly templateFile: string; - public readonly nestedStackResource?: CfnResource; - - private readonly parameters: { [name: string]: string }; - private readonly resource: CfnStack; - private readonly _contextualStackId: string; - private readonly _contextualStackName: string; - private _templateUrl?: string; - private _parentStack: Stack; - - constructor(scope: Construct, id: string, props: NestedStackProps = { }) { - const parentStack = findParentStack(scope); - - super(scope, id, { - env: { account: parentStack.account, region: parentStack.region }, - synthesizer: new NestedStackSynthesizer(parentStack.synthesizer), - description: props.description, - crossRegionReferences: parentStack._crossRegionReferences, - }); - - this._parentStack = parentStack; - - const parentScope = new Construct(scope, id + '.NestedStack'); - - Object.defineProperty(this, NESTED_STACK_SYMBOL, { value: true }); - - // this is the file name of the synthesized template file within the cloud assembly - this.templateFile = `${Names.uniqueId(this)}.nested.template.json`; - - this.parameters = props.parameters || {}; - - this.resource = new CfnStack(parentScope, `${id}.NestedStackResource`, { - // This value cannot be cached since it changes during the synthesis phase - templateUrl: Lazy.uncachedString({ produce: () => this._templateUrl || '' }), - parameters: Lazy.any({ produce: () => Object.keys(this.parameters).length > 0 ? this.parameters : undefined }), - notificationArns: props.notificationArns, - timeoutInMinutes: props.timeout ? props.timeout.toMinutes() : undefined, - }); - this.resource.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.DESTROY); - - this.nestedStackResource = this.resource; - this.node.defaultChild = this.resource; - - // context-aware stack name: if resolved from within this stack, return AWS::StackName - // if resolved from the outer stack, use the { Ref } of the AWS::CloudFormation::Stack resource - // which resolves the ARN of the stack. We need to extract the stack name, which is the second - // component after splitting by "/" - this._contextualStackName = this.contextualAttribute(Aws.STACK_NAME, Fn.select(1, Fn.split('/', this.resource.ref))); - this._contextualStackId = this.contextualAttribute(Aws.STACK_ID, this.resource.ref); - } - - /** - * An attribute that represents the name of the nested stack. - * - * This is a context aware attribute: - * - If this is referenced from the parent stack, it will return a token that parses the name from the stack ID. - * - If this is referenced from the context of the nested stack, it will return `{ "Ref": "AWS::StackName" }` - * - * Example value: `mystack-mynestedstack-sggfrhxhum7w` - * @attribute - */ - public get stackName() { - return this._contextualStackName; - } - - /** - * An attribute that represents the ID of the stack. - * - * This is a context aware attribute: - * - If this is referenced from the parent stack, it will return `{ "Ref": "LogicalIdOfNestedStackResource" }`. - * - If this is referenced from the context of the nested stack, it will return `{ "Ref": "AWS::StackId" }` - * - * Example value: `arn:aws:cloudformation:us-east-2:123456789012:stack/mystack-mynestedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786` - * @attribute - */ - public get stackId() { - return this._contextualStackId; - } - - /** - * Assign a value to one of the nested stack parameters. - * @param name The parameter name (ID) - * @param value The value to assign - */ - public setParameter(name: string, value: string) { - this.parameters[name] = value; - } - - /** - * Defines an asset at the parent stack which represents the template of this - * nested stack. - * - * This private API is used by `App.prepare()` within a loop that rectifies - * references every time an asset is added. This is because (at the moment) - * assets are addressed using CloudFormation parameters. - * - * @returns `true` if a new asset was added or `false` if an asset was - * previously added. When this returns `true`, App will do another reference - * rectification cycle. - * - * @internal - */ - public _prepareTemplateAsset() { - if (this._templateUrl) { - return false; - } - - // When adding tags to nested stack, the tags need to be added to all the resources in - // nested stack, which is handled by the `tags` property, But to tag the - // tags have to be added in the parent stack CfnStack resource. The CfnStack resource created - // by this class don't share the same TagManager as that of the one exposed by the `tag` property of the - // class, all the tags need to be copied to the CfnStack resource before synthesizing the resource. - // See https://github.com/aws/aws-cdk/pull/19128 - Object.entries(this.tags.tagValues()).forEach(([key, value]) => { - this.resource.tags.setTag(key, value); - }); - - const cfn = JSON.stringify(this._toCloudFormation()); - const templateHash = crypto.createHash('sha256').update(cfn).digest('hex'); - - const templateLocation = this._parentStack.synthesizer.addFileAsset({ - packaging: FileAssetPackaging.FILE, - sourceHash: templateHash, - fileName: this.templateFile, - }); - - this.addResourceMetadata(this.resource, 'TemplateURL'); - - // if bucketName/objectKey are cfn parameters from a stack other than the parent stack, they will - // be resolved as cross-stack references like any other (see "multi" tests). - this._templateUrl = `https://s3.${this._parentStack.region}.${this._parentStack.urlSuffix}/${templateLocation.bucketName}/${templateLocation.objectKey}`; - return true; - } - - private contextualAttribute(innerValue: string, outerValue: string) { - return Token.asString({ - resolve: (context: IResolveContext) => { - if (Stack.of(context.scope) === this) { - return innerValue; - } else { - return outerValue; - } - }, - }); - } - - private addResourceMetadata(resource: CfnResource, resourceProperty: string) { - if (!this.node.tryGetContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)) { - return; // not enabled - } - - // tell tools such as SAM CLI that the "TemplateURL" property of this resource - // points to the nested stack template for local emulation - resource.cfnOptions.metadata = resource.cfnOptions.metadata || { }; - resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PATH_KEY] = this.templateFile; - resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PROPERTY_KEY] = resourceProperty; - } -} - -/** - * Validates the scope for a nested stack. Nested stacks must be defined within the scope of another `Stack`. - */ -function findParentStack(scope: Construct): Stack { - if (!scope) { - throw new Error('Nested stacks cannot be defined as a root construct'); - } - - const parentStack = Node.of(scope).scopes.reverse().find(p => Stack.isStack(p)); - if (!parentStack) { - throw new Error('Nested stacks must be defined within scope of another non-nested stack'); - } - - return parentStack as Stack; -} diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts b/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts deleted file mode 100644 index 6fa04b14cbcb3..0000000000000 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/types.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { CloudAssemblyBuilder } from '@aws-cdk/cx-api'; -import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetSource } from '../assets'; -import { Stack } from '../stack'; - -/** - * Encodes information how a certain Stack should be deployed - */ -export interface IStackSynthesizer { - /** - * The qualifier used to bootstrap this stack - * - * @default - no qualifier - */ - readonly bootstrapQualifier?: string; - - /** - * Bind to the stack this environment is going to be used on - * - * Must be called before any of the other methods are called, and can only be called once. - */ - bind(stack: Stack): void; - - /** - * Register a File Asset - * - * Returns the parameters that can be used to refer to the asset inside the template. - */ - addFileAsset(asset: FileAssetSource): FileAssetLocation; - - /** - * Register a Docker Image Asset - * - * Returns the parameters that can be used to refer to the asset inside the template. - */ - addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation; - - /** - * Synthesize the associated stack to the session - */ - synthesize(session: ISynthesisSession): void; -} - -/** - * Interface for Stack Synthesizers that can be used for more than one stack. - * - * Regular `IStackSynthesizer` instances can only be bound to a Stack once. - * `IReusableStackSynthesizer` instances. - * - * For backwards compatibility reasons, this class inherits from - * `IStackSynthesizer`, but if an object implements `IReusableStackSynthesizer`, - * no other methods than `reusableBind()` will be called. - */ -export interface IReusableStackSynthesizer extends IStackSynthesizer { - /** - * Produce a bound Stack Synthesizer for the given stack. - * - * This method may be called more than once on the same object. - */ - reusableBind(stack: Stack): IBoundStackSynthesizer; -} - -/** - * A Stack Synthesizer, obtained from `IReusableStackSynthesizer.` - * - * Just a type alias with a very concrete contract. - */ -export interface IBoundStackSynthesizer extends IStackSynthesizer { -} - -/** - * Represents a single session of synthesis. Passed into `Construct.synthesize()` methods. - */ -export interface ISynthesisSession { - /** - * The output directory for this synthesis session. - */ - outdir: string; - - /** - * Cloud assembly builder. - */ - assembly: CloudAssemblyBuilder; - - /** - * Whether the stack should be validated after synthesis to check for error metadata - * - * @default - false - */ - validateOnSynth?: boolean; -} - -/** - * Whether the given Stack Synthesizer is reusable or not - */ -export function isReusableStackSynthesizer(x: IStackSynthesizer): x is IReusableStackSynthesizer { - return !!(x as any).reusableBind; -} \ No newline at end of file diff --git a/packages/@aws-cdk/core/lib/stage.ts b/packages/@aws-cdk/core/lib/stage.ts deleted file mode 100644 index 94a8c29f05009..0000000000000 --- a/packages/@aws-cdk/core/lib/stage.ts +++ /dev/null @@ -1,265 +0,0 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { IConstruct, Construct, Node } from 'constructs'; -import { Environment } from './environment'; -import { PermissionsBoundary } from './permissions-boundary'; -import { synthesize } from './private/synthesis'; -import { IPolicyValidationPluginBeta1 } from './validation'; - -const STAGE_SYMBOL = Symbol.for('@aws-cdk/core.Stage'); - -/** - * Initialization props for a stage. - */ -export interface StageProps { - /** - * Default AWS environment (account/region) for `Stack`s in this `Stage`. - * - * Stacks defined inside this `Stage` with either `region` or `account` missing - * from its env will use the corresponding field given here. - * - * If either `region` or `account`is is not configured for `Stack` (either on - * the `Stack` itself or on the containing `Stage`), the Stack will be - * *environment-agnostic*. - * - * Environment-agnostic stacks can be deployed to any environment, may not be - * able to take advantage of all features of the CDK. For example, they will - * not be able to use environmental context lookups, will not automatically - * translate Service Principals to the right format based on the environment's - * AWS partition, and other such enhancements. - * - * @example - * - * // Use a concrete account and region to deploy this Stage to - * new Stage(app, 'Stage1', { - * env: { account: '123456789012', region: 'us-east-1' }, - * }); - * - * // Use the CLI's current credentials to determine the target environment - * new Stage(app, 'Stage2', { - * env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION }, - * }); - * - * @default - The environments should be configured on the `Stack`s. - */ - readonly env?: Environment; - - /** - * The output directory into which to emit synthesized artifacts. - * - * Can only be specified if this stage is the root stage (the app). If this is - * specified and this stage is nested within another stage, an error will be - * thrown. - * - * @default - for nested stages, outdir will be determined as a relative - * directory to the outdir of the app. For apps, if outdir is not specified, a - * temporary directory will be created. - */ - readonly outdir?: string; - - /** - * Name of this stage. - * - * @default - Derived from the id. - */ - readonly stageName?: string; - - /** - * Options for applying a permissions boundary to all IAM Roles - * and Users created within this Stage - * - * @default - no permissions boundary is applied - */ - readonly permissionsBoundary?: PermissionsBoundary; - - /** - * Validation plugins to run during synthesis. If any plugin reports any violation, - * synthesis will be interrupted and the report displayed to the user. - * - * @default - no validation plugins are used - */ - readonly policyValidationBeta1?: IPolicyValidationPluginBeta1[] -} - -/** - * An abstract application modeling unit consisting of Stacks that should be - * deployed together. - * - * Derive a subclass of `Stage` and use it to model a single instance of your - * application. - * - * You can then instantiate your subclass multiple times to model multiple - * copies of your application which should be be deployed to different - * environments. - */ -export class Stage extends Construct { - /** - * Return the stage this construct is contained with, if available. If called - * on a nested stage, returns its parent. - * - */ - public static of(construct: IConstruct): Stage | undefined { - return Node.of(construct).scopes.reverse().slice(1).find(Stage.isStage); - } - - /** - * Test whether the given construct is a stage. - * - */ - public static isStage(x: any ): x is Stage { - return x !== null && typeof(x) === 'object' && STAGE_SYMBOL in x; - } - - /** - * The default region for all resources defined within this stage. - * - */ - public readonly region?: string; - - /** - * The default account for all resources defined within this stage. - * - */ - public readonly account?: string; - - /** - * The cloud assembly builder that is being used for this App - * - * @internal - */ - public readonly _assemblyBuilder: cxapi.CloudAssemblyBuilder; - - /** - * The name of the stage. Based on names of the parent stages separated by - * hypens. - * - */ - public readonly stageName: string; - - /** - * The parent stage or `undefined` if this is the app. - * * - */ - public readonly parentStage?: Stage; - - /** - * The cached assembly if it was already built - */ - private assembly?: cxapi.CloudAssembly; - - /** - * Validation plugins to run during synthesis. If any plugin reports any violation, - * synthesis will be interrupted and the report displayed to the user. - * - * @default - no validation plugins are used - */ - public readonly policyValidationBeta1: IPolicyValidationPluginBeta1[] = []; - - - constructor(scope: Construct, id: string, props: StageProps = {}) { - super(scope, id); - - if (id !== '' && !/^[a-z][a-z0-9\-\_\.]+$/i.test(id)) { - throw new Error(`invalid stage name "${id}". Stage name must start with a letter and contain only alphanumeric characters, hypens ('-'), underscores ('_') and periods ('.')`); - } - - Object.defineProperty(this, STAGE_SYMBOL, { value: true }); - - this.parentStage = Stage.of(this); - - this.region = props.env?.region ?? this.parentStage?.region; - this.account = props.env?.account ?? this.parentStage?.account; - - - props.permissionsBoundary?._bind(this); - - this._assemblyBuilder = this.createBuilder(props.outdir); - this.stageName = [this.parentStage?.stageName, props.stageName ?? id].filter(x => x).join('-'); - - if (props.policyValidationBeta1) { - this.policyValidationBeta1 = props.policyValidationBeta1; - } - } - - /** - * The cloud assembly output directory. - */ - public get outdir() { - return this._assemblyBuilder.outdir; - } - - /** - * The cloud assembly asset output directory. - */ - public get assetOutdir() { - return this._assemblyBuilder.assetOutdir; - } - - /** - * Artifact ID of the assembly if it is a nested stage. The root stage (app) - * will return an empty string. - * - * Derived from the construct path. - * - */ - public get artifactId() { - if (!this.node.path) { return ''; } - return `assembly-${this.node.path.replace(/\//g, '-').replace(/^-+|-+$/g, '')}`; - } - - /** - * Synthesize this stage into a cloud assembly. - * - * Once an assembly has been synthesized, it cannot be modified. Subsequent - * calls will return the same assembly. - */ - public synth(options: StageSynthesisOptions = { }): cxapi.CloudAssembly { - if (!this.assembly || options.force) { - this.assembly = synthesize(this, { - skipValidation: options.skipValidation, - validateOnSynthesis: options.validateOnSynthesis, - }); - } - - return this.assembly; - } - - private createBuilder(outdir?: string) { - // cannot specify "outdir" if we are a nested stage - if (this.parentStage && outdir) { - throw new Error('"outdir" cannot be specified for nested stages'); - } - - // Need to determine fixed output directory already, because we must know where - // to write sub-assemblies (which must happen before we actually get to this app's - // synthesize() phase). - return this.parentStage - ? this.parentStage._assemblyBuilder.createNestedAssembly(this.artifactId, this.node.path) - : new cxapi.CloudAssemblyBuilder(outdir); - } -} - -/** - * Options for assembly synthesis. - */ -export interface StageSynthesisOptions { - /** - * Should we skip construct validation. - * @default - false - */ - readonly skipValidation?: boolean; - - /** - * Whether the stack should be validated after synthesis to check for error metadata - * - * @default - false - */ - readonly validateOnSynthesis?: boolean; - - /** - * Force a re-synth, even if the stage has already been synthesized. - * This is used by tests to allow for incremental verification of the output. - * Do not use in production. - * @default false - */ - readonly force?: boolean; -} diff --git a/packages/@aws-cdk/core/package.json b/packages/@aws-cdk/core/package.json deleted file mode 100644 index 82f98a1f04d26..0000000000000 --- a/packages/@aws-cdk/core/package.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "name": "@aws-cdk/core", - "version": "0.0.0", - "private": true, - "description": "AWS Cloud Development Kit Core Library", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.core", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "core" - } - }, - "dotnet": { - "namespace": "Amazon.CDK", - "packageId": "Amazon.CDK", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.core", - "module": "aws_cdk.core", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/core" - }, - "awslint": { - "exclude": [ - "props-physical-name:@aws-cdk/aws-cloudformation.CustomResourceProps", - "construct-ctor:@aws-cdk/core.App.", - "construct-ctor:@aws-cdk/core.Construct..params[0]", - "props-no-cfn-types:@aws-cdk/core.CfnOutputProps.condition", - "duration-prop-type:@aws-cdk/core.ResourceSignal.timeout", - "props-no-any:@aws-cdk/core.CfnParameterProps.default", - "props-no-cfn-types:@aws-cdk/core.CfnRuleProps.assertions", - "props-no-cfn-types:@aws-cdk/core.CfnCodeDeployBlueGreenHookProps.applications", - "props-no-cfn-types:@aws-cdk/core.CfnCodeDeployBlueGreenHookProps.additionalOptions", - "props-no-cfn-types:@aws-cdk/core.CfnCodeDeployBlueGreenHookProps.lifecycleEventHooks", - "props-no-cfn-types:@aws-cdk/core.CfnCodeDeployBlueGreenHookProps.trafficRoutingConfig", - "construct-ctor:@aws-cdk/core.Stack..params[1]", - "docs-public-apis:@aws-cdk/core.ScopedAws.urlSuffix", - "docs-public-apis:@aws-cdk/core.TagType.NOT_TAGGABLE", - "docs-public-apis:@aws-cdk/core.TagType.KEY_VALUE", - "docs-public-apis:@aws-cdk/core.TagType.MAP", - "docs-public-apis:@aws-cdk/core.TagType.AUTOSCALING_GROUP", - "docs-public-apis:@aws-cdk/core.Arn", - "docs-public-apis:@aws-cdk/core.Aws.ACCOUNT_ID", - "docs-public-apis:@aws-cdk/core.Aws.NO_VALUE", - "docs-public-apis:@aws-cdk/core.Aws.NOTIFICATION_ARNS", - "docs-public-apis:@aws-cdk/core.Aws.PARTITION", - "docs-public-apis:@aws-cdk/core.Aws.REGION", - "docs-public-apis:@aws-cdk/core.Aws.STACK_ID", - "docs-public-apis:@aws-cdk/core.Aws.STACK_NAME", - "docs-public-apis:@aws-cdk/core.Aws.URL_SUFFIX", - "docs-public-apis:@aws-cdk/core.ConstructNode.root", - "docs-public-apis:@aws-cdk/core.ContextProvider.getKey", - "docs-public-apis:@aws-cdk/core.ContextProvider.getValue", - "docs-public-apis:@aws-cdk/core.Lazy.anyValue", - "docs-public-apis:@aws-cdk/core.Lazy.listValue", - "docs-public-apis:@aws-cdk/core.Lazy.numberValue", - "docs-public-apis:@aws-cdk/core.Lazy.stringValue", - "docs-public-apis:@aws-cdk/core.Reference.displayName", - "docs-public-apis:@aws-cdk/core.Reference.target", - "docs-public-apis:@aws-cdk/core.ScopedAws.accountId", - "docs-public-apis:@aws-cdk/core.ScopedAws.notificationArns", - "docs-public-apis:@aws-cdk/core.ScopedAws.partition", - "docs-public-apis:@aws-cdk/core.ScopedAws.region", - "docs-public-apis:@aws-cdk/core.ScopedAws.stackId", - "docs-public-apis:@aws-cdk/core.ScopedAws.stackName", - "docs-public-apis:@aws-cdk/core.TagType.STANDARD", - "docs-public-apis:@aws-cdk/core.Stack.addDockerImageAsset", - "docs-public-apis:@aws-cdk/core.Stack.addFileAsset", - "docs-public-apis:@aws-cdk/core.TagManager.applyTagAspectHere", - "docs-public-apis:@aws-cdk/core.TokenizedStringFragments.firstValue", - "docs-public-apis:@aws-cdk/core.TokenizedStringFragments.length", - "docs-public-apis:@aws-cdk/core.TokenizedStringFragments.firstToken", - "docs-public-apis:@aws-cdk/core.TokenizedStringFragments.addIntrinsic", - "docs-public-apis:@aws-cdk/core.TokenizedStringFragments.addLiteral", - "docs-public-apis:@aws-cdk/core.TokenizedStringFragments.addToken", - "docs-public-apis:@aws-cdk/core.ValidationResult.errorMessage", - "docs-public-apis:@aws-cdk/core.ValidationResult.isSuccess", - "docs-public-apis:@aws-cdk/core.ValidationResult.results", - "docs-public-apis:@aws-cdk/core.ValidationResults.isSuccess", - "docs-public-apis:@aws-cdk/core.ValidationResults.results", - "docs-public-apis:@aws-cdk/core.ValidationResults.collect", - "docs-public-apis:@aws-cdk/core.ValidationResults.errorTreeList", - "docs-public-apis:@aws-cdk/core.ArnComponents", - "props-default-doc:@aws-cdk/core.ArnComponents.resourceName", - "docs-public-apis:@aws-cdk/core.DockerImageAssetSource", - "props-default-doc:@aws-cdk/core.EncodingOptions.displayHint", - "docs-public-apis:@aws-cdk/core.GetContextKeyOptions", - "props-default-doc:@aws-cdk/core.GetContextKeyOptions.props", - "docs-public-apis:@aws-cdk/core.GetContextKeyResult", - "docs-public-apis:@aws-cdk/core.GetContextKeyResult.key", - "docs-public-apis:@aws-cdk/core.GetContextKeyResult.props", - "docs-public-apis:@aws-cdk/core.GetContextValueOptions", - "docs-public-apis:@aws-cdk/core.GetContextValueResult", - "docs-public-apis:@aws-cdk/core.GetContextValueResult.value", - "props-default-doc:@aws-cdk/core.GetContextValueResult.value", - "docs-public-apis:@aws-cdk/core.ICfnResourceOptions", - "docs-public-apis:@aws-cdk/core.RemovalPolicyOptions", - "docs-public-apis:@aws-cdk/core.StackProps", - "docs-public-apis:@aws-cdk/core.RemovalPolicy", - "docs-public-apis:@aws-cdk/core.TagType", - "module-name:@aws-cdk/core", - "construct-ctor:@aws-cdk/core.CustomResourceProvider", - "construct-interface-extends-iconstruct:@aws-cdk/core.ICustomResourceProvider", - "props-physical-name:@aws-cdk/core.CustomResourceProps", - "integ-return-type:@aws-cdk/core.IStackSynthesizer.bind", - "integ-return-type:@aws-cdk/core.IBoundStackSynthesizer.bind", - "integ-return-type:@aws-cdk/core.IReusableStackSynthesizer.bind", - "props-no-any:@aws-cdk/core.CfnJsonProps.value" - ] - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "cfn2ts": "cfn2ts", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cfn2ts", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "cloudformation": "AWS::CloudFormation", - "cfn2ts-core-import": ".", - "pre": [ - "rm -rf test/fs/fixtures", - "cd test/fs", - "tar -xzf fixtures.tar.gz" - ], - "env": { - "AWSLINT_BASE_CONSTRUCT": "true" - } - }, - "nyc": { - "statements": 55, - "lines": 55, - "branches": 35 - }, - "ubergen": { - "exports": { - "./lib/helpers-internal": "./lib/helpers-internal/index.js" - } - }, - "keywords": [ - "aws", - "cdk", - "jsii", - "cdk-core" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/fs-extra": "^9.0.13", - "@types/jest": "^27.5.2", - "@types/lodash": "^4.14.191", - "@types/minimatch": "^3.0.5", - "aws-sdk": "^2.1329.0", - "@types/sinon": "^9.0.11", - "fast-check": "^2.25.0", - "jest": "^27.5.1", - "lodash": "^4.17.21", - "sinon": "^9.2.4", - "ts-mock-imports": "^1.3.8" - }, - "dependencies": { - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "@balena/dockerignore": "^1.0.2", - "constructs": "^10.0.0", - "fs-extra": "^9.1.0", - "ignore": "^5.2.4", - "minimatch": "^3.1.2", - "table": "^6.8.1", - "yaml": "1.10.2" - }, - "bundledDependencies": [ - "fs-extra", - "minimatch", - "@balena/dockerignore", - "ignore", - "table", - "yaml" - ], - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awscdkio": { - "announce": false - }, - "nozem": { - "ostools": [ - "rm", - "tar", - "grep", - "xargs", - "head", - "cut", - "touch", - "diff", - "echo", - "gzip" - ] - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/core/rosetta/default.ts-fixture b/packages/@aws-cdk/core/rosetta/default.ts-fixture deleted file mode 100644 index cc57d5981d90c..0000000000000 --- a/packages/@aws-cdk/core/rosetta/default.ts-fixture +++ /dev/null @@ -1,84 +0,0 @@ -import * as cfn from '@aws-cdk/aws-cloudformation'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as origins from '@aws-cdk/aws-cloudfront-origins'; -import * as customresources from '@aws-cdk/custom-resources'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as s3 from '@aws-cdk/aws-s3'; -import { - App, - Aws, - CfnCondition, - CfnDynamicReference, - CfnDynamicReferenceService, - CfnInclude, - CfnJson, - CfnMapping, - CfnOutput, - CfnParameter, - CfnResource, - CfnResourceProps, - CustomResource, - CustomResourceProvider, - CustomResourceProviderRuntime, - DefaultStackSynthesizer, - Duration, - Fn, - IConstruct, - RemovalPolicy, - SecretValue, - Size, - SizeRoundingBehavior, - Stack, - StackProps, - Stage, - Token, -} from '@aws-cdk/core'; -import { - Construct, - DependencyGroup, -} from 'constructs'; - -declare const app: App; -declare const arn: 'arn:partition:service:region:account-id:resource-id'; -declare const cfnResource: CfnResource; -declare const construct: Construct; -declare const constructA: Construct; -declare const constructB: Construct; -declare const constructC: Construct; -declare const functionProps: lambda.FunctionProps; -declare const isCompleteHandler: lambda.Function; -declare const myBucket: s3.IBucket; -declare const myFunction: lambda.IFunction; -declare const myTopic: sns.ITopic; -declare const onEventHandler: lambda.Function; -declare const resourceProps: CfnResourceProps; - -declare class MyStack extends Stack {} -declare class YourStack extends Stack {} - -class StackThatProvidesABucket extends Stack { - public readonly bucket!: s3.IBucket; -} - -interface StackThatExpectsABucketProps extends StackProps { - readonly bucket: s3.IBucket; -} - -class StackThatExpectsABucket extends Stack { - constructor(scope: Construct, id: string, props: StackThatExpectsABucketProps) { - super(scope, id, props); - } -} - -class fixture$construct extends Construct { - public constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/core/test/aspect.test.ts b/packages/@aws-cdk/core/test/aspect.test.ts deleted file mode 100644 index b431c0272a579..0000000000000 --- a/packages/@aws-cdk/core/test/aspect.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Construct, IConstruct } from 'constructs'; -import { App } from '../lib'; -import { IAspect, Aspects } from '../lib/aspect'; - -class MyConstruct extends Construct { - public static IsMyConstruct(x: any): x is MyConstruct { - return x.visitCounter !== undefined; - } - public visitCounter: number = 0; -} - -class VisitOnce implements IAspect { - public visit(node: IConstruct): void { - if (MyConstruct.IsMyConstruct(node)) { - node.visitCounter += 1; - } - } -} - -class MyAspect implements IAspect { - public visit(node: IConstruct): void { - node.node.addMetadata('foo', 'bar'); - } -} - -describe('aspect', () => { - test('Aspects are invoked only once', () => { - const app = new App(); - const root = new MyConstruct(app, 'MyConstruct'); - Aspects.of(root).add(new VisitOnce()); - app.synth(); - expect(root.visitCounter).toEqual(1); - app.synth(); - expect(root.visitCounter).toEqual(1); - }); - - test('Warn if an Aspect is added via another Aspect', () => { - const app = new App(); - const root = new MyConstruct(app, 'MyConstruct'); - const child = new MyConstruct(root, 'ChildConstruct'); - Aspects.of(root).add({ - visit(construct: IConstruct) { - Aspects.of(construct).add({ - visit(inner: IConstruct) { - inner.node.addMetadata('test', 'would-be-ignored'); - }, - }); - }, - }); - app.synth(); - expect(root.node.metadata[0].type).toEqual(cxschema.ArtifactMetadataEntryType.WARN); - expect(root.node.metadata[0].data).toEqual('We detected an Aspect was added via another Aspect, and will not be applied'); - // warning is not added to child construct - expect(child.node.metadata.length).toEqual(0); - }); - - test('Do not warn if an Aspect is added directly (not by another aspect)', () => { - const app = new App(); - const root = new MyConstruct(app, 'Construct'); - const child = new MyConstruct(root, 'ChildConstruct'); - Aspects.of(root).add(new MyAspect()); - app.synth(); - expect(root.node.metadata[0].type).toEqual('foo'); - expect(root.node.metadata[0].data).toEqual('bar'); - expect(child.node.metadata[0].type).toEqual('foo'); - expect(child.node.metadata[0].data).toEqual('bar'); - // no warning is added - expect(root.node.metadata.length).toEqual(1); - expect(child.node.metadata.length).toEqual(1); - }); -}); diff --git a/packages/@aws-cdk/core/test/assets.test.ts b/packages/@aws-cdk/core/test/assets.test.ts deleted file mode 100644 index 758f844cae30e..0000000000000 --- a/packages/@aws-cdk/core/test/assets.test.ts +++ /dev/null @@ -1,146 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; -import { toCloudFormation } from './util'; -import { App, FileAssetPackaging, Stack } from '../lib'; - -describe('assets', () => { - let app: App; - let stack: Stack; - - beforeEach(() => { - app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - stack = new Stack(app); - }); - - test('addFileAsset correctly sets metadata and creates S3 parameters', () => { - // WHEN - stack.synthesizer.addFileAsset({ - fileName: 'file-name', - packaging: FileAssetPackaging.ZIP_DIRECTORY, - sourceHash: 'source-hash', - }); - - // THEN - const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); - - expect(assetMetadata && assetMetadata.data).toBeDefined(); - - if (assetMetadata && assetMetadata.data) { - const data = assetMetadata.data as cxschema.AssetMetadataEntry; - expect(data.path).toEqual('file-name'); - expect(data.id).toEqual('source-hash'); - expect(data.packaging).toEqual(FileAssetPackaging.ZIP_DIRECTORY); - expect(data.sourceHash).toEqual('source-hash'); - } - - expect(toCloudFormation(stack)).toEqual({ - Parameters: { - AssetParameterssourcehashS3BucketE6E91E3E: { - Type: 'String', - Description: 'S3 bucket for asset "source-hash"', - }, - AssetParameterssourcehashS3VersionKeyAC4157C3: { - Type: 'String', - Description: 'S3 key for asset version "source-hash"', - }, - AssetParameterssourcehashArtifactHashADBAE418: { - Type: 'String', - Description: 'Artifact hash for asset "source-hash"', - }, - }, - }); - }); - - test('addFileAsset correctly sets object urls', () => { - // WHEN - const assetLocation = stack.synthesizer.addFileAsset({ - fileName: 'file-name', - packaging: FileAssetPackaging.ZIP_DIRECTORY, - sourceHash: 'source-hash', - }); - - // THEN - const expectedS3UrlPrefix = 's3://'; - const expectedHttpUrlPrefix = `https://s3.${stack.region}.${stack.urlSuffix}/`; - - expect( - assetLocation.s3ObjectUrl.replace(expectedS3UrlPrefix, '')).toEqual( - assetLocation.httpUrl.replace(expectedHttpUrlPrefix, ''), - ); - }); - - test('addDockerImageAsset correctly sets metadata', () => { - // WHEN - stack.synthesizer.addDockerImageAsset({ - sourceHash: 'source-hash', - directoryName: 'directory-name', - }); - - // THEN - const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); - - expect(assetMetadata && assetMetadata.data).toBeDefined(); - - if (assetMetadata && assetMetadata.data) { - const data = assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry; - expect(data.packaging).toEqual('container-image'); - expect(data.path).toEqual('directory-name'); - expect(data.sourceHash).toEqual('source-hash'); - expect(data.imageTag).toEqual('source-hash'); - } - - expect(toCloudFormation(stack)).toEqual({ }); - - }); - - test('addDockerImageAsset uses the default repository name', () => { - // WHEN - stack.synthesizer.addDockerImageAsset({ - sourceHash: 'source-hash', - directoryName: 'directory-name', - }); - - // THEN - const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); - - expect(assetMetadata && assetMetadata.data).toBeDefined(); - - if (assetMetadata && assetMetadata.data) { - const data = assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry; - expect(data.packaging).toEqual('container-image'); - expect(data.path).toEqual('directory-name'); - expect(data.sourceHash).toEqual('source-hash'); - expect(data.imageTag).toEqual('source-hash'); - } - - expect(toCloudFormation(stack)).toEqual({ }); - - }); - - test('addDockerImageAsset supports overriding repository name through a context key as a workaround until we have API for that', () => { - stack.node.setContext('assets-ecr-repository-name', 'my-custom-repo-name'); - - // WHEN - stack.synthesizer.addDockerImageAsset({ - sourceHash: 'source-hash', - directoryName: 'directory-name', - }); - - // THEN - const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); - - expect(assetMetadata && assetMetadata.data).toBeDefined(); - - if (assetMetadata && assetMetadata.data) { - const data = assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry; - expect(data.packaging).toEqual('container-image'); - expect(data.path).toEqual('directory-name'); - expect(data.sourceHash).toEqual('source-hash'); - expect(data.repositoryName).toEqual('my-custom-repo-name'); - expect(data.imageTag).toEqual('source-hash'); - } - - expect(toCloudFormation(stack)).toEqual({ }); - - }); -}); diff --git a/packages/@aws-cdk/core/test/fs/.gitignore b/packages/@aws-cdk/core/test/fs/.gitignore deleted file mode 100644 index b13de5858771b..0000000000000 --- a/packages/@aws-cdk/core/test/fs/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# codepipeline looses symlinks so we bundled fixtures into a tarball -# and unpack in pre-build script (yak) -fixtures/** diff --git a/packages/@aws-cdk/core/test/resource.test.ts b/packages/@aws-cdk/core/test/resource.test.ts deleted file mode 100644 index 8dd7f0530cfe9..0000000000000 --- a/packages/@aws-cdk/core/test/resource.test.ts +++ /dev/null @@ -1,1038 +0,0 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { toCloudFormation } from './util'; -import { - App, App as Root, CfnCondition, - CfnDeletionPolicy, CfnResource, - Fn, IResource, RemovalPolicy, Resource, Stack, -} from '../lib'; -import { synthesize } from '../lib/private/synthesis'; - -describe('resource', () => { - test('all resources derive from Resource, which derives from Entity', () => { - const stack = new Stack(); - - new CfnResource(stack, 'MyResource', { - type: 'MyResourceType', - properties: { - Prop1: 'p1', Prop2: 123, - }, - }); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - MyResource: { - Type: 'MyResourceType', - Properties: { - Prop1: 'p1', - Prop2: 123, - }, - }, - }, - }); - }); - - test('resources must reside within a Stack and fail upon creation if not', () => { - const root = new Root(); - expect(() => new CfnResource(root, 'R1', { type: 'ResourceType' })).toThrow(); - }); - - test('all entities have a logical ID calculated based on their full path in the tree', () => { - const stack = new Stack(undefined, 'TestStack'); - const level1 = new Construct(stack, 'level1'); - const level2 = new Construct(level1, 'level2'); - const level3 = new Construct(level2, 'level3'); - const res1 = new CfnResource(level1, 'childoflevel1', { type: 'MyResourceType1' }); - const res2 = new CfnResource(level3, 'childoflevel3', { type: 'MyResourceType2' }); - - expect(withoutHash(stack.resolve(res1.logicalId))).toEqual('level1childoflevel1'); - expect(withoutHash(stack.resolve(res2.logicalId))).toEqual('level1level2level3childoflevel3'); - }); - - test('resource.props can only be accessed by derived classes', () => { - const stack = new Stack(); - const res = new Counter(stack, 'MyResource', { Count: 10 }); - res.increment(); - res.increment(2); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - MyResource: { Type: 'My::Counter', Properties: { Count: 13 } }, - }, - }); - }); - - test('resource attributes can be retrieved using getAtt(s) or attribute properties', () => { - const stack = new Stack(); - const res = new Counter(stack, 'MyResource', { Count: 10 }); - - new CfnResource(stack, 'YourResource', { - type: 'Type', - properties: { - CounterName: res.getAtt('Name'), - CounterArn: res.arn, - CounterURL: res.url, - }, - }); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - MyResource: { Type: 'My::Counter', Properties: { Count: 10 } }, - YourResource: { - Type: 'Type', - Properties: { - CounterName: { 'Fn::GetAtt': ['MyResource', 'Name'] }, - CounterArn: { 'Fn::GetAtt': ['MyResource', 'Arn'] }, - CounterURL: { 'Fn::GetAtt': ['MyResource', 'URL'] }, - }, - }, - }, - }); - }); - - test('ARN-type resource attributes have some common functionality', () => { - const stack = new Stack(); - const res = new Counter(stack, 'MyResource', { Count: 1 }); - new CfnResource(stack, 'MyResource2', { - type: 'Type', - properties: { - Perm: res.arn, - }, - }); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - MyResource: { Type: 'My::Counter', Properties: { Count: 1 } }, - MyResource2: { - Type: 'Type', - Properties: { - Perm: { - 'Fn::GetAtt': ['MyResource', 'Arn'], - }, - }, - }, - }, - }); - }); - - test('resource.addDependency(e) can be used to add a DependsOn on another resource', () => { - const stack = new Stack(); - const r1 = new Counter(stack, 'Counter1', { Count: 1 }); - const r2 = new Counter(stack, 'Counter2', { Count: 1 }); - const r3 = new CfnResource(stack, 'Resource3', { type: 'MyResourceType' }); - r2.node.addDependency(r1); - r2.node.addDependency(r3); - - synthesize(stack); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Counter1: { - Type: 'My::Counter', - Properties: { Count: 1 }, - }, - Counter2: { - Type: 'My::Counter', - Properties: { Count: 1 }, - DependsOn: [ - 'Counter1', - 'Resource3', - ], - }, - Resource3: { Type: 'MyResourceType' }, - }, - }); - }); - - test('if addDependency is called multiple times with the same resource, it will only appear once', () => { - // GIVEN - const stack = new Stack(); - const r1 = new Counter(stack, 'Counter1', { Count: 1 }); - const dependent = new CfnResource(stack, 'Dependent', { type: 'R' }); - - // WHEN - dependent.addDependency(r1); - dependent.addDependency(r1); - dependent.addDependency(r1); - dependent.addDependency(r1); - dependent.addDependency(r1); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Counter1: { - Type: 'My::Counter', - Properties: { - Count: 1, - }, - }, - Dependent: { - Type: 'R', - DependsOn: [ - 'Counter1', - ], - }, - }, - }); - }); - - test('conditions can be attached to a resource', () => { - const stack = new Stack(); - const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); - const cond = new CfnCondition(stack, 'MyCondition', { expression: Fn.conditionNot(Fn.conditionEquals('a', 'b')) }); - r1.cfnOptions.condition = cond; - - expect(toCloudFormation(stack)).toEqual({ - Resources: { Resource: { Type: 'Type', Condition: 'MyCondition' } }, - Conditions: { MyCondition: { 'Fn::Not': [{ 'Fn::Equals': ['a', 'b'] }] } }, - }); - }); - - test('creation/update/updateReplace/deletion policies can be set on a resource', () => { - const stack = new Stack(); - const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); - - r1.cfnOptions.creationPolicy = { - autoScalingCreationPolicy: { minSuccessfulInstancesPercent: 10 }, - startFleet: true, - }; - // eslint-disable-next-line max-len - r1.cfnOptions.updatePolicy = { - autoScalingScheduledAction: { ignoreUnmodifiedGroupSizeProperties: false }, - autoScalingReplacingUpdate: { willReplace: true }, - codeDeployLambdaAliasUpdate: { - applicationName: 'CodeDeployApplication', - deploymentGroupName: 'CodeDeployDeploymentGroup', - beforeAllowTrafficHook: 'lambda1', - }, - }; - r1.cfnOptions.deletionPolicy = CfnDeletionPolicy.RETAIN; - r1.cfnOptions.updateReplacePolicy = CfnDeletionPolicy.SNAPSHOT; - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Resource: { - Type: 'Type', - CreationPolicy: { - AutoScalingCreationPolicy: { MinSuccessfulInstancesPercent: 10 }, - StartFleet: true, - }, - UpdatePolicy: { - AutoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: false }, - AutoScalingReplacingUpdate: { WillReplace: true }, - CodeDeployLambdaAliasUpdate: { - ApplicationName: 'CodeDeployApplication', - DeploymentGroupName: 'CodeDeployDeploymentGroup', - BeforeAllowTrafficHook: 'lambda1', - }, - }, - DeletionPolicy: 'Retain', - UpdateReplacePolicy: 'Snapshot', - }, - }, - }); - }); - - test('update policies UseOnlineResharding flag', () => { - const stack = new Stack(); - const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); - - r1.cfnOptions.updatePolicy = { useOnlineResharding: true }; - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Resource: { - Type: 'Type', - UpdatePolicy: { - UseOnlineResharding: true, - }, - }, - }, - }); - }); - - test('metadata can be set on a resource', () => { - const stack = new Stack(); - const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); - - r1.cfnOptions.metadata = { - MyKey: 10, - MyValue: 99, - }; - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Resource: { - Type: 'Type', - Metadata: { - MyKey: 10, - MyValue: 99, - }, - }, - }, - }); - }); - - test('the "type" property is required when creating a resource', () => { - const stack = new Stack(); - expect(() => new CfnResource(stack, 'Resource', { notypehere: true } as any)).toThrow(); - }); - - test('removal policy is a high level abstraction of deletion policy used by l2', () => { - const stack = new Stack(); - - const retain = new CfnResource(stack, 'Retain', { type: 'T1' }); - const destroy = new CfnResource(stack, 'Destroy', { type: 'T3' }); - const def = new CfnResource(stack, 'Default1', { type: 'T4' }); - const def2 = new CfnResource(stack, 'Default2', { type: 'T4' }); - - retain.applyRemovalPolicy(RemovalPolicy.RETAIN); - destroy.applyRemovalPolicy(RemovalPolicy.DESTROY); - def.applyRemovalPolicy(undefined, { default: RemovalPolicy.DESTROY }); - def2.applyRemovalPolicy(undefined); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Retain: { Type: 'T1', DeletionPolicy: 'Retain', UpdateReplacePolicy: 'Retain' }, - Destroy: { Type: 'T3', DeletionPolicy: 'Delete', UpdateReplacePolicy: 'Delete' }, - Default1: { Type: 'T4', DeletionPolicy: 'Delete', UpdateReplacePolicy: 'Delete' }, // explicit default - Default2: { Type: 'T4', DeletionPolicy: 'Retain', UpdateReplacePolicy: 'Retain' }, // implicit default - }, - }); - }); - - test('applyRemovalPolicy available for interface resources', () => { - class Child extends Resource { - constructor(scope: Construct, id: string) { - super(scope, id); - - new CfnResource(this, 'Resource', { - type: 'ChildResourceType', - }); - } - } - - const stack = new Stack(); - const child: IResource = new Child(stack, 'Child'); - - child.applyRemovalPolicy(RemovalPolicy.RETAIN); - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - ChildDAB30558: { - DeletionPolicy: 'Retain', - Type: 'ChildResourceType', - UpdateReplacePolicy: 'Retain', - }, - }, - }); - }); - - test('addDependency adds all dependencyElements of dependent constructs', () => { - - class C1 extends Construct { - public readonly r1: CfnResource; - public readonly r2: CfnResource; - - constructor(scope: Construct, id: string) { - super(scope, id); - - this.r1 = new CfnResource(this, 'R1', { type: 'T1' }); - this.r2 = new CfnResource(this, 'R2', { type: 'T2' }); - } - } - - class C2 extends Construct { - public readonly r3: CfnResource; - - constructor(scope: Construct, id: string) { - super(scope, id); - - this.r3 = new CfnResource(this, 'R3', { type: 'T3' }); - } - } - - // C3 returns [ c2 ] for it's dependency elements - // this should result in 'flattening' the list of elements. - class C3 extends Construct { - constructor(scope: Construct, id: string) { - super(scope, id); - - new C2(this, 'C2'); - } - } - - const stack = new Stack(); - const c1 = new C1(stack, 'MyC1'); - const c2 = new C2(stack, 'MyC2'); - const c3 = new C3(stack, 'MyC3'); - - const dependingResource = new CfnResource(stack, 'MyResource', { type: 'R' }); - dependingResource.node.addDependency(c1, c2); - dependingResource.node.addDependency(c3); - - synthesize(stack); - - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyC1R1FB2A562F: { Type: 'T1' }, - MyC1R2AE2B5066: { Type: 'T2' }, - MyC2R3809EEAD6: { Type: 'T3' }, - MyC3C2R38CE6F9F7: { Type: 'T3' }, - MyResource: - { - Type: 'R', - DependsOn: - ['MyC1R1FB2A562F', - 'MyC1R2AE2B5066', - 'MyC2R3809EEAD6', - 'MyC3C2R38CE6F9F7'], - }, - }, - }); - }); - - test('resource.ref returns the {Ref} token', () => { - const stack = new Stack(); - const r = new CfnResource(stack, 'MyResource', { type: 'R' }); - - expect(stack.resolve(r.ref)).toEqual({ Ref: 'MyResource' }); - }); - - describe('overrides', () => { - test('addOverride(p, v) allows assigning arbitrary values to synthesized resource definitions', () => { - // GIVEN - const stack = new Stack(); - const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); - - // WHEN - r.addOverride('Type', 'YouCanEvenOverrideTheType'); - r.addOverride('Metadata', { Key: 12 }); - r.addOverride('Use.Dot.Notation', 'To create subtrees'); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'YouCanEvenOverrideTheType', - Use: { Dot: { Notation: 'To create subtrees' } }, - Metadata: { Key: 12 }, - }, - }, - }); - }); - - test('addPropertyOverride() allows assigning an attribute of a different resource', () => { - // GIVEN - const stack = new Stack(); - const r1 = new CfnResource(stack, 'MyResource1', { type: 'AWS::Resource::Type' }); - const r2 = new CfnResource(stack, 'MyResource2', { type: 'AWS::Resource::Type' }); - - // WHEN - r2.addPropertyOverride('A', { - B: r1.getAtt('Arn'), - }); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: { - MyResource1: { - Type: 'AWS::Resource::Type', - }, - MyResource2: { - Type: 'AWS::Resource::Type', - Properties: { - A: { - B: { 'Fn::GetAtt': ['MyResource1', 'Arn'] }, - }, - }, - }, - }, - }); - }); - - test('addOverride(p, null) will assign an "null" value', () => { - // GIVEN - const stack = new Stack(); - - const r = new CfnResource(stack, 'MyResource', { - type: 'AWS::Resource::Type', - properties: { - Hello: { - World: { - Value1: 'Hello', - Value2: 129, - }, - }, - }, - }); - - // WHEN - r.addOverride('Properties.Hello.World.Value2', null); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: { Hello: { World: { Value1: 'Hello', Value2: null } } }, - }, - }, - }); - }); - - test('addOverride(p, undefined) can be used to delete a value', () => { - // GIVEN - const stack = new Stack(); - - const r = new CfnResource(stack, 'MyResource', { - type: 'AWS::Resource::Type', - properties: { - Hello: { - World: { - Value1: 'Hello', - Value2: 129, - }, - }, - }, - }); - - // WHEN - r.addOverride('Properties.Hello.World.Value2', undefined); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: { Hello: { World: { Value1: 'Hello' } } }, - }, - }, - }); - }); - - test('addOverride(p, undefined) will not create empty trees', () => { - // GIVEN - const stack = new Stack(); - - const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); - - // WHEN - r.addPropertyOverride('Tree.Exists', 42); - r.addPropertyOverride('Tree.Does.Not.Exist', undefined); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: { Tree: { Exists: 42 } }, - }, - }, - }); - }); - - test('addDeletionOverride(p) and addPropertyDeletionOverride(pp) are sugar for `undefined`', () => { - // GIVEN - const stack = new Stack(); - - const r = new CfnResource(stack, 'MyResource', { - type: 'AWS::Resource::Type', - properties: { - Hello: { - World: { - Value1: 'Hello', - Value2: 129, - Value3: ['foo', 'bar'], - }, - }, - }, - }); - - // WHEN - r.addDeletionOverride('Properties.Hello.World.Value2'); - r.addPropertyDeletionOverride('Hello.World.Value3'); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: { Hello: { World: { Value1: 'Hello' } } }, - }, - }, - }); - }); - - test('addOverride(p, v) will overwrite any non-objects along the path', () => { - // GIVEN - const stack = new Stack(); - const r = new CfnResource(stack, 'MyResource', { - type: 'AWS::Resource::Type', - properties: { - Hello: { - World: 42, - }, - }, - }); - - // WHEN - r.addOverride('Properties.Override1', ['Hello', 123]); - r.addOverride('Properties.Override1.Override2', { Heyy: [1] }); - r.addOverride('Properties.Hello.World.Foo.Bar', 42); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: - { - Hello: { World: { Foo: { Bar: 42 } } }, - Override1: { - Override2: { Heyy: [1] }, - }, - }, - }, - }, - }); - }); - - test('addOverride(p, v) will not split on escaped dots', () => { - // GIVEN - const stack = new Stack(); - const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); - - // WHEN - r.addOverride(String.raw`Properties.Hello\.World.Foo\.Bar\.Baz`, 42); - r.addOverride(String.raw`Properties.Single\Back\Slashes`, 42); - r.addOverride(String.raw`Properties.Escaped\\.Back\\.Slashes`, 42); - r.addOverride(String.raw`Properties.DoublyEscaped\\\\Back\\\\Slashes`, 42); - r.addOverride('Properties.EndWith\\', 42); // Raw string cannot end with a backslash - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: - { - 'Hello.World': { 'Foo.Bar.Baz': 42 }, - 'SingleBackSlashes': 42, - 'Escaped\\': { 'Back\\': { Slashes: 42 } }, - 'DoublyEscaped\\\\Back\\\\Slashes': 42, - 'EndWith\\': 42, - }, - }, - }, - }); - }); - - test('addPropertyOverride(pp, v) is a sugar for overriding properties', () => { - // GIVEN - const stack = new Stack(); - const r = new CfnResource(stack, 'MyResource', { - type: 'AWS::Resource::Type', - properties: { Hello: { World: 42 } }, - }); - - // WHEN - r.addPropertyOverride('Hello.World', { Hey: 'Jude' }); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'AWS::Resource::Type', - Properties: { Hello: { World: { Hey: 'Jude' } } }, - }, - }, - }); - }); - - test('overrides are applied after render', () => { - // GIVEN - class MyResource extends CfnResource { - public renderProperties() { - return { Fixed: 123 }; - } - } - const stack = new Stack(); - const cfn = new MyResource(stack, 'rr', { type: 'AWS::Resource::Type' }); - - // WHEN - cfn.addPropertyOverride('Boom', 'Hi'); - cfn.addOverride('Properties.Foo.Bar', 'Bar'); - - // THEN - expect(toCloudFormation(stack)).toEqual({ - Resources: { - rr: { - Type: 'AWS::Resource::Type', - Properties: { - Fixed: 123, - Boom: 'Hi', - Foo: { - Bar: 'Bar', - }, - }, - }, - }, - }); - }); - - test('overrides allow overriding one intrinsic with another', () => { - // GIVEN - const stack = new Stack(); - - const resource = new CfnResource(stack, 'MyResource', { - type: 'MyResourceType', - properties: { - prop1: Fn.ref('Param'), - }, - }); - - // WHEN - resource.addPropertyOverride('prop1', Fn.join('-', ['hello', Fn.ref('Param')])); - const cfn = toCloudFormation(stack); - - // THEN - expect(cfn.Resources.MyResource).toEqual({ - Type: 'MyResourceType', - Properties: { - prop1: { - 'Fn::Join': [ - '-', - [ - 'hello', - { - Ref: 'Param', - }, - ], - ], - }, - }, - }); - }); - - test('Can override a an object with an intrinsic', () => { - // GIVEN - const stack = new Stack(); - - const condition = new CfnCondition(stack, 'MyCondition', { - expression: Fn.conditionEquals('us-east-1', 'us-east-1'), - }); - const resource = new CfnResource(stack, 'MyResource', { - type: 'MyResourceType', - properties: { - prop1: { - subprop: { - name: Fn.getAtt('resource', 'abc'), - }, - }, - }, - }); - const isEnabled = Fn.conditionIf(condition.logicalId, { - Ref: 'AWS::NoValue', - }, { - name: Fn.getAtt('resource', 'abc'), - }); - - // WHEN - resource.addPropertyOverride('prop1.subprop', isEnabled); - const cfn = toCloudFormation(stack); - - // THEN - expect(cfn.Resources.MyResource).toEqual({ - Type: 'MyResourceType', - Properties: { - prop1: { - subprop: { - 'Fn::If': [ - 'MyCondition', - { - Ref: 'AWS::NoValue', - }, - { - name: { - 'Fn::GetAtt': [ - 'resource', - 'abc', - ], - }, - }, - ], - }, - }, - }, - }); - }); - - test('overrides allow overriding a nested intrinsic', () => { - // GIVEN - const stack = new Stack(); - - const resource = new CfnResource(stack, 'MyResource', { - type: 'MyResourceType', - properties: { - prop1: Fn.importValue(Fn.sub('${Sub}', { Sub: 'Value' })), - }, - }); - - // WHEN - resource.addPropertyOverride('prop1', Fn.importValue(Fn.join('-', ['abc', Fn.sub('${Sub}', { Sub: 'Value' })]))); - const cfn = toCloudFormation(stack); - - // THEN - expect(cfn.Resources.MyResource).toEqual({ - Type: 'MyResourceType', - Properties: { - prop1: { - 'Fn::ImportValue': { - 'Fn::Join': [ - '-', - [ - 'abc', - { - 'Fn::Sub': ['${Sub}', { Sub: 'Value' }], - }, - ], - ], - }, - }, - }, - }); - }); - - describe('using mutable properties', () => { - test('can be used by derived classes to specify overrides before render()', () => { - const stack = new Stack(); - - const r = new CustomizableResource(stack, 'MyResource', { - prop1: 'foo', - }); - - r.prop2 = 'bar'; - - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'MyResourceType', - Properties: { PROP1: 'foo', PROP2: 'bar' }, - }, - }, - }); - }); - - test('"properties" is undefined', () => { - const stack = new Stack(); - - const r = new CustomizableResource(stack, 'MyResource'); - - r.prop3 = 'zoo'; - - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'MyResourceType', - Properties: { PROP3: 'zoo' }, - }, - }, - }); - }); - - test('"properties" is empty', () => { - const stack = new Stack(); - - const r = new CustomizableResource(stack, 'MyResource', { }); - - r.prop3 = 'zoo'; - r.prop2 = 'hey'; - - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - MyResource: - { - Type: 'MyResourceType', - Properties: { PROP2: 'hey', PROP3: 'zoo' }, - }, - }, - }); - }); - }); - }); - - test('"aws:cdk:path" metadata is added if "aws:cdk:path-metadata" context is set to true', () => { - const stack = new Stack(); - stack.node.setContext(cxapi.PATH_METADATA_ENABLE_CONTEXT, true); - - const parent = new Construct(stack, 'Parent'); - - new CfnResource(parent, 'MyResource', { - type: 'MyResourceType', - }); - - expect(toCloudFormation(stack)).toEqual({ - Resources: - { - ParentMyResource4B1FDBCC: - { - Type: 'MyResourceType', - Metadata: { [cxapi.PATH_METADATA_KEY]: 'Default/Parent/MyResource' }, - }, - }, - }); - }); - - test('cross-stack construct dependencies are not rendered but turned into stack dependencies', () => { - // GIVEN - const app = new App(); - const stackA = new Stack(app, 'StackA'); - const resA = new CfnResource(stackA, 'Resource', { type: 'R' }); - const stackB = new Stack(app, 'StackB'); - const resB = new CfnResource(stackB, 'Resource', { type: 'R' }); - - // WHEN - resB.node.addDependency(resA); - - // THEN - const assembly = app.synth(); - const templateB = assembly.getStackByName(stackB.stackName).template; - - expect(templateB?.Resources?.Resource).toEqual({ - Type: 'R', - // Notice absence of 'DependsOn' - }); - expect(stackB.dependencies.map(s => s.node.id)).toEqual(['StackA']); - }); - - test('enableVersionUpgrade can be set on a resource', () => { - const stack = new Stack(); - const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); - - r1.cfnOptions.updatePolicy = { - enableVersionUpgrade: true, - }; - - expect(toCloudFormation(stack)).toEqual({ - Resources: { - Resource: { - Type: 'Type', - UpdatePolicy: { - EnableVersionUpgrade: true, - }, - }, - }, - }); - }); -}); - -test('Resource can get account and Region from ARN', () => { - const stack = new Stack(); - - // WHEN - const resource = new TestResource(stack, 'Resource', { - environmentFromArn: 'arn:partition:service:region:account:relative-id', - }); - - // THEN - expect(resource.env.account).toEqual('account'); - expect(resource.env.region).toEqual('region'); -}); - -interface CounterProps { - Count: number; -} - -class Counter extends CfnResource { - public readonly arn: string; - public readonly url: string; - - public count: number; - - constructor(scope: Construct, id: string, props: CounterProps) { - super(scope, id, { type: 'My::Counter', properties: { Count: props.Count } }); - this.arn = this.getAtt('Arn').toString(); - this.url = this.getAtt('URL').toString(); - this.count = props.Count; - } - - public increment(by = 1) { - this.count += by; - } - - protected get cfnProperties(): { [key: string]: any } { - return { Count: this.count }; - } -} - -function withoutHash(logId: string) { - return logId.slice(0, -8); -} - -class CustomizableResource extends CfnResource { - public prop1: any; - public prop2: any; - public prop3: any; - - constructor(scope: Construct, id: string, props?: any) { - super(scope, id, { type: 'MyResourceType', properties: props }); - if (props !== undefined) { - this.prop1 = props.prop1; - this.prop2 = props.prop2; - this.prop3 = props.prop3; - } - } - - public renderProperties(): { [key: string]: any } { - const props = this.updatedProperties; - const render: { [key: string]: any } = {}; - for (const key of Object.keys(props)) { - render[key.toUpperCase()] = props[key]; - } - return render; - } - - protected get updatedProperties(): { [key: string]: any } { - const props: { [key: string]: any } = { - prop1: this.prop1, - prop2: this.prop2, - prop3: this.prop3, - }; - const cleanProps: { [key: string]: any } = { }; - for (const key of Object.keys(props)) { - if (props[key] === undefined) { - continue; - } - cleanProps[key] = props[key]; - } - return cleanProps; - } -} - -/** - * Because Resource is abstract - */ -class TestResource extends Resource {} diff --git a/packages/@aws-cdk/core/test/stage.test.ts b/packages/@aws-cdk/core/test/stage.test.ts deleted file mode 100644 index 41e604a212182..0000000000000 --- a/packages/@aws-cdk/core/test/stage.test.ts +++ /dev/null @@ -1,332 +0,0 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct, IConstruct } from 'constructs'; -import { App, CfnResource, IAspect, Stack, Stage, Aspects } from '../lib'; - -describe('stage', () => { - test('Stack inherits unspecified part of the env from Stage', () => { - // GIVEN - const app = new App(); - const stage = new Stage(app, 'Stage', { - env: { account: 'account', region: 'region' }, - }); - - // WHEN - const stack1 = new Stack(stage, 'Stack1', { env: { region: 'elsewhere' } }); - const stack2 = new Stack(stage, 'Stack2', { env: { account: 'tnuocca' } }); - - // THEN - expect(acctRegion(stack1)).toEqual(['account', 'elsewhere']); - expect(acctRegion(stack2)).toEqual(['tnuocca', 'region']); - }); - - test('envs are inherited deeply', () => { - // GIVEN - const app = new App(); - const outer = new Stage(app, 'Stage', { - env: { account: 'account', region: 'region' }, - }); - - // WHEN - const innerAcct = new Stage(outer, 'Acct', { env: { account: 'tnuocca' } }); - const innerRegion = new Stage(outer, 'Rgn', { env: { region: 'elsewhere' } }); - const innerNeither = new Stage(outer, 'Neither'); - - // THEN - expect(acctRegion(new Stack(innerAcct, 'Stack'))).toEqual(['tnuocca', 'region']); - expect(acctRegion(new Stack(innerRegion, 'Stack'))).toEqual(['account', 'elsewhere']); - expect(acctRegion(new Stack(innerNeither, 'Stack'))).toEqual(['account', 'region']); - }); - - test('The Stage Assembly is in the app Assembly\'s manifest', () => { - // WHEN - const app = new App(); - const stage = new Stage(app, 'Stage'); - new BogusStack(stage, 'Stack2'); - - // THEN -- app manifest contains a nested cloud assembly - const appAsm = app.synth(); - - const artifact = appAsm.artifacts.find(x => x instanceof cxapi.NestedCloudAssemblyArtifact); - expect(artifact).toBeDefined(); - }); - - test('Stacks in Stage are in a different cxasm than Stacks in App', () => { - // WHEN - const app = new App(); - const stack1 = new BogusStack(app, 'Stack1'); - const stage = new Stage(app, 'Stage'); - const stack2 = new BogusStack(stage, 'Stack2'); - - // THEN - const stageAsm = stage.synth(); - expect(stageAsm.stacks.map(s => s.stackName)).toEqual([stack2.stackName]); - - const appAsm = app.synth(); - expect(appAsm.stacks.map(s => s.stackName)).toEqual([stack1.stackName]); - }); - - test('Can nest Stages inside other Stages', () => { - // WHEN - const app = new App(); - const outer = new Stage(app, 'Outer'); - const inner = new Stage(outer, 'Inner'); - const stack = new BogusStack(inner, 'Stack'); - - // WHEN - const appAsm = app.synth(); - const outerAsm = appAsm.getNestedAssembly(outer.artifactId); - const innerAsm = outerAsm.getNestedAssembly(inner.artifactId); - - expect(innerAsm.tryGetArtifact(stack.artifactId)).toBeDefined(); - }); - - test('Default stack name in Stage objects incorporates the Stage name and no hash', () => { - // WHEN - const app = new App(); - const stage = new Stage(app, 'MyStage'); - const stack = new BogusStack(stage, 'MyStack'); - - // THEN - expect(stage.stageName).toEqual('MyStage'); - expect(stack.stackName).toEqual('MyStage-MyStack'); - }); - - test('can override the stage name', () => { - // WHEN - const app = new App(); - const stage = new Stage(app, 'NotMyStageName', { stageName: 'MyStage' }); - const stack = new BogusStack(stage, 'MyStack'); - - // THEN - expect(stage.stageName).toEqual('MyStage'); - expect(stack.stackName).toEqual('MyStage-MyStack'); - }); - - test('Can not have dependencies to stacks outside the nested asm', () => { - // GIVEN - const app = new App(); - const stack1 = new BogusStack(app, 'Stack1'); - const stage = new Stage(app, 'MyStage'); - const stack2 = new BogusStack(stage, 'Stack2'); - - // WHEN - expect(() => { - stack2.addDependency(stack1); - }).toThrow(/dependency cannot cross stage boundaries/); - }); - - test('When we synth() a stage, aspects inside it must have been applied', () => { - // GIVEN - const app = new App(); - const stage = new Stage(app, 'MyStage'); - const stack = new BogusStack(stage, 'Stack'); - - // WHEN - const aspect = new TouchingAspect(); - Aspects.of(stack).add(aspect); - - // THEN - app.synth(); - expect(aspect.visits.map(c => c.node.path)).toEqual([ - 'MyStage/Stack', - 'MyStage/Stack/Resource', - ]); - }); - - test('Aspects do not apply inside a Stage', () => { - // GIVEN - const app = new App(); - const stage = new Stage(app, 'MyStage'); - new BogusStack(stage, 'Stack'); - - // WHEN - const aspect = new TouchingAspect(); - Aspects.of(app).add(aspect); - - // THEN - app.synth(); - expect(aspect.visits.map(c => c.node.path)).toEqual([ - '', - 'Tree', - ]); - }); - - test('Automatic dependencies inside a stage are available immediately after synth', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stage = new Stage(app, 'MyStage'); - const stack1 = new Stack(stage, 'Stack1'); - const stack2 = new Stack(stage, 'Stack2'); - - // WHEN - const resource1 = new CfnResource(stack1, 'Resource', { - type: 'CDK::Test::Resource', - }); - new CfnResource(stack2, 'Resource', { - type: 'CDK::Test::Resource', - properties: { - OtherThing: resource1.ref, - }, - }); - - const asm = stage.synth(); - - // THEN - expect( - asm.getStackArtifact(stack2.artifactId).dependencies.map(d => d.id)).toEqual( - [stack1.artifactId]); - }); - - test('Assemblies can be deeply nested', () => { - // GIVEN - const app = new App({ treeMetadata: false }); - - const level1 = new Stage(app, 'StageLevel1'); - const level2 = new Stage(level1, 'StageLevel2'); - new Stage(level2, 'StageLevel3'); - - // WHEN - const rootAssembly = app.synth(); - - // THEN - expect(rootAssembly.manifest.artifacts).toEqual({ - 'assembly-StageLevel1': { - type: 'cdk:cloud-assembly', - properties: { - directoryName: 'assembly-StageLevel1', - displayName: 'StageLevel1', - }, - }, - }); - - const assemblyLevel1 = rootAssembly.getNestedAssembly('assembly-StageLevel1'); - expect(assemblyLevel1.manifest.artifacts).toEqual({ - 'assembly-StageLevel1-StageLevel2': { - type: 'cdk:cloud-assembly', - properties: { - directoryName: 'assembly-StageLevel1-StageLevel2', - displayName: 'StageLevel1/StageLevel2', - }, - }, - }); - - const assemblyLevel2 = assemblyLevel1.getNestedAssembly('assembly-StageLevel1-StageLevel2'); - expect(assemblyLevel2.manifest.artifacts).toEqual({ - 'assembly-StageLevel1-StageLevel2-StageLevel3': { - type: 'cdk:cloud-assembly', - properties: { - directoryName: 'assembly-StageLevel1-StageLevel2-StageLevel3', - displayName: 'StageLevel1/StageLevel2/StageLevel3', - }, - }, - }); - }); - - test('stage name validation', () => { - const app = new App(); - - new Stage(app, 'abcd'); - new Stage(app, 'abcd123'); - new Stage(app, 'abcd123-588dfjjk'); - new Stage(app, 'abcd123-588dfjjk.sss'); - new Stage(app, 'abcd123-588dfjjk.sss_ajsid'); - - expect(() => new Stage(app, 'abcd123-588dfjjk.sss_ajsid ')).toThrow(/invalid stage name "abcd123-588dfjjk.sss_ajsid "/); - expect(() => new Stage(app, 'abcd123-588dfjjk.sss_ajsid/dfo')).toThrow(/invalid stage name "abcd123-588dfjjk.sss_ajsid\/dfo"/); - expect(() => new Stage(app, '&')).toThrow(/invalid stage name "&"/); - expect(() => new Stage(app, '45hello')).toThrow(/invalid stage name "45hello"/); - expect(() => new Stage(app, 'f')).toThrow(/invalid stage name "f"/); - }); - - test('outdir cannot be specified for nested stages', () => { - // WHEN - const app = new App(); - - // THEN - expect(() => new Stage(app, 'mystage', { outdir: '/tmp/foo/bar' })).toThrow(/"outdir" cannot be specified for nested stages/); - }); - - test('Stage.isStage indicates that a construct is a stage', () => { - // WHEN - const app = new App(); - const stack = new Stack(); - const stage = new Stage(app, 'Stage'); - - // THEN - expect(Stage.isStage(stage)).toEqual(true); - expect(Stage.isStage(app)).toEqual(true); - expect(Stage.isStage(stack)).toEqual(false); - }); - - test('Stage.isStage indicates that a construct is a stage based on symbol', () => { - // WHEN - const app = new App(); - const stage = new Stage(app, 'Stage'); - - const externalStage = {}; - const STAGE_SYMBOL = Symbol.for('@aws-cdk/core.Stage'); - Object.defineProperty(externalStage, STAGE_SYMBOL, { value: true }); - - // THEN - expect(Stage.isStage(stage)).toEqual(true); - expect(Stage.isStage(app)).toEqual(true); - expect(Stage.isStage(externalStage)).toEqual(true); - }); -}); - -test('missing context in Stages is propagated up to root assembly', () => { - // GIVEN - const app = new App(); - const stage = new Stage(app, 'Stage', { - env: { account: 'account', region: 'region' }, - }); - const stack = new Stack(stage, 'Stack'); - new CfnResource(stack, 'Resource', { type: 'Something' }); - - // WHEN - stack.reportMissingContextKey({ - key: 'missing-context-key', - provider: cxschema.ContextProvider.AVAILABILITY_ZONE_PROVIDER, - props: { - account: 'account', - region: 'region', - }, - }); - - // THEN - const assembly = app.synth(); - - expect(assembly.manifest.missing).toEqual([ - { - key: 'missing-context-key', - provider: cxschema.ContextProvider.AVAILABILITY_ZONE_PROVIDER, - props: { - account: 'account', - lookupRoleArn: 'arn:${AWS::Partition}:iam::account:role/cdk-hnb659fds-lookup-role-account-region', - region: 'region', - }, - }, - ]); -}); - -class TouchingAspect implements IAspect { - public readonly visits = new Array(); - public visit(node: IConstruct): void { - this.visits.push(node); - } -} - -class BogusStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - new CfnResource(this, 'Resource', { - type: 'CDK::Test::Resource', - }); - } -} - -function acctRegion(s: Stack) { - return [s.account, s.region]; -} diff --git a/packages/@aws-cdk/core/test/staging.test.ts b/packages/@aws-cdk/core/test/staging.test.ts deleted file mode 100644 index cbde1eaf0fc26..0000000000000 --- a/packages/@aws-cdk/core/test/staging.test.ts +++ /dev/null @@ -1,1348 +0,0 @@ -import * as os from 'os'; -import * as path from 'path'; -import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { FileAssetPackaging } from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as fs from 'fs-extra'; -import * as sinon from 'sinon'; -import { App, AssetHashType, AssetStaging, DockerImage, BundlingOptions, BundlingOutput, FileSystem, Stack, Stage, BundlingFileAccess } from '../lib'; - -const STUB_INPUT_FILE = '/tmp/docker-stub.input'; -const STUB_INPUT_CONCAT_FILE = '/tmp/docker-stub.input.concat'; - -const STUB_INPUT_CP_FILE = '/tmp/docker-stub-cp.input'; -const STUB_INPUT_CP_CONCAT_FILE = '/tmp/docker-stub-cp.input.concat'; - -enum DockerStubCommand { - SUCCESS = 'DOCKER_STUB_SUCCESS', - FAIL = 'DOCKER_STUB_FAIL', - SUCCESS_NO_OUTPUT = 'DOCKER_STUB_SUCCESS_NO_OUTPUT', - MULTIPLE_FILES = 'DOCKER_STUB_MULTIPLE_FILES', - SINGLE_ARCHIVE = 'DOCKER_STUB_SINGLE_ARCHIVE', - VOLUME_SINGLE_ARCHIVE = 'DOCKER_STUB_VOLUME_SINGLE_ARCHIVE', -} - -const FIXTURE_TEST1_DIR = path.join(__dirname, 'fs', 'fixtures', 'test1'); -const FIXTURE_TEST1_HASH = '2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'; -const FIXTURE_TARBALL = path.join(__dirname, 'fs', 'fixtures.tar.gz'); -const NOT_ARCHIVED_ZIP_TXT_HASH = '95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df'; -const ARCHIVE_TARBALL_TEST_HASH = '3e948ff54a277d6001e2452fdbc4a9ef61f916ff662ba5e05ece1e2ec6dec9f5'; - -const userInfo = os.userInfo(); -const USER_ARG = `-u ${userInfo.uid}:${userInfo.gid}`; - - -describe('staging', () => { - beforeAll(() => { - // this is a way to provide a custom "docker" command for staging. - process.env.CDK_DOCKER = `${__dirname}/docker-stub.sh`; - }); - - afterAll(() => { - delete process.env.CDK_DOCKER; - }); - - afterEach(() => { - AssetStaging.clearAssetHashCache(); - if (fs.existsSync(STUB_INPUT_FILE)) { - fs.unlinkSync(STUB_INPUT_FILE); - } - if (fs.existsSync(STUB_INPUT_CONCAT_FILE)) { - fs.unlinkSync(STUB_INPUT_CONCAT_FILE); - } - sinon.restore(); - }); - - test('base case', () => { - // GIVEN - const stack = new Stack(); - const sourcePath = FIXTURE_TEST1_DIR; - - // WHEN - const staging = new AssetStaging(stack, 's1', { sourcePath }); - - expect(staging.assetHash).toEqual(FIXTURE_TEST1_HASH); - expect(staging.sourcePath).toEqual(sourcePath); - expect(path.basename(staging.absoluteStagedPath)).toEqual(`asset.${FIXTURE_TEST1_HASH}`); - expect(path.basename(staging.relativeStagedPath(stack))).toEqual(`asset.${FIXTURE_TEST1_HASH}`); - expect(staging.packaging).toEqual(FileAssetPackaging.ZIP_DIRECTORY); - expect(staging.isArchive).toEqual(true); - }); - - test('base case if source directory is a symlink', () => { - // GIVEN - const stack = new Stack(); - const sourcePath = path.join(os.tmpdir(), 'asset-symlink'); - if (fs.existsSync(sourcePath)) { fs.unlinkSync(sourcePath); } - fs.symlinkSync(FIXTURE_TEST1_DIR, sourcePath); - - try { - const staging = new AssetStaging(stack, 's1', { sourcePath }); - - // Should be the same asset hash as in the previous test - expect(staging.assetHash).toEqual(FIXTURE_TEST1_HASH); - } finally { - if (fs.existsSync(sourcePath)) { - fs.unlinkSync(sourcePath); - } - } - }); - - test('staging of an archive file correctly sets packaging and isArchive', () => { - // GIVEN - const stack = new Stack(); - const sourcePath = path.join(__dirname, 'archive', 'archive.zip'); - - // WHEN - const staging = new AssetStaging(stack, 's1', { sourcePath }); - - expect(staging.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging.isArchive).toEqual(true); - }); - - test('staging of an archive with multiple extension name correctly sets packaging and isArchive', () => { - // GIVEN - const stack = new Stack(); - const sourcePathTarGz1 = path.join(__dirname, 'archive', 'artifact.tar.gz'); - const sourcePathTarGz2 = path.join(__dirname, 'archive', 'artifact.da.vinci.monalisa.tar.gz'); - const sourcePathTgz = path.join(__dirname, 'archive', 'artifact.tgz'); - const sourcePathTar = path.join(__dirname, 'archive', 'artifact.tar'); - const sourcePathNotArchive = path.join(__dirname, 'archive', 'artifact.zip.txt'); - const sourcePathDockerFile = path.join(__dirname, 'archive', 'DockerFile'); - - // WHEN - const stagingTarGz1 = new AssetStaging(stack, 's1', { sourcePath: sourcePathTarGz1 }); - const stagingTarGz2 = new AssetStaging(stack, 's2', { sourcePath: sourcePathTarGz2 }); - const stagingTgz = new AssetStaging(stack, 's3', { sourcePath: sourcePathTgz }); - const stagingTar = new AssetStaging(stack, 's4', { sourcePath: sourcePathTar }); - const stagingNotArchive = new AssetStaging(stack, 's5', { sourcePath: sourcePathNotArchive }); - const stagingDockerFile = new AssetStaging(stack, 's6', { sourcePath: sourcePathDockerFile }); - - expect(stagingTarGz1.packaging).toEqual(FileAssetPackaging.FILE); - expect(stagingTarGz1.isArchive).toEqual(true); - expect(stagingTarGz2.packaging).toEqual(FileAssetPackaging.FILE); - expect(path.basename(stagingTarGz2.absoluteStagedPath)).toEqual(`asset.${ARCHIVE_TARBALL_TEST_HASH}.tar.gz`); - expect(path.basename(stagingTarGz2.relativeStagedPath(stack))).toEqual(`asset.${ARCHIVE_TARBALL_TEST_HASH}.tar.gz`); - expect(stagingTarGz2.isArchive).toEqual(true); - expect(stagingTgz.packaging).toEqual(FileAssetPackaging.FILE); - expect(stagingTgz.isArchive).toEqual(true); - expect(stagingTar.packaging).toEqual(FileAssetPackaging.FILE); - expect(stagingTar.isArchive).toEqual(true); - expect(stagingNotArchive.packaging).toEqual(FileAssetPackaging.FILE); - expect(path.basename(stagingNotArchive.absoluteStagedPath)).toEqual(`asset.${NOT_ARCHIVED_ZIP_TXT_HASH}.txt`); - expect(path.basename(stagingNotArchive.relativeStagedPath(stack))).toEqual(`asset.${NOT_ARCHIVED_ZIP_TXT_HASH}.txt`); - expect(stagingNotArchive.isArchive).toEqual(false); - expect(stagingDockerFile.packaging).toEqual(FileAssetPackaging.FILE); - expect(stagingDockerFile.isArchive).toEqual(false); - - }); - - test('asset packaging type is correct when staging is skipped because of memory cache', () => { - // GIVEN - const stack = new Stack(); - const sourcePath = path.join(__dirname, 'archive', 'archive.zip'); - - // WHEN - const staging1 = new AssetStaging(stack, 's1', { sourcePath }); - const staging2 = new AssetStaging(stack, 's2', { sourcePath }); - - expect(staging1.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging1.isArchive).toEqual(true); - expect(staging2.packaging).toEqual(staging1.packaging); - expect(staging2.isArchive).toEqual(staging1.isArchive); - }); - - test('asset packaging type is correct when staging is skipped because of disk cache', () => { - // GIVEN - const TEST_OUTDIR = path.join(__dirname, 'cdk.out'); - if (fs.existsSync(TEST_OUTDIR)) { - fs.removeSync(TEST_OUTDIR); - } - - const sourcePath = path.join(__dirname, 'archive', 'archive.zip'); - - const app1 = new App({ outdir: TEST_OUTDIR }); - const stack1 = new Stack(app1, 'Stack'); - - const app2 = new App({ outdir: TEST_OUTDIR }); // same OUTDIR - const stack2 = new Stack(app2, 'stack'); - - // WHEN - const staging1 = new AssetStaging(stack1, 'Asset', { sourcePath }); - - // Now clear asset hash cache to show that during the second staging - // even though the asset is already available on disk it will correctly - // be considered as a FileAssetPackaging.FILE. - AssetStaging.clearAssetHashCache(); - - const staging2 = new AssetStaging(stack2, 'Asset', { sourcePath }); - - // THEN - expect(staging1.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging1.isArchive).toEqual(true); - expect(staging2.packaging).toEqual(staging1.packaging); - expect(staging2.isArchive).toEqual(staging1.isArchive); - }); - - test('staging of a non-archive file correctly sets packaging and isArchive', () => { - // GIVEN - const stack = new Stack(); - const sourcePath = __filename; - - // WHEN - const staging = new AssetStaging(stack, 's1', { sourcePath }); - - expect(staging.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging.isArchive).toEqual(false); - }); - - test('staging can be disabled through context', () => { - // GIVEN - const stack = new Stack(); - stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true); - const sourcePath = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const staging = new AssetStaging(stack, 's1', { sourcePath }); - - expect(staging.assetHash).toEqual(FIXTURE_TEST1_HASH); - expect(staging.sourcePath).toEqual(sourcePath); - expect(staging.absoluteStagedPath).toEqual(sourcePath); - expect(staging.relativeStagedPath(stack)).toEqual(sourcePath); - }); - - test('files are copied to the output directory during synth', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - - // WHEN - new AssetStaging(stack, 's1', { sourcePath: FIXTURE_TEST1_DIR }); - new AssetStaging(stack, 'file', { sourcePath: FIXTURE_TARBALL }); - - // THEN - const assembly = app.synth(); - expect(fs.readdirSync(assembly.directory)).toEqual([ - `asset.${FIXTURE_TEST1_HASH}`, - 'asset.af10ac04b3b607b0f8659c8f0cee8c343025ee75baf0b146f10f0e5311d2c46b.tar.gz', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - }); - - test('assets in nested assemblies get staged into assembly root directory', () => { - // GIVEN - const app = new App(); - const stack1 = new Stack(new Stage(app, 'Stage1'), 'Stack'); - const stack2 = new Stack(new Stage(app, 'Stage2'), 'Stack'); - - // WHEN - new AssetStaging(stack1, 's1', { sourcePath: FIXTURE_TEST1_DIR }); - new AssetStaging(stack2, 's1', { sourcePath: FIXTURE_TEST1_DIR }); - - // THEN - const assembly = app.synth(); - - // One asset directory at the top - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'assembly-Stage1', - 'assembly-Stage2', - `asset.${FIXTURE_TEST1_HASH}`, - 'cdk.out', - 'manifest.json', - 'tree.json', - ]); - }); - - test('allow specifying extra data to include in the source hash', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const withoutExtra = new AssetStaging(stack, 'withoutExtra', { sourcePath: directory }); - const withExtra = new AssetStaging(stack, 'withExtra', { sourcePath: directory, extraHash: 'boom' }); - - // THEN - expect(withoutExtra.assetHash).not.toEqual(withExtra.assetHash); - expect(withoutExtra.assetHash).toEqual(FIXTURE_TEST1_HASH); - expect(withExtra.assetHash).toEqual('c95c915a5722bb9019e2c725d11868e5a619b55f36172f76bcbcaa8bb2d10c5f'); - }); - - test('can specify extra asset salt via context key', () => { - // GIVEN - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - const app = new App(); - const stack = new Stack(app, 'stack'); - - const saltedApp = new App({ context: { '@aws-cdk/core:assetHashSalt': 'magic' } }); - const saltedStack = new Stack(saltedApp, 'stack'); - - // WHEN - const asset = new AssetStaging(stack, 'X', { sourcePath: directory }); - const saltedAsset = new AssetStaging(saltedStack, 'X', { sourcePath: directory }); - - // THEN - expect(asset.assetHash).not.toEqual(saltedAsset.assetHash); - }); - - test('with bundling', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - const processStdErrWriteSpy = sinon.spy(process.stderr, 'write'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - // THEN - const assembly = app.synth(); - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - - // shows a message before bundling - expect(processStdErrWriteSpy.calledWith('Bundling asset stack/Asset...\n')).toEqual(true); - }); - - test('bundled resources have absolute path when staging is disabled', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - // THEN - const assembly = app.synth(); - - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - - expect(asset.assetHash).toEqual('b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4'); - expect(asset.sourcePath).toEqual(directory); - - const resolvedStagePath = asset.relativeStagedPath(stack); - // absolute path ending with bundling dir - expect(path.isAbsolute(resolvedStagePath)).toEqual(true); - expect(new RegExp('asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4$').test(resolvedStagePath)).toEqual(true); - }); - - test('bundler reuses its output when it can', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack, 'AssetDuplicate', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - // THEN - const assembly = app.synth(); - - // We're testing that docker was run exactly once even though there are two bundling assets. - expect( - readDockerStubInputConcat()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - }); - - test('uses asset hash cache with AssetHashType.OUTPUT', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - const fingerPrintSpy = sinon.spy(FileSystem, 'fingerprint'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack, 'AssetDuplicate', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { // Same bundling but with keys ordered differently - command: [DockerStubCommand.SUCCESS], - image: DockerImage.fromRegistry('alpine'), - }, - }); - - // THEN - const assembly = app.synth(); - - // We're testing that docker was run exactly once even though there are two bundling assets - // and that the hash is based on the output - expect( - readDockerStubInputConcat()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - - // Only one fingerprinting - expect(fingerPrintSpy.calledOnce).toEqual(true); - }); - - test('bundler considers its options when reusing bundle output', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack, 'AssetWithDifferentBundlingOptions', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - environment: { - UNIQUE_ENV_VAR: 'SOMEVALUE', - }, - }, - }); - - // THEN - const assembly = app.synth(); - - // We're testing that docker was run twice - once for each set of bundler options - // operating on the same source asset. - expect( - readDockerStubInputConcat()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS\n` + - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated --env UNIQUE_ENV_VAR=SOMEVALUE -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', // 'Asset' - 'asset.e80bb8f931b87e84975de193f5a7ecddd7558d3caf3d35d3a536d9ae6539234f', // 'AssetWithDifferentBundlingOptions' - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - }); - - test('bundler outputs to intermediate dir and renames to asset', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - const ensureDirSync = sinon.spy(fs, 'ensureDirSync'); - const chmodSyncSpy = sinon.spy(fs, 'chmodSync'); - const renameSyncSpy = sinon.spy(fs, 'renameSync'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - // THEN - const assembly = app.synth(); - - expect(ensureDirSync.calledWith(sinon.match(path.join(assembly.directory, 'bundling-temp-')))).toEqual(true); - expect(chmodSyncSpy.calledWith(sinon.match(path.join(assembly.directory, 'bundling-temp-')), 0o777)).toEqual(true); - expect(renameSyncSpy.calledWith(sinon.match(path.join(assembly.directory, 'bundling-temp-')), sinon.match(path.join(assembly.directory, 'asset.')))).toEqual(true); - - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f', // 'Asset' - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - }); - - test('bundling failure preserves the bundleDir for diagnosability', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.FAIL], - }, - })).toThrow(/Failed.*bundl.*asset.*-error/); - - // THEN - const assembly = app.synth(); - - const dir = fs.readdirSync(assembly.directory); - expect(dir.some(entry => entry.match(/asset.*-error/))).toEqual(true); - }); - - test('bundler re-uses assets from previous synths', () => { - // GIVEN - const TEST_OUTDIR = path.join(__dirname, 'cdk.out'); - if (fs.existsSync(TEST_OUTDIR)) { - fs.removeSync(TEST_OUTDIR); - } - - const app = new App({ outdir: TEST_OUTDIR, context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - // Clear asset hash cache to show that during the second synth bundling - // will consider the existing bundling dir (file system cache). - AssetStaging.clearAssetHashCache(); - - // GIVEN - const app2 = new App({ outdir: TEST_OUTDIR, context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack2 = new Stack(app2, 'stack'); - - // WHEN - new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - // THEN - const appAssembly = app.synth(); - const app2Assembly = app2.synth(); - - expect( - readDockerStubInputConcat()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - - expect(appAssembly.directory).toEqual(app2Assembly.directory); - expect(fs.readdirSync(appAssembly.directory)).toEqual([ - 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - }); - - test('bundling throws when /asset-output is empty', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // THEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS_NO_OUTPUT], - }, - })).toThrow(/Bundling did not produce any output/); - - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS_NO_OUTPUT`, - ); - }); - - testDeprecated('bundling with BUNDLE asset hash type', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - assetHashType: AssetHashType.BUNDLE, - }); - - // THEN - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); - }); - - test('bundling with docker security option', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - securityOpt: 'no-new-privileges', - }, - assetHashType: AssetHashType.BUNDLE, - }); - - // THEN - expect( - readDockerStubInput()).toEqual( - `run --rm --security-opt no-new-privileges ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); - }); - - test('bundling with docker entrypoint', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - entrypoint: [DockerStubCommand.SUCCESS], - command: [DockerStubCommand.SUCCESS], - }, - assetHashType: AssetHashType.OUTPUT, - }); - - // THEN - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input --entrypoint DOCKER_STUB_SUCCESS alpine DOCKER_STUB_SUCCESS`, - ); - expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); - }); - - test('bundling with OUTPUT asset hash type', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - assetHashType: AssetHashType.OUTPUT, - }); - - // THEN - expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); - }); - - test('custom hash', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHash: 'my-custom-hash', - }); - - // THEN - expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); - expect(asset.assetHash).toEqual('b9c77053f5b83bbe5ba343bc18e92db939a49017010813225fea91fa892c4823'); // hash of 'my-custom-hash' - }); - - test('throws with assetHash and not CUSTOM hash type', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // THEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - assetHash: 'my-custom-hash', - assetHashType: AssetHashType.OUTPUT, - })).toThrow(/Cannot specify `output` for `assetHashType`/); - }); - - testDeprecated('throws with BUNDLE hash type and no bundling', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // THEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.BUNDLE, - })).toThrow(/Cannot use `bundle` hash type when `bundling` is not specified/); - expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); - }); - - test('throws with OUTPUT hash type and no bundling', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // THEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - })).toThrow(/Cannot use `output` hash type when `bundling` is not specified/); - expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); - }); - - test('throws with CUSTOM and no hash', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // THEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.CUSTOM, - })).toThrow(/`assetHash` must be specified when `assetHashType` is set to `AssetHashType.CUSTOM`/); - expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); // "docker" not executed - }); - - test('throws when bundling fails', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // THEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('this-is-an-invalid-docker-image'), - command: [DockerStubCommand.FAIL], - }, - })).toThrow(/Failed to bundle asset stack\/Asset/); - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input this-is-an-invalid-docker-image DOCKER_STUB_FAIL`, - ); - }); - - test('with local bundling', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - let dir: string | undefined; - let opts: BundlingOptions | undefined; - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - local: { - tryBundle(outputDir: string, options: BundlingOptions): boolean { - dir = outputDir; - opts = options; - fs.writeFileSync(path.join(outputDir, 'hello.txt'), 'hello'); // output cannot be empty - return true; - }, - }, - }, - }); - - // THEN - expect(dir && /asset.[0-9a-f]{16,}/.test(dir)).toEqual(true); - expect(opts?.command?.[0]).toEqual(DockerStubCommand.SUCCESS); - expect(() => readDockerStubInput()).toThrow(); - - if (dir) { - fs.removeSync(path.join(dir, 'hello.txt')); - } - }); - - test('with local bundling returning false', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - local: { - tryBundle(_bundleDir: string): boolean { - return false; - }, - }, - }, - }); - - // THEN - expect(readDockerStubInput()).toBeDefined(); - }); - - test('bundling can be skipped by setting context', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'MyStack'); - stack.node.setContext(cxapi.BUNDLING_STACKS, ['OtherStack']); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - expect(() => readDockerStubInput()).toThrow(); // Bundling did not run - expect(asset.sourcePath).toEqual(directory); - expect(asset.stagedPath).toEqual(directory); - expect(asset.relativeStagedPath(stack)).toEqual(directory); - expect(asset.assetHash).toEqual('f66d7421aa2d044a6c1f60ddfc76dc78571fcd8bd228eb48eb394e2dbad94a5c'); - }); - - test('correctly skips bundling with stack under stage', () => { - // GIVEN - const app = new App(); - - const stage = new Stage(app, 'Stage'); - stage.node.setContext(cxapi.BUNDLING_STACKS, ['Stage/Stack1']); - - const stack1 = new Stack(stage, 'Stack1'); - const stack2 = new Stack(stage, 'Stack2'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - new AssetStaging(stack1, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - }, - }); - - const dockerStubInput = readDockerStubInputConcat(); - // Docker ran for the asset in Stack1 - expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // DOcker did not run for the asset in Stack2 - expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); - }); - - test('correctly skips bundling with stack under stage and custom stack name', () => { - // GIVEN - const app = new App(); - - const stage = new Stage(app, 'Stage'); - stage.node.setContext(cxapi.BUNDLING_STACKS, ['Stage/Stack1']); - - const stack1 = new Stack(stage, 'Stack1', { stackName: 'unrelated-stack1-name' }); - const stack2 = new Stack(stage, 'Stack2', { stackName: 'unrelated-stack2-name' }); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack1, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - }, - }); - - // THEN - const dockerStubInput = readDockerStubInputConcat(); - // Docker ran for the asset in Stack1 - expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // Docker did not run for the asset in Stack2 - expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); - }); - - test('correctly bundles with stack under stage and the default stack pattern', () => { - // GIVEN - const app = new App(); - - const stage = new Stage(app, 'Stage'); - - const stack1 = new Stack(stage, 'Stack1'); - const stack2 = new Stack(stage, 'Stack2'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack1, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - }, - }); - - // THEN - const dockerStubInput = readDockerStubInputConcat(); - // Docker ran for the asset in Stack1 - expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // Docker ran for the asset in Stack2 - expect(dockerStubInput).toMatch(DockerStubCommand.MULTIPLE_FILES); - }); - - test('correctly bundles with stack under stage and partial globstar wildcard', () => { - // GIVEN - const app = new App(); - - const stage = new Stage(app, 'Stage'); - stage.node.setContext(cxapi.BUNDLING_STACKS, ['**/Stack1']); // a single wildcard prefix ('*Stack1') won't match - - const stack1 = new Stack(stage, 'Stack1'); - const stack2 = new Stack(stage, 'Stack2'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(stack1, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - }, - }); - - // THEN - const dockerStubInput = readDockerStubInputConcat(); - // Docker ran for the asset in Stack1 - expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // Docker did not run for the asset in Stack2 - expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); - }); - - test('correctly bundles selected stacks nested in Stack/Stage/Stack', () => { - // GIVEN - const app = new App(); - - const topStack = new Stack(app, 'TopStack'); - topStack.node.setContext(cxapi.BUNDLING_STACKS, ['TopStack/MiddleStage/BottomStack']); - - const middleStage = new Stage(topStack, 'MiddleStage'); - const bottomStack = new Stack(middleStage, 'BottomStack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - new AssetStaging(bottomStack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - new AssetStaging(topStack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - }, - }); - - const dockerStubInput = readDockerStubInputConcat(); - // Docker ran for the asset in BottomStack - expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); - // Docker did not run for the asset in TopStack - expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); - }); - - test('bundling still occurs with partial wildcard', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'MyStack'); - stack.node.setContext(cxapi.BUNDLING_STACKS, ['*Stack']); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); // hash of MyStack/Asset - }); - - test('bundling still occurs with a single wildcard', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'MyStack'); - stack.node.setContext(cxapi.BUNDLING_STACKS, ['*']); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const asset = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - assetHashType: AssetHashType.OUTPUT, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SUCCESS], - }, - }); - - expect( - readDockerStubInput()).toEqual( - `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, - ); - expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); // hash of MyStack/Asset - }); - - test('bundling that produces a single archive file is autodiscovered', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const staging = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SINGLE_ARCHIVE], - }, - }); - - // THEN - const assembly = app.synth(); - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.f43148c61174f444925231b5849b468f21e93b5d1469cd07c53625ffd039ef48', // this is the bundle dir - 'asset.f43148c61174f444925231b5849b468f21e93b5d1469cd07c53625ffd039ef48.zip', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - expect(fs.readdirSync(path.join(assembly.directory, 'asset.f43148c61174f444925231b5849b468f21e93b5d1469cd07c53625ffd039ef48'))).toEqual([ - 'test.zip', // bundle dir with "touched" bundled output file - ]); - expect(staging.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging.isArchive).toEqual(true); - }); - - test('bundling that produces a single archive file with disk cache', () => { - // GIVEN - const TEST_OUTDIR = path.join(__dirname, 'cdk.out'); - if (fs.existsSync(TEST_OUTDIR)) { - fs.removeSync(TEST_OUTDIR); - } - - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - const app1 = new App({ outdir: TEST_OUTDIR }); - const stack1 = new Stack(app1, 'Stack'); - - const app2 = new App({ outdir: TEST_OUTDIR }); // same OUTDIR - const stack2 = new Stack(app2, 'stack'); - - // WHEN - const staging1 = new AssetStaging(stack1, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SINGLE_ARCHIVE], - outputType: BundlingOutput.ARCHIVED, - }, - }); - - // Now clear asset hash cache to show that during the second staging - // even though bundling is skipped it will correctly be considered - // as a FileAssetPackaging.FILE. - AssetStaging.clearAssetHashCache(); - - const staging2 = new AssetStaging(stack2, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SINGLE_ARCHIVE], - outputType: BundlingOutput.ARCHIVED, - }, - }); - - // THEN - expect(staging1.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging1.isArchive).toEqual(true); - expect(staging2.packaging).toEqual(staging1.packaging); - expect(staging2.isArchive).toEqual(staging1.isArchive); - }); - - test('bundling that produces a single archive file with NOT_ARCHIVED', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const staging = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.SINGLE_ARCHIVE], - outputType: BundlingOutput.NOT_ARCHIVED, - }, - }); - - // THEN - const assembly = app.synth(); - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.86ec07746e1d859290cfd8b9c648e581555649c75f51f741f11e22cab6775abc', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - expect(staging.packaging).toEqual(FileAssetPackaging.ZIP_DIRECTORY); - expect(staging.isArchive).toEqual(true); - }); - - test('throws with ARCHIVED and bundling that does not produce a single archive file', () => { - // GIVEN - const app = new App(); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - expect(() => new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.MULTIPLE_FILES], - outputType: BundlingOutput.ARCHIVED, - }, - })).toThrow(/Bundling output directory is expected to include only a single archive file when `output` is set to `ARCHIVED`/); - }); -}); - -describe('staging with docker cp', () => { - beforeAll(() => { - // this is a way to provide a custom "docker" command for staging. - process.env.CDK_DOCKER = `${__dirname}/docker-stub-cp.sh`; - }); - - afterAll(() => { - delete process.env.CDK_DOCKER; - }); - - afterEach(() => { - AssetStaging.clearAssetHashCache(); - if (fs.existsSync(STUB_INPUT_CP_FILE)) { - fs.unlinkSync(STUB_INPUT_CP_FILE); - } - if (fs.existsSync(STUB_INPUT_CP_CONCAT_FILE)) { - fs.unlinkSync(STUB_INPUT_CP_CONCAT_FILE); - } - sinon.restore(); - }); - - test('bundling with docker image copy variant', () => { - // GIVEN - const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); - const stack = new Stack(app, 'stack'); - const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); - - // WHEN - const staging = new AssetStaging(stack, 'Asset', { - sourcePath: directory, - bundling: { - image: DockerImage.fromRegistry('alpine'), - command: [DockerStubCommand.VOLUME_SINGLE_ARCHIVE], - bundlingFileAccess: BundlingFileAccess.VOLUME_COPY, - }, - }); - - // THEN - const assembly = app.synth(); - expect(fs.readdirSync(assembly.directory)).toEqual([ - 'asset.0ec371a2022d29dfd83f5df104e0f01b34233a4e3e839c3c4ec62008f0b9a0e8', // this is the bundle dir - 'asset.0ec371a2022d29dfd83f5df104e0f01b34233a4e3e839c3c4ec62008f0b9a0e8.zip', - 'cdk.out', - 'manifest.json', - 'stack.template.json', - 'tree.json', - ]); - expect(fs.readdirSync(path.join(assembly.directory, 'asset.0ec371a2022d29dfd83f5df104e0f01b34233a4e3e839c3c4ec62008f0b9a0e8'))).toEqual([ - 'test.zip', // bundle dir with "touched" bundled output file - ]); - expect(staging.packaging).toEqual(FileAssetPackaging.FILE); - expect(staging.isArchive).toEqual(true); - const dockerCalls: string[] = readDockerStubInputConcat(STUB_INPUT_CP_CONCAT_FILE).split(/\r?\n/); - expect(dockerCalls).toEqual(expect.arrayContaining([ - expect.stringContaining('volume create assetInput'), - expect.stringContaining('volume create assetOutput'), - expect.stringMatching('run --name copyContainer.* -v /input:/asset-input -v /output:/asset-output alpine sh -c mkdir -p /asset-input && chown -R .* /asset-output && chown -R .* /asset-input'), - expect.stringMatching('cp .*fs/fixtures/test1/\. copyContainer.*:/asset-input'), - expect.stringMatching('run --rm -u .* --volumes-from copyContainer.* -w /asset-input alpine DOCKER_STUB_VOLUME_SINGLE_ARCHIVE'), - expect.stringMatching('cp copyContainer.*:/asset-output/\. .*'), - expect.stringContaining('rm copyContainer'), - expect.stringContaining('volume rm assetInput'), - expect.stringContaining('volume rm assetOutput'), - ])); - }); -}); - -// Reads a docker stub and cleans the volume paths out of the stub. -function readAndCleanDockerStubInput(file: string) { - return fs - .readFileSync(file, 'utf-8') - .trim() - .replace(/-v ([^:]+):\/asset-input/g, '-v /input:/asset-input') - .replace(/-v ([^:]+):\/asset-output/g, '-v /output:/asset-output'); -} - -// Last docker input since last teardown -function readDockerStubInput(file?: string) { - return readAndCleanDockerStubInput(file ?? STUB_INPUT_FILE); -} -// Concatenated docker inputs since last teardown -function readDockerStubInputConcat(file?: string) { - return readAndCleanDockerStubInput(file ?? STUB_INPUT_CONCAT_FILE); -} diff --git a/packages/@aws-cdk/core/test/util.ts b/packages/@aws-cdk/core/test/util.ts deleted file mode 100644 index 8cf516921503e..0000000000000 --- a/packages/@aws-cdk/core/test/util.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { CloudAssembly } from '@aws-cdk/cx-api'; -import { Stack } from '../lib'; -import { CDK_DEBUG } from '../lib/debug'; -import { synthesize } from '../lib/private/synthesis'; - -export function toCloudFormation(stack: Stack): any { - const synthesizedTemplate = synthesize(stack, { skipValidation: true }).getStackByName(stack.stackName).template; - - // if new-style synthesis is not explicitly set, remove the extra generated Rule and Parameter from the synthesized template, - // to avoid changing many tests that rely on the template being exactly what it is - delete synthesizedTemplate?.Rules?.CheckBootstrapVersion; - if (Object.keys(synthesizedTemplate?.Rules ?? {}).length === 0) { - delete synthesizedTemplate?.Rules; - } - delete synthesizedTemplate?.Parameters?.BootstrapVersion; - if (Object.keys(synthesizedTemplate?.Parameters ?? {}).length === 0) { - delete synthesizedTemplate?.Parameters; - } - - return synthesizedTemplate; -} - -export function reEnableStackTraceCollection(): string | undefined { - const previousValue = process.env.CDK_DISABLE_STACK_TRACE; - process.env.CDK_DISABLE_STACK_TRACE = ''; - process.env[CDK_DEBUG] = 'true'; - return previousValue; -} - -export function restoreStackTraceColection(previousValue: string | undefined): void { - process.env.CDK_DISABLE_STACK_TRACE = previousValue; - delete process.env[CDK_DEBUG]; -} - -export function getWarnings(casm: CloudAssembly) { - const result = new Array<{ path: string, message: string }>(); - for (const stack of Object.values(casm.manifest.artifacts ?? {})) { - for (const [path, md] of Object.entries(stack.metadata ?? {})) { - for (const x of md) { - if (x.type === 'aws:cdk:warning') { - result.push({ path, message: x.data as string }); - } - } - } - } - return result; -} diff --git a/packages/@aws-cdk/custom-resources/.eslintrc.js b/packages/@aws-cdk/custom-resources/.eslintrc.js deleted file mode 100644 index 46bdbac86c07f..0000000000000 --- a/packages/@aws-cdk/custom-resources/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; - -module.exports = baseConfig; diff --git a/packages/@aws-cdk/custom-resources/.gitignore b/packages/@aws-cdk/custom-resources/.gitignore deleted file mode 100644 index b10ee134f84e9..0000000000000 --- a/packages/@aws-cdk/custom-resources/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -!lib/provider-framework/types.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk - -lib/aws-custom-resource/sdk-api-metadata.json -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/custom-resources/.npmignore b/packages/@aws-cdk/custom-resources/.npmignore deleted file mode 100644 index 1ac13af872cc3..0000000000000 --- a/packages/@aws-cdk/custom-resources/.npmignore +++ /dev/null @@ -1,30 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/custom-resources/LICENSE b/packages/@aws-cdk/custom-resources/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/custom-resources/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/custom-resources/NOTICE b/packages/@aws-cdk/custom-resources/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/custom-resources/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/custom-resources/README.md b/packages/@aws-cdk/custom-resources/README.md deleted file mode 100644 index ca0537308b10b..0000000000000 --- a/packages/@aws-cdk/custom-resources/README.md +++ /dev/null @@ -1,636 +0,0 @@ -# AWS CDK Custom Resources - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -## Provider Framework - -AWS CloudFormation [custom resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) are extension points to the provisioning -engine. When CloudFormation needs to create, update or delete a custom resource, -it sends a lifecycle event notification to a **custom resource provider**. The provider -handles the event (e.g. creates a resource) and sends back a response to CloudFormation. - -The `@aws-cdk/custom-resources.Provider` construct is a "mini-framework" for -implementing providers for AWS CloudFormation custom resources. The framework offers a high-level API which makes it easier to implement robust -and powerful custom resources. If you are looking to implement a custom resource provider, we recommend -you use this module unless you have good reasons not to. For an overview of different provider types you -could be using, see the [Custom Resource Providers section in the core library documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib-readme.html#custom-resource-providers). - -> **N.B.**: if you use the provider framework in this module you will write AWS Lambda Functions that look a lot like, but aren't exactly the same as the Lambda Functions you would write if you wrote CloudFormation Custom Resources directly, without this framework. -> -> Specifically, to report success or failure, have your Lambda Function exit in the right way: return data for success, or throw an -> exception for failure. *Do not* post the success or failure of your custom resource to an HTTPS URL as the CloudFormation -> documentation tells you to do. - -The framework has the following capabilities: - -* Handles responses to AWS CloudFormation and protects against blocked - deployments -* Validates handler return values to help with correct handler implementation -* Supports asynchronous handlers to enable operations that require a long waiting period for a resource, which can exceed the AWS Lambda timeout -* Implements default behavior for physical resource IDs. - -The following code shows how the `Provider` construct is used in conjunction -with a `CustomResource` and a user-provided AWS Lambda function which implements -the actual handler. - -```ts -declare const onEvent: lambda.Function; -declare const isComplete: lambda.Function; -declare const myRole: iam.Role; - -const myProvider = new cr.Provider(this, 'MyProvider', { - onEventHandler: onEvent, - isCompleteHandler: isComplete, // optional async "waiter" - logRetention: logs.RetentionDays.ONE_DAY, // default is INFINITE - role: myRole, // must be assumable by the `lambda.amazonaws.com` service principal -}); - -new CustomResource(this, 'Resource1', { serviceToken: myProvider.serviceToken }); -new CustomResource(this, 'Resource2', { serviceToken: myProvider.serviceToken }); -``` - -Providers are implemented through AWS Lambda functions that are triggered by the -provider framework in response to lifecycle events. - -At the minimum, users must define the `onEvent` handler, which is invoked by the -framework for all resource lifecycle events (`Create`, `Update` and `Delete`) -and returns a result which is then submitted to CloudFormation. - -The following example is a skeleton for a Python implementation of `onEvent`: - -```py -def on_event(event, context): - print(event) - request_type = event['RequestType'] - if request_type == 'Create': return on_create(event) - if request_type == 'Update': return on_update(event) - if request_type == 'Delete': return on_delete(event) - raise Exception("Invalid request type: %s" % request_type) - -def on_create(event): - props = event["ResourceProperties"] - print("create new resource with props %s" % props) - - # add your create code here... - physical_id = ... - - return { 'PhysicalResourceId': physical_id } - -def on_update(event): - physical_id = event["PhysicalResourceId"] - props = event["ResourceProperties"] - print("update resource %s with props %s" % (physical_id, props)) - # ... - -def on_delete(event): - physical_id = event["PhysicalResourceId"] - print("delete resource %s" % physical_id) - # ... -``` - -> When writing your handlers, there are a couple of non-obvious corner cases you need to -> pay attention to. See the [important cases to handle](#important-cases-to-handle) section for more information. - -Users may also provide an additional handler called `isComplete`, for cases -where the lifecycle operation cannot be completed immediately. The -`isComplete` handler will be retried asynchronously after `onEvent` until it -returns `IsComplete: true`, or until the total provider timeout has expired. - -The following example is a skeleton for a Python implementation of `isComplete`: - -```py -def is_complete(event, context): - physical_id = event["PhysicalResourceId"] - request_type = event["RequestType"] - - # check if resource is stable based on request_type - is_ready = ... - - return { 'IsComplete': is_ready } -``` - -> **Security Note**: the Custom Resource Provider Framework will write the value of `ResponseURL`, -> which is a pre-signed S3 URL used to report the success or failure of the Custom Resource execution -> back to CloudFormation, in a readable form to the AWS Step Functions execution history. -> -> Anybody who can list and read AWS StepFunction executions in your account will be able to write -> a fake response to this URL and make your CloudFormation deployments fail. -> -> Do not use this library if your threat model requires that you cannot trust actors who are able -> to list StepFunction executions in your account. - -### Handling Lifecycle Events: onEvent - -The user-defined `onEvent` AWS Lambda function is invoked whenever a resource -lifecycle event occurs. The function is expected to handle the event and return -a response to the framework that, at least, includes the physical resource ID. - -If `onEvent` returns successfully, the framework will submit a "SUCCESS" response -to AWS CloudFormation for this resource operation. If the provider is -[asynchronous](#asynchronous-providers-iscomplete) (`isCompleteHandler` is -defined), the framework will only submit a response based on the result of -`isComplete`. - -If `onEvent` throws an error, the framework will submit a "FAILED" response to -AWS CloudFormation. - -The input event includes the following fields derived from the [Custom Resource -Provider Request]: - -|Field|Type|Description -|-----|----|---------------- -|`RequestType`|String|The type of lifecycle event: `Create`, `Update` or `Delete`. -|`LogicalResourceId`|String|The template developer-chosen name (logical ID) of the custom resource in the AWS CloudFormation template. -|`PhysicalResourceId`|String|This field will only be present for `Update` and `Delete` events and includes the value returned in `PhysicalResourceId` of the previous operation. -|`ResourceProperties`|JSON|This field contains the properties defined in the template for this custom resource. -|`OldResourceProperties`|JSON|This field will only be present for `Update` events and contains the resource properties that were declared previous to the update request. -|`ResourceType`|String|The resource type defined for this custom resource in the template. A provider may handle any number of custom resource types. -|`RequestId`|String|A unique ID for the request. -|`StackId`|String|The ARN that identifies the stack that contains the custom resource. - -The return value from `onEvent` must be a JSON object with the following fields: - -|Field|Type|Required|Description -|-----|----|--------|----------- -|`PhysicalResourceId`|String|No|The allocated/assigned physical ID of the resource. If omitted for `Create` events, the event's `RequestId` will be used. For `Update`, the current physical ID will be used. If a different value is returned, CloudFormation will follow with a subsequent `Delete` for the previous ID (resource replacement). For `Delete`, it will always return the current physical resource ID, and if the user returns a different one, an error will occur. -|`Data`|JSON|No|Resource attributes, which can later be retrieved through `Fn::GetAtt` on the custom resource object. -|`NoEcho`|Boolean|No|Whether to mask the output of the custom resource when retrieved by using the `Fn::GetAtt` function. -|*any*|*any*|No|Any other field included in the response will be passed through to `isComplete`. This can sometimes be useful to pass state between the handlers. - -[Custom Resource Provider Request]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref-requests.html#crpg-ref-request-fields - -### Asynchronous Providers: isComplete - -It is not uncommon for the provisioning of resources to be an asynchronous -operation, which means that the operation does not immediately finish, and we -need to "wait" until the resource stabilizes. - -The provider framework makes it easy to implement "waiters" by allowing users to -specify an additional AWS Lambda function in `isCompleteHandler`. - -The framework will repeatedly invoke the handler every `queryInterval`. When -`isComplete` returns with `IsComplete: true`, the framework will submit a -"SUCCESS" response to AWS CloudFormation. If `totalTimeout` expires and the -operation has not yet completed, the framework will submit a "FAILED" response -with the message "Operation timed out". - -If an error is thrown, the framework will submit a "FAILED" response to AWS -CloudFormation. - -The input event to `isComplete` includes all request fields, combined with all -fields returned from `onEvent`. If `PhysicalResourceId` has not been explicitly -returned from `onEvent`, it's value will be calculated based on the heuristics -described above. - -The return value must be a JSON object with the following fields: - -|Field|Type|Required|Description -|-----|----|--------|----------- -|`IsComplete`|Boolean|Yes|Indicates if the operation has finished or not. -|`Data`|JSON|No|May only be sent if `IsComplete` is `true` and includes additional resource attributes. These attributes will be **merged** with the ones returned from `onEvent` - -### Physical Resource IDs - -Every resource in CloudFormation has a physical resource ID. When a resource is -created, the `PhysicalResourceId` returned from the `Create` operation is stored -by AWS CloudFormation and assigned to the logical ID defined for this resource -in the template. If a `Create` operation returns without a `PhysicalResourceId`, -the framework will use `RequestId` as the default. This is sufficient for -various cases such as "pseudo-resources" which only query data. - -For `Update` and `Delete` operations, the resource event will always include the -current `PhysicalResourceId` of the resource. - -When an `Update` operation occurs, the default behavior is to return the current -physical resource ID. if the `onEvent` returns a `PhysicalResourceId` which is -different from the current one, AWS CloudFormation will treat this as a -**resource replacement**, and it will issue a subsequent `Delete` operation for -the old resource. - -As a rule of thumb, if your custom resource supports configuring a physical name -(e.g. you can specify a `BucketName` when you define an `AWS::S3::Bucket`), you -must return this name in `PhysicalResourceId` and make sure to handle -replacement properly. The `S3File` example demonstrates this -through the `objectKey` property. - -### When there are errors - -As mentioned above, if any of the user handlers fail (i.e. throws an exception) -or times out (due to their AWS Lambda timing out), the framework will trap these -errors and submit a "FAILED" response to AWS CloudFormation, along with the error -message. - -Since errors can occur in multiple places in the provider (framework, `onEvent`, -`isComplete`), it is important to know that there could situations where a -resource operation fails even though the operation technically succeeded (i.e. -isComplete throws an error). - -When AWS CloudFormation receives a "FAILED" response, it will attempt to roll -back the stack to it's last state. This has different meanings for different -lifecycle events: - -* If a `Create` event fails, the resource provider framework will automatically - ignore the subsequent `Delete` operation issued by AWS CloudFormation. The - framework currently does not support customizing this behavior (see - https://github.com/aws/aws-cdk/issues/5524). -* If an `Update` event fails, CloudFormation will issue an additional `Update` - with the previous properties. -* If a `Delete` event fails, CloudFormation will abandon this resource. - -### Important cases to handle - -You should keep the following list in mind when writing custom resources to -make sure your custom resource behaves correctly in all cases: - -* During `Create`: - * If the create fails, the *provider framework* will make sure you - don't get a subsequent `Delete` event. If your create involves multiple distinct - operations, it is your responsibility to catch and rethrow and clean up - any partial updates that have already been performed. Make sure your - API call timeouts and Lambda timeouts allow for this. -* During `Update`: - * If the update fails, you will get a subsequent `Update` event - to roll back to the previous state (with `ResourceProperties` and - `OldResourceProperties` reversed). - * If you return a different `PhysicalResourceId`, you will subsequently - receive a `Delete` event to clean up the previous state of the resource. -* During `Delete`: - * If the behavior of your custom resource is tied to another AWS resource - (for example, it exists to clean the contents of a stateful resource), keep - in mind that your custom resource may be deleted independently of the other - resource and you must confirm that it is appropriate to perform the action. - * (only if you are *not* using the provider framework) a `Delete` event - may be caused by a failed `Create`. You must be able to handle the case - where the resource you are trying to delete hasn't even been created yet. -* If you update the code of your custom resource and change the format of the - resource properties, be aware that there may still be already-deployed - instances of your custom resource out there, and you may still receive - the *old* property format in `ResourceProperties` (during `Delete` and - rollback `Updates`) or in `OldResourceProperties` (during rollforward - `Update`). You must continue to handle all possible sets of properties - your custom resource could have ever been created with in the past. - -### Provider Framework Execution Policy - -Similarly to any AWS Lambda function, if the user-defined handlers require -access to AWS resources, you will have to define these permissions -by calling "grant" methods such as `myBucket.grantRead(myHandler)`), using `myHandler.addToRolePolicy` -or specifying an `initialPolicy` when defining the function. - -Bear in mind that in most cases, a single provider will be used for multiple -resource instances. This means that the execution policy of the provider must -have the appropriate privileges. - -The following example grants the `onEvent` handler `s3:GetObject*` permissions -to all buckets: - -```ts -new lambda.Function(this, 'OnEventHandler', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromInline('my code'), - initialPolicy: [ - new iam.PolicyStatement({ actions: [ 's3:GetObject*' ], resources: [ '*' ] }), - ], -}); -``` - -### Timeouts - -Users are responsible to define the timeouts for the AWS Lambda functions for -user-defined handlers. It is recommended not to exceed a **14 minutes** timeout, -since all framework functions are configured to time out after 15 minutes, which -is the maximal AWS Lambda timeout. - -If your operation takes over **14 minutes**, the recommended approach is to -implement an [asynchronous provider](#asynchronous-providers-iscomplete), and -then configure the timeouts for the asynchronous retries through the -`queryInterval` and the `totalTimeout` options. - -### Provider Framework Examples - -This module includes a few examples for custom resource implementations: - -#### S3File - -Provisions an object in an S3 bucket with textual contents. See the source code -for the -[construct](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts) and -[handler](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts). - -The following example will create the file `folder/file1.txt` inside `myBucket` -with the contents `hello!`. - - -```plaintext -// This example exists only for TypeScript - -declare const myBucket: s3.Bucket; -new cr.S3File(this, 'MyFile', { - bucket: myBucket, - objectKey: 'folder/file1.txt', // optional - content: 'hello!', - public: true, // optional -}); -``` - -This sample demonstrates the following concepts: - -* Synchronous implementation (`isComplete` is not defined) -* Automatically generates the physical name if `objectKey` is not defined -* Handles physical name changes -* Returns resource attributes -* Handles deletions -* Implemented in TypeScript - -#### S3Assert - -Checks that the textual contents of an S3 object matches a certain value. The check will be retried for 5 minutes as long as the object is not found or the value is different. See the source code for the [construct](test/provider-framework/integration-test-fixtures/s3-assert.ts) and [handler](test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py). - -The following example defines an `S3Assert` resource which waits until -`myfile.txt` in `myBucket` exists and includes the contents `foo bar`: - -```plaintext -// This example exists only for TypeScript - -declare const myBucket: s3.Bucket; -new cr.S3Assert(this, 'AssertMyFile', { - bucket: myBucket, - objectKey: 'myfile.txt', - expectedContent: 'foo bar', -}); -``` - -This sample demonstrates the following concepts: - -* Asynchronous implementation -* Non-intrinsic physical IDs -* Implemented in Python - - -### Customizing Provider Function name - -In multi-account environments or when the custom resource may be re-utilized across several -stacks it may be useful to manually set a name for the Provider Function Lambda and therefore -have a predefined service token ARN. - -```ts -declare const onEvent: lambda.Function; -declare const isComplete: lambda.Function; -declare const myRole: iam.Role; -const myProvider = new cr.Provider(this, 'MyProvider', { - onEventHandler: onEvent, - isCompleteHandler: isComplete, - logRetention: logs.RetentionDays.ONE_DAY, - role: myRole, - providerFunctionName: 'the-lambda-name', // Optional -}); - -``` - -## Custom Resources for AWS APIs - -Sometimes a single API call can fill the gap in the CloudFormation coverage. In -this case you can use the `AwsCustomResource` construct. This construct creates -a custom resource that can be customized to make specific API calls for the -`CREATE`, `UPDATE` and `DELETE` events. Additionally, data returned by the API -call can be extracted and used in other constructs/resources (creating a real -CloudFormation dependency using `Fn::GetAtt` under the hood). - -The physical id of the custom resource can be specified or derived from the data -returned by the API call. - -The `AwsCustomResource` uses the AWS SDK for JavaScript. Services, actions and -parameters can be found in the [API documentation](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html). - -Path to data must be specified using a dot notation, e.g. to get the string value -of the `Title` attribute for the first item returned by `dynamodb.query` it should -be `Items.0.Title.S`. - -To make sure that the newest API calls are available the latest AWS SDK v2 is installed -in the Lambda function implementing the custom resource. The installation takes around 60 -seconds. If you prefer to optimize for speed, you can disable the installation by setting -the `installLatestAwsSdk` prop to `false`. - -### Custom Resource Execution Policy - -The `policy` property defines the IAM Policy that will be applied to the API calls. This must be provided -if an existing `role` is not specified and is optional otherwise. The library provides two factory methods -to quickly configure this: - -* **`AwsCustomResourcePolicy.fromSdkCalls`** - Use this to auto-generate IAM - Policy statements based on the configured SDK calls. Keep two things in mind - when using this policy: - * This policy variant assumes the IAM policy name has the same name as the API - call. This is true in 99% of cases, but there are exceptions (for example, - S3's `PutBucketLifecycleConfiguration` requires - `s3:PutLifecycleConfiguration` permissions, Lambda's `Invoke` requires - `lambda:InvokeFunction` permissions). Use `fromStatements` if you want to - do a call that requires different IAM action names. - * You will have to either provide specific ARNs, or explicitly use - `AwsCustomResourcePolicy.ANY_RESOURCE` to allow access to any resource. -* **`AwsCustomResourcePolicy.fromStatements`** - Use this to specify your own - custom statements. - -The custom resource also implements `iam.IGrantable`, making it possible to use the `grantXxx()` methods. - -As this custom resource uses a singleton Lambda function, it's important to note -that the function's role will eventually accumulate the permissions/grants from all -resources. - -Chained API calls can be achieved by creating dependencies: - -```ts -const awsCustom1 = new cr.AwsCustomResource(this, 'API1', { - onCreate: { - service: '...', - action: '...', - physicalResourceId: cr.PhysicalResourceId.of('...'), - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}); - -const awsCustom2 = new cr.AwsCustomResource(this, 'API2', { - onCreate: { - service: '...', - action: '...', - parameters: { - text: awsCustom1.getResponseField('Items.0.text'), - }, - physicalResourceId: cr.PhysicalResourceId.of('...'), - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}); -``` - -### Physical Resource Id Parameter - -Some AWS APIs may require passing the physical resource id in as a parameter for doing updates and deletes. You can pass it by using `PhysicalResourceIdReference`. - -```ts -const awsCustom = new cr.AwsCustomResource(this, 'aws-custom', { - onCreate: { - service: '...', - action: '...', - parameters: { - text: '...', - }, - physicalResourceId: cr.PhysicalResourceId.of('...'), - }, - onUpdate: { - service: '...', - action: '...', - parameters: { - text: '...', - resourceId: new cr.PhysicalResourceIdReference(), - }, - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}) -``` - -You can omit `PhysicalResourceId` property in `onUpdate` to passthrough the value in `onCreate`. This behavior is useful when using Update APIs that response with an empty body. - -> AwsCustomResource.getResponseField() and .getResponseFieldReference() will not work if the Create and Update APIs don't consistently return the same fields. - -### Handling Custom Resource Errors - -Every error produced by the API call is treated as is and will cause a "FAILED" response to be submitted to CloudFormation. -You can ignore some errors by specifying the `ignoreErrorCodesMatching` property, which accepts a regular expression that is -tested against the `code` property of the response. If matched, a "SUCCESS" response is submitted. -Note that in such a case, the call response data and the `Data` key submitted to CloudFormation would both be an empty JSON object. -Since a successful resource provisioning might or might not produce outputs, this presents us with some limitations: - -* `PhysicalResourceId.fromResponse` - Since the call response data might be empty, we cannot use it to extract the physical id. -* `getResponseField` and `getResponseFieldReference` - Since the `Data` key is empty, the resource will not have any attributes, and therefore, invoking these functions will result in an error. - -In both the cases, you will get a synth time error if you attempt to use it in conjunction with `ignoreErrorCodesMatching`. - -### Customizing the Lambda function implementing the custom resource - -Use the `role`, `timeout`, `logRetention` and `functionName` properties to customize -the Lambda function implementing the custom resource: - -```ts -declare const myRole: iam.Role; -new cr.AwsCustomResource(this, 'Customized', { - role: myRole, // must be assumable by the `lambda.amazonaws.com` service principal - timeout: Duration.minutes(10), // defaults to 2 minutes - logRetention: logs.RetentionDays.ONE_WEEK, // defaults to never delete logs - functionName: 'my-custom-name', // defaults to a CloudFormation generated name - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}); -``` - -Additionally, the Lambda function can be placed in a private VPC by using the `vpc` -and `vpcSubnets` properties. - -```ts -declare const myVpc: ec2.Vpc; -new cr.AwsCustomResource(this, 'CustomizedInVpc', { - vpc, - vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_NAT }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - } -}) -``` - -Note that Lambda functions in a VPC -[require Network Address Translation (NAT) in order to access the internet][vpc-internet]. -The subnets specified in `vpcSubnets` must be private subnets. - -[vpc-internet]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html#vpc-internet - -### Restricting the output of the Custom Resource - -CloudFormation imposes a hard limit of 4096 bytes for custom resources response -objects. If your API call returns an object that exceeds this limit, you can restrict -the data returned by the custom resource to specific paths in the API response: - -```ts -new cr.AwsCustomResource(this, 'ListObjects', { - onCreate: { - service: 's3', - action: 'listObjectsV2', - parameters: { - Bucket: 'my-bucket', - }, - physicalResourceId: cr.PhysicalResourceId.of('id'), - outputPaths: ['Contents.0.Key', 'Contents.1.Key'], // Output only the two first keys - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}); -``` - -Note that even if you restrict the output of your custom resource you can still use any -path in `PhysicalResourceId.fromResponse()`. - -### Custom Resource Examples - -#### Get the latest version of a secure SSM parameter - -```ts -const getParameter = new cr.AwsCustomResource(this, 'GetParameter', { - onUpdate: { // will also be called for a CREATE event - service: 'SSM', - action: 'getParameter', - parameters: { - Name: 'my-parameter', - WithDecryption: true, - }, - physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()), // Update physical id to always fetch the latest version - }, - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}); - -// Use the value in another construct with -getParameter.getResponseField('Parameter.Value'); -``` - -#### Associate a PrivateHostedZone with VPC shared from another account - -```ts -const getParameter = new cr.AwsCustomResource(this, 'AssociateVPCWithHostedZone', { - onCreate: { - assumedRoleArn: 'arn:aws:iam::OTHERACCOUNT:role/CrossAccount/ManageHostedZoneConnections', - service: 'Route53', - action: 'associateVPCWithHostedZone', - parameters: { - HostedZoneId: 'hz-123', - VPC: { - VPCId: 'vpc-123', - VPCRegion: 'region-for-vpc', - }, - }, - physicalResourceId: cr.PhysicalResourceId.of('${vpcStack.SharedVpc.VpcId}-${vpcStack.Region}-${PrivateHostedZone.HostedZoneId}'), - }, - //Will ignore any resource and use the assumedRoleArn as resource and 'sts:AssumeRole' for service:action - policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ - resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, - }), -}); -``` - ---- - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/@aws-cdk/custom-resources/jest.config.js b/packages/@aws-cdk/custom-resources/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/custom-resources/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/index.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/index.ts deleted file mode 100644 index 0a8c7e17e952f..0000000000000 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './provider'; \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/util.ts b/packages/@aws-cdk/custom-resources/lib/provider-framework/util.ts deleted file mode 100644 index 29e7493ce26e8..0000000000000 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/util.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Duration } from '@aws-cdk/core'; - -const DEFAULT_TIMEOUT = Duration.minutes(30); -const DEFAULT_INTERVAL = Duration.seconds(5); - -export function calculateRetryPolicy(props: { totalTimeout?: Duration, queryInterval?: Duration } = { }) { - const totalTimeout = props.totalTimeout || DEFAULT_TIMEOUT; - const interval = props.queryInterval || DEFAULT_INTERVAL; - const maxAttempts = totalTimeout.toSeconds() / interval.toSeconds(); - - if (Math.round(maxAttempts) !== maxAttempts) { - throw new Error(`Cannot determine retry count since totalTimeout=${totalTimeout.toSeconds()}s is not integrally dividable by queryInterval=${interval.toSeconds()}s`); - } - - return { - maxAttempts, - interval, - backoffRate: 1, - }; -} diff --git a/packages/@aws-cdk/custom-resources/package.json b/packages/@aws-cdk/custom-resources/package.json deleted file mode 100644 index fcffd11a0a870..0000000000000 --- a/packages/@aws-cdk/custom-resources/package.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "name": "@aws-cdk/custom-resources", - "version": "0.0.0", - "private": true, - "description": "Constructs for implementing CDK custom resources", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.customresources", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-customresources" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.CustomResources", - "packageId": "Amazon.CDK.AWS.CustomResources", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.custom-resources", - "module": "aws_cdk.custom_resources", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/custom-resources" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "gen": "cp -f $(node -p 'require.resolve(\"aws-sdk/apis/metadata.json\")') lib/aws-custom-resource/sdk-api-metadata.json && rm -rf test/aws-custom-resource/cdk.out", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "cloudformation", - "custom-resources", - "customresources" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/aws-lambda": "^8.10.111", - "@types/fs-extra": "^9.0.13", - "@types/jest": "^27.5.2", - "@types/sinon": "^9.0.11", - "aws-sdk": "^2.1329.0", - "aws-sdk-mock": "5.6.0", - "fs-extra": "^9.1.0", - "nock": "^13.3.0", - "sinon": "^9.2.4" - }, - "dependencies": { - "@aws-cdk/aws-cloudformation": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudformation": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "awslint": { - "exclude": [ - "construct-ctor-props-optional:@aws-cdk/custom-resources.AwsCustomResource" - ] - }, - "awscdkio": { - "announce": false - }, - "nozem": { - "ostools": [ - "rm", - "cp" - ] - }, - "maturity": "stable", - "publishConfig": { - "tag": "latest" - } -} diff --git a/packages/@aws-cdk/custom-resources/rosetta/default.ts-fixture b/packages/@aws-cdk/custom-resources/rosetta/default.ts-fixture deleted file mode 100644 index b80888ebeedd0..0000000000000 --- a/packages/@aws-cdk/custom-resources/rosetta/default.ts-fixture +++ /dev/null @@ -1,16 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { CustomResource, Duration, Stack } from '@aws-cdk/core'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cr from '@aws-cdk/custom-resources'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as logs from '@aws-cdk/aws-logs'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/cdk.out b/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/cdk.out deleted file mode 100644 index 145739f539580..0000000000000 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/integ.aws-custom-resource-vpc.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"22.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.d.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.d.ts deleted file mode 100644 index c535c997c1e97..0000000000000 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare function onEvent(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; -export declare function putObject(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; -export declare function deleteObject(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.js b/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.js deleted file mode 100644 index 8271b7315b80d..0000000000000 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integ.provider.js.snapshot/asset.4395b44839a882f77d9467a415b5a45ab1eee138cf0d9ce078d6b366890040aa/index.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.deleteObject = exports.putObject = exports.onEvent = void 0; -/* eslint-disable no-console */ -const AWS = require("aws-sdk"); -const api = require("./api"); -const s3 = new AWS.S3(); -async function onEvent(event) { - switch (event.RequestType) { - case 'Create': - case 'Update': - return putObject(event); - case 'Delete': - return deleteObject(event); - } -} -exports.onEvent = onEvent; -async function putObject(event) { - const bucketName = event.ResourceProperties[api.PROP_BUCKET_NAME]; - if (!bucketName) { - throw new Error('"BucketName" is required'); - } - const contents = event.ResourceProperties[api.PROP_CONTENTS]; - if (!contents) { - throw new Error('"Contents" is required'); - } - // determine the object key which is the physical ID of the resource. - // if it was not provided by the user, we generated it using the request ID. - let objectKey = event.ResourceProperties[api.PROP_OBJECT_KEY] || event.LogicalResourceId + '-' + event.RequestId.replace(/-/g, '') + '.txt'; - // trim trailing `/` - if (objectKey.startsWith('/')) { - objectKey = objectKey.slice(1); - } - const publicRead = event.ResourceProperties[api.PROP_PUBLIC] || false; - console.log(`writing s3://${bucketName}/${objectKey}`); - const resp = await s3.putObject({ - Bucket: bucketName, - Key: objectKey, - Body: contents, - ACL: publicRead ? 'public-read' : undefined, - }).promise(); - // NOTE: updates to the object key will be handled automatically: a new object will be put and then we return - // the new name. this will tell cloudformation that the resource has been replaced and it will issue a DELETE - // for the old object. - return { - PhysicalResourceId: objectKey, - Data: { - [api.ATTR_OBJECT_KEY]: objectKey, - [api.ATTR_ETAG]: resp.ETag, - [api.ATTR_URL]: `https://${bucketName}.s3.amazonaws.com/${objectKey}`, - }, - }; -} -exports.putObject = putObject; -async function deleteObject(event) { - const bucketName = event.ResourceProperties.BucketName; - if (!bucketName) { - throw new Error('"BucketName" is required'); - } - const objectKey = event.PhysicalResourceId; - if (!objectKey) { - throw new Error('PhysicalResourceId expected for DELETE events'); - } - await s3.deleteObject({ - Bucket: bucketName, - Key: objectKey, - }).promise(); -} -exports.deleteObject = deleteObject; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsK0JBQStCO0FBQy9CLDZCQUE2QjtBQUU3QixNQUFNLEVBQUUsR0FBRyxJQUFJL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4gIGNvbnN0IGJ1Y2tldE5hbWUgPSBldmVudC5SZXNvdXJjZVByb3BlcnRpZXMuQnVja2V0TmFtZTtcbiAgaWYgKCFidWNrZXROYW1lKSB7IHRocm93IG5ldyBFcnJvcignXCJCdWNrZXROYW1lXCIgaXMgcmVxdWlyZWQnKTsgfVxuXG4gIGNvbnN0IG9iamVjdEtleSA9IGV2ZW50LlBoeXNpY2FsUmVzb3VyY2VJZDtcbiAgaWYgKCFvYmplY3RLZXkpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoJ1BoeXNpY2FsUmVzb3VyY2VJZCBleHBlY3RlZCBmb3IgREVMRVRFIGV2ZW50cycpO1xuICB9XG5cbiAgYXdhaXQgczMuZGVsZXRlT2JqZWN0KHtcbiAgICBCdWNrZXQ6IGJ1Y2tldE5hbWUsXG4gICAgS2V5OiBvYmplY3RLZXksXG4gIH0pLnByb21pc2UoKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts deleted file mode 100644 index e20403d0cccac..0000000000000 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts +++ /dev/null @@ -1,95 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { CustomResource, Duration, Stack } from '@aws-cdk/core'; -import { Construct, Node } from 'constructs'; -import * as cr from '../../../lib'; - -export interface S3AssertProps { - /** - * The s3 bucket to query. - */ - readonly bucket: s3.IBucket; - - /** - * The object key. - */ - readonly objectKey: string; - - /** - * The expected contents. - */ - readonly expectedContent: string; -} - -/** - * A custom resource that asserts that a file on s3 has the specified contents. - * This resource will wait 10 minutes before, allowing for eventual consistency - * to stabilize (and also exercises the idea of asynchronous custom resources). - * - * Code is written in Python because why not. - */ -export class S3Assert extends Construct { - - constructor(scope: Construct, id: string, props: S3AssertProps) { - super(scope, id); - - new CustomResource(this, 'Resource', { - serviceToken: S3AssertProvider.getOrCreate(this), - resourceType: 'Custom::S3Assert', - properties: { - BucketName: props.bucket.bucketName, - ObjectKey: props.objectKey, - ExpectedContent: props.expectedContent, - }, - }); - } -} - -class S3AssertProvider extends Construct { - - /** - * Returns the singleton provider. - */ - public static getOrCreate(scope: Construct) { - const providerId = 'com.amazonaws.cdk.custom-resources.s3assert-provider'; - const stack = Stack.of(scope); - const group = Node.of(stack).tryFindChild(providerId) as S3AssertProvider || new S3AssertProvider(stack, providerId); - return group.provider.serviceToken; - } - - private readonly provider: cr.Provider; - - constructor(scope: Construct, id: string) { - super(scope, id); - - const onEvent = new lambda.Function(this, 's3assert-on-event', { - code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), - runtime: lambda.Runtime.PYTHON_3_7, - handler: 'index.on_event', - }); - - const isComplete = new lambda.Function(this, 's3assert-is-complete', { - code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), - runtime: lambda.Runtime.PYTHON_3_7, - handler: 'index.is_complete', - initialPolicy: [ - new iam.PolicyStatement({ - resources: ['*'], - actions: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - ], - }), - ], - }); - - this.provider = new cr.Provider(this, 's3assert-provider', { - onEventHandler: onEvent, - isCompleteHandler: isComplete, - totalTimeout: Duration.minutes(5), - }); - } -} diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts b/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts deleted file mode 100644 index 9eae5e43e74db..0000000000000 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { CustomResource, Stack } from '@aws-cdk/core'; -import { Construct, Node } from 'constructs'; -import * as api from './s3-file-handler/api'; -import * as cr from '../../../lib'; - -interface S3FileProps { - /** - * The bucket in which the file will be created. - */ - readonly bucket: s3.IBucket; - - /** - * The object key. - * - * @default - automatically-generated - */ - readonly objectKey?: string; - - /** - * The contents of the file. - */ - readonly contents: string; - - /** - * Indicates if this file should have public-read permissions. - * - * @default false - */ - readonly public?: boolean; -} - -export class S3File extends Construct { - public readonly objectKey: string; - public readonly url: string; - public readonly etag: string; - - constructor(scope: Construct, id: string, props: S3FileProps) { - super(scope, id); - - const resource = new CustomResource(this, 'Resource', { - serviceToken: S3FileProvider.getOrCreate(this), - resourceType: 'Custom::S3File', - properties: { - [api.PROP_BUCKET_NAME]: props.bucket.bucketName, - [api.PROP_CONTENTS]: props.contents, - [api.PROP_OBJECT_KEY]: props.objectKey, - [api.PROP_PUBLIC]: props.public, - }, - }); - - this.objectKey = resource.getAttString(api.ATTR_OBJECT_KEY); - this.url = resource.getAttString(api.ATTR_URL); - this.etag = resource.getAttString(api.ATTR_ETAG); - } -} - -class S3FileProvider extends Construct { - - /** - * Returns the singleton provider. - */ - public static getOrCreate(scope: Construct) { - const stack = Stack.of(scope); - const id = 'com.amazonaws.cdk.custom-resources.s3file-provider'; - const x = Node.of(stack).tryFindChild(id) as S3FileProvider || new S3FileProvider(stack, id); - return x.provider.serviceToken; - } - - private readonly provider: cr.Provider; - - constructor(scope: Construct, id: string) { - super(scope, id); - - this.provider = new cr.Provider(this, 's3file-provider', { - onEventHandler: new lambda.Function(this, 's3file-on-event', { - code: lambda.Code.fromAsset(path.join(__dirname, 's3-file-handler')), - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.onEvent', - initialPolicy: [ - new iam.PolicyStatement({ - resources: ['*'], - actions: [ - 's3:GetObject*', - 's3:GetBucket*', - 's3:List*', - 's3:DeleteObject*', - 's3:PutObject*', - 's3:Abort*', - ], - }), - ], - }), - }); - } -} diff --git a/packages/@aws-cdk/example-construct-library/.eslintrc.js b/packages/@aws-cdk/example-construct-library/.eslintrc.js index 2658ee8727166..73d2505a85a7f 100644 --- a/packages/@aws-cdk/example-construct-library/.eslintrc.js +++ b/packages/@aws-cdk/example-construct-library/.eslintrc.js @@ -1,3 +1,4 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; +baseConfig.rules['import/order'] = 'off'; module.exports = baseConfig; diff --git a/packages/@aws-cdk/example-construct-library/lib/example-resource.ts b/packages/@aws-cdk/example-construct-library/lib/example-resource.ts index 29b15c51ff057..f55c98f495fe1 100644 --- a/packages/@aws-cdk/example-construct-library/lib/example-resource.ts +++ b/packages/@aws-cdk/example-construct-library/lib/example-resource.ts @@ -6,12 +6,12 @@ * Our linter also enforces ES6-style imports - * we don't use TypeScript's import a = require('a') imports. */ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as core from '@aws-cdk/core'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as core from 'aws-cdk-lib'; import { Construct } from 'constructs'; // for files that are part of this package, we do import individual classes or functions import { exampleResourceArnComponents } from './private/example-resource-common'; diff --git a/packages/@aws-cdk/example-construct-library/lib/private/example-resource-common.ts b/packages/@aws-cdk/example-construct-library/lib/private/example-resource-common.ts index ec95e51fa4825..a0d9f86091322 100644 --- a/packages/@aws-cdk/example-construct-library/lib/private/example-resource-common.ts +++ b/packages/@aws-cdk/example-construct-library/lib/private/example-resource-common.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from 'aws-cdk-lib'; // This file contains utility functions used in the implementation of ExampleResource // which we don't want to make part of the public API of this module diff --git a/packages/@aws-cdk/example-construct-library/package.json b/packages/@aws-cdk/example-construct-library/package.json index 7bdbcc37987ff..8250f37317d95 100644 --- a/packages/@aws-cdk/example-construct-library/package.json +++ b/packages/@aws-cdk/example-construct-library/package.json @@ -73,7 +73,7 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", + "aws-cdk-lib": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/pkglint": "0.0.0", @@ -81,22 +81,12 @@ "jest": "^27.5.1" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, "separate-module": false, diff --git a/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts b/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts index cbfb43344ad25..fa9ea68fe0179 100644 --- a/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts +++ b/packages/@aws-cdk/example-construct-library/test/example-resource.test.ts @@ -4,12 +4,12 @@ * but it's considered Names, and we want to migrate to Jest). */ -import { Match, Template } from '@aws-cdk/assertions'; +import { Match, Template } from 'aws-cdk-lib/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as core from '@aws-cdk/core'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as core from 'aws-cdk-lib'; // Always import the module you're testing qualified - // don't import individual classes from it! diff --git a/packages/@aws-cdk/example-construct-library/test/integ.example-resource.ts b/packages/@aws-cdk/example-construct-library/test/integ.example-resource.ts index 93d082da24989..59bfe78e4c4a5 100644 --- a/packages/@aws-cdk/example-construct-library/test/integ.example-resource.ts +++ b/packages/@aws-cdk/example-construct-library/test/integ.example-resource.ts @@ -8,7 +8,7 @@ * see the main CONTRIBUTING.md file. */ -import * as core from '@aws-cdk/core'; +import * as core from 'aws-cdk-lib'; // as in unit tests, we use a qualified import, // not bring in individual classes import * as er from '../lib'; diff --git a/packages/@aws-cdk/integ-runner/package.json b/packages/@aws-cdk/integ-runner/package.json index 80458664ac0a9..50122ca3d324a 100644 --- a/packages/@aws-cdk/integ-runner/package.json +++ b/packages/@aws-cdk/integ-runner/package.json @@ -53,7 +53,7 @@ "license": "Apache-2.0", "devDependencies": { "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/fs-extra": "^9.0.13", "@types/jest": "^27.5.2", diff --git a/packages/@aws-cdk/integ-tests/.eslintrc.js b/packages/@aws-cdk/integ-tests/.eslintrc.js index 2658ee8727166..b284f20df26e9 100644 --- a/packages/@aws-cdk/integ-tests/.eslintrc.js +++ b/packages/@aws-cdk/integ-tests/.eslintrc.js @@ -1,3 +1,8 @@ const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; + +baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ]; +baseConfig.rules['import/order'] = 'off'; +baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off'; + module.exports = baseConfig; diff --git a/packages/@aws-cdk/integ-tests/.gitignore b/packages/@aws-cdk/integ-tests/.gitignore index 17a41566f0002..34344c8e50f01 100644 --- a/packages/@aws-cdk/integ-tests/.gitignore +++ b/packages/@aws-cdk/integ-tests/.gitignore @@ -16,4 +16,5 @@ nyc.config.js !.eslintrc.js junit.xml -!jest.config.js \ No newline at end of file +!jest.config.js +* diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/api-call-base.ts b/packages/@aws-cdk/integ-tests/lib/assertions/api-call-base.ts index 12a4f9f614877..6904a75e3fdb8 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/api-call-base.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/api-call-base.ts @@ -1,4 +1,4 @@ -import { CustomResource, Reference } from '@aws-cdk/core'; +import { CustomResource, Reference } from 'aws-cdk-lib'; import { Construct, IConstruct } from 'constructs'; import { ExpectedResult } from './common'; import { AssertionsProvider } from './providers'; diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/assertions.ts b/packages/@aws-cdk/integ-tests/lib/assertions/assertions.ts index 6442c07318aee..f6db29e52ac79 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/assertions.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/assertions.ts @@ -1,4 +1,4 @@ -import { CustomResource, CfnOutput } from '@aws-cdk/core'; +import { CustomResource, CfnOutput } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { ExpectedResult, ActualResult } from './common'; import { md5hash } from './private/hash'; diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/common.ts b/packages/@aws-cdk/integ-tests/lib/assertions/common.ts index 13c1e50cddc08..c967754b299a5 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/common.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/common.ts @@ -1,4 +1,4 @@ -import { CustomResource } from '@aws-cdk/core'; +import { CustomResource } from 'aws-cdk-lib'; import { IApiCall } from './api-call-base'; /** diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/private/deploy-assert.ts b/packages/@aws-cdk/integ-tests/lib/assertions/private/deploy-assert.ts index 0d15f14daa35c..f4358a2221434 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/private/deploy-assert.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/private/deploy-assert.ts @@ -1,4 +1,4 @@ -import { Stack } from '@aws-cdk/core'; +import { Stack } from 'aws-cdk-lib'; import { Construct, IConstruct, Node } from 'constructs'; import { IApiCall } from '../api-call-base'; import { EqualsAssertion } from '../assertions'; diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/private/hash.ts b/packages/@aws-cdk/integ-tests/lib/assertions/private/hash.ts index 0dc4b4ad5f5c9..1acee28576b73 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/private/hash.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/private/hash.ts @@ -1,4 +1,4 @@ -import { md5hash as coreMd5 } from '@aws-cdk/core/lib/helpers-internal'; +import { md5hash as coreMd5 } from 'aws-cdk-lib/core/lib/helpers-internal'; export function md5hash(obj: any): string { if (!obj || (typeof(obj) === 'object' && Object.keys(obj).length === 0)) { diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/providers/lambda-handler/assertion.ts b/packages/@aws-cdk/integ-tests/lib/assertions/providers/lambda-handler/assertion.ts index 8495cc9643d83..354344c43633f 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/providers/lambda-handler/assertion.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/providers/lambda-handler/assertion.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ // eslint-disable-next-line import/no-extraneous-dependencies -import { Match, Matcher } from '@aws-cdk/assertions/lib/helpers-internal'; +import { Match, Matcher } from 'aws-cdk-lib/assertions/lib/helpers-internal'; import { CustomResourceHandler } from './base'; import { AssertionResult, AssertionRequest } from './types'; diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/providers/provider.ts b/packages/@aws-cdk/integ-tests/lib/assertions/providers/provider.ts index cd8afbc2a0050..7b495d69213a7 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/providers/provider.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/providers/provider.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { Duration, CfnResource, AssetStaging, Stack, FileAssetPackaging, Token, Lazy, Reference } from '@aws-cdk/core'; +import { Duration, CfnResource, AssetStaging, Stack, FileAssetPackaging, Token, Lazy, Reference } from 'aws-cdk-lib'; import { Construct } from 'constructs'; let SDK_METADATA: any = undefined; diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/sdk.ts b/packages/@aws-cdk/integ-tests/lib/assertions/sdk.ts index 1f4084670062c..bfc1dfa4674be 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/sdk.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/sdk.ts @@ -1,4 +1,4 @@ -import { ArnFormat, CfnResource, CustomResource, Lazy, Stack, Aspects, CfnOutput } from '@aws-cdk/core'; +import { ArnFormat, CfnResource, CustomResource, Lazy, Stack, Aspects, CfnOutput } from 'aws-cdk-lib'; import { Construct, IConstruct } from 'constructs'; import { ApiCallBase, IApiCall } from './api-call-base'; import { ExpectedResult } from './common'; diff --git a/packages/@aws-cdk/integ-tests/lib/assertions/waiter-state-machine.ts b/packages/@aws-cdk/integ-tests/lib/assertions/waiter-state-machine.ts index 5b994265b6bc8..63bbfe7779fe1 100644 --- a/packages/@aws-cdk/integ-tests/lib/assertions/waiter-state-machine.ts +++ b/packages/@aws-cdk/integ-tests/lib/assertions/waiter-state-machine.ts @@ -1,4 +1,4 @@ -import { CfnResource, Duration, Stack } from '@aws-cdk/core'; +import { CfnResource, Duration, Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { AssertionsProvider } from './providers'; diff --git a/packages/@aws-cdk/integ-tests/lib/manifest-synthesizer.ts b/packages/@aws-cdk/integ-tests/lib/manifest-synthesizer.ts index 61274f7c84ab9..ff3e400fa04a1 100644 --- a/packages/@aws-cdk/integ-tests/lib/manifest-synthesizer.ts +++ b/packages/@aws-cdk/integ-tests/lib/manifest-synthesizer.ts @@ -1,5 +1,5 @@ -import { IntegManifest, Manifest } from '@aws-cdk/cloud-assembly-schema'; -import { ISynthesisSession } from '@aws-cdk/core'; +import { IntegManifest, Manifest } from 'aws-cdk-lib/cloud-assembly-schema'; +import { ISynthesisSession } from 'aws-cdk-lib'; import { IntegManifestWriter } from './manifest-writer'; import { IntegTestCase } from './test-case'; diff --git a/packages/@aws-cdk/integ-tests/lib/manifest-writer.ts b/packages/@aws-cdk/integ-tests/lib/manifest-writer.ts index 3ad2d03d61293..5d4468e2494f6 100644 --- a/packages/@aws-cdk/integ-tests/lib/manifest-writer.ts +++ b/packages/@aws-cdk/integ-tests/lib/manifest-writer.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import { IntegManifest, Manifest } from '@aws-cdk/cloud-assembly-schema'; +import { IntegManifest, Manifest } from 'aws-cdk-lib/cloud-assembly-schema'; export class IntegManifestWriter { public static readonly DEFAULT_FILENAME = 'integ.json'; diff --git a/packages/@aws-cdk/integ-tests/lib/test-case.ts b/packages/@aws-cdk/integ-tests/lib/test-case.ts index 50aa946ac155c..dcbd0d3cb209e 100644 --- a/packages/@aws-cdk/integ-tests/lib/test-case.ts +++ b/packages/@aws-cdk/integ-tests/lib/test-case.ts @@ -1,5 +1,5 @@ -import { IntegManifest, Manifest, TestCase, TestOptions } from '@aws-cdk/cloud-assembly-schema'; -import { attachCustomSynthesis, ISynthesisSession, Stack, StackProps } from '@aws-cdk/core'; +import { IntegManifest, Manifest, TestCase, TestOptions } from 'aws-cdk-lib/cloud-assembly-schema'; +import { attachCustomSynthesis, ISynthesisSession, Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IDeployAssert } from './assertions'; import { DeployAssert } from './assertions/private/deploy-assert'; diff --git a/packages/@aws-cdk/integ-tests/package.json b/packages/@aws-cdk/integ-tests/package.json index 25136f2ee90c2..2a239d9c89164 100644 --- a/packages/@aws-cdk/integ-tests/package.json +++ b/packages/@aws-cdk/integ-tests/package.json @@ -1,32 +1,36 @@ { - "name": "@aws-cdk/integ-tests", + "name": "@aws-cdk/integ-tests-alpha", "description": "CDK Integration Testing Constructs", "version": "0.0.0", - "private": true, + "private": false, "main": "lib/index.js", "types": "lib/index.d.ts", "jsii": { "outdir": "dist", "targets": { "java": { - "package": "software.amazon.awscdk.integtests", + "package": "software.amazon.awscdk.integtests.alpha", "maven": { "groupId": "software.amazon.awscdk", - "artifactId": "cdk-integ-tests" + "artifactId": "cdk-integ-tests-alpha" } }, "dotnet": { - "namespace": "Amazon.CDK.IntegTests", - "packageId": "Amazon.CDK.IntegTests", + "namespace": "Amazon.CDK.IntegTests.Alpha", + "packageId": "Amazon.CDK.IntegTests.Alpha", "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" }, "python": { - "distName": "aws-cdk.integ-tests", - "module": "aws_cdk.integ_tests", + "distName": "aws-cdk.integ-tests-alpha", + "module": "aws_cdk.integ_tests_alpha", "classifiers": [ "Framework :: AWS CDK", "Framework :: AWS CDK :: 2" ] + }, + "go": { + "moduleName": "github.com/aws/aws-cdk-go", + "packageName": "awscdkintegtestsalpha" } }, "projectReferences": true, @@ -62,9 +66,7 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/fs-extra": "^9.0.13", @@ -73,16 +75,13 @@ "aws-sdk-mock": "5.6.0", "jest": "^27.5.1", "nock": "^13.3.0", - "sinon": "^9.2.4" - }, - "dependencies": { - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", + "sinon": "^9.2.4", + "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" }, + "dependencies": {}, "peerDependencies": { - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "^0.0.0", "constructs": "^10.0.0" }, "repository": { @@ -108,7 +107,7 @@ }, "awslint": { "exclude": [ - "construct-ctor:@aws-cdk/integ-tests.DeployAssert." + "*:*" ] }, "nozem": { @@ -125,5 +124,11 @@ }, "awscdkio": { "announce": false + }, + "pkglint": { + "exclude": [ + "naming/package-matches-directory", + "assert/assert-dependency" + ] } } diff --git a/packages/@aws-cdk/integ-tests/rosetta/default.ts-fixture b/packages/@aws-cdk/integ-tests/rosetta/default.ts-fixture index 672c09156597f..9ae8a2ab04d7d 100644 --- a/packages/@aws-cdk/integ-tests/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/integ-tests/rosetta/default.ts-fixture @@ -1,4 +1,4 @@ -import * as lambda from '@aws-cdk/aws-lambda'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; import { IntegTestCase, IntegTest, @@ -13,7 +13,7 @@ import { LambdaInvokeFunction, Match, AssertionsProvider, -} from '@aws-cdk/integ-tests'; +} from '@aws-cdk/integ-tests-alpha'; import { Construct } from 'constructs'; import { App, @@ -21,10 +21,10 @@ import { StackProps, CustomResource, Duration, -} from '@aws-cdk/core'; +} from 'aws-cdk-lib'; import * as path from 'path'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { IStateMachine } from '@aws-cdk/aws-stepfunctions'; -import { RequireApproval } from '@aws-cdk/cloud-assembly-schema'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import { IStateMachine } from 'aws-cdk-lib/aws-stepfunctions'; +import { RequireApproval } from 'aws-cdk-lib/cloud-assembly-schema'; /// here diff --git a/packages/@aws-cdk/integ-tests/test/assertions/deploy-assert.test.ts b/packages/@aws-cdk/integ-tests/test/assertions/deploy-assert.test.ts index df7a5253dba62..f196afc3b1e2f 100644 --- a/packages/@aws-cdk/integ-tests/test/assertions/deploy-assert.test.ts +++ b/packages/@aws-cdk/integ-tests/test/assertions/deploy-assert.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, CustomResource, Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { App, CustomResource, Stack } from 'aws-cdk-lib'; import { ActualResult, ExpectedResult, InvocationType, LogType } from '../../lib/assertions'; import { DeployAssert } from '../../lib/assertions/private/deploy-assert'; import { IntegTest } from '../../lib/test-case'; diff --git a/packages/@aws-cdk/integ-tests/test/assertions/providers/integ.assertions.ts b/packages/@aws-cdk/integ-tests/test/assertions/providers/integ.assertions.ts index 783755617537c..06c22f763de8b 100644 --- a/packages/@aws-cdk/integ-tests/test/assertions/providers/integ.assertions.ts +++ b/packages/@aws-cdk/integ-tests/test/assertions/providers/integ.assertions.ts @@ -1,4 +1,4 @@ -import { App, CfnResource, Stack } from '@aws-cdk/core'; +import { App, CfnResource, Stack } from 'aws-cdk-lib'; import { ExpectedResult, IntegTest } from '../../../lib'; const app = new App(); diff --git a/packages/@aws-cdk/integ-tests/test/assertions/providers/provider.test.ts b/packages/@aws-cdk/integ-tests/test/assertions/providers/provider.test.ts index bac228258751a..98d4d6536011b 100644 --- a/packages/@aws-cdk/integ-tests/test/assertions/providers/provider.test.ts +++ b/packages/@aws-cdk/integ-tests/test/assertions/providers/provider.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from 'aws-cdk-lib/assertions'; +import { Stack } from 'aws-cdk-lib'; import { AssertionsProvider } from '../../../lib/assertions'; let stack: Stack; diff --git a/packages/@aws-cdk/integ-tests/test/assertions/sdk.test.ts b/packages/@aws-cdk/integ-tests/test/assertions/sdk.test.ts index 97a9d87cd9b2f..2cd0b30c97bf5 100644 --- a/packages/@aws-cdk/integ-tests/test/assertions/sdk.test.ts +++ b/packages/@aws-cdk/integ-tests/test/assertions/sdk.test.ts @@ -1,5 +1,5 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import { App, CfnOutput, Duration } from '@aws-cdk/core'; +import { Template, Match } from 'aws-cdk-lib/assertions'; +import { App, CfnOutput, Duration } from 'aws-cdk-lib'; import { LogType, InvocationType, ExpectedResult } from '../../lib/assertions'; import { DeployAssert } from '../../lib/assertions/private/deploy-assert'; diff --git a/packages/@aws-cdk/integ-tests/test/manifest-synthesizer.test.ts b/packages/@aws-cdk/integ-tests/test/manifest-synthesizer.test.ts index 982079e7aedfb..8488f7114411d 100644 --- a/packages/@aws-cdk/integ-tests/test/manifest-synthesizer.test.ts +++ b/packages/@aws-cdk/integ-tests/test/manifest-synthesizer.test.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { Manifest } from '@aws-cdk/cloud-assembly-schema'; -import { App, Stack } from '@aws-cdk/core'; -import { CloudAssemblyBuilder } from '@aws-cdk/cx-api'; +import { Manifest } from 'aws-cdk-lib/cloud-assembly-schema'; +import { App, Stack } from 'aws-cdk-lib'; +import { CloudAssemblyBuilder } from 'aws-cdk-lib/cx-api'; import { IntegTestCase, IntegTest, IntegTestCaseStack } from '../lib'; import { IntegManifestSynthesizer } from '../lib/manifest-synthesizer'; import { IntegManifestWriter } from '../lib/manifest-writer'; diff --git a/packages/@aws-cdk/integ-tests/test/manifest-writer.test.ts b/packages/@aws-cdk/integ-tests/test/manifest-writer.test.ts index 537939647b3d7..b47a1c27a8d7b 100644 --- a/packages/@aws-cdk/integ-tests/test/manifest-writer.test.ts +++ b/packages/@aws-cdk/integ-tests/test/manifest-writer.test.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { IntegManifest, Manifest } from '@aws-cdk/cloud-assembly-schema'; +import { IntegManifest, Manifest } from 'aws-cdk-lib/cloud-assembly-schema'; import { IntegManifestWriter } from '../lib/manifest-writer'; describe(IntegManifestWriter, () => { diff --git a/packages/@aws-cdk/lambda-layer-awscli/.eslintrc.js b/packages/@aws-cdk/lambda-layer-awscli/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/lambda-layer-awscli/.gitignore b/packages/@aws-cdk/lambda-layer-awscli/.gitignore deleted file mode 100644 index e3816042b49b3..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -lib/*.zip - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/lambda-layer-awscli/.npmignore b/packages/@aws-cdk/lambda-layer-awscli/.npmignore deleted file mode 100644 index 019ee9deca824..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/lambda-layer-awscli/LICENSE b/packages/@aws-cdk/lambda-layer-awscli/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/lambda-layer-awscli/NOTICE b/packages/@aws-cdk/lambda-layer-awscli/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/lambda-layer-awscli/README.md b/packages/@aws-cdk/lambda-layer-awscli/README.md deleted file mode 100644 index 8221cbe348aa9..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# AWS Lambda Layer with AWS CLI - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - - -This module exports a single class called `AwsCliLayer` which is a `lambda.Layer` that bundles the AWS CLI. - -Any Lambda Function that uses this layer must use a Python 3.x runtime. - -Usage: - -```ts -// AwsCliLayer bundles the AWS CLI in a lambda layer -import { AwsCliLayer } from '@aws-cdk/lambda-layer-awscli'; - -declare const fn: lambda.Function; -fn.addLayers(new AwsCliLayer(this, 'AwsCliLayer')); -``` - -The CLI will be installed under `/opt/awscli/aws`. - -## Alternatives - -This module bundles AWS cli v1. To use AWS cli v2, you can use the -external module [awscdk-asset-awscli](https://github.com/cdklabs/awscdk-asset-awscli/tree/awscli-v2/main). diff --git a/packages/@aws-cdk/lambda-layer-awscli/jest.config.js b/packages/@aws-cdk/lambda-layer-awscli/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/lambda-layer-awscli/package.json b/packages/@aws-cdk/lambda-layer-awscli/package.json deleted file mode 100644 index 7e6cc5e5d7e5e..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "@aws-cdk/lambda-layer-awscli", - "version": "0.0.0", - "description": "An AWS Lambda layer that contains the AWS CLI", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.lambdalayer.awscli", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-lambda-layer-awscli" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.LambdaLayer.AwsCli", - "packageId": "Amazon.CDK.LambdaLayer.AwsCli", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.lambda-layer-awscli", - "module": "aws_cdk.lambda_layer_awscli", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/lambda-layer-awscli" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "example", - "construct", - "library" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/asset-awscli-v1": "^2.2.97", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/asset-awscli-v1": "^2.2.52", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "ubergen": { - "exclude": false - }, - "nozem": { - "ostools": [ - "dirname", - "docker" - ] - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/lambda-layer-awscli/rosetta/default.ts-fixture b/packages/@aws-cdk/lambda-layer-awscli/rosetta/default.ts-fixture deleted file mode 100644 index d3534321d7f54..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as lambda from '@aws-cdk/aws-lambda'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/cdk.out b/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/cdk.out deleted file mode 100644 index ae4b03c54e770..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-kubectl/.eslintrc.js b/packages/@aws-cdk/lambda-layer-kubectl/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/lambda-layer-kubectl/.gitignore b/packages/@aws-cdk/lambda-layer-kubectl/.gitignore deleted file mode 100644 index e3816042b49b3..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -lib/*.zip - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/lambda-layer-kubectl/.npmignore b/packages/@aws-cdk/lambda-layer-kubectl/.npmignore deleted file mode 100644 index 019ee9deca824..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/lambda-layer-kubectl/LICENSE b/packages/@aws-cdk/lambda-layer-kubectl/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/lambda-layer-kubectl/NOTICE b/packages/@aws-cdk/lambda-layer-kubectl/NOTICE deleted file mode 100644 index 35797a0012b2d..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/NOTICE +++ /dev/null @@ -1,37 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - ----------------- - -** kubectl - https://github.com/kubernetes/kubectl -Copyright 2017 The Kubernetes Authors. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ----------------- - -** helm - https://github.com/helm/helm -Copyright 2016 The Kubernetes Authors All Rights Reserved - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/packages/@aws-cdk/lambda-layer-kubectl/README.md b/packages/@aws-cdk/lambda-layer-kubectl/README.md deleted file mode 100644 index 59427504f1a22..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# AWS Lambda Layer with kubectl (and helm) - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module exports a single class called `KubectlLayer` which is a `lambda.Layer` that bundles the [`kubectl`](https://kubernetes.io/docs/reference/kubectl/kubectl/) and the [`helm`](https://helm.sh/) command line. - -> - Helm Version: 3.5.4 -> - Kubectl Version: 1.20.0 -> - -Usage: - -```ts -// KubectlLayer bundles the 'kubectl' and 'helm' command lines -import { KubectlLayer } from '@aws-cdk/lambda-layer-kubectl'; - -declare const fn: lambda.Function; -fn.addLayers(new KubectlLayer(this, 'KubectlLayer')); -``` - -`kubectl` will be installed under `/opt/kubectl/kubectl`, and `helm` will be installed under `/opt/helm/helm`. - -## Alternatives - -This module bundles Kubectl v1.20.0 and the associated helm version -To use alternative Kubectl versions, including the latest available, -you can use the external module -[awscdk-asset-kubectl](https://github.com/cdklabs/awscdk-asset-kubectl). diff --git a/packages/@aws-cdk/lambda-layer-kubectl/jest.config.js b/packages/@aws-cdk/lambda-layer-kubectl/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/lambda-layer-kubectl/package.json b/packages/@aws-cdk/lambda-layer-kubectl/package.json deleted file mode 100644 index a298ea148a731..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/package.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "name": "@aws-cdk/lambda-layer-kubectl", - "version": "0.0.0", - "description": "An AWS Lambda layer that contains the `kubectl` and `helm`", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.lambdalayer.kubectl", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-lambda-layer-kubectl" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.LambdaLayer.Kubectl", - "packageId": "Amazon.CDK.LambdaLayer.Kubectl", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.lambda-layer-kubectl", - "module": "aws_cdk.lambda_layer_kubectl", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/lambda-layer-kubectl" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "example", - "construct", - "library" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "pkglint": { - "attribution": [ - "kubectl", - "helm" - ] - }, - "dependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/asset-kubectl-v20": "^2.1.1", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/asset-kubectl-v20": "^2.1.1", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nozem": { - "ostools": [ - "dirname", - "docker" - ] - }, - "ubergen": { - "exclude": false - }, - "publishConfig": { - "tag": "latest" - }, - "private": true -} diff --git a/packages/@aws-cdk/lambda-layer-kubectl/rosetta/default.ts-fixture b/packages/@aws-cdk/lambda-layer-kubectl/rosetta/default.ts-fixture deleted file mode 100644 index d3534321d7f54..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/rosetta/default.ts-fixture +++ /dev/null @@ -1,12 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import * as lambda from '@aws-cdk/aws-lambda'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - /// here - } -} diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/cdk.out b/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/cdk.out deleted file mode 100644 index ae4b03c54e770..0000000000000 --- a/packages/@aws-cdk/lambda-layer-kubectl/test/integ.kubectl-layer.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.eslintrc.js b/packages/@aws-cdk/lambda-layer-node-proxy-agent/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.gitignore b/packages/@aws-cdk/lambda-layer-node-proxy-agent/.gitignore deleted file mode 100644 index d98c24e1333b2..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -lib/*.zip - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** - -!test/lambda-handler/index.js \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.npmignore b/packages/@aws-cdk/lambda-layer-node-proxy-agent/.npmignore deleted file mode 100644 index 5d96a5edc769d..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.npmignore +++ /dev/null @@ -1,34 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml - -test/ - -!*.lit.ts - -layer/node_modules - -**/*.snapshot diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/LICENSE b/packages/@aws-cdk/lambda-layer-node-proxy-agent/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/NOTICE b/packages/@aws-cdk/lambda-layer-node-proxy-agent/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/README.md b/packages/@aws-cdk/lambda-layer-node-proxy-agent/README.md deleted file mode 100644 index da6471a4950da..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# AWS Lambda Layer with the NPM dependency proxy-agent - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -This module exports a single class called `NodeProxyAgentLayer` which is a `lambda.Layer` that bundles the NPM dependency [`proxy-agent`](https://www.npmjs.com/package/proxy-agent). - -> - proxy-agent Version: 5.0.0 - -Usage: - -```ts -import { NodeProxyAgentLayer } from '@aws-cdk/lambda-layer-node-proxy-agent'; -import * as lambda from '@aws-cdk/aws-lambda'; - -declare const fn: lambda.Function; -fn.addLayers(new NodeProxyAgentLayer(this, 'NodeProxyAgentLayer')); -``` - -[`proxy-agent`](https://www.npmjs.com/package/proxy-agent) will be installed under `/nodejs/node_modules`. diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/jest.config.js b/packages/@aws-cdk/lambda-layer-node-proxy-agent/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/package.json b/packages/@aws-cdk/lambda-layer-node-proxy-agent/package.json deleted file mode 100644 index 17f369d855bfe..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "@aws-cdk/lambda-layer-node-proxy-agent", - "version": "0.0.0", - "description": "An AWS Lambda layer that contains the `proxy-agent` NPM dependency", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.lambda.layer.node.proxy.agent", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-lambda-layer-node-proxy-agent" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.LambdaLayer.NodeProxyAgent", - "packageId": "Amazon.CDK.LambdaLayer.NodeProxyAgent", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.lambda-layer-node-proxy-agent", - "module": "aws_cdk.lambda_layer_node_proxy_agent", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 1" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/lambda-layer-node-proxy-agent" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "example", - "construct", - "library" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/asset-node-proxy-agent-v5": "^2.0.77", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/asset-node-proxy-agent-v5": "^2.0.42", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "nozem": { - "ostools": [ - "dirname", - "docker" - ] - }, - "ubergen": { - "exclude": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/rosetta/default.ts-fixture b/packages/@aws-cdk/lambda-layer-node-proxy-agent/rosetta/default.ts-fixture deleted file mode 100644 index 50d86e8a055ce..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/rosetta/default.ts-fixture +++ /dev/null @@ -1,10 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/cdk.out b/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/cdk.out deleted file mode 100644 index ae4b03c54e770..0000000000000 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/integ.node-proxy-agent.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/.eslintrc.js b/packages/@aws-cdk/pipelines/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/pipelines/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/pipelines/.gitignore b/packages/@aws-cdk/pipelines/.gitignore deleted file mode 100644 index 57c54ea685c55..0000000000000 --- a/packages/@aws-cdk/pipelines/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -*.js -tsconfig.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js - -!jest.config.js -junit.xml - -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/pipelines/.npmignore b/packages/@aws-cdk/pipelines/.npmignore deleted file mode 100644 index 9227cc28d59c7..0000000000000 --- a/packages/@aws-cdk/pipelines/.npmignore +++ /dev/null @@ -1,31 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -jest.config.js -junit.xml -package/node_modules -test/ - -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/pipelines/LICENSE b/packages/@aws-cdk/pipelines/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/pipelines/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/pipelines/NOTICE b/packages/@aws-cdk/pipelines/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/pipelines/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/pipelines/README.md b/packages/@aws-cdk/pipelines/README.md deleted file mode 100644 index 48b3611dd517e..0000000000000 --- a/packages/@aws-cdk/pipelines/README.md +++ /dev/null @@ -1,1750 +0,0 @@ -# CDK Pipelines - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -A construct library for painless Continuous Delivery of CDK applications. - -CDK Pipelines is an *opinionated construct library*. It is purpose-built to -deploy one or more copies of your CDK applications using CloudFormation with a -minimal amount of effort on your part. It is *not* intended to support arbitrary -deployment pipelines, and very specifically it is not built to use CodeDeploy to -deploy applications to instances, or deploy your custom-built ECR images to an ECS -cluster directly: use CDK file assets with CloudFormation Init for instances, or -CDK container assets for ECS clusters instead. - -Give the CDK Pipelines way of doing things a shot first: you might find it does -everything you need. If you want or need more control, we recommend you drop -down to using the `aws-codepipeline` construct library directly. - -> This module contains two sets of APIs: an **original** and a **modern** version of -CDK Pipelines. The *modern* API has been updated to be easier to work with and -customize, and will be the preferred API going forward. The *original* version -of the API is still available for backwards compatibility, but we recommend migrating -to the new version if possible. -> -> Compared to the original API, the modern API: has more sensible defaults; is -> more flexible; supports parallel deployments; supports multiple synth inputs; -> allows more control of CodeBuild project generation; supports deployment -> engines other than CodePipeline. -> -> The README for the original API, as well as a migration guide, can be found in [our GitHub repository](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/pipelines/ORIGINAL_API.md). - -## At a glance - -Deploying your application continuously starts by defining a -`MyApplicationStage`, a subclass of `Stage` that contains the stacks that make -up a single copy of your application. - -You then define a `Pipeline`, instantiate as many instances of -`MyApplicationStage` as you want for your test and production environments, with -different parameters for each, and calling `pipeline.addStage()` for each of -them. You can deploy to the same account and Region, or to a different one, -with the same amount of code. The *CDK Pipelines* library takes care of the -details. - -CDK Pipelines supports multiple *deployment engines* (see -[Using a different deployment engine](#using-a-different-deployment-engine)), -and comes with a deployment engine that deploys CDK apps using AWS CodePipeline. -To use the CodePipeline engine, define a `CodePipeline` construct. The following -example creates a CodePipeline that deploys an application from GitHub: - -```ts -/** The stacks for our app are minimally defined here. The internals of these - * stacks aren't important, except that DatabaseStack exposes an attribute - * "table" for a database table it defines, and ComputeStack accepts a reference - * to this table in its properties. - */ -class DatabaseStack extends Stack { - public readonly table: dynamodb.Table; - - constructor(scope: Construct, id: string) { - super(scope, id); - this.table = new dynamodb.Table(this, 'Table', { - partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING } - }); - } -} - -interface ComputeProps { - readonly table: dynamodb.Table; -} - -class ComputeStack extends Stack { - constructor(scope: Construct, id: string, props: ComputeProps) { - super(scope, id); - } -} - -/** - * Stack to hold the pipeline - */ -class MyPipelineStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - // Use a connection created using the AWS console to authenticate to GitHub - // Other sources are available. - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: [ - 'npm ci', - 'npm run build', - 'npx cdk synth', - ], - }), - }); - - // 'MyApplication' is defined below. Call `addStage` as many times as - // necessary with any account and region (may be different from the - // pipeline's). - pipeline.addStage(new MyApplication(this, 'Prod', { - env: { - account: '123456789012', - region: 'eu-west-1', - }, - })); - } -} - -/** - * Your application - * - * May consist of one or more Stacks (here, two) - * - * By declaring our DatabaseStack and our ComputeStack inside a Stage, - * we make sure they are deployed together, or not at all. - */ -class MyApplication extends Stage { - constructor(scope: Construct, id: string, props?: StageProps) { - super(scope, id, props); - - const dbStack = new DatabaseStack(this, 'Database'); - new ComputeStack(this, 'Compute', { - table: dbStack.table, - }); - } -} - -// In your main file -new MyPipelineStack(this, 'PipelineStack', { - env: { - account: '123456789012', - region: 'eu-west-1', - } -}); -``` - -The pipeline is **self-mutating**, which means that if you add new -application stages in the source code, or new stacks to `MyApplication`, the -pipeline will automatically reconfigure itself to deploy those new stages and -stacks. - -(Note that you have to *bootstrap* all environments before the above code -will work, and switch on "Modern synthesis" if you are using -CDKv1. See the section **CDK Environment Bootstrapping** below for -more information). - -## Provisioning the pipeline - -To provision the pipeline you have defined, make sure the target environment -has been bootstrapped (see below), and then execute deploying the -`PipelineStack` *once*. Afterwards, the pipeline will keep itself up-to-date. - -> **Important**: be sure to `git commit` and `git push` before deploying the -> Pipeline stack using `cdk deploy`! -> -> The reason is that the pipeline will start deploying and self-mutating -> right away based on the sources in the repository, so the sources it finds -> in there should be the ones you want it to find. - -Run the following commands to get the pipeline going: - -```console -$ git commit -a -$ git push -$ cdk deploy PipelineStack -``` - -Administrative permissions to the account are only necessary up until -this point. We recommend you remove access to these credentials after doing this. - -### Working on the pipeline - -The self-mutation feature of the Pipeline might at times get in the way -of the pipeline development workflow. Each change to the pipeline must be pushed -to git, otherwise, after the pipeline was updated using `cdk deploy`, it will -automatically revert to the state found in git. - -To make the development more convenient, the self-mutation feature can be turned -off temporarily, by passing `selfMutation: false` property, example: - -```ts -// Modern API -const modernPipeline = new pipelines.CodePipeline(this, 'Pipeline', { - selfMutation: false, - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: [ - 'npm ci', - 'npm run build', - 'npx cdk synth', - ], - }), -}); - -// Original API -const cloudAssemblyArtifact = new codepipeline.Artifact(); -const originalPipeline = new pipelines.CdkPipeline(this, 'Pipeline', { - selfMutating: false, - cloudAssemblyArtifact, -}); -``` - -## Defining the pipeline - -This section of the documentation describes the AWS CodePipeline engine, -which comes with this library. If you want to use a different deployment -engine, read the section -[Using a different deployment engine](#using-a-different-deployment-engine) below. - -### Synth and sources - -To define a pipeline, instantiate a `CodePipeline` construct from the -`@aws-cdk/pipelines` module. It takes one argument, a `synth` step, which is -expected to produce the CDK Cloud Assembly as its single output (the contents of -the `cdk.out` directory after running `cdk synth`). "Steps" are arbitrary -actions in the pipeline, typically used to run scripts or commands. - -For the synth, use a `ShellStep` and specify the commands necessary to install -dependencies, the CDK CLI, build your project and run `cdk synth`; the specific -commands required will depend on the programming language you are using. For a -typical NPM-based project, the synth will look like this: - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: [ - 'npm ci', - 'npm run build', - 'npx cdk synth', - ], - }), -}); -``` - -The pipeline assumes that your `ShellStep` will produce a `cdk.out` -directory in the root, containing the CDK cloud assembly. If your -CDK project lives in a subdirectory, be sure to adjust the -`primaryOutputDirectory` to match: - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: [ - 'cd mysubdir', - 'npm ci', - 'npm run build', - 'npx cdk synth', - ], - primaryOutputDirectory: 'mysubdir/cdk.out', - }), -}); -``` - -The underlying `@aws-cdk/aws-codepipeline.Pipeline` construct will be produced -when `app.synth()` is called. You can also force it to be produced -earlier by calling `pipeline.buildPipeline()`. After you've called -that method, you can inspect the constructs that were produced by -accessing the properties of the `pipeline` object. - -#### Commands for other languages and package managers - -The commands you pass to `new ShellStep` will be very similar to the commands -you run on your own workstation to install dependencies and synth your CDK -project. Here are some (non-exhaustive) examples for what those commands might -look like in a number of different situations. - -For Yarn, the install commands are different: - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: [ - 'yarn install --frozen-lockfile', - 'yarn build', - 'npx cdk synth', - ], - }) -}); -``` - -For Python projects, remember to install the CDK CLI globally (as -there is no `package.json` to automatically install it for you): - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: [ - 'pip install -r requirements.txt', - 'npm install -g aws-cdk', - 'cdk synth', - ], - }) -}); -``` - -For Java projects, remember to install the CDK CLI globally (as -there is no `package.json` to automatically install it for you), -and the Maven compilation step is automatically executed for you -as you run `cdk synth`: - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: [ - 'npm install -g aws-cdk', - 'cdk synth', - ], - }) -}); -``` - -You can adapt these examples to your own situation. - -#### Migrating from buildspec.yml files - -You may currently have the build instructions for your CodeBuild Projects in a -`buildspec.yml` file in your source repository. In addition to your build -commands, the CodeBuild Project's buildspec also controls some information that -CDK Pipelines manages for you, like artifact identifiers, input artifact -locations, Docker authorization, and exported variables. - -Since there is no way in general for CDK Pipelines to modify the file in your -resource repository, CDK Pipelines configures the BuildSpec directly on the -CodeBuild Project, instead of loading it from the `buildspec.yml` file. -This requires a pipeline self-mutation to update. - -To avoid this, put your build instructions in a separate script, for example -`build.sh`, and call that script from the build `commands` array: - -```ts -declare const source: pipelines.IFileSetProducer; - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: [ - // Abstract over doing the build - './build.sh', - ], - }) -}); -``` - -Doing so keeps your exact build instructions in sync with your source code in -the source repository where it belongs, and provides a convenient build script -for developers at the same time. - -#### CodePipeline Sources - -In CodePipeline, *Sources* define where the source of your application lives. -When a change to the source is detected, the pipeline will start executing. -Source objects can be created by factory methods on the `CodePipelineSource` class: - -##### GitHub, GitHub Enterprise, BitBucket using a connection - -The recommended way of connecting to GitHub or BitBucket is by using a *connection*. -You will first use the AWS Console to authenticate to the source control -provider, and then use the connection ARN in your pipeline definition: - -```ts -pipelines.CodePipelineSource.connection('org/repo', 'branch', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', -}); -``` - -##### GitHub using OAuth - -You can also authenticate to GitHub using a personal access token. This expects -that you've created a personal access token and stored it in Secrets Manager. -By default, the source object will look for a secret named **github-token**, but -you can change the name. The token should have the **repo** and **admin:repo_hook** -scopes. - -```ts -pipelines.CodePipelineSource.gitHub('org/repo', 'branch', { - // This is optional - authentication: cdk.SecretValue.secretsManager('my-token'), -}); -``` - -##### CodeCommit - -You can use a CodeCommit repository as the source. Either create or import -that the CodeCommit repository and then use `CodePipelineSource.codeCommit` -to reference it: - -```ts -const repository = codecommit.Repository.fromRepositoryName(this, 'Repository', 'my-repository'); -pipelines.CodePipelineSource.codeCommit(repository, 'main'); -``` - -##### S3 - -You can use a zip file in S3 as the source of the pipeline. The pipeline will be -triggered every time the file in S3 is changed: - -```ts -const bucket = s3.Bucket.fromBucketName(this, 'Bucket', 'my-bucket'); -pipelines.CodePipelineSource.s3(bucket, 'my/source.zip'); -``` - -##### ECR - -You can use a Docker image in ECR as the source of the pipeline. The pipeline will be -triggered every time an image is pushed to ECR: - -```ts -const repository = new ecr.Repository(this, 'Repository'); -pipelines.CodePipelineSource.ecr(repository); -``` - -#### Additional inputs - -`ShellStep` allows passing in more than one input: additional -inputs will be placed in the directories you specify. Any step that produces an -output file set can be used as an input, such as a `CodePipelineSource`, but -also other `ShellStep`: - -```ts -const prebuild = new pipelines.ShellStep('Prebuild', { - input: pipelines.CodePipelineSource.gitHub('myorg/repo1', 'main'), - primaryOutputDirectory: './build', - commands: ['./build.sh'], -}); - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.gitHub('myorg/repo2', 'main'), - additionalInputs: { - 'subdir': pipelines.CodePipelineSource.gitHub('myorg/repo3', 'main'), - '../siblingdir': prebuild, - }, - - commands: ['./build.sh'], - }) -}); -``` - -### CDK application deployments - -After you have defined the pipeline and the `synth` step, you can add one or -more CDK `Stages` which will be deployed to their target environments. To do -so, call `pipeline.addStage()` on the Stage object: - -```ts -declare const pipeline: pipelines.CodePipeline; -// Do this as many times as necessary with any account and region -// Account and region may different from the pipeline's. -pipeline.addStage(new MyApplicationStage(this, 'Prod', { - env: { - account: '123456789012', - region: 'eu-west-1', - } -})); -``` - -CDK Pipelines will automatically discover all `Stacks` in the given `Stage` -object, determine their dependency order, and add appropriate actions to the -pipeline to publish the assets referenced in those stacks and deploy the stacks -in the right order. - -If the `Stacks` are targeted at an environment in a different AWS account or -Region and that environment has been -[bootstrapped](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html) -, CDK Pipelines will transparently make sure the IAM roles are set up -correctly and any requisite replication Buckets are created. - -#### Deploying in parallel - -By default, all applications added to CDK Pipelines by calling `addStage()` will -be deployed in sequence, one after the other. If you have a lot of stages, you can -speed up the pipeline by choosing to deploy some stages in parallel. You do this -by calling `addWave()` instead of `addStage()`: a *wave* is a set of stages that -are all deployed in parallel instead of sequentially. Waves themselves are still -deployed in sequence. For example, the following will deploy two copies of your -application to `eu-west-1` and `eu-central-1` in parallel: - -```ts -declare const pipeline: pipelines.CodePipeline; -const europeWave = pipeline.addWave('Europe'); -europeWave.addStage(new MyApplicationStage(this, 'Ireland', { - env: { region: 'eu-west-1' } -})); -europeWave.addStage(new MyApplicationStage(this, 'Germany', { - env: { region: 'eu-central-1' } -})); -``` - -#### Deploying to other accounts / encrypting the Artifact Bucket - -CDK Pipelines can transparently deploy to other Regions and other accounts -(provided those target environments have been -[*bootstrapped*](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)). -However, deploying to another account requires one additional piece of -configuration: you need to enable `crossAccountKeys: true` when creating the -pipeline. - -This will encrypt the artifact bucket(s), but incurs a cost for maintaining the -KMS key. - -You may also wish to enable automatic key rotation for the created KMS key. - -Example: - -```ts -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - // Encrypt artifacts, required for cross-account deployments - crossAccountKeys: true, - enableKeyRotation: true, // optional - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: [ - 'npm ci', - 'npm run build', - 'npx cdk synth', - ], - }), -}); -``` - -#### Deploying without change sets - -Deployment is done by default with `CodePipeline` engine using change sets, -i.e. to first create a change set and then execute it. This allows you to inject -steps that inspect the change set and approve or reject it, but failed deployments -are not retryable and creation of the change set costs time. - -The creation of change sets can be switched off by setting `useChangeSets: false`: - -```ts -declare const synth: pipelines.ShellStep; - -class PipelineStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth, - - // Disable change set creation and make deployments in pipeline as single step - useChangeSets: false, - }); - } -} -``` - -### Validation - -Every `addStage()` and `addWave()` command takes additional options. As part of these options, -you can specify `pre` and `post` steps, which are arbitrary steps that run before or after -the contents of the stage or wave, respectively. You can use these to add validations like -manual or automated gates to your pipeline. We recommend putting manual approval gates in the set of `pre` steps, and automated approval gates in -the set of `post` steps. - -The following example shows both an automated approval in the form of a `ShellStep`, and -a manual approval in the form of a `ManualApprovalStep` added to the pipeline. Both must -pass in order to promote from the `PreProd` to the `Prod` environment: - -```ts -declare const pipeline: pipelines.CodePipeline; -const preprod = new MyApplicationStage(this, 'PreProd'); -const prod = new MyApplicationStage(this, 'Prod'); - -pipeline.addStage(preprod, { - post: [ - new pipelines.ShellStep('Validate Endpoint', { - commands: ['curl -Ssf https://my.webservice.com/'], - }), - ], -}); -pipeline.addStage(prod, { - pre: [ - new pipelines.ManualApprovalStep('PromoteToProd'), - ], -}); -``` - -You can also specify steps to be executed at the stack level. To achieve this, you can specify the stack and step via the `stackSteps` property: - -```ts -class MyStacksStage extends Stage { - public readonly stack1: Stack; - public readonly stack2: Stack; - - constructor(scope: Construct, id: string, props?: StageProps) { - super(scope, id, props); - this.stack1 = new Stack(this, 'stack1'); - this.stack2 = new Stack(this, 'stack2'); - } -} - -declare const pipeline: pipelines.CodePipeline; -const prod = new MyStacksStage(this, 'Prod'); - -pipeline.addStage(prod, { - stackSteps: [{ - stack: prod.stack1, - pre: [new pipelines.ManualApprovalStep('Pre-Stack Check')], // Executed before stack is prepared - changeSet: [new pipelines.ManualApprovalStep('ChangeSet Approval')], // Executed after stack is prepared but before the stack is deployed - post: [new pipelines.ManualApprovalStep('Post-Deploy Check')], // Executed after stack is deployed - }, { - stack: prod.stack2, - post: [new pipelines.ManualApprovalStep('Post-Deploy Check')], // Executed after stack is deployed - }], -}); -``` - -If you specify multiple steps, they will execute in parallel by default. You can add dependencies between them -to if you wish to specify an order. To add a dependency, call `step.addStepDependency()`: - -```ts -const firstStep = new pipelines.ManualApprovalStep('A'); -const secondStep = new pipelines.ManualApprovalStep('B'); -secondStep.addStepDependency(firstStep); -``` - -For convenience, `Step.sequence()` will take an array of steps and dependencies between adjacent steps, -so that the whole list executes in order: - -```ts -// Step A will depend on step B and step B will depend on step C -const orderedSteps = pipelines.Step.sequence([ - new pipelines.ManualApprovalStep('A'), - new pipelines.ManualApprovalStep('B'), - new pipelines.ManualApprovalStep('C'), -]); -``` - -#### Using CloudFormation Stack Outputs in approvals - -Because many CloudFormation deployments result in the generation of resources with unpredictable -names, validations have support for reading back CloudFormation Outputs after a deployment. This -makes it possible to pass (for example) the generated URL of a load balancer to the test set. - -To use Stack Outputs, expose the `CfnOutput` object you're interested in, and -pass it to `envFromCfnOutputs` of the `ShellStep`: - -```ts -class MyOutputStage extends Stage { - public readonly loadBalancerAddress: CfnOutput; - - constructor(scope: Construct, id: string, props?: StageProps) { - super(scope, id, props); - this.loadBalancerAddress = new CfnOutput(this, 'Output', {value: 'value'}); - } -} - -const lbApp = new MyOutputStage(this, 'MyApp'); -declare const pipeline: pipelines.CodePipeline; -pipeline.addStage(lbApp, { - post: [ - new pipelines.ShellStep('HitEndpoint', { - envFromCfnOutputs: { - // Make the load balancer address available as $URL inside the commands - URL: lbApp.loadBalancerAddress, - }, - commands: ['curl -Ssf $URL'], - }), - ], -}); -``` - -#### Running scripts compiled during the synth step - -As part of a validation, you probably want to run a test suite that's more -elaborate than what can be expressed in a couple of lines of shell script. -You can bring additional files into the shell script validation by supplying -the `input` or `additionalInputs` property of `ShellStep`. The input can -be produced by the `Synth` step, or come from a source or any other build -step. - -Here's an example that captures an additional output directory in the synth -step and runs tests from there: - -```ts -declare const synth: pipelines.ShellStep; -const stage = new MyApplicationStage(this, 'MyApplication'); -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { synth }); - -pipeline.addStage(stage, { - post: [ - new pipelines.ShellStep('Approve', { - // Use the contents of the 'integ' directory from the synth step as the input - input: synth.addOutputDirectory('integ'), - commands: ['cd integ && ./run.sh'], - }), - ], -}); -``` - -### Customizing CodeBuild Projects - -CDK pipelines will generate CodeBuild projects for each `ShellStep` you use, and it -will also generate CodeBuild projects to publish assets and perform the self-mutation -of the pipeline. To control the various aspects of the CodeBuild projects that get -generated, use a `CodeBuildStep` instead of a `ShellStep`. This class has a number -of properties that allow you to customize various aspects of the projects: - -```ts -declare const vpc: ec2.Vpc; -declare const mySecurityGroup: ec2.SecurityGroup; -new pipelines.CodeBuildStep('Synth', { - // ...standard ShellStep props... - commands: [/* ... */], - env: { /* ... */ }, - - // If you are using a CodeBuildStep explicitly, set the 'cdk.out' directory - // to be the synth step's output. - primaryOutputDirectory: 'cdk.out', - - // Control the name of the project - projectName: 'MyProject', - - // Control parts of the BuildSpec other than the regular 'build' and 'install' commands - partialBuildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - // ... - }), - - // Control the build environment - buildEnvironment: { - computeType: codebuild.ComputeType.LARGE, - }, - timeout: Duration.minutes(90), - - // Control Elastic Network Interface creation - vpc: vpc, - subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - securityGroups: [mySecurityGroup], - - // Control caching - cache: codebuild.Cache.bucket(new s3.Bucket(this, 'Cache')), - - // Additional policy statements for the execution role - rolePolicyStatements: [ - new iam.PolicyStatement({ /* ... */ }), - ], -}); -``` - -You can also configure defaults for *all* CodeBuild projects by passing `codeBuildDefaults`, -or just for the synth, asset publishing, and self-mutation projects by passing `synthCodeBuildDefaults`, -`assetPublishingCodeBuildDefaults`, or `selfMutationCodeBuildDefaults`: - -```ts -declare const vpc: ec2.Vpc; -declare const mySecurityGroup: ec2.SecurityGroup; -new pipelines.CodePipeline(this, 'Pipeline', { - // Standard CodePipeline properties - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: [ - 'npm ci', - 'npm run build', - 'npx cdk synth', - ], - }), - - // Defaults for all CodeBuild projects - codeBuildDefaults: { - // Prepend commands and configuration to all projects - partialBuildSpec: codebuild.BuildSpec.fromObject({ - version: '0.2', - // ... - }), - - // Control the build environment - buildEnvironment: { - computeType: codebuild.ComputeType.LARGE, - }, - - // Control Elastic Network Interface creation - vpc: vpc, - subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, - securityGroups: [mySecurityGroup], - - // Additional policy statements for the execution role - rolePolicy: [ - new iam.PolicyStatement({ /* ... */ }), - ], - }, - - synthCodeBuildDefaults: { /* ... */ }, - assetPublishingCodeBuildDefaults: { /* ... */ }, - selfMutationCodeBuildDefaults: { /* ... */ }, -}); -``` - -### Arbitrary CodePipeline actions - -If you want to add a type of CodePipeline action to the CDK Pipeline that -doesn't have a matching class yet, you can define your own step class that extends -`Step` and implements `ICodePipelineActionFactory`. - -Here's an example that adds a Jenkins step: - -```ts -class MyJenkinsStep extends pipelines.Step implements pipelines.ICodePipelineActionFactory { - constructor( - private readonly provider: cpactions.JenkinsProvider, - private readonly input: pipelines.FileSet, - ) { - super('MyJenkinsStep'); - - // This is necessary if your step accepts parameters, like environment variables, - // that may contain outputs from other steps. It doesn't matter what the - // structure is, as long as it contains the values that may contain outputs. - this.discoverReferencedOutputs({ - env: { /* ... */ } - }); - } - - public produceAction(stage: codepipeline.IStage, options: pipelines.ProduceActionOptions): pipelines.CodePipelineActionFactoryResult { - - // This is where you control what type of Action gets added to the - // CodePipeline - stage.addAction(new cpactions.JenkinsAction({ - // Copy 'actionName' and 'runOrder' from the options - actionName: options.actionName, - runOrder: options.runOrder, - - // Jenkins-specific configuration - type: cpactions.JenkinsActionType.TEST, - jenkinsProvider: this.provider, - projectName: 'MyJenkinsProject', - - // Translate the FileSet into a codepipeline.Artifact - inputs: [options.artifacts.toCodePipeline(this.input)], - })); - - return { runOrdersConsumed: 1 }; - } -} -``` - -Another example, adding a lambda step referencing outputs from a stack: - -```ts -class MyLambdaStep extends pipelines.Step implements pipelines.ICodePipelineActionFactory { - private stackOutputReference: pipelines.StackOutputReference - - constructor( - private readonly function: lambda.Function, - stackOutput: CfnOutput, - ) { - super('MyLambdaStep'); - this.stackOutputReference = pipelines.StackOutputReference.fromCfnOutput(stackOutput); - } - - public produceAction(stage: codepipeline.IStage, options: pipelines.ProduceActionOptions): pipelines.CodePipelineActionFactoryResult { - - stage.addAction(new cpactions.LambdaInvokeAction({ - actionName: options.actionName, - runOrder: options.runOrder, - // Map the reference to the variable name the CDK has generated for you. - userParameters: {stackOutput: options.stackOutputsMap.toCodePipeline(this.stackOutputReference)}, - lambda: this.function, - })); - - return { runOrdersConsumed: 1 }; - } - - /** - * Expose stack output references, letting the CDK know - * we want these variables accessible for this step. - */ - public get consumedStackOutputs(): pipelines.StackOutputReference[] { - return [this.stackOutputReference]; - } -} -``` - -### Using an existing AWS Codepipeline - -If you wish to use an existing `CodePipeline.Pipeline` while using the modern API's -methods and classes, you can pass in the existing `CodePipeline.Pipeline` to be built upon -instead of having the `pipelines.CodePipeline` construct create a new `CodePipeline.Pipeline`. -This also gives you more direct control over the underlying `CodePipeline.Pipeline` construct -if the way the modern API creates it doesn't allow for desired configurations. Use `CodePipelineFileset` to convert CodePipeline **artifacts** into CDK Pipelines **file sets**, -that can be used everywhere a file set or file set producer is expected. - -Here's an example of passing in an existing pipeline and using a *source* that's already -in the pipeline: - -```ts -declare const codePipeline: codepipeline.Pipeline; - -const sourceArtifact = new codepipeline.Artifact('MySourceArtifact'); - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - codePipeline: codePipeline, - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineFileSet.fromArtifact(sourceArtifact), - commands: ['npm ci','npm run build','npx cdk synth'], - }), -}); -``` - -If your existing pipeline already provides a synth step, pass the existing -artifact in place of the `synth` step: - -```ts -declare const codePipeline: codepipeline.Pipeline; - -const buildArtifact = new codepipeline.Artifact('MyBuildArtifact'); - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - codePipeline: codePipeline, - synth: pipelines.CodePipelineFileSet.fromArtifact(buildArtifact), -}); -``` - -Note that if you provide an existing pipeline, you cannot provide values for -`pipelineName`, `crossAccountKeys`, `reuseCrossRegionSupportStacks`, or `role` -because those values are passed in directly to the underlying `codepipeline.Pipeline`. - -## Using Docker in the pipeline - -Docker can be used in 3 different places in the pipeline: - -- If you are using Docker image assets in your application stages: Docker will - run in the asset publishing projects. -- If you are using Docker image assets in your stack (for example as - images for your CodeBuild projects): Docker will run in the self-mutate project. -- If you are using Docker to bundle file assets anywhere in your project (for - example, if you are using such construct libraries as - `@aws-cdk/aws-lambda-nodejs`): Docker will run in the - *synth* project. - -For the first case, you don't need to do anything special. For the other two cases, -you need to make sure that **privileged mode** is enabled on the correct CodeBuild -projects, so that Docker can run correctly. The follow sections describe how to do -that. - -You may also need to authenticate to Docker registries to avoid being throttled. -See the section **Authenticating to Docker registries** below for information on how to do -that. - -### Using Docker image assets in the pipeline - -If your `PipelineStack` is using Docker image assets (as opposed to the application -stacks the pipeline is deploying), for example by the use of `LinuxBuildImage.fromAsset()`, -you need to pass `dockerEnabledForSelfMutation: true` to the pipeline. For example: - -```ts -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: ['npm ci','npm run build','npx cdk synth'], - }), - - // Turn this on because the pipeline uses Docker image assets - dockerEnabledForSelfMutation: true, -}); - -pipeline.addWave('MyWave', { - post: [ - new pipelines.CodeBuildStep('RunApproval', { - commands: ['command-from-image'], - buildEnvironment: { - // The user of a Docker image asset in the pipeline requires turning on - // 'dockerEnabledForSelfMutation'. - buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'Image', { - directory: './docker-image', - }), - }, - }), - ], -}); -``` - -> **Important**: You must turn on the `dockerEnabledForSelfMutation` flag, -> commit and allow the pipeline to self-update *before* adding the actual -> Docker asset. - -### Using bundled file assets - -If you are using asset bundling anywhere (such as automatically done for you -if you add a construct like `@aws-cdk/aws-lambda-nodejs`), you need to pass -`dockerEnabledForSynth: true` to the pipeline. For example: - -```ts -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: ['npm ci','npm run build','npx cdk synth'], - }), - - // Turn this on because the application uses bundled file assets - dockerEnabledForSynth: true, -}); -``` - -> **Important**: You must turn on the `dockerEnabledForSynth` flag, -> commit and allow the pipeline to self-update *before* adding the actual -> Docker asset. - -### Authenticating to Docker registries - -You can specify credentials to use for authenticating to Docker registries as part of the -pipeline definition. This can be useful if any Docker image assets — in the pipeline or -any of the application stages — require authentication, either due to being in a -different environment (e.g., ECR repo) or to avoid throttling (e.g., DockerHub). - -```ts -const dockerHubSecret = secretsmanager.Secret.fromSecretCompleteArn(this, 'DHSecret', 'arn:aws:...'); -const customRegSecret = secretsmanager.Secret.fromSecretCompleteArn(this, 'CRSecret', 'arn:aws:...'); -const repo1 = ecr.Repository.fromRepositoryArn(this, 'Repo', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo1'); -const repo2 = ecr.Repository.fromRepositoryArn(this, 'Repo', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2'); - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - dockerCredentials: [ - pipelines.DockerCredential.dockerHub(dockerHubSecret), - pipelines.DockerCredential.customRegistry('dockerregistry.example.com', customRegSecret), - pipelines.DockerCredential.ecr([repo1, repo2]), - ], - synth: new pipelines.ShellStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: ['npm ci','npm run build','npx cdk synth'], - }), -}); -``` - -For authenticating to Docker registries that require a username and password combination -(like DockerHub), create a Secrets Manager Secret with fields named `username` -and `secret`, and import it (the field names change be customized). - -Authentication to ECR repositories is done using the execution role of the -relevant CodeBuild job. Both types of credentials can be provided with an -optional role to assume before requesting the credentials. - -By default, the Docker credentials provided to the pipeline will be available to -the **Synth**, **Self-Update**, and **Asset Publishing** actions within the -*pipeline. The scope of the credentials can be limited via the `DockerCredentialUsage` option. - -```ts -const dockerHubSecret = secretsmanager.Secret.fromSecretCompleteArn(this, 'DHSecret', 'arn:aws:...'); -// Only the image asset publishing actions will be granted read access to the secret. -const creds = pipelines.DockerCredential.dockerHub(dockerHubSecret, { usages: [pipelines.DockerCredentialUsage.ASSET_PUBLISHING] }); -``` - -## CDK Environment Bootstrapping - -An *environment* is an *(account, region)* pair where you want to deploy a -CDK stack (see -[Environments](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) -in the CDK Developer Guide). In a Continuous Deployment pipeline, there are -at least two environments involved: the environment where the pipeline is -provisioned, and the environment where you want to deploy the application (or -different stages of the application). These can be the same, though best -practices recommend you isolate your different application stages from each -other in different AWS accounts or regions. - -Before you can provision the pipeline, you have to *bootstrap* the environment you want -to create it in. If you are deploying your application to different environments, you -also have to bootstrap those and be sure to add a *trust* relationship. - -After you have bootstrapped an environment and created a pipeline that deploys -to it, it's important that you don't delete the stack or change its *Qualifier*, -or future deployments to this environment will fail. If you want to upgrade -the bootstrap stack to a newer version, do that by updating it in-place. - -> This library requires the *modern* bootstrapping stack which has -> been updated specifically to support cross-account continuous delivery. -> -> If you are using CDKv2, you do not need to do anything else. Modern -> bootstrapping and modern stack synthesis (also known as "default stack -> synthesis") is the default. -> -> If you are using CDKv1, you need to opt in to modern bootstrapping and -> modern stack synthesis using a feature flag. Make sure `cdk.json` includes: -> -> ```json -> { -> "context": { -> "@aws-cdk/core:newStyleStackSynthesis": true -> } -> } -> ``` -> -> And be sure to run `cdk bootstrap` in the same directory as the `cdk.json` -> file. - -To bootstrap an environment for provisioning the pipeline: - -```console -$ npx cdk bootstrap \ - [--profile admin-profile-1] \ - --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \ - aws://111111111111/us-east-1 -``` - -To bootstrap a different environment for deploying CDK applications into using -a pipeline in account `111111111111`: - -```console -$ npx cdk bootstrap \ - [--profile admin-profile-2] \ - --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \ - --trust 11111111111 \ - aws://222222222222/us-east-2 -``` - -If you only want to trust an account to do lookups (e.g, when your CDK application has a -`Vpc.fromLookup()` call), use the option `--trust-for-lookup`: - -```console -$ npx cdk bootstrap \ - [--profile admin-profile-2] \ - --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \ - --trust-for-lookup 11111111111 \ - aws://222222222222/us-east-2 -``` - -These command lines explained: - -- `npx`: means to use the CDK CLI from the current NPM install. If you are using - a global install of the CDK CLI, leave this out. -- `--profile`: should indicate a profile with administrator privileges that has - permissions to provision a pipeline in the indicated account. You can leave this - flag out if either the AWS default credentials or the `AWS_*` environment - variables confer these permissions. -- `--cloudformation-execution-policies`: ARN of the managed policy that future CDK - deployments should execute with. By default this is `AdministratorAccess`, but - if you also specify the `--trust` flag to give another Account permissions to - deploy into the current account, you must specify a value here. -- `--trust`: indicates which other account(s) should have permissions to deploy - CDK applications into this account. In this case we indicate the Pipeline's account, - but you could also use this for developer accounts (don't do that for production - application accounts though!). -- `--trust-for-lookup`: gives a more limited set of permissions to the - trusted account, only allowing it to look up values such as availability zones, EC2 images and - VPCs. `--trust-for-lookup` does not give permissions to modify anything in the account. - Note that `--trust` implies `--trust-for-lookup`, so you don't need to specify - the same account twice. -- `aws://222222222222/us-east-2`: the account and region we're bootstrapping. - -> Be aware that anyone who has access to the trusted Accounts **effectively has all -> permissions conferred by the configured CloudFormation execution policies**, -> allowing them to do things like read arbitrary S3 buckets and create arbitrary -> infrastructure in the bootstrapped account. Restrict the list of `--trust`ed Accounts, -> or restrict the policies configured by `--cloudformation-execution-policies`. - -
- -> **Security tip**: we recommend that you use administrative credentials to an -> account only to bootstrap it and provision the initial pipeline. Otherwise, -> access to administrative credentials should be dropped as soon as possible. - -
- -> **On the use of AdministratorAccess**: The use of the `AdministratorAccess` policy -> ensures that your pipeline can deploy every type of AWS resource to your account. -> Make sure you trust all the code and dependencies that make up your CDK app. -> Check with the appropriate department within your organization to decide on the -> proper policy to use. -> -> If your policy includes permissions to create on attach permission to a role, -> developers can escalate their privilege with more permissive permission. -> Thus, we recommend implementing [permissions boundary](https://aws.amazon.com/premiumsupport/knowledge-center/iam-permission-boundaries/) -> in the CDK Execution role. To do this, you can bootstrap with the `--template` option with -> [a customized template](https://github.com/aws-samples/aws-bootstrap-kit-examples/blob/ba28a97d289128281bc9483bcba12c1793f2c27a/source/1-SDLC-organization/lib/cdk-bootstrap-template.yml#L395) that contains a permission boundary. - -### Migrating from old bootstrap stack - -The bootstrap stack is a CloudFormation stack in your account named -**CDKToolkit** that provisions a set of resources required for the CDK -to deploy into that environment. - -The "new" bootstrap stack (obtained by running `cdk bootstrap` with -`CDK_NEW_BOOTSTRAP=1`) is slightly more elaborate than the "old" stack. It -contains: - -- An S3 bucket and ECR repository with predictable names, so that we can reference - assets in these storage locations *without* the use of CloudFormation template - parameters. -- A set of roles with permissions to access these asset locations and to execute - CloudFormation, assumable from whatever accounts you specify under `--trust`. - -It is possible and safe to migrate from the old bootstrap stack to the new -bootstrap stack. This will create a new S3 file asset bucket in your account -and orphan the old bucket. You should manually delete the orphaned bucket -after you are sure you have redeployed all CDK applications and there are no -more references to the old asset bucket. - -## Context Lookups - -You might be using CDK constructs that need to look up [runtime -context](https://docs.aws.amazon.com/cdk/latest/guide/context.html#context_methods), -which is information from the target AWS Account and Region the CDK needs to -synthesize CloudFormation templates appropriate for that environment. Examples -of this kind of context lookups are the number of Availability Zones available -to you, a Route53 Hosted Zone ID, or the ID of an AMI in a given region. This -information is automatically looked up when you run `cdk synth`. - -By default, a `cdk synth` performed in a pipeline will not have permissions -to perform these lookups, and the lookups will fail. This is by design. - -**Our recommended way of using lookups** is by running `cdk synth` on the -developer workstation and checking in the `cdk.context.json` file, which -contains the results of the context lookups. This will make sure your -synthesized infrastructure is consistent and repeatable. If you do not commit -`cdk.context.json`, the results of the lookups may suddenly be different in -unexpected ways, and even produce results that cannot be deployed or will cause -data loss. To give an account permissions to perform lookups against an -environment, without being able to deploy to it and make changes, run -`cdk bootstrap --trust-for-lookup=`. - -If you want to use lookups directly from the pipeline, you either need to accept -the risk of nondeterminism, or make sure you save and load the -`cdk.context.json` file somewhere between synth runs. Finally, you should -give the synth CodeBuild execution role permissions to assume the bootstrapped -lookup roles. As an example, doing so would look like this: - -```ts -new pipelines.CodePipeline(this, 'Pipeline', { - synth: new pipelines.CodeBuildStep('Synth', { - input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { - connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', - }), - commands: [ - // Commands to load cdk.context.json from somewhere here - '...', - 'npm ci', - 'npm run build', - 'npx cdk synth', - // Commands to store cdk.context.json back here - '...', - ], - rolePolicyStatements: [ - new iam.PolicyStatement({ - actions: ['sts:AssumeRole'], - resources: ['*'], - conditions: { - StringEquals: { - 'iam:ResourceTag/aws-cdk:bootstrap-role': 'lookup', - }, - }, - }), - ], - }), -}); -``` - -The above example requires that the target environments have all -been bootstrapped with bootstrap stack version `8`, released with -CDK CLI `1.114.0`. - -## Security Considerations - -It's important to stay safe while employing Continuous Delivery. The CDK Pipelines -library comes with secure defaults to the best of our ability, but by its -very nature the library cannot take care of everything. - -We therefore expect you to mind the following: - -- Maintain dependency hygiene and vet 3rd-party software you use. Any software you - run on your build machine has the ability to change the infrastructure that gets - deployed. Be careful with the software you depend on. - -- Use dependency locking to prevent accidental upgrades! The default `CdkSynths` that - come with CDK Pipelines will expect `package-lock.json` and `yarn.lock` to - ensure your dependencies are the ones you expect. - -- Credentials to production environments should be short-lived. After - bootstrapping and the initial pipeline provisioning, there is no more need for - developers to have access to any of the account credentials; all further - changes can be deployed through git. Avoid the chances of credentials leaking - by not having them in the first place! - -### Confirm permissions broadening - -To keep tabs on the security impact of changes going out through your pipeline, -you can insert a security check before any stage deployment. This security check -will check if the upcoming deployment would add any new IAM permissions or -security group rules, and if so pause the pipeline and require you to confirm -the changes. - -The security check will appear as two distinct actions in your pipeline: first -a CodeBuild project that runs `cdk diff` on the stage that's about to be deployed, -followed by a Manual Approval action that pauses the pipeline. If it so happens -that there no new IAM permissions or security group rules will be added by the deployment, -the manual approval step is automatically satisfied. The pipeline will look like this: - -```txt -Pipeline -├── ... -├── MyApplicationStage -│   ├── MyApplicationSecurityCheck // Security Diff Action -│   ├── MyApplicationManualApproval // Manual Approval Action -│   ├── Stack.Prepare -│   └── Stack.Deploy -└── ... -``` - -You can insert the security check by using a `ConfirmPermissionsBroadening` step: - -```ts -declare const pipeline: pipelines.CodePipeline; -const stage = new MyApplicationStage(this, 'MyApplication'); -pipeline.addStage(stage, { - pre: [ - new pipelines.ConfirmPermissionsBroadening('Check', { stage }), - ], -}); -``` - -To get notified when there is a change that needs your manual approval, -create an SNS Topic, subscribe your own email address, and pass it in as -as the `notificationTopic` property: - -```ts -declare const pipeline: pipelines.CodePipeline; -const topic = new sns.Topic(this, 'SecurityChangesTopic'); -topic.addSubscription(new subscriptions.EmailSubscription('test@email.com')); - -const stage = new MyApplicationStage(this, 'MyApplication'); -pipeline.addStage(stage, { - pre: [ - new pipelines.ConfirmPermissionsBroadening('Check', { - stage, - notificationTopic: topic, - }), - ], -}); -``` - -**Note**: Manual Approvals notifications only apply when an application has security -check enabled. - -## Using a different deployment engine - -CDK Pipelines supports multiple *deployment engines*, but this module vends a -construct for only one such engine: AWS CodePipeline. It is also possible to -use CDK Pipelines to build pipelines backed by other deployment engines. - -Here is a list of CDK Libraries that integrate CDK Pipelines with -alternative deployment engines: - -- GitHub Workflows: [`cdk-pipelines-github`](https://github.com/cdklabs/cdk-pipelines-github) - -## Troubleshooting - -Here are some common errors you may encounter while using this library. - -### Pipeline: Internal Failure - -If you see the following error during deployment of your pipeline: - -```plaintext -CREATE_FAILED | AWS::CodePipeline::Pipeline | Pipeline/Pipeline -Internal Failure -``` - -There's something wrong with your GitHub access token. It might be missing, or not have the -right permissions to access the repository you're trying to access. - -### Key: Policy contains a statement with one or more invalid principals - -If you see the following error during deployment of your pipeline: - -```plaintext -CREATE_FAILED | AWS::KMS::Key | Pipeline/Pipeline/ArtifactsBucketEncryptionKey -Policy contains a statement with one or more invalid principals. -``` - -One of the target (account, region) environments has not been bootstrapped -with the new bootstrap stack. Check your target environments and make sure -they are all bootstrapped. - -### Message: no matching base directory path found for cdk.out - -If you see this error during the **Synth** step, it means that CodeBuild -is expecting to find a `cdk.out` directory in the root of your CodeBuild project, -but the directory wasn't there. There are two common causes for this: - -- `cdk synth` is not being executed: `cdk synth` used to be run - implicitly for you, but you now have to explicitly include the command. - For NPM-based projects, add `npx cdk synth` to the end of the `commands` - property, for other languages add `npm install -g aws-cdk` and `cdk synth`. -- Your CDK project lives in a subdirectory: you added a `cd ` command - to the list of commands; don't forget to tell the `ScriptStep` about the - different location of `cdk.out`, by passing `primaryOutputDirectory: '/cdk.out'`. - -### is in ROLLBACK_COMPLETE state and can not be updated - -If you see the following error during execution of your pipeline: - -```plaintext -Stack ... is in ROLLBACK_COMPLETE state and can not be updated. (Service: -AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request -ID: ...) -``` - -The stack failed its previous deployment, and is in a non-retryable state. -Go into the CloudFormation console, delete the stack, and retry the deployment. - -### Cannot find module 'xxxx' or its corresponding type declarations - -You may see this if you are using TypeScript or other NPM-based languages, -when using NPM 7 on your workstation (where you generate `package-lock.json`) -and NPM 6 on the CodeBuild image used for synthesizing. - -It looks like NPM 7 has started writing less information to `package-lock.json`, -leading NPM 6 reading that same file to not install all required packages anymore. - -Make sure you are using the same NPM version everywhere, either downgrade your -workstation's version or upgrade the CodeBuild version. - -### Cannot find module '.../check-node-version.js' (MODULE_NOT_FOUND) - -The above error may be produced by `npx` when executing the CDK CLI, or any -project that uses the AWS SDK for JavaScript, without the target application -having been installed yet. For example, it can be triggered by `npx cdk synth` -if `aws-cdk` is not in your `package.json`. - -Work around this by either installing the target application using NPM *before* -running `npx`, or set the environment variable `NPM_CONFIG_UNSAFE_PERM=true`. - -### Cannot connect to the Docker daemon at unix:///var/run/docker.sock - -If, in the 'Synth' action (inside the 'Build' stage) of your pipeline, you get an error like this: - -```console -stderr: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. -See 'docker run --help'. -``` - -It means that the AWS CodeBuild project for 'Synth' is not configured to run in privileged mode, -which prevents Docker builds from happening. This typically happens if you use a CDK construct -that bundles asset using tools run via Docker, like `aws-lambda-nodejs`, `aws-lambda-python`, -`aws-lambda-go` and others. - -Make sure you set the `privileged` environment variable to `true` in the synth definition: - -```ts -const sourceArtifact = new codepipeline.Artifact(); -const cloudAssemblyArtifact = new codepipeline.Artifact(); -const pipeline = new pipelines.CdkPipeline(this, 'MyPipeline', { - cloudAssemblyArtifact, - synthAction: pipelines.SimpleSynthAction.standardNpmSynth({ - sourceArtifact, - cloudAssemblyArtifact, - environment: { - privileged: true, - }, - }), -}); -``` - -After turning on `privilegedMode: true`, you will need to do a one-time manual cdk deploy of your -pipeline to get it going again (as with a broken 'synth' the pipeline will not be able to self -update to the right state). - -### Not authorized to perform sts:AssumeRole on arn:aws:iam::\*:role/\*-lookup-role-\* - -You may get an error like the following in the **Synth** step: - -```text -Could not assume role in target account using current credentials (which are for account 111111111111). User: -arn:aws:sts::111111111111:assumed-role/PipelineStack-PipelineBuildSynthCdkBuildProje-..../AWSCodeBuild-.... -is not authorized to perform: sts:AssumeRole on resource: -arn:aws:iam::222222222222:role/cdk-hnb659fds-lookup-role-222222222222-us-east-1. -Please make sure that this role exists in the account. If it doesn't exist, (re)-bootstrap the environment with -the right '--trust', using the latest version of the CDK CLI. -``` - -This is a sign that the CLI is trying to do Context Lookups during the **Synth** step, which are failing -because it cannot assume the right role. We recommend you don't rely on Context Lookups in the pipeline at -all, and commit a file called `cdk.context.json` with the right lookup values in it to source control. - -If you do want to do lookups in the pipeline, the cause is one of the following: - -- The target environment has not been bootstrapped; OR -- The target environment has been bootstrapped without the right `--trust` relationship; OR -- The CodeBuild execution role does not have permissions to call `sts:AssumeRole`. - -See the section called **Context Lookups** for more information on using this feature. - -### IAM policies: Cannot exceed quota for PoliciesPerRole / Maximum policy size exceeded - -This happens as a result of having a lot of targets in the Pipeline: the IAM policies that -get generated enumerate all required roles and grow too large. - -Make sure you are on version `2.26.0` or higher, and that your `cdk.json` contains the -following: - -```json -{ - "context": { - "@aws-cdk/aws-iam:minimizePolicies": true - } -} -``` - -### S3 error: Access Denied - -An "S3 Access Denied" error can have two causes: - -- Asset hashes have changed, but self-mutation has been disabled in the pipeline. -- You have deleted and recreated the bootstrap stack, or changed its qualifier. - -#### Self-mutation step has been removed - -Some constructs, such as EKS clusters, generate nested stacks. When CloudFormation tries -to deploy those stacks, it may fail with this error: - -```console -S3 error: Access Denied For more information check http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html -``` - -This happens because the pipeline is not self-mutating and, as a consequence, the `FileAssetX` -build projects get out-of-sync with the generated templates. To fix this, make sure the -`selfMutating` property is set to `true`: - -```ts -const cloudAssemblyArtifact = new codepipeline.Artifact(); -const pipeline = new pipelines.CdkPipeline(this, 'MyPipeline', { - selfMutating: true, - cloudAssemblyArtifact, -}); -``` - -#### Bootstrap roles have been renamed or recreated - -While attempting to deploy an application stage, the "Prepare" or "Deploy" stage may fail with a cryptic error like: - -`Action execution failed -Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 0123456ABCDEFGH; -S3 Extended Request ID: 3hWcrVkhFGxfiMb/rTJO0Bk7Qn95x5ll4gyHiFsX6Pmk/NT+uX9+Z1moEcfkL7H3cjH7sWZfeD0=; Proxy: null)` - -This generally indicates that the roles necessary to deploy have been deleted (or deleted and re-created); -for example, if the bootstrap stack has been deleted and re-created, this scenario will happen. Under the hood, -the resources that rely on these roles (e.g., `cdk-$qualifier-deploy-role-$account-$region`) point to different -canonical IDs than the recreated versions of these roles, which causes the errors. There are no simple solutions -to this issue, and for that reason we **strongly recommend** that bootstrap stacks not be deleted and re-created -once created. - -The most automated way to solve the issue is to introduce a secondary bootstrap stack. By changing the qualifier -that the pipeline stack looks for, a change will be detected and the impacted policies and resources will be updated. -A hypothetical recovery workflow would look something like this: - -- First, for all impacted environments, create a secondary bootstrap stack: - -```sh -$ env CDK_NEW_BOOTSTRAP=1 npx cdk bootstrap \ - --qualifier random1234 \ - --toolkit-stack-name CDKToolkitTemp \ - aws://111111111111/us-east-1 -``` - -- Update all impacted stacks in the pipeline to use this new qualifier. -See https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html for more info. - -```ts -new Stack(this, 'MyStack', { - // Update this qualifier to match the one used above. - synthesizer: new cdk.DefaultStackSynthesizer({ - qualifier: 'randchars1234', - }), -}); -``` - -- Deploy the updated stacks. This will update the stacks to use the roles created in the new bootstrap stack. -- (Optional) Restore back to the original state: - - Revert the change made in step #2 above - - Re-deploy the pipeline to use the original qualifier. - - Delete the temporary bootstrap stack(s) - -##### Manual Alternative - -Alternatively, the errors can be resolved by finding each impacted resource and policy, and correcting the policies -by replacing the canonical IDs (e.g., `AROAYBRETNYCYV6ZF2R93`) with the appropriate ARNs. As an example, the KMS -encryption key policy for the artifacts bucket may have a statement that looks like the following: - -```json -{ - "Effect" : "Allow", - "Principal" : { - // "AWS" : "AROAYBRETNYCYV6ZF2R93" // Indicates this issue; replace this value - "AWS": "arn:aws:iam::0123456789012:role/cdk-hnb659fds-deploy-role-0123456789012-eu-west-1", // Correct value - }, - "Action" : [ "kms:Decrypt", "kms:DescribeKey" ], - "Resource" : "*" -} -``` - -Any resource or policy that references the qualifier (`hnb659fds` by default) will need to be updated. - -### This CDK CLI is not compatible with the CDK library used by your application - -The CDK CLI version used in your pipeline is too old to read the Cloud Assembly -produced by your CDK app. - -Most likely this happens in the `SelfMutate` action, you are passing the `cliVersion` -parameter to control the version of the CDK CLI, and you just updated the CDK -framework version that your application uses. You either forgot to change the -`cliVersion` parameter, or changed the `cliVersion` in the same commit in which -you changed the framework version. Because a change to the pipeline settings needs -a successful run of the `SelfMutate` step to be applied, the next iteration of the -`SelfMutate` step still executes with the *old* CLI version, and that old CLI version -is not able to read the cloud assembly produced by the new framework version. - -Solution: change the `cliVersion` first, commit, push and deploy, and only then -change the framework version. - -We recommend you avoid specifying the `cliVersion` parameter at all. By default -the pipeline will use the latest CLI version, which will support all cloud assembly -versions. - -## Using Drop-in Docker Replacements - -By default, the AWS CDK will build and publish Docker image assets using the -`docker` command. However, by specifying the `CDK_DOCKER` environment variable, -you can override the command that will be used to build and publish your -assets. - -In CDK Pipelines, the drop-in replacement for the `docker` command must be -included in the CodeBuild environment and configured for your pipeline. - -### Adding to the default CodeBuild image - -You can add a drop-in Docker replacement command to the default CodeBuild -environment by adding install-phase commands that encode how to install -your tooling and by adding the `CDK_DOCKER` environment variable to your -build environment. - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source -declare const synthCommands: string[]; // Commands to synthesize your app -declare const installCommands: string[]; // Commands to install your toolchain - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - // Standard CodePipeline properties... - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: synthCommands, - }), - - // Configure CodeBuild to use a drop-in Docker replacement. - codeBuildDefaults: { - buildEnvironment: { - partialBuildSpec: Codebuild.BuildSpec.fromObject({ - phases: { - install: { - // Add the shell commands to install your drop-in Docker - // replacement to the CodeBuild enviromment. - commands: installCommands, - } - } - }), - environmentVariables: { - // Instruct the AWS CDK to use `drop-in-replacement` instead of - // `docker` when building / publishing docker images. - // e.g., `drop-in-replacement build . -f path/to/Dockerfile` - CDK_DOCKER: 'drop-in-replacement', - } - } - }, -}); -``` - -### Using a custom build image - -If you're using a custom build image in CodeBuild, you can override the -command the AWS CDK uses to build Docker images by providing `CDK_DOCKER` as -an `ENV` in your `Dockerfile` or by providing the environment variable in the -pipeline as shown below. - -```ts -declare const source: pipelines.IFileSetProducer; // the repository source -declare const synthCommands: string[]; // Commands to synthesize your app - -const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { - // Standard CodePipeline properties... - synth: new pipelines.ShellStep('Synth', { - input: source, - commands: synthCommands, - }), - - // Configure CodeBuild to use a drop-in Docker replacement. - codeBuildDefaults: { - buildEnvironment: { - // Provide a custom build image containing your toolchain and the - // pre-installed replacement for the `docker` command. - buildImage: codebuild.LinuxBuildImage.fromDockerRegistry('your-docker-registry'), - environmentVariables: { - // If you haven't provided an `ENV` in your Dockerfile that overrides - // `CDK_DOCKER`, then you must provide the name of the command that - // the AWS CDK should run instead of `docker` here. - CDK_DOCKER: 'drop-in-replacement', - } - } - }, -}); -``` - -## Known Issues - -There are some usability issues that are caused by underlying technology, and -cannot be remedied by CDK at this point. They are reproduced here for completeness. - -- **Console links to other accounts will not work**: the AWS CodePipeline - console will assume all links are relative to the current account. You will - not be able to use the pipeline console to click through to a CloudFormation - stack in a different account. -- **If a change set failed to apply the pipeline must be restarted**: if a change - set failed to apply, it cannot be retried. The pipeline must be restarted from - the top by clicking **Release Change**. -- **A stack that failed to create must be deleted manually**: if a stack - failed to create on the first attempt, you must delete it using the - CloudFormation console before starting the pipeline again by clicking - **Release Change**. diff --git a/packages/@aws-cdk/pipelines/jest.config.js b/packages/@aws-cdk/pipelines/jest.config.js deleted file mode 100644 index 8ce875da0ea4c..0000000000000 --- a/packages/@aws-cdk/pipelines/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - statements: 75, - branches: 55, - }, - }, -}; - diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline.ts b/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline.ts deleted file mode 100644 index bb4b90427565b..0000000000000 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline.ts +++ /dev/null @@ -1,1012 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import * as cb from '@aws-cdk/aws-codebuild'; -import * as cp from '@aws-cdk/aws-codepipeline'; -import * as cpa from '@aws-cdk/aws-codepipeline-actions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Aws, CfnCapabilities, Duration, PhysicalName, Stack, Names } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct } from 'constructs'; -import { ArtifactMap } from './artifact-map'; -import { CodeBuildStep } from './codebuild-step'; -import { CodePipelineActionFactoryResult, ICodePipelineActionFactory } from './codepipeline-action-factory'; -import { CodeBuildFactory, mergeCodeBuildOptions } from './private/codebuild-factory'; -import { namespaceStepOutputs } from './private/outputs'; -import { StackOutputsMap } from './stack-outputs-map'; -import { AssetType, FileSet, IFileSetProducer, ManualApprovalStep, ShellStep, StackAsset, StackDeployment, Step } from '../blueprint'; -import { DockerCredential, dockerCredentialsInstallCommands, DockerCredentialUsage } from '../docker-credentials'; -import { GraphNodeCollection, isGraph, AGraphNode, PipelineGraph } from '../helpers-internal'; -import { PipelineBase } from '../main'; -import { AssetSingletonRole } from '../private/asset-singleton-role'; -import { CachedFnSub } from '../private/cached-fnsub'; -import { preferredCliVersion } from '../private/cli-version'; -import { appOf, assemblyBuilderOf, embeddedAsmPath, obtainScope } from '../private/construct-internals'; -import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../private/default-codebuild-image'; -import { toPosixPath } from '../private/fs'; -import { actionName, stackVariableNamespace } from '../private/identifiers'; -import { enumerate, flatten, maybeSuffix, noUndefined } from '../private/javascript'; -import { writeTemplateConfiguration } from '../private/template-configuration'; - - -/** - * Properties for a `CodePipeline` - */ -export interface CodePipelineProps { - /** - * The build step that produces the CDK Cloud Assembly - * - * The primary output of this step needs to be the `cdk.out` directory - * generated by the `cdk synth` command. - * - * If you use a `ShellStep` here and you don't configure an output directory, - * the output directory will automatically be assumed to be `cdk.out`. - */ - readonly synth: IFileSetProducer; - - /** - * The name of the CodePipeline pipeline - * - * @default - Automatically generated - */ - readonly pipelineName?: string; - - /** - * Create KMS keys for the artifact buckets, allowing cross-account deployments - * - * The artifact buckets have to be encrypted to support deploying CDK apps to - * another account, so if you want to do that or want to have your artifact - * buckets encrypted, be sure to set this value to `true`. - * - * Be aware there is a cost associated with maintaining the KMS keys. - * - * @default false - */ - readonly crossAccountKeys?: boolean; - - /** - * CDK CLI version to use in self-mutation and asset publishing steps - * - * If you want to lock the CDK CLI version used in the pipeline, by steps - * that are automatically generated for you, specify the version here. - * - * We recommend you do not specify this value, as not specifying it always - * uses the latest CLI version which is backwards compatible with old versions. - * - * If you do specify it, be aware that this version should always be equal to or higher than the - * version of the CDK framework used by the CDK app, when the CDK commands are - * run during your pipeline execution. When you change this version, the *next - * time* the `SelfMutate` step runs it will still be using the CLI of the the - * *previous* version that was in this property: it will only start using the - * new version after `SelfMutate` completes successfully. That means that if - * you want to update both framework and CLI version, you should update the - * CLI version first, commit, push and deploy, and only then update the - * framework version. - * - * @default - Latest version - */ - readonly cliVersion?: string; - - /** - * Whether the pipeline will update itself - * - * This needs to be set to `true` to allow the pipeline to reconfigure - * itself when assets or stages are being added to it, and `true` is the - * recommended setting. - * - * You can temporarily set this to `false` while you are iterating - * on the pipeline itself and prefer to deploy changes using `cdk deploy`. - * - * @default true - */ - readonly selfMutation?: boolean; - - /** - * Enable Docker for the self-mutate step - * - * Set this to true if the pipeline itself uses Docker container assets - * (for example, if you use `LinuxBuildImage.fromAsset()` as the build - * image of a CodeBuild step in the pipeline). - * - * You do not need to set it if you build Docker image assets in the - * application Stages and Stacks that are *deployed* by this pipeline. - * - * Configures privileged mode for the self-mutation CodeBuild action. - * - * If you are about to turn this on in an already-deployed Pipeline, - * set the value to `true` first, commit and allow the pipeline to - * self-update, and only then use the Docker asset in the pipeline. - * - * @default false - */ - readonly dockerEnabledForSelfMutation?: boolean; - - /** - * Enable Docker for the 'synth' step - * - * Set this to true if you are using file assets that require - * "bundling" anywhere in your application (meaning an asset - * compilation step will be run with the tools provided by - * a Docker image), both for the Pipeline stack as well as the - * application stacks. - * - * A common way to use bundling assets in your application is by - * using the `@aws-cdk/aws-lambda-nodejs` library. - * - * Configures privileged mode for the synth CodeBuild action. - * - * If you are about to turn this on in an already-deployed Pipeline, - * set the value to `true` first, commit and allow the pipeline to - * self-update, and only then use the bundled asset. - * - * @default false - */ - readonly dockerEnabledForSynth?: boolean; - - /** - * Customize the CodeBuild projects created for this pipeline - * - * @default - All projects run non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_6_0 - */ - readonly codeBuildDefaults?: CodeBuildOptions; - - /** - * Additional customizations to apply to the synthesize CodeBuild projects - * - * @default - Only `codeBuildDefaults` are applied - */ - readonly synthCodeBuildDefaults?: CodeBuildOptions; - - /** - * Additional customizations to apply to the asset publishing CodeBuild projects - * - * @default - Only `codeBuildDefaults` are applied - */ - readonly assetPublishingCodeBuildDefaults?: CodeBuildOptions; - - /** - * Additional customizations to apply to the self mutation CodeBuild projects - * - * @default - Only `codeBuildDefaults` are applied - */ - readonly selfMutationCodeBuildDefaults?: CodeBuildOptions; - - /** - * Publish assets in multiple CodeBuild projects - * - * If set to false, use one Project per type to publish all assets. - * - * Publishing in parallel improves concurrency and may reduce publishing - * latency, but may also increase overall provisioning time of the CodeBuild - * projects. - * - * Experiment and see what value works best for you. - * - * @default true - */ - readonly publishAssetsInParallel?: boolean; - - /** - * A list of credentials used to authenticate to Docker registries. - * - * Specify any credentials necessary within the pipeline to build, synth, update, or publish assets. - * - * @default [] - */ - readonly dockerCredentials?: DockerCredential[]; - - /** - * An existing Pipeline to be reused and built upon. - * - * [disable-awslint:ref-via-interface] - * - * @default - a new underlying pipeline is created. - */ - readonly codePipeline?: cp.Pipeline; - - /** - * Reuse the same cross region support stack for all pipelines in the App. - * - * @default - true (Use the same support stack for all pipelines in App) - */ - readonly reuseCrossRegionSupportStacks?: boolean; - - /** - * The IAM role to be assumed by this Pipeline - * - * @default - A new role is created - */ - readonly role?: iam.IRole; - - /** - * Deploy every stack by creating a change set and executing it - * - * When enabled, creates a "Prepare" and "Execute" action for each stack. Disable - * to deploy the stack in one pipeline action. - * - * @default true - */ - readonly useChangeSets?: boolean; - - /** - * Enable KMS key rotation for the generated KMS keys. - * - * By default KMS key rotation is disabled, but will add - * additional costs when enabled. - * - * @default - false (key rotation is disabled) - */ - readonly enableKeyRotation?: boolean; -} - -/** - * Options for customizing a single CodeBuild project - */ -export interface CodeBuildOptions { - /** - * Partial build environment, will be combined with other build environments that apply - * - * @default - Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_6_0 - */ - readonly buildEnvironment?: cb.BuildEnvironment; - - /** - * Policy statements to add to role - * - * @default - No policy statements added to CodeBuild Project Role - */ - readonly rolePolicy?: iam.PolicyStatement[]; - - /** - * Partial buildspec, will be combined with other buildspecs that apply - * - * The BuildSpec must be available inline--it cannot reference a file - * on disk. - * - * @default - No initial BuildSpec - */ - readonly partialBuildSpec?: cb.BuildSpec; - - /** - * Which security group(s) to associate with the project network interfaces. - * - * Only used if 'vpc' is supplied. - * - * @default - Security group will be automatically created. - */ - readonly securityGroups?: ec2.ISecurityGroup[]; - - /** - * The VPC where to create the CodeBuild network interfaces in. - * - * @default - No VPC - */ - readonly vpc?: ec2.IVpc; - - /** - * Which subnets to use. - * - * Only used if 'vpc' is supplied. - * - * @default - All private subnets. - */ - readonly subnetSelection?: ec2.SubnetSelection; - - /** - * Caching strategy to use. - * - * @default - No cache - */ - readonly cache?: cb.Cache; - - /** - * The number of minutes after which AWS CodeBuild stops the build if it's - * not complete. For valid values, see the timeoutInMinutes field in the AWS - * CodeBuild User Guide. - * - * @default Duration.hours(1) - */ - readonly timeout?: Duration; -} - - -/** - * A CDK Pipeline that uses CodePipeline to deploy CDK apps - * - * This is a `Pipeline` with its `engine` property set to - * `CodePipelineEngine`, and exists for nicer ergonomics for - * users that don't need to switch out engines. - */ -export class CodePipeline extends PipelineBase { - /** - * Whether SelfMutation is enabled for this CDK Pipeline - */ - public readonly selfMutationEnabled: boolean; - - private _pipeline?: cp.Pipeline; - private artifacts = new ArtifactMap(); - private _synthProject?: cb.IProject; - private _selfMutationProject?: cb.IProject; - private readonly useChangeSets: boolean; - private _myCxAsmRoot?: string; - private readonly dockerCredentials: DockerCredential[]; - private readonly cachedFnSub = new CachedFnSub(); - private stackOutputs: StackOutputsMap; - - /** - * Asset roles shared for publishing - */ - private readonly assetCodeBuildRoles: Map = new Map(); - - /** - * This is set to the very first artifact produced in the pipeline - */ - private _fallbackArtifact?: cp.Artifact; - - private _cloudAssemblyFileSet?: FileSet; - - private readonly singlePublisherPerAssetType: boolean; - private readonly cliVersion?: string; - - constructor(scope: Construct, id: string, private readonly props: CodePipelineProps) { - super(scope, id, props); - - this.selfMutationEnabled = props.selfMutation ?? true; - this.dockerCredentials = props.dockerCredentials ?? []; - this.singlePublisherPerAssetType = !(props.publishAssetsInParallel ?? true); - this.cliVersion = props.cliVersion ?? preferredCliVersion(); - this.useChangeSets = props.useChangeSets ?? true; - this.stackOutputs = new StackOutputsMap(this); - } - - /** - * The CodeBuild project that performs the Synth - * - * Only available after the pipeline has been built. - */ - public get synthProject(): cb.IProject { - if (!this._synthProject) { - throw new Error('Call pipeline.buildPipeline() before reading this property'); - } - return this._synthProject; - } - - /** - * The CodeBuild project that performs the SelfMutation - * - * Will throw an error if this is accessed before `buildPipeline()` - * is called, or if selfMutation has been disabled. - */ - public get selfMutationProject(): cb.IProject { - if (!this._pipeline) { - throw new Error('Call pipeline.buildPipeline() before reading this property'); - } - if (!this._selfMutationProject) { - throw new Error('No selfMutationProject since the selfMutation property was set to false'); - } - return this._selfMutationProject; - } - - /** - * The CodePipeline pipeline that deploys the CDK app - * - * Only available after the pipeline has been built. - */ - public get pipeline(): cp.Pipeline { - if (!this._pipeline) { - throw new Error('Pipeline not created yet'); - } - return this._pipeline; - } - - - protected doBuildPipeline(): void { - if (this._pipeline) { - throw new Error('Pipeline already created'); - } - - this._myCxAsmRoot = path.resolve(assemblyBuilderOf(appOf(this)).outdir); - - if (this.props.codePipeline) { - if (this.props.pipelineName) { - throw new Error('Cannot set \'pipelineName\' if an existing CodePipeline is given using \'codePipeline\''); - } - if (this.props.crossAccountKeys !== undefined) { - throw new Error('Cannot set \'crossAccountKeys\' if an existing CodePipeline is given using \'codePipeline\''); - } - if (this.props.enableKeyRotation !== undefined) { - throw new Error('Cannot set \'enableKeyRotation\' if an existing CodePipeline is given using \'codePipeline\''); - } - if (this.props.reuseCrossRegionSupportStacks !== undefined) { - throw new Error('Cannot set \'reuseCrossRegionSupportStacks\' if an existing CodePipeline is given using \'codePipeline\''); - } - if (this.props.role !== undefined) { - throw new Error('Cannot set \'role\' if an existing CodePipeline is given using \'codePipeline\''); - } - - this._pipeline = this.props.codePipeline; - } else { - this._pipeline = new cp.Pipeline(this, 'Pipeline', { - pipelineName: this.props.pipelineName, - crossAccountKeys: this.props.crossAccountKeys ?? false, - reuseCrossRegionSupportStacks: this.props.reuseCrossRegionSupportStacks, - // This is necessary to make self-mutation work (deployments are guaranteed - // to happen only after the builds of the latest pipeline definition). - restartExecutionOnUpdate: true, - role: this.props.role, - enableKeyRotation: this.props.enableKeyRotation, - }); - } - - const graphFromBp = new PipelineGraph(this, { - selfMutation: this.selfMutationEnabled, - singlePublisherPerAssetType: this.singlePublisherPerAssetType, - prepareStep: this.useChangeSets, - }); - this._cloudAssemblyFileSet = graphFromBp.cloudAssemblyFileSet; - - this.pipelineStagesAndActionsFromGraph(graphFromBp); - - // Write a dotfile for the pipeline layout - const dotFile = `${Names.uniqueId(this)}.dot`; - fs.writeFileSync(path.join(this.myCxAsmRoot, dotFile), graphFromBp.graph.renderDot().replace(/input\.dot/, dotFile), { encoding: 'utf-8' }); - } - - private get myCxAsmRoot(): string { - if (!this._myCxAsmRoot) { - throw new Error('Can\'t read \'myCxAsmRoot\' if build deployment not called yet'); - } - return this._myCxAsmRoot; - } - - /** - * Scope for Assets-related resources. - * - * Purely exists for construct tree backwards compatibility with legacy pipelines - */ - private get assetsScope(): Construct { - return obtainScope(this, 'Assets'); - } - - private pipelineStagesAndActionsFromGraph(structure: PipelineGraph) { - // Translate graph into Pipeline Stages and Actions - let beforeSelfMutation = this.selfMutationEnabled; - for (const stageNode of flatten(structure.graph.sortedChildren())) { - if (!isGraph(stageNode)) { - throw new Error(`Top-level children must be graphs, got '${stageNode}'`); - } - - // Group our ordered tranches into blocks of 50. - // We can map these onto stages without exceeding the capacity of a Stage. - const chunks = chunkTranches(50, stageNode.sortedLeaves()); - const actionsOverflowStage = chunks.length > 1; - for (const [i, tranches] of enumerate(chunks)) { - const stageName = actionsOverflowStage ? `${stageNode.id}.${i + 1}` : stageNode.id; - const pipelineStage = this.pipeline.addStage({ stageName }); - - const sharedParent = new GraphNodeCollection(flatten(tranches)).commonAncestor(); - - let runOrder = 1; - for (const tranche of tranches) { - const runOrdersConsumed = [0]; - - for (const node of tranche) { - const factory = this.actionFromNode(node); - - const nodeType = this.nodeTypeFromNode(node); - const name = actionName(node, sharedParent); - - const variablesNamespace = node.data?.type === 'step' - ? namespaceStepOutputs(node.data.step, pipelineStage, name) - : undefined; - - const result = factory.produceAction(pipelineStage, { - actionName: name, - runOrder, - artifacts: this.artifacts, - scope: obtainScope(this.pipeline, stageName), - fallbackArtifact: this._fallbackArtifact, - pipeline: this, - // If this step happens to produce a CodeBuild job, set the default options - codeBuildDefaults: nodeType ? this.codeBuildDefaultsFor(nodeType) : undefined, - beforeSelfMutation, - variablesNamespace, - stackOutputsMap: this.stackOutputs, - }); - - if (node.data?.type === 'self-update') { - beforeSelfMutation = false; - } - - this.postProcessNode(node, result); - - runOrdersConsumed.push(result.runOrdersConsumed); - } - - runOrder += Math.max(...runOrdersConsumed); - } - } - } - } - - /** - * Do additional things after the action got added to the pipeline - * - * Some minor state manipulation of CodeBuild projects and pipeline - * artifacts. - */ - private postProcessNode(node: AGraphNode, result: CodePipelineActionFactoryResult) { - const nodeType = this.nodeTypeFromNode(node); - - if (result.project) { - const dockerUsage = dockerUsageFromCodeBuild(nodeType ?? CodeBuildProjectType.STEP); - if (dockerUsage) { - for (const c of this.dockerCredentials) { - c.grantRead(result.project, dockerUsage); - } - } - - if (nodeType === CodeBuildProjectType.SYNTH) { - this._synthProject = result.project; - } - if (nodeType === CodeBuildProjectType.SELF_MUTATE) { - this._selfMutationProject = result.project; - } - } - - if (node.data?.type === 'step' && node.data.step.primaryOutput?.primaryOutput && !this._fallbackArtifact) { - this._fallbackArtifact = this.artifacts.toCodePipeline(node.data.step.primaryOutput?.primaryOutput); - } - } - - /** - * Make an action from the given node and/or step - */ - private actionFromNode(node: AGraphNode): ICodePipelineActionFactory { - switch (node.data?.type) { - // Nothing for these, they are groupings (shouldn't even have popped up here) - case 'group': - case 'stack-group': - case undefined: - throw new Error(`actionFromNode: did not expect to get group nodes: ${node.data?.type}`); - - case 'self-update': - return this.selfMutateAction(); - - case 'publish-assets': - return this.publishAssetsAction(node, node.data.assets); - - case 'prepare': - return this.createChangeSetAction(node.data.stack); - - case 'execute': - return node.data.withoutChangeSet - ? this.executeDeploymentAction(node.data.stack, node.data.captureOutputs) - : this.executeChangeSetAction(node.data.stack, node.data.captureOutputs); - - case 'step': - return this.actionFromStep(node, node.data.step); - - default: - throw new Error(`CodePipeline does not support graph nodes of type '${node.data?.type}'. You are probably using a feature this CDK Pipelines implementation does not support.`); - } - } - - /** - * Take a Step and turn it into a CodePipeline Action - * - * There are only 3 types of Steps we need to support: - * - * - Shell (generic) - * - ManualApproval (generic) - * - CodePipelineActionFactory (CodePipeline-specific) - * - * The rest is expressed in terms of these 3, or in terms of graph nodes - * which are handled elsewhere. - */ - private actionFromStep(node: AGraphNode, step: Step): ICodePipelineActionFactory { - const nodeType = this.nodeTypeFromNode(node); - - // CodePipeline-specific steps first -- this includes Sources - if (isCodePipelineActionFactory(step)) { - return step; - } - - // Now built-in steps - if (step instanceof ShellStep || step instanceof CodeBuildStep) { - // The 'CdkBuildProject' will be the construct ID of the CodeBuild project, necessary for backwards compat - let constructId = nodeType === CodeBuildProjectType.SYNTH - ? 'CdkBuildProject' - : step.id; - - return step instanceof CodeBuildStep - ? CodeBuildFactory.fromCodeBuildStep(constructId, step) - : CodeBuildFactory.fromShellStep(constructId, step); - } - - if (step instanceof ManualApprovalStep) { - return { - produceAction: (stage, options) => { - stage.addAction(new cpa.ManualApprovalAction({ - actionName: options.actionName, - runOrder: options.runOrder, - additionalInformation: step.comment, - })); - return { runOrdersConsumed: 1 }; - }, - }; - } - - throw new Error(`Deployment step '${step}' is not supported for CodePipeline-backed pipelines`); - } - - private createChangeSetAction(stack: StackDeployment): ICodePipelineActionFactory { - const changeSetName = 'PipelineChange'; - - const templateArtifact = this.artifacts.toCodePipeline(this._cloudAssemblyFileSet!); - const templateConfigurationPath = this.writeTemplateConfiguration(stack); - - const region = stack.region !== Stack.of(this).region ? stack.region : undefined; - const account = stack.account !== Stack.of(this).account ? stack.account : undefined; - - const relativeTemplatePath = path.relative(this.myCxAsmRoot, stack.absoluteTemplatePath); - - return { - produceAction: (stage, options) => { - stage.addAction(new cpa.CloudFormationCreateReplaceChangeSetAction({ - actionName: options.actionName, - runOrder: options.runOrder, - changeSetName, - stackName: stack.stackName, - templatePath: templateArtifact.atPath(toPosixPath(relativeTemplatePath)), - adminPermissions: true, - role: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.assumeRoleArn), - deploymentRole: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.executionRoleArn), - region: region, - templateConfiguration: templateConfigurationPath - ? templateArtifact.atPath(toPosixPath(templateConfigurationPath)) - : undefined, - cfnCapabilities: [CfnCapabilities.NAMED_IAM, CfnCapabilities.AUTO_EXPAND], - })); - return { runOrdersConsumed: 1 }; - }, - }; - } - - private executeChangeSetAction(stack: StackDeployment, captureOutputs: boolean): ICodePipelineActionFactory { - const changeSetName = 'PipelineChange'; - - const region = stack.region !== Stack.of(this).region ? stack.region : undefined; - const account = stack.account !== Stack.of(this).account ? stack.account : undefined; - - return { - produceAction: (stage, options) => { - stage.addAction(new cpa.CloudFormationExecuteChangeSetAction({ - actionName: options.actionName, - runOrder: options.runOrder, - changeSetName, - stackName: stack.stackName, - role: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.assumeRoleArn), - region: region, - variablesNamespace: captureOutputs ? stackVariableNamespace(stack) : undefined, - })); - - return { runOrdersConsumed: 1 }; - }, - }; - } - - private executeDeploymentAction(stack: StackDeployment, captureOutputs: boolean): ICodePipelineActionFactory { - const templateArtifact = this.artifacts.toCodePipeline(this._cloudAssemblyFileSet!); - const templateConfigurationPath = this.writeTemplateConfiguration(stack); - - const region = stack.region !== Stack.of(this).region ? stack.region : undefined; - const account = stack.account !== Stack.of(this).account ? stack.account : undefined; - - const relativeTemplatePath = path.relative(this.myCxAsmRoot, stack.absoluteTemplatePath); - - return { - produceAction: (stage, options) => { - stage.addAction(new cpa.CloudFormationCreateUpdateStackAction({ - actionName: options.actionName, - runOrder: options.runOrder, - stackName: stack.stackName, - templatePath: templateArtifact.atPath(toPosixPath(relativeTemplatePath)), - adminPermissions: true, - role: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.assumeRoleArn), - deploymentRole: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.executionRoleArn), - region: region, - templateConfiguration: templateConfigurationPath - ? templateArtifact.atPath(toPosixPath(templateConfigurationPath)) - : undefined, - cfnCapabilities: [CfnCapabilities.NAMED_IAM, CfnCapabilities.AUTO_EXPAND], - variablesNamespace: captureOutputs ? stackVariableNamespace(stack) : undefined, - })); - - return { runOrdersConsumed: 1 }; - }, - }; - } - - private selfMutateAction(): ICodePipelineActionFactory { - const installSuffix = this.cliVersion ? `@${this.cliVersion}` : ''; - - const pipelineStack = Stack.of(this.pipeline); - const pipelineStackIdentifier = pipelineStack.node.path ?? pipelineStack.stackName; - - const step = new CodeBuildStep('SelfMutate', { - projectName: maybeSuffix(this.props.pipelineName, '-selfupdate'), - input: this._cloudAssemblyFileSet, - installCommands: [ - `npm install -g aws-cdk${installSuffix}`, - ], - commands: [ - `cdk -a ${toPosixPath(embeddedAsmPath(this.pipeline))} deploy ${pipelineStackIdentifier} --require-approval=never --verbose`, - ], - - rolePolicyStatements: [ - // allow the self-mutating project permissions to assume the bootstrap Action role - new iam.PolicyStatement({ - actions: ['sts:AssumeRole'], - resources: [`arn:*:iam::${Stack.of(this.pipeline).account}:role/*`], - conditions: { - 'ForAnyValue:StringEquals': { - 'iam:ResourceTag/aws-cdk:bootstrap-role': ['image-publishing', 'file-publishing', 'deploy'], - }, - }, - }), - new iam.PolicyStatement({ - actions: ['cloudformation:DescribeStacks'], - resources: ['*'], // this is needed to check the status of the bootstrap stack when doing `cdk deploy` - }), - // S3 checks for the presence of the ListBucket permission - new iam.PolicyStatement({ - actions: ['s3:ListBucket'], - resources: ['*'], - }), - ], - }); - - // Different on purpose -- id needed for backwards compatible LogicalID - return CodeBuildFactory.fromCodeBuildStep('SelfMutation', step, { - additionalConstructLevel: false, - scope: obtainScope(this, 'UpdatePipeline'), - }); - } - - private publishAssetsAction(node: AGraphNode, assets: StackAsset[]): ICodePipelineActionFactory { - const installSuffix = this.cliVersion ? `@${this.cliVersion}` : ''; - - const commands = assets.map(asset => { - const relativeAssetManifestPath = path.relative(this.myCxAsmRoot, asset.assetManifestPath); - return `cdk-assets --path "${toPosixPath(relativeAssetManifestPath)}" --verbose publish "${asset.assetSelector}"`; - }); - - const assetType = assets[0].assetType; - if (assets.some(a => a.assetType !== assetType)) { - throw new Error('All assets in a single publishing step must be of the same type'); - } - - const role = this.obtainAssetCodeBuildRole(assets[0].assetType); - - for (const roleArn of assets.flatMap(a => a.assetPublishingRoleArn ? [a.assetPublishingRoleArn] : [])) { - // The ARNs include raw AWS pseudo parameters (e.g., ${AWS::Partition}), which need to be substituted. - role.addAssumeRole(this.cachedFnSub.fnSub(roleArn)); - }; - - // The base commands that need to be run - const script = new CodeBuildStep(node.id, { - commands, - installCommands: [ - `npm install -g cdk-assets${installSuffix}`, - ], - input: this._cloudAssemblyFileSet, - buildEnvironment: { - privileged: assets.some(asset => asset.assetType === AssetType.DOCKER_IMAGE), - }, - role, - }); - - // Customizations that are not accessible to regular users - return CodeBuildFactory.fromCodeBuildStep(node.id, script, { - additionalConstructLevel: false, - - // If we use a single publisher, pass buildspec via file otherwise it'll - // grow too big. - passBuildSpecViaCloudAssembly: this.singlePublisherPerAssetType, - scope: this.assetsScope, - }); - } - - private nodeTypeFromNode(node: AGraphNode) { - if (node.data?.type === 'step') { - return !!node.data?.isBuildStep ? CodeBuildProjectType.SYNTH : CodeBuildProjectType.STEP; - } - if (node.data?.type === 'publish-assets') { - return CodeBuildProjectType.ASSETS; - } - if (node.data?.type === 'self-update') { - return CodeBuildProjectType.SELF_MUTATE; - } - return undefined; - } - - private codeBuildDefaultsFor(nodeType: CodeBuildProjectType): CodeBuildOptions | undefined { - const defaultOptions: CodeBuildOptions = { - buildEnvironment: { - buildImage: CDKP_DEFAULT_CODEBUILD_IMAGE, - computeType: cb.ComputeType.SMALL, - }, - }; - - const typeBasedCustomizations = { - [CodeBuildProjectType.SYNTH]: this.props.dockerEnabledForSynth - ? mergeCodeBuildOptions(this.props.synthCodeBuildDefaults, { buildEnvironment: { privileged: true } }) - : this.props.synthCodeBuildDefaults, - - [CodeBuildProjectType.ASSETS]: this.props.assetPublishingCodeBuildDefaults, - - [CodeBuildProjectType.SELF_MUTATE]: this.props.dockerEnabledForSelfMutation - ? mergeCodeBuildOptions(this.props.selfMutationCodeBuildDefaults, { buildEnvironment: { privileged: true } }) - : this.props.selfMutationCodeBuildDefaults, - - [CodeBuildProjectType.STEP]: {}, - }; - - const dockerUsage = dockerUsageFromCodeBuild(nodeType); - const dockerCommands = dockerUsage !== undefined - ? dockerCredentialsInstallCommands(dockerUsage, this.dockerCredentials, 'both') - : []; - const typeBasedDockerCommands = dockerCommands.length > 0 ? { - partialBuildSpec: cb.BuildSpec.fromObject({ - version: '0.2', - phases: { - pre_build: { - commands: dockerCommands, - }, - }, - }), - } : {}; - - return mergeCodeBuildOptions( - defaultOptions, - this.props.codeBuildDefaults, - typeBasedCustomizations[nodeType], - typeBasedDockerCommands, - ); - } - - private roleFromPlaceholderArn(scope: Construct, region: string | undefined, - account: string | undefined, arn: string): iam.IRole; - private roleFromPlaceholderArn(scope: Construct, region: string | undefined, - account: string | undefined, arn: string | undefined): iam.IRole | undefined; - private roleFromPlaceholderArn(scope: Construct, region: string | undefined, - account: string | undefined, arn: string | undefined): iam.IRole | undefined { - - if (!arn) { return undefined; } - - // Use placeholder arn as construct ID. - const id = arn; - - // https://github.com/aws/aws-cdk/issues/7255 - let existingRole = scope.node.tryFindChild(`ImmutableRole${id}`) as iam.IRole; - if (existingRole) { return existingRole; } - // For when #7255 is fixed. - existingRole = scope.node.tryFindChild(id) as iam.IRole; - if (existingRole) { return existingRole; } - - const arnToImport = cxapi.EnvironmentPlaceholders.replace(arn, { - region: region ?? Aws.REGION, - accountId: account ?? Aws.ACCOUNT_ID, - partition: Aws.PARTITION, - }); - return iam.Role.fromRoleArn(scope, id, arnToImport, { mutable: false, addGrantsToResources: true }); - } - - /** - * Non-template config files for CodePipeline actions - * - * Currently only supports tags. - */ - private writeTemplateConfiguration(stack: StackDeployment): string | undefined { - if (Object.keys(stack.tags).length === 0) { return undefined; } - - const absConfigPath = `${stack.absoluteTemplatePath}.config.json`; - const relativeConfigPath = path.relative(this.myCxAsmRoot, absConfigPath); - - // Write the template configuration file (for parameters into CreateChangeSet call that - // cannot be configured any other way). They must come from a file, and there's unfortunately - // no better hook to write this file (`construct.onSynthesize()` would have been the prime candidate - // but that is being deprecated--and DeployCdkStackAction isn't even a construct). - writeTemplateConfiguration(absConfigPath, { - Tags: noUndefined(stack.tags), - }); - - return relativeConfigPath; - } - - /** - * This role is used by both the CodePipeline build action and related CodeBuild project. Consolidating these two - * roles into one, and re-using across all assets, saves significant size of the final synthesized output. - * Modeled after the CodePipeline role and 'CodePipelineActionRole' roles. - * Generates one role per asset type to separate file and Docker/image-based permissions. - */ - private obtainAssetCodeBuildRole(assetType: AssetType): AssetSingletonRole { - const existing = this.assetCodeBuildRoles.get(assetType); - if (existing) { - return existing; - } - - const stack = Stack.of(this); - - const rolePrefix = assetType === AssetType.DOCKER_IMAGE ? 'Docker' : 'File'; - const assetRole = new AssetSingletonRole(this.assetsScope, `${rolePrefix}Role`, { - roleName: PhysicalName.GENERATE_IF_NEEDED, - assumedBy: new iam.CompositePrincipal( - new iam.ServicePrincipal('codebuild.amazonaws.com'), - new iam.AccountPrincipal(stack.account), - ), - }); - - // Grant pull access for any ECR registries and secrets that exist - if (assetType === AssetType.DOCKER_IMAGE) { - this.dockerCredentials.forEach(reg => reg.grantRead(assetRole, DockerCredentialUsage.ASSET_PUBLISHING)); - } - - this.assetCodeBuildRoles.set(assetType, assetRole); - return assetRole; - } - -} - -function dockerUsageFromCodeBuild(cbt: CodeBuildProjectType): DockerCredentialUsage | undefined { - switch (cbt) { - case CodeBuildProjectType.ASSETS: return DockerCredentialUsage.ASSET_PUBLISHING; - case CodeBuildProjectType.SELF_MUTATE: return DockerCredentialUsage.SELF_UPDATE; - case CodeBuildProjectType.SYNTH: return DockerCredentialUsage.SYNTH; - case CodeBuildProjectType.STEP: return undefined; - } -} - -enum CodeBuildProjectType { - SYNTH = 'SYNTH', - ASSETS = 'ASSETS', - SELF_MUTATE = 'SELF_MUTATE', - STEP = 'STEP', -} - -/** - * Take a set of tranches and split them up into groups so - * that no set of tranches has more than n items total - */ -function chunkTranches
(n: number, xss: A[][]): A[][][] { - const ret: A[][][] = []; - - while (xss.length > 0) { - const tranches: A[][] = []; - let count = 0; - - while (xss.length > 0) { - const xs = xss[0]; - const spaceRemaining = n - count; - if (xs.length <= spaceRemaining) { - tranches.push(xs); - count += xs.length; - xss.shift(); - } else { - tranches.push(xs.splice(0, spaceRemaining)); - count = n; - break; - } - } - - ret.push(tranches); - } - - - return ret; -} - -function isCodePipelineActionFactory(x: any): x is ICodePipelineActionFactory { - return !!(x as ICodePipelineActionFactory).produceAction; -} diff --git a/packages/@aws-cdk/pipelines/lib/legacy/pipeline.ts b/packages/@aws-cdk/pipelines/lib/legacy/pipeline.ts deleted file mode 100644 index a7c224bde5611..0000000000000 --- a/packages/@aws-cdk/pipelines/lib/legacy/pipeline.ts +++ /dev/null @@ -1,626 +0,0 @@ -import * as path from 'path'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Annotations, App, CfnOutput, PhysicalName, Stack, Stage } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import { DeployCdkStackAction, PublishAssetsAction, UpdatePipelineAction } from './actions'; -import { AddStageOptions, AssetPublishingCommand, BaseStageOptions, CdkStage, StackOutput } from './stage'; -import { SimpleSynthAction } from './synths'; -import { AssetType } from '../blueprint/asset-type'; -import { dockerCredentialsInstallCommands, DockerCredential, DockerCredentialUsage } from '../docker-credentials'; -import { ApplicationSecurityCheck } from '../private/application-security-check'; -import { AssetSingletonRole } from '../private/asset-singleton-role'; -import { CachedFnSub } from '../private/cached-fnsub'; -import { preferredCliVersion } from '../private/cli-version'; -import { appOf, assemblyBuilderOf } from '../private/construct-internals'; - -const CODE_BUILD_LENGTH_LIMIT = 100; -/** - * Properties for a CdkPipeline - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface CdkPipelineProps { - /** - * The CodePipeline action used to retrieve the CDK app's source - * - * @default - Required unless `codePipeline` is given - */ - readonly sourceAction?: codepipeline.IAction; - - /** - * The CodePipeline action build and synthesis step of the CDK app - * - * @default - Required unless `codePipeline` or `sourceAction` is given - */ - readonly synthAction?: codepipeline.IAction; - - /** - * The artifact you have defined to be the artifact to hold the cloudAssemblyArtifact for the synth action - */ - readonly cloudAssemblyArtifact: codepipeline.Artifact; - - /** - * Existing CodePipeline to add deployment stages to - * - * Use this if you want more control over the CodePipeline that gets created. - * You can choose to not pass this value, in which case a new CodePipeline is - * created with default settings. - * - * If you pass an existing CodePipeline, it should have been created - * with `restartExecutionOnUpdate: true`. - * - * [disable-awslint:ref-via-interface] - * - * @default - A new CodePipeline is automatically generated - */ - readonly codePipeline?: codepipeline.Pipeline; - - /** - * Name of the pipeline - * - * Can only be set if `codePipeline` is not set. - * - * @default - A name is automatically generated - */ - readonly pipelineName?: string; - - /** - * Create KMS keys for cross-account deployments - * - * This controls whether the pipeline is enabled for cross-account deployments. - * - * Can only be set if `codePipeline` is not set. - * - * By default cross-account deployments are enabled, but this feature requires - * that KMS Customer Master Keys are created which have a cost of $1/month. - * - * If you do not need cross-account deployments, you can set this to `false` to - * not create those keys and save on that cost (the artifact bucket will be - * encrypted with an AWS-managed key). However, cross-account deployments will - * no longer be possible. - * - * @default true - */ - readonly crossAccountKeys?: boolean; - // @deprecated(v2): switch to default false - - - /** - * Enables KMS key rotation for cross-account keys. - * - * Cannot be set if `crossAccountKeys` was set to `false`. - * - * Key rotation costs $1/month when enabled. - * - * @default - false (key rotation is disabled) - */ - readonly enableKeyRotation?: boolean; - - - /** - * CDK CLI version to use in pipeline - * - * Some Actions in the pipeline will download and run a version of the CDK - * CLI. Specify the version here. - * - * @default - Latest version - */ - readonly cdkCliVersion?: string; - - /** - * The VPC where to execute the CdkPipeline actions. - * - * @default - No VPC - */ - readonly vpc?: ec2.IVpc; - - /** - * Which subnets to use. - * - * Only used if 'vpc' is supplied. - * - * @default - All private subnets. - */ - readonly subnetSelection?: ec2.SubnetSelection; - - /** - * Whether the pipeline will update itself - * - * This needs to be set to `true` to allow the pipeline to reconfigure - * itself when assets or stages are being added to it, and `true` is the - * recommended setting. - * - * You can temporarily set this to `false` while you are iterating - * on the pipeline itself and prefer to deploy changes using `cdk deploy`. - * - * @default true - */ - readonly selfMutating?: boolean; - - /** - * Custom BuildSpec that is merged with generated one (for self-mutation stage) - * - * @default - none - */ - readonly selfMutationBuildSpec?: codebuild.BuildSpec; - - /** - * Whether this pipeline creates one asset upload action per asset type or one asset upload per asset - * - * @default false - */ - readonly singlePublisherPerType?: boolean; - - /** - * Additional commands to run before installing cdk-assets during the asset publishing step - * Use this to setup proxies or npm mirrors - * - * @default - - */ - readonly assetPreInstallCommands?: string[]; - - /** - * Custom BuildSpec that is merged with generated one (for asset publishing actions) - * - * @default - none - */ - readonly assetBuildSpec?: codebuild.BuildSpec; - - /** - * Whether the pipeline needs to build Docker images in the UpdatePipeline stage. - * - * If the UpdatePipeline stage tries to build a Docker image and this flag is not - * set to `true`, the build step will run in non-privileged mode and consequently - * will fail with a message like: - * - * > Cannot connect to the Docker daemon at unix:///var/run/docker.sock. - * > Is the docker daemon running? - * - * This flag has an effect only if `selfMutating` is also `true`. - * - * @default - false - */ - readonly supportDockerAssets?: boolean; - - /** - * A list of credentials used to authenticate to Docker registries. - * - * Specify any credentials necessary within the pipeline to build, synth, update, or publish assets. - * - * @default [] - */ - readonly dockerCredentials?: DockerCredential[]; -} - -/** - * A Pipeline to deploy CDK apps - * - * Defines an AWS CodePipeline-based Pipeline to deploy CDK applications. - * - * Automatically manages the following: - * - * - Stack dependency order. - * - Asset publishing. - * - Keeping the pipeline up-to-date as the CDK apps change. - * - Using stack outputs later on in the pipeline. - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export class CdkPipeline extends Construct { - private readonly _pipeline: codepipeline.Pipeline; - private readonly _assets: AssetPublishing; - private readonly _stages: CdkStage[] = []; - private readonly _outputArtifacts: Record = {}; - private readonly _cloudAssemblyArtifact: codepipeline.Artifact; - private readonly _dockerCredentials: DockerCredential[]; - private _applicationSecurityCheck?: ApplicationSecurityCheck; - private readonly cliVersion?: string; - - constructor(scope: Construct, id: string, props: CdkPipelineProps) { - super(scope, id); - this.cliVersion = props.cdkCliVersion ?? preferredCliVersion(); - - if (!App.isApp(this.node.root)) { - throw new Error('CdkPipeline must be created under an App'); - } - - this._cloudAssemblyArtifact = props.cloudAssemblyArtifact; - this._dockerCredentials = props.dockerCredentials ?? []; - const pipelineStack = Stack.of(this); - - if (props.codePipeline) { - if (props.pipelineName) { - throw new Error('Cannot set \'pipelineName\' if an existing CodePipeline is given using \'codePipeline\''); - } - if (props.crossAccountKeys !== undefined) { - throw new Error('Cannot set \'crossAccountKeys\' if an existing CodePipeline is given using \'codePipeline\''); - } - if (props.enableKeyRotation !== undefined) { - throw new Error('Cannot set \'enableKeyRotation\' if an existing CodePipeline is given using \'codePipeline\''); - } - - this._pipeline = props.codePipeline; - } else { - this._pipeline = new codepipeline.Pipeline(this, 'Pipeline', { - pipelineName: props.pipelineName, - crossAccountKeys: props.crossAccountKeys, - enableKeyRotation: props.enableKeyRotation, - restartExecutionOnUpdate: true, - }); - } - - if (props.sourceAction && !props.synthAction) { - // Because of ordering limitations, you can: bring your own Source, bring your own - // Both, or bring your own Nothing. You cannot bring your own Build (which because of the - // current CodePipeline API must go BEFORE what we're adding) and then having us add a - // Source after it. That doesn't make any sense. - throw new Error('When passing a \'sourceAction\' you must also pass a \'synthAction\' (or a \'codePipeline\' that already has both)'); - } - if (!props.sourceAction && (!props.codePipeline || props.codePipeline.stages.length < 1)) { - throw new Error('You must pass a \'sourceAction\' (or a \'codePipeline\' that already has a Source stage)'); - } - - if (props.sourceAction) { - this._pipeline.addStage({ - stageName: 'Source', - actions: [props.sourceAction], - }); - } - - if (props.synthAction) { - if (props.synthAction instanceof SimpleSynthAction && this._dockerCredentials.length > 0) { - props.synthAction._addDockerCredentials(this._dockerCredentials); - } - - this._pipeline.addStage({ - stageName: 'Build', - actions: [props.synthAction], - }); - } - - if (props.selfMutating ?? true) { - this._pipeline.addStage({ - stageName: 'UpdatePipeline', - actions: [new UpdatePipelineAction(this, 'UpdatePipeline', { - cloudAssemblyInput: this._cloudAssemblyArtifact, - pipelineStackHierarchicalId: pipelineStack.node.path, - cdkCliVersion: this.cliVersion, - projectName: maybeSuffix(props.pipelineName, '-selfupdate'), - privileged: props.supportDockerAssets, - dockerCredentials: this._dockerCredentials, - buildSpec: props.selfMutationBuildSpec, - })], - }); - } - - this._assets = new AssetPublishing(this, 'Assets', { - cloudAssemblyInput: this._cloudAssemblyArtifact, - cdkCliVersion: this.cliVersion, - pipeline: this._pipeline, - projectName: maybeSuffix(props.pipelineName, '-publish'), - vpc: props.vpc, - subnetSelection: props.subnetSelection, - singlePublisherPerType: props.singlePublisherPerType, - preInstallCommands: props.assetPreInstallCommands, - buildSpec: props.assetBuildSpec, - dockerCredentials: this._dockerCredentials, - }); - - this.node.addValidation({ validate: () => this.validatePipeline() }); - } - - /** - * The underlying CodePipeline object - * - * You can use this to add more Stages to the pipeline, or Actions - * to Stages. - */ - public get codePipeline(): codepipeline.Pipeline { - return this._pipeline; - } - - /** - * Access one of the pipeline's stages by stage name - * - * You can use this to add more Actions to a stage. - */ - public stage(stageName: string): codepipeline.IStage { - return this._pipeline.stage(stageName); - } - - /** - * Get a cached version of an Application Security Check, which consists of: - * - CodeBuild Project to check for security changes in a stage - * - Lambda Function that approves the manual approval if no security changes are detected - * - * @internal - */ - public _getApplicationSecurityCheck(): ApplicationSecurityCheck { - if (!this._applicationSecurityCheck) { - this._applicationSecurityCheck = new ApplicationSecurityCheck(this, 'PipelineApplicationSecurityCheck', { - codePipeline: this._pipeline, - }); - } - return this._applicationSecurityCheck; - } - - /** - * Add pipeline stage that will deploy the given application stage - * - * The application construct should subclass `Stage` and can contain any - * number of `Stacks` inside it that may have dependency relationships - * on one another. - * - * All stacks in the application will be deployed in the appropriate order, - * and all assets found in the application will be added to the asset - * publishing stage. - */ - public addApplicationStage(appStage: Stage, options: AddStageOptions = {}): CdkStage { - const stage = this.addStage(appStage.stageName, options); - stage.addApplication(appStage, options); - return stage; - } - - /** - * Add a new, empty stage to the pipeline - * - * Prefer to use `addApplicationStage` if you are intended to deploy a CDK - * application, but you can use this method if you want to add other kinds of - * Actions to a pipeline. - */ - public addStage(stageName: string, options?: BaseStageOptions) { - const pipelineStage = this._pipeline.addStage({ - stageName, - }); - - const stage = new CdkStage(this, stageName, { - cloudAssemblyArtifact: this._cloudAssemblyArtifact, - pipelineStage, - stageName, - host: { - publishAsset: this._assets.addPublishAssetAction.bind(this._assets), - stackOutputArtifact: (artifactId) => this._outputArtifacts[artifactId], - }, - ...options, - }); - this._stages.push(stage); - return stage; - } - - /** - * Get the StackOutput object that holds this CfnOutput's value in this pipeline - * - * `StackOutput` can be used in validation actions later in the pipeline. - */ - public stackOutput(cfnOutput: CfnOutput): StackOutput { - const stack = Stack.of(cfnOutput); - - if (!this._outputArtifacts[stack.artifactId]) { - // We should have stored the ArtifactPath in the map, but its Artifact - // property isn't publicly readable... - const artifactName = `${stack.artifactId}_Outputs`; - const compactName = artifactName.slice(artifactName.length - Math.min(artifactName.length, CODE_BUILD_LENGTH_LIMIT)); - this._outputArtifacts[stack.artifactId] = new codepipeline.Artifact(compactName); - } - - return new StackOutput(this._outputArtifacts[stack.artifactId].atPath('outputs.json'), cfnOutput.logicalId); - } - - /** - * Validate that we don't have any stacks violating dependency order in the pipeline - * - * Our own convenience methods will never generate a pipeline that does that (although - * this is a nice verification), but a user can also add the stacks by hand. - */ - private validatePipeline(): string[] { - const ret = new Array(); - - ret.push(...this.validateDeployOrder()); - ret.push(...this.validateRequestedOutputs()); - - return ret; - } - - /** - * Return all StackDeployActions in an ordered list - */ - private get stackActions(): DeployCdkStackAction[] { - return flatMap(this._pipeline.stages, s => s.actions.filter(isDeployAction)); - } - - private * validateDeployOrder(): IterableIterator { - const stackActions = this.stackActions; - for (const stackAction of stackActions) { - // For every dependency, it must be executed in an action before this one is prepared. - for (const depId of stackAction.dependencyStackArtifactIds) { - const depAction = stackActions.find(s => s.stackArtifactId === depId); - - if (depAction === undefined) { - Annotations.of(this).addWarning(`Stack '${stackAction.stackName}' depends on stack ` + - `'${depId}', but that dependency is not deployed through the pipeline!`); - } else if (!(depAction.executeRunOrder < stackAction.prepareRunOrder)) { - yield `Stack '${stackAction.stackName}' depends on stack ` + - `'${depAction.stackName}', but is deployed before it in the pipeline!`; - } - } - } - } - - private * validateRequestedOutputs(): IterableIterator { - const artifactIds = this.stackActions.map(s => s.stackArtifactId); - - for (const artifactId of Object.keys(this._outputArtifacts)) { - if (!artifactIds.includes(artifactId)) { - yield `Trying to use outputs for Stack '${artifactId}', but Stack is not deployed in this pipeline. Add it to the pipeline.`; - } - } - } -} - -function isDeployAction(a: codepipeline.IAction): a is DeployCdkStackAction { - return a instanceof DeployCdkStackAction; -} - -function flatMap(xs: A[], f: (x: A) => B[]): B[] { - return Array.prototype.concat([], ...xs.map(f)); -} - -interface AssetPublishingProps { - readonly cloudAssemblyInput: codepipeline.Artifact; - readonly pipeline: codepipeline.Pipeline; - readonly cdkCliVersion?: string; - readonly projectName?: string; - readonly vpc?: ec2.IVpc; - readonly subnetSelection?: ec2.SubnetSelection; - readonly singlePublisherPerType?: boolean; - readonly preInstallCommands?: string[]; - readonly buildSpec?: codebuild.BuildSpec; - readonly dockerCredentials: DockerCredential[]; -} - -/** - * Add appropriate publishing actions to the asset publishing stage - */ -class AssetPublishing extends Construct { - // CodePipelines has a hard limit of 50 actions per stage. See https://github.com/aws/aws-cdk/issues/9353 - private readonly MAX_PUBLISHERS_PER_STAGE = 50; - - private readonly publishers: Record = {}; - private readonly assetRoles: Map = new Map(); - private readonly assetAttachedPolicies: Record = {}; - private readonly myCxAsmRoot: string; - private readonly cachedFnSub = new CachedFnSub(); - - private readonly lastStageBeforePublishing?: codepipeline.IStage; - private readonly stages: codepipeline.IStage[] = []; - private readonly pipeline: codepipeline.Pipeline; - private readonly dockerCredentials: DockerCredential[]; - - private _fileAssetCtr = 0; - private _dockerAssetCtr = 0; - - constructor(scope: Construct, id: string, private readonly props: AssetPublishingProps) { - super(scope, id); - this.myCxAsmRoot = path.resolve(assemblyBuilderOf(appOf(this)).outdir); - - this.pipeline = this.props.pipeline; - // Hacks to get access to the innards of Pipeline - const stages: codepipeline.IStage[] = (this.props.pipeline as any)._stages; - // Any asset publishing stages will be added directly after the last stage that currently exists. - this.lastStageBeforePublishing = stages.slice(-1)[0]; - - this.dockerCredentials = props.dockerCredentials; - } - - /** - * Make sure there is an action in the stage to publish the given asset - * - * Assets are grouped by asset ID (which represent individual assets) so all assets - * are published in parallel. For each assets, all destinations are published sequentially - * so that we can reuse expensive operations between them (mostly: building a Docker image). - */ - public addPublishAssetAction(command: AssetPublishingCommand) { - // FIXME: this is silly, we need the relative path here but no easy way to get it - const relativePath = path.relative(this.myCxAsmRoot, command.assetManifestPath); - - // The path cannot be outside the asm root. I don't really understand how this could ever - // come to pass, but apparently it has (see https://github.com/aws/aws-cdk/issues/9766). - // Add a sanity check here so we can catch it more quickly next time. - if (relativePath.startsWith(`..${path.sep}`)) { - throw new Error(`The asset manifest (${command.assetManifestPath}) cannot be outside the Cloud Assembly directory (${this.myCxAsmRoot}). Please report this error at https://github.com/aws/aws-cdk/issues to help us debug why this is happening.`); - } - - // Late-binding here (rather than in the constructor) to prevent creating the role in cases where no asset actions are created. - const assetRole = this.generateAssetRole(command.assetType); - // The ARNs include raw AWS pseudo parameters (e.g., ${AWS::Partition}), which need to be substituted. - assetRole.addAssumeRole(this.cachedFnSub.fnSub(command.assetPublishingRoleArn)); - const publisherKey = this.props.singlePublisherPerType ? command.assetType.toString() : command.assetId; - - let action = this.publishers[publisherKey]; - if (!action) { - // Dynamically create new stages as needed, with `MAX_PUBLISHERS_PER_STAGE` assets per stage. - const stageIndex = this.props.singlePublisherPerType ? 0 : - Math.floor((this._fileAssetCtr + this._dockerAssetCtr) / this.MAX_PUBLISHERS_PER_STAGE); - - if (!this.props.singlePublisherPerType && stageIndex >= this.stages.length) { - const previousStage = this.stages.slice(-1)[0] ?? this.lastStageBeforePublishing; - this.stages.push(this.pipeline.addStage({ - stageName: `Assets${stageIndex > 0 ? stageIndex + 1 : ''}`, - placement: { justAfter: previousStage }, - })); - } else if (this.props.singlePublisherPerType && this.stages.length == 0) { - this.stages.push(this.pipeline.addStage({ - stageName: 'Assets', - placement: { justAfter: this.lastStageBeforePublishing }, - })); - } - - // The asset ID would be a logical candidate for the construct path and project names, but if the asset - // changes it leads to recreation of a number of Role/Policy/Project resources which is slower than - // necessary. Number sequentially instead. - // - // FIXME: The ultimate best solution is probably to generate a single Project per asset type - // and reuse that for all assets. - const id = this.props.singlePublisherPerType ? - command.assetType === AssetType.FILE ? 'FileAsset' : 'DockerAsset' : - command.assetType === AssetType.FILE ? `FileAsset${++this._fileAssetCtr}` : `DockerAsset${++this._dockerAssetCtr}`; - - const credsInstallCommands = dockerCredentialsInstallCommands(DockerCredentialUsage.ASSET_PUBLISHING, this.dockerCredentials); - - // NOTE: It's important that asset changes don't force a pipeline self-mutation. - // This can cause an infinite loop of updates (see https://github.com/aws/aws-cdk/issues/9080). - // For that reason, we use the id as the actionName below, rather than the asset hash. - action = this.publishers[publisherKey] = new PublishAssetsAction(this, id, { - actionName: id, - cloudAssemblyInput: this.props.cloudAssemblyInput, - cdkCliVersion: this.props.cdkCliVersion, - assetType: command.assetType, - role: this.assetRoles.get(command.assetType), - dependable: this.assetAttachedPolicies[command.assetType], - vpc: this.props.vpc, - subnetSelection: this.props.subnetSelection, - buildSpec: this.props.buildSpec, - createBuildspecFile: this.props.singlePublisherPerType, - preInstallCommands: [...(this.props.preInstallCommands ?? []), ...credsInstallCommands], - }); - this.stages[stageIndex].addAction(action); - } - - action.addPublishCommand(relativePath, command.assetSelector); - } - - /** - * This role is used by both the CodePipeline build action and related CodeBuild project. Consolidating these two - * roles into one, and re-using across all assets, saves significant size of the final synthesized output. - * Modeled after the CodePipeline role and 'CodePipelineActionRole' roles. - * Generates one role per asset type to separate file and Docker/image-based permissions. - */ - private generateAssetRole(assetType: AssetType) { - const existing = this.assetRoles.get(assetType); - if (existing) { - return existing; - } - - const rolePrefix = assetType === AssetType.DOCKER_IMAGE ? 'Docker' : 'File'; - const assetRole = new AssetSingletonRole(this, `${rolePrefix}Role`, { - roleName: PhysicalName.GENERATE_IF_NEEDED, - assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('codebuild.amazonaws.com'), new iam.AccountPrincipal(Stack.of(this).account)), - }); - - // Grant pull access for any ECR registries and secrets that exist - if (assetType === AssetType.DOCKER_IMAGE) { - this.dockerCredentials.forEach(reg => reg.grantRead(assetRole, DockerCredentialUsage.ASSET_PUBLISHING)); - } - - this.assetRoles.set(assetType, assetRole); - return assetRole; - } -} - -function maybeSuffix(x: string | undefined, suffix: string): string | undefined { - if (x === undefined) { return undefined; } - return `${x}${suffix}`; -} diff --git a/packages/@aws-cdk/pipelines/lib/legacy/stage.ts b/packages/@aws-cdk/pipelines/lib/legacy/stage.ts deleted file mode 100644 index 4bba0ef8aa1f9..0000000000000 --- a/packages/@aws-cdk/pipelines/lib/legacy/stage.ts +++ /dev/null @@ -1,587 +0,0 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cpactions from '@aws-cdk/aws-codepipeline-actions'; -import { CodeBuildAction } from '@aws-cdk/aws-codepipeline-actions'; -import * as sns from '@aws-cdk/aws-sns'; -import { Stage, Aspects } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Construct, Node } from 'constructs'; -import { DeployCdkStackAction } from './actions'; -import { CdkPipeline } from './pipeline'; -import { AssetType } from '../blueprint/asset-type'; -import { ApplicationSecurityCheck } from '../private/application-security-check'; -import { AssetManifestReader, DockerImageManifestEntry, FileManifestEntry } from '../private/asset-manifest'; -import { pipelineSynth } from '../private/construct-internals'; -import { topologicalSort } from '../private/toposort'; - -/** - * Construction properties for a CdkStage - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface CdkStageProps { - /** - * Name of the stage that should be created - */ - readonly stageName: string; - - /** - * The underlying Pipeline Stage associated with thisCdkStage - */ - readonly pipelineStage: codepipeline.IStage; - - /** - * The CodePipeline Artifact with the Cloud Assembly - */ - readonly cloudAssemblyArtifact: codepipeline.Artifact; - - /** - * Features the Stage needs from its environment - */ - readonly host: IStageHost; - - /** - * Run a security check before every application prepare/deploy actions. - * - * Note: Stage level security check can be overriden per application as follows: - * `stage.addApplication(app, { confirmBroadeningPermissions: false })` - * - * @default false - */ - readonly confirmBroadeningPermissions?: boolean; - - /** - * Optional SNS topic to send notifications to when any security check registers - * changes within a application. - * - * Note: The Stage Notification Topic can be overriden per application as follows: - * `stage.addApplication(app, { securityNotificationTopic: newTopic })` - * - * @default undefined no stage level notification topic - */ - readonly securityNotificationTopic?: sns.ITopic; -} - - -/** - * Stage in a CdkPipeline - * - * You don't need to instantiate this class directly. Use - * `cdkPipeline.addStage()` instead. - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export class CdkStage extends Construct { - private _nextSequentialRunOrder = 1; // Must start at 1 eh - private _manualApprovalCounter = 1; - private readonly pipelineStage: codepipeline.IStage; - private readonly cloudAssemblyArtifact: codepipeline.Artifact; - private readonly stacksToDeploy = new Array(); - private readonly stageName: string; - private readonly host: IStageHost; - private readonly confirmBroadeningPermissions: boolean; - private readonly pipeline?: CdkPipeline; - private readonly securityNotificationTopic?: sns.ITopic; - private _applicationSecurityCheck?: ApplicationSecurityCheck; - private _prepared = false; - - constructor(scope: Construct, id: string, props: CdkStageProps) { - super(scope, id); - - if (scope instanceof CdkPipeline) { - this.pipeline = scope; - } - - this.stageName = props.stageName; - this.pipelineStage = props.pipelineStage; - this.cloudAssemblyArtifact = props.cloudAssemblyArtifact; - this.host = props.host; - this.confirmBroadeningPermissions = props.confirmBroadeningPermissions ?? false; - this.securityNotificationTopic = props.securityNotificationTopic; - - Aspects.of(this).add({ visit: () => this.prepareStage() }); - } - - /** - * Add all stacks in the application Stage to this stage - * - * The application construct should subclass `Stage` and can contain any - * number of `Stacks` inside it that may have dependency relationships - * on one another. - * - * All stacks in the application will be deployed in the appropriate order, - * and all assets found in the application will be added to the asset - * publishing stage. - */ - public addApplication(appStage: Stage, options: AddStageOptions = {}) { - const asm = pipelineSynth(appStage); - const extraRunOrderSpace = options.extraRunOrderSpace ?? 0; - - if (options.confirmBroadeningPermissions ?? this.confirmBroadeningPermissions) { - this.addSecurityCheck(appStage, options); - } - - if (asm.stacks.length === 0) { - // If we don't check here, a more puzzling "stage contains no actions" - // error will be thrown come deployment time. - throw new Error(`The given Stage construct ('${appStage.node.path}') should contain at least one Stack`); - } - - const sortedTranches = topologicalSort(asm.stacks, - stack => stack.id, - stack => stack.dependencies.map(d => d.id)); - - for (const stacks of sortedTranches) { - const runOrder = this.nextSequentialRunOrder(extraRunOrderSpace + 2); // 2 actions for Prepare/Execute ChangeSet - let executeRunOrder = runOrder + extraRunOrderSpace + 1; - - // If we need to insert a manual approval action, then what's the executeRunOrder - // now is where we add a manual approval step, and we allocate 1 more runOrder - // for the execute. - if (options.manualApprovals) { - this.addManualApprovalAction({ runOrder: runOrder + 1 }); - executeRunOrder = this.nextSequentialRunOrder(); - } - - // These don't have a dependency on each other, so can all be added in parallel - for (const stack of stacks) { - this.addStackArtifactDeployment(stack, { runOrder, executeRunOrder }); - } - } - } - - /** - * Get a cached version of an ApplicationSecurityCheck, which consists of: - * - CodeBuild Project to check for security changes in a stage - * - Lambda Function that approves the manual approval if no security changes are detected - * - * The ApplicationSecurityCheck is cached from the pipeline **if** this stage is scoped - * to a CDK Pipeline. If this stage **is not** scoped to a pipeline, create an ApplicationSecurityCheck - * scoped to the stage itself. - * - * @internal - */ - private getApplicationSecurityCheck(): ApplicationSecurityCheck { - if (this._applicationSecurityCheck) { - return this._applicationSecurityCheck; - } - - this._applicationSecurityCheck = this.pipeline - ? this.pipeline._getApplicationSecurityCheck() - : new ApplicationSecurityCheck(this, 'StageApplicationSecurityCheck', { - codePipeline: this.pipelineStage.pipeline as codepipeline.Pipeline, - }); - return this._applicationSecurityCheck; - } - - /** - * Add a deployment action based on a stack artifact - */ - public addStackArtifactDeployment(stackArtifact: cxapi.CloudFormationStackArtifact, options: AddStackOptions = {}) { - // Get all assets manifests and add the assets in 'em to the asset publishing stage. - this.publishAssetDependencies(stackArtifact); - - // Remember for later, see 'prepare()' - // We know that deploying a stack is going to take up 2 runorder slots later on. - const runOrder = options.runOrder ?? this.nextSequentialRunOrder(2); - const executeRunOrder = options.executeRunOrder ?? runOrder + 1; - this.stacksToDeploy.push({ - prepareRunOrder: runOrder, - executeRunOrder, - stackArtifact, - }); - - this.advanceRunOrderPast(runOrder); - this.advanceRunOrderPast(executeRunOrder); - } - - /** - * Add a manual approval action - * - * If you need more flexibility than what this method offers, - * use `addAction` with a `ManualApprovalAction`. - */ - public addManualApprovalAction(options: AddManualApprovalOptions = {}) { - let actionName = options.actionName; - if (!actionName) { - actionName = `ManualApproval${this._manualApprovalCounter > 1 ? this._manualApprovalCounter : ''}`; - this._manualApprovalCounter += 1; - } - - this.addActions(new cpactions.ManualApprovalAction({ - actionName, - runOrder: options.runOrder ?? this.nextSequentialRunOrder(), - })); - } - - /** - * Add one or more CodePipeline Actions - * - * You need to make sure it is created with the right runOrder. Call `nextSequentialRunOrder()` - * for every action to get actions to execute in sequence. - */ - public addActions(...actions: codepipeline.IAction[]) { - for (const action of actions) { - this.pipelineStage.addAction(action); - } - } - - /** - * Return the runOrder number necessary to run the next Action in sequence with the rest - * - * FIXME: This is here because Actions are immutable and can't be reordered - * after creation, nor is there a way to specify relative priorities, which - * is a limitation that we should take away in the base library. - */ - public nextSequentialRunOrder(count: number = 1): number { - const ret = this._nextSequentialRunOrder; - this._nextSequentialRunOrder += count; - return ret; - } - - /** - * Whether this Stage contains an action to deploy the given stack, identified by its artifact ID - */ - public deploysStack(artifactId: string) { - return this.stacksToDeploy.map(s => s.stackArtifact.id).includes(artifactId); - } - - /** - * Actually add all the DeployStack actions to the stage. - * - * We do this late because before we can render the actual DeployActions, - * we need to know whether or not we need to capture the stack outputs. - * - * FIXME: This is here because Actions are immutable and can't be reordered - * after creation, nor is there a way to specify relative priorities, which - * is a limitation that we should take away in the base library. - */ - private prepareStage() { - // FIXME: Make sure this only gets run once. There seems to be an issue in the reconciliation - // loop that may trigger this more than once if it throws an error somewhere, and the exception - // that gets thrown here will then override the actual failure. - if (this._prepared) { return; } - this._prepared = true; - - for (const { prepareRunOrder, stackArtifact, executeRunOrder } of this.stacksToDeploy) { - const artifact = this.host.stackOutputArtifact(stackArtifact.id); - - this.pipelineStage.addAction(DeployCdkStackAction.fromStackArtifact(this, stackArtifact, { - baseActionName: this.simplifyStackName(stackArtifact.stackName), - cloudAssemblyInput: this.cloudAssemblyArtifact, - output: artifact, - outputFileName: artifact ? 'outputs.json' : undefined, - prepareRunOrder, - executeRunOrder, - })); - } - } - - /** - * Advance the runorder counter so that the next sequential number is higher than the given one - */ - private advanceRunOrderPast(lastUsed: number) { - this._nextSequentialRunOrder = Math.max(lastUsed + 1, this._nextSequentialRunOrder); - } - - /** - * Simplify the stack name by removing the `Stage-` prefix if it exists. - */ - private simplifyStackName(s: string) { - return stripPrefix(s, `${this.stageName}-`); - } - - /** - * Add a security check before the prepare/deploy actions of an CDK stage. - * The security check consists of two actions: - * - CodeBuild Action to check for security changes in a stage - * - Manual Approval Action that is auto approved via a Lambda if no security changes detected - */ - private addSecurityCheck(appStage: Stage, options?: BaseStageOptions) { - const { cdkDiffProject } = this.getApplicationSecurityCheck(); - const notificationTopic: sns.ITopic | undefined = options?.securityNotificationTopic ?? this.securityNotificationTopic; - notificationTopic?.grantPublish(cdkDiffProject); - - const appStageName = appStage.stageName; - const approveActionName = `${appStageName}ManualApproval`; - const diffAction = new CodeBuildAction({ - runOrder: this.nextSequentialRunOrder(), - actionName: `${appStageName}SecurityCheck`, - input: this.cloudAssemblyArtifact, - project: cdkDiffProject, - variablesNamespace: `${appStageName}SecurityCheck`, - environmentVariables: { - STAGE_PATH: { - value: Node.of(appStage).path, - type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, - }, - STAGE_NAME: { - value: this.stageName, - type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, - }, - ACTION_NAME: { - value: approveActionName, - type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, - }, - ...notificationTopic ? { - NOTIFICATION_ARN: { - value: notificationTopic.topicArn, - type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, - }, - NOTIFICATION_SUBJECT: { - value: `Confirm permission broadening in ${appStageName}`, - type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, - }, - } : {}, - }, - }); - - const approve = new cpactions.ManualApprovalAction({ - actionName: approveActionName, - runOrder: this.nextSequentialRunOrder(), - additionalInformation: `#{${appStageName}SecurityCheck.MESSAGE}`, - externalEntityLink: `#{${appStageName}SecurityCheck.LINK}`, - }); - - this.addActions(diffAction, approve); - } - - /** - * Make sure all assets depended on by this stack are published in this pipeline - * - * Taking care to exclude the stack template itself -- it is being published - * as an asset because the CLI needs to know the asset publishing role when - * pushing the template to S3, but in the case of CodePipeline we always - * reference the template from the artifact bucket. - * - * (NOTE: this is only true for top-level stacks, not nested stacks. Nested - * Stack templates are always published as assets). - */ - private publishAssetDependencies(stackArtifact: cxapi.CloudFormationStackArtifact) { - const assetManifests = stackArtifact.dependencies.filter(isAssetManifest); - - for (const manifestArtifact of assetManifests) { - const manifest = AssetManifestReader.fromFile(manifestArtifact.file); - - for (const entry of manifest.entries) { - let assetType: AssetType; - if (entry instanceof DockerImageManifestEntry) { - assetType = AssetType.DOCKER_IMAGE; - } else if (entry instanceof FileManifestEntry) { - // Don't publish the template for this stack - if (entry.source.packaging === 'file' && entry.source.path === stackArtifact.templateFile) { - continue; - } - - assetType = AssetType.FILE; - } else { - throw new Error(`Unrecognized asset type: ${entry.type}`); - } - - if (!entry.destination.assumeRoleArn) { - throw new Error('assumeRoleArn is missing on asset and required'); - } - - this.host.publishAsset({ - assetManifestPath: manifestArtifact.file, - assetId: entry.id.assetId, - assetSelector: entry.id.toString(), - assetType, - assetPublishingRoleArn: entry.destination.assumeRoleArn, - }); - } - } - } -} - -/** - * Additional options for adding a stack deployment - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface AddStackOptions { - /** - * Base runorder - * - * @default - Next sequential runorder - */ - readonly runOrder?: number; - - /** - * Base runorder - * - * @default - runOrder + 1 - */ - readonly executeRunOrder?: number; -} - -/** - * A single output of a Stack - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export class StackOutput { - /** - * The artifact and file the output is stored in - */ - public readonly artifactFile: codepipeline.ArtifactPath; - - /** - * The name of the output in the JSON object in the file - */ - public readonly outputName: string; - - /** - * Build a StackOutput from a known artifact and an output name - */ - constructor(artifactFile: codepipeline.ArtifactPath, outputName: string) { - this.artifactFile = artifactFile; - this.outputName = outputName; - } -} - -function stripPrefix(s: string, prefix: string) { - return s.startsWith(prefix) ? s.slice(prefix.length) : s; -} - -function isAssetManifest(s: cxapi.CloudArtifact): s is cxapi.AssetManifestArtifact { - // instanceof is too risky, and we're at a too late stage to properly fix. - // return s instanceof cxapi.AssetManifestArtifact; - return s.constructor.name === 'AssetManifestArtifact'; -} - -/** - * Features that the Stage needs from its environment - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface IStageHost { - /** - * Make sure all the assets from the given manifest are published - */ - publishAsset(command: AssetPublishingCommand): void; - - /** - * Return the Artifact the given stack has to emit its outputs into, if any - */ - stackOutputArtifact(stackArtifactId: string): codepipeline.Artifact | undefined; -} - -/** - * Instructions to publish certain assets - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface AssetPublishingCommand { - /** - * Asset manifest path - */ - readonly assetManifestPath: string; - - /** - * Asset identifier - */ - readonly assetId: string; - - /** - * Asset selector to pass to `cdk-assets`. - */ - readonly assetSelector: string; - - /** - * Type of asset to publish - */ - readonly assetType: AssetType; - - /** - * ARN of the IAM Role used to publish this asset. - */ - readonly assetPublishingRoleArn: string; -} - -/** - * Base options for a pipelines stage - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface BaseStageOptions { - /** - * Runs a `cdk diff --security-only --fail` to pause the pipeline if there - * are any security changes. - * - * If the stage is configured with `confirmBroadeningPermissions` enabled, you can use this - * property to override the stage configuration. For example, Pipeline Stage - * "Prod" has confirmBroadeningPermissions enabled, with applications "A", "B", "C". All three - * applications will run a security check, but if we want to disable the one for "C", - * we run `stage.addApplication(C, { confirmBroadeningPermissions: false })` to override the pipeline - * stage behavior. - * - * Adds 1 to the run order space. - * - * @default false - */ - readonly confirmBroadeningPermissions?: boolean; - /** - * Optional SNS topic to send notifications to when the security check registers - * changes within the application. - * - * @default undefined no notification topic for security check manual approval action - */ - readonly securityNotificationTopic?: sns.ITopic; -} - -/** - * Options for adding an application stage to a pipeline - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface AddStageOptions extends BaseStageOptions { - /** - * Add manual approvals before executing change sets - * - * This gives humans the opportunity to confirm the change set looks alright - * before deploying it. - * - * @default false - */ - readonly manualApprovals?: boolean; - /** - * Add room for extra actions - * - * You can use this to make extra room in the runOrder sequence between the - * changeset 'prepare' and 'execute' actions and insert your own actions there. - * - * @default 0 - */ - readonly extraRunOrderSpace?: number; -} - -/** - * Options for addManualApproval - * - * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead - */ -export interface AddManualApprovalOptions { - /** - * The name of the manual approval action - * - * @default 'ManualApproval' with a rolling counter - */ - readonly actionName?: string; - - /** - * The runOrder for this action - * - * @default - The next sequential runOrder - */ - readonly runOrder?: number; -} - -/** - * Queued "deploy stack" command that is reified during prepare() - */ -interface DeployStackCommand { - prepareRunOrder: number; - executeRunOrder: number; - stackArtifact: cxapi.CloudFormationStackArtifact; -} diff --git a/packages/@aws-cdk/pipelines/lib/legacy/synths/_util.ts b/packages/@aws-cdk/pipelines/lib/legacy/synths/_util.ts deleted file mode 100644 index 83f83bc802564..0000000000000 --- a/packages/@aws-cdk/pipelines/lib/legacy/synths/_util.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; - -export function copyEnvironmentVariables(...names: string[]): Record { - const ret: Record = {}; - for (const name of names) { - if (process.env[name]) { - ret[name] = { value: process.env[name] }; - } - } - return ret; -} - -export function filterEmpty(xs: Array): string[] { - return xs.filter(x => x) as any; -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/lib/private/default-codebuild-image.ts b/packages/@aws-cdk/pipelines/lib/private/default-codebuild-image.ts deleted file mode 100644 index a736eb215bc9a..0000000000000 --- a/packages/@aws-cdk/pipelines/lib/private/default-codebuild-image.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { LinuxBuildImage } from '@aws-cdk/aws-codebuild'; - -export const CDKP_DEFAULT_CODEBUILD_IMAGE = LinuxBuildImage.STANDARD_6_0; \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/package.json b/packages/@aws-cdk/pipelines/package.json deleted file mode 100644 index 9b7ce3a5034b9..0000000000000 --- a/packages/@aws-cdk/pipelines/package.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "name": "@aws-cdk/pipelines", - "version": "0.0.0", - "private": true, - "description": "Continuous Delivery of CDK applications", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "typesVersions": { - "<=3.9": { - "*": [ - ".types-compat/ts3.9/*", - ".types-compat/ts3.9/*/index.d.ts" - ] - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/pipelines" - }, - "bin": {}, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "exports": { - ".": "./lib/index.js", - "./package.json": "./package.json", - "./.jsii": "./.jsii", - "./.warnings.jsii.js": "./.warnings.jsii.js", - "./lib/helpers-internal": "./lib/helpers-internal/index.js" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "aws-sdk": "^2.1329.0" - }, - "peerDependencies": { - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-codepipeline-actions": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "dependencies": { - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-codepipeline-actions": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "constructs": "^10.0.0" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "pipelines", - "cicd", - "continuous", - "delivery" - ], - "engines": { - "node": ">= 14.15.0" - }, - "license": "Apache-2.0", - "stability": "stable", - "maturity": "stable", - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.pipelines", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-pipelines" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.Pipelines", - "packageId": "Amazon.CDK.Pipelines", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.pipelines", - "module": "aws_cdk.pipelines", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "awscdkio": { - "announce": false - }, - "awslint": { - "exclude": [ - "events-generic:@aws-cdk/pipelines.PublishAssetsAction", - "events-method-signature:@aws-cdk/pipelines.PublishAssetsAction.onStateChange", - "events-generic:@aws-cdk/pipelines.UpdatePipelineAction", - "events-method-signature:@aws-cdk/pipelines.UpdatePipelineAction.onStateChange" - ] - }, - "homepage": "https://github.com/aws/aws-cdk", - "publishConfig": { - "tag": "latest" - }, - "preferredCdkCliVersion": "1" -} diff --git a/packages/@aws-cdk/pipelines/rosetta/default.ts-fixture b/packages/@aws-cdk/pipelines/rosetta/default.ts-fixture deleted file mode 100644 index 3745f7721e39e..0000000000000 --- a/packages/@aws-cdk/pipelines/rosetta/default.ts-fixture +++ /dev/null @@ -1,31 +0,0 @@ -// Fixture with packages imported, but nothing else -import { Construct } from 'constructs'; -import { CfnOutput, Duration, Stage, Stack, StackProps, StageProps } from '@aws-cdk/core'; -import cdk = require('@aws-cdk/core'); -import codepipeline = require('@aws-cdk/aws-codepipeline'); -import cpactions = require('@aws-cdk/aws-codepipeline-actions'); -import codebuild = require('@aws-cdk/aws-codebuild'); -import codecommit = require('@aws-cdk/aws-codecommit'); -import dynamodb = require('@aws-cdk/aws-dynamodb'); -import ecr = require('@aws-cdk/aws-ecr'); -import ec2 = require('@aws-cdk/aws-ec2'); -import iam = require('@aws-cdk/aws-iam'); -import lambda = require('@aws-cdk/lambda'); -import pipelines = require('@aws-cdk/pipelines'); -import secretsmanager = require('@aws-cdk/aws-secretsmanager'); -import sns = require('@aws-cdk/aws-sns'); -import subscriptions = require('@aws-cdk/aws-sns-subscriptions'); -import s3 = require('@aws-cdk/aws-s3'); - -class MyApplicationStage extends Stage { - constructor(scope: Construct, id: string, props?: StageProps) { - super(scope, id, props); - } -} - -class Fixture extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - /// here - } -} diff --git a/packages/@aws-cdk/pipelines/test/compliance/assets.test.ts b/packages/@aws-cdk/pipelines/test/compliance/assets.test.ts deleted file mode 100644 index 0295d66c09808..0000000000000 --- a/packages/@aws-cdk/pipelines/test/compliance/assets.test.ts +++ /dev/null @@ -1,1074 +0,0 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import { Capture, Match, Template } from '@aws-cdk/assertions'; -import * as cb from '@aws-cdk/aws-codebuild'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack, Stage } from '@aws-cdk/core'; -import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; -import { behavior, PIPELINE_ENV, TestApp, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, FileAssetApp, MegaAssetsApp, TwoFileAssetsApp, DockerAssetApp, PlainStackApp, stringLike } from '../testhelpers'; - -const FILE_ASSET_SOURCE_HASH = '8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5'; -const FILE_ASSET_SOURCE_HASH2 = 'ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e'; - -const FILE_PUBLISHING_ROLE = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}'; -const IMAGE_PUBLISHING_ROLE = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}'; - -let app: TestApp; -let pipelineStack: Stack; - -beforeEach(() => { - app = new TestApp(); - pipelineStack = new Stack(app, 'PipelineStack', { env: PIPELINE_ENV }); -}); - -afterEach(() => { - app.cleanup(); -}); - -describe('basic pipeline', () => { - behavior('no assets stage if the application has no assets', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new PlainStackApp(app, 'App')); - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new PlainStackApp(app, 'App')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - // THEN - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: Match.not(Match.arrayWith([Match.objectLike({ - Name: 'Assets', - })])), - }); - } - }); - - describe('asset stage placement', () => { - behavior('assets stage comes before any user-defined stages', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'App')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new FileAssetApp(app, 'App')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - Match.objectLike({ Name: 'Source' }), - Match.objectLike({ Name: 'Build' }), - Match.objectLike({ Name: 'UpdatePipeline' }), - Match.objectLike({ Name: 'Assets' }), - Match.objectLike({ Name: 'App' }), - ], - }); - } - }); - - behavior('up to 50 assets fit in a single stage', (suite) => { - suite.legacy(() => { - // WHEN - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new MegaAssetsApp(app, 'App', { numAssets: 50 })); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new MegaAssetsApp(app, 'App', { numAssets: 50 })); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - Match.objectLike({ Name: 'Source' }), - Match.objectLike({ Name: 'Build' }), - Match.objectLike({ Name: 'UpdatePipeline' }), - Match.objectLike({ Name: 'Assets' }), - Match.objectLike({ Name: 'App' }), - ], - }); - } - }); - - behavior('51 assets triggers a second stage', (suite) => { - suite.legacy(() => { - // WHEN - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new MegaAssetsApp(app, 'App', { numAssets: 51 })); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - // WHEN - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new MegaAssetsApp(app, 'App', { numAssets: 51 })); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - Match.objectLike({ Name: 'Source' }), - Match.objectLike({ Name: 'Build' }), - Match.objectLike({ Name: 'UpdatePipeline' }), - Match.objectLike({ Name: stringLike('Assets*') }), - Match.objectLike({ Name: stringLike('Assets*2') }), - Match.objectLike({ Name: 'App' }), - ], - }); - } - }); - - behavior('101 assets triggers a third stage', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new MegaAssetsApp(app, 'App', { numAssets: 101 })); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new MegaAssetsApp(app, 'App', { numAssets: 101 })); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: [ - Match.objectLike({ Name: 'Source' }), - Match.objectLike({ Name: 'Build' }), - Match.objectLike({ Name: 'UpdatePipeline' }), - Match.objectLike({ Name: stringLike('Assets*') }), // 'Assets' vs 'Assets.1' - Match.objectLike({ Name: stringLike('Assets*2') }), - Match.objectLike({ Name: stringLike('Assets*3') }), - Match.objectLike({ Name: 'App' }), - ], - }); - } - }); - }); - - behavior('command line properly locates assets in subassembly', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new FileAssetApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - build: { - commands: Match.arrayWith([`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH}:current_account-current_region"`]), - }, - }, - })), - }, - }); - } - }); - - behavior('multiple assets are published in parallel', (suite) => { - suite.legacy(() => { - // WHEN - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: Match.arrayWith([{ - Name: 'Assets', - Actions: [ - Match.objectLike({ RunOrder: 1 }), - Match.objectLike({ RunOrder: 1 }), - ], - }]), - }); - } - }); - - behavior('assets are also published when using the lower-level addStackArtifactDeployment', (suite) => { - suite.legacy(() => { - // GIVEN - const asm = new FileAssetApp(app, 'FileAssetApp').synth(); - - // WHEN - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage('SomeStage').addStackArtifactDeployment(asm.getStackByName('FileAssetApp-Stack')); - - // THEN - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: Match.arrayWith([{ - Name: 'Assets', - Actions: [ - Match.objectLike({ - Name: 'FileAsset1', - RunOrder: 1, - }), - ], - }]), - }); - }); - - // This function does not exist in the modern API - suite.doesNotApply.modern(); - }); - - behavior('file image asset publishers do not use privilegedmode', (suite) => { - suite.legacy(() => { - // WHEN - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - // WHEN - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new FileAssetApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - build: { - commands: Match.arrayWith([stringLike('cdk-assets *')]), - }, - }, - })), - }, - Environment: Match.objectLike({ - PrivilegedMode: false, - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - }), - }); - } - }); - - behavior('docker image asset publishers use privilegedmode', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - build: { - commands: Match.arrayWith([stringLike('cdk-assets *')]), - }, - }, - })), - }, - Environment: Match.objectLike({ - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - PrivilegedMode: true, - }), - }); - } - }); - - behavior('can control fix/CLI version used in asset publishing', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - cdkCliVersion: '1.2.3', - }); - pipeline.addApplicationStage(new FileAssetApp(pipelineStack, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - cliVersion: '1.2.3', - }); - pipeline.addStage(new FileAssetApp(pipelineStack, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - install: { - commands: ['npm install -g cdk-assets@1.2.3'], - }, - }, - })), - }, - }); - } - }); - - describe('asset roles and policies', () => { - behavior('includes file publishing assets role for apps with file assets', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - // Expectation expects to see KMS key policy permissions - crossAccountKeys: true, - }); - pipeline.addStage(new FileAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'codebuild.amazonaws.com', - }, - }, - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - AWS: { - 'Fn::Join': ['', [ - 'arn:', { Ref: 'AWS::Partition' }, `:iam::${PIPELINE_ENV.account}:root`, - ]], - }, - }, - }, - ], - }, - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', - expectedAssetRolePolicy(FILE_PUBLISHING_ROLE, 'CdkAssetsFileRole6BE17A07')); - } - }); - - behavior('publishing assets role may assume roles from multiple environments', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); - pipeline.addApplicationStage(new FileAssetApp(app, 'App2', { - env: { - account: '0123456789012', - region: 'eu-west-1', - }, - })); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - // Expectation expects to see KMS key policy permissions - crossAccountKeys: true, - }); - - pipeline.addStage(new FileAssetApp(app, 'App1')); - pipeline.addStage(new FileAssetApp(app, 'App2', { - env: { - account: '0123456789012', - region: 'eu-west-1', - }, - })); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', - expectedAssetRolePolicy([FILE_PUBLISHING_ROLE, 'arn:${AWS::Partition}:iam::0123456789012:role/cdk-hnb659fds-file-publishing-role-0123456789012-eu-west-1'], - 'CdkAssetsFileRole6BE17A07')); - } - }); - - behavior('publishing assets role de-dupes assumed roles', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); - pipeline.addApplicationStage(new FileAssetApp(app, 'App2')); - pipeline.addApplicationStage(new FileAssetApp(app, 'App3')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - // Expectation expects to see KMS key policy permissions - crossAccountKeys: true, - }); - pipeline.addStage(new FileAssetApp(app, 'App1')); - pipeline.addStage(new FileAssetApp(app, 'App2')); - pipeline.addStage(new FileAssetApp(app, 'App3')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', - expectedAssetRolePolicy(FILE_PUBLISHING_ROLE, 'CdkAssetsFileRole6BE17A07')); - } - }); - - behavior('includes image publishing assets role for apps with Docker assets', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - // Expectation expects to see KMS key policy permissions - crossAccountKeys: true, - }); - pipeline.addStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Role', { - AssumeRolePolicyDocument: { - Statement: [ - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - Service: 'codebuild.amazonaws.com', - }, - }, - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Principal: { - AWS: { - 'Fn::Join': ['', [ - 'arn:', { Ref: 'AWS::Partition' }, `:iam::${PIPELINE_ENV.account}:root`, - ]], - }, - }, - }, - ], - }, - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', - expectedAssetRolePolicy(IMAGE_PUBLISHING_ROLE, 'CdkAssetsDockerRole484B6DD3')); - } - }); - - behavior('includes both roles for apps with both file and Docker assets', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); - pipeline.addApplicationStage(new DockerAssetApp(app, 'App2')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - // Expectation expects to see KMS key policy permissions - crossAccountKeys: true, - }); - pipeline.addStage(new FileAssetApp(app, 'App1')); - pipeline.addStage(new DockerAssetApp(app, 'App2')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', - expectedAssetRolePolicy(FILE_PUBLISHING_ROLE, 'CdkAssetsFileRole6BE17A07')); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', - expectedAssetRolePolicy(IMAGE_PUBLISHING_ROLE, 'CdkAssetsDockerRole484B6DD3')); - } - }); - }); -}); - -behavior('can supply pre-install scripts to asset upload', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - assetPreInstallCommands: [ - 'npm config set registry https://registry.com', - ], - }); - pipeline.addApplicationStage(new FileAssetApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - assetPublishingCodeBuildDefaults: { - partialBuildSpec: cb.BuildSpec.fromObject({ - version: '0.2', - phases: { - install: { - commands: [ - 'npm config set registry https://registry.com', - ], - }, - }, - }), - }, - }); - pipeline.addStage(new FileAssetApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - install: { - commands: ['npm config set registry https://registry.com', 'npm install -g cdk-assets@1'], - }, - }, - })), - }, - }); - } -}); - -describe('pipeline with VPC', () => { - let vpc: ec2.Vpc; - beforeEach(() => { - vpc = new ec2.Vpc(pipelineStack, 'Vpc'); - }); - - behavior('asset CodeBuild Project uses VPC subnets', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - vpc, - }); - pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - codeBuildDefaults: { vpc }, - }); - pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - // THEN - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - VpcConfig: Match.objectLike({ - SecurityGroupIds: [ - { 'Fn::GetAtt': ['CdkAssetsDockerAsset1SecurityGroup078F5C66', 'GroupId'] }, - ], - Subnets: [ - { Ref: 'VpcPrivateSubnet1Subnet536B997A' }, - { Ref: 'VpcPrivateSubnet2Subnet3788AAA1' }, - { Ref: 'VpcPrivateSubnet3SubnetF258B56E' }, - ], - VpcId: { Ref: 'Vpc8378EB38' }, - }), - }); - } - }); - - behavior('Pipeline-generated CodeBuild Projects have appropriate execution role permissions', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - vpc, - }); - pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - codeBuildDefaults: { vpc }, - }); - pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - // Assets Project - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - Roles: [ - { Ref: 'CdkAssetsDockerRole484B6DD3' }, - ], - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: Match.arrayWith(['ec2:DescribeSecurityGroups']), - Effect: 'Allow', - Resource: '*', - }]), - }, - }); - } - }); - - behavior('Asset publishing CodeBuild Projects have correct VPC permissions', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - vpc, - }); - pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - codeBuildDefaults: { vpc }, - }); - pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - // Assets Project - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - Match.objectLike({ - Resource: '*', - Action: [ - 'ec2:CreateNetworkInterface', - 'ec2:DescribeNetworkInterfaces', - 'ec2:DeleteNetworkInterface', - 'ec2:DescribeSubnets', - 'ec2:DescribeSecurityGroups', - 'ec2:DescribeDhcpOptions', - 'ec2:DescribeVpcs', - ], - }), - ], - }, - Roles: [{ Ref: 'CdkAssetsDockerRole484B6DD3' }], - }); - Template.fromStack(pipelineStack).hasResource('AWS::CodeBuild::Project', { - Properties: { - ServiceRole: { 'Fn::GetAtt': ['CdkAssetsDockerRole484B6DD3', 'Arn'] }, - }, - DependsOn: [ - 'CdkAssetsDockerAsset1PolicyDocument8DA96A22', - ], - }); - } - }); -}); - -describe('pipeline with single asset publisher', () => { - behavior('multiple assets are using the same job in singlePublisherMode', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - singlePublisherPerType: true, - }); - pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - publishAssetsInParallel: false, - }); - pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - // THEN - const buildSpecName = new Capture(stringLike('buildspec-*.yaml')); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: Match.arrayWith([{ - Name: 'Assets', - Actions: [ - // Only one file asset action - Match.objectLike({ RunOrder: 1, Name: 'FileAsset' }), - ], - }]), - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - }, - Source: { - BuildSpec: buildSpecName, - }, - }); - const assembly = synthesize(pipelineStack); - - const actualFileName = buildSpecName.asString(); - - const buildSpec = JSON.parse(fs.readFileSync(path.join(assembly.directory, actualFileName), { encoding: 'utf-8' })); - expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH}:current_account-current_region"`); - expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH2}:current_account-current_region"`); - } - }); - - behavior('other pipeline writes to separate assets build spec file', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - singlePublisherPerType: true, - }); - pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - const pipelineStack2 = new Stack(app, 'PipelineStack2', { env: PIPELINE_ENV }); - const otherPipeline = new LegacyTestGitHubNpmPipeline(pipelineStack2, 'Cdk', { - singlePublisherPerType: true, - }); - otherPipeline.addApplicationStage(new TwoFileAssetsApp(app, 'OtherFileAssetApp')); - - THEN_codePipelineExpectation(pipelineStack2); - }); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - publishAssetsInParallel: false, - }); - pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - const pipelineStack2 = new Stack(app, 'PipelineStack2', { env: PIPELINE_ENV }); - const otherPipeline = new ModernTestGitHubNpmPipeline(pipelineStack2, 'Cdk', { - publishAssetsInParallel: false, - }); - otherPipeline.addStage(new TwoFileAssetsApp(app, 'OtherFileAssetApp')); - - THEN_codePipelineExpectation(pipelineStack2); - }); - - function THEN_codePipelineExpectation(pipelineStack2: Stack) { - // THEN - const buildSpecName1 = new Capture(stringLike('buildspec-*.yaml')); - const buildSpecName2 = new Capture(stringLike('buildspec-*.yaml')); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - BuildSpec: buildSpecName1, - }, - }); - Template.fromStack(pipelineStack2).hasResourceProperties('AWS::CodeBuild::Project', { - Source: { - BuildSpec: buildSpecName2, - }, - }); - - expect(buildSpecName1.asString()).not.toEqual(buildSpecName2.asString()); - } - }); -}); - - -describe('pipeline with custom asset publisher BuildSpec', () => { - - behavior('custom buildspec is merged correctly', (suite) => { - suite.legacy(() => { - // WHEN - const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - singlePublisherPerType: true, - assetBuildSpec: cb.BuildSpec.fromObject({ - phases: { - pre_install: { - commands: 'preinstall', - }, - }, - cache: { - paths: 'node_modules', - }, - }), - }); - pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - // WHEN - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { - publishAssetsInParallel: false, - assetPublishingCodeBuildDefaults: { - partialBuildSpec: cb.BuildSpec.fromObject({ - phases: { - pre_install: { - commands: 'preinstall', - }, - }, - cache: { - paths: 'node_modules', - }, - }), - }, - }); - pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); - - THEN_codePipelineExpectation(); - }); - - - function THEN_codePipelineExpectation() { - const buildSpecName = new Capture(stringLike('buildspec-*')); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { - Stages: Match.arrayWith([{ - Name: 'Assets', - Actions: [ - // Only one file asset action - Match.objectLike({ RunOrder: 1, Name: 'FileAsset' }), - ], - }]), - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { - Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, - }, - Source: { - BuildSpec: buildSpecName, - }, - }); - const assembly = synthesize(pipelineStack); - const buildSpec = JSON.parse(fs.readFileSync(path.join(assembly.directory, buildSpecName.asString())).toString()); - expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH}:current_account-current_region"`); - expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH2}:current_account-current_region"`); - expect(buildSpec.phases.pre_install.commands).toContain('preinstall'); - expect(buildSpec.cache.paths).toContain('node_modules'); - } - }); -}); - -function expectedAssetRolePolicy(assumeRolePattern: string | string[], attachedRole: string) { - if (typeof assumeRolePattern === 'string') { assumeRolePattern = [assumeRolePattern]; } - - return { - PolicyDocument: { - Statement: [{ - Action: ['logs:CreateLogGroup', 'logs:CreateLogStream', 'logs:PutLogEvents'], - Effect: 'Allow', - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - `:logs:${PIPELINE_ENV.region}:${PIPELINE_ENV.account}:log-group:/aws/codebuild/*`, - ]], - }, - }, - { - Action: ['codebuild:CreateReportGroup', 'codebuild:CreateReport', 'codebuild:UpdateReport', 'codebuild:BatchPutTestCases', 'codebuild:BatchPutCodeCoverages'], - Effect: 'Allow', - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - `:codebuild:${PIPELINE_ENV.region}:${PIPELINE_ENV.account}:report-group/*`, - ]], - }, - }, - { - Action: ['codebuild:BatchGetBuilds', 'codebuild:StartBuild', 'codebuild:StopBuild'], - Effect: 'Allow', - Resource: '*', - }, - { - Action: 'sts:AssumeRole', - Effect: 'Allow', - Resource: unsingleton(assumeRolePattern.map(arn => { return { 'Fn::Sub': arn }; })), - }, - { - Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], - Effect: 'Allow', - Resource: [ - { 'Fn::GetAtt': ['CdkPipelineArtifactsBucket7B46C7BF', 'Arn'] }, - { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['CdkPipelineArtifactsBucket7B46C7BF', 'Arn'] }, '/*']] }, - ], - }, - { - Action: ['kms:Decrypt', 'kms:DescribeKey'], - Effect: 'Allow', - Resource: { 'Fn::GetAtt': ['CdkPipelineArtifactsBucketEncryptionKeyDDD3258C', 'Arn'] }, - }], - }, - Roles: [{ Ref: attachedRole }], - }; -} - - -behavior('necessary secrets manager permissions get added to asset roles', suite => { - // Not possible to configure this for legacy pipelines - suite.doesNotApply.legacy(); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Pipeline', { - assetPublishingCodeBuildDefaults: { - buildEnvironment: { - environmentVariables: { - FOOBAR: { - value: 'FoobarSecret', - type: cb.BuildEnvironmentVariableType.SECRETS_MANAGER, - }, - }, - }, - }, - }); - pipeline.addStage(new FileAssetApp(pipelineStack, 'MyApp')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: 'secretsmanager:GetSecretValue', - Effect: 'Allow', - Resource: { - 'Fn::Join': [ - '', - [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':secretsmanager:us-pipeline:123pipeline:secret:FoobarSecret-??????', - ], - ], - }, - }]), - }, - Roles: [ - { Ref: 'PipelineAssetsFileRole59943A77' }, - ], - }); - } -}); - -behavior('adding environment variable to assets job adds SecretsManager permissions', suite => { - // No way to manipulate buildEnvironment in legacy API - suite.doesNotApply.legacy(); - - suite.modern(() => { - const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Pipeline', { - assetPublishingCodeBuildDefaults: { - buildEnvironment: { - environmentVariables: { - FOOBAR: { - value: 'FoobarSecret', - type: cb.BuildEnvironmentVariableType.SECRETS_MANAGER, - }, - }, - }, - }, - }); - pipeline.addStage(new FileAssetApp(pipelineStack, 'MyApp')); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([ - Match.objectLike({ - Action: 'secretsmanager:GetSecretValue', - Effect: 'Allow', - Resource: { - 'Fn::Join': ['', [ - 'arn:', - { Ref: 'AWS::Partition' }, - ':secretsmanager:us-pipeline:123pipeline:secret:FoobarSecret-??????', - ]], - }, - }), - ]), - }, - }); - }); -}); - -function synthesize(stack: Stack) { - const root = stack.node.root; - if (!Stage.isStage(root)) { - throw new Error('unexpected: all stacks must be part of a Stage'); - } - - return root.synth({ skipValidation: true }); -} - -function unsingleton(xs: A[]): A | A[] { - if (xs.length === 1) { - return xs[0]; - } - return xs; -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/compliance/docker-credentials.test.ts b/packages/@aws-cdk/pipelines/test/compliance/docker-credentials.test.ts deleted file mode 100644 index 726d1bfbe31c3..0000000000000 --- a/packages/@aws-cdk/pipelines/test/compliance/docker-credentials.test.ts +++ /dev/null @@ -1,292 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cb from '@aws-cdk/aws-codebuild'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Stack } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as cdkp from '../../lib'; -import { CodeBuildStep } from '../../lib'; -import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; -import { behavior, PIPELINE_ENV, TestApp, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, DockerAssetApp, stringLike } from '../testhelpers'; - -const secretSynthArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:synth-012345'; -const secretUpdateArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:update-012345'; -const secretPublishArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:publish-012345'; - -let app: TestApp; -let pipelineStack: Stack; -let secretSynth: secretsmanager.ISecret; -let secretUpdate: secretsmanager.ISecret; -let secretPublish: secretsmanager.ISecret; - -beforeEach(() => { - app = new TestApp(); - pipelineStack = new Stack(app, 'PipelineStack', { env: PIPELINE_ENV }); - secretSynth = secretsmanager.Secret.fromSecretCompleteArn(pipelineStack, 'Secret1', secretSynthArn); - secretUpdate = secretsmanager.Secret.fromSecretCompleteArn(pipelineStack, 'Secret2', secretUpdateArn); - secretPublish = secretsmanager.Secret.fromSecretCompleteArn(pipelineStack, 'Secret3', secretPublishArn); -}); - -afterEach(() => { - app.cleanup(); -}); - -behavior('synth action receives install commands and access to relevant credentials', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk'); - pipeline.addStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - const expectedCredsConfig = JSON.stringify({ - version: '1.0', - domainCredentials: { 'synth.example.com': { secretsManagerSecretId: secretSynthArn } }, - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - pre_build: { - commands: Match.arrayWith([ - 'mkdir $HOME/.cdk', - `echo '${expectedCredsConfig}' > $HOME/.cdk/cdk-docker-creds.json`, - ]), - }, - // Prove we're looking at the Synth project - build: { - commands: Match.arrayWith([stringLike('*cdk*synth*')]), - }, - }, - })), - }, - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], - Effect: 'Allow', - Resource: secretSynthArn, - }]), - Version: '2012-10-17', - }, - Roles: [{ Ref: stringLike('Cdk*BuildProjectRole*') }], - }); - } -}); - -behavior('synth action receives Windows install commands if a Windows image is detected', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk2', { - npmSynthOptions: { - environment: { - buildImage: cb.WindowsBuildImage.WINDOWS_BASE_2_0, - }, - }, - }); - pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - suite.modern(() => { - const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk2', { - synth: new CodeBuildStep('Synth', { - commands: ['cdk synth'], - primaryOutputDirectory: 'cdk.out', - input: cdkp.CodePipelineSource.gitHub('test/test', 'main'), - buildEnvironment: { - buildImage: cb.WindowsBuildImage.WINDOWS_BASE_2_0, - computeType: cb.ComputeType.MEDIUM, - }, - }), - }); - pipeline.addStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation(); - }); - - function THEN_codePipelineExpectation() { - const expectedCredsConfig = JSON.stringify({ - version: '1.0', - domainCredentials: { 'synth.example.com': { secretsManagerSecretId: secretSynthArn } }, - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { Image: 'aws/codebuild/windows-base:2.0' }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - pre_build: { - commands: Match.arrayWith([ - 'mkdir %USERPROFILE%\\.cdk', - `echo '${expectedCredsConfig}' > %USERPROFILE%\\.cdk\\cdk-docker-creds.json`, - ]), - }, - // Prove we're looking at the Synth project - build: { - commands: Match.arrayWith([stringLike('*cdk*synth*')]), - }, - }, - })), - }, - }); - } -}); - -behavior('self-update receives install commands and access to relevant credentials', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation('install'); - }); - - suite.modern(() => { - const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk'); - pipeline.addStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation('pre_build'); - }); - - function THEN_codePipelineExpectation(expectedPhase: string) { - const expectedCredsConfig = JSON.stringify({ - version: '1.0', - domainCredentials: { 'selfupdate.example.com': { secretsManagerSecretId: secretUpdateArn } }, - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - [expectedPhase]: { - commands: Match.arrayWith([ - 'mkdir $HOME/.cdk', - `echo '${expectedCredsConfig}' > $HOME/.cdk/cdk-docker-creds.json`, - ]), - }, - // Prove we're looking at the SelfMutate project - build: { - commands: Match.arrayWith([ - stringLike('cdk * deploy PipelineStack*'), - ]), - }, - }, - })), - }, - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], - Effect: 'Allow', - Resource: secretUpdateArn, - }]), - Version: '2012-10-17', - }, - Roles: [{ Ref: stringLike('*SelfMutat*Role*') }], - }); - } -}); - -behavior('asset publishing receives install commands and access to relevant credentials', (suite) => { - suite.legacy(() => { - const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk'); - pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation('install'); - }); - - suite.modern(() => { - const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk'); - pipeline.addStage(new DockerAssetApp(app, 'App1')); - - THEN_codePipelineExpectation('pre_build'); - }); - - function THEN_codePipelineExpectation(expectedPhase: string) { - const expectedCredsConfig = JSON.stringify({ - version: '1.0', - domainCredentials: { 'publish.example.com': { secretsManagerSecretId: secretPublishArn } }, - }); - - Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { - Environment: { Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId }, - Source: { - BuildSpec: Match.serializedJson(Match.objectLike({ - phases: { - [expectedPhase]: { - commands: Match.arrayWith([ - 'mkdir $HOME/.cdk', - `echo '${expectedCredsConfig}' > $HOME/.cdk/cdk-docker-creds.json`, - ]), - }, - // Prove we're looking at the Publishing project - build: { - commands: Match.arrayWith([stringLike('cdk-assets*')]), - }, - }, - })), - }, - }); - Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], - Effect: 'Allow', - Resource: secretPublishArn, - }]), - Version: '2012-10-17', - }, - Roles: [{ Ref: 'CdkAssetsDockerRole484B6DD3' }], - }); - } -}); - -class LegacyPipelineWithCreds extends LegacyTestGitHubNpmPipeline { - constructor(scope: Construct, id: string, props?: ConstructorParameters[2]) { - super(scope, id, { - dockerCredentials: [ - cdkp.DockerCredential.customRegistry('synth.example.com', secretSynth, { - usages: [cdkp.DockerCredentialUsage.SYNTH], - }), - cdkp.DockerCredential.customRegistry('selfupdate.example.com', secretUpdate, { - usages: [cdkp.DockerCredentialUsage.SELF_UPDATE], - }), - cdkp.DockerCredential.customRegistry('publish.example.com', secretPublish, { - usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], - }), - ], - ...props, - }); - } -} - -class ModernPipelineWithCreds extends ModernTestGitHubNpmPipeline { - constructor(scope: Construct, id: string, props?: ConstructorParameters[2]) { - super(scope, id, { - dockerCredentials: [ - cdkp.DockerCredential.customRegistry('synth.example.com', secretSynth, { - usages: [cdkp.DockerCredentialUsage.SYNTH], - }), - cdkp.DockerCredential.customRegistry('selfupdate.example.com', secretUpdate, { - usages: [cdkp.DockerCredentialUsage.SELF_UPDATE], - }), - cdkp.DockerCredential.customRegistry('publish.example.com', secretPublish, { - usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], - }), - ], - ...props, - }); - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/docker-credentials.test.ts b/packages/@aws-cdk/pipelines/test/docker-credentials.test.ts deleted file mode 100644 index 8527f45cb85e3..0000000000000 --- a/packages/@aws-cdk/pipelines/test/docker-credentials.test.ts +++ /dev/null @@ -1,400 +0,0 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import { DockerAssetApp, TestApp } from './testhelpers'; -import * as cdkp from '../lib'; -import { ShellStep } from '../lib'; - -let app: cdk.App; -let stack: cdk.Stack; - -beforeEach(() => { - app = new TestApp(); - stack = new cdk.Stack(app, 'Stack', { - env: { account: '0123456789012', region: 'eu-west-1' }, - }); -}); - -describe('ExternalDockerCredential', () => { - - let secret: secretsmanager.ISecret; - - beforeEach(() => { - secret = new secretsmanager.Secret(stack, 'Secret'); - }); - - test('dockerHub defaults registry domain', () => { - const creds = cdkp.DockerCredential.dockerHub(secret); - - expect(Object.keys(creds._renderCdkAssetsConfig())).toEqual(['https://index.docker.io/v1/']); - }); - - test('minimal example only renders secret', () => { - const creds = cdkp.DockerCredential.customRegistry('example.com', secret); - - const config = creds._renderCdkAssetsConfig(); - expect(stack.resolve(config)).toEqual({ - 'example.com': { - secretsManagerSecretId: { Ref: 'SecretA720EF05' }, - }, - }); - }); - - test('maximum example includes all expected properties', () => { - const roleArn = 'arn:aws:iam::0123456789012:role/MyRole'; - const creds = cdkp.DockerCredential.customRegistry('example.com', secret, { - secretUsernameField: 'login', - secretPasswordField: 'pass', - assumeRole: iam.Role.fromRoleArn(stack, 'Role', roleArn), - }); - - const config = creds._renderCdkAssetsConfig(); - expect(stack.resolve(config)).toEqual({ - 'example.com': { - secretsManagerSecretId: { Ref: 'SecretA720EF05' }, - secretsUsernameField: 'login', - secretsPasswordField: 'pass', - assumeRoleArn: roleArn, - }, - }); - }); - - describe('grantRead', () => { - - test('grants read access to the secret', () => { - const creds = cdkp.DockerCredential.customRegistry('example.com', secret); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [ - { - Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], - Effect: 'Allow', - Resource: { Ref: 'SecretA720EF05' }, - }, - ], - Version: '2012-10-17', - }, - Users: [{ Ref: 'User00B015A1' }], - }); - }); - - test('grants read access to the secret to the assumeRole if provided', () => { - const assumeRole = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::0123456789012:role/MyRole'); - const creds = cdkp.DockerCredential.customRegistry('example.com', secret, { assumeRole }); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], - Effect: 'Allow', - Resource: { Ref: 'SecretA720EF05' }, - }], - Version: '2012-10-17', - }, - Roles: ['MyRole'], - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Resource: 'arn:aws:iam::0123456789012:role/MyRole', - }], - Version: '2012-10-17', - }, - Users: [{ Ref: 'User00B015A1' }], - }); - }); - - test('does not grant any access if the usage does not match', () => { - const assumeRole = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::0123456789012:role/MyRole'); - const creds = cdkp.DockerCredential.customRegistry('example.com', secret, { - assumeRole, - usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], - }); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.SELF_UPDATE); - - Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); - }); - - }); - -}); - -describe('EcrDockerCredential', () => { - - let repo: ecr.IRepository; - - beforeEach(() => { - repo = ecr.Repository.fromRepositoryArn(stack, 'Repo', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo'); - }); - - test('minimal example only renders ecrRepository', () => { - const creds = cdkp.DockerCredential.ecr([repo]); - - const config = creds._renderCdkAssetsConfig(); - - expect(stack.resolve(Object.keys(config))).toEqual([{ - 'Fn::Select': [ - 0, { - 'Fn::Split': ['/', { - 'Fn::Join': ['', ['0123456789012.dkr.ecr.eu-west-1.', { Ref: 'AWS::URLSuffix' }, '/Repo']], - }], - }, - ], - }]); - expect(Object.values(config)).toEqual([{ - ecrRepository: true, - }]); - }); - - test('maximum example renders all fields', () => { - const roleArn = 'arn:aws:iam::0123456789012:role/MyRole'; - const creds = cdkp.DockerCredential.ecr([repo], { - assumeRole: iam.Role.fromRoleArn(stack, 'Role', roleArn), - usages: [cdkp.DockerCredentialUsage.SYNTH], - }); - - const config = creds._renderCdkAssetsConfig(); - - expect(stack.resolve(Object.keys(config))).toEqual([{ - 'Fn::Select': [ - 0, { - 'Fn::Split': ['/', { - 'Fn::Join': ['', ['0123456789012.dkr.ecr.eu-west-1.', { Ref: 'AWS::URLSuffix' }, '/Repo']], - }], - }, - ], - }]); - expect(Object.values(config)).toEqual([{ - assumeRoleArn: roleArn, - ecrRepository: true, - }]); - }); - - describe('grantRead', () => { - - test('grants pull access to the repo', () => { - const creds = cdkp.DockerCredential.ecr([repo]); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: [ - 'ecr:BatchCheckLayerAvailability', - 'ecr:GetDownloadUrlForLayer', - 'ecr:BatchGetImage', - ], - Effect: 'Allow', - Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo', - }, - { - Action: 'ecr:GetAuthorizationToken', - Effect: 'Allow', - Resource: '*', - }], - Version: '2012-10-17', - }, - Users: [{ Ref: 'User00B015A1' }], - }); - }); - - test('grants pull access to the assumed role', () => { - const assumeRole = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::0123456789012:role/MyRole'); - const creds = cdkp.DockerCredential.ecr([repo], { assumeRole }); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: [ - 'ecr:BatchCheckLayerAvailability', - 'ecr:GetDownloadUrlForLayer', - 'ecr:BatchGetImage', - ], - Effect: 'Allow', - Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo', - }, - { - Action: 'ecr:GetAuthorizationToken', - Effect: 'Allow', - Resource: '*', - }], - Version: '2012-10-17', - }, - Roles: ['MyRole'], - }); - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: [{ - Action: 'sts:AssumeRole', - Effect: 'Allow', - Resource: 'arn:aws:iam::0123456789012:role/MyRole', - }], - Version: '2012-10-17', - }, - Users: [{ Ref: 'User00B015A1' }], - }); - }); - - test('grants pull access to multiple repos if provided', () => { - const repo2 = ecr.Repository.fromRepositoryArn(stack, 'Repo2', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2'); - const creds = cdkp.DockerCredential.ecr([repo, repo2]); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); - - Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { - PolicyDocument: { - Statement: Match.arrayWith([{ - Action: [ - 'ecr:BatchCheckLayerAvailability', - 'ecr:GetDownloadUrlForLayer', - 'ecr:BatchGetImage', - ], - Effect: 'Allow', - Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo', - }, - { - Action: 'ecr:GetAuthorizationToken', - Effect: 'Allow', - Resource: '*', - }, - { - Action: [ - 'ecr:BatchCheckLayerAvailability', - 'ecr:GetDownloadUrlForLayer', - 'ecr:BatchGetImage', - ], - Effect: 'Allow', - Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2', - }]), - Version: '2012-10-17', - }, - Users: [{ Ref: 'User00B015A1' }], - }); - }); - - test('does not grant any access if the usage does not match', () => { - const creds = cdkp.DockerCredential.ecr([repo], { usages: [cdkp.DockerCredentialUsage.SYNTH] }); - - const user = new iam.User(stack, 'User'); - creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); - - Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); - }); - }); - - // This test doesn't actually work yet. See https://github.com/aws/aws-cdk/issues/16164 - // eslint-disable-next-line jest/no-disabled-tests - test.skip('with non-parallel publishing', () => { - const pipelines = new cdkp.CodePipeline(stack, 'Pipeline', { - synth: new ShellStep('Build', { - input: cdkp.CodePipelineSource.gitHub('test/test', 'test'), - commands: ['cdk synth'], - }), - - publishAssetsInParallel: false, - dockerCredentials: [ - cdkp.DockerCredential.ecr([repo]), - ], - }); - pipelines.addStage(new DockerAssetApp(stack, 'AssetApp')); - - // Should not throw - app.synth(); - }); -}); - -describe('dockerCredentialsInstallCommands', () => { - const secretArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:mySecret-012345'; - let secret: secretsmanager.ISecret; - - beforeEach(() => { - secret = secretsmanager.Secret.fromSecretCompleteArn(stack, 'Secret', secretArn); - }); - - test('returns a blank array for empty inputs', () => { - expect(cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH)).toEqual([]); - expect(cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [])).toEqual([]); - }); - - test('returns only credentials relevant to the current usage', () => { - const synthCreds = cdkp.DockerCredential.customRegistry('synth.example.com', secret, { - usages: [cdkp.DockerCredentialUsage.SYNTH], - }); - const selfUpdateCreds = cdkp.DockerCredential.customRegistry('selfupdate.example.com', secret, { - usages: [cdkp.DockerCredentialUsage.SELF_UPDATE], - }); - const assetPublishingCreds = cdkp.DockerCredential.customRegistry('assetpublishing.example.com', secret, { - usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], - }); - - const commands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, - [synthCreds, selfUpdateCreds, assetPublishingCreds]).join('|'); - - expect(commands.includes('synth')).toBeTruthy(); - expect(commands.includes('selfupdate')).toBeFalsy(); - expect(commands.includes('assetpublishing')).toBeFalsy(); - }); - - test('defaults to Linux-style commands', () => { - const creds = cdkp.DockerCredential.dockerHub(secret); - - const defaultCommands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds]); - const linuxCommands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds], ec2.OperatingSystemType.LINUX); - - expect(defaultCommands).toEqual(linuxCommands); - }); - - test('Linux commands', () => { - const creds = cdkp.DockerCredential.customRegistry('example.com', secret); - const expectedCredsFile = JSON.stringify({ - version: '1.0', - domainCredentials: { - 'example.com': { secretsManagerSecretId: secretArn }, - }, - }); - - const commands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds], ec2.OperatingSystemType.LINUX); - - expect(commands).toEqual([ - 'mkdir $HOME/.cdk', - `echo '${expectedCredsFile}' > $HOME/.cdk/cdk-docker-creds.json`, - ]); - }); - - test('Windows commands', () => { - const creds = cdkp.DockerCredential.customRegistry('example.com', secret); - const expectedCredsFile = JSON.stringify({ - version: '1.0', - domainCredentials: { - 'example.com': { secretsManagerSecretId: secretArn }, - }, - }); - - const commands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds], ec2.OperatingSystemType.WINDOWS); - - expect(commands).toEqual([ - 'mkdir %USERPROFILE%\\.cdk', - `echo '${expectedCredsFile}' > %USERPROFILE%\\.cdk\\cdk-docker-creds.json`, - ]); - }); -}); diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.assets.json deleted file mode 100644 index 4283422144729..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "65c76b51aca7d9a23134ff6f50a78c074f2122615c96f8c8373c6d009f2a1f87": { - "source": { - "path": "PipelineStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "65c76b51aca7d9a23134ff6f50a78c074f2122615c96f8c8373c6d009f2a1f87.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.template.json deleted file mode 100644 index 4717d1e0fd94d..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/PipelineStack.template.json +++ /dev/null @@ -1,2546 +0,0 @@ -{ - "Resources": { - "PipelineArtifactsBucketEncryptionKeyF5BF0670": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "EnableKeyRotation": true - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { - "Type": "AWS::KMS::Alias", - "Properties": { - "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "TargetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketAEA9A052": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "KMSMasterKeyID": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "SSEAlgorithm": "aws:kms" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "PipelineArtifactsBucketPolicyF53CCC52": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleB27FAA37": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleDefaultPolicy7BDC1ABB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "Roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "Pipeline9850B417": { - "Type": "AWS::CodePipeline::Pipeline", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "Stages": [ - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Source", - "Owner": "ThirdParty", - "Provider": "GitHub", - "Version": "1" - }, - "Configuration": { - "Owner": "tkglaser", - "Repo": "cdk-pipelines-demo", - "Branch": "main", - "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", - "PollForSourceChanges": false - }, - "Name": "tkglaser_cdk-pipelines-demo", - "OutputArtifacts": [ - { - "Name": "tkglaser_cdk_pipelines_demo_Source" - } - ], - "RunOrder": 1 - } - ], - "Name": "Source" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" - }, - "InputArtifacts": [ - { - "Name": "tkglaser_cdk_pipelines_demo_Source" - } - ], - "Name": "Synth", - "OutputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Build" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"ceff66d3191e2ca3ec1a2711dae97a4541cbf7254c7dcca9acf21e0d12ce37a2\"}]" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "SelfMutate", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "UpdatePipeline" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - } - ], - "Name": "Beta" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod1.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod2.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod1.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod2.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod1.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod2.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod1.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod2.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - } - ], - "Name": "Wave1" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod3.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod4.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod5.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod6.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod3.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod4.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod5.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod6.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod3.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod4.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod5.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod6.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod3.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod4.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod5.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod6.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - } - ], - "Name": "Wave2" - } - ], - "ArtifactStore": { - "EncryptionKey": { - "Id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Type": "KMS" - }, - "Location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "Type": "S3" - }, - "RestartExecutionOnUpdate": true - }, - "DependsOn": [ - "PipelineRoleDefaultPolicy7BDC1ABB", - "PipelineRoleB27FAA37" - ] - }, - "PipelineSourcetkglasercdkpipelinesdemoWebhookResource54EE51BE": { - "Type": "AWS::CodePipeline::Webhook", - "Properties": { - "Authentication": "GITHUB_HMAC", - "AuthenticationConfiguration": { - "SecretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" - }, - "Filters": [ - { - "JsonPath": "$.ref", - "MatchEquals": "refs/heads/{Branch}" - } - ], - "TargetAction": "tkglaser_cdk-pipelines-demo", - "TargetPipeline": { - "Ref": "Pipeline9850B417" - }, - "TargetPipelineVersion": 1, - "RegisterWithThirdParty": true - } - }, - "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProject6BEFA8E6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/Build/Synth", - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineCodeBuildActionRole226DB0CB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "Bool": { - "aws:ViaAWSService": "codepipeline.amazonaws.com" - } - }, - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", - "Roles": [ - { - "Ref": "PipelineCodeBuildActionRole226DB0CB" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationRole57E559E8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationDAA41400": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json deleted file mode 100644 index 4dcd082943816..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65": { - "source": { - "path": "PipelineStackBetaStack1E6541489.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json deleted file mode 100644 index 64b29ec0098ea..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326": { - "source": { - "path": "PipelineStackBetaStack2C79AD00A.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/manifest.json deleted file mode 100644 index 4bb5689450675..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Beta/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackBetaStack1E6541489.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackBetaStack1E6541489.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackBetaStack1E6541489": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackBetaStack1E6541489.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackBetaStack1E6541489.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Beta-Stack1" - }, - "dependencies": [ - "PipelineStackBetaStack1E6541489.assets" - ], - "metadata": { - "/PipelineStack/Beta/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Beta/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Beta/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Beta/Stack1" - }, - "PipelineStackBetaStack2C79AD00A.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackBetaStack2C79AD00A.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackBetaStack2C79AD00A": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackBetaStack2C79AD00A.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackBetaStack2C79AD00A.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Beta-Stack2" - }, - "dependencies": [ - "PipelineStackBetaStack1E6541489", - "PipelineStackBetaStack2C79AD00A.assets" - ], - "metadata": { - "/PipelineStack/Beta/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Beta/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Beta/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Beta/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json deleted file mode 100644 index b0b6911c8e622..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3": { - "source": { - "path": "PipelineStackProd1Stack14013D698.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json deleted file mode 100644 index 2564919d9f4c7..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059": { - "source": { - "path": "PipelineStackProd1Stack2F0681AFF.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/manifest.json deleted file mode 100644 index 42c36e92a83ce..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod1/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd1Stack14013D698.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd1Stack14013D698.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd1Stack14013D698": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd1Stack14013D698.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd1Stack14013D698.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod1-Stack1" - }, - "dependencies": [ - "PipelineStackProd1Stack14013D698.assets" - ], - "metadata": { - "/PipelineStack/Prod1/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod1/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod1/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod1/Stack1" - }, - "PipelineStackProd1Stack2F0681AFF.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd1Stack2F0681AFF.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd1Stack2F0681AFF": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd1Stack2F0681AFF.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd1Stack2F0681AFF.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod1-Stack2" - }, - "dependencies": [ - "PipelineStackProd1Stack14013D698", - "PipelineStackProd1Stack2F0681AFF.assets" - ], - "metadata": { - "/PipelineStack/Prod1/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod1/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod1/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod1/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json deleted file mode 100644 index bbfcdc8262d4d..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68": { - "source": { - "path": "PipelineStackProd2Stack1FD464162.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json deleted file mode 100644 index 696665b70c71f..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9": { - "source": { - "path": "PipelineStackProd2Stack2176123EB.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/manifest.json deleted file mode 100644 index 435acb733132c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod2/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd2Stack1FD464162.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd2Stack1FD464162.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd2Stack1FD464162": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd2Stack1FD464162.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd2Stack1FD464162.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod2-Stack1" - }, - "dependencies": [ - "PipelineStackProd2Stack1FD464162.assets" - ], - "metadata": { - "/PipelineStack/Prod2/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod2/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod2/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod2/Stack1" - }, - "PipelineStackProd2Stack2176123EB.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd2Stack2176123EB.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd2Stack2176123EB": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd2Stack2176123EB.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd2Stack2176123EB.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod2-Stack2" - }, - "dependencies": [ - "PipelineStackProd2Stack1FD464162", - "PipelineStackProd2Stack2176123EB.assets" - ], - "metadata": { - "/PipelineStack/Prod2/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod2/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod2/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod2/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json deleted file mode 100644 index 09f23364954ef..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff": { - "source": { - "path": "PipelineStackProd3Stack1795F3D43.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json deleted file mode 100644 index 1e04e5ffc5b32..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99": { - "source": { - "path": "PipelineStackProd3Stack2DFBBA0B2.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/manifest.json deleted file mode 100644 index 90c6bc0ac66d5..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod3/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd3Stack1795F3D43.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd3Stack1795F3D43.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd3Stack1795F3D43": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd3Stack1795F3D43.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd3Stack1795F3D43.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod3-Stack1" - }, - "dependencies": [ - "PipelineStackProd3Stack1795F3D43.assets" - ], - "metadata": { - "/PipelineStack/Prod3/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod3/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod3/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod3/Stack1" - }, - "PipelineStackProd3Stack2DFBBA0B2.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd3Stack2DFBBA0B2.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd3Stack2DFBBA0B2": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd3Stack2DFBBA0B2.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd3Stack2DFBBA0B2.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod3-Stack2" - }, - "dependencies": [ - "PipelineStackProd3Stack1795F3D43", - "PipelineStackProd3Stack2DFBBA0B2.assets" - ], - "metadata": { - "/PipelineStack/Prod3/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod3/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod3/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod3/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json deleted file mode 100644 index fecfecde1c2b2..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78": { - "source": { - "path": "PipelineStackProd4Stack118F74ADB.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json deleted file mode 100644 index 57e9205f14899..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd": { - "source": { - "path": "PipelineStackProd4Stack2E2CB4ED3.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/manifest.json deleted file mode 100644 index c759e1f4d3da0..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod4/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd4Stack118F74ADB.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd4Stack118F74ADB.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd4Stack118F74ADB": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd4Stack118F74ADB.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd4Stack118F74ADB.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod4-Stack1" - }, - "dependencies": [ - "PipelineStackProd4Stack118F74ADB.assets" - ], - "metadata": { - "/PipelineStack/Prod4/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod4/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod4/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod4/Stack1" - }, - "PipelineStackProd4Stack2E2CB4ED3.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd4Stack2E2CB4ED3.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd4Stack2E2CB4ED3": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd4Stack2E2CB4ED3.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd4Stack2E2CB4ED3.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod4-Stack2" - }, - "dependencies": [ - "PipelineStackProd4Stack118F74ADB", - "PipelineStackProd4Stack2E2CB4ED3.assets" - ], - "metadata": { - "/PipelineStack/Prod4/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod4/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod4/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod4/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json deleted file mode 100644 index 08c8be3ece681..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7": { - "source": { - "path": "PipelineStackProd5Stack1E7E4E4C6.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json deleted file mode 100644 index bee0e9a641bc7..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8": { - "source": { - "path": "PipelineStackProd5Stack2C39BEE5B.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/manifest.json deleted file mode 100644 index bfda4464363eb..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod5/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd5Stack1E7E4E4C6.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd5Stack1E7E4E4C6.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd5Stack1E7E4E4C6": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd5Stack1E7E4E4C6.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd5Stack1E7E4E4C6.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod5-Stack1" - }, - "dependencies": [ - "PipelineStackProd5Stack1E7E4E4C6.assets" - ], - "metadata": { - "/PipelineStack/Prod5/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod5/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod5/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod5/Stack1" - }, - "PipelineStackProd5Stack2C39BEE5B.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd5Stack2C39BEE5B.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd5Stack2C39BEE5B": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd5Stack2C39BEE5B.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd5Stack2C39BEE5B.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod5-Stack2" - }, - "dependencies": [ - "PipelineStackProd5Stack1E7E4E4C6", - "PipelineStackProd5Stack2C39BEE5B.assets" - ], - "metadata": { - "/PipelineStack/Prod5/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod5/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod5/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod5/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json deleted file mode 100644 index 13dcd2725fa4f..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813": { - "source": { - "path": "PipelineStackProd6Stack1E7C34314.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json deleted file mode 100644 index d6be13b8891c1..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30": { - "source": { - "path": "PipelineStackProd6Stack2BED1BBCE.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/manifest.json deleted file mode 100644 index 5cfa186f47d6a..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/assembly-PipelineStack-Prod6/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd6Stack1E7C34314.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd6Stack1E7C34314.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd6Stack1E7C34314": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd6Stack1E7C34314.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd6Stack1E7C34314.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod6-Stack1" - }, - "dependencies": [ - "PipelineStackProd6Stack1E7C34314.assets" - ], - "metadata": { - "/PipelineStack/Prod6/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod6/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod6/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod6/Stack1" - }, - "PipelineStackProd6Stack2BED1BBCE.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd6Stack2BED1BBCE.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd6Stack2BED1BBCE": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd6Stack2BED1BBCE.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd6Stack2BED1BBCE.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod6-Stack2" - }, - "dependencies": [ - "PipelineStackProd6Stack1E7C34314", - "PipelineStackProd6Stack2BED1BBCE.assets" - ], - "metadata": { - "/PipelineStack/Prod6/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod6/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod6/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod6/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/integ.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/integ.json deleted file mode 100644 index 9991ff8d88028..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "30.1.0", - "testCases": { - "LambdaTest/DefaultTest": { - "stacks": [ - "PipelineStack" - ], - "assertionStack": "LambdaTest/DefaultTest/DeployAssert", - "assertionStackName": "LambdaTestDefaultTestDeployAssert1AF2B360" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/manifest.json deleted file mode 100644 index 20c148f2f7dc8..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/manifest.json +++ /dev/null @@ -1,250 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "assembly-PipelineStack-Beta": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Beta", - "displayName": "PipelineStack/Beta" - } - }, - "assembly-PipelineStack-Prod1": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod1", - "displayName": "PipelineStack/Prod1" - } - }, - "assembly-PipelineStack-Prod2": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod2", - "displayName": "PipelineStack/Prod2" - } - }, - "assembly-PipelineStack-Prod3": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod3", - "displayName": "PipelineStack/Prod3" - } - }, - "assembly-PipelineStack-Prod4": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod4", - "displayName": "PipelineStack/Prod4" - } - }, - "assembly-PipelineStack-Prod5": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod5", - "displayName": "PipelineStack/Prod5" - } - }, - "assembly-PipelineStack-Prod6": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod6", - "displayName": "PipelineStack/Prod6" - } - }, - "PipelineStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStack.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/65c76b51aca7d9a23134ff6f50a78c074f2122615c96f8c8373c6d009f2a1f87.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "PipelineStack.assets" - ], - "metadata": { - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketAEA9A052" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketPolicyF53CCC52" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleB27FAA37" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleDefaultPolicy7BDC1ABB" - } - ], - "/PipelineStack/Pipeline/Pipeline/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Pipeline9850B417" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/tkglaser_cdk-pipelines-demo/WebhookResource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourcetkglasercdkpipelinesdemoWebhookResource54EE51BE" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ], - "/PipelineStack/Pipeline/CodeBuildActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineCodeBuildActionRole226DB0CB" - } - ], - "/PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ], - "/PipelineStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack" - }, - "LambdaTestDefaultTestDeployAssert1AF2B360.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "LambdaTestDefaultTestDeployAssert1AF2B360.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "LambdaTestDefaultTestDeployAssert1AF2B360": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "LambdaTestDefaultTestDeployAssert1AF2B360.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "LambdaTestDefaultTestDeployAssert1AF2B360.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "LambdaTestDefaultTestDeployAssert1AF2B360.assets" - ], - "metadata": { - "/LambdaTest/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/LambdaTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "LambdaTest/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/tree.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/tree.json deleted file mode 100644 index 35f69612b3cfe..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-cross-account-keys.js.snapshot/tree.json +++ /dev/null @@ -1,4200 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "PipelineStack": { - "id": "PipelineStack", - "path": "PipelineStack", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline/Pipeline", - "children": { - "ArtifactsBucketEncryptionKey": { - "id": "ArtifactsBucketEncryptionKey", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Key", - "aws:cdk:cloudformation:props": { - "keyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "enableKeyRotation": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnKey", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Key", - "version": "0.0.0" - } - }, - "ArtifactsBucketEncryptionKeyAlias": { - "id": "ArtifactsBucketEncryptionKeyAlias", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Alias", - "aws:cdk:cloudformation:props": { - "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "targetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnAlias", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Alias", - "version": "0.0.0" - } - }, - "ArtifactsBucket": { - "id": "ArtifactsBucket", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "aws:kms", - "kmsMasterKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "stages": [ - { - "name": "Source", - "actions": [ - { - "name": "tkglaser_cdk-pipelines-demo", - "outputArtifacts": [ - { - "name": "tkglaser_cdk_pipelines_demo_Source" - } - ], - "actionTypeId": { - "category": "Source", - "version": "1", - "owner": "ThirdParty", - "provider": "GitHub" - }, - "configuration": { - "Owner": "tkglaser", - "Repo": "cdk-pipelines-demo", - "Branch": "main", - "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", - "PollForSourceChanges": false - }, - "runOrder": 1 - } - ] - }, - { - "name": "Build", - "actions": [ - { - "name": "Synth", - "inputArtifacts": [ - { - "name": "tkglaser_cdk_pipelines_demo_Source" - } - ], - "outputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "UpdatePipeline", - "actions": [ - { - "name": "SelfMutate", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"ceff66d3191e2ca3ec1a2711dae97a4541cbf7254c7dcca9acf21e0d12ce37a2\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "Beta", - "actions": [ - { - "name": "Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - }, - { - "name": "Wave1", - "actions": [ - { - "name": "Prod1.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod1.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod1.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod1.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - }, - { - "name": "Wave2", - "actions": [ - { - "name": "Prod3.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod3.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod3.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod3.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - } - ], - "artifactStore": { - "type": "S3", - "location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "encryptionKey": { - "type": "KMS", - "id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "restartExecutionOnUpdate": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnPipeline", - "version": "0.0.0" - } - }, - "Source": { - "id": "Source", - "path": "PipelineStack/Pipeline/Pipeline/Source", - "children": { - "tkglaser_cdk-pipelines-demo": { - "id": "tkglaser_cdk-pipelines-demo", - "path": "PipelineStack/Pipeline/Pipeline/Source/tkglaser_cdk-pipelines-demo", - "children": { - "WebhookResource": { - "id": "WebhookResource", - "path": "PipelineStack/Pipeline/Pipeline/Source/tkglaser_cdk-pipelines-demo/WebhookResource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Webhook", - "aws:cdk:cloudformation:props": { - "authentication": "GITHUB_HMAC", - "authenticationConfiguration": { - "secretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" - }, - "filters": [ - { - "jsonPath": "$.ref", - "matchEquals": "refs/heads/{Branch}" - } - ], - "targetAction": "tkglaser_cdk-pipelines-demo", - "targetPipeline": { - "Ref": "Pipeline9850B417" - }, - "targetPipelineVersion": 1, - "registerWithThirdParty": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnWebhook", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Build": { - "id": "Build", - "path": "PipelineStack/Pipeline/Pipeline/Build", - "children": { - "Synth": { - "id": "Synth", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", - "children": { - "CdkBuildProject": { - "id": "CdkBuildProject", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/Build/Synth", - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", - "children": { - "SelfMutate": { - "id": "SelfMutate", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Beta": { - "id": "Beta", - "path": "PipelineStack/Pipeline/Pipeline/Beta", - "children": { - "Stack1.Prepare": { - "id": "Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack1.Deploy": { - "id": "Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2.Prepare": { - "id": "Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2.Deploy": { - "id": "Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "children": { - "8389e75f-0810-4838-bf64-d6f85a95cf83": { - "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Wave1": { - "id": "Wave1", - "path": "PipelineStack/Pipeline/Pipeline/Wave1", - "children": { - "Prod1.Stack1.Prepare": { - "id": "Prod1.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack1.Prepare": { - "id": "Prod2.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1.Stack1.Deploy": { - "id": "Prod1.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack1.Deploy": { - "id": "Prod2.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1.Stack2.Prepare": { - "id": "Prod1.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack2.Prepare": { - "id": "Prod2.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1.Stack2.Deploy": { - "id": "Prod1.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack2.Deploy": { - "id": "Prod2.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Wave2": { - "id": "Wave2", - "path": "PipelineStack/Pipeline/Pipeline/Wave2", - "children": { - "Prod3.Stack1.Prepare": { - "id": "Prod3.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack1.Prepare": { - "id": "Prod4.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack1.Prepare": { - "id": "Prod5.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack1.Prepare": { - "id": "Prod6.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3.Stack1.Deploy": { - "id": "Prod3.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack1.Deploy": { - "id": "Prod4.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack1.Deploy": { - "id": "Prod5.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack1.Deploy": { - "id": "Prod6.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3.Stack2.Prepare": { - "id": "Prod3.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack2.Prepare": { - "id": "Prod4.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack2.Prepare": { - "id": "Prod5.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack2.Prepare": { - "id": "Prod6.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3.Stack2.Deploy": { - "id": "Prod3.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack2.Deploy": { - "id": "Prod4.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack2.Deploy": { - "id": "Prod5.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack2.Deploy": { - "id": "Prod6.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.Pipeline", - "version": "0.0.0" - } - }, - "CodeBuildActionRole": { - "id": "CodeBuildActionRole", - "path": "PipelineStack/Pipeline/CodeBuildActionRole", - "children": { - "ImportCodeBuildActionRole": { - "id": "ImportCodeBuildActionRole", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/ImportCodeBuildActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "Bool": { - "aws:ViaAWSService": "codepipeline.amazonaws.com" - } - }, - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", - "roles": [ - { - "Ref": "PipelineCodeBuildActionRole226DB0CB" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/UpdatePipeline", - "children": { - "SelfMutation": { - "id": "SelfMutation", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CodePipeline", - "version": "0.0.0" - } - }, - "Beta": { - "id": "Beta", - "path": "PipelineStack/Beta", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Beta/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Beta/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Beta/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Beta/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Beta/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Beta/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Beta/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Beta/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Beta/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Beta-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Beta/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Beta/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1": { - "id": "Prod1", - "path": "PipelineStack/Prod1", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod1/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod1/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod1/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod1/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod1/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod1/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod1/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod1/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod1/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod1-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod1/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod1/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2": { - "id": "Prod2", - "path": "PipelineStack/Prod2", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod2/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod2/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod2/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod2/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod2/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod2/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod2/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod2/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod2/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod2-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod2/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod2/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3": { - "id": "Prod3", - "path": "PipelineStack/Prod3", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod3/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod3/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod3/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod3/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod3/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod3/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod3/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod3/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod3/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod3-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod3/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod3/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4": { - "id": "Prod4", - "path": "PipelineStack/Prod4", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod4/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod4/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod4/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod4/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod4/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod4/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod4/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod4/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod4/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod4-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod4/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod4/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5": { - "id": "Prod5", - "path": "PipelineStack/Prod5", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod5/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod5/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod5/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod5/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod5/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod5/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod5/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod5/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod5/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod5-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod5/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod5/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6": { - "id": "Prod6", - "path": "PipelineStack/Prod6", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod6/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod6/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod6/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod6/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod6/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod6/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod6/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod6/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod6/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod6-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod6/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod6/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "LambdaTest": { - "id": "LambdaTest", - "path": "LambdaTest", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "LambdaTest/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "LambdaTest/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "LambdaTest/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "LambdaTest/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "LambdaTest/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.assets.json deleted file mode 100644 index 1810b87be3f74..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "9b823e9391fce4464a626cf388cd0ace02f442cfc7008913d5c12a1cedd2f5ef": { - "source": { - "path": "PipelineStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9b823e9391fce4464a626cf388cd0ace02f442cfc7008913d5c12a1cedd2f5ef.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.template.json deleted file mode 100644 index 5072fd1e09a8a..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/PipelineStack.template.json +++ /dev/null @@ -1,2153 +0,0 @@ -{ - "Resources": { - "Vpc8378EB38": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc" - } - ] - } - }, - "VpcPublicSubnet1Subnet5C2D37C4": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "VpcPublicSubnet1RouteTable6C95E38E": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "VpcPublicSubnet1RouteTableAssociation97140677": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - } - } - }, - "VpcPublicSubnet1DefaultRoute3DA9E72A": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VpcIGWD7BA715C" - } - }, - "DependsOn": [ - "VpcVPCGWBF912B6E" - ] - }, - "VpcPublicSubnet1EIPD7E02669": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "VpcPublicSubnet1NATGateway4D7517AA": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, - "AllocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet1EIPD7E02669", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - }, - "DependsOn": [ - "VpcPublicSubnet1DefaultRoute3DA9E72A", - "VpcPublicSubnet1RouteTableAssociation97140677" - ] - }, - "VpcPublicSubnet2Subnet691E08A3": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.64.0/18", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "VpcPublicSubnet2RouteTable94F7E489": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "VpcPublicSubnet2RouteTableAssociationDD5762D8": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - } - } - }, - "VpcPublicSubnet2DefaultRoute97F91067": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VpcIGWD7BA715C" - } - }, - "DependsOn": [ - "VpcVPCGWBF912B6E" - ] - }, - "VpcPublicSubnet2EIP3C605A87": { - "Type": "AWS::EC2::EIP", - "Properties": { - "Domain": "vpc", - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "VpcPublicSubnet2NATGateway9182C01D": { - "Type": "AWS::EC2::NatGateway", - "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, - "AllocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet2EIP3C605A87", - "AllocationId" - ] - }, - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - }, - "DependsOn": [ - "VpcPublicSubnet2DefaultRoute97F91067", - "VpcPublicSubnet2RouteTableAssociationDD5762D8" - ] - }, - "VpcPrivateSubnet1Subnet536B997A": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.128.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PrivateSubnet1" - } - ] - } - }, - "VpcPrivateSubnet1RouteTableB2C5B500": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PrivateSubnet1" - } - ] - } - }, - "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "SubnetId": { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - } - }, - "VpcPrivateSubnet1DefaultRouteBE02A9ED": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "VpcPublicSubnet1NATGateway4D7517AA" - } - } - }, - "VpcPrivateSubnet2Subnet3788AAA1": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.192.0/18", - "MapPublicIpOnLaunch": false, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "Private" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Private" - }, - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PrivateSubnet2" - } - ] - } - }, - "VpcPrivateSubnet2RouteTableA678073B": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc/PrivateSubnet2" - } - ] - } - }, - "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "SubnetId": { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - } - }, - "VpcPrivateSubnet2DefaultRoute060D2087": { - "Type": "AWS::EC2::Route", - "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "DestinationCidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Ref": "VpcPublicSubnet2NATGateway9182C01D" - } - } - }, - "VpcIGWD7BA715C": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "PipelineStack/Vpc" - } - ] - } - }, - "VpcVPCGWBF912B6E": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, - "InternetGatewayId": { - "Ref": "VpcIGWD7BA715C" - } - } - }, - "PipelineArtifactsBucketAEA9A052": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "aws:kms" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "PipelineArtifactsBucketPolicyF53CCC52": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleB27FAA37": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleDefaultPolicy7BDC1ABB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "Roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "Pipeline9850B417": { - "Type": "AWS::CodePipeline::Pipeline", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "Stages": [ - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Source", - "Owner": "ThirdParty", - "Provider": "GitHub", - "Version": "1" - }, - "Configuration": { - "Owner": "aws", - "Repo": "aws-cdk", - "Branch": "v2-main", - "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", - "PollForSourceChanges": false - }, - "Name": "aws_aws-cdk", - "OutputArtifacts": [ - { - "Name": "aws_aws_cdk_Source" - } - ], - "RunOrder": 1 - } - ], - "Name": "Source" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" - }, - "InputArtifacts": [ - { - "Name": "aws_aws_cdk_Source" - } - ], - "Name": "Synth", - "OutputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Build" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"ceff66d3191e2ca3ec1a2711dae97a4541cbf7254c7dcca9acf21e0d12ce37a2\"}]" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "SelfMutate", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "UpdatePipeline" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset185A67CB4" - } - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "FileAsset1", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset24D2D639B" - } - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "FileAsset2", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Assets" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - } - ], - "Name": "Beta" - } - ], - "ArtifactStore": { - "Location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "Type": "S3" - }, - "RestartExecutionOnUpdate": true - }, - "DependsOn": [ - "PipelineRoleDefaultPolicy7BDC1ABB", - "PipelineRoleB27FAA37" - ] - }, - "PipelineSourceawsawscdkWebhookResource46EC529B": { - "Type": "AWS::CodePipeline::Webhook", - "Properties": { - "Authentication": "GITHUB_HMAC", - "AuthenticationConfiguration": { - "SecretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" - }, - "Filters": [ - { - "JsonPath": "$.ref", - "MatchEquals": "refs/heads/{Branch}" - } - ], - "TargetAction": "aws_aws-cdk", - "TargetPipeline": { - "Ref": "Pipeline9850B417" - }, - "TargetPipelineVersion": 1, - "RegisterWithThirdParty": true - } - }, - "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "ec2:CreateNetworkInterfacePermission", - "Condition": { - "StringEquals": { - "ec2:Subnet": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - ] - } - ], - "ec2:AuthorizedService": "codebuild.amazonaws.com" - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":network-interface/*" - ] - ] - } - }, - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineBuildSynthCdkBuildProject225CEB2C", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "PipelineBuildSynthCdkBuildProject6BEFA8E6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/Build/Synth", - "EncryptionKey": "alias/aws/s3", - "VpcConfig": { - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "DependsOn": [ - "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A" - ] - }, - "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "ec2:CreateNetworkInterface", - "ec2:DeleteNetworkInterface", - "ec2:DescribeDhcpOptions", - "ec2:DescribeNetworkInterfaces", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineCodeBuildActionRole226DB0CB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "Bool": { - "aws:ViaAWSService": "codepipeline.amazonaws.com" - } - }, - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset185A67CB4", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset24D2D639B", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", - "Roles": [ - { - "Ref": "PipelineCodeBuildActionRole226DB0CB" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationRole57E559E8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "ec2:CreateNetworkInterfacePermission", - "Condition": { - "StringEquals": { - "ec2:Subnet": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - ] - } - ], - "ec2:AuthorizedService": "codebuild.amazonaws.com" - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":network-interface/*" - ] - ] - } - }, - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineUpdatePipelineSelfMutationE51045FC", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "PipelineUpdatePipelineSelfMutationDAA41400": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", - "EncryptionKey": "alias/aws/s3", - "VpcConfig": { - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "DependsOn": [ - "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74" - ] - }, - "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "ec2:CreateNetworkInterface", - "ec2:DeleteNetworkInterface", - "ec2:DescribeDhcpOptions", - "ec2:DescribeNetworkInterfaces", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineAssetsFileRole59943A77": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - }, - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineAssetsFileRoleDefaultPolicy14DB8755": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": { - "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - }, - { - "Action": "ec2:CreateNetworkInterfacePermission", - "Condition": { - "StringEquals": { - "ec2:Subnet": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - ] - } - ], - "ec2:AuthorizedService": "codebuild.amazonaws.com" - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":network-interface/*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", - "Roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "PipelineAssetsFileAsset1SecurityGroupF04F1AD4": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset10191BEFB", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "PipelineAssetsFileAsset185A67CB4": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset1", - "EncryptionKey": "alias/aws/s3", - "VpcConfig": { - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset1SecurityGroupF04F1AD4", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "DependsOn": [ - "PipelineAssetsFileAsset1PolicyDocument4681543E" - ] - }, - "PipelineAssetsFileAsset1PolicyDocument4681543E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "ec2:CreateNetworkInterface", - "ec2:DeleteNetworkInterface", - "ec2:DescribeDhcpOptions", - "ec2:DescribeNetworkInterfaces", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineAssetsFileAsset1PolicyDocument4681543E", - "Roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "PipelineAssetsFileAsset2SecurityGroupA400C1A5": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset24DB856A2", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "PipelineAssetsFileAsset24D2D639B": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset2", - "EncryptionKey": "alias/aws/s3", - "VpcConfig": { - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset2SecurityGroupA400C1A5", - "GroupId" - ] - } - ], - "Subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "VpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "DependsOn": [ - "PipelineAssetsFileAsset1PolicyDocument4681543E" - ] - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json deleted file mode 100644 index 87c6776a54703..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5": { - "source": { - "path": "../asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e": { - "source": { - "path": "../asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "9b0251342ce12f30650bbf24424c57aba9857cc654420b1deff1533588801ceb": { - "source": { - "path": "PipelineStackBetaStack1E6541489.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9b0251342ce12f30650bbf24424c57aba9857cc654420b1deff1533588801ceb.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/manifest.json deleted file mode 100644 index fd5f1031b8637..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/assembly-PipelineStack-Beta/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackBetaStack1E6541489.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackBetaStack1E6541489.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackBetaStack1E6541489": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackBetaStack1E6541489.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9b0251342ce12f30650bbf24424c57aba9857cc654420b1deff1533588801ceb.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackBetaStack1E6541489.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Beta-Stack1" - }, - "dependencies": [ - "PipelineStackBetaStack1E6541489.assets" - ], - "metadata": { - "/PipelineStack/Beta/Stack1/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Beta/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Beta/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Beta/Stack1" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/integ.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/integ.json deleted file mode 100644 index 5c8e2f720df19..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/integ.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "30.1.0", - "testCases": { - "integ.newpipeline-with-vpc": { - "stacks": [ - "PipelineStack" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": { - "@aws-cdk/core:newStyleStackSynthesis": "true" - }, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/manifest.json deleted file mode 100644 index 67944a3522e2a..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/manifest.json +++ /dev/null @@ -1,353 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "assembly-PipelineStack-Beta": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Beta", - "displayName": "PipelineStack/Beta" - } - }, - "PipelineStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStack.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9b823e9391fce4464a626cf388cd0ace02f442cfc7008913d5c12a1cedd2f5ef.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "PipelineStack.assets" - ], - "metadata": { - "/PipelineStack/Vpc/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Vpc8378EB38" - } - ], - "/PipelineStack/Vpc/PublicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1Subnet5C2D37C4" - } - ], - "/PipelineStack/Vpc/PublicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1RouteTable6C95E38E" - } - ], - "/PipelineStack/Vpc/PublicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1RouteTableAssociation97140677" - } - ], - "/PipelineStack/Vpc/PublicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1DefaultRoute3DA9E72A" - } - ], - "/PipelineStack/Vpc/PublicSubnet1/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1EIPD7E02669" - } - ], - "/PipelineStack/Vpc/PublicSubnet1/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet1NATGateway4D7517AA" - } - ], - "/PipelineStack/Vpc/PublicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2Subnet691E08A3" - } - ], - "/PipelineStack/Vpc/PublicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2RouteTable94F7E489" - } - ], - "/PipelineStack/Vpc/PublicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2RouteTableAssociationDD5762D8" - } - ], - "/PipelineStack/Vpc/PublicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2DefaultRoute97F91067" - } - ], - "/PipelineStack/Vpc/PublicSubnet2/EIP": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2EIP3C605A87" - } - ], - "/PipelineStack/Vpc/PublicSubnet2/NATGateway": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPublicSubnet2NATGateway9182C01D" - } - ], - "/PipelineStack/Vpc/PrivateSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1Subnet536B997A" - } - ], - "/PipelineStack/Vpc/PrivateSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1RouteTableB2C5B500" - } - ], - "/PipelineStack/Vpc/PrivateSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1RouteTableAssociation70C59FA6" - } - ], - "/PipelineStack/Vpc/PrivateSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet1DefaultRouteBE02A9ED" - } - ], - "/PipelineStack/Vpc/PrivateSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "/PipelineStack/Vpc/PrivateSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2RouteTableA678073B" - } - ], - "/PipelineStack/Vpc/PrivateSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2RouteTableAssociationA89CAD56" - } - ], - "/PipelineStack/Vpc/PrivateSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcPrivateSubnet2DefaultRoute060D2087" - } - ], - "/PipelineStack/Vpc/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcIGWD7BA715C" - } - ], - "/PipelineStack/Vpc/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "VpcVPCGWBF912B6E" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketAEA9A052" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketPolicyF53CCC52" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleB27FAA37" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleDefaultPolicy7BDC1ABB" - } - ], - "/PipelineStack/Pipeline/Pipeline/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Pipeline9850B417" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/aws_aws-cdk/WebhookResource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceawsawscdkWebhookResource46EC529B" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/PolicyDocument/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A" - } - ], - "/PipelineStack/Pipeline/CodeBuildActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineCodeBuildActionRole226DB0CB" - } - ], - "/PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/PolicyDocument/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74" - } - ], - "/PipelineStack/Pipeline/Assets/FileRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileRole59943A77" - } - ], - "/PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileRoleDefaultPolicy14DB8755" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset1/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset1SecurityGroupF04F1AD4" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset1/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset185A67CB4" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset1/PolicyDocument/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset1PolicyDocument4681543E" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset2/SecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset2SecurityGroupA400C1A5" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset2/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset24D2D639B" - } - ], - "/PipelineStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/tree.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/tree.json deleted file mode 100644 index 6d19c95ab90d0..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.js.snapshot/tree.json +++ /dev/null @@ -1,3168 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "PipelineStack": { - "id": "PipelineStack", - "path": "PipelineStack", - "children": { - "Vpc": { - "id": "Vpc", - "path": "PipelineStack/Vpc", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Vpc/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPC", - "aws:cdk:cloudformation:props": { - "cidrBlock": "10.0.0.0/16", - "enableDnsHostnames": true, - "enableDnsSupport": true, - "instanceTenancy": "default", - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPC", - "version": "0.0.0" - } - }, - "PublicSubnet1": { - "id": "PublicSubnet1", - "path": "PipelineStack/Vpc/PublicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "PipelineStack/Vpc/PublicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.0.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "PipelineStack/Vpc/PublicSubnet1/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "PipelineStack/Vpc/PublicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "PipelineStack/Vpc/PublicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "subnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "PipelineStack/Vpc/PublicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "VpcIGWD7BA715C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "PipelineStack/Vpc/PublicSubnet1/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "PipelineStack/Vpc/PublicSubnet1/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, - "allocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet1EIPD7E02669", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PublicSubnet2": { - "id": "PublicSubnet2", - "path": "PipelineStack/Vpc/PublicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "PipelineStack/Vpc/PublicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.64.0/18", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "PipelineStack/Vpc/PublicSubnet2/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "PipelineStack/Vpc/PublicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "PipelineStack/Vpc/PublicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "subnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "PipelineStack/Vpc/PublicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "VpcIGWD7BA715C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - }, - "EIP": { - "id": "EIP", - "path": "PipelineStack/Vpc/PublicSubnet2/EIP", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::EIP", - "aws:cdk:cloudformation:props": { - "domain": "vpc", - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnEIP", - "version": "0.0.0" - } - }, - "NATGateway": { - "id": "NATGateway", - "path": "PipelineStack/Vpc/PublicSubnet2/NATGateway", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", - "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, - "allocationId": { - "Fn::GetAtt": [ - "VpcPublicSubnet2EIP3C605A87", - "AllocationId" - ] - }, - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PublicSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet1": { - "id": "PrivateSubnet1", - "path": "PipelineStack/Vpc/PrivateSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "PipelineStack/Vpc/PrivateSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.128.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "PipelineStack/Vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "PipelineStack/Vpc/PrivateSubnet1/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "PipelineStack/Vpc/PrivateSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PrivateSubnet1" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "PipelineStack/Vpc/PrivateSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "subnetId": { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "PipelineStack/Vpc/PrivateSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "VpcPublicSubnet1NATGateway4D7517AA" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "PrivateSubnet2": { - "id": "PrivateSubnet2", - "path": "PipelineStack/Vpc/PrivateSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "PipelineStack/Vpc/PrivateSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.192.0/18", - "mapPublicIpOnLaunch": false, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "Private" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Private" - }, - { - "key": "Name", - "value": "PipelineStack/Vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "PipelineStack/Vpc/PrivateSubnet2/Acl", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "PipelineStack/Vpc/PrivateSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc/PrivateSubnet2" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "PipelineStack/Vpc/PrivateSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "subnetId": { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "PipelineStack/Vpc/PrivateSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, - "destinationCidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Ref": "VpcPublicSubnet2NATGateway9182C01D" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "PipelineStack/Vpc/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "PipelineStack/Vpc" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "PipelineStack/Vpc/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "internetGatewayId": { - "Ref": "VpcIGWD7BA715C" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.Vpc", - "version": "0.0.0" - } - }, - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline/Pipeline", - "children": { - "ArtifactsBucket": { - "id": "ArtifactsBucket", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "aws:kms" - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "stages": [ - { - "name": "Source", - "actions": [ - { - "name": "aws_aws-cdk", - "outputArtifacts": [ - { - "name": "aws_aws_cdk_Source" - } - ], - "actionTypeId": { - "category": "Source", - "version": "1", - "owner": "ThirdParty", - "provider": "GitHub" - }, - "configuration": { - "Owner": "aws", - "Repo": "aws-cdk", - "Branch": "v2-main", - "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", - "PollForSourceChanges": false - }, - "runOrder": 1 - } - ] - }, - { - "name": "Build", - "actions": [ - { - "name": "Synth", - "inputArtifacts": [ - { - "name": "aws_aws_cdk_Source" - } - ], - "outputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "UpdatePipeline", - "actions": [ - { - "name": "SelfMutate", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"ceff66d3191e2ca3ec1a2711dae97a4541cbf7254c7dcca9acf21e0d12ce37a2\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "Assets", - "actions": [ - { - "name": "FileAsset1", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset185A67CB4" - } - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - }, - { - "name": "FileAsset2", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset24D2D639B" - } - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "Beta", - "actions": [ - { - "name": "Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - } - ], - "artifactStore": { - "type": "S3", - "location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - } - }, - "restartExecutionOnUpdate": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnPipeline", - "version": "0.0.0" - } - }, - "Source": { - "id": "Source", - "path": "PipelineStack/Pipeline/Pipeline/Source", - "children": { - "aws_aws-cdk": { - "id": "aws_aws-cdk", - "path": "PipelineStack/Pipeline/Pipeline/Source/aws_aws-cdk", - "children": { - "WebhookResource": { - "id": "WebhookResource", - "path": "PipelineStack/Pipeline/Pipeline/Source/aws_aws-cdk/WebhookResource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Webhook", - "aws:cdk:cloudformation:props": { - "authentication": "GITHUB_HMAC", - "authenticationConfiguration": { - "secretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" - }, - "filters": [ - { - "jsonPath": "$.ref", - "matchEquals": "refs/heads/{Branch}" - } - ], - "targetAction": "aws_aws-cdk", - "targetPipeline": { - "Ref": "Pipeline9850B417" - }, - "targetPipelineVersion": 1, - "registerWithThirdParty": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnWebhook", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Build": { - "id": "Build", - "path": "PipelineStack/Pipeline/Pipeline/Build", - "children": { - "Synth": { - "id": "Synth", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", - "children": { - "CdkBuildProject": { - "id": "CdkBuildProject", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "ec2:CreateNetworkInterfacePermission", - "Condition": { - "StringEquals": { - "ec2:Subnet": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - ] - } - ], - "ec2:AuthorizedService": "codebuild.amazonaws.com" - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":network-interface/*" - ] - ] - } - }, - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineBuildSynthCdkBuildProject225CEB2C", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/Build/Synth", - "encryptionKey": "alias/aws/s3", - "vpcConfig": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectSecurityGroup84F92459", - "GroupId" - ] - } - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - }, - "PolicyDocument": { - "id": "PolicyDocument", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/PolicyDocument", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/PolicyDocument/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "ec2:CreateNetworkInterface", - "ec2:DeleteNetworkInterface", - "ec2:DescribeDhcpOptions", - "ec2:DescribeNetworkInterfaces", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectPolicyDocument4D16371A", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", - "children": { - "SelfMutate": { - "id": "SelfMutate", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Pipeline/Assets", - "children": { - "FileAsset1": { - "id": "FileAsset1", - "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset1", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "FileAsset2": { - "id": "FileAsset2", - "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset2", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Beta": { - "id": "Beta", - "path": "PipelineStack/Pipeline/Pipeline/Beta", - "children": { - "Prepare": { - "id": "Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Deploy": { - "id": "Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "children": { - "8389e75f-0810-4838-bf64-d6f85a95cf83": { - "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.Pipeline", - "version": "0.0.0" - } - }, - "CodeBuildActionRole": { - "id": "CodeBuildActionRole", - "path": "PipelineStack/Pipeline/CodeBuildActionRole", - "children": { - "ImportCodeBuildActionRole": { - "id": "ImportCodeBuildActionRole", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/ImportCodeBuildActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "Bool": { - "aws:ViaAWSService": "codepipeline.amazonaws.com" - } - }, - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset185A67CB4", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset24D2D639B", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", - "roles": [ - { - "Ref": "PipelineCodeBuildActionRole226DB0CB" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/UpdatePipeline", - "children": { - "SelfMutation": { - "id": "SelfMutation", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "ec2:CreateNetworkInterfacePermission", - "Condition": { - "StringEquals": { - "ec2:Subnet": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - ] - } - ], - "ec2:AuthorizedService": "codebuild.amazonaws.com" - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":network-interface/*" - ] - ] - } - }, - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "SecurityGroup": { - "id": "SecurityGroup", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineUpdatePipelineSelfMutationE51045FC", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", - "encryptionKey": "alias/aws/s3", - "vpcConfig": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationSecurityGroup94164EDC", - "GroupId" - ] - } - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - }, - "PolicyDocument": { - "id": "PolicyDocument", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/PolicyDocument", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/PolicyDocument/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "ec2:CreateNetworkInterface", - "ec2:DeleteNetworkInterface", - "ec2:DescribeDhcpOptions", - "ec2:DescribeNetworkInterfaces", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationPolicyDocumentD327DC74", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Assets", - "children": { - "FileRole": { - "id": "FileRole", - "path": "PipelineStack/Pipeline/Assets/FileRole", - "children": { - "ImportFileRole": { - "id": "ImportFileRole", - "path": "PipelineStack/Pipeline/Assets/FileRole/ImportFileRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - }, - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": { - "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - }, - { - "Action": "ec2:CreateNetworkInterfacePermission", - "Condition": { - "StringEquals": { - "ec2:Subnet": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":subnet/", - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ] - ] - } - ], - "ec2:AuthorizedService": "codebuild.amazonaws.com" - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":network-interface/*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", - "roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "FileAsset1": { - "id": "FileAsset1", - "path": "PipelineStack/Pipeline/Assets/FileAsset1", - "children": { - "SecurityGroup": { - "id": "SecurityGroup", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset10191BEFB", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset1", - "encryptionKey": "alias/aws/s3", - "vpcConfig": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset1SecurityGroupF04F1AD4", - "GroupId" - ] - } - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - }, - "PolicyDocument": { - "id": "PolicyDocument", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/PolicyDocument", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/PolicyDocument/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "ec2:CreateNetworkInterface", - "ec2:DeleteNetworkInterface", - "ec2:DescribeDhcpOptions", - "ec2:DescribeNetworkInterfaces", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs" - ], - "Effect": "Allow", - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineAssetsFileAsset1PolicyDocument4681543E", - "roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - }, - "FileAsset2": { - "id": "FileAsset2", - "path": "PipelineStack/Pipeline/Assets/FileAsset2", - "children": { - "SecurityGroup": { - "id": "SecurityGroup", - "path": "PipelineStack/Pipeline/Assets/FileAsset2/SecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset2/SecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "Automatic generated security group for CodeBuild PipelineStackPipelineAssetsFileAsset24DB856A2", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "vpcId": { - "Ref": "Vpc8378EB38" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset2/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/Assets/FileAsset2", - "encryptionKey": "alias/aws/s3", - "vpcConfig": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, - "subnets": [ - { - "Ref": "VpcPrivateSubnet1Subnet536B997A" - }, - { - "Ref": "VpcPrivateSubnet2Subnet3788AAA1" - } - ], - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileAsset2SecurityGroupA400C1A5", - "GroupId" - ] - } - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CodePipeline", - "version": "0.0.0" - } - }, - "Beta": { - "id": "Beta", - "path": "PipelineStack/Beta", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Beta/Stack1", - "children": { - "Asset": { - "id": "Asset", - "path": "PipelineStack/Beta/Stack1/Asset", - "children": { - "Stage": { - "id": "Stage", - "path": "PipelineStack/Beta/Stack1/Asset/Stage", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "PipelineStack/Beta/Stack1/Asset/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Asset2": { - "id": "Asset2", - "path": "PipelineStack/Beta/Stack1/Asset2", - "children": { - "Stage": { - "id": "Stage", - "path": "PipelineStack/Beta/Stack1/Asset2/Stage", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "PipelineStack/Beta/Stack1/Asset2/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Beta/Stack1/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Beta/Stack1/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Beta/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Beta/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.assets.json deleted file mode 100644 index 53541c617b50b..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "1dbba360a5b410c5ef982afe56c9c77ea414e1a4d6c00e51a2bc3810237fc17a": { - "source": { - "path": "PipelineStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "1dbba360a5b410c5ef982afe56c9c77ea414e1a4d6c00e51a2bc3810237fc17a.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.template.json deleted file mode 100644 index 55ab470865d7d..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/PipelineStack.template.json +++ /dev/null @@ -1,2390 +0,0 @@ -{ - "Resources": { - "PipelineArtifactsBucketAEA9A052": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "aws:kms" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "PipelineArtifactsBucketPolicyF53CCC52": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleB27FAA37": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleDefaultPolicy7BDC1ABB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "Roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "Pipeline9850B417": { - "Type": "AWS::CodePipeline::Pipeline", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "Stages": [ - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Source", - "Owner": "ThirdParty", - "Provider": "GitHub", - "Version": "1" - }, - "Configuration": { - "Owner": "rix0rrr", - "Repo": "cdk-pipelines-demo", - "Branch": "main", - "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", - "PollForSourceChanges": false - }, - "Name": "rix0rrr_cdk-pipelines-demo", - "OutputArtifacts": [ - { - "Name": "rix0rrr_cdk_pipelines_demo_Source" - } - ], - "RunOrder": 1 - } - ], - "Name": "Source" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" - }, - "InputArtifacts": [ - { - "Name": "rix0rrr_cdk_pipelines_demo_Source" - } - ], - "Name": "Synth", - "OutputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Build" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"ceff66d3191e2ca3ec1a2711dae97a4541cbf7254c7dcca9acf21e0d12ce37a2\"}]" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "SelfMutate", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "UpdatePipeline" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Beta-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - } - ], - "Name": "Beta" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod1.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod2.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod1.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod2.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod1.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod2.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod1-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod1.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod2-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod2.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - } - ], - "Name": "Wave1" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod3.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod4.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod5.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod6.Stack1.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod3.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod4.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod5.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod6.Stack1.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod3.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod4.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod5.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" - }, - "InputArtifacts": [ - { - "Name": "Synth_Output" - } - ], - "Name": "Prod6.Stack2.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 3 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod3-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod3.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod4-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod4.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod5-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod5.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "Prod6-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Prod6.Stack2.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 4 - } - ], - "Name": "Wave2" - } - ], - "ArtifactStore": { - "Location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "Type": "S3" - }, - "RestartExecutionOnUpdate": true - }, - "DependsOn": [ - "PipelineRoleDefaultPolicy7BDC1ABB", - "PipelineRoleB27FAA37" - ] - }, - "PipelineSourcerix0rrrcdkpipelinesdemoWebhookResourceDB0C1BCA": { - "Type": "AWS::CodePipeline::Webhook", - "Properties": { - "Authentication": "GITHUB_HMAC", - "AuthenticationConfiguration": { - "SecretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" - }, - "Filters": [ - { - "JsonPath": "$.ref", - "MatchEquals": "refs/heads/{Branch}" - } - ], - "TargetAction": "rix0rrr_cdk-pipelines-demo", - "TargetPipeline": { - "Ref": "Pipeline9850B417" - }, - "TargetPipelineVersion": 1, - "RegisterWithThirdParty": true - } - }, - "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProject6BEFA8E6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/Build/Synth", - "EncryptionKey": "alias/aws/s3" - } - }, - "PipelineCodeBuildActionRole226DB0CB": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "Bool": { - "aws:ViaAWSService": "codepipeline.amazonaws.com" - } - }, - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", - "Roles": [ - { - "Ref": "PipelineCodeBuildActionRole226DB0CB" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationRole57E559E8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationDAA41400": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "Description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", - "EncryptionKey": "alias/aws/s3" - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json deleted file mode 100644 index 4dcd082943816..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65": { - "source": { - "path": "PipelineStackBetaStack1E6541489.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json deleted file mode 100644 index 64b29ec0098ea..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326": { - "source": { - "path": "PipelineStackBetaStack2C79AD00A.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/manifest.json deleted file mode 100644 index 4bb5689450675..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Beta/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackBetaStack1E6541489.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackBetaStack1E6541489.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackBetaStack1E6541489": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackBetaStack1E6541489.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/91031b26c04588c38a59e3481d308182b5244c5f5a3af3ee05566e2f4f70ce65.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackBetaStack1E6541489.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Beta-Stack1" - }, - "dependencies": [ - "PipelineStackBetaStack1E6541489.assets" - ], - "metadata": { - "/PipelineStack/Beta/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Beta/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Beta/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Beta/Stack1" - }, - "PipelineStackBetaStack2C79AD00A.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackBetaStack2C79AD00A.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackBetaStack2C79AD00A": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackBetaStack2C79AD00A.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e3aa38ca82b00b776ad3834e9ee862d2e529d91c0f0b12fad846884e1e600326.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackBetaStack2C79AD00A.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Beta-Stack2" - }, - "dependencies": [ - "PipelineStackBetaStack1E6541489", - "PipelineStackBetaStack2C79AD00A.assets" - ], - "metadata": { - "/PipelineStack/Beta/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Beta/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Beta/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Beta/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json deleted file mode 100644 index b0b6911c8e622..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3": { - "source": { - "path": "PipelineStackProd1Stack14013D698.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json deleted file mode 100644 index 2564919d9f4c7..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059": { - "source": { - "path": "PipelineStackProd1Stack2F0681AFF.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/manifest.json deleted file mode 100644 index 42c36e92a83ce..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod1/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd1Stack14013D698.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd1Stack14013D698.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd1Stack14013D698": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd1Stack14013D698.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/774f0c3cec814003a4da7d6cab73aec82952a0cb52a221b3f94fae483d9922a3.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd1Stack14013D698.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod1-Stack1" - }, - "dependencies": [ - "PipelineStackProd1Stack14013D698.assets" - ], - "metadata": { - "/PipelineStack/Prod1/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod1/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod1/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod1/Stack1" - }, - "PipelineStackProd1Stack2F0681AFF.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd1Stack2F0681AFF.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd1Stack2F0681AFF": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd1Stack2F0681AFF.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c1cb4eebe68ea920a89e618efa29c36ecc1aa0c6f6ef6b65559efe9c0bba4059.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd1Stack2F0681AFF.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod1-Stack2" - }, - "dependencies": [ - "PipelineStackProd1Stack14013D698", - "PipelineStackProd1Stack2F0681AFF.assets" - ], - "metadata": { - "/PipelineStack/Prod1/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod1/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod1/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod1/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json deleted file mode 100644 index bbfcdc8262d4d..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68": { - "source": { - "path": "PipelineStackProd2Stack1FD464162.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json deleted file mode 100644 index 696665b70c71f..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9": { - "source": { - "path": "PipelineStackProd2Stack2176123EB.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/manifest.json deleted file mode 100644 index 435acb733132c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod2/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd2Stack1FD464162.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd2Stack1FD464162.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd2Stack1FD464162": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd2Stack1FD464162.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a595899a57366f015e986ac46c3da09fac75670ea0f4719de8defc67d731fa68.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd2Stack1FD464162.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod2-Stack1" - }, - "dependencies": [ - "PipelineStackProd2Stack1FD464162.assets" - ], - "metadata": { - "/PipelineStack/Prod2/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod2/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod2/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod2/Stack1" - }, - "PipelineStackProd2Stack2176123EB.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd2Stack2176123EB.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd2Stack2176123EB": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd2Stack2176123EB.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/364ee9a72c6c371a00c6e41438695af070848a2d625a4c953bfc4666e7ad5ae9.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd2Stack2176123EB.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod2-Stack2" - }, - "dependencies": [ - "PipelineStackProd2Stack1FD464162", - "PipelineStackProd2Stack2176123EB.assets" - ], - "metadata": { - "/PipelineStack/Prod2/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod2/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod2/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod2/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json deleted file mode 100644 index 09f23364954ef..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff": { - "source": { - "path": "PipelineStackProd3Stack1795F3D43.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json deleted file mode 100644 index 1e04e5ffc5b32..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99": { - "source": { - "path": "PipelineStackProd3Stack2DFBBA0B2.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/cdk.out b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/manifest.json deleted file mode 100644 index 90c6bc0ac66d5..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod3/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd3Stack1795F3D43.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd3Stack1795F3D43.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd3Stack1795F3D43": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd3Stack1795F3D43.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e8c78794529aa32b354a78b7b979165b0cadd9d113a37f537d083f946c0e7bff.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd3Stack1795F3D43.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod3-Stack1" - }, - "dependencies": [ - "PipelineStackProd3Stack1795F3D43.assets" - ], - "metadata": { - "/PipelineStack/Prod3/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod3/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod3/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod3/Stack1" - }, - "PipelineStackProd3Stack2DFBBA0B2.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd3Stack2DFBBA0B2.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd3Stack2DFBBA0B2": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd3Stack2DFBBA0B2.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9fee5ad34559e603d3fc184456935445ea09549b147d2cbc2acd8cf6b916dd99.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd3Stack2DFBBA0B2.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod3-Stack2" - }, - "dependencies": [ - "PipelineStackProd3Stack1795F3D43", - "PipelineStackProd3Stack2DFBBA0B2.assets" - ], - "metadata": { - "/PipelineStack/Prod3/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod3/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod3/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod3/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json deleted file mode 100644 index fecfecde1c2b2..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78": { - "source": { - "path": "PipelineStackProd4Stack118F74ADB.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json deleted file mode 100644 index 57e9205f14899..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd": { - "source": { - "path": "PipelineStackProd4Stack2E2CB4ED3.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/cdk.out b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/manifest.json deleted file mode 100644 index c759e1f4d3da0..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod4/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd4Stack118F74ADB.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd4Stack118F74ADB.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd4Stack118F74ADB": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd4Stack118F74ADB.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7e0ecf5ec563ed47798cfb17d4c3ce0e6c710c075fc53bf8cd15d8fb9a210f78.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd4Stack118F74ADB.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod4-Stack1" - }, - "dependencies": [ - "PipelineStackProd4Stack118F74ADB.assets" - ], - "metadata": { - "/PipelineStack/Prod4/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod4/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod4/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod4/Stack1" - }, - "PipelineStackProd4Stack2E2CB4ED3.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd4Stack2E2CB4ED3.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd4Stack2E2CB4ED3": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd4Stack2E2CB4ED3.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a9cddd81a8937cbadd9bf93c6fe07766501a7c137605bb09e6cfa322b2eb09fd.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd4Stack2E2CB4ED3.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod4-Stack2" - }, - "dependencies": [ - "PipelineStackProd4Stack118F74ADB", - "PipelineStackProd4Stack2E2CB4ED3.assets" - ], - "metadata": { - "/PipelineStack/Prod4/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod4/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod4/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod4/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json deleted file mode 100644 index 08c8be3ece681..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7": { - "source": { - "path": "PipelineStackProd5Stack1E7E4E4C6.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json deleted file mode 100644 index bee0e9a641bc7..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8": { - "source": { - "path": "PipelineStackProd5Stack2C39BEE5B.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/cdk.out b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/manifest.json deleted file mode 100644 index bfda4464363eb..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod5/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd5Stack1E7E4E4C6.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd5Stack1E7E4E4C6.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd5Stack1E7E4E4C6": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd5Stack1E7E4E4C6.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1e0089d5c027ddec49745fce045925aff9342fbffdf989e4ae5263fd87ee50f7.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd5Stack1E7E4E4C6.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod5-Stack1" - }, - "dependencies": [ - "PipelineStackProd5Stack1E7E4E4C6.assets" - ], - "metadata": { - "/PipelineStack/Prod5/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod5/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod5/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod5/Stack1" - }, - "PipelineStackProd5Stack2C39BEE5B.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd5Stack2C39BEE5B.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd5Stack2C39BEE5B": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd5Stack2C39BEE5B.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/48a94145722a5a14816cb87dce62fadba53a03b2c18e0fdfb5107ffabd5d7cd8.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd5Stack2C39BEE5B.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod5-Stack2" - }, - "dependencies": [ - "PipelineStackProd5Stack1E7E4E4C6", - "PipelineStackProd5Stack2C39BEE5B.assets" - ], - "metadata": { - "/PipelineStack/Prod5/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod5/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod5/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod5/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json deleted file mode 100644 index 13dcd2725fa4f..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813": { - "source": { - "path": "PipelineStackProd6Stack1E7C34314.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json deleted file mode 100644 index d6be13b8891c1..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30": { - "source": { - "path": "PipelineStackProd6Stack2BED1BBCE.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/cdk.out b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/manifest.json deleted file mode 100644 index 5cfa186f47d6a..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/assembly-PipelineStack-Prod6/manifest.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackProd6Stack1E7C34314.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd6Stack1E7C34314.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd6Stack1E7C34314": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd6Stack1E7C34314.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/26d311d19506235a52c5d093cf5a8360110af6a2b713beda66b33ba3ee5bd813.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd6Stack1E7C34314.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod6-Stack1" - }, - "dependencies": [ - "PipelineStackProd6Stack1E7C34314.assets" - ], - "metadata": { - "/PipelineStack/Prod6/Stack1/Queue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Queue4A7E3555" - } - ], - "/PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": [ - { - "type": "aws:cdk:logicalId", - "data": "ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - } - ], - "/PipelineStack/Prod6/Stack1/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod6/Stack1/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod6/Stack1" - }, - "PipelineStackProd6Stack2BED1BBCE.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackProd6Stack2BED1BBCE.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackProd6Stack2BED1BBCE": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackProd6Stack2BED1BBCE.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8f3e16ae3f29a4a50d4ef13026a3bc879e039d80e9fffdefe19d40349ec6bb30.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackProd6Stack2BED1BBCE.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "Prod6-Stack2" - }, - "dependencies": [ - "PipelineStackProd6Stack1E7C34314", - "PipelineStackProd6Stack2BED1BBCE.assets" - ], - "metadata": { - "/PipelineStack/Prod6/Stack2/OtherQueue/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "OtherQueue60B686DC" - } - ], - "/PipelineStack/Prod6/Stack2/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/Prod6/Stack2/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/Prod6/Stack2" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/integ.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/integ.json deleted file mode 100644 index de89e5deeb511..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/integ.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "30.1.0", - "testCases": { - "integ.newpipeline": { - "stacks": [ - "PipelineStack" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": { - "@aws-cdk/core:newStyleStackSynthesis": "true" - }, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/manifest.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/manifest.json deleted file mode 100644 index c411f0567fa8f..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/manifest.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "assembly-PipelineStack-Beta": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Beta", - "displayName": "PipelineStack/Beta" - } - }, - "assembly-PipelineStack-Prod1": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod1", - "displayName": "PipelineStack/Prod1" - } - }, - "assembly-PipelineStack-Prod2": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod2", - "displayName": "PipelineStack/Prod2" - } - }, - "assembly-PipelineStack-Prod3": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod3", - "displayName": "PipelineStack/Prod3" - } - }, - "assembly-PipelineStack-Prod4": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod4", - "displayName": "PipelineStack/Prod4" - } - }, - "assembly-PipelineStack-Prod5": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod5", - "displayName": "PipelineStack/Prod5" - } - }, - "assembly-PipelineStack-Prod6": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-Prod6", - "displayName": "PipelineStack/Prod6" - } - }, - "PipelineStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStack.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1dbba360a5b410c5ef982afe56c9c77ea414e1a4d6c00e51a2bc3810237fc17a.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "PipelineStack.assets" - ], - "metadata": { - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketAEA9A052" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketPolicyF53CCC52" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleB27FAA37" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleDefaultPolicy7BDC1ABB" - } - ], - "/PipelineStack/Pipeline/Pipeline/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Pipeline9850B417" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/rix0rrr_cdk-pipelines-demo/WebhookResource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourcerix0rrrcdkpipelinesdemoWebhookResourceDB0C1BCA" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ], - "/PipelineStack/Pipeline/CodeBuildActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineCodeBuildActionRole226DB0CB" - } - ], - "/PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ], - "/PipelineStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/tree.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/tree.json deleted file mode 100644 index 53a8f24be58ea..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.js.snapshot/tree.json +++ /dev/null @@ -1,3958 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "PipelineStack": { - "id": "PipelineStack", - "path": "PipelineStack", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline/Pipeline", - "children": { - "ArtifactsBucket": { - "id": "ArtifactsBucket", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "aws:kms" - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "stages": [ - { - "name": "Source", - "actions": [ - { - "name": "rix0rrr_cdk-pipelines-demo", - "outputArtifacts": [ - { - "name": "rix0rrr_cdk_pipelines_demo_Source" - } - ], - "actionTypeId": { - "category": "Source", - "version": "1", - "owner": "ThirdParty", - "provider": "GitHub" - }, - "configuration": { - "Owner": "rix0rrr", - "Repo": "cdk-pipelines-demo", - "Branch": "main", - "OAuthToken": "{{resolve:secretsmanager:github-token:SecretString:::}}", - "PollForSourceChanges": false - }, - "runOrder": 1 - } - ] - }, - { - "name": "Build", - "actions": [ - { - "name": "Synth", - "inputArtifacts": [ - { - "name": "rix0rrr_cdk_pipelines_demo_Source" - } - ], - "outputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"09deb76d97fe89f2ccd364ad1eedc7ebc7c010be6bf79da68c34f358446cd134\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "UpdatePipeline", - "actions": [ - { - "name": "SelfMutate", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"ceff66d3191e2ca3ec1a2711dae97a4541cbf7254c7dcca9acf21e0d12ce37a2\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineCodeBuildActionRole226DB0CB", - "Arn" - ] - } - } - ] - }, - { - "name": "Beta", - "actions": [ - { - "name": "Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Beta/PipelineStackBetaStack2C79AD00A.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Beta-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - }, - { - "name": "Wave1", - "actions": [ - { - "name": "Prod1.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack14013D698.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack1FD464162.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod1.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod1.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod1/PipelineStackProd1Stack2F0681AFF.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod2/PipelineStackProd2Stack2176123EB.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod1.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod1-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod2.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod2-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - }, - { - "name": "Wave2", - "actions": [ - { - "name": "Prod3.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack1795F3D43.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack118F74ADB.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack1E7E4E4C6.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack1.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack1", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack1E7C34314.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod3.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack1.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack1", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod3.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod3/PipelineStackProd3Stack2DFBBA0B2.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod4/PipelineStackProd4Stack2E2CB4ED3.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod5/PipelineStackProd5Stack2C39BEE5B.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack2.Prepare", - "inputArtifacts": [ - { - "name": "Synth_Output" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack2", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "Synth_Output::assembly-PipelineStack-Prod6/PipelineStackProd6Stack2BED1BBCE.template.json" - }, - "runOrder": 3, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod3.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod3-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod4.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod4-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod5.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod5-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Prod6.Stack2.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "Prod6-Stack2", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 4, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - } - ], - "artifactStore": { - "type": "S3", - "location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - } - }, - "restartExecutionOnUpdate": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnPipeline", - "version": "0.0.0" - } - }, - "Source": { - "id": "Source", - "path": "PipelineStack/Pipeline/Pipeline/Source", - "children": { - "rix0rrr_cdk-pipelines-demo": { - "id": "rix0rrr_cdk-pipelines-demo", - "path": "PipelineStack/Pipeline/Pipeline/Source/rix0rrr_cdk-pipelines-demo", - "children": { - "WebhookResource": { - "id": "WebhookResource", - "path": "PipelineStack/Pipeline/Pipeline/Source/rix0rrr_cdk-pipelines-demo/WebhookResource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Webhook", - "aws:cdk:cloudformation:props": { - "authentication": "GITHUB_HMAC", - "authenticationConfiguration": { - "secretToken": "{{resolve:secretsmanager:github-token:SecretString:::}}" - }, - "filters": [ - { - "jsonPath": "$.ref", - "matchEquals": "refs/heads/{Branch}" - } - ], - "targetAction": "rix0rrr_cdk-pipelines-demo", - "targetPipeline": { - "Ref": "Pipeline9850B417" - }, - "targetPipelineVersion": 1, - "registerWithThirdParty": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnWebhook", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Build": { - "id": "Build", - "path": "PipelineStack/Pipeline/Pipeline/Build", - "children": { - "Synth": { - "id": "Synth", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", - "children": { - "CdkBuildProject": { - "id": "CdkBuildProject", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/Build/Synth", - "encryptionKey": "alias/aws/s3" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", - "children": { - "SelfMutate": { - "id": "SelfMutate", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Beta": { - "id": "Beta", - "path": "PipelineStack/Pipeline/Pipeline/Beta", - "children": { - "Stack1.Prepare": { - "id": "Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack1.Deploy": { - "id": "Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2.Prepare": { - "id": "Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2.Deploy": { - "id": "Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Beta/Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "children": { - "8389e75f-0810-4838-bf64-d6f85a95cf83": { - "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/Pipeline/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Wave1": { - "id": "Wave1", - "path": "PipelineStack/Pipeline/Pipeline/Wave1", - "children": { - "Prod1.Stack1.Prepare": { - "id": "Prod1.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack1.Prepare": { - "id": "Prod2.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1.Stack1.Deploy": { - "id": "Prod1.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack1.Deploy": { - "id": "Prod2.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1.Stack2.Prepare": { - "id": "Prod1.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack2.Prepare": { - "id": "Prod2.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1.Stack2.Deploy": { - "id": "Prod1.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod1.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2.Stack2.Deploy": { - "id": "Prod2.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave1/Prod2.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Wave2": { - "id": "Wave2", - "path": "PipelineStack/Pipeline/Pipeline/Wave2", - "children": { - "Prod3.Stack1.Prepare": { - "id": "Prod3.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack1.Prepare": { - "id": "Prod4.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack1.Prepare": { - "id": "Prod5.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack1.Prepare": { - "id": "Prod6.Stack1.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3.Stack1.Deploy": { - "id": "Prod3.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack1.Deploy": { - "id": "Prod4.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack1.Deploy": { - "id": "Prod5.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack1.Deploy": { - "id": "Prod6.Stack1.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack1.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3.Stack2.Prepare": { - "id": "Prod3.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack2.Prepare": { - "id": "Prod4.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack2.Prepare": { - "id": "Prod5.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack2.Prepare": { - "id": "Prod6.Stack2.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3.Stack2.Deploy": { - "id": "Prod3.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod3.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4.Stack2.Deploy": { - "id": "Prod4.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod4.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5.Stack2.Deploy": { - "id": "Prod5.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod5.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6.Stack2.Deploy": { - "id": "Prod6.Stack2.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/Wave2/Prod6.Stack2.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.Pipeline", - "version": "0.0.0" - } - }, - "CodeBuildActionRole": { - "id": "CodeBuildActionRole", - "path": "PipelineStack/Pipeline/CodeBuildActionRole", - "children": { - "ImportCodeBuildActionRole": { - "id": "ImportCodeBuildActionRole", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/ImportCodeBuildActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Condition": { - "Bool": { - "aws:ViaAWSService": "codepipeline.amazonaws.com" - } - }, - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/CodeBuildActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineCodeBuildActionRoleDefaultPolicy1D62A6FE", - "roles": [ - { - "Ref": "PipelineCodeBuildActionRole226DB0CB" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/UpdatePipeline", - "children": { - "SelfMutation": { - "id": "SelfMutation", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "description": "Pipeline step PipelineStack/Pipeline/UpdatePipeline/SelfMutate", - "encryptionKey": "alias/aws/s3" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CodePipeline", - "version": "0.0.0" - } - }, - "Beta": { - "id": "Beta", - "path": "PipelineStack/Beta", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Beta/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Beta/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Beta/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Beta/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Beta/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Beta/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Beta/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Beta/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Beta/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Beta/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Beta-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Beta/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Beta/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod1": { - "id": "Prod1", - "path": "PipelineStack/Prod1", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod1/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod1/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod1/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod1/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod1/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod1/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod1/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod1/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod1/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod1/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod1-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod1/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod1/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod2": { - "id": "Prod2", - "path": "PipelineStack/Prod2", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod2/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod2/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod2/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod2/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod2/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod2/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod2/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod2/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod2/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod2/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod2-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod2/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod2/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod3": { - "id": "Prod3", - "path": "PipelineStack/Prod3", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod3/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod3/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod3/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod3/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod3/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod3/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod3/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod3/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod3/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod3/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod3-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod3/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod3/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod4": { - "id": "Prod4", - "path": "PipelineStack/Prod4", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod4/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod4/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod4/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod4/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod4/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod4/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod4/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod4/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod4/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod4/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod4-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod4/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod4/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod5": { - "id": "Prod5", - "path": "PipelineStack/Prod5", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod5/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod5/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod5/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod5/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod5/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod5/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod5/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod5/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod5/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod5/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod5-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod5/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod5/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Prod6": { - "id": "Prod6", - "path": "PipelineStack/Prod6", - "children": { - "Stack1": { - "id": "Stack1", - "path": "PipelineStack/Prod6/Stack1", - "children": { - "Queue": { - "id": "Queue", - "path": "PipelineStack/Prod6/Stack1/Queue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod6/Stack1/Queue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": {} - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "Exports": { - "id": "Exports", - "path": "PipelineStack/Prod6/Stack1/Exports", - "children": { - "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}": { - "id": "Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "path": "PipelineStack/Prod6/Stack1/Exports/Output{\"Fn::GetAtt\":[\"Queue4A7E3555\",\"Arn\"]}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod6/Stack1/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod6/Stack1/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack2": { - "id": "Stack2", - "path": "PipelineStack/Prod6/Stack2", - "children": { - "OtherQueue": { - "id": "OtherQueue", - "path": "PipelineStack/Prod6/Stack2/OtherQueue", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Prod6/Stack2/OtherQueue/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::SQS::Queue", - "aws:cdk:cloudformation:props": { - "redrivePolicy": { - "deadLetterTargetArn": { - "Fn::ImportValue": "Prod6-Stack1:ExportsOutputFnGetAttQueue4A7E3555Arn15A7202E" - }, - "maxReceiveCount": 5 - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.CfnQueue", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-sqs.Queue", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/Prod6/Stack2/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/Prod6/Stack2/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-DisableSecurityCheck/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-EnableSecurityCheck/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-NoSecurityCheck/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-PreProduction/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SafeProduction/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/assembly-PipelineSecurityStack-SingleStage/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js deleted file mode 100644 index bf260b9069cd1..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sdUJBQXVCLEdBQUcsNkJBQTZCLENBQUM7QUFFOUQsTUFBTSxFQUFFLEdBQUcsSUFBSSxZQUFFLEVBQUUsQ0FBQztBQUViLEtBQUssVUFBVSxPQUFP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SkucHJvbWlzZSgpO1xuICByZXR1cm4gcmVzcG9uc2UuVGFnU2V0LnNvbWUodGFnID0+IHRhZy5LZXkgPT09IEFVVE9fREVMRVRFX09CSkVDVFNfVEFHICYmIHRhZy5WYWx1ZSA9PT0gJ3RydWUnKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.d.ts b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.d.ts deleted file mode 100644 index cfb478c2f9b1a..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function handler(event: any, _context: any): Promise; diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.js deleted file mode 100644 index d815e7bc859b4..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const AWS = require("aws-sdk"); -const client = new AWS.CodePipeline({ apiVersion: '2015-07-09' }); -const TIMEOUT_IN_MINUTES = 5; -const sleep = (seconds) => { - return new Promise(resolve => setTimeout(resolve, seconds * 1000)); -}; -async function handler(event, _context) { - const { PipelineName: pipelineName, StageName: stageName, ActionName: actionName, } = event; - function parseState(response) { - const stages = response.stageStates; - const validStages = stages?.filter((s) => s.stageName === stageName); - const manualApproval = validStages.length && - validStages[0].actionStates.filter((state) => state.actionName === actionName); - const latest = manualApproval && manualApproval.length && - manualApproval[0].latestExecution; - return latest ? latest.token : undefined; - } - const deadline = Date.now() + TIMEOUT_IN_MINUTES * 60000; - while (Date.now() < deadline) { - const response = await client.getPipelineState({ name: pipelineName }).promise(); - const token = parseState(response); - if (token) { - await client.putApprovalResult({ - pipelineName, - actionName, - stageName, - result: { - summary: 'No security changes detected. Automatically approved by Lambda.', - status: 'Approved', - }, - token, - }).promise(); - return; - } - await sleep(5); - } -} -exports.handler = handler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QsK0JBQStCO0FBRS9CLE1BQU0sTUFBTSxHQUFHLElBQUksR0FBRyxDQUFDLFlBQVksQ0FBQyxFQUFFLFVBQVUsRUFBRSxZQUFZLEVBQUUsQ0FBQyxDQUFDO0FBQ2xFLE1BQU0sa0JBQWtCLEdBQUcsQ0FBQyxDQUFDO0FBRTdCLE1BQU0sS0FBSyxHQUFHLENBQUMsT0FBZSxFQUFFLEVBQUU7SUFDaEMsT0FBTyxJQUFJLE9BQU8sQ0FBTyxPQUFPLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxPQUFPLEVBQUUsT0FBTyxHQUFHLElBQUksQ0FBQyxDQUFDLENBQUM7QUFDM0UsQ0FBQyxDQUFDO0FBRUssS0FBSyxVQUFVLE9BQU8sQ0FBQyxLQUFVLEVBQUUsUUFBYTtJQUNyRCxNQUFNLEVBQ0osWUFBWSxFQUFFLFlBQVksRUFDMUIsU0FBUyxFQUFFLFNBQVMsRUFDcEIsVUFBV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mVzdWx0OiB7XG4gICAgICAgICAgc3VtbWFyeTogJ05vIHNlY3VyaXR5IGNoYW5nZXMgZGV0ZWN0ZWQuIEF1dG9tYXRpY2FsbHkgYXBwcm92ZWQgYnkgTGFtYmRhLicsXG4gICAgICAgICAgc3RhdHVzOiAnQXBwcm92ZWQnLFxuICAgICAgICB9LFxuICAgICAgICB0b2tlbixcbiAgICAgIH0pLnByb21pc2UoKTtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgYXdhaXQgc2xlZXAoNSk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.assets.json deleted file mode 100644 index a3e1cc195769d..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c": { - "source": { - "path": "asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "538477f3553442356779ff4d69d1dbd33b6253cd1beff5f14489eef90dbc13ab": { - "source": { - "path": "PipelineStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "538477f3553442356779ff4d69d1dbd33b6253cd1beff5f14489eef90dbc13ab.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.template.json deleted file mode 100644 index f82b0ab32ebf9..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/PipelineStack.template.json +++ /dev/null @@ -1,2015 +0,0 @@ -{ - "Resources": { - "SourceBucketDDD2130A": { - "Type": "AWS::S3::Bucket", - "Properties": { - "Tags": [ - { - "Key": "aws-cdk:auto-delete-objects", - "Value": "true" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "SourceBucketPolicy703DFBF9": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "SourceBucketAutoDeleteObjectsCustomResourceC68FC040": { - "Type": "Custom::S3AutoDeleteObjects", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", - "Arn" - ] - }, - "BucketName": { - "Ref": "SourceBucketDDD2130A" - } - }, - "DependsOn": [ - "SourceBucketPolicy703DFBF9" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ] - } - }, - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c.zip" - }, - "Timeout": 900, - "MemorySize": 128, - "Handler": "__entrypoint__.handler", - "Role": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - }, - "Runtime": "nodejs14.x", - "Description": { - "Fn::Join": [ - "", - [ - "Lambda function for auto-deleting objects in ", - { - "Ref": "SourceBucketDDD2130A" - }, - " S3 bucket." - ] - ] - } - }, - "DependsOn": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" - ] - }, - "PipelineArtifactsBucketEncryptionKeyF5BF0670": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { - "Type": "AWS::KMS::Alias", - "Properties": { - "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "TargetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketAEA9A052": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "KMSMasterKeyID": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "SSEAlgorithm": "aws:kms" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "PipelineArtifactsBucketPolicyF53CCC52": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleB27FAA37": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleDefaultPolicy7BDC1ABB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "Roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "Pipeline9850B417": { - "Type": "AWS::CodePipeline::Pipeline", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "Stages": [ - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Source", - "Owner": "AWS", - "Provider": "S3", - "Version": "1" - }, - "Configuration": { - "S3Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "S3ObjectKey": "key" - }, - "Name": "S3", - "OutputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Source" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" - }, - "InputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "Name": "Synth", - "OutputArtifacts": [ - { - "Name": "CloudAsm" - }, - { - "Name": "IntegTests" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Build" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "SelfMutate", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "UpdatePipeline" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset5D8C5DA6" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "FileAsset", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Assets" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - }, - "InputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "Name": "UseSource", - "RoleArn": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - "RunOrder": 100 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "PreProd-Stack", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "Stack.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "PreProd-Stack", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - } - ], - "Name": "PreProd" - } - ], - "ArtifactStore": { - "EncryptionKey": { - "Id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Type": "KMS" - }, - "Location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "Type": "S3" - }, - "RestartExecutionOnUpdate": true - }, - "DependsOn": [ - "PipelineRoleDefaultPolicy7BDC1ABB", - "PipelineRoleB27FAA37" - ] - }, - "PipelineSourceS3CodePipelineActionRole83895A58": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/key" - ] - ] - } - ] - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", - "Roles": [ - { - "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ] - } - }, - "PipelineBuildSynthCodePipelineActionRole4E7A6C97": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", - "Roles": [ - { - "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProject6BEFA8E6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "EnvironmentVariables": [ - { - "Name": "NPM_CONFIG_UNSAFE_PERM", - "Type": "PLAINTEXT", - "Value": "true" - } - ], - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Name": "MyServicePipeline-synth" - } - }, - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ] - } - }, - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProject2E711EB4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", - "Roles": [ - { - "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ] - } - }, - "PipelinePreProdUseSourceProjectRole69B20A71": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", - "Roles": [ - { - "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ] - } - }, - "PipelinePreProdUseSourceProject2E711EB4": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProjectRole69B20A71", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineUpdatePipelineSelfMutationRole57E559E8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationDAA41400": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineAssetsFileRole59943A77": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - }, - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineAssetsFileRoleDefaultPolicy14DB8755": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": { - "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", - "Roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "PipelineAssetsFileAsset5D8C5DA6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "Source": { - "BuildSpec": "buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json deleted file mode 100644 index 5427209c670c6..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5": { - "source": { - "path": "../asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e": { - "source": { - "path": "../asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4": { - "source": { - "path": "PipelineStackPreProdStack65A0AD1F.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/manifest.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/manifest.json deleted file mode 100644 index d9e7f37233989..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/assembly-PipelineStack-PreProd/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackPreProdStack65A0AD1F.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackPreProdStack65A0AD1F.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackPreProdStack65A0AD1F": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackPreProdStack65A0AD1F.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackPreProdStack65A0AD1F.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "PreProd-Stack" - }, - "dependencies": [ - "PipelineStackPreProdStack65A0AD1F.assets" - ], - "metadata": { - "/PipelineStack/PreProd/Stack/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Resource" - } - ], - "/PipelineStack/PreProd/Stack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/PreProd/Stack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/PreProd/Stack" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/integ.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/integ.json deleted file mode 100644 index c31b2b8e31726..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/integ.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "30.1.0", - "testCases": { - "integ.pipeline-with-assets-single-upload": { - "stacks": [ - "PipelineStack" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": { - "@aws-cdk/core:newStyleStackSynthesis": "true" - }, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/manifest.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/manifest.json deleted file mode 100644 index 4f5e4c4d535f3..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/manifest.json +++ /dev/null @@ -1,257 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "assembly-PipelineStack-PreProd": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-PreProd", - "displayName": "PipelineStack/PreProd" - } - }, - "PipelineStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStack.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/538477f3553442356779ff4d69d1dbd33b6253cd1beff5f14489eef90dbc13ab.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "PipelineStack.assets" - ], - "metadata": { - "/PipelineStack/SourceBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketDDD2130A" - } - ], - "/PipelineStack/SourceBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketPolicy703DFBF9" - } - ], - "/PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketAutoDeleteObjectsCustomResourceC68FC040" - } - ], - "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" - } - ], - "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketAEA9A052" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketPolicyF53CCC52" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleB27FAA37" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleDefaultPolicy7BDC1ABB" - } - ], - "/PipelineStack/Pipeline/Pipeline/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Pipeline9850B417" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ], - "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ], - "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProject2E711EB4" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ], - "/PipelineStack/Pipeline/Assets/FileRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileRole59943A77" - } - ], - "/PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileRoleDefaultPolicy14DB8755" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset/Default/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset5D8C5DA6" - } - ], - "/PipelineStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/tree.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/tree.json deleted file mode 100644 index 82927154c2361..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.js.snapshot/tree.json +++ /dev/null @@ -1,2883 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "PipelineStack": { - "id": "PipelineStack", - "path": "PipelineStack", - "children": { - "SourceBucket": { - "id": "SourceBucket", - "path": "PipelineStack/SourceBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/SourceBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "aws-cdk:auto-delete-objects", - "value": "true" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/SourceBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/SourceBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - }, - "AutoDeleteObjectsCustomResource": { - "id": "AutoDeleteObjectsCustomResource", - "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource", - "children": { - "Default": { - "id": "Default", - "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Custom::S3AutoDeleteObjectsCustomResourceProvider": { - "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider", - "children": { - "Staging": { - "id": "Staging", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Handler": { - "id": "Handler", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline/Pipeline", - "children": { - "ArtifactsBucketEncryptionKey": { - "id": "ArtifactsBucketEncryptionKey", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Key", - "aws:cdk:cloudformation:props": { - "keyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnKey", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Key", - "version": "0.0.0" - } - }, - "ArtifactsBucketEncryptionKeyAlias": { - "id": "ArtifactsBucketEncryptionKeyAlias", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Alias", - "aws:cdk:cloudformation:props": { - "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "targetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnAlias", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Alias", - "version": "0.0.0" - } - }, - "ArtifactsBucket": { - "id": "ArtifactsBucket", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "aws:kms", - "kmsMasterKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "stages": [ - { - "name": "Source", - "actions": [ - { - "name": "S3", - "outputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "actionTypeId": { - "category": "Source", - "version": "1", - "owner": "AWS", - "provider": "S3" - }, - "configuration": { - "S3Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "S3ObjectKey": "key" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - } - } - ] - }, - { - "name": "Build", - "actions": [ - { - "name": "Synth", - "inputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "outputArtifacts": [ - { - "name": "CloudAsm" - }, - { - "name": "IntegTests" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - } - } - ] - }, - { - "name": "UpdatePipeline", - "actions": [ - { - "name": "SelfMutate", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - } - } - ] - }, - { - "name": "Assets", - "actions": [ - { - "name": "FileAsset", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset5D8C5DA6" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - } - } - ] - }, - { - "name": "PreProd", - "actions": [ - { - "name": "UseSource", - "inputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - }, - "runOrder": 100, - "roleArn": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - } - }, - { - "name": "Stack.Prepare", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "PreProd-Stack", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "PreProd-Stack", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - } - ], - "artifactStore": { - "type": "S3", - "location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "encryptionKey": { - "type": "KMS", - "id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "restartExecutionOnUpdate": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnPipeline", - "version": "0.0.0" - } - }, - "Source": { - "id": "Source", - "path": "PipelineStack/Pipeline/Pipeline/Source", - "children": { - "S3": { - "id": "S3", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/key" - ] - ] - } - ] - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", - "roles": [ - { - "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Build": { - "id": "Build", - "path": "PipelineStack/Pipeline/Pipeline/Build", - "children": { - "Synth": { - "id": "Synth", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", - "roles": [ - { - "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "CdkBuildProject": { - "id": "CdkBuildProject", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL", - "environmentVariables": [ - { - "name": "NPM_CONFIG_UNSAFE_PERM", - "type": "PLAINTEXT", - "value": "true" - } - ] - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "name": "MyServicePipeline-synth" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", - "children": { - "SelfMutate": { - "id": "SelfMutate", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/Pipeline/Pipeline/PreProd", - "children": { - "UseSource": { - "id": "UseSource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProject2E711EB4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", - "roles": [ - { - "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Project": { - "id": "Project", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", - "roles": [ - { - "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProjectRole69B20A71", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack.Deploy": { - "id": "Stack.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack.Prepare": { - "id": "Stack.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Pipeline/Assets", - "children": { - "FileAsset": { - "id": "FileAsset", - "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.Pipeline", - "version": "0.0.0" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/UpdatePipeline", - "children": { - "SelfMutation": { - "id": "SelfMutation", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.UpdatePipelineAction", - "version": "0.0.0" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Assets", - "children": { - "FileRole": { - "id": "FileRole", - "path": "PipelineStack/Pipeline/Assets/FileRole", - "children": { - "ImportFileRole": { - "id": "ImportFileRole", - "path": "PipelineStack/Pipeline/Assets/FileRole/ImportFileRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - }, - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": { - "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", - "roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "FileAsset": { - "id": "FileAsset", - "path": "PipelineStack/Pipeline/Assets/FileAsset", - "children": { - "Default": { - "id": "Default", - "path": "PipelineStack/Pipeline/Assets/FileAsset/Default", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset/Default/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.PublishAssetsAction", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/Pipeline/PreProd", - "children": { - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "children": { - "8389e75f-0810-4838-bf64-d6f85a95cf83": { - "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CdkStage", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CdkPipeline", - "version": "0.0.0" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/PreProd", - "children": { - "Stack": { - "id": "Stack", - "path": "PipelineStack/PreProd/Stack", - "children": { - "Asset": { - "id": "Asset", - "path": "PipelineStack/PreProd/Stack/Asset", - "children": { - "Stage": { - "id": "Stage", - "path": "PipelineStack/PreProd/Stack/Asset/Stage", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "PipelineStack/PreProd/Stack/Asset/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Asset2": { - "id": "Asset2", - "path": "PipelineStack/PreProd/Stack/Asset2", - "children": { - "Stage": { - "id": "Stage", - "path": "PipelineStack/PreProd/Stack/Asset2/Stage", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "PipelineStack/PreProd/Stack/Asset2/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/PreProd/Stack/Resource", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/PreProd/Stack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/PreProd/Stack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.assets.json deleted file mode 100644 index b935903d9e3a1..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c": { - "source": { - "path": "asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "7758d639fbbb2fdd63b99e118fe3a2fe5cdcc221dad29e055e10301c4b5b0452": { - "source": { - "path": "PipelineStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7758d639fbbb2fdd63b99e118fe3a2fe5cdcc221dad29e055e10301c4b5b0452.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.template.json deleted file mode 100644 index 15851e1dc3152..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/PipelineStack.template.json +++ /dev/null @@ -1,2076 +0,0 @@ -{ - "Resources": { - "SourceBucketDDD2130A": { - "Type": "AWS::S3::Bucket", - "Properties": { - "Tags": [ - { - "Key": "aws-cdk:auto-delete-objects", - "Value": "true" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "SourceBucketPolicy703DFBF9": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "SourceBucketAutoDeleteObjectsCustomResourceC68FC040": { - "Type": "Custom::S3AutoDeleteObjects", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", - "Arn" - ] - }, - "BucketName": { - "Ref": "SourceBucketDDD2130A" - } - }, - "DependsOn": [ - "SourceBucketPolicy703DFBF9" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ] - } - }, - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c.zip" - }, - "Timeout": 900, - "MemorySize": 128, - "Handler": "__entrypoint__.handler", - "Role": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - }, - "Runtime": "nodejs14.x", - "Description": { - "Fn::Join": [ - "", - [ - "Lambda function for auto-deleting objects in ", - { - "Ref": "SourceBucketDDD2130A" - }, - " S3 bucket." - ] - ] - } - }, - "DependsOn": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" - ] - }, - "PipelineArtifactsBucketEncryptionKeyF5BF0670": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { - "Type": "AWS::KMS::Alias", - "Properties": { - "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "TargetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketAEA9A052": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "KMSMasterKeyID": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "SSEAlgorithm": "aws:kms" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "PipelineArtifactsBucketPolicyF53CCC52": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleB27FAA37": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleDefaultPolicy7BDC1ABB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "Roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "Pipeline9850B417": { - "Type": "AWS::CodePipeline::Pipeline", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "Stages": [ - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Source", - "Owner": "AWS", - "Provider": "S3", - "Version": "1" - }, - "Configuration": { - "S3Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "S3ObjectKey": "key" - }, - "Name": "S3", - "OutputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Source" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" - }, - "InputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "Name": "Synth", - "OutputArtifacts": [ - { - "Name": "CloudAsm" - }, - { - "Name": "IntegTests" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Build" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "SelfMutate", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "UpdatePipeline" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset185A67CB4" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "FileAsset1", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset24D2D639B" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "FileAsset2", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Assets" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - }, - "InputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "Name": "UseSource", - "RoleArn": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - "RunOrder": 100 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "PreProd-Stack", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "Stack.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "PreProd-Stack", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - } - ], - "Name": "PreProd" - } - ], - "ArtifactStore": { - "EncryptionKey": { - "Id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Type": "KMS" - }, - "Location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "Type": "S3" - }, - "RestartExecutionOnUpdate": true - }, - "DependsOn": [ - "PipelineRoleDefaultPolicy7BDC1ABB", - "PipelineRoleB27FAA37" - ] - }, - "PipelineSourceS3CodePipelineActionRole83895A58": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/key" - ] - ] - } - ] - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", - "Roles": [ - { - "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ] - } - }, - "PipelineBuildSynthCodePipelineActionRole4E7A6C97": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", - "Roles": [ - { - "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProject6BEFA8E6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "EnvironmentVariables": [ - { - "Name": "NPM_CONFIG_UNSAFE_PERM", - "Type": "PLAINTEXT", - "Value": "true" - } - ], - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Name": "MyServicePipeline-synth" - } - }, - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ] - } - }, - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProject2E711EB4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", - "Roles": [ - { - "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ] - } - }, - "PipelinePreProdUseSourceProjectRole69B20A71": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", - "Roles": [ - { - "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ] - } - }, - "PipelinePreProdUseSourceProject2E711EB4": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProjectRole69B20A71", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineUpdatePipelineSelfMutationRole57E559E8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationDAA41400": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineAssetsFileRole59943A77": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - }, - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineAssetsFileRoleDefaultPolicy14DB8755": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": { - "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", - "Roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "PipelineAssetsFileAsset185A67CB4": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineAssetsFileAsset24D2D639B": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json deleted file mode 100644 index 5427209c670c6..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5": { - "source": { - "path": "../asset.8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5.txt", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e": { - "source": { - "path": "../asset.ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e.txt", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4": { - "source": { - "path": "PipelineStackPreProdStack65A0AD1F.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/manifest.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/manifest.json deleted file mode 100644 index d9e7f37233989..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/assembly-PipelineStack-PreProd/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackPreProdStack65A0AD1F.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackPreProdStack65A0AD1F.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackPreProdStack65A0AD1F": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackPreProdStack65A0AD1F.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackPreProdStack65A0AD1F.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "PreProd-Stack" - }, - "dependencies": [ - "PipelineStackPreProdStack65A0AD1F.assets" - ], - "metadata": { - "/PipelineStack/PreProd/Stack/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Resource" - } - ], - "/PipelineStack/PreProd/Stack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/PreProd/Stack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/PreProd/Stack" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js deleted file mode 100644 index 7ce4156d4ba41..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sdUJBQXVCLEdBQUcsNkJBQTZCLENBQUM7QUFFOUQsTUFBTSxFQUFFLEdBQUcsSUFBSSxZQUFFLEVBQUUsQ0FBQztBQUViLEtBQUssVUFBVSxPQUFPLENBQUMsS0FBa0Q7SUFDOUUsUUFBUSxLQUFLLENBQUMsV0FBVyxFQUFFO1FBQ3pCLEtBQUssUUFBUTtZQUNYLE9BQU87UUFDVCxLQUFLLFFBQVE7WUFDWCxPQUFPLFFBQVEsQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUN6QixLQUFLLFFBQVE7WUFDWCxPQUFPLFFBQVEsQ0FBQyxLQUFLLENBQUMsa0JBQWtCLEVBQUUsVUFBVSxDQUFDLENBQUM7S0FDekQ7QUFDSCxDQUFDO0FBVEQsMEJBU0M7QUFFRCxLQUFLLFVBQVUsUUFBUSxDQUFDLEtBQWtEO0lBQ3hFLE1BQU0sV0FBVyxHQUFHLEtBQTBELENBQUM7SUFDL0UsTUFBTSxhQUFhLEdBQUcsV0FBVyxDQUFDLHFCQUFxQixFQUFFLFVBQVUsQ0FBQztJQUNwRSxNQUFNLGFBQWEsR0FBRyxXQUFXLENBQUMsa0JBQWtCLEVBQUUsVUFBVSxDQUFDO0lBQ2pFLE1BQU0sb0JBQW9CLEdBQUcsYUFBYSxJQUFJLElBQUksSUFBSSxhQUFhLElBQUksSUFBSSxJQUFJLGFBQWEsS0FBSyxhQUFhLENBQUM7SUFFL0c7O3NEQU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V0LCBpdCBtdXN0IGJlIGJlY2F1c2VcbiAqIGBhdXRvRGVsZXRlT2JqZWN0c2AgaGFzIGJlZW4gc3dpdGNoZWQgdG8gZmFsc2UsIGluIHdoaWNoIGNhc2UgdGhlIHRhZyB3b3VsZCBoYXZlXG4gKiBiZWVuIHJlbW92ZWQgYmVmb3JlIHdlIGdldCB0byB0aGlzIERlbGV0ZSBldmVudC5cbiAqL1xuYXN5bmMgZnVuY3Rpb24gaXNCdWNrZXRUYWdnZWRGb3JEZWxldGlvbihidWNrZXROYW1lOiBzdHJpbmcpIHtcbiAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBzMy5nZXRCdWNrZXRUYWdnaW5nKHsgQnVja2V0OiBidWNrZXROYW1lIH0pLnByb21pc2UoKTtcbiAgcmV0dXJuIHJlc3BvbnNlLlRhZ1NldC5zb21lKHRhZyA9PiB0YWcuS2V5ID09PSBBVVRPX0RFTEVURV9PQkpFQ1RTX1RBRyAmJiB0YWcuVmFsdWUgPT09ICd0cnVlJyk7XG59Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/integ.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/integ.json deleted file mode 100644 index 11be3e8d0b439..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/integ.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "30.1.0", - "testCases": { - "integ.pipeline-with-assets": { - "stacks": [ - "PipelineStack" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": { - "@aws-cdk/core:newStyleStackSynthesis": "true" - }, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/manifest.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/manifest.json deleted file mode 100644 index 6c72e242b57d7..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/manifest.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "assembly-PipelineStack-PreProd": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-PreProd", - "displayName": "PipelineStack/PreProd" - } - }, - "PipelineStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStack.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7758d639fbbb2fdd63b99e118fe3a2fe5cdcc221dad29e055e10301c4b5b0452.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "PipelineStack.assets" - ], - "metadata": { - "/PipelineStack/SourceBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketDDD2130A" - } - ], - "/PipelineStack/SourceBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketPolicy703DFBF9" - } - ], - "/PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketAutoDeleteObjectsCustomResourceC68FC040" - } - ], - "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" - } - ], - "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketAEA9A052" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketPolicyF53CCC52" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleB27FAA37" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleDefaultPolicy7BDC1ABB" - } - ], - "/PipelineStack/Pipeline/Pipeline/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Pipeline9850B417" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ], - "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ], - "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProject2E711EB4" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ], - "/PipelineStack/Pipeline/Assets/FileRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileRole59943A77" - } - ], - "/PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileRoleDefaultPolicy14DB8755" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset1/Default/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset185A67CB4" - } - ], - "/PipelineStack/Pipeline/Assets/FileAsset2/Default/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineAssetsFileAsset24D2D639B" - } - ], - "/PipelineStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/tree.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/tree.json deleted file mode 100644 index 7ae475f236e76..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.js.snapshot/tree.json +++ /dev/null @@ -1,2980 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "PipelineStack": { - "id": "PipelineStack", - "path": "PipelineStack", - "children": { - "SourceBucket": { - "id": "SourceBucket", - "path": "PipelineStack/SourceBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/SourceBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "aws-cdk:auto-delete-objects", - "value": "true" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/SourceBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/SourceBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - }, - "AutoDeleteObjectsCustomResource": { - "id": "AutoDeleteObjectsCustomResource", - "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource", - "children": { - "Default": { - "id": "Default", - "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Custom::S3AutoDeleteObjectsCustomResourceProvider": { - "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider", - "children": { - "Staging": { - "id": "Staging", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Handler": { - "id": "Handler", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline/Pipeline", - "children": { - "ArtifactsBucketEncryptionKey": { - "id": "ArtifactsBucketEncryptionKey", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Key", - "aws:cdk:cloudformation:props": { - "keyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnKey", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Key", - "version": "0.0.0" - } - }, - "ArtifactsBucketEncryptionKeyAlias": { - "id": "ArtifactsBucketEncryptionKeyAlias", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Alias", - "aws:cdk:cloudformation:props": { - "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "targetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnAlias", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Alias", - "version": "0.0.0" - } - }, - "ArtifactsBucket": { - "id": "ArtifactsBucket", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "aws:kms", - "kmsMasterKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "stages": [ - { - "name": "Source", - "actions": [ - { - "name": "S3", - "outputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "actionTypeId": { - "category": "Source", - "version": "1", - "owner": "AWS", - "provider": "S3" - }, - "configuration": { - "S3Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "S3ObjectKey": "key" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - } - } - ] - }, - { - "name": "Build", - "actions": [ - { - "name": "Synth", - "inputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "outputArtifacts": [ - { - "name": "CloudAsm" - }, - { - "name": "IntegTests" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - } - } - ] - }, - { - "name": "UpdatePipeline", - "actions": [ - { - "name": "SelfMutate", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - } - } - ] - }, - { - "name": "Assets", - "actions": [ - { - "name": "FileAsset1", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset185A67CB4" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - } - }, - { - "name": "FileAsset2", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineAssetsFileAsset24D2D639B" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - } - } - ] - }, - { - "name": "PreProd", - "actions": [ - { - "name": "UseSource", - "inputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - }, - "runOrder": 100, - "roleArn": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - } - }, - { - "name": "Stack.Prepare", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "PreProd-Stack", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "PreProd-Stack", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - } - ], - "artifactStore": { - "type": "S3", - "location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "encryptionKey": { - "type": "KMS", - "id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "restartExecutionOnUpdate": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnPipeline", - "version": "0.0.0" - } - }, - "Source": { - "id": "Source", - "path": "PipelineStack/Pipeline/Pipeline/Source", - "children": { - "S3": { - "id": "S3", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/key" - ] - ] - } - ] - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", - "roles": [ - { - "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Build": { - "id": "Build", - "path": "PipelineStack/Pipeline/Pipeline/Build", - "children": { - "Synth": { - "id": "Synth", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", - "roles": [ - { - "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "CdkBuildProject": { - "id": "CdkBuildProject", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL", - "environmentVariables": [ - { - "name": "NPM_CONFIG_UNSAFE_PERM", - "type": "PLAINTEXT", - "value": "true" - } - ] - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "name": "MyServicePipeline-synth" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", - "children": { - "SelfMutate": { - "id": "SelfMutate", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/Pipeline/Pipeline/PreProd", - "children": { - "UseSource": { - "id": "UseSource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProject2E711EB4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", - "roles": [ - { - "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Project": { - "id": "Project", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", - "roles": [ - { - "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProjectRole69B20A71", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack.Deploy": { - "id": "Stack.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack.Prepare": { - "id": "Stack.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Pipeline/Assets", - "children": { - "FileAsset1": { - "id": "FileAsset1", - "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset1", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "FileAsset2": { - "id": "FileAsset2", - "path": "PipelineStack/Pipeline/Pipeline/Assets/FileAsset2", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.Pipeline", - "version": "0.0.0" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/UpdatePipeline", - "children": { - "SelfMutation": { - "id": "SelfMutation", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.UpdatePipelineAction", - "version": "0.0.0" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Assets", - "children": { - "FileRole": { - "id": "FileRole", - "path": "PipelineStack/Pipeline/Assets/FileRole", - "children": { - "ImportFileRole": { - "id": "ImportFileRole", - "path": "PipelineStack/Pipeline/Assets/FileRole/ImportFileRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - }, - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/*" - ] - ] - } - }, - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": { - "Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineAssetsFileRoleDefaultPolicy14DB8755", - "roles": [ - { - "Ref": "PipelineAssetsFileRole59943A77" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "FileAsset1": { - "id": "FileAsset1", - "path": "PipelineStack/Pipeline/Assets/FileAsset1", - "children": { - "Default": { - "id": "Default", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/Default", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset1/Default/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.PublishAssetsAction", - "version": "0.0.0" - } - }, - "FileAsset2": { - "id": "FileAsset2", - "path": "PipelineStack/Pipeline/Assets/FileAsset2", - "children": { - "Default": { - "id": "Default", - "path": "PipelineStack/Pipeline/Assets/FileAsset2/Default", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Assets/FileAsset2/Default/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineAssetsFileRole59943A77", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.PublishAssetsAction", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/Pipeline/PreProd", - "children": { - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "children": { - "8389e75f-0810-4838-bf64-d6f85a95cf83": { - "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CdkStage", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CdkPipeline", - "version": "0.0.0" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/PreProd", - "children": { - "Stack": { - "id": "Stack", - "path": "PipelineStack/PreProd/Stack", - "children": { - "Asset": { - "id": "Asset", - "path": "PipelineStack/PreProd/Stack/Asset", - "children": { - "Stage": { - "id": "Stage", - "path": "PipelineStack/PreProd/Stack/Asset/Stage", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "PipelineStack/PreProd/Stack/Asset/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Asset2": { - "id": "Asset2", - "path": "PipelineStack/PreProd/Stack/Asset2", - "children": { - "Stage": { - "id": "Stage", - "path": "PipelineStack/PreProd/Stack/Asset2/Stage", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "PipelineStack/PreProd/Stack/Asset2/AssetBucket", - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketBase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3-assets.Asset", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/PreProd/Stack/Resource", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/PreProd/Stack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/PreProd/Stack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/assembly-StackOutputPipelineStack-AppStage/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-stack-outputs-in-custom-step.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js deleted file mode 100644 index 1e3a3093c1706..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.withRetries = exports.handler = exports.external = void 0; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - const sanitizedEvent = { ...event, ResponseURL: '...' }; - exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(sanitizedEvent, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -exports.handler = handler; -function renderResponse(cfnRequest, handlerResponse = {}) { - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - const json = { - Status: status, - Reason: event.Reason ?? status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - exports.external.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - const retryOptions = { - attempts: 5, - sleep: 1000, - }; - await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); -} -async function defaultSendHttpRequest(options, responseBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, _ => resolve()); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -function withRetries(options, fn) { - return async (...xs) => { - let attempts = options.attempts; - let ms = options.sleep; - while (true) { - try { - return await fn(...xs); - } - catch (e) { - if (attempts-- <= 0) { - throw e; - } - await sleep(Math.floor(Math.random() * ms)); - ms *= 2; - } - } - }; -} -exports.withRetries = withRetries; -async function sleep(ms) { - return new Promise((ok) => setTimeout(ok, ms)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJub2RlanMtZW50cnlwb2ludC50cyJdLCJuYW1lcyI6W10sIm1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3YWl0IHNsZWVwKE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG1zKSk7XG4gICAgICAgIG1zICo9IDI7XG4gICAgICB9XG4gICAgfVxuICB9O1xufVxuXG5hc3luYyBmdW5jdGlvbiBzbGVlcChtczogbnVtYmVyKTogUHJvbWlzZTx2b2lkPiB7XG4gIHJldHVybiBuZXcgUHJvbWlzZSgob2spID0+IHNldFRpbWVvdXQob2ssIG1zKSk7XG59Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js deleted file mode 100644 index bf260b9069cd1..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sdUJBQXVCLEdBQUcsNkJBQTZCLENBQUM7QUFFOUQsTUFBTSxFQUFFLEdBQUcsSUFBSSxZQUFFLEVBQUUsQ0FBQztBQUViLEtBQUssVUFBVSxPQUFPLENBQUMsS0FBa0Q7SUFDOUUsUUFBUSxL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cG9uc2UuVGFnU2V0LnNvbWUodGFnID0+IHRhZy5LZXkgPT09IEFVVE9fREVMRVRFX09CSkVDVFNfVEFHICYmIHRhZy5WYWx1ZSA9PT0gJ3RydWUnKTtcbn1cbiJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-variables.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/assembly-PreparelessPipelineStack-MyStage-Stack-MyApp/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/assembly-PreparelessPipelineStack-MyStage/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js deleted file mode 100644 index 1e3a3093c1706..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.withRetries = exports.handler = exports.external = void 0; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - const sanitizedEvent = { ...event, ResponseURL: '...' }; - exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(sanitizedEvent, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -exports.handler = handler; -function renderResponse(cfnRequest, handlerResponse = {}) { - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - const json = { - Status: status, - Reason: event.Reason ?? status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - exports.external.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - const retryOptions = { - attempts: 5, - sleep: 1000, - }; - await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); -} -async function defaultSendHttpRequest(options, responseBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, _ => resolve()); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -function withRetries(options, fn) { - return async (...xs) => { - let attempts = options.attempts; - let ms = options.sleep; - while (true) { - try { - return await fn(...xs); - } - catch (e) { - if (attempts-- <= 0) { - throw e; - } - await sleep(Math.floor(Math.random() * ms)); - ms *= 2; - } - } - }; -} -exports.withRetries = withRetries; -async function sleep(ms) { - return new Promise((ok) => setTimeout(ok, ms)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJub2RlanMtZW50cnlwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBRTNCLGlCQUFpQjtBQUNKLFFBQUEsUUFBUSxHQUFHO0lBQ3RCLGVBQWUsRUFBRSxzQkFBc0I7SUFDdkMsR0FBRyxFQUFFLFVBQVU7SUFDZixrQkFBa0IsRUFBRSxJQUFJO0lBQ3hCLGdCQUFnQixFQUFFLFNBQVM7Q0FDNUIsQ0FBQztBQUVGLE1BQU0sZ0NBQWdDLEdBQUcsd0RBQXdELENBQUM7QUFDbEcsTUFBTSwwQkFBMEIsR0FBRyw4REFBOEQsQ0FBQztBQVczRixLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQWtELEVBQUUsT0FBMEI7SUFDMUcsTUFBTSxjQUFjLEdBQUcsRUFBRSxHQUFHLEtBQUssRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLENBQUM7SUFDeEQsZ0JBQVEsQ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qKiBTbGVlcCBiYXNlLCBpbiBtcyAqL1xuICByZWFkb25seSBzbGVlcDogbnVtYmVyO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gd2l0aFJldHJpZXM8QSBleHRlbmRzIEFycmF5PGFueT4sIEI+KG9wdGlvbnM6IFJldHJ5T3B0aW9ucywgZm46ICguLi54czogQSkgPT4gUHJvbWlzZTxCPik6ICguLi54czogQSkgPT4gUHJvbWlzZTxCPiB7XG4gIHJldHVybiBhc3luYyAoLi4ueHM6IEEpID0+IHtcbiAgICBsZXQgYXR0ZW1wdHMgPSBvcHRpb25zLmF0dGVtcHRzO1xuICAgIGxldCBtcyA9IG9wdGlvbnMuc2xlZXA7XG4gICAgd2hpbGUgKHRydWUpIHtcbiAgICAgIHRyeSB7XG4gICAgICAgIHJldHVybiBhd2FpdCBmbiguLi54cyk7XG4gICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgIGlmIChhdHRlbXB0cy0tIDw9IDApIHtcbiAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHNsZWVwKE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG1zKSk7XG4gICAgICAgIG1zICo9IDI7XG4gICAgICB9XG4gICAgfVxuICB9O1xufVxuXG5hc3luYyBmdW5jdGlvbiBzbGVlcChtczogbnVtYmVyKTogUHJvbWlzZTx2b2lkPiB7XG4gIHJldHVybiBuZXcgUHJvbWlzZSgob2spID0+IHNldFRpbWVvdXQob2ssIG1zKSk7XG59Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js deleted file mode 100644 index 7ce4156d4ba41..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2REFBNkQ7QUFDN0QscUNBQTZCO0FBRTdCLE1BQU0sdUJBQXVCLEdBQUcsNkJBQTZCLENBQUM7QUFFOUQsTUFBTSxFQUFFLEdBQUcsSUFBSSxZQUFFLEVBQUUsQ0FBQztBQUViLEtBQUssVUFBVSxPQUFPLENBQUMsS0FBa0Q7SUFDOUUsUUFBUSxLQUFLLENBQUMsV0FBVyxFQUFFO1FBQ3pCLEtBQUssUUFBUTtZQUNYLE9BQU87UUFDVCxLQUFLLFFBQVE7WUFDWCxPQUFPLFFBQVEsQ0FBQyxLQUFLLENBQUMsQ0FBQztRQUN6QixLQUFLLFFBQVE7WUFDWCxPQUFPLFFBQVEsQ0FBQyxLQUFLLENBQUMsa0JBQWtCLEVBQUUsVUFBVSxDQUFDLENBQUM7S0FDekQ7QUFDSCxDQUFDO0FBVEQsMEJBU0M7QUFFRCxLQUFLLFVBQVUsUUFBUSxDQUFDLEtBQWtEO0lBQ3hFLE1BQU0sV0FBVyxHQUFHLEtBQTBELENBQUM7SUFDL0UsTUFBTSxhQUFhLEdBQUcsV0FBVyxDQUFDLHFCQUFxQixFQUFFLFVBQVUsQ0FBQztJQUNwRSxNQUFNLGFBQWEsR0FBRyxXQUFXLENBQUMsa0JBQWtCLEVBQUUsVUFBVSx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IGRlcGxveW1lbnQgYXMgdGhpcyBDdXN0b20gUmVzb3VyY2UuXG4gKlxuICogSWYgdGhlIEN1c3RvbSBSZXNvdXJjZSBpcyBldmVyeSBkZWxldGVkIGJlZm9yZSB0aGUgYnVja2V0LCBpdCBtdXN0IGJlIGJlY2F1c2VcbiAqIGBhdXRvRGVsZXRlT2JqZWN0c2AgaGFzIGJlZW4gc3dpdGNoZWQgdG8gZmFsc2UsIGluIHdoaWNoIGNhc2UgdGhlIHRhZyB3b3VsZCBoYXZlXG4gKiBiZWVuIHJlbW92ZWQgYmVmb3JlIHdlIGdldCB0byB0aGlzIERlbGV0ZSBldmVudC5cbiAqL1xuYXN5bmMgZnVuY3Rpb24gaXNCdWNrZXRUYWdnZWRGb3JEZWxldGlvbihidWNrZXROYW1lOiBzdHJpbmcpIHtcbiAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBzMy5nZXRCdWNrZXRUYWdnaW5nKHsgQnVja2V0OiBidWNrZXROYW1lIH0pLnByb21pc2UoKTtcbiAgcmV0dXJuIHJlc3BvbnNlLlRhZ1NldC5zb21lKHRhZyA9PiB0YWcuS2V5ID09PSBBVVRPX0RFTEVURV9PQkpFQ1RTX1RBRyAmJiB0YWcuVmFsdWUgPT09ICd0cnVlJyk7XG59Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-without-prepare.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.assets.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.assets.json deleted file mode 100644 index 312a9a61b3c38..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c": { - "source": { - "path": "asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "9db3ef838ddb1d8f88bb13aa5b5d39ca2487da80e7bf530cf6fc7f929814129a": { - "source": { - "path": "PipelineStack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9db3ef838ddb1d8f88bb13aa5b5d39ca2487da80e7bf530cf6fc7f929814129a.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.template.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.template.json deleted file mode 100644 index 98ea3867ef32e..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/PipelineStack.template.json +++ /dev/null @@ -1,1777 +0,0 @@ -{ - "Resources": { - "SourceBucketDDD2130A": { - "Type": "AWS::S3::Bucket", - "Properties": { - "Tags": [ - { - "Key": "aws-cdk:auto-delete-objects", - "Value": "true" - } - ] - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "SourceBucketPolicy703DFBF9": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "SourceBucketAutoDeleteObjectsCustomResourceC68FC040": { - "Type": "Custom::S3AutoDeleteObjects", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", - "Arn" - ] - }, - "BucketName": { - "Ref": "SourceBucketDDD2130A" - } - }, - "DependsOn": [ - "SourceBucketPolicy703DFBF9" - ], - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ] - } - }, - "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c.zip" - }, - "Timeout": 900, - "MemorySize": 128, - "Handler": "__entrypoint__.handler", - "Role": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - }, - "Runtime": "nodejs14.x", - "Description": { - "Fn::Join": [ - "", - [ - "Lambda function for auto-deleting objects in ", - { - "Ref": "SourceBucketDDD2130A" - }, - " S3 bucket." - ] - ] - } - }, - "DependsOn": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" - ] - }, - "PipelineArtifactsBucketEncryptionKeyF5BF0670": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketEncryptionKeyAlias94A07392": { - "Type": "AWS::KMS::Alias", - "Properties": { - "AliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "TargetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "PipelineArtifactsBucketAEA9A052": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "KMSMasterKeyID": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "SSEAlgorithm": "aws:kms" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "PipelineArtifactsBucketPolicyF53CCC52": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleB27FAA37": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineRoleDefaultPolicy7BDC1ABB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "Roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "Pipeline9850B417": { - "Type": "AWS::CodePipeline::Pipeline", - "Properties": { - "RoleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "Stages": [ - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Source", - "Owner": "AWS", - "Provider": "S3", - "Version": "1" - }, - "Configuration": { - "S3Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "S3ObjectKey": "key" - }, - "Name": "S3", - "OutputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Source" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" - }, - "InputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "Name": "Synth", - "OutputArtifacts": [ - { - "Name": "CloudAsm" - }, - { - "Name": "IntegTests" - } - ], - "RoleArn": { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "Build" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "SelfMutate", - "RoleArn": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - "RunOrder": 1 - } - ], - "Name": "UpdatePipeline" - }, - { - "Actions": [ - { - "ActionTypeId": { - "Category": "Build", - "Owner": "AWS", - "Provider": "CodeBuild", - "Version": "1" - }, - "Configuration": { - "ProjectName": { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - }, - "InputArtifacts": [ - { - "Name": "Artifact_Source_S3" - } - ], - "Name": "UseSource", - "RoleArn": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - "RunOrder": 100 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "PreProd-Stack", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" - }, - "InputArtifacts": [ - { - "Name": "CloudAsm" - } - ], - "Name": "Stack.Prepare", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 1 - }, - { - "ActionTypeId": { - "Category": "Deploy", - "Owner": "AWS", - "Provider": "CloudFormation", - "Version": "1" - }, - "Configuration": { - "StackName": "PreProd-Stack", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "Name": "Stack.Deploy", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "RunOrder": 2 - } - ], - "Name": "PreProd" - } - ], - "ArtifactStore": { - "EncryptionKey": { - "Id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Type": "KMS" - }, - "Location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "Type": "S3" - }, - "RestartExecutionOnUpdate": true - }, - "DependsOn": [ - "PipelineRoleDefaultPolicy7BDC1ABB", - "PipelineRoleB27FAA37" - ] - }, - "PipelineSourceS3CodePipelineActionRole83895A58": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/key" - ] - ] - } - ] - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", - "Roles": [ - { - "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ] - } - }, - "PipelineBuildSynthCodePipelineActionRole4E7A6C97": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", - "Roles": [ - { - "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProjectRole231EEA2A": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "Roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "PipelineBuildSynthCdkBuildProject6BEFA8E6": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "EnvironmentVariables": [ - { - "Name": "NPM_CONFIG_UNSAFE_PERM", - "Type": "PLAINTEXT", - "Value": "true" - } - ], - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "Name": "MyServicePipeline-synth" - } - }, - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ] - } - }, - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProject2E711EB4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", - "Roles": [ - { - "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ] - } - }, - "PipelinePreProdUseSourceProjectRole69B20A71": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", - "Roles": [ - { - "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ] - } - }, - "PipelinePreProdUseSourceProject2E711EB4": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProjectRole69B20A71", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "PipelineUpdatePipelineSelfMutationRole57E559E8": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "Roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "PipelineUpdatePipelineSelfMutationDAA41400": { - "Type": "AWS::CodeBuild::Project", - "Properties": { - "Artifacts": { - "Type": "CODEPIPELINE" - }, - "Environment": { - "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:6.0", - "ImagePullCredentialsType": "CODEBUILD", - "PrivilegedMode": false, - "Type": "LINUX_CONTAINER" - }, - "ServiceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "Source": { - "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", - "Type": "CODEPIPELINE" - }, - "Cache": { - "Type": "NO_CACHE" - }, - "EncryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - }, - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json deleted file mode 100644 index 4bfa80d900909..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "30.1.0", - "files": { - "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4": { - "source": { - "path": "PipelineStackPreProdStack65A0AD1F.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/manifest.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/manifest.json deleted file mode 100644 index d9e7f37233989..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/assembly-PipelineStack-PreProd/manifest.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "PipelineStackPreProdStack65A0AD1F.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStackPreProdStack65A0AD1F.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStackPreProdStack65A0AD1F": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStackPreProdStack65A0AD1F.template.json", - "validateOnSynth": true, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/17b50ab4e61e5c19d1e2d14ccc136d8c1ae3b77a4236035ac6ac6273619764a4.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStackPreProdStack65A0AD1F.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - }, - "stackName": "PreProd-Stack" - }, - "dependencies": [ - "PipelineStackPreProdStack65A0AD1F.assets" - ], - "metadata": { - "/PipelineStack/PreProd/Stack/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Resource" - } - ], - "/PipelineStack/PreProd/Stack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/PreProd/Stack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack/PreProd/Stack" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js deleted file mode 100644 index 1e3a3093c1706..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/__entrypoint__.js +++ /dev/null @@ -1,144 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.withRetries = exports.handler = exports.external = void 0; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - const sanitizedEvent = { ...event, ResponseURL: '...' }; - exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(sanitizedEvent, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -exports.handler = handler; -function renderResponse(cfnRequest, handlerResponse = {}) { - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - const json = { - Status: status, - Reason: event.Reason ?? status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - exports.external.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { 'content-type': '', 'content-length': responseBody.length }, - }; - const retryOptions = { - attempts: 5, - sleep: 1000, - }; - await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); -} -async function defaultSendHttpRequest(options, responseBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, _ => resolve()); - request.on('error', reject); - request.write(responseBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -function withRetries(options, fn) { - return async (...xs) => { - let attempts = options.attempts; - let ms = options.sleep; - while (true) { - try { - return await fn(...xs); - } - catch (e) { - if (attempts-- <= 0) { - throw e; - } - await sleep(Math.floor(Math.random() * ms)); - ms *= 2; - } - } - }; -} -exports.withRetries = withRetries; -async function sleep(ms) { - return new Promise((ok) => setTimeout(ok, ms)); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZWpzLWVudHJ5cG9pbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJub2RlanMtZW50cnlwb2ludC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBRTNCLGlCQUFpQjtBQUNKLFFBQUEsUUFBUSxHQUFHO0lBQ3RCLGVBQWUsRUFBRSxzQkFBc0I7SUFDdkMsR0FBRyxFQUFFLFVBQVU7SUFDZixrQkFBa0IsRUFBRSxJQUFJO0lBQ3hCLGdCQUFnQixFQUFFLFNBQVM7Q0FDNUIsQ0FBQztBQUVGLE1BQU0sZ0NBQWdDLEdBQUcsd0RBQXdELENBQUM7QUFDbEcsTUFBTSwwQkFBMEIsR0FBRyw4REFBOEQsQ0FBQztBQVczRixLQUFLLFVBQVUsT0FBTyxDQUFDLEtBQWtELEVBQUUsT0FBMEI7SUFDMUcsTUFBTSxjQUFjLEdBQUcsRUFBRSxHQUFHLEtBQUssRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLENBQUM7SUFDeEQsZ0JBQVEsQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxjQUFjLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFFM0QsdUVBQXVFO0lBQ3ZFLHVFQUF1RTtJQUN2RSxhQUFhO0lBQ2IsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsSUFBSSxLQUFLLENBQUMsa0JBQWtCLEtBQUssZ0NBQWdDLEVBQUU7UUFDbkcsZ0JBQVEsQ0FBQyxHQUFHLENBQUMsdURBQXVELENB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gPSBvcHRpb25zLmF0dGVtcHRzO1xuICAgIGxldCBtcyA9IG9wdGlvbnMuc2xlZXA7XG4gICAgd2hpbGUgKHRydWUpIHtcbiAgICAgIHRyeSB7XG4gICAgICAgIHJldHVybiBhd2FpdCBmbiguLi54cyk7XG4gICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgIGlmIChhdHRlbXB0cy0tIDw9IDApIHtcbiAgICAgICAgICB0aHJvdyBlO1xuICAgICAgICB9XG4gICAgICAgIGF3YWl0IHNsZWVwKE1hdGguZmxvb3IoTWF0aC5yYW5kb20oKSAqIG1zKSk7XG4gICAgICAgIG1zICo9IDI7XG4gICAgICB9XG4gICAgfVxuICB9O1xufVxuXG5hc3luYyBmdW5jdGlvbiBzbGVlcChtczogbnVtYmVyKTogUHJvbWlzZTx2b2lkPiB7XG4gIHJldHVybiBuZXcgUHJvbWlzZSgob2spID0+IHNldFRpbWVvdXQob2ssIG1zKSk7XG59Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js deleted file mode 100644 index 7ce4156d4ba41..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/asset.33e2651435a0d472a75c1e033c9832b21321d9e56711926b04c5705e5f63874c/index.js +++ /dev/null @@ -1,78 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.handler = void 0; -// eslint-disable-next-line import/no-extraneous-dependencies -const aws_sdk_1 = require("aws-sdk"); -const AUTO_DELETE_OBJECTS_TAG = 'aws-cdk:auto-delete-objects'; -const s3 = new aws_sdk_1.S3(); -async function handler(event) { - switch (event.RequestType) { - case 'Create': - return; - case 'Update': - return onUpdate(event); - case 'Delete': - return onDelete(event.ResourceProperties?.BucketName); - } -} -exports.handler = handler; -async function onUpdate(event) { - const updateEvent = event; - const oldBucketName = updateEvent.OldResourceProperties?.BucketName; - const newBucketName = updateEvent.ResourceProperties?.BucketName; - const bucketNameHasChanged = newBucketName != null && oldBucketName != null && newBucketName !== oldBucketName; - /* If the name of the bucket has changed, CloudFormation will try to delete the bucket - and create a new one with the new name. So we have to delete the contents of the - bucket so that this operation does not fail. */ - if (bucketNameHasChanged) { - return onDelete(oldBucketName); - } -} -/** - * Recursively delete all items in the bucket - * - * @param bucketName the bucket name - */ -async function emptyBucket(bucketName) { - const listedObjects = await s3.listObjectVersions({ Bucket: bucketName }).promise(); - const contents = [...listedObjects.Versions ?? [], ...listedObjects.DeleteMarkers ?? []]; - if (contents.length === 0) { - return; - } - const records = contents.map((record) => ({ Key: record.Key, VersionId: record.VersionId })); - await s3.deleteObjects({ Bucket: bucketName, Delete: { Objects: records } }).promise(); - if (listedObjects?.IsTruncated) { - await emptyBucket(bucketName); - } -} -async function onDelete(bucketName) { - if (!bucketName) { - throw new Error('No BucketName was provided.'); - } - if (!await isBucketTaggedForDeletion(bucketName)) { - process.stdout.write(`Bucket does not have '${AUTO_DELETE_OBJECTS_TAG}' tag, skipping cleaning.\n`); - return; - } - try { - await emptyBucket(bucketName); - } - catch (e) { - if (e.code !== 'NoSuchBucket') { - throw e; - } - // Bucket doesn't exist. Ignoring - } -} -/** - * The bucket will only be tagged for deletion if it's being deleted in the same - * deployment as this Custom Resource. - * - * If the Custom Resource is every deleted before the bucket, it must be because - * `autoDeleteObjects` has been switched to false, in which case the tag would have - * been removed before we get to this Delete event. - */ -async function isBucketTaggedForDeletion(bucketName) { - const response = await s3.getBucketTagging({ Bucket: bucketName }).promise(); - return response.TagSet.some(tag => tag.Key === AUTO_DELETE_OBJECTS_TAG && tag.Value === 'true'); -} -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc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B0aGlzIERlbGV0ZSBldmVudC5cbiAqL1xuYXN5bmMgZnVuY3Rpb24gaXNCdWNrZXRUYWdnZWRGb3JEZWxldGlvbihidWNrZXROYW1lOiBzdHJpbmcpIHtcbiAgY29uc3QgcmVzcG9uc2UgPSBhd2FpdCBzMy5nZXRCdWNrZXRUYWdnaW5nKHsgQnVja2V0OiBidWNrZXROYW1lIH0pLnByb21pc2UoKTtcbiAgcmV0dXJuIHJlc3BvbnNlLlRhZ1NldC5zb21lKHRhZyA9PiB0YWcuS2V5ID09PSBBVVRPX0RFTEVURV9PQkpFQ1RTX1RBRyAmJiB0YWcuVmFsdWUgPT09ICd0cnVlJyk7XG59Il19 \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/cdk.out b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/cdk.out deleted file mode 100644 index b72fef144f05c..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"30.1.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/integ.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/integ.json deleted file mode 100644 index 9f1875f665de7..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/integ.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "30.1.0", - "testCases": { - "integ.pipeline": { - "stacks": [ - "PipelineStack" - ], - "diffAssets": false, - "stackUpdateWorkflow": true - } - }, - "synthContext": { - "@aws-cdk/core:newStyleStackSynthesis": "true" - }, - "enableLookups": false -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/manifest.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/manifest.json deleted file mode 100644 index 5eb71bc8ed82b..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/manifest.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "version": "30.1.0", - "artifacts": { - "assembly-PipelineStack-PreProd": { - "type": "cdk:cloud-assembly", - "properties": { - "directoryName": "assembly-PipelineStack-PreProd", - "displayName": "PipelineStack/PreProd" - } - }, - "PipelineStack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "PipelineStack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "PipelineStack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "PipelineStack.template.json", - "validateOnSynth": false, - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9db3ef838ddb1d8f88bb13aa5b5d39ca2487da80e7bf530cf6fc7f929814129a.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "PipelineStack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "PipelineStack.assets" - ], - "metadata": { - "/PipelineStack/SourceBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketDDD2130A" - } - ], - "/PipelineStack/SourceBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketPolicy703DFBF9" - } - ], - "/PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "SourceBucketAutoDeleteObjectsCustomResourceC68FC040" - } - ], - "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" - } - ], - "/PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyF5BF0670" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketEncryptionKeyAlias94A07392" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketAEA9A052" - } - ], - "/PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineArtifactsBucketPolicyF53CCC52" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleB27FAA37" - } - ], - "/PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineRoleDefaultPolicy7BDC1ABB" - } - ], - "/PipelineStack/Pipeline/Pipeline/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "Pipeline9850B417" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ], - "/PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C" - } - ], - "/PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ], - "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ], - "/PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3" - } - ], - "/PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelinePreProdUseSourceProject2E711EB4" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E" - } - ], - "/PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ], - "/PipelineStack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/PipelineStack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "PipelineStack" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/tree.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/tree.json deleted file mode 100644 index 427bbf6007cad..0000000000000 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.js.snapshot/tree.json +++ /dev/null @@ -1,2501 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "PipelineStack": { - "id": "PipelineStack", - "path": "PipelineStack", - "children": { - "SourceBucket": { - "id": "SourceBucket", - "path": "PipelineStack/SourceBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/SourceBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "aws-cdk:auto-delete-objects", - "value": "true" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/SourceBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/SourceBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::GetAtt": [ - "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", - "Arn" - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - }, - "AutoDeleteObjectsCustomResource": { - "id": "AutoDeleteObjectsCustomResource", - "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource", - "children": { - "Default": { - "id": "Default", - "path": "PipelineStack/SourceBucket/AutoDeleteObjectsCustomResource/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Custom::S3AutoDeleteObjectsCustomResourceProvider": { - "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider", - "children": { - "Staging": { - "id": "Staging", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Handler": { - "id": "Handler", - "path": "PipelineStack/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline", - "children": { - "Pipeline": { - "id": "Pipeline", - "path": "PipelineStack/Pipeline/Pipeline", - "children": { - "ArtifactsBucketEncryptionKey": { - "id": "ArtifactsBucketEncryptionKey", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKey/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Key", - "aws:cdk:cloudformation:props": { - "keyPolicy": { - "Statement": [ - { - "Action": "kms:*", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnKey", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Key", - "version": "0.0.0" - } - }, - "ArtifactsBucketEncryptionKeyAlias": { - "id": "ArtifactsBucketEncryptionKeyAlias", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucketEncryptionKeyAlias/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::KMS::Alias", - "aws:cdk:cloudformation:props": { - "aliasName": "alias/codepipeline-pipelinestack-pipeline-e95eedaa", - "targetKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.CfnAlias", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-kms.Alias", - "version": "0.0.0" - } - }, - "ArtifactsBucket": { - "id": "ArtifactsBucket", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "aws:kms", - "kmsMasterKeyId": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucket", - "version": "0.0.0" - } - }, - "Policy": { - "id": "Policy", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/ArtifactsBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.CfnBucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.BucketPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-s3.Bucket", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codepipeline.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - }, - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - }, - { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineRoleDefaultPolicy7BDC1ABB", - "roles": [ - { - "Ref": "PipelineRoleB27FAA37" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodePipeline::Pipeline", - "aws:cdk:cloudformation:props": { - "roleArn": { - "Fn::GetAtt": [ - "PipelineRoleB27FAA37", - "Arn" - ] - }, - "stages": [ - { - "name": "Source", - "actions": [ - { - "name": "S3", - "outputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "actionTypeId": { - "category": "Source", - "version": "1", - "owner": "AWS", - "provider": "S3" - }, - "configuration": { - "S3Bucket": { - "Ref": "SourceBucketDDD2130A" - }, - "S3ObjectKey": "key" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineSourceS3CodePipelineActionRole83895A58", - "Arn" - ] - } - } - ] - }, - { - "name": "Build", - "actions": [ - { - "name": "Synth", - "inputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "outputArtifacts": [ - { - "name": "CloudAsm" - }, - { - "name": "IntegTests" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "EnvironmentVariables": "[{\"name\":\"_PROJECT_CONFIG_HASH\",\"type\":\"PLAINTEXT\",\"value\":\"51983b0b2e2ab480fd5d90c068e63373d8f0ab1a3a1da93ac53a82b8a296d34f\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineBuildSynthCodePipelineActionRole4E7A6C97", - "Arn" - ] - } - } - ] - }, - { - "name": "UpdatePipeline", - "actions": [ - { - "name": "SelfMutate", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "EnvironmentVariables": "[{\"name\":\"CDK_CLI_VERSION\",\"type\":\"PLAINTEXT\",\"value\":\"1\"}]" - }, - "runOrder": 1, - "roleArn": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF", - "Arn" - ] - } - } - ] - }, - { - "name": "PreProd", - "actions": [ - { - "name": "UseSource", - "inputArtifacts": [ - { - "name": "Artifact_Source_S3" - } - ], - "actionTypeId": { - "category": "Build", - "version": "1", - "owner": "AWS", - "provider": "CodeBuild" - }, - "configuration": { - "ProjectName": { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - }, - "runOrder": 100, - "roleArn": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA", - "Arn" - ] - } - }, - { - "name": "Stack.Prepare", - "inputArtifacts": [ - { - "name": "CloudAsm" - } - ], - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "PreProd-Stack", - "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND", - "RoleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-cfn-exec-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - }, - "ActionMode": "CHANGE_SET_REPLACE", - "ChangeSetName": "PipelineChange", - "TemplatePath": "CloudAsm::assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.template.json" - }, - "runOrder": 1, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - }, - { - "name": "Stack.Deploy", - "actionTypeId": { - "category": "Deploy", - "version": "1", - "owner": "AWS", - "provider": "CloudFormation" - }, - "configuration": { - "StackName": "PreProd-Stack", - "ActionMode": "CHANGE_SET_EXECUTE", - "ChangeSetName": "PipelineChange" - }, - "runOrder": 2, - "roleArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/cdk-hnb659fds-deploy-role-", - { - "Ref": "AWS::AccountId" - }, - "-", - { - "Ref": "AWS::Region" - } - ] - ] - } - } - ] - } - ], - "artifactStore": { - "type": "S3", - "location": { - "Ref": "PipelineArtifactsBucketAEA9A052" - }, - "encryptionKey": { - "type": "KMS", - "id": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "restartExecutionOnUpdate": true - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.CfnPipeline", - "version": "0.0.0" - } - }, - "Source": { - "id": "Source", - "path": "PipelineStack/Pipeline/Pipeline/Source", - "children": { - "S3": { - "id": "S3", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Source/S3/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "SourceBucketDDD2130A", - "Arn" - ] - }, - "/key" - ] - ] - } - ] - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineSourceS3CodePipelineActionRoleDefaultPolicyB176A07F", - "roles": [ - { - "Ref": "PipelineSourceS3CodePipelineActionRole83895A58" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Build": { - "id": "Build", - "path": "PipelineStack/Pipeline/Pipeline/Build", - "children": { - "Synth": { - "id": "Synth", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProject6BEFA8E6", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCodePipelineActionRoleDefaultPolicy92C90290", - "roles": [ - { - "Ref": "PipelineBuildSynthCodePipelineActionRole4E7A6C97" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "CdkBuildProject": { - "id": "CdkBuildProject", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineBuildSynthCdkBuildProject6BEFA8E6" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineBuildSynthCdkBuildProjectRoleDefaultPolicyFB6C941C", - "roles": [ - { - "Ref": "PipelineBuildSynthCdkBuildProjectRole231EEA2A" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/Build/Synth/CdkBuildProject/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL", - "environmentVariables": [ - { - "name": "NPM_CONFIG_UNSAFE_PERM", - "type": "PLAINTEXT", - "value": "true" - } - ] - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineBuildSynthCdkBuildProjectRole231EEA2A", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - }, - "name": "MyServicePipeline-synth" - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline", - "children": { - "SelfMutate": { - "id": "SelfMutate", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/UpdatePipeline/SelfMutate/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationDAA41400", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleDefaultPolicyE626265B", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutateCodePipelineActionRoleD6D4E5CF" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/Pipeline/Pipeline/PreProd", - "children": { - "UseSource": { - "id": "UseSource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource", - "children": { - "CodePipelineActionRole": { - "id": "CodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole", - "children": { - "ImportCodePipelineActionRole": { - "id": "ImportCodePipelineActionRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/ImportCodePipelineActionRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/CodePipelineActionRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "codebuild:BatchGetBuilds", - "codebuild:StartBuild", - "codebuild:StopBuild" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProject2E711EB4", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelinePreProdUseSourceCodePipelineActionRoleDefaultPolicy9BE325AD", - "roles": [ - { - "Ref": "PipelinePreProdUseSourceCodePipelineActionRoleA2043BDA" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Project": { - "id": "Project", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelinePreProdUseSourceProject2E711EB4" - }, - "-*" - ] - ] - } - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelinePreProdUseSourceProjectRoleDefaultPolicy50F68DF3", - "roles": [ - { - "Ref": "PipelinePreProdUseSourceProjectRole69B20A71" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/UseSource/Project/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelinePreProdUseSourceProjectRole69B20A71", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack.Deploy": { - "id": "Stack.Deploy", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Deploy", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Stack.Prepare": { - "id": "Stack.Prepare", - "path": "PipelineStack/Pipeline/Pipeline/PreProd/Stack.Prepare", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codepipeline.Pipeline", - "version": "0.0.0" - } - }, - "UpdatePipeline": { - "id": "UpdatePipeline", - "path": "PipelineStack/Pipeline/UpdatePipeline", - "children": { - "SelfMutation": { - "id": "SelfMutation", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation", - "children": { - "Role": { - "id": "Role", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role", - "children": { - "ImportRole": { - "id": "ImportRole", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/ImportRole", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "codebuild.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnRole", - "version": "0.0.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Role/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - ":*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws/codebuild/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - } - ] - ] - } - ] - }, - { - "Action": [ - "codebuild:BatchPutCodeCoverages", - "codebuild:BatchPutTestCases", - "codebuild:CreateReport", - "codebuild:CreateReportGroup", - "codebuild:UpdateReport" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":codebuild:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":report-group/", - { - "Ref": "PipelineUpdatePipelineSelfMutationDAA41400" - }, - "-*" - ] - ] - } - }, - { - "Action": "sts:AssumeRole", - "Condition": { - "ForAnyValue:StringEquals": { - "iam:ResourceTag/aws-cdk:bootstrap-role": [ - "image-publishing", - "file-publishing", - "deploy" - ] - } - }, - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:*:iam::", - { - "Ref": "AWS::AccountId" - }, - ":role/*" - ] - ] - } - }, - { - "Action": [ - "cloudformation:DescribeStacks", - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "PipelineArtifactsBucketAEA9A052", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "kms:Decrypt", - "kms:DescribeKey", - "kms:Encrypt", - "kms:GenerateDataKey*", - "kms:ReEncrypt*" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "PipelineUpdatePipelineSelfMutationRoleDefaultPolicyA225DA4E", - "roles": [ - { - "Ref": "PipelineUpdatePipelineSelfMutationRole57E559E8" - } - ] - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.CfnPolicy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Policy", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-iam.Role", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "PipelineStack/Pipeline/UpdatePipeline/SelfMutation/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", - "aws:cdk:cloudformation:props": { - "artifacts": { - "type": "CODEPIPELINE" - }, - "environment": { - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:6.0", - "imagePullCredentialsType": "CODEBUILD", - "privilegedMode": false, - "computeType": "BUILD_GENERAL1_SMALL" - }, - "serviceRole": { - "Fn::GetAtt": [ - "PipelineUpdatePipelineSelfMutationRole57E559E8", - "Arn" - ] - }, - "source": { - "type": "CODEPIPELINE", - "buildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk@1\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}" - }, - "cache": { - "type": "NO_CACHE" - }, - "encryptionKey": { - "Fn::GetAtt": [ - "PipelineArtifactsBucketEncryptionKeyF5BF0670", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.CfnProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-codebuild.PipelineProject", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.UpdatePipelineAction", - "version": "0.0.0" - } - }, - "Assets": { - "id": "Assets", - "path": "PipelineStack/Pipeline/Assets", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/Pipeline/PreProd", - "children": { - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", - "children": { - "8389e75f-0810-4838-bf64-d6f85a95cf83": { - "id": "8389e75f-0810-4838-bf64-d6f85a95cf83", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}/8389e75f-0810-4838-bf64-d6f85a95cf83", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/MutableRolearn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}": { - "id": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "path": "PipelineStack/Pipeline/PreProd/arn:${AWS::Partition}:iam::${AWS::AccountId}:role--cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CdkStage", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/pipelines.CdkPipeline", - "version": "0.0.0" - } - }, - "PreProd": { - "id": "PreProd", - "path": "PipelineStack/PreProd", - "children": { - "Stack": { - "id": "Stack", - "path": "PipelineStack/PreProd/Stack", - "children": { - "Resource": { - "id": "Resource", - "path": "PipelineStack/PreProd/Stack/Resource", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/PreProd/Stack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/PreProd/Stack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "PipelineStack/BootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "PipelineStack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } - }, - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.264" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts b/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts index 35d1eddc5abcd..4db884ef2d892 100644 --- a/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts +++ b/packages/@aws-cdk/region-info/build-tools/generate-static-data.ts @@ -13,7 +13,7 @@ import { } from '../lib/aws-entities'; import { Default } from '../lib/default'; -async function main(): Promise { +export async function main(): Promise { checkRegions(APPMESH_ECR_ACCOUNTS); checkRegions(DLC_REPOSITORY_ACCOUNTS); checkRegions(ELBV2_ACCOUNTS); diff --git a/packages/@aws-cdk/region-info/rosetta/default.ts-fixture b/packages/@aws-cdk/region-info/rosetta/default.ts-fixture index 3a11f7f47a475..8ba0e3cb1f461 100644 --- a/packages/@aws-cdk/region-info/rosetta/default.ts-fixture +++ b/packages/@aws-cdk/region-info/rosetta/default.ts-fixture @@ -1,5 +1,5 @@ // Fixture with packages imported, but nothing else -import { Stack } from '@aws-cdk/core'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; import * as regionInfo from '@aws-cdk/region-info'; @@ -8,4 +8,4 @@ class Fixture extends Stack { super(scope, id); /// here } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/triggers/.eslintrc.js b/packages/@aws-cdk/triggers/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/triggers/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/triggers/.gitignore b/packages/@aws-cdk/triggers/.gitignore deleted file mode 100644 index 3e895fc51317c..0000000000000 --- a/packages/@aws-cdk/triggers/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -.LAST_PACKAGE -*.snk -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/triggers/.npmignore b/packages/@aws-cdk/triggers/.npmignore deleted file mode 100644 index f1da4a2492fb5..0000000000000 --- a/packages/@aws-cdk/triggers/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -!*.lit.ts -test/ -**/*.snapshot diff --git a/packages/@aws-cdk/triggers/LICENSE b/packages/@aws-cdk/triggers/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/triggers/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/triggers/NOTICE b/packages/@aws-cdk/triggers/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/packages/@aws-cdk/triggers/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/triggers/README.md b/packages/@aws-cdk/triggers/README.md deleted file mode 100644 index 2c86e946c1941..0000000000000 --- a/packages/@aws-cdk/triggers/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# Triggers - - ---- - -![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) - ---- - - - -Triggers allows you to execute code during deployments. This can be used for a -variety of use cases such as: - -* Self tests: validate something after a resource/construct been provisioned -* Data priming: add initial data to resources after they are created -* Preconditions: check things such as account limits or external dependencies - before deployment. - -## Usage - -The `TriggerFunction` construct will define an AWS Lambda function which is -triggered *during* deployment: - -```ts -import * as lambda from '@aws-cdk/aws-lambda'; -import * as triggers from '@aws-cdk/triggers'; -import { Stack } from '@aws-cdk/core'; - -declare const stack: Stack; - -new triggers.TriggerFunction(stack, 'MyTrigger', { - runtime: lambda.Runtime.NODEJS_14_X, - handler: 'index.handler', - code: lambda.Code.fromAsset(__dirname + '/my-trigger'), -}); -``` - -In the above example, the AWS Lambda function defined in `myLambdaFunction` will -be invoked when the stack is deployed. - -## Trigger Failures - -If the trigger handler fails (e.g. an exception is raised), the CloudFormation -deployment will fail, as if a resource failed to provision. This makes it easy -to implement "self tests" via triggers by simply making a set of assertions on -some provisioned infrastructure. - -## Order of Execution - -By default, a trigger will be executed by CloudFormation after the associated -handler is provisioned. This means that if the handler takes an implicit -dependency on other resources (e.g. via environment variables), those resources -will be provisioned *before* the trigger is executed. - -In most cases, implicit ordering should be sufficient, but you can also use -`executeAfter` and `executeBefore` to control the order of execution. - -The following example defines the following order: `(hello, world) => myTrigger => goodbye`. -The resources under `hello` and `world` will be provisioned in -parallel, and then the trigger `myTrigger` will be executed. Only then the -resources under `goodbye` will be provisioned: - -```ts -import { Construct, Node } from 'constructs'; -import * as triggers from '@aws-cdk/triggers'; - -declare const myTrigger: triggers.Trigger; -declare const hello: Construct; -declare const world: Construct; -declare const goodbye: Construct; - -myTrigger.executeAfter(hello, world); -myTrigger.executeBefore(goodbye); -``` - -Note that `hello` and `world` are construct *scopes*. This means that they can -be specific resources (such as an `s3.Bucket` object) or groups of resources -composed together into constructs. - -## Re-execution of Triggers - -By default, `executeOnHandlerChange` is enabled. This implies that the trigger -is re-executed every time the handler function code or configuration changes. If -this option is disabled, the trigger will be executed only once upon first -deployment. - -In the future we will consider adding support for additional re-execution modes: - -* `executeOnEveryDeployment: boolean` - re-executes every time the stack is - deployed (add random "salt" during synthesis). -* `executeOnResourceChange: Construct[]` - re-executes when one of the resources - under the specified scopes has changed (add the hash the CloudFormation - resource specs). diff --git a/packages/@aws-cdk/triggers/jest.config.js b/packages/@aws-cdk/triggers/jest.config.js deleted file mode 100644 index 3a2fd93a1228a..0000000000000 --- a/packages/@aws-cdk/triggers/jest.config.js +++ /dev/null @@ -1,2 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = baseConfig; diff --git a/packages/@aws-cdk/triggers/package.json b/packages/@aws-cdk/triggers/package.json deleted file mode 100644 index 3d4221bd14726..0000000000000 --- a/packages/@aws-cdk/triggers/package.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "name": "@aws-cdk/triggers", - "version": "0.0.0", - "description": "Execute AWS Lambda functions during deployment", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.triggers", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-triggers" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.Triggers", - "packageId": "Amazon.CDK.Triggers", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.triggers", - "module": "aws_cdk.triggers", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/@aws-cdk/triggers" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "integ-runner", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test": "yarn build && yarn test", - "build+test+package": "yarn build+test && yarn package", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "keywords": [ - "aws", - "cdk", - "example", - "construct", - "library", - "triggers" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "aws-sdk": "^2.1329.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "jest": "^27.5.1" - }, - "dependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "homepage": "https://github.com/aws/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/core": "0.0.0", - "constructs": "^10.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "stability": "stable", - "maturity": "stable", - "awscdkio": { - "announce": false - }, - "cdk-build": { - "env": { - "AWSLINT_BASE_CONSTRUCT": true - } - }, - "publishConfig": { - "tag": "latest" - }, - "awslint": { - "exclude": [ - "ref-via-interface:@aws-cdk/triggers.TriggerProps.handler" - ] - }, - "private": true -} diff --git a/packages/@aws-cdk/yaml-cfn/.eslintrc.js b/packages/@aws-cdk/yaml-cfn/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/packages/@aws-cdk/yaml-cfn/.gitignore b/packages/@aws-cdk/yaml-cfn/.gitignore deleted file mode 100644 index d93ce1bcf5d13..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -dist -tsconfig.json -.jsii - -.LAST_BUILD -.LAST_PACKAGE -*.snk -.nyc_output -coverage -nyc.config.js -!.eslintrc.js -!jest.config.js - -junit.xml -!**/*.snapshot/**/asset.*/*.js -!**/*.snapshot/**/asset.*/*.d.ts - -!**/*.snapshot/**/asset.*/** diff --git a/packages/@aws-cdk/yaml-cfn/.npmignore b/packages/@aws-cdk/yaml-cfn/.npmignore deleted file mode 100644 index 2f484b8db6b88..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/.npmignore +++ /dev/null @@ -1,29 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo - -tsconfig.json -.eslintrc.js -jest.config.js - -# exclude cdk artifacts -**/cdk.out -junit.xml -test/ -!*.lit.ts -**/*.snapshot diff --git a/packages/@aws-cdk/yaml-cfn/LICENSE b/packages/@aws-cdk/yaml-cfn/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/yaml-cfn/NOTICE b/packages/@aws-cdk/yaml-cfn/NOTICE deleted file mode 100644 index a5a290d6cbe2e..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/NOTICE +++ /dev/null @@ -1,23 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - -------------------------------------------------------------------------------- - -The AWS CDK includes the following third-party software/licensing: - -** yaml - https://www.npmjs.com/package/yaml -Copyright 2018 Eemeli Aro - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. - ----------------- \ No newline at end of file diff --git a/packages/@aws-cdk/yaml-cfn/README.md b/packages/@aws-cdk/yaml-cfn/README.md deleted file mode 100644 index 7090b6001111c..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# CloudFormation YAML utilities - - ---- - -![Deprecated](https://img.shields.io/badge/deprecated-critical.svg?style=for-the-badge) - -> This API may emit warnings. Backward compatibility is not guaranteed. - ---- - - - -This module contains utilities for parsing and emitting -YAML that is used by [AWS CloudFormation](https://aws.amazon.com/cloudformation). - -This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/@aws-cdk/yaml-cfn/jest.config.js b/packages/@aws-cdk/yaml-cfn/jest.config.js deleted file mode 100644 index 315f80405878f..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/jest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, -}; diff --git a/packages/@aws-cdk/yaml-cfn/lib/index.ts b/packages/@aws-cdk/yaml-cfn/lib/index.ts deleted file mode 100644 index 8acac13029169..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './yaml'; diff --git a/packages/@aws-cdk/yaml-cfn/lib/yaml.ts b/packages/@aws-cdk/yaml-cfn/lib/yaml.ts deleted file mode 100644 index e46c8f8d6bf72..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/lib/yaml.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as yaml from 'yaml'; -import * as yaml_cst from 'yaml/parse-cst'; -import * as yaml_types from 'yaml/types'; - -/** - * Serializes the given data structure into valid YAML. - * - * @param obj the data structure to serialize - * @returns a string containing the YAML representation of {@param obj} - */ -export function serialize(obj: any): string { - const oldFold = yaml_types.strOptions.fold.lineWidth; - try { - yaml_types.strOptions.fold.lineWidth = 0; - return yaml.stringify(obj, { schema: 'yaml-1.1' }); - } finally { - yaml_types.strOptions.fold.lineWidth = oldFold; - } -} - -/** - * Deserialize the YAML into the appropriate data structure. - * - * @param str the string containing YAML - * @returns the data structure the YAML represents - * (most often in case of CloudFormation, an object) - */ -export function deserialize(str: string): any { - return parseYamlStrWithCfnTags(str); -} - -function makeTagForCfnIntrinsic(intrinsicName: string, addFnPrefix: boolean): yaml_types.Schema.CustomTag { - return { - identify(value: any) { return typeof value === 'string'; }, - tag: `!${intrinsicName}`, - resolve: (_doc: yaml.Document, cstNode: yaml_cst.CST.Node) => { - const ret: any = {}; - ret[addFnPrefix ? `Fn::${intrinsicName}` : intrinsicName] = - // the +1 is to account for the ! the short form begins with - parseYamlStrWithCfnTags(cstNode.toString().substring(intrinsicName.length + 1)); - return ret; - }, - }; -} - -const shortForms: yaml_types.Schema.CustomTag[] = [ - 'Base64', 'Cidr', 'FindInMap', 'GetAZs', 'ImportValue', 'Join', 'Sub', - 'Select', 'Split', 'Transform', 'And', 'Equals', 'If', 'Not', 'Or', 'GetAtt', -].map(name => makeTagForCfnIntrinsic(name, true)).concat( - makeTagForCfnIntrinsic('Ref', false), - makeTagForCfnIntrinsic('Condition', false), -); - -function parseYamlStrWithCfnTags(text: string): any { - return yaml.parse(text, { - customTags: shortForms, - schema: 'core', - }); -} diff --git a/packages/@aws-cdk/yaml-cfn/package.json b/packages/@aws-cdk/yaml-cfn/package.json deleted file mode 100644 index 9e61348140744..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/package.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "name": "@aws-cdk/yaml-cfn", - "deprecated": "This module is no longer supported and will be removed in a future release.", - "version": "0.0.0", - "description": "Utilities for handling CloudFormation-flavored YAML", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "repository": { - "url": "https://github.com/aws/aws-cdk.git", - "type": "git", - "directory": "packages/@aws-cdk/yaml-cfn" - }, - "homepage": "https://github.com/aws/aws-cdk", - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "keywords": [ - "aws", - "cdk", - "cfn", - "cloudformation", - "yaml" - ], - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.yaml.cfn", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "cdk-yaml-cfn" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.Yaml.Cfn", - "packageId": "Amazon.CDK.Yaml.Cfn", - "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/main/logo/default-256-dark.png" - }, - "python": { - "distName": "aws-cdk.yaml-cfn", - "module": "aws_cdk.yaml_cfn", - "classifiers": [ - "Framework :: AWS CDK", - "Framework :: AWS CDK :: 2" - ] - } - }, - "projectReferences": true, - "metadata": { - "jsii": { - "rosetta": { - "strict": true - } - } - } - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "yarn build+test && yarn package", - "build+test": "yarn build && yarn test", - "compat": "cdk-compat", - "rosetta:extract": "yarn --silent jsii-rosetta extract", - "build+extract": "yarn build && yarn rosetta:extract", - "build+test+extract": "yarn build+test && yarn rosetta:extract" - }, - "dependencies": { - "yaml": "1.10.2" - }, - "devDependencies": { - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/jest": "^27.5.2", - "@types/yaml": "^1.9.7", - "jest": "^27.5.1" - }, - "bundledDependencies": [ - "yaml" - ], - "engines": { - "node": ">= 14.15.0" - }, - "stability": "deprecated", - "maturity": "deprecated", - "awscdkio": { - "announce": false - }, - "publishConfig": { - "tag": "next" - }, - "private": true -} diff --git a/packages/@aws-cdk/yaml-cfn/test/deserialization.test.ts b/packages/@aws-cdk/yaml-cfn/test/deserialization.test.ts deleted file mode 100644 index 3c6bbc09f2397..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/test/deserialization.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as yaml_cfn from '../lib'; - -test('Unquoted year-month-day is treated as a string, not a Date', () => { - const value = yaml_cfn.deserialize('Key: 2020-12-31'); - - expect(value).toEqual({ - Key: '2020-12-31', - }); -}); - -test("Unquoted 'No' is treated as a string, not a boolean", () => { - const value = yaml_cfn.deserialize('Key: No'); - - expect(value).toEqual({ - Key: 'No', - }); -}); - -test("Short-form 'Ref' is deserialized correctly", () => { - const value = yaml_cfn.deserialize('!Ref Resource'); - - expect(value).toEqual({ - Ref: 'Resource', - }); -}); - -test("Short-form 'Fn::GetAtt' is deserialized correctly", () => { - const value = yaml_cfn.deserialize('!GetAtt Resource.Attribute'); - - expect(value).toEqual({ - 'Fn::GetAtt': 'Resource.Attribute', - }); -}); diff --git a/packages/@aws-cdk/yaml-cfn/test/serialization.test.ts b/packages/@aws-cdk/yaml-cfn/test/serialization.test.ts deleted file mode 100644 index 7b9d07ca2a50d..0000000000000 --- a/packages/@aws-cdk/yaml-cfn/test/serialization.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as yaml_cfn from '../lib'; - -test('An object with a single string value is serialized as a simple string', () => { - const value = yaml_cfn.serialize({ key: 'some string' }); - - expect(value).toEqual('key: some string\n'); -}); diff --git a/packages/aws-cdk-lib/.gitignore b/packages/aws-cdk-lib/.gitignore index 6b75540036a24..4b4c1e6d4716a 100644 --- a/packages/aws-cdk-lib/.gitignore +++ b/packages/aws-cdk-lib/.gitignore @@ -1,18 +1,24 @@ -# Ignore everything (because we're going to be generating into this -# directory) except certain source files. - -* -!LICENSE -!NOTICE -!README.md -!scripts/ -!scripts/*.ts -!scripts/*.sh -scripts/*.d.ts - -.LAST_BUILD +*.d.ts +*.generated.ts +*.js +*.js.map *.snk -junit.xml -!.eslintrc.js -dist +.jsii +.jsii.gz +.LAST_BUILD .LAST_PACKAGE +nyc.config.js +.nyc_output +.vscode +.types-compat +coverage +dist +tsconfig.json +!.eslintrc.js +!jest.config.js + +junit.xml +!**/*.snapshot/**/asset.*/*.js +!**/*.snapshot/**/asset.*/*.d.ts + +!**/*.snapshot/**/asset.*/** diff --git a/packages/aws-cdk-lib/.npmignore b/packages/aws-cdk-lib/.npmignore index 059501e441fd2..f6a6ce9e1317a 100644 --- a/packages/aws-cdk-lib/.npmignore +++ b/packages/aws-cdk-lib/.npmignore @@ -33,3 +33,6 @@ junit.xml # exclude source maps as they only work locally *.map + +# Nested node_modules +aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/node_modules diff --git a/packages/aws-cdk-lib/alexa-ask/.jsiirc.json b/packages/aws-cdk-lib/alexa-ask/.jsiirc.json new file mode 100644 index 0000000000000..0807131dfa483 --- /dev/null +++ b/packages/aws-cdk-lib/alexa-ask/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.Alexa.Ask" + }, + "java": { + "package": "software.amazon.awscdk.alexa.ask" + }, + "python": { + "module": "aws_cdk.alexa_ask" + } + } +} diff --git a/packages/aws-cdk-lib/alexa-ask/README.md b/packages/aws-cdk-lib/alexa-ask/README.md new file mode 100644 index 0000000000000..1a6a705b54c15 --- /dev/null +++ b/packages/aws-cdk-lib/alexa-ask/README.md @@ -0,0 +1,27 @@ +# Alexa Skills Kit Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as alexa_ask from 'aws-cdk-lib/alexa-ask'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ASK construct libraries](https://constructs.dev/search?q=ask) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation Alexa::ASK resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Alexa_ASK.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for Alexa::ASK](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Alexa_ASK.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/alexa-ask/index.ts b/packages/aws-cdk-lib/alexa-ask/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/alexa-ask/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/alexa-ask/lib/index.ts b/packages/aws-cdk-lib/alexa-ask/lib/index.ts new file mode 100644 index 0000000000000..074d7d64e85ef --- /dev/null +++ b/packages/aws-cdk-lib/alexa-ask/lib/index.ts @@ -0,0 +1 @@ +export * from './ask.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/assertions/.jsiirc.json b/packages/aws-cdk-lib/assertions/.jsiirc.json new file mode 100644 index 0000000000000..061ee866b10de --- /dev/null +++ b/packages/aws-cdk-lib/assertions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.assertions" + }, + "dotnet": { + "namespace": "Amazon.CDK.Assertions" + }, + "python": { + "module": "aws_cdk.assertions" + } + } +} diff --git a/packages/@aws-cdk/assertions/MIGRATING.md b/packages/aws-cdk-lib/assertions/MIGRATING.md similarity index 100% rename from packages/@aws-cdk/assertions/MIGRATING.md rename to packages/aws-cdk-lib/assertions/MIGRATING.md diff --git a/packages/aws-cdk-lib/assertions/README.md b/packages/aws-cdk-lib/assertions/README.md new file mode 100644 index 0000000000000..82968f0f1f157 --- /dev/null +++ b/packages/aws-cdk-lib/assertions/README.md @@ -0,0 +1,597 @@ +# Assertions + + +If you're migrating from the old `assert` library, the migration guide can be found in +[our GitHub repository](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/assertions/MIGRATING.md). + +Functions for writing test asserting against CDK applications, with focus on CloudFormation templates. + +The `Template` class includes a set of methods for writing assertions against CloudFormation templates. Use one of the `Template.fromXxx()` static methods to create an instance of this class. + +To create `Template` from CDK stack, start off with: + +```ts nofixture +import { Stack } from 'aws-cdk-lib'; +import { Template } from 'aws-cdk-lib/assertions'; + +const stack = new Stack(/* ... */); +// ... +const template = Template.fromStack(stack); +``` + +Alternatively, assertions can be run on an existing CloudFormation template - + +```ts fixture=init +const templateJson = '{ "Resources": ... }'; /* The CloudFormation template as JSON serialized string. */ +const template = Template.fromString(templateJson); +``` + +**Cyclical Resources Note** + +If allowing cyclical references is desired, for example in the case of unprocessed Transform templates, supply TemplateParsingOptions and +set skipCyclicalDependenciesCheck to true. In all other cases, will fail on detecting cyclical dependencies. + +## Full Template Match + +The simplest assertion would be to assert that the template matches a given +template. + +```ts +template.templateMatches({ + Resources: { + BarLogicalId: { + Type: 'Foo::Bar', + Properties: { + Baz: 'Qux', + }, + }, + }, +}); +``` + +By default, the `templateMatches()` API will use the an 'object-like' comparison, +which means that it will allow for the actual template to be a superset of the +given expectation. See [Special Matchers](#special-matchers) for details on how +to change this. + +Snapshot testing is a common technique to store a snapshot of the output and +compare it during future changes. Since CloudFormation templates are human readable, +they are a good target for snapshot testing. + +The `toJSON()` method on the `Template` can be used to produce a well formatted JSON +of the CloudFormation template that can be used as a snapshot. + +See [Snapshot Testing in Jest](https://jestjs.io/docs/snapshot-testing) and [Snapshot +Testing in Java](https://json-snapshot.github.io/). + +## Counting Resources + +This module allows asserting the number of resources of a specific type found +in a template. + +```ts +template.resourceCountIs('Foo::Bar', 2); +``` + +You can also count the number of resources of a specific type whose `Properties` +section contains the specified properties: + +```ts +template.resourcePropertiesCountIs('Foo::Bar', { + Foo: 'Bar', + Baz: 5, + Qux: [ 'Waldo', 'Fred' ], +}, 1); +``` + +## Resource Matching & Retrieval + +Beyond resource counting, the module also allows asserting that a resource with +specific properties are present. + +The following code asserts that the `Properties` section of a resource of type +`Foo::Bar` contains the specified properties - + +```ts +template.hasResourceProperties('Foo::Bar', { + Lorem: 'Ipsum', + Baz: 5, + Qux: [ 'Waldo', 'Fred' ], +}); +``` + +You can also assert that the `Properties` section of all resources of type +`Foo::Bar` contains the specified properties - + +```ts +template.allResourcesProperties('Foo::Bar', { + Lorem: 'Ipsum', + Baz: 5, + Qux: [ 'Waldo', 'Fred' ], +}); +``` + +Alternatively, if you would like to assert the entire resource definition, you +can use the `hasResource()` API. + +```ts +template.hasResource('Foo::Bar', { + Properties: { Lorem: 'Ipsum' }, + DependsOn: [ 'Waldo', 'Fred' ], +}); +``` + +You can also assert the definitions of all resources of a type using the +`allResources()` API. + +```ts +template.allResources('Foo::Bar', { + Properties: { Lorem: 'Ipsum' }, + DependsOn: [ 'Waldo', 'Fred' ], +}); +``` + +Beyond assertions, the module provides APIs to retrieve matching resources. +The `findResources()` API is complementary to the `hasResource()` API, except, +instead of asserting its presence, it returns the set of matching resources. + +By default, the `hasResource()` and `hasResourceProperties()` APIs perform deep +partial object matching. This behavior can be configured using matchers. +See subsequent section on [special matchers](#special-matchers). + +## Output and Mapping sections + +The module allows you to assert that the CloudFormation template contains an Output +that matches specific properties. The following code asserts that a template contains +an Output with a `logicalId` of `Foo` and the specified properties - + +```ts +const expected = { + Value: 'Bar', + Export: { Name: 'ExportBaz' }, +}; +template.hasOutput('Foo', expected); +``` + +If you want to match against all Outputs in the template, use `*` as the `logicalId`. + +```ts +template.hasOutput('*', { + Value: 'Bar', + Export: { Name: 'ExportBaz' }, +}); +``` + +`findOutputs()` will return a set of outputs that match the `logicalId` and `props`, +and you can use the `'*'` special case as well. + +```ts +const result = template.findOutputs('*', { Value: 'Fred' }); +expect(result.Foo).toEqual({ Value: 'Fred', Description: 'FooFred' }); +expect(result.Bar).toEqual({ Value: 'Fred', Description: 'BarFred' }); +``` + +The APIs `hasMapping()`, `findMappings()`, `hasCondition()`, and `hasCondtions()` provide similar functionalities. + +## Special Matchers + +The expectation provided to the `hasXxx()`, `findXxx()` and `templateMatches()` +APIs, besides carrying literal values, as seen in the above examples, also accept +special matchers. + +They are available as part of the `Match` class. + +### Object Matchers + +The `Match.objectLike()` API can be used to assert that the target is a superset +object of the provided pattern. +This API will perform a deep partial match on the target. +Deep partial matching is where objects are matched partially recursively. At each +level, the list of keys in the target is a subset of the provided pattern. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": { +// "Wobble": "Flob", +// "Bob": "Cat" +// } +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: Match.objectLike({ + Wobble: 'Flob', + }), +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: Match.objectLike({ + Brew: 'Coffee', + }), +}); +``` + +The `Match.objectEquals()` API can be used to assert a target as a deep exact +match. + +### Presence and Absence + +The `Match.absent()` matcher can be used to specify that a specific +value should not exist on the target. This can be used within `Match.objectLike()` +or outside of any matchers. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": { +// "Wobble": "Flob", +// } +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: Match.objectLike({ + Bob: Match.absent(), + }), +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: Match.objectLike({ + Wobble: Match.absent(), + }), +}); +``` + +The `Match.anyValue()` matcher can be used to specify that a specific value should be found +at the location. This matcher will fail if when the target location has null-ish values +(i.e., `null` or `undefined`). + +This matcher can be combined with any of the other matchers. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": { +// "Wobble": ["Flob", "Flib"], +// } +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: { + Wobble: [ Match.anyValue(), Match.anyValue() ], + }, +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: { + Wimble: Match.anyValue(), + }, +}); +``` + +### Array Matchers + +The `Match.arrayWith()` API can be used to assert that the target is equal to or a subset +of the provided pattern array. +This API will perform subset match on the target. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": ["Flob", "Cat"] +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: Match.arrayWith(['Flob']), +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', Match.objectLike({ + Fred: Match.arrayWith(['Wobble']), +})); +``` + +*Note:* The list of items in the pattern array should be in order as they appear in the +target array. Out of order will be recorded as a match failure. + +Alternatively, the `Match.arrayEquals()` API can be used to assert that the target is +exactly equal to the pattern array. + +### String Matchers + +The `Match.stringLikeRegexp()` API can be used to assert that the target matches the +provided regular expression. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Template": "const includeHeaders = true;" +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Template: Match.stringLikeRegexp('includeHeaders = (true|false)'), +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Template: Match.stringLikeRegexp('includeHeaders = null'), +}); +``` + +### Not Matcher + +The not matcher inverts the search pattern and matches all patterns in the path that does +not match the pattern specified. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": ["Flob", "Cat"] +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Fred: Match.not(['Flob']), +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', Match.objectLike({ + Fred: Match.not(['Flob', 'Cat']), +})); +``` + +### Serialized JSON + +Often, we find that some CloudFormation Resource types declare properties as a string, +but actually expect JSON serialized as a string. +For example, the [`BuildSpec` property of `AWS::CodeBuild::Project`][Pipeline BuildSpec], +the [`Definition` property of `AWS::StepFunctions::StateMachine`][StateMachine Definition], +to name a couple. + +The `Match.serializedJson()` matcher allows deep matching within a stringified JSON. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Baz": "{ \"Fred\": [\"Waldo\", \"Willow\"] }" +// } +// } +// } +// } + +// The following will NOT throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Baz: Match.serializedJson({ + Fred: Match.arrayWith(["Waldo"]), + }), +}); + +// The following will throw an assertion error +template.hasResourceProperties('Foo::Bar', { + Baz: Match.serializedJson({ + Fred: ["Waldo", "Johnny"], + }), +}); +``` + +[Pipeline BuildSpec]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-source.html#cfn-codebuild-project-source-buildspec +[StateMachine Definition]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definition + +## Capturing Values + +The matcher APIs documented above allow capturing values in the matching entry +(Resource, Output, Mapping, etc.). The following code captures a string from a +matching resource. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": ["Flob", "Cat"], +// "Waldo": ["Qix", "Qux"], +// } +// } +// } +// } + +const fredCapture = new Capture(); +const waldoCapture = new Capture(); +template.hasResourceProperties('Foo::Bar', { + Fred: fredCapture, + Waldo: ["Qix", waldoCapture], +}); + +fredCapture.asArray(); // returns ["Flob", "Cat"] +waldoCapture.asString(); // returns "Qux" +``` + +With captures, a nested pattern can also be specified, so that only targets +that match the nested pattern will be captured. This pattern can be literals or +further Matchers. + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar1": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": ["Flob", "Cat"], +// } +// } +// "MyBar2": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": ["Qix", "Qux"], +// } +// } +// } +// } + +const capture = new Capture(Match.arrayWith(['Cat'])); +template.hasResourceProperties('Foo::Bar', { + Fred: capture, +}); + +capture.asArray(); // returns ['Flob', 'Cat'] +``` + +When multiple resources match the given condition, each `Capture` defined in +the condition will capture all matching values. They can be paged through using +the `next()` API. The following example illustrates this - + +```ts +// Given a template - +// { +// "Resources": { +// "MyBar": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": "Flob", +// } +// }, +// "MyBaz": { +// "Type": "Foo::Bar", +// "Properties": { +// "Fred": "Quib", +// } +// } +// } +// } + +const fredCapture = new Capture(); +template.hasResourceProperties('Foo::Bar', { + Fred: fredCapture, +}); + +fredCapture.asString(); // returns "Flob" +fredCapture.next(); // returns true +fredCapture.asString(); // returns "Quib" +``` + +## Asserting Annotations + +In addition to template matching, we provide an API for annotation matching. +[Annotations](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Annotations.html) +can be added via the [Aspects](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Aspects.html) +API. You can learn more about Aspects [here](https://docs.aws.amazon.com/cdk/v2/guide/aspects.html). + +Say you have a `MyAspect` and a `MyStack` that uses `MyAspect`: + +```ts nofixture +import * as cdk from 'aws-cdk-lib'; +import { Construct, IConstruct } from 'constructs'; + +class MyAspect implements cdk.IAspect { + public visit(node: IConstruct): void { + if (node instanceof cdk.CfnResource && node.cfnResourceType === 'Foo::Bar') { + this.error(node, 'we do not want a Foo::Bar resource'); + } + } + + protected error(node: IConstruct, message: string): void { + cdk.Annotations.of(node).addError(message); + } +} + +class MyStack extends cdk.Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const stack = new cdk.Stack(); + new cdk.CfnResource(stack, 'Foo', { + type: 'Foo::Bar', + properties: { + Fred: 'Thud', + }, + }); + cdk.Aspects.of(stack).add(new MyAspect()); + } +} +``` + +We can then assert that the stack contains the expected Error: + +```ts +// import { Annotations } from '@aws-cdk/assertions'; + +Annotations.fromStack(stack).hasError( + '/Default/Foo', + 'we do not want a Foo::Bar resource', +); +``` + +Here are the available APIs for `Annotations`: + +- `hasError()`, `hasNoError()`, and `findError()` +- `hasWarning()`, `hasNoWarning()`, and `findWarning()` +- `hasInfo()`, `hasNoInfo()`, and `findInfo()` + +The corresponding `findXxx()` API is complementary to the `hasXxx()` API, except instead +of asserting its presence, it returns the set of matching messages. + +In addition, this suite of APIs is compatible with `Matchers` for more fine-grained control. +For example, the following assertion works as well: + +```ts +Annotations.fromStack(stack).hasError( + '/Default/Foo', + Match.stringLikeRegexp('.*Foo::Bar.*'), +); +``` diff --git a/packages/aws-cdk-lib/assertions/index.ts b/packages/aws-cdk-lib/assertions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/assertions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/assertions/lib/annotations.ts b/packages/aws-cdk-lib/assertions/lib/annotations.ts new file mode 100644 index 0000000000000..58010948d9245 --- /dev/null +++ b/packages/aws-cdk-lib/assertions/lib/annotations.ts @@ -0,0 +1,168 @@ +import { Stack, Stage } from '../../core'; +import { SynthesisMessage } from '../../cx-api'; +import { Messages } from './private/message'; +import { findMessage, hasMessage, hasNoMessage } from './private/messages'; + +/** + * Suite of assertions that can be run on a CDK Stack. + * Focused on asserting annotations. + */ +export class Annotations { + /** + * Base your assertions on the messages returned by a synthesized CDK `Stack`. + * @param stack the CDK Stack to run assertions on + */ + public static fromStack(stack: Stack): Annotations { + return new Annotations(toMessages(stack)); + } + + private readonly _messages: Messages; + + private constructor(messages: SynthesisMessage[]) { + this._messages = convertArrayToMessagesType(messages); + } + + /** + * Assert that an error with the given message exists in the synthesized CDK `Stack`. + * + * @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template. + * @param message the error message as should be expected. This should be a string or Matcher object. + */ + public hasError(constructPath: string, message: any): void { + const matchError = hasMessage(this._messages, constructPath, constructMessage('error', message)); + if (matchError) { + throw new Error(matchError); + } + } + + /** + * Assert that an error with the given message does not exist in the synthesized CDK `Stack`. + * + * @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template. + * @param message the error message as should be expected. This should be a string or Matcher object. + */ + public hasNoError(constructPath: string, message: any): void { + const matchError = hasNoMessage(this._messages, constructPath, constructMessage('error', message)); + if (matchError) { + throw new Error(matchError); + } + } + + /** + * Get the set of matching errors of a given construct path and message. + * + * @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template. + * @param message the error message as should be expected. This should be a string or Matcher object. + */ + public findError(constructPath: string, message: any): SynthesisMessage[] { + return convertMessagesTypeToArray(findMessage(this._messages, constructPath, constructMessage('error', message)) as Messages); + } + + /** + * Assert that an warning with the given message exists in the synthesized CDK `Stack`. + * + * @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template. + * @param message the warning message as should be expected. This should be a string or Matcher object. + */ + public hasWarning(constructPath: string, message: any): void { + const matchError = hasMessage(this._messages, constructPath, constructMessage('warning', message)); + if (matchError) { + throw new Error(matchError); + } + } + + /** + * Assert that an warning with the given message does not exist in the synthesized CDK `Stack`. + * + * @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template. + * @param message the warning message as should be expected. This should be a string or Matcher object. + */ + public hasNoWarning(constructPath: string, message: any): void { + const matchError = hasNoMessage(this._messages, constructPath, constructMessage('warning', message)); + if (matchError) { + throw new Error(matchError); + } + } + + /** + * Get the set of matching warning of a given construct path and message. + * + * @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template. + * @param message the warning message as should be expected. This should be a string or Matcher object. + */ + public findWarning(constructPath: string, message: any): SynthesisMessage[] { + return convertMessagesTypeToArray(findMessage(this._messages, constructPath, constructMessage('warning', message)) as Messages); + } + + /** + * Assert that an info with the given message exists in the synthesized CDK `Stack`. + * + * @param constructPath the construct path to the info. Provide `'*'` to match all info in the template. + * @param message the info message as should be expected. This should be a string or Matcher object. + */ + public hasInfo(constructPath: string, message: any): void { + const matchError = hasMessage(this._messages, constructPath, constructMessage('info', message)); + if (matchError) { + throw new Error(matchError); + } + } + + /** + * Assert that an info with the given message does not exist in the synthesized CDK `Stack`. + * + * @param constructPath the construct path to the info. Provide `'*'` to match all info in the template. + * @param message the info message as should be expected. This should be a string or Matcher object. + */ + public hasNoInfo(constructPath: string, message: any): void { + const matchError = hasNoMessage(this._messages, constructPath, constructMessage('info', message)); + if (matchError) { + throw new Error(matchError); + } + } + + /** + * Get the set of matching infos of a given construct path and message. + * + * @param constructPath the construct path to the info. Provide `'*'` to match all infos in the template. + * @param message the info message as should be expected. This should be a string or Matcher object. + */ + public findInfo(constructPath: string, message: any): SynthesisMessage[] { + return convertMessagesTypeToArray(findMessage(this._messages, constructPath, constructMessage('info', message)) as Messages); + } +} + +function constructMessage(type: 'info' | 'warning' | 'error', message: any): {[key:string]: any } { + return { + level: type, + entry: { + data: message, + }, + }; +} + +function convertArrayToMessagesType(messages: SynthesisMessage[]): Messages { + return messages.reduce((obj, item, index) => { + return { + ...obj, + [index]: item, + }; + }, {}) as Messages; +} + +function convertMessagesTypeToArray(messages: Messages): SynthesisMessage[] { + return Object.values(messages) as SynthesisMessage[]; +} + +function toMessages(stack: Stack): any { + const root = stack.node.root; + if (!Stage.isStage(root)) { + throw new Error('unexpected: all stacks must be part of a Stage or an App'); + } + + // to support incremental assertions (i.e. "expect(stack).toNotContainSomething(); doSomething(); expect(stack).toContainSomthing()") + const force = true; + + const assembly = root.synth({ force }); + + return assembly.getStackArtifact(stack.artifactId).messages; +} diff --git a/packages/@aws-cdk/assertions/lib/capture.ts b/packages/aws-cdk-lib/assertions/lib/capture.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/capture.ts rename to packages/aws-cdk-lib/assertions/lib/capture.ts diff --git a/packages/@aws-cdk/assertions/lib/helpers-internal/index.ts b/packages/aws-cdk-lib/assertions/lib/helpers-internal/index.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/helpers-internal/index.ts rename to packages/aws-cdk-lib/assertions/lib/helpers-internal/index.ts diff --git a/packages/@aws-cdk/assertions/lib/index.ts b/packages/aws-cdk-lib/assertions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/index.ts rename to packages/aws-cdk-lib/assertions/lib/index.ts diff --git a/packages/@aws-cdk/assertions/lib/match.ts b/packages/aws-cdk-lib/assertions/lib/match.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/match.ts rename to packages/aws-cdk-lib/assertions/lib/match.ts diff --git a/packages/@aws-cdk/assertions/lib/matcher.ts b/packages/aws-cdk-lib/assertions/lib/matcher.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/matcher.ts rename to packages/aws-cdk-lib/assertions/lib/matcher.ts diff --git a/packages/@aws-cdk/assertions/lib/private/conditions.ts b/packages/aws-cdk-lib/assertions/lib/private/conditions.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/conditions.ts rename to packages/aws-cdk-lib/assertions/lib/private/conditions.ts diff --git a/packages/@aws-cdk/assertions/lib/private/cyclic.ts b/packages/aws-cdk-lib/assertions/lib/private/cyclic.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/cyclic.ts rename to packages/aws-cdk-lib/assertions/lib/private/cyclic.ts diff --git a/packages/@aws-cdk/assertions/lib/private/mappings.ts b/packages/aws-cdk-lib/assertions/lib/private/mappings.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/mappings.ts rename to packages/aws-cdk-lib/assertions/lib/private/mappings.ts diff --git a/packages/@aws-cdk/assertions/lib/private/matchers/absent.ts b/packages/aws-cdk-lib/assertions/lib/private/matchers/absent.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/matchers/absent.ts rename to packages/aws-cdk-lib/assertions/lib/private/matchers/absent.ts diff --git a/packages/aws-cdk-lib/assertions/lib/private/message.ts b/packages/aws-cdk-lib/assertions/lib/private/message.ts new file mode 100644 index 0000000000000..f62d240275fe1 --- /dev/null +++ b/packages/aws-cdk-lib/assertions/lib/private/message.ts @@ -0,0 +1,5 @@ +import { SynthesisMessage } from '../../../cx-api'; + +export type Messages = { + [key: string]: SynthesisMessage; +} diff --git a/packages/@aws-cdk/assertions/lib/private/messages.ts b/packages/aws-cdk-lib/assertions/lib/private/messages.ts similarity index 97% rename from packages/@aws-cdk/assertions/lib/private/messages.ts rename to packages/aws-cdk-lib/assertions/lib/private/messages.ts index 140eb3fd95201..0db71f1cccb3d 100644 --- a/packages/@aws-cdk/assertions/lib/private/messages.ts +++ b/packages/aws-cdk-lib/assertions/lib/private/messages.ts @@ -1,4 +1,4 @@ -import { SynthesisMessage } from '@aws-cdk/cx-api'; +import { SynthesisMessage } from '../../../cx-api'; import { Messages } from './message'; import { formatAllMatches, matchSection, formatSectionMatchFailure } from './section'; diff --git a/packages/@aws-cdk/assertions/lib/private/outputs.ts b/packages/aws-cdk-lib/assertions/lib/private/outputs.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/outputs.ts rename to packages/aws-cdk-lib/assertions/lib/private/outputs.ts diff --git a/packages/@aws-cdk/assertions/lib/private/parameters.ts b/packages/aws-cdk-lib/assertions/lib/private/parameters.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/parameters.ts rename to packages/aws-cdk-lib/assertions/lib/private/parameters.ts diff --git a/packages/@aws-cdk/assertions/lib/private/resources.ts b/packages/aws-cdk-lib/assertions/lib/private/resources.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/resources.ts rename to packages/aws-cdk-lib/assertions/lib/private/resources.ts diff --git a/packages/@aws-cdk/assertions/lib/private/section.ts b/packages/aws-cdk-lib/assertions/lib/private/section.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/section.ts rename to packages/aws-cdk-lib/assertions/lib/private/section.ts diff --git a/packages/@aws-cdk/assertions/lib/private/sorting.ts b/packages/aws-cdk-lib/assertions/lib/private/sorting.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/sorting.ts rename to packages/aws-cdk-lib/assertions/lib/private/sorting.ts diff --git a/packages/@aws-cdk/assertions/lib/private/sparse-matrix.ts b/packages/aws-cdk-lib/assertions/lib/private/sparse-matrix.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/sparse-matrix.ts rename to packages/aws-cdk-lib/assertions/lib/private/sparse-matrix.ts diff --git a/packages/@aws-cdk/assertions/lib/private/template.ts b/packages/aws-cdk-lib/assertions/lib/private/template.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/template.ts rename to packages/aws-cdk-lib/assertions/lib/private/template.ts diff --git a/packages/@aws-cdk/assertions/lib/private/type.ts b/packages/aws-cdk-lib/assertions/lib/private/type.ts similarity index 100% rename from packages/@aws-cdk/assertions/lib/private/type.ts rename to packages/aws-cdk-lib/assertions/lib/private/type.ts diff --git a/packages/@aws-cdk/assertions/lib/template.ts b/packages/aws-cdk-lib/assertions/lib/template.ts similarity index 99% rename from packages/@aws-cdk/assertions/lib/template.ts rename to packages/aws-cdk-lib/assertions/lib/template.ts index 2c099733bc6ec..b85b718c15f42 100644 --- a/packages/@aws-cdk/assertions/lib/template.ts +++ b/packages/aws-cdk-lib/assertions/lib/template.ts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { Stack, Stage } from '@aws-cdk/core'; +import { Stack, Stage } from '../../core'; import * as fs from 'fs-extra'; import { Match } from './match'; import { Matcher } from './matcher'; diff --git a/packages/@aws-cdk/assertions/rewrite.toml b/packages/aws-cdk-lib/assertions/rewrite.toml similarity index 100% rename from packages/@aws-cdk/assertions/rewrite.toml rename to packages/aws-cdk-lib/assertions/rewrite.toml diff --git a/packages/@aws-cdk/assertions/test/__snapshots__/render.test.js.snap b/packages/aws-cdk-lib/assertions/test/__snapshots__/render.test.js.snap similarity index 100% rename from packages/@aws-cdk/assertions/test/__snapshots__/render.test.js.snap rename to packages/aws-cdk-lib/assertions/test/__snapshots__/render.test.js.snap diff --git a/packages/@aws-cdk/assertions/test/annotations.test.ts b/packages/aws-cdk-lib/assertions/test/annotations.test.ts similarity index 99% rename from packages/@aws-cdk/assertions/test/annotations.test.ts rename to packages/aws-cdk-lib/assertions/test/annotations.test.ts index 2732f7db7c774..beaee3b172c0b 100644 --- a/packages/@aws-cdk/assertions/test/annotations.test.ts +++ b/packages/aws-cdk-lib/assertions/test/annotations.test.ts @@ -1,4 +1,4 @@ -import { Annotations, Aspects, CfnResource, IAspect, Stack } from '@aws-cdk/core'; +import { Annotations, Aspects, CfnResource, IAspect, Stack } from '../../core'; import { IConstruct } from 'constructs'; import { Annotations as _Annotations, Match } from '../lib'; diff --git a/packages/@aws-cdk/assertions/test/capture.test.ts b/packages/aws-cdk-lib/assertions/test/capture.test.ts similarity index 100% rename from packages/@aws-cdk/assertions/test/capture.test.ts rename to packages/aws-cdk-lib/assertions/test/capture.test.ts diff --git a/packages/@aws-cdk/assertions/test/match.test.ts b/packages/aws-cdk-lib/assertions/test/match.test.ts similarity index 100% rename from packages/@aws-cdk/assertions/test/match.test.ts rename to packages/aws-cdk-lib/assertions/test/match.test.ts diff --git a/packages/@aws-cdk/assertions/test/private/section.test.ts b/packages/aws-cdk-lib/assertions/test/private/section.test.ts similarity index 100% rename from packages/@aws-cdk/assertions/test/private/section.test.ts rename to packages/aws-cdk-lib/assertions/test/private/section.test.ts diff --git a/packages/@aws-cdk/assertions/test/render.test.ts b/packages/aws-cdk-lib/assertions/test/render.test.ts similarity index 100% rename from packages/@aws-cdk/assertions/test/render.test.ts rename to packages/aws-cdk-lib/assertions/test/render.test.ts diff --git a/packages/@aws-cdk/assertions/test/template.test.ts b/packages/aws-cdk-lib/assertions/test/template.test.ts similarity index 99% rename from packages/@aws-cdk/assertions/test/template.test.ts rename to packages/aws-cdk-lib/assertions/test/template.test.ts index da23ade89b83d..2deb97c1e2197 100644 --- a/packages/@aws-cdk/assertions/test/template.test.ts +++ b/packages/aws-cdk-lib/assertions/test/template.test.ts @@ -1,4 +1,4 @@ -import { App, CfnCondition, CfnMapping, CfnOutput, CfnParameter, CfnResource, Fn, LegacyStackSynthesizer, NestedStack, Stack } from '@aws-cdk/core'; +import { App, CfnCondition, CfnMapping, CfnOutput, CfnParameter, CfnResource, Fn, LegacyStackSynthesizer, NestedStack, Stack } from '../../core'; import { Construct } from 'constructs'; import { Capture, Match, Template } from '../lib'; diff --git a/packages/aws-cdk-lib/assets/.jsiirc.json b/packages/aws-cdk-lib/assets/.jsiirc.json new file mode 100644 index 0000000000000..60834f61023aa --- /dev/null +++ b/packages/aws-cdk-lib/assets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.assets" + }, + "dotnet": { + "namespace": "Amazon.CDK.Assets" + }, + "python": { + "module": "aws_cdk.assets" + } + } +} diff --git a/packages/aws-cdk-lib/assets/README.md b/packages/aws-cdk-lib/assets/README.md new file mode 100644 index 0000000000000..70b423f3e3386 --- /dev/null +++ b/packages/aws-cdk-lib/assets/README.md @@ -0,0 +1,4 @@ +# AWS CDK Assets + + +All types moved to @aws-cdk/core. diff --git a/packages/aws-cdk-lib/assets/index.ts b/packages/aws-cdk-lib/assets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/assets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/assets/lib/api.ts b/packages/aws-cdk-lib/assets/lib/api.ts similarity index 100% rename from packages/@aws-cdk/assets/lib/api.ts rename to packages/aws-cdk-lib/assets/lib/api.ts diff --git a/packages/aws-cdk-lib/assets/lib/compat.ts b/packages/aws-cdk-lib/assets/lib/compat.ts new file mode 100644 index 0000000000000..130f8d7eca0e6 --- /dev/null +++ b/packages/aws-cdk-lib/assets/lib/compat.ts @@ -0,0 +1,17 @@ +import { SymlinkFollowMode } from '../../core'; +import { FollowMode } from './fs/follow-mode'; + +export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined { + if (!follow) { + return undefined; + } + + switch (follow) { + case FollowMode.NEVER: return SymlinkFollowMode.NEVER; + case FollowMode.ALWAYS: return SymlinkFollowMode.ALWAYS; + case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL; + case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL; + default: + throw new Error(`unknown follow mode: ${follow}`); + } +} diff --git a/packages/@aws-cdk/assets/lib/fs/follow-mode.ts b/packages/aws-cdk-lib/assets/lib/fs/follow-mode.ts similarity index 100% rename from packages/@aws-cdk/assets/lib/fs/follow-mode.ts rename to packages/aws-cdk-lib/assets/lib/fs/follow-mode.ts diff --git a/packages/@aws-cdk/assets/lib/fs/options.ts b/packages/aws-cdk-lib/assets/lib/fs/options.ts similarity index 96% rename from packages/@aws-cdk/assets/lib/fs/options.ts rename to packages/aws-cdk-lib/assets/lib/fs/options.ts index 548fa4bda42ee..f6845f0ea7cdb 100644 --- a/packages/@aws-cdk/assets/lib/fs/options.ts +++ b/packages/aws-cdk-lib/assets/lib/fs/options.ts @@ -1,4 +1,4 @@ -import { IgnoreMode } from '@aws-cdk/core'; +import { IgnoreMode } from '../../../core'; import { FollowMode } from './follow-mode'; /** diff --git a/packages/@aws-cdk/assets/lib/index.ts b/packages/aws-cdk-lib/assets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/assets/lib/index.ts rename to packages/aws-cdk-lib/assets/lib/index.ts diff --git a/packages/@aws-cdk/assets/lib/staging.ts b/packages/aws-cdk-lib/assets/lib/staging.ts similarity index 94% rename from packages/@aws-cdk/assets/lib/staging.ts rename to packages/aws-cdk-lib/assets/lib/staging.ts index 34b86f648b251..6797867f996dc 100644 --- a/packages/@aws-cdk/assets/lib/staging.ts +++ b/packages/aws-cdk-lib/assets/lib/staging.ts @@ -1,4 +1,4 @@ -import { AssetStaging } from '@aws-cdk/core'; +import { AssetStaging } from '../../core'; import { Construct } from 'constructs'; import { toSymlinkFollow } from './compat'; import { FingerprintOptions } from './fs/options'; diff --git a/packages/aws-cdk-lib/assets/test/compat.test.ts b/packages/aws-cdk-lib/assets/test/compat.test.ts new file mode 100644 index 0000000000000..b8e73c137596d --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/compat.test.ts @@ -0,0 +1,11 @@ +import { SymlinkFollowMode } from '../../core'; +import { FollowMode } from '../lib'; +import { toSymlinkFollow } from '../lib/compat'; + +test('FollowMode compatibility', () => { + expect(toSymlinkFollow(undefined)).toEqual(undefined); + expect(toSymlinkFollow(FollowMode.ALWAYS)).toEqual(SymlinkFollowMode.ALWAYS); + expect(toSymlinkFollow(FollowMode.BLOCK_EXTERNAL)).toEqual(SymlinkFollowMode.BLOCK_EXTERNAL); + expect(toSymlinkFollow(FollowMode.EXTERNAL)).toEqual(SymlinkFollowMode.EXTERNAL); + expect(toSymlinkFollow(FollowMode.NEVER)).toEqual(SymlinkFollowMode.NEVER); +}); diff --git a/packages/@aws-cdk/assets/test/fs/fixtures.tar.gz b/packages/aws-cdk-lib/assets/test/fs/fixtures.tar.gz similarity index 100% rename from packages/@aws-cdk/assets/test/fs/fixtures.tar.gz rename to packages/aws-cdk-lib/assets/test/fs/fixtures.tar.gz diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/external-dir-link b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/external-dir-link new file mode 120000 index 0000000000000..b9447033a4279 --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/external-dir-link @@ -0,0 +1 @@ +../test1/subdir \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/external-link.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/external-link.txt new file mode 120000 index 0000000000000..267020c936652 --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/external-link.txt @@ -0,0 +1 @@ +../test1/subdir2/subdir3/file3.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/indirect-external-link.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/indirect-external-link.txt new file mode 120000 index 0000000000000..907a2a65b1515 --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/indirect-external-link.txt @@ -0,0 +1 @@ +external-link.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/local-dir-link b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/local-dir-link new file mode 120000 index 0000000000000..42101049ac31a --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/local-dir-link @@ -0,0 +1 @@ +normal-dir \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/local-link.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/local-link.txt new file mode 120000 index 0000000000000..b3c6fdbd8bfad --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/local-link.txt @@ -0,0 +1 @@ +normal-file.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/normal-dir/file-in-subdir.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/normal-dir/file-in-subdir.txt new file mode 100644 index 0000000000000..f52de026412b3 --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/normal-dir/file-in-subdir.txt @@ -0,0 +1 @@ +file in subdir diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/normal-file.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/normal-file.txt new file mode 100644 index 0000000000000..d627587e36e77 --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/symlinks/normal-file.txt @@ -0,0 +1 @@ +this is a normal file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/external-link.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/external-link.txt new file mode 120000 index 0000000000000..c7ba61290b25a --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/external-link.txt @@ -0,0 +1 @@ +../symlinks/normal-file.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/file1.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/file1.txt new file mode 100644 index 0000000000000..e2129701f1a4d --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/file1.txt @@ -0,0 +1 @@ +file1 diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/local-link.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/local-link.txt new file mode 120000 index 0000000000000..39cd5762dce4e --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/local-link.txt @@ -0,0 +1 @@ +file1.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir/file2.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir/file2.txt new file mode 100644 index 0000000000000..97bbbd35efdff --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir/file2.txt @@ -0,0 +1 @@ +file2 in subdir \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir2/empty-subdir/.hidden b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir2/empty-subdir/.hidden new file mode 100644 index 0000000000000..b96b7256c6541 --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir2/empty-subdir/.hidden @@ -0,0 +1 @@ +hidden file \ No newline at end of file diff --git a/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir2/subdir3/file3.txt b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir2/subdir3/file3.txt new file mode 100644 index 0000000000000..eae5e936a040d --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/fs/fixtures/test1/subdir2/subdir3/file3.txt @@ -0,0 +1 @@ +file3 in subdir2/subdir3 diff --git a/packages/aws-cdk-lib/assets/test/staging.test.ts b/packages/aws-cdk-lib/assets/test/staging.test.ts new file mode 100644 index 0000000000000..2f77fb5c4dfdb --- /dev/null +++ b/packages/aws-cdk-lib/assets/test/staging.test.ts @@ -0,0 +1,74 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; +import { App, Stack } from '../../core'; +import * as cxapi from '../../cx-api'; +import { Staging } from '../lib'; + +describeDeprecated('staging', () => { + test('base case', () => { + // GIVEN + const stack = new Stack(); + const sourcePath = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const staging = new Staging(stack, 's1', { sourcePath }); + + expect(staging.assetHash).toEqual('2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); + expect(staging.sourcePath).toEqual(sourcePath); + expect(staging.relativeStagedPath(stack)).toEqual('asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); + }); + + test('staging can be disabled through context', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true); + const sourcePath = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const staging = new Staging(stack, 's1', { sourcePath }); + + expect(staging.assetHash).toEqual('2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); + expect(staging.sourcePath).toEqual(sourcePath); + expect(staging.absoluteStagedPath).toEqual(sourcePath); + }); + + test('files are copied to the output directory during synth', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + const file = path.join(__dirname, 'fs', 'fixtures.tar.gz'); + + // WHEN + new Staging(stack, 's1', { sourcePath: directory }); + new Staging(stack, 'file', { sourcePath: file }); + + // THEN + const assembly = app.synth(); + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00', + 'asset.af10ac04b3b607b0f8659c8f0cee8c343025ee75baf0b146f10f0e5311d2c46b.tar.gz', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + }); + + test('allow specifying extra data to include in the source hash', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const withoutExtra = new Staging(stack, 'withoutExtra', { sourcePath: directory }); + const withExtra = new Staging(stack, 'withExtra', { sourcePath: directory, extraHash: 'boom' }); + + // THEN + expect(withoutExtra.assetHash).not.toEqual(withExtra.assetHash); + expect(withoutExtra.assetHash).toEqual('2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'); + expect(withExtra.assetHash).toEqual('c95c915a5722bb9019e2c725d11868e5a619b55f36172f76bcbcaa8bb2d10c5f'); + }); +}); diff --git a/packages/aws-cdk-lib/aws-accessanalyzer/.jsiirc.json b/packages/aws-cdk-lib/aws-accessanalyzer/.jsiirc.json new file mode 100644 index 0000000000000..71341b972cfad --- /dev/null +++ b/packages/aws-cdk-lib/aws-accessanalyzer/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AccessAnalyzer" + }, + "java": { + "package": "software.amazon.awscdk.services.accessanalyzer" + }, + "python": { + "module": "aws_cdk.aws_accessanalyzer" + } + } +} diff --git a/packages/aws-cdk-lib/aws-accessanalyzer/README.md b/packages/aws-cdk-lib/aws-accessanalyzer/README.md new file mode 100644 index 0000000000000..0b8968724332c --- /dev/null +++ b/packages/aws-cdk-lib/aws-accessanalyzer/README.md @@ -0,0 +1,27 @@ +# AWS::AccessAnalyzer Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as accessanalyzer from 'aws-cdk-lib/aws-accessanalyzer'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AccessAnalyzer construct libraries](https://constructs.dev/search?q=accessanalyzer) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AccessAnalyzer resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AccessAnalyzer.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AccessAnalyzer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AccessAnalyzer.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-accessanalyzer/index.ts b/packages/aws-cdk-lib/aws-accessanalyzer/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-accessanalyzer/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-accessanalyzer/lib/index.ts b/packages/aws-cdk-lib/aws-accessanalyzer/lib/index.ts new file mode 100644 index 0000000000000..5f524323afcf4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-accessanalyzer/lib/index.ts @@ -0,0 +1 @@ +export * from './accessanalyzer.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-acmpca/.jsiirc.json b/packages/aws-cdk-lib/aws-acmpca/.jsiirc.json new file mode 100644 index 0000000000000..742262067afd6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-acmpca/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ACMPCA" + }, + "java": { + "package": "software.amazon.awscdk.services.acmpca" + }, + "python": { + "module": "aws_cdk.aws_acmpca" + } + } +} diff --git a/packages/aws-cdk-lib/aws-acmpca/README.md b/packages/aws-cdk-lib/aws-acmpca/README.md new file mode 100644 index 0000000000000..9ee12718ffcea --- /dev/null +++ b/packages/aws-cdk-lib/aws-acmpca/README.md @@ -0,0 +1,59 @@ +# AWS::ACMPCA Construct Library + + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; +``` + +## Certificate Authority + +This package contains a `CertificateAuthority` class. +At the moment, you cannot create new Authorities using it, +but you can import existing ones using the `fromCertificateAuthorityArn` static method: + +```ts +const certificateAuthority = acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CA', + 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77'); +``` + +## Low-level `Cfn*` classes + +You can always use the low-level classes +(starting with `Cfn*`) to create resources like the Certificate Authority: + +```ts +const cfnCertificateAuthority = new acmpca.CfnCertificateAuthority(this, 'CA', { + type: 'ROOT', + keyAlgorithm: 'RSA_2048', + signingAlgorithm: 'SHA256WITHRSA', + subject: { + country: 'US', + organization: 'string', + organizationalUnit: 'string', + distinguishedNameQualifier: 'string', + state: 'string', + commonName: '123', + serialNumber: 'string', + locality: 'string', + title: 'string', + surname: 'string', + givenName: 'string', + initials: 'DG', + pseudonym: 'string', + generationQualifier: 'DBG', + }, +}); +``` + +If you need to pass the higher-level `ICertificateAuthority` somewhere, +you can get it from the lower-level `CfnCertificateAuthority` using the same `fromCertificateAuthorityArn` method: + +```ts +declare const cfnCertificateAuthority: acmpca.CfnCertificateAuthority; + +const certificateAuthority = acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CertificateAuthority', + cfnCertificateAuthority.attrArn); +``` diff --git a/packages/aws-cdk-lib/aws-acmpca/index.ts b/packages/aws-cdk-lib/aws-acmpca/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-acmpca/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-acmpca/lib/certificate-authority.ts b/packages/aws-cdk-lib/aws-acmpca/lib/certificate-authority.ts similarity index 95% rename from packages/@aws-cdk/aws-acmpca/lib/certificate-authority.ts rename to packages/aws-cdk-lib/aws-acmpca/lib/certificate-authority.ts index 2c3131976e925..38e48c8bbcdd8 100644 --- a/packages/@aws-cdk/aws-acmpca/lib/certificate-authority.ts +++ b/packages/aws-cdk-lib/aws-acmpca/lib/certificate-authority.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-acmpca/lib/index.ts b/packages/aws-cdk-lib/aws-acmpca/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-acmpca/lib/index.ts rename to packages/aws-cdk-lib/aws-acmpca/lib/index.ts diff --git a/packages/@aws-cdk/aws-acmpca/test/acmpca.test.ts b/packages/aws-cdk-lib/aws-acmpca/test/acmpca.test.ts similarity index 100% rename from packages/@aws-cdk/aws-acmpca/test/acmpca.test.ts rename to packages/aws-cdk-lib/aws-acmpca/test/acmpca.test.ts diff --git a/packages/aws-cdk-lib/aws-amazonmq/.jsiirc.json b/packages/aws-cdk-lib/aws-amazonmq/.jsiirc.json new file mode 100644 index 0000000000000..d67c797b9f8c8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-amazonmq/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AmazonMQ" + }, + "java": { + "package": "software.amazon.awscdk.services.amazonmq" + }, + "python": { + "module": "aws_cdk.aws_amazonmq" + } + } +} diff --git a/packages/aws-cdk-lib/aws-amazonmq/README.md b/packages/aws-cdk-lib/aws-amazonmq/README.md new file mode 100644 index 0000000000000..8c981d717cb39 --- /dev/null +++ b/packages/aws-cdk-lib/aws-amazonmq/README.md @@ -0,0 +1,27 @@ +# Amazon MQ Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as amazonmq from 'aws-cdk-lib/aws-amazonmq'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AmazonMQ construct libraries](https://constructs.dev/search?q=amazonmq) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AmazonMQ resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmazonMQ.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AmazonMQ](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmazonMQ.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-amazonmq/index.ts b/packages/aws-cdk-lib/aws-amazonmq/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-amazonmq/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-amazonmq/lib/index.ts b/packages/aws-cdk-lib/aws-amazonmq/lib/index.ts new file mode 100644 index 0000000000000..16eb058b6febf --- /dev/null +++ b/packages/aws-cdk-lib/aws-amazonmq/lib/index.ts @@ -0,0 +1 @@ +export * from './amazonmq.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-amplify/.jsiirc.json b/packages/aws-cdk-lib/aws-amplify/.jsiirc.json new file mode 100644 index 0000000000000..b6b3ee1b67ce8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplify/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Amplify" + }, + "java": { + "package": "software.amazon.awscdk.services.amplify" + }, + "python": { + "module": "aws_cdk.aws_amplify" + } + } +} diff --git a/packages/aws-cdk-lib/aws-amplify/README.md b/packages/aws-cdk-lib/aws-amplify/README.md new file mode 100644 index 0000000000000..4bcb2ef4ca83f --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplify/README.md @@ -0,0 +1,32 @@ +# AWS Amplify Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as amplify from 'aws-cdk-lib/aws-amplify'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Amplify construct libraries](https://constructs.dev/search?q=amplify) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Amplify resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Amplify.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-amplify-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Amplify](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Amplify.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-amplify/index.ts b/packages/aws-cdk-lib/aws-amplify/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplify/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-amplify/lib/index.ts b/packages/aws-cdk-lib/aws-amplify/lib/index.ts new file mode 100644 index 0000000000000..55c15eb1a195c --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplify/lib/index.ts @@ -0,0 +1 @@ +export * from './amplify.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-amplifyuibuilder/.jsiirc.json b/packages/aws-cdk-lib/aws-amplifyuibuilder/.jsiirc.json new file mode 100644 index 0000000000000..2c3460e5f7b8d --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplifyuibuilder/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AmplifyUIBuilder" + }, + "java": { + "package": "software.amazon.awscdk.services.amplifyuibuilder" + }, + "python": { + "module": "aws_cdk.aws_amplifyuibuilder" + } + } +} diff --git a/packages/aws-cdk-lib/aws-amplifyuibuilder/README.md b/packages/aws-cdk-lib/aws-amplifyuibuilder/README.md new file mode 100644 index 0000000000000..b2031cb3e7aaa --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplifyuibuilder/README.md @@ -0,0 +1,27 @@ +# AWS::AmplifyUIBuilder Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as amplifyuibuilder from 'aws-cdk-lib/aws-amplifyuibuilder'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AmplifyUIBuilder construct libraries](https://constructs.dev/search?q=amplifyuibuilder) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AmplifyUIBuilder resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmplifyUIBuilder.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AmplifyUIBuilder](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AmplifyUIBuilder.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-amplifyuibuilder/index.ts b/packages/aws-cdk-lib/aws-amplifyuibuilder/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplifyuibuilder/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-amplifyuibuilder/lib/index.ts b/packages/aws-cdk-lib/aws-amplifyuibuilder/lib/index.ts new file mode 100644 index 0000000000000..71d6fee2a2091 --- /dev/null +++ b/packages/aws-cdk-lib/aws-amplifyuibuilder/lib/index.ts @@ -0,0 +1 @@ +export * from './amplifyuibuilder.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigateway/.jsiirc.json b/packages/aws-cdk-lib/aws-apigateway/.jsiirc.json new file mode 100644 index 0000000000000..635a07ce32b60 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.apigateway" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.APIGateway" + }, + "python": { + "module": "aws_cdk.aws_apigateway" + } + } +} diff --git a/packages/aws-cdk-lib/aws-apigateway/README.md b/packages/aws-cdk-lib/aws-apigateway/README.md new file mode 100644 index 0000000000000..c97feff153724 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/README.md @@ -0,0 +1,1478 @@ +# Amazon API Gateway Construct Library + + +Amazon API Gateway is a fully managed service that makes it easy for developers +to publish, maintain, monitor, and secure APIs at any scale. Create an API to +access data, business logic, or functionality from your back-end services, such +as applications running on Amazon Elastic Compute Cloud (Amazon EC2), code +running on AWS Lambda, or any web application. + +## Table of Contents + +- [Defining APIs](#defining-apis) + - [Breaking up Methods and Resources across Stacks](#breaking-up-methods-and-resources-across-stacks) +- [AWS Lambda-backed APIs](#aws-lambda-backed-apis) +- [AWS StepFunctions backed APIs](#aws-stepfunctions-backed-APIs) +- [Integration Targets](#integration-targets) +- [Usage Plan & API Keys](#usage-plan--api-keys) +- [Working with models](#working-with-models) +- [Default Integration and Method Options](#default-integration-and-method-options) +- [Proxy Routes](#proxy-routes) +- [Authorizers](#authorizers) + - [IAM-based authorizer](#iam-based-authorizer) + - [Lambda-based token authorizer](#lambda-based-token-authorizer) + - [Lambda-based request authorizer](#lambda-based-request-authorizer) + - [Cognito User Pools authorizer](#cognito-user-pools-authorizer) +- [Mutual TLS](#mutal-tls-mtls) +- [Deployments](#deployments) + - [Deep dive: Invalidation of deployments](#deep-dive-invalidation-of-deployments) +- [Custom Domains](#custom-domains) +- [Access Logging](#access-logging) +- [Cross Origin Resource Sharing (CORS)](#cross-origin-resource-sharing-cors) +- [Endpoint Configuration](#endpoint-configuration) +- [Private Integrations](#private-integrations) +- [Gateway Response](#gateway-response) +- [OpenAPI Definition](#openapi-definition) + - [Endpoint configuration](#endpoint-configuration) +- [Metrics](#metrics) +- [APIGateway v2](#apigateway-v2) + +## Defining APIs + +APIs are defined as a hierarchy of resources and methods. `addResource` and +`addMethod` can be used to build this hierarchy. The root resource is +`api.root`. + +For example, the following code defines an API that includes the following HTTP +endpoints: `ANY /`, `GET /books`, `POST /books`, `GET /books/{book_id}`, `DELETE /books/{book_id}`. + +```ts +const api = new apigateway.RestApi(this, 'books-api'); + +api.root.addMethod('ANY'); + +const books = api.root.addResource('books'); +books.addMethod('GET'); +books.addMethod('POST'); + +const book = books.addResource('{book_id}'); +book.addMethod('GET'); +book.addMethod('DELETE'); +``` + +## AWS Lambda-backed APIs + +A very common practice is to use Amazon API Gateway with AWS Lambda as the +backend integration. The `LambdaRestApi` construct makes it easy: + +The following code defines a REST API that routes all requests to the +specified AWS Lambda function: + +```ts +declare const backend: lambda.Function; +new apigateway.LambdaRestApi(this, 'myapi', { + handler: backend, +}); +``` + +You can also supply `proxy: false`, in which case you will have to explicitly +define the API model: + +```ts +declare const backend: lambda.Function; +const api = new apigateway.LambdaRestApi(this, 'myapi', { + handler: backend, + proxy: false +}); + +const items = api.root.addResource('items'); +items.addMethod('GET'); // GET /items +items.addMethod('POST'); // POST /items + +const item = items.addResource('{item}'); +item.addMethod('GET'); // GET /items/{item} + +// the default integration for methods is "handler", but one can +// customize this behavior per method or even a sub path. +item.addMethod('DELETE', new apigateway.HttpIntegration('http://amazon.com')); +``` + +Additionally, `integrationOptions` can be supplied to explicitly define +options of the Lambda integration: + +```ts +declare const backend: lambda.Function; + +const api = new apigateway.LambdaRestApi(this, 'myapi', { + handler: backend, + integrationOptions: { + allowTestInvoke: false, + timeout: Duration.seconds(1), + } +}) +``` + +## AWS StepFunctions backed APIs + +You can use Amazon API Gateway with AWS Step Functions as the backend integration, specifically Synchronous Express Workflows. + +The `StepFunctionsRestApi` only supports integration with Synchronous Express state machine. The `StepFunctionsRestApi` construct makes this easy by setting up input, output and error mapping. + +The construct sets up an API endpoint and maps the `ANY` HTTP method and any calls to the API endpoint starts an express workflow execution for the underlying state machine. + +Invoking the endpoint with any HTTP method (`GET`, `POST`, `PUT`, `DELETE`, ...) in the example below will send the request to the state machine as a new execution. On success, an HTTP code `200` is returned with the execution output as the Response Body. + +If the execution fails, an HTTP `500` response is returned with the `error` and `cause` from the execution output as the Response Body. If the request is invalid (ex. bad execution input) HTTP code `400` is returned. + +The response from the invocation contains only the `output` field from the +[StartSyncExecution](https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartSyncExecution.html#API_StartSyncExecution_ResponseSyntax) API. +In case of failures, the fields `error` and `cause` are returned as part of the response. +Other metadata such as billing details, AWS account ID and resource ARNs are not returned in the API response. + +By default, a `prod` stage is provisioned. + +In order to reduce the payload size sent to AWS Step Functions, `headers` are not forwarded to the Step Functions execution input. It is possible to choose whether `headers`, `requestContext`, `path`, `querystring`, and `authorizer` are included or not. By default, `headers` are excluded in all requests. + +More details about AWS Step Functions payload limit can be found at https://docs.aws.amazon.com/step-functions/latest/dg/limits-overview.html#service-limits-task-executions. + +The following code defines a REST API that routes all requests to the specified AWS StepFunctions state machine: + +```ts +const stateMachineDefinition = new stepfunctions.Pass(this, 'PassState'); + +const stateMachine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', { + definition: stateMachineDefinition, + stateMachineType: stepfunctions.StateMachineType.EXPRESS, +}); + +new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', { + deploy: true, + stateMachine: stateMachine, +}); +``` + +When the REST API endpoint configuration above is invoked using POST, as follows - + +```bash +curl -X POST -d '{ "customerId": 1 }' https://example.com/ +``` + +AWS Step Functions will receive the request body in its input as follows: + +```json +{ + "body": { + "customerId": 1 + }, + "path": "/", + "querystring": {} +} +``` + +When the endpoint is invoked at path '/users/5' using the HTTP GET method as below: + +```bash +curl -X GET https://example.com/users/5?foo=bar +``` + +AWS Step Functions will receive the following execution input: + +```json +{ + "body": {}, + "path": { + "users": "5" + }, + "querystring": { + "foo": "bar" + } +} +``` + +Additional information around the request such as the request context, authorizer context, and headers can be included as part of the input +forwarded to the state machine. The following example enables headers to be included in the input but not query string. + +```ts fixture=stepfunctions +new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', { + stateMachine: machine, + headers: true, + path: false, + querystring: false, + authorizer: false, + requestContext: { + caller: true, + user: true, + }, +}); +``` + +In such a case, when the endpoint is invoked as below: + +```bash +curl -X GET https://example.com/ +``` + +AWS Step Functions will receive the following execution input: + +```json +{ + "headers": { + "Accept": "...", + "CloudFront-Forwarded-Proto": "...", + }, + "requestContext": { + "accountId": "...", + "apiKey": "...", + }, + "body": {} +} +``` + +### Breaking up Methods and Resources across Stacks + +It is fairly common for REST APIs with a large number of Resources and Methods to hit the [CloudFormation +limit](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) of 500 resources per +stack. + +To help with this, Resources and Methods for the same REST API can be re-organized across multiple stacks. A common +way to do this is to have a stack per Resource or groups of Resources, but this is not the only possible way. +The following example uses sets up two Resources '/pets' and '/books' in separate stacks using nested stacks: + +[Resources grouped into nested stacks](test/integ.restapi-import.lit.ts) + +## Integration Targets + +Methods are associated with backend integrations, which are invoked when this +method is called. API Gateway supports the following integrations: + +- `MockIntegration` - can be used to test APIs. This is the default + integration if one is not specified. +- `LambdaIntegration` - can be used to invoke an AWS Lambda function. +- `AwsIntegration` - can be used to invoke arbitrary AWS service APIs. +- `HttpIntegration` - can be used to invoke HTTP endpoints. + +The following example shows how to integrate the `GET /book/{book_id}` method to +an AWS Lambda function: + +```ts +declare const getBookHandler: lambda.Function; +declare const book: apigateway.Resource; + +const getBookIntegration = new apigateway.LambdaIntegration(getBookHandler); +book.addMethod('GET', getBookIntegration); +``` + +Integration options can be optionally be specified: + +```ts +declare const getBookHandler: lambda.Function; +declare const getBookIntegration: apigateway.LambdaIntegration; + +const getBookIntegration = new apigateway.LambdaIntegration(getBookHandler, { + contentHandling: apigateway.ContentHandling.CONVERT_TO_TEXT, // convert to base64 + credentialsPassthrough: true, // use caller identity to invoke the function +}); +``` + +Method options can optionally be specified when adding methods: + +```ts +declare const book: apigateway.Resource; +declare const getBookIntegration: apigateway.LambdaIntegration; + +book.addMethod('GET', getBookIntegration, { + authorizationType: apigateway.AuthorizationType.IAM, + apiKeyRequired: true +}); +``` + +It is possible to also integrate with AWS services in a different region. The following code integrates with Amazon SQS in the +`eu-west-1` region. + +```ts +const getMessageIntegration = new apigateway.AwsIntegration({ + service: 'sqs', + path: 'queueName', + region: 'eu-west-1' +}); +``` + +## Usage Plan & API Keys + +A usage plan specifies who can access one or more deployed API stages and methods, and the rate at which they can be +accessed. The plan uses API keys to identify API clients and meters access to the associated API stages for each key. +Usage plans also allow configuring throttling limits and quota limits that are enforced on individual client API keys. + +The following example shows how to create and associate a usage plan and an API key: + +```ts +declare const integration: apigateway.LambdaIntegration; + +const api = new apigateway.RestApi(this, 'hello-api'); + +const v1 = api.root.addResource('v1'); +const echo = v1.addResource('echo'); +const echoMethod = echo.addMethod('GET', integration, { apiKeyRequired: true }); + +const plan = api.addUsagePlan('UsagePlan', { + name: 'Easy', + throttle: { + rateLimit: 10, + burstLimit: 2 + } +}); + +const key = api.addApiKey('ApiKey'); +plan.addApiKey(key); +``` + +To associate a plan to a given RestAPI stage: + +```ts +declare const plan: apigateway.UsagePlan; +declare const api: apigateway.RestApi; +declare const echoMethod: apigateway.Method; + +plan.addApiStage({ + stage: api.deploymentStage, + throttle: [ + { + method: echoMethod, + throttle: { + rateLimit: 10, + burstLimit: 2 + } + } + ] +}); +``` + +Existing usage plans can be imported into a CDK app using its id. + +```ts +const importedUsagePlan = apigateway.UsagePlan.fromUsagePlanId(this, 'imported-usage-plan', ''); +``` + +The name and value of the API Key can be specified at creation; if not +provided, a name and value will be automatically generated by API Gateway. + +```ts +declare const api: apigateway.RestApi; +const key = api.addApiKey('ApiKey', { + apiKeyName: 'myApiKey1', + value: 'MyApiKeyThatIsAtLeast20Characters', +}); +``` + +Existing API keys can also be imported into a CDK app using its id. + +```ts +const importedKey = apigateway.ApiKey.fromApiKeyId(this, 'imported-key', ''); +``` + +The "grant" methods can be used to give prepackaged sets of permissions to other resources. The +following code provides read permission to an API key. + +```ts +declare const importedKey: apigateway.ApiKey; +declare const lambdaFn: lambda.Function; +importedKey.grantRead(lambdaFn); +``` + +### Adding an API Key to an imported RestApi + +API Keys are added to ApiGateway Stages, not to the API itself. When you import a RestApi +it does not have any information on the Stages that may be associated with it. Since adding an API +Key requires a stage, you should instead add the Api Key to the imported Stage. + +```ts +declare const restApi: apigateway.IRestApi; +const importedStage = apigateway.Stage.fromStageAttributes(this, 'imported-stage', { + stageName: 'myStageName', + restApi, +}); + +importedStage.addApiKey('MyApiKey'); +``` + +### ⚠️ Multiple API Keys + +It is possible to specify multiple API keys for a given Usage Plan, by calling `usagePlan.addApiKey()`. + +When using multiple API keys, a past bug of the CDK prevents API key associations to a Usage Plan to be deleted. +If the CDK app had the [feature flag] - `@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId` - enabled when the API +keys were created, then the app will not be affected by this bug. + +If this is not the case, you will need to ensure that the CloudFormation [logical ids] of the API keys that are not +being deleted remain unchanged. +Make note of the logical ids of these API keys before removing any, and set it as part of the `addApiKey()` method: + +```ts +declare const usageplan: apigateway.UsagePlan; +declare const apiKey: apigateway.ApiKey; + +usageplan.addApiKey(apiKey, { + overrideLogicalId: '...', +}); +``` + +[feature flag]: https://docs.aws.amazon.com/cdk/latest/guide/featureflags.html +[logical ids]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html + +### Rate Limited API Key + +In scenarios where you need to create a single api key and configure rate limiting for it, you can use `RateLimitedApiKey`. +This construct lets you specify rate limiting properties which should be applied only to the api key being created. +The API key created has the specified rate limits, such as quota and throttles, applied. + +The following example shows how to use a rate limited api key : + +```ts +declare const api: apigateway.RestApi; + +const key = new apigateway.RateLimitedApiKey(this, 'rate-limited-api-key', { + customerId: 'hello-customer', + stages: [api.deploymentStage], + quota: { + limit: 10000, + period: apigateway.Period.MONTH + } +}); +``` + +## Working with models + +When you work with Lambda integrations that are not Proxy integrations, you +have to define your models and mappings for the request, response, and integration. + +```ts +const hello = new lambda.Function(this, 'hello', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromAsset('lambda') +}); + +const api = new apigateway.RestApi(this, 'hello-api', { }); +const resource = api.root.addResource('v1'); +``` + +You can define more parameters on the integration to tune the behavior of API Gateway + +```ts +declare const hello: lambda.Function; + +const integration = new apigateway.LambdaIntegration(hello, { + proxy: false, + requestParameters: { + // You can define mapping parameters from your method to your integration + // - Destination parameters (the key) are the integration parameters (used in mappings) + // - Source parameters (the value) are the source request parameters or expressions + // @see: https://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html + 'integration.request.querystring.who': 'method.request.querystring.who' + }, + allowTestInvoke: true, + requestTemplates: { + // You can define a mapping that will build a payload for your integration, based + // on the integration parameters that you have specified + // Check: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html + 'application/json': JSON.stringify({ action: 'sayHello', pollId: "$util.escapeJavaScript($input.params('who'))" }) + }, + // This parameter defines the behavior of the engine is no suitable response template is found + passthroughBehavior: apigateway.PassthroughBehavior.NEVER, + integrationResponses: [ + { + // Successful response from the Lambda function, no filter defined + // - the selectionPattern filter only tests the error message + // We will set the response status code to 200 + statusCode: "200", + responseTemplates: { + // This template takes the "message" result from the Lambda function, and embeds it in a JSON response + // Check https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html + 'application/json': JSON.stringify({ state: 'ok', greeting: '$util.escapeJavaScript($input.body)' }) + }, + responseParameters: { + // We can map response parameters + // - Destination parameters (the key) are the response parameters (used in mappings) + // - Source parameters (the value) are the integration response parameters or expressions + 'method.response.header.Content-Type': "'application/json'", + 'method.response.header.Access-Control-Allow-Origin': "'*'", + 'method.response.header.Access-Control-Allow-Credentials': "'true'" + } + }, + { + // For errors, we check if the error message is not empty, get the error data + selectionPattern: '(\n|.)+', + // We will set the response status code to 200 + statusCode: "400", + responseTemplates: { + 'application/json': JSON.stringify({ state: 'error', message: "$util.escapeJavaScript($input.path('$.errorMessage'))" }) + }, + responseParameters: { + 'method.response.header.Content-Type': "'application/json'", + 'method.response.header.Access-Control-Allow-Origin': "'*'", + 'method.response.header.Access-Control-Allow-Credentials': "'true'" + } + } + ] +}); + +``` + +You can define models for your responses (and requests) + +```ts +declare const api: apigateway.RestApi; + +// We define the JSON Schema for the transformed valid response +const responseModel = api.addModel('ResponseModel', { + contentType: 'application/json', + modelName: 'ResponseModel', + schema: { + schema: apigateway.JsonSchemaVersion.DRAFT4, + title: 'pollResponse', + type: apigateway.JsonSchemaType.OBJECT, + properties: { + state: { type: apigateway.JsonSchemaType.STRING }, + greeting: { type: apigateway.JsonSchemaType.STRING } + } + } +}); + +// We define the JSON Schema for the transformed error response +const errorResponseModel = api.addModel('ErrorResponseModel', { + contentType: 'application/json', + modelName: 'ErrorResponseModel', + schema: { + schema: apigateway.JsonSchemaVersion.DRAFT4, + title: 'errorResponse', + type: apigateway.JsonSchemaType.OBJECT, + properties: { + state: { type: apigateway.JsonSchemaType.STRING }, + message: { type: apigateway.JsonSchemaType.STRING } + } + } +}); + +``` + +And reference all on your method definition. + +```ts +declare const integration: apigateway.LambdaIntegration; +declare const resource: apigateway.Resource; +declare const responseModel: apigateway.Model; +declare const errorResponseModel: apigateway.Model; + +resource.addMethod('GET', integration, { + // We can mark the parameters as required + requestParameters: { + 'method.request.querystring.who': true + }, + // we can set request validator options like below + requestValidatorOptions: { + requestValidatorName: 'test-validator', + validateRequestBody: true, + validateRequestParameters: false + }, + methodResponses: [ + { + // Successful response from the integration + statusCode: '200', + // Define what parameters are allowed or not + responseParameters: { + 'method.response.header.Content-Type': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Access-Control-Allow-Credentials': true + }, + // Validate the schema on the response + responseModels: { + 'application/json': responseModel + } + }, + { + // Same thing for the error responses + statusCode: '400', + responseParameters: { + 'method.response.header.Content-Type': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Access-Control-Allow-Credentials': true + }, + responseModels: { + 'application/json': errorResponseModel + } + } + ] +}); +``` + +Specifying `requestValidatorOptions` automatically creates the RequestValidator construct with the given options. +However, if you have your RequestValidator already initialized or imported, use the `requestValidator` option instead. + +## Default Integration and Method Options + +The `defaultIntegration` and `defaultMethodOptions` properties can be used to +configure a default integration at any resource level. These options will be +used when defining method under this resource (recursively) with undefined +integration or options. + +> If not defined, the default integration is `MockIntegration`. See reference +documentation for default method options. + +The following example defines the `booksBackend` integration as a default +integration. This means that all API methods that do not explicitly define an +integration will be routed to this AWS Lambda function. + +```ts +declare const booksBackend: apigateway.LambdaIntegration; +const api = new apigateway.RestApi(this, 'books', { + defaultIntegration: booksBackend +}); + +const books = api.root.addResource('books'); +books.addMethod('GET'); // integrated with `booksBackend` +books.addMethod('POST'); // integrated with `booksBackend` + +const book = books.addResource('{book_id}'); +book.addMethod('GET'); // integrated with `booksBackend` +``` + +A Method can be configured with authorization scopes. Authorization scopes are +used in conjunction with an [authorizer that uses Amazon Cognito user +pools](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html#apigateway-enable-cognito-user-pool). +Read more about authorization scopes +[here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationscopes). + +Authorization scopes for a Method can be configured using the `authorizationScopes` property as shown below - + +```ts +declare const books: apigateway.Resource; + +books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { + authorizationType: apigateway.AuthorizationType.COGNITO, + authorizationScopes: ['Scope1','Scope2'] +}); +``` + +## Proxy Routes + +The `addProxy` method can be used to install a greedy `{proxy+}` resource +on a path. By default, this also installs an `"ANY"` method: + +```ts +declare const resource: apigateway.Resource; +declare const handler: lambda.Function; +const proxy = resource.addProxy({ + defaultIntegration: new apigateway.LambdaIntegration(handler), + + // "false" will require explicitly adding methods on the `proxy` resource + anyMethod: true // "true" is the default +}); +``` + +## Authorizers + +API Gateway [supports several different authorization types](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-to-api.html) +that can be used for controlling access to your REST APIs. + +### IAM-based authorizer + +The following CDK code provides 'execute-api' permission to an IAM user, via IAM policies, for the 'GET' method on the `books` resource: + +```ts +declare const books: apigateway.Resource; +declare const iamUser: iam.User; + +const getBooks = books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { + authorizationType: apigateway.AuthorizationType.IAM +}); + +iamUser.attachInlinePolicy(new iam.Policy(this, 'AllowBooks', { + statements: [ + new iam.PolicyStatement({ + actions: [ 'execute-api:Invoke' ], + effect: iam.Effect.ALLOW, + resources: [ getBooks.methodArn ] + }) + ] +})) +``` + +### Lambda-based token authorizer + +API Gateway also allows [lambda functions to be used as authorizers](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html). + +This module provides support for token-based Lambda authorizers. When a client makes a request to an API's methods configured with such +an authorizer, API Gateway calls the Lambda authorizer, which takes the caller's identity as input and returns an IAM policy as output. +A token-based Lambda authorizer (also called a token authorizer) receives the caller's identity in a bearer token, such as +a JSON Web Token (JWT) or an OAuth token. + +API Gateway interacts with the authorizer Lambda function handler by passing input and expecting the output in a specific format. +The event object that the handler is called with contains the `authorizationToken` and the `methodArn` from the request to the +API Gateway endpoint. The handler is expected to return the `principalId` (i.e. the client identifier) and a `policyDocument` stating +what the client is authorizer to perform. +See [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html) for a detailed specification on +inputs and outputs of the Lambda handler. + +The following code attaches a token-based Lambda authorizer to the 'GET' Method of the Book resource: + +```ts +declare const authFn: lambda.Function; +declare const books: apigateway.Resource; + +const auth = new apigateway.TokenAuthorizer(this, 'booksAuthorizer', { + handler: authFn +}); + +books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { + authorizer: auth +}); +``` + +A full working example is shown below. + +```ts +import * as path from 'path'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { App, Stack } from 'aws-cdk-lib'; +import { MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer, Cors } from '../../lib'; + +/// !show +const app = new App(); +const stack = new Stack(app, 'TokenAuthorizerInteg'); + +const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')), +}); + +const authorizer = new TokenAuthorizer(stack, 'MyAuthorizer', { + handler: authorizerFn, +}); + +const restapi = new RestApi(stack, 'MyRestApi', { + cloudWatchRole: true, + defaultMethodOptions: { + authorizer, + }, + defaultCorsPreflightOptions: { + allowOrigins: Cors.ALL_ORIGINS, + }, +}); + + +restapi.root.addMethod('ANY', new MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], +}); +``` + +By default, the `TokenAuthorizer` looks for the authorization token in the request header with the key 'Authorization'. This can, +however, be modified by changing the `identitySource` property. + +Authorizers can also be passed via the `defaultMethodOptions` property within the `RestApi` construct or the `Method` construct. Unless +explicitly overridden, the specified defaults will be applied across all `Method`s across the `RestApi` or across all `Resource`s, +depending on where the defaults were specified. + +### Lambda-based request authorizer + +This module provides support for request-based Lambda authorizers. When a client makes a request to an API's methods configured with such +an authorizer, API Gateway calls the Lambda authorizer, which takes specified parts of the request, known as identity sources, +as input and returns an IAM policy as output. A request-based Lambda authorizer (also called a request authorizer) receives +the identity sources in a series of values pulled from the request, from the headers, stage variables, query strings, and the context. + +API Gateway interacts with the authorizer Lambda function handler by passing input and expecting the output in a specific format. +The event object that the handler is called with contains the body of the request and the `methodArn` from the request to the +API Gateway endpoint. The handler is expected to return the `principalId` (i.e. the client identifier) and a `policyDocument` stating +what the client is authorizer to perform. +See [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html) for a detailed specification on +inputs and outputs of the Lambda handler. + +The following code attaches a request-based Lambda authorizer to the 'GET' Method of the Book resource: + +```ts +declare const authFn: lambda.Function; +declare const books: apigateway.Resource; + +const auth = new apigateway.RequestAuthorizer(this, 'booksAuthorizer', { + handler: authFn, + identitySources: [apigateway.IdentitySource.header('Authorization')] +}); + +books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { + authorizer: auth +}); +``` + +A full working example is shown below. + +[Full request authorizer example](test/authorizers/integ.request-authorizer.lit.ts). + +By default, the `RequestAuthorizer` does not pass any kind of information from the request. This can, +however, be modified by changing the `identitySource` property, and is required when specifying a value for caching. + +Authorizers can also be passed via the `defaultMethodOptions` property within the `RestApi` construct or the `Method` construct. Unless +explicitly overridden, the specified defaults will be applied across all `Method`s across the `RestApi` or across all `Resource`s, +depending on where the defaults were specified. + +### Cognito User Pools authorizer + +API Gateway also allows [Amazon Cognito user pools as authorizer](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html) + +The following snippet configures a Cognito user pool as an authorizer: + +```ts +const userPool = new cognito.UserPool(this, 'UserPool'); + +const auth = new apigateway.CognitoUserPoolsAuthorizer(this, 'booksAuthorizer', { + cognitoUserPools: [userPool] +}); + +declare const books: apigateway.Resource; +books.addMethod('GET', new apigateway.HttpIntegration('http://amazon.com'), { + authorizer: auth, + authorizationType: apigateway.AuthorizationType.COGNITO, +}); +``` + +## Mutual TLS (mTLS) + +Mutual TLS can be configured to limit access to your API based by using client certificates instead of (or as an extension of) using authorization headers. + +```ts +declare const acm: any; + +new apigateway.DomainName(this, 'domain-name', { + domainName: 'example.com', + certificate: acm.Certificate.fromCertificateArn(this, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + mtls: { + bucket: new s3.Bucket(this, 'bucket'), + key: 'truststore.pem', + version: 'version', + }, +}); +``` + +Instructions for configuring your trust store can be found [here](https://aws.amazon.com/blogs/compute/introducing-mutual-tls-authentication-for-amazon-api-gateway/). + +## Deployments + +By default, the `RestApi` construct will automatically create an API Gateway +[Deployment] and a "prod" [Stage] which represent the API configuration you +defined in your CDK app. This means that when you deploy your app, your API will +be have open access from the internet via the stage URL. + +The URL of your API can be obtained from the attribute `restApi.url`, and is +also exported as an `Output` from your stack, so it's printed when you `cdk +deploy` your app: + +```console +$ cdk deploy +... +books.booksapiEndpointE230E8D5 = https://6lyktd4lpk.execute-api.us-east-1.amazonaws.com/prod/ +``` + +To disable this behavior, you can set `{ deploy: false }` when creating your +API. This means that the API will not be deployed and a stage will not be +created for it. You will need to manually define a `apigateway.Deployment` and +`apigateway.Stage` resources. + +Use the `deployOptions` property to customize the deployment options of your +API. + +The following example will configure API Gateway to emit logs and data traces to +AWS CloudWatch for all API calls: + +> Note: whether or not this is enabled or disabled by default is controlled by the +`@aws-cdk/aws-apigateway:disableCloudWatchRole` feature flag. When this feature flag +is set to `false` the default behavior will set `cloudWatchRole=true` + +This is controlled via the `@aws-cdk/aws-apigateway:disableCloudWatchRole` feature flag and +is disabled by default. When enabled (or `@aws-cdk/aws-apigateway:disableCloudWatchRole=false`), +an IAM role will be created and associated with API Gateway to allow it to write logs and metrics to AWS CloudWatch. + +```ts +const api = new apigateway.RestApi(this, 'books', { + cloudWatchRole: true, + deployOptions: { + loggingLevel: apigateway.MethodLoggingLevel.INFO, + dataTraceEnabled: true + } +}) +``` + +> Note: there can only be a single apigateway.CfnAccount per AWS environment +so if you create multiple `RestApi`s with `cloudWatchRole=true` each new `RestApi` +will overwrite the `CfnAccount`. It is recommended to set `cloudWatchRole=false` +(the default behavior if `@aws-cdk/aws-apigateway:disableCloudWatchRole` is enabled) +and only create a single CloudWatch role and account per environment. + +### Deep dive: Invalidation of deployments + +API Gateway deployments are an immutable snapshot of the API. This means that we +want to automatically create a new deployment resource every time the API model +defined in our CDK app changes. + +In order to achieve that, the AWS CloudFormation logical ID of the +`AWS::ApiGateway::Deployment` resource is dynamically calculated by hashing the +API configuration (resources, methods). This means that when the configuration +changes (i.e. a resource or method are added, configuration is changed), a new +logical ID will be assigned to the deployment resource. This will cause +CloudFormation to create a new deployment resource. + +By default, old deployments are _deleted_. You can set `retainDeployments: true` +to allow users revert the stage to an old deployment manually. + +[Deployment]: https://docs.aws.amazon.com/apigateway/api-reference/resource/deployment/ +[Stage]: https://docs.aws.amazon.com/apigateway/api-reference/resource/stage/ + +In order to also create a new deployment when changes are made to any authorizer attached to the API, +the `@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId` [feature flag](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html) can be enabled. This can be set +in the `cdk.json` file. + +```json +{ + "context": { + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true + } +} +``` + +## Custom Domains + +To associate an API with a custom domain, use the `domainName` configuration when +you define your API: + +```ts +declare const acmCertificateForExampleCom: any; + +const api = new apigateway.RestApi(this, 'MyDomain', { + domainName: { + domainName: 'example.com', + certificate: acmCertificateForExampleCom, + }, +}); +``` + +This will define a `DomainName` resource for you, along with a `BasePathMapping` +from the root of the domain to the deployment stage of the API. This is a common +set up. + +To route domain traffic to an API Gateway API, use Amazon Route 53 to create an +alias record. An alias record is a Route 53 extension to DNS. It's similar to a +CNAME record, but you can create an alias record both for the root domain, such +as `example.com`, and for subdomains, such as `www.example.com`. (You can create +CNAME records only for subdomains.) + +```ts +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; + +declare const api: apigateway.RestApi; +declare const hostedZoneForExampleCom: any; + +new route53.ARecord(this, 'CustomDomainAliasRecord', { + zone: hostedZoneForExampleCom, + target: route53.RecordTarget.fromAlias(new targets.ApiGateway(api)) +}); +``` + +You can also define a `DomainName` resource directly in order to customize the default behavior: + +```ts +declare const acmCertificateForExampleCom: any; + +new apigateway.DomainName(this, 'custom-domain', { + domainName: 'example.com', + certificate: acmCertificateForExampleCom, + endpointType: apigateway.EndpointType.EDGE, // default is REGIONAL + securityPolicy: apigateway.SecurityPolicy.TLS_1_2 +}); +``` + +Once you have a domain, you can map base paths of the domain to APIs. +The following example will map the URL +to the `api1` API and to the `api2` API. + +```ts +declare const domain: apigateway.DomainName; +declare const api1: apigateway.RestApi; +declare const api2: apigateway.RestApi; + +domain.addBasePathMapping(api1, { basePath: 'go-to-api1' }); +domain.addBasePathMapping(api2, { basePath: 'boom' }); +``` + +By default, the base path URL will map to the `deploymentStage` of the `RestApi`. +You can specify a different API `Stage` to which the base path URL will map to. + +```ts +declare const domain: apigateway.DomainName; +declare const restapi: apigateway.RestApi; + +const betaDeploy = new apigateway.Deployment(this, 'beta-deployment', { + api: restapi, +}); +const betaStage = new apigateway.Stage(this, 'beta-stage', { + deployment: betaDeploy, +}); +domain.addBasePathMapping(restapi, { basePath: 'api/beta', stage: betaStage }); +``` + +It is possible to create a base path mapping without associating it with a +stage by using the `attachToStage` property. When set to `false`, the stage must be +included in the URL when invoking the API. For example, + will invoke the stage named `prod` from the +`myapi` base path mapping. + +```ts +declare const domain: apigateway.DomainName; +declare const api: apigateway.RestApi; + +domain.addBasePathMapping(api, { basePath: 'myapi', attachToStage: false }); +``` + +If you don't specify `basePath`, all URLs under this domain will be mapped +to the API, and you won't be able to map another API to the same domain: + +```ts +declare const domain: apigateway.DomainName; +declare const api: apigateway.RestApi; +domain.addBasePathMapping(api); +``` + +This can also be achieved through the `mapping` configuration when defining the +domain as demonstrated above. + +Base path mappings can also be created with the `BasePathMapping` resource. + +```ts +declare const api: apigateway.RestApi; + +const domainName = apigateway.DomainName.fromDomainNameAttributes(this, 'DomainName', { + domainName: 'domainName', + domainNameAliasHostedZoneId: 'domainNameAliasHostedZoneId', + domainNameAliasTarget: 'domainNameAliasTarget', +}); + +new apigateway.BasePathMapping(this, 'BasePathMapping', { + domainName: domainName, + restApi: api, +}); +``` + +If you wish to setup this domain with an Amazon Route53 alias, use the `targets.ApiGatewayDomain`: + +```ts +declare const hostedZoneForExampleCom: any; +declare const domainName: apigateway.DomainName; + +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; + +new route53.ARecord(this, 'CustomDomainAliasRecord', { + zone: hostedZoneForExampleCom, + target: route53.RecordTarget.fromAlias(new targets.ApiGatewayDomain(domainName)) +}); +``` + +### Custom Domains with multi-level api mapping + +Additional requirements for creating multi-level path mappings for RestApis: + +(both are defaults) + +- Must use `SecurityPolicy.TLS_1_2` +- DomainNames must be `EndpointType.REGIONAL` + +```ts +declare const acmCertificateForExampleCom: any; +declare const restApi: apigateway.RestApi; + +new apigateway.DomainName(this, 'custom-domain', { + domainName: 'example.com', + certificate: acmCertificateForExampleCom, + mapping: restApi, + basePath: 'orders/v1/api', +}); +``` + +To then add additional mappings to a domain you can use the `addApiMapping` method. + +```ts +declare const acmCertificateForExampleCom: any; +declare const restApi: apigateway.RestApi; +declare const secondRestApi: apigateway.RestApi; + +const domain = new apigateway.DomainName(this, 'custom-domain', { + domainName: 'example.com', + certificate: acmCertificateForExampleCom, + mapping: restApi, +}); + +domain.addApiMapping(secondRestApi.deploymentStage, { + basePath: 'orders/v2/api', +}); +``` + +## Access Logging + +Access logging creates logs every time an API method is accessed. Access logs can have information on +who has accessed the API, how the caller accessed the API and what responses were generated. +Access logs are configured on a Stage of the RestApi. +Access logs can be expressed in a format of your choosing, and can contain any access details, with a +minimum that it must include either 'requestId' or 'extendedRequestId'. The list of variables that +can be expressed in the access log can be found +[here](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference). +Read more at [Setting Up CloudWatch API Logging in API +Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html) + +```ts +// production stage +const prdLogGroup = new logs.LogGroup(this, "PrdLogs"); +const api = new apigateway.RestApi(this, 'books', { + deployOptions: { + accessLogDestination: new apigateway.LogGroupLogDestination(prdLogGroup), + accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields(), + }, +}); +const deployment = new apigateway.Deployment(this, 'Deployment', {api}); + +// development stage +const devLogGroup = new logs.LogGroup(this, "DevLogs"); +new apigateway.Stage(this, 'dev', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(devLogGroup), + accessLogFormat: apigateway.AccessLogFormat.jsonWithStandardFields({ + caller: false, + httpMethod: true, + ip: true, + protocol: true, + requestTime: true, + resourcePath: true, + responseLength: true, + status: true, + user: true, + }), +}); +``` + +The following code will generate the access log in the [CLF format](https://en.wikipedia.org/wiki/Common_Log_Format). + +```ts +const logGroup = new logs.LogGroup(this, "ApiGatewayAccessLogs"); +const api = new apigateway.RestApi(this, 'books', { + deployOptions: { + accessLogDestination: new apigateway.LogGroupLogDestination(logGroup), + accessLogFormat: apigateway.AccessLogFormat.clf(), + }}); +``` + +You can also configure your own access log format by using the `AccessLogFormat.custom()` API. +`AccessLogField` provides commonly used fields. The following code configures access log to contain. + +```ts +const logGroup = new logs.LogGroup(this, "ApiGatewayAccessLogs"); +new apigateway.RestApi(this, 'books', { + deployOptions: { + accessLogDestination: new apigateway.LogGroupLogDestination(logGroup), + accessLogFormat: apigateway.AccessLogFormat.custom( + `${apigateway.AccessLogField.contextRequestId()} ${apigateway.AccessLogField.contextErrorMessage()} ${apigateway.AccessLogField.contextErrorMessageString()} + ${apigateway.AccessLogField.contextAuthorizerError()} ${apigateway.AccessLogField.contextAuthorizerIntegrationStatus()}` + ) + } +}); +``` + +You can use the `methodOptions` property to configure +[default method throttling](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html#apigateway-api-level-throttling-in-usage-plan) +for a stage. The following snippet configures the a stage that accepts +100 requests per minute, allowing burst up to 200 requests per minute. + +```ts +const api = new apigateway.RestApi(this, 'books'); +const deployment = new apigateway.Deployment(this, 'my-deployment', { api }); +const stage = new apigateway.Stage(this, 'my-stage', { + deployment, + methodOptions: { + '/*/*': { // This special path applies to all resource paths and all HTTP methods + throttlingRateLimit: 100, + throttlingBurstLimit: 200 + } + } +}); +``` + +Configuring `methodOptions` on the `deployOptions` of `RestApi` will set the +throttling behaviors on the default stage that is automatically created. + +```ts +const api = new apigateway.RestApi(this, 'books', { + deployOptions: { + methodOptions: { + '/*/*': { // This special path applies to all resource paths and all HTTP methods + throttlingRateLimit: 100, + throttlingBurstLimit: 1000 + } + } + } +}); +``` + +## Cross Origin Resource Sharing (CORS) + +[Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) is a mechanism +that uses additional HTTP headers to tell browsers to give a web application +running at one origin, access to selected resources from a different origin. A +web application executes a cross-origin HTTP request when it requests a resource +that has a different origin (domain, protocol, or port) from its own. + +You can add the CORS [preflight](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Preflighted_requests) OPTIONS +HTTP method to any API resource via the `defaultCorsPreflightOptions` option or by calling the `addCorsPreflight` on a specific resource. + +The following example will enable CORS for all methods and all origins on all resources of the API: + +```ts +new apigateway.RestApi(this, 'api', { + defaultCorsPreflightOptions: { + allowOrigins: apigateway.Cors.ALL_ORIGINS, + allowMethods: apigateway.Cors.ALL_METHODS // this is also the default + } +}) +``` + +The following example will add an OPTIONS method to the `myResource` API resource, which +only allows GET and PUT HTTP requests from the origin + +```ts +declare const myResource: apigateway.Resource; + +myResource.addCorsPreflight({ + allowOrigins: [ 'https://amazon.com' ], + allowMethods: [ 'GET', 'PUT' ] +}); +``` + +See the +[`CorsOptions`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.CorsOptions.html) +API reference for a detailed list of supported configuration options. + +You can specify defaults this at the resource level, in which case they will be applied to the entire resource sub-tree: + +```ts +declare const resource: apigateway.Resource; + +const subtree = resource.addResource('subtree', { + defaultCorsPreflightOptions: { + allowOrigins: [ 'https://amazon.com' ] + } +}); +``` + +This means that all resources under `subtree` (inclusive) will have a preflight +OPTIONS added to them. + +See [#906](https://github.com/aws/aws-cdk/issues/906) for a list of CORS +features which are not yet supported. + +## Endpoint Configuration + +API gateway allows you to specify an +[API Endpoint Type](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-endpoint-types.html). +To define an endpoint type for the API gateway, use `endpointConfiguration` property: + +```ts +const api = new apigateway.RestApi(this, 'api', { + endpointConfiguration: { + types: [ apigateway.EndpointType.EDGE ] + } +}); +``` + +You can also create an association between your Rest API and a VPC endpoint. By doing so, +API Gateway will generate a new +Route53 Alias DNS record which you can use to invoke your private APIs. More info can be found +[here](https://docs.aws.amazon.com/apigateway/latest/developerguide/associate-private-api-with-vpc-endpoint.html). + +Here is an example: + +```ts +declare const someEndpoint: ec2.IVpcEndpoint; + +const api = new apigateway.RestApi(this, 'api', { + endpointConfiguration: { + types: [ apigateway.EndpointType.PRIVATE ], + vpcEndpoints: [ someEndpoint ] + } +}); +``` + +By performing this association, we can invoke the API gateway using the following format: + +```plaintext +https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage} +``` + +## Private Integrations + +A private integration makes it simple to expose HTTP/HTTPS resources behind an +Amazon VPC for access by clients outside of the VPC. The private integration uses +an API Gateway resource of `VpcLink` to encapsulate connections between API +Gateway and targeted VPC resources. +The `VpcLink` is then attached to the `Integration` of a specific API Gateway +Method. The following code sets up a private integration with a network load +balancer - + +```ts +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; + +const vpc = new ec2.Vpc(this, 'VPC'); +const nlb = new elbv2.NetworkLoadBalancer(this, 'NLB', { + vpc, +}); +const link = new apigateway.VpcLink(this, 'link', { + targets: [nlb], +}); + +const integration = new apigateway.Integration({ + type: apigateway.IntegrationType.HTTP_PROXY, + options: { + connectionType: apigateway.ConnectionType.VPC_LINK, + vpcLink: link, + }, +}); +``` + +The uri for the private integration, in the case of a VpcLink, will be set to the DNS name of +the VPC Link's NLB. If the VPC Link has multiple NLBs or the VPC Link is imported or the DNS +name cannot be determined for any other reason, the user is expected to specify the `uri` +property. + +Any existing `VpcLink` resource can be imported into the CDK app via the `VpcLink.fromVpcLinkId()`. + +```ts +const awesomeLink = apigateway.VpcLink.fromVpcLinkId(this, 'awesome-vpc-link', 'us-east-1_oiuR12Abd'); +``` + +## Gateway response + +If the Rest API fails to process an incoming request, it returns to the client an error response without forwarding the +request to the integration backend. API Gateway has a set of standard response messages that are sent to the client for +each type of error. These error responses can be configured on the Rest API. The list of Gateway responses that can be +configured can be found [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/supported-gateway-response-types.html). +Learn more about [Gateway +Responses](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-gatewayResponse-definition.html). + +The following code configures a Gateway Response when the response is 'access denied': + +```ts +const api = new apigateway.RestApi(this, 'books-api'); +api.addGatewayResponse('test-response', { + type: apigateway.ResponseType.ACCESS_DENIED, + statusCode: '500', + responseHeaders: { + // Note that values must be enclosed within a pair of single quotes + 'Access-Control-Allow-Origin': "'test.com'", + 'test-key': "'test-value'", + }, + templates: { + 'application/json': '{ "message": $context.error.messageString, "statusCode": "488", "type": "$context.error.responseType" }' + } +}); +``` + +## OpenAPI Definition + +CDK supports creating a REST API by importing an OpenAPI definition file. It currently supports OpenAPI v2.0 and OpenAPI +v3.0 definition files. Read more about [Configuring a REST API using +OpenAPI](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html). + +The following code creates a REST API using an external OpenAPI definition JSON file - + +```ts +declare const integration: apigateway.Integration; + +const api = new apigateway.SpecRestApi(this, 'books-api', { + apiDefinition: apigateway.ApiDefinition.fromAsset('path-to-file.json') +}); + +const booksResource = api.root.addResource('books') +booksResource.addMethod('GET', integration); +``` + +It is possible to use the `addResource()` API to define additional API Gateway Resources. + +**Note:** Deployment will fail if a Resource of the same name is already defined in the Open API specification. + +**Note:** Any default properties configured, such as `defaultIntegration`, `defaultMethodOptions`, etc. will only be +applied to Resources and Methods defined in the CDK, and not the ones defined in the spec. Use the [API Gateway +extensions to OpenAPI](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions.html) +to configure these. + +There are a number of limitations in using OpenAPI definitions in API Gateway. Read the [Amazon API Gateway important +notes for REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html#api-gateway-known-issues-rest-apis) +for more details. + +**Note:** When starting off with an OpenAPI definition using `SpecRestApi`, it is not possible to configure some +properties that can be configured directly in the OpenAPI specification file. This is to prevent people duplication +of these properties and potential confusion. + +### Endpoint configuration + +By default, `SpecRestApi` will create an edge optimized endpoint. + +This can be modified as shown below: + +```ts +declare const apiDefinition: apigateway.ApiDefinition; + +const api = new apigateway.SpecRestApi(this, 'ExampleRestApi', { + apiDefinition, + endpointTypes: [apigateway.EndpointType.PRIVATE] +}); +``` + +**Note:** For private endpoints you will still need to provide the +[`x-amazon-apigateway-policy`](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html) and +[`x-amazon-apigateway-endpoint-configuration`](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html) +in your openApi file. + +## Metrics + +The API Gateway service sends metrics around the performance of Rest APIs to Amazon CloudWatch. +These metrics can be referred to using the metric APIs available on the `RestApi`, `Stage` and `Method` constructs. +Note that detailed metrics must be enabled for a stage to use the `Method` metrics. +Read more about [API Gateway metrics](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-metrics-and-dimensions.html), including enabling detailed metrics. +The APIs with the `metric` prefix can be used to get reference to specific metrics for this API. For example: + +```ts +const api = new apigateway.RestApi(this, 'my-api'); +const stage = api.deploymentStage; +const method = api.root.addMethod('GET'); + +const clientErrorApiMetric = api.metricClientError(); +const serverErrorStageMetric = stage.metricServerError(); +const latencyMethodMetric = method.metricLatency(stage); +``` + +## APIGateway v2 + +APIGateway v2 APIs are now moved to its own package named `aws-apigatewayv2`. For backwards compatibility, existing +APIGateway v2 "CFN resources" (such as `CfnApi`) that were previously exported as part of this package, are still +exported from here and have been marked deprecated. However, updates to these CloudFormation resources, such as new +properties and new resource types will not be available. + +Move to using `aws-apigatewayv2` to get the latest APIs and updates. + +---- + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/aws-cdk-lib/aws-apigateway/index.ts b/packages/aws-cdk-lib/aws-apigateway/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/access-log.ts b/packages/aws-cdk-lib/aws-apigateway/lib/access-log.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/access-log.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/access-log.ts index 7c5b13d3a6204..dc9e7f9394c35 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/access-log.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/access-log.ts @@ -1,4 +1,4 @@ -import { ILogGroup } from '@aws-cdk/aws-logs'; +import { ILogGroup } from '../../aws-logs'; import { IStage } from './stage'; /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/api-definition.ts b/packages/aws-cdk-lib/aws-apigateway/lib/api-definition.ts similarity index 97% rename from packages/@aws-cdk/aws-apigateway/lib/api-definition.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/api-definition.ts index 39b513b550c8f..6a546843d30be 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/api-definition.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/api-definition.ts @@ -1,6 +1,6 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as s3 from '../../aws-s3'; +import * as s3_assets from '../../aws-s3-assets'; +import * as cxapi from '../../cx-api'; import { Construct, Node } from 'constructs'; import { CfnRestApi } from './apigateway.generated'; import { IRestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/api-key.ts b/packages/aws-cdk-lib/aws-apigateway/lib/api-key.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/api-key.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/api-key.ts index 1780fe0df9465..5313c07e00a0b 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/api-key.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/api-key.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { ArnFormat, IResource as IResourceBase, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnApiKey } from './apigateway.generated'; import { ResourceOptions } from './resource'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts b/packages/aws-cdk-lib/aws-apigateway/lib/apigatewayv2.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/apigatewayv2.ts index 0f63c54177777..5ab7d336d2bcc 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/apigatewayv2.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/apigatewayv2.ts @@ -3,7 +3,7 @@ /* eslint-disable max-len */ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizer.ts b/packages/aws-cdk-lib/aws-apigateway/lib/authorizer.ts similarity index 95% rename from packages/@aws-cdk/aws-apigateway/lib/authorizer.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/authorizer.ts index 8a4c5a020bb9a..ab21c7803ba3d 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/authorizer.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/authorizer.ts @@ -1,4 +1,4 @@ -import { Resource, ResourceProps } from '@aws-cdk/core'; +import { Resource, ResourceProps } from '../../core'; import { Construct } from 'constructs'; import { AuthorizationType } from './method'; import { IRestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizers/cognito.ts b/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/cognito.ts similarity index 96% rename from packages/@aws-cdk/aws-apigateway/lib/authorizers/cognito.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/authorizers/cognito.ts index 870c976d9ba20..07f99b22f50a8 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/authorizers/cognito.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/cognito.ts @@ -1,6 +1,6 @@ -import * as cognito from '@aws-cdk/aws-cognito'; -import { Duration, FeatureFlags, Lazy, Names, Stack } from '@aws-cdk/core'; -import { APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID } from '@aws-cdk/cx-api'; +import * as cognito from '../../../aws-cognito'; +import { Duration, FeatureFlags, Lazy, Names, Stack } from '../../../core'; +import { APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID } from '../../../cx-api'; import { Construct } from 'constructs'; import { CfnAuthorizer, CfnAuthorizerProps } from '../apigateway.generated'; import { Authorizer, IAuthorizer } from '../authorizer'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizers/identity-source.ts b/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/identity-source.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/authorizers/identity-source.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/authorizers/identity-source.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizers/index.ts b/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/authorizers/index.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/authorizers/index.ts diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/lambda.ts b/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/lambda.ts new file mode 100644 index 0000000000000..cc11c6881cc09 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/lib/authorizers/lambda.ts @@ -0,0 +1,313 @@ +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import { Arn, ArnFormat, Duration, FeatureFlags, Lazy, Names, Stack } from '../../../core'; +import { APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID } from '../../../cx-api'; +import { Construct } from 'constructs'; +import { CfnAuthorizer, CfnAuthorizerProps } from '../apigateway.generated'; +import { Authorizer, IAuthorizer } from '../authorizer'; +import { IRestApi } from '../restapi'; + + +/** + * Base properties for all lambda authorizers + */ +export interface LambdaAuthorizerProps { + /** + * An optional human friendly name for the authorizer. Note that, this is not the primary identifier of the authorizer. + * + * @default - the unique construct ID + */ + readonly authorizerName?: string; + + /** + * The handler for the authorizer lambda function. + * + * The handler must follow a very specific protocol on the input it receives + * and the output it needs to produce. API Gateway has documented the + * handler's [input specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html) + * and [output specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html). + */ + readonly handler: lambda.IFunction; + + /** + * How long APIGateway should cache the results. Max 1 hour. + * Disable caching by setting this to 0. + * + * @default Duration.minutes(5) + */ + readonly resultsCacheTtl?: Duration; + + /** + * An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer. The IAM role must be + * assumable by 'apigateway.amazonaws.com'. + * + * @default - A resource policy is added to the Lambda function allowing apigateway.amazonaws.com to invoke the function. + */ + readonly assumeRole?: iam.IRole; +} + +abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer { + + /** + * The id of the authorizer. + * @attribute + */ + public abstract override readonly authorizerId: string; + + /** + * The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants. + */ + public abstract readonly authorizerArn: string; + + /** + * The Lambda function handler that this authorizer uses. + */ + protected readonly handler: lambda.IFunction; + + /** + * The IAM role that the API Gateway service assumes while invoking the Lambda function. + */ + protected readonly role?: iam.IRole; + + protected restApiId?: string; + + protected abstract readonly authorizerProps: CfnAuthorizerProps; + + protected constructor(scope: Construct, id: string, props: LambdaAuthorizerProps) { + super(scope, id); + + this.handler = props.handler; + this.role = props.assumeRole; + + if (props.resultsCacheTtl && props.resultsCacheTtl?.toSeconds() > 3600) { + throw new Error('Lambda authorizer property \'resultsCacheTtl\' must not be greater than 3600 seconds (1 hour)'); + } + } + + /** + * Attaches this authorizer to a specific REST API. + * @internal + */ + public _attachToApi(restApi: IRestApi) { + if (this.restApiId && this.restApiId !== restApi.restApiId) { + throw new Error('Cannot attach authorizer to two different rest APIs'); + } + + this.restApiId = restApi.restApiId; + + const deployment = restApi.latestDeployment; + const addToLogicalId = FeatureFlags.of(this).isEnabled(APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID); + + if (deployment && addToLogicalId) { + let functionName; + + if (this.handler instanceof lambda.Function) { + // if not imported, attempt to get the function name, which + // may be a token + functionName = (this.handler.node.defaultChild as lambda.CfnFunction).functionName; + } else { + // if imported, the function name will be a token + functionName = this.handler.functionName; + } + + deployment.node.addDependency(this); + deployment.addToLogicalId({ + authorizer: this.authorizerProps, + authorizerToken: functionName, + }); + } + } + + /** + * Sets up the permissions necessary for the API Gateway service to invoke the Lambda function. + */ + protected setupPermissions() { + if (!this.role) { + this.addDefaultPermisionRole(); + } else if (iam.Role.isRole(this.role)) { + this.addLambdaInvokePermission(this.role); + } + } + + /** + * Add Default Permission Role for handler + */ + private addDefaultPermisionRole() :void { + this.handler.addPermission(`${Names.uniqueId(this)}:Permissions`, { + principal: new iam.ServicePrincipal('apigateway.amazonaws.com'), + sourceArn: this.authorizerArn, + }); + } + + /** + * Add Lambda Invoke Permission for LambdaAurhorizer's role + */ + private addLambdaInvokePermission(role: iam.Role) :void { + role.attachInlinePolicy(new iam.Policy(this, 'authorizerInvokePolicy', { + statements: [ + new iam.PolicyStatement({ + resources: this.handler.resourceArnsForGrantInvoke, + actions: ['lambda:InvokeFunction'], + }), + ], + })); + } + + /** + * Returns a token that resolves to the Rest Api Id at the time of synthesis. + * Throws an error, during token resolution, if no RestApi is attached to this authorizer. + */ + protected lazyRestApiId() { + return Lazy.string({ + produce: () => { + if (!this.restApiId) { + throw new Error(`Authorizer (${this.node.path}) must be attached to a RestApi`); + } + return this.restApiId; + }, + }); + } +} + +/** + * Properties for TokenAuthorizer + */ +export interface TokenAuthorizerProps extends LambdaAuthorizerProps { + /** + * An optional regex to be matched against the authorization token. When matched the authorizer lambda is invoked, + * otherwise a 401 Unauthorized is returned to the client. + * + * @default - no regex filter will be applied. + */ + readonly validationRegex?: string; + + /** + * The request header mapping expression for the bearer token. This is typically passed as part of the header, in which case + * this should be `method.request.header.Authorizer` where Authorizer is the header containing the bearer token. + * @see https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource + * @default `IdentitySource.header('Authorization')` + */ + readonly identitySource?: string; +} + +/** + * Token based lambda authorizer that recognizes the caller's identity as a bearer token, + * such as a JSON Web Token (JWT) or an OAuth token. + * Based on the token, authorization is performed by a lambda function. + * + * @resource AWS::ApiGateway::Authorizer + */ +export class TokenAuthorizer extends LambdaAuthorizer { + + public readonly authorizerId: string; + + public readonly authorizerArn: string; + + protected readonly authorizerProps: CfnAuthorizerProps; + + constructor(scope: Construct, id: string, props: TokenAuthorizerProps) { + super(scope, id, props); + + const restApiId = this.lazyRestApiId(); + + const authorizerProps: CfnAuthorizerProps = { + name: props.authorizerName ?? Names.uniqueId(this), + restApiId, + type: 'TOKEN', + authorizerUri: lambdaAuthorizerArn(props.handler), + authorizerCredentials: props.assumeRole?.roleArn, + authorizerResultTtlInSeconds: props.resultsCacheTtl?.toSeconds(), + identitySource: props.identitySource || 'method.request.header.Authorization', + identityValidationExpression: props.validationRegex, + }; + + this.authorizerProps = authorizerProps; + + const resource = new CfnAuthorizer(this, 'Resource', authorizerProps); + + this.authorizerId = resource.ref; + this.authorizerArn = Stack.of(this).formatArn({ + service: 'execute-api', + resource: restApiId, + resourceName: `authorizers/${this.authorizerId}`, + }); + + this.setupPermissions(); + } +} + +/** + * Properties for RequestAuthorizer + */ +export interface RequestAuthorizerProps extends LambdaAuthorizerProps { + /** + * An array of request header mapping expressions for identities. Supported parameter types are + * Header, Query String, Stage Variable, and Context. For instance, extracting an authorization + * token from a header would use the identity source `IdentitySource.header('Authorizer')`. + * + * Note: API Gateway uses the specified identity sources as the request authorizer caching key. When caching is + * enabled, API Gateway calls the authorizer's Lambda function only after successfully verifying that all the + * specified identity sources are present at runtime. If a specified identify source is missing, null, or empty, + * API Gateway returns a 401 Unauthorized response without calling the authorizer Lambda function. + * + * @see https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource + */ + readonly identitySources: string[]; +} + +/** + * Request-based lambda authorizer that recognizes the caller's identity via request parameters, + * such as headers, paths, query strings, stage variables, or context variables. + * Based on the request, authorization is performed by a lambda function. + * + * @resource AWS::ApiGateway::Authorizer + */ +export class RequestAuthorizer extends LambdaAuthorizer { + + public readonly authorizerId: string; + + public readonly authorizerArn: string; + + protected readonly authorizerProps: CfnAuthorizerProps; + + constructor(scope: Construct, id: string, props: RequestAuthorizerProps) { + super(scope, id, props); + + if ((props.resultsCacheTtl === undefined || props.resultsCacheTtl.toSeconds() !== 0) && props.identitySources.length === 0) { + throw new Error('At least one Identity Source is required for a REQUEST-based Lambda authorizer if caching is enabled.'); + } + + const restApiId = this.lazyRestApiId(); + + const authorizerProps: CfnAuthorizerProps = { + name: props.authorizerName ?? Names.uniqueId(this), + restApiId, + type: 'REQUEST', + authorizerUri: lambdaAuthorizerArn(props.handler), + authorizerCredentials: props.assumeRole?.roleArn, + authorizerResultTtlInSeconds: props.resultsCacheTtl?.toSeconds(), + identitySource: props.identitySources.map(is => is.toString()).join(','), + }; + + this.authorizerProps = authorizerProps; + + const resource = new CfnAuthorizer(this, 'Resource', authorizerProps); + + this.authorizerId = resource.ref; + this.authorizerArn = Stack.of(this).formatArn({ + service: 'execute-api', + resource: restApiId, + resourceName: `authorizers/${this.authorizerId}`, + }); + + this.setupPermissions(); + } +} + +/** + * constructs the authorizerURIArn. + */ +function lambdaAuthorizerArn(handler: lambda.IFunction) { + const { region, partition } = Arn.split( handler.functionArn, ArnFormat.COLON_RESOURCE_NAME); + return `arn:${partition}:apigateway:${region}:lambda:path/2015-03-31/functions/${handler.functionArn}/invocations`; +} diff --git a/packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts b/packages/aws-cdk-lib/aws-apigateway/lib/base-path-mapping.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/base-path-mapping.ts index 0df48fcb89e3b..3f0520623fb8c 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/base-path-mapping.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/base-path-mapping.ts @@ -1,4 +1,4 @@ -import { Resource, Token } from '@aws-cdk/core'; +import { Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnBasePathMapping } from './apigateway.generated'; import { IDomainName } from './domain-name'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/cors.ts b/packages/aws-cdk-lib/aws-apigateway/lib/cors.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/cors.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/cors.ts index d0cc6ee3e5a79..a9b6a8339d05c 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/cors.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/cors.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../core'; import { ALL_METHODS } from './util'; export interface CorsOptions { diff --git a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts b/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/deployment.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts index b53cd45f27e23..1f4d93b0bf097 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/deployment.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts @@ -1,5 +1,5 @@ -import { Lazy, RemovalPolicy, Resource, CfnResource } from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; +import { Lazy, RemovalPolicy, Resource, CfnResource } from '../../core'; +import { md5hash } from '../../core/lib/helpers-internal'; import { Construct } from 'constructs'; import { CfnDeployment } from './apigateway.generated'; import { Method } from './method'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts b/packages/aws-cdk-lib/aws-apigateway/lib/domain-name.ts similarity index 97% rename from packages/@aws-cdk/aws-apigateway/lib/domain-name.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/domain-name.ts index 8bc3f6ea1301f..9b7ba3d1a42f1 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/domain-name.ts @@ -1,7 +1,7 @@ -import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { IBucket } from '@aws-cdk/aws-s3'; -import { IResource, Names, Resource, Token } from '@aws-cdk/core'; +import * as apigwv2 from '../../aws-apigatewayv2'; +import * as acm from '../../aws-certificatemanager'; +import { IBucket } from '../../aws-s3'; +import { IResource, Names, Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnDomainName } from './apigateway.generated'; import { BasePathMapping, BasePathMappingOptions } from './base-path-mapping'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts b/packages/aws-cdk-lib/aws-apigateway/lib/gateway-response.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/gateway-response.ts index 0ab490a893051..958e1b9d70640 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/gateway-response.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/gateway-response.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnGatewayResponse, CfnGatewayResponseProps } from './apigateway.generated'; import { IRestApi } from './restapi'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/index.ts b/packages/aws-cdk-lib/aws-apigateway/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/index.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/index.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/integration.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integration.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/integration.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integration.ts index 4ff6a28c76a63..663a862e9f727 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integration.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/integration.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Lazy, Duration } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Lazy, Duration } from '../../core'; import { Method } from './method'; import { IVpcLink, VpcLink } from './vpc-link'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/aws.ts similarity index 97% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/aws.ts index 8af257000180c..68fc2bc6a551f 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integrations/aws.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/aws.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import { ArnFormat } from '@aws-cdk/core'; +import * as cdk from '../../../core'; +import { ArnFormat } from '../../../core'; import { IConstruct } from 'constructs'; import { Integration, IntegrationConfig, IntegrationOptions, IntegrationType } from '../integration'; import { Method } from '../method'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/http.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/http.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/http.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/index.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/index.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/index.ts diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/integrations/lambda.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/lambda.ts new file mode 100644 index 0000000000000..8dce8d845e046 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/lambda.ts @@ -0,0 +1,99 @@ +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import { Lazy, Names, Token } from '../../../core'; +import { AwsIntegration } from './aws'; +import { IntegrationConfig, IntegrationOptions } from '../integration'; +import { Method } from '../method'; + +export interface LambdaIntegrationOptions extends IntegrationOptions { + /** + * Use proxy integration or normal (request/response mapping) integration. + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format + * + * @default true + */ + readonly proxy?: boolean; + + /** + * Allow invoking method from AWS Console UI (for testing purposes). + * + * This will add another permission to the AWS Lambda resource policy which + * will allow the `test-invoke-stage` stage to invoke this handler. If this + * is set to `false`, the function will only be usable from the deployment + * endpoint. + * + * @default true + */ + readonly allowTestInvoke?: boolean; +} + +/** + * Integrates an AWS Lambda function to an API Gateway method. + * + * @example + * + * declare const resource: apigateway.Resource; + * declare const handler: lambda.Function; + * resource.addMethod('GET', new apigateway.LambdaIntegration(handler)); + * + */ +export class LambdaIntegration extends AwsIntegration { + private readonly handler: lambda.IFunction; + private readonly enableTest: boolean; + + constructor(handler: lambda.IFunction, options: LambdaIntegrationOptions = { }) { + const proxy = options.proxy ?? true; + + super({ + proxy, + service: 'lambda', + path: `2015-03-31/functions/${handler.functionArn}/invocations`, + options, + }); + + this.handler = handler; + this.enableTest = options.allowTestInvoke ?? true; + } + + public bind(method: Method): IntegrationConfig { + const bindResult = super.bind(method); + const principal = new iam.ServicePrincipal('apigateway.amazonaws.com'); + + const desc = `${Names.nodeUniqueId(method.api.node)}.${method.httpMethod}.${method.resource.path.replace(/\//g, '.')}`; + + this.handler.addPermission(`ApiPermission.${desc}`, { + principal, + scope: method, + sourceArn: Lazy.string({ produce: () => method.methodArn }), + }); + + // add permission to invoke from the console + if (this.enableTest) { + this.handler.addPermission(`ApiPermission.Test.${desc}`, { + principal, + scope: method, + sourceArn: method.testMethodArn, + }); + } + + let functionName; + + if (this.handler instanceof lambda.Function) { + // if not imported, extract the name from the CFN layer to reach + // the literal value if it is given (rather than a token) + functionName = (this.handler.node.defaultChild as lambda.CfnFunction).functionName; + } else { + // imported, just take the function name. + functionName = this.handler.functionName; + } + + let deploymentToken; + if (!Token.isUnresolved(functionName)) { + deploymentToken = JSON.stringify({ functionName }); + } + return { + ...bindResult, + deploymentToken, + }; + } +} diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/mock.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/mock.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/mock.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/mock.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/request-context.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/request-context.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/request-context.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/request-context.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/stepfunctions.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/stepfunctions.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts index 9ff8e066e449c..9b91bde47abfd 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/integrations/stepfunctions.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Token } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Token } from '../../../core'; import { RequestContext } from '.'; import { AwsIntegration } from './aws'; import { IntegrationConfig, IntegrationOptions, PassthroughBehavior } from '../integration'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/integrations/stepfunctions.vtl b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.vtl similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/integrations/stepfunctions.vtl rename to packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.vtl diff --git a/packages/@aws-cdk/aws-apigateway/lib/json-schema.ts b/packages/aws-cdk-lib/aws-apigateway/lib/json-schema.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/json-schema.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/json-schema.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts b/packages/aws-cdk-lib/aws-apigateway/lib/lambda-api.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/lambda-api.ts index a60a3731e4f8f..179edc274ee21 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/lambda-api.ts @@ -1,4 +1,4 @@ -import * as lambda from '@aws-cdk/aws-lambda'; +import * as lambda from '../../aws-lambda'; import { Construct } from 'constructs'; import { LambdaIntegration, LambdaIntegrationOptions } from './integrations'; import { Method } from './method'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/method.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/method.ts index ed2dc72ecf065..62a1b01b3301e 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { ArnFormat, Lazy, Resource, Stack } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { ArnFormat, Lazy, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { ApiGatewayMetrics } from './apigateway-canned-metrics.generated'; import { CfnMethod, CfnMethodProps } from './apigateway.generated'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/methodresponse.ts b/packages/aws-cdk-lib/aws-apigateway/lib/methodresponse.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/methodresponse.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/methodresponse.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/model.ts b/packages/aws-cdk-lib/aws-apigateway/lib/model.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/model.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/model.ts index 9e4f4cb12c1a4..562ade8fa2b01 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/model.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/model.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnModel, CfnModelProps } from './apigateway.generated'; import * as jsonSchema from './json-schema'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts b/packages/aws-cdk-lib/aws-apigateway/lib/requestvalidator.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/requestvalidator.ts index 02d3e014c24da..27e73691e109c 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/requestvalidator.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/requestvalidator.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnRequestValidator, CfnRequestValidatorProps } from './apigateway.generated'; import { IRestApi, RestApi } from './restapi'; diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts b/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts new file mode 100644 index 0000000000000..414e9ba6e4382 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/lib/resource.ts @@ -0,0 +1,565 @@ +import { IResource as IResourceBase, Resource as ResourceConstruct } from '../../core'; +import { Construct } from 'constructs'; +import { CfnResource, CfnResourceProps } from './apigateway.generated'; +import { Cors, CorsOptions } from './cors'; +import { Integration } from './integration'; +import { MockIntegration } from './integrations'; +import { Method, MethodOptions, AuthorizationType } from './method'; +import { IRestApi, RestApi } from './restapi'; + +export interface IResource extends IResourceBase { + /** + * The parent of this resource or undefined for the root resource. + */ + readonly parentResource?: IResource; + + /** + * The rest API that this resource is part of. + * + * @deprecated - Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead. + */ + readonly restApi: RestApi; + + /** + * The rest API that this resource is part of. + * + * The reason we need the RestApi object itself and not just the ID is because the model + * is being tracked by the top-level RestApi object for the purpose of calculating it's + * hash to determine the ID of the deployment. This allows us to automatically update + * the deployment when the model of the REST API changes. + */ + readonly api: IRestApi; + + /** + * The ID of the resource. + * @attribute + */ + readonly resourceId: string; + + /** + * The full path of this resource. + */ + readonly path: string; + + /** + * An integration to use as a default for all methods created within this + * API unless an integration is specified. + */ + readonly defaultIntegration?: Integration; + + /** + * Method options to use as a default for all methods created within this + * API unless custom options are specified. + */ + readonly defaultMethodOptions?: MethodOptions; + + /** + * Default options for CORS preflight OPTIONS method. + */ + readonly defaultCorsPreflightOptions?: CorsOptions; + + /** + * Gets or create all resources leading up to the specified path. + * + * - Path may only start with "/" if this method is called on the root resource. + * - All resources are created using default options. + * + * @param path The relative path + * @returns a new or existing resource. + */ + resourceForPath(path: string): Resource; + + /** + * Defines a new child resource where this resource is the parent. + * @param pathPart The path part for the child resource + * @param options Resource options + * @returns A Resource object + */ + addResource(pathPart: string, options?: ResourceOptions): Resource; + + /** + * Retrieves a child resource by path part. + * + * @param pathPart The path part of the child resource + * @returns the child resource or undefined if not found + */ + getResource(pathPart: string): IResource | undefined; + + /** + * Adds a greedy proxy resource ("{proxy+}") and an ANY method to this route. + * @param options Default integration and method options. + */ + addProxy(options?: ProxyResourceOptions): ProxyResource; + + /** + * Defines a new method for this resource. + * @param httpMethod The HTTP method + * @param target The target backend integration for this method + * @param options Method options, such as authentication. + * + * @returns The newly created `Method` object. + */ + addMethod(httpMethod: string, target?: Integration, options?: MethodOptions): Method; + + /** + * Adds an OPTIONS method to this resource which responds to Cross-Origin + * Resource Sharing (CORS) preflight requests. + * + * Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional + * HTTP headers to tell browsers to give a web application running at one + * origin, access to selected resources from a different origin. A web + * application executes a cross-origin HTTP request when it requests a + * resource that has a different origin (domain, protocol, or port) from its + * own. + * + * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS + * @param options CORS options + * @returns a `Method` object + */ + addCorsPreflight(options: CorsOptions): Method; +} + +export interface ResourceOptions { + /** + * An integration to use as a default for all methods created within this + * API unless an integration is specified. + * + * @default - Inherited from parent. + */ + readonly defaultIntegration?: Integration; + + /** + * Method options to use as a default for all methods created within this + * API unless custom options are specified. + * + * @default - Inherited from parent. + */ + readonly defaultMethodOptions?: MethodOptions; + + /** + * Adds a CORS preflight OPTIONS method to this resource and all child + * resources. + * + * You can add CORS at the resource-level using `addCorsPreflight`. + * + * @default - CORS is disabled + */ + readonly defaultCorsPreflightOptions?: CorsOptions; +} + +export interface ResourceProps extends ResourceOptions { + /** + * The parent resource of this resource. You can either pass another + * `Resource` object or a `RestApi` object here. + */ + readonly parent: IResource; + + /** + * A path name for the resource. + */ + readonly pathPart: string; +} + +export abstract class ResourceBase extends ResourceConstruct implements IResource { + public abstract readonly parentResource?: IResource; + /** + * @deprecated - Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead. + */ + public abstract readonly restApi: RestApi; + public abstract readonly api: IRestApi; + public abstract readonly resourceId: string; + public abstract readonly path: string; + public abstract readonly defaultIntegration?: Integration; + public abstract readonly defaultMethodOptions?: MethodOptions; + public abstract readonly defaultCorsPreflightOptions?: CorsOptions; + + private readonly children: { [pathPart: string]: Resource } = { }; + + constructor(scope: Construct, id: string) { + super(scope, id); + } + + public addResource(pathPart: string, options?: ResourceOptions): Resource { + return new Resource(this, pathPart, { parent: this, pathPart, ...options }); + } + + public addMethod(httpMethod: string, integration?: Integration, options?: MethodOptions): Method { + return new Method(this, httpMethod, { resource: this, httpMethod, integration, options }); + } + + public addProxy(options?: ProxyResourceOptions): ProxyResource { + return new ProxyResource(this, '{proxy+}', { parent: this, ...options }); + } + + public addCorsPreflight(options: CorsOptions) { + const headers: { [name: string]: string } = { }; + + // + // Access-Control-Allow-Headers + + const allowHeaders = options.allowHeaders || Cors.DEFAULT_HEADERS; + headers['Access-Control-Allow-Headers'] = `'${allowHeaders.join(',')}'`; + + // + // Access-Control-Allow-Origin + + if (options.allowOrigins.length === 0) { + throw new Error('allowOrigins must contain at least one origin'); + } + + if (options.allowOrigins.includes('*') && options.allowOrigins.length > 1) { + throw new Error(`Invalid "allowOrigins" - cannot mix "*" with specific origins: ${options.allowOrigins.join(',')}`); + } + + // we use the first origin here and if there are more origins in the list, we + // will match against them in the response velocity template + const initialOrigin = options.allowOrigins[0]; + headers['Access-Control-Allow-Origin'] = `'${initialOrigin}'`; + + // the "Vary" header is required if we allow a specific origin + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin#CORS_and_caching + if (initialOrigin !== '*') { + headers.Vary = '\'Origin\''; + } + + // + // Access-Control-Allow-Methods + + let allowMethods = options.allowMethods || Cors.ALL_METHODS; + + if (allowMethods.includes('ANY')) { + if (allowMethods.length > 1) { + throw new Error(`ANY cannot be used with any other method. Received: ${allowMethods.join(',')}`); + } + + allowMethods = Cors.ALL_METHODS; + } + + headers['Access-Control-Allow-Methods'] = `'${allowMethods.join(',')}'`; + + // + // Access-Control-Allow-Credentials + + if (options.allowCredentials) { + headers['Access-Control-Allow-Credentials'] = '\'true\''; + } + + // + // Access-Control-Max-Age + + let maxAgeSeconds; + + if (options.maxAge && options.disableCache) { + throw new Error('The options "maxAge" and "disableCache" are mutually exclusive'); + } + + if (options.maxAge) { + maxAgeSeconds = options.maxAge.toSeconds(); + } + + if (options.disableCache) { + maxAgeSeconds = -1; + } + + if (maxAgeSeconds) { + headers['Access-Control-Max-Age'] = `'${maxAgeSeconds}'`; + } + + // + // Access-Control-Expose-Headers + // + + if (options.exposeHeaders) { + headers['Access-Control-Expose-Headers'] = `'${options.exposeHeaders.join(',')}'`; + } + + // + // statusCode + + const statusCode = options.statusCode ?? 204; + + // + // prepare responseParams + + const integrationResponseParams: { [p: string]: string } = { }; + const methodResponseParams: { [p: string]: boolean } = { }; + + for (const [name, value] of Object.entries(headers)) { + const key = `method.response.header.${name}`; + integrationResponseParams[key] = value; + methodResponseParams[key] = true; + } + + return this.addMethod('OPTIONS', new MockIntegration({ + requestTemplates: { 'application/json': '{ statusCode: 200 }' }, + integrationResponses: [ + { statusCode: `${statusCode}`, responseParameters: integrationResponseParams, responseTemplates: renderResponseTemplate() }, + ], + }), { + authorizer: { + authorizerId: '', + authorizationType: AuthorizationType.NONE, + }, + apiKeyRequired: false, + authorizationType: AuthorizationType.NONE, + methodResponses: [ + { statusCode: `${statusCode}`, responseParameters: methodResponseParams }, + ], + }); + + // renders the response template to match all possible origins (if we have more than one) + function renderResponseTemplate() { + const origins = options.allowOrigins.slice(1); + + if (origins.length === 0) { + return undefined; + } + + const template = new Array(); + + template.push('#set($origin = $input.params().header.get("Origin"))'); + template.push('#if($origin == "") #set($origin = $input.params().header.get("origin")) #end'); + + const condition = origins.map(o => `$origin.matches("${o}")`).join(' || '); + + template.push(`#if(${condition})`); + template.push(' #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)'); + template.push('#end'); + + return { + 'application/json': template.join('\n'), + }; + } + } + + public getResource(pathPart: string): IResource | undefined { + return this.children[pathPart]; + } + + /** + * @internal + */ + public _trackChild(pathPart: string, resource: Resource) { + this.children[pathPart] = resource; + } + + public resourceForPath(path: string): Resource { + if (!path) { + return this; + } + + if (path.startsWith('/')) { + if (this.path !== '/') { + throw new Error(`Path may start with "/" only for the resource, but we are at: ${this.path}`); + } + + // trim trailing "/" + return this.resourceForPath(path.slice(1)); + } + + const parts = path.split('/'); + const next = parts.shift(); + if (!next || next === '') { + throw new Error('resourceForPath cannot be called with an empty path'); + } + + let resource = this.getResource(next); + if (!resource) { + resource = this.addResource(next); + } + + return resource.resourceForPath(parts.join('/')); + } + + /** + * @deprecated - Throws error in some use cases that have been enabled since this deprecation notice. Use `RestApi.urlForPath()` instead. + */ + public get url(): string { + return this.restApi.urlForPath(this.path); + } +} + +/** + * Attributes that can be specified when importing a Resource + */ +export interface ResourceAttributes { + /** + * The ID of the resource. + */ + readonly resourceId: string; + + /** + * The rest API that this resource is part of. + */ + readonly restApi: IRestApi; + + /** + * The full path of this resource. + */ + readonly path: string; +} + +export class Resource extends ResourceBase { + /** + * Import an existing resource + */ + public static fromResourceAttributes(scope: Construct, id: string, attrs: ResourceAttributes): IResource { + class Import extends ResourceBase { + public readonly api = attrs.restApi; + public readonly resourceId = attrs.resourceId; + public readonly path = attrs.path; + public readonly defaultIntegration?: Integration = undefined; + public readonly defaultMethodOptions?: MethodOptions = undefined; + public readonly defaultCorsPreflightOptions?: CorsOptions = undefined; + + public get parentResource(): IResource { + throw new Error('parentResource is not configured for imported resource.'); + } + + public get restApi(): RestApi { + throw new Error('restApi is not configured for imported resource.'); + } + } + + return new Import(scope, id); + } + + public readonly parentResource?: IResource; + public readonly api: IRestApi; + public readonly resourceId: string; + public readonly path: string; + + public readonly defaultIntegration?: Integration; + public readonly defaultMethodOptions?: MethodOptions; + public readonly defaultCorsPreflightOptions?: CorsOptions; + + constructor(scope: Construct, id: string, props: ResourceProps) { + super(scope, id); + + validateResourcePathPart(props.pathPart); + + this.parentResource = props.parent; + + if (props.parent instanceof ResourceBase) { + props.parent._trackChild(props.pathPart, this); + } + + const resourceProps: CfnResourceProps = { + restApiId: props.parent.api.restApiId, + parentId: props.parent.resourceId, + pathPart: props.pathPart, + }; + const resource = new CfnResource(this, 'Resource', resourceProps); + + this.resourceId = resource.ref; + this.api = props.parent.api; + + // render resource path (special case for root) + this.path = props.parent.path; + if (!this.path.endsWith('/')) { this.path += '/'; } + this.path += props.pathPart; + + const deployment = props.parent.api.latestDeployment; + if (deployment) { + deployment.node.addDependency(resource); + deployment.addToLogicalId({ resource: resourceProps }); + } + + // setup defaults based on properties and inherit from parent. method defaults + // are inherited per property, so children can override piecemeal. + this.defaultIntegration = props.defaultIntegration || props.parent.defaultIntegration; + this.defaultMethodOptions = { + ...props.parent.defaultMethodOptions, + ...props.defaultMethodOptions, + }; + this.defaultCorsPreflightOptions = props.defaultCorsPreflightOptions || props.parent.defaultCorsPreflightOptions; + + if (this.defaultCorsPreflightOptions) { + this.addCorsPreflight(this.defaultCorsPreflightOptions); + } + } + + /** + * The RestApi associated with this Resource + * @deprecated - Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead. + */ + public get restApi(): RestApi { + if (!this.parentResource) { + throw new Error('parentResource was unexpectedly not defined'); + } + return this.parentResource.restApi; + } +} + +export interface ProxyResourceOptions extends ResourceOptions { + /** + * Adds an "ANY" method to this resource. If set to `false`, you will have to explicitly + * add methods to this resource after it's created. + * + * @default true + */ + readonly anyMethod?: boolean; +} + +export interface ProxyResourceProps extends ProxyResourceOptions { + /** + * The parent resource of this resource. You can either pass another + * `Resource` object or a `RestApi` object here. + */ + readonly parent: IResource; +} + +/** + * Defines a {proxy+} greedy resource and an ANY method on a route. + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html + */ +export class ProxyResource extends Resource { + /** + * If `props.anyMethod` is `true`, this will be the reference to the 'ANY' + * method associated with this proxy resource. + */ + public readonly anyMethod?: Method; + + constructor(scope: Construct, id: string, props: ProxyResourceProps) { + super(scope, id, { + parent: props.parent, + pathPart: '{proxy+}', + defaultIntegration: props.defaultIntegration, + defaultMethodOptions: props.defaultMethodOptions, + }); + + const anyMethod = props.anyMethod ?? true; + if (anyMethod) { + this.anyMethod = this.addMethod('ANY'); + } + } + + public addMethod(httpMethod: string, integration?: Integration, options?: MethodOptions): Method { + // In case this proxy is mounted under the root, also add this method to + // the root so that empty paths are proxied as well. + if (this.parentResource && this.parentResource.path === '/') { + // skip if the root resource already has this method defined + if (!(this.parentResource.node.tryFindChild(httpMethod) instanceof Method)) { + this.parentResource.addMethod(httpMethod, integration, options); + } + } + return super.addMethod(httpMethod, integration, options); + } +} + +function validateResourcePathPart(part: string) { + // strip {} which indicate this is a parameter + if (part.startsWith('{') && part.endsWith('}')) { + part = part.slice(1, -1); + + // proxy resources are allowed to end with a '+' + if (part.endsWith('+')) { + part = part.slice(0, -1); + } + } + + if (!/^[a-zA-Z0-9:\.\_\-]+$/.test(part)) { + throw new Error(`Resource's path part only allow [a-zA-Z0-9:._-], an optional trailing '+' + and curly braces at the beginning and the end: ${part}`); + } +} diff --git a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts b/packages/aws-cdk-lib/aws-apigateway/lib/restapi.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/lib/restapi.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/restapi.ts index 41a0990e4f5f7..962ef81d84516 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/restapi.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/restapi.ts @@ -1,8 +1,8 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { IVpcEndpoint } from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy, Size } from '@aws-cdk/core'; -import { APIGATEWAY_DISABLE_CLOUDWATCH_ROLE } from '@aws-cdk/cx-api'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { IVpcEndpoint } from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy, Size } from '../../core'; +import { APIGATEWAY_DISABLE_CLOUDWATCH_ROLE } from '../../cx-api'; import { Construct } from 'constructs'; import { ApiDefinition } from './api-definition'; import { ApiKey, ApiKeyOptions, IApiKey } from './api-key'; diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/stage.ts b/packages/aws-cdk-lib/aws-apigateway/lib/stage.ts new file mode 100644 index 0000000000000..ea052cd6d765d --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/lib/stage.ts @@ -0,0 +1,495 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import { ArnFormat, Duration, IResource, Resource, Stack, Token } from '../../core'; +import { Construct } from 'constructs'; +import { AccessLogFormat, IAccessLogDestination } from './access-log'; +import { IApiKey, ApiKeyOptions, ApiKey } from './api-key'; +import { ApiGatewayMetrics } from './apigateway-canned-metrics.generated'; +import { CfnStage } from './apigateway.generated'; +import { Deployment } from './deployment'; +import { IRestApi, RestApiBase } from './restapi'; +import { parseMethodOptionsPath } from './util'; + +/** + * Represents an APIGateway Stage. + */ +export interface IStage extends IResource { + /** + * Name of this stage. + * @attribute + */ + readonly stageName: string; + + /** + * RestApi to which this stage is associated. + */ + readonly restApi: IRestApi; + + /** + * Add an ApiKey to this Stage + */ + addApiKey(id: string, options?: ApiKeyOptions): IApiKey; +} + +export interface StageOptions extends MethodDeploymentOptions { + /** + * The name of the stage, which API Gateway uses as the first path segment + * in the invoked Uniform Resource Identifier (URI). + * + * @default - "prod" + */ + readonly stageName?: string; + + /** + * The CloudWatch Logs log group. + * + * @default - No destination + */ + readonly accessLogDestination?: IAccessLogDestination; + + /** + * A single line format of access logs of data, as specified by selected $content variables. + * The format must include either `AccessLogFormat.contextRequestId()` + * or `AccessLogFormat.contextExtendedRequestId()`. + * + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference + * + * @default - Common Log Format + */ + readonly accessLogFormat?: AccessLogFormat; + + /** + * Specifies whether Amazon X-Ray tracing is enabled for this method. + * + * @default false + */ + readonly tracingEnabled?: boolean; + + /** + * Indicates whether cache clustering is enabled for the stage. + * + * @default - Disabled for the stage. + */ + readonly cacheClusterEnabled?: boolean; + + /** + * The stage's cache cluster size. + * @default 0.5 + */ + readonly cacheClusterSize?: string; + + /** + * The identifier of the client certificate that API Gateway uses to call + * your integration endpoints in the stage. + * + * @default - None. + */ + readonly clientCertificateId?: string; + + /** + * A description of the purpose of the stage. + * + * @default - No description. + */ + readonly description?: string; + + /** + * The version identifier of the API documentation snapshot. + * + * @default - No documentation version. + */ + readonly documentationVersion?: string; + + /** + * A map that defines the stage variables. Variable names must consist of + * alphanumeric characters, and the values must match the following regular + * expression: [A-Za-z0-9-._~:/?#&=,]+. + * + * @default - No stage variables. + */ + readonly variables?: { [key: string]: string }; + + /** + * Method deployment options for specific resources/methods. These will + * override common options defined in `StageOptions#methodOptions`. + * + * @param path is {resource_path}/{http_method} (i.e. /api/toys/GET) for an + * individual method override. You can use `*` for both {resource_path} and {http_method} + * to define options for all methods/resources. + * + * @default - Common options will be used. + */ + readonly methodOptions?: { [path: string]: MethodDeploymentOptions }; +} + +export interface StageProps extends StageOptions { + /** + * The deployment that this stage points to [disable-awslint:ref-via-interface]. + */ + readonly deployment: Deployment; +} + +export enum MethodLoggingLevel { + OFF = 'OFF', + ERROR = 'ERROR', + INFO = 'INFO' +} + +export interface MethodDeploymentOptions { + /** + * Specifies whether Amazon CloudWatch metrics are enabled for this method. + * + * @default false + */ + readonly metricsEnabled?: boolean; + + /** + * Specifies the logging level for this method, which effects the log + * entries pushed to Amazon CloudWatch Logs. + * + * @default - Off + */ + readonly loggingLevel?: MethodLoggingLevel; + + /** + * Specifies whether data trace logging is enabled for this method. + * When enabled, API gateway will log the full API requests and responses. + * This can be useful to troubleshoot APIs, but can result in logging sensitive data. + * We recommend that you don't enable this feature for production APIs. + * + * @default false + */ + readonly dataTraceEnabled?: boolean; + + /** + * Specifies the throttling burst limit. + * The total rate of all requests in your AWS account is limited to 5,000 requests. + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html + * + * @default - No additional restriction. + */ + readonly throttlingBurstLimit?: number; + + /** + * Specifies the throttling rate limit. + * The total rate of all requests in your AWS account is limited to 10,000 requests per second (rps). + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html + * + * @default - No additional restriction. + */ + readonly throttlingRateLimit?: number; + + /** + * Specifies whether responses should be cached and returned for requests. A + * cache cluster must be enabled on the stage for responses to be cached. + * + * @default - Caching is Disabled. + */ + readonly cachingEnabled?: boolean; + + /** + * Specifies the time to live (TTL), in seconds, for cached responses. The + * higher the TTL, the longer the response will be cached. + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html + * + * @default Duration.minutes(5) + */ + readonly cacheTtl?: Duration; + + /** + * Indicates whether the cached responses are encrypted. + * + * @default false + */ + readonly cacheDataEncrypted?: boolean; +} + +/** + * The attributes of an imported Stage + */ +export interface StageAttributes { + /** + * The name of the stage + */ + readonly stageName: string; + + /** + * The RestApi that the stage belongs to + */ + readonly restApi: IRestApi; +} + +/** + * Base class for an ApiGateway Stage + */ +export abstract class StageBase extends Resource implements IStage { + public abstract readonly stageName: string; + public abstract readonly restApi: IRestApi; + + /** + * Add an ApiKey to this stage + */ + public addApiKey(id: string, options?: ApiKeyOptions): IApiKey { + return new ApiKey(this, id, { + stages: [this], + ...options, + }); + } + + /** + * Returns the invoke URL for a certain path. + * @param path The resource path + */ + public urlForPath(path: string = '/') { + if (!path.startsWith('/')) { + throw new Error(`Path must begin with "/": ${path}`); + } + return `https://${this.restApi.restApiId}.execute-api.${Stack.of(this).region}.${Stack.of(this).urlSuffix}/${this.stageName}${path}`; + } + + /** + * Returns the resource ARN for this stage: + * + * arn:aws:apigateway:{region}::/restapis/{restApiId}/stages/{stageName} + * + * Note that this is separate from the execute-api ARN for methods and resources + * within this stage. + * + * @attribute + */ + public get stageArn() { + return Stack.of(this).formatArn({ + arnFormat: ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME, + service: 'apigateway', + account: '', + resource: 'restapis', + resourceName: `${this.restApi.restApiId}/stages/${this.stageName}`, + }); + } + + /** + * Returns the given named metric for this stage + */ + public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + namespace: 'AWS/ApiGateway', + metricName, + dimensionsMap: { ApiName: this.restApi.restApiName, Stage: this.stageName }, + ...props, + }).attachTo(this); + } + + /** + * Metric for the number of client-side errors captured in a given period. + * + * @default - sum over 5 minutes + */ + public metricClientError(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics._4XxErrorSum, props); + } + + /** + * Metric for the number of server-side errors captured in a given period. + * + * @default - sum over 5 minutes + */ + public metricServerError(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics._5XxErrorSum, props); + } + + /** + * Metric for the number of requests served from the API cache in a given period. + * + * @default - sum over 5 minutes + */ + public metricCacheHitCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.cacheHitCountSum, props); + } + + /** + * Metric for the number of requests served from the backend in a given period, + * when API caching is enabled. + * + * @default - sum over 5 minutes + */ + public metricCacheMissCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.cacheMissCountSum, props); + } + + /** + * Metric for the total number API requests in a given period. + * + * @default - sample count over 5 minutes + */ + public metricCount(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.countSum, { + statistic: 'SampleCount', + ...props, + }); + } + + /** + * Metric for the time between when API Gateway relays a request to the backend + * and when it receives a response from the backend. + * + * @default - average over 5 minutes. + */ + public metricIntegrationLatency(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.integrationLatencyAverage, props); + } + + /** + * The time between when API Gateway receives a request from a client + * and when it returns a response to the client. + * The latency includes the integration latency and other API Gateway overhead. + * + * @default - average over 5 minutes. + */ + public metricLatency(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ApiGatewayMetrics.latencyAverage, props); + } + + private cannedMetric(fn: (dims: { ApiName: string; Stage: string }) => cloudwatch.MetricProps, props?: cloudwatch.MetricOptions) { + return new cloudwatch.Metric({ + ...fn({ ApiName: this.restApi.restApiName, Stage: this.stageName }), + ...props, + }).attachTo(this); + } +} + +export class Stage extends StageBase { + /** + * Import a Stage by its attributes + */ + public static fromStageAttributes(scope: Construct, id: string, attrs: StageAttributes): IStage { + class Import extends StageBase { + public readonly stageName = attrs.stageName; + public readonly restApi = attrs.restApi; + } + return new Import(scope, id); + } + + public readonly stageName: string; + public readonly restApi: IRestApi; + + private enableCacheCluster?: boolean; + + constructor(scope: Construct, id: string, props: StageProps) { + super(scope, id); + + this.enableCacheCluster = props.cacheClusterEnabled; + + const methodSettings = this.renderMethodSettings(props); // this can mutate `this.cacheClusterEnabled` + + // custom access logging + let accessLogSetting: CfnStage.AccessLogSettingProperty | undefined; + const accessLogDestination = props.accessLogDestination; + const accessLogFormat = props.accessLogFormat; + if (!accessLogDestination && !accessLogFormat) { + accessLogSetting = undefined; + } else { + if (accessLogFormat !== undefined && + !Token.isUnresolved(accessLogFormat.toString()) && + !/.*\$context.(requestId|extendedRequestId)\b.*/.test(accessLogFormat.toString())) { + + throw new Error('Access log must include either `AccessLogFormat.contextRequestId()` or `AccessLogFormat.contextExtendedRequestId()`'); + } + if (accessLogFormat !== undefined && accessLogDestination === undefined) { + throw new Error('Access log format is specified without a destination'); + } + + accessLogSetting = { + destinationArn: accessLogDestination?.bind(this).destinationArn, + format: accessLogFormat?.toString() ? accessLogFormat?.toString() : AccessLogFormat.clf().toString(), + }; + } + + // enable cache cluster if cacheClusterSize is set + if (props.cacheClusterSize !== undefined) { + if (this.enableCacheCluster === undefined) { + this.enableCacheCluster = true; + } else if (this.enableCacheCluster === false) { + throw new Error(`Cannot set "cacheClusterSize" to ${props.cacheClusterSize} and "cacheClusterEnabled" to "false"`); + } + } + + const cacheClusterSize = this.enableCacheCluster ? (props.cacheClusterSize || '0.5') : undefined; + const resource = new CfnStage(this, 'Resource', { + stageName: props.stageName || 'prod', + accessLogSetting, + cacheClusterEnabled: this.enableCacheCluster, + cacheClusterSize, + clientCertificateId: props.clientCertificateId, + deploymentId: props.deployment.deploymentId, + restApiId: props.deployment.api.restApiId, + description: props.description, + documentationVersion: props.documentationVersion, + variables: props.variables, + tracingEnabled: props.tracingEnabled, + methodSettings, + }); + + this.stageName = resource.ref; + this.restApi = props.deployment.api; + + if (RestApiBase._isRestApiBase(this.restApi)) { + this.restApi._attachStage(this); + } + } + + + private renderMethodSettings(props: StageProps): CfnStage.MethodSettingProperty[] | undefined { + const settings = new Array(); + const self = this; + + // extract common method options from the stage props + const commonMethodOptions: MethodDeploymentOptions = { + metricsEnabled: props.metricsEnabled, + loggingLevel: props.loggingLevel, + dataTraceEnabled: props.dataTraceEnabled, + throttlingBurstLimit: props.throttlingBurstLimit, + throttlingRateLimit: props.throttlingRateLimit, + cachingEnabled: props.cachingEnabled, + cacheTtl: props.cacheTtl, + cacheDataEncrypted: props.cacheDataEncrypted, + }; + + // if any of them are defined, add an entry for '/*/*'. + const hasCommonOptions = Object.keys(commonMethodOptions).map(v => (commonMethodOptions as any)[v]).filter(x => x !== undefined).length > 0; + if (hasCommonOptions) { + settings.push(renderEntry('/*/*', commonMethodOptions)); + } + + if (props.methodOptions) { + for (const path of Object.keys(props.methodOptions)) { + settings.push(renderEntry(path, props.methodOptions[path])); + } + } + + return settings.length === 0 ? undefined : settings; + + function renderEntry(path: string, options: MethodDeploymentOptions): CfnStage.MethodSettingProperty { + if (options.cachingEnabled) { + if (self.enableCacheCluster === undefined) { + self.enableCacheCluster = true; + } else if (self.enableCacheCluster === false) { + throw new Error(`Cannot enable caching for method ${path} since cache cluster is disabled on stage`); + } + } + + const { httpMethod, resourcePath } = parseMethodOptionsPath(path); + + return { + httpMethod, + resourcePath, + cacheDataEncrypted: options.cacheDataEncrypted, + cacheTtlInSeconds: options.cacheTtl && options.cacheTtl.toSeconds(), + cachingEnabled: options.cachingEnabled, + dataTraceEnabled: options.dataTraceEnabled ?? false, + loggingLevel: options.loggingLevel, + metricsEnabled: options.metricsEnabled, + throttlingBurstLimit: options.throttlingBurstLimit, + throttlingRateLimit: options.throttlingRateLimit, + }; + } + } +} diff --git a/packages/@aws-cdk/aws-apigateway/lib/stepfunctions-api.ts b/packages/aws-cdk-lib/aws-apigateway/lib/stepfunctions-api.ts similarity index 97% rename from packages/@aws-cdk/aws-apigateway/lib/stepfunctions-api.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/stepfunctions-api.ts index c48b497160bd7..1e2c3fcfe520c 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/stepfunctions-api.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/stepfunctions-api.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../aws-iam'; +import * as sfn from '../../aws-stepfunctions'; import { Construct } from 'constructs'; import { RestApi, RestApiProps } from '.'; import { RequestContext } from './integrations'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts b/packages/aws-cdk-lib/aws-apigateway/lib/usage-plan.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/usage-plan.ts index 2f10071259517..71bb8246669fb 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/usage-plan.ts @@ -1,5 +1,5 @@ -import { FeatureFlags, IResource, Lazy, Names, Resource, Token } from '@aws-cdk/core'; -import { APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID } from '@aws-cdk/cx-api'; +import { FeatureFlags, IResource, Lazy, Names, Resource, Token } from '../../core'; +import { APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID } from '../../cx-api'; import { Construct } from 'constructs'; import { IApiKey } from './api-key'; import { CfnUsagePlan, CfnUsagePlanKey } from './apigateway.generated'; diff --git a/packages/@aws-cdk/aws-apigateway/lib/util.ts b/packages/aws-cdk-lib/aws-apigateway/lib/util.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/lib/util.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/util.ts diff --git a/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts b/packages/aws-cdk-lib/aws-apigateway/lib/vpc-link.ts similarity index 95% rename from packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts rename to packages/aws-cdk-lib/aws-apigateway/lib/vpc-link.ts index 06a168d31e557..d76864e6e493b 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/vpc-link.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/vpc-link.ts @@ -1,5 +1,5 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { IResource, Lazy, Names, Resource } from '@aws-cdk/core'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { IResource, Lazy, Names, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnVpcLink } from './apigateway.generated'; diff --git a/packages/@aws-cdk/aws-apigateway/test/access-log.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/access-log.test.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/access-log.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/access-log.test.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/api-definition.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/api-definition.test.ts similarity index 96% rename from packages/@aws-cdk/aws-apigateway/test/api-definition.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/api-definition.test.ts index 2b30a992749bb..78ca40f3260ea 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-definition.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/api-definition.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as apigw from '../lib'; describe('api definition', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/api-key.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/api-key.test.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/test/api-key.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/api-key.test.ts index 0a77e792065dc..e414d0b1a068a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/api-key.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/api-key.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as apigateway from '../lib'; describe('api key', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizer.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizer.test.ts similarity index 93% rename from packages/@aws-cdk/aws-apigateway/test/authorizer.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/authorizer.test.ts index 0946ef4214c73..cf5ab6c37904f 100644 --- a/packages/@aws-cdk/aws-apigateway/test/authorizer.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/authorizer.test.ts @@ -1,4 +1,4 @@ -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../core'; import { Authorizer, IRestApi } from '../lib'; describe('authorizer', () => { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/authorizers/cognito.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/cognito.test.ts new file mode 100644 index 0000000000000..0d886634910e5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/cognito.test.ts @@ -0,0 +1,120 @@ +import { Template } from '../../../assertions'; +import * as cognito from '../../../aws-cognito'; +import { Duration, Stack } from '../../../core'; +import { AuthorizationType, CognitoUserPoolsAuthorizer, RestApi } from '../../lib'; + +describe('Cognito Authorizer', () => { + test('default cognito authorizer', () => { + // GIVEN + const stack = new Stack(); + const userPool = new cognito.UserPool(stack, 'UserPool'); + + // WHEN + const authorizer = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { + cognitoUserPools: [userPool], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer, + authorizationType: AuthorizationType.COGNITO, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'COGNITO_USER_POOLS', + RestApiId: stack.resolve(restApi.restApiId), + IdentitySource: 'method.request.header.Authorization', + ProviderARNs: [stack.resolve(userPool.userPoolArn)], + }); + + expect(authorizer.authorizerArn.endsWith(`/authorizers/${authorizer.authorizerId}`)).toBeTruthy(); + }); + + test('cognito authorizer with all parameters specified', () => { + // GIVEN + const stack = new Stack(); + const userPool1 = new cognito.UserPool(stack, 'UserPool1'); + const userPool2 = new cognito.UserPool(stack, 'UserPool2'); + + // WHEN + const authorizer = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { + cognitoUserPools: [userPool1, userPool2], + identitySource: 'method.request.header.whoami', + authorizerName: 'myauthorizer', + resultsCacheTtl: Duration.minutes(1), + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer, + authorizationType: AuthorizationType.COGNITO, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'COGNITO_USER_POOLS', + Name: 'myauthorizer', + RestApiId: stack.resolve(restApi.restApiId), + IdentitySource: 'method.request.header.whoami', + AuthorizerResultTtlInSeconds: 60, + ProviderARNs: [stack.resolve(userPool1.userPoolArn), stack.resolve(userPool2.userPoolArn)], + }); + + expect(authorizer.authorizerArn.endsWith(`/authorizers/${authorizer.authorizerId}`)).toBeTruthy(); + }); + + test('rest api depends on the authorizer when @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { + const stack = new Stack(); + stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); + const userPool1 = new cognito.UserPool(stack, 'UserPool'); + + const authorizer = new CognitoUserPoolsAuthorizer(stack, 'Authorizer', { + cognitoUserPools: [userPool1], + }); + + const restApi = new RestApi(stack, 'Api'); + + restApi.root.addMethod('ANY', undefined, { + authorizer, + authorizationType: AuthorizationType.COGNITO, + }); + + const template = Template.fromStack(stack); + + const authorizerId = Object.keys(template.findResources('AWS::ApiGateway::Authorizer'))[0]; + const deployment = Object.values(template.findResources('AWS::ApiGateway::Deployment'))[0]; + + expect(deployment.DependsOn).toEqual(expect.arrayContaining([authorizerId])); + }); + + test('a new deployment is created when a cognito user pool is re-created and @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { + const createApiTemplate = (userPoolId: string) => { + const stack = new Stack(); + stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); + + const userPool = new cognito.UserPool(stack, userPoolId); + + const auth = new CognitoUserPoolsAuthorizer(stack, 'myauthorizer', { + resultsCacheTtl: Duration.seconds(0), + cognitoUserPools: [userPool], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.COGNITO, + }); + + return Template.fromStack(stack); + }; + + const oldTemplate = createApiTemplate('foo'); + const newTemplate = createApiTemplate('bar'); + + const oldDeploymentId = Object.keys(oldTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; + const newDeploymentId = Object.keys(newTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; + + expect(oldDeploymentId).not.toEqual(newDeploymentId); + }); +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/authorizers/identity-source.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/identity-source.test.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/authorizers/identity-source.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/authorizers/identity-source.test.ts diff --git a/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts new file mode 100644 index 0000000000000..517b5fe0c3d4b --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.request-authorizer.handler/index.ts @@ -0,0 +1,25 @@ +/* eslint-disable no-console */ + +export const handler = async (event: any, _context: any = {}): Promise => { + const authToken: string = event.headers.Authorization; + const authQueryString: string = event.queryStringParameters.allow; + console.log(`event.headers.Authorization = ${authToken}`); + console.log(`event.queryStringParameters.allow = ${authQueryString}`); + if ((authToken === 'allow' || authToken === 'deny') && authQueryString === 'yes') { + return { + principalId: 'user', + policyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: 'execute-api:Invoke', + Effect: authToken, + Resource: event.methodArn, + }, + ], + }, + }; + } else { + throw new Error('Unauthorized'); + } +}; diff --git a/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts new file mode 100644 index 0000000000000..3f1d8d3aa4935 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts @@ -0,0 +1,60 @@ +import * as path from 'path'; +import * as lambda from '../../../aws-lambda'; +import { App, Stack } from '../../../core'; +import { MockIntegration, PassthroughBehavior, RestApi, RequestAuthorizer, IdentitySource } from '../../lib'; + +// Against the RestApi endpoint from the stack output, run +// `curl -s -o /dev/null -w "%{http_code}" ` should return 401 +// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: deny' ?allow=yes` should return 403 +// `curl -s -o /dev/null -w "%{http_code}" -H 'Authorization: allow' ?allow=yes` should return 200 + +const app = new App(); +const stack = new Stack(app, 'RequestAuthorizerInteg'); + +const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')), +}); + +const restapi = new RestApi(stack, 'MyRestApi', { cloudWatchRole: true }); + +const authorizer = new RequestAuthorizer(stack, 'MyAuthorizer', { + handler: authorizerFn, + identitySources: [IdentitySource.header('Authorization'), IdentitySource.queryString('allow')], +}); + +const secondAuthorizer = new RequestAuthorizer(stack, 'MySecondAuthorizer', { + handler: authorizerFn, + identitySources: [IdentitySource.header('Authorization'), IdentitySource.queryString('allow')], +}); + +restapi.root.addMethod('ANY', new MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer, +}); + +restapi.root.resourceForPath('auth').addMethod('ANY', new MockIntegration({ + integrationResponses: [ + { statusCode: '200' }, + ], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, +}), { + methodResponses: [ + { statusCode: '200' }, + ], + authorizer: secondAuthorizer, +}); diff --git a/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts new file mode 100644 index 0000000000000..4d1f1d9307e39 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/integ.token-authorizer.handler/index.ts @@ -0,0 +1,23 @@ +/* eslint-disable no-console */ + +export const handler = async (event: any, _context: any = {}): Promise => { + const authToken: string = event.authorizationToken; + console.log(`event.authorizationToken = ${authToken}`); + if (authToken === 'allow' || authToken === 'deny') { + return { + principalId: 'user', + policyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: 'execute-api:Invoke', + Effect: authToken, + Resource: event.methodArn, + }, + ], + }, + }; + } else { + throw new Error('Unauthorized'); + } +}; diff --git a/packages/aws-cdk-lib/aws-apigateway/test/authorizers/lambda.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/lambda.test.ts new file mode 100644 index 0000000000000..ab8c6c71b2ff3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/authorizers/lambda.test.ts @@ -0,0 +1,652 @@ +import { Match, Template } from '../../../assertions'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import { Duration, Stack } from '../../../core'; +import { AuthorizationType, IdentitySource, RequestAuthorizer, RestApi, TokenAuthorizer } from '../../lib'; + +describe('lambda authorizer', () => { + test('default token authorizer', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const auth = new TokenAuthorizer(stack, 'myauthorizer', { + handler: func, + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'TOKEN', + RestApiId: stack.resolve(restApi.restApiId), + IdentitySource: 'method.request.header.Authorization', + AuthorizerUri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':apigateway:', + { + 'Fn::Select': [ + 3, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + '/invocations', + ], + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + Principal: 'apigateway.amazonaws.com', + }); + + expect(auth.authorizerArn.endsWith(`/authorizers/${auth.authorizerId}`)).toBeTruthy(); + }); + + test('default request authorizer', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + resultsCacheTtl: Duration.seconds(0), + identitySources: [], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'REQUEST', + RestApiId: stack.resolve(restApi.restApiId), + AuthorizerUri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':apigateway:', + { + 'Fn::Select': [ + 3, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + '/invocations', + ], + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + Principal: 'apigateway.amazonaws.com', + }); + + expect(auth.authorizerArn.endsWith(`/authorizers/${auth.authorizerId}`)).toBeTruthy(); + + + }); + + test('invalid request authorizer config', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + expect(() => new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + resultsCacheTtl: Duration.seconds(1), + identitySources: [], + })).toThrow('At least one Identity Source is required for a REQUEST-based Lambda authorizer if caching is enabled.'); + }); + + test('token authorizer with all parameters specified', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const auth = new TokenAuthorizer(stack, 'myauthorizer', { + handler: func, + identitySource: 'method.request.header.whoami', + validationRegex: 'a-hacker', + authorizerName: 'myauthorizer', + resultsCacheTtl: Duration.minutes(1), + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'TOKEN', + RestApiId: stack.resolve(restApi.restApiId), + IdentitySource: 'method.request.header.whoami', + IdentityValidationExpression: 'a-hacker', + Name: 'myauthorizer', + AuthorizerResultTtlInSeconds: 60, + AuthorizerUri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':apigateway:', + { + 'Fn::Select': [ + 3, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + '/invocations', + ], + ], + }, + }); + }); + + test('request authorizer with all parameters specified', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + identitySources: [IdentitySource.header('whoami')], + authorizerName: 'myauthorizer', + resultsCacheTtl: Duration.minutes(1), + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'REQUEST', + RestApiId: stack.resolve(restApi.restApiId), + IdentitySource: 'method.request.header.whoami', + Name: 'myauthorizer', + AuthorizerResultTtlInSeconds: 60, + AuthorizerUri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':apigateway:', + { + 'Fn::Select': [ + 3, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + '/invocations', + ], + ], + }, + }); + }); + + test('token authorizer with assume role', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const role = new iam.Role(stack, 'authorizerassumerole', { + assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), + roleName: 'authorizerassumerole', + }); + + const auth = new TokenAuthorizer(stack, 'myauthorizer', { + handler: func, + assumeRole: role, + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'TOKEN', + RestApiId: stack.resolve(restApi.restApiId), + AuthorizerUri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':apigateway:', + { + 'Fn::Select': [ + 3, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + '/invocations', + ], + ], + }, + }); + + Template.fromStack(stack).hasResource('AWS::IAM::Role', Match.anyValue()); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + Roles: [ + stack.resolve(role.roleName), + ], + PolicyDocument: { + Statement: [ + { + Resource: stack.resolve(func.resourceArnsForGrantInvoke), + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + }, + ], + }, + }); + + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); + }); + + test('request authorizer with assume role', () => { + const stack = new Stack(); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const role = new iam.Role(stack, 'authorizerassumerole', { + assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), + roleName: 'authorizerassumerole', + }); + + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + assumeRole: role, + resultsCacheTtl: Duration.seconds(0), + identitySources: [], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Authorizer', { + Type: 'REQUEST', + RestApiId: stack.resolve(restApi.restApiId), + AuthorizerUri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':apigateway:', + { + 'Fn::Select': [ + 3, + { + 'Fn::Split': [ + ':', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + ], + }, + ], + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': ['myfunction9B95E948', 'Arn'], + }, + '/invocations', + ], + ], + }, + }); + + Template.fromStack(stack).hasResource('AWS::IAM::Role', Match.anyValue()); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + Roles: [ + stack.resolve(role.roleName), + ], + PolicyDocument: { + Statement: [ + { + Resource: stack.resolve(func.resourceArnsForGrantInvoke), + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + }, + ], + }, + }); + + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); + }); + + test('token authorizer throws when not attached to a rest api', () => { + const stack = new Stack(); + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + const auth = new TokenAuthorizer(stack, 'myauthorizer', { + handler: func, + }); + + expect(() => stack.resolve(auth.authorizerArn)).toThrow(/must be attached to a RestApi/); + }); + + test('request authorizer throws when not attached to a rest api', () => { + const stack = new Stack(); + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + identitySources: [IdentitySource.header('myheader')], + }); + + expect(() => stack.resolve(auth.authorizerArn)).toThrow(/must be attached to a RestApi/); + }); + + test('rest api depends on the token authorizer when @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { + const stack = new Stack(); + stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_18_X, + }); + + const auth = new TokenAuthorizer(stack, 'myauthorizer', { + handler: func, + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + const template = Template.fromStack(stack); + + const authorizerId = Object.keys(template.findResources('AWS::ApiGateway::Authorizer'))[0]; + const deployment = Object.values(template.findResources('AWS::ApiGateway::Deployment'))[0]; + + expect(deployment.DependsOn).toEqual(expect.arrayContaining([authorizerId])); + }); + + test('rest api depends on the request authorizer when @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { + const stack = new Stack(); + stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + resultsCacheTtl: Duration.seconds(0), + identitySources: [], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + const template = Template.fromStack(stack); + + const authorizerId = Object.keys(template.findResources('AWS::ApiGateway::Authorizer'))[0]; + const deployment = Object.values(template.findResources('AWS::ApiGateway::Deployment'))[0]; + + expect(deployment.DependsOn).toEqual(expect.arrayContaining([authorizerId])); + }); + + test('a new deployment is created when a lambda function changes name and @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { + const createApiTemplate = (lambdaFunctionName: string) => { + const stack = new Stack(); + stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); + + const func = new lambda.Function(stack, 'myfunction', { + handler: 'handler', + functionName: lambdaFunctionName, + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_18_X, + }); + + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + resultsCacheTtl: Duration.seconds(0), + identitySources: [], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + return Template.fromStack(stack); + }; + + const oldTemplate = createApiTemplate('foo'); + const newTemplate = createApiTemplate('bar'); + + const oldDeploymentId = Object.keys(oldTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; + const newDeploymentId = Object.keys(newTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; + + expect(oldDeploymentId).not.toEqual(newDeploymentId); + }); + + test('a new deployment is created when an imported lambda function changes name and @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId is enabled', () => { + const createApiTemplate = (lambdaFunctionName: string) => { + const stack = new Stack(); + stack.node.setContext('@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId', true); + + const func = lambda.Function.fromFunctionName(stack, 'myfunction', lambdaFunctionName); + + const auth = new RequestAuthorizer(stack, 'myauthorizer', { + handler: func, + resultsCacheTtl: Duration.seconds(0), + identitySources: [], + }); + + const restApi = new RestApi(stack, 'myrestapi'); + restApi.root.addMethod('ANY', undefined, { + authorizer: auth, + authorizationType: AuthorizationType.CUSTOM, + }); + + return Template.fromStack(stack); + }; + + const oldTemplate = createApiTemplate('foo'); + const newTemplate = createApiTemplate('bar'); + + const oldDeploymentId = Object.keys(oldTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; + const newDeploymentId = Object.keys(newTemplate.findResources('AWS::ApiGateway::Deployment'))[0]; + + expect(oldDeploymentId).not.toEqual(newDeploymentId); + }); +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/base-path-mapping.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/base-path-mapping.test.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/test/base-path-mapping.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/base-path-mapping.test.ts index 69e7e98d9146f..92092c775333a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/base-path-mapping.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/base-path-mapping.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import * as cdk from '../../core'; import * as apigw from '../lib'; describe('BasePathMapping', () => { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/cors.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/cors.test.ts new file mode 100644 index 0000000000000..a4969efc41d73 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/cors.test.ts @@ -0,0 +1,683 @@ +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import { Duration, Stack } from '../../core'; +import * as apigw from '../lib'; + +describe('cors', () => { + test('adds an OPTIONS method to a resource', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://amazon.com'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('allowCredentials', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://amazon.com'], + allowCredentials: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + 'method.response.header.Access-Control-Allow-Credentials': "'true'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + 'method.response.header.Access-Control-Allow-Credentials': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('allowMethods', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://aws.amazon.com'], + allowMethods: ['GET', 'PUT'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://aws.amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'GET,PUT'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('allowMethods ANY will expand to all supported methods', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://aws.amazon.com'], + allowMethods: ['ANY'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://aws.amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('allowMethods ANY cannot be used with any other method', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // THEN + expect(() => resource.addCorsPreflight({ + allowOrigins: ['https://aws.amazon.com'], + allowMethods: ['ANY', 'PUT'], + })).toThrow(/ANY cannot be used with any other method. Received: ANY,PUT/); + }); + + test('statusCode can be used to set the response status code', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://aws.amazon.com'], + statusCode: 200, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://aws.amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + }, + StatusCode: '200', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + }, + StatusCode: '200', + }, + ], + }); + }); + + test('allowOrigins must contain at least one origin', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + expect(() => resource.addCorsPreflight({ + allowOrigins: [], + })).toThrow(/allowOrigins must contain at least one origin/); + }); + + test('allowOrigins can be used to specify multiple origins', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://twitch.tv', 'https://amazon.com', 'https://aws.amazon.com'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://twitch.tv'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + }, + ResponseTemplates: { + 'application/json': '#set($origin = $input.params().header.get("Origin"))\n#if($origin == "") #set($origin = $input.params().header.get("origin")) #end\n#if($origin.matches("https://amazon.com") || $origin.matches("https://aws.amazon.com"))\n #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)\n#end', + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('maxAge can be used to specify Access-Control-Max-Age', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://amazon.com'], + maxAge: Duration.minutes(60), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + 'method.response.header.Access-Control-Max-Age': `'${60 * 60}'`, + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + 'method.response.header.Access-Control-Max-Age': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('disableCache will set Max-Age to -1', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://amazon.com'], + disableCache: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + 'method.response.header.Access-Control-Max-Age': '\'-1\'', + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + 'method.response.header.Access-Control-Max-Age': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('maxAge and disableCache are mutually exclusive', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // THEN + expect(() => resource.addCorsPreflight({ + allowOrigins: ['https://amazon.com'], + disableCache: true, + maxAge: Duration.seconds(10), + })).toThrow(/The options "maxAge" and "disableCache" are mutually exclusive/); + }); + + test('exposeHeaders can be used to specify Access-Control-Expose-Headers', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const resource = api.root.addResource('MyResource'); + + // WHEN + resource.addCorsPreflight({ + allowOrigins: ['https://amazon.com'], + exposeHeaders: ['Authorization', 'Foo'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'https://amazon.com'", + 'method.response.header.Vary': "'Origin'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + 'method.response.header.Access-Control-Expose-Headers': "'Authorization,Foo'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Vary': true, + 'method.response.header.Access-Control-Allow-Methods': true, + 'method.response.header.Access-Control-Expose-Headers': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('defaultCorsPreflightOptions can be used to specify CORS for all resource tree', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + + // WHEN + const resource = api.root.addResource('MyResource', { + defaultCorsPreflightOptions: { + allowOrigins: ['https://amazon.com'], + }, + }); + resource.addResource('MyChildResource'); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 2); // on both resources + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceD5CDB490' }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apiMyResourceMyChildResource2DC010C5' }, + }); + }); + + test('defaultCorsPreflightOptions can be specified at the API level to apply to all resources', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'api', { + defaultCorsPreflightOptions: { + allowOrigins: ['https://amazon.com'], + }, + }); + + const child1 = api.root.addResource('child1'); + child1.addResource('child2'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { 'Fn::GetAtt': ['apiC8550315', 'RootResourceId'] }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apichild1841A5840' }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { Ref: 'apichild1child26A9A7C47' }, + }); + }); + + test('Vary: Origin is sent back if Allow-Origin is not "*"', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + + // WHEN + api.root.addResource('AllowAll', { + defaultCorsPreflightOptions: { + allowOrigins: apigw.Cors.ALL_ORIGINS, + }, + }); + + api.root.addResource('AllowSpecific', { + defaultCorsPreflightOptions: { + allowOrigins: ['http://specific.com'], + }, + }); + + // THENB + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + ResourceId: { + Ref: 'apiAllowAll2F5BC564', + }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'*'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Access-Control-Allow-Methods': true, + }, + StatusCode: '204', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + ResourceId: { + Ref: 'apiAllowSpecific77DD8AF1', + }, + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", + 'method.response.header.Access-Control-Allow-Origin': "'http://specific.com'", + 'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'", + 'method.response.header.Vary': "'Origin'", + }, + StatusCode: '204', + }, + ], + RequestTemplates: { + 'application/json': '{ statusCode: 200 }', + }, + Type: 'MOCK', + }, + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Headers': true, + 'method.response.header.Access-Control-Allow-Origin': true, + 'method.response.header.Access-Control-Allow-Methods': true, + 'method.response.header.Vary': true, + }, + StatusCode: '204', + }, + ], + }); + }); + + test('If "*" is specified in allow-origin, it cannot be mixed with specific origins', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + + // WHEN + expect(() => api.root.addResource('AllowAll', { + defaultCorsPreflightOptions: { + allowOrigins: ['https://bla.com', '*', 'https://specific'], + }, + })).toThrow(/Invalid "allowOrigins" - cannot mix "\*" with specific origins: https:\/\/bla\.com,\*,https:\/\/specific/); + }); + + test('defaultCorsPreflightOptions can be used to specify CORS for all resource tree [LambdaRestApi]', () => { + // GIVEN + const stack = new Stack(); + + const handler = new lambda.Function(stack, 'handler', { + handler: 'index.handler', + code: lambda.Code.fromInline('boom'), + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + new apigw.LambdaRestApi(stack, 'lambda-rest-api', { + handler, + defaultCorsPreflightOptions: { + allowOrigins: ['https://amazon.com'], + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 4); // two ANY and two OPTIONS resources + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { + 'Fn::GetAtt': [ + 'lambdarestapiAAD10924', + 'RootResourceId', + ], + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + ResourceId: { + Ref: 'lambdarestapiproxyE3AE07E3', + }, + }); + }); + + test('CORS and proxy resources', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const api = new apigw.RestApi(stack, 'API', { + defaultCorsPreflightOptions: { allowOrigins: ['*'] }, + }); + + api.root.addProxy(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'OPTIONS', + }); + }); +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/deployment.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/deployment.test.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/test/deployment.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/deployment.test.ts index ae74fd4080f62..07bfbc6333da9 100644 --- a/packages/@aws-cdk/aws-apigateway/test/deployment.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/deployment.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { CfnResource, Lazy, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import { CfnResource, Lazy, Stack } from '../../core'; import * as apigateway from '../lib'; describe('deployment', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/domains.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/domains.test.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/test/domains.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/domains.test.ts index 63b70457c2b4d..456dcc64cd563 100644 --- a/packages/@aws-cdk/aws-apigateway/test/domains.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/domains.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Bucket } from '@aws-cdk/aws-s3'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import { Bucket } from '../../aws-s3'; +import { Stack } from '../../core'; import * as apigw from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-apigateway/test/gateway-response.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/gateway-response.test.ts similarity index 97% rename from packages/@aws-cdk/aws-apigateway/test/gateway-response.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/gateway-response.test.ts index 80093aba04de1..fcbc0a3066c65 100644 --- a/packages/@aws-cdk/aws-apigateway/test/gateway-response.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/gateway-response.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import { Stack } from '../../core'; import { ResponseType, RestApi } from '../lib'; describe('gateway response', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/http.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/http.test.ts similarity index 93% rename from packages/@aws-cdk/aws-apigateway/test/http.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/http.test.ts index 4d687da1546b7..d375aa978932a 100644 --- a/packages/@aws-cdk/aws-apigateway/test/http.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/http.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as apigateway from '../lib'; describe('http integration', () => { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integ.cors.handler/index.ts b/packages/aws-cdk-lib/aws-apigateway/test/integ.cors.handler/index.ts new file mode 100644 index 0000000000000..dd19c03dd795f --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/integ.cors.handler/index.ts @@ -0,0 +1,11 @@ +exports.handler = async (evt: any) => { + // eslint-disable-next-line no-console + console.error(JSON.stringify(evt, undefined, 2)); + return { + statusCode: 200, + body: 'hello, cors!', + headers: { + 'Access-Control-Allow-Origin': '*', + }, + }; +}; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integ.restapi-import.lit.ts b/packages/aws-cdk-lib/aws-apigateway/test/integ.restapi-import.lit.ts new file mode 100644 index 0000000000000..c914f9a33be0c --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/integ.restapi-import.lit.ts @@ -0,0 +1,130 @@ +import { App, CfnOutput, NestedStack, NestedStackProps, Stack } from '../../core'; +import { Construct } from 'constructs'; +import { Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage } from '../lib'; + +/** + * This file showcases how to split up a RestApi's Resources and Methods across nested stacks. + * + * The root stack 'RootStack' first defines a RestApi. + * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'. + * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack. + * + * To verify this worked, go to the APIGateway + */ + +class RootStack extends Stack { + constructor(scope: Construct) { + super(scope, 'integ-restapi-import-RootStack'); + + const restApi = new RestApi(this, 'RestApi', { + cloudWatchRole: true, + deploy: false, + }); + restApi.root.addMethod('ANY'); + + const petsStack = new PetsStack(this, { + restApiId: restApi.restApiId, + rootResourceId: restApi.restApiRootResourceId, + }); + const booksStack = new BooksStack(this, { + restApiId: restApi.restApiId, + rootResourceId: restApi.restApiRootResourceId, + }); + new DeployStack(this, { + restApiId: restApi.restApiId, + methods: petsStack.methods.concat(booksStack.methods), + }); + + new CfnOutput(this, 'PetsURL', { + value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/pets`, + }); + + new CfnOutput(this, 'BooksURL', { + value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/books`, + }); + } +} + +interface ResourceNestedStackProps extends NestedStackProps { + readonly restApiId: string; + + readonly rootResourceId: string; +} + +class PetsStack extends NestedStack { + public readonly methods: Method[] = []; + + constructor(scope: Construct, props: ResourceNestedStackProps) { + super(scope, 'integ-restapi-import-PetsStack', props); + + const api = RestApi.fromRestApiAttributes(this, 'RestApi', { + restApiId: props.restApiId, + rootResourceId: props.rootResourceId, + }); + + const method = api.root.addResource('pets').addMethod('GET', new MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, + }), { + methodResponses: [{ statusCode: '200' }], + }); + + this.methods.push(method); + } +} + +class BooksStack extends NestedStack { + public readonly methods: Method[] = []; + + constructor(scope: Construct, props: ResourceNestedStackProps) { + super(scope, 'integ-restapi-import-BooksStack', props); + + const api = RestApi.fromRestApiAttributes(this, 'RestApi', { + restApiId: props.restApiId, + rootResourceId: props.rootResourceId, + }); + + const method = api.root.addResource('books').addMethod('GET', new MockIntegration({ + integrationResponses: [{ + statusCode: '200', + }], + passthroughBehavior: PassthroughBehavior.NEVER, + requestTemplates: { + 'application/json': '{ "statusCode": 200 }', + }, + }), { + methodResponses: [{ statusCode: '200' }], + }); + + this.methods.push(method); + } +} + +interface DeployStackProps extends NestedStackProps { + readonly restApiId: string; + + readonly methods?: Method[]; +} + +class DeployStack extends NestedStack { + constructor(scope: Construct, props: DeployStackProps) { + super(scope, 'integ-restapi-import-DeployStack', props); + + const deployment = new Deployment(this, 'Deployment', { + api: RestApi.fromRestApiId(this, 'RestApi', props.restApiId), + }); + if (props.methods) { + for (const method of props.methods) { + deployment.node.addDependency(method); + } + } + new Stage(this, 'Stage', { deployment }); + } +} + +new RootStack(new App()); diff --git a/packages/@aws-cdk/aws-apigateway/test/integration.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integration.test.ts similarity index 96% rename from packages/@aws-cdk/aws-apigateway/test/integration.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/integration.test.ts index 0ae46986bcc93..c48743f8c2a98 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integration.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integration.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as apigw from '../lib'; describe('integration', () => { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/lambda.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/lambda.test.ts new file mode 100644 index 0000000000000..07642c8307086 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/lambda.test.ts @@ -0,0 +1,300 @@ +import { Match, Template } from '../../../assertions'; +import * as lambda from '../../../aws-lambda'; +import * as cdk from '../../../core'; +import * as apigateway from '../../lib'; + +describe('lambda', () => { + test('minimal setup', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'my-api'); + const handler = new lambda.Function(stack, 'Handler', { + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'boom', + code: lambda.Code.fromInline('foo'), + }); + + // WHEN + const integ = new apigateway.LambdaIntegration(handler); + api.root.addMethod('GET', integ); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + Integration: { + IntegrationHttpMethod: 'POST', + Type: 'AWS_PROXY', + Uri: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':apigateway:', + { + Ref: 'AWS::Region', + }, + ':lambda:path/2015-03-31/functions/', + { + 'Fn::GetAtt': [ + 'Handler886CB40B', + 'Arn', + ], + }, + '/invocations', + ], + ], + }, + }, + }); + }); + + test('"allowTestInvoke" can be used to disallow calling the API from the test UI', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Handler', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + }); + + const api = new apigateway.RestApi(stack, 'api'); + + // WHEN + const integ = new apigateway.LambdaIntegration(fn, { allowTestInvoke: false }); + api.root.addMethod('GET', integ); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + SourceArn: { + 'Fn::Join': [ + '', + [ + 'arn:', { Ref: 'AWS::Partition' }, ':execute-api:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':', + { Ref: 'apiC8550315' }, '/', { Ref: 'apiDeploymentStageprod896C8101' }, '/GET/', + ], + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', Match.not({ + SourceArn: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':execute-api:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'apiC8550315' }, + '/test-invoke-stage/GET/', + ], + ], + }, + })); + }); + + test('"allowTestInvoke" set to true allows calling the API from the test UI', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Handler', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + }); + + const api = new apigateway.RestApi(stack, 'api'); + + // WHEN + const integ = new apigateway.LambdaIntegration(fn, { allowTestInvoke: true }); + api.root.addMethod('GET', integ); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + SourceArn: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':execute-api:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'apiC8550315' }, + '/test-invoke-stage/GET/', + ], + ], + }, + }); + }); + + test('"proxy" can be used to disable proxy mode', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Handler', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + handler: 'index.handler', + }); + + const api = new apigateway.RestApi(stack, 'api'); + + // WHEN + const integ = new apigateway.LambdaIntegration(fn, { proxy: false }); + api.root.addMethod('GET', integ); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + Integration: { + Type: 'AWS', + }, + }); + }); + + test('when "ANY" is used, lambda permission will include "*" for method', () => { + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api'); + + const handler = new lambda.Function(stack, 'MyFunc', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('loo'), + }); + + const target = new apigateway.LambdaIntegration(handler); + + api.root.addMethod('ANY', target); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + SourceArn: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':execute-api:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'testapiD6451F70' }, + '/test-invoke-stage/*/', + ], + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + SourceArn: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':execute-api:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':', + { + Ref: 'testapiD6451F70', + }, + '/', + { Ref: 'testapiDeploymentStageprod5C9E92A4' }, + '/*/', + ], + ], + }, + }); + }); + + test('works for imported RestApi', () => { + const stack = new cdk.Stack(); + const api = apigateway.RestApi.fromRestApiAttributes(stack, 'RestApi', { + restApiId: 'imported-rest-api-id', + rootResourceId: 'imported-root-resource-id', + }); + + const handler = new lambda.Function(stack, 'MyFunc', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('loo'), + }); + + api.root.addMethod('ANY', new apigateway.LambdaIntegration(handler)); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + RestApiId: 'imported-rest-api-id', + ResourceId: 'imported-root-resource-id', + HttpMethod: 'ANY', + }); + }); + + test('fingerprint is computed when functionName is specified', () => { + // GIVEN + const stack = new cdk.Stack(); + const restapi = new apigateway.RestApi(stack, 'RestApi'); + const method = restapi.root.addMethod('ANY'); + const handler = new lambda.Function(stack, 'MyFunc', { + functionName: 'ThisFunction', + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('loo'), + }); + const integration = new apigateway.LambdaIntegration(handler); + + // WHEN + const bindResult = integration.bind(method); + + // THEN + expect(bindResult?.deploymentToken).toBeDefined(); + expect(bindResult!.deploymentToken).toEqual('{"functionName":"ThisFunction"}'); + }); + + test('fingerprint is not computed when functionName is not specified', () => { + // GIVEN + const stack = new cdk.Stack(); + const restapi = new apigateway.RestApi(stack, 'RestApi'); + const method = restapi.root.addMethod('ANY'); + const handler = new lambda.Function(stack, 'MyFunc', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('loo'), + }); + const integration = new apigateway.LambdaIntegration(handler); + + // WHEN + const bindResult = integration.bind(method); + + // THEN + expect(bindResult?.deploymentToken).toBeUndefined(); + }); + + test('bind works for integration with imported functions', () => { + // GIVEN + const stack = new cdk.Stack(); + const restapi = new apigateway.RestApi(stack, 'RestApi'); + const method = restapi.root.addMethod('ANY'); + const handler = lambda.Function.fromFunctionArn(stack, 'MyFunc', 'arn:aws:lambda:region:account:function:myfunc'); + const integration = new apigateway.LambdaIntegration(handler); + + // WHEN + const bindResult = integration.bind(method); + + // the deployment token should be defined since the function name + // should be a literal string. + expect(bindResult?.deploymentToken).toEqual(JSON.stringify({ functionName: 'myfunc' })); + }); +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/test/integrations/stepfunctions.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index 01c5320cae179..607298294d9cd 100644 --- a/packages/@aws-cdk/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { StateMachine, StateMachineType } from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import { StateMachine, StateMachineType } from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as apigw from '../../lib'; describe('StepFunctionsIntegration', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda-api.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/lambda-api.test.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/test/lambda-api.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/lambda-api.test.ts index 23c5140c75137..334c601e40bbe 100644 --- a/packages/@aws-cdk/aws-apigateway/test/lambda-api.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/lambda-api.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; import * as apigw from '../lib'; describe('lambda api', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/lambda/index.ts b/packages/aws-cdk-lib/aws-apigateway/test/lambda/index.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/lambda/index.ts rename to packages/aws-cdk-lib/aws-apigateway/test/lambda/index.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/method.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/method.test.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/test/method.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/method.test.ts index a84f0e023b12c..21ad5b91d6581 100644 --- a/packages/@aws-cdk/aws-apigateway/test/method.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/method.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as apigw from '../lib'; const DUMMY_AUTHORIZER: apigw.IAuthorizer = { diff --git a/packages/@aws-cdk/aws-apigateway/test/model.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/model.test.ts similarity index 95% rename from packages/@aws-cdk/aws-apigateway/test/model.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/model.test.ts index 4318f3c5b0093..952df3b89d9c7 100644 --- a/packages/@aws-cdk/aws-apigateway/test/model.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/model.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as apigw from '../lib'; describe('model', () => { diff --git a/packages/@aws-cdk/aws-apigateway/test/requestvalidator.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/requestvalidator.test.ts similarity index 95% rename from packages/@aws-cdk/aws-apigateway/test/requestvalidator.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/requestvalidator.test.ts index 061c7853d3392..f78fed436517e 100644 --- a/packages/@aws-cdk/aws-apigateway/test/requestvalidator.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/requestvalidator.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as apigateway from '../lib'; describe('request validator', () => { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/resource.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/resource.test.ts new file mode 100644 index 0000000000000..b5e58b7d78d8c --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/resource.test.ts @@ -0,0 +1,427 @@ +import { Match, Template } from '../../assertions'; +import { Stack } from '../../core'; +import * as apigw from '../lib'; + +/* eslint-disable quote-props */ + +describe('resource', () => { + test('ProxyResource defines a "{proxy+}" resource with ANY method', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + + // WHEN + new apigw.ProxyResource(stack, 'proxy', { + parent: api.root, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Resource', { + 'ParentId': { + 'Fn::GetAtt': [ + 'apiC8550315', + 'RootResourceId', + ], + }, + 'PathPart': '{proxy+}', + 'RestApiId': { + 'Ref': 'apiC8550315', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + 'HttpMethod': 'ANY', + 'ResourceId': { + 'Ref': 'proxy3A1DA9C7', + }, + 'RestApiId': { + 'Ref': 'apiC8550315', + }, + 'AuthorizationType': 'NONE', + 'Integration': { + 'Type': 'MOCK', + }, + }); + + + }); + + test('if "anyMethod" is false, then an ANY method will not be defined', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + + // WHEN + const proxy = new apigw.ProxyResource(stack, 'proxy', { + parent: api.root, + anyMethod: false, + }); + + proxy.addMethod('GET'); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Resource', 1); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { 'HttpMethod': 'GET' }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', Match.not({ 'HttpMethod': 'ANY' })); + + + }); + + test('addProxy can be used on any resource to attach a proxy from that route', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api', { + deploy: false, + cloudWatchRole: false, + }); + + const v2 = api.root.addResource('v2'); + v2.addProxy(); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'apiC8550315': { + 'Type': 'AWS::ApiGateway::RestApi', + 'Properties': { + 'Name': 'api', + }, + }, + 'apiv25206B108': { + 'Type': 'AWS::ApiGateway::Resource', + 'Properties': { + 'ParentId': { + 'Fn::GetAtt': [ + 'apiC8550315', + 'RootResourceId', + ], + }, + 'PathPart': 'v2', + 'RestApiId': { + 'Ref': 'apiC8550315', + }, + }, + }, + 'apiv2proxyAEA4DAC8': { + 'Type': 'AWS::ApiGateway::Resource', + 'Properties': { + 'ParentId': { + 'Ref': 'apiv25206B108', + }, + 'PathPart': '{proxy+}', + 'RestApiId': { + 'Ref': 'apiC8550315', + }, + }, + }, + 'apiv2proxyANY889F4CE1': { + 'Type': 'AWS::ApiGateway::Method', + 'Properties': { + 'HttpMethod': 'ANY', + 'ResourceId': { + 'Ref': 'apiv2proxyAEA4DAC8', + }, + 'RestApiId': { + 'Ref': 'apiC8550315', + }, + 'AuthorizationType': 'NONE', + 'Integration': { + 'Type': 'MOCK', + }, + }, + }, + }, + }); + + + }); + + test('if proxy is added to root, proxy methods are automatically duplicated (with integration and options)', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + const proxy = api.root.addProxy({ + anyMethod: false, + }); + const deleteInteg = new apigw.MockIntegration({ + requestParameters: { + foo: 'bar', + }, + }); + + // WHEN + proxy.addMethod('DELETE', deleteInteg, { + operationName: 'DeleteMe', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'DELETE', + ResourceId: { Ref: 'apiproxy4EA44110' }, + Integration: { + RequestParameters: { foo: 'bar' }, + Type: 'MOCK', + }, + OperationName: 'DeleteMe', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'DELETE', + ResourceId: { 'Fn::GetAtt': ['apiC8550315', 'RootResourceId'] }, + Integration: { + RequestParameters: { foo: 'bar' }, + Type: 'MOCK', + }, + OperationName: 'DeleteMe', + }); + + + }); + + test('if proxy is added to root, proxy methods are only added if they are not defined already on the root resource', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('POST'); + const proxy = api.root.addProxy({ anyMethod: false }); + + // WHEN + proxy.addMethod('POST'); + + // THEN + + }); + + test('url for a resource', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + + // WHEN + const aResource = api.root.addResource('a'); + const cResource = aResource.addResource('b').addResource('c'); + const colonResource = cResource.addResource('d:e'); + + // THEN + expect(stack.resolve(api.urlForPath(aResource.path))).toEqual({ + 'Fn::Join': [ + '', + [ + 'https://', + { Ref: 'apiC8550315' }, + '.execute-api.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + '/', + { Ref: 'apiDeploymentStageprod896C8101' }, + '/a', + ], + ], + }); + expect(stack.resolve(api.urlForPath(cResource.path))).toEqual({ + 'Fn::Join': [ + '', + [ + 'https://', + { Ref: 'apiC8550315' }, + '.execute-api.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + '/', + { Ref: 'apiDeploymentStageprod896C8101' }, + '/a/b/c', + ], + ], + }); + expect(stack.resolve(api.urlForPath(colonResource.path))).toEqual({ + 'Fn::Join': [ + '', + [ + 'https://', + { Ref: 'apiC8550315' }, + '.execute-api.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + '/', + { Ref: 'apiDeploymentStageprod896C8101' }, + '/a/b/c/d:e', + ], + ], + }); + + }); + + test('fromResourceAttributes()', () => { + // GIVEN + const stack = new Stack(); + const resourceId = 'resource-id'; + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // WHEN + const imported = apigw.Resource.fromResourceAttributes(stack, 'imported-resource', { + resourceId, + restApi: api, + path: 'some-path', + }); + imported.addMethod('GET'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'GET', + ResourceId: resourceId, + }); + }); + + describe('getResource', () => { + + describe('root resource', () => { + test('returns undefined if not found', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // THEN + expect(api.root.getResource('boom')).toBeUndefined(); + + }); + + test('returns the resource if found', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // WHEN + const r1 = api.root.addResource('hello'); + const r2 = api.root.addResource('world'); + + // THEN + expect(api.root.getResource('hello')).toEqual(r1); + expect(api.root.getResource('world')).toEqual(r2); + + }); + + test('returns the resource even if it was created using "new"', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // WHEN + const r1 = new apigw.Resource(stack, 'child', { + parent: api.root, + pathPart: 'yello', + }); + + // THEN + expect(api.root.getResource('yello')).toEqual(r1); + + }); + + }); + + describe('non-root', () => { + + test('returns undefined if not found', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + const res = api.root.addResource('boom'); + + // THEN + expect(res.getResource('child-of-boom')).toBeUndefined(); + + }); + + test('returns the resource if found', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + const child = api.root.addResource('boom'); + + // WHEN + const r1 = child.addResource('hello'); + const r2 = child.addResource('world'); + + // THEN + expect(child.getResource('hello')).toEqual(r1); + expect(child.getResource('world')).toEqual(r2); + + }); + + test('returns the resource even if created with "new"', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + const child = api.root.addResource('boom'); + + // WHEN + const r1 = child.addResource('hello'); + + const r2 = new apigw.Resource(stack, 'world', { + parent: child, + pathPart: 'outside-world', + }); + + // THEN + expect(child.getResource('hello')).toEqual(r1); + expect(child.getResource('outside-world')).toEqual(r2); + + + }); + }); + + describe('resourceForPath', () => { + + test('empty path or "/" (on root) returns this', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // THEN + expect(api.root.resourceForPath('')).toEqual(api.root); + expect(api.root.resourceForPath('/')).toEqual(api.root); + expect(api.root.resourceForPath('///')).toEqual(api.root); + + }); + + test('returns a resource for that path', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // WHEN + const resource = api.root.resourceForPath('/boom/trach'); + + // THEN + expect(resource.path).toEqual('/boom/trach'); + + }); + + test('resources not created if not needed', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'MyRestApi'); + + // WHEN + const trach = api.root.resourceForPath('/boom/trach'); + const bam1 = api.root.resourceForPath('/boom/bam'); + + // THEN + const parent = api.root.getResource('boom'); + expect(parent).toBeDefined(); + expect(parent!.path).toEqual('/boom'); + + expect(trach.parentResource).toBe(parent); + expect(trach.parentResource!.path).toEqual('/boom'); + + const bam2 = api.root.resourceForPath('/boom/bam'); + expect(bam1).toBe(bam2); + expect(bam1.parentResource!.path).toEqual('/boom'); + + }); + + }); + }); + +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/restapi.test.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/test/restapi.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/restapi.test.ts index 205686f7a0c5b..51b1b5b85c537 100644 --- a/packages/@aws-cdk/aws-apigateway/test/restapi.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/restapi.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { GatewayVpcEndpoint } from '@aws-cdk/aws-ec2'; +import { Template } from '../../assertions'; +import { GatewayVpcEndpoint } from '../../aws-ec2'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, CfnElement, CfnResource, Lazy, Size, Stack } from '@aws-cdk/core'; +import { App, CfnElement, CfnResource, Lazy, Size, Stack } from '../../core'; import * as apigw from '../lib'; describe('restapi', () => { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/sample-definition.yaml b/packages/aws-cdk-lib/aws-apigateway/test/sample-definition.yaml new file mode 100644 index 0000000000000..a0dd197f67c37 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/sample-definition.yaml @@ -0,0 +1,30 @@ +openapi: "3.0.2" +info: + version: 1.0.0 + title: Test API for CDK +paths: + /pets: + get: + summary: Test Method + operationId: testMethod + responses: + "200": + description: A paged array of pets + content: + application/json: + schema: + $ref: "#/components/schemas/Empty" + x-amazon-apigateway-integration: + responses: + default: + statusCode: "200" + requestTemplates: + application/json: "{\"statusCode\": 200}" + passthroughBehavior: when_no_match + type: mock + +components: + schemas: + Empty: + title: Empty Schema + type: object \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigateway/test/stage.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/stage.test.ts new file mode 100644 index 0000000000000..95034a37deb24 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigateway/test/stage.test.ts @@ -0,0 +1,715 @@ +import { Template } from '../../assertions'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; +import * as apigateway from '../lib'; +import { ApiDefinition } from '../lib'; + +describe('stage', () => { + test('minimal setup', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { deployment }); + + // THEN + Template.fromStack(stack).templateMatches({ + Resources: { + testapiD6451F70: { + Type: 'AWS::ApiGateway::RestApi', + Properties: { + Name: 'test-api', + }, + }, + testapiGETD8DE4ED1: { + Type: 'AWS::ApiGateway::Method', + Properties: { + HttpMethod: 'GET', + ResourceId: { + 'Fn::GetAtt': [ + 'testapiD6451F70', + 'RootResourceId', + ], + }, + RestApiId: { + Ref: 'testapiD6451F70', + }, + AuthorizationType: 'NONE', + Integration: { + Type: 'MOCK', + }, + }, + }, + mydeployment71ED3B4B5ce82e617e0729f75657ddcca51e3b91: { + Type: 'AWS::ApiGateway::Deployment', + Properties: { + RestApiId: { + Ref: 'testapiD6451F70', + }, + }, + DependsOn: [ + 'testapiGETD8DE4ED1', + ], + }, + mystage7483BE9A: { + Type: 'AWS::ApiGateway::Stage', + Properties: { + RestApiId: { + Ref: 'testapiD6451F70', + }, + DeploymentId: { + Ref: 'mydeployment71ED3B4B5ce82e617e0729f75657ddcca51e3b91', + }, + StageName: 'prod', + }, + }, + }, + }); + }); + + test('RestApi - stage depends on the CloudWatch role when it exists', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: true, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { deployment }); + + // THEN + Template.fromStack(stack).hasResource('AWS::ApiGateway::Stage', { + DependsOn: ['testapiAccount9B907665'], + }); + }); + + test('SpecRestApi - stage depends on the CloudWatch role when it exists', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.SpecRestApi(stack, 'test-api', { apiDefinition: apigateway.ApiDefinition.fromInline( { foo: 'bar' }) }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { deployment }); + + // THEN + Template.fromStack(stack).hasResource('AWS::ApiGateway::Stage', { + DependsOn: ['testapiAccount9B907665'], + }); + }); + + test('common method settings can be set at the stage level', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { + deployment, + loggingLevel: apigateway.MethodLoggingLevel.INFO, + throttlingRateLimit: 12, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + MethodSettings: [ + { + DataTraceEnabled: false, + HttpMethod: '*', + LoggingLevel: 'INFO', + ResourcePath: '/*', + ThrottlingRateLimit: 12, + }, + ], + }); + }); + + test('"stageResourceArn" returns the ARN for the stage', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api'); + const deployment = new apigateway.Deployment(stack, 'test-deploymnet', { + api, + }); + api.root.addMethod('GET'); + + // WHEN + const stage = new apigateway.Stage(stack, 'test-stage', { + deployment, + }); + + // THEN + expect(stack.resolve(stage.stageArn)).toEqual({ + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':apigateway:', + { Ref: 'AWS::Region' }, + '::/restapis/', + { Ref: 'testapiD6451F70' }, + '/stages/', + { Ref: 'teststage8788861E' }, + ], + ], + }); + }); + + test('custom method settings can be set by their path', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { + deployment, + loggingLevel: apigateway.MethodLoggingLevel.INFO, + throttlingRateLimit: 12, + methodOptions: { + '/goo/bar/GET': { + loggingLevel: apigateway.MethodLoggingLevel.ERROR, + }, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + MethodSettings: [ + { + DataTraceEnabled: false, + HttpMethod: '*', + LoggingLevel: 'INFO', + ResourcePath: '/*', + ThrottlingRateLimit: 12, + }, + { + DataTraceEnabled: false, + HttpMethod: 'GET', + LoggingLevel: 'ERROR', + ResourcePath: '/~1goo~1bar', + }, + ], + }); + }); + + test('default "cacheClusterSize" is 0.5 (if cache cluster is enabled)', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { + deployment, + cacheClusterEnabled: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + CacheClusterEnabled: true, + CacheClusterSize: '0.5', + }); + }); + + test('setting "cacheClusterSize" implies "cacheClusterEnabled"', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { + deployment, + cacheClusterSize: '0.5', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + CacheClusterEnabled: true, + CacheClusterSize: '0.5', + }); + }); + + test('fails when "cacheClusterEnabled" is "false" and "cacheClusterSize" is set', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + cacheClusterSize: '0.5', + cacheClusterEnabled: false, + })).toThrow(/Cannot set "cacheClusterSize" to 0.5 and "cacheClusterEnabled" to "false"/); + }); + + test('if "cachingEnabled" in method settings, implicitly enable cache cluster', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + new apigateway.Stage(stack, 'my-stage', { + deployment, + cachingEnabled: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + CacheClusterEnabled: true, + CacheClusterSize: '0.5', + MethodSettings: [ + { + DataTraceEnabled: false, + CachingEnabled: true, + HttpMethod: '*', + ResourcePath: '/*', + }, + ], + StageName: 'prod', + }); + }); + + test('if caching cluster is explicitly disabled, do not auto-enable cache cluster when "cachingEnabled" is set in method options', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + cacheClusterEnabled: false, + deployment, + cachingEnabled: true, + })).toThrow(/Cannot enable caching for method \/\*\/\* since cache cluster is disabled on stage/); + }); + + test('if only the custom log destination log group is set', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + AccessLogSetting: { + DestinationArn: { + 'Fn::GetAtt': [ + 'LogGroupF5B46931', + 'Arn', + ], + }, + Format: '$context.identity.sourceIp $context.identity.caller $context.identity.user [$context.requestTime] "$context.httpMethod $context.resourcePath $context.protocol" $context.status $context.responseLength $context.requestId', + }, + StageName: 'prod', + }); + }); + + test('if the custom log destination log group and format is set', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.jsonWithStandardFields(); + new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + AccessLogSetting: { + DestinationArn: { + 'Fn::GetAtt': [ + 'LogGroupF5B46931', + 'Arn', + ], + }, + Format: '{"requestId":"$context.requestId","ip":"$context.identity.sourceIp","user":"$context.identity.user","caller":"$context.identity.caller","requestTime":"$context.requestTime","httpMethod":"$context.httpMethod","resourcePath":"$context.resourcePath","status":"$context.status","protocol":"$context.protocol","responseLength":"$context.responseLength"}', + }, + StageName: 'prod', + }); + }); + + describe('access log check', () => { + test('fails when access log format does not contain `contextRequestId()` or `contextExtendedRequestId()', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.custom(''); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + })).toThrow('Access log must include either `AccessLogFormat.contextRequestId()` or `AccessLogFormat.contextExtendedRequestId()`'); + }); + + test('succeeds when access log format contains `contextRequestId()`', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ + requestId: apigateway.AccessLogField.contextRequestId(), + })); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + })).not.toThrow(); + }); + + test('succeeds when access log format contains `contextExtendedRequestId()`', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ + extendedRequestId: apigateway.AccessLogField.contextExtendedRequestId(), + })); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + })).not.toThrow(); + }); + + test('succeeds when access log format contains both `contextRequestId()` and `contextExtendedRequestId`', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ + requestId: apigateway.AccessLogField.contextRequestId(), + extendedRequestId: apigateway.AccessLogField.contextExtendedRequestId(), + })); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + })).not.toThrow(); + }); + + test('fails when access log format contains `contextRequestIdXxx`', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.custom(JSON.stringify({ + requestIdXxx: '$context.requestIdXxx', + })); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + })).toThrow('Access log must include either `AccessLogFormat.contextRequestId()` or `AccessLogFormat.contextExtendedRequestId()`'); + }); + + test('does not fail when access log format is a token', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testLogGroup = new logs.LogGroup(stack, 'LogGroup'); + const testFormat = apigateway.AccessLogFormat.custom(cdk.Lazy.string({ produce: () => 'test' })); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogDestination: new apigateway.LogGroupLogDestination(testLogGroup), + accessLogFormat: testFormat, + })).not.toThrow(); + }); + + test('fails when access log destination is empty', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false, deploy: false }); + const deployment = new apigateway.Deployment(stack, 'my-deployment', { api }); + api.root.addMethod('GET'); + + // WHEN + const testFormat = apigateway.AccessLogFormat.jsonWithStandardFields(); + + // THEN + expect(() => new apigateway.Stage(stack, 'my-stage', { + deployment, + accessLogFormat: testFormat, + })).toThrow(/Access log format is specified without a destination/); + }); + }); + + test('default throttling settings', () => { + // GIVEN + const stack = new cdk.Stack(); + new apigateway.SpecRestApi(stack, 'testapi', { + apiDefinition: ApiDefinition.fromInline({ + openapi: '3.0.2', + }), + deployOptions: { + throttlingBurstLimit: 0, + throttlingRateLimit: 0, + metricsEnabled: false, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Stage', { + MethodSettings: [{ + DataTraceEnabled: false, + HttpMethod: '*', + ResourcePath: '/*', + ThrottlingBurstLimit: 0, + ThrottlingRateLimit: 0, + }], + }); + }); + + test('addApiKey is supported', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false }); + api.root.addMethod('GET'); + const stage = new apigateway.Stage(stack, 'Stage', { + deployment: api.latestDeployment!, + }); + + // WHEN + stage.addApiKey('MyKey'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::ApiKey', { + StageKeys: [ + { + RestApiId: { + Ref: 'testapiD6451F70', + }, + StageName: { + Ref: 'Stage0E8C2AF5', + }, + }, + ], + }); + }); + + test('addApiKey is supported on an imported stage', () => { + // GIVEN + const stack = new cdk.Stack(); + const api = new apigateway.RestApi(stack, 'test-api', { cloudWatchRole: false }); + api.root.addMethod('GET'); + const stage = apigateway.Stage.fromStageAttributes(stack, 'Stage', { + restApi: api, + stageName: 'MyStage', + }); + + // WHEN + stage.addApiKey('MyKey'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::ApiKey', { + StageKeys: [ + { + RestApiId: { + Ref: 'testapiD6451F70', + }, + StageName: 'MyStage', + }, + ], + }); + + }); + + describe('Metrics', () => { + test('metric', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const metricName = '4XXError'; + const statistic = 'Sum'; + const metric = api.deploymentStage.metric(metricName, { statistic }); + + // THEN + expect(metric.namespace).toEqual('AWS/ApiGateway'); + expect(metric.metricName).toEqual(metricName); + expect(metric.statistic).toEqual(statistic); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricClientError', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricClientError({ color }); + + // THEN + expect(metric.metricName).toEqual('4XXError'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricServerError', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricServerError({ color }); + + // THEN + expect(metric.metricName).toEqual('5XXError'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricCacheHitCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricCacheHitCount({ color }); + + // THEN + expect(metric.metricName).toEqual('CacheHitCount'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricCacheMissCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricCacheMissCount({ color }); + + // THEN + expect(metric.metricName).toEqual('CacheMissCount'); + expect(metric.statistic).toEqual('Sum'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricCount', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricCount({ color }); + + // THEN + expect(metric.metricName).toEqual('Count'); + expect(metric.statistic).toEqual('SampleCount'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricIntegrationLatency', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricIntegrationLatency({ color }); + + // THEN + expect(metric.metricName).toEqual('IntegrationLatency'); + expect(metric.statistic).toEqual('Average'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + + test('metricLatency', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const api = new apigateway.RestApi(stack, 'test-api'); + const color = '#00ff00'; + const metric = api.deploymentStage.metricLatency({ color }); + + // THEN + expect(metric.metricName).toEqual('Latency'); + expect(metric.statistic).toEqual('Average'); + expect(metric.color).toEqual(color); + expect(metric.dimensions).toEqual({ ApiName: 'test-api', Stage: api.deploymentStage.stageName }); + }); + }); +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/stepfunctions-api.test.ts similarity index 98% rename from packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/stepfunctions-api.test.ts index c4c826b13d1bd..4bdacef692ad8 100644 --- a/packages/@aws-cdk/aws-apigateway/test/stepfunctions-api.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/stepfunctions-api.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { StateMachine } from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as sfn from '../../aws-stepfunctions'; +import { StateMachine } from '../../aws-stepfunctions'; +import * as cdk from '../../core'; import * as apigw from '../lib'; import { StepFunctionsIntegration } from '../lib'; diff --git a/packages/@aws-cdk/aws-apigateway/test/usage-plan.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/usage-plan.test.ts similarity index 99% rename from packages/@aws-cdk/aws-apigateway/test/usage-plan.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/usage-plan.test.ts index aa56d019ffab2..a24521ee0a8a4 100644 --- a/packages/@aws-cdk/aws-apigateway/test/usage-plan.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/usage-plan.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as apigateway from '../lib'; const RESOURCE_TYPE = 'AWS::ApiGateway::UsagePlan'; diff --git a/packages/@aws-cdk/aws-apigateway/test/util.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/util.test.ts similarity index 100% rename from packages/@aws-cdk/aws-apigateway/test/util.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/util.test.ts diff --git a/packages/@aws-cdk/aws-apigateway/test/vpc-link.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/vpc-link.test.ts similarity index 91% rename from packages/@aws-cdk/aws-apigateway/test/vpc-link.test.ts rename to packages/aws-cdk-lib/aws-apigateway/test/vpc-link.test.ts index b41e1a4d19471..08a996dc12a21 100644 --- a/packages/@aws-cdk/aws-apigateway/test/vpc-link.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/vpc-link.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as cdk from '../../core'; import * as apigateway from '../lib'; describe('vpc link', () => { diff --git a/packages/aws-cdk-lib/aws-apigatewayv2/.jsiirc.json b/packages/aws-cdk-lib/aws-apigatewayv2/.jsiirc.json new file mode 100644 index 0000000000000..86189bb44796e --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigatewayv2/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Apigatewayv2" + }, + "java": { + "package": "software.amazon.awscdk.services.apigatewayv2" + }, + "python": { + "module": "aws_cdk.aws_apigatewayv2" + } + } +} diff --git a/packages/aws-cdk-lib/aws-apigatewayv2/README.md b/packages/aws-cdk-lib/aws-apigatewayv2/README.md new file mode 100644 index 0000000000000..a639c8b04bf09 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigatewayv2/README.md @@ -0,0 +1,32 @@ +# AWS::ApiGatewayV2 Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as apigateway from 'aws-cdk-lib/aws-apigatewayv2'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ApiGatewayV2 construct libraries](https://constructs.dev/search?q=apigatewayv2) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ApiGatewayV2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApiGatewayV2.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-apigatewayv2-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ApiGatewayV2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApiGatewayV2.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-apigatewayv2/index.ts b/packages/aws-cdk-lib/aws-apigatewayv2/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigatewayv2/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-apigatewayv2/lib/index.ts b/packages/aws-cdk-lib/aws-apigatewayv2/lib/index.ts new file mode 100644 index 0000000000000..e49ed1d6b78b0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigatewayv2/lib/index.ts @@ -0,0 +1 @@ +export * from './apigatewayv2.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appconfig/.jsiirc.json b/packages/aws-cdk-lib/aws-appconfig/.jsiirc.json new file mode 100644 index 0000000000000..bb42d98b824c0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appconfig/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppConfig" + }, + "java": { + "package": "software.amazon.awscdk.services.appconfig" + }, + "python": { + "module": "aws_cdk.aws_appconfig" + } + } +} diff --git a/packages/aws-cdk-lib/aws-appconfig/README.md b/packages/aws-cdk-lib/aws-appconfig/README.md new file mode 100644 index 0000000000000..f682ece88395d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appconfig/README.md @@ -0,0 +1,27 @@ +# AWS::AppConfig Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as appconfig from 'aws-cdk-lib/aws-appconfig'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AppConfig construct libraries](https://constructs.dev/search?q=appconfig) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppConfig resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppConfig.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppConfig](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppConfig.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-appconfig/index.ts b/packages/aws-cdk-lib/aws-appconfig/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appconfig/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-appconfig/lib/index.ts b/packages/aws-cdk-lib/aws-appconfig/lib/index.ts new file mode 100644 index 0000000000000..7708199fed61b --- /dev/null +++ b/packages/aws-cdk-lib/aws-appconfig/lib/index.ts @@ -0,0 +1 @@ +export * from './appconfig.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appflow/.jsiirc.json b/packages/aws-cdk-lib/aws-appflow/.jsiirc.json new file mode 100644 index 0000000000000..c29970a89bcb7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appflow/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppFlow" + }, + "java": { + "package": "software.amazon.awscdk.services.appflow" + }, + "python": { + "module": "aws_cdk.aws_appflow" + } + } +} diff --git a/packages/aws-cdk-lib/aws-appflow/README.md b/packages/aws-cdk-lib/aws-appflow/README.md new file mode 100644 index 0000000000000..697b58a9bc246 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appflow/README.md @@ -0,0 +1,27 @@ +# AWS::AppFlow Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as appflow from 'aws-cdk-lib/aws-appflow'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AppFlow construct libraries](https://constructs.dev/search?q=appflow) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppFlow resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppFlow.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppFlow](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppFlow.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-appflow/index.ts b/packages/aws-cdk-lib/aws-appflow/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appflow/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-appflow/lib/index.ts b/packages/aws-cdk-lib/aws-appflow/lib/index.ts new file mode 100644 index 0000000000000..e40e995c69706 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appflow/lib/index.ts @@ -0,0 +1 @@ +export * from './appflow.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appintegrations/.jsiirc.json b/packages/aws-cdk-lib/aws-appintegrations/.jsiirc.json new file mode 100644 index 0000000000000..14e009556b75a --- /dev/null +++ b/packages/aws-cdk-lib/aws-appintegrations/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppIntegrations" + }, + "java": { + "package": "software.amazon.awscdk.services.appintegrations" + }, + "python": { + "module": "aws_cdk.aws_appintegrations" + } + } +} diff --git a/packages/aws-cdk-lib/aws-appintegrations/README.md b/packages/aws-cdk-lib/aws-appintegrations/README.md new file mode 100644 index 0000000000000..f69e1773579b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appintegrations/README.md @@ -0,0 +1,27 @@ +# AWS::AppIntegrations Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as appintegrations from 'aws-cdk-lib/aws-appintegrations'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AppIntegrations construct libraries](https://constructs.dev/search?q=appintegrations) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppIntegrations resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppIntegrations.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppIntegrations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppIntegrations.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-appintegrations/index.ts b/packages/aws-cdk-lib/aws-appintegrations/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appintegrations/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-appintegrations/lib/index.ts b/packages/aws-cdk-lib/aws-appintegrations/lib/index.ts new file mode 100644 index 0000000000000..252fba57d295c --- /dev/null +++ b/packages/aws-cdk-lib/aws-appintegrations/lib/index.ts @@ -0,0 +1 @@ +export * from './appintegrations.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/.jsiirc.json b/packages/aws-cdk-lib/aws-applicationautoscaling/.jsiirc.json new file mode 100644 index 0000000000000..b122a7ed8c386 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.applicationautoscaling" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ApplicationAutoScaling" + }, + "python": { + "module": "aws_cdk.aws_applicationautoscaling" + } + } +} diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/README.md b/packages/aws-cdk-lib/aws-applicationautoscaling/README.md new file mode 100644 index 0000000000000..6bc05ee9882f2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/README.md @@ -0,0 +1,246 @@ +# AWS Auto Scaling Construct Library + + +**Application AutoScaling** is used to configure autoscaling for all +services other than scaling EC2 instances. For example, you will use this to +scale ECS tasks, DynamoDB capacity, Spot Fleet sizes, Comprehend document classification endpoints, Lambda function provisioned concurrency and more. + +As a CDK user, you will probably not have to interact with this library +directly; instead, it will be used by other construct libraries to +offer AutoScaling features for their own constructs. + +This document will describe the general autoscaling features and concepts; +your particular service may offer only a subset of these. + +## AutoScaling basics + +Resources can offer one or more **attributes** to autoscale, typically +representing some capacity dimension of the underlying service. For example, +a DynamoDB Table offers autoscaling of the read and write capacity of the +table proper and its Global Secondary Indexes, an ECS Service offers +autoscaling of its task count, an RDS Aurora cluster offers scaling of its +replica count, and so on. + +When you enable autoscaling for an attribute, you specify a minimum and a +maximum value for the capacity. AutoScaling policies that respond to metrics +will never go higher or lower than the indicated capacity (but scheduled +scaling actions might, see below). + +There are three ways to scale your capacity: + +* **In response to a metric** (also known as step scaling); for example, you + might want to scale out if the CPU usage across your cluster starts to rise, + and scale in when it drops again. +* **By trying to keep a certain metric around a given value** (also known as + target tracking scaling); you might want to automatically scale out an in to + keep your CPU usage around 50%. +* **On a schedule**; you might want to organize your scaling around traffic + flows you expect, by scaling out in the morning and scaling in in the + evening. + +The general pattern of autoscaling will look like this: + +```ts +declare const resource: SomeScalableResource; + +const capacity = resource.autoScaleCapacity({ + minCapacity: 5, + maxCapacity: 100 +}); + +// Then call a method to enable metric scaling and/or schedule scaling +// (explained below): +// +// capacity.scaleOnMetric(...); +// capacity.scaleToTrackMetric(...); +// capacity.scaleOnSchedule(...); +``` + +## Step Scaling + +This type of scaling scales in and out in deterministic steps that you +configure, in response to metric values. For example, your scaling strategy +to scale in response to CPU usage might look like this: + +```plaintext + Scaling -1 (no change) +1 +3 + │ │ │ │ │ + ├────────┼───────────────────────┼────────┼────────┤ + │ │ │ │ │ +CPU usage 0% 10% 50% 70% 100% +``` + +(Note that this is not necessarily a recommended scaling strategy, but it's +a possible one. You will have to determine what thresholds are right for you). + +You would configure it like this: + +```ts +declare const capacity: ScalableAttribute; +declare const cpuUtilization: cloudwatch.Metric; + +capacity.scaleOnMetric('ScaleToCPU', { + metric: cpuUtilization, + scalingSteps: [ + { upper: 10, change: -1 }, + { lower: 50, change: +1 }, + { lower: 70, change: +3 }, + ], + + // Change this to AdjustmentType.PercentChangeInCapacity to interpret the + // 'change' numbers before as percentages instead of capacity counts. + adjustmentType: appscaling.AdjustmentType.CHANGE_IN_CAPACITY, +}); +``` + +The AutoScaling construct library will create the required CloudWatch alarms and +AutoScaling policies for you. + +### Scaling based on multiple datapoints + +The Step Scaling configuration above will initiate a scaling event when a single +datapoint of the scaling metric is breaching a scaling step breakpoint. In cases +where you might want to initiate scaling actions on a larger number of datapoints +(ie in order to smooth out randomness in the metric data), you can use the +optional `evaluationPeriods` and `datapointsToAlarm` properties: + +```ts +declare const capacity: ScalableAttribute; +declare const cpuUtilization: cloudwatch.Metric; + +capacity.scaleOnMetric('ScaleToCPUWithMultipleDatapoints', { + metric: cpuUtilization, + scalingSteps: [ + { upper: 10, change: -1 }, + { lower: 50, change: +1 }, + { lower: 70, change: +3 }, + ], + + // if the cpuUtilization metric has a period of 1 minute, then data points + // in the last 10 minutes will be evaluated + evaluationPeriods: 10, + + // Only trigger a scaling action when 6 datapoints out of the last 10 are + // breaching. If this is left unspecified, then ALL datapoints in the + // evaluation period must be breaching to trigger a scaling action + datapointsToAlarm: 6 +}); +``` + +## Target Tracking Scaling + +This type of scaling scales in and out in order to keep a metric (typically +representing utilization) around a value you prefer. This type of scaling is +typically heavily service-dependent in what metric you can use, and so +different services will have different methods here to set up target tracking +scaling. + +The following example configures the read capacity of a DynamoDB table +to be around 60% utilization: + +```ts +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; + +declare const table: dynamodb.Table; + +const readCapacity = table.autoScaleReadCapacity({ + minCapacity: 10, + maxCapacity: 1000 +}); +readCapacity.scaleOnUtilization({ + targetUtilizationPercent: 60 +}); +``` + +## Scheduled Scaling + +This type of scaling is used to change capacities based on time. It works +by changing the `minCapacity` and `maxCapacity` of the attribute, and so +can be used for two purposes: + +* Scale in and out on a schedule by setting the `minCapacity` high or + the `maxCapacity` low. +* Still allow the regular scaling actions to do their job, but restrict + the range they can scale over (by setting both `minCapacity` and + `maxCapacity` but changing their range over time). + +The following schedule expressions can be used: + +* `at(yyyy-mm-ddThh:mm:ss)` -- scale at a particular moment in time +* `rate(value unit)` -- scale every minute/hour/day +* `cron(mm hh dd mm dow)` -- scale on arbitrary schedules + +Of these, the cron expression is the most useful but also the most +complicated. A schedule is expressed as a cron expression. The `Schedule` class has a `cron` method to help build cron expressions. + +The following example scales the fleet out in the morning, and lets natural +scaling take over at night: + +```ts +declare const resource: SomeScalableResource; + +const capacity = resource.autoScaleCapacity({ + minCapacity: 1, + maxCapacity: 50, +}); + +capacity.scaleOnSchedule('PrescaleInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, +}); + +capacity.scaleOnSchedule('AllowDownscalingAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + minCapacity: 1 +}); +``` + +## Examples + +### Lambda Provisioned Concurrency Auto Scaling + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +declare const code: lambda.Code; + +const handler = new lambda.Function(this, 'MyFunction', { + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.handler', + code, + + reservedConcurrentExecutions: 2, +}); + +const fnVer = handler.currentVersion; + +const target = new appscaling.ScalableTarget(this, 'ScalableTarget', { + serviceNamespace: appscaling.ServiceNamespace.LAMBDA, + maxCapacity: 100, + minCapacity: 10, + resourceId: `function:${handler.functionName}:${fnVer.version}`, + scalableDimension: 'lambda:function:ProvisionedConcurrency', +}) + +target.scaleToTrackMetric('PceTracking', { + targetValue: 0.9, + predefinedMetric: appscaling.PredefinedMetric.LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION, +}) +``` + +### ElastiCache Redis shards scaling with target value + +```ts +const shardsScalableTarget = new appscaling.ScalableTarget(this, 'ElastiCacheRedisShardsScalableTarget', { + serviceNamespace: appscaling.ServiceNamespace.ELASTICACHE, + scalableDimension: 'elasticache:replication-group:NodeGroups', + minCapacity: 2, + maxCapacity: 10, + resourceId: 'replication-group/main-cluster', +}); + +shardsScalableTarget.scaleToTrackMetric('ElastiCacheRedisShardsCPUUtilization', { + targetValue: 20, + predefinedMetric: appscaling.PredefinedMetric.ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION, +}); +``` diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/index.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/base-scalable-attribute.ts similarity index 98% rename from packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts rename to packages/aws-cdk-lib/aws-applicationautoscaling/lib/base-scalable-attribute.ts index ec550f3abc468..4202c6b2dd261 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/base-scalable-attribute.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/base-scalable-attribute.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import { Construct } from 'constructs'; import { ScalableTarget, ScalingSchedule, ServiceNamespace } from './scalable-target'; import { BasicStepScalingPolicyProps } from './step-scaling-policy'; diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/index.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-applicationautoscaling/lib/index.ts rename to packages/aws-cdk-lib/aws-applicationautoscaling/lib/index.ts diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/scalable-target.ts similarity index 98% rename from packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts rename to packages/aws-cdk-lib/aws-applicationautoscaling/lib/scalable-target.ts index f5686e8c13170..16bf5209140a6 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/scalable-target.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { IResource, Lazy, Resource, withResolved } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { IResource, Lazy, Resource, withResolved } from '../../core'; import { Construct } from 'constructs'; import { CfnScalableTarget } from './applicationautoscaling.generated'; import { Schedule } from './schedule'; diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/lib/schedule.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/schedule.ts new file mode 100644 index 0000000000000..b40fb52ec02c4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/schedule.ts @@ -0,0 +1,182 @@ +import { Annotations, Duration } from '../../core'; +import { Construct } from 'constructs'; + +/** + * Schedule for scheduled scaling actions + */ +export abstract class Schedule { + /** + * Construct a schedule from a literal schedule expression + * + * @param expression The expression to use. Must be in a format that Application AutoScaling will recognize + */ + public static expression(expression: string): Schedule { + return new LiteralSchedule(expression); + } + + /** + * Construct a schedule from an interval and a time unit + */ + public static rate(duration: Duration): Schedule { + if (duration.isUnresolved()) { + const validDurationUnit = ['minute', 'minutes', 'hour', 'hours', 'day', 'days']; + if (!validDurationUnit.includes(duration.unitLabel())) { + throw new Error("Allowed units for scheduling are: 'minute', 'minutes', 'hour', 'hours', 'day' or 'days'"); + } + return new LiteralSchedule(`rate(${duration.formatTokenToNumber()})`); + } + if (duration.toSeconds() === 0) { + throw new Error('Duration cannot be 0'); + } + + let rate = maybeRate(duration.toDays({ integral: false }), 'day'); + if (rate === undefined) { rate = maybeRate(duration.toHours({ integral: false }), 'hour'); } + if (rate === undefined) { rate = makeRate(duration.toMinutes({ integral: true }), 'minute'); } + return new LiteralSchedule(rate); + } + + /** + * Construct a Schedule from a moment in time + */ + public static at(moment: Date): Schedule { + return new LiteralSchedule(`at(${formatISO(moment)})`); + } + + /** + * Create a schedule from a set of cron fields + */ + public static cron(options: CronOptions): Schedule { + if (options.weekDay !== undefined && options.day !== undefined) { + throw new Error('Cannot supply both \'day\' and \'weekDay\', use at most one'); + } + + const minute = fallback(options.minute, '*'); + const hour = fallback(options.hour, '*'); + const month = fallback(options.month, '*'); + const year = fallback(options.year, '*'); + + // Weekday defaults to '?' if not supplied. If it is supplied, day must become '?' + const day = fallback(options.day, options.weekDay !== undefined ? '?' : '*'); + const weekDay = fallback(options.weekDay, '?'); + + return new class extends Schedule { + public readonly expressionString: string = `cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`; + public _bind(scope: Construct) { + if (!options.minute) { + Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.'); + } + return new LiteralSchedule(this.expressionString); + } + }; + } + + /** + * Retrieve the expression for this schedule + */ + public abstract readonly expressionString: string; + + protected constructor() {} + + /** + * + * @internal + */ + public abstract _bind(scope: Construct): void; +} + +/** + * Options to configure a cron expression + * + * All fields are strings so you can use complex expressions. Absence of + * a field implies '*' or '?', whichever one is appropriate. + * + * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions + */ +export interface CronOptions { + /** + * The minute to run this rule at + * + * @default - Every minute + */ + readonly minute?: string; + + /** + * The hour to run this rule at + * + * @default - Every hour + */ + readonly hour?: string; + + /** + * The day of the month to run this rule at + * + * @default - Every day of the month + */ + readonly day?: string; + + /** + * The month to run this rule at + * + * @default - Every month + */ + readonly month?: string; + + /** + * The year to run this rule at + * + * @default - Every year + */ + readonly year?: string; + + /** + * The day of the week to run this rule at + * + * @default - Any day of the week + */ + readonly weekDay?: string; +} + +class LiteralSchedule extends Schedule { + constructor(public readonly expressionString: string) { + super(); + } + + public _bind() {} +} + +function fallback(x: T | undefined, def: T): T { + return x === undefined ? def : x; +} + +function formatISO(date?: Date) { + if (!date) { return undefined; } + + return date.getUTCFullYear() + + '-' + pad(date.getUTCMonth() + 1) + + '-' + pad(date.getUTCDate()) + + 'T' + pad(date.getUTCHours()) + + ':' + pad(date.getUTCMinutes()) + + ':' + pad(date.getUTCSeconds()); + + function pad(num: number) { + if (num < 10) { + return '0' + num; + } + return num; + } +} + +/** + * Return the rate if the rate is whole number + */ +function maybeRate(interval: number, singular: string) { + if (interval === 0 || !Number.isInteger(interval)) { return undefined; } + return makeRate(interval, singular); +} + +/** + * Return 'rate(${interval} ${singular}(s))` for the interval + */ +function makeRate(interval: number, singular: string) { + return interval === 1 ? `rate(1 ${singular})` : `rate(${interval} ${singular}s)`; +} diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-action.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-action.ts new file mode 100644 index 0000000000000..a5cc8410b265c --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-action.ts @@ -0,0 +1,194 @@ +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import { CfnScalingPolicy } from './applicationautoscaling.generated'; +import { IScalableTarget } from './scalable-target'; + +/** + * Properties for a scaling policy + */ +export interface StepScalingActionProps { + /** + * The scalable target + */ + readonly scalingTarget: IScalableTarget; + + /** + * A name for the scaling policy + * + * @default Automatically generated name + */ + readonly policyName?: string; + + /** + * How the adjustment numbers are interpreted + * + * @default ChangeInCapacity + */ + readonly adjustmentType?: AdjustmentType; + + /** + * Grace period after scaling activity. + * + * For scale out policies, multiple scale outs during the cooldown period are + * squashed so that only the biggest scale out happens. + * + * For scale in policies, subsequent scale ins during the cooldown period are + * ignored. + * + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html + * @default No cooldown period + */ + readonly cooldown?: cdk.Duration; + + /** + * Minimum absolute number to adjust capacity with as result of percentage scaling. + * + * Only when using AdjustmentType = PercentChangeInCapacity, this number controls + * the minimum absolute effect size. + * + * @default No minimum scaling effect + */ + readonly minAdjustmentMagnitude?: number; + + /** + * The aggregation type for the CloudWatch metrics. + * + * @default Average + */ + readonly metricAggregationType?: MetricAggregationType; +} + +/** + * Define a step scaling action + * + * This kind of scaling policy adjusts the target capacity in configurable + * steps. The size of the step is configurable based on the metric's distance + * to its alarm threshold. + * + * This Action must be used as the target of a CloudWatch alarm to take effect. + */ +export class StepScalingAction extends Construct { + /** + * ARN of the scaling policy + */ + public readonly scalingPolicyArn: string; + + private readonly adjustments = new Array(); + + constructor(scope: Construct, id: string, props: StepScalingActionProps) { + super(scope, id); + + // Cloudformation requires either the ResourceId, ScalableDimension, and ServiceNamespace + // properties, or the ScalingTargetId property, but not both. + // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-applicationautoscaling-scalingpolicy.html + const resource = new CfnScalingPolicy(this, 'Resource', { + policyName: props.policyName || cdk.Names.uniqueId(this), + policyType: 'StepScaling', + scalingTargetId: props.scalingTarget.scalableTargetId, + stepScalingPolicyConfiguration: { + adjustmentType: props.adjustmentType, + cooldown: props.cooldown && props.cooldown.toSeconds(), + minAdjustmentMagnitude: props.minAdjustmentMagnitude, + metricAggregationType: props.metricAggregationType, + stepAdjustments: cdk.Lazy.any({ produce: () => this.adjustments }), + } as CfnScalingPolicy.StepScalingPolicyConfigurationProperty, + }); + + this.scalingPolicyArn = resource.ref; + } + + /** + * Add an adjusment interval to the ScalingAction + */ + public addAdjustment(adjustment: AdjustmentTier) { + if (adjustment.lowerBound === undefined && adjustment.upperBound === undefined) { + throw new Error('At least one of lowerBound or upperBound is required'); + } + this.adjustments.push({ + metricIntervalLowerBound: adjustment.lowerBound, + metricIntervalUpperBound: adjustment.upperBound, + scalingAdjustment: adjustment.adjustment, + }); + } +} + +/** + * How adjustment numbers are interpreted + */ +export enum AdjustmentType { + /** + * Add the adjustment number to the current capacity. + * + * A positive number increases capacity, a negative number decreases capacity. + */ + CHANGE_IN_CAPACITY = 'ChangeInCapacity', + + /** + * Add this percentage of the current capacity to itself. + * + * The number must be between -100 and 100; a positive number increases + * capacity and a negative number decreases it. + */ + PERCENT_CHANGE_IN_CAPACITY = 'PercentChangeInCapacity', + + /** + * Make the capacity equal to the exact number given. + */ + EXACT_CAPACITY = 'ExactCapacity', +} + +/** + * How the scaling metric is going to be aggregated + */ +export enum MetricAggregationType { + /** + * Average + */ + AVERAGE = 'Average', + + /** + * Minimum + */ + MINIMUM = 'Minimum', + + /** + * Maximum + */ + MAXIMUM = 'Maximum' +} + +/** + * An adjustment + */ +export interface AdjustmentTier { + /** + * What number to adjust the capacity with + * + * The number is interpeted as an added capacity, a new fixed capacity or an + * added percentage depending on the AdjustmentType value of the + * StepScalingPolicy. + * + * Can be positive or negative. + */ + readonly adjustment: number; + + /** + * Lower bound where this scaling tier applies. + * + * The scaling tier applies if the difference between the metric + * value and its alarm threshold is higher than this value. + * + * @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier + */ + readonly lowerBound?: number; + + /** + * Upper bound where this scaling tier applies + * + * The scaling tier applies if the difference between the metric + * value and its alarm threshold is lower than this value. + * + * @default +Infinity + */ + readonly upperBound?: number; +} diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-policy.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-policy.ts new file mode 100644 index 0000000000000..fb9073217541d --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/step-scaling-policy.ts @@ -0,0 +1,257 @@ +import { findAlarmThresholds, normalizeIntervals } from '../../aws-autoscaling-common'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import { IScalableTarget } from './scalable-target'; +import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action'; + +export interface BasicStepScalingPolicyProps { + /** + * Metric to scale on. + */ + readonly metric: cloudwatch.IMetric; + + /** + * The intervals for scaling. + * + * Maps a range of metric values to a particular scaling behavior. + */ + readonly scalingSteps: ScalingInterval[]; + + /** + * How the adjustment numbers inside 'intervals' are interpreted. + * + * @default ChangeInCapacity + */ + readonly adjustmentType?: AdjustmentType; + + /** + * Grace period after scaling activity. + * + * Subsequent scale outs during the cooldown period are squashed so that only + * the biggest scale out happens. + * + * Subsequent scale ins during the cooldown period are ignored. + * + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html + * @default No cooldown period + */ + readonly cooldown?: cdk.Duration; + + /** + * Minimum absolute number to adjust capacity with as result of percentage scaling. + * + * Only when using AdjustmentType = PercentChangeInCapacity, this number controls + * the minimum absolute effect size. + * + * @default No minimum scaling effect + */ + readonly minAdjustmentMagnitude?: number; + + /** + * How many evaluation periods of the metric to wait before triggering a scaling action + * + * Raising this value can be used to smooth out the metric, at the expense + * of slower response times. + * + * If `datapointsToAlarm` is not set, then all data points in the evaluation period + * must meet the criteria to trigger a scaling action. + * + * @default 1 + */ + readonly evaluationPeriods?: number; + + /** + * The number of data points out of the evaluation periods that must be breaching to + * trigger a scaling action + * + * Creates an "M out of N" alarm, where this property is the M and the value set for + * `evaluationPeriods` is the N value. + * + * Only has meaning if `evaluationPeriods != 1`. + * + * @default `evaluationPeriods` + */ + readonly datapointsToAlarm?: number; + + /** + * Aggregation to apply to all data points over the evaluation periods + * + * Only has meaning if `evaluationPeriods != 1`. + * + * @default - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE. + */ + readonly metricAggregationType?: MetricAggregationType; +} + +export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { + /** + * The scaling target + */ + readonly scalingTarget: IScalableTarget; +} + +/** + * Define a scaling strategy which scales depending on absolute values of some metric. + * + * You can specify the scaling behavior for various values of the metric. + * + * Implemented using one or more CloudWatch alarms and Step Scaling Policies. + */ +export class StepScalingPolicy extends Construct { + public readonly lowerAlarm?: cloudwatch.Alarm; + public readonly lowerAction?: StepScalingAction; + public readonly upperAlarm?: cloudwatch.Alarm; + public readonly upperAction?: StepScalingAction; + + constructor(scope: Construct, id: string, props: StepScalingPolicyProps) { + super(scope, id); + + if (props.scalingSteps.length < 2) { + throw new Error('You must supply at least 2 intervals for autoscaling'); + } + + if (props.datapointsToAlarm !== undefined && props.datapointsToAlarm < 1) { + throw new RangeError(`datapointsToAlarm cannot be less than 1, got: ${props.datapointsToAlarm}`); + } + + const adjustmentType = props.adjustmentType || AdjustmentType.CHANGE_IN_CAPACITY; + const changesAreAbsolute = adjustmentType === AdjustmentType.EXACT_CAPACITY; + + const intervals = normalizeIntervals(props.scalingSteps, changesAreAbsolute); + const alarms = findAlarmThresholds(intervals); + + if (alarms.lowerAlarmIntervalIndex !== undefined) { + const threshold = intervals[alarms.lowerAlarmIntervalIndex].upper; + + this.lowerAction = new StepScalingAction(this, 'LowerPolicy', { + adjustmentType, + cooldown: props.cooldown, + metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), + minAdjustmentMagnitude: props.minAdjustmentMagnitude, + scalingTarget: props.scalingTarget, + }); + + for (let i = alarms.lowerAlarmIntervalIndex; i >= 0; i--) { + this.lowerAction.addAdjustment({ + adjustment: intervals[i].change!, + lowerBound: i !== 0 ? intervals[i].lower - threshold : undefined, // Extend last interval to -infinity + upperBound: intervals[i].upper - threshold, + }); + } + + this.lowerAlarm = new cloudwatch.Alarm(this, 'LowerAlarm', { + // Recommended by AutoScaling + metric: props.metric, + alarmDescription: 'Lower threshold scaling alarm', + comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD, + evaluationPeriods: props.evaluationPeriods ?? 1, + datapointsToAlarm: props.datapointsToAlarm, + threshold, + }); + this.lowerAlarm.addAlarmAction(new StepScalingAlarmAction(this.lowerAction)); + } + + if (alarms.upperAlarmIntervalIndex !== undefined) { + const threshold = intervals[alarms.upperAlarmIntervalIndex].lower; + + this.upperAction = new StepScalingAction(this, 'UpperPolicy', { + adjustmentType, + cooldown: props.cooldown, + metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), + minAdjustmentMagnitude: props.minAdjustmentMagnitude, + scalingTarget: props.scalingTarget, + }); + + for (let i = alarms.upperAlarmIntervalIndex; i < intervals.length; i++) { + this.upperAction.addAdjustment({ + adjustment: intervals[i].change!, + lowerBound: intervals[i].lower - threshold, + upperBound: i !== intervals.length - 1 ? intervals[i].upper - threshold : undefined, // Extend last interval to +infinity + }); + } + + this.upperAlarm = new cloudwatch.Alarm(this, 'UpperAlarm', { + // Recommended by AutoScaling + metric: props.metric, + alarmDescription: 'Upper threshold scaling alarm', + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD, + evaluationPeriods: props.evaluationPeriods ?? 1, + datapointsToAlarm: props.datapointsToAlarm, + threshold, + }); + this.upperAlarm.addAlarmAction(new StepScalingAlarmAction(this.upperAction)); + } + } +} + +/** + * A range of metric values in which to apply a certain scaling operation + */ +export interface ScalingInterval { + /** + * The lower bound of the interval. + * + * The scaling adjustment will be applied if the metric is higher than this value. + * + * @default Threshold automatically derived from neighbouring intervals + */ + readonly lower?: number; + + /** + * The upper bound of the interval. + * + * The scaling adjustment will be applied if the metric is lower than this value. + * + * @default Threshold automatically derived from neighbouring intervals + */ + readonly upper?: number; + + /** + * The capacity adjustment to apply in this interval + * + * The number is interpreted differently based on AdjustmentType: + * + * - ChangeInCapacity: add the adjustment to the current capacity. + * The number can be positive or negative. + * - PercentChangeInCapacity: add or remove the given percentage of the current + * capacity to itself. The number can be in the range [-100..100]. + * - ExactCapacity: set the capacity to this number. The number must + * be positive. + */ + readonly change: number; +} + +function aggregationTypeFromMetric(metric: cloudwatch.IMetric): MetricAggregationType | undefined { + const statistic = metric.toMetricConfig().metricStat?.statistic; + if (statistic == null) { return undefined; } // Math expression, don't know aggregation, leave default + + switch (statistic) { + case 'Average': + return MetricAggregationType.AVERAGE; + case 'Minimum': + return MetricAggregationType.MINIMUM; + case 'Maximum': + return MetricAggregationType.MAXIMUM; + default: + return MetricAggregationType.AVERAGE; + } +} + +/** + * Use a StepScalingAction as an Alarm Action + * + * This class is here and not in aws-cloudwatch-actions because this library + * needs to use the class, and otherwise we'd have a circular dependency: + * + * aws-autoscaling -> aws-cloudwatch-actions (for using the Action) + * aws-cloudwatch-actions -> aws-autoscaling (for the definition of IStepScalingAction) + */ +class StepScalingAlarmAction implements cloudwatch.IAlarmAction { + constructor(private readonly stepScalingAction: StepScalingAction) { + } + + public bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { + return { alarmActionArn: this.stepScalingAction.scalingPolicyArn }; + } +} diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts new file mode 100644 index 0000000000000..da774f10a864e --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts @@ -0,0 +1,292 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import { CfnScalingPolicy } from './applicationautoscaling.generated'; +import { IScalableTarget } from './scalable-target'; + +/** + * Base interface for target tracking props + * + * Contains the attributes that are common to target tracking policies, + * except the ones relating to the metric and to the scalable target. + * + * This interface is reused by more specific target tracking props objects + * in other services. + */ +export interface BaseTargetTrackingProps { + /** + * A name for the scaling policy + * + * @default - Automatically generated name. + */ + readonly policyName?: string; + + /** + * Indicates whether scale in by the target tracking policy is disabled. + * + * If the value is true, scale in is disabled and the target tracking policy + * won't remove capacity from the scalable resource. Otherwise, scale in is + * enabled and the target tracking policy can remove capacity from the + * scalable resource. + * + * @default false + */ + readonly disableScaleIn?: boolean; + + /** + * Period after a scale in activity completes before another scale in activity can start. + * + * @default Duration.seconds(300) for the following scalable targets: ECS services, + * Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, + * Amazon SageMaker endpoint variants, Custom resources. For all other scalable + * targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB + * global secondary indexes, Amazon Comprehend document classification endpoints, + * Lambda provisioned concurrency + */ + readonly scaleInCooldown?: cdk.Duration; + + /** + * Period after a scale out activity completes before another scale out activity can start. + * + * @default Duration.seconds(300) for the following scalable targets: ECS services, + * Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters, + * Amazon SageMaker endpoint variants, Custom resources. For all other scalable + * targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB + * global secondary indexes, Amazon Comprehend document classification endpoints, + * Lambda provisioned concurrency + */ + readonly scaleOutCooldown?: cdk.Duration; +} + +/** + * Properties for a Target Tracking policy that include the metric but exclude the target + */ +export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackingProps { + /** + * The target value for the metric. + */ + readonly targetValue: number; + + /** + * A predefined metric for application autoscaling + * + * The metric must track utilization. Scaling out will happen if the metric is higher than + * the target value, scaling in will happen in the metric is lower than the target value. + * + * Exactly one of customMetric or predefinedMetric must be specified. + * + * @default - No predefined metrics. + */ + readonly predefinedMetric?: PredefinedMetric; + + /** + * Identify the resource associated with the metric type. + * + * Only used for predefined metric ALBRequestCountPerTarget. + * + * Example value: `app///targetgroup//` + * + * @default - No resource label. + */ + readonly resourceLabel?: string; + + /** + * A custom metric for application autoscaling + * + * The metric must track utilization. Scaling out will happen if the metric is higher than + * the target value, scaling in will happen in the metric is lower than the target value. + * + * Exactly one of customMetric or predefinedMetric must be specified. + * + * @default - No custom metric. + */ + readonly customMetric?: cloudwatch.IMetric; +} + +/** + * Properties for a concrete TargetTrackingPolicy + * + * Adds the scalingTarget. + */ +export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps { + /* + * The scalable target + */ + readonly scalingTarget: IScalableTarget; +} + +export class TargetTrackingScalingPolicy extends Construct { + /** + * ARN of the scaling policy + */ + public readonly scalingPolicyArn: string; + + constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps) { + if ((props.customMetric === undefined) === (props.predefinedMetric === undefined)) { + throw new Error('Exactly one of \'customMetric\' or \'predefinedMetric\' must be specified.'); + } + + if (props.customMetric && !props.customMetric.toMetricConfig().metricStat) { + throw new Error('Only direct metrics are supported for Target Tracking. Use Step Scaling or supply a Metric object.'); + } + + super(scope, id); + + // replace dummy value in DYNAMODB_WRITE_CAPACITY_UTILIZATION due to a jsii bug (https://github.com/aws/jsii/issues/2782) + const predefinedMetric = props.predefinedMetric === PredefinedMetric.DYNAMODB_WRITE_CAPACITY_UTILIZATION ? + PredefinedMetric.DYANMODB_WRITE_CAPACITY_UTILIZATION : + props.predefinedMetric; + + const resource = new CfnScalingPolicy(this, 'Resource', { + policyName: props.policyName || cdk.Names.uniqueId(this), + policyType: 'TargetTrackingScaling', + scalingTargetId: props.scalingTarget.scalableTargetId, + targetTrackingScalingPolicyConfiguration: { + customizedMetricSpecification: renderCustomMetric(props.customMetric), + disableScaleIn: props.disableScaleIn, + predefinedMetricSpecification: predefinedMetric !== undefined ? { + predefinedMetricType: predefinedMetric, + resourceLabel: props.resourceLabel, + } : undefined, + scaleInCooldown: props.scaleInCooldown && props.scaleInCooldown.toSeconds(), + scaleOutCooldown: props.scaleOutCooldown && props.scaleOutCooldown.toSeconds(), + targetValue: props.targetValue, + }, + }); + + this.scalingPolicyArn = resource.ref; + } +} + +function renderCustomMetric(metric?: cloudwatch.IMetric): CfnScalingPolicy.CustomizedMetricSpecificationProperty | undefined { + if (!metric) { return undefined; } + const c = metric.toMetricConfig().metricStat!; + + if (c.statistic.startsWith('p')) { + throw new Error(`Cannot use statistic '${c.statistic}' for Target Tracking: only 'Average', 'Minimum', 'Maximum', 'SampleCount', and 'Sum' are supported.`); + } + + return { + dimensions: c.dimensions, + metricName: c.metricName, + namespace: c.namespace, + statistic: c.statistic, + unit: c.unitFilter, + }; +} + +/** + * One of the predefined autoscaling metrics + */ +export enum PredefinedMetric { + /** + * Average percentage of instances in an AppStream fleet that are being used. + */ + APPSTREAM_AVERAGE_CAPACITY_UTILIZATION = 'AppStreamAverageCapacityUtilization', + /** + * Percentage of provisioned read capacity units utilized by a Keyspaces table. + */ + CASSANDRA_READ_CAPACITY_UTILIZATION = 'CassandraReadCapacityUtilization', + /** + * Percentage of provisioned write capacity units utilized by a Keyspaces table. + */ + CASSANDRA_WRITE_CAPACITY_UTILIZATION = 'CassandraWriteCapacityUtilization', + /** + * Percentage of provisioned inference units utilized by a Comprehend endpoint. + */ + COMPREHEND_INFERENCE_UTILIZATION = 'ComprehendInferenceUtilization', + /** + * Average CPU Utilization of read replica instances in a Neptune DB cluster. + */ + NEPTURE_READER_AVERAGE_CPU_UTILIZATION = 'NeptuneReaderAverageCPUUtilization', + /** + * Percentage of provisioned read capacity units consumed by a DynamoDB table. + */ + DYNAMODB_READ_CAPACITY_UTILIZATION = 'DynamoDBReadCapacityUtilization', + /** + * Percentage of provisioned write capacity units consumed by a DynamoDB table. + * + * Suffix `dummy` is necessary due to jsii bug (https://github.com/aws/jsii/issues/2782). + * Duplicate values will be dropped, so this suffix is added as a workaround. + * The value will be replaced when this enum is used. + * + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + DYNAMODB_WRITE_CAPACITY_UTILIZATION = 'DynamoDBWriteCapacityUtilization-dummy', + /** + * DYANMODB_WRITE_CAPACITY_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + * @deprecated use `PredefinedMetric.DYNAMODB_WRITE_CAPACITY_UTILIZATION` + */ + DYANMODB_WRITE_CAPACITY_UTILIZATION = 'DynamoDBWriteCapacityUtilization', + /** + * ALB_REQUEST_COUNT_PER_TARGET + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ALB_REQUEST_COUNT_PER_TARGET = 'ALBRequestCountPerTarget', + /** + * RDS_READER_AVERAGE_CPU_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + RDS_READER_AVERAGE_CPU_UTILIZATION = 'RDSReaderAverageCPUUtilization', + /** + * RDS_READER_AVERAGE_DATABASE_CONNECTIONS + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + RDS_READER_AVERAGE_DATABASE_CONNECTIONS = 'RDSReaderAverageDatabaseConnections', + /** + * EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION = 'EC2SpotFleetRequestAverageCPUUtilization', + /** + * EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN = 'EC2SpotFleetRequestAverageNetworkIn', + /** + * EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT = 'EC2SpotFleetRequestAverageNetworkOut', + /** + * SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE = 'SageMakerVariantInvocationsPerInstance', + /** + * ECS_SERVICE_AVERAGE_CPU_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ECS_SERVICE_AVERAGE_CPU_UTILIZATION = 'ECSServiceAverageCPUUtilization', + /** + * ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION = 'ECSServiceAverageMemoryUtilization', + /** + * LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION + * @see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency + */ + LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION = 'LambdaProvisionedConcurrencyUtilization', + /** + * KAFKA_BROKER_STORAGE_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + KAFKA_BROKER_STORAGE_UTILIZATION = 'KafkaBrokerStorageUtilization', + /** + * ELASTIC_CACHE_PRIMARY_ENGINE_CPU_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION = 'ElastiCachePrimaryEngineCPUUtilization', + /** + * ELASTIC_CACHE_REPLICA_ENGINE_CPU_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ELASTICACHE_REPLICA_ENGINE_CPU_UTILIZATION = 'ElastiCacheReplicaEngineCPUUtilization', + /** + * ELASTIC_CACHE_REPLICA_ENGINE_CPU_UTILIZATION + * @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html + */ + ELASTICACHE_DATABASE_MEMORY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE = 'ElastiCacheDatabaseMemoryUsageCountedForEvictPercentage', +} diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/test/scalable-target.test.ts similarity index 97% rename from packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts rename to packages/aws-cdk-lib/aws-applicationautoscaling/test/scalable-target.test.ts index 8255c8e6ea431..ab6ead3fa4d34 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/test/scalable-target.test.ts @@ -1,7 +1,7 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Annotations, Match, Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { createScalableTarget } from './util'; import * as appscaling from '../lib'; diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/test/schedule.test.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/test/schedule.test.ts new file mode 100644 index 0000000000000..86d4d06c8cae6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/test/schedule.test.ts @@ -0,0 +1,70 @@ +import { Duration, Stack, Lazy } from '../../core'; +import * as appscaling from '../lib'; + +describe('cron', () => { + test('test utc cron, hour only', () => { + expect(appscaling.Schedule.cron({ hour: '18', minute: '0' }).expressionString).toEqual('cron(0 18 * * ? *)'); + + }); + + test('test utc cron, hour and minute', () => { + expect(appscaling.Schedule.cron({ hour: '18', minute: '24' }).expressionString).toEqual('cron(24 18 * * ? *)'); + + }); +}); + +describe('rate', () => { + test('rate must be whole number of minutes', () => { + expect(() => { + appscaling.Schedule.rate(Duration.minutes(0.13456)); + }).toThrow(/'0.13456 minutes' cannot be converted into a whole number of seconds/); + + }); + + test('rate can be in seconds', () => { + const duration = appscaling.Schedule.rate(Duration.seconds(120)); + expect('rate(2 minutes)').toEqual(duration.expressionString); + + }); + + test('rate must not be in seconds when specified as a token', () => { + expect(() => { + appscaling.Schedule.rate(Duration.seconds(Lazy.number({ produce: () => 5 }))); + }).toThrow(/Allowed units for scheduling/); + + }); + + test('rate cannot be 0', () => { + expect(() => { + appscaling.Schedule.rate(Duration.days(0)); + }).toThrow(/Duration cannot be 0/); + + }); + + test('rate can be token', () => { + const stack = new Stack(); + const lazyDuration = Duration.minutes(Lazy.number({ produce: () => 5 })); + const rate = appscaling.Schedule.rate(lazyDuration); + expect('rate(5 minutes)').toEqual(stack.resolve(rate).expressionString); + + }); + + test('rate can be in allowed type hours', () => { + expect('rate(1 hour)').toEqual(appscaling.Schedule.rate(Duration.hours(1)) + .expressionString); + + }); +}); + +describe('expression', () => { + test('test using a literal schedule expression', () => { + expect(appscaling.Schedule.expression('cron(0 18 * * ? *)').expressionString).toEqual('cron(0 18 * * ? *)'); + + }); +}); + +describe('at', () => { + test('test using at with a specific Date', () => { + expect(appscaling.Schedule.at(new Date(Date.UTC(2021, 10, 26))).expressionString).toEqual('at(2021-11-26T00:00:00)'); + }); +}); diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/step-scaling-policy.test.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/test/step-scaling-policy.test.ts similarity index 98% rename from packages/@aws-cdk/aws-applicationautoscaling/test/step-scaling-policy.test.ts rename to packages/aws-cdk-lib/aws-applicationautoscaling/test/step-scaling-policy.test.ts index 5fab44f0b7766..f1e501913eefd 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/step-scaling-policy.test.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/test/step-scaling-policy.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as cdk from '../../core'; import * as fc from 'fast-check'; import { arbitrary_input_intervals, createScalableTarget } from './util'; import * as appscaling from '../lib'; diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/target-tracking.test.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts similarity index 95% rename from packages/@aws-cdk/aws-applicationautoscaling/test/target-tracking.test.ts rename to packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts index af2f7230ae15e..929eec809aa68 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/target-tracking.test.ts +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/test/target-tracking.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as cdk from '../../core'; import { createScalableTarget } from './util'; import * as appscaling from '../lib'; diff --git a/packages/aws-cdk-lib/aws-applicationautoscaling/test/util.ts b/packages/aws-cdk-lib/aws-applicationautoscaling/test/util.ts new file mode 100644 index 0000000000000..6a758e18c2021 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationautoscaling/test/util.ts @@ -0,0 +1,25 @@ +import * as scalingcommon from '../../aws-autoscaling-common'; +import * as constructs from 'constructs'; +import * as fc from 'fast-check'; +import * as appscaling from '../lib'; + +export function createScalableTarget(scope: constructs.Construct) { + return new appscaling.ScalableTarget(scope, 'Target', { + serviceNamespace: appscaling.ServiceNamespace.DYNAMODB, + scalableDimension: 'test:TestCount', + resourceId: 'test:this/test', + minCapacity: 1, + maxCapacity: 20, + }); +} + +export class ArbitraryInputIntervals extends fc.Arbitrary { + public generate(mrng: fc.Random): fc.Shrinkable { + const ret = scalingcommon.generateArbitraryIntervals(mrng); + return new fc.Shrinkable(ret.intervals); + } +} + +export function arbitrary_input_intervals() { + return new ArbitraryInputIntervals(); +} diff --git a/packages/aws-cdk-lib/aws-applicationinsights/.jsiirc.json b/packages/aws-cdk-lib/aws-applicationinsights/.jsiirc.json new file mode 100644 index 0000000000000..71cb7e77ee4c9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationinsights/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ApplicationInsights" + }, + "java": { + "package": "software.amazon.awscdk.services.applicationinsights" + }, + "python": { + "module": "aws_cdk.aws_applicationinsights" + } + } +} diff --git a/packages/aws-cdk-lib/aws-applicationinsights/README.md b/packages/aws-cdk-lib/aws-applicationinsights/README.md new file mode 100644 index 0000000000000..6e3ae8177f454 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationinsights/README.md @@ -0,0 +1,27 @@ +# AWS::ApplicationInsights Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as applicationinsights from 'aws-cdk-lib/aws-applicationinsights'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ApplicationInsights construct libraries](https://constructs.dev/search?q=applicationinsights) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ApplicationInsights resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApplicationInsights.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ApplicationInsights](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ApplicationInsights.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-applicationinsights/index.ts b/packages/aws-cdk-lib/aws-applicationinsights/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationinsights/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-applicationinsights/lib/index.ts b/packages/aws-cdk-lib/aws-applicationinsights/lib/index.ts new file mode 100644 index 0000000000000..81124195d1606 --- /dev/null +++ b/packages/aws-cdk-lib/aws-applicationinsights/lib/index.ts @@ -0,0 +1 @@ +export * from './applicationinsights.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appmesh/.jsiirc.json b/packages/aws-cdk-lib/aws-appmesh/.jsiirc.json new file mode 100644 index 0000000000000..c237931ebf1f0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appmesh/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppMesh" + }, + "java": { + "package": "software.amazon.awscdk.services.appmesh" + }, + "python": { + "module": "aws_cdk.aws_appmesh" + } + } +} diff --git a/packages/aws-cdk-lib/aws-appmesh/README.md b/packages/aws-cdk-lib/aws-appmesh/README.md new file mode 100644 index 0000000000000..597b4e0e68c3b --- /dev/null +++ b/packages/aws-cdk-lib/aws-appmesh/README.md @@ -0,0 +1,883 @@ +# AWS App Mesh Construct Library + + +AWS App Mesh is a service mesh based on the [Envoy](https://www.envoyproxy.io/) proxy that makes it easy to monitor and control microservices. App Mesh standardizes how your microservices communicate, giving you end-to-end visibility and helping to ensure high-availability for your applications. + +App Mesh gives you consistent visibility and network traffic controls for every microservice in an application. + +App Mesh supports microservice applications that use service discovery naming for their components. To use App Mesh, you must have an existing application running on AWS Fargate, Amazon ECS, Amazon EKS, Kubernetes on AWS, or Amazon EC2. + +For further information on **AWS App Mesh**, visit the [AWS App Mesh Documentation](https://docs.aws.amazon.com/app-mesh/index.html). + +## Create the App and Stack + +```ts +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'stack'); +``` + +## Creating the Mesh + +A service mesh is a logical boundary for network traffic between the services that reside within it. + +After you create your service mesh, you can create virtual services, virtual nodes, virtual routers, and routes to distribute traffic between the applications in your mesh. + +The following example creates the `AppMesh` service mesh with the default egress filter of `DROP_ALL`. See [the AWS CloudFormation `EgressFilter` resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-mesh-egressfilter.html) for more info on egress filters. + +```ts +const mesh = new appmesh.Mesh(this, 'AppMesh', { + meshName: 'myAwsMesh', +}); +``` + +The mesh can instead be created with the `ALLOW_ALL` egress filter by providing the `egressFilter` property. + +```ts +const mesh = new appmesh.Mesh(this, 'AppMesh', { + meshName: 'myAwsMesh', + egressFilter: appmesh.MeshFilterType.ALLOW_ALL, +}); +``` + +A mesh with an IP preference can be created by providing the property `serviceDiscovery` that specifes an `ipPreference`. + +```ts +const mesh = new appmesh.Mesh(this, 'AppMesh', { + meshName: 'myAwsMesh', + serviceDiscovery: { + ipPreference: appmesh.IpPreference.IPV4_ONLY, + }, +}); +``` + +## Adding VirtualRouters + +A _mesh_ uses _virtual routers_ as logical units to route requests to _virtual nodes_. + +Virtual routers handle traffic for one or more virtual services within your mesh. +After you create a virtual router, you can create and associate routes to your virtual router that direct incoming requests to different virtual nodes. + +```ts +declare const mesh: appmesh.Mesh; +const router = mesh.addVirtualRouter('router', { + listeners: [appmesh.VirtualRouterListener.http(8080)], +}); +``` + +Note that creating the router using the `addVirtualRouter()` method places it in the same stack as the mesh +(which might be different from the current stack). +The router can also be created using the `VirtualRouter` constructor (passing in the mesh) instead of calling the `addVirtualRouter()` method. +This is particularly useful when splitting your resources between many stacks: for example, defining the mesh itself as part of an infrastructure stack, but defining the other resources, such as routers, in the application stack: + +```ts +declare const infraStack: cdk.Stack; +declare const appStack: cdk.Stack; + +const mesh = new appmesh.Mesh(infraStack, 'AppMesh', { + meshName: 'myAwsMesh', + egressFilter: appmesh.MeshFilterType.ALLOW_ALL, +}); + +// the VirtualRouter will belong to 'appStack', +// even though the Mesh belongs to 'infraStack' +const router = new appmesh.VirtualRouter(appStack, 'router', { + mesh, // notice that mesh is a required property when creating a router with the 'new' statement + listeners: [appmesh.VirtualRouterListener.http(8081)], +}); +``` + +The same is true for other `add*()` methods in the App Mesh construct library. + +The `VirtualRouterListener` class lets you define protocol-specific listeners. +The `http()`, `http2()`, `grpc()` and `tcp()` methods create listeners for the named protocols. +They accept a single parameter that defines the port to on which requests will be matched. +The port parameter defaults to 8080 if omitted. + +## Adding a VirtualService + +A _virtual service_ is an abstraction of a real service that is provided by a virtual node directly, or indirectly by means of a virtual router. Dependent services call your virtual service by its `virtualServiceName`, and those requests are routed to the virtual node or virtual router specified as the provider for the virtual service. + +We recommend that you use the service discovery name of the real service that you're targeting (such as `my-service.default.svc.cluster.local`). + +When creating a virtual service: + +- If you want the virtual service to spread traffic across multiple virtual nodes, specify a virtual router. +- If you want the virtual service to reach a virtual node directly, without a virtual router, specify a virtual node. + +Adding a virtual router as the provider: + +```ts +declare const router: appmesh.VirtualRouter; + +new appmesh.VirtualService(this, 'virtual-service', { + virtualServiceName: 'my-service.default.svc.cluster.local', // optional + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router), +}); +``` + +Adding a virtual node as the provider: + +```ts +declare const node: appmesh.VirtualNode; + +new appmesh.VirtualService(this, 'virtual-service', { + virtualServiceName: `my-service.default.svc.cluster.local`, // optional + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node), +}); +``` + +## Adding a VirtualNode + +A _virtual node_ acts as a logical pointer to a particular task group, such as an Amazon ECS service or a Kubernetes deployment. + +When you create a virtual node, accept inbound traffic by specifying a *listener*. Outbound traffic that your virtual node expects to send should be specified as a *back end*. + +The response metadata for your new virtual node contains the Amazon Resource Name (ARN) that is associated with the virtual node. Set this value (either the full ARN or the truncated resource name) as the `APPMESH_VIRTUAL_NODE_NAME` environment variable for your task group's Envoy proxy container in your task definition or pod spec. For example, the value could be `mesh/default/virtualNode/simpleapp`. This is then mapped to the `node.id` and `node.cluster` Envoy parameters. + +> **Note** +> If you require your Envoy stats or tracing to use a different name, you can override the `node.cluster` value that is set by `APPMESH_VIRTUAL_NODE_NAME` with the `APPMESH_VIRTUAL_NODE_CLUSTER` environment variable. + +```ts +const vpc = new ec2.Vpc(this, 'vpc'); +const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', { + vpc, + name: 'domain.local', +}); +const service = namespace.createService('Svc'); + +declare const mesh: appmesh.Mesh; +const node = mesh.addVirtualNode('virtual-node', { + serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), + listeners: [appmesh.VirtualNodeListener.http({ + port: 8081, + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + interval: cdk.Duration.seconds(5), // minimum + path: '/health-check-path', + timeout: cdk.Duration.seconds(2), // minimum + unhealthyThreshold: 2, + }), + })], + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), +}); +``` + +Create a `VirtualNode` with the constructor and add tags. + +```ts +declare const mesh: appmesh.Mesh; +declare const service: cloudmap.Service; + +const node = new appmesh.VirtualNode(this, 'node', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), + listeners: [appmesh.VirtualNodeListener.http({ + port: 8080, + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + interval: cdk.Duration.seconds(5), + path: '/ping', + timeout: cdk.Duration.seconds(2), + unhealthyThreshold: 2, + }), + timeout: { + idle: cdk.Duration.seconds(5), + }, + })], + backendDefaults: { + tlsClientPolicy: { + validation: { + trust: appmesh.TlsValidationTrust.file('/keys/local_cert_chain.pem'), + }, + }, + }, + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), +}); + +cdk.Tags.of(node).add('Environment', 'Dev'); +``` + +Create a `VirtualNode` with the constructor and add backend virtual service. + +```ts +declare const mesh: appmesh.Mesh; +declare const router: appmesh.VirtualRouter; +declare const service: cloudmap.Service; + +const node = new appmesh.VirtualNode(this, 'node', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), + listeners: [appmesh.VirtualNodeListener.http({ + port: 8080, + healthCheck: appmesh.HealthCheck.http({ + healthyThreshold: 3, + interval: cdk.Duration.seconds(5), + path: '/ping', + timeout: cdk.Duration.seconds(2), + unhealthyThreshold: 2, + }), + timeout: { + idle: cdk.Duration.seconds(5), + }, + })], + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), +}); + +const virtualService = new appmesh.VirtualService(this, 'service-1', { + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualRouter(router), + virtualServiceName: 'service1.domain.local', +}); + +node.addBackend(appmesh.Backend.virtualService(virtualService)); +``` + +The `listeners` property can be left blank and added later with the `node.addListener()` method. The `serviceDiscovery` property must be specified when specifying a listener. + +The `backends` property can be added with `node.addBackend()`. In the example, we define a virtual service and add it to the virtual node to allow egress traffic to other nodes. + +The `backendDefaults` property is added to the node while creating the virtual node. These are the virtual node's default settings for all backends. + +The `VirtualNode.addBackend()` method is especially useful if you want to create a circular traffic flow by having a Virtual Service as a backend whose provider is that same Virtual Node: + +```ts +declare const mesh: appmesh.Mesh; + +const node = new appmesh.VirtualNode(this, 'node', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.dns('node'), +}); + +const virtualService = new appmesh.VirtualService(this, 'service-1', { + virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node), + virtualServiceName: 'service1.domain.local', +}); + +node.addBackend(appmesh.Backend.virtualService(virtualService)); +``` + +### Adding TLS to a listener + +The `tls` property specifies TLS configuration when creating a listener for a virtual node or a virtual gateway. +Provide the TLS certificate to the proxy in one of the following ways: + +- A certificate from AWS Certificate Manager (ACM). + +- A customer-provided certificate (specify a `certificateChain` path file and a `privateKey` file path). + +- A certificate provided by a Secrets Discovery Service (SDS) endpoint over local Unix Domain Socket (specify its `secretName`). + +```ts +// A Virtual Node with listener TLS from an ACM provided certificate +declare const cert: certificatemanager.Certificate; +declare const mesh: appmesh.Mesh; + +const node = new appmesh.VirtualNode(this, 'node', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.dns('node'), + listeners: [appmesh.VirtualNodeListener.grpc({ + port: 80, + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.acm(cert), + }, + })], +}); + +// A Virtual Gateway with listener TLS from a customer provided file certificate +const gateway = new appmesh.VirtualGateway(this, 'gateway', { + mesh, + listeners: [appmesh.VirtualGatewayListener.grpc({ + port: 8080, + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'), + }, + })], + virtualGatewayName: 'gateway', +}); + +// A Virtual Gateway with listener TLS from a SDS provided certificate +const gateway2 = new appmesh.VirtualGateway(this, 'gateway2', { + mesh, + listeners: [appmesh.VirtualGatewayListener.http2({ + port: 8080, + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.sds('secrete_certificate'), + }, + })], + virtualGatewayName: 'gateway2', +}); +``` + +### Adding mutual TLS authentication + +Mutual TLS authentication is an optional component of TLS that offers two-way peer authentication. +To enable mutual TLS authentication, add the `mutualTlsCertificate` property to TLS client policy and/or the `mutualTlsValidation` property to your TLS listener. + +`tls.mutualTlsValidation` and `tlsClientPolicy.mutualTlsCertificate` can be sourced from either: + +- A customer-provided certificate (specify a `certificateChain` path file and a `privateKey` file path). + +- A certificate provided by a Secrets Discovery Service (SDS) endpoint over local Unix Domain Socket (specify its `secretName`). + +> **Note** +> Currently, a certificate from AWS Certificate Manager (ACM) cannot be used for mutual TLS authentication. + +```ts +declare const mesh: appmesh.Mesh; + +const node1 = new appmesh.VirtualNode(this, 'node1', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.dns('node'), + listeners: [appmesh.VirtualNodeListener.grpc({ + port: 80, + tls: { + mode: appmesh.TlsMode.STRICT, + certificate: appmesh.TlsCertificate.file('path/to/certChain', 'path/to/privateKey'), + // Validate a file client certificates to enable mutual TLS authentication when a client provides a certificate. + mutualTlsValidation: { + trust: appmesh.TlsValidationTrust.file('path-to-certificate'), + }, + }, + })], +}); + +const certificateAuthorityArn = 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012'; +const node2 = new appmesh.VirtualNode(this, 'node2', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.dns('node2'), + backendDefaults: { + tlsClientPolicy: { + ports: [8080, 8081], + validation: { + subjectAlternativeNames: appmesh.SubjectAlternativeNames.matchingExactly('mesh-endpoint.apps.local'), + trust: appmesh.TlsValidationTrust.acm([ + acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'certificate', certificateAuthorityArn)]), + }, + // Provide a SDS client certificate when a server requests it and enable mutual TLS authentication. + mutualTlsCertificate: appmesh.TlsCertificate.sds('secret_certificate'), + }, + }, +}); +``` + +### Adding outlier detection to a Virtual Node listener + +The `outlierDetection` property adds outlier detection to a Virtual Node listener. The properties +`baseEjectionDuration`, `interval`, `maxEjectionPercent`, and `maxServerErrors` are required. + +```ts +// Cloud Map service discovery is currently required for host ejection by outlier detection +const vpc = new ec2.Vpc(this, 'vpc'); +const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', { + vpc, + name: 'domain.local', +}); +const service = namespace.createService('Svc'); + +declare const mesh: appmesh.Mesh; +const node = mesh.addVirtualNode('virtual-node', { + serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service), + listeners: [appmesh.VirtualNodeListener.http({ + outlierDetection: { + baseEjectionDuration: cdk.Duration.seconds(10), + interval: cdk.Duration.seconds(30), + maxEjectionPercent: 50, + maxServerErrors: 5, + }, + })], +}); +``` + +### Adding a connection pool to a listener + +The `connectionPool` property can be added to a Virtual Node listener or Virtual Gateway listener to add a request connection pool. Each listener protocol type has its own connection pool properties. + +```ts +// A Virtual Node with a gRPC listener with a connection pool set +declare const mesh: appmesh.Mesh; +const node = new appmesh.VirtualNode(this, 'node', { + mesh, + // DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS. + // LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints, + // whereas ENDPOINTS means that the DNS resolver is returning all the endpoints. + // By default, the response type is assumed to be LOAD_BALANCER + serviceDiscovery: appmesh.ServiceDiscovery.dns('node', appmesh.DnsResponseType.ENDPOINTS), + listeners: [appmesh.VirtualNodeListener.http({ + port: 80, + connectionPool: { + maxConnections: 100, + maxPendingRequests: 10, + }, + })], +}); + +// A Virtual Gateway with a gRPC listener with a connection pool set +const gateway = new appmesh.VirtualGateway(this, 'gateway', { + mesh, + listeners: [appmesh.VirtualGatewayListener.grpc({ + port: 8080, + connectionPool: { + maxRequests: 10, + }, + })], + virtualGatewayName: 'gateway', +}); +``` + +### Adding an IP Preference to a Virtual Node + +An `ipPreference` can be specified as part of a Virtual Node's service discovery. An IP preference defines how clients for this Virtual Node will interact with it. + +There a four different IP preferences available to use which each specify what IP versions this Virtual Node will use and prefer. + +- `IPv4_ONLY` - Only use IPv4. For CloudMap service discovery, only IPv4 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv4. + +- `IPv4_PREFERRED` - Prefer IPv4 and fall back to IPv6. For CloudMap service discovery, an IPv4 address will be used if returned from CloudMap. Otherwise, an IPv6 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv4 and fall back to IPv6. + +- `IPv6_ONLY` - Only use IPv6. For CloudMap service discovery, only IPv6 addresses returned from CloudMap will be used. For DNS service discovery, Envoy's DNS resolver will only resolve DNS queries for IPv6. + +- `IPv6_PREFERRED` - Prefer IPv6 and fall back to IPv4. For CloudMap service discovery, an IPv6 address will be used if returned from CloudMap. Otherwise, an IPv4 address will be used if available. For DNS service discovery, Envoy's DNS resolver will first attempt to resolve DNS queries using IPv6 and fall back to IPv4. + +```ts +const mesh = new appmesh.Mesh(stack, 'mesh', { + meshName: 'mesh-with-preference', +}); + +// Virtual Node with DNS service discovery and an IP preference +const dnsNode = new appmesh.VirtualNode(stack, 'dns-node', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.dns('test', appmesh.DnsResponseType.LOAD_BALANCER, appmesh.IpPreference.IPV4_ONLY), +}); + +// Virtual Node with CloudMap service discovery and an IP preference +const vpc = new ec2.Vpc(stack, 'vpc'); +const namespace = new cloudmap.PrivateDnsNamespace(stack, 'test-namespace', { + vpc, + name: 'domain.local', +}); +const service = namespace.createService('Svc'); + +const instanceAttribute : { [key: string]: string} = {}; +instanceAttribute.testKey = 'testValue'; + +const cloudmapNode = new appmesh.VirtualNode(stack, 'cloudmap-node', { + mesh, + serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service, instanceAttribute, appmesh.IpPreference.IPV4_ONLY), +}); +``` + +## Adding a Route + +A _route_ matches requests with an associated virtual router and distributes traffic to its associated virtual nodes. +The route distributes matching requests to one or more target virtual nodes with relative weighting. + +The `RouteSpec` class lets you define protocol-specific route specifications. +The `tcp()`, `http()`, `http2()`, and `grpc()` methods create a specification for the named protocols. + +For HTTP-based routes, the match field can match on path (prefix, exact, or regex), HTTP method, scheme, +HTTP headers, and query parameters. By default, HTTP-based routes match all requests. + +For gRPC-based routes, the match field can match on service name, method name, and metadata. +When specifying the method name, the service name must also be specified. + +For example, here's how to add an HTTP route that matches based on a prefix of the URL path: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-http', { + routeSpec: appmesh.RouteSpec.http({ + weightedTargets: [ + { + virtualNode: node, + }, + ], + match: { + // Path that is passed to this method must start with '/'. + path: appmesh.HttpRoutePathMatch.startsWith('/path-to-app'), + }, + }), +}); +``` + +Add an HTTP2 route that matches based on exact path, method, scheme, headers, and query parameters: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-http2', { + routeSpec: appmesh.RouteSpec.http2({ + weightedTargets: [ + { + virtualNode: node, + }, + ], + match: { + path: appmesh.HttpRoutePathMatch.exactly('/exact'), + method: appmesh.HttpRouteMethod.POST, + protocol: appmesh.HttpRouteProtocol.HTTPS, + headers: [ + // All specified headers must match for the route to match. + appmesh.HeaderMatch.valueIs('Content-Type', 'application/json'), + appmesh.HeaderMatch.valueIsNot('Content-Type', 'application/json'), + ], + queryParameters: [ + // All specified query parameters must match for the route to match. + appmesh.QueryParameterMatch.valueIs('query-field', 'value') + ], + }, + }), +}); +``` + +Add a single route with two targets and split traffic 50/50: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-http', { + routeSpec: appmesh.RouteSpec.http({ + weightedTargets: [ + { + virtualNode: node, + weight: 50, + }, + { + virtualNode: node, + weight: 50, + }, + ], + match: { + path: appmesh.HttpRoutePathMatch.startsWith('/path-to-app'), + }, + }), +}); +``` + +Add an http2 route with retries: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-http2-retry', { + routeSpec: appmesh.RouteSpec.http2({ + weightedTargets: [{ virtualNode: node }], + retryPolicy: { + // Retry if the connection failed + tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR], + // Retry if HTTP responds with a gateway error (502, 503, 504) + httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR], + // Retry five times + retryAttempts: 5, + // Use a 1 second timeout per retry + retryTimeout: cdk.Duration.seconds(1), + }, + }), +}); +``` + +Add a gRPC route with retries: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-grpc-retry', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [{ virtualNode: node }], + match: { serviceName: 'servicename' }, + retryPolicy: { + tcpRetryEvents: [appmesh.TcpRetryEvent.CONNECTION_ERROR], + httpRetryEvents: [appmesh.HttpRetryEvent.GATEWAY_ERROR], + // Retry if gRPC responds that the request was cancelled, a resource + // was exhausted, or if the service is unavailable + grpcRetryEvents: [ + appmesh.GrpcRetryEvent.CANCELLED, + appmesh.GrpcRetryEvent.RESOURCE_EXHAUSTED, + appmesh.GrpcRetryEvent.UNAVAILABLE, + ], + retryAttempts: 5, + retryTimeout: cdk.Duration.seconds(1), + }, + }), +}); +``` + +Add an gRPC route that matches based on method name and metadata: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-grpc-retry', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [{ virtualNode: node }], + match: { + // When method name is specified, service name must be also specified. + methodName: 'methodname', + serviceName: 'servicename', + metadata: [ + // All specified metadata must match for the route to match. + appmesh.HeaderMatch.valueStartsWith('Content-Type', 'application/'), + appmesh.HeaderMatch.valueDoesNotStartWith('Content-Type', 'text/'), + ], + }, + }), +}); +``` + +Add a gRPC route with timeout: + +```ts +declare const router: appmesh.VirtualRouter; +declare const node: appmesh.VirtualNode; + +router.addRoute('route-http', { + routeSpec: appmesh.RouteSpec.grpc({ + weightedTargets: [ + { + virtualNode: node, + }, + ], + match: { + serviceName: 'my-service.default.svc.cluster.local', + }, + timeout: { + idle : cdk.Duration.seconds(2), + perRequest: cdk.Duration.seconds(1), + }, + }), +}); +``` + +## Adding a Virtual Gateway + +A _virtual gateway_ allows resources outside your mesh to communicate with resources inside your mesh. +The virtual gateway represents an Envoy proxy running in an Amazon ECS task, in a Kubernetes service, or on an Amazon EC2 instance. +Unlike a virtual node, which represents Envoy running with an application, a virtual gateway represents Envoy deployed by itself. + +A virtual gateway is similar to a virtual node in that it has a listener that accepts traffic for a particular port and protocol (HTTP, HTTP2, gRPC). +Traffic received by the virtual gateway is directed to other services in your mesh +using rules defined in gateway routes which can be added to your virtual gateway. + +Create a virtual gateway with the constructor: + +```ts +declare const mesh: appmesh.Mesh; +const certificateAuthorityArn = 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012'; + +const gateway = new appmesh.VirtualGateway(this, 'gateway', { + mesh: mesh, + listeners: [appmesh.VirtualGatewayListener.http({ + port: 443, + healthCheck: appmesh.HealthCheck.http({ + interval: cdk.Duration.seconds(10), + }), + })], + backendDefaults: { + tlsClientPolicy: { + ports: [8080, 8081], + validation: { + trust: appmesh.TlsValidationTrust.acm([ + acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'certificate', certificateAuthorityArn)]), + }, + }, + }, + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), + virtualGatewayName: 'virtualGateway', +}); +``` + +Add a virtual gateway directly to the mesh: + +```ts +declare const mesh: appmesh.Mesh; + +const gateway = mesh.addVirtualGateway('gateway', { + accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'), + virtualGatewayName: 'virtualGateway', + listeners: [appmesh.VirtualGatewayListener.http({ + port: 443, + healthCheck: appmesh.HealthCheck.http({ + interval: cdk.Duration.seconds(10), + }), + })], +}); +``` + +The `listeners` field defaults to an HTTP Listener on port 8080 if omitted. +A gateway route can be added using the `gateway.addGatewayRoute()` method. + +The `backendDefaults` property, provided when creating the virtual gateway, specifies the virtual gateway's default settings for all backends. + +## Adding a Gateway Route + +A _gateway route_ is attached to a virtual gateway and routes matching traffic to an existing virtual service. + +For HTTP-based gateway routes, the `match` field can be used to match on +path (prefix, exact, or regex), HTTP method, host name, HTTP headers, and query parameters. +By default, HTTP-based gateway routes match all requests. + +```ts +declare const gateway: appmesh.VirtualGateway; +declare const virtualService: appmesh.VirtualService; + +gateway.addGatewayRoute('gateway-route-http', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + match: { + path: appmesh.HttpGatewayRoutePathMatch.regex('regex'), + }, + }), +}); +``` + +For gRPC-based gateway routes, the `match` field can be used to match on service name, host name, and metadata. + +```ts +declare const gateway: appmesh.VirtualGateway; +declare const virtualService: appmesh.VirtualService; + +gateway.addGatewayRoute('gateway-route-grpc', { + routeSpec: appmesh.GatewayRouteSpec.grpc({ + routeTarget: virtualService, + match: { + hostname: appmesh.GatewayRouteHostnameMatch.endsWith('.example.com'), + }, + }), +}); +``` + +For HTTP based gateway routes, App Mesh automatically rewrites the matched prefix path in Gateway Route to “/”. +This automatic rewrite configuration can be overwritten in following ways: + +```ts +declare const gateway: appmesh.VirtualGateway; +declare const virtualService: appmesh.VirtualService; + +gateway.addGatewayRoute('gateway-route-http', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + match: { + // This disables the default rewrite to '/', and retains original path. + path: appmesh.HttpGatewayRoutePathMatch.startsWith('/path-to-app/', ''), + }, + }), +}); + +gateway.addGatewayRoute('gateway-route-http-1', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + match: { + // If the request full path is '/path-to-app/xxxxx', this rewrites the path to '/rewrittenUri/xxxxx'. + // Please note both `prefixPathMatch` and `rewriteTo` must start and end with the `/` character. + path: appmesh.HttpGatewayRoutePathMatch.startsWith('/path-to-app/', '/rewrittenUri/'), + }, + }), +}); +``` + +If matching other path (exact or regex), only specific rewrite path can be specified. +Unlike `startsWith()` method above, no default rewrite is performed. + +```ts +declare const gateway: appmesh.VirtualGateway; +declare const virtualService: appmesh.VirtualService; + +gateway.addGatewayRoute('gateway-route-http-2', { + routeSpec: appmesh.GatewayRouteSpec.http({ + routeTarget: virtualService, + match: { + // This rewrites the path from '/test' to '/rewrittenPath'. + path: appmesh.HttpGatewayRoutePathMatch.exactly('/test', '/rewrittenPath'), + }, + }), +}); +``` + +For HTTP/gRPC based routes, App Mesh automatically rewrites +the original request received at the Virtual Gateway to the destination Virtual Service name. +This default host name rewrite can be configured by specifying the rewrite rule as one of the `match` property: + +```ts +declare const gateway: appmesh.VirtualGateway; +declare const virtualService: appmesh.VirtualService; + +gateway.addGatewayRoute('gateway-route-grpc', { + routeSpec: appmesh.GatewayRouteSpec.grpc({ + routeTarget: virtualService, + match: { + hostname: appmesh.GatewayRouteHostnameMatch.exactly('example.com'), + // This disables the default rewrite to virtual service name and retain original request. + rewriteRequestHostname: false, + }, + }), +}); +``` + +## Importing Resources + +Each App Mesh resource class comes with two static methods, `fromArn` and `fromAttributes` (where `` is replaced with the resource name, such as `VirtualNode`) for importing a reference to an existing App Mesh resource. +These imported resources can be used with other resources in your mesh as if they were defined directly in your CDK application. + +```ts +const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh/virtualNode/testNode'; +appmesh.VirtualNode.fromVirtualNodeArn(this, 'importedVirtualNode', arn); +``` + +```ts +const virtualNodeName = 'my-virtual-node'; +appmesh.VirtualNode.fromVirtualNodeAttributes(this, 'imported-virtual-node', { + mesh: appmesh.Mesh.fromMeshName(this, 'Mesh', 'testMesh'), + virtualNodeName: virtualNodeName, +}); +``` + +To import a mesh, again there are two static methods, `fromMeshArn` and `fromMeshName`. + +```ts +const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh'; +appmesh.Mesh.fromMeshArn(this, 'imported-mesh', arn); +``` + +```ts +appmesh.Mesh.fromMeshName(this, 'imported-mesh', 'abc'); +``` + +## IAM Grants + +`VirtualNode` and `VirtualGateway` provide `grantStreamAggregatedResources` methods that grant identities that are running +Envoy access to stream generated config from App Mesh. + +```ts +declare const mesh: appmesh.Mesh; +const gateway = new appmesh.VirtualGateway(this, 'testGateway', { mesh }); +const envoyUser = new iam.User(this, 'envoyUser'); + +/** + * This will grant `grantStreamAggregatedResources` ONLY for this gateway. + */ +gateway.grantStreamAggregatedResources(envoyUser) +``` + +## Adding Resources to shared meshes + +A shared mesh allows resources created by different accounts to communicate with each other in the same mesh: + +```ts +// This is the ARN for the mesh from different AWS IAM account ID. +// Ensure mesh is properly shared with your account. For more details, see: https://github.com/aws/aws-cdk/issues/15404 +const arn = 'arn:aws:appmesh:us-east-1:123456789012:mesh/testMesh'; +const sharedMesh = appmesh.Mesh.fromMeshArn(this, 'imported-mesh', arn); + +// This VirtualNode resource can communicate with the resources in the mesh from different AWS IAM account ID. +new appmesh.VirtualNode(this, 'test-node', { + mesh: sharedMesh, +}); +``` diff --git a/packages/aws-cdk-lib/aws-appmesh/index.ts b/packages/aws-cdk-lib/aws-appmesh/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appmesh/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/gateway-route-spec.ts b/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/gateway-route-spec.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/gateway-route-spec.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/gateway-route.ts b/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/gateway-route.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/gateway-route.ts index 32a52acbe7bda..1d6d2a11e890b 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/gateway-route.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/gateway-route.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnGatewayRoute } from './appmesh.generated'; import { GatewayRouteSpec } from './gateway-route-spec'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/header-match.ts b/packages/aws-cdk-lib/aws-appmesh/lib/header-match.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/header-match.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/header-match.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/health-checks.ts b/packages/aws-cdk-lib/aws-appmesh/lib/health-checks.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/health-checks.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/health-checks.ts index 566c0acca912b..65b8d7333166c 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/health-checks.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/health-checks.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnVirtualGateway, CfnVirtualNode } from './appmesh.generated'; import { Protocol } from './shared-interfaces'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/http-route-method.ts b/packages/aws-cdk-lib/aws-appmesh/lib/http-route-method.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/http-route-method.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/http-route-method.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts b/packages/aws-cdk-lib/aws-appmesh/lib/http-route-path-match.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/http-route-path-match.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/index.ts b/packages/aws-cdk-lib/aws-appmesh/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/index.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/index.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/listener-tls-options.ts b/packages/aws-cdk-lib/aws-appmesh/lib/listener-tls-options.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/listener-tls-options.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/listener-tls-options.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/mesh.ts b/packages/aws-cdk-lib/aws-appmesh/lib/mesh.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/mesh.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/mesh.ts index a54689130fb63..a53e19b93e580 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/mesh.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/mesh.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnMesh } from './appmesh.generated'; import { MeshServiceDiscovery } from './service-discovery'; diff --git a/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts b/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts new file mode 100644 index 0000000000000..efae7a5f2ca06 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appmesh/lib/private/utils.ts @@ -0,0 +1,141 @@ +import { Token, TokenComparison } from '../../../core'; +import { Construct } from 'constructs'; +import { CfnVirtualNode } from '../appmesh.generated'; +import { GrpcGatewayRouteMatch } from '../gateway-route-spec'; +import { HeaderMatch } from '../header-match'; +import { ListenerTlsOptions } from '../listener-tls-options'; +import { QueryParameterMatch } from '../query-parameter-match'; +import { GrpcRouteMatch } from '../route-spec'; +import { TlsClientPolicy } from '../tls-client-policy'; + +/** + * Generated Connection pool config + */ +export interface ConnectionPoolConfig { + /** + * The maximum connections in the pool + * + * @default - none + */ + readonly maxConnections?: number; + + /** + * The maximum pending requests in the pool + * + * @default - none + */ + readonly maxPendingRequests?: number; + + /** + * The maximum requests in the pool + * + * @default - none + */ + readonly maxRequests?: number; +} + +/** + * This is the helper method to render TLS property of client policy. + */ +export function renderTlsClientPolicy(scope: Construct, tlsClientPolicy: TlsClientPolicy | undefined) + : CfnVirtualNode.ClientPolicyTlsProperty | undefined { + const certificate = tlsClientPolicy?.mutualTlsCertificate?.bind(scope).tlsCertificate; + const sans = tlsClientPolicy?.validation.subjectAlternativeNames; + + return tlsClientPolicy + ? { + certificate: certificate, + ports: tlsClientPolicy.ports, + enforce: tlsClientPolicy.enforce, + validation: { + subjectAlternativeNames: sans + ? { + match: sans.bind(scope).subjectAlternativeNamesMatch, + } + : undefined, + trust: tlsClientPolicy.validation.trust.bind(scope).tlsValidationTrust, + }, + } + : undefined; +} + +/** + * This is the helper method to render the TLS config for a listener. + */ +export function renderListenerTlsOptions(scope: Construct, listenerTls: ListenerTlsOptions | undefined) + : CfnVirtualNode.ListenerTlsProperty | undefined { + const tlsValidation = listenerTls?.mutualTlsValidation; + + return listenerTls + ? { + certificate: listenerTls.certificate.bind(scope).tlsCertificate, + mode: listenerTls.mode, + validation: tlsValidation + ? { + subjectAlternativeNames: tlsValidation.subjectAlternativeNames + ? { + match: tlsValidation.subjectAlternativeNames.bind(scope).subjectAlternativeNamesMatch, + } + : undefined, + trust: tlsValidation.trust.bind(scope).tlsValidationTrust, + } + : undefined, + } + : undefined; +} + +/** + * This is the helper method to populate mesh owner when it is a shared mesh scenario + */ +export function renderMeshOwner(resourceAccount: string, meshAccount: string) : string | undefined { + const comparison = Token.compareStrings(resourceAccount, meshAccount); + return comparison === TokenComparison.DIFFERENT || comparison === TokenComparison.ONE_UNRESOLVED + ? meshAccount + : undefined; +} + +/** + * This is the helper method to validate the length of HTTP match array when it is specified. + */ +export function validateHttpMatchArrayLength(headers?: HeaderMatch[], queryParameters?: QueryParameterMatch[]) { + const MIN_LENGTH = 1; + const MAX_LENGTH = 10; + + if (headers && (headers.length < MIN_LENGTH || headers.length > MAX_LENGTH)) { + throw new Error(`Number of headers provided for matching must be between ${MIN_LENGTH} and ${MAX_LENGTH}, got: ${headers.length}`); + } + + if (queryParameters && (queryParameters.length < MIN_LENGTH || queryParameters.length > MAX_LENGTH)) { + throw new Error(`Number of query parameters provided for matching must be between ${MIN_LENGTH} and ${MAX_LENGTH}, got: ${queryParameters.length}`); + } +} + +/** + * This is the helper method to validate the length of gRPC match array when it is specified. + */ +export function validateGrpcMatchArrayLength(metadata?: HeaderMatch[]): void { + const MIN_LENGTH = 1; + const MAX_LENGTH = 10; + + if (metadata && (metadata.length < MIN_LENGTH || metadata.length > MAX_LENGTH)) { + throw new Error(`Number of metadata provided for matching must be between ${MIN_LENGTH} and ${MAX_LENGTH}, got: ${metadata.length}`); + } +} + +/** + * This is the helper method to validate at least one of gRPC route match type is defined. + */ +export function validateGrpcRouteMatch(match: GrpcRouteMatch): void { + if (match.serviceName === undefined && match.metadata === undefined && match.methodName === undefined) { + throw new Error('At least one gRPC route match property must be provided'); + } +} + +/** + * This is the helper method to validate at least one of gRPC gateway route match type is defined. + */ +export function validateGrpcGatewayRouteMatch(match: GrpcGatewayRouteMatch): void { + if (match.serviceName === undefined && match.metadata === undefined && match.hostname === undefined) { + throw new Error('At least one gRPC gateway route match property beside rewriteRequestHostname must be provided'); + } +} diff --git a/packages/@aws-cdk/aws-appmesh/lib/query-parameter-match.ts b/packages/aws-cdk-lib/aws-appmesh/lib/query-parameter-match.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/query-parameter-match.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/query-parameter-match.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/route-spec.ts b/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/route-spec.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts index 0ef904e03af24..82c685ed3d59f 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/route-spec.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/route-spec.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnRoute } from './appmesh.generated'; import { HeaderMatch } from './header-match'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/route.ts b/packages/aws-cdk-lib/aws-appmesh/lib/route.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/route.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/route.ts index 3e604f6d97511..87ce596394658 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/route.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/route.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnRoute } from './appmesh.generated'; import { IMesh } from './mesh'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/service-discovery.ts b/packages/aws-cdk-lib/aws-appmesh/lib/service-discovery.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/lib/service-discovery.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/service-discovery.ts index 660e3aeb7ca05..60a1443a2ea52 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/service-discovery.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/service-discovery.ts @@ -1,4 +1,4 @@ -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; +import * as cloudmap from '../../aws-servicediscovery'; import { Construct } from 'constructs'; import { CfnVirtualNode } from './appmesh.generated'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/shared-interfaces.ts b/packages/aws-cdk-lib/aws-appmesh/lib/shared-interfaces.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/shared-interfaces.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/shared-interfaces.ts index 3efd50f7a7f38..02d6a5a3beb0a 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/shared-interfaces.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/shared-interfaces.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnVirtualGateway, CfnVirtualNode } from './appmesh.generated'; import { renderTlsClientPolicy } from './private/utils'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts b/packages/aws-cdk-lib/aws-appmesh/lib/tls-certificate.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/tls-certificate.ts index d9ed5e8c5d4ac..8fa908deb6b36 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/tls-certificate.ts @@ -1,4 +1,4 @@ -import * as acm from '@aws-cdk/aws-certificatemanager'; +import * as acm from '../../aws-certificatemanager'; import { Construct } from 'constructs'; import { CfnVirtualNode } from './appmesh.generated'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/tls-client-policy.ts b/packages/aws-cdk-lib/aws-appmesh/lib/tls-client-policy.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/tls-client-policy.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/tls-client-policy.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts b/packages/aws-cdk-lib/aws-appmesh/lib/tls-validation.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/tls-validation.ts index 9bf566c0d4843..4660254ba25ba 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/tls-validation.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/tls-validation.ts @@ -1,4 +1,4 @@ -import * as acmpca from '@aws-cdk/aws-acmpca'; +import * as acmpca from '../../aws-acmpca'; import { Construct } from 'constructs'; import { CfnVirtualNode } from './appmesh.generated'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-gateway-listener.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-gateway-listener.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-gateway-listener.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-gateway-listener.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-gateway.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-gateway.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-gateway.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-gateway.ts index a99f014df8c63..471327514b404 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-gateway.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-gateway.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnVirtualGateway } from './appmesh.generated'; import { GatewayRoute, GatewayRouteBaseProps } from './gateway-route'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-node-listener.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-node-listener.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-node-listener.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-node-listener.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-node.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-node.ts index c2dda44d7a7de..afef440db094a 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-node.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-node.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnVirtualNode } from './appmesh.generated'; import { IMesh, Mesh } from './mesh'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-router-listener.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-router-listener.ts similarity index 100% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-router-listener.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-router-listener.ts diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-router.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-router.ts index f5dda554bd387..00373de19f99d 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-router.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-router.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnVirtualRouter } from './appmesh.generated'; import { IMesh, Mesh } from './mesh'; diff --git a/packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-service.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts rename to packages/aws-cdk-lib/aws-appmesh/lib/virtual-service.ts index 8dc31c2a56f66..4cddf68108057 100644 --- a/packages/@aws-cdk/aws-appmesh/lib/virtual-service.ts +++ b/packages/aws-cdk-lib/aws-appmesh/lib/virtual-service.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnVirtualService } from './appmesh.generated'; import { IMesh, Mesh } from './mesh'; diff --git a/packages/@aws-cdk/aws-appmesh/test/gateway-route.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/test/gateway-route.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts index 63516490d37a8..7854662ada55e 100644 --- a/packages/@aws-cdk/aws-appmesh/test/gateway-route.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/gateway-route.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('gateway route', () => { diff --git a/packages/@aws-cdk/aws-appmesh/test/health-check.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/health-check.test.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/test/health-check.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/health-check.test.ts index ebc78039d8cc4..3c1b5b7eed662 100644 --- a/packages/@aws-cdk/aws-appmesh/test/health-check.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/health-check.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; let idCounter = 0; diff --git a/packages/@aws-cdk/aws-appmesh/test/mesh.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/mesh.test.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/test/mesh.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/mesh.test.ts index 7969720001186..9074fcf040bb4 100644 --- a/packages/@aws-cdk/aws-appmesh/test/mesh.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/mesh.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cloudmap from '../../aws-servicediscovery'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('mesh', () => { diff --git a/packages/@aws-cdk/aws-appmesh/test/route.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/route.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/test/route.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/route.test.ts index 513e15c3356cd..95e7f1f285634 100644 --- a/packages/@aws-cdk/aws-appmesh/test/route.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/route.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('route', () => { diff --git a/packages/@aws-cdk/aws-appmesh/test/virtual-gateway.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/virtual-gateway.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/test/virtual-gateway.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/virtual-gateway.test.ts index eadfebec29493..8469daad9437c 100644 --- a/packages/@aws-cdk/aws-appmesh/test/virtual-gateway.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/virtual-gateway.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('virtual gateway', () => { diff --git a/packages/@aws-cdk/aws-appmesh/test/virtual-node.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/virtual-node.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/test/virtual-node.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/virtual-node.test.ts index 24712b76d99e6..f0aaac93c11d6 100644 --- a/packages/@aws-cdk/aws-appmesh/test/virtual-node.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/virtual-node.test.ts @@ -1,10 +1,10 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acmpca from '@aws-cdk/aws-acmpca'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as acmpca from '../../aws-acmpca'; +import * as acm from '../../aws-certificatemanager'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as cloudmap from '../../aws-servicediscovery'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('virtual node', () => { diff --git a/packages/@aws-cdk/aws-appmesh/test/virtual-router.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/virtual-router.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appmesh/test/virtual-router.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/virtual-router.test.ts index 24df84fd051ad..44774de4a8ea7 100644 --- a/packages/@aws-cdk/aws-appmesh/test/virtual-router.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/virtual-router.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('virtual router', () => { diff --git a/packages/@aws-cdk/aws-appmesh/test/virtual-service.test.ts b/packages/aws-cdk-lib/aws-appmesh/test/virtual-service.test.ts similarity index 98% rename from packages/@aws-cdk/aws-appmesh/test/virtual-service.test.ts rename to packages/aws-cdk-lib/aws-appmesh/test/virtual-service.test.ts index 2cec646ed7377..fae6a3b84dc84 100644 --- a/packages/@aws-cdk/aws-appmesh/test/virtual-service.test.ts +++ b/packages/aws-cdk-lib/aws-appmesh/test/virtual-service.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as appmesh from '../lib'; describe('virtual service', () => { diff --git a/packages/aws-cdk-lib/aws-apprunner/.jsiirc.json b/packages/aws-cdk-lib/aws-apprunner/.jsiirc.json new file mode 100644 index 0000000000000..7743d9a4cefe4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apprunner/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppRunner" + }, + "java": { + "package": "software.amazon.awscdk.services.apprunner" + }, + "python": { + "module": "aws_cdk.aws_apprunner" + } + } +} diff --git a/packages/aws-cdk-lib/aws-apprunner/README.md b/packages/aws-cdk-lib/aws-apprunner/README.md new file mode 100644 index 0000000000000..64f27382f6459 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apprunner/README.md @@ -0,0 +1,32 @@ +# AWS::AppRunner Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as apprunner from 'aws-cdk-lib/aws-apprunner'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AppRunner construct libraries](https://constructs.dev/search?q=apprunner) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppRunner resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppRunner.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-apprunner-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppRunner](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppRunner.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-apprunner/index.ts b/packages/aws-cdk-lib/aws-apprunner/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-apprunner/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-apprunner/lib/index.ts b/packages/aws-cdk-lib/aws-apprunner/lib/index.ts new file mode 100644 index 0000000000000..92bf32d34bdb7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apprunner/lib/index.ts @@ -0,0 +1 @@ +export * from './apprunner.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appstream/.jsiirc.json b/packages/aws-cdk-lib/aws-appstream/.jsiirc.json new file mode 100644 index 0000000000000..19fc11b9749b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appstream/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppStream" + }, + "java": { + "package": "software.amazon.awscdk.services.appstream" + }, + "python": { + "module": "aws_cdk.aws_appstream" + } + } +} diff --git a/packages/aws-cdk-lib/aws-appstream/README.md b/packages/aws-cdk-lib/aws-appstream/README.md new file mode 100644 index 0000000000000..ff75ea53a9b40 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appstream/README.md @@ -0,0 +1,27 @@ +# Amazon AppStream 2.0 Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as appstream from 'aws-cdk-lib/aws-appstream'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AppStream construct libraries](https://constructs.dev/search?q=appstream) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AppStream resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppStream.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AppStream](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AppStream.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-appstream/index.ts b/packages/aws-cdk-lib/aws-appstream/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appstream/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-appstream/lib/index.ts b/packages/aws-cdk-lib/aws-appstream/lib/index.ts new file mode 100644 index 0000000000000..e07691eded13e --- /dev/null +++ b/packages/aws-cdk-lib/aws-appstream/lib/index.ts @@ -0,0 +1 @@ +export * from './appstream.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appsync/.gitignore b/packages/aws-cdk-lib/aws-appsync/.gitignore new file mode 100644 index 0000000000000..fe8dff7095004 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/.gitignore @@ -0,0 +1,2 @@ +!test/verify/**/*.js +!test/integ-assets/**/*.js diff --git a/packages/aws-cdk-lib/aws-appsync/.jsiirc.json b/packages/aws-cdk-lib/aws-appsync/.jsiirc.json new file mode 100644 index 0000000000000..211b5ef5dd254 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.appsync" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.AppSync" + }, + "python": { + "module": "aws_cdk.aws_appsync" + } + } +} diff --git a/packages/aws-cdk-lib/aws-appsync/README.md b/packages/aws-cdk-lib/aws-appsync/README.md new file mode 100644 index 0000000000000..5ba37810dc3cd --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/README.md @@ -0,0 +1,569 @@ +# AWS AppSync Construct Library + + +The `@aws-cdk/aws-appsync` package contains constructs for building flexible +APIs that use GraphQL. + +```ts nofixture +import * as appsync from 'aws-cdk-lib/aws-appsync'; +``` + +## Example + +### DynamoDB + +Example of a GraphQL API with `AWS_IAM` [authorization](#authorization) resolving into a DynamoDb +backend data source. + +GraphQL schema file `schema.graphql`: + +```gql +type demo { + id: String! + version: String! +} +type Query { + getDemos: [ demo! ] +} +input DemoInput { + version: String! +} +type Mutation { + addDemo(input: DemoInput!): demo +} +``` + +CDK stack file `app-stack.ts`: + +```ts +const api = new appsync.GraphqlApi(this, 'Api', { + name: 'demo', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: appsync.AuthorizationType.IAM, + }, + }, + xrayEnabled: true, +}); + +const demoTable = new dynamodb.Table(this, 'DemoTable', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, +}); + +const demoDS = api.addDynamoDbDataSource('demoDataSource', demoTable); + +// Resolver for the Query "getDemos" that scans the DynamoDb table and returns the entire list. +// Resolver Mapping Template Reference: +// https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html +demoDS.createResolver('QueryGetDemosResolver', { + typeName: 'Query', + fieldName: 'getDemos', + requestMappingTemplate: appsync.MappingTemplate.dynamoDbScanTable(), + responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), +}); + +// Resolver for the Mutation "addDemo" that puts the item into the DynamoDb table. +demoDS.createResolver('MutationAddDemoResolver', { + typeName: 'Mutation', + fieldName: 'addDemo', + requestMappingTemplate: appsync.MappingTemplate.dynamoDbPutItem( + appsync.PrimaryKey.partition('id').auto(), + appsync.Values.projecting('input'), + ), + responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultItem(), +}); + +//To enable DynamoDB read consistency with the `MappingTemplate`: +demoDS.createResolver('QueryGetDemosConsistentResolver', { + typeName: 'Query', + fieldName: 'getDemosConsistent', + requestMappingTemplate: appsync.MappingTemplate.dynamoDbScanTable(true), + responseMappingTemplate: appsync.MappingTemplate.dynamoDbResultList(), +}); +``` + + + +### Aurora Serverless + +AppSync provides a data source for executing SQL commands against Amazon Aurora +Serverless clusters. You can use AppSync resolvers to execute SQL statements +against the Data API with GraphQL queries, mutations, and subscriptions. + +```ts +// Create username and password secret for DB Cluster +const secret = new rds.DatabaseSecret(this, 'AuroraSecret', { + username: 'clusteradmin', +}); + +// The VPC to place the cluster in +const vpc = new ec2.Vpc(this, 'AuroraVpc'); + +// Create the serverless cluster, provide all values needed to customise the database. +const cluster = new rds.ServerlessCluster(this, 'AuroraCluster', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + vpc, + credentials: { username: 'clusteradmin' }, + clusterIdentifier: 'db-endpoint-test', + defaultDatabaseName: 'demos', +}); + +// Build a data source for AppSync to access the database. +declare const api: appsync.GraphqlApi; +const rdsDS = api.addRdsDataSource('rds', cluster, secret, 'demos'); + +// Set up a resolver for an RDS query. +rdsDS.createResolver('QueryGetDemosRdsResolver', { + typeName: 'Query', + fieldName: 'getDemosRds', + requestMappingTemplate: appsync.MappingTemplate.fromString(` + { + "version": "2018-05-29", + "statements": [ + "SELECT * FROM demos" + ] + } + `), + responseMappingTemplate: appsync.MappingTemplate.fromString(` + $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) + `), +}); + +// Set up a resolver for an RDS mutation. +rdsDS.createResolver('MutationAddDemoRdsResolver', { + typeName: 'Mutation', + fieldName: 'addDemoRds', + requestMappingTemplate: appsync.MappingTemplate.fromString(` + { + "version": "2018-05-29", + "statements": [ + "INSERT INTO demos VALUES (:id, :version)", + "SELECT * WHERE id = :id" + ], + "variableMap": { + ":id": $util.toJson($util.autoId()), + ":version": $util.toJson($ctx.args.version) + } + } + `), + responseMappingTemplate: appsync.MappingTemplate.fromString(` + $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0]) + `), +}); +``` + +### HTTP Endpoints + +GraphQL schema file `schema.graphql`: + +```gql +type job { + id: String! + version: String! +} + +input DemoInput { + version: String! +} + +type Mutation { + callStepFunction(input: DemoInput!): job +} +``` + +GraphQL request mapping template `request.vtl`: + +```json +{ + "version": "2018-05-29", + "method": "POST", + "resourcePath": "/", + "params": { + "headers": { + "content-type": "application/x-amz-json-1.0", + "x-amz-target":"AWSStepFunctions.StartExecution" + }, + "body": { + "stateMachineArn": "", + "input": "{ \"id\": \"$context.arguments.id\" }" + } + } +} +``` + +GraphQL response mapping template `response.vtl`: + +```json +{ + "id": "${context.result.id}" +} +``` + +CDK stack file `app-stack.ts`: + +```ts +const api = new appsync.GraphqlApi(this, 'api', { + name: 'api', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphql')), +}); + +const httpDs = api.addHttpDataSource( + 'ds', + 'https://states.amazonaws.com', + { + name: 'httpDsWithStepF', + description: 'from appsync to StepFunctions Workflow', + authorizationConfig: { + signingRegion: 'us-east-1', + signingServiceName: 'states', + } + } +); + +httpDs.createResolver('MutationCallStepFunctionResolver', { + typeName: 'Mutation', + fieldName: 'callStepFunction', + requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'), + responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'), +}); +``` + +### Amazon OpenSearch Service + +AppSync has builtin support for Amazon OpenSearch Service (successor to Amazon +Elasticsearch Service) from domains that are provisioned through your AWS account. You can +use AppSync resolvers to perform GraphQL operations such as queries, mutations, and +subscriptions. + +```ts +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; + +const user = new iam.User(this, 'User'); +const domain = new opensearch.Domain(this, 'Domain', { + version: opensearch.EngineVersion.OPENSEARCH_2_3, + removalPolicy: RemovalPolicy.DESTROY, + fineGrainedAccessControl: { masterUserArn: user.userArn }, + encryptionAtRest: { enabled: true }, + nodeToNodeEncryption: true, + enforceHttps: true, +}); + +declare const api: appsync.GraphqlApi; +const ds = api.addOpenSearchDataSource('ds', domain); + +ds.createResolver('QueryGetTestsResolver', { + typeName: 'Query', + fieldName: 'getTests', + requestMappingTemplate: appsync.MappingTemplate.fromString(JSON.stringify({ + version: '2017-02-28', + operation: 'GET', + path: '/id/post/_search', + params: { + headers: {}, + queryString: {}, + body: { from: 0, size: 50 }, + }, + })), + responseMappingTemplate: appsync.MappingTemplate.fromString(`[ + #foreach($entry in $context.result.hits.hits) + #if( $velocityCount > 1 ) , #end + $utils.toJson($entry.get("_source")) + #end + ]`), +}); +``` + +## Custom Domain Names + +For many use cases you may want to associate a custom domain name with your +GraphQL API. This can be done during the API creation. + +```ts +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import * as route53 from 'aws-cdk-lib/aws-route53'; + +const myDomainName = 'api.example.com'; +const certificate = new acm.Certificate(this, 'cert', { domainName: myDomainName }); +const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' }) +const api = new appsync.GraphqlApi(this, 'api', { + name: 'myApi', + schema, + domainName: { + certificate, + domainName: myDomainName, + }, +}); + +// hosted zone and route53 features +declare const hostedZoneId: string; +declare const zoneName = 'example.com'; + +// hosted zone for adding appsync domain +const zone = route53.HostedZone.fromHostedZoneAttributes(this, `HostedZone`, { + hostedZoneId, + zoneName, +}); + +// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net +new route53.CnameRecord(this, `CnameApiRecord`, { + recordName: 'api', + zone, + domainName: api.appSyncDomainName, +}); +``` + +## Log Group + +AppSync automatically create a log group with the name `/aws/appsync/apis/` upon deployment with +log data set to never expire. If you want to set a different expiration period, use the `logConfig.retention` property. + +To obtain the GraphQL API's log group as a `logs.ILogGroup` use the `logGroup` property of the +`GraphqlApi` construct. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; + +const logConfig: appsync.LogConfig = { + retention: logs.RetentionDays.ONE_WEEK, +}; + +new appsync.GraphqlApi(this, 'api', { + authorizationConfig: {}, + name: 'myApi', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'myApi.graphql')), + logConfig, +}); +``` + +## Schema + +You can define a schema using from a local file using `SchemaFile.fromAsset` + +```ts +const api = new appsync.GraphqlApi(this, 'api', { + name: 'myApi', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphl')), +}); +``` + +### ISchema + +Alternative schema sources can be defined by implementing the `ISchema` +interface. An example of this is the `CodeFirstSchema` class provided in +[awscdk-appsync-utils](https://github.com/cdklabs/awscdk-appsync-utils) + +## Imports + +Any GraphQL Api that has been created outside the stack can be imported from +another stack into your CDK app. Utilizing the `fromXxx` function, you have +the ability to add data sources and resolvers through a `IGraphqlApi` interface. + +```ts +declare const api: appsync.GraphqlApi; +declare const table: dynamodb.Table; +const importedApi = appsync.GraphqlApi.fromGraphqlApiAttributes(this, 'IApi', { + graphqlApiId: api.apiId, + graphqlApiArn: api.arn, +}); +importedApi.addDynamoDbDataSource('TableDataSource', table); +``` + +If you don't specify `graphqlArn` in `fromXxxAttributes`, CDK will autogenerate +the expected `arn` for the imported api, given the `apiId`. For creating data +sources and resolvers, an `apiId` is sufficient. + +## Authorization + +There are multiple authorization types available for GraphQL API to cater to different +access use cases. They are: + +- API Keys (`AuthorizationType.API_KEY`) +- Amazon Cognito User Pools (`AuthorizationType.USER_POOL`) +- OpenID Connect (`AuthorizationType.OPENID_CONNECT`) +- AWS Identity and Access Management (`AuthorizationType.AWS_IAM`) +- AWS Lambda (`AuthorizationType.AWS_LAMBDA`) + +These types can be used simultaneously in a single API, allowing different types of clients to +access data. When you specify an authorization type, you can also specify the corresponding +authorization mode to finish defining your authorization. For example, this is a GraphQL API +with AWS Lambda Authorization. + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; +declare const authFunction: lambda.Function; + +new appsync.GraphqlApi(this, 'api', { + name: 'api', + schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'appsync.test.graphql')), + authorizationConfig: { + defaultAuthorization: { + authorizationType: appsync.AuthorizationType.LAMBDA, + lambdaAuthorizerConfig: { + handler: authFunction, + // can also specify `resultsCacheTtl` and `validationRegex`. + }, + }, + }, +}); +``` + +## Permissions + +When using `AWS_IAM` as the authorization type for GraphQL API, an IAM Role +with correct permissions must be used for access to API. + +When configuring permissions, you can specify specific resources to only be +accessible by `IAM` authorization. For example, if you want to only allow mutability +for `IAM` authorized access you would configure the following. + +In `schema.graphql`: + +```gql +type Mutation { + updateExample(...): ... + @aws_iam +} +``` + +In `IAM`: + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "appsync:GraphQL" + ], + "Resource": [ + "arn:aws:appsync:REGION:ACCOUNT_ID:apis/GRAPHQL_ID/types/Mutation/fields/updateExample" + ] + } + ] +} +``` + +See [documentation](https://docs.aws.amazon.com/appsync/latest/devguide/security.html#aws-iam-authorization) for more details. + +To make this easier, CDK provides `grant` API. + +Use the `grant` function for more granular authorization. + +```ts +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); +declare const api: appsync.GraphqlApi; + +api.grant(role, appsync.IamResource.custom('types/Mutation/fields/updateExample'), 'appsync:GraphQL'); +``` + +### IamResource + +In order to use the `grant` functions, you need to use the class `IamResource`. + +- `IamResource.custom(...arns)` permits custom ARNs and requires an argument. + +- `IamResouce.ofType(type, ...fields)` permits ARNs for types and their fields. + +- `IamResource.all()` permits ALL resources. + +### Generic Permissions + +Alternatively, you can use more generic `grant` functions to accomplish the same usage. + +These include: + +- grantMutation (use to grant access to Mutation fields) +- grantQuery (use to grant access to Query fields) +- grantSubscription (use to grant access to Subscription fields) + +```ts +declare const api: appsync.GraphqlApi; +declare const role: iam.Role; + +// For generic types +api.grantMutation(role, 'updateExample'); + +// For custom types and granular design +api.grant(role, appsync.IamResource.ofType('Mutation', 'updateExample'), 'appsync:GraphQL'); +``` + +## Pipeline Resolvers and AppSync Functions + +AppSync Functions are local functions that perform certain operations onto a +backend data source. Developers can compose operations (Functions) and execute +them in sequence with Pipeline Resolvers. + +```ts +declare const api: appsync.GraphqlApi; + +const appsyncFunction = new appsync.AppsyncFunction(this, 'function', { + name: 'appsync_function', + api, + dataSource: api.addNoneDataSource('none'), + requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'), + responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'), +}); +``` + +AppSync Functions are used in tandem with pipeline resolvers to compose multiple +operations. + +```ts +declare const api: appsync.GraphqlApi; +declare const appsyncFunction: appsync.AppsyncFunction; + +const pipelineResolver = new appsync.Resolver(this, 'pipeline', { + api, + dataSource: api.addNoneDataSource('none'), + typeName: 'typeName', + fieldName: 'fieldName', + requestMappingTemplate: appsync.MappingTemplate.fromFile('beforeRequest.vtl'), + pipelineConfig: [appsyncFunction], + responseMappingTemplate: appsync.MappingTemplate.fromFile('afterResponse.vtl'), +}); +``` + +### JS Functions and Resolvers + +JS Functions and resolvers are also supported. You can use a `.js` file within your CDK project, or specify your function code inline. + +```ts +declare const api: appsync.GraphqlApi; + +const myJsFunction = new appsync.AppsyncFunction(this, 'function', { + name: 'my_js_function', + api, + dataSource: api.addNoneDataSource('none'), + code: appsync.Code.fromAsset('directory/function_code.js'), + runtime: appsync.FunctionRuntime.JS_1_0_0, +}); + +new appsync.Resolver(this, 'PipelineResolver', { + api, + typeName: 'typeName', + fieldName: 'fieldName', + code: appsync.Code.fromInline(` + // The before step + export function request(...args) { + console.log(args); + return {} + } + + // The after step + export function response(ctx) { + return ctx.prev.result + } + `), + runtime: appsync.FunctionRuntime.JS_1_0_0, + pipelineConfig: [myJsFunction], +}); +``` + +Learn more about Pipeline Resolvers and AppSync Functions [here](https://docs.aws.amazon.com/appsync/latest/devguide/pipeline-resolvers.html). diff --git a/packages/aws-cdk-lib/aws-appsync/index.ts b/packages/aws-cdk-lib/aws-appsync/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-appsync/lib/appsync-function.ts b/packages/aws-cdk-lib/aws-appsync/lib/appsync-function.ts similarity index 98% rename from packages/@aws-cdk/aws-appsync/lib/appsync-function.ts rename to packages/aws-cdk-lib/aws-appsync/lib/appsync-function.ts index 1153a3aed85ec..cd4bd16c0ce82 100644 --- a/packages/@aws-cdk/aws-appsync/lib/appsync-function.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/appsync-function.ts @@ -1,4 +1,4 @@ -import { Resource, IResource, Lazy, Fn } from '@aws-cdk/core'; +import { Resource, IResource, Lazy, Fn } from '../../core'; import { Construct } from 'constructs'; import { CfnFunctionConfiguration } from './appsync.generated'; import { Code } from './code'; diff --git a/packages/@aws-cdk/aws-appsync/lib/caching-config.ts b/packages/aws-cdk-lib/aws-appsync/lib/caching-config.ts similarity index 92% rename from packages/@aws-cdk/aws-appsync/lib/caching-config.ts rename to packages/aws-cdk-lib/aws-appsync/lib/caching-config.ts index d02a393cc53c0..3e23381058349 100644 --- a/packages/@aws-cdk/aws-appsync/lib/caching-config.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/caching-config.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../core'; /** * CachingConfig for AppSync resolvers diff --git a/packages/@aws-cdk/aws-appsync/lib/caching-key.ts b/packages/aws-cdk-lib/aws-appsync/lib/caching-key.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/caching-key.ts rename to packages/aws-cdk-lib/aws-appsync/lib/caching-key.ts diff --git a/packages/aws-cdk-lib/aws-appsync/lib/code.ts b/packages/aws-cdk-lib/aws-appsync/lib/code.ts new file mode 100644 index 0000000000000..a0775c40b93be --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/lib/code.ts @@ -0,0 +1,98 @@ +import * as s3_assets from '../../aws-s3-assets'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; + +/** + * Result of binding `Code` into a `Function`. + */ +export interface CodeConfig { + /** + * The location of the code in S3 (mutually exclusive with `inlineCode`. + * @default - code is not an s3 location + */ + readonly s3Location?: string; + + /** + * Inline code (mutually exclusive with `s3Location`). + * @default - code is not inline code + */ + readonly inlineCode?: string; +} + +/** + * Represents source code for an AppSync Function or Resolver. + */ +export abstract class Code { + /** + * Loads the function code from a local disk path. + * + * @param path The path to the source code file. + */ + public static fromAsset(path: string, options?: s3_assets.AssetOptions): AssetCode { + return new AssetCode(path, options); + } + + /** + * Inline code for AppSync function + * @returns `InlineCode` with inline code. + * @param code The actual handler code (limited to 4KiB) + */ + public static fromInline(code: string): InlineCode { + return new InlineCode(code); + } + + /** + * Bind source code to an AppSync Function or resolver. + */ + public abstract bind(scope: Construct): CodeConfig; +} + +/** + * Represents a local file with source code used for an AppSync Function or Resolver. + */ +export class AssetCode extends Code { + private asset?: s3_assets.Asset; + + /** + * @param path The path to the asset file. + */ + constructor(public readonly path: string, private readonly options: s3_assets.AssetOptions = { }) { + super(); + } + + public bind(scope: Construct): CodeConfig { + // If the same AssetCode is used multiple times, retain only the first instantiation. + if (!this.asset) { + this.asset = new s3_assets.Asset(scope, 'Code', { + path: this.path, + ...this.options, + }); + } else if (cdk.Stack.of(this.asset) !== cdk.Stack.of(scope)) { + throw new Error(`Asset is already associated with another stack '${cdk.Stack.of(this.asset).stackName}'. ` + + 'Create a new Code instance for every stack.'); + } + + return { + s3Location: this.asset.s3ObjectUrl, + }; + } +} + +/** + * AppSync function code from an inline string. + */ +export class InlineCode extends Code { + constructor(private code: string) { + super(); + + if (code.length === 0) { + throw new Error('AppSync Inline code cannot be empty'); + } + } + + public bind(_scope: Construct): CodeConfig { + return { + inlineCode: this.code, + }; + } +} diff --git a/packages/@aws-cdk/aws-appsync/lib/data-source.ts b/packages/aws-cdk-lib/aws-appsync/lib/data-source.ts similarity index 96% rename from packages/@aws-cdk/aws-appsync/lib/data-source.ts rename to packages/aws-cdk-lib/aws-appsync/lib/data-source.ts index 3e4f9afe1c1e7..32d285de99c17 100644 --- a/packages/@aws-cdk/aws-appsync/lib/data-source.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/data-source.ts @@ -1,11 +1,11 @@ -import { ITable } from '@aws-cdk/aws-dynamodb'; -import { IDomain as IElasticsearchDomain } from '@aws-cdk/aws-elasticsearch'; -import { Grant, IGrantable, IPrincipal, IRole, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { IDomain as IOpenSearchDomain } from '@aws-cdk/aws-opensearchservice'; -import { IServerlessCluster } from '@aws-cdk/aws-rds'; -import { ISecret } from '@aws-cdk/aws-secretsmanager'; -import { IResolvable, Lazy, Stack, Token } from '@aws-cdk/core'; +import { ITable } from '../../aws-dynamodb'; +import { IDomain as IElasticsearchDomain } from '../../aws-elasticsearch'; +import { Grant, IGrantable, IPrincipal, IRole, Role, ServicePrincipal } from '../../aws-iam'; +import { IFunction } from '../../aws-lambda'; +import { IDomain as IOpenSearchDomain } from '../../aws-opensearchservice'; +import { IServerlessCluster } from '../../aws-rds'; +import { ISecret } from '../../aws-secretsmanager'; +import { IResolvable, Lazy, Stack, Token } from '../../core'; import { Construct } from 'constructs'; import { BaseAppsyncFunctionProps, AppsyncFunction } from './appsync-function'; import { CfnDataSource } from './appsync.generated'; diff --git a/packages/@aws-cdk/aws-appsync/lib/graphqlapi-base.ts b/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi-base.ts similarity index 95% rename from packages/@aws-cdk/aws-appsync/lib/graphqlapi-base.ts rename to packages/aws-cdk-lib/aws-appsync/lib/graphqlapi-base.ts index 4823837757883..c13ba65f983c0 100644 --- a/packages/@aws-cdk/aws-appsync/lib/graphqlapi-base.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi-base.ts @@ -1,10 +1,10 @@ -import { ITable } from '@aws-cdk/aws-dynamodb'; -import { IDomain as IElasticsearchDomain } from '@aws-cdk/aws-elasticsearch'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { IDomain as IOpenSearchDomain } from '@aws-cdk/aws-opensearchservice'; -import { IServerlessCluster } from '@aws-cdk/aws-rds'; -import { ISecret } from '@aws-cdk/aws-secretsmanager'; -import { CfnResource, IResource, Resource } from '@aws-cdk/core'; +import { ITable } from '../../aws-dynamodb'; +import { IDomain as IElasticsearchDomain } from '../../aws-elasticsearch'; +import { IFunction } from '../../aws-lambda'; +import { IDomain as IOpenSearchDomain } from '../../aws-opensearchservice'; +import { IServerlessCluster } from '../../aws-rds'; +import { ISecret } from '../../aws-secretsmanager'; +import { CfnResource, IResource, Resource } from '../../core'; import { DynamoDbDataSource, HttpDataSource, LambdaDataSource, NoneDataSource, RdsDataSource, AwsIamConfig, ElasticsearchDataSource, OpenSearchDataSource } from './data-source'; import { Resolver, ExtendedResolverProps } from './resolver'; diff --git a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts b/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi.ts similarity index 98% rename from packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts rename to packages/aws-cdk-lib/aws-appsync/lib/graphqlapi.ts index 00d4f2a0159df..dc227286f99b9 100644 --- a/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi.ts @@ -1,9 +1,9 @@ -import { ICertificate } from '@aws-cdk/aws-certificatemanager'; -import { IUserPool } from '@aws-cdk/aws-cognito'; -import { ManagedPolicy, Role, IRole, ServicePrincipal, Grant, IGrantable } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { ILogGroup, LogGroup, LogRetention, RetentionDays } from '@aws-cdk/aws-logs'; -import { ArnFormat, CfnResource, Duration, Expiration, IResolvable, Stack } from '@aws-cdk/core'; +import { ICertificate } from '../../aws-certificatemanager'; +import { IUserPool } from '../../aws-cognito'; +import { ManagedPolicy, Role, IRole, ServicePrincipal, Grant, IGrantable } from '../../aws-iam'; +import { IFunction } from '../../aws-lambda'; +import { ILogGroup, LogGroup, LogRetention, RetentionDays } from '../../aws-logs'; +import { ArnFormat, CfnResource, Duration, Expiration, IResolvable, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnApiKey, CfnGraphQLApi, CfnGraphQLSchema, CfnDomainName, CfnDomainNameApiAssociation } from './appsync.generated'; import { IGraphqlApi, GraphqlApiBase } from './graphqlapi-base'; diff --git a/packages/@aws-cdk/aws-appsync/lib/index.ts b/packages/aws-cdk-lib/aws-appsync/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/index.ts rename to packages/aws-cdk-lib/aws-appsync/lib/index.ts diff --git a/packages/@aws-cdk/aws-appsync/lib/key.ts b/packages/aws-cdk-lib/aws-appsync/lib/key.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/key.ts rename to packages/aws-cdk-lib/aws-appsync/lib/key.ts diff --git a/packages/@aws-cdk/aws-appsync/lib/mapping-template.ts b/packages/aws-cdk-lib/aws-appsync/lib/mapping-template.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/mapping-template.ts rename to packages/aws-cdk-lib/aws-appsync/lib/mapping-template.ts diff --git a/packages/@aws-cdk/aws-appsync/lib/private.ts b/packages/aws-cdk-lib/aws-appsync/lib/private.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/private.ts rename to packages/aws-cdk-lib/aws-appsync/lib/private.ts diff --git a/packages/@aws-cdk/aws-appsync/lib/resolver.ts b/packages/aws-cdk-lib/aws-appsync/lib/resolver.ts similarity index 99% rename from packages/@aws-cdk/aws-appsync/lib/resolver.ts rename to packages/aws-cdk-lib/aws-appsync/lib/resolver.ts index 1c12438fe692d..700c4eae810cb 100644 --- a/packages/@aws-cdk/aws-appsync/lib/resolver.ts +++ b/packages/aws-cdk-lib/aws-appsync/lib/resolver.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; import { Construct } from 'constructs'; import { IAppsyncFunction } from './appsync-function'; import { CfnResolver } from './appsync.generated'; diff --git a/packages/@aws-cdk/aws-appsync/lib/runtime.ts b/packages/aws-cdk-lib/aws-appsync/lib/runtime.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/runtime.ts rename to packages/aws-cdk-lib/aws-appsync/lib/runtime.ts diff --git a/packages/@aws-cdk/aws-appsync/lib/schema.ts b/packages/aws-cdk-lib/aws-appsync/lib/schema.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/lib/schema.ts rename to packages/aws-cdk-lib/aws-appsync/lib/schema.ts diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-auth.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-auth.test.ts index e46494ce563fc..a6600c2912083 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-auth.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-auth.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as cognito from '@aws-cdk/aws-cognito'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cognito from '../../aws-cognito'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-caching-config.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-caching-config.test.ts similarity index 95% rename from packages/@aws-cdk/aws-appsync/test/appsync-caching-config.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-caching-config.test.ts index 43dc85a9b1fd5..918beab56a1cb 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-caching-config.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-caching-config.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; +import { Duration } from '../../core'; import * as appsync from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-domain.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-domain.test.ts similarity index 90% rename from packages/@aws-cdk/aws-appsync/test/appsync-domain.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-domain.test.ts index aac7539679b4a..218ffa47caf8f 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-domain.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-domain.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import { Certificate } from '../../aws-certificatemanager'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts similarity index 98% rename from packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts index d49dfffa61ffa..1b64a62e04732 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-dynamodb.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-dynamodb.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as db from '@aws-cdk/aws-dynamodb'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as db from '../../aws-dynamodb'; +import * as cdk from '../../core'; import * as appsync from '../lib'; import { KeyCondition } from '../lib'; diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-elasticsearch.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-elasticsearch.test.ts similarity index 97% rename from packages/@aws-cdk/aws-appsync/test/appsync-elasticsearch.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-elasticsearch.test.ts index 86dbf19885546..6d0fda9e67fa0 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-elasticsearch.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-elasticsearch.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as es from '@aws-cdk/aws-elasticsearch'; +import { Template } from '../../assertions'; +import * as es from '../../aws-elasticsearch'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-grant.test.ts similarity index 99% rename from packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-grant.test.ts index 0b95a93bc9947..e6ad4a1741238 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-grant.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-grant.test.ts @@ -1,7 +1,7 @@ import { join } from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as appsync from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-http.test.ts similarity index 97% rename from packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-http.test.ts index 655527a414a82..305dc31d47b50 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-http.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-http.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as sfn from '../../aws-stepfunctions'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-lambda.test.ts similarity index 97% rename from packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-lambda.test.ts index 9479d5975adc5..46e39e15caaaf 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-lambda.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-lambda.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-mapping-template.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-mapping-template.test.ts similarity index 94% rename from packages/@aws-cdk/aws-appsync/test/appsync-mapping-template.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-mapping-template.test.ts index e06e87e6658a5..18d96ac45232c 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-mapping-template.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-mapping-template.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; import * as appsync from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-none.test.ts similarity index 97% rename from packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-none.test.ts index 03d0e7a4afd89..da16eb8825f23 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-none.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-none.test.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-opensearch.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-opensearch.test.ts similarity index 96% rename from packages/@aws-cdk/aws-appsync/test/appsync-opensearch.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-opensearch.test.ts index fe88042030fb4..e2b77bc9acecf 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-opensearch.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-opensearch.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as opensearch from '@aws-cdk/aws-opensearchservice'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as opensearch from '../../aws-opensearchservice'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/@aws-cdk/aws-appsync/test/appsync-rds.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync-rds.test.ts similarity index 97% rename from packages/@aws-cdk/aws-appsync/test/appsync-rds.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync-rds.test.ts index a281737d1ab3c..fcb400a3208d9 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync-rds.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync-rds.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { Vpc, SecurityGroup, SubnetType } from '@aws-cdk/aws-ec2'; -import { DatabaseSecret, DatabaseClusterEngine, AuroraMysqlEngineVersion, ServerlessCluster } from '@aws-cdk/aws-rds'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Vpc, SecurityGroup, SubnetType } from '../../aws-ec2'; +import { DatabaseSecret, DatabaseClusterEngine, AuroraMysqlEngineVersion, ServerlessCluster } from '../../aws-rds'; +import * as cdk from '../../core'; import * as appsync from '../lib'; // GLOBAL GIVEN diff --git a/packages/aws-cdk-lib/aws-appsync/test/appsync.auth.graphql b/packages/aws-cdk-lib/aws-appsync/test/appsync.auth.graphql new file mode 100644 index 0000000000000..e59469dedfd10 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync.auth.graphql @@ -0,0 +1,12 @@ +type test { + id: Int! + version: String! +} + +type Query { + getTests: [ test! ] +} + +type Mutation { + addTest(version: String!): test! +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appsync/test/appsync.js-resolver.graphql b/packages/aws-cdk-lib/aws-appsync/test/appsync.js-resolver.graphql new file mode 100644 index 0000000000000..2e29df5c893d2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync.js-resolver.graphql @@ -0,0 +1,10 @@ +type Test { + id: String! + name: String! +} +type Query { + getTests: [Test]! +} +type Mutation { + addTest(name: String!): Test +} diff --git a/packages/aws-cdk-lib/aws-appsync/test/appsync.lambda.graphql b/packages/aws-cdk-lib/aws-appsync/test/appsync.lambda.graphql new file mode 100644 index 0000000000000..089553dfc913b --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync.lambda.graphql @@ -0,0 +1,25 @@ +schema { + query: Query + mutation: Mutation +} + +type Query { + getPost(id:ID!): Post + allPosts: [Post] +} + +type Mutation { + addPost(id: ID!, author: String!, title: String, content: String, url: String): Post! +} + +type Post { + id: ID! + author: String! + title: String + content: String + url: String + ups: Int + downs: Int + relatedPosts: [Post] + relatedPostsMaxBatchSize: [Post] +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appsync/test/appsync.none.graphql b/packages/aws-cdk-lib/aws-appsync/test/appsync.none.graphql new file mode 100644 index 0000000000000..fa7b3b6a95836 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync.none.graphql @@ -0,0 +1,9 @@ +type test { + version: String! +} +type Query { + getTests: [test]! +} +type Mutation { + addTest(version: String!): test +} diff --git a/packages/aws-cdk-lib/aws-appsync/test/appsync.test.graphql b/packages/aws-cdk-lib/aws-appsync/test/appsync.test.graphql new file mode 100644 index 0000000000000..fa7b3b6a95836 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync.test.graphql @@ -0,0 +1,9 @@ +type test { + version: String! +} +type Query { + getTests: [test]! +} +type Mutation { + addTest(version: String!): test +} diff --git a/packages/@aws-cdk/aws-appsync/test/appsync.test.ts b/packages/aws-cdk-lib/aws-appsync/test/appsync.test.ts similarity index 96% rename from packages/@aws-cdk/aws-appsync/test/appsync.test.ts rename to packages/aws-cdk-lib/aws-appsync/test/appsync.test.ts index 840f9664e5854..d5cbfe73712b9 100644 --- a/packages/@aws-cdk/aws-appsync/test/appsync.test.ts +++ b/packages/aws-cdk-lib/aws-appsync/test/appsync.test.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Certificate } from '../../aws-certificatemanager'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; import * as appsync from '../lib'; let stack: cdk.Stack; diff --git a/packages/aws-cdk-lib/aws-appsync/test/integ-assets/appsync-js-pipeline.js b/packages/aws-cdk-lib/aws-appsync/test/integ-assets/appsync-js-pipeline.js new file mode 100644 index 0000000000000..cfc6716b9273a --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/integ-assets/appsync-js-pipeline.js @@ -0,0 +1,9 @@ +// The before step +export function request(...args) { + return {} +} + +// The after step +export function response(ctx) { + return ctx.prev.result +} diff --git a/packages/aws-cdk-lib/aws-appsync/test/integ-assets/appsync-js-resolver.js b/packages/aws-cdk-lib/aws-appsync/test/integ-assets/appsync-js-resolver.js new file mode 100644 index 0000000000000..74a309765f2c2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/integ-assets/appsync-js-resolver.js @@ -0,0 +1,22 @@ +import { util } from '@aws-appsync/utils' + +export function request(ctx) { + const id = util.autoId() + const name = ctx.args.name; + + ctx.args.input = { + id, + name, + } + + return { + version: '2018-05-29', + operation: 'PutItem', + key: { id: util.dynamodb.toDynamoDB(ctx.args.input.id) }, + attributeValues: util.dynamodb.toMapValues(ctx.args.input), + }; +} + +export function response(ctx) { + return ctx.result; +} diff --git a/packages/aws-cdk-lib/aws-appsync/test/integ-assets/js-resolver-assertion/index.js b/packages/aws-cdk-lib/aws-appsync/test/integ-assets/js-resolver-assertion/index.js new file mode 100644 index 0000000000000..db0dbed85dfd5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/integ-assets/js-resolver-assertion/index.js @@ -0,0 +1,24 @@ +exports.handler = async function(event) { + console.log(event); + + let myHeaders = new Headers(); + myHeaders.append("x-api-key", event.apiKey); + myHeaders.append("Content-Type", "application/json"); + + const query = JSON.stringify({ + query: "mutation MyMutation {\n addTest(name: \"123\") {\n id\n name\n }\n}", + variables: {} + }); + + const requestOptions = { + method: 'POST', + headers: myHeaders, + body: query, + redirect: 'follow' + }; + + const response = await fetch(event.hostname, requestOptions) + .then(response => response.json()) + + return response; +} diff --git a/packages/aws-cdk-lib/aws-appsync/test/integ.graphql-iam.graphql b/packages/aws-cdk-lib/aws-appsync/test/integ.graphql-iam.graphql new file mode 100644 index 0000000000000..bae8d70f18fde --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/integ.graphql-iam.graphql @@ -0,0 +1,19 @@ +type test @aws_iam { + id: String! + version: String! +} + +type Query { + getTest(id: String!): test + getTests: [ test! ] + @aws_iam +} + +input TestInput { + version: String! +} + +type Mutation { + addTest(input: TestInput!): test + @aws_iam +} diff --git a/packages/aws-cdk-lib/aws-appsync/test/integ.graphql.graphql b/packages/aws-cdk-lib/aws-appsync/test/integ.graphql.graphql new file mode 100644 index 0000000000000..d418ab54de7a5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/integ.graphql.graphql @@ -0,0 +1,86 @@ +type ServiceVersion @aws_api_key { + version: String! +} + +type Customer @aws_api_key { + id: String! + name: String! +} + +input SaveCustomerInput { + name: String! +} + +type Order @aws_api_key { + customer: String! + order: String! +} + +type Payment @aws_api_key { + id: String! + amount: String! +} + +input PaymentInput { + amount: String! +} + +type Query @aws_api_key { + getServiceVersion: ServiceVersion + getCustomers: [Customer] + getCustomersNotConsistent: [Customer] + getCustomersConsistent: [Customer] + getCustomer(id: String): Customer + getCustomerNotConsistent(id: String): Customer + getCustomerConsistent(id: String): Customer + getCustomerOrdersEq(customer: String): Order + getCustomerOrdersLt(customer: String): Order + getCustomerOrdersLe(customer: String): Order + getCustomerOrdersGt(customer: String): Order + getCustomerOrdersGe(customer: String): Order + getCustomerOrdersNotConsistentEq(customer: String): Order + getCustomerOrdersNotConsistentLt(customer: String): Order + getCustomerOrdersNotConsistentLe(customer: String): Order + getCustomerOrdersNotConsistentGt(customer: String): Order + getCustomerOrdersNotConsistentGe(customer: String): Order + getCustomerOrdersConsistentEq(customer: String): Order + getCustomerOrdersConsistentLt(customer: String): Order + getCustomerOrdersConsistentLe(customer: String): Order + getCustomerOrdersConsistentGt(customer: String): Order + getCustomerOrdersConsistentGe(customer: String): Order + getCustomerOrdersFilter(customer: String, order: String): Order + getCustomerOrdersBetween(customer: String, order1: String, order2: String): Order + getOrderCustomersEq(order: String): [Customer] + getOrderCustomersLt(order: String): [Customer] + getOrderCustomersLe(order: String): [Customer] + getOrderCustomersGt(order: String): [Customer] + getOrderCustomersGe(order: String): [Customer] + getOrderCustomersNotConsistentEq(order: String): [Customer] + getOrderCustomersNotConsistentLt(order: String): [Customer] + getOrderCustomersNotConsistentLe(order: String): [Customer] + getOrderCustomersNotConsistentGt(order: String): [Customer] + getOrderCustomersNotConsistentGe(order: String): [Customer] + getOrderCustomersConsistentEq(order: String): [Customer] + getOrderCustomersConsistentLt(order: String): [Customer] + getOrderCustomersConsistentLe(order: String): [Customer] + getOrderCustomersConsistentGt(order: String): [Customer] + getOrderCustomersConsistentGe(order: String): [Customer] + getOrderCustomersFilter(order: String, customer: String): [Customer] + getOrderCustomersBetween(order: String, customer1: String, customer2: String): [Customer] + getPayment(id: String): Payment + getPaymentConsistent(id: String): Payment +} + +input FirstOrderInput { + product: String! + quantity: Int! +} + +type Mutation @aws_api_key { + addCustomer(customer: SaveCustomerInput!): Customer + saveCustomer(id: String!, customer: SaveCustomerInput!): Customer + removeCustomer(id: String!): Customer + saveCustomerWithFirstOrder(customer: SaveCustomerInput!, order: FirstOrderInput!, referral: String): Order + savePayment(payment: PaymentInput!): Payment + doPostOnAws: String! +} diff --git a/packages/@aws-cdk/aws-appsync/test/verify.graphql.sh b/packages/aws-cdk-lib/aws-appsync/test/verify.graphql.sh similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify.graphql.sh rename to packages/aws-cdk-lib/aws-appsync/test/verify.graphql.sh diff --git a/packages/@aws-cdk/aws-appsync/test/verify.integ.appsync-lambda.sh b/packages/aws-cdk-lib/aws-appsync/test/verify.integ.appsync-lambda.sh similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify.integ.appsync-lambda.sh rename to packages/aws-cdk-lib/aws-appsync/test/verify.integ.appsync-lambda.sh diff --git a/packages/@aws-cdk/aws-appsync/test/verify.integ.auth-apikey.sh b/packages/aws-cdk-lib/aws-appsync/test/verify.integ.auth-apikey.sh similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify.integ.auth-apikey.sh rename to packages/aws-cdk-lib/aws-appsync/test/verify.integ.auth-apikey.sh diff --git a/packages/@aws-cdk/aws-appsync/test/verify.integ.graphql-iam.sh b/packages/aws-cdk-lib/aws-appsync/test/verify.integ.graphql-iam.sh similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify.integ.graphql-iam.sh rename to packages/aws-cdk-lib/aws-appsync/test/verify.integ.graphql-iam.sh diff --git a/packages/@aws-cdk/aws-appsync/test/verify.integ.graphql-schema.sh b/packages/aws-cdk-lib/aws-appsync/test/verify.integ.graphql-schema.sh similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify.integ.graphql-schema.sh rename to packages/aws-cdk-lib/aws-appsync/test/verify.integ.graphql-schema.sh diff --git a/packages/@aws-cdk/aws-appsync/test/verify.integ.graphql.sh b/packages/aws-cdk-lib/aws-appsync/test/verify.integ.graphql.sh similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/verify.integ.graphql.sh rename to packages/aws-cdk-lib/aws-appsync/test/verify.integ.graphql.sh diff --git a/packages/aws-cdk-lib/aws-appsync/test/verify/iam-query/iam-query.js b/packages/aws-cdk-lib/aws-appsync/test/verify/iam-query/iam-query.js new file mode 100644 index 0000000000000..11e895d2e2c54 --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/verify/iam-query/iam-query.js @@ -0,0 +1,40 @@ +require('isomorphic-fetch'); +const AWS = require('aws-sdk/global'); +const gql = require('graphql-tag'); +const appsync = require('aws-appsync'); + +const config = { + url: process.env.APPSYNC_ENDPOINT, + region: process.env.AWS_REGION, + auth: { + type: appsync.AUTH_TYPE.AWS_IAM, + credentials: AWS.config.credentials, + }, + disableOffline: true +}; + +const getTests = +`query getTests { + getTests { + id + version + } +}`; + +const client = new appsync.AWSAppSyncClient(config); + +exports.handler = (event, context, callback) => { + + (async () => { + try { + const result = await client.query({ + query: gql(getTests) + }); + console.log(result.data); + callback(null, result.data); + } catch (e) { + console.warn('Error sending mutation: ', e); + callback(Error(e)); + } + })(); +}; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js b/packages/aws-cdk-lib/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js new file mode 100644 index 0000000000000..5a08f83ef4f0a --- /dev/null +++ b/packages/aws-cdk-lib/aws-appsync/test/verify/lambda-tutorial/lambda-tutorial.js @@ -0,0 +1,70 @@ +exports.handler = (event, context, callback) => { + console.log("Received event {}", JSON.stringify(event, 3)); + var posts = { + "1": {"id": "1", "title": "First book", "author": "Author1", "url": "https://amazon.com/", "content": "SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1 SAMPLE TEXT AUTHOR 1", "ups": "100", "downs": "10"}, + "2": {"id": "2", "title": "Second book", "author": "Author2", "url": "https://amazon.com", "content": "SAMPLE TEXT AUTHOR 2 SAMPLE TEXT AUTHOR 2 SAMPLE TEXT", "ups": "100", "downs": "10"}, + "3": {"id": "3", "title": "Third book", "author": "Author3", "url": null, "content": null, "ups": null, "downs": null }, + "4": {"id": "4", "title": "Fourth book", "author": "Author4", "url": "https://www.amazon.com/", "content": "SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4 SAMPLE TEXT AUTHOR 4", "ups": "1000", "downs": "0"}, + "5": {"id": "5", "title": "Fifth book", "author": "Author5", "url": "https://www.amazon.com/", "content": "SAMPLE TEXT AUTHOR 5 SAMPLE TEXT AUTHOR 5 SAMPLE TEXT AUTHOR 5 SAMPLE TEXT AUTHOR 5 SAMPLE TEXT", "ups": "50", "downs": "0"} }; + + var relatedPosts = { + "1": [posts['4']], + "2": [posts['3'], posts['5']], + "3": [posts['2'], posts['1']], + "4": [posts['2'], posts['1']], + "5": [] + }; + const isBatch = Array.isArray(event); + if (isBatch) { + console.log("Got an BatchInvoke Request. The payload has %d items to resolve.", event.length); + const field = event[0].field; + switch(field) { + case "relatedPostsMaxBatchSize": + case "relatedPosts": + var results = []; + // the response MUST contain the same number + // of entries as the payload array + for (var i=0; i< event.length; i++) { + console.log("post {}", JSON.stringify(event[i].source)); + results.push(relatedPosts[event[i].source.id]); + } + console.log("results {}", JSON.stringify(results)); + callback(null, results); + break; + default: + callback("Unknown field, unable to resolve" + field, null); + break; + } + } + else { + console.log("Got an Invoke Request."); + switch(event.field) { + case "getPost": + var id = event.arguments.id; + callback(null, posts[id]); + break; + case "allPosts": + var values = []; + for(var d in posts){ + values.push(posts[d]); + } + callback(null, values); + break; + case "addPost": + // return the arguments back + callback(null, event.arguments); + break; + case "addPostErrorWithData": + var id = event.arguments.id; + var result = posts[id]; + // attached additional error information to the post + result.errorMessage = 'Error with the mutation, data has changed'; + result.errorType = 'MUTATION_ERROR'; + callback(null, result); + break; + default: + callback("Unknown field, unable to resolve" + event.field, null); + break; + } + } +}; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-aps/.jsiirc.json b/packages/aws-cdk-lib/aws-aps/.jsiirc.json new file mode 100644 index 0000000000000..b99ca9009020b --- /dev/null +++ b/packages/aws-cdk-lib/aws-aps/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.APS" + }, + "java": { + "package": "software.amazon.awscdk.services.aps" + }, + "python": { + "module": "aws_cdk.aws_aps" + } + } +} diff --git a/packages/aws-cdk-lib/aws-aps/README.md b/packages/aws-cdk-lib/aws-aps/README.md new file mode 100644 index 0000000000000..b3c20298417c1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-aps/README.md @@ -0,0 +1,27 @@ +# AWS::APS Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as aps from 'aws-cdk-lib/aws-aps'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for APS construct libraries](https://constructs.dev/search?q=aps) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::APS resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_APS.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::APS](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_APS.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-aps/index.ts b/packages/aws-cdk-lib/aws-aps/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-aps/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-aps/lib/index.ts b/packages/aws-cdk-lib/aws-aps/lib/index.ts new file mode 100644 index 0000000000000..ff76985816ed3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-aps/lib/index.ts @@ -0,0 +1 @@ +export * from './aps.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-athena/.jsiirc.json b/packages/aws-cdk-lib/aws-athena/.jsiirc.json new file mode 100644 index 0000000000000..f8121707407b6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-athena/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.athena" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Athena" + }, + "python": { + "module": "aws_cdk.aws_athena" + } + } +} diff --git a/packages/aws-cdk-lib/aws-athena/README.md b/packages/aws-cdk-lib/aws-athena/README.md new file mode 100644 index 0000000000000..a6a12cbbccbe4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-athena/README.md @@ -0,0 +1,27 @@ +# Amazon Athena Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as athena from 'aws-cdk-lib/aws-athena'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Athena construct libraries](https://constructs.dev/search?q=athena) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Athena resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Athena.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Athena](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Athena.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-athena/index.ts b/packages/aws-cdk-lib/aws-athena/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-athena/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-athena/lib/index.ts b/packages/aws-cdk-lib/aws-athena/lib/index.ts new file mode 100644 index 0000000000000..5acff1af91a3d --- /dev/null +++ b/packages/aws-cdk-lib/aws-athena/lib/index.ts @@ -0,0 +1 @@ +export * from './athena.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-auditmanager/.jsiirc.json b/packages/aws-cdk-lib/aws-auditmanager/.jsiirc.json new file mode 100644 index 0000000000000..d2fdf7f10f18d --- /dev/null +++ b/packages/aws-cdk-lib/aws-auditmanager/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.AuditManager" + }, + "java": { + "package": "software.amazon.awscdk.services.auditmanager" + }, + "python": { + "module": "aws_cdk.aws_auditmanager" + } + } +} diff --git a/packages/aws-cdk-lib/aws-auditmanager/README.md b/packages/aws-cdk-lib/aws-auditmanager/README.md new file mode 100644 index 0000000000000..606546a783a75 --- /dev/null +++ b/packages/aws-cdk-lib/aws-auditmanager/README.md @@ -0,0 +1,27 @@ +# AWS::AuditManager Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as auditmanager from 'aws-cdk-lib/aws-auditmanager'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AuditManager construct libraries](https://constructs.dev/search?q=auditmanager) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AuditManager resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AuditManager.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AuditManager](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AuditManager.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-auditmanager/index.ts b/packages/aws-cdk-lib/aws-auditmanager/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-auditmanager/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-auditmanager/lib/index.ts b/packages/aws-cdk-lib/aws-auditmanager/lib/index.ts new file mode 100644 index 0000000000000..6d4e2ad8f50bc --- /dev/null +++ b/packages/aws-cdk-lib/aws-auditmanager/lib/index.ts @@ -0,0 +1 @@ +export * from './auditmanager.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-autoscaling-common/.jsiirc.json b/packages/aws-cdk-lib/aws-autoscaling-common/.jsiirc.json new file mode 100644 index 0000000000000..879ac40a72c13 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-common/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.autoscaling.common" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.AutoScaling.Common" + }, + "python": { + "module": "aws_cdk.aws_autoscaling_common" + } + } +} diff --git a/packages/aws-cdk-lib/aws-autoscaling-common/README.md b/packages/aws-cdk-lib/aws-autoscaling-common/README.md new file mode 100644 index 0000000000000..e8c6d1f15a6aa --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-common/README.md @@ -0,0 +1,8 @@ +# AWS AutoScaling Common Library + + +This is a sister package to `@aws-cdk/aws-autoscaling` and +`@aws-cdk/aws-applicationautoscaling`. It contains shared implementation +details between them. + +It does not need to be used directly. diff --git a/packages/aws-cdk-lib/aws-autoscaling-common/index.ts b/packages/aws-cdk-lib/aws-autoscaling-common/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-common/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/index.ts b/packages/aws-cdk-lib/aws-autoscaling-common/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-common/lib/index.ts rename to packages/aws-cdk-lib/aws-autoscaling-common/lib/index.ts diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/interval-utils.ts b/packages/aws-cdk-lib/aws-autoscaling-common/lib/interval-utils.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-common/lib/interval-utils.ts rename to packages/aws-cdk-lib/aws-autoscaling-common/lib/interval-utils.ts diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/test-utils.ts b/packages/aws-cdk-lib/aws-autoscaling-common/lib/test-utils.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-common/lib/test-utils.ts rename to packages/aws-cdk-lib/aws-autoscaling-common/lib/test-utils.ts diff --git a/packages/@aws-cdk/aws-autoscaling-common/lib/types.ts b/packages/aws-cdk-lib/aws-autoscaling-common/lib/types.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-common/lib/types.ts rename to packages/aws-cdk-lib/aws-autoscaling-common/lib/types.ts diff --git a/packages/@aws-cdk/aws-autoscaling-common/test/intervals.test.ts b/packages/aws-cdk-lib/aws-autoscaling-common/test/intervals.test.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-common/test/intervals.test.ts rename to packages/aws-cdk-lib/aws-autoscaling-common/test/intervals.test.ts diff --git a/packages/@aws-cdk/aws-autoscaling-common/test/util.ts b/packages/aws-cdk-lib/aws-autoscaling-common/test/util.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-common/test/util.ts rename to packages/aws-cdk-lib/aws-autoscaling-common/test/util.ts diff --git a/packages/aws-cdk-lib/aws-autoscaling-hooktargets/.jsiirc.json b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/.jsiirc.json new file mode 100644 index 0000000000000..ed2230c91e1d5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.autoscaling.hooktargets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.AutoScaling.HookTargets" + }, + "python": { + "module": "aws_cdk.aws_autoscaling_hooktargets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-autoscaling-hooktargets/README.md b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/README.md new file mode 100644 index 0000000000000..1929e6a3b148f --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/README.md @@ -0,0 +1,18 @@ +# Lifecycle Hook for the CDK AWS AutoScaling Library + + +This library contains integration classes for AutoScaling lifecycle hooks. +Instances of these classes should be passed to the +`autoScalingGroup.addLifecycleHook()` method. + +Lifecycle hooks can be activated in one of the following ways: + +* Invoke a Lambda function +* Publish to an SNS topic +* Send to an SQS queue + +For more information on using this library, see the README of the +`@aws-cdk/aws-autoscaling` library. + +For more information about lifecycle hooks, see +[Amazon EC2 AutoScaling Lifecycle hooks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) in the Amazon EC2 User Guide. diff --git a/packages/aws-cdk-lib/aws-autoscaling-hooktargets/index.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/common.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/common.ts new file mode 100644 index 0000000000000..77ab0af64e804 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/common.ts @@ -0,0 +1,14 @@ +// eslint-disable-next-line import/order +import * as iam from '../../aws-iam'; +import * as constructs from 'constructs'; + +export function createRole(scope: constructs.Construct, _role?: iam.IRole) { + let role = _role; + if (!role) { + role = new iam.Role(scope, 'Role', { + assumedBy: new iam.ServicePrincipal('autoscaling.amazonaws.com'), + }); + } + + return role; +} diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/index.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/lib/index.ts rename to packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/index.ts diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/lambda-hook.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/lambda-hook.ts similarity index 87% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/lib/lambda-hook.ts rename to packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/lambda-hook.ts index 8868eea5d4164..dbf561d74e969 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/lambda-hook.ts +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/lambda-hook.ts @@ -1,8 +1,8 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as subs from '@aws-cdk/aws-sns-subscriptions'; +import * as autoscaling from '../../aws-autoscaling'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import * as subs from '../../aws-sns-subscriptions'; import { Construct } from 'constructs'; import { createRole } from './common'; import { TopicHook } from './topic-hook'; diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/queue-hook.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/queue-hook.ts similarity index 89% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/lib/queue-hook.ts rename to packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/queue-hook.ts index 6247b93ee306c..06395feac7dc0 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/queue-hook.ts +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/queue-hook.ts @@ -1,5 +1,5 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as sqs from '@aws-cdk/aws-sqs'; +import * as autoscaling from '../../aws-autoscaling'; +import * as sqs from '../../aws-sqs'; import { Construct } from 'constructs'; import { createRole } from './common'; diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/topic-hook.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/topic-hook.ts similarity index 89% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/lib/topic-hook.ts rename to packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/topic-hook.ts index 65da54b79e210..31c381abce62f 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/lib/topic-hook.ts +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/lib/topic-hook.ts @@ -1,5 +1,5 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as sns from '@aws-cdk/aws-sns'; +import * as autoscaling from '../../aws-autoscaling'; +import * as sns from '../../aws-sns'; import { Construct } from 'constructs'; import { createRole } from './common'; diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/hooks.test.ts b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/test/hooks.test.ts similarity index 95% rename from packages/@aws-cdk/aws-autoscaling-hooktargets/test/hooks.test.ts rename to packages/aws-cdk-lib/aws-autoscaling-hooktargets/test/hooks.test.ts index 1e824c28ebd04..7fe8a81f21ecc 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/test/hooks.test.ts +++ b/packages/aws-cdk-lib/aws-autoscaling-hooktargets/test/hooks.test.ts @@ -1,12 +1,12 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as autoscaling from '../../aws-autoscaling'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import * as sqs from '../../aws-sqs'; +import { Stack } from '../../core'; import * as hooks from '../lib'; diff --git a/packages/aws-cdk-lib/aws-autoscaling/.jsiirc.json b/packages/aws-cdk-lib/aws-autoscaling/.jsiirc.json new file mode 100644 index 0000000000000..089b4ebe5a625 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.autoscaling" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.AutoScaling" + }, + "python": { + "module": "aws_cdk.aws_autoscaling" + } + } +} diff --git a/packages/aws-cdk-lib/aws-autoscaling/README.md b/packages/aws-cdk-lib/aws-autoscaling/README.md new file mode 100644 index 0000000000000..26beca6eb71cf --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/README.md @@ -0,0 +1,659 @@ +# Amazon EC2 Auto Scaling Construct Library + + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Auto Scaling Group + +An `AutoScalingGroup` represents a number of instances on which you run your code. You +pick the size of the fleet, the instance type and the OS image: + +```ts +declare const vpc: ec2.Vpc; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + + // The latest Amazon Linux image of a particular generation + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), +}); +``` + +NOTE: AutoScalingGroup has an property called `allowAllOutbound` (allowing the instances to contact the +internet) which is set to `true` by default. Be sure to set this to `false` if you don't want +your instances to be able to start arbitrary connections. Alternatively, you can specify an existing security +group to attach to the instances that are launched, rather than have the group create a new one. + +```ts +declare const vpc: ec2.Vpc; + +const mySecurityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc }); +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + securityGroup: mySecurityGroup, +}); +``` + +Alternatively you can create an `AutoScalingGroup` from a `LaunchTemplate`: + +```ts +declare const vpc: ec2.Vpc; +declare const launchTemplate: ec2.LaunchTemplate; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + launchTemplate: launchTemplate +}); +``` + +To launch a mixture of Spot and on-demand instances, and/or with multiple instance types, you can create an `AutoScalingGroup` from a MixedInstancesPolicy: + +```ts +declare const vpc: ec2.Vpc; +declare const launchTemplate1: ec2.LaunchTemplate; +declare const launchTemplate2: ec2.LaunchTemplate; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + mixedInstancesPolicy: { + instancesDistribution: { + onDemandPercentageAboveBaseCapacity: 50, // Mix Spot and On-Demand instances + }, + launchTemplate: launchTemplate1, + launchTemplateOverrides: [ // Mix multiple instance types + { instanceType: new ec2.InstanceType('t3.micro') }, + { instanceType: new ec2.InstanceType('t3a.micro') }, + { instanceType: new ec2.InstanceType('t4g.micro'), launchTemplate: launchTemplate2 }, + ], + } +}); +``` + +## Machine Images (AMIs) + +AMIs control the OS that gets launched when you start your EC2 instance. The EC2 +library contains constructs to select the AMI you want to use. + +Depending on the type of AMI, you select it a different way. + +The latest version of Amazon Linux and Microsoft Windows images are +selectable by instantiating one of these classes: + +[example of creating images](test/example.images.lit.ts) + +> NOTE: The Amazon Linux images selected will be cached in your `cdk.json`, so that your +> AutoScalingGroups don't automatically change out from under you when you're making unrelated +> changes. To update to the latest version of Amazon Linux, remove the cache entry from the `context` +> section of your `cdk.json`. +> +> We will add command-line options to make this step easier in the future. + +## AutoScaling Instance Counts + +AutoScalingGroups make it possible to raise and lower the number of instances in the group, +in response to (or in advance of) changes in workload. + +When you create your AutoScalingGroup, you specify a `minCapacity` and a +`maxCapacity`. AutoScaling policies that respond to metrics will never go higher +or lower than the indicated capacity (but scheduled scaling actions might, see +below). + +There are three ways to scale your capacity: + +* **In response to a metric** (also known as step scaling); for example, you + might want to scale out if the CPU usage across your cluster starts to rise, + and scale in when it drops again. +* **By trying to keep a certain metric around a given value** (also known as + target tracking scaling); you might want to automatically scale out and in to + keep your CPU usage around 50%. +* **On a schedule**; you might want to organize your scaling around traffic + flows you expect, by scaling out in the morning and scaling in in the + evening. + +The general pattern of autoscaling will look like this: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + minCapacity: 5, + maxCapacity: 100 + // ... +}); + +// Then call one of the scaling methods (explained below) +// +// autoScalingGroup.scaleOnMetric(...); +// +// autoScalingGroup.scaleOnCpuUtilization(...); +// autoScalingGroup.scaleOnIncomingBytes(...); +// autoScalingGroup.scaleOnOutgoingBytes(...); +// autoScalingGroup.scaleOnRequestCount(...); +// autoScalingGroup.scaleToTrackMetric(...); +// +// autoScalingGroup.scaleOnSchedule(...); +``` + +### Step Scaling + +This type of scaling scales in and out in deterministics steps that you +configure, in response to metric values. For example, your scaling strategy to +scale in response to a metric that represents your average worker pool usage +might look like this: + +```plaintext + Scaling -1 (no change) +1 +3 + │ │ │ │ │ + ├────────┼───────────────────────┼────────┼────────┤ + │ │ │ │ │ +Worker use 0% 10% 50% 70% 100% +``` + +(Note that this is not necessarily a recommended scaling strategy, but it's +a possible one. You will have to determine what thresholds are right for you). + +Note that in order to set up this scaling strategy, you will have to emit a +metric representing your worker utilization from your instances. After that, +you would configure the scaling something like this: + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +const workerUtilizationMetric = new cloudwatch.Metric({ + namespace: 'MyService', + metricName: 'WorkerUtilization' +}); + +autoScalingGroup.scaleOnMetric('ScaleToCPU', { + metric: workerUtilizationMetric, + scalingSteps: [ + { upper: 10, change: -1 }, + { lower: 50, change: +1 }, + { lower: 70, change: +3 }, + ], + + // Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the + // 'change' numbers before as percentages instead of capacity counts. + adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY, +}); +``` + +The AutoScaling construct library will create the required CloudWatch alarms and +AutoScaling policies for you. + +### Target Tracking Scaling + +This type of scaling scales in and out in order to keep a metric around a value +you prefer. There are four types of predefined metrics you can track, or you can +choose to track a custom metric. If you do choose to track a custom metric, +be aware that the metric has to represent instance utilization in some way +(AutoScaling will scale out if the metric is higher than the target, and scale +in if the metric is lower than the target). + +If you configure multiple target tracking policies, AutoScaling will use the +one that yields the highest capacity. + +The following example scales to keep the CPU usage of your instances around +50% utilization: + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +autoScalingGroup.scaleOnCpuUtilization('KeepSpareCPU', { + targetUtilizationPercent: 50 +}); +``` + +To scale on average network traffic in and out of your instances: + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +autoScalingGroup.scaleOnIncomingBytes('LimitIngressPerInstance', { + targetBytesPerSecond: 10 * 1024 * 1024 // 10 MB/s +}); +autoScalingGroup.scaleOnOutgoingBytes('LimitEgressPerInstance', { + targetBytesPerSecond: 10 * 1024 * 1024 // 10 MB/s +}); +``` + +To scale on the average request count per instance (only works for +AutoScalingGroups that have been attached to Application Load +Balancers): + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +autoScalingGroup.scaleOnRequestCount('LimitRPS', { + targetRequestsPerSecond: 1000 +}); +``` + +### Scheduled Scaling + +This type of scaling is used to change capacities based on time. It works by +changing `minCapacity`, `maxCapacity` and `desiredCapacity` of the +AutoScalingGroup, and so can be used for two purposes: + +* Scale in and out on a schedule by setting the `minCapacity` high or + the `maxCapacity` low. +* Still allow the regular scaling actions to do their job, but restrict + the range they can scale over (by setting both `minCapacity` and + `maxCapacity` but changing their range over time). + +A schedule is expressed as a cron expression. The `Schedule` class has a `cron` method to help build cron expressions. + +The following example scales the fleet out in the morning, going back to natural +scaling (all the way down to 1 instance if necessary) at night: + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +autoScalingGroup.scaleOnSchedule('PrescaleInTheMorning', { + schedule: autoscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, +}); + +autoScalingGroup.scaleOnSchedule('AllowDownscalingAtNight', { + schedule: autoscaling.Schedule.cron({ hour: '20', minute: '0' }), + minCapacity: 1 +}); +``` + +### Block Devices + +This type specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. + +#### GP3 Volumes + +You can only specify the `throughput` on GP3 volumes. + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + blockDevices: [ + { + deviceName: 'gp3-volume', + volume: autoscaling.BlockDeviceVolume.ebs(15, { + volumeType: autoscaling.EbsDeviceVolumeType.GP3, + throughput: 125, + }), + }, + ], + // ... +}); +``` + +## Configuring Instances using CloudFormation Init + +It is possible to use the CloudFormation Init mechanism to configure the +instances in the AutoScalingGroup. You can write files to it, run commands, +start services, etc. See the documentation of +[AWS::CloudFormation::Init](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html) +and the documentation of CDK's `aws-ec2` library for more information. + +When you specify a CloudFormation Init configuration for an AutoScalingGroup: + +* you *must* also specify `signals` to configure how long CloudFormation + should wait for the instances to successfully configure themselves. +* you *should* also specify an `updatePolicy` to configure how instances + should be updated when the AutoScalingGroup is updated (for example, + when the AMI is updated). If you don't specify an update policy, a *rolling + update* is chosen by default. + +Here's an example of using CloudFormation Init to write a file to the +instance hosts on startup: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + init: ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromString('/etc/my_instance', 'This got written during instance startup'), + ), + signals: autoscaling.Signals.waitForAll({ + timeout: Duration.minutes(10), + }), +}); +``` + +## Signals + +In normal operation, CloudFormation will send a Create or Update command to +an AutoScalingGroup and proceed with the rest of the deployment without waiting +for the *instances in the AutoScalingGroup*. + +Configure `signals` to tell CloudFormation to wait for a specific number of +instances in the AutoScalingGroup to have been started (or failed to start) +before moving on. An instance is supposed to execute the +[`cfn-signal`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-signal.html) +program as part of its startup to indicate whether it was started +successfully or not. + +If you use CloudFormation Init support (described in the previous section), +the appropriate call to `cfn-signal` is automatically added to the +AutoScalingGroup's UserData. If you don't use the `signals` directly, you are +responsible for adding such a call yourself. + +The following type of `Signals` are available: + +* `Signals.waitForAll([options])`: wait for all of `desiredCapacity` amount of instances + to have started (recommended). +* `Signals.waitForMinCapacity([options])`: wait for a `minCapacity` amount of instances + to have started (use this if waiting for all instances takes too long and you are happy + with a minimum count of healthy hosts). +* `Signals.waitForCount(count, [options])`: wait for a specific amount of instances to have + started. + +There are two `options` you can configure: + +* `timeout`: maximum time a host startup is allowed to take. If a host does not report + success within this time, it is considered a failure. Default is 5 minutes. +* `minSuccessPercentage`: percentage of hosts that needs to be healthy in order for the + update to succeed. If you set this value lower than 100, some percentage of hosts may + report failure, while still considering the deployment a success. Default is 100%. + +## Update Policy + +The *update policy* describes what should happen to running instances when the definition +of the AutoScalingGroup is changed. For example, if you add a command to the UserData +of an AutoScalingGroup, do the existing instances get replaced with new instances that +have executed the new UserData? Or do the "old" instances just keep on running? + +It is recommended to always use an update policy, otherwise the current state of your +instances also depends the previous state of your instances, rather than just on your +source code. This degrades the reproducibility of your deployments. + +The following update policies are available: + +* `UpdatePolicy.none()`: leave existing instances alone (not recommended). +* `UpdatePolicy.rollingUpdate([options])`: progressively replace the existing + instances with new instances, in small batches. At any point in time, + roughly the same amount of total instances will be running. If the deployment + needs to be rolled back, the fresh instances will be replaced with the "old" + configuration again. +* `UpdatePolicy.replacingUpdate([options])`: build a completely fresh copy + of the new AutoScalingGroup next to the old one. Once the AutoScalingGroup + has been successfully created (and the instances started, if `signals` is + configured on the AutoScalingGroup), the old AutoScalingGroup is deleted. + If the deployment needs to be rolled back, the new AutoScalingGroup is + deleted and the old one is left unchanged. + +## Allowing Connections + +See the documentation of the `@aws-cdk/aws-ec2` package for more information +about allowing connections between resources backed by instances. + +## Max Instance Lifetime + +To enable the max instance lifetime support, specify `maxInstanceLifetime` property +for the `AutoscalingGroup` resource. The value must be between 7 and 365 days(inclusive). +To clear a previously set value, leave this property undefined. + +## Instance Monitoring + +To disable detailed instance monitoring, specify `instanceMonitoring` property +for the `AutoscalingGroup` resource as `Monitoring.BASIC`. Otherwise detailed monitoring +will be enabled. + +## Monitoring Group Metrics + +Group metrics are used to monitor group level properties; they describe the group rather than any of its instances (e.g GroupMaxSize, the group maximum size). To enable group metrics monitoring, use the `groupMetrics` property. +All group metrics are reported in a granularity of 1 minute at no additional charge. + +See [EC2 docs](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html#as-group-metrics) for a list of all available group metrics. + +To enable group metrics monitoring using the `groupMetrics` property: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +// Enable monitoring of all group metrics +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + groupMetrics: [autoscaling.GroupMetrics.all()], +}); + +// Enable monitoring for a subset of group metrics +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + groupMetrics: [new autoscaling.GroupMetrics(autoscaling.GroupMetric.MIN_SIZE, autoscaling.GroupMetric.MAX_SIZE)], +}); +``` + +## Termination policies + +Auto Scaling uses [termination policies](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html) +to determine which instances it terminates first during scale-in events. You +can specify one or more termination policies with the `terminationPolicies` +property: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + terminationPolicies: [ + autoscaling.TerminationPolicy.OLDEST_INSTANCE, + autoscaling.TerminationPolicy.DEFAULT, + ], +}); +``` + +## Protecting new instances from being terminated on scale-in + +By default, Auto Scaling can terminate an instance at any time after launch when +scaling in an Auto Scaling Group, subject to the group's [termination +policy](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html). + +However, you may wish to protect newly-launched instances from being scaled in +if they are going to run critical applications that should not be prematurely +terminated. EC2 Capacity Providers for Amazon ECS requires this attribute be +set to `true`. + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + newInstancesProtectedFromScaleIn: true, +}); +``` + +## Configuring Capacity Rebalancing + +Indicates whether Capacity Rebalancing is enabled. Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see [Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) in the in the Amazon EC2 Auto Scaling User Guide. + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + capacityRebalance: true, +}); +``` + +## Connecting to your instances using SSM Session Manager + +SSM Session Manager makes it possible to connect to your instances from the +AWS Console, without preparing SSH keys. + +To do so, you need to: + +* Use an image with [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) installed + and configured. [Many images come with SSM Agent + preinstalled](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html), otherwise you + may need to manually put instructions to [install SSM + Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) into your + instance's UserData or use EC2 Init). +* Create the AutoScalingGroup with `ssmSessionPermissions: true`. + +If these conditions are met, you can connect to the instance from the EC2 Console. Example: + +```ts +declare const vpc: ec2.Vpc; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO), + + // Amazon Linux 2 comes with SSM Agent by default + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + + // Turn on SSM + ssmSessionPermissions: true, +}); +``` + +## Configuring Instance Metadata Service (IMDS) + +### Toggling IMDSv1 + +You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options to either +allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS. + +To do this for a single `AutoScalingGroup`, you can use set the `requireImdsv2` property. +The example below demonstrates IMDSv2 being required on a single `AutoScalingGroup`: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + requireImdsv2: true, +}); +``` + +You can also use `AutoScalingGroupRequireImdsv2Aspect` to apply the operation to multiple AutoScalingGroups. +The example below demonstrates the `AutoScalingGroupRequireImdsv2Aspect` being used to require IMDSv2 for all AutoScalingGroups in a stack: + +```ts +const aspect = new autoscaling.AutoScalingGroupRequireImdsv2Aspect(); + +Aspects.of(this).add(aspect); +``` + +## Warm Pool + +Auto Scaling offers [a warm pool](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) which gives an ability to decrease latency for applications that have exceptionally long boot times. You can create a warm pool with default parameters as below: + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +autoScalingGroup.addWarmPool(); +``` + +You can also customize a warm pool by configuring parameters: + +```ts +declare const autoScalingGroup: autoscaling.AutoScalingGroup; + +autoScalingGroup.addWarmPool({ + minSize: 1, + reuseOnScaleIn: true, +}); +``` + +### Default Instance Warming + +You can use the default instance warmup feature to improve the Amazon CloudWatch metrics used for dynamic scaling. +When default instance warmup is not enabled, each instance starts contributing usage data to the aggregated metrics +as soon as the instance reaches the InService state. However, if you enable default instance warmup, this lets +your instances finish warming up before they contribute the usage data. + +To optimize the performance of scaling policies that scale continuously, such as target tracking and step scaling +policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds. + +To set up Default Instance Warming for an autoscaling group, simply pass it in as a prop + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + + +new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType, + machineImage, + + // ... + + defaultInstanceWarmup: Duration.seconds(5), +}); +``` + +## Future work + +* [ ] CloudWatch Events (impossible to add currently as the AutoScalingGroup ARN is + necessary to make this rule and this cannot be accessed from CloudFormation). diff --git a/packages/aws-cdk-lib/aws-autoscaling/index.ts b/packages/aws-cdk-lib/aws-autoscaling/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/aspects/index.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/aspects/index.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/lib/aspects/index.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/aspects/index.ts diff --git a/packages/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.ts new file mode 100644 index 0000000000000..af4d53b70e689 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/aspects/require-imdsv2-aspect.ts @@ -0,0 +1,39 @@ +import * as cdk from '../../../core'; +import { IConstruct } from 'constructs'; +import { AutoScalingGroup } from '../auto-scaling-group'; +import { CfnLaunchConfiguration } from '../autoscaling.generated'; + +/** + * Aspect that makes IMDSv2 required on instances deployed by AutoScalingGroups. + */ +export class AutoScalingGroupRequireImdsv2Aspect implements cdk.IAspect { + constructor() { + } + + public visit(node: IConstruct): void { + if (!(node instanceof AutoScalingGroup)) { + return; + } + + const launchConfig = node.node.tryFindChild('LaunchConfig') as CfnLaunchConfiguration; + if (cdk.isResolvableObject(launchConfig.metadataOptions)) { + this.warn(node, 'CfnLaunchConfiguration.MetadataOptions field is a CDK token.'); + return; + } + + launchConfig.metadataOptions = { + ...launchConfig.metadataOptions, + httpTokens: 'required', + }; + } + + /** + * Adds a warning annotation to a node. + * + * @param node The scope to add the warning to. + * @param message The warning message. + */ + protected warn(node: IConstruct, message: string) { + cdk.Annotations.of(node).addWarning(`${AutoScalingGroupRequireImdsv2Aspect.name} failed on node ${node.node.id}: ${message}`); + } +} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts similarity index 99% rename from packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts index 36430ebda8cb9..48f28faa1f32a 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts @@ -1,9 +1,9 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import * as elb from '../../aws-elasticloadbalancing'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as iam from '../../aws-iam'; +import * as sns from '../../aws-sns'; import { Annotations, @@ -13,7 +13,7 @@ import { Duration, Fn, IResource, Lazy, PhysicalName, Resource, Stack, Tags, Token, Tokenization, withResolved, -} from '@aws-cdk/core'; +} from '../../core'; import { Construct } from 'constructs'; import { AutoScalingGroupRequireImdsv2Aspect } from './aspects'; import { CfnAutoScalingGroup, CfnAutoScalingGroupProps, CfnLaunchConfiguration } from './autoscaling.generated'; diff --git a/packages/@aws-cdk/aws-autoscaling/lib/index.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/lib/index.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/index.ts diff --git a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.ts similarity index 97% rename from packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.ts index 4314e99971cab..829f67dff1d76 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook-target.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line import/order import { LifecycleHook } from './lifecycle-hook'; -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import * as constructs from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.ts similarity index 97% rename from packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.ts index cdcd9870ab37d..bc8cbe166a8d3 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Duration, IResource, Resource } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Duration, IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnLifecycleHook } from './autoscaling.generated'; diff --git a/packages/aws-cdk-lib/aws-autoscaling/lib/schedule.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/schedule.ts new file mode 100644 index 0000000000000..009b7fda02cc1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/schedule.ts @@ -0,0 +1,112 @@ +import { Annotations } from '../../core'; +import { Construct } from 'constructs'; + +/** + * Schedule for scheduled scaling actions + */ +export abstract class Schedule { + /** + * Construct a schedule from a literal schedule expression + * + * @param expression The expression to use. Must be in a format that AutoScaling will recognize + * @see http://crontab.org/ + */ + public static expression(expression: string): Schedule { + return new LiteralSchedule(expression); + } + + /** + * Create a schedule from a set of cron fields + */ + public static cron(options: CronOptions): Schedule { + if (options.weekDay !== undefined && options.day !== undefined) { + throw new Error('Cannot supply both \'day\' and \'weekDay\', use at most one'); + } + + const minute = fallback(options.minute, '*'); + const hour = fallback(options.hour, '*'); + const month = fallback(options.month, '*'); + const day = fallback(options.day, '*'); + const weekDay = fallback(options.weekDay, '*'); + + return new class extends Schedule { + public readonly expressionString: string = `${minute} ${hour} ${day} ${month} ${weekDay}`; + public _bind(scope: Construct) { + if (!options.minute) { + Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.'); + } + return new LiteralSchedule(this.expressionString); + } + }; + } + + /** + * Retrieve the expression for this schedule + */ + public abstract readonly expressionString: string; + + protected constructor() {} + + /** + * + * @internal + */ + public abstract _bind(scope: Construct): void; +} + +/** + * Options to configure a cron expression + * + * All fields are strings so you can use complex expressions. Absence of + * a field implies '*' or '?', whichever one is appropriate. + * + * @see http://crontab.org/ + */ +export interface CronOptions { + /** + * The minute to run this rule at + * + * @default - Every minute + */ + readonly minute?: string; + + /** + * The hour to run this rule at + * + * @default - Every hour + */ + readonly hour?: string; + + /** + * The day of the month to run this rule at + * + * @default - Every day of the month + */ + readonly day?: string; + + /** + * The month to run this rule at + * + * @default - Every month + */ + readonly month?: string; + + /** + * The day of the week to run this rule at + * + * @default - Any day of the week + */ + readonly weekDay?: string; +} + +class LiteralSchedule extends Schedule { + constructor(public readonly expressionString: string) { + super(); + } + + public _bind(): void {} +} + +function fallback(x: T | undefined, def: T): T { + return x === undefined ? def : x; +} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.ts similarity index 98% rename from packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.ts index 0889e759b1d1e..2bfb30921372d 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/scheduled-action.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/scheduled-action.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnScheduledAction } from './autoscaling.generated'; diff --git a/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.ts new file mode 100644 index 0000000000000..7f10199e753a4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-action.ts @@ -0,0 +1,182 @@ +import { Duration, Lazy } from '../../core'; +import { Construct } from 'constructs'; +import { IAutoScalingGroup } from './auto-scaling-group'; +import { CfnScalingPolicy } from './autoscaling.generated'; + +/** + * Properties for a scaling policy + */ +export interface StepScalingActionProps { + /** + * The auto scaling group + */ + readonly autoScalingGroup: IAutoScalingGroup; + + /** + * Period after a scaling completes before another scaling activity can start. + * + * @default The default cooldown configured on the AutoScalingGroup + */ + readonly cooldown?: Duration; + + /** + * Estimated time until a newly launched instance can send metrics to CloudWatch. + * + * @default Same as the cooldown + */ + readonly estimatedInstanceWarmup?: Duration; + + /** + * How the adjustment numbers are interpreted + * + * @default ChangeInCapacity + */ + readonly adjustmentType?: AdjustmentType; + + /** + * Minimum absolute number to adjust capacity with as result of percentage scaling. + * + * Only when using AdjustmentType = PercentChangeInCapacity, this number controls + * the minimum absolute effect size. + * + * @default No minimum scaling effect + */ + readonly minAdjustmentMagnitude?: number; + + /** + * The aggregation type for the CloudWatch metrics. + * + * @default Average + */ + readonly metricAggregationType?: MetricAggregationType; +} + +/** + * Define a step scaling action + * + * This kind of scaling policy adjusts the target capacity in configurable + * steps. The size of the step is configurable based on the metric's distance + * to its alarm threshold. + * + * This Action must be used as the target of a CloudWatch alarm to take effect. + */ +export class StepScalingAction extends Construct { + /** + * ARN of the scaling policy + */ + public readonly scalingPolicyArn: string; + + private readonly adjustments = new Array(); + + constructor(scope: Construct, id: string, props: StepScalingActionProps) { + super(scope, id); + + const resource = new CfnScalingPolicy(this, 'Resource', { + policyType: 'StepScaling', + autoScalingGroupName: props.autoScalingGroup.autoScalingGroupName, + cooldown: props.cooldown && props.cooldown.toSeconds().toString(), + estimatedInstanceWarmup: props.estimatedInstanceWarmup && props.estimatedInstanceWarmup.toSeconds(), + adjustmentType: props.adjustmentType, + minAdjustmentMagnitude: props.minAdjustmentMagnitude, + metricAggregationType: props.metricAggregationType, + stepAdjustments: Lazy.any({ produce: () => this.adjustments }), + }); + + this.scalingPolicyArn = resource.ref; + } + + /** + * Add an adjusment interval to the ScalingAction + */ + public addAdjustment(adjustment: AdjustmentTier) { + if (adjustment.lowerBound === undefined && adjustment.upperBound === undefined) { + throw new Error('At least one of lowerBound or upperBound is required'); + } + this.adjustments.push({ + metricIntervalLowerBound: adjustment.lowerBound, + metricIntervalUpperBound: adjustment.upperBound, + scalingAdjustment: adjustment.adjustment, + }); + } +} + +/** + * How adjustment numbers are interpreted + */ +export enum AdjustmentType { + /** + * Add the adjustment number to the current capacity. + * + * A positive number increases capacity, a negative number decreases capacity. + */ + CHANGE_IN_CAPACITY = 'ChangeInCapacity', + + /** + * Add this percentage of the current capacity to itself. + * + * The number must be between -100 and 100; a positive number increases + * capacity and a negative number decreases it. + */ + PERCENT_CHANGE_IN_CAPACITY = 'PercentChangeInCapacity', + + /** + * Make the capacity equal to the exact number given. + */ + EXACT_CAPACITY = 'ExactCapacity', +} + +/** + * How the scaling metric is going to be aggregated + */ +export enum MetricAggregationType { + /** + * Average + */ + AVERAGE = 'Average', + + /** + * Minimum + */ + MINIMUM = 'Minimum', + + /** + * Maximum + */ + MAXIMUM = 'Maximum' +} + +/** + * An adjustment + */ +export interface AdjustmentTier { + /** + * What number to adjust the capacity with + * + * The number is interpeted as an added capacity, a new fixed capacity or an + * added percentage depending on the AdjustmentType value of the + * StepScalingPolicy. + * + * Can be positive or negative. + */ + readonly adjustment: number; + + /** + * Lower bound where this scaling tier applies. + * + * The scaling tier applies if the difference between the metric + * value and its alarm threshold is higher than this value. + * + * @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier + */ + readonly lowerBound?: number; + + /** + * Upper bound where this scaling tier applies + * + * The scaling tier applies if the difference between the metric + * value and its alarm threshold is lower than this value. + * + * @default +Infinity + */ + readonly upperBound?: number; +} diff --git a/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.ts new file mode 100644 index 0000000000000..2bffe9aa808c6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/step-scaling-policy.ts @@ -0,0 +1,238 @@ +import { findAlarmThresholds, normalizeIntervals } from '../../aws-autoscaling-common'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Duration } from '../../core'; +import { Construct } from 'constructs'; +import { IAutoScalingGroup } from './auto-scaling-group'; +import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action'; + +export interface BasicStepScalingPolicyProps { + /** + * Metric to scale on. + */ + readonly metric: cloudwatch.IMetric; + + /** + * The intervals for scaling. + * + * Maps a range of metric values to a particular scaling behavior. + */ + readonly scalingSteps: ScalingInterval[]; + + /** + * How the adjustment numbers inside 'intervals' are interpreted. + * + * @default ChangeInCapacity + */ + readonly adjustmentType?: AdjustmentType; + + /** + * Grace period after scaling activity. + * + * @default Default cooldown period on your AutoScalingGroup + */ + readonly cooldown?: Duration; + + /** + * Estimated time until a newly launched instance can send metrics to CloudWatch. + * + * @default Same as the cooldown + */ + readonly estimatedInstanceWarmup?: Duration; + + /** + * Minimum absolute number to adjust capacity with as result of percentage scaling. + * + * Only when using AdjustmentType = PercentChangeInCapacity, this number controls + * the minimum absolute effect size. + * + * @default No minimum scaling effect + */ + readonly minAdjustmentMagnitude?: number; + + /** + * How many evaluation periods of the metric to wait before triggering a scaling action + * + * Raising this value can be used to smooth out the metric, at the expense + * of slower response times. + * + * @default 1 + */ + readonly evaluationPeriods?: number; + + /** + * Aggregation to apply to all data points over the evaluation periods + * + * Only has meaning if `evaluationPeriods != 1`. + * + * @default - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE. + */ + readonly metricAggregationType?: MetricAggregationType; +} + +export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps { + /** + * The auto scaling group + */ + readonly autoScalingGroup: IAutoScalingGroup; +} + +/** + * Define a acaling strategy which scales depending on absolute values of some metric. + * + * You can specify the scaling behavior for various values of the metric. + * + * Implemented using one or more CloudWatch alarms and Step Scaling Policies. + */ +export class StepScalingPolicy extends Construct { + public readonly lowerAlarm?: cloudwatch.Alarm; + public readonly lowerAction?: StepScalingAction; + public readonly upperAlarm?: cloudwatch.Alarm; + public readonly upperAction?: StepScalingAction; + + constructor(scope: Construct, id: string, props: StepScalingPolicyProps) { + super(scope, id); + + if (props.scalingSteps.length < 2) { + throw new Error('You must supply at least 2 intervals for autoscaling'); + } + + const adjustmentType = props.adjustmentType || AdjustmentType.CHANGE_IN_CAPACITY; + const changesAreAbsolute = adjustmentType === AdjustmentType.EXACT_CAPACITY; + + const intervals = normalizeIntervals(props.scalingSteps, changesAreAbsolute); + const alarms = findAlarmThresholds(intervals); + + if (alarms.lowerAlarmIntervalIndex !== undefined) { + const threshold = intervals[alarms.lowerAlarmIntervalIndex].upper; + + this.lowerAction = new StepScalingAction(this, 'LowerPolicy', { + adjustmentType: props.adjustmentType, + cooldown: props.cooldown, + estimatedInstanceWarmup: props.estimatedInstanceWarmup, + metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), + minAdjustmentMagnitude: props.minAdjustmentMagnitude, + autoScalingGroup: props.autoScalingGroup, + }); + + for (let i = alarms.lowerAlarmIntervalIndex; i >= 0; i--) { + this.lowerAction.addAdjustment({ + adjustment: intervals[i].change!, + lowerBound: i !== 0 ? intervals[i].lower - threshold : undefined, // Extend last interval to -infinity + upperBound: intervals[i].upper - threshold, + }); + } + + this.lowerAlarm = new cloudwatch.Alarm(this, 'LowerAlarm', { + // Recommended by AutoScaling + metric: props.metric, + alarmDescription: 'Lower threshold scaling alarm', + comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD, + evaluationPeriods: props.evaluationPeriods ?? 1, + threshold, + }); + this.lowerAlarm.addAlarmAction(new StepScalingAlarmAction(this.lowerAction)); + } + + if (alarms.upperAlarmIntervalIndex !== undefined) { + const threshold = intervals[alarms.upperAlarmIntervalIndex].lower; + + this.upperAction = new StepScalingAction(this, 'UpperPolicy', { + adjustmentType: props.adjustmentType, + cooldown: props.cooldown, + estimatedInstanceWarmup: props.estimatedInstanceWarmup, + metricAggregationType: props.metricAggregationType ?? aggregationTypeFromMetric(props.metric), + minAdjustmentMagnitude: props.minAdjustmentMagnitude, + autoScalingGroup: props.autoScalingGroup, + }); + + for (let i = alarms.upperAlarmIntervalIndex; i < intervals.length; i++) { + this.upperAction.addAdjustment({ + adjustment: intervals[i].change!, + lowerBound: intervals[i].lower - threshold, + upperBound: i !== intervals.length - 1 ? intervals[i].upper - threshold : undefined, // Extend last interval to +infinity + }); + } + + this.upperAlarm = new cloudwatch.Alarm(this, 'UpperAlarm', { + // Recommended by AutoScaling + metric: props.metric, + alarmDescription: 'Upper threshold scaling alarm', + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD, + evaluationPeriods: props.evaluationPeriods ?? 1, + threshold, + }); + this.upperAlarm.addAlarmAction(new StepScalingAlarmAction(this.upperAction)); + } + } +} + +function aggregationTypeFromMetric(metric: cloudwatch.IMetric): MetricAggregationType | undefined { + const statistic = metric.toMetricConfig().metricStat?.statistic; + if (statistic === undefined) { return undefined; } // Math expression, don't know aggregation, leave default + + switch (statistic) { + case 'Average': + return MetricAggregationType.AVERAGE; + case 'Minimum': + return MetricAggregationType.MINIMUM; + case 'Maximum': + return MetricAggregationType.MAXIMUM; + default: + return MetricAggregationType.AVERAGE; + } +} + +/** + * A range of metric values in which to apply a certain scaling operation + */ +export interface ScalingInterval { + /** + * The lower bound of the interval. + * + * The scaling adjustment will be applied if the metric is higher than this value. + * + * @default Threshold automatically derived from neighbouring intervals + */ + readonly lower?: number; + + /** + * The upper bound of the interval. + * + * The scaling adjustment will be applied if the metric is lower than this value. + * + * @default Threshold automatically derived from neighbouring intervals + */ + readonly upper?: number; + + /** + * The capacity adjustment to apply in this interval + * + * The number is interpreted differently based on AdjustmentType: + * + * - ChangeInCapacity: add the adjustment to the current capacity. + * The number can be positive or negative. + * - PercentChangeInCapacity: add or remove the given percentage of the current + * capacity to itself. The number can be in the range [-100..100]. + * - ExactCapacity: set the capacity to this number. The number must + * be positive. + */ + readonly change: number; +} + +/** + * Use a StepScalingAction as an Alarm Action + * + * This class is here and not in aws-cloudwatch-actions because this library + * needs to use the class, and otherwise we'd have a circular dependency: + * + * aws-autoscaling -> aws-cloudwatch-actions (for using the Action) + * aws-cloudwatch-actions -> aws-autoscaling (for the definition of IStepScalingAction) + */ +class StepScalingAlarmAction implements cloudwatch.IAlarmAction { + constructor(private readonly stepScalingAction: StepScalingAction) { + } + + public bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { + return { alarmActionArn: this.stepScalingAction.scalingPolicyArn }; + } +} diff --git a/packages/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.ts new file mode 100644 index 0000000000000..bb0a752309fcd --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/target-tracking-scaling-policy.ts @@ -0,0 +1,185 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import { Duration } from '../../core'; +import { Construct } from 'constructs'; +import { IAutoScalingGroup } from './auto-scaling-group'; +import { CfnScalingPolicy } from './autoscaling.generated'; + +/** + * Base interface for target tracking props + * + * Contains the attributes that are common to target tracking policies, + * except the ones relating to the metric and to the scalable target. + * + * This interface is reused by more specific target tracking props objects. + */ +export interface BaseTargetTrackingProps { + /** + * Indicates whether scale in by the target tracking policy is disabled. + * + * If the value is true, scale in is disabled and the target tracking policy + * won't remove capacity from the autoscaling group. Otherwise, scale in is + * enabled and the target tracking policy can remove capacity from the + * group. + * + * @default false + */ + readonly disableScaleIn?: boolean; + + /** + * Period after a scaling completes before another scaling activity can start. + * + * @default - The default cooldown configured on the AutoScalingGroup. + */ + readonly cooldown?: Duration; + + /** + * Estimated time until a newly launched instance can send metrics to CloudWatch. + * + * @default - Same as the cooldown. + */ + readonly estimatedInstanceWarmup?: Duration; +} + +/** + * Properties for a Target Tracking policy that include the metric but exclude the target + */ +export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackingProps { + /** + * The target value for the metric. + */ + readonly targetValue: number; + + /** + * A predefined metric for application autoscaling + * + * The metric must track utilization. Scaling out will happen if the metric is higher than + * the target value, scaling in will happen in the metric is lower than the target value. + * + * Exactly one of customMetric or predefinedMetric must be specified. + * + * @default - No predefined metric. + */ + readonly predefinedMetric?: PredefinedMetric; + + /** + * A custom metric for application autoscaling + * + * The metric must track utilization. Scaling out will happen if the metric is higher than + * the target value, scaling in will happen in the metric is lower than the target value. + * + * Exactly one of customMetric or predefinedMetric must be specified. + * + * @default - No custom metric. + */ + readonly customMetric?: cloudwatch.IMetric; + + /** + * The resource label associated with the predefined metric + * + * Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the + * format should be: + * + * app///targetgroup// + * + * @default - No resource label. + */ + readonly resourceLabel?: string; +} + +/** + * Properties for a concrete TargetTrackingPolicy + * + * Adds the scalingTarget. + */ +export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps { + /* + * The auto scaling group + */ + readonly autoScalingGroup: IAutoScalingGroup; +} + +export class TargetTrackingScalingPolicy extends Construct { + /** + * ARN of the scaling policy + */ + public readonly scalingPolicyArn: string; + + /** + * The resource object + */ + private resource: CfnScalingPolicy; + + constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps) { + if ((props.customMetric === undefined) === (props.predefinedMetric === undefined)) { + throw new Error('Exactly one of \'customMetric\' or \'predefinedMetric\' must be specified.'); + } + + if (props.predefinedMetric === PredefinedMetric.ALB_REQUEST_COUNT_PER_TARGET && !props.resourceLabel) { + throw new Error('When tracking the ALBRequestCountPerTarget metric, the ALB identifier must be supplied in resourceLabel'); + } + + if (props.customMetric && !props.customMetric.toMetricConfig().metricStat) { + throw new Error('Only direct metrics are supported for Target Tracking. Use Step Scaling or supply a Metric object.'); + } + + super(scope, id); + + this.resource = new CfnScalingPolicy(this, 'Resource', { + policyType: 'TargetTrackingScaling', + autoScalingGroupName: props.autoScalingGroup.autoScalingGroupName, + cooldown: props.cooldown && props.cooldown.toSeconds().toString(), + estimatedInstanceWarmup: props.estimatedInstanceWarmup && props.estimatedInstanceWarmup.toSeconds(), + targetTrackingConfiguration: { + customizedMetricSpecification: renderCustomMetric(props.customMetric), + disableScaleIn: props.disableScaleIn, + predefinedMetricSpecification: props.predefinedMetric !== undefined ? { + predefinedMetricType: props.predefinedMetric, + resourceLabel: props.resourceLabel, + } : undefined, + targetValue: props.targetValue, + }, + }); + + this.scalingPolicyArn = this.resource.ref; + } +} + +function renderCustomMetric(metric?: cloudwatch.IMetric): CfnScalingPolicy.CustomizedMetricSpecificationProperty | undefined { + if (!metric) { return undefined; } + const c = metric.toMetricConfig().metricStat!; + + return { + dimensions: c.dimensions, + metricName: c.metricName, + namespace: c.namespace, + statistic: c.statistic, + unit: c.unitFilter, + }; +} + +/** + * One of the predefined autoscaling metrics + */ +export enum PredefinedMetric { + /** + * Average CPU utilization of the Auto Scaling group + */ + ASG_AVERAGE_CPU_UTILIZATION = 'ASGAverageCPUUtilization', + + /** + * Average number of bytes received on all network interfaces by the Auto Scaling group + */ + ASG_AVERAGE_NETWORK_IN = 'ASGAverageNetworkIn', + + /** + * Average number of bytes sent out on all network interfaces by the Auto Scaling group + */ + ASG_AVERAGE_NETWORK_OUT = 'ASGAverageNetworkOut', + + /** + * Number of requests completed per target in an Application Load Balancer target group + * + * Specify the ALB to look at in the `resourceLabel` field. + */ + ALB_REQUEST_COUNT_PER_TARGET = 'ALBRequestCountPerTarget', +} diff --git a/packages/@aws-cdk/aws-autoscaling/lib/termination-policy.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/termination-policy.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/lib/termination-policy.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/termination-policy.ts diff --git a/packages/@aws-cdk/aws-autoscaling/lib/volume.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/volume.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/lib/volume.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/volume.ts diff --git a/packages/@aws-cdk/aws-autoscaling/lib/warm-pool.ts b/packages/aws-cdk-lib/aws-autoscaling/lib/warm-pool.ts similarity index 98% rename from packages/@aws-cdk/aws-autoscaling/lib/warm-pool.ts rename to packages/aws-cdk-lib/aws-autoscaling/lib/warm-pool.ts index c08b0fa45c38c..e30537ae9fc4a 100644 --- a/packages/@aws-cdk/aws-autoscaling/lib/warm-pool.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/lib/warm-pool.ts @@ -1,4 +1,4 @@ -import { Lazy, Names, Resource } from '@aws-cdk/core'; +import { Lazy, Names, Resource } from '../../core'; import { Construct } from 'constructs'; import { IAutoScalingGroup } from './auto-scaling-group'; import { CfnWarmPool } from './autoscaling.generated'; diff --git a/packages/aws-cdk-lib/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts new file mode 100644 index 0000000000000..8a8835f217865 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/test/aspects/require-imdsv2-aspect.test.ts @@ -0,0 +1,66 @@ +import { Annotations, Match, Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as cdk from '../../../core'; +import { + AutoScalingGroup, + AutoScalingGroupRequireImdsv2Aspect, + CfnLaunchConfiguration, +} from '../../lib'; + +describe('AutoScalingGroupRequireImdsv2Aspect', () => { + let app: cdk.App; + let stack: cdk.Stack; + let vpc: ec2.Vpc; + + beforeEach(() => { + app = new cdk.App(); + stack = new cdk.Stack(app, 'Stack'); + vpc = new ec2.Vpc(stack, 'Vpc'); + }); + + test('warns when metadataOptions is a token', () => { + // GIVEN + const asg = new AutoScalingGroup(stack, 'AutoScalingGroup', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ec2.MachineImage.latestAmazonLinux(), + }); + const launchConfig = asg.node.tryFindChild('LaunchConfig') as CfnLaunchConfiguration; + launchConfig.metadataOptions = cdk.Token.asAny({ + httpEndpoint: 'https://bla.com', + } as CfnLaunchConfiguration.MetadataOptionsProperty); + const aspect = new AutoScalingGroupRequireImdsv2Aspect(); + + // WHEN + cdk.Aspects.of(stack).add(aspect); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', Match.not({ + MetadataOptions: { + HttpTokens: 'required', + }, + })); + + Annotations.fromStack(stack).hasWarning('/Stack/AutoScalingGroup', Match.stringLikeRegexp('.*CfnLaunchConfiguration.MetadataOptions field is a CDK token.')); + }); + + test('requires IMDSv2', () => { + // GIVEN + new AutoScalingGroup(stack, 'AutoScalingGroup', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ec2.MachineImage.latestAmazonLinux(), + }); + const aspect = new AutoScalingGroupRequireImdsv2Aspect(); + + // WHEN + cdk.Aspects.of(stack).add(aspect); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + MetadataOptions: { + HttpTokens: 'required', + }, + }); + }); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/auto-scaling-group.test.ts similarity index 99% rename from packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts rename to packages/aws-cdk-lib/aws-autoscaling/test/auto-scaling-group.test.ts index 0ea23a5bb5c29..a052a51d8a877 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/test/auto-scaling-group.test.ts @@ -1,12 +1,12 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { AmazonLinuxCpuType, AmazonLinuxGeneration, AmazonLinuxImage, InstanceType, LaunchTemplate } from '@aws-cdk/aws-ec2'; -import { ApplicationListener, ApplicationLoadBalancer, ApplicationTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; +import { Annotations, Match, Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import { AmazonLinuxCpuType, AmazonLinuxGeneration, AmazonLinuxImage, InstanceType, LaunchTemplate } from '../../aws-ec2'; +import { ApplicationListener, ApplicationLoadBalancer, ApplicationTargetGroup } from '../../aws-elasticloadbalancingv2'; +import * as iam from '../../aws-iam'; +import * as sns from '../../aws-sns'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as autoscaling from '../lib'; import { OnDemandAllocationStrategy, SpotAllocationStrategy } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-autoscaling/test/cfn-init.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/cfn-init.test.ts new file mode 100644 index 0000000000000..0a8f1c5fd7944 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/test/cfn-init.test.ts @@ -0,0 +1,257 @@ +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import { Duration, Stack } from '../../core'; +import * as autoscaling from '../lib'; + +interface BaseProps { + vpc: ec2.Vpc; + machineImage: ec2.IMachineImage; + instanceType: ec2.InstanceType; + desiredCapacity: number; + minCapacity: number; +} + +let stack: Stack; +let vpc: ec2.Vpc; +let baseProps: BaseProps; + +beforeEach(() => { + stack = new Stack(); + vpc = new ec2.Vpc(stack, 'Vpc'); + + baseProps = { + vpc, + machineImage: new ec2.AmazonLinuxImage(), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO), + desiredCapacity: 5, + minCapacity: 2, + }; +}); + +test('Signals.waitForAll uses desiredCapacity if available', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + signals: autoscaling.Signals.waitForAll(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + CreationPolicy: { + ResourceSignal: { + Count: 5, + }, + }, + }); +}); + +test('Signals.waitForAll uses minCapacity if desiredCapacity is not available', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + desiredCapacity: undefined, + signals: autoscaling.Signals.waitForAll(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + CreationPolicy: { + ResourceSignal: { + Count: 2, + }, + }, + }); +}); + +test('Signals.waitForMinCapacity uses minCapacity', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + signals: autoscaling.Signals.waitForMinCapacity(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + CreationPolicy: { + ResourceSignal: { + Count: 2, + }, + }, + }); +}); + +test('Signals.waitForCount uses given number', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + signals: autoscaling.Signals.waitForCount(10), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + CreationPolicy: { + ResourceSignal: { + Count: 10, + }, + }, + }); +}); + +test('When signals are given appropriate IAM policy is added', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + signals: autoscaling.Signals.waitForAll(), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: 'cloudformation:SignalResource', + Effect: 'Allow', + Resource: { Ref: 'AWS::StackId' }, + }]), + }, + }); +}); + +test('UpdatePolicy.rollingUpdate() still correctly inserts IgnoreUnmodifiedGroupSizeProperties', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingScheduledAction: { + IgnoreUnmodifiedGroupSizeProperties: true, + }, + }, + }); +}); + +test('UpdatePolicy.rollingUpdate() with Signals uses those defaults', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + signals: autoscaling.Signals.waitForCount(10, { + minSuccessPercentage: 50, + timeout: Duration.minutes(30), + }), + updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + CreationPolicy: { + AutoScalingCreationPolicy: { + MinSuccessfulInstancesPercent: 50, + }, + ResourceSignal: { + Count: 10, + Timeout: 'PT30M', + }, + }, + UpdatePolicy: { + AutoScalingRollingUpdate: { + MinSuccessfulInstancesPercent: 50, + PauseTime: 'PT30M', + WaitOnResourceSignals: true, + }, + }, + }); +}); + +test('UpdatePolicy.rollingUpdate() without Signals', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + updatePolicy: autoscaling.UpdatePolicy.rollingUpdate(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingRollingUpdate: { + }, + }, + }); +}); + +test('UpdatePolicy.replacingUpdate() renders correct UpdatePolicy', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); +}); + +test('Using init config in ASG leads to default updatepolicy', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + init: ec2.CloudFormationInit.fromElements( + ec2.InitCommand.shellCommand('echo hihi'), + ), + signals: autoscaling.Signals.waitForAll(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingRollingUpdate: Match.anyValue(), + }, + }); +}); + +test('Using init config in ASG leads to correct UserData and permissions', () => { + // WHEN + new autoscaling.AutoScalingGroup(stack, 'Asg', { + ...baseProps, + init: ec2.CloudFormationInit.fromElements( + ec2.InitCommand.shellCommand('echo hihi'), + ), + signals: autoscaling.Signals.waitForAll(), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + UserData: { + 'Fn::Base64': { + 'Fn::Join': ['', [ + '#!/bin/bash\n# fingerprint: 593c357d7f305b75\n(\n set +e\n /opt/aws/bin/cfn-init -v --region ', + { Ref: 'AWS::Region' }, + ' --stack ', + { Ref: 'AWS::StackName' }, + ' --resource AsgASGD1D7B4E2 -c default\n /opt/aws/bin/cfn-signal -e $? --region ', + { Ref: 'AWS::Region' }, + ' --stack ', + { Ref: 'AWS::StackName' }, + ' --resource AsgASGD1D7B4E2\n cat /var/log/cfn-init.log >&2\n)', + ]], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['cloudformation:DescribeStackResource', 'cloudformation:SignalResource'], + Effect: 'Allow', + Resource: { Ref: 'AWS::StackId' }, + }]), + }, + }); +}); diff --git a/packages/@aws-cdk/aws-autoscaling/test/cron.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/cron.test.ts similarity index 100% rename from packages/@aws-cdk/aws-autoscaling/test/cron.test.ts rename to packages/aws-cdk-lib/aws-autoscaling/test/cron.test.ts diff --git a/packages/@aws-cdk/aws-autoscaling/test/example.images.lit.ts b/packages/aws-cdk-lib/aws-autoscaling/test/example.images.lit.ts similarity index 95% rename from packages/@aws-cdk/aws-autoscaling/test/example.images.lit.ts rename to packages/aws-cdk-lib/aws-autoscaling/test/example.images.lit.ts index 3439dc7c1f7f1..76e24dd22a539 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/example.images.lit.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/test/example.images.lit.ts @@ -1,4 +1,4 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from '../../aws-ec2'; /// !show // Pick a Windows edition to use diff --git a/packages/@aws-cdk/aws-autoscaling/test/lifecyclehooks.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/lifecyclehooks.test.ts similarity index 97% rename from packages/@aws-cdk/aws-autoscaling/test/lifecyclehooks.test.ts rename to packages/aws-cdk-lib/aws-autoscaling/test/lifecyclehooks.test.ts index 2cecb8b227107..2b49c8a7368cc 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/lifecyclehooks.test.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/test/lifecyclehooks.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as constructs from 'constructs'; import * as autoscaling from '../lib'; diff --git a/packages/aws-cdk-lib/aws-autoscaling/test/scaling.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/scaling.test.ts new file mode 100644 index 0000000000000..812370f9b002e --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscaling/test/scaling.test.ts @@ -0,0 +1,344 @@ +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import * as autoscaling from '../lib'; + +describe('scaling', () => { + describe('target tracking policies', () => { + test('cpu utilization', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleOnCpuUtilization('ScaleCpu', { + targetUtilizationPercent: 30, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingConfiguration: { + PredefinedMetricSpecification: { PredefinedMetricType: 'ASGAverageCPUUtilization' }, + TargetValue: 30, + }, + }); + }); + + test('network ingress', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleOnIncomingBytes('ScaleNetwork', { + targetBytesPerSecond: 100, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingConfiguration: { + PredefinedMetricSpecification: { PredefinedMetricType: 'ASGAverageNetworkIn' }, + TargetValue: 100, + }, + }); + }); + + test('network egress', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleOnOutgoingBytes('ScaleNetwork', { + targetBytesPerSecond: 100, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingConfiguration: { + PredefinedMetricSpecification: { PredefinedMetricType: 'ASGAverageNetworkOut' }, + TargetValue: 100, + }, + }); + }); + + test('request count per second', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + const alb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', { vpc: fixture.vpc }); + const listener = alb.addListener('Listener', { port: 80 }); + listener.addTargets('Targets', { + port: 80, + targets: [fixture.asg], + }); + + // WHEN + fixture.asg.scaleOnRequestCount('ScaleRequest', { + targetRequestsPerSecond: 10, + }); + + // THEN + const arnParts = { + 'Fn::Split': [ + '/', + { Ref: 'ALBListener3B99FF85' }, + ], + }; + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingConfiguration: { + TargetValue: 600, + PredefinedMetricSpecification: { + PredefinedMetricType: 'ALBRequestCountPerTarget', + ResourceLabel: { + 'Fn::Join': ['', [ + { 'Fn::Select': [1, arnParts] }, + '/', + { 'Fn::Select': [2, arnParts] }, + '/', + { 'Fn::Select': [3, arnParts] }, + '/', + { 'Fn::GetAtt': ['ALBListenerTargetsGroup01D7716A', 'TargetGroupFullName'] }, + ]], + }, + }, + }, + }); + }); + + test('request count per minute', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + const alb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', { vpc: fixture.vpc }); + const listener = alb.addListener('Listener', { port: 80 }); + listener.addTargets('Targets', { + port: 80, + targets: [fixture.asg], + }); + + // WHEN + fixture.asg.scaleOnRequestCount('ScaleRequest', { + targetRequestsPerMinute: 10, + }); + + // THEN + const arnParts = { + 'Fn::Split': [ + '/', + { Ref: 'ALBListener3B99FF85' }, + ], + }; + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingConfiguration: { + TargetValue: 10, + PredefinedMetricSpecification: { + PredefinedMetricType: 'ALBRequestCountPerTarget', + ResourceLabel: { + 'Fn::Join': ['', [ + { 'Fn::Select': [1, arnParts] }, + '/', + { 'Fn::Select': [2, arnParts] }, + '/', + { 'Fn::Select': [3, arnParts] }, + '/', + { 'Fn::GetAtt': ['ALBListenerTargetsGroup01D7716A', 'TargetGroupFullName'] }, + ]], + }, + }, + }, + }); + }); + + test('custom metric', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleToTrackMetric('Metric', { + metric: new cloudwatch.Metric({ + metricName: 'Henk', + namespace: 'Test', + dimensionsMap: { + Mustache: 'Bushy', + }, + }), + targetValue: 2, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingConfiguration: { + CustomizedMetricSpecification: { + Dimensions: [{ Name: 'Mustache', Value: 'Bushy' }], + MetricName: 'Henk', + Namespace: 'Test', + Statistic: 'Average', + }, + TargetValue: 2, + }, + }); + }); + }); + + test('step scaling', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleOnMetric('Metric', { + metric: new cloudwatch.Metric({ + metricName: 'Legs', + namespace: 'Henk', + dimensionsMap: { Mustache: 'Bushy' }, + }), + estimatedInstanceWarmup: cdk.Duration.seconds(150), + // Adjust the number of legs to be closer to 2 + scalingSteps: [ + { lower: 0, upper: 2, change: +1 }, + { lower: 3, upper: 5, change: -1 }, + { lower: 5, change: -2 }, // Must work harder to remove legs + ], + }); + + // THEN: scaling in policy + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + MetricAggregationType: 'Average', + PolicyType: 'StepScaling', + StepAdjustments: [ + { + MetricIntervalLowerBound: 0, + MetricIntervalUpperBound: 2, + ScalingAdjustment: -1, + }, + { + MetricIntervalLowerBound: 2, + ScalingAdjustment: -2, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + ComparisonOperator: 'GreaterThanOrEqualToThreshold', + Threshold: 3, + AlarmActions: [{ Ref: 'FixtureASGMetricUpperPolicyC464CAFB' }], + AlarmDescription: 'Upper threshold scaling alarm', + }); + + // THEN: scaling out policy + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + MetricAggregationType: 'Average', + PolicyType: 'StepScaling', + EstimatedInstanceWarmup: 150, + StepAdjustments: [ + { + MetricIntervalUpperBound: 0, + ScalingAdjustment: 1, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + ComparisonOperator: 'LessThanOrEqualToThreshold', + Threshold: 2, + AlarmActions: [{ Ref: 'FixtureASGMetricLowerPolicy4A1CDE42' }], + AlarmDescription: 'Lower threshold scaling alarm', + }); + }); +}); + +test('step scaling from percentile metric', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleOnMetric('Tracking', { + metric: new cloudwatch.Metric({ namespace: 'Test', metricName: 'Metric', statistic: 'p99' }), + scalingSteps: [ + { upper: 0, change: -1 }, + { lower: 100, change: +1 }, + { lower: 500, change: +5 }, + ], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'StepScaling', + MetricAggregationType: 'Average', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + ComparisonOperator: 'GreaterThanOrEqualToThreshold', + EvaluationPeriods: 1, + AlarmActions: [ + { Ref: 'FixtureASGTrackingUpperPolicy27D4301F' }, + ], + ExtendedStatistic: 'p99', + MetricName: 'Metric', + Namespace: 'Test', + Threshold: 100, + }); +}); + +test('step scaling with evaluation period configured', () => { + // GIVEN + const stack = new cdk.Stack(); + const fixture = new ASGFixture(stack, 'Fixture'); + + // WHEN + fixture.asg.scaleOnMetric('Tracking', { + metric: new cloudwatch.Metric({ namespace: 'Test', metricName: 'Metric', statistic: 'p99' }), + scalingSteps: [ + { upper: 0, change: -1 }, + { lower: 100, change: +1 }, + { lower: 500, change: +5 }, + ], + evaluationPeriods: 10, + metricAggregationType: autoscaling.MetricAggregationType.MAXIMUM, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::ScalingPolicy', { + PolicyType: 'StepScaling', + MetricAggregationType: 'Maximum', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + ComparisonOperator: 'GreaterThanOrEqualToThreshold', + EvaluationPeriods: 10, + ExtendedStatistic: 'p99', + MetricName: 'Metric', + Namespace: 'Test', + Threshold: 100, + }); +}); + +class ASGFixture extends Construct { + public readonly vpc: ec2.Vpc; + public readonly asg: autoscaling.AutoScalingGroup; + + constructor(scope: Construct, id: string) { + super(scope, id); + + this.vpc = new ec2.Vpc(this, 'VPC'); + this.asg = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc: this.vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.MICRO), + machineImage: new ec2.AmazonLinuxImage(), + }); + } +} diff --git a/packages/@aws-cdk/aws-autoscaling/test/scheduled-action.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/scheduled-action.test.ts similarity index 97% rename from packages/@aws-cdk/aws-autoscaling/test/scheduled-action.test.ts rename to packages/aws-cdk-lib/aws-autoscaling/test/scheduled-action.test.ts index ad721317b6a67..9b57c026052ff 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/scheduled-action.test.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/test/scheduled-action.test.ts @@ -1,7 +1,7 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; +import { Annotations, Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as constructs from 'constructs'; import * as autoscaling from '../lib'; diff --git a/packages/@aws-cdk/aws-autoscaling/test/warm-pool.test.ts b/packages/aws-cdk-lib/aws-autoscaling/test/warm-pool.test.ts similarity index 94% rename from packages/@aws-cdk/aws-autoscaling/test/warm-pool.test.ts rename to packages/aws-cdk-lib/aws-autoscaling/test/warm-pool.test.ts index 041feac6ce30b..3004a5fe7f10f 100644 --- a/packages/@aws-cdk/aws-autoscaling/test/warm-pool.test.ts +++ b/packages/aws-cdk-lib/aws-autoscaling/test/warm-pool.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import * as autoscaling from '../lib'; describe('warm pool', () => { diff --git a/packages/aws-cdk-lib/aws-autoscalingplans/.jsiirc.json b/packages/aws-cdk-lib/aws-autoscalingplans/.jsiirc.json new file mode 100644 index 0000000000000..9509f5fc46b50 --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscalingplans/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.autoscalingplans" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.AutoScalingPlans" + }, + "python": { + "module": "aws_cdk.aws_autoscalingplans" + } + } +} diff --git a/packages/aws-cdk-lib/aws-autoscalingplans/README.md b/packages/aws-cdk-lib/aws-autoscalingplans/README.md new file mode 100644 index 0000000000000..647ca43a30d9c --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscalingplans/README.md @@ -0,0 +1,27 @@ +# AWS Auto Scaling Plans Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as autoscalingplans from 'aws-cdk-lib/aws-autoscalingplans'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for AutoScalingPlans construct libraries](https://constructs.dev/search?q=autoscalingplans) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::AutoScalingPlans resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AutoScalingPlans.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::AutoScalingPlans](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_AutoScalingPlans.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-autoscalingplans/index.ts b/packages/aws-cdk-lib/aws-autoscalingplans/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscalingplans/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-autoscalingplans/lib/index.ts b/packages/aws-cdk-lib/aws-autoscalingplans/lib/index.ts new file mode 100644 index 0000000000000..45256e3268d4e --- /dev/null +++ b/packages/aws-cdk-lib/aws-autoscalingplans/lib/index.ts @@ -0,0 +1 @@ +export * from './autoscalingplans.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-backup/.jsiirc.json b/packages/aws-cdk-lib/aws-backup/.jsiirc.json new file mode 100644 index 0000000000000..b3af29709fd7e --- /dev/null +++ b/packages/aws-cdk-lib/aws-backup/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Backup" + }, + "java": { + "package": "software.amazon.awscdk.services.backup" + }, + "python": { + "module": "aws_cdk.aws_backup" + } + } +} diff --git a/packages/aws-cdk-lib/aws-backup/README.md b/packages/aws-cdk-lib/aws-backup/README.md new file mode 100644 index 0000000000000..ca7848bd82916 --- /dev/null +++ b/packages/aws-cdk-lib/aws-backup/README.md @@ -0,0 +1,225 @@ +# AWS Backup Construct Library + + +AWS Backup is a fully managed backup service that makes it easy to centralize and automate the +backup of data across AWS services in the cloud and on premises. Using AWS Backup, you can +configure backup policies and monitor backup activity for your AWS resources in one place. + +## Backup plan and selection + +In AWS Backup, a *backup plan* is a policy expression that defines when and how you want to back up + your AWS resources, such as Amazon DynamoDB tables or Amazon Elastic File System (Amazon EFS) file + systems. You can assign resources to backup plans, and AWS Backup automatically backs up and retains + backups for those resources according to the backup plan. You can create multiple backup plans if you + have workloads with different backup requirements. + +This module provides ready-made backup plans (similar to the console experience): + +```ts +// Daily, weekly and monthly with 5 year retention +const plan = backup.BackupPlan.dailyWeeklyMonthly5YearRetention(this, 'Plan'); +``` + +Assigning resources to a plan can be done with `addSelection()`: + +```ts +declare const plan: backup.BackupPlan; +declare const vpc: ec2.Vpc; +const myTable = dynamodb.Table.fromTableName(this, 'Table', 'myTableName'); +const myDatabaseInstance = new rds.DatabaseInstance(this, 'DatabaseInstance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_26 }), + vpc, +}); +const myDatabaseCluster = new rds.DatabaseCluster(this, 'DatabaseCluster', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), + credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'), + instanceProps: { + vpc, + }, +}); +const myServerlessCluster = new rds.ServerlessCluster(this, 'ServerlessCluster', { + engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL, + parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql10'), + vpc, +}); +const myCoolConstruct = new Construct(this, 'MyCoolConstruct'); + +plan.addSelection('Selection', { + resources: [ + backup.BackupResource.fromDynamoDbTable(myTable), // A DynamoDB table + backup.BackupResource.fromRdsDatabaseInstance(myDatabaseInstance), // A RDS instance + backup.BackupResource.fromRdsDatabaseCluster(myDatabaseCluster), // A RDS database cluster + backup.BackupResource.fromRdsServerlessCluster(myServerlessCluster), // An Aurora Serverless cluster + backup.BackupResource.fromTag('stage', 'prod'), // All resources that are tagged stage=prod in the region/account + backup.BackupResource.fromConstruct(myCoolConstruct), // All backupable resources in `myCoolConstruct` + ] +}) +``` + +If not specified, a new IAM role with a managed policy for backup will be +created for the selection. The `BackupSelection` implements `IGrantable`. + +To add rules to a plan, use `addRule()`: + +```ts +declare const plan: backup.BackupPlan; +plan.addRule(new backup.BackupPlanRule({ + completionWindow: Duration.hours(2), + startWindow: Duration.hours(1), + scheduleExpression: events.Schedule.cron({ // Only cron expressions are supported + day: '15', + hour: '3', + minute: '30', + }), + moveToColdStorageAfter: Duration.days(30), +})); +``` + +Continuous backup and point-in-time restores (PITR) can be configured. +Property `deleteAfter` defines the retention period for the backup. It is mandatory if PITR is enabled. +If no value is specified, the retention period is set to 35 days which is the maximum retention period supported by PITR. +Property `moveToColdStorageAfter` must not be specified because PITR does not support this option. +This example defines an AWS Backup rule with PITR and a retention period set to 14 days: + +```ts +declare const plan: backup.BackupPlan; +plan.addRule(new backup.BackupPlanRule({ + enableContinuousBackup: true, + deleteAfter: Duration.days(14), +})); +``` + +Rules can also specify to copy recovery points to another Backup Vault using `copyActions`. Copied recovery points can +optionally have `moveToColdStorageAfter` and `deleteAfter` configured. + +```ts +declare const plan: backup.BackupPlan; +declare const secondaryVault: backup.BackupVault; +plan.addRule(new backup.BackupPlanRule({ + copyActions: [{ + destinationBackupVault: secondaryVault, + moveToColdStorageAfter: Duration.days(30), + deleteAfter: Duration.days(120), + }] +})); +``` + +Ready-made rules are also available: + +```ts +declare const plan: backup.BackupPlan; +plan.addRule(backup.BackupPlanRule.daily()); +plan.addRule(backup.BackupPlanRule.weekly()); +``` + +By default a new [vault](#Backup-vault) is created when creating a plan. +It is also possible to specify a vault either at the plan level or at the +rule level. + +```ts +const myVault = backup.BackupVault.fromBackupVaultName(this, 'Vault1', 'myVault'); +const otherVault = backup.BackupVault.fromBackupVaultName(this, 'Vault2', 'otherVault'); + +const plan = backup.BackupPlan.daily35DayRetention(this, 'Plan', myVault); // Use `myVault` for all plan rules +plan.addRule(backup.BackupPlanRule.monthly1Year(otherVault)); // Use `otherVault` for this specific rule +``` + +You can [backup](https://docs.aws.amazon.com/aws-backup/latest/devguide/windows-backups.html) +VSS-enabled Windows applications running on Amazon EC2 instances by setting the `windowsVss` +parameter to `true`. If the application has VSS writer registered with Windows VSS, +then AWS Backup creates a snapshot that will be consistent for that application. + +```ts +const plan = new backup.BackupPlan(this, 'Plan', { + windowsVss: true, +}); +``` + +## Backup vault + +In AWS Backup, a *backup vault* is a container that you organize your backups in. You can use backup +vaults to set the AWS Key Management Service (AWS KMS) encryption key that is used to encrypt backups +in the backup vault and to control access to the backups in the backup vault. If you require different +encryption keys or access policies for different groups of backups, you can optionally create multiple +backup vaults. + +```ts +const myKey = kms.Key.fromKeyArn(this, 'MyKey', 'aaa'); +const myTopic = sns.Topic.fromTopicArn(this, 'MyTopic', 'bbb'); + +const vault = new backup.BackupVault(this, 'Vault', { + encryptionKey: myKey, // Custom encryption key + notificationTopic: myTopic, // Send all vault events to this SNS topic +}); +``` + +A vault has a default `RemovalPolicy` set to `RETAIN`. Note that removing a vault +that contains recovery points will fail. + +You can assign policies to backup vaults and the resources they contain. Assigning policies allows +you to do things like grant access to users to create backup plans and on-demand backups, but limit +their ability to delete recovery points after they're created. + +Use the `accessPolicy` property to create a backup vault policy: + +```ts +const vault = new backup.BackupVault(this, 'Vault', { + accessPolicy: new iam.PolicyDocument({ + statements: [ + new iam.PolicyStatement({ + effect: iam.Effect.DENY, + principals: [new iam.AnyPrincipal()], + actions: ['backup:DeleteRecoveryPoint'], + resources: ['*'], + conditions: { + StringNotLike: { + 'aws:userId': [ + 'user1', + 'user2', + ], + }, + }, + }), + ], + }), +}) +``` + +Alternativately statements can be added to the vault policy using `addToAccessPolicy()`. + +Use the `blockRecoveryPointDeletion` property or the `blockRecoveryPointDeletion()` method to add +a statement to the vault access policy that prevents recovery point deletions in your vault: + +```ts +new backup.BackupVault(this, 'Vault', { + blockRecoveryPointDeletion: true, +}); + +declare const backupVault: backup.BackupVault; +backupVault.blockRecoveryPointDeletion(); +``` + +By default access is not restricted. + +Use the `lockConfiguration` property to enable [AWS Backup Vault Lock](https://docs.aws.amazon.com/aws-backup/latest/devguide/vault-lock.html): + +```ts +new BackupVault(stack, 'Vault', { + lockConfiguration: { + minRetention: Duration.days(30), + }, +}); +``` + +## Importing existing backup vault + +To import an existing backup vault into your CDK application, use the `BackupVault.fromBackupVaultArn` or `BackupVault.fromBackupVaultName` +static method. Here is an example of giving an IAM Role permission to start a backup job: + +```ts +const importedVault = backup.BackupVault.fromBackupVaultName(this, 'Vault', 'myVaultName'); + +const role = new iam.Role(this, 'Access Role', { assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com') }); + +importedVault.grant(role, 'backup:StartBackupJob'); +``` diff --git a/packages/aws-cdk-lib/aws-backup/index.ts b/packages/aws-cdk-lib/aws-backup/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-backup/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-backup/lib/backupable-resources-collector.ts b/packages/aws-cdk-lib/aws-backup/lib/backupable-resources-collector.ts similarity index 87% rename from packages/@aws-cdk/aws-backup/lib/backupable-resources-collector.ts rename to packages/aws-cdk-lib/aws-backup/lib/backupable-resources-collector.ts index 7dc5bbdf5efdb..a05beedcba59f 100644 --- a/packages/@aws-cdk/aws-backup/lib/backupable-resources-collector.ts +++ b/packages/aws-cdk-lib/aws-backup/lib/backupable-resources-collector.ts @@ -1,8 +1,8 @@ -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as rds from '@aws-cdk/aws-rds'; -import { ArnFormat, IAspect, Stack } from '@aws-cdk/core'; +import * as dynamodb from '../../aws-dynamodb'; +import * as ec2 from '../../aws-ec2'; +import * as efs from '../../aws-efs'; +import * as rds from '../../aws-rds'; +import { ArnFormat, IAspect, Stack } from '../../core'; import { IConstruct } from 'constructs'; export class BackupableResourcesCollector implements IAspect { diff --git a/packages/@aws-cdk/aws-backup/lib/index.ts b/packages/aws-cdk-lib/aws-backup/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-backup/lib/index.ts rename to packages/aws-cdk-lib/aws-backup/lib/index.ts diff --git a/packages/@aws-cdk/aws-backup/lib/plan.ts b/packages/aws-cdk-lib/aws-backup/lib/plan.ts similarity index 99% rename from packages/@aws-cdk/aws-backup/lib/plan.ts rename to packages/aws-cdk-lib/aws-backup/lib/plan.ts index fd80dbb20d6b9..d01e9754ee1f7 100644 --- a/packages/@aws-cdk/aws-backup/lib/plan.ts +++ b/packages/aws-cdk-lib/aws-backup/lib/plan.ts @@ -1,4 +1,4 @@ -import { IResource, Lazy, Resource } from '@aws-cdk/core'; +import { IResource, Lazy, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnBackupPlan } from './backup.generated'; import { BackupPlanCopyActionProps, BackupPlanRule } from './rule'; diff --git a/packages/aws-cdk-lib/aws-backup/lib/resource.ts b/packages/aws-cdk-lib/aws-backup/lib/resource.ts new file mode 100644 index 0000000000000..0378b091b72a2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-backup/lib/resource.ts @@ -0,0 +1,155 @@ +import * as dynamodb from '../../aws-dynamodb'; +import * as ec2 from '../../aws-ec2'; +import * as efs from '../../aws-efs'; +import * as rds from '../../aws-rds'; +import { Stack } from '../../core'; +import { Construct } from 'constructs'; + +/** + * An operation that is applied to a key-value pair + */ +export enum TagOperation { + /** + * StringEquals + */ + STRING_EQUALS = 'STRINGEQUALS', + + /** + * Dummy member + */ + DUMMY = 'dummy' +} + +/** + * A tag condition + */ +export interface TagCondition { + /** + * The key in a key-value pair. + * + * For example, in `"ec2:ResourceTag/Department": "accounting"`, + * `ec2:ResourceTag/Department` is the key. + */ + readonly key: string; + + /** + * An operation that is applied to a key-value pair used to filter + * resources in a selection. + * + * @default STRING_EQUALS + */ + readonly operation?: TagOperation; + + /** + * The value in a key-value pair. + * + * For example, in `"ec2:ResourceTag/Department": "accounting"`, + * `accounting` is the value. + */ + readonly value: string; +} + +/** + * A resource to backup + */ +export class BackupResource { + /** + * Adds all supported resources in a construct + * + * @param construct The construct containing resources to backup + */ + public static fromConstruct(construct: Construct) { + return new BackupResource(undefined, undefined, construct); + } + + /** + * A DynamoDB table + */ + public static fromDynamoDbTable(table: dynamodb.ITable) { + return BackupResource.fromArn(table.tableArn); + } + + /** + * An EC2 instance + */ + public static fromEc2Instance(instance: ec2.IInstance) { + return BackupResource.fromArn(Stack.of(instance).formatArn({ + service: 'ec2', + resource: 'instance', + resourceName: instance.instanceId, + })); + } + + /** + * An EFS file system + */ + public static fromEfsFileSystem(fileSystem: efs.IFileSystem) { + return BackupResource.fromArn(Stack.of(fileSystem).formatArn({ + service: 'elasticfilesystem', + resource: 'file-system', + resourceName: fileSystem.fileSystemId, + })); + } + + /** + * A RDS database instance + */ + public static fromRdsDatabaseInstance(instance: rds.IDatabaseInstance) { + return BackupResource.fromArn(instance.instanceArn); + } + + /** + * A RDS database cluter + */ + public static fromRdsDatabaseCluster(cluster: rds.IDatabaseCluster) { + const stack = Stack.of(cluster); + return BackupResource.fromArn(`arn:${stack.partition}:rds:${stack.region}:${stack.account}:cluster:${cluster.clusterIdentifier}`); + } + + /** + * An Aurora database instance + */ + public static fromRdsServerlessCluster(cluster: rds.IServerlessCluster) { + return BackupResource.fromArn(cluster.clusterArn); + } + + /** + * A list of ARNs or match patterns such as + * `arn:aws:ec2:us-east-1:123456789012:volume/*` + */ + public static fromArn(arn: string) { + return new BackupResource(arn); + } + + /** + * A tag condition + */ + public static fromTag(key: string, value: string, operation?: TagOperation) { + return new BackupResource(undefined, { + key, + value, + operation, + }); + } + + /** + * A resource + */ + public readonly resource?: string; + + /** + * A condition on a tag + */ + public readonly tagCondition?: TagCondition; + + /** + * A construct + */ + public readonly construct?: Construct; + + constructor(resource?: string, tagCondition?: TagCondition, construct?: Construct) { + this.resource = resource; + this.tagCondition = tagCondition; + this.construct = construct; + } +} diff --git a/packages/aws-cdk-lib/aws-backup/lib/rule.ts b/packages/aws-cdk-lib/aws-backup/lib/rule.ts new file mode 100644 index 0000000000000..e386a8d52bcfa --- /dev/null +++ b/packages/aws-cdk-lib/aws-backup/lib/rule.ts @@ -0,0 +1,239 @@ +import * as events from '../../aws-events'; +import { Duration, Token } from '../../core'; +import { IBackupVault } from './vault'; + +/** + * Properties for a BackupPlanRule + */ +export interface BackupPlanRuleProps { + /** + * The duration after a backup job is successfully started before it must be + * completed or it is canceled by AWS Backup. + * + * @default - 8 hours + */ + readonly completionWindow?: Duration; + + /** + * Specifies the duration after creation that a recovery point is deleted. + * Must be greater than `moveToColdStorageAfter`. + * + * @default - recovery point is never deleted + */ + readonly deleteAfter?: Duration; + + /** + * Specifies the duration after creation that a recovery point is moved to cold + * storage. + * + * @default - recovery point is never moved to cold storage + */ + readonly moveToColdStorageAfter?: Duration; + + /** + * A display name for the backup rule. + * + * @default - a CDK generated name + */ + readonly ruleName?: string; + + /** + * A CRON expression specifying when AWS Backup initiates a backup job. + * + * @default - no schedule + */ + readonly scheduleExpression?: events.Schedule; + + /** + * The duration after a backup is scheduled before a job is canceled if it doesn't start successfully. + * + * @default - 8 hours + */ + readonly startWindow?: Duration; + + /** + * The backup vault where backups are + * + * @default - use the vault defined at the plan level. If not defined a new + * common vault for the plan will be created + */ + readonly backupVault?: IBackupVault; + + /** + * Enables continuous backup and point-in-time restores (PITR). + * + * Property `deleteAfter` defines the retention period for the backup. It is mandatory if PITR is enabled. + * If no value is specified, the retention period is set to 35 days which is the maximum retention period supported by PITR. + * + * Property `moveToColdStorageAfter` must not be specified because PITR does not support this option. + * + * @default false + */ + readonly enableContinuousBackup?: boolean; + + /** + * Copy operations to perform on recovery points created by this rule + * + * @default - no copy actions + */ + readonly copyActions?: BackupPlanCopyActionProps[]; +} + +/** + * Properties for a BackupPlanCopyAction + */ +export interface BackupPlanCopyActionProps { + /** + * Destination Vault for recovery points to be copied into + */ + readonly destinationBackupVault: IBackupVault; + + /** + * Specifies the duration after creation that a copied recovery point is deleted from the destination vault. + * Must be at least 90 days greater than `moveToColdStorageAfter`, if specified. + * + * @default - recovery point is never deleted + */ + readonly deleteAfter?: Duration; + + /** + * Specifies the duration after creation that a copied recovery point is moved to cold storage. + * + * @default - recovery point is never moved to cold storage + */ + readonly moveToColdStorageAfter?: Duration; +} + +/** + * A backup plan rule + */ +export class BackupPlanRule { + /** + * Daily with 35 days retention + */ + public static daily(backupVault?: IBackupVault) { + return new BackupPlanRule({ + backupVault, + ruleName: 'Daily', + scheduleExpression: events.Schedule.cron({ + hour: '5', + minute: '0', + }), + deleteAfter: Duration.days(35), + }); + } + + /** + * Weekly with 3 months retention + */ + public static weekly(backupVault?: IBackupVault) { + return new BackupPlanRule({ + backupVault, + ruleName: 'Weekly', + scheduleExpression: events.Schedule.cron({ + hour: '5', + minute: '0', + weekDay: 'SAT', + }), + deleteAfter: Duration.days(30 * 3), + }); + } + + /** + * Monthly 1 year retention, move to cold storage after 1 month + */ + public static monthly1Year(backupVault?: IBackupVault) { + return new BackupPlanRule({ + backupVault, + ruleName: 'Monthly1Year', + scheduleExpression: events.Schedule.cron({ + day: '1', + hour: '5', + minute: '0', + }), + moveToColdStorageAfter: Duration.days(30), + deleteAfter: Duration.days(365), + }); + } + + /** + * Monthly 5 year retention, move to cold storage after 3 months + */ + public static monthly5Year(backupVault?: IBackupVault) { + return new BackupPlanRule({ + backupVault, + ruleName: 'Monthly5Year', + scheduleExpression: events.Schedule.cron({ + day: '1', + hour: '5', + minute: '0', + }), + moveToColdStorageAfter: Duration.days(30 * 3), + deleteAfter: Duration.days(365 * 5), + }); + } + + /** + * Monthly 7 year retention, move to cold storage after 3 months + */ + public static monthly7Year(backupVault?: IBackupVault) { + return new BackupPlanRule({ + backupVault, + ruleName: 'Monthly7Year', + scheduleExpression: events.Schedule.cron({ + day: '1', + hour: '5', + minute: '0', + }), + moveToColdStorageAfter: Duration.days(30 * 3), + deleteAfter: Duration.days(365 * 7), + }); + } + + /** + * Properties of BackupPlanRule + */ + public readonly props: BackupPlanRuleProps + + /** @param props Rule properties */ + constructor(props: BackupPlanRuleProps) { + if (props.deleteAfter && props.moveToColdStorageAfter && + props.deleteAfter.toDays() < props.moveToColdStorageAfter.toDays()) { + throw new Error('`deleteAfter` must be greater than `moveToColdStorageAfter`'); + } + + if (props.scheduleExpression && !/^cron/.test(props.scheduleExpression.expressionString)) { + throw new Error('`scheduleExpression` must be of type `cron`'); + } + + const deleteAfter = (props.enableContinuousBackup && !props.deleteAfter) ? Duration.days(35) : props.deleteAfter; + + if (props.enableContinuousBackup && props.moveToColdStorageAfter) { + throw new Error('`moveToColdStorageAfter` must not be specified if `enableContinuousBackup` is enabled'); + } + + if (props.enableContinuousBackup && props.deleteAfter && + (props.deleteAfter?.toDays() < 1 || props.deleteAfter?.toDays() > 35)) { + throw new Error(`'deleteAfter' must be between 1 and 35 days if 'enableContinuousBackup' is enabled, but got ${props.deleteAfter.toHumanString()}`); + } + + if (props.copyActions && props.copyActions.length > 0) { + props.copyActions.forEach(copyAction => { + if (copyAction.deleteAfter && !Token.isUnresolved(copyAction.deleteAfter) && + copyAction.moveToColdStorageAfter && !Token.isUnresolved(copyAction.moveToColdStorageAfter) && + copyAction.deleteAfter.toDays() < copyAction.moveToColdStorageAfter.toDays() + 90) { + throw new Error([ + '\'deleteAfter\' must at least 90 days later than corresponding \'moveToColdStorageAfter\'', + `received 'deleteAfter: ${copyAction.deleteAfter.toDays()}' and 'moveToColdStorageAfter: ${copyAction.moveToColdStorageAfter.toDays()}'`, + ].join('\n')); + } + }); + } + + this.props = { + ...props, + deleteAfter, + }; + + } +} diff --git a/packages/@aws-cdk/aws-backup/lib/selection.ts b/packages/aws-cdk-lib/aws-backup/lib/selection.ts similarity index 97% rename from packages/@aws-cdk/aws-backup/lib/selection.ts rename to packages/aws-cdk-lib/aws-backup/lib/selection.ts index 401af8314b6e1..6517c2dabec96 100644 --- a/packages/@aws-cdk/aws-backup/lib/selection.ts +++ b/packages/aws-cdk-lib/aws-backup/lib/selection.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Lazy, Resource, Aspects } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Lazy, Resource, Aspects } from '../../core'; import { Construct } from 'constructs'; import { CfnBackupSelection } from './backup.generated'; import { BackupableResourcesCollector } from './backupable-resources-collector'; diff --git a/packages/@aws-cdk/aws-backup/lib/vault.ts b/packages/aws-cdk-lib/aws-backup/lib/vault.ts similarity index 98% rename from packages/@aws-cdk/aws-backup/lib/vault.ts rename to packages/aws-cdk-lib/aws-backup/lib/vault.ts index 74051ab1467a4..282872bfcb630 100644 --- a/packages/@aws-cdk/aws-backup/lib/vault.ts +++ b/packages/aws-cdk-lib/aws-backup/lib/vault.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sns from '@aws-cdk/aws-sns'; -import { ArnFormat, Duration, IResource, Lazy, Names, RemovalPolicy, Resource, Stack } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as sns from '../../aws-sns'; +import { ArnFormat, Duration, IResource, Lazy, Names, RemovalPolicy, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnBackupVault } from './backup.generated'; diff --git a/packages/@aws-cdk/aws-backup/test/plan.test.ts b/packages/aws-cdk-lib/aws-backup/test/plan.test.ts similarity index 98% rename from packages/@aws-cdk/aws-backup/test/plan.test.ts rename to packages/aws-cdk-lib/aws-backup/test/plan.test.ts index 80f3ed4321427..bbb34ebc8b587 100644 --- a/packages/@aws-cdk/aws-backup/test/plan.test.ts +++ b/packages/aws-cdk-lib/aws-backup/test/plan.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as events from '@aws-cdk/aws-events'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as events from '../../aws-events'; +import { App, Duration, Stack } from '../../core'; import { BackupPlan, BackupPlanRule, BackupVault } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-backup/test/selection.test.ts b/packages/aws-cdk-lib/aws-backup/test/selection.test.ts similarity index 98% rename from packages/@aws-cdk/aws-backup/test/selection.test.ts rename to packages/aws-cdk-lib/aws-backup/test/selection.test.ts index 3691d9b4adbd2..63b0257d9dfec 100644 --- a/packages/@aws-cdk/aws-backup/test/selection.test.ts +++ b/packages/aws-cdk-lib/aws-backup/test/selection.test.ts @@ -1,9 +1,9 @@ -import { Template } from '@aws-cdk/assertions'; -import * as dynamodb from '@aws-cdk/aws-dynamodb'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as rds from '@aws-cdk/aws-rds'; -import { RemovalPolicy, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as dynamodb from '../../aws-dynamodb'; +import * as ec2 from '../../aws-ec2'; +import * as efs from '../../aws-efs'; +import * as rds from '../../aws-rds'; +import { RemovalPolicy, Stack } from '../../core'; import { Construct } from 'constructs'; import { BackupPlan, BackupResource, BackupSelection } from '../lib'; diff --git a/packages/@aws-cdk/aws-backup/test/vault.test.ts b/packages/aws-cdk-lib/aws-backup/test/vault.test.ts similarity index 97% rename from packages/@aws-cdk/aws-backup/test/vault.test.ts rename to packages/aws-cdk-lib/aws-backup/test/vault.test.ts index 1030d432f1364..e50c18cb12baf 100644 --- a/packages/@aws-cdk/aws-backup/test/vault.test.ts +++ b/packages/aws-cdk-lib/aws-backup/test/vault.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sns from '@aws-cdk/aws-sns'; -import { ArnFormat, Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as sns from '../../aws-sns'; +import { ArnFormat, Duration, Stack } from '../../core'; import { BackupVault, BackupVaultEvents } from '../lib'; let stack: Stack; diff --git a/packages/aws-cdk-lib/aws-batch/.jsiirc.json b/packages/aws-cdk-lib/aws-batch/.jsiirc.json new file mode 100644 index 0000000000000..7fb1c454a6f47 --- /dev/null +++ b/packages/aws-cdk-lib/aws-batch/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.batch" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Batch" + }, + "python": { + "module": "aws_cdk.aws_batch" + } + } +} diff --git a/packages/aws-cdk-lib/aws-batch/README.md b/packages/aws-cdk-lib/aws-batch/README.md new file mode 100644 index 0000000000000..3e4a3a3cd832d --- /dev/null +++ b/packages/aws-cdk-lib/aws-batch/README.md @@ -0,0 +1,32 @@ +# AWS Batch Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as batch from 'aws-cdk-lib/aws-batch'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Batch construct libraries](https://constructs.dev/search?q=batch) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Batch resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Batch.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-batch-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Batch](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Batch.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-batch/index.ts b/packages/aws-cdk-lib/aws-batch/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-batch/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-batch/lib/index.ts b/packages/aws-cdk-lib/aws-batch/lib/index.ts new file mode 100644 index 0000000000000..f39905c3d7ee8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-batch/lib/index.ts @@ -0,0 +1 @@ +export * from './batch.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-billingconductor/.jsiirc.json b/packages/aws-cdk-lib/aws-billingconductor/.jsiirc.json new file mode 100644 index 0000000000000..bf7c31c772da4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-billingconductor/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.BillingConductor" + }, + "java": { + "package": "software.amazon.awscdk.services.billingconductor" + }, + "python": { + "module": "aws_cdk.aws_billingconductor" + } + } +} diff --git a/packages/aws-cdk-lib/aws-billingconductor/README.md b/packages/aws-cdk-lib/aws-billingconductor/README.md new file mode 100644 index 0000000000000..bf033e4060f12 --- /dev/null +++ b/packages/aws-cdk-lib/aws-billingconductor/README.md @@ -0,0 +1,27 @@ +# AWS::BillingConductor Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as billingconductor from 'aws-cdk-lib/aws-billingconductor'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for BillingConductor construct libraries](https://constructs.dev/search?q=billingconductor) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::BillingConductor resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_BillingConductor.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::BillingConductor](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_BillingConductor.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-billingconductor/index.ts b/packages/aws-cdk-lib/aws-billingconductor/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-billingconductor/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-billingconductor/lib/index.ts b/packages/aws-cdk-lib/aws-billingconductor/lib/index.ts new file mode 100644 index 0000000000000..7c9ec806c0bd7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-billingconductor/lib/index.ts @@ -0,0 +1 @@ +export * from './billingconductor.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-budgets/.jsiirc.json b/packages/aws-cdk-lib/aws-budgets/.jsiirc.json new file mode 100644 index 0000000000000..d2f6bd2f64b8a --- /dev/null +++ b/packages/aws-cdk-lib/aws-budgets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.budgets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Budgets" + }, + "python": { + "module": "aws_cdk.aws_budgets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-budgets/README.md b/packages/aws-cdk-lib/aws-budgets/README.md new file mode 100644 index 0000000000000..3d0ef15654aff --- /dev/null +++ b/packages/aws-cdk-lib/aws-budgets/README.md @@ -0,0 +1,27 @@ +# AWS Budgets Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as budgets from 'aws-cdk-lib/aws-budgets'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Budgets construct libraries](https://constructs.dev/search?q=budgets) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Budgets resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Budgets.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Budgets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Budgets.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-budgets/index.ts b/packages/aws-cdk-lib/aws-budgets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-budgets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-budgets/lib/index.ts b/packages/aws-cdk-lib/aws-budgets/lib/index.ts new file mode 100644 index 0000000000000..91d968c6f036a --- /dev/null +++ b/packages/aws-cdk-lib/aws-budgets/lib/index.ts @@ -0,0 +1 @@ +export * from './budgets.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-cassandra/.jsiirc.json b/packages/aws-cdk-lib/aws-cassandra/.jsiirc.json new file mode 100644 index 0000000000000..10d181be7f637 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cassandra/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Cassandra" + }, + "java": { + "package": "software.amazon.awscdk.services.cassandra" + }, + "python": { + "module": "aws_cdk.aws_cassandra" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cassandra/README.md b/packages/aws-cdk-lib/aws-cassandra/README.md new file mode 100644 index 0000000000000..db8caa18fe5a9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cassandra/README.md @@ -0,0 +1,27 @@ +# AWS::Cassandra Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as cassandra from 'aws-cdk-lib/aws-cassandra'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Cassandra construct libraries](https://constructs.dev/search?q=cassandra) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Cassandra resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Cassandra.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Cassandra](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Cassandra.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-cassandra/index.ts b/packages/aws-cdk-lib/aws-cassandra/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cassandra/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-cassandra/lib/index.ts b/packages/aws-cdk-lib/aws-cassandra/lib/index.ts new file mode 100644 index 0000000000000..c91b915f8c2f8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cassandra/lib/index.ts @@ -0,0 +1 @@ +export * from './cassandra.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-ce/.jsiirc.json b/packages/aws-cdk-lib/aws-ce/.jsiirc.json new file mode 100644 index 0000000000000..2d11f6be0e838 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ce/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CE" + }, + "java": { + "package": "software.amazon.awscdk.services.ce" + }, + "python": { + "module": "aws_cdk.aws_ce" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ce/README.md b/packages/aws-cdk-lib/aws-ce/README.md new file mode 100644 index 0000000000000..2ce3f16ef902f --- /dev/null +++ b/packages/aws-cdk-lib/aws-ce/README.md @@ -0,0 +1,27 @@ +# AWS::CE Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as ce from 'aws-cdk-lib/aws-ce'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CE construct libraries](https://constructs.dev/search?q=ce) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CE resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CE.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CE](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CE.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-ce/index.ts b/packages/aws-cdk-lib/aws-ce/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ce/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-ce/lib/index.ts b/packages/aws-cdk-lib/aws-ce/lib/index.ts new file mode 100644 index 0000000000000..3d3ba36732d85 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ce/lib/index.ts @@ -0,0 +1 @@ +export * from './ce.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-certificatemanager/.jsiirc.json b/packages/aws-cdk-lib/aws-certificatemanager/.jsiirc.json new file mode 100644 index 0000000000000..5738d7bc5f43a --- /dev/null +++ b/packages/aws-cdk-lib/aws-certificatemanager/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.certificatemanager" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CertificateManager" + }, + "python": { + "module": "aws_cdk.aws_certificatemanager" + } + } +} diff --git a/packages/aws-cdk-lib/aws-certificatemanager/README.md b/packages/aws-cdk-lib/aws-certificatemanager/README.md new file mode 100644 index 0000000000000..23c4a4ca7a0c4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-certificatemanager/README.md @@ -0,0 +1,192 @@ +# AWS Certificate Manager Construct Library + + + +AWS Certificate Manager (ACM) handles the complexity of creating, storing, and renewing public and private SSL/TLS X.509 certificates and keys that +protect your AWS websites and applications. ACM certificates can secure singular domain names, multiple specific domain names, wildcard domains, or +combinations of these. ACM wildcard certificates can protect an unlimited number of subdomains. + +This package provides Constructs for provisioning and referencing ACM certificates which can be used with CloudFront and ELB. + +After requesting a certificate, you will need to prove that you own the +domain in question before the certificate will be granted. The CloudFormation +deployment will wait until this verification process has been completed. + +Because of this wait time, when using manual validation methods, it's better +to provision your certificates either in a separate stack from your main +service, or provision them manually and import them into your CDK application. + +**Note:** There is a limit on total number of ACM certificates that can be requested on an account and region within a year. +The default limit is 2000, but this limit may be (much) lower on new AWS accounts. +See https://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html for more information. + +## DNS validation + +DNS validation is the preferred method to validate domain ownership, as it has a number of advantages over email validation. +See also [Validate with DNS](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate-dns.html) +in the AWS Certificate Manager User Guide. + +If Amazon Route 53 is your DNS provider for the requested domain, the DNS record can be +created automatically: + +```ts +const myHostedZone = new route53.HostedZone(this, 'HostedZone', { + zoneName: 'example.com', +}); +new acm.Certificate(this, 'Certificate', { + domainName: 'hello.example.com', + certificateName: 'Hello World Service', // Optionally provide an certificate name + validation: acm.CertificateValidation.fromDns(myHostedZone), +}); +``` + +If Route 53 is not your DNS provider, the DNS records must be added manually and the stack will not complete +creating until the records are added. + +```ts +new acm.Certificate(this, 'Certificate', { + domainName: 'hello.example.com', + validation: acm.CertificateValidation.fromDns(), // Records must be added manually +}); +``` + +When working with multiple domains, use the `CertificateValidation.fromDnsMultiZone()`: + +```ts +const exampleCom = new route53.HostedZone(this, 'ExampleCom', { + zoneName: 'example.com', +}); +const exampleNet = new route53.HostedZone(this, 'ExampleNet', { + zoneName: 'example.net', +}); + +const cert = new acm.Certificate(this, 'Certificate', { + domainName: 'test.example.com', + subjectAlternativeNames: ['cool.example.com', 'test.example.net'], + validation: acm.CertificateValidation.fromDnsMultiZone({ + 'test.example.com': exampleCom, + 'cool.example.com': exampleCom, + 'test.example.net': exampleNet, + }), +}); +``` + +## Email validation + +Email-validated certificates (the default) are validated by receiving an +email on one of a number of predefined domains and following the instructions +in the email. + +See [Validate with Email](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-validate-email.html) +in the AWS Certificate Manager User Guide. + +```ts +new acm.Certificate(this, 'Certificate', { + domainName: 'hello.example.com', + validation: acm.CertificateValidation.fromEmail(), // Optional, this is the default +}); +``` + +## Cross-region Certificates + +ACM certificates that are used with CloudFront -- or higher-level constructs which rely on CloudFront -- must be in the `us-east-1` region. +CloudFormation allows you to create a Stack with a CloudFront distribution in any region. In order +to create an ACM certificate in us-east-1 and reference it in a CloudFront distribution is a +different region, it is recommended to perform a multi stack deployment. + +Enable the Stack property `crossRegionReferences` +in order to access the cross stack/region certificate. + +> **This feature is currently experimental** + +```ts +const stack1 = new Stack(app, 'Stack1', { + env: { + region: 'us-east-1', + }, + crossRegionReferences: true, +}); +const cert = new acm.Certificate(stack1, 'Cert', { + domainName: '*.example.com', + validation: acm.CertificateValidation.fromDns(PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'ZONE_ID')), +}); + +const stack2 = new Stack(app, 'Stack2', { + env: { + region: 'us-east-2', + }, + crossRegionReferences: true, +}); + +new cloudfront.Distribution(stack2, 'Distribution', { + defaultBehavior: { + origin: new origins.HttpOrigin('example.com'), + }, + domainNames: ['dev.example.com'], + certificate: cert, +}); +``` + +## Requesting private certificates + +AWS Certificate Manager can create [private certificates](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-private.html) issued by [Private Certificate Authority (PCA)](https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaWelcome.html). Validation of private certificates is not necessary. + +```ts +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; + +new acm.PrivateCertificate(this, 'PrivateCertificate', { + domainName: 'test.example.com', + subjectAlternativeNames: ['cool.example.com', 'test.example.net'], // optional + certificateAuthority: acmpca.CertificateAuthority.fromCertificateAuthorityArn(this, 'CA', + 'arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/023077d8-2bfa-4eb0-8f22-05c96deade77'), +}); +``` + +## Requesting certificates without transparency logging + +Transparency logging can be opted out of for AWS Certificate Manager certificates. See [opting out of certificate transparency logging](https://docs.aws.amazon.com/acm/latest/userguide/acm-bestpractices.html#best-practices-transparency) for limits. + +```ts +new acm.Certificate(this, 'Certificate', { + domainName: 'test.example.com', + transparencyLoggingEnabled: false, +}); +``` + +## Importing + +If you want to import an existing certificate, you can do so from its ARN: + +```ts +const arn = 'arn:aws:...'; +const certificate = acm.Certificate.fromCertificateArn(this, 'Certificate', arn); +``` + +## Sharing between Stacks + +To share the certificate between stacks in the same CDK application, simply +pass the `Certificate` object between the stacks. + +## Metrics + +The `DaysToExpiry` metric is available via the `metricDaysToExpiry` method for +all certificates. This metric is emitted by AWS Certificates Manager once per +day until the certificate has effectively expired. + +An alarm can be created to determine whether a certificate is soon due for +renewal ussing the following code: + +```ts +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +declare const myHostedZone: route53.HostedZone; +const certificate = new acm.Certificate(this, 'Certificate', { + domainName: 'hello.example.com', + validation: acm.CertificateValidation.fromDns(myHostedZone), +}); +certificate.metricDaysToExpiry().createAlarm(this, 'Alarm', { + comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD, + evaluationPeriods: 1, + threshold: 45, // Automatic rotation happens between 60 and 45 days before expiry +}); +``` diff --git a/packages/aws-cdk-lib/aws-certificatemanager/index.ts b/packages/aws-cdk-lib/aws-certificatemanager/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-certificatemanager/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/.no-packagejson-validator b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/.no-packagejson-validator similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/.no-packagejson-validator rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/.no-packagejson-validator diff --git a/packages/@aws-cdk/alexa-ask/.eslintrc.js b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.eslintrc.js similarity index 100% rename from packages/@aws-cdk/alexa-ask/.eslintrc.js rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.eslintrc.js diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.gitignore b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.gitignore similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.gitignore rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.gitignore diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.node-version b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.node-version similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.node-version rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.node-version diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.npmignore b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.npmignore similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.npmignore rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/.npmignore diff --git a/packages/@aws-cdk/assertions/LICENSE b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/LICENSE similarity index 100% rename from packages/@aws-cdk/assertions/LICENSE rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/LICENSE diff --git a/packages/@aws-cdk/alexa-ask/NOTICE b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/NOTICE similarity index 100% rename from packages/@aws-cdk/alexa-ask/NOTICE rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/NOTICE diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/README.md b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/README.md similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/README.md rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/README.md diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/jest.config.js b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/jest.config.js similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/jest.config.js rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/jest.config.js diff --git a/packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/asset.ef671dfd26b6dde1f73a4325587504813605a928622ebc466f4d0de6a0f3b672/index.js b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/lib/index.js similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/test/integ.dns-validated-certificate.js.snapshot/asset.ef671dfd26b6dde1f73a4325587504813605a928622ebc466f4d0de6a0f3b672/index.js rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/lib/index.js diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/test/handler.test.js b/packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/test/handler.test.js similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/test/handler.test.js rename to packages/aws-cdk-lib/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/test/handler.test.js diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate-base.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts similarity index 85% rename from packages/@aws-cdk/aws-certificatemanager/lib/certificate-base.ts rename to packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts index adaa2abe7ae2e..b819a467cc4c4 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate-base.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate-base.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Stats } from '@aws-cdk/aws-cloudwatch'; -import { Duration, Resource } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Stats } from '../../aws-cloudwatch'; +import { Duration, Resource } from '../../core'; import { ICertificate } from './certificate'; /** diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate.ts similarity index 98% rename from packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts rename to packages/aws-cdk-lib/aws-certificatemanager/lib/certificate.ts index e6fdab62a1455..58b3d467fb030 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/certificate.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/lib/certificate.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as route53 from '@aws-cdk/aws-route53'; -import { IResource, Token, Tags } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as route53 from '../../aws-route53'; +import { IResource, Token, Tags } from '../../core'; import { Construct } from 'constructs'; import { CertificateBase } from './certificate-base'; import { CfnCertificate } from './certificatemanager.generated'; diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/dns-validated-certificate.ts similarity index 97% rename from packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts rename to packages/aws-cdk-lib/aws-certificatemanager/lib/dns-validated-certificate.ts index b2d2e0a35e6cd..dd1263963eee6 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/lib/dns-validated-certificate.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import { Token } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as route53 from '../../aws-route53'; +import * as cdk from '../../core'; +import { Token } from '../../core'; import { Construct } from 'constructs'; import { CertificateProps, ICertificate } from './certificate'; import { CertificateBase } from './certificate-base'; diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/index.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lib/index.ts rename to packages/aws-cdk-lib/aws-certificatemanager/lib/index.ts diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/private-certificate.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/private-certificate.ts similarity index 97% rename from packages/@aws-cdk/aws-certificatemanager/lib/private-certificate.ts rename to packages/aws-cdk-lib/aws-certificatemanager/lib/private-certificate.ts index 366b3ea623ac6..feb347d52c22b 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lib/private-certificate.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/lib/private-certificate.ts @@ -1,4 +1,4 @@ -import * as acmpca from '@aws-cdk/aws-acmpca'; +import * as acmpca from '../../aws-acmpca'; import { Construct } from 'constructs'; import { ICertificate } from './certificate'; import { CertificateBase } from './certificate-base'; diff --git a/packages/@aws-cdk/aws-certificatemanager/lib/public-suffixes.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/public-suffixes.ts similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/lib/public-suffixes.ts rename to packages/aws-cdk-lib/aws-certificatemanager/lib/public-suffixes.ts diff --git a/packages/aws-cdk-lib/aws-certificatemanager/lib/util.ts b/packages/aws-cdk-lib/aws-certificatemanager/lib/util.ts new file mode 100644 index 0000000000000..d14cff94da639 --- /dev/null +++ b/packages/aws-cdk-lib/aws-certificatemanager/lib/util.ts @@ -0,0 +1,51 @@ +import { Arn, ArnFormat, Stack, Token } from '../../core'; +import { ICertificate } from './certificate'; +import { DnsValidatedCertificate } from './dns-validated-certificate'; +import { publicSuffixes } from './public-suffixes'; + +/** + * Returns the apex domain (domain.com) from a subdomain (www.sub.domain.com) + */ +export function apexDomain(domainName: string): string { + const parts = domainName.split('.').reverse(); + + let curr: any = publicSuffixes; + + const accumulated: string[] = []; + for (const part of parts) { + accumulated.push(part); + if (!(part in curr)) { break; } + curr = curr[part]; + } + return accumulated.reverse().join('.'); +} + +export function isDnsValidatedCertificate(cert: ICertificate): cert is DnsValidatedCertificate { + return cert.hasOwnProperty('domainName'); +} + +export function getCertificateRegion(cert: ICertificate): string | undefined { + const { certificateArn, stack } = cert; + + if (isDnsValidatedCertificate(cert)) { + const requestResource = cert.node.findChild('CertificateRequestorResource').node.defaultChild; + + // @ts-ignore + const { _cfnProperties: properties } = requestResource; + const { Region: region } = properties; + + if (region && !Token.isUnresolved(region)) { + return region; + } + } + + { + const { region } = Arn.split(certificateArn, ArnFormat.SLASH_RESOURCE_NAME); + + if (region && !Token.isUnresolved(region)) { + return region; + } + } + + return Stack.of(stack).region; +} diff --git a/packages/@aws-cdk/aws-certificatemanager/suffixes/README.txt b/packages/aws-cdk-lib/aws-certificatemanager/suffixes/README.txt similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/suffixes/README.txt rename to packages/aws-cdk-lib/aws-certificatemanager/suffixes/README.txt diff --git a/packages/@aws-cdk/aws-certificatemanager/suffixes/build-map.py b/packages/aws-cdk-lib/aws-certificatemanager/suffixes/build-map.py similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/suffixes/build-map.py rename to packages/aws-cdk-lib/aws-certificatemanager/suffixes/build-map.py diff --git a/packages/@aws-cdk/aws-certificatemanager/suffixes/public_suffix_list.dat b/packages/aws-cdk-lib/aws-certificatemanager/suffixes/public_suffix_list.dat similarity index 100% rename from packages/@aws-cdk/aws-certificatemanager/suffixes/public_suffix_list.dat rename to packages/aws-cdk-lib/aws-certificatemanager/suffixes/public_suffix_list.dat diff --git a/packages/@aws-cdk/aws-certificatemanager/test/certificate.test.ts b/packages/aws-cdk-lib/aws-certificatemanager/test/certificate.test.ts similarity index 98% rename from packages/@aws-cdk/aws-certificatemanager/test/certificate.test.ts rename to packages/aws-cdk-lib/aws-certificatemanager/test/certificate.test.ts index 950d631876b45..cd5752e67a0f3 100644 --- a/packages/@aws-cdk/aws-certificatemanager/test/certificate.test.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/test/certificate.test.ts @@ -1,6 +1,6 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Aws, Duration, Lazy, Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import * as route53 from '../../aws-route53'; +import { Aws, Duration, Lazy, Stack } from '../../core'; import { Certificate, CertificateValidation } from '../lib'; test('apex domain selection by default', () => { diff --git a/packages/@aws-cdk/aws-certificatemanager/test/dns-validated-certificate.test.ts b/packages/aws-cdk-lib/aws-certificatemanager/test/dns-validated-certificate.test.ts similarity index 97% rename from packages/@aws-cdk/aws-certificatemanager/test/dns-validated-certificate.test.ts rename to packages/aws-cdk-lib/aws-certificatemanager/test/dns-validated-certificate.test.ts index f7c827cddfebd..9ca5f43381358 100644 --- a/packages/@aws-cdk/aws-certificatemanager/test/dns-validated-certificate.test.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/test/dns-validated-certificate.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { HostedZone, PublicHostedZone } from '@aws-cdk/aws-route53'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { HostedZone, PublicHostedZone } from '../../aws-route53'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Stack, Token, Tags, RemovalPolicy, Aws } from '@aws-cdk/core'; +import { App, Stack, Token, Tags, RemovalPolicy, Aws } from '../../core'; import { DnsValidatedCertificate } from '../lib/dns-validated-certificate'; testDeprecated('creates CloudFormation Custom Resource', () => { diff --git a/packages/@aws-cdk/aws-certificatemanager/test/example.dns-validated-request.lit.ts b/packages/aws-cdk-lib/aws-certificatemanager/test/example.dns-validated-request.lit.ts similarity index 86% rename from packages/@aws-cdk/aws-certificatemanager/test/example.dns-validated-request.lit.ts rename to packages/aws-cdk-lib/aws-certificatemanager/test/example.dns-validated-request.lit.ts index b30827a63173d..f19d92d5aabfc 100644 --- a/packages/@aws-cdk/aws-certificatemanager/test/example.dns-validated-request.lit.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/test/example.dns-validated-request.lit.ts @@ -1,5 +1,5 @@ -import * as route53 from '@aws-cdk/aws-route53'; -import { App, Stack } from '@aws-cdk/core'; +import * as route53 from '../../aws-route53'; +import { App, Stack } from '../../core'; import { Construct } from 'constructs'; import * as certmgr from '../lib'; diff --git a/packages/@aws-cdk/aws-certificatemanager/test/private-certificate.test.ts b/packages/aws-cdk-lib/aws-certificatemanager/test/private-certificate.test.ts similarity index 96% rename from packages/@aws-cdk/aws-certificatemanager/test/private-certificate.test.ts rename to packages/aws-cdk-lib/aws-certificatemanager/test/private-certificate.test.ts index fe9008f15e135..550d26eb89515 100644 --- a/packages/@aws-cdk/aws-certificatemanager/test/private-certificate.test.ts +++ b/packages/aws-cdk-lib/aws-certificatemanager/test/private-certificate.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as acmpca from '@aws-cdk/aws-acmpca'; -import { Duration, Lazy, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as acmpca from '../../aws-acmpca'; +import { Duration, Lazy, Stack } from '../../core'; import { PrivateCertificate } from '../lib'; test('private certificate authority', () => { diff --git a/packages/aws-cdk-lib/aws-certificatemanager/test/util.test.ts b/packages/aws-cdk-lib/aws-certificatemanager/test/util.test.ts new file mode 100644 index 0000000000000..d7c4aa5a5e2e5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-certificatemanager/test/util.test.ts @@ -0,0 +1,105 @@ +import { PublicHostedZone } from '../../aws-route53'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { App, Aws, Stack } from '../../core'; +import { Certificate, DnsValidatedCertificate } from '../lib'; +import { apexDomain, getCertificateRegion, isDnsValidatedCertificate } from '../lib/util'; + +describe('apex domain', () => { + test('returns right domain', () => { + expect(apexDomain('domain.com')).toEqual('domain.com'); + expect(apexDomain('test.domain.com')).toEqual('domain.com'); + }); + + test('understands eTLDs', () => { + expect(apexDomain('test.domain.co.uk')).toEqual('domain.co.uk'); + }); +}); + +describe('isDnsValidatedCertificate', () => { + testDeprecated('new DnsValidatedCertificate is a DnsValidatedCertificate', () => { + const stack = new Stack(); + + const hostedZone = new PublicHostedZone(stack, 'ExampleDotCom', { + zoneName: 'example.com', + }); + const cert = new DnsValidatedCertificate(stack, 'Certificate', { + domainName: 'test.example.com', + hostedZone, + }); + + expect(isDnsValidatedCertificate(cert)).toBeTruthy(); + }); + + test('new Certificate is not a DnsValidatedCertificate', () => { + const stack = new Stack(); + + const cert = new Certificate(stack, 'Certificate', { + domainName: 'test.example.com', + }); + + expect(isDnsValidatedCertificate(cert)).toBeFalsy(); + }); + + test('fromCertificateArn is not a DnsValidatedCertificate', () => { + const stack = new Stack(); + + const cert = Certificate.fromCertificateArn(stack, 'Certificate', 'cert-arn'); + + expect(isDnsValidatedCertificate(cert)).toBeFalsy(); + }); +}); + +describe('getCertificateRegion', () => { + test('from stack', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'RegionStack', { env: { region: 'eu-west-1' } }); + + const certificate = new Certificate(stack, 'TestCertificate', { + domainName: 'www.example.com', + }); + + expect(getCertificateRegion(certificate)).toEqual('eu-west-1'); + }); + + testDeprecated('from DnsValidatedCertificate region', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'RegionStack', { env: { region: 'eu-west-1' } }); + const hostedZone = new PublicHostedZone(stack, 'ExampleDotCom', { + zoneName: 'example.com', + }); + + const certificate = new DnsValidatedCertificate(stack, 'TestCertificate', { + domainName: 'www.example.com', + hostedZone, + region: 'eu-west-3', + }); + + expect(getCertificateRegion(certificate)).toEqual('eu-west-3'); + }); + + test('fromCertificateArn', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'RegionStack', { env: { region: 'eu-west-1' } }); + + const certificate = Certificate.fromCertificateArn( + stack, 'TestCertificate', 'arn:aws:acm:us-east-2:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', + ); + + expect(getCertificateRegion(certificate)).toEqual('us-east-2'); + }); + + test('region agnostic stack', () => { + // GIVEN + const stack = new Stack(); + + const certificate = new Certificate(stack, 'TestCertificate', { + domainName: 'www.example.com', + }); + + expect(getCertificateRegion(certificate)).toEqual(Aws.REGION); + }); + +}); diff --git a/packages/aws-cdk-lib/aws-chatbot/.jsiirc.json b/packages/aws-cdk-lib/aws-chatbot/.jsiirc.json new file mode 100644 index 0000000000000..7650a5e033e19 --- /dev/null +++ b/packages/aws-cdk-lib/aws-chatbot/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Chatbot" + }, + "java": { + "package": "software.amazon.awscdk.services.chatbot" + }, + "python": { + "module": "aws_cdk.aws_chatbot" + } + } +} diff --git a/packages/aws-cdk-lib/aws-chatbot/README.md b/packages/aws-cdk-lib/aws-chatbot/README.md new file mode 100644 index 0000000000000..0bb650ac21693 --- /dev/null +++ b/packages/aws-cdk-lib/aws-chatbot/README.md @@ -0,0 +1,49 @@ +# AWS::Chatbot Construct Library + + +AWS Chatbot is an AWS service that enables DevOps and software development teams to use Slack chat rooms to monitor and respond to operational events in their AWS Cloud. AWS Chatbot processes AWS service notifications from Amazon Simple Notification Service (Amazon SNS), and forwards them to Slack chat rooms so teams can analyze and act on them immediately, regardless of location. + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +const slackChannel = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', + slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', + slackChannelId: 'YOUR_SLACK_CHANNEL_ID', +}); + +slackChannel.addToRolePolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: [ + 's3:GetObject', + ], + resources: ['arn:aws:s3:::abc/xyz/123.txt'], +})); + +slackChannel.addNotificationTopic(new sns.Topic(this, 'MyTopic')); +``` + +## Log Group + +Slack channel configuration automatically create a log group with the name `/aws/chatbot/` in `us-east-1` upon first execution with +log data set to never expire. + +The `logRetention` property can be used to set a different expiration period. A log group will be created if not already exists. +If the log group already exists, it's expiration will be configured to the value specified in this construct (never expire, by default). + +By default, CDK uses the AWS SDK retry options when interacting with the log group. The `logRetentionRetryOptions` property +allows you to customize the maximum number of retries and base backoff duration. + +*Note* that, if `logRetention` is set, a [CloudFormation custom +resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html) is added +to the stack that pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the +correct log retention period (never expire, by default). + +## Guardrails + +By default slack channel will use `AdministratorAccess` managed policy as guardrail policy. +The `guardrailPolicies` property can be used to set a different set of managed policies. diff --git a/packages/aws-cdk-lib/aws-chatbot/index.ts b/packages/aws-cdk-lib/aws-chatbot/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-chatbot/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-chatbot/lib/index.ts b/packages/aws-cdk-lib/aws-chatbot/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-chatbot/lib/index.ts rename to packages/aws-cdk-lib/aws-chatbot/lib/index.ts diff --git a/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts b/packages/aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration.ts similarity index 97% rename from packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts rename to packages/aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration.ts index ccba363517688..25367157f2cb3 100644 --- a/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts +++ b/packages/aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration.ts @@ -1,9 +1,9 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as notifications from '../../aws-codestarnotifications'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnSlackChannelConfiguration } from './chatbot.generated'; diff --git a/packages/@aws-cdk/aws-chatbot/test/slack-channel-configuration.test.ts b/packages/aws-cdk-lib/aws-chatbot/test/slack-channel-configuration.test.ts similarity index 97% rename from packages/@aws-cdk/aws-chatbot/test/slack-channel-configuration.test.ts rename to packages/aws-cdk-lib/aws-chatbot/test/slack-channel-configuration.test.ts index 49314e8572f3e..8233886bf6596 100644 --- a/packages/@aws-cdk/aws-chatbot/test/slack-channel-configuration.test.ts +++ b/packages/aws-cdk-lib/aws-chatbot/test/slack-channel-configuration.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import * as chatbot from '../lib'; describe('SlackChannelConfiguration', () => { diff --git a/packages/aws-cdk-lib/aws-cloud9/.jsiirc.json b/packages/aws-cdk-lib/aws-cloud9/.jsiirc.json new file mode 100644 index 0000000000000..ad7d635ec0f3a --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloud9/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloud9" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Cloud9" + }, + "python": { + "module": "aws_cdk.aws_cloud9" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloud9/README.md b/packages/aws-cdk-lib/aws-cloud9/README.md new file mode 100644 index 0000000000000..59793083137c0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloud9/README.md @@ -0,0 +1,32 @@ +# AWS Cloud9 Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as cloud9 from 'aws-cdk-lib/aws-cloud9'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Cloud9 construct libraries](https://constructs.dev/search?q=cloud9) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Cloud9 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Cloud9.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-cloud9-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Cloud9](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Cloud9.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-cloud9/index.ts b/packages/aws-cdk-lib/aws-cloud9/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloud9/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-cloud9/lib/index.ts b/packages/aws-cdk-lib/aws-cloud9/lib/index.ts new file mode 100644 index 0000000000000..31a5f05427046 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloud9/lib/index.ts @@ -0,0 +1 @@ +export * from './cloud9.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-cloudformation/.jsiirc.json b/packages/aws-cdk-lib/aws-cloudformation/.jsiirc.json new file mode 100644 index 0000000000000..f8f70eced317a --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudformation/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloudformation" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CloudFormation" + }, + "python": { + "module": "aws_cdk.aws_cloudformation" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloudformation/README.md b/packages/aws-cdk-lib/aws-cloudformation/README.md new file mode 100644 index 0000000000000..399c967cf9e1d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudformation/README.md @@ -0,0 +1,4 @@ +# AWS CloudFormation Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/aws-cdk-lib/aws-cloudformation/index.ts b/packages/aws-cdk-lib/aws-cloudformation/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudformation/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cloudformation/lib/cloud-formation-capabilities.ts b/packages/aws-cdk-lib/aws-cloudformation/lib/cloud-formation-capabilities.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/lib/cloud-formation-capabilities.ts rename to packages/aws-cdk-lib/aws-cloudformation/lib/cloud-formation-capabilities.ts diff --git a/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts b/packages/aws-cdk-lib/aws-cloudformation/lib/custom-resource.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts rename to packages/aws-cdk-lib/aws-cloudformation/lib/custom-resource.ts index 380bc6f37671f..4911060deae91 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/custom-resource.ts +++ b/packages/aws-cdk-lib/aws-cloudformation/lib/custom-resource.ts @@ -1,6 +1,6 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as core from '@aws-cdk/core'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import * as core from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-cloudformation/lib/index.ts b/packages/aws-cdk-lib/aws-cloudformation/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/lib/index.ts rename to packages/aws-cdk-lib/aws-cloudformation/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-cloudformation/lib/nested-stack.ts b/packages/aws-cdk-lib/aws-cloudformation/lib/nested-stack.ts new file mode 100644 index 0000000000000..e1a66fc5790d6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudformation/lib/nested-stack.ts @@ -0,0 +1,74 @@ +import * as sns from '../../aws-sns'; +import * as core from '../../core'; +import { Construct } from 'constructs'; + +/** + * Initialization props for the `NestedStack` construct. + * + * @deprecated use core.NestedStackProps instead + */ +export interface NestedStackProps { + /** + * The set value pairs that represent the parameters passed to CloudFormation + * when this nested stack is created. Each parameter has a name corresponding + * to a parameter defined in the embedded template and a value representing + * the value that you want to set for the parameter. + * + * The nested stack construct will automatically synthesize parameters in order + * to bind references from the parent stack(s) into the nested stack. + * + * @default - no user-defined parameters are passed to the nested stack + */ + readonly parameters?: { [key: string]: string }; + + /** + * The length of time that CloudFormation waits for the nested stack to reach + * the CREATE_COMPLETE state. + * + * When CloudFormation detects that the nested stack has reached the + * CREATE_COMPLETE state, it marks the nested stack resource as + * CREATE_COMPLETE in the parent stack and resumes creating the parent stack. + * If the timeout period expires before the nested stack reaches + * CREATE_COMPLETE, CloudFormation marks the nested stack as failed and rolls + * back both the nested stack and parent stack. + * + * @default - no timeout + */ + readonly timeout?: core.Duration; + + /** + * The Simple Notification Service (SNS) topics to publish stack related + * events. + * + * @default - notifications are not sent for this stack. + */ + readonly notifications?: sns.ITopic[]; +} + +/** + * A CloudFormation nested stack. + * + * When you apply template changes to update a top-level stack, CloudFormation + * updates the top-level stack and initiates an update to its nested stacks. + * CloudFormation updates the resources of modified nested stacks, but does not + * update the resources of unmodified nested stacks. + * + * Furthermore, this stack will not be treated as an independent deployment + * artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), + * but rather only synthesized as a template and uploaded as an asset to S3. + * + * Cross references of resource attributes between the parent stack and the + * nested stack will automatically be translated to stack parameters and + * outputs. + * + * @deprecated use core.NestedStack instead + */ +export class NestedStack extends core.NestedStack { + constructor(scope: Construct, id: string, props: NestedStackProps = { }) { + super(scope, id, { + parameters: props.parameters, + timeout: props.timeout, + notificationArns: props.notifications?.map(n => n.topicArn), + }); + } +} diff --git a/packages/aws-cdk-lib/aws-cloudformation/test/asset-directory-fixture/index.ts b/packages/aws-cdk-lib/aws-cloudformation/test/asset-directory-fixture/index.ts new file mode 100644 index 0000000000000..adfa3cdf1ef24 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudformation/test/asset-directory-fixture/index.ts @@ -0,0 +1,6 @@ +/* eslint-disable no-console */ + +exports.handler = async (evt: any) => { + console.error(JSON.stringify(evt, undefined, 2)); + return 'hello, world!'; +}; diff --git a/packages/@aws-cdk/aws-cloudformation/test/asset-docker-fixture/Dockerfile b/packages/aws-cdk-lib/aws-cloudformation/test/asset-docker-fixture/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/asset-docker-fixture/Dockerfile rename to packages/aws-cdk-lib/aws-cloudformation/test/asset-docker-fixture/Dockerfile diff --git a/packages/@aws-cdk/aws-cloudformation/test/asset-fixture.txt b/packages/aws-cdk-lib/aws-cloudformation/test/asset-fixture.txt similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/asset-fixture.txt rename to packages/aws-cdk-lib/aws-cloudformation/test/asset-fixture.txt diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/mock-provider/index.ts b/packages/aws-cdk-lib/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts similarity index 100% rename from packages/@aws-cdk/core/test/custom-resource-provider/mock-provider/index.ts rename to packages/aws-cdk-lib/aws-cloudformation/test/core-custom-resource-provider-fixture/index.ts diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/DependsOnTestDefaultTestDeployAssert3B3B50E2.template.json diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.d.ts diff --git a/packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js similarity index 100% rename from packages/@aws-cdk/aws-appsync/test/integ.js-resolver.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.js diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts similarity index 100% rename from packages/@aws-cdk/aws-rds/test/integ.instance.lit.js.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/asset.d01c24641c7d8cb6488393ffceaefff282370a9a522bf9d77b21da73fa257347/index.ts diff --git a/packages/@aws-cdk/aws-servicecatalog/test/product.integ.snapshot/cdk.out b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/product.integ.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/integ.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/integ.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/manifest.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/manifest.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.assets.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.assets.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.template.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nested-stack-depends-test.template.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nested-stack-depends-test.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack1DE6783D8.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/nestedstackdependstestStack2A36722CF.nested.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.assets.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.assets.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.assets.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.assets.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.template.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.template.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/integ.core-deps.js.snapshot/replace-depends-on-test.template.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/replace-depends-on-test.template.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/tree.json b/packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-cloudformation/test/core-deps.integ.snapshot/tree.json rename to packages/aws-cdk-lib/aws-cloudformation/test/core-deps.integ.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-cloudformation/test/deps.test.ts b/packages/aws-cdk-lib/aws-cloudformation/test/deps.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudformation/test/deps.test.ts rename to packages/aws-cdk-lib/aws-cloudformation/test/deps.test.ts index 0dbb1a9c5ec1b..43c9bc77f2f2e 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/deps.test.ts +++ b/packages/aws-cdk-lib/aws-cloudformation/test/deps.test.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; +import { Template } from '../../assertions'; import { testDeprecated, describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, CfnResource, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { App, CfnResource, Stack } from '../../core'; +import * as cxapi from '../../cx-api'; import { NestedStack } from '../lib'; describe('resource dependencies', () => { diff --git a/packages/@aws-cdk/aws-cloudformation/test/nested-stack.test.ts b/packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudformation/test/nested-stack.test.ts rename to packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts index f8f70d3dd58fc..a976680c54e73 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/nested-stack.test.ts +++ b/packages/aws-cdk-lib/aws-cloudformation/test/nested-stack.test.ts @@ -1,11 +1,11 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as sns from '@aws-cdk/aws-sns'; +import { Template } from '../../assertions'; +import * as s3_assets from '../../aws-s3-assets'; +import * as sns from '../../aws-sns'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, CfnParameter, CfnResource, ContextProvider, LegacyStackSynthesizer, Names, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { App, CfnParameter, CfnResource, ContextProvider, LegacyStackSynthesizer, Names, Stack } from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { NestedStack } from '../lib/nested-stack'; diff --git a/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts b/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts new file mode 100644 index 0000000000000..bfbf573be1d12 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudformation/test/resource.test.ts @@ -0,0 +1,217 @@ +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import { CustomResource, CustomResourceProvider } from '../lib'; + +/* eslint-disable @aws-cdk/no-core-construct */ +/* eslint-disable quote-props */ + +describeDeprecated('custom resources honor removalPolicy', () => { + test('unspecified (aka .Destroy)', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + // WHEN + new TestCustomResource(stack, 'Custom'); + + // THEN + Template.fromStack(stack).hasResource('AWS::CloudFormation::CustomResource', {}); + expect(app.synth().tryGetArtifact(stack.stackName)!.findMetadataByType('aws:cdk:protected').length).toEqual(0); + }); + + test('.Destroy', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + // WHEN + new TestCustomResource(stack, 'Custom', { removalPolicy: cdk.RemovalPolicy.DESTROY }); + + // THEN + Template.fromStack(stack).hasResource('AWS::CloudFormation::CustomResource', {}); + expect(app.synth().tryGetArtifact(stack.stackName)!.findMetadataByType('aws:cdk:protected').length).toEqual(0); + }); + + test('.Retain', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + // WHEN + new TestCustomResource(stack, 'Custom', { removalPolicy: cdk.RemovalPolicy.RETAIN }); + + // THEN + Template.fromStack(stack).hasResource('AWS::CloudFormation::CustomResource', { + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }); + }); +}); + +testDeprecated('custom resource is added twice, lambda is added once', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + // WHEN + new TestCustomResource(stack, 'Custom1'); + new TestCustomResource(stack, 'Custom2'); + + // THEN + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'SingletonLambdaTestCustomResourceProviderServiceRole81FEAB5C': { + 'Type': 'AWS::IAM::Role', + 'Properties': { + 'AssumeRolePolicyDocument': { + 'Statement': [ + { + 'Action': 'sts:AssumeRole', + 'Effect': 'Allow', + 'Principal': { + 'Service': 'lambda.amazonaws.com', + }, + }, + ], + 'Version': '2012-10-17', + }, + 'ManagedPolicyArns': [ + { + 'Fn::Join': ['', [ + 'arn:', { 'Ref': 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', + ]], + }, + ], + }, + }, + 'SingletonLambdaTestCustomResourceProviderA9255269': { + 'Type': 'AWS::Lambda::Function', + 'Properties': { + 'Code': { + 'ZipFile': 'def hello(): pass', + }, + 'Handler': 'index.hello', + 'Role': { + 'Fn::GetAtt': [ + 'SingletonLambdaTestCustomResourceProviderServiceRole81FEAB5C', + 'Arn', + ], + }, + 'Runtime': 'python3.9', + 'Timeout': 300, + }, + 'DependsOn': [ + 'SingletonLambdaTestCustomResourceProviderServiceRole81FEAB5C', + ], + }, + 'Custom1D319B237': { + 'Type': 'AWS::CloudFormation::CustomResource', + 'DeletionPolicy': 'Delete', + 'UpdateReplacePolicy': 'Delete', + 'Properties': { + 'ServiceToken': { + 'Fn::GetAtt': [ + 'SingletonLambdaTestCustomResourceProviderA9255269', + 'Arn', + ], + }, + }, + }, + 'Custom2DD5FB44D': { + 'Type': 'AWS::CloudFormation::CustomResource', + 'DeletionPolicy': 'Delete', + 'UpdateReplacePolicy': 'Delete', + 'Properties': { + 'ServiceToken': { + 'Fn::GetAtt': [ + 'SingletonLambdaTestCustomResourceProviderA9255269', + 'Arn', + ], + }, + }, + }, + }, + }); +}); + +testDeprecated('custom resources can specify a resource type that starts with Custom::', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + new CustomResource(stack, 'MyCustomResource', { + resourceType: 'Custom::MyCustomResourceType', + provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), + }); + Template.fromStack(stack).hasResourceProperties('Custom::MyCustomResourceType', {}); +}); + +describeDeprecated('fails if custom resource type is invalid', () => { + test('does not start with "Custom::"', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + expect(() => { + new CustomResource(stack, 'MyCustomResource', { + resourceType: 'NoCustom::MyCustomResourceType', + provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), + }); + }).toThrow(/Custom resource type must begin with "Custom::"/); + }); + + test('has invalid characters', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + expect(() => { + new CustomResource(stack, 'MyCustomResource', { + resourceType: 'Custom::My Custom?ResourceType', + provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), + }); + }).toThrow(/Custom resource type name can only include alphanumeric characters and/); + }); + + test('is longer than 60 characters', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Test'); + + expect(() => { + new CustomResource(stack, 'MyCustomResource', { + resourceType: 'Custom::0123456789012345678901234567890123456789012345678901234567891', + provider: CustomResourceProvider.fromTopic(new sns.Topic(stack, 'Provider')), + }); + }).toThrow(/Custom resource type length > 60/); + }); +}); + +testDeprecated('.ref returns the intrinsic reference (physical name)', () => { + // GIVEN + const stack = new cdk.Stack(); + const res = new TestCustomResource(stack, 'myResource'); + + // THEN + expect(stack.resolve(res.resource.ref)).toEqual({ Ref: 'myResourceC6A188A9' }); +}); + +class TestCustomResource extends Construct { + public readonly resource: CustomResource; + + constructor(scope: Construct, id: string, opts: { removalPolicy?: cdk.RemovalPolicy } = {}) { + super(scope, id); + + const singletonLambda = new lambda.SingletonFunction(this, 'Lambda', { + uuid: 'TestCustomResourceProvider', + code: new lambda.InlineCode('def hello(): pass'), + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'index.hello', + timeout: cdk.Duration.minutes(5), + }); + + this.resource = new CustomResource(this, 'Resource', { + ...opts, + provider: CustomResourceProvider.fromLambda(singletonLambda), + }); + } +} diff --git a/packages/aws-cdk-lib/aws-cloudfront-origins/.jsiirc.json b/packages/aws-cdk-lib/aws-cloudfront-origins/.jsiirc.json new file mode 100644 index 0000000000000..9a1d86c57596d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloudfront.origins" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CloudFront.Origins" + }, + "python": { + "module": "aws_cdk.aws_cloudfront_origins" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloudfront-origins/README.md b/packages/aws-cdk-lib/aws-cloudfront-origins/README.md new file mode 100644 index 0000000000000..ada52ef1ed55c --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/README.md @@ -0,0 +1,133 @@ +# CloudFront Origins for the CDK CloudFront Library + + +This library contains convenience methods for defining origins for a CloudFront distribution. You can use this library to create origins from +S3 buckets, Elastic Load Balancing v2 load balancers, or any other domain name. + +## S3 Bucket + +An S3 bucket can be added as an origin. If the bucket is configured as a website endpoint, the distribution can use S3 redirects and S3 custom error +documents. + +```ts +const myBucket = new s3.Bucket(this, 'myBucket'); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.S3Origin(myBucket) }, +}); +``` + +The above will treat the bucket differently based on if `IBucket.isWebsite` is set or not. If the bucket is configured as a website, the bucket is +treated as an HTTP origin, and the built-in S3 redirects and error pages can be used. Otherwise, the bucket is handled as a bucket origin and +CloudFront's redirect and error handling will be used. In the latter case, the Origin will create an origin access identity and grant it access to the +underlying bucket. This can be used in conjunction with a bucket that is not public to require that your users access your content using CloudFront +URLs and not S3 URLs directly. Alternatively, a custom origin access identity can be passed to the S3 origin in the properties. + +### Adding Custom Headers + +You can configure CloudFront to add custom headers to the requests that it sends to your origin. These custom headers enable you to send and gather information from your origin that you don’t get with typical viewer requests. These headers can even be customized for each origin. CloudFront supports custom headers for both for custom and Amazon S3 origins. + +```ts +const myBucket = new s3.Bucket(this, 'myBucket'); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.S3Origin(myBucket, { + customHeaders: { + Foo: 'bar', + }, + })}, +}); +``` + +## ELBv2 Load Balancer + +An Elastic Load Balancing (ELB) v2 load balancer may be used as an origin. In order for a load balancer to serve as an origin, it must be publicly +accessible (`internetFacing` is true). Both Application and Network load balancers are supported. + +```ts +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; + +declare const vpc: ec2.Vpc; +// Create an application load balancer in a VPC. 'internetFacing' must be 'true' +// for CloudFront to access the load balancer and use it as an origin. +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, +}); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.LoadBalancerV2Origin(lb) }, +}); +``` + +The origin can also be customized to respond on different ports, have different connection properties, etc. + +```ts +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; + +declare const loadBalancer: elbv2.ApplicationLoadBalancer; +const origin = new origins.LoadBalancerV2Origin(loadBalancer, { + connectionAttempts: 3, + connectionTimeout: Duration.seconds(5), + readTimeout: Duration.seconds(45), + keepaliveTimeout: Duration.seconds(45), + protocolPolicy: cloudfront.OriginProtocolPolicy.MATCH_VIEWER, +}); +``` + +Note that the `readTimeout` and `keepaliveTimeout` properties can extend their values over 60 seconds only if a limit increase request for CloudFront origin response timeout +quota has been approved in the target account; otherwise, values over 60 seconds will produce an error at deploy time. Consider that this value is +still limited to a maximum value of 180 seconds, which is a hard limit for that quota. + +## From an HTTP endpoint + +Origins can also be created from any other HTTP endpoint, given the domain name, and optionally, other origin properties. + +```ts +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, +}); +``` + +See the documentation of `@aws-cdk/aws-cloudfront` for more information. + +## Failover Origins (Origin Groups) + +You can set up CloudFront with origin failover for scenarios that require high availability. +To get started, you create an origin group with two origins: a primary and a secondary. +If the primary origin is unavailable, or returns specific HTTP response status codes that indicate a failure, +CloudFront automatically switches to the secondary origin. +You achieve that behavior in the CDK using the `OriginGroup` class: + +```ts +const myBucket = new s3.Bucket(this, 'myBucket'); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { + origin: new origins.OriginGroup({ + primaryOrigin: new origins.S3Origin(myBucket), + fallbackOrigin: new origins.HttpOrigin('www.example.com'), + // optional, defaults to: 500, 502, 503 and 504 + fallbackStatusCodes: [404], + }), + }, +}); +``` + +## From an API Gateway REST API + +Origins can be created from an API Gateway REST API. It is recommended to use a +[regional API](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-endpoint-types.html) in this case. The origin path will automatically be set as the stage name. + +```ts +declare const api: apigateway.RestApi; +new cloudfront.Distribution(this, 'Distribution', { + defaultBehavior: { origin: new origins.RestApiOrigin(api) }, +}); +``` + +If you want to use a different origin path, you can specify it in the `originPath` property. + +```ts +declare const api: apigateway.RestApi; +new cloudfront.Distribution(this, 'Distribution', { + defaultBehavior: { origin: new origins.RestApiOrigin(api, { originPath: '/custom-origin-path' }) }, +}); +``` diff --git a/packages/aws-cdk-lib/aws-cloudfront-origins/index.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/http-origin.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/http-origin.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudfront-origins/lib/http-origin.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/lib/http-origin.ts index 19a4631221573..e89ff222afe70 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/lib/http-origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/http-origin.ts @@ -1,5 +1,5 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as cdk from '@aws-cdk/core'; +import * as cloudfront from '../../aws-cloudfront'; +import * as cdk from '../../core'; import { validateSecondsInRangeOrUndefined } from './private/utils'; /** diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/index.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudfront-origins/lib/index.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/lib/index.ts diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/load-balancer-origin.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/load-balancer-origin.ts similarity index 88% rename from packages/@aws-cdk/aws-cloudfront-origins/lib/load-balancer-origin.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/lib/load-balancer-origin.ts index 21075a093f3e6..3611b96c9498a 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/lib/load-balancer-origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/load-balancer-origin.ts @@ -1,4 +1,4 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; import { HttpOrigin, HttpOriginProps } from './http-origin'; /** diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/origin-group.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/origin-group.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudfront-origins/lib/origin-group.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/lib/origin-group.ts index 4bc086e55b9f3..a723dd4628432 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/lib/origin-group.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/origin-group.ts @@ -1,4 +1,4 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; +import * as cloudfront from '../../aws-cloudfront'; import { Construct } from 'constructs'; /** Construction properties for `OriginGroup`. */ diff --git a/packages/aws-cdk-lib/aws-cloudfront-origins/lib/private/utils.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/private/utils.ts new file mode 100644 index 0000000000000..d5538dd873128 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/private/utils.ts @@ -0,0 +1,12 @@ +import * as cdk from '../../../core'; + +/** + * Throws an error if a duration is defined and not an integer number of seconds within a range. + */ +export function validateSecondsInRangeOrUndefined(name: string, min: number, max: number, duration?: cdk.Duration) { + if (duration === undefined) { return; } + const value = duration.toSeconds(); + if (!Number.isInteger(value) || value < min || value > max) { + throw new Error(`${name}: Must be an int between ${min} and ${max} seconds (inclusive); received ${value}.`); + } +} diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/rest-api-origin.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/rest-api-origin.ts similarity index 94% rename from packages/@aws-cdk/aws-cloudfront-origins/lib/rest-api-origin.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/lib/rest-api-origin.ts index fd3b2142371cc..fab837646db73 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/lib/rest-api-origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/rest-api-origin.ts @@ -1,6 +1,6 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as cdk from '@aws-cdk/core'; +import * as apigateway from '../../aws-apigateway'; +import * as cloudfront from '../../aws-cloudfront'; +import * as cdk from '../../core'; import { validateSecondsInRangeOrUndefined } from './private/utils'; /** diff --git a/packages/@aws-cdk/aws-cloudfront-origins/lib/s3-origin.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/s3-origin.ts similarity index 95% rename from packages/@aws-cdk/aws-cloudfront-origins/lib/s3-origin.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/lib/s3-origin.ts index d2003c9285571..caf85eb49df3d 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/lib/s3-origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/lib/s3-origin.ts @@ -1,7 +1,7 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as cloudfront from '../../aws-cloudfront'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { HttpOrigin } from './http-origin'; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/http-origin.test.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/test/http-origin.test.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudfront-origins/test/http-origin.test.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/test/http-origin.test.ts index 898129517d828..fce80fd25375e 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/http-origin.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/test/http-origin.test.ts @@ -1,5 +1,5 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import * as cloudfront from '../../aws-cloudfront'; +import { App, Duration, Stack } from '../../core'; import { HttpOrigin } from '../lib'; let app: App; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/load-balancer-origin.test.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/test/load-balancer-origin.test.ts similarity index 92% rename from packages/@aws-cdk/aws-cloudfront-origins/test/load-balancer-origin.test.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/test/load-balancer-origin.test.ts index 6bbe38f976e34..071687db26d4f 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/load-balancer-origin.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/test/load-balancer-origin.test.ts @@ -1,6 +1,6 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import * as cloudfront from '../../aws-cloudfront'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { App, Duration, Stack } from '../../core'; import { LoadBalancerV2Origin } from '../lib'; let app: App; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/origin-group.test.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/test/origin-group.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront-origins/test/origin-group.test.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/test/origin-group.test.ts index a864a03fa7c82..23337d50b4960 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/origin-group.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/test/origin-group.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudfront from '../../aws-cloudfront'; +import * as s3 from '../../aws-s3'; +import { Stack } from '../../core'; import * as origins from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.test.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/test/rest-api-origin.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.test.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/test/rest-api-origin.test.ts index dde812309c02b..97249f09949df 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/rest-api-origin.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/test/rest-api-origin.test.ts @@ -1,5 +1,5 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import { Stack } from '@aws-cdk/core'; +import * as apigateway from '../../aws-apigateway'; +import { Stack } from '../../core'; import { RestApiOrigin } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-cloudfront-origins/test/s3-origin.test.ts b/packages/aws-cdk-lib/aws-cloudfront-origins/test/s3-origin.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront-origins/test/s3-origin.test.ts rename to packages/aws-cdk-lib/aws-cloudfront-origins/test/s3-origin.test.ts index 7889659db5420..68272dd8b95ab 100644 --- a/packages/@aws-cdk/aws-cloudfront-origins/test/s3-origin.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront-origins/test/s3-origin.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cloudfront from '../../aws-cloudfront'; +import * as s3 from '../../aws-s3'; +import { App, Duration, Stack } from '../../core'; import { S3Origin } from '../lib'; let app: App; diff --git a/packages/aws-cdk-lib/aws-cloudfront/.gitignore b/packages/aws-cdk-lib/aws-cloudfront/.gitignore new file mode 100644 index 0000000000000..119c1960a4969 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/.gitignore @@ -0,0 +1,2 @@ +!lib/experimental/edge-function/index.js +!test/function-code.js diff --git a/packages/aws-cdk-lib/aws-cloudfront/.jsiirc.json b/packages/aws-cdk-lib/aws-cloudfront/.jsiirc.json new file mode 100644 index 0000000000000..9ce9845c25f5c --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloudfront" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CloudFront" + }, + "python": { + "module": "aws_cdk.aws_cloudfront" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloudfront/README.md b/packages/aws-cdk-lib/aws-cloudfront/README.md new file mode 100644 index 0000000000000..1569441e54853 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/README.md @@ -0,0 +1,1023 @@ +# Amazon CloudFront Construct Library + + +Amazon CloudFront is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .js, and image files, to +your users. CloudFront delivers your content through a worldwide network of data centers called edge locations. When a user requests content that +you're serving with CloudFront, the user is routed to the edge location that provides the lowest latency, so that content is delivered with the best +possible performance. + +## Distribution API + +The `Distribution` API is currently being built to replace the existing `CloudFrontWebDistribution` API. The `Distribution` API is optimized for the +most common use cases of CloudFront distributions (e.g., single origin and behavior, few customizations) while still providing the ability for more +advanced use cases. The API focuses on simplicity for the common use cases, and convenience methods for creating the behaviors and origins necessary +for more complex use cases. + +### Creating a distribution + +CloudFront distributions deliver your content from one or more origins; an origin is the location where you store the original version of your +content. Origins can be created from S3 buckets or a custom origin (HTTP server). Constructs to define origins are in the `@aws-cdk/aws-cloudfront-origins` module. + +Each distribution has a default behavior which applies to all requests to that distribution, and routes requests to a primary origin. +Additional behaviors may be specified for an origin with a given URL path pattern. Behaviors allow routing with multiple origins, +controlling which HTTP methods to support, whether to require users to use HTTPS, and what query strings or cookies to forward to your origin, +among other settings. + +#### From an S3 Bucket + +An S3 bucket can be added as an origin. If the bucket is configured as a website endpoint, the distribution can use S3 redirects and S3 custom error +documents. + +```ts +// Creates a distribution from an S3 bucket. +const myBucket = new s3.Bucket(this, 'myBucket'); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.S3Origin(myBucket) }, +}); +``` + +The above will treat the bucket differently based on if `IBucket.isWebsite` is set or not. If the bucket is configured as a website, the bucket is +treated as an HTTP origin, and the built-in S3 redirects and error pages can be used. Otherwise, the bucket is handled as a bucket origin and +CloudFront's redirect and error handling will be used. In the latter case, the Origin will create an origin access identity and grant it access to the +underlying bucket. This can be used in conjunction with a bucket that is not public to require that your users access your content using CloudFront +URLs and not S3 URLs directly. + +#### ELBv2 Load Balancer + +An Elastic Load Balancing (ELB) v2 load balancer may be used as an origin. In order for a load balancer to serve as an origin, it must be publicly +accessible (`internetFacing` is true). Both Application and Network load balancers are supported. + +```ts +// Creates a distribution from an ELBv2 load balancer +declare const vpc: ec2.Vpc; +// Create an application load balancer in a VPC. 'internetFacing' must be 'true' +// for CloudFront to access the load balancer and use it as an origin. +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, +}); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.LoadBalancerV2Origin(lb) }, +}); +``` + +#### From an HTTP endpoint + +Origins can also be created from any other HTTP endpoint, given the domain name, and optionally, other origin properties. + +```ts +// Creates a distribution from an HTTP endpoint +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, +}); +``` + +### Domain Names and Certificates + +When you create a distribution, CloudFront assigns a domain name for the distribution, for example: `d111111abcdef8.cloudfront.net`; this value can +be retrieved from `distribution.distributionDomainName`. CloudFront distributions use a default certificate (`*.cloudfront.net`) to support HTTPS by +default. If you want to use your own domain name, such as `www.example.com`, you must associate a certificate with your distribution that contains +your domain name, and provide one (or more) domain names from the certificate for the distribution. + +The certificate must be present in the AWS Certificate Manager (ACM) service in the US East (N. Virginia) region; the certificate +may either be created by ACM, or created elsewhere and imported into ACM. When a certificate is used, the distribution will support HTTPS connections +from SNI only and a minimum protocol version of TLSv1.2_2021 if the `@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021` feature flag is set, and TLSv1.2_2019 otherwise. + +```ts +// To use your own domain name in a Distribution, you must associate a certificate +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import * as route53 from 'aws-cdk-lib/aws-route53'; + +declare const hostedZone: route53.HostedZone; +const myCertificate = new acm.Certificate(this, 'mySiteCert', { + domainName: 'www.example.com', + validation: acm.CertificateValidation.fromDns(hostedZone), +}); + +declare const myBucket: s3.Bucket; +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.S3Origin(myBucket) }, + domainNames: ['www.example.com'], + certificate: myCertificate, +}); +``` + +However, you can customize the minimum protocol version for the certificate while creating the distribution using `minimumProtocolVersion` property. + +```ts +// Create a Distribution with a custom domain name and a minimum protocol version. +declare const myBucket: s3.Bucket; +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.S3Origin(myBucket) }, + domainNames: ['www.example.com'], + minimumProtocolVersion: cloudfront.SecurityPolicyProtocol.TLS_V1_2016, + sslSupportMethod: cloudfront.SSLMethod.SNI, +}); +``` + +#### Cross Region Certificates + +> **This feature is currently experimental** + +You can enable the Stack property `crossRegionReferences` +in order to access resources in a different stack _and_ region. With this feature flag +enabled it is possible to do something like creating a CloudFront distribution in `us-east-2` and +an ACM certificate in `us-east-1`. + +```ts +const stack1 = new Stack(app, 'Stack1', { + env: { + region: 'us-east-1', + }, + crossRegionReferences: true, +}); +const cert = new acm.Certificate(stack1, 'Cert', { + domainName: '*.example.com', + validation: acm.CertificateValidation.fromDns(route53.PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'Z0329774B51CGXTDQV3X')), +}); + +const stack2 = new Stack(app, 'Stack2', { + env: { + region: 'us-east-2', + }, + crossRegionReferences: true, +}); +new cloudfront.Distribution(stack2, 'Distribution', { + defaultBehavior: { + origin: new origins.HttpOrigin('example.com'), + }, + domainNames: ['dev.example.com'], + certificate: cert, +}); +``` + +### Multiple Behaviors & Origins + +Each distribution has a default behavior which applies to all requests to that distribution; additional behaviors may be specified for a +given URL path pattern. Behaviors allow routing with multiple origins, controlling which HTTP methods to support, whether to require users to +use HTTPS, and what query strings or cookies to forward to your origin, among others. + +The properties of the default behavior can be adjusted as part of the distribution creation. The following example shows configuring the HTTP +methods and viewer protocol policy of the cache. + +```ts +// Create a Distribution with configured HTTP methods and viewer protocol policy of the cache. +declare const myBucket: s3.Bucket; +const myWebDistribution = new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { + origin: new origins.S3Origin(myBucket), + allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL, + viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, + }, +}); +``` + +Additional behaviors can be specified at creation, or added after the initial creation. Each additional behavior is associated with an origin, +and enable customization for a specific set of resources based on a URL path pattern. For example, we can add a behavior to `myWebDistribution` to +override the default viewer protocol policy for all of the images. + +```ts +// Add a behavior to a Distribution after initial creation. +declare const myBucket: s3.Bucket; +declare const myWebDistribution: cloudfront.Distribution; +myWebDistribution.addBehavior('/images/*.jpg', new origins.S3Origin(myBucket), { + viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, +}); +``` + +These behaviors can also be specified at distribution creation time. + +```ts +// Create a Distribution with additional behaviors at creation time. +declare const myBucket: s3.Bucket; +const bucketOrigin = new origins.S3Origin(myBucket); +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { + origin: bucketOrigin, + allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL, + viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, + }, + additionalBehaviors: { + '/images/*.jpg': { + origin: bucketOrigin, + viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, + }, + }, +}); +``` + +### Customizing Cache Keys and TTLs with Cache Policies + +You can use a cache policy to improve your cache hit ratio by controlling the values (URL query strings, HTTP headers, and cookies) +that are included in the cache key, and/or adjusting how long items remain in the cache via the time-to-live (TTL) settings. +CloudFront provides some predefined cache policies, known as managed policies, for common use cases. You can use these managed policies, +or you can create your own cache policy that’s specific to your needs. +See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-the-cache-key.html for more details. + +```ts +// Using an existing cache policy for a Distribution +declare const bucketOrigin: origins.S3Origin; +new cloudfront.Distribution(this, 'myDistManagedPolicy', { + defaultBehavior: { + origin: bucketOrigin, + cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED, + }, +}); +``` + +```ts +// Creating a custom cache policy for a Distribution -- all parameters optional +declare const bucketOrigin: origins.S3Origin; +const myCachePolicy = new cloudfront.CachePolicy(this, 'myCachePolicy', { + cachePolicyName: 'MyPolicy', + comment: 'A default policy', + defaultTtl: Duration.days(2), + minTtl: Duration.minutes(1), + maxTtl: Duration.days(10), + cookieBehavior: cloudfront.CacheCookieBehavior.all(), + headerBehavior: cloudfront.CacheHeaderBehavior.allowList('X-CustomHeader'), + queryStringBehavior: cloudfront.CacheQueryStringBehavior.denyList('username'), + enableAcceptEncodingGzip: true, + enableAcceptEncodingBrotli: true, +}); +new cloudfront.Distribution(this, 'myDistCustomPolicy', { + defaultBehavior: { + origin: bucketOrigin, + cachePolicy: myCachePolicy, + }, +}); +``` + +### Customizing Origin Requests with Origin Request Policies + +When CloudFront makes a request to an origin, the URL path, request body (if present), and a few standard headers are included. +Other information from the viewer request, such as URL query strings, HTTP headers, and cookies, is not included in the origin request by default. +You can use an origin request policy to control the information that’s included in an origin request. +CloudFront provides some predefined origin request policies, known as managed policies, for common use cases. You can use these managed policies, +or you can create your own origin request policy that’s specific to your needs. +See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/controlling-origin-requests.html for more details. + +```ts +// Using an existing origin request policy for a Distribution +declare const bucketOrigin: origins.S3Origin; +new cloudfront.Distribution(this, 'myDistManagedPolicy', { + defaultBehavior: { + origin: bucketOrigin, + originRequestPolicy: cloudfront.OriginRequestPolicy.CORS_S3_ORIGIN, + }, +}); +``` + +```ts +// Creating a custom origin request policy for a Distribution -- all parameters optional +declare const bucketOrigin: origins.S3Origin; +const myOriginRequestPolicy = new cloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', { + originRequestPolicyName: 'MyPolicy', + comment: 'A default policy', + cookieBehavior: cloudfront.OriginRequestCookieBehavior.none(), + headerBehavior: cloudfront.OriginRequestHeaderBehavior.all('CloudFront-Is-Android-Viewer'), + queryStringBehavior: cloudfront.OriginRequestQueryStringBehavior.allowList('username'), +}); + +new cloudfront.Distribution(this, 'myDistCustomPolicy', { + defaultBehavior: { + origin: bucketOrigin, + originRequestPolicy: myOriginRequestPolicy, + }, +}); +``` + +### Customizing Response Headers with Response Headers Policies + +You can configure CloudFront to add one or more HTTP headers to the responses that it sends to viewers (web browsers or other clients), without making any changes to the origin or writing any code. +To specify the headers that CloudFront adds to HTTP responses, you use a response headers policy. CloudFront adds the headers regardless of whether it serves the object from the cache or has to retrieve the object from the origin. If the origin response includes one or more of the headers that’s in a response headers policy, the policy can specify whether CloudFront uses the header it received from the origin or overwrites it with the one in the policy. +See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/adding-response-headers.html + +```ts +// Using an existing managed response headers policy +declare const bucketOrigin: origins.S3Origin; +new cloudfront.Distribution(this, 'myDistManagedPolicy', { + defaultBehavior: { + origin: bucketOrigin, + responseHeadersPolicy: cloudfront.ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS, + }, +}); + +// Creating a custom response headers policy -- all parameters optional +const myResponseHeadersPolicy = new cloudfront.ResponseHeadersPolicy(this, 'ResponseHeadersPolicy', { + responseHeadersPolicyName: 'MyPolicy', + comment: 'A default policy', + corsBehavior: { + accessControlAllowCredentials: false, + accessControlAllowHeaders: ['X-Custom-Header-1', 'X-Custom-Header-2'], + accessControlAllowMethods: ['GET', 'POST'], + accessControlAllowOrigins: ['*'], + accessControlExposeHeaders: ['X-Custom-Header-1', 'X-Custom-Header-2'], + accessControlMaxAge: Duration.seconds(600), + originOverride: true, + }, + customHeadersBehavior: { + customHeaders: [ + { header: 'X-Amz-Date', value: 'some-value', override: true }, + { header: 'X-Amz-Security-Token', value: 'some-value', override: false }, + ], + }, + securityHeadersBehavior: { + contentSecurityPolicy: { contentSecurityPolicy: 'default-src https:;', override: true }, + contentTypeOptions: { override: true }, + frameOptions: { frameOption: cloudfront.HeadersFrameOption.DENY, override: true }, + referrerPolicy: { referrerPolicy: cloudfront.HeadersReferrerPolicy.NO_REFERRER, override: true }, + strictTransportSecurity: { accessControlMaxAge: Duration.seconds(600), includeSubdomains: true, override: true }, + xssProtection: { protection: true, modeBlock: true, reportUri: 'https://example.com/csp-report', override: true }, + }, + removeHeaders: ['Server'], + serverTimingSamplingRate: 50, +}); +new cloudfront.Distribution(this, 'myDistCustomPolicy', { + defaultBehavior: { + origin: bucketOrigin, + responseHeadersPolicy: myResponseHeadersPolicy, + }, +}); +``` + +### Validating signed URLs or signed cookies with Trusted Key Groups + +CloudFront Distribution supports validating signed URLs or signed cookies using key groups. +When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed +cookies for all requests that match the cache behavior. + +```ts +// Validating signed URLs or signed cookies with Trusted Key Groups + +// public key in PEM format +declare const publicKey: string; +const pubKey = new cloudfront.PublicKey(this, 'MyPubKey', { + encodedKey: publicKey, +}); + +const keyGroup = new cloudfront.KeyGroup(this, 'MyKeyGroup', { + items: [ + pubKey, + ], +}); + +new cloudfront.Distribution(this, 'Dist', { + defaultBehavior: { + origin: new origins.HttpOrigin('www.example.com'), + trustedKeyGroups: [ + keyGroup, + ], + }, +}); +``` + +### Lambda@Edge + +Lambda@Edge is an extension of AWS Lambda, a compute service that lets you execute +functions that customize the content that CloudFront delivers. You can author Node.js +or Python functions in the US East (N. Virginia) region, and then execute them in AWS +locations globally that are closer to the viewer, without provisioning or managing servers. +Lambda@Edge functions are associated with a specific behavior and event type. Lambda@Edge +can be used to rewrite URLs, alter responses based on headers or cookies, or authorize +requests based on headers or authorization tokens. + +The following shows a Lambda@Edge function added to the default behavior and triggered +on every request: + +```ts +// A Lambda@Edge function added to default behavior of a Distribution +// and triggered on every request +const myFunc = new cloudfront.experimental.EdgeFunction(this, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), +}); + +declare const myBucket: s3.Bucket; +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { + origin: new origins.S3Origin(myBucket), + edgeLambdas: [ + { + functionVersion: myFunc.currentVersion, + eventType: cloudfront.LambdaEdgeEventType.VIEWER_REQUEST, + } + ], + }, +}); +``` + +> **Note:** Lambda@Edge functions must be created in the `us-east-1` region, regardless of the region of the CloudFront distribution and stack. +> To make it easier to request functions for Lambda@Edge, the `EdgeFunction` construct can be used. +> The `EdgeFunction` construct will automatically request a function in `us-east-1`, regardless of the region of the current stack. +> `EdgeFunction` has the same interface as `Function` and can be created and used interchangeably. +> Please note that using `EdgeFunction` requires that the `us-east-1` region has been bootstrapped. +> See https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html for more about bootstrapping regions. + +If the stack is in `us-east-1`, a "normal" `lambda.Function` can be used instead of an `EdgeFunction`. + +```ts +// Using a lambda Function instead of an EdgeFunction for stacks in `us-east-`. +const myFunc = new lambda.Function(this, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), +}); +``` + +If the stack is not in `us-east-1`, and you need references from different applications on the same account, +you can also set a specific stack ID for each Lambda@Edge. + +```ts +// Setting stackIds for EdgeFunctions that can be referenced from different applications +// on the same account. +const myFunc1 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction1', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler1')), + stackId: 'edge-lambda-stack-id-1', +}); + +const myFunc2 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction2', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler2')), + stackId: 'edge-lambda-stack-id-2', +}); +``` + +Lambda@Edge functions can also be associated with additional behaviors, +either at or after Distribution creation time. + +```ts +// Associating a Lambda@Edge function with additional behaviors. + +declare const myFunc: cloudfront.experimental.EdgeFunction; +// assigning at Distribution creation +declare const myBucket: s3.Bucket; +const myOrigin = new origins.S3Origin(myBucket); +const myDistribution = new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: myOrigin }, + additionalBehaviors: { + 'images/*': { + origin: myOrigin, + edgeLambdas: [ + { + functionVersion: myFunc.currentVersion, + eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST, + includeBody: true, // Optional - defaults to false + }, + ], + }, + }, +}); + +// assigning after creation +myDistribution.addBehavior('images/*', myOrigin, { + edgeLambdas: [ + { + functionVersion: myFunc.currentVersion, + eventType: cloudfront.LambdaEdgeEventType.VIEWER_RESPONSE, + }, + ], +}); +``` + +Adding an existing Lambda@Edge function created in a different stack to a CloudFront distribution. + +```ts +// Adding an existing Lambda@Edge function created in a different stack +// to a CloudFront distribution. +declare const s3Bucket: s3.Bucket; +const functionVersion = lambda.Version.fromVersionArn(this, 'Version', 'arn:aws:lambda:us-east-1:123456789012:function:functionName:1'); + +new cloudfront.Distribution(this, 'distro', { + defaultBehavior: { + origin: new origins.S3Origin(s3Bucket), + edgeLambdas: [ + { + functionVersion, + eventType: cloudfront.LambdaEdgeEventType.VIEWER_REQUEST, + }, + ], + }, +}); +``` + +### CloudFront Function + +You can also deploy CloudFront functions and add them to a CloudFront distribution. + +```ts +// Add a cloudfront Function to a Distribution +const cfFunction = new cloudfront.Function(this, 'Function', { + code: cloudfront.FunctionCode.fromInline('function handler(event) { return event.request }'), +}); + +declare const s3Bucket: s3.Bucket; +new cloudfront.Distribution(this, 'distro', { + defaultBehavior: { + origin: new origins.S3Origin(s3Bucket), + functionAssociations: [{ + function: cfFunction, + eventType: cloudfront.FunctionEventType.VIEWER_REQUEST, + }], + }, +}); +``` + +It will auto-generate the name of the function and deploy it to the `live` stage. + +Additionally, you can load the function's code from a file using the `FunctionCode.fromFile()` method. + +### Logging + +You can configure CloudFront to create log files that contain detailed information about every user request that CloudFront receives. +The logs can go to either an existing bucket, or a bucket will be created for you. + +```ts +// Configure logging for Distributions + +// Simplest form - creates a new bucket and logs to it. +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, + enableLogging: true, +}); + +// You can optionally log to a specific bucket, configure whether cookies are logged, and give the log files a prefix. +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, + enableLogging: true, // Optional, this is implied if logBucket is specified + logBucket: new s3.Bucket(this, 'LogBucket'), + logFilePrefix: 'distribution-access-logs/', + logIncludesCookies: true, +}); +``` + +### HTTP Versions + +You can configure CloudFront to use a particular version of the HTTP protocol. By default, +newly created distributions use HTTP/2 but can be configured to use both HTTP/2 and HTTP/3 or +just HTTP/3. For all supported HTTP versions, see the `HttpVerson` enum. + +```ts +// Configure a distribution to use HTTP/2 and HTTP/3 +new cloudfront.Distribution(this, 'myDist', { + defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, + httpVersion: cloudfront.HttpVersion.HTTP2_AND_3, +}); +``` + +### Importing Distributions + +Existing distributions can be imported as well; note that like most imported constructs, an imported distribution cannot be modified. +However, it can be used as a reference for other higher-level constructs. + +```ts +// Using a reference to an imported Distribution +const distribution = cloudfront.Distribution.fromDistributionAttributes(this, 'ImportedDist', { + domainName: 'd111111abcdef8.cloudfront.net', + distributionId: '012345ABCDEF', +}); +``` + +### Permissions + +Use the `grant()` method to allow actions on the distribution. +`grantCreateInvalidation()` is a shorthand to allow `CreateInvalidation`. + +```ts +declare const distribution: cloudfront.Distribution; +declare const lambdaFn: lambda.Function; +distribution.grant(lambdaFn, 'cloudfront:ListInvalidations', 'cloudfront:GetInvalidation'); +distribution.grantCreateInvalidation(lambdaFn); +``` + +## Migrating from the original CloudFrontWebDistribution to the newer Distribution construct + +It's possible to migrate a distribution from the original to the modern API. +The changes necessary are the following: + +### The Distribution + +Replace `new CloudFrontWebDistribution` with `new Distribution`. Some +configuration properties have been changed: + +| Old API | New API | +|--------------------------------|------------------------------------------------------------------------------------------------| +| `originConfigs` | `defaultBehavior`; use `additionalBehaviors` if necessary | +| `viewerCertificate` | `certificate`; use `domainNames` for aliases | +| `errorConfigurations` | `errorResponses` | +| `loggingConfig` | `enableLogging`; configure with `logBucket` `logFilePrefix` and `logIncludesCookies` | +| `viewerProtocolPolicy` | removed; set on each behavior instead. default changed from `REDIRECT_TO_HTTPS` to `ALLOW_ALL` | + +After switching constructs, you need to maintain the same logical ID for the underlying [CfnDistribution](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-cloudfront.CfnDistribution.html) if you wish to avoid the deletion and recreation of your distribution. +To do this, use [escape hatches](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) to override the logical ID created by the new Distribution construct with the logical ID created by the old construct. + +Example: + +```ts +declare const sourceBucket: s3.Bucket; + +const myDistribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { + defaultBehavior: { + origin: new origins.S3Origin(sourceBucket), + }, +}); +const cfnDistribution = myDistribution.node.defaultChild as cloudfront.CfnDistribution; +cfnDistribution.overrideLogicalId('MyDistributionCFDistribution3H55TI9Q'); +``` + +### Behaviors + +The modern API makes use of the [CloudFront Origins](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins-readme.html) module to easily configure your origin. Replace your origin configuration with the relevant CloudFront Origins class. For example, here's a behavior with an S3 origin: + +```ts +declare const sourceBucket: s3.Bucket; +declare const oai: cloudfront.OriginAccessIdentity; + +new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + originAccessIdentity: oai, + }, + behaviors : [ {isDefaultBehavior: true}], + }, + ], +}); +``` + +Becomes: + +```ts +declare const sourceBucket: s3.Bucket; + +const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { + defaultBehavior: { + origin: new origins.S3Origin(sourceBucket) // This class automatically creates an Origin Access Identity + }, +}); +``` + +In the original API all behaviors are defined in the `originConfigs` property. The new API is optimized for a single origin and behavior, so the default behavior and additional behaviors will be defined separately. + +```ts +declare const sourceBucket: s3.Bucket; +declare const oai: cloudfront.OriginAccessIdentity; + +new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + originAccessIdentity: oai, + }, + behaviors: [ {isDefaultBehavior: true}], + }, + { + customOriginSource: { + domainName: 'MYALIAS', + }, + behaviors: [{ pathPattern: '/somewhere' }] + } + ], +}); +``` + +Becomes: + +```ts +declare const sourceBucket: s3.Bucket; + +const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { + defaultBehavior: { + origin: new origins.S3Origin(sourceBucket) // This class automatically creates an Origin Access Identity + }, + additionalBehaviors: { + '/somewhere': { + origin: new origins.HttpOrigin('MYALIAS'), + } + } +}); +``` + +### Certificates + +If you are using an ACM certificate, you can pass the certificate directly to the `certificate` prop. +Any aliases used before in the `ViewerCertificate` class should be passed in to the `domainNames` prop in the modern API. + +```ts +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +declare const certificate: acm.Certificate; +declare const sourceBucket: s3.Bucket; + +const viewerCertificate = cloudfront.ViewerCertificate.fromAcmCertificate(certificate, { + aliases: ['MYALIAS'], +}); + +new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors : [ {isDefaultBehavior: true} ], + }, + ], + viewerCertificate: viewerCertificate, +}); +``` + +Becomes: + +```ts +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +declare const certificate: acm.Certificate; +declare const sourceBucket: s3.Bucket; + +const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { + defaultBehavior: { + origin: new origins.S3Origin(sourceBucket), + }, + domainNames: ['MYALIAS'], + certificate: certificate, +}); +``` + +IAM certificates aren't directly supported by the new API, but can be easily configured through [escape hatches](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) + +```ts +declare const sourceBucket: s3.Bucket; +const viewerCertificate = cloudfront.ViewerCertificate.fromIamCertificate('MYIAMROLEIDENTIFIER', { + aliases: ['MYALIAS'], +}); + +new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors : [ {isDefaultBehavior: true} ], + }, + ], + viewerCertificate: viewerCertificate, +}); +``` + +Becomes: + +```ts +declare const sourceBucket: s3.Bucket; +const distribution = new cloudfront.Distribution(this, 'MyCfWebDistribution', { + defaultBehavior: { + origin: new origins.S3Origin(sourceBucket), + }, + domainNames: ['MYALIAS'], +}); + +const cfnDistribution = distribution.node.defaultChild as cloudfront.CfnDistribution; + +cfnDistribution.addPropertyOverride('ViewerCertificate.IamCertificateId', 'MYIAMROLEIDENTIFIER'); +cfnDistribution.addPropertyOverride('ViewerCertificate.SslSupportMethod', 'sni-only'); +``` + +### Other changes + +A number of default settings have changed on the new API when creating a new distribution, behavior, and origin. +After making the major changes needed for the migration, run `cdk diff` to see what settings have changed. +If no changes are desired during migration, you will at the least be able to use [escape hatches](https://docs.aws.amazon.com/cdk/v2/guide/cfn_layer.html) to override what the CDK synthesizes, if you can't change the properties directly. + +## CloudFrontWebDistribution API + +> The `CloudFrontWebDistribution` construct is the original construct written for working with CloudFront distributions. +> Users are encouraged to use the newer `Distribution` instead, as it has a simpler interface and receives new features faster. + +Example usage: + +```ts +// Using a CloudFrontWebDistribution construct. + +declare const sourceBucket: s3.Bucket; +const distribution = new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors : [ {isDefaultBehavior: true}], + }, + ], +}); +``` + +### Viewer certificate + +By default, CloudFront Web Distributions will answer HTTPS requests with CloudFront's default certificate, +only containing the distribution `domainName` (e.g. d111111abcdef8.cloudfront.net). +You can customize the viewer certificate property to provide a custom certificate and/or list of domain name aliases to fit your needs. + +See [Using Alternate Domain Names and HTTPS](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-https-alternate-domain-names.html) in the CloudFront User Guide. + +#### Default certificate + +You can customize the default certificate aliases. This is intended to be used in combination with CNAME records in your DNS zone. + +Example: + +[create a distribution with an default certificate example](test/example.default-cert-alias.lit.ts) + +#### ACM certificate + +You can change the default certificate by one stored AWS Certificate Manager, or ACM. +Those certificate can either be generated by AWS, or purchased by another CA imported into ACM. + +For more information, see +[the aws-certificatemanager module documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-certificatemanager-readme.html) +or [Importing Certificates into AWS Certificate Manager](https://docs.aws.amazon.com/acm/latest/userguide/import-certificate.html) +in the AWS Certificate Manager User Guide. + +Example: + +[create a distribution with an acm certificate example](test/example.acm-cert-alias.lit.ts) + +#### IAM certificate + +You can also import a certificate into the IAM certificate store. + +See [Importing an SSL/TLS Certificate](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cnames-and-https-procedures.html#cnames-and-https-uploading-certificates) in the CloudFront User Guide. + +Example: + +[create a distribution with an iam certificate example](test/example.iam-cert-alias.lit.ts) + +### Trusted Key Groups + +CloudFront Web Distributions supports validating signed URLs or signed cookies using key groups. +When a cache behavior contains trusted key groups, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. + +Example: + +```ts +// Using trusted key groups for Cloudfront Web Distributions. +declare const sourceBucket: s3.Bucket; +declare const publicKey: string; +const pubKey = new cloudfront.PublicKey(this, 'MyPubKey', { + encodedKey: publicKey, +}); + +const keyGroup = new cloudfront.KeyGroup(this, 'MyKeyGroup', { + items: [ + pubKey, + ], +}); + +new cloudfront.CloudFrontWebDistribution(this, 'AnAmazingWebsiteProbably', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors: [ + { + isDefaultBehavior: true, + trustedKeyGroups: [ + keyGroup, + ], + }, + ], + }, + ], +}); +``` + +### Restrictions + +CloudFront supports adding restrictions to your distribution. + +See [Restricting the Geographic Distribution of Your Content](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/georestrictions.html) in the CloudFront User Guide. + +Example: + +```ts +// Adding restrictions to a Cloudfront Web Distribution. +declare const sourceBucket: s3.Bucket; +new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: sourceBucket, + }, + behaviors : [ {isDefaultBehavior: true}], + }, + ], + geoRestriction: cloudfront.GeoRestriction.allowlist('US', 'GB'), +}); +``` + +### Connection behaviors between CloudFront and your origin + +CloudFront provides you even more control over the connection behaviors between CloudFront and your origin. +You can now configure the number of connection attempts CloudFront will make to your origin and the origin connection timeout for each attempt. + +See [Origin Connection Attempts](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-attempts) + +See [Origin Connection Timeout](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#origin-connection-timeout) + +Example usage: + +```ts +// Configuring connection behaviors between Cloudfront and your origin +const distribution = new cloudfront.CloudFrontWebDistribution(this, 'MyDistribution', { + originConfigs: [ + { + connectionAttempts: 3, + connectionTimeout: Duration.seconds(10), + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], +}); +``` + +#### Origin Fallback + +In case the origin source is not available and answers with one of the +specified status codes the failover origin source will be used. + +```ts +// Configuring origin fallback options for the CloudFrontWebDistribution +new cloudfront.CloudFrontWebDistribution(this, 'ADistribution', { + originConfigs: [ + { + s3OriginSource: { + s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucket', 'myoriginbucket'), + originPath: '/', + originHeaders: { + 'myHeader': '42', + }, + originShieldRegion: 'us-west-2', + }, + failoverS3OriginSource: { + s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucketFallback', 'myoriginbucketfallback'), + originPath: '/somewhere', + originHeaders: { + 'myHeader2': '21', + }, + originShieldRegion: 'us-east-1', + }, + failoverCriteriaStatusCodes: [cloudfront.FailoverStatusCode.INTERNAL_SERVER_ERROR], + behaviors: [ + { + isDefaultBehavior: true, + }, + ], + }, + ], +}); +``` + +## KeyGroup & PublicKey API + +You can create a key group to use with CloudFront signed URLs and signed cookies +You can add public keys to use with CloudFront features such as signed URLs, signed cookies, and field-level encryption. + +The following example command uses OpenSSL to generate an RSA key pair with a length of 2048 bits and save to the file named `private_key.pem`. + +```bash +openssl genrsa -out private_key.pem 2048 +``` + +The resulting file contains both the public and the private key. The following example command extracts the public key from the file named `private_key.pem` and stores it in `public_key.pem`. + +```bash +openssl rsa -pubout -in private_key.pem -out public_key.pem +``` + +Note: Don't forget to copy/paste the contents of `public_key.pem` file including `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----` lines into `encodedKey` parameter when creating a `PublicKey`. + +Example: + +```ts +// Create a key group to use with CloudFront signed URLs and signed cookies. +new cloudfront.KeyGroup(this, 'MyKeyGroup', { + items: [ + new cloudfront.PublicKey(this, 'MyPublicKey', { + encodedKey: '...', // contents of public_key.pem file + // comment: 'Key is expiring on ...', + }), + ], + // comment: 'Key group containing public keys ...', +}); +``` + +See: + +* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html +* https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html diff --git a/packages/aws-cdk-lib/aws-cloudfront/index.ts b/packages/aws-cdk-lib/aws-cloudfront/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/cache-policy.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/lib/cache-policy.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts index e870a538fc887..f811c9342baf7 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/cache-policy.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts @@ -1,4 +1,4 @@ -import { Duration, Names, Resource, Stack, Token } from '@aws-cdk/core'; +import { Duration, Names, Resource, Stack, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnCachePolicy } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/distribution.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/lib/distribution.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts index 790173451dbaf..b69849930e2a1 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/distribution.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/distribution.ts @@ -1,9 +1,9 @@ -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { ArnFormat, IResource, Lazy, Resource, Stack, Token, Duration, Names, FeatureFlags } from '@aws-cdk/core'; -import { CLOUDFRONT_DEFAULT_SECURITY_POLICY_TLS_V1_2_2021 } from '@aws-cdk/cx-api'; +import * as acm from '../../aws-certificatemanager'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import { ArnFormat, IResource, Lazy, Resource, Stack, Token, Duration, Names, FeatureFlags } from '../../core'; +import { CLOUDFRONT_DEFAULT_SECURITY_POLICY_TLS_V1_2_2021 } from '../../cx-api'; import { Construct } from 'constructs'; import { ICachePolicy } from './cache-policy'; import { CfnDistribution } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/experimental/edge-function.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/experimental/edge-function.ts index 103e992dda640..6bf6129b5f65f 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/experimental/edge-function.ts @@ -1,14 +1,14 @@ import * as path from 'path'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as ssm from '@aws-cdk/aws-ssm'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as ssm from '../../../aws-ssm'; import { CfnResource, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Lazy, Resource, Stack, Stage, Token, -} from '@aws-cdk/core'; +} from '../../../core'; import { Construct, Node } from 'constructs'; diff --git a/packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/index.js b/packages/aws-cdk-lib/aws-cloudfront/lib/experimental/edge-function/index.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/integ.distribution-lambda-cross-region.js.snapshot/asset.e718f39096261b3e336dd6d896baabf1049bb1938cb1865de1b5e576cb57376a/index.js rename to packages/aws-cdk-lib/aws-cloudfront/lib/experimental/edge-function/index.js diff --git a/packages/@aws-cdk/aws-cloudfront/lib/experimental/index.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/experimental/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/lib/experimental/index.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/experimental/index.ts diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts new file mode 100644 index 0000000000000..8638df3286893 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts @@ -0,0 +1,215 @@ +import * as fs from 'fs'; +import { IResource, Names, Resource, Stack } from '../../core'; +import { Construct } from 'constructs'; +import { CfnFunction } from './cloudfront.generated'; + +/** + * Represents the function's source code + */ +export abstract class FunctionCode { + + /** + * Inline code for function + * @returns code object with inline code. + * @param code The actual function code + */ + public static fromInline(code: string): FunctionCode { + return new InlineCode(code); + } + + /** + * Code from external file for function + * @returns code object with contents from file. + * @param options the options for the external file + */ + public static fromFile(options: FileCodeOptions): FunctionCode { + return new FileCode(options); + } + + /** + * renders the function code + */ + public abstract render(): string; +} + +/** + * Options when reading the function's code from an external file + */ +export interface FileCodeOptions { + /** + * The path of the file to read the code from + */ + readonly filePath: string; +} + +/** + * Represents the function's source code as inline code + */ +class InlineCode extends FunctionCode { + + constructor(private code: string) { + super(); + } + + public render(): string { + return this.code; + } +} + + +/** + * Represents the function's source code loaded from an external file + */ +class FileCode extends FunctionCode { + + constructor(private options: FileCodeOptions) { + super(); + } + + public render(): string { + return fs.readFileSync(this.options.filePath, { encoding: 'utf-8' }); + } +} + +/** + * Represents a CloudFront Function + */ +export interface IFunction extends IResource { + /** + * The name of the function. + * @attribute + */ + readonly functionName: string; + + /** + * The ARN of the function. + * @attribute + */ + readonly functionArn: string; +} + +/** + * Attributes of an existing CloudFront Function to import it + */ +export interface FunctionAttributes { + /** + * The name of the function. + */ + readonly functionName: string; + + /** + * The ARN of the function. + */ + readonly functionArn: string; +} + +/** + * Properties for creating a CloudFront Function + */ +export interface FunctionProps { + /** + * A name to identify the function. + * @default - generated from the `id` + */ + readonly functionName?: string; + + /** + * A comment to describe the function. + * @default - same as `functionName` + */ + readonly comment?: string; + + /** + * The source code of the function. + */ + readonly code: FunctionCode; +} + +/** + * A CloudFront Function + * + * @resource AWS::CloudFront::Function + */ +export class Function extends Resource implements IFunction { + + /** Imports a function by its name and ARN */ + public static fromFunctionAttributes(scope: Construct, id: string, attrs: FunctionAttributes): IFunction { + return new class extends Resource implements IFunction { + public readonly functionName = attrs.functionName; + public readonly functionArn = attrs.functionArn; + }(scope, id); + } + + /** + * the name of the CloudFront function + * @attribute + */ + public readonly functionName: string; + /** + * the ARN of the CloudFront function + * @attribute + */ + public readonly functionArn: string; + /** + * the deployment stage of the CloudFront function + * @attribute + */ + public readonly functionStage: string; + + constructor(scope: Construct, id: string, props: FunctionProps) { + super(scope, id); + + this.functionName = props.functionName ?? this.generateName(); + + const resource = new CfnFunction(this, 'Resource', { + autoPublish: true, + functionCode: props.code.render(), + functionConfig: { + comment: props.comment ?? this.functionName, + runtime: 'cloudfront-js-1.0', + }, + name: this.functionName, + }); + + this.functionArn = resource.attrFunctionArn; + this.functionStage = resource.attrStage; + } + + private generateName(): string { + const name = Stack.of(this).region + Names.uniqueId(this); + if (name.length > 64) { + return name.substring(0, 32) + name.substring(name.length - 32); + } + return name; + } +} + +/** + * The type of events that a CloudFront function can be invoked in response to. + */ +export enum FunctionEventType { + + /** + * The viewer-request specifies the incoming request + */ + VIEWER_REQUEST = 'viewer-request', + + /** + * The viewer-response specifies the outgoing response + */ + VIEWER_RESPONSE = 'viewer-response', +} + +/** + * Represents a CloudFront function and event type when using CF Functions. + * The type of the `AddBehaviorOptions.functionAssociations` property. + */ +export interface FunctionAssociation { + /** + * The CloudFront function that will be invoked. + */ + readonly function: IFunction; + + /** The type of event which should invoke the function. */ + readonly eventType: FunctionEventType; +} diff --git a/packages/@aws-cdk/aws-cloudfront/lib/geo-restriction.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/geo-restriction.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/lib/geo-restriction.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/geo-restriction.ts diff --git a/packages/@aws-cdk/aws-cloudfront/lib/index.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/lib/index.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/index.ts diff --git a/packages/@aws-cdk/aws-cloudfront/lib/key-group.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/key-group.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudfront/lib/key-group.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/key-group.ts index aea7bf451f305..67e98b4bf140f 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/key-group.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/key-group.ts @@ -1,4 +1,4 @@ -import { IResource, Names, Resource } from '@aws-cdk/core'; +import { IResource, Names, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnKeyGroup } from './cloudfront.generated'; import { IPublicKey } from './public-key'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/origin-access-identity.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/origin-access-identity.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/lib/origin-access-identity.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/origin-access-identity.ts index 449f801b1089d..12879e7e23dd3 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/origin-access-identity.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/origin-access-identity.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnCloudFrontOriginAccessIdentity } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/origin-request-policy.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/origin-request-policy.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/lib/origin-request-policy.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/origin-request-policy.ts index 93d77ed0414e5..2abca8ba5562d 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/origin-request-policy.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/origin-request-policy.ts @@ -1,4 +1,4 @@ -import { Names, Resource, Token } from '@aws-cdk/core'; +import { Names, Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnOriginRequestPolicy } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/origin.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/origin.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/lib/origin.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/origin.ts index 9f7d8c7f852ea..ee7bd55445517 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/origin.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/origin.ts @@ -1,4 +1,4 @@ -import { Duration, Token } from '@aws-cdk/core'; +import { Duration, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnDistribution } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/private/cache-behavior.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/private/cache-behavior.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/lib/private/cache-behavior.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/private/cache-behavior.ts index a4708b7e2fb58..dcd25b3eb5e88 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/private/cache-behavior.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/private/cache-behavior.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../../aws-iam'; import { CachePolicy } from '../cache-policy'; import { CfnDistribution } from '../cloudfront.generated'; import { AddBehaviorOptions, EdgeLambda, LambdaEdgeEventType, ViewerProtocolPolicy } from '../distribution'; diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/private/utils.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/private/utils.ts new file mode 100644 index 0000000000000..3c613a469c56e --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/private/utils.ts @@ -0,0 +1,14 @@ +import { Stack } from '../../../core'; +import { IDistribution } from '..'; + +/** + * Format distribution ARN from stack and distribution ID. + */ +export function formatDistributionArn(dist: IDistribution) { + return Stack.of(dist).formatArn({ + service: 'cloudfront', + region: '', + resource: 'distribution', + resourceName: dist.distributionId, + }); +} diff --git a/packages/@aws-cdk/aws-cloudfront/lib/public-key.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/public-key.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront/lib/public-key.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/public-key.ts index e2c2b6e044cdb..7f0586a54109c 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/public-key.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/public-key.ts @@ -1,4 +1,4 @@ -import { IResource, Names, Resource, Token } from '@aws-cdk/core'; +import { IResource, Names, Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnPublicKey } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/response-headers-policy.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/response-headers-policy.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/lib/response-headers-policy.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/response-headers-policy.ts index 415169cd40ca4..2087c43f4f203 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/response-headers-policy.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/response-headers-policy.ts @@ -1,4 +1,4 @@ -import { Duration, Names, Resource, Token } from '@aws-cdk/core'; +import { Duration, Names, Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnResponseHeadersPolicy } from './cloudfront.generated'; diff --git a/packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/web-distribution.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts rename to packages/aws-cdk-lib/aws-cloudfront/lib/web-distribution.ts index ca08aa477f018..a9f6c2eb226e3 100644 --- a/packages/@aws-cdk/aws-cloudfront/lib/web-distribution.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/web-distribution.ts @@ -1,8 +1,8 @@ -import * as certificatemanager from '@aws-cdk/aws-certificatemanager'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as certificatemanager from '../../aws-certificatemanager'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnDistribution } from './cloudfront.generated'; import { HttpVersion, IDistribution, LambdaEdgeEventType, OriginProtocolPolicy, PriceClass, ViewerProtocolPolicy, SSLMethod, SecurityPolicyProtocol } from './distribution'; diff --git a/packages/@aws-cdk/aws-cloudfront/test/cache-policy.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/cache-policy.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/test/cache-policy.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/cache-policy.test.ts index 2abeffd3cc39b..52c469beb44af 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/cache-policy.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/cache-policy.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Aws, Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Aws, Duration, Stack } from '../../core'; import { CachePolicy, CacheCookieBehavior, CacheHeaderBehavior, CacheQueryStringBehavior } from '../lib'; describe('CachePolicy', () => { diff --git a/packages/@aws-cdk/aws-cloudfront/test/distribution.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/distribution.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/test/distribution.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/distribution.test.ts index 02e0d3b572121..7c80979e47165 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/distribution.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/distribution.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import { App, Duration, Stack } from '../../core'; import { defaultOrigin, defaultOriginGroup } from './test-origin'; import { CfnDistribution, diff --git a/packages/@aws-cdk/aws-cloudfront/test/example.acm-cert-alias.lit.ts b/packages/aws-cdk-lib/aws-cloudfront/test/example.acm-cert-alias.lit.ts similarity index 88% rename from packages/@aws-cdk/aws-cloudfront/test/example.acm-cert-alias.lit.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/example.acm-cert-alias.lit.ts index 861df3df10bdd..858a1deecb9e4 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/example.acm-cert-alias.lit.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/example.acm-cert-alias.lit.ts @@ -1,6 +1,6 @@ -import * as certificatemanager from '@aws-cdk/aws-certificatemanager'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; +import * as certificatemanager from '../../aws-certificatemanager'; +import * as s3 from '../../aws-s3'; +import { App, Stack } from '../../core'; import { Construct } from 'constructs'; import * as cloudfront from '../lib'; diff --git a/packages/@aws-cdk/aws-cloudfront/test/example.default-cert-alias.lit.ts b/packages/aws-cdk-lib/aws-cloudfront/test/example.default-cert-alias.lit.ts similarity index 90% rename from packages/@aws-cdk/aws-cloudfront/test/example.default-cert-alias.lit.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/example.default-cert-alias.lit.ts index 68882bcb9b7ee..a7aa75f1f22e2 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/example.default-cert-alias.lit.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/example.default-cert-alias.lit.ts @@ -1,5 +1,5 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; +import * as s3 from '../../aws-s3'; +import { App, Stack } from '../../core'; import { Construct } from 'constructs'; import * as cloudfront from '../lib'; diff --git a/packages/@aws-cdk/aws-cloudfront/test/example.iam-cert-alias.lit.ts b/packages/aws-cdk-lib/aws-cloudfront/test/example.iam-cert-alias.lit.ts similarity index 92% rename from packages/@aws-cdk/aws-cloudfront/test/example.iam-cert-alias.lit.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/example.iam-cert-alias.lit.ts index 9c8f50f191c9f..93978b0d02a77 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/example.iam-cert-alias.lit.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/example.iam-cert-alias.lit.ts @@ -1,5 +1,5 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; +import * as s3 from '../../aws-s3'; +import { App, Stack } from '../../core'; import { Construct } from 'constructs'; import * as cloudfront from '../lib'; diff --git a/packages/@aws-cdk/aws-cloudfront/test/experimental/edge-function.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/experimental/edge-function.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/test/experimental/edge-function.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/experimental/edge-function.test.ts index 597c09eea4605..54dff2ef5487e 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/experimental/edge-function.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/experimental/edge-function.test.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as cdk from '../../../core'; import * as cloudfront from '../../lib'; let app: cdk.App; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py b/packages/aws-cdk-lib/aws-cloudfront/test/experimental/my-lambda-handler/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py rename to packages/aws-cdk-lib/aws-cloudfront/test/experimental/my-lambda-handler/index.py diff --git a/packages/@aws-cdk/aws-cloudfront/test/function-code.js b/packages/aws-cdk-lib/aws-cloudfront/test/function-code.js similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/function-code.js rename to packages/aws-cdk-lib/aws-cloudfront/test/function-code.js diff --git a/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts new file mode 100644 index 0000000000000..7573e1c7e65af --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudfront/test/function.test.ts @@ -0,0 +1,135 @@ +import * as path from 'path'; +import { Template } from '../../assertions'; +import { App, Stack } from '../../core'; +import { Function, FunctionCode } from '../lib'; + +describe('CloudFront Function', () => { + + test('minimal example', () => { + const app = new App(); + const stack = new Stack(app, 'Stack', { + env: { account: '123456789012', region: 'testregion' }, + }); + new Function(stack, 'CF2', { + code: FunctionCode.fromInline('code'), + }); + + Template.fromStack(stack).templateMatches({ + Resources: { + CF2D7241DD7: { + Type: 'AWS::CloudFront::Function', + Properties: { + Name: 'testregionStackCF2CE3F783F', + AutoPublish: true, + FunctionCode: 'code', + FunctionConfig: { + Comment: 'testregionStackCF2CE3F783F', + Runtime: 'cloudfront-js-1.0', + }, + }, + }, + }, + }); + }); + + test('minimal example in environment agnostic stack', () => { + const app = new App(); + const stack = new Stack(app, 'Stack'); + new Function(stack, 'CF2', { + code: FunctionCode.fromInline('code'), + }); + + Template.fromStack(stack).templateMatches({ + Resources: { + CF2D7241DD7: { + Type: 'AWS::CloudFront::Function', + Properties: { + Name: { + 'Fn::Join': [ + '', + [ + { + Ref: 'AWS::Region', + }, + 'StackCF2CE3F783F', + ], + ], + }, + AutoPublish: true, + FunctionCode: 'code', + FunctionConfig: { + Comment: { + 'Fn::Join': [ + '', + [ + { + Ref: 'AWS::Region', + }, + 'StackCF2CE3F783F', + ], + ], + }, + Runtime: 'cloudfront-js-1.0', + }, + }, + }, + }, + }); + }); + + test('maximum example', () => { + const app = new App(); + const stack = new Stack(app, 'Stack', { + env: { account: '123456789012', region: 'testregion' }, + }); + new Function(stack, 'CF2', { + code: FunctionCode.fromInline('code'), + comment: 'My super comment', + functionName: 'FunctionName', + }); + + Template.fromStack(stack).templateMatches({ + Resources: { + CF2D7241DD7: { + Type: 'AWS::CloudFront::Function', + Properties: { + Name: 'FunctionName', + AutoPublish: true, + FunctionCode: 'code', + FunctionConfig: { + Comment: 'My super comment', + Runtime: 'cloudfront-js-1.0', + }, + }, + }, + }, + }); + }); + + test('code from external file', () => { + const app = new App(); + const stack = new Stack(app, 'Stack', { + env: { account: '123456789012', region: 'testregion' }, + }); + new Function(stack, 'CF2', { + code: FunctionCode.fromFile({ filePath: path.join(__dirname, 'function-code.js') }), + }); + + Template.fromStack(stack).templateMatches({ + Resources: { + CF2D7241DD7: { + Type: 'AWS::CloudFront::Function', + Properties: { + Name: 'testregionStackCF2CE3F783F', + AutoPublish: true, + FunctionCode: 'function handler(event) {\n return event.request;\n}', + FunctionConfig: { + Comment: 'testregionStackCF2CE3F783F', + Runtime: 'cloudfront-js-1.0', + }, + }, + }, + }, + }); + }); +}); diff --git a/packages/@aws-cdk/aws-cloudfront/test/geo-restriction.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/geo-restriction.test.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/geo-restriction.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/geo-restriction.test.ts diff --git a/packages/@aws-cdk/aws-cloudfront/test/key-group.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/key-group.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/test/key-group.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/key-group.test.ts index 6a1dfbdd90a5d..bbc8a3bca7f3c 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/key-group.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/key-group.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Stack } from '../../core'; import { KeyGroup, PublicKey } from '../lib'; const publicKey1 = `-----BEGIN PUBLIC KEY----- diff --git a/packages/@aws-cdk/aws-cloudfront/test/oai.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/oai.test.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudfront/test/oai.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/oai.test.ts index 167d6356741a7..95b2f589c9bea 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/oai.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/oai.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; +import { Template } from '../../assertions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { OriginAccessIdentity } from '../lib'; describe('Origin Access Identity', () => { diff --git a/packages/@aws-cdk/aws-cloudfront/test/origin-groups.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/origin-groups.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront/test/origin-groups.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/origin-groups.test.ts index 62b4fd25b7202..4a0c661eda0de 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/origin-groups.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/origin-groups.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; +import { Match, Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { CloudFrontWebDistribution, FailoverStatusCode } from '../lib'; describe('origin group', () => { diff --git a/packages/@aws-cdk/aws-cloudfront/test/origin-request-policy.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/origin-request-policy.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/test/origin-request-policy.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/origin-request-policy.test.ts index fb2c3b7dc3b9b..f8ea37de19ac8 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/origin-request-policy.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/origin-request-policy.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Aws, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Aws, Stack } from '../../core'; import { OriginRequestPolicy, OriginRequestCookieBehavior, OriginRequestHeaderBehavior, OriginRequestQueryStringBehavior } from '../lib'; describe('OriginRequestPolicy', () => { diff --git a/packages/@aws-cdk/aws-cloudfront/test/origin.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/origin.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/test/origin.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/origin.test.ts index a365810364d66..75df3c7d6acfb 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/origin.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/origin.test.ts @@ -1,4 +1,4 @@ -import { App, Stack, Duration } from '@aws-cdk/core'; +import { App, Stack, Duration } from '../../core'; import { TestOrigin } from './test-origin'; let app: App; diff --git a/packages/@aws-cdk/aws-cloudfront/test/private/cache-behavior.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/private/cache-behavior.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudfront/test/private/cache-behavior.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/private/cache-behavior.test.ts index 842f42e494157..71741d3e838e7 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/private/cache-behavior.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/private/cache-behavior.test.ts @@ -1,5 +1,5 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import { App, Stack } from '@aws-cdk/core'; +import * as lambda from '../../../aws-lambda'; +import { App, Stack } from '../../../core'; import { AllowedMethods, CachedMethods, CachePolicy, KeyGroup, LambdaEdgeEventType, OriginRequestPolicy, PublicKey, ViewerProtocolPolicy } from '../../lib'; import { CacheBehavior } from '../../lib/private/cache-behavior'; diff --git a/packages/@aws-cdk/aws-cloudfront/test/public-key.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/public-key.test.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudfront/test/public-key.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/public-key.test.ts index 75ae100ab9bfd..a9da25a620dff 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/public-key.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/public-key.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Stack } from '../../core'; import { PublicKey } from '../lib'; const publicKey = `-----BEGIN PUBLIC KEY----- diff --git a/packages/@aws-cdk/aws-cloudfront/test/response-headers-policy.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/response-headers-policy.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudfront/test/response-headers-policy.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/response-headers-policy.test.ts index 0c1898748b5e8..2950ec5373dea 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/response-headers-policy.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/response-headers-policy.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Duration, Stack } from '../../core'; import { HeadersFrameOption, HeadersReferrerPolicy, ResponseHeadersPolicy } from '../lib'; describe('ResponseHeadersPolicy', () => { diff --git a/packages/@aws-cdk/aws-cloudfront/test/test-origin.ts b/packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudfront/test/test-origin.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/test-origin.ts diff --git a/packages/@aws-cdk/aws-cloudfront/test/web-distribution.test.ts b/packages/aws-cdk-lib/aws-cloudfront/test/web-distribution.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudfront/test/web-distribution.test.ts rename to packages/aws-cdk-lib/aws-cloudfront/test/web-distribution.test.ts index e5b65d12915ed..30466d089333e 100644 --- a/packages/@aws-cdk/aws-cloudfront/test/web-distribution.test.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/test/web-distribution.test.ts @@ -1,10 +1,10 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as certificatemanager from '@aws-cdk/aws-certificatemanager'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; +import { Match, Template } from '../../assertions'; +import * as certificatemanager from '../../aws-certificatemanager'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { CfnDistribution, CloudFrontWebDistribution, diff --git a/packages/aws-cdk-lib/aws-cloudtrail/.jsiirc.json b/packages/aws-cdk-lib/aws-cloudtrail/.jsiirc.json new file mode 100644 index 0000000000000..b78b6e9f4b678 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudtrail/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloudtrail" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CloudTrail" + }, + "python": { + "module": "aws_cdk.aws_cloudtrail" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloudtrail/README.md b/packages/aws-cdk-lib/aws-cloudtrail/README.md new file mode 100644 index 0000000000000..fabd6bdf43b10 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudtrail/README.md @@ -0,0 +1,203 @@ +# AWS CloudTrail Construct Library + + +## Trail + +AWS CloudTrail enables governance, compliance, and operational and risk auditing of your AWS account. Actions taken by +a user, role, or an AWS service are recorded as events in CloudTrail. Learn more at the [CloudTrail +documentation](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html). + +The `Trail` construct enables ongoing delivery of events as log files to an Amazon S3 bucket. Learn more about [Creating +a Trail for Your AWS Account](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html). +The following code creates a simple CloudTrail for your account - + +```ts +const trail = new cloudtrail.Trail(this, 'CloudTrail'); +``` + +By default, this will create a new S3 Bucket that CloudTrail will write to, and choose a few other reasonable defaults +such as turning on multi-region and global service events. +The defaults for each property and how to override them are all documented on the `TrailProps` interface. + +## Log File Validation + +In order to validate that the CloudTrail log file was not modified after CloudTrail delivered it, CloudTrail provides a +digital signature for each file. Learn more at [Validating CloudTrail Log File +Integrity](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-log-file-validation-intro.html). + +This is enabled on the `Trail` construct by default, but can be turned off by setting `enableFileValidation` to `false`. + +```ts +const trail = new cloudtrail.Trail(this, 'CloudTrail', { + enableFileValidation: false, +}); +``` + +## Notifications + +Amazon SNS notifications can be configured upon new log files containing Trail events are delivered to S3. +Learn more at [Configuring Amazon SNS Notifications for +CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/configure-sns-notifications-for-cloudtrail.html). +The following code configures an SNS topic to be notified - + +```ts +const topic = new sns.Topic(this, 'TrailTopic'); +const trail = new cloudtrail.Trail(this, 'CloudTrail', { + snsTopic: topic, +}); +``` + +## Service Integrations + +Besides sending trail events to S3, they can also be configured to notify other AWS services - + +### Amazon CloudWatch Logs + +CloudTrail events can be delivered to a CloudWatch Logs LogGroup. By default, a new LogGroup is created with a +default retention setting. The following code enables sending CloudWatch logs but specifies a particular retention +period for the created Log Group. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; + +const trail = new cloudtrail.Trail(this, 'CloudTrail', { + sendToCloudWatchLogs: true, + cloudWatchLogsRetention: logs.RetentionDays.FOUR_MONTHS, +}); +``` + +If you would like to use a specific log group instead, this can be configured via `cloudwatchLogGroup`. + +### Amazon EventBridge + +Amazon EventBridge rules can be configured to be triggered when CloudTrail events occur using the `Trail.onEvent()` API. +Using APIs available in `aws-events`, these events can be filtered to match to those that are of interest, either from +a specific service, account or time range. See [Events delivered via +CloudTrail](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#events-for-services-not-listed) +to learn more about the event structure for events from CloudTrail. + +The following code filters events for S3 from a specific AWS account and triggers a lambda function. + +```ts +const myFunctionHandler = new lambda.Function(this, 'MyFunction', { + code: lambda.Code.fromAsset('resource/myfunction'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', +}); + +const eventRule = cloudtrail.Trail.onEvent(this, 'MyCloudWatchEvent', { + target: new targets.LambdaFunction(myFunctionHandler), +}); + +eventRule.addEventPattern({ + account: ['123456789012'], + source: ['aws.s3'], +}); +``` + +## Multi-Region & Global Service Events + +By default, a `Trail` is configured to deliver log files from multiple regions to a single S3 bucket for a given +account. This creates shadow trails (replication of the trails) in all of the other regions. Learn more about [How +CloudTrail Behaves Regionally](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-regional-and-global-services) +and about the [`IsMultiRegion` +property](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudtrail-trail.html#cfn-cloudtrail-trail-ismultiregiontrail). + +For most services, events are recorded in the region where the action occurred. For global services such as AWS IAM, +AWS STS, Amazon CloudFront, Route 53, etc., events are delivered to any trail that includes global services. Learn more +[About Global Service Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-global-service-events). + +Events for global services are turned on by default for `Trail` constructs in the CDK. + +The following code disables multi-region trail delivery and trail delivery for global services for a specific `Trail` - + +```ts +const trail = new cloudtrail.Trail(this, 'CloudTrail', { + // ... + isMultiRegionTrail: false, + includeGlobalServiceEvents: false, +}); +``` + +## Events Types + +**Management events** provide information about management operations that are performed on resources in your AWS +account. These are also known as control plane operations. Learn more about [Management +Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-events). + +By default, a `Trail` logs all management events. However, they can be configured to either be turned off, or to only +log 'Read' or 'Write' events. + +The following code configures the `Trail` to only track management events that are of type 'Read'. + +```ts +const trail = new cloudtrail.Trail(this, 'CloudTrail', { + // ... + managementEvents: cloudtrail.ReadWriteType.READ_ONLY, +}); +``` + +**Data events** provide information about the resource operations performed on or in a resource. These are also known +as data plane operations. Learn more about [Data +Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-concepts.html#cloudtrail-concepts-events). +By default, no data events are logged for a `Trail`. + +AWS CloudTrail supports data event logging for Amazon S3 objects and AWS Lambda functions. + +The `logAllS3DataEvents()` API configures the trail to log all S3 data events while the `addS3EventSelector()` API can +be used to configure logging of S3 data events for specific buckets and specific object prefix. The following code +configures logging of S3 data events for `fooBucket` and with object prefix `bar/`. + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; + +const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail'); +declare const bucket: s3.Bucket; + +// Adds an event selector to the bucket foo +trail.addS3EventSelector([{ + bucket, + objectPrefix: 'bar/', +}]); +``` + +Similarly, the `logAllLambdaDataEvents()` configures the trail to log all Lambda data events while the +`addLambdaEventSelector()` API can be used to configure logging for specific Lambda functions. The following code +configures logging of Lambda data events for a specific Function. + +```ts +const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail'); +const amazingFunction = new lambda.Function(this, 'AnAmazingFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: "hello.handler", + code: lambda.Code.fromAsset("lambda"), +}); + +// Add an event selector to log data events for the provided Lambda functions. +trail.addLambdaEventSelector([ amazingFunction ]); +``` + +## Organization Trail + +It is possible to create a trail that will be applied to all accounts in an organization if the current account manages an organization. +To enable this, the property `isOrganizationTrail` must be set. If this property is set and the current account does not manage an organization, the stack will fail to deploy. + +```ts +new cloudtrail.Trail(this, 'OrganizationTrail', { + isOrganizationTrail: true, +}); +``` + +## CloudTrail Insights + +Set `InsightSelector` to enable Insight. +Insights selector values can be `ApiCallRateInsight`, `ApiErrorRateInsight`, or both. + +```ts +new Trail(stack, 'Insights', { + insightTypes: [ + InsightType.API_CALL_RATE, + InsightType.API_ERROR_RATE, + ], +}); +``` diff --git a/packages/@aws-cdk/aws-cloudtrail/SAMPLE-EVENTS.md b/packages/aws-cdk-lib/aws-cloudtrail/SAMPLE-EVENTS.md similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/SAMPLE-EVENTS.md rename to packages/aws-cdk-lib/aws-cloudtrail/SAMPLE-EVENTS.md diff --git a/packages/aws-cdk-lib/aws-cloudtrail/index.ts b/packages/aws-cdk-lib/aws-cloudtrail/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudtrail/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts b/packages/aws-cdk-lib/aws-cloudtrail/lib/cloudtrail.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts rename to packages/aws-cdk-lib/aws-cloudtrail/lib/cloudtrail.ts index 1838a043429bb..e09b66691db2e 100644 --- a/packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts +++ b/packages/aws-cdk-lib/aws-cloudtrail/lib/cloudtrail.ts @@ -1,11 +1,11 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import { Resource, Stack } from '@aws-cdk/core'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import { Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnTrail } from './cloudtrail.generated'; diff --git a/packages/@aws-cdk/aws-cloudtrail/lib/index.ts b/packages/aws-cdk-lib/aws-cloudtrail/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudtrail/lib/index.ts rename to packages/aws-cdk-lib/aws-cloudtrail/lib/index.ts diff --git a/packages/@aws-cdk/aws-cloudtrail/test/cloudtrail.test.ts b/packages/aws-cdk-lib/aws-cloudtrail/test/cloudtrail.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudtrail/test/cloudtrail.test.ts rename to packages/aws-cdk-lib/aws-cloudtrail/test/cloudtrail.test.ts index a026f732793ab..7cb226159e64c 100644 --- a/packages/@aws-cdk/aws-cloudtrail/test/cloudtrail.test.ts +++ b/packages/aws-cdk-lib/aws-cloudtrail/test/cloudtrail.test.ts @@ -1,12 +1,12 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { LogGroup, RetentionDays } from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import { LogGroup, RetentionDays } from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../core'; import { ManagementEventSources, ReadWriteType, Trail, InsightType } from '../lib'; const ExpectedBucketPolicyProperties = { diff --git a/packages/aws-cdk-lib/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts b/packages/aws-cdk-lib/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts new file mode 100644 index 0000000000000..1a9172f82888e --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudtrail/test/integ.cloudtrail-supplied-bucket.lit.ts @@ -0,0 +1,50 @@ +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; + +import * as cloudtrail from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail'); + +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); + +// using exctecy the same code as inside the cloudtrail class to produce the supplied bucket and policy +const cloudTrailPrincipal = new iam.ServicePrincipal('cloudtrail.amazonaws.com'); + +const Trailbucket = new s3.Bucket(stack, 'S3', { + encryption: s3.BucketEncryption.UNENCRYPTED, + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); + +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.bucketArn], + actions: ['s3:GetBucketAcl'], + principals: [cloudTrailPrincipal], +})); + +Trailbucket.addToResourcePolicy(new iam.PolicyStatement({ + resources: [Trailbucket.arnForObjects(`AWSLogs/${cdk.Stack.of(stack).account}/*`)], + actions: ['s3:PutObject'], + principals: [cloudTrailPrincipal], + conditions: { + StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' }, + }, +})); + +const trail = new cloudtrail.Trail(stack, 'Trail', { bucket: Trailbucket }); + +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-cloudtrail/test/integ.cloudtrail.lit.ts b/packages/aws-cdk-lib/aws-cloudtrail/test/integ.cloudtrail.lit.ts new file mode 100644 index 0000000000000..52736ff6ffeb1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudtrail/test/integ.cloudtrail.lit.ts @@ -0,0 +1,27 @@ +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; +import * as cloudtrail from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'integ-cloudtrail'); + +const bucket = new s3.Bucket(stack, 'Bucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +const topic = new sns.Topic(stack, 'Topic'); +const lambdaFunction = new lambda.Function(stack, 'LambdaFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'hello.handler', + code: lambda.Code.fromInline('exports.handler = {}'), +}); + +const trail = new cloudtrail.Trail(stack, 'Trail', { + snsTopic: topic, +}); +trail.addLambdaEventSelector([lambdaFunction]); +trail.addS3EventSelector([{ bucket }]); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/.jsiirc.json b/packages/aws-cdk-lib/aws-cloudwatch-actions/.jsiirc.json new file mode 100644 index 0000000000000..675fd6f567c2e --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloudwatch.actions" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CloudWatch.Actions" + }, + "python": { + "module": "aws_cdk.aws_cloudwatch_actions" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/README.md b/packages/aws-cdk-lib/aws-cloudwatch-actions/README.md new file mode 100644 index 0000000000000..79647f527b7b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/README.md @@ -0,0 +1,43 @@ +# CloudWatch Alarm Actions library + + +This library contains a set of classes which can be used as CloudWatch Alarm actions. + +The currently implemented actions are: EC2 Actions, SNS Actions, SSM OpsCenter Actions, Autoscaling Actions and Application Autoscaling Actions + + +## EC2 Action Example + +```ts +// Alarm must be configured with an EC2 per-instance metric +declare const alarm: cloudwatch.Alarm; +// Attach a reboot when alarm triggers +alarm.addAlarmAction( + new actions.Ec2Action(actions.Ec2InstanceAction.REBOOT), +); +``` + +## SSM OpsCenter Action Example + +```ts +declare const alarm: cloudwatch.Alarm; +// Create an OpsItem with specific severity and category when alarm triggers +alarm.addAlarmAction( + new actions.SsmAction( + actions.OpsItemSeverity.CRITICAL, + actions.OpsItemCategory.PERFORMANCE // category is optional + ) +); +``` + +## SSM Incident Manager Action Example + +```ts +declare const alarm: cloudwatch.Alarm; +// Create an Incident Manager incident based on a specific response plan +alarm.addAlarmAction( + new actions.SsmIncidentAction('ResponsePlanName') +); +``` + +See `@aws-cdk/aws-cloudwatch` for more information. diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/index.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/lib/appscaling.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/appscaling.ts similarity index 82% rename from packages/@aws-cdk/aws-cloudwatch-actions/lib/appscaling.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/lib/appscaling.ts index d548120e1c716..2683044880c63 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/lib/appscaling.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/appscaling.ts @@ -1,5 +1,5 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/lib/autoscaling.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/autoscaling.ts similarity index 83% rename from packages/@aws-cdk/aws-cloudwatch-actions/lib/autoscaling.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/lib/autoscaling.ts index 0c4ad825572c9..0899e8b2b9a7c 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/lib/autoscaling.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/autoscaling.ts @@ -1,5 +1,5 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as autoscaling from '../../aws-autoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/lib/ec2.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/ec2.ts similarity index 90% rename from packages/@aws-cdk/aws-cloudwatch-actions/lib/ec2.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/lib/ec2.ts index 9e7ac47cf3b5e..8842d9ad7ab6a 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/lib/ec2.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/ec2.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Stack } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/lib/index.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch-actions/lib/index.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/sns.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/sns.ts new file mode 100644 index 0000000000000..4a9646b8f5d80 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/sns.ts @@ -0,0 +1,18 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import * as sns from '../../aws-sns'; +import { Construct } from 'constructs'; + +/** + * Use an SNS topic as an alarm action + */ +export class SnsAction implements cloudwatch.IAlarmAction { + constructor(private readonly topic: sns.ITopic) { + } + + /** + * Returns an alarm action configuration to use an SNS topic as an alarm action + */ + public bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { + return { alarmActionArn: this.topic.topicArn }; + } +} diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/lib/ssm.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/ssm.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudwatch-actions/lib/ssm.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/lib/ssm.ts index 6986580bcc4d4..982b5a7e4c8c0 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/lib/ssm.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/lib/ssm.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Stack } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/appscaling.test.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/appscaling.test.ts similarity index 80% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/appscaling.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/test/appscaling.test.ts index 066df92d34b45..2b27d0e248f46 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/test/appscaling.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/appscaling.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Stack } from '../../core'; import * as actions from '../lib'; test('can use topic as alarm action', () => { diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/ec2.test.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/ec2.test.ts similarity index 86% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/ec2.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/test/ec2.test.ts index 0d4a31022b08b..f955f2791d32f 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/test/ec2.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/ec2.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Stack } from '../../core'; import * as actions from '../lib'; test('can use instance reboot as alarm action', () => { diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/test/scaling.test.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/scaling.test.ts new file mode 100644 index 0000000000000..f173292590d8f --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/scaling.test.ts @@ -0,0 +1,37 @@ +import { Template } from '../../assertions'; +import * as autoscaling from '../../aws-autoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import { Stack } from '../../core'; +import * as actions from '../lib'; + +test('can use topic as alarm action', () => { + // GIVEN + const stack = new Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'ASG', { + minCapacity: 1, + maxCapacity: 100, + instanceType: new ec2.InstanceType('t-1000.macro'), + machineImage: new ec2.AmazonLinuxImage(), + vpc, + }); + const action = new autoscaling.StepScalingAction(stack, 'Action', { + autoScalingGroup, + }); + const alarm = new cloudwatch.Alarm(stack, 'Alarm', { + metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Henk' }), + evaluationPeriods: 3, + threshold: 100, + }); + + // WHEN + alarm.addAlarmAction(new actions.AutoScalingAction(action)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + AlarmActions: [ + { Ref: 'Action62AD07C0' }, + ], + }); +}); diff --git a/packages/aws-cdk-lib/aws-cloudwatch-actions/test/sns.test.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/sns.test.ts new file mode 100644 index 0000000000000..04b555a4a71f5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/sns.test.ts @@ -0,0 +1,26 @@ +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as sns from '../../aws-sns'; +import { Stack } from '../../core'; +import * as actions from '../lib'; + +test('can use topic as alarm action', () => { + // GIVEN + const stack = new Stack(); + const topic = new sns.Topic(stack, 'Topic'); + const alarm = new cloudwatch.Alarm(stack, 'Alarm', { + metric: new cloudwatch.Metric({ namespace: 'AWS', metricName: 'Henk' }), + evaluationPeriods: 3, + threshold: 100, + }); + + // WHEN + alarm.addAlarmAction(new actions.SnsAction(topic)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + AlarmActions: [ + { Ref: 'TopicBFC7AF6E' }, + ], + }); +}); diff --git a/packages/@aws-cdk/aws-cloudwatch-actions/test/ssm.test.ts b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/ssm.test.ts similarity index 95% rename from packages/@aws-cdk/aws-cloudwatch-actions/test/ssm.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch-actions/test/ssm.test.ts index a77333d97200f..27136bbe9c856 100644 --- a/packages/@aws-cdk/aws-cloudwatch-actions/test/ssm.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch-actions/test/ssm.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Stack } from '../../core'; import * as actions from '../lib'; test('can use ssm with critical severity and performance category as alarm action', () => { diff --git a/packages/aws-cdk-lib/aws-cloudwatch/.jsiirc.json b/packages/aws-cdk-lib/aws-cloudwatch/.jsiirc.json new file mode 100644 index 0000000000000..117d3f18a2dda --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cloudwatch" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CloudWatch" + }, + "python": { + "module": "aws_cdk.aws_cloudwatch" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cloudwatch/README.md b/packages/aws-cdk-lib/aws-cloudwatch/README.md new file mode 100644 index 0000000000000..ed2b6b53e1c9b --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch/README.md @@ -0,0 +1,704 @@ +# Amazon CloudWatch Construct Library + + +## Metric objects + +Metric objects represent a metric that is emitted by AWS services or your own +application, such as `CPUUsage`, `FailureCount` or `Bandwidth`. + +Metric objects can be constructed directly or are exposed by resources as +attributes. Resources that expose metrics will have functions that look +like `metricXxx()` which will return a Metric object, initialized with defaults +that make sense. + +For example, `lambda.Function` objects have the `fn.metricErrors()` method, which +represents the amount of errors reported by that Lambda function: + +```ts +declare const fn: lambda.Function; + +const errors = fn.metricErrors(); +``` + +`Metric` objects can be account and region aware. You can specify `account` and `region` as properties of the metric, or use the `metric.attachTo(Construct)` method. `metric.attachTo()` will automatically copy the `region` and `account` fields of the `Construct`, which can come from anywhere in the Construct tree. + +You can also instantiate `Metric` objects to reference any +[published metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) +that's not exposed using a convenience method on the CDK construct. +For example: + +```ts +const hostedZone = new route53.HostedZone(this, 'MyHostedZone', { zoneName: "example.org" }); +const metric = new cloudwatch.Metric({ + namespace: 'AWS/Route53', + metricName: 'DNSQueries', + dimensionsMap: { + HostedZoneId: hostedZone.hostedZoneId + } +}); +``` + +### Instantiating a new Metric object + +If you want to reference a metric that is not yet exposed by an existing construct, +you can instantiate a `Metric` object to represent it. For example: + +```ts +const metric = new cloudwatch.Metric({ + namespace: 'MyNamespace', + metricName: 'MyMetric', + dimensionsMap: { + ProcessingStep: 'Download' + } +}); +``` + +### Metric Math + +Math expressions are supported by instantiating the `MathExpression` class. +For example, a math expression that sums two other metrics looks like this: + +```ts +declare const fn: lambda.Function; + +const allProblems = new cloudwatch.MathExpression({ + expression: "errors + throttles", + usingMetrics: { + errors: fn.metricErrors(), + throttles: fn.metricThrottles(), + } +}); +``` + +You can use `MathExpression` objects like any other metric, including using +them in other math expressions: + +```ts +declare const fn: lambda.Function; +declare const allProblems: cloudwatch.MathExpression; + +const problemPercentage = new cloudwatch.MathExpression({ + expression: "(problems / invocations) * 100", + usingMetrics: { + problems: allProblems, + invocations: fn.metricInvocations() + } +}); +``` + +### Search Expressions + +Math expressions also support search expressions. For example, the following +search expression returns all CPUUtilization metrics that it finds, with the +graph showing the Average statistic with an aggregation period of 5 minutes: + +```ts +const cpuUtilization = new cloudwatch.MathExpression({ + expression: "SEARCH('{AWS/EC2,InstanceId} MetricName=\"CPUUtilization\"', 'Average', 300)", + + // Specifying '' as the label suppresses the default behavior + // of using the expression as metric label. This is especially appropriate + // when using expressions that return multiple time series (like SEARCH() + // or METRICS()), to show the labels of the retrieved metrics only. + label: '', +}); +``` + +Cross-account and cross-region search expressions are also supported. Use +the `searchAccount` and `searchRegion` properties to specify the account +and/or region to evaluate the search expression against. + +### Aggregation + +To graph or alarm on metrics you must aggregate them first, using a function +like `Average` or a percentile function like `P99`. By default, most Metric objects +returned by CDK libraries will be configured as `Average` over `300 seconds` (5 minutes). +The exception is if the metric represents a count of discrete events, such as +failures. In that case, the Metric object will be configured as `Sum` over `300 +seconds`, i.e. it represents the number of times that event occurred over the +time period. + +If you want to change the default aggregation of the Metric object (for example, +the function or the period), you can do so by passing additional parameters +to the metric function call: + +```ts +declare const fn: lambda.Function; + +const minuteErrorRate = fn.metricErrors({ + statistic: cloudwatch.Stats.AVERAGE, + period: Duration.minutes(1), + label: 'Lambda failure rate' +}); +``` + +The `statistic` field accepts a `string`; the `cloudwatch.Stats` object has a +number of predefined factory functions that help you constructs strings that are +appropriate for CloudWatch. The `metricErrors` function also allows changing the +metric label or color, which will be useful when embedding them in graphs (see +below). + +> Rates versus Sums +> +> The reason for using `Sum` to count discrete events is that *some* events are +> emitted as either `0` or `1` (for example `Errors` for a Lambda) and some are +> only emitted as `1` (for example `NumberOfMessagesPublished` for an SNS +> topic). +> +> In case `0`-metrics are emitted, it makes sense to take the `Average` of this +> metric: the result will be the fraction of errors over all executions. +> +> If `0`-metrics are not emitted, the `Average` will always be equal to `1`, +> and not be very useful. +> +> In order to simplify the mental model of `Metric` objects, we default to +> aggregating using `Sum`, which will be the same for both metrics types. If you +> happen to know the Metric you want to alarm on makes sense as a rate +> (`Average`) you can always choose to change the statistic. + +### Available Aggregation Statistics + +For your metrics aggregation, you can use the following statistics: + +| Statistic | Short format | Long format | Factory name | +| ------------------------ | :-----------------: | :------------------------------------------: | -------------------- | +| SampleCount (n) | ❌ | ❌ | `Stats.SAMPLE_COUNT` | +| Average (avg) | ❌ | ❌ | `Stats.AVERAGE` | +| Sum | ❌ | ❌ | `Stats.SUM` | +| Minimum (min) | ❌ | ❌ | `Stats.MINIMUM` | +| Maximum (max) | ❌ | ❌ | `Stats.MAXIMUM` | +| Interquartile mean (IQM) | ❌ | ❌ | `Stats.IQM` | +| Percentile (p) | `p99` | ❌ | `Stats.p(99)` | +| Winsorized mean (WM) | `wm99` = `WM(:99%)` | `WM(x:y) \| WM(x%:y%) \| WM(x%:) \| WM(:y%)` | `Stats.wm(10, 90)` | +| Trimmed count (TC) | `tc99` = `TC(:99%)` | `TC(x:y) \| TC(x%:y%) \| TC(x%:) \| TC(:y%)` | `Stats.tc(10, 90)` | +| Trimmed sum (TS) | `ts99` = `TS(:99%)` | `TS(x:y) \| TS(x%:y%) \| TS(x%:) \| TS(:y%)` | `Stats.ts(10, 90)` | +| Percentile rank (PR) | ❌ | `PR(x:y) \| PR(x:) \| PR(:y)` | `Stats.pr(10, 5000)` | + +The most common values are provided in the `cloudwatch.Stats` class. You can provide any string if your statistic is not in the class. + +Read more at [CloudWatch statistics definitions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Statistics-definitions.html). + +```ts +new cloudwatch.Metric({ + namespace: 'AWS/Route53', + metricName: 'DNSQueries', + dimensionsMap: { + HostedZoneId: hostedZone.hostedZoneId + }, + statistic: cloudwatch.Stats.SAMPLE_COUNT, + period: cloudwatch.Duration.minutes(5) +}); + +new cloudwatch.Metric({ + namespace: 'AWS/Route53', + metricName: 'DNSQueries', + dimensionsMap: { + HostedZoneId: hostedZone.hostedZoneId + }, + statistic: cloudwatch.Stats.p(99), + period: cloudwatch.Duration.minutes(5) +}); + +new cloudwatch.Metric({ + namespace: 'AWS/Route53', + metricName: 'DNSQueries', + dimensionsMap: { + HostedZoneId: hostedZone.hostedZoneId + }, + statistic: 'TS(7.5%:90%)', + period: cloudwatch.Duration.minutes(5) +}); +``` + +### Labels + +Metric labels are displayed in the legend of graphs that include the metrics. + +You can use [dynamic labels](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html) +to show summary information about the displayed time series +in the legend. For example, if you use: + +```ts +declare const fn: lambda.Function; + +const minuteErrorRate = fn.metricErrors({ + statistic: cloudwatch.Stats.SUM, + period: Duration.hours(1), + + // Show the maximum hourly error count in the legend + label: '[max: ${MAX}] Lambda failure rate', +}); +``` + +As the metric label, the maximum value in the visible range will +be shown next to the time series name in the graph's legend. + +If the metric is a math expression producing more than one time series, the +maximum will be individually calculated and shown for each time series produce +by the math expression. + +## Alarms + +Alarms can be created on metrics in one of two ways. Either create an `Alarm` +object, passing the `Metric` object to set the alarm on: + +```ts +declare const fn: lambda.Function; + +new cloudwatch.Alarm(this, 'Alarm', { + metric: fn.metricErrors(), + threshold: 100, + evaluationPeriods: 2, +}); +``` + +Alternatively, you can call `metric.createAlarm()`: + +```ts +declare const fn: lambda.Function; + +fn.metricErrors().createAlarm(this, 'Alarm', { + threshold: 100, + evaluationPeriods: 2, +}); +``` + +The most important properties to set while creating an Alarms are: + +- `threshold`: the value to compare the metric against. +- `comparisonOperator`: the comparison operation to use, defaults to `metric >= threshold`. +- `evaluationPeriods`: how many consecutive periods the metric has to be + breaching the the threshold for the alarm to trigger. + +To create a cross-account alarm, make sure you have enabled [cross-account functionality](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html) in CloudWatch. Then, set the `account` property in the `Metric` object either manually or via the `metric.attachTo()` method. + +### Alarm Actions + +To add actions to an alarm, use the integration classes from the +`@aws-cdk/aws-cloudwatch-actions` package. For example, to post a message to +an SNS topic when an alarm breaches, do the following: + +```ts +import * as cw_actions from 'aws-cdk-lib/aws-cloudwatch-actions'; +declare const alarm: cloudwatch.Alarm; + +const topic = new sns.Topic(this, 'Topic'); +alarm.addAlarmAction(new cw_actions.SnsAction(topic)); +``` + +#### Notification formats + +Alarms can be created in one of two "formats": + +- With "top-level parameters" (these are the classic style of CloudWatch Alarms). +- With a list of metrics specifications (these are the modern style of CloudWatch Alarms). + +For backwards compatibility, CDK will try to create classic, top-level CloudWatch alarms +as much as possible, unless you are using features that cannot be expressed in that format. +Features that require the new-style alarm format are: + +- Metric math +- Cross-account metrics +- Labels + +The difference between these two does not impact the functionality of the alarm +in any way, *except* that the format of the notifications the Alarm generates is +different between them. This affects both the notifications sent out over SNS, +as well as the EventBridge events generated by this Alarm. If you are writing +code to consume these notifications, be sure to handle both formats. + +### Composite Alarms + +[Composite Alarms](https://aws.amazon.com/about-aws/whats-new/2020/03/amazon-cloudwatch-now-allows-you-to-combine-multiple-alarms/) +can be created from existing Alarm resources. + +```ts +declare const alarm1: cloudwatch.Alarm; +declare const alarm2: cloudwatch.Alarm; +declare const alarm3: cloudwatch.Alarm; +declare const alarm4: cloudwatch.Alarm; + +const alarmRule = cloudwatch.AlarmRule.anyOf( + cloudwatch.AlarmRule.allOf( + cloudwatch.AlarmRule.anyOf( + alarm1, + cloudwatch.AlarmRule.fromAlarm(alarm2, cloudwatch.AlarmState.OK), + alarm3, + ), + cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.fromAlarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA)), + ), + cloudwatch.AlarmRule.fromBoolean(false), +); + +new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', { + alarmRule, +}); +``` + +#### Actions Suppressor + +If you want to disable actions of a Composite Alarm based on a certain condition, you can use [Actions Suppression](https://www.amazonaws.cn/en/new/2022/amazon-cloudwatch-supports-composite-alarm-actions-suppression/). + +```ts +declare const childAlarm1: cloudwatch.Alarm; +declare const childAlarm2: cloudwatch.Alarm; +declare const onAlarmAction: cloudwatch.IAlarmAction; +declare const onOkAction: cloudwatch.IAlarmAction; +declare const actionsSuppressor: cloudwatch.Alarm; + +const alarmRule = cloudwatch.AlarmRule.anyOf(alarm1, alarm2); + +const myCompositeAlarm = new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', { + alarmRule, + actionsSuppressor, +}); +myCompositeAlarm.addAlarmActions(onAlarmAction); +myComposireAlarm.addOkAction(onOkAction); +``` + +In the provided example, if `actionsSuppressor` is in `ALARM` state, `onAlarmAction` won't be triggered even if `myCompositeAlarm` goes into `ALARM` state. +Similar, if `actionsSuppressor` is in `ALARM` state and `myCompositeAlarm` goes from `ALARM` into `OK` state, `onOkAction` won't be triggered. + +### A note on units + +In CloudWatch, Metrics datums are emitted with units, such as `seconds` or +`bytes`. When `Metric` objects are given a `unit` attribute, it will be used to +*filter* the stream of metric datums for datums emitted using the same `unit` +attribute. + +In particular, the `unit` field is *not* used to rescale datums or alarm threshold +values (for example, it cannot be used to specify an alarm threshold in +*Megabytes* if the metric stream is being emitted as *bytes*). + +You almost certainly don't want to specify the `unit` property when creating +`Metric` objects (which will retrieve all datums regardless of their unit), +unless you have very specific requirements. Note that in any case, CloudWatch +only supports filtering by `unit` for Alarms, not in Dashboard graphs. + +Please see the following GitHub issue for a discussion on real unit +calculations in CDK: https://github.com/aws/aws-cdk/issues/5595 + +## Dashboards + +Dashboards are set of Widgets stored server-side which can be accessed quickly +from the AWS console. Available widgets are graphs of a metric over time, the +current value of a metric, or a static piece of Markdown which explains what the +graphs mean. + +The following widgets are available: + +- `GraphWidget` -- shows any number of metrics on both the left and right + vertical axes. +- `AlarmWidget` -- shows the graph and alarm line for a single alarm. +- `SingleValueWidget` -- shows the current value of a set of metrics. +- `TextWidget` -- shows some static Markdown. +- `AlarmStatusWidget` -- shows the status of your alarms in a grid view. + +### Graph widget + +A graph widget can display any number of metrics on either the `left` or +`right` vertical axis: + +```ts +declare const dashboard: cloudwatch.Dashboard; +declare const executionCountMetric: cloudwatch.Metric; +declare const errorCountMetric: cloudwatch.Metric; + +dashboard.addWidgets(new cloudwatch.GraphWidget({ + title: "Executions vs error rate", + + left: [executionCountMetric], + + right: [errorCountMetric.with({ + statistic: cloudwatch.Stats.AVERAGE, + label: "Error rate", + color: cloudwatch.Color.GREEN, + })] +})); +``` + +Using the methods `addLeftMetric()` and `addRightMetric()` you can add metrics to a graph widget later on. + +Graph widgets can also display annotations attached to the left or the right y-axis. + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.GraphWidget({ + // ... + + leftAnnotations: [ + { value: 1800, label: Duration.minutes(30).toHumanString(), color: cloudwatch.Color.RED, }, + { value: 3600, label: '1 hour', color: '#2ca02c', } + ], +})); +``` + +The graph legend can be adjusted from the default position at bottom of the widget. + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.GraphWidget({ + // ... + + legendPosition: cloudwatch.LegendPosition.RIGHT, +})); +``` + +The graph can publish live data within the last minute that has not been fully aggregated. + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.GraphWidget({ + // ... + + liveData: true, +})); +``` + +The graph view can be changed from default 'timeSeries' to 'bar' or 'pie'. + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.GraphWidget({ + // ... + + view: cloudwatch.GraphWidgetView.BAR, +})); +``` + +### Gauge widget + +Gauge graph requires the max and min value of the left Y axis, if no value is informed the limits will be from 0 to 100. + +```ts +declare const dashboard: cloudwatch.Dashboard; +declare const errorAlarm: cloudwatch.Alarm; +declare const gaugeMetric: cloudwatch.Metric; + +dashboard.addWidgets(new cloudwatch.GaugeWidget({ + metrics: [gaugeMetric], + leftYAxis: { + min: 0, + max: 1000, + } +})); +``` + +### Alarm widget + +An alarm widget shows the graph and the alarm line of a single alarm: + +```ts +declare const dashboard: cloudwatch.Dashboard; +declare const errorAlarm: cloudwatch.Alarm; + +dashboard.addWidgets(new cloudwatch.AlarmWidget({ + title: "Errors", + alarm: errorAlarm, +})); +``` + +### Single value widget + +A single-value widget shows the latest value of a set of metrics (as opposed +to a graph of the value over time): + +```ts +declare const dashboard: cloudwatch.Dashboard; +declare const visitorCount: cloudwatch.Metric; +declare const purchaseCount: cloudwatch.Metric; + +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + metrics: [visitorCount, purchaseCount], +})); +``` + +Show as many digits as can fit, before rounding. + + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + metrics: [ /* ... */ ], + + fullPrecision: true, +})); +``` + +Sparkline allows you to glance the trend of a metric by displaying a simplified linegraph below the value. You can't use `sparkline: true` together with `setPeriodToTimeRange: true` + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.SingleValueWidget({ + metrics: [ /* ... */ ], + + sparkline: true, +})); +``` + +### Text widget + +A text widget shows an arbitrary piece of MarkDown. Use this to add explanations +to your dashboard: + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.TextWidget({ + markdown: '# Key Performance Indicators' +})); +``` + +Optionally set the TextWidget background to be transparent + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.TextWidget({ + markdown: '# Key Performance Indicators', + background: TextWidgetBackground.TRANSPARENT +})); +``` + +### Alarm Status widget + +An alarm status widget displays instantly the status of any type of alarms and gives the +ability to aggregate one or more alarms together in a small surface. + +```ts +declare const dashboard: cloudwatch.Dashboard; +declare const errorAlarm: cloudwatch.Alarm; + +dashboard.addWidgets( + new cloudwatch.AlarmStatusWidget({ + alarms: [errorAlarm], + }) +); +``` + +An alarm status widget only showing firing alarms, sorted by state and timestamp: + +```ts +declare const dashboard: cloudwatch.Dashboard; +declare const errorAlarm: cloudwatch.Alarm; + +dashboard.addWidgets(new cloudwatch.AlarmStatusWidget({ + title: "Errors", + alarms: [errorAlarm], + sortBy: cloudwatch.AlarmStatusWidgetSortBy.STATE_UPDATED_TIMESTAMP, + states: [cloudwatch.AlarmState.ALARM], +})); +``` + +### Query results widget + +A `LogQueryWidget` shows the results of a query from Logs Insights: + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + logGroupNames: ['my-log-group'], + view: cloudwatch.LogQueryVisualizationType.TABLE, + // The lines will be automatically combined using '\n|'. + queryLines: [ + 'fields @message', + 'filter @message like /Error/', + ] +})); +``` + +### Custom widget + +A `CustomWidget` shows the result of an AWS Lambda function: + +```ts +declare const dashboard: cloudwatch.Dashboard; + +// Import or create a lambda function +const fn = lambda.Function.fromFunctionArn( + dashboard, + 'Function', + 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', +); + +dashboard.addWidgets(new cloudwatch.CustomWidget({ + functionArn: fn.functionArn, + title: 'My lambda baked widget', +})); +``` + +You can learn more about custom widgets in the [Amazon Cloudwatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/add_custom_widget_dashboard.html). + +### Dashboard Layout + +The widgets on a dashboard are visually laid out in a grid that is 24 columns +wide. Normally you specify X and Y coordinates for the widgets on a Dashboard, +but because this is inconvenient to do manually, the library contains a simple +layout system to help you lay out your dashboards the way you want them to. + +Widgets have a `width` and `height` property, and they will be automatically +laid out either horizontally or vertically stacked to fill out the available +space. + +Widgets are added to a Dashboard by calling `add(widget1, widget2, ...)`. +Widgets given in the same call will be laid out horizontally. Widgets given +in different calls will be laid out vertically. To make more complex layouts, +you can use the following widgets to pack widgets together in different ways: + +- `Column`: stack two or more widgets vertically. +- `Row`: lay out two or more widgets horizontally. +- `Spacer`: take up empty space + +### Column widget + +A column widget contains other widgets and they will be laid out in a +vertical column. Widgets will be put one after another in order. + +```ts +declare const widgetA: cloudwatch.IWidget; +declare const widgetB: cloudwatch.IWidget; + +new cloudwatch.Column(widgetA, widgetB); +``` + +You can add a widget after object instantiation with the method +`addWidget()`. Each new widget will be put at the bottom of the column. + +### Row widget + +A row widget contains other widgets and they will be laid out in a +horizontal row. Widgets will be put one after another in order. +If the total width of the row exceeds the max width of the grid of 24 +columns, the row will wrap automatically and adapt its height. + +```ts +declare const widgetA: cloudwatch.IWidget; +declare const widgetB: cloudwatch.IWidget; + +new cloudwatch.Row(widgetA, widgetB); +``` + +You can add a widget after object instantiation with the method +`addWidget()`. + +### Interval duration for dashboard + +Interval duration for metrics in dashboard. You can specify `defaultInterval` with +the relative time(eg. 7 days) as `cdk.Duration.days(7)`. + +```ts +import * as cw from 'aws-cdk-lib/aws-cloudwatch'; + +const dashboard = new cw.Dashboard(stack, 'Dash', { + defaultInterval: cdk.Duration.days(7), +}); +``` + +Here, the dashboard would show the metrics for the last 7 days. diff --git a/packages/aws-cdk-lib/aws-cloudwatch/index.ts b/packages/aws-cdk-lib/aws-cloudwatch/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-action.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-action.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/alarm-action.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-action.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-base.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-base.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudwatch/lib/alarm-base.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-base.ts index 830fa04b290e5..ce77ee93396af 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-base.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-base.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { IAlarmAction } from './alarm-action'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-rule.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-rule.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/alarm-rule.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-rule.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm-status-widget.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-status-widget.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/alarm-status-widget.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-status-widget.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/alarm.ts index 74227317d4d4f..edbc0248d6a28 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm.ts @@ -1,4 +1,4 @@ -import { ArnFormat, Lazy, Stack, Token, Annotations } from '@aws-cdk/core'; +import { ArnFormat, Lazy, Stack, Token, Annotations } from '../../core'; import { Construct } from 'constructs'; import { IAlarmAction } from './alarm-action'; import { AlarmBase, IAlarm } from './alarm-base'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/composite-alarm.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/composite-alarm.ts index e2a412209e5c4..bba51289fd8ca 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/composite-alarm.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/composite-alarm.ts @@ -1,4 +1,4 @@ -import { ArnFormat, Lazy, Names, Stack, Duration } from '@aws-cdk/core'; +import { ArnFormat, Lazy, Names, Stack, Duration } from '../../core'; import { Construct } from 'constructs'; import { AlarmBase, IAlarm, IAlarmRule } from './alarm-base'; import { CfnCompositeAlarm } from './cloudwatch.generated'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/dashboard.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/dashboard.ts index 37cd92fd9e29b..e3da89bf5870d 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/dashboard.ts @@ -1,4 +1,4 @@ -import { Lazy, Resource, Stack, Token, Annotations, Duration } from '@aws-cdk/core'; +import { Lazy, Resource, Stack, Token, Annotations, Duration } from '../../core'; import { Construct } from 'constructs'; import { CfnDashboard } from './cloudwatch.generated'; import { Column, Row } from './layout'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/lib/graph.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts index ebcf83afab423..7ec29665e1382 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/graph.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { IAlarm } from './alarm-base'; import { IMetric } from './metric-types'; import { allMetricsGraphJson } from './private/rendering'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/index.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/index.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/index.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/layout.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/layout.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/layout.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/layout.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/log-query.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudwatch/lib/log-query.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts index 3984fb9bd88f4..85deb76ca980d 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/log-query.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { ConcreteWidget } from './widget'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/metric-types.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/metric-types.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/lib/metric-types.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/metric-types.ts index e68cabd3c9524..0fac96a135c1e 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/metric-types.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/metric-types.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../core'; /** * Interface for metrics diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/lib/metric.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts index 770c3604c3c5a..5fa603373ce33 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/metric.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/metric.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { Construct, IConstruct } from 'constructs'; import { Alarm, ComparisonOperator, TreatMissingData } from './alarm'; import { Dimension, IMetric, MetricAlarmConfig, MetricConfig, MetricGraphConfig, Statistic, Unit } from './metric-types'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.ts similarity index 96% rename from packages/@aws-cdk/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.ts index 093d7a318aded..e9f1d2b0ebd32 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/drop-empty-object-at-the-end-of-an-array-token.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { dropUndefined } from './object'; /** diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/env-tokens.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudwatch/lib/private/env-tokens.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.ts index 15fcda4886791..6db05606dcefc 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/private/env-tokens.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/env-tokens.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; /** * Make a Token that renders to given region if used in a different stack, otherwise undefined diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.ts index 8988148c16b3b..f668e8f63f4dc 100644 --- a/packages/@aws-cdk/aws-cloudwatch/lib/private/metric-util.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/metric-util.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../../core'; import { MathExpression } from '../metric'; import { IMetric, MetricConfig, MetricExpressionConfig, MetricStatConfig } from '../metric-types'; diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/object.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/object.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/private/object.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/private/object.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/rendering.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/rendering.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/private/rendering.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/private/rendering.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/private/statistic.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/private/statistic.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/private/statistic.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/private/statistic.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/stats.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/stats.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/stats.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/stats.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/text.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/text.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/text.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/text.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/lib/widget.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/widget.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/lib/widget.ts rename to packages/aws-cdk-lib/aws-cloudwatch/lib/widget.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/test/alarm-status-widget.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/alarm-status-widget.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cloudwatch/test/alarm-status-widget.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/alarm-status-widget.test.ts index 31cb33c724237..4f606f9efce3f 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/alarm-status-widget.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/alarm-status-widget.test.ts @@ -1,4 +1,4 @@ -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../core'; import { Metric, Alarm, AlarmStatusWidget, AlarmStatusWidgetSortBy, AlarmState } from '../lib'; describe('Alarm Status Widget', () => { test('alarm status widget', () => { diff --git a/packages/@aws-cdk/aws-cloudwatch/test/alarm.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/alarm.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudwatch/test/alarm.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/alarm.test.ts index e793cf1b9745d..ca88d9fbf398b 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/alarm.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/alarm.test.ts @@ -1,5 +1,5 @@ -import { Match, Template, Annotations } from '@aws-cdk/assertions'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Match, Template, Annotations } from '../../assertions'; +import { Duration, Stack } from '../../core'; import { Construct } from 'constructs'; import { Alarm, IAlarm, IAlarmAction, Metric, MathExpression, IMetric, Stats } from '../lib'; diff --git a/packages/@aws-cdk/aws-cloudwatch/test/composite-alarm.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/composite-alarm.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudwatch/test/composite-alarm.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/composite-alarm.test.ts index ad229dbbc5605..073d596d3a83a 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/composite-alarm.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/composite-alarm.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Duration, Stack } from '../../core'; import { Alarm, AlarmRule, AlarmState, CompositeAlarm, Metric } from '../lib'; describe('CompositeAlarm', () => { diff --git a/packages/@aws-cdk/aws-cloudwatch/test/cross-environment.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/cross-environment.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/test/cross-environment.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/cross-environment.test.ts index 00b9ef07b8aa8..0f64902c64a65 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/cross-environment.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/cross-environment.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Duration, Stack, Token, Aws } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import { Duration, Stack, Token, Aws } from '../../core'; import { Alarm, GraphWidget, IWidget, MathExpression, Metric } from '../lib'; const a = new Metric({ namespace: 'Test', metricName: 'ACount' }); diff --git a/packages/@aws-cdk/aws-cloudwatch/test/dashboard.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/dashboard.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cloudwatch/test/dashboard.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/dashboard.test.ts index 87641c935d448..2390de1520bb2 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/dashboard.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/dashboard.test.ts @@ -1,5 +1,5 @@ -import { Template, Annotations, Match } from '@aws-cdk/assertions'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import { Template, Annotations, Match } from '../../assertions'; +import { App, Duration, Stack } from '../../core'; import { Dashboard, GraphWidget, PeriodOverride, TextWidget, MathExpression, TextWidgetBackground } from '../lib'; describe('Dashboard', () => { diff --git a/packages/@aws-cdk/aws-cloudwatch/test/graphs.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/test/graphs.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts index 5f9d3f0d27842..7973c2cd1761c 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/graphs.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts @@ -1,4 +1,4 @@ -import { Duration, Stack } from '@aws-cdk/core'; +import { Duration, Stack } from '../../core'; import { Alarm, AlarmWidget, Color, GraphWidget, GraphWidgetView, LegendPosition, LogQueryWidget, Metric, Shading, SingleValueWidget, LogQueryVisualizationType, CustomWidget, GaugeWidget } from '../lib'; describe('Graphs', () => { diff --git a/packages/@aws-cdk/aws-cloudwatch/test/layout.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/layout.test.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/layout.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/layout.test.ts diff --git a/packages/@aws-cdk/aws-cloudwatch/test/metric-math.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/metric-math.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cloudwatch/test/metric-math.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/metric-math.test.ts index 24ffebfcfb76f..1dcb184e40f5d 100644 --- a/packages/@aws-cdk/aws-cloudwatch/test/metric-math.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/metric-math.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Duration, Stack } from '../../core'; import { Alarm, GraphWidget, IWidget, MathExpression, Metric } from '../lib'; const a = new Metric({ namespace: 'Test', metricName: 'ACount' }); diff --git a/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts new file mode 100644 index 0000000000000..17e07609043bb --- /dev/null +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/metrics.test.ts @@ -0,0 +1,354 @@ +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../core'; +import { Alarm, Metric, Stats } from '../lib'; +import { PairStatistic, parseStatistic, SingleStatistic } from '../lib/private/statistic'; + +describe('Metrics', () => { + test('metric grant', () => { + // GIVEN + const stack = new cdk.Stack(); + const role = new iam.Role(stack, 'SomeRole', { + assumedBy: new iam.AnyPrincipal(), + }); + + // WHEN + Metric.grantPutMetricData(role); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: 'cloudwatch:PutMetricData', + Effect: 'Allow', + Resource: '*', + }, + ], + }, + }); + + + }); + + test('can not use invalid period in Metric', () => { + expect(() => { + new Metric({ namespace: 'Test', metricName: 'ACount', period: cdk.Duration.seconds(20) }); + }).toThrow(/'period' must be 1, 5, 10, 30, or a multiple of 60 seconds, received 20/); + + + }); + + test('Metric optimization: "with" with the same period returns the same object', () => { + const m = new Metric({ namespace: 'Test', metricName: 'Metric', period: cdk.Duration.minutes(10) }); + + // Note: object equality, NOT deep equality on purpose + expect(m.with({})).toEqual(m); + expect(m.with({ period: cdk.Duration.minutes(10) })).toEqual(m); + + expect(m.with({ period: cdk.Duration.minutes(5) })).not.toEqual(m); + + + }); + + testDeprecated('cannot use null dimension value', () => { + expect(() => { + new Metric({ + namespace: 'Test', + metricName: 'ACount', + period: cdk.Duration.minutes(10), + dimensions: { + DimensionWithNull: null, + }, + }); + }).toThrow(/Dimension value of 'null' is invalid/); + + + }); + + testDeprecated('cannot use undefined dimension value', () => { + expect(() => { + new Metric({ + namespace: 'Test', + metricName: 'ACount', + period: cdk.Duration.minutes(10), + dimensions: { + DimensionWithUndefined: undefined, + }, + }); + }).toThrow(/Dimension value of 'undefined' is invalid/); + + + }); + + testDeprecated('cannot use long dimension values', () => { + const arr = new Array(256); + const invalidDimensionValue = arr.fill('A', 0).join(''); + + expect(() => { + new Metric({ + namespace: 'Test', + metricName: 'ACount', + period: cdk.Duration.minutes(10), + dimensions: { + DimensionWithLongValue: invalidDimensionValue, + }, + }); + }).toThrow(`Dimension value must be at least 1 and no more than 255 characters; received ${invalidDimensionValue}`); + + + }); + + test('cannot use long dimension values in dimensionsMap', () => { + const arr = new Array(256); + const invalidDimensionValue = arr.fill('A', 0).join(''); + + expect(() => { + new Metric({ + namespace: 'Test', + metricName: 'ACount', + period: cdk.Duration.minutes(10), + dimensionsMap: { + DimensionWithLongValue: invalidDimensionValue, + }, + }); + }).toThrow(`Dimension value must be at least 1 and no more than 255 characters; received ${invalidDimensionValue}`); + + + }); + + testDeprecated('throws error when there are more than 10 dimensions', () => { + expect(() => { + new Metric({ + namespace: 'Test', + metricName: 'ACount', + period: cdk.Duration.minutes(10), + dimensions: { + dimensionA: 'value1', + dimensionB: 'value2', + dimensionC: 'value3', + dimensionD: 'value4', + dimensionE: 'value5', + dimensionF: 'value6', + dimensionG: 'value7', + dimensionH: 'value8', + dimensionI: 'value9', + dimensionJ: 'value10', + dimensionK: 'value11', + }, + } ); + }).toThrow(/The maximum number of dimensions is 10, received 11/); + + + }); + + test('throws error when there are more than 10 dimensions in dimensionsMap', () => { + expect(() => { + new Metric({ + namespace: 'Test', + metricName: 'ACount', + period: cdk.Duration.minutes(10), + dimensionsMap: { + dimensionA: 'value1', + dimensionB: 'value2', + dimensionC: 'value3', + dimensionD: 'value4', + dimensionE: 'value5', + dimensionF: 'value6', + dimensionG: 'value7', + dimensionH: 'value8', + dimensionI: 'value9', + dimensionJ: 'value10', + dimensionK: 'value11', + }, + } ); + }).toThrow(/The maximum number of dimensions is 10, received 11/); + + + }); + + test('can create metric with dimensionsMap property', () => { + const stack = new cdk.Stack(); + const metric = new Metric({ + namespace: 'Test', + metricName: 'Metric', + dimensionsMap: { + dimensionA: 'value1', + dimensionB: 'value2', + }, + }); + + new Alarm(stack, 'Alarm', { + metric: metric, + threshold: 10, + evaluationPeriods: 1, + }); + + expect(metric.dimensions).toEqual({ + dimensionA: 'value1', + dimensionB: 'value2', + }); + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + Namespace: 'Test', + MetricName: 'Metric', + Dimensions: [ + { + Name: 'dimensionA', + Value: 'value1', + }, + { + Name: 'dimensionB', + Value: 'value2', + }, + ], + Threshold: 10, + EvaluationPeriods: 1, + }); + + + }); + + test('"with" with a different dimensions property', () => { + const dims = { + dimensionA: 'value1', + }; + + const metric = new Metric({ + namespace: 'Test', + metricName: 'Metric', + period: cdk.Duration.minutes(10), + dimensionsMap: dims, + }); + + const newDims = { + dimensionB: 'value2', + }; + + expect(metric.with({ + dimensionsMap: newDims, + }).dimensions).toEqual(newDims); + + + }); + + test('metric accepts a variety of statistics', () => { + const customStat = 'myCustomStatistic'; + const metric = new Metric({ + namespace: 'Test', + metricName: 'Metric', + statistic: customStat, + }); + + expect(metric.statistic).toEqual(customStat); + }); + + test('statistic is properly parsed', () => { + const checkParsingSingle = (statistic: string, statPrefix: string, statName: string, value: number) => { + const parsed = parseStatistic(statistic); + expect(parsed.type).toEqual('single'); + expect((parsed as SingleStatistic).value).toEqual(value); + expect((parsed as SingleStatistic).statPrefix).toEqual(statPrefix); + expect((parsed as SingleStatistic).statName).toEqual(statName); + }; + + const checkParsingPair = ( + statistic: string, + statPrefix: string, + statName: string, + isPercent: boolean, + canBeSingleStat: boolean, + asSingleStatStr?: string, + lower?: number, + upper?: number, + ) => { + const parsed = parseStatistic(statistic); + expect(parsed.type).toEqual('pair'); + expect((parsed as PairStatistic).isPercent).toEqual(isPercent); + expect((parsed as PairStatistic).lower).toEqual(lower); + expect((parsed as PairStatistic).upper).toEqual(upper); + expect((parsed as PairStatistic).canBeSingleStat).toEqual(canBeSingleStat); + expect((parsed as PairStatistic).asSingleStatStr).toEqual(asSingleStatStr); + expect((parsed as PairStatistic).statPrefix).toEqual(statPrefix); + expect((parsed as PairStatistic).statName).toEqual(statName); + }; + + expect(parseStatistic(Stats.SAMPLE_COUNT).type).toEqual('simple'); + expect(parseStatistic(Stats.AVERAGE).type).toEqual('simple'); + expect(parseStatistic(Stats.SUM).type).toEqual('simple'); + expect(parseStatistic(Stats.MINIMUM).type).toEqual('simple'); + expect(parseStatistic(Stats.MAXIMUM).type).toEqual('simple'); + expect(parseStatistic(Stats.IQM).type).toEqual('simple'); + + /* eslint-disable no-multi-spaces */ + + // Check single statistics + checkParsingSingle('p9', 'p', 'percentile', 9); + checkParsingSingle('p99', 'p', 'percentile', 99); + checkParsingSingle('P99', 'p', 'percentile', 99); + checkParsingSingle('p99.99', 'p', 'percentile', 99.99); + checkParsingSingle('tm99', 'tm', 'trimmedMean', 99); + checkParsingSingle('wm99', 'wm', 'winsorizedMean', 99); + checkParsingSingle('tc99', 'tc', 'trimmedCount', 99); + checkParsingSingle('ts99', 'ts', 'trimmedSum', 99); + + // Check all pair statistics + checkParsingPair('TM(10%:90%)', 'TM', 'trimmedMean', true, false, undefined, 10, 90); + checkParsingPair('TM(10.99%:90.99%)', 'TM', 'trimmedMean', true, false, undefined, 10.99, 90.99); + checkParsingPair('WM(10%:90%)', 'WM', 'winsorizedMean', true, false, undefined, 10, 90); + checkParsingPair('TC(10%:90%)', 'TC', 'trimmedCount', true, false, undefined, 10, 90); + checkParsingPair('TS(10%:90%)', 'TS', 'trimmedSum', true, false, undefined, 10, 90); + + // Check can be represented as a single statistic + checkParsingPair('TM(:90%)', 'TM', 'trimmedMean', true, true, 'tm90', undefined, 90); + + // Check every case + checkParsingPair('tm(10%:90%)', 'TM', 'trimmedMean', true, false, undefined, 10, 90); + checkParsingPair('TM(10%:90%)', 'TM', 'trimmedMean', true, false, undefined, 10, 90); + checkParsingPair('TM(:90%)', 'TM', 'trimmedMean', true, true, 'tm90', undefined, 90); + checkParsingPair('TM(10%:)', 'TM', 'trimmedMean', true, false, undefined, 10, undefined); + checkParsingPair('TM(10:1500)', 'TM', 'trimmedMean', false, false, undefined, 10, 1500); + checkParsingPair('TM(10:)', 'TM', 'trimmedMean', false, false, undefined, 10, undefined); + checkParsingPair('TM(:5000)', 'TM', 'trimmedMean', false, false, undefined, undefined, 5000); + checkParsingPair('TM(0.123456789:)', 'TM', 'trimmedMean', false, false, undefined, 0.123456789, undefined); + checkParsingPair('TM(0.123456789:)', 'TM', 'trimmedMean', false, false, undefined, 0.123456789, undefined); + checkParsingPair('TM(:0.123456789)', 'TM', 'trimmedMean', false, false, undefined, undefined, 0.123456789); + checkParsingPair('TM(0.123456789%:)', 'TM', 'trimmedMean', true, false, undefined, 0.123456789, undefined); + checkParsingPair('TM(:0.123456789%)', 'TM', 'trimmedMean', true, true, 'tm0.123456789', undefined, 0.123456789); + checkParsingPair('TM(0.123:0.4543)', 'TM', 'trimmedMean', false, false, undefined, 0.123, 0.4543); + checkParsingPair('TM(0.123%:0.4543%)', 'TM', 'trimmedMean', true, false, undefined, 0.123, 0.4543); + checkParsingPair('TM(0.1000%:0.1000%)', 'TM', 'trimmedMean', true, false, undefined, 0.1, 0.1); + checkParsingPair('TM(0.9999:100.9999)', 'TM', 'trimmedMean', false, false, undefined, 0.9999, 100.9999); + + /* eslint-enable no-multi-spaces */ + + // Check invalid statistics + expect(parseStatistic('p99.99.99').type).toEqual('generic'); + expect(parseStatistic('p200').type).toEqual('generic'); + expect(parseStatistic('pa99').type).toEqual('generic'); + expect(parseStatistic('99').type).toEqual('generic'); + expect(parseStatistic('tm1.').type).toEqual('generic'); + expect(parseStatistic('tm12.').type).toEqual('generic'); + expect(parseStatistic('tm123').type).toEqual('generic'); + expect(parseStatistic('tm123.123456789').type).toEqual('generic'); + expect(parseStatistic('tm.123456789').type).toEqual('generic'); + expect(parseStatistic('TM(10:90%)').type).toEqual('generic'); + expect(parseStatistic('TM(10%:1500)').type).toEqual('generic'); + expect(parseStatistic('TM(10)').type).toEqual('generic'); + expect(parseStatistic('TM()').type).toEqual('generic'); + expect(parseStatistic('TM(0.:)').type).toEqual('generic'); + expect(parseStatistic('TM(:0.)').type).toEqual('generic'); + expect(parseStatistic('()').type).toEqual('generic'); + expect(parseStatistic('(:)').type).toEqual('generic'); + expect(parseStatistic('TM(:)').type).toEqual('generic'); + expect(parseStatistic('TM(').type).toEqual('generic'); + expect(parseStatistic('TM)').type).toEqual('generic'); + expect(parseStatistic('TM(0.123456789%:%)').type).toEqual('generic'); + expect(parseStatistic('TM(0.123:0.4543%)').type).toEqual('generic'); + expect(parseStatistic('TM(0.123%:0.4543)').type).toEqual('generic'); + expect(parseStatistic('TM(1000%:)').type).toEqual('generic'); + expect(parseStatistic('TM(:1000%)').type).toEqual('generic'); + expect(parseStatistic('TM(1000%:1000%)').type).toEqual('generic'); + }); +}); diff --git a/packages/@aws-cdk/aws-cloudwatch/test/stats.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/stats.test.ts similarity index 100% rename from packages/@aws-cdk/aws-cloudwatch/test/stats.test.ts rename to packages/aws-cdk-lib/aws-cloudwatch/test/stats.test.ts diff --git a/packages/aws-cdk-lib/aws-codeartifact/.jsiirc.json b/packages/aws-cdk-lib/aws-codeartifact/.jsiirc.json new file mode 100644 index 0000000000000..ddf2fa73a338d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeartifact/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeArtifact" + }, + "java": { + "package": "software.amazon.awscdk.services.codeartifact" + }, + "python": { + "module": "aws_cdk.aws_codeartifact" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codeartifact/README.md b/packages/aws-cdk-lib/aws-codeartifact/README.md new file mode 100644 index 0000000000000..cd1c53959bf5a --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeartifact/README.md @@ -0,0 +1,27 @@ +# AWS::CodeArtifact Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as codeartifact from 'aws-cdk-lib/aws-codeartifact'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CodeArtifact construct libraries](https://constructs.dev/search?q=codeartifact) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeArtifact resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeArtifact.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeArtifact](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeArtifact.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-codeartifact/index.ts b/packages/aws-cdk-lib/aws-codeartifact/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeartifact/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codeartifact/lib/index.ts b/packages/aws-cdk-lib/aws-codeartifact/lib/index.ts new file mode 100644 index 0000000000000..0521addc5fa3c --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeartifact/lib/index.ts @@ -0,0 +1 @@ +export * from './codeartifact.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codebuild/.jsiirc.json b/packages/aws-cdk-lib/aws-codebuild/.jsiirc.json new file mode 100644 index 0000000000000..e1a621becdd1d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.codebuild" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeBuild" + }, + "python": { + "module": "aws_cdk.aws_codebuild" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codebuild/README.md b/packages/aws-cdk-lib/aws-codebuild/README.md new file mode 100644 index 0000000000000..e2ed9c07481f7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/README.md @@ -0,0 +1,852 @@ +# AWS CodeBuild Construct Library + + +AWS CodeBuild is a fully managed continuous integration service that compiles +source code, runs tests, and produces software packages that are ready to +deploy. With CodeBuild, you don’t need to provision, manage, and scale your own +build servers. CodeBuild scales continuously and processes multiple builds +concurrently, so your builds are not left waiting in a queue. You can get +started quickly by using prepackaged build environments, or you can create +custom build environments that use your own build tools. With CodeBuild, you are +charged by the minute for the compute resources you use. + +## Source + +Build projects are usually associated with a _source_, which is specified via +the `source` property which accepts a class that extends the `Source` +abstract base class. +The default is to have no source associated with the build project; +the `buildSpec` option is required in that case. + +Here's a CodeBuild project with no source which simply prints `Hello, +CodeBuild!`: + +[Minimal Example](./test/integ.defaults.lit.ts) + +### `CodeCommitSource` + +Use an AWS CodeCommit repository as the source of this build: + +```ts +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; + +const repository = new codecommit.Repository(this, 'MyRepo', { repositoryName: 'foo' }); +new codebuild.Project(this, 'MyFirstCodeCommitProject', { + source: codebuild.Source.codeCommit({ repository }), +}); +``` + +### `S3Source` + +Create a CodeBuild project with an S3 bucket as the source: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket'); + +new codebuild.Project(this, 'MyProject', { + source: codebuild.Source.s3({ + bucket: bucket, + path: 'path/to/file.zip', + }), +}); +``` + +The CodeBuild role will be granted to read just the given path from the given `bucket`. + +### `GitHubSource` and `GitHubEnterpriseSource` + +These source types can be used to build code from a GitHub repository. +Example: + +```ts +const gitHubSource = codebuild.Source.gitHub({ + owner: 'awslabs', + repo: 'aws-cdk', + webhook: true, // optional, default: true if `webhookFilters` were provided, false otherwise + webhookTriggersBatchBuild: true, // optional, default is false + webhookFilters: [ + codebuild.FilterGroup + .inEventOf(codebuild.EventAction.PUSH) + .andBranchIs('main') + .andCommitMessageIs('the commit message'), + ], // optional, by default all pushes and Pull Requests will trigger a build +}); +``` + +To provide GitHub credentials, please either go to AWS CodeBuild Console to connect +or call `ImportSourceCredentials` to persist your personal access token. +Example: + +```console +aws codebuild import-source-credentials --server-type GITHUB --auth-type PERSONAL_ACCESS_TOKEN --token +``` + +### `BitBucketSource` + +This source type can be used to build code from a BitBucket repository. + +```ts +const bbSource = codebuild.Source.bitBucket({ + owner: 'owner', + repo: 'repo', +}); +``` + +### For all Git sources + +For all Git sources, you can fetch submodules while cloning git repo. + +```ts +const gitHubSource = codebuild.Source.gitHub({ + owner: 'awslabs', + repo: 'aws-cdk', + fetchSubmodules: true, +}); +``` + +## BuildSpec + +The build spec can be provided from a number of different sources + +### File path relative to the root of the source + +You can specify a specific filename that exists within the project's source artifact to use as the buildspec. + +```ts +const project = new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromSourceFileName('my-buildspec.yml'), + source: codebuild.Source.gitHub({ + owner: 'awslabs', + repo: 'aws-cdk', + }) +}); +``` + +This will use `my-buildspec.yml` file within the `awslabs/aws-cdk` repository as the build spec. + +### File within the CDK project codebuild + +You can also specify a file within your cdk project directory to use as the buildspec. + +```ts +const project = new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromAsset('my-buildspec.yml'), +}); +``` + +This file will be uploaded to S3 and referenced from the codebuild project. + +### Inline object + +```ts +const project = new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), +}); +``` + +This will result in the buildspec being rendered as JSON within the codebuild project, if you prefer it to be rendered as YAML, use `fromObjectToYaml`. + +```ts +const project = new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObjectToYaml({ + version: '0.2', + }), +}); +``` + +## Artifacts + +CodeBuild Projects can produce Artifacts and upload them to S3. For example: + +```ts +declare const bucket: s3.Bucket; + +const project = new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + artifacts: codebuild.Artifacts.s3({ + bucket, + includeBuildId: false, + packageZip: true, + path: 'another/path', + identifier: 'AddArtifact1', + }), +}); +``` + +Because we've not set the `name` property, this example will set the +`overrideArtifactName` parameter, and produce an artifact named as defined in +the Buildspec file, uploaded to an S3 bucket (`bucket`). The path will be +`another/path` and the artifact will be a zipfile. + +## CodePipeline + +To add a CodeBuild Project as an Action to CodePipeline, +use the `PipelineProject` class instead of `Project`. +It's a simple class that doesn't allow you to specify `sources`, +`secondarySources`, `artifacts` or `secondaryArtifacts`, +as these are handled by setting input and output CodePipeline `Artifact` instances on the Action, +instead of setting them on the Project. + +```ts +const project = new codebuild.PipelineProject(this, 'Project', { + // properties as above... +}) +``` + +For more details, see the readme of the `@aws-cdk/aws-codepipeline-actions` package. + +## Caching + +You can save time when your project builds by using a cache. A cache can store reusable pieces of your build environment and use them across multiple builds. Your build project can use one of two types of caching: Amazon S3 or local. In general, S3 caching is a good option for small and intermediate build artifacts that are more expensive to build than to download. Local caching is a good option for large intermediate build artifacts because the cache is immediately available on the build host. + +### S3 Caching + +With S3 caching, the cache is stored in an S3 bucket which is available +regardless from what CodeBuild instance gets selected to run your CodeBuild job +on. When using S3 caching, you must also add in a `cache` section to your +buildspec which indicates the files to be cached: + +```ts +declare const myCachingBucket: s3.Bucket; + +new codebuild.Project(this, 'Project', { + source: codebuild.Source.bitBucket({ + owner: 'awslabs', + repo: 'aws-cdk', + }), + + cache: codebuild.Cache.bucket(myCachingBucket), + + // BuildSpec with a 'cache' section necessary for S3 caching. This can + // also come from 'buildspec.yml' in your source. + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['...'], + }, + }, + cache: { + paths: [ + // The '**/*' is required to indicate all files in this directory + '/root/cachedir/**/*', + ], + }, + }), +}); +``` + +Note that two different CodeBuild Projects using the same S3 bucket will *not* +share their cache: each Project will get a unique file in the S3 bucket to store +the cache in. + +### Local Caching + +With local caching, the cache is stored on the codebuild instance itself. This +is simple, cheap and fast, but CodeBuild cannot guarantee a reuse of instance +and hence cannot guarantee cache hits. For example, when a build starts and +caches files locally, if two subsequent builds start at the same time afterwards +only one of those builds would get the cache. Three different cache modes are +supported, which can be turned on individually. + +* `LocalCacheMode.SOURCE` caches Git metadata for primary and secondary sources. +* `LocalCacheMode.DOCKER_LAYER` caches existing Docker layers. +* `LocalCacheMode.CUSTOM` caches directories you specify in the buildspec file. + +```ts +new codebuild.Project(this, 'Project', { + source: codebuild.Source.gitHubEnterprise({ + httpsCloneUrl: 'https://my-github-enterprise.com/owner/repo', + }), + + // Enable Docker AND custom caching + cache: codebuild.Cache.local(codebuild.LocalCacheMode.DOCKER_LAYER, codebuild.LocalCacheMode.CUSTOM), + + // BuildSpec with a 'cache' section necessary for 'CUSTOM' caching. This can + // also come from 'buildspec.yml' in your source. + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['...'], + }, + }, + cache: { + paths: [ + // The '**/*' is required to indicate all files in this directory + '/root/cachedir/**/*', + ], + }, + }), +}); +``` + +## Environment + +By default, projects use a small instance with an Ubuntu 18.04 image. You +can use the `environment` property to customize the build environment: + +* `buildImage` defines the Docker image used. See [Images](#images) below for + details on how to define build images. +* `certificate` defines the location of a PEM encoded certificate to import. +* `computeType` defines the instance type used for the build. +* `privileged` can be set to `true` to allow privileged access. +* `environmentVariables` can be set at this level (and also at the project + level). + +## Images + +The CodeBuild library supports both Linux and Windows images via the +`LinuxBuildImage` (or `LinuxArmBuildImage`), and `WindowsBuildImage` classes, respectively. + +You can specify one of the predefined Windows/Linux images by using one +of the constants such as `WindowsBuildImage.WIN_SERVER_CORE_2019_BASE`, +`WindowsBuildImage.WINDOWS_BASE_2_0`, `LinuxBuildImage.STANDARD_2_0`, or +`LinuxArmBuildImage.AMAZON_LINUX_2_ARM`. + +Alternatively, you can specify a custom image using one of the static methods on +`LinuxBuildImage`: + +* `LinuxBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }])` to reference an image in any public or private Docker registry. +* `LinuxBuildImage.fromEcrRepository(repo[, tag])` to reference an image available in an + ECR repository. +* `LinuxBuildImage.fromAsset(parent, id, props)` to use an image created from a + local asset. +* `LinuxBuildImage.fromCodeBuildImageId(id)` to reference a pre-defined, CodeBuild-provided Docker image. + +or one of the corresponding methods on `WindowsBuildImage`: + +* `WindowsBuildImage.fromDockerRegistry(image[, { secretsManagerCredentials }, imageType])` +* `WindowsBuildImage.fromEcrRepository(repo[, tag, imageType])` +* `WindowsBuildImage.fromAsset(parent, id, props, [, imageType])` + +or one of the corresponding methods on `LinuxArmBuildImage`: + +* `LinuxArmBuildImage.fromEcrRepository(repo[, tag])` + +Note that the `WindowsBuildImage` version of the static methods accepts an optional parameter of type `WindowsImageType`, +which can be either `WindowsImageType.STANDARD`, the default, or `WindowsImageType.SERVER_2019`: + +```ts +declare const ecrRepository: ecr.Repository; + +new codebuild.Project(this, 'Project', { + environment: { + buildImage: codebuild.WindowsBuildImage.fromEcrRepository(ecrRepository, 'v1.0', codebuild.WindowsImageType.SERVER_2019), + // optional certificate to include in the build image + certificate: { + bucket: s3.Bucket.fromBucketName(this, 'Bucket', 'my-bucket'), + objectKey: 'path/to/cert.pem', + }, + }, + // ... +}) +``` + +The following example shows how to define an image from a Docker asset: + +[Docker asset example](./test/integ.docker-asset.lit.ts) + +The following example shows how to define an image from an ECR repository: + +[ECR example](./test/integ.ecr.lit.ts) + +The following example shows how to define an image from a private docker registry: + +[Docker Registry example](./test/integ.docker-registry.lit.ts) + +### GPU images + +The class `LinuxGpuBuildImage` contains constants for working with +[AWS Deep Learning Container images](https://aws.amazon.com/releasenotes/available-deep-learning-containers-images): + + +```ts +new codebuild.Project(this, 'Project', { + environment: { + buildImage: codebuild.LinuxGpuBuildImage.DLC_TENSORFLOW_2_1_0_INFERENCE, + }, + // ... +}) +``` + +One complication is that the repositories for the DLC images are in +different accounts in different AWS regions. +In most cases, the CDK will handle providing the correct account for you; +in rare cases (for example, deploying to new regions) +where our information might be out of date, +you can always specify the account +(along with the repository name and tag) +explicitly using the `awsDeepLearningContainersImage` method: + +```ts +new codebuild.Project(this, 'Project', { + environment: { + buildImage: codebuild.LinuxGpuBuildImage.awsDeepLearningContainersImage( + 'tensorflow-inference', '2.1.0-gpu-py36-cu101-ubuntu18.04', '123456789012'), + }, + // ... +}) +``` + +Alternatively, you can reference an image available in an ECR repository using the `LinuxGpuBuildImage.fromEcrRepository(repo[, tag])` method. + +## Logs + +CodeBuild lets you specify an S3 Bucket, CloudWatch Log Group or both to receive logs from your projects. + +By default, logs will go to cloudwatch. + +### CloudWatch Logs Example + +```ts +new codebuild.Project(this, 'Project', { + logging: { + cloudWatch: { + logGroup: new logs.LogGroup(this, `MyLogGroup`), + } + }, +}) +``` + +### S3 Logs Example + +```ts +new codebuild.Project(this, 'Project', { + logging: { + s3: { + bucket: new s3.Bucket(this, `LogBucket`) + } + }, +}) +``` + +## Debugging builds interactively using SSM Session Manager + +Integration with SSM Session Manager makes it possible to add breakpoints to your +build commands, pause the build there and log into the container to interactively +debug the environment. + +To do so, you need to: + +* Create the build with `ssmSessionPermissions: true`. +* Use a build image with SSM agent installed and configured (default CodeBuild images come with the image preinstalled). +* Start the build with [debugSessionEnabled](https://docs.aws.amazon.com/codebuild/latest/APIReference/API_StartBuild.html#CodeBuild-StartBuild-request-debugSessionEnabled) set to true. + +If these conditions are met, execution of the command `codebuild-breakpoint` +will suspend your build and allow you to attach a Session Manager session from +the CodeBuild console. + +For more information, see [View a running build in Session +Manager](https://docs.aws.amazon.com/codebuild/latest/userguide/session-manager.html) +in the CodeBuild documentation. + +Example: + +```ts +new codebuild.Project(this, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.STANDARD_6_0, + }, + ssmSessionPermissions: true, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + // Pause the build container if possible + 'codebuild-breakpoint', + // Regular build in a script in the repository + './my-build.sh', + ], + }, + }, + }), +}) +``` + +## Credentials + +CodeBuild allows you to store credentials used when communicating with various sources, +like GitHub: + +```ts +new codebuild.GitHubSourceCredentials(this, 'CodeBuildGitHubCreds', { + accessToken: SecretValue.secretsManager('my-token'), +}); +// GitHub Enterprise is almost the same, +// except the class is called GitHubEnterpriseSourceCredentials +``` + +and BitBucket: + +```ts +new codebuild.BitBucketSourceCredentials(this, 'CodeBuildBitBucketCreds', { + username: SecretValue.secretsManager('my-bitbucket-creds', { jsonField: 'username' }), + password: SecretValue.secretsManager('my-bitbucket-creds', { jsonField: 'password' }), +}); +``` + +**Note**: the credentials are global to a given account in a given region - +they are not defined per CodeBuild project. +CodeBuild only allows storing a single credential of a given type +(GitHub, GitHub Enterprise or BitBucket) +in a given account in a given region - +any attempt to save more than one will result in an error. +You can use the [`list-source-credentials` AWS CLI operation](https://docs.aws.amazon.com/cli/latest/reference/codebuild/list-source-credentials.html) +to inspect what credentials are stored in your account. + +## Test reports + +You can specify a test report in your buildspec: + +```ts +const project = new codebuild.Project(this, 'Project', { + buildSpec: codebuild.BuildSpec.fromObject({ + // ... + reports: { + myReport: { + files: '**/*', + 'base-directory': 'build/test-results', + }, + }, + }), +}); +``` + +This will create a new test report group, +with the name `-myReport`. + +The project's role in the CDK will always be granted permissions to create and use report groups +with names starting with the project's name; +if you'd rather not have those permissions added, +you can opt out of it when creating the project: + +```ts +declare const source: codebuild.Source; + +const project = new codebuild.Project(this, 'Project', { + source, + grantReportGroupPermissions: false, +}); +``` + +Alternatively, you can specify an ARN of an existing resource group, +instead of a simple name, in your buildspec: + +```ts +declare const source: codebuild.Source; + +// create a new ReportGroup +const reportGroup = new codebuild.ReportGroup(this, 'ReportGroup'); + +const project = new codebuild.Project(this, 'Project', { + source, + buildSpec: codebuild.BuildSpec.fromObject({ + // ... + reports: { + [reportGroup.reportGroupArn]: { + files: '**/*', + 'base-directory': 'build/test-results', + }, + }, + }), +}); +``` + +For a code coverage report, you can specify a report group with the code coverage report group type. + +```ts +declare const source: codebuild.Source; + +// create a new ReportGroup +const reportGroup = new codebuild.ReportGroup(this, 'ReportGroup', { + type: codebuild.ReportGroupType.CODE_COVERAGE +}); + +const project = new codebuild.Project(this, 'Project', { + source, + buildSpec: codebuild.BuildSpec.fromObject({ + // ... + reports: { + [reportGroup.reportGroupArn]: { + files: '**/*', + 'base-directory': 'build/coverage-report.xml', + 'file-format': 'JACOCOXML' + }, + }, + }), +}); +``` + +If you specify a report group, you need to grant the project's role permissions to write reports to that report group: + +```ts +declare const project: codebuild.Project; +declare const reportGroup: codebuild.ReportGroup; + +reportGroup.grantWrite(project); +``` + +The created policy will adjust to the report group type. If no type is specified when creating the report group the created policy will contain the action for the test report group type. + +For more information on the test reports feature, +see the [AWS CodeBuild documentation](https://docs.aws.amazon.com/codebuild/latest/userguide/test-reporting.html). + +## Events + +CodeBuild projects can be used either as a source for events or be triggered +by events via an event rule. + +### Using Project as an event target + +The `@aws-cdk/aws-events-targets.CodeBuildProject` allows using an AWS CodeBuild +project as a AWS CloudWatch event rule target: + +```ts +// start build when a commit is pushed +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +declare const codeCommitRepository: codecommit.Repository; +declare const project: codebuild.Project; + +codeCommitRepository.onCommit('OnCommit', { + target: new targets.CodeBuildProject(project), +}); +``` + +### Using Project as an event source + +To define Amazon CloudWatch event rules for build projects, use one of the `onXxx` +methods: + +```ts +import * as targets from 'aws-cdk-lib/aws-events-targets'; +declare const fn: lambda.Function; +declare const project: codebuild.Project; + +const rule = project.onStateChange('BuildStateChange', { + target: new targets.LambdaFunction(fn) +}); +``` + +## CodeStar Notifications + +To define CodeStar Notification rules for Projects, use one of the `notifyOnXxx()` methods. +They are very similar to `onXxx()` methods for CloudWatch events: + +```ts +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; + +declare const project: codebuild.Project; + +const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', + slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', + slackChannelId: 'YOUR_SLACK_CHANNEL_ID', +}); + +const rule = project.notifyOnBuildSucceeded('NotifyOnBuildSucceeded', target); +``` + +## Secondary sources and artifacts + +CodeBuild Projects can get their sources from multiple places, and produce +multiple outputs. For example: + +```ts +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +declare const repo: codecommit.Repository; +declare const bucket: s3.Bucket; + +const project = new codebuild.Project(this, 'MyProject', { + secondarySources: [ + codebuild.Source.codeCommit({ + identifier: 'source2', + repository: repo, + }), + ], + secondaryArtifacts: [ + codebuild.Artifacts.s3({ + identifier: 'artifact2', + bucket: bucket, + path: 'some/path', + name: 'file.zip', + }), + ], + // ... +}); +``` + +Note that the `identifier` property is required for both secondary sources and +artifacts. + +The contents of the secondary source is available to the build under the +directory specified by the `CODEBUILD_SRC_DIR_` environment variable +(so, `CODEBUILD_SRC_DIR_source2` in the above case). + +The secondary artifacts have their own section in the buildspec, under the +regular `artifacts` one. Each secondary artifact has its own section, beginning +with their identifier. + +So, a buildspec for the above Project could look something like this: + +```ts +const project = new codebuild.Project(this, 'MyProject', { + // secondary sources and artifacts as above... + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'cd $CODEBUILD_SRC_DIR_source2', + 'touch output2.txt', + ], + }, + }, + artifacts: { + 'secondary-artifacts': { + 'artifact2': { + 'base-directory': '$CODEBUILD_SRC_DIR_source2', + 'files': [ + 'output2.txt', + ], + }, + }, + }, + }), +}); +``` + +### Definition of VPC configuration in CodeBuild Project + +Typically, resources in an VPC are not accessible by AWS CodeBuild. To enable +access, you must provide additional VPC-specific configuration information as +part of your CodeBuild project configuration. This includes the VPC ID, the +VPC subnet IDs, and the VPC security group IDs. VPC-enabled builds are then +able to access resources inside your VPC. + +For further Information see https://docs.aws.amazon.com/codebuild/latest/userguide/vpc-support.html + +**Use Cases** +VPC connectivity from AWS CodeBuild builds makes it possible to: + +* Run integration tests from your build against data in an Amazon RDS database that's isolated on a private subnet. +* Query data in an Amazon ElastiCache cluster directly from tests. +* Interact with internal web services hosted on Amazon EC2, Amazon ECS, or services that use internal Elastic Load Balancing. +* Retrieve dependencies from self-hosted, internal artifact repositories, such as PyPI for Python, Maven for Java, and npm for Node.js. +* Access objects in an Amazon S3 bucket configured to allow access through an Amazon VPC endpoint only. +* Query external web services that require fixed IP addresses through the Elastic IP address of the NAT gateway or NAT instance associated with your subnet(s). + +Your builds can access any resource that's hosted in your VPC. + +**Enable Amazon VPC Access in your CodeBuild Projects** + +Pass the VPC when defining your Project, then make sure to +give the CodeBuild's security group the right permissions +to access the resources that it needs by using the +`connections` object. + +For example: + +```ts +declare const loadBalancer: elbv2.ApplicationLoadBalancer; + +const vpc = new ec2.Vpc(this, 'MyVPC'); +const project = new codebuild.Project(this, 'MyProject', { + vpc: vpc, + buildSpec: codebuild.BuildSpec.fromObject({ + // ... + }), +}); + +project.connections.allowTo(loadBalancer, ec2.Port.tcp(443)); +``` + +## Project File System Location EFS + +Add support for CodeBuild to build on AWS EFS file system mounts using +the new ProjectFileSystemLocation. +The `fileSystemLocations` property which accepts a list `ProjectFileSystemLocation` +as represented by the interface `IFileSystemLocations`. +The only supported file system type is `EFS`. + +For example: + +```ts +new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + fileSystemLocations: [ + codebuild.FileSystemLocation.efs({ + identifier: "myidentifier2", + location: "myclodation.mydnsroot.com:/loc", + mountPoint: "/media", + mountOptions: "opts" + }) + ] +}); +``` + +Here's a CodeBuild project with a simple example that creates a project mounted on AWS EFS: + +[Minimal Example](./test/integ.project-file-system-location.ts) + +## Batch builds + +To enable batch builds you should call `enableBatchBuilds()` on the project instance. + +It returns an object containing the batch service role that was created, +or `undefined` if batch builds could not be enabled, for example if the project was imported. + +```ts +declare const source: codebuild.Source; + +const project = new codebuild.Project(this, 'MyProject', { source, }); + +if (project.enableBatchBuilds()) { + console.log('Batch builds were enabled'); +} +``` + +## Timeouts + +There are two types of timeouts that can be set when creating your Project. +The `timeout` property can be used to set an upper limit on how long your Project is able to run without being marked as completed. +The default is 60 minutes. +An example of overriding the default follows. + +```ts +new codebuild.Project(this, 'MyProject', { + timeout: Duration.minutes(90) +}); +``` + +The `queuedTimeout` property can be used to set an upper limit on how your Project remains queued to run. +There is no default value for this property. +As an example, to allow your Project to queue for up to thirty (30) minutes before the build fails, +use the following code. + +```ts +new codebuild.Project(this, 'MyProject', { + queuedTimeout: Duration.minutes(30) +}); +``` + +## Limiting concurrency + +By default if a new build is triggered it will be run even if there is a previous build already in progress. +It is possible to limit the maximum concurrent builds to value between 1 and the account specific maximum limit. +By default there is no explicit limit. + +```ts +new codebuild.Project(this, 'MyProject', { + concurrentBuildLimit: 1 +}); +``` diff --git a/packages/aws-cdk-lib/aws-codebuild/index.ts b/packages/aws-cdk-lib/aws-codebuild/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts b/packages/aws-cdk-lib/aws-codebuild/lib/artifacts.ts similarity index 99% rename from packages/@aws-cdk/aws-codebuild/lib/artifacts.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/artifacts.ts index be5224b266ed9..312c8763c043c 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/artifacts.ts @@ -1,4 +1,4 @@ -import * as s3 from '@aws-cdk/aws-s3'; +import * as s3 from '../../aws-s3'; import { Construct } from 'constructs'; import { CfnProject } from './codebuild.generated'; import { IProject } from './project'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/build-spec.ts b/packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts similarity index 98% rename from packages/@aws-cdk/aws-codebuild/lib/build-spec.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts index 92bae615e8e7b..0ff59ba67ae4c 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/build-spec.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/build-spec.ts @@ -1,5 +1,5 @@ -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import { IResolveContext, Lazy, Stack } from '@aws-cdk/core'; +import * as s3_assets from '../../aws-s3-assets'; +import { IResolveContext, Lazy, Stack } from '../../core'; import { Construct } from 'constructs'; import * as yaml_cfn from './private/yaml-cfn'; import { Project } from './project'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/cache.ts b/packages/aws-cdk-lib/aws-codebuild/lib/cache.ts similarity index 96% rename from packages/@aws-cdk/aws-codebuild/lib/cache.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/cache.ts index 1d8e264649634..68ab19dbee3e5 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/cache.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/cache.ts @@ -1,5 +1,5 @@ -import { IBucket } from '@aws-cdk/aws-s3'; -import { Aws, Fn } from '@aws-cdk/core'; +import { IBucket } from '../../aws-s3'; +import { Aws, Fn } from '../../core'; import { CfnProject } from './codebuild.generated'; import { IProject } from './project'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/codepipeline-artifacts.ts b/packages/aws-cdk-lib/aws-codebuild/lib/codepipeline-artifacts.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/codepipeline-artifacts.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/codepipeline-artifacts.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/codepipeline-source.ts b/packages/aws-cdk-lib/aws-codebuild/lib/codepipeline-source.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/codepipeline-source.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/codepipeline-source.ts diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/events.ts b/packages/aws-cdk-lib/aws-codebuild/lib/events.ts new file mode 100644 index 0000000000000..e5fbd64df44cf --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/lib/events.ts @@ -0,0 +1,88 @@ +import * as events from '../../aws-events'; + +/** + * Event fields for the CodeBuild "state change" event + * + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html#sample-build-notifications-ref + */ +export class StateChangeEvent { + /** + * The triggering build's status + */ + public static get buildStatus() { + return events.EventField.fromPath('$.detail.build-status'); + } + + /** + * The triggering build's project name + */ + public static get projectName() { + return events.EventField.fromPath('$.detail.project-name'); + } + + /** + * Return the build id + */ + public static get buildId() { + return events.EventField.fromPath('$.detail.build-id'); + } + + public static get currentPhase() { + return events.EventField.fromPath('$.detail.current-phase'); + } + + private constructor() { + } +} + +/** + * Event fields for the CodeBuild "phase change" event + * + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html#sample-build-notifications-ref + */ +export class PhaseChangeEvent { + /** + * The triggering build's project name + */ + public static get projectName() { + return events.EventField.fromPath('$.detail.project-name'); + } + + /** + * The triggering build's id + */ + public static get buildId() { + return events.EventField.fromPath('$.detail.build-id'); + } + + /** + * The phase that was just completed + */ + public static get completedPhase() { + return events.EventField.fromPath('$.detail.completed-phase'); + } + + /** + * The status of the completed phase + */ + public static get completedPhaseStatus() { + return events.EventField.fromPath('$.detail.completed-phase-status'); + } + + /** + * The duration of the completed phase + */ + public static get completedPhaseDurationSeconds() { + return events.EventField.fromPath('$.detail.completed-phase-duration-seconds'); + } + + /** + * Whether the build is complete + */ + public static get buildComplete() { + return events.EventField.fromPath('$.detail.build-complete'); + } + + private constructor() { + } +} diff --git a/packages/@aws-cdk/aws-codebuild/lib/file-location.ts b/packages/aws-cdk-lib/aws-codebuild/lib/file-location.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/file-location.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/file-location.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/index.ts b/packages/aws-cdk-lib/aws-codebuild/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/index.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/index.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/linux-arm-build-image.ts b/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts similarity index 97% rename from packages/@aws-cdk/aws-codebuild/lib/linux-arm-build-image.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts index 8f466c7b8ddc9..74e7762f33255 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/linux-arm-build-image.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts @@ -1,5 +1,5 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; +import * as ecr from '../../aws-ecr'; +import * as secretsmanager from '../../aws-secretsmanager'; import { BuildSpec } from './build-spec'; import { runScriptLinuxBuildSpec } from './private/run-script-linux-build-spec'; import { BuildEnvironment, ComputeType, IBuildImage, ImagePullPrincipalType } from './project'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/linux-gpu-build-image.ts b/packages/aws-cdk-lib/aws-codebuild/lib/linux-gpu-build-image.ts similarity index 98% rename from packages/@aws-cdk/aws-codebuild/lib/linux-gpu-build-image.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/linux-gpu-build-image.ts index bbdf6d50517fc..f263f0a58c591 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/linux-gpu-build-image.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/linux-gpu-build-image.ts @@ -1,6 +1,6 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import * as core from '@aws-cdk/core'; -import { FactName } from '@aws-cdk/region-info'; +import * as ecr from '../../aws-ecr'; +import * as core from '../../core'; +import { FactName } from '../../region-info'; import { Construct } from 'constructs'; import { BuildSpec } from './build-spec'; import { runScriptLinuxBuildSpec } from './private/run-script-linux-build-spec'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/no-artifacts.ts b/packages/aws-cdk-lib/aws-codebuild/lib/no-artifacts.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/no-artifacts.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/no-artifacts.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/no-source.ts b/packages/aws-cdk-lib/aws-codebuild/lib/no-source.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/no-source.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/no-source.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/pipeline-project.ts b/packages/aws-cdk-lib/aws-codebuild/lib/pipeline-project.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/pipeline-project.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/pipeline-project.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/private/run-script-linux-build-spec.ts b/packages/aws-cdk-lib/aws-codebuild/lib/private/run-script-linux-build-spec.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/private/run-script-linux-build-spec.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/private/run-script-linux-build-spec.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/private/yaml-cfn.ts b/packages/aws-cdk-lib/aws-codebuild/lib/private/yaml-cfn.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/private/yaml-cfn.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/private/yaml-cfn.ts diff --git a/packages/@aws-cdk/aws-codebuild/lib/project-logs.ts b/packages/aws-cdk-lib/aws-codebuild/lib/project-logs.ts similarity index 95% rename from packages/@aws-cdk/aws-codebuild/lib/project-logs.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/project-logs.ts index d2613462d6330..d131cd8f94c09 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project-logs.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/project-logs.ts @@ -1,5 +1,5 @@ -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; /** * Information about logs built to an S3 bucket for a build project. diff --git a/packages/@aws-cdk/aws-codebuild/lib/project.ts b/packages/aws-cdk-lib/aws-codebuild/lib/project.ts similarity index 99% rename from packages/@aws-cdk/aws-codebuild/lib/project.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/project.ts index a0f7e45f75701..61effdf6a577c 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/project.ts @@ -1,14 +1,14 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { DockerImageAsset, DockerImageAssetProps } from '@aws-cdk/aws-ecr-assets'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { ArnFormat, Aws, Duration, IResource, Lazy, Names, PhysicalName, Reference, Resource, SecretValue, Stack, Token, TokenComparison, Tokenization } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as notifications from '../../aws-codestarnotifications'; +import * as ec2 from '../../aws-ec2'; +import * as ecr from '../../aws-ecr'; +import { DockerImageAsset, DockerImageAssetProps } from '../../aws-ecr-assets'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { ArnFormat, Aws, Duration, IResource, Lazy, Names, PhysicalName, Reference, Resource, SecretValue, Stack, Token, TokenComparison, Tokenization } from '../../core'; import { Construct, IConstruct } from 'constructs'; import { IArtifacts } from './artifacts'; import { BuildSpec } from './build-spec'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/report-group-utils.ts b/packages/aws-cdk-lib/aws-codebuild/lib/report-group-utils.ts similarity index 93% rename from packages/@aws-cdk/aws-codebuild/lib/report-group-utils.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/report-group-utils.ts index 9789807652866..709bbf731328e 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/report-group-utils.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/report-group-utils.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; // this file contains a bunch of functions shared diff --git a/packages/@aws-cdk/aws-codebuild/lib/report-group.ts b/packages/aws-cdk-lib/aws-codebuild/lib/report-group.ts similarity index 97% rename from packages/@aws-cdk/aws-codebuild/lib/report-group.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/report-group.ts index a10bdd1f04e6f..469ef5970e5fe 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/report-group.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/report-group.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnReportGroup } from './codebuild.generated'; import { renderReportGroupArn, reportGroupArnComponents } from './report-group-utils'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/source-credentials.ts b/packages/aws-cdk-lib/aws-codebuild/lib/source-credentials.ts similarity index 98% rename from packages/@aws-cdk/aws-codebuild/lib/source-credentials.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/source-credentials.ts index 479c9d627cde3..1fd3dd836f188 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/source-credentials.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/source-credentials.ts @@ -1,4 +1,4 @@ -import { Resource, SecretValue } from '@aws-cdk/core'; +import { Resource, SecretValue } from '../../core'; import { Construct } from 'constructs'; import { CfnSourceCredential } from './codebuild.generated'; diff --git a/packages/@aws-cdk/aws-codebuild/lib/source-types.ts b/packages/aws-cdk-lib/aws-codebuild/lib/source-types.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/lib/source-types.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/source-types.ts diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/source.ts b/packages/aws-cdk-lib/aws-codebuild/lib/source.ts new file mode 100644 index 0000000000000..b12f78ca996f4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/lib/source.ts @@ -0,0 +1,887 @@ +import * as codecommit from '../../aws-codecommit'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import { Construct } from 'constructs'; +import { CfnProject } from './codebuild.generated'; +import { IProject } from './project'; +import { + BITBUCKET_SOURCE_TYPE, + CODECOMMIT_SOURCE_TYPE, + GITHUB_ENTERPRISE_SOURCE_TYPE, + GITHUB_SOURCE_TYPE, + S3_SOURCE_TYPE, +} from './source-types'; + +/** + * The type returned from `ISource#bind`. + */ +export interface SourceConfig { + readonly sourceProperty: CfnProject.SourceProperty; + + readonly buildTriggers?: CfnProject.ProjectTriggersProperty; + + /** + * `AWS::CodeBuild::Project.SourceVersion` + * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codebuild-project.html#cfn-codebuild-project-sourceversion + * @default the latest version + */ + readonly sourceVersion?: string; +} + +/** + * The abstract interface of a CodeBuild source. + * Implemented by `Source`. + */ +export interface ISource { + readonly identifier?: string; + + readonly type: string; + + readonly badgeSupported: boolean; + + bind(scope: Construct, project: IProject): SourceConfig; +} + +/** + * Properties common to all Source classes. + */ +export interface SourceProps { + /** + * The source identifier. + * This property is required on secondary sources. + */ + readonly identifier?: string; +} + +/** + * Source provider definition for a CodeBuild Project. + */ +export abstract class Source implements ISource { + public static s3(props: S3SourceProps): ISource { + return new S3Source(props); + } + + public static codeCommit(props: CodeCommitSourceProps): ISource { + return new CodeCommitSource(props); + } + + public static gitHub(props: GitHubSourceProps): ISource { + return new GitHubSource(props); + } + + public static gitHubEnterprise(props: GitHubEnterpriseSourceProps): ISource { + return new GitHubEnterpriseSource(props); + } + + public static bitBucket(props: BitBucketSourceProps): ISource { + return new BitBucketSource(props); + } + + public readonly identifier?: string; + public abstract readonly type: string; + public readonly badgeSupported: boolean = false; + + protected constructor(props: SourceProps) { + this.identifier = props.identifier; + } + + /** + * Called by the project when the source is added so that the source can perform + * binding operations on the source. For example, it can grant permissions to the + * code build project to read from the S3 bucket. + */ + public bind(_scope: Construct, _project: IProject): SourceConfig { + return { + sourceProperty: { + sourceIdentifier: this.identifier, + type: this.type, + }, + }; + } +} + +/** + * The construction properties common to all build sources that are backed by Git. + */ +interface GitSourceProps extends SourceProps { + /** + * The depth of history to download. Minimum value is 0. + * If this value is 0, greater than 25, or not provided, + * then the full history is downloaded with each build of the project. + */ + readonly cloneDepth?: number; + + /** + * The commit ID, pull request ID, branch name, or tag name that corresponds to + * the version of the source code you want to build + * + * @example 'mybranch' + * @default the default branch's HEAD commit ID is used + */ + readonly branchOrRef?: string; + + /** + * Whether to fetch submodules while cloning git repo. + * + * @default false + */ + readonly fetchSubmodules?: boolean; +} + +/** + * A common superclass of all build sources that are backed by Git. + */ +abstract class GitSource extends Source { + private readonly cloneDepth?: number; + private readonly branchOrRef?: string; + private readonly fetchSubmodules?: boolean; + + protected constructor(props: GitSourceProps) { + super(props); + + this.cloneDepth = props.cloneDepth; + this.branchOrRef = props.branchOrRef; + this.fetchSubmodules = props.fetchSubmodules; + } + + public bind(_scope: Construct, _project: IProject): SourceConfig { + const superConfig = super.bind(_scope, _project); + return { + sourceVersion: this.branchOrRef, + sourceProperty: { + ...superConfig.sourceProperty, + gitCloneDepth: this.cloneDepth, + gitSubmodulesConfig: this.fetchSubmodules ? { + fetchSubmodules: this.fetchSubmodules, + } : undefined, + }, + }; + } +} + +/** + * The types of webhook event actions. + */ +export enum EventAction { + /** + * A push (of a branch, or a tag) to the repository. + */ + PUSH = 'PUSH', + + /** + * Creating a Pull Request. + */ + PULL_REQUEST_CREATED = 'PULL_REQUEST_CREATED', + + /** + * Updating a Pull Request. + */ + PULL_REQUEST_UPDATED = 'PULL_REQUEST_UPDATED', + + /** + * Merging a Pull Request. + */ + PULL_REQUEST_MERGED = 'PULL_REQUEST_MERGED', + + /** + * Re-opening a previously closed Pull Request. + * Note that this event is only supported for GitHub and GitHubEnterprise sources. + */ + PULL_REQUEST_REOPENED = 'PULL_REQUEST_REOPENED', +} + +enum WebhookFilterTypes { + FILE_PATH = 'FILE_PATH', + COMMIT_MESSAGE = 'COMMIT_MESSAGE', + HEAD_REF = 'HEAD_REF', + ACTOR_ACCOUNT_ID = 'ACTOR_ACCOUNT_ID', + BASE_REF = 'BASE_REF', +} + +/** + * An object that represents a group of filter conditions for a webhook. + * Every condition in a given FilterGroup must be true in order for the whole group to be true. + * You construct instances of it by calling the `#inEventOf` static factory method, + * and then calling various `andXyz` instance methods to create modified instances of it + * (this class is immutable). + * + * You pass instances of this class to the `webhookFilters` property when constructing a source. + */ +export class FilterGroup { + /** + * Creates a new event FilterGroup that triggers on any of the provided actions. + * + * @param actions the actions to trigger the webhook on + */ + public static inEventOf(...actions: EventAction[]): FilterGroup { + return new FilterGroup(new Set(actions), []); + } + + private readonly actions: Set; + private readonly filters: CfnProject.WebhookFilterProperty[]; + + private constructor(actions: Set, filters: CfnProject.WebhookFilterProperty[]) { + if (actions.size === 0) { + throw new Error('A filter group must contain at least one event action'); + } + this.actions = actions; + this.filters = filters; + } + + /** + * Create a new FilterGroup with an added condition: + * the event must affect the given branch. + * + * @param branchName the name of the branch (can be a regular expression) + */ + public andBranchIs(branchName: string): FilterGroup { + return this.addHeadBranchFilter(branchName, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must not affect the given branch. + * + * @param branchName the name of the branch (can be a regular expression) + */ + public andBranchIsNot(branchName: string): FilterGroup { + return this.addHeadBranchFilter(branchName, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must affect a head commit with the given message. + * + * @param commitMessage the commit message (can be a regular expression) + */ + public andCommitMessageIs(commitMessage: string): FilterGroup { + return this.addCommitMessageFilter(commitMessage, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must not affect a head commit with the given message. + * + * @param commitMessage the commit message (can be a regular expression) + */ + public andCommitMessageIsNot(commitMessage: string): FilterGroup { + return this.addCommitMessageFilter(commitMessage, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must affect the given tag. + * + * @param tagName the name of the tag (can be a regular expression) + */ + public andTagIs(tagName: string): FilterGroup { + return this.addHeadTagFilter(tagName, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must not affect the given tag. + * + * @param tagName the name of the tag (can be a regular expression) + */ + public andTagIsNot(tagName: string): FilterGroup { + return this.addHeadTagFilter(tagName, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must affect a Git reference (ie., a branch or a tag) + * that matches the given pattern. + * + * @param pattern a regular expression + */ + public andHeadRefIs(pattern: string) { + return this.addHeadRefFilter(pattern, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the event must not affect a Git reference (ie., a branch or a tag) + * that matches the given pattern. + * + * @param pattern a regular expression + */ + public andHeadRefIsNot(pattern: string) { + return this.addHeadRefFilter(pattern, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the account ID of the actor initiating the event must match the given pattern. + * + * @param pattern a regular expression + */ + public andActorAccountIs(pattern: string): FilterGroup { + return this.addActorAccountId(pattern, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the account ID of the actor initiating the event must not match the given pattern. + * + * @param pattern a regular expression + */ + public andActorAccountIsNot(pattern: string): FilterGroup { + return this.addActorAccountId(pattern, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the Pull Request that is the source of the event must target the given base branch. + * Note that you cannot use this method if this Group contains the `PUSH` event action. + * + * @param branchName the name of the branch (can be a regular expression) + */ + public andBaseBranchIs(branchName: string): FilterGroup { + return this.addBaseBranchFilter(branchName, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the Pull Request that is the source of the event must not target the given base branch. + * Note that you cannot use this method if this Group contains the `PUSH` event action. + * + * @param branchName the name of the branch (can be a regular expression) + */ + public andBaseBranchIsNot(branchName: string): FilterGroup { + return this.addBaseBranchFilter(branchName, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the Pull Request that is the source of the event must target the given Git reference. + * Note that you cannot use this method if this Group contains the `PUSH` event action. + * + * @param pattern a regular expression + */ + public andBaseRefIs(pattern: string): FilterGroup { + return this.addBaseRefFilter(pattern, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the Pull Request that is the source of the event must not target the given Git reference. + * Note that you cannot use this method if this Group contains the `PUSH` event action. + * + * @param pattern a regular expression + */ + public andBaseRefIsNot(pattern: string): FilterGroup { + return this.addBaseRefFilter(pattern, false); + } + + /** + * Create a new FilterGroup with an added condition: + * the push that is the source of the event must affect a file that matches the given pattern. + * Note that you can only use this method if this Group contains only the `PUSH` event action, + * and only for GitHub, Bitbucket and GitHubEnterprise sources. + * + * @param pattern a regular expression + */ + public andFilePathIs(pattern: string): FilterGroup { + return this.addFilePathFilter(pattern, true); + } + + /** + * Create a new FilterGroup with an added condition: + * the push that is the source of the event must not affect a file that matches the given pattern. + * Note that you can only use this method if this Group contains only the `PUSH` event action, + * and only for GitHub, Bitbucket and GitHubEnterprise sources. + * + * @param pattern a regular expression + */ + public andFilePathIsNot(pattern: string): FilterGroup { + return this.addFilePathFilter(pattern, false); + } + + /** @internal */ + public get _actions(): EventAction[] { + return set2Array(this.actions); + } + + /** @internal */ + public get _filters(): CfnProject.WebhookFilterProperty[] { + return this.filters.slice(); + } + + /** @internal */ + public _toJson(): CfnProject.WebhookFilterProperty[] { + const eventFilter: CfnProject.WebhookFilterProperty = { + type: 'EVENT', + pattern: set2Array(this.actions).join(', '), + }; + return [eventFilter].concat(this.filters); + } + + private addCommitMessageFilter(commitMessage: string, include: boolean): FilterGroup { + return this.addFilter(WebhookFilterTypes.COMMIT_MESSAGE, commitMessage, include); + } + + private addHeadBranchFilter(branchName: string, include: boolean): FilterGroup { + return this.addHeadRefFilter(`refs/heads/${branchName}`, include); + } + + private addHeadTagFilter(tagName: string, include: boolean): FilterGroup { + return this.addHeadRefFilter(`refs/tags/${tagName}`, include); + } + + private addHeadRefFilter(refName: string, include: boolean) { + return this.addFilter(WebhookFilterTypes.HEAD_REF, refName, include); + } + + private addActorAccountId(accountId: string, include: boolean) { + return this.addFilter(WebhookFilterTypes.ACTOR_ACCOUNT_ID, accountId, include); + } + + private addBaseBranchFilter(branchName: string, include: boolean): FilterGroup { + return this.addBaseRefFilter(`refs/heads/${branchName}`, include); + } + + private addBaseRefFilter(refName: string, include: boolean) { + if (this.actions.has(EventAction.PUSH)) { + throw new Error('A base reference condition cannot be added if a Group contains a PUSH event action'); + } + return this.addFilter(WebhookFilterTypes.BASE_REF, refName, include); + } + + private addFilePathFilter(pattern: string, include: boolean): FilterGroup { + return this.addFilter(WebhookFilterTypes.FILE_PATH, pattern, include); + } + + private addFilter(type: WebhookFilterTypes, pattern: string, include: boolean) { + return new FilterGroup(this.actions, this.filters.concat([{ + type, + pattern, + excludeMatchedPattern: include ? undefined : true, + }])); + } +} + +/** + * The construction properties common to all third-party build sources that are backed by Git. + */ +interface ThirdPartyGitSourceProps extends GitSourceProps { + /** + * Whether to send notifications on your build's start and end. + * + * @default true + */ + readonly reportBuildStatus?: boolean; + + /** + * Whether to create a webhook that will trigger a build every time an event happens in the repository. + * + * @default true if any `webhookFilters` were provided, false otherwise + */ + readonly webhook?: boolean; + + /** + * Trigger a batch build from a webhook instead of a standard one. + * + * Enabling this will enable batch builds on the CodeBuild project. + * + * @default false + */ + readonly webhookTriggersBatchBuild?: boolean; + + /** + * A list of webhook filters that can constraint what events in the repository will trigger a build. + * A build is triggered if any of the provided filter groups match. + * Only valid if `webhook` was not provided as false. + * + * @default every push and every Pull Request (create or update) triggers a build + */ + readonly webhookFilters?: FilterGroup[]; + + /** + * The URL that the build will report back to the source provider. + * Can use built-in CodeBuild variables, like $AWS_REGION. + * + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.source.buildstatusconfig.targeturl + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html + * + * @example "$CODEBUILD_PUBLIC_BUILD_URL" + * @default - link to the AWS Console for CodeBuild to a particular build execution + */ + readonly buildStatusUrl?: string; +} + +/** + * A common superclass of all third-party build sources that are backed by Git. + */ +abstract class ThirdPartyGitSource extends GitSource { + public readonly badgeSupported: boolean = true; + protected readonly webhookFilters: FilterGroup[]; + private readonly reportBuildStatus: boolean; + private readonly webhook?: boolean; + private readonly webhookTriggersBatchBuild?: boolean; + protected readonly buildStatusUrl?: string; + + protected constructor(props: ThirdPartyGitSourceProps) { + super(props); + + this.webhook = props.webhook; + this.reportBuildStatus = props.reportBuildStatus ?? true; + this.webhookFilters = props.webhookFilters || []; + this.webhookTriggersBatchBuild = props.webhookTriggersBatchBuild; + this.buildStatusUrl = props.buildStatusUrl; + } + + public bind(_scope: Construct, project: IProject): SourceConfig { + const anyFilterGroupsProvided = this.webhookFilters.length > 0; + const webhook = this.webhook ?? (anyFilterGroupsProvided ? true : undefined); + + if (!webhook && anyFilterGroupsProvided) { + throw new Error('`webhookFilters` cannot be used when `webhook` is `false`'); + } + + if (!webhook && this.webhookTriggersBatchBuild) { + throw new Error('`webhookTriggersBatchBuild` cannot be used when `webhook` is `false`'); + } + + const superConfig = super.bind(_scope, project); + + if (this.webhookTriggersBatchBuild) { + project.enableBatchBuilds(); + } + + return { + sourceProperty: { + ...superConfig.sourceProperty, + reportBuildStatus: this.reportBuildStatus, + }, + sourceVersion: superConfig.sourceVersion, + buildTriggers: webhook === undefined ? undefined : { + webhook, + buildType: this.webhookTriggersBatchBuild ? 'BUILD_BATCH' : undefined, + filterGroups: anyFilterGroupsProvided ? this.webhookFilters.map(fg => fg._toJson()) : undefined, + }, + }; + } +} + +/** + * Construction properties for `CodeCommitSource`. + */ +export interface CodeCommitSourceProps extends GitSourceProps { + readonly repository: codecommit.IRepository; +} + +/** + * CodeCommit Source definition for a CodeBuild project. + */ +class CodeCommitSource extends GitSource { + public readonly badgeSupported = true; + public readonly type = CODECOMMIT_SOURCE_TYPE; + private readonly repo: codecommit.IRepository; + + constructor(props: CodeCommitSourceProps) { + super(props); + this.repo = props.repository; + } + + public bind(_scope: Construct, project: IProject): SourceConfig { + // https://docs.aws.amazon.com/codebuild/latest/userguide/setting-up.html + project.addToRolePolicy(new iam.PolicyStatement({ + actions: ['codecommit:GitPull'], + resources: [this.repo.repositoryArn], + })); + + const superConfig = super.bind(_scope, project); + return { + sourceProperty: { + ...superConfig.sourceProperty, + location: this.repo.repositoryCloneUrlHttp, + }, + sourceVersion: superConfig.sourceVersion, + }; + } +} + +/** + * Construction properties for `S3Source`. + */ +export interface S3SourceProps extends SourceProps { + readonly bucket: s3.IBucket; + readonly path: string; + + /** + * The version ID of the object that represents the build input ZIP file to use. + * + * @default latest + */ + readonly version?: string; +} + +/** + * S3 bucket definition for a CodeBuild project. + */ +class S3Source extends Source { + public readonly type = S3_SOURCE_TYPE; + private readonly bucket: s3.IBucket; + private readonly path: string; + private readonly version?: string; + + constructor(props: S3SourceProps) { + super(props); + this.bucket = props.bucket; + this.path = props.path; + this.version = props.version; + } + + public bind(_scope: Construct, project: IProject): SourceConfig { + this.bucket.grantRead(project, this.path); + + const superConfig = super.bind(_scope, project); + return { + sourceProperty: { + ...superConfig.sourceProperty, + location: `${this.bucket.bucketName}/${this.path}`, + }, + sourceVersion: this.version, + }; + } +} + +/** + * Common properties between `GitHubSource` and `GitHubEnterpriseSource`. + */ +interface CommonGithubSourceProps extends ThirdPartyGitSourceProps { + /** + * This parameter is used for the `context` parameter in the GitHub commit status. + * Can use built-in CodeBuild variables, like $AWS_REGION. + * + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.source.buildstatusconfig.context + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html + * + * @example "My build #$CODEBUILD_BUILD_NUMBER" + * @default "AWS CodeBuild $AWS_REGION ($PROJECT_NAME)" + */ + readonly buildStatusContext?: string +} + +abstract class CommonGithubSource extends ThirdPartyGitSource { + private readonly buildStatusContext?: string; + + constructor(props: CommonGithubSourceProps) { + super(props); + this.buildStatusContext = props.buildStatusContext; + } + + public bind(scope: Construct, project: IProject): SourceConfig { + const superConfig = super.bind(scope, project); + return { + sourceProperty: { + ...superConfig.sourceProperty, + buildStatusConfig: this.buildStatusContext !== undefined || this.buildStatusUrl !== undefined + ? { + context: this.buildStatusContext, + targetUrl: this.buildStatusUrl, + } + : undefined, + }, + sourceVersion: superConfig.sourceVersion, + buildTriggers: superConfig.buildTriggers, + }; + } +} + +/** + * Construction properties for `GitHubSource` and `GitHubEnterpriseSource`. + */ +export interface GitHubSourceProps extends CommonGithubSourceProps { + /** + * The GitHub account/user that owns the repo. + * + * @example 'awslabs' + */ + readonly owner: string; + + /** + * The name of the repo (without the username). + * + * @example 'aws-cdk' + */ + readonly repo: string; +} + +/** + * GitHub Source definition for a CodeBuild project. + */ +class GitHubSource extends CommonGithubSource { + public readonly type = GITHUB_SOURCE_TYPE; + private readonly httpsCloneUrl: string; + + constructor(props: GitHubSourceProps) { + super(props); + this.httpsCloneUrl = `https://github.com/${props.owner}/${props.repo}.git`; + } + + public bind(_scope: Construct, project: IProject): SourceConfig { + const superConfig = super.bind(_scope, project); + return { + sourceProperty: { + ...superConfig.sourceProperty, + location: this.httpsCloneUrl, + }, + sourceVersion: superConfig.sourceVersion, + buildTriggers: superConfig.buildTriggers, + }; + } +} + +/** + * Construction properties for `GitHubEnterpriseSource`. + */ +export interface GitHubEnterpriseSourceProps extends CommonGithubSourceProps { + /** + * The HTTPS URL of the repository in your GitHub Enterprise installation. + */ + readonly httpsCloneUrl: string; + + /** + * Whether to ignore SSL errors when connecting to the repository. + * + * @default false + */ + readonly ignoreSslErrors?: boolean; +} + +/** + * GitHub Enterprise Source definition for a CodeBuild project. + */ +class GitHubEnterpriseSource extends CommonGithubSource { + public readonly type = GITHUB_ENTERPRISE_SOURCE_TYPE; + private readonly httpsCloneUrl: string; + private readonly ignoreSslErrors?: boolean; + + constructor(props: GitHubEnterpriseSourceProps) { + super(props); + this.httpsCloneUrl = props.httpsCloneUrl; + this.ignoreSslErrors = props.ignoreSslErrors; + } + + public bind(_scope: Construct, _project: IProject): SourceConfig { + if (this.hasCommitMessageFilterAndPrEvent()) { + throw new Error('COMMIT_MESSAGE filters cannot be used with GitHub Enterprise Server pull request events'); + } + + if (this.hasFilePathFilterAndPrEvent()) { + throw new Error('FILE_PATH filters cannot be used with GitHub Enterprise Server pull request events'); + } + + const superConfig = super.bind(_scope, _project); + return { + sourceProperty: { + ...superConfig.sourceProperty, + location: this.httpsCloneUrl, + insecureSsl: this.ignoreSslErrors, + }, + sourceVersion: superConfig.sourceVersion, + buildTriggers: superConfig.buildTriggers, + }; + } + + private hasCommitMessageFilterAndPrEvent() { + return this.webhookFilters.some(fg => ( + fg._filters.some(fp => fp.type === WebhookFilterTypes.COMMIT_MESSAGE) && + this.hasPrEvent(fg._actions))); + } + private hasFilePathFilterAndPrEvent() { + return this.webhookFilters.some(fg => ( + fg._filters.some(fp => fp.type === WebhookFilterTypes.FILE_PATH) && + this.hasPrEvent(fg._actions))); + } + private hasPrEvent(actions: EventAction[]) { + return actions.includes( + EventAction.PULL_REQUEST_CREATED || + EventAction.PULL_REQUEST_MERGED || + EventAction.PULL_REQUEST_REOPENED || + EventAction.PULL_REQUEST_UPDATED); + } +} + +/** + * Construction properties for `BitBucketSource`. + */ +export interface BitBucketSourceProps extends ThirdPartyGitSourceProps { + /** + * The BitBucket account/user that owns the repo. + * + * @example 'awslabs' + */ + readonly owner: string; + + /** + * The name of the repo (without the username). + * + * @example 'aws-cdk' + */ + readonly repo: string; + + /** + * This parameter is used for the `name` parameter in the Bitbucket commit status. + * Can use built-in CodeBuild variables, like $AWS_REGION. + * + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/create-project-cli.html#cli.source.buildstatusconfig.context + * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html + * + * @example "My build #$CODEBUILD_BUILD_NUMBER" + * @default "AWS CodeBuild $AWS_REGION ($PROJECT_NAME)" + */ + readonly buildStatusName?: string; +} + +/** + * BitBucket Source definition for a CodeBuild project. + */ +class BitBucketSource extends ThirdPartyGitSource { + public readonly type = BITBUCKET_SOURCE_TYPE; + private readonly httpsCloneUrl: any; + private readonly buildStatusName?: string; + + constructor(props: BitBucketSourceProps) { + super(props); + this.httpsCloneUrl = `https://bitbucket.org/${props.owner}/${props.repo}.git`; + this.buildStatusName = props.buildStatusName; + } + + public bind(_scope: Construct, _project: IProject): SourceConfig { + // BitBucket sources don't support the PULL_REQUEST_REOPENED event action + if (this.anyWebhookFilterContainsPrReopenedEventAction()) { + throw new Error('BitBucket sources do not support the PULL_REQUEST_REOPENED webhook event action'); + } + + const superConfig = super.bind(_scope, _project); + return { + sourceProperty: { + ...superConfig.sourceProperty, + location: this.httpsCloneUrl, + buildStatusConfig: this.buildStatusName !== undefined || this.buildStatusUrl !== undefined + ? { + context: this.buildStatusName, + targetUrl: this.buildStatusUrl, + } + : undefined, + }, + sourceVersion: superConfig.sourceVersion, + buildTriggers: superConfig.buildTriggers, + }; + } + + private anyWebhookFilterContainsPrReopenedEventAction() { + return this.webhookFilters.findIndex(fg => { + return fg._actions.findIndex(a => a === EventAction.PULL_REQUEST_REOPENED) !== -1; + }) !== -1; + } +} + +function set2Array(set: Set): T[] { + const ret: T[] = []; + set.forEach(el => ret.push(el)); + return ret; +} diff --git a/packages/@aws-cdk/aws-codebuild/lib/untrusted-code-boundary-policy.ts b/packages/aws-cdk-lib/aws-codebuild/lib/untrusted-code-boundary-policy.ts similarity index 98% rename from packages/@aws-cdk/aws-codebuild/lib/untrusted-code-boundary-policy.ts rename to packages/aws-cdk-lib/aws-codebuild/lib/untrusted-code-boundary-policy.ts index 1a94c521fc08a..462af3ffe0ee2 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/untrusted-code-boundary-policy.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/untrusted-code-boundary-policy.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.report-group.js.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/assertion-results.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/assertion-results.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/assertion-results.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/assertion-results.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.assets.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.assets.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.assets.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.assets.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.template.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.template.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/aws-cdk-codebuild-breakpoint.template.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/aws-cdk-codebuild-breakpoint.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.vdm-attributes.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/integ.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/integ.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/manifest.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/integ.breakpoint.js.snapshot/manifest.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/tree.json b/packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/breakpoint.integ.snapshot/tree.json rename to packages/aws-cdk-lib/aws-codebuild/test/breakpoint.integ.snapshot/tree.json diff --git a/packages/aws-cdk-lib/aws-codebuild/test/build-spec-asset.yml b/packages/aws-cdk-lib/aws-codebuild/test/build-spec-asset.yml new file mode 100644 index 0000000000000..82f86c25d24f0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/build-spec-asset.yml @@ -0,0 +1,6 @@ +version: 0.2 + +phases: + build: + commands: + - echo running stuff diff --git a/packages/@aws-cdk/aws-codebuild/test/build-spec.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/build-spec.test.ts similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/build-spec.test.ts rename to packages/aws-cdk-lib/aws-codebuild/test/build-spec.test.ts diff --git a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts new file mode 100644 index 0000000000000..3827705d56195 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts @@ -0,0 +1,1988 @@ +import { Match, Template } from '../../assertions'; +import * as codecommit from '../../aws-codecommit'; +import * as ec2 from '../../aws-ec2'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import * as codebuild from '../lib'; +import { CodePipelineSource } from '../lib/codepipeline-source'; +import { NoSource } from '../lib/no-source'; + +/* eslint-disable quote-props */ + +describe('default properties', () => { + test('with CodePipeline source', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'MyProject'); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'MyProjectRole9BBE5233': { + 'Type': 'AWS::IAM::Role', + 'Properties': { + 'AssumeRolePolicyDocument': { + 'Statement': [ + { + 'Action': 'sts:AssumeRole', + 'Effect': 'Allow', + 'Principal': { + 'Service': 'codebuild.amazonaws.com', + }, + }, + ], + 'Version': '2012-10-17', + }, + }, + }, + 'MyProjectRoleDefaultPolicyB19B7C29': { + 'Type': 'AWS::IAM::Policy', + 'Properties': { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': [ + 'logs:CreateLogGroup', + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + 'Effect': 'Allow', + 'Resource': [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':logs:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':log-group:/aws/codebuild/', + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':logs:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':log-group:/aws/codebuild/', + { + 'Ref': 'MyProject39F7B0AE', + }, + ':*', + ], + ], + }, + ], + }, + { + 'Action': [ + 'codebuild:CreateReportGroup', + 'codebuild:CreateReport', + 'codebuild:UpdateReport', + 'codebuild:BatchPutTestCases', + 'codebuild:BatchPutCodeCoverages', + ], + 'Effect': 'Allow', + 'Resource': { + 'Fn::Join': ['', [ + 'arn:', + { 'Ref': 'AWS::Partition' }, + ':codebuild:', + { 'Ref': 'AWS::Region' }, + ':', + { 'Ref': 'AWS::AccountId' }, + ':report-group/', + { 'Ref': 'MyProject39F7B0AE' }, + '-*', + ]], + }, + }, + ], + 'Version': '2012-10-17', + }, + 'PolicyName': 'MyProjectRoleDefaultPolicyB19B7C29', + 'Roles': [ + { + 'Ref': 'MyProjectRole9BBE5233', + }, + ], + }, + }, + 'MyProject39F7B0AE': { + 'Type': 'AWS::CodeBuild::Project', + 'Properties': { + 'Source': { + 'Type': 'CODEPIPELINE', + }, + 'Artifacts': { + 'Type': 'CODEPIPELINE', + }, + 'ServiceRole': { + 'Fn::GetAtt': [ + 'MyProjectRole9BBE5233', + 'Arn', + ], + }, + 'Environment': { + 'Type': 'LINUX_CONTAINER', + 'PrivilegedMode': false, + 'Image': 'aws/codebuild/standard:1.0', + 'ImagePullCredentialsType': 'CODEBUILD', + 'ComputeType': 'BUILD_GENERAL1_SMALL', + }, + 'EncryptionKey': 'alias/aws/s3', + 'Cache': { + 'Type': 'NO_CACHE', + }, + }, + }, + }, + }); + }); + + test('with CodeCommit source', () => { + const stack = new cdk.Stack(); + + const repo = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'hello-cdk', + }); + + const source = codebuild.Source.codeCommit({ repository: repo, cloneDepth: 2 }); + + new codebuild.Project(stack, 'MyProject', { + source, + }); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'MyRepoF4F48043': { + 'Type': 'AWS::CodeCommit::Repository', + 'Properties': { + 'RepositoryName': 'hello-cdk', + }, + }, + 'MyProjectRole9BBE5233': { + 'Type': 'AWS::IAM::Role', + 'Properties': { + 'AssumeRolePolicyDocument': { + 'Statement': [ + { + 'Action': 'sts:AssumeRole', + 'Effect': 'Allow', + 'Principal': { + 'Service': 'codebuild.amazonaws.com', + }, + }, + ], + 'Version': '2012-10-17', + }, + }, + }, + 'MyProjectRoleDefaultPolicyB19B7C29': { + 'Type': 'AWS::IAM::Policy', + 'Properties': { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': 'codecommit:GitPull', + 'Effect': 'Allow', + 'Resource': { + 'Fn::GetAtt': [ + 'MyRepoF4F48043', + 'Arn', + ], + }, + }, + { + 'Action': [ + 'logs:CreateLogGroup', + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + 'Effect': 'Allow', + 'Resource': [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':logs:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':log-group:/aws/codebuild/', + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':logs:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':log-group:/aws/codebuild/', + { + 'Ref': 'MyProject39F7B0AE', + }, + ':*', + ], + ], + }, + ], + }, + { + 'Action': [ + 'codebuild:CreateReportGroup', + 'codebuild:CreateReport', + 'codebuild:UpdateReport', + 'codebuild:BatchPutTestCases', + 'codebuild:BatchPutCodeCoverages', + ], + 'Effect': 'Allow', + 'Resource': { + 'Fn::Join': ['', [ + 'arn:', + { 'Ref': 'AWS::Partition' }, + ':codebuild:', + { 'Ref': 'AWS::Region' }, + ':', + { 'Ref': 'AWS::AccountId' }, + ':report-group/', + { 'Ref': 'MyProject39F7B0AE' }, + '-*', + ]], + }, + }, + ], + 'Version': '2012-10-17', + }, + 'PolicyName': 'MyProjectRoleDefaultPolicyB19B7C29', + 'Roles': [ + { + 'Ref': 'MyProjectRole9BBE5233', + }, + ], + }, + }, + 'MyProject39F7B0AE': { + 'Type': 'AWS::CodeBuild::Project', + 'Properties': { + 'Artifacts': { + 'Type': 'NO_ARTIFACTS', + }, + 'Environment': { + 'ComputeType': 'BUILD_GENERAL1_SMALL', + 'Image': 'aws/codebuild/standard:1.0', + 'ImagePullCredentialsType': 'CODEBUILD', + 'PrivilegedMode': false, + 'Type': 'LINUX_CONTAINER', + }, + 'ServiceRole': { + 'Fn::GetAtt': [ + 'MyProjectRole9BBE5233', + 'Arn', + ], + }, + 'Source': { + 'Location': { + 'Fn::GetAtt': [ + 'MyRepoF4F48043', + 'CloneUrlHttp', + ], + }, + 'GitCloneDepth': 2, + 'Type': 'CODECOMMIT', + }, + 'EncryptionKey': 'alias/aws/s3', + 'Cache': { + 'Type': 'NO_CACHE', + }, + }, + }, + }, + }); + }); + + test('with S3Bucket source', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'path/to/source.zip', + }), + environment: { + buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0, + }, + }); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'MyBucketF68F3FF0': { + 'Type': 'AWS::S3::Bucket', + 'DeletionPolicy': 'Retain', + 'UpdateReplacePolicy': 'Retain', + }, + 'MyProjectRole9BBE5233': { + 'Type': 'AWS::IAM::Role', + 'Properties': { + 'AssumeRolePolicyDocument': { + 'Statement': [ + { + 'Action': 'sts:AssumeRole', + 'Effect': 'Allow', + 'Principal': { + 'Service': 'codebuild.amazonaws.com', + }, + }, + ], + 'Version': '2012-10-17', + }, + }, + }, + 'MyProjectRoleDefaultPolicyB19B7C29': { + 'Type': 'AWS::IAM::Policy', + 'Properties': { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + 'Effect': 'Allow', + 'Resource': [ + { + 'Fn::GetAtt': [ + 'MyBucketF68F3FF0', + 'Arn', + ], + }, + { + 'Fn::Join': [ + '', + [ + { + 'Fn::GetAtt': [ + 'MyBucketF68F3FF0', + 'Arn', + ], + }, + '/path/to/source.zip', + ], + ], + }, + ], + }, + { + 'Action': [ + 'logs:CreateLogGroup', + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + 'Effect': 'Allow', + 'Resource': [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':logs:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':log-group:/aws/codebuild/', + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':logs:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':log-group:/aws/codebuild/', + { + 'Ref': 'MyProject39F7B0AE', + }, + ':*', + ], + ], + }, + ], + }, + { + 'Action': [ + 'codebuild:CreateReportGroup', + 'codebuild:CreateReport', + 'codebuild:UpdateReport', + 'codebuild:BatchPutTestCases', + 'codebuild:BatchPutCodeCoverages', + ], + 'Effect': 'Allow', + 'Resource': { + 'Fn::Join': ['', [ + 'arn:', + { 'Ref': 'AWS::Partition' }, + ':codebuild:', + { 'Ref': 'AWS::Region' }, + ':', + { 'Ref': 'AWS::AccountId' }, + ':report-group/', + { 'Ref': 'MyProject39F7B0AE' }, + '-*', + ]], + }, + }, + ], + 'Version': '2012-10-17', + }, + 'PolicyName': 'MyProjectRoleDefaultPolicyB19B7C29', + 'Roles': [ + { + 'Ref': 'MyProjectRole9BBE5233', + }, + ], + }, + }, + 'MyProject39F7B0AE': { + 'Type': 'AWS::CodeBuild::Project', + 'Properties': { + 'Artifacts': { + 'Type': 'NO_ARTIFACTS', + }, + 'Environment': { + 'ComputeType': 'BUILD_GENERAL1_MEDIUM', + 'Image': 'aws/codebuild/windows-base:2.0', + 'ImagePullCredentialsType': 'CODEBUILD', + 'PrivilegedMode': false, + 'Type': 'WINDOWS_CONTAINER', + }, + 'ServiceRole': { + 'Fn::GetAtt': [ + 'MyProjectRole9BBE5233', + 'Arn', + ], + }, + 'Source': { + 'Location': { + 'Fn::Join': [ + '', + [ + { + 'Ref': 'MyBucketF68F3FF0', + }, + '/path/to/source.zip', + ], + ], + }, + 'Type': 'S3', + }, + 'EncryptionKey': 'alias/aws/s3', + 'Cache': { + 'Type': 'NO_CACHE', + }, + }, + }, + }, + }); + }); + + test('with GitHub source', () => { + const stack = new cdk.Stack(); + + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.gitHub({ + owner: 'testowner', + repo: 'testrepo', + cloneDepth: 3, + fetchSubmodules: true, + webhook: true, + reportBuildStatus: false, + webhookFilters: [ + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH).andTagIsNot('stable'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_REOPENED).andBaseBranchIs('main'), + ], + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + Type: 'GITHUB', + Location: 'https://github.com/testowner/testrepo.git', + ReportBuildStatus: false, + GitCloneDepth: 3, + GitSubmodulesConfig: { + FetchSubmodules: true, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Triggers: { + Webhook: true, + FilterGroups: [ + [ + { Type: 'EVENT', Pattern: 'PUSH' }, + { Type: 'HEAD_REF', Pattern: 'refs/tags/stable', ExcludeMatchedPattern: true }, + ], + [ + { Type: 'EVENT', Pattern: 'PULL_REQUEST_REOPENED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], + ], + }, + }); + }); + + test('with GitHubEnterprise source', () => { + const stack = new cdk.Stack(); + + const pushFilterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH); + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.gitHubEnterprise({ + httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', + ignoreSslErrors: true, + cloneDepth: 4, + webhook: true, + reportBuildStatus: false, + webhookFilters: [ + pushFilterGroup.andBranchIs('main'), + pushFilterGroup.andBranchIs('develop'), + pushFilterGroup.andFilePathIs('ReadMe.md'), + ], + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + Type: 'GITHUB_ENTERPRISE', + InsecureSsl: true, + GitCloneDepth: 4, + ReportBuildStatus: false, + Location: 'https://github.testcompany.com/testowner/testrepo', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Triggers: { + Webhook: true, + FilterGroups: [ + [ + { Type: 'EVENT', Pattern: 'PUSH' }, + { Type: 'HEAD_REF', Pattern: 'refs/heads/main' }, + ], + [ + { Type: 'EVENT', Pattern: 'PUSH' }, + { Type: 'HEAD_REF', Pattern: 'refs/heads/develop' }, + ], + [ + { Type: 'EVENT', Pattern: 'PUSH' }, + { Type: 'FILE_PATH', Pattern: 'ReadMe.md' }, + ], + ], + }, + }); + }); + + test('with Bitbucket source', () => { + const stack = new cdk.Stack(); + + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.bitBucket({ + owner: 'testowner', + repo: 'testrepo', + cloneDepth: 5, + reportBuildStatus: false, + webhookFilters: [ + codebuild.FilterGroup.inEventOf( + codebuild.EventAction.PULL_REQUEST_CREATED, + codebuild.EventAction.PULL_REQUEST_UPDATED, + codebuild.EventAction.PULL_REQUEST_MERGED, + ).andTagIs('v.*'), + // duplicate event actions are fine + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PUSH).andActorAccountIsNot('aws-cdk-dev'), + ], + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + Type: 'BITBUCKET', + Location: 'https://bitbucket.org/testowner/testrepo.git', + GitCloneDepth: 5, + ReportBuildStatus: false, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Triggers: { + Webhook: true, + FilterGroups: [ + [ + { Type: 'EVENT', Pattern: 'PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_MERGED' }, + { Type: 'HEAD_REF', Pattern: 'refs/tags/v.*' }, + ], + [ + { Type: 'EVENT', Pattern: 'PUSH' }, + { Type: 'ACTOR_ACCOUNT_ID', Pattern: 'aws-cdk-dev', ExcludeMatchedPattern: true }, + ], + ], + }, + }); + }); + + test('with webhookTriggersBatchBuild option', () => { + const stack = new cdk.Stack(); + + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.gitHub({ + owner: 'testowner', + repo: 'testrepo', + webhook: true, + webhookTriggersBatchBuild: true, + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Triggers: { + Webhook: true, + BuildType: 'BUILD_BATCH', + }, + BuildBatchConfig: { + ServiceRole: { + 'Fn::GetAtt': [ + 'ProjectBatchServiceRoleF97A1CFB', + 'Arn', + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'codebuild.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'codebuild:StartBuild', + 'codebuild:StopBuild', + 'codebuild:RetryBuild', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'ProjectC78D97AD', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }, + }); + }); + + test('fail creating a Project when webhook false and webhookTriggersBatchBuild option', () => { + [false, undefined].forEach((webhook) => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.gitHub({ + owner: 'testowner', + repo: 'testrepo', + webhook, + webhookTriggersBatchBuild: true, + }), + }); + }).toThrow(/`webhookTriggersBatchBuild` cannot be used when `webhook` is `false`/); + }); + }); + + test('fail creating a Project when no build spec is given', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.Project(stack, 'MyProject', { + }); + }).toThrow(/buildSpec/); + }); + + test('with VPC configuration', () => { + const stack = new cdk.Stack(); + + const bucket = new s3.Bucket(stack, 'MyBucket'); + const vpc = new ec2.Vpc(stack, 'MyVPC'); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { + securityGroupName: 'Bob', + vpc, + allowAllOutbound: true, + description: 'Example', + }); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'path/to/source.zip', + }), + vpc, + securityGroups: [securityGroup], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'VpcConfig': { + 'SecurityGroupIds': [ + { + 'Fn::GetAtt': [ + 'SecurityGroup1F554B36F', + 'GroupId', + ], + }, + ], + 'Subnets': [ + { + 'Ref': 'MyVPCPrivateSubnet1Subnet641543F4', + }, + { + 'Ref': 'MyVPCPrivateSubnet2SubnetA420D3F0', + }, + ], + 'VpcId': { + 'Ref': 'MyVPCAFB07A31', + }, + }, + }); + + expect(project.connections).toBeDefined(); + }); + + test('without VPC configuration but security group identified', () => { + const stack = new cdk.Stack(); + + const bucket = new s3.Bucket(stack, 'MyBucket'); + const vpc = new ec2.Vpc(stack, 'MyVPC'); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { + securityGroupName: 'Bob', + vpc, + allowAllOutbound: true, + description: 'Example', + }); + + expect(() => + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'path/to/source.zip', + }), + securityGroups: [securityGroup], + }), + ).toThrow(/Cannot configure 'securityGroup' or 'allowAllOutbound' without configuring a VPC/); + }); + + test('with VPC configuration but allowAllOutbound identified', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const vpc = new ec2.Vpc(stack, 'MyVPC'); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup1', { + securityGroupName: 'Bob', + vpc, + allowAllOutbound: true, + description: 'Example', + }); + + expect(() => + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'path/to/source.zip', + }), + vpc, + allowAllOutbound: true, + securityGroups: [securityGroup], + }), + ).toThrow(/Configure 'allowAllOutbound' directly on the supplied SecurityGroup/); + }); + + test('without passing a VPC cannot access the connections property', () => { + const stack = new cdk.Stack(); + + const project = new codebuild.PipelineProject(stack, 'MyProject'); + + expect(() => project.connections).toThrow( + /Only VPC-associated Projects have security groups to manage. Supply the "vpc" parameter when creating the Project/); + }); + + test('no KMS Key defaults to default S3 managed key', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new codebuild.PipelineProject(stack, 'MyProject'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + EncryptionKey: 'alias/aws/s3', + }); + }); + + test('with a KMS Key adds decrypt permissions to the CodeBuild Role', () => { + const stack = new cdk.Stack(); + + const key = new kms.Key(stack, 'MyKey'); + + new codebuild.PipelineProject(stack, 'MyProject', { + encryptionKey: key, + grantReportGroupPermissions: false, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + 'Statement': [ + {}, // CloudWatch logs + { + 'Action': [ + 'kms:Decrypt', + 'kms:Encrypt', + 'kms:ReEncrypt*', + 'kms:GenerateDataKey*', + ], + 'Effect': 'Allow', + 'Resource': { + 'Fn::GetAtt': [ + 'MyKey6AB29FA6', + 'Arn', + ], + }, + }, + ], + }, + 'Roles': [ + { + 'Ref': 'MyProjectRole9BBE5233', + }, + ], + }); + }); +}); + +test('using timeout and path in S3 artifacts sets it correctly', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'Bucket'); + new codebuild.Project(stack, 'Project', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + artifacts: codebuild.Artifacts.s3({ + path: 'some/path', + name: 'some_name', + bucket, + }), + timeout: cdk.Duration.minutes(123), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Artifacts': { + 'Path': 'some/path', + 'Name': 'some_name', + 'Type': 'S3', + }, + 'TimeoutInMinutes': 123, + }); +}); + +describe('secondary sources', () => { + test('require providing an identifier when creating a Project', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + secondarySources: [ + codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'path', + }), + ], + }); + }).toThrow(/identifier/); + }); + + test('are not allowed for a Project with CodePipeline as Source', () => { + const stack = new cdk.Stack(); + const project = new codebuild.PipelineProject(stack, 'MyProject'); + + project.addSecondarySource(codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'some/path', + identifier: 'id', + })); + + expect(() => Template.fromStack(stack)).toThrow(/secondary sources/); + }); + + test('added with an identifer after the Project has been created are rendered in the template', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + }); + + project.addSecondarySource(codebuild.Source.s3({ + bucket, + path: 'another/path', + identifier: 'source1', + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'SecondarySources': [ + { + 'SourceIdentifier': 'source1', + 'Type': 'S3', + }, + ], + }); + }); +}); + +describe('sources with customised build status configuration', () => { + test('GitHub', () => { + const context = 'My custom CodeBuild worker!'; + const stack = new cdk.Stack(); + const source = codebuild.Source.gitHub({ + owner: 'awslabs', + repo: 'aws-cdk', + buildStatusContext: context, + }); + + new codebuild.Project(stack, 'MyProject', { source }); + Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { + Source: { + buildStatusConfig: { + context: context, + }, + }, + }); + }); + + test('GitHub Enterprise', () => { + const context = 'My custom CodeBuild worker!'; + const stack = new cdk.Stack(); + const source = codebuild.Source.gitHubEnterprise({ + httpsCloneUrl: 'url', + buildStatusContext: context, + }); + new codebuild.Project(stack, 'MyProject', { source }); + Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { + Source: { + buildStatusConfig: { + context: context, + }, + }, + }); + }); + + test('BitBucket', () => { + const context = 'My custom CodeBuild worker!'; + const stack = new cdk.Stack(); + const source = codebuild.Source.bitBucket({ owner: 'awslabs', repo: 'aws-cdk' }); + new codebuild.Project(stack, 'MyProject', { source }); + Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { + Source: { + buildStatusConfig: { + context: context, + }, + }, + }); + }); +}); + +describe('sources with customised build status configuration', () => { + test('GitHub with targetUrl', () => { + const targetUrl = 'https://example.com'; + const stack = new cdk.Stack(); + const source = codebuild.Source.gitHub({ + owner: 'awslabs', + repo: 'aws-cdk', + buildStatusUrl: targetUrl, + }); + new codebuild.Project(stack, 'MyProject', { source }); + Template.fromStack(stack).findParameters('AWS::CodeBuild::Project', { + Source: { + buildStatusConfig: { + targetUrl: targetUrl, + }, + }, + }); + }); +}); + +describe('secondary source versions', () => { + test('allow secondary source versions', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + }); + + project.addSecondarySource(codebuild.Source.s3({ + bucket, + path: 'another/path', + identifier: 'source1', + version: 'someversion', + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'SecondarySources': [ + { + 'SourceIdentifier': 'source1', + 'Type': 'S3', + }, + ], + 'SecondarySourceVersions': [ + { + 'SourceIdentifier': 'source1', + 'SourceVersion': 'someversion', + }, + ], + }); + }); + + test('allow not to specify secondary source versions', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + }); + + project.addSecondarySource(codebuild.Source.s3({ + bucket, + path: 'another/path', + identifier: 'source1', + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'SecondarySources': [ + { + 'SourceIdentifier': 'source1', + 'Type': 'S3', + }, + ], + }); + }); +}); + +describe('fileSystemLocations', () => { + test('create fileSystemLocation and validate attributes', () => { + const stack = new cdk.Stack(); + new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + fileSystemLocations: [codebuild.FileSystemLocation.efs({ + identifier: 'myidentifier2', + location: 'myclodation.mydnsroot.com:/loc', + mountPoint: '/media', + mountOptions: 'opts', + })], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'FileSystemLocations': [ + { + 'Identifier': 'myidentifier2', + 'MountPoint': '/media', + 'MountOptions': 'opts', + 'Location': 'myclodation.mydnsroot.com:/loc', + 'Type': 'EFS', + }, + ], + }); + }); + + test('Multiple fileSystemLocation created', () => { + const stack = new cdk.Stack(); + const project = new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + }); + project.addFileSystemLocation(codebuild.FileSystemLocation.efs({ + identifier: 'myidentifier3', + location: 'myclodation.mydnsroot.com:/loc', + mountPoint: '/media', + mountOptions: 'opts', + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'FileSystemLocations': [ + { + 'Identifier': 'myidentifier3', + 'MountPoint': '/media', + 'MountOptions': 'opts', + 'Location': 'myclodation.mydnsroot.com:/loc', + 'Type': 'EFS', + }, + ], + }); + }); +}); + +describe('secondary artifacts', () => { + test('require providing an identifier when creating a Project', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.Project(stack, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + }), + secondaryArtifacts: [ + codebuild.Artifacts.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'some/path', + name: 'name', + }), + ], + }); + }).toThrow(/identifier/); + }); + + test('are not allowed for a Project with CodePipeline as Source', () => { + const stack = new cdk.Stack(); + const project = new codebuild.PipelineProject(stack, 'MyProject'); + + project.addSecondaryArtifact(codebuild.Artifacts.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'some/path', + name: 'name', + identifier: 'id', + })); + + expect(() => Template.fromStack(stack)).toThrow(/secondary artifacts/); + }); + + test('added with an identifier after the Project has been created are rendered in the template', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + }); + + project.addSecondaryArtifact(codebuild.Artifacts.s3({ + bucket, + path: 'another/path', + name: 'name', + identifier: 'artifact1', + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'SecondaryArtifacts': [ + { + 'ArtifactIdentifier': 'artifact1', + 'Type': 'S3', + }, + ], + }); + }); + + test('disabledEncryption is set', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + }); + + project.addSecondaryArtifact(codebuild.Artifacts.s3({ + bucket, + path: 'another/path', + name: 'name', + identifier: 'artifact1', + encryption: false, + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'SecondaryArtifacts': [ + { + 'ArtifactIdentifier': 'artifact1', + 'EncryptionDisabled': true, + }, + ], + }); + }); +}); + +describe('artifacts', () => { + describe('CodePipeline', () => { + test('both source and artifacs are set to CodePipeline', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'MyProject'); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Source': { + 'Type': 'CODEPIPELINE', + }, + 'Artifacts': { + 'Type': 'CODEPIPELINE', + }, + 'ServiceRole': { + 'Fn::GetAtt': [ + 'MyProjectRole9BBE5233', + 'Arn', + ], + }, + 'Environment': { + 'Type': 'LINUX_CONTAINER', + 'PrivilegedMode': false, + 'Image': 'aws/codebuild/standard:1.0', + 'ImagePullCredentialsType': 'CODEBUILD', + 'ComputeType': 'BUILD_GENERAL1_SMALL', + }, + }); + }); + }); + + describe('S3', () => { + test('name is not set so use buildspec', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + artifacts: codebuild.Artifacts.s3({ + bucket, + path: 'another/path', + identifier: 'artifact1', + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Artifacts': { + 'Name': Match.absent(), + 'ArtifactIdentifier': 'artifact1', + 'OverrideArtifactName': true, + }, + }); + }); + + test('name is set so use it', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket, + path: 'some/path', + }), + artifacts: codebuild.Artifacts.s3({ + bucket, + path: 'another/path', + name: 'specificname', + identifier: 'artifact1', + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Artifacts': { + 'ArtifactIdentifier': 'artifact1', + 'Name': 'specificname', + 'OverrideArtifactName': Match.absent(), + }, + }); + }); + }); +}); + +test('events', () => { + const stack = new cdk.Stack(); + const project = new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'path', + }), + }); + + project.onBuildFailed('OnBuildFailed', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); + project.onBuildSucceeded('OnBuildSucceeded', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); + project.onPhaseChange('OnPhaseChange', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); + project.onStateChange('OnStateChange', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); + project.onBuildStarted('OnBuildStarted', { target: { bind: () => ({ arn: 'ARN', id: 'ID' }) } }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + 'EventPattern': { + 'source': [ + 'aws.codebuild', + ], + 'detail-type': [ + 'CodeBuild Build State Change', + ], + 'detail': { + 'project-name': [ + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + 'build-status': [ + 'FAILED', + ], + }, + }, + 'State': 'ENABLED', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + 'EventPattern': { + 'source': [ + 'aws.codebuild', + ], + 'detail-type': [ + 'CodeBuild Build State Change', + ], + 'detail': { + 'project-name': [ + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + 'build-status': [ + 'SUCCEEDED', + ], + }, + }, + 'State': 'ENABLED', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + 'EventPattern': { + 'source': [ + 'aws.codebuild', + ], + 'detail-type': [ + 'CodeBuild Build Phase Change', + ], + 'detail': { + 'project-name': [ + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + }, + }, + 'State': 'ENABLED', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + 'EventPattern': { + 'source': [ + 'aws.codebuild', + ], + 'detail-type': [ + 'CodeBuild Build State Change', + ], + 'detail': { + 'project-name': [ + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + }, + }, + 'State': 'ENABLED', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + 'EventPattern': { + 'source': [ + 'aws.codebuild', + ], + 'detail-type': [ + 'CodeBuild Build State Change', + ], + 'detail': { + 'project-name': [ + { + 'Ref': 'MyProject39F7B0AE', + }, + ], + 'build-status': [ + 'IN_PROGRESS', + ], + }, + }, + 'State': 'ENABLED', + }); +}); + +test('environment variables can be overridden at the project level', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'Project', { + environment: { + environmentVariables: { + FOO: { value: '1234' }, + BAR: { value: `111${cdk.Token.asString({ twotwotwo: '222' })}`, type: codebuild.BuildEnvironmentVariableType.PARAMETER_STORE }, + }, + }, + environmentVariables: { + GOO: { value: 'ABC' }, + FOO: { value: 'OVERRIDE!' }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Source': { + 'Type': 'CODEPIPELINE', + }, + 'Artifacts': { + 'Type': 'CODEPIPELINE', + }, + 'ServiceRole': { + 'Fn::GetAtt': [ + 'ProjectRole4CCB274E', + 'Arn', + ], + }, + 'Environment': { + 'Type': 'LINUX_CONTAINER', + 'EnvironmentVariables': [ + { + 'Type': 'PLAINTEXT', + 'Value': 'OVERRIDE!', + 'Name': 'FOO', + }, + { + 'Type': 'PARAMETER_STORE', + 'Value': { + 'Fn::Join': [ + '', + [ + '111', + { twotwotwo: '222' }, + ], + ], + }, + 'Name': 'BAR', + }, + { + 'Type': 'PLAINTEXT', + 'Value': 'ABC', + 'Name': 'GOO', + }, + ], + 'PrivilegedMode': false, + 'Image': 'aws/codebuild/standard:1.0', + 'ImagePullCredentialsType': 'CODEBUILD', + 'ComputeType': 'BUILD_GENERAL1_SMALL', + }, + }); +}); + +test('.metricXxx() methods can be used to obtain Metrics for CodeBuild projects', () => { + const stack = new cdk.Stack(); + + const project = new codebuild.Project(stack, 'MyBuildProject', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'path', + }), + }); + + const metricBuilds = project.metricBuilds(); + expect(metricBuilds.dimensions!.ProjectName).toEqual(project.projectName); + expect(metricBuilds.namespace).toEqual('AWS/CodeBuild'); + expect(metricBuilds.statistic).toEqual('Sum'); + expect(metricBuilds.metricName).toEqual('Builds'); + + const metricDuration = project.metricDuration({ label: 'hello' }); + + expect(metricDuration.metricName).toEqual('Duration'); + expect(metricDuration.label).toEqual('hello'); + + expect(project.metricFailedBuilds().metricName).toEqual('FailedBuilds'); + expect(project.metricSucceededBuilds().metricName).toEqual('SucceededBuilds'); +}); + +test('using ComputeType.Small with a Windows image fails validation', () => { + const stack = new cdk.Stack(); + const invalidEnvironment: codebuild.BuildEnvironment = { + buildImage: codebuild.WindowsBuildImage.WINDOWS_BASE_2_0, + computeType: codebuild.ComputeType.SMALL, + }; + + expect(() => { + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'MyBucket'), + path: 'path', + }), + environment: invalidEnvironment, + }); + }).toThrow(/Windows images do not support the Small ComputeType/); +}); + +test('fromCodebuildImage', () => { + const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.fromCodeBuildImageId('aws/codebuild/standard:4.0'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Image': 'aws/codebuild/standard:4.0', + }, + }); +}); + +describe('Windows2019 image', () => { + describe('WIN_SERVER_CORE_2016_BASE', () => { + test('has type WINDOWS_SERVER_2019_CONTAINER and default ComputeType MEDIUM', () => { + const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.WindowsBuildImage.WIN_SERVER_CORE_2019_BASE, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'WINDOWS_SERVER_2019_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_MEDIUM', + }, + }); + }); + }); +}); + +describe('ARM image', () => { + describe('AMAZON_LINUX_2_ARM', () => { + test('has type ARM_CONTAINER and default ComputeType LARGE', () => { + const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'ARM_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_LARGE', + }, + }); + }); + + test('can be used with ComputeType SMALL', () => { + const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + computeType: codebuild.ComputeType.SMALL, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'ARM_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_SMALL', + }, + }); + }); + + test('cannot be used in conjunction with ComputeType MEDIUM', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + computeType: codebuild.ComputeType.MEDIUM, + }, + }); + }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/); + }); + + test('can be used with ComputeType LARGE', () => { + const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + computeType: codebuild.ComputeType.LARGE, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'ARM_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_LARGE', + }, + }); + }); + + test('cannot be used in conjunction with ComputeType X2_LARGE', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + computeType: codebuild.ComputeType.X2_LARGE, + }, + }); + }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/); + }); + }); +}); + +test('badge support test', () => { + const stack = new cdk.Stack(); + + interface BadgeValidationTestCase { + source: codebuild.Source, + allowsBadge: boolean + } + + const repo = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'hello-cdk', + }); + const bucket = new s3.Bucket(stack, 'MyBucket'); + + const cases: BadgeValidationTestCase[] = [ + { source: new NoSource(), allowsBadge: false }, + { source: new CodePipelineSource(), allowsBadge: false }, + { source: codebuild.Source.codeCommit({ repository: repo }), allowsBadge: true }, + { source: codebuild.Source.s3({ bucket, path: 'path/to/source.zip' }), allowsBadge: false }, + { source: codebuild.Source.gitHub({ owner: 'awslabs', repo: 'aws-cdk' }), allowsBadge: true }, + { source: codebuild.Source.gitHubEnterprise({ httpsCloneUrl: 'url' }), allowsBadge: true }, + { source: codebuild.Source.bitBucket({ owner: 'awslabs', repo: 'aws-cdk' }), allowsBadge: true }, + ]; + + cases.forEach(testCase => { + const source = testCase.source; + const validationBlock = () => { new codebuild.Project(stack, `MyProject-${source.type}`, { source, badge: true }); }; + if (testCase.allowsBadge) { + expect(validationBlock).not.toThrow(); + } else { + expect(validationBlock).toThrow(/Badge is not supported for source type /); + } + }); +}); + +describe('webhook Filters', () => { + test('a Group cannot be created with an empty set of event actions', () => { + expect(() => { + codebuild.FilterGroup.inEventOf(); + }).toThrow(/A filter group must contain at least one event action/); + }); + + test('cannot have base ref conditions if the Group contains the PUSH action', () => { + const filterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_CREATED, + codebuild.EventAction.PUSH); + + expect(() => { + filterGroup.andBaseRefIs('.*'); + }).toThrow(/A base reference condition cannot be added if a Group contains a PUSH event action/); + }); + + test('cannot be used when webhook is false', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.bitBucket({ + owner: 'owner', + repo: 'repo', + webhook: false, + webhookFilters: [ + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH), + ], + }), + }); + }).toThrow(/`webhookFilters` cannot be used when `webhook` is `false`/); + }); + + test('can have FILE_PATH filters if the Group contains PUSH and PR_CREATED events', () => { + codebuild.FilterGroup.inEventOf( + codebuild.EventAction.PULL_REQUEST_CREATED, + codebuild.EventAction.PUSH) + .andFilePathIsNot('.*\\.java'); + }); + + test('BitBucket sources do not support the PULL_REQUEST_REOPENED event action', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.bitBucket({ + owner: 'owner', + repo: 'repo', + webhookFilters: [ + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_REOPENED), + ], + }), + }); + }).toThrow(/BitBucket sources do not support the PULL_REQUEST_REOPENED webhook event action/); + }); + + test('BitBucket sources support file path conditions', () => { + const stack = new cdk.Stack(); + const filterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH).andFilePathIs('.*'); + + expect(() => { + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.bitBucket({ + owner: 'owner', + repo: 'repo', + webhookFilters: [filterGroup], + }), + }); + }).not.toThrow(); + }); + + test('GitHub Enterprise Server sources do not support FILE_PATH filters on PR events', () => { + const stack = new cdk.Stack(); + const pullFilterGroup = codebuild.FilterGroup.inEventOf( + codebuild.EventAction.PULL_REQUEST_CREATED, + codebuild.EventAction.PULL_REQUEST_MERGED, + codebuild.EventAction.PULL_REQUEST_REOPENED, + codebuild.EventAction.PULL_REQUEST_UPDATED, + ); + + expect(() => { + new codebuild.Project(stack, 'MyFilePathProject', { + source: codebuild.Source.gitHubEnterprise({ + httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', + webhookFilters: [ + pullFilterGroup.andFilePathIs('ReadMe.md'), + ], + }), + }); + }).toThrow(/FILE_PATH filters cannot be used with GitHub Enterprise Server pull request events/); + }); + + describe('COMMIT_MESSAGE Filter', () => { + test('GitHub Enterprise Server sources do not support COMMIT_MESSAGE filters on PR events', () => { + const stack = new cdk.Stack(); + const pullFilterGroup = codebuild.FilterGroup.inEventOf( + codebuild.EventAction.PULL_REQUEST_CREATED, + codebuild.EventAction.PULL_REQUEST_MERGED, + codebuild.EventAction.PULL_REQUEST_REOPENED, + codebuild.EventAction.PULL_REQUEST_UPDATED, + ); + + expect(() => { + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.gitHubEnterprise({ + httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', + webhookFilters: [ + pullFilterGroup.andCommitMessageIs('the commit message'), + ], + }), + }); + }).toThrow(/COMMIT_MESSAGE filters cannot be used with GitHub Enterprise Server pull request events/); + }); + + test('GitHub Enterprise Server sources support COMMIT_MESSAGE filters on PUSH events', () => { + const stack = new cdk.Stack(); + const pushFilterGroup = codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH); + + expect(() => { + new codebuild.Project(stack, 'MyProject', { + source: codebuild.Source.gitHubEnterprise({ + httpsCloneUrl: 'https://github.testcompany.com/testowner/testrepo', + webhookFilters: [ + pushFilterGroup.andCommitMessageIs('the commit message'), + ], + }), + }); + }).not.toThrow(); + }); + + test('BitBucket and GitHub sources support a COMMIT_MESSAGE filter', () => { + const stack = new cdk.Stack(); + const filterGroup = codebuild + .FilterGroup + .inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PULL_REQUEST_CREATED) + .andCommitMessageIs('the commit message'); + + expect(() => { + new codebuild.Project(stack, 'BitBucket Project', { + source: codebuild.Source.bitBucket({ + owner: 'owner', + repo: 'repo', + webhookFilters: [filterGroup], + }), + }); + new codebuild.Project(stack, 'GitHub Project', { + source: codebuild.Source.gitHub({ + owner: 'owner', + repo: 'repo', + webhookFilters: [filterGroup], + }), + }); + }).not.toThrow(); + }); + }); +}); + +test('enableBatchBuilds()', () => { + const stack = new cdk.Stack(); + + const project = new codebuild.Project(stack, 'Project', { + source: codebuild.Source.gitHub({ + owner: 'testowner', + repo: 'testrepo', + }), + }); + + const returnVal = project.enableBatchBuilds(); + if (!returnVal?.role) { + throw new Error('Expecting return value with role'); + } + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + BuildBatchConfig: { + ServiceRole: { + 'Fn::GetAtt': [ + 'ProjectBatchServiceRoleF97A1CFB', + 'Arn', + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'codebuild.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'codebuild:StartBuild', + 'codebuild:StopBuild', + 'codebuild:RetryBuild', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'ProjectC78D97AD', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }, + }); +}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/batchjob-image/Dockerfile b/packages/aws-cdk-lib/aws-codebuild/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/batchjob-image/Dockerfile rename to packages/aws-cdk-lib/aws-codebuild/test/demo-image/Dockerfile diff --git a/packages/aws-cdk-lib/aws-codebuild/test/demo-image/index.py b/packages/aws-cdk-lib/aws-codebuild/test/demo-image/index.py new file mode 100644 index 0000000000000..25d040434dab1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/demo-image/index.py @@ -0,0 +1,2 @@ +#!/usr/bin/python +print("Hello world from the built image") diff --git a/packages/aws-cdk-lib/aws-codebuild/test/integ.defaults.lit.ts b/packages/aws-cdk-lib/aws-codebuild/test/integ.defaults.lit.ts new file mode 100644 index 0000000000000..e0d60a27296c9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/integ.defaults.lit.ts @@ -0,0 +1,29 @@ +import * as cdk from '../../core'; +import * as codebuild from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + /// !show + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'echo "Hello, CodeBuild!"', + ], + }, + }, + }), + }); + /// !hide + } +} + +const app = new cdk.App(); + +new TestStack(app, 'codebuild-default-project'); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-codebuild/test/integ.docker-asset.lit.ts b/packages/aws-cdk-lib/aws-codebuild/test/integ.docker-asset.lit.ts new file mode 100644 index 0000000000000..47cad555b56df --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/integ.docker-asset.lit.ts @@ -0,0 +1,34 @@ +import * as path from 'path'; +import * as cdk from '../../core'; +import * as codebuild from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'MyImage', { + directory: path.join(__dirname, 'demo-image'), + }), + }, + /// !hide + }); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'test-codebuild-docker-asset'); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-codebuild/test/integ.docker-registry.lit.ts b/packages/aws-cdk-lib/aws-codebuild/test/integ.docker-registry.lit.ts new file mode 100644 index 0000000000000..581421ca7744f --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/integ.docker-registry.lit.ts @@ -0,0 +1,37 @@ +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; +import * as codebuild from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const secrets = secretsmanager.Secret.fromSecretCompleteArn(this, 'MySecrets', + `arn:aws:secretsmanager:${this.region}:${this.account}:secret:my-secrets-123456`); + + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromDockerRegistry('my-registry/my-repo', { + secretsManagerCredentials: secrets, + }), + }, + /// !hide + }); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'test-codebuild-docker-asset'); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-codebuild/test/integ.ecr.lit.ts b/packages/aws-cdk-lib/aws-codebuild/test/integ.ecr.lit.ts new file mode 100644 index 0000000000000..ddf49983193ab --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/integ.ecr.lit.ts @@ -0,0 +1,34 @@ +import * as ecr from '../../aws-ecr'; +import * as cdk from '../../core'; +import * as codebuild from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const ecrRepository = new ecr.Repository(this, 'MyRepo'); + + new codebuild.Project(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: ['ls'], + }, + }, + }), + grantReportGroupPermissions: false, + /// !show + environment: { + buildImage: codebuild.LinuxBuildImage.fromEcrRepository(ecrRepository, 'v1.0'), + }, + /// !hide + }); + } +} + +const app = new cdk.App(); + +new TestStack(app, 'test-codebuild-docker-asset'); + +app.synth(); diff --git a/packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts rename to packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts index 389fbc0529b22..75d99981be0b2 100644 --- a/packages/@aws-cdk/aws-codebuild/test/linux-arm-build-image.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ecr from '../../aws-ecr'; +import * as cdk from '../../core'; import * as codebuild from '../lib'; describe('Linux ARM build image', () => { diff --git a/packages/@aws-cdk/aws-codebuild/test/linux-gpu-build-image.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/linux-gpu-build-image.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codebuild/test/linux-gpu-build-image.test.ts rename to packages/aws-cdk-lib/aws-codebuild/test/linux-gpu-build-image.test.ts index 106836acdac21..f1fdada6c68e5 100644 --- a/packages/@aws-cdk/aws-codebuild/test/linux-gpu-build-image.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/linux-gpu-build-image.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ecr from '../../aws-ecr'; +import * as cdk from '../../core'; import * as codebuild from '../lib'; describe('Linux GPU build image', () => { diff --git a/packages/aws-cdk-lib/aws-codebuild/test/notification-rule.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/notification-rule.test.ts new file mode 100644 index 0000000000000..99ac65a425e6a --- /dev/null +++ b/packages/aws-cdk-lib/aws-codebuild/test/notification-rule.test.ts @@ -0,0 +1,70 @@ +import { Template } from '../../assertions'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; +import * as codebuild from '../lib'; + +test('notifications rule', () => { + const stack = new cdk.Stack(); + const project = new codebuild.Project(stack, 'MyCodebuildProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'echo "Hello, CodeBuild!"', + ], + }, + }, + }), + }); + + const target = new sns.Topic(stack, 'MyTopic'); + + project.notifyOnBuildSucceeded('NotifyOnBuildSucceeded', target); + + project.notifyOnBuildFailed('NotifyOnBuildFailed', target); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyCodebuildProjectNotifyOnBuildSucceeded77719592', + DetailType: 'FULL', + EventTypeIds: [ + 'codebuild-project-build-state-succeeded', + ], + Resource: { + 'Fn::GetAtt': [ + 'MyCodebuildProjectB0479580', + 'Arn', + ], + }, + Targets: [ + { + TargetAddress: { + Ref: 'MyTopic86869434', + }, + TargetType: 'SNS', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyCodebuildProjectNotifyOnBuildFailedF680E310', + DetailType: 'FULL', + EventTypeIds: [ + 'codebuild-project-build-state-failed', + ], + Resource: { + 'Fn::GetAtt': [ + 'MyCodebuildProjectB0479580', + 'Arn', + ], + }, + Targets: [ + { + TargetAddress: { + Ref: 'MyTopic86869434', + }, + TargetType: 'SNS', + }, + ], + }); +}); diff --git a/packages/@aws-cdk/aws-codebuild/test/project.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/project.test.ts similarity index 99% rename from packages/@aws-cdk/aws-codebuild/test/project.test.ts rename to packages/aws-cdk-lib/aws-codebuild/test/project.test.ts index 1ca53200c3bd4..ac5892d59a41b 100644 --- a/packages/@aws-cdk/aws-codebuild/test/project.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/project.test.ts @@ -1,10 +1,10 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; import * as codebuild from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codebuild/test/report-group.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/report-group.test.ts similarity index 96% rename from packages/@aws-cdk/aws-codebuild/test/report-group.test.ts rename to packages/aws-cdk-lib/aws-codebuild/test/report-group.test.ts index 24d8005af64a4..fefa664e9ba6a 100644 --- a/packages/@aws-cdk/aws-codebuild/test/report-group.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/report-group.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; import * as codebuild from '../lib'; import { ReportGroupType } from '../lib'; diff --git a/packages/@aws-cdk/aws-codebuild/test/script_bundle/build.sh b/packages/aws-cdk-lib/aws-codebuild/test/script_bundle/build.sh similarity index 100% rename from packages/@aws-cdk/aws-codebuild/test/script_bundle/build.sh rename to packages/aws-cdk-lib/aws-codebuild/test/script_bundle/build.sh diff --git a/packages/@aws-cdk/aws-codebuild/test/untrusted-code-boundary.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/untrusted-code-boundary.test.ts similarity index 90% rename from packages/@aws-cdk/aws-codebuild/test/untrusted-code-boundary.test.ts rename to packages/aws-cdk-lib/aws-codebuild/test/untrusted-code-boundary.test.ts index af1f4fdfb328f..526bf5d39c89d 100644 --- a/packages/@aws-cdk/aws-codebuild/test/untrusted-code-boundary.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/untrusted-code-boundary.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as codebuild from '../lib'; test('can attach permissions boundary to Project', () => { diff --git a/packages/aws-cdk-lib/aws-codecommit/.jsiirc.json b/packages/aws-cdk-lib/aws-codecommit/.jsiirc.json new file mode 100644 index 0000000000000..4dff5c2723d23 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.codecommit" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeCommit" + }, + "python": { + "module": "aws_cdk.aws_codecommit" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codecommit/README.md b/packages/aws-cdk-lib/aws-codecommit/README.md new file mode 100644 index 0000000000000..302b47cee79df --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/README.md @@ -0,0 +1,85 @@ +# AWS CodeCommit Construct Library + + +AWS CodeCommit is a version control service that enables you to privately store and manage Git repositories in the AWS cloud. + +For further information on CodeCommit, +see the [AWS CodeCommit documentation](https://docs.aws.amazon.com/codecommit). + +To add a CodeCommit Repository to your stack: + +```ts +const repo = new codecommit.Repository(this, 'Repository', { + repositoryName: 'MyRepositoryName', + description: 'Some description.', // optional property +}); +``` + +Use the `repositoryCloneUrlHttp`, `repositoryCloneUrlSsh` or `repositoryCloneUrlGrc` +property to clone your repository. + +To add an Amazon SNS trigger to your repository: + +```ts +declare const repo: codecommit.Repository; + +// trigger is established for all repository actions on all branches by default. +repo.notify('arn:aws:sns:*:123456789012:my_topic'); +``` + +## Add initial commit + +It is possible to initialize the Repository via the `Code` class. +It provides methods for loading code from a directory, `.zip` file and from a pre-created CDK Asset. + +Example: + +```ts +const repo = new codecommit.Repository(this, 'Repository', { + repositoryName: 'MyRepositoryName', + code: codecommit.Code.fromDirectory(path.join(__dirname, 'directory/'), 'develop'), // optional property, branch parameter can be omitted +}); +``` + +## Events + +CodeCommit repositories emit Amazon CloudWatch events for certain activities. +Use the `repo.onXxx` methods to define rules that trigger on these events +and invoke targets as a result: + +```ts +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +declare const repo: codecommit.Repository; +declare const project: codebuild.PipelineProject; +declare const myTopic: sns.Topic; + +// starts a CodeBuild project when a commit is pushed to the "main" branch of the repo +repo.onCommit('CommitToMain', { + target: new targets.CodeBuildProject(project), + branches: ['main'], +}); + +// publishes a message to an Amazon SNS topic when a comment is made on a pull request +const rule = repo.onCommentOnPullRequest('CommentOnPullRequest', { + target: new targets.SnsTopic(myTopic), +}); +``` + +## CodeStar Notifications + +To define CodeStar Notification rules for Repositories, use one of the `notifyOnXxx()` methods. +They are very similar to `onXxx()` methods for CloudWatch events: + +```ts +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; + +declare const repository: codecommit.Repository; +const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', + slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', + slackChannelId: 'YOUR_SLACK_CHANNEL_ID', +}); +const rule = repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); +``` diff --git a/packages/aws-cdk-lib/aws-codecommit/index.ts b/packages/aws-cdk-lib/aws-codecommit/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codecommit/lib/code.ts b/packages/aws-cdk-lib/aws-codecommit/lib/code.ts new file mode 100644 index 0000000000000..d428dca123027 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/lib/code.ts @@ -0,0 +1,104 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as assets from '../../aws-s3-assets'; +import { Construct } from 'constructs'; +import { CfnRepository } from './codecommit.generated'; + +/** + * Represents the structure to pass into the underlying CfnRepository class. + */ +export interface CodeConfig { + /** + * represents the underlying code structure + */ + readonly code: CfnRepository.CodeProperty; +} + +/** + * Represents the contents to initialize the repository with. + */ +export abstract class Code { + /** + * Code from directory. + * @param directoryPath the path to the local directory containing the contents to initialize the repository with + * @param branch the name of the branch to create in the repository. Default is "main" + */ + public static fromDirectory(directoryPath: string, branch?: string): Code { + const resolvedPath = path.resolve(directoryPath); + + const statResult = fs.statSync(resolvedPath); + if (!statResult || !statResult.isDirectory()) { + throw new Error(`'${directoryPath}' needs to be a path to a directory (resolved to: '${resolvedPath }')`); + } + + return new PathResolvedCode(resolvedPath, branch); + } + + /** + * Code from preexisting ZIP file. + * @param filePath the path to the local ZIP file containing the contents to initialize the repository with + * @param branch the name of the branch to create in the repository. Default is "main" + */ + public static fromZipFile(filePath: string, branch?: string): Code { + const resolvedPath = path.resolve(filePath); + + const statResult = fs.statSync(resolvedPath); + if (!statResult || !statResult.isFile()) { + throw new Error(`'${filePath}' needs to be a path to a ZIP file (resolved to: '${resolvedPath }')`); + } + + return new PathResolvedCode(resolvedPath, branch); + } + + /** + * Code from user-supplied asset. + * @param asset pre-existing asset + * @param branch the name of the branch to create in the repository. Default is "main" + */ + public static fromAsset(asset: assets.Asset, branch?: string): Code { + return new AssetCode(asset, branch); + } + + /** + * This method is called after a repository is passed this instance of Code in its 'code' property. + * + * @param scope the binding scope + */ + public abstract bind(scope: Construct): CodeConfig; +} + +class PathResolvedCode extends Code { + constructor(private readonly resolvedPath: string, private readonly branch?: string) { + super(); + } + + public bind(scope: Construct): CodeConfig { + const asset = new assets.Asset(scope, 'PathResolvedCodeAsset', { + path: this.resolvedPath, + }); + + return (new AssetCode(asset, this.branch)).bind(scope); + } +} + +class AssetCode extends Code { + constructor(private readonly asset: assets.Asset, private readonly branch?: string) { + super(); + } + + public bind(_scope: Construct): CodeConfig { + if (!this.asset.isZipArchive) { + throw new Error('Asset must be a .zip file or a directory (resolved to: ' + this.asset.assetPath + ' )'); + } + + return { + code: { + branchName: this.branch, + s3: { + bucket: this.asset.s3BucketName, + key: this.asset.s3ObjectKey, + }, + }, + }; + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codecommit/lib/events.ts b/packages/aws-cdk-lib/aws-codecommit/lib/events.ts new file mode 100644 index 0000000000000..03589093dc090 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/lib/events.ts @@ -0,0 +1,66 @@ +import * as events from '../../aws-events'; + +/** + * Fields of CloudWatch Events that change references + * + * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/EventTypes.html#codebuild_event_type + */ +export class ReferenceEvent { + /** + * The type of reference event + * + * 'referenceCreated', 'referenceUpdated' or 'referenceDeleted' + */ + public static get eventType() { + return events.EventField.fromPath('$.detail.event'); + } + + /** + * Name of the CodeCommit repository + */ + public static get repositoryName() { + return events.EventField.fromPath('$.detail.repositoryName'); + } + + /** + * Id of the CodeCommit repository + */ + public static get repositoryId() { + return events.EventField.fromPath('$.detail.repositoryId'); + } + + /** + * Type of reference changed + * + * 'branch' or 'tag' + */ + public static get referenceType() { + return events.EventField.fromPath('$.detail.referenceType'); + } + + /** + * Name of reference changed (branch or tag name) + */ + public static get referenceName() { + return events.EventField.fromPath('$.detail.referenceName'); + } + + /** + * Full reference name + * + * For example, 'refs/tags/myTag' + */ + public static get referenceFullName() { + return events.EventField.fromPath('$.detail.referenceFullName'); + } + + /** + * Commit id this reference now points to + */ + public static get commitId() { + return events.EventField.fromPath('$.detail.commitId'); + } + + private constructor() { + } +} diff --git a/packages/@aws-cdk/aws-codecommit/lib/index.ts b/packages/aws-cdk-lib/aws-codecommit/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codecommit/lib/index.ts rename to packages/aws-cdk-lib/aws-codecommit/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-codecommit/lib/repository.ts b/packages/aws-cdk-lib/aws-codecommit/lib/repository.ts new file mode 100644 index 0000000000000..53b36ea686d20 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/lib/repository.ts @@ -0,0 +1,723 @@ +import * as notifications from '../../aws-codestarnotifications'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import { ArnFormat, IResource, Lazy, Resource, Stack } from '../../core'; +import { Construct } from 'constructs'; +import { Code } from './code'; +import { CfnRepository } from './codecommit.generated'; + +/** + * Additional options to pass to the notification rule. + */ +export interface RepositoryNotifyOnOptions extends notifications.NotificationRuleOptions { + /** + * A list of event types associated with this notification rule for CodeCommit repositories. + * For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide. + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api + */ + readonly events: RepositoryNotificationEvents[]; +} + +export interface IRepository extends IResource, notifications.INotificationRuleSource { + /** + * The ARN of this Repository. + * @attribute + */ + readonly repositoryArn: string; + + /** + * The human-visible name of this Repository. + * @attribute + */ + readonly repositoryName: string; + + /** + * The HTTP clone URL. + * @attribute + */ + readonly repositoryCloneUrlHttp: string; + + /** + * The SSH clone URL. + * @attribute + */ + readonly repositoryCloneUrlSsh: string; + + /** + * The HTTPS (GRC) clone URL. + * + * HTTPS (GRC) is the protocol to use with git-remote-codecommit (GRC). + * + * It is the recommended method for supporting connections made with federated + * access, identity providers, and temporary credentials. + * + * @see https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-git-remote-codecommit.html + */ + readonly repositoryCloneUrlGrc: string; + + /** + * Defines a CloudWatch event rule which triggers for repository events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + onEvent(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a "CodeCommit + * Repository State Change" event occurs. + */ + onStateChange(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a reference is + * created (i.e. a new branch/tag is created) to the repository. + */ + onReferenceCreated(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a reference is + * updated (i.e. a commit is pushed to an existing or new branch) from the repository. + */ + onReferenceUpdated(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a reference is + * delete (i.e. a branch/tag is deleted) from the repository. + */ + onReferenceDeleted(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a pull request state is changed. + */ + onPullRequestStateChange(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a comment is made on a pull request. + */ + onCommentOnPullRequest(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a comment is made on a commit. + */ + onCommentOnCommit(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers when a commit is pushed to a branch. + */ + onCommit(id: string, options?: OnCommitOptions): events.Rule; + + /** + * Grant the given principal identity permissions to perform the actions on this repository. + */ + grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant; + + /** + * Grant the given identity permissions to pull this repository. + */ + grantPull(grantee: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity permissions to pull and push this repository. + */ + grantPullPush(grantee: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity permissions to read this repository. + */ + grantRead(grantee: iam.IGrantable): iam.Grant; + + /** + * Defines a CodeStar Notification rule triggered when the project + * events specified by you are emitted. Similar to `onEvent` API. + * + * You can also use the methods to define rules for the specific event emitted. + * eg: `notifyOnPullRequstCreated`. + * + * @returns CodeStar Notifications rule associated with this repository. + */ + notifyOn( + id: string, + target: notifications.INotificationRuleTarget, + options: RepositoryNotifyOnOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when a comment is made on a pull request. + */ + notifyOnPullRequestComment( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when an approval status is changed. + */ + notifyOnApprovalStatusChanged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when an approval rule is overridden. + */ + notifyOnApprovalRuleOverridden( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when a pull request is created. + */ + notifyOnPullRequestCreated( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when a pull request is merged. + * @deprecated this method has a typo in its name, use notifyOnPullRequestMerged instead + */ + notifiyOnPullRequestMerged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when a pull request is merged. + */ + notifyOnPullRequestMerged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when a new branch or tag is created. + */ + notifyOnBranchOrTagCreated( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Defines a CodeStar Notification rule which triggers when a branch or tag is deleted. + */ + notifyOnBranchOrTagDeleted( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; +} + +/** + * Options for the onCommit() method. + */ +export interface OnCommitOptions extends events.OnEventOptions { + /** + * The branch to monitor. + * + * @default - All branches + */ + readonly branches?: string[]; +} + +/** + * Represents a reference to a CodeCommit Repository. + * + * If you want to create a new Repository managed alongside your CDK code, + * use the `Repository` class. + * + * If you want to reference an already existing Repository, + * use the `Repository.import` method. + */ +abstract class RepositoryBase extends Resource implements IRepository { + /** The ARN of this Repository. */ + public abstract readonly repositoryArn: string; + + /** The human-visible name of this Repository. */ + public abstract readonly repositoryName: string; + + /** The HTTP clone URL */ + public abstract readonly repositoryCloneUrlHttp: string; + + /** The SSH clone URL */ + public abstract readonly repositoryCloneUrlSsh: string; + + public abstract readonly repositoryCloneUrlGrc: string; + + /** + * Defines a CloudWatch event rule which triggers for repository events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + public onEvent(id: string, options: events.OnEventOptions = {}) { + const rule = new events.Rule(this, id, options); + rule.addEventPattern({ + source: ['aws.codecommit'], + resources: [this.repositoryArn], + }); + rule.addTarget(options.target); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a "CodeCommit + * Repository State Change" event occurs. + */ + public onStateChange(id: string, options: events.OnEventOptions = {}) { + const rule = this.onEvent(id, options); + rule.addEventPattern({ + detailType: ['CodeCommit Repository State Change'], + }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a reference is + * created (i.e. a new branch/tag is created) to the repository. + */ + public onReferenceCreated(id: string, options: events.OnEventOptions = {}) { + const rule = this.onStateChange(id, options); + rule.addEventPattern({ detail: { event: ['referenceCreated'] } }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a reference is + * updated (i.e. a commit is pushed to an existing or new branch) from the repository. + */ + public onReferenceUpdated(id: string, options: events.OnEventOptions = {}) { + const rule = this.onStateChange(id, options); + rule.addEventPattern({ detail: { event: ['referenceCreated', 'referenceUpdated'] } }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a reference is + * delete (i.e. a branch/tag is deleted) from the repository. + */ + public onReferenceDeleted(id: string, options: events.OnEventOptions = {}) { + const rule = this.onStateChange(id, options); + rule.addEventPattern({ detail: { event: ['referenceDeleted'] } }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a pull request state is changed. + */ + public onPullRequestStateChange(id: string, options: events.OnEventOptions = {}) { + const rule = this.onEvent(id, options); + rule.addEventPattern({ detailType: ['CodeCommit Pull Request State Change'] }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a comment is made on a pull request. + */ + public onCommentOnPullRequest(id: string, options: events.OnEventOptions = {}) { + const rule = this.onEvent(id, options); + rule.addEventPattern({ detailType: ['CodeCommit Comment on Pull Request'] }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a comment is made on a commit. + */ + public onCommentOnCommit(id: string, options: events.OnEventOptions = {}) { + const rule = this.onEvent(id, options); + rule.addEventPattern({ detailType: ['CodeCommit Comment on Commit'] }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers when a commit is pushed to a branch. + */ + public onCommit(id: string, options: OnCommitOptions = {}) { + const rule = this.onReferenceUpdated(id, options); + if (options.branches) { + rule.addEventPattern({ detail: { referenceName: options.branches } }); + } + return rule; + } + + public grant(grantee: iam.IGrantable, ...actions: string[]) { + return iam.Grant.addToPrincipal({ + grantee, + actions, + resourceArns: [this.repositoryArn], + }); + } + + public grantPull(grantee: iam.IGrantable) { + return this.grant(grantee, 'codecommit:GitPull'); + } + + public grantPullPush(grantee: iam.IGrantable) { + this.grantPull(grantee); + return this.grant(grantee, 'codecommit:GitPush'); + } + + public grantRead(grantee: iam.IGrantable) { + this.grantPull(grantee); + return this.grant(grantee, + 'codecommit:EvaluatePullRequestApprovalRules', + 'codecommit:Get*', + 'codecommit:Describe*', + ); + } + + public notifyOn( + id: string, + target: notifications.INotificationRuleTarget, + options: RepositoryNotifyOnOptions, + ): notifications.INotificationRule { + return new notifications.NotificationRule(this, id, { + ...options, + source: this, + targets: [target], + }); + } + + public notifyOnPullRequestComment( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.PULL_REQUEST_COMMENT], + }); + } + + public notifyOnApprovalStatusChanged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.APPROVAL_STATUS_CHANGED], + }); + } + + public notifyOnApprovalRuleOverridden( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.APPROVAL_RULE_OVERRIDDEN], + }); + } + + public notifyOnPullRequestCreated( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.PULL_REQUEST_CREATED], + }); + } + + public notifiyOnPullRequestMerged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOnPullRequestMerged(id, target, options); + } + + public notifyOnPullRequestMerged( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.PULL_REQUEST_MERGED], + }); + } + + public notifyOnBranchOrTagCreated( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.BRANCH_OR_TAG_CREATED], + }); + } + + public notifyOnBranchOrTagDeleted( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [RepositoryNotificationEvents.BRANCH_OR_TAG_DELETED], + }); + } + + public bindAsNotificationRuleSource(_scope: Construct): notifications.NotificationRuleSourceConfig { + return { + sourceArn: this.repositoryArn, + }; + } +} + +export interface RepositoryProps { + /** + * Name of the repository. + * + * This property is required for all CodeCommit repositories. + */ + readonly repositoryName: string; + + /** + * A description of the repository. Use the description to identify the + * purpose of the repository. + * + * @default - No description. + */ + readonly description?: string; + + /** + * The contents with which to initialize the repository after it has been created. + * + * @default - No initialization (create empty repo) + */ + readonly code?: Code; +} + +/** + * Provides a CodeCommit Repository. + */ +export class Repository extends RepositoryBase { + + /** + * Imports a codecommit repository. + * @param repositoryArn (e.g. `arn:aws:codecommit:us-east-1:123456789012:MyDemoRepo`) + */ + public static fromRepositoryArn(scope: Construct, id: string, repositoryArn: string): IRepository { + const stack = Stack.of(scope); + const arn = stack.splitArn(repositoryArn, ArnFormat.NO_RESOURCE_NAME); + const repositoryName = arn.resource; + const region = arn.region; + + class Import extends RepositoryBase { + public readonly repositoryArn = repositoryArn; + public readonly repositoryName = repositoryName; + public readonly repositoryCloneUrlHttp = makeCloneUrl(stack, repositoryName, 'https', region); + public readonly repositoryCloneUrlSsh = makeCloneUrl(stack, repositoryName, 'ssh', region); + public readonly repositoryCloneUrlGrc = makeCloneUrl(stack, repositoryName, 'grc', region); + } + + return new Import(scope, id, { + account: arn.account, + region, + }); + } + + public static fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository { + const stack = Stack.of(scope); + + class Import extends RepositoryBase { + public repositoryName = repositoryName; + public repositoryArn = Stack.of(scope).formatArn({ + service: 'codecommit', + resource: repositoryName, + }); + public readonly repositoryCloneUrlHttp = makeCloneUrl(stack, repositoryName, 'https'); + public readonly repositoryCloneUrlSsh = makeCloneUrl(stack, repositoryName, 'ssh'); + public readonly repositoryCloneUrlGrc = makeCloneUrl(stack, repositoryName, 'grc'); + } + + return new Import(scope, id); + } + + public readonly repositoryArn: string; + public readonly repositoryName: string; + public readonly repositoryCloneUrlHttp: string; + public readonly repositoryCloneUrlSsh: string; + public readonly repositoryCloneUrlGrc: string; + private readonly triggers = new Array(); + + constructor(scope: Construct, id: string, props: RepositoryProps) { + super(scope, id, { + physicalName: props.repositoryName, + }); + + const repository = new CfnRepository(this, 'Resource', { + repositoryName: props.repositoryName, + repositoryDescription: props.description, + triggers: Lazy.any({ produce: () => this.triggers }, { omitEmptyArray: true }), + code: (props.code?.bind(this))?.code, + }); + + this.repositoryName = this.getResourceNameAttribute(repository.attrName); + this.repositoryArn = this.getResourceArnAttribute(repository.attrArn, { + service: 'codecommit', + resource: this.physicalName, + }); + this.repositoryCloneUrlHttp = repository.attrCloneUrlHttp; + this.repositoryCloneUrlSsh = repository.attrCloneUrlSsh; + this.repositoryCloneUrlGrc = makeCloneUrl(Stack.of(this), this.repositoryName, 'grc'); + } + + /** + * Create a trigger to notify another service to run actions on repository events. + * @param arn Arn of the resource that repository events will notify + * @param options Trigger options to run actions + */ + public notify(arn: string, options?: RepositoryTriggerOptions): Repository { + + let evt = options && options.events; + if (evt && evt.length > 1 && evt.indexOf(RepositoryEventTrigger.ALL) > -1) { + evt = [RepositoryEventTrigger.ALL]; + } + + const customData = options && options.customData; + const branches = options && options.branches; + + let name = options && options.name; + if (!name) { + name = this.node.path + '/' + arn; + } + + if (this.triggers.find(prop => prop.name === name)) { + throw new Error(`Unable to set repository trigger named ${name} because trigger names must be unique`); + } + + this.triggers.push({ + destinationArn: arn, + name, + customData, + branches, + events: evt || [RepositoryEventTrigger.ALL], + }); + return this; + } +} + +/** + * Creates for a repository trigger to an SNS topic or Lambda function. + */ +export interface RepositoryTriggerOptions { + /** + * A name for the trigger.Triggers on a repository must have unique names. + */ + readonly name?: string; + + /** + * The repository events for which AWS CodeCommit sends information to the + * target, which you specified in the DestinationArn property.If you don't + * specify events, the trigger runs for all repository events. + */ + readonly events?: RepositoryEventTrigger[]; + + /** + * The names of the branches in the AWS CodeCommit repository that contain + * events that you want to include in the trigger. If you don't specify at + * least one branch, the trigger applies to all branches. + */ + readonly branches?: string[]; + + /** + * When an event is triggered, additional information that AWS CodeCommit + * includes when it sends information to the target. + */ + readonly customData?: string; +} + +/** + * Repository events that will cause the trigger to run actions in another service. + */ +export enum RepositoryEventTrigger { + ALL = 'all', + UPDATE_REF = 'updateReference', + CREATE_REF = 'createReference', + DELETE_REF = 'deleteReference' +} + +/** + * Returns the clone URL for a protocol. + */ +function makeCloneUrl(stack: Stack, repositoryName: string, protocol: 'https' | 'ssh' | 'grc', region?: string) { + switch (protocol) { + case 'https': + case 'ssh': + return `${protocol}://git-codecommit.${region ?? stack.region}.${stack.urlSuffix}/v1/repos/${repositoryName}`; + case 'grc': + return `codecommit::${region ?? stack.region}://${repositoryName}`; + } +} + +/** + * List of event types for AWS CodeCommit + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-repositories + */ +export enum RepositoryNotificationEvents { + /** + * Trigger notication when comment made on commit. + */ + COMMIT_COMMENT = 'codecommit-repository-comments-on-commits', + + /** + * Trigger notification when comment made on pull request. + */ + PULL_REQUEST_COMMENT = 'codecommit-repository-comments-on-pull-requests', + + /** + * Trigger notification when approval status changed. + */ + APPROVAL_STATUS_CHANGED = 'codecommit-repository-approvals-status-changed', + + /** + * Trigger notifications when approval rule is overridden. + */ + APPROVAL_RULE_OVERRIDDEN = 'codecommit-repository-approvals-rule-override', + + /** + * Trigger notification when pull request created. + */ + PULL_REQUEST_CREATED = 'codecommit-repository-pull-request-created', + + /** + * Trigger notification when pull request source updated. + */ + PULL_REQUEST_SOURCE_UPDATED = 'codecommit-repository-pull-request-source-updated', + + /** + * Trigger notification when pull request status is changed. + */ + PULL_REQUEST_STATUS_CHANGED = 'codecommit-repository-pull-request-status-changed', + + /** + * Trigger notification when pull requset is merged. + */ + PULL_REQUEST_MERGED = 'codecommit-repository-pull-request-merged', + + /** + * Trigger notification when a branch or tag is created. + */ + BRANCH_OR_TAG_CREATED = 'codecommit-repository-branches-and-tags-created', + + /** + * Trigger notification when a branch or tag is deleted. + */ + BRANCH_OR_TAG_DELETED = 'codecommit-repository-branches-and-tags-deleted', + + /** + * Trigger notification when a branch or tag is updated. + */ + BRANCH_OR_TAG_UPDATED = 'codecommit-repository-branches-and-tags-updated', +} diff --git a/packages/@aws-cdk/aws-codecommit/test/asset-test.zip b/packages/aws-cdk-lib/aws-codecommit/test/asset-test.zip similarity index 100% rename from packages/@aws-cdk/aws-codecommit/test/asset-test.zip rename to packages/aws-cdk-lib/aws-codecommit/test/asset-test.zip diff --git a/packages/aws-cdk-lib/aws-codecommit/test/asset-test/test.md b/packages/aws-cdk-lib/aws-codecommit/test/asset-test/test.md new file mode 100644 index 0000000000000..21e60f8358c61 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/test/asset-test/test.md @@ -0,0 +1 @@ +# Test \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codecommit/test/codecommit.test.ts b/packages/aws-cdk-lib/aws-codecommit/test/codecommit.test.ts similarity index 97% rename from packages/@aws-cdk/aws-codecommit/test/codecommit.test.ts rename to packages/aws-cdk-lib/aws-codecommit/test/codecommit.test.ts index 88e754c847c3b..0f13b2790e046 100644 --- a/packages/@aws-cdk/aws-codecommit/test/codecommit.test.ts +++ b/packages/aws-cdk-lib/aws-codecommit/test/codecommit.test.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import { join, resolve } from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Role, ServicePrincipal } from '../../aws-iam'; +import { Asset } from '../../aws-s3-assets'; +import { App, Stack } from '../../core'; import { Code, Repository, RepositoryProps } from '../lib'; describe('codecommit', () => { diff --git a/packages/aws-cdk-lib/aws-codecommit/test/notification-rule.test.ts b/packages/aws-cdk-lib/aws-codecommit/test/notification-rule.test.ts new file mode 100644 index 0000000000000..04df254493023 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codecommit/test/notification-rule.test.ts @@ -0,0 +1,65 @@ +import { Template } from '../../assertions'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; +import * as codecommit from '../lib'; + +describe('notification rule', () => { + test('CodeCommit Repositories - can create notification rule', () => { + const stack = new cdk.Stack(); + const repository = new codecommit.Repository(stack, 'MyCodecommitRepository', { + repositoryName: 'my-test-repository', + }); + + const target = new sns.Topic(stack, 'MyTopic'); + + repository.notifyOnPullRequestCreated('NotifyOnPullRequestCreated', target); + + repository.notifyOnPullRequestMerged('NotifyOnPullRequestMerged', target); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyCodecommitRepositoryNotifyOnPullRequestCreatedBB14EA32', + DetailType: 'FULL', + EventTypeIds: [ + 'codecommit-repository-pull-request-created', + ], + Resource: { + 'Fn::GetAtt': [ + 'MyCodecommitRepository26DB372B', + 'Arn', + ], + }, + Targets: [ + { + TargetAddress: { + Ref: 'MyTopic86869434', + }, + TargetType: 'SNS', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyCodecommitRepositoryNotifyOnPullRequestMerged34A7EDF1', + DetailType: 'FULL', + EventTypeIds: [ + 'codecommit-repository-pull-request-merged', + ], + Resource: { + 'Fn::GetAtt': [ + 'MyCodecommitRepository26DB372B', + 'Arn', + ], + }, + Targets: [ + { + TargetAddress: { + Ref: 'MyTopic86869434', + }, + TargetType: 'SNS', + }, + ], + }); + + + }); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codedeploy/.jsiirc.json b/packages/aws-cdk-lib/aws-codedeploy/.jsiirc.json new file mode 100644 index 0000000000000..c420db4aa7357 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.codedeploy" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeDeploy" + }, + "python": { + "module": "aws_cdk.aws_codedeploy" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codedeploy/README.md b/packages/aws-cdk-lib/aws-codedeploy/README.md new file mode 100644 index 0000000000000..30038154c6dfc --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/README.md @@ -0,0 +1,708 @@ +# AWS CodeDeploy Construct Library + + +## Table of Contents + +- [Introduction](#introduction) +- Deploying to Amazon EC2 and on-premise instances + - [EC2/on-premise Applications](#ec2on-premise-applications) + - [EC2/on-premise Deployment Groups](#ec2on-premise-deployment-groups) + - [EC2/on-premise Deployment Configurations](#ec2on-premise-deployment-configurations) +- Deploying to AWS Lambda functions + - [Lambda Applications](#lambda-applications) + - [Lambda Deployment Groups](#lambda-deployment-groups) + - [Lambda Deployment Configurations](#lambda-deployment-configurations) +- Deploying to Amazon ECS services + - [ECS Applications](#ecs-applications) + - [ECS Deployment Groups](#ecs-deployment-groups) + - [ECS Deployment Configurations](#ecs-deployment-configurations) + - [ECS Deployments](#ecs-deployments) + +## Introduction + +AWS CodeDeploy is a deployment service that automates application deployments to +Amazon EC2 instances, on-premises instances, serverless Lambda functions, or +Amazon ECS services. + +The CDK currently supports Amazon EC2, on-premise, AWS Lambda, and Amazon ECS applications. + +## EC2/on-premise Applications + +To create a new CodeDeploy Application that deploys to EC2/on-premise instances: + +```ts +const application = new codedeploy.ServerApplication(this, 'CodeDeployApplication', { + applicationName: 'MyApplication', // optional property +}); +``` + +To import an already existing Application: + +```ts +const application = codedeploy.ServerApplication.fromServerApplicationName( + this, + 'ExistingCodeDeployApplication', + 'MyExistingApplication', +); +``` + +## EC2/on-premise Deployment Groups + +To create a new CodeDeploy Deployment Group that deploys to EC2/on-premise instances: + +```ts +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +declare const application: codedeploy.ServerApplication; +declare const asg: autoscaling.AutoScalingGroup; +declare const alarm: cloudwatch.Alarm; +const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'CodeDeployDeploymentGroup', { + application, + deploymentGroupName: 'MyDeploymentGroup', + autoScalingGroups: [asg], + // adds User Data that installs the CodeDeploy agent on your auto-scaling groups hosts + // default: true + installAgent: true, + // adds EC2 instances matching tags + ec2InstanceTags: new codedeploy.InstanceTagSet( + { + // any instance with tags satisfying + // key1=v1 or key1=v2 or key2 (any value) or value v3 (any key) + // will match this group + 'key1': ['v1', 'v2'], + 'key2': [], + '': ['v3'], + }, + ), + // adds on-premise instances matching tags + onPremiseInstanceTags: new codedeploy.InstanceTagSet( + // only instances with tags (key1=v1 or key1=v2) AND key2=v3 will match this set + { + 'key1': ['v1', 'v2'], + }, + { + 'key2': ['v3'], + }, + ), + // CloudWatch alarms + alarms: [alarm], + // whether to ignore failure to fetch the status of alarms from CloudWatch + // default: false + ignorePollAlarmsFailure: false, + // auto-rollback configuration + autoRollback: { + failedDeployment: true, // default: true + stoppedDeployment: true, // default: false + deploymentInAlarm: true, // default: true if you provided any alarms, false otherwise + }, +}); +``` + +All properties are optional - if you don't provide an Application, +one will be automatically created. + +To import an already existing Deployment Group: + +```ts +declare const application: codedeploy.ServerApplication; +const deploymentGroup = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes( + this, + 'ExistingCodeDeployDeploymentGroup', { + application, + deploymentGroupName: 'MyExistingDeploymentGroup', + }, +); +``` + +### Load balancers + +You can [specify a load balancer](https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-elastic-load-balancing.html) +with the `loadBalancer` property when creating a Deployment Group. + +`LoadBalancer` is an abstract class with static factory methods that allow you to create instances of it from various sources. + +With Classic Elastic Load Balancer, you provide it directly: + +```ts +import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; + +declare const lb: elb.LoadBalancer; +lb.addListener({ + externalPort: 80, +}); + +const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', { + loadBalancer: codedeploy.LoadBalancer.classic(lb), +}); +``` + +With Application Load Balancer or Network Load Balancer, +you provide a Target Group as the load balancer: + +```ts +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; + +declare const alb: elbv2.ApplicationLoadBalancer; +const listener = alb.addListener('Listener', { port: 80 }); +const targetGroup = listener.addTargets('Fleet', { port: 80 }); + +const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', { + loadBalancer: codedeploy.LoadBalancer.application(targetGroup), +}); +``` + +## EC2/on-premise Deployment Configurations + +You can also pass a Deployment Configuration when creating the Deployment Group: + +```ts +const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'CodeDeployDeploymentGroup', { + deploymentConfig: codedeploy.ServerDeploymentConfig.ALL_AT_ONCE, +}); +``` + +The default Deployment Configuration is `ServerDeploymentConfig.ONE_AT_A_TIME`. + +You can also create a custom Deployment Configuration: + +```ts +const deploymentConfig = new codedeploy.ServerDeploymentConfig(this, 'DeploymentConfiguration', { + deploymentConfigName: 'MyDeploymentConfiguration', // optional property + // one of these is required, but both cannot be specified at the same time + minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(2), + // minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), +}); +``` + +Or import an existing one: + +```ts +const deploymentConfig = codedeploy.ServerDeploymentConfig.fromServerDeploymentConfigName( + this, + 'ExistingDeploymentConfiguration', + 'MyExistingDeploymentConfiguration', +); +``` + +## Lambda Applications + +To create a new CodeDeploy Application that deploys to a Lambda function: + +```ts +const application = new codedeploy.LambdaApplication(this, 'CodeDeployApplication', { + applicationName: 'MyApplication', // optional property +}); +``` + +To import an already existing Application: + +```ts +const application = codedeploy.LambdaApplication.fromLambdaApplicationName( + this, + 'ExistingCodeDeployApplication', + 'MyExistingApplication', +); +``` + +## Lambda Deployment Groups + +To enable traffic shifting deployments for Lambda functions, CodeDeploy uses Lambda Aliases, which can balance incoming traffic between two different versions of your function. +Before deployment, the alias sends 100% of invokes to the version used in production. +When you publish a new version of the function to your stack, CodeDeploy will send a small percentage of traffic to the new version, monitor, and validate before shifting 100% of traffic to the new version. + +To create a new CodeDeploy Deployment Group that deploys to a Lambda function: + +```ts +declare const myApplication: codedeploy.LambdaApplication; +declare const func: lambda.Function; +const version = func.currentVersion; +const version1Alias = new lambda.Alias(this, 'alias', { + aliasName: 'prod', + version, +}); + +const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { + application: myApplication, // optional property: one will be created for you if not provided + alias: version1Alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, +}); +``` + +In order to deploy a new version of this function: + +1. Reference the version with the latest changes `const version = func.currentVersion`. +2. Re-deploy the stack (this will trigger a deployment). +3. Monitor the CodeDeploy deployment as traffic shifts between the versions. + +### Lambda Deployment Rollbacks and Alarms + +CodeDeploy will roll back if the deployment fails. You can optionally trigger a rollback when one or more alarms are in a failed state: + +```ts +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +declare const alias: lambda.Alias; +const alarm = new cloudwatch.Alarm(this, 'Errors', { + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + metric: alias.metricErrors(), +}); +const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, + alarms: [ + // pass some alarms when constructing the deployment group + alarm, + ], +}); + +// or add alarms to an existing group +declare const blueGreenAlias: lambda.Alias; +deploymentGroup.addAlarm(new cloudwatch.Alarm(this, 'BlueGreenErrors', { + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + metric: blueGreenAlias.metricErrors(), +})); +``` + +### Pre and Post Hooks + +CodeDeploy allows you to run an arbitrary Lambda function before traffic shifting actually starts (PreTraffic Hook) and after it completes (PostTraffic Hook). +With either hook, you have the opportunity to run logic that determines whether the deployment must succeed or fail. +For example, with PreTraffic hook you could run integration tests against the newly created Lambda version (but not serving traffic). With PostTraffic hook, you could run end-to-end validation checks. + +```ts +declare const warmUpUserCache: lambda.Function; +declare const endToEndValidation: lambda.Function; +declare const alias: lambda.Alias; + +// pass a hook whe creating the deployment group +const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { + alias: alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, + preHook: warmUpUserCache, +}); + +// or configure one on an existing deployment group +deploymentGroup.addPostHook(endToEndValidation); +``` + +### Import an existing Lambda Deployment Group + +To import an already existing Deployment Group: + +```ts +declare const application: codedeploy.LambdaApplication; +const deploymentGroup = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(this, 'ExistingCodeDeployDeploymentGroup', { + application, + deploymentGroupName: 'MyExistingDeploymentGroup', +}); +``` + +## Lambda Deployment Configurations + +CodeDeploy for Lambda comes with predefined configurations for traffic shifting. +The predefined configurations are available as LambdaDeploymentConfig constants. + +```ts +const config = codedeploy.LambdaDeploymentConfig.CANARY_10PERCENT_30MINUTES; + +declare const application: codedeploy.LambdaApplication; +declare const alias: lambda.Alias; +const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { + application, + alias, + deploymentConfig: config, +}); +``` + +If you want to specify your own strategy, +you can do so with the LambdaDeploymentConfig construct, +letting you specify precisely how fast a new function version is deployed. + +```ts +const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', { + trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ + interval: cdk.Duration.minutes(15), + percentage: 5, + }), +}); + +declare const application: codedeploy.LambdaApplication; +declare const alias: lambda.Alias; +const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', { + application, + alias, + deploymentConfig: config, +}); +``` + +You can specify a custom name for your deployment config, but if you do you will not be able to update the interval/percentage through CDK. + +```ts +const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', { + trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ + interval: cdk.Duration.minutes(15), + percentage: 5, + }), + deploymentConfigName: 'MyDeploymentConfig', +}); +``` + +To import an already existing Deployment Config: + +```ts +const deploymentConfig = codedeploy.LambdaDeploymentConfig.fromLambdaDeploymentConfigName( + this, + 'ExistingDeploymentConfiguration', + 'MyExistingDeploymentConfiguration', +); +``` + +## ECS Applications + +To create a new CodeDeploy Application that deploys an ECS service: + +```ts +const application = new codedeploy.EcsApplication(this, 'CodeDeployApplication', { + applicationName: 'MyApplication', // optional property +}); +``` + +To import an already existing Application: + +```ts +const application = codedeploy.EcsApplication.fromEcsApplicationName( + this, + 'ExistingCodeDeployApplication', + 'MyExistingApplication', +); +``` + +## ECS Deployment Groups + +CodeDeploy can be used to deploy to load-balanced ECS services. +CodeDeploy performs ECS blue-green deployments by managing ECS task sets and load balancer +target groups. During a blue-green deployment, one task set and target group runs the +original version of your ECS task definition ('blue') and another task set and target group +runs the new version of your ECS task definition ('green'). + +CodeDeploy orchestrates traffic shifting during ECS blue-green deployments by using +a load balancer listener to balance incoming traffic between the 'blue' and 'green' task sets/target groups +running two different versions of your ECS task definition. +Before deployment, the load balancer listener sends 100% of requests to the 'blue' target group. +When you publish a new version of the task definition and start a CodeDeploy deployment, +CodeDeploy can send a small percentage of traffic to the new 'green' task set behind the 'green' target group, +monitor, and validate before shifting 100% of traffic to the new version. + +To create a new CodeDeploy Deployment Group that deploys to an ECS service: + +```ts +declare const myApplication: codedeploy.EcsApplication; +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.FargateTaskDefinition; +declare const blueTargetGroup: elbv2.ITargetGroup; +declare const greenTargetGroup: elbv2.ITargetGroup; +declare const listener: elbv2.IApplicationListener; + +const service = new ecs.FargateService(this, 'Service', { + cluster, + taskDefinition, + deploymentController: { + type: ecs.DeploymentControllerType.CODE_DEPLOY, + }, +}); + +new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + service, + blueGreenDeploymentConfig: { + blueTargetGroup, + greenTargetGroup, + listener, + }, + deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); +``` + +In order to deploy a new task definition version to the ECS service, +deploy the changes directly through CodeDeploy using the CodeDeploy APIs or console. +When the `CODE_DEPLOY` deployment controller is used, the ECS service cannot be +deployed with a new task definition version through CloudFormation. + +For more information on the behavior of CodeDeploy blue-green deployments for ECS, see +[What happens during an Amazon ECS deployment](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html#deployment-steps-what-happens) +in the CodeDeploy user guide. + +Note: If you wish to deploy updates to your ECS service through CDK and CloudFormation instead of directly through CodeDeploy, +using the [`CfnCodeDeployBlueGreenHook`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnCodeDeployBlueGreenHook.html) +construct is the recommended approach instead of using the `EcsDeploymentGroup` construct. For a comparison +of ECS blue-green deployments through CodeDeploy (using `EcsDeploymentGroup`) and through CloudFormation (using `CfnCodeDeployBlueGreenHook`), +see [Create an Amazon ECS blue/green deployment through AWS CloudFormation](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployments-create-ecs-cfn.html#differences-ecs-bg-cfn) +in the CloudFormation user guide. + +### ECS Deployment Rollbacks and Alarms + +CodeDeploy will automatically roll back if a deployment fails. +You can optionally trigger an automatic rollback when one or more alarms are in a failed state during a deployment, or if the deployment stops. + +In this example, CodeDeploy will monitor and roll back on alarms set for the +number of unhealthy ECS tasks in each of the blue and green target groups, +as well as alarms set for the number HTTP 5xx responses seen in each of the blue +and green target groups. + +```ts +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +// Alarm on the number of unhealthy ECS tasks in each target group +const blueUnhealthyHosts = new cloudwatch.Alarm(stack, 'BlueUnhealthyHosts', { + alarmName: stack.stackName + '-Unhealthy-Hosts-Blue', + metric: blueTargetGroup.metricUnhealthyHostCount(), + threshold: 1, + evaluationPeriods: 2, +}); + +const greenUnhealthyHosts = new cloudwatch.Alarm(stack, 'GreenUnhealthyHosts', { + alarmName: stack.stackName + '-Unhealthy-Hosts-Green', + metric: greenTargetGroup.metricUnhealthyHostCount(), + threshold: 1, + evaluationPeriods: 2, +}); + +// Alarm on the number of HTTP 5xx responses returned by each target group +const blueApiFailure = new cloudwatch.Alarm(stack, 'Blue5xx', { + alarmName: stack.stackName + '-Http-5xx-Blue', + metric: blueTargetGroup.metricHttpCodeTarget( + elbv2.HttpCodeTarget.TARGET_5XX_COUNT, + { period: cdk.Duration.minutes(1) }, + ), + threshold: 1, + evaluationPeriods: 1, +}); + +const greenApiFailure = new cloudwatch.Alarm(stack, 'Green5xx', { + alarmName: stack.stackName + '-Http-5xx-Green', + metric: greenTargetGroup.metricHttpCodeTarget( + elbv2.HttpCodeTarget.TARGET_5XX_COUNT, + { period: cdk.Duration.minutes(1) }, + ), + threshold: 1, + evaluationPeriods: 1, +}); + +new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + // CodeDeploy will monitor these alarms during a deployment and automatically roll back + alarms: [blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure], + autoRollback: { + // CodeDeploy will automatically roll back if a deployment is stopped + stoppedDeployment: true, + }, + service, + blueGreenDeploymentConfig: { + blueTargetGroup, + greenTargetGroup, + listener, + }, + deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); +``` + +### Deployment validation and manual deployment approval + +CodeDeploy blue-green deployments provide an opportunity to validate the new task definition version running on +the 'green' ECS task set prior to shifting any production traffic to the new version. A second 'test' listener +serving traffic on a different port be added to the load balancer. For example, the test listener can serve +test traffic on port 9001 while the main listener serves production traffic on port 443. +During a blue-green deployment, CodeDeploy can then shift 100% of test traffic over to the 'green' +task set/target group prior to shifting any production traffic during the deployment. + +```ts +declare const myApplication: codedeploy.EcsApplication; +declare const service: ecs.FargateService; +declare const blueTargetGroup: elbv2.ITargetGroup; +declare const greenTargetGroup: elbv2.ITargetGroup; +declare const listener: elbv2.IApplicationListener; +declare const testListener: elbv2.IApplicationListener; + +new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + service, + blueGreenDeploymentConfig: { + blueTargetGroup, + greenTargetGroup, + listener, + testListener, + }, + deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); +``` + +Automated validation steps can run during the CodeDeploy deployment after shifting test traffic and before +shifting production traffic. CodeDeploy supports registering Lambda functions as lifecycle hooks for +an ECS deployment. These Lambda functions can run automated validation steps against the test traffic +port, for example in response to the `AfterAllowTestTraffic` lifecycle hook. For more information about +how to specify the Lambda functions to run for each CodeDeploy lifecycle hook in an ECS deployment, see the +[AppSpec 'hooks' for an Amazon ECS deployment](https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs) +section in the CodeDeploy user guide. + +After provisioning the 'green' ECS task set and re-routing test traffic during a blue-green deployment, +CodeDeploy can wait for approval before continuing the deployment and re-routing production traffic. +During this approval wait time, you can complete additional validation steps prior to exposing the new +'green' task set to production traffic, such as manual testing through the test listener port or +running automated integration test suites. + +To approve the deployment, validation steps use the CodeDeploy +[ContinueDeployment API(https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ContinueDeployment.html). +If the ContinueDeployment API is not called within the approval wait time period, CodeDeploy will stop the +deployment and can automatically roll back the deployment. + +```ts +new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + autoRollback: { + // CodeDeploy will automatically roll back if the 8-hour approval period times out and the deployment stops + stoppedDeployment: true, + }, + service, + blueGreenDeploymentConfig: { + // The deployment will wait for approval for up to 8 hours before stopping the deployment + deploymentApprovalWaitTime: Duration.hours(8), + blueTargetGroup, + greenTargetGroup, + listener, + testListener, + }, + deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); +``` + +### Deployment bake time + +You can specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment +is complete in order to let the deployment "bake" a while. During this bake time, CodeDeploy will continue to monitor any +CloudWatch alarms specified for the deployment group and will automatically roll back if those alarms go into a failed state. + +```ts +new codedeploy.EcsDeploymentGroup(stack, 'BlueGreenDG', { + service, + blueGreenDeploymentConfig: { + blueTargetGroup, + greenTargetGroup, + listener, + // CodeDeploy will wait for 30 minutes after completing the blue-green deployment before it terminates the blue tasks + terminationWaitTime: Duration.minutes(30), + }, + // CodeDeploy will continue to monitor these alarms during the 30-minute bake time and will automatically + // roll back if they go into a failed state at any point during the deployment. + alarms: [blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure], + deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES, +}); +``` + +### Import an existing ECS Deployment Group + +To import an already existing Deployment Group: + +```ts +declare const application: codedeploy.EcsApplication; +const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(this, 'ExistingCodeDeployDeploymentGroup', { + application, + deploymentGroupName: 'MyExistingDeploymentGroup', +}); +``` + +## ECS Deployment Configurations + +CodeDeploy for ECS comes with predefined configurations for traffic shifting. +The predefined configurations are available as LambdaDeploymentConfig constants. + +```ts +const config = codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES; +``` + +If you want to specify your own strategy, +you can do so with the EcsDeploymentConfig construct, +letting you specify precisely how fast an ECS service is deployed. + +```ts +new codedeploy.EcsDeploymentConfig(this, 'CustomConfig', { + trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ + interval: cdk.Duration.minutes(15), + percentage: 5, + }), +}); +``` + +You can specify a custom name for your deployment config, but if you do you will not be able to update the interval/percentage through CDK. + +```ts +const config = new codedeploy.EcsDeploymentConfig(this, 'CustomConfig', { + trafficRoutingConfig: new codedeploy.TimeBasedCanaryTrafficRoutingConfig({ + interval: cdk.Duration.minutes(15), + percentage: 5, + }), + deploymentConfigName: 'MyDeploymentConfig', +}); +``` + +Or import an existing one: + +```ts +const deploymentConfig = codedeploy.EcsDeploymentConfig.fromEcsDeploymentConfigName( + this, + 'ExistingDeploymentConfiguration', + 'MyExistingDeploymentConfiguration', +); +``` + +## ECS Deployments + +[![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg)](https://constructs.dev/packages/@cdklabs/cdk-ecs-codedeploy) + +An experimental construct is available on the Construct Hub called [@cdklabs/cdk-ecs-codedeploy](https://constructs.dev/packages/@cdklabs/cdk-ecs-codedeploy) that manages ECS CodeDeploy deployments. + +```ts +declare const deploymentGroup: codeDeploy.IEcsDeploymentGroup; +declare const taskDefinition: ecs.ITaskDefinition; + +new EcsDeployment({ + deploymentGroup, + targetService: { + taskDefinition, + containerName: 'mycontainer', + containerPort: 80, + }, +}); +``` + +The deployment will use the AutoRollbackConfig for the EcsDeploymentGroup unless it is overridden in the deployment: + +```ts +new EcsDeployment({ + deploymentGroup, + targetService: { + taskDefinition, + containerName: 'mycontainer', + containerPort: 80, + }, + autoRollback: { + failedDeployment: true, + deploymentInAlarm: true, + stoppedDeployment: false, + }, +}); +``` + +By default, the CodeDeploy Deployment will timeout after 30 minutes. The timeout value can be overridden: + +```ts +new EcsDeployment({ + deploymentGroup, + targetService: { + taskDefinition, + containerName: 'mycontainer', + containerPort: 80, + }, + timeout: Duration.minutes(60), +}); +``` diff --git a/packages/aws-cdk-lib/aws-codedeploy/index.ts b/packages/aws-cdk-lib/aws-codedeploy/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/base-deployment-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/base-deployment-config.ts similarity index 98% rename from packages/@aws-cdk/aws-codedeploy/lib/base-deployment-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/base-deployment-config.ts index fef4a8e9ae696..505bf04421f67 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/base-deployment-config.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/base-deployment-config.ts @@ -1,4 +1,4 @@ -import { ArnFormat, Resource, Stack } from '@aws-cdk/core'; +import { ArnFormat, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnDeploymentConfig } from './codedeploy.generated'; import { MinimumHealthyHosts } from './host-health-config'; diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/application.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/application.ts new file mode 100644 index 0000000000000..5b344341b81d1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/application.ts @@ -0,0 +1,100 @@ +import { ArnFormat, IResource, Resource, Stack, Arn } from '../../../core'; +import { Construct } from 'constructs'; +import { CfnApplication } from '../codedeploy.generated'; +import { arnForApplication, validateName } from '../private/utils'; + +/** + * Represents a reference to a CodeDeploy Application deploying to Amazon ECS. + * + * If you're managing the Application alongside the rest of your CDK resources, + * use the `EcsApplication` class. + * + * If you want to reference an already existing Application, + * or one defined in a different CDK Stack, + * use the `EcsApplication#fromEcsApplicationName` method. + */ +export interface IEcsApplication extends IResource { + /** @attribute */ + readonly applicationArn: string; + + /** @attribute */ + readonly applicationName: string; +} + +/** + * Construction properties for `EcsApplication`. + */ +export interface EcsApplicationProps { + /** + * The physical, human-readable name of the CodeDeploy Application. + * + * @default an auto-generated name will be used + */ + readonly applicationName?: string; +} + +/** + * A CodeDeploy Application that deploys to an Amazon ECS service. + * + * @resource AWS::CodeDeploy::Application + */ +export class EcsApplication extends Resource implements IEcsApplication { + /** + * Import an Application defined either outside the CDK, or in a different CDK Stack. + * + * The Application's account and region are assumed to be the same as the stack it is being imported + * into. If not, use `fromEcsApplicationArn`. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param ecsApplicationName the name of the application to import + * @returns a Construct representing a reference to an existing Application + */ + public static fromEcsApplicationName(scope: Construct, id: string, ecsApplicationName: string): IEcsApplication { + class Import extends Resource implements IEcsApplication { + public applicationArn = arnForApplication(Stack.of(scope), ecsApplicationName); + public applicationName = ecsApplicationName; + } + + return new Import(scope, id); + } + + /** + * Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param ecsApplicationArn the ARN of the application to import + * @returns a Construct representing a reference to an existing Application + */ + public static fromEcsApplicationArn(scope: Construct, id: string, ecsApplicationArn: string): IEcsApplication { + return new class extends Resource implements IEcsApplication { + public applicationArn = ecsApplicationArn; + public applicationName = Arn.split(ecsApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? ''; + } (scope, id, { environmentFromArn: ecsApplicationArn }); + } + + public readonly applicationArn: string; + public readonly applicationName: string; + + constructor(scope: Construct, id: string, props: EcsApplicationProps = {}) { + super(scope, id, { + physicalName: props.applicationName, + }); + + const resource = new CfnApplication(this, 'Resource', { + applicationName: this.physicalName, + computePlatform: 'ECS', + }); + + this.applicationName = this.getResourceNameAttribute(resource.ref); + this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(scope), resource.ref), { + service: 'codedeploy', + resource: 'application', + resourceName: this.physicalName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + + this.node.addValidation({ validate: () => validateName('Application', this.physicalName) }); + } +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-config.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/ecs/deployment-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-config.ts diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts new file mode 100644 index 0000000000000..9b5dc277ed94b --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/deployment-group.ts @@ -0,0 +1,368 @@ +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ecs from '../../../aws-ecs'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; +import { CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP } from '../../../cx-api'; +import { Construct } from 'constructs'; +import { IEcsApplication, EcsApplication } from './application'; +import { EcsDeploymentConfig, IEcsDeploymentConfig } from './deployment-config'; +import { CfnDeploymentGroup } from '../codedeploy.generated'; +import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group'; +import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils'; +import { AutoRollbackConfig } from '../rollback-config'; + +/** + * Interface for an ECS deployment group. + */ +export interface IEcsDeploymentGroup extends cdk.IResource { + /** + * The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. + */ + readonly application: IEcsApplication; + + /** + * The physical name of the CodeDeploy Deployment Group. + * @attribute + */ + readonly deploymentGroupName: string; + + /** + * The ARN of this Deployment Group. + * @attribute + */ + readonly deploymentGroupArn: string; + + /** + * The Deployment Configuration this Group uses. + */ + readonly deploymentConfig: IEcsDeploymentConfig; +} + +/** + * Specify how the deployment behaves and how traffic is routed to the ECS service during a blue-green ECS deployment. + * + * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html#deployment-steps-what-happens + * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs + */ +export interface EcsBlueGreenDeploymentConfig { + /** + * The target group that will be associated with the 'blue' ECS task set during a blue-green deployment. + */ + readonly blueTargetGroup: elbv2.ITargetGroup; + + /** + * The target group that will be associated with the 'green' ECS task set during a blue-green deployment. + */ + readonly greenTargetGroup: elbv2.ITargetGroup; + + /** + * The load balancer listener used to serve production traffic and to shift production traffic from the + * 'blue' ECS task set to the 'green' ECS task set during a blue-green deployment. + */ + readonly listener: elbv2.IListener; + + /** + * The load balancer listener used to route test traffic to the 'green' ECS task set during a blue-green deployment. + * + * During a blue-green deployment, validation can occur after test traffic has been re-routed and before production + * traffic has been re-routed to the 'green' ECS task set. You can specify one or more Lambda funtions in the + * deployment's AppSpec file that run during the AfterAllowTestTraffic hook. The functions can run validation tests. + * If a validation test fails, a deployment rollback is triggered. If the validation tests succeed, the next hook in + * the deployment lifecycle, BeforeAllowTraffic, is triggered. + * + * If a test listener is not specified, the deployment will proceed to routing the production listener to the 'green' ECS task set + * and will skip the AfterAllowTestTraffic hook. + * + * @default No test listener will be added + */ + readonly testListener?: elbv2.IListener; + + /** + * Specify how long CodeDeploy waits for approval to continue a blue-green deployment before it stops the deployment. + * + * After provisioning the 'green' ECS task set and re-routing test traffic, CodeDeploy can wait for approval before + * continuing the deployment and re-routing production traffic. During this wait time, validation such as manual + * testing or running integration tests can occur using the test traffic port, prior to exposing the new 'green' task + * set to production traffic. To approve the deployment, validation steps use the CodeDeploy + * [ContinueDeployment API(https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ContinueDeployment.html). + * If the ContinueDeployment API is not called within the wait time period, CodeDeploy will stop the deployment. + * + * By default, CodeDeploy will not wait for deployment approval. After re-routing test traffic to the 'green' ECS task set + * and running any 'AfterAllowTestTraffic' and 'BeforeAllowTraffic' lifecycle hooks, the deployment will immediately + * re-route production traffic to the 'green' ECS task set. + * + * @default 0 + */ + readonly deploymentApprovalWaitTime?: cdk.Duration; + + /** + * Specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment is complete. + * + * During this wait time, CodeDeploy will continue to monitor any CloudWatch alarms specified for the deployment group, + * and the deployment group can be configured to automatically roll back if those alarms fire. Once CodeDeploy begins to + * terminate the 'blue' ECS task set, the deployment can no longer be rolled back, manually or automatically. + * + * By default, the deployment will immediately terminate the 'blue' ECS task set after production traffic is successfully + * routed to the 'green' ECS task set. + * + * @default 0 + */ + readonly terminationWaitTime?: cdk.Duration; +} + +/** + * Construction properties for `EcsDeploymentGroup`. + */ +export interface EcsDeploymentGroupProps { + /** + * The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. + * + * @default One will be created for you. + */ + readonly application?: IEcsApplication; + + /** + * The physical, human-readable name of the CodeDeploy Deployment Group. + * + * @default An auto-generated name will be used. + */ + readonly deploymentGroupName?: string; + + /** + * The Deployment Configuration this Deployment Group uses. + * + * @default EcsDeploymentConfig.ALL_AT_ONCE + */ + readonly deploymentConfig?: IEcsDeploymentConfig; + + /** + * The CloudWatch alarms associated with this Deployment Group. + * CodeDeploy will stop (and optionally roll back) + * a deployment if during it any of the alarms trigger. + * + * Alarms can also be added after the Deployment Group is created using the `#addAlarm` method. + * + * @default [] + * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html + */ + readonly alarms?: cloudwatch.IAlarm[]; + + /** + * The service Role of this Deployment Group. + * + * @default - A new Role will be created. + */ + readonly role?: iam.IRole; + + /** + * The ECS service to deploy with this Deployment Group. + */ + readonly service: ecs.IBaseService; + + /** + * The configuration options for blue-green ECS deployments + */ + readonly blueGreenDeploymentConfig: EcsBlueGreenDeploymentConfig; + + /** + * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. + * + * @default false + */ + readonly ignorePollAlarmsFailure?: boolean; + + /** + * The auto-rollback configuration for this Deployment Group. + * + * @default - default AutoRollbackConfig. + */ + readonly autoRollback?: AutoRollbackConfig; +} + +/** + * A CodeDeploy deployment group that orchestrates ECS blue-green deployments. + * @resource AWS::CodeDeploy::DeploymentGroup + */ +export class EcsDeploymentGroup extends DeploymentGroupBase implements IEcsDeploymentGroup { + /** + * Reference an ECS Deployment Group defined outside the CDK app. + * + * Account and region for the DeploymentGroup are taken from the application. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param attrs the properties of the referenced Deployment Group + * @returns a Construct representing a reference to an existing Deployment Group + */ + public static fromEcsDeploymentGroupAttributes( + scope:Construct, + id: string, + attrs: EcsDeploymentGroupAttributes): IEcsDeploymentGroup { + return new ImportedEcsDeploymentGroup(scope, id, attrs); + } + + public readonly application: IEcsApplication; + public readonly deploymentConfig: IEcsDeploymentConfig; + /** + * The service Role of this Deployment Group. + */ + public readonly role: iam.IRole; + + private readonly alarms: cloudwatch.IAlarm[]; + + constructor(scope: Construct, id: string, props: EcsDeploymentGroupProps) { + super(scope, id, { + deploymentGroupName: props.deploymentGroupName, + role: props.role, + roleConstructId: 'ServiceRole', + }); + this.role = this._role; + + this.application = props.application || new EcsApplication(this, 'Application'); + this.alarms = props.alarms || []; + + this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AWSCodeDeployRoleForECS')); + this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || EcsDeploymentConfig.ALL_AT_ONCE); + + if (cdk.Resource.isOwnedResource(props.service)) { + const cfnSvc = (props.service as ecs.BaseService).node.defaultChild as ecs.CfnService; + if (cfnSvc.deploymentController === undefined || + (cfnSvc.deploymentController! as ecs.CfnService.DeploymentControllerProperty).type !== ecs.DeploymentControllerType.CODE_DEPLOY) { + throw new Error( + 'The ECS service associated with the deployment group must use the CODE_DEPLOY deployment controller type', + ); + } + + if (cfnSvc.taskDefinition !== (props.service as ecs.BaseService).taskDefinition.family) { + throw new Error( + 'The ECS service associated with the deployment group must specify the task definition using the task definition family name only. Otherwise, the task definition cannot be updated in the stack', + ); + } + } + + const removeAlarmsFromDeploymentGroup = cdk.FeatureFlags.of(this).isEnabled(CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP); + + const resource = new CfnDeploymentGroup(this, 'Resource', { + applicationName: this.application.applicationName, + serviceRoleArn: this.role.roleArn, + deploymentGroupName: this.physicalName, + deploymentConfigName: this.deploymentConfig.deploymentConfigName, + deploymentStyle: { + deploymentType: 'BLUE_GREEN', + deploymentOption: 'WITH_TRAFFIC_CONTROL', + }, + ecsServices: [{ + clusterName: props.service.cluster.clusterName, + serviceName: props.service.serviceName, + }], + blueGreenDeploymentConfiguration: cdk.Lazy.any({ + produce: () => this.renderBlueGreenDeploymentConfiguration(props.blueGreenDeploymentConfig), + }), + loadBalancerInfo: cdk.Lazy.any({ produce: () => this.renderLoadBalancerInfo(props.blueGreenDeploymentConfig) }), + alarmConfiguration: cdk.Lazy.any({ + produce: () => renderAlarmConfiguration(this.alarms, props.ignorePollAlarmsFailure, removeAlarmsFromDeploymentGroup), + }), + autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }), + }); + + this._setNameAndArn(resource, this.application); + + // If the deployment config is a construct, add a dependency to ensure the deployment config + // is created before the deployment group is. + if (Construct.isConstruct(this.deploymentConfig)) { + this.node.addDependency(this.deploymentConfig); + } + } + + /** + * Associates an additional alarm with this Deployment Group. + * + * @param alarm the alarm to associate with this Deployment Group + */ + public addAlarm(alarm: cloudwatch.IAlarm): void { + this.alarms.push(alarm); + } + + private renderBlueGreenDeploymentConfiguration(options: EcsBlueGreenDeploymentConfig): + CfnDeploymentGroup.BlueGreenDeploymentConfigurationProperty { + return { + deploymentReadyOption: { + actionOnTimeout: options.deploymentApprovalWaitTime ? 'STOP_DEPLOYMENT' : 'CONTINUE_DEPLOYMENT', + waitTimeInMinutes: options.deploymentApprovalWaitTime?.toMinutes() ?? 0, + }, + terminateBlueInstancesOnDeploymentSuccess: { + action: 'TERMINATE', + terminationWaitTimeInMinutes: options.terminationWaitTime?.toMinutes() ?? 0, + }, + }; + } + + private renderLoadBalancerInfo(options: EcsBlueGreenDeploymentConfig): CfnDeploymentGroup.LoadBalancerInfoProperty { + return { + targetGroupPairInfoList: [ + { + targetGroups: [ + { + name: options.blueTargetGroup.targetGroupName, + }, + { + name: options.greenTargetGroup.targetGroupName, + }, + ], + prodTrafficRoute: { + listenerArns: [ + options.listener.listenerArn, + ], + }, + testTrafficRoute: options.testListener ? { + listenerArns: [ + options.testListener.listenerArn, + ], + } : undefined, + }, + ], + }; + } +} + +/** + * Properties of a reference to a CodeDeploy ECS Deployment Group. + * + * @see EcsDeploymentGroup#fromEcsDeploymentGroupAttributes + */ +export interface EcsDeploymentGroupAttributes { + /** + * The reference to the CodeDeploy ECS Application + * that this Deployment Group belongs to. + */ + readonly application: IEcsApplication; + + /** + * The physical, human-readable name of the CodeDeploy ECS Deployment Group + * that we are referencing. + */ + readonly deploymentGroupName: string; + + /** + * The Deployment Configuration this Deployment Group uses. + * + * @default EcsDeploymentConfig.ALL_AT_ONCE + */ + readonly deploymentConfig?: IEcsDeploymentConfig; +} + +class ImportedEcsDeploymentGroup extends ImportedDeploymentGroupBase implements IEcsDeploymentGroup { + public readonly application: IEcsApplication; + public readonly deploymentConfig: IEcsDeploymentConfig; + + constructor(scope: Construct, id: string, props: EcsDeploymentGroupAttributes) { + super(scope, id, { + application: props.application, + deploymentGroupName: props.deploymentGroupName, + }); + + this.application = props.application; + this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || EcsDeploymentConfig.ALL_AT_ONCE); + } +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/ecs/index.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/ecs/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/ecs/index.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/ecs/index.ts diff --git a/packages/@aws-cdk/aws-codedeploy/lib/host-health-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/host-health-config.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/host-health-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/host-health-config.ts diff --git a/packages/@aws-cdk/aws-codedeploy/lib/index.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/index.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/application.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/application.ts new file mode 100644 index 0000000000000..015130afaecca --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/application.ts @@ -0,0 +1,100 @@ +import { ArnFormat, IResource, Resource, Stack, Arn } from '../../../core'; +import { Construct } from 'constructs'; +import { CfnApplication } from '../codedeploy.generated'; +import { arnForApplication, validateName } from '../private/utils'; + +/** + * Represents a reference to a CodeDeploy Application deploying to AWS Lambda. + * + * If you're managing the Application alongside the rest of your CDK resources, + * use the `LambdaApplication` class. + * + * If you want to reference an already existing Application, + * or one defined in a different CDK Stack, + * use the `LambdaApplication#fromLambdaApplicationName` method. + */ +export interface ILambdaApplication extends IResource { + /** @attribute */ + readonly applicationArn: string; + + /** @attribute */ + readonly applicationName: string; +} + +/** + * Construction properties for `LambdaApplication`. + */ +export interface LambdaApplicationProps { + /** + * The physical, human-readable name of the CodeDeploy Application. + * + * @default an auto-generated name will be used + */ + readonly applicationName?: string; +} + +/** + * A CodeDeploy Application that deploys to an AWS Lambda function. + * + * @resource AWS::CodeDeploy::Application + */ +export class LambdaApplication extends Resource implements ILambdaApplication { + /** + * Import an Application defined either outside the CDK, or in a different CDK Stack. + * + * The Application's account and region are assumed to be the same as the stack it is being imported + * into. If not, use `fromLambdaApplicationArn`. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param lambdaApplicationName the name of the application to import + * @returns a Construct representing a reference to an existing Application + */ + public static fromLambdaApplicationName(scope: Construct, id: string, lambdaApplicationName: string): ILambdaApplication { + class Import extends Resource implements ILambdaApplication { + public applicationArn = arnForApplication(Stack.of(scope), lambdaApplicationName); + public applicationName = lambdaApplicationName; + } + + return new Import(scope, id); + } + + /** + * Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param lambdaApplicationArn the ARN of the application to import + * @returns a Construct representing a reference to an existing Application + */ + public static fromLambdaApplicationArn(scope: Construct, id: string, lambdaApplicationArn: string): ILambdaApplication { + return new class extends Resource implements ILambdaApplication { + public applicationArn = lambdaApplicationArn; + public applicationName = Arn.split(lambdaApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? ''; + }(scope, id, { environmentFromArn: lambdaApplicationArn }); + } + + public readonly applicationArn: string; + public readonly applicationName: string; + + constructor(scope: Construct, id: string, props: LambdaApplicationProps = {}) { + super(scope, id, { + physicalName: props.applicationName, + }); + + const resource = new CfnApplication(this, 'Resource', { + applicationName: this.physicalName, + computePlatform: 'Lambda', + }); + + this.applicationName = this.getResourceNameAttribute(resource.ref); + this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(this), resource.ref), { + service: 'codedeploy', + resource: 'application', + resourceName: this.physicalName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + + this.node.addValidation({ validate: () => validateName('Application', this.physicalName) }); + } +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/custom-deployment-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/custom-deployment-config.ts similarity index 98% rename from packages/@aws-cdk/aws-codedeploy/lib/lambda/custom-deployment-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/lambda/custom-deployment-config.ts index 63e894aba6f21..ecc8b32320d04 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/lambda/custom-deployment-config.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/custom-deployment-config.ts @@ -1,5 +1,5 @@ -import { Duration, Names, Resource } from '@aws-cdk/core'; -import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '@aws-cdk/custom-resources'; +import { Duration, Names, Resource } from '../../../core'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '../../../custom-resources'; import { Construct } from 'constructs'; import { ILambdaDeploymentConfig } from './deployment-config'; import { arnForDeploymentConfig, validateName } from '../private/utils'; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/deployment-config.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/lambda/deployment-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/lambda/deployment-config.ts diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/deployment-group.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/deployment-group.ts new file mode 100644 index 0000000000000..2d4387490cf09 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/deployment-group.ts @@ -0,0 +1,300 @@ +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as cdk from '../../../core'; +import { CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP } from '../../../cx-api'; +import { Construct } from 'constructs'; +import { ILambdaApplication, LambdaApplication } from './application'; +import { ILambdaDeploymentConfig, LambdaDeploymentConfig } from './deployment-config'; +import { CfnDeploymentGroup } from '../codedeploy.generated'; +import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group'; +import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils'; +import { AutoRollbackConfig } from '../rollback-config'; + +/** + * Interface for a Lambda deployment groups. + */ +export interface ILambdaDeploymentGroup extends cdk.IResource { + /** + * The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. + */ + readonly application: ILambdaApplication; + + /** + * The physical name of the CodeDeploy Deployment Group. + * @attribute + */ + readonly deploymentGroupName: string; + + /** + * The ARN of this Deployment Group. + * @attribute + */ + readonly deploymentGroupArn: string; + + /** + * The Deployment Configuration this Group uses. + */ + readonly deploymentConfig: ILambdaDeploymentConfig; +} + +/** + * Construction properties for `LambdaDeploymentGroup`. + */ +export interface LambdaDeploymentGroupProps { + /** + * The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. + * + * @default - One will be created for you. + */ + readonly application?: ILambdaApplication; + + /** + * The physical, human-readable name of the CodeDeploy Deployment Group. + * + * @default - An auto-generated name will be used. + */ + readonly deploymentGroupName?: string; + + /** + * The Deployment Configuration this Deployment Group uses. + * + * @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES + */ + readonly deploymentConfig?: ILambdaDeploymentConfig; + + /** + * The CloudWatch alarms associated with this Deployment Group. + * CodeDeploy will stop (and optionally roll back) + * a deployment if during it any of the alarms trigger. + * + * Alarms can also be added after the Deployment Group is created using the `#addAlarm` method. + * + * @default [] + * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html + */ + readonly alarms?: cloudwatch.IAlarm[]; + + /** + * The service Role of this Deployment Group. + * + * @default - A new Role will be created. + */ + readonly role?: iam.IRole; + + /** + * Lambda Alias to shift traffic. Updating the version + * of the alias will trigger a CodeDeploy deployment. + * + * [disable-awslint:ref-via-interface] since we need to modify the alias CFN resource update policy + */ + readonly alias: lambda.Alias; + + /** + * The Lambda function to run before traffic routing starts. + * + * @default - None. + */ + readonly preHook?: lambda.IFunction; + + /** + * The Lambda function to run after traffic routing starts. + * + * @default - None. + */ + readonly postHook?: lambda.IFunction; + + /** + * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. + * + * @default false + */ + readonly ignorePollAlarmsFailure?: boolean; + + /** + * The auto-rollback configuration for this Deployment Group. + * + * @default - default AutoRollbackConfig. + */ + readonly autoRollback?: AutoRollbackConfig; +} + +/** + * @resource AWS::CodeDeploy::DeploymentGroup + */ +export class LambdaDeploymentGroup extends DeploymentGroupBase implements ILambdaDeploymentGroup { + /** + * Import an Lambda Deployment Group defined either outside the CDK app, or in a different AWS region. + * + * Account and region for the DeploymentGroup are taken from the application. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param attrs the properties of the referenced Deployment Group + * @returns a Construct representing a reference to an existing Deployment Group + */ + public static fromLambdaDeploymentGroupAttributes( + scope: Construct, + id: string, + attrs: LambdaDeploymentGroupAttributes): ILambdaDeploymentGroup { + return new ImportedLambdaDeploymentGroup(scope, id, attrs); + } + + public readonly application: ILambdaApplication; + public readonly deploymentConfig: ILambdaDeploymentConfig; + /** + * The service Role of this Deployment Group. + */ + public readonly role: iam.IRole; + + private readonly alarms: cloudwatch.IAlarm[]; + private preHook?: lambda.IFunction; + private postHook?: lambda.IFunction; + + constructor(scope: Construct, id: string, props: LambdaDeploymentGroupProps) { + super(scope, id, { + deploymentGroupName: props.deploymentGroupName, + role: props.role, + roleConstructId: 'ServiceRole', + }); + this.role = this._role; + + this.application = props.application || new LambdaApplication(this, 'Application'); + this.alarms = props.alarms || []; + + this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSCodeDeployRoleForLambdaLimited')); + this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES); + + const removeAlarmsFromDeploymentGroup = cdk.FeatureFlags.of(this).isEnabled(CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP); + + const resource = new CfnDeploymentGroup(this, 'Resource', { + applicationName: this.application.applicationName, + serviceRoleArn: this.role.roleArn, + deploymentGroupName: this.physicalName, + deploymentConfigName: this.deploymentConfig.deploymentConfigName, + deploymentStyle: { + deploymentType: 'BLUE_GREEN', + deploymentOption: 'WITH_TRAFFIC_CONTROL', + }, + alarmConfiguration: cdk.Lazy.any({ + produce: () => renderAlarmConfiguration(this.alarms, props.ignorePollAlarmsFailure, removeAlarmsFromDeploymentGroup), + }), + autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }), + }); + + this._setNameAndArn(resource, this.application); + + if (props.preHook) { + this.addPreHook(props.preHook); + } + if (props.postHook) { + this.addPostHook(props.postHook); + } + + (props.alias.node.defaultChild as lambda.CfnAlias).cfnOptions.updatePolicy = { + codeDeployLambdaAliasUpdate: { + applicationName: this.application.applicationName, + deploymentGroupName: resource.ref, + beforeAllowTrafficHook: cdk.Lazy.string({ produce: () => this.preHook && this.preHook.functionName }), + afterAllowTrafficHook: cdk.Lazy.string({ produce: () => this.postHook && this.postHook.functionName }), + }, + }; + + // If the deployment config is a construct, add a dependency to ensure the deployment config + // is created before the deployment group is. + if (this.deploymentConfig instanceof Construct) { + this.node.addDependency(this.deploymentConfig); + } + } + + /** + * Associates an additional alarm with this Deployment Group. + * + * @param alarm the alarm to associate with this Deployment Group + */ + public addAlarm(alarm: cloudwatch.IAlarm): void { + this.alarms.push(alarm); + } + + /** + * Associate a function to run before deployment begins. + * @param preHook function to run before deployment beings + * @throws an error if a pre-hook function is already configured + */ + public addPreHook(preHook: lambda.IFunction): void { + if (this.preHook !== undefined) { + throw new Error('A pre-hook function is already defined for this deployment group'); + } + this.preHook = preHook; + this.grantPutLifecycleEventHookExecutionStatus(this.preHook); + this.preHook.grantInvoke(this.role); + } + + /** + * Associate a function to run after deployment completes. + * @param postHook function to run after deployment completes + * @throws an error if a post-hook function is already configured + */ + public addPostHook(postHook: lambda.IFunction): void { + if (this.postHook !== undefined) { + throw new Error('A post-hook function is already defined for this deployment group'); + } + this.postHook = postHook; + this.grantPutLifecycleEventHookExecutionStatus(this.postHook); + this.postHook.grantInvoke(this.role); + } + + /** + * Grant a principal permission to codedeploy:PutLifecycleEventHookExecutionStatus + * on this deployment group resource. + * @param grantee to grant permission to + */ + public grantPutLifecycleEventHookExecutionStatus(grantee: iam.IGrantable): iam.Grant { + return iam.Grant.addToPrincipal({ + grantee, + resourceArns: [this.deploymentGroupArn], + actions: ['codedeploy:PutLifecycleEventHookExecutionStatus'], + }); + } +} + +/** + * Properties of a reference to a CodeDeploy Lambda Deployment Group. + * + * @see LambdaDeploymentGroup#fromLambdaDeploymentGroupAttributes + */ +export interface LambdaDeploymentGroupAttributes { + /** + * The reference to the CodeDeploy Lambda Application + * that this Deployment Group belongs to. + */ + readonly application: ILambdaApplication; + + /** + * The physical, human-readable name of the CodeDeploy Lambda Deployment Group + * that we are referencing. + */ + readonly deploymentGroupName: string; + + /** + * The Deployment Configuration this Deployment Group uses. + * + * @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES + */ + readonly deploymentConfig?: ILambdaDeploymentConfig; +} + +class ImportedLambdaDeploymentGroup extends ImportedDeploymentGroupBase implements ILambdaDeploymentGroup { + public readonly application: ILambdaApplication; + public readonly deploymentConfig: ILambdaDeploymentConfig; + + constructor(scope: Construct, id: string, props: LambdaDeploymentGroupAttributes) { + super(scope, id, { + application: props.application, + deploymentGroupName: props.deploymentGroupName, + }); + + this.application = props.application; + this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES); + } +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/lambda/index.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/lambda/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/lambda/index.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/lambda/index.ts diff --git a/packages/@aws-cdk/aws-codedeploy/lib/private/base-deployment-group.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/private/base-deployment-group.ts similarity index 97% rename from packages/@aws-cdk/aws-codedeploy/lib/private/base-deployment-group.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/private/base-deployment-group.ts index 7889d9b88e92c..578d00e8da275 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/private/base-deployment-group.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/private/base-deployment-group.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Resource, IResource, ArnFormat, Arn, Aws } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import { Resource, IResource, ArnFormat, Arn, Aws } from '../../../core'; import { Construct } from 'constructs'; import { isPredefinedDeploymentConfig } from './predefined-deployment-config'; import { validateName } from './utils'; diff --git a/packages/@aws-cdk/aws-codedeploy/lib/private/predefined-deployment-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/private/predefined-deployment-config.ts similarity index 96% rename from packages/@aws-cdk/aws-codedeploy/lib/private/predefined-deployment-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/private/predefined-deployment-config.ts index 3341a4df0af95..85a1d94c483f5 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/private/predefined-deployment-config.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/private/predefined-deployment-config.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from '../../../core'; import { IBaseDeploymentConfig } from '../base-deployment-config'; /** diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/private/utils.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/private/utils.ts new file mode 100644 index 0000000000000..15407050531f3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/private/utils.ts @@ -0,0 +1,125 @@ +import * as cloudwatch from '../../../aws-cloudwatch'; +import { Token, Stack, ArnFormat, Arn, Fn, Aws, IResource } from '../../../core'; +import { IPredefinedDeploymentConfig } from './predefined-deployment-config'; +import { IBaseDeploymentConfig } from '../base-deployment-config'; +import { CfnDeploymentGroup } from '../codedeploy.generated'; +import { AutoRollbackConfig } from '../rollback-config'; + +export function arnForApplication(stack: Stack, applicationName: string): string { + return stack.formatArn({ + service: 'codedeploy', + resource: 'application', + resourceName: applicationName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); +} + +export function nameFromDeploymentGroupArn(deploymentGroupArn: string): string { + const components = Arn.split(deploymentGroupArn, ArnFormat.COLON_RESOURCE_NAME); + return Fn.select(1, Fn.split('/', components.resourceName ?? '')); +} + +export function arnForDeploymentConfig(name: string, resource?: IResource): string { + return Arn.format({ + partition: Aws.PARTITION, + account: resource?.env.account ?? Aws.ACCOUNT_ID, + region: resource?.env.region ?? Aws.REGION, + service: 'codedeploy', + resource: 'deploymentconfig', + resourceName: name, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); +} + +export function renderAlarmConfiguration(alarms: cloudwatch.IAlarm[], ignorePollAlarmFailure: boolean | undefined, removeAlarms = true): +CfnDeploymentGroup.AlarmConfigurationProperty | undefined { + if (removeAlarms) { + return { + alarms: alarms.length > 0 ? alarms.map(a => ({ name: a.alarmName })) : undefined, + enabled: alarms.length > 0, + ignorePollAlarmFailure, + }; + } + + return alarms.length === 0 + ? undefined + : { + alarms: alarms.map(a => ({ name: a.alarmName })), + enabled: true, + ignorePollAlarmFailure, + }; +} + +export function deploymentConfig(name: string): IBaseDeploymentConfig & IPredefinedDeploymentConfig { + return { + deploymentConfigName: name, + deploymentConfigArn: arnForDeploymentConfig(name), + bindEnvironment: (resource) => ({ + deploymentConfigName: name, + deploymentConfigArn: arnForDeploymentConfig(name, resource), + }), + }; +} + +enum AutoRollbackEvent { + DEPLOYMENT_FAILURE = 'DEPLOYMENT_FAILURE', + DEPLOYMENT_STOP_ON_ALARM = 'DEPLOYMENT_STOP_ON_ALARM', + DEPLOYMENT_STOP_ON_REQUEST = 'DEPLOYMENT_STOP_ON_REQUEST' +} + +export function renderAutoRollbackConfiguration(alarms: cloudwatch.IAlarm[], autoRollbackConfig: AutoRollbackConfig = {}): +CfnDeploymentGroup.AutoRollbackConfigurationProperty | undefined { + const events = new Array(); + + // we roll back failed deployments by default + if (autoRollbackConfig.failedDeployment !== false) { + events.push(AutoRollbackEvent.DEPLOYMENT_FAILURE); + } + + // we _do not_ roll back stopped deployments by default + if (autoRollbackConfig.stoppedDeployment === true) { + events.push(AutoRollbackEvent.DEPLOYMENT_STOP_ON_REQUEST); + } + + // we _do not_ roll back alarm-triggering deployments by default + // unless the Deployment Group has at least one alarm + if (autoRollbackConfig.deploymentInAlarm !== false) { + if (alarms.length > 0) { + events.push(AutoRollbackEvent.DEPLOYMENT_STOP_ON_ALARM); + } else if (autoRollbackConfig.deploymentInAlarm === true) { + throw new Error( + "The auto-rollback setting 'deploymentInAlarm' does not have any effect unless you associate " + + 'at least one CloudWatch alarm with the Deployment Group'); + } + } + + if (autoRollbackConfig.failedDeployment === false + && autoRollbackConfig.stoppedDeployment !== true + && autoRollbackConfig.deploymentInAlarm === false) { + return { + enabled: false, + }; + } + + return events.length > 0 + ? { + enabled: true, + events, + } + : undefined; +} + +export function validateName(type: 'Application' | 'Deployment group' | 'Deployment config', name: string): string[] { + const ret = []; + + if (!Token.isUnresolved(name) && name !== undefined) { + if (name.length > 100) { + ret.push(`${type} name: "${name}" can be a max of 100 characters.`); + } + if (!/^[a-z0-9._+=,@-]+$/i.test(name)) { + ret.push(`${type} name: "${name}" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).`); + } + } + + return ret; +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/rollback-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/rollback-config.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/rollback-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/rollback-config.ts diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/server/application.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/server/application.ts new file mode 100644 index 0000000000000..c0b103dfc7b72 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/server/application.ts @@ -0,0 +1,101 @@ +import { ArnFormat, IResource, Resource, Stack, Arn } from '../../../core'; +import { Construct } from 'constructs'; +import { CfnApplication } from '../codedeploy.generated'; +import { arnForApplication, validateName } from '../private/utils'; + +/** + * Represents a reference to a CodeDeploy Application deploying to EC2/on-premise instances. + * + * If you're managing the Application alongside the rest of your CDK resources, + * use the `ServerApplication` class. + * + * If you want to reference an already existing Application, + * or one defined in a different CDK Stack, + * use the `#fromServerApplicationName` method. + */ +export interface IServerApplication extends IResource { + /** @attribute */ + readonly applicationArn: string; + + /** @attribute */ + readonly applicationName: string; +} + +/** + * Construction properties for `ServerApplication`. + */ +export interface ServerApplicationProps { + /** + * The physical, human-readable name of the CodeDeploy Application. + * + * @default an auto-generated name will be used + */ + readonly applicationName?: string; +} + +/** + * A CodeDeploy Application that deploys to EC2/on-premise instances. + * + * @resource AWS::CodeDeploy::Application + */ +export class ServerApplication extends Resource implements IServerApplication { + /** + * Import an Application defined either outside the CDK app, or in a different region. + * + * The Application's account and region are assumed to be the same as the stack it is being imported + * into. If not, use `fromServerApplicationArn`. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param serverApplicationName the name of the application to import + * @returns a Construct representing a reference to an existing Application + */ + public static fromServerApplicationName(scope: Construct, id: string, serverApplicationName: string): IServerApplication { + class Import extends Resource implements IServerApplication { + public readonly applicationArn = arnForApplication(Stack.of(scope), serverApplicationName); + public readonly applicationName = serverApplicationName; + } + + return new Import(scope, id); + } + + /** + * Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param serverApplicationArn the ARN of the application to import + * @returns a Construct representing a reference to an existing Application + */ + public static fromServerApplicationArn(scope: Construct, id: string, serverApplicationArn: string): IServerApplication { + return new class extends Resource implements IServerApplication { + public applicationArn = serverApplicationArn; + public applicationName = Arn.split(serverApplicationArn, ArnFormat.COLON_RESOURCE_NAME).resourceName ?? ''; + }(scope, id, { environmentFromArn: serverApplicationArn }); + } + + public readonly applicationArn: string; + public readonly applicationName: string; + + constructor(scope: Construct, id: string, props: ServerApplicationProps = {}) { + super(scope, id, { + physicalName: props.applicationName, + }); + + const resource = new CfnApplication(this, 'Resource', { + applicationName: this.physicalName, + computePlatform: 'Server', + }); + + this.applicationName = this.getResourceNameAttribute(resource.ref); + this.applicationArn = this.getResourceArnAttribute(arnForApplication(Stack.of(scope), resource.ref), { + service: 'codedeploy', + resource: 'application', + resourceName: this.physicalName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + + this.node.addValidation({ validate: () => validateName('Application', this.physicalName) }); + } + +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/server/deployment-config.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/server/deployment-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/server/deployment-config.ts diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/server/deployment-group.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/server/deployment-group.ts new file mode 100644 index 0000000000000..278c10418d634 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/server/deployment-group.ts @@ -0,0 +1,461 @@ +import * as autoscaling from '../../../aws-autoscaling'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import * as cdk from '../../../core'; +import { CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP } from '../../../cx-api'; +import { Construct } from 'constructs'; +import { IServerApplication, ServerApplication } from './application'; +import { IServerDeploymentConfig, ServerDeploymentConfig } from './deployment-config'; +import { LoadBalancer, LoadBalancerGeneration } from './load-balancer'; +import { CfnDeploymentGroup } from '../codedeploy.generated'; +import { ImportedDeploymentGroupBase, DeploymentGroupBase } from '../private/base-deployment-group'; +import { renderAlarmConfiguration, renderAutoRollbackConfiguration } from '../private/utils'; +import { AutoRollbackConfig } from '../rollback-config'; + +export interface IServerDeploymentGroup extends cdk.IResource { + readonly application: IServerApplication; + readonly role?: iam.IRole; + /** + * @attribute + */ + readonly deploymentGroupName: string; + + /** + * @attribute + */ + readonly deploymentGroupArn: string; + readonly deploymentConfig: IServerDeploymentConfig; + readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[]; +} + +/** + * Properties of a reference to a CodeDeploy EC2/on-premise Deployment Group. + * + * @see ServerDeploymentGroup#import + */ +export interface ServerDeploymentGroupAttributes { + /** + * The reference to the CodeDeploy EC2/on-premise Application + * that this Deployment Group belongs to. + */ + readonly application: IServerApplication; + + /** + * The physical, human-readable name of the CodeDeploy EC2/on-premise Deployment Group + * that we are referencing. + */ + readonly deploymentGroupName: string; + + /** + * The Deployment Configuration this Deployment Group uses. + * + * @default ServerDeploymentConfig#OneAtATime + */ + readonly deploymentConfig?: IServerDeploymentConfig; +} + +class ImportedServerDeploymentGroup extends ImportedDeploymentGroupBase implements IServerDeploymentGroup { + public readonly application: IServerApplication; + public readonly role?: iam.Role = undefined; + public readonly autoScalingGroups?: autoscaling.AutoScalingGroup[] = undefined; + public readonly deploymentConfig: IServerDeploymentConfig; + + constructor(scope: Construct, id: string, props: ServerDeploymentGroupAttributes) { + super(scope, id, { + application: props.application, + deploymentGroupName: props.deploymentGroupName, + }); + + this.application = props.application; + this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || ServerDeploymentConfig.ONE_AT_A_TIME); + } +} + +/** + * Represents a group of instance tags. + * An instance will match a group if it has a tag matching + * any of the group's tags by key and any of the provided values - + * in other words, tag groups follow 'or' semantics. + * If the value for a given key is an empty array, + * an instance will match when it has a tag with the given key, + * regardless of the value. + * If the key is an empty string, any tag, + * regardless of its key, with any of the given values, will match. + */ +export type InstanceTagGroup = {[key: string]: string[]}; + +/** + * Represents a set of instance tag groups. + * An instance will match a set if it matches all of the groups in the set - + * in other words, sets follow 'and' semantics. + * You can have a maximum of 3 tag groups inside a set. + */ +export class InstanceTagSet { + private readonly _instanceTagGroups: InstanceTagGroup[]; + + constructor(...instanceTagGroups: InstanceTagGroup[]) { + if (instanceTagGroups.length > 3) { + throw new Error('An instance tag set can have a maximum of 3 instance tag groups, ' + + `but ${instanceTagGroups.length} were provided`); + } + this._instanceTagGroups = instanceTagGroups; + } + + public get instanceTagGroups(): InstanceTagGroup[] { + return this._instanceTagGroups.slice(); + } +} + +/** + * Construction properties for `ServerDeploymentGroup`. + */ +export interface ServerDeploymentGroupProps { + /** + * The CodeDeploy EC2/on-premise Application this Deployment Group belongs to. + * + * @default - A new Application will be created. + */ + readonly application?: IServerApplication; + + /** + * The service Role of this Deployment Group. + * + * @default - A new Role will be created. + */ + readonly role?: iam.IRole; + + /** + * The physical, human-readable name of the CodeDeploy Deployment Group. + * + * @default - An auto-generated name will be used. + */ + readonly deploymentGroupName?: string; + + /** + * The EC2/on-premise Deployment Configuration to use for this Deployment Group. + * + * @default ServerDeploymentConfig#OneAtATime + */ + readonly deploymentConfig?: IServerDeploymentConfig; + + /** + * The auto-scaling groups belonging to this Deployment Group. + * + * Auto-scaling groups can also be added after the Deployment Group is created + * using the `#addAutoScalingGroup` method. + * + * [disable-awslint:ref-via-interface] is needed because we update userdata + * for ASGs to install the codedeploy agent. + * + * @default [] + */ + readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[]; + + /** + * If you've provided any auto-scaling groups with the `#autoScalingGroups` property, + * you can set this property to add User Data that installs the CodeDeploy agent on the instances. + * + * @default true + * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html + */ + readonly installAgent?: boolean; + + /** + * The load balancer to place in front of this Deployment Group. + * Can be created from either a classic Elastic Load Balancer, + * or an Application Load Balancer / Network Load Balancer Target Group. + * + * @default - Deployment Group will not have a load balancer defined. + */ + readonly loadBalancer?: LoadBalancer; + + /** + * All EC2 instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. + * + * @default - No additional EC2 instances will be added to the Deployment Group. + */ + readonly ec2InstanceTags?: InstanceTagSet; + + /** + * All on-premise instances matching the given set of tags when a deployment occurs will be added to this Deployment Group. + * + * @default - No additional on-premise instances will be added to the Deployment Group. + */ + readonly onPremiseInstanceTags?: InstanceTagSet; + + /** + * The CloudWatch alarms associated with this Deployment Group. + * CodeDeploy will stop (and optionally roll back) + * a deployment if during it any of the alarms trigger. + * + * Alarms can also be added after the Deployment Group is created using the `#addAlarm` method. + * + * @default [] + * @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html + */ + readonly alarms?: cloudwatch.IAlarm[]; + + /** + * Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. + * + * @default false + */ + readonly ignorePollAlarmsFailure?: boolean; + + /** + * The auto-rollback configuration for this Deployment Group. + * + * @default - default AutoRollbackConfig. + */ + readonly autoRollback?: AutoRollbackConfig; +} + +/** + * A CodeDeploy Deployment Group that deploys to EC2/on-premise instances. + * @resource AWS::CodeDeploy::DeploymentGroup + */ +export class ServerDeploymentGroup extends DeploymentGroupBase implements IServerDeploymentGroup { + /** + * Import an EC2/on-premise Deployment Group defined either outside the CDK app, + * or in a different region. + * + * @param scope the parent Construct for this new Construct + * @param id the logical ID of this new Construct + * @param attrs the properties of the referenced Deployment Group + * @returns a Construct representing a reference to an existing Deployment Group + */ + public static fromServerDeploymentGroupAttributes( + scope: Construct, + id: string, + attrs: ServerDeploymentGroupAttributes): IServerDeploymentGroup { + return new ImportedServerDeploymentGroup(scope, id, attrs); + } + + public readonly application: IServerApplication; + public readonly deploymentConfig: IServerDeploymentConfig; + /** + * The service Role of this Deployment Group. + */ + public readonly role?: iam.IRole; + + private readonly _autoScalingGroups: autoscaling.IAutoScalingGroup[]; + private readonly installAgent: boolean; + private readonly codeDeployBucket: s3.IBucket; + private readonly alarms: cloudwatch.IAlarm[]; + + constructor(scope: Construct, id: string, props: ServerDeploymentGroupProps = {}) { + super(scope, id, { + deploymentGroupName: props.deploymentGroupName, + role: props.role, + roleConstructId: 'Role', + }); + this.role = this._role; + + this.application = props.application || new ServerApplication(this, 'Application', { + applicationName: props.deploymentGroupName === cdk.PhysicalName.GENERATE_IF_NEEDED ? cdk.PhysicalName.GENERATE_IF_NEEDED : undefined, + }); + this.deploymentConfig = this._bindDeploymentConfig(props.deploymentConfig || ServerDeploymentConfig.ONE_AT_A_TIME); + + this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSCodeDeployRole')); + this._autoScalingGroups = props.autoScalingGroups || []; + this.installAgent = props.installAgent ?? true; + this.codeDeployBucket = s3.Bucket.fromBucketName(this, 'Bucket', `aws-codedeploy-${cdk.Stack.of(this).region}`); + for (const asg of this._autoScalingGroups) { + this.addCodeDeployAgentInstallUserData(asg); + } + + this.alarms = props.alarms || []; + + const removeAlarmsFromDeploymentGroup = cdk.FeatureFlags.of(this).isEnabled(CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP); + + const resource = new CfnDeploymentGroup(this, 'Resource', { + applicationName: this.application.applicationName, + deploymentGroupName: this.physicalName, + serviceRoleArn: this.role.roleArn, + deploymentConfigName: props.deploymentConfig && + props.deploymentConfig.deploymentConfigName, + autoScalingGroups: cdk.Lazy.list({ produce: () => this._autoScalingGroups.map(asg => asg.autoScalingGroupName) }, { omitEmpty: true }), + loadBalancerInfo: this.loadBalancerInfo(props.loadBalancer), + deploymentStyle: props.loadBalancer === undefined + ? undefined + : { + deploymentOption: 'WITH_TRAFFIC_CONTROL', + }, + ec2TagSet: this.ec2TagSet(props.ec2InstanceTags), + onPremisesTagSet: this.onPremiseTagSet(props.onPremiseInstanceTags), + alarmConfiguration: cdk.Lazy.any({ + produce: () => renderAlarmConfiguration(this.alarms, props.ignorePollAlarmsFailure, removeAlarmsFromDeploymentGroup), + }), + autoRollbackConfiguration: cdk.Lazy.any({ produce: () => renderAutoRollbackConfiguration(this.alarms, props.autoRollback) }), + }); + + this._setNameAndArn(resource, this.application); + } + + /** + * Adds an additional auto-scaling group to this Deployment Group. + * + * @param asg the auto-scaling group to add to this Deployment Group. + * [disable-awslint:ref-via-interface] is needed in order to install the code + * deploy agent by updating the ASGs user data. + */ + public addAutoScalingGroup(asg: autoscaling.AutoScalingGroup): void { + this._autoScalingGroups.push(asg); + this.addCodeDeployAgentInstallUserData(asg); + } + + /** + * Associates an additional alarm with this Deployment Group. + * + * @param alarm the alarm to associate with this Deployment Group + */ + public addAlarm(alarm: cloudwatch.IAlarm): void { + this.alarms.push(alarm); + } + + public get autoScalingGroups(): autoscaling.IAutoScalingGroup[] | undefined { + return this._autoScalingGroups.slice(); + } + + private addCodeDeployAgentInstallUserData(asg: autoscaling.IAutoScalingGroup): void { + if (!this.installAgent) { + return; + } + + this.codeDeployBucket.grantRead(asg, 'latest/*'); + + switch (asg.osType) { + case ec2.OperatingSystemType.LINUX: + asg.addUserData( + 'set +e', // make sure we don't exit on the `which` failing + 'PKG_CMD=`which yum 2>/dev/null`', + 'set -e', // continue with failing on error + 'if [ -z "$PKG_CMD" ]; then', + 'PKG_CMD=apt-get', + 'else', + 'PKG_CMD=yum', + 'fi', + '$PKG_CMD update -y', + 'set +e', // make sure we don't exit on the next command failing (we check its exit code below) + '$PKG_CMD install -y ruby2.0', + 'RUBY2_INSTALL=$?', + 'set -e', // continue with failing on error + 'if [ $RUBY2_INSTALL -ne 0 ]; then', + '$PKG_CMD install -y ruby', + 'fi', + 'AWS_CLI_PACKAGE_NAME=awscli', + 'if [ "$PKG_CMD" = "yum" ]; then', + 'AWS_CLI_PACKAGE_NAME=aws-cli', + 'fi', + '$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME', + 'TMP_DIR=`mktemp -d`', + 'cd $TMP_DIR', + `aws s3 cp s3://aws-codedeploy-${cdk.Stack.of(this).region}/latest/install . --region ${cdk.Stack.of(this).region}`, + 'chmod +x ./install', + './install auto', + 'rm -fr $TMP_DIR', + ); + break; + case ec2.OperatingSystemType.WINDOWS: + asg.addUserData( + 'Set-Variable -Name TEMPDIR -Value (New-TemporaryFile).DirectoryName', + `aws s3 cp s3://aws-codedeploy-${cdk.Stack.of(this).region}/latest/codedeploy-agent.msi $TEMPDIR\\codedeploy-agent.msi`, + 'cd $TEMPDIR', + '.\\codedeploy-agent.msi /quiet /l c:\\temp\\host-agent-install-log.txt', + ); + break; + } + } + + private loadBalancerInfo(loadBalancer?: LoadBalancer): + CfnDeploymentGroup.LoadBalancerInfoProperty | undefined { + if (!loadBalancer) { + return undefined; + } + + switch (loadBalancer.generation) { + case LoadBalancerGeneration.FIRST: + return { + elbInfoList: [ + { name: loadBalancer.name }, + ], + }; + case LoadBalancerGeneration.SECOND: + return { + targetGroupInfoList: [ + { name: loadBalancer.name }, + ], + }; + } + } + + private ec2TagSet(tagSet?: InstanceTagSet): + CfnDeploymentGroup.EC2TagSetProperty | undefined { + if (!tagSet || tagSet.instanceTagGroups.length === 0) { + return undefined; + } + + return { + ec2TagSetList: tagSet.instanceTagGroups.map(tagGroup => { + return { + ec2TagGroup: this.tagGroup2TagsArray(tagGroup) as + CfnDeploymentGroup.EC2TagFilterProperty[], + }; + }), + }; + } + + private onPremiseTagSet(tagSet?: InstanceTagSet): + CfnDeploymentGroup.OnPremisesTagSetProperty | undefined { + if (!tagSet || tagSet.instanceTagGroups.length === 0) { + return undefined; + } + + return { + onPremisesTagSetList: tagSet.instanceTagGroups.map(tagGroup => { + return { + onPremisesTagGroup: this.tagGroup2TagsArray(tagGroup), + }; + }), + }; + } + + private tagGroup2TagsArray(tagGroup: InstanceTagGroup): CfnDeploymentGroup.TagFilterProperty[] { + const tagsInGroup = new Array(); + for (const tagKey in tagGroup) { + if (tagGroup.hasOwnProperty(tagKey)) { + const tagValues = tagGroup[tagKey]; + if (tagKey.length > 0) { + if (tagValues.length > 0) { + for (const tagValue of tagValues) { + tagsInGroup.push({ + key: tagKey, + value: tagValue, + type: 'KEY_AND_VALUE', + }); + } + } else { + tagsInGroup.push({ + key: tagKey, + type: 'KEY_ONLY', + }); + } + } else { + if (tagValues.length > 0) { + for (const tagValue of tagValues) { + tagsInGroup.push({ + value: tagValue, + type: 'VALUE_ONLY', + }); + } + } else { + throw new Error('Cannot specify both an empty key and no values for an instance tag filter'); + } + } + } + } + return tagsInGroup; + } +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/server/index.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/server/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codedeploy/lib/server/index.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/server/index.ts diff --git a/packages/aws-cdk-lib/aws-codedeploy/lib/server/load-balancer.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/server/load-balancer.ts new file mode 100644 index 0000000000000..e7d336f1d4c30 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/server/load-balancer.ts @@ -0,0 +1,69 @@ +import * as elb from '../../../aws-elasticloadbalancing'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; + +/** + * The generations of AWS load balancing solutions. + */ +export enum LoadBalancerGeneration { + /** + * The first generation (ELB Classic). + */ + FIRST = 0, + + /** + * The second generation (ALB and NLB). + */ + SECOND = 1 +} + +/** + * An interface of an abstract load balancer, as needed by CodeDeploy. + * Create instances using the static factory methods: + * `#classic`, `#application` and `#network`. + */ +export abstract class LoadBalancer { + /** + * Creates a new CodeDeploy load balancer from a Classic ELB Load Balancer. + * + * @param loadBalancer a classic ELB Load Balancer + */ + public static classic(loadBalancer: elb.LoadBalancer): LoadBalancer { + class ClassicLoadBalancer extends LoadBalancer { + public readonly generation = LoadBalancerGeneration.FIRST; + public readonly name = loadBalancer.loadBalancerName; + } + + return new ClassicLoadBalancer(); + } + + /** + * Creates a new CodeDeploy load balancer from an Application Load Balancer Target Group. + * + * @param albTargetGroup an ALB Target Group + */ + public static application(albTargetGroup: elbv2.IApplicationTargetGroup): LoadBalancer { + class AlbLoadBalancer extends LoadBalancer { + public readonly generation = LoadBalancerGeneration.SECOND; + public readonly name = albTargetGroup.targetGroupName; + } + + return new AlbLoadBalancer(); + } + + /** + * Creates a new CodeDeploy load balancer from a Network Load Balancer Target Group. + * + * @param nlbTargetGroup an NLB Target Group + */ + public static network(nlbTargetGroup: elbv2.INetworkTargetGroup): LoadBalancer { + class NlbLoadBalancer extends LoadBalancer { + public readonly generation = LoadBalancerGeneration.SECOND; + public readonly name = nlbTargetGroup.targetGroupName; + } + + return new NlbLoadBalancer(); + } + + public abstract readonly generation: LoadBalancerGeneration; + public abstract readonly name: string; +} diff --git a/packages/@aws-cdk/aws-codedeploy/lib/traffic-routing-config.ts b/packages/aws-cdk-lib/aws-codedeploy/lib/traffic-routing-config.ts similarity index 99% rename from packages/@aws-cdk/aws-codedeploy/lib/traffic-routing-config.ts rename to packages/aws-cdk-lib/aws-codedeploy/lib/traffic-routing-config.ts index fe7440ecdefbe..112c29581b63a 100644 --- a/packages/@aws-cdk/aws-codedeploy/lib/traffic-routing-config.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/lib/traffic-routing-config.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/ecs/application.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/ecs/application.test.ts new file mode 100644 index 0000000000000..57992cfa8d79c --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/ecs/application.test.ts @@ -0,0 +1,55 @@ +import { Template } from '../../../assertions'; +import * as cdk from '../../../core'; +import * as codedeploy from '../../lib'; + +describe('CodeDeploy ECS Application', () => { + test('can be created', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsApplication(stack, 'MyApp'); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { + ComputePlatform: 'ECS', + }); + }); + + test('can be created with explicit name', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsApplication(stack, 'MyApp', { + applicationName: 'my-name', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { + ApplicationName: 'my-name', + ComputePlatform: 'ECS', + }); + }); + + test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.EcsApplication(stack, 'MyApp', { + applicationName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Application name: "${'a'.repeat(101)}" can be a max of 100 characters.`); + }); + + test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.EcsApplication(stack, 'MyApp', { + applicationName: 'my name', + }); + + expect(() => app.synth()).toThrow('Application name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); + }); + + test('can be imported', () => { + const stack = new cdk.Stack(); + + const application = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'MyApp', 'MyApp'); + + expect(application).not.toEqual(undefined); + expect(application.applicationName).toEqual('MyApp'); + }); +}); diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/ecs/deployment-config.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/ecs/deployment-config.test.ts new file mode 100644 index 0000000000000..0f5bc6916b0c7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/ecs/deployment-config.test.ts @@ -0,0 +1,142 @@ +import { Template } from '../../../assertions'; +import * as cdk from '../../../core'; +import * as codedeploy from '../../lib'; +import { TrafficRouting } from '../../lib'; + +/* eslint-disable quote-props */ + +let stack: cdk.Stack; + +beforeEach(() => { + stack = new cdk.Stack(); +}); + +test('can create default config', () => { + // WHEN + new codedeploy.EcsDeploymentConfig(stack, 'MyConfig'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'ECS', + 'TrafficRoutingConfig': { + 'Type': 'AllAtOnce', + }, + }); +}); + +test('can create all-at-once config', () => { + // WHEN + new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.allAtOnce(), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'ECS', + 'TrafficRoutingConfig': { + 'Type': 'AllAtOnce', + }, + }); +}); + +test('can create linear config', () => { + // WHEN + new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedLinear({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'ECS', + 'TrafficRoutingConfig': { + 'TimeBasedLinear': { + 'LinearInterval': 1, + 'LinearPercentage': 5, + }, + 'Type': 'TimeBasedLinear', + }, + }); +}); + +test('can create canary config', () => { + // WHEN + new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'ECS', + 'TrafficRoutingConfig': { + 'TimeBasedCanary': { + 'CanaryInterval': 1, + 'CanaryPercentage': 5, + }, + 'Type': 'TimeBasedCanary', + }, + }); +}); + +test('can create a config with a specific name', () => { + // WHEN + new codedeploy.EcsDeploymentConfig(stack, 'MyConfig', { + deploymentConfigName: 'MyCanaryConfig', + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'ECS', + 'DeploymentConfigName': 'MyCanaryConfig', + 'TrafficRoutingConfig': { + 'TimeBasedCanary': { + 'CanaryInterval': 1, + 'CanaryPercentage': 5, + }, + 'Type': 'TimeBasedCanary', + }, + }); +}); + +test('can be imported', () => { + const deploymentConfig = codedeploy.EcsDeploymentConfig.fromEcsDeploymentConfigName(stack, 'MyDC', 'MyDC'); + + expect(deploymentConfig).not.toEqual(undefined); +}); + +test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stackWithApp = new cdk.Stack(app); + new codedeploy.EcsDeploymentConfig(stackWithApp, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + deploymentConfigName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Deployment config name: "${'a'.repeat(101)}" can be a max of 100 characters.`); +}); + +test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stackWithApp = new cdk.Stack(app); + new codedeploy.EcsDeploymentConfig(stackWithApp, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + deploymentConfigName: 'my name', + }); + + expect(() => app.synth()).toThrow('Deployment config name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); +}); diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/ecs/deployment-group.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/ecs/deployment-group.test.ts new file mode 100644 index 0000000000000..dc8a4539b4c7e --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/ecs/deployment-group.test.ts @@ -0,0 +1,887 @@ +import { Match, Template } from '../../../assertions'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; +import { Duration, Stack } from '../../../core'; +import * as codedeploy from '../../lib'; + +const mockCluster = 'my-cluster'; +const mockService = 'my-service'; +const mockRegion = 'my-region'; +const mockAccount = 'my-account'; + +function mockEcsService(stack: cdk.Stack): ecs.IBaseService { + const serviceArn = `arn:aws:ecs:${mockRegion}:${mockAccount}:service/${mockCluster}/${mockService}`; + return ecs.BaseService.fromServiceArnWithCluster(stack, 'Service', serviceArn); +} + +function mockTargetGroup(stack: cdk.Stack, id: string): elbv2.ITargetGroup { + const targetGroupArn = `arn:aws:elasticloadbalancing:${mockRegion}:${mockAccount}:targetgroup/${id}/f7a80aba5edd5980`; + return elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, id, { + targetGroupArn, + }); +} + +function mockListener(stack: cdk.Stack, id: string): elbv2.IListener { + const listenerArn = `arn:aws:elasticloadbalancing:${mockRegion}:${mockAccount}:listener/app/myloadbalancer/lb-12345/${id}`; + const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack, 'MySecurityGroup' + id, 'sg-12345678'); + return elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener' + id, { + listenerArn, + securityGroup, + }); +} + +describe('CodeDeploy ECS DeploymentGroup', () => { + describe('imported with fromEcsDeploymentGroupAttributes', () => { + test('defaults the Deployment Config to AllAtOnce', () => { + const stack = new cdk.Stack(); + + const ecsApp = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'EA', 'EcsApplication'); + const importedGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'EDG', { + application: ecsApp, + deploymentGroupName: 'EcsDeploymentGroup', + }); + + expect(importedGroup.deploymentConfig.deploymentConfigName).toEqual('CodeDeployDefault.ECSAllAtOnce'); + }); + }); + + test('can be created with default configuration', () => { + const stack = new cdk.Stack(); + stack.node.setContext('@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup', true); + + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResource('AWS::CodeDeploy::DeploymentGroup', { + Type: 'AWS::CodeDeploy::DeploymentGroup', + Properties: { + ApplicationName: { + Ref: 'MyDGApplication57B1E402', + }, + ServiceRoleArn: { + 'Fn::GetAtt': [ + 'MyDGServiceRole5E94FD88', + 'Arn', + ], + }, + AlarmConfiguration: { + Enabled: false, + Alarms: Match.absent(), + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + ], + }, + BlueGreenDeploymentConfiguration: { + DeploymentReadyOption: { + ActionOnTimeout: 'CONTINUE_DEPLOYMENT', + WaitTimeInMinutes: 0, + }, + TerminateBlueInstancesOnDeploymentSuccess: { + Action: 'TERMINATE', + TerminationWaitTimeInMinutes: 0, + }, + }, + DeploymentConfigName: 'CodeDeployDefault.ECSAllAtOnce', + DeploymentStyle: { + DeploymentOption: 'WITH_TRAFFIC_CONTROL', + DeploymentType: 'BLUE_GREEN', + }, + ECSServices: [ + { + ClusterName: 'my-cluster', + ServiceName: 'my-service', + }, + ], + LoadBalancerInfo: { + TargetGroupPairInfoList: [ + { + ProdTrafficRoute: { + ListenerArns: [ + 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/prod', + ], + }, + TargetGroups: [ + { + Name: 'blue', + }, + { + Name: 'green', + }, + ], + }, + ], + }, + }, + }); + + Template.fromStack(stack).hasResource('AWS::CodeDeploy::Application', { + Type: 'AWS::CodeDeploy::Application', + Properties: { + ComputePlatform: 'ECS', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: { + 'Fn::FindInMap': [ + 'ServiceprincipalMap', + { + Ref: 'AWS::Region', + }, + 'codedeploy', + ], + }, + }, + }], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AWSCodeDeployRoleForECS', + ], + ], + }, + ], + }); + }); + + test('can be created with explicit name', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'test', + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + DeploymentGroupName: 'test', + }); + }); + + test('can be created with explicit application', () => { + const stack = new cdk.Stack(); + const application = codedeploy.EcsApplication.fromEcsApplicationName(stack, 'A', 'myapp'); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + application, + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + ApplicationName: 'myapp', + }); + }); + + test('can be created with explicit deployment config', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_15MINUTES, + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + DeploymentConfigName: 'CodeDeployDefault.ECSCanary10Percent15Minutes', + }); + }); + + test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'a'.repeat(101), + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + expect(() => app.synth()).toThrow(`Deployment group name: "${'a'.repeat(101)}" can be a max of 100 characters.`); + }); + + test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'my name', + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + expect(() => app.synth()).toThrow('Deployment group name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); + }); + + test('fail when ECS service does not use CODE_DEPLOY deployment controller', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef'); + + taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }); + + const service = new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + deploymentController: { + type: ecs.DeploymentControllerType.ECS, + }, + }); + + expect(() => new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'a'.repeat(101), + service, + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + })).toThrow('The ECS service associated with the deployment group must use the CODE_DEPLOY deployment controller type'); + }); + + test('fail when ECS service uses CODE_DEPLOY deployment controller, but did not strip the revision ID from the task definition', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef'); + + taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }); + + const service = new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + deploymentController: { + type: ecs.DeploymentControllerType.CODE_DEPLOY, + }, + }); + (service.node.defaultChild as ecs.CfnService).taskDefinition = 'arn:aws:ecs:us-west-2:123456789012:task-definition/hello_world:8'; + + expect(() => new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'a'.repeat(101), + service, + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + })).toThrow('The ECS service associated with the deployment group must specify the task definition using the task definition family name only. Otherwise, the task definition cannot be updated in the stack'); + }); + + test('can be created with explicit role', () => { + const stack = new cdk.Stack(); + const serviceRole = new iam.Role(stack, 'MyRole', { + assumedBy: new iam.ServicePrincipal('not-codedeploy.test'), + }); + + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + role: serviceRole, + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'not-codedeploy.test', + }, + }], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AWSCodeDeployRoleForECS', + ], + ], + }, + ], + }); + }); + + test('can rollback on alarm', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + alarms: [ + new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'blue/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'green/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + ], + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Alarms: [ + { + Name: { + Ref: 'BlueTGUnHealthyHostsE5A415E0', + }, + }, + { + Name: { + Ref: 'GreenTGUnHealthyHosts49873ED5', + }, + }, + ], + Enabled: true, + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + 'DEPLOYMENT_STOP_ON_ALARM', + ], + }, + }); + }); + + test('can add alarms after construction', () => { + const stack = new cdk.Stack(); + const dg = new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + alarms: [ + new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'blue/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + ], + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + dg.addAlarm(new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'green/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + })); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Alarms: [ + { + Name: { + Ref: 'BlueTGUnHealthyHostsE5A415E0', + }, + }, + { + Name: { + Ref: 'GreenTGUnHealthyHosts49873ED5', + }, + }, + ], + Enabled: true, + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + 'DEPLOYMENT_STOP_ON_ALARM', + ], + }, + }); + }); + + test('fail if alarm rollbacks are enabled, but no alarms provided', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + autoRollback: { + deploymentInAlarm: true, + }, + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + expect(() => app.synth()).toThrow('The auto-rollback setting \'deploymentInAlarm\' does not have any effect unless you associate at least one CloudWatch alarm with the Deployment Group.'); + }); + + test('can disable rollback when alarm polling fails', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + ignorePollAlarmsFailure: true, + alarms: [ + new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'blue/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'green/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + ], + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Alarms: [ + { + Name: { + Ref: 'BlueTGUnHealthyHostsE5A415E0', + }, + }, + { + Name: { + Ref: 'GreenTGUnHealthyHosts49873ED5', + }, + }, + ], + Enabled: true, + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + 'DEPLOYMENT_STOP_ON_ALARM', + ], + }, + }); + }); + + test('can disable rollback when deployment fails', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + autoRollback: { + failedDeployment: false, + }, + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResource('AWS::CodeDeploy::DeploymentGroup', { + Type: 'AWS::CodeDeploy::DeploymentGroup', + Properties: { + ApplicationName: { + Ref: 'MyDGApplication57B1E402', + }, + ServiceRoleArn: { + 'Fn::GetAtt': [ + 'MyDGServiceRole5E94FD88', + 'Arn', + ], + }, + BlueGreenDeploymentConfiguration: { + DeploymentReadyOption: { + ActionOnTimeout: 'CONTINUE_DEPLOYMENT', + WaitTimeInMinutes: 0, + }, + TerminateBlueInstancesOnDeploymentSuccess: { + Action: 'TERMINATE', + TerminationWaitTimeInMinutes: 0, + }, + }, + DeploymentConfigName: 'CodeDeployDefault.ECSAllAtOnce', + DeploymentStyle: { + DeploymentOption: 'WITH_TRAFFIC_CONTROL', + DeploymentType: 'BLUE_GREEN', + }, + ECSServices: [ + { + ClusterName: 'my-cluster', + ServiceName: 'my-service', + }, + ], + LoadBalancerInfo: { + TargetGroupPairInfoList: [ + { + ProdTrafficRoute: { + ListenerArns: [ + 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/prod', + ], + }, + TargetGroups: [ + { + Name: 'blue', + }, + { + Name: 'green', + }, + ], + }, + ], + }, + }, + }); + }); + + test('can enable rollback when deployment stops', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + autoRollback: { + stoppedDeployment: true, + }, + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + 'DEPLOYMENT_STOP_ON_REQUEST', + ], + }, + }); + }); + + test('can disable rollback when alarm in failure state', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + autoRollback: { + deploymentInAlarm: false, + }, + alarms: [ + new cloudwatch.Alarm(stack, 'BlueTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'blue/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + new cloudwatch.Alarm(stack, 'GreenTGUnHealthyHosts', { + metric: new cloudwatch.Metric({ + namespace: 'AWS/ApplicationELB', + metricName: 'UnHealthyHostCount', + dimensionsMap: { + TargetGroup: 'green/f7a80aba5edd5980', + LoadBalancer: 'app/myloadbalancer/lb-12345', + }, + }), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + }), + ], + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Alarms: [ + { + Name: { + Ref: 'BlueTGUnHealthyHostsE5A415E0', + }, + }, + { + Name: { + Ref: 'GreenTGUnHealthyHosts49873ED5', + }, + }, + ], + Enabled: true, + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + ], + }, + }); + }); + + test('can specify a test traffic route', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + testListener: mockListener(stack, 'test'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + LoadBalancerInfo: { + TargetGroupPairInfoList: [ + { + ProdTrafficRoute: { + ListenerArns: [ + 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/prod', + ], + }, + TestTrafficRoute: { + ListenerArns: [ + 'arn:aws:elasticloadbalancing:my-region:my-account:listener/app/myloadbalancer/lb-12345/test', + ], + }, + TargetGroups: [ + { + Name: 'blue', + }, + { + Name: 'green', + }, + ], + }, + ], + }, + }); + }); + + test('can require manual deployment approval', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + deploymentApprovalWaitTime: Duration.hours(8), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + BlueGreenDeploymentConfiguration: { + DeploymentReadyOption: { + ActionOnTimeout: 'STOP_DEPLOYMENT', + WaitTimeInMinutes: 480, + }, + TerminateBlueInstancesOnDeploymentSuccess: { + Action: 'TERMINATE', + TerminationWaitTimeInMinutes: 0, + }, + }, + }); + }); + + test('can add deployment bake time', () => { + const stack = new cdk.Stack(); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + terminationWaitTime: Duration.hours(1), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + BlueGreenDeploymentConfiguration: { + DeploymentReadyOption: { + ActionOnTimeout: 'CONTINUE_DEPLOYMENT', + WaitTimeInMinutes: 0, + }, + TerminateBlueInstancesOnDeploymentSuccess: { + Action: 'TERMINATE', + TerminationWaitTimeInMinutes: 60, + }, + }, + }); + }); + + test('uses the correct Service Principal in the us-isob-east-1 region', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'CodeDeployLambdaStack', { + env: { region: 'us-isob-east-1' }, + }); + new codedeploy.EcsDeploymentGroup(stack, 'MyDG', { + service: mockEcsService(stack), + blueGreenDeploymentConfig: { + blueTargetGroup: mockTargetGroup(stack, 'blue'), + greenTargetGroup: mockTargetGroup(stack, 'green'), + listener: mockListener(stack, 'prod'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'codedeploy.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + }); + + describe('deploymentGroup from ARN in different account and region', () => { + let stack: Stack; + let application: codedeploy.IEcsApplication; + let group: codedeploy.IEcsDeploymentGroup; + + const account = '222222222222'; + const region = 'theregion-1'; + + beforeEach(() => { + stack = new cdk.Stack(undefined, 'Stack', { env: { account: '111111111111', region: 'blabla-1' } }); + + application = codedeploy.EcsApplication.fromEcsApplicationArn(stack, 'Application', `arn:aws:codedeploy:${region}:${account}:application:MyApplication`); + group = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'Group', { + application, + deploymentGroupName: 'DeploymentGroup', + }); + }); + + test('knows its account and region', () => { + // THEN + expect(application.env).toEqual(expect.objectContaining({ account, region })); + expect(group.env).toEqual(expect.objectContaining({ account, region })); + }); + + test('references the predefined DeploymentGroupConfig in the right region', () => { + expect(group.deploymentConfig.deploymentConfigArn).toEqual(expect.stringContaining( + `:codedeploy:${region}:${account}:deploymentconfig:CodeDeployDefault.ECSAllAtOnce`, + )); + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/lambda/application.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/application.test.ts new file mode 100644 index 0000000000000..92a5fa5a443c0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/application.test.ts @@ -0,0 +1,53 @@ +import { Template } from '../../../assertions'; +import * as cdk from '../../../core'; +import * as codedeploy from '../../lib'; + +describe('CodeDeploy Lambda Application', () => { + test('can be created', () => { + const stack = new cdk.Stack(); + new codedeploy.LambdaApplication(stack, 'MyApp'); + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { + ComputePlatform: 'Lambda', + }); + }); + + test('can be created with explicit name', () => { + const stack = new cdk.Stack(); + new codedeploy.LambdaApplication(stack, 'MyApp', { + applicationName: 'my-name', + }); + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::Application', { + ApplicationName: 'my-name', + ComputePlatform: 'Lambda', + }); + }); + + test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.LambdaApplication(stack, 'MyApp', { + applicationName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Application name: "${'a'.repeat(101)}" can be a max of 100 characters.`); + }); + + test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.LambdaApplication(stack, 'MyApp', { + applicationName: 'my name', + }); + + expect(() => app.synth()).toThrow('Application name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); + }); + + test('can be imported', () => { + const stack = new cdk.Stack(); + + const application = codedeploy.LambdaApplication.fromLambdaApplicationName(stack, 'MyApp', 'MyApp'); + + expect(application).not.toEqual(undefined); + expect(application.applicationName).toEqual('MyApp'); + }); +}); diff --git a/packages/@aws-cdk/aws-codedeploy/test/lambda/custom-deployment-config.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/custom-deployment-config.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codedeploy/test/lambda/custom-deployment-config.test.ts rename to packages/aws-cdk-lib/aws-codedeploy/test/lambda/custom-deployment-config.test.ts index 20af6c7147751..459bcb4806778 100644 --- a/packages/@aws-cdk/aws-codedeploy/test/lambda/custom-deployment-config.test.ts +++ b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/custom-deployment-config.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Template } from '../../../assertions'; +import * as lambda from '../../../aws-lambda'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as codedeploy from '../../lib'; function mockFunction(stack: cdk.Stack, id: string) { diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/lambda/deployment-config.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/deployment-config.test.ts new file mode 100644 index 0000000000000..2c9a08b78e9e7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/deployment-config.test.ts @@ -0,0 +1,142 @@ +import { Template } from '../../../assertions'; +import * as cdk from '../../../core'; +import * as codedeploy from '../../lib'; +import { TrafficRouting } from '../../lib'; + +/* eslint-disable quote-props */ + +let stack: cdk.Stack; + +beforeEach(() => { + stack = new cdk.Stack(); +}); + +test('can create default config', () => { + // WHEN + new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'Lambda', + 'TrafficRoutingConfig': { + 'Type': 'AllAtOnce', + }, + }); +}); + +test('can create all-at-once config', () => { + // WHEN + new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.allAtOnce(), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'Lambda', + 'TrafficRoutingConfig': { + 'Type': 'AllAtOnce', + }, + }); +}); + +test('can create linear config', () => { + // WHEN + new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedLinear({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'Lambda', + 'TrafficRoutingConfig': { + 'TimeBasedLinear': { + 'LinearInterval': 1, + 'LinearPercentage': 5, + }, + 'Type': 'TimeBasedLinear', + }, + }); +}); + +test('can create canary config', () => { + // WHEN + new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'Lambda', + 'TrafficRoutingConfig': { + 'TimeBasedCanary': { + 'CanaryInterval': 1, + 'CanaryPercentage': 5, + }, + 'Type': 'TimeBasedCanary', + }, + }); +}); + +test('can create a config with a specific name', () => { + // WHEN + new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { + deploymentConfigName: 'MyCanaryConfig', + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'ComputePlatform': 'Lambda', + 'DeploymentConfigName': 'MyCanaryConfig', + 'TrafficRoutingConfig': { + 'TimeBasedCanary': { + 'CanaryInterval': 1, + 'CanaryPercentage': 5, + }, + 'Type': 'TimeBasedCanary', + }, + }); +}); + +test('can be imported', () => { + const deploymentConfig = codedeploy.LambdaDeploymentConfig.fromLambdaDeploymentConfigName(stack, 'MyDC', 'MyDC'); + + expect(deploymentConfig).not.toEqual(undefined); +}); + +test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stackWithApp = new cdk.Stack(app); + new codedeploy.LambdaDeploymentConfig(stackWithApp, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + deploymentConfigName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Deployment config name: "${'a'.repeat(101)}" can be a max of 100 characters.`); +}); + +test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stackWithApp = new cdk.Stack(app); + new codedeploy.LambdaDeploymentConfig(stackWithApp, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + deploymentConfigName: 'my name', + }); + + expect(() => app.synth()).toThrow('Deployment config name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); +}); diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/lambda/deployment-group.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/deployment-group.test.ts new file mode 100644 index 0000000000000..9043ddf0f28ec --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/lambda/deployment-group.test.ts @@ -0,0 +1,697 @@ +import { Match, Template } from '../../../assertions'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as cdk from '../../../core'; +import { Stack } from '../../../core'; +import * as codedeploy from '../../lib'; +import { TrafficRouting } from '../../lib'; + +function mockFunction(stack: cdk.Stack, id: string) { + return new lambda.Function(stack, id, { + code: lambda.Code.fromInline('mock'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); +} +function mockAlias(stack: cdk.Stack) { + return new lambda.Alias(stack, 'Alias', { + aliasName: 'my-alias', + version: new lambda.Version(stack, 'Version', { + lambda: mockFunction(stack, 'Function'), + }), + }); +} + +describe('CodeDeploy Lambda DeploymentGroup', () => { + test('can be created with default AllAtOnce IN_PLACE configuration', () => { + const stack = new cdk.Stack(); + stack.node.setContext('@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup', true); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + ServiceRoleArn: { + 'Fn::GetAtt': [ + 'MyDGServiceRole5E94FD88', + 'Arn', + ], + }, + AlarmConfiguration: { + Enabled: false, + Alarms: Match.absent(), + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + ], + }, + DeploymentConfigName: 'CodeDeployDefault.LambdaAllAtOnce', + DeploymentStyle: { + DeploymentOption: 'WITH_TRAFFIC_CONTROL', + DeploymentType: 'BLUE_GREEN', + }, + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { + Type: 'AWS::Lambda::Alias', + Properties: { + FunctionName: { + Ref: 'Function76856677', + }, + FunctionVersion: { + 'Fn::GetAtt': [ + 'Version6A868472', + 'Version', + ], + }, + Name: 'my-alias', + }, + UpdatePolicy: { + CodeDeployLambdaAliasUpdate: { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + DeploymentGroupName: { + Ref: 'MyDGC350BD3F', + }, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: { + 'Fn::FindInMap': [ + 'ServiceprincipalMap', + { + Ref: 'AWS::Region', + }, + 'codedeploy', + ], + }, + }, + }], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited', + ], + ], + }, + ], + }); + }); + + test('can be created with explicit name', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + deploymentGroupName: 'test', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + DeploymentGroupName: 'test', + }); + }); + + test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + alias, + deploymentGroupName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Deployment group name: "${'a'.repeat(101)}" can be a max of 100 characters.`); + }); + + test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + alias, + deploymentGroupName: 'my name', + }); + + expect(() => app.synth()).toThrow('Deployment group name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); + }); + + test('can be created with explicit role', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + const serviceRole = new iam.Role(stack, 'MyRole', { + assumedBy: new iam.ServicePrincipal('not-codedeploy.test'), + }); + + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + role: serviceRole, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'not-codedeploy.test', + }, + }], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/service-role/AWSCodeDeployRoleForLambdaLimited', + ], + ], + }, + ], + }); + }); + + test('can configure blue/green traffic shifting', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + ServiceRoleArn: { + 'Fn::GetAtt': [ + 'MyDGServiceRole5E94FD88', + 'Arn', + ], + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + ], + }, + DeploymentConfigName: 'CodeDeployDefault.LambdaLinear10PercentEvery1Minute', + DeploymentStyle: { + DeploymentOption: 'WITH_TRAFFIC_CONTROL', + DeploymentType: 'BLUE_GREEN', + }, + }); + }); + + test('can rollback on alarm', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + alarms: [new cloudwatch.Alarm(stack, 'Failures', { + metric: alias.metricErrors(), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + })], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Alarms: [{ + Name: { + Ref: 'Failures8A3E1A2F', + }, + }], + Enabled: true, + }, + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + 'DEPLOYMENT_STOP_ON_ALARM', + ], + }, + }); + }); + + test('onPreHook throws error if pre-hook already defined', () => { + const stack = new cdk.Stack(); + const alias = mockAlias(stack); + const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + alias, + preHook: mockFunction(stack, 'PreHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + expect(() => group.addPreHook(mockFunction(stack, 'PreHook2'))).toThrow(); + }); + + test('onPostHook throws error if post-hook already defined', () => { + const stack = new cdk.Stack(); + const alias = mockAlias(stack); + const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + alias, + postHook: mockFunction(stack, 'PostHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + expect(() => group.addPostHook(mockFunction(stack, 'PostHook2'))).toThrow(); + }); + + test('can run pre hook lambda function before deployment', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + preHook: mockFunction(stack, 'PreHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { + UpdatePolicy: { + CodeDeployLambdaAliasUpdate: { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + DeploymentGroupName: { + Ref: 'MyDGC350BD3F', + }, + BeforeAllowTrafficHook: { + Ref: 'PreHook8B53F672', + }, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', + Roles: [{ + Ref: 'MyDGServiceRole5E94FD88', + }], + PolicyDocument: { + Statement: [{ + Action: 'lambda:InvokeFunction', + Resource: [ + { 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, ':*']] }, + ], + Effect: 'Allow', + }], + Version: '2012-10-17', + }, + }); + }); + + test('can add pre hook lambda function after creating the deployment group', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + group.addPreHook(mockFunction(stack, 'PreHook')); + + Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { + UpdatePolicy: { + CodeDeployLambdaAliasUpdate: { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + DeploymentGroupName: { + Ref: 'MyDGC350BD3F', + }, + BeforeAllowTrafficHook: { + Ref: 'PreHook8B53F672', + }, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', + Roles: [{ + Ref: 'MyDGServiceRole5E94FD88', + }], + PolicyDocument: { + Statement: [{ + Action: 'lambda:InvokeFunction', + Resource: [ + { 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PreHook8B53F672', 'Arn'] }, ':*']] }, + ], + Effect: 'Allow', + }], + Version: '2012-10-17', + }, + }); + }); + + test('can run post hook lambda function before deployment', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + postHook: mockFunction(stack, 'PostHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { + UpdatePolicy: { + CodeDeployLambdaAliasUpdate: { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + DeploymentGroupName: { + Ref: 'MyDGC350BD3F', + }, + AfterAllowTrafficHook: { + Ref: 'PostHookF2E49B30', + }, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', + Roles: [{ + Ref: 'MyDGServiceRole5E94FD88', + }], + PolicyDocument: { + Statement: [{ + Action: 'lambda:InvokeFunction', + Resource: [ + { 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, ':*']] }, + ], + Effect: 'Allow', + }], + Version: '2012-10-17', + }, + }); + }); + + test('can add post hook lambda function after creating the deployment group', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + const group = new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + }); + group.addPostHook(mockFunction(stack, 'PostHook')); + + Template.fromStack(stack).hasResource('AWS::Lambda::Alias', { + UpdatePolicy: { + CodeDeployLambdaAliasUpdate: { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + DeploymentGroupName: { + Ref: 'MyDGC350BD3F', + }, + AfterAllowTrafficHook: { + Ref: 'PostHookF2E49B30', + }, + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyName: 'MyDGServiceRoleDefaultPolicy65E8E1EA', + Roles: [{ + Ref: 'MyDGServiceRole5E94FD88', + }], + PolicyDocument: { + Statement: [{ + Action: 'lambda:InvokeFunction', + Resource: [ + { 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['PostHookF2E49B30', 'Arn'] }, ':*']] }, + ], + Effect: 'Allow', + }], + Version: '2012-10-17', + }, + }); + }); + + test('can disable rollback when alarm polling fails', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + postHook: mockFunction(stack, 'PostHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + ignorePollAlarmsFailure: true, + alarms: [new cloudwatch.Alarm(stack, 'Failures', { + metric: alias.metricErrors(), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + })], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Alarms: [{ + Name: { + Ref: 'Failures8A3E1A2F', + }, + }], + Enabled: true, + IgnorePollAlarmFailure: true, + }, + }); + }); + + test('can disable rollback when deployment fails', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + postHook: mockFunction(stack, 'PostHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + autoRollback: { + failedDeployment: false, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + ApplicationName: { + Ref: 'MyApp3CE31C26', + }, + ServiceRoleArn: { + 'Fn::GetAtt': [ + 'MyDGServiceRole5E94FD88', + 'Arn', + ], + }, + DeploymentConfigName: 'CodeDeployDefault.LambdaAllAtOnce', + DeploymentStyle: { + DeploymentOption: 'WITH_TRAFFIC_CONTROL', + DeploymentType: 'BLUE_GREEN', + }, + }); + }); + + test('can enable rollback when deployment stops', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + postHook: mockFunction(stack, 'PostHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + autoRollback: { + stoppedDeployment: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + 'DEPLOYMENT_STOP_ON_REQUEST', + ], + }, + }); + }); + + test('can disable rollback when alarm in failure state', () => { + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + postHook: mockFunction(stack, 'PostHook'), + deploymentConfig: codedeploy.LambdaDeploymentConfig.ALL_AT_ONCE, + autoRollback: { + deploymentInAlarm: false, + }, + alarms: [new cloudwatch.Alarm(stack, 'Failures', { + metric: alias.metricErrors(), + comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD, + threshold: 1, + evaluationPeriods: 1, + })], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AutoRollbackConfiguration: { + Enabled: true, + Events: [ + 'DEPLOYMENT_FAILURE', + ], + }, + }); + }); + + test('uses the correct Service Principal in the us-isob-east-1 region', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'CodeDeployLambdaStack', { + env: { region: 'us-isob-east-1' }, + }); + const alias = mockAlias(stack); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + alias, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'codedeploy.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + }); + + describe('deploymentGroup from ARN in different account and region', () => { + let stack: Stack; + let application: codedeploy.ILambdaApplication; + let group: codedeploy.ILambdaDeploymentGroup; + + const account = '222222222222'; + const region = 'theregion-1'; + + beforeEach(() => { + stack = new cdk.Stack(undefined, 'Stack', { env: { account: '111111111111', region: 'blabla-1' } }); + + application = codedeploy.LambdaApplication.fromLambdaApplicationArn(stack, 'Application', `arn:aws:codedeploy:${region}:${account}:application:MyApplication`); + group = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(stack, 'Group', { + application, + deploymentGroupName: 'DeploymentGroup', + }); + }); + + test('knows its account and region', () => { + // THEN + expect(application.env).toEqual(expect.objectContaining({ account, region })); + expect(group.env).toEqual(expect.objectContaining({ account, region })); + }); + + test('references the predefined DeploymentGroupConfig in the right region', () => { + expect(group.deploymentConfig.deploymentConfigArn).toEqual(expect.stringContaining( + `:codedeploy:${region}:${account}:deploymentconfig:CodeDeployDefault.LambdaCanary10Percent5Minutes`, + )); + }); + }); +}); + +describe('imported with fromLambdaDeploymentGroupAttributes', () => { + test('defaults the Deployment Config to Canary10Percent5Minutes', () => { + const stack = new cdk.Stack(); + + const lambdaApp = codedeploy.LambdaApplication.fromLambdaApplicationName(stack, 'LA', 'LambdaApplication'); + const importedGroup = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(stack, 'LDG', { + application: lambdaApp, + deploymentGroupName: 'LambdaDeploymentGroup', + }); + + expect(importedGroup.deploymentConfig.deploymentConfigName).toEqual('CodeDeployDefault.LambdaCanary10Percent5Minutes'); + }); +}); + +test('dependency on the config exists to ensure ordering', () => { + // WHEN + const stack = new cdk.Stack(); + const application = new codedeploy.LambdaApplication(stack, 'MyApp'); + const alias = mockAlias(stack); + const config = new codedeploy.LambdaDeploymentConfig(stack, 'MyConfig', { + trafficRouting: TrafficRouting.timeBasedCanary({ + interval: cdk.Duration.minutes(1), + percentage: 5, + }), + }); + new codedeploy.LambdaDeploymentGroup(stack, 'MyDG', { + application, + alias, + deploymentConfig: config, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::CodeDeploy::DeploymentGroup', { + Properties: { + DeploymentConfigName: stack.resolve(config.deploymentConfigName), + }, + DependsOn: [ + stack.getLogicalId(config.node.defaultChild as codedeploy.CfnDeploymentConfig), + ], + }); +}); diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/server/deployment-config.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/server/deployment-config.test.ts new file mode 100644 index 0000000000000..8e7d42a25e1cf --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/server/deployment-config.test.ts @@ -0,0 +1,67 @@ +import { Template } from '../../../assertions'; +import * as cdk from '../../../core'; +import * as codedeploy from '../../lib'; + +/* eslint-disable quote-props */ + +describe('CodeDeploy DeploymentConfig', () => { + test('can be created by specifying only minHealthyHostCount', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { + minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(1), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'MinimumHealthyHosts': { + 'Type': 'HOST_COUNT', + 'Value': 1, + }, + }); + }); + + test('can be created by specifying only minHealthyHostPercentage', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { + minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentConfig', { + 'MinimumHealthyHosts': { + 'Type': 'FLEET_PERCENT', + 'Value': 75, + }, + }); + }); + + test('can be imported', () => { + const stack = new cdk.Stack(); + + const deploymentConfig = codedeploy.ServerDeploymentConfig.fromServerDeploymentConfigName(stack, 'MyDC', 'MyDC'); + + expect(deploymentConfig).not.toEqual(undefined); + }); + + test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { + minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), + deploymentConfigName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Deployment config name: "${'a'.repeat(101)}" can be a max of 100 characters.`); + }); + + test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.ServerDeploymentConfig(stack, 'DeploymentConfig', { + minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75), + deploymentConfigName: 'my name', + }); + + expect(() => app.synth()).toThrow('Deployment config name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); + }); +}); diff --git a/packages/aws-cdk-lib/aws-codedeploy/test/server/deployment-group.test.ts b/packages/aws-cdk-lib/aws-codedeploy/test/server/deployment-group.test.ts new file mode 100644 index 0000000000000..5054b968922eb --- /dev/null +++ b/packages/aws-cdk-lib/aws-codedeploy/test/server/deployment-group.test.ts @@ -0,0 +1,544 @@ +import { Match, Template } from '../../../assertions'; +import * as autoscaling from '../../../aws-autoscaling'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as lbv2 from '../../../aws-elasticloadbalancingv2'; +import * as cdk from '../../../core'; +import * as codedeploy from '../../lib'; + +/* eslint-disable quote-props */ + +describe('CodeDeploy Server Deployment Group', () => { + test('can be created by explicitly passing an Application', () => { + const stack = new cdk.Stack(); + + const application = new codedeploy.ServerApplication(stack, 'MyApp'); + new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { + application, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'ApplicationName': { + 'Ref': 'MyApp3CE31C26', + }, + }); + }); + + test('can create a deployment group with no alarms', () => { + const stack = new cdk.Stack(); + stack.node.setContext('@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup', true); + + const application = new codedeploy.ServerApplication(stack, 'MyApp'); + new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { + application, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + AlarmConfiguration: { + Enabled: false, + Alarms: Match.absent(), + }, + }); + }); + + test('creating an application with physical name if needed', () => { + const stack = new cdk.Stack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } }); + const stack2 = new cdk.Stack(undefined, undefined, { env: { account: '12346', region: 'us-test-2' } }); + const serverDeploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: cdk.PhysicalName.GENERATE_IF_NEEDED, + }); + + new cdk.CfnOutput(stack2, 'Output', { + value: serverDeploymentGroup.application.applicationName, + }); + + Template.fromStack(stack2).hasOutput('Output', { + Value: 'defaultmydgapplication78dba0bb0c7580b32033', + }); + }); + + test('can be imported', () => { + const stack = new cdk.Stack(); + + const application = codedeploy.ServerApplication.fromServerApplicationName(stack, 'MyApp', 'MyApp'); + const deploymentGroup = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes(stack, 'MyDG', { + application, + deploymentGroupName: 'MyDG', + }); + + expect(deploymentGroup).not.toEqual(undefined); + }); + + test('uses good linux install agent script', () => { + const stack = new cdk.Stack(); + + const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), + machineImage: new ec2.AmazonLinuxImage(), + vpc: new ec2.Vpc(stack, 'VPC'), + }); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoScalingGroups: [asg], + installAgent: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + 'UserData': { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\nset +e\nPKG_CMD=`which yum 2>/dev/null`\nset -e\nif [ -z "$PKG_CMD" ]; then\nPKG_CMD=apt-get\nelse\nPKG_CMD=yum\nfi\n$PKG_CMD update -y\nset +e\n$PKG_CMD install -y ruby2.0\nRUBY2_INSTALL=$?\nset -e\nif [ $RUBY2_INSTALL -ne 0 ]; then\n$PKG_CMD install -y ruby\nfi\nAWS_CLI_PACKAGE_NAME=awscli\nif [ "$PKG_CMD" = "yum" ]; then\nAWS_CLI_PACKAGE_NAME=aws-cli\nfi\n$PKG_CMD install -y $AWS_CLI_PACKAGE_NAME\nTMP_DIR=`mktemp -d`\ncd $TMP_DIR\naws s3 cp s3://aws-codedeploy-', + { + 'Ref': 'AWS::Region', + }, + '/latest/install . --region ', + { + 'Ref': 'AWS::Region', + }, + '\nchmod +x ./install\n./install auto\nrm -fr $TMP_DIR', + ], + ], + }, + }, + }); + }); + + test('uses good windows install agent script', () => { + const stack = new cdk.Stack(); + + const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), + machineImage: new ec2.WindowsImage(ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE, {}), + vpc: new ec2.Vpc(stack, 'VPC'), + }); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoScalingGroups: [asg], + installAgent: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + 'UserData': { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + 'Set-Variable -Name TEMPDIR -Value (New-TemporaryFile).DirectoryName\naws s3 cp s3://aws-codedeploy-', + { + 'Ref': 'AWS::Region', + }, + '/latest/codedeploy-agent.msi $TEMPDIR\\codedeploy-agent.msi\ncd $TEMPDIR\n.\\codedeploy-agent.msi /quiet /l c:\\temp\\host-agent-install-log.txt', + ], + ], + }, + }, + }); + }); + + test('created with ASGs contains the ASG names', () => { + const stack = new cdk.Stack(); + + const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), + machineImage: new ec2.AmazonLinuxImage(), + vpc: new ec2.Vpc(stack, 'VPC'), + }); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoScalingGroups: [asg], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AutoScalingGroups': [ + { + 'Ref': 'ASG46ED3070', + }, + ], + }); + }); + + test('created without ASGs but adding them later contains the ASG names', () => { + const stack = new cdk.Stack(); + + const asg = new autoscaling.AutoScalingGroup(stack, 'ASG', { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.STANDARD3, ec2.InstanceSize.SMALL), + machineImage: new ec2.AmazonLinuxImage(), + vpc: new ec2.Vpc(stack, 'VPC'), + }); + + const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup'); + deploymentGroup.addAutoScalingGroup(asg); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AutoScalingGroups': [ + { + 'Ref': 'ASG46ED3070', + }, + ], + }); + }); + + test('can be created with an ALB Target Group as the load balancer', () => { + const stack = new cdk.Stack(); + + const alb = new lbv2.ApplicationLoadBalancer(stack, 'ALB', { + vpc: new ec2.Vpc(stack, 'VPC'), + }); + const listener = alb.addListener('Listener', { protocol: lbv2.ApplicationProtocol.HTTP }); + const targetGroup = listener.addTargets('Fleet', { protocol: lbv2.ApplicationProtocol.HTTP }); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + loadBalancer: codedeploy.LoadBalancer.application(targetGroup), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'LoadBalancerInfo': { + 'TargetGroupInfoList': [ + { + 'Name': { + 'Fn::GetAtt': [ + 'ALBListenerFleetGroup008CEEE4', + 'TargetGroupName', + ], + }, + }, + ], + }, + 'DeploymentStyle': { + 'DeploymentOption': 'WITH_TRAFFIC_CONTROL', + }, + }); + }); + + test('can be created with an NLB Target Group as the load balancer', () => { + const stack = new cdk.Stack(); + + const nlb = new lbv2.NetworkLoadBalancer(stack, 'NLB', { + vpc: new ec2.Vpc(stack, 'VPC'), + }); + const listener = nlb.addListener('Listener', { port: 80 }); + const targetGroup = listener.addTargets('Fleet', { port: 80 }); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + loadBalancer: codedeploy.LoadBalancer.network(targetGroup), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'LoadBalancerInfo': { + 'TargetGroupInfoList': [ + { + 'Name': { + 'Fn::GetAtt': [ + 'NLBListenerFleetGroupB882EC86', + 'TargetGroupName', + ], + }, + }, + ], + }, + 'DeploymentStyle': { + 'DeploymentOption': 'WITH_TRAFFIC_CONTROL', + }, + }); + }); + + test('can be created with a single EC2 instance tag set with a single or no value', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + ec2InstanceTags: new codedeploy.InstanceTagSet( + { + 'some-key': ['some-value'], + 'other-key': [], + }, + ), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'Ec2TagSet': { + 'Ec2TagSetList': [ + { + 'Ec2TagGroup': [ + { + 'Key': 'some-key', + 'Value': 'some-value', + 'Type': 'KEY_AND_VALUE', + }, + { + 'Key': 'other-key', + 'Type': 'KEY_ONLY', + }, + ], + }, + ], + }, + }); + }); + + test('can be created with two on-premise instance tag sets with multiple values or without a key', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + onPremiseInstanceTags: new codedeploy.InstanceTagSet( + { + 'some-key': ['some-value', 'another-value'], + }, + { + '': ['keyless-value'], + }, + ), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'OnPremisesTagSet': { + 'OnPremisesTagSetList': [ + { + 'OnPremisesTagGroup': [ + { + 'Key': 'some-key', + 'Value': 'some-value', + 'Type': 'KEY_AND_VALUE', + }, + { + 'Key': 'some-key', + 'Value': 'another-value', + 'Type': 'KEY_AND_VALUE', + }, + ], + }, + { + 'OnPremisesTagGroup': [ + { + 'Value': 'keyless-value', + 'Type': 'VALUE_ONLY', + }, + ], + }, + ], + }, + }); + }); + + test('cannot be created with an instance tag set containing a keyless, valueless filter', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + onPremiseInstanceTags: new codedeploy.InstanceTagSet({ + '': [], + }), + }); + }).toThrow(); + }); + + test('cannot be created with an instance tag set containing 4 instance tag groups', () => { + const stack = new cdk.Stack(); + + expect(() => { + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + onPremiseInstanceTags: new codedeploy.InstanceTagSet({}, {}, {}, {}), + }); + }).toThrow(/3/); + }); + + test('can have alarms added to it after being created', () => { + const stack = new cdk.Stack(); + + const alarm = new cloudwatch.Alarm(stack, 'Alarm1', { + metric: new cloudwatch.Metric({ + metricName: 'Errors', + namespace: 'my.namespace', + }), + threshold: 1, + evaluationPeriods: 1, + }); + + const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup'); + deploymentGroup.addAlarm(alarm); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AlarmConfiguration': { + 'Alarms': [ + { + 'Name': { + 'Ref': 'Alarm1F9009D71', + }, + }, + ], + 'Enabled': true, + }, + }); + }); + + test('only automatically rolls back failed deployments by default', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup'); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AutoRollbackConfiguration': { + 'Enabled': true, + 'Events': [ + 'DEPLOYMENT_FAILURE', + ], + }, + }); + }); + + test('rolls back alarmed deployments if at least one alarm has been added', () => { + const stack = new cdk.Stack(); + + const alarm = new cloudwatch.Alarm(stack, 'Alarm1', { + metric: new cloudwatch.Metric({ + metricName: 'Errors', + namespace: 'my.namespace', + }), + threshold: 1, + evaluationPeriods: 1, + }); + + const deploymentGroup = new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoRollback: { + failedDeployment: false, + }, + }); + deploymentGroup.addAlarm(alarm); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AutoRollbackConfiguration': { + 'Enabled': true, + 'Events': [ + 'DEPLOYMENT_STOP_ON_ALARM', + ], + }, + }); + }); + + test('setting to roll back on alarms without providing any results in an exception', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoRollback: { + deploymentInAlarm: true, + }, + }); + + expect(() => app.synth()).toThrow(/deploymentInAlarm/); + }); + + test('disable automatic rollback', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoRollback: { + deploymentInAlarm: false, + failedDeployment: false, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AutoRollbackConfiguration': { + 'Enabled': false, + }, + }); + }); + + test('disable automatic rollback when all options are false', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + autoRollback: { + deploymentInAlarm: false, + failedDeployment: false, + stoppedDeployment: false, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'AutoRollbackConfiguration': { + 'Enabled': false, + }, + }); + }); + + + test('can be used with an imported ALB Target Group as the load balancer', () => { + const stack = new cdk.Stack(); + + new codedeploy.ServerDeploymentGroup(stack, 'DeploymentGroup', { + loadBalancer: codedeploy.LoadBalancer.application( + lbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedAlbTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', + }), + ), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeDeploy::DeploymentGroup', { + 'LoadBalancerInfo': { + 'TargetGroupInfoList': [ + { + 'Name': 'myAlbTargetGroup', + }, + ], + }, + 'DeploymentStyle': { + 'DeploymentOption': 'WITH_TRAFFIC_CONTROL', + }, + }); + }); + + test('fail with more than 100 characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { + deploymentGroupName: 'a'.repeat(101), + }); + + expect(() => app.synth()).toThrow(`Deployment group name: "${'a'.repeat(101)}" can be a max of 100 characters.`); + }); + + test('fail with unallowed characters in name', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new codedeploy.ServerDeploymentGroup(stack, 'MyDG', { + + deploymentGroupName: 'my name', + }); + + expect(() => app.synth()).toThrow('Deployment group name: "my name" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).'); + }); + + describe('deploymentGroup from ARN in different account and region', () => { + let stack: cdk.Stack; + let application: codedeploy.IServerApplication; + let group: codedeploy.IServerDeploymentGroup; + + const account = '222222222222'; + const region = 'theregion-1'; + + beforeEach(() => { + stack = new cdk.Stack(undefined, 'Stack', { env: { account: '111111111111', region: 'blabla-1' } }); + + application = codedeploy.ServerApplication.fromServerApplicationArn(stack, 'Application', `arn:aws:codedeploy:${region}:${account}:application:MyApplication`); + group = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes(stack, 'Group', { + application, + deploymentGroupName: 'DeploymentGroup', + }); + }); + + test('knows its account and region', () => { + // THEN + expect(application.env).toEqual(expect.objectContaining({ account, region })); + expect(group.env).toEqual(expect.objectContaining({ account, region })); + }); + + test('references the predefined DeploymentGroupConfig in the right region', () => { + expect(group.deploymentConfig.deploymentConfigArn).toEqual(expect.stringContaining( + `:codedeploy:${region}:${account}:deploymentconfig:CodeDeployDefault.OneAtATime`, + )); + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-codeguruprofiler/.jsiirc.json b/packages/aws-cdk-lib/aws-codeguruprofiler/.jsiirc.json new file mode 100644 index 0000000000000..319c8b04720ae --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeguruprofiler/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeGuruProfiler" + }, + "java": { + "package": "software.amazon.awscdk.services.codeguruprofiler" + }, + "python": { + "module": "aws_cdk.aws_codeguruprofiler" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codeguruprofiler/README.md b/packages/aws-cdk-lib/aws-codeguruprofiler/README.md new file mode 100644 index 0000000000000..5ab3ef0923a96 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeguruprofiler/README.md @@ -0,0 +1,37 @@ +# AWS::CodeGuruProfiler Construct Library + + +Amazon CodeGuru Profiler collects runtime performance data from your live applications, and provides recommendations that can help you fine-tune your application performance. + +## Installation + +Import to your project: + +```ts nofixture +import * as codeguruprofiler from 'aws-cdk-lib/aws-codeguruprofiler'; +``` + +## Basic usage + +Here's how to setup a profiling group and give your compute role permissions to publish to the profiling group to the profiling agent can publish profiling information: + +```ts +// The execution role of your application that publishes to the ProfilingGroup via CodeGuru Profiler Profiling Agent. (the following is merely an example) +const publishAppRole = new iam.Role(this, 'PublishAppRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); + +const profilingGroup = new codeguruprofiler.ProfilingGroup(this, 'MyProfilingGroup'); +profilingGroup.grantPublish(publishAppRole); +``` + +## Compute Platform configuration + +Code Guru Profiler supports multiple compute environments. +They can be configured when creating a Profiling Group by using the `computePlatform` property: + +```ts +const profilingGroup = new codeguruprofiler.ProfilingGroup(this, 'MyProfilingGroup', { + computePlatform: codeguruprofiler.ComputePlatform.AWS_LAMBDA, +}); +``` diff --git a/packages/aws-cdk-lib/aws-codeguruprofiler/index.ts b/packages/aws-cdk-lib/aws-codeguruprofiler/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codeguruprofiler/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-codeguruprofiler/lib/index.ts b/packages/aws-cdk-lib/aws-codeguruprofiler/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codeguruprofiler/lib/index.ts rename to packages/aws-cdk-lib/aws-codeguruprofiler/lib/index.ts diff --git a/packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts b/packages/aws-cdk-lib/aws-codeguruprofiler/lib/profiling-group.ts similarity index 98% rename from packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts rename to packages/aws-cdk-lib/aws-codeguruprofiler/lib/profiling-group.ts index 6672923e36706..bad6d68cd0455 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/lib/profiling-group.ts +++ b/packages/aws-cdk-lib/aws-codeguruprofiler/lib/profiling-group.ts @@ -1,5 +1,5 @@ -import { Grant, IGrantable } from '@aws-cdk/aws-iam'; -import { ArnFormat, IResource, Lazy, Names, Resource, Stack } from '@aws-cdk/core'; +import { Grant, IGrantable } from '../../aws-iam'; +import { ArnFormat, IResource, Lazy, Names, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnProfilingGroup } from './codeguruprofiler.generated'; diff --git a/packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts b/packages/aws-cdk-lib/aws-codeguruprofiler/test/profiling-group.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts rename to packages/aws-cdk-lib/aws-codeguruprofiler/test/profiling-group.test.ts index 8b176566436e4..60bebfa23a894 100644 --- a/packages/@aws-cdk/aws-codeguruprofiler/test/profiling-group.test.ts +++ b/packages/aws-cdk-lib/aws-codeguruprofiler/test/profiling-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { AccountRootPrincipal, Role } from '../../aws-iam'; +import { Stack } from '../../core'; import { ProfilingGroup, ComputePlatform } from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-codegurureviewer/.jsiirc.json b/packages/aws-cdk-lib/aws-codegurureviewer/.jsiirc.json new file mode 100644 index 0000000000000..c0207f4e124d7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codegurureviewer/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeGuruReviewer" + }, + "java": { + "package": "software.amazon.awscdk.services.codegurureviewer" + }, + "python": { + "module": "aws_cdk.aws_codegurureviewer" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codegurureviewer/README.md b/packages/aws-cdk-lib/aws-codegurureviewer/README.md new file mode 100644 index 0000000000000..c002200d213af --- /dev/null +++ b/packages/aws-cdk-lib/aws-codegurureviewer/README.md @@ -0,0 +1,27 @@ +# AWS::CodeGuruReviewer Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as codegurureviewer from 'aws-cdk-lib/aws-codegurureviewer'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CodeGuruReviewer construct libraries](https://constructs.dev/search?q=codegurureviewer) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeGuruReviewer resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeGuruReviewer.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeGuruReviewer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeGuruReviewer.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-codegurureviewer/index.ts b/packages/aws-cdk-lib/aws-codegurureviewer/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codegurureviewer/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codegurureviewer/lib/index.ts b/packages/aws-cdk-lib/aws-codegurureviewer/lib/index.ts new file mode 100644 index 0000000000000..ddd329c4d3251 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codegurureviewer/lib/index.ts @@ -0,0 +1 @@ +export * from './codegurureviewer.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/.jsiirc.json b/packages/aws-cdk-lib/aws-codepipeline-actions/.jsiirc.json new file mode 100644 index 0000000000000..420431f598fba --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.codepipeline.actions" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodePipeline.Actions" + }, + "python": { + "module": "aws_cdk.aws_codepipeline_actions" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/README.md b/packages/aws-cdk-lib/aws-codepipeline-actions/README.md new file mode 100644 index 0000000000000..74a37565664ee --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/README.md @@ -0,0 +1,1225 @@ +# AWS CodePipeline Actions + + +This package contains Actions that can be used in a CodePipeline. + +```ts nofixture +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; +``` + +## Sources + +### AWS CodeCommit + +To use a CodeCommit Repository in a CodePipeline: + +```ts +const repo = new codecommit.Repository(this, 'Repo', { + repositoryName: 'MyRepo', +}); + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', { + pipelineName: 'MyPipeline', +}); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CodeCommit', + repository: repo, + output: sourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [sourceAction], +}); +``` + +If you want to use existing role which can be used by on commit event rule. +You can specify the role object in eventRole property. + +```ts +const eventRole = iam.Role.fromRoleArn(this, 'Event-role', 'roleArn'); +declare const repo: codecommit.Repository; +const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CodeCommit', + repository: repo, + output: new codepipeline.Artifact(), + eventRole, +}); +``` + +If you want to clone the entire CodeCommit repository (only available for CodeBuild actions), +you can set the `codeBuildCloneOutput` property to `true`: + +```ts +declare const project: codebuild.PipelineProject; +declare const repo: codecommit.Repository; +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CodeCommit', + repository: repo, + output: sourceOutput, + codeBuildCloneOutput: true, +}); + +const buildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, // The build action must use the CodeCommitSourceAction output as input. + outputs: [new codepipeline.Artifact()], // optional +}); +``` + +The CodeCommit source action emits variables: + +```ts +declare const project: codebuild.PipelineProject; +declare const repo: codecommit.Repository; +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CodeCommit', + repository: repo, + output: sourceOutput, + variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you +}); + +// later: + +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + COMMIT_ID: { + value: sourceAction.variables.commitId, + }, + }, +}); +``` + +### GitHub + +If you want to use a GitHub repository as the source, you must create: + +* A [GitHub Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line), + with scopes **repo** and **admin:repo_hook**. +* A [Secrets Manager Secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html) + with the value of the **GitHub Access Token**. Pick whatever name you want (for example `my-github-token`). + This token can be stored either as Plaintext or as a Secret key/value. + If you stored the token as Plaintext, + set `SecretValue.secretsManager('my-github-token')` as the value of `oauthToken`. + If you stored it as a Secret key/value, + you must set `SecretValue.secretsManager('my-github-token', { jsonField : 'my-github-token' })` as the value of `oauthToken`. + +To use GitHub as the source of a CodePipeline: + +```ts +// Read the secret from Secrets Manager +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.GitHubSourceAction({ + actionName: 'GitHub_Source', + owner: 'awslabs', + repo: 'aws-cdk', + oauthToken: SecretValue.secretsManager('my-github-token'), + output: sourceOutput, + branch: 'develop', // default: 'master' +}); +pipeline.addStage({ + stageName: 'Source', + actions: [sourceAction], +}); +``` + +The GitHub source action emits variables: + +```ts +declare const sourceOutput: codepipeline.Artifact; +declare const project: codebuild.PipelineProject; + +const sourceAction = new codepipeline_actions.GitHubSourceAction({ + actionName: 'Github_Source', + output: sourceOutput, + owner: 'my-owner', + repo: 'my-repo', + oauthToken: SecretValue.secretsManager('my-github-token'), + variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you +}); + +// later: + +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + COMMIT_URL: { + value: sourceAction.variables.commitUrl, + }, + }, +}); +``` + +### BitBucket + +CodePipeline can use a BitBucket Git repository as a source: + +**Note**: you have to manually connect CodePipeline through the AWS Console with your BitBucket account. +This is a one-time operation for a given AWS account in a given region. +The simplest way to do that is to either start creating a new CodePipeline, +or edit an existing one, while being logged in to BitBucket. +Choose BitBucket as the source, +and grant CodePipeline permissions to your BitBucket account. +Copy & paste the Connection ARN that you get in the console, +or use the [`codestar-connections list-connections` AWS CLI operation](https://docs.aws.amazon.com/cli/latest/reference/codestar-connections/list-connections.html) +to find it. +After that, you can safely abort creating or editing the pipeline - +the connection has already been created. + +```ts +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({ + actionName: 'BitBucket_Source', + owner: 'aws', + repo: 'aws-cdk', + output: sourceOutput, + connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh', +}); +``` + +You can also use the `CodeStarConnectionsSourceAction` to connect to GitHub, in the same way +(you just have to select GitHub as the source when creating the connection in the console). + +Similarly to `GitHubSourceAction`, `CodeStarConnectionsSourceAction` also emits the variables: + +```ts +declare const project: codebuild.Project; + +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({ + actionName: 'BitBucket_Source', + owner: 'aws', + repo: 'aws-cdk', + output: sourceOutput, + connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh', + variablesNamespace: 'SomeSpace', // optional - by default, a name will be generated for you +}); + +// later: + +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + COMMIT_ID: { + value: sourceAction.variables.commitId, + }, + }, +}); +``` + +### AWS S3 Source + +To use an S3 Bucket as a source in CodePipeline: + +```ts +const sourceBucket = new s3.Bucket(this, 'MyBucket', { + versioned: true, // a Bucket used as a source in CodePipeline must be versioned +}); + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.S3SourceAction({ + actionName: 'S3Source', + bucket: sourceBucket, + bucketKey: 'path/to/file.zip', + output: sourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [sourceAction], +}); +``` + +The region of the action will be determined by the region the bucket itself is in. +When using a newly created bucket, +that region will be taken from the stack the bucket belongs to; +for an imported bucket, +you can specify the region explicitly: + +```ts +const sourceBucket = s3.Bucket.fromBucketAttributes(this, 'SourceBucket', { + bucketName: 'my-bucket', + region: 'ap-southeast-1', +}); +``` + +By default, the Pipeline will poll the Bucket to detect changes. +You can change that behavior to use CloudWatch Events by setting the `trigger` +property to `S3Trigger.EVENTS` (it's `S3Trigger.POLL` by default). +If you do that, make sure the source Bucket is part of an AWS CloudTrail Trail - +otherwise, the CloudWatch Events will not be emitted, +and your Pipeline will not react to changes in the Bucket. +You can do it through the CDK: + +```ts +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; + +declare const sourceBucket: s3.Bucket; +const sourceOutput = new codepipeline.Artifact(); +const key = 'some/key.zip'; +const trail = new cloudtrail.Trail(this, 'CloudTrail'); +trail.addS3EventSelector([{ + bucket: sourceBucket, + objectPrefix: key, +}], { + readWriteType: cloudtrail.ReadWriteType.WRITE_ONLY, +}); +const sourceAction = new codepipeline_actions.S3SourceAction({ + actionName: 'S3Source', + bucketKey: key, + bucket: sourceBucket, + output: sourceOutput, + trigger: codepipeline_actions.S3Trigger.EVENTS, // default: S3Trigger.POLL +}); +``` + +The S3 source action emits variables: + +```ts +const key = 'some/key.zip'; +declare const sourceBucket: s3.Bucket; +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.S3SourceAction({ + actionName: 'S3Source', + bucketKey: key, + bucket: sourceBucket, + output: sourceOutput, + variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you +}); + +// later: +declare const project: codebuild.PipelineProject; +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + VERSION_ID: { + value: sourceAction.variables.versionId, + }, + }, +}); +``` + +### AWS ECR + +To use an ECR Repository as a source in a Pipeline: + +```ts +import * as ecr from 'aws-cdk-lib/aws-ecr'; + +declare const ecrRepository: ecr.Repository; +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.EcrSourceAction({ + actionName: 'ECR', + repository: ecrRepository, + imageTag: 'some-tag', // optional, default: 'latest' + output: sourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [sourceAction], +}); +``` + +The ECR source action emits variables: + +```ts +import * as ecr from 'aws-cdk-lib/aws-ecr'; + +const sourceOutput = new codepipeline.Artifact(); +declare const ecrRepository: ecr.Repository; +const sourceAction = new codepipeline_actions.EcrSourceAction({ + actionName: 'Source', + output: sourceOutput, + repository: ecrRepository, + variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you +}); + +// later: +declare const project: codebuild.PipelineProject; +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + IMAGE_URI: { + value: sourceAction.variables.imageUri, + }, + }, +}); +``` + +## Build & test + +### AWS CodeBuild + +Example of a CodeBuild Project used in a Pipeline, alongside CodeCommit: + +```ts +declare const project: codebuild.PipelineProject; +const repository = new codecommit.Repository(this, 'MyRepository', { + repositoryName: 'MyRepository', +}); +const project = new codebuild.PipelineProject(this, 'MyProject'); + +const sourceOutput = new codepipeline.Artifact(); +const sourceAction = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CodeCommit', + repository, + output: sourceOutput, +}); +const buildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + outputs: [new codepipeline.Artifact()], // optional + executeBatchBuild: true, // optional, defaults to false + combineBatchBuildArtifacts: true, // optional, defaults to false +}); + +new codepipeline.Pipeline(this, 'MyPipeline', { + stages: [ + { + stageName: 'Source', + actions: [sourceAction], + }, + { + stageName: 'Build', + actions: [buildAction], + }, + ], +}); +``` + +The default category of the CodeBuild Action is `Build`; +if you want a `Test` Action instead, +override the `type` property: + +```ts +declare const project: codebuild.PipelineProject; +const sourceOutput = new codepipeline.Artifact(); +const testAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'IntegrationTest', + project, + input: sourceOutput, + type: codepipeline_actions.CodeBuildActionType.TEST, // default is BUILD +}); +``` + +#### Multiple inputs and outputs + +When you want to have multiple inputs and/or outputs for a Project used in a +Pipeline, instead of using the `secondarySources` and `secondaryArtifacts` +properties of the `Project` class, you need to use the `extraInputs` and +`outputs` properties of the CodeBuild CodePipeline +Actions. Example: + +```ts +declare const repository1: codecommit.Repository; +const sourceOutput1 = new codepipeline.Artifact(); +const sourceAction1 = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'Source1', + repository: repository1, + output: sourceOutput1, +}); +declare const repository2: codecommit.Repository; +const sourceOutput2 = new codepipeline.Artifact('source2'); +const sourceAction2 = new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'Source2', + repository: repository2, + output: sourceOutput2, +}); + +declare const project: codebuild.PipelineProject; +const buildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'Build', + project, + input: sourceOutput1, + extraInputs: [ + sourceOutput2, // this is where 'source2' comes from + ], + outputs: [ + new codepipeline.Artifact('artifact1'), // for better buildspec readability - see below + new codepipeline.Artifact('artifact2'), + ], +}); +``` + +**Note**: when a CodeBuild Action in a Pipeline has more than one output, it +only uses the `secondary-artifacts` field of the buildspec, never the +primary output specification directly under `artifacts`. Because of that, it +pays to explicitly name all output artifacts of that Action, like we did +above, so that you know what name to use in the buildspec. + +Example buildspec for the above project: + +```ts +const project = new codebuild.PipelineProject(this, 'MyProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + // By default, you're in a directory with the contents of the repository from sourceAction1. + // Use the CODEBUILD_SRC_DIR_source2 environment variable + // to get a path to the directory with the contents of the second input repository. + ], + }, + }, + artifacts: { + 'secondary-artifacts': { + 'artifact1': { + // primary Action output artifact, + // available as buildAction.outputArtifact + }, + 'artifact2': { + // additional output artifact, + // available as buildAction.additionalOutputArtifact('artifact2') + }, + }, + }, + }), + // ... +}); +``` + +#### Variables + +The CodeBuild action emits variables. +Unlike many other actions, the variables are not static, +but dynamic, defined in the buildspec, +in the 'exported-variables' subsection of the 'env' section. +Example: + +```ts +const sourceOutput = new codepipeline.Artifact(); +const buildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'Build1', + input: sourceOutput, + project: new codebuild.PipelineProject(this, 'Project', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + env: { + 'exported-variables': [ + 'MY_VAR', + ], + }, + phases: { + build: { + commands: 'export MY_VAR="some value"', + }, + }, + }), + }), + variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you +}); + +// later: +declare const project: codebuild.PipelineProject; +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + MyVar: { + value: buildAction.variable('MY_VAR'), + }, + }, +}); +``` + +### Jenkins + +In order to use Jenkins Actions in the Pipeline, +you first need to create a `JenkinsProvider`: + +```ts +const jenkinsProvider = new codepipeline_actions.JenkinsProvider(this, 'JenkinsProvider', { + providerName: 'MyJenkinsProvider', + serverUrl: 'http://my-jenkins.com:8080', + version: '2', // optional, default: '1' +}); +``` + +If you've registered a Jenkins provider in a different CDK app, +or outside the CDK (in the CodePipeline AWS Console, for example), +you can import it: + +```ts +const jenkinsProvider = codepipeline_actions.JenkinsProvider.fromJenkinsProviderAttributes(this, 'JenkinsProvider', { + providerName: 'MyJenkinsProvider', + serverUrl: 'http://my-jenkins.com:8080', + version: '2', // optional, default: '1' +}); +``` + +Note that a Jenkins provider +(identified by the provider name-category(build/test)-version tuple) +must always be registered in the given account, in the given AWS region, +before it can be used in CodePipeline. + +With a `JenkinsProvider`, +we can create a Jenkins Action: + +```ts +declare const jenkinsProvider: codepipeline_actions.JenkinsProvider; +const buildAction = new codepipeline_actions.JenkinsAction({ + actionName: 'JenkinsBuild', + jenkinsProvider: jenkinsProvider, + projectName: 'MyProject', + type: codepipeline_actions.JenkinsActionType.BUILD, +}); +``` + +## Deploy + +### AWS CloudFormation + +This module contains Actions that allows you to deploy to CloudFormation from AWS CodePipeline. + +For example, the following code fragment defines a pipeline that automatically deploys a CloudFormation template +directly from a CodeCommit repository, with a manual approval step in between to confirm the changes: + +[example Pipeline to deploy CloudFormation](test/integ.cfn-template-from-repo.lit.ts) + +See [the AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline.html) +for more details about using CloudFormation in CodePipeline. + +#### Actions for updating individual CloudFormation Stacks + +This package contains the following CloudFormation actions: + +* **CloudFormationCreateUpdateStackAction** - Deploy a CloudFormation template directly from the pipeline. The indicated stack is created, + or updated if it already exists. If the stack is in a failure state, deployment will fail (unless `replaceOnFailure` + is set to `true`, in which case it will be destroyed and recreated). +* **CloudFormationDeleteStackAction** - Delete the stack with the given name. +* **CloudFormationCreateReplaceChangeSetAction** - Prepare a change set to be applied later. You will typically use change sets if you want + to manually verify the changes that are being staged, or if you want to separate the people (or system) preparing the + changes from the people (or system) applying the changes. +* **CloudFormationExecuteChangeSetAction** - Execute a change set prepared previously. + +#### Actions for deploying CloudFormation StackSets to multiple accounts + +You can use CloudFormation StackSets to deploy the same CloudFormation template to multiple +accounts in a managed way. If you use AWS Organizations, StackSets can be deployed to +all accounts in a particular Organizational Unit (OU), and even automatically to new +accounts as soon as they are added to a particular OU. For more information, see +the [Working with StackSets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/what-is-cfnstacksets.html) +section of the CloudFormation developer guide. + +The actions available for updating StackSets are: + +* **CloudFormationDeployStackSetAction** - Create or update a CloudFormation StackSet directly from the pipeline, optionally + immediately create and update Stack Instances as well. +* **CloudFormationDeployStackInstancesAction** - Update outdated Stack Instances using the current version of the StackSet. + +Here's an example of using both of these actions: + +```ts +declare const pipeline: codepipeline.Pipeline; +declare const sourceOutput: codepipeline.Artifact; + +pipeline.addStage({ + stageName: 'DeployStackSets', + actions: [ + // First, update the StackSet itself with the newest template + new codepipeline_actions.CloudFormationDeployStackSetAction({ + actionName: 'UpdateStackSet', + runOrder: 1, + stackSetName: 'MyStackSet', + template: codepipeline_actions.StackSetTemplate.fromArtifactPath(sourceOutput.atPath('template.yaml')), + + // Change this to 'StackSetDeploymentModel.organizations()' if you want to deploy to OUs + deploymentModel: codepipeline_actions.StackSetDeploymentModel.selfManaged(), + // This deploys to a set of accounts + stackInstances: codepipeline_actions.StackInstances.inAccounts(['111111111111'], ['us-east-1', 'eu-west-1']), + }), + + // Afterwards, update/create additional instances in other accounts + new codepipeline_actions.CloudFormationDeployStackInstancesAction({ + actionName: 'AddMoreInstances', + runOrder: 2, + stackSetName: 'MyStackSet', + stackInstances: codepipeline_actions.StackInstances.inAccounts( + ['222222222222', '333333333333'], + ['us-east-1', 'eu-west-1'] + ), + }), + ], +}); +``` + +#### Lambda deployed through CodePipeline + +If you want to deploy your Lambda through CodePipeline, +and you don't use assets (for example, because your CDK code and Lambda code are separate), +you can use a special Lambda `Code` class, `CfnParametersCode`. +Note that your Lambda must be in a different Stack than your Pipeline. +The Lambda itself will be deployed, alongside the entire Stack it belongs to, +using a CloudFormation CodePipeline Action. Example: + +[Example of deploying a Lambda through CodePipeline](test/integ.lambda-deployed-through-codepipeline.lit.ts) + +#### Cross-account actions + +If you want to update stacks in a different account, +pass the `account` property when creating the action: + +```ts +const sourceOutput = new codepipeline.Artifact(); +new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'CloudFormationCreateUpdate', + stackName: 'MyStackName', + adminPermissions: true, + templatePath: sourceOutput.atPath('template.yaml'), + account: '123456789012', +}); +``` + +This will create a new stack, called `-support-123456789012`, in your `App`, +that will contain the role that the pipeline will assume in account 123456789012 before executing this action. +This support stack will automatically be deployed before the stack containing the pipeline. + +You can also pass a role explicitly when creating the action - +in that case, the `account` property is ignored, +and the action will operate in the same account the role belongs to: + +```ts +import { PhysicalName } from 'aws-cdk-lib'; + +// in stack for account 123456789012... +declare const otherAccountStack: Stack; +const actionRole = new iam.Role(otherAccountStack, 'ActionRole', { + assumedBy: new iam.AccountPrincipal('123456789012'), + // the role has to have a physical name set + roleName: PhysicalName.GENERATE_IF_NEEDED, +}); + +// in the pipeline stack... +const sourceOutput = new codepipeline.Artifact(); +new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'CloudFormationCreateUpdate', + stackName: 'MyStackName', + adminPermissions: true, + templatePath: sourceOutput.atPath('template.yaml'), + role: actionRole, // this action will be cross-account as well +}); +``` + +### AWS CodeDeploy + +#### Server deployments + +To use CodeDeploy for EC2/on-premise deployments in a Pipeline: + +```ts +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', { + pipelineName: 'MyPipeline', +}); + +// add the source and build Stages to the Pipeline... +const buildOutput = new codepipeline.Artifact(); +declare const deploymentGroup: codedeploy.ServerDeploymentGroup; +const deployAction = new codepipeline_actions.CodeDeployServerDeployAction({ + actionName: 'CodeDeploy', + input: buildOutput, + deploymentGroup, +}); +pipeline.addStage({ + stageName: 'Deploy', + actions: [deployAction], +}); +``` + +##### Lambda deployments + +To use CodeDeploy for blue-green Lambda deployments in a Pipeline: + +```ts +const lambdaCode = lambda.Code.fromCfnParameters(); +const func = new lambda.Function(this, 'Lambda', { + code: lambdaCode, + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +// used to make sure each CDK synthesis produces a different Version +const version = func.currentVersion; +const alias = new lambda.Alias(this, 'LambdaAlias', { + aliasName: 'Prod', + version, +}); + +new codedeploy.LambdaDeploymentGroup(this, 'DeploymentGroup', { + alias, + deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE, +}); +``` + +Then, you need to create your Pipeline Stack, +where you will define your Pipeline, +and deploy the `lambdaStack` using a CloudFormation CodePipeline Action +(see above for a complete example). + +### ECS + +CodePipeline can deploy an ECS service. +The deploy Action receives one input Artifact which contains the [image definition file]: + +```ts +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +declare const service: ecs.FargateService; +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const buildOutput = new codepipeline.Artifact(); +const deployStage = pipeline.addStage({ + stageName: 'Deploy', + actions: [ + new codepipeline_actions.EcsDeployAction({ + actionName: 'DeployAction', + service, + // if your file is called imagedefinitions.json, + // use the `input` property, + // and leave out the `imageFile` property + input: buildOutput, + // if your file name is _not_ imagedefinitions.json, + // use the `imageFile` property, + // and leave out the `input` property + imageFile: buildOutput.atPath('imageDef.json'), + deploymentTimeout: Duration.minutes(60), // optional, default is 60 minutes + }), + ], +}); +``` + +[image definition file]: https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html#pipelines-create-image-definitions + +#### Deploying ECS applications to existing services + +CodePipeline can deploy to an existing ECS service which uses the +[ECS service ARN format that contains the Cluster name](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). +This also works if the service is in a different account and/or region than the pipeline: + +```ts +import * as ecs from 'aws-cdk-lib/aws-ecs'; + +const service = ecs.BaseService.fromServiceArnWithCluster(this, 'EcsService', + 'arn:aws:ecs:us-east-1:123456789012:service/myClusterName/myServiceName' +); +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const buildOutput = new codepipeline.Artifact(); +// add source and build stages to the pipeline as usual... +const deployStage = pipeline.addStage({ + stageName: 'Deploy', + actions: [ + new codepipeline_actions.EcsDeployAction({ + actionName: 'DeployAction', + service: service, + input: buildOutput, + }), + ], +}); +``` + +When deploying across accounts, especially in a CDK Pipelines self-mutating pipeline, +it is recommended to provide the `role` property to the `EcsDeployAction`. +The Role will need to have permissions assigned to it for ECS deployment. +See [the CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam.html#how-to-custom-role) +for the permissions needed. + +#### Deploying ECS applications stored in a separate source code repository + +The idiomatic CDK way of deploying an ECS application is to have your Dockerfiles and your CDK code in the same source code repository, +leveraging [Docker Assets](https://docs.aws.amazon.com/cdk/latest/guide/assets.html#assets_types_docker), +and use the [CDK Pipelines module](https://docs.aws.amazon.com/cdk/api/latest/docs/pipelines-readme.html). + +However, if you want to deploy a Docker application whose source code is kept in a separate version control repository than the CDK code, +you can use the `TagParameterContainerImage` class from the ECS module. +Here's an example: + +[example ECS pipeline for an application in a separate source code repository](test/integ.pipeline-ecs-separate-source.lit.ts) + +### AWS S3 Deployment + +To use an S3 Bucket as a deployment target in CodePipeline: + +```ts +const sourceOutput = new codepipeline.Artifact(); +const targetBucket = new s3.Bucket(this, 'MyBucket'); + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const deployAction = new codepipeline_actions.S3DeployAction({ + actionName: 'S3Deploy', + bucket: targetBucket, + input: sourceOutput, +}); +const deployStage = pipeline.addStage({ + stageName: 'Deploy', + actions: [deployAction], +}); +``` + +#### Invalidating the CloudFront cache when deploying to S3 + +There is currently no native support in CodePipeline for invalidating a CloudFront cache after deployment. +One workaround is to add another build step after the deploy step, +and use the AWS CLI to invalidate the cache: + +```ts +// Create a Cloudfront Web Distribution +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +declare const distribution: cloudfront.Distribution; + +// Create the build project that will invalidate the cache +const invalidateBuildProject = new codebuild.PipelineProject(this, `InvalidateProject`, { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands:[ + 'aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths "/*"', + // Choose whatever files or paths you'd like, or all files as specified here + ], + }, + }, + }), + environmentVariables: { + CLOUDFRONT_ID: { value: distribution.distributionId }, + }, +}); + +// Add Cloudfront invalidation permissions to the project +const distributionArn = `arn:aws:cloudfront::${this.account}:distribution/${distribution.distributionId}`; +invalidateBuildProject.addToRolePolicy(new iam.PolicyStatement({ + resources: [distributionArn], + actions: [ + 'cloudfront:CreateInvalidation', + ], +})); + +// Create the pipeline (here only the S3 deploy and Invalidate cache build) +const deployBucket = new s3.Bucket(this, 'DeployBucket'); +const deployInput = new codepipeline.Artifact(); +new codepipeline.Pipeline(this, 'Pipeline', { + stages: [ + // ... + { + stageName: 'Deploy', + actions: [ + new codepipeline_actions.S3DeployAction({ + actionName: 'S3Deploy', + bucket: deployBucket, + input: deployInput, + runOrder: 1, + }), + new codepipeline_actions.CodeBuildAction({ + actionName: 'InvalidateCache', + project: invalidateBuildProject, + input: deployInput, + runOrder: 2, + }), + ], + }, + ], +}); +``` + +### Elastic Beanstalk Deployment + +To deploy an Elastic Beanstalk Application in CodePipeline: + +```ts +const sourceOutput = new codepipeline.Artifact(); +const targetBucket = new s3.Bucket(this, 'MyBucket'); + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const deployAction = new codepipeline_actions.ElasticBeanstalkDeployAction({ + actionName: 'ElasticBeanstalkDeploy', + input: sourceOutput, + environmentName: 'envName', + applicationName: 'appName', +}); + +const deployStage = pipeline.addStage({ + stageName: 'Deploy', + actions: [deployAction], +}); +``` + +### Alexa Skill + +You can deploy to Alexa using CodePipeline with the following Action: + +```ts +// Read the secrets from ParameterStore +const clientId = SecretValue.secretsManager('AlexaClientId'); +const clientSecret = SecretValue.secretsManager('AlexaClientSecret'); +const refreshToken = SecretValue.secretsManager('AlexaRefreshToken'); + +// Add deploy action +const sourceOutput = new codepipeline.Artifact(); +new codepipeline_actions.AlexaSkillDeployAction({ + actionName: 'DeploySkill', + runOrder: 1, + input: sourceOutput, + clientId: clientId.toString(), + clientSecret: clientSecret, + refreshToken: refreshToken, + skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', +}); +``` + +If you need manifest overrides you can specify them as `parameterOverridesArtifact` in the action: + +```ts +// Deploy some CFN change set and store output +const executeOutput = new codepipeline.Artifact('CloudFormation'); +const executeChangeSetAction = new codepipeline_actions.CloudFormationExecuteChangeSetAction({ + actionName: 'ExecuteChangesTest', + runOrder: 2, + stackName: 'MyStack', + changeSetName: 'MyChangeSet', + outputFileName: 'overrides.json', + output: executeOutput, +}); + +// Provide CFN output as manifest overrides +const clientId = SecretValue.secretsManager('AlexaClientId'); +const clientSecret = SecretValue.secretsManager('AlexaClientSecret'); +const refreshToken = SecretValue.secretsManager('AlexaRefreshToken'); +const sourceOutput = new codepipeline.Artifact(); +new codepipeline_actions.AlexaSkillDeployAction({ + actionName: 'DeploySkill', + runOrder: 1, + input: sourceOutput, + parameterOverridesArtifact: executeOutput, + clientId: clientId.toString(), + clientSecret: clientSecret, + refreshToken: refreshToken, + skillId: 'amzn1.ask.skill.12345678-1234-1234-1234-123456789012', +}); +``` + +### AWS Service Catalog + +You can deploy a CloudFormation template to an existing Service Catalog product with the following Action: + +```ts +const cdkBuildOutput = new codepipeline.Artifact(); +const serviceCatalogDeployAction = new codepipeline_actions.ServiceCatalogDeployActionBeta1({ + actionName: 'ServiceCatalogDeploy', + templatePath: cdkBuildOutput.atPath("Sample.template.json"), + productVersionName: "Version - " + Date.now.toString, + productVersionDescription: "This is a version from the pipeline with a new description.", + productId: "prod-XXXXXXXX", +}); +``` + +## Approve & invoke + +### Manual approval Action + +This package contains an Action that stops the Pipeline until someone manually clicks the approve button: + +```ts +import * as sns from 'aws-cdk-lib/aws-sns'; + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const approveStage = pipeline.addStage({ stageName: 'Approve' }); +const manualApprovalAction = new codepipeline_actions.ManualApprovalAction({ + actionName: 'Approve', + notificationTopic: new sns.Topic(this, 'Topic'), // optional + notifyEmails: [ + 'some_email@example.com', + ], // optional + additionalInformation: 'additional info', // optional +}); +approveStage.addAction(manualApprovalAction); +// `manualApprovalAction.notificationTopic` can be used to access the Topic +// after the Action has been added to a Pipeline +``` + +If the `notificationTopic` has not been provided, +but `notifyEmails` were, +a new SNS Topic will be created +(and accessible through the `notificationTopic` property of the Action). + +If you want to grant a principal permissions to approve the changes, +you can invoke the method `grantManualApproval` passing it a `IGrantable`: + +```ts +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const approveStage = pipeline.addStage({ stageName: 'Approve' }); +const manualApprovalAction = new codepipeline_actions.ManualApprovalAction({ + actionName: 'Approve', +}); +approveStage.addAction(manualApprovalAction); + +const role = iam.Role.fromRoleArn(this, 'Admin', Arn.format({ service: 'iam', resource: 'role', resourceName: 'Admin' }, this)); +manualApprovalAction.grantManualApproval(role); +``` + +### AWS Lambda + +This module contains an Action that allows you to invoke a Lambda function in a Pipeline: + +```ts +declare const fn: lambda.Function; +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const lambdaAction = new codepipeline_actions.LambdaInvokeAction({ + actionName: 'Lambda', + lambda: fn, +}); +pipeline.addStage({ + stageName: 'Lambda', + actions: [lambdaAction], +}); +``` + +The Lambda Action can have up to 5 inputs, +and up to 5 outputs: + +```ts +declare const fn: lambda.Function; +const sourceOutput = new codepipeline.Artifact(); +const buildOutput = new codepipeline.Artifact(); +const lambdaAction = new codepipeline_actions.LambdaInvokeAction({ + actionName: 'Lambda', + inputs: [ + sourceOutput, + buildOutput, + ], + outputs: [ + new codepipeline.Artifact('Out1'), + new codepipeline.Artifact('Out2'), + ], + lambda: fn, +}); +``` + +The Lambda Action supports custom user parameters that pipeline +will pass to the Lambda function: + +```ts +declare const fn: lambda.Function; + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const lambdaAction = new codepipeline_actions.LambdaInvokeAction({ + actionName: 'Lambda', + lambda: fn, + userParameters: { + foo: 'bar', + baz: 'qux', + }, + // OR + userParametersString: 'my-parameter-string', +}); +``` + +The Lambda invoke action emits variables. +Unlike many other actions, the variables are not static, +but dynamic, defined by the function calling the `PutJobSuccessResult` +API with the `outputVariables` property filled with the map of variables +Example: + +```ts +const lambdaInvokeAction = new codepipeline_actions.LambdaInvokeAction({ + actionName: 'Lambda', + lambda: new lambda.Function(this, 'Func', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(` + const AWS = require('aws-sdk'); + + exports.handler = async function(event, context) { + const codepipeline = new AWS.CodePipeline(); + await codepipeline.putJobSuccessResult({ + jobId: event['CodePipeline.job'].id, + outputVariables: { + MY_VAR: "some value", + }, + }).promise(); + } + `), + }), + variablesNamespace: 'MyNamespace', // optional - by default, a name will be generated for you +}); + +// later: +declare const project: codebuild.PipelineProject; +const sourceOutput = new codepipeline.Artifact(); +new codepipeline_actions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + environmentVariables: { + MyVar: { + value: lambdaInvokeAction.variable('MY_VAR'), + }, + }, +}); +``` + +See [the AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html) +on how to write a Lambda function invoked from CodePipeline. + +### AWS Step Functions + +This module contains an Action that allows you to invoke a Step Function in a Pipeline: + +```ts +import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions'; +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const startState = new stepfunctions.Pass(this, 'StartState'); +const simpleStateMachine = new stepfunctions.StateMachine(this, 'SimpleStateMachine', { + definition: startState, +}); +const stepFunctionAction = new codepipeline_actions.StepFunctionInvokeAction({ + actionName: 'Invoke', + stateMachine: simpleStateMachine, + stateMachineInput: codepipeline_actions.StateMachineInput.literal({ IsHelloWorldExample: true }), +}); +pipeline.addStage({ + stageName: 'StepFunctions', + actions: [stepFunctionAction], +}); +``` + +The `StateMachineInput` can be created with one of 2 static factory methods: +`literal`, which takes an arbitrary map as its only argument, or `filePath`: + +```ts +import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions'; + +const pipeline = new codepipeline.Pipeline(this, 'MyPipeline'); +const inputArtifact = new codepipeline.Artifact(); +const startState = new stepfunctions.Pass(this, 'StartState'); +const simpleStateMachine = new stepfunctions.StateMachine(this, 'SimpleStateMachine', { + definition: startState, +}); +const stepFunctionAction = new codepipeline_actions.StepFunctionInvokeAction({ + actionName: 'Invoke', + stateMachine: simpleStateMachine, + stateMachineInput: codepipeline_actions.StateMachineInput.filePath(inputArtifact.atPath('assets/input.json')), +}); +pipeline.addStage({ + stageName: 'StepFunctions', + actions: [stepFunctionAction], +}); +``` + +See [the AWS documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-StepFunctions.html) +for information on Action structure reference. diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/index.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/action.ts new file mode 100644 index 0000000000000..eee977652e867 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/action.ts @@ -0,0 +1,15 @@ +import * as codepipeline from '../../aws-codepipeline'; + +/** + * Low-level class for generic CodePipeline Actions. + * If you're implementing your own IAction, + * prefer to use the Action class from the codepipeline module. + */ +export abstract class Action extends codepipeline.Action { + protected readonly providedActionProperties: codepipeline.ActionProperties; + + protected constructor(actionProperties: codepipeline.ActionProperties) { + super(); + this.providedActionProperties = actionProperties; + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/alexa-ask/deploy-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/alexa-ask/deploy-action.ts new file mode 100644 index 0000000000000..937fa9c8b2132 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/alexa-ask/deploy-action.ts @@ -0,0 +1,84 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import { SecretValue } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; + +/** + * Construction properties of the `AlexaSkillDeployAction Alexa deploy Action`. + */ +export interface AlexaSkillDeployActionProps extends codepipeline.CommonActionProps { + /** + * The client id of the developer console token + */ + readonly clientId: string; + + /** + * The client secret of the developer console token + */ + readonly clientSecret: SecretValue; + + /** + * The refresh token of the developer console token + */ + readonly refreshToken: SecretValue; + + /** + * The Alexa skill id + */ + readonly skillId: string; + + /** + * The source artifact containing the voice model and skill manifest + */ + readonly input: codepipeline.Artifact; + + /** + * An optional artifact containing overrides for the skill manifest + */ + readonly parameterOverridesArtifact?: codepipeline.Artifact; +} + +/** + * Deploys the skill to Alexa + */ +export class AlexaSkillDeployAction extends Action { + private readonly props: AlexaSkillDeployActionProps; + + constructor(props: AlexaSkillDeployActionProps) { + super({ + ...props, + category: codepipeline.ActionCategory.DEPLOY, + owner: 'ThirdParty', + provider: 'AlexaSkillsKit', + artifactBounds: { + minInputs: 1, + maxInputs: 2, + minOutputs: 0, + maxOutputs: 0, + }, + inputs: getInputs(props), + }); + + this.props = props; + } + + protected bound(_scope: Construct, _stage: codepipeline.IStage, _options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + return { + configuration: { + ClientId: this.props.clientId, + ClientSecret: this.props.clientSecret.unsafeUnwrap(), // Safe usage + RefreshToken: this.props.refreshToken.unsafeUnwrap(), // Safe usage + SkillId: this.props.skillId, + }, + }; + } +} + +function getInputs(props: AlexaSkillDeployActionProps): codepipeline.Artifact[] { + const ret = [props.input]; + if (props.parameterOverridesArtifact) { + ret.push(props.parameterOverridesArtifact); + } + return ret; +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/bitbucket/source-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/bitbucket/source-action.ts new file mode 100644 index 0000000000000..649682d2304c3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/bitbucket/source-action.ts @@ -0,0 +1,37 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as events from '../../../aws-events'; +import { Construct } from 'constructs'; +import { CodeStarConnectionsSourceAction, CodeStarConnectionsSourceActionProps } from '../codestar-connections/source-action'; + +/** + * Construction properties for `BitBucketSourceAction`. + * + * @deprecated use CodeStarConnectionsSourceActionProps instead + */ +export interface BitBucketSourceActionProps extends CodeStarConnectionsSourceActionProps { +} + +/** + * A CodePipeline source action for BitBucket. + * + * @deprecated use CodeStarConnectionsSourceAction instead + */ +export class BitBucketSourceAction implements codepipeline.IAction { + private readonly codeStarConnectionsSourceAction: CodeStarConnectionsSourceAction; + + constructor(props: BitBucketSourceActionProps) { + this.codeStarConnectionsSourceAction = new CodeStarConnectionsSourceAction(props); + } + + public get actionProperties(): codepipeline.ActionProperties { + return this.codeStarConnectionsSourceAction.actionProperties; + } + + public bind(scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): codepipeline.ActionConfig { + return this.codeStarConnectionsSourceAction.bind(scope, stage, options); + } + + public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule { + return this.codeStarConnectionsSourceAction.onStateChange(name, target, options); + } +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/index.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/index.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/index.ts diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts index f5ca9fdcd7c2a..d51535b1936b9 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/pipeline-actions.ts @@ -1,7 +1,7 @@ -import * as cloudformation from '@aws-cdk/aws-cloudformation'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as cloudformation from '../../../aws-cloudformation'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { parseCapabilities, SingletonPolicy } from './private/singleton-policy'; import { Action } from '../action'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/private/singleton-policy.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/private/singleton-policy.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/private/singleton-policy.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/private/singleton-policy.ts index e2bc7cbf7cee3..943af7f3c6872 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/private/singleton-policy.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/private/singleton-policy.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../../aws-iam'; +import * as cdk from '../../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackinstances-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackinstances-action.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackinstances-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackinstances-action.ts index 298aa9d195904..9db519ce6946d 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackinstances-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackinstances-action.ts @@ -1,4 +1,4 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; +import * as codepipeline from '../../../aws-codepipeline'; import { Construct } from 'constructs'; import { SingletonPolicy } from './private/singleton-policy'; import { CommonCloudFormationStackSetOptions, StackInstances, StackSetParameters } from './stackset-types'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts index 30e4e42a6925b..e635615187f27 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-action.ts @@ -1,5 +1,5 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cdk from '@aws-cdk/core'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { parseCapabilities, SingletonPolicy } from './private/singleton-policy'; import { CommonCloudFormationStackSetOptions, StackInstances, StackSetDeploymentModel, StackSetParameters, StackSetTemplate } from './stackset-types'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackset-types.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-types.ts similarity index 99% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackset-types.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-types.ts index 319d96d732997..9b69f9c323f90 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/cloudformation/stackset-types.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/cloudformation/stackset-types.ts @@ -1,6 +1,6 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/codebuild/build-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codebuild/build-action.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/codebuild/build-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/codebuild/build-action.ts index e7e5bb686e00e..52d68a8b2e45b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/codebuild/build-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codebuild/build-action.ts @@ -1,7 +1,7 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { CodeStarConnectionsSourceAction } from '..'; import { Action } from '../action'; diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codecommit/source-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codecommit/source-action.ts new file mode 100644 index 0000000000000..a21bf349fcc31 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codecommit/source-action.ts @@ -0,0 +1,231 @@ +import * as codecommit from '../../../aws-codecommit'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as targets from '../../../aws-events-targets'; +import * as iam from '../../../aws-iam'; +import { Names, Stack, Token, TokenComparison } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { sourceArtifactBounds } from '../common'; + +/** + * How should the CodeCommit Action detect changes. + * This is the type of the `CodeCommitSourceAction.trigger` property. + */ +export enum CodeCommitTrigger { + /** + * The Action will never detect changes - + * the Pipeline it's part of will only begin a run when explicitly started. + */ + NONE = 'None', + + /** + * CodePipeline will poll the repository to detect changes. + */ + POLL = 'Poll', + + /** + * CodePipeline will use CloudWatch Events to be notified of changes. + * This is the default method of detecting changes. + */ + EVENTS = 'Events', +} + +/** + * The CodePipeline variables emitted by the CodeCommit source Action. + */ +export interface CodeCommitSourceVariables { + /** The name of the repository this action points to. */ + readonly repositoryName: string; + + /** The name of the branch this action tracks. */ + readonly branchName: string; + + /** The date the currently last commit on the tracked branch was authored, in ISO-8601 format. */ + readonly authorDate: string; + + /** The date the currently last commit on the tracked branch was committed, in ISO-8601 format. */ + readonly committerDate: string; + + /** The SHA1 hash of the currently last commit on the tracked branch. */ + readonly commitId: string; + + /** The message of the currently last commit on the tracked branch. */ + readonly commitMessage: string; +} + +/** + * Construction properties of the `CodeCommitSourceAction CodeCommit source CodePipeline Action`. + */ +export interface CodeCommitSourceActionProps extends codepipeline.CommonAwsActionProps { + /** + * + */ + readonly output: codepipeline.Artifact; + + /** + * @default 'master' + */ + readonly branch?: string; + + /** + * How should CodePipeline detect source changes for this Action. + * + * @default CodeCommitTrigger.EVENTS + */ + readonly trigger?: CodeCommitTrigger; + + /** + * The CodeCommit repository. + */ + readonly repository: codecommit.IRepository; + + /** + * Role to be used by on commit event rule. + * Used only when trigger value is CodeCommitTrigger.EVENTS. + * + * @default a new role will be created. + */ + readonly eventRole?: iam.IRole; + + /** + * Whether the output should be the contents of the repository + * (which is the default), + * or a link that allows CodeBuild to clone the repository before building. + * + * **Note**: if this option is true, + * then only CodeBuild actions can use the resulting `output`. + * + * @default false + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodeCommit.html + */ + readonly codeBuildCloneOutput?: boolean; +} + +/** + * CodePipeline Source that is provided by an AWS CodeCommit repository. + * + * If the CodeCommit repository is in a different account, you must use + * `CodeCommitTrigger.EVENTS` to trigger the pipeline. + * + * (That is because the Pipeline structure normally only has a `RepositoryName` + * field, and that is not enough for the pipeline to locate the repository's + * source account. However, if the pipeline is triggered via an EventBridge + * event, the event itself has the full repository ARN in there, allowing the + * pipeline to locate the repository). + */ +export class CodeCommitSourceAction extends Action { + /** + * The name of the property that holds the ARN of the CodeCommit Repository + * inside of the CodePipeline Artifact's metadata. + * + * @internal + */ + public static readonly _FULL_CLONE_ARN_PROPERTY = 'CodeCommitCloneRepositoryArn'; + + private readonly branch: string; + private readonly props: CodeCommitSourceActionProps; + + constructor(props: CodeCommitSourceActionProps) { + const branch = props.branch ?? 'master'; + if (!branch) { + throw new Error("'branch' parameter cannot be an empty string"); + } + + if (props.codeBuildCloneOutput === true) { + props.output.setMetadata(CodeCommitSourceAction._FULL_CLONE_ARN_PROPERTY, props.repository.repositoryArn); + } + + super({ + ...props, + resource: props.repository, + category: codepipeline.ActionCategory.SOURCE, + provider: 'CodeCommit', + artifactBounds: sourceArtifactBounds(), + outputs: [props.output], + }); + + this.branch = branch; + this.props = props; + } + + /** The variables emitted by this action. */ + public get variables(): CodeCommitSourceVariables { + return { + repositoryName: this.variableExpression('RepositoryName'), + branchName: this.variableExpression('BranchName'), + authorDate: this.variableExpression('AuthorDate'), + committerDate: this.variableExpression('CommitterDate'), + commitId: this.variableExpression('CommitId'), + commitMessage: this.variableExpression('CommitMessage'), + }; + } + + protected bound(_scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + const createEvent = this.props.trigger === undefined || + this.props.trigger === CodeCommitTrigger.EVENTS; + if (createEvent) { + const eventId = this.generateEventId(stage); + this.props.repository.onCommit(eventId, { + target: new targets.CodePipeline(stage.pipeline, { + eventRole: this.props.eventRole, + }), + branches: [this.branch], + crossStackScope: stage.pipeline as unknown as Construct, + }); + } + + // the Action will write the contents of the Git repository to the Bucket, + // so its Role needs write permissions to the Pipeline Bucket + options.bucket.grantReadWrite(options.role); + // when this action is cross-account, + // the Role needs the s3:PutObjectAcl permission for some not yet fully understood reason + if (Token.compareStrings(this.props.repository.env.account, Stack.of(stage.pipeline).account) === TokenComparison.DIFFERENT) { + options.bucket.grantPutAcl(options.role); + } + + // https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-permissions-reference.html#aa-acp + options.role.addToPrincipalPolicy(new iam.PolicyStatement({ + resources: [this.props.repository.repositoryArn], + actions: [ + 'codecommit:GetBranch', + 'codecommit:GetCommit', + 'codecommit:UploadArchive', + 'codecommit:GetUploadArchiveStatus', + 'codecommit:CancelUploadArchive', + ...(this.props.codeBuildCloneOutput === true ? ['codecommit:GetRepository'] : []), + ], + })); + + return { + configuration: { + RepositoryName: this.props.repository.repositoryName, + BranchName: this.branch, + PollForSourceChanges: this.props.trigger === CodeCommitTrigger.POLL, + OutputArtifactFormat: this.props.codeBuildCloneOutput === true + ? 'CODEBUILD_CLONE_REF' + : undefined, + }, + }; + } + + private generateEventId(stage: codepipeline.IStage): string { + const baseId = Names.nodeUniqueId(stage.pipeline.node); + if (Token.isUnresolved(this.branch)) { + let candidate = ''; + let counter = 0; + do { + candidate = this.eventIdFromPrefix(`${baseId}${counter}`); + counter += 1; + } while (this.props.repository.node.tryFindChild(candidate) !== undefined); + return candidate; + } else { + const branchIdDisambiguator = this.branch === 'master' ? '' : `-${this.branch}-`; + return this.eventIdFromPrefix(`${baseId}${branchIdDisambiguator}`); + } + } + + private eventIdFromPrefix(eventIdPrefix: string) { + return `${eventIdPrefix}EventRule`; + } +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/codedeploy/ecs-deploy-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/ecs-deploy-action.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/codedeploy/ecs-deploy-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/ecs-deploy-action.ts index 83ac88db92f91..c64bbe58f84e8 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/codedeploy/ecs-deploy-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/ecs-deploy-action.ts @@ -1,7 +1,7 @@ -import * as codedeploy from '@aws-cdk/aws-codedeploy'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import { Lazy } from '@aws-cdk/core'; +import * as codedeploy from '../../../aws-codedeploy'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import { Lazy } from '../../../core'; import { Construct } from 'constructs'; import { Action } from '../action'; import { forceSupportStackDependency } from '../private/stack-dependency'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts similarity index 94% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts index b802bbecde4fe..94483a6770f88 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codedeploy/server-deploy-action.ts @@ -1,6 +1,6 @@ -import * as codedeploy from '@aws-cdk/aws-codedeploy'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; +import * as codedeploy from '../../../aws-codedeploy'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; import { Construct } from 'constructs'; import { Action } from '../action'; import { deployArtifactBounds } from '../common'; diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codestar-connections/source-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codestar-connections/source-action.ts new file mode 100644 index 0000000000000..3234f2f2631b7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codestar-connections/source-action.ts @@ -0,0 +1,165 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { sourceArtifactBounds } from '../common'; + +/** + * The CodePipeline variables emitted by CodeStar source Action. + */ +export interface CodeStarSourceVariables { + /** The name of the repository this action points to. */ + readonly fullRepositoryName: string; + /** The name of the branch this action tracks. */ + readonly branchName: string; + /** The date the currently last commit on the tracked branch was authored, in ISO-8601 format. */ + readonly authorDate: string; + /** The SHA1 hash of the currently last commit on the tracked branch. */ + readonly commitId: string; + /** The message of the currently last commit on the tracked branch. */ + readonly commitMessage: string; + /** The connection ARN this source uses. */ + readonly connectionArn: string; +} + +/** + * Construction properties for `CodeStarConnectionsSourceAction`. + */ +export interface CodeStarConnectionsSourceActionProps extends codepipeline.CommonAwsActionProps { + /** + * The output artifact that this action produces. + * Can be used as input for further pipeline actions. + */ + readonly output: codepipeline.Artifact; + + /** + * The ARN of the CodeStar Connection created in the AWS console + * that has permissions to access this GitHub or BitBucket repository. + * + * @example 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh' + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-create.html + */ + readonly connectionArn: string; + + /** + * The owning user or organization of the repository. + * + * @example 'aws' + */ + readonly owner: string; + + /** + * The name of the repository. + * + * @example 'aws-cdk' + */ + readonly repo: string; + + /** + * The branch to build. + * + * @default 'master' + */ + readonly branch?: string; + + // long URL in @see + /** + * Whether the output should be the contents of the repository + * (which is the default), + * or a link that allows CodeBuild to clone the repository before building. + * + * **Note**: if this option is true, + * then only CodeBuild actions can use the resulting `output`. + * + * @default false + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html#action-reference-CodestarConnectionSource-config + */ + readonly codeBuildCloneOutput?: boolean; + + /** + * Controls automatically starting your pipeline when a new commit + * is made on the configured repository and branch. If unspecified, + * the default value is true, and the field does not display by default. + * + * @default true + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html + */ + readonly triggerOnPush?: boolean; +} + +/** + * A CodePipeline source action for the CodeStar Connections source, + * which allows connecting to GitHub and BitBucket. + */ +export class CodeStarConnectionsSourceAction extends Action { + /** + * The name of the property that holds the ARN of the CodeStar Connection + * inside of the CodePipeline Artifact's metadata. + * + * @internal + */ + public static readonly _CONNECTION_ARN_PROPERTY = 'CodeStarConnectionArnProperty'; + + private readonly props: CodeStarConnectionsSourceActionProps; + + constructor(props: CodeStarConnectionsSourceActionProps) { + super({ + ...props, + category: codepipeline.ActionCategory.SOURCE, + owner: 'AWS', // because props also has a (different!) owner property! + provider: 'CodeStarSourceConnection', + artifactBounds: sourceArtifactBounds(), + outputs: [props.output], + }); + + this.props = props; + } + + /** The variables emitted by this action. */ + public get variables(): CodeStarSourceVariables { + return { + fullRepositoryName: this.variableExpression('FullRepositoryName'), + branchName: this.variableExpression('BranchName'), + authorDate: this.variableExpression('AuthorDate'), + commitId: this.variableExpression('CommitId'), + commitMessage: this.variableExpression('CommitMessage'), + connectionArn: this.variableExpression('ConnectionArn'), + }; + } + + protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): codepipeline.ActionConfig { + // https://docs.aws.amazon.com/codepipeline/latest/userguide/security-iam.html#how-to-update-role-new-services + options.role.addToPolicy(new iam.PolicyStatement({ + actions: [ + 'codestar-connections:UseConnection', + ], + resources: [ + this.props.connectionArn, + ], + })); + + // the action needs to write the output to the pipeline bucket + options.bucket.grantReadWrite(options.role); + options.bucket.grantPutAcl(options.role); + + // if codeBuildCloneOutput is true, + // save the connectionArn in the Artifact instance + // to be read by the CodeBuildAction later + if (this.props.codeBuildCloneOutput === true) { + this.props.output.setMetadata(CodeStarConnectionsSourceAction._CONNECTION_ARN_PROPERTY, + this.props.connectionArn); + } + + return { + configuration: { + ConnectionArn: this.props.connectionArn, + FullRepositoryId: `${this.props.owner}/${this.props.repo}`, + BranchName: this.props.branch ?? 'master', + OutputArtifactFormat: this.props.codeBuildCloneOutput === true + ? 'CODEBUILD_CLONE_REF' + : undefined, + DetectChanges: this.props.triggerOnPush, + }, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/common.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/common.ts new file mode 100644 index 0000000000000..a9aa783341876 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/common.ts @@ -0,0 +1,38 @@ +import * as codepipeline from '../../aws-codepipeline'; +import { Token } from '../../core'; + +/** + * The ArtifactBounds that make sense for source Actions - + * they don't have any inputs, and have exactly one output. + */ +export function sourceArtifactBounds(): codepipeline.ActionArtifactBounds { + return { + minInputs: 0, + maxInputs: 0, + minOutputs: 1, + maxOutputs: 1, + }; +} + +/** + * The ArtifactBounds that make sense for deploy Actions - + * they have exactly one input, and don't produce any outputs. + */ +export function deployArtifactBounds(): codepipeline.ActionArtifactBounds { + return { + minInputs: 1, + maxInputs: 1, + minOutputs: 0, + maxOutputs: 0, + }; +} + +export function validatePercentage(name: string, value?: number) { + if (value === undefined || Token.isUnresolved(value)) { + return; + } + + if (value < 0 || value > 100 || !Number.isInteger(value)) { + throw new Error(`'${name}': must be a whole number between 0 and 100, got: ${value}`); + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/ecr/source-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/ecr/source-action.ts new file mode 100644 index 0000000000000..d3c66f35184b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/ecr/source-action.ts @@ -0,0 +1,122 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as ecr from '../../../aws-ecr'; +import { Rule } from '../../../aws-events'; +import * as targets from '../../../aws-events-targets'; +import * as iam from '../../../aws-iam'; +import { Names } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { sourceArtifactBounds } from '../common'; + +/** + * The CodePipeline variables emitted by the ECR source Action. + */ +export interface EcrSourceVariables { + /** The identifier of the registry. In ECR, this is usually the ID of the AWS account owning it. */ + readonly registryId: string; + + /** The physical name of the repository that this action tracks. */ + readonly repositoryName: string; + + /** The digest of the current image, in the form ':'. */ + readonly imageDigest: string; + + /** The Docker tag of the current image. */ + readonly imageTag: string; + + /** The full ECR Docker URI of the current image. */ + readonly imageUri: string; +} + +/** + * Construction properties of `EcrSourceAction`. + */ +export interface EcrSourceActionProps extends codepipeline.CommonAwsActionProps { + /** + * The image tag that will be checked for changes. + * + * It is not possible to trigger on changes to more than one tag. + * + * @default 'latest' + */ + readonly imageTag?: string; + + /** + * + */ + readonly output: codepipeline.Artifact; + + /** + * The repository that will be watched for changes. + */ + readonly repository: ecr.IRepository; +} + +/** + * The ECR Repository source CodePipeline Action. + * + * Will trigger the pipeline as soon as the target tag in the repository + * changes, but only if there is a CloudTrail Trail in the account that + * captures the ECR event. + */ +export class EcrSourceAction extends Action { + private readonly props: EcrSourceActionProps; + + constructor(props: EcrSourceActionProps) { + super({ + ...props, + resource: props.repository, + category: codepipeline.ActionCategory.SOURCE, + provider: 'ECR', + artifactBounds: sourceArtifactBounds(), + outputs: [props.output], + }); + + this.props = props; + } + + /** The variables emitted by this action. */ + public get variables(): EcrSourceVariables { + return { + registryId: this.variableExpression('RegistryId'), + repositoryName: this.variableExpression('RepositoryName'), + imageDigest: this.variableExpression('ImageDigest'), + imageTag: this.variableExpression('ImageTag'), + imageUri: this.variableExpression('ImageURI'), + }; + } + + protected bound(scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + options.role.addToPolicy(new iam.PolicyStatement({ + actions: ['ecr:DescribeImages'], + resources: [this.props.repository.repositoryArn], + })); + + new Rule(scope, Names.nodeUniqueId(stage.pipeline.node) + 'SourceEventRule', { + targets: [ + new targets.CodePipeline(stage.pipeline), + ], + eventPattern: { + detailType: ['ECR Image Action'], + source: ['aws.ecr'], + detail: { + 'result': ['SUCCESS'], + 'repository-name': [this.props.repository.repositoryName], + 'image-tag': [this.props.imageTag === '' ? undefined : (this.props.imageTag ?? 'latest')], + 'action-type': ['PUSH'], + }, + }, + }); + + // the Action Role also needs to write to the Pipeline's bucket + options.bucket.grantWrite(options.role); + + return { + configuration: { + RepositoryName: this.props.repository.repositoryName, + ImageTag: this.props.imageTag ? this.props.imageTag : undefined, // `''` is falsy in JS/TS + }, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/ecs/deploy-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/ecs/deploy-action.ts new file mode 100644 index 0000000000000..1fc5d7fd83a71 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/ecs/deploy-action.ts @@ -0,0 +1,133 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as ecs from '../../../aws-ecs'; +import * as iam from '../../../aws-iam'; +import { Duration } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { deployArtifactBounds } from '../common'; + +/** + * Construction properties of `EcsDeployAction`. + */ +export interface EcsDeployActionProps extends codepipeline.CommonAwsActionProps { + /** + * The input artifact that contains the JSON image definitions file to use for deployments. + * The JSON file is a list of objects, + * each with 2 keys: `name` is the name of the container in the Task Definition, + * and `imageUri` is the Docker image URI you want to update your service with. + * If you use this property, it's assumed the file is called 'imagedefinitions.json'. + * If your build uses a different file, leave this property empty, + * and use the `imageFile` property instead. + * + * @default - one of this property, or `imageFile`, is required + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html#pipelines-create-image-definitions + */ + readonly input?: codepipeline.Artifact; + + /** + * The name of the JSON image definitions file to use for deployments. + * The JSON file is a list of objects, + * each with 2 keys: `name` is the name of the container in the Task Definition, + * and `imageUri` is the Docker image URI you want to update your service with. + * Use this property if you want to use a different name for this file than the default 'imagedefinitions.json'. + * If you use this property, you don't need to specify the `input` property. + * + * @default - one of this property, or `input`, is required + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create.html#pipelines-create-image-definitions + */ + readonly imageFile?: codepipeline.ArtifactPath; + + /** + * The ECS Service to deploy. + */ + readonly service: ecs.IBaseService; + + /** + * Timeout for the ECS deployment in minutes. Value must be between 1-60. + * + * @default - 60 minutes + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-ECS.html + */ + readonly deploymentTimeout?: Duration; +} + +/** + * CodePipeline Action to deploy an ECS Service. + */ +export class EcsDeployAction extends Action { + private readonly props: EcsDeployActionProps; + private readonly deploymentTimeout?: number + + constructor(props: EcsDeployActionProps) { + super({ + ...props, + category: codepipeline.ActionCategory.DEPLOY, + provider: 'ECS', + artifactBounds: deployArtifactBounds(), + inputs: [determineInputArtifact(props)], + resource: props.service, + }); + + const deploymentTimeout = props.deploymentTimeout?.toMinutes({ integral: true }); + if (deploymentTimeout !== undefined && (deploymentTimeout < 1 || deploymentTimeout > 60)) { + throw new Error(`Deployment timeout must be between 1 and 60 minutes, got: ${deploymentTimeout}`); + } + + this.props = props; + this.deploymentTimeout = deploymentTimeout; + } + + protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + // permissions based on CodePipeline documentation: + // https://docs.aws.amazon.com/codepipeline/latest/userguide/how-to-custom-role.html#how-to-update-role-new-services + options.role.addToPolicy(new iam.PolicyStatement({ + actions: [ + 'ecs:DescribeServices', + 'ecs:DescribeTaskDefinition', + 'ecs:DescribeTasks', + 'ecs:ListTasks', + 'ecs:RegisterTaskDefinition', + 'ecs:UpdateService', + ], + resources: ['*'], + })); + + options.role.addToPolicy(new iam.PolicyStatement({ + actions: ['iam:PassRole'], + resources: ['*'], + conditions: { + StringEqualsIfExists: { + 'iam:PassedToService': [ + 'ec2.amazonaws.com', + 'ecs-tasks.amazonaws.com', + ], + }, + }, + })); + + options.bucket.grantRead(options.role); + + return { + configuration: { + ClusterName: this.props.service.cluster.clusterName, + ServiceName: this.props.service.serviceName, + FileName: this.props.imageFile?.fileName, + DeploymentTimeout: this.deploymentTimeout, + }, + }; + } +} + +function determineInputArtifact(props: EcsDeployActionProps): codepipeline.Artifact { + if (props.imageFile && props.input) { + throw new Error("Exactly one of 'input' or 'imageFile' can be provided in the ECS deploy Action"); + } + if (props.imageFile) { + return props.imageFile.artifact; + } + if (props.input) { + return props.input; + } + throw new Error("Specifying one of 'input' or 'imageFile' is required for the ECS deploy Action"); +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/elastic-beanstalk/deploy-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/elastic-beanstalk/deploy-action.ts new file mode 100644 index 0000000000000..b81f630702388 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/elastic-beanstalk/deploy-action.ts @@ -0,0 +1,66 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { deployArtifactBounds } from '../common'; + +/** + * Construction properties of the `ElasticBeanstalkDeployAction Elastic Beanstalk deploy CodePipeline Action`. + */ +export interface ElasticBeanstalkDeployActionProps extends codepipeline.CommonAwsActionProps { + /** + * The source to use as input for deployment. + */ + readonly input: codepipeline.Artifact; + + /** + * The name of the AWS Elastic Beanstalk application to deploy. + */ + readonly applicationName: string; + + /** + * The name of the AWS Elastic Beanstalk environment to deploy to. + */ + readonly environmentName: string; +} + +/** + * CodePipeline action to deploy an AWS ElasticBeanstalk Application. + */ +export class ElasticBeanstalkDeployAction extends Action { + private readonly applicationName: string; + private readonly environmentName: string; + + constructor(props: ElasticBeanstalkDeployActionProps) { + super({ + ...props, + category: codepipeline.ActionCategory.DEPLOY, + provider: 'ElasticBeanstalk', + artifactBounds: deployArtifactBounds(), + inputs: [props.input], + }); + + this.applicationName = props.applicationName; + this.environmentName = props.environmentName; + } + + protected bound( + _scope: Construct, + _stage: codepipeline.IStage, + options: codepipeline.ActionBindOptions, + ): codepipeline.ActionConfig { + + // Per https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.iam.managed-policies.html + // it doesn't seem we can scope this down further for the codepipeline action. + options.role.addManagedPolicy({ managedPolicyArn: 'arn:aws:iam::aws:policy/AdministratorAccess-AWSElasticBeanstalk' }); + + // the Action's Role needs to read from the Bucket to get artifacts + options.bucket.grantRead(options.role); + + return { + configuration: { + ApplicationName: this.applicationName, + EnvironmentName: this.environmentName, + }, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/github/source-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/github/source-action.ts new file mode 100644 index 0000000000000..53a40141b8c2c --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/github/source-action.ts @@ -0,0 +1,160 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import { SecretValue } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { sourceArtifactBounds } from '../common'; + +/** + * If and how the GitHub source action should be triggered + */ +export enum GitHubTrigger { + NONE = 'None', + POLL = 'Poll', + WEBHOOK = 'WebHook', +} + +/** + * The CodePipeline variables emitted by GitHub source Action. + */ +export interface GitHubSourceVariables { + /** The name of the repository this action points to. */ + readonly repositoryName: string; + /** The name of the branch this action tracks. */ + readonly branchName: string; + /** The date the currently last commit on the tracked branch was authored, in ISO-8601 format. */ + readonly authorDate: string; + /** The date the currently last commit on the tracked branch was committed, in ISO-8601 format. */ + readonly committerDate: string; + /** The SHA1 hash of the currently last commit on the tracked branch. */ + readonly commitId: string; + /** The message of the currently last commit on the tracked branch. */ + readonly commitMessage: string; + /** The GitHub API URL of the currently last commit on the tracked branch. */ + readonly commitUrl: string; +} + +/** + * Construction properties of the `GitHubSourceAction GitHub source action`. + */ +export interface GitHubSourceActionProps extends codepipeline.CommonActionProps { + /** + * + */ + readonly output: codepipeline.Artifact; + + /** + * The GitHub account/user that owns the repo. + */ + readonly owner: string; + + /** + * The name of the repo, without the username. + */ + readonly repo: string; + + /** + * The branch to use. + * + * @default "master" + */ + readonly branch?: string; + + /** + * A GitHub OAuth token to use for authentication. + * + * It is recommended to use a Secrets Manager `Secret` to obtain the token: + * + * const oauth = cdk.SecretValue.secretsManager('my-github-token'); + * new GitHubSourceAction(this, 'GitHubAction', { oauthToken: oauth, ... }); + * + * If you rotate the value in the Secret, you must also change at least one property + * of the CodePipeline to force CloudFormation to re-read the secret. + * + * The GitHub Personal Access Token should have these scopes: + * + * * **repo** - to read the repository + * * **admin:repo_hook** - if you plan to use webhooks (true by default) + * + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/appendix-github-oauth.html#GitHub-create-personal-token-CLI + */ + readonly oauthToken: SecretValue; + + /** + * How AWS CodePipeline should be triggered + * + * With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action + * With "POLL", CodePipeline periodically checks the source for changes + * With "None", the action is not triggered through changes in the source + * + * To use `WEBHOOK`, your GitHub Personal Access Token should have + * **admin:repo_hook** scope (in addition to the regular **repo** scope). + * + * @default GitHubTrigger.WEBHOOK + */ + readonly trigger?: GitHubTrigger; +} + +/** + * Source that is provided by a GitHub repository. + */ +export class GitHubSourceAction extends Action { + private readonly props: GitHubSourceActionProps; + + constructor(props: GitHubSourceActionProps) { + super({ + ...props, + category: codepipeline.ActionCategory.SOURCE, + owner: 'ThirdParty', + provider: 'GitHub', + artifactBounds: sourceArtifactBounds(), + outputs: [props.output], + }); + + this.props = props; + } + + /** The variables emitted by this action. */ + public get variables(): GitHubSourceVariables { + return { + repositoryName: this.variableExpression('RepositoryName'), + branchName: this.variableExpression('BranchName'), + authorDate: this.variableExpression('AuthorDate'), + committerDate: this.variableExpression('CommitterDate'), + commitId: this.variableExpression('CommitId'), + commitMessage: this.variableExpression('CommitMessage'), + commitUrl: this.variableExpression('CommitUrl'), + }; + } + + protected bound(scope: Construct, stage: codepipeline.IStage, _options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + if (!this.props.trigger || this.props.trigger === GitHubTrigger.WEBHOOK) { + new codepipeline.CfnWebhook(scope, 'WebhookResource', { + authentication: 'GITHUB_HMAC', + authenticationConfiguration: { + secretToken: this.props.oauthToken.unsafeUnwrap(), // Safe usage + }, + filters: [ + { + jsonPath: '$.ref', + matchEquals: 'refs/heads/{Branch}', + }, + ], + targetAction: this.actionProperties.actionName, + targetPipeline: stage.pipeline.pipelineName, + targetPipelineVersion: 1, + registerWithThirdParty: true, + }); + } + + return { + configuration: { + Owner: this.props.owner, + Repo: this.props.repo, + Branch: this.props.branch || 'master', + OAuthToken: this.props.oauthToken.unsafeUnwrap(), + PollForSourceChanges: this.props.trigger === GitHubTrigger.POLL, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/index.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/index.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/index.ts diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/jenkins/jenkins-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/jenkins/jenkins-action.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/jenkins/jenkins-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/jenkins/jenkins-action.ts index a73e2db679426..8507d10fdd5ca 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/jenkins/jenkins-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/jenkins/jenkins-action.ts @@ -1,4 +1,4 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; +import * as codepipeline from '../../../aws-codepipeline'; import { Construct } from 'constructs'; import { IJenkinsProvider, jenkinsArtifactsBounds } from './jenkins-provider'; import { Action } from '../action'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/jenkins/jenkins-provider.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/jenkins/jenkins-provider.ts similarity index 99% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/jenkins/jenkins-provider.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/jenkins/jenkins-provider.ts index 5f2b4aa064482..8e4e9d786c955 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/jenkins/jenkins-provider.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/jenkins/jenkins-provider.ts @@ -1,4 +1,4 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; +import * as codepipeline from '../../../aws-codepipeline'; import { Construct, IConstruct } from 'constructs'; /** diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/lambda/invoke-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/lambda/invoke-action.ts new file mode 100644 index 0000000000000..d207d2dcdd48e --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/lambda/invoke-action.ts @@ -0,0 +1,140 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import { Stack } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; + +/** + * Construction properties of the `LambdaInvokeAction Lambda invoke CodePipeline Action`. + */ +export interface LambdaInvokeActionProps extends codepipeline.CommonAwsActionProps { + /** + * The optional input Artifacts of the Action. + * A Lambda Action can have up to 5 inputs. + * The inputs will appear in the event passed to the Lambda, + * under the `'CodePipeline.job'.data.inputArtifacts` path. + * + * @default the Action will not have any inputs + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example + */ + readonly inputs?: codepipeline.Artifact[]; + + /** + * The optional names of the output Artifacts of the Action. + * A Lambda Action can have up to 5 outputs. + * The outputs will appear in the event passed to the Lambda, + * under the `'CodePipeline.job'.data.outputArtifacts` path. + * It is the responsibility of the Lambda to upload ZIP files with the Artifact contents to the provided locations. + * + * @default the Action will not have any outputs + */ + readonly outputs?: codepipeline.Artifact[]; + + /** + * A set of key-value pairs that will be accessible to the invoked Lambda + * inside the event that the Pipeline will call it with. + * + * Only one of `userParameters` or `userParametersString` can be specified. + * + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example + * @default - no user parameters will be passed + */ + readonly userParameters?: { [key: string]: any }; + + /** + * The string representation of the user parameters that will be + * accessible to the invoked Lambda inside the event + * that the Pipeline will call it with. + * + * Only one of `userParametersString` or `userParameters` can be specified. + * + * @default - no user parameters will be passed + */ + readonly userParametersString?: string; + + /** + * The lambda function to invoke. + */ + readonly lambda: lambda.IFunction; +} + +/** + * CodePipeline invoke Action that is provided by an AWS Lambda function. + * + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html + */ +export class LambdaInvokeAction extends Action { + private readonly props: LambdaInvokeActionProps; + + constructor(props: LambdaInvokeActionProps) { + super({ + ...props, + resource: props.lambda, + category: codepipeline.ActionCategory.INVOKE, + provider: 'Lambda', + artifactBounds: { + minInputs: 0, + maxInputs: 5, + minOutputs: 0, + maxOutputs: 5, + }, + }); + + this.props = props; + + if (props.userParameters && props.userParametersString) { + throw new Error('Only one of userParameters or userParametersString can be specified'); + } + } + + /** + * Reference a CodePipeline variable defined by the Lambda function this action points to. + * Variables in Lambda invoke actions are defined by calling the PutJobSuccessResult CodePipeline API call + * with the 'outputVariables' property filled. + * + * @param variableName the name of the variable to reference. + * A variable by this name must be present in the 'outputVariables' section of the PutJobSuccessResult + * request that the Lambda function calls when the action is invoked + * + * @see https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PutJobSuccessResult.html + */ + public variable(variableName: string): string { + return this.variableExpression(variableName); + } + + protected bound(scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + // allow pipeline to list functions + options.role.addToPolicy(new iam.PolicyStatement({ + actions: ['lambda:ListFunctions'], + resources: ['*'], + })); + + // allow pipeline to invoke this lambda functionn + this.props.lambda.grantInvoke(options.role); + + // allow the Role access to the Bucket, if there are any inputs/outputs + if ((this.actionProperties.inputs || []).length > 0) { + options.bucket.grantRead(options.role); + } + if ((this.actionProperties.outputs || []).length > 0) { + options.bucket.grantWrite(options.role); + } + + // allow lambda to put job results for this pipeline + // CodePipeline requires this to be granted to '*' + // (the Pipeline ARN will not be enough) + this.props.lambda.addToRolePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['codepipeline:PutJobSuccessResult', 'codepipeline:PutJobFailureResult'], + })); + + return { + configuration: { + FunctionName: this.props.lambda.functionName, + UserParameters: this.props.userParametersString ?? Stack.of(scope).toJsonString(this.props.userParameters), + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/manual-approval-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/manual-approval-action.ts similarity index 95% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/manual-approval-action.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/manual-approval-action.ts index 252d89fa46e75..bad1935b8c7e3 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/manual-approval-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/manual-approval-action.ts @@ -1,7 +1,7 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as subs from '@aws-cdk/aws-sns-subscriptions'; +import * as codepipeline from '../../aws-codepipeline'; +import * as iam from '../../aws-iam'; +import * as sns from '../../aws-sns'; +import * as subs from '../../aws-sns-subscriptions'; import { Construct } from 'constructs'; import { Action } from './action'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/private/stack-dependency.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/private/stack-dependency.ts similarity index 90% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/private/stack-dependency.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/private/stack-dependency.ts index 84976246d8bff..5c24fb4647d64 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/private/stack-dependency.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/private/stack-dependency.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Resource, Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import { Resource, Stack } from '../../../core'; /** * Create a dependency between the stack of the replication bucket and the stack of the action role diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/deploy-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/deploy-action.ts new file mode 100644 index 0000000000000..470a32f2b49ee --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/deploy-action.ts @@ -0,0 +1,135 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as s3 from '../../../aws-s3'; +import { Duration } from '../../../core'; +import { kebab as toKebabCase } from 'case'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { deployArtifactBounds } from '../common'; + +// Class copied verbatim from the aws-s3-deployment module. +// Yes, it sucks that we didn't abstract this properly in a common class, +// but having 2 different CacheControl classes that behave differently would be worse I think. +// Something to do when CDK 2.0.0 comes out. +/** + * Used for HTTP cache-control header, which influences downstream caches. + * Use the provided static factory methods to construct instances of this class. + * Used in the `S3DeployActionProps.cacheControl` property. + * + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 + */ +export class CacheControl { + /** The 'must-revalidate' cache control directive. */ + public static mustRevalidate() { return new CacheControl('must-revalidate'); } + /** The 'no-cache' cache control directive. */ + public static noCache() { return new CacheControl('no-cache'); } + /** The 'no-transform' cache control directive. */ + public static noTransform() { return new CacheControl('no-transform'); } + /** The 'public' cache control directive. */ + public static setPublic() { return new CacheControl('public'); } + /** The 'private' cache control directive. */ + public static setPrivate() { return new CacheControl('private'); } + /** The 'proxy-revalidate' cache control directive. */ + public static proxyRevalidate() { return new CacheControl('proxy-revalidate'); } + /** The 'max-age' cache control directive. */ + public static maxAge(t: Duration) { return new CacheControl(`max-age=${t.toSeconds()}`); } + /** The 's-max-age' cache control directive. */ + public static sMaxAge(t: Duration) { return new CacheControl(`s-maxage=${t.toSeconds()}`); } + /** + * Allows you to create an arbitrary cache control directive, + * in case our support is missing a method for a particular directive. + */ + public static fromString(s: string) { return new CacheControl(s); } + + /** @param value the actual text value of the created directive */ + private constructor(public value: string) {} +} + +/** + * Construction properties of the `S3DeployAction S3 deploy Action`. + */ +export interface S3DeployActionProps extends codepipeline.CommonAwsActionProps { + /** + * Should the deploy action extract the artifact before deploying to Amazon S3. + * + * @default true + */ + readonly extract?: boolean; + + /** + * The key of the target object. This is required if extract is false. + */ + readonly objectKey?: string; + + /** + * The input Artifact to deploy to Amazon S3. + */ + readonly input: codepipeline.Artifact; + + /** + * The Amazon S3 bucket that is the deploy target. + */ + readonly bucket: s3.IBucket; + + /** + * The specified canned ACL to objects deployed to Amazon S3. + * This overwrites any existing ACL that was applied to the object. + * + * @default - the original object ACL + */ + readonly accessControl?: s3.BucketAccessControl; + + /** + * The caching behavior for requests/responses for objects in the bucket. + * The final cache control property will be the result of joining all of the provided array elements with a comma + * (plus a space after the comma). + * + * @default - none, decided by the HTTP client + */ + readonly cacheControl?: CacheControl[]; +} + +/** + * Deploys the sourceArtifact to Amazon S3. + */ +export class S3DeployAction extends Action { + private readonly props: S3DeployActionProps; + + constructor(props: S3DeployActionProps) { + super({ + ...props, + resource: props.bucket, + category: codepipeline.ActionCategory.DEPLOY, + provider: 'S3', + artifactBounds: deployArtifactBounds(), + inputs: [props.input], + }); + + this.props = props; + } + + protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + // pipeline needs permissions to write to the S3 bucket + this.props.bucket.grantWrite(options.role); + + if (this.props.accessControl !== undefined) { + // we need to modify the ACL settings of objects within the Bucket, + // so grant the Action's Role permissions to do that + this.props.bucket.grantPutAcl(options.role); + } + + // the Action Role also needs to read from the Pipeline's bucket + options.bucket.grantRead(options.role); + + const acl = this.props.accessControl; + return { + configuration: { + BucketName: this.props.bucket.bucketName, + Extract: this.props.extract === false ? 'false' : 'true', + ObjectKey: this.props.objectKey, + CannedACL: acl ? toKebabCase(acl.toString()) : undefined, + CacheControl: this.props.cacheControl && this.props.cacheControl.map(ac => ac.value).join(', '), + }, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/source-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/source-action.ts new file mode 100644 index 0000000000000..144aceebf7cf2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/s3/source-action.ts @@ -0,0 +1,168 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as targets from '../../../aws-events-targets'; +import * as s3 from '../../../aws-s3'; +import { Names, Token } from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; +import { sourceArtifactBounds } from '../common'; + +/** + * How should the S3 Action detect changes. + * This is the type of the `S3SourceAction.trigger` property. + */ +export enum S3Trigger { + /** + * The Action will never detect changes - + * the Pipeline it's part of will only begin a run when explicitly started. + */ + NONE = 'None', + + /** + * CodePipeline will poll S3 to detect changes. + * This is the default method of detecting changes. + */ + POLL = 'Poll', + + /** + * CodePipeline will use CloudWatch Events to be notified of changes. + * Note that the Bucket that the Action uses needs to be part of a CloudTrail Trail + * for the events to be delivered. + */ + EVENTS = 'Events', +} + +/** + * The CodePipeline variables emitted by the S3 source Action. + */ +export interface S3SourceVariables { + /** The identifier of the S3 version of the object that triggered the build. */ + readonly versionId: string; + + /** The e-tag of the S3 version of the object that triggered the build. */ + readonly eTag: string; +} + +/** + * Construction properties of the `S3SourceAction S3 source Action`. + */ +export interface S3SourceActionProps extends codepipeline.CommonAwsActionProps { + /** + * + */ + readonly output: codepipeline.Artifact; + + /** + * The key within the S3 bucket that stores the source code. + * + * @example 'path/to/file.zip' + */ + readonly bucketKey: string; + + /** + * How should CodePipeline detect source changes for this Action. + * Note that if this is S3Trigger.EVENTS, you need to make sure to include the source Bucket in a CloudTrail Trail, + * as otherwise the CloudWatch Events will not be emitted. + * + * @default S3Trigger.POLL + * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/log-s3-data-events.html + */ + readonly trigger?: S3Trigger; + + /** + * The Amazon S3 bucket that stores the source code. + * + * If you import an encrypted bucket in your stack, please specify + * the encryption key at import time by using `Bucket.fromBucketAttributes()` method. + */ + readonly bucket: s3.IBucket; +} + +/** + * Source that is provided by a specific Amazon S3 object. + * + * Will trigger the pipeline as soon as the S3 object changes, but only if there is + * a CloudTrail Trail in the account that captures the S3 event. + */ +export class S3SourceAction extends Action { + private readonly props: S3SourceActionProps; + + constructor(props: S3SourceActionProps) { + super({ + ...props, + resource: props.bucket, + category: codepipeline.ActionCategory.SOURCE, + provider: 'S3', + artifactBounds: sourceArtifactBounds(), + outputs: [props.output], + }); + + if (props.bucketKey.length === 0) { + throw new Error('Property bucketKey cannot be an empty string'); + } + + this.props = props; + } + + /** The variables emitted by this action. */ + public get variables(): S3SourceVariables { + return { + versionId: this.variableExpression('VersionId'), + eTag: this.variableExpression('ETag'), + }; + } + + protected bound(_scope: Construct, stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + if (this.props.trigger === S3Trigger.EVENTS) { + const id = this.generateEventId(stage); + this.props.bucket.onCloudTrailWriteObject(id, { + target: new targets.CodePipeline(stage.pipeline), + paths: [this.props.bucketKey], + crossStackScope: stage.pipeline as unknown as Construct, + }); + } + + // we need to read from the source bucket... + this.props.bucket.grantRead(options.role, this.props.bucketKey); + + // ...and write to the Pipeline bucket + options.bucket.grantWrite(options.role); + + return { + configuration: { + S3Bucket: this.props.bucket.bucketName, + S3ObjectKey: this.props.bucketKey, + PollForSourceChanges: this.props.trigger && this.props.trigger === S3Trigger.POLL, + }, + }; + } + + private generateEventId(stage: codepipeline.IStage): string { + let ret: string; + const baseId = Names.nodeUniqueId(stage.pipeline.node) + 'SourceEventRule'; + + if (Token.isUnresolved(this.props.bucketKey)) { + // If bucketKey is a Token, don't include it in the ID. + // Instead, use numbers to differentiate if multiple actions observe the same bucket + let candidate = baseId; + let counter = 0; + while (this.props.bucket.node.tryFindChild(candidate) !== undefined) { + counter += 1; + candidate = baseId + counter; + } + ret = candidate; + } else { + // we can't use Tokens in construct IDs, + // however, if bucketKey is not a Token, + // we want it to differentiate between multiple actions + // observing the same Bucket with different keys + ret = baseId + this.props.bucketKey; + if (this.props.bucket.node.tryFindChild(ret)) { + // this means a duplicate path for the same bucket - error out + throw new Error(`S3 source action with path '${this.props.bucketKey}' is already present in the pipeline for this source bucket`); + } + } + + return ret; + } +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/lib/servicecatalog/deploy-action-beta1.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/servicecatalog/deploy-action-beta1.ts similarity index 96% rename from packages/@aws-cdk/aws-codepipeline-actions/lib/servicecatalog/deploy-action-beta1.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/lib/servicecatalog/deploy-action-beta1.ts index c45a815ac914f..1bb5a8cfffc9b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/lib/servicecatalog/deploy-action-beta1.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/servicecatalog/deploy-action-beta1.ts @@ -1,5 +1,5 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; import { Construct } from 'constructs'; import { Action } from '../action'; diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/lib/stepfunctions/invoke-action.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/stepfunctions/invoke-action.ts new file mode 100644 index 0000000000000..842407f681b4f --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/lib/stepfunctions/invoke-action.ts @@ -0,0 +1,161 @@ +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as stepfunction from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; +import { Construct } from 'constructs'; +import { Action } from '../action'; + +/** + * Represents the input for the StateMachine. + */ +export class StateMachineInput { + /** + * When the input type is FilePath, input artifact and + * filepath must be specified. + */ + public static filePath(inputFile: codepipeline.ArtifactPath): StateMachineInput { + return new StateMachineInput(inputFile.location, inputFile.artifact, 'FilePath'); + } + + /** + * When the input type is Literal, input value is passed + * directly to the state machine input. + */ + public static literal(object: object): StateMachineInput { + return new StateMachineInput(JSON.stringify(object), undefined, 'Literal'); + } + + /** + * The optional input Artifact of the Action. + * If InputType is set to FilePath, this artifact is required + * and is used to source the input for the state machine execution. + * + * @default - the Action will not have any inputs + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-StepFunctions.html#action-reference-StepFunctions-example + */ + public readonly inputArtifact?: codepipeline.Artifact; + + /** + * Optional StateMachine InputType + * InputType can be Literal or FilePath + * + * @default - Literal + */ + public readonly inputType?: string; + + /** + * When InputType is set to Literal (default), the Input field is used + * directly as the input for the state machine execution. + * Otherwise, the state machine is invoked with an empty JSON object {}. + * + * When InputType is set to FilePath, this field is required. + * An input artifact is also required when InputType is set to FilePath. + * + * @default - none + */ + public readonly input: any; + + private constructor(input: any, inputArtifact: codepipeline.Artifact | undefined, inputType: string) { + this.input = input; + this.inputArtifact = inputArtifact; + this.inputType = inputType; + } +} + +/** + * Construction properties of the `StepFunctionsInvokeAction StepFunction Invoke Action`. + */ +export interface StepFunctionsInvokeActionProps extends codepipeline.CommonAwsActionProps { + /** + * The optional output Artifact of the Action. + * + * @default the Action will not have any outputs + */ + readonly output?: codepipeline.Artifact; + + /** + * The state machine to invoke. + */ + readonly stateMachine: stepfunction.IStateMachine; + + /** + * Represents the input to the StateMachine. + * This includes input artifact, input type and the statemachine input. + * + * @default - none + */ + readonly stateMachineInput?: StateMachineInput; + + /** + * Prefix (optional) + * + * By default, the action execution ID is used as the state machine execution name. + * If a prefix is provided, it is prepended to the action execution ID with a hyphen and + * together used as the state machine execution name. + * + * @default - action execution ID + */ + readonly executionNamePrefix?: string; +} + +/** + * StepFunctionInvokeAction that is provided by an AWS CodePipeline. + */ +export class StepFunctionInvokeAction extends Action { + private readonly props: StepFunctionsInvokeActionProps; + + constructor(props: StepFunctionsInvokeActionProps) { + super({ + ...props, + resource: props.stateMachine, + category: codepipeline.ActionCategory.INVOKE, + provider: 'StepFunctions', + artifactBounds: { + minInputs: 0, + maxInputs: 1, + minOutputs: 0, + maxOutputs: 1, + }, + inputs: (props.stateMachineInput && props.stateMachineInput.inputArtifact) ? [props.stateMachineInput.inputArtifact] : [], + outputs: (props.output) ? [props.output] : [], + }); + this.props = props; + } + + protected bound(_scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): + codepipeline.ActionConfig { + // allow pipeline to invoke this step function + options.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['states:StartExecution', 'states:DescribeStateMachine'], + resources: [this.props.stateMachine.stateMachineArn], + })); + + // allow state machine executions to be inspected + options.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['states:DescribeExecution'], + resources: [cdk.Stack.of(this.props.stateMachine).formatArn({ + service: 'states', + resource: 'execution', + resourceName: `${cdk.Stack.of(this.props.stateMachine).splitArn(this.props.stateMachine.stateMachineArn, cdk.ArnFormat.COLON_RESOURCE_NAME).resourceName}:${this.props.executionNamePrefix ?? ''}*`, + arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME, + })], + })); + + // allow the Role access to the Bucket, if there are any inputs/outputs + if ((this.actionProperties.inputs ?? []).length > 0) { + options.bucket.grantRead(options.role); + } + if ((this.actionProperties.outputs ?? []).length > 0) { + options.bucket.grantWrite(options.role); + } + + return { + configuration: { + StateMachineArn: this.props.stateMachine.stateMachineArn, + Input: this.props.stateMachineInput?.input, + InputType: this.props.stateMachineInput?.inputType, + ExecutionNamePrefix: this.props.executionNamePrefix, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/assets/nodejs.zip b/packages/aws-cdk-lib/aws-codepipeline-actions/test/assets/nodejs.zip similarity index 100% rename from packages/@aws-cdk/aws-codepipeline-actions/test/assets/nodejs.zip rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/assets/nodejs.zip diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/bitbucket-source-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/bitbucket/bitbucket-source-action.test.ts similarity index 96% rename from packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/bitbucket-source-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/bitbucket/bitbucket-source-action.test.ts index 7d22f2b690015..bf55e4ed6434f 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/bitbucket/bitbucket-source-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/bitbucket/bitbucket-source-action.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/cloudformation-pipeline-actions.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/cloudformation-pipeline-actions.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/cloudformation-pipeline-actions.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/cloudformation-pipeline-actions.test.ts index daeed409aba42..c1102a13ebbb1 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/cloudformation-pipeline-actions.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/cloudformation-pipeline-actions.test.ts @@ -1,9 +1,9 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { PolicyStatement, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codecommit from '../../../aws-codecommit'; +import * as codepipeline from '../../../aws-codepipeline'; +import { PolicyStatement, Role, ServicePrincipal } from '../../../aws-iam'; +import * as cdk from '../../../core'; import { TestFixture } from './test-fixture'; import * as cpactions from '../../lib'; diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/cloudformation-stackset-pipeline-actions.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/cloudformation-stackset-pipeline-actions.test.ts similarity index 99% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/cloudformation-stackset-pipeline-actions.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/cloudformation-stackset-pipeline-actions.test.ts index a618ee858a942..a78dea00f1cc9 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/cloudformation-stackset-pipeline-actions.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/cloudformation-stackset-pipeline-actions.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { TestFixture } from './test-fixture'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/pipeline-actions.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/pipeline-actions.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/pipeline-actions.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/pipeline-actions.test.ts index 05ef548385597..cce7140273c8f 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/pipeline-actions.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/pipeline-actions.test.ts @@ -1,9 +1,9 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as notifications from '../../../aws-codestarnotifications'; +import * as events from '../../../aws-events'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import * as cdk from '../../../core'; import { Construct, IConstruct, Node } from 'constructs'; import * as _ from 'lodash'; import * as cpactions from '../../lib'; diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml new file mode 100644 index 0000000000000..c2c61591f6778 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/test-artifact/template.yaml @@ -0,0 +1,6 @@ +Resources: + Filler: + Type: AWS::CloudFormation::WaitConditionHandle +Outputs: + Great: + Value: It works! \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test-fixture.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/test-fixture.ts similarity index 88% rename from packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test-fixture.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/test-fixture.ts index f981d829c2a2d..898172711090c 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/cloudformation/test-fixture.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/cloudformation/test-fixture.ts @@ -1,6 +1,6 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cdk from '@aws-cdk/core'; +import * as codecommit from '../../../aws-codecommit'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as cdk from '../../../core'; import * as cpactions from '../../lib'; /** diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/codebuild-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codebuild/codebuild-action.test.ts similarity index 96% rename from packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/codebuild-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/codebuild/codebuild-action.test.ts index fdd470bf19640..7abf5c80c7e20 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/codebuild/codebuild-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codebuild/codebuild-action.test.ts @@ -1,10 +1,10 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import { App, SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codecommit from '../../../aws-codecommit'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as s3 from '../../../aws-s3'; +import * as sns from '../../../aws-sns'; +import { App, SecretValue, Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/codecommit-source-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codecommit/codecommit-source-action.test.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/codecommit-source-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/codecommit/codecommit-source-action.test.ts index b317e522fb1e5..b483270d960cb 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/codecommit/codecommit-source-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codecommit/codecommit-source-action.test.ts @@ -1,11 +1,11 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack, Lazy, App } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codecommit from '../../../aws-codecommit'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as s3 from '../../../aws-s3'; +import { Stack, Lazy, App } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/codedeploy/ecs-deploy-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codedeploy/ecs-deploy-action.test.ts new file mode 100644 index 0000000000000..ca700e4e6ac0b --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codedeploy/ecs-deploy-action.test.ts @@ -0,0 +1,274 @@ +import { Template } from '../../../assertions'; +import * as codedeploy from '../../../aws-codedeploy'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as cdk from '../../../core'; +import * as cpactions from '../../lib'; + +describe('CodeDeploy ECS Deploy Action', () => { + describe('CodeDeploy ECS Deploy Action', () => { + test('throws an exception if more than 4 container image inputs are provided', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + const artifact = new codepipeline.Artifact('Artifact'); + + const containerImageInputs: cpactions.CodeDeployEcsContainerImageInput[] = []; + for (let i = 0; i < 5; i++) { + containerImageInputs.push({ + input: artifact, + }); + } + + expect(() => { + new cpactions.CodeDeployEcsDeployAction({ + actionName: 'DeployToECS', + deploymentGroup, + taskDefinitionTemplateInput: artifact, + appSpecTemplateInput: artifact, + containerImageInputs, + }); + }).toThrow(/Action cannot have more than 4 container image inputs, got: 5/); + + + }); + + test('throws an exception if both appspec artifact input and file are specified', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + const artifact = new codepipeline.Artifact('Artifact'); + const artifactPath = new codepipeline.ArtifactPath(artifact, 'hello'); + + expect(() => { + new cpactions.CodeDeployEcsDeployAction({ + actionName: 'DeployToECS', + deploymentGroup, + taskDefinitionTemplateInput: artifact, + appSpecTemplateInput: artifact, + appSpecTemplateFile: artifactPath, + }); + }).toThrow(/Exactly one of 'appSpecTemplateInput' or 'appSpecTemplateFile' can be provided in the ECS CodeDeploy Action/); + + + }); + + test('throws an exception if neither appspec artifact input nor file are specified', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.CodeDeployEcsDeployAction({ + actionName: 'DeployToECS', + deploymentGroup, + taskDefinitionTemplateInput: artifact, + }); + }).toThrow(/Specifying one of 'appSpecTemplateInput' or 'appSpecTemplateFile' is required for the ECS CodeDeploy Action/); + + + }); + + test('throws an exception if both task definition artifact input and file are specified', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + const artifact = new codepipeline.Artifact('Artifact'); + const artifactPath = new codepipeline.ArtifactPath(artifact, 'hello'); + + expect(() => { + new cpactions.CodeDeployEcsDeployAction({ + actionName: 'DeployToECS', + deploymentGroup, + taskDefinitionTemplateInput: artifact, + taskDefinitionTemplateFile: artifactPath, + appSpecTemplateInput: artifact, + }); + }).toThrow(/Exactly one of 'taskDefinitionTemplateInput' or 'taskDefinitionTemplateFile' can be provided in the ECS CodeDeploy Action/); + + + }); + + test('throws an exception if neither task definition artifact input nor file are specified', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.CodeDeployEcsDeployAction({ + actionName: 'DeployToECS', + deploymentGroup, + appSpecTemplateInput: artifact, + }); + }).toThrow(/Specifying one of 'taskDefinitionTemplateInput' or 'taskDefinitionTemplateFile' is required for the ECS CodeDeploy Action/); + + + }); + + test('defaults task definition and appspec template paths', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + addCodeDeployECSCodePipeline(stack, { + actionName: 'DeployToECS', + deploymentGroup, + taskDefinitionTemplateInput: new codepipeline.Artifact('TaskDefArtifact'), + appSpecTemplateInput: new codepipeline.Artifact('AppSpecArtifact'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + {}, + { + Actions: [ + { + Configuration: { + ApplicationName: 'MyApplication', + DeploymentGroupName: 'MyDeploymentGroup', + TaskDefinitionTemplateArtifact: 'TaskDefArtifact', + AppSpecTemplateArtifact: 'AppSpecArtifact', + TaskDefinitionTemplatePath: 'taskdef.json', + AppSpecTemplatePath: 'appspec.yaml', + }, + InputArtifacts: [ + { + Name: 'TaskDefArtifact', + }, + { + Name: 'AppSpecArtifact', + }, + ], + }, + ], + }, + ], + }); + + + }); + + test('defaults task definition placeholder string', () => { + const stack = new cdk.Stack(); + const deploymentGroup = addEcsDeploymentGroup(stack); + const artifact1 = new codepipeline.Artifact(); + const artifact2 = new codepipeline.Artifact(); + addCodeDeployECSCodePipeline(stack, { + actionName: 'DeployToECS', + deploymentGroup, + taskDefinitionTemplateFile: artifact1.atPath('task-definition.json'), + appSpecTemplateFile: artifact2.atPath('appspec-test.yaml'), + containerImageInputs: [ + { + input: artifact1, + }, + { + input: artifact2, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + {}, + { + Actions: [ + { + Configuration: { + ApplicationName: 'MyApplication', + DeploymentGroupName: 'MyDeploymentGroup', + TaskDefinitionTemplateArtifact: 'Artifact_Source_GitHub', + AppSpecTemplateArtifact: 'Artifact_Source_GitHub2', + TaskDefinitionTemplatePath: 'task-definition.json', + AppSpecTemplatePath: 'appspec-test.yaml', + Image1ArtifactName: 'Artifact_Source_GitHub', + Image1ContainerName: 'IMAGE', + Image2ArtifactName: 'Artifact_Source_GitHub2', + Image2ContainerName: 'IMAGE', + }, + InputArtifacts: [ + { + Name: 'Artifact_Source_GitHub', + }, + { + Name: 'Artifact_Source_GitHub2', + }, + ], + }, + ], + }, + ], + }); + + + }); + }); + + test('cross-account cross-region deployment has correct dependency between support stacks', () => { + // GIVEN + const stackEnv: cdk.Environment = { account: '111111111111', region: 'us-east-1' }; + const deployEnv: cdk.Environment = { account: '222222222222', region: 'us-east-2' }; + + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Pipe', { env: stackEnv }); + const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, 'Group', { + application: codedeploy.EcsApplication.fromEcsApplicationArn(stack, 'Application', + `arn:aws:codedeploy:${deployEnv.region}:${deployEnv.account}:application:MyApplication`), + deploymentGroupName: 'MyGroup', + }); + + // WHEN + addCodeDeployECSCodePipeline(stack, { + actionName: 'DeployECS', + deploymentGroup, + taskDefinitionTemplateInput: new codepipeline.Artifact('Artifact'), + appSpecTemplateInput: new codepipeline.Artifact('Artifact2'), + }); + + // THEN - dependency from region stack to account stack + // (region stack has bucket, account stack has role) + const asm = app.synth(); + + const stacks = Object.fromEntries(asm.stacks.map(s => [s.stackName, s])); + expect(Object.keys(stacks)).toContain('Pipe-support-us-east-2'); + expect(Object.keys(stacks)).toContain('Pipe-support-222222222222'); + + expect(stacks['Pipe-support-us-east-2'].dependencies).toContain(stacks['Pipe-support-222222222222']); + }); +}); + +function addEcsDeploymentGroup(stack: cdk.Stack): codedeploy.IEcsDeploymentGroup { + return codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes( + stack, 'EDG', { + application: codedeploy.EcsApplication.fromEcsApplicationName( + stack, 'EA', 'MyApplication', + ), + deploymentGroupName: 'MyDeploymentGroup', + }); +} + +function addCodeDeployECSCodePipeline(stack: cdk.Stack, props: cpactions.CodeDeployEcsDeployActionProps) { + new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.GitHubSourceAction({ + actionName: 'GitHub', + output: props.taskDefinitionTemplateInput || props.taskDefinitionTemplateFile!.artifact, + oauthToken: cdk.SecretValue.unsafePlainText('secret'), + owner: 'awslabs', + repo: 'aws-cdk', + }), + new cpactions.GitHubSourceAction({ + actionName: 'GitHub2', + output: props.appSpecTemplateInput || props.appSpecTemplateFile!.artifact, + oauthToken: cdk.SecretValue.unsafePlainText('secret'), + owner: 'awslabs', + repo: 'aws-cdk-2', + }), + ], + }, + { + stageName: 'Invoke', + actions: [ + new cpactions.CodeDeployEcsDeployAction(props), + ], + }, + ], + }); +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/codestar-connections/codestar-connections-source-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codestar-connections/codestar-connections-source-action.test.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline-actions/test/codestar-connections/codestar-connections-source-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/codestar-connections/codestar-connections-source-action.test.ts index eb85f0fc2d1e3..131d533059fe1 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/codestar-connections/codestar-connections-source-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/codestar-connections/codestar-connections-source-action.test.ts @@ -1,7 +1,7 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { App, Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import { App, Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/ecr/ecr-source-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/ecr/ecr-source-action.test.ts similarity index 94% rename from packages/@aws-cdk/aws-codepipeline-actions/test/ecr/ecr-source-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/ecr/ecr-source-action.test.ts index a728a9f9c5e45..0de297c56a2dc 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/ecr/ecr-source-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/ecr/ecr-source-action.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as ecr from '../../../aws-ecr'; +import { Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/ecs/ecs-deploy-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/ecs/ecs-deploy-action.test.ts new file mode 100644 index 0000000000000..0517cd47b4245 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/ecs/ecs-deploy-action.test.ts @@ -0,0 +1,294 @@ +import { Template } from '../../../assertions'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as s3 from '../../../aws-s3'; +import * as cdk from '../../../core'; +import * as cpactions from '../../lib'; + +describe('ecs deploy action', () => { + describe('ECS deploy Action', () => { + test('throws an exception if neither inputArtifact nor imageFile were provided', () => { + const service = anyEcsService(); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + }); + }).toThrow(/one of 'input' or 'imageFile' is required/); + + + }); + + test('can be created just by specifying the inputArtifact', () => { + const service = anyEcsService(); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + }); + }).not.toThrow(); + + + }); + + test('can be created just by specifying the imageFile', () => { + const service = anyEcsService(); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + imageFile: artifact.atPath('imageFile.json'), + }); + }).not.toThrow(); + + + }); + + test('throws an exception if both inputArtifact and imageFile were provided', () => { + const service = anyEcsService(); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + imageFile: artifact.atPath('file.json'), + }); + }).toThrow(/one of 'input' or 'imageFile' can be provided/); + + + }); + + test('can be created with deploymentTimeout between 1-60 minutes', () => { + const service = anyEcsService(); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + deploymentTimeout: cdk.Duration.minutes(30), + }); + }).not.toThrow(); + + + }); + + test('throws an exception if deploymentTimeout is out of bounds', () => { + const service = anyEcsService(); + const artifact = new codepipeline.Artifact('Artifact'); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + deploymentTimeout: cdk.Duration.minutes(61), + }); + }).toThrow(/timeout must be between 1 and 60 minutes/); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + deploymentTimeout: cdk.Duration.minutes(0), + }); + }).toThrow(/timeout must be between 1 and 60 minutes/); + + expect(() => { + new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + deploymentTimeout: cdk.Duration.seconds(30), + }); + }).toThrow(/cannot be converted into a whole number/); + + + }); + + test("sets the target service as the action's backing resource", () => { + const service = anyEcsService(); + const artifact = new codepipeline.Artifact('Artifact'); + + const action = new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + input: artifact, + }); + + expect(action.actionProperties.resource).toEqual(service); + + + }); + + test('can be created by existing service', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const service = ecs.FargateService.fromFargateServiceAttributes(stack, 'FargateService', { + serviceName: 'service-name', + cluster: ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { + vpc, + securityGroups: [], + clusterName: 'cluster-name', + }), + }); + const artifact = new codepipeline.Artifact('Artifact'); + const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const source = new cpactions.S3SourceAction({ + actionName: 'Source', + output: artifact, + bucket, + bucketKey: 'key', + }); + const action = new cpactions.EcsDeployAction({ + actionName: 'ECS', + service, + imageFile: artifact.atPath('imageFile.json'), + }); + new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [source], + }, + { + stageName: 'Deploy', + actions: [action], + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + {}, + { + Actions: [ + { + Name: 'ECS', + ActionTypeId: { + Category: 'Deploy', + Provider: 'ECS', + }, + Configuration: { + ClusterName: 'cluster-name', + ServiceName: 'service-name', + FileName: 'imageFile.json', + }, + }, + ], + }, + ], + }); + + + }); + + test('can be created by existing service with cluster ARN format', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'PipelineStack', { + env: { + region: 'pipeline-region', account: 'pipeline-account', + }, + }); + const clusterName = 'cluster-name'; + const serviceName = 'service-name'; + const region = 'service-region'; + const account = 'service-account'; + const serviceArn = `arn:aws:ecs:${region}:${account}:service/${clusterName}/${serviceName}`; + const service = ecs.BaseService.fromServiceArnWithCluster(stack, 'FargateService', serviceArn); + + const artifact = new codepipeline.Artifact('Artifact'); + const bucket = new s3.Bucket(stack, 'PipelineBucket', { + versioned: true, + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + const source = new cpactions.S3SourceAction({ + actionName: 'Source', + output: artifact, + bucket, + bucketKey: 'key', + }); + const action = new cpactions.EcsDeployAction({ + actionName: 'ECS', + service: service, + input: artifact, + }); + new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [source], + }, + { + stageName: 'Deploy', + actions: [action], + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + {}, + { + Actions: [ + { + Name: 'ECS', + ActionTypeId: { + Category: 'Deploy', + Provider: 'ECS', + }, + Configuration: { + ClusterName: clusterName, + ServiceName: serviceName, + }, + Region: region, + RoleArn: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + `:iam::${account}:role/pipelinestack-support-serloyecsactionrole49867f847238c85af7c0`, + ], + ], + }, + }, + ], + }, + ], + }); + }); + }); +}); + +function anyEcsService(): ecs.FargateService { + const stack = new cdk.Stack(); + const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDefinition'); + taskDefinition.addContainer('MainContainer', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new ecs.Cluster(stack, 'Cluster', { + vpc, + }); + return new ecs.FargateService(stack, 'FargateService', { + cluster, + taskDefinition, + }); +} diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/elastic-beanstalk/elastic-beanstalk-deploy-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/elastic-beanstalk/elastic-beanstalk-deploy-action.test.ts similarity index 94% rename from packages/@aws-cdk/aws-codepipeline-actions/test/elastic-beanstalk/elastic-beanstalk-deploy-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/elastic-beanstalk/elastic-beanstalk-deploy-action.test.ts index 16855d3342f11..821aad867a4fd 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/elastic-beanstalk/elastic-beanstalk-deploy-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/elastic-beanstalk/elastic-beanstalk-deploy-action.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { Bucket } from '@aws-cdk/aws-s3'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as codepipeline from '../../../aws-codepipeline'; +import { Bucket } from '../../../aws-s3'; +import { App, Stack } from '../../../core'; import { ElasticBeanstalkDeployAction, S3SourceAction, S3Trigger } from '../../lib'; describe('elastic beanstalk deploy action tests', () => { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/github/github-source-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/github/github-source-action.test.ts similarity index 96% rename from packages/@aws-cdk/aws-codepipeline-actions/test/github/github-source-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/github/github-source-action.test.ts index 7b88d369d0870..7fbd567c9a09c 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/github/github-source-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/github/github-source-action.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { App, SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import { App, SecretValue, Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts new file mode 100644 index 0000000000000..90ca8e3a22aea --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts @@ -0,0 +1,62 @@ +import * as codecommit from '../../aws-codecommit'; +import * as codepipeline from '../../aws-codepipeline'; +import * as cdk from '../../core'; +import * as cpactions from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-codepipeline-cloudformation'); + +/// !show +// Source stage: read from repository +const repo = new codecommit.Repository(stack, 'TemplateRepo', { + repositoryName: 'template-repo', +}); +const sourceOutput = new codepipeline.Artifact('SourceArtifact'); +const source = new cpactions.CodeCommitSourceAction({ + actionName: 'Source', + repository: repo, + output: sourceOutput, + trigger: cpactions.CodeCommitTrigger.POLL, +}); +const sourceStage = { + stageName: 'Source', + actions: [source], +}; + +// Deployment stage: create and deploy changeset with manual approval +const stackName = 'OurStack'; +const changeSetName = 'StagedChangeSet'; + +const prodStage = { + stageName: 'Deploy', + actions: [ + new cpactions.CloudFormationCreateReplaceChangeSetAction({ + actionName: 'PrepareChanges', + stackName, + changeSetName, + adminPermissions: true, + templatePath: sourceOutput.atPath('template.yaml'), + runOrder: 1, + }), + new cpactions.ManualApprovalAction({ + actionName: 'ApproveChanges', + runOrder: 2, + }), + new cpactions.CloudFormationExecuteChangeSetAction({ + actionName: 'ExecuteChanges', + stackName, + changeSetName, + runOrder: 3, + }), + ], +}; + +new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + sourceStage, + prodStage, + ], +}); +/// !hide + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts new file mode 100644 index 0000000000000..8c2a13a20bc85 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.ts @@ -0,0 +1,133 @@ +/// !cdk-integ PipelineStack +import * as codebuild from '../../aws-codebuild'; +import * as codecommit from '../../aws-codecommit'; +import * as codepipeline from '../../aws-codepipeline'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; +import * as codepipeline_actions from '../lib'; + +const app = new cdk.App(); + +/// !show +const lambdaStack = new cdk.Stack(app, 'LambdaStack'); +const lambdaCode = lambda.Code.fromCfnParameters(); +new lambda.Function(lambdaStack, 'Lambda', { + code: lambdaCode, + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); +// other resources that your Lambda needs, added to the lambdaStack... + +const pipelineStack = new cdk.Stack(app, 'PipelineStack'); +const pipeline = new codepipeline.Pipeline(pipelineStack, 'Pipeline'); + +// add the source code repository containing this code to your Pipeline, +// and the source code of the Lambda Function, if they're separate +const cdkSourceOutput = new codepipeline.Artifact(); +const cdkSourceAction = new codepipeline_actions.CodeCommitSourceAction({ + repository: new codecommit.Repository(pipelineStack, 'CdkCodeRepo', { + repositoryName: 'CdkCodeRepo', + }), + actionName: 'CdkCode_Source', + output: cdkSourceOutput, +}); +const lambdaSourceOutput = new codepipeline.Artifact(); +const lambdaSourceAction = new codepipeline_actions.CodeCommitSourceAction({ + repository: new codecommit.Repository(pipelineStack, 'LambdaCodeRepo', { + repositoryName: 'LambdaCodeRepo', + }), + actionName: 'LambdaCode_Source', + output: lambdaSourceOutput, +}); +pipeline.addStage({ + stageName: 'Source', + actions: [cdkSourceAction, lambdaSourceAction], +}); + +// synthesize the Lambda CDK template, using CodeBuild +// the below values are just examples, assuming your CDK code is in TypeScript/JavaScript - +// adjust the build environment and/or commands accordingly +const cdkBuildProject = new codebuild.Project(pipelineStack, 'CdkBuildProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: 'npm install', + }, + build: { + commands: [ + 'npm run build', + 'npm run cdk synth LambdaStack -- -o .', + ], + }, + }, + artifacts: { + files: 'LambdaStack.template.yaml', + }, + }), +}); +const cdkBuildOutput = new codepipeline.Artifact(); +const cdkBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'CDK_Build', + project: cdkBuildProject, + input: cdkSourceOutput, + outputs: [cdkBuildOutput], +}); + +// build your Lambda code, using CodeBuild +// again, this example assumes your Lambda is written in TypeScript/JavaScript - +// make sure to adjust the build environment and/or commands if they don't match your specific situation +const lambdaBuildProject = new codebuild.Project(pipelineStack, 'LambdaBuildProject', { + environment: { + buildImage: codebuild.LinuxBuildImage.UBUNTU_14_04_NODEJS_10_1_0, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: 'npm install', + }, + build: { + commands: 'npm run build', + }, + }, + artifacts: { + files: [ + 'index.js', + 'node_modules/**/*', + ], + }, + }), +}); +const lambdaBuildOutput = new codepipeline.Artifact(); +const lambdaBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'Lambda_Build', + project: lambdaBuildProject, + input: lambdaSourceOutput, + outputs: [lambdaBuildOutput], +}); + +pipeline.addStage({ + stageName: 'Build', + actions: [cdkBuildAction, lambdaBuildAction], +}); + +// finally, deploy your Lambda Stack +pipeline.addStage({ + stageName: 'Deploy', + actions: [ + new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'Lambda_CFN_Deploy', + templatePath: cdkBuildOutput.atPath('LambdaStack.template.yaml'), + stackName: 'LambdaStackDeployedName', + adminPermissions: true, + parameterOverrides: lambdaCode.assign(lambdaBuildOutput.s3Location), + extraInputs: [ + lambdaBuildOutput, + ], + }), + ], +}); diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts new file mode 100644 index 0000000000000..4dce565c3d199 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.ts @@ -0,0 +1,221 @@ +/// !cdk-integ * + +import * as codebuild from '../../aws-codebuild'; +import * as codecommit from '../../aws-codecommit'; +import * as codepipeline from '../../aws-codepipeline'; +import * as ec2 from '../../aws-ec2'; +import * as ecr from '../../aws-ecr'; +import * as ecs from '../../aws-ecs'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import * as codepipeline_actions from '../lib'; + +/** + * This example demonstrates how to create a CodePipeline that deploys an ECS Service + * from a different source repository than the source repository of your CDK code. + * If your application code and your CDK code are in the same repository, + * use the CDK Pipelines module instead of this method. + */ + +/// !show + +/** + * These are the construction properties for `EcsAppStack`. + * They extend the standard Stack properties, + * but also require providing the ContainerImage that the service will use. + * That Image will be provided from the Stack containing the CodePipeline. + */ +export interface EcsAppStackProps extends cdk.StackProps { + readonly image: ecs.ContainerImage; +} + +/** + * This is the Stack containing a simple ECS Service that uses the provided ContainerImage. + */ +export class EcsAppStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: EcsAppStackProps) { + super(scope, id, props); + + const taskDefinition = new ecs.TaskDefinition(this, 'TaskDefinition', { + compatibility: ecs.Compatibility.FARGATE, + cpu: '1024', + memoryMiB: '2048', + }); + taskDefinition.addContainer('AppContainer', { + image: props.image, + }); + new ecs.FargateService(this, 'EcsService', { + taskDefinition, + cluster: new ecs.Cluster(this, 'Cluster', { + vpc: new ec2.Vpc(this, 'Vpc', { + maxAzs: 1, + }), + }), + }); + } +} + +/** + * This is the Stack containing the CodePipeline definition that deploys an ECS Service. + */ +export class PipelineStack extends cdk.Stack { + public readonly tagParameterContainerImage: ecs.TagParameterContainerImage; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /* ********** ECS part **************** */ + + // this is the ECR repository where the built Docker image will be pushed + const appEcrRepo = new ecr.Repository(this, 'EcsDeployRepository'); + // the build that creates the Docker image, and pushes it to the ECR repo + const appCodeDockerBuild = new codebuild.PipelineProject(this, 'AppCodeDockerImageBuildAndPushProject', { + environment: { + // we need to run Docker + privileged: true, + }, + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + // login to ECR first + '$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)', + // if your application needs any build steps, they would be invoked here + + // build the image, and tag it with the commit hash + // (CODEBUILD_RESOLVED_SOURCE_VERSION is a special environment variable available in CodeBuild) + 'docker build -t $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION .', + ], + }, + post_build: { + commands: [ + // push the built image into the ECR repository + 'docker push $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION', + // save the declared tag as an environment variable, + // that is then exported below in the 'exported-variables' section as a CodePipeline Variable + 'export imageTag=$CODEBUILD_RESOLVED_SOURCE_VERSION', + ], + }, + }, + env: { + // save the imageTag environment variable as a CodePipeline Variable + 'exported-variables': [ + 'imageTag', + ], + }, + }), + environmentVariables: { + REPOSITORY_URI: { + value: appEcrRepo.repositoryUri, + }, + }, + }); + // needed for `docker push` + appEcrRepo.grantPullPush(appCodeDockerBuild); + // create the ContainerImage used for the ECS application Stack + this.tagParameterContainerImage = new ecs.TagParameterContainerImage(appEcrRepo); + + const cdkCodeBuild = new codebuild.PipelineProject(this, 'CdkCodeBuildProject', { + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: [ + 'npm install', + ], + }, + build: { + commands: [ + // synthesize the CDK code for the ECS application Stack + 'npx cdk synth --verbose', + ], + }, + }, + artifacts: { + // store the entire Cloud Assembly as the output artifact + 'base-directory': 'cdk.out', + 'files': '**/*', + }, + }), + }); + + /* ********** Pipeline part **************** */ + + const appCodeSourceOutput = new codepipeline.Artifact(); + const cdkCodeSourceOutput = new codepipeline.Artifact(); + const cdkCodeBuildOutput = new codepipeline.Artifact(); + const appCodeBuildAction = new codepipeline_actions.CodeBuildAction({ + actionName: 'AppCodeDockerImageBuildAndPush', + project: appCodeDockerBuild, + input: appCodeSourceOutput, + }); + new codepipeline.Pipeline(this, 'CodePipelineDeployingEcsApplication', { + artifactBucket: new s3.Bucket(this, 'ArtifactBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }), + stages: [ + { + stageName: 'Source', + actions: [ + // this is the Action that takes the source of your application code + new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'AppCodeSource', + repository: new codecommit.Repository(this, 'AppCodeSourceRepository', { repositoryName: 'AppCodeSourceRepository' }), + output: appCodeSourceOutput, + }), + // this is the Action that takes the source of your CDK code + // (which would probably include this Pipeline code as well) + new codepipeline_actions.CodeCommitSourceAction({ + actionName: 'CdkCodeSource', + repository: new codecommit.Repository(this, 'CdkCodeSourceRepository', { repositoryName: 'CdkCodeSourceRepository' }), + output: cdkCodeSourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + appCodeBuildAction, + new codepipeline_actions.CodeBuildAction({ + actionName: 'CdkCodeBuildAndSynth', + project: cdkCodeBuild, + input: cdkCodeSourceOutput, + outputs: [cdkCodeBuildOutput], + }), + ], + }, + { + stageName: 'Deploy', + actions: [ + new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + actionName: 'CFN_Deploy', + stackName: 'SampleEcsStackDeployedFromCodePipeline', + // this name has to be the same name as used below in the CDK code for the application Stack + templatePath: cdkCodeBuildOutput.atPath('EcsStackDeployedInPipeline.template.json'), + adminPermissions: true, + parameterOverrides: { + // read the tag pushed to the ECR repository from the CodePipeline Variable saved by the application build step, + // and pass it as the CloudFormation Parameter for the tag + [this.tagParameterContainerImage.tagParameterName]: appCodeBuildAction.variable('imageTag'), + }, + }), + ], + }, + ], + }); + } +} + +const app = new cdk.App(); + +// the CodePipeline Stack needs to be created first +const pipelineStack = new PipelineStack(app, 'aws-cdk-pipeline-ecs-separate-sources'); +// we supply the image to the ECS application Stack from the CodePipeline Stack +new EcsAppStack(app, 'EcsStackDeployedInPipeline', { + image: pipelineStack.tagParameterContainerImage, +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/lambda/lambda-invoke-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/lambda/lambda-invoke-action.test.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline-actions/test/lambda/lambda-invoke-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/lambda/lambda-invoke-action.test.ts index c62c6519f4301..f64b47d34b38a 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/lambda/lambda-invoke-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/lambda/lambda-invoke-action.test.ts @@ -1,9 +1,9 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import { App, Aws, Lazy, SecretValue, Stack, Token } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as lambda from '../../../aws-lambda'; +import * as s3 from '../../../aws-s3'; +import * as sns from '../../../aws-sns'; +import { App, Aws, Lazy, SecretValue, Stack, Token } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/manual-approval.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/manual-approval.test.ts similarity index 95% rename from packages/@aws-cdk/aws-codepipeline-actions/test/manual-approval.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/manual-approval.test.ts index c0d3b6609ddf9..a1c19633cbf2b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/manual-approval.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/manual-approval.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import { SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as codepipeline from '../../aws-codepipeline'; +import * as iam from '../../aws-iam'; +import * as sns from '../../aws-sns'; +import { SecretValue, Stack } from '../../core'; import * as cpactions from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts new file mode 100644 index 0000000000000..488eb8e786018 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/pipeline.test.ts @@ -0,0 +1,1146 @@ +import { Template } from '../../assertions'; +import * as codebuild from '../../aws-codebuild'; +import * as codecommit from '../../aws-codecommit'; +import * as codepipeline from '../../aws-codepipeline'; +import * as targets from '../../aws-events-targets'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import { App, Aws, CfnParameter, SecretValue, Stack } from '../../core'; +import * as cpactions from '../lib'; + +/* eslint-disable quote-props */ + +describe('pipeline', () => { + test('basic pipeline', () => { + const stack = new Stack(); + + const repository = new codecommit.Repository(stack, 'MyRepo', { + repositoryName: 'my-repo', + }); + + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); + const sourceOutput = new codepipeline.Artifact('SourceArtifact'); + const source = new cpactions.CodeCommitSourceAction({ + actionName: 'source', + output: sourceOutput, + repository, + }); + pipeline.addStage({ + stageName: 'source', + actions: [source], + }); + + const project = new codebuild.PipelineProject(stack, 'MyBuildProject'); + pipeline.addStage({ + stageName: 'build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'build', + input: sourceOutput, + project, + }), + ], + }); + + expect(Template.fromStack(stack).toJSON()).not.toEqual({}); + expect([]).toEqual(pipeline.node.validate()); + }); + + test('Tokens can be used as physical names of the Pipeline', () => { + const stack = new Stack(undefined, 'StackName'); + + const p = new codepipeline.Pipeline(stack, 'Pipeline', { + pipelineName: Aws.STACK_NAME, + }); + p.addStage({ + stageName: 'Source', + actions: [ + new cpactions.GitHubSourceAction({ + actionName: 'GH', + runOrder: 8, + output: new codepipeline.Artifact('A'), + branch: 'branch', + oauthToken: SecretValue.unsafePlainText('secret'), + owner: 'foo', + repo: 'bar', + trigger: cpactions.GitHubTrigger.POLL, + }), + ], + }); + + p.addStage({ + stageName: 'Two', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'Boo' }), + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'Name': { + 'Ref': 'AWS::StackName', + }, + }); + + + }); + + test('pipeline with GitHub source with poll trigger', () => { + const stack = new Stack(); + + const secret = new CfnParameter(stack, 'GitHubToken', { type: 'String', default: 'my-token' }); + + const p = new codepipeline.Pipeline(stack, 'P'); + + p.addStage({ + stageName: 'Source', + actions: [ + new cpactions.GitHubSourceAction({ + actionName: 'GH', + runOrder: 8, + output: new codepipeline.Artifact('A'), + branch: 'branch', + oauthToken: SecretValue.unsafePlainText(secret.valueAsString), + owner: 'foo', + repo: 'bar', + trigger: cpactions.GitHubTrigger.POLL, + }), + ], + }); + + p.addStage({ + stageName: 'Two', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'Boo' }), + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::CodePipeline::Webhook', 0); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'Stages': [ + { + 'Actions': [ + { + 'Configuration': { + 'PollForSourceChanges': true, + }, + 'Name': 'GH', + }, + ], + 'Name': 'Source', + }, + { + 'Actions': [ + { + 'Name': 'Boo', + }, + ], + 'Name': 'Two', + }, + ], + }); + + + }); + + test('pipeline with GitHub source without triggers', () => { + const stack = new Stack(); + + const secret = new CfnParameter(stack, 'GitHubToken', { type: 'String', default: 'my-token' }); + + const p = new codepipeline.Pipeline(stack, 'P'); + + p.addStage({ + stageName: 'Source', + actions: [ + new cpactions.GitHubSourceAction({ + actionName: 'GH', + runOrder: 8, + output: new codepipeline.Artifact('A'), + branch: 'branch', + oauthToken: SecretValue.unsafePlainText(secret.valueAsString), + owner: 'foo', + repo: 'bar', + trigger: cpactions.GitHubTrigger.NONE, + }), + ], + }); + + p.addStage({ + stageName: 'Two', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'Boo' }), + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::CodePipeline::Webhook', 0); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'Stages': [ + { + 'Actions': [ + { + 'Configuration': { + 'PollForSourceChanges': false, + }, + 'Name': 'GH', + }, + ], + 'Name': 'Source', + }, + { + 'Actions': [ + { + 'Name': 'Boo', + }, + ], + 'Name': 'Two', + }, + ], + }); + + + }); + + test('github action uses ThirdParty owner', () => { + const stack = new Stack(); + + const secret = new CfnParameter(stack, 'GitHubToken', { type: 'String', default: 'my-token' }); + + const p = new codepipeline.Pipeline(stack, 'P'); + + p.addStage({ + stageName: 'Source', + actions: [ + new cpactions.GitHubSourceAction({ + actionName: 'GH', + runOrder: 8, + output: new codepipeline.Artifact('A'), + branch: 'branch', + oauthToken: SecretValue.unsafePlainText(secret.valueAsString), + owner: 'foo', + repo: 'bar', + }), + ], + }); + + p.addStage({ + stageName: 'Two', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'Boo' }), + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::CodePipeline::Webhook', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStore': { + 'Location': { + 'Ref': 'PArtifactsBucket5E711C12', + }, + 'Type': 'S3', + }, + 'RoleArn': { + 'Fn::GetAtt': [ + 'PRole07BDC907', + 'Arn', + ], + }, + 'Stages': [ + { + 'Actions': [ + { + 'ActionTypeId': { + 'Category': 'Source', + 'Owner': 'ThirdParty', + 'Provider': 'GitHub', + 'Version': '1', + }, + 'Configuration': { + 'Owner': 'foo', + 'Repo': 'bar', + 'Branch': 'branch', + 'OAuthToken': { + 'Ref': 'GitHubToken', + }, + 'PollForSourceChanges': false, + }, + 'Name': 'GH', + 'OutputArtifacts': [ + { + 'Name': 'A', + }, + ], + 'RunOrder': 8, + }, + ], + 'Name': 'Source', + }, + { + 'Actions': [ + { + 'ActionTypeId': { + 'Category': 'Approval', + 'Owner': 'AWS', + 'Provider': 'Manual', + 'Version': '1', + }, + 'Name': 'Boo', + 'RunOrder': 1, + }, + ], + 'Name': 'Two', + }, + ], + }); + + expect([]).toEqual(p.node.validate()); + }); + + test('onStateChange', () => { + const stack = new Stack(); + + const topic = new sns.Topic(stack, 'Topic'); + + const pipeline = new codepipeline.Pipeline(stack, 'PL'); + + pipeline.addStage({ + stageName: 'S1', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'A1', + output: new codepipeline.Artifact('Artifact'), + bucket: new s3.Bucket(stack, 'Bucket'), + bucketKey: 'Key', + }), + ], + }); + + pipeline.addStage({ + stageName: 'S2', + actions: [ + new cpactions.ManualApprovalAction({ actionName: 'A2' }), + ], + }); + + pipeline.onStateChange('OnStateChange', { + target: new targets.SnsTopic(topic), + description: 'desc', + eventPattern: { + detail: { + state: ['FAILED'], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + 'Description': 'desc', + 'EventPattern': { + 'detail': { + 'state': [ + 'FAILED', + ], + }, + 'detail-type': [ + 'CodePipeline Pipeline Execution State Change', + ], + 'source': [ + 'aws.codepipeline', + ], + 'resources': [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':codepipeline:', + { + 'Ref': 'AWS::Region', + }, + ':', + { + 'Ref': 'AWS::AccountId', + }, + ':', + { + 'Ref': 'PLD5425AEA', + }, + ], + ], + }, + ], + }, + 'State': 'ENABLED', + 'Targets': [ + { + 'Arn': { + 'Ref': 'TopicBFC7AF6E', + }, + 'Id': 'Target0', + }, + ], + }); + + expect([]).toEqual(pipeline.node.validate()); + }); + + describe('PipelineProject', () => { + describe('with a custom Project Name', () => { + test('sets the source and artifacts to CodePipeline', () => { + const stack = new Stack(); + + new codebuild.PipelineProject(stack, 'MyProject', { + projectName: 'MyProject', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Name': 'MyProject', + 'Source': { + 'Type': 'CODEPIPELINE', + }, + 'Artifacts': { + 'Type': 'CODEPIPELINE', + }, + 'ServiceRole': { + 'Fn::GetAtt': [ + 'MyProjectRole9BBE5233', + 'Arn', + ], + }, + 'Environment': { + 'Type': 'LINUX_CONTAINER', + 'PrivilegedMode': false, + 'Image': 'aws/codebuild/standard:1.0', + 'ComputeType': 'BUILD_GENERAL1_SMALL', + }, + }); + + + }); + }); + }); + + test('Lambda PipelineInvokeAction can be used to invoke Lambda functions from a CodePipeline', () => { + const stack = new Stack(); + + const lambdaFun = new lambda.Function(stack, 'Function', { + code: new lambda.InlineCode('bla'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + const source1Output = new codepipeline.Artifact('sourceArtifact1'); + const source1 = new cpactions.S3SourceAction({ + actionName: 'SourceAction1', + bucketKey: 'some/key', + output: source1Output, + bucket, + }); + const source2Output = new codepipeline.Artifact('sourceArtifact2'); + const source2 = new cpactions.S3SourceAction({ + actionName: 'SourceAction2', + bucketKey: 'another/key', + output: source2Output, + bucket, + }); + pipeline.addStage({ + stageName: 'Source', + actions: [ + source1, + source2, + ], + }); + + const lambdaAction = new cpactions.LambdaInvokeAction({ + actionName: 'InvokeAction', + lambda: lambdaFun, + inputs: [ + source2Output, + source1Output, + ], + outputs: [ + new codepipeline.Artifact('lambdaOutput1'), + new codepipeline.Artifact('lambdaOutput2'), + new codepipeline.Artifact('lambdaOutput3'), + ], + }); + pipeline.addStage({ + stageName: 'Stage', + actions: [lambdaAction], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStore': { + 'Location': { + 'Ref': 'PipelineArtifactsBucket22248F97', + }, + 'Type': 'S3', + }, + 'RoleArn': { + 'Fn::GetAtt': [ + 'PipelineRoleD68726F7', + 'Arn', + ], + }, + 'Stages': [ + { + 'Name': 'Source', + }, + { + 'Actions': [ + { + 'ActionTypeId': { + 'Category': 'Invoke', + 'Owner': 'AWS', + 'Provider': 'Lambda', + 'Version': '1', + }, + 'Configuration': { + 'FunctionName': { + 'Ref': 'Function76856677', + }, + }, + 'InputArtifacts': [ + { 'Name': 'sourceArtifact2' }, + { 'Name': 'sourceArtifact1' }, + ], + 'Name': 'InvokeAction', + 'OutputArtifacts': [ + { 'Name': 'lambdaOutput1' }, + { 'Name': 'lambdaOutput2' }, + { 'Name': 'lambdaOutput3' }, + ], + 'RunOrder': 1, + }, + ], + 'Name': 'Stage', + }, + ], + }); + + expect((lambdaAction.actionProperties.outputs || []).length).toEqual(3); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': [ + 'codepipeline:PutJobSuccessResult', + 'codepipeline:PutJobFailureResult', + ], + 'Effect': 'Allow', + 'Resource': '*', + }, + ], + 'Version': '2012-10-17', + }, + 'PolicyName': 'FunctionServiceRoleDefaultPolicy2F49994A', + 'Roles': [ + { + 'Ref': 'FunctionServiceRole675BB04A', + }, + ], + }); + + + }); + + describe('cross-region Pipeline', () => { + test('generates the required Action & ArtifactStores properties in the template', () => { + const pipelineRegion = 'us-west-2'; + const pipelineAccount = '123'; + + const app = new App(); + + const stack = new Stack(app, 'TestStack', { + env: { + region: pipelineRegion, + account: pipelineAccount, + }, + }); + const pipeline = new codepipeline.Pipeline(stack, 'MyPipeline', { + crossRegionReplicationBuckets: { + 'us-west-1': s3.Bucket.fromBucketName(stack, 'ImportedBucket', 'sfo-replication-bucket'), + }, + }); + + const sourceBucket = new s3.Bucket(stack, 'MyBucket'); + const sourceOutput = new codepipeline.Artifact('SourceOutput'); + const sourceAction = new cpactions.S3SourceAction({ + actionName: 'BucketSource', + bucketKey: '/some/key', + output: sourceOutput, + bucket: sourceBucket, + }); + pipeline.addStage({ + stageName: 'Stage1', + actions: [sourceAction], + }); + + pipeline.addStage({ + stageName: 'Stage2', + actions: [ + new cpactions.CloudFormationCreateReplaceChangeSetAction({ + actionName: 'Action1', + changeSetName: 'ChangeSet', + templatePath: sourceOutput.atPath('template.yaml'), + stackName: 'SomeStack', + region: pipelineRegion, + adminPermissions: false, + }), + new cpactions.CloudFormationCreateUpdateStackAction({ + actionName: 'Action2', + templatePath: sourceOutput.atPath('template.yaml'), + stackName: 'OtherStack', + region: 'us-east-1', + adminPermissions: false, + }), + new cpactions.CloudFormationExecuteChangeSetAction({ + actionName: 'Action3', + changeSetName: 'ChangeSet', + stackName: 'SomeStack', + region: 'us-west-1', + }), + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStores': [ + { + 'Region': 'us-west-1', + 'ArtifactStore': { + 'Type': 'S3', + 'Location': 'sfo-replication-bucket', + }, + }, + { + 'Region': 'us-east-1', + 'ArtifactStore': { + 'Type': 'S3', + 'Location': 'teststack-support-us-easteplicationbucket1a8063b3cdac6e7e0e73', + }, + }, + { + 'Region': 'us-west-2', + 'ArtifactStore': { + 'Type': 'S3', + 'EncryptionKey': { + 'Type': 'KMS', + 'Id': { + }, + }, + }, + }, + ], + 'Stages': [ + { + 'Name': 'Stage1', + }, + { + 'Name': 'Stage2', + 'Actions': [ + { + 'Name': 'Action1', + 'Region': 'us-west-2', + }, + { + 'Name': 'Action2', + 'Region': 'us-east-1', + }, + { + 'Name': 'Action3', + 'Region': 'us-west-1', + }, + ], + }, + ], + }); + + expect(pipeline.crossRegionSupport[pipelineRegion]).toBeDefined(); + expect(pipeline.crossRegionSupport['us-west-1']).toBeDefined(); + + const usEast1Support = pipeline.crossRegionSupport['us-east-1']; + expect(usEast1Support).toBeDefined(); + expect(usEast1Support.stack.region).toEqual('us-east-1'); + expect(usEast1Support.stack.account).toEqual(pipelineAccount); + expect(usEast1Support.stack.node.id.indexOf('us-east-1')).not.toEqual(-1); + + + }); + + test('allows specifying only one of artifactBucket and crossRegionReplicationBuckets', () => { + const stack = new Stack(); + + expect(() => { + new codepipeline.Pipeline(stack, 'Pipeline', { + artifactBucket: new s3.Bucket(stack, 'Bucket'), + crossRegionReplicationBuckets: { + // even an empty map should trigger this validation... + }, + }); + }).toThrow(/Only one of artifactBucket and crossRegionReplicationBuckets can be specified!/); + + }); + + test('does not create a new artifact Bucket if one was provided in the cross-region Buckets for the Pipeline region', () => { + const pipelineRegion = 'us-west-2'; + + const stack = new Stack(undefined, undefined, { + env: { + region: pipelineRegion, + }, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(stack, 'Pipeline', { + crossRegionReplicationBuckets: { + [pipelineRegion]: new s3.Bucket(stack, 'Bucket', { + bucketName: 'my-pipeline-bucket', + }), + }, + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.CodeCommitSourceAction({ + actionName: 'Source', + output: sourceOutput, + repository: new codecommit.Repository(stack, 'Repo', { repositoryName: 'Repo' }), + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'Build', + input: sourceOutput, + project: new codebuild.PipelineProject(stack, 'Project'), + }), + ], + }, + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::S3::Bucket', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStores': [ + { + 'Region': pipelineRegion, + 'ArtifactStore': { + 'Type': 'S3', + 'Location': { + 'Ref': 'Bucket83908E77', + }, + }, + }, + ], + }); + + + }); + + test('allows providing a resource-backed action from a different region directly', () => { + const account = '123456789012'; + const app = new App(); + + const replicationRegion = 'us-west-1'; + const replicationStack = new Stack(app, 'ReplicationStack', { env: { region: replicationRegion, account } }); + const project = new codebuild.PipelineProject(replicationStack, 'CodeBuildProject', { + projectName: 'MyCodeBuildProject', + }); + + const pipelineRegion = 'us-west-2'; + const pipelineStack = new Stack(app, 'TestStack', { env: { region: pipelineRegion, account } }); + const sourceOutput = new codepipeline.Artifact('SourceOutput'); + new codepipeline.Pipeline(pipelineStack, 'MyPipeline', { + stages: [ + { + stageName: 'Source', + actions: [new cpactions.CodeCommitSourceAction({ + actionName: 'CodeCommitAction', + output: sourceOutput, + repository: codecommit.Repository.fromRepositoryName(pipelineStack, 'Repo', 'my-codecommit-repo'), + })], + }, + { + stageName: 'Build', + actions: [new cpactions.CodeBuildAction({ + actionName: 'CodeBuildAction', + input: sourceOutput, + project, + })], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStores': [ + { + 'Region': replicationRegion, + 'ArtifactStore': { + 'Type': 'S3', + 'Location': 'replicationstackeplicationbucket2464cd5c33b386483b66', + 'EncryptionKey': { + 'Id': { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':kms:us-west-1:123456789012:alias/ionstacktencryptionalias043cb2f8ceac9da9c07c', + ], + ], + }, + 'Type': 'KMS', + }, + }, + }, + { + 'Region': pipelineRegion, + }, + ], + 'Stages': [ + { + 'Name': 'Source', + }, + { + 'Name': 'Build', + 'Actions': [ + { + 'Name': 'CodeBuildAction', + 'Region': replicationRegion, + 'Configuration': { + 'ProjectName': 'MyCodeBuildProject', + }, + }, + ], + }, + ], + }); + + Template.fromStack(replicationStack).hasResourceProperties('AWS::S3::Bucket', { + 'BucketName': 'replicationstackeplicationbucket2464cd5c33b386483b66', + }); + + + }); + }); + + describe('cross-account Pipeline', () => { + test('with a CodeBuild Project in a different account works correctly', () => { + const app = new App(); + + const buildAccount = '901234567890'; + const buildRegion = 'bermuda-triangle-1'; + const buildStack = new Stack(app, 'BuildStack', { + env: { account: buildAccount, region: buildRegion }, + }); + const rolePhysicalName = 'ProjectRolePhysicalName'; + const projectRole = new iam.Role(buildStack, 'ProjectRole', { + assumedBy: new iam.ServicePrincipal('codebuild.amazonaws.com'), + roleName: rolePhysicalName, + }); + const projectPhysicalName = 'ProjectPhysicalName'; + const project = new codebuild.PipelineProject(buildStack, 'Project', { + projectName: projectPhysicalName, + role: projectRole, + }); + + const pipelineStack = new Stack(app, 'PipelineStack', { + env: { account: '123456789012', region: buildRegion }, + }); + const sourceBucket = new s3.Bucket(pipelineStack, 'ArtifactBucket', { + bucketName: 'source-bucket', + encryption: s3.BucketEncryption.KMS, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'S3', + bucket: sourceBucket, + bucketKey: 'path/to/file.zip', + output: sourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + }), + ], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'Stages': [ + { + 'Name': 'Source', + }, + { + 'Name': 'Build', + 'Actions': [ + { + 'Name': 'CodeBuild', + 'Configuration': { + 'ProjectName': projectPhysicalName, + }, + 'RoleArn': { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + `:iam::${buildAccount}:role/buildstackebuildactionrole166c75d1d8be701b1ad8`, + ], + ], + }, + }, + ], + }, + ], + }); + + Template.fromStack(buildStack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + 'Statement': [ + { + // log permissions from the CodeBuild Project Construct... + }, + { + // report group permissions from the CodeBuild Project construct... + }, + { + 'Action': [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + 'Effect': 'Allow', + 'Resource': [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':s3:::pipelinestackeartifactsbucket5409dc84bb108027cb58', + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':s3:::pipelinestackeartifactsbucket5409dc84bb108027cb58/*', + ], + ], + }, + ], + }, + { + 'Action': [ + 'kms:Decrypt', + 'kms:DescribeKey', + ], + 'Effect': 'Allow', + 'Resource': '*', + }, + ], + }, + }); + + + }); + + test('adds a dependency on the Stack containing a new action Role', () => { + const region = 'us-west-2'; + const pipelineAccount = '123456789012'; + const buildAccount = '901234567890'; + const app = new App(); + + const buildStack = new Stack(app, 'BuildStack', { + env: { account: buildAccount, region }, + }); + const actionRolePhysicalName = 'ProjectRolePhysicalName'; + const actionRoleInOtherAccount = new iam.Role(buildStack, 'ProjectRole', { + assumedBy: new iam.AccountPrincipal(pipelineAccount), + roleName: actionRolePhysicalName, + }); + const projectPhysicalName = 'ProjectPhysicalName'; + const project = codebuild.Project.fromProjectName(buildStack, 'Project', + projectPhysicalName); + + const pipelineStack = new Stack(app, 'PipelineStack', { + env: { account: pipelineAccount, region }, + }); + const bucket = new s3.Bucket(pipelineStack, 'ArtifactBucket', { + bucketName: 'source-bucket', + encryption: s3.BucketEncryption.KMS, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + artifactBucket: bucket, + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'S3', + bucket, + bucketKey: 'path/to/file.zip', + output: sourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + role: actionRoleInOtherAccount, + }), + ], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'Stages': [ + { + 'Name': 'Source', + }, + { + 'Name': 'Build', + 'Actions': [ + { + 'Name': 'CodeBuild', + 'Configuration': { + 'ProjectName': projectPhysicalName, + }, + 'RoleArn': { + 'Fn::Join': ['', [ + 'arn:', + { 'Ref': 'AWS::Partition' }, + `:iam::${buildAccount}:role/${actionRolePhysicalName}`, + ]], + }, + }, + ], + }, + ], + }); + + expect(pipelineStack.dependencies.length).toEqual(1); + + + }); + + test('does not add a dependency on the Stack containing an imported action Role', () => { + const region = 'us-west-2'; + const pipelineAccount = '123456789012'; + const buildAccount = '901234567890'; + const app = new App(); + + const buildStack = new Stack(app, 'BuildStack', { + env: { account: buildAccount, region }, + }); + const actionRolePhysicalName = 'ProjectRolePhysicalName'; + const actionRoleInOtherAccount = iam.Role.fromRoleArn(buildStack, 'ProjectRole', + `arn:aws:iam::${buildAccount}:role/${actionRolePhysicalName}`); + const projectPhysicalName = 'ProjectPhysicalName'; + const project = new codebuild.PipelineProject(buildStack, 'Project', { + projectName: projectPhysicalName, + }); + + const pipelineStack = new Stack(app, 'PipelineStack', { + env: { account: pipelineAccount, region }, + }); + const bucket = new s3.Bucket(pipelineStack, 'ArtifactBucket', { + bucketName: 'source-bucket', + encryption: s3.BucketEncryption.KMS, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + artifactBucket: bucket, + stages: [ + { + stageName: 'Source', + actions: [ + new cpactions.S3SourceAction({ + actionName: 'S3', + bucket, + bucketKey: 'path/to/file.zip', + output: sourceOutput, + }), + ], + }, + { + stageName: 'Build', + actions: [ + new cpactions.CodeBuildAction({ + actionName: 'CodeBuild', + project, + input: sourceOutput, + role: actionRoleInOtherAccount, + }), + ], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'Stages': [ + { + 'Name': 'Source', + }, + { + 'Name': 'Build', + 'Actions': [ + { + 'Name': 'CodeBuild', + 'Configuration': { + 'ProjectName': projectPhysicalName, + }, + 'RoleArn': `arn:aws:iam::${buildAccount}:role/${actionRolePhysicalName}`, + }, + ], + }, + ], + }); + + expect(pipelineStack.dependencies.length).toEqual(0); + + + }); + }); +}); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/s3-deploy-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/s3/s3-deploy-action.test.ts similarity index 96% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/s3-deploy-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/s3/s3-deploy-action.test.ts index d5b5a0a3db79d..a3ebd51a2cd4c 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/s3-deploy-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/s3/s3-deploy-action.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Duration, SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as s3 from '../../../aws-s3'; +import { App, Duration, SecretValue, Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/s3-source-action.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/s3/s3-source-action.test.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline-actions/test/s3/s3-source-action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/s3/s3-source-action.test.ts index 0fe6b311ad8a3..3bc96810347ea 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/s3/s3-source-action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/s3/s3-source-action.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Lazy, Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as s3 from '../../../aws-s3'; +import { Lazy, Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/servicecatalog/servicecatalog-deploy-action-beta1.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/servicecatalog/servicecatalog-deploy-action-beta1.test.ts similarity index 95% rename from packages/@aws-cdk/aws-codepipeline-actions/test/servicecatalog/servicecatalog-deploy-action-beta1.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/servicecatalog/servicecatalog-deploy-action-beta1.test.ts index 0be3e3a610c49..5077d549752bb 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/servicecatalog/servicecatalog-deploy-action-beta1.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/servicecatalog/servicecatalog-deploy-action-beta1.test.ts @@ -1,7 +1,7 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codecommit from '../../../aws-codecommit'; +import * as codepipeline from '../../../aws-codepipeline'; +import { Stack } from '../../../core'; import * as cpactions from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/stepfunctions/stepfunctions-invoke-actions.test.ts b/packages/aws-cdk-lib/aws-codepipeline-actions/test/stepfunctions/stepfunctions-invoke-actions.test.ts similarity index 95% rename from packages/@aws-cdk/aws-codepipeline-actions/test/stepfunctions/stepfunctions-invoke-actions.test.ts rename to packages/aws-cdk-lib/aws-codepipeline-actions/test/stepfunctions/stepfunctions-invoke-actions.test.ts index 0825f8fdfcf35..2ceb9b0305586 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/stepfunctions/stepfunctions-invoke-actions.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline-actions/test/stepfunctions/stepfunctions-invoke-actions.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as stepfunction from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as s3 from '../../../aws-s3'; +import * as stepfunction from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import * as cpactions from '../../lib'; describe('StepFunctions Invoke Action', () => { diff --git a/packages/aws-cdk-lib/aws-codepipeline/.jsiirc.json b/packages/aws-cdk-lib/aws-codepipeline/.jsiirc.json new file mode 100644 index 0000000000000..35bc2ed0e229d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.codepipeline" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodePipeline" + }, + "python": { + "module": "aws_cdk.aws_codepipeline" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codepipeline/README.md b/packages/aws-cdk-lib/aws-codepipeline/README.md new file mode 100644 index 0000000000000..cb796159e09d4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/README.md @@ -0,0 +1,481 @@ +# AWS CodePipeline Construct Library + + +## Pipeline + +To construct an empty Pipeline: + +```ts +// Construct an empty Pipeline +const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline'); +``` + +To give the Pipeline a nice, human-readable name: + +```ts +// Give the Pipeline a nice, human-readable name +const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { + pipelineName: 'MyPipeline', +}); +``` + +Be aware that in the default configuration, the `Pipeline` construct creates +an AWS Key Management Service (AWS KMS) Customer Master Key (CMK) for you to +encrypt the artifacts in the artifact bucket, which incurs a cost of +**$1/month**. This default configuration is necessary to allow cross-account +actions. + +If you do not intend to perform cross-account deployments, you can disable +the creation of the Customer Master Keys by passing `crossAccountKeys: false` +when defining the Pipeline: + +```ts +// Don't create Customer Master Keys +const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { + crossAccountKeys: false, +}); +``` + +If you want to enable key rotation for the generated KMS keys, +you can configure it by passing `enableKeyRotation: true` when creating the pipeline. +Note that key rotation will incur an additional cost of **$1/month**. + +```ts +// Enable key rotation for the generated KMS key +const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { + // ... + enableKeyRotation: true, +}); +``` + +## Stages + +You can provide Stages when creating the Pipeline: + +```ts +// Provide a Stage when creating a pipeline +const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { + stages: [ + { + stageName: 'Source', + actions: [ + // see below... + ], + }, + ], +}); +``` + +Or append a Stage to an existing Pipeline: + +```ts +// Append a Stage to an existing Pipeline +declare const pipeline: codepipeline.Pipeline; +const sourceStage = pipeline.addStage({ + stageName: 'Source', + actions: [ // optional property + // see below... + ], +}); +``` + +You can insert the new Stage at an arbitrary point in the Pipeline: + +```ts +// Insert a new Stage at an arbitrary point +declare const pipeline: codepipeline.Pipeline; +declare const anotherStage: codepipeline.IStage; +declare const yetAnotherStage: codepipeline.IStage; + +const someStage = pipeline.addStage({ + stageName: 'SomeStage', + placement: { + // note: you can only specify one of the below properties + rightBefore: anotherStage, + justAfter: yetAnotherStage, + } +}); +``` + +You can disable transition to a Stage: + +```ts +// Disable transition to a stage +declare const pipeline: codepipeline.Pipeline; + +const someStage = pipeline.addStage({ + stageName: 'SomeStage', + transitionToEnabled: false, + transitionDisabledReason: 'Manual transition only', // optional reason +}) +``` + +This is useful if you don't want every executions of the pipeline to flow into +this stage automatically. The transition can then be "manually" enabled later on. + +## Actions + +Actions live in a separate package, `@aws-cdk/aws-codepipeline-actions`. + +To add an Action to a Stage, you can provide it when creating the Stage, +in the `actions` property, +or you can use the `IStage.addAction()` method to mutate an existing Stage: + +```ts +// Use the `IStage.addAction()` method to mutate an existing Stage. +declare const sourceStage: codepipeline.IStage; +declare const someAction: codepipeline.Action; +sourceStage.addAction(someAction); +``` + +## Custom Action Registration + +To make your own custom CodePipeline Action requires registering the action provider. Look to the `JenkinsProvider` in `@aws-cdk/aws-codepipeline-actions` for an implementation example. + +```ts +// Make a custom CodePipeline Action +new codepipeline.CustomActionRegistration(this, 'GenericGitSourceProviderResource', { + category: codepipeline.ActionCategory.SOURCE, + artifactBounds: { minInputs: 0, maxInputs: 0, minOutputs: 1, maxOutputs: 1 }, + provider: 'GenericGitSource', + version: '1', + entityUrl: 'https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html', + executionUrl: 'https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html', + actionProperties: [ + { + name: 'Branch', + required: true, + key: false, + secret: false, + queryable: false, + description: 'Git branch to pull', + type: 'String', + }, + { + name: 'GitUrl', + required: true, + key: false, + secret: false, + queryable: false, + description: 'SSH git clone URL', + type: 'String', + }, + ], +}); +``` + +## Cross-account CodePipelines + +> Cross-account Pipeline actions require that the Pipeline has *not* been +> created with `crossAccountKeys: false`. + +Most pipeline Actions accept an AWS resource object to operate on. For example: + +* `S3DeployAction` accepts an `s3.IBucket`. +* `CodeBuildAction` accepts a `codebuild.IProject`. +* etc. + +These resources can be either newly defined (`new s3.Bucket(...)`) or imported +(`s3.Bucket.fromBucketAttributes(...)`) and identify the resource that should +be changed. + +These resources can be in different accounts than the pipeline itself. For +example, the following action deploys to an imported S3 bucket from a +different account: + +```ts +// Deploy an imported S3 bucket from a different account +declare const stage: codepipeline.IStage; +declare const input: codepipeline.Artifact; +stage.addAction(new codepipeline_actions.S3DeployAction({ + bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', { + account: '123456789012', + // ... + }), + input: input, + actionName: 's3-deploy-action', + // ... +})); +``` + +Actions that don't accept a resource object accept an explicit `account` parameter: + +```ts +// Actions that don't accept a resource objet accept an explicit `account` parameter +declare const stage: codepipeline.IStage; +declare const templatePath: codepipeline.ArtifactPath; +stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + account: '123456789012', + templatePath, + adminPermissions: false, + stackName: Stack.of(this).stackName, + actionName: 'cloudformation-create-update', + // ... +})); +``` + +The `Pipeline` construct automatically defines an **IAM Role** for you in the +target account which the pipeline will assume to perform that action. This +Role will be defined in a **support stack** named +`-support-`, that will automatically be deployed +before the stack containing the pipeline. + +If you do not want to use the generated role, you can also explicitly pass a +`role` when creating the action. In that case, the action will operate in the +account the role belongs to: + +```ts +// Explicitly pass in a `role` when creating an action. +declare const stage: codepipeline.IStage; +declare const templatePath: codepipeline.ArtifactPath; +stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + templatePath, + adminPermissions: false, + stackName: Stack.of(this).stackName, + actionName: 'cloudformation-create-update', + // ... + role: iam.Role.fromRoleArn(this, 'ActionRole', '...'), +})); +``` + +## Cross-region CodePipelines + +Similar to how you set up a cross-account Action, the AWS resource object you +pass to actions can also be in different *Regions*. For example, the +following Action deploys to an imported S3 bucket from a different Region: + +```ts +// Deploy to an imported S3 bucket from a different Region. +declare const stage: codepipeline.IStage; +declare const input: codepipeline.Artifact; +stage.addAction(new codepipeline_actions.S3DeployAction({ + bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', { + region: 'us-west-1', + // ... + }), + input: input, + actionName: 's3-deploy-action', + // ... +})); +``` + +Actions that don't take an AWS resource will accept an explicit `region` +parameter: + +```ts +// Actions that don't take an AWS resource will accept an explicit `region` parameter. +declare const stage: codepipeline.IStage; +declare const templatePath: codepipeline.ArtifactPath; +stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({ + templatePath, + adminPermissions: false, + stackName: Stack.of(this).stackName, + actionName: 'cloudformation-create-update', + // ... + region: 'us-west-1', +})); +``` + +The `Pipeline` construct automatically defines a **replication bucket** for +you in the target region, which the pipeline will replicate artifacts to and +from. This Bucket will be defined in a **support stack** named +`-support-`, that will automatically be deployed +before the stack containing the pipeline. + +If you don't want to use these support stacks, and already have buckets in +place to serve as replication buckets, you can supply these at Pipeline definition +time using the `crossRegionReplicationBuckets` parameter. Example: + +```ts +// Supply replication buckets for the Pipeline instead of using the generated support stack +const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', { + // ... + + crossRegionReplicationBuckets: { + // note that a physical name of the replication Bucket must be known at synthesis time + 'us-west-1': s3.Bucket.fromBucketAttributes(this, 'UsWest1ReplicationBucket', { + bucketName: 'my-us-west-1-replication-bucket', + // optional KMS key + encryptionKey: kms.Key.fromKeyArn(this, 'UsWest1ReplicationKey', + 'arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012' + ), + }), + }, +}); +``` + +See [the AWS docs here](https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-cross-region.html) +for more information on cross-region CodePipelines. + +### Creating an encrypted replication bucket + +If you're passing a replication bucket created in a different stack, +like this: + +```ts +// Passing a replication bucket created in a different stack. +const app = new App(); +const replicationStack = new Stack(app, 'ReplicationStack', { + env: { + region: 'us-west-1', + }, +}); +const key = new kms.Key(replicationStack, 'ReplicationKey'); +const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { + // like was said above - replication buckets need a set physical name + bucketName: PhysicalName.GENERATE_IF_NEEDED, + encryptionKey: key, // does not work! +}); + +// later... +new codepipeline.Pipeline(replicationStack, 'Pipeline', { + crossRegionReplicationBuckets: { + 'us-west-1': replicationBucket, + }, +}); +``` + +When trying to encrypt it +(and note that if any of the cross-region actions happen to be cross-account as well, +the bucket *has to* be encrypted - otherwise the pipeline will fail at runtime), +you cannot use a key directly - KMS keys don't have physical names, +and so you can't reference them across environments. + +In this case, you need to use an alias in place of the key when creating the bucket: + +```ts +// Passing an encrypted replication bucket created in a different stack. +const app = new App(); +const replicationStack = new Stack(app, 'ReplicationStack', { + env: { + region: 'us-west-1', + }, +}); +const key = new kms.Key(replicationStack, 'ReplicationKey'); +const alias = new kms.Alias(replicationStack, 'ReplicationAlias', { + // aliasName is required + aliasName: PhysicalName.GENERATE_IF_NEEDED, + targetKey: key, +}); +const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { + bucketName: PhysicalName.GENERATE_IF_NEEDED, + encryptionKey: alias, +}); +``` + +## Variables + +The library supports the CodePipeline Variables feature. +Each action class that emits variables has a separate variables interface, +accessed as a property of the action instance called `variables`. +You instantiate the action class and assign it to a local variable; +when you want to use a variable in the configuration of a different action, +you access the appropriate property of the interface returned from `variables`, +which represents a single variable. +Example: + +```ts fixture=action +// MyAction is some action type that produces variables, like EcrSourceAction +const myAction = new MyAction({ + // ... + actionName: 'myAction', +}); +new OtherAction({ + // ... + config: myAction.variables.myVariable, + actionName: 'otherAction', +}); +``` + +The namespace name that will be used will be automatically generated by the pipeline construct, +based on the stage and action name; +you can pass a custom name when creating the action instance: + +```ts fixture=action +// MyAction is some action type that produces variables, like EcrSourceAction +const myAction = new MyAction({ + // ... + variablesNamespace: 'MyNamespace', + actionName: 'myAction', +}); +``` + +There are also global variables available, +not tied to any action; +these are accessed through static properties of the `GlobalVariables` class: + +```ts fixture=action +// OtherAction is some action type that produces variables, like EcrSourceAction +new OtherAction({ + // ... + config: codepipeline.GlobalVariables.executionId, + actionName: 'otherAction', +}); +``` + +Check the documentation of the `@aws-cdk/aws-codepipeline-actions` +for details on how to use the variables for each action class. + +See the [CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html) +for more details on how to use the variables feature. + +## Events + +### Using a pipeline as an event target + +A pipeline can be used as a target for a CloudWatch event rule: + +```ts +// A pipeline being used as a target for a CloudWatch event rule. +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as events from 'aws-cdk-lib/aws-events'; + +// kick off the pipeline every day +const rule = new events.Rule(this, 'Daily', { + schedule: events.Schedule.rate(Duration.days(1)), +}); + +declare const pipeline: codepipeline.Pipeline; +rule.addTarget(new targets.CodePipeline(pipeline)); +``` + +When a pipeline is used as an event target, the +"codepipeline:StartPipelineExecution" permission is granted to the AWS +CloudWatch Events service. + +### Event sources + +Pipelines emit CloudWatch events. To define event rules for events emitted by +the pipeline, stages or action, use the `onXxx` methods on the respective +construct: + +```ts +// Define event rules for events emitted by the pipeline +import * as events from 'aws-cdk-lib/aws-events'; + +declare const myPipeline: codepipeline.Pipeline; +declare const myStage: codepipeline.IStage; +declare const myAction: codepipeline.Action; +declare const target: events.IRuleTarget; +myPipeline.onStateChange('MyPipelineStateChange', { target: target } ); +myStage.onStateChange('MyStageStateChange', target); +myAction.onStateChange('MyActionStateChange', target); +``` + +## CodeStar Notifications + +To define CodeStar Notification rules for Pipelines, use one of the `notifyOnXxx()` methods. +They are very similar to `onXxx()` methods for CloudWatch events: + +```ts +// Define CodeStar Notification rules for Pipelines +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; +const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', + slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', + slackChannelId: 'YOUR_SLACK_CHANNEL_ID', +}); + +declare const pipeline: codepipeline.Pipeline; +const rule = pipeline.notifyOnExecutionStateChange('NotifyOnExecutionStateChange', target); +``` diff --git a/packages/aws-cdk-lib/aws-codepipeline/index.ts b/packages/aws-cdk-lib/aws-codepipeline/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codepipeline/lib/action.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/action.ts new file mode 100644 index 0000000000000..750177cf4c2a9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/action.ts @@ -0,0 +1,562 @@ +import * as notifications from '../../aws-codestarnotifications'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import { IResource, Lazy } from '../../core'; +import { Construct } from 'constructs'; +import { Artifact } from './artifact'; + +export enum ActionCategory { + SOURCE = 'Source', + BUILD = 'Build', + TEST = 'Test', + APPROVAL = 'Approval', + DEPLOY = 'Deploy', + INVOKE = 'Invoke' +} + +/** + * Specifies the constraints on the number of input and output + * artifacts an action can have. + * + * The constraints for each action type are documented on the + * [Pipeline Structure Reference](https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html) page. + */ +export interface ActionArtifactBounds { + readonly minInputs: number; + readonly maxInputs: number; + readonly minOutputs: number; + readonly maxOutputs: number; +} + +/** + * The CodePipeline variables that are global, + * not bound to a specific action. + * This class defines a bunch of static fields that represent the different variables. + * These can be used can be used in any action configuration. + */ +export class GlobalVariables { + /** The identifier of the current pipeline execution. */ + public static readonly executionId = '#{codepipeline.PipelineExecutionId}'; +} + +export interface ActionProperties { + readonly actionName: string; + readonly role?: iam.IRole; + + /** + * The AWS region the given Action resides in. + * Note that a cross-region Pipeline requires replication buckets to function correctly. + * You can provide their names with the `PipelineProps#crossRegionReplicationBuckets` property. + * If you don't, the CodePipeline Construct will create new Stacks in your CDK app containing those buckets, + * that you will need to `cdk deploy` before deploying the main, Pipeline-containing Stack. + * + * @default the Action resides in the same region as the Pipeline + */ + readonly region?: string; + + /** + * The account the Action is supposed to live in. + * For Actions backed by resources, + * this is inferred from the Stack `resource` is part of. + * However, some Actions, like the CloudFormation ones, + * are not backed by any resource, and they still might want to be cross-account. + * In general, a concrete Action class should specify either `resource`, + * or `account` - but not both. + */ + readonly account?: string; + + /** + * The optional resource that is backing this Action. + * This is used for automatically handling Actions backed by + * resources from a different account and/or region. + */ + readonly resource?: IResource; + + /** + * The category of the action. + * The category defines which action type the owner + * (the entity that performs the action) performs. + */ + readonly category: ActionCategory; + + /** + * The service provider that the action calls. + */ + readonly provider: string; + readonly owner?: string; + readonly version?: string; + + /** + * The order in which AWS CodePipeline runs this action. + * For more information, see the AWS CodePipeline User Guide. + * + * https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements + */ + readonly runOrder?: number; + readonly artifactBounds: ActionArtifactBounds; + readonly inputs?: Artifact[]; + readonly outputs?: Artifact[]; + + /** + * The name of the namespace to use for variables emitted by this action. + * + * @default - a name will be generated, based on the stage and action names + */ + readonly variablesNamespace?: string; +} + +export interface ActionBindOptions { + readonly role: iam.IRole; + + readonly bucket: s3.IBucket; +} + +export interface ActionConfig { + readonly configuration?: any; +} + +/** + * Additional options to pass to the notification rule. + */ +export interface PipelineNotifyOnOptions extends notifications.NotificationRuleOptions { + /** + * A list of event types associated with this notification rule for CodePipeline Pipeline. + * For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide. + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api + */ + readonly events: PipelineNotificationEvents[]; +} + +/** + * A Pipeline Action. + * If you want to implement this interface, + * consider extending the `Action` class, + * which contains some common logic. + */ +export interface IAction { + /** + * The simple properties of the Action, + * like its Owner, name, etc. + * Note that this accessor will be called before the `bind` callback. + */ + readonly actionProperties: ActionProperties; + + /** + * The callback invoked when this Action is added to a Pipeline. + * + * @param scope the Construct tree scope the Action can use if it needs to create any resources + * @param stage the `IStage` this Action is being added to + * @param options additional options the Action can use, + * like the artifact Bucket of the pipeline it's being added to + */ + bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig; + + /** + * Creates an Event that will be triggered whenever the state of this Action changes. + * + * @param name the name to use for the new Event + * @param target the optional target for the Event + * @param options additional options that can be used to customize the created Event + */ + onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule; +} + +/** + * The abstract view of an AWS CodePipeline as required and used by Actions. + * It extends `events.IRuleTarget`, + * so this interface can be used as a Target for CloudWatch Events. + */ +export interface IPipeline extends IResource, notifications.INotificationRuleSource { + /** + * The name of the Pipeline. + * + * @attribute + */ + readonly pipelineName: string; + + /** + * The ARN of the Pipeline. + * + * @attribute + */ + readonly pipelineArn: string; + + /** + * Define an event rule triggered by this CodePipeline. + * + * @param id Identifier for this event handler. + * @param options Additional options to pass to the event rule. + */ + onEvent(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Define an event rule triggered by the "CodePipeline Pipeline Execution + * State Change" event emitted from this pipeline. + * + * @param id Identifier for this event handler. + * @param options Additional options to pass to the event rule. + */ + onStateChange(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a CodeStar notification rule triggered when the pipeline + * events emitted by you specified, it very similar to `onEvent` API. + * + * You can also use the methods `notifyOnExecutionStateChange`, `notifyOnAnyStageStateChange`, + * `notifyOnAnyActionStateChange` and `notifyOnAnyManualApprovalStateChange` + * to define rules for these specific event emitted. + * + * @param id The id of the CodeStar notification rule + * @param target The target to register for the CodeStar Notifications destination. + * @param options Customization options for CodeStar notification rule + * @returns CodeStar notification rule associated with this build project. + */ + notifyOn( + id: string, + target: notifications.INotificationRuleTarget, + options: PipelineNotifyOnOptions, + ): notifications.INotificationRule; + + /** + * Define an notification rule triggered by the set of the "Pipeline execution" events emitted from this pipeline. + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline + * + * @param id Identifier for this notification handler. + * @param target The target to register for the CodeStar Notifications destination. + * @param options Additional options to pass to the notification rule. + */ + notifyOnExecutionStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Define an notification rule triggered by the set of the "Stage execution" events emitted from this pipeline. + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline + * + * @param id Identifier for this notification handler. + * @param target The target to register for the CodeStar Notifications destination. + * @param options Additional options to pass to the notification rule. + */ + notifyOnAnyStageStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Define an notification rule triggered by the set of the "Action execution" events emitted from this pipeline. + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline + * + * @param id Identifier for this notification handler. + * @param target The target to register for the CodeStar Notifications destination. + * @param options Additional options to pass to the notification rule. + */ + notifyOnAnyActionStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; + + /** + * Define an notification rule triggered by the set of the "Manual approval" events emitted from this pipeline. + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline + * + * @param id Identifier for this notification handler. + * @param target The target to register for the CodeStar Notifications destination. + * @param options Additional options to pass to the notification rule. + */ + notifyOnAnyManualApprovalStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule; +} + +/** + * The abstract interface of a Pipeline Stage that is used by Actions. + */ +export interface IStage { + /** + * The physical, human-readable name of this Pipeline Stage. + */ + readonly stageName: string; + + readonly pipeline: IPipeline; + + /** + * The actions belonging to this stage. + */ + readonly actions: IAction[]; + + addAction(action: IAction): void; + + onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule; +} + +/** + * Common properties shared by all Actions. + */ +export interface CommonActionProps { + /** + * The physical, human-readable name of the Action. + * Note that Action names must be unique within a single Stage. + */ + readonly actionName: string; + + /** + * The runOrder property for this Action. + * RunOrder determines the relative order in which multiple Actions in the same Stage execute. + * + * @default 1 + * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html + */ + readonly runOrder?: number; + + /** + * The name of the namespace to use for variables emitted by this action. + * + * @default - a name will be generated, based on the stage and action names, + * if any of the action's variables were referenced - otherwise, + * no namespace will be set + */ + readonly variablesNamespace?: string; +} + +/** + * Common properties shared by all Actions whose `ActionProperties.owner` field is 'AWS' + * (or unset, as 'AWS' is the default). + */ +export interface CommonAwsActionProps extends CommonActionProps { + /** + * The Role in which context's this Action will be executing in. + * The Pipeline's Role will assume this Role + * (the required permissions for that will be granted automatically) + * right before executing this Action. + * This Action will be passed into your `IAction.bind` + * method in the `ActionBindOptions.role` property. + * + * @default a new Role will be generated + */ + readonly role?: iam.IRole; +} + +/** + * Low-level class for generic CodePipeline Actions implementing the `IAction` interface. + * Contains some common logic that can be re-used by all `IAction` implementations. + * If you're writing your own Action class, + * feel free to extend this class. + */ +export abstract class Action implements IAction { + /** + * This is a renamed version of the `IAction.actionProperties` property. + */ + protected abstract readonly providedActionProperties: ActionProperties; + + private __actionProperties?: ActionProperties; + private __pipeline?: IPipeline; + private __stage?: IStage; + private __scope?: Construct; + private readonly _namespaceToken: string; + private _customerProvidedNamespace?: string; + private _actualNamespace?: string; + + private _variableReferenced = false; + + protected constructor() { + this._namespaceToken = Lazy.string({ + produce: () => { + // make sure the action was bound (= added to a pipeline) + if (this._actualNamespace === undefined) { + throw new Error(`Cannot reference variables of action '${this.actionProperties.actionName}', ` + + 'as that action was never added to a pipeline'); + } else { + return this._customerProvidedNamespace !== undefined + // if a customer passed a namespace explicitly, always use that + ? this._customerProvidedNamespace + // otherwise, only return a namespace if any variable was referenced + : (this._variableReferenced ? this._actualNamespace : undefined); + } + }, + }); + } + + public get actionProperties(): ActionProperties { + if (this.__actionProperties === undefined) { + const actionProperties = this.providedActionProperties; + this._customerProvidedNamespace = actionProperties.variablesNamespace; + this.__actionProperties = { + ...actionProperties, + variablesNamespace: this._customerProvidedNamespace === undefined + ? this._namespaceToken + : this._customerProvidedNamespace, + }; + } + return this.__actionProperties; + } + + public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig { + this.__pipeline = stage.pipeline; + this.__stage = stage; + this.__scope = scope; + + this._actualNamespace = this._customerProvidedNamespace === undefined + // default a namespace name, based on the stage and action names + ? `${stage.stageName}_${this.actionProperties.actionName}_NS` + : this._customerProvidedNamespace; + + return this.bound(scope, stage, options); + } + + public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps) { + const rule = new events.Rule(this._scope, name, options); + rule.addTarget(target); + rule.addEventPattern({ + detailType: ['CodePipeline Action Execution State Change'], + source: ['aws.codepipeline'], + resources: [this._pipeline.pipelineArn], + detail: { + stage: [this._stage.stageName], + action: [this.actionProperties.actionName], + }, + }); + return rule; + } + + protected variableExpression(variableName: string): string { + this._variableReferenced = true; + return `#{${this._namespaceToken}.${variableName}}`; + } + + /** + * This is a renamed version of the `IAction.bind` method. + */ + protected abstract bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig; + + private get _pipeline(): IPipeline { + if (this.__pipeline) { + return this.__pipeline; + } else { + throw new Error('Action must be added to a stage that is part of a pipeline before using onStateChange'); + } + } + + private get _stage(): IStage { + if (this.__stage) { + return this.__stage; + } else { + throw new Error('Action must be added to a stage that is part of a pipeline before using onStateChange'); + } + } + + /** + * Retrieves the Construct scope of this Action. + * Only available after the Action has been added to a Stage, + * and that Stage to a Pipeline. + */ + private get _scope(): Construct { + if (this.__scope) { + return this.__scope; + } else { + throw new Error('Action must be added to a stage that is part of a pipeline first'); + } + } +} + +/** + * The list of event types for AWS Codepipeline Pipeline + * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline + */ +export enum PipelineNotificationEvents { + /** + * Trigger notification when pipeline execution failed + */ + PIPELINE_EXECUTION_FAILED = 'codepipeline-pipeline-pipeline-execution-failed', + + /** + * Trigger notification when pipeline execution canceled + */ + PIPELINE_EXECUTION_CANCELED = 'codepipeline-pipeline-pipeline-execution-canceled', + + /** + * Trigger notification when pipeline execution started + */ + PIPELINE_EXECUTION_STARTED = 'codepipeline-pipeline-pipeline-execution-started', + + /** + * Trigger notification when pipeline execution resumed + */ + PIPELINE_EXECUTION_RESUMED = 'codepipeline-pipeline-pipeline-execution-resumed', + + /** + * Trigger notification when pipeline execution succeeded + */ + PIPELINE_EXECUTION_SUCCEEDED = 'codepipeline-pipeline-pipeline-execution-succeeded', + + /** + * Trigger notification when pipeline execution superseded + */ + PIPELINE_EXECUTION_SUPERSEDED = 'codepipeline-pipeline-pipeline-execution-superseded', + + /** + * Trigger notification when pipeline stage execution started + */ + STAGE_EXECUTION_STARTED = 'codepipeline-pipeline-stage-execution-started', + + /** + * Trigger notification when pipeline stage execution succeeded + */ + STAGE_EXECUTION_SUCCEEDED = 'codepipeline-pipeline-stage-execution-succeeded', + + /** + * Trigger notification when pipeline stage execution resumed + */ + STAGE_EXECUTION_RESUMED = 'codepipeline-pipeline-stage-execution-resumed', + + /** + * Trigger notification when pipeline stage execution canceled + */ + STAGE_EXECUTION_CANCELED = 'codepipeline-pipeline-stage-execution-canceled', + + /** + * Trigger notification when pipeline stage execution failed + */ + STAGE_EXECUTION_FAILED = 'codepipeline-pipeline-stage-execution-failed', + + /** + * Trigger notification when pipeline action execution succeeded + */ + ACTION_EXECUTION_SUCCEEDED = 'codepipeline-pipeline-action-execution-succeeded', + + /** + * Trigger notification when pipeline action execution failed + */ + ACTION_EXECUTION_FAILED = 'codepipeline-pipeline-action-execution-failed', + + /** + * Trigger notification when pipeline action execution canceled + */ + ACTION_EXECUTION_CANCELED = 'codepipeline-pipeline-action-execution-canceled', + + /** + * Trigger notification when pipeline action execution started + */ + ACTION_EXECUTION_STARTED = 'codepipeline-pipeline-action-execution-started', + + /** + * Trigger notification when pipeline manual approval failed + */ + MANUAL_APPROVAL_FAILED = 'codepipeline-pipeline-manual-approval-failed', + + /** + * Trigger notification when pipeline manual approval needed + */ + MANUAL_APPROVAL_NEEDED = 'codepipeline-pipeline-manual-approval-needed', + + /** + * Trigger notification when pipeline manual approval succeeded + */ + MANUAL_APPROVAL_SUCCEEDED = 'codepipeline-pipeline-manual-approval-succeeded', +} diff --git a/packages/@aws-cdk/aws-codepipeline/lib/artifact.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/artifact.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/lib/artifact.ts rename to packages/aws-cdk-lib/aws-codepipeline/lib/artifact.ts index 5317676a5f0fe..d5ae47f2eef1d 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/artifact.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/artifact.ts @@ -1,5 +1,5 @@ -import * as s3 from '@aws-cdk/aws-s3'; -import { Lazy, Token } from '@aws-cdk/core'; +import * as s3 from '../../aws-s3'; +import { Lazy, Token } from '../../core'; import * as validation from './private/validation'; /** diff --git a/packages/@aws-cdk/aws-codepipeline/lib/custom-action-registration.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/custom-action-registration.ts similarity index 100% rename from packages/@aws-cdk/aws-codepipeline/lib/custom-action-registration.ts rename to packages/aws-cdk-lib/aws-codepipeline/lib/custom-action-registration.ts diff --git a/packages/@aws-cdk/aws-codepipeline/lib/index.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codepipeline/lib/index.ts rename to packages/aws-cdk-lib/aws-codepipeline/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts new file mode 100644 index 0000000000000..c81189ce2ac53 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/pipeline.ts @@ -0,0 +1,1160 @@ +import * as notifications from '../../aws-codestarnotifications'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import { + ArnFormat, + BootstraplessSynthesizer, + DefaultStackSynthesizer, + FeatureFlags, + IStackSynthesizer, + Lazy, + Names, + PhysicalName, + RemovalPolicy, + Resource, + Stack, + Stage as CdkStage, + Token, +} from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { ActionCategory, IAction, IPipeline, IStage, PipelineNotificationEvents, PipelineNotifyOnOptions } from './action'; +import { CfnPipeline } from './codepipeline.generated'; +import { CrossRegionSupportConstruct, CrossRegionSupportStack } from './private/cross-region-support-stack'; +import { FullActionDescriptor } from './private/full-action-descriptor'; +import { RichAction } from './private/rich-action'; +import { Stage } from './private/stage'; +import { validateName, validateNamespaceName, validateSourceAction } from './private/validation'; + +/** + * Allows you to control where to place a new Stage when it's added to the Pipeline. + * Note that you can provide only one of the below properties - + * specifying more than one will result in a validation error. + * + * @see #rightBefore + * @see #justAfter + */ +export interface StagePlacement { + /** + * Inserts the new Stage as a parent of the given Stage + * (changing its current parent Stage, if it had one). + */ + readonly rightBefore?: IStage; + + /** + * Inserts the new Stage as a child of the given Stage + * (changing its current child Stage, if it had one). + */ + readonly justAfter?: IStage; +} + +/** + * Construction properties of a Pipeline Stage. + */ +export interface StageProps { + /** + * The physical, human-readable name to assign to this Pipeline Stage. + */ + readonly stageName: string; + + /** + * The list of Actions to create this Stage with. + * You can always add more Actions later by calling `IStage#addAction`. + */ + readonly actions?: IAction[]; + + /** + * Whether to enable transition to this stage. + * + * @default true + */ + readonly transitionToEnabled?: boolean; + + /** + * The reason for disabling transition to this stage. Only applicable + * if `transitionToEnabled` is set to `false`. + * + * @default 'Transition disabled' + */ + readonly transitionDisabledReason?: string; +} + +export interface StageOptions extends StageProps { + readonly placement?: StagePlacement; +} + +export interface PipelineProps { + /** + * The S3 bucket used by this Pipeline to store artifacts. + * + * @default - A new S3 bucket will be created. + */ + readonly artifactBucket?: s3.IBucket; + + /** + * The IAM role to be assumed by this Pipeline. + * + * @default a new IAM role will be created. + */ + readonly role?: iam.IRole; + + /** + * Indicates whether to rerun the AWS CodePipeline pipeline after you update it. + * + * @default false + */ + readonly restartExecutionOnUpdate?: boolean; + + /** + * Name of the pipeline. + * + * @default - AWS CloudFormation generates an ID and uses that for the pipeline name. + */ + readonly pipelineName?: string; + + /** + * A map of region to S3 bucket name used for cross-region CodePipeline. + * For every Action that you specify targeting a different region than the Pipeline itself, + * if you don't provide an explicit Bucket for that region using this property, + * the construct will automatically create a Stack containing an S3 Bucket in that region. + * + * @default - None. + */ + readonly crossRegionReplicationBuckets?: { [region: string]: s3.IBucket }; + + /** + * The list of Stages, in order, + * to create this Pipeline with. + * You can always add more Stages later by calling `Pipeline#addStage`. + * + * @default - None. + */ + readonly stages?: StageProps[]; + + /** + * Create KMS keys for cross-account deployments. + * + * This controls whether the pipeline is enabled for cross-account deployments. + * + * By default cross-account deployments are enabled, but this feature requires + * that KMS Customer Master Keys are created which have a cost of $1/month. + * + * If you do not need cross-account deployments, you can set this to `false` to + * not create those keys and save on that cost (the artifact bucket will be + * encrypted with an AWS-managed key). However, cross-account deployments will + * no longer be possible. + * + * @default true + */ + readonly crossAccountKeys?: boolean; + + /** + * Enable KMS key rotation for the generated KMS keys. + * + * By default KMS key rotation is disabled, but will add an additional $1/month + * for each year the key exists when enabled. + * + * @default - false (key rotation is disabled) + */ + readonly enableKeyRotation?: boolean; + + /** + * Reuse the same cross region support stack for all pipelines in the App. + * + * @default - true (Use the same support stack for all pipelines in App) + */ + readonly reuseCrossRegionSupportStacks?: boolean; +} + +abstract class PipelineBase extends Resource implements IPipeline { + public abstract readonly pipelineName: string; + public abstract readonly pipelineArn: string; + + /** + * Defines an event rule triggered by this CodePipeline. + * + * @param id Identifier for this event handler. + * @param options Additional options to pass to the event rule. + */ + public onEvent(id: string, options: events.OnEventOptions = {}): events.Rule { + const rule = new events.Rule(this, id, options); + rule.addTarget(options.target); + rule.addEventPattern({ + source: ['aws.codepipeline'], + resources: [this.pipelineArn], + }); + return rule; + } + + /** + * Defines an event rule triggered by the "CodePipeline Pipeline Execution + * State Change" event emitted from this pipeline. + * + * @param id Identifier for this event handler. + * @param options Additional options to pass to the event rule. + */ + public onStateChange(id: string, options: events.OnEventOptions = {}): events.Rule { + const rule = this.onEvent(id, options); + rule.addEventPattern({ + detailType: ['CodePipeline Pipeline Execution State Change'], + }); + return rule; + } + + public bindAsNotificationRuleSource(_scope: Construct): notifications.NotificationRuleSourceConfig { + return { + sourceArn: this.pipelineArn, + }; + } + + public notifyOn( + id: string, + target: notifications.INotificationRuleTarget, + options: PipelineNotifyOnOptions, + ): notifications.INotificationRule { + return new notifications.NotificationRule(this, id, { + ...options, + source: this, + targets: [target], + }); + } + + public notifyOnExecutionStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [ + PipelineNotificationEvents.PIPELINE_EXECUTION_FAILED, + PipelineNotificationEvents.PIPELINE_EXECUTION_CANCELED, + PipelineNotificationEvents.PIPELINE_EXECUTION_STARTED, + PipelineNotificationEvents.PIPELINE_EXECUTION_RESUMED, + PipelineNotificationEvents.PIPELINE_EXECUTION_SUCCEEDED, + PipelineNotificationEvents.PIPELINE_EXECUTION_SUPERSEDED, + ], + }); + } + + public notifyOnAnyStageStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [ + PipelineNotificationEvents.STAGE_EXECUTION_CANCELED, + PipelineNotificationEvents.STAGE_EXECUTION_FAILED, + PipelineNotificationEvents.STAGE_EXECUTION_RESUMED, + PipelineNotificationEvents.STAGE_EXECUTION_STARTED, + PipelineNotificationEvents.STAGE_EXECUTION_SUCCEEDED, + ], + }); + } + + public notifyOnAnyActionStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [ + PipelineNotificationEvents.ACTION_EXECUTION_CANCELED, + PipelineNotificationEvents.ACTION_EXECUTION_FAILED, + PipelineNotificationEvents.ACTION_EXECUTION_STARTED, + PipelineNotificationEvents.ACTION_EXECUTION_SUCCEEDED, + ], + }); + } + + public notifyOnAnyManualApprovalStateChange( + id: string, + target: notifications.INotificationRuleTarget, + options?: notifications.NotificationRuleOptions, + ): notifications.INotificationRule { + return this.notifyOn(id, target, { + ...options, + events: [ + PipelineNotificationEvents.MANUAL_APPROVAL_FAILED, + PipelineNotificationEvents.MANUAL_APPROVAL_NEEDED, + PipelineNotificationEvents.MANUAL_APPROVAL_SUCCEEDED, + ], + }); + } +} + +/** + * An AWS CodePipeline pipeline with its associated IAM role and S3 bucket. + * + * @example + * // create a pipeline + * import * as codecommit from '@aws-cdk/aws-codecommit'; + * + * const pipeline = new codepipeline.Pipeline(this, 'Pipeline'); + * + * // add a stage + * const sourceStage = pipeline.addStage({ stageName: 'Source' }); + * + * // add a source action to the stage + * declare const repo: codecommit.Repository; + * declare const sourceArtifact: codepipeline.Artifact; + * sourceStage.addAction(new codepipeline_actions.CodeCommitSourceAction({ + * actionName: 'Source', + * output: sourceArtifact, + * repository: repo, + * })); + * + * // ... add more stages + */ +export class Pipeline extends PipelineBase { + /** + * Import a pipeline into this app. + * + * @param scope the scope into which to import this pipeline + * @param id the logical ID of the returned pipeline construct + * @param pipelineArn The ARN of the pipeline (e.g. `arn:aws:codepipeline:us-east-1:123456789012:MyDemoPipeline`) + */ + public static fromPipelineArn(scope: Construct, id: string, pipelineArn: string): IPipeline { + class Import extends PipelineBase { + public readonly pipelineName = Stack.of(scope).splitArn(pipelineArn, ArnFormat.SLASH_RESOURCE_NAME).resource; + public readonly pipelineArn = pipelineArn; + } + + return new Import(scope, id); + } + + /** + * The IAM role AWS CodePipeline will use to perform actions or assume roles for actions with + * a more specific IAM role. + */ + public readonly role: iam.IRole; + + /** + * ARN of this pipeline + */ + public readonly pipelineArn: string; + + /** + * The name of the pipeline + */ + public readonly pipelineName: string; + + /** + * The version of the pipeline + * + * @attribute + */ + public readonly pipelineVersion: string; + + /** + * Bucket used to store output artifacts + */ + public readonly artifactBucket: s3.IBucket; + + private readonly _stages = new Array(); + private readonly crossRegionBucketsPassed: boolean; + private readonly _crossRegionSupport: { [region: string]: CrossRegionSupport } = {}; + private readonly _crossAccountSupport: { [account: string]: Stack } = {}; + private readonly crossAccountKeys: boolean; + private readonly enableKeyRotation?: boolean; + private readonly reuseCrossRegionSupportStacks: boolean; + private readonly codePipeline: CfnPipeline; + + constructor(scope: Construct, id: string, props: PipelineProps = {}) { + super(scope, id, { + physicalName: props.pipelineName, + }); + + validateName('Pipeline', this.physicalName); + + // only one of artifactBucket and crossRegionReplicationBuckets can be supplied + if (props.artifactBucket && props.crossRegionReplicationBuckets) { + throw new Error('Only one of artifactBucket and crossRegionReplicationBuckets can be specified!'); + } + + // @deprecated(v2): switch to default false + this.crossAccountKeys = props.crossAccountKeys ?? true; + this.enableKeyRotation = props.enableKeyRotation; + + // Cross account keys must be set for key rotation to be enabled + if (this.enableKeyRotation && !this.crossAccountKeys) { + throw new Error("Setting 'enableKeyRotation' to true also requires 'crossAccountKeys' to be enabled"); + } + + this.reuseCrossRegionSupportStacks = props.reuseCrossRegionSupportStacks ?? true; + + // If a bucket has been provided, use it - otherwise, create a bucket. + let propsBucket = this.getArtifactBucketFromProps(props); + + if (!propsBucket) { + let encryptionKey; + + if (this.crossAccountKeys) { + encryptionKey = new kms.Key(this, 'ArtifactsBucketEncryptionKey', { + // remove the key - there is a grace period of a few days before it's gone for good, + // that should be enough for any emergency access to the bucket artifacts + removalPolicy: RemovalPolicy.DESTROY, + enableKeyRotation: this.enableKeyRotation, + }); + // add an alias to make finding the key in the console easier + new kms.Alias(this, 'ArtifactsBucketEncryptionKeyAlias', { + aliasName: this.generateNameForDefaultBucketKeyAlias(), + targetKey: encryptionKey, + removalPolicy: RemovalPolicy.DESTROY, // destroy the alias along with the key + }); + } + + propsBucket = new s3.Bucket(this, 'ArtifactsBucket', { + bucketName: PhysicalName.GENERATE_IF_NEEDED, + encryptionKey, + encryption: encryptionKey ? s3.BucketEncryption.KMS : s3.BucketEncryption.KMS_MANAGED, + enforceSSL: true, + blockPublicAccess: new s3.BlockPublicAccess(s3.BlockPublicAccess.BLOCK_ALL), + removalPolicy: RemovalPolicy.RETAIN, + }); + } + this.artifactBucket = propsBucket; + + // If a role has been provided, use it - otherwise, create a role. + this.role = props.role || new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('codepipeline.amazonaws.com'), + }); + + this.codePipeline = new CfnPipeline(this, 'Resource', { + artifactStore: Lazy.any({ produce: () => this.renderArtifactStoreProperty() }), + artifactStores: Lazy.any({ produce: () => this.renderArtifactStoresProperty() }), + stages: Lazy.any({ produce: () => this.renderStages() }), + disableInboundStageTransitions: Lazy.any({ produce: () => this.renderDisabledTransitions() }, { omitEmptyArray: true }), + roleArn: this.role.roleArn, + restartExecutionOnUpdate: props && props.restartExecutionOnUpdate, + name: this.physicalName, + }); + + // this will produce a DependsOn for both the role and the policy resources. + this.codePipeline.node.addDependency(this.role); + + this.artifactBucket.grantReadWrite(this.role); + this.pipelineName = this.getResourceNameAttribute(this.codePipeline.ref); + this.pipelineVersion = this.codePipeline.attrVersion; + this.crossRegionBucketsPassed = !!props.crossRegionReplicationBuckets; + + for (const [region, replicationBucket] of Object.entries(props.crossRegionReplicationBuckets || {})) { + this._crossRegionSupport[region] = { + replicationBucket, + stack: Stack.of(replicationBucket), + }; + } + + // Does not expose a Fn::GetAtt for the ARN so we'll have to make it ourselves + this.pipelineArn = Stack.of(this).formatArn({ + service: 'codepipeline', + resource: this.pipelineName, + }); + + for (const stage of props.stages || []) { + this.addStage(stage); + } + + this.node.addValidation({ validate: () => this.validatePipeline() }); + } + + /** + * Creates a new Stage, and adds it to this Pipeline. + * + * @param props the creation properties of the new Stage + * @returns the newly created Stage + */ + public addStage(props: StageOptions): IStage { + // check for duplicate Stages and names + if (this._stages.find(s => s.stageName === props.stageName)) { + throw new Error(`Stage with duplicate name '${props.stageName}' added to the Pipeline`); + } + + const stage = new Stage(props, this); + + const index = props.placement + ? this.calculateInsertIndexFromPlacement(props.placement) + : this.stageCount; + + this._stages.splice(index, 0, stage); + + return stage; + } + + /** + * Adds a statement to the pipeline role. + */ + public addToRolePolicy(statement: iam.PolicyStatement) { + this.role.addToPrincipalPolicy(statement); + } + + /** + * Get the number of Stages in this Pipeline. + */ + public get stageCount(): number { + return this._stages.length; + } + + /** + * Returns the stages that comprise the pipeline. + * + * **Note**: the returned array is a defensive copy, + * so adding elements to it has no effect. + * Instead, use the `addStage` method if you want to add more stages + * to the pipeline. + */ + public get stages(): IStage[] { + return this._stages.slice(); + } + + /** + * Access one of the pipeline's stages by stage name + */ + public stage(stageName: string): IStage { + for (const stage of this._stages) { + if (stage.stageName === stageName) { + return stage; + } + } + throw new Error(`Pipeline does not contain a stage named '${stageName}'. Available stages: ${this._stages.map(s => s.stageName).join(', ')}`); + } + + /** + * Returns all of the `CrossRegionSupportStack`s that were generated automatically + * when dealing with Actions that reside in a different region than the Pipeline itself. + * + */ + public get crossRegionSupport(): { [region: string]: CrossRegionSupport } { + const ret: { [region: string]: CrossRegionSupport } = {}; + Object.keys(this._crossRegionSupport).forEach((key) => { + ret[key] = this._crossRegionSupport[key]; + }); + return ret; + } + + /** @internal */ + public _attachActionToPipeline(stage: Stage, action: IAction, actionScope: Construct): FullActionDescriptor { + const richAction = new RichAction(action, this); + + // handle cross-region actions here + const crossRegionInfo = this.ensureReplicationResourcesExistFor(richAction); + + // get the role for the given action, handling if it's cross-account + const actionRole = this.getRoleForAction(stage, richAction, actionScope); + + // // CodePipeline Variables + validateNamespaceName(richAction.actionProperties.variablesNamespace); + + // bind the Action (type h4x) + const actionConfig = richAction.bind(actionScope, stage, { + role: actionRole ? actionRole : this.role, + bucket: crossRegionInfo.artifactBucket, + }); + + return new FullActionDescriptor({ + // must be 'action', not 'richAction', + // as those are returned by the IStage.actions property, + // and it's important customers of Pipeline get the same instance + // back as they added to the pipeline + action, + actionConfig, + actionRole, + actionRegion: crossRegionInfo.region, + }); + } + + /** + * Validate the pipeline structure + * + * Validation happens according to the rules documented at + * + * https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#pipeline-requirements + */ + private validatePipeline(): string[] { + return [ + ...this.validateSourceActionLocations(), + ...this.validateHasStages(), + ...this.validateStages(), + ...this.validateArtifacts(), + ]; + } + + private ensureReplicationResourcesExistFor(action: RichAction): CrossRegionInfo { + if (!action.isCrossRegion) { + return { + artifactBucket: this.artifactBucket, + }; + } + + // The action has a specific region, + // require the pipeline to have a known region as well. + this.requireRegion(); + + // source actions have to be in the same region as the pipeline + if (action.actionProperties.category === ActionCategory.SOURCE) { + throw new Error(`Source action '${action.actionProperties.actionName}' must be in the same region as the pipeline`); + } + + // check whether we already have a bucket in that region, + // either passed from the outside or previously created + const crossRegionSupport = this.obtainCrossRegionSupportFor(action); + + // the stack containing the replication bucket must be deployed before the pipeline + Stack.of(this).addDependency(crossRegionSupport.stack); + // The Pipeline role must be able to replicate to that bucket + crossRegionSupport.replicationBucket.grantReadWrite(this.role); + + return { + artifactBucket: crossRegionSupport.replicationBucket, + region: action.effectiveRegion, + }; + } + + /** + * Get or create the cross-region support construct for the given action + */ + private obtainCrossRegionSupportFor(action: RichAction) { + // this method is never called for non cross-region actions + const actionRegion = action.effectiveRegion!; + let crossRegionSupport = this._crossRegionSupport[actionRegion]; + if (!crossRegionSupport) { + // we need to create scaffolding resources for this region + const otherStack = action.resourceStack; + crossRegionSupport = this.createSupportResourcesForRegion(otherStack, actionRegion); + this._crossRegionSupport[actionRegion] = crossRegionSupport; + } + return crossRegionSupport; + } + + private createSupportResourcesForRegion(otherStack: Stack | undefined, actionRegion: string): CrossRegionSupport { + // if we have a stack from the resource passed - use that! + if (otherStack) { + // check if the stack doesn't have this magic construct already + const id = `CrossRegionReplicationSupport-d823f1d8-a990-4e5c-be18-4ac698532e65-${actionRegion}`; + let crossRegionSupportConstruct = otherStack.node.tryFindChild(id) as CrossRegionSupportConstruct; + if (!crossRegionSupportConstruct) { + crossRegionSupportConstruct = new CrossRegionSupportConstruct(otherStack, id, { + createKmsKey: this.crossAccountKeys, + enableKeyRotation: this.enableKeyRotation, + }); + } + + return { + replicationBucket: crossRegionSupportConstruct.replicationBucket, + stack: otherStack, + }; + } + + // otherwise - create a stack with the resources needed for replication across regions + const pipelineStack = Stack.of(this); + const pipelineAccount = pipelineStack.account; + if (Token.isUnresolved(pipelineAccount)) { + throw new Error("You need to specify an explicit account when using CodePipeline's cross-region support"); + } + + const app = this.supportScope(); + const supportStackId = `cross-region-stack-${this.reuseCrossRegionSupportStacks ? pipelineAccount : pipelineStack.stackName}:${actionRegion}`; + let supportStack = app.node.tryFindChild(supportStackId) as CrossRegionSupportStack; + if (!supportStack) { + supportStack = new CrossRegionSupportStack(app, supportStackId, { + pipelineStackName: pipelineStack.stackName, + region: actionRegion, + account: pipelineAccount, + synthesizer: this.getCrossRegionSupportSynthesizer(), + createKmsKey: this.crossAccountKeys, + enableKeyRotation: this.enableKeyRotation, + }); + } + + return { + stack: supportStack, + replicationBucket: supportStack.replicationBucket, + }; + } + + private getCrossRegionSupportSynthesizer(): IStackSynthesizer | undefined { + if (this.stack.synthesizer instanceof DefaultStackSynthesizer) { + // if we have the new synthesizer, + // we need a bootstrapless copy of it, + // because we don't want to require bootstrapping the environment + // of the pipeline account in this replication region + return new BootstraplessSynthesizer({ + deployRoleArn: this.stack.synthesizer.deployRoleArn, + cloudFormationExecutionRoleArn: this.stack.synthesizer.cloudFormationExecutionRoleArn, + }); + } else { + // any other synthesizer: just return undefined + // (ie., use the default based on the context settings) + return undefined; + } + } + + private generateNameForDefaultBucketKeyAlias(): string { + const prefix = 'alias/codepipeline-'; + const maxAliasLength = 256; + const maxResourceNameLength = maxAliasLength - prefix.length; + // Names.uniqueId() may have naming collisions when the IDs of resources are similar + // and/or when they are too long and sliced. We do not want to update this and + // automatically change the name of every KMS key already generated so we are putting + // this under a feature flag. + const uniqueId = FeatureFlags.of(this).isEnabled(cxapi.CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME) ? + Names.uniqueResourceName(this, { + separator: '-', + maxLength: maxResourceNameLength, + allowedSpecialCharacters: '/_-', + }) : + Names.uniqueId(this).slice(-maxResourceNameLength); + return prefix + uniqueId.toLowerCase(); + } + + /** + * Gets the role used for this action, + * including handling the case when the action is supposed to be cross-account. + * + * @param stage the stage the action belongs to + * @param action the action to return/create a role for + * @param actionScope the scope, unique to the action, to create new resources in + */ + private getRoleForAction(stage: Stage, action: RichAction, actionScope: Construct): iam.IRole | undefined { + const pipelineStack = Stack.of(this); + + let actionRole = this.getRoleFromActionPropsOrGenerateIfCrossAccount(stage, action); + + if (!actionRole && this.isAwsOwned(action)) { + // generate a Role for this specific Action + actionRole = new iam.Role(actionScope, 'CodePipelineActionRole', { + assumedBy: new iam.AccountPrincipal(pipelineStack.account), + }); + } + + // the pipeline role needs assumeRole permissions to the action role + const grant = actionRole?.grantAssumeRole(this.role); + grant?.applyBefore(this.codePipeline); + return actionRole; + } + + private getRoleFromActionPropsOrGenerateIfCrossAccount(stage: Stage, action: RichAction): iam.IRole | undefined { + const pipelineStack = Stack.of(this); + + // if we have a cross-account action, the pipeline's bucket must have a KMS key + // (otherwise we can't configure cross-account trust policies) + if (action.isCrossAccount) { + const artifactBucket = this.ensureReplicationResourcesExistFor(action).artifactBucket; + if (!artifactBucket.encryptionKey) { + throw new Error( + `Artifact Bucket must have a KMS Key to add cross-account action '${action.actionProperties.actionName}' ` + + `(pipeline account: '${renderEnvDimension(this.env.account)}', action account: '${renderEnvDimension(action.effectiveAccount)}'). ` + + 'Create Pipeline with \'crossAccountKeys: true\' (or pass an existing Bucket with a key)', + ); + } + } + + // if a Role has been passed explicitly, always use it + // (even if the backing resource is from a different account - + // this is how the user can override our default support logic) + if (action.actionProperties.role) { + if (this.isAwsOwned(action)) { + // the role has to be deployed before the pipeline + // (our magical cross-stack dependencies will not work, + // because the role might be from a different environment), + // but _only_ if it's a new Role - + // an imported Role should not add the dependency + if (iam.Role.isRole(action.actionProperties.role)) { + const roleStack = Stack.of(action.actionProperties.role); + pipelineStack.addDependency(roleStack); + } + + return action.actionProperties.role; + } else { + // ...except if the Action is not owned by 'AWS', + // as that would be rejected by CodePipeline at deploy time + throw new Error("Specifying a Role is not supported for actions with an owner different than 'AWS' - " + + `got '${action.actionProperties.owner}' (Action: '${action.actionProperties.actionName}' in Stage: '${stage.stageName}')`); + } + } + + // if we don't have a Role passed, + // and the action is cross-account, + // generate a Role in that other account stack + const otherAccountStack = this.getOtherStackIfActionIsCrossAccount(action); + if (!otherAccountStack) { + return undefined; + } + + // generate a role in the other stack, that the Pipeline will assume for executing this action + const ret = new iam.Role(otherAccountStack, + `${Names.uniqueId(this)}-${stage.stageName}-${action.actionProperties.actionName}-ActionRole`, { + assumedBy: new iam.AccountPrincipal(pipelineStack.account), + roleName: PhysicalName.GENERATE_IF_NEEDED, + }); + // the other stack with the role has to be deployed before the pipeline stack + // (CodePipeline verifies you can assume the action Role on creation) + pipelineStack.addDependency(otherAccountStack); + + return ret; + } + + /** + * Returns the Stack this Action belongs to if this is a cross-account Action. + * If this Action is not cross-account (i.e., it lives in the same account as the Pipeline), + * it returns undefined. + * + * @param action the Action to return the Stack for + */ + private getOtherStackIfActionIsCrossAccount(action: IAction): Stack | undefined { + const targetAccount = action.actionProperties.resource + ? action.actionProperties.resource.env.account + : action.actionProperties.account; + + if (targetAccount === undefined) { + // if the account of the Action is not specified, + // then it defaults to the same account the pipeline itself is in + return undefined; + } + + // check whether the action's account is a static string + if (Token.isUnresolved(targetAccount)) { + if (Token.isUnresolved(this.env.account)) { + // the pipeline is also env-agnostic, so that's fine + return undefined; + } else { + throw new Error(`The 'account' property must be a concrete value (action: '${action.actionProperties.actionName}')`); + } + } + + // At this point, we know that the action's account is a static string. + // In this case, the pipeline's account must also be a static string. + if (Token.isUnresolved(this.env.account)) { + throw new Error('Pipeline stack which uses cross-environment actions must have an explicitly set account'); + } + + // at this point, we know that both the Pipeline's account, + // and the action-backing resource's account are static strings + + // if they are identical - nothing to do (the action is not cross-account) + if (this.env.account === targetAccount) { + return undefined; + } + + // at this point, we know that the action is certainly cross-account, + // so we need to return a Stack in its account to create the helper Role in + + const candidateActionResourceStack = action.actionProperties.resource + ? Stack.of(action.actionProperties.resource) + : undefined; + if (candidateActionResourceStack?.account === targetAccount) { + // we always use the "latest" action-backing resource's Stack for this account, + // even if a different one was used earlier + this._crossAccountSupport[targetAccount] = candidateActionResourceStack; + return candidateActionResourceStack; + } + + let targetAccountStack: Stack | undefined = this._crossAccountSupport[targetAccount]; + if (!targetAccountStack) { + const stackId = `cross-account-support-stack-${targetAccount}`; + const app = this.supportScope(); + targetAccountStack = app.node.tryFindChild(stackId) as Stack; + if (!targetAccountStack) { + const actionRegion = action.actionProperties.resource + ? action.actionProperties.resource.env.region + : action.actionProperties.region; + const pipelineStack = Stack.of(this); + targetAccountStack = new Stack(app, stackId, { + stackName: `${pipelineStack.stackName}-support-${targetAccount}`, + env: { + account: targetAccount, + region: actionRegion ?? pipelineStack.region, + }, + }); + } + this._crossAccountSupport[targetAccount] = targetAccountStack; + } + return targetAccountStack; + } + + private isAwsOwned(action: IAction) { + const owner = action.actionProperties.owner; + return !owner || owner === 'AWS'; + } + + private getArtifactBucketFromProps(props: PipelineProps): s3.IBucket | undefined { + if (props.artifactBucket) { + return props.artifactBucket; + } + if (props.crossRegionReplicationBuckets) { + const pipelineRegion = this.requireRegion(); + return props.crossRegionReplicationBuckets[pipelineRegion]; + } + return undefined; + } + + private calculateInsertIndexFromPlacement(placement: StagePlacement): number { + // check if at most one placement property was provided + const providedPlacementProps = ['rightBefore', 'justAfter', 'atIndex'] + .filter((prop) => (placement as any)[prop] !== undefined); + if (providedPlacementProps.length > 1) { + throw new Error('Error adding Stage to the Pipeline: ' + + 'you can only provide at most one placement property, but ' + + `'${providedPlacementProps.join(', ')}' were given`); + } + + if (placement.rightBefore !== undefined) { + const targetIndex = this.findStageIndex(placement.rightBefore); + if (targetIndex === -1) { + throw new Error('Error adding Stage to the Pipeline: ' + + `the requested Stage to add it before, '${placement.rightBefore.stageName}', was not found`); + } + return targetIndex; + } + + if (placement.justAfter !== undefined) { + const targetIndex = this.findStageIndex(placement.justAfter); + if (targetIndex === -1) { + throw new Error('Error adding Stage to the Pipeline: ' + + `the requested Stage to add it after, '${placement.justAfter.stageName}', was not found`); + } + return targetIndex + 1; + } + + return this.stageCount; + } + + private findStageIndex(targetStage: IStage) { + return this._stages.findIndex(stage => stage === targetStage); + } + + private validateSourceActionLocations(): string[] { + const errors = new Array(); + let firstStage = true; + for (const stage of this._stages) { + const onlySourceActionsPermitted = firstStage; + for (const action of stage.actionDescriptors) { + errors.push(...validateSourceAction(onlySourceActionsPermitted, action.category, action.actionName, stage.stageName)); + } + firstStage = false; + } + return errors; + } + + private validateHasStages(): string[] { + if (this.stageCount < 2) { + return ['Pipeline must have at least two stages']; + } + return []; + } + + private validateStages(): string[] { + const ret = new Array(); + for (const stage of this._stages) { + ret.push(...stage.validate()); + } + return ret; + } + + private validateArtifacts(): string[] { + const ret = new Array(); + + const producers: Record = {}; + const firstConsumers: Record = {}; + + for (const [stageIndex, stage] of enumerate(this._stages)) { + // For every output artifact, get the producer + for (const action of stage.actionDescriptors) { + const actionLoc = new PipelineLocation(stageIndex, stage, action); + + for (const outputArtifact of action.outputs) { + // output Artifacts always have a name set + const name = outputArtifact.artifactName!; + if (producers[name]) { + ret.push(`Both Actions '${producers[name].actionName}' and '${action.actionName}' are producting Artifact '${name}'. Every artifact can only be produced once.`); + continue; + } + + producers[name] = actionLoc; + } + + // For every input artifact, get the first consumer + for (const inputArtifact of action.inputs) { + const name = inputArtifact.artifactName; + if (!name) { + ret.push(`Action '${action.actionName}' is using an unnamed input Artifact, which is not being produced in this pipeline`); + continue; + } + + firstConsumers[name] = firstConsumers[name] ? firstConsumers[name].first(actionLoc) : actionLoc; + } + } + } + + // Now validate that every input artifact is produced before it's + // being consumed. + for (const [artifactName, consumerLoc] of Object.entries(firstConsumers)) { + const producerLoc = producers[artifactName]; + if (!producerLoc) { + ret.push(`Action '${consumerLoc.actionName}' is using input Artifact '${artifactName}', which is not being produced in this pipeline`); + continue; + } + + if (consumerLoc.beforeOrEqual(producerLoc)) { + ret.push(`${consumerLoc} is consuming input Artifact '${artifactName}' before it is being produced at ${producerLoc}`); + } + } + + return ret; + } + + private renderArtifactStoresProperty(): CfnPipeline.ArtifactStoreMapProperty[] | undefined { + if (!this.crossRegion) { return undefined; } + + // add the Pipeline's artifact store + const primaryRegion = this.requireRegion(); + this._crossRegionSupport[primaryRegion] = { + replicationBucket: this.artifactBucket, + stack: Stack.of(this), + }; + + return Object.entries(this._crossRegionSupport).map(([region, support]) => ({ + region, + artifactStore: this.renderArtifactStore(support.replicationBucket), + })); + } + + private renderArtifactStoreProperty(): CfnPipeline.ArtifactStoreProperty | undefined { + if (this.crossRegion) { return undefined; } + return this.renderPrimaryArtifactStore(); + } + + private renderPrimaryArtifactStore(): CfnPipeline.ArtifactStoreProperty { + return this.renderArtifactStore(this.artifactBucket); + } + + private renderArtifactStore(bucket: s3.IBucket): CfnPipeline.ArtifactStoreProperty { + let encryptionKey: CfnPipeline.EncryptionKeyProperty | undefined; + const bucketKey = bucket.encryptionKey; + if (bucketKey) { + encryptionKey = { + type: 'KMS', + id: bucketKey.keyArn, + }; + } + + return { + type: 'S3', + location: bucket.bucketName, + encryptionKey, + }; + } + + private get crossRegion(): boolean { + if (this.crossRegionBucketsPassed) { return true; } + return this._stages.some(stage => stage.actionDescriptors.some(action => action.region !== undefined)); + } + + private renderStages(): CfnPipeline.StageDeclarationProperty[] { + return this._stages.map(stage => stage.render()); + } + + private renderDisabledTransitions(): CfnPipeline.StageTransitionProperty[] { + return this._stages + .filter(stage => !stage.transitionToEnabled) + .map(stage => ({ + reason: stage.transitionDisabledReason, + stageName: stage.stageName, + })); + } + + private requireRegion(): string { + const region = this.env.region; + if (Token.isUnresolved(region)) { + throw new Error('Pipeline stack which uses cross-environment actions must have an explicitly set region'); + } + return region; + } + + private supportScope(): CdkStage { + const scope = CdkStage.of(this); + if (!scope) { + throw new Error('Pipeline stack which uses cross-environment actions must be part of a CDK App or Stage'); + } + return scope; + } +} + +/** + * An interface representing resources generated in order to support + * the cross-region capabilities of CodePipeline. + * You get instances of this interface from the `Pipeline#crossRegionSupport` property. + * + */ +export interface CrossRegionSupport { + /** + * The Stack that has been created to house the replication Bucket + * required for this region. + */ + readonly stack: Stack; + + /** + * The replication Bucket used by CodePipeline to operate in this region. + * Belongs to `stack`. + */ + readonly replicationBucket: s3.IBucket; +} + +interface CrossRegionInfo { + readonly artifactBucket: s3.IBucket; + + readonly region?: string; +} + +function enumerate(xs: A[]): Array<[number, A]> { + const ret = new Array<[number, A]>(); + for (let i = 0; i < xs.length; i++) { + ret.push([i, xs[i]]); + } + return ret; +} + +class PipelineLocation { + constructor(private readonly stageIndex: number, private readonly stage: IStage, private readonly action: FullActionDescriptor) { + } + + public get stageName() { + return this.stage.stageName; + } + + public get actionName() { + return this.action.actionName; + } + + /** + * Returns whether a is before or the same order as b + */ + public beforeOrEqual(rhs: PipelineLocation) { + if (this.stageIndex !== rhs.stageIndex) { return rhs.stageIndex < rhs.stageIndex; } + return this.action.runOrder <= rhs.action.runOrder; + } + + /** + * Returns the first location between this and the other one + */ + public first(rhs: PipelineLocation) { + return this.beforeOrEqual(rhs) ? this : rhs; + } + + public toString() { + // runOrders are 1-based, so make the stageIndex also 1-based otherwise it's going to be confusing. + return `Stage ${this.stageIndex + 1} Action ${this.action.runOrder} ('${this.stageName}'/'${this.actionName}')`; + } +} + +/** + * Render an env dimension without showing the ugly stringified tokens + */ +function renderEnvDimension(s: string | undefined) { + return Token.isUnresolved(s) ? '(current)' : s; +} diff --git a/packages/@aws-cdk/aws-codepipeline/lib/private/cross-region-support-stack.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/private/cross-region-support-stack.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline/lib/private/cross-region-support-stack.ts rename to packages/aws-cdk-lib/aws-codepipeline/lib/private/cross-region-support-stack.ts index b8d7b7fc475d5..40e3f17637ba7 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/private/cross-region-support-stack.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/private/cross-region-support-stack.ts @@ -1,6 +1,6 @@ -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import * as kms from '../../../aws-kms'; +import * as s3 from '../../../aws-s3'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; const REQUIRED_ALIAS_PREFIX = 'alias/'; diff --git a/packages/@aws-cdk/aws-codepipeline/lib/private/full-action-descriptor.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/private/full-action-descriptor.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/lib/private/full-action-descriptor.ts rename to packages/aws-cdk-lib/aws-codepipeline/lib/private/full-action-descriptor.ts index 895d3cf15430c..fbe7d3d3eb3c8 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/private/full-action-descriptor.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/private/full-action-descriptor.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../../aws-iam'; import { ActionArtifactBounds, ActionCategory, ActionConfig, IAction } from '../action'; import { Artifact } from '../artifact'; diff --git a/packages/@aws-cdk/aws-codepipeline/lib/private/rich-action.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/private/rich-action.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/lib/private/rich-action.ts rename to packages/aws-cdk-lib/aws-codepipeline/lib/private/rich-action.ts index 2b6499013c06d..4d3b896523274 100644 --- a/packages/@aws-cdk/aws-codepipeline/lib/private/rich-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/private/rich-action.ts @@ -1,5 +1,5 @@ -import * as events from '@aws-cdk/aws-events'; -import { ResourceEnvironment, Stack, Token, TokenComparison } from '@aws-cdk/core'; +import * as events from '../../../aws-events'; +import { ResourceEnvironment, Stack, Token, TokenComparison } from '../../../core'; import { Construct } from 'constructs'; import { ActionBindOptions, ActionConfig, ActionProperties, IAction, IPipeline, IStage } from '../action'; diff --git a/packages/aws-cdk-lib/aws-codepipeline/lib/private/stage.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/private/stage.ts new file mode 100644 index 0000000000000..c586923aba0b6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/private/stage.ts @@ -0,0 +1,203 @@ +import * as events from '../../../aws-events'; +import * as cdk from '../../../core'; +import { Token } from '../../../core'; +import { Construct, Node } from 'constructs'; +import { FullActionDescriptor } from './full-action-descriptor'; +import * as validation from './validation'; +import { IAction, IPipeline, IStage } from '../action'; +import { Artifact } from '../artifact'; +import { CfnPipeline } from '../codepipeline.generated'; +import { Pipeline, StageProps } from '../pipeline'; + +/** + * A Stage in a Pipeline. + * + * Stages are added to a Pipeline by calling `Pipeline#addStage`, + * which returns an instance of `codepipeline.IStage`. + * + * This class is private to the CodePipeline module. + */ +export class Stage implements IStage { + /** + * The Pipeline this Stage is a part of. + */ + public readonly stageName: string; + public readonly transitionToEnabled: boolean; + public readonly transitionDisabledReason: string; + private readonly scope: Construct; + private readonly _pipeline: Pipeline; + private readonly _actions = new Array(); + + /** + * Create a new Stage. + */ + constructor(props: StageProps, pipeline: Pipeline) { + validation.validateName('Stage', props.stageName); + + this.stageName = props.stageName; + this.transitionToEnabled = props.transitionToEnabled ?? true; + this.transitionDisabledReason = props.transitionDisabledReason ?? 'Transition disabled'; + this._pipeline = pipeline; + this.scope = new Construct(pipeline, this.stageName); + + for (const action of props.actions || []) { + this.addAction(action); + } + } + + /** + * Get a duplicate of this stage's list of actions. + */ + public get actionDescriptors(): FullActionDescriptor[] { + return this._actions.slice(); + } + + public get actions(): IAction[] { + return this._actions.map(actionDescriptor => actionDescriptor.action); + } + + public get pipeline(): IPipeline { + return this._pipeline; + } + + public render(): CfnPipeline.StageDeclarationProperty { + // first, assign names to output Artifacts who don't have one + for (const action of this._actions) { + const outputArtifacts = action.outputs; + + const unnamedOutputs = outputArtifacts.filter(o => !o.artifactName); + + for (const outputArtifact of outputArtifacts) { + if (!outputArtifact.artifactName) { + const unsanitizedArtifactName = `Artifact_${this.stageName}_${action.actionName}` + (unnamedOutputs.length === 1 + ? '' + : '_' + (unnamedOutputs.indexOf(outputArtifact) + 1)); + const artifactName = sanitizeArtifactName(unsanitizedArtifactName); + (outputArtifact as any)._setName(artifactName); + } + } + } + + return { + name: this.stageName, + actions: this._actions.map(action => this.renderAction(action)), + }; + } + + public addAction(action: IAction): void { + const actionName = action.actionProperties.actionName; + // validate the name + validation.validateName('Action', actionName); + + // check for duplicate Actions and names + if (this._actions.find(a => a.actionName === actionName)) { + throw new Error(`Stage ${this.stageName} already contains an action with name '${actionName}'`); + } + + this._actions.push(this.attachActionToPipeline(action)); + } + + public onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule { + const rule = new events.Rule(this.scope, name, options); + rule.addTarget(target); + rule.addEventPattern({ + detailType: ['CodePipeline Stage Execution State Change'], + source: ['aws.codepipeline'], + resources: [this.pipeline.pipelineArn], + detail: { + stage: [this.stageName], + }, + }); + return rule; + } + + public validate(): string[] { + return [ + ...this.validateHasActions(), + ...this.validateActions(), + ]; + } + + private validateHasActions(): string[] { + if (this._actions.length === 0) { + return [`Stage '${this.stageName}' must have at least one action`]; + } + return []; + } + + private validateActions(): string[] { + const ret = new Array(); + for (const action of this.actionDescriptors) { + ret.push(...this.validateAction(action)); + } + return ret; + } + + private validateAction(action: FullActionDescriptor): string[] { + return validation.validateArtifactBounds('input', action.inputs, action.artifactBounds.minInputs, + action.artifactBounds.maxInputs, action.category, action.provider) + .concat(validation.validateArtifactBounds('output', action.outputs, action.artifactBounds.minOutputs, + action.artifactBounds.maxOutputs, action.category, action.provider), + ); + } + + private attachActionToPipeline(action: IAction): FullActionDescriptor { + // notify the Pipeline of the new Action + // + // It may be that a construct already exists with the given action name (CDK Pipelines + // may do this to maintain construct tree compatibility between versions). + // + // If so, we simply reuse it. + let actionScope = Node.of(this.scope).tryFindChild(action.actionProperties.actionName) as Construct | undefined; + if (!actionScope) { + let id = action.actionProperties.actionName; + if (Token.isUnresolved(id)) { + id = findUniqueConstructId(this.scope, action.actionProperties.provider); + } + actionScope = new Construct(this.scope, id); + } + return this._pipeline._attachActionToPipeline(this, action, actionScope); + } + + private renderAction(action: FullActionDescriptor): CfnPipeline.ActionDeclarationProperty { + const outputArtifacts = cdk.Lazy.any({ produce: () => this.renderArtifacts(action.outputs) }, { omitEmptyArray: true }); + const inputArtifacts = cdk.Lazy.any({ produce: () => this.renderArtifacts(action.inputs) }, { omitEmptyArray: true }); + return { + name: action.actionName, + inputArtifacts, + outputArtifacts, + actionTypeId: { + category: action.category.toString(), + version: action.version, + owner: action.owner, + provider: action.provider, + }, + configuration: action.configuration, + runOrder: action.runOrder, + roleArn: action.role ? action.role.roleArn : undefined, + region: action.region, + namespace: action.namespace, + }; + } + + private renderArtifacts(artifacts: Artifact[]): CfnPipeline.InputArtifactProperty[] { + return artifacts + .filter(a => a.artifactName) + .map(a => ({ name: a.artifactName! })); + } +} + +function sanitizeArtifactName(artifactName: string): string { + // strip out some characters that are legal in Stage and Action names, + // but not in Artifact names + return artifactName.replace(/[@.]/g, ''); +} + +function findUniqueConstructId(scope: Construct, prefix: string) { + let current = prefix; + let ctr = 1; + while (Node.of(scope).tryFindChild(current) !== undefined) { + current = `${prefix}${++ctr}`; + } + return current; +} diff --git a/packages/aws-cdk-lib/aws-codepipeline/lib/private/validation.ts b/packages/aws-cdk-lib/aws-codepipeline/lib/private/validation.ts new file mode 100644 index 0000000000000..bd66ee8e06a7f --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/lib/private/validation.ts @@ -0,0 +1,70 @@ +import * as cdk from '../../../core'; +import { ActionCategory } from '../action'; +import { Artifact } from '../artifact'; + +/** + * Validation function that checks if the number of artifacts is within the given bounds + */ +export function validateArtifactBounds( + type: string, artifacts: Artifact[], + min: number, max: number, + category: string, provider: string): string[] { + const ret: string[] = []; + + if (artifacts.length < min) { + ret.push(`${category}/${provider} must have at least ${min} ${type} artifacts`); + } + + if (artifacts.length > max) { + ret.push(`${category}/${provider} cannot have more than ${max} ${type} artifacts`); + } + + return ret; +} + +/** + * Validation function that guarantees that an action is or is not a source action. This is useful because Source actions can only be + * in the first stage of a pipeline, and the first stage can only contain source actions. + */ +export function validateSourceAction(mustBeSource: boolean, category: string, actionName: string, stageName: string): string[] { + if (mustBeSource !== (category === ActionCategory.SOURCE)) { + return [`Action ${actionName} in stage ${stageName}: ` + (mustBeSource ? 'first stage may only contain Source actions' + : 'Source actions may only occur in first stage')]; + } + return []; +} + +/** + * Regex to validate Pipeline, Stage, Action names + * + * https://docs.aws.amazon.com/codepipeline/latest/userguide/limits.html + */ +const VALID_IDENTIFIER_REGEX = /^[a-zA-Z0-9.@_-]{1,100}$/; + +/** + * Validate the given name of a pipeline component. Pipeline component names all have the same restrictions. + * This can be used to validate the name of all components of a pipeline. + */ +export function validateName(thing: string, name: string | undefined): void { + validateAgainstRegex(VALID_IDENTIFIER_REGEX, thing, name); +} + +export function validateArtifactName(artifactName: string | undefined): void { + // https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_Artifact.html#CodePipeline-Type-Artifact-name + validateAgainstRegex(/^[a-zA-Z0-9_-]{1,100}$/, 'Artifact', artifactName); +} + +export function validateNamespaceName(namespaceName: string | undefined): void { + validateAgainstRegex(/^[A-Za-z0-9@_-]{1,100}$/, 'Namespace', namespaceName); +} + +function validateAgainstRegex(regex: RegExp, thing: string, name: string | undefined) { + // name could be a Token - in that case, skip validation altogether + if (cdk.Token.isUnresolved(name)) { + return; + } + + if (name !== undefined && !regex.test(name)) { + throw new Error(`${thing} name must match regular expression: ${regex.toString()}, got '${name}'`); + } +} diff --git a/packages/@aws-cdk/aws-codepipeline/test/action.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/action.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/test/action.test.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/action.test.ts index c3d8862421446..090798822b250 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/action.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/action.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; import * as codepipeline from '../lib'; diff --git a/packages/@aws-cdk/aws-codepipeline/test/artifacts.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/artifacts.test.ts similarity index 99% rename from packages/@aws-cdk/aws-codepipeline/test/artifacts.test.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/artifacts.test.ts index 87b36a207aa22..81c6acb4d60da 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/artifacts.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/artifacts.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import { IConstruct } from 'constructs'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; diff --git a/packages/@aws-cdk/aws-codepipeline/test/cross-env.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/cross-env.test.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline/test/cross-env.test.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/cross-env.test.ts index 4945c06850f34..543e0ee99a7fa 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/cross-env.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/cross-env.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack, App, Stage as CdkStage } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import { Stack, App, Stage as CdkStage } from '../../core'; import { Construct } from 'constructs'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; diff --git a/packages/@aws-cdk/aws-codepipeline/test/fake-build-action.ts b/packages/aws-cdk-lib/aws-codepipeline/test/fake-build-action.ts similarity index 93% rename from packages/@aws-cdk/aws-codepipeline/test/fake-build-action.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/fake-build-action.ts index 9f2d41b7d5252..ab0d3c53bc1d7 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/fake-build-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/fake-build-action.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { IResource } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { IResource } from '../../core'; import { Construct } from 'constructs'; import * as codepipeline from '../lib'; diff --git a/packages/@aws-cdk/aws-codepipeline/test/fake-source-action.ts b/packages/aws-cdk-lib/aws-codepipeline/test/fake-source-action.ts similarity index 97% rename from packages/@aws-cdk/aws-codepipeline/test/fake-source-action.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/fake-source-action.ts index 13e4a21b0e77e..fc29e49448c4e 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/fake-source-action.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/fake-source-action.ts @@ -1,4 +1,4 @@ -import { Lazy } from '@aws-cdk/core'; +import { Lazy } from '../../core'; import { Construct } from 'constructs'; import * as codepipeline from '../lib'; diff --git a/packages/@aws-cdk/aws-codepipeline/test/general-validation.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/general-validation.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/test/general-validation.test.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/general-validation.test.ts index 90a6a36a87662..a54fd65215f53 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/general-validation.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/general-validation.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { FakeSourceAction } from './fake-source-action'; import { IStage } from '../lib/action'; import { Artifact } from '../lib/artifact'; diff --git a/packages/aws-cdk-lib/aws-codepipeline/test/notification-rule.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/notification-rule.test.ts new file mode 100644 index 0000000000000..3150967ef0e6f --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/test/notification-rule.test.ts @@ -0,0 +1,189 @@ +import { Template } from '../../assertions'; +import * as cdk from '../../core'; +import { FakeBuildAction } from './fake-build-action'; +import { FakeSourceAction } from './fake-source-action'; +import * as codepipeline from '../lib'; + +describe('pipeline with codestar notification integration', () => { + let stack: cdk.Stack; + let pipeline: codepipeline.Pipeline; + let sourceArtifact: codepipeline.Artifact; + beforeEach(() => { + stack = new cdk.Stack(); + sourceArtifact = new codepipeline.Artifact(); + pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ actionName: 'Fetch', output: sourceArtifact })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ actionName: 'Gcc', input: sourceArtifact })], + }, + ], + }); + }); + + test('On "Pipeline" execution events emitted notification rule', () => { + const target = { + bindAsNotificationRuleTarget: () => ({ + targetType: 'AWSChatbotSlack', + targetAddress: 'SlackID', + }), + }; + + pipeline.notifyOnExecutionStateChange('NotifyOnExecutionStateChange', target); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'PipelineNotifyOnExecutionStateChange9FE60973', + DetailType: 'FULL', + EventTypeIds: [ + 'codepipeline-pipeline-pipeline-execution-failed', + 'codepipeline-pipeline-pipeline-execution-canceled', + 'codepipeline-pipeline-pipeline-execution-started', + 'codepipeline-pipeline-pipeline-execution-resumed', + 'codepipeline-pipeline-pipeline-execution-succeeded', + 'codepipeline-pipeline-pipeline-execution-superseded', + ], + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':codepipeline:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'PipelineC660917D' }, + ]], + }, + Targets: [ + { + TargetAddress: 'SlackID', + TargetType: 'AWSChatbotSlack', + }, + ], + }); + }); + + test('On any "Stage" execution events emitted notification rule in pipeline', () => { + const target = { + bindAsNotificationRuleTarget: () => ({ + targetType: 'AWSChatbotSlack', + targetAddress: 'SlackID', + }), + }; + + pipeline.notifyOnAnyStageStateChange('NotifyOnAnyStageStateChange', target); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'PipelineNotifyOnAnyStageStateChange05355CCD', + DetailType: 'FULL', + EventTypeIds: [ + 'codepipeline-pipeline-stage-execution-canceled', + 'codepipeline-pipeline-stage-execution-failed', + 'codepipeline-pipeline-stage-execution-resumed', + 'codepipeline-pipeline-stage-execution-started', + 'codepipeline-pipeline-stage-execution-succeeded', + ], + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':codepipeline:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'PipelineC660917D' }, + ]], + }, + Targets: [ + { + TargetAddress: 'SlackID', + TargetType: 'AWSChatbotSlack', + }, + ], + }); + }); + + test('On any "Action" execution events emitted notification rule in pipeline', () => { + const target = { + bindAsNotificationRuleTarget: () => ({ + targetType: 'AWSChatbotSlack', + targetAddress: 'SlackID', + }), + }; + + pipeline.notifyOnAnyActionStateChange('NotifyOnAnyActionStateChange', target); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'PipelineNotifyOnAnyActionStateChange64D5B2AA', + DetailType: 'FULL', + EventTypeIds: [ + 'codepipeline-pipeline-action-execution-canceled', + 'codepipeline-pipeline-action-execution-failed', + 'codepipeline-pipeline-action-execution-started', + 'codepipeline-pipeline-action-execution-succeeded', + ], + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':codepipeline:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'PipelineC660917D' }, + ]], + }, + Targets: [ + { + TargetAddress: 'SlackID', + TargetType: 'AWSChatbotSlack', + }, + ], + }); + }); + + test('On any "Manual approval" execution events emitted notification rule in pipeline', () => { + const target = { + bindAsNotificationRuleTarget: () => ({ + targetType: 'AWSChatbotSlack', + targetAddress: 'SlackID', + }), + }; + + pipeline.notifyOnAnyManualApprovalStateChange('NotifyOnAnyManualApprovalStateChange', target); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'PipelineNotifyOnAnyManualApprovalStateChangeE60778F7', + DetailType: 'FULL', + EventTypeIds: [ + 'codepipeline-pipeline-manual-approval-failed', + 'codepipeline-pipeline-manual-approval-needed', + 'codepipeline-pipeline-manual-approval-succeeded', + ], + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':codepipeline:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':', + { Ref: 'PipelineC660917D' }, + ]], + }, + Targets: [ + { + TargetAddress: 'SlackID', + TargetType: 'AWSChatbotSlack', + }, + ], + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-codepipeline/test/pipeline.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/pipeline.test.ts new file mode 100644 index 0000000000000..b7a7b9ce68102 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codepipeline/test/pipeline.test.ts @@ -0,0 +1,899 @@ +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { FakeBuildAction } from './fake-build-action'; +import { FakeSourceAction } from './fake-source-action'; +import * as codepipeline from '../lib'; + +/* eslint-disable quote-props */ + +describe('', () => { + describe('Pipeline', () => { + test('can be passed an IAM role during pipeline creation', () => { + const stack = new cdk.Stack(); + const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('codepipeline.amazonaws.com'), + }); + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + role, + }); + + // Adding 2 stages with actions so pipeline validation will pass + const sourceArtifact = new codepipeline.Artifact(); + pipeline.addStage({ + stageName: 'Source', + actions: [new FakeSourceAction({ + actionName: 'FakeSource', + output: sourceArtifact, + })], + }); + + pipeline.addStage({ + stageName: 'Build', + actions: [new FakeBuildAction({ + actionName: 'FakeBuild', + input: sourceArtifact, + })], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'RoleArn': { + 'Fn::GetAtt': [ + 'Role1ABCC5F0', + 'Arn', + ], + }, + }); + }); + + test('can be imported by ARN', () => { + const stack = new cdk.Stack(); + + const pipeline = codepipeline.Pipeline.fromPipelineArn(stack, 'Pipeline', + 'arn:aws:codepipeline:us-east-1:123456789012:MyPipeline'); + + expect(pipeline.pipelineArn).toEqual('arn:aws:codepipeline:us-east-1:123456789012:MyPipeline'); + expect(pipeline.pipelineName).toEqual('MyPipeline'); + }); + + describe('that is cross-region', () => { + test('validates that source actions are in the same region as the pipeline', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'PipelineStack', { env: { region: 'us-west-1', account: '123456789012' } }); + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline'); + const sourceStage = pipeline.addStage({ + stageName: 'Source', + }); + const sourceAction = new FakeSourceAction({ + actionName: 'FakeSource', + output: new codepipeline.Artifact(), + region: 'ap-southeast-1', + }); + + expect(() => { + sourceStage.addAction(sourceAction); + }).toThrow(/Source action 'FakeSource' must be in the same region as the pipeline/); + }); + + test('allows passing an Alias in place of the KMS Key in the replication Bucket', () => { + const app = new cdk.App(); + + const replicationRegion = 'us-west-1'; + const replicationStack = new cdk.Stack(app, 'ReplicationStack', { + env: { region: replicationRegion, account: '123456789012' }, + }); + const replicationKey = new kms.Key(replicationStack, 'ReplicationKey'); + const replicationAlias = replicationKey.addAlias('alias/my-replication-alias'); + const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { + encryptionKey: replicationAlias, + bucketName: cdk.PhysicalName.GENERATE_IF_NEEDED, + }); + + const pipelineRegion = 'us-west-2'; + const pipelineStack = new cdk.Stack(app, 'PipelineStack', { + env: { region: pipelineRegion, account: '123456789012' }, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + crossRegionReplicationBuckets: { + [replicationRegion]: replicationBucket, + }, + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ + actionName: 'Source', + output: sourceOutput, + })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ + actionName: 'Build', + input: sourceOutput, + region: replicationRegion, + })], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStores': [ + { + 'Region': replicationRegion, + 'ArtifactStore': { + 'Type': 'S3', + 'EncryptionKey': { + 'Type': 'KMS', + 'Id': { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':kms:us-west-1:123456789012:alias/my-replication-alias', + ], + ], + }, + }, + }, + }, + { + 'Region': pipelineRegion, + }, + ], + }); + + Template.fromStack(replicationStack).hasResourceProperties('AWS::KMS::Key', { + 'KeyPolicy': { + 'Statement': [ + { + // owning account management permissions - we don't care about them in this test + }, + { + // KMS verifies whether the principal given in its key policy exists when creating that key. + // Since the replication bucket must be deployed before the pipeline, + // we cannot put the pipeline role as the principal here - + // hence, we put the account itself + 'Action': [ + 'kms:Decrypt', + 'kms:DescribeKey', + 'kms:Encrypt', + 'kms:ReEncrypt*', + 'kms:GenerateDataKey*', + ], + 'Effect': 'Allow', + 'Principal': { + 'AWS': { + 'Fn::Join': ['', [ + 'arn:', + { 'Ref': 'AWS::Partition' }, + ':iam::123456789012:root', + ]], + }, + }, + 'Resource': '*', + }, + ], + }, + }); + }); + + test('generates ArtifactStores with the alias ARN as the KeyID', () => { + const app = new cdk.App(); + const replicationRegion = 'us-west-1'; + + const pipelineRegion = 'us-west-2'; + const pipelineStack = new cdk.Stack(app, 'MyStack', { + env: { region: pipelineRegion, account: '123456789012' }, + }); + const sourceOutput = new codepipeline.Artifact(); + const pipeline = new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ + actionName: 'Source', + output: sourceOutput, + })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ + actionName: 'Build', + input: sourceOutput, + region: replicationRegion, + })], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStores': [ + { + 'Region': replicationRegion, + 'ArtifactStore': { + 'Type': 'S3', + 'EncryptionKey': { + 'Type': 'KMS', + 'Id': { + 'Fn::Join': [ + '', + [ + 'arn:', + { + 'Ref': 'AWS::Partition', + }, + ':kms:us-west-1:123456789012:alias/s-west-1tencryptionalias9b344b2b8e6825cb1f7d', + ], + ], + }, + }, + }, + }, + { + 'Region': pipelineRegion, + }, + ], + }); + + Template.fromStack(pipeline.crossRegionSupport[replicationRegion].stack).hasResource('AWS::KMS::Alias', { + 'DeletionPolicy': 'Delete', + 'UpdateReplacePolicy': 'Delete', + }); + }); + + test('allows passing an imported Bucket and Key for the replication Bucket', () => { + const replicationRegion = 'us-west-1'; + + const pipelineRegion = 'us-west-2'; + const pipelineStack = new cdk.Stack(undefined, undefined, { + env: { region: pipelineRegion }, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + crossRegionReplicationBuckets: { + [replicationRegion]: s3.Bucket.fromBucketAttributes(pipelineStack, 'ReplicationBucket', { + bucketArn: 'arn:aws:s3:::my-us-west-1-replication-bucket', + encryptionKey: kms.Key.fromKeyArn(pipelineStack, 'ReplicationKey', + `arn:aws:kms:${replicationRegion}:123456789012:key/1234-5678-9012`, + ), + }), + }, + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ + actionName: 'Source', + output: sourceOutput, + })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ + actionName: 'Build', + input: sourceOutput, + })], + }, + ], + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + 'ArtifactStores': [ + { + 'Region': replicationRegion, + 'ArtifactStore': { + 'Type': 'S3', + 'Location': 'my-us-west-1-replication-bucket', + 'EncryptionKey': { + 'Type': 'KMS', + 'Id': 'arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012', + }, + }, + }, + { + 'Region': pipelineRegion, + }, + ], + }); + }); + + test('generates the support stack containing the replication Bucket without the need to bootstrap in that environment', () => { + const app = new cdk.App({ + treeMetadata: false, // we can't set the context otherwise, because App will have a child + }); + app.node.setContext(cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT, true); + + const pipelineStack = new cdk.Stack(app, 'PipelineStack', { + env: { region: 'us-west-2', account: '123456789012' }, + }); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(pipelineStack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ + actionName: 'Source', + output: sourceOutput, + })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ + actionName: 'Build', + input: sourceOutput, + region: 'eu-south-1', + })], + }, + ], + }); + + const assembly = app.synth(); + const supportStackArtifact = assembly.getStackByName('PipelineStack-support-eu-south-1'); + expect(supportStackArtifact.assumeRoleArn).toEqual( + 'arn:${AWS::Partition}:iam::123456789012:role/cdk-hnb659fds-deploy-role-123456789012-us-west-2'); + expect(supportStackArtifact.cloudFormationExecutionRoleArn).toEqual( + 'arn:${AWS::Partition}:iam::123456789012:role/cdk-hnb659fds-cfn-exec-role-123456789012-us-west-2'); + + }); + + test('generates the same support stack containing the replication Bucket without the need to bootstrap in that environment for multiple pipelines', () => { + const app = new cdk.App(); + + new ReusePipelineStack(app, 'PipelineStackA', { + env: { region: 'us-west-2', account: '123456789012' }, + }); + new ReusePipelineStack(app, 'PipelineStackB', { + env: { region: 'us-west-2', account: '123456789012' }, + }); + + const assembly = app.synth(); + // 2 Pipeline Stacks and 1 support stack for both pipeline stacks. + expect(assembly.stacks.length).toEqual(3); + assembly.getStackByName('PipelineStackA-support-eu-south-1'); + expect(() => { + assembly.getStackByName('PipelineStackB-support-eu-south-1'); + }).toThrowError(/Unable to find stack with stack name/); + + }); + + test('generates the unique support stack containing the replication Bucket without the need to bootstrap in that environment for multiple pipelines', () => { + const app = new cdk.App(); + + new ReusePipelineStack(app, 'PipelineStackA', { + env: { region: 'us-west-2', account: '123456789012' }, + reuseCrossRegionSupportStacks: false, + }); + new ReusePipelineStack(app, 'PipelineStackB', { + env: { region: 'us-west-2', account: '123456789012' }, + reuseCrossRegionSupportStacks: false, + }); + + const assembly = app.synth(); + // 2 Pipeline Stacks and 1 support stack for each pipeline stack. + expect(assembly.stacks.length).toEqual(4); + const supportStackAArtifact = assembly.getStackByName('PipelineStackA-support-eu-south-1'); + const supportStackBArtifact = assembly.getStackByName('PipelineStackB-support-eu-south-1'); + + const supportStackATemplate = supportStackAArtifact.template; + Template.fromJSON(supportStackATemplate).hasResourceProperties('AWS::S3::Bucket', { + BucketName: 'pipelinestacka-support-eueplicationbucket8934e91f26961aa6cbfa', + }); + Template.fromJSON(supportStackATemplate).hasResourceProperties('AWS::KMS::Alias', { + AliasName: 'alias/pport-eutencryptionalias02f1cda3732942f6c529', + }); + + const supportStackBTemplate = supportStackBArtifact.template; + Template.fromJSON(supportStackBTemplate).hasResourceProperties('AWS::S3::Bucket', { + BucketName: 'pipelinestackb-support-eueplicationbucketdf7c0e10245faa377228', + }); + Template.fromJSON(supportStackBTemplate).hasResourceProperties('AWS::KMS::Alias', { + AliasName: 'alias/pport-eutencryptionaliasdef3fd3fec63bc54980e', + }); + }); + }); + + describe('that is cross-account', () => { + test('does not allow passing a dynamic value in the Action account property', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'PipelineStack', { env: { account: '123456789012' } }); + const sourceOutput = new codepipeline.Artifact(); + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ actionName: 'Source', output: sourceOutput })], + }, + ], + }); + const buildStage = pipeline.addStage({ stageName: 'Build' }); + + expect(() => { + buildStage.addAction(new FakeBuildAction({ + actionName: 'FakeBuild', + input: sourceOutput, + account: cdk.Aws.ACCOUNT_ID, + })); + }).toThrow(/The 'account' property must be a concrete value \(action: 'FakeBuild'\)/); + }); + + test('does not allow an env-agnostic Pipeline Stack if an Action account has been provided', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'PipelineStack'); + const sourceOutput = new codepipeline.Artifact(); + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ actionName: 'Source', output: sourceOutput })], + }, + ], + }); + const buildStage = pipeline.addStage({ stageName: 'Build' }); + + expect(() => { + buildStage.addAction(new FakeBuildAction({ + actionName: 'FakeBuild', + input: sourceOutput, + account: '123456789012', + })); + }).toThrow(/Pipeline stack which uses cross-environment actions must have an explicitly set account/); + }); + + test('does not allow enabling key rotation if cross account keys have been disabled', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'PipelineStack'); + + expect(() => { + new codepipeline.Pipeline(stack, 'Pipeline', { + crossAccountKeys: false, + enableKeyRotation: true, + }); + }).toThrow("Setting 'enableKeyRotation' to true also requires 'crossAccountKeys' to be enabled"); + }); + + test("enabling key rotation sets 'EnableKeyRotation' to 'true' in the main generated KMS key", () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'PipelineStack'); + const sourceOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(stack, 'Pipeline', { + enableKeyRotation: true, + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ actionName: 'Source', output: sourceOutput })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ actionName: 'Build', input: sourceOutput })], + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', { + 'EnableKeyRotation': true, + }); + }); + }); + }); + + describe('cross account key alias name tests', () => { + const kmsAliasResource = 'AWS::KMS::Alias'; + + test('cross account key alias is named with stack name instead of ID when feature flag is enabled', () => { + const stack = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name', + stackId: 'PipelineStack', + }); + + Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-name-pipeline-0a412eb5', + }); + }); + + test('cross account key alias is named with stack ID when feature flag is not enabled', () => { + const stack = createPipelineStack({ + suffix: 'Name', + stackId: 'PipelineStack', + }); + + Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-pipelinestackpipeline9db740af', + }); + }); + + test('cross account key alias is named with generated stack name when stack name is undefined and feature flag is enabled', () => { + const stack = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name', + stackId: 'PipelineStack', + undefinedStackName: true, + }); + + Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-pipelinestack-pipeline-9db740af', + }); + }); + + test('cross account key alias is named with stack ID when stack name is not present and feature flag is not enabled', () => { + const stack = createPipelineStack({ + suffix: 'Name', + stackId: 'PipelineStack', + undefinedStackName: true, + }); + + Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-pipelinestackpipeline9db740af', + }); + }); + + test('cross account key alias is named with stack name and nested stack ID when feature flag is enabled', () => { + const stack = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name', + stackId: 'TopLevelStack', + nestedStackId: 'NestedPipelineStack', + pipelineId: 'ActualPipeline', + }); + + Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-name-nestedpipelinestack-actualpipeline-23a98110', + }); + }); + + test('cross account key alias is named with stack ID and nested stack ID when stack name is present and feature flag is not enabled', () => { + const stack = createPipelineStack({ + suffix: 'Name', + stackId: 'TopLevelStack', + nestedStackId: 'NestedPipelineStack', + pipelineId: 'ActualPipeline', + }); + + Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-toplevelstacknestedpipelinestackactualpipeline3161a537', + }); + }); + + test('cross account key alias is named with generated stack name and nested stack ID when stack name is undefined and feature flag is enabled', () => { + const stack = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name', + stackId: 'TopLevelStack', + nestedStackId: 'NestedPipelineStack', + pipelineId: 'ActualPipeline', + undefinedStackName: true, + }); + + Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-toplevelstack-nestedpipelinestack-actualpipeline-3161a537', + }); + }); + + test('cross account key alias is named with stack ID and nested stack ID when stack name is not present and feature flag is not enabled', () => { + const stack = createPipelineStack({ + suffix: 'Name', + stackId: 'TopLevelStack', + nestedStackId: 'NestedPipelineStack', + pipelineId: 'ActualPipeline', + undefinedStackName: true, + }); + + Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-toplevelstacknestedpipelinestackactualpipeline3161a537', + }); + }); + + test('cross account key alias is properly shortened to 256 characters when stack name is too long and feature flag is enabled', () => { + const stack = createPipelineStack({ + withFeatureFlag: true, + suffix: 'NeedsToBeShortenedDueToTheLengthOfThisAbsurdNameThatNoOneShouldUseButItStillMightHappenSoWeMustTestForTheTestCase', + stackId: 'too-long', + pipelineId: 'ActualPipelineWithExtraSuperLongNameThatWillNeedToBeShortenedDueToTheAlsoVerySuperExtraLongNameOfTheStack-AlsoWithSomeDifferentCharactersAddedToTheEnd', + }); + + Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-needstobeshortenedduetothelengthofthisabsurdnamethatnooneshouldusebutitstillmighthappensowemusttestfohatwillneedtobeshortenedduetothealsoverysuperextralongnameofthestack-alsowithsomedifferentcharactersaddedtotheend-384b9343', + }); + }); + + test('cross account key alias is properly shortened to 256 characters when stack name is too long and feature flag is not enabled', () => { + const stack = createPipelineStack({ + suffix: 'too-long', + stackId: 'NeedsToBeShortenedDueToTheLengthOfThisAbsurdNameThatNoOneShouldUseButItStillMightHappenSoWeMustTestForTheTestCase', + pipelineId: 'ActualPipelineWithExtraSuperLongNameThatWillNeedToBeShortenedDueToTheAlsoVerySuperExtraLongNameOfTheStack-AlsoWithSomeDifferentCharactersAddedToTheEnd', + }); + + Template.fromStack(stack).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-ortenedduetothelengthofthisabsurdnamethatnooneshouldusebutitstillmighthappensowemusttestforthetestcaseactualpipelinewithextrasuperlongnamethatwillneedtobeshortenedduetothealsoverysuperextralongnameofthestackalsowithsomedifferentc498e0672', + }); + }); + + test('cross account key alias names do not conflict when the stack ID is the same and pipeline ID is the same and feature flag is enabled', () => { + const stack1 = createPipelineStack({ + withFeatureFlag: true, + suffix: '1', + stackId: 'STACK-ID', + }); + + const stack2 = createPipelineStack({ + withFeatureFlag: true, + suffix: '2', + stackId: 'STACK-ID', + }); + + expect(Template.fromStack(stack1).findResources(kmsAliasResource)).not.toEqual(Template.fromStack(stack2).findResources(kmsAliasResource)); + + Template.fromStack(stack1).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-1-pipeline-b09fefee', + }); + + Template.fromStack(stack2).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-2-pipeline-f46258fe', + }); + }); + + test('cross account key alias names do conflict when the stack ID is the same and pipeline ID is the same when feature flag is not enabled', () => { + const stack1 = createPipelineStack({ + suffix: '1', + stackId: 'STACK-ID', + }); + + const stack2 = createPipelineStack({ + suffix: '2', + stackId: 'STACK-ID', + }); + + expect(Template.fromStack(stack1).findResources(kmsAliasResource)).toEqual(Template.fromStack(stack2).findResources(kmsAliasResource)); + + Template.fromStack(stack1).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-stackidpipeline32fb88b3', + }); + + Template.fromStack(stack2).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-stackidpipeline32fb88b3', + }); + }); + + test('cross account key alias names do not conflict for nested stacks when pipeline ID is the same and nested stacks have the same ID when feature flag is enabled', () => { + const stack1 = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name-1', + stackId: 'STACK-ID', + nestedStackId: 'Nested', + pipelineId: 'PIPELINE-ID', + }); + const stack2 = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name-2', + stackId: 'STACK-ID', + nestedStackId: 'Nested', + pipelineId: 'PIPELINE-ID', + }); + + expect(Template.fromStack(stack1.nestedStack!).findResources(kmsAliasResource)) + .not.toEqual(Template.fromStack(stack2.nestedStack!).findResources(kmsAliasResource)); + + Template.fromStack(stack1.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-name-1-nested-pipeline-id-c8c9f252', + }); + + Template.fromStack(stack2.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-name-2-nested-pipeline-id-aff6dd63', + }); + }); + + test('cross account key alias names do conflict for nested stacks when pipeline ID is the same and nested stacks have the same ID when feature flag is not enabled', () => { + const stack1 = createPipelineStack({ + suffix: '1', + stackId: 'STACK-ID', + nestedStackId: 'Nested', + pipelineId: 'PIPELINE-ID', + }); + const stack2 = createPipelineStack({ + suffix: '2', + stackId: 'STACK-ID', + nestedStackId: 'Nested', + pipelineId: 'PIPELINE-ID', + }); + + expect(Template.fromStack(stack1.nestedStack!).findResources(kmsAliasResource)) + .toEqual(Template.fromStack(stack2.nestedStack!).findResources(kmsAliasResource)); + + Template.fromStack(stack1.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-stackidnestedpipelineid3e91360a', + }); + + Template.fromStack(stack2.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-stackidnestedpipelineid3e91360a', + }); + }); + + test('cross account key alias names do not conflict for nested stacks when in the same stack but nested stacks have different IDs when feature flag is enabled', () => { + const stack = createPipelineStack({ + withFeatureFlag: true, + suffix: 'Name-1', + stackId: 'STACK-ID', + nestedStackId: 'First', + pipelineId: 'PIPELINE-ID', + }); + const nestedStack2 = new cdk.NestedStack(stack, 'Second'); + createPipelineWithSourceAndBuildStages(nestedStack2, 'Actual-Pipeline-Name-2', 'PIPELINE-ID'); + + expect(Template.fromStack(stack.nestedStack!).findResources(kmsAliasResource)) + .not.toEqual(Template.fromStack(nestedStack2).findResources(kmsAliasResource)); + + Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-name-1-first-pipeline-id-3c59cb88', + }); + + Template.fromStack(nestedStack2).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-actual-stack-name-1-second-pipeline-id-16143d12', + }); + }); + + test('cross account key alias names do not conflict for nested stacks when in the same stack but nested stacks have different IDs when feature flag is not enabled', () => { + const stack = createPipelineStack({ + suffix: 'Name-1', + stackId: 'STACK-ID', + nestedStackId: 'First', + pipelineId: 'PIPELINE-ID', + }); + const nestedStack2 = new cdk.NestedStack(stack, 'Second'); + createPipelineWithSourceAndBuildStages(nestedStack2, 'Actual-Pipeline-Name-2', 'PIPELINE-ID'); + + expect(Template.fromStack(stack.nestedStack!).findResources(kmsAliasResource)) + .not.toEqual(Template.fromStack(nestedStack2).findResources(kmsAliasResource)); + + Template.fromStack(stack.nestedStack!).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-stackidfirstpipelineid5abca693', + }); + + Template.fromStack(nestedStack2).hasResourceProperties(kmsAliasResource, { + AliasName: 'alias/codepipeline-stackidsecondpipelineid288ce778', + }); + }); + }); +}); + +describe('test with shared setup', () => { + let stack: cdk.Stack; + let sourceArtifact: codepipeline.Artifact; + beforeEach(() => { + stack = new cdk.Stack(); + sourceArtifact = new codepipeline.Artifact(); + }); + + test('can add actions to stages after creation', () => { + // GIVEN + const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ actionName: 'Fetch', output: sourceArtifact })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ actionName: 'Gcc', input: sourceArtifact })], + }, + ], + }); + + // WHEN + pipeline.stage('Build').addAction(new FakeBuildAction({ actionName: 'debug.com', input: sourceArtifact })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: Match.arrayWith([{ + Name: 'Build', + Actions: [ + Match.objectLike({ Name: 'Gcc' }), + Match.objectLike({ Name: 'debug.com' }), + ], + }]), + }); + }); +}); + +interface ReusePipelineStackProps extends cdk.StackProps { + reuseCrossRegionSupportStacks?: boolean; +} + +class ReusePipelineStack extends cdk.Stack { + public constructor(scope: Construct, id: string, props: ReusePipelineStackProps ) { + super(scope, id, props); + const sourceOutput = new codepipeline.Artifact(); + const buildOutput = new codepipeline.Artifact(); + new codepipeline.Pipeline(this, 'Pipeline', { + reuseCrossRegionSupportStacks: props.reuseCrossRegionSupportStacks, + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ + actionName: 'Source', + output: sourceOutput, + })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ + actionName: 'Build', + input: sourceOutput, + region: 'eu-south-1', + output: buildOutput, + })], + }, + { + stageName: 'Deploy', + actions: [new FakeBuildAction({ + actionName: 'Deploy', + input: buildOutput, + region: 'eu-south-1', + })], + }, + ], + }); + } +} + +interface PipelineStackProps extends cdk.StackProps { + readonly nestedStackId?: string; + readonly pipelineName: string; + readonly pipelineId?: string; +} + +class PipelineStack extends cdk.Stack { + nestedStack?: cdk.NestedStack; + pipeline: codepipeline.Pipeline; + + constructor(scope?: Construct, id?: string, props?: PipelineStackProps) { + super (scope, id, props); + + props?.nestedStackId ? this.nestedStack = new cdk.NestedStack(this, props!.nestedStackId!) : undefined; + this.pipeline = createPipelineWithSourceAndBuildStages(this.nestedStack || this, props?.pipelineName, props?.pipelineId); + } +} + +function createPipelineWithSourceAndBuildStages(scope: Construct, pipelineName?: string, pipelineId: string = 'Pipeline') { + const artifact = new codepipeline.Artifact(); + return new codepipeline.Pipeline(scope, pipelineId, { + pipelineName, + crossAccountKeys: true, + reuseCrossRegionSupportStacks: false, + stages: [ + { + stageName: 'Source', + actions: [new FakeSourceAction({ actionName: 'Source', output: artifact })], + }, + { + stageName: 'Build', + actions: [new FakeBuildAction({ actionName: 'Build', input: artifact })], + }, + ], + }); +}; + +interface CreatePipelineStackOptions { + readonly withFeatureFlag?: boolean, + readonly suffix: string, + readonly stackId?: string, + readonly pipelineId?: string, + readonly undefinedStackName?: boolean, + readonly nestedStackId?: string, +} + +function createPipelineStack(options: CreatePipelineStackOptions): PipelineStack { + const context = options.withFeatureFlag ? { context: { [cxapi.CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME]: true } } : undefined; + return new PipelineStack(new cdk.App(context), options.stackId, { + stackName: options.undefinedStackName ? undefined : `Actual-Stack-${options.suffix}`, + nestedStackId: options.nestedStackId, + pipelineName: `Actual-Pipeline-${options.suffix}`.substring(0, 100), + pipelineId: options.pipelineId, + }); +}; diff --git a/packages/@aws-cdk/aws-codepipeline/test/stages.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/stages.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/test/stages.test.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/stages.test.ts index 3400601c9a3fb..59c94547def7e 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/stages.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/stages.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; import * as codepipeline from '../lib'; diff --git a/packages/@aws-cdk/aws-codepipeline/test/variables.test.ts b/packages/aws-cdk-lib/aws-codepipeline/test/variables.test.ts similarity index 98% rename from packages/@aws-cdk/aws-codepipeline/test/variables.test.ts rename to packages/aws-cdk-lib/aws-codepipeline/test/variables.test.ts index 0cbc7899bf003..be33c2cd19187 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/variables.test.ts +++ b/packages/aws-cdk-lib/aws-codepipeline/test/variables.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import { FakeBuildAction } from './fake-build-action'; import { FakeSourceAction } from './fake-source-action'; import * as codepipeline from '../lib'; diff --git a/packages/aws-cdk-lib/aws-codestar/.jsiirc.json b/packages/aws-cdk-lib/aws-codestar/.jsiirc.json new file mode 100644 index 0000000000000..0691f0c9d93ad --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestar/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Codestar" + }, + "java": { + "package": "software.amazon.awscdk.services.codestar" + }, + "python": { + "module": "aws_cdk.aws_codestar" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codestar/README.md b/packages/aws-cdk-lib/aws-codestar/README.md new file mode 100644 index 0000000000000..f66c62e79e9fd --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestar/README.md @@ -0,0 +1,32 @@ +# AWS::CodeStar Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as codestar from 'aws-cdk-lib/aws-codestar'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CodeStar construct libraries](https://constructs.dev/search?q=codestar) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeStar resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeStar.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-codestar-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeStar](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeStar.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-codestar/index.ts b/packages/aws-cdk-lib/aws-codestar/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestar/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codestar/lib/index.ts b/packages/aws-cdk-lib/aws-codestar/lib/index.ts new file mode 100644 index 0000000000000..37aecce5af2dc --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestar/lib/index.ts @@ -0,0 +1 @@ +export * from './codestar.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codestarconnections/.jsiirc.json b/packages/aws-cdk-lib/aws-codestarconnections/.jsiirc.json new file mode 100644 index 0000000000000..1499169d3da23 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarconnections/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeStarConnections" + }, + "java": { + "package": "software.amazon.awscdk.services.codestarconnections" + }, + "python": { + "module": "aws_cdk.aws_codestarconnections" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codestarconnections/README.md b/packages/aws-cdk-lib/aws-codestarconnections/README.md new file mode 100644 index 0000000000000..58bdab2865e18 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarconnections/README.md @@ -0,0 +1,27 @@ +# AWS::CodeStarConnections Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as codestarconnections from 'aws-cdk-lib/aws-codestarconnections'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CodeStarConnections construct libraries](https://constructs.dev/search?q=codestarconnections) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CodeStarConnections resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeStarConnections.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CodeStarConnections](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CodeStarConnections.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-codestarconnections/index.ts b/packages/aws-cdk-lib/aws-codestarconnections/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarconnections/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-codestarconnections/lib/index.ts b/packages/aws-cdk-lib/aws-codestarconnections/lib/index.ts new file mode 100644 index 0000000000000..e5245a5d69330 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarconnections/lib/index.ts @@ -0,0 +1 @@ +export * from './codestarconnections.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-codestarnotifications/.jsiirc.json b/packages/aws-cdk-lib/aws-codestarnotifications/.jsiirc.json new file mode 100644 index 0000000000000..c42e139bd4887 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarnotifications/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CodeStarNotifications" + }, + "java": { + "package": "software.amazon.awscdk.services.codestarnotifications" + }, + "python": { + "module": "aws_cdk.aws_codestarnotifications" + } + } +} diff --git a/packages/aws-cdk-lib/aws-codestarnotifications/README.md b/packages/aws-cdk-lib/aws-codestarnotifications/README.md new file mode 100644 index 0000000000000..0e1def9aefdbc --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarnotifications/README.md @@ -0,0 +1,68 @@ +# AWS CodeStarNotifications Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## NotificationRule + +The `NotificationRule` construct defines an AWS CodeStarNotifications rule. +The rule specifies the events you want notifications about and the targets +(such as Amazon SNS topics or AWS Chatbot clients configured for Slack) +where you want to receive them. +Notification targets are objects that implement the `INotificationRuleTarget` +interface and notification source is object that implement the `INotificationRuleSource` interface. + +## Notification Targets + +This module includes classes that implement the `INotificationRuleTarget` interface for SNS and slack in AWS Chatbot. + +The following targets are supported: + +* `SNS`: specify event and notify to SNS topic. +* `AWS Chatbot`: specify event and notify to slack channel and only support `SlackChannelConfiguration`. + +## Examples + +```ts +import * as notifications from 'aws-cdk-lib/aws-codestarnotifications'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as chatbot from 'aws-cdk-lib/aws-chatbot'; + +const project = new codebuild.PipelineProject(this, 'MyProject'); + +const topic = new sns.Topic(this, 'MyTopic1'); + +const slack = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', { + slackChannelConfigurationName: 'YOUR_CHANNEL_NAME', + slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID', + slackChannelId: 'YOUR_SLACK_CHANNEL_ID', +}); + +const rule = new notifications.NotificationRule(this, 'NotificationRule', { + source: project, + events: [ + 'codebuild-project-build-state-succeeded', + 'codebuild-project-build-state-failed', + ], + targets: [topic], +}); +rule.addTarget(slack); +``` + +## Notification Source + +This module includes classes that implement the `INotificationRuleSource` interface for AWS CodeBuild, +AWS CodePipeline and will support AWS CodeCommit, AWS CodeDeploy in future. + +The following sources are supported: + +* `AWS CodeBuild`: support codebuild project to trigger notification when event specified. +* `AWS CodePipeline`: support codepipeline to trigger notification when event specified. + +## Events + +For the complete list of supported event types for CodeBuild and CodePipeline, see: + +* [Events for notification rules on build projects](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-buildproject). +* [Events for notification rules on pipelines](https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline). diff --git a/packages/aws-cdk-lib/aws-codestarnotifications/index.ts b/packages/aws-cdk-lib/aws-codestarnotifications/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarnotifications/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-codestarnotifications/lib/index.ts b/packages/aws-cdk-lib/aws-codestarnotifications/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-codestarnotifications/lib/index.ts rename to packages/aws-cdk-lib/aws-codestarnotifications/lib/index.ts diff --git a/packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule-source.ts b/packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule-source.ts similarity index 100% rename from packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule-source.ts rename to packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule-source.ts diff --git a/packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule-target.ts b/packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule-target.ts similarity index 100% rename from packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule-target.ts rename to packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule-target.ts diff --git a/packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule.ts b/packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule.ts similarity index 99% rename from packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule.ts rename to packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule.ts index f30cf11f58a99..06dfe9d392263 100644 --- a/packages/@aws-cdk/aws-codestarnotifications/lib/notification-rule.ts +++ b/packages/aws-cdk-lib/aws-codestarnotifications/lib/notification-rule.ts @@ -1,4 +1,4 @@ -import { IResource, Resource, Names } from '@aws-cdk/core'; +import { IResource, Resource, Names } from '../../core'; import * as constructs from 'constructs'; import { CfnNotificationRule } from './codestarnotifications.generated'; import { INotificationRuleSource } from './notification-rule-source'; diff --git a/packages/@aws-cdk/aws-codestarnotifications/test/helpers.ts b/packages/aws-cdk-lib/aws-codestarnotifications/test/helpers.ts similarity index 100% rename from packages/@aws-cdk/aws-codestarnotifications/test/helpers.ts rename to packages/aws-cdk-lib/aws-codestarnotifications/test/helpers.ts diff --git a/packages/aws-cdk-lib/aws-codestarnotifications/test/notification-rule.test.ts b/packages/aws-cdk-lib/aws-codestarnotifications/test/notification-rule.test.ts new file mode 100644 index 0000000000000..54449ebb91df9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-codestarnotifications/test/notification-rule.test.ts @@ -0,0 +1,239 @@ +import { Template } from '../../assertions'; +import * as cdk from '../../core'; +import { + FakeCodeBuild, + FakeCodePipeline, + FakeCodeCommit, + FakeSlackTarget, + FakeSnsTopicTarget, +} from './helpers'; +import * as notifications from '../lib'; + +describe('NotificationRule', () => { + let stack: cdk.Stack; + + beforeEach(() => { + stack = new cdk.Stack(); + }); + + test('created new notification rule with source', () => { + const project = new FakeCodeBuild(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: project, + events: ['codebuild-project-build-state-succeeded'], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + }); + }); + + test('created new notification rule from repository source', () => { + const repository = new FakeCodeCommit(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: repository, + events: [ + 'codecommit-repository-pull-request-created', + 'codecommit-repository-pull-request-merged', + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Resource: repository.repositoryArn, + EventTypeIds: [ + 'codecommit-repository-pull-request-created', + 'codecommit-repository-pull-request-merged', + ], + }); + }); + + test('created new notification rule with all parameters in constructor props', () => { + const project = new FakeCodeBuild(); + const slack = new FakeSlackTarget(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + notificationRuleName: 'MyNotificationRule', + detailType: notifications.DetailType.FULL, + events: [ + 'codebuild-project-build-state-succeeded', + 'codebuild-project-build-state-failed', + ], + source: project, + targets: [slack], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyNotificationRule', + DetailType: 'FULL', + EventTypeIds: [ + 'codebuild-project-build-state-succeeded', + 'codebuild-project-build-state-failed', + ], + Resource: project.projectArn, + Targets: [ + { + TargetAddress: slack.slackChannelConfigurationArn, + TargetType: 'AWSChatbotSlack', + }, + ], + }); + }); + + test('created new notification rule without name and will generate from the `id`', () => { + const project = new FakeCodeBuild(); + + new notifications.NotificationRule(stack, 'MyNotificationRuleGeneratedFromId', { + source: project, + events: ['codebuild-project-build-state-succeeded'], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyNotificationRuleGeneratedFromId', + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + }); + }); + + test('generating name will cut if id length is over than 64 charts', () => { + const project = new FakeCodeBuild(); + + new notifications.NotificationRule(stack, 'MyNotificationRuleGeneratedFromIdIsToooooooooooooooooooooooooooooLong', { + source: project, + events: ['codebuild-project-build-state-succeeded'], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'ificationRuleGeneratedFromIdIsToooooooooooooooooooooooooooooLong', + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + }); + }); + + test('created new notification rule without detailType', () => { + const project = new FakeCodeBuild(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + notificationRuleName: 'MyNotificationRule', + source: project, + events: ['codebuild-project-build-state-succeeded'], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyNotificationRule', + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + DetailType: 'FULL', + }); + }); + + test('created new notification rule with status DISABLED', () => { + const project = new FakeCodeBuild(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: project, + events: ['codebuild-project-build-state-succeeded'], + enabled: false, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyNotificationRule', + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + Status: 'DISABLED', + }); + }); + + test('created new notification rule with status ENABLED', () => { + const project = new FakeCodeBuild(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: project, + events: ['codebuild-project-build-state-succeeded'], + enabled: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Name: 'MyNotificationRule', + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + Status: 'ENABLED', + }); + }); + + test('notification added targets', () => { + const project = new FakeCodeBuild(); + const topic = new FakeSnsTopicTarget(); + const slack = new FakeSlackTarget(); + + const rule = new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: project, + events: ['codebuild-project-build-state-succeeded'], + }); + + rule.addTarget(slack); + + expect(rule.addTarget(topic)).toEqual(true); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Resource: project.projectArn, + EventTypeIds: ['codebuild-project-build-state-succeeded'], + Targets: [ + { + TargetAddress: slack.slackChannelConfigurationArn, + TargetType: 'AWSChatbotSlack', + }, + { + TargetAddress: topic.topicArn, + TargetType: 'SNS', + }, + ], + }); + }); + + test('will not add if notification added duplicating event', () => { + const pipeline = new FakeCodePipeline(); + + new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: pipeline, + events: [ + 'codepipeline-pipeline-pipeline-execution-succeeded', + 'codepipeline-pipeline-pipeline-execution-failed', + 'codepipeline-pipeline-pipeline-execution-succeeded', + 'codepipeline-pipeline-pipeline-execution-canceled', + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeStarNotifications::NotificationRule', { + Resource: pipeline.pipelineArn, + EventTypeIds: [ + 'codepipeline-pipeline-pipeline-execution-succeeded', + 'codepipeline-pipeline-pipeline-execution-failed', + 'codepipeline-pipeline-pipeline-execution-canceled', + ], + }); + }); +}); + +describe('NotificationRule from imported', () => { + let stack: cdk.Stack; + + beforeEach(() => { + stack = new cdk.Stack(); + }); + + test('from notification rule ARN', () => { + const imported = notifications.NotificationRule.fromNotificationRuleArn(stack, 'MyNotificationRule', + 'arn:aws:codestar-notifications::1234567890:notificationrule/1234567890abcdef'); + expect(imported.notificationRuleArn).toEqual('arn:aws:codestar-notifications::1234567890:notificationrule/1234567890abcdef'); + }); + + test('will not effect and return false when added targets if notification from imported', () => { + const imported = notifications.NotificationRule.fromNotificationRuleArn(stack, 'MyNotificationRule', + 'arn:aws:codestar-notifications::1234567890:notificationrule/1234567890abcdef'); + const slack = new FakeSlackTarget(); + expect(imported.addTarget(slack)).toEqual(false); + }); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-cognito/.jsiirc.json b/packages/aws-cdk-lib/aws-cognito/.jsiirc.json new file mode 100644 index 0000000000000..4d3ed88aa9551 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cognito/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.cognito" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Cognito" + }, + "python": { + "module": "aws_cdk.aws_cognito" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cognito/README.md b/packages/aws-cdk-lib/aws-cognito/README.md new file mode 100644 index 0000000000000..e9680faa72a92 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cognito/README.md @@ -0,0 +1,911 @@ +# Amazon Cognito Construct Library + + +[Amazon Cognito](https://docs.aws.amazon.com/cognito/latest/developerguide/what-is-amazon-cognito.html) provides +authentication, authorization, and user management for your web and mobile apps. Your users can sign in directly with a +user name and password, or through a third party such as Facebook, Amazon, Google or Apple. + +The two main components of Amazon Cognito are [user +pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html) and [identity +pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html). User pools are user directories +that provide sign-up and sign-in options for your app users. Identity pools enable you to grant your users access to +other AWS services. Identity Pool L2 Constructs can be found [here](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cognito-identitypool-alpha-readme.html). + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Table of Contents + +- [User Pools](#user-pools) + - [Sign Up](#sign-up) + - [Sign In](#sign-in) + - [Attributes](#attributes) + - [Security](#security) + - [Multi-factor Authentication](#multi-factor-authentication-mfa) + - [Account Recovery Settings](#account-recovery-settings) + - [Emails](#emails) + - [Device Tracking](#device-tracking) + - [Lambda Triggers](#lambda-triggers) + - [Trigger Permissions](#trigger-permissions) + - [Import](#importing-user-pools) + - [Identity Providers](#identity-providers) + - [App Clients](#app-clients) + - [Resource Servers](#resource-servers) + - [Domains](#domains) + - [Deletion protection](#deletion-protection) + +## User Pools + +User pools allow creating and managing your own directory of users that can sign up and sign in. They enable easy +integration with social identity providers such as Facebook, Google, Amazon, Microsoft Active Directory, etc. through +SAML. + +Using the CDK, a new user pool can be created as part of the stack using the construct's constructor. You may specify +the `userPoolName` to give your own identifier to the user pool. If not, CloudFormation will generate a name. + +```ts +new cognito.UserPool(this, 'myuserpool', { + userPoolName: 'myawesomeapp-userpool', + signInCaseSensitive: false, // case insensitive is preferred in most situations +}); +``` + +By default, usernames and email addresses in user pools are case sensitive, which means `user@example.com` and `User@example.com` +are considered different. In most situations it is preferred to have usernames and email addresses be case insensitive so that +capitalization differences are ignored. As shown above, you can make a user pool case insensitive by setting `signInCaseSensitive` +to `false`. The case sensitivity cannot be changed once a user pool is created. + +The default set up for the user pool is configured such that only administrators will be allowed +to create users. Features such as Multi-factor authentication (MFAs) and Lambda Triggers are not +configured by default. + +Use the `grant()` method to add an IAM policy statement associated with the user pool to an +IAM principal's policy. + +```ts +const userPool = new cognito.UserPool(this, 'myuserpool'); +const role = new iam.Role(this, 'role', { + assumedBy: new iam.ServicePrincipal('foo'), +}); +userPool.grant(role, 'cognito-idp:AdminCreateUser'); +``` + +### Sign Up + +Users can either be signed up by the app's administrators or can sign themselves up. Once a user has signed up, their +account needs to be confirmed. Cognito provides several ways to sign users up and confirm their accounts. Learn more +about [user sign up here](https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html). + +When a user signs up, email and SMS messages are used to verify their account and contact methods. The following code +snippet configures a user pool with properties relevant to these verification messages - + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + selfSignUpEnabled: true, + userVerification: { + emailSubject: 'Verify your email for our awesome app!', + emailBody: 'Thanks for signing up to our awesome app! Your verification code is {####}', + emailStyle: cognito.VerificationEmailStyle.CODE, + smsMessage: 'Thanks for signing up to our awesome app! Your verification code is {####}', + }, +}); +``` + +By default, self sign up is disabled. Learn more about [email and SMS verification messages +here](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-customizations.html). + +Besides users signing themselves up, an administrator of any user pool can sign users up. The user then receives an +invitation to join the user pool. The following code snippet configures a user pool with properties relevant to the +invitation messages - + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + userInvitation: { + emailSubject: 'Invite to join our awesome app!', + emailBody: 'Hello {username}, you have been invited to join our awesome app! Your temporary password is {####}', + smsMessage: 'Hello {username}, your temporary password for our awesome app is {####}', + }, +}); +``` + +All email subjects, bodies and SMS messages for both invitation and verification support Cognito's message templating. +Learn more about [message templates +here](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-message-templates.html). + +### Sign In + +Users registering or signing in into your application can do so with multiple identifiers. There are 4 options +available: + +- `username`: Allow signing in using the one time immutable user name that the user chose at the time of sign up. +- `email`: Allow signing in using the email address that is associated with the account. +- `phone`: Allow signing in using the phone number that is associated with the account. +- `preferredUsername`: Allow signing in with an alternate user name that the user can change at any time. However, this + is not available if the `username` option is not chosen. + +The following code sets up a user pool so that the user can sign in with either their username or their email address - + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + // ... + signInAliases: { + username: true, + email: true, + }, +}); +``` + +User pools can either be configured so that user name is primary sign in form, but also allows for the other three to be +used additionally; or it can be configured so that email and/or phone numbers are the only ways a user can register and +sign in. Read more about this +[here](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases-settings). + +⚠️ The Cognito service prevents changing the `signInAlias` property for an existing user pool. + +To match with 'Option 1' in the above link, with a verified email, `signInAliases` should be set to +`{ username: true, email: true }`. To match with 'Option 2' in the above link with both a verified +email and phone number, this property should be set to `{ email: true, phone: true }`. + +Cognito recommends that email and phone number be automatically verified, if they are one of the sign in methods for +the user pool. Read more about that +[here](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases). +The CDK does this by default, when email and/or phone number are specified as part of `signInAliases`. This can be +overridden by specifying the `autoVerify` property. + +The following code snippet sets up only email as a sign in alias, but both email and phone number to be auto-verified. + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + // ... + signInAliases: { username: true, email: true }, + autoVerify: { email: true, phone: true }, +}); +``` + +A user pool can optionally ignore case when evaluating sign-ins. When `signInCaseSensitive` is false, Cognito will not +check the capitalization of the alias when signing in. Default is true. + +### Attributes + +Attributes represent the various properties of each user that's collected and stored in the user pool. Cognito +provides a set of standard attributes that are available for all user pools. Users are allowed to select any of these +standard attributes to be required. Users will not be able to sign up to the user pool without providing the required +attributes. Besides these, additional attributes can be further defined, and are known as custom attributes. + +Learn more on [attributes in Cognito's +documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html). + +The following code configures a user pool with two standard attributes (name and address) as required and mutable, and adds +four custom attributes. + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + standardAttributes: { + fullname: { + required: true, + mutable: false, + }, + address: { + required: false, + mutable: true, + }, + }, + customAttributes: { + 'myappid': new cognito.StringAttribute({ minLen: 5, maxLen: 15, mutable: false }), + 'callingcode': new cognito.NumberAttribute({ min: 1, max: 3, mutable: true }), + 'isEmployee': new cognito.BooleanAttribute({ mutable: true }), + 'joinedOn': new cognito.DateTimeAttribute(), + }, +}); +``` + +As shown in the code snippet, there are data types that are available for custom attributes. The 'String' and 'Number' +data types allow for further constraints on their length and values, respectively. + +Custom attributes cannot be marked as required. + +All custom attributes share the property `mutable` that specifies whether the value of the attribute can be changed. +The default value is `false`. + +User pools come with two 'built-in' attributes - `email_verified` and `phone_number_verified`. These cannot be +configured (required-ness or mutability) as part of user pool creation. However, user pool administrators can modify +them for specific users using the [AdminUpdateUserAttributes API]. + +[AdminUpdateUserAttributes API]: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminUpdateUserAttributes.html + +### Attribute verification + +When your user updates an email address or phone number attribute, Amazon Cognito marks it unverified until they verify the new value. +You can’t send messages to an unverified email address or phone number. +Your user can’t sign in with an unverified alias attribute. +You can choose how Amazon Cognito handles an updated email address or phone number after the update and before the verification. + +Learn more on [configuring email or phone verification in Cognito's documentation.](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html?icmpid=docs_cognito_console_help_panel) + +The following code configures a user pool that keeps the original value for the two standard attributes (email and phone_number) until the new values are verified. + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + signInAliases: { username: true }, + autoVerify: { email: true, phone: true }, + keepOriginal: { + email: true, + phone: true, + }, +}); +``` + + +### Security + +Cognito sends various messages to its users via SMS, for different actions, ranging from account verification to +marketing. In order to send SMS messages, Cognito needs an IAM role that it can assume, with permissions that allow it +to send SMS messages. + +By default, the CDK looks at all of the specified properties (and their defaults when not explicitly specified) and +automatically creates an SMS role, when needed. For example, if MFA second factor by SMS is enabled, the CDK will +create a new role. The `smsRole` property can be used to specify the user supplied role that should be used instead. +Additionally, the property `enableSmsRole` can be used to override the CDK's default behaviour to either enable or +suppress automatic role creation. + +```ts +const poolSmsRole = new iam.Role(this, 'userpoolsmsrole', { + assumedBy: new iam.ServicePrincipal('foo'), +}); + +new cognito.UserPool(this, 'myuserpool', { + // ... + smsRole: poolSmsRole, + smsRoleExternalId: 'c87467be-4f34-11ea-b77f-2e728ce88125', +}); +``` + +When the `smsRole` property is specified, the `smsRoleExternalId` may also be specified. The value of +`smsRoleExternalId` will be used as the `sts:ExternalId` when the Cognito service assumes the role. In turn, the role's +assume role policy should be configured to accept this value as the ExternalId. Learn more about [ExternalId +here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html). + +#### Multi-factor Authentication (MFA) + +User pools can be configured to enable multi-factor authentication (MFA). It can either be turned off, set to optional +or made required. Setting MFA to optional means that individual users can choose to enable it. +Additionally, the MFA code can be sent either via SMS text message or via a time-based software token. +See the [documentation on MFA](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa.html) to +learn more. + +The following code snippet marks MFA for the user pool as required. This means that all users are required to +configure an MFA token and use it for sign in. It also allows for the users to use both SMS based MFA, as well, +[time-based one time password +(TOTP)](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-mfa-totp.html). + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + mfa: cognito.Mfa.REQUIRED, + mfaSecondFactor: { + sms: true, + otp: true, + }, +}); +``` + +User pools can be configured with policies around a user's password. This includes the password length and the +character sets that they must contain. + +Further to this, it can also be configured with the validity of the auto-generated temporary password. A temporary +password is generated by the user pool either when an admin signs up a user or when a password reset is requested. +The validity of this password dictates how long to give the user to use this password before expiring it. + +The following code snippet configures these properties - + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + passwordPolicy: { + minLength: 12, + requireLowercase: true, + requireUppercase: true, + requireDigits: true, + requireSymbols: true, + tempPasswordValidity: Duration.days(3), + }, +}); +``` + +Note that, `tempPasswordValidity` can be specified only in whole days. Specifying fractional days would throw an error. + +#### Account Recovery Settings + +User pools can be configured on which method a user should use when recovering the password for their account. This +can either be email and/or SMS. Read more at [Recovering User Accounts](https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-recover-a-user-account.html) + +```ts +new cognito.UserPool(this, 'UserPool', { + // ... + accountRecovery: cognito.AccountRecovery.EMAIL_ONLY, +}) +``` + +The default for account recovery is by phone if available and by email otherwise. +A user will not be allowed to reset their password via phone if they are also using it for MFA. + +#### Advanced Security Mode + +User pools can be configured to use Advanced security. You can turn the user pool advanced security features on, and customize the actions that are taken in response to different risks. Or you can use audit mode to gather metrics on detected risks without taking action. In audit mode, the advanced security features publish metrics to Amazon CloudWatch. See the [documentation on Advanced security](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security.html) to learn more. + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + advancedSecurityMode: cognito.AdvancedSecurityMode.ENFORCED, +}); +``` + +### Emails + +Cognito sends emails to users in the user pool, when particular actions take place, such as welcome emails, invitation +emails, password resets, etc. The address from which these emails are sent can be configured on the user pool. +Read more at [Email settings for User Pools](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-email.html). + +By default, user pools are configured to use Cognito's built in email capability, which will send emails +from `no-reply@verificationemail.com`. If you want to use a custom email address you can configure +Cognito to send emails through Amazon SES, which is detailed below. + +```ts +new cognito.UserPool(this, 'myuserpool', { + email: cognito.UserPoolEmail.withCognito('support@myawesomeapp.com'), +}); +``` + +For typical production environments, the default email limit is below the required delivery volume. +To enable a higher delivery volume, you can configure the UserPool to send emails through Amazon SES. To do +so, follow the steps in the [Cognito Developer Guide](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-email.html#user-pool-email-developer) +to verify an email address, move the account out of the SES sandbox, and grant Cognito email permissions via an +authorization policy. + +Once the SES setup is complete, the UserPool can be configured to use the SES email. + +```ts +new cognito.UserPool(this, 'myuserpool', { + email: cognito.UserPoolEmail.withSES({ + fromEmail: 'noreply@myawesomeapp.com', + fromName: 'Awesome App', + replyTo: 'support@myawesomeapp.com', + }), +}); +``` + +Sending emails through SES requires that SES be configured (as described above) in a valid SES region. +If the UserPool is being created in a different region, `sesRegion` must be used to specify the correct SES region. + +```ts +new cognito.UserPool(this, 'myuserpool', { + email: cognito.UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: 'noreply@myawesomeapp.com', + fromName: 'Awesome App', + replyTo: 'support@myawesomeapp.com', + }), +}); + +``` + +When sending emails from an SES verified domain, `sesVerifiedDomain` can be used to specify the domain. +The email address does not need to be verified when sending emails from a verified domain, because the identity of the email configuration is can be determined from the domain alone. + +```ts +new cognito.UserPool(this, 'myuserpool', { + email: cognito.UserPoolEmail.withSES({ + sesRegion: 'us-east-1', + fromEmail: 'noreply@myawesomeapp.com', + fromName: 'Awesome App', + replyTo: 'support@myawesomeapp.com', + sesVerifiedDomain: 'myawesomeapp.com', + }), +}); +``` + +If `fromName` does not comply RFC 5322 atom or quoted-string, it will be quoted or mime-encoded. + +```ts +new cognito.UserPool(this, 'myuserpool', { + email: cognito.UserPoolEmail.withSES({ + fromEmail: 'noreply@myawesomeapp.com', + fromName: 'myname@mycompany.com', + }), +}); +// => From: "myname@mycompany.com" +``` + +### Device Tracking + +User pools can be configured to track devices that users have logged in to. +Read more at [Device Tracking](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-device-tracking.html) + +```ts +new cognito.UserPool(this, 'myuserpool', { + // ... + deviceTracking: { + challengeRequiredOnNewDevice: true, + deviceOnlyRememberedOnUserPrompt: true, + }, +}); +``` + +The default is to not track devices. + +### Lambda Triggers + +User pools can be configured such that AWS Lambda functions can be triggered when certain user operations or actions +occur, such as, sign up, user confirmation, sign in, etc. They can also be used to add custom authentication +challenges, user migrations and custom verification messages. Learn more about triggers at [User Pool Workflows with +Triggers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html). + +Lambda triggers can either be specified as part of the `UserPool` initialization, or it can be added later, via methods +on the construct, as so - + +```ts +const authChallengeFn = new lambda.Function(this, 'authChallengeFn', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'path/to/asset')), +}); + +const userpool = new cognito.UserPool(this, 'myuserpool', { + // ... + lambdaTriggers: { + createAuthChallenge: authChallengeFn, + // ... + }, +}); + +userpool.addTrigger(cognito.UserPoolOperation.USER_MIGRATION, new lambda.Function(this, 'userMigrationFn', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'path/to/asset')), +})); +``` + +The following table lists the set of triggers available, and their corresponding method to add it to the user pool. +For more information on the function of these triggers and how to configure them, read [User Pool Workflows with +Triggers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html). + +#### Trigger Permissions + +The `function.attachToRolePolicy()` API can be used to add additional IAM permissions to the lambda trigger +as necessary. + +⚠️ Using the `attachToRolePolicy` API to provide permissions to your user pool will result in a circular dependency. See [aws/aws-cdk#7016](https://github.com/aws/aws-cdk/issues/7016). +Error message when running `cdk synth` or `cdk deploy`: +> Circular dependency between resources: [pool056F3F7E, fnPostAuthFnCognitoA630A2B1, ...] + +To work around the circular dependency issue, use the `attachInlinePolicy()` API instead, as shown below. + +```ts +declare const postAuthFn: lambda.Function; + +const userpool = new cognito.UserPool(this, 'myuserpool', { + lambdaTriggers: { + postAuthentication: postAuthFn, + }, +}); + +// provide permissions to describe the user pool scoped to the ARN the user pool +postAuthFn.role?.attachInlinePolicy(new iam.Policy(this, 'userpool-policy', { + statements: [new iam.PolicyStatement({ + actions: ['cognito-idp:DescribeUserPool'], + resources: [userpool.userPoolArn], + })], +})); +``` + +### Importing User Pools + +Any user pool that has been created outside of this stack, can be imported into the CDK app. Importing a user pool +allows for it to be used in other parts of the CDK app that reference an `IUserPool`. However, imported user pools have +limited configurability. As a rule of thumb, none of the properties that are part of the +[`AWS::Cognito::UserPool`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html) +CloudFormation resource can be configured. + +User pools can be imported either using their id via the `UserPool.fromUserPoolId()`, or by using their ARN, via the +`UserPool.fromUserPoolArn()` API. + +```ts +const awesomePool = cognito.UserPool.fromUserPoolId(this, 'awesome-user-pool', 'us-east-1_oiuR12Abd'); + +const otherAwesomePool = cognito.UserPool.fromUserPoolArn(this, 'other-awesome-user-pool', + 'arn:aws:cognito-idp:eu-west-1:123456789012:userpool/us-east-1_mtRyYQ14D'); +``` + +### Identity Providers + +Users that are part of a user pool can sign in either directly through a user pool, or federate through a third-party +identity provider. Once configured, the Cognito backend will take care of integrating with the third-party provider. +Read more about [Adding User Pool Sign-in Through a Third +Party](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-identity-federation.html). + +The following third-party identity providers are currently supported in the CDK - + +- [Login With Amazon](https://developer.amazon.com/apps-and-games/login-with-amazon) +- [Facebook Login](https://developers.facebook.com/docs/facebook-login/) +- [Google Login](https://developers.google.com/identity/sign-in/web/sign-in) +- [Sign In With Apple](https://developer.apple.com/sign-in-with-apple/get-started/) +- [OpenID Connect](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-oidc-idp.html) +- [SAML](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-saml-idp.html) + +The following code configures a user pool to federate with the third party provider, 'Login with Amazon'. The identity +provider needs to be configured with a set of credentials that the Cognito backend can use to federate with the +third-party identity provider. + +```ts +const userpool = new cognito.UserPool(this, 'Pool'); + +const provider = new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', { + clientId: 'amzn-client-id', + clientSecret: 'amzn-client-secret', + userPool: userpool, +}); +``` + +Using Google identity provider is possible to use clientSecretValue with SecretValue from secrets manager. + +```ts +const userpool = new cognito.UserPool(this, 'Pool'); +const secret = secretsManager.Secret.fromSecretAttributes(this, "CognitoClientSecret", { + secretCompleteArn: "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx" +}).secretValue + +const provider = new cognito.UserPoolIdentityProviderGoogle(this, 'Google', { + clientId: 'amzn-client-id', + clientSecretValue: secret, + userPool: userpool, +}); +``` + +Attribute mapping allows mapping attributes provided by the third-party identity providers to [standard and custom +attributes](#Attributes) of the user pool. Learn more about [Specifying Identity Provider Attribute Mappings for Your +User Pool](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html). + +The following code shows how different attributes provided by 'Login With Amazon' can be mapped to standard and custom +user pool attributes. + +```ts +const userpool = new cognito.UserPool(this, 'Pool'); + +new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', { + clientId: 'amzn-client-id', + clientSecret: 'amzn-client-secret', + userPool: userpool, + attributeMapping: { + email: cognito.ProviderAttribute.AMAZON_EMAIL, + website: cognito.ProviderAttribute.other('url'), // use other() when an attribute is not pre-defined in the CDK + custom: { + // custom user pool attributes go here + uniqueId: cognito.ProviderAttribute.AMAZON_USER_ID, + }, + }, +}); +``` + +### App Clients + +An app is an entity within a user pool that has permission to call unauthenticated APIs (APIs that do not have an +authenticated user), such as APIs to register, sign in, and handle forgotten passwords. To call these APIs, you need an +app client ID and an optional client secret. Read [Configuring a User Pool App +Client](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html) to learn more. + +The following code creates an app client and retrieves the client id - + +```ts +const pool = new cognito.UserPool(this, 'pool'); +const client = pool.addClient('customer-app-client'); +const clientId = client.userPoolClientId; +``` + +Existing app clients can be imported into the CDK app using the `UserPoolClient.fromUserPoolClientId()` API. For new +and imported user pools, clients can also be created via the `UserPoolClient` constructor, as so - + +```ts +const importedPool = cognito.UserPool.fromUserPoolId(this, 'imported-pool', 'us-east-1_oiuR12Abd'); +new cognito.UserPoolClient(this, 'customer-app-client', { + userPool: importedPool, +}); +``` + +Clients can be configured with authentication flows. Authentication flows allow users on a client to be authenticated +with a user pool. Cognito user pools provide several different types of authentication, such as, SRP (Secure +Remote Password) authentication, username-and-password authentication, etc. Learn more about this at [UserPool Authentication +Flow](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html). + +The following code configures a client to use both SRP and username-and-password authentication - + +```ts +const pool = new cognito.UserPool(this, 'pool'); +pool.addClient('app-client', { + authFlows: { + userPassword: true, + userSrp: true, + }, +}); +``` + +Custom authentication protocols can be configured by setting the `custom` property under `authFlow` and defining lambda +functions for the corresponding user pool [triggers](#lambda-triggers). Learn more at [Custom Authentication +Flow](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#amazon-cognito-user-pools-custom-authentication-flow). + +In addition to these authentication mechanisms, Cognito user pools also support using OAuth 2.0 framework for +authenticating users. User pool clients can be configured with OAuth 2.0 authorization flows and scopes. Learn more +about the [OAuth 2.0 authorization framework](https://tools.ietf.org/html/rfc6749) and [Cognito user pool's +implementation of +OAuth2.0](https://aws.amazon.com/blogs/mobile/understanding-amazon-cognito-user-pool-oauth-2-0-grants/). + +The following code configures an app client with the authorization code grant flow and registers the the app's welcome +page as a callback (or redirect) URL. It also configures the access token scope to 'openid'. All of these concepts can +be found in the [OAuth 2.0 RFC](https://tools.ietf.org/html/rfc6749). + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +pool.addClient('app-client', { + oAuth: { + flows: { + authorizationCodeGrant: true, + }, + scopes: [ cognito.OAuthScope.OPENID ], + callbackUrls: [ 'https://my-app-domain.com/welcome' ], + logoutUrls: [ 'https://my-app-domain.com/signin' ], + }, +}); +``` + +An app client can be configured to prevent user existence errors. This +instructs the Cognito authentication API to return generic authentication +failure responses instead of an UserNotFoundException. By default, the flag +is not set, which means the CloudFormation default (false) will be used. See the +[documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-managing-errors.html) +for the full details on the behavior of this flag. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +pool.addClient('app-client', { + preventUserExistenceErrors: true, +}); +``` + +All identity providers created in the CDK app are automatically registered into the corresponding user pool. All app +clients created in the CDK have all of the identity providers enabled by default. The 'Cognito' identity provider, +that allows users to register and sign in directly with the Cognito user pool, is also enabled by default. +Alternatively, the list of supported identity providers for a client can be explicitly specified - + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +pool.addClient('app-client', { + // ... + supportedIdentityProviders: [ + cognito.UserPoolClientIdentityProvider.AMAZON, + cognito.UserPoolClientIdentityProvider.COGNITO, + ], +}); +``` + +If the identity provider and the app client are created in the same stack, specify the dependency between both constructs to +make sure that the identity provider already exists when the app client will be created. The app client cannot handle the +dependency to the identity provider automatically because the client does not have access to the provider's construct. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +const provider = new cognito.UserPoolIdentityProviderAmazon(this, 'Amazon', { + userPool: pool, + clientId: 'amzn-client-id', + clientSecret: 'amzn-client-secret', +}); + +const client = pool.addClient('app-client', { + // ... + supportedIdentityProviders: [ + cognito.UserPoolClientIdentityProvider.AMAZON, + ], +}); + +client.node.addDependency(provider); +``` + +The property `authSessionValidity` is the session token for each API request in the authentication flow. +Valid duration is from 3 to 15 minutes. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +pool.addClient('app-client', { + // ... + authSessionValidity: Duration.minutes(15), +}); +``` + +In accordance with the OIDC open standard, Cognito user pool clients provide access tokens, ID tokens and refresh tokens. +More information is available at [Using Tokens with User Pools](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html). +The expiration time for these tokens can be configured as shown below. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +pool.addClient('app-client', { + // ... + accessTokenValidity: Duration.minutes(60), + idTokenValidity: Duration.minutes(60), + refreshTokenValidity: Duration.days(30), +}); +``` + +Clients can (and should) be allowed to read and write relevant user attributes only. Usually every client can be allowed to +read the `given_name` attribute but not every client should be allowed to set the `email_verified` attribute. +The same criteria applies for both standard and custom attributes, more info is available at +[Attribute Permissions and Scopes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-attribute-permissions-and-scopes). +The default behaviour is to allow read and write permissions on all attributes. The following code shows how this can be +configured for a client. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); + +const clientWriteAttributes = (new cognito.ClientAttributes()) + .withStandardAttributes({fullname: true, email: true}) + .withCustomAttributes('favouritePizza', 'favouriteBeverage'); + +const clientReadAttributes = clientWriteAttributes + .withStandardAttributes({emailVerified: true}) + .withCustomAttributes('pointsEarned'); + +pool.addClient('app-client', { + // ... + readAttributes: clientReadAttributes, + writeAttributes: clientWriteAttributes, +}); +``` + +[Token revocation](https://docs.aws.amazon.com/cognito/latest/developerguide/token-revocation.html) +can be configured to be able to revoke refresh tokens in app clients. By default, token revocation is enabled for new user +pools. The property can be used to enable the token revocation in existing app clients or to change the default behavior. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); +pool.addClient('app-client', { + // ... + enableTokenRevocation: true, +}); +``` + +User Pool clients can generate a client ID as well as a client secret, to support more advanced authentication workflows. + +To create a client with an autogenerated client secret, pass the `generateSecret: true` prop: + +```ts +const userPoolClient = new cognito.UserPoolClient(this, 'UserPoolClient', { + userPool: importedPool, + generateSecret: true, +}); + +// Allows you to pass the generated secret to other pieces of infrastructure +const secret = userPoolClient.userPoolClientSecret; +``` + +### Resource Servers + +A resource server is a server for access-protected resources. It handles authenticated requests from an app that has an +access token. See [Defining Resource +Servers](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-define-resource-servers.html) +for more information. + +An application may choose to model custom permissions via OAuth. Resource Servers provide this capability via custom scopes +that are attached to an app client. The following example sets up a resource server for the 'users' resource for two different +app clients and configures the clients to use these scopes. + +```ts +const pool = new cognito.UserPool(this, 'Pool'); + +const readOnlyScope = new cognito.ResourceServerScope({ scopeName: 'read', scopeDescription: 'Read-only access' }); +const fullAccessScope = new cognito.ResourceServerScope({ scopeName: '*', scopeDescription: 'Full access' }); + +const userServer = pool.addResourceServer('ResourceServer', { + identifier: 'users', + scopes: [ readOnlyScope, fullAccessScope ], +}); + +const readOnlyClient = pool.addClient('read-only-client', { + // ... + oAuth: { + // ... + scopes: [ cognito.OAuthScope.resourceServer(userServer, readOnlyScope) ], + }, +}); + +const fullAccessClient = pool.addClient('full-access-client', { + // ... + oAuth: { + // ... + scopes: [ cognito.OAuthScope.resourceServer(userServer, fullAccessScope) ], + }, +}); +``` + + +### Domains + +After setting up an [app client](#app-clients), the address for the user pool's sign-up and sign-in webpages can be +configured using domains. There are two ways to set up a domain - either the Amazon Cognito hosted domain can be chosen +with an available domain prefix, or a custom domain name can be chosen. The custom domain must be one that is already +owned, and whose certificate is registered in AWS Certificate Manager. + +The following code sets up a user pool domain in Amazon Cognito hosted domain with the prefix 'my-awesome-app', and +another domain with the custom domain 'user.myapp.com' - + +```ts +const pool = new cognito.UserPool(this, 'Pool'); + +pool.addDomain('CognitoDomain', { + cognitoDomain: { + domainPrefix: 'my-awesome-app', + }, +}); + +const certificateArn = 'arn:aws:acm:us-east-1:123456789012:certificate/11-3336f1-44483d-adc7-9cd375c5169d'; + +const domainCert = certificatemanager.Certificate.fromCertificateArn(this, 'domainCert', certificateArn); +pool.addDomain('CustomDomain', { + customDomain: { + domainName: 'user.myapp.com', + certificate: domainCert, + }, +}); +``` + +Read more about [Using the Amazon Cognito +Domain](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-assign-domain-prefix.html) and [Using Your Own +Domain](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-add-custom-domain.html). + +The `signInUrl()` methods returns the fully qualified URL to the login page for the user pool. This page comes from the +hosted UI configured with Cognito. Learn more at [Hosted UI with the Amazon Cognito +Console](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-integration.html#cognito-user-pools-create-an-app-integration). + +```ts +const userpool = new cognito.UserPool(this, 'UserPool', { + // ... +}); +const client = userpool.addClient('Client', { + // ... + oAuth: { + flows: { + implicitCodeGrant: true, + }, + callbackUrls: [ + 'https://myapp.com/home', + 'https://myapp.com/users', + ], + }, +}); +const domain = userpool.addDomain('Domain', { + // ... +}); +const signInUrl = domain.signInUrl(client, { + redirectUri: 'https://myapp.com/home', // must be a URL configured under 'callbackUrls' with the client +}); +``` + +Existing domains can be imported into CDK apps using `UserPoolDomain.fromDomainName()` API + +```ts +const myUserPoolDomain = cognito.UserPoolDomain.fromDomainName(this, 'my-user-pool-domain', 'domain-name'); +``` + +### Deletion protection + +Deletion protection can be enabled on a user pool to prevent accidental deletion: + +```ts +const userpool = new cognito.UserPool(this, 'UserPool', { + // ... + deletionProtection: true, +}); +``` + +By default deletion protection is disabled. diff --git a/packages/aws-cdk-lib/aws-cognito/index.ts b/packages/aws-cdk-lib/aws-cognito/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cognito/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-cognito/lib/index.ts b/packages/aws-cdk-lib/aws-cognito/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/index.ts rename to packages/aws-cdk-lib/aws-cognito/lib/index.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/private/attr-names.ts b/packages/aws-cdk-lib/aws-cognito/lib/private/attr-names.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/private/attr-names.ts rename to packages/aws-cdk-lib/aws-cognito/lib/private/attr-names.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-attr.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-attr.ts index 50572382325ea..78a6980d391e6 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-attr.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-attr.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; import { StandardAttributeNames } from './private/attr-names'; /** diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-client.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-client.ts index 73517691fa7c7..14dc510bd4315 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-client.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-client.ts @@ -1,5 +1,5 @@ -import { IResource, Resource, Duration, Stack, SecretValue } from '@aws-cdk/core'; -import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '@aws-cdk/custom-resources'; +import { IResource, Resource, Duration, Stack, SecretValue } from '../../core'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '../../custom-resources'; import { Construct } from 'constructs'; import { CfnUserPoolClient } from './cognito.generated'; import { IUserPool } from './user-pool'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-domain.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-domain.ts similarity index 97% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-domain.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-domain.ts index 89244f76d0c1b..2d6961ff337a8 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-domain.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-domain.ts @@ -1,6 +1,6 @@ -import { ICertificate } from '@aws-cdk/aws-certificatemanager'; -import { IResource, Resource, Stack, Token } from '@aws-cdk/core'; -import { AwsCustomResource, AwsCustomResourcePolicy, AwsSdkCall, PhysicalResourceId } from '@aws-cdk/custom-resources'; +import { ICertificate } from '../../aws-certificatemanager'; +import { IResource, Resource, Stack, Token } from '../../core'; +import { AwsCustomResource, AwsCustomResourcePolicy, AwsSdkCall, PhysicalResourceId } from '../../custom-resources'; import { Construct } from 'constructs'; import { CfnUserPoolDomain } from './cognito.generated'; import { IUserPool } from './user-pool'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-email.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-email.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts index d275c4d3a5dd2..4fcb484b19966 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-email.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-email.ts @@ -1,4 +1,4 @@ -import { Stack, Token } from '@aws-cdk/core'; +import { Stack, Token } from '../../core'; import { Construct } from 'constructs'; import { toASCII as punycodeEncode } from 'punycode/'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idp.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idp.ts similarity index 93% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idp.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idp.ts index c569ccd778fd8..a89f961850f4e 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-idp.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idp.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/amazon.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/amazon.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/amazon.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/amazon.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/apple.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/apple.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/apple.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/apple.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/base.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/base.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/base.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/facebook.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/facebook.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/facebook.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/facebook.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/google.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/google.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts index 6bb86f2d32935..94a25d5a700fd 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/google.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts @@ -1,4 +1,4 @@ -import { SecretValue } from '@aws-cdk/core'; +import { SecretValue } from '../../../core'; import { Construct } from 'constructs'; import { UserPoolIdentityProviderProps } from './base'; import { UserPoolIdentityProviderBase } from './private/user-pool-idp-base'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/index.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/index.ts similarity index 100% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/index.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/index.ts diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/oidc.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/oidc.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts index aeda14de8d546..819f5e86fcb7e 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/oidc.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts @@ -1,4 +1,4 @@ -import { Names, Token } from '@aws-cdk/core'; +import { Names, Token } from '../../../core'; import { Construct } from 'constructs'; import { UserPoolIdentityProviderProps } from './base'; import { UserPoolIdentityProviderBase } from './private/user-pool-idp-base'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts similarity index 97% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts index 633972f4b82f3..7fc36a20a6801 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../../../core'; import { Construct } from 'constructs'; import { StandardAttributeNames } from '../../private/attr-names'; import { IUserPoolIdentityProvider } from '../../user-pool-idp'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/saml.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-idps/saml.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts index 7e6724cb47ccd..c9fd3cbb96476 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-idps/saml.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts @@ -1,4 +1,4 @@ -import { Names, Token } from '@aws-cdk/core'; +import { Names, Token } from '../../../core'; import { Construct } from 'constructs'; import { UserPoolIdentityProviderProps } from './base'; import { UserPoolIdentityProviderBase } from './private/user-pool-idp-base'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool-resource-server.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-resource-server.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/lib/user-pool-resource-server.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool-resource-server.ts index d78d61e956587..edbfb8f4208f5 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool-resource-server.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-resource-server.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnUserPoolResourceServer } from './cognito.generated'; import { IUserPool } from './user-pool'; diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/lib/user-pool.ts rename to packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts index 1f2fdd90ac6d9..9976384247313 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts @@ -1,7 +1,7 @@ -import { Grant, IGrantable, IRole, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IKey } from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { ArnFormat, Duration, IResource, Lazy, Names, RemovalPolicy, Resource, Stack, Token } from '@aws-cdk/core'; +import { Grant, IGrantable, IRole, PolicyDocument, PolicyStatement, Role, ServicePrincipal } from '../../aws-iam'; +import { IKey } from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import { ArnFormat, Duration, IResource, Lazy, Names, RemovalPolicy, Resource, Stack, Token } from '../../core'; import { Construct } from 'constructs'; import { toASCII as punycodeEncode } from 'punycode/'; import { CfnUserPool } from './cognito.generated'; diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-attr.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-attr.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/test/user-pool-attr.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-attr.test.ts index 899989267e809..7e97eff16d247 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-attr.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-attr.test.ts @@ -1,4 +1,4 @@ -import { CfnParameter, Stack } from '@aws-cdk/core'; +import { CfnParameter, Stack } from '../../core'; import { BooleanAttribute, CustomAttributeConfig, DateTimeAttribute, ICustomAttribute, NumberAttribute, StringAttribute, ClientAttributes } from '../lib'; import { StandardAttributeNames } from '../lib/private/attr-names'; diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-client.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-client.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/test/user-pool-client.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-client.test.ts index e246e46bf54b3..9f465eead69a9 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-client.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-client.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Stack, Duration } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import { Stack, Duration } from '../../core'; import { OAuthScope, ResourceServerScope, UserPool, UserPoolClient, UserPoolClientIdentityProvider, UserPoolIdentityProvider, ClientAttributes } from '../lib'; describe('User Pool Client', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-domain.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-domain.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/test/user-pool-domain.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-domain.test.ts index ea751c58d4380..109c357576c34 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-domain.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-domain.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import { CfnParameter, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Certificate } from '../../aws-certificatemanager'; +import { CfnParameter, Stack } from '../../core'; import { UserPool, UserPoolDomain } from '../lib'; describe('User Pool Client', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/amazon.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/amazon.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/amazon.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/amazon.test.ts index a905e7da01730..1ecd8818d02e3 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/amazon.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/amazon.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import { Stack } from '../../../core'; import { ProviderAttribute, UserPool, UserPoolIdentityProviderAmazon } from '../../lib'; describe('UserPoolIdentityProvider', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/apple.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts similarity index 97% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/apple.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts index 3787f83b17391..c38e5b16ee73b 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/apple.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/apple.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import { Stack } from '../../../core'; import { ProviderAttribute, UserPool, UserPoolIdentityProviderApple } from '../../lib'; describe('UserPoolIdentityProvider', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/base.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/base.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts index 01d185bf98eef..1d58e96c572da 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/base.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/base.test.ts @@ -1,4 +1,4 @@ -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import { ProviderAttribute, UserPool } from '../../lib'; import { UserPoolIdentityProviderBase } from '../../lib/user-pool-idps/private/user-pool-idp-base'; diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/facebook.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/facebook.test.ts similarity index 97% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/facebook.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/facebook.test.ts index f2ec3bf581bf6..3c89f537d9410 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/facebook.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/facebook.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import { Stack } from '../../../core'; import { ProviderAttribute, UserPool, UserPoolIdentityProviderFacebook } from '../../lib'; describe('UserPoolIdentityProvider', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/google.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/google.test.ts similarity index 96% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/google.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/google.test.ts index 67aa197a9ba9a..1c149a6d5a190 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/google.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/google.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import { SecretValue, Stack } from '../../../core'; import { ProviderAttribute, UserPool, UserPoolIdentityProviderGoogle } from '../../lib'; describe('UserPoolIdentityProvider', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/oidc.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/oidc.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/oidc.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/oidc.test.ts index c28feb073ae13..e3b13cda4e0f7 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/oidc.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/oidc.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import { Stack } from '../../../core'; import { ProviderAttribute, UserPool, UserPoolIdentityProviderOidc } from '../../lib'; describe('UserPoolIdentityProvider', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/saml.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/saml.test.ts similarity index 98% rename from packages/@aws-cdk/aws-cognito/test/user-pool-idps/saml.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/saml.test.ts index 464bd66396ca3..e55fdafe45e14 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-idps/saml.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-idps/saml.test.ts @@ -1,5 +1,5 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import { Stack } from '../../../core'; import { ProviderAttribute, UserPool, UserPoolIdentityProviderSaml, UserPoolIdentityProviderSamlMetadata } from '../../lib'; describe('UserPoolIdentityProvider', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-resource-server.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool-resource-server.test.ts similarity index 95% rename from packages/@aws-cdk/aws-cognito/test/user-pool-resource-server.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool-resource-server.test.ts index f8c3fc9d12d3a..e101a05d249c7 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-resource-server.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool-resource-server.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { UserPool, UserPoolResourceServer } from '../lib'; describe('User Pool Resource Server', () => { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts b/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts similarity index 99% rename from packages/@aws-cdk/aws-cognito/test/user-pool.test.ts rename to packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts index edec04ad26fb5..289032dd0f8e2 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts +++ b/packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Match, Template } from '../../assertions'; +import { Role, ServicePrincipal } from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { CfnParameter, Duration, Stack, Tags } from '@aws-cdk/core'; +import { CfnParameter, Duration, Stack, Tags } from '../../core'; import { Construct } from 'constructs'; import { AccountRecovery, Mfa, NumberAttribute, StringAttribute, UserPool, UserPoolIdentityProvider, UserPoolOperation, VerificationEmailStyle, UserPoolEmail, AdvancedSecurityMode } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-comprehend/.jsiirc.json b/packages/aws-cdk-lib/aws-comprehend/.jsiirc.json new file mode 100644 index 0000000000000..70fe5a15358ff --- /dev/null +++ b/packages/aws-cdk-lib/aws-comprehend/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Comprehend" + }, + "java": { + "package": "software.amazon.awscdk.services.comprehend" + }, + "python": { + "module": "aws_cdk.aws_comprehend" + } + } +} diff --git a/packages/aws-cdk-lib/aws-comprehend/README.md b/packages/aws-cdk-lib/aws-comprehend/README.md new file mode 100644 index 0000000000000..776d96b0cf3ff --- /dev/null +++ b/packages/aws-cdk-lib/aws-comprehend/README.md @@ -0,0 +1,27 @@ +# AWS::Comprehend Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as comprehend from 'aws-cdk-lib/aws-comprehend'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Comprehend construct libraries](https://constructs.dev/search?q=comprehend) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Comprehend resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Comprehend.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Comprehend](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Comprehend.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-comprehend/index.ts b/packages/aws-cdk-lib/aws-comprehend/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-comprehend/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-comprehend/lib/index.ts b/packages/aws-cdk-lib/aws-comprehend/lib/index.ts new file mode 100644 index 0000000000000..8c80ec90c051f --- /dev/null +++ b/packages/aws-cdk-lib/aws-comprehend/lib/index.ts @@ -0,0 +1 @@ +export * from './comprehend.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-config/.jsiirc.json b/packages/aws-cdk-lib/aws-config/.jsiirc.json new file mode 100644 index 0000000000000..01e95282412e1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-config/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.config" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Config" + }, + "python": { + "module": "aws_cdk.aws_config" + } + } +} diff --git a/packages/aws-cdk-lib/aws-config/README.md b/packages/aws-cdk-lib/aws-config/README.md new file mode 100644 index 0000000000000..f9bd3b1555f1e --- /dev/null +++ b/packages/aws-cdk-lib/aws-config/README.md @@ -0,0 +1,270 @@ +# AWS Config Construct Library + + +[AWS Config](https://docs.aws.amazon.com/config/latest/developerguide/WhatIsConfig.html) provides a detailed view of the configuration of AWS resources in your AWS account. +This includes how the resources are related to one another and how they were configured in the +past so that you can see how the configurations and relationships change over time. + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Initial Setup + +Before using the constructs provided in this module, you need to set up AWS Config +in the region in which it will be used. This setup includes the one-time creation of the +following resources per region: + +- `ConfigurationRecorder`: Configure which resources will be recorded for config changes. +- `DeliveryChannel`: Configure where to store the recorded data. + +The following guides provide the steps for getting started with AWS Config: + +- [Using the AWS Console](https://docs.aws.amazon.com/config/latest/developerguide/gs-console.html) +- [Using the AWS CLI](https://docs.aws.amazon.com/config/latest/developerguide/gs-cli.html) + +## Rules + +AWS Config can evaluate the configuration settings of your AWS resources by creating AWS Config rules, +which represent your ideal configuration settings. + +See [Evaluating Resources with AWS Config Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) to learn more about AWS Config rules. + +### AWS Managed Rules + +AWS Config provides AWS managed rules, which are predefined, customizable rules that AWS Config +uses to evaluate whether your AWS resources comply with common best practices. + +For example, you could create a managed rule that checks whether active access keys are rotated +within the number of days specified. + +```ts +// https://docs.aws.amazon.com/config/latest/developerguide/access-keys-rotated.html +new config.ManagedRule(this, 'AccessKeysRotated', { + identifier: config.ManagedRuleIdentifiers.ACCESS_KEYS_ROTATED, + inputParameters: { + maxAccessKeyAge: 60, // default is 90 days + }, + + // default is 24 hours + maximumExecutionFrequency: config.MaximumExecutionFrequency.TWELVE_HOURS, +}); +``` + +Identifiers for AWS managed rules are available through static constants in the `ManagedRuleIdentifiers` class. +You can find supported input parameters in the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html). + +The following higher level constructs for AWS managed rules are available. + +#### Access Key rotation + +Checks whether your active access keys are rotated within the number of days specified. + +```ts +// compliant if access keys have been rotated within the last 90 days +new config.AccessKeysRotated(this, 'AccessKeyRotated'); +``` + +#### CloudFormation Stack drift detection + +Checks whether your CloudFormation stack's actual configuration differs, or has drifted, +from it's expected configuration. + +```ts +// compliant if stack's status is 'IN_SYNC' +// non-compliant if the stack's drift status is 'DRIFTED' +new config.CloudFormationStackDriftDetectionCheck(this, 'Drift', { + ownStackOnly: true, // checks only the stack containing the rule +}); +``` + +#### CloudFormation Stack notifications + +Checks whether your CloudFormation stacks are sending event notifications to a SNS topic. + +```ts +// topics to which CloudFormation stacks may send event notifications +const topic1 = new sns.Topic(this, 'AllowedTopic1'); +const topic2 = new sns.Topic(this, 'AllowedTopic2'); + +// non-compliant if CloudFormation stack does not send notifications to 'topic1' or 'topic2' +new config.CloudFormationStackNotificationCheck(this, 'NotificationCheck', { + topics: [topic1, topic2], +}); +``` + +### Custom rules + +You can develop custom rules and add them to AWS Config. You associate each custom rule with an +AWS Lambda function and Guard. + +#### Custom Lambda Rules + +Lambda function which contains the logic that evaluates whether your AWS resources comply with the rule. + +```ts +// Lambda function containing logic that evaluates compliance with the rule. +const evalComplianceFn = new lambda.Function(this, "CustomFunction", { + code: lambda.AssetCode.fromInline( + "exports.handler = (event) => console.log(event);" + ), + handler: "index.handler", + runtime: lambda.Runtime.NODEJS_14_X, +}); + +// A custom rule that runs on configuration changes of EC2 instances +const customRule = new config.CustomRule(this, "Custom", { + configurationChanges: true, + lambdaFunction: evalComplianceFn, + ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE), +}); +``` + +#### Custom Policy Rules + +Guard which contains the logic that evaluates whether your AWS resources comply with the rule. + +```ts +const samplePolicyText = ` +# This rule checks if point in time recovery (PITR) is enabled on active Amazon DynamoDB tables +let status = ['ACTIVE'] + +rule tableisactive when + resourceType == "AWS::DynamoDB::Table" { + configuration.tableStatus == %status +} + +rule checkcompliance when + resourceType == "AWS::DynamoDB::Table" + tableisactive { + let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus + %pitr == "ENABLED" +} +`; + +new config.CustomPolicy(stack, "Custom", { + policyText: samplePolicyText, + enableDebugLog: true, + ruleScope: config.RuleScope.fromResources([ + config.ResourceType.DYNAMODB_TABLE, + ]), +}); +``` + +### Triggers + +AWS Lambda executes functions in response to events that are published by AWS Services. +The function for a custom Config rule receives an event that is published by AWS Config, +and is responsible for evaluating the compliance of the rule. + +Evaluations can be triggered by configuration changes, periodically, or both. +To create a custom rule, define a `CustomRule` and specify the Lambda Function +to run and the trigger types. + +```ts +declare const evalComplianceFn: lambda.Function; + +new config.CustomRule(this, 'CustomRule', { + lambdaFunction: evalComplianceFn, + configurationChanges: true, + periodic: true, + + // default is 24 hours + maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, +}); +``` + +When the trigger for a rule occurs, the Lambda function is invoked by publishing an event. +See [example events for AWS Config Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_example-events.html) + +The AWS documentation has examples of Lambda functions for evaluations that are +[triggered by configuration changes](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_nodejs-sample.html#event-based-example-rule) and [triggered periodically](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules_nodejs-sample.html#periodic-example-rule) + + +### Scope + +By default rules are triggered by changes to all [resources](https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html#supported-resources). + +Use the `RuleScope` APIs (`fromResource()`, `fromResources()` or `fromTag()`) to restrict +the scope of both managed and custom rules: + +```ts +const sshRule = new config.ManagedRule(this, 'SSH', { + identifier: config.ManagedRuleIdentifiers.EC2_SECURITY_GROUPS_INCOMING_SSH_DISABLED, + ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_SECURITY_GROUP, 'sg-1234567890abcdefgh'), // restrict to specific security group +}); + +declare const evalComplianceFn: lambda.Function; +const customRule = new config.CustomRule(this, 'Lambda', { + lambdaFunction: evalComplianceFn, + configurationChanges: true, + ruleScope: config.RuleScope.fromResources([config.ResourceType.CLOUDFORMATION_STACK, config.ResourceType.S3_BUCKET]), // restrict to all CloudFormation stacks and S3 buckets +}); + +const tagRule = new config.CustomRule(this, 'CostCenterTagRule', { + lambdaFunction: evalComplianceFn, + configurationChanges: true, + ruleScope: config.RuleScope.fromTag('Cost Center', 'MyApp'), // restrict to a specific tag +}); +``` + +### Events + +You can define Amazon EventBridge event rules which trigger when a compliance check fails +or when a rule is re-evaluated. + +Use the `onComplianceChange()` APIs to trigger an EventBridge event when a compliance check +of your AWS Config Rule fails: + +```ts +// Topic to which compliance notification events will be published +const complianceTopic = new sns.Topic(this, 'ComplianceTopic'); + +const rule = new config.CloudFormationStackDriftDetectionCheck(this, 'Drift'); +rule.onComplianceChange('TopicEvent', { + target: new targets.SnsTopic(complianceTopic), +}); +``` + +Use the `onReEvaluationStatus()` status to trigger an EventBridge event when an AWS Config +rule is re-evaluated. + +```ts +// Topic to which re-evaluation notification events will be published +const reEvaluationTopic = new sns.Topic(this, 'ComplianceTopic'); + +const rule = new config.CloudFormationStackDriftDetectionCheck(this, 'Drift'); +rule.onReEvaluationStatus('ReEvaluationEvent', { + target: new targets.SnsTopic(reEvaluationTopic), +}); +``` + +### Example + +The following example creates a custom rule that evaluates whether EC2 instances are compliant. +Compliance events are published to an SNS topic. + +```ts +// Lambda function containing logic that evaluates compliance with the rule. +const evalComplianceFn = new lambda.Function(this, 'CustomFunction', { + code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, +}); + +// A custom rule that runs on configuration changes of EC2 instances +const customRule = new config.CustomRule(this, 'Custom', { + configurationChanges: true, + lambdaFunction: evalComplianceFn, + ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE), +}); + +// A rule to detect stack drifts +const driftRule = new config.CloudFormationStackDriftDetectionCheck(this, 'Drift'); + +// Topic to which compliance notification events will be published +const complianceTopic = new sns.Topic(this, 'ComplianceTopic'); + +// Send notification on compliance change events +driftRule.onComplianceChange('ComplianceChange', { + target: new targets.SnsTopic(complianceTopic), +}); +``` diff --git a/packages/aws-cdk-lib/aws-config/index.ts b/packages/aws-cdk-lib/aws-config/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-config/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-config/lib/index.ts b/packages/aws-cdk-lib/aws-config/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-config/lib/index.ts rename to packages/aws-cdk-lib/aws-config/lib/index.ts diff --git a/packages/@aws-cdk/aws-config/lib/managed-rules.ts b/packages/aws-cdk-lib/aws-config/lib/managed-rules.ts similarity index 96% rename from packages/@aws-cdk/aws-config/lib/managed-rules.ts rename to packages/aws-cdk-lib/aws-config/lib/managed-rules.ts index 4bc7b7fa8c015..53de5b5c025e7 100644 --- a/packages/@aws-cdk/aws-config/lib/managed-rules.ts +++ b/packages/aws-cdk-lib/aws-config/lib/managed-rules.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import { Duration, Lazy, Stack } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as sns from '../../aws-sns'; +import { Duration, Lazy, Stack } from '../../core'; import { Construct } from 'constructs'; import { ManagedRule, ManagedRuleIdentifiers, ResourceType, RuleProps, RuleScope } from './rule'; diff --git a/packages/aws-cdk-lib/aws-config/lib/rule.ts b/packages/aws-cdk-lib/aws-config/lib/rule.ts new file mode 100644 index 0000000000000..e403daca2aa59 --- /dev/null +++ b/packages/aws-cdk-lib/aws-config/lib/rule.ts @@ -0,0 +1,2576 @@ +import { createHash } from 'crypto'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import { IResource, Lazy, Resource, Stack } from '../../core'; +import { Construct } from 'constructs'; +import { CfnConfigRule } from './config.generated'; + +/** + * Interface representing an AWS Config rule + */ +export interface IRule extends IResource { + /** + * The name of the rule. + * + * @attribute + */ + readonly configRuleName: string; + + /** + * Defines an EventBridge event rule which triggers for rule events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + onEvent(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a EventBridge event rule which triggers for rule compliance events. + */ + onComplianceChange(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines a EventBridge event rule which triggers for rule re-evaluation status events. + */ + onReEvaluationStatus(id: string, options?: events.OnEventOptions): events.Rule; +} + +/** + * A new or imported rule. + */ +abstract class RuleBase extends Resource implements IRule { + public abstract readonly configRuleName: string; + + /** + * Defines an EventBridge event rule which triggers for rule events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + public onEvent(id: string, options: events.OnEventOptions = {}) { + const rule = new events.Rule(this, id, options); + rule.addEventPattern({ + source: ['aws.config'], + detail: { + configRuleName: [this.configRuleName], + }, + }); + rule.addTarget(options.target); + return rule; + } + + /** + * Defines an EventBridge event rule which triggers for rule compliance events. + */ + public onComplianceChange(id: string, options: events.OnEventOptions = {}): events.Rule { + const rule = this.onEvent(id, options); + rule.addEventPattern({ + detailType: ['Config Rules Compliance Change'], + }); + return rule; + } + + /** + * Defines an EventBridge event rule which triggers for rule re-evaluation status events. + */ + public onReEvaluationStatus(id: string, options: events.OnEventOptions = {}): events.Rule { + const rule = this.onEvent(id, options); + rule.addEventPattern({ + detailType: ['Config Rules Re-evaluation Status'], + }); + return rule; + } +} + +/** + * A new managed or custom rule. + */ +abstract class RuleNew extends RuleBase { + /** + * Imports an existing rule. + * + * @param configRuleName the name of the rule + */ + public static fromConfigRuleName(scope: Construct, id: string, configRuleName: string): IRule { + class Import extends RuleBase { + public readonly configRuleName = configRuleName; + } + + return new Import(scope, id); + } + + /** + * The arn of the rule. + */ + public abstract readonly configRuleArn: string; + + /** + * The id of the rule. + */ + public abstract readonly configRuleId: string; + + /** + * The compliance status of the rule. + */ + public abstract readonly configRuleComplianceType: string; + + protected ruleScope?: RuleScope; + protected isManaged?: boolean; + protected isCustomWithChanges?: boolean; +} + +/** + * Determines which resources trigger an evaluation of an AWS Config rule. + */ +export class RuleScope { + /** restricts scope of changes to a specific resource type or resource identifier */ + public static fromResource(resourceType: ResourceType, resourceId?: string) { + return new RuleScope(resourceId, [resourceType]); + } + /** restricts scope of changes to specific resource types */ + public static fromResources(resourceTypes: ResourceType[]) { + return new RuleScope(undefined, resourceTypes); + } + /** restricts scope of changes to a specific tag */ + public static fromTag(key: string, value?: string) { + return new RuleScope(undefined, undefined, key, value); + } + + /** Resource types that will trigger evaluation of a rule */ + public readonly resourceTypes?: ResourceType[]; + + /** ID of the only AWS resource that will trigger evaluation of a rule */ + public readonly resourceId?: string; + + /** tag key applied to resources that will trigger evaluation of a rule */ + public readonly key?: string; + + /** tag value applied to resources that will trigger evaluation of a rule */ + public readonly value?: string; + + private constructor(resourceId?: string, resourceTypes?: ResourceType[], tagKey?: string, tagValue?: string) { + this.resourceTypes = resourceTypes; + this.resourceId = resourceId; + this.key = tagKey; + this.value = tagValue; + } +} + +/** + * The maximum frequency at which the AWS Config rule runs evaluations. + */ +export enum MaximumExecutionFrequency { + + /** + * 1 hour. + */ + ONE_HOUR = 'One_Hour', + + /** + * 3 hours. + */ + THREE_HOURS = 'Three_Hours', + + /** + * 6 hours. + */ + SIX_HOURS = 'Six_Hours', + + /** + * 12 hours. + */ + TWELVE_HOURS = 'Twelve_Hours', + + /** + * 24 hours. + */ + TWENTY_FOUR_HOURS = 'TwentyFour_Hours' +} + +/** + * Construction properties for a new rule. + */ +export interface RuleProps { + /** + * A name for the AWS Config rule. + * + * @default - CloudFormation generated name + */ + readonly configRuleName?: string; + + /** + * A description about this AWS Config rule. + * + * @default - No description + */ + readonly description?: string; + + /** + * Input parameter values that are passed to the AWS Config rule. + * + * @default - No input parameters + */ + readonly inputParameters?: { [key: string]: any }; + + /** + * The maximum frequency at which the AWS Config rule runs evaluations. + * + * @default MaximumExecutionFrequency.TWENTY_FOUR_HOURS + */ + readonly maximumExecutionFrequency?: MaximumExecutionFrequency; + + /** + * Defines which resources trigger an evaluation for an AWS Config rule. + * + * @default - evaluations for the rule are triggered when any resource in the recording group changes. + */ + readonly ruleScope?: RuleScope; +} + +/** + * Construction properties for a ManagedRule. + */ +export interface ManagedRuleProps extends RuleProps { + /** + * The identifier of the AWS managed rule. + * + * @see https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html + */ + readonly identifier: string; +} + +/** + * A new managed rule. + * + * @resource AWS::Config::ConfigRule + */ +export class ManagedRule extends RuleNew { + /** @attribute */ + public readonly configRuleName: string; + + /** @attribute */ + public readonly configRuleArn: string; + + /** @attribute */ + public readonly configRuleId: string; + + /** @attribute */ + public readonly configRuleComplianceType: string; + + constructor(scope: Construct, id: string, props: ManagedRuleProps) { + super(scope, id, { + physicalName: props.configRuleName, + }); + + this.ruleScope = props.ruleScope; + + const rule = new CfnConfigRule(this, 'Resource', { + configRuleName: this.physicalName, + description: props.description, + inputParameters: props.inputParameters, + maximumExecutionFrequency: props.maximumExecutionFrequency, + scope: Lazy.any({ produce: () => renderScope(this.ruleScope) }), // scope can use values such as stack id (see CloudFormationStackDriftDetectionCheck) + source: { + owner: 'AWS', + sourceIdentifier: props.identifier, + }, + }); + + this.configRuleName = rule.ref; + this.configRuleArn = rule.attrArn; + this.configRuleId = rule.attrConfigRuleId; + this.configRuleComplianceType = rule.attrComplianceType; + + this.isManaged = true; + } +} + +/** + * The source of the event, such as an AWS service, + * that triggers AWS Config to evaluate your AWS resources. + */ +enum EventSource { + + /* from aws.config */ + AWS_CONFIG = 'aws.config', + +} + +/** + * The type of notification that triggers AWS Config to run an evaluation for a rule. + */ +enum MessageType { + + /** + * Triggers an evaluation when AWS Config delivers a configuration item as a result of a resource change. + */ + CONFIGURATION_ITEM_CHANGE_NOTIFICATION = 'ConfigurationItemChangeNotification', + + /** + * Triggers an evaluation when AWS Config delivers an oversized configuration item. + */ + OVERSIZED_CONFIGURATION_ITEM_CHANGE_NOTIFICATION = 'OversizedConfigurationItemChangeNotification', + + /** + * Triggers a periodic evaluation at the frequency specified for MaximumExecutionFrequency. + */ + SCHEDULED_NOTIFICATION = 'ScheduledNotification', + + /** + * Triggers a periodic evaluation when AWS Config delivers a configuration snapshot. + */ + CONFIGURATION_SNAPSHOT_DELIVERY_COMPLETED = 'ConfigurationSnapshotDeliveryCompleted', +} + +/** + * Construction properties for a CustomRule. + */ +interface SourceDetail { + /** + * The source of the event, such as an AWS service, + * that triggers AWS Config to evaluate your AWS resources. + * + */ + readonly eventSource: EventSource; + /** + * The frequency at which you want AWS Config to run evaluations for a custom rule with a periodic trigger. + */ + readonly maximumExecutionFrequency?: MaximumExecutionFrequency; + /** + * The type of notification that triggers AWS Config to run an evaluation for a rule. + */ + readonly messageType: MessageType; +} + +/** + * Construction properties for a CustomRule. + */ +export interface CustomRuleProps extends RuleProps { + /** + * The Lambda function to run. + */ + readonly lambdaFunction: lambda.IFunction; + + /** + * Whether to run the rule on configuration changes. + * + * @default false + */ + readonly configurationChanges?: boolean; + + /** + * Whether to run the rule on a fixed frequency. + * + * @default false + */ + readonly periodic?: boolean; +} +/** + * A new custom rule. + * + * @resource AWS::Config::ConfigRule + */ +export class CustomRule extends RuleNew { + /** @attribute */ + public readonly configRuleName: string; + + /** @attribute */ + public readonly configRuleArn: string; + + /** @attribute */ + public readonly configRuleId: string; + + /** @attribute */ + public readonly configRuleComplianceType: string; + + constructor(scope: Construct, id: string, props: CustomRuleProps) { + super(scope, id, { + physicalName: props.configRuleName, + }); + + if (!props.configurationChanges && !props.periodic) { + throw new Error('At least one of `configurationChanges` or `periodic` must be set to true.'); + } + + const sourceDetails: SourceDetail[] = []; + this.ruleScope = props.ruleScope; + if (props.configurationChanges) { + sourceDetails.push({ + eventSource: EventSource.AWS_CONFIG, + messageType: MessageType.CONFIGURATION_ITEM_CHANGE_NOTIFICATION, + }); + sourceDetails.push({ + eventSource: EventSource.AWS_CONFIG, + messageType: MessageType.OVERSIZED_CONFIGURATION_ITEM_CHANGE_NOTIFICATION, + }); + } + + if (props.periodic) { + sourceDetails.push({ + eventSource: EventSource.AWS_CONFIG, + maximumExecutionFrequency: props.maximumExecutionFrequency, + messageType: MessageType.SCHEDULED_NOTIFICATION, + }); + } + const hash = createHash('sha256') + .update(JSON.stringify({ + fnName: props.lambdaFunction.functionName.toString, + accountId: Stack.of(this).resolve(this.env.account), + region: Stack.of(this).resolve(this.env.region), + }), 'utf8') + .digest('base64'); + const customRulePermissionId: string = `CustomRulePermission${hash}`; + if (!props.lambdaFunction.permissionsNode.tryFindChild(customRulePermissionId)) { + props.lambdaFunction.addPermission(customRulePermissionId, { + principal: new iam.ServicePrincipal('config.amazonaws.com'), + sourceAccount: this.env.account, + }); + }; + + if (props.lambdaFunction.role) { + props.lambdaFunction.role.addManagedPolicy( + iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSConfigRulesExecutionRole'), + ); + } + + // The lambda permission must be created before the rule + this.node.addDependency(props.lambdaFunction); + + const rule = new CfnConfigRule(this, 'Resource', { + configRuleName: this.physicalName, + description: props.description, + inputParameters: props.inputParameters, + maximumExecutionFrequency: props.maximumExecutionFrequency, + scope: Lazy.any({ produce: () => renderScope(this.ruleScope) }), // scope can use values such as stack id (see CloudFormationStackDriftDetectionCheck) + source: { + owner: 'CUSTOM_LAMBDA', + sourceDetails, + sourceIdentifier: props.lambdaFunction.functionArn, + }, + }); + + this.configRuleName = rule.ref; + this.configRuleArn = rule.attrArn; + this.configRuleId = rule.attrConfigRuleId; + this.configRuleComplianceType = rule.attrComplianceType; + + if (props.configurationChanges) { + this.isCustomWithChanges = true; + } + } +} + +/** + * Construction properties for a CustomPolicy. + */ +export interface CustomPolicyProps extends RuleProps { + /** + * The policy definition containing the logic for your AWS Config Custom Policy rule. + */ + readonly policyText: string; + + /** + * The boolean expression for enabling debug logging for your AWS Config Custom Policy rule. + * + * @default false + */ + readonly enableDebugLog?: boolean; +} + +/** + * A new custom policy. + * + * @resource AWS::Config::ConfigRule + */ +export class CustomPolicy extends RuleNew { + /** @attribute */ + public readonly configRuleName: string; + + /** @attribute */ + public readonly configRuleArn: string; + + /** @attribute */ + public readonly configRuleId: string; + + /** @attribute */ + public readonly configRuleComplianceType: string; + + constructor(scope: Construct, id: string, props: CustomPolicyProps) { + super(scope, id, { + physicalName: props.configRuleName, + }); + + if (!props.policyText || [...props.policyText].length === 0) { + throw new Error('Policy Text cannot be empty.'); + } + if ( [...props.policyText].length > 10000 ) { + throw new Error('Policy Text is limited to 10,000 characters or less.'); + } + + const sourceDetails: SourceDetail[] = []; + this.ruleScope = props.ruleScope; + + sourceDetails.push({ + eventSource: EventSource.AWS_CONFIG, + messageType: MessageType.CONFIGURATION_ITEM_CHANGE_NOTIFICATION, + }); + sourceDetails.push({ + eventSource: EventSource.AWS_CONFIG, + messageType: MessageType.OVERSIZED_CONFIGURATION_ITEM_CHANGE_NOTIFICATION, + }); + const rule = new CfnConfigRule(this, 'Resource', { + configRuleName: this.physicalName, + description: props.description, + inputParameters: props.inputParameters, + scope: Lazy.any({ produce: () => renderScope(this.ruleScope) }), // scope can use values such as stack id (see CloudFormationStackDriftDetectionCheck) + source: { + owner: 'CUSTOM_POLICY', + sourceDetails, + customPolicyDetails: { + enableDebugLogDelivery: props.enableDebugLog, + policyRuntime: 'guard-2.x.x', + policyText: props.policyText, + }, + }, + }); + + this.configRuleName = rule.ref; + this.configRuleArn = rule.attrArn; + this.configRuleId = rule.attrConfigRuleId; + this.configRuleComplianceType = rule.attrComplianceType; + this.isCustomWithChanges = true; + } +} + +/** + * Managed rules that are supported by AWS Config. + * @see https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html + */ +export class ManagedRuleIdentifiers { + /** + * Checks that the inline policies attached to your AWS Identity and Access Management users, + * roles, and groups do not allow blocked actions on all AWS Key Management Service keys. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-inline-policy-blocked-kms-actions.html + */ + public static readonly IAM_INLINE_POLICY_BLOCKED_KMS_ACTIONS = 'IAM_INLINE_POLICY_BLOCKED_KMS_ACTIONS'; + /** + * Checks that the managed AWS Identity and Access Management policies that you create do not + * allow blocked actions on all AWS AWS KMS keys. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-customer-policy-blocked-kms-actions.html + */ + public static readonly IAM_CUSTOMER_POLICY_BLOCKED_KMS_ACTIONS = 'IAM_CUSTOMER_POLICY_BLOCKED_KMS_ACTIONS'; + /** + * Checks whether the active access keys are rotated within the number of days specified in maxAccessKeyAge. + * @see https://docs.aws.amazon.com/config/latest/developerguide/access-keys-rotated.html + */ + public static readonly ACCESS_KEYS_ROTATED = 'ACCESS_KEYS_ROTATED'; + /** + * Checks whether AWS account is part of AWS Organizations. + * @see https://docs.aws.amazon.com/config/latest/developerguide/account-part-of-organizations.html + */ + public static readonly ACCOUNT_PART_OF_ORGANIZATIONS = 'ACCOUNT_PART_OF_ORGANIZATIONS'; + /** + * Checks whether ACM Certificates in your account are marked for expiration within the specified number of days. + * @see https://docs.aws.amazon.com/config/latest/developerguide/acm-certificate-expiration-check.html + */ + public static readonly ACM_CERTIFICATE_EXPIRATION_CHECK = 'ACM_CERTIFICATE_EXPIRATION_CHECK'; + /** + * Checks if an Application Load Balancer (ALB) is configured with a user defined desync mitigation mode. + * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-desync-mode-check.html + */ + public static readonly ALB_DESYNC_MODE_CHECK = 'ALB_DESYNC_MODE_CHECK'; + /** + * Checks if rule evaluates Application Load Balancers (ALBs) to ensure they are configured to drop http headers. + * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-http-drop-invalid-header-enabled.html + */ + public static readonly ALB_HTTP_DROP_INVALID_HEADER_ENABLED = 'ALB_HTTP_DROP_INVALID_HEADER_ENABLED'; + /** + * Checks whether HTTP to HTTPS redirection is configured on all HTTP listeners of Application Load Balancer. + * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-http-to-https-redirection-check.html + */ + public static readonly ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK = 'ALB_HTTP_TO_HTTPS_REDIRECTION_CHECK'; + /** + * Checks if Web Application Firewall (WAF) is enabled on Application Load Balancers (ALBs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/alb-waf-enabled.html + */ + public static readonly ALB_WAF_ENABLED = 'ALB_WAF_ENABLED'; + /** + * Checks if Amazon API Gateway V2 stages have access logging enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gwv2-access-logs-enabled.html + */ + public static readonly API_GWV2_ACCESS_LOGS_ENABLED = 'API_GWV2_ACCESS_LOGS_ENABLED'; + /** + * Checks if Amazon API Gatewayv2 API routes have an authorization type set. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gwv2-authorization-type-configured.html + */ + public static readonly API_GWV2_AUTHORIZATION_TYPE_CONFIGURED = 'API_GWV2_AUTHORIZATION_TYPE_CONFIGURED'; + /** + * Checks if an Amazon API Gateway API stage is using an AWS WAF Web ACL. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-associated-with-waf.html + */ + public static readonly API_GW_ASSOCIATED_WITH_WAF = 'API_GW_ASSOCIATED_WITH_WAF'; + /** + * Checks that all methods in Amazon API Gateway stages have caching enabled and encrypted. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-cache-enabled-and-encrypted.html + */ + public static readonly API_GW_CACHE_ENABLED_AND_ENCRYPTED = 'API_GW_CACHE_ENABLED_AND_ENCRYPTED'; + /** + * Checks that Amazon API Gateway APIs are of the type specified in the rule parameter endpointConfigurationType. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-endpoint-type-check.html + */ + public static readonly API_GW_ENDPOINT_TYPE_CHECK = 'API_GW_ENDPOINT_TYPE_CHECK'; + /** + * Checks that all methods in Amazon API Gateway stage has logging enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-execution-logging-enabled.html + */ + public static readonly API_GW_EXECUTION_LOGGING_ENABLED = 'API_GW_EXECUTION_LOGGING_ENABLED'; + /** + * Checks if a REST API stage uses an Secure Sockets Layer (SSL) certificate. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-ssl-enabled.html + */ + public static readonly API_GW_SSL_ENABLED = 'API_GW_SSL_ENABLED'; + /** + * Checks if AWS X-Ray tracing is enabled on Amazon API Gateway REST APIs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/api-gw-xray-enabled.html + */ + public static readonly API_GW_XRAY_ENABLED = 'API_GW_XRAY_ENABLED'; + /** + * Checks whether running instances are using specified AMIs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/approved-amis-by-id.html + */ + public static readonly APPROVED_AMIS_BY_ID = 'APPROVED_AMIS_BY_ID'; + /** + * Checks whether running instances are using specified AMIs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/approved-amis-by-tag.html + */ + public static readonly APPROVED_AMIS_BY_TAG = 'APPROVED_AMIS_BY_TAG'; + /** + * Checks if a recovery point was created for Amazon Aurora DB clusters. + * @see https://docs.aws.amazon.com/config/latest/developerguide/aurora-last-backup-recovery-point-created.html + */ + public static readonly AURORA_LAST_BACKUP_RECOVERY_POINT_CREATED = 'AURORA_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks if an Amazon Aurora MySQL cluster has backtracking enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/aurora-mysql-backtracking-enabled.html + */ + public static readonly AURORA_MYSQL_BACKTRACKING_ENABLED = 'AURORA_MYSQL_BACKTRACKING_ENABLED'; + /** + * Checks if Amazon Aurora DB clusters are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/aurora-resources-protected-by-backup-plan.html + */ + public static readonly AURORA_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'AURORA_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks if Capacity Rebalancing is enabled for Amazon EC2 Auto Scaling groups that use multiple instance types. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-capacity-rebalancing.html + */ + public static readonly AUTOSCALING_CAPACITY_REBALANCING = 'AUTOSCALING_CAPACITY_REBALANCING'; + /** + * Checks whether your Auto Scaling groups that are associated with a load balancer are using + * Elastic Load Balancing health checks. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-group-elb-healthcheck-required.html + */ + public static readonly AUTOSCALING_GROUP_ELB_HEALTHCHECK_REQUIRED = 'AUTOSCALING_GROUP_ELB_HEALTHCHECK_REQUIRED'; + /** + * Checks whether only IMDSv2 is enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launchconfig-requires-imdsv2.html + */ + public static readonly AUTOSCALING_LAUNCHCONFIG_REQUIRES_IMDSV2 = 'AUTOSCALING_LAUNCHCONFIG_REQUIRES_IMDSV2'; + /** + * Checks the number of network hops that the metadata token can travel. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launch-config-hop-limit.html + */ + public static readonly AUTOSCALING_LAUNCH_CONFIG_HOP_LIMIT = 'AUTOSCALING_LAUNCH_CONFIG_HOP_LIMIT'; + /** + * Checks if Amazon EC2 Auto Scaling groups have public IP addresses enabled through Launch Configurations. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launch-config-public-ip-disabled.html + */ + public static readonly AUTOSCALING_LAUNCH_CONFIG_PUBLIC_IP_DISABLED = 'AUTOSCALING_LAUNCH_CONFIG_PUBLIC_IP_DISABLED'; + /** + * Checks if an Amazon Elastic Compute Cloud (EC2) Auto Scaling group is created from an EC2 launch template. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-launch-template.html + */ + public static readonly AUTOSCALING_LAUNCH_TEMPLATE = 'AUTOSCALING_LAUNCH_TEMPLATE'; + /** + * Checks if the Auto Scaling group spans multiple Availability Zones. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-multiple-az.html + */ + public static readonly AUTOSCALING_MULTIPLE_AZ = 'AUTOSCALING_MULTIPLE_AZ'; + /** + * Checks if an Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling group uses multiple instance types. + * @see https://docs.aws.amazon.com/config/latest/developerguide/autoscaling-multiple-instance-types.html + */ + public static readonly AUTOSCALING_MULTIPLE_INSTANCE_TYPES = 'AUTOSCALING_MULTIPLE_INSTANCE_TYPES'; + /** + * Checks if a backup plan has a backup rule that satisfies the required frequency and retention period. + * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-plan-min-frequency-and-min-retention-check.html + */ + public static readonly BACKUP_PLAN_MIN_FREQUENCY_AND_MIN_RETENTION_CHECK = 'BACKUP_PLAN_MIN_FREQUENCY_AND_MIN_RETENTION_CHECK'; + /** + * Checks if a recovery point is encrypted. + * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-recovery-point-encrypted.html + */ + public static readonly BACKUP_RECOVERY_POINT_ENCRYPTED = 'BACKUP_RECOVERY_POINT_ENCRYPTED'; + /** + * Checks if a backup vault has an attached resource-based policy which prevents deletion of recovery points. + * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-recovery-point-manual-deletion-disabled.html + */ + public static readonly BACKUP_RECOVERY_POINT_MANUAL_DELETION_DISABLED = 'BACKUP_RECOVERY_POINT_MANUAL_DELETION_DISABLED'; + /** + * Checks if a recovery point expires no earlier than after the specified period. + * @see https://docs.aws.amazon.com/config/latest/developerguide/backup-recovery-point-minimum-retention-check.html + */ + public static readonly BACKUP_RECOVERY_POINT_MINIMUM_RETENTION_CHECK = 'BACKUP_RECOVERY_POINT_MINIMUM_RETENTION_CHECK'; + /** + * Checks if an AWS Elastic Beanstalk environment is configured for enhanced health reporting. + * @see https://docs.aws.amazon.com/config/latest/developerguide/beanstalk-enhanced-health-reporting-enabled.html + */ + public static readonly BEANSTALK_ENHANCED_HEALTH_REPORTING_ENABLED = 'BEANSTALK_ENHANCED_HEALTH_REPORTING_ENABLED'; + /** + * Checks if Classic Load Balancers (CLB) are configured with a user defined Desync mitigation mode. + * @see https://docs.aws.amazon.com/config/latest/developerguide/clb-desync-mode-check.html + */ + public static readonly CLB_DESYNC_MODE_CHECK = 'CLB_DESYNC_MODE_CHECK'; + /** + * Checks if a Classic Load Balancer spans multiple Availability Zones (AZs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/clb-multiple-az.html + */ + public static readonly CLB_MULTIPLE_AZ = 'CLB_MULTIPLE_AZ'; + /** + * Checks whether an AWS CloudFormation stack's actual configuration differs, or has drifted, + * from it's expected configuration. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudformation-stack-drift-detection-check.html + */ + public static readonly CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK = 'CLOUDFORMATION_STACK_DRIFT_DETECTION_CHECK'; + /** + * Checks whether your CloudFormation stacks are sending event notifications to an SNS topic. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudformation-stack-notification-check.html + */ + public static readonly CLOUDFORMATION_STACK_NOTIFICATION_CHECK = 'CLOUDFORMATION_STACK_NOTIFICATION_CHECK'; + /** + * Checks if Amazon CloudFront distributions are configured to capture information from + * Amazon Simple Storage Service (Amazon S3) server access logs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-accesslogs-enabled.html + */ + public static readonly CLOUDFRONT_ACCESSLOGS_ENABLED = 'CLOUDFRONT_ACCESSLOGS_ENABLED'; + /** + * Checks if Amazon CloudFront distributions are associated with either WAF or WAFv2 web access control lists (ACLs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-associated-with-waf.html + */ + public static readonly CLOUDFRONT_ASSOCIATED_WITH_WAF = 'CLOUDFRONT_ASSOCIATED_WITH_WAF'; + /** + * Checks if the certificate associated with an Amazon CloudFront distribution is the default Secure Sockets Layer (SSL) certificate. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-custom-ssl-certificate.html + */ + public static readonly CLOUDFRONT_CUSTOM_SSL_CERTIFICATE = 'CLOUDFRONT_CUSTOM_SSL_CERTIFICATE'; + /** + * Checks if an Amazon CloudFront distribution is configured to return a specific object that is the default root object. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-default-root-object-configured.html + */ + public static readonly CLOUDFRONT_DEFAULT_ROOT_OBJECT_CONFIGURED = 'CLOUDFRONT_DEFAULT_ROOT_OBJECT_CONFIGURED'; + /** + * Checks if CloudFront distributions are using deprecated SSL protocols for HTTPS communication between + * CloudFront edge locations and custom origins. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-no-deprecated-ssl-protocols.html + */ + public static readonly CLOUDFRONT_NO_DEPRECATED_SSL_PROTOCOLS = 'CLOUDFRONT_NO_DEPRECATED_SSL_PROTOCOLS'; + /** + * Checks that Amazon CloudFront distribution with Amazon S3 Origin type has Origin Access Identity (OAI) configured. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-origin-access-identity-enabled.html + */ + public static readonly CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ENABLED = 'CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ENABLED'; + /** + * Checks whether an origin group is configured for the distribution of at least 2 origins in the + * origin group for Amazon CloudFront. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-origin-failover-enabled.html + */ + public static readonly CLOUDFRONT_ORIGIN_FAILOVER_ENABLED = 'CLOUDFRONT_ORIGIN_FAILOVER_ENABLED'; + /** + * Checks if Amazon CloudFront distributions are using a minimum security policy and cipher suite of TLSv1.2 or + * greater for viewer connections. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-security-policy-check.html + */ + public static readonly CLOUDFRONT_SECURITY_POLICY_CHECK = 'CLOUDFRONT_SECURITY_POLICY_CHECK' + /** + * Checks if Amazon CloudFront distributions are using a custom SSL certificate and are configured + * to use SNI to serve HTTPS requests. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-sni-enabled.html + */ + public static readonly CLOUDFRONT_SNI_ENABLED = 'CLOUDFRONT_SNI_ENABLED'; + /** + * Checks if Amazon CloudFront distributions are encrypting traffic to custom origins. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-traffic-to-origin-encrypted.html + */ + public static readonly CLOUDFRONT_TRAFFIC_TO_ORIGIN_ENCRYPTED = 'CLOUDFRONT_TRAFFIC_TO_ORIGIN_ENCRYPTED'; + /** + * Checks whether your Amazon CloudFront distributions use HTTPS (directly or via a redirection). + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudfront-viewer-policy-https.html + */ + public static readonly CLOUDFRONT_VIEWER_POLICY_HTTPS = 'CLOUDFRONT_VIEWER_POLICY_HTTPS'; + /** + * Checks whether AWS CloudTrail trails are configured to send logs to Amazon CloudWatch Logs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloud-trail-cloud-watch-logs-enabled.html + */ + public static readonly CLOUD_TRAIL_CLOUD_WATCH_LOGS_ENABLED = 'CLOUD_TRAIL_CLOUD_WATCH_LOGS_ENABLED'; + /** + * Checks whether AWS CloudTrail is enabled in your AWS account. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudtrail-enabled.html + */ + public static readonly CLOUD_TRAIL_ENABLED = 'CLOUD_TRAIL_ENABLED'; + /** + * Checks whether AWS CloudTrail is configured to use the server side encryption (SSE) + * AWS Key Management Service (AWS KMS) customer master key (CMK) encryption. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloud-trail-encryption-enabled.html + */ + public static readonly CLOUD_TRAIL_ENCRYPTION_ENABLED = 'CLOUD_TRAIL_ENCRYPTION_ENABLED'; + /** + * Checks whether AWS CloudTrail creates a signed digest file with logs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloud-trail-log-file-validation-enabled.html + */ + public static readonly CLOUD_TRAIL_LOG_FILE_VALIDATION_ENABLED = 'CLOUD_TRAIL_LOG_FILE_VALIDATION_ENABLED'; + /** + * Checks whether at least one AWS CloudTrail trail is logging Amazon S3 data events for all S3 buckets. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudtrail-s3-dataevents-enabled.html + */ + public static readonly CLOUDTRAIL_S3_DATAEVENTS_ENABLED = 'CLOUDTRAIL_S3_DATAEVENTS_ENABLED'; + /** + * Checks that there is at least one AWS CloudTrail trail defined with security best practices. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudtrail-security-trail-enabled.html + */ + public static readonly CLOUDTRAIL_SECURITY_TRAIL_ENABLED = 'CLOUDTRAIL_SECURITY_TRAIL_ENABLED'; + /** + * Checks whether CloudWatch alarms have at least one alarm action, one INSUFFICIENT_DATA action, + * or one OK action enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-action-check.html + */ + public static readonly CLOUDWATCH_ALARM_ACTION_CHECK = 'CLOUDWATCH_ALARM_ACTION_CHECK'; + /** + * Checks if Amazon CloudWatch alarms actions are in enabled state. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-action-enabled-check.html + */ + public static readonly CLOUDWATCH_ALARM_ACTION_ENABLED_CHECK = 'CLOUDWATCH_ALARM_ACTION_ENABLED_CHECK'; + /** + * Checks whether the specified resource type has a CloudWatch alarm for the specified metric. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-resource-check.html + */ + public static readonly CLOUDWATCH_ALARM_RESOURCE_CHECK = 'CLOUDWATCH_ALARM_RESOURCE_CHECK'; + /** + * Checks whether CloudWatch alarms with the given metric name have the specified settings. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-alarm-settings-check.html + */ + public static readonly CLOUDWATCH_ALARM_SETTINGS_CHECK = 'CLOUDWATCH_ALARM_SETTINGS_CHECK'; + /** + * Checks whether a log group in Amazon CloudWatch Logs is encrypted with + * a AWS Key Management Service (KMS) managed Customer Master Keys (CMK). + * @see https://docs.aws.amazon.com/config/latest/developerguide/cloudwatch-log-group-encrypted.html + */ + public static readonly CLOUDWATCH_LOG_GROUP_ENCRYPTED = 'CLOUDWATCH_LOG_GROUP_ENCRYPTED'; + /** + * Checks that key rotation is enabled for each key and matches to the key ID of the + * customer created customer master key (CMK). + * @see https://docs.aws.amazon.com/config/latest/developerguide/cmk-backing-key-rotation-enabled.html + */ + public static readonly CMK_BACKING_KEY_ROTATION_ENABLED = 'CMK_BACKING_KEY_ROTATION_ENABLED'; + /** + * Checks if an AWS CodeBuild project has encryption enabled for all of its artifacts. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-artifact-encryption.html + */ + public static readonly CODEBUILD_PROJECT_ARTIFACT_ENCRYPTION = 'CODEBUILD_PROJECT_ARTIFACT_ENCRYPTION'; + /** + * Checks if an AWS CodeBuild project environment has privileged mode enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-environment-privileged-check.html + */ + public static readonly CODEBUILD_PROJECT_ENVIRONMENT_PRIVILEGED_CHECK = 'CODEBUILD_PROJECT_ENVIRONMENT_PRIVILEGED_CHECK'; + /** + * Checks whether the project contains environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-envvar-awscred-check.html + */ + public static readonly CODEBUILD_PROJECT_ENVVAR_AWSCRED_CHECK = 'CODEBUILD_PROJECT_ENVVAR_AWSCRED_CHECK'; + /** + * Checks if an AWS CodeBuild project environment has at least one log option enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-logging-enabled.html + */ + public static readonly CODEBUILD_PROJECT_LOGGING_ENABLED = 'CODEBUILD_PROJECT_LOGGING_ENABLED'; + /** + * Checks if a AWS CodeBuild project configured with Amazon S3 Logs has encryption enabled for its logs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-s3-logs-encrypted.html + */ + public static readonly CODEBUILD_PROJECT_S3_LOGS_ENCRYPTED = 'CODEBUILD_PROJECT_S3_LOGS_ENCRYPTED'; + /** + * Checks whether the GitHub or Bitbucket source repository URL contains either personal access tokens + * or user name and password. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codebuild-project-source-repo-url-check.html + */ + public static readonly CODEBUILD_PROJECT_SOURCE_REPO_URL_CHECK = 'CODEBUILD_PROJECT_SOURCE_REPO_URL_CHECK'; + /** + * Checks if the deployment group is configured with automatic deployment rollback and + * deployment monitoring with alarms attached. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codedeploy-auto-rollback-monitor-enabled.html + */ + public static readonly CODEDEPLOY_AUTO_ROLLBACK_MONITOR_ENABLED = 'CODEDEPLOY_AUTO_ROLLBACK_MONITOR_ENABLED'; + /** + * Checks if the deployment group for EC2/On-Premises Compute Platform is configured with + * a minimum healthy hosts fleet percentage or host count greater than or equal to the input threshold. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codedeploy-ec2-minimum-healthy-hosts-configured.html + */ + public static readonly CODEDEPLOY_EC2_MINIMUM_HEALTHY_HOSTS_CONFIGURED = 'CODEDEPLOY_EC2_MINIMUM_HEALTHY_HOSTS_CONFIGURED'; + /** + * Checks if the deployment group for Lambda Compute Platform is not using the default deployment configuration. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codedeploy-lambda-allatonce-traffic-shift-disabled.html + */ + public static readonly CODEDEPLOY_LAMBDA_ALLATONCE_TRAFFIC_SHIFT_DISABLED = 'CODEDEPLOY_LAMBDA_ALLATONCE_TRAFFIC_SHIFT_DISABLED'; + /** + * Checks whether the first deployment stage of the AWS CodePipeline performs more than one deployment. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codepipeline-deployment-count-check.html + */ + public static readonly CODEPIPELINE_DEPLOYMENT_COUNT_CHECK = 'CODEPIPELINE_DEPLOYMENT_COUNT_CHECK'; + /** + * Checks whether each stage in the AWS CodePipeline deploys to more than N times the number of + * the regions the AWS CodePipeline has deployed in all the previous combined stages, + * where N is the region fanout number. + * @see https://docs.aws.amazon.com/config/latest/developerguide/codepipeline-region-fanout-check.html + */ + public static readonly CODEPIPELINE_REGION_FANOUT_CHECK = 'CODEPIPELINE_REGION_FANOUT_CHECK'; + /** + * Checks whether Amazon CloudWatch LogGroup retention period is set to specific number of days. + * @see https://docs.aws.amazon.com/config/latest/developerguide/cw-loggroup-retention-period-check.html + */ + public static readonly CW_LOGGROUP_RETENTION_PERIOD_CHECK = 'CW_LOGGROUP_RETENTION_PERIOD_CHECK'; + /** + * Checks that DynamoDB Accelerator (DAX) clusters are encrypted. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dax-encryption-enabled.html + */ + public static readonly DAX_ENCRYPTION_ENABLED = 'DAX_ENCRYPTION_ENABLED'; + /** + * Checks whether RDS DB instances have backups enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/db-instance-backup-enabled.html + */ + public static readonly RDS_DB_INSTANCE_BACKUP_ENABLED = 'DB_INSTANCE_BACKUP_ENABLED'; + /** + * Checks instances for specified tenancy. + * @see https://docs.aws.amazon.com/config/latest/developerguide/desired-instance-tenancy.html + */ + public static readonly EC2_DESIRED_INSTANCE_TENANCY = 'DESIRED_INSTANCE_TENANCY'; + /** + * Checks whether your EC2 instances are of the specified instance types. + * @see https://docs.aws.amazon.com/config/latest/developerguide/desired-instance-type.html + */ + public static readonly EC2_DESIRED_INSTANCE_TYPE = 'DESIRED_INSTANCE_TYPE'; + /** + * Checks whether AWS Database Migration Service replication instances are public. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dms-replication-not-public.html + */ + public static readonly DMS_REPLICATION_NOT_PUBLIC = 'DMS_REPLICATION_NOT_PUBLIC'; + /** + * Checks whether Auto Scaling or On-Demand is enabled on your DynamoDB tables and/or global secondary indexes. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-autoscaling-enabled.html + */ + public static readonly DYNAMODB_AUTOSCALING_ENABLED = 'DYNAMODB_AUTOSCALING_ENABLED'; + /** + * Checks whether Amazon DynamoDB table is present in AWS Backup plans. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-in-backup-plan.html + */ + public static readonly DYNAMODB_IN_BACKUP_PLAN = 'DYNAMODB_IN_BACKUP_PLAN'; + /** + * Checks if a recovery point was created for Amazon DynamoDB Tables within the specified period. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-last-backup-recovery-point-created.html + */ + public static readonly DYNAMODB_LAST_BACKUP_RECOVERY_POINT_CREATED = 'DYNAMODB_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks that point in time recovery (PITR) is enabled for Amazon DynamoDB tables. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-pitr-enabled.html + */ + public static readonly DYNAMODB_PITR_ENABLED = 'DYNAMODB_PITR_ENABLED'; + /** + * Checks if Amazon DynamoDB tables are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-resources-protected-by-backup-plan.html + */ + public static readonly DYNAMODB_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'DYNAMODB_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks whether Amazon DynamoDB table is encrypted with AWS Key Management Service (KMS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-table-encrypted-kms.html + */ + public static readonly DYNAMODB_TABLE_ENCRYPTED_KMS = 'DYNAMODB_TABLE_ENCRYPTED_KMS'; + /** + * Checks whether the Amazon DynamoDB tables are encrypted and checks their status. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-table-encryption-enabled.html + */ + public static readonly DYNAMODB_TABLE_ENCRYPTION_ENABLED = 'DYNAMODB_TABLE_ENCRYPTION_ENABLED'; + /** + * Checks whether provisioned DynamoDB throughput is approaching the maximum limit for your account. + * @see https://docs.aws.amazon.com/config/latest/developerguide/dynamodb-throughput-limit-check.html + */ + public static readonly DYNAMODB_THROUGHPUT_LIMIT_CHECK = 'DYNAMODB_THROUGHPUT_LIMIT_CHECK'; + /** + * Checks if Amazon Elastic Block Store (Amazon EBS) volumes are added in backup plans of AWS Backup. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-in-backup-plan.html + */ + public static readonly EBS_IN_BACKUP_PLAN = 'EBS_IN_BACKUP_PLAN'; + /** + * Checks whether Amazon Elastic File System (Amazon EFS) file systems are added + * in the backup plans of AWS Backup. + * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-in-backup-plan.html + */ + public static readonly EFS_IN_BACKUP_PLAN = 'EFS_IN_BACKUP_PLAN'; + /** + * Check that Amazon Elastic Block Store (EBS) encryption is enabled by default. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-ebs-encryption-by-default.html + */ + public static readonly EC2_EBS_ENCRYPTION_BY_DEFAULT = 'EC2_EBS_ENCRYPTION_BY_DEFAULT'; + /** + * Checks whether EBS optimization is enabled for your EC2 instances that can be EBS-optimized. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-optimized-instance.html + */ + public static readonly EBS_OPTIMIZED_INSTANCE = 'EBS_OPTIMIZED_INSTANCE'; + /** + * Checks if Amazon Elastic Block Store (Amazon EBS) volumes are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-resources-protected-by-backup-plan.html + */ + public static readonly EBS_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'EBS_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks whether Amazon Elastic Block Store snapshots are not publicly restorable. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ebs-snapshot-public-restorable-check.html + */ + public static readonly EBS_SNAPSHOT_PUBLIC_RESTORABLE_CHECK = 'EBS_SNAPSHOT_PUBLIC_RESTORABLE_CHECK'; + /** + * Checks whether detailed monitoring is enabled for EC2 instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-detailed-monitoring-enabled.html + */ + public static readonly EC2_INSTANCE_DETAILED_MONITORING_ENABLED = 'EC2_INSTANCE_DETAILED_MONITORING_ENABLED'; + /** + * Checks whether the Amazon EC2 instances in your account are managed by AWS Systems Manager. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-managed-by-systems-manager.html + */ + public static readonly EC2_INSTANCE_MANAGED_BY_SSM = 'EC2_INSTANCE_MANAGED_BY_SSM'; + /** + * Checks if an Amazon Elastic Compute Cloud (Amazon EC2) instance has an Identity and Access + * Management (IAM) profile attached to it. This rule is NON_COMPLIANT if no IAM profile is + * attached to the Amazon EC2 instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-profile-attached.html + */ + public static readonly EC2_INSTANCE_PROFILE_ATTACHED = 'EC2_INSTANCE_PROFILE_ATTACHED'; + /** + * Checks if Amazon Elastic Compute Cloud (Amazon EC2) uses multiple ENIs (Elastic Network Interfaces) + * or Elastic Fabric Adapters (EFAs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-multiple-eni-check.html + */ + public static readonly EC2_INSTANCE_MULTIPLE_ENI_CHECK = 'EC2_INSTANCE_MULTIPLE_ENI_CHECK'; + /** + * Checks whether Amazon Elastic Compute Cloud (Amazon EC2) instances have a public IP association. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instance-no-public-ip.html + */ + public static readonly EC2_INSTANCE_NO_PUBLIC_IP = 'EC2_INSTANCE_NO_PUBLIC_IP'; + /** + * Checks if a recovery point was created for Amazon Elastic Compute Cloud (Amazon EC2) instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-last-backup-recovery-point-created.html + */ + public static readonly EC2_LAST_BACKUP_RECOVERY_POINT_CREATED = 'EC2_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks whether your EC2 instances belong to a virtual private cloud (VPC). + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instances-in-vpc.html + */ + public static readonly EC2_INSTANCES_IN_VPC = 'INSTANCES_IN_VPC'; + /** + * Checks that none of the specified applications are installed on the instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-applications-blacklisted.html + */ + public static readonly EC2_MANAGED_INSTANCE_APPLICATIONS_BLOCKED = 'EC2_MANAGEDINSTANCE_APPLICATIONS_BLACKLISTED'; + /** + * Checks whether all of the specified applications are installed on the instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-applications-required.html + */ + public static readonly EC2_MANAGED_INSTANCE_APPLICATIONS_REQUIRED = 'EC2_MANAGEDINSTANCE_APPLICATIONS_REQUIRED'; + /** + * Checks whether the compliance status of AWS Systems Manager association compliance is COMPLIANT + * or NON_COMPLIANT after the association execution on the instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-association-compliance-status-check.html + */ + public static readonly EC2_MANAGED_INSTANCE_ASSOCIATION_COMPLIANCE_STATUS_CHECK = 'EC2_MANAGEDINSTANCE_ASSOCIATION_COMPLIANCE_STATUS_CHECK'; + /** + * Checks whether instances managed by AWS Systems Manager are configured to collect blocked inventory types. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-inventory-blacklisted.html + */ + public static readonly EC2_MANAGED_INSTANCE_INVENTORY_BLOCKED = 'EC2_MANAGEDINSTANCE_INVENTORY_BLACKLISTED'; + /** + * Checks whether the compliance status of the Amazon EC2 Systems Manager patch compliance is + * COMPLIANT or NON_COMPLIANT after the patch installation on the instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-patch-compliance-status-check.html + */ + public static readonly EC2_MANAGED_INSTANCE_PATCH_COMPLIANCE_STATUS_CHECK = 'EC2_MANAGEDINSTANCE_PATCH_COMPLIANCE_STATUS_CHECK'; + /** + * Checks whether EC2 managed instances have the desired configurations. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-managedinstance-platform-check.html + */ + public static readonly EC2_MANAGED_INSTANCE_PLATFORM_CHECK = 'EC2_MANAGEDINSTANCE_PLATFORM_CHECK'; + /** + * Checks if running Amazon Elastic Compute Cloud (EC2) instances are launched using amazon key pairs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-no-amazon-key-pair.html + */ + public static readonly EC2_NO_AMAZON_KEY_PAIR = 'EC2_NO_AMAZON_KEY_PAIR'; + /** + * Checks if the virtualization type of an EC2 instance is paravirtual. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-paravirtual-instance-check.html + */ + public static readonly EC2_PARAVIRTUAL_INSTANCE_CHECK = 'EC2_PARAVIRTUAL_INSTANCE_CHECK'; + /** + * Checks if Amazon Elastic Compute Cloud (Amazon EC2) instances are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-resources-protected-by-backup-plan.html + */ + public static readonly EC2_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'EC2_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks that security groups are attached to Amazon Elastic Compute Cloud (Amazon EC2) instances + * or to an elastic network interface. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-security-group-attached-to-eni.html + */ + public static readonly EC2_SECURITY_GROUP_ATTACHED_TO_ENI = 'EC2_SECURITY_GROUP_ATTACHED_TO_ENI'; + /** + * Checks if non-default security groups are attached to Elastic network interfaces (ENIs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-security-group-attached-to-eni-periodic.html + */ + public static readonly EC2_SECURITY_GROUP_ATTACHED_TO_ENI_PERIODIC = 'EC2_SECURITY_GROUP_ATTACHED_TO_ENI_PERIODIC'; + /** + * Checks whether there are instances stopped for more than the allowed number of days. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-stopped-instance.html + */ + public static readonly EC2_STOPPED_INSTANCE = 'EC2_STOPPED_INSTANCE'; + /** + * Checks if an Amazon Elastic Compute Cloud (EC2) instance metadata + * has a specified token hop limit that is below the desired limit. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-token-hop-limit-check.html + */ + public static readonly EC2_TOKEN_HOP_LIMIT_CHECK = 'EC2_TOKEN_HOP_LIMIT_CHECK'; + /** + * Checks if Amazon Elastic Compute Cloud (Amazon EC2) Transit Gateways have 'AutoAcceptSharedAttachments' enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-transit-gateway-auto-vpc-attach-disabled.html + */ + public static readonly EC2_TRANSIT_GATEWAY_AUTO_VPC_ATTACH_DISABLED = 'EC2_TRANSIT_GATEWAY_AUTO_VPC_ATTACH_DISABLED'; + /** + * Checks whether EBS volumes are attached to EC2 instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-volume-inuse-check.html + */ + public static readonly EC2_VOLUME_INUSE_CHECK = 'EC2_VOLUME_INUSE_CHECK'; + /** + * Checks if a private Amazon Elastic Container Registry (ECR) repository has image scanning enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecr-private-image-scanning-enabled.html + */ + public static readonly ECR_PRIVATE_IMAGE_SCANNING_ENABLED = 'ECR_PRIVATE_IMAGE_SCANNING_ENABLED'; + /** + * Checks if a private Amazon Elastic Container Registry (ECR) repository has at least one lifecycle policy configured. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecr-private-lifecycle-policy-configured.html + */ + public static readonly ECR_PRIVATE_LIFECYCLE_POLICY_CONFIGURED = 'ECR_PRIVATE_LIFECYCLE_POLICY_CONFIGURED'; + /** + * Checks if a private Amazon Elastic Container Registry (ECR) repository has tag immutability enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecr-private-tag-immutability-enabled.html + */ + public static readonly ECR_PRIVATE_TAG_IMMUTABILITY_ENABLED = 'ECR_PRIVATE_TAG_IMMUTABILITY_ENABLED'; + /** + * Checks if the networking mode for active ECSTaskDefinitions is set to ‘awsvpc’. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-awsvpc-networking-enabled.html + */ + public static readonly ECS_AWSVPC_NETWORKING_ENABLED = 'ECS_AWSVPC_NETWORKING_ENABLED'; + /** + * Checks if the privileged parameter in the container definition of ECSTaskDefinitions is set to ‘true’. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-instances-in-vpc.html + */ + public static readonly ECS_CONTAINERS_NONPRIVILEGED = 'ECS_CONTAINERS_NONPRIVILEGED'; + /** + * Checks if Amazon Elastic Container Service (Amazon ECS) Containers only have read-only access to its root filesystems. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-containers-readonly-access.html + */ + public static readonly ECS_CONTAINERS_READONLY_ACCESS = 'ECS_CONTAINERS_READONLY_ACCESS'; + /** + * Checks if Amazon Elastic Container Service clusters have container insights enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-container-insights-enabled.html + */ + public static readonly ECS_CONTAINER_INSIGHTS_ENABLED = 'ECS_CONTAINER_INSIGHTS_ENABLED'; + /** + * Checks if Amazon Elastic Container Service (ECS) Fargate Services + * is running on the latest Fargate platform version. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-fargate-latest-platform-version.html + */ + public static readonly ECS_FARGATE_LATEST_PLATFORM_VERSION = 'ECS_FARGATE_LATEST_PLATFORM_VERSION'; + /** + * Checks if secrets are passed as container environment variables. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-no-environment-secrets.html + */ + public static readonly ECS_NO_ENVIRONMENT_SECRETS = 'ECS_NO_ENVIRONMENT_SECRETS'; + /** + * Checks if logConfiguration is set on active ECS Task Definitions. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-task-definition-log-configuration.html + */ + public static readonly ECS_TASK_DEFINITION_LOG_CONFIGURATION = 'ECS_TASK_DEFINITION_LOG_CONFIGURATION'; + /** + * Checks if Amazon Elastic Container Service (ECS) task definitions have a set memory limit for its container definitions. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-task-definition-memory-hard-limit.html + */ + public static readonly ECS_TASK_DEFINITION_MEMORY_HARD_LIMIT = 'ECS_TASK_DEFINITION_MEMORY_HARD_LIMIT'; + /** + * Checks if ECSTaskDefinitions specify a user + * for Amazon Elastic Container Service (Amazon ECS) EC2 launch type containers to run on. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ecs-task-definition-nonroot-user.html + */ + public static readonly ECS_TASK_DEFINITION_NONROOT_USER = 'ECS_TASK_DEFINITION_NONROOT_USER'; + /** + * Checks if ECSTaskDefinitions are configured to share a host’s process namespace + * with its Amazon Elastic Container Service (Amazon ECS) containers. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-stopped-instance.html + */ + public static readonly ECS_TASK_DEFINITION_PID_MODE_CHECK = 'ECS_TASK_DEFINITION_PID_MODE_CHECK'; + /** + * Checks if an Amazon Elastic Container Service (Amazon ECS) task definition + * with host networking mode has 'privileged' or 'user' container definitions. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-volume-inuse-check.html + */ + public static readonly EC2_VOLUME_IECS_TASK_DEFINITION_USER_FOR_HOST_MODE_CHECKNUSE_CHECK = 'ECS_TASK_DEFINITION_USER_FOR_HOST_MODE_CHECK'; + /** + * Checks if Amazon Elastic File System (Amazon EFS) access points are configured to enforce a root directory. + * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-access-point-enforce-root-directory.html + */ + public static readonly EFS_ACCESS_POINT_ENFORCE_ROOT_DIRECTORY = 'EFS_ACCESS_POINT_ENFORCE_ROOT_DIRECTORY'; + /** + * Checks if Amazon Elastic File System (Amazon EFS) access points are configured to enforce a user identity. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-volume-inuse-check.html + */ + public static readonly EFS_ACCESS_POINT_ENFORCE_USER_IDENTITY = 'EFS_ACCESS_POINT_ENFORCE_USER_IDENTITY'; + /** + * hecks whether Amazon Elastic File System (Amazon EFS) is configured to encrypt the file data + * using AWS Key Management Service (AWS KMS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-encrypted-check.html + */ + public static readonly EFS_ENCRYPTED_CHECK = 'EFS_ENCRYPTED_CHECK'; + /** + * Checks if a recovery point was created for Amazon Elastic File System (Amazon EFS) File Systems. + * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-last-backup-recovery-point-created.html + */ + public static readonly EFS_LAST_BACKUP_RECOVERY_POINT_CREATED = 'EFS_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks if Amazon Elastic File System (Amazon EFS) File Systems are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/efs-resources-protected-by-backup-plan.html + */ + public static readonly EFS_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'EFS_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks whether all Elastic IP addresses that are allocated to a VPC are attached to + * EC2 instances or in-use elastic network interfaces (ENIs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/eip-attached.html + */ + public static readonly EIP_ATTACHED = 'EIP_ATTACHED'; + /** + * Checks whether Amazon Elasticsearch Service (Amazon ES) domains have encryption + * at rest configuration enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticsearch-encrypted-at-rest.html + */ + public static readonly ELASTICSEARCH_ENCRYPTED_AT_REST = 'ELASTICSEARCH_ENCRYPTED_AT_REST'; + /** + * Checks whether Amazon Elasticsearch Service (Amazon ES) domains are in + * Amazon Virtual Private Cloud (Amazon VPC). + * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticsearch-in-vpc-only.html + */ + public static readonly ELASTICSEARCH_IN_VPC_ONLY = 'ELASTICSEARCH_IN_VPC_ONLY'; + /** + * Check if the Amazon ElastiCache Redis clusters have automatic backup turned on. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticache-redis-cluster-automatic-backup-check.html + */ + public static readonly ELASTICACHE_REDIS_CLUSTER_AUTOMATIC_BACKUP_CHECK = 'ELASTICACHE_REDIS_CLUSTER_AUTOMATIC_BACKUP_CHECK'; + /** + * Checks whether your Amazon Elastic Compute Cloud (Amazon EC2) instance metadata version + * is configured with Instance Metadata Service Version 2 (IMDSv2). + * @see https://docs.aws.amazon.com/config/latest/developerguide/ec2-imdsv2-check.html + */ + public static readonly EC2_IMDSV2_CHECK = 'EC2_IMDSV2_CHECK'; + /** + * Checks if an Amazon Elastic Kubernetes Service (EKS) cluster is running the oldest supported version. + * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-oldest-supported-version.html + */ + public static readonly EKS_CLUSTER_OLDEST_SUPPORTED_VERSION = 'EKS_CLUSTER_OLDEST_SUPPORTED_VERSION'; + /** + * Checks if an Amazon Elastic Kubernetes Service (EKS) cluster is running a supported Kubernetes version. + * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-cluster-supported-version.html + */ + public static readonly EKS_CLUSTER_SUPPORTED_VERSION = 'EKS_CLUSTER_SUPPORTED_VERSION'; + /** + * Checks whether Amazon Elastic Kubernetes Service (Amazon EKS) endpoint is not publicly accessible. + * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-endpoint-no-public-access.html + */ + public static readonly EKS_ENDPOINT_NO_PUBLIC_ACCESS = 'EKS_ENDPOINT_NO_PUBLIC_ACCESS'; + /** + * Checks whether Amazon Elastic Kubernetes Service clusters are configured to have Kubernetes + * secrets encrypted using AWS Key Management Service (KMS) keys. + * @see https://docs.aws.amazon.com/config/latest/developerguide/eks-secrets-encrypted.html + */ + public static readonly EKS_SECRETS_ENCRYPTED = 'EKS_SECRETS_ENCRYPTED'; + /** + * Check that Amazon ElasticSearch Service nodes are encrypted end to end. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elasticsearch-node-to-node-encryption-check.html + */ + public static readonly ELASTICSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK = 'ELASTICSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK'; + /** + * Checks if managed platform updates in an AWS Elastic Beanstalk environment is enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elastic-beanstalk-managed-updates-enabled.html + */ + public static readonly ELASTIC_BEANSTALK_MANAGED_UPDATES_ENABLED = 'ELASTIC_BEANSTALK_MANAGED_UPDATES_ENABLED'; + /** + * Checks if Application Load Balancers and Network Load Balancers + * have listeners that are configured to use certificates from AWS Certificate Manager (ACM). + * @see https://docs.aws.amazon.com/config/latest/developerguide/elbv2-acm-certificate-required.html + */ + public static readonly ELBV2_ACM_CERTIFICATE_REQUIRED = 'ELBV2_ACM_CERTIFICATE_REQUIRED'; + /** + * Checks if an Elastic Load Balancer V2 (Application, Network, or Gateway Load Balancer) + * has registered instances from multiple Availability Zones (AZ's). + * @see https://docs.aws.amazon.com/config/latest/developerguide/elbv2-multiple-az.html + */ + public static readonly ELBV2_MULTIPLE_AZ = 'ELBV2_MULTIPLE_AZ'; + /** + * Checks if cross-zone load balancing is enabled for the Classic Load Balancers (CLBs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-cross-zone-load-balancing-enabled.html + */ + public static readonly ELB_CROSS_ZONE_LOAD_BALANCING_ENABLED = 'ELB_CROSS_ZONE_LOAD_BALANCING_ENABLED'; + /** + * Checks whether your Classic Load Balancer is configured with SSL or HTTPS listeners. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-tls-https-listeners-only.html + */ + public static readonly ELB_TLS_HTTPS_LISTENERS_ONLY = 'ELB_TLS_HTTPS_LISTENERS_ONLY'; + /** + * Checks whether the Classic Load Balancers use SSL certificates provided by AWS Certificate Manager. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-acm-certificate-required.html + */ + public static readonly ELB_ACM_CERTIFICATE_REQUIRED = 'ELB_ACM_CERTIFICATE_REQUIRED'; + /** + * Checks whether your Classic Load Balancer SSL listeners are using a custom policy. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-custom-security-policy-ssl-check.html + */ + public static readonly ELB_CUSTOM_SECURITY_POLICY_SSL_CHECK = 'ELB_CUSTOM_SECURITY_POLICY_SSL_CHECK'; + /** + * Checks whether Elastic Load Balancing has deletion protection enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-deletion-protection-enabled.html + */ + public static readonly ELB_DELETION_PROTECTION_ENABLED = 'ELB_DELETION_PROTECTION_ENABLED'; + /** + * Checks whether the Application Load Balancer and the Classic Load Balancer have logging enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-logging-enabled.html + */ + public static readonly ELB_LOGGING_ENABLED = 'ELB_LOGGING_ENABLED'; + /** + * Checks whether your Classic Load Balancer SSL listeners are using a predefined policy. + * @see https://docs.aws.amazon.com/config/latest/developerguide/elb-predefined-security-policy-ssl-check.html + */ + public static readonly ELB_PREDEFINED_SECURITY_POLICY_SSL_CHECK = 'ELB_PREDEFINED_SECURITY_POLICY_SSL_CHECK'; + /** + * Checks that Amazon EMR clusters have Kerberos enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/emr-kerberos-enabled.html + */ + public static readonly EMR_KERBEROS_ENABLED = 'EMR_KERBEROS_ENABLED'; + /** + * Checks whether Amazon Elastic MapReduce (EMR) clusters' master nodes have public IPs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/emr-master-no-public-ip.html + */ + public static readonly EMR_MASTER_NO_PUBLIC_IP = 'EMR_MASTER_NO_PUBLIC_IP'; + /** + * Checks whether the EBS volumes that are in an attached state are encrypted. + * @see https://docs.aws.amazon.com/config/latest/developerguide/encrypted-volumes.html + */ + public static readonly EBS_ENCRYPTED_VOLUMES = 'ENCRYPTED_VOLUMES'; + /** + * Checks whether the security groups associated inScope resources are compliant with the + * master security groups at each rule level based on allowSecurityGroup and denySecurityGroup flag. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-security-group-audit-policy-check.html + * + * @deprecated Inactive managed rule + * + */ + public static readonly FMS_SECURITY_GROUP_AUDIT_POLICY_CHECK = 'FMS_SECURITY_GROUP_AUDIT_POLICY_CHECK'; + /** + * Checks whether AWS Firewall Manager created security groups content is the same as the master security groups. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-security-group-content-check.html + * + * @deprecated Inactive managed rule + * + */ + public static readonly FMS_SECURITY_GROUP_CONTENT_CHECK = 'FMS_SECURITY_GROUP_CONTENT_CHECK'; + /** + * Checks whether Amazon EC2 or an elastic network interface is associated with AWS Firewall Manager security groups. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-security-group-resource-association-check.html + * + * @deprecated Inactive managed rule + * + */ + public static readonly FMS_SECURITY_GROUP_RESOURCE_ASSOCIATION_CHECK = 'FMS_SECURITY_GROUP_RESOURCE_ASSOCIATION_CHECK'; + /** + * Checks whether an Application Load Balancer, Amazon CloudFront distributions, + * Elastic Load Balancer or Elastic IP has AWS Shield protection. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-shield-resource-policy-check.html + */ + public static readonly FMS_SHIELD_RESOURCE_POLICY_CHECK = 'FMS_SHIELD_RESOURCE_POLICY_CHECK'; + /** + * Checks whether the web ACL is associated with an Application Load Balancer, API Gateway stage, + * or Amazon CloudFront distributions. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-webacl-resource-policy-check.html + */ + public static readonly FMS_WEBACL_RESOURCE_POLICY_CHECK = 'FMS_WEBACL_RESOURCE_POLICY_CHECK'; + /** + * Checks that the rule groups associate with the web ACL at the correct priority. + * The correct priority is decided by the rank of the rule groups in the ruleGroups parameter. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fms-webacl-rulegroup-association-check.html + */ + public static readonly FMS_WEBACL_RULEGROUP_ASSOCIATION_CHECK = 'FMS_WEBACL_RULEGROUP_ASSOCIATION_CHECK'; + /** + * Checks if a recovery point was created for Amazon FSx File Systems. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fsx-last-backup-recovery-point-created.html + */ + public static readonly FSX_LAST_BACKUP_RECOVERY_POINT_CREATED = 'FSX_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks if Amazon FSx File Systems are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/fsx-resources-protected-by-backup-plan.html + */ + public static readonly FSX_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'FSX_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks whether Amazon GuardDuty is enabled in your AWS account and region. If you provide an AWS account for centralization, + * the rule evaluates the Amazon GuardDuty results in the centralized account. + * @see https://docs.aws.amazon.com/config/latest/developerguide/guardduty-enabled-centralized.html + */ + public static readonly GUARDDUTY_ENABLED_CENTRALIZED = 'GUARDDUTY_ENABLED_CENTRALIZED'; + /** + * Checks whether the Amazon GuardDuty has findings that are non archived. + * @see https://docs.aws.amazon.com/config/latest/developerguide/guardduty-non-archived-findings.html + */ + public static readonly GUARDDUTY_NON_ARCHIVED_FINDINGS = 'GUARDDUTY_NON_ARCHIVED_FINDINGS'; + /** + * Checks that inline policy feature is not in use. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-no-inline-policy-check.html + */ + public static readonly IAM_NO_INLINE_POLICY_CHECK = 'IAM_NO_INLINE_POLICY_CHECK'; + /** + * Checks whether IAM groups have at least one IAM user. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-group-has-users-check.html + */ + public static readonly IAM_GROUP_HAS_USERS_CHECK = 'IAM_GROUP_HAS_USERS_CHECK'; + /** + * Checks whether the account password policy for IAM users meets the specified requirements + * indicated in the parameters. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-password-policy.html + */ + public static readonly IAM_PASSWORD_POLICY = 'IAM_PASSWORD_POLICY'; + /** + * Checks whether for each IAM resource, a policy ARN in the input parameter is attached to the IAM resource. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-blacklisted-check.html + */ + public static readonly IAM_POLICY_BLOCKED_CHECK = 'IAM_POLICY_BLACKLISTED_CHECK'; + /** + * Checks whether the IAM policy ARN is attached to an IAM user, or an IAM group with one or more IAM users, + * or an IAM role with one or more trusted entity. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-in-use.html + */ + public static readonly IAM_POLICY_IN_USE = 'IAM_POLICY_IN_USE'; + /** + * Checks the IAM policies that you create for Allow statements that grant permissions to all actions on all resources. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-no-statements-with-admin-access.html + */ + public static readonly IAM_POLICY_NO_STATEMENTS_WITH_ADMIN_ACCESS = 'IAM_POLICY_NO_STATEMENTS_WITH_ADMIN_ACCESS'; + /** + * Checks if AWS Identity and Access Management (IAM) policies that you create grant permissions to all actions on individual AWS resources. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-policy-no-statements-with-full-access.html + */ + public static readonly IAM_POLICY_NO_STATEMENTS_WITH_FULL_ACCESS = 'IAM_POLICY_NO_STATEMENTS_WITH_FULL_ACCESS'; + /** + * Checks that AWS Identity and Access Management (IAM) policies in a list of policies are attached to all AWS roles. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-role-managed-policy-check.html + */ + public static readonly IAM_ROLE_MANAGED_POLICY_CHECK = 'IAM_ROLE_MANAGED_POLICY_CHECK'; + /** + * Checks whether the root user access key is available. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-root-access-key-check.html + */ + public static readonly IAM_ROOT_ACCESS_KEY_CHECK = 'IAM_ROOT_ACCESS_KEY_CHECK'; + /** + * Checks whether IAM users are members of at least one IAM group. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-group-membership-check.html + */ + public static readonly IAM_USER_GROUP_MEMBERSHIP_CHECK = 'IAM_USER_GROUP_MEMBERSHIP_CHECK'; + /** + * Checks whether the AWS Identity and Access Management users have multi-factor authentication (MFA) enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-mfa-enabled.html + */ + public static readonly IAM_USER_MFA_ENABLED = 'IAM_USER_MFA_ENABLED'; + /** + * Checks that none of your IAM users have policies attached. IAM users must inherit permissions from IAM groups or roles. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-no-policies-check.html + */ + public static readonly IAM_USER_NO_POLICIES_CHECK = 'IAM_USER_NO_POLICIES_CHECK'; + /** + * Checks whether your AWS Identity and Access Management (IAM) users have passwords or + * active access keys that have not been used within the specified number of days you provided. + * @see https://docs.aws.amazon.com/config/latest/developerguide/iam-user-unused-credentials-check.html + */ + public static readonly IAM_USER_UNUSED_CREDENTIALS_CHECK = 'IAM_USER_UNUSED_CREDENTIALS_CHECK'; + /** + * Checks that Internet gateways (IGWs) are only attached to an authorized Amazon Virtual Private Cloud (VPCs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/internet-gateway-authorized-vpc-only.html + */ + public static readonly INTERNET_GATEWAY_AUTHORIZED_VPC_ONLY = 'INTERNET_GATEWAY_AUTHORIZED_VPC_ONLY'; + /** + * Checks if Amazon Kinesis streams are encrypted at rest with server-side encryption. + * @see https://docs.aws.amazon.com/config/latest/developerguide/kinesis-stream-encrypted.html + */ + public static readonly KINESIS_STREAM_ENCRYPTED = 'KINESIS_STREAM_ENCRYPTED'; + /** + * Checks whether customer master keys (CMKs) are not scheduled for deletion in AWS Key Management Service (KMS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/kms-cmk-not-scheduled-for-deletion.html + */ + public static readonly KMS_CMK_NOT_SCHEDULED_FOR_DELETION = 'KMS_CMK_NOT_SCHEDULED_FOR_DELETION'; + /** + * Checks whether the AWS Lambda function is configured with function-level concurrent execution limit. + * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-concurrency-check.html + */ + public static readonly LAMBDA_CONCURRENCY_CHECK = 'LAMBDA_CONCURRENCY_CHECK'; + /** + * Checks whether an AWS Lambda function is configured with a dead-letter queue. + * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-dlq-check.html + */ + public static readonly LAMBDA_DLQ_CHECK = 'LAMBDA_DLQ_CHECK'; + /** + * Checks whether the AWS Lambda function policy attached to the Lambda resource prohibits public access. + * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-function-public-access-prohibited.html + */ + public static readonly LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED = 'LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED'; + /** + * Checks that the lambda function settings for runtime, role, timeout, and memory size match the expected values. + * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-function-settings-check.html + */ + public static readonly LAMBDA_FUNCTION_SETTINGS_CHECK = 'LAMBDA_FUNCTION_SETTINGS_CHECK'; + /** + * Checks whether an AWS Lambda function is in an Amazon Virtual Private Cloud. + * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-inside-vpc.html + */ + public static readonly LAMBDA_INSIDE_VPC = 'LAMBDA_INSIDE_VPC'; + /** + * Checks if Lambda has more than 1 availability zone associated. + * @see https://docs.aws.amazon.com/config/latest/developerguide/lambda-vpc-multi-az-check.html + */ + public static readonly LAMBDA_VPC_MULTI_AZ_CHECK = 'LAMBDA_VPC_MULTI_AZ_CHECK'; + /** + * Checks whether AWS Multi-Factor Authentication (MFA) is enabled for all IAM users that use a console password. + * @see https://docs.aws.amazon.com/config/latest/developerguide/mfa-enabled-for-iam-console-access.html + */ + public static readonly MFA_ENABLED_FOR_IAM_CONSOLE_ACCESS = 'MFA_ENABLED_FOR_IAM_CONSOLE_ACCESS'; + /** + * Checks that there is at least one multi-region AWS CloudTrail. + * @see https://docs.aws.amazon.com/config/latest/developerguide/multi-region-cloudtrail-enabled.html + */ + public static readonly CLOUDTRAIL_MULTI_REGION_ENABLED = 'MULTI_REGION_CLOUD_TRAIL_ENABLED'; + /** + * Checks if default ports for SSH/RDP ingress traffic for network access control lists (NACLs) is unrestricted. + * @see https://docs.aws.amazon.com/config/latest/developerguide/nacl-no-unrestricted-ssh-rdp.html + */ + public static readonly NACL_NO_UNRESTRICTED_SSH_RDP = 'NACL_NO_UNRESTRICTED_SSH_RDP'; + /** + * Checks if an AWS Network Firewall policy is configured with a user defined stateless default action for fragmented packets. + * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-policy-default-action-fragment-packets.html + */ + public static readonly NETFW_POLICY_DEFAULT_ACTION_FRAGMENT_PACKETS = 'NETFW_POLICY_DEFAULT_ACTION_FRAGMENT_PACKETS'; + /** + * Checks if an AWS Network Firewall policy is configured with a user defined default stateless action for full packets. + * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-policy-default-action-full-packets.html + */ + public static readonly NETFW_POLICY_DEFAULT_ACTION_FULL_PACKETS = 'NETFW_POLICY_DEFAULT_ACTION_FULL_PACKETS'; + /** + * Check AWS Network Firewall policy is associated with stateful OR stateless rule groups. + * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-policy-rule-group-associated.html + */ + public static readonly NETFW_POLICY_RULE_GROUP_ASSOCIATED = 'NETFW_POLICY_RULE_GROUP_ASSOCIATED'; + /** + * Checks if a Stateless Network Firewall Rule Group contains rules. + * @see https://docs.aws.amazon.com/config/latest/developerguide/netfw-stateless-rule-group-not-empty.html + */ + public static readonly NETFW_STATELESS_RULE_GROUP_NOT_EMPTY = 'NETFW_STATELESS_RULE_GROUP_NOT_EMPTY'; + /** + * Checks if cross-zone load balancing is enabled on Network Load Balancers (NLBs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/nlb-cross-zone-load-balancing-enabled.html + */ + public static readonly NLB_CROSS_ZONE_LOAD_BALANCING_ENABLED = 'NLB_CROSS_ZONE_LOAD_BALANCING_ENABLED'; + /** + * Checks if Amazon OpenSearch Service domains have fine-grained access control enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-access-control-enabled.html + */ + public static readonly OPENSEARCH_ACCESS_CONTROL_ENABLED = 'OPENSEARCH_ACCESS_CONTROL_ENABLED'; + /** + * Checks if Amazon OpenSearch Service domains have audit logging enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-audit-logging-enabled.html + */ + public static readonly OPENSEARCH_AUDIT_LOGGING_ENABLED = 'OPENSEARCH_AUDIT_LOGGING_ENABLED'; + /** + * Checks if Amazon OpenSearch Service domains are configured with at least three data nodes and zoneAwarenessEnabled is true. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-data-node-fault-tolerance.html + */ + public static readonly OPENSEARCH_DATA_NODE_FAULT_TOLERANCE = 'OPENSEARCH_DATA_NODE_FAULT_TOLERANCE'; + /** + * Checks if Amazon OpenSearch Service domains have encryption at rest configuration enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-encrypted-at-rest.html + */ + public static readonly OPENSEARCH_ENCRYPTED_AT_REST = 'OPENSEARCH_ENCRYPTED_AT_REST'; + /** + * Checks whether connections to OpenSearch domains are using HTTPS. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-https-required.html + */ + public static readonly OPENSEARCH_HTTPS_REQUIRED = 'OPENSEARCH_HTTPS_REQUIRED'; + /** + * Checks if Amazon OpenSearch Service domains are in an Amazon Virtual Private Cloud (VPC). + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-in-vpc-only.html + */ + public static readonly OPENSEARCH_IN_VPC_ONLY = 'OPENSEARCH_IN_VPC_ONLY'; + /** + * Checks if Amazon OpenSearch Service domains are configured to send logs to Amazon CloudWatch Logs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-logs-to-cloudwatch.html + */ + public static readonly OPENSEARCH_LOGS_TO_CLOUDWATCH = 'OPENSEARCH_LOGS_TO_CLOUDWATCH'; + /** + * Check if Amazon OpenSearch Service nodes are encrypted end to end. + * @see https://docs.aws.amazon.com/config/latest/developerguide/opensearch-node-to-node-encryption-check.html + */ + public static readonly OPENSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK = 'OPENSEARCH_NODE_TO_NODE_ENCRYPTION_CHECK'; + /** + * Checks if Amazon Relational Database Service (RDS) database instances are configured for automatic minor version upgrades. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-automatic-minor-version-upgrade-enabled.html + */ + public static readonly RDS_AUTOMATIC_MINOR_VERSION_UPGRADE_ENABLED = 'RDS_AUTOMATIC_MINOR_VERSION_UPGRADE_ENABLED'; + /** + * Checks if an Amazon Relational Database Service (Amazon RDS) database cluster has changed the admin username from its default value. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-default-admin-check.html + */ + public static readonly RDS_CLUSTER_DEFAULT_ADMIN_CHECK = 'RDS_CLUSTER_DEFAULT_ADMIN_CHECK'; + /** + * Checks if an Amazon Relational Database Service (Amazon RDS) cluster has deletion protection enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-deletion-protection-enabled.html + */ + public static readonly RDS_CLUSTER_DELETION_PROTECTION_ENABLED = 'RDS_CLUSTER_DELETION_PROTECTION_ENABLED'; + /** + * Checks if an Amazon RDS Cluster has AWS Identity and Access Management (IAM) authentication enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-iam-authentication-enabled.html + */ + public static readonly RDS_CLUSTER_IAM_AUTHENTICATION_ENABLED = 'RDS_CLUSTER_IAM_AUTHENTICATION_ENABLED'; + /** + * Checks if Multi-AZ replication is enabled on Amazon Aurora and Hermes clusters managed by Amazon Relational Database Service (Amazon RDS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-cluster-multi-az-enabled.html + */ + public static readonly RDS_CLUSTER_MULTI_AZ_ENABLED = 'RDS_CLUSTER_MULTI_AZ_ENABLED'; + /** + * Checks if an Amazon Relational Database Service (Amazon RDS) database has changed the admin username from its default value. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-default-admin-check.html + */ + public static readonly RDS_INSTANCE_DEFAULT_ADMIN_CHECK = 'RDS_INSTANCE_DEFAULT_ADMIN_CHECK'; + /** + *Checks if there are any Amazon Relational Database Service (RDS) DB security groups that are not the default DB security group. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-db-security-group-not-allowed.html + */ + public static readonly RDS_DB_SECURITY_GROUP_NOT_ALLOWED = 'RDS_DB_SECURITY_GROUP_NOT_ALLOWED'; + /** + * Checks if an Amazon Relational Database Service (Amazon RDS) instance has deletion protection enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-deletion-protection-enabled.html + */ + public static readonly RDS_INSTANCE_DELETION_PROTECTION_ENABLED = 'RDS_INSTANCE_DELETION_PROTECTION_ENABLED'; + /** + * Checks if an Amazon RDS instance has AWS Identity and Access Management (IAM) authentication enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-iam-authentication-enabled.html + */ + public static readonly RDS_INSTANCE_IAM_AUTHENTICATION_ENABLED = 'RDS_INSTANCE_IAM_AUTHENTICATION_ENABLED'; + /** + * Checks that respective logs of Amazon Relational Database Service (Amazon RDS) are enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-logging-enabled.html + */ + public static readonly RDS_LOGGING_ENABLED = 'RDS_LOGGING_ENABLED'; + /** + * Checks that Amazon Redshift automated snapshots are enabled for clusters. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-backup-enabled.html + */ + public static readonly REDSHIFT_BACKUP_ENABLED = 'REDSHIFT_BACKUP_ENABLED'; + /** + * Checks whether enhanced monitoring is enabled for Amazon Relational Database Service (Amazon RDS) instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-enhanced-monitoring-enabled.html + */ + public static readonly RDS_ENHANCED_MONITORING_ENABLED = 'RDS_ENHANCED_MONITORING_ENABLED'; + /** + * Checks whether Amazon Relational Database Service (Amazon RDS) DB snapshots are encrypted. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-snapshot-encrypted.html + */ + public static readonly RDS_SNAPSHOT_ENCRYPTED = 'RDS_SNAPSHOT_ENCRYPTED'; + /** + * Checks whether Amazon Redshift clusters require TLS/SSL encryption to connect to SQL clients. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-require-tls-ssl.html + */ + public static readonly REDSHIFT_REQUIRE_TLS_SSL = 'REDSHIFT_REQUIRE_TLS_SSL'; + /** + * Checks whether Amazon RDS database is present in back plans of AWS Backup. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-in-backup-plan.html + */ + public static readonly RDS_IN_BACKUP_PLAN = 'RDS_IN_BACKUP_PLAN'; + /** + * Checks if a recovery point was created for Amazon Relational Database Service (Amazon RDS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-last-backup-recovery-point-created.html + */ + public static readonly RDS_LAST_BACKUP_RECOVERY_POINT_CREATED = 'RDS_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Check whether the Amazon Relational Database Service instances are not publicly accessible. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-instance-public-access-check.html + */ + public static readonly RDS_INSTANCE_PUBLIC_ACCESS_CHECK = 'RDS_INSTANCE_PUBLIC_ACCESS_CHECK'; + /** + * Checks whether high availability is enabled for your RDS DB instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-multi-az-support.html + */ + public static readonly RDS_MULTI_AZ_SUPPORT = 'RDS_MULTI_AZ_SUPPORT'; + /** + * Checks if Amazon Relational Database Service (Amazon RDS) instances are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-resources-protected-by-backup-plan.html + */ + public static readonly RDS_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'RDS_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks if Amazon Relational Database Service (Amazon RDS) snapshots are public. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-snapshots-public-prohibited.html + */ + public static readonly RDS_SNAPSHOTS_PUBLIC_PROHIBITED = 'RDS_SNAPSHOTS_PUBLIC_PROHIBITED'; + /** + * Checks whether storage encryption is enabled for your RDS DB instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/rds-storage-encrypted.html + */ + public static readonly RDS_STORAGE_ENCRYPTED = 'RDS_STORAGE_ENCRYPTED'; + /** + * Checks if Amazon Redshift clusters are logging audits to a specific bucket. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-audit-logging-enabled.html + */ + public static readonly REDSHIFT_AUDIT_LOGGING_ENABLED = 'REDSHIFT_AUDIT_LOGGING_ENABLED'; + /** + * Checks whether Amazon Redshift clusters have the specified settings. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-configuration-check.html + */ + public static readonly REDSHIFT_CLUSTER_CONFIGURATION_CHECK = 'REDSHIFT_CLUSTER_CONFIGURATION_CHECK'; + /** + * Checks if Amazon Redshift clusters are using a specified AWS Key Management Service (AWS KMS) key for encryption. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-kms-enabled.html + */ + public static readonly REDSHIFT_CLUSTER_KMS_ENABLED = 'REDSHIFT_CLUSTER_KMS_ENABLED'; + /** + * Checks whether Amazon Redshift clusters have the specified maintenance settings. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-maintenancesettings-check.html + */ + public static readonly REDSHIFT_CLUSTER_MAINTENANCE_SETTINGS_CHECK = 'REDSHIFT_CLUSTER_MAINTENANCESETTINGS_CHECK'; + /** + * Checks whether Amazon Redshift clusters are not publicly accessible. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-cluster-public-access-check.html + */ + public static readonly REDSHIFT_CLUSTER_PUBLIC_ACCESS_CHECK = 'REDSHIFT_CLUSTER_PUBLIC_ACCESS_CHECK'; + /** + * Checks if an Amazon Redshift cluster has changed the admin username from its default value. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-default-admin-check.html + */ + public static readonly REDSHIFT_DEFAULT_ADMIN_CHECK = 'REDSHIFT_DEFAULT_ADMIN_CHECK'; + /** + * Checks if a Redshift cluster has changed its database name from the default value. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-default-db-name-check.html + */ + public static readonly REDSHIFT_DEFAULT_DB_NAME_CHECK = 'REDSHIFT_DEFAULT_DB_NAME_CHECK'; + /** + * Checks if Amazon Redshift cluster has 'enhancedVpcRouting' enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/redshift-enhanced-vpc-routing-enabled.html + */ + public static readonly REDSHIFT_ENHANCED_VPC_ROUTING_ENABLED = 'REDSHIFT_ENHANCED_VPC_ROUTING_ENABLED'; + /** + * Checks whether your resources have the tags that you specify. + * For example, you can check whether your Amazon EC2 instances have the CostCenter tag. + * @see https://docs.aws.amazon.com/config/latest/developerguide/required-tags.html + */ + public static readonly REQUIRED_TAGS = 'REQUIRED_TAGS'; + /** + * Checks whether the security groups in use do not allow unrestricted incoming TCP traffic to the specified ports. + * @see https://docs.aws.amazon.com/config/latest/developerguide/restricted-common-ports.html + */ + public static readonly EC2_SECURITY_GROUPS_RESTRICTED_INCOMING_TRAFFIC = 'RESTRICTED_INCOMING_TRAFFIC'; + /** + * Checks whether the incoming SSH traffic for the security groups is accessible. + * @see https://docs.aws.amazon.com/config/latest/developerguide/restricted-ssh.html + */ + public static readonly EC2_SECURITY_GROUPS_INCOMING_SSH_DISABLED = 'INCOMING_SSH_DISABLED'; + /** + * Checks whether your AWS account is enabled to use multi-factor authentication (MFA) hardware + * device to sign in with root credentials. + * @see https://docs.aws.amazon.com/config/latest/developerguide/root-account-hardware-mfa-enabled.html + */ + public static readonly ROOT_ACCOUNT_HARDWARE_MFA_ENABLED = 'ROOT_ACCOUNT_HARDWARE_MFA_ENABLED'; + /** + * Checks whether users of your AWS account require a multi-factor authentication (MFA) device + * to sign in with root credentials. + * @see https://docs.aws.amazon.com/config/latest/developerguide/root-account-mfa-enabled.html + */ + public static readonly ROOT_ACCOUNT_MFA_ENABLED = 'ROOT_ACCOUNT_MFA_ENABLED'; + /** + * Checks whether Amazon Simple Storage Service (Amazon S3) bucket has lock enabled, by default. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-default-lock-enabled.html + */ + public static readonly S3_BUCKET_DEFAULT_LOCK_ENABLED = 'S3_BUCKET_DEFAULT_LOCK_ENABLED'; + /** + * Checks whether the Amazon Simple Storage Service (Amazon S3) buckets are encrypted + * with AWS Key Management Service (AWS KMS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-default-encryption-kms.html + */ + public static readonly S3_DEFAULT_ENCRYPTION_KMS = 'S3_DEFAULT_ENCRYPTION_KMS'; + /** + * Checks that AWS Security Hub is enabled for an AWS account. + * @see https://docs.aws.amazon.com/config/latest/developerguide/securityhub-enabled.html + */ + public static readonly SECURITYHUB_ENABLED = 'SECURITYHUB_ENABLED'; + /** + * Checks whether Amazon SNS topic is encrypted with AWS Key Management Service (AWS KMS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/sns-encrypted-kms.html + */ + public static readonly SNS_ENCRYPTED_KMS = 'SNS_ENCRYPTED_KMS'; + /** + * Checks if Amazon Simple Notification Service (SNS) logging is enabled + * for the delivery status of notification messages sent to a topic for the endpoints. + * @see https://docs.aws.amazon.com/config/latest/developerguide/sns-topic-message-delivery-notification-enabled.html + */ + public static readonly SNS_TOPIC_MESSAGE_DELIVERY_NOTIFICATION_ENABLED = 'SNS_TOPIC_MESSAGE_DELIVERY_NOTIFICATION_ENABLED'; + /** + * Checks if AWS Systems Manager documents owned by the account are public. + * @see https://docs.aws.amazon.com/config/latest/developerguide/ssm-document-not-public.html + */ + public static readonly SSM_DOCUMENT_NOT_PUBLIC = 'SSM_DOCUMENT_NOT_PUBLIC'; + /** + * Checks if a recovery point was created for AWS Storage Gateway volumes. + * @see https://docs.aws.amazon.com/config/latest/developerguide/storagegateway-last-backup-recovery-point-created.html + */ + public static readonly STORAGEGATEWAY_LAST_BACKUP_RECOVERY_POINT_CREATED = 'STORAGEGATEWAY_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * hecks if Amazon Virtual Private Cloud (Amazon VPC) subnets are assigned a public IP address. + * @see https://docs.aws.amazon.com/config/latest/developerguide/subnet-auto-assign-public-ip-disabled.html + */ + public static readonly SUBNET_AUTO_ASSIGN_PUBLIC_IP_DISABLED = 'SUBNET_AUTO_ASSIGN_PUBLIC_IP_DISABLED'; + /** + * Checks whether the required public access block settings are configured from account level. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-account-level-public-access-blocks.html + */ + public static readonly S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS = 'S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS'; + /** + * Checks if the required public access block settings are configured from account level. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-account-level-public-access-blocks-periodic.html + */ + public static readonly S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS_PERIODIC = 'S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS_PERIODIC'; + /** + * Checks if Amazon Simple Storage Service (Amazon S3) Buckets allow user permissions through access control lists (ACLs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-acl-prohibited.html + */ + public static readonly S3_BUCKET_ACL_PROHIBITED = 'S3_BUCKET_ACL_PROHIBITED'; + /** + * Checks if the Amazon Simple Storage Service bucket policy does not allow blacklisted bucket-level + * and object-level actions on resources in the bucket for principals from other AWS accounts. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-blacklisted-actions-prohibited.html + */ + public static readonly S3_BUCKET_BLOCKED_ACTIONS_PROHIBITED = 'S3_BUCKET_BLACKLISTED_ACTIONS_PROHIBITED'; + /** + * Checks if Amazon Simple Storage Service (Amazon S3) buckets are publicly accessible. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-level-public-access-prohibited.html + */ + public static readonly S3_BUCKET_LEVEL_PUBLIC_ACCESS_PROHIBITED = 'S3_BUCKET_LEVEL_PUBLIC_ACCESS_PROHIBITED'; + /** + * Checks whether logging is enabled for your S3 buckets. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-logging-enabled.html + */ + public static readonly S3_BUCKET_LOGGING_ENABLED = 'S3_BUCKET_LOGGING_ENABLED'; + /** + * Checks that the access granted by the Amazon S3 bucket is restricted by any of the AWS principals, federated users, + * service principals, IP addresses, or VPCs that you provide. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-policy-grantee-check.html + */ + public static readonly S3_BUCKET_POLICY_GRANTEE_CHECK = 'S3_BUCKET_POLICY_GRANTEE_CHECK'; + /** + * Checks if your Amazon Simple Storage Service bucket policies do not allow other inter-account permissions + * than the control Amazon S3 bucket policy that you provide. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-policy-not-more-permissive.html + */ + public static readonly S3_BUCKET_POLICY_NOT_MORE_PERMISSIVE = 'S3_BUCKET_POLICY_NOT_MORE_PERMISSIVE'; + /** + * Checks if your Amazon S3 buckets do not allow public read access. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-public-read-prohibited.html + */ + public static readonly S3_BUCKET_PUBLIC_READ_PROHIBITED = 'S3_BUCKET_PUBLIC_READ_PROHIBITED'; + /** + * Checks that your Amazon S3 buckets do not allow public write access. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-public-write-prohibited.html + */ + public static readonly S3_BUCKET_PUBLIC_WRITE_PROHIBITED = 'S3_BUCKET_PUBLIC_WRITE_PROHIBITED'; + /** + * Checks whether S3 buckets have cross-region replication enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-replication-enabled.html + */ + public static readonly S3_BUCKET_REPLICATION_ENABLED = 'S3_BUCKET_REPLICATION_ENABLED'; + /** + * Checks that your Amazon S3 bucket either has Amazon S3 default encryption enabled or that the + * S3 bucket policy explicitly denies put-object requests without server side encryption that + * uses AES-256 or AWS Key Management Service. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-server-side-encryption-enabled.html + */ + public static readonly S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED = 'S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED'; + /** + * Checks whether S3 buckets have policies that require requests to use Secure Socket Layer (SSL). + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-ssl-requests-only.html + */ + public static readonly S3_BUCKET_SSL_REQUESTS_ONLY= 'S3_BUCKET_SSL_REQUESTS_ONLY'; + /** + * Checks whether versioning is enabled for your S3 buckets. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-versioning-enabled.html + */ + public static readonly S3_BUCKET_VERSIONING_ENABLED = 'S3_BUCKET_VERSIONING_ENABLED'; + /** + * Checks if Amazon S3 Events Notifications are enabled on an S3 bucket. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-event-notifications-enabled.html + */ + public static readonly S3_EVENT_NOTIFICATIONS_ENABLED = 'S3_EVENT_NOTIFICATIONS_ENABLED'; + /** + * Checks if a recovery point was created for Amazon Simple Storage Service (Amazon S3). + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-last-backup-recovery-point-created.html + */ + public static readonly S3_LAST_BACKUP_RECOVERY_POINT_CREATED = 'S3_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks if a lifecycle rule is configured for an Amazon Simple Storage Service (Amazon S3) bucket. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-lifecycle-policy-check.html + */ + public static readonly S3_LIFECYCLE_POLICY_CHECK = 'S3_LIFECYCLE_POLICY_CHECK'; + /** + * Checks if Amazon Simple Storage Service (Amazon S3) buckets are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-resources-protected-by-backup-plan.html + */ + public static readonly S3_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'S3_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks if Amazon Simple Storage Service (Amazon S3) version enabled buckets have lifecycle policy configured. + * @see https://docs.aws.amazon.com/config/latest/developerguide/s3-version-lifecycle-policy-check.html + */ + public static readonly S3_VERSION_LIFECYCLE_POLICY_CHECK = 'S3_VERSION_LIFECYCLE_POLICY_CHECK'; + /** + * Checks whether AWS Key Management Service (KMS) key is configured for an Amazon SageMaker endpoint configuration. + * @see https://docs.aws.amazon.com/config/latest/developerguide/sagemaker-endpoint-configuration-kms-key-configured.html + */ + public static readonly SAGEMAKER_ENDPOINT_CONFIGURATION_KMS_KEY_CONFIGURED = 'SAGEMAKER_ENDPOINT_CONFIGURATION_KMS_KEY_CONFIGURED'; + /** + * Check whether an AWS Key Management Service (KMS) key is configured for SageMaker notebook instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/sagemaker-notebook-instance-kms-key-configured.html + */ + public static readonly SAGEMAKER_NOTEBOOK_INSTANCE_KMS_KEY_CONFIGURED = 'SAGEMAKER_NOTEBOOK_INSTANCE_KMS_KEY_CONFIGURED'; + /** + * Checks whether direct internet access is disabled for an Amazon SageMaker notebook instance. + * @see https://docs.aws.amazon.com/config/latest/developerguide/sagemaker-notebook-no-direct-internet-access.html + */ + public static readonly SAGEMAKER_NOTEBOOK_NO_DIRECT_INTERNET_ACCESS = 'SAGEMAKER_NOTEBOOK_NO_DIRECT_INTERNET_ACCESS'; + /** + * Checks whether AWS Secrets Manager secret has rotation enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-rotation-enabled-check.html + */ + public static readonly SECRETSMANAGER_ROTATION_ENABLED_CHECK = 'SECRETSMANAGER_ROTATION_ENABLED_CHECK'; + /** + * Checks whether AWS Secrets Manager secret rotation has rotated successfully as per the rotation schedule. + * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-scheduled-rotation-success-check.html + */ + public static readonly SECRETSMANAGER_SCHEDULED_ROTATION_SUCCESS_CHECK = 'SECRETSMANAGER_SCHEDULED_ROTATION_SUCCESS_CHECK'; + /** + * Checks if AWS Secrets Manager secrets have been rotated in the past specified number of days. + * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-secret-periodic-rotation.html + */ + public static readonly SECRETSMANAGER_SECRET_PERIODIC_ROTATION = 'SECRETSMANAGER_SECRET_PERIODIC_ROTATION'; + /** + * Checks if AWS Secrets Manager secrets have been accessed within a specified number of days. + * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-secret-unused.html + */ + public static readonly SECRETSMANAGER_SECRET_UNUSED = 'SECRETSMANAGER_SECRET_UNUSED'; + /** + * Checks if all secrets in AWS Secrets Manager are encrypted using the AWS managed key (aws/secretsmanager) + * or a customer managed key that was created in AWS Key Management Service (AWS KMS). + * @see https://docs.aws.amazon.com/config/latest/developerguide/secretsmanager-using-cmk.html + */ + public static readonly SECRETSMANAGER_USING_CMK = 'SECRETSMANAGER_USING_CMK'; + /** + * Checks whether Service Endpoint for the service provided in rule parameter is created for each Amazon VPC. + * @see https://docs.aws.amazon.com/config/latest/developerguide/service-vpc-endpoint-enabled.html + */ + public static readonly SERVICE_VPC_ENDPOINT_ENABLED = 'SERVICE_VPC_ENDPOINT_ENABLED'; + /** + * Checks whether EBS volumes are attached to EC2 instances. + * @see https://docs.aws.amazon.com/config/latest/developerguide/shield-advanced-enabled-autorenew.html + */ + public static readonly SHIELD_ADVANCED_ENABLED_AUTO_RENEW = 'SHIELD_ADVANCED_ENABLED_AUTORENEW'; + /** + * Verify that DDoS response team (DRT) can access AWS account. + * @see https://docs.aws.amazon.com/config/latest/developerguide/shield-drt-access.html + */ + public static readonly SHIELD_DRT_ACCESS = 'SHIELD_DRT_ACCESS'; + /** + * Checks if a recovery point was created for AWS Backup-Gateway VirtualMachines. + * @see https://docs.aws.amazon.com/config/latest/developerguide/virtualmachine-last-backup-recovery-point-created.html + */ + public static readonly VIRTUALMACHINE_LAST_BACKUP_RECOVERY_POINT_CREATED = 'VIRTUALMACHINE_LAST_BACKUP_RECOVERY_POINT_CREATED'; + /** + * Checks if AWS Backup-Gateway VirtualMachines are protected by a backup plan. + * @see https://docs.aws.amazon.com/config/latest/developerguide/virtualmachine-resources-protected-by-backup-plan.html + */ + public static readonly VIRTUALMACHINE_RESOURCES_PROTECTED_BY_BACKUP_PLAN = 'VIRTUALMACHINE_RESOURCES_PROTECTED_BY_BACKUP_PLAN'; + /** + * Checks that the default security group of any Amazon Virtual Private Cloud (VPC) does not + * allow inbound or outbound traffic. The rule returns NOT_APPLICABLE if the security group + * is not default. + * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-default-security-group-closed.html + */ + public static readonly VPC_DEFAULT_SECURITY_GROUP_CLOSED = 'VPC_DEFAULT_SECURITY_GROUP_CLOSED'; + /** + * Checks whether Amazon Virtual Private Cloud flow logs are found and enabled for Amazon VPC. + * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-flow-logs-enabled.html + */ + public static readonly VPC_FLOW_LOGS_ENABLED = 'VPC_FLOW_LOGS_ENABLED'; + /** + * Checks if there are unused network access control lists (network ACLs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-network-acl-unused-check.html + */ + public static readonly VPC_NETWORK_ACL_UNUSED_CHECK = 'VPC_NETWORK_ACL_UNUSED_CHECK'; + /** + * Checks if DNS resolution from accepter/requester VPC to private IP is enabled. + * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-peering-dns-resolution-check.html + */ + public static readonly VPC_PEERING_DNS_RESOLUTION_CHECK = 'VPC_PEERING_DNS_RESOLUTION_CHECK'; + /** + * Checks whether the security group with 0.0.0.0/0 of any Amazon Virtual Private Cloud (Amazon VPC) + * allows only specific inbound TCP or UDP traffic. + * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-sg-open-only-to-authorized-ports.html + */ + public static readonly VPC_SG_OPEN_ONLY_TO_AUTHORIZED_PORTS = 'VPC_SG_OPEN_ONLY_TO_AUTHORIZED_PORTS'; + /** + * Checks that both AWS Virtual Private Network tunnels provided by AWS Site-to-Site VPN are in + * UP status. + * @see https://docs.aws.amazon.com/config/latest/developerguide/vpc-vpn-2-tunnels-up.html + */ + public static readonly VPC_VPN_2_TUNNELS_UP = 'VPC_VPN_2_TUNNELS_UP'; + /** + * Checks if logging is enabled on AWS Web Application Firewall (WAF) classic global web ACLs. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-classic-logging-enabled.html + */ + public static readonly WAF_CLASSIC_LOGGING_ENABLED = 'WAF_CLASSIC_LOGGING_ENABLED'; + /** + * Checks whether logging is enabled on AWS Web Application Firewall (WAFV2) regional and global + * web access control list (ACLs). + * @see https://docs.aws.amazon.com/config/latest/developerguide/wafv2-logging-enabled.html + */ + public static readonly WAFV2_LOGGING_ENABLED = 'WAFV2_LOGGING_ENABLED'; + /** + * Checks if an AWS WAF Classic rule group contains any rules. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-global-rulegroup-not-empty.html + */ + public static readonly WAF_GLOBAL_RULEGROUP_NOT_EMPTY = 'WAF_GLOBAL_RULEGROUP_NOT_EMPTY'; + /** + * Checks if an AWS WAF global rule contains any conditions. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-global-rule-not-empty.html + */ + public static readonly WAF_GLOBAL_RULE_NOT_EMPTY = 'WAF_GLOBAL_RULE_NOT_EMPTY'; + /** + * Checks whether a WAF Global Web ACL contains any WAF rules or rule groups. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-global-webacl-not-empty.html + */ + public static readonly WAF_GLOBAL_WEBACL_NOT_EMPTY = 'WAF_GLOBAL_WEBACL_NOT_EMPTY'; + /** + * Checks if WAF Regional rule groups contain any rules. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-regional-rulegroup-not-empty.html + */ + public static readonly WAF_REGIONAL_RULEGROUP_NOT_EMPTY = 'WAF_REGIONAL_RULEGROUP_NOT_EMPTY'; + /** + * Checks whether WAF regional rule contains conditions. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-regional-rule-not-empty.html + */ + public static readonly WAF_REGIONAL_RULE_NOT_EMPTY = 'WAF_REGIONAL_RULE_NOT_EMPTY'; + /** + * Checks if a WAF regional Web ACL contains any WAF rules or rule groups. + * @see https://docs.aws.amazon.com/config/latest/developerguide/waf-regional-webacl-not-empty.html + */ + public static readonly WAF_REGIONAL_WEBACL_NOT_EMPTY = 'WAF_REGIONAL_WEBACL_NOT_EMPTY'; + + // utility class + private constructor() { } +} + +/** + * Resources types that are supported by AWS Config + * @see https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html + */ +export class ResourceType { + /** API Gateway Stage */ + public static readonly APIGATEWAY_STAGE = new ResourceType('AWS::ApiGateway::Stage'); + /** API Gatewayv2 Stage */ + public static readonly APIGATEWAYV2_STAGE = new ResourceType('AWS::ApiGatewayV2::Stage'); + /** API Gateway REST API */ + public static readonly APIGATEWAY_REST_API = new ResourceType('AWS::ApiGateway::RestApi'); + /** API Gatewayv2 API */ + public static readonly APIGATEWAYV2_API = new ResourceType('AWS::ApiGatewayV2::Api'); + /** Amazon CloudFront Distribution */ + public static readonly CLOUDFRONT_DISTRIBUTION = new ResourceType('AWS::CloudFront::Distribution'); + /** Amazon CloudFront streaming distribution */ + public static readonly CLOUDFRONT_STREAMING_DISTRIBUTION = new ResourceType('AWS::CloudFront::StreamingDistribution'); + /** Amazon CloudWatch Alarm */ + public static readonly CLOUDWATCH_ALARM = new ResourceType('AWS::CloudWatch::Alarm'); + /** Amazon CloudWatch RUM */ + public static readonly CLOUDWATCH_RUM_APP_MONITOR = new ResourceType('AWS::RUM::AppMonitor'); + /** Amazon DynamoDB Table */ + public static readonly DYNAMODB_TABLE = new ResourceType('AWS::DynamoDB::Table'); + /** Elastic Block Store (EBS) volume */ + public static readonly EBS_VOLUME = new ResourceType('AWS::EC2::Volume'); + /** EC2 host */ + public static readonly EC2_HOST = new ResourceType('AWS::EC2::Host'); + /** EC2 Elastic IP */ + public static readonly EC2_EIP = new ResourceType('AWS::EC2::EIP'); + /** EC2 instance */ + public static readonly EC2_INSTANCE = new ResourceType('AWS::EC2::Instance'); + /** EC2 Network Interface */ + public static readonly EC2_NETWORK_INTERFACE = new ResourceType('AWS::EC2::NetworkInterface'); + /** EC2 security group */ + public static readonly EC2_SECURITY_GROUP = new ResourceType('AWS::EC2::SecurityGroup'); + /** EC2 NAT gateway */ + public static readonly EC2_NAT_GATEWAY = new ResourceType('AWS::EC2::NatGateway'); + /** EC2 Egress only internet gateway */ + public static readonly EC2_EGRESS_ONLY_INTERNET_GATEWAY = new ResourceType('AWS::EC2::EgressOnlyInternetGateway'); + /** EC2 flow log */ + public static readonly EC2_FLOW_LOG = new ResourceType('AWS::EC2::FlowLog'); + /** EC2 transit gateway */ + public static readonly EC2_TRANSIT_GATEWAY = new ResourceType('AWS::EC2::TransitGateway'); + /** EC2 transit gateway attachment */ + public static readonly EC2_TRANSIT_GATEWAY_ATTACHMENT = new ResourceType('AWS::EC2::TransitGatewayAttachment'); + /** EC2 transit gateway route table */ + public static readonly EC2_TRANSIT_GATEWAY_ROUTE_TABLE = new ResourceType('AWS::EC2::TransitGatewayRouteTable'); + /** EC2 VPC endpoint */ + public static readonly EC2_VPC_ENDPOINT = new ResourceType('AWS::EC2::VPCEndpoint'); + /** EC2 VPC endpoint service */ + public static readonly EC2_VPC_ENDPOINT_SERVICE = new ResourceType('AWS::EC2::VPCEndpointService'); + /** EC2 VPC peering connection */ + public static readonly EC2_VPC_PEERING_CONNECTION = new ResourceType('AWS::EC2::VPCPeeringConnection'); + /** EC2 registered HA instance */ + public static readonly EC2_REGISTERED_HA_INSTANCE = new ResourceType('AWS::EC2::RegisteredHAInstance'); + /** EC2 launch template */ + public static readonly EC2_LAUNCH_TEMPLATE = new ResourceType('AWS::EC2::LaunchTemplate'); + /** EC2 Network Insights Access Scope Analysis */ + public static readonly EC2_NETWORK_INSIGHTS_ACCESS_SCOPE_ANALYSIS = new ResourceType('AWS::EC2::NetworkInsightsAccessScopeAnalysis'); + /** EC2 Image Builder ContainerRecipe */ + public static readonly IMAGEBUILDER_CONTAINER_RECIPE = new ResourceType('AWS::ImageBuilder::ContainerRecipe'); + /** EC2 Image Builder DistributionConfiguration */ + public static readonly IMAGEBUILDER_DISTRIBUTION_CONFIGURATION = new ResourceType('AWS::ImageBuilder::DistributionConfiguration'); + /** EC2 Image Builder InfrastructureConfiguration */ + public static readonly IMAGEBUILDER_INFRASTRUCTURE_CONFIGURATION = new ResourceType('AWS::ImageBuilder::InfrastructureConfiguration'); + /** Amazon ECR repository */ + public static readonly ECR_REPOSITORY = new ResourceType('AWS::ECR::Repository'); + /** Amazon ECR registry policy */ + public static readonly ECR_REGISTRY_POLICY = new ResourceType('AWS::ECR::RegistryPolicy'); + /** Amazon ECR public repository */ + public static readonly ECR_PUBLIC_REPOSITORY = new ResourceType('AWS::ECR::PublicRepository'); + /** Amazon ECS cluster */ + public static readonly ECS_CLUSTER = new ResourceType('AWS::ECS::Cluster'); + /** Amazon ECS task definition */ + public static readonly ECS_TASK_DEFINITION = new ResourceType('AWS::ECS::TaskDefinition'); + /** Amazon ECS service */ + public static readonly ECS_SERVICE = new ResourceType('AWS::ECS::Service'); + /** Amazon EFS file system */ + public static readonly EFS_FILE_SYSTEM = new ResourceType('AWS::EFS::FileSystem'); + /** Amazon EFS access point */ + public static readonly EFS_ACCESS_POINT = new ResourceType('AWS::EFS::AccessPoint'); + /** Amazon Elastic Kubernetes Service cluster */ + public static readonly EKS_CLUSTER = new ResourceType('AWS::EKS::Cluster'); + /** Amazon Elastic Kubernetes Service identity provider config */ + public static readonly EKS_IDENTITY_PROVIDER_CONFIG = new ResourceType('AWS::EKS::IdentityProviderConfig'); + /** Amazon Elastic Kubernetes Service addon */ + public static readonly EKS_ADDON = new ResourceType('AWS::EKS::Addon'); + /** Amazon EMR security configuration */ + public static readonly EMR_SECURITY_CONFIGURATION = new ResourceType('AWS::EMR::SecurityConfiguration'); + /** Amazon EventBridge EventBus */ + public static readonly EVENTBRIDGE_EVENTBUS = new ResourceType('AWS::Events::EventBus'); + /** Amazon EventBridge Api Destination */ + public static readonly EVENTBRIDGE_API_DESTINATION = new ResourceType('AWS::Events::ApiDestination'); + /** Amazon EventBridge Archive */ + public static readonly EVENTBRIDGE_ARCHIVE = new ResourceType('AWS::Events::Archive'); + /** Amazon EventBridge Endpoint */ + public static readonly EVENTBRIDGE_ENDPOINT = new ResourceType('AWS::Events::Endpoint'); + /** Amazon EventBridge EventSchemas registry */ + public static readonly EVENTSCHEMAS_REGISTRY = new ResourceType('AWS::EventSchemas::Registry'); + /** Amazon EventBridge EventSchemas registry policy */ + public static readonly EVENTSCHEMAS_REGISTRY_POLICY = new ResourceType('AWS::EventSchemas::RegistryPolicy'); + /** Amazon EventBridge EventSchemas discoverer */ + public static readonly EVENTSCHEMAS_DISCOVERER = new ResourceType('AWS::EventSchemas::Discoverer'); + /** AWS FraudDetector label */ + public static readonly FRAUDDETECTOR_LABEL = new ResourceType('AWS::FraudDetector::Label'); + /** AWS FraudDetector entity type */ + public static readonly FRAUDDETECTOR_ENTITY_TYPE = new ResourceType('AWS::FraudDetector::EntityType'); + /** AWS FraudDetector variable */ + public static readonly FRAUDDETECTOR_VARIABLE = new ResourceType('AWS::FraudDetector::Variable'); + /** AWS FraudDetector outcome */ + public static readonly FRAUDDETECTOR_OUTCOME = new ResourceType('AWS::FraudDetector::Outcome'); + /** Amazon GuardDuty detector */ + public static readonly GUARDDUTY_DETECTOR = new ResourceType('AWS::GuardDuty::Detector'); + /** Amazon GuardDuty Threat Intel Set */ + public static readonly GUARDDUTY_THREAT_INTEL_SET = new ResourceType('AWS::GuardDuty::ThreatIntelSet'); + /** Amazon GuardDuty IP Set */ + public static readonly GUARDDUTY_IP_SET = new ResourceType(' AWS::GuardDuty::IPSet'); + /** Amazon GuardDuty Filter */ + public static readonly GUARDDUTY_FILTER = new ResourceType('AWS::GuardDuty::Filter'); + /** Amazon ElasticSearch domain */ + public static readonly ELASTICSEARCH_DOMAIN = new ResourceType('AWS::Elasticsearch::Domain'); + /** Amazon Interactive Video Service (IVS) channel */ + public static readonly IVS_CHANNEL = new ResourceType('AWS::IVS::Channel'); + /** Amazon Interactive Video Service (IVS) recording configuration */ + public static readonly IVS_RECORDING_CONFIGURATION = new ResourceType('AWS::IVS::RecordingConfiguration'); + /** Amazon Interactive Video Service (IVS) playback key pair */ + public static readonly IVS_PLAYBACK_KEYPAIR = new ResourceType('AWS::IVS::PlaybackKeyPair'); + /** Amazon OpenSearch domain */ + public static readonly OPENSEARCH_DOMAIN = new ResourceType('AWS::OpenSearch::Domain'); + /** Amazon QLDB ledger */ + public static readonly QLDB_LEDGER = new ResourceType('AWS::QLDB::Ledger'); + /** Amazon Kinesis stream */ + public static readonly KINESIS_STREAM = new ResourceType('AWS::Kinesis::Stream'); + /** Amazon Kinesis stream consumer */ + public static readonly KINESIS_STREAM_CONSUMER = new ResourceType('AWS::Kinesis::StreamConsumer'); + /** Amazon Kinesis Analytics V2 application */ + public static readonly KINESIS_ANALYTICS_V2_APPLICATION = new ResourceType('AWS::KinesisAnalyticsV2::Application'); + /** Amazon Lightsail Certificate */ + public static readonly LIGHTSAIL_CERTIFICATE = new ResourceType('AWS::Lightsail::Certificate'); + /** Amazon Lightsail Disk */ + public static readonly LIGHTSAIL_DISK = new ResourceType('AWS::Lightsail::Disk'); + /** AWS Lightsail bucket */ + public static readonly LIGHTSAIL_BUCKET = new ResourceType('AWS::Lightsail::Bucket'); + /** AWS Lightsail static IP */ + public static readonly LIGHTSAIL_STATIC_IP = new ResourceType('AWS::Lightsail::StaticIp'); + /** Amazon MQ broker */ + public static readonly AMAZON_MQ_BROKER = new ResourceType('AWS::AmazonMQ::Broker'); + /** Amazon MSK cluster */ + public static readonly MSK_CLUSTER = new ResourceType('AWS::MSK::Cluster'); + /** Amazon Redshift cluster */ + public static readonly REDSHIFT_CLUSTER = new ResourceType('AWS::Redshift::Cluster'); + /** Amazon Redshift cluster parameter group */ + public static readonly REDSHIFT_CLUSTER_PARAMETER_GROUP = new ResourceType('AWS::Redshift::ClusterParameterGroup'); + /** Amazon Redshift cluster security group */ + public static readonly REDSHIFT_CLUSTER_SECURITY_GROUP = new ResourceType('AWS::Redshift::ClusterSecurityGroup'); + /** Amazon Redshift cluster snapshot */ + public static readonly REDSHIFT_CLUSTER_SNAPSHOT = new ResourceType('AWS::Redshift::ClusterSnapshot'); + /** Amazon Redshift cluster subnet group */ + public static readonly REDSHIFT_CLUSTER_SUBNET_GROUP = new ResourceType('AWS::Redshift::ClusterSubnetGroup'); + /** Amazon Redshift event subscription */ + public static readonly REDSHIFT_EVENT_SUBSCRIPTION = new ResourceType('AWS::Redshift::EventSubscription'); + /** Amazon RDS database instance */ + public static readonly RDS_DB_INSTANCE = new ResourceType('AWS::RDS::DBInstance'); + /** Amazon RDS database security group */ + public static readonly RDS_DB_SECURITY_GROUP = new ResourceType('AWS::RDS::DBSecurityGroup'); + /** Amazon RDS database snapshot */ + public static readonly RDS_DB_SNAPSHOT = new ResourceType('AWS::RDS::DBSnapshot'); + /** Amazon RDS database subnet group */ + public static readonly RDS_DB_SUBNET_GROUP = new ResourceType('AWS::RDS::DBSubnetGroup'); + /** Amazon RDS event subscription */ + public static readonly RDS_EVENT_SUBSCRIPTION = new ResourceType('AWS::RDS::EventSubscription'); + /** Amazon RDS database cluster */ + public static readonly RDS_DB_CLUSTER = new ResourceType('AWS::RDS::DBCluster'); + /** Amazon RDS database cluster snapshot */ + public static readonly RDS_DB_CLUSTER_SNAPSHOT = new ResourceType('AWS::RDS::DBClusterSnapshot'); + /** Amazon RDS global cluster */ + public static readonly RDS_GLOBAL_CLUSTER = new ResourceType('AWS::RDS::GlobalCluster'); + /** Amazon Route53 Hosted Zone */ + public static readonly ROUTE53_HOSTED_ZONE= new ResourceType('AWS::Route53::HostedZone'); + /** Amazon Route53 Health Check */ + public static readonly ROUTE53_HEALTH_CHECK = new ResourceType('AWS::Route53::HealthCheck'); + /** Amazon Route53 resolver resolver endpoint */ + public static readonly ROUTE53_RESOLVER_RESOLVER_ENDPOINT = new ResourceType('AWS::Route53Resolver::ResolverEndpoint'); + /** Amazon Route53 resolver resolver rule */ + public static readonly ROUTE53_RESOLVER_RESOLVER_RULE = new ResourceType('AWS::Route53Resolver::ResolverRule'); + /** Amazon Route53 resolver resolver rule association */ + public static readonly ROUTE53_RESOLVER_RESOLVER_RULE_ASSOCIATION = new ResourceType('AWS::Route53Resolver::ResolverRuleAssociation'); + /** Amazon Route 53 Application Recovery Controller Cell */ + public static readonly ROUTE53_RECOVERY_READINESS_CELL = new ResourceType('AWS::Route53RecoveryReadiness::Cell'); + /** Amazon Route 53 Application Recovery Controller Readiness Check */ + public static readonly ROUTE53_RECOVERY_READINESS_READINESS_CHECK = new ResourceType('AWS::Route53RecoveryReadiness::ReadinessCheck'); + /** Amazon Route53 recovery readiness recovery group */ + public static readonly ROUTE53_RECOVERY_READINESS_RECOVERY_GROUP = new ResourceType('AWS::Route53RecoveryReadiness::RecoveryGroup'); + /** Amazon SQS queue */ + public static readonly SQS_QUEUE = new ResourceType('AWS::SQS::Queue'); + /** Amazon SNS topic */ + public static readonly SNS_TOPIC = new ResourceType('AWS::SNS::Topic'); + /** Amazon S3 bucket */ + public static readonly S3_BUCKET = new ResourceType('AWS::S3::Bucket'); + /** Amazon S3 Multi-Region Access Point */ + public static readonly S3_MULTIREGION_ACCESS_POINT = new ResourceType('AWS::S3::MultiRegionAccessPoint'); + /** Amazon SageMaker code repository */ + public static readonly SAGEMAKER_CODE_REPOSITORY = new ResourceType('AWS::SageMaker::CodeRepository'); + /** Amazon SageMaker model */ + public static readonly SAGEMAKER_MODEL = new ResourceType('AWS::SageMaker::Model'); + /** Amazon SageMaker notebook instance */ + public static readonly SAGEMAKER_NOTEBOOK_INSTANCE = new ResourceType('AWS::SageMaker::NotebookInstance'); + /** Amazon SageMaker workteam */ + public static readonly SAGEMAKER_WORKTEAM = new ResourceType('AWS::SageMaker::Workteam'); + /** Amazon SES Configuration Set */ + public static readonly SES_CONFIGURATION_SET = new ResourceType('AWS::SES::ConfigurationSet'); + /** Amazon SES Contact List */ + public static readonly SES_CONTACT_LIST = new ResourceType('AWS::SES::ContactList'); + /** Amazon SES Template */ + public static readonly SES_TEMPLATE = new ResourceType('AWS::SES::Template'); + /** Amazon SES ReceiptFilter */ + public static readonly SES_RECEIPT_FILTER = new ResourceType('AWS::SES::ReceiptFilter'); + /** Amazon SES ReceiptRuleSet */ + public static readonly SES_RECEIPT_RECEIPT_RULE_SET = new ResourceType('AWS::SES::ReceiptRuleSet'); + /** Amazon S3 account public access block */ + public static readonly S3_ACCOUNT_PUBLIC_ACCESS_BLOCK = new ResourceType('AWS::S3::AccountPublicAccessBlock'); + /** Amazon EC2 customer gateway */ + public static readonly EC2_CUSTOMER_GATEWAY = new ResourceType('AWS::EC2::CustomerGateway'); + /** Amazon EC2 internet gateway */ + public static readonly EC2_INTERNET_GATEWAY = new ResourceType('AWS::EC2::InternetGateway'); + /** Amazon EC2 network ACL */ + public static readonly EC2_NETWORK_ACL = new ResourceType('AWS::EC2::NetworkAcl'); + /** Amazon EC2 route table */ + public static readonly EC2_ROUTE_TABLE = new ResourceType('AWS::EC2::RouteTable'); + /** Amazon EC2 subnet table */ + public static readonly EC2_SUBNET = new ResourceType('AWS::EC2::Subnet'); + /** Amazon EC2 VPC */ + public static readonly EC2_VPC = new ResourceType('AWS::EC2::VPC'); + /** Amazon EC2 VPN connection */ + public static readonly EC2_VPN_CONNECTION = new ResourceType('AWS::EC2::VPNConnection'); + /** Amazon EC2 VPN gateway */ + public static readonly EC2_VPN_GATEWAY = new ResourceType('AWS::EC2::VPNGateway'); + /** AWS Auto Scaling group */ + public static readonly AUTO_SCALING_GROUP = new ResourceType('AWS::AutoScaling::AutoScalingGroup'); + /** AWS Auto Scaling launch configuration */ + public static readonly AUTO_SCALING_LAUNCH_CONFIGURATION = new ResourceType('AWS::AutoScaling::LaunchConfiguration'); + /** AWS Auto Scaling policy */ + public static readonly AUTO_SCALING_POLICY = new ResourceType('AWS::AutoScaling::ScalingPolicy'); + /** AWS Auto Scaling scheduled action */ + public static readonly AUTO_SCALING_SCHEDULED_ACTION = new ResourceType('AWS::AutoScaling::ScheduledAction'); + /** Amazon WorkSpaces connection alias */ + public static readonly WORKSPACES_CONNECTION_ALIAS = new ResourceType('AWS::WorkSpaces::ConnectionAlias'); + /** Amazon WorkSpaces workSpace */ + public static readonly WORKSPACES_WORKSPACE = new ResourceType('AWS::WorkSpaces::Workspace'); + /** AWS AppConfig application */ + public static readonly APPCONFIG_APPLICATION = new ResourceType('AWS::AppConfig::Application'); + /** AWS AppConfig environment */ + public static readonly APPCONFIG_ENVIRONMENT = new ResourceType('AWS::AppConfig::Environment'); + /** AWS AppConfig configuration profile */ + public static readonly APPCONFIG_CONFIGURATION_PROFILE = new ResourceType('AWS::AppConfig::ConfigurationProfile'); + /** AWS AppSync GraphQL Api */ + public static readonly APPSYNC_GRAPHQL_API = new ResourceType('AWS::AppSync::GraphQLApi'); + /** AWS Backup backup plan */ + public static readonly BACKUP_BACKUP_PLAN = new ResourceType('AWS::Backup::BackupPlan'); + /** AWS Backup backup selection */ + public static readonly BACKUP_BACKUP_SELECTION = new ResourceType('AWS::Backup::BackupSelection'); + /** AWS Backup backup vault */ + public static readonly BACKUP_BACKUP_VAULT = new ResourceType('AWS::Backup::BackupVault'); + /** AWS Backup recovery point */ + public static readonly BACKUP_RECOVERY_POINT = new ResourceType('AWS::Backup::RecoveryPoint'); + /** AWS Backup report plan */ + public static readonly BACKUP_REPORT_PLAN = new ResourceType('AWS::Backup::ReportPlan'); + /** AWS Batch job queue */ + public static readonly BATCH_JOB_QUEUE = new ResourceType('AWS::Batch::JobQueue'); + /** AWS Batch compute environment */ + public static readonly BATCH_COMPUTE_ENVIRONMENT = new ResourceType('AWS::Batch::ComputeEnvironment'); + /** AWS Certificate manager certificate */ + public static readonly ACM_CERTIFICATE = new ResourceType('AWS::ACM::Certificate'); + /** AWS CloudFormation stack */ + public static readonly CLOUDFORMATION_STACK = new ResourceType('AWS::CloudFormation::Stack'); + /** AWS CloudTrail trail */ + public static readonly CLOUDTRAIL_TRAIL = new ResourceType('AWS::CloudTrail::Trail'); + /** AWS Cloud9 environment EC2 */ + public static readonly CLOUD9_ENVIRONMENT_EC2 = new ResourceType('AWS::Cloud9::EnvironmentEC2'); + /** AWS Cloud Map(ServiceDiscovery) service */ + public static readonly SERVICEDISCOVERY_SERVICE = new ResourceType('AWS::ServiceDiscovery::Service'); + /** AWS Cloud Map(ServiceDiscovery) Public Dns Namespace */ + public static readonly SERVICEDISCOVERY_PUBLIC_DNS_NAMESPACE = new ResourceType('AWS::ServiceDiscovery::PublicDnsNamespace'); + /** AWS Cloud Map(ServiceDiscovery) Http Namespace */ + public static readonly SERVICEDISCOVERY_HTTP_NAMESPACE = new ResourceType('AWS::ServiceDiscovery::HttpNamespace'); + /** AWS CodeBuild project */ + public static readonly CODEBUILD_PROJECT = new ResourceType('AWS::CodeBuild::Project'); + /** AWS CodeDeploy application */ + public static readonly CODEDEPLOY_APPLICATION = new ResourceType('AWS::CodeDeploy::Application'); + /** AWS CodeDeploy deployment config */ + public static readonly CODEDEPLOY_DEPLOYMENT_CONFIG = new ResourceType('AWS::CodeDeploy::DeploymentConfig'); + /** AWS CodeDeploy deployment group */ + public static readonly CODEDEPLOY_DEPLOYMENT_GROUP = new ResourceType('AWS::CodeDeploy::DeploymentGroup'); + /** AWS CodePipeline pipeline */ + public static readonly CODEPIPELINE_PIPELINE = new ResourceType('AWS::CodePipeline::Pipeline'); + /** AWS Config resource compliance */ + public static readonly CONFIG_RESOURCE_COMPLIANCE = new ResourceType('AWS::Config::ResourceCompliance'); + /** AWS Config conformance pack compliance */ + public static readonly CONFIG_CONFORMANCE_PACK_COMPLIANCE = new ResourceType('AWS::Config::ConformancePackCompliance'); + /** AWS DMS event subscription */ + public static readonly DMS_EVENT_SUBSCRIPTION = new ResourceType('AWS::DMS::EventSubscription'); + /** AWS DMS replication subnet group */ + public static readonly DMS_REPLICATION_SUBNET_GROUP = new ResourceType('AWS::DMS::ReplicationSubnetGroup'); + /** AWS DataSync location SMB */ + public static readonly DATASYNC_LOCATION_SMB = new ResourceType('AWS::DataSync::LocationSMB'); + /** AWS DataSync location FSx Lustre */ + public static readonly DATASYNC_LOCATION_FSX_LUSTRE = new ResourceType('AWS::DataSync::LocationFSxLustre'); + /** AWS DataSync location FSx Windows */ + public static readonly DATASYNC_LOCATION_FSX_WINDOWS = new ResourceType('AWS::DataSync::LocationFSxWindows'); + /** AWS DataSync location S3 */ + public static readonly DATASYNC_LOCATION_S3 = new ResourceType('AWS::DataSync::LocationS3'); + /** AWS DataSync location EFS */ + public static readonly DATASYNC_LOCATION_EFS = new ResourceType('AWS::DataSync::LocationEFS'); + /** AWS DataSync task */ + public static readonly DATASYNC_TASK = new ResourceType('AWS::DataSync::Task'); + /** AWS DataSync location NFS */ + public static readonly DATASYNC_LOCATION_NFS = new ResourceType('AWS::DataSync::LocationNFS'); + /** AWS DataSync location object storage */ + public static readonly DATASYNC_LOCATION_OBJECT_STORAGE = new ResourceType('AWS::DataSync::LocationObjectStorage'); + /** AWS DataSync location HDFS */ + public static readonly DATASYNC_LOCATION_HDFS = new ResourceType('AWS::DataSync::LocationHDFS'); + /** AWS Elastic Beanstalk (EB) application */ + public static readonly ELASTIC_BEANSTALK_APPLICATION = new ResourceType('AWS::ElasticBeanstalk::Application'); + /** AWS Elastic Beanstalk (EB) application version */ + public static readonly ELASTIC_BEANSTALK_APPLICATION_VERSION = new ResourceType('AWS::ElasticBeanstalk::ApplicationVersion'); + /** AWS Elastic Beanstalk (EB) environment */ + public static readonly ELASTIC_BEANSTALK_ENVIRONMENT = new ResourceType('AWS::ElasticBeanstalk::Environment'); + /** AWS Fault Injection Simulator Experiment_Template */ + public static readonly FIS_EXPERIMENT_TEMPLATE = new ResourceType('AWS::FIS::ExperimentTemplate'); + /** AWS GlobalAccelerator listener */ + public static readonly GLOBALACCELERATOR_LISTENER = new ResourceType('AWS::GlobalAccelerator::Listener'); + /** AWS GlobalAccelerator endpoint group */ + public static readonly GLOBALACCELERATOR_ENDPOINT_GROUP = new ResourceType('AWS::GlobalAccelerator::EndpointGroup'); + /** AWS GlobalAccelerator accelerator */ + public static readonly GLOBALACCELERATOR_ACCELERATOR = new ResourceType('AWS::GlobalAccelerator::Accelerator'); + /** AWS Glue Job */ + public static readonly GLUE_JOB = new ResourceType('AWS::Glue::Job'); + /** AWS Glue Classifier */ + public static readonly GLUE_CLASSIFIER = new ResourceType('AWS::Glue::Classifier'); + /** AWS Glue machine learning transform */ + public static readonly GLUE_ML_TRANSFORM = new ResourceType('AWS::Glue::MLTransform'); + /** AWS IAM user */ + public static readonly IAM_USER = new ResourceType('AWS::IAM::User'); + /** AWS IAM group */ + public static readonly IAM_GROUP = new ResourceType('AWS::IAM::Group'); + /** AWS IAM role */ + public static readonly IAM_ROLE = new ResourceType('AWS::IAM::Role'); + /** AWS IAM policy */ + public static readonly IAM_POLICY = new ResourceType('AWS::IAM::Policy'); + /** AWS IAM AccessAnalyzer analyzer */ + public static readonly IAM_ACCESSANALYZER_ANALYZER = new ResourceType('AWS::AccessAnalyzer::Analyzer'); + /** AWS IoT authorizer */ + public static readonly IOT_AUTHORIZER = new ResourceType('AWS::IoT::Authorizer'); + /** AWS IoT security profile */ + public static readonly IOT_SECURITY_PROFILE = new ResourceType('AWS::IoT::SecurityProfile'); + /** AWS IoT role alias */ + public static readonly IOT_ROLE_ALIAS = new ResourceType('AWS::IoT::RoleAlias'); + /** AWS IoT dimension */ + public static readonly IOT_DIMENSION = new ResourceType('AWS::IoT::Dimension'); + /** AWS IoT policy */ + public static readonly IOT_POLICY = new ResourceType('AWS::IoT::Policy'); + /** AWS IoT mitigation action */ + public static readonly IOT_MITIGATION_ACTION = new ResourceType('AWS::IoT::MitigationAction'); + /** AWS IoT TwinMaker workspace */ + public static readonly IOT_TWINMAKER_WORKSPACE = new ResourceType('AWS::IoTwinMaker::Workspace'); + /** AWS IoT TwinMaker entity */ + public static readonly IOT_TWINMAKER_ENTITY = new ResourceType('AWS::IoTTwinMaker::Entity'); + /** AWS IoT Analytics datastore */ + public static readonly IOT_ANALYTICS_DATASTORE = new ResourceType('AWS::IoTAnalytics::Datastore'); + /** AWS IoT Analytics dataset */ + public static readonly IOT_ANALYTICS_DATASET = new ResourceType('AWS::IoTAnalytics::Dataset'); + /** AWS IoT Analytics pipeline */ + public static readonly IOT_ANALYTICS_PIPELINE = new ResourceType('AWS::IoTAnalytics::Pipeline'); + /** AWS IoT Analytics channel */ + public static readonly IOT_ANALYTICS_CHANNEL = new ResourceType('AWS::IoTAnalytics::Channel'); + /** AWS IoT Events Input */ + public static readonly IOT_EVENTS_INPUT = new ResourceType('AWS::IoTEvents::Input'); + /** AWS IoT Events Detector Model */ + public static readonly IOT_EVENTS_DETECTOR_MODEL = new ResourceType('AWS::IoTEvents::DetectorModel'); + /** AWS IoT Events Alarm Model */ + public static readonly IOT_EVENTS_ALARM_MODEL = new ResourceType('AWS::IoTEvents::AlarmModel'); + /** AWS IoT SiteWise dashboard */ + public static readonly IOT_SITEWISE_DASHBOARD = new ResourceType('AWS::IoTSiteWise::Dashboard'); + /** AWS IoT SiteWise project */ + public static readonly IOT_SITEWISE_PROJECT = new ResourceType('AWS::IoTSiteWise::Project'); + /** AWS IoT SiteWise portal */ + public static readonly IOT_SITEWISE_PORTAL = new ResourceType('AWS::IoTSiteWise::Portal'); + /** AWS IoT SiteWise asset model */ + public static readonly IOT_SITEWISE_ASSETMODEL = new ResourceType('AWS::IoTSiteWise::AssetModel'); + /** AWS KMS Key */ + public static readonly KMS_KEY = new ResourceType('AWS::KMS::Key'); + /** AWS Lambda function */ + public static readonly LAMBDA_FUNCTION = new ResourceType('AWS::Lambda::Function'); + /** AWS Network Firewall Firewall */ + public static readonly NETWORK_FIREWALL_FIREWALL = new ResourceType('AWS::NetworkFirewall::Firewall'); + /** AWS Network Firewall Firewall Policy */ + public static readonly NETWORK_FIREWALL_FIREWALL_POLICY = new ResourceType('AWS::NetworkFirewall::FirewallPolicy'); + /** AWS Network Firewall Rule Group */ + public static readonly NETWORK_FIREWALL_RULE_GROUP = new ResourceType('AWS::NetworkFirewall::RuleGroup'); + /** AWS ResilienceHub resiliency policy */ + public static readonly RESILIENCEHUB_RESILIENCY_POLICY = new ResourceType('AWS::ResilienceHub::ResiliencyPolicy'); + /**AWS Secrets Manager secret */ + public static readonly SECRETS_MANAGER_SECRET = new ResourceType('AWS::SecretsManager::Secret'); + /** AWS Service Catalog CloudFormation product */ + public static readonly SERVICE_CATALOG_CLOUDFORMATION_PRODUCT = new ResourceType('AWS::ServiceCatalog::CloudFormationProduct'); + /** AWS Service Catalog CloudFormation provisioned product */ + public static readonly SERVICE_CATALOG_CLOUDFORMATION_PROVISIONED_PRODUCT = new ResourceType( + 'AWS::ServiceCatalog::CloudFormationProvisionedProduct'); + /** AWS Service Catalog portfolio */ + public static readonly SERVICE_CATALOG_PORTFOLIO = new ResourceType('AWS::ServiceCatalog::Portfolio'); + /** AWS Shield protection */ + public static readonly SHIELD_PROTECTION = new ResourceType('AWS::Shield::Protection'); + /** AWS Shield regional protection */ + public static readonly SHIELD_REGIONAL_PROTECTION = new ResourceType('AWS::ShieldRegional::Protection'); + /** AWS StepFunctions activity */ + public static readonly STEPFUNCTIONS_ACTIVITY = new ResourceType('AWS::StepFunctions::Activity'); + /** AWS StepFunctions state machine */ + public static readonly STEPFUNCTIONS_STATE_MACHINE = new ResourceType('AWS::StepFunctions::StateMachine'); + /** AWS Systems Manager managed instance inventory */ + public static readonly SYSTEMS_MANAGER_MANAGED_INSTANCE_INVENTORY = new ResourceType('AWS::SSM::ManagedInstanceInventory'); + /** AWS Systems Manager patch compliance */ + public static readonly SYSTEMS_MANAGER_PATCH_COMPLIANCE = new ResourceType('AWS::SSM::PatchCompliance'); + /** AWS Systems Manager association compliance */ + public static readonly SYSTEMS_MANAGER_ASSOCIATION_COMPLIANCE = new ResourceType('AWS::SSM::AssociationCompliance'); + /** AWS Systems Manager file data */ + public static readonly SYSTEMS_MANAGER_FILE_DATA = new ResourceType('AWS::SSM::FileData'); + /** AWS Transfer workflow */ + public static readonly TRANSFER_WORKFLOW = new ResourceType('AWS::Transfer::Workflow'); + /** AWS WAF rate based rule */ + public static readonly WAF_RATE_BASED_RULE = new ResourceType('AWS::WAF::RateBasedRule'); + /** AWS WAF rule */ + public static readonly WAF_RULE = new ResourceType('AWS::WAF::Rule'); + /** AWS WAF web ACL */ + public static readonly WAF_WEB_ACL = new ResourceType('AWS::WAF::WebACL'); + /** AWS WAF rule group */ + public static readonly WAF_RULE_GROUP = new ResourceType('AWS::WAF::RuleGroup'); + /** AWS WAF regional rate based rule */ + public static readonly WAF_REGIONAL_RATE_BASED_RULE = new ResourceType('AWS::WAFRegional::RateBasedRule'); + /** AWS WAF regional rule */ + public static readonly WAF_REGIONAL_RULE = new ResourceType('AWS::WAFRegional::Rule'); + /** AWS WAF web ACL */ + public static readonly WAF_REGIONAL_WEB_ACL = new ResourceType('AWS::WAFRegional::WebACL'); + /** AWS WAF regional rule group */ + public static readonly WAF_REGIONAL_RULE_GROUP = new ResourceType('AWS::WAFRegional::RuleGroup'); + /** AWS WAFv2 web ACL */ + public static readonly WAFV2_WEB_ACL = new ResourceType('AWS::WAFv2::WebACL'); + /** AWS WAFv2 rule group */ + public static readonly WAFV2_RULE_GROUP = new ResourceType('AWS::WAFv2::RuleGroup'); + /** AWS WAFv2 managed rule set */ + public static readonly WAFV2_MANAGED_RULE_SET = new ResourceType('AWS::WAFv2::ManagedRuleSet'); + /** AWS WAFv2 ip set */ + public static readonly WAFV2_IP_SET = new ResourceType('AWS::WAFv2::IPSet'); + /** AWS WAFv2 regex pattern set */ + public static readonly WAFV2_REGEX_PATTERN_SET = new ResourceType('AWS::WAFv2::RegexPatternSet'); + /** AWS X-Ray encryption configuration */ + public static readonly XRAY_ENCRYPTION_CONFIGURATION = new ResourceType('AWS::XRay::EncryptionConfig'); + /** AWS ELB classic load balancer */ + public static readonly ELB_LOAD_BALANCER = new ResourceType('AWS::ElasticLoadBalancing::LoadBalancer'); + /** AWS ELBv2 network load balancer or AWS ELBv2 application load balancer */ + public static readonly ELBV2_LOAD_BALANCER = new ResourceType('AWS::ElasticLoadBalancingV2::LoadBalancer'); + /** AWS ELBv2 application load balancer listener */ + public static readonly ELBV2_LISTENER = new ResourceType('AWS::ElasticLoadBalancingV2::Listener'); + /** AWS Elemental MediaPackage packaging group */ + public static readonly MEDIAPACKAGE_PACKAGING_GROUP = new ResourceType('AWS::MediaPackage::PackagingGroup'); + + /** A custom resource type to support future cases. */ + public static of(type: string): ResourceType { + return new ResourceType(type); + } + + /** + * Valid value of resource type. + */ + public readonly complianceResourceType: string; + + private constructor(type: string) { + this.complianceResourceType = type; + } + +} + +function renderScope(ruleScope?: RuleScope): CfnConfigRule.ScopeProperty | undefined { + return ruleScope ? { + complianceResourceId: ruleScope.resourceId, + complianceResourceTypes: ruleScope.resourceTypes?.map(resource => resource.complianceResourceType), + tagKey: ruleScope.key, + tagValue: ruleScope.value, + } : undefined; +} diff --git a/packages/@aws-cdk/aws-config/test/managed-rules.test.ts b/packages/aws-cdk-lib/aws-config/test/managed-rules.test.ts similarity index 97% rename from packages/@aws-cdk/aws-config/test/managed-rules.test.ts rename to packages/aws-cdk-lib/aws-config/test/managed-rules.test.ts index b360267c97352..abf5862b208d9 100644 --- a/packages/@aws-cdk/aws-config/test/managed-rules.test.ts +++ b/packages/aws-cdk-lib/aws-config/test/managed-rules.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import * as config from '../lib'; describe('access keys', () => { diff --git a/packages/aws-cdk-lib/aws-config/test/rule.test.ts b/packages/aws-cdk-lib/aws-config/test/rule.test.ts new file mode 100644 index 0000000000000..6484ef143163c --- /dev/null +++ b/packages/aws-cdk-lib/aws-config/test/rule.test.ts @@ -0,0 +1,522 @@ +import { Template } from '../../assertions'; +import * as targets from '../../aws-events-targets'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; +import * as config from '../lib'; + +describe('rule', () => { + test('create a managed rule', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new config.ManagedRule(stack, 'Rule', { + description: 'really cool rule', + identifier: 'AWS_SUPER_COOL', + inputParameters: { + key: 'value', + }, + maximumExecutionFrequency: config.MaximumExecutionFrequency.THREE_HOURS, + configRuleName: 'cool rule', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { + Source: { + Owner: 'AWS', + SourceIdentifier: 'AWS_SUPER_COOL', + }, + ConfigRuleName: 'cool rule', + Description: 'really cool rule', + InputParameters: { + key: 'value', + }, + MaximumExecutionFrequency: 'Three_Hours', + }); + }); + + test('create a custom rule', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.AssetCode.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + new config.CustomRule(stack, 'Rule', { + configurationChanges: true, + description: 'really cool rule', + inputParameters: { + key: 'value', + }, + lambdaFunction: fn, + maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, + configRuleName: 'cool rule', + periodic: true, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::Config::ConfigRule', { + Properties: { + Source: { + Owner: 'CUSTOM_LAMBDA', + SourceDetails: [ + { + EventSource: 'aws.config', + MessageType: 'ConfigurationItemChangeNotification', + }, + { + EventSource: 'aws.config', + MessageType: 'OversizedConfigurationItemChangeNotification', + }, + { + EventSource: 'aws.config', + MaximumExecutionFrequency: 'Six_Hours', + MessageType: 'ScheduledNotification', + }, + ], + SourceIdentifier: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + }, + ConfigRuleName: 'cool rule', + Description: 'really cool rule', + InputParameters: { + key: 'value', + }, + MaximumExecutionFrequency: 'Six_Hours', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Principal: 'config.amazonaws.com', + SourceAccount: { + Ref: 'AWS::AccountId', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AWSConfigRulesExecutionRole', + ], + ], + }, + ], + }); + }); + + test('scope to resource', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new config.ManagedRule(stack, 'Rule', { + identifier: 'AWS_SUPER_COOL', + ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE, 'i-1234'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { + Scope: { + ComplianceResourceId: 'i-1234', + ComplianceResourceTypes: [ + 'AWS::EC2::Instance', + ], + }, + }); + }); + + test('scope to resources', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new config.ManagedRule(stack, 'Rule', { + identifier: 'AWS_SUPER_COOL', + ruleScope: config.RuleScope.fromResources([config.ResourceType.S3_BUCKET, config.ResourceType.CLOUDFORMATION_STACK]), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { + Scope: { + ComplianceResourceTypes: [ + 'AWS::S3::Bucket', + 'AWS::CloudFormation::Stack', + ], + }, + }); + }), + + test('scope to tag', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new config.ManagedRule(stack, 'Rule', { + identifier: 'RULE', + ruleScope: config.RuleScope.fromTag('key', 'value'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { + Scope: { + TagKey: 'key', + TagValue: 'value', + }, + }); + }), + + test('allows scoping a custom rule without configurationChanges enabled', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.AssetCode.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // THEN + expect(() => new config.CustomRule(stack, 'Rule', { + lambdaFunction: fn, + periodic: true, + ruleScope: config.RuleScope.fromResources([config.ResourceType.of('resource')]), + })).not.toThrow(); + }), + + test('throws when both configurationChanges and periodic are falsy', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.AssetCode.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // THEN + expect(() => new config.CustomRule(stack, 'Rule', { + lambdaFunction: fn, + })).toThrow(/`configurationChanges`.*`periodic`/); + }), + + test('on compliance change event', () => { + // GIVEN + const stack = new cdk.Stack(); + const rule = new config.ManagedRule(stack, 'Rule', { + identifier: 'RULE', + }); + + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('dummy'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + rule.onComplianceChange('ComplianceChange', { + target: new targets.LambdaFunction(fn), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + EventPattern: { + 'source': [ + 'aws.config', + ], + 'detail': { + configRuleName: [ + { + Ref: 'Rule4C995B7F', + }, + ], + }, + 'detail-type': [ + 'Config Rules Compliance Change', + ], + }, + }); + }); + + test('Add EKS Cluster check to ManagedRule', () => { + // GIVEN + const stack1 = new cdk.Stack(); + const stack2 = new cdk.Stack(); + + // WHEN + new config.ManagedRule(stack1, 'RuleEksClusterOldest', { + identifier: config.ManagedRuleIdentifiers.EKS_CLUSTER_OLDEST_SUPPORTED_VERSION, + ruleScope: config.RuleScope.fromResource(config.ResourceType.EKS_CLUSTER), + }); + new config.ManagedRule(stack2, 'RuleEksClusterVersion', { + identifier: config.ManagedRuleIdentifiers.EKS_CLUSTER_SUPPORTED_VERSION, + ruleScope: config.RuleScope.fromResources([config.ResourceType.EKS_CLUSTER]), + }); + + // THEN + Template.fromStack(stack1).hasResourceProperties('AWS::Config::ConfigRule', { + Source: { + SourceIdentifier: 'EKS_CLUSTER_OLDEST_SUPPORTED_VERSION', + }, + Scope: { + ComplianceResourceTypes: ['AWS::EKS::Cluster'], + }, + }); + Template.fromStack(stack2).hasResourceProperties('AWS::Config::ConfigRule', { + Source: { + SourceIdentifier: 'EKS_CLUSTER_SUPPORTED_VERSION', + }, + Scope: { + ComplianceResourceTypes: ['AWS::EKS::Cluster'], + }, + }); + }); + + test('scope to resource', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new config.ManagedRule(stack, 'Rule', { + identifier: 'AWS_SUPER_COOL', + ruleScope: config.RuleScope.fromResources([ + config.ResourceType.EC2_NETWORK_INTERFACE, + config.ResourceType.EC2_TRANSIT_GATEWAY, + config.ResourceType.EC2_TRANSIT_GATEWAY_ATTACHMENT, + config.ResourceType.EC2_TRANSIT_GATEWAY_ROUTE_TABLE, + config.ResourceType.EC2_REGISTERED_HA_INSTANCE, + config.ResourceType.EC2_LAUNCH_TEMPLATE, + config.ResourceType.ECR_REPOSITORY, + config.ResourceType.ECR_PUBLIC_REPOSITORY, + config.ResourceType.ECS_CLUSTER, + config.ResourceType.ECS_TASK_DEFINITION, + config.ResourceType.ECS_SERVICE, + config.ResourceType.EFS_FILE_SYSTEM, + config.ResourceType.EFS_ACCESS_POINT, + config.ResourceType.EMR_SECURITY_CONFIGURATION, + config.ResourceType.GUARDDUTY_DETECTOR, + config.ResourceType.OPENSEARCH_DOMAIN, + config.ResourceType.KINESIS_STREAM, + config.ResourceType.KINESIS_STREAM_CONSUMER, + config.ResourceType.MSK_CLUSTER, + config.ResourceType.ROUTE53_RESOLVER_RESOLVER_ENDPOINT, + config.ResourceType.ROUTE53_RESOLVER_RESOLVER_RULE, + config.ResourceType.ROUTE53_RESOLVER_RESOLVER_RULE_ASSOCIATION, + config.ResourceType.SAGEMAKER_CODE_REPOSITORY, + config.ResourceType.SAGEMAKER_MODEL, + config.ResourceType.SAGEMAKER_NOTEBOOK_INSTANCE, + config.ResourceType.WORKSPACES_CONNECTION_ALIAS, + config.ResourceType.WORKSPACES_WORKSPACE, + config.ResourceType.BACKUP_BACKUP_PLAN, + config.ResourceType.BACKUP_BACKUP_SELECTION, + config.ResourceType.BACKUP_BACKUP_VAULT, + config.ResourceType.BACKUP_RECOVERY_POINT, + config.ResourceType.BATCH_JOB_QUEUE, + config.ResourceType.BATCH_COMPUTE_ENVIRONMENT, + config.ResourceType.CODEDEPLOY_APPLICATION, + config.ResourceType.CODEDEPLOY_DEPLOYMENT_CONFIG, + config.ResourceType.CODEDEPLOY_DEPLOYMENT_GROUP, + config.ResourceType.CONFIG_RESOURCE_COMPLIANCE, + config.ResourceType.CONFIG_CONFORMANCE_PACK_COMPLIANCE, + config.ResourceType.DMS_EVENT_SUBSCRIPTION, + config.ResourceType.DMS_REPLICATION_SUBNET_GROUP, + config.ResourceType.GLOBALACCELERATOR_LISTENER, + config.ResourceType.GLOBALACCELERATOR_ENDPOINT_GROUP, + config.ResourceType.GLOBALACCELERATOR_ACCELERATOR, + config.ResourceType.IAM_ACCESSANALYZER_ANALYZER, + config.ResourceType.STEPFUNCTIONS_ACTIVITY, + config.ResourceType.STEPFUNCTIONS_STATE_MACHINE, + config.ResourceType.WAFV2_IP_SET, + config.ResourceType.WAFV2_REGEX_PATTERN_SET, + config.ResourceType.ELBV2_LISTENER, + ]), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { + Scope: { + ComplianceResourceTypes: [ + 'AWS::EC2::NetworkInterface', + 'AWS::EC2::TransitGateway', + 'AWS::EC2::TransitGatewayAttachment', + 'AWS::EC2::TransitGatewayRouteTable', + 'AWS::EC2::RegisteredHAInstance', + 'AWS::EC2::LaunchTemplate', + 'AWS::ECR::Repository', + 'AWS::ECR::PublicRepository', + 'AWS::ECS::Cluster', + 'AWS::ECS::TaskDefinition', + 'AWS::ECS::Service', + 'AWS::EFS::FileSystem', + 'AWS::EFS::AccessPoint', + 'AWS::EMR::SecurityConfiguration', + 'AWS::GuardDuty::Detector', + 'AWS::OpenSearch::Domain', + 'AWS::Kinesis::Stream', + 'AWS::Kinesis::StreamConsumer', + 'AWS::MSK::Cluster', + 'AWS::Route53Resolver::ResolverEndpoint', + 'AWS::Route53Resolver::ResolverRule', + 'AWS::Route53Resolver::ResolverRuleAssociation', + 'AWS::SageMaker::CodeRepository', + 'AWS::SageMaker::Model', + 'AWS::SageMaker::NotebookInstance', + 'AWS::WorkSpaces::ConnectionAlias', + 'AWS::WorkSpaces::Workspace', + 'AWS::Backup::BackupPlan', + 'AWS::Backup::BackupSelection', + 'AWS::Backup::BackupVault', + 'AWS::Backup::RecoveryPoint', + 'AWS::Batch::JobQueue', + 'AWS::Batch::ComputeEnvironment', + 'AWS::CodeDeploy::Application', + 'AWS::CodeDeploy::DeploymentConfig', + 'AWS::CodeDeploy::DeploymentGroup', + 'AWS::Config::ResourceCompliance', + 'AWS::Config::ConformancePackCompliance', + 'AWS::DMS::EventSubscription', + 'AWS::DMS::ReplicationSubnetGroup', + 'AWS::GlobalAccelerator::Listener', + 'AWS::GlobalAccelerator::EndpointGroup', + 'AWS::GlobalAccelerator::Accelerator', + 'AWS::AccessAnalyzer::Analyzer', + 'AWS::StepFunctions::Activity', + 'AWS::StepFunctions::StateMachine', + 'AWS::WAFv2::IPSet', + 'AWS::WAFv2::RegexPatternSet', + 'AWS::ElasticLoadBalancingV2::Listener', + ], + }, + }); + }); + test('create a custom policy', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new config.CustomPolicy(stack, 'Rule', { + policyText: ` + let status = ['ACTIVE'] + + rule tableisactive when + resourceType == "AWS::DynamoDB::Table" { + configuration.tableStatus == %status + } + + rule checkcompliance when + resourceType == "AWS::DynamoDB::Table" + tableisactive { + let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus + %pitr == "ENABLED" + }`, + description: 'really cool rule', + configRuleName: 'cool rule', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Config::ConfigRule', { + Source: { + Owner: 'CUSTOM_POLICY', + SourceDetails: [ + { + EventSource: 'aws.config', + MessageType: 'ConfigurationItemChangeNotification', + }, + { + EventSource: 'aws.config', + MessageType: 'OversizedConfigurationItemChangeNotification', + }, + ], + }, + ConfigRuleName: 'cool rule', + Description: 'really cool rule', + }); + }); + + test('create two custom rules and one function', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.AssetCode.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + new config.CustomRule(stack, 'Rule1', { + configurationChanges: true, + description: 'really cool rule', + lambdaFunction: fn, + maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, + configRuleName: 'cool rule 1', + periodic: true, + }); + new config.CustomRule(stack, 'Rule2', { + configurationChanges: true, + description: 'really cool rule', + lambdaFunction: fn, + configRuleName: 'cool rule 2', + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Config::ConfigRule', 2); + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'config.amazonaws.com', + SourceAccount: { + Ref: 'AWS::AccountId', + }, + }); + }); + test('create a 0 charactor policy', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + // THEN + expect(() => new config.CustomPolicy(stack, 'Rule', { + policyText: '', + })).toThrow('Policy Text cannot be empty.'); + }); + + test('create over 10000 charactor policy', () => { + // GIVEN + const stack = new cdk.Stack(); + const stringLen10001 = '0123456789'.repeat(1000) + 'a'; + // WHEN + // THEN + expect(() => new config.CustomPolicy(stack, 'Rule', { + policyText: stringLen10001, + })).toThrow('Policy Text is limited to 10,000 characters or less.'); + }); +}); diff --git a/packages/aws-cdk-lib/aws-connect/.jsiirc.json b/packages/aws-cdk-lib/aws-connect/.jsiirc.json new file mode 100644 index 0000000000000..986b9cf13eb9a --- /dev/null +++ b/packages/aws-cdk-lib/aws-connect/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Connect" + }, + "java": { + "package": "software.amazon.awscdk.services.connect" + }, + "python": { + "module": "aws_cdk.aws_connect" + } + } +} diff --git a/packages/aws-cdk-lib/aws-connect/README.md b/packages/aws-cdk-lib/aws-connect/README.md new file mode 100644 index 0000000000000..b3c1de09c5ada --- /dev/null +++ b/packages/aws-cdk-lib/aws-connect/README.md @@ -0,0 +1,27 @@ +# AWS::Connect Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as connect from 'aws-cdk-lib/aws-connect'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Connect construct libraries](https://constructs.dev/search?q=connect) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Connect resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Connect.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Connect](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Connect.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-connect/index.ts b/packages/aws-cdk-lib/aws-connect/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-connect/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-connect/lib/index.ts b/packages/aws-cdk-lib/aws-connect/lib/index.ts new file mode 100644 index 0000000000000..800af3323cfc9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-connect/lib/index.ts @@ -0,0 +1 @@ +export * from './connect.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-connectcampaigns/.jsiirc.json b/packages/aws-cdk-lib/aws-connectcampaigns/.jsiirc.json new file mode 100644 index 0000000000000..1a47200d2d905 --- /dev/null +++ b/packages/aws-cdk-lib/aws-connectcampaigns/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ConnectCampaigns" + }, + "java": { + "package": "software.amazon.awscdk.services.connectcampaigns" + }, + "python": { + "module": "aws_cdk.aws_connectcampaigns" + } + } +} diff --git a/packages/aws-cdk-lib/aws-connectcampaigns/README.md b/packages/aws-cdk-lib/aws-connectcampaigns/README.md new file mode 100644 index 0000000000000..95fb0c114a627 --- /dev/null +++ b/packages/aws-cdk-lib/aws-connectcampaigns/README.md @@ -0,0 +1,27 @@ +# AWS::ConnectCampaigns Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as connectcampaigns from 'aws-cdk-lib/aws-connectcampaigns'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ConnectCampaigns construct libraries](https://constructs.dev/search?q=connectcampaigns) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ConnectCampaigns resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ConnectCampaigns.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ConnectCampaigns](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ConnectCampaigns.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-connectcampaigns/index.ts b/packages/aws-cdk-lib/aws-connectcampaigns/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-connectcampaigns/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-connectcampaigns/lib/index.ts b/packages/aws-cdk-lib/aws-connectcampaigns/lib/index.ts new file mode 100644 index 0000000000000..a5f18484800cb --- /dev/null +++ b/packages/aws-cdk-lib/aws-connectcampaigns/lib/index.ts @@ -0,0 +1 @@ +export * from './connectcampaigns.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-controltower/.jsiirc.json b/packages/aws-cdk-lib/aws-controltower/.jsiirc.json new file mode 100644 index 0000000000000..319a2f69c6daf --- /dev/null +++ b/packages/aws-cdk-lib/aws-controltower/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ControlTower" + }, + "java": { + "package": "software.amazon.awscdk.services.controltower" + }, + "python": { + "module": "aws_cdk.aws_controltower" + } + } +} diff --git a/packages/aws-cdk-lib/aws-controltower/README.md b/packages/aws-cdk-lib/aws-controltower/README.md new file mode 100644 index 0000000000000..bb7ba0e09dae5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-controltower/README.md @@ -0,0 +1,27 @@ +# AWS::ControlTower Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as controltower from 'aws-cdk-lib/aws-controltower'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ControlTower construct libraries](https://constructs.dev/search?q=controltower) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ControlTower resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ControlTower.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ControlTower](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ControlTower.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-controltower/index.ts b/packages/aws-cdk-lib/aws-controltower/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-controltower/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-controltower/lib/index.ts b/packages/aws-cdk-lib/aws-controltower/lib/index.ts new file mode 100644 index 0000000000000..0c99c2d812825 --- /dev/null +++ b/packages/aws-cdk-lib/aws-controltower/lib/index.ts @@ -0,0 +1 @@ +export * from './controltower.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-cur/.jsiirc.json b/packages/aws-cdk-lib/aws-cur/.jsiirc.json new file mode 100644 index 0000000000000..81d6166fc6602 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cur/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CUR" + }, + "java": { + "package": "software.amazon.awscdk.services.cur" + }, + "python": { + "module": "aws_cdk.aws_cur" + } + } +} diff --git a/packages/aws-cdk-lib/aws-cur/README.md b/packages/aws-cdk-lib/aws-cur/README.md new file mode 100644 index 0000000000000..60261888d995e --- /dev/null +++ b/packages/aws-cdk-lib/aws-cur/README.md @@ -0,0 +1,27 @@ +# AWS::CUR Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as cur from 'aws-cdk-lib/aws-cur'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CUR construct libraries](https://constructs.dev/search?q=cur) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CUR resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CUR.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CUR](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CUR.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-cur/index.ts b/packages/aws-cdk-lib/aws-cur/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-cur/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-cur/lib/index.ts b/packages/aws-cdk-lib/aws-cur/lib/index.ts new file mode 100644 index 0000000000000..51f7f920492f7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-cur/lib/index.ts @@ -0,0 +1 @@ +export * from './cur.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-customerprofiles/.jsiirc.json b/packages/aws-cdk-lib/aws-customerprofiles/.jsiirc.json new file mode 100644 index 0000000000000..d9fdb815e93c1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-customerprofiles/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.CustomerProfiles" + }, + "java": { + "package": "software.amazon.awscdk.services.customerprofiles" + }, + "python": { + "module": "aws_cdk.aws_customerprofiles" + } + } +} diff --git a/packages/aws-cdk-lib/aws-customerprofiles/README.md b/packages/aws-cdk-lib/aws-customerprofiles/README.md new file mode 100644 index 0000000000000..c194592414cad --- /dev/null +++ b/packages/aws-cdk-lib/aws-customerprofiles/README.md @@ -0,0 +1,27 @@ +# AWS::CustomerProfiles Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as customerprofiles from 'aws-cdk-lib/aws-customerprofiles'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for CustomerProfiles construct libraries](https://constructs.dev/search?q=customerprofiles) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::CustomerProfiles resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CustomerProfiles.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::CustomerProfiles](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_CustomerProfiles.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-customerprofiles/index.ts b/packages/aws-cdk-lib/aws-customerprofiles/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-customerprofiles/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-customerprofiles/lib/index.ts b/packages/aws-cdk-lib/aws-customerprofiles/lib/index.ts new file mode 100644 index 0000000000000..31a9058fca4e0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-customerprofiles/lib/index.ts @@ -0,0 +1 @@ +export * from './customerprofiles.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-databrew/.jsiirc.json b/packages/aws-cdk-lib/aws-databrew/.jsiirc.json new file mode 100644 index 0000000000000..5106dc51c60e0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-databrew/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DataBrew" + }, + "java": { + "package": "software.amazon.awscdk.services.databrew" + }, + "python": { + "module": "aws_cdk.aws_databrew" + } + } +} diff --git a/packages/aws-cdk-lib/aws-databrew/README.md b/packages/aws-cdk-lib/aws-databrew/README.md new file mode 100644 index 0000000000000..5726294914553 --- /dev/null +++ b/packages/aws-cdk-lib/aws-databrew/README.md @@ -0,0 +1,27 @@ +# AWS::DataBrew Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as databrew from 'aws-cdk-lib/aws-databrew'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DataBrew construct libraries](https://constructs.dev/search?q=databrew) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DataBrew resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataBrew.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DataBrew](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataBrew.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-databrew/index.ts b/packages/aws-cdk-lib/aws-databrew/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-databrew/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-databrew/lib/index.ts b/packages/aws-cdk-lib/aws-databrew/lib/index.ts new file mode 100644 index 0000000000000..57beb0c613888 --- /dev/null +++ b/packages/aws-cdk-lib/aws-databrew/lib/index.ts @@ -0,0 +1 @@ +export * from './databrew.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-datapipeline/.jsiirc.json b/packages/aws-cdk-lib/aws-datapipeline/.jsiirc.json new file mode 100644 index 0000000000000..39aaeae990232 --- /dev/null +++ b/packages/aws-cdk-lib/aws-datapipeline/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.datapipeline" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.DataPipeline" + }, + "python": { + "module": "aws_cdk.aws_datapipeline" + } + } +} diff --git a/packages/aws-cdk-lib/aws-datapipeline/README.md b/packages/aws-cdk-lib/aws-datapipeline/README.md new file mode 100644 index 0000000000000..0b2a19c6611ad --- /dev/null +++ b/packages/aws-cdk-lib/aws-datapipeline/README.md @@ -0,0 +1,27 @@ +# AWS Data Pipeline Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as datapipeline from 'aws-cdk-lib/aws-datapipeline'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DataPipeline construct libraries](https://constructs.dev/search?q=datapipeline) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DataPipeline resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataPipeline.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DataPipeline](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataPipeline.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-datapipeline/index.ts b/packages/aws-cdk-lib/aws-datapipeline/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-datapipeline/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-datapipeline/lib/index.ts b/packages/aws-cdk-lib/aws-datapipeline/lib/index.ts new file mode 100644 index 0000000000000..93c28f5a8d59c --- /dev/null +++ b/packages/aws-cdk-lib/aws-datapipeline/lib/index.ts @@ -0,0 +1 @@ +export * from './datapipeline.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-datasync/.jsiirc.json b/packages/aws-cdk-lib/aws-datasync/.jsiirc.json new file mode 100644 index 0000000000000..b61e79f4a9bae --- /dev/null +++ b/packages/aws-cdk-lib/aws-datasync/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DataSync" + }, + "java": { + "package": "software.amazon.awscdk.services.datasync" + }, + "python": { + "module": "aws_cdk.aws_datasync" + } + } +} diff --git a/packages/aws-cdk-lib/aws-datasync/README.md b/packages/aws-cdk-lib/aws-datasync/README.md new file mode 100644 index 0000000000000..c0fcdc28d0b8f --- /dev/null +++ b/packages/aws-cdk-lib/aws-datasync/README.md @@ -0,0 +1,27 @@ +# AWS::DataSync Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as datasync from 'aws-cdk-lib/aws-datasync'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DataSync construct libraries](https://constructs.dev/search?q=datasync) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DataSync resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataSync.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DataSync](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DataSync.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-datasync/index.ts b/packages/aws-cdk-lib/aws-datasync/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-datasync/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-datasync/lib/index.ts b/packages/aws-cdk-lib/aws-datasync/lib/index.ts new file mode 100644 index 0000000000000..c9776005f354d --- /dev/null +++ b/packages/aws-cdk-lib/aws-datasync/lib/index.ts @@ -0,0 +1 @@ +export * from './datasync.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-dax/.jsiirc.json b/packages/aws-cdk-lib/aws-dax/.jsiirc.json new file mode 100644 index 0000000000000..8a4688a740024 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dax/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.dax" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.DAX" + }, + "python": { + "module": "aws_cdk.aws_dax" + } + } +} diff --git a/packages/aws-cdk-lib/aws-dax/README.md b/packages/aws-cdk-lib/aws-dax/README.md new file mode 100644 index 0000000000000..d04cc2843d08d --- /dev/null +++ b/packages/aws-cdk-lib/aws-dax/README.md @@ -0,0 +1,27 @@ +# Amazon DynamoDB Accelerator Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as dax from 'aws-cdk-lib/aws-dax'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DAX construct libraries](https://constructs.dev/search?q=dax) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DAX resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DAX.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DAX](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DAX.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-dax/index.ts b/packages/aws-cdk-lib/aws-dax/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-dax/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-dax/lib/index.ts b/packages/aws-cdk-lib/aws-dax/lib/index.ts new file mode 100644 index 0000000000000..7354f4abe2092 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dax/lib/index.ts @@ -0,0 +1 @@ +export * from './dax.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-detective/.jsiirc.json b/packages/aws-cdk-lib/aws-detective/.jsiirc.json new file mode 100644 index 0000000000000..12c0dd1072c36 --- /dev/null +++ b/packages/aws-cdk-lib/aws-detective/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Detective" + }, + "java": { + "package": "software.amazon.awscdk.services.detective" + }, + "python": { + "module": "aws_cdk.aws_detective" + } + } +} diff --git a/packages/aws-cdk-lib/aws-detective/README.md b/packages/aws-cdk-lib/aws-detective/README.md new file mode 100644 index 0000000000000..dda666dbfbb83 --- /dev/null +++ b/packages/aws-cdk-lib/aws-detective/README.md @@ -0,0 +1,27 @@ +# AWS::Detective Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as detective from 'aws-cdk-lib/aws-detective'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Detective construct libraries](https://constructs.dev/search?q=detective) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Detective resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Detective.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Detective](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Detective.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-detective/index.ts b/packages/aws-cdk-lib/aws-detective/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-detective/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-detective/lib/index.ts b/packages/aws-cdk-lib/aws-detective/lib/index.ts new file mode 100644 index 0000000000000..eb18e8550ac94 --- /dev/null +++ b/packages/aws-cdk-lib/aws-detective/lib/index.ts @@ -0,0 +1 @@ +export * from './detective.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-devicefarm/.jsiirc.json b/packages/aws-cdk-lib/aws-devicefarm/.jsiirc.json new file mode 100644 index 0000000000000..a7ff826f14f57 --- /dev/null +++ b/packages/aws-cdk-lib/aws-devicefarm/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DeviceFarm" + }, + "java": { + "package": "software.amazon.awscdk.services.devicefarm" + }, + "python": { + "module": "aws_cdk.aws_devicefarm" + } + } +} diff --git a/packages/aws-cdk-lib/aws-devicefarm/README.md b/packages/aws-cdk-lib/aws-devicefarm/README.md new file mode 100644 index 0000000000000..c64e4cbb4fac6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-devicefarm/README.md @@ -0,0 +1,27 @@ +# AWS::DeviceFarm Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as devicefarm from 'aws-cdk-lib/aws-devicefarm'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DeviceFarm construct libraries](https://constructs.dev/search?q=devicefarm) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DeviceFarm resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DeviceFarm.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DeviceFarm](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DeviceFarm.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-devicefarm/index.ts b/packages/aws-cdk-lib/aws-devicefarm/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-devicefarm/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-devicefarm/lib/index.ts b/packages/aws-cdk-lib/aws-devicefarm/lib/index.ts new file mode 100644 index 0000000000000..078f88ac4b5e2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-devicefarm/lib/index.ts @@ -0,0 +1 @@ +export * from './devicefarm.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-devopsguru/.jsiirc.json b/packages/aws-cdk-lib/aws-devopsguru/.jsiirc.json new file mode 100644 index 0000000000000..edfbe5f314f63 --- /dev/null +++ b/packages/aws-cdk-lib/aws-devopsguru/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DevOpsGuru" + }, + "java": { + "package": "software.amazon.awscdk.services.devopsguru" + }, + "python": { + "module": "aws_cdk.aws_devopsguru" + } + } +} diff --git a/packages/aws-cdk-lib/aws-devopsguru/README.md b/packages/aws-cdk-lib/aws-devopsguru/README.md new file mode 100644 index 0000000000000..67570ae13181d --- /dev/null +++ b/packages/aws-cdk-lib/aws-devopsguru/README.md @@ -0,0 +1,27 @@ +# AWS::DevOpsGuru Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as devopsguru from 'aws-cdk-lib/aws-devopsguru'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DevOpsGuru construct libraries](https://constructs.dev/search?q=devopsguru) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DevOpsGuru resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DevOpsGuru.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DevOpsGuru](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DevOpsGuru.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-devopsguru/index.ts b/packages/aws-cdk-lib/aws-devopsguru/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-devopsguru/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-devopsguru/lib/index.ts b/packages/aws-cdk-lib/aws-devopsguru/lib/index.ts new file mode 100644 index 0000000000000..277a7d3ce9386 --- /dev/null +++ b/packages/aws-cdk-lib/aws-devopsguru/lib/index.ts @@ -0,0 +1 @@ +export * from './devopsguru.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-directoryservice/.jsiirc.json b/packages/aws-cdk-lib/aws-directoryservice/.jsiirc.json new file mode 100644 index 0000000000000..fdab3bcbb4069 --- /dev/null +++ b/packages/aws-cdk-lib/aws-directoryservice/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.directoryservice" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.DirectoryService" + }, + "python": { + "module": "aws_cdk.aws_directoryservice" + } + } +} diff --git a/packages/aws-cdk-lib/aws-directoryservice/README.md b/packages/aws-cdk-lib/aws-directoryservice/README.md new file mode 100644 index 0000000000000..56ee0057fc0c0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-directoryservice/README.md @@ -0,0 +1,27 @@ +# AWS Directory Service Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as directoryservice from 'aws-cdk-lib/aws-directoryservice'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DirectoryService construct libraries](https://constructs.dev/search?q=directoryservice) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DirectoryService resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DirectoryService.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DirectoryService](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DirectoryService.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-directoryservice/index.ts b/packages/aws-cdk-lib/aws-directoryservice/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-directoryservice/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-directoryservice/lib/index.ts b/packages/aws-cdk-lib/aws-directoryservice/lib/index.ts new file mode 100644 index 0000000000000..130c2a9611f7f --- /dev/null +++ b/packages/aws-cdk-lib/aws-directoryservice/lib/index.ts @@ -0,0 +1 @@ +export * from './directoryservice.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-dlm/.jsiirc.json b/packages/aws-cdk-lib/aws-dlm/.jsiirc.json new file mode 100644 index 0000000000000..2866685a62004 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dlm/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DLM" + }, + "java": { + "package": "software.amazon.awscdk.services.dlm" + }, + "python": { + "module": "aws_cdk.aws_dlm" + } + } +} diff --git a/packages/aws-cdk-lib/aws-dlm/README.md b/packages/aws-cdk-lib/aws-dlm/README.md new file mode 100644 index 0000000000000..053c5b6ea3b07 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dlm/README.md @@ -0,0 +1,27 @@ +# Amazon Data Lifecycle Manager Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as dlm from 'aws-cdk-lib/aws-dlm'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DLM construct libraries](https://constructs.dev/search?q=dlm) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DLM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DLM.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DLM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DLM.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-dlm/index.ts b/packages/aws-cdk-lib/aws-dlm/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-dlm/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-dlm/lib/index.ts b/packages/aws-cdk-lib/aws-dlm/lib/index.ts new file mode 100644 index 0000000000000..a11d0396a3c62 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dlm/lib/index.ts @@ -0,0 +1 @@ +export * from './dlm.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-dms/.jsiirc.json b/packages/aws-cdk-lib/aws-dms/.jsiirc.json new file mode 100644 index 0000000000000..c867fc38140c4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dms/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.dms" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.DMS" + }, + "python": { + "module": "aws_cdk.aws_dms" + } + } +} diff --git a/packages/aws-cdk-lib/aws-dms/README.md b/packages/aws-cdk-lib/aws-dms/README.md new file mode 100644 index 0000000000000..bd1955eae4d93 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dms/README.md @@ -0,0 +1,27 @@ +# AWS Database Migration Service Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as dms from 'aws-cdk-lib/aws-dms'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DMS construct libraries](https://constructs.dev/search?q=dms) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DMS resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DMS.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DMS](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DMS.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-dms/index.ts b/packages/aws-cdk-lib/aws-dms/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-dms/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-dms/lib/index.ts b/packages/aws-cdk-lib/aws-dms/lib/index.ts new file mode 100644 index 0000000000000..05ea61127eed2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dms/lib/index.ts @@ -0,0 +1 @@ +export * from './dms.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-docdb/.jsiirc.json b/packages/aws-cdk-lib/aws-docdb/.jsiirc.json new file mode 100644 index 0000000000000..4e0d85026f410 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DocDB" + }, + "java": { + "package": "software.amazon.awscdk.services.docdb" + }, + "python": { + "module": "aws_cdk.aws_docdb" + } + } +} diff --git a/packages/aws-cdk-lib/aws-docdb/README.md b/packages/aws-cdk-lib/aws-docdb/README.md new file mode 100644 index 0000000000000..30e4652d42c33 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/README.md @@ -0,0 +1,173 @@ +# Amazon DocumentDB Construct Library + + +## Starting a Clustered Database + +To set up a clustered DocumentDB database, define a `DatabaseCluster`. You must +always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether +your instances will be launched privately or publicly: + +```ts +declare const vpc: ec2.Vpc; +const cluster = new docdb.DatabaseCluster(this, 'Database', { + masterUser: { + username: 'myuser', // NOTE: 'admin' is reserved by DocumentDB + excludeCharacters: '\"@/:', // optional, defaults to the set "\"@/" and is also used for eventually created rotations + secretName: '/myapp/mydocdb/masteruser', // optional, if you prefer to specify the secret name + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + vpc, +}); +``` + +By default, the master password will be generated and stored in AWS Secrets Manager with auto-generated description. + +Your cluster will be empty by default. + +## Connecting + +To control who can access the cluster, use the `.connections` attribute. DocumentDB databases have a default port, so +you don't need to specify the port: + +```ts +declare const cluster: docdb.DatabaseCluster; +cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world'); +``` + +The endpoints to access your database cluster will be available as the `.clusterEndpoint` and `.clusterReadEndpoint` +attributes: + +```ts +declare const cluster: docdb.DatabaseCluster; +const writeAddress = cluster.clusterEndpoint.socketAddress; // "HOSTNAME:PORT" +``` + +If you have existing security groups you would like to add to the cluster, use the `addSecurityGroups` method. Security +groups added in this way will not be managed by the `Connections` object of the cluster. + +```ts +declare const vpc: ec2.Vpc; +declare const cluster: docdb.DatabaseCluster; + +const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { + vpc, +}); +cluster.addSecurityGroups(securityGroup); +``` + +## Deletion protection + +Deletion protection can be enabled on an Amazon DocumentDB cluster to prevent accidental deletion of the cluster: + +```ts +declare const vpc: ec2.Vpc; +const cluster = new docdb.DatabaseCluster(this, 'Database', { + masterUser: { + username: 'myuser', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + vpc, + deletionProtection: true, // Enable deletion protection. +}); +``` + +## Rotating credentials + +When the master password is generated and stored in AWS Secrets Manager, it can be rotated automatically: + +```ts +declare const cluster: docdb.DatabaseCluster; +cluster.addRotationSingleUser(); // Will rotate automatically after 30 days +``` + +[example of setting up master password rotation for a cluster](test/integ.cluster-rotation.lit.ts) + +The multi user rotation scheme is also available: + +```ts +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; + +declare const myImportedSecret: secretsmanager.Secret; +declare const cluster: docdb.DatabaseCluster; + +cluster.addRotationMultiUser('MyUser', { + secret: myImportedSecret, // This secret must have the `masterarn` key +}); +``` + +It's also possible to create user credentials together with the cluster and add rotation: + +```ts +declare const cluster: docdb.DatabaseCluster; +const myUserSecret = new docdb.DatabaseSecret(this, 'MyUserSecret', { + username: 'myuser', + masterSecret: cluster.secret, +}); +const myUserSecretAttached = myUserSecret.attach(cluster); // Adds DB connections information in the secret + +cluster.addRotationMultiUser('MyUser', { // Add rotation using the multi user scheme + secret: myUserSecretAttached, // This secret must have the `masterarn` key +}); +``` + +**Note**: This user must be created manually in the database using the master credentials. +The rotation will start as soon as this user exists. + +See also [@aws-cdk/aws-secretsmanager](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-secretsmanager/README.md) for credentials rotation of existing clusters. + +## Audit and profiler Logs + +Sending audit or profiler needs to be configured in two places: + +1. Check / create the needed options in your ParameterGroup for [audit](https://docs.aws.amazon.com/documentdb/latest/developerguide/event-auditing.html#event-auditing-enabling-auditing) and +[profiler](https://docs.aws.amazon.com/documentdb/latest/developerguide/profiling.html#profiling.enable-profiling) logs. +2. Enable the corresponding option(s) when creating the `DatabaseCluster`: + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as logs from'aws-cdk-lib/aws-logs'; + +declare const myLogsPublishingRole: iam.Role; +declare const vpc: ec2.Vpc; + +const cluster = new docdb.DatabaseCluster(this, 'Database', { + masterUser: { + username: 'myuser', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + vpc, + exportProfilerLogsToCloudWatch: true, // Enable sending profiler logs + exportAuditLogsToCloudWatch: true, // Enable sending audit logs + cloudWatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs + cloudWatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided +}); +``` + +## Enable Performance Insights + +By enabling this feature it will be cascaded and enabled in all instances inside the cluster: + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new docdb.DatabaseCluster(this, 'Database', { + masterUser: { + username: 'myuser', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.MEMORY5, ec2.InstanceSize.LARGE), + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + vpc, + enablePerformanceInsights: true, // Enable Performance Insights in all instances under this cluster +}); +``` diff --git a/packages/aws-cdk-lib/aws-docdb/index.ts b/packages/aws-cdk-lib/aws-docdb/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-docdb/lib/cluster-ref.ts b/packages/aws-cdk-lib/aws-docdb/lib/cluster-ref.ts new file mode 100644 index 0000000000000..606495cfc1ca0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/cluster-ref.ts @@ -0,0 +1,88 @@ +import { IConnectable, ISecurityGroup } from '../../aws-ec2'; +import { ISecretAttachmentTarget } from '../../aws-secretsmanager'; +import { IResource } from '../../core'; +import { Endpoint } from './endpoint'; + +/** + * Create a clustered database with a given number of instances. + */ +export interface IDatabaseCluster extends IResource, IConnectable, ISecretAttachmentTarget { + /** + * Identifier of the cluster + */ + readonly clusterIdentifier: string; + + /** + * Identifiers of the replicas + */ + readonly instanceIdentifiers: string[]; + + /** + * The endpoint to use for read/write operations + * @attribute Endpoint,Port + */ + readonly clusterEndpoint: Endpoint; + + /** + * Endpoint to use for load-balanced read-only operations. + * @attribute ReadEndpoint + */ + readonly clusterReadEndpoint: Endpoint; + + /** + * Endpoints which address each individual replica. + */ + readonly instanceEndpoints: Endpoint[]; + + /** + * The security group for this database cluster + */ + readonly securityGroupId: string; +} + +/** + * Properties that describe an existing cluster instance + */ +export interface DatabaseClusterAttributes { + /** + * The database port + * @default - none + */ + readonly port?: number; + + /** + * The security group of the database cluster + * @default - no security groups + */ + readonly securityGroup?: ISecurityGroup; + + /** + * Identifier for the cluster + */ + readonly clusterIdentifier: string; + + /** + * Identifier for the instances + * @default - no instance identifiers + */ + readonly instanceIdentifiers?: string[]; + // Actual underlying type: DBInstanceId[], but we have to type it more loosely for Java's benefit. + + /** + * Cluster endpoint address + * @default - no cluster endpoint address + */ + readonly clusterEndpointAddress?: string; + + /** + * Reader endpoint address + * @default - no reader endpoint address + */ + readonly readerEndpointAddress?: string; + + /** + * Endpoint addresses of individual instances + * @default - no instance endpoint addresses + */ + readonly instanceEndpointAddresses?: string[]; +} diff --git a/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts b/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts new file mode 100644 index 0000000000000..5b46e6b365c3f --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/cluster.ts @@ -0,0 +1,619 @@ +import * as ec2 from '../../aws-ec2'; +import { IRole } from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { CfnResource, Duration, RemovalPolicy, Resource, Token } from '../../core'; +import { Construct } from 'constructs'; +import { DatabaseClusterAttributes, IDatabaseCluster } from './cluster-ref'; +import { DatabaseSecret } from './database-secret'; +import { CfnDBCluster, CfnDBInstance, CfnDBSubnetGroup } from './docdb.generated'; +import { Endpoint } from './endpoint'; +import { IClusterParameterGroup } from './parameter-group'; +import { BackupProps, Login, RotationMultiUserOptions } from './props'; + +/** + * Properties for a new database cluster + */ +export interface DatabaseClusterProps { + /** + * What version of the database to start + * + * @default - The default engine version. + */ + readonly engineVersion?: string; + + /** + * The port the DocumentDB cluster will listen on + * + * @default DatabaseCluster.DEFAULT_PORT + */ + readonly port?: number; + + /** + * Username and password for the administrative user + */ + readonly masterUser: Login; + + /** + * Backup settings + * + * @default - Backup retention period for automated backups is 1 day. + * Backup preferred window is set to a 30-minute window selected at random from an + * 8-hour block of time for each AWS Region, occurring on a random day of the week. + * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/backup-restore.db-cluster-snapshots.html#backup-restore.backup-window + */ + readonly backup?: BackupProps; + + /** + * The KMS key for storage encryption. + * + * @default - default master key. + */ + readonly kmsKey?: kms.IKey; + + /** + * Whether to enable storage encryption + * + * @default true + */ + readonly storageEncrypted?: boolean; + + /** + * Number of DocDB compute instances + * + * @default 1 + */ + readonly instances?: number; + + /** + * An optional identifier for the cluster + * + * @default - A name is automatically generated. + */ + readonly dbClusterName?: string; + + /** + * Base identifier for instances + * + * Every replica is named by appending the replica number to this string, 1-based. + * + * @default - `dbClusterName` is used with the word "Instance" appended. If `dbClusterName` is not provided, the + * identifier is automatically generated. + */ + readonly instanceIdentifierBase?: string; + + /** + * What type of instance to start for the replicas + */ + readonly instanceType: ec2.InstanceType; + + /** + * What subnets to run the DocumentDB instances in. + * + * Must be at least 2 subnets in two different AZs. + */ + readonly vpc: ec2.IVpc; + + /** + * Where to place the instances within the VPC + * + * @default private subnets + */ + readonly vpcSubnets?: ec2.SubnetSelection; + + /** + * Security group. + * + * @default a new security group is created. + */ + readonly securityGroup?: ec2.ISecurityGroup; + + /** + * The DB parameter group to associate with the instance. + * + * @default no parameter group + */ + readonly parameterGroup?: IClusterParameterGroup; + + /** + * A weekly time range in which maintenance should preferably execute. + * + * Must be at least 30 minutes long. + * + * Example: 'tue:04:17-tue:04:47' + * + * @default - 30-minute window selected at random from an 8-hour block of time for + * each AWS Region, occurring on a random day of the week. + * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-maintain.html#maintenance-window + */ + readonly preferredMaintenanceWindow?: string; + + /** + * The removal policy to apply when the cluster and its instances are removed + * or replaced during a stack update, or when the stack is deleted. This + * removal policy also applies to the implicit security group created for the + * cluster if one is not supplied as a parameter. + * + * @default - Retain cluster. + */ + readonly removalPolicy?: RemovalPolicy + + /** + * Specifies whether this cluster can be deleted. If deletionProtection is + * enabled, the cluster cannot be deleted unless it is modified and + * deletionProtection is disabled. deletionProtection protects clusters from + * being accidentally deleted. + * + * @default - false + */ + readonly deletionProtection?: boolean; + + /** + * Whether the profiler logs should be exported to CloudWatch. + * Note that you also have to configure the profiler log export in the Cluster's Parameter Group. + * + * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/profiling.html#profiling.enable-profiling + * @default false + */ + readonly exportProfilerLogsToCloudWatch?: boolean; + + /** + * Whether the audit logs should be exported to CloudWatch. + * Note that you also have to configure the audit log export in the Cluster's Parameter Group. + * + * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/event-auditing.html#event-auditing-enabling-auditing + * @default false + */ + readonly exportAuditLogsToCloudWatch?: boolean; + + /** + * The number of days log events are kept in CloudWatch Logs. When updating + * this property, unsetting it doesn't remove the log retention policy. To + * remove the retention policy, set the value to `Infinity`. + * + * @default - logs never expire + */ + readonly cloudWatchLogsRetention?: logs.RetentionDays; + + /** + * The IAM role for the Lambda function associated with the custom resource + * that sets the retention policy. + * + * @default - a new role is created. + */ + readonly cloudWatchLogsRetentionRole?: IRole; + + /** + * A value that indicates whether to enable Performance Insights for the instances in the DB Cluster. + * + * @default - false + */ + readonly enablePerformanceInsights?: boolean; +} + +/** + * A new or imported clustered database. + */ +abstract class DatabaseClusterBase extends Resource implements IDatabaseCluster { + /** + * Identifier of the cluster + */ + public abstract readonly clusterIdentifier: string; + /** + * Identifiers of the replicas + */ + public abstract readonly instanceIdentifiers: string[]; + + /** + * The endpoint to use for read/write operations + */ + public abstract readonly clusterEndpoint: Endpoint; + + /** + * Endpoint to use for load-balanced read-only operations. + */ + public abstract readonly clusterReadEndpoint: Endpoint; + + /** + * Endpoints which address each individual replica. + */ + public abstract readonly instanceEndpoints: Endpoint[]; + + /** + * Access to the network connections + */ + public abstract readonly connections: ec2.Connections; + + /** + * Security group identifier of this database + */ + public abstract readonly securityGroupId: string; + + /** + * Renders the secret attachment target specifications. + */ + public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { + return { + targetId: this.clusterIdentifier, + targetType: secretsmanager.AttachmentTargetType.DOCDB_DB_CLUSTER, + }; + } +} + +/** + * Create a clustered database with a given number of instances. + * + * @resource AWS::DocDB::DBCluster + */ +export class DatabaseCluster extends DatabaseClusterBase { + + /** + * The default number of instances in the DocDB cluster if none are + * specified + */ + public static readonly DEFAULT_NUM_INSTANCES = 1; + + /** + * The default port Document DB listens on + */ + public static readonly DEFAULT_PORT = 27017; + + /** + * Import an existing DatabaseCluster from properties + */ + public static fromDatabaseClusterAttributes(scope: Construct, id: string, attrs: DatabaseClusterAttributes): IDatabaseCluster { + class Import extends DatabaseClusterBase implements IDatabaseCluster { + public readonly defaultPort = typeof attrs.port !== 'undefined' ? ec2.Port.tcp(attrs.port) : undefined; + public readonly connections = new ec2.Connections({ + securityGroups: attrs.securityGroup ? [attrs.securityGroup] : undefined, + defaultPort: this.defaultPort, + }); + public readonly clusterIdentifier = attrs.clusterIdentifier; + private readonly _instanceIdentifiers = attrs.instanceIdentifiers; + private readonly _clusterEndpoint = attrs.clusterEndpointAddress && typeof attrs.port !== 'undefined' ? + new Endpoint(attrs.clusterEndpointAddress, attrs.port) : undefined; + private readonly _clusterReadEndpoint = attrs.readerEndpointAddress && typeof attrs.port !== 'undefined' ? + new Endpoint(attrs.readerEndpointAddress, attrs.port) : undefined; + private readonly _instanceEndpoints = attrs.instanceEndpointAddresses && typeof attrs.port !== 'undefined' ? + attrs.instanceEndpointAddresses.map(addr => new Endpoint(addr, attrs.port!)) : undefined; + private readonly _securityGroupId = attrs.securityGroup?.securityGroupId; + + public get instanceIdentifiers(): string[] { + if (!this._instanceIdentifiers) { + throw new Error('Cannot access `instanceIdentifiers` of an imported cluster without provided instanceIdentifiers'); + } + return this._instanceIdentifiers; + } + + public get clusterEndpoint(): Endpoint { + if (!this._clusterEndpoint) { + throw new Error('Cannot access `clusterEndpoint` of an imported cluster without an endpoint address and port'); + } + return this._clusterEndpoint; + } + + public get clusterReadEndpoint(): Endpoint { + if (!this._clusterReadEndpoint) { + throw new Error('Cannot access `clusterReadEndpoint` of an imported cluster without a readerEndpointAddress and port'); + } + return this._clusterReadEndpoint; + } + + public get instanceEndpoints(): Endpoint[] { + if (!this._instanceEndpoints) { + throw new Error('Cannot access `instanceEndpoints` of an imported cluster without instanceEndpointAddresses and port'); + } + return this._instanceEndpoints; + } + + public get securityGroupId(): string { + if (!this._securityGroupId) { + throw new Error('Cannot access `securityGroupId` of an imported cluster without securityGroupId'); + } + return this._securityGroupId; + } + } + + return new Import(scope, id); + } + + /** + * The single user secret rotation application. + */ + private static readonly SINGLE_USER_ROTATION_APPLICATION = secretsmanager.SecretRotationApplication.MONGODB_ROTATION_SINGLE_USER; + + /** + * The multi user secret rotation application. + */ + private static readonly MULTI_USER_ROTATION_APPLICATION = secretsmanager.SecretRotationApplication.MONGODB_ROTATION_MULTI_USER; + + /** + * Identifier of the cluster + */ + public readonly clusterIdentifier: string; + + /** + * The endpoint to use for read/write operations + */ + public readonly clusterEndpoint: Endpoint; + + /** + * Endpoint to use for load-balanced read-only operations. + */ + public readonly clusterReadEndpoint: Endpoint; + + /** + * The resource id for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. The cluster ID uniquely + * identifies the cluster and is used in things like IAM authentication policies. + * @attribute ClusterResourceId + */ + public readonly clusterResourceIdentifier: string; + + /** + * The connections object to implement IConnectable + */ + public readonly connections: ec2.Connections; + + /** + * Identifiers of the replicas + */ + public readonly instanceIdentifiers: string[] = []; + + /** + * Endpoints which address each individual replica. + */ + public readonly instanceEndpoints: Endpoint[] = []; + + /** + * Security group identifier of this database + */ + public readonly securityGroupId: string; + + /** + * The secret attached to this cluster + */ + public readonly secret?: secretsmanager.ISecret; + + /** + * The underlying CloudFormation resource for a database cluster. + */ + private readonly cluster: CfnDBCluster; + + /** + * The VPC where the DB subnet group is created. + */ + private readonly vpc: ec2.IVpc; + + /** + * The subnets used by the DB subnet group. + */ + private readonly vpcSubnets?: ec2.SubnetSelection; + + constructor(scope: Construct, id: string, props: DatabaseClusterProps) { + super(scope, id); + + this.vpc = props.vpc; + this.vpcSubnets = props.vpcSubnets; + + // Determine the subnet(s) to deploy the DocDB cluster to + const { subnetIds, internetConnectivityEstablished } = this.vpc.selectSubnets(this.vpcSubnets); + + // DocDB clusters require a subnet group with subnets from at least two AZs. + // We cannot test whether the subnets are in different AZs, but at least we can test the amount. + // See https://docs.aws.amazon.com/documentdb/latest/developerguide/replication.html#replication.high-availability + if (subnetIds.length < 2) { + throw new Error(`Cluster requires at least 2 subnets, got ${subnetIds.length}`); + } + + const subnetGroup = new CfnDBSubnetGroup(this, 'Subnets', { + dbSubnetGroupDescription: `Subnets for ${id} database`, + subnetIds, + }); + + // Create the security group for the DB cluster + let securityGroup: ec2.ISecurityGroup; + if (props.securityGroup) { + securityGroup = props.securityGroup; + } else { + securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { + description: 'DocumentDB security group', + vpc: this.vpc, + }); + // HACK: Use an escape-hatch to apply a consistent removal policy to the + // security group so we don't get errors when trying to delete the stack + (securityGroup.node.defaultChild as CfnResource).applyRemovalPolicy(props.removalPolicy, { + applyToUpdateReplacePolicy: true, + }); + } + this.securityGroupId = securityGroup.securityGroupId; + + // Create the CloudwatchLogsConfiguratoin + const enableCloudwatchLogsExports: string[] = []; + if (props.exportAuditLogsToCloudWatch) { + enableCloudwatchLogsExports.push('audit'); + } + if (props.exportProfilerLogsToCloudWatch) { + enableCloudwatchLogsExports.push('profiler'); + } + + // Create the secret manager secret if no password is specified + let secret: DatabaseSecret | undefined; + if (!props.masterUser.password) { + secret = new DatabaseSecret(this, 'Secret', { + username: props.masterUser.username, + encryptionKey: props.masterUser.kmsKey, + excludeCharacters: props.masterUser.excludeCharacters, + secretName: props.masterUser.secretName, + }); + } + + // Default to encrypted storage + const storageEncrypted = props.storageEncrypted ?? true; + + if (props.kmsKey && !storageEncrypted) { + throw new Error('KMS key supplied but storageEncrypted is false'); + } + + // Create the DocDB cluster + this.cluster = new CfnDBCluster(this, 'Resource', { + // Basic + engineVersion: props.engineVersion, + dbClusterIdentifier: props.dbClusterName, + dbSubnetGroupName: subnetGroup.ref, + port: props.port, + vpcSecurityGroupIds: [this.securityGroupId], + dbClusterParameterGroupName: props.parameterGroup?.parameterGroupName, + deletionProtection: props.deletionProtection, + // Admin + masterUsername: secret ? secret.secretValueFromJson('username').unsafeUnwrap() : props.masterUser.username, + masterUserPassword: secret + ? secret.secretValueFromJson('password').unsafeUnwrap() + : props.masterUser.password!.unsafeUnwrap(), // Safe usage + // Backup + backupRetentionPeriod: props.backup?.retention?.toDays(), + preferredBackupWindow: props.backup?.preferredWindow, + preferredMaintenanceWindow: props.preferredMaintenanceWindow, + // EnableCloudwatchLogsExports + enableCloudwatchLogsExports: enableCloudwatchLogsExports.length > 0 ? enableCloudwatchLogsExports : undefined, + // Encryption + kmsKeyId: props.kmsKey?.keyArn, + storageEncrypted, + }); + + this.cluster.applyRemovalPolicy(props.removalPolicy, { + applyToUpdateReplacePolicy: true, + }); + + this.clusterIdentifier = this.cluster.ref; + this.clusterResourceIdentifier = this.cluster.attrClusterResourceId; + + const port = Token.asNumber(this.cluster.attrPort); + this.clusterEndpoint = new Endpoint(this.cluster.attrEndpoint, port); + this.clusterReadEndpoint = new Endpoint(this.cluster.attrReadEndpoint, port); + + this.setLogRetention(this, props, enableCloudwatchLogsExports); + + if (secret) { + this.secret = secret.attach(this); + } + + // Create the instances + const instanceCount = props.instances ?? DatabaseCluster.DEFAULT_NUM_INSTANCES; + if (instanceCount < 1) { + throw new Error('At least one instance is required'); + } + + for (let i = 0; i < instanceCount; i++) { + const instanceIndex = i + 1; + + const instanceIdentifier = props.instanceIdentifierBase != null ? `${props.instanceIdentifierBase}${instanceIndex}` + : props.dbClusterName != null ? `${props.dbClusterName}instance${instanceIndex}` : undefined; + + const instance = new CfnDBInstance(this, `Instance${instanceIndex}`, { + // Link to cluster + dbClusterIdentifier: this.cluster.ref, + dbInstanceIdentifier: instanceIdentifier, + // Instance properties + dbInstanceClass: databaseInstanceType(props.instanceType), + enablePerformanceInsights: props.enablePerformanceInsights, + }); + + instance.applyRemovalPolicy(props.removalPolicy, { + applyToUpdateReplacePolicy: true, + }); + + // We must have a dependency on the NAT gateway provider here to create + // things in the right order. + instance.node.addDependency(internetConnectivityEstablished); + + this.instanceIdentifiers.push(instance.ref); + this.instanceEndpoints.push(new Endpoint(instance.attrEndpoint, port)); + } + + this.connections = new ec2.Connections({ + defaultPort: ec2.Port.tcp(port), + securityGroups: [securityGroup], + }); + } + + /** + * Sets up CloudWatch log retention if configured. + */ + private setLogRetention(cluster: DatabaseCluster, props: DatabaseClusterProps, cloudwatchLogsExports: string[]) { + if (props.cloudWatchLogsRetention) { + for (const log of cloudwatchLogsExports) { + new logs.LogRetention(cluster, `LogRetention${log}`, { + logGroupName: `/aws/docdb/${cluster.clusterIdentifier}/${log}`, + retention: props.cloudWatchLogsRetention, + role: props.cloudWatchLogsRetentionRole, + }); + } + } + } + + /** + * Adds the single user rotation of the master password to this cluster. + * + * @param [automaticallyAfter=Duration.days(30)] Specifies the number of days after the previous rotation + * before Secrets Manager triggers the next automatic rotation. + */ + public addRotationSingleUser(automaticallyAfter?: Duration): secretsmanager.SecretRotation { + if (!this.secret) { + throw new Error('Cannot add single user rotation for a cluster without secret.'); + } + + const id = 'RotationSingleUser'; + const existing = this.node.tryFindChild(id); + if (existing) { + throw new Error('A single user rotation was already added to this cluster.'); + } + + return new secretsmanager.SecretRotation(this, id, { + secret: this.secret, + automaticallyAfter, + application: DatabaseCluster.SINGLE_USER_ROTATION_APPLICATION, + excludeCharacters: (this.node.tryFindChild('Secret') as DatabaseSecret)._excludedCharacters, + vpc: this.vpc, + vpcSubnets: this.vpcSubnets, + target: this, + }); + } + + /** + * Adds the multi user rotation to this cluster. + */ + public addRotationMultiUser(id: string, options: RotationMultiUserOptions): secretsmanager.SecretRotation { + if (!this.secret) { + throw new Error('Cannot add multi user rotation for a cluster without secret.'); + } + return new secretsmanager.SecretRotation(this, id, { + secret: options.secret, + masterSecret: this.secret, + automaticallyAfter: options.automaticallyAfter, + excludeCharacters: (this.node.tryFindChild('Secret') as DatabaseSecret)._excludedCharacters, + application: DatabaseCluster.MULTI_USER_ROTATION_APPLICATION, + vpc: this.vpc, + vpcSubnets: this.vpcSubnets, + target: this, + }); + } + + /** + * Adds security groups to this cluster. + * @param securityGroups The security groups to add. + */ + public addSecurityGroups(...securityGroups: ec2.ISecurityGroup[]): void { + if (this.cluster.vpcSecurityGroupIds === undefined) { + this.cluster.vpcSecurityGroupIds = []; + } + this.cluster.vpcSecurityGroupIds.push(...securityGroups.map(sg => sg.securityGroupId)); + } +} + +/** + * Turn a regular instance type into a database instance type + */ +function databaseInstanceType(instanceType: ec2.InstanceType) { + return 'db.' + instanceType.toString(); +} diff --git a/packages/aws-cdk-lib/aws-docdb/lib/database-secret.ts b/packages/aws-cdk-lib/aws-docdb/lib/database-secret.ts new file mode 100644 index 0000000000000..dc380a904872e --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/database-secret.ts @@ -0,0 +1,86 @@ +import { IKey } from '../../aws-kms'; +import { ISecret, Secret } from '../../aws-secretsmanager'; +import { Aws } from '../../core'; +import { Construct } from 'constructs'; + +/** + * Construction properties for a DatabaseSecret. + */ +export interface DatabaseSecretProps { + /** + * The username. + */ + readonly username: string; + + /** + * The KMS key to use to encrypt the secret. + * + * @default default master key + */ + readonly encryptionKey?: IKey; + + /** + * The physical name of the secret + * + * @default Secretsmanager will generate a physical name for the secret + */ + readonly secretName?: string; + + /** + * The master secret which will be used to rotate this secret. + * + * @default - no master secret information will be included + */ + readonly masterSecret?: ISecret; + + /** + * Characters to not include in the generated password. + * + * @default "\"@/" + */ + readonly excludeCharacters?: string; +} + +/** + * + * A database secret. + * + * @resource AWS::SecretsManager::Secret + */ +export class DatabaseSecret extends Secret { + + /** + * the excluded characters for this Secret + * @internal + */ + public readonly _excludedCharacters: string; + + constructor(scope: Construct, id: string, props: DatabaseSecretProps) { + const excludedCharacters = props.excludeCharacters ?? '"@/'; + + super(scope, id, { + secretName: props.secretName, + description: `Generated by the CDK for stack: ${Aws.STACK_NAME}`, + encryptionKey: props.encryptionKey, + // The CloudFormation resource provider for AWS::DocDB::DBCluster currently limits the DocDB master password to + // 41 characters when pulling the password from secrets manager using a CloudFormation reference. This does not + // line up with the CloudFormation resource specification which states a maximum of 100 characters: + // + // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-docdb-dbcluster.html#cfn-docdb-dbcluster-masteruserpassword + // + // When attempting to exceed 41 characters, a deployment fails with the message: + // Length of value for property {/MasterUserPassword} is greater than maximum allowed length {41} + generateSecretString: { + passwordLength: 41, + secretStringTemplate: JSON.stringify({ + username: props.username, + masterarn: props.masterSecret?.secretArn, + }), + generateStringKey: 'password', + excludeCharacters: excludedCharacters, + }, + }); + + this._excludedCharacters = excludedCharacters; + } +} diff --git a/packages/aws-cdk-lib/aws-docdb/lib/endpoint.ts b/packages/aws-cdk-lib/aws-docdb/lib/endpoint.ts new file mode 100644 index 0000000000000..02e6e813c2a6d --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/endpoint.ts @@ -0,0 +1,81 @@ +import { Token } from '../../core'; + +/** + * Connection endpoint of a database cluster or instance + * + * Consists of a combination of hostname and port. + */ +export class Endpoint { + /** + * The minimum port value + */ + private static readonly MIN_PORT = 1; + + /** + * The maximum port value + */ + private static readonly MAX_PORT = 65535; + + /** + * Determines if a port is valid + * + * @param port: The port number + * @returns boolean whether the port is valid + */ + private static isValidPort(port: number): boolean { + return Number.isInteger(port) && port >= Endpoint.MIN_PORT && port <= Endpoint.MAX_PORT; + } + + /** + * The hostname of the endpoint + */ + public readonly hostname: string; + + /** + * The port number of the endpoint. + * + * This can potentially be a CDK token. If you need to embed the port in a string (e.g. instance user data script), + * use `Endpoint.portAsString`. + */ + public readonly port: number; + + /** + * The combination of ``HOSTNAME:PORT`` for this endpoint. + */ + public readonly socketAddress: string; + + /** + * Constructs an Endpoint instance. + * + * @param address - The hostname or address of the endpoint + * @param port - The port number of the endpoint + */ + constructor(address: string, port: number) { + if (!Token.isUnresolved(port) && !Endpoint.isValidPort(port)) { + throw new Error(`Port must be an integer between [${Endpoint.MIN_PORT}, ${Endpoint.MAX_PORT}] but got: ${port}`); + } + + this.hostname = address; + this.port = port; + + const portDesc = Token.isUnresolved(port) ? Token.asString(port) : port; + this.socketAddress = `${address}:${portDesc}`; + } + + /** + * Returns the port number as a string representation that can be used for embedding within other strings. + * + * This is intended to deal with CDK's token system. Numeric CDK tokens are not expanded when their string + * representation is embedded in a string. This function returns the port either as an unresolved string token or + * as a resolved string representation of the port value. + * + * @returns {string} An (un)resolved string representation of the endpoint's port number + */ + public portAsString(): string { + if (Token.isUnresolved(this.port)) { + return Token.asString(this.port); + } else { + return this.port.toString(); + } + } +} diff --git a/packages/@aws-cdk/aws-docdb/lib/index.ts b/packages/aws-cdk-lib/aws-docdb/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-docdb/lib/index.ts rename to packages/aws-cdk-lib/aws-docdb/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-docdb/lib/instance.ts b/packages/aws-cdk-lib/aws-docdb/lib/instance.ts new file mode 100644 index 0000000000000..623107ba020f3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/instance.ts @@ -0,0 +1,234 @@ +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import { ArnFormat } from '../../core'; +import { Construct } from 'constructs'; +import { IDatabaseCluster } from './cluster-ref'; +import { CfnDBInstance } from './docdb.generated'; +import { Endpoint } from './endpoint'; + +/** + * A database instance + */ +export interface IDatabaseInstance extends cdk.IResource { + /** + * The instance identifier. + */ + readonly instanceIdentifier: string; + + /** + * The instance arn. + */ + readonly instanceArn: string; + + /** + * The instance endpoint address. + * + * @attribute Endpoint + */ + readonly dbInstanceEndpointAddress: string; + + /** + * The instance endpoint port. + * + * @attribute Port + */ + readonly dbInstanceEndpointPort: string; + + /** + * The instance endpoint. + */ + readonly instanceEndpoint: Endpoint; +} + +/** + * Properties that describe an existing instance + */ +export interface DatabaseInstanceAttributes { + /** + * The instance identifier. + */ + readonly instanceIdentifier: string; + + /** + * The endpoint address. + */ + readonly instanceEndpointAddress: string; + + /** + * The database port. + */ + readonly port: number; +} + +/** + * A new or imported database instance. + */ +abstract class DatabaseInstanceBase extends cdk.Resource implements IDatabaseInstance { + /** + * Import an existing database instance. + */ + public static fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance { + class Import extends DatabaseInstanceBase implements IDatabaseInstance { + public readonly defaultPort = ec2.Port.tcp(attrs.port); + public readonly instanceIdentifier = attrs.instanceIdentifier; + public readonly dbInstanceEndpointAddress = attrs.instanceEndpointAddress; + public readonly dbInstanceEndpointPort = attrs.port.toString(); + public readonly instanceEndpoint = new Endpoint(attrs.instanceEndpointAddress, attrs.port); + } + + return new Import(scope, id); + } + + /** + * @inheritdoc + */ + public abstract readonly instanceIdentifier: string; + /** + * @inheritdoc + */ + public abstract readonly dbInstanceEndpointAddress: string; + /** + * @inheritdoc + */ + public abstract readonly dbInstanceEndpointPort: string; + /** + * @inheritdoc + */ + public abstract readonly instanceEndpoint: Endpoint; + + /** + * The instance arn. + */ + public get instanceArn(): string { + return cdk.Stack.of(this).formatArn({ + service: 'rds', + resource: 'db', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + resourceName: this.instanceIdentifier, + }); + } +} + +/** + * Construction properties for a DatabaseInstanceNew + */ +export interface DatabaseInstanceProps { + /** + * The DocumentDB database cluster the instance should launch into. + */ + readonly cluster: IDatabaseCluster; + + /** + * The name of the compute and memory capacity classes. + */ + readonly instanceType: ec2.InstanceType; + + /** + * The name of the Availability Zone where the DB instance will be located. + * + * @default - no preference + */ + readonly availabilityZone?: string; + + /** + * A name for the DB instance. If you specify a name, AWS CloudFormation + * converts it to lowercase. + * + * @default - a CloudFormation generated name + */ + readonly dbInstanceName?: string; + + /** + * Indicates that minor engine upgrades are applied automatically to the + * DB instance during the maintenance window. + * + * @default true + */ + readonly autoMinorVersionUpgrade?: boolean; + + /** + * The weekly time range (in UTC) during which system maintenance can occur. + * + * Format: `ddd:hh24:mi-ddd:hh24:mi` + * Constraint: Minimum 30-minute window + * + * @default - a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region, occurring on a random day of the week. To see + * the time blocks available, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-maintain.html#maintenance-window + */ + readonly preferredMaintenanceWindow?: string; + + /** + * The CloudFormation policy to apply when the instance is removed from the + * stack or replaced during an update. + * + * @default RemovalPolicy.Retain + */ + readonly removalPolicy?: cdk.RemovalPolicy + + /** + * A value that indicates whether to enable Performance Insights for the DB Instance. + * + * @default - false + */ + readonly enablePerformanceInsights?: boolean; +} + +/** + * A database instance + * + * @resource AWS::DocDB::DBInstance + */ +export class DatabaseInstance extends DatabaseInstanceBase implements IDatabaseInstance { + /** + * The instance's database cluster + */ + public readonly cluster: IDatabaseCluster; + + /** + * @inheritdoc + */ + public readonly instanceIdentifier: string; + + /** + * @inheritdoc + */ + public readonly dbInstanceEndpointAddress: string; + + /** + * @inheritdoc + */ + public readonly dbInstanceEndpointPort: string; + + /** + * @inheritdoc + */ + public readonly instanceEndpoint: Endpoint; + + constructor(scope: Construct, id: string, props: DatabaseInstanceProps) { + super(scope, id); + + const instance = new CfnDBInstance(this, 'Resource', { + dbClusterIdentifier: props.cluster.clusterIdentifier, + dbInstanceClass: `db.${props.instanceType}`, + autoMinorVersionUpgrade: props.autoMinorVersionUpgrade ?? true, + availabilityZone: props.availabilityZone, + dbInstanceIdentifier: props.dbInstanceName, + preferredMaintenanceWindow: props.preferredMaintenanceWindow, + enablePerformanceInsights: props.enablePerformanceInsights, + }); + + this.cluster = props.cluster; + this.instanceIdentifier = instance.ref; + this.dbInstanceEndpointAddress = instance.attrEndpoint; + this.dbInstanceEndpointPort = instance.attrPort; + + // create a number token that represents the port of the instance + const portAttribute = cdk.Token.asNumber(instance.attrPort); + this.instanceEndpoint = new Endpoint(instance.attrEndpoint, portAttribute); + + instance.applyRemovalPolicy(props.removalPolicy, { + applyToUpdateReplacePolicy: true, + }); + } +} diff --git a/packages/aws-cdk-lib/aws-docdb/lib/parameter-group.ts b/packages/aws-cdk-lib/aws-docdb/lib/parameter-group.ts new file mode 100644 index 0000000000000..f8edd9723a22f --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/parameter-group.ts @@ -0,0 +1,87 @@ +import { IResource, Resource } from '../../core'; +import { Construct } from 'constructs'; +import { CfnDBClusterParameterGroup } from './docdb.generated'; + +/** + * A parameter group + */ +export interface IClusterParameterGroup extends IResource { + /** + * The name of this parameter group + */ + readonly parameterGroupName: string; +} + +/** + * A new cluster or instance parameter group + */ +abstract class ClusterParameterGroupBase extends Resource implements IClusterParameterGroup { + /** + * Imports a parameter group + */ + public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IClusterParameterGroup { + class Import extends Resource implements IClusterParameterGroup { + public readonly parameterGroupName = parameterGroupName; + } + return new Import(scope, id); + } + + /** + * The name of the parameter group + */ + public abstract readonly parameterGroupName: string; +} + +/** + * Properties for a cluster parameter group + */ +export interface ClusterParameterGroupProps { + /** + * Description for this parameter group + * + * @default a CDK generated description + */ + readonly description?: string; + + /** + * Database family of this parameter group + */ + readonly family: string; + + /** + * The name of the cluster parameter group + * + * @default A CDK generated name for the cluster parameter group + */ + readonly dbClusterParameterGroupName?: string; + + /** + * The parameters in this parameter group + */ + readonly parameters: { [key: string]: string }; +} + +/** + * A cluster parameter group + * + * @resource AWS::DocDB::DBClusterParameterGroup + */ +export class ClusterParameterGroup extends ClusterParameterGroupBase implements IClusterParameterGroup { + /** + * The name of the parameter group + */ + public readonly parameterGroupName: string; + + constructor(scope: Construct, id: string, props: ClusterParameterGroupProps) { + super(scope, id); + + const resource = new CfnDBClusterParameterGroup(this, 'Resource', { + name: props.dbClusterParameterGroupName, + description: props.description || `Cluster parameter group for ${props.family}`, + family: props.family, + parameters: props.parameters, + }); + + this.parameterGroupName = resource.ref; + } +} diff --git a/packages/aws-cdk-lib/aws-docdb/lib/props.ts b/packages/aws-cdk-lib/aws-docdb/lib/props.ts new file mode 100644 index 0000000000000..729f30bb51612 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/lib/props.ts @@ -0,0 +1,101 @@ +import * as kms from '../../aws-kms'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { Duration, SecretValue } from '../../core'; + +/** + * Backup configuration for DocumentDB databases + * + * @default - The retention period for automated backups is 1 day. + * The preferred backup window will be a 30-minute window selected at random + * from an 8-hour block of time for each AWS Region. + * @see https://docs.aws.amazon.com/documentdb/latest/developerguide/backup-restore.db-cluster-snapshots.html#backup-restore.backup-window + */ +export interface BackupProps { + + /** + * How many days to retain the backup + */ + readonly retention: Duration; + + /** + * A daily time range in 24-hours UTC format in which backups preferably execute. + * + * Must be at least 30 minutes long. + * + * Example: '01:00-02:00' + * + * @default - a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region. To see the time blocks available, see + * https://docs.aws.amazon.com/documentdb/latest/developerguide/backup-restore.db-cluster-snapshots.html#backup-restore.backup-window + */ + readonly preferredWindow?: string; +} + +/** + * Login credentials for a database cluster + */ +export interface Login { + /** + * Username + */ + readonly username: string; + /** + * Password + * + * Do not put passwords in your CDK code directly. + * + * @default a Secrets Manager generated password + */ + readonly password?: SecretValue; + /** + * KMS encryption key to encrypt the generated secret. + * + * @default default master key + */ + readonly kmsKey?: kms.IKey; + + /** + * Specifies characters to not include in generated passwords. + * + * @default "\"@/" + */ + readonly excludeCharacters?: string; + + /** + * The physical name of the secret, that will be generated. + * + * @default Secretsmanager will generate a physical name for the secret + */ + readonly secretName?: string; +} + +/** + * Options to add the multi user rotation + */ +export interface RotationMultiUserOptions { + /** + * The secret to rotate. It must be a JSON string with the following format: + * ``` + * { + * "engine": , + * "host": , + * "username": , + * "password": , + * "dbname": , + * "port": , + * "masterarn": + * "ssl": + * } + * ``` + */ + readonly secret: secretsmanager.ISecret; + + /** + * Specifies the number of days after the previous rotation before + * Secrets Manager triggers the next automatic rotation. + * + * @default Duration.days(30) + */ + readonly automaticallyAfter?: Duration; +} diff --git a/packages/aws-cdk-lib/aws-docdb/test/cluster.test.ts b/packages/aws-cdk-lib/aws-docdb/test/cluster.test.ts new file mode 100644 index 0000000000000..50b23408db59a --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/test/cluster.test.ts @@ -0,0 +1,965 @@ +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; +import { ClusterParameterGroup, DatabaseCluster, DatabaseSecret } from '../lib'; + +describe('DatabaseCluster', () => { + test('check that instantiation works', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::DocDB::DBCluster', { + Properties: { + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + MasterUsername: 'admin', + MasterUserPassword: 'tooshort', + VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], + StorageEncrypted: true, + }, + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }); + + Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBSubnetGroup', { + SubnetIds: [ + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + { Ref: 'VPCPrivateSubnet3Subnet3EDCD457' }, + ], + }); + }); + + test('can create a cluster with a single instance', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + instances: 1, + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + MasterUsername: 'admin', + MasterUserPassword: 'tooshort', + VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], + }); + }); + + test('errors when less than one instance is specified', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + expect(() => { + new DatabaseCluster(stack, 'Database', { + instances: 0, + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), + }); + }).toThrowError('At least one instance is required'); + }); + + test('errors when only one subnet is specified', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 1, + }); + + // WHEN + expect(() => { + new DatabaseCluster(stack, 'Database', { + instances: 1, + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE), + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + }); + }).toThrowError('Cluster requires at least 2 subnets, got 1'); + }); + + test('secret attachment target type is correct', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + instances: 1, + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::SecretTargetAttachment', { + SecretId: { Ref: 'DatabaseSecret3B817195' }, + TargetId: { Ref: 'DatabaseB269D8BB' }, + TargetType: 'AWS::DocDB::DBCluster', + }); + }); + + test('can create a cluster with imported vpc and security group', () => { + // GIVEN + const stack = testStack(); + const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { + vpcId: 'VPC12345', + }); + const sg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'SecurityGroupId12345'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + instances: 1, + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + securityGroup: sg, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + MasterUsername: 'admin', + MasterUserPassword: 'tooshort', + VpcSecurityGroupIds: ['SecurityGroupId12345'], + }); + }); + + test('can configure cluster deletion protection', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + deletionProtection: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + DeletionProtection: true, + }); + }); + + test('cluster with parameter group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const group = new ClusterParameterGroup(stack, 'Params', { + family: 'hello', + description: 'bye', + parameters: { + param: 'value', + }, + }); + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + parameterGroup: group, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + DBClusterParameterGroupName: { Ref: 'ParamsA8366201' }, + }); + }); + + test('cluster with imported parameter group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const group = ClusterParameterGroup.fromParameterGroupName(stack, 'Params', 'ParamGroupName'); + + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + parameterGroup: group, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + DBClusterParameterGroupName: 'ParamGroupName', + }); + }); + + test('creates a secret when master credentials are not specified', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + MasterUsername: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DatabaseSecret3B817195', + }, + ':SecretString:username::}}', + ], + ], + }, + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DatabaseSecret3B817195', + }, + ':SecretString:password::}}', + ], + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: { + ExcludeCharacters: '\"@/', + GenerateStringKey: 'password', + PasswordLength: 41, + SecretStringTemplate: '{"username":"admin"}', + }, + }); + }); + + test('creates a secret with excludeCharacters', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + excludeCharacters: '"@/()[]', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: Match.objectLike({ + ExcludeCharacters: '\"@/()[]', + }), + }); + }); + + test('creates a secret with secretName set', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + secretName: '/myapp/mydocdb/masteruser', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Name: '/myapp/mydocdb/masteruser', + }); + }); + + test('create an encrypted cluster with custom KMS key', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + kmsKey: new kms.Key(stack, 'Key'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + KmsKeyId: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + StorageEncrypted: true, + }); + }); + + test('creating a cluster defaults to using encryption', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + StorageEncrypted: true, + }); + }); + + test('supplying a KMS key with storageEncryption false throws an error', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + function action() { + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + kmsKey: new kms.Key(stack, 'Key'), + storageEncrypted: false, + }); + } + + // THEN + expect(action).toThrow(); + }); + + test('cluster exposes different read and write endpoints', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const cluster = new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // THEN + expect(stack.resolve(cluster.clusterEndpoint)).not.toBe(stack.resolve(cluster.clusterReadEndpoint)); + }); + + test('instance identifier used when present', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const instanceIdentifierBase = 'instanceidentifierbase-'; + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + instanceIdentifierBase, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBInstance', { + DBInstanceIdentifier: `${instanceIdentifierBase}1`, + }); + }); + + test('cluster identifier used', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const clusterIdentifier = 'clusteridentifier-'; + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + dbClusterName: clusterIdentifier, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBInstance', { + DBInstanceIdentifier: `${clusterIdentifier}instance1`, + }); + }); + + test('imported cluster has supplied attributes', () => { + // GIVEN + const stack = testStack(); + + // WHEN + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterEndpointAddress: 'addr', + clusterIdentifier: 'identifier', + instanceEndpointAddresses: ['addr'], + instanceIdentifiers: ['identifier'], + port: 3306, + readerEndpointAddress: 'reader-address', + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + }), + }); + + // THEN + expect(cluster.clusterEndpoint.hostname).toEqual('addr'); + expect(cluster.clusterEndpoint.port).toEqual(3306); + expect(cluster.clusterIdentifier).toEqual('identifier'); + expect(cluster.instanceIdentifiers).toEqual(['identifier']); + expect(cluster.clusterReadEndpoint.hostname).toEqual('reader-address'); + expect(cluster.securityGroupId).toEqual('sg-123456789'); + }); + + test('imported cluster with imported security group honors allowAllOutbound', () => { + // GIVEN + const stack = testStack(); + + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterEndpointAddress: 'addr', + clusterIdentifier: 'identifier', + instanceEndpointAddresses: ['addr'], + instanceIdentifiers: ['identifier'], + port: 3306, + readerEndpointAddress: 'reader-address', + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + }), + }); + + // WHEN + cluster.connections.allowToAnyIpv4(ec2.Port.tcp(443)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: 'sg-123456789', + }); + }); + + test('minimal imported cluster throws on accessing attributes for unprovided parameters', () => { + const stack = testStack(); + + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterIdentifier: 'identifier', + }); + + expect(cluster.clusterIdentifier).toEqual('identifier'); + expect(() => cluster.clusterEndpoint).toThrow(/Cannot access `clusterEndpoint` of an imported cluster/); + expect(() => cluster.clusterReadEndpoint).toThrow(/Cannot access `clusterReadEndpoint` of an imported cluster/); + expect(() => cluster.instanceIdentifiers).toThrow(/Cannot access `instanceIdentifiers` of an imported cluster/); + expect(() => cluster.instanceEndpoints).toThrow(/Cannot access `instanceEndpoints` of an imported cluster/); + expect(() => cluster.securityGroupId).toThrow(/Cannot access `securityGroupId` of an imported cluster/); + }); + + test('backup retention period respected', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + backup: { + retention: cdk.Duration.days(20), + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + BackupRetentionPeriod: 20, + }); + }); + + test('backup maintenance window respected', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + backup: { + retention: cdk.Duration.days(20), + preferredWindow: '07:34-08:04', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + BackupRetentionPeriod: 20, + PreferredBackupWindow: '07:34-08:04', + }); + }); + + test('regular maintenance window respected', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + preferredMaintenanceWindow: '07:34-08:04', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + PreferredMaintenanceWindow: '07:34-08:04', + }); + }); + + test('can configure CloudWatchLogs for audit', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + exportAuditLogsToCloudWatch: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + EnableCloudwatchLogsExports: ['audit'], + }); + }); + + test('can configure CloudWatchLogs for profiler', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + exportProfilerLogsToCloudWatch: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + EnableCloudwatchLogsExports: ['profiler'], + }); + }); + + test('can configure CloudWatchLogs for all logs', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + exportAuditLogsToCloudWatch: true, + exportProfilerLogsToCloudWatch: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + EnableCloudwatchLogsExports: ['audit', 'profiler'], + }); + }); + + test('can set CloudWatch log retention', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + exportAuditLogsToCloudWatch: true, + exportProfilerLogsToCloudWatch: true, + cloudWatchLogsRetention: logs.RetentionDays.THREE_MONTHS, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { + ServiceToken: { + 'Fn::GetAtt': [ + 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', + 'Arn', + ], + }, + LogGroupName: { 'Fn::Join': ['', ['/aws/docdb/', { Ref: 'DatabaseB269D8BB' }, '/audit']] }, + RetentionInDays: 90, + }); + Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { + ServiceToken: { + 'Fn::GetAtt': [ + 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', + 'Arn', + ], + }, + LogGroupName: { 'Fn::Join': ['', ['/aws/docdb/', { Ref: 'DatabaseB269D8BB' }, '/profiler']] }, + RetentionInDays: 90, + }); + }); + + test('can enable Performance Insights on instances', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + enablePerformanceInsights: true, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { + Properties: { + EnablePerformanceInsights: true, + }, + }); + }); + + test('single user rotation', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + }); + + // WHEN + cluster.addRotationSingleUser(cdk.Duration.days(5)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Location: { + ApplicationId: { 'Fn::FindInMap': ['DatabaseRotationSingleUserSARMapping9AEB3E55', { Ref: 'AWS::Partition' }, 'applicationId'] }, + SemanticVersion: { 'Fn::FindInMap': ['DatabaseRotationSingleUserSARMapping9AEB3E55', { Ref: 'AWS::Partition' }, 'semanticVersion'] }, + }, + Parameters: { + endpoint: { + 'Fn::Join': [ + '', + [ + 'https://secretsmanager.us-test-1.', + { Ref: 'AWS::URLSuffix' }, + ], + ], + }, + functionName: 'DatabaseRotationSingleUser458A45BE', + excludeCharacters: '\"@/', + vpcSubnetIds: { + 'Fn::Join': [ + '', + [ + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + ',', + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + ',', + { Ref: 'VPCPrivateSubnet3Subnet3EDCD457' }, + ], + ], + }, + vpcSecurityGroupIds: { + 'Fn::GetAtt': ['DatabaseRotationSingleUserSecurityGroupAC6E0E73', 'GroupId'], + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { Ref: 'DatabaseSecretAttachmentE5D1B020' }, + RotationLambdaARN: { + 'Fn::GetAtt': ['DatabaseRotationSingleUser65F55654', 'Outputs.RotationLambdaARN'], + }, + RotationRules: { + AutomaticallyAfterDays: 5, + }, + }); + }); + + test('single user rotation requires secret', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('secret'), + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + }); + + // WHEN + function addSingleUserRotation() { + cluster.addRotationSingleUser(cdk.Duration.days(10)); + } + + // THEN + expect(addSingleUserRotation).toThrow(); + }); + + test('no multiple single user rotations', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + }); + + // WHEN + cluster.addRotationSingleUser(cdk.Duration.days(5)); + function addSecondRotation() { + cluster.addRotationSingleUser(cdk.Duration.days(10)); + } + + // THEN + expect(addSecondRotation).toThrow(); + }); + + test('multi user rotation', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + }); + const userSecret = new DatabaseSecret(stack, 'UserSecret', { + username: 'seconduser', + masterSecret: cluster.secret, + }); + userSecret.attach(cluster); + + // WHEN + cluster.addRotationMultiUser('Rotation', { + secret: userSecret, + automaticallyAfter: cdk.Duration.days(5), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Location: { + ApplicationId: { 'Fn::FindInMap': ['DatabaseRotationSARMappingE46CFA92', { Ref: 'AWS::Partition' }, 'applicationId'] }, + SemanticVersion: { 'Fn::FindInMap': ['DatabaseRotationSARMappingE46CFA92', { Ref: 'AWS::Partition' }, 'semanticVersion'] }, + }, + Parameters: { + endpoint: { + 'Fn::Join': [ + '', + [ + 'https://secretsmanager.us-test-1.', + { Ref: 'AWS::URLSuffix' }, + ], + ], + }, + functionName: 'DatabaseRotation0D47EBD2', + excludeCharacters: '\"@/', + vpcSubnetIds: { + 'Fn::Join': [ + '', + [ + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + ',', + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + ',', + { Ref: 'VPCPrivateSubnet3Subnet3EDCD457' }, + ], + ], + }, + vpcSecurityGroupIds: { + 'Fn::GetAtt': ['DatabaseRotationSecurityGroup17736B63', 'GroupId'], + }, + masterSecretArn: { Ref: 'DatabaseSecretAttachmentE5D1B020' }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { Ref: 'UserSecret0463E4F5' }, + RotationLambdaARN: { + 'Fn::GetAtt': ['DatabaseRotation6B6E1D86', 'Outputs.RotationLambdaARN'], + }, + RotationRules: { + AutomaticallyAfterDays: 5, + }, + }); + }); + + test('multi user rotation requires secret', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('secret'), + }, + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + }); + const userSecret = new DatabaseSecret(stack, 'UserSecret', { + username: 'seconduser', + masterSecret: cluster.secret, + }); + userSecret.attach(cluster); + + // WHEN + function addMultiUserRotation() { + cluster.addRotationMultiUser('Rotation', { + secret: userSecret, + }); + } + + // THEN + expect(addMultiUserRotation).toThrow(); + }); + + test('adds security groups', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + vpc, + masterUser: { + username: 'admin', + }, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.SMALL), + }); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc, + }); + + // WHEN + cluster.addSecurityGroups(securityGroup); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBCluster', { + VpcSecurityGroupIds: Match.arrayWith([stack.resolve(securityGroup.securityGroupId)]), + }); + }); +}); + +function testStack() { + const stack = new cdk.Stack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } }); + stack.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']); + return stack; +} diff --git a/packages/@aws-cdk/aws-docdb/test/endpoint.test.ts b/packages/aws-cdk-lib/aws-docdb/test/endpoint.test.ts similarity index 98% rename from packages/@aws-cdk/aws-docdb/test/endpoint.test.ts rename to packages/aws-cdk-lib/aws-docdb/test/endpoint.test.ts index fa58338182e2c..6eed21ded42a8 100644 --- a/packages/@aws-cdk/aws-docdb/test/endpoint.test.ts +++ b/packages/aws-cdk-lib/aws-docdb/test/endpoint.test.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; import { Endpoint } from '../lib'; const CDK_NUMERIC_TOKEN = Token.asNumber({ Ref: 'abc' }); diff --git a/packages/aws-cdk-lib/aws-docdb/test/instance.test.ts b/packages/aws-cdk-lib/aws-docdb/test/instance.test.ts new file mode 100644 index 0000000000000..8bfb0569d8c8d --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/test/instance.test.ts @@ -0,0 +1,220 @@ +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import * as constructs from 'constructs'; +import { DatabaseCluster, DatabaseInstance } from '../lib'; + +const CLUSTER_INSTANCE_TYPE = ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE); +const SINGLE_INSTANCE_TYPE = ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.XLARGE); +const EXPECTED_SYNTH_INSTANCE_TYPE = `db.${SINGLE_INSTANCE_TYPE}`; + +describe('DatabaseInstance', () => { + test('check that instantiation works', () => { + // GIVEN + const stack = testStack(); + + // WHEN + new DatabaseInstance(stack, 'Instance', { + cluster: stack.cluster, + instanceType: SINGLE_INSTANCE_TYPE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { + Properties: { + DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' }, + DBInstanceClass: EXPECTED_SYNTH_INSTANCE_TYPE, + AutoMinorVersionUpgrade: true, + }, + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }); + }); + + test.each([ + [undefined, true], + [true, true], + [false, false], + ])('check that autoMinorVersionUpdate works: %p', (given: boolean | undefined, expected: boolean) => { + // GIVEN + const stack = testStack(); + + // WHEN + new DatabaseInstance(stack, 'Instance', { + cluster: stack.cluster, + instanceType: SINGLE_INSTANCE_TYPE, + autoMinorVersionUpgrade: given, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { + Properties: { + DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' }, + DBInstanceClass: EXPECTED_SYNTH_INSTANCE_TYPE, + AutoMinorVersionUpgrade: expected, + }, + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }); + }); + + test('check that the endpoint works', () => { + // GIVEN + const stack = testStack(); + const instance = new DatabaseInstance(stack, 'Instance', { + cluster: stack.cluster, + instanceType: SINGLE_INSTANCE_TYPE, + }); + const exportName = 'DbInstanceEndpoint'; + + // WHEN + new cdk.CfnOutput(stack, exportName, { + exportName, + value: instance.instanceEndpoint.socketAddress, + }); + + // THEN + Template.fromStack(stack).hasOutput(exportName, { + Export: { + Name: exportName, + }, + Value: { + 'Fn::Join': [ + '', + [ + { 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint'] }, + ':', + { 'Fn::GetAtt': ['InstanceC1063A87', 'Port'] }, + ], + ], + }, + }); + }); + + test('check that instanceArn property works', () => { + // GIVEN + const stack = testStack(); + const instance = new DatabaseInstance(stack, 'Instance', { + cluster: stack.cluster, + instanceType: SINGLE_INSTANCE_TYPE, + }); + const exportName = 'DbInstanceArn'; + + // WHEN + new cdk.CfnOutput(stack, exportName, { + exportName, + value: instance.instanceArn, + }); + + // THEN + Template.fromStack(stack).hasOutput(exportName, { + Export: { + Name: exportName, + }, + Value: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':rds:us-test-1:12345:db:', + { Ref: 'InstanceC1063A87' }, + ], + ], + }, + }); + }); + + test('check importing works as expected', () => { + // GIVEN + const stack = testStack(); + const arnExportName = 'DbInstanceArn'; + const endpointExportName = 'DbInstanceEndpoint'; + const instanceEndpointAddress = '127.0.0.1'; + const instanceIdentifier = 'InstanceID'; + const port = 8888; + + // WHEN + const instance = DatabaseInstance.fromDatabaseInstanceAttributes(stack, 'Instance', { + instanceEndpointAddress, + instanceIdentifier, + port, + }); + new cdk.CfnOutput(stack, 'ArnOutput', { + exportName: arnExportName, + value: instance.instanceArn, + }); + new cdk.CfnOutput(stack, 'EndpointOutput', { + exportName: endpointExportName, + value: instance.instanceEndpoint.socketAddress, + }); + + // THEN + Template.fromStack(stack).hasOutput('ArnOutput', { + Export: { + Name: arnExportName, + }, + Value: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + `:rds:us-test-1:12345:db:${instanceIdentifier}`, + ], + ], + }, + }); + Template.fromStack(stack).hasOutput('EndpointOutput', { + Export: { + Name: endpointExportName, + }, + Value: `${instanceEndpointAddress}:${port}`, + }); + }); + + test('can enable performance insights on instances', () => { + // GIVEN + const stack = testStack(); + + // WHEN + new DatabaseInstance(stack, 'Instance', { + cluster: stack.cluster, + instanceType: SINGLE_INSTANCE_TYPE, + enablePerformanceInsights: true, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::DocDB::DBInstance', { + Properties: { + EnablePerformanceInsights: true, + }, + }); + }); +}); + +class TestStack extends cdk.Stack { + public readonly vpc: ec2.Vpc; + public readonly cluster: DatabaseCluster; + + constructor(scope?: constructs.Construct, id?: string, props: cdk.StackProps = {}) { + super(scope, id, props); + + this.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']); + + this.vpc = new ec2.Vpc(this, 'VPC'); + this.cluster = new DatabaseCluster(this, 'Database', { + masterUser: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceType: CLUSTER_INSTANCE_TYPE, + vpc: this.vpc, + }); + } +} + +function testStack() { + const stack = new TestStack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } }); + return stack; +} diff --git a/packages/aws-cdk-lib/aws-docdb/test/integ.cluster-rotation.lit.ts b/packages/aws-cdk-lib/aws-docdb/test/integ.cluster-rotation.lit.ts new file mode 100644 index 0000000000000..857e9bbe06cb0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdb/test/integ.cluster-rotation.lit.ts @@ -0,0 +1,31 @@ +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import * as docdb from '../lib'; + +/* + * Stack verification steps: + * * aws secretsmanager describe-secret --secret-id + * * aws lambda get-function --function-name { + test('check that instantiation works', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new ClusterParameterGroup(stack, 'Params', { + family: 'hello', + description: 'desc', + parameters: { + key: 'value', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBClusterParameterGroup', { + Description: 'desc', + Family: 'hello', + Parameters: { + key: 'value', + }, + }); + }); + + test('check automatically generated descriptions', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new ClusterParameterGroup(stack, 'Params', { + family: 'hello', + parameters: { + key: 'value', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::DocDB::DBClusterParameterGroup', { + Description: 'Cluster parameter group for hello', + Family: 'hello', + Parameters: { + key: 'value', + }, + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-docdbelastic/.jsiirc.json b/packages/aws-cdk-lib/aws-docdbelastic/.jsiirc.json new file mode 100644 index 0000000000000..dcc0e2d7a07a9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdbelastic/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.DocDBElastic" + }, + "java": { + "package": "software.amazon.awscdk.services.docdbelastic" + }, + "python": { + "module": "aws_cdk.aws_docdbelastic" + } + } +} diff --git a/packages/aws-cdk-lib/aws-docdbelastic/README.md b/packages/aws-cdk-lib/aws-docdbelastic/README.md new file mode 100644 index 0000000000000..6599e0935fe7f --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdbelastic/README.md @@ -0,0 +1,27 @@ +# AWS::DocDBElastic Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as docdbelastic from 'aws-cdk-lib/aws-docdbelastic'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for DocDBElastic construct libraries](https://constructs.dev/search?q=docdbelastic) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::DocDBElastic resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DocDBElastic.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::DocDBElastic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_DocDBElastic.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-docdbelastic/index.ts b/packages/aws-cdk-lib/aws-docdbelastic/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdbelastic/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-docdbelastic/lib/index.ts b/packages/aws-cdk-lib/aws-docdbelastic/lib/index.ts new file mode 100644 index 0000000000000..4a935fa258c43 --- /dev/null +++ b/packages/aws-cdk-lib/aws-docdbelastic/lib/index.ts @@ -0,0 +1 @@ +export * from './docdbelastic.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-dynamodb/.jsiirc.json b/packages/aws-cdk-lib/aws-dynamodb/.jsiirc.json new file mode 100644 index 0000000000000..42568063be382 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dynamodb/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.dynamodb" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.DynamoDB" + }, + "python": { + "module": "aws_cdk.aws_dynamodb" + } + } +} diff --git a/packages/aws-cdk-lib/aws-dynamodb/README.md b/packages/aws-cdk-lib/aws-dynamodb/README.md new file mode 100644 index 0000000000000..267a72409dcad --- /dev/null +++ b/packages/aws-cdk-lib/aws-dynamodb/README.md @@ -0,0 +1,240 @@ +# Amazon DynamoDB Construct Library + + +Here is a minimal deployable DynamoDB table definition: + +```ts +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, +}); +``` + +## Importing existing tables + +To import an existing table into your CDK application, use the `Table.fromTableName`, `Table.fromTableArn` or `Table.fromTableAttributes` +factory method. This method accepts table name or table ARN which describes the properties of an already +existing table: + +```ts +declare const user: iam.User; +const table = dynamodb.Table.fromTableArn(this, 'ImportedTable', 'arn:aws:dynamodb:us-east-1:111111111:table/my-table'); +// now you can just call methods on the table +table.grantReadWriteData(user); +``` + +If you intend to use the `tableStreamArn` (including indirectly, for example by creating an +`@aws-cdk/aws-lambda-event-source.DynamoEventSource` on the imported table), you *must* use the +`Table.fromTableAttributes` method and the `tableStreamArn` property *must* be populated. + +In order to grant permissions to indexes on imported tables you can either set `grantIndexPermissions` to `true`, or you can provide the indexes via the `globalIndexes` or `localIndexes` properties. This will enable `grant*` methods to also grant permissions to *all* table indexes. + +## Keys + +When a table is defined, you must define it's schema using the `partitionKey` +(required) and `sortKey` (optional) properties. + +## Billing Mode + +DynamoDB supports two billing modes: + +* PROVISIONED - the default mode where the table and global secondary indexes have configured read and write capacity. +* PAY_PER_REQUEST - on-demand pricing and scaling. You only pay for what you use and there is no read and write capacity for the table or its global secondary indexes. + +```ts +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, +}); +``` + +Further reading: +https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode. + +## Table Class + +DynamoDB supports two table classes: + +* STANDARD - the default mode, and is recommended for the vast majority of workloads. +* STANDARD_INFREQUENT_ACCESS - optimized for tables where storage is the dominant cost. + +```ts +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + tableClass: dynamodb.TableClass.STANDARD_INFREQUENT_ACCESS, +}); +``` + +Further reading: +https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.TableClasses.html + +## Configure AutoScaling for your table + +You can have DynamoDB automatically raise and lower the read and write capacities +of your table by setting up autoscaling. You can use this to either keep your +tables at a desired utilization level, or by scaling up and down at pre-configured +times of the day: + +Auto-scaling is only relevant for tables with the billing mode, PROVISIONED. + +[Example of configuring autoscaling](test/integ.autoscaling.lit.ts) + +Further reading: +https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.html +https://aws.amazon.com/blogs/database/how-to-use-aws-cloudformation-to-configure-auto-scaling-for-amazon-dynamodb-tables-and-indexes/ + +## Amazon DynamoDB Global Tables + +You can create DynamoDB Global Tables by setting the `replicationRegions` property on a `Table`: + +```ts +const globalTable = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'], +}); +``` + +When doing so, a CloudFormation Custom Resource will be added to the stack in order to create the replica tables in the +selected regions. + +The default billing mode for Global Tables is `PAY_PER_REQUEST`. +If you want to use `PROVISIONED`, +you have to make sure write auto-scaling is enabled for that Table: + +```ts +const globalTable = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'], + billingMode: dynamodb.BillingMode.PROVISIONED, +}); + +globalTable.autoScaleWriteCapacity({ + minCapacity: 1, + maxCapacity: 10, +}).scaleOnUtilization({ targetUtilizationPercent: 75 }); +``` + +When adding a replica region for a large table, you might want to increase the +timeout for the replication operation: + +```ts +const globalTable = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'], + replicationTimeout: Duration.hours(2), // defaults to Duration.minutes(30) +}); +``` + +A maximum of 10 tables with replication can be added to a stack without a limit increase for +[managed policies attached to an IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entities). +This is because more than 10 managed policies will be attached to the DynamoDB service replication role - one policy per replication table. +Consider splitting your tables across multiple stacks if your reach this limit. + +## Encryption + +All user data stored in Amazon DynamoDB is fully encrypted at rest. When creating a new table, you can choose to encrypt using the following customer master keys (CMK) to encrypt your table: + +* AWS owned CMK - By default, all tables are encrypted under an AWS owned customer master key (CMK) in the DynamoDB service account (no additional charges apply). +* AWS managed CMK - AWS KMS keys (one per region) are created in your account, managed, and used on your behalf by AWS DynamoDB (AWS KMS charges apply). +* Customer managed CMK - You have full control over the KMS key used to encrypt the DynamoDB Table (AWS KMS charges apply). + +Creating a Table encrypted with a customer managed CMK: + +```ts +const table = new dynamodb.Table(this, 'MyTable', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + encryption: dynamodb.TableEncryption.CUSTOMER_MANAGED, +}); + +// You can access the CMK that was added to the stack on your behalf by the Table construct via: +const tableEncryptionKey = table.encryptionKey; +``` + +You can also supply your own key: + +```ts +import * as kms from 'aws-cdk-lib/aws-kms'; + +const encryptionKey = new kms.Key(this, 'Key', { + enableKeyRotation: true, +}); +const table = new dynamodb.Table(this, 'MyTable', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + encryption: dynamodb.TableEncryption.CUSTOMER_MANAGED, + encryptionKey, // This will be exposed as table.encryptionKey +}); +``` + +In order to use the AWS managed CMK instead, change the code to: + +```ts +const table = new dynamodb.Table(this, 'MyTable', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + encryption: dynamodb.TableEncryption.AWS_MANAGED, +}); + +// In this case, the CMK _cannot_ be accessed through table.encryptionKey. +``` + +## Get schema of table or secondary indexes + +To get the partition key and sort key of the table or indexes you have configured: + +```ts +declare const table: dynamodb.Table; +const schema = table.schema(); +const partitionKey = schema.partitionKey; +const sortKey = schema.sortKey; + +// In case you want to get schema details for any secondary index +// const { partitionKey, sortKey } = table.schema(INDEX_NAME); +``` + +## Kinesis Stream + +A Kinesis Data Stream can be configured on the DynamoDB table to capture item-level changes. + +```ts +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; + +const stream = new kinesis.Stream(this, 'Stream'); + +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + kinesisStream: stream, +}); +``` + +## Alarm metrics + +Alarms can be configured on the DynamoDB table to captured metric data + +```ts +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, +}); + +const metric = table.metricThrottledRequestsForOperations({ + operations: [dynamodb.Operation.PUT_ITEM], + period: Duration.minutes(1), +}); + +new cloudwatch.Alarm(stack, 'Alarm', { + metric: metric, + evaluationPeriods: 1, + threshold: 1, +}); +``` + +## Deletion Protection for Tables + +You can enable deletion protection for a table by setting the `deletionProtection` property to `true`. +When deletion protection is enabled for a table, it cannot be deleted by anyone. By default, deletion protection is disabled. + +```ts +const table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING }, + deletionProtection: true, +}); +``` diff --git a/packages/aws-cdk-lib/aws-dynamodb/index.ts b/packages/aws-cdk-lib/aws-dynamodb/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-dynamodb/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-dynamodb/lib/index.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/lib/index.ts rename to packages/aws-cdk-lib/aws-dynamodb/lib/index.ts diff --git a/packages/@aws-cdk/aws-dynamodb/lib/perms.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/perms.ts similarity index 100% rename from packages/@aws-cdk/aws-dynamodb/lib/perms.ts rename to packages/aws-cdk-lib/aws-dynamodb/lib/perms.ts diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/replica-handler/index.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/replica-handler/index.ts new file mode 100644 index 0000000000000..610f4ff48ca86 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/replica-handler/index.ts @@ -0,0 +1,77 @@ +/* eslint-disable no-console */ +import type { IsCompleteRequest, IsCompleteResponse, OnEventRequest, OnEventResponse } from '../../../custom-resources/lib/provider-framework/types'; +import { DynamoDB } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +export async function onEventHandler(event: OnEventRequest): Promise { + console.log('Event: %j', { ...event, ResponseURL: '...' }); + + const dynamodb = new DynamoDB(); + + const tableName = event.ResourceProperties.TableName; + const region = event.ResourceProperties.Region; + + let updateTableAction: 'Create' | 'Update' | 'Delete' | undefined; + if (event.RequestType === 'Create' || event.RequestType === 'Delete') { + updateTableAction = event.RequestType; + } else { // Update + // There are two cases where an Update can happen: + // 1. A table replacement. In that case, we need to create the replica in the new Table + // (the replica for the "old" Table will be deleted when CFN issues a Delete event on the old physical resource id). + // 2. A customer has changed one of the properties of the Custom Resource, + // like 'waitForReplicationToFinish'. In that case, we don't have to do anything. + // To differentiate the two cases, we make an API call to DynamoDB to check whether a replica already exists. + const describeTableResult = await dynamodb.describeTable({ + TableName: tableName, + }).promise(); + console.log('Describe table: %j', describeTableResult); + const replicaExists = describeTableResult.Table?.Replicas?.some(replica => replica.RegionName === region); + updateTableAction = replicaExists ? undefined : 'Create'; + } + + if (updateTableAction) { + const data = await dynamodb.updateTable({ + TableName: tableName, + ReplicaUpdates: [ + { + [updateTableAction]: { + RegionName: region, + }, + }, + ], + }).promise(); + console.log('Update table: %j', data); + } else { + console.log("Skipping updating Table, as a replica in '%s' already exists", region); + } + + return event.RequestType === 'Create' || event.RequestType === 'Update' + ? { PhysicalResourceId: `${tableName}-${region}` } + : {}; +} + +export async function isCompleteHandler(event: IsCompleteRequest): Promise { + console.log('Event: %j', { ...event, ResponseURL: '...' }); + + const dynamodb = new DynamoDB(); + + const data = await dynamodb.describeTable({ + TableName: event.ResourceProperties.TableName, + }).promise(); + console.log('Describe table: %j', data); + + const tableActive = data.Table?.TableStatus === 'ACTIVE'; + const replicas = data.Table?.Replicas ?? []; + const regionReplica = replicas.find(r => r.RegionName === event.ResourceProperties.Region); + const replicaActive = regionReplica?.ReplicaStatus === 'ACTIVE'; + const skipReplicationCompletedWait = event.ResourceProperties.SkipReplicationCompletedWait === 'true'; + + switch (event.RequestType) { + case 'Create': + case 'Update': + // Complete when replica is reported as ACTIVE + return { IsComplete: tableActive && (replicaActive || skipReplicationCompletedWait) }; + case 'Delete': + // Complete when replica is gone + return { IsComplete: tableActive && regionReplica === undefined }; + } +} diff --git a/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/replica-provider.ts similarity index 94% rename from packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts rename to packages/aws-cdk-lib/aws-dynamodb/lib/replica-provider.ts index 9186de8d7347d..941cfdfa42b82 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/replica-provider.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/replica-provider.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, NestedStack, Stack } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import { Duration, NestedStack, Stack } from '../../core'; +import * as cr from '../../custom-resources'; import { Construct } from 'constructs'; /** diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/scalable-attribute-api.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/scalable-attribute-api.ts new file mode 100644 index 0000000000000..7fce9a6385bbf --- /dev/null +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/scalable-attribute-api.ts @@ -0,0 +1,41 @@ +import * as appscaling from '../../aws-applicationautoscaling'; + +/** + * Interface for scalable attributes + */ +export interface IScalableTableAttribute { + /** + * Add scheduled scaling for this scaling attribute + */ + scaleOnSchedule(id: string, actions: appscaling.ScalingSchedule): void; + + /** + * Scale out or in to keep utilization at a given level + */ + scaleOnUtilization(props: UtilizationScalingProps): void; +} + +/** + * Properties for enabling DynamoDB capacity scaling + */ +export interface EnableScalingProps { + /** + * Minimum capacity to scale to + */ + readonly minCapacity: number; + + /** + * Maximum capacity to scale to + */ + readonly maxCapacity: number; +} + +/** + * Properties for enabling DynamoDB utilization tracking + */ +export interface UtilizationScalingProps extends appscaling.BaseTargetTrackingProps { + /** + * Target utilization percentage for the attribute + */ + readonly targetUtilizationPercent: number; +} diff --git a/packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/scalable-table-attribute.ts similarity index 96% rename from packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts rename to packages/aws-cdk-lib/aws-dynamodb/lib/scalable-table-attribute.ts index 8c5f6467f4715..bf7ae536c5ff9 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/scalable-table-attribute.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/scalable-table-attribute.ts @@ -1,4 +1,4 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; +import * as appscaling from '../../aws-applicationautoscaling'; import { UtilizationScalingProps } from './scalable-attribute-api'; /** diff --git a/packages/@aws-cdk/aws-dynamodb/lib/table.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts similarity index 99% rename from packages/@aws-cdk/aws-dynamodb/lib/table.ts rename to packages/aws-cdk-lib/aws-dynamodb/lib/table.ts index f14808a4acefc..07879f882441c 100644 --- a/packages/@aws-cdk/aws-dynamodb/lib/table.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts @@ -1,13 +1,13 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as kms from '@aws-cdk/aws-kms'; +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import * as kinesis from '../../aws-kinesis'; +import * as kms from '../../aws-kms'; import { ArnFormat, Aws, CfnCondition, CfnCustomResource, CfnResource, CustomResource, Duration, Fn, IResource, Lazy, Names, RemovalPolicy, Resource, Stack, Token, -} from '@aws-cdk/core'; +} from '../../core'; import { Construct } from 'constructs'; import { DynamoDBMetrics } from './dynamodb-canned-metrics.generated'; import { CfnTable, CfnTableProps } from './dynamodb.generated'; diff --git a/packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts similarity index 99% rename from packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts rename to packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts index 404ea6392e77a..e63f812c9eedf 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts @@ -1,12 +1,12 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kinesis from '@aws-cdk/aws-kinesis'; -import * as kms from '@aws-cdk/aws-kms'; +import { Annotations, Match, Template } from '../../assertions'; +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import * as kinesis from '../../aws-kinesis'; +import * as kms from '../../aws-kms'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Aws, CfnDeletionPolicy, Duration, PhysicalName, RemovalPolicy, Resource, Stack, Tags } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; +import { App, Aws, CfnDeletionPolicy, Duration, PhysicalName, RemovalPolicy, Resource, Stack, Tags } from '../../core'; +import * as cr from '../../custom-resources'; import { Construct } from 'constructs'; import { Attribute, @@ -24,7 +24,7 @@ import { } from '../lib'; import { ReplicaProvider } from '../lib/replica-provider'; -jest.mock('@aws-cdk/custom-resources'); +jest.mock('../../custom-resources'); /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/integ.autoscaling.lit.ts b/packages/aws-cdk-lib/aws-dynamodb/test/integ.autoscaling.lit.ts new file mode 100644 index 0000000000000..e57e96b6136c4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-dynamodb/test/integ.autoscaling.lit.ts @@ -0,0 +1,31 @@ +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cdk from '../../core'; +import * as dynamodb from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-dynamodb'); + +const table = new dynamodb.Table(stack, 'Table', { + partitionKey: { name: 'hashKey', type: dynamodb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +/// !show +const readScaling = table.autoScaleReadCapacity({ minCapacity: 1, maxCapacity: 50 }); + +readScaling.scaleOnUtilization({ + targetUtilizationPercent: 50, +}); + +readScaling.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, +}); + +readScaling.scaleOnSchedule('ScaleDownAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 20, +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk/aws-dynamodb/test/replica-provider.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/replica-provider.test.ts similarity index 98% rename from packages/@aws-cdk/aws-dynamodb/test/replica-provider.test.ts rename to packages/aws-cdk-lib/aws-dynamodb/test/replica-provider.test.ts index b0a522f7353c0..b841ded5824a0 100644 --- a/packages/@aws-cdk/aws-dynamodb/test/replica-provider.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/replica-provider.test.ts @@ -1,4 +1,4 @@ -import { OnEventRequest } from '@aws-cdk/custom-resources/lib/provider-framework/types'; +import { OnEventRequest } from '../../custom-resources/lib/provider-framework/types'; import * as AWS from 'aws-sdk-mock'; import * as sinon from 'sinon'; import { isCompleteHandler, onEventHandler } from '../lib/replica-handler'; diff --git a/packages/aws-cdk-lib/aws-ec2/.jsiirc.json b/packages/aws-cdk-lib/aws-ec2/.jsiirc.json new file mode 100644 index 0000000000000..c1a15c6c9d9da --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ec2" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.EC2" + }, + "python": { + "module": "aws_cdk.aws_ec2" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ec2/README.md b/packages/aws-cdk-lib/aws-ec2/README.md new file mode 100644 index 0000000000000..42e22db39107a --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/README.md @@ -0,0 +1,1774 @@ +# Amazon EC2 Construct Library + + + +The `@aws-cdk/aws-ec2` package contains primitives for setting up networking and +instances. + +```ts nofixture +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +``` + +## VPC + +Most projects need a Virtual Private Cloud to provide security by means of +network partitioning. This is achieved by creating an instance of +`Vpc`: + +```ts +const vpc = new ec2.Vpc(this, 'VPC'); +``` + +All default constructs require EC2 instances to be launched inside a VPC, so +you should generally start by defining a VPC whenever you need to launch +instances for your project. + +### Subnet Types + +A VPC consists of one or more subnets that instances can be placed into. CDK +distinguishes three different subnet types: + +* **Public (`SubnetType.PUBLIC`)** - public subnets connect directly to the Internet using an + Internet Gateway. If you want your instances to have a public IP address + and be directly reachable from the Internet, you must place them in a + public subnet. +* **Private with Internet Access (`SubnetType.PRIVATE_WITH_EGRESS`)** - instances in private subnets are not directly routable from the + Internet, and you must provide a way to connect out to the Internet. + By default, a NAT gateway is created in every public subnet for maximum availability. Be + aware that you will be charged for NAT gateways. + Alternatively you can set `natGateways:0` and provide your own egress configuration (i.e through Transit Gateway) +* **Isolated (`SubnetType.PRIVATE_ISOLATED`)** - isolated subnets do not route from or to the Internet, and + as such do not require NAT gateways. They can only connect to or be + connected to from other instances in the same VPC. A default VPC configuration + will not include isolated subnets, + +A default VPC configuration will create public and **private** subnets. However, if +`natGateways:0` **and** `subnetConfiguration` is undefined, default VPC configuration +will create public and **isolated** subnets. See [*Advanced Subnet Configuration*](#advanced-subnet-configuration) +below for information on how to change the default subnet configuration. + +Constructs using the VPC will "launch instances" (or more accurately, create +Elastic Network Interfaces) into one or more of the subnets. They all accept +a property called `subnetSelection` (sometimes called `vpcSubnets`) to allow +you to select in what subnet to place the ENIs, usually defaulting to +*private* subnets if the property is omitted. + +If you would like to save on the cost of NAT gateways, you can use +*isolated* subnets instead of *private* subnets (as described in Advanced +*Subnet Configuration*). If you need private instances to have +internet connectivity, another option is to reduce the number of NAT gateways +created by setting the `natGateways` property to a lower value (the default +is one NAT gateway per availability zone). Be aware that this may have +availability implications for your application. + +[Read more about +subnets](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html). + +### Control over availability zones + +By default, a VPC will spread over at most 3 Availability Zones available to +it. To change the number of Availability Zones that the VPC will spread over, +specify the `maxAzs` property when defining it. + +The number of Availability Zones that are available depends on the *region* +and *account* of the Stack containing the VPC. If the [region and account are +specified](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) on +the Stack, the CLI will [look up the existing Availability +Zones](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#using-regions-availability-zones-describe) +and get an accurate count. If region and account are not specified, the stack +could be deployed anywhere and it will have to make a safe choice, limiting +itself to 2 Availability Zones. + +Therefore, to get the VPC to spread over 3 or more availability zones, you +must specify the environment where the stack will be deployed. + +You can gain full control over the availability zones selection strategy by overriding the Stack's [`get availabilityZones()`](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/core/lib/stack.ts) method: + +```text +// This example is only available in TypeScript + +class MyStack extends Stack { + + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + // ... + } + + get availabilityZones(): string[] { + return ['us-west-2a', 'us-west-2b']; + } + +} +``` + +Note that overriding the `get availabilityZones()` method will override the default behavior for all constructs defined within the Stack. + +### Choosing subnets for resources + +When creating resources that create Elastic Network Interfaces (such as +databases or instances), there is an option to choose which subnets to place +them in. For example, a VPC endpoint by default is placed into a subnet in +every availability zone, but you can override which subnets to use. The property +is typically called one of `subnets`, `vpcSubnets` or `subnetSelection`. + +The example below will place the endpoint into two AZs (`us-east-1a` and `us-east-1c`), +in Isolated subnets: + +```ts +declare const vpc: ec2.Vpc; + +new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { + vpc, + service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), + subnets: { + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + availabilityZones: ['us-east-1a', 'us-east-1c'] + } +}); +``` + +You can also specify specific subnet objects for granular control: + +```ts +declare const vpc: ec2.Vpc; +declare const subnet1: ec2.Subnet; +declare const subnet2: ec2.Subnet; + +new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { + vpc, + service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), + subnets: { + subnets: [subnet1, subnet2] + } +}); +``` + +Which subnets are selected is evaluated as follows: + +* `subnets`: if specific subnet objects are supplied, these are selected, and no other + logic is used. +* `subnetType`/`subnetGroupName`: otherwise, a set of subnets is selected by + supplying either type or name: + * `subnetType` will select all subnets of the given type. + * `subnetGroupName` should be used to distinguish between multiple groups of subnets of + the same type (for example, you may want to separate your application instances and your + RDS instances into two distinct groups of Isolated subnets). + * If neither are given, the first available subnet group of a given type that + exists in the VPC will be used, in this order: Private, then Isolated, then Public. + In short: by default ENIs will preferentially be placed in subnets not connected to + the Internet. +* `availabilityZones`/`onePerAz`: finally, some availability-zone based filtering may be done. + This filtering by availability zones will only be possible if the VPC has been created or + looked up in a non-environment agnostic stack (so account and region have been set and + availability zones have been looked up). + * `availabilityZones`: only the specific subnets from the selected subnet groups that are + in the given availability zones will be returned. + * `onePerAz`: per availability zone, a maximum of one subnet will be returned (Useful for resource + types that do not allow creating two ENIs in the same availability zone). +* `subnetFilters`: additional filtering on subnets using any number of user-provided filters which + extend `SubnetFilter`. The following methods on the `SubnetFilter` class can be used to create + a filter: + * `byIds`: chooses subnets from a list of ids + * `availabilityZones`: chooses subnets in the provided list of availability zones + * `onePerAz`: chooses at most one subnet per availability zone + * `containsIpAddresses`: chooses a subnet which contains *any* of the listed ip addresses + * `byCidrMask`: chooses subnets that have the provided CIDR netmask + +### Using NAT instances + +By default, the `Vpc` construct will create NAT *gateways* for you, which +are managed by AWS. If you would prefer to use your own managed NAT +*instances* instead, specify a different value for the `natGatewayProvider` +property, as follows: + +[using NAT instances](test/integ.nat-instances.lit.ts) + +The construct will automatically search for the most recent NAT gateway AMI. +If you prefer to use a custom AMI, use `machineImage: +MachineImage.genericLinux({ ... })` and configure the right AMI ID for the +regions you want to deploy to. + +By default, the NAT instances will route all traffic. To control what traffic +gets routed, pass a custom value for `defaultAllowedTraffic` and access the +`NatInstanceProvider.connections` member after having passed the NAT provider to +the VPC: + +```ts +declare const instanceType: ec2.InstanceType; + +const provider = ec2.NatProvider.instance({ + instanceType, + defaultAllowedTraffic: ec2.NatTrafficDirection.OUTBOUND_ONLY, +}); +new ec2.Vpc(this, 'TheVPC', { + natGatewayProvider: provider, +}); +provider.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/8'), ec2.Port.tcp(80)); +``` + +### Ip Address Management + +The VPC spans a supernet IP range, which contains the non-overlapping IPs of its contained subnets. Possible sources for this IP range are: + +* You specify an IP range directly by specifying a CIDR +* You allocate an IP range of a given size automatically from AWS IPAM + +By default the Vpc will allocate the `10.0.0.0/16` address range which will be exhaustively spread across all subnets in the subnet configuration. This behavior can be changed by passing an object that implements `IIpAddresses` to the `ipAddress` property of a Vpc. See the subsequent sections for the options. + +Be aware that if you don't explicitly reserve subnet groups in `subnetConfiguration`, the address space will be fully allocated! If you predict you may need to add more subnet groups later, add them early on and set `reserved: true` (see the "Advanced Subnet Configuration" section for more information). + +#### Specifying a CIDR directly + +Use `IpAddresses.cidr` to define a Cidr range for your Vpc directly in code: + +```ts +import { IpAddresses } from 'aws-cdk-lib/aws-ec2'; + +new ec2.Vpc(stack, 'TheVPC', { + ipAddresses: ec2.IpAddresses.cidr('10.0.1.0/20') +}); +``` + +Space will be allocated to subnets in the following order: + +* First, spaces is allocated for all subnets groups that explicitly have a `cidrMask` set as part of their configuration (including reserved subnets). +* Afterwards, any remaining space is divided evenly between the rest of the subnets (if any). + +The argument to `IpAddresses.cidr` may not be a token, and concrete Cidr values are generated in the synthesized CloudFormation template. + +#### Allocating an IP range from AWS IPAM + +Amazon VPC IP Address Manager (IPAM) manages a large IP space, from which chunks can be allocated for use in the Vpc. For information on Amazon VPC IP Address Manager please see the [official documentation](https://docs.aws.amazon.com/vpc/latest/ipam/what-it-is-ipam.html). An example of allocating from AWS IPAM looks like this: + +```ts +import { IpAddresses } from 'aws-cdk-lib/aws-ec2'; + +declare const pool: ec2.CfnIPAMPool; + +new ec2.Vpc(stack, 'TheVPC', { + ipAddresses: ec2.IpAddresses.awsIpamAllocation({ + ipv4IpamPoolId: pool.ref, + ipv4NetmaskLength: 18, + defaultSubnetIpv4NetmaskLength: 24 + }) +}); +``` + +`IpAddresses.awsIpamAllocation` requires the following: + +* `ipv4IpamPoolId`, the id of an IPAM Pool from which the VPC range should be allocated. +* `ipv4NetmaskLength`, the size of the IP range that will be requested from the Pool at deploy time. +* `defaultSubnetIpv4NetmaskLength`, the size of subnets in groups that don't have `cidrMask` set. + +With this method of IP address management, no attempt is made to guess at subnet group sizes or to exhaustively allocate the IP range. All subnet groups must have an explicit `cidrMask` set as part of their subnet configuration, or `defaultSubnetIpv4NetmaskLength` must be set for a default size. If not, synthesis will fail and you must provide one or the other. + +### Reserving availability zones + +There are situations where the IP space for availability zones will +need to be reserved. This is useful in situations where availability +zones would need to be added after the vpc is originally deployed, +without causing IP renumbering for availability zones subnets. The IP +space for reserving `n` availability zones can be done by setting the +`reservedAzs` to `n` in vpc props, as shown below: + +```ts +const vpc = new ec2.Vpc(this, 'TheVPC', { + cidr: '10.0.0.0/21', + maxAzs: 3, + reservedAzs: 1, +}); +``` + +In the example above, the subnets for reserved availability zones is not +actually provisioned but its IP space is still reserved. If, in the future, +new availability zones needs to be provisioned, then we would decrement +the value of `reservedAzs` and increment the `maxAzs` or `availabilityZones` +accordingly. This action would not cause the IP address of subnets to get +renumbered, but rather the IP space that was previously reserved will be +used for the new availability zones subnets. + +### Advanced Subnet Configuration + +If the default VPC configuration (public and private subnets spanning the +size of the VPC) don't suffice for you, you can configure what subnets to +create by specifying the `subnetConfiguration` property. It allows you +to configure the number and size of all subnets. Specifying an advanced +subnet configuration could look like this: + +```ts +const vpc = new ec2.Vpc(this, 'TheVPC', { + // 'IpAddresses' configures the IP range and size of the entire VPC. + // The IP space will be divided based on configuration for the subnets. + ipAddresses: IpAddresses.cidr('10.0.0.0/21'), + + // 'maxAzs' configures the maximum number of availability zones to use. + // If you want to specify the exact availability zones you want the VPC + // to use, use `availabilityZones` instead. + maxAzs: 3, + + // 'subnetConfiguration' specifies the "subnet groups" to create. + // Every subnet group will have a subnet for each AZ, so this + // configuration will create `3 groups × 3 AZs = 9` subnets. + subnetConfiguration: [ + { + // 'subnetType' controls Internet access, as described above. + subnetType: ec2.SubnetType.PUBLIC, + + // 'name' is used to name this particular subnet group. You will have to + // use the name for subnet selection if you have more than one subnet + // group of the same type. + name: 'Ingress', + + // 'cidrMask' specifies the IP addresses in the range of of individual + // subnets in the group. Each of the subnets in this group will contain + // `2^(32 address bits - 24 subnet bits) - 2 reserved addresses = 254` + // usable IP addresses. + // + // If 'cidrMask' is left out the available address space is evenly + // divided across the remaining subnet groups. + cidrMask: 24, + }, + { + cidrMask: 24, + name: 'Application', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + { + cidrMask: 28, + name: 'Database', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + + // 'reserved' can be used to reserve IP address space. No resources will + // be created for this subnet, but the IP range will be kept available for + // future creation of this subnet, or even for future subdivision. + reserved: true + } + ], +}); +``` + +The example above is one possible configuration, but the user can use the +constructs above to implement many other network configurations. + +The `Vpc` from the above configuration in a Region with three +availability zones will be the following: + +Subnet Name |Type |IP Block |AZ|Features +------------------|----------|--------------|--|-------- +IngressSubnet1 |`PUBLIC` |`10.0.0.0/24` |#1|NAT Gateway +IngressSubnet2 |`PUBLIC` |`10.0.1.0/24` |#2|NAT Gateway +IngressSubnet3 |`PUBLIC` |`10.0.2.0/24` |#3|NAT Gateway +ApplicationSubnet1|`PRIVATE` |`10.0.3.0/24` |#1|Route to NAT in IngressSubnet1 +ApplicationSubnet2|`PRIVATE` |`10.0.4.0/24` |#2|Route to NAT in IngressSubnet2 +ApplicationSubnet3|`PRIVATE` |`10.0.5.0/24` |#3|Route to NAT in IngressSubnet3 +DatabaseSubnet1 |`ISOLATED`|`10.0.6.0/28` |#1|Only routes within the VPC +DatabaseSubnet2 |`ISOLATED`|`10.0.6.16/28`|#2|Only routes within the VPC +DatabaseSubnet3 |`ISOLATED`|`10.0.6.32/28`|#3|Only routes within the VPC + +### Accessing the Internet Gateway + +If you need access to the internet gateway, you can get its ID like so: + +```ts +declare const vpc: ec2.Vpc; + +const igwId = vpc.internetGatewayId; +``` + +For a VPC with only `ISOLATED` subnets, this value will be undefined. + +This is only supported for VPCs created in the stack - currently you're +unable to get the ID for imported VPCs. To do that you'd have to specifically +look up the Internet Gateway by name, which would require knowing the name +beforehand. + +This can be useful for configuring routing using a combination of gateways: +for more information see [Routing](#routing) below. + +#### Routing + +It's possible to add routes to any subnets using the `addRoute()` method. If for +example you want an isolated subnet to have a static route via the default +Internet Gateway created for the public subnet - perhaps for routing a VPN +connection - you can do so like this: + +```ts +const vpc = new ec2.Vpc(this, "VPC", { + subnetConfiguration: [{ + subnetType: ec2.SubnetType.PUBLIC, + name: 'Public', + },{ + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + name: 'Isolated', + }] +}); + +(vpc.isolatedSubnets[0] as ec2.Subnet).addRoute("StaticRoute", { + routerId: vpc.internetGatewayId!, + routerType: ec2.RouterType.GATEWAY, + destinationCidrBlock: "8.8.8.8/32", +}) +``` + +*Note that we cast to `Subnet` here because the list of subnets only returns an +`ISubnet`.* + +### Reserving subnet IP space + +There are situations where the IP space for a subnet or number of subnets +will need to be reserved. This is useful in situations where subnets would +need to be added after the vpc is originally deployed, without causing IP +renumbering for existing subnets. The IP space for a subnet may be reserved +by setting the `reserved` subnetConfiguration property to true, as shown +below: + +```ts +const vpc = new ec2.Vpc(this, 'TheVPC', { + natGateways: 1, + subnetConfiguration: [ + { + cidrMask: 26, + name: 'Public', + subnetType: ec2.SubnetType.PUBLIC, + }, + { + cidrMask: 26, + name: 'Application1', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + { + cidrMask: 26, + name: 'Application2', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + reserved: true, // <---- This subnet group is reserved + }, + { + cidrMask: 27, + name: 'Database', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + } + ], +}); +``` + +In the example above, the subnet for Application2 is not actually provisioned +but its IP space is still reserved. If in the future this subnet needs to be +provisioned, then the `reserved: true` property should be removed. Reserving +parts of the IP space prevents the other subnets from getting renumbered. + +### Sharing VPCs between stacks + +If you are creating multiple `Stack`s inside the same CDK application, you +can reuse a VPC defined in one Stack in another by simply passing the VPC +instance around: + +[sharing VPCs between stacks](test/integ.share-vpcs.lit.ts) + +### Importing an existing VPC + +If your VPC is created outside your CDK app, you can use `Vpc.fromLookup()`. +The CDK CLI will search for the specified VPC in the the stack's region and +account, and import the subnet configuration. Looking up can be done by VPC +ID, but more flexibly by searching for a specific tag on the VPC. + +Subnet types will be determined from the `aws-cdk:subnet-type` tag on the +subnet if it exists, or the presence of a route to an Internet Gateway +otherwise. Subnet names will be determined from the `aws-cdk:subnet-name` tag +on the subnet if it exists, or will mirror the subnet type otherwise (i.e. +a public subnet will have the name `"Public"`). + +The result of the `Vpc.fromLookup()` operation will be written to a file +called `cdk.context.json`. You must commit this file to source control so +that the lookup values are available in non-privileged environments such +as CI build steps, and to ensure your template builds are repeatable. + +Here's how `Vpc.fromLookup()` can be used: + +[importing existing VPCs](test/integ.import-default-vpc.lit.ts) + +`Vpc.fromLookup` is the recommended way to import VPCs. If for whatever +reason you do not want to use the context mechanism to look up a VPC at +synthesis time, you can also use `Vpc.fromVpcAttributes`. This has the +following limitations: + +* Every subnet group in the VPC must have a subnet in each availability zone + (for example, each AZ must have both a public and private subnet). Asymmetric + VPCs are not supported. +* All VpcId, SubnetId, RouteTableId, ... parameters must either be known at + synthesis time, or they must come from deploy-time list parameters whose + deploy-time lengths are known at synthesis time. + +Using `Vpc.fromVpcAttributes()` looks like this: + +```ts +const vpc = ec2.Vpc.fromVpcAttributes(this, 'VPC', { + vpcId: 'vpc-1234', + availabilityZones: ['us-east-1a', 'us-east-1b'], + + // Either pass literals for all IDs + publicSubnetIds: ['s-12345', 's-67890'], + + // OR: import a list of known length + privateSubnetIds: Fn.importListValue('PrivateSubnetIds', 2), + + // OR: split an imported string to a list of known length + isolatedSubnetIds: Fn.split(',', ssm.StringParameter.valueForStringParameter(this, `MyParameter`), 2), +}); +``` + +For each subnet group the import function accepts optional parameters for subnet +names, route table ids and IPv4 CIDR blocks. When supplied, the length of these +lists are required to match the length of the list of subnet ids, allowing the +lists to be zipped together to form `ISubnet` instances. + +Public subnet group example (for private or isolated subnet groups, use the properties with the respective prefix): + +```ts +const vpc = ec2.Vpc.fromVpcAttributes(this, 'VPC', { + vpcId: 'vpc-1234', + availabilityZones: ['us-east-1a', 'us-east-1b', 'us-east-1c'], + publicSubnetIds: ['s-12345', 's-34567', 's-56789'], + publicSubnetNames: ['Subnet A', 'Subnet B', 'Subnet C'], + publicSubnetRouteTableIds: ['rt-12345', 'rt-34567', 'rt-56789'], + publicSubnetIpv4CidrBlocks: ['10.0.0.0/24', '10.0.1.0/24', '10.0.2.0/24'], +}); +``` + +The above example will create an `IVpc` instance with three public subnets: + +| Subnet id | Availability zone | Subnet name | Route table id | IPv4 CIDR | +| --------- | ----------------- | ----------- | -------------- | ----------- | +| s-12345 | us-east-1a | Subnet A | rt-12345 | 10.0.0.0/24 | +| s-34567 | us-east-1b | Subnet B | rt-34567 | 10.0.1.0/24 | +| s-56789 | us-east-1c | Subnet B | rt-56789 | 10.0.2.0/24 | + +## Allowing Connections + +In AWS, all network traffic in and out of **Elastic Network Interfaces** (ENIs) +is controlled by **Security Groups**. You can think of Security Groups as a +firewall with a set of rules. By default, Security Groups allow no incoming +(ingress) traffic and all outgoing (egress) traffic. You can add ingress rules +to them to allow incoming traffic streams. To exert fine-grained control over +egress traffic, set `allowAllOutbound: false` on the `SecurityGroup`, after +which you can add egress traffic rules. + +You can manipulate Security Groups directly: + +```ts fixture=with-vpc +const mySecurityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { + vpc, + description: 'Allow ssh access to ec2 instances', + allowAllOutbound: true // Can be set to false +}); +mySecurityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(22), 'allow ssh access from the world'); +``` + +All constructs that create ENIs on your behalf (typically constructs that create +EC2 instances or other VPC-connected resources) will all have security groups +automatically assigned. Those constructs have an attribute called +**connections**, which is an object that makes it convenient to update the +security groups. If you want to allow connections between two constructs that +have security groups, you have to add an **Egress** rule to one Security Group, +and an **Ingress** rule to the other. The connections object will automatically +take care of this for you: + +```ts +declare const loadBalancer: elbv2.ApplicationLoadBalancer; +declare const appFleet: autoscaling.AutoScalingGroup; +declare const dbFleet: autoscaling.AutoScalingGroup; + +// Allow connections from anywhere +loadBalancer.connections.allowFromAnyIpv4(ec2.Port.tcp(443), 'Allow inbound HTTPS'); + +// The same, but an explicit IP address +loadBalancer.connections.allowFrom(ec2.Peer.ipv4('1.2.3.4/32'), ec2.Port.tcp(443), 'Allow inbound HTTPS'); + +// Allow connection between AutoScalingGroups +appFleet.connections.allowTo(dbFleet, ec2.Port.tcp(443), 'App can call database'); +``` + +### Connection Peers + +There are various classes that implement the connection peer part: + +```ts +declare const appFleet: autoscaling.AutoScalingGroup; +declare const dbFleet: autoscaling.AutoScalingGroup; + +// Simple connection peers +let peer = ec2.Peer.ipv4('10.0.0.0/16'); +peer = ec2.Peer.anyIpv4(); +peer = ec2.Peer.ipv6('::0/0'); +peer = ec2.Peer.anyIpv6(); +peer = ec2.Peer.prefixList('pl-12345'); +appFleet.connections.allowTo(peer, ec2.Port.tcp(443), 'Allow outbound HTTPS'); +``` + +Any object that has a security group can itself be used as a connection peer: + +```ts +declare const fleet1: autoscaling.AutoScalingGroup; +declare const fleet2: autoscaling.AutoScalingGroup; +declare const appFleet: autoscaling.AutoScalingGroup; + +// These automatically create appropriate ingress and egress rules in both security groups +fleet1.connections.allowTo(fleet2, ec2.Port.tcp(80), 'Allow between fleets'); + +appFleet.connections.allowFromAnyIpv4(ec2.Port.tcp(80), 'Allow from load balancer'); +``` + +### Port Ranges + +The connections that are allowed are specified by port ranges. A number of classes provide +the connection specifier: + +```ts +ec2.Port.tcp(80) +ec2.Port.tcpRange(60000, 65535) +ec2.Port.allTcp() +ec2.Port.allIcmp() +ec2.Port.allIcmpV6() +ec2.Port.allTraffic() +``` + +> NOTE: Not all protocols have corresponding helper methods. In the absence of a helper method, +> you can instantiate `Port` yourself with your own settings. You are also welcome to contribute +> new helper methods. + +### Default Ports + +Some Constructs have default ports associated with them. For example, the +listener of a load balancer does (it's the public port), or instances of an +RDS database (it's the port the database is accepting connections on). + +If the object you're calling the peering method on has a default port associated with it, you can call +`allowDefaultPortFrom()` and omit the port specifier. If the argument has an associated default port, call +`allowDefaultPortTo()`. + +For example: + +```ts +declare const listener: elbv2.ApplicationListener; +declare const appFleet: autoscaling.AutoScalingGroup; +declare const rdsDatabase: rds.DatabaseCluster; + +// Port implicit in listener +listener.connections.allowDefaultPortFromAnyIpv4('Allow public'); + +// Port implicit in peer +appFleet.connections.allowDefaultPortTo(rdsDatabase, 'Fleet can access database'); +``` + +### Security group rules + +By default, security group wills be added inline to the security group in the output cloud formation +template, if applicable. This includes any static rules by ip address and port range. This +optimization helps to minimize the size of the template. + +In some environments this is not desirable, for example if your security group access is controlled +via tags. You can disable inline rules per security group or globally via the context key +`@aws-cdk/aws-ec2.securityGroupDisableInlineRules`. + +```ts fixture=with-vpc +const mySecurityGroupWithoutInlineRules = new ec2.SecurityGroup(this, 'SecurityGroup', { + vpc, + description: 'Allow ssh access to ec2 instances', + allowAllOutbound: true, + disableInlineRules: true +}); +//This will add the rule as an external cloud formation construct +mySecurityGroupWithoutInlineRules.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(22), 'allow ssh access from the world'); +``` + +### Importing an existing security group + +If you know the ID and the configuration of the security group to import, you can use `SecurityGroup.fromSecurityGroupId`: + +```ts +const sg = ec2.SecurityGroup.fromSecurityGroupId(this, 'SecurityGroupImport', 'sg-1234', { + allowAllOutbound: true, +}); +``` + +Alternatively, use lookup methods to import security groups if you do not know the ID or the configuration details. Method `SecurityGroup.fromLookupByName` looks up a security group if the security group ID is unknown. + +```ts fixture=with-vpc +const sg = ec2.SecurityGroup.fromLookupByName(this, 'SecurityGroupLookup', 'security-group-name', vpc); +``` + +If the security group ID is known and configuration details are unknown, use method `SecurityGroup.fromLookupById` instead. This method will lookup property `allowAllOutbound` from the current configuration of the security group. + +```ts +const sg = ec2.SecurityGroup.fromLookupById(this, 'SecurityGroupLookup', 'sg-1234'); +``` + +The result of `SecurityGroup.fromLookupByName` and `SecurityGroup.fromLookupById` operations will be written to a file called `cdk.context.json`. You must commit this file to source control so that the lookup values are available in non-privileged environments such as CI build steps, and to ensure your template builds are repeatable. + +### Cross Stack Connections + +If you are attempting to add a connection from a peer in one stack to a peer in a different stack, sometimes it is necessary to ensure that you are making the connection in +a specific stack in order to avoid a cyclic reference. If there are no other dependencies between stacks then it will not matter in which stack you make +the connection, but if there are existing dependencies (i.e. stack1 already depends on stack2), then it is important to make the connection in the dependent stack (i.e. stack1). + +Whenever you make a `connections` function call, the ingress and egress security group rules will be added to the stack that the calling object exists in. +So if you are doing something like `peer1.connections.allowFrom(peer2)`, then the security group rules (both ingress and egress) will be created in `peer1`'s Stack. + +As an example, if we wanted to allow a connection from a security group in one stack (egress) to a security group in a different stack (ingress), +we would make the connection like: + +**If Stack1 depends on Stack2** + +```ts fixture=with-vpc +// Stack 1 +declare const stack1: Stack; +declare const stack2: Stack; + +const sg1 = new ec2.SecurityGroup(stack1, 'SG1', { + allowAllOutbound: false, // if this is `true` then no egress rule will be created + vpc, +}); + +// Stack 2 +const sg2 = new ec2.SecurityGroup(stack2, 'SG2', { + allowAllOutbound: false, // if this is `true` then no egress rule will be created + vpc, +}); + + +// `connections.allowTo` on `sg1` since we want the +// rules to be created in Stack1 +sg1.connections.allowTo(sg2, ec2.Port.tcp(3333)); +``` + +In this case both the Ingress Rule for `sg2` and the Egress Rule for `sg1` will both be created +in `Stack 1` which avoids the cyclic reference. + + +**If Stack2 depends on Stack1** + +```ts fixture=with-vpc +// Stack 1 +declare const stack1: Stack; +declare const stack2: Stack; + +const sg1 = new ec2.SecurityGroup(stack1, 'SG1', { + allowAllOutbound: false, // if this is `true` then no egress rule will be created + vpc, +}); + +// Stack 2 +const sg2 = new ec2.SecurityGroup(stack2, 'SG2', { + allowAllOutbound: false, // if this is `true` then no egress rule will be created + vpc, +}); + + +// `connections.allowFrom` on `sg2` since we want the +// rules to be created in Stack2 +sg2.connections.allowFrom(sg1, ec2.Port.tcp(3333)); +``` + +In this case both the Ingress Rule for `sg2` and the Egress Rule for `sg1` will both be created +in `Stack 2` which avoids the cyclic reference. + +## Machine Images (AMIs) + +AMIs control the OS that gets launched when you start your EC2 instance. The EC2 +library contains constructs to select the AMI you want to use. + +Depending on the type of AMI, you select it a different way. Here are some +examples of images you might want to use: + +[example of creating images](test/example.images.lit.ts) + +> NOTE: The AMIs selected by `MachineImage.lookup()` will be cached in +> `cdk.context.json`, so that your AutoScalingGroup instances aren't replaced while +> you are making unrelated changes to your CDK app. +> +> To query for the latest AMI again, remove the relevant cache entry from +> `cdk.context.json`, or use the `cdk context` command. For more information, see +> [Runtime Context](https://docs.aws.amazon.com/cdk/latest/guide/context.html) in the CDK +> developer guide. +> +> `MachineImage.genericLinux()`, `MachineImage.genericWindows()` will use `CfnMapping` in +> an agnostic stack. + +## Special VPC configurations + +### VPN connections to a VPC + +Create your VPC with VPN connections by specifying the `vpnConnections` props (keys are construct `id`s): + +```ts +const vpc = new ec2.Vpc(this, 'MyVpc', { + vpnConnections: { + dynamic: { // Dynamic routing (BGP) + ip: '1.2.3.4' + }, + static: { // Static routing + ip: '4.5.6.7', + staticRoutes: [ + '192.168.10.0/24', + '192.168.20.0/24' + ] + } + } +}); +``` + +To create a VPC that can accept VPN connections, set `vpnGateway` to `true`: + +```ts +const vpc = new ec2.Vpc(this, 'MyVpc', { + vpnGateway: true +}); +``` + +VPN connections can then be added: + +```ts fixture=with-vpc +vpc.addVpnConnection('Dynamic', { + ip: '1.2.3.4' +}); +``` + +By default, routes will be propagated on the route tables associated with the private subnets. If no +private subnets exist, isolated subnets are used. If no isolated subnets exist, public subnets are +used. Use the `Vpc` property `vpnRoutePropagation` to customize this behavior. + +VPN connections expose [metrics (cloudwatch.Metric)](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-cloudwatch/README.md) across all tunnels in the account/region and per connection: + +```ts fixture=with-vpc +// Across all tunnels in the account/region +const allDataOut = ec2.VpnConnection.metricAllTunnelDataOut(); + +// For a specific vpn connection +const vpnConnection = vpc.addVpnConnection('Dynamic', { + ip: '1.2.3.4' +}); +const state = vpnConnection.metricTunnelState(); +``` + +### VPC endpoints + +A VPC endpoint enables you to privately connect your VPC to supported AWS services and VPC endpoint services powered by PrivateLink without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Instances in your VPC do not require public IP addresses to communicate with resources in the service. Traffic between your VPC and the other service does not leave the Amazon network. + +Endpoints are virtual devices. They are horizontally scaled, redundant, and highly available VPC components that allow communication between instances in your VPC and services without imposing availability risks or bandwidth constraints on your network traffic. + +[example of setting up VPC endpoints](test/integ.vpc-endpoint.lit.ts) + +By default, CDK will place a VPC endpoint in one subnet per AZ. If you wish to override the AZs CDK places the VPC endpoint in, +use the `subnets` parameter as follows: + +```ts +declare const vpc: ec2.Vpc; + +new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { + vpc, + service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), + // Choose which availability zones to place the VPC endpoint in, based on + // available AZs + subnets: { + availabilityZones: ['us-east-1a', 'us-east-1c'] + } +}); +``` + +Per the [AWS documentation](https://aws.amazon.com/premiumsupport/knowledge-center/interface-endpoint-availability-zone/), not all +VPC endpoint services are available in all AZs. If you specify the parameter `lookupSupportedAzs`, CDK attempts to discover which +AZs an endpoint service is available in, and will ensure the VPC endpoint is not placed in a subnet that doesn't match those AZs. +These AZs will be stored in cdk.context.json. + +```ts +declare const vpc: ec2.Vpc; + +new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { + vpc, + service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443), + // Choose which availability zones to place the VPC endpoint in, based on + // available AZs + lookupSupportedAzs: true +}); +``` + +Pre-defined AWS services are defined in the [InterfaceVpcEndpointAwsService](lib/vpc-endpoint.ts) class, and can be used to +create VPC endpoints without having to configure name, ports, etc. For example, a Keyspaces endpoint can be created for +use in your VPC: + +``` ts +declare const vpc: ec2.Vpc; + +new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', { + vpc, + service: ec2.InterfaceVpcEndpointAwsService.KEYSPACES, +}); +``` + +#### Security groups for interface VPC endpoints + +By default, interface VPC endpoints create a new security group and traffic is **not** +automatically allowed from the VPC CIDR. + +Use the `connections` object to allow traffic to flow to the endpoint: + +```ts +declare const myEndpoint: ec2.InterfaceVpcEndpoint; + +myEndpoint.connections.allowDefaultPortFromAnyIpv4(); +``` + +Alternatively, existing security groups can be used by specifying the `securityGroups` prop. + +### VPC endpoint services + +A VPC endpoint service enables you to expose a Network Load Balancer(s) as a provider service to consumers, who connect to your service over a VPC endpoint. You can restrict access to your service via allowed principals (anything that extends ArnPrincipal), and require that new connections be manually accepted. + +```ts +declare const networkLoadBalancer1: elbv2.NetworkLoadBalancer; +declare const networkLoadBalancer2: elbv2.NetworkLoadBalancer; + +new ec2.VpcEndpointService(this, 'EndpointService', { + vpcEndpointServiceLoadBalancers: [networkLoadBalancer1, networkLoadBalancer2], + acceptanceRequired: true, + allowedPrincipals: [new iam.ArnPrincipal('arn:aws:iam::123456789012:root')] +}); +``` + +Endpoint services support private DNS, which makes it easier for clients to connect to your service by automatically setting up DNS in their VPC. +You can enable private DNS on an endpoint service like so: + +```ts +import { HostedZone, VpcEndpointServiceDomainName } from 'aws-cdk-lib/aws-route53'; +declare const zone: HostedZone; +declare const vpces: ec2.VpcEndpointService; + +new VpcEndpointServiceDomainName(this, 'EndpointDomain', { + endpointService: vpces, + domainName: 'my-stuff.aws-cdk.dev', + publicHostedZone: zone, +}); +``` + +Note: The domain name must be owned (registered through Route53) by the account the endpoint service is in, or delegated to the account. +The VpcEndpointServiceDomainName will handle the AWS side of domain verification, the process for which can be found +[here](https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-services-dns-validation.html) + +### Client VPN endpoint + +AWS Client VPN is a managed client-based VPN service that enables you to securely access your AWS +resources and resources in your on-premises network. With Client VPN, you can access your resources +from any location using an OpenVPN-based VPN client. + +Use the `addClientVpnEndpoint()` method to add a client VPN endpoint to a VPC: + +```ts fixture=client-vpn +vpc.addClientVpnEndpoint('Endpoint', { + cidr: '10.100.0.0/16', + serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id', + // Mutual authentication + clientCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/client-certificate-id', + // User-based authentication + userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider), +}); +``` + +The endpoint must use at least one [authentication method](https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/client-authentication.html): + +* Mutual authentication with a client certificate +* User-based authentication (directory or federated) + +If user-based authentication is used, the [self-service portal URL](https://docs.aws.amazon.com/vpn/latest/clientvpn-user/self-service-portal.html) +is made available via a CloudFormation output. + +By default, a new security group is created, and logging is enabled. Moreover, a rule to +authorize all users to the VPC CIDR is created. + +To customize authorization rules, set the `authorizeAllUsersToVpcCidr` prop to `false` +and use `addAuthorizationRule()`: + +```ts fixture=client-vpn +const endpoint = vpc.addClientVpnEndpoint('Endpoint', { + cidr: '10.100.0.0/16', + serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id', + userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider), + authorizeAllUsersToVpcCidr: false, +}); + +endpoint.addAuthorizationRule('Rule', { + cidr: '10.0.10.0/32', + groupId: 'group-id', +}); +``` + +Use `addRoute()` to configure network routes: + +```ts fixture=client-vpn +const endpoint = vpc.addClientVpnEndpoint('Endpoint', { + cidr: '10.100.0.0/16', + serverCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/server-certificate-id', + userBasedAuthentication: ec2.ClientVpnUserBasedAuthentication.federated(samlProvider), +}); + +// Client-to-client access +endpoint.addRoute('Route', { + cidr: '10.100.0.0/16', + target: ec2.ClientVpnRouteTarget.local(), +}); +``` + +Use the `connections` object of the endpoint to allow traffic to other security groups. + +## Instances + +You can use the `Instance` class to start up a single EC2 instance. For production setups, we recommend +you use an `AutoScalingGroup` from the `aws-autoscaling` module instead, as AutoScalingGroups will take +care of restarting your instance if it ever fails. + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; + +// Amazon Linux 1 +new ec2.Instance(this, 'Instance1', { + vpc, + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux(), +}); + +// Amazon Linux 2 +new ec2.Instance(this, 'Instance2', { + vpc, + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), +}); + +// Amazon Linux 2 with kernel 5.x +new ec2.Instance(this, 'Instance3', { + vpc, + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + kernel: ec2.AmazonLinuxKernel.KERNEL5_X, + }), +}); + +// AWS Linux 2022 +new ec2.Instance(this, 'Instance4', { + vpc, + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022, + }), +}); + +// Graviton 3 Processor +new ec2.Instance(this, 'Instance5', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.C7G, ec2.InstanceSize.LARGE), + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + cpuType: ec2.AmazonLinuxCpuType.ARM_64, + }), +}); +``` + +### Configuring Instances using CloudFormation Init (cfn-init) + +CloudFormation Init allows you to configure your instances by writing files to them, installing software +packages, starting services and running arbitrary commands. By default, if any of the instance setup +commands throw an error; the deployment will fail and roll back to the previously known good state. +The following documentation also applies to `AutoScalingGroup`s. + +For the full set of capabilities of this system, see the documentation for +[`AWS::CloudFormation::Init`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html). +Here is an example of applying some configuration to an instance: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new ec2.Instance(this, 'Instance', { + vpc, + instanceType, + machineImage, + + // Showing the most complex setup, if you have simpler requirements + // you can use `CloudFormationInit.fromElements()`. + init: ec2.CloudFormationInit.fromConfigSets({ + configSets: { + // Applies the configs below in this order + default: ['yumPreinstall', 'config'], + }, + configs: { + yumPreinstall: new ec2.InitConfig([ + // Install an Amazon Linux package using yum + ec2.InitPackage.yum('git'), + ]), + config: new ec2.InitConfig([ + // Create a JSON file from tokens (can also create other files) + ec2.InitFile.fromObject('/etc/stack.json', { + stackId: Stack.of(this).stackId, + stackName: Stack.of(this).stackName, + region: Stack.of(this).region, + }), + + // Create a group and user + ec2.InitGroup.fromName('my-group'), + ec2.InitUser.fromName('my-user'), + + // Install an RPM from the internet + ec2.InitPackage.rpm('http://mirrors.ukfast.co.uk/sites/dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/r/rubygem-git-1.5.0-2.el8.noarch.rpm'), + ]), + }, + }), + initOptions: { + // Optional, which configsets to activate (['default'] by default) + configSets: ['default'], + + // Optional, how long the installation is expected to take (5 minutes by default) + timeout: Duration.minutes(30), + + // Optional, whether to include the --url argument when running cfn-init and cfn-signal commands (false by default) + includeUrl: true, + + // Optional, whether to include the --role argument when running cfn-init and cfn-signal commands (false by default) + includeRole: true, + }, +}); +``` + +`InitCommand` can not be used to start long-running processes. At deploy time, +`cfn-init` will always wait for the process to exit before continuing, causing +the CloudFormation deployment to fail because the signal hasn't been received +within the expected timeout. + +Instead, you should install a service configuration file onto your machine `InitFile`, +and then use `InitService` to start it. + +If your Linux OS is using SystemD (like Amazon Linux 2 or higher), the CDK has +helpers to create a long-running service using CFN Init. You can create a +SystemD-compatible config file using `InitService.systemdConfigFile()`, and +start it immediately. The following examples shows how to start a trivial Python +3 web server: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; + +new ec2.Instance(this, 'Instance', { + vpc, + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux({ + // Amazon Linux 2 uses SystemD + generation: ec2.AmazonLinuxGeneration: AMAZON_LINUX_2, + }), + + init: ec2.CloudFormationInit.fromElements([ + // Create a simple config file that runs a Python web server + ec2.InitService.systemdConfigFile('simpleserver', { + command: '/usr/bin/python3 -m http.server 8080', + cwd: '/var/www/html', + }), + // Start the server using SystemD + ec2.InitService.enable('simpleserver', { + serviceManager: ec2.ServiceManager.SYSTEMD, + }), + // Drop an example file to show the web server working + ec2.InitFile.fromString('/var/www/html/index.html', 'Hello! It\'s working!'), + ]), +}); +``` + +You can have services restarted after the init process has made changes to the system. +To do that, instantiate an `InitServiceRestartHandle` and pass it to the config elements +that need to trigger the restart and the service itself. For example, the following +config writes a config file for nginx, extracts an archive to the root directory, and then +restarts nginx so that it picks up the new config and files: + +```ts +declare const myBucket: s3.Bucket; + +const handle = new ec2.InitServiceRestartHandle(); + +ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromString('/etc/nginx/nginx.conf', '...', { serviceRestartHandles: [handle] }), + ec2.InitSource.fromS3Object('/var/www/html', myBucket, 'html.zip', { serviceRestartHandles: [handle] }), + ec2.InitService.enable('nginx', { + serviceRestartHandle: handle, + }) +); +``` + +### Bastion Hosts + +A bastion host functions as an instance used to access servers and resources in a VPC without open up the complete VPC on a network level. +You can use bastion hosts using a standard SSH connection targeting port 22 on the host. As an alternative, you can connect the SSH connection +feature of AWS Systems Manager Session Manager, which does not need an opened security group. (https://aws.amazon.com/about-aws/whats-new/2019/07/session-manager-launches-tunneling-support-for-ssh-and-scp/) + +A default bastion host for use via SSM can be configured like: + +```ts fixture=with-vpc +const host = new ec2.BastionHostLinux(this, 'BastionHost', { vpc }); +``` + +If you want to connect from the internet using SSH, you need to place the host into a public subnet. You can then configure allowed source hosts. + +```ts fixture=with-vpc +const host = new ec2.BastionHostLinux(this, 'BastionHost', { + vpc, + subnetSelection: { subnetType: ec2.SubnetType.PUBLIC }, +}); +host.allowSshAccessFrom(ec2.Peer.ipv4('1.2.3.4/32')); +``` + +As there are no SSH public keys deployed on this machine, you need to use [EC2 Instance Connect](https://aws.amazon.com/de/blogs/compute/new-using-amazon-ec2-instance-connect-for-ssh-access-to-your-ec2-instances/) +with the command `aws ec2-instance-connect send-ssh-public-key` to provide your SSH public key. + +EBS volume for the bastion host can be encrypted like: + +```ts fixture=with-vpc +const host = new ec2.BastionHostLinux(this, 'BastionHost', { + vpc, + blockDevices: [{ + deviceName: 'EBSBastionHost', + volume: ec2.BlockDeviceVolume.ebs(10, { + encrypted: true, + }), + }], +}); +``` + +### Block Devices + +To add EBS block device mappings, specify the `blockDevices` property. The following example sets the EBS-backed +root device (`/dev/sda1`) size to 50 GiB, and adds another EBS-backed device mapped to `/dev/sdm` that is 100 GiB in +size: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new ec2.Instance(this, 'Instance', { + vpc, + instanceType, + machineImage, + + // ... + + blockDevices: [ + { + deviceName: '/dev/sda1', + volume: ec2.BlockDeviceVolume.ebs(50), + }, + { + deviceName: '/dev/sdm', + volume: ec2.BlockDeviceVolume.ebs(100), + }, + ], +}); + +``` + +It is also possible to encrypt the block devices. In this example we will create an customer managed key encrypted EBS-backed root device: + +```ts +import { Key } from 'aws-cdk-lib/aws-kms'; + +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +const kmsKey = new Key(this, 'KmsKey') + +new ec2.Instance(this, 'Instance', { + vpc, + instanceType, + machineImage, + + // ... + + blockDevices: [ + { + deviceName: '/dev/sda1', + volume: ec2.BlockDeviceVolume.ebs(50, { + encrypted: true, + kmsKey: kmsKey, + }), + }, + ], +}); + +``` + +### Volumes + +Whereas a `BlockDeviceVolume` is an EBS volume that is created and destroyed as part of the creation and destruction of a specific instance. A `Volume` is for when you want an EBS volume separate from any particular instance. A `Volume` is an EBS block device that can be attached to, or detached from, any instance at any time. Some types of `Volume`s can also be attached to multiple instances at the same time to allow you to have shared storage between those instances. + +A notable restriction is that a Volume can only be attached to instances in the same availability zone as the Volume itself. + +The following demonstrates how to create a 500 GiB encrypted Volume in the `us-west-2a` availability zone, and give a role the ability to attach that Volume to a specific instance: + +```ts +declare const instance: ec2.Instance; +declare const role: iam.Role; + +const volume = new ec2.Volume(this, 'Volume', { + availabilityZone: 'us-west-2a', + size: Size.gibibytes(500), + encrypted: true, +}); + +volume.grantAttachVolume(role, [instance]); +``` + +#### Instances Attaching Volumes to Themselves + +If you need to grant an instance the ability to attach/detach an EBS volume to/from itself, then using `grantAttachVolume` and `grantDetachVolume` as outlined above +will lead to an unresolvable circular reference between the instance role and the instance. In this case, use `grantAttachVolumeByResourceTag` and `grantDetachVolumeByResourceTag` as follows: + +```ts +declare const instance: ec2.Instance; +declare const volume: ec2.Volume; + +const attachGrant = volume.grantAttachVolumeByResourceTag(instance.grantPrincipal, [instance]); +const detachGrant = volume.grantDetachVolumeByResourceTag(instance.grantPrincipal, [instance]); +``` + +#### Attaching Volumes + +The Amazon EC2 documentation for +[Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) and +[Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-volumes.html) contains information on how +to attach and detach your Volumes to/from instances, and how to format them for use. + +The following is a sample skeleton of EC2 UserData that can be used to attach a Volume to the Linux instance that it is running on: + +```ts +declare const instance: ec2.Instance; +declare const volume: ec2.Volume; + +volume.grantAttachVolumeByResourceTag(instance.grantPrincipal, [instance]); +const targetDevice = '/dev/xvdz'; +instance.userData.addCommands( + // Retrieve token for accessing EC2 instance metadata (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html) + `TOKEN=$(curl -SsfX PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")`, + // Retrieve the instance Id of the current EC2 instance + `INSTANCE_ID=$(curl -SsfH "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id)`, + // Attach the volume to /dev/xvdz + `aws --region ${Stack.of(this).region} ec2 attach-volume --volume-id ${volume.volumeId} --instance-id $INSTANCE_ID --device ${targetDevice}`, + // Wait until the volume has attached + `while ! test -e ${targetDevice}; do sleep 1; done` + // The volume will now be mounted. You may have to add additional code to format the volume if it has not been prepared. +); +``` + +#### Tagging Volumes + +You can configure [tag propagation on volume creation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-propagatetagstovolumeoncreation). + +```ts + declare const vpc: ec2.Vpc; + declare const instanceType: ec2.InstanceType; + declare const machineImage: ec2.IMachineImage; + + new ec2.Instance(this, 'Instance', { + vpc, + machineImage, + instanceType, + propagateTagsToVolumeOnCreation: true, + }); +``` + +#### Throughput on GP3 Volumes + +You can specify the `throughput` of a GP3 volume from 125 (default) to 1000. + +```ts +new ec2.Volume(this, 'Volume', { + availabilityZone: 'us-east-1a', + size: cdk.Size.gibibytes(125), + volumeType: EbsDeviceVolumeType.GP3, + throughput: 125, +}); +``` + +### Configuring Instance Metadata Service (IMDS) + +#### Toggling IMDSv1 + +You can configure [EC2 Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) options to either +allow both IMDSv1 and IMDSv2 or enforce IMDSv2 when interacting with the IMDS. + +To do this for a single `Instance`, you can use the `requireImdsv2` property. +The example below demonstrates IMDSv2 being required on a single `Instance`: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; +declare const machineImage: ec2.IMachineImage; + +new ec2.Instance(this, 'Instance', { + vpc, + instanceType, + machineImage, + + // ... + + requireImdsv2: true, +}); +``` + +You can also use the either the `InstanceRequireImdsv2Aspect` for EC2 instances or the `LaunchTemplateRequireImdsv2Aspect` for EC2 launch templates +to apply the operation to multiple instances or launch templates, respectively. + +The following example demonstrates how to use the `InstanceRequireImdsv2Aspect` to require IMDSv2 for all EC2 instances in a stack: + +```ts +const aspect = new ec2.InstanceRequireImdsv2Aspect(); +Aspects.of(this).add(aspect); +``` + +## VPC Flow Logs + +VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Flow log data can be published to Amazon CloudWatch Logs and Amazon S3. After you've created a flow log, you can retrieve and view its data in the chosen destination. (). + +By default, a flow log will be created with CloudWatch Logs as the destination. + +You can create a flow log like this: + +```ts +declare const vpc: ec2.Vpc; + +new ec2.FlowLog(this, 'FlowLog', { + resourceType: ec2.FlowLogResourceType.fromVpc(vpc) +}) +``` + +Or you can add a Flow Log to a VPC by using the addFlowLog method like this: + +```ts +const vpc = new ec2.Vpc(this, 'Vpc'); + +vpc.addFlowLog('FlowLog'); +``` + +You can also add multiple flow logs with different destinations. + +```ts +const vpc = new ec2.Vpc(this, 'Vpc'); + +vpc.addFlowLog('FlowLogS3', { + destination: ec2.FlowLogDestination.toS3() +}); + +// Only reject traffic and interval every minute. +vpc.addFlowLog('FlowLogCloudWatch', { + trafficType: ec2.FlowLogTrafficType.REJECT, + maxAggregationInterval: FlowLogMaxAggregationInterval.ONE_MINUTE, +}); +``` + +### Custom Formatting + +You can also custom format flow logs. + +```ts +const vpc = new ec2.Vpc(this, 'Vpc'); + +vpc.addFlowLog('FlowLog', { + logFormat: [ + ec2.LogFormat.DST_PORT, + ec2.LogFormat.SRC_PORT, + ], +}); + +// If you just want to add a field to the default field +vpc.addFlowLog('FlowLog', { + logFormat: [ + ec2.LogFormat.VERSION, + ec2.LogFormat.ALL_DEFAULT_FIELDS, + ], +}); + +// If AWS CDK does not support the new fields +vpc.addFlowLog('FlowLog', { + logFormat: [ + ec2.LogFormat.SRC_PORT, + ec2.LogFormat.custom('${new-field}'), + ], +}); +``` + + +By default, the CDK will create the necessary resources for the destination. For the CloudWatch Logs destination +it will create a CloudWatch Logs Log Group as well as the IAM role with the necessary permissions to publish to +the log group. In the case of an S3 destination, it will create the S3 bucket. + +If you want to customize any of the destination resources you can provide your own as part of the `destination`. + +*CloudWatch Logs* + +```ts +declare const vpc: ec2.Vpc; + +const logGroup = new logs.LogGroup(this, 'MyCustomLogGroup'); + +const role = new iam.Role(this, 'MyCustomRole', { + assumedBy: new iam.ServicePrincipal('vpc-flow-logs.amazonaws.com') +}); + +new ec2.FlowLog(this, 'FlowLog', { + resourceType: ec2.FlowLogResourceType.fromVpc(vpc), + destination: ec2.FlowLogDestination.toCloudWatchLogs(logGroup, role) +}); +``` + +*S3* + +```ts +declare const vpc: ec2.Vpc; + +const bucket = new s3.Bucket(this, 'MyCustomBucket'); + +new ec2.FlowLog(this, 'FlowLog', { + resourceType: ec2.FlowLogResourceType.fromVpc(vpc), + destination: ec2.FlowLogDestination.toS3(bucket) +}); + +new ec2.FlowLog(this, 'FlowLogWithKeyPrefix', { + resourceType: ec2.FlowLogResourceType.fromVpc(vpc), + destination: ec2.FlowLogDestination.toS3(bucket, 'prefix/') +}); +``` + +When the S3 destination is configured, AWS will automatically create an S3 bucket policy +that allows the service to write logs to the bucket. This makes it impossible to later update +that bucket policy. To have CDK create the bucket policy so that future updates can be made, +the `@aws-cdk/aws-s3:createDefaultLoggingPolicy` [feature flag](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html) can be used. This can be set +in the `cdk.json` file. + +```json +{ + "context": { + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true + } +} +``` + +## User Data + +User data enables you to run a script when your instances start up. In order to configure these scripts you can add commands directly to the script + or you can use the UserData's convenience functions to aid in the creation of your script. + +A user data could be configured to run a script found in an asset through the following: + +```ts +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; + +declare const instance: ec2.Instance; + +const asset = new Asset(this, 'Asset', { + path: './configure.sh' +}); + +const localPath = instance.userData.addS3DownloadCommand({ + bucket:asset.bucket, + bucketKey:asset.s3ObjectKey, + region: 'us-east-1', // Optional +}); +instance.userData.addExecuteFileCommand({ + filePath:localPath, + arguments: '--verbose -y' +}); +asset.grantRead(instance.role); +``` + +### Persisting user data + +By default, EC2 UserData is run once on only the first time that an instance is started. It is possible to make the +user data script run on every start of the instance. + +When creating a Windows UserData you can use the `persist` option to set whether or not to add +`true` [to the user data script](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts). it can be used as follows: + +```ts +const windowsUserData = UserData.forWindows({ persist: true }); +``` + +For a Linux instance, this can be accomplished by using a Multipart user data to configure cloud-config as detailed +in: https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/ + +### Multipart user data + +In addition, to above the `MultipartUserData` can be used to change instance startup behavior. Multipart user data are composed +from separate parts forming archive. The most common parts are scripts executed during instance set-up. However, there are other +kinds, too. + +The advantage of multipart archive is in flexibility when it's needed to add additional parts or to use specialized parts to +fine tune instance startup. Some services (like AWS Batch) support only `MultipartUserData`. + +The parts can be executed at different moment of instance start-up and can serve a different purpose. This is controlled by `contentType` property. +For common scripts, `text/x-shellscript; charset="utf-8"` can be used as content type. + +In order to create archive the `MultipartUserData` has to be instantiated. Than, user can add parts to multipart archive using `addPart`. The `MultipartBody` contains methods supporting creation of body parts. + +If the very custom part is required, it can be created using `MultipartUserData.fromRawBody`, in this case full control over content type, +transfer encoding, and body properties is given to the user. + +Below is an example for creating multipart user data with single body part responsible for installing `awscli` and configuring maximum size +of storage used by Docker containers: + +```ts +const bootHookConf = ec2.UserData.forLinux(); +bootHookConf.addCommands('cloud-init-per once docker_options echo \'OPTIONS="${OPTIONS} --storage-opt dm.basesize=40G"\' >> /etc/sysconfig/docker'); + +const setupCommands = ec2.UserData.forLinux(); +setupCommands.addCommands('sudo yum install awscli && echo Packages installed らと > /var/tmp/setup'); + +const multipartUserData = new ec2.MultipartUserData(); +// The docker has to be configured at early stage, so content type is overridden to boothook +multipartUserData.addPart(ec2.MultipartBody.fromUserData(bootHookConf, 'text/cloud-boothook; charset="us-ascii"')); +// Execute the rest of setup +multipartUserData.addPart(ec2.MultipartBody.fromUserData(setupCommands)); + +new ec2.LaunchTemplate(this, '', { + userData: multipartUserData, + blockDevices: [ + // Block device configuration rest + ] +}); +``` + +For more information see +[Specifying Multiple User Data Blocks Using a MIME Multi Part Archive](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bootstrap_container_instance.html#multi-part_user_data) + +#### Using add*Command on MultipartUserData + +To use the `add*Command` methods, that are inherited from the `UserData` interface, on `MultipartUserData` you must add a part +to the `MultipartUserData` and designate it as the receiver for these methods. This is accomplished by using the `addUserDataPart()` +method on `MultipartUserData` with the `makeDefault` argument set to `true`: + +```ts +const multipartUserData = new ec2.MultipartUserData(); +const commandsUserData = ec2.UserData.forLinux(); +multipartUserData.addUserDataPart(commandsUserData, ec2.MultipartBody.SHELL_SCRIPT, true); + +// Adding commands to the multipartUserData adds them to commandsUserData, and vice-versa. +multipartUserData.addCommands('touch /root/multi.txt'); +commandsUserData.addCommands('touch /root/userdata.txt'); +``` + +When used on an EC2 instance, the above `multipartUserData` will create both `multi.txt` and `userdata.txt` in `/root`. + +## Importing existing subnet + +To import an existing Subnet, call `Subnet.fromSubnetAttributes()` or +`Subnet.fromSubnetId()`. Only if you supply the subnet's Availability Zone +and Route Table Ids when calling `Subnet.fromSubnetAttributes()` will you be +able to use the CDK features that use these values (such as selecting one +subnet per AZ). + +Importing an existing subnet looks like this: + +```ts +// Supply all properties +const subnet1 = ec2.Subnet.fromSubnetAttributes(this, 'SubnetFromAttributes', { + subnetId: 's-1234', + availabilityZone: 'pub-az-4465', + routeTableId: 'rt-145' +}); + +// Supply only subnet id +const subnet2 = ec2.Subnet.fromSubnetId(this, 'SubnetFromId', 's-1234'); +``` + +## Launch Templates + +A Launch Template is a standardized template that contains the configuration information to launch an instance. +They can be used when launching instances on their own, through Amazon EC2 Auto Scaling, EC2 Fleet, and Spot Fleet. +Launch templates enable you to store launch parameters so that you do not have to specify them every time you launch +an instance. For information on Launch Templates please see the +[official documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html). + +The following demonstrates how to create a launch template with an Amazon Machine Image, and security group. + +```ts +declare const vpc: ec2.Vpc; + +const template = new ec2.LaunchTemplate(this, 'LaunchTemplate', { + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + securityGroup: new ec2.SecurityGroup(this, 'LaunchTemplateSG', { + vpc: vpc, + }), +}); +``` + +And the following demonstrates how to enable metadata options support. + +```ts +new ec2.LaunchTemplate(this, 'LaunchTemplate', { + httpEndpoint: true, + httpProtocolIpv6: true, + httpPutResponseHopLimit: 1, + httpTokens: ec2.LaunchTemplateHttpTokens.REQUIRED, + instanceMetadataTags: true, +}); +``` + +## Detailed Monitoring + +The following demonstrates how to enable [Detailed Monitoring](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html) for an EC2 instance. Keep in mind that Detailed Monitoring results in [additional charges](http://aws.amazon.com/cloudwatch/pricing/). + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; + +new ec2.Instance(this, 'Instance1', { + vpc, + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux(), + detailedMonitoring: true, +}); +``` + +## Connecting to your instances using SSM Session Manager + +SSM Session Manager makes it possible to connect to your instances from the +AWS Console, without preparing SSH keys. + +To do so, you need to: + +* Use an image with [SSM agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) installed + and configured. [Many images come with SSM Agent + preinstalled](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html), otherwise you + may need to manually put instructions to [install SSM + Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) into your + instance's UserData or use EC2 Init). +* Create the instance with `ssmSessionPermissions: true`. + +If these conditions are met, you can connect to the instance from the EC2 Console. Example: + +```ts +declare const vpc: ec2.Vpc; +declare const instanceType: ec2.InstanceType; + +new ec2.Instance(this, 'Instance1', { + vpc, + instanceType, + + // Amazon Linux 2 comes with SSM Agent by default + machineImage: ec2.MachineImage.latestAmazonLinux({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }), + + // Turn on SSM + ssmSessionPermissions: true, +}); +``` diff --git a/packages/aws-cdk-lib/aws-ec2/index.ts b/packages/aws-cdk-lib/aws-ec2/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ec2/lib/aspects/index.ts b/packages/aws-cdk-lib/aws-ec2/lib/aspects/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/aspects/index.ts rename to packages/aws-cdk-lib/aws-ec2/lib/aspects/index.ts diff --git a/packages/aws-cdk-lib/aws-ec2/lib/aspects/require-imdsv2-aspect.ts b/packages/aws-cdk-lib/aws-ec2/lib/aspects/require-imdsv2-aspect.ts new file mode 100644 index 0000000000000..a938c35e56379 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/lib/aspects/require-imdsv2-aspect.ts @@ -0,0 +1,155 @@ +import * as cdk from '../../../core'; +import * as cxapi from '../../../cx-api'; +import { IConstruct } from 'constructs'; +import { CfnLaunchTemplate } from '../ec2.generated'; +import { Instance } from '../instance'; +import { LaunchTemplate } from '../launch-template'; + +/** + * Properties for `RequireImdsv2Aspect`. + */ +interface RequireImdsv2AspectProps { + /** + * Whether warning annotations from this Aspect should be suppressed or not. + * + * @default - false + */ + readonly suppressWarnings?: boolean; +} + +/** + * Base class for Aspect that makes IMDSv2 required. + */ +abstract class RequireImdsv2Aspect implements cdk.IAspect { + protected readonly suppressWarnings: boolean; + + constructor(props?: RequireImdsv2AspectProps) { + this.suppressWarnings = props?.suppressWarnings ?? false; + } + + abstract visit(node: IConstruct): void; + + /** + * Adds a warning annotation to a node, unless `suppressWarnings` is true. + * + * @param node The scope to add the warning to. + * @param message The warning message. + */ + protected warn(node: IConstruct, message: string) { + if (this.suppressWarnings !== true) { + cdk.Annotations.of(node).addWarning(`${RequireImdsv2Aspect.name} failed on node ${node.node.id}: ${message}`); + } + } +} + +/** + * Properties for `InstanceRequireImdsv2Aspect`. + */ +export interface InstanceRequireImdsv2AspectProps extends RequireImdsv2AspectProps { + /** + * Whether warnings that would be raised when an Instance is associated with an existing Launch Template + * should be suppressed or not. + * + * You can set this to `true` if `LaunchTemplateImdsAspect` is being used alongside this Aspect to + * suppress false-positive warnings because any Launch Templates associated with Instances will still be covered. + * + * @default - false + */ + readonly suppressLaunchTemplateWarning?: boolean; +} + +/** + * Aspect that applies IMDS configuration on EC2 Instance constructs. + * + * This aspect configures IMDS on an EC2 instance by creating a Launch Template with the + * IMDS configuration and associating that Launch Template with the instance. If an Instance + * is already associated with a Launch Template, a warning will (optionally) be added to the + * construct node and it will be skipped. + * + * To cover Instances already associated with Launch Templates, use `LaunchTemplateImdsAspect`. + */ +export class InstanceRequireImdsv2Aspect extends RequireImdsv2Aspect { + private readonly suppressLaunchTemplateWarning: boolean; + + constructor(props?: InstanceRequireImdsv2AspectProps) { + super(props); + this.suppressLaunchTemplateWarning = props?.suppressLaunchTemplateWarning ?? false; + } + + visit(node: IConstruct): void { + if (!(node instanceof Instance)) { + return; + } + if (node.instance.launchTemplate !== undefined) { + this.warn(node, 'Cannot toggle IMDSv1 because this Instance is associated with an existing Launch Template.'); + return; + } + + const launchTemplate = new CfnLaunchTemplate(node, 'LaunchTemplate', { + launchTemplateData: { + metadataOptions: { + httpTokens: 'required', + }, + }, + }); + if (cdk.FeatureFlags.of(node).isEnabled(cxapi.EC2_UNIQUE_IMDSV2_LAUNCH_TEMPLATE_NAME)) { + launchTemplate.launchTemplateName = cdk.Names.uniqueId(launchTemplate); + } else { + launchTemplate.launchTemplateName = `${node.node.id}LaunchTemplate`; + } + node.instance.launchTemplate = { + launchTemplateName: launchTemplate.launchTemplateName, + version: launchTemplate.getAtt('LatestVersionNumber').toString(), + }; + } + + protected warn(node: IConstruct, message: string) { + if (this.suppressLaunchTemplateWarning !== true) { + super.warn(node, message); + } + } +} + +/** + * Properties for `LaunchTemplateRequireImdsv2Aspect`. + */ +export interface LaunchTemplateRequireImdsv2AspectProps extends RequireImdsv2AspectProps {} + +/** + * Aspect that applies IMDS configuration on EC2 Launch Template constructs. + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html + */ +export class LaunchTemplateRequireImdsv2Aspect extends RequireImdsv2Aspect { + constructor(props?: LaunchTemplateRequireImdsv2AspectProps) { + super(props); + } + + visit(node: IConstruct): void { + if (!(node instanceof LaunchTemplate)) { + return; + } + + const launchTemplate = node.node.tryFindChild('Resource') as CfnLaunchTemplate; + const data = launchTemplate.launchTemplateData; + if (cdk.isResolvableObject(data)) { + this.warn(node, 'LaunchTemplateData is a CDK token.'); + return; + } + + const metadataOptions = (data as CfnLaunchTemplate.LaunchTemplateDataProperty).metadataOptions; + if (cdk.isResolvableObject(metadataOptions)) { + this.warn(node, 'LaunchTemplateData.MetadataOptions is a CDK token.'); + return; + } + + const newData: CfnLaunchTemplate.LaunchTemplateDataProperty = { + ...data, + metadataOptions: { + ...metadataOptions, + httpTokens: 'required', + }, + }; + launchTemplate.launchTemplateData = newData; + } +} diff --git a/packages/@aws-cdk/aws-ec2/lib/bastion-host.ts b/packages/aws-cdk-lib/aws-ec2/lib/bastion-host.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/bastion-host.ts rename to packages/aws-cdk-lib/aws-ec2/lib/bastion-host.ts index c956b25bdd2a6..86d739b38ec94 100644 --- a/packages/@aws-cdk/aws-ec2/lib/bastion-host.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/bastion-host.ts @@ -1,5 +1,5 @@ -import { IPrincipal, IRole, PolicyStatement } from '@aws-cdk/aws-iam'; -import { CfnOutput, Resource, Stack } from '@aws-cdk/core'; +import { IPrincipal, IRole, PolicyStatement } from '../../aws-iam'; +import { CfnOutput, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { AmazonLinuxGeneration, InstanceArchitecture, InstanceClass, InstanceSize, InstanceType } from '.'; import { CloudFormationInit } from './cfn-init'; diff --git a/packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts b/packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts rename to packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts index fb347ac20f5df..ac3a015909666 100644 --- a/packages/@aws-cdk/aws-ec2/lib/cfn-init-elements.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import { Duration } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as s3_assets from '../../aws-s3-assets'; +import { Duration } from '../../core'; import { InitBindOptions, InitElementConfig, InitElementType, InitPlatform } from './private/cfn-init-internal'; /** diff --git a/packages/@aws-cdk/aws-ec2/lib/cfn-init.ts b/packages/aws-cdk-lib/aws-ec2/lib/cfn-init.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/cfn-init.ts rename to packages/aws-cdk-lib/aws-ec2/lib/cfn-init.ts index 2292468725021..6363269c8e9a1 100644 --- a/packages/@aws-cdk/aws-ec2/lib/cfn-init.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/cfn-init.ts @@ -1,6 +1,6 @@ import * as crypto from 'crypto'; -import * as iam from '@aws-cdk/aws-iam'; -import { Aws, CfnResource } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Aws, CfnResource } from '../../core'; import { Construct } from 'constructs'; import { InitElement } from './cfn-init-elements'; import { OperatingSystemType } from './machine-image'; diff --git a/packages/@aws-cdk/aws-ec2/lib/cidr-splits.ts b/packages/aws-cdk-lib/aws-ec2/lib/cidr-splits.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/cidr-splits.ts rename to packages/aws-cdk-lib/aws-ec2/lib/cidr-splits.ts diff --git a/packages/@aws-cdk/aws-ec2/lib/client-vpn-authorization-rule.ts b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-authorization-rule.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/client-vpn-authorization-rule.ts rename to packages/aws-cdk-lib/aws-ec2/lib/client-vpn-authorization-rule.ts index ea574628d16e5..1a124bc72a8d9 100644 --- a/packages/@aws-cdk/aws-ec2/lib/client-vpn-authorization-rule.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-authorization-rule.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { IClientVpnEndpoint } from './client-vpn-endpoint-types'; import { CfnClientVpnAuthorizationRule } from './ec2.generated'; diff --git a/packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint-types.ts b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-endpoint-types.ts similarity index 95% rename from packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint-types.ts rename to packages/aws-cdk-lib/aws-ec2/lib/client-vpn-endpoint-types.ts index ee432f54b7dbb..2a0a703571cfc 100644 --- a/packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint-types.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-endpoint-types.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from '../../core'; import { IDependable } from 'constructs'; import { IConnectable } from './connections'; diff --git a/packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint.ts b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-endpoint.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint.ts rename to packages/aws-cdk-lib/aws-ec2/lib/client-vpn-endpoint.ts index f518b6219be53..f5cb8e94bc7c1 100644 --- a/packages/@aws-cdk/aws-ec2/lib/client-vpn-endpoint.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-endpoint.ts @@ -1,6 +1,6 @@ -import { ISamlProvider } from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import { CfnOutput, Resource, Token } from '@aws-cdk/core'; +import { ISamlProvider } from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import { CfnOutput, Resource, Token } from '../../core'; import { Construct, DependencyGroup, IDependable } from 'constructs'; import { ClientVpnAuthorizationRule, ClientVpnAuthorizationRuleOptions } from './client-vpn-authorization-rule'; import { IClientVpnConnectionHandler, IClientVpnEndpoint, TransportProtocol, VpnPort } from './client-vpn-endpoint-types'; diff --git a/packages/@aws-cdk/aws-ec2/lib/client-vpn-route.ts b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-route.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/client-vpn-route.ts rename to packages/aws-cdk-lib/aws-ec2/lib/client-vpn-route.ts index dd0c026be5a55..4b79c8bbbee7c 100644 --- a/packages/@aws-cdk/aws-ec2/lib/client-vpn-route.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/client-vpn-route.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { IClientVpnEndpoint } from './client-vpn-endpoint-types'; import { CfnClientVpnRoute } from './ec2.generated'; diff --git a/packages/@aws-cdk/aws-ec2/lib/connections.ts b/packages/aws-cdk-lib/aws-ec2/lib/connections.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/connections.ts rename to packages/aws-cdk-lib/aws-ec2/lib/connections.ts diff --git a/packages/@aws-cdk/aws-ec2/lib/index.ts b/packages/aws-cdk-lib/aws-ec2/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/index.ts rename to packages/aws-cdk-lib/aws-ec2/lib/index.ts diff --git a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts b/packages/aws-cdk-lib/aws-ec2/lib/instance-types.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/instance-types.ts rename to packages/aws-cdk-lib/aws-ec2/lib/instance-types.ts diff --git a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts new file mode 100644 index 0000000000000..345afab15be25 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts @@ -0,0 +1,632 @@ +import * as iam from '../../aws-iam'; + +import { Annotations, Aspects, Duration, Fn, IResource, Lazy, Resource, Stack, Tags } from '../../core'; +import { md5hash } from '../../core/lib/helpers-internal'; +import { Construct } from 'constructs'; +import { InstanceRequireImdsv2Aspect } from './aspects'; +import { CloudFormationInit } from './cfn-init'; +import { Connections, IConnectable } from './connections'; +import { CfnInstance } from './ec2.generated'; +import { InstanceType } from './instance-types'; +import { IMachineImage, OperatingSystemType } from './machine-image'; +import { instanceBlockDeviceMappings } from './private/ebs-util'; +import { ISecurityGroup, SecurityGroup } from './security-group'; +import { UserData } from './user-data'; +import { BlockDevice } from './volume'; +import { IVpc, Subnet, SubnetSelection } from './vpc'; + +/** + * Name tag constant + */ +const NAME_TAG: string = 'Name'; + +export interface IInstance extends IResource, IConnectable, iam.IGrantable { + /** + * The instance's ID + * + * @attribute + */ + readonly instanceId: string; + + /** + * The availability zone the instance was launched in + * + * @attribute + */ + readonly instanceAvailabilityZone: string; + + /** + * Private DNS name for this instance + * @attribute + */ + readonly instancePrivateDnsName: string; + + /** + * Private IP for this instance + * + * @attribute + */ + readonly instancePrivateIp: string; + + /** + * Publicly-routable DNS name for this instance. + * + * (May be an empty string if the instance does not have a public name). + * + * @attribute + */ + readonly instancePublicDnsName: string; + + /** + * Publicly-routable IP address for this instance. + * + * (May be an empty string if the instance does not have a public IP). + * + * @attribute + */ + readonly instancePublicIp: string; +} + +/** + * Properties of an EC2 Instance + */ +export interface InstanceProps { + + /** + * Name of SSH keypair to grant access to instance + * + * @default - No SSH access will be possible. + */ + readonly keyName?: string; + + /** + * Where to place the instance within the VPC + * + * @default - Private subnets. + */ + readonly vpcSubnets?: SubnetSelection; + + /** + * In which AZ to place the instance within the VPC + * + * @default - Random zone. + */ + readonly availabilityZone?: string; + + /** + * Whether the instance could initiate connections to anywhere by default. + * This property is only used when you do not provide a security group. + * + * @default true + */ + readonly allowAllOutbound?: boolean; + + /** + * The length of time to wait for the resourceSignalCount + * + * The maximum value is 43200 (12 hours). + * + * @default Duration.minutes(5) + */ + readonly resourceSignalTimeout?: Duration; + + /** + * VPC to launch the instance in. + */ + readonly vpc: IVpc; + + /** + * Security Group to assign to this instance + * + * @default - create new security group + */ + readonly securityGroup?: ISecurityGroup; + + /** + * Type of instance to launch + */ + readonly instanceType: InstanceType; + + /** + * AMI to launch + */ + readonly machineImage: IMachineImage; + + /** + * Specific UserData to use + * + * The UserData may still be mutated after creation. + * + * @default - A UserData object appropriate for the MachineImage's + * Operating System is created. + */ + readonly userData?: UserData; + + /** + * Changes to the UserData force replacement + * + * Depending the EC2 instance type, changing UserData either + * restarts the instance or replaces the instance. + * + * - Instance store-backed instances are replaced. + * - EBS-backed instances are restarted. + * + * By default, restarting does not execute the new UserData so you + * will need a different mechanism to ensure the instance is restarted. + * + * Setting this to `true` will make the instance's Logical ID depend on the + * UserData, which will cause CloudFormation to replace it if the UserData + * changes. + * + * @default - true iff `initOptions` is specified, false otherwise. + */ + readonly userDataCausesReplacement?: boolean; + + /** + * An IAM role to associate with the instance profile assigned to this Auto Scaling Group. + * + * The role must be assumable by the service principal `ec2.amazonaws.com`: + * + * @example + * const role = new iam.Role(this, 'MyRole', { + * assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com') + * }); + * + * @default - A role will automatically be created, it can be accessed via the `role` property + */ + readonly role?: iam.IRole; + + /** + * The name of the instance + * + * @default - CDK generated name + */ + readonly instanceName?: string; + + /** + * Specifies whether to enable an instance launched in a VPC to perform NAT. + * This controls whether source/destination checking is enabled on the instance. + * A value of true means that checking is enabled, and false means that checking is disabled. + * The value must be false for the instance to perform NAT. + * + * @default true + */ + readonly sourceDestCheck?: boolean; + + /** + * Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. + * + * Each instance that is launched has an associated root device volume, + * either an Amazon EBS volume or an instance store volume. + * You can use block device mappings to specify additional EBS volumes or + * instance store volumes to attach to an instance when it is launched. + * + * @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html + * + * @default - Uses the block device mapping of the AMI + */ + readonly blockDevices?: BlockDevice[]; + + /** + * Defines a private IP address to associate with an instance. + * + * Private IP should be available within the VPC that the instance is build within. + * + * @default - no association + */ + readonly privateIpAddress?: string; + + /** + * Propagate the EC2 instance tags to the EBS volumes. + * + * @default - false + */ + readonly propagateTagsToVolumeOnCreation?: boolean; + + /** + * Apply the given CloudFormation Init configuration to the instance at startup + * + * @default - no CloudFormation init + */ + readonly init?: CloudFormationInit; + + /** + * Use the given options for applying CloudFormation Init + * + * Describes the configsets to use and the timeout to wait + * + * @default - default options + */ + readonly initOptions?: ApplyCloudFormationInitOptions; + + /** + * Whether IMDSv2 should be required on this instance. + * + * @default - false + */ + readonly requireImdsv2?: boolean; + + /** + * Whether "Detailed Monitoring" is enabled for this instance + * Keep in mind that Detailed Monitoring results in extra charges + * + * @see http://aws.amazon.com/cloudwatch/pricing/ + * @default - false + */ + readonly detailedMonitoring?: boolean; + + /** + * Add SSM session permissions to the instance role + * + * Setting this to `true` adds the necessary permissions to connect + * to the instance using SSM Session Manager. You can do this + * from the AWS Console. + * + * NOTE: Setting this flag to `true` may not be enough by itself. + * You must also use an AMI that comes with the SSM Agent, or install + * the SSM Agent yourself. See + * [Working with SSM Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) + * in the SSM Developer Guide. + * + * @default false + */ + readonly ssmSessionPermissions?: boolean; +} + +/** + * This represents a single EC2 instance + */ +export class Instance extends Resource implements IInstance { + + /** + * The type of OS the instance is running. + */ + public readonly osType: OperatingSystemType; + + /** + * Allows specify security group connections for the instance. + */ + public readonly connections: Connections; + + /** + * The IAM role assumed by the instance. + */ + public readonly role: iam.IRole; + + /** + * The principal to grant permissions to + */ + public readonly grantPrincipal: iam.IPrincipal; + + /** + * UserData for the instance + */ + public readonly userData: UserData; + + /** + * the underlying instance resource + */ + public readonly instance: CfnInstance; + /** + * @attribute + */ + public readonly instanceId: string; + /** + * @attribute + */ + public readonly instanceAvailabilityZone: string; + /** + * @attribute + */ + public readonly instancePrivateDnsName: string; + /** + * @attribute + */ + public readonly instancePrivateIp: string; + /** + * @attribute + */ + public readonly instancePublicDnsName: string; + /** + * @attribute + */ + public readonly instancePublicIp: string; + + private readonly securityGroup: ISecurityGroup; + private readonly securityGroups: ISecurityGroup[] = []; + + constructor(scope: Construct, id: string, props: InstanceProps) { + super(scope, id); + + if (props.initOptions && !props.init) { + throw new Error('Setting \'initOptions\' requires that \'init\' is also set'); + } + + if (props.securityGroup) { + this.securityGroup = props.securityGroup; + } else { + this.securityGroup = new SecurityGroup(this, 'InstanceSecurityGroup', { + vpc: props.vpc, + allowAllOutbound: props.allowAllOutbound !== false, + }); + } + this.connections = new Connections({ securityGroups: [this.securityGroup] }); + this.securityGroups.push(this.securityGroup); + Tags.of(this).add(NAME_TAG, props.instanceName || this.node.path); + + this.role = props.role || new iam.Role(this, 'InstanceRole', { + assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), + }); + this.grantPrincipal = this.role; + + if (props.ssmSessionPermissions) { + this.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSSMManagedInstanceCore')); + } + + const iamProfile = new iam.CfnInstanceProfile(this, 'InstanceProfile', { + roles: [this.role.roleName], + }); + + // use delayed evaluation + const imageConfig = props.machineImage.getImage(this); + this.userData = props.userData ?? imageConfig.userData; + const userDataToken = Lazy.string({ produce: () => Fn.base64(this.userData.render()) }); + const securityGroupsToken = Lazy.list({ produce: () => this.securityGroups.map(sg => sg.securityGroupId) }); + + const { subnets } = props.vpc.selectSubnets(props.vpcSubnets); + let subnet; + if (props.availabilityZone) { + const selected = subnets.filter(sn => sn.availabilityZone === props.availabilityZone); + if (selected.length === 1) { + subnet = selected[0]; + } else { + Annotations.of(this).addError(`Need exactly 1 subnet to match AZ '${props.availabilityZone}', found ${selected.length}. Use a different availabilityZone.`); + } + } else { + if (subnets.length > 0) { + subnet = subnets[0]; + } else { + Annotations.of(this).addError(`Did not find any subnets matching '${JSON.stringify(props.vpcSubnets)}', please use a different selection.`); + } + } + if (!subnet) { + // We got here and we don't have a subnet because of validation errors. + // Invent one on the spot so the code below doesn't fail. + subnet = Subnet.fromSubnetAttributes(this, 'DummySubnet', { + subnetId: 's-notfound', + availabilityZone: 'az-notfound', + }); + } + + this.instance = new CfnInstance(this, 'Resource', { + imageId: imageConfig.imageId, + keyName: props.keyName, + instanceType: props.instanceType.toString(), + securityGroupIds: securityGroupsToken, + iamInstanceProfile: iamProfile.ref, + userData: userDataToken, + subnetId: subnet.subnetId, + availabilityZone: subnet.availabilityZone, + sourceDestCheck: props.sourceDestCheck, + blockDeviceMappings: props.blockDevices !== undefined ? instanceBlockDeviceMappings(this, props.blockDevices) : undefined, + privateIpAddress: props.privateIpAddress, + propagateTagsToVolumeOnCreation: props.propagateTagsToVolumeOnCreation, + monitoring: props.detailedMonitoring, + }); + this.instance.node.addDependency(this.role); + + this.osType = imageConfig.osType; + this.node.defaultChild = this.instance; + + this.instanceId = this.instance.ref; + this.instanceAvailabilityZone = this.instance.attrAvailabilityZone; + this.instancePrivateDnsName = this.instance.attrPrivateDnsName; + this.instancePrivateIp = this.instance.attrPrivateIp; + this.instancePublicDnsName = this.instance.attrPublicDnsName; + this.instancePublicIp = this.instance.attrPublicIp; + + if (props.init) { + this.applyCloudFormationInit(props.init, props.initOptions); + } + + this.applyUpdatePolicies(props); + + // Trigger replacement (via new logical ID) on user data change, if specified or cfn-init is being used. + // + // This is slightly tricky -- we need to resolve the UserData string (in order to get at actual Asset hashes, + // instead of the Token stringifications of them ('${Token[1234]}'). However, in the case of CFN Init usage, + // a UserData is going to contain the logicalID of the resource itself, which means infinite recursion if we + // try to naively resolve. We need a recursion breaker in this. + const originalLogicalId = Stack.of(this).getLogicalId(this.instance); + let recursing = false; + this.instance.overrideLogicalId(Lazy.uncachedString({ + produce: (context) => { + if (recursing) { return originalLogicalId; } + if (!(props.userDataCausesReplacement ?? props.initOptions)) { return originalLogicalId; } + + const fragments = new Array(); + recursing = true; + try { + fragments.push(JSON.stringify(context.resolve(this.userData.render()))); + } finally { + recursing = false; + } + const digest = md5hash(fragments.join('')).slice(0, 16); + return `${originalLogicalId}${digest}`; + }, + })); + + if (props.requireImdsv2) { + Aspects.of(this).add(new InstanceRequireImdsv2Aspect()); + } + } + + /** + * Add the security group to the instance. + * + * @param securityGroup: The security group to add + */ + public addSecurityGroup(securityGroup: ISecurityGroup): void { + this.securityGroups.push(securityGroup); + } + + /** + * Add command to the startup script of the instance. + * The command must be in the scripting language supported by the instance's OS (i.e. Linux/Windows). + */ + public addUserData(...commands: string[]) { + this.userData.addCommands(...commands); + } + + /** + * Adds a statement to the IAM role assumed by the instance. + */ + public addToRolePolicy(statement: iam.PolicyStatement) { + this.role.addToPrincipalPolicy(statement); + } + + /** + * Use a CloudFormation Init configuration at instance startup + * + * This does the following: + * + * - Attaches the CloudFormation Init metadata to the Instance resource. + * - Add commands to the instance UserData to run `cfn-init` and `cfn-signal`. + * - Update the instance's CreationPolicy to wait for the `cfn-signal` commands. + */ + private applyCloudFormationInit(init: CloudFormationInit, options: ApplyCloudFormationInitOptions = {}) { + init.attach(this.instance, { + platform: this.osType, + instanceRole: this.role, + userData: this.userData, + configSets: options.configSets, + embedFingerprint: options.embedFingerprint, + printLog: options.printLog, + ignoreFailures: options.ignoreFailures, + includeRole: options.includeRole, + includeUrl: options.includeUrl, + }); + this.waitForResourceSignal(options.timeout ?? Duration.minutes(5)); + } + + /** + * Wait for a single additional resource signal + * + * Add 1 to the current ResourceSignal Count and add the given timeout to the current timeout. + * + * Use this to pause the CloudFormation deployment to wait for the instances + * in the AutoScalingGroup to report successful startup during + * creation and updates. The UserData script needs to invoke `cfn-signal` + * with a success or failure code after it is done setting up the instance. + */ + private waitForResourceSignal(timeout: Duration) { + const oldResourceSignal = this.instance.cfnOptions.creationPolicy?.resourceSignal; + this.instance.cfnOptions.creationPolicy = { + ...this.instance.cfnOptions.creationPolicy, + resourceSignal: { + count: (oldResourceSignal?.count ?? 0) + 1, + timeout: (oldResourceSignal?.timeout ? Duration.parse(oldResourceSignal?.timeout).plus(timeout) : timeout).toIsoString(), + }, + }; + } + + /** + * Apply CloudFormation update policies for the instance + */ + private applyUpdatePolicies(props: InstanceProps) { + if (props.resourceSignalTimeout !== undefined) { + this.instance.cfnOptions.creationPolicy = { + ...this.instance.cfnOptions.creationPolicy, + resourceSignal: { + timeout: props.resourceSignalTimeout && props.resourceSignalTimeout.toIsoString(), + }, + }; + } + } +} + +/** + * Options for applying CloudFormation init to an instance or instance group + */ +export interface ApplyCloudFormationInitOptions { + /** + * ConfigSet to activate + * + * @default ['default'] + */ + readonly configSets?: string[]; + + /** + * Timeout waiting for the configuration to be applied + * + * @default Duration.minutes(5) + */ + readonly timeout?: Duration; + + /** + * Force instance replacement by embedding a config fingerprint + * + * If `true` (the default), a hash of the config will be embedded into the + * UserData, so that if the config changes, the UserData changes. + * + * - If the EC2 instance is instance-store backed or + * `userDataCausesReplacement` is set, this will cause the instance to be + * replaced and the new configuration to be applied. + * - If the instance is EBS-backed and `userDataCausesReplacement` is not + * set, the change of UserData will make the instance restart but not be + * replaced, and the configuration will not be applied automatically. + * + * If `false`, no hash will be embedded, and if the CloudFormation Init + * config changes nothing will happen to the running instance. If a + * config update introduces errors, you will not notice until after the + * CloudFormation deployment successfully finishes and the next instance + * fails to launch. + * + * @default true + */ + readonly embedFingerprint?: boolean; + + /** + * Print the results of running cfn-init to the Instance System Log + * + * By default, the output of running cfn-init is written to a log file + * on the instance. Set this to `true` to print it to the System Log + * (visible from the EC2 Console), `false` to not print it. + * + * (Be aware that the system log is refreshed at certain points in + * time of the instance life cycle, and successful execution may + * not always show up). + * + * @default true + */ + readonly printLog?: boolean; + + /** + * Don't fail the instance creation when cfn-init fails + * + * You can use this to prevent CloudFormation from rolling back when + * instances fail to start up, to help in debugging. + * + * @default false + */ + readonly ignoreFailures?: boolean; + + /** + * Include --url argument when running cfn-init and cfn-signal commands + * + * This will be the cloudformation endpoint in the deployed region + * e.g. https://cloudformation.us-east-1.amazonaws.com + * + * @default false + */ + readonly includeUrl?: boolean; + + /** + * Include --role argument when running cfn-init and cfn-signal commands + * + * This will be the IAM instance profile attached to the EC2 instance + * + * @default false + */ + readonly includeRole?: boolean; +} diff --git a/packages/@aws-cdk/aws-ec2/lib/ip-addresses.ts b/packages/aws-cdk-lib/aws-ec2/lib/ip-addresses.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/ip-addresses.ts rename to packages/aws-cdk-lib/aws-ec2/lib/ip-addresses.ts index 4a6cbc6df7ea7..86a1347c0b8ae 100644 --- a/packages/@aws-cdk/aws-ec2/lib/ip-addresses.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/ip-addresses.ts @@ -1,4 +1,4 @@ -import { Fn, Token } from '@aws-cdk/core'; +import { Fn, Token } from '../../core'; import { calculateCidrSplits } from './cidr-splits'; import { NetworkBuilder } from './network-util'; import { SubnetConfiguration } from './vpc'; diff --git a/packages/@aws-cdk/aws-ec2/lib/launch-template.ts b/packages/aws-cdk-lib/aws-ec2/lib/launch-template.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/launch-template.ts rename to packages/aws-cdk-lib/aws-ec2/lib/launch-template.ts index 0f27c58240c44..fddedade2ee8c 100644 --- a/packages/@aws-cdk/aws-ec2/lib/launch-template.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/launch-template.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import { Annotations, @@ -13,8 +13,8 @@ import { Tags, Token, FeatureFlags, -} from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +} from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { Connections, IConnectable } from './connections'; import { CfnLaunchTemplate } from './ec2.generated'; diff --git a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts b/packages/aws-cdk-lib/aws-ec2/lib/machine-image.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/machine-image.ts rename to packages/aws-cdk-lib/aws-ec2/lib/machine-image.ts index 7d05353781b71..12c41894e5936 100644 --- a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/machine-image.ts @@ -1,7 +1,7 @@ -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { ContextProvider, CfnMapping, Aws, Stack, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ssm from '../../aws-ssm'; +import * as cxschema from '../../cloud-assembly-schema'; +import { ContextProvider, CfnMapping, Aws, Stack, Token } from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { UserData } from './user-data'; import { WindowsVersion } from './windows-versions'; diff --git a/packages/@aws-cdk/aws-ec2/lib/nat.ts b/packages/aws-cdk-lib/aws-ec2/lib/nat.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/nat.ts rename to packages/aws-cdk-lib/aws-ec2/lib/nat.ts index f4ce8aa242053..6b8487c9d8b56 100644 --- a/packages/@aws-cdk/aws-ec2/lib/nat.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/nat.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Fn, Token } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Fn, Token } from '../../core'; import { Connections, IConnectable } from './connections'; import { Instance } from './instance'; import { InstanceType } from './instance-types'; diff --git a/packages/@aws-cdk/aws-ec2/lib/network-acl-types.ts b/packages/aws-cdk-lib/aws-ec2/lib/network-acl-types.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/network-acl-types.ts rename to packages/aws-cdk-lib/aws-ec2/lib/network-acl-types.ts diff --git a/packages/@aws-cdk/aws-ec2/lib/network-acl.ts b/packages/aws-cdk-lib/aws-ec2/lib/network-acl.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/network-acl.ts rename to packages/aws-cdk-lib/aws-ec2/lib/network-acl.ts index a957c3f46e92c..5fa160ee58421 100644 --- a/packages/@aws-cdk/aws-ec2/lib/network-acl.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/network-acl.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnNetworkAcl, CfnNetworkAclEntry, CfnSubnetNetworkAclAssociation } from './ec2.generated'; import { AclCidr, AclTraffic } from './network-acl-types'; diff --git a/packages/@aws-cdk/aws-ec2/lib/network-util.ts b/packages/aws-cdk-lib/aws-ec2/lib/network-util.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/network-util.ts rename to packages/aws-cdk-lib/aws-ec2/lib/network-util.ts diff --git a/packages/@aws-cdk/aws-ec2/lib/peer.ts b/packages/aws-cdk-lib/aws-ec2/lib/peer.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/peer.ts rename to packages/aws-cdk-lib/aws-ec2/lib/peer.ts index 2c0cc4be394c4..875b62afc975b 100644 --- a/packages/@aws-cdk/aws-ec2/lib/peer.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/peer.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; import { Connections, IConnectable } from './connections'; /** diff --git a/packages/@aws-cdk/aws-ec2/lib/port.ts b/packages/aws-cdk-lib/aws-ec2/lib/port.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/port.ts rename to packages/aws-cdk-lib/aws-ec2/lib/port.ts index 33999939a5222..8b7633fe117ab 100644 --- a/packages/@aws-cdk/aws-ec2/lib/port.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/port.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; /** * Protocol for use in Connection Rules diff --git a/packages/@aws-cdk/aws-ec2/lib/private/cfn-init-internal.ts b/packages/aws-cdk-lib/aws-ec2/lib/private/cfn-init-internal.ts similarity index 97% rename from packages/@aws-cdk/aws-ec2/lib/private/cfn-init-internal.ts rename to packages/aws-cdk-lib/aws-ec2/lib/private/cfn-init-internal.ts index 75e6c57175b93..1d8c4e245a971 100644 --- a/packages/@aws-cdk/aws-ec2/lib/private/cfn-init-internal.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/private/cfn-init-internal.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../../aws-iam'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ec2/lib/private/ebs-util.ts b/packages/aws-cdk-lib/aws-ec2/lib/private/ebs-util.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/private/ebs-util.ts rename to packages/aws-cdk-lib/aws-ec2/lib/private/ebs-util.ts index c4cce48152d89..d3ccff05f38a4 100644 --- a/packages/@aws-cdk/aws-ec2/lib/private/ebs-util.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/private/ebs-util.ts @@ -1,4 +1,4 @@ -import { Annotations } from '@aws-cdk/core'; +import { Annotations } from '../../../core'; import { Construct } from 'constructs'; import { CfnInstance, CfnLaunchTemplate } from '../ec2.generated'; import { BlockDevice, EbsDeviceVolumeType } from '../volume'; diff --git a/packages/aws-cdk-lib/aws-ec2/lib/security-group.ts b/packages/aws-cdk-lib/aws-ec2/lib/security-group.ts new file mode 100644 index 0000000000000..5e745e535a6ba --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/lib/security-group.ts @@ -0,0 +1,846 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import { Annotations, ContextProvider, IResource, Lazy, Names, Resource, ResourceProps, Stack, Token } from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { Connections } from './connections'; +import { CfnSecurityGroup, CfnSecurityGroupEgress, CfnSecurityGroupIngress } from './ec2.generated'; +import { IPeer, Peer } from './peer'; +import { Port } from './port'; +import { IVpc } from './vpc'; + +const SECURITY_GROUP_SYMBOL = Symbol.for('@aws-cdk/iam.SecurityGroup'); + +const SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY = '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'; + +/** + * Interface for security group-like objects + */ +export interface ISecurityGroup extends IResource, IPeer { + /** + * ID for the current security group + * @attribute + */ + readonly securityGroupId: string; + + /** + * Whether the SecurityGroup has been configured to allow all outbound traffic + */ + readonly allowAllOutbound: boolean; + + /** + * Add an ingress rule for the current security group + * + * `remoteRule` controls where the Rule object is created if the peer is also a + * securityGroup and they are in different stack. If false (default) the + * rule object is created under the current SecurityGroup object. If true and the + * peer is also a SecurityGroup, the rule object is created under the remote + * SecurityGroup object. + */ + addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean): void; + + /** + * Add an egress rule for the current security group + * + * `remoteRule` controls where the Rule object is created if the peer is also a + * securityGroup and they are in different stack. If false (default) the + * rule object is created under the current SecurityGroup object. If true and the + * peer is also a SecurityGroup, the rule object is created under the remote + * SecurityGroup object. + */ + addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean): void; +} + +/** + * A SecurityGroup that is not created in this template + */ +abstract class SecurityGroupBase extends Resource implements ISecurityGroup { + /** + * Return whether the indicated object is a security group + */ + public static isSecurityGroup(x: any): x is SecurityGroupBase { + return SECURITY_GROUP_SYMBOL in x; + } + + public abstract readonly securityGroupId: string; + public abstract readonly allowAllOutbound: boolean; + public abstract readonly allowAllIpv6Outbound: boolean; + + public readonly canInlineRule = false; + public readonly connections: Connections = new Connections({ securityGroups: [this] }); + public readonly defaultPort?: Port; + + private peerAsTokenCount: number = 0; + + constructor(scope: Construct, id: string, props?: ResourceProps) { + super(scope, id, props); + + Object.defineProperty(this, SECURITY_GROUP_SYMBOL, { value: true }); + } + + public get uniqueId() { + return Names.nodeUniqueId(this.node); + } + + public addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { + if (description === undefined) { + description = `from ${peer.uniqueId}:${connection}`; + } + + const { scope, id } = this.determineRuleScope(peer, connection, 'from', remoteRule); + + // Skip duplicates + if (scope.node.tryFindChild(id) === undefined) { + new CfnSecurityGroupIngress(scope, id, { + groupId: this.securityGroupId, + ...peer.toIngressRuleConfig(), + ...connection.toRuleJson(), + description, + }); + } + } + + public addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { + if (description === undefined) { + description = `to ${peer.uniqueId}:${connection}`; + } + + const { scope, id } = this.determineRuleScope(peer, connection, 'to', remoteRule); + + // Skip duplicates + if (scope.node.tryFindChild(id) === undefined) { + new CfnSecurityGroupEgress(scope, id, { + groupId: this.securityGroupId, + ...peer.toEgressRuleConfig(), + ...connection.toRuleJson(), + description, + }); + } + } + + public toIngressRuleConfig(): any { + return { sourceSecurityGroupId: this.securityGroupId }; + } + + public toEgressRuleConfig(): any { + return { destinationSecurityGroupId: this.securityGroupId }; + } + + /** + * Determine where to parent a new ingress/egress rule + * + * A SecurityGroup rule is parented under the group it's related to, UNLESS + * we're in a cross-stack scenario with another Security Group. In that case, + * we respect the 'remoteRule' flag and will parent under the other security + * group. + * + * This is necessary to avoid cyclic dependencies between stacks, since both + * ingress and egress rules will reference both security groups, and a naive + * parenting will lead to the following situation: + * + * ╔════════════════════╗ ╔════════════════════╗ + * ║ ┌───────────┐ ║ ║ ┌───────────┐ ║ + * ║ │ GroupA │◀────╬─┐ ┌───╬───▶│ GroupB │ ║ + * ║ └───────────┘ ║ │ │ ║ └───────────┘ ║ + * ║ ▲ ║ │ │ ║ ▲ ║ + * ║ │ ║ │ │ ║ │ ║ + * ║ │ ║ │ │ ║ │ ║ + * ║ ┌───────────┐ ║ └───┼───╬────┌───────────┐ ║ + * ║ │ EgressA │─────╬─────┘ ║ │ IngressB │ ║ + * ║ └───────────┘ ║ ║ └───────────┘ ║ + * ║ ║ ║ ║ + * ╚════════════════════╝ ╚════════════════════╝ + * + * By having the ability to switch the parent, we avoid the cyclic reference by + * keeping all rules in a single stack. + * + * If this happens, we also have to change the construct ID, because + * otherwise we might have two objects with the same ID if we have + * multiple reversed security group relationships. + * + * ╔═══════════════════════════════════╗ + * ║┌───────────┐ ║ + * ║│ GroupB │ ║ + * ║└───────────┘ ║ + * ║ ▲ ║ + * ║ │ ┌───────────┐ ║ + * ║ ├────"from A"──│ IngressB │ ║ + * ║ │ └───────────┘ ║ + * ║ │ ┌───────────┐ ║ + * ║ ├─────"to B"───│ EgressA │ ║ + * ║ │ └───────────┘ ║ + * ║ │ ┌───────────┐ ║ + * ║ └─────"to B"───│ EgressC │ ║ <-- oops + * ║ └───────────┘ ║ + * ╚═══════════════════════════════════╝ + */ + + protected determineRuleScope( + peer: IPeer, + connection: Port, + fromTo: 'from' | 'to', + remoteRule?: boolean): RuleScope { + + if (remoteRule && SecurityGroupBase.isSecurityGroup(peer) && differentStacks(this, peer)) { + // Reversed + const reversedFromTo = fromTo === 'from' ? 'to' : 'from'; + return { scope: peer, id: `${this.uniqueId}:${connection} ${reversedFromTo}` }; + } else { + // Regular (do old ID escaping to in order to not disturb existing deployments) + return { scope: this, id: `${fromTo} ${this.renderPeer(peer)}:${connection}`.replace('/', '_') }; + } + } + + private renderPeer(peer: IPeer) { + if (Token.isUnresolved(peer.uniqueId)) { + // Need to return a unique value each time a peer + // is an unresolved token, else the duplicate skipper + // in `sg.addXxxRule` can detect unique rules as duplicates + return this.peerAsTokenCount++ ? `'{IndirectPeer${this.peerAsTokenCount}}'` : '{IndirectPeer}'; + } else { + return peer.uniqueId; + } + } +} + +/** + * The scope and id in which a given SecurityGroup rule should be defined. + */ +export interface RuleScope { + /** + * The SecurityGroup in which a rule should be scoped. + */ + readonly scope: ISecurityGroup; + /** + * The construct ID to use for the rule. + */ + readonly id: string; +} + +function differentStacks(group1: SecurityGroupBase, group2: SecurityGroupBase) { + return Stack.of(group1) !== Stack.of(group2); +} + +export interface SecurityGroupProps { + /** + * The name of the security group. For valid values, see the GroupName + * parameter of the CreateSecurityGroup action in the Amazon EC2 API + * Reference. + * + * It is not recommended to use an explicit group name. + * + * @default If you don't specify a GroupName, AWS CloudFormation generates a + * unique physical ID and uses that ID for the group name. + */ + readonly securityGroupName?: string; + + /** + * A description of the security group. + * + * @default The default name will be the construct's CDK path. + */ + readonly description?: string; + + /** + * The VPC in which to create the security group. + */ + readonly vpc: IVpc; + + /** + * Whether to allow all outbound traffic by default. + * + * If this is set to true, there will only be a single egress rule which allows all + * outbound traffic. If this is set to false, no outbound traffic will be allowed by + * default and all egress traffic must be explicitly authorized. + * + * To allow all ipv6 traffic use allowAllIpv6Outbound + * + * @default true + */ + readonly allowAllOutbound?: boolean; + + /** + * Whether to allow all outbound ipv6 traffic by default. + * + * If this is set to true, there will only be a single egress rule which allows all + * outbound ipv6 traffic. If this is set to false, no outbound traffic will be allowed by + * default and all egress ipv6 traffic must be explicitly authorized. + * + * To allow all ipv4 traffic use allowAllOutbound + * + * @default false + */ + readonly allowAllIpv6Outbound?: boolean; + + /** + * Whether to disable inline ingress and egress rule optimization. + * + * If this is set to true, ingress and egress rules will not be declared under the + * SecurityGroup in cloudformation, but will be separate elements. + * + * Inlining rules is an optimization for producing smaller stack templates. Sometimes + * this is not desirable, for example when security group access is managed via tags. + * + * The default value can be overriden globally by setting the context variable + * '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'. + * + * @default false + */ + readonly disableInlineRules?: boolean; +} + +/** + * Additional options for imported security groups + */ +export interface SecurityGroupImportOptions { + /** + * Mark the SecurityGroup as having been created allowing all outbound traffic + * + * Only if this is set to false will egress rules be added to this security + * group. Be aware, this would undo any potential "all outbound traffic" + * default. + * + * + * @default true + */ + readonly allowAllOutbound?: boolean; + + /** + * Mark the SecurityGroup as having been created allowing all outbound ipv6 traffic + * + * Only if this is set to false will egress rules for ipv6 be added to this security + * group. Be aware, this would undo any potential "all outbound traffic" + * default. + * + * @default false + */ + readonly allowAllIpv6Outbound?: boolean; + + /** + * If a SecurityGroup is mutable CDK can add rules to existing groups + * + * Beware that making a SecurityGroup immutable might lead to issue + * due to missing ingress/egress rules for new resources. + * + * + * @default true + */ + readonly mutable?: boolean; +} + +/** + * Creates an Amazon EC2 security group within a VPC. + * + * Security Groups act like a firewall with a set of rules, and are associated + * with any AWS resource that has or creates Elastic Network Interfaces (ENIs). + * A typical example of a resource that has a security group is an Instance (or + * Auto Scaling Group of instances) + * + * If you are defining new infrastructure in CDK, there is a good chance you + * won't have to interact with this class at all. Like IAM Roles, Security + * Groups need to exist to control access between AWS resources, but CDK will + * automatically generate and populate them with least-privilege permissions + * for you so you can concentrate on your business logic. + * + * All Constructs that require Security Groups will create one for you if you + * don't specify one at construction. After construction, you can selectively + * allow connections to and between constructs via--for example-- the `instance.connections` + * object. Think of it as "allowing connections to your instance", rather than + * "adding ingress rules a security group". See the [Allowing + * Connections](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#allowing-connections) + * section in the library documentation for examples. + * + * Direct manipulation of the Security Group through `addIngressRule` and + * `addEgressRule` is possible, but mutation through the `.connections` object + * is recommended. If you peer two constructs with security groups this way, + * appropriate rules will be created in both. + * + * If you have an existing security group you want to use in your CDK application, + * you would import it like this: + * + * ```ts + * const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'SG', 'sg-12345', { + * mutable: false + * }); + * ``` + */ +export class SecurityGroup extends SecurityGroupBase { + /** + * Look up a security group by id. + * + * @deprecated Use `fromLookupById()` instead + */ + public static fromLookup(scope: Construct, id: string, securityGroupId: string) { + return this.fromLookupAttributes(scope, id, { securityGroupId }); + } + + /** + * Look up a security group by id. + */ + public static fromLookupById(scope: Construct, id: string, securityGroupId: string) { + return this.fromLookupAttributes(scope, id, { securityGroupId }); + } + + /** + * Look up a security group by name. + */ + public static fromLookupByName(scope: Construct, id: string, securityGroupName: string, vpc: IVpc) { + return this.fromLookupAttributes(scope, id, { securityGroupName, vpc }); + } + + /** + * Import an existing security group into this app. + * + * This method will assume that the Security Group has a rule in it which allows + * all outbound traffic, and so will not add egress rules to the imported Security + * Group (only ingress rules). + * + * If your existing Security Group needs to have egress rules added, pass the + * `allowAllOutbound: false` option on import. + */ + public static fromSecurityGroupId(scope: Construct, id: string, securityGroupId: string, options: SecurityGroupImportOptions = {}): ISecurityGroup { + class MutableImport extends SecurityGroupBase { + public securityGroupId = securityGroupId; + public allowAllOutbound = options.allowAllOutbound ?? true; + public allowAllIpv6Outbound = options.allowAllIpv6Outbound ?? false; + + public addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { + // Only if allowAllOutbound has been disabled + if (options.allowAllOutbound === false) { + super.addEgressRule(peer, connection, description, remoteRule); + } + } + } + + class ImmutableImport extends SecurityGroupBase { + public securityGroupId = securityGroupId; + public allowAllOutbound = options.allowAllOutbound ?? true; + public allowAllIpv6Outbound = options.allowAllIpv6Outbound ?? false; + + public addEgressRule(_peer: IPeer, _connection: Port, _description?: string, _remoteRule?: boolean) { + // do nothing + } + + public addIngressRule(_peer: IPeer, _connection: Port, _description?: string, _remoteRule?: boolean) { + // do nothing + } + } + + return options.mutable !== false + ? new MutableImport(scope, id) + : new ImmutableImport(scope, id); + } + + /** + * Look up a security group. + */ + private static fromLookupAttributes(scope: Construct, id: string, options: SecurityGroupLookupOptions) { + if (Token.isUnresolved(options.securityGroupId) || Token.isUnresolved(options.securityGroupName) || Token.isUnresolved(options.vpc?.vpcId)) { + throw new Error('All arguments to look up a security group must be concrete (no Tokens)'); + } + + const attributes: cxapi.SecurityGroupContextResponse = ContextProvider.getValue(scope, { + provider: cxschema.ContextProvider.SECURITY_GROUP_PROVIDER, + props: { + securityGroupId: options.securityGroupId, + securityGroupName: options.securityGroupName, + vpcId: options.vpc?.vpcId, + }, + dummyValue: { + securityGroupId: 'sg-12345678', + allowAllOutbound: true, + } as cxapi.SecurityGroupContextResponse, + }).value; + + return SecurityGroup.fromSecurityGroupId(scope, id, attributes.securityGroupId, { + allowAllOutbound: attributes.allowAllOutbound, + mutable: true, + }); + } + + /** + * An attribute that represents the security group name. + * + * @attribute + * @deprecated returns the security group ID, rather than the name. + */ + public readonly securityGroupName: string; + + /** + * The ID of the security group + * + * @attribute + */ + public readonly securityGroupId: string; + + /** + * The VPC ID this security group is part of. + * + * @attribute + */ + public readonly securityGroupVpcId: string; + + /** + * Whether the SecurityGroup has been configured to allow all outbound traffic + */ + public readonly allowAllOutbound: boolean; + + /** + * Whether the SecurityGroup has been configured to allow all outbound ipv6 traffic + */ + public readonly allowAllIpv6Outbound: boolean; + + private readonly securityGroup: CfnSecurityGroup; + private readonly directIngressRules: CfnSecurityGroup.IngressProperty[] = []; + private readonly directEgressRules: CfnSecurityGroup.EgressProperty[] = []; + + /** + * Whether to disable optimization for inline security group rules. + */ + private readonly disableInlineRules: boolean; + + constructor(scope: Construct, id: string, props: SecurityGroupProps) { + super(scope, id, { + physicalName: props.securityGroupName, + }); + + const groupDescription = props.description || this.node.path; + + this.allowAllOutbound = props.allowAllOutbound !== false; + this.allowAllIpv6Outbound = props.allowAllIpv6Outbound ?? false; + + this.disableInlineRules = props.disableInlineRules !== undefined ? + !!props.disableInlineRules : + !!this.node.tryGetContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY); + + this.securityGroup = new CfnSecurityGroup(this, 'Resource', { + groupName: this.physicalName, + groupDescription, + securityGroupIngress: Lazy.any({ produce: () => this.directIngressRules }, { omitEmptyArray: true } ), + securityGroupEgress: Lazy.any({ produce: () => this.directEgressRules }, { omitEmptyArray: true } ), + vpcId: props.vpc.vpcId, + }); + + this.securityGroupId = this.securityGroup.attrGroupId; + this.securityGroupVpcId = this.securityGroup.attrVpcId; + this.securityGroupName = this.securityGroup.ref; + + this.addDefaultEgressRule(); + this.addDefaultIpv6EgressRule(); + } + + public addIngressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { + if (!peer.canInlineRule || !connection.canInlineRule || this.disableInlineRules) { + super.addIngressRule(peer, connection, description, remoteRule); + return; + } + + if (description === undefined) { + description = `from ${peer.uniqueId}:${connection}`; + } + + this.addDirectIngressRule({ + ...peer.toIngressRuleConfig(), + ...connection.toRuleJson(), + description, + }); + } + + public addEgressRule(peer: IPeer, connection: Port, description?: string, remoteRule?: boolean) { + const isIpv6 = peer.toEgressRuleConfig().hasOwnProperty('cidrIpv6'); + + if (!isIpv6 && this.allowAllOutbound) { + // In the case of "allowAllOutbound", we don't add any more rules. There + // is only one rule which allows all traffic and that subsumes any other + // rule. + if (!remoteRule) { // Warn only if addEgressRule() was explicitely called + Annotations.of(this).addWarning('Ignoring Egress rule since \'allowAllOutbound\' is set to true; To add customized rules, set allowAllOutbound=false on the SecurityGroup'); + } + return; + } else if (!isIpv6 && !this.allowAllOutbound) { + // Otherwise, if the bogus rule exists we can now remove it because the + // presence of any other rule will get rid of EC2's implicit "all + // outbound" rule anyway. + this.removeNoTrafficRule(); + } + + if (isIpv6 && this.allowAllIpv6Outbound) { + // In the case of "allowAllIpv6Outbound", we don't add any more rules. There + // is only one rule which allows all traffic and that subsumes any other + // rule. + if (!remoteRule) { // Warn only if addEgressRule() was explicitely called + Annotations.of(this).addWarning('Ignoring Egress rule since \'allowAllIpv6Outbound\' is set to true; To add customized rules, set allowAllIpv6Outbound=false on the SecurityGroup'); + } + return; + } + + if (!peer.canInlineRule || !connection.canInlineRule || this.disableInlineRules) { + super.addEgressRule(peer, connection, description, remoteRule); + return; + } + + if (description === undefined) { + description = `from ${peer.uniqueId}:${connection}`; + } + + const rule = { + ...peer.toEgressRuleConfig(), + ...connection.toRuleJson(), + description, + }; + + if (isAllTrafficRule(rule)) { + // We cannot allow this; if someone adds the rule in this way, it will be + // removed again if they add other rules. We also can't automatically switch + // to "allOutbound=true" mode, because we might have already emitted + // EgressRule objects (which count as rules added later) and there's no way + // to recall those. Better to prevent this for now. + throw new Error('Cannot add an "all traffic" egress rule in this way; set allowAllOutbound=true (for ipv6) or allowAllIpv6Outbound=true (for ipv6) on the SecurityGroup instead.'); + } + + this.addDirectEgressRule(rule); + } + + /** + * Add a direct ingress rule + */ + private addDirectIngressRule(rule: CfnSecurityGroup.IngressProperty) { + if (!this.hasIngressRule(rule)) { + this.directIngressRules.push(rule); + } + } + + /** + * Return whether the given ingress rule exists on the group + */ + private hasIngressRule(rule: CfnSecurityGroup.IngressProperty): boolean { + return this.directIngressRules.findIndex(r => ingressRulesEqual(r, rule)) > -1; + } + + /** + * Add a direct egress rule + */ + private addDirectEgressRule(rule: CfnSecurityGroup.EgressProperty) { + if (!this.hasEgressRule(rule)) { + this.directEgressRules.push(rule); + } + } + + /** + * Return whether the given egress rule exists on the group + */ + private hasEgressRule(rule: CfnSecurityGroup.EgressProperty): boolean { + return this.directEgressRules.findIndex(r => egressRulesEqual(r, rule)) > -1; + } + + /** + * Add the default egress rule to the securityGroup + * + * This depends on allowAllOutbound: + * + * - If allowAllOutbound is true, we *TECHNICALLY* don't need to do anything, because + * EC2 is going to create this default rule anyway. But, for maximum readability + * of the template, we will add one anyway. + * - If allowAllOutbound is false, we add a bogus rule that matches no traffic in + * order to get rid of the default "all outbound" rule that EC2 creates by default. + * If other rules happen to get added later, we remove the bogus rule again so + * that it doesn't clutter up the template too much (even though that's not + * strictly necessary). + */ + private addDefaultEgressRule() { + if (this.disableInlineRules) { + const peer = this.allowAllOutbound ? ALL_TRAFFIC_PEER : NO_TRAFFIC_PEER; + const port = this.allowAllOutbound ? ALL_TRAFFIC_PORT : NO_TRAFFIC_PORT; + const description = this.allowAllOutbound ? ALLOW_ALL_RULE.description : MATCH_NO_TRAFFIC.description; + super.addEgressRule(peer, port, description, false); + } else { + const rule = this.allowAllOutbound? ALLOW_ALL_RULE : MATCH_NO_TRAFFIC; + this.directEgressRules.push(rule); + } + } + + /** + * Add a allow all ipv6 egress rule to the securityGroup + * + * This depends on allowAllIpv6Outbound: + * + * - If allowAllIpv6Outbound is true, we will add an allow all rule. + * - If allowAllOutbound is false, we don't do anything since EC2 does not add + * a default allow all ipv6 rule. + */ + private addDefaultIpv6EgressRule() { + const description = 'Allow all outbound ipv6 traffic by default'; + const peer = Peer.anyIpv6(); + if (this.allowAllIpv6Outbound) { + if (this.disableInlineRules) { + super.addEgressRule(peer, Port.allTraffic(), description, false); + } else { + this.directEgressRules.push({ + ipProtocol: '-1', + cidrIpv6: peer.uniqueId, + description, + }); + } + } + } + + /** + * Remove the bogus rule if it exists + */ + private removeNoTrafficRule() { + if (this.disableInlineRules) { + const { scope, id } = this.determineRuleScope( + NO_TRAFFIC_PEER, + NO_TRAFFIC_PORT, + 'to', + false, + ); + scope.node.tryRemoveChild(id); + } else { + const i = this.directEgressRules.findIndex(r => egressRulesEqual(r, MATCH_NO_TRAFFIC)); + if (i > -1) { + this.directEgressRules.splice(i, 1); + } + } + } +} + +/** + * Egress rule that purposely matches no traffic + * + * This is used in order to disable the "all traffic" default of Security Groups. + * + * No machine can ever actually have the 255.255.255.255 IP address, but + * in order to lock it down even more we'll restrict to a nonexistent + * ICMP traffic type. + */ +const MATCH_NO_TRAFFIC = { + cidrIp: '255.255.255.255/32', + description: 'Disallow all traffic', + ipProtocol: 'icmp', + fromPort: 252, + toPort: 86, +}; + +const NO_TRAFFIC_PEER = Peer.ipv4(MATCH_NO_TRAFFIC.cidrIp); +const NO_TRAFFIC_PORT = Port.icmpTypeAndCode(MATCH_NO_TRAFFIC.fromPort, MATCH_NO_TRAFFIC.toPort); + +/** + * Egress rule that matches all traffic + */ +const ALLOW_ALL_RULE = { + cidrIp: '0.0.0.0/0', + description: 'Allow all outbound traffic by default', + ipProtocol: '-1', +}; + +const ALL_TRAFFIC_PEER = Peer.anyIpv4(); +const ALL_TRAFFIC_PORT = Port.allTraffic(); + +export interface ConnectionRule { + /** + * The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). + * Use -1 to specify all protocols. If you specify -1, or a protocol number + * other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is + * allowed, regardless of any ports you specify. For tcp, udp, and icmp, you + * must specify a port range. For protocol 58 (ICMPv6), you can optionally + * specify a port range; if you don't, traffic for all types and codes is + * allowed. + * + * @default tcp + */ + readonly protocol?: string; + + /** + * Start of port range for the TCP and UDP protocols, or an ICMP type number. + * + * If you specify icmp for the IpProtocol property, you can specify + * -1 as a wildcard (i.e., any ICMP type number). + */ + readonly fromPort: number; + + /** + * End of port range for the TCP and UDP protocols, or an ICMP code. + * + * If you specify icmp for the IpProtocol property, you can specify -1 as a + * wildcard (i.e., any ICMP code). + * + * @default If toPort is not specified, it will be the same as fromPort. + */ + readonly toPort?: number; + + /** + * Description of this connection. It is applied to both the ingress rule + * and the egress rule. + * + * @default No description + */ + readonly description?: string; +} + +/** + * Compare two ingress rules for equality the same way CloudFormation would (discarding description) + */ +function ingressRulesEqual(a: CfnSecurityGroup.IngressProperty, b: CfnSecurityGroup.IngressProperty) { + return a.cidrIp === b.cidrIp + && a.cidrIpv6 === b.cidrIpv6 + && a.fromPort === b.fromPort + && a.toPort === b.toPort + && a.ipProtocol === b.ipProtocol + && a.sourceSecurityGroupId === b.sourceSecurityGroupId + && a.sourceSecurityGroupName === b.sourceSecurityGroupName + && a.sourceSecurityGroupOwnerId === b.sourceSecurityGroupOwnerId; +} + +/** + * Compare two egress rules for equality the same way CloudFormation would (discarding description) + */ +function egressRulesEqual(a: CfnSecurityGroup.EgressProperty, b: CfnSecurityGroup.EgressProperty) { + return a.cidrIp === b.cidrIp + && a.cidrIpv6 === b.cidrIpv6 + && a.fromPort === b.fromPort + && a.toPort === b.toPort + && a.ipProtocol === b.ipProtocol + && a.destinationPrefixListId === b.destinationPrefixListId + && a.destinationSecurityGroupId === b.destinationSecurityGroupId; +} + +/** + * Whether this rule refers to all traffic + */ +function isAllTrafficRule(rule: any) { + return (rule.cidrIp === '0.0.0.0/0' || rule.cidrIpv6 === '::/0') && rule.ipProtocol === '-1'; +} + +/** + * Properties for looking up an existing SecurityGroup. + * + * Either `securityGroupName` or `securityGroupId` has to be specified. + */ +interface SecurityGroupLookupOptions { + /** + * The name of the security group + * + * If given, will import the SecurityGroup with this name. + * + * @default Don't filter on securityGroupName + */ + readonly securityGroupName?: string; + + /** + * The ID of the security group + * + * If given, will import the SecurityGroup with this ID. + * + * @default Don't filter on securityGroupId + */ + readonly securityGroupId?: string; + + /** + * The VPC of the security group + * + * If given, will filter the SecurityGroup based on the VPC. + * + * @default Don't filter on VPC + */ + readonly vpc?: IVpc, +} diff --git a/packages/@aws-cdk/aws-ec2/lib/subnet.ts b/packages/aws-cdk-lib/aws-ec2/lib/subnet.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/subnet.ts rename to packages/aws-cdk-lib/aws-ec2/lib/subnet.ts index 41585a2d8b974..73814b36d6127 100644 --- a/packages/@aws-cdk/aws-ec2/lib/subnet.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/subnet.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; import { CidrBlock, NetworkUtils } from './network-util'; import { ISubnet } from './vpc'; /** diff --git a/packages/aws-cdk-lib/aws-ec2/lib/user-data.ts b/packages/aws-cdk-lib/aws-ec2/lib/user-data.ts new file mode 100644 index 0000000000000..84f0527d854ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/lib/user-data.ts @@ -0,0 +1,594 @@ +import { IBucket } from '../../aws-s3'; +import { Fn, Resource, Stack, CfnResource } from '../../core'; +import { OperatingSystemType } from './machine-image'; + +/** + * Options when constructing UserData for Linux + */ +export interface LinuxUserDataOptions { + /** + * Shebang for the UserData script + * + * @default "#!/bin/bash" + */ + readonly shebang?: string; +} + +/** + * Options when constructing UserData for Windows + */ +export interface WindowsUserDataOptions { + /** + * Set to true to set this userdata to persist through an instance reboot; allowing + * it to run on every instance start. + * By default, UserData is run only once during the first instance launch. + * + * For more information, see: + * https://aws.amazon.com/premiumsupport/knowledge-center/execute-user-data-ec2/ + * https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts + * + * @default false + */ + readonly persist?: boolean; +} + +/** + * Options when downloading files from S3 + */ +export interface S3DownloadOptions { + + /** + * Name of the S3 bucket to download from + */ + readonly bucket: IBucket; + + /** + * The key of the file to download + */ + readonly bucketKey: string; + + /** + * The name of the local file. + * + * @default Linux - /tmp/bucketKey + * Windows - %TEMP%/bucketKey + */ + readonly localFile?: string; + + /** + * The region of the S3 Bucket (needed for access via VPC Gateway) + * @default none + */ + readonly region?: string + +} + +/** + * Options when executing a file. + */ +export interface ExecuteFileOptions { + + /** + * The path to the file. + */ + readonly filePath: string; + + /** + * The arguments to be passed to the file. + * + * @default No arguments are passed to the file. + */ + readonly arguments?: string; + +} + +/** + * Instance User Data + */ +export abstract class UserData { + /** + * Create a userdata object for Linux hosts + */ + public static forLinux(options: LinuxUserDataOptions = {}): UserData { + return new LinuxUserData(options); + } + + /** + * Create a userdata object for Windows hosts + */ + public static forWindows(options: WindowsUserDataOptions = {}): UserData { + return new WindowsUserData(options); + } + + /** + * Create a userdata object with custom content + */ + public static custom(content: string): UserData { + const userData = new CustomUserData(); + userData.addCommands(content); + return userData; + } + + public static forOperatingSystem(os: OperatingSystemType): UserData { + switch (os) { + case OperatingSystemType.LINUX: return UserData.forLinux(); + case OperatingSystemType.WINDOWS: return UserData.forWindows(); + case OperatingSystemType.UNKNOWN: throw new Error('Cannot determine UserData for unknown operating system type'); + } + } + + /** + * Add one or more commands to the user data + */ + public abstract addCommands(...commands: string[]): void; + + /** + * Add one or more commands to the user data that will run when the script exits. + */ + public abstract addOnExitCommands(...commands: string[]): void; + + /** + * Render the UserData for use in a construct + */ + public abstract render(): string; + + /** + * Adds commands to download a file from S3 + * + * @returns: The local path that the file will be downloaded to + */ + public abstract addS3DownloadCommand(params: S3DownloadOptions): string; + + /** + * Adds commands to execute a file + */ + public abstract addExecuteFileCommand( params: ExecuteFileOptions): void; + + /** + * Adds a command which will send a cfn-signal when the user data script ends + */ + public abstract addSignalOnExitCommand( resource: Resource ): void; + +} + +/** + * Linux Instance User Data + */ +class LinuxUserData extends UserData { + private readonly lines: string[] = []; + private readonly onExitLines: string[] = []; + + constructor(private readonly props: LinuxUserDataOptions = {}) { + super(); + } + + public addCommands(...commands: string[]) { + this.lines.push(...commands); + } + + public addOnExitCommands(...commands: string[]) { + this.onExitLines.push(...commands); + } + + public render(): string { + const shebang = this.props.shebang ?? '#!/bin/bash'; + return [shebang, ...(this.renderOnExitLines()), ...this.lines].join('\n'); + } + + public addS3DownloadCommand(params: S3DownloadOptions): string { + const s3Path = `s3://${params.bucket.bucketName}/${params.bucketKey}`; + const localPath = ( params.localFile && params.localFile.length !== 0 ) ? params.localFile : `/tmp/${ params.bucketKey }`; + this.addCommands( + `mkdir -p $(dirname '${localPath}')`, + `aws s3 cp '${s3Path}' '${localPath}'` + (params.region !== undefined ? ` --region ${params.region}` : ''), + ); + + return localPath; + } + + public addExecuteFileCommand( params: ExecuteFileOptions): void { + this.addCommands( + 'set -e', + `chmod +x '${params.filePath}'`, + `'${params.filePath}' ${params.arguments ?? ''}`.trim(), + ); + } + + public addSignalOnExitCommand( resource: Resource ): void { + const stack = Stack.of(resource); + const resourceID = (resource.node.defaultChild as CfnResource).logicalId; + this.addOnExitCommands(`/opt/aws/bin/cfn-signal --stack ${stack.stackName} --resource ${resourceID} --region ${stack.region} -e $exitCode || echo 'Failed to send Cloudformation Signal'`); + } + + private renderOnExitLines(): string[] { + if ( this.onExitLines.length > 0 ) { + return ['function exitTrap(){', 'exitCode=$?', ...this.onExitLines, '}', 'trap exitTrap EXIT']; + } + return []; + } +} + +/** + * Windows Instance User Data + */ +class WindowsUserData extends UserData { + private readonly lines: string[] = []; + private readonly onExitLines: string[] = []; + + constructor(private readonly props: WindowsUserDataOptions = {}) { + super(); + } + + public addCommands(...commands: string[]) { + this.lines.push(...commands); + } + + public addOnExitCommands(...commands: string[]) { + this.onExitLines.push(...commands); + } + + public render(): string { + return `${ + [...(this.renderOnExitLines()), + ...this.lines, + ...( this.onExitLines.length > 0 ? ['throw "Success"'] : [] )].join('\n') + }${(this.props.persist ?? false) ? 'true' : ''}`; + } + + public addS3DownloadCommand(params: S3DownloadOptions): string { + const localPath = ( params.localFile && params.localFile.length !== 0 ) ? params.localFile : `C:/temp/${ params.bucketKey }`; + this.addCommands( + `mkdir (Split-Path -Path '${localPath}' ) -ea 0`, + `Read-S3Object -BucketName '${params.bucket.bucketName}' -key '${params.bucketKey}' -file '${localPath}' -ErrorAction Stop` + (params.region !== undefined ? ` -Region ${params.region}` : ''), + ); + return localPath; + } + + public addExecuteFileCommand( params: ExecuteFileOptions): void { + this.addCommands( + `&'${params.filePath}' ${params.arguments ?? ''}`.trim(), + `if (!$?) { Write-Error 'Failed to execute the file "${params.filePath}"' -ErrorAction Stop }`, + ); + } + + public addSignalOnExitCommand( resource: Resource ): void { + const stack = Stack.of(resource); + const resourceID = (resource.node.defaultChild as CfnResource).logicalId; + + this.addOnExitCommands(`cfn-signal --stack ${stack.stackName} --resource ${resourceID} --region ${stack.region} --success ($success.ToString().ToLower())`); + } + + private renderOnExitLines(): string[] { + if ( this.onExitLines.length > 0 ) { + return ['trap {', '$success=($PSItem.Exception.Message -eq "Success")', ...this.onExitLines, 'break', '}']; + } + return []; + } +} + +/** + * Custom Instance User Data + */ +class CustomUserData extends UserData { + private readonly lines: string[] = []; + + constructor() { + super(); + } + + public addCommands(...commands: string[]) { + this.lines.push(...commands); + } + + public addOnExitCommands(): void { + throw new Error('CustomUserData does not support addOnExitCommands, use UserData.forLinux() or UserData.forWindows() instead.'); + } + + public render(): string { + return this.lines.join('\n'); + } + + public addS3DownloadCommand(): string { + throw new Error('CustomUserData does not support addS3DownloadCommand, use UserData.forLinux() or UserData.forWindows() instead.'); + } + + public addExecuteFileCommand(): void { + throw new Error('CustomUserData does not support addExecuteFileCommand, use UserData.forLinux() or UserData.forWindows() instead.'); + } + + public addSignalOnExitCommand(): void { + throw new Error('CustomUserData does not support addSignalOnExitCommand, use UserData.forLinux() or UserData.forWindows() instead.'); + } +} + +/** + * Options when creating `MultipartBody`. + */ +export interface MultipartBodyOptions { + + /** + * `Content-Type` header of this part. + * + * Some examples of content types: + * * `text/x-shellscript; charset="utf-8"` (shell script) + * * `text/cloud-boothook; charset="utf-8"` (shell script executed during boot phase) + * + * For Linux shell scripts use `text/x-shellscript`. + */ + readonly contentType: string; + + /** + * `Content-Transfer-Encoding` header specifying part encoding. + * + * @default undefined - body is not encoded + */ + readonly transferEncoding?: string; + + /** + * The body of message. + * + * @default undefined - body will not be added to part + */ + readonly body?: string, +} + +/** + * The base class for all classes which can be used as `MultipartUserData`. + */ +export abstract class MultipartBody { + /** + * Content type for shell scripts + */ + public static readonly SHELL_SCRIPT = 'text/x-shellscript; charset="utf-8"'; + + /** + * Content type for boot hooks + */ + public static readonly CLOUD_BOOTHOOK = 'text/cloud-boothook; charset="utf-8"'; + + /** + * Constructs the new `MultipartBody` wrapping existing `UserData`. Modification to `UserData` are reflected + * in subsequent renders of the part. + * + * For more information about content types see `MultipartBodyOptions.contentType`. + * + * @param userData user data to wrap into body part + * @param contentType optional content type, if default one should not be used + */ + public static fromUserData(userData: UserData, contentType?: string): MultipartBody { + return new MultipartBodyUserDataWrapper(userData, contentType); + } + + /** + * Constructs the raw `MultipartBody` using specified body, content type and transfer encoding. + * + * When transfer encoding is specified (typically as Base64), it's caller responsibility to convert body to + * Base64 either by wrapping with `Fn.base64` or by converting it by other converters. + */ + public static fromRawBody(opts: MultipartBodyOptions): MultipartBody { + return new MultipartBodyRaw(opts); + } + + public constructor() { + } + + /** + * Render body part as the string. + * + * Subclasses should not add leading nor trailing new line characters (\r \n) + */ + public abstract renderBodyPart(): string[]; +} + +/** + * The raw part of multi-part user data, which can be added to `MultipartUserData`. + */ +class MultipartBodyRaw extends MultipartBody { + public constructor(private readonly props: MultipartBodyOptions) { + super(); + } + + /** + * Render body part as the string. + */ + public renderBodyPart(): string[] { + const result: string[] = []; + + result.push(`Content-Type: ${this.props.contentType}`); + + if (this.props.transferEncoding != null) { + result.push(`Content-Transfer-Encoding: ${this.props.transferEncoding}`); + } + // One line free after separator + result.push(''); + + if (this.props.body != null) { + result.push(this.props.body); + // The new line added after join will be consumed by encapsulating or closing boundary + } + + return result; + } +} + +/** + * Wrapper for `UserData`. + */ +class MultipartBodyUserDataWrapper extends MultipartBody { + private readonly contentType: string; + + public constructor(private readonly userData: UserData, contentType?: string) { + super(); + + this.contentType = contentType || MultipartBody.SHELL_SCRIPT; + } + + /** + * Render body part as the string. + */ + public renderBodyPart(): string[] { + const result: string[] = []; + + result.push(`Content-Type: ${this.contentType}`); + result.push('Content-Transfer-Encoding: base64'); + result.push(''); + result.push(Fn.base64(this.userData.render())); + + return result; + } +} + +/** + * Options for creating `MultipartUserData` + */ +export interface MultipartUserDataOptions { + /** + * The string used to separate parts in multipart user data archive (it's like MIME boundary). + * + * This string should contain [a-zA-Z0-9()+,-./:=?] characters only, and should not be present in any part, or in text content of archive. + * + * @default `+AWS+CDK+User+Data+Separator==` + */ + readonly partsSeparator?: string; +} + +/** + * Mime multipart user data. + * + * This class represents MIME multipart user data, as described in. + * [Specifying Multiple User Data Blocks Using a MIME Multi Part Archive](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/bootstrap_container_instance.html#multi-part_user_data) + * + */ +export class MultipartUserData extends UserData { + private static readonly USE_PART_ERROR = 'MultipartUserData only supports this operation if it has a default UserData. Call addUserDataPart with makeDefault=true.'; + private static readonly BOUNDRY_PATTERN = '[^a-zA-Z0-9()+,-./:=?]'; + + private parts: MultipartBody[] = []; + + private opts: MultipartUserDataOptions; + + private defaultUserData?: UserData; + + constructor(opts?: MultipartUserDataOptions) { + super(); + + let partsSeparator: string; + + // Validate separator + if (opts?.partsSeparator != null) { + if (new RegExp(MultipartUserData.BOUNDRY_PATTERN).test(opts!.partsSeparator)) { + throw new Error(`Invalid characters in separator. Separator has to match pattern ${MultipartUserData.BOUNDRY_PATTERN}`); + } else { + partsSeparator = opts!.partsSeparator; + } + } else { + partsSeparator = '+AWS+CDK+User+Data+Separator=='; + } + + this.opts = { + partsSeparator: partsSeparator, + }; + } + + /** + * Adds a part to the list of parts. + */ + public addPart(part: MultipartBody) { + this.parts.push(part); + } + + /** + * Adds a multipart part based on a UserData object. + * + * If `makeDefault` is true, then the UserData added by this method + * will also be the target of calls to the `add*Command` methods on + * this MultipartUserData object. + * + * If `makeDefault` is false, then this is the same as calling: + * + * ```ts + * declare const multiPart: ec2.MultipartUserData; + * declare const userData: ec2.UserData; + * declare const contentType: string; + * + * multiPart.addPart(ec2.MultipartBody.fromUserData(userData, contentType)); + * ``` + * + * An undefined `makeDefault` defaults to either: + * - `true` if no default UserData has been set yet; or + * - `false` if there is no default UserData set. + */ + public addUserDataPart(userData: UserData, contentType?: string, makeDefault?: boolean) { + this.addPart(MultipartBody.fromUserData(userData, contentType)); + makeDefault = makeDefault ?? (this.defaultUserData === undefined ? true : false); + if (makeDefault) { + this.defaultUserData = userData; + } + } + + public render(): string { + const boundary = this.opts.partsSeparator; + // Now build final MIME archive - there are few changes from MIME message which are accepted by cloud-init: + // - MIME RFC uses CRLF to separate lines - cloud-init is fine with LF \n only + // Note: new lines matters, matters a lot. + var resultArchive = new Array(); + resultArchive.push(`Content-Type: multipart/mixed; boundary="${boundary}"`); + resultArchive.push('MIME-Version: 1.0'); + + // Add new line, the next one will be boundary (encapsulating or closing) + // so this line will count into it. + resultArchive.push(''); + + // Add parts - each part starts with boundary + this.parts.forEach(part => { + resultArchive.push(`--${boundary}`); + resultArchive.push(...part.renderBodyPart()); + }); + + // Add closing boundary + resultArchive.push(`--${boundary}--`); + resultArchive.push(''); // Force new line at the end + + return resultArchive.join('\n'); + } + + public addS3DownloadCommand(params: S3DownloadOptions): string { + if (this.defaultUserData) { + return this.defaultUserData.addS3DownloadCommand(params); + } else { + throw new Error(MultipartUserData.USE_PART_ERROR); + } + } + + public addExecuteFileCommand(params: ExecuteFileOptions): void { + if (this.defaultUserData) { + this.defaultUserData.addExecuteFileCommand(params); + } else { + throw new Error(MultipartUserData.USE_PART_ERROR); + } + } + + public addSignalOnExitCommand(resource: Resource): void { + if (this.defaultUserData) { + this.defaultUserData.addSignalOnExitCommand(resource); + } else { + throw new Error(MultipartUserData.USE_PART_ERROR); + } + } + + public addCommands(...commands: string[]): void { + if (this.defaultUserData) { + this.defaultUserData.addCommands(...commands); + } else { + throw new Error(MultipartUserData.USE_PART_ERROR); + } + } + + public addOnExitCommands(...commands: string[]): void { + if (this.defaultUserData) { + this.defaultUserData.addOnExitCommands(...commands); + } else { + throw new Error(MultipartUserData.USE_PART_ERROR); + } + } +} diff --git a/packages/@aws-cdk/aws-ec2/lib/util.ts b/packages/aws-cdk-lib/aws-ec2/lib/util.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/util.ts rename to packages/aws-cdk-lib/aws-ec2/lib/util.ts diff --git a/packages/@aws-cdk/aws-ec2/lib/volume.ts b/packages/aws-cdk-lib/aws-ec2/lib/volume.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/volume.ts rename to packages/aws-cdk-lib/aws-ec2/lib/volume.ts index ace264dcd64f5..a49c104e9734a 100644 --- a/packages/@aws-cdk/aws-ec2/lib/volume.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/volume.ts @@ -1,7 +1,7 @@ -import { AccountRootPrincipal, Grant, IGrantable } from '@aws-cdk/aws-iam'; -import { IKey, ViaServicePrincipal } from '@aws-cdk/aws-kms'; -import { IResource, Resource, Size, SizeRoundingBehavior, Stack, Token, Tags, Names, RemovalPolicy } from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; +import { AccountRootPrincipal, Grant, IGrantable } from '../../aws-iam'; +import { IKey, ViaServicePrincipal } from '../../aws-kms'; +import { IResource, Resource, Size, SizeRoundingBehavior, Stack, Token, Tags, Names, RemovalPolicy } from '../../core'; +import { md5hash } from '../../core/lib/helpers-internal'; import { Construct } from 'constructs'; import { CfnVolume } from './ec2.generated'; import { IInstance } from './instance'; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts b/packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint-service.ts similarity index 96% rename from packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts rename to packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint-service.ts index 119f8fdf07d6a..a0e5d9ae59eef 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint-service.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint-service.ts @@ -1,6 +1,6 @@ -import { ArnPrincipal } from '@aws-cdk/aws-iam'; -import { Aws, Fn, IResource, Resource, Stack, Token } from '@aws-cdk/core'; -import { Default, RegionInfo } from '@aws-cdk/region-info'; +import { ArnPrincipal } from '../../aws-iam'; +import { Aws, Fn, IResource, Resource, Stack, Token } from '../../core'; +import { Default, RegionInfo } from '../../region-info'; import { Construct } from 'constructs'; import { CfnVPCEndpointService, CfnVPCEndpointServicePermissions } from './ec2.generated'; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts b/packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts rename to packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.ts index 61ddbea05e5c1..25d875b2b2103 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-endpoint.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/vpc-endpoint.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Aws, ContextProvider, IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cxschema from '../../cloud-assembly-schema'; +import { Aws, ContextProvider, IResource, Lazy, Resource, Stack, Token } from '../../core'; import { Construct } from 'constructs'; import { Connections, IConnectable } from './connections'; import { CfnVPCEndpoint } from './ec2.generated'; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts b/packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts rename to packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts index 07a19033534a1..0e9ecf12ababf 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc-flow-logs.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts @@ -1,8 +1,8 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import { IResource, PhysicalName, RemovalPolicy, Resource, FeatureFlags, Stack, CfnResource } from '@aws-cdk/core'; -import { S3_CREATE_DEFAULT_LOGGING_POLICY } from '@aws-cdk/cx-api'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import { IResource, PhysicalName, RemovalPolicy, Resource, FeatureFlags, Stack, CfnResource } from '../../core'; +import { S3_CREATE_DEFAULT_LOGGING_POLICY } from '../../cx-api'; import { Construct } from 'constructs'; import { CfnFlowLog } from './ec2.generated'; import { ISubnet, IVpc } from './vpc'; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc-lookup.ts b/packages/aws-cdk-lib/aws-ec2/lib/vpc-lookup.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/vpc-lookup.ts rename to packages/aws-cdk-lib/aws-ec2/lib/vpc-lookup.ts diff --git a/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts b/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts new file mode 100644 index 0000000000000..d836a1b4f6bea --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts @@ -0,0 +1,2430 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import { + Arn, Annotations, ContextProvider, + IResource, Lazy, Resource, Stack, Token, Tags, Names, +} from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct, Dependable, DependencyGroup, IConstruct, IDependable, Node } from 'constructs'; +import { ClientVpnEndpoint, ClientVpnEndpointOptions } from './client-vpn-endpoint'; +import { + CfnEIP, CfnInternetGateway, CfnNatGateway, CfnRoute, CfnRouteTable, CfnSubnet, + CfnSubnetRouteTableAssociation, CfnVPC, CfnVPCGatewayAttachment, CfnVPNGatewayRoutePropagation, +} from './ec2.generated'; +import { AllocatedSubnet, IIpAddresses, RequestedSubnet, IpAddresses } from './ip-addresses'; +import { NatProvider } from './nat'; +import { INetworkAcl, NetworkAcl, SubnetNetworkAclAssociation } from './network-acl'; +import { SubnetFilter } from './subnet'; +import { allRouteTableIds, defaultSubnetName, flatten, ImportSubnetGroup, subnetGroupNameFromConstructId, subnetId } from './util'; +import { GatewayVpcEndpoint, GatewayVpcEndpointAwsService, GatewayVpcEndpointOptions, InterfaceVpcEndpoint, InterfaceVpcEndpointOptions } from './vpc-endpoint'; +import { FlowLog, FlowLogOptions, FlowLogResourceType } from './vpc-flow-logs'; +import { VpcLookupOptions } from './vpc-lookup'; +import { EnableVpnGatewayOptions, VpnConnection, VpnConnectionOptions, VpnConnectionType, VpnGateway } from './vpn'; + +const VPC_SUBNET_SYMBOL = Symbol.for('@aws-cdk/aws-ec2.VpcSubnet'); +const FAKE_AZ_NAME = 'fake-az'; + +export interface ISubnet extends IResource { + /** + * The Availability Zone the subnet is located in + */ + readonly availabilityZone: string; + + /** + * The subnetId for this particular subnet + * @attribute + */ + readonly subnetId: string; + + /** + * Dependable that can be depended upon to force internet connectivity established on the VPC + */ + readonly internetConnectivityEstablished: IDependable; + + /** + * The IPv4 CIDR block for this subnet + */ + readonly ipv4CidrBlock: string; + + /** + * The route table for this subnet + */ + readonly routeTable: IRouteTable; + + /** + * Associate a Network ACL with this subnet + * + * @param acl The Network ACL to associate + */ + associateNetworkAcl(id: string, acl: INetworkAcl): void; +} + +/** + * An abstract route table + */ +export interface IRouteTable { + /** + * Route table ID + */ + readonly routeTableId: string; +} + +export interface IVpc extends IResource { + /** + * Identifier for this VPC + * @attribute + */ + readonly vpcId: string; + + /** + * ARN for this VPC + * @attribute + */ + readonly vpcArn: string; + + /** + * CIDR range for this VPC + * + * @attribute + */ + readonly vpcCidrBlock: string; + + /** + * List of public subnets in this VPC + */ + readonly publicSubnets: ISubnet[]; + + /** + * List of private subnets in this VPC + */ + readonly privateSubnets: ISubnet[]; + + /** + * List of isolated subnets in this VPC + */ + readonly isolatedSubnets: ISubnet[]; + + /** + * AZs for this VPC + */ + readonly availabilityZones: string[]; + + /** + * Identifier for the VPN gateway + */ + readonly vpnGatewayId?: string; + + /** + * Dependable that can be depended upon to force internet connectivity established on the VPC + */ + readonly internetConnectivityEstablished: IDependable; + + /** + * Return information on the subnets appropriate for the given selection strategy + * + * Requires that at least one subnet is matched, throws a descriptive + * error message otherwise. + */ + selectSubnets(selection?: SubnetSelection): SelectedSubnets; + + /** + * Adds a VPN Gateway to this VPC + */ + enableVpnGateway(options: EnableVpnGatewayOptions): void; + + /** + * Adds a new VPN connection to this VPC + */ + addVpnConnection(id: string, options: VpnConnectionOptions): VpnConnection; + + /** + * Adds a new client VPN endpoint to this VPC + */ + addClientVpnEndpoint(id: string, options: ClientVpnEndpointOptions): ClientVpnEndpoint; + + /** + * Adds a new gateway endpoint to this VPC + */ + addGatewayEndpoint(id: string, options: GatewayVpcEndpointOptions): GatewayVpcEndpoint + + /** + * Adds a new interface endpoint to this VPC + */ + addInterfaceEndpoint(id: string, options: InterfaceVpcEndpointOptions): InterfaceVpcEndpoint + + /** + * Adds a new Flow Log to this VPC + */ + addFlowLog(id: string, options?: FlowLogOptions): FlowLog +} + +/** + * The type of Subnet + */ +export enum SubnetType { + /** + * Isolated Subnets do not route traffic to the Internet (in this VPC), + * and as such, do not require NAT gateways. + * + * Isolated subnets can only connect to or be connected to from other + * instances in the same VPC. A default VPC configuration will not include + * isolated subnets. + * + * This can be good for subnets with RDS or Elasticache instances, + * or which route Internet traffic through a peer VPC. + */ + PRIVATE_ISOLATED = 'Isolated', + + /** + * Isolated Subnets do not route traffic to the Internet (in this VPC), + * and as such, do not require NAT gateways. + * + * Isolated subnets can only connect to or be connected to from other + * instances in the same VPC. A default VPC configuration will not include + * isolated subnets. + * + * This can be good for subnets with RDS or Elasticache instances, + * or which route Internet traffic through a peer VPC. + * + * @deprecated use `SubnetType.PRIVATE_ISOLATED` + */ + ISOLATED = 'Deprecated_Isolated', + + /** + * Subnet that routes to the internet, but not vice versa. + * + * Instances in a private subnet can connect to the Internet, but will not + * allow connections to be initiated from the Internet. Egress to the internet will + * need to be provided. + * NAT Gateway(s) are the default solution to providing this subnet type the ability to route Internet traffic. + * If a NAT Gateway is not required or desired, set `natGateways:0` or use + * `SubnetType.PRIVATE_ISOLATED` instead. + * + * By default, a NAT gateway is created in every public subnet for maximum availability. + * Be aware that you will be charged for NAT gateways. + * + * Normally a Private subnet will use a NAT gateway in the same AZ, but + * if `natGateways` is used to reduce the number of NAT gateways, a NAT + * gateway from another AZ will be used instead. + */ + PRIVATE_WITH_EGRESS = 'Private', + + /** + * Subnet that routes to the internet (via a NAT gateway), but not vice versa. + * + * Instances in a private subnet can connect to the Internet, but will not + * allow connections to be initiated from the Internet. NAT Gateway(s) are + * required with this subnet type to route the Internet traffic through. + * If a NAT Gateway is not required or desired, use `SubnetType.PRIVATE_ISOLATED` instead. + * + * By default, a NAT gateway is created in every public subnet for maximum availability. + * Be aware that you will be charged for NAT gateways. + * + * Normally a Private subnet will use a NAT gateway in the same AZ, but + * if `natGateways` is used to reduce the number of NAT gateways, a NAT + * gateway from another AZ will be used instead. + * @deprecated use `PRIVATE_WITH_EGRESS` + */ + PRIVATE_WITH_NAT = 'Deprecated_Private_NAT', + + /** + * Subnet that routes to the internet, but not vice versa. + * + * Instances in a private subnet can connect to the Internet, but will not + * allow connections to be initiated from the Internet. NAT Gateway(s) are + * required with this subnet type to route the Internet traffic through. + * If a NAT Gateway is not required or desired, use `SubnetType.PRIVATE_ISOLATED` instead. + * + * By default, a NAT gateway is created in every public subnet for maximum availability. + * Be aware that you will be charged for NAT gateways. + * + * Normally a Private subnet will use a NAT gateway in the same AZ, but + * if `natGateways` is used to reduce the number of NAT gateways, a NAT + * gateway from another AZ will be used instead. + * + * @deprecated use `PRIVATE_WITH_EGRESS` + */ + PRIVATE = 'Deprecated_Private', + + /** + * Subnet connected to the Internet + * + * Instances in a Public subnet can connect to the Internet and can be + * connected to from the Internet as long as they are launched with public + * IPs (controlled on the AutoScalingGroup or other constructs that launch + * instances). + * + * Public subnets route outbound traffic via an Internet Gateway. + */ + PUBLIC = 'Public' +} + +/** + * Customize subnets that are selected for placement of ENIs + * + * Constructs that allow customization of VPC placement use parameters of this + * type to provide placement settings. + * + * By default, the instances are placed in the private subnets. + */ +export interface SubnetSelection { + /** + * Select all subnets of the given type + * + * At most one of `subnetType` and `subnetGroupName` can be supplied. + * + * @default SubnetType.PRIVATE_WITH_EGRESS (or ISOLATED or PUBLIC if there are no PRIVATE_WITH_EGRESS subnets) + */ + readonly subnetType?: SubnetType; + + /** + * Select subnets only in the given AZs. + * + * @default no filtering on AZs is done + */ + readonly availabilityZones?: string[]; + + /** + * Select the subnet group with the given name + * + * Select the subnet group with the given name. This only needs + * to be used if you have multiple subnet groups of the same type + * and you need to distinguish between them. Otherwise, prefer + * `subnetType`. + * + * This field does not select individual subnets, it selects all subnets that + * share the given subnet group name. This is the name supplied in + * `subnetConfiguration`. + * + * At most one of `subnetType` and `subnetGroupName` can be supplied. + * + * @default - Selection by type instead of by name + */ + readonly subnetGroupName?: string; + + /** + * Alias for `subnetGroupName` + * + * Select the subnet group with the given name. This only needs + * to be used if you have multiple subnet groups of the same type + * and you need to distinguish between them. + * + * @deprecated Use `subnetGroupName` instead + */ + readonly subnetName?: string; + + /** + * If true, return at most one subnet per AZ + * + * @default false + */ + readonly onePerAz?: boolean; + + /** + * List of provided subnet filters. + * + * @default - none + */ + readonly subnetFilters?: SubnetFilter[]; + + /** + * Explicitly select individual subnets + * + * Use this if you don't want to automatically use all subnets in + * a group, but have a need to control selection down to + * individual subnets. + * + * Cannot be specified together with `subnetType` or `subnetGroupName`. + * + * @default - Use all subnets in a selected group (all private subnets by default) + */ + readonly subnets?: ISubnet[] +} + +/** + * Result of selecting a subset of subnets from a VPC + */ +export interface SelectedSubnets { + /** + * The subnet IDs + */ + readonly subnetIds: string[]; + + /** + * The respective AZs of each subnet + */ + readonly availabilityZones: string[]; + + /** + * Dependency representing internet connectivity for these subnets + */ + readonly internetConnectivityEstablished: IDependable; + + /** + * Selected subnet objects + */ + readonly subnets: ISubnet[]; + + /** + * Whether any of the given subnets are from the VPC's public subnets. + */ + readonly hasPublic: boolean; + + /** + * The subnet selection is not actually real yet + * + * If this value is true, don't validate anything about the subnets. The count + * or identities are not known yet, and the validation will most likely fail + * which will prevent a successful lookup. + * + * @default false + */ + readonly isPendingLookup?: boolean; +} + +/** + * A new or imported VPC + */ +abstract class VpcBase extends Resource implements IVpc { + + /** + * Identifier for this VPC + */ + public abstract readonly vpcId: string; + + /** + * Arn of this VPC + */ + public abstract readonly vpcArn: string; + + /** + * CIDR range for this VPC + */ + public abstract readonly vpcCidrBlock: string; + + /** + * List of public subnets in this VPC + */ + public abstract readonly publicSubnets: ISubnet[]; + + /** + * List of private subnets in this VPC + */ + public abstract readonly privateSubnets: ISubnet[]; + + /** + * List of isolated subnets in this VPC + */ + public abstract readonly isolatedSubnets: ISubnet[]; + + /** + * AZs for this VPC + */ + public abstract readonly availabilityZones: string[]; + + /** + * Dependencies for internet connectivity + */ + public abstract readonly internetConnectivityEstablished: IDependable; + + /** + * Dependencies for NAT connectivity + * + * @deprecated - This value is no longer used. + */ + protected readonly natDependencies = new Array(); + + /** + * If this is set to true, don't error out on trying to select subnets + */ + protected incompleteSubnetDefinition: boolean = false; + + /** + * Mutable private field for the vpnGatewayId + * + * @internal + */ + protected _vpnGatewayId?: string; + + /** + * Returns IDs of selected subnets + */ + public selectSubnets(selection: SubnetSelection = {}): SelectedSubnets { + const subnets = this.selectSubnetObjects(selection); + const pubs = new Set(this.publicSubnets); + + return { + subnetIds: subnets.map(s => s.subnetId), + get availabilityZones(): string[] { return subnets.map(s => s.availabilityZone); }, + internetConnectivityEstablished: tap(new CompositeDependable(), d => subnets.forEach(s => d.add(s.internetConnectivityEstablished))), + subnets, + hasPublic: subnets.some(s => pubs.has(s)), + isPendingLookup: this.incompleteSubnetDefinition, + }; + } + + /** + * Adds a VPN Gateway to this VPC + */ + public enableVpnGateway(options: EnableVpnGatewayOptions): void { + if (this.vpnGatewayId) { + throw new Error('The VPN Gateway has already been enabled.'); + } + + const vpnGateway = new VpnGateway(this, 'VpnGateway', { + amazonSideAsn: options.amazonSideAsn, + type: VpnConnectionType.IPSEC_1, + }); + + this._vpnGatewayId = vpnGateway.gatewayId; + + const attachment = new CfnVPCGatewayAttachment(this, 'VPCVPNGW', { + vpcId: this.vpcId, + vpnGatewayId: this._vpnGatewayId, + }); + + // Propagate routes on route tables associated with the right subnets + const vpnRoutePropagation = options.vpnRoutePropagation ?? [{}]; + const routeTableIds = allRouteTableIds(flatten(vpnRoutePropagation.map(s => this.selectSubnets(s).subnets))); + + if (routeTableIds.length === 0) { + Annotations.of(this).addError(`enableVpnGateway: no subnets matching selection: '${JSON.stringify(vpnRoutePropagation)}'. Select other subnets to add routes to.`); + } + + const routePropagation = new CfnVPNGatewayRoutePropagation(this, 'RoutePropagation', { + routeTableIds, + vpnGatewayId: this._vpnGatewayId, + }); + // The AWS::EC2::VPNGatewayRoutePropagation resource cannot use the VPN gateway + // until it has successfully attached to the VPC. + // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html + routePropagation.node.addDependency(attachment); + } + + /** + * Adds a new VPN connection to this VPC + */ + public addVpnConnection(id: string, options: VpnConnectionOptions): VpnConnection { + return new VpnConnection(this, id, { + vpc: this, + ...options, + }); + } + + /** + * Adds a new client VPN endpoint to this VPC + */ + public addClientVpnEndpoint(id: string, options: ClientVpnEndpointOptions): ClientVpnEndpoint { + return new ClientVpnEndpoint(this, id, { + ...options, + vpc: this, + }); + } + + /** + * Adds a new interface endpoint to this VPC + */ + public addInterfaceEndpoint(id: string, options: InterfaceVpcEndpointOptions): InterfaceVpcEndpoint { + return new InterfaceVpcEndpoint(this, id, { + vpc: this, + ...options, + }); + } + + /** + * Adds a new gateway endpoint to this VPC + */ + public addGatewayEndpoint(id: string, options: GatewayVpcEndpointOptions): GatewayVpcEndpoint { + return new GatewayVpcEndpoint(this, id, { + vpc: this, + ...options, + }); + } + + /** + * Adds a new flow log to this VPC + */ + public addFlowLog(id: string, options?: FlowLogOptions): FlowLog { + return new FlowLog(this, id, { + resourceType: FlowLogResourceType.fromVpc(this), + ...options, + }); + } + + /** + * Returns the id of the VPN Gateway (if enabled) + */ + public get vpnGatewayId(): string | undefined { + return this._vpnGatewayId; + } + + /** + * Return the subnets appropriate for the placement strategy + */ + protected selectSubnetObjects(selection: SubnetSelection = {}): ISubnet[] { + selection = this.reifySelectionDefaults(selection); + + if (selection.subnets !== undefined) { + return selection.subnets; + } + + let subnets; + + if (selection.subnetGroupName !== undefined) { // Select by name + subnets = this.selectSubnetObjectsByName(selection.subnetGroupName); + + } else { // Or specify by type + const type = selection.subnetType || SubnetType.PRIVATE_WITH_EGRESS; + subnets = this.selectSubnetObjectsByType(type); + } + + // Apply all the filters + subnets = this.applySubnetFilters(subnets, selection.subnetFilters ?? []); + + return subnets; + } + + private applySubnetFilters(subnets: ISubnet[], filters: SubnetFilter[]): ISubnet[] { + let filtered = subnets; + // Apply each filter in sequence + for (const filter of filters) { + filtered = filter.selectSubnets(filtered); + } + return filtered; + } + + private selectSubnetObjectsByName(groupName: string) { + const allSubnets = [...this.publicSubnets, ...this.privateSubnets, ...this.isolatedSubnets]; + const subnets = allSubnets.filter(s => subnetGroupNameFromConstructId(s) === groupName); + + if (subnets.length === 0 && !this.incompleteSubnetDefinition) { + const names = Array.from(new Set(allSubnets.map(subnetGroupNameFromConstructId))); + throw new Error(`There are no subnet groups with name '${groupName}' in this VPC. Available names: ${names}`); + } + + return subnets; + } + + private selectSubnetObjectsByType(subnetType: SubnetType) { + const allSubnets = { + [SubnetType.PRIVATE_ISOLATED]: this.isolatedSubnets, + [SubnetType.ISOLATED]: this.isolatedSubnets, + [SubnetType.PRIVATE_WITH_NAT]: this.privateSubnets, + [SubnetType.PRIVATE_WITH_EGRESS]: this.privateSubnets, + [SubnetType.PRIVATE]: this.privateSubnets, + [SubnetType.PUBLIC]: this.publicSubnets, + }; + + const subnets = allSubnets[subnetType]; + + // Force merge conflict here with https://github.com/aws/aws-cdk/pull/4089 + // see ImportedVpc + + if (subnets.length === 0 && !this.incompleteSubnetDefinition) { + const availableTypes = Object.entries(allSubnets).filter(([_, subs]) => subs.length > 0).map(([typeName, _]) => typeName); + throw new Error(`There are no '${subnetType}' subnet groups in this VPC. Available types: ${availableTypes}`); + } + + return subnets; + } + + /** + * Validate the fields in a SubnetSelection object, and reify defaults if necessary + * + * In case of default selection, select the first type of PRIVATE, ISOLATED, + * PUBLIC (in that order) that has any subnets. + */ + private reifySelectionDefaults(placement: SubnetSelection): SubnetSelection { + + if (placement.subnetName !== undefined) { + if (placement.subnetGroupName !== undefined) { + throw new Error('Please use only \'subnetGroupName\' (\'subnetName\' is deprecated and has the same behavior)'); + } else { + Annotations.of(this).addWarning('Usage of \'subnetName\' in SubnetSelection is deprecated, use \'subnetGroupName\' instead'); + } + placement = { ...placement, subnetGroupName: placement.subnetName }; + } + + const exclusiveSelections: Array = ['subnets', 'subnetType', 'subnetGroupName']; + const providedSelections = exclusiveSelections.filter(key => placement[key] !== undefined); + if (providedSelections.length > 1) { + throw new Error(`Only one of '${providedSelections}' can be supplied to subnet selection.`); + } + + if (placement.subnetType === undefined && placement.subnetGroupName === undefined && placement.subnets === undefined) { + // Return default subnet type based on subnets that actually exist + let subnetType = this.privateSubnets.length + ? SubnetType.PRIVATE_WITH_EGRESS : this.isolatedSubnets.length ? SubnetType.PRIVATE_ISOLATED : SubnetType.PUBLIC; + placement = { ...placement, subnetType: subnetType }; + } + + // Establish which subnet filters are going to be used + let subnetFilters = placement.subnetFilters ?? []; + + // Backwards compatibility with existing `availabilityZones` and `onePerAz` functionality + if (placement.availabilityZones !== undefined) { // Filter by AZs, if specified + subnetFilters.push(SubnetFilter.availabilityZones(placement.availabilityZones)); + } + if (!!placement.onePerAz) { // Ensure one per AZ if specified + subnetFilters.push(SubnetFilter.onePerAz()); + } + + // Overwrite the provided placement filters and remove the availabilityZones and onePerAz properties + placement = { ...placement, subnetFilters: subnetFilters, availabilityZones: undefined, onePerAz: undefined }; + const { availabilityZones, onePerAz, ...rest } = placement; + + return rest; + } +} + +/** + * Properties that reference an external Vpc + */ +export interface VpcAttributes { + /** + * VPC's identifier + */ + readonly vpcId: string; + + /** + * VPC's CIDR range + * + * @default - Retrieving the CIDR from the VPC will fail + */ + readonly vpcCidrBlock?: string; + + /** + * List of availability zones for the subnets in this VPC. + */ + readonly availabilityZones: string[]; + + /** + * List of public subnet IDs + * + * Must be undefined or match the availability zones in length and order. + * + * @default - The VPC does not have any public subnets + */ + readonly publicSubnetIds?: string[]; + + /** + * List of names for the public subnets + * + * Must be undefined or have a name for every public subnet group. + * + * @default - All public subnets will have the name `Public` + */ + readonly publicSubnetNames?: string[]; + + /** + * List of IDs of route tables for the public subnets. + * + * Must be undefined or have a name for every public subnet group. + * + * @default - Retrieving the route table ID of any public subnet will fail + */ + readonly publicSubnetRouteTableIds?: string[]; + + /** + * List of IPv4 CIDR blocks for the public subnets. + * + * Must be undefined or have an entry for every public subnet group. + * + * @default - Retrieving the IPv4 CIDR block of any public subnet will fail + */ + readonly publicSubnetIpv4CidrBlocks?: string[]; + + /** + * List of private subnet IDs + * + * Must be undefined or match the availability zones in length and order. + * + * @default - The VPC does not have any private subnets + */ + readonly privateSubnetIds?: string[]; + + /** + * List of names for the private subnets + * + * Must be undefined or have a name for every private subnet group. + * + * @default - All private subnets will have the name `Private` + */ + readonly privateSubnetNames?: string[]; + + /** + * List of IDs of route tables for the private subnets. + * + * Must be undefined or have a name for every private subnet group. + * + * @default - Retrieving the route table ID of any private subnet will fail + */ + readonly privateSubnetRouteTableIds?: string[]; + + /** + * List of IPv4 CIDR blocks for the private subnets. + * + * Must be undefined or have an entry for every private subnet group. + * + * @default - Retrieving the IPv4 CIDR block of any private subnet will fail + */ + readonly privateSubnetIpv4CidrBlocks?: string[]; + + /** + * List of isolated subnet IDs + * + * Must be undefined or match the availability zones in length and order. + * + * @default - The VPC does not have any isolated subnets + */ + readonly isolatedSubnetIds?: string[]; + + /** + * List of names for the isolated subnets + * + * Must be undefined or have a name for every isolated subnet group. + * + * @default - All isolated subnets will have the name `Isolated` + */ + readonly isolatedSubnetNames?: string[]; + + /** + * List of IDs of route tables for the isolated subnets. + * + * Must be undefined or have a name for every isolated subnet group. + * + * @default - Retrieving the route table ID of any isolated subnet will fail + */ + readonly isolatedSubnetRouteTableIds?: string[]; + + /** + * List of IPv4 CIDR blocks for the isolated subnets. + * + * Must be undefined or have an entry for every isolated subnet group. + * + * @default - Retrieving the IPv4 CIDR block of any isolated subnet will fail + */ + readonly isolatedSubnetIpv4CidrBlocks?: string[]; + + /** + * VPN gateway's identifier + */ + readonly vpnGatewayId?: string; + + /** + * The region the VPC is in + * + * @default - The region of the stack where the VPC belongs to + */ + readonly region?: string; +} + +export interface SubnetAttributes { + + /** + * The Availability Zone the subnet is located in + * + * @default - No AZ information, cannot use AZ selection features + */ + readonly availabilityZone?: string; + + /** + * The IPv4 CIDR block associated with the subnet + * + * @default - No CIDR information, cannot use CIDR filter features + */ + readonly ipv4CidrBlock?: string; + + /** + * The ID of the route table for this particular subnet + * + * @default - No route table information, cannot create VPC endpoints + */ + readonly routeTableId?: string; + + /** + * The subnetId for this particular subnet + */ + readonly subnetId: string; +} + +/** + * Name tag constant + */ +const NAME_TAG: string = 'Name'; + +/** + * Configuration for Vpc + */ +export interface VpcProps { + + /** + * The Provider to use to allocate IP Space to your VPC. + * + * Options include static allocation or from a pool. + * + * @default ec2.IpAddresses.cidr + */ + readonly ipAddresses?: IIpAddresses; + + /** + * The CIDR range to use for the VPC, e.g. '10.0.0.0/16'. + * + * Should be a minimum of /28 and maximum size of /16. The range will be + * split across all subnets per Availability Zone. + * + * @default Vpc.DEFAULT_CIDR_RANGE + * + * @deprecated Use ipAddresses instead + */ + readonly cidr?: string; + + /** + * Indicates whether the instances launched in the VPC get public DNS hostnames. + * + * If this attribute is true, instances in the VPC get public DNS hostnames, + * but only if the enableDnsSupport attribute is also set to true. + * + * @default true + */ + readonly enableDnsHostnames?: boolean; + + /** + * Indicates whether the DNS resolution is supported for the VPC. + * + * If this attribute is false, the Amazon-provided DNS server in the VPC that + * resolves public DNS hostnames to IP addresses is not enabled. If this + * attribute is true, queries to the Amazon provided DNS server at the + * 169.254.169.253 IP address, or the reserved IP address at the base of the + * VPC IPv4 network range plus two will succeed. + * + * @default true + */ + readonly enableDnsSupport?: boolean; + + /** + * The default tenancy of instances launched into the VPC. + * + * By setting this to dedicated tenancy, instances will be launched on + * hardware dedicated to a single AWS customer, unless specifically specified + * at instance launch time. Please note, not all instance types are usable + * with Dedicated tenancy. + * + * @default DefaultInstanceTenancy.Default (shared) tenancy + */ + readonly defaultInstanceTenancy?: DefaultInstanceTenancy; + + /** + * Define the maximum number of AZs to use in this region + * + * If the region has more AZs than you want to use (for example, because of + * EIP limits), pick a lower number here. The AZs will be sorted and picked + * from the start of the list. + * + * If you pick a higher number than the number of AZs in the region, all AZs + * in the region will be selected. To use "all AZs" available to your + * account, use a high number (such as 99). + * + * Be aware that environment-agnostic stacks will be created with access to + * only 2 AZs, so to use more than 2 AZs, be sure to specify the account and + * region on your stack. + * + * Specify this option only if you do not specify `availabilityZones`. + * + * @default 3 + */ + readonly maxAzs?: number; + + /** + * Define the number of AZs to reserve. + * + * When specified, the IP space is reserved for the azs but no actual + * resources are provisioned. + * + * @default 0 + */ + readonly reservedAzs?: number; + + /** + * Availability zones this VPC spans. + * + * Specify this option only if you do not specify `maxAzs`. + * + * @default - a subset of AZs of the stack + */ + readonly availabilityZones?: string[]; + + /** + * The number of NAT Gateways/Instances to create. + * + * The type of NAT gateway or instance will be determined by the + * `natGatewayProvider` parameter. + * + * You can set this number lower than the number of Availability Zones in your + * VPC in order to save on NAT cost. Be aware you may be charged for + * cross-AZ data traffic instead. + * + * @default - One NAT gateway/instance per Availability Zone + */ + readonly natGateways?: number; + + /** + * Configures the subnets which will have NAT Gateways/Instances + * + * You can pick a specific group of subnets by specifying the group name; + * the picked subnets must be public subnets. + * + * Only necessary if you have more than one public subnet group. + * + * @default - All public subnets. + */ + readonly natGatewaySubnets?: SubnetSelection; + + /** + * What type of NAT provider to use + * + * Select between NAT gateways or NAT instances. NAT gateways + * may not be available in all AWS regions. + * + * @default NatProvider.gateway() + * + */ + readonly natGatewayProvider?: NatProvider; + + /** + * Configure the subnets to build for each AZ + * + * Each entry in this list configures a Subnet Group; each group will contain a + * subnet for each Availability Zone. + * + * For example, if you want 1 public subnet, 1 private subnet, and 1 isolated + * subnet in each AZ provide the following: + * + * ```ts + * new ec2.Vpc(this, 'VPC', { + * subnetConfiguration: [ + * { + * cidrMask: 24, + * name: 'ingress', + * subnetType: ec2.SubnetType.PUBLIC, + * }, + * { + * cidrMask: 24, + * name: 'application', + * subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + * }, + * { + * cidrMask: 28, + * name: 'rds', + * subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + * } + * ] + * }); + * ``` + * + * @default - The VPC CIDR will be evenly divided between 1 public and 1 + * private subnet per AZ. + */ + readonly subnetConfiguration?: SubnetConfiguration[]; + + /** + * Indicates whether a VPN gateway should be created and attached to this VPC. + * + * @default - true when vpnGatewayAsn or vpnConnections is specified + */ + readonly vpnGateway?: boolean; + + /** + * The private Autonomous System Number (ASN) for the VPN gateway. + * + * @default - Amazon default ASN. + */ + readonly vpnGatewayAsn?: number; + + /** + * VPN connections to this VPC. + * + * @default - No connections. + */ + readonly vpnConnections?: { [id: string]: VpnConnectionOptions } + + /** + * Where to propagate VPN routes. + * + * @default - On the route tables associated with private subnets. If no + * private subnets exists, isolated subnets are used. If no isolated subnets + * exists, public subnets are used. + */ + readonly vpnRoutePropagation?: SubnetSelection[] + + /** + * Gateway endpoints to add to this VPC. + * + * @default - None. + */ + readonly gatewayEndpoints?: { [id: string]: GatewayVpcEndpointOptions } + + /** + * Flow logs to add to this VPC. + * + * @default - No flow logs. + */ + readonly flowLogs?: { [id: string]: FlowLogOptions } + + /** + * The VPC name. + * + * Since the VPC resource doesn't support providing a physical name, the value provided here will be recorded in the `Name` tag + * + * @default this.node.path + */ + readonly vpcName?: string; +} + +/** + * The default tenancy of instances launched into the VPC. + */ +export enum DefaultInstanceTenancy { + /** + * Instances can be launched with any tenancy. + */ + DEFAULT = 'default', + + /** + * Any instance launched into the VPC automatically has dedicated tenancy, unless you launch it with the default tenancy. + */ + DEDICATED = 'dedicated' +} + +/** + * Specify configuration parameters for a single subnet group in a VPC. + */ +export interface SubnetConfiguration { + /** + * The number of leading 1 bits in the routing mask. + * + * The number of available IP addresses in each subnet of this group + * will be equal to `2^(32 - cidrMask) - 2`. + * + * Valid values are `16--28`. + * + * @default - Available IP space is evenly divided across subnets. + */ + readonly cidrMask?: number; + + /** + * The type of Subnet to configure. + * + * The Subnet type will control the ability to route and connect to the + * Internet. + */ + readonly subnetType: SubnetType; + + /** + * Logical name for the subnet group. + * + * This name can be used when selecting VPC subnets to distinguish + * between different subnet groups of the same type. + */ + readonly name: string; + + /** + * Controls if subnet IP space needs to be reserved. + * + * When true, the IP space for the subnet is reserved but no actual + * resources are provisioned. This space is only dependent on the + * number of availability zones and on `cidrMask` - all other subnet + * properties are ignored. + * + * @default false + */ + readonly reserved?: boolean; + + /** + * Controls if a public IP is associated to an instance at launch + * + * @default true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. + */ + readonly mapPublicIpOnLaunch?: boolean; +} + +/** + * Define an AWS Virtual Private Cloud + * + * See the package-level documentation of this package for an overview + * of the various dimensions in which you can configure your VPC. + * + * For example: + * + * ```ts + * const vpc = new ec2.Vpc(this, 'TheVPC', { + * ipAddresses: IpAddresses.cidr('10.0.0.0/16'), + * }) + * + * // Iterate the private subnets + * const selection = vpc.selectSubnets({ + * subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS + * }); + * + * for (const subnet of selection.subnets) { + * // ... + * } + * ``` + * + * @resource AWS::EC2::VPC + */ +export class Vpc extends VpcBase { + /** + * The default CIDR range used when creating VPCs. + * This can be overridden using VpcProps when creating a VPCNetwork resource. + * e.g. new VpcResource(this, { cidr: '192.168.0.0./16' }) + */ + public static readonly DEFAULT_CIDR_RANGE: string = '10.0.0.0/16'; + + /** + * The default subnet configuration + * + * 1 Public and 1 Private subnet per AZ evenly split + */ + public static readonly DEFAULT_SUBNETS: SubnetConfiguration[] = [ + { + subnetType: SubnetType.PUBLIC, + name: defaultSubnetName(SubnetType.PUBLIC), + }, + { + subnetType: SubnetType.PRIVATE_WITH_EGRESS, + name: defaultSubnetName(SubnetType.PRIVATE_WITH_EGRESS), + }, + ]; + + /** + * The default subnet configuration if natGateways specified to be 0 + * + * 1 Public and 1 Isolated Subnet per AZ evenly split + */ + public static readonly DEFAULT_SUBNETS_NO_NAT: SubnetConfiguration[] = [ + { + subnetType: SubnetType.PUBLIC, + name: defaultSubnetName(SubnetType.PUBLIC), + }, + { + subnetType: SubnetType.PRIVATE_ISOLATED, + name: defaultSubnetName(SubnetType.PRIVATE_ISOLATED), + }, + ]; + + /** + * Import a VPC by supplying all attributes directly + * + * NOTE: using `fromVpcAttributes()` with deploy-time parameters (like a `Fn.importValue()` or + * `CfnParameter` to represent a list of subnet IDs) sometimes accidentally works. It happens + * to work for constructs that need a list of subnets (like `AutoScalingGroup` and `eks.Cluster`) + * but it does not work for constructs that need individual subnets (like + * `Instance`). See https://github.com/aws/aws-cdk/issues/4118 for more + * information. + * + * Prefer to use `Vpc.fromLookup()` instead. + */ + public static fromVpcAttributes(scope: Construct, id: string, attrs: VpcAttributes): IVpc { + return new ImportedVpc(scope, id, attrs, false); + } + + /** + * Import an existing VPC by querying the AWS environment this stack is deployed to. + * + * This function only needs to be used to use VPCs not defined in your CDK + * application. If you are looking to share a VPC between stacks, you can + * pass the `Vpc` object between stacks and use it as normal. + * + * Calling this method will lead to a lookup when the CDK CLI is executed. + * You can therefore not use any values that will only be available at + * CloudFormation execution time (i.e., Tokens). + * + * The VPC information will be cached in `cdk.context.json` and the same VPC + * will be used on future runs. To refresh the lookup, you will have to + * evict the value from the cache using the `cdk context` command. See + * https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information. + */ + public static fromLookup(scope: Construct, id: string, options: VpcLookupOptions): IVpc { + if (Token.isUnresolved(options.vpcId) + || Token.isUnresolved(options.vpcName) + || Object.values(options.tags || {}).some(Token.isUnresolved) + || Object.keys(options.tags || {}).some(Token.isUnresolved)) { + throw new Error('All arguments to Vpc.fromLookup() must be concrete (no Tokens)'); + } + + const filter: {[key: string]: string} = makeTagFilter(options.tags); + + // We give special treatment to some tags + if (options.vpcId) { filter['vpc-id'] = options.vpcId; } + if (options.vpcName) { filter['tag:Name'] = options.vpcName; } + if (options.isDefault !== undefined) { + filter.isDefault = options.isDefault ? 'true' : 'false'; + } + + const overrides: {[key: string]: string} = {}; + if (options.region) { + overrides.region = options.region; + } + + const attributes: cxapi.VpcContextResponse = ContextProvider.getValue(scope, { + provider: cxschema.ContextProvider.VPC_PROVIDER, + props: { + ...overrides, + filter, + returnAsymmetricSubnets: true, + returnVpnGateways: options.returnVpnGateways, + subnetGroupNameTag: options.subnetGroupNameTag, + } as cxschema.VpcContextQuery, + dummyValue: undefined, + }).value; + + return new LookedUpVpc(scope, id, attributes ?? DUMMY_VPC_PROPS, attributes === undefined); + + /** + * Prefixes all keys in the argument with `tag:`.` + */ + function makeTagFilter(tags: { [name: string]: string } | undefined): { [name: string]: string } { + const result: { [name: string]: string } = {}; + for (const [name, value] of Object.entries(tags || {})) { + result[`tag:${name}`] = value; + } + return result; + } + } + + /** + * Identifier for this VPC + */ + public readonly vpcId: string; + + /** + * @attribute + */ + public readonly vpcArn: string; + + /** + * @attribute + */ + public readonly vpcCidrBlock: string; + + /** + * @attribute + */ + public readonly vpcDefaultNetworkAcl: string; + + /** + * @attribute + */ + public readonly vpcCidrBlockAssociations: string[]; + + /** + * @attribute + */ + public readonly vpcDefaultSecurityGroup: string; + + /** + * @attribute + */ + public readonly vpcIpv6CidrBlocks: string[]; + + /** + * List of public subnets in this VPC + */ + public readonly publicSubnets: ISubnet[] = []; + + /** + * List of private subnets in this VPC + */ + public readonly privateSubnets: ISubnet[] = []; + + /** + * List of isolated subnets in this VPC + */ + public readonly isolatedSubnets: ISubnet[] = []; + + /** + * AZs for this VPC + */ + public readonly availabilityZones: string[]; + + /** + * Internet Gateway for the VPC. Note that in case the VPC is configured only + * with ISOLATED subnets, this attribute will be `undefined`. + */ + public readonly internetGatewayId?: string; + + public readonly internetConnectivityEstablished: IDependable; + + /** + * Indicates if instances launched in this VPC will have public DNS hostnames. + */ + public readonly dnsHostnamesEnabled: boolean; + + /** + * Indicates if DNS support is enabled for this VPC. + */ + public readonly dnsSupportEnabled: boolean; + + /** + * The VPC resource + */ + private readonly resource: CfnVPC; + + /** + * The provider of ip addresses + */ + private readonly ipAddresses: IIpAddresses; + + /** + * Subnet configurations for this VPC + */ + private subnetConfiguration: SubnetConfiguration[] = []; + + private readonly _internetConnectivityEstablished = new DependencyGroup(); + + /** + * Vpc creates a VPC that spans a whole region. + * It will automatically divide the provided VPC CIDR range, and create public and private subnets per Availability Zone. + * Network routing for the public subnets will be configured to allow outbound access directly via an Internet Gateway. + * Network routing for the private subnets will be configured to allow outbound access via a set of resilient NAT Gateways (one per AZ). + */ + constructor(scope: Construct, id: string, props: VpcProps = {}) { + super(scope, id); + + const stack = Stack.of(this); + + // Can't have enabledDnsHostnames without enableDnsSupport + if (props.enableDnsHostnames && !props.enableDnsSupport) { + throw new Error('To use DNS Hostnames, DNS Support must be enabled, however, it was explicitly disabled.'); + } + + if (props.availabilityZones && props.maxAzs) { + throw new Error('Vpc supports \'availabilityZones\' or \'maxAzs\', but not both.'); + } + + const cidrBlock = ifUndefined(props.cidr, Vpc.DEFAULT_CIDR_RANGE); + if (Token.isUnresolved(cidrBlock)) { + throw new Error('\'cidr\' property must be a concrete CIDR string, got a Token (we need to parse it for automatic subdivision)'); + } + + if (props.ipAddresses && props.cidr) { + throw new Error('supply at most one of ipAddresses or cidr'); + } + + this.ipAddresses = props.ipAddresses ?? IpAddresses.cidr(cidrBlock); + + this.dnsHostnamesEnabled = props.enableDnsHostnames == null ? true : props.enableDnsHostnames; + this.dnsSupportEnabled = props.enableDnsSupport == null ? true : props.enableDnsSupport; + const instanceTenancy = props.defaultInstanceTenancy || 'default'; + this.internetConnectivityEstablished = this._internetConnectivityEstablished; + + const vpcIpAddressOptions = this.ipAddresses.allocateVpcCidr(); + + // Define a VPC using the provided CIDR range + this.resource = new CfnVPC(this, 'Resource', { + cidrBlock: vpcIpAddressOptions.cidrBlock, + ipv4IpamPoolId: vpcIpAddressOptions.ipv4IpamPoolId, + ipv4NetmaskLength: vpcIpAddressOptions.ipv4NetmaskLength, + enableDnsHostnames: this.dnsHostnamesEnabled, + enableDnsSupport: this.dnsSupportEnabled, + instanceTenancy, + }); + + this.vpcDefaultNetworkAcl = this.resource.attrDefaultNetworkAcl; + this.vpcCidrBlockAssociations = this.resource.attrCidrBlockAssociations; + this.vpcCidrBlock = this.resource.attrCidrBlock; + this.vpcDefaultSecurityGroup = this.resource.attrDefaultSecurityGroup; + this.vpcIpv6CidrBlocks = this.resource.attrIpv6CidrBlocks; + + Tags.of(this).add(NAME_TAG, props.vpcName || this.node.path); + + if (props.availabilityZones) { + // If given AZs and stack AZs are both resolved, then validate their compatibility. + const resolvedStackAzs = stack.availabilityZones.filter(az => !Token.isUnresolved(az)); + const areGivenAzsSubsetOfStack = resolvedStackAzs.length === 0 // stack AZs are tokenized, so we cannot validate it + || props.availabilityZones.every( + az => Token.isUnresolved(az) // given AZ is tokenized, such as in integ tests, so we cannot validate it + || resolvedStackAzs.includes(az)); + if (!areGivenAzsSubsetOfStack) { + throw new Error(`Given VPC 'availabilityZones' ${props.availabilityZones} must be a subset of the stack's availability zones ${stack.availabilityZones}`); + } + this.availabilityZones = props.availabilityZones; + } else { + const maxAZs = props.maxAzs ?? 3; + this.availabilityZones = stack.availabilityZones.slice(0, maxAZs); + } + for (let i = 0; props.reservedAzs && i < props.reservedAzs; i++) { + this.availabilityZones.push(FAKE_AZ_NAME); + } + + + this.vpcId = this.resource.ref; + this.vpcArn = Arn.format({ + service: 'ec2', + resource: 'vpc', + resourceName: this.vpcId, + }, stack); + + const defaultSubnet = props.natGateways === 0 ? Vpc.DEFAULT_SUBNETS_NO_NAT : Vpc.DEFAULT_SUBNETS; + this.subnetConfiguration = ifUndefined(props.subnetConfiguration, defaultSubnet); + + const natGatewayPlacement = props.natGatewaySubnets || { subnetType: SubnetType.PUBLIC }; + const natGatewayCount = determineNatGatewayCount(props.natGateways, this.subnetConfiguration, this.availabilityZones.length); + + // subnetConfiguration must be set before calling createSubnets + this.createSubnets(); + + const allowOutbound = this.subnetConfiguration.filter( + subnet => (subnet.subnetType !== SubnetType.PRIVATE_ISOLATED && subnet.subnetType !== SubnetType.ISOLATED)).length > 0; + + // Create an Internet Gateway and attach it if necessary + if (allowOutbound) { + const igw = new CfnInternetGateway(this, 'IGW', { + }); + + this.internetGatewayId = igw.ref; + + this._internetConnectivityEstablished.add(igw); + const att = new CfnVPCGatewayAttachment(this, 'VPCGW', { + internetGatewayId: igw.ref, + vpcId: this.resource.ref, + }); + + (this.publicSubnets as PublicSubnet[]).forEach(publicSubnet => { + publicSubnet.addDefaultInternetRoute(igw.ref, att); + }); + + // if gateways are needed create them + if (natGatewayCount > 0) { + const provider = props.natGatewayProvider || NatProvider.gateway(); + this.createNatGateways(provider, natGatewayCount, natGatewayPlacement); + } + } + + if (props.vpnGateway && this.publicSubnets.length === 0 && this.privateSubnets.length === 0 && this.isolatedSubnets.length === 0) { + throw new Error('Can not enable the VPN gateway while the VPC has no subnets at all'); + } + + if ((props.vpnConnections || props.vpnGatewayAsn) && props.vpnGateway === false) { + throw new Error('Cannot specify `vpnConnections` or `vpnGatewayAsn` when `vpnGateway` is set to false.'); + } + + if (props.vpnGateway || props.vpnConnections || props.vpnGatewayAsn) { + this.enableVpnGateway({ + amazonSideAsn: props.vpnGatewayAsn, + type: VpnConnectionType.IPSEC_1, + vpnRoutePropagation: props.vpnRoutePropagation, + }); + + const vpnConnections = props.vpnConnections || {}; + for (const [connectionId, connection] of Object.entries(vpnConnections)) { + this.addVpnConnection(connectionId, connection); + } + } + + // Allow creation of gateway endpoints on VPC instantiation as those can be + // immediately functional without further configuration. This is not the case + // for interface endpoints where the security group must be configured. + if (props.gatewayEndpoints) { + const gatewayEndpoints = props.gatewayEndpoints || {}; + for (const [endpointId, endpoint] of Object.entries(gatewayEndpoints)) { + this.addGatewayEndpoint(endpointId, endpoint); + } + } + + // Add flow logs to the VPC + if (props.flowLogs) { + const flowLogs = props.flowLogs || {}; + for (const [flowLogId, flowLog] of Object.entries(flowLogs)) { + this.addFlowLog(flowLogId, flowLog); + } + } + } + + /** + * Adds a new S3 gateway endpoint to this VPC + * + * @deprecated use `addGatewayEndpoint()` instead + */ + public addS3Endpoint(id: string, subnets?: SubnetSelection[]): GatewayVpcEndpoint { + return new GatewayVpcEndpoint(this, id, { + service: GatewayVpcEndpointAwsService.S3, + vpc: this, + subnets, + }); + } + + /** + * Adds a new DynamoDB gateway endpoint to this VPC + * + * @deprecated use `addGatewayEndpoint()` instead + */ + public addDynamoDbEndpoint(id: string, subnets?: SubnetSelection[]): GatewayVpcEndpoint { + return new GatewayVpcEndpoint(this, id, { + service: GatewayVpcEndpointAwsService.DYNAMODB, + vpc: this, + subnets, + }); + } + + private createNatGateways(provider: NatProvider, natCount: number, placement: SubnetSelection): void { + const natSubnets: PublicSubnet[] = this.selectSubnetObjects(placement) as PublicSubnet[]; + for (const sub of natSubnets) { + if (this.publicSubnets.indexOf(sub) === -1) { + throw new Error(`natGatewayPlacement ${placement} contains non public subnet ${sub}`); + } + } + + provider.configureNat({ + vpc: this, + natSubnets: natSubnets.slice(0, natCount), + privateSubnets: this.privateSubnets as PrivateSubnet[], + }); + } + + /** + * createSubnets creates the subnets specified by the subnet configuration + * array or creates the `DEFAULT_SUBNETS` configuration + */ + private createSubnets() { + + const requestedSubnets: RequestedSubnet[] = []; + + this.subnetConfiguration.forEach((configuration)=> ( + this.availabilityZones.forEach((az, index) => { + requestedSubnets.push({ + availabilityZone: az, + subnetConstructId: subnetId(configuration.name, index), + configuration, + }); + }, + ))); + + const { allocatedSubnets } = this.ipAddresses.allocateSubnetsCidr({ + vpcCidr: this.vpcCidrBlock, + requestedSubnets, + }); + + if (allocatedSubnets.length != requestedSubnets.length) { + throw new Error('Incomplete Subnet Allocation; response array dose not equal input array'); + } + + this.createSubnetResources(requestedSubnets, allocatedSubnets); + } + + private createSubnetResources(requestedSubnets: RequestedSubnet[], allocatedSubnets: AllocatedSubnet[]) { + allocatedSubnets.forEach((allocated, i) => { + + const { configuration: subnetConfig, subnetConstructId, availabilityZone } = requestedSubnets[i]; + + if (subnetConfig.reserved === true) { + // For reserved subnets, do not create any resources + return; + } + if (availabilityZone === FAKE_AZ_NAME) { + // For reserved azs, do not create any resources + return; + } + + // mapPublicIpOnLaunch true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. + let mapPublicIpOnLaunch = false; + if (subnetConfig.subnetType !== SubnetType.PUBLIC && subnetConfig.mapPublicIpOnLaunch !== undefined) { + throw new Error(`${subnetConfig.subnetType} subnet cannot include mapPublicIpOnLaunch parameter`); + } + if (subnetConfig.subnetType === SubnetType.PUBLIC) { + mapPublicIpOnLaunch = (subnetConfig.mapPublicIpOnLaunch !== undefined) + ? subnetConfig.mapPublicIpOnLaunch + : true; + } + + const subnetProps: SubnetProps = { + availabilityZone, + vpcId: this.vpcId, + cidrBlock: allocated.cidr, + mapPublicIpOnLaunch: mapPublicIpOnLaunch, + }; + + let subnet: Subnet; + switch (subnetConfig.subnetType) { + case SubnetType.PUBLIC: + const publicSubnet = new PublicSubnet(this, subnetConstructId, subnetProps); + this.publicSubnets.push(publicSubnet); + subnet = publicSubnet; + break; + case SubnetType.PRIVATE_WITH_EGRESS: + case SubnetType.PRIVATE_WITH_NAT: + case SubnetType.PRIVATE: + const privateSubnet = new PrivateSubnet(this, subnetConstructId, subnetProps); + this.privateSubnets.push(privateSubnet); + subnet = privateSubnet; + break; + case SubnetType.PRIVATE_ISOLATED: + case SubnetType.ISOLATED: + const isolatedSubnet = new PrivateSubnet(this, subnetConstructId, subnetProps); + this.isolatedSubnets.push(isolatedSubnet); + subnet = isolatedSubnet; + break; + default: + throw new Error(`Unrecognized subnet type: ${subnetConfig.subnetType}`); + } + + // These values will be used to recover the config upon provider import + const includeResourceTypes = [CfnSubnet.CFN_RESOURCE_TYPE_NAME]; + Tags.of(subnet).add(SUBNETNAME_TAG, subnetConfig.name, { includeResourceTypes }); + Tags.of(subnet).add(SUBNETTYPE_TAG, subnetTypeTagValue(subnetConfig.subnetType), { includeResourceTypes }); + }); + } +} + +const SUBNETTYPE_TAG = 'aws-cdk:subnet-type'; +const SUBNETNAME_TAG = 'aws-cdk:subnet-name'; + +function subnetTypeTagValue(type: SubnetType) { + switch (type) { + case SubnetType.PUBLIC: return 'Public'; + case SubnetType.PRIVATE_WITH_EGRESS: + case SubnetType.PRIVATE_WITH_NAT: + case SubnetType.PRIVATE: + return 'Private'; + case SubnetType.PRIVATE_ISOLATED: + case SubnetType.ISOLATED: + return 'Isolated'; + } +} + +/** + * Specify configuration parameters for a VPC subnet + */ +export interface SubnetProps { + + /** + * The availability zone for the subnet + */ + readonly availabilityZone: string; + + /** + * The VPC which this subnet is part of + */ + readonly vpcId: string; + + /** + * The CIDR notation for this subnet + */ + readonly cidrBlock: string; + + /** + * Controls if a public IP is associated to an instance at launch + * + * @default true in Subnet.Public, false in Subnet.Private or Subnet.Isolated. + */ + readonly mapPublicIpOnLaunch?: boolean; +} + +/** + * Represents a new VPC subnet resource + * + * @resource AWS::EC2::Subnet + */ +export class Subnet extends Resource implements ISubnet { + + public static isVpcSubnet(x: any): x is Subnet { + return VPC_SUBNET_SYMBOL in x; + } + + public static fromSubnetAttributes(scope: Construct, id: string, attrs: SubnetAttributes): ISubnet { + return new ImportedSubnet(scope, id, attrs); + } + + /** + * Import existing subnet from id. + */ + // eslint-disable-next-line @typescript-eslint/no-shadow + public static fromSubnetId(scope: Construct, id: string, subnetId: string): ISubnet { + return this.fromSubnetAttributes(scope, id, { subnetId }); + } + + /** + * The Availability Zone the subnet is located in + */ + public readonly availabilityZone: string; + + /** + * @attribute + */ + public readonly ipv4CidrBlock: string; + + /** + * The subnetId for this particular subnet + */ + public readonly subnetId: string; + + /** + * @attribute + */ + public readonly subnetVpcId: string; + + /** + * @attribute + */ + public readonly subnetAvailabilityZone: string; + + /** + * @attribute + */ + public readonly subnetIpv6CidrBlocks: string[]; + + /** + * The Amazon Resource Name (ARN) of the Outpost for this subnet (if one exists). + * @attribute + */ + public readonly subnetOutpostArn: string; + + /** + * @attribute + */ + public readonly subnetNetworkAclAssociationId: string; + + /** + * Parts of this VPC subnet + */ + public readonly dependencyElements: IDependable[] = []; + + /** + * The routeTableId attached to this subnet. + */ + public readonly routeTable: IRouteTable; + + public readonly internetConnectivityEstablished: IDependable; + + private readonly _internetConnectivityEstablished = new DependencyGroup(); + + private _networkAcl: INetworkAcl; + + constructor(scope: Construct, id: string, props: SubnetProps) { + super(scope, id); + + Object.defineProperty(this, VPC_SUBNET_SYMBOL, { value: true }); + + Tags.of(this).add(NAME_TAG, this.node.path); + + this.availabilityZone = props.availabilityZone; + this.ipv4CidrBlock = props.cidrBlock; + const subnet = new CfnSubnet(this, 'Subnet', { + vpcId: props.vpcId, + cidrBlock: props.cidrBlock, + availabilityZone: props.availabilityZone, + mapPublicIpOnLaunch: props.mapPublicIpOnLaunch, + }); + this.subnetId = subnet.ref; + this.subnetVpcId = subnet.attrVpcId; + this.subnetAvailabilityZone = subnet.attrAvailabilityZone; + this.subnetIpv6CidrBlocks = subnet.attrIpv6CidrBlocks; + this.subnetOutpostArn = subnet.attrOutpostArn; + + // subnet.attrNetworkAclAssociationId is the default ACL after the subnet + // was just created. However, the ACL can be replaced at a later time. + this._networkAcl = NetworkAcl.fromNetworkAclId(this, 'Acl', subnet.attrNetworkAclAssociationId); + this.subnetNetworkAclAssociationId = Lazy.string({ produce: () => this._networkAcl.networkAclId }); + this.node.defaultChild = subnet; + + const table = new CfnRouteTable(this, 'RouteTable', { + vpcId: props.vpcId, + }); + this.routeTable = { routeTableId: table.ref }; + + // Associate the public route table for this subnet, to this subnet + const routeAssoc = new CfnSubnetRouteTableAssociation(this, 'RouteTableAssociation', { + subnetId: this.subnetId, + routeTableId: table.ref, + }); + this._internetConnectivityEstablished.add(routeAssoc); + + this.internetConnectivityEstablished = this._internetConnectivityEstablished; + } + + /** + * Create a default route that points to a passed IGW, with a dependency + * on the IGW's attachment to the VPC. + * + * @param gatewayId the logical ID (ref) of the gateway attached to your VPC + * @param gatewayAttachment the gateway attachment construct to be added as a dependency + */ + public addDefaultInternetRoute(gatewayId: string, gatewayAttachment: IDependable) { + const route = new CfnRoute(this, 'DefaultRoute', { + routeTableId: this.routeTable.routeTableId, + destinationCidrBlock: '0.0.0.0/0', + gatewayId, + }); + route.node.addDependency(gatewayAttachment); + + // Since the 'route' depends on the gateway attachment, just + // depending on the route is enough. + this._internetConnectivityEstablished.add(route); + } + + /** + * Network ACL associated with this Subnet + * + * Upon creation, this is the default ACL which allows all traffic, except + * explicit DENY entries that you add. + * + * You can replace it with a custom ACL which denies all traffic except + * the explicit ALLOW entries that you add by creating a `NetworkAcl` + * object and calling `associateNetworkAcl()`. + */ + public get networkAcl(): INetworkAcl { + return this._networkAcl; + } + + /** + * Adds an entry to this subnets route table that points to the passed NATGatewayId + * @param natGatewayId The ID of the NAT gateway + */ + public addDefaultNatRoute(natGatewayId: string) { + this.addRoute('DefaultRoute', { + routerType: RouterType.NAT_GATEWAY, + routerId: natGatewayId, + enablesInternetConnectivity: true, + }); + } + + /** + * Adds an entry to this subnets route table + */ + public addRoute(id: string, options: AddRouteOptions) { + if (options.destinationCidrBlock && options.destinationIpv6CidrBlock) { + throw new Error('Cannot specify both \'destinationCidrBlock\' and \'destinationIpv6CidrBlock\''); + } + + const route = new CfnRoute(this, id, { + routeTableId: this.routeTable.routeTableId, + destinationCidrBlock: options.destinationCidrBlock || (options.destinationIpv6CidrBlock === undefined ? '0.0.0.0/0' : undefined), + destinationIpv6CidrBlock: options.destinationIpv6CidrBlock, + [routerTypeToPropName(options.routerType)]: options.routerId, + }); + + if (options.enablesInternetConnectivity) { + this._internetConnectivityEstablished.add(route); + } + } + + public associateNetworkAcl(id: string, networkAcl: INetworkAcl) { + this._networkAcl = networkAcl; + + const scope = networkAcl instanceof Construct ? networkAcl : this; + const other = networkAcl instanceof Construct ? this : networkAcl; + new SubnetNetworkAclAssociation(scope, id + Names.nodeUniqueId(other.node), { + networkAcl, + subnet: this, + }); + } +} + +/** + * Options for adding a new route to a subnet + */ +export interface AddRouteOptions { + /** + * IPv4 range this route applies to + * + * @default '0.0.0.0/0' + */ + readonly destinationCidrBlock?: string; + + /** + * IPv6 range this route applies to + * + * @default - Uses IPv6 + */ + readonly destinationIpv6CidrBlock?: string; + + /** + * What type of router to route this traffic to + */ + readonly routerType: RouterType; + + /** + * The ID of the router + * + * Can be an instance ID, gateway ID, etc, depending on the router type. + */ + readonly routerId: string; + + /** + * Whether this route will enable internet connectivity + * + * If true, this route will be added before any AWS resources that depend + * on internet connectivity in the VPC will be created. + * + * @default false + */ + readonly enablesInternetConnectivity?: boolean; +} + +/** + * Type of router used in route + */ +export enum RouterType { + /** + * Carrier gateway + */ + CARRIER_GATEWAY = 'CarrierGateway', + + /** + * Egress-only Internet Gateway + */ + EGRESS_ONLY_INTERNET_GATEWAY = 'EgressOnlyInternetGateway', + + /** + * Internet Gateway + */ + GATEWAY = 'Gateway', + + /** + * Instance + */ + INSTANCE = 'Instance', + + /** + * Local Gateway + */ + LOCAL_GATEWAY = 'LocalGateway', + + /** + * NAT Gateway + */ + NAT_GATEWAY = 'NatGateway', + + /** + * Network Interface + */ + NETWORK_INTERFACE = 'NetworkInterface', + + /** + * Transit Gateway + */ + TRANSIT_GATEWAY = 'TransitGateway', + + /** + * VPC peering connection + */ + VPC_PEERING_CONNECTION = 'VpcPeeringConnection', + + /** + * VPC Endpoint for gateway load balancers + */ + VPC_ENDPOINT = 'VpcEndpoint', +} + +function routerTypeToPropName(routerType: RouterType) { + return ({ + [RouterType.CARRIER_GATEWAY]: 'carrierGatewayId', + [RouterType.EGRESS_ONLY_INTERNET_GATEWAY]: 'egressOnlyInternetGatewayId', + [RouterType.GATEWAY]: 'gatewayId', + [RouterType.INSTANCE]: 'instanceId', + [RouterType.LOCAL_GATEWAY]: 'localGatewayId', + [RouterType.NAT_GATEWAY]: 'natGatewayId', + [RouterType.NETWORK_INTERFACE]: 'networkInterfaceId', + [RouterType.TRANSIT_GATEWAY]: 'transitGatewayId', + [RouterType.VPC_PEERING_CONNECTION]: 'vpcPeeringConnectionId', + [RouterType.VPC_ENDPOINT]: 'vpcEndpointId', + })[routerType]; +} + +export interface PublicSubnetProps extends SubnetProps { + +} + +export interface IPublicSubnet extends ISubnet { } + +export interface PublicSubnetAttributes extends SubnetAttributes { } + +/** + * Represents a public VPC subnet resource + */ +export class PublicSubnet extends Subnet implements IPublicSubnet { + + public static fromPublicSubnetAttributes(scope: Construct, id: string, attrs: PublicSubnetAttributes): IPublicSubnet { + return new ImportedSubnet(scope, id, attrs); + } + + constructor(scope: Construct, id: string, props: PublicSubnetProps) { + super(scope, id, props); + } + + /** + * Creates a new managed NAT gateway attached to this public subnet. + * Also adds the EIP for the managed NAT. + * @returns A ref to the the NAT Gateway ID + */ + public addNatGateway(eipAllocationId?: string) { + // Create a NAT Gateway in this public subnet + const ngw = new CfnNatGateway(this, 'NATGateway', { + subnetId: this.subnetId, + allocationId: eipAllocationId ?? new CfnEIP(this, 'EIP', { + domain: 'vpc', + }).attrAllocationId, + }); + ngw.node.addDependency(this.internetConnectivityEstablished); + return ngw; + } +} + +export interface PrivateSubnetProps extends SubnetProps { + +} + +export interface IPrivateSubnet extends ISubnet { } + +export interface PrivateSubnetAttributes extends SubnetAttributes { } + +/** + * Represents a private VPC subnet resource + */ +export class PrivateSubnet extends Subnet implements IPrivateSubnet { + + public static fromPrivateSubnetAttributes(scope: Construct, id: string, attrs: PrivateSubnetAttributes): IPrivateSubnet { + return new ImportedSubnet(scope, id, attrs); + } + + constructor(scope: Construct, id: string, props: PrivateSubnetProps) { + super(scope, id, props); + } +} + +function ifUndefined(value: T | undefined, defaultValue: T): T { + return value ?? defaultValue; +} + +class ImportedVpc extends VpcBase { + public readonly vpcId: string; + public readonly vpcArn: string; + public readonly publicSubnets: ISubnet[]; + public readonly privateSubnets: ISubnet[]; + public readonly isolatedSubnets: ISubnet[]; + public readonly availabilityZones: string[]; + public readonly internetConnectivityEstablished: IDependable = new DependencyGroup(); + private readonly cidr?: string | undefined; + + constructor(scope: Construct, id: string, props: VpcAttributes, isIncomplete: boolean) { + super(scope, id, { + region: props.region, + }); + + this.vpcId = props.vpcId; + this.vpcArn = Arn.format({ + service: 'ec2', + resource: 'vpc', + resourceName: this.vpcId, + }, Stack.of(this)); + this.cidr = props.vpcCidrBlock; + this.availabilityZones = props.availabilityZones; + this._vpnGatewayId = props.vpnGatewayId; + this.incompleteSubnetDefinition = isIncomplete; + + // None of the values may be unresolved list tokens + for (const k of Object.keys(props) as Array) { + if (Array.isArray(props[k]) && Token.isUnresolved(props[k])) { + Annotations.of(this).addWarning(`fromVpcAttributes: '${k}' is a list token: the imported VPC will not work with constructs that require a list of subnets at synthesis time. Use 'Vpc.fromLookup()' or 'Fn.importListValue' instead.`); + } + } + + /* eslint-disable max-len */ + const pub = new ImportSubnetGroup(props.publicSubnetIds, props.publicSubnetNames, props.publicSubnetRouteTableIds, props.publicSubnetIpv4CidrBlocks, SubnetType.PUBLIC, this.availabilityZones, 'publicSubnetIds', 'publicSubnetNames', 'publicSubnetRouteTableIds', 'publicSubnetIpv4CidrBlocks'); + const priv = new ImportSubnetGroup(props.privateSubnetIds, props.privateSubnetNames, props.privateSubnetRouteTableIds, props.privateSubnetIpv4CidrBlocks, SubnetType.PRIVATE_WITH_EGRESS, this.availabilityZones, 'privateSubnetIds', 'privateSubnetNames', 'privateSubnetRouteTableIds', 'privateSubnetIpv4CidrBlocks'); + const iso = new ImportSubnetGroup(props.isolatedSubnetIds, props.isolatedSubnetNames, props.isolatedSubnetRouteTableIds, props.isolatedSubnetIpv4CidrBlocks, SubnetType.PRIVATE_ISOLATED, this.availabilityZones, 'isolatedSubnetIds', 'isolatedSubnetNames', 'isolatedSubnetRouteTableIds', 'isolatedSubnetIpv4CidrBlocks'); + /* eslint-enable max-len */ + + this.publicSubnets = pub.import(this); + this.privateSubnets = priv.import(this); + this.isolatedSubnets = iso.import(this); + } + + public get vpcCidrBlock(): string { + if (this.cidr === undefined) { + throw new Error('Cannot perform this operation: \'vpcCidrBlock\' was not supplied when creating this VPC'); + } + return this.cidr; + } +} + +class LookedUpVpc extends VpcBase { + public readonly vpcId: string; + public readonly vpcArn: string; + public readonly internetConnectivityEstablished: IDependable = new DependencyGroup(); + public readonly availabilityZones: string[]; + public readonly publicSubnets: ISubnet[]; + public readonly privateSubnets: ISubnet[]; + public readonly isolatedSubnets: ISubnet[]; + private readonly cidr?: string | undefined; + + constructor(scope: Construct, id: string, props: cxapi.VpcContextResponse, isIncomplete: boolean) { + super(scope, id, { + region: props.region, + }); + + this.vpcId = props.vpcId; + this.vpcArn = Arn.format({ + service: 'ec2', + resource: 'vpc', + resourceName: this.vpcId, + }, Stack.of(this)); + this.cidr = props.vpcCidrBlock; + this._vpnGatewayId = props.vpnGatewayId; + this.incompleteSubnetDefinition = isIncomplete; + + const subnetGroups = props.subnetGroups || []; + const availabilityZones = Array.from(new Set(flatMap(subnetGroups, subnetGroup => { + return subnetGroup.subnets.map(subnet => subnet.availabilityZone); + }))); + availabilityZones.sort((az1, az2) => az1.localeCompare(az2)); + this.availabilityZones = availabilityZones; + + this.publicSubnets = this.extractSubnetsOfType(subnetGroups, cxapi.VpcSubnetGroupType.PUBLIC); + this.privateSubnets = this.extractSubnetsOfType(subnetGroups, cxapi.VpcSubnetGroupType.PRIVATE); + this.isolatedSubnets = this.extractSubnetsOfType(subnetGroups, cxapi.VpcSubnetGroupType.ISOLATED); + } + + public get vpcCidrBlock(): string { + if (this.cidr === undefined) { + // Value might be cached from an old CLI version, so bumping the CX API protocol to + // force the value to exist would not have helped. + throw new Error('Cannot perform this operation: \'vpcCidrBlock\' was not found when looking up this VPC. Use a newer version of the CDK CLI and clear the old context value.'); + } + return this.cidr; + } + + private extractSubnetsOfType(subnetGroups: cxapi.VpcSubnetGroup[], subnetGroupType: cxapi.VpcSubnetGroupType): ISubnet[] { + return flatMap(subnetGroups.filter(subnetGroup => subnetGroup.type === subnetGroupType), + subnetGroup => this.subnetGroupToSubnets(subnetGroup)); + } + + private subnetGroupToSubnets(subnetGroup: cxapi.VpcSubnetGroup): ISubnet[] { + const ret = new Array(); + for (let i = 0; i < subnetGroup.subnets.length; i++) { + const vpcSubnet = subnetGroup.subnets[i]; + ret.push(Subnet.fromSubnetAttributes(this, `${subnetGroup.name}Subnet${i + 1}`, { + availabilityZone: vpcSubnet.availabilityZone, + subnetId: vpcSubnet.subnetId, + routeTableId: vpcSubnet.routeTableId, + ipv4CidrBlock: vpcSubnet.cidr, + })); + } + return ret; + } +} + +function flatMap(xs: T[], fn: (x: T) => U[]): U[] { + const ret = new Array(); + for (const x of xs) { + ret.push(...fn(x)); + } + return ret; +} + +class CompositeDependable implements IDependable { + private readonly dependables = new Array(); + + constructor() { + const self = this; + Dependable.implement(this, { + get dependencyRoots() { + const ret = new Array(); + for (const dep of self.dependables) { + ret.push(...Dependable.of(dep).dependencyRoots); + } + return ret; + }, + }); + } + + /** + * Add a construct to the dependency roots + */ + public add(dep: IDependable) { + this.dependables.push(dep); + } +} + +/** + * Invoke a function on a value (for its side effect) and return the value + */ +function tap(x: T, fn: (x: T) => void): T { + fn(x); + return x; +} + +class ImportedSubnet extends Resource implements ISubnet, IPublicSubnet, IPrivateSubnet { + public readonly internetConnectivityEstablished: IDependable = new DependencyGroup(); + public readonly subnetId: string; + public readonly routeTable: IRouteTable; + private readonly _availabilityZone?: string; + private readonly _ipv4CidrBlock?: string; + + constructor(scope: Construct, id: string, attrs: SubnetAttributes) { + super(scope, id); + + if (!attrs.routeTableId) { + // The following looks a little weird, but comes down to: + // + // * Is the subnetId itself unresolved ({ Ref: Subnet }); or + // * Was it the accidentally extracted first element of a list-encoded + // token? ({ Fn::ImportValue: Subnets } => ['#{Token[1234]}'] => + // '#{Token[1234]}' + // + // There's no other API to test for the second case than to the string back into + // a list and see if the combination is Unresolved. + // + // In both cases we can't output the subnetId literally into the metadata (because it'll + // be useless). In the 2nd case even, if we output it to metadata, the `resolve()` call + // that gets done on the metadata will even `throw`, because the '#{Token}' value will + // occur in an illegal position (not in a list context). + const ref = Token.isUnresolved(attrs.subnetId) || Token.isUnresolved([attrs.subnetId]) + ? `at '${Node.of(scope).path}/${id}'` + : `'${attrs.subnetId}'`; + // eslint-disable-next-line max-len + Annotations.of(this).addWarning(`No routeTableId was provided to the subnet ${ref}. Attempting to read its .routeTable.routeTableId will return null/undefined. (More info: https://github.com/aws/aws-cdk/pull/3171)`); + } + + this._ipv4CidrBlock = attrs.ipv4CidrBlock; + this._availabilityZone = attrs.availabilityZone; + this.subnetId = attrs.subnetId; + this.routeTable = { + // Forcing routeTableId to pretend non-null to maintain backwards-compatibility. See https://github.com/aws/aws-cdk/pull/3171 + routeTableId: attrs.routeTableId!, + }; + } + + public get availabilityZone(): string { + if (!this._availabilityZone) { + // eslint-disable-next-line max-len + throw new Error('You cannot reference a Subnet\'s availability zone if it was not supplied. Add the availabilityZone when importing using Subnet.fromSubnetAttributes()'); + } + return this._availabilityZone; + } + + public get ipv4CidrBlock(): string { + if (!this._ipv4CidrBlock) { + // tslint:disable-next-line: max-line-length + throw new Error('You cannot reference an imported Subnet\'s IPv4 CIDR if it was not supplied. Add the ipv4CidrBlock when importing using Subnet.fromSubnetAttributes()'); + } + return this._ipv4CidrBlock; + } + + public associateNetworkAcl(id: string, networkAcl: INetworkAcl): void { + const scope = networkAcl instanceof Construct ? networkAcl : this; + const other = networkAcl instanceof Construct ? this : networkAcl; + new SubnetNetworkAclAssociation(scope, id + Names.nodeUniqueId(other.node), { + networkAcl, + subnet: this, + }); + } +} + +/** + * Determine (and validate) the NAT gateway count w.r.t. the rest of the subnet configuration + * + * We have the following requirements: + * + * - NatGatewayCount = 0 ==> there are no private subnets + * - NatGatewayCount > 0 ==> there must be public subnets + * + * Do we want to require that there are private subnets if there are NatGateways? + * They seem pointless but I see no reason to prevent it. + */ +function determineNatGatewayCount(requestedCount: number | undefined, subnetConfig: SubnetConfiguration[], azCount: number) { + const hasPrivateSubnets = subnetConfig.some(c => (c.subnetType === SubnetType.PRIVATE_WITH_EGRESS + || c.subnetType === SubnetType.PRIVATE || c.subnetType === SubnetType.PRIVATE_WITH_NAT) && !c.reserved); + const hasPublicSubnets = subnetConfig.some(c => c.subnetType === SubnetType.PUBLIC); + const hasCustomEgress = subnetConfig.some(c => c.subnetType === SubnetType.PRIVATE_WITH_EGRESS); + + const count = requestedCount !== undefined ? Math.min(requestedCount, azCount) : (hasPrivateSubnets ? azCount : 0); + + if (count === 0 && hasPrivateSubnets && !hasCustomEgress) { + // eslint-disable-next-line max-len + throw new Error('If you do not want NAT gateways (natGateways=0), make sure you don\'t configure any PRIVATE(_WITH_NAT) subnets in \'subnetConfiguration\' (make them PUBLIC or ISOLATED instead)'); + } + + if (count > 0 && !hasPublicSubnets) { + // eslint-disable-next-line max-len + throw new Error(`If you configure PRIVATE subnets in 'subnetConfiguration', you must also configure PUBLIC subnets to put the NAT gateways into (got ${JSON.stringify(subnetConfig)}.`); + } + + return count; +} + +/** + * There are returned when the provider has not supplied props yet + * + * It's only used for testing and on the first run-through. + */ +const DUMMY_VPC_PROPS: cxapi.VpcContextResponse = { + availabilityZones: [], + vpcCidrBlock: '1.2.3.4/5', + isolatedSubnetIds: undefined, + isolatedSubnetNames: undefined, + isolatedSubnetRouteTableIds: undefined, + privateSubnetIds: undefined, + privateSubnetNames: undefined, + privateSubnetRouteTableIds: undefined, + publicSubnetIds: undefined, + publicSubnetNames: undefined, + publicSubnetRouteTableIds: undefined, + subnetGroups: [ + { + name: 'Public', + type: cxapi.VpcSubnetGroupType.PUBLIC, + subnets: [ + { + availabilityZone: 'dummy1a', + subnetId: 's-12345', + routeTableId: 'rtb-12345s', + cidr: '1.2.3.4/5', + }, + { + availabilityZone: 'dummy1b', + subnetId: 's-67890', + routeTableId: 'rtb-67890s', + cidr: '1.2.3.4/5', + }, + ], + }, + { + name: 'Private', + type: cxapi.VpcSubnetGroupType.PRIVATE, + subnets: [ + { + availabilityZone: 'dummy1a', + subnetId: 'p-12345', + routeTableId: 'rtb-12345p', + cidr: '1.2.3.4/5', + }, + { + availabilityZone: 'dummy1b', + subnetId: 'p-67890', + routeTableId: 'rtb-57890p', + cidr: '1.2.3.4/5', + }, + ], + }, + { + name: 'Isolated', + type: cxapi.VpcSubnetGroupType.ISOLATED, + subnets: [ + { + availabilityZone: 'dummy1a', + subnetId: 'p-12345', + routeTableId: 'rtb-12345p', + cidr: '1.2.3.4/5', + }, + { + availabilityZone: 'dummy1b', + subnetId: 'p-67890', + routeTableId: 'rtb-57890p', + cidr: '1.2.3.4/5', + }, + ], + }, + ], + vpcId: 'vpc-12345', +}; diff --git a/packages/@aws-cdk/aws-ec2/lib/vpn.ts b/packages/aws-cdk-lib/aws-ec2/lib/vpn.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/lib/vpn.ts rename to packages/aws-cdk-lib/aws-ec2/lib/vpn.ts index 0f159da3ea56f..cfaa5b5aea9a8 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpn.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/vpn.ts @@ -1,6 +1,6 @@ import * as net from 'net'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { IResource, Resource, SecretValue, Token } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { IResource, Resource, SecretValue, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnCustomerGateway, diff --git a/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts b/packages/aws-cdk-lib/aws-ec2/lib/windows-versions.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/lib/windows-versions.ts rename to packages/aws-cdk-lib/aws-ec2/lib/windows-versions.ts diff --git a/packages/aws-cdk-lib/aws-ec2/test/aspects/require-imdsv2-aspect.test.ts b/packages/aws-cdk-lib/aws-ec2/test/aspects/require-imdsv2-aspect.test.ts new file mode 100644 index 0000000000000..7bf08f8ec7dc7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/aspects/require-imdsv2-aspect.test.ts @@ -0,0 +1,209 @@ +import { Annotations, Template, Match } from '../../../assertions'; +import * as cdk from '../../../core'; +import { Construct } from 'constructs'; +import { + CfnLaunchTemplate, + Instance, + InstanceRequireImdsv2Aspect, + InstanceType, + LaunchTemplate, + LaunchTemplateRequireImdsv2Aspect, + MachineImage, + Vpc, +} from '../../lib'; + +describe('RequireImdsv2Aspect', () => { + let app: cdk.App; + let stack: cdk.Stack; + let vpc: Vpc; + + beforeEach(() => { + app = new cdk.App(); + stack = new cdk.Stack(app, 'Stack'); + vpc = new Vpc(stack, 'Vpc'); + }); + + test('suppresses warnings', () => { + // GIVEN + const aspect = new LaunchTemplateRequireImdsv2Aspect({ + suppressWarnings: true, + }); + const errmsg = 'ERROR'; + const visitMock = jest.spyOn(aspect, 'visit').mockImplementation((node) => { + // @ts-ignore + aspect.warn(node, errmsg); + }); + const construct = new Construct(stack, 'Construct'); + + // WHEN + aspect.visit(construct); + + // THEN + expect(visitMock).toHaveBeenCalled(); + Annotations.fromStack(stack).hasNoWarning('/Stack/Construct', errmsg); + }); + + describe('InstanceRequireImdsv2Aspect', () => { + test('requires IMDSv2', () => { + // GIVEN + const instance = new Instance(stack, 'Instance', { + vpc, + instanceType: new InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }); + const aspect = new InstanceRequireImdsv2Aspect(); + + // WHEN + cdk.Aspects.of(stack).add(aspect); + app.synth(); + + // THEN + const launchTemplate = instance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; + expect(launchTemplate).toBeDefined(); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::LaunchTemplate', { + LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), + LaunchTemplateData: { + MetadataOptions: { + HttpTokens: 'required', + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + LaunchTemplate: { + LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), + }, + }); + }); + + test('does not toggle when Instance has a LaunchTemplate', () => { + // GIVEN + const instance = new Instance(stack, 'Instance', { + vpc, + instanceType: new InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }); + instance.instance.launchTemplate = { + launchTemplateName: 'name', + version: 'version', + }; + const aspect = new InstanceRequireImdsv2Aspect(); + + // WHEN + cdk.Aspects.of(stack).add(aspect); + + // THEN + // Aspect normally creates a LaunchTemplate for the Instance to toggle IMDSv1, + // so we can assert that one was not created + Template.fromStack(stack).resourceCountIs('AWS::EC2::LaunchTemplate', 0); + Annotations.fromStack(stack).hasWarning('/Stack/Instance', Match.stringLikeRegexp('.*Cannot toggle IMDSv1 because this Instance is associated with an existing Launch Template.')); + }); + + test('suppresses Launch Template warnings', () => { + // GIVEN + const instance = new Instance(stack, 'Instance', { + vpc, + instanceType: new InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }); + instance.instance.launchTemplate = { + launchTemplateName: 'name', + version: 'version', + }; + const aspect = new InstanceRequireImdsv2Aspect({ + suppressLaunchTemplateWarning: true, + }); + + // WHEN + aspect.visit(instance); + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Stack/Instance', 'Cannot toggle IMDSv1 because this Instance is associated with an existing Launch Template.'); + }); + + test('launch template name is unique with feature flag', () => { + // GIVEN + const app2 = new cdk.App(); + const otherStack = new cdk.Stack(app2, 'OtherStack'); + const otherVpc = new Vpc(otherStack, 'OtherVpc'); + const otherInstance = new Instance(otherStack, 'OtherInstance', { + vpc: otherVpc, + instanceType: new InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }); + const imdsv2Stack = new cdk.Stack(app2, 'RequireImdsv2Stack'); + const imdsv2Vpc = new Vpc(imdsv2Stack, 'Vpc'); + const instance = new Instance(imdsv2Stack, 'Instance', { + vpc: imdsv2Vpc, + instanceType: new InstanceType('t2.micro'), + machineImage: MachineImage.latestAmazonLinux(), + }); + const aspect = new InstanceRequireImdsv2Aspect(); + + // WHEN + cdk.Aspects.of(imdsv2Stack).add(aspect); + cdk.Aspects.of(otherStack).add(aspect); + app2.synth(); + + // THEN + const launchTemplate = instance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; + const otherLaunchTemplate = otherInstance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; + expect(launchTemplate).toBeDefined(); + expect(otherLaunchTemplate).toBeDefined(); + expect(launchTemplate.launchTemplateName !== otherLaunchTemplate.launchTemplateName); + }); + }); + + describe('LaunchTemplateRequireImdsv2Aspect', () => { + test('warns when LaunchTemplateData is a CDK token', () => { + // GIVEN + const launchTemplate = new LaunchTemplate(stack, 'LaunchTemplate'); + const cfnLaunchTemplate = launchTemplate.node.tryFindChild('Resource') as CfnLaunchTemplate; + cfnLaunchTemplate.launchTemplateData = cdk.Token.asAny({ + kernelId: 'asfd', + } as CfnLaunchTemplate.LaunchTemplateDataProperty); + const aspect = new LaunchTemplateRequireImdsv2Aspect(); + + // WHEN + aspect.visit(launchTemplate); + + // THEN + Annotations.fromStack(stack).hasWarning('/Stack/LaunchTemplate', Match.stringLikeRegexp('.*LaunchTemplateData is a CDK token.')); + }); + + test('warns when MetadataOptions is a CDK token', () => { + // GIVEN + const launchTemplate = new LaunchTemplate(stack, 'LaunchTemplate'); + const cfnLaunchTemplate = launchTemplate.node.tryFindChild('Resource') as CfnLaunchTemplate; + cfnLaunchTemplate.launchTemplateData = { + metadataOptions: cdk.Token.asAny({ + httpEndpoint: 'http://bla', + } as CfnLaunchTemplate.MetadataOptionsProperty), + } as CfnLaunchTemplate.LaunchTemplateDataProperty; + const aspect = new LaunchTemplateRequireImdsv2Aspect(); + + // WHEN + aspect.visit(launchTemplate); + + // THEN + Annotations.fromStack(stack).hasWarning('/Stack/LaunchTemplate', Match.stringLikeRegexp('.*LaunchTemplateData.MetadataOptions is a CDK token.')); + }); + + test('requires IMDSv2', () => { + // GIVEN + new LaunchTemplate(stack, 'LaunchTemplate'); + const aspect = new LaunchTemplateRequireImdsv2Aspect(); + + // WHEN + cdk.Aspects.of(stack).add(aspect); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::LaunchTemplate', { + LaunchTemplateData: { + MetadataOptions: { + HttpTokens: 'required', + }, + }, + }); + }); + }); +}); diff --git a/packages/@aws-cdk/aws-ec2/test/asset-fixture/data.txt b/packages/aws-cdk-lib/aws-ec2/test/asset-fixture/data.txt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/asset-fixture/data.txt rename to packages/aws-cdk-lib/aws-ec2/test/asset-fixture/data.txt diff --git a/packages/@aws-cdk/aws-ec2/test/bastion-host.test.ts b/packages/aws-cdk-lib/aws-ec2/test/bastion-host.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ec2/test/bastion-host.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/bastion-host.test.ts index 2d21d5ac2e57a..887c1761bcaa3 100644 --- a/packages/@aws-cdk/aws-ec2/test/bastion-host.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/bastion-host.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Duration, Stack } from '../../core'; import { BastionHostLinux, BlockDeviceVolume, CloudFormationInit, InitCommand, InstanceClass, InstanceSize, InstanceType, SubnetType, Vpc } from '../lib'; describe('bastion host', () => { diff --git a/packages/@aws-cdk/aws-ec2/test/cfn-init-element.test.ts b/packages/aws-cdk-lib/aws-ec2/test/cfn-init-element.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/cfn-init-element.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/cfn-init-element.test.ts index 7b6c61e47c590..53b673ce9258c 100644 --- a/packages/@aws-cdk/aws-ec2/test/cfn-init-element.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/cfn-init-element.test.ts @@ -2,9 +2,9 @@ import * as crypto from 'crypto'; import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { App, Duration, Stack } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import { App, Duration, Stack } from '../../core'; import * as ec2 from '../lib'; import { InitPlatform } from '../lib/private/cfn-init-internal'; diff --git a/packages/aws-cdk-lib/aws-ec2/test/cfn-init.test.ts b/packages/aws-cdk-lib/aws-ec2/test/cfn-init.test.ts new file mode 100644 index 0000000000000..42638c6577390 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/cfn-init.test.ts @@ -0,0 +1,682 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import { Asset } from '../../aws-s3-assets'; +import { AssetStaging, App, Aws, CfnResource, Stack, DefaultStackSynthesizer, IStackSynthesizer, FileAssetSource, FileAssetLocation } from '../../core'; +import * as cxapi from '../../cx-api'; +import { stringLike } from './util'; +import * as ec2 from '../lib'; + +let app: App; +let stack: Stack; +let instanceRole: iam.Role; +let resource: CfnResource; +let linuxUserData: ec2.UserData; +let signalResource: CfnResource; + +function resetState() { + resetStateWithSynthesizer(); +} + +function resetStateWithSynthesizer(customSynthesizer?: IStackSynthesizer) { + app = new App({ + context: { + [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false, + }, + }); + stack = new Stack(app, 'Stack', { + env: { account: '1234', region: 'testregion' }, + synthesizer: customSynthesizer, + }); + instanceRole = new iam.Role(stack, 'InstanceRole', { + assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), + }); + resource = new CfnResource(stack, 'Resource', { + type: 'CDK::Test::Resource', + }); + signalResource = new CfnResource(stack, 'SignalResource', { + type: 'CDK::Test::Resource', + }); + linuxUserData = ec2.UserData.forLinux(); +}; + +beforeEach(resetState); + +test('whole config with restart handles', () => { + // WHEN + const handle = new ec2.InitServiceRestartHandle(); + const config = new ec2.InitConfig([ + ec2.InitFile.fromString('/etc/my.cnf', '[mysql]\ngo_fast=true', { serviceRestartHandles: [handle] }), + ec2.InitSource.fromUrl('/tmp/foo', 'https://amazon.com/foo.zip', { serviceRestartHandles: [handle] }), + ec2.InitPackage.yum('httpd', { serviceRestartHandles: [handle] }), + ec2.InitCommand.argvCommand(['/bin/true'], { serviceRestartHandles: [handle] }), + ec2.InitService.enable('httpd', { serviceRestartHandle: handle }), + ]); + + // THEN + expect(config._bind(stack, linuxOptions()).config).toEqual(expect.objectContaining({ + services: { + sysvinit: { + httpd: { + enabled: true, + ensureRunning: true, + commands: ['000'], + files: ['/etc/my.cnf'], + packages: { + yum: ['httpd'], + }, + sources: ['/tmp/foo'], + }, + }, + }, + })); +}); + +test('CloudFormationInit can be added to after instantiation', () => { + // GIVEN + const config = new ec2.InitConfig([]); + const init = ec2.CloudFormationInit.fromConfig(config); + + // WHEN + config.add(ec2.InitCommand.argvCommand(['/bin/true'])); + init.attach(resource, linuxOptions()); + + // THEN + expectMetadataLike({ + 'AWS::CloudFormation::Init': { + config: { + commands: { + '000': { command: ['/bin/true'] }, + }, + }, + }, + }); +}); + +test('CloudFormationInit cannot be attached twice', () => { + // GIVEN + const init = ec2.CloudFormationInit.fromElements(); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + expect(() => { init.attach(resource, linuxOptions()); }).toThrow(/already has/); +}); + +test('empty configs are not rendered', () => { + // GIVEN + const config1 = new ec2.InitConfig([]); + const config2 = new ec2.InitConfig([ + ec2.InitCommand.argvCommand(['/bin/true']), + ]); + + // WHEN + const init = ec2.CloudFormationInit.fromConfigSets({ + configSets: { default: ['config2', 'config1'] }, + configs: { config1, config2 }, + }); + init.attach(resource, linuxOptions()); + + // THEN + expectMetadataLike({ + 'AWS::CloudFormation::Init': { + configSets: { + default: ['config2'], + }, + config2: { + commands: { + '000': { command: ['/bin/true'] }, + }, + }, + }, + }); +}); + +describe('userdata', () => { + let simpleInit: ec2.CloudFormationInit; + beforeEach(() => { + simpleInit = ec2.CloudFormationInit.fromElements( + ec2.InitCommand.argvCommand(['/bin/true']), + ); + }); + + function linuxUserDataTest(signalLogicalId: string) { + const lines = linuxUserData.render().split('\n'); + expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`)); + expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`)); + expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`)); + expectLine(lines, cmdArg('cfn-init', '-c default')); + expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`)); + expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`)); + expectLine(lines, cmdArg('cfn-signal', `--resource ${signalLogicalId}`)); + expectLine(lines, cmdArg('cfn-signal', '-e $?')); + expectLine(lines, cmdArg('cat', 'cfn-init.log')); + expectLine(lines, /fingerprint/); + } + + function windowsUserDataTest( + windowsUserData: ec2.UserData, + signalLogicalId: string, + ) { + const lines = windowsUserData.render().split('\n'); + expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`)); + expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`)); + expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`)); + expectLine(lines, cmdArg('cfn-init', '-c default')); + expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`)); + expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`)); + expectLine(lines, cmdArg('cfn-signal', `--resource ${signalLogicalId}`)); + expectLine(lines, cmdArg('cfn-signal', '-e $LASTEXITCODE')); + expectLine(lines, cmdArg('type', 'cfn-init.log')); + expectLine(lines, /fingerprint/); + } + + test('linux userdata contains right commands', () => { + // WHEN + simpleInit.attach(resource, linuxOptions()); + + // THEN + linuxUserDataTest(resource.logicalId); + }); + + test('linux userdata contains right commands with different signal resource', () => { + // WHEN + simpleInit.attach(resource, { + ...linuxOptions(), + signalResource, + }); + + // THEN + linuxUserDataTest(signalResource.logicalId); + }); + + test('linux userdata contains right commands when url and role included', () => { + // WHEN + simpleInit.attach(resource, { + platform: ec2.OperatingSystemType.LINUX, + instanceRole, + includeUrl: true, + includeRole: true, + userData: linuxUserData, + }); + + // THEN + const lines = linuxUserData.render().split('\n'); + expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`)); + expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`)); + expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`)); + expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole.roleName}`)); + expectLine(lines, cmdArg('cfn-init', `--url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`)); + expectLine(lines, cmdArg('cfn-init', '-c default')); + expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`)); + expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`)); + expectLine(lines, cmdArg('cfn-signal', `--resource ${resource.logicalId}`)); + expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole.roleName}`)); + expectLine(lines, cmdArg('cfn-init', `--url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`)); + expectLine(lines, cmdArg('cfn-signal', '-e $?')); + expectLine(lines, cmdArg('cat', 'cfn-init.log')); + expectLine(lines, /fingerprint/); + }); + + test('Windows userdata contains right commands', () => { + // WHEN + const windowsUserData = ec2.UserData.forWindows(); + + simpleInit.attach(resource, { + platform: ec2.OperatingSystemType.WINDOWS, + instanceRole, + userData: windowsUserData, + }); + + // THEN + windowsUserDataTest(windowsUserData, resource.logicalId); + }); + + test('Windows userdata contains right commands with different signal resource', () => { + // WHEN + const windowsUserData = ec2.UserData.forWindows(); + + simpleInit.attach(resource, { + platform: ec2.OperatingSystemType.WINDOWS, + instanceRole, + userData: windowsUserData, + signalResource, + }); + + // THEN + windowsUserDataTest(windowsUserData, signalResource.logicalId); + }); + + test('ignoreFailures disables result code reporting', () => { + // WHEN + simpleInit.attach(resource, { + ...linuxOptions(), + ignoreFailures: true, + }); + + // THEN + const lines = linuxUserData.render().split('\n'); + dontExpectLine(lines, cmdArg('cfn-signal', '-e $?')); + expectLine(lines, cmdArg('cfn-signal', '-e 0')); + }); + + test('can disable log printing', () => { + // WHEN + simpleInit.attach(resource, { + ...linuxOptions(), + printLog: false, + }); + + // THEN + const lines = linuxUserData.render().split('\n'); + dontExpectLine(lines, cmdArg('cat', 'cfn-init.log')); + }); + + test('can disable fingerprinting', () => { + // WHEN + simpleInit.attach(resource, { + ...linuxOptions(), + embedFingerprint: false, + }); + + // THEN + const lines = linuxUserData.render().split('\n'); + dontExpectLine(lines, /fingerprint/); + }); + + test('can request multiple different configsets to be used', () => { + // WHEN + simpleInit.attach(resource, { + ...linuxOptions(), + configSets: ['banana', 'peach'], + }); + + // THEN + const lines = linuxUserData.render().split('\n'); + expectLine(lines, cmdArg('cfn-init', '-c banana,peach')); + }); +}); + +const ASSET_STATEMENT = { + Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], + Effect: 'Allow', + Resource: [ + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':s3:::', + { Ref: stringLike(/AssetParameter.*S3Bucket.*/) }, + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':s3:::', + { Ref: stringLike(/AssetParameter.*S3Bucket.*/) }, + '/*', + ]], + }, + ], +}; + +describe('assets n buckets', () => { + + test.each([ + ['Existing'], + [''], + ])('InitFile.from%sAsset', (existing: string) => { + // GIVEN + const asset = new Asset(stack, 'Asset', { path: __filename }); + const init = ec2.CloudFormationInit.fromElements( + existing + ? ec2.InitFile.fromExistingAsset('/etc/fun.js', asset) + : ec2.InitFile.fromAsset('/etc/fun.js', __filename), + ); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([ASSET_STATEMENT]), + Version: '2012-10-17', + }, + }); + expectMetadataLike({ + 'AWS::CloudFormation::Init': { + config: { + files: { + '/etc/fun.js': { + source: { + 'Fn::Join': ['', [ + 'https://s3.testregion.', + { Ref: 'AWS::URLSuffix' }, + '/', + { Ref: stringLike(/AssetParameters.*/) }, + '/', + { 'Fn::Select': [0, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, + { 'Fn::Select': [1, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, + ]], + }, + }, + }, + }, + }, + 'AWS::CloudFormation::Authentication': { + S3AccessCreds: { + type: 'S3', + roleName: { Ref: 'InstanceRole3CCE2F1D' }, + buckets: [ + { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, + ], + }, + }, + }); + }); + + test.each([ + ['Existing'], + [''], + ])('InitSource.from%sAsset', (existing: string) => { + // GIVEN + const asset = new Asset(stack, 'Asset', { path: path.join(__dirname, 'asset-fixture') }); + const init = ec2.CloudFormationInit.fromElements( + existing + ? ec2.InitSource.fromExistingAsset('/etc/fun', asset) + : ec2.InitSource.fromAsset('/etc/fun', path.join(__dirname, 'asset-fixture')), + ); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([ASSET_STATEMENT]), + Version: '2012-10-17', + }, + }); + expectMetadataLike({ + 'AWS::CloudFormation::Init': { + config: { + sources: { + '/etc/fun': { + 'Fn::Join': ['', [ + 'https://s3.testregion.', + { Ref: 'AWS::URLSuffix' }, + '/', + { Ref: stringLike(/AssetParameters.*/) }, + '/', + { 'Fn::Select': [0, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, + { 'Fn::Select': [1, { 'Fn::Split': ['||', { Ref: stringLike(/AssetParameters.*/) }] }] }, + ]], + }, + }, + }, + }, + 'AWS::CloudFormation::Authentication': { + S3AccessCreds: { + type: 'S3', + roleName: { Ref: 'InstanceRole3CCE2F1D' }, + buckets: [ + { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, + ], + }, + }, + }); + }); + + test('InitFile.fromS3Object', () => { + const bucket = s3.Bucket.fromBucketName(stack, 'Bucket', 'my-bucket'); + const init = ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromS3Object('/etc/fun.js', bucket, 'file.js'), + ); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], + Effect: 'Allow', + Resource: [ + { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket']] }, + { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket/file.js']] }, + ], + }]), + Version: '2012-10-17', + }, + }); + expectMetadataLike({ + 'AWS::CloudFormation::Init': { + config: { + files: { + '/etc/fun.js': { + source: { 'Fn::Join': ['', ['https://s3.testregion.', { Ref: 'AWS::URLSuffix' }, '/my-bucket/file.js']] }, + }, + }, + }, + }, + 'AWS::CloudFormation::Authentication': { + S3AccessCreds: { + type: 'S3', + roleName: { Ref: 'InstanceRole3CCE2F1D' }, + buckets: ['my-bucket'], + }, + }, + }); + }); + + test('InitSource.fromS3Object', () => { + const bucket = s3.Bucket.fromBucketName(stack, 'Bucket', 'my-bucket'); + const init = ec2.CloudFormationInit.fromElements( + ec2.InitSource.fromS3Object('/etc/fun', bucket, 'file.zip'), + ); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], + Effect: 'Allow', + Resource: [ + { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket']] }, + { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':s3:::my-bucket/file.zip']] }, + ], + }]), + Version: '2012-10-17', + }, + }); + expectMetadataLike({ + 'AWS::CloudFormation::Init': { + config: { + sources: { + '/etc/fun': { 'Fn::Join': ['', ['https://s3.testregion.', { Ref: 'AWS::URLSuffix' }, '/my-bucket/file.zip']] }, + }, + }, + }, + 'AWS::CloudFormation::Authentication': { + S3AccessCreds: { + type: 'S3', + roleName: { Ref: 'InstanceRole3CCE2F1D' }, + buckets: ['my-bucket'], + }, + }, + }); + }); + + test('no duplication of bucket names when using multiple assets', () => { + // GIVEN + const init = ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromAsset('/etc/fun.js', __filename), + ec2.InitSource.fromAsset('/etc/fun', path.join(__dirname, 'asset-fixture')), + ); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + expectMetadataLike({ + 'AWS::CloudFormation::Authentication': { + S3AccessCreds: { + type: 'S3', + roleName: { Ref: 'InstanceRole3CCE2F1D' }, + buckets: Match.arrayWith([ + { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, + ]), + }, + }, + }); + }); + + test('multiple buckets appear in the same auth block', () => { + // GIVEN + const bucket = s3.Bucket.fromBucketName(stack, 'Bucket', 'my-bucket'); + const init = ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromS3Object('/etc/fun.js', bucket, 'file.js'), + ec2.InitSource.fromAsset('/etc/fun', path.join(__dirname, 'asset-fixture')), + ); + + // WHEN + init.attach(resource, linuxOptions()); + + // THEN + expectMetadataLike({ + 'AWS::CloudFormation::Authentication': { + S3AccessCreds: { + type: 'S3', + roleName: { Ref: 'InstanceRole3CCE2F1D' }, + buckets: Match.arrayWith([ + { Ref: stringLike(/AssetParameters.*S3Bucket.*/) }, + 'my-bucket', + ]), + }, + }, + }); + }); + + test('fingerprint data changes on asset hash update', () => { + function calculateFingerprint(assetFilePath: string): string | undefined { + resetState(); // Needed so the same resources/assets/filenames can be used. + AssetStaging.clearAssetHashCache(); // Needed so changing the content of the file will update the hash + const init = ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromAsset('/etc/myFile', assetFilePath), + ); + init.attach(resource, linuxOptions()); + + return linuxUserData.render().split('\n').find(line => line.match(/# fingerprint:/)); + } + + // Setup initial asset file + const assetFileDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cfn-init-test')); + const assetFilePath = path.join(assetFileDir, 'fingerprint-test'); + fs.writeFileSync(assetFilePath, 'hello'); + + const fingerprintOne = calculateFingerprint(assetFilePath); + const fingerprintOneAgain = calculateFingerprint(assetFilePath); + // Consistent without changes. + expect(fingerprintOneAgain).toEqual(fingerprintOne); + + // Change asset file content/hash + fs.writeFileSync(assetFilePath, ' world'); + + const fingerprintTwo = calculateFingerprint(assetFilePath); + + expect(fingerprintTwo).not.toEqual(fingerprintOne); + }); + + test('fingerprint data changes on existing asset update, even for assets with unchanging URLs', () => { + function calculateFingerprint(assetFilePath: string): string | undefined { + resetStateWithSynthesizer(new SingletonLocationSythesizer()); + AssetStaging.clearAssetHashCache(); // Needed so changing the content of the file will update the hash + const init = ec2.CloudFormationInit.fromElements( + ec2.InitFile.fromExistingAsset('/etc/myFile', new Asset(stack, 'FileAsset', { path: assetFilePath })), + ); + init.attach(resource, linuxOptions()); + + return linuxUserData.render().split('\n').find(line => line.match(/# fingerprint:/)); + } + + // Setup initial asset file + const assetFileDir = fs.mkdtempSync(path.join(os.tmpdir(), 'cfn-init-test')); + const assetFilePath = path.join(assetFileDir, 'fingerprint-test'); + fs.writeFileSync(assetFilePath, 'hello'); + + const fingerprintOne = calculateFingerprint(assetFilePath); + const fingerprintOneAgain = calculateFingerprint(assetFilePath); + // Consistent without changes. + expect(fingerprintOneAgain).toEqual(fingerprintOne); + + // Change asset file content/hash + fs.writeFileSync(assetFilePath, ' world'); + + const fingerprintTwo = calculateFingerprint(assetFilePath); + + expect(fingerprintTwo).not.toEqual(fingerprintOne); + }); +}); + +function linuxOptions() { + return { + platform: ec2.OperatingSystemType.LINUX, + instanceRole, + userData: linuxUserData, + }; +} + +function expectMetadataLike(pattern: any) { + Template.fromStack(stack).hasResource('CDK::Test::Resource', { + Metadata: pattern, + }); +} + +function expectLine(lines: string[], re: RegExp) { + for (const line of lines) { + if (re.test(line)) { return; } + } + + throw new Error(`None of the lines matched '${re}': ${lines.join('\n')}`); +} + +function dontExpectLine(lines: string[], re: RegExp) { + try { + expectLine(lines, re); + } catch (e) { + return; + } + throw new Error(`Found unexpected line matching '${re}': ${lines.join('\n')}`); +} + +function cmdArg(command: string, argument: string) { + return new RegExp(`${escapeRegex(command)}(\.exe)? .*${escapeRegex(argument)}`); +} + +function escapeRegex(s: string) { + return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} + +/** Creates file assets that have a hard-coded asset url, rather than the default based on asset hash */ +class SingletonLocationSythesizer extends DefaultStackSynthesizer { + public addFileAsset(_asset: FileAssetSource): FileAssetLocation { + const httpUrl = 'https://MyBucket.s3.amazonaws.com/MyAsset'; + return { + bucketName: 'myassetbucket', + objectKey: 'MyAssetFile', + httpUrl, + s3ObjectUrl: httpUrl, + s3Url: httpUrl, + }; + } +} diff --git a/packages/@aws-cdk/aws-ec2/test/cidr-splits.test.ts b/packages/aws-cdk-lib/aws-ec2/test/cidr-splits.test.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/cidr-splits.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/cidr-splits.test.ts diff --git a/packages/@aws-cdk/aws-ec2/test/client-vpn-authorization-rule.test.ts b/packages/aws-cdk-lib/aws-ec2/test/client-vpn-authorization-rule.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ec2/test/client-vpn-authorization-rule.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/client-vpn-authorization-rule.test.ts index 45dc200f9c817..3246333cb7060 100644 --- a/packages/@aws-cdk/aws-ec2/test/client-vpn-authorization-rule.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/client-vpn-authorization-rule.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; +import { Template } from '../../assertions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Stack } from '@aws-cdk/core'; +import { App, Stack } from '../../core'; import { Connections, IClientVpnEndpoint } from '../lib'; import { ClientVpnAuthorizationRule } from '../lib/client-vpn-authorization-rule'; diff --git a/packages/@aws-cdk/aws-ec2/test/client-vpn-endpoint.test.ts b/packages/aws-cdk-lib/aws-ec2/test/client-vpn-endpoint.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ec2/test/client-vpn-endpoint.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/client-vpn-endpoint.test.ts index 2b087d6da1f10..ceaf942ab2b12 100644 --- a/packages/@aws-cdk/aws-ec2/test/client-vpn-endpoint.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/client-vpn-endpoint.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { SamlMetadataDocument, SamlProvider } from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { SamlMetadataDocument, SamlProvider } from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import { Stack } from '../../core'; import * as ec2 from '../lib'; import { ClientVpnUserBasedAuthentication } from '../lib/client-vpn-endpoint'; diff --git a/packages/@aws-cdk/aws-ec2/test/client-vpn-route.test.ts b/packages/aws-cdk-lib/aws-ec2/test/client-vpn-route.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ec2/test/client-vpn-route.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/client-vpn-route.test.ts index 213c10f0b438c..80bfd7fbe583f 100644 --- a/packages/@aws-cdk/aws-ec2/test/client-vpn-route.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/client-vpn-route.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { SamlMetadataDocument, SamlProvider } from '@aws-cdk/aws-iam'; +import { Template } from '../../assertions'; +import { SamlMetadataDocument, SamlProvider } from '../../aws-iam'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, Stack } from '@aws-cdk/core'; +import { App, Stack } from '../../core'; import * as ec2 from '../lib'; import { ClientVpnRoute, diff --git a/packages/@aws-cdk/aws-ec2/test/connections.test.ts b/packages/aws-cdk-lib/aws-ec2/test/connections.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/connections.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/connections.test.ts index 7853bebe58083..adb3b1b71a65c 100644 --- a/packages/@aws-cdk/aws-ec2/test/connections.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/connections.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Stack } from '../../core'; import { Connections, diff --git a/packages/@aws-cdk/aws-ec2/test/example.images.lit.ts b/packages/aws-cdk-lib/aws-ec2/test/example.images.lit.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/example.images.lit.ts rename to packages/aws-cdk-lib/aws-ec2/test/example.images.lit.ts diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/ca.crt b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/ca.crt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/ca.crt rename to packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/ca.crt diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.crt b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/client1.domain.tld.crt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.crt rename to packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/client1.domain.tld.crt diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.key b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/client1.domain.tld.key similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/client1.domain.tld.key rename to packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/client1.domain.tld.key diff --git a/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/index.ts b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/index.ts new file mode 100644 index 0000000000000..846af4be6bcc3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/index.ts @@ -0,0 +1,49 @@ +import * as fs from 'fs'; +import { ACM } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +const acm = new ACM(); + +export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.RequestType) { + case 'Create': + let serverImport; + if (!event.ResourceProperties.ServerCertificateArn) { + serverImport = await acm.importCertificate({ + Certificate: fs.readFileSync('./server.crt'), + PrivateKey: fs.readFileSync('./server.key'), + CertificateChain: fs.readFileSync('./ca.crt'), + }).promise(); + } + + let clientImport; + if (!event.ResourceProperties.ClientCertificateArn) { + clientImport = await acm.importCertificate({ + Certificate: fs.readFileSync('./client1.domain.tld.crt'), + PrivateKey: fs.readFileSync('./client1.domain.tld.key'), + CertificateChain: fs.readFileSync('./ca.crt'), + }).promise(); + } + + + return { + Data: { + ServerCertificateArn: serverImport?.CertificateArn, + ClientCertificateArn: clientImport?.CertificateArn, + }, + }; + case 'Update': + return; + case 'Delete': + if (event.ResourceProperties.ServerCertificateArn) { + await acm.deleteCertificate({ + CertificateArn: event.ResourceProperties.ServerCertificateArn, + }).promise(); + } + if (event.ResourceProperties.ClientCertificateArn) { + await acm.deleteCertificate({ + CertificateArn: event.ResourceProperties.ClientCertificateArn, + }).promise(); + } + return; + } +} diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.crt b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/server.crt similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.crt rename to packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/server.crt diff --git a/packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.key b/packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/server.key similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/integ.client-vpn-endpoint.js.snapshot/asset.1ef463e71119677d383a964bbb0740f0c4de382c21d5a8d68be98334d514ae8a/server.key rename to packages/aws-cdk-lib/aws-ec2/test/import-certificates-handler/server.key diff --git a/packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/aws-cdk-ec2-import.template.json b/packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/aws-cdk-ec2-import.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/aws-cdk-ec2-import.template.json rename to packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/aws-cdk-ec2-import.template.json diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/importdefaultvpcDefaultTestDeployAssertC39D1439.template.json b/packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/importdefaultvpcDefaultTestDeployAssertC39D1439.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/importdefaultvpcDefaultTestDeployAssertC39D1439.template.json rename to packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/importdefaultvpcDefaultTestDeployAssertC39D1439.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/integ.json b/packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/integ.json rename to packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/manifest.json b/packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/manifest.json rename to packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/tree.json b/packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/import-default-vpc.integ.snapshot/tree.json rename to packages/aws-cdk-lib/aws-ec2/test/import-default-vpc.integ.snapshot/tree.json diff --git a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts new file mode 100644 index 0000000000000..fbb524b540d1e --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts @@ -0,0 +1,627 @@ +import * as path from 'path'; +import { Annotations, Match, Template } from '../../assertions'; +import { Key } from '../../aws-kms'; +import { Asset } from '../../aws-s3-assets'; +import { StringParameter } from '../../aws-ssm'; +import { App, Stack } from '../../core'; +import * as cxapi from '../../cx-api'; +import { + AmazonLinuxImage, + BlockDeviceVolume, + CloudFormationInit, + EbsDeviceVolumeType, + InitCommand, + Instance, + InstanceArchitecture, + InstanceClass, + InstanceSize, + InstanceType, + LaunchTemplate, + UserData, + Vpc, +} from '../lib'; + +let stack: Stack; +let vpc: Vpc; +beforeEach(() => { + stack = new Stack(); + vpc = new Vpc(stack, 'VPC'); +}); + +describe('instance', () => { + test('instance is created with source/dest check switched off', () => { + // WHEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + sourceDestCheck: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + InstanceType: 't3.large', + SourceDestCheck: false, + }); + + + }); + test('instance is grantable', () => { + // GIVEN + const param = new StringParameter(stack, 'Param', { stringValue: 'Foobar' }); + const instance = new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + }); + + // WHEN + param.grantRead(instance); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'ssm:DescribeParameters', + 'ssm:GetParameters', + 'ssm:GetParameter', + 'ssm:GetParameterHistory', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':ssm:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':parameter/', + { + Ref: 'Param165332EC', + }, + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + }); + + + }); + test('instance architecture is correctly discerned for arm instances', () => { + // GIVEN + const sampleInstanceClasses = [ + 'a1', 't4g', 'c6g', 'c7g', 'c6gd', 'c6gn', 'm6g', 'm6gd', 'm7g', 'r6g', 'r6gd', 'r7g', 'g5g', 'im4gn', 'is4gen', // current Graviton-based instance classes + 'a13', 't11g', 'y10ng', 'z11ngd', // theoretical future Graviton-based instance classes + ]; + + for (const instanceClass of sampleInstanceClasses) { + // WHEN + const instanceType = InstanceType.of(instanceClass as InstanceClass, InstanceSize.XLARGE18); + + // THEN + expect(instanceType.architecture).toBe(InstanceArchitecture.ARM_64); + } + + + }); + test('instance architecture is correctly discerned for x86-64 instance', () => { + // GIVEN + const sampleInstanceClasses = ['c5', 'm5ad', 'r5n', 'm6', 't3a', 'r6i', 'r6a', 'p4de']; // A sample of x86-64 instance classes + + for (const instanceClass of sampleInstanceClasses) { + // WHEN + const instanceType = InstanceType.of(instanceClass as InstanceClass, InstanceSize.XLARGE18); + + // THEN + expect(instanceType.architecture).toBe(InstanceArchitecture.X86_64); + } + + + }); + + test('instances with local NVME drive are correctly named', () => { + // GIVEN + const sampleInstanceClassKeys = [{ + key: InstanceClass.R5D, + value: 'r5d', + }, { + key: InstanceClass.MEMORY5_NVME_DRIVE, + value: 'r5d', + }, { + key: InstanceClass.R5AD, + value: 'r5ad', + }, { + key: InstanceClass.MEMORY5_AMD_NVME_DRIVE, + value: 'r5ad', + }, { + key: InstanceClass.M5AD, + value: 'm5ad', + }, { + key: InstanceClass.STANDARD5_AMD_NVME_DRIVE, + value: 'm5ad', + }]; // A sample of instances with NVME drives + + for (const instanceClass of sampleInstanceClassKeys) { + // WHEN + const instanceType = InstanceType.of(instanceClass.key, InstanceSize.LARGE); + // THEN + expect(instanceType.toString().split('.')[0]).toBe(instanceClass.value); + } + }); + test('instance architecture throws an error when instance type is invalid', () => { + // GIVEN + const malformedInstanceTypes = ['t4', 't4g.nano.', 't4gnano', '']; + + for (const malformedInstanceType of malformedInstanceTypes) { + // WHEN + const instanceType = new InstanceType(malformedInstanceType); + + // THEN + expect(() => instanceType.architecture).toThrow('Malformed instance type identifier'); + } + + + }); + test('can propagate EBS volume tags', () => { + // WHEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + propagateTagsToVolumeOnCreation: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + PropagateTagsToVolumeOnCreation: true, + }); + }); + describe('blockDeviceMappings', () => { + test('can set blockDeviceMappings', () => { + // WHEN + const kmsKey = new Key(stack, 'EbsKey'); + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + blockDevices: [{ + deviceName: 'ebs', + mappingEnabled: true, + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + volumeType: EbsDeviceVolumeType.IO1, + iops: 5000, + }), + }, { + deviceName: 'ebs-gp3', + mappingEnabled: true, + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + volumeType: EbsDeviceVolumeType.GP3, + iops: 5000, + }), + }, { + deviceName: 'ebs-cmk', + mappingEnabled: true, + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + kmsKey: kmsKey, + volumeType: EbsDeviceVolumeType.IO1, + iops: 5000, + }), + }, { + deviceName: 'ebs-snapshot', + mappingEnabled: false, + volume: BlockDeviceVolume.ebsFromSnapshot('snapshot-id', { + volumeSize: 500, + deleteOnTermination: false, + volumeType: EbsDeviceVolumeType.SC1, + }), + }, { + deviceName: 'ephemeral', + volume: BlockDeviceVolume.ephemeral(0), + }], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + BlockDeviceMappings: [ + { + DeviceName: 'ebs', + Ebs: { + DeleteOnTermination: true, + Encrypted: true, + Iops: 5000, + VolumeSize: 15, + VolumeType: 'io1', + }, + }, + { + DeviceName: 'ebs-gp3', + Ebs: { + DeleteOnTermination: true, + Encrypted: true, + Iops: 5000, + VolumeSize: 15, + VolumeType: 'gp3', + }, + }, + { + DeviceName: 'ebs-cmk', + Ebs: { + DeleteOnTermination: true, + Encrypted: true, + KmsKeyId: { + 'Fn::GetAtt': [ + 'EbsKeyD3FEE551', + 'Arn', + ], + }, + Iops: 5000, + VolumeSize: 15, + VolumeType: 'io1', + }, + }, + { + DeviceName: 'ebs-snapshot', + Ebs: { + DeleteOnTermination: false, + SnapshotId: 'snapshot-id', + VolumeSize: 500, + VolumeType: 'sc1', + }, + NoDevice: {}, + }, + { + DeviceName: 'ephemeral', + VirtualName: 'ephemeral0', + }, + ], + }); + + + }); + + test('throws if ephemeral volumeIndex < 0', () => { + // THEN + expect(() => { + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + blockDevices: [{ + deviceName: 'ephemeral', + volume: BlockDeviceVolume.ephemeral(-1), + }], + }); + }).toThrow(/volumeIndex must be a number starting from 0/); + + + }); + + test('throws if volumeType === IO1 without iops', () => { + // THEN + expect(() => { + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + blockDevices: [{ + deviceName: 'ebs', + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + volumeType: EbsDeviceVolumeType.IO1, + }), + }], + }); + }).toThrow(/ops property is required with volumeType: EbsDeviceVolumeType.IO1/); + }); + + test('throws if volumeType === IO2 without iops', () => { + // THEN + expect(() => { + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + blockDevices: [{ + deviceName: 'ebs', + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + volumeType: EbsDeviceVolumeType.IO2, + }), + }], + }); + }).toThrow(/ops property is required with volumeType: EbsDeviceVolumeType.IO1 and EbsDeviceVolumeType.IO2/); + }); + + test('warning if iops without volumeType', () => { + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + blockDevices: [{ + deviceName: 'ebs', + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + iops: 5000, + }), + }], + }); + + // THEN + Annotations.fromStack(stack).hasWarning('/Default/Instance', 'iops will be ignored without volumeType: IO1, IO2, or GP3'); + }); + + test('warning if iops and invalid volumeType', () => { + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + blockDevices: [{ + deviceName: 'ebs', + volume: BlockDeviceVolume.ebs(15, { + deleteOnTermination: true, + encrypted: true, + volumeType: EbsDeviceVolumeType.GP2, + iops: 5000, + }), + }], + }); + + // THEN + Annotations.fromStack(stack).hasWarning('/Default/Instance', 'iops will be ignored without volumeType: IO1, IO2, or GP3'); + }); + }); + + test('instance can be created with Private IP Address', () => { + // WHEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + privateIpAddress: '10.0.0.2', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + InstanceType: 't3.large', + PrivateIpAddress: '10.0.0.2', + }); + + + }); + + test('instance requires IMDSv2', () => { + // WHEN + const instance = new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: new InstanceType('t2.micro'), + requireImdsv2: true, + }); + + // Force stack synth so the InstanceRequireImdsv2Aspect is applied + Template.fromStack(stack); + + // THEN + const launchTemplate = instance.node.tryFindChild('LaunchTemplate') as LaunchTemplate; + expect(launchTemplate).toBeDefined(); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::LaunchTemplate', { + LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), + LaunchTemplateData: { + MetadataOptions: { + HttpTokens: 'required', + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + LaunchTemplate: { + LaunchTemplateName: stack.resolve(launchTemplate.launchTemplateName), + }, + }); + }); + + describe('Detailed Monitoring', () => { + test('instance with Detailed Monitoring enabled', () => { + // WHEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: new InstanceType('t2.micro'), + detailedMonitoring: true, + }); + + // Force stack synth so the Instance is applied + Template.fromStack(stack); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + Monitoring: true, + }); + }); + + test('instance with Detailed Monitoring disabled', () => { + // WHEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: new InstanceType('t2.micro'), + detailedMonitoring: false, + }); + + // Force stack synth so the Instance is applied + Template.fromStack(stack); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + Monitoring: false, + }); + }); + + test('instance with Detailed Monitoring unset falls back to disabled', () => { + // WHEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: new InstanceType('t2.micro'), + }); + + // Force stack synth so the Instance is applied + Template.fromStack(stack); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + Monitoring: Match.absent(), + }); + }); + }); + +}); + +test('add CloudFormation Init to instance', () => { + // GIVEN + new Instance(stack, 'Instance', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + init: CloudFormationInit.fromElements( + InitCommand.shellCommand('echo hello'), + ), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Instance', { + UserData: { + 'Fn::Base64': { + 'Fn::Join': ['', [ + '#!/bin/bash\n# fingerprint: 85ac432b1de1144f\n(\n set +e\n /opt/aws/bin/cfn-init -v --region ', + { Ref: 'AWS::Region' }, + ' --stack ', + { Ref: 'AWS::StackName' }, + ' --resource InstanceC1063A87 -c default\n /opt/aws/bin/cfn-signal -e $? --region ', + { Ref: 'AWS::Region' }, + ' --stack ', + { Ref: 'AWS::StackName' }, + ' --resource InstanceC1063A87\n cat /var/log/cfn-init.log >&2\n)', + ]], + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['cloudformation:DescribeStackResource', 'cloudformation:SignalResource'], + Effect: 'Allow', + Resource: { Ref: 'AWS::StackId' }, + }]), + Version: '2012-10-17', + }, + }); + Template.fromStack(stack).hasResource('AWS::EC2::Instance', { + CreationPolicy: { + ResourceSignal: { + Count: 1, + Timeout: 'PT5M', + }, + }, + }); +}); + +test('cause replacement from s3 asset in userdata', () => { + // GIVEN + const app = new App({ + context: { + [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false, + }, + }); + stack = new Stack(app); + vpc = new Vpc(stack, 'Vpc)'); + const userData1 = UserData.forLinux(); + const asset1 = new Asset(stack, 'UserDataAssets1', { + path: path.join(__dirname, 'asset-fixture', 'data.txt'), + }); + userData1.addS3DownloadCommand({ bucket: asset1.bucket, bucketKey: asset1.s3ObjectKey }); + + const userData2 = UserData.forLinux(); + const asset2 = new Asset(stack, 'UserDataAssets2', { + path: path.join(__dirname, 'asset-fixture', 'data.txt'), + }); + userData2.addS3DownloadCommand({ bucket: asset2.bucket, bucketKey: asset2.s3ObjectKey }); + + // WHEN + new Instance(stack, 'InstanceOne', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + userData: userData1, + userDataCausesReplacement: true, + }); + new Instance(stack, 'InstanceTwo', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + userData: userData2, + userDataCausesReplacement: true, + }); + + // THEN -- both instances have the same userData hash, telling us the hash is based + // on the actual asset hash and not accidentally on the token stringification of them. + // (which would base the hash on '${Token[1234.bla]}' + const hash = 'f88eace39faf39d7'; + Template.fromStack(stack).templateMatches(Match.objectLike({ + Resources: Match.objectLike({ + [`InstanceOne5B821005${hash}`]: Match.objectLike({ + Type: 'AWS::EC2::Instance', + Properties: Match.anyValue(), + }), + [`InstanceTwoDC29A7A7${hash}`]: Match.objectLike({ + Type: 'AWS::EC2::Instance', + Properties: Match.anyValue(), + }), + }), + })); +}); + +test('ssm permissions adds right managed policy', () => { + // WHEN + new Instance(stack, 'InstanceOne', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + ssmSessionPermissions: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + ManagedPolicyArns: [ + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AmazonSSMManagedInstanceCore', + ]], + }, + ], + }); +}); + diff --git a/packages/aws-cdk-lib/aws-ec2/test/integ.import-default-vpc.lit.ts b/packages/aws-cdk-lib/aws-ec2/test/integ.import-default-vpc.lit.ts new file mode 100644 index 0000000000000..6c59229ed6a35 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/integ.import-default-vpc.lit.ts @@ -0,0 +1,38 @@ +/// !cdk-integ * pragma:enable-lookups +import * as cdk from '../../core'; +import * as ec2 from '../lib'; + +const app = new cdk.App(); + +// we associate this stack with an explicit environment since this is required by the +// environmental context provider used in `fromLookup`. CDK_INTEG_XXX are set +// when producing the .expected file and CDK_DEFAULT_XXX is passed in through from +// the CLI in actual deployment. +const env = { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, +}; + +const stack = new cdk.Stack(app, 'aws-cdk-ec2-import', { env }); + +/// !show +const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { + // This imports the default VPC but you can also + // specify a 'vpcName' or 'tags'. + isDefault: true, +}); +/// !hide + +// The only thing in this library that takes a VPC as an argument :) +new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc, +}); + +// Try subnet selection +new cdk.CfnOutput(stack, 'PublicSubnets', { value: 'ids:' + vpc.publicSubnets.map(s => s.subnetId).join(',') }); +new cdk.CfnOutput(stack, 'PrivateSubnets', { value: 'ids:' + vpc.privateSubnets.map(s => s.subnetId).join(',') }); + +// Route table IDs +new cdk.CfnOutput(stack, 'PublicRouteTables', { value: 'ids: ' + vpc.publicSubnets.map(s => s.routeTable.routeTableId).join(', ') }); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-ec2/test/integ.nat-instances.lit.ts b/packages/aws-cdk-lib/aws-ec2/test/integ.nat-instances.lit.ts new file mode 100644 index 0000000000000..6bd02065e7001 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/integ.nat-instances.lit.ts @@ -0,0 +1,35 @@ +/// !cdk-integ pragma:enable-lookups +import * as cdk from '../../core'; +import * as ec2 from '../lib'; + +class NatInstanceStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + // Configure the `natGatewayProvider` when defining a Vpc + const natGatewayProvider = ec2.NatProvider.instance({ + instanceType: new ec2.InstanceType('t3.small'), + }); + + const vpc = new ec2.Vpc(this, 'MyVpc', { + natGatewayProvider, + + // The 'natGateways' parameter now controls the number of NAT instances + natGateways: 2, + }); + /// !hide + + Array.isArray(vpc); + Array.isArray(natGatewayProvider.configuredGateways); + } +} + +const app = new cdk.App(); +new NatInstanceStack(app, 'aws-cdk-vpc-nat-instances', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_INTEG_REGION || process.env.CDK_DEFAULT_REGION, + }, +}); +app.synth(); diff --git a/packages/aws-cdk-lib/aws-ec2/test/integ.share-vpcs.lit.ts b/packages/aws-cdk-lib/aws-ec2/test/integ.share-vpcs.lit.ts new file mode 100644 index 0000000000000..61ed323fdc3f5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/integ.share-vpcs.lit.ts @@ -0,0 +1,63 @@ +/// !cdk-integ * +import * as cdk from '../../core'; +import { Construct } from 'constructs'; +import * as ec2 from '../lib'; + +const app = new cdk.App(); + +interface ConstructThatTakesAVpcProps { + vpc: ec2.IVpc; +} + +class ConstructThatTakesAVpc extends Construct { + constructor(scope: Construct, id: string, _props: ConstructThatTakesAVpcProps) { + super(scope, id); + + // new ec2.CfnInstance(this, 'Instance', { + // subnetId: props.vpc.privateSubnets[0].subnetId, + // imageId: new ec2.AmazonLinuxImage().getImage(this).imageId, + // }); + } +} + +/// !show +/** + * Stack1 creates the VPC + */ +class Stack1 extends cdk.Stack { + public readonly vpc: ec2.Vpc; + + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + this.vpc = new ec2.Vpc(this, 'VPC'); + } +} + +interface Stack2Props extends cdk.StackProps { + vpc: ec2.IVpc; +} + +/** + * Stack2 consumes the VPC + */ +class Stack2 extends cdk.Stack { + constructor(scope: cdk.App, id: string, props: Stack2Props) { + super(scope, id, props); + + // Pass the VPC to a construct that needs it + new ConstructThatTakesAVpc(this, 'Construct', { + vpc: props.vpc, + }); + } +} + +const stack1 = new Stack1(app, 'Stack1'); +const stack2 = new Stack2(app, 'Stack2', { + vpc: stack1.vpc, +}); +/// !hide + +Array.isArray(stack2); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-ec2/test/integ.vpc-endpoint.lit.ts b/packages/aws-cdk-lib/aws-ec2/test/integ.vpc-endpoint.lit.ts new file mode 100644 index 0000000000000..6f8cef83102a4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/integ.vpc-endpoint.lit.ts @@ -0,0 +1,47 @@ +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as ec2 from '../lib'; + +const app = new cdk.App(); + +class VpcEndpointStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + // Add gateway endpoints when creating the VPC + const vpc = new ec2.Vpc(this, 'MyVpc', { + gatewayEndpoints: { + S3: { + service: ec2.GatewayVpcEndpointAwsService.S3, + }, + }, + }); + + // Alternatively gateway endpoints can be added on the VPC + const dynamoDbEndpoint = vpc.addGatewayEndpoint('DynamoDbEndpoint', { + service: ec2.GatewayVpcEndpointAwsService.DYNAMODB, + }); + + // This allows to customize the endpoint policy + dynamoDbEndpoint.addToPolicy( + new iam.PolicyStatement({ // Restrict to listing and describing tables + principals: [new iam.AnyPrincipal()], + actions: ['dynamodb:DescribeTable', 'dynamodb:ListTables'], + resources: ['*'], + })); + + // Add an interface endpoint + vpc.addInterfaceEndpoint('EcrDockerEndpoint', { + service: ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER, + + // Uncomment the following to allow more fine-grained control over + // who can access the endpoint via the '.connections' object. + // open: false + }); + /// !hide + } +} + +new VpcEndpointStack(app, 'aws-cdk-ec2-vpc-endpoint'); +app.synth(); diff --git a/packages/@aws-cdk/aws-ec2/test/ip-addresses.test.ts b/packages/aws-cdk-lib/aws-ec2/test/ip-addresses.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/ip-addresses.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/ip-addresses.test.ts index 4df3561fd4b82..9ab1bd60b5911 100644 --- a/packages/@aws-cdk/aws-ec2/test/ip-addresses.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/ip-addresses.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { IpAddresses, SubnetType, Vpc } from '../lib'; describe('Cidr vpc allocation', () => { diff --git a/packages/@aws-cdk/aws-ec2/test/l1.test.ts b/packages/aws-cdk-lib/aws-ec2/test/l1.test.ts similarity index 89% rename from packages/@aws-cdk/aws-ec2/test/l1.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/l1.test.ts index 0124940b6e3fc..a8ac13caca875 100644 --- a/packages/@aws-cdk/aws-ec2/test/l1.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/l1.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as ec2 from '../lib'; test('NetworkAclEntry CidrBlock should be optional', () => { diff --git a/packages/@aws-cdk/aws-ec2/test/launch-template.test.ts b/packages/aws-cdk-lib/aws-ec2/test/launch-template.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/launch-template.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/launch-template.test.ts index 234d6558bbca2..a46580072fd2a 100644 --- a/packages/@aws-cdk/aws-ec2/test/launch-template.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/launch-template.test.ts @@ -1,18 +1,18 @@ -import { Annotations, Template, Match } from '@aws-cdk/assertions'; +import { Annotations, Template, Match } from '../../assertions'; import { CfnInstanceProfile, Role, ServicePrincipal, -} from '@aws-cdk/aws-iam'; -import { Key } from '@aws-cdk/aws-kms'; +} from '../../aws-iam'; +import { Key } from '../../aws-kms'; import { App, Duration, Expiration, Stack, Tags, -} from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +} from '../../core'; +import * as cxapi from '../../cx-api'; import { stringLike } from './util'; import { AmazonLinuxImage, diff --git a/packages/@aws-cdk/aws-ec2/test/machine-image.test.ts b/packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/test/machine-image.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts index 60d2372b310a0..f4f4fcedf8271 100644 --- a/packages/@aws-cdk/aws-ec2/test/machine-image.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { App, Stack } from '../../core'; import * as ec2 from '../lib'; let app: App; diff --git a/packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/aws-cdk-vpc-nat-instances.template.json b/packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/aws-cdk-vpc-nat-instances.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/aws-cdk-vpc-nat-instances.template.json rename to packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/aws-cdk-vpc-nat-instances.template.json diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/test/integ.sns-sqs.lit.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/integ.json b/packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/integ.json rename to packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/manifest.json b/packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/manifest.json rename to packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/tree.json b/packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/tree.json rename to packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/vpcnatinstancesDefaultTestDeployAssert519D693A.template.json b/packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/vpcnatinstancesDefaultTestDeployAssert519D693A.template.json similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/nat-instances.integ.snapshot/vpcnatinstancesDefaultTestDeployAssert519D693A.template.json rename to packages/aws-cdk-lib/aws-ec2/test/nat-instances.integ.snapshot/vpcnatinstancesDefaultTestDeployAssert519D693A.template.json diff --git a/packages/@aws-cdk/aws-ec2/test/network-utils.test.ts b/packages/aws-cdk-lib/aws-ec2/test/network-utils.test.ts similarity index 100% rename from packages/@aws-cdk/aws-ec2/test/network-utils.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/network-utils.test.ts diff --git a/packages/aws-cdk-lib/aws-ec2/test/security-group.test.ts b/packages/aws-cdk-lib/aws-ec2/test/security-group.test.ts new file mode 100644 index 0000000000000..e77baa0e60fe7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/security-group.test.ts @@ -0,0 +1,1111 @@ +import { Template } from '../../assertions'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { App, Intrinsic, Lazy, Stack, Token } from '../../core'; +import { Peer, Port, SecurityGroup, SecurityGroupProps, Vpc } from '../lib'; + +const SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY = '@aws-cdk/aws-ec2.securityGroupDisableInlineRules'; + +describe('security group', () => { + test('security group can allows all outbound traffic by default', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: true }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + }); + }); + + test('security group can allows all ipv6 outbound traffic by default', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + new SecurityGroup(stack, 'SG1', { vpc, allowAllIpv6Outbound: true }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + { + CidrIpv6: '::/0', + Description: 'Allow all outbound ipv6 traffic by default', + IpProtocol: '-1', + }, + ], + }); + }); + + test('can add ipv6 rules even if allowAllOutbound=true', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', { vpc }); + sg.addEgressRule(Peer.ipv6('2001:db8::/128'), Port.tcp(80)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + { + CidrIpv6: '2001:db8::/128', + Description: 'from 2001:db8::/128:80', + FromPort: 80, + ToPort: 80, + IpProtocol: 'tcp', + }, + ], + }); + + }); + + test('no new outbound rule is added if we are allowing all traffic anyway', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: true }); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'This does not show up'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + }); + + + }); + + test('security group disallow outbound traffic by default', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '255.255.255.255/32', + Description: 'Disallow all traffic', + FromPort: 252, + IpProtocol: 'icmp', + ToPort: 86, + }, + ], + }); + + + }); + + test('bogus outbound rule disappears if another rule is added', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'This replaces the other one'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'This replaces the other one', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }, + ], + }); + }); + + test('all outbound rule cannot be added after creation', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); + expect(() => { + sg.addEgressRule(Peer.anyIpv4(), Port.allTraffic(), 'All traffic'); + }).toThrow(/Cannot add/); + }); + + test('all ipv6 outbound rule cannot be added after creation', () => { + // GIVEN + const stack = new Stack(); + const vpc = new Vpc(stack, 'VPC'); + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', { vpc, allowAllOutbound: false }); + expect(() => { + sg.addEgressRule(Peer.anyIpv6(), Port.allTraffic(), 'All traffic'); + }).toThrow(/Cannot add/); + }); + + test('immutable imports do not add rules', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const sg = SecurityGroup.fromSecurityGroupId(stack, 'SG1', 'test-id', { mutable: false }); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'This rule was not added'); + sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'This rule was not added'); + + const openEgressRules = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'This rule was not added', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }, + ], + }); + expect(Object.keys(openEgressRules).length).toBe(0); + + const openIngressRules = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'This rule was not added', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }, + ], + }); + expect(Object.keys(openIngressRules).length).toBe(0); + }); + + describe('Inline Rule Control', () => { + //Not inlined + describe('When props.disableInlineRules is true', () => { testRulesAreNotInlined(undefined, true); }); + describe('When context.disableInlineRules is true', () => { testRulesAreNotInlined(true, undefined); }); + describe('When context.disableInlineRules is true and props.disableInlineRules is true', () => { testRulesAreNotInlined(true, true); }); + describe('When context.disableInlineRules is false and props.disableInlineRules is true', () => { testRulesAreNotInlined(false, true); }); + describe('When props.disableInlineRules is true and context.disableInlineRules is null', () => { testRulesAreNotInlined(null, true); }); + //Inlined + describe('When context.disableInlineRules is false and props.disableInlineRules is false', () => { testRulesAreInlined(false, false); }); + describe('When context.disableInlineRules is true and props.disableInlineRules is false', () => { testRulesAreInlined(true, false); }); + describe('When context.disableInlineRules is false', () => { testRulesAreInlined(false, undefined); }); + describe('When props.disableInlineRules is false', () => { testRulesAreInlined(undefined, false); }); + describe('When neither props.disableInlineRules nor context.disableInlineRules are defined', () => { testRulesAreInlined(undefined, undefined); }); + describe('When props.disableInlineRules is undefined and context.disableInlineRules is null', () => { testRulesAreInlined(null, undefined); }); + describe('When props.disableInlineRules is false and context.disableInlineRules is null', () => { testRulesAreInlined(null, false); }); + }); + + test('peer between all types of peers and port range types', () => { + // GIVEN + const stack = new Stack(undefined, 'TestStack', { env: { account: '12345678', region: 'dummy' } }); + const vpc = new Vpc(stack, 'VPC'); + const sg = new SecurityGroup(stack, 'SG', { vpc, allowAllIpv6Outbound: true }); + + const peers = [ + new SecurityGroup(stack, 'PeerGroup', { vpc }), + Peer.anyIpv4(), + Peer.anyIpv6(), + Peer.prefixList('pl-012345'), + Peer.securityGroupId('sg-012345678'), + ]; + + const ports = [ + Port.tcp(1234), + Port.tcp(Lazy.number({ produce: () => 5000 })), + Port.allTcp(), + Port.tcpRange(80, 90), + Port.udp(2345), + Port.udp(Lazy.number({ produce: () => 7777 })), + Port.allUdp(), + Port.udpRange(85, 95), + Port.icmpTypeAndCode(5, 1), + Port.icmpType(8), + Port.allIcmp(), + Port.icmpPing(), + Port.allTraffic(), + ]; + + // WHEN + for (const peer of peers) { + for (const port of ports) { + sg.connections.allowTo(peer, port); + sg.connections.allowFrom(peer, port); + } + } + + // THEN -- no crash + + + }); + + test('can add multiple rules using tokens on same security group', () => { + // GIVEN + const stack = new Stack(undefined, 'TestStack', { env: { account: '12345678', region: 'dummy' } }); + const vpc = new Vpc(stack, 'VPC'); + const sg = new SecurityGroup(stack, 'SG', { vpc }); + + const p1 = Lazy.string({ produce: () => 'dummyid1' }); + const p2 = Lazy.string({ produce: () => 'dummyid2' }); + const peer1 = Peer.prefixList(p1); + const peer2 = Peer.prefixList(p2); + + // WHEN + sg.addIngressRule(peer1, Port.tcp(5432), 'Rule 1'); + sg.addIngressRule(peer2, Port.tcp(5432), 'Rule 2'); + + // THEN -- no crash + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + Description: 'Rule 1', + }); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + Description: 'Rule 2', + }); + }); + + test('if tokens are used in ports, `canInlineRule` should be false to avoid cycles', () => { + // GIVEN + const p1 = Lazy.number({ produce: () => 80 }); + const p2 = Lazy.number({ produce: () => 5000 }); + + // WHEN + const ports = [ + Port.tcp(p1), + Port.tcp(p2), + Port.tcpRange(p1, 90), + Port.tcpRange(80, p2), + Port.tcpRange(p1, p2), + Port.udp(p1), + Port.udpRange(p1, 95), + Port.udpRange(85, p2), + Port.udpRange(p1, p2), + Port.icmpTypeAndCode(p1, 1), + Port.icmpTypeAndCode(5, p1), + Port.icmpTypeAndCode(p1, p2), + Port.icmpType(p1), + ]; + + // THEN + for (const range of ports) { + expect(range.canInlineRule).toEqual(false); + } + + + }); + + describe('Peer IP CIDR validation', () => { + test('passes with valid IPv4 CIDR block', () => { + // GIVEN + const cidrIps = ['0.0.0.0/0', '192.168.255.255/24']; + + // THEN + for (const cidrIp of cidrIps) { + expect(Peer.ipv4(cidrIp).uniqueId).toEqual(cidrIp); + } + + + }); + + test('passes with unresolved IP CIDR token', () => { + // GIVEN + Token.asString(new Intrinsic('ip')); + + // THEN: don't throw + + + }); + + test('throws if invalid IPv4 CIDR block', () => { + // THEN + expect(() => { + Peer.ipv4('invalid'); + }).toThrow(/Invalid IPv4 CIDR/); + + + }); + + test('throws if missing mask in IPv4 CIDR block', () => { + expect(() => { + Peer.ipv4('0.0.0.0'); + }).toThrow(/CIDR mask is missing in IPv4/); + + + }); + + test('passes with valid IPv6 CIDR block', () => { + // GIVEN + const cidrIps = [ + '::/0', + '2001:db8::/32', + '2001:0db8:0000:0000:0000:8a2e:0370:7334/32', + '2001:db8::8a2e:370:7334/32', + ]; + + // THEN + for (const cidrIp of cidrIps) { + expect(Peer.ipv6(cidrIp).uniqueId).toEqual(cidrIp); + } + + + }); + + test('throws if invalid IPv6 CIDR block', () => { + // THEN + expect(() => { + Peer.ipv6('invalid'); + }).toThrow(/Invalid IPv6 CIDR/); + + + }); + + test('throws if missing mask in IPv6 CIDR block', () => { + expect(() => { + Peer.ipv6('::'); + }).toThrow(/IDR mask is missing in IPv6/); + + + }); + }); + + describe('Peer security group ID validation', () => { + test('passes with valid security group ID', () => { + //GIVEN + const securityGroupIds = ['sg-12345678', 'sg-0123456789abcdefg']; + + // THEN + for (const securityGroupId of securityGroupIds) { + expect(Peer.securityGroupId(securityGroupId).uniqueId).toEqual(securityGroupId); + } + }); + + test('passes with valid security group ID and source owner id', () => { + //GIVEN + const securityGroupIds = ['sg-12345678', 'sg-0123456789abcdefg']; + const ownerIds = ['000000000000', '000000000001']; + + // THEN + for (const securityGroupId of securityGroupIds) { + for (const ownerId of ownerIds) { + expect(Peer.securityGroupId(securityGroupId, ownerId).uniqueId).toEqual(securityGroupId); + } + } + }); + + test('passes with unresolved security group id token or owner id token', () => { + // GIVEN + Token.asString('securityGroupId'); + + const securityGroupId = Lazy.string({ produce: () => 'sg-01234567' }); + const ownerId = Lazy.string({ produce: () => '000000000000' }); + Peer.securityGroupId(securityGroupId); + Peer.securityGroupId(securityGroupId, ownerId); + + // THEN: don't throw + }); + + test('throws if invalid security group ID', () => { + // THEN + expect(() => { + Peer.securityGroupId('invalid'); + }).toThrow(/Invalid security group ID/); + + + }); + + test('throws if invalid source security group id', () => { + // THEN + expect(() => { + Peer.securityGroupId('sg-12345678', 'invalid'); + }).toThrow(/Invalid security group owner ID/); + }); + }); + + describe('SourceSecurityGroupOwnerId property validation', () => { + test('SourceSecurityGroupOwnerId property is not present when value is not provided to ingress rule', () => { + // GIVEN + const stack = new Stack(undefined, 'TestStack'); + const vpc = new Vpc(stack, 'VPC'); + const sg = new SecurityGroup(stack, 'SG', { vpc }); + + //WHEN + sg.addIngressRule(Peer.securityGroupId('sg-123456789'), Port.allTcp(), 'no owner id property'); + + //THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [{ + SourceSecurityGroupId: 'sg-123456789', + Description: 'no owner id property', + FromPort: 0, + ToPort: 65535, + IpProtocol: 'tcp', + }], + }); + }); + + test('SourceSecurityGroupOwnerId property is present when value is provided to ingress rule', () => { + // GIVEN + const stack = new Stack(undefined, 'TestStack'); + const vpc = new Vpc(stack, 'VPC'); + const sg = new SecurityGroup(stack, 'SG', { vpc }); + + //WHEN + sg.addIngressRule(Peer.securityGroupId('sg-123456789', '000000000000'), Port.allTcp(), 'contains owner id property'); + + //THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [{ + SourceSecurityGroupId: 'sg-123456789', + SourceSecurityGroupOwnerId: '000000000000', + Description: 'contains owner id property', + FromPort: 0, + ToPort: 65535, + IpProtocol: 'tcp', + }], + }); + }); + + test('SourceSecurityGroupOwnerId property is not present when value is provided to egress rule', () => { + // GIVEN + const stack = new Stack(undefined, 'TestStack'); + const vpc = new Vpc(stack, 'VPC'); + const sg = new SecurityGroup(stack, 'SG', { vpc, allowAllOutbound: false }); + + //WHEN + sg.addEgressRule(Peer.securityGroupId('sg-123456789', '000000000000'), Port.allTcp(), 'no owner id property'); + + //THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupEgress: [{ + DestinationSecurityGroupId: 'sg-123456789', + Description: 'no owner id property', + FromPort: 0, + ToPort: 65535, + IpProtocol: 'tcp', + }], + }); + }); + }); +}); + +describe('security group lookup', () => { + testDeprecated('can look up a security group', () => { + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + const securityGroup = SecurityGroup.fromLookup(stack, 'stack', 'sg-1234'); + + expect(securityGroup.securityGroupId).toEqual('sg-12345678'); + expect(securityGroup.allowAllOutbound).toEqual(true); + + }); + + test('can look up a security group by id', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + // WHEN + const securityGroup = SecurityGroup.fromLookupById(stack, 'SG1', 'sg-12345'); + + // THEN + expect(securityGroup.securityGroupId).toEqual('sg-12345678'); + expect(securityGroup.allowAllOutbound).toEqual(true); + + }); + + test('can look up a security group by name and vpc', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { + vpcId: 'vpc-1234', + availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], + }); + + // WHEN + const securityGroup = SecurityGroup.fromLookupByName(stack, 'SG1', 'sg-12345', vpc); + + // THEN + expect(securityGroup.securityGroupId).toEqual('sg-12345678'); + expect(securityGroup.allowAllOutbound).toEqual(true); + + }); + + test('can look up a security group by id and vpc', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { + vpcId: 'vpc-1234', + availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], + }); + + // WHEN + const securityGroup = SecurityGroup.fromLookupByName(stack, 'SG1', 'my-security-group', vpc); + + // THEN + expect(securityGroup.securityGroupId).toEqual('sg-12345678'); + expect(securityGroup.allowAllOutbound).toEqual(true); + + }); + + test('can look up a security group and use it as a peer', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { + vpcId: 'vpc-1234', + availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], + }); + + // WHEN + const securityGroup = SecurityGroup.fromLookupByName(stack, 'SG1', 'my-security-group', vpc); + + // THEN + expect(() => { + Peer.securityGroupId(securityGroup.securityGroupId); + }).not.toThrow(); + }); + + test('throws if securityGroupId is tokenized', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + // WHEN + expect(() => { + SecurityGroup.fromLookupById(stack, 'stack', Lazy.string({ produce: () => 'sg-12345' })); + }).toThrow('All arguments to look up a security group must be concrete (no Tokens)'); + + }); + + test('throws if securityGroupName is tokenized', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + // WHEN + expect(() => { + SecurityGroup.fromLookupById(stack, 'stack', Lazy.string({ produce: () => 'my-security-group' })); + }).toThrow('All arguments to look up a security group must be concrete (no Tokens)'); + + }); + + test('throws if vpc id is tokenized', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { + account: '1234', + region: 'us-east-1', + }, + }); + + const vpc = Vpc.fromVpcAttributes(stack, 'VPC', { + vpcId: Lazy.string({ produce: () => 'vpc-1234' }), + availabilityZones: ['dummy1a', 'dummy1b', 'dummy1c'], + }); + + // WHEN + expect(() => { + SecurityGroup.fromLookupByName(stack, 'stack', 'my-security-group', vpc); + }).toThrow('All arguments to look up a security group must be concrete (no Tokens)'); + + }); + +}); + +function testRulesAreInlined(contextDisableInlineRules: boolean | undefined | null, optionsDisableInlineRules: boolean | undefined) { + + describe('When allowAllOutbound', () => { + test('new SecurityGroup will create an inline SecurityGroupEgress rule to allow all traffic', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + new SecurityGroup(stack, 'SG1', props); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + }); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + + test('addEgressRule rule will not modify egress rules', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + + test('addIngressRule will add a new ingress rule', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + SecurityGroupIngress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'An external Rule', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }, + ], + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + }); + + }); + }); + + describe('When do not allowAllOutbound', () => { + test('new SecurityGroup rule will create an egress rule that denies all traffic', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + new SecurityGroup(stack, 'SG1', props); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + SecurityGroupEgress: [ + { + CidrIp: '255.255.255.255/32', + Description: 'Disallow all traffic', + IpProtocol: 'icmp', + FromPort: 252, + ToPort: 86, + }, + ], + }); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + + }); + test('addEgressRule rule will add a new inline egress rule and remove the denyAllTraffic rule', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An inline Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'An inline Rule', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }, + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + + test('addIngressRule will add a new ingress rule', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + SecurityGroupIngress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'An external Rule', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }, + ], + SecurityGroupEgress: [ + { + CidrIp: '255.255.255.255/32', + Description: 'Disallow all traffic', + IpProtocol: 'icmp', + FromPort: 252, + ToPort: 86, + }, + ], + }); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 0); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + }); + +}; + + +function testRulesAreNotInlined(contextDisableInlineRules: boolean | undefined | null, optionsDisableInlineRules: boolean | undefined) { + + describe('When allowAllOutbound', () => { + test('new SecurityGroup will create an external SecurityGroupEgress rule', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + + test('addIngressRule rule will not remove external allowAllOutbound rule', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + + test('addIngressRule rule will not add a new egress rule', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + + const egressGroups = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + Description: 'An external Rule', + }); + expect(Object.keys(egressGroups).length).toBe(0); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + }); + + test('addIngressRule rule will add a new external ingress rule even if it could have been inlined', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: true, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '0.0.0.0/0', + Description: 'An external Rule', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }); + + }); + }); + + describe('When do not allowAllOutbound', () => { + test('new SecurityGroup rule will create an external egress rule that denies all traffic', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '255.255.255.255/32', + Description: 'Disallow all traffic', + IpProtocol: 'icmp', + FromPort: 252, + ToPort: 86, + }); + + }); + + test('addEgressRule rule will remove the rule that denies all traffic if another egress rule is added', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + const egressGroups = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '255.255.255.255/32', + }); + expect(Object.keys(egressGroups).length).toBe(0); + }); + + test('addEgressRule rule will add a new external egress rule even if it could have been inlined', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addEgressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '0.0.0.0/0', + Description: 'An external Rule', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupIngress', 0); + + }); + + test('addIngressRule will add a new external ingress rule even if it could have been inlined', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(SECURITY_GROUP_DISABLE_INLINE_RULES_CONTEXT_KEY, contextDisableInlineRules); + const vpc = new Vpc(stack, 'VPC'); + const props: SecurityGroupProps = { vpc, allowAllOutbound: false, disableInlineRules: optionsDisableInlineRules }; + + // WHEN + const sg = new SecurityGroup(stack, 'SG1', props); + sg.addIngressRule(Peer.anyIpv4(), Port.tcp(86), 'An external Rule'); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/SG1', + VpcId: stack.resolve(vpc.vpcId), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '0.0.0.0/0', + Description: 'An external Rule', + FromPort: 86, + IpProtocol: 'tcp', + ToPort: 86, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: stack.resolve(sg.securityGroupId), + CidrIp: '255.255.255.255/32', + Description: 'Disallow all traffic', + IpProtocol: 'icmp', + FromPort: 252, + ToPort: 86, + }); + + }); + }); + +} diff --git a/packages/@aws-cdk/aws-ec2/test/userdata.test.ts b/packages/aws-cdk-lib/aws-ec2/test/userdata.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/userdata.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/userdata.test.ts index 4a29db3ea45c9..c9e7932e6ffa7 100644 --- a/packages/@aws-cdk/aws-ec2/test/userdata.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/userdata.test.ts @@ -1,6 +1,6 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import { Bucket } from '@aws-cdk/aws-s3'; -import { Aws, Stack, CfnResource } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import { Bucket } from '../../aws-s3'; +import { Aws, Stack, CfnResource } from '../../core'; import * as ec2 from '../lib'; describe('user data', () => { diff --git a/packages/aws-cdk-lib/aws-ec2/test/util.ts b/packages/aws-cdk-lib/aws-ec2/test/util.ts new file mode 100644 index 0000000000000..9d2090b52e9c6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ec2/test/util.ts @@ -0,0 +1,20 @@ +import { Matcher, MatchResult } from '../../assertions'; + +export function stringLike(pattern: string | RegExp): Matcher { + return new RegexMatcher(new RegExp(pattern)); +} + +export class RegexMatcher extends Matcher { + constructor(private readonly pattern: RegExp, public readonly name: string = 'RegexMatch') { super(); } + public test(actual: any): MatchResult { + const result = new MatchResult(actual); + if (!this.pattern.test(actual)) { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected ${actual} to match ${this.pattern}`, + }); + } + return result; + } +} diff --git a/packages/@aws-cdk/aws-ec2/test/volume.test.ts b/packages/aws-cdk-lib/aws-ec2/test/volume.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/volume.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/volume.test.ts index 96bd94bb117cf..ffe1ef38a9c17 100644 --- a/packages/@aws-cdk/aws-ec2/test/volume.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/volume.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AccountRootPrincipal, Role } from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import { AccountRootPrincipal, Role } from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as cdk from '../../core'; import { AmazonLinuxGeneration, EbsDeviceVolumeType, diff --git a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint-service.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint-service.test.ts index 3a1eb7edee100..1785f80bf1b9a 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint-service.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint-service.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { ArnPrincipal } from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { ArnPrincipal } from '../../aws-iam'; +import { Stack } from '../../core'; // eslint-disable-next-line max-len import { IVpcEndpointServiceLoadBalancer, Vpc, VpcEndpointService } from '../lib'; diff --git a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint.test.ts index e508f19054e75..dba796f16ed4d 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-endpoint.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpc-endpoint.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AnyPrincipal, PolicyStatement } from '@aws-cdk/aws-iam'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { ContextProvider, Fn, Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import { AnyPrincipal, PolicyStatement } from '../../aws-iam'; +import * as cxschema from '../../cloud-assembly-schema'; +import { ContextProvider, Fn, Stack } from '../../core'; // eslint-disable-next-line max-len import { GatewayVpcEndpoint, GatewayVpcEndpointAwsService, InterfaceVpcEndpoint, InterfaceVpcEndpointAwsService, InterfaceVpcEndpointService, SecurityGroup, SubnetFilter, SubnetType, Vpc } from '../lib'; diff --git a/packages/@aws-cdk/aws-ec2/test/vpc-flow-logs.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/test/vpc-flow-logs.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts index 672a10652700e..715b3a2f3974a 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc-flow-logs.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import { RemovalPolicy, Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import { RemovalPolicy, Stack } from '../../core'; import { FlowLog, FlowLogDestination, FlowLogResourceType, FlowLogMaxAggregationInterval, LogFormat, Vpc } from '../lib'; describe('vpc flow logs', () => { diff --git a/packages/@aws-cdk/aws-ec2/test/vpc.from-lookup.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpc.from-lookup.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/test/vpc.from-lookup.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/vpc.from-lookup.test.ts index ba439b8d68211..f64ade1055477 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc.from-lookup.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpc.from-lookup.test.ts @@ -1,6 +1,6 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { ContextProvider, GetContextValueOptions, GetContextValueResult, Lazy, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import { ContextProvider, GetContextValueOptions, GetContextValueResult, Lazy, Stack } from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { GenericLinuxImage, Instance, InstanceType, SubnetType, Vpc } from '../lib'; diff --git a/packages/@aws-cdk/aws-ec2/test/vpc.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ec2/test/vpc.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts index 074c1aa8c0a91..647745199f503 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpc.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts @@ -1,6 +1,6 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; +import { Annotations, Match, Template } from '../../assertions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { App, CfnOutput, CfnResource, Fn, Lazy, Stack, Tags } from '@aws-cdk/core'; +import { App, CfnOutput, CfnResource, Fn, Lazy, Stack, Tags } from '../../core'; import { AclCidr, AclTraffic, diff --git a/packages/@aws-cdk/aws-ec2/test/vpn.test.ts b/packages/aws-cdk-lib/aws-ec2/test/vpn.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ec2/test/vpn.test.ts rename to packages/aws-cdk-lib/aws-ec2/test/vpn.test.ts index 76ba6053ed31e..b4b63efedef4a 100644 --- a/packages/@aws-cdk/aws-ec2/test/vpn.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/vpn.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; +import { Template } from '../../assertions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Duration, SecretValue, Stack, Token } from '@aws-cdk/core'; +import { Duration, SecretValue, Stack, Token } from '../../core'; import { PublicSubnet, Vpc, VpnConnection } from '../lib'; describe('vpn', () => { diff --git a/packages/aws-cdk-lib/aws-ecr-assets/.jsiirc.json b/packages/aws-cdk-lib/aws-ecr-assets/.jsiirc.json new file mode 100644 index 0000000000000..2bddc2d1f7f3d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr-assets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ecr.assets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Ecr.Assets" + }, + "python": { + "module": "aws_cdk.aws_ecr_assets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ecr-assets/README.md b/packages/aws-cdk-lib/aws-ecr-assets/README.md new file mode 100644 index 0000000000000..504f071089199 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr-assets/README.md @@ -0,0 +1,194 @@ +# AWS CDK Docker Image Assets + + +This module allows bundling Docker images as assets. + +## Images from Dockerfile + +Images are built from a local Docker context directory (with a `Dockerfile`), +uploaded to Amazon Elastic Container Registry (ECR) by the CDK toolkit +and/or your app's CI/CD pipeline, and can be naturally referenced in your CDK app. + +```ts +import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), +}); +``` + +The directory `my-image` must include a `Dockerfile`. + +This will instruct the toolkit to build a Docker image from `my-image`, push it +to an Amazon ECR repository and wire the name of the repository as CloudFormation +parameters to your stack. + +By default, all files in the given directory will be copied into the docker +*build context*. If there is a large directory that you know you definitely +don't need in the build context you can improve the performance by adding the +names of files and directories to ignore to a file called `.dockerignore`, or +pass them via the `exclude` property. If both are available, the patterns +found in `exclude` are appended to the patterns found in `.dockerignore`. + +The `ignoreMode` property controls how the set of ignore patterns is +interpreted. The recommended setting for Docker image assets is +`IgnoreMode.DOCKER`. If the context flag +`@aws-cdk/aws-ecr-assets:dockerIgnoreSupport` is set to `true` in your +`cdk.json` (this is by default for new projects, but must be set manually for +old projects) then `IgnoreMode.DOCKER` is the default and you don't need to +configure it on the asset itself. + +Use `asset.imageUri` to reference the image. It includes both the ECR image URL +and tag. + +Use `asset.imageTag` to reference only the image tag. + +You can optionally pass build args to the `docker build` command by specifying +the `buildArgs` property. It is recommended to skip hashing of `buildArgs` for +values that can change between different machines to maintain a consistent +asset hash. + +Additionally, you can supply `buildSecrets`. Your system must have Buildkit +enabled, see https://docs.docker.com/build/buildkit/. + +```ts +import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), + buildArgs: { + HTTP_PROXY: 'http://10.20.30.2:1234', + }, + invalidation: { + buildArgs: false, + }, +}); +``` + +You can optionally pass a target to the `docker build` command by specifying +the `target` property: + +```ts +import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), + target: 'a-target', +}); +``` + +You can optionally pass networking mode to the `docker build` command by specifying +the `networkMode` property: + +```ts +import { DockerImageAsset, NetworkMode } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), + networkMode: NetworkMode.HOST, +}) +``` + +You can optionally pass an alternate platform to the `docker build` command by specifying +the `platform` property: + +```ts +import { DockerImageAsset, Platform } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), + platform: Platform.LINUX_ARM64, +}) +``` + +You can optionally pass an array of outputs to the `docker build` command by specifying +the `outputs` property: + +```ts +import { DockerImageAsset, Platform } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), + outputs: ['type=local,dest=out'], +}) +``` + +You can optionally pass cache from and cache to options to cache images: + +```ts +import { DockerImageAsset, Platform } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new DockerImageAsset(this, 'MyBuildImage', { + directory: path.join(__dirname, 'my-image'), + cacheFrom: [{ type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache' }}], + cacheTo: { type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache', mode: 'max', compression: 'zstd' }} +}) +``` + +## Images from Tarball + +Images are loaded from a local tarball, uploaded to ECR by the CDK toolkit and/or your app's CI-CD pipeline, and can be +naturally referenced in your CDK app. + +```ts +import { TarballImageAsset } from 'aws-cdk-lib/aws-ecr-assets'; + +const asset = new TarballImageAsset(this, 'MyBuildImage', { + tarballFile: 'local-image.tar', +}); +``` + +This will instruct the toolkit to add the tarball as a file asset. During deployment it will load the container image +from `local-image.tar`, push it to an Amazon ECR repository and wire the name of the repository as CloudFormation parameters +to your stack. + +## Publishing images to ECR repositories + +`DockerImageAsset` is designed for seamless build & consumption of image assets by CDK code deployed to multiple environments +through the CDK CLI or through CI/CD workflows. To that end, the ECR repository behind this construct is controlled by the AWS CDK. +The mechanics of where these images are published and how are intentionally kept as an implementation detail, and the construct +does not support customizations such as specifying the ECR repository name or tags. + +If you are looking for a way to _publish_ image assets to an ECR repository in your control, you should consider using +[cdklabs/cdk-ecr-deployment], which is able to replicate an image asset from the CDK-controlled ECR repository to a repository of +your choice. + +Here an example from the [cdklabs/cdk-ecr-deployment] project: + +```text +// This example available in TypeScript only + +import { DockerImageAsset } from 'aws-cdk-lib/aws-ecr-assets'; +import * as ecrdeploy from 'cdk-ecr-deployment'; + +const image = new DockerImageAsset(this, 'CDKDockerImage', { + directory: path.join(__dirname, 'docker'), +}); + +new ecrdeploy.ECRDeployment(this, 'DeployDockerImage', { + src: new ecrdeploy.DockerImageName(image.imageUri), + dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/test:nginx`), +}); +``` + +⚠️ Please note that this is a 3rd-party construct library and is not officially supported by AWS. +You are welcome to +1 [this GitHub issue](https://github.com/aws/aws-cdk/issues/12597) if you would like to see +native support for this use-case in the AWS CDK. + +[cdklabs/cdk-ecr-deployment]: https://github.com/cdklabs/cdk-ecr-deployment + +## Pull Permissions + +Depending on the consumer of your image asset, you will need to make sure +the principal has permissions to pull the image. + +In most cases, you should use the `asset.repository.grantPull(principal)` +method. This will modify the IAM policy of the principal to allow it to +pull images from this repository. + +If the pulling principal is not in the same account or is an AWS service that +doesn't assume a role in your account (e.g. AWS CodeBuild), pull permissions +must be granted on the __resource policy__ (and not on the principal's policy). +To do that, you can use `asset.repository.addToResourcePolicy(statement)` to +grant the desired principal the following permissions: "ecr:GetDownloadUrlForLayer", +"ecr:BatchGetImage" and "ecr:BatchCheckLayerAvailability". diff --git a/packages/aws-cdk-lib/aws-ecr-assets/index.ts b/packages/aws-cdk-lib/aws-ecr-assets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr-assets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts b/packages/aws-cdk-lib/aws-ecr-assets/lib/image-asset.ts similarity index 98% rename from packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts rename to packages/aws-cdk-lib/aws-ecr-assets/lib/image-asset.ts index 49e93ff47bbfb..bc2c78ff7fc2c 100644 --- a/packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts +++ b/packages/aws-cdk-lib/aws-ecr-assets/lib/image-asset.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import * as path from 'path'; -import { FingerprintOptions, FollowMode, IAsset } from '@aws-cdk/assets'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { Annotations, AssetStaging, FeatureFlags, FileFingerprintOptions, IgnoreMode, Stack, SymlinkFollowMode, Token, Stage, CfnResource } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { FingerprintOptions, FollowMode, IAsset } from '../../assets'; +import * as ecr from '../../aws-ecr'; +import { Annotations, AssetStaging, FeatureFlags, FileFingerprintOptions, IgnoreMode, Stack, SymlinkFollowMode, Token, Stage, CfnResource } from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecr-assets/lib/index.ts b/packages/aws-cdk-lib/aws-ecr-assets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/lib/index.ts rename to packages/aws-cdk-lib/aws-ecr-assets/lib/index.ts diff --git a/packages/@aws-cdk/aws-ecr-assets/lib/tarball-asset.ts b/packages/aws-cdk-lib/aws-ecr-assets/lib/tarball-asset.ts similarity index 95% rename from packages/@aws-cdk/aws-ecr-assets/lib/tarball-asset.ts rename to packages/aws-cdk-lib/aws-ecr-assets/lib/tarball-asset.ts index 95dbbee1d1119..b73d331bda7c8 100644 --- a/packages/@aws-cdk/aws-ecr-assets/lib/tarball-asset.ts +++ b/packages/aws-cdk-lib/aws-ecr-assets/lib/tarball-asset.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { IAsset } from '@aws-cdk/assets'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { AssetStaging, Stack, Stage } from '@aws-cdk/core'; +import { IAsset } from '../../assets'; +import * as ecr from '../../aws-ecr'; +import { AssetStaging, Stack, Stage } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/.dockerignore b/packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/.dockerignore similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/.dockerignore rename to packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/.dockerignore diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/Dockerfile b/packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.run-batch-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/Dockerfile rename to packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/foobar.txt b/packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/foobar.txt similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/foobar.txt rename to packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/foobar.txt diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.asset-image.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py rename to packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/subdirectory/baz.txt b/packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/subdirectory/baz.txt similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/subdirectory/baz.txt rename to packages/aws-cdk-lib/aws-ecr-assets/test/allow-listed-image/subdirectory/baz.txt diff --git a/packages/@aws-cdk/aws-ecr-assets/test/build-image-cache.test.ts b/packages/aws-cdk-lib/aws-ecr-assets/test/build-image-cache.test.ts similarity index 95% rename from packages/@aws-cdk/aws-ecr-assets/test/build-image-cache.test.ts rename to packages/aws-cdk-lib/aws-ecr-assets/test/build-image-cache.test.ts index e50c41c4c6f95..3c4655e0453e6 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/build-image-cache.test.ts +++ b/packages/aws-cdk-lib/aws-ecr-assets/test/build-image-cache.test.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { AssetManifest } from '@aws-cdk/cloud-assembly-schema'; -import { App, Stack } from '@aws-cdk/core'; -import { AssetManifestArtifact, CloudArtifact, CloudAssembly } from '@aws-cdk/cx-api'; +import { AssetManifest } from '../../cloud-assembly-schema'; +import { App, Stack } from '../../core'; +import { AssetManifestArtifact, CloudArtifact, CloudAssembly } from '../../cx-api'; import { DockerImageAsset } from '../lib'; describe('build cache', () => { diff --git a/packages/aws-cdk-lib/aws-ecr-assets/test/custom-synthesis.test.ts b/packages/aws-cdk-lib/aws-ecr-assets/test/custom-synthesis.test.ts new file mode 100644 index 0000000000000..a6c68b9332e93 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr-assets/test/custom-synthesis.test.ts @@ -0,0 +1,94 @@ +/** + * This file asserts that it is possible to write a custom stacksynthesizer that will synthesize + * ONE thing to the asset manifest, while returning another thing (including tokens) to the + * CloudFormation template -- without reaching into the library internals + */ + +import * as path from 'path'; +import { Template } from '../../assertions'; +import { StackSynthesizer, FileAssetSource, FileAssetLocation, DockerImageAssetSource, DockerImageAssetLocation, ISynthesisSession, App, Stack, AssetManifestBuilder, CfnParameter, CfnResource } from '../../core'; +import { AssetManifestArtifact } from '../../cx-api'; +import { DockerImageAsset } from '../lib'; + +test('use custom synthesizer', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'Stack', { + synthesizer: new CustomSynthesizer(), + }); + + // WHEN + const asset = new DockerImageAsset(stack, 'MyAsset', { + directory: path.join(__dirname, 'demo-image'), + }); + new CfnResource(stack, 'TestResource', { + type: 'CDK::TestResource', + properties: { + ImageUri: asset.imageUri, + ImageTag: asset.imageTag, + }, + }); + + // THEN + const assembly = app.synth(); + const stackArtifact = assembly.getStackArtifact(stack.artifactId); + const assetArtifact = stackArtifact.dependencies[0] as AssetManifestArtifact; + + const stackTemplate = Template.fromJSON(stackArtifact.template); + stackTemplate.hasResourceProperties('CDK::TestResource', { + ImageUri: { 'Fn::Sub': '${AWS::AccountId}.dkr.ecr.${AWS::Region}.${AWS::URLSuffix}/${RepositoryName}:0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14' }, + ImageTag: '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14', + }); + + expect(assetArtifact.contents).toEqual(expect.objectContaining({ + dockerImages: expect.objectContaining({ + '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14': { + destinations: { + 'current_account-current_region': { + repositoryName: 'write-repo', + imageTag: '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14', + }, + }, + source: { + directory: 'asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14', + }, + }, + }), + })); +}); + +class CustomSynthesizer extends StackSynthesizer { + private readonly manifest = new AssetManifestBuilder(); + private parameter?: CfnParameter; + + override bind(stack: Stack) { + super.bind(stack); + + this.parameter = new CfnParameter(stack, 'RepositoryName'); + } + + addFileAsset(asset: FileAssetSource): FileAssetLocation { + void(asset); + throw new Error('file assets not supported here'); + } + + addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation { + const dest = this.manifest.defaultAddDockerImageAsset(this.boundStack, asset, { + repositoryName: 'write-repo', + }); + return this.cloudFormationLocationFromDockerImageAsset({ + ...dest, + repositoryName: ['${', this.parameter!.logicalId, '}'].join(''), + }); + } + + synthesize(session: ISynthesisSession): void { + // NOTE: Explicitly not adding template to asset manifest + this.synthesizeTemplate(session); + const assetManifestId = this.manifest.emitManifest(this.boundStack, session); + + this.emitArtifact(session, { + additionalDependencies: [assetManifestId], + }); + } +} diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/.dockerignore b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/.dockerignore similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/.dockerignore rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/.dockerignore diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/Dockerfile b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/integ.submit-job.js.snapshot/asset.8b518243ecbfcfd08b4734069e7e74ff97b7889dfde0a60d16e7bdc96e6c593b/Dockerfile rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile.Custom b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile.Custom similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile.Custom rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/Dockerfile.Custom diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.runtime-platform-application-load-balanced-fargate-service.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-custom-docker-file/index.py diff --git a/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-secret/Dockerfile b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-secret/Dockerfile new file mode 100644 index 0000000000000..72a0396611404 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-secret/Dockerfile @@ -0,0 +1,6 @@ +FROM public.ecr.aws/lambda/python:3.6 +RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret +EXPOSE 8000 +WORKDIR /src +ADD . /src +CMD python3 index.py diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-secret/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.scheduled-fargate-task.js.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image-secret/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image/Dockerfile diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-image/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-tarball-hello-world/hello-world.tar diff --git a/packages/@aws-cdk/aws-ecr-assets/test/demo-tarball/empty.tar b/packages/aws-cdk-lib/aws-ecr-assets/test/demo-tarball/empty.tar similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/demo-tarball/empty.tar rename to packages/aws-cdk-lib/aws-ecr-assets/test/demo-tarball/empty.tar diff --git a/packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/.dockerignore b/packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/.dockerignore similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/.dockerignore rename to packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/.dockerignore diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile b/packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile rename to packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/Dockerfile diff --git a/packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/foobar.txt b/packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/foobar.txt similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/foobar.txt rename to packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/foobar.txt diff --git a/packages/@aws-cdk/aws-ecs/test/demo-image/index.py b/packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs/test/demo-image/index.py rename to packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/index.py diff --git a/packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/subdirectory/baz.txt b/packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/subdirectory/baz.txt similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/dockerignore-image/subdirectory/baz.txt rename to packages/aws-cdk-lib/aws-ecr-assets/test/dockerignore-image/subdirectory/baz.txt diff --git a/packages/@aws-cdk/aws-ecr-assets/test/image-asset.test.ts b/packages/aws-cdk-lib/aws-ecr-assets/test/image-asset.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecr-assets/test/image-asset.test.ts rename to packages/aws-cdk-lib/aws-ecr-assets/test/image-asset.test.ts index 2b5c98a100f4d..12f3a677bf635 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/image-asset.test.ts +++ b/packages/aws-cdk-lib/aws-ecr-assets/test/image-asset.test.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import * as path from 'path'; import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { App, DefaultStackSynthesizer, DockerBuildSecret, IgnoreMode, Lazy, LegacyStackSynthesizer, Stack, Stage } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import { App, DefaultStackSynthesizer, DockerBuildSecret, IgnoreMode, Lazy, LegacyStackSynthesizer, Stack, Stage } from '../../core'; +import * as cxapi from '../../cx-api'; import { DockerImageAsset } from '../lib'; const DEMO_IMAGE_ASSET_HASH = '0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14'; diff --git a/packages/@aws-cdk/aws-ecr-assets/test/tarball-asset.test.ts b/packages/aws-cdk-lib/aws-ecr-assets/test/tarball-asset.test.ts similarity index 95% rename from packages/@aws-cdk/aws-ecr-assets/test/tarball-asset.test.ts rename to packages/aws-cdk-lib/aws-ecr-assets/test/tarball-asset.test.ts index 8975c873b9672..539225661f54b 100644 --- a/packages/@aws-cdk/aws-ecr-assets/test/tarball-asset.test.ts +++ b/packages/aws-cdk-lib/aws-ecr-assets/test/tarball-asset.test.ts @@ -1,10 +1,10 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { App, Stack, DefaultStackSynthesizer } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cxschema from '../../cloud-assembly-schema'; +import { App, Stack, DefaultStackSynthesizer } from '../../core'; +import * as cxapi from '../../cx-api'; import { TarballImageAsset } from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-ecr/.jsiirc.json b/packages/aws-cdk-lib/aws-ecr/.jsiirc.json new file mode 100644 index 0000000000000..d33995bb07968 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ecr" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ECR" + }, + "python": { + "module": "aws_cdk.aws_ecr" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ecr/README.md b/packages/aws-cdk-lib/aws-ecr/README.md new file mode 100644 index 0000000000000..a2b27343fb35d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr/README.md @@ -0,0 +1,128 @@ +# Amazon ECR Construct Library + + +This package contains constructs for working with Amazon Elastic Container Registry. + +## Repositories + +Define a repository by creating a new instance of `Repository`. A repository +holds multiple versions of a single container image. + +```ts +const repository = new ecr.Repository(this, 'Repository'); +``` + +## Image scanning + +Amazon ECR image scanning helps in identifying software vulnerabilities in your container images. You can manually scan container images stored in Amazon ECR, or you can configure your repositories to scan images when you push them to a repository. To create a new repository to scan on push, simply enable `imageScanOnPush` in the properties + +```ts +const repository = new ecr.Repository(this, 'Repo', { + imageScanOnPush: true, +}); +``` + +To create an `onImageScanCompleted` event rule and trigger the event target + +```ts +declare const repository: ecr.Repository; +declare const target: SomeTarget; + +repository.onImageScanCompleted('ImageScanComplete') + .addTarget(target); +``` + +### Authorization Token + +Besides the Amazon ECR APIs, ECR also allows the Docker CLI or a language-specific Docker library to push and pull +images from an ECR repository. However, the Docker CLI does not support native IAM authentication methods and +additional steps must be taken so that Amazon ECR can authenticate and authorize Docker push and pull requests. +More information can be found at at [Registry Authentication](https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth). + +A Docker authorization token can be obtained using the `GetAuthorizationToken` ECR API. The following code snippets +grants an IAM user access to call this API. + +```ts +const user = new iam.User(this, 'User'); +ecr.AuthorizationToken.grantRead(user); +``` + +If you access images in the [Public ECR Gallery](https://gallery.ecr.aws/) as well, it is recommended you authenticate to the registry to benefit from +higher rate and bandwidth limits. + +> See `Pricing` in https://aws.amazon.com/blogs/aws/amazon-ecr-public-a-new-public-container-registry/ and [Service quotas](https://docs.aws.amazon.com/AmazonECR/latest/public/public-service-quotas.html). + +The following code snippet grants an IAM user access to retrieve an authorization token for the public gallery. + +```ts +const user = new iam.User(this, 'User'); +ecr.PublicGalleryAuthorizationToken.grantRead(user); +``` + +This user can then proceed to login to the registry using one of the [authentication methods](https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html#public-registry-auth). + +### Image tag immutability + +You can set tag immutability on images in our repository using the `imageTagMutability` construct prop. + +```ts +new ecr.Repository(this, 'Repo', { imageTagMutability: ecr.TagMutability.IMMUTABLE }); +``` + +### Encryption + +By default, Amazon ECR uses server-side encryption with Amazon S3-managed encryption keys which encrypts your data at rest using an AES-256 encryption algorithm. For more control over the encryption for your Amazon ECR repositories, you can use server-side encryption with KMS keys stored in AWS Key Management Service (AWS KMS). Read more about this feature in the [ECR Developer Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/encryption-at-rest.html). + +When you use AWS KMS to encrypt your data, you can either use the default AWS managed key, which is managed by Amazon ECR, by specifying `RepositoryEncryption.KMS` in the `encryption` property. Or specify your own customer managed KMS key, by specifying the `encryptionKey` property. + +When `encryptionKey` is set, the `encryption` property must be `KMS` or empty. + +In the case `encryption` is set to `KMS` but no `encryptionKey` is set, an AWS managed KMS key is used. + +```ts +new ecr.Repository(this, 'Repo', { + encryption: ecr.RepositoryEncryption.KMS +}); +``` + +Otherwise, a customer-managed KMS key is used if `encryptionKey` was set and `encryption` was optionally set to `KMS`. + +```ts +import * as kms from 'aws-cdk-lib/aws-kms'; + +new ecr.Repository(this, 'Repo', { + encryptionKey: new kms.Key(this, 'Key'), +}); +``` + +## Automatically clean up repositories + +You can set life cycle rules to automatically clean up old images from your +repository. The first life cycle rule that matches an image will be applied +against that image. For example, the following deletes images older than +30 days, while keeping all images tagged with prod (note that the order +is important here): + +```ts +declare const repository: ecr.Repository; +repository.addLifecycleRule({ tagPrefixList: ['prod'], maxImageCount: 9999 }); +repository.addLifecycleRule({ maxImageAge: Duration.days(30) }); +``` + +### Repository deletion + +When a repository is removed from a stack (or the stack is deleted), the ECR +repository will be removed according to its removal policy (which by default will +simply orphan the repository and leave it in your AWS account). If the removal +policy is set to `RemovalPolicy.DESTROY`, the repository will be deleted as long +as it does not contain any images. + +To override this and force all images to get deleted during repository deletion, +enable the`autoDeleteImages` option. + +```ts +const repository = new Repository(this, 'MyTempRepo', { + removalPolicy: RemovalPolicy.DESTROY, + autoDeleteImages: true, +}); +``` diff --git a/packages/aws-cdk-lib/aws-ecr/index.ts b/packages/aws-cdk-lib/aws-ecr/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ecr/lib/auth-token.ts b/packages/aws-cdk-lib/aws-ecr/lib/auth-token.ts similarity index 97% rename from packages/@aws-cdk/aws-ecr/lib/auth-token.ts rename to packages/aws-cdk-lib/aws-ecr/lib/auth-token.ts index 63484bbed0199..cf4b027d6c37f 100644 --- a/packages/@aws-cdk/aws-ecr/lib/auth-token.ts +++ b/packages/aws-cdk-lib/aws-ecr/lib/auth-token.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; /** * Authorization token to access private ECR repositories in the current environment via Docker CLI. diff --git a/packages/@aws-cdk/aws-ecr/lib/auto-delete-images-handler/index.ts b/packages/aws-cdk-lib/aws-ecr/lib/auto-delete-images-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecr/lib/auto-delete-images-handler/index.ts rename to packages/aws-cdk-lib/aws-ecr/lib/auto-delete-images-handler/index.ts diff --git a/packages/@aws-cdk/aws-ecr/lib/index.ts b/packages/aws-cdk-lib/aws-ecr/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecr/lib/index.ts rename to packages/aws-cdk-lib/aws-ecr/lib/index.ts diff --git a/packages/@aws-cdk/aws-ecr/lib/lifecycle.ts b/packages/aws-cdk-lib/aws-ecr/lib/lifecycle.ts similarity index 97% rename from packages/@aws-cdk/aws-ecr/lib/lifecycle.ts rename to packages/aws-cdk-lib/aws-ecr/lib/lifecycle.ts index 1e3be2a5fb90e..8349745be5599 100644 --- a/packages/@aws-cdk/aws-ecr/lib/lifecycle.ts +++ b/packages/aws-cdk-lib/aws-ecr/lib/lifecycle.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../core'; /** * An ECR life cycle rule diff --git a/packages/aws-cdk-lib/aws-ecr/lib/repository.ts b/packages/aws-cdk-lib/aws-ecr/lib/repository.ts new file mode 100644 index 0000000000000..286505b641c73 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecr/lib/repository.ts @@ -0,0 +1,900 @@ +import { EOL } from 'os'; +import * as path from 'path'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { + ArnFormat, + IResource, + Lazy, + RemovalPolicy, + Resource, + Stack, + Tags, + Token, + TokenComparison, + CustomResource, + CustomResourceProvider, + CustomResourceProviderRuntime, +} from '../../core'; +import { IConstruct, Construct } from 'constructs'; +import { CfnRepository } from './ecr.generated'; +import { LifecycleRule, TagStatus } from './lifecycle'; + +const AUTO_DELETE_IMAGES_RESOURCE_TYPE = 'Custom::ECRAutoDeleteImages'; +const AUTO_DELETE_IMAGES_TAG = 'aws-cdk:auto-delete-images'; + +/** + * Represents an ECR repository. + */ +export interface IRepository extends IResource { + /** + * The name of the repository + * @attribute + */ + readonly repositoryName: string; + + /** + * The ARN of the repository + * @attribute + */ + readonly repositoryArn: string; + + /** + * The URI of this repository (represents the latest image): + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY + * + * @attribute + */ + readonly repositoryUri: string; + + /** + * Returns the URI of the repository for a certain tag. Can be used in `docker push/pull`. + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] + * + * @param tag Image tag to use (tools usually default to "latest" if omitted) + */ + repositoryUriForTag(tag?: string): string; + + /** + * Returns the URI of the repository for a certain digest. Can be used in `docker push/pull`. + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] + * + * @param digest Image digest to use (tools usually default to the image with the "latest" tag if omitted) + */ + repositoryUriForDigest(digest?: string): string; + + /** + * Returns the URI of the repository for a certain tag or digest, inferring based on the syntax of the tag. Can be used in `docker push/pull`. + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] + * + * @param tagOrDigest Image tag or digest to use (tools usually default to the image with the "latest" tag if omitted) + */ + repositoryUriForTagOrDigest(tagOrDigest?: string): string; + + /** + * Add a policy statement to the repository's resource policy + */ + addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult; + + /** + * Grant the given principal identity permissions to perform the actions on this repository + */ + grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant; + + /** + * Grant the given identity permissions to pull images in this repository. + */ + grantPull(grantee: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity permissions to pull and push images to this repository. + */ + grantPullPush(grantee: iam.IGrantable): iam.Grant; + + /** + * Define a CloudWatch event that triggers when something happens to this repository + * + * Requires that there exists at least one CloudTrail Trail in your account + * that captures the event. This method will not create the Trail. + * + * @param id The id of the rule + * @param options Options for adding the rule + */ + onCloudTrailEvent(id: string, options?: events.OnEventOptions): events.Rule; + + /** + * Defines an AWS CloudWatch event rule that can trigger a target when an image is pushed to this + * repository. + * + * Requires that there exists at least one CloudTrail Trail in your account + * that captures the event. This method will not create the Trail. + * + * @param id The id of the rule + * @param options Options for adding the rule + */ + onCloudTrailImagePushed(id: string, options?: OnCloudTrailImagePushedOptions): events.Rule; + + /** + * Defines an AWS CloudWatch event rule that can trigger a target when the image scan is completed + * + * + * @param id The id of the rule + * @param options Options for adding the rule + */ + onImageScanCompleted(id: string, options?: OnImageScanCompletedOptions): events.Rule; + + /** + * Defines a CloudWatch event rule which triggers for repository events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + onEvent(id: string, options?: events.OnEventOptions): events.Rule; +} + +/** + * Base class for ECR repository. Reused between imported repositories and owned repositories. + */ +export abstract class RepositoryBase extends Resource implements IRepository { + /** + * The name of the repository + */ + public abstract readonly repositoryName: string; + + /** + * The ARN of the repository + */ + public abstract readonly repositoryArn: string; + + /** + * Add a policy statement to the repository's resource policy + */ + public abstract addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult; + + /** + * The URI of this repository (represents the latest image): + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY + * + */ + public get repositoryUri() { + return this.repositoryUriForTag(); + } + + /** + * Returns the URL of the repository. Can be used in `docker push/pull`. + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] + * + * @param tag Optional image tag + */ + public repositoryUriForTag(tag?: string): string { + const tagSuffix = tag ? `:${tag}` : ''; + return this.repositoryUriWithSuffix(tagSuffix); + } + + /** + * Returns the URL of the repository. Can be used in `docker push/pull`. + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] + * + * @param digest Optional image digest + */ + public repositoryUriForDigest(digest?: string): string { + const digestSuffix = digest ? `@${digest}` : ''; + return this.repositoryUriWithSuffix(digestSuffix); + } + + /** + * Returns the URL of the repository. Can be used in `docker push/pull`. + * + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[:TAG] + * ACCOUNT.dkr.ecr.REGION.amazonaws.com/REPOSITORY[@DIGEST] + * + * @param tagOrDigest Optional image tag or digest (digests must start with `sha256:`) + */ + public repositoryUriForTagOrDigest(tagOrDigest?: string): string { + if (tagOrDigest?.startsWith('sha256:')) { + return this.repositoryUriForDigest(tagOrDigest); + } else { + return this.repositoryUriForTag(tagOrDigest); + } + } + + /** + * Returns the repository URI, with an appended suffix, if provided. + * @param suffix An image tag or an image digest. + * @private + */ + private repositoryUriWithSuffix(suffix?: string): string { + const parts = this.stack.splitArn(this.repositoryArn, ArnFormat.SLASH_RESOURCE_NAME); + return `${parts.account}.dkr.ecr.${parts.region}.${this.stack.urlSuffix}/${this.repositoryName}${suffix}`; + } + + /** + * Define a CloudWatch event that triggers when something happens to this repository + * + * Requires that there exists at least one CloudTrail Trail in your account + * that captures the event. This method will not create the Trail. + * + * @param id The id of the rule + * @param options Options for adding the rule + */ + public onCloudTrailEvent(id: string, options: events.OnEventOptions = {}): events.Rule { + const rule = new events.Rule(this, id, options); + rule.addTarget(options.target); + rule.addEventPattern({ + source: ['aws.ecr'], + detailType: ['AWS API Call via CloudTrail'], + detail: { + requestParameters: { + repositoryName: [this.repositoryName], + }, + }, + }); + return rule; + } + + /** + * Defines an AWS CloudWatch event rule that can trigger a target when an image is pushed to this + * repository. + * + * Requires that there exists at least one CloudTrail Trail in your account + * that captures the event. This method will not create the Trail. + * + * @param id The id of the rule + * @param options Options for adding the rule + */ + public onCloudTrailImagePushed(id: string, options: OnCloudTrailImagePushedOptions = {}): events.Rule { + const rule = this.onCloudTrailEvent(id, options); + rule.addEventPattern({ + detail: { + eventName: ['PutImage'], + requestParameters: { + imageTag: options.imageTag ? [options.imageTag] : undefined, + }, + }, + }); + return rule; + } + /** + * Defines an AWS CloudWatch event rule that can trigger a target when an image scan is completed + * + * + * @param id The id of the rule + * @param options Options for adding the rule + */ + public onImageScanCompleted(id: string, options: OnImageScanCompletedOptions = {}): events.Rule { + const rule = new events.Rule(this, id, options); + rule.addTarget(options.target); + rule.addEventPattern({ + source: ['aws.ecr'], + detailType: ['ECR Image Scan'], + detail: { + 'repository-name': [this.repositoryName], + 'scan-status': ['COMPLETE'], + 'image-tags': options.imageTags ?? undefined, + }, + }); + return rule; + } + + /** + * Defines a CloudWatch event rule which triggers for repository events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + public onEvent(id: string, options: events.OnEventOptions = {}) { + const rule = new events.Rule(this, id, options); + rule.addEventPattern({ + source: ['aws.ecr'], + resources: [this.repositoryArn], + }); + rule.addTarget(options.target); + return rule; + } + + /** + * Grant the given principal identity permissions to perform the actions on this repository + */ + public grant(grantee: iam.IGrantable, ...actions: string[]) { + const crossAccountPrincipal = this.unsafeCrossAccountResourcePolicyPrincipal(grantee); + if (crossAccountPrincipal) { + // If the principal is from a different account, + // that means addToPrincipalOrResource() will update the Resource Policy of this repo to trust that principal. + // However, ECR verifies that the principal used in the Policy exists, + // and will error out if it doesn't. + // Because of that, if the principal is a newly created resource, + // and there is not a dependency relationship between the Stacks of this repo and the principal, + // trust the entire account of the principal instead + // (otherwise, deploying this repo will fail). + // To scope down the permissions as much as possible, + // only trust principals from that account with a specific tag + const crossAccountPrincipalStack = Stack.of(crossAccountPrincipal); + const roleTag = `${crossAccountPrincipalStack.stackName}_${crossAccountPrincipal.node.addr}`; + Tags.of(crossAccountPrincipal).add('aws-cdk:id', roleTag); + this.addToResourcePolicy(new iam.PolicyStatement({ + actions, + principals: [new iam.AccountPrincipal(crossAccountPrincipalStack.account)], + conditions: { + StringEquals: { 'aws:PrincipalTag/aws-cdk:id': roleTag }, + }, + })); + + return iam.Grant.addToPrincipal({ + grantee, + actions, + resourceArns: [this.repositoryArn], + scope: this, + }); + } else { + return iam.Grant.addToPrincipalOrResource({ + grantee, + actions, + resourceArns: [this.repositoryArn], + resourceSelfArns: [], + resource: this, + }); + } + } + + /** + * Grant the given identity permissions to use the images in this repository + */ + public grantPull(grantee: iam.IGrantable) { + const ret = this.grant(grantee, 'ecr:BatchCheckLayerAvailability', 'ecr:GetDownloadUrlForLayer', 'ecr:BatchGetImage'); + + iam.Grant.addToPrincipal({ + grantee, + actions: ['ecr:GetAuthorizationToken'], + resourceArns: ['*'], + scope: this, + }); + + return ret; + } + + /** + * Grant the given identity permissions to pull and push images to this repository. + */ + public grantPullPush(grantee: iam.IGrantable) { + this.grantPull(grantee); + return this.grant(grantee, + 'ecr:PutImage', + 'ecr:InitiateLayerUpload', + 'ecr:UploadLayerPart', + 'ecr:CompleteLayerUpload'); + } + + /** + * Returns the resource that backs the given IAM grantee if we cannot put a direct reference + * to the grantee in the resource policy of this ECR repository, + * and 'undefined' in case we can. + */ + private unsafeCrossAccountResourcePolicyPrincipal(grantee: iam.IGrantable): IConstruct | undefined { + // A principal cannot be safely added to the Resource Policy of this ECR repository, if: + // 1. The principal is from a different account, and + // 2. The principal is a new resource (meaning, not just referenced), and + // 3. The Stack this repo belongs to doesn't depend on the Stack the principal belongs to. + + // condition #1 + const principal = grantee.grantPrincipal; + const principalAccount = principal.principalAccount; + if (!principalAccount) { + return undefined; + } + const repoAndPrincipalAccountCompare = Token.compareStrings(this.env.account, principalAccount); + if (repoAndPrincipalAccountCompare === TokenComparison.BOTH_UNRESOLVED || + repoAndPrincipalAccountCompare === TokenComparison.SAME) { + return undefined; + } + + // condition #2 + if (!iam.principalIsOwnedResource(principal)) { + return undefined; + } + + // condition #3 + const principalStack = Stack.of(principal); + if (this.stack.dependencies.includes(principalStack)) { + return undefined; + } + + return principal; + } +} + +/** + * Options for the onCloudTrailImagePushed method + */ +export interface OnCloudTrailImagePushedOptions extends events.OnEventOptions { + /** + * Only watch changes to this image tag + * + * @default - Watch changes to all tags + */ + readonly imageTag?: string; +} + +/** + * Options for the OnImageScanCompleted method + */ +export interface OnImageScanCompletedOptions extends events.OnEventOptions { + /** + * Only watch changes to the image tags spedified. + * Leave it undefined to watch the full repository. + * + * @default - Watch the changes to the repository with all image tags + */ + readonly imageTags?: string[]; +} + +export interface RepositoryProps { + /** + * Name for this repository + * + * @default Automatically generated name. + */ + readonly repositoryName?: string; + + /** + * The kind of server-side encryption to apply to this repository. + * + * If you choose KMS, you can specify a KMS key via `encryptionKey`. If + * encryptionKey is not specified, an AWS managed KMS key is used. + * + * @default - `KMS` if `encryptionKey` is specified, or `AES256` otherwise. + */ + readonly encryption?: RepositoryEncryption; + + /** + * External KMS key to use for repository encryption. + * + * The 'encryption' property must be either not specified or set to "KMS". + * An error will be emitted if encryption is set to "AES256". + * + * @default - If encryption is set to `KMS` and this property is undefined, + * an AWS managed KMS key is used. + */ + readonly encryptionKey?: kms.IKey; + + /** + * Life cycle rules to apply to this registry + * + * @default No life cycle rules + */ + readonly lifecycleRules?: LifecycleRule[]; + + /** + * The AWS account ID associated with the registry that contains the repository. + * + * @see https://docs.aws.amazon.com/AmazonECR/latest/APIReference/API_PutLifecyclePolicy.html + * @default The default registry is assumed. + */ + readonly lifecycleRegistryId?: string; + + /** + * Determine what happens to the repository when the resource/stack is deleted. + * + * @default RemovalPolicy.Retain + */ + readonly removalPolicy?: RemovalPolicy; + + /** + * Enable the scan on push when creating the repository + * + * @default false + */ + readonly imageScanOnPush?: boolean; + + /** + * The tag mutability setting for the repository. If this parameter is omitted, the default setting of MUTABLE will be used which will allow image tags to be overwritten. + * + * @default TagMutability.MUTABLE + */ + readonly imageTagMutability?: TagMutability; + + /** + * Whether all images should be automatically deleted when the repository is + * removed from the stack or when the stack is deleted. + * + * Requires the `removalPolicy` to be set to `RemovalPolicy.DESTROY`. + * + * @default false + */ + readonly autoDeleteImages?: boolean; +} + +export interface RepositoryAttributes { + readonly repositoryName: string; + readonly repositoryArn: string; +} + +/** + * Define an ECR repository + */ +export class Repository extends RepositoryBase { + /** + * Import a repository + */ + public static fromRepositoryAttributes(scope: Construct, id: string, attrs: RepositoryAttributes): IRepository { + class Import extends RepositoryBase { + public readonly repositoryName = attrs.repositoryName; + public readonly repositoryArn = attrs.repositoryArn; + + public addToResourcePolicy(_statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { + // dropped + return { statementAdded: false }; + } + } + + return new Import(scope, id); + } + + public static fromRepositoryArn(scope: Construct, id: string, repositoryArn: string): IRepository { + + // if repositoryArn is a token, the repository name is also required. this is because + // repository names can include "/" (e.g. foo/bar/myrepo) and it is impossible to + // parse the name from an ARN using CloudFormation's split/select. + if (Token.isUnresolved(repositoryArn)) { + throw new Error('"repositoryArn" is a late-bound value, and therefore "repositoryName" is required. Use `fromRepositoryAttributes` instead'); + } + + const repositoryName = repositoryArn.split('/').slice(1).join('/'); + + class Import extends RepositoryBase { + public repositoryName = repositoryName; + public repositoryArn = repositoryArn; + + public addToResourcePolicy(_statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { + // dropped + return { statementAdded: false }; + } + } + + return new Import(scope, id, { + environmentFromArn: repositoryArn, + }); + } + + public static fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository { + class Import extends RepositoryBase { + public repositoryName = repositoryName; + public repositoryArn = Repository.arnForLocalRepository(repositoryName, scope); + + public addToResourcePolicy(_statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { + // dropped + return { statementAdded: false }; + } + } + + return new Import(scope, id); + } + + /** + * Returns an ECR ARN for a repository that resides in the same account/region + * as the current stack. + */ + public static arnForLocalRepository(repositoryName: string, scope: IConstruct, account?: string): string { + return Stack.of(scope).formatArn({ + account, + service: 'ecr', + resource: 'repository', + resourceName: repositoryName, + }); + } + + private static validateRepositoryName(physicalName: string) { + const repositoryName = physicalName; + if (!repositoryName || Token.isUnresolved(repositoryName)) { + // the name is a late-bound value, not a defined string, + // so skip validation + return; + } + + const errors: string[] = []; + + // Rules codified from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html + if (repositoryName.length < 2 || repositoryName.length > 256) { + errors.push('Repository name must be at least 2 and no more than 256 characters'); + } + const isPatternMatch = /^(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)*[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(repositoryName); + if (!isPatternMatch) { + errors.push('Repository name must follow the specified pattern: (?:[a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*'); + } + + if (errors.length > 0) { + throw new Error(`Invalid ECR repository name (value: ${repositoryName})${EOL}${errors.join(EOL)}`); + } + } + + public readonly repositoryName: string; + public readonly repositoryArn: string; + private readonly lifecycleRules = new Array(); + private readonly registryId?: string; + private policyDocument?: iam.PolicyDocument; + private readonly _resource: CfnRepository; + + constructor(scope: Construct, id: string, props: RepositoryProps = {}) { + super(scope, id, { + physicalName: props.repositoryName, + }); + + Repository.validateRepositoryName(this.physicalName); + + const resource = new CfnRepository(this, 'Resource', { + repositoryName: this.physicalName, + // It says "Text", but they actually mean "Object". + repositoryPolicyText: Lazy.any({ produce: () => this.policyDocument }), + lifecyclePolicy: Lazy.any({ produce: () => this.renderLifecyclePolicy() }), + imageScanningConfiguration: props.imageScanOnPush !== undefined ? { scanOnPush: props.imageScanOnPush } : undefined, + imageTagMutability: props.imageTagMutability || undefined, + encryptionConfiguration: this.parseEncryption(props), + }); + this._resource = resource; + + if (props.autoDeleteImages) { + if (props.removalPolicy !== RemovalPolicy.DESTROY) { + throw new Error('Cannot use \'autoDeleteImages\' property on a repository without setting removal policy to \'DESTROY\'.'); + } + this.enableAutoDeleteImages(); + } + + resource.applyRemovalPolicy(props.removalPolicy); + + this.registryId = props.lifecycleRegistryId; + if (props.lifecycleRules) { + props.lifecycleRules.forEach(this.addLifecycleRule.bind(this)); + } + + this.repositoryName = this.getResourceNameAttribute(resource.ref); + this.repositoryArn = this.getResourceArnAttribute(resource.attrArn, { + service: 'ecr', + resource: 'repository', + resourceName: this.physicalName, + }); + + this.node.addValidation({ validate: () => this.policyDocument?.validateForResourcePolicy() ?? [] }); + } + + public addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { + if (this.policyDocument === undefined) { + this.policyDocument = new iam.PolicyDocument(); + } + this.policyDocument.addStatements(statement); + return { statementAdded: true, policyDependable: this.policyDocument }; + } + + /** + * Add a life cycle rule to the repository + * + * Life cycle rules automatically expire images from the repository that match + * certain conditions. + */ + public addLifecycleRule(rule: LifecycleRule) { + // Validate rule here so users get errors at the expected location + if (rule.tagStatus === undefined) { + rule = { ...rule, tagStatus: rule.tagPrefixList === undefined ? TagStatus.ANY : TagStatus.TAGGED }; + } + + if (rule.tagStatus === TagStatus.TAGGED && (rule.tagPrefixList === undefined || rule.tagPrefixList.length === 0)) { + throw new Error('TagStatus.Tagged requires the specification of a tagPrefixList'); + } + if (rule.tagStatus !== TagStatus.TAGGED && rule.tagPrefixList !== undefined) { + throw new Error('tagPrefixList can only be specified when tagStatus is set to Tagged'); + } + if ((rule.maxImageAge !== undefined) === (rule.maxImageCount !== undefined)) { + throw new Error(`Life cycle rule must contain exactly one of 'maxImageAge' and 'maxImageCount', got: ${JSON.stringify(rule)}`); + } + + if (rule.tagStatus === TagStatus.ANY && this.lifecycleRules.filter(r => r.tagStatus === TagStatus.ANY).length > 0) { + throw new Error('Life cycle can only have one TagStatus.Any rule'); + } + + this.lifecycleRules.push({ ...rule }); + } + + /** + * Render the life cycle policy object + */ + private renderLifecyclePolicy(): CfnRepository.LifecyclePolicyProperty | undefined { + const stack = Stack.of(this); + let lifecyclePolicyText: any; + + if (this.lifecycleRules.length === 0 && !this.registryId) { return undefined; } + + if (this.lifecycleRules.length > 0) { + lifecyclePolicyText = JSON.stringify(stack.resolve({ + rules: this.orderedLifecycleRules().map(renderLifecycleRule), + })); + } + + return { + lifecyclePolicyText, + registryId: this.registryId, + }; + } + + /** + * Return life cycle rules with automatic ordering applied. + * + * Also applies validation of the 'any' rule. + */ + private orderedLifecycleRules(): LifecycleRule[] { + if (this.lifecycleRules.length === 0) { return []; } + + const prioritizedRules = this.lifecycleRules.filter(r => r.rulePriority !== undefined && r.tagStatus !== TagStatus.ANY); + const autoPrioritizedRules = this.lifecycleRules.filter(r => r.rulePriority === undefined && r.tagStatus !== TagStatus.ANY); + const anyRules = this.lifecycleRules.filter(r => r.tagStatus === TagStatus.ANY); + if (anyRules.length > 0 && anyRules[0].rulePriority !== undefined && autoPrioritizedRules.length > 0) { + // Supporting this is too complex for very little value. We just prohibit it. + throw new Error("Cannot combine prioritized TagStatus.Any rule with unprioritized rules. Remove rulePriority from the 'Any' rule."); + } + + const prios = prioritizedRules.map(r => r.rulePriority!); + let autoPrio = (prios.length > 0 ? Math.max(...prios) : 0) + 1; + + const ret = new Array(); + for (const rule of prioritizedRules.concat(autoPrioritizedRules).concat(anyRules)) { + ret.push({ + ...rule, + rulePriority: rule.rulePriority ?? autoPrio++, + }); + } + + // Do validation on the final array--might still be wrong because the user supplied all prios, but incorrectly. + validateAnyRuleLast(ret); + return ret; + } + + /** + * Set up key properties and return the Repository encryption property from the + * user's configuration. + */ + private parseEncryption(props: RepositoryProps): CfnRepository.EncryptionConfigurationProperty | undefined { + + // default based on whether encryptionKey is specified + const encryptionType = props.encryption ?? (props.encryptionKey ? RepositoryEncryption.KMS : RepositoryEncryption.AES_256); + + // if encryption key is set, encryption must be set to KMS. + if (encryptionType !== RepositoryEncryption.KMS && props.encryptionKey) { + throw new Error(`encryptionKey is specified, so 'encryption' must be set to KMS (value: ${encryptionType.value})`); + } + + if (encryptionType === RepositoryEncryption.AES_256) { + return undefined; + } + + if (encryptionType === RepositoryEncryption.KMS) { + return { + encryptionType: 'KMS', + kmsKey: props.encryptionKey?.keyArn, + }; + } + + throw new Error(`Unexpected 'encryptionType': ${encryptionType}`); + } + + private enableAutoDeleteImages() { + // Use a iam policy to allow the custom resource to list & delete + // images in the repository and the ability to get all repositories to find the arn needed on delete. + const provider = CustomResourceProvider.getOrCreateProvider(this, AUTO_DELETE_IMAGES_RESOURCE_TYPE, { + codeDirectory: path.join(__dirname, 'auto-delete-images-handler'), + runtime: CustomResourceProviderRuntime.NODEJS_14_X, + description: `Lambda function for auto-deleting images in ${this.repositoryName} repository.`, + policyStatements: [ + { + Effect: 'Allow', + Action: [ + 'ecr:BatchDeleteImage', + 'ecr:DescribeRepositories', + 'ecr:ListImages', + 'ecr:ListTagsForResource', + ], + Resource: [this._resource.attrArn], + }, + ], + }); + + const customResource = new CustomResource(this, 'AutoDeleteImagesCustomResource', { + resourceType: AUTO_DELETE_IMAGES_RESOURCE_TYPE, + serviceToken: provider.serviceToken, + properties: { + RepositoryName: Lazy.any({ produce: () => this.repositoryName }), + }, + }); + customResource.node.addDependency(this); + + // We also tag the repository to record the fact that we want it autodeleted. + // The custom resource will check this tag before actually doing the delete. + // Because tagging and untagging will ALWAYS happen before the CR is deleted, + // we can set `autoDeleteImages: false` without the removal of the CR emptying + // the repository as a side effect. + Tags.of(this._resource).add(AUTO_DELETE_IMAGES_TAG, 'true'); + } +} + +function validateAnyRuleLast(rules: LifecycleRule[]) { + const anyRules = rules.filter(r => r.tagStatus === TagStatus.ANY); + if (anyRules.length === 1) { + const maxPrio = Math.max(...rules.map(r => r.rulePriority!)); + if (anyRules[0].rulePriority !== maxPrio) { + throw new Error(`TagStatus.Any rule must have highest priority, has ${anyRules[0].rulePriority} which is smaller than ${maxPrio}`); + } + } +} + +/** + * Render the lifecycle rule to JSON + */ +function renderLifecycleRule(rule: LifecycleRule) { + return { + rulePriority: rule.rulePriority, + description: rule.description, + selection: { + tagStatus: rule.tagStatus || TagStatus.ANY, + tagPrefixList: rule.tagPrefixList, + countType: rule.maxImageAge !== undefined ? CountType.SINCE_IMAGE_PUSHED : CountType.IMAGE_COUNT_MORE_THAN, + countNumber: rule.maxImageAge?.toDays() ?? rule.maxImageCount, + countUnit: rule.maxImageAge !== undefined ? 'days' : undefined, + }, + action: { + type: 'expire', + }, + }; +} + +/** + * Select images based on counts + */ +const enum CountType { + /** + * Set a limit on the number of images in your repository + */ + IMAGE_COUNT_MORE_THAN = 'imageCountMoreThan', + + /** + * Set an age limit on the images in your repository + */ + SINCE_IMAGE_PUSHED = 'sinceImagePushed', +} + +/** + * The tag mutability setting for your repository. + */ +export enum TagMutability { + /** + * allow image tags to be overwritten. + */ + MUTABLE = 'MUTABLE', + + /** + * all image tags within the repository will be immutable which will prevent them from being overwritten. + */ + IMMUTABLE = 'IMMUTABLE', + +} + +/** + * Indicates whether server-side encryption is enabled for the object, and whether that encryption is + * from the AWS Key Management Service (AWS KMS) or from Amazon S3 managed encryption (SSE-S3). + * @see https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#SysMetadata + */ +export class RepositoryEncryption { + /** + * 'AES256' + */ + public static readonly AES_256 = new RepositoryEncryption('AES256'); + /** + * 'KMS' + */ + public static readonly KMS = new RepositoryEncryption('KMS'); + + /** + * @param value the string value of the encryption + */ + protected constructor(public readonly value: string) { } +} diff --git a/packages/@aws-cdk/aws-ecr/test/auth-token.test.ts b/packages/aws-cdk-lib/aws-ecr/test/auth-token.test.ts similarity index 90% rename from packages/@aws-cdk/aws-ecr/test/auth-token.test.ts rename to packages/aws-cdk-lib/aws-ecr/test/auth-token.test.ts index 421ba7c2f6645..c7b0914260b1a 100644 --- a/packages/@aws-cdk/aws-ecr/test/auth-token.test.ts +++ b/packages/aws-cdk-lib/aws-ecr/test/auth-token.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { Stack } from '../../core'; import { AuthorizationToken, PublicGalleryAuthorizationToken } from '../lib'; describe('auth-token', () => { diff --git a/packages/@aws-cdk/aws-ecr/test/auto-delete-images-handler.test.ts b/packages/aws-cdk-lib/aws-ecr/test/auto-delete-images-handler.test.ts similarity index 100% rename from packages/@aws-cdk/aws-ecr/test/auto-delete-images-handler.test.ts rename to packages/aws-cdk-lib/aws-ecr/test/auto-delete-images-handler.test.ts diff --git a/packages/@aws-cdk/aws-ecr/test/repository.test.ts b/packages/aws-cdk-lib/aws-ecr/test/repository.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ecr/test/repository.test.ts rename to packages/aws-cdk-lib/aws-ecr/test/repository.test.ts index 84ea9d1a9930f..c4c3d0de1bf2e 100644 --- a/packages/@aws-cdk/aws-ecr/test/repository.test.ts +++ b/packages/aws-cdk-lib/aws-ecr/test/repository.test.ts @@ -1,8 +1,8 @@ import { EOL } from 'os'; -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as cdk from '../../core'; import * as ecr from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/.jsiirc.json b/packages/aws-cdk-lib/aws-ecs-patterns/.jsiirc.json new file mode 100644 index 0000000000000..bc9b2face9da3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ecs.patterns" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ECS.Patterns" + }, + "python": { + "module": "aws_cdk.aws_ecs_patterns" + } + } +} diff --git a/packages/@aws-cdk/aws-ecs-patterns/CONTRIBUTING.md b/packages/aws-cdk-lib/aws-ecs-patterns/CONTRIBUTING.md similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/CONTRIBUTING.md rename to packages/aws-cdk-lib/aws-ecs-patterns/CONTRIBUTING.md diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/README.md b/packages/aws-cdk-lib/aws-ecs-patterns/README.md new file mode 100644 index 0000000000000..b052fea3eec4c --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/README.md @@ -0,0 +1,984 @@ +# CDK Construct library for higher-level ECS Constructs + + +This library provides higher-level Amazon ECS constructs which follow common architectural patterns. It contains: + +* Application Load Balanced Services +* Network Load Balanced Services +* Queue Processing Services +* Scheduled Tasks (cron jobs) +* Additional Examples + +## Application Load Balanced Services + +To define an Amazon ECS service that is behind an application load balancer, instantiate one of the following: + +* `ApplicationLoadBalancedEc2Service` + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedEcsService = new ecsPatterns.ApplicationLoadBalancedEc2Service(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('test'), + environment: { + TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", + TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", + }, + command: ['command'], + entryPoint: ['entry', 'point'], + }, + desiredCount: 2, +}); +``` + +* `ApplicationLoadBalancedFargateService` + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + command: ['command'], + entryPoint: ['entry', 'point'], + }, +}); + +loadBalancedFargateService.targetGroup.configureHealthCheck({ + path: "/custom-health-path", +}); +``` + +Instead of providing a cluster you can specify a VPC and CDK will create a new ECS cluster. +If you deploy multiple services CDK will only create one cluster per VPC. + +You can omit `cluster` and `vpc` to let CDK create a new VPC with two AZs and create a cluster inside this VPC. + +You can customize the health check for your target group; otherwise it defaults to `HTTP` over port `80` hitting path `/`. + +Fargate services will use the `LATEST` platform version by default, but you can override by providing a value for the `platformVersion` property in the constructor. + +Fargate services use the default VPC Security Group unless one or more are provided using the `securityGroups` property in the constructor. + +By setting `redirectHTTP` to true, CDK will automatically create a listener on port 80 that redirects HTTP traffic to the HTTPS port. + +If you specify the option `recordType` you can decide if you want the construct to use CNAME or Route53-Aliases as record sets. + +If you need to encrypt the traffic between the load balancer and the ECS tasks, you can set the `targetProtocol` to `HTTPS`. + +Additionally, if more than one application target group are needed, instantiate one of the following: + +* `ApplicationMultipleTargetGroupsEc2Service` + +```ts +// One application load balancer with one listener and two target groups. +declare const cluster: ecs.Cluster; +const loadBalancedEc2Service = new ecsPatterns.ApplicationMultipleTargetGroupsEc2Service(this, 'Service', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + targetGroups: [ + { + containerPort: 80, + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + }, + ], +}); +``` + +* `ApplicationMultipleTargetGroupsFargateService` + +```ts +// One application load balancer with one listener and two target groups. +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + targetGroups: [ + { + containerPort: 80, + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + }, + ], +}); +``` + +## Network Load Balanced Services + +To define an Amazon ECS service that is behind a network load balancer, instantiate one of the following: + +* `NetworkLoadBalancedEc2Service` + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedEcsService = new ecsPatterns.NetworkLoadBalancedEc2Service(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('test'), + environment: { + TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", + TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", + }, + }, + desiredCount: 2, +}); +``` + +* `NetworkLoadBalancedFargateService` + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, +}); +``` + +The CDK will create a new Amazon ECS cluster if you specify a VPC and omit `cluster`. If you deploy multiple services the CDK will only create one cluster per VPC. + +If `cluster` and `vpc` are omitted, the CDK creates a new VPC with subnets in two Availability Zones and a cluster within this VPC. + +If you specify the option `recordType` you can decide if you want the construct to use CNAME or Route53-Aliases as record sets. + +Additionally, if more than one network target group is needed, instantiate one of the following: + +* NetworkMultipleTargetGroupsEc2Service + +```ts +// Two network load balancers, each with their own listener and target group. +declare const cluster: ecs.Cluster; +const loadBalancedEc2Service = new ecsPatterns.NetworkMultipleTargetGroupsEc2Service(this, 'Service', { + cluster, + memoryLimitMiB: 256, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +``` + +* NetworkMultipleTargetGroupsFargateService + +```ts +// Two network load balancers, each with their own listener and target group. +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.NetworkMultipleTargetGroupsFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + loadBalancers: [ + { + name: 'lb1', + listeners: [ + { + name: 'listener1', + }, + ], + }, + { + name: 'lb2', + listeners: [ + { + name: 'listener2', + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener1', + }, + { + containerPort: 90, + listener: 'listener2', + }, + ], +}); +``` + +## Queue Processing Services + +To define a service that creates a queue and reads from that queue, instantiate one of the following: + +* `QueueProcessingEc2Service` + +```ts +declare const cluster: ecs.Cluster; +const queueProcessingEc2Service = new ecsPatterns.QueueProcessingEc2Service(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + image: ecs.ContainerImage.fromRegistry('test'), + command: ["-c", "4", "amazon.com"], + enableLogging: false, + desiredTaskCount: 2, + environment: { + TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", + TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", + }, + maxScalingCapacity: 5, + containerName: 'test', +}); +``` + +* `QueueProcessingFargateService` + +```ts +declare const cluster: ecs.Cluster; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + command: ["-c", "4", "amazon.com"], + enableLogging: false, + desiredTaskCount: 2, + environment: { + TEST_ENVIRONMENT_VARIABLE1: "test environment variable 1 value", + TEST_ENVIRONMENT_VARIABLE2: "test environment variable 2 value", + }, + maxScalingCapacity: 5, + containerName: 'test', +}); +``` + +when queue not provided by user, CDK will create a primary queue and a dead letter queue with default redrive policy and attach permission to the task to be able to access the primary queue. + +## Scheduled Tasks + +To define a task that runs periodically, there are 2 options: + +* `ScheduledEc2Task` + +```ts +// Instantiate an Amazon EC2 Task to run at a scheduled interval +declare const cluster: ecs.Cluster; +const ecsScheduledTask = new ecsPatterns.ScheduledEc2Task(this, 'ScheduledTask', { + cluster, + scheduledEc2TaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 256, + environment: { name: 'TRIGGER', value: 'CloudWatch Events' }, + }, + schedule: appscaling.Schedule.expression('rate(1 minute)'), + enabled: true, + ruleName: 'sample-scheduled-task-rule', +}); +``` + +* `ScheduledFargateTask` + +```ts +declare const cluster: ecs.Cluster; +const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + }, + schedule: appscaling.Schedule.expression('rate(1 minute)'), + platformVersion: ecs.FargatePlatformVersion.LATEST, +}); +``` + +## Additional Examples + +In addition to using the constructs, users can also add logic to customize these constructs: + +### Configure HTTPS on an ApplicationLoadBalancedFargateService + +```ts +import { HostedZone } from 'aws-cdk-lib/aws-route53'; +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { SslPolicy } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; + +const domainZone = HostedZone.fromLookup(this, 'Zone', { domainName: 'example.com' }); +const certificate = Certificate.fromCertificateArn(this, 'Cert', 'arn:aws:acm:us-east-1:123456:certificate/abcdefg'); + +declare const vpc: ec2.Vpc; +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + vpc, + cluster, + certificate, + sslPolicy: SslPolicy.RECOMMENDED, + domainName: 'api.example.com', + domainZone, + redirectHTTP: true, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, +}); +``` + +### Set capacityProviderStrategies for ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +cluster.enableFargateCapacityProviders(); + +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + capacityProviderStrategies: [ + { + capacityProvider: 'FARGATE_SPOT', + weight: 2, + base: 0, + }, + { + capacityProvider: 'FARGATE', + weight: 1, + base: 1, + }, + ], +}); +``` + +### Add Schedule-Based Auto-Scaling to an ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, +}); + +const scalableTarget = loadBalancedFargateService.service.autoScaleTaskCount({ + minCapacity: 5, + maxCapacity: 20, +}); + +scalableTarget.scaleOnSchedule('DaytimeScaleDown', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0'}), + minCapacity: 1, +}); + +scalableTarget.scaleOnSchedule('EveningRushScaleUp', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0'}), + minCapacity: 10, +}); +``` + +### Add Metric-Based Auto-Scaling to an ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, +}); + +const scalableTarget = loadBalancedFargateService.service.autoScaleTaskCount({ + minCapacity: 1, + maxCapacity: 20, +}); + +scalableTarget.scaleOnCpuUtilization('CpuScaling', { + targetUtilizationPercent: 50, +}); + +scalableTarget.scaleOnMemoryUtilization('MemoryScaling', { + targetUtilizationPercent: 50, +}); +``` + +### Change the default Deployment Controller + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + deploymentController: { + type: ecs.DeploymentControllerType.CODE_DEPLOY, + }, +}); +``` + +### Deployment circuit breaker and rollback + +Amazon ECS [deployment circuit breaker](https://aws.amazon.com/tw/blogs/containers/announcing-amazon-ecs-deployment-circuit-breaker/) +automatically rolls back unhealthy service deployments without the need for manual intervention. Use `circuitBreaker` to enable +deployment circuit breaker and optionally enable `rollback` for automatic rollback. See [Using the deployment circuit breaker](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html) +for more details. + +```ts +declare const cluster: ecs.Cluster; +const service = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + circuitBreaker: { rollback: true }, +}); +``` + +### Set deployment configuration on QueueProcessingService + +```ts +declare const cluster: ecs.Cluster; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + command: ["-c", "4", "amazon.com"], + enableLogging: false, + desiredTaskCount: 2, + environment: {}, + maxScalingCapacity: 5, + maxHealthyPercent: 200, + minHealthyPercent: 66, +}); +``` + +### Set taskSubnets and securityGroups for QueueProcessingFargateService + +```ts +declare const vpc: ec2.Vpc; +declare const securityGroup: ec2.SecurityGroup; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + vpc, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + securityGroups: [securityGroup], + taskSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, +}); +``` + +### Define tasks with public IPs for QueueProcessingFargateService + +```ts +declare const vpc: ec2.Vpc; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + vpc, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + assignPublicIp: true, +}); +``` + +### Define tasks with custom queue parameters for QueueProcessingFargateService + +```ts +declare const vpc: ec2.Vpc; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + vpc, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + maxReceiveCount: 42, + retentionPeriod: Duration.days(7), + visibilityTimeout: Duration.minutes(5), +}); +``` + +### Set capacityProviderStrategies for QueueProcessingFargateService + +```ts +declare const cluster: ecs.Cluster; +cluster.enableFargateCapacityProviders(); + +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + capacityProviderStrategies: [ + { + capacityProvider: 'FARGATE_SPOT', + weight: 2, + }, + { + capacityProvider: 'FARGATE', + weight: 1, + }, + ], +}); +``` + +### Set a custom container-level Healthcheck for QueueProcessingFargateService + +```ts +declare const vpc: ec2.Vpc; +declare const securityGroup: ec2.SecurityGroup; +const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateService(this, 'Service', { + vpc, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + healthCheck: { + command: [ "CMD-SHELL", "curl -f http://localhost/ || exit 1" ], + // the properties below are optional + interval: Duration.minutes(30), + retries: 123, + startPeriod: Duration.minutes(30), + timeout: Duration.minutes(30), + }, +}); +``` + +### Set capacityProviderStrategies for QueueProcessingEc2Service + +```ts +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; + +const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); +const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'asg', { + vpc, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MICRO), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), +}); +const capacityProvider = new ecs.AsgCapacityProvider(this, 'provider', { + autoScalingGroup, +}); +cluster.addAsgCapacityProvider(capacityProvider); + +const queueProcessingEc2Service = new ecsPatterns.QueueProcessingEc2Service(this, 'Service', { + cluster, + memoryLimitMiB: 512, + image: ecs.ContainerImage.fromRegistry('test'), + capacityProviderStrategies: [ + { + capacityProvider: capacityProvider.capacityProviderName, + }, + ], +}); +``` + +### Select specific vpc subnets for ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + taskSubnets: { + subnets: [ec2.Subnet.fromSubnetId(this, 'subnet', 'VpcISOLATEDSubnet1Subnet80F07FA0')], + }, +}); +``` + +### Select idleTimeout for ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + idleTimeout: Duration.seconds(120), +}); +``` + +### Select idleTimeout for ApplicationMultipleTargetGroupsFargateService + +```ts +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { InstanceType } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { ApplicationProtocol, SslPolicy } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); +const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'myService', { + cluster: new ecs.Cluster(this, 'EcsCluster', { vpc }), + memoryLimitMiB: 256, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + enableExecuteCommand: true, + loadBalancers: [ + { + name: 'lb', + idleTimeout: Duration.seconds(400), + domainName: 'api.example.com', + domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'example.com' }), + listeners: [ + { + name: 'listener', + protocol: ApplicationProtocol.HTTPS, + certificate: Certificate.fromCertificateArn(this, 'Cert', 'helloworld'), + sslPolicy: SslPolicy.TLS12_EXT, + }, + ], + }, + { + name: 'lb2', + idleTimeout: Duration.seconds(120), + domainName: 'frontend.com', + domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'frontend.com' }), + listeners: [ + { + name: 'listener2', + protocol: ApplicationProtocol.HTTPS, + certificate: Certificate.fromCertificateArn(this, 'Cert2', 'helloworld'), + sslPolicy: SslPolicy.TLS12_EXT, + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener', + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + listener: 'listener', + }, + { + containerPort: 443, + listener: 'listener2', + }, + { + containerPort: 80, + pathPattern: 'a/b/c', + priority: 10, + listener: 'listener2', + }, + ], +}); +``` + +### Set health checks for ApplicationMultipleTargetGroupsFargateService + +```ts +import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'; +import { InstanceType } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, ContainerImage } from 'aws-cdk-lib/aws-ecs'; +import { ApplicationProtocol,Protocol, SslPolicy } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); + +const loadBalancedFargateService = new ecsPatterns.ApplicationMultipleTargetGroupsFargateService(this, 'myService', { + cluster: new ecs.Cluster(this, 'EcsCluster', { vpc }), + memoryLimitMiB: 256, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + enableExecuteCommand: true, + loadBalancers: [ + { + name: 'lb', + idleTimeout: Duration.seconds(400), + domainName: 'api.example.com', + domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'example.com' }), + listeners: [ + { + name: 'listener', + protocol: ApplicationProtocol.HTTPS, + certificate: Certificate.fromCertificateArn(this, 'Cert', 'helloworld'), + sslPolicy: SslPolicy.TLS12_EXT, + }, + ], + }, + { + name: 'lb2', + idleTimeout: Duration.seconds(120), + domainName: 'frontend.com', + domainZone: new PublicHostedZone(this, 'HostedZone', { zoneName: 'frontend.com' }), + listeners: [ + { + name: 'listener2', + protocol: ApplicationProtocol.HTTPS, + certificate: Certificate.fromCertificateArn(this, 'Cert2', 'helloworld'), + sslPolicy: SslPolicy.TLS12_EXT, + }, + ], + }, + ], + targetGroups: [ + { + containerPort: 80, + listener: 'listener', + }, + { + containerPort: 90, + pathPattern: 'a/b/c', + priority: 10, + listener: 'listener', + }, + { + containerPort: 443, + listener: 'listener2', + }, + { + containerPort: 80, + pathPattern: 'a/b/c', + priority: 10, + listener: 'listener2', + }, + ], +}); + +loadBalancedFargateService.targetGroups[0].configureHealthCheck({ + port: '8050', + protocol: Protocol.HTTP, + healthyThresholdCount: 2, + unhealthyThresholdCount: 2, + timeout: Duration.seconds(10), + interval: Duration.seconds(30), + healthyHttpCodes: '200', +}); + + +loadBalancedFargateService.targetGroups[1].configureHealthCheck({ + port: '8050', + protocol: Protocol.HTTP, + healthyThresholdCount: 2, + unhealthyThresholdCount: 2, + timeout: Duration.seconds(10), + interval: Duration.seconds(30), + healthyHttpCodes: '200', +}); + +``` + +### Set runtimePlatform for ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +const applicationLoadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + }, + runtimePlatform: { + cpuArchitecture: ecs.CpuArchitecture.ARM64, + operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, + }, +}); +``` + +### Set PlatformVersion for ScheduledFargateTask + +```ts +declare const cluster: ecs.Cluster; +const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + }, + schedule: appscaling.Schedule.expression('rate(1 minute)'), + platformVersion: ecs.FargatePlatformVersion.VERSION1_4, +}); +``` + +### Set SecurityGroups for ScheduledFargateTask + +```ts +const vpc = new ec2.Vpc(this, 'Vpc', { maxAzs: 1 }); +const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); +const securityGroup = new ec2.SecurityGroup(this, 'SG', { vpc }); + +const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'ScheduledFargateTask', { + cluster, + scheduledFargateTaskImageOptions: { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryLimitMiB: 512, + }, + schedule: appscaling.Schedule.expression('rate(1 minute)'), + securityGroups: [securityGroup], +}); +``` + +### Use the REMOVE_DEFAULT_DESIRED_COUNT feature flag + +The REMOVE_DEFAULT_DESIRED_COUNT feature flag is used to override the default desiredCount that is autogenerated by the CDK. This will set the desiredCount of any service created by any of the following constructs to be undefined. + +* ApplicationLoadBalancedEc2Service +* ApplicationLoadBalancedFargateService +* NetworkLoadBalancedEc2Service +* NetworkLoadBalancedFargateService +* QueueProcessingEc2Service +* QueueProcessingFargateService + +If a desiredCount is not passed in as input to the above constructs, CloudFormation will either create a new service to start up with a desiredCount of 1, or update an existing service to start up with the same desiredCount as prior to the update. + +To enable the feature flag, ensure that the REMOVE_DEFAULT_DESIRED_COUNT flag within an application stack context is set to true, like so: + +```ts +declare const stack: Stack; +stack.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true); +``` + +The following is an example of an application with the REMOVE_DEFAULT_DESIRED_COUNT feature flag enabled: + +```ts nofixture +import { App, Stack } from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; +import * as cxapi from 'aws-cdk-lib/cx-api'; +import * as path from 'path'; + +const app = new App(); + +const stack = new Stack(app, 'aws-ecs-patterns-queue'); +stack.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true); + +const vpc = new ec2.Vpc(stack, 'VPC', { + maxAzs: 2, +}); + +new ecsPatterns.QueueProcessingFargateService(stack, 'QueueProcessingService', { + vpc, + memoryLimitMiB: 512, + image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), +}); +``` + +### Deploy application and metrics sidecar + +The following is an example of deploying an application along with a metrics sidecar container that utilizes `dockerLabels` for discovery: + +```ts +declare const cluster: ecs.Cluster; +declare const vpc: ec2.Vpc; +const service = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + vpc, + desiredCount: 1, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + dockerLabels: { + 'application.label.one': 'first_label', + 'application.label.two': 'second_label', + }, + }, +}); + +service.taskDefinition.addContainer('Sidecar', { + image: ecs.ContainerImage.fromRegistry('example/metrics-sidecar'), +}); +``` + +### Select specific load balancer name ApplicationLoadBalancedFargateService + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + taskSubnets: { + subnets: [ec2.Subnet.fromSubnetId(this, 'subnet', 'VpcISOLATEDSubnet1Subnet80F07FA0')], + }, + loadBalancerName: 'application-lb-name', +}); +``` + +### ECS Exec + +You can use ECS Exec to run commands in or get a shell to a container running on an Amazon EC2 instance or on +AWS Fargate. Enable ECS Exec, by setting `enableExecuteCommand` to `true`. + +ECS Exec is supported by all Services i.e. `ApplicationLoadBalanced(Fargate|Ec2)Service`, `ApplicationMultipleTargetGroups(Fargate|Ec2)Service`, `NetworkLoadBalanced(Fargate|Ec2)Service`, `NetworkMultipleTargetGroups(Fargate|Ec2)Service`, `QueueProcessing(Fargate|Ec2)Service`. It is not supported for `ScheduledTask`s. + +Read more about ECS Exec in the [ECS Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html). + +Example: + +```ts +declare const cluster: ecs.Cluster; +const loadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + cluster, + memoryLimitMiB: 1024, + desiredCount: 1, + cpu: 512, + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + }, + enableExecuteCommand: true +}); +``` + +Please note, ECS Exec leverages AWS Systems Manager (SSM). So as a prerequisite for the exec command +to work, you need to have the SSM plugin for the AWS CLI installed locally. For more information, see +[Install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html). diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/index.ts b/packages/aws-cdk-lib/aws-ecs-patterns/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index 207c101fe969b..514639acd71ee 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -1,18 +1,18 @@ -import { Certificate, CertificateValidation, ICertificate } from '@aws-cdk/aws-certificatemanager'; -import { IVpc } from '@aws-cdk/aws-ec2'; +import { Certificate, CertificateValidation, ICertificate } from '../../../aws-certificatemanager'; +import { IVpc } from '../../../aws-ec2'; import { AwsLogDriver, BaseService, CloudMapOptions, Cluster, ContainerImage, DeploymentController, DeploymentCircuitBreaker, ICluster, LogDriver, PropagatedTagSource, Secret, CapacityProviderStrategy, -} from '@aws-cdk/aws-ecs'; +} from '../../../aws-ecs'; import { ApplicationListener, ApplicationLoadBalancer, ApplicationProtocol, ApplicationProtocolVersion, ApplicationTargetGroup, IApplicationLoadBalancer, ListenerCertificate, ListenerAction, AddApplicationTargetsProps, SslPolicy, -} from '@aws-cdk/aws-elasticloadbalancingv2'; -import { IRole } from '@aws-cdk/aws-iam'; -import { ARecord, IHostedZone, RecordTarget, CnameRecord } from '@aws-cdk/aws-route53'; -import { LoadBalancerTarget } from '@aws-cdk/aws-route53-targets'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; +} from '../../../aws-elasticloadbalancingv2'; +import { IRole } from '../../../aws-iam'; +import { ARecord, IHostedZone, RecordTarget, CnameRecord } from '../../../aws-route53'; +import { LoadBalancerTarget } from '../../../aws-route53-targets'; +import * as cdk from '../../../core'; +import { Duration } from '../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 14973d3295362..4e11fad6db585 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -1,9 +1,9 @@ -import { Certificate, CertificateValidation, ICertificate } from '@aws-cdk/aws-certificatemanager'; -import { IVpc } from '@aws-cdk/aws-ec2'; +import { Certificate, CertificateValidation, ICertificate } from '../../../aws-certificatemanager'; +import { IVpc } from '../../../aws-ec2'; import { AwsLogDriver, BaseService, CloudMapOptions, Cluster, ContainerDefinition, ContainerImage, ICluster, LogDriver, PropagatedTagSource, Protocol, Secret, -} from '@aws-cdk/aws-ecs'; +} from '../../../aws-ecs'; import { ApplicationListener, ApplicationLoadBalancer, @@ -11,11 +11,11 @@ import { ApplicationTargetGroup, ListenerCertificate, ListenerCondition, SslPolicy, -} from '@aws-cdk/aws-elasticloadbalancingv2'; -import { IRole } from '@aws-cdk/aws-iam'; -import { ARecord, IHostedZone, RecordTarget } from '@aws-cdk/aws-route53'; -import { LoadBalancerTarget } from '@aws-cdk/aws-route53-targets'; -import { CfnOutput, Duration, Stack } from '@aws-cdk/core'; +} from '../../../aws-elasticloadbalancingv2'; +import { IRole } from '../../../aws-iam'; +import { ARecord, IHostedZone, RecordTarget } from '../../../aws-route53'; +import { LoadBalancerTarget } from '../../../aws-route53-targets'; +import { CfnOutput, Duration, Stack } from '../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/fargate-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/fargate-service-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts index 91075d9f553d0..618f556744800 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/fargate-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts @@ -1,4 +1,4 @@ -import { FargatePlatformVersion, FargateTaskDefinition, RuntimePlatform } from '@aws-cdk/aws-ecs'; +import { FargatePlatformVersion, FargateTaskDefinition, RuntimePlatform } from '../../../aws-ecs'; export interface FargateServiceBaseProps { diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts index 900c45cf59fc4..61911ae406578 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts @@ -1,13 +1,13 @@ -import { IVpc } from '@aws-cdk/aws-ec2'; +import { IVpc } from '../../../aws-ec2'; import { AwsLogDriver, BaseService, CloudMapOptions, Cluster, ContainerImage, DeploymentController, DeploymentCircuitBreaker, ICluster, LogDriver, PropagatedTagSource, Secret, CapacityProviderStrategy, -} from '@aws-cdk/aws-ecs'; -import { INetworkLoadBalancer, NetworkListener, NetworkLoadBalancer, NetworkTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { IRole } from '@aws-cdk/aws-iam'; -import { ARecord, CnameRecord, IHostedZone, RecordTarget } from '@aws-cdk/aws-route53'; -import { LoadBalancerTarget } from '@aws-cdk/aws-route53-targets'; -import * as cdk from '@aws-cdk/core'; +} from '../../../aws-ecs'; +import { INetworkLoadBalancer, NetworkListener, NetworkLoadBalancer, NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2'; +import { IRole } from '../../../aws-iam'; +import { ARecord, CnameRecord, IHostedZone, RecordTarget } from '../../../aws-route53'; +import { LoadBalancerTarget } from '../../../aws-route53-targets'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 1783a84967196..33427c75c3758 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -1,13 +1,13 @@ -import { IVpc } from '@aws-cdk/aws-ec2'; +import { IVpc } from '../../../aws-ec2'; import { AwsLogDriver, BaseService, CloudMapOptions, Cluster, ContainerDefinition, ContainerImage, ICluster, LogDriver, PropagatedTagSource, Protocol, Secret, -} from '@aws-cdk/aws-ecs'; -import { NetworkListener, NetworkLoadBalancer, NetworkTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { IRole } from '@aws-cdk/aws-iam'; -import { ARecord, IHostedZone, RecordTarget } from '@aws-cdk/aws-route53'; -import { LoadBalancerTarget } from '@aws-cdk/aws-route53-targets'; -import { CfnOutput, Duration, Stack } from '@aws-cdk/core'; +} from '../../../aws-ecs'; +import { NetworkListener, NetworkLoadBalancer, NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2'; +import { IRole } from '../../../aws-iam'; +import { ARecord, IHostedZone, RecordTarget } from '../../../aws-route53'; +import { LoadBalancerTarget } from '../../../aws-route53-targets'; +import { CfnOutput, Duration, Stack } from '../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts index 9347a7649d87b..0dbce5b6b96e0 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/queue-processing-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts @@ -1,12 +1,12 @@ -import { ScalingInterval } from '@aws-cdk/aws-applicationautoscaling'; -import { IVpc } from '@aws-cdk/aws-ec2'; +import { ScalingInterval } from '../../../aws-applicationautoscaling'; +import { IVpc } from '../../../aws-ec2'; import { AwsLogDriver, BaseService, CapacityProviderStrategy, Cluster, ContainerImage, DeploymentController, DeploymentCircuitBreaker, ICluster, LogDriver, PropagatedTagSource, Secret, -} from '@aws-cdk/aws-ecs'; -import { IQueue, Queue } from '@aws-cdk/aws-sqs'; -import { CfnOutput, Duration, FeatureFlags, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +} from '../../../aws-ecs'; +import { IQueue, Queue } from '../../../aws-sqs'; +import { CfnOutput, Duration, FeatureFlags, Stack } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/base/scheduled-task-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs-patterns/lib/base/scheduled-task-base.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts index 342e4fa1e08c3..9190bb3ed2fb3 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/base/scheduled-task-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/scheduled-task-base.ts @@ -1,9 +1,9 @@ -import { Schedule } from '@aws-cdk/aws-applicationautoscaling'; -import { ISecurityGroup, IVpc, SubnetSelection, SubnetType } from '@aws-cdk/aws-ec2'; -import { AwsLogDriver, Cluster, ContainerImage, ICluster, LogDriver, Secret, TaskDefinition } from '@aws-cdk/aws-ecs'; -import { Rule } from '@aws-cdk/aws-events'; -import { EcsTask } from '@aws-cdk/aws-events-targets'; -import { Stack } from '@aws-cdk/core'; +import { Schedule } from '../../../aws-applicationautoscaling'; +import { ISecurityGroup, IVpc, SubnetSelection, SubnetType } from '../../../aws-ec2'; +import { AwsLogDriver, Cluster, ContainerImage, ICluster, LogDriver, Secret, TaskDefinition } from '../../../aws-ecs'; +import { Rule } from '../../../aws-events'; +import { EcsTask } from '../../../aws-events-targets'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts index 0d35a6c8a2271..df3dc32bac74e 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-load-balanced-ecs-service.ts @@ -1,6 +1,6 @@ -import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '@aws-cdk/aws-ecs'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '../../../aws-ecs'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationLoadBalancedServiceBase, ApplicationLoadBalancedServiceBaseProps } from '../base/application-load-balanced-service-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts index 4950338194015..c69386bd2e719 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/application-multiple-target-groups-ecs-service.ts @@ -1,7 +1,7 @@ -import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '@aws-cdk/aws-ecs'; -import { ApplicationTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '../../../aws-ecs'; +import { ApplicationTargetGroup } from '../../../aws-elasticloadbalancingv2'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationMultipleTargetGroupsServiceBase, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts index d2c6ff08a450c..e525ee02cf65e 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-load-balanced-ecs-service.ts @@ -1,6 +1,6 @@ -import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '@aws-cdk/aws-ecs'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '../../../aws-ecs'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { NetworkLoadBalancedServiceBase, NetworkLoadBalancedServiceBaseProps } from '../base/network-load-balanced-service-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts index 19b5a8634bfef..fa176f8930962 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/network-multiple-target-groups-ecs-service.ts @@ -1,7 +1,7 @@ -import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '@aws-cdk/aws-ecs'; -import { NetworkTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '../../../aws-ecs'; +import { NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { NetworkMultipleTargetGroupsServiceBase, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts index ead2b27c05386..95b3f8edefeae 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/queue-processing-ecs-service.ts @@ -1,6 +1,6 @@ -import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '@aws-cdk/aws-ecs'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Ec2Service, Ec2TaskDefinition, PlacementConstraint, PlacementStrategy } from '../../../aws-ecs'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { QueueProcessingServiceBase, QueueProcessingServiceBaseProps } from '../base/queue-processing-service-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts index 32599569a892e..1bc0ffe350239 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts @@ -1,5 +1,5 @@ -import { Ec2TaskDefinition } from '@aws-cdk/aws-ecs'; -import { EcsTask } from '@aws-cdk/aws-events-targets'; +import { Ec2TaskDefinition } from '../../../aws-ecs'; +import { EcsTask } from '../../../aws-events-targets'; import { Construct } from 'constructs'; import { ScheduledTaskBase, ScheduledTaskBaseProps, ScheduledTaskImageProps } from '../base/scheduled-task-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts index d3f6bc7760c05..236a763bcd3f8 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-load-balanced-fargate-service.ts @@ -1,7 +1,7 @@ -import { ISecurityGroup, SubnetSelection } from '@aws-cdk/aws-ec2'; -import { FargateService, FargateTaskDefinition } from '@aws-cdk/aws-ecs'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { ISecurityGroup, SubnetSelection } from '../../../aws-ec2'; +import { FargateService, FargateTaskDefinition } from '../../../aws-ecs'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationLoadBalancedServiceBase, ApplicationLoadBalancedServiceBaseProps } from '../base/application-load-balanced-service-base'; import { FargateServiceBaseProps } from '../base/fargate-service-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts index bc72872102ef3..69a5b65309a40 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/application-multiple-target-groups-fargate-service.ts @@ -1,7 +1,7 @@ -import { FargateService, FargateTaskDefinition } from '@aws-cdk/aws-ecs'; -import { ApplicationTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { FargateService, FargateTaskDefinition } from '../../../aws-ecs'; +import { ApplicationTargetGroup } from '../../../aws-elasticloadbalancingv2'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationMultipleTargetGroupsServiceBase, diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts index 1e09e4ebf03c8..1ec8f38e16547 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts @@ -1,7 +1,7 @@ -import { SubnetSelection } from '@aws-cdk/aws-ec2'; -import { FargateService, FargateTaskDefinition } from '@aws-cdk/aws-ecs'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { SubnetSelection } from '../../../aws-ec2'; +import { FargateService, FargateTaskDefinition } from '../../../aws-ecs'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { FargateServiceBaseProps } from '../base/fargate-service-base'; import { NetworkLoadBalancedServiceBase, NetworkLoadBalancedServiceBaseProps } from '../base/network-load-balanced-service-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts index 582a417c2ac15..2ee925d585b7c 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-multiple-target-groups-fargate-service.ts @@ -1,7 +1,7 @@ -import { FargateService, FargateTaskDefinition } from '@aws-cdk/aws-ecs'; -import { NetworkTargetGroup } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { FargateService, FargateTaskDefinition } from '../../../aws-ecs'; +import { NetworkTargetGroup } from '../../../aws-elasticloadbalancingv2'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { FargateServiceBaseProps } from '../base/fargate-service-base'; import { diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts index 812478b9dba96..8c48023c4bc1c 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/queue-processing-fargate-service.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { FargateService, FargateTaskDefinition, HealthCheck } from '@aws-cdk/aws-ecs'; -import { FeatureFlags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ec2 from '../../../aws-ec2'; +import { FargateService, FargateTaskDefinition, HealthCheck } from '../../../aws-ecs'; +import { FeatureFlags } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { FargateServiceBaseProps } from '../base/fargate-service-base'; import { QueueProcessingServiceBase, QueueProcessingServiceBaseProps } from '../base/queue-processing-service-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts index e508b44bade4a..aaed749435f29 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/scheduled-fargate-task.ts @@ -1,5 +1,5 @@ -import { FargateTaskDefinition } from '@aws-cdk/aws-ecs'; -import { EcsTask } from '@aws-cdk/aws-events-targets'; +import { FargateTaskDefinition } from '../../../aws-ecs'; +import { EcsTask } from '../../../aws-events-targets'; import { Construct } from 'constructs'; import { FargateServiceBaseProps } from '../base/fargate-service-base'; import { ScheduledTaskBase, ScheduledTaskBaseProps, ScheduledTaskImageProps } from '../base/scheduled-task-base'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/index.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/lib/index.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/lib/index.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile b/packages/aws-cdk-lib/aws-ecs-patterns/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.ec2-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile rename to packages/aws-cdk-lib/aws-ecs-patterns/test/demo-image/Dockerfile diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/demo-image/index.py b/packages/aws-cdk-lib/aws-ecs-patterns/test/demo-image/index.py new file mode 100644 index 0000000000000..2ccedfce3ab76 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/demo-image/index.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +import sys +import textwrap +import http.server +import socketserver + +PORT = 8000 + + +class Handler(http.server.SimpleHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-Type', 'text/html') + self.end_headers() + self.wfile.write(textwrap.dedent('''\ + + It works + +

Hello from the integ test container

+

This container got built and started as part of the integ test.

+ + + ''').encode('utf-8')) + + +def main(): + httpd = http.server.HTTPServer(("", PORT), Handler) + print("serving at port", PORT) + httpd.serve_forever() + + +if __name__ == '__main__': + main() diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s-v2.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s-v2.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts index 02df03f67434b..a6ae25547b32f 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s-v2.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s-v2.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { MachineImage, Vpc } from '@aws-cdk/aws-ec2'; +import { Match, Template } from '../../../assertions'; +import { AutoScalingGroup } from '../../../aws-autoscaling'; +import { Certificate } from '../../../aws-certificatemanager'; +import * as ec2 from '../../../aws-ec2'; +import { MachineImage, Vpc } from '../../../aws-ec2'; import { AsgCapacityProvider, AwsLogDriver, @@ -13,12 +13,12 @@ import { Protocol, PlacementStrategy, PlacementConstraint, -} from '@aws-cdk/aws-ecs'; -import { ApplicationProtocol, SslPolicy } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { CompositePrincipal, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import { NamespaceType } from '@aws-cdk/aws-servicediscovery'; -import { Duration, Stack } from '@aws-cdk/core'; +} from '../../../aws-ecs'; +import { ApplicationProtocol, SslPolicy } from '../../../aws-elasticloadbalancingv2'; +import { CompositePrincipal, Role, ServicePrincipal } from '../../../aws-iam'; +import { PublicHostedZone } from '../../../aws-route53'; +import { NamespaceType } from '../../../aws-servicediscovery'; +import { Duration, Stack } from '../../../core'; import { ApplicationMultipleTargetGroupsEc2Service, NetworkMultipleTargetGroupsEc2Service } from '../../lib'; describe('When Application Load Balancer', () => { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts index 2170ecf57e6fe..799ba8a210449 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/l3s.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/l3s.test.ts @@ -1,15 +1,15 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import { Certificate } from '@aws-cdk/aws-certificatemanager'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { MachineImage } from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { AsgCapacityProvider } from '@aws-cdk/aws-ecs'; -import { ApplicationLoadBalancer, ApplicationProtocol, ApplicationProtocolVersion, NetworkLoadBalancer, SslPolicy } from '@aws-cdk/aws-elasticloadbalancingv2'; -import { PublicHostedZone } from '@aws-cdk/aws-route53'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import { AutoScalingGroup } from '../../../aws-autoscaling'; +import { Certificate } from '../../../aws-certificatemanager'; +import * as ec2 from '../../../aws-ec2'; +import { MachineImage } from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import { AsgCapacityProvider } from '../../../aws-ecs'; +import { ApplicationLoadBalancer, ApplicationProtocol, ApplicationProtocolVersion, NetworkLoadBalancer, SslPolicy } from '../../../aws-elasticloadbalancingv2'; +import { PublicHostedZone } from '../../../aws-route53'; +import * as cloudmap from '../../../aws-servicediscovery'; +import * as cdk from '../../../core'; +import { Duration } from '../../../core'; import * as ecsPatterns from '../../lib'; test('test ECS loadbalanced construct', () => { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/queue-processing-ecs-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/queue-processing-ecs-service.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/queue-processing-ecs-service.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/queue-processing-ecs-service.test.ts index b666e4a277957..c89fe64261a58 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/queue-processing-ecs-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/queue-processing-ecs-service.test.ts @@ -1,14 +1,14 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import { MachineImage } from '@aws-cdk/aws-ec2'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { AsgCapacityProvider } from '@aws-cdk/aws-ecs'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { Queue } from '@aws-cdk/aws-sqs'; +import { Match, Template } from '../../../assertions'; +import { AutoScalingGroup } from '../../../aws-autoscaling'; +import * as autoscaling from '../../../aws-autoscaling'; +import { MachineImage } from '../../../aws-ec2'; +import * as ec2 from '../../../aws-ec2'; +import { AsgCapacityProvider } from '../../../aws-ecs'; +import * as ecs from '../../../aws-ecs'; +import * as sqs from '../../../aws-sqs'; +import { Queue } from '../../../aws-sqs'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as ecsPatterns from '../../lib'; test('test ECS queue worker service construct - with only required props', () => { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/aws-ecs-integ-ecs.template.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/aws-ecs-integ-ecs.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/aws-ecs-integ-ecs.template.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/aws-ecs-integ-ecs.template.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/integ.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/integ.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/manifest.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/manifest.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/scheduledEc2TaskTestDefaultTestDeployAssertF02313CA.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/tree.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/tree.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.lit.integ.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts index b2321f9478045..71f8b81f14d95 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/ec2/scheduled-ecs-task.test.ts @@ -1,11 +1,11 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { MachineImage } from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { AsgCapacityProvider } from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; +import { Annotations, Match, Template } from '../../../assertions'; +import { AutoScalingGroup } from '../../../aws-autoscaling'; +import * as ec2 from '../../../aws-ec2'; +import { MachineImage } from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import { AsgCapacityProvider } from '../../../aws-ecs'; +import * as events from '../../../aws-events'; +import * as cdk from '../../../core'; import { ScheduledEc2Task } from '../../lib'; test('Can create a scheduled Ec2 Task - with only required props', () => { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts index a081df88b9529..509cb09502939 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Vpc } from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { ContainerImage } from '@aws-cdk/aws-ecs'; -import { CompositePrincipal, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import { Vpc } from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import { ContainerImage } from '../../../aws-ecs'; +import { CompositePrincipal, Role, ServicePrincipal } from '../../../aws-iam'; +import { Duration, Stack } from '../../../core'; import { ApplicationLoadBalancedFargateService, ApplicationMultipleTargetGroupsFargateService, NetworkLoadBalancedFargateService, NetworkMultipleTargetGroupsFargateService } from '../../lib'; diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts index 5cbb22774d95f..a11f62b59544c 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts @@ -1,14 +1,14 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import { Certificate, CertificateValidation } from '@aws-cdk/aws-certificatemanager'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { MachineImage } from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { AsgCapacityProvider } from '@aws-cdk/aws-ecs'; -import { ApplicationLoadBalancer, ApplicationProtocol, NetworkLoadBalancer } from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import { AutoScalingGroup } from '../../../aws-autoscaling'; +import { Certificate, CertificateValidation } from '../../../aws-certificatemanager'; +import * as ec2 from '../../../aws-ec2'; +import { MachineImage } from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import { AsgCapacityProvider } from '../../../aws-ecs'; +import { ApplicationLoadBalancer, ApplicationProtocol, NetworkLoadBalancer } from '../../../aws-elasticloadbalancingv2'; +import * as iam from '../../../aws-iam'; +import * as route53 from '../../../aws-route53'; +import * as cdk from '../../../core'; import * as ecsPatterns from '../../lib'; test('setting loadBalancerType to Network creates an NLB Public', () => { diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts index 8cbb1d579d5b0..5cce579170906 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts @@ -1,13 +1,13 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { AutoScalingGroup } from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { MachineImage } from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import { AsgCapacityProvider } from '@aws-cdk/aws-ecs'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { Queue } from '@aws-cdk/aws-sqs'; +import { Match, Template } from '../../../assertions'; +import { AutoScalingGroup } from '../../../aws-autoscaling'; +import * as ec2 from '../../../aws-ec2'; +import { MachineImage } from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import { AsgCapacityProvider } from '../../../aws-ecs'; +import * as sqs from '../../../aws-sqs'; +import { Queue } from '../../../aws-sqs'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as ecsPatterns from '../../lib'; test('test fargate queue worker service construct - with only required props', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-run-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/Dockerfile diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py new file mode 100644 index 0000000000000..2ccedfce3ab76 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/asset.0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14/index.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +import sys +import textwrap +import http.server +import socketserver + +PORT = 8000 + + +class Handler(http.server.SimpleHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-Type', 'text/html') + self.end_headers() + self.wfile.write(textwrap.dedent('''\ + + It works + +

Hello from the integ test container

+

This container got built and started as part of the integ test.

+ + + ''').encode('utf-8')) + + +def main(): + httpd = http.server.HTTPServer(("", PORT), Handler) + print("serving at port", PORT) + httpd.serve_forever() + + +if __name__ == '__main__': + main() diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/aws-fargate-integ.template.json diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/integ.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/integ.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/integ.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/integ.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/manifest.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/manifest.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/manifest.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/manifest.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/publicQueueProcessingFargateServiceTestDefaultTestDeployAssertD65416D6.template.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/tree.json b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/tree.json similarity index 100% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/tree.json rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.lit.integ.snapshot/tree.json diff --git a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts rename to packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts index e32938d11284a..e33116d945afb 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/scheduled-fargate-task.test.ts @@ -1,8 +1,8 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as cdk from '@aws-cdk/core'; +import { Annotations, Match, Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as events from '../../../aws-events'; +import * as cdk from '../../../core'; import { ScheduledFargateTask } from '../../lib'; test('Can create a scheduled Fargate Task - with only required props', () => { diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/sqs-reader/Dockerfile b/packages/aws-cdk-lib/aws-ecs-patterns/test/sqs-reader/Dockerfile new file mode 100644 index 0000000000000..919fabfc3f637 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/sqs-reader/Dockerfile @@ -0,0 +1,10 @@ +FROM public.ecr.aws/lambda/python:3.6 + +RUN pip3 install boto3 + +ENV QUEUE_NAME $QUEUE_NAME + +WORKDIR /src +ADD . /src + +CMD python3 index.py diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/test/sqs-reader/index.py b/packages/aws-cdk-lib/aws-ecs-patterns/test/sqs-reader/index.py new file mode 100644 index 0000000000000..8b53f5149cb24 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs-patterns/test/sqs-reader/index.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +import os +import boto3 + +QUEUE_NAME = os.environ.get('QUEUE_NAME') +print('QUEUE_NAME ' + QUEUE_NAME) + +if __name__ == '__main__': + client = boto3.client('sqs') + queue_url = client.get_queue_url(QueueName=QUEUE_NAME)['QueueUrl'] + print('queue_url ' + queue_url) + while True: + response = client.receive_message( + QueueUrl=queue_url, + WaitTimeSeconds=10, + ) + if response and 'Messages' in response: + for msg in response['Messages']: + print(msg['Body']) + entries = [{'Id': x['MessageId'], 'ReceiptHandle': x['ReceiptHandle']} for x in response['Messages']] + client.delete_message_batch(QueueUrl=queue_url, Entries=entries) + diff --git a/packages/aws-cdk-lib/aws-ecs/.jsiirc.json b/packages/aws-cdk-lib/aws-ecs/.jsiirc.json new file mode 100644 index 0000000000000..b5604e81cc02f --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ecs" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ECS" + }, + "python": { + "module": "aws_cdk.aws_ecs" + } + } +} diff --git a/packages/@aws-cdk/aws-ecs/CONTRIBUTING.md b/packages/aws-cdk-lib/aws-ecs/CONTRIBUTING.md similarity index 100% rename from packages/@aws-cdk/aws-ecs/CONTRIBUTING.md rename to packages/aws-cdk-lib/aws-ecs/CONTRIBUTING.md diff --git a/packages/aws-cdk-lib/aws-ecs/README.md b/packages/aws-cdk-lib/aws-ecs/README.md new file mode 100644 index 0000000000000..1c58768e85186 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/README.md @@ -0,0 +1,1367 @@ +# Amazon ECS Construct Library + + +This package contains constructs for working with **Amazon Elastic Container +Service** (Amazon ECS). + +Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service. + +For further information on Amazon ECS, +see the [Amazon ECS documentation](https://docs.aws.amazon.com/ecs) + +The following example creates an Amazon ECS cluster, adds capacity to it, and +runs a service on it: + +```ts +declare const vpc: ec2.Vpc; + +// Create an ECS cluster +const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); + +// Add capacity to it +cluster.addCapacity('DefaultAutoScalingGroupCapacity', { + instanceType: new ec2.InstanceType("t2.xlarge"), + desiredCapacity: 3, +}); + +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); + +taskDefinition.addContainer('DefaultContainer', { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 512, +}); + +// Instantiate an Amazon ECS Service +const ecsService = new ecs.Ec2Service(this, 'Service', { + cluster, + taskDefinition, +}); +``` + +For a set of constructs defining common ECS architectural patterns, see the `@aws-cdk/aws-ecs-patterns` package. + +## Launch Types: AWS Fargate vs Amazon EC2 vs AWS ECS Anywhere + +There are three sets of constructs in this library: + +- Use the `Ec2TaskDefinition` and `Ec2Service` constructs to run tasks on Amazon EC2 instances running in your account. +- Use the `FargateTaskDefinition` and `FargateService` constructs to run tasks on + instances that are managed for you by AWS. +- Use the `ExternalTaskDefinition` and `ExternalService` constructs to run AWS ECS Anywhere tasks on self-managed infrastructure. + +Here are the main differences: + +- **Amazon EC2**: instances are under your control. Complete control of task to host + allocation. Required to specify at least a memory reservation or limit for + every container. Can use Host, Bridge and AwsVpc networking modes. Can attach + Classic Load Balancer. Can share volumes between container and host. +- **AWS Fargate**: tasks run on AWS-managed instances, AWS manages task to host + allocation for you. Requires specification of memory and cpu sizes at the + taskdefinition level. Only supports AwsVpc networking modes and + Application/Network Load Balancers. Only the AWS log driver is supported. + Many host features are not supported such as adding kernel capabilities + and mounting host devices/volumes inside the container. +- **AWS ECS Anywhere**: tasks are run and managed by AWS ECS Anywhere on infrastructure + owned by the customer. Bridge, Host and None networking modes are supported. Does not + support autoscaling, load balancing, cloudmap or attachment of volumes. + +For more information on Amazon EC2 vs AWS Fargate, networking and ECS Anywhere see the AWS Documentation: +[AWS Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html), +[Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html), +[ECS Anywhere](https://aws.amazon.com/ecs/anywhere/) + +## Clusters + +A `Cluster` defines the infrastructure to run your +tasks on. You can run many tasks on a single cluster. + +The following code creates a cluster that can run AWS Fargate tasks: + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new ecs.Cluster(this, 'Cluster', { + vpc, +}); +``` + +The following code imports an existing cluster using the ARN which can be used to +import an Amazon ECS service either EC2 or Fargate. + +```ts +const clusterArn = 'arn:aws:ecs:us-east-1:012345678910:cluster/clusterName'; + +const cluster = ecs.Cluster.fromClusterArn(this, 'Cluster', clusterArn); +``` + +To use tasks with Amazon EC2 launch-type, you have to add capacity to +the cluster in order for tasks to be scheduled on your instances. Typically, +you add an AutoScalingGroup with instances running the latest +Amazon ECS-optimized AMI to the cluster. There is a method to build and add such an +AutoScalingGroup automatically, or you can supply a customized AutoScalingGroup +that you construct yourself. It's possible to add multiple AutoScalingGroups +with various instance types. + +The following example creates an Amazon ECS cluster and adds capacity to it: + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new ecs.Cluster(this, 'Cluster', { + vpc, +}); + +// Either add default capacity +cluster.addCapacity('DefaultAutoScalingGroupCapacity', { + instanceType: new ec2.InstanceType("t2.xlarge"), + desiredCapacity: 3, +}); + +// Or add customized capacity. Be sure to start the Amazon ECS-optimized AMI. +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType: new ec2.InstanceType('t2.xlarge'), + machineImage: ecs.EcsOptimizedImage.amazonLinux(), + // Or use Amazon ECS-Optimized Amazon Linux 2 AMI + // machineImage: EcsOptimizedImage.amazonLinux2(), + desiredCapacity: 3, + // ... other options here ... +}); + +const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider', { + autoScalingGroup, +}); +cluster.addAsgCapacityProvider(capacityProvider); +``` + +If you omit the property `vpc`, the construct will create a new VPC with two AZs. + +By default, all machine images will auto-update to the latest version +on each deployment, causing a replacement of the instances in your AutoScalingGroup +if the AMI has been updated since the last deployment. + +If task draining is enabled, ECS will transparently reschedule tasks on to the new +instances before terminating your old instances. If you have disabled task draining, +the tasks will be terminated along with the instance. To prevent that, you +can pick a non-updating AMI by passing `cacheInContext: true`, but be sure +to periodically update to the latest AMI manually by using the [CDK CLI +context management commands](https://docs.aws.amazon.com/cdk/latest/guide/context.html): + +```ts +declare const vpc: ec2.Vpc; +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { + machineImage: ecs.EcsOptimizedImage.amazonLinux({ cachedInContext: true }), + vpc, + instanceType: new ec2.InstanceType('t2.micro'), +}); +``` + +To use `LaunchTemplate` with `AsgCapacityProvider`, make sure to specify the `userData` in the `LaunchTemplate`: + +```ts +declare const vpc: ec2.Vpc; +const launchTemplate = new ec2.LaunchTemplate(this, 'ASG-LaunchTemplate', { + instanceType: new ec2.InstanceType('t3.medium'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + userData: ec2.UserData.forLinux(), +}); + +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + mixedInstancesPolicy: { + instancesDistribution: { + onDemandPercentageAboveBaseCapacity: 50, + }, + launchTemplate: launchTemplate, + }, +}); + +const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); + +const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider', { + autoScalingGroup, + machineImageType: ecs.MachineImageType.AMAZON_LINUX_2, +}); + +cluster.addAsgCapacityProvider(capacityProvider); +``` + + +### Bottlerocket + +[Bottlerocket](https://aws.amazon.com/bottlerocket/) is a Linux-based open source operating system that is +purpose-built by AWS for running containers. You can launch Amazon ECS container instances with the Bottlerocket AMI. + +The following example will create a capacity with self-managed Amazon EC2 capacity of 2 `c5.large` Linux instances running with `Bottlerocket` AMI. + +The following example adds Bottlerocket capacity to the cluster: + +```ts +declare const cluster: ecs.Cluster; + +cluster.addCapacity('bottlerocket-asg', { + minCapacity: 2, + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), +}); +``` + +### ARM64 (Graviton) Instances + +To launch instances with ARM64 hardware, you can use the Amazon ECS-optimized +Amazon Linux 2 (arm64) AMI. Based on Amazon Linux 2, this AMI is recommended +for use when launching your EC2 instances that are powered by Arm-based AWS +Graviton Processors. + +```ts +declare const cluster: ecs.Cluster; + +cluster.addCapacity('graviton-cluster', { + minCapacity: 2, + instanceType: new ec2.InstanceType('c6g.large'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM), +}); +``` + +Bottlerocket is also supported: + +```ts +declare const cluster: ecs.Cluster; + +cluster.addCapacity('graviton-cluster', { + minCapacity: 2, + instanceType: new ec2.InstanceType('c6g.large'), + machineImageType: ecs.MachineImageType.BOTTLEROCKET, +}); +``` + +### Spot Instances + +To add spot instances into the cluster, you must specify the `spotPrice` in the `ecs.AddCapacityOptions` and optionally enable the `spotInstanceDraining` property. + +```ts +declare const cluster: ecs.Cluster; + +// Add an AutoScalingGroup with spot instances to the existing cluster +cluster.addCapacity('AsgSpot', { + maxCapacity: 2, + minCapacity: 2, + desiredCapacity: 2, + instanceType: new ec2.InstanceType('c5.xlarge'), + spotPrice: '0.0735', + // Enable the Automated Spot Draining support for Amazon ECS + spotInstanceDraining: true, +}); +``` + +### SNS Topic Encryption + +When the `ecs.AddCapacityOptions` that you provide has a non-zero `taskDrainTime` (the default) then an SNS topic and Lambda are created to ensure that the +cluster's instances have been properly drained of tasks before terminating. The SNS Topic is sent the instance-terminating lifecycle event from the AutoScalingGroup, +and the Lambda acts on that event. If you wish to engage [server-side encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for this SNS Topic +then you may do so by providing a KMS key for the `topicEncryptionKey` property of `ecs.AddCapacityOptions`. + +```ts +// Given +declare const cluster: ecs.Cluster; +declare const key: kms.Key; +// Then, use that key to encrypt the lifecycle-event SNS Topic. +cluster.addCapacity('ASGEncryptedSNS', { + instanceType: new ec2.InstanceType("t2.xlarge"), + desiredCapacity: 3, + topicEncryptionKey: key, +}); +``` + +## Task definitions + +A task definition describes what a single copy of a **task** should look like. +A task definition has one or more containers; typically, it has one +main container (the *default container* is the first one that's added +to the task definition, and it is marked *essential*) and optionally +some supporting containers which are used to support the main container, +doings things like upload logs or metrics to monitoring services. + +To run a task or service with Amazon EC2 launch type, use the `Ec2TaskDefinition`. For AWS Fargate tasks/services, use the +`FargateTaskDefinition`. For AWS ECS Anywhere use the `ExternalTaskDefinition`. These classes +provide simplified APIs that only contain properties relevant for each specific launch type. + +For a `FargateTaskDefinition`, specify the task size (`memoryLimitMiB` and `cpu`): + +```ts +const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { + memoryLimitMiB: 512, + cpu: 256, +}); +``` + +On Fargate Platform Version 1.4.0 or later, you may specify up to 200GiB of +[ephemeral storage](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html#fargate-task-storage-pv14): + +```ts +const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { + memoryLimitMiB: 512, + cpu: 256, + ephemeralStorageGiB: 100, +}); +``` + +To add containers to a task definition, call `addContainer()`: + +```ts +const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { + memoryLimitMiB: 512, + cpu: 256, +}); +const container = fargateTaskDefinition.addContainer("WebContainer", { + // Use an image from DockerHub + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + // ... other options here ... +}); +``` + +For an `Ec2TaskDefinition`: + +```ts +const ec2TaskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef', { + networkMode: ecs.NetworkMode.BRIDGE, +}); + +const container = ec2TaskDefinition.addContainer("WebContainer", { + // Use an image from DockerHub + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 1024, + // ... other options here ... +}); +``` + +For an `ExternalTaskDefinition`: + +```ts +const externalTaskDefinition = new ecs.ExternalTaskDefinition(this, 'TaskDef'); + +const container = externalTaskDefinition.addContainer("WebContainer", { + // Use an image from DockerHub + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 1024, + // ... other options here ... +}); +``` + +You can specify container properties when you add them to the task definition, or with various methods, e.g.: + +To add a port mapping when adding a container to the task definition, specify the `portMappings` option: + +```ts +declare const taskDefinition: ecs.TaskDefinition; + +taskDefinition.addContainer("WebContainer", { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 1024, + portMappings: [{ containerPort: 3000 }], +}); +``` + +To add port mappings directly to a container definition, call `addPortMappings()`: + +```ts +declare const container: ecs.ContainerDefinition; + +container.addPortMappings({ + containerPort: 3000, +}); +``` + +To add data volumes to a task definition, call `addVolume()`: + +```ts +const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { + memoryLimitMiB: 512, + cpu: 256, +}); +const volume = { + // Use an Elastic FileSystem + name: "mydatavolume", + efsVolumeConfiguration: { + fileSystemId: "EFS", + // ... other options here ... + }, +}; + +const container = fargateTaskDefinition.addVolume(volume); +``` + +> Note: ECS Anywhere doesn't support volume attachments in the task definition. + +To use a TaskDefinition that can be used with either Amazon EC2 or +AWS Fargate launch types, use the `TaskDefinition` construct. + +When creating a task definition you have to specify what kind of +tasks you intend to run: Amazon EC2, AWS Fargate, or both. +The following example uses both: + +```ts +const taskDefinition = new ecs.TaskDefinition(this, 'TaskDef', { + memoryMiB: '512', + cpu: '256', + networkMode: ecs.NetworkMode.AWS_VPC, + compatibility: ecs.Compatibility.EC2_AND_FARGATE, +}); +``` + +To grant a principal permission to run your `TaskDefinition`, you can use the `TaskDefinition.grantRun()` method: + +```ts +declare const role: iam.IGrantable; +const taskDef = new ecs.TaskDefinition(this, 'TaskDef', { + cpu: '512', + memoryMiB: '512', + compatibility: ecs.Compatibility.EC2_AND_FARGATE, +}); + +// Gives role required permissions to run taskDef +taskDef.grantRun(role); +``` + +### Images + +Images supply the software that runs inside the container. Images can be +obtained from either DockerHub or from ECR repositories, built directly from a local Dockerfile, or use an existing tarball. + +- `ecs.ContainerImage.fromRegistry(imageName)`: use a public image. +- `ecs.ContainerImage.fromRegistry(imageName, { credentials: mySecret })`: use a private image that requires credentials. +- `ecs.ContainerImage.fromEcrRepository(repo, tagOrDigest)`: use the given ECR repository as the image + to start. If no tag or digest is provided, "latest" is assumed. +- `ecs.ContainerImage.fromAsset('./image')`: build and upload an + image directly from a `Dockerfile` in your source directory. +- `ecs.ContainerImage.fromDockerImageAsset(asset)`: uses an existing + `@aws-cdk/aws-ecr-assets.DockerImageAsset` as a container image. +- `ecs.ContainerImage.fromTarball(file)`: use an existing tarball. +- `new ecs.TagParameterContainerImage(repository)`: use the given ECR repository as the image + but a CloudFormation parameter as the tag. + +### Environment variables + +To pass environment variables to the container, you can use the `environment`, `environmentFiles`, and `secrets` props. + +```ts +declare const secret: secretsmanager.Secret; +declare const dbSecret: secretsmanager.Secret; +declare const parameter: ssm.StringParameter; +declare const taskDefinition: ecs.TaskDefinition; +declare const s3Bucket: s3.Bucket; + +const newContainer = taskDefinition.addContainer('container', { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 1024, + environment: { // clear text, not for sensitive data + STAGE: 'prod', + }, + environmentFiles: [ // list of environment files hosted either on local disk or S3 + ecs.EnvironmentFile.fromAsset('./demo-env-file.env'), + ecs.EnvironmentFile.fromBucket(s3Bucket, 'assets/demo-env-file.env'), + ], + secrets: { // Retrieved from AWS Secrets Manager or AWS Systems Manager Parameter Store at container start-up. + SECRET: ecs.Secret.fromSecretsManager(secret), + DB_PASSWORD: ecs.Secret.fromSecretsManager(dbSecret, 'password'), // Reference a specific JSON field, (requires platform version 1.4.0 or later for Fargate tasks) + API_KEY: ecs.Secret.fromSecretsManagerVersion(secret, { versionId: '12345' }, 'apiKey'), // Reference a specific version of the secret by its version id or version stage (requires platform version 1.4.0 or later for Fargate tasks) + PARAMETER: ecs.Secret.fromSsmParameter(parameter), + }, +}); +newContainer.addEnvironment('QUEUE_NAME', 'MyQueue'); +newContainer.addSecret('API_KEY', ecs.Secret.fromSecretsManager(secret)); +newContainer.addSecret('DB_PASSWORD', ecs.Secret.fromSecretsManager(secret, 'password')); +``` + +The task execution role is automatically granted read permissions on the secrets/parameters. Support for environment +files is restricted to the EC2 launch type for files hosted on S3. Further details provided in the AWS documentation +about [specifying environment variables](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html). + +### Linux parameters + +To apply additional linux-specific options related to init process and memory management to the container, use the `linuxParameters` property: + +```ts +declare const taskDefinition: ecs.TaskDefinition; + +taskDefinition.addContainer('container', { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 1024, + linuxParameters: new ecs.LinuxParameters(this, 'LinuxParameters', { + initProcessEnabled: true, + sharedMemorySize: 1024, + maxSwap: Size.mebibytes(5000), + swappiness: 90, + }), +}); +``` + +### System controls + +To set system controls (kernel parameters) on the container, use the `systemControls` prop: + +```ts +declare const taskDefinition: ecs.TaskDefinition; + +taskDefinition.addContainer('container', { + image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), + memoryLimitMiB: 1024, + systemControls: [ + { + namespace: 'net.ipv6.conf.all.default.disable_ipv6', + value: '1', + }, + ], +}); +``` + +### Using Windows containers on Fargate + +AWS Fargate supports Amazon ECS Windows containers. For more details, please see this [blog post](https://aws.amazon.com/tw/blogs/containers/running-windows-containers-with-amazon-ecs-on-aws-fargate/) + +```ts +// Create a Task Definition for the Windows container to start +const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { + runtimePlatform: { + operatingSystemFamily: ecs.OperatingSystemFamily.WINDOWS_SERVER_2019_CORE, + cpuArchitecture: ecs.CpuArchitecture.X86_64, + }, + cpu: 1024, + memoryLimitMiB: 2048, +}); + +taskDefinition.addContainer('windowsservercore', { + logging: ecs.LogDriver.awsLogs({ streamPrefix: 'win-iis-on-fargate' }), + portMappings: [{ containerPort: 80 }], + image: ecs.ContainerImage.fromRegistry('mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019'), +}); +``` + +### Using Graviton2 with Fargate + +AWS Graviton2 supports AWS Fargate. For more details, please see this [blog post](https://aws.amazon.com/blogs/aws/announcing-aws-graviton2-support-for-aws-fargate-get-up-to-40-better-price-performance-for-your-serverless-containers/) + +```ts +// Create a Task Definition for running container on Graviton Runtime. +const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', { + runtimePlatform: { + operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, + cpuArchitecture: ecs.CpuArchitecture.ARM64, + }, + cpu: 1024, + memoryLimitMiB: 2048, +}); + +taskDefinition.addContainer('webarm64', { + logging: ecs.LogDriver.awsLogs({ streamPrefix: 'graviton2-on-fargate' }), + portMappings: [{ containerPort: 80 }], + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:latest-arm64v8'), +}); +``` + +## Service + +A `Service` instantiates a `TaskDefinition` on a `Cluster` a given number of +times, optionally associating them with a load balancer. +If a task fails, +Amazon ECS automatically restarts the task. + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; + +const service = new ecs.FargateService(this, 'Service', { + cluster, + taskDefinition, + desiredCount: 5, +}); +``` + +ECS Anywhere service definition looks like: + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; + +const service = new ecs.ExternalService(this, 'Service', { + cluster, + taskDefinition, + desiredCount: 5, +}); +``` + +`Services` by default will create a security group if not provided. +If you'd like to specify which security groups to use you can override the `securityGroups` property. + +### Deployment circuit breaker and rollback + +Amazon ECS [deployment circuit breaker](https://aws.amazon.com/tw/blogs/containers/announcing-amazon-ecs-deployment-circuit-breaker/) +automatically rolls back unhealthy service deployments without the need for manual intervention. Use `circuitBreaker` to enable +deployment circuit breaker and optionally enable `rollback` for automatic rollback. See [Using the deployment circuit breaker](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html) +for more details. + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; +const service = new ecs.FargateService(this, 'Service', { + cluster, + taskDefinition, + circuitBreaker: { rollback: true }, +}); +``` + +> Note: ECS Anywhere doesn't support deployment circuit breakers and rollback. + +### Include an application/network load balancer + +`Services` are load balancing targets and can be added to a target group, which will be attached to an application/network load balancers: + +```ts +declare const vpc: ec2.Vpc; +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; +const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition }); + +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('Listener', { port: 80 }); +const targetGroup1 = listener.addTargets('ECS1', { + port: 80, + targets: [service], +}); +const targetGroup2 = listener.addTargets('ECS2', { + port: 80, + targets: [service.loadBalancerTarget({ + containerName: 'MyContainer', + containerPort: 8080 + })], +}); +``` + +> Note: ECS Anywhere doesn't support application/network load balancers. + +Note that in the example above, the default `service` only allows you to register the first essential container or the first mapped port on the container as a target and add it to a new target group. To have more control over which container and port to register as targets, you can use `service.loadBalancerTarget()` to return a load balancing target for a specific container and port. + +Alternatively, you can also create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly. + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; +declare const vpc: ec2.Vpc; +const service = new ecs.FargateService(this, 'Service', { cluster, taskDefinition }); + +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { vpc, internetFacing: true }); +const listener = lb.addListener('Listener', { port: 80 }); +service.registerLoadBalancerTargets( + { + containerName: 'web', + containerPort: 80, + newTargetGroupId: 'ECS', + listener: ecs.ListenerConfig.applicationListener(listener, { + protocol: elbv2.ApplicationProtocol.HTTPS + }), + }, +); +``` + +### Using a Load Balancer from a different Stack + +If you want to put your Load Balancer and the Service it is load balancing to in +different stacks, you may not be able to use the convenience methods +`loadBalancer.addListener()` and `listener.addTargets()`. + +The reason is that these methods will create resources in the same Stack as the +object they're called on, which may lead to cyclic references between stacks. +Instead, you will have to create an `ApplicationListener` in the service stack, +or an empty `TargetGroup` in the load balancer stack that you attach your +service to. + +See the [ecs/cross-stack-load-balancer example](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/ecs/cross-stack-load-balancer/) +for the alternatives. + +### Include a classic load balancer + +`Services` can also be directly attached to a classic load balancer as targets: + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; +declare const vpc: ec2.Vpc; +const service = new ecs.Ec2Service(this, 'Service', { cluster, taskDefinition }); + +const lb = new elb.LoadBalancer(this, 'LB', { vpc }); +lb.addListener({ externalPort: 80 }); +lb.addTarget(service); +``` + +Similarly, if you want to have more control over load balancer targeting: + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; +declare const vpc: ec2.Vpc; +const service = new ecs.Ec2Service(this, 'Service', { cluster, taskDefinition }); + +const lb = new elb.LoadBalancer(this, 'LB', { vpc }); +lb.addListener({ externalPort: 80 }); +lb.addTarget(service.loadBalancerTarget({ + containerName: 'MyContainer', + containerPort: 80, +})); +``` + +There are two higher-level constructs available which include a load balancer for you that can be found in the aws-ecs-patterns module: + +- `LoadBalancedFargateService` +- `LoadBalancedEc2Service` + +### Import existing services + +`Ec2Service` and `FargateService` provide methods to import existing EC2/Fargate services. +The ARN of the existing service has to be specified to import the service. + +Since AWS has changed the [ARN format for ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids), +feature flag `@aws-cdk/aws-ecs:arnFormatIncludesClusterName` must be enabled to use the new ARN format. +The feature flag changes behavior for the entire CDK project. Therefore it is not possible to mix the old and the new format in one CDK project. + +```tss +declare const cluster: ecs.Cluster; + +// Import service from EC2 service attributes +const service = ecs.Ec2Service.fromEc2ServiceAttributes(stack, 'EcsService', { + serviceArn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service', + cluster, +}); + +// Import service from EC2 service ARN +const service = ecs.Ec2Service.fromEc2ServiceArn(stack, 'EcsService', 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service'); + +// Import service from Fargate service attributes +const service = ecs.FargateService.fromFargateServiceAttributes(stack, 'EcsService', { + serviceArn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service', + cluster, +}); + +// Import service from Fargate service ARN +const service = ecs.FargateService.fromFargateServiceArn(stack, 'EcsService', 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service'); +``` + +## Task Auto-Scaling + +You can configure the task count of a service to match demand. Task auto-scaling is +configured by calling `autoScaleTaskCount()`: + +```ts +declare const target: elbv2.ApplicationTargetGroup; +declare const service: ecs.BaseService; +const scaling = service.autoScaleTaskCount({ maxCapacity: 10 }); +scaling.scaleOnCpuUtilization('CpuScaling', { + targetUtilizationPercent: 50, +}); + +scaling.scaleOnRequestCount('RequestScaling', { + requestsPerTarget: 10000, + targetGroup: target, +}); +``` + +Task auto-scaling is powered by *Application Auto-Scaling*. +See that section for details. + +## Integration with CloudWatch Events + +To start an Amazon ECS task on an Amazon EC2-backed Cluster, instantiate an +`@aws-cdk/aws-events-targets.EcsTask` instead of an `Ec2Service`: + +```ts +declare const cluster: ecs.Cluster; +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(path.resolve(__dirname, '..', 'eventhandler-image')), + memoryLimitMiB: 256, + logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo', mode: ecs.AwsLogDriverMode.NON_BLOCKING }), +}); + +// An Rule that describes the event trigger (in this case a scheduled run) +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.expression('rate(1 min)'), +}); + +// Pass an environment variable to the container 'TheContainer' in the task +rule.addTarget(new targets.EcsTask({ + cluster, + taskDefinition, + taskCount: 1, + containerOverrides: [{ + containerName: 'TheContainer', + environment: [{ + name: 'I_WAS_TRIGGERED', + value: 'From CloudWatch Events' + }], + }], +})); +``` + +## Log Drivers + +Currently Supported Log Drivers: + +- awslogs +- fluentd +- gelf +- journald +- json-file +- splunk +- syslog +- awsfirelens +- Generic + +### awslogs Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.awsLogs({ streamPrefix: 'EventDemo' }), +}); +``` + +### fluentd Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.fluentd(), +}); +``` + +### gelf Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.gelf({ address: 'my-gelf-address' }), +}); +``` + +### journald Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.journald(), +}); +``` + +### json-file Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.jsonFile(), +}); +``` + +### splunk Log Driver + +```ts +declare const secret: ecs.Secret; + +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.splunk({ + secretToken: secret, + url: 'my-splunk-url', + }), +}); +``` + +### syslog Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.syslog(), +}); +``` + +### firelens Log Driver + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.firelens({ + options: { + Name: 'firehose', + region: 'us-west-2', + delivery_stream: 'my-stream', + }, + }), +}); +``` + +To pass secrets to the log configuration, use the `secretOptions` property of the log configuration. The task execution role is automatically granted read permissions on the secrets/parameters. + +```ts +declare const secret: secretsmanager.Secret; +declare const parameter: ssm.StringParameter; + +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: ecs.LogDrivers.firelens({ + options: { + // ... log driver options here ... + }, + secretOptions: { // Retrieved from AWS Secrets Manager or AWS Systems Manager Parameter Store + apikey: ecs.Secret.fromSecretsManager(secret), + host: ecs.Secret.fromSsmParameter(parameter), + }, + }), +}); +``` + +### Generic Log Driver + +A generic log driver object exists to provide a lower level abstraction of the log driver configuration. + +```ts +// Create a Task Definition for the container to start +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + memoryLimitMiB: 256, + logging: new ecs.GenericLogDriver({ + logDriver: 'fluentd', + options: { + tag: 'example-tag', + }, + }), +}); +``` + +## CloudMap Service Discovery + +To register your ECS service with a CloudMap Service Registry, you may add the +`cloudMapOptions` property to your service: + +```ts +declare const taskDefinition: ecs.TaskDefinition; +declare const cluster: ecs.Cluster; + +const service = new ecs.Ec2Service(this, 'Service', { + cluster, + taskDefinition, + cloudMapOptions: { + // Create A records - useful for AWSVPC network mode. + dnsRecordType: cloudmap.DnsRecordType.A, + }, +}); +``` + +With `bridge` or `host` network modes, only `SRV` DNS record types are supported. +By default, `SRV` DNS record types will target the default container and default +port. However, you may target a different container and port on the same ECS task: + +```ts +declare const taskDefinition: ecs.TaskDefinition; +declare const cluster: ecs.Cluster; + +// Add a container to the task definition +const specificContainer = taskDefinition.addContainer('Container', { + image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'), + memoryLimitMiB: 2048, +}); + +// Add a port mapping +specificContainer.addPortMappings({ + containerPort: 7600, + protocol: ecs.Protocol.TCP, +}); + +new ecs.Ec2Service(this, 'Service', { + cluster, + taskDefinition, + cloudMapOptions: { + // Create SRV records - useful for bridge networking + dnsRecordType: cloudmap.DnsRecordType.SRV, + // Targets port TCP port 7600 `specificContainer` + container: specificContainer, + containerPort: 7600, + }, +}); +``` + +### Associate With a Specific CloudMap Service + +You may associate an ECS service with a specific CloudMap service. To do +this, use the service's `associateCloudMapService` method: + +```ts +declare const cloudMapService: cloudmap.Service; +declare const ecsService: ecs.FargateService; + +ecsService.associateCloudMapService({ + service: cloudMapService, +}); +``` + +## Capacity Providers + +There are two major families of Capacity Providers: [AWS +Fargate](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-capacity-providers.html) +(including Fargate Spot) and EC2 [Auto Scaling +Group](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html) +Capacity Providers. Both are supported. + +### Fargate Capacity Providers + +To enable Fargate capacity providers, you can either set +`enableFargateCapacityProviders` to `true` when creating your cluster, or by +invoking the `enableFargateCapacityProviders()` method after creating your +cluster. This will add both `FARGATE` and `FARGATE_SPOT` as available capacity +providers on your cluster. + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new ecs.Cluster(this, 'FargateCPCluster', { + vpc, + enableFargateCapacityProviders: true, +}); + +const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef'); + +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), +}); + +new ecs.FargateService(this, 'FargateService', { + cluster, + taskDefinition, + capacityProviderStrategies: [ + { + capacityProvider: 'FARGATE_SPOT', + weight: 2, + }, + { + capacityProvider: 'FARGATE', + weight: 1, + }, + ], +}); +``` + +### Auto Scaling Group Capacity Providers + +To add an Auto Scaling Group Capacity Provider, first create an EC2 Auto Scaling +Group. Then, create an `AsgCapacityProvider` and pass the Auto Scaling Group to +it in the constructor. Then add the Capacity Provider to the cluster. Finally, +you can refer to the Provider by its name in your service's or task's Capacity +Provider strategy. + +By default, Auto Scaling Group Capacity Providers will manage the scale-in and +scale-out behavior of the auto scaling group based on the load your tasks put on +the cluster, this is called [Managed Scaling](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-managed-scaling). If you'd +rather manage scaling behavior yourself set `enableManagedScaling` to `false`. + +Additionally [Managed Termination Protection](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-auto-scaling.html#managed-termination-protection) is enabled by default to +prevent scale-in behavior from terminating instances that have non-daemon tasks +running on them. This is ideal for tasks that should be ran to completion. If your +tasks are safe to interrupt then this protection can be disabled by setting +`enableManagedTerminationProtection` to `false`. Managed Scaling must be enabled for +Managed Termination Protection to work. + +> Currently there is a known [CloudFormation issue](https://github.com/aws/containers-roadmap/issues/631) +> that prevents CloudFormation from automatically deleting Auto Scaling Groups that +> have Managed Termination Protection enabled. To work around this issue you could set +> `enableManagedTerminationProtection` to `false` on the Auto Scaling Group Capacity +> Provider. If you'd rather not disable Managed Termination Protection, you can [manually +> delete the Auto Scaling Group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-process-shutdown.html). +> For other workarounds, see [this GitHub issue](https://github.com/aws/aws-cdk/issues/18179). + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new ecs.Cluster(this, 'Cluster', { + vpc, +}); + +const autoScalingGroup = new autoscaling.AutoScalingGroup(this, 'ASG', { + vpc, + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + minCapacity: 0, + maxCapacity: 100, +}); + +const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider', { + autoScalingGroup, +}); +cluster.addAsgCapacityProvider(capacityProvider); + +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); + +taskDefinition.addContainer('web', { + image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'), + memoryReservationMiB: 256, +}); + +new ecs.Ec2Service(this, 'EC2Service', { + cluster, + taskDefinition, + capacityProviderStrategies: [ + { + capacityProvider: capacityProvider.capacityProviderName, + weight: 1, + }, + ], +}); +``` + +### Cluster Default Provider Strategy + +A capacity provider strategy determines whether ECS tasks are launched on EC2 instances or Fargate/Fargate Spot. It can be specified at the cluster, service, or task level, and consists of one or more capacity providers. You can specify an optional base and weight value for finer control of how tasks are launched. The `base` specifies a minimum number of tasks on one capacity provider, and the `weight`s of each capacity provider determine how tasks are distributed after `base` is satisfied. + +You can associate a default capacity provider strategy with an Amazon ECS cluster. After you do this, a default capacity provider strategy is used when creating a service or running a standalone task in the cluster and whenever a custom capacity provider strategy or a launch type isn't specified. We recommend that you define a default capacity provider strategy for each cluster. + +For more information visit https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html + +When the service does not have a capacity provider strategy, the cluster's default capacity provider strategy will be used. Default Capacity Provider Strategy can be added by using the method `addDefaultCapacityProviderStrategy`. A capacity provider strategy cannot contain a mix of EC2 Autoscaling Group capacity providers and Fargate providers. + +```ts +declare const capacityProvider: ecs.CapacityProvider; + +const cluster = new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, +}); +cluster.addAsgCapacityProvider(capacityProvider); + +cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 10, weight: 50 }, + { capacityProvider: 'FARGATE_SPOT', weight: 50 }, +]); +``` + +```ts +declare const capacityProvider: ecs.CapacityProvider; + +const cluster = new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, +}); +cluster.addAsgCapacityProvider(capacityProvider); + +cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: capacityProvider.capacityProviderName }, +]); +``` + +## Elastic Inference Accelerators + +Currently, this feature is only supported for services with EC2 launch types. + +To add elastic inference accelerators to your EC2 instance, first add +`inferenceAccelerators` field to the Ec2TaskDefinition and set the `deviceName` +and `deviceType` properties. + +```ts +const inferenceAccelerators = [{ + deviceName: 'device1', + deviceType: 'eia2.medium', +}]; + +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'Ec2TaskDef', { + inferenceAccelerators, +}); +``` + +To enable using the inference accelerators in the containers, add `inferenceAcceleratorResources` +field and set it to a list of device names used for the inference accelerators. Each value in the +list should match a `DeviceName` for an `InferenceAccelerator` specified in the task definition. + +```ts +declare const taskDefinition: ecs.TaskDefinition; +const inferenceAcceleratorResources = ['device1']; + +taskDefinition.addContainer('cont', { + image: ecs.ContainerImage.fromRegistry('test'), + memoryLimitMiB: 1024, + inferenceAcceleratorResources, +}); +``` + +## ECS Exec command + +Please note, ECS Exec leverages AWS Systems Manager (SSM). So as a prerequisite for the exec command +to work, you need to have the SSM plugin for the AWS CLI installed locally. For more information, see +[Install Session Manager plugin for AWS CLI](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html). + +To enable the ECS Exec feature for your containers, set the boolean flag `enableExecuteCommand` to `true` in +your `Ec2Service` or `FargateService`. + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; + +const service = new ecs.Ec2Service(this, 'Service', { + cluster, + taskDefinition, + enableExecuteCommand: true, +}); +``` + +### Enabling logging + +You can enable sending logs of your execute session commands to a CloudWatch log group or S3 bucket by configuring +the `executeCommandConfiguration` property for your cluster. The default configuration will send the +logs to the CloudWatch Logs using the `awslogs` log driver that is configured in your task definition. Please note, +when using your own `logConfiguration` the log group or S3 Bucket specified must already be created. + +To encrypt data using your own KMS Customer Key (CMK), you must create a CMK and provide the key in the `kmsKey` field +of the `executeCommandConfiguration`. To use this key for encrypting CloudWatch log data or S3 bucket, make sure to associate the key +to these resources on creation. + +```ts +declare const vpc: ec2.Vpc; +const kmsKey = new kms.Key(this, 'KmsKey'); + +// Pass the KMS key in the `encryptionKey` field to associate the key to the log group +const logGroup = new logs.LogGroup(this, 'LogGroup', { + encryptionKey: kmsKey, +}); + +// Pass the KMS key in the `encryptionKey` field to associate the key to the S3 bucket +const execBucket = new s3.Bucket(this, 'EcsExecBucket', { + encryptionKey: kmsKey, +}); + +const cluster = new ecs.Cluster(this, 'Cluster', { + vpc, + executeCommandConfiguration: { + kmsKey, + logConfiguration: { + cloudWatchLogGroup: logGroup, + cloudWatchEncryptionEnabled: true, + s3Bucket: execBucket, + s3EncryptionEnabled: true, + s3KeyPrefix: 'exec-command-output', + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, +}); +``` + +## Amazon ECS Service Connect + +Service Connect is a managed AWS mesh network offering. It simplifies DNS queries and inter-service communication for +ECS Services by allowing customers to set up simple DNS aliases for their services, which are accessible to all +services that have enabled Service Connect. + +To enable Service Connect, you must have created a CloudMap namespace. The CDK can infer your cluster's default CloudMap namespace, +or you can specify a custom namespace. You must also have created a named port mapping on at least one container in your Task Definition. + +```ts +declare const cluster: ecs.Cluster; +declare const taskDefinition: ecs.TaskDefinition; +declare const container: ecs.ContainerDefinition; + +container.addPortMappings({ + name: 'api', + containerPort: 8080, +}); + +taskDefinition.addContainer(container); + +cluster.addDefaultCloudMapNamespace({ + name: 'local', +}); + +const service = new ecs.FargateService(this, 'Service', { + cluster, + taskDefinition, + serviceConnectConfiguration: { + services: [ + { + portMappingName: 'api', + dnsName: 'http-api', + port: 80, + }, + ], + }, +}); +``` + +Service Connect-enabled services may now reach this service at `http-api:80`. Traffic to this endpoint will +be routed to the container's port 8080. + +To opt a service into using service connect without advertising a port, simply call the 'enableServiceConnect' method on an initialized service. + +```ts +const service = new ecs.FargateService(this, 'Service', { + cluster, + taskDefinition +) +service.enableServiceConnect(); +``` + +Service Connect also allows custom logging, Service Discovery name, and configuration of the port where service connect traffic is received. + +```ts +const customService = new ecs.FargateService(this, 'CustomizedService', { + cluster, + taskDefinition, + serviceConnectConfiguration: { + logDriver: ecs.LogDrivers.awslogs({ + streamPrefix: 'sc-traffic', + }), + services: [ + { + portMappingName: 'api', + dnsName: 'customized-api', + port: 80, + ingressPortOverride: 20040, + discoveryName: 'custom', + }, + ], + }, +}); +``` + +## Enable pseudo-terminal (TTY) allocation + +You can allocate a pseudo-terminal (TTY) for a container passing `pseudoTerminal` option while adding the container +to the task definition. +This maps to Tty option in the ["Create a container section"](https://docs.docker.com/engine/api/v1.38/#operation/ContainerCreate) +of the [Docker Remote API](https://docs.docker.com/engine/api/v1.38/) and the --tty option to [`docker run`](https://docs.docker.com/engine/reference/commandline/run/). + +```ts +const taskDefinition = new ecs.Ec2TaskDefinition(this, 'TaskDef'); +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('example-image'), + pseudoTerminal: true +}); +``` diff --git a/packages/aws-cdk-lib/aws-ecs/index.ts b/packages/aws-cdk-lib/aws-ecs/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ecs/lib/amis.ts b/packages/aws-cdk-lib/aws-ecs/lib/amis.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/amis.ts rename to packages/aws-cdk-lib/aws-ecs/lib/amis.ts index bdccc04a7fab6..54c5aa12fc5fb 100644 --- a/packages/@aws-cdk/aws-ecs/lib/amis.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/amis.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ssm from '@aws-cdk/aws-ssm'; +import * as ec2 from '../../aws-ec2'; +import * as ssm from '../../aws-ssm'; // v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. // eslint-disable-next-line diff --git a/packages/@aws-cdk/aws-ecs/lib/base/_imported-task-definition.ts b/packages/aws-cdk-lib/aws-ecs/lib/base/_imported-task-definition.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs/lib/base/_imported-task-definition.ts rename to packages/aws-cdk-lib/aws-ecs/lib/base/_imported-task-definition.ts index 9b59865c3c610..9ee5eb50060f0 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/_imported-task-definition.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/base/_imported-task-definition.ts @@ -1,5 +1,5 @@ -import { IRole } from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; +import { IRole } from '../../../aws-iam'; +import { Resource } from '../../../core'; import { Construct } from 'constructs'; import { Compatibility, NetworkMode, isEc2Compatible, isFargateCompatible, isExternalCompatible } from './task-definition'; import { IEc2TaskDefinition } from '../ec2/ec2-task-definition'; diff --git a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts b/packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/base/base-service.ts rename to packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts index cb59541cdffa3..3d5642e4cda65 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts @@ -1,10 +1,10 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; +import * as appscaling from '../../../aws-applicationautoscaling'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as elb from '../../../aws-elasticloadbalancing'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as iam from '../../../aws-iam'; +import * as cloudmap from '../../../aws-servicediscovery'; import { Annotations, Duration, @@ -15,8 +15,8 @@ import { Stack, ArnFormat, FeatureFlags, -} from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +} from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ScalableTaskCount } from './scalable-task-count'; diff --git a/packages/@aws-cdk/aws-ecs/lib/base/from-service-attributes.ts b/packages/aws-cdk-lib/aws-ecs/lib/base/from-service-attributes.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/base/from-service-attributes.ts rename to packages/aws-cdk-lib/aws-ecs/lib/base/from-service-attributes.ts index cddbbe52ad87a..7dc1ebbc60dc8 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/from-service-attributes.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/base/from-service-attributes.ts @@ -1,5 +1,5 @@ -import { ArnFormat, FeatureFlags, Fn, Resource, Stack, Token } from '@aws-cdk/core'; -import { ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME } from '@aws-cdk/cx-api'; +import { ArnFormat, FeatureFlags, Fn, Resource, Stack, Token } from '../../../core'; +import { ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME } from '../../../cx-api'; import { Construct } from 'constructs'; import { IBaseService } from '../base/base-service'; import { ICluster } from '../cluster'; diff --git a/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts b/packages/aws-cdk-lib/aws-ecs/lib/base/scalable-task-count.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts rename to packages/aws-cdk-lib/aws-ecs/lib/base/scalable-task-count.ts index 00d7dd4f1a968..4ebeb178dc292 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/scalable-task-count.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/base/scalable-task-count.ts @@ -1,6 +1,6 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import * as appscaling from '../../../aws-applicationautoscaling'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts b/packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts rename to packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts index 235f47d0690fe..365299bbbbced 100644 --- a/packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { IResource, Lazy, Names, PhysicalName, Resource } from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import { IResource, Lazy, Names, PhysicalName, Resource } from '../../../core'; import { Construct } from 'constructs'; import { ImportedTaskDefinition } from './_imported-task-definition'; import { ContainerDefinition, ContainerDefinitionOptions, PortMapping, Protocol } from '../container-definition'; diff --git a/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts b/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts new file mode 100644 index 0000000000000..45da021aabb75 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts @@ -0,0 +1,1288 @@ +import * as autoscaling from '../../aws-autoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as cloudmap from '../../aws-servicediscovery'; +import { Duration, IResource, Resource, Stack, Aspects, ArnFormat, IAspect } from '../../core'; +import { Construct, IConstruct } from 'constructs'; +import { BottleRocketImage, EcsOptimizedAmi } from './amis'; +import { InstanceDrainHook } from './drain-hook/instance-drain-hook'; +import { ECSMetrics } from './ecs-canned-metrics.generated'; +import { CfnCluster, CfnCapacityProvider, CfnClusterCapacityProviderAssociations } from './ecs.generated'; + +const CLUSTER_SYMBOL = Symbol.for('@aws-cdk/aws-ecs/lib/cluster.Cluster'); + +/** + * The properties used to define an ECS cluster. + */ +export interface ClusterProps { + /** + * The name for the cluster. + * + * @default CloudFormation-generated name + */ + readonly clusterName?: string; + + /** + * The VPC where your ECS instances will be running or your ENIs will be deployed + * + * @default - creates a new VPC with two AZs + */ + readonly vpc?: ec2.IVpc; + + /** + * The service discovery namespace created in this cluster + * + * @default - no service discovery namespace created, you can use `addDefaultCloudMapNamespace` to add a + * default service discovery namespace later. + */ + readonly defaultCloudMapNamespace?: CloudMapNamespaceOptions; + + /** + * The ec2 capacity to add to the cluster + * + * @default - no EC2 capacity will be added, you can use `addCapacity` to add capacity later. + */ + readonly capacity?: AddCapacityOptions; + + /** + * The capacity providers to add to the cluster + * + * @default - None. Currently only FARGATE and FARGATE_SPOT are supported. + * @deprecated Use `ClusterProps.enableFargateCapacityProviders` instead. + */ + readonly capacityProviders?: string[]; + + /** + * Whether to enable Fargate Capacity Providers + * + * @default false + */ + readonly enableFargateCapacityProviders?: boolean; + + /** + * If true CloudWatch Container Insights will be enabled for the cluster + * + * @default - Container Insights will be disabled for this cluster. + */ + readonly containerInsights?: boolean; + + /** + * The execute command configuration for the cluster + * + * @default - no configuration will be provided. + */ + readonly executeCommandConfiguration?: ExecuteCommandConfiguration; +} + +/** + * The machine image type + */ +export enum MachineImageType { + /** + * Amazon ECS-optimized Amazon Linux 2 AMI + */ + AMAZON_LINUX_2, + /** + * Bottlerocket AMI + */ + BOTTLEROCKET +} + +/** + * A regional grouping of one or more container instances on which you can run tasks and services. + */ +export class Cluster extends Resource implements ICluster { + + /** + * Return whether the given object is a Cluster + */ + public static isCluster(x: any) : x is Cluster { + return x !== null && typeof(x) === 'object' && CLUSTER_SYMBOL in x; + } + + /** + * Import an existing cluster to the stack from its attributes. + */ + public static fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster { + return new ImportedCluster(scope, id, attrs); + } + + /** + * Import an existing cluster to the stack from the cluster ARN. + * This does not provide access to the vpc, hasEc2Capacity, or connections - + * use the `fromClusterAttributes` method to access those properties. + */ + public static fromClusterArn(scope: Construct, id: string, clusterArn: string): ICluster { + const stack = Stack.of(scope); + const arn = stack.splitArn(clusterArn, ArnFormat.SLASH_RESOURCE_NAME); + const clusterName = arn.resourceName; + + if (!clusterName) { + throw new Error(`Missing required Cluster Name from Cluster ARN: ${clusterArn}`); + } + + const errorSuffix = 'is not available for a Cluster imported using fromClusterArn(), please use fromClusterAttributes() instead.'; + + class Import extends Resource implements ICluster { + public readonly clusterArn = clusterArn; + public readonly clusterName = clusterName!; + get hasEc2Capacity(): boolean { + throw new Error(`hasEc2Capacity ${errorSuffix}`); + } + get connections(): ec2.Connections { + throw new Error(`connections ${errorSuffix}`); + } + get vpc(): ec2.IVpc { + throw new Error(`vpc ${errorSuffix}`); + } + } + + return new Import(scope, id, { + environmentFromArn: clusterArn, + }); + } + + /** + * Manage the allowed network connections for the cluster with Security Groups. + */ + public readonly connections: ec2.Connections = new ec2.Connections(); + + /** + * The VPC associated with the cluster. + */ + public readonly vpc: ec2.IVpc; + + /** + * The Amazon Resource Name (ARN) that identifies the cluster. + */ + public readonly clusterArn: string; + + /** + * The name of the cluster. + */ + public readonly clusterName: string; + + /** + * The names of both ASG and Fargate capacity providers associated with the cluster. + */ + private _capacityProviderNames: string[] = []; + + /** + * The cluster default capacity provider strategy. This takes the form of a list of CapacityProviderStrategy objects. + */ + private _defaultCapacityProviderStrategy: CapacityProviderStrategy[] = []; + + /** + * The AWS Cloud Map namespace to associate with the cluster. + */ + private _defaultCloudMapNamespace?: cloudmap.INamespace; + + /** + * Specifies whether the cluster has EC2 instance capacity. + */ + private _hasEc2Capacity: boolean = false; + + /** + * The autoscaling group for added Ec2 capacity + */ + private _autoscalingGroup?: autoscaling.IAutoScalingGroup; + + /** + * The execute command configuration for the cluster + */ + private _executeCommandConfiguration?: ExecuteCommandConfiguration; + + /** + * CfnCluster instance + */ + private _cfnCluster: CfnCluster; + + /** + * Constructs a new instance of the Cluster class. + */ + constructor(scope: Construct, id: string, props: ClusterProps = {}) { + super(scope, id, { + physicalName: props.clusterName, + }); + + /** + * clusterSettings needs to be undefined if containerInsights is not explicitly set in order to allow any + * containerInsights settings on the account to apply. See: + * https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-clustersettings.html#cfn-ecs-cluster-clustersettings-value + */ + let clusterSettings = undefined; + if (props.containerInsights !== undefined) { + clusterSettings = [{ name: 'containerInsights', value: props.containerInsights ? ContainerInsights.ENABLED : ContainerInsights.DISABLED }]; + } + + this._capacityProviderNames = props.capacityProviders ?? []; + if (props.enableFargateCapacityProviders) { + this.enableFargateCapacityProviders(); + } + + if (props.executeCommandConfiguration) { + if ((props.executeCommandConfiguration.logging === ExecuteCommandLogging.OVERRIDE) !== + (props.executeCommandConfiguration.logConfiguration !== undefined)) { + throw new Error('Execute command log configuration must only be specified when logging is OVERRIDE.'); + } + this._executeCommandConfiguration = props.executeCommandConfiguration; + } + + this._cfnCluster = new CfnCluster(this, 'Resource', { + clusterName: this.physicalName, + clusterSettings, + configuration: this._executeCommandConfiguration && this.renderExecuteCommandConfiguration(), + }); + + this.clusterArn = this.getResourceArnAttribute(this._cfnCluster.attrArn, { + service: 'ecs', + resource: 'cluster', + resourceName: this.physicalName, + }); + this.clusterName = this.getResourceNameAttribute(this._cfnCluster.ref); + + this.vpc = props.vpc || new ec2.Vpc(this, 'Vpc', { maxAzs: 2 }); + + this._defaultCloudMapNamespace = props.defaultCloudMapNamespace !== undefined + ? this.addDefaultCloudMapNamespace(props.defaultCloudMapNamespace) + : undefined; + + this._autoscalingGroup = props.capacity !== undefined + ? this.addCapacity('DefaultAutoScalingGroup', props.capacity) + : undefined; + + // Only create cluster capacity provider associations if there are any EC2 + // capacity providers. Ordinarily we'd just add the construct to the tree + // since it's harmless, but we'd prefer not to add unexpected new + // resources to the stack which could surprise users working with + // brown-field CDK apps and stacks. + Aspects.of(this).add(new MaybeCreateCapacityProviderAssociations(this, id)); + } + + /** + * Enable the Fargate capacity providers for this cluster. + */ + public enableFargateCapacityProviders() { + for (const provider of ['FARGATE', 'FARGATE_SPOT']) { + if (!this._capacityProviderNames.includes(provider)) { + this._capacityProviderNames.push(provider); + } + } + } + + /** + * Add default capacity provider strategy for this cluster. + * + * @param defaultCapacityProviderStrategy cluster default capacity provider strategy. This takes the form of a list of CapacityProviderStrategy objects. + * + * For example + * [ + * { + * capacityProvider: 'FARGATE', + * base: 10, + * weight: 50 + * } + * ] + */ + public addDefaultCapacityProviderStrategy(defaultCapacityProviderStrategy: CapacityProviderStrategy[]) { + if (this._defaultCapacityProviderStrategy.length > 0) { + throw new Error('Cluster default capacity provider strategy is already set.'); + } + + if (defaultCapacityProviderStrategy.some(dcp => dcp.capacityProvider.includes('FARGATE')) && defaultCapacityProviderStrategy.some(dcp => !dcp.capacityProvider.includes('FARGATE'))) { + throw new Error('A capacity provider strategy cannot contain a mix of capacity providers using Auto Scaling groups and Fargate providers. Specify one or the other and try again.'); + } + + defaultCapacityProviderStrategy.forEach(dcp => { + if (!this._capacityProviderNames.includes(dcp.capacityProvider)) { + throw new Error(`Capacity provider ${dcp.capacityProvider} must be added to the cluster with addAsgCapacityProvider() before it can be used in a default capacity provider strategy.`); + } + }); + + const defaultCapacityProvidersWithBase = defaultCapacityProviderStrategy.filter(dcp => !!dcp.base); + if (defaultCapacityProvidersWithBase.length > 1) { + throw new Error('Only 1 capacity provider in a capacity provider strategy can have a nonzero base.'); + } + this._defaultCapacityProviderStrategy = defaultCapacityProviderStrategy; + } + + private renderExecuteCommandConfiguration(): CfnCluster.ClusterConfigurationProperty { + return { + executeCommandConfiguration: { + kmsKeyId: this._executeCommandConfiguration?.kmsKey?.keyArn, + logConfiguration: this._executeCommandConfiguration?.logConfiguration && this.renderExecuteCommandLogConfiguration(), + logging: this._executeCommandConfiguration?.logging, + }, + }; + } + + private renderExecuteCommandLogConfiguration(): CfnCluster.ExecuteCommandLogConfigurationProperty { + const logConfiguration = this._executeCommandConfiguration?.logConfiguration; + if (logConfiguration?.s3EncryptionEnabled && !logConfiguration?.s3Bucket) { + throw new Error('You must specify an S3 bucket name in the execute command log configuration to enable S3 encryption.'); + } + if (logConfiguration?.cloudWatchEncryptionEnabled && !logConfiguration?.cloudWatchLogGroup) { + throw new Error('You must specify a CloudWatch log group in the execute command log configuration to enable CloudWatch encryption.'); + } + return { + cloudWatchEncryptionEnabled: logConfiguration?.cloudWatchEncryptionEnabled, + cloudWatchLogGroupName: logConfiguration?.cloudWatchLogGroup?.logGroupName, + s3BucketName: logConfiguration?.s3Bucket?.bucketName, + s3EncryptionEnabled: logConfiguration?.s3EncryptionEnabled, + s3KeyPrefix: logConfiguration?.s3KeyPrefix, + }; + } + + /** + * Add an AWS Cloud Map DNS namespace for this cluster. + * NOTE: HttpNamespaces are supported only for use cases involving Service Connect. For use cases involving both Service- + * Discovery and Service Connect, customers should manage the HttpNamespace outside of the Cluster.addDefaultCloudMapNamespace method. + */ + public addDefaultCloudMapNamespace(options: CloudMapNamespaceOptions): cloudmap.INamespace { + if (this._defaultCloudMapNamespace !== undefined) { + throw new Error('Can only add default namespace once.'); + } + + const namespaceType = options.type !== undefined + ? options.type + : cloudmap.NamespaceType.DNS_PRIVATE; + + let sdNamespace; + switch (namespaceType) { + case cloudmap.NamespaceType.DNS_PRIVATE: + sdNamespace = new cloudmap.PrivateDnsNamespace(this, 'DefaultServiceDiscoveryNamespace', { + name: options.name, + vpc: this.vpc, + }); + break; + case cloudmap.NamespaceType.DNS_PUBLIC: + sdNamespace = new cloudmap.PublicDnsNamespace(this, 'DefaultServiceDiscoveryNamespace', { + name: options.name, + }); + break; + case cloudmap.NamespaceType.HTTP: + sdNamespace = new cloudmap.HttpNamespace(this, 'DefaultServiceDiscoveryNamespace', { + name: options.name, + }); + break; + default: + throw new Error(`Namespace type ${namespaceType} is not supported.`); + } + + this._defaultCloudMapNamespace = sdNamespace; + if (options.useForServiceConnect) { + this._cfnCluster.serviceConnectDefaults = { + namespace: options.name, + }; + } + + return sdNamespace; + } + + /** + * Getter for _defaultCapacityProviderStrategy. This is necessary to correctly create Capacity Provider Associations. + */ + public get defaultCapacityProviderStrategy() { + return this._defaultCapacityProviderStrategy; + } + + /** + * Getter for _capacityProviderNames added to cluster + */ + public get capacityProviderNames() { + return this._capacityProviderNames; + } + + /** + * Getter for namespace added to cluster + */ + public get defaultCloudMapNamespace(): cloudmap.INamespace | undefined { + return this._defaultCloudMapNamespace; + } + + /** + * It is highly recommended to use `Cluster.addAsgCapacityProvider` instead of this method. + * + * This method adds compute capacity to a cluster by creating an AutoScalingGroup with the specified options. + * + * Returns the AutoScalingGroup so you can add autoscaling settings to it. + */ + public addCapacity(id: string, options: AddCapacityOptions): autoscaling.AutoScalingGroup { + // Do 2-way defaulting here: if the machineImageType is BOTTLEROCKET, pick the right AMI. + // Otherwise, determine the machineImageType from the given AMI. + const machineImage = options.machineImage ?? + (options.machineImageType === MachineImageType.BOTTLEROCKET ? new BottleRocketImage({ + architecture: options.instanceType.architecture, + }) : new EcsOptimizedAmi()); + + const machineImageType = options.machineImageType ?? + (BottleRocketImage.isBottleRocketImage(machineImage) ? MachineImageType.BOTTLEROCKET : MachineImageType.AMAZON_LINUX_2); + + const autoScalingGroup = new autoscaling.AutoScalingGroup(this, id, { + vpc: this.vpc, + machineImage, + updateType: !!options.updatePolicy ? undefined : options.updateType || autoscaling.UpdateType.REPLACING_UPDATE, + ...options, + }); + + this.addAutoScalingGroup(autoScalingGroup, { + machineImageType: machineImageType, + ...options, + }); + + return autoScalingGroup; + } + + /** + * This method adds an Auto Scaling Group Capacity Provider to a cluster. + * + * @param provider the capacity provider to add to this cluster. + */ + public addAsgCapacityProvider(provider: AsgCapacityProvider, options: AddAutoScalingGroupCapacityOptions = {}) { + // Don't add the same capacity provider more than once. + if (this._capacityProviderNames.includes(provider.capacityProviderName)) { + return; + } + this._hasEc2Capacity = true; + this.configureAutoScalingGroup(provider.autoScalingGroup, { + ...options, + machineImageType: provider.machineImageType, + // Don't enable the instance-draining lifecycle hook if managed termination protection is enabled + taskDrainTime: provider.enableManagedTerminationProtection ? Duration.seconds(0) : options.taskDrainTime, + canContainersAccessInstanceRole: options.canContainersAccessInstanceRole ?? provider.canContainersAccessInstanceRole, + }); + + this._capacityProviderNames.push(provider.capacityProviderName); + } + + /** + * This method adds compute capacity to a cluster using the specified AutoScalingGroup. + * + * @deprecated Use `Cluster.addAsgCapacityProvider` instead. + * @param autoScalingGroup the ASG to add to this cluster. + * [disable-awslint:ref-via-interface] is needed in order to install the ECS + * agent by updating the ASGs user data. + */ + public addAutoScalingGroup(autoScalingGroup: autoscaling.AutoScalingGroup, options: AddAutoScalingGroupCapacityOptions = {}) { + this._hasEc2Capacity = true; + this.connections.connections.addSecurityGroup(...autoScalingGroup.connections.securityGroups); + this.configureAutoScalingGroup(autoScalingGroup, options); + } + + private configureAutoScalingGroup(autoScalingGroup: autoscaling.AutoScalingGroup, options: AddAutoScalingGroupCapacityOptions = {}) { + if (autoScalingGroup.osType === ec2.OperatingSystemType.WINDOWS) { + this.configureWindowsAutoScalingGroup(autoScalingGroup, options); + } else { + // Tie instances to cluster + switch (options.machineImageType) { + // Bottlerocket AMI + case MachineImageType.BOTTLEROCKET: { + autoScalingGroup.addUserData( + // Connect to the cluster + // Source: https://github.com/bottlerocket-os/bottlerocket/blob/develop/QUICKSTART-ECS.md#connecting-to-your-cluster + '[settings.ecs]', + `cluster = "${this.clusterName}"`, + ); + // Enabling SSM + // Source: https://github.com/bottlerocket-os/bottlerocket/blob/develop/QUICKSTART-ECS.md#enabling-ssm + autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonSSMManagedInstanceCore')); + // required managed policy + autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonEC2ContainerServiceforEC2Role')); + break; + } + default: + // Amazon ECS-optimized AMI for Amazon Linux 2 + autoScalingGroup.addUserData(`echo ECS_CLUSTER=${this.clusterName} >> /etc/ecs/ecs.config`); + if (!options.canContainersAccessInstanceRole) { + // Deny containers access to instance metadata service + // Source: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html + autoScalingGroup.addUserData('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + autoScalingGroup.addUserData('sudo service iptables save'); + // The following is only for AwsVpc networking mode, but doesn't hurt for the other modes. + autoScalingGroup.addUserData('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + } + + if (autoScalingGroup.spotPrice && options.spotInstanceDraining) { + autoScalingGroup.addUserData('echo ECS_ENABLE_SPOT_INSTANCE_DRAINING=true >> /etc/ecs/ecs.config'); + } + } + } + + // ECS instances must be able to do these things + // Source: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html + // But, scoped down to minimal permissions required. + // Notes: + // - 'ecs:CreateCluster' removed. The cluster already exists. + autoScalingGroup.addToRolePolicy(new iam.PolicyStatement({ + actions: [ + 'ecs:DeregisterContainerInstance', + 'ecs:RegisterContainerInstance', + 'ecs:Submit*', + ], + resources: [ + this.clusterArn, + ], + })); + autoScalingGroup.addToRolePolicy(new iam.PolicyStatement({ + actions: [ + // These act on a cluster instance, and the instance doesn't exist until the service starts. + // Thus, scope to the cluster using a condition. + // See: https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonelasticcontainerservice.html + 'ecs:Poll', + 'ecs:StartTelemetrySession', + ], + resources: ['*'], + conditions: { + ArnEquals: { 'ecs:cluster': this.clusterArn }, + }, + })); + autoScalingGroup.addToRolePolicy(new iam.PolicyStatement({ + actions: [ + // These do not support resource constraints, and must be resource '*' + 'ecs:DiscoverPollEndpoint', + 'ecr:GetAuthorizationToken', + // Preserved for backwards compatibility. + // Users are able to enable cloudwatch agent using CDK. Existing + // customers might be installing CW agent as part of user-data so if we + // remove these permissions we will break that customer use cases. + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + resources: ['*'], + })); + + // 0 disables, otherwise forward to underlying implementation which picks the sane default + if (!options.taskDrainTime || options.taskDrainTime.toSeconds() !== 0) { + new InstanceDrainHook(autoScalingGroup, 'DrainECSHook', { + autoScalingGroup, + cluster: this, + drainTime: options.taskDrainTime, + topicEncryptionKey: options.topicEncryptionKey, + }); + } + } + + /** + * This method enables the Fargate or Fargate Spot capacity providers on the cluster. + * + * @param provider the capacity provider to add to this cluster. + * @deprecated Use `enableFargateCapacityProviders` instead. + * @see `addAsgCapacityProvider` to add an Auto Scaling Group capacity provider to the cluster. + */ + public addCapacityProvider(provider: string) { + if (!(provider === 'FARGATE' || provider === 'FARGATE_SPOT')) { + throw new Error('CapacityProvider not supported'); + } + + if (!this._capacityProviderNames.includes(provider)) { + this._capacityProviderNames.push(provider); + } + } + + private configureWindowsAutoScalingGroup(autoScalingGroup: autoscaling.AutoScalingGroup, options: AddAutoScalingGroupCapacityOptions = {}) { + // clear the cache of the agent + autoScalingGroup.addUserData('Remove-Item -Recurse C:\\ProgramData\\Amazon\\ECS\\Cache'); + + // pull the latest ECS Tools + autoScalingGroup.addUserData('Import-Module ECSTools'); + + // set the cluster name environment variable + autoScalingGroup.addUserData(`[Environment]::SetEnvironmentVariable("ECS_CLUSTER", "${this.clusterName}", "Machine")`); + autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_ENABLE_AWSLOGS_EXECUTIONROLE_OVERRIDE", "true", "Machine")'); + // tslint:disable-next-line: max-line-length + autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_AVAILABLE_LOGGING_DRIVERS", \'["json-file","awslogs"]\', "Machine")'); + + // enable instance draining + if (autoScalingGroup.spotPrice && options.spotInstanceDraining) { + autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_ENABLE_SPOT_INSTANCE_DRAINING", "true", "Machine")'); + } + + // enable task iam role + if (!options.canContainersAccessInstanceRole) { + autoScalingGroup.addUserData('[Environment]::SetEnvironmentVariable("ECS_ENABLE_TASK_IAM_ROLE", "true", "Machine")'); + autoScalingGroup.addUserData(`Initialize-ECSAgent -Cluster '${this.clusterName}' -EnableTaskIAMRole`); + } else { + autoScalingGroup.addUserData(`Initialize-ECSAgent -Cluster '${this.clusterName}'`); + } + } + + /** + * Getter for autoscaling group added to cluster + */ + public get autoscalingGroup(): autoscaling.IAutoScalingGroup | undefined { + return this._autoscalingGroup; + } + + /** + * Whether the cluster has EC2 capacity associated with it + */ + public get hasEc2Capacity(): boolean { + return this._hasEc2Capacity; + } + + /** + * Getter for execute command configuration associated with the cluster. + */ + public get executeCommandConfiguration(): ExecuteCommandConfiguration | undefined { + return this._executeCommandConfiguration; + } + + /** + * This method returns the CloudWatch metric for this clusters CPU reservation. + * + * @default average over 5 minutes + */ + public metricCpuReservation(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ECSMetrics.cpuReservationAverage, props); + } + + /** + * This method returns the CloudWatch metric for this clusters CPU utilization. + * + * @default average over 5 minutes + */ + public metricCpuUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ECSMetrics.cpuUtilizationAverage, props); + } + + /** + * This method returns the CloudWatch metric for this clusters memory reservation. + * + * @default average over 5 minutes + */ + public metricMemoryReservation(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ECSMetrics.memoryReservationAverage, props); + } + + /** + * This method returns the CloudWatch metric for this clusters memory utilization. + * + * @default average over 5 minutes + */ + public metricMemoryUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(ECSMetrics.memoryUtilizationAverage, props); + } + + /** + * This method returns the specifed CloudWatch metric for this cluster. + */ + public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + namespace: 'AWS/ECS', + metricName, + dimensionsMap: { ClusterName: this.clusterName }, + ...props, + }).attachTo(this); + } + + private cannedMetric( + fn: (dims: { ClusterName: string }) => cloudwatch.MetricProps, + props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + ...fn({ ClusterName: this.clusterName }), + ...props, + }).attachTo(this); + } +} + +Object.defineProperty(Cluster.prototype, CLUSTER_SYMBOL, { + value: true, + enumerable: false, + writable: false, +}); + +/** + * A regional grouping of one or more container instances on which you can run tasks and services. + */ +export interface ICluster extends IResource { + /** + * The name of the cluster. + * @attribute + */ + readonly clusterName: string; + + /** + * The Amazon Resource Name (ARN) that identifies the cluster. + * @attribute + */ + readonly clusterArn: string; + + /** + * The VPC associated with the cluster. + */ + readonly vpc: ec2.IVpc; + + /** + * Manage the allowed network connections for the cluster with Security Groups. + */ + readonly connections: ec2.Connections; + + /** + * Specifies whether the cluster has EC2 instance capacity. + */ + readonly hasEc2Capacity: boolean; + + /** + * The AWS Cloud Map namespace to associate with the cluster. + */ + readonly defaultCloudMapNamespace?: cloudmap.INamespace; + + /** + * The autoscaling group added to the cluster if capacity is associated to the cluster + */ + readonly autoscalingGroup?: autoscaling.IAutoScalingGroup; + + /** + * The execute command configuration for the cluster + */ + readonly executeCommandConfiguration?: ExecuteCommandConfiguration; +} + +/** + * The properties to import from the ECS cluster. + */ +export interface ClusterAttributes { + /** + * The name of the cluster. + */ + readonly clusterName: string; + + /** + * The Amazon Resource Name (ARN) that identifies the cluster. + * + * @default Derived from clusterName + */ + readonly clusterArn?: string; + + /** + * The VPC associated with the cluster. + */ + readonly vpc: ec2.IVpc; + + /** + * The security groups associated with the container instances registered to the cluster. + */ + readonly securityGroups: ec2.ISecurityGroup[]; + + /** + * Specifies whether the cluster has EC2 instance capacity. + * + * @default true + */ + readonly hasEc2Capacity?: boolean; + + /** + * The AWS Cloud Map namespace to associate with the cluster. + * + * @default - No default namespace + */ + readonly defaultCloudMapNamespace?: cloudmap.INamespace; + + /** + * Autoscaling group added to the cluster if capacity is added + * + * @default - No default autoscaling group + */ + readonly autoscalingGroup?: autoscaling.IAutoScalingGroup; + + /** + * The execute command configuration for the cluster + * + * @default - none. + */ + readonly executeCommandConfiguration?: ExecuteCommandConfiguration; +} + +/** + * An Cluster that has been imported + */ +class ImportedCluster extends Resource implements ICluster { + /** + * Name of the cluster + */ + public readonly clusterName: string; + + /** + * ARN of the cluster + */ + public readonly clusterArn: string; + + /** + * VPC that the cluster instances are running in + */ + public readonly vpc: ec2.IVpc; + + /** + * Security group of the cluster instances + */ + public readonly connections = new ec2.Connections(); + + /** + * Whether the cluster has EC2 capacity + */ + public readonly hasEc2Capacity: boolean; + + /** + * Cloudmap namespace created in the cluster + */ + private _defaultCloudMapNamespace?: cloudmap.INamespace; + + /** + * The execute command configuration for the cluster + */ + private _executeCommandConfiguration?: ExecuteCommandConfiguration; + + /** + * Constructs a new instance of the ImportedCluster class. + */ + constructor(scope: Construct, id: string, props: ClusterAttributes) { + super(scope, id); + this.clusterName = props.clusterName; + this.vpc = props.vpc; + this.hasEc2Capacity = props.hasEc2Capacity !== false; + this._defaultCloudMapNamespace = props.defaultCloudMapNamespace; + this._executeCommandConfiguration = props.executeCommandConfiguration; + + this.clusterArn = props.clusterArn ?? Stack.of(this).formatArn({ + service: 'ecs', + resource: 'cluster', + resourceName: props.clusterName, + }); + + this.connections = new ec2.Connections({ + securityGroups: props.securityGroups, + }); + } + + public get defaultCloudMapNamespace(): cloudmap.INamespace | undefined { + return this._defaultCloudMapNamespace; + } + + public get executeCommandConfiguration(): ExecuteCommandConfiguration | undefined { + return this._executeCommandConfiguration; + } +} + +/** + * The properties for adding an AutoScalingGroup. + */ +export interface AddAutoScalingGroupCapacityOptions { + /** + * Specifies whether the containers can access the container instance role. + * + * @default false + */ + readonly canContainersAccessInstanceRole?: boolean; + + /** + * The time period to wait before force terminating an instance that is draining. + * + * This creates a Lambda function that is used by a lifecycle hook for the + * AutoScalingGroup that will delay instance termination until all ECS tasks + * have drained from the instance. Set to 0 to disable task draining. + * + * Set to 0 to disable task draining. + * + * @deprecated The lifecycle draining hook is not configured if using the EC2 Capacity Provider. Enable managed termination protection instead. + * @default Duration.minutes(5) + */ + readonly taskDrainTime?: Duration; + + /** + * Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services. + * For more information, see [Using Spot Instances](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-spot.html). + * + * @default false + */ + readonly spotInstanceDraining?: boolean + + /** + * If `AddAutoScalingGroupCapacityOptions.taskDrainTime` is non-zero, then the ECS cluster creates an + * SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. + * If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. + * See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information. + * + * @default The SNS Topic will not be encrypted. + */ + readonly topicEncryptionKey?: kms.IKey; + + /** + * What type of machine image this is + * + * Depending on the setting, different UserData will automatically be added + * to the `AutoScalingGroup` to configure it properly for use with ECS. + * + * If you create an `AutoScalingGroup` yourself and are adding it via + * `addAutoScalingGroup()`, you must specify this value. If you are adding an + * `autoScalingGroup` via `addCapacity`, this value will be determined + * from the `machineImage` you pass. + * + * @default - Automatically determined from `machineImage`, if available, otherwise `MachineImageType.AMAZON_LINUX_2`. + */ + readonly machineImageType?: MachineImageType; +} + +/** + * The properties for adding instance capacity to an AutoScalingGroup. + */ +export interface AddCapacityOptions extends AddAutoScalingGroupCapacityOptions, autoscaling.CommonAutoScalingGroupProps { + /** + * The EC2 instance type to use when launching instances into the AutoScalingGroup. + */ + readonly instanceType: ec2.InstanceType; + + /** + * The ECS-optimized AMI variant to use + * + * The default is to use an ECS-optimized AMI of Amazon Linux 2 which is + * automatically updated to the latest version on every deployment. This will + * replace the instances in the AutoScalingGroup. Make sure you have not disabled + * task draining, to avoid downtime when the AMI updates. + * + * To use an image that does not update on every deployment, pass: + * + * ```ts + * const machineImage = ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.STANDARD, { + * cachedInContext: true, + * }); + * ``` + * + * For more information, see [Amazon ECS-optimized + * AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html). + * + * You must define either `machineImage` or `machineImageType`, not both. + * + * @default - Automatically updated, ECS-optimized Amazon Linux 2 + */ + readonly machineImage?: ec2.IMachineImage; +} + +/** + * The options for creating an AWS Cloud Map namespace. + */ +export interface CloudMapNamespaceOptions { + /** + * The name of the namespace, such as example.com. + */ + readonly name: string; + + /** + * The type of CloudMap Namespace to create. + * + * @default PrivateDns + */ + readonly type?: cloudmap.NamespaceType; + + /** + * The VPC to associate the namespace with. This property is required for private DNS namespaces. + * + * @default VPC of the cluster for Private DNS Namespace, otherwise none + */ + readonly vpc?: ec2.IVpc; + + /** + * This property specifies whether to set the provided namespace as the service connect default in the cluster properties. + * + * @default false + */ + readonly useForServiceConnect?: boolean; + +} + +enum ContainerInsights { + /** + * Enable CloudWatch Container Insights for the cluster + */ + + ENABLED = 'enabled', + + /** + * Disable CloudWatch Container Insights for the cluster + */ + DISABLED = 'disabled', +} + +/** + * A Capacity Provider strategy to use for the service. + */ +export interface CapacityProviderStrategy { + /** + * The name of the capacity provider. + */ + readonly capacityProvider: string; + + /** + * The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one + * capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default + * value of 0 is used. + * + * @default - none + */ + readonly base?: number; + + /** + * The weight value designates the relative percentage of the total number of tasks launched that should use the + * specified +capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied. + * + * @default - 0 + */ + readonly weight?: number; +} + +/** + * The details of the execute command configuration. For more information, see + * [ExecuteCommandConfiguration] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandconfiguration.html + */ +export interface ExecuteCommandConfiguration { + /** + * The AWS Key Management Service key ID to encrypt the data between the local client and the container. + * + * @default - none + */ + readonly kmsKey?: kms.IKey, + + /** + * The log configuration for the results of the execute command actions. The logs can be sent to CloudWatch Logs or an Amazon S3 bucket. + * + * @default - none + */ + readonly logConfiguration?: ExecuteCommandLogConfiguration, + + /** + * The log settings to use for logging the execute command session. + * + * @default - none + */ + readonly logging?: ExecuteCommandLogging, +} + +/** + * The log settings to use to for logging the execute command session. For more information, see + * [Logging] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandconfiguration.html#cfn-ecs-cluster-executecommandconfiguration-logging + */ +export enum ExecuteCommandLogging { + /** + * The execute command session is not logged. + */ + NONE = 'NONE', + + /** + * The awslogs configuration in the task definition is used. If no logging parameter is specified, it defaults to this value. If no awslogs log driver is configured in the task definition, the output won't be logged. + */ + DEFAULT = 'DEFAULT', + + /** + * Specify the logging details as a part of logConfiguration. + */ + OVERRIDE = 'OVERRIDE', +} + +/** + * The log configuration for the results of the execute command actions. The logs can be sent to CloudWatch Logs and/ or an Amazon S3 bucket. + * For more information, see [ExecuteCommandLogConfiguration] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-cluster-executecommandlogconfiguration.html + */ +export interface ExecuteCommandLogConfiguration { + /** + * Whether or not to enable encryption on the CloudWatch logs. + * + * @default - encryption will be disabled. + */ + readonly cloudWatchEncryptionEnabled?: boolean, + + /** + * The name of the CloudWatch log group to send logs to. The CloudWatch log group must already be created. + * @default - none + */ + readonly cloudWatchLogGroup?: logs.ILogGroup, + + /** + * The name of the S3 bucket to send logs to. The S3 bucket must already be created. + * + * @default - none + */ + readonly s3Bucket?: s3.IBucket, + + /** + * Whether or not to enable encryption on the CloudWatch logs. + * + * @default - encryption will be disabled. + */ + readonly s3EncryptionEnabled?: boolean, + + /** + * An optional folder in the S3 bucket to place logs in. + * + * @default - none + */ + readonly s3KeyPrefix?: string +} + +/** + * The options for creating an Auto Scaling Group Capacity Provider. + */ +export interface AsgCapacityProviderProps extends AddAutoScalingGroupCapacityOptions { + /** + * The name of the capacity provider. If a name is specified, + * it cannot start with `aws`, `ecs`, or `fargate`. If no name is specified, + * a default name in the CFNStackName-CFNResourceName-RandomString format is used. + * + * @default CloudFormation-generated name + */ + readonly capacityProviderName?: string; + + /** + * The autoscaling group to add as a Capacity Provider. + */ + readonly autoScalingGroup: autoscaling.IAutoScalingGroup; + + /** + * When enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you. + * This means your cluster will automatically scale instances based on the load your tasks put on the cluster. + * For more information, see [Using Managed Scaling](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html#asg-capacity-providers-managed-scaling) in the ECS Developer Guide. + * + * @default true + */ + readonly enableManagedScaling?: boolean; + + /** + * When enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon + * tasks. + * + * Scale-in protection will be automatically enabled on instances. When all non-daemon tasks are + * stopped on an instance, ECS initiates the scale-in process and turns off scale-in protection for the + * instance. The Auto Scaling Group can then terminate the instance. For more information see [Managed termination + * protection](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-auto-scaling.html#managed-termination-protection) + * in the ECS Developer Guide. + * + * Managed scaling must also be enabled. + * + * @default true + */ + readonly enableManagedTerminationProtection?: boolean; + + /** + * Maximum scaling step size. In most cases this should be left alone. + * + * @default 1000 + */ + readonly maximumScalingStepSize?: number; + + /** + * Minimum scaling step size. In most cases this should be left alone. + * + * @default 1 + */ + readonly minimumScalingStepSize?: number; + + /** + * Target capacity percent. In most cases this should be left alone. + * + * @default 100 + */ + readonly targetCapacityPercent?: number; +} + +/** + * An Auto Scaling Group Capacity Provider. This allows an ECS cluster to target + * a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and + * recommended), ECS can manage the number of instances in the ASG to fit the + * tasks, and can ensure that instances are not prematurely terminated while + * there are still tasks running on them. + */ +export class AsgCapacityProvider extends Construct { + /** + * Capacity provider name + * @default Chosen by CloudFormation + */ + readonly capacityProviderName: string; + + /** + * Auto Scaling Group + */ + readonly autoScalingGroup: autoscaling.AutoScalingGroup; + + /** + * Auto Scaling Group machineImageType. + */ + readonly machineImageType: MachineImageType; + + /** + * Whether managed termination protection is enabled. + */ + readonly enableManagedTerminationProtection?: boolean; + + /** + * Specifies whether the containers can access the container instance role. + * + * @default false + */ + readonly canContainersAccessInstanceRole?: boolean; + + constructor(scope: Construct, id: string, props: AsgCapacityProviderProps) { + super(scope, id); + this.autoScalingGroup = props.autoScalingGroup as autoscaling.AutoScalingGroup; + this.machineImageType = props.machineImageType ?? MachineImageType.AMAZON_LINUX_2; + this.canContainersAccessInstanceRole = props.canContainersAccessInstanceRole; + this.enableManagedTerminationProtection = props.enableManagedTerminationProtection ?? true; + + if (this.enableManagedTerminationProtection && props.enableManagedScaling === false) { + throw new Error('Cannot enable Managed Termination Protection on a Capacity Provider when Managed Scaling is disabled. Either enable Managed Scaling or disable Managed Termination Protection.'); + } + if (this.enableManagedTerminationProtection) { + this.autoScalingGroup.protectNewInstancesFromScaleIn(); + } + + if (props.capacityProviderName) { + if (!(/^(?!aws|ecs|fargate).+/gm.test(props.capacityProviderName))) { + throw new Error(`Invalid Capacity Provider Name: ${props.capacityProviderName}, If a name is specified, it cannot start with aws, ecs, or fargate.`); + } + } + const capacityProvider = new CfnCapacityProvider(this, id, { + name: props.capacityProviderName, + autoScalingGroupProvider: { + autoScalingGroupArn: this.autoScalingGroup.autoScalingGroupName, + managedScaling: props.enableManagedScaling === false ? undefined : { + status: 'ENABLED', + targetCapacity: props.targetCapacityPercent || 100, + maximumScalingStepSize: props.maximumScalingStepSize, + minimumScalingStepSize: props.minimumScalingStepSize, + }, + managedTerminationProtection: this.enableManagedTerminationProtection ? 'ENABLED' : 'DISABLED', + }, + }); + + this.capacityProviderName = capacityProvider.ref; + } +} + +/** + * A visitor that adds a capacity provider association to a Cluster only if + * the caller created any EC2 Capacity Providers. + */ +class MaybeCreateCapacityProviderAssociations implements IAspect { + private scope: Cluster; + private id: string; + private resource?: CfnClusterCapacityProviderAssociations; + + constructor(scope: Cluster, id: string) { + this.scope = scope; + this.id = id; + } + + public visit(node: IConstruct): void { + if (Cluster.isCluster(node)) { + if ((this.scope.defaultCapacityProviderStrategy.length > 0 || this.scope.capacityProviderNames.length > 0 && !this.resource)) { + this.resource = new CfnClusterCapacityProviderAssociations(this.scope, this.id, { + cluster: node.clusterName, + defaultCapacityProviderStrategy: this.scope.defaultCapacityProviderStrategy, + capacityProviders: this.scope.capacityProviderNames, + }); + } + } + } +} diff --git a/packages/@aws-cdk/aws-ecs/lib/container-definition.ts b/packages/aws-cdk-lib/aws-ecs/lib/container-definition.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/container-definition.ts rename to packages/aws-cdk-lib/aws-ecs/lib/container-definition.ts index f9c8a3bcf5392..91e2a81adffeb 100644 --- a/packages/@aws-cdk/aws-ecs/lib/container-definition.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/container-definition.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as ssm from '../../aws-ssm'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { NetworkMode, TaskDefinition } from './base/task-definition'; import { ContainerImage, ContainerImageConfig } from './container-image'; diff --git a/packages/@aws-cdk/aws-ecs/lib/container-image.ts b/packages/aws-cdk-lib/aws-ecs/lib/container-image.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/container-image.ts rename to packages/aws-cdk-lib/aws-ecs/lib/container-image.ts index 014cc93d2e7f6..64d4011e87889 100644 --- a/packages/@aws-cdk/aws-ecs/lib/container-image.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/container-image.ts @@ -1,5 +1,5 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import { DockerImageAsset, TarballImageAsset } from '@aws-cdk/aws-ecr-assets'; +import * as ecr from '../../aws-ecr'; +import { DockerImageAsset, TarballImageAsset } from '../../aws-ecr-assets'; import { Construct } from 'constructs'; import { ContainerDefinition } from './container-definition'; import { CfnTaskDefinition } from './ecs.generated'; diff --git a/packages/@aws-cdk/aws-ecs/lib/drain-hook/instance-drain-hook.ts b/packages/aws-cdk-lib/aws-ecs/lib/drain-hook/instance-drain-hook.ts similarity index 93% rename from packages/@aws-cdk/aws-ecs/lib/drain-hook/instance-drain-hook.ts rename to packages/aws-cdk-lib/aws-ecs/lib/drain-hook/instance-drain-hook.ts index 57ec41047e20d..ae9357a5666da 100644 --- a/packages/@aws-cdk/aws-ecs/lib/drain-hook/instance-drain-hook.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/drain-hook/instance-drain-hook.ts @@ -1,11 +1,11 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as hooks from '@aws-cdk/aws-autoscaling-hooktargets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; +import * as autoscaling from '../../../aws-autoscaling'; +import * as hooks from '../../../aws-autoscaling-hooktargets'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as lambda from '../../../aws-lambda'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { ICluster } from '../cluster'; diff --git a/packages/@aws-cdk/aws-ecs/lib/drain-hook/lambda-source/index.py b/packages/aws-cdk-lib/aws-ecs/lib/drain-hook/lambda-source/index.py similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/drain-hook/lambda-source/index.py rename to packages/aws-cdk-lib/aws-ecs/lib/drain-hook/lambda-source/index.py diff --git a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts b/packages/aws-cdk-lib/aws-ecs/lib/ec2/ec2-service.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts rename to packages/aws-cdk-lib/aws-ecs/lib/ec2/ec2-service.ts index db26265570aaa..6d936cc0820ba 100644 --- a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-service.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/ec2/ec2-service.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Lazy, Resource, Stack } from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import { Lazy, Resource, Stack } from '../../../core'; import { Construct } from 'constructs'; import { BaseService, BaseServiceOptions, DeploymentControllerType, IBaseService, IService, LaunchType } from '../base/base-service'; import { fromServiceAttributes, extractServiceNameFromArn } from '../base/from-service-attributes'; diff --git a/packages/@aws-cdk/aws-ecs/lib/ec2/ec2-task-definition.ts b/packages/aws-cdk-lib/aws-ecs/lib/ec2/ec2-task-definition.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/ec2/ec2-task-definition.ts rename to packages/aws-cdk-lib/aws-ecs/lib/ec2/ec2-task-definition.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/environment-file.ts b/packages/aws-cdk-lib/aws-ecs/lib/environment-file.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/environment-file.ts rename to packages/aws-cdk-lib/aws-ecs/lib/environment-file.ts index daaaf7db98d78..74db621b3c6ac 100644 --- a/packages/@aws-cdk/aws-ecs/lib/environment-file.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/environment-file.ts @@ -1,5 +1,5 @@ -import { IBucket, Location } from '@aws-cdk/aws-s3'; -import { Asset, AssetOptions } from '@aws-cdk/aws-s3-assets'; +import { IBucket, Location } from '../../aws-s3'; +import { Asset, AssetOptions } from '../../aws-s3-assets'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-ecs/lib/external/external-service.ts b/packages/aws-cdk-lib/aws-ecs/lib/external/external-service.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/external/external-service.ts rename to packages/aws-cdk-lib/aws-ecs/lib/external/external-service.ts index 377154e197f32..1059e38ab681c 100644 --- a/packages/@aws-cdk/aws-ecs/lib/external/external-service.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/external/external-service.ts @@ -1,8 +1,8 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import { ArnFormat, Resource, Stack } from '@aws-cdk/core'; +import * as appscaling from '../../../aws-applicationautoscaling'; +import * as ec2 from '../../../aws-ec2'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as cloudmap from '../../../aws-servicediscovery'; +import { ArnFormat, Resource, Stack } from '../../../core'; import { Construct } from 'constructs'; import { AssociateCloudMapServiceOptions, BaseService, BaseServiceOptions, CloudMapOptions, DeploymentControllerType, EcsTarget, IBaseService, IEcsLoadBalancerTarget, IService, LaunchType, PropagatedTagSource } from '../base/base-service'; import { fromServiceAttributes } from '../base/from-service-attributes'; diff --git a/packages/@aws-cdk/aws-ecs/lib/external/external-task-definition.ts b/packages/aws-cdk-lib/aws-ecs/lib/external/external-task-definition.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/external/external-task-definition.ts rename to packages/aws-cdk-lib/aws-ecs/lib/external/external-task-definition.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts b/packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-service.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts rename to packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-service.ts index 2339a0c0a9423..56c64eac1852c 100644 --- a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-service.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-service.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { BaseService, BaseServiceOptions, DeploymentControllerType, IBaseService, IService, LaunchType } from '../base/base-service'; import { fromServiceAttributes, extractServiceNameFromArn } from '../base/from-service-attributes'; diff --git a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts b/packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-task-definition.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts rename to packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-task-definition.ts index 5f5a8a99805e7..edeb85fa823fc 100644 --- a/packages/@aws-cdk/aws-ecs/lib/fargate/fargate-task-definition.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/fargate/fargate-task-definition.ts @@ -1,4 +1,4 @@ -import { Tokenization, Token } from '@aws-cdk/core'; +import { Tokenization, Token } from '../../../core'; import { Construct } from 'constructs'; import { ImportedTaskDefinition } from '../base/_imported-task-definition'; import { diff --git a/packages/@aws-cdk/aws-ecs/lib/firelens-log-router.ts b/packages/aws-cdk-lib/aws-ecs/lib/firelens-log-router.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/lib/firelens-log-router.ts rename to packages/aws-cdk-lib/aws-ecs/lib/firelens-log-router.ts index 76f6452095bb1..ea5ed7b756b41 100644 --- a/packages/@aws-cdk/aws-ecs/lib/firelens-log-router.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/firelens-log-router.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as ssm from '../../aws-ssm'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { TaskDefinition } from './base/task-definition'; import { ContainerDefinition, ContainerDefinitionOptions, ContainerDefinitionProps } from './container-definition'; diff --git a/packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts b/packages/aws-cdk-lib/aws-ecs/lib/images/asset-image.ts similarity index 92% rename from packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts rename to packages/aws-cdk-lib/aws-ecs/lib/images/asset-image.ts index 2b2a9e039bdb9..7f2fd2f766b34 100644 --- a/packages/@aws-cdk/aws-ecs/lib/images/asset-image.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/images/asset-image.ts @@ -1,4 +1,4 @@ -import { DockerImageAsset, DockerImageAssetOptions } from '@aws-cdk/aws-ecr-assets'; +import { DockerImageAsset, DockerImageAssetOptions } from '../../../aws-ecr-assets'; import { Construct } from 'constructs'; import { ContainerDefinition } from '../container-definition'; import { ContainerImage, ContainerImageConfig } from '../container-image'; diff --git a/packages/@aws-cdk/aws-ecs/lib/images/ecr.ts b/packages/aws-cdk-lib/aws-ecs/lib/images/ecr.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/images/ecr.ts rename to packages/aws-cdk-lib/aws-ecs/lib/images/ecr.ts index 3a89fd214882a..3038faedb0a66 100644 --- a/packages/@aws-cdk/aws-ecs/lib/images/ecr.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/images/ecr.ts @@ -1,4 +1,4 @@ -import * as ecr from '@aws-cdk/aws-ecr'; +import * as ecr from '../../../aws-ecr'; import { Construct } from 'constructs'; import { ContainerDefinition } from '../container-definition'; import { ContainerImage, ContainerImageConfig } from '../container-image'; diff --git a/packages/aws-cdk-lib/aws-ecs/lib/images/repository.ts b/packages/aws-cdk-lib/aws-ecs/lib/images/repository.ts new file mode 100644 index 0000000000000..88f2ff532dde4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/lib/images/repository.ts @@ -0,0 +1,54 @@ +import * as secretsmanager from '../../../aws-secretsmanager'; +import { Annotations, Token } from '../../../core'; +import { Construct } from 'constructs'; +import { ContainerDefinition } from '../container-definition'; +import { ContainerImage, ContainerImageConfig } from '../container-image'; + +/** + * Regex pattern to check if it is an ECR image URL. + * + */ +const ECR_IMAGE_REGEX = /(^[a-zA-Z0-9][a-zA-Z0-9-_]*).dkr.ecr.([a-zA-Z0-9][a-zA-Z0-9-_]*).amazonaws.com(.cn)?\/.*/; + +/** + * The properties for an image hosted in a public or private repository. + */ +export interface RepositoryImageProps { + /** + * The secret to expose to the container that contains the credentials for the image repository. + * The supported value is the full ARN of an AWS Secrets Manager secret. + */ + readonly credentials?: secretsmanager.ISecret; +} + +/** + * An image hosted in a public or private repository. For images hosted in Amazon ECR, see + * [EcrImage](https://docs.aws.amazon.com/AmazonECR/latest/userguide/images.html). + */ +export class RepositoryImage extends ContainerImage { + + /** + * Constructs a new instance of the RepositoryImage class. + */ + constructor(private readonly imageName: string, private readonly props: RepositoryImageProps = {}) { + super(); + } + + public bind(scope: Construct, containerDefinition: ContainerDefinition): ContainerImageConfig { + // name could be a Token - in that case, skip validation altogether + if (!Token.isUnresolved(this.imageName) && ECR_IMAGE_REGEX.test(this.imageName)) { + Annotations.of(scope).addWarning("Proper policies need to be attached before pulling from ECR repository, or use 'fromEcrRepository'."); + } + + if (this.props.credentials) { + this.props.credentials.grantRead(containerDefinition.taskDefinition.obtainExecutionRole()); + } + + return { + imageName: this.imageName, + repositoryCredentials: this.props.credentials && { + credentialsParameter: this.props.credentials.secretArn, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-ecs/lib/images/tag-parameter-container-image.ts b/packages/aws-cdk-lib/aws-ecs/lib/images/tag-parameter-container-image.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/lib/images/tag-parameter-container-image.ts rename to packages/aws-cdk-lib/aws-ecs/lib/images/tag-parameter-container-image.ts index 6e3c6ded7442f..c5c79884efad1 100644 --- a/packages/@aws-cdk/aws-ecs/lib/images/tag-parameter-container-image.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/images/tag-parameter-container-image.ts @@ -1,5 +1,5 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; +import * as ecr from '../../../aws-ecr'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { ContainerDefinition } from '../container-definition'; import { ContainerImage, ContainerImageConfig } from '../container-image'; diff --git a/packages/@aws-cdk/aws-ecs/lib/index.ts b/packages/aws-cdk-lib/aws-ecs/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/index.ts rename to packages/aws-cdk-lib/aws-ecs/lib/index.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts b/packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts rename to packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts index ebd24fa1235f0..8b65259c01c3d 100644 --- a/packages/@aws-cdk/aws-ecs/lib/linux-parameters.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/linux-parameters.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { CfnTaskDefinition } from './ecs.generated'; diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/aws-log-driver.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/aws-log-driver.ts index 7f539f072efd7..454796b2be4f4 100644 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/aws-log-driver.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/aws-log-driver.ts @@ -1,4 +1,4 @@ -import * as logs from '@aws-cdk/aws-logs'; +import * as logs from '../../../aws-logs'; import { Construct } from 'constructs'; import { LogDriver, LogDriverConfig } from './log-driver'; import { removeEmpty } from './utils'; diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/base-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/base-log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/base-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/base-log-driver.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/firelens-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/firelens-log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/firelens-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/firelens-log-driver.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/fluentd-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/fluentd-log-driver.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/fluentd-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/fluentd-log-driver.ts index 0cb37b9e3a621..0c1f4c73284f8 100644 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/fluentd-log-driver.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/fluentd-log-driver.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../../core'; import { Construct } from 'constructs'; import { BaseLogDriverProps } from './base-log-driver'; import { LogDriver, LogDriverConfig } from './log-driver'; diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/gelf-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/gelf-log-driver.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/gelf-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/gelf-log-driver.ts index e48cfa6b0fee4..f01b6f1a3c218 100644 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/gelf-log-driver.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/gelf-log-driver.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../../core'; import { Construct } from 'constructs'; import { BaseLogDriverProps } from './base-log-driver'; import { LogDriver, LogDriverConfig } from './log-driver'; diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/generic-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/generic-log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/generic-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/generic-log-driver.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/journald-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/journald-log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/journald-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/journald-log-driver.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/json-file-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/json-file-log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/json-file-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/json-file-log-driver.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/log-driver.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/log-drivers.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/log-drivers.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/log-drivers.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/log-drivers.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/splunk-log-driver.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/splunk-log-driver.ts index 8d4cda1ba1586..e5cefb822c7ca 100644 --- a/packages/@aws-cdk/aws-ecs/lib/log-drivers/splunk-log-driver.ts +++ b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/splunk-log-driver.ts @@ -1,4 +1,4 @@ -import { SecretValue } from '@aws-cdk/core'; +import { SecretValue } from '../../../core'; import { Construct } from 'constructs'; import { BaseLogDriverProps } from './base-log-driver'; import { LogDriver, LogDriverConfig } from './log-driver'; diff --git a/packages/@aws-cdk/aws-ecs/lib/log-drivers/syslog-log-driver.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/syslog-log-driver.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/log-drivers/syslog-log-driver.ts rename to packages/aws-cdk-lib/aws-ecs/lib/log-drivers/syslog-log-driver.ts diff --git a/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/utils.ts b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/utils.ts new file mode 100644 index 0000000000000..3df2bfeae1c3b --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/lib/log-drivers/utils.ts @@ -0,0 +1,73 @@ +import { Duration, SecretValue, Token } from '../../../core'; +import { BaseLogDriverProps } from './base-log-driver'; +import { TaskDefinition } from '../base/task-definition'; +import { Secret } from '../container-definition'; +import { CfnTaskDefinition } from '../ecs.generated'; + +/** + * Remove undefined values from a dictionary + */ +export function removeEmpty(x: { [key: string]: (T | undefined | string) }): { [key: string]: string } { + for (const key of Object.keys(x)) { + if (x[key] === undefined) { + delete x[key]; + } + } + return x as any; +} + +/** + * Checks that a value is a positive integer + */ +export function ensurePositiveInteger(val: number) { + if (!Token.isUnresolved(val) && Number.isInteger(val) && val < 0) { + throw new Error(`\`${val}\` must be a positive integer.`); + } +} + +/** + * Checks that a value is contained in a range of two other values + */ +export function ensureInRange(val: number, start: number, end: number) { + if (!Token.isUnresolved(val) && !(val >= start && val <= end)) { + throw new Error(`\`${val}\` must be within range ${start}:${end}`); + } +} + +export function stringifyOptions(options: { [key: string]: (SecretValue | Duration | string | string[] | number | boolean | undefined) }) { + const _options: { [key: string]: string } = {}; + const filteredOptions = removeEmpty(options); + + for (const [key, value] of Object.entries(filteredOptions)) { + // Convert value to string + _options[key] = SecretValue.isSecretValue(value) ? value.unsafeUnwrap() : `${value}`; + } + + return _options; +} + +export function renderCommonLogDriverOptions(opts: BaseLogDriverProps) { + return { + 'tag': opts.tag, + 'labels': joinWithCommas(opts.labels), + 'env': joinWithCommas(opts.env), + 'env-regex': opts.envRegex, + }; +} + +export function joinWithCommas(xs?: string[]): string | undefined { + return xs && xs.join(','); +} + +export function renderLogDriverSecretOptions(secretValue: { [key: string]: Secret }, taskDefinition: TaskDefinition): +CfnTaskDefinition.SecretProperty[] { + const secrets = []; + for (const [name, secret] of Object.entries(secretValue)) { + secret.grantRead(taskDefinition.obtainExecutionRole()); + secrets.push({ + name, + valueFrom: secret.arn, + }); + } + return secrets; +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/lib/placement.ts b/packages/aws-cdk-lib/aws-ecs/lib/placement.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/placement.ts rename to packages/aws-cdk-lib/aws-ecs/lib/placement.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/proxy-configuration/app-mesh-proxy-configuration.ts b/packages/aws-cdk-lib/aws-ecs/lib/proxy-configuration/app-mesh-proxy-configuration.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/proxy-configuration/app-mesh-proxy-configuration.ts rename to packages/aws-cdk-lib/aws-ecs/lib/proxy-configuration/app-mesh-proxy-configuration.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/proxy-configuration/proxy-configuration.ts b/packages/aws-cdk-lib/aws-ecs/lib/proxy-configuration/proxy-configuration.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/proxy-configuration/proxy-configuration.ts rename to packages/aws-cdk-lib/aws-ecs/lib/proxy-configuration/proxy-configuration.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/proxy-configuration/proxy-configurations.ts b/packages/aws-cdk-lib/aws-ecs/lib/proxy-configuration/proxy-configurations.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/proxy-configuration/proxy-configurations.ts rename to packages/aws-cdk-lib/aws-ecs/lib/proxy-configuration/proxy-configurations.ts diff --git a/packages/@aws-cdk/aws-ecs/lib/runtime-platform.ts b/packages/aws-cdk-lib/aws-ecs/lib/runtime-platform.ts similarity index 100% rename from packages/@aws-cdk/aws-ecs/lib/runtime-platform.ts rename to packages/aws-cdk-lib/aws-ecs/lib/runtime-platform.ts diff --git a/packages/@aws-cdk/aws-ecs/test/app-mesh-proxy-configuration.test.ts b/packages/aws-cdk-lib/aws-ecs/test/app-mesh-proxy-configuration.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/test/app-mesh-proxy-configuration.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/app-mesh-proxy-configuration.test.ts index 683a7301b54dd..8fc44a55cc19c 100644 --- a/packages/@aws-cdk/aws-ecs/test/app-mesh-proxy-configuration.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/app-mesh-proxy-configuration.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ecs from '../lib'; describe('app mesh proxy configuration', () => { diff --git a/packages/@aws-cdk/aws-ecs/test/aws-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/aws-log-driver.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs/test/aws-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/aws-log-driver.test.ts index de7e4faa24f19..8c8a4edf8a46a 100644 --- a/packages/@aws-cdk/aws-ecs/test/aws-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/aws-log-driver.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/base-service.test.ts b/packages/aws-cdk-lib/aws-ecs/test/base-service.test.ts similarity index 94% rename from packages/@aws-cdk/aws-ecs/test/base-service.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/base-service.test.ts index 4aafd851984e9..ca8d035807834 100644 --- a/packages/@aws-cdk/aws-ecs/test/base-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/base-service.test.ts @@ -1,7 +1,7 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { App, Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import { App, Stack } from '../../core'; import * as ecs from '../lib'; describe('When import an ECS Service', () => { diff --git a/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts b/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts new file mode 100644 index 0000000000000..c22e70137fae6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts @@ -0,0 +1,2912 @@ +import { Match, Template } from '../../assertions'; +import * as autoscaling from '../../aws-autoscaling'; +import * as ec2 from '../../aws-ec2'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as cloudmap from '../../aws-servicediscovery'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; +import * as ecs from '../lib'; + +describe('cluster', () => { + describe('isCluster() returns', () => { + test('true if given cluster instance', () => { + // GIVEN + const stack = new cdk.Stack(); + // WHEN + const createdCluster = new ecs.Cluster(stack, 'EcsCluster'); + // THEN + expect(ecs.Cluster.isCluster(createdCluster)).toBe(true); + }); + + test('false if given imported cluster instance', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + const importedSg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG1', 'sg-1', { allowAllOutbound: false }); + // WHEN + const importedCluster = ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster-name', + securityGroups: [importedSg], + vpc, + }); + // THEN + expect(ecs.Cluster.isCluster(importedCluster)).toBe(false); + }); + + test('false if given undefined', () => { + // THEN + expect(ecs.Cluster.isCluster(undefined)).toBe(false); + }); + }); + + describe('When creating an ECS Cluster', () => { + testDeprecated('with no properties set, it correctly sets default properties', () => { + // GIVEN + const stack = new cdk.Stack(); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + + Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { + CidrBlock: '10.0.0.0/16', + EnableDnsHostnames: true, + EnableDnsSupport: true, + InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, + Tags: [ + { + Key: 'Name', + Value: 'Default/EcsCluster/Vpc', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + InstanceType: 't2.micro', + IamInstanceProfile: { + Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', + }, + SecurityGroups: [ + { + 'Fn::GetAtt': [ + 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', + 'GroupId', + ], + }, + ], + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + }, + // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + MaxSize: '1', + MinSize: '1', + LaunchConfigurationName: { + Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', + }, + Tags: [ + { + Key: 'Name', + PropagateAtLaunch: true, + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VPCZoneIdentifier: [ + { + Ref: 'EcsClusterVpcPrivateSubnet1SubnetFAB0E487', + }, + { + Ref: 'EcsClusterVpcPrivateSubnet2SubnetC2B7B1BA', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + Tags: [ + { + Key: 'Name', + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VpcId: { + Ref: 'EcsClusterVpc779914AB', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'ec2.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'ecs:DeregisterContainerInstance', + 'ecs:RegisterContainerInstance', + 'ecs:Submit*', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + { + Action: [ + 'ecs:Poll', + 'ecs:StartTelemetrySession', + ], + Effect: 'Allow', + Resource: '*', + Condition: { + ArnEquals: { + 'ecs:cluster': { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + }, + }, + { + Action: [ + 'ecs:DiscoverPollEndpoint', + 'ecr:GetAuthorizationToken', + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + }); + }); + + testDeprecated('with only vpc set, it correctly sets default properties', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { + vpc, + }); + + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + + Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { + CidrBlock: '10.0.0.0/16', + EnableDnsHostnames: true, + EnableDnsSupport: true, + InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, + Tags: [ + { + Key: 'Name', + Value: 'Default/MyVpc', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + InstanceType: 't2.micro', + IamInstanceProfile: { + Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', + }, + SecurityGroups: [ + { + 'Fn::GetAtt': [ + 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', + 'GroupId', + ], + }, + ], + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + }, + // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + MaxSize: '1', + MinSize: '1', + LaunchConfigurationName: { + Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', + }, + Tags: [ + { + Key: 'Name', + PropagateAtLaunch: true, + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VPCZoneIdentifier: [ + { + Ref: 'MyVpcPrivateSubnet1Subnet5057CF7E', + }, + { + Ref: 'MyVpcPrivateSubnet2Subnet0040C983', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + Tags: [ + { + Key: 'Name', + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VpcId: { + Ref: 'MyVpcF9F0CA6F', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'ec2.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'ecs:DeregisterContainerInstance', + 'ecs:RegisterContainerInstance', + 'ecs:Submit*', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + { + Action: [ + 'ecs:Poll', + 'ecs:StartTelemetrySession', + ], + Effect: 'Allow', + Resource: '*', + Condition: { + ArnEquals: { + 'ecs:cluster': { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + }, + }, + { + Action: [ + 'ecs:DiscoverPollEndpoint', + 'ecr:GetAuthorizationToken', + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + }); + + + }); + + testDeprecated('multiple clusters with default capacity', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + // WHEN + for (let i = 0; i < 2; i++) { + const cluster = new ecs.Cluster(stack, `EcsCluster${i}`, { vpc }); + cluster.addCapacity('MyCapacity', { + instanceType: new ec2.InstanceType('m3.medium'), + }); + } + + + }); + + testDeprecated('lifecycle hook is automatically added', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { + vpc, + }); + + // WHEN + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LifecycleHook', { + AutoScalingGroupName: { Ref: 'EcsClusterDefaultAutoScalingGroupASGC1A785DB' }, + LifecycleTransition: 'autoscaling:EC2_INSTANCE_TERMINATING', + DefaultResult: 'CONTINUE', + HeartbeatTimeout: 300, + NotificationTargetARN: { Ref: 'EcsClusterDefaultAutoScalingGroupLifecycleHookDrainHookTopicACD2D4A4' }, + RoleARN: { 'Fn::GetAtt': ['EcsClusterDefaultAutoScalingGroupLifecycleHookDrainHookRoleA38EC83B', 'Arn'] }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Timeout: 310, + Environment: { + Variables: { + CLUSTER: { + Ref: 'EcsCluster97242B84', + }, + }, + }, + Handler: 'index.lambda_handler', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'ec2:DescribeInstances', + 'ec2:DescribeInstanceAttribute', + 'ec2:DescribeInstanceStatus', + 'ec2:DescribeHosts', + ], + Effect: 'Allow', + Resource: '*', + }, + { + Action: 'autoscaling:CompleteLifecycleAction', + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':autoscaling:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':autoScalingGroup:*:autoScalingGroupName/', + { + Ref: 'EcsClusterDefaultAutoScalingGroupASGC1A785DB', + }, + ], + ], + }, + }, + { + Action: [ + 'ecs:DescribeContainerInstances', + 'ecs:DescribeTasks', + ], + Effect: 'Allow', + Resource: '*', + Condition: { + ArnEquals: { + 'ecs:cluster': { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + }, + }, + { + Action: [ + 'ecs:ListContainerInstances', + 'ecs:SubmitContainerStateChange', + 'ecs:SubmitTaskStateChange', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + { + Action: [ + 'ecs:UpdateContainerInstancesState', + 'ecs:ListTasks', + ], + Condition: { + ArnEquals: { + 'ecs:cluster': { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + }, + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'EcsClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRoleDefaultPolicyA45BF396', + Roles: [ + { + Ref: 'EcsClusterDefaultAutoScalingGroupDrainECSHookFunctionServiceRole94543EDA', + }, + ], + }); + + + }); + + testDeprecated('lifecycle hook with encrypted SNS is added correctly', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { + vpc, + }); + const key = new kms.Key(stack, 'Key'); + + // WHEN + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + topicEncryptionKey: key, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + KmsMasterKeyId: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + }); + + + }); + + testDeprecated('with capacity and cloudmap namespace properties set', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + new ecs.Cluster(stack, 'EcsCluster', { + vpc, + capacity: { + instanceType: new ec2.InstanceType('t2.micro'), + }, + defaultCloudMapNamespace: { + name: 'foo.com', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::PrivateDnsNamespace', { + Name: 'foo.com', + Vpc: { + Ref: 'MyVpcF9F0CA6F', + }, + }); + + Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { + CidrBlock: '10.0.0.0/16', + EnableDnsHostnames: true, + EnableDnsSupport: true, + InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, + Tags: [ + { + Key: 'Name', + Value: 'Default/MyVpc', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + InstanceType: 't2.micro', + IamInstanceProfile: { + Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', + }, + SecurityGroups: [ + { + 'Fn::GetAtt': [ + 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', + 'GroupId', + ], + }, + ], + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + }, + // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + MaxSize: '1', + MinSize: '1', + LaunchConfigurationName: { + Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', + }, + Tags: [ + { + Key: 'Name', + PropagateAtLaunch: true, + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VPCZoneIdentifier: [ + { + Ref: 'MyVpcPrivateSubnet1Subnet5057CF7E', + }, + { + Ref: 'MyVpcPrivateSubnet2Subnet0040C983', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + Tags: [ + { + Key: 'Name', + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VpcId: { + Ref: 'MyVpcF9F0CA6F', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'ec2.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'ecs:DeregisterContainerInstance', + 'ecs:RegisterContainerInstance', + 'ecs:Submit*', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + { + Action: [ + 'ecs:Poll', + 'ecs:StartTelemetrySession', + ], + Effect: 'Allow', + Resource: '*', + Condition: { + ArnEquals: { + 'ecs:cluster': { + 'Fn::GetAtt': [ + 'EcsCluster97242B84', + 'Arn', + ], + }, + }, + }, + }, + { + Action: [ + 'ecs:DiscoverPollEndpoint', + 'ecr:GetAuthorizationToken', + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + }); + + + }); + }); + + testDeprecated('allows specifying instance type', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('m3.large'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + InstanceType: 'm3.large', + }); + + + }); + + testDeprecated('allows specifying cluster size', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + desiredCapacity: 3, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + MaxSize: '3', + }); + + + }); + + testDeprecated('configures userdata with powershell if windows machine image is specified', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('WindowsAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: new ecs.EcsOptimizedAmi({ + windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiwindowsserver2019englishfullrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + InstanceType: 't2.micro', + IamInstanceProfile: { + Ref: 'EcsClusterWindowsAutoScalingGroupInstanceProfile65DFA6BB', + }, + SecurityGroups: [ + { + 'Fn::GetAtt': [ + 'EcsClusterWindowsAutoScalingGroupInstanceSecurityGroupDA468DF1', + 'GroupId', + ], + }, + ], + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + 'Remove-Item -Recurse C:\\ProgramData\\Amazon\\ECS\\Cache\nImport-Module ECSTools\n[Environment]::SetEnvironmentVariable("ECS_CLUSTER", "', + { + Ref: 'EcsCluster97242B84', + }, + "\", \"Machine\")\n[Environment]::SetEnvironmentVariable(\"ECS_ENABLE_AWSLOGS_EXECUTIONROLE_OVERRIDE\", \"true\", \"Machine\")\n[Environment]::SetEnvironmentVariable(\"ECS_AVAILABLE_LOGGING_DRIVERS\", '[\"json-file\",\"awslogs\"]', \"Machine\")\n[Environment]::SetEnvironmentVariable(\"ECS_ENABLE_TASK_IAM_ROLE\", \"true\", \"Machine\")\nInitialize-ECSAgent -Cluster '", + { + Ref: 'EcsCluster97242B84', + }, + "' -EnableTaskIAMRole", + ], + ], + }, + }, + }); + + + }); + + /* + * TODO:v2.0.0 BEGINNING OF OBSOLETE BLOCK + */ + testDeprecated('allows specifying special HW AMI Type', () => { + // GIVEN + const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('GpuAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: new ecs.EcsOptimizedAmi({ + hardwareType: ecs.AmiHardwareType.GPU, + }), + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + }); + + expect(template.Parameters).toEqual({ + SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id', + }, + }); + + + }); + + testDeprecated('errors if amazon linux given with special HW type', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // THEN + expect(() => { + cluster.addCapacity('GpuAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: new ecs.EcsOptimizedAmi({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX, + hardwareType: ecs.AmiHardwareType.GPU, + }), + }); + }).toThrow(/Amazon Linux does not support special hardware type/); + + + }); + + testDeprecated('allows specifying windows image', () => { + // GIVEN + const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('WindowsAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: new ecs.EcsOptimizedAmi({ + windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, + }), + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Parameters).toEqual({ + SsmParameterValueawsserviceecsoptimizedamiwindowsserver2019englishfullrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/ecs/optimized-ami/windows_server/2019/english/full/recommended/image_id', + }, + }); + + + }); + + testDeprecated('errors if windows given with special HW type', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // THEN + expect(() => { + cluster.addCapacity('WindowsGpuAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: new ecs.EcsOptimizedAmi({ + windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, + hardwareType: ecs.AmiHardwareType.GPU, + }), + }); + }).toThrow(/Windows Server does not support special hardware type/); + + + }); + + testDeprecated('errors if windowsVersion and linux generation are set', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // THEN + expect(() => { + cluster.addCapacity('WindowsScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: new ecs.EcsOptimizedAmi({ + windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX, + }), + }); + }).toThrow(/"windowsVersion" and Linux image "generation" cannot be both set/); + + + }); + + testDeprecated('allows returning the correct image for windows for EcsOptimizedAmi', () => { + // GIVEN + const stack = new cdk.Stack(); + const ami = new ecs.EcsOptimizedAmi({ + windowsVersion: ecs.WindowsOptimizedVersion.SERVER_2019, + }); + + expect(ami.getImage(stack).osType).toEqual(ec2.OperatingSystemType.WINDOWS); + + + }); + + testDeprecated('allows returning the correct image for linux for EcsOptimizedAmi', () => { + // GIVEN + const stack = new cdk.Stack(); + const ami = new ecs.EcsOptimizedAmi({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX, + }); + + expect(ami.getImage(stack).osType).toEqual(ec2.OperatingSystemType.LINUX); + + + }); + + testDeprecated('allows returning the correct image for linux 2 for EcsOptimizedAmi', () => { + // GIVEN + const stack = new cdk.Stack(); + const ami = new ecs.EcsOptimizedAmi({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, + }); + + expect(ami.getImage(stack).osType).toEqual(ec2.OperatingSystemType.LINUX); + + + }); + + test('allows returning the correct image for linux for EcsOptimizedImage', () => { + // GIVEN + const stack = new cdk.Stack(); + + expect(ecs.EcsOptimizedImage.amazonLinux().getImage(stack).osType).toEqual( + ec2.OperatingSystemType.LINUX); + + + }); + + test('allows returning the correct image for linux 2 for EcsOptimizedImage', () => { + // GIVEN + const stack = new cdk.Stack(); + + expect(ecs.EcsOptimizedImage.amazonLinux2().getImage(stack).osType).toEqual( + ec2.OperatingSystemType.LINUX); + + + }); + + test('allows returning the correct image for linux 2 for EcsOptimizedImage with ARM hardware', () => { + // GIVEN + const stack = new cdk.Stack(); + + expect(ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.ARM).getImage(stack).osType).toEqual( + ec2.OperatingSystemType.LINUX); + + + }); + + + test('allows returning the correct image for windows for EcsOptimizedImage', () => { + // GIVEN + const stack = new cdk.Stack(); + + expect(ecs.EcsOptimizedImage.windows(ecs.WindowsOptimizedVersion.SERVER_2019).getImage(stack).osType).toEqual( + ec2.OperatingSystemType.WINDOWS); + + + }); + + test('allows setting cluster ServiceConnectDefaults.Namespace property when useAsServiceConnectDefault is true', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // WHEN + cluster.addDefaultCloudMapNamespace({ + name: 'foo.com', + useForServiceConnect: true, + }); + + // THEN + expect((cluster as any)._cfnCluster.serviceConnectDefaults.namespace).toBe('foo.com'); + }); + + test('allows setting cluster _defaultCloudMapNamespace for HTTP namespace', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + // WHEN + const namespace = cluster.addDefaultCloudMapNamespace({ + name: 'foo', + type: cloudmap.NamespaceType.HTTP, + }); + // THEN + expect(namespace.namespaceName).toBe('foo'); + }); + + /* + * TODO:v2.0.0 END OF OBSOLETE BLOCK + */ + + testDeprecated('allows specifying special HW AMI Type v2', () => { + // GIVEN + const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('GpuAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.GPU), + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + }); + + expect(template.Parameters).toEqual({ + SsmParameterValueawsserviceecsoptimizedamiamazonlinux2gpurecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id', + }, + }); + + + }); + + testDeprecated('allows specifying Amazon Linux v1 AMI', () => { + // GIVEN + const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('GpuAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.amazonLinux(), + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinuxrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + }); + + expect(template.Parameters).toEqual({ + SsmParameterValueawsserviceecsoptimizedamiamazonlinuxrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/ecs/optimized-ami/amazon-linux/recommended/image_id', + }, + }); + + + }); + + testDeprecated('allows specifying windows image v2', () => { + // GIVEN + const app = new cdk.App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('WindowsAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + machineImage: ecs.EcsOptimizedImage.windows(ecs.WindowsOptimizedVersion.SERVER_2019), + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Parameters).toEqual({ + SsmParameterValueawsserviceecsoptimizedamiwindowsserver2019englishfullrecommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter: { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/ecs/optimized-ami/windows_server/2019/english/full/recommended/image_id', + }, + }); + + + }); + + testDeprecated('allows specifying spot fleet', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + spotPrice: '0.31', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + SpotPrice: '0.31', + }); + + + }); + + testDeprecated('allows specifying drain time', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + taskDrainTime: cdk.Duration.minutes(1), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LifecycleHook', { + HeartbeatTimeout: 60, + }); + + + }); + + testDeprecated('allows specifying automated spot draining', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('c5.xlarge'), + spotPrice: '0.0735', + spotInstanceDraining: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + }, + ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config\necho ECS_ENABLE_SPOT_INSTANCE_DRAINING=true >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + + }); + + testDeprecated('allows containers access to instance metadata service', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + canContainersAccessInstanceRole: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + }, + ' >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + + }); + + testDeprecated('allows adding default service discovery namespace', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + + // WHEN + cluster.addDefaultCloudMapNamespace({ + name: 'foo.com', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::PrivateDnsNamespace', { + Name: 'foo.com', + Vpc: { + Ref: 'MyVpcF9F0CA6F', + }, + }); + + + }); + + testDeprecated('allows adding public service discovery namespace', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + + // WHEN + cluster.addDefaultCloudMapNamespace({ + name: 'foo.com', + type: cloudmap.NamespaceType.DNS_PUBLIC, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::PublicDnsNamespace', { + Name: 'foo.com', + }); + + expect(cluster.defaultCloudMapNamespace!.type).toEqual(cloudmap.NamespaceType.DNS_PUBLIC); + + + }); + + testDeprecated('throws if default service discovery namespace added more than once', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + }); + + // WHEN + cluster.addDefaultCloudMapNamespace({ + name: 'foo.com', + }); + + // THEN + expect(() => { + cluster.addDefaultCloudMapNamespace({ + name: 'foo.com', + }); + }).toThrow(/Can only add default namespace once./); + + + }); + + + test('export/import of a cluster with a namespace', () => { + // GIVEN + const stack1 = new cdk.Stack(); + const vpc1 = new ec2.Vpc(stack1, 'Vpc'); + const cluster1 = new ecs.Cluster(stack1, 'Cluster', { vpc: vpc1 }); + cluster1.addDefaultCloudMapNamespace({ + name: 'hello.com', + }); + + const stack2 = new cdk.Stack(); + + // WHEN + const cluster2 = ecs.Cluster.fromClusterAttributes(stack2, 'Cluster', { + vpc: vpc1, + securityGroups: cluster1.connections.securityGroups, + defaultCloudMapNamespace: cloudmap.PrivateDnsNamespace.fromPrivateDnsNamespaceAttributes(stack2, 'ns', { + namespaceId: 'import-namespace-id', + namespaceArn: 'import-namespace-arn', + namespaceName: 'import-namespace-name', + }), + clusterName: 'cluster-name', + }); + + // THEN + expect(cluster2.defaultCloudMapNamespace!.type).toEqual(cloudmap.NamespaceType.DNS_PRIVATE); + expect(stack2.resolve(cluster2.defaultCloudMapNamespace!.namespaceId)).toEqual('import-namespace-id'); + + // Can retrieve subnets from VPC - will throw 'There are no 'Private' subnets in this VPC. Use a different VPC subnet selection.' if broken. + cluster2.vpc.selectSubnets(); + + + }); + + test('imported cluster with imported security groups honors allowAllOutbound', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + const importedSg1 = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG1', 'sg-1', { allowAllOutbound: false }); + const importedSg2 = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG2', 'sg-2'); + + const cluster = ecs.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster-name', + securityGroups: [importedSg1, importedSg2], + vpc, + }); + + // WHEN + cluster.connections.allowToAnyIpv4(ec2.Port.tcp(443)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: 'sg-1', + }); + + Template.fromStack(stack).resourceCountIs('AWS::EC2::SecurityGroupEgress', 1); + + + }); + + test('Metric', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc', {}); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // THEN + expect(stack.resolve(cluster.metricCpuReservation())).toEqual({ + dimensions: { + ClusterName: { Ref: 'EcsCluster97242B84' }, + }, + namespace: 'AWS/ECS', + metricName: 'CPUReservation', + period: cdk.Duration.minutes(5), + statistic: 'Average', + }); + + expect(stack.resolve(cluster.metricMemoryReservation())).toEqual({ + dimensions: { + ClusterName: { Ref: 'EcsCluster97242B84' }, + }, + namespace: 'AWS/ECS', + metricName: 'MemoryReservation', + period: cdk.Duration.minutes(5), + statistic: 'Average', + }); + + expect(stack.resolve(cluster.metric('myMetric'))).toEqual({ + dimensions: { + ClusterName: { Ref: 'EcsCluster97242B84' }, + }, + namespace: 'AWS/ECS', + metricName: 'myMetric', + period: cdk.Duration.minutes(5), + statistic: 'Average', + }); + + + }); + + testDeprecated('ASG with a public VPC without NAT Gateways', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyPublicVpc', { + natGateways: 0, + subnetConfiguration: [ + { cidrMask: 24, name: 'ingress', subnetType: ec2.SubnetType.PUBLIC }, + ], + }); + + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + // WHEN + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + associatePublicIpAddress: true, + vpcSubnets: { + onePerAz: true, + subnetType: ec2.SubnetType.PUBLIC, + }, + }); + + Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', { + CidrBlock: '10.0.0.0/16', + EnableDnsHostnames: true, + EnableDnsSupport: true, + InstanceTenancy: ec2.DefaultInstanceTenancy.DEFAULT, + Tags: [ + { + Key: 'Name', + Value: 'Default/MyPublicVpc', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + InstanceType: 't2.micro', + AssociatePublicIpAddress: true, + IamInstanceProfile: { + Ref: 'EcsClusterDefaultAutoScalingGroupInstanceProfile2CE606B3', + }, + SecurityGroups: [ + { + 'Fn::GetAtt': [ + 'EcsClusterDefaultAutoScalingGroupInstanceSecurityGroup912E1231', + 'GroupId', + ], + }, + ], + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + }, + // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + MaxSize: '1', + MinSize: '1', + LaunchConfigurationName: { + Ref: 'EcsClusterDefaultAutoScalingGroupLaunchConfigB7E376C1', + }, + Tags: [ + { + Key: 'Name', + PropagateAtLaunch: true, + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VPCZoneIdentifier: [ + { + Ref: 'MyPublicVpcingressSubnet1Subnet9191044C', + }, + { + Ref: 'MyPublicVpcingressSubnet2SubnetD2F2E034', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Default/EcsCluster/DefaultAutoScalingGroup/InstanceSecurityGroup', + SecurityGroupEgress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow all outbound traffic by default', + IpProtocol: '-1', + }, + ], + Tags: [ + { + Key: 'Name', + Value: 'Default/EcsCluster/DefaultAutoScalingGroup', + }, + ], + VpcId: { + Ref: 'MyPublicVpcA2BF6CDA', + }, + }); + + // THEN + + }); + + test('enable container insights', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + new ecs.Cluster(stack, 'EcsCluster', { containerInsights: true }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + ClusterSettings: [ + { + Name: 'containerInsights', + Value: 'enabled', + }, + ], + }); + + + }); + + test('disable container insights', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + new ecs.Cluster(stack, 'EcsCluster', { containerInsights: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + ClusterSettings: [ + { + Name: 'containerInsights', + Value: 'disabled', + }, + ], + }); + + + }); + + test('default container insights is undefined', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + new ecs.Cluster(stack, 'EcsCluster'); + + // THEN + const assembly = app.synth(); + const stackAssembly = assembly.getStackByName(stack.stackName); + const template = stackAssembly.template; + + expect( + template.Resources.EcsCluster97242B84.Properties === undefined || + template.Resources.EcsCluster97242B84.Properties.ClusterSettings === undefined, + ).toEqual(true); + + + }); + + test('BottleRocketImage() returns correct AMI', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // WHEN + new ecs.BottleRocketImage().getImage(stack); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketawsecs') && + (v as any).Default.includes('/bottlerocket/'), + )).toEqual(true); + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketawsecs') && + (v as any).Default.includes('/aws-ecs-1/'), + )).toEqual(true); + + }); + + describe('isBottleRocketImage() returns', () => { + test('true if given bottleRocketImage instance', () => { + // WHEN + const bottleRockectImage = new ecs.BottleRocketImage(); + // THEN + expect(ecs.BottleRocketImage.isBottleRocketImage(bottleRockectImage)).toBe(true); + }); + + test('false if given amazonLinux instance', () => { + // GIVEN + const wrongImage = ec2.MachineImage.latestAmazonLinux(); + // THEN + expect(ecs.BottleRocketImage.isBottleRocketImage(wrongImage)).toBe(false); + }); + + test('false if given undefined', () => { + // THEN + expect(ecs.BottleRocketImage.isBottleRocketImage(undefined)).toBe(false); + }); + }); + + testDeprecated('cluster capacity with bottlerocket AMI, by setting machineImageType', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImageType: ecs.MachineImageType.BOTTLEROCKET, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ECS::Cluster', 1); + Template.fromStack(stack).resourceCountIs('AWS::AutoScaling::AutoScalingGroup', 1); + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsservicebottlerocketawsecs1x8664latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '\n[settings.ecs]\ncluster = "', + { + Ref: 'EcsCluster97242B84', + }, + '"', + ], + ], + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'ec2.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/AmazonSSMManagedInstanceCore', + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role', + ], + ], + }, + ], + Tags: [ + { + Key: 'Name', + Value: 'test/EcsCluster/bottlerocket-asg', + }, + ], + }); + }); + + testDeprecated('correct bottlerocket AMI for ARM64 architecture', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('m6g.large'), + machineImageType: ecs.MachineImageType.BOTTLEROCKET, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsservicebottlerocketawsecs1arm64latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + }); + + Template.fromStack(stack).hasParameter('SsmParameterValueawsservicebottlerocketawsecs1arm64latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/bottlerocket/aws-ecs-1/arm64/latest/image_id', + }); + }); + + testDeprecated('throws when machineImage and machineImageType both specified', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '\n[settings.ecs]\ncluster = "', + { + Ref: 'EcsCluster97242B84', + }, + '"', + ], + ], + }, + }, + }); + + }); + + testDeprecated('updatePolicy set when passed without updateType', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); + }); + + testDeprecated('undefined updateType & updatePolicy replaced by default updatePolicy', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); + }); + + testDeprecated('updateType.NONE replaced by updatePolicy equivalent', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updateType: autoscaling.UpdateType.NONE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingScheduledAction: { + IgnoreUnmodifiedGroupSizeProperties: true, + }, + }, + }); + }); + + testDeprecated('updateType.REPLACING_UPDATE replaced by updatePolicy equivalent', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updateType: autoscaling.UpdateType.REPLACING_UPDATE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingReplacingUpdate: { + WillReplace: true, + }, + }, + }); + }); + + testDeprecated('updateType.ROLLING_UPDATE replaced by updatePolicy equivalent', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updateType: autoscaling.UpdateType.ROLLING_UPDATE, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { + AutoScalingRollingUpdate: { + WaitOnResourceSignals: false, + PauseTime: 'PT0S', + SuspendProcesses: [ + 'HealthCheck', + 'ReplaceUnhealthy', + 'AZRebalance', + 'AlarmNotification', + 'ScheduledActions', + ], + }, + AutoScalingScheduledAction: { + IgnoreUnmodifiedGroupSizeProperties: true, + }, + }, + }); + }); + + testDeprecated('throws when updatePolicy and updateType both specified', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + expect(() => { + cluster.addCapacity('bottlerocket-asg', { + instanceType: new ec2.InstanceType('c5.large'), + machineImage: new ecs.BottleRocketImage(), + updatePolicy: autoscaling.UpdatePolicy.replacingUpdate(), + updateType: autoscaling.UpdateType.REPLACING_UPDATE, + }); + }).toThrow("Cannot set 'signals'/'updatePolicy' and 'updateType' together. Prefer 'signals'/'updatePolicy'"); + }); + + testDeprecated('allows specifying capacityProviders (deprecated)', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // WHEN + new ecs.Cluster(stack, 'EcsCluster', { capacityProviders: ['FARGATE_SPOT'] }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + CapacityProviders: Match.absent(), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + CapacityProviders: ['FARGATE_SPOT'], + }); + + + }); + + test('allows specifying Fargate capacityProviders', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // WHEN + new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + CapacityProviders: Match.absent(), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + CapacityProviders: ['FARGATE', 'FARGATE_SPOT'], + }); + + + }); + + test('allows specifying capacityProviders (alternate method)', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // WHEN + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + cluster.enableFargateCapacityProviders(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + CapacityProviders: Match.absent(), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + CapacityProviders: ['FARGATE', 'FARGATE_SPOT'], + }); + + + }); + + testDeprecated('allows adding capacityProviders post-construction (deprecated)', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + cluster.addCapacityProvider('FARGATE'); + cluster.addCapacityProvider('FARGATE'); // does not add twice + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + CapacityProviders: Match.absent(), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + CapacityProviders: ['FARGATE'], + }); + + + }); + + testDeprecated('allows adding capacityProviders post-construction', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + cluster.addCapacityProvider('FARGATE'); + cluster.addCapacityProvider('FARGATE'); // does not add twice + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + CapacityProviders: Match.absent(), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + CapacityProviders: ['FARGATE'], + }); + + + }); + + testDeprecated('throws for unsupported capacity providers', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // THEN + expect(() => { + cluster.addCapacityProvider('HONK'); + }).toThrow(/CapacityProvider not supported/); + + + }); + + test('creates ASG capacity providers with expected defaults', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::CapacityProvider', { + AutoScalingGroupProvider: { + AutoScalingGroupArn: { + Ref: 'asgASG4D014670', + }, + ManagedScaling: { + Status: 'ENABLED', + TargetCapacity: 100, + }, + ManagedTerminationProtection: 'ENABLED', + }, + }); + + }); + + test('can disable Managed Scaling and Managed Termination Protection for ASG capacity provider', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedScaling: false, + enableManagedTerminationProtection: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::CapacityProvider', { + AutoScalingGroupProvider: { + AutoScalingGroupArn: { + Ref: 'asgASG4D014670', + }, + ManagedScaling: Match.absent(), + ManagedTerminationProtection: 'DISABLED', + }, + }); + }); + + test('can disable Managed Termination Protection for ASG capacity provider', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedTerminationProtection: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::CapacityProvider', { + AutoScalingGroupProvider: { + AutoScalingGroupArn: { + Ref: 'asgASG4D014670', + }, + ManagedScaling: { + Status: 'ENABLED', + TargetCapacity: 100, + }, + ManagedTerminationProtection: 'DISABLED', + }, + }); + }); + + test('throws error, when ASG capacity provider has Managed Scaling disabled and Managed Termination Protection is undefined (defaults to true)', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // THEN + expect(() => { + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedScaling: false, + }); + }).toThrowError('Cannot enable Managed Termination Protection on a Capacity Provider when Managed Scaling is disabled. Either enable Managed Scaling or disable Managed Termination Protection.'); + }); + + test('throws error, when Managed Scaling is disabled and Managed Termination Protection is enabled.', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // THEN + expect(() => { + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedScaling: false, + enableManagedTerminationProtection: true, + }); + }).toThrowError('Cannot enable Managed Termination Protection on a Capacity Provider when Managed Scaling is disabled. Either enable Managed Scaling or disable Managed Termination Protection.'); + }); + + test('capacity provider enables ASG new instance scale-in protection by default', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + NewInstancesProtectedFromScaleIn: true, + }); + + }); + + test('capacity provider disables ASG new instance scale-in protection', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedTerminationProtection: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + NewInstancesProtectedFromScaleIn: Match.absent(), + }); + }); + + test('can add ASG capacity via Capacity Provider', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedTerminationProtection: false, + }); + + cluster.enableFargateCapacityProviders(); + + // Ensure not added twice + cluster.addAsgCapacityProvider(capacityProvider); + cluster.addAsgCapacityProvider(capacityProvider); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + Cluster: { + Ref: 'EcsCluster97242B84', + }, + CapacityProviders: [ + 'FARGATE', + 'FARGATE_SPOT', + { + Ref: 'providerD3FF4D3A', + }, + ], + DefaultCapacityProviderStrategy: [], + }); + + }); + + test('should throw an error if capacity provider with default strategy is not present in capacity providers', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, + }).addDefaultCapacityProviderStrategy([ + { capacityProvider: 'test capacityProvider', base: 10, weight: 50 }, + ]); + }).toThrow('Capacity provider test capacityProvider must be added to the cluster with addAsgCapacityProvider() before it can be used in a default capacity provider strategy.'); + }); + + test('should throw an error when capacity providers is length 0 and default capacity provider startegy specified', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: false, + }).addDefaultCapacityProviderStrategy([ + { capacityProvider: 'test capacityProvider', base: 10, weight: 50 }, + ]); + }).toThrow('Capacity provider test capacityProvider must be added to the cluster with addAsgCapacityProvider() before it can be used in a default capacity provider strategy.'); + }); + + test('should throw an error when more than 1 default capacity provider have base specified', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, + }).addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 10, weight: 50 }, + { capacityProvider: 'FARGATE_SPOT', base: 10, weight: 50 }, + ]); + }).toThrow(/Only 1 capacity provider in a capacity provider strategy can have a nonzero base./); + }); + + test('should throw an error when a capacity provider strategy contains a mix of Auto Scaling groups and Fargate providers', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, + }); + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedTerminationProtection: false, + }); + cluster.addAsgCapacityProvider(capacityProvider); + + // THEN + expect(() => { + cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 10, weight: 50 }, + { capacityProvider: 'FARGATE_SPOT' }, + { capacityProvider: capacityProvider.capacityProviderName }, + ]); + }).toThrow(/A capacity provider strategy cannot contain a mix of capacity providers using Auto Scaling groups and Fargate providers. Specify one or the other and try again./); + }); + + test('should throw an error if addDefaultCapacityProviderStrategy is called more than once', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + const cluster = new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, + }); + cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 10, weight: 50 }, + { capacityProvider: 'FARGATE_SPOT' }, + ]); + cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 10, weight: 50 }, + { capacityProvider: 'FARGATE_SPOT' }, + ]); + }).toThrow(/Cluster default capacity provider strategy is already set./); + }); + + test('can add ASG capacity via Capacity Provider with default capacity provider', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { + enableFargateCapacityProviders: true, + }); + + cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: 'FARGATE', base: 10, weight: 50 }, + { capacityProvider: 'FARGATE_SPOT' }, + ]); + + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedTerminationProtection: false, + }); + + cluster.addAsgCapacityProvider(capacityProvider); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + Cluster: { + Ref: 'EcsCluster97242B84', + }, + CapacityProviders: [ + 'FARGATE', + 'FARGATE_SPOT', + { + Ref: 'providerD3FF4D3A', + }, + ], + DefaultCapacityProviderStrategy: [ + { CapacityProvider: 'FARGATE', Base: 10, Weight: 50 }, + { CapacityProvider: 'FARGATE_SPOT' }, + ], + }); + }); + + test('can add ASG default capacity provider', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'asg', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'provider', { + autoScalingGroup, + enableManagedTerminationProtection: false, + }); + + cluster.addAsgCapacityProvider(capacityProvider); + + cluster.addDefaultCapacityProviderStrategy([ + { capacityProvider: capacityProvider.capacityProviderName }, + ]); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + Cluster: { + Ref: 'EcsCluster97242B84', + }, + CapacityProviders: [ + { + Ref: 'providerD3FF4D3A', + }, + ], + DefaultCapacityProviderStrategy: [ + { + CapacityProvider: { + Ref: 'providerD3FF4D3A', + }, + }, + ], + }); + }); + + test('correctly sets log configuration for execute command', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const kmsKey = new kms.Key(stack, 'KmsKey'); + + const logGroup = new logs.LogGroup(stack, 'LogGroup', { + encryptionKey: kmsKey, + }); + + const execBucket = new s3.Bucket(stack, 'EcsExecBucket', { + encryptionKey: kmsKey, + }); + + // WHEN + new ecs.Cluster(stack, 'EcsCluster', { + executeCommandConfiguration: { + kmsKey: kmsKey, + logConfiguration: { + cloudWatchLogGroup: logGroup, + cloudWatchEncryptionEnabled: true, + s3Bucket: execBucket, + s3EncryptionEnabled: true, + s3KeyPrefix: 'exec-output', + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ECS::Cluster', { + Configuration: { + ExecuteCommandConfiguration: { + KmsKeyId: { + 'Fn::GetAtt': [ + 'KmsKey46693ADD', + 'Arn', + ], + }, + LogConfiguration: { + CloudWatchEncryptionEnabled: true, + CloudWatchLogGroupName: { + Ref: 'LogGroupF5B46931', + }, + S3BucketName: { + Ref: 'EcsExecBucket4F468651', + }, + S3EncryptionEnabled: true, + S3KeyPrefix: 'exec-output', + }, + Logging: 'OVERRIDE', + }, + }, + }); + + + }); + + test('throws when no log configuration is provided when logging is set to OVERRIDE', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + executeCommandConfiguration: { + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, + }); + }).toThrow(/Execute command log configuration must only be specified when logging is OVERRIDE./); + + + }); + + test('throws when log configuration provided but logging is set to DEFAULT', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + const logGroup = new logs.LogGroup(stack, 'LogGroup'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + executeCommandConfiguration: { + logConfiguration: { + cloudWatchLogGroup: logGroup, + }, + logging: ecs.ExecuteCommandLogging.DEFAULT, + }, + }); + }).toThrow(/Execute command log configuration must only be specified when logging is OVERRIDE./); + + + }); + + test('throws when CloudWatchEncryptionEnabled without providing CloudWatch Logs log group name', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + executeCommandConfiguration: { + logConfiguration: { + cloudWatchEncryptionEnabled: true, + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, + }); + }).toThrow(/You must specify a CloudWatch log group in the execute command log configuration to enable CloudWatch encryption./); + + + }); + + test('throws when S3EncryptionEnabled without providing S3 Bucket name', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + + // THEN + expect(() => { + new ecs.Cluster(stack, 'EcsCluster', { + executeCommandConfiguration: { + logConfiguration: { + s3EncryptionEnabled: true, + }, + logging: ecs.ExecuteCommandLogging.OVERRIDE, + }, + }); + }).toThrow(/You must specify an S3 bucket name in the execute command log configuration to enable S3 encryption./); + + + }); + + test('When importing ECS Cluster via Arn', () => { + // GIVEN + const stack = new cdk.Stack(); + const clusterName = 'my-cluster'; + const region = 'service-region'; + const account = 'service-account'; + const cluster = ecs.Cluster.fromClusterArn(stack, 'Cluster', `arn:aws:ecs:${region}:${account}:cluster/${clusterName}`); + + // THEN + expect(cluster.clusterName).toEqual(clusterName); + expect(cluster.env.region).toEqual(region); + expect(cluster.env.account).toEqual(account); + }); + + test('throws error when import ECS Cluster without resource name in arn', () => { + // GIVEN + const stack = new cdk.Stack(); + + // THEN + expect(() => { + ecs.Cluster.fromClusterArn(stack, 'Cluster', 'arn:aws:ecs:service-region:service-account:cluster'); + }).toThrowError(/Missing required Cluster Name from Cluster ARN: /); + }); +}); + +test('can add ASG capacity via Capacity Provider by not specifying machineImageType', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + const autoScalingGroupAl2 = new autoscaling.AutoScalingGroup(stack, 'asgal2', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + const autoScalingGroupBottlerocket = new autoscaling.AutoScalingGroup(stack, 'asgBottlerocket', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: new ecs.BottleRocketImage(), + }); + + // WHEN + const capacityProviderAl2 = new ecs.AsgCapacityProvider(stack, 'provideral2', { + autoScalingGroup: autoScalingGroupAl2, + enableManagedTerminationProtection: false, + }); + + const capacityProviderBottlerocket = new ecs.AsgCapacityProvider(stack, 'providerBottlerocket', { + autoScalingGroup: autoScalingGroupBottlerocket, + enableManagedTerminationProtection: false, + machineImageType: ecs.MachineImageType.BOTTLEROCKET, + }); + + cluster.enableFargateCapacityProviders(); + + // Ensure not added twice + cluster.addAsgCapacityProvider(capacityProviderAl2); + cluster.addAsgCapacityProvider(capacityProviderAl2); + + // Add Bottlerocket ASG Capacity Provider + cluster.addAsgCapacityProvider(capacityProviderBottlerocket); + + + // THEN Bottlerocket LaunchConfiguration + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsservicebottlerocketawsecs1x8664latestimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + + }, + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '\n[settings.ecs]\ncluster = \"', + { + Ref: 'EcsCluster97242B84', + }, + '\"', + ], + ], + }, + }, + }); + + // THEN AmazonLinux2 LaunchConfiguration + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + ImageId: { + Ref: 'SsmParameterValueawsserviceecsoptimizedamiamazonlinux2recommendedimageidC96584B6F00A464EAD1953AFF4B05118Parameter', + }, + UserData: { + 'Fn::Base64': { + 'Fn::Join': [ + '', + [ + '#!/bin/bash\necho ECS_CLUSTER=', + { + Ref: 'EcsCluster97242B84', + + }, + ' >> /etc/ecs/ecs.config\nsudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP\nsudo service iptables save\necho ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config', + ], + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ECS::ClusterCapacityProviderAssociations', { + CapacityProviders: [ + 'FARGATE', + 'FARGATE_SPOT', + { + Ref: 'provideral2A427CBC0', + }, + { + Ref: 'providerBottlerocket90C039FA', + }, + ], + Cluster: { + Ref: 'EcsCluster97242B84', + }, + DefaultCapacityProviderStrategy: [], + }); + +}); + +test('throws when ASG Capacity Provider with capacityProviderName starting with aws, ecs or faragte', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + const autoScalingGroupAl2 = new autoscaling.AutoScalingGroup(stack, 'asgal2', { + vpc, + instanceType: new ec2.InstanceType('bogus'), + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + }); + + // THEN + expect(() => { + // WHEN Capacity Provider define capacityProviderName start with aws. + const capacityProviderAl2 = new ecs.AsgCapacityProvider(stack, 'provideral2', { + autoScalingGroup: autoScalingGroupAl2, + enableManagedTerminationProtection: false, + capacityProviderName: 'awscp', + }); + + cluster.addAsgCapacityProvider(capacityProviderAl2); + }).toThrow(/Invalid Capacity Provider Name: awscp, If a name is specified, it cannot start with aws, ecs, or fargate./); + + expect(() => { + // WHEN Capacity Provider define capacityProviderName start with ecs. + const capacityProviderAl2 = new ecs.AsgCapacityProvider(stack, 'provideral2-2', { + autoScalingGroup: autoScalingGroupAl2, + enableManagedTerminationProtection: false, + capacityProviderName: 'ecscp', + }); + + cluster.addAsgCapacityProvider(capacityProviderAl2); + }).toThrow(/Invalid Capacity Provider Name: ecscp, If a name is specified, it cannot start with aws, ecs, or fargate./); +}); + +describe('Accessing container instance role', function () { + + const addUserDataMock = jest.fn(); + const autoScalingGroup: autoscaling.AutoScalingGroup = { + addUserData: addUserDataMock, + addToRolePolicy: jest.fn(), + protectNewInstancesFromScaleIn: jest.fn(), + } as unknown as autoscaling.AutoScalingGroup; + + afterEach(() => { + addUserDataMock.mockClear(); + }); + + test('block ecs from accessing metadata service when canContainersAccessInstanceRole not set', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { + autoScalingGroup: autoScalingGroup, + }); + + cluster.addAsgCapacityProvider(capacityProvider); + + // THEN + expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo service iptables save'); + expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + }); + + test('allow ecs accessing metadata service when canContainersAccessInstanceRole is set on addAsgCapacityProvider', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { + autoScalingGroup: autoScalingGroup, + }); + + cluster.addAsgCapacityProvider(capacityProvider, { + canContainersAccessInstanceRole: true, + }); + + // THEN + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + }); + + test('allow ecs accessing metadata service when canContainersAccessInstanceRole is set on AsgCapacityProvider instantiation', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { + autoScalingGroup: autoScalingGroup, + canContainersAccessInstanceRole: true, + }); + + cluster.addAsgCapacityProvider(capacityProvider); + + // THEN + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + }); + + test('allow ecs accessing metadata service when canContainersAccessInstanceRole is set on constructor and method', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { + autoScalingGroup: autoScalingGroup, + canContainersAccessInstanceRole: true, + }); + + cluster.addAsgCapacityProvider(capacityProvider, { + canContainersAccessInstanceRole: true, + }); + + // THEN + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + }); + + test('block ecs from accessing metadata service when canContainersAccessInstanceRole set on constructor and not set on method', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { + autoScalingGroup: autoScalingGroup, + canContainersAccessInstanceRole: true, + }); + + cluster.addAsgCapacityProvider(capacityProvider, { + canContainersAccessInstanceRole: false, + }); + + // THEN + expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('sudo service iptables save'); + expect(autoScalingGroup.addUserData).toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + }); + + test('allow ecs accessing metadata service when canContainersAccessInstanceRole is not set on constructor and set on method', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'test'); + const cluster = new ecs.Cluster(stack, 'EcsCluster'); + + // WHEN + const capacityProvider = new ecs.AsgCapacityProvider(stack, 'Provider', { + autoScalingGroup: autoScalingGroup, + canContainersAccessInstanceRole: false, + }); + + cluster.addAsgCapacityProvider(capacityProvider, { + canContainersAccessInstanceRole: true, + }); + + // THEN + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo iptables --insert FORWARD 1 --in-interface docker+ --destination 169.254.169.254/32 --jump DROP'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('sudo service iptables save'); + expect(autoScalingGroup.addUserData).not.toHaveBeenCalledWith('echo ECS_AWSVPC_BLOCK_IMDS=true >> /etc/ecs/ecs.config'); + }); +}); diff --git a/packages/@aws-cdk/aws-ecs/test/container-definition.test.ts b/packages/aws-cdk-lib/aws-ecs/test/container-definition.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/test/container-definition.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/container-definition.test.ts index cc47129500df6..b260f3473ebf6 100644 --- a/packages/@aws-cdk/aws-ecs/test/container-definition.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/container-definition.test.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Match, Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as ssm from '../../aws-ssm'; +import * as cdk from '../../core'; +import { Duration } from '../../core'; +import * as cxapi from '../../cx-api'; import * as ecs from '../lib'; import { AppProtocol } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-ecs/test/demo-envfiles/test-envfile.env b/packages/aws-cdk-lib/aws-ecs/test/demo-envfiles/test-envfile.env new file mode 100644 index 0000000000000..1566bb1d76a71 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/test/demo-envfiles/test-envfile.env @@ -0,0 +1 @@ +FOO=bar \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile b/packages/aws-cdk-lib/aws-ecs/test/demo-image/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/integ.fargate-task.js.snapshot/asset.7a4895bc694ae074467753dddb9a798e58f2f5eda62bcce5833d7d356b8a1da2/Dockerfile rename to packages/aws-cdk-lib/aws-ecs/test/demo-image/Dockerfile diff --git a/packages/aws-cdk-lib/aws-ecs/test/demo-image/index.py b/packages/aws-cdk-lib/aws-ecs/test/demo-image/index.py new file mode 100644 index 0000000000000..2ccedfce3ab76 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/test/demo-image/index.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +import sys +import textwrap +import http.server +import socketserver + +PORT = 8000 + + +class Handler(http.server.SimpleHTTPRequestHandler): + def do_GET(self): + self.send_response(200) + self.send_header('Content-Type', 'text/html') + self.end_headers() + self.wfile.write(textwrap.dedent('''\ + + It works + +

Hello from the integ test container

+

This container got built and started as part of the integ test.

+ + + ''').encode('utf-8')) + + +def main(): + httpd = http.server.HTTPServer(("", PORT), Handler) + print("serving at port", PORT) + httpd.serve_forever() + + +if __name__ == '__main__': + main() diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/cross-stack.test.ts b/packages/aws-cdk-lib/aws-ecs/test/ec2/cross-stack.test.ts similarity index 93% rename from packages/@aws-cdk/aws-ecs/test/ec2/cross-stack.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/ec2/cross-stack.test.ts index 4ad3830fa7a9a..5eb00f13856ca 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/cross-stack.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/ec2/cross-stack.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import { App, Stack } from '../../../core'; import * as ecs from '../../lib'; import { addDefaultCapacityProvider } from '../util'; diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/ec2-service.test.ts b/packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/test/ec2/ec2-service.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts index d5533252ea70e..0ff7a112dc22f 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/ec2-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts @@ -1,16 +1,16 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; +import { Annotations, Match, Template } from '../../../assertions'; +import * as autoscaling from '../../../aws-autoscaling'; +import * as ec2 from '../../../aws-ec2'; +import * as elb from '../../../aws-elasticloadbalancing'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as kms from '../../../aws-kms'; +import * as logs from '../../../aws-logs'; +import * as s3 from '../../../aws-s3'; +import * as cloudmap from '../../../aws-servicediscovery'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import { App } from '@aws-cdk/core'; -import { ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME } from '@aws-cdk/cx-api'; +import * as cdk from '../../../core'; +import { App } from '../../../core'; +import { ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME } from '../../../cx-api'; import * as ecs from '../../lib'; import { DeploymentControllerType, LaunchType, PropagatedTagSource } from '../../lib/base/base-service'; import { PlacementConstraint, PlacementStrategy } from '../../lib/placement'; diff --git a/packages/@aws-cdk/aws-ecs/test/ec2/ec2-task-definition.test.ts b/packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-task-definition.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/test/ec2/ec2-task-definition.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-task-definition.test.ts index 311ecfebd20c3..c57aad2859195 100644 --- a/packages/@aws-cdk/aws-ecs/test/ec2/ec2-task-definition.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-task-definition.test.ts @@ -1,12 +1,12 @@ import * as path from 'path'; -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import { Protocol } from '@aws-cdk/aws-ec2'; -import { Repository } from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Annotations, Match, Template } from '../../../assertions'; +import { Protocol } from '../../../aws-ec2'; +import { Repository } from '../../../aws-ecr'; +import * as iam from '../../../aws-iam'; +import * as secretsmanager from '../../../aws-secretsmanager'; +import * as ssm from '../../../aws-ssm'; +import * as cdk from '../../../core'; +import * as cxapi from '../../../cx-api'; import * as ecs from '../../lib'; describe('ec2 task definition', () => { diff --git a/packages/aws-cdk-lib/aws-ecs/test/ec2/firelens.conf b/packages/aws-cdk-lib/aws-ecs/test/ec2/firelens.conf new file mode 100644 index 0000000000000..f7ad6021a9436 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/test/ec2/firelens.conf @@ -0,0 +1,2 @@ +[SERVICE] + Log_Level debug \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/test/environment-file.test.ts b/packages/aws-cdk-lib/aws-ecs/test/environment-file.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/test/environment-file.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/environment-file.test.ts index 263df20a2810a..d0ad2f53b7b7c 100644 --- a/packages/@aws-cdk/aws-ecs/test/environment-file.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/environment-file.test.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as ecs from '../lib'; /* eslint-disable dot-notation */ diff --git a/packages/@aws-cdk/aws-ecs/test/external/external-service.test.ts b/packages/aws-cdk-lib/aws-ecs/test/external/external-service.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/test/external/external-service.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/external/external-service.test.ts index 5ec5def7a7621..3044c9ebf0dc0 100644 --- a/packages/@aws-cdk/aws-ecs/test/external/external-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/external/external-service.test.ts @@ -1,9 +1,9 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as autoscaling from '../../../aws-autoscaling'; +import * as ec2 from '../../../aws-ec2'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as cloudmap from '../../../aws-servicediscovery'; +import * as cdk from '../../../core'; import * as ecs from '../../lib'; import { DeploymentControllerType, LaunchType } from '../../lib/base/base-service'; import { addDefaultCapacityProvider } from '../util'; diff --git a/packages/@aws-cdk/aws-ecs/test/external/external-task-definition.test.ts b/packages/aws-cdk-lib/aws-ecs/test/external/external-task-definition.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/test/external/external-task-definition.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/external/external-task-definition.test.ts index f830363939634..4c6105575927a 100644 --- a/packages/@aws-cdk/aws-ecs/test/external/external-task-definition.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/external/external-task-definition.test.ts @@ -1,11 +1,11 @@ import * as path from 'path'; -import { Annotations, Template } from '@aws-cdk/assertions'; -import { Protocol } from '@aws-cdk/aws-ec2'; -import { Repository } from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; +import { Annotations, Template } from '../../../assertions'; +import { Protocol } from '../../../aws-ec2'; +import { Repository } from '../../../aws-ecr'; +import * as iam from '../../../aws-iam'; +import * as secretsmanager from '../../../aws-secretsmanager'; +import * as ssm from '../../../aws-ssm'; +import * as cdk from '../../../core'; import * as ecs from '../../lib'; describe('external task definition', () => { diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/fargate-service.test.ts b/packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-service.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ecs/test/fargate/fargate-service.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-service.test.ts index a7647f8e3fa4a..222fcd47cb803 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/fargate-service.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-service.test.ts @@ -1,18 +1,18 @@ -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cloudmap from '@aws-cdk/aws-servicediscovery'; +import { Annotations, Match, Template } from '../../../assertions'; +import * as appscaling from '../../../aws-applicationautoscaling'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as elbv2 from '../../../aws-elasticloadbalancingv2'; +import * as kms from '../../../aws-kms'; +import * as logs from '../../../aws-logs'; +import * as s3 from '../../../aws-s3'; +import * as secretsmanager from '../../../aws-secretsmanager'; +import * as cloudmap from '../../../aws-servicediscovery'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import { App } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME } from '@aws-cdk/cx-api'; +import * as cdk from '../../../core'; +import { App } from '../../../core'; +import * as cxapi from '../../../cx-api'; +import { ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME } from '../../../cx-api'; import * as ecs from '../../lib'; import { DeploymentControllerType, LaunchType, PropagatedTagSource, ServiceConnectProps } from '../../lib/base/base-service'; import { addDefaultCapacityProvider } from '../util'; diff --git a/packages/@aws-cdk/aws-ecs/test/fargate/fargate-task-definition.test.ts b/packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-task-definition.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/test/fargate/fargate-task-definition.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-task-definition.test.ts index e2eb71d53ceee..ef80331aa1344 100644 --- a/packages/@aws-cdk/aws-ecs/test/fargate/fargate-task-definition.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-task-definition.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import * as ecs from '../../lib'; describe('fargate task definition', () => { diff --git a/packages/@aws-cdk/aws-ecs/test/firelens-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/firelens-log-driver.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/test/firelens-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/firelens-log-driver.test.ts index 62aa0b8e7bd5b..0d02dc4528cae 100644 --- a/packages/@aws-cdk/aws-ecs/test/firelens-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/firelens-log-driver.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as ssm from '../../aws-ssm'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/fluentd-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/fluentd-log-driver.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ecs/test/fluentd-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/fluentd-log-driver.test.ts index 7bd81fed41221..6196999703d2a 100644 --- a/packages/@aws-cdk/aws-ecs/test/fluentd-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/fluentd-log-driver.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/gelf-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/gelf-log-driver.test.ts similarity index 94% rename from packages/@aws-cdk/aws-ecs/test/gelf-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/gelf-log-driver.test.ts index f6800bb48ac01..06bbfcb8bd268 100644 --- a/packages/@aws-cdk/aws-ecs/test/gelf-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/gelf-log-driver.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/images/tag-parameter-container-image.test.ts b/packages/aws-cdk-lib/aws-ecs/test/images/tag-parameter-container-image.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/test/images/tag-parameter-container-image.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/images/tag-parameter-container-image.test.ts index 5f09864f5f3c7..8910e52849e0d 100644 --- a/packages/@aws-cdk/aws-ecs/test/images/tag-parameter-container-image.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/images/tag-parameter-container-image.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import * as ecr from '../../../aws-ecr'; +import * as cdk from '../../../core'; import * as ecs from '../../lib'; describe('tag parameter container image', () => { diff --git a/packages/@aws-cdk/aws-ecs/test/journald-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/journald-log-driver.test.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs/test/journald-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/journald-log-driver.test.ts index b3f25650b9e58..30db6900c8ba0 100644 --- a/packages/@aws-cdk/aws-ecs/test/journald-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/journald-log-driver.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/json-file-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/json-file-log-driver.test.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs/test/json-file-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/json-file-log-driver.test.ts index ed2622dc79eaa..57dcdfa08f1f7 100644 --- a/packages/@aws-cdk/aws-ecs/test/json-file-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/json-file-log-driver.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/splunk-log-driver.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/splunk-log-driver.test.ts index 02786fa5d61cc..5f7b9e5fc900c 100644 --- a/packages/@aws-cdk/aws-ecs/test/splunk-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/splunk-log-driver.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as ssm from '../../aws-ssm'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/syslog-log-driver.test.ts b/packages/aws-cdk-lib/aws-ecs/test/syslog-log-driver.test.ts similarity index 95% rename from packages/@aws-cdk/aws-ecs/test/syslog-log-driver.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/syslog-log-driver.test.ts index fa77acb52e09b..a76dd2f3d5186 100644 --- a/packages/@aws-cdk/aws-ecs/test/syslog-log-driver.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/syslog-log-driver.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ecs from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-ecs/test/task-definition.test.ts b/packages/aws-cdk-lib/aws-ecs/test/task-definition.test.ts similarity index 98% rename from packages/@aws-cdk/aws-ecs/test/task-definition.test.ts rename to packages/aws-cdk-lib/aws-ecs/test/task-definition.test.ts index 0bcae59c6c3a9..a182a1a4b4bdc 100644 --- a/packages/@aws-cdk/aws-ecs/test/task-definition.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/task-definition.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ecr from '../../aws-ecr'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as ecs from '../lib'; describe('task definition', () => { diff --git a/packages/aws-cdk-lib/aws-ecs/test/util.ts b/packages/aws-cdk-lib/aws-ecs/test/util.ts new file mode 100644 index 0000000000000..40a722f6140e8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ecs/test/util.ts @@ -0,0 +1,21 @@ +import * as autoscaling from '../../aws-autoscaling'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import * as ecs from '../lib'; + +export function addDefaultCapacityProvider(cluster: ecs.Cluster, + stack: cdk.Stack, + vpc: ec2.Vpc, + props?: Omit) { + const autoScalingGroup = new autoscaling.AutoScalingGroup(stack, 'DefaultAutoScalingGroup', { + vpc, + machineImage: ecs.EcsOptimizedImage.amazonLinux2(), + instanceType: new ec2.InstanceType('t2.micro'), + }); + const provider = new ecs.AsgCapacityProvider(stack, 'AsgCapacityProvider', { + ...props, + autoScalingGroup, + }); + cluster.addAsgCapacityProvider(provider); + cluster.connections.addSecurityGroup(...autoScalingGroup.connections.securityGroups); +} diff --git a/packages/aws-cdk-lib/aws-efs/.jsiirc.json b/packages/aws-cdk-lib/aws-efs/.jsiirc.json new file mode 100644 index 0000000000000..899e686f5ecf0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-efs/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.efs" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.EFS" + }, + "python": { + "module": "aws_cdk.aws_efs" + } + } +} diff --git a/packages/aws-cdk-lib/aws-efs/README.md b/packages/aws-cdk-lib/aws-efs/README.md new file mode 100644 index 0000000000000..9cf5af7dec103 --- /dev/null +++ b/packages/aws-cdk-lib/aws-efs/README.md @@ -0,0 +1,198 @@ +# Amazon Elastic File System Construct Library + + +[Amazon Elastic File System](https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html) (Amazon EFS) provides a simple, scalable, +fully managed elastic NFS file system for use with AWS Cloud services and on-premises resources. +Amazon EFS provides file storage in the AWS Cloud. With Amazon EFS, you can create a file system, +mount the file system on an Amazon EC2 instance, and then read and write data to and from your file system. + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## File Systems + +Amazon EFS provides elastic, shared file storage that is POSIX-compliant. The file system you create +supports concurrent read and write access from multiple Amazon EC2 instances and is accessible from +all of the Availability Zones in the AWS Region where it is created. Learn more about [EFS file systems](https://docs.aws.amazon.com/efs/latest/ug/creating-using.html) + +### Create an Amazon EFS file system + +A Virtual Private Cloud (VPC) is required to create an Amazon EFS file system. +The following example creates a file system that is encrypted at rest, running in `General Purpose` +performance mode, and `Bursting` throughput mode and does not transition files to the Infrequent +Access (IA) storage class. + +```ts +const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { + vpc: new ec2.Vpc(this, 'VPC'), + lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS, // files are not transitioned to infrequent access (IA) storage by default + performanceMode: efs.PerformanceMode.GENERAL_PURPOSE, // default + outOfInfrequentAccessPolicy: efs.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS, // files are not transitioned back from (infrequent access) IA to primary storage by default +}); +``` + +⚠️ An Amazon EFS file system's performance mode can't be MAX_IO when its throughputMode is ELASTIC. + +⚠️ An Amazon EFS file system's performance mode can't be changed after the file system has been created. +Updating this property will replace the file system. + +Any file system that has been created outside the stack can be imported into your CDK app. + +Use the `fromFileSystemAttributes()` API to import an existing file system. +Here is an example of giving a role write permissions on a file system. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +const importedFileSystem = efs.FileSystem.fromFileSystemAttributes(this, 'existingFS', { + fileSystemId: 'fs-12345678', // You can also use fileSystemArn instead of fileSystemId. + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(this, 'SG', 'sg-123456789', { + allowAllOutbound: false, + }), +}); +``` + +### IAM to control file system data access + +You can use both IAM identity policies and resource policies to control client access to Amazon EFS resources in a way that is scalable and optimized for cloud environments. Using IAM, you can permit clients to perform specific actions on a file system, including read-only, write, and root access. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +const myFileSystemPolicy = new iam.PolicyDocument({ + statements: [new iam.PolicyStatement({ + actions: [ + 'elasticfilesystem:ClientWrite', + 'elasticfilesystem:ClientMount', + ], + principals: [new iam.AccountRootPrincipal()], + resources: ['*'], + conditions: { + Bool: { + 'elasticfilesystem:AccessedViaMountTarget': 'true', + }, + }, + })], +}); + +const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { + vpc: new ec2.Vpc(this, 'VPC'), + fileSystemPolicy: myFileSystemPolicy, +}); +``` + +Alternatively, a resource policy can be added later using `addToResourcePolicy(statement)`. Note that this will not work with imported FileSystem. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +declare const statement: iam.PolicyStatement; +const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { + vpc: new ec2.Vpc(this, 'VPC'), +}); + +fileSystem.addToResourcePolicy(statement); +``` + +### Permissions + +If you need to grant file system permissions to another resource, you can use the `.grant()` API. +As an example, the following code gives `elasticfilesystem:ClientWrite` permissions to an IAM role. + +```ts fixture=with-filesystem-instance +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.AnyPrincipal(), +}); + +fileSystem.grant(role, 'elasticfilesystem:ClientWrite'); +``` + +### Access Point + +An access point is an application-specific view into an EFS file system that applies an operating +system user and group, and a file system path, to any file system request made through the access +point. The operating system user and group override any identity information provided by the NFS +client. The file system path is exposed as the access point's root directory. Applications using +the access point can only access data in its own directory and below. To learn more, see [Mounting a File System Using EFS Access Points](https://docs.aws.amazon.com/efs/latest/ug/efs-access-points.html). + +Use the `addAccessPoint` API to create an access point from a fileSystem. + +```ts fixture=with-filesystem-instance +fileSystem.addAccessPoint('AccessPoint'); +``` + +By default, when you create an access point, the root(`/`) directory is exposed to the client +connecting to the access point. You can specify a custom path with the `path` property. + +If `path` does not exist, it will be created with the settings defined in the `creationInfo`. +See [Creating Access Points](https://docs.aws.amazon.com/efs/latest/ug/create-access-point.html) for more details. + +Any access point that has been created outside the stack can be imported into your CDK app. + +Use the `fromAccessPointAttributes()` API to import an existing access point. + +```ts +efs.AccessPoint.fromAccessPointAttributes(this, 'ap', { + accessPointId: 'fsap-1293c4d9832fo0912', + fileSystem: efs.FileSystem.fromFileSystemAttributes(this, 'efs', { + fileSystemId: 'fs-099d3e2f', + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(this, 'sg', 'sg-51530134'), + }), +}); +``` + +⚠️ Notice: When importing an Access Point using `fromAccessPointAttributes()`, you must make sure +the mount targets are deployed and their lifecycle state is `available`. Otherwise, you may encounter +the following error when deploying: +> EFS file system <ARN of efs> referenced by access point <ARN of access point of EFS> has +> mount targets created in all availability zones the function will execute in, but not all +> are in the available life cycle state yet. Please wait for them to become available and +> try the request again. + +### Connecting + +To control who can access the EFS, use the `.connections` attribute. EFS has +a fixed default port, so you don't need to specify the port: + +```ts fixture=with-filesystem-instance +fileSystem.connections.allowDefaultPortFrom(instance); +``` + +Learn more about [managing file system network accessibility](https://docs.aws.amazon.com/efs/latest/ug/manage-fs-access.html) + +### Mounting the file system using User Data + +After you create a file system, you can create mount targets. Then you can mount the file system on +EC2 instances, containers, and Lambda functions in your virtual private cloud (VPC). + +The following example automatically mounts a file system during instance launch. + +```ts fixture=with-filesystem-instance +fileSystem.connections.allowDefaultPortFrom(instance); + +instance.userData.addCommands("yum check-update -y", // Ubuntu: apt-get -y update + "yum upgrade -y", // Ubuntu: apt-get -y upgrade + "yum install -y amazon-efs-utils", // Ubuntu: apt-get -y install amazon-efs-utils + "yum install -y nfs-utils", // Ubuntu: apt-get -y install nfs-common + "file_system_id_1=" + fileSystem.fileSystemId, + "efs_mount_point_1=/mnt/efs/fs1", + "mkdir -p \"${efs_mount_point_1}\"", + "test -f \"/sbin/mount.efs\" && echo \"${file_system_id_1}:/ ${efs_mount_point_1} efs defaults,_netdev\" >> /etc/fstab || " + + "echo \"${file_system_id_1}.efs." + Stack.of(this).region + ".amazonaws.com:/ ${efs_mount_point_1} nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,_netdev 0 0\" >> /etc/fstab", + "mount -a -t efs,nfs4 defaults"); +``` + +Learn more about [mounting EFS file systems](https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html) + +### Deleting + +Since file systems are stateful resources, by default the file system will not be deleted when your +stack is deleted. + +You can configure the file system to be destroyed on stack deletion by setting a `removalPolicy` + +```ts +const fileSystem = new efs.FileSystem(this, 'EfsFileSystem', { + vpc: new ec2.Vpc(this, 'VPC'), + removalPolicy: RemovalPolicy.DESTROY, +}); +``` diff --git a/packages/aws-cdk-lib/aws-efs/index.ts b/packages/aws-cdk-lib/aws-efs/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-efs/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-efs/lib/access-point.ts b/packages/aws-cdk-lib/aws-efs/lib/access-point.ts similarity index 98% rename from packages/@aws-cdk/aws-efs/lib/access-point.ts rename to packages/aws-cdk-lib/aws-efs/lib/access-point.ts index 41424f96378e5..8685bc5231f00 100644 --- a/packages/@aws-cdk/aws-efs/lib/access-point.ts +++ b/packages/aws-cdk-lib/aws-efs/lib/access-point.ts @@ -1,4 +1,4 @@ -import { ArnFormat, IResource, Resource, Stack, Tags } from '@aws-cdk/core'; +import { ArnFormat, IResource, Resource, Stack, Tags } from '../../core'; import { Construct } from 'constructs'; import { IFileSystem } from './efs-file-system'; import { CfnAccessPoint } from './efs.generated'; diff --git a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts b/packages/aws-cdk-lib/aws-efs/lib/efs-file-system.ts similarity index 98% rename from packages/@aws-cdk/aws-efs/lib/efs-file-system.ts rename to packages/aws-cdk-lib/aws-efs/lib/efs-file-system.ts index 1265990c6820f..31ee4a61e3be1 100644 --- a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts +++ b/packages/aws-cdk-lib/aws-efs/lib/efs-file-system.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { ArnFormat, FeatureFlags, Lazy, RemovalPolicy, Resource, Size, Stack, Tags } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { ArnFormat, FeatureFlags, Lazy, RemovalPolicy, Resource, Size, Stack, Tags } from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct, DependencyGroup, IDependable } from 'constructs'; import { AccessPoint, AccessPointOptions } from './access-point'; import { CfnFileSystem, CfnMountTarget } from './efs.generated'; diff --git a/packages/@aws-cdk/aws-efs/lib/index.ts b/packages/aws-cdk-lib/aws-efs/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-efs/lib/index.ts rename to packages/aws-cdk-lib/aws-efs/lib/index.ts diff --git a/packages/@aws-cdk/aws-efs/test/access-point.test.ts b/packages/aws-cdk-lib/aws-efs/test/access-point.test.ts similarity index 97% rename from packages/@aws-cdk/aws-efs/test/access-point.test.ts rename to packages/aws-cdk-lib/aws-efs/test/access-point.test.ts index 6571be822a720..2a9b0387594dd 100644 --- a/packages/@aws-cdk/aws-efs/test/access-point.test.ts +++ b/packages/aws-cdk-lib/aws-efs/test/access-point.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Stack, Tags } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import { Stack, Tags } from '../../core'; import { AccessPoint, FileSystem } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts b/packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts similarity index 98% rename from packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts rename to packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts index aff56b624ddef..0598b94989a10 100644 --- a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts +++ b/packages/aws-cdk-lib/aws-efs/test/efs-file-system.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { RemovalPolicy, Size, Stack, Tags } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { RemovalPolicy, Size, Stack, Tags } from '../../core'; import { FileSystem, LifecyclePolicy, PerformanceMode, ThroughputMode, OutOfInfrequentAccessPolicy } from '../lib'; let stack = new Stack(); diff --git a/packages/aws-cdk-lib/aws-eks/.jsiirc.json b/packages/aws-cdk-lib/aws-eks/.jsiirc.json new file mode 100644 index 0000000000000..29a1dd1fbebad --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.eks" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.EKS" + }, + "python": { + "module": "aws_cdk.aws_eks" + } + } +} diff --git a/packages/aws-cdk-lib/aws-eks/README.md b/packages/aws-cdk-lib/aws-eks/README.md new file mode 100644 index 0000000000000..a81bf0aaf7458 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/README.md @@ -0,0 +1,1497 @@ +# Amazon EKS Construct Library + + +This construct library allows you to define [Amazon Elastic Container Service for Kubernetes (EKS)](https://aws.amazon.com/eks/) clusters. +In addition, the library also supports defining Kubernetes resource manifests within EKS clusters. + +## Table Of Contents + +* [Quick Start](#quick-start) +* [API Reference](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-eks-readme.html) +* [Architectural Overview](#architectural-overview) +* [Provisioning clusters](#provisioning-clusters) + * [Managed node groups](#managed-node-groups) + * [Fargate Profiles](#fargate-profiles) + * [Self-managed nodes](#self-managed-nodes) + * [Endpoint Access](#endpoint-access) + * [ALB Controller](#alb-controller) + * [VPC Support](#vpc-support) + * [Kubectl Support](#kubectl-support) + * [ARM64 Support](#arm64-support) + * [Masters Role](#masters-role) + * [Encryption](#encryption) +* [Permissions and Security](#permissions-and-security) +* [Applying Kubernetes Resources](#applying-kubernetes-resources) + * [Kubernetes Manifests](#kubernetes-manifests) + * [Helm Charts](#helm-charts) + * [CDK8s Charts](#cdk8s-charts) +* [Patching Kubernetes Resources](#patching-kubernetes-resources) +* [Querying Kubernetes Resources](#querying-kubernetes-resources) +* [Using existing clusters](#using-existing-clusters) +* [Known Issues and Limitations](#known-issues-and-limitations) + +## Quick Start + +This example defines an Amazon EKS cluster with the following configuration: + +* Dedicated VPC with default configuration (Implicitly created using [ec2.Vpc](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#vpc)) +* A Kubernetes pod with a container based on the [paulbouwer/hello-kubernetes](https://github.com/paulbouwer/hello-kubernetes) image. + +```ts +// provisiong a cluster +const cluster = new eks.Cluster(this, 'hello-eks', { + version: eks.KubernetesVersion.V1_25, + kubectlLayer: new KubectlV25Layer(this, 'kubectl'), +}); + +// apply a kubernetes manifest to the cluster +cluster.addManifest('mypod', { + apiVersion: 'v1', + kind: 'Pod', + metadata: { name: 'mypod' }, + spec: { + containers: [ + { + name: 'hello', + image: 'paulbouwer/hello-kubernetes:1.5', + ports: [ { containerPort: 8080 } ], + }, + ], + }, +}); +``` + +In order to interact with your cluster through `kubectl`, you can use the `aws eks update-kubeconfig` [AWS CLI command](https://docs.aws.amazon.com/cli/latest/reference/eks/update-kubeconfig.html) +to configure your local kubeconfig. The EKS module will define a CloudFormation output in your stack which contains the command to run. For example: + +```plaintext +Outputs: +ClusterConfigCommand43AAE40F = aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy +``` + +Execute the `aws eks update-kubeconfig ...` command in your terminal to create or update a local kubeconfig context: + +```console +$ aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy +Added new context arn:aws:eks:rrrrr:112233445566:cluster/cluster-xxxxx to /home/boom/.kube/config +``` + +And now you can simply use `kubectl`: + +```console +$ kubectl get all -n kube-system +NAME READY STATUS RESTARTS AGE +pod/aws-node-fpmwv 1/1 Running 0 21m +pod/aws-node-m9htf 1/1 Running 0 21m +pod/coredns-5cb4fb54c7-q222j 1/1 Running 0 23m +pod/coredns-5cb4fb54c7-v9nxx 1/1 Running 0 23m +... +``` + +## Architectural Overview + +The following is a qualitative diagram of the various possible components involved in the cluster deployment. + +```text + +-----------------------------------------------+ +-----------------+ + | EKS Cluster | kubectl | | + |-----------------------------------------------|<-------------+| Kubectl Handler | + | | | | + | | +-----------------+ + | +--------------------+ +-----------------+ | + | | | | | | + | | Managed Node Group | | Fargate Profile | | +-----------------+ + | | | | | | | | + | +--------------------+ +-----------------+ | | Cluster Handler | + | | | | + +-----------------------------------------------+ +-----------------+ + ^ ^ + + | | | + | connect self managed capacity | | aws-sdk + | | create/update/delete | + + | v + +--------------------+ + +-------------------+ + | | --------------+| eks.amazonaws.com | + | Auto Scaling Group | +-------------------+ + | | + +--------------------+ +``` + +In a nutshell: + +* `EKS Cluster` - The cluster endpoint created by EKS. +* `Managed Node Group` - EC2 worker nodes managed by EKS. +* `Fargate Profile` - Fargate worker nodes managed by EKS. +* `Auto Scaling Group` - EC2 worker nodes managed by the user. +* `KubectlHandler` - Lambda function for invoking `kubectl` commands on the cluster - created by CDK. +* `ClusterHandler` - Lambda function for interacting with EKS API to manage the cluster lifecycle - created by CDK. + +A more detailed breakdown of each is provided further down this README. + +## Provisioning clusters + +Creating a new cluster is done using the `Cluster` or `FargateCluster` constructs. The only required property is the kubernetes `version`. + +```ts +new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, +}); +``` + +You can also use `FargateCluster` to provision a cluster that uses only fargate workers. + +```ts +new eks.FargateCluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, +}); +``` + +> **NOTE: Only 1 cluster per stack is supported.** If you have a use-case for multiple clusters per stack, or would like to understand more about this limitation, see . + +Below you'll find a few important cluster configuration options. First of which is Capacity. +Capacity is the amount and the type of worker nodes that are available to the cluster for deploying resources. Amazon EKS offers 3 ways of configuring capacity, which you can combine as you like: + +### Managed node groups + +Amazon EKS managed node groups automate the provisioning and lifecycle management of nodes (Amazon EC2 instances) for Amazon EKS Kubernetes clusters. +With Amazon EKS managed node groups, you don’t need to separately provision or register the Amazon EC2 instances that provide compute capacity to run your Kubernetes applications. You can create, update, or terminate nodes for your cluster with a single operation. Nodes run using the latest Amazon EKS optimized AMIs in your AWS account while node updates and terminations gracefully drain nodes to ensure that your applications stay available. + +> For more details visit [Amazon EKS Managed Node Groups](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html). + +**Managed Node Groups are the recommended way to allocate cluster capacity.** + +By default, this library will allocate a managed node group with 2 *m5.large* instances (this instance type suits most common use-cases, and is good value for money). + +At cluster instantiation time, you can customize the number of instances and their type: + +```ts +new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, + defaultCapacity: 5, + defaultCapacityInstance: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.SMALL), +}); +``` + +To access the node group that was created on your behalf, you can use `cluster.defaultNodegroup`. + +Additional customizations are available post instantiation. To apply them, set the default capacity to 0, and use the `cluster.addNodegroupCapacity` method: + +```ts +const cluster = new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, + defaultCapacity: 0, +}); + +cluster.addNodegroupCapacity('custom-node-group', { + instanceTypes: [new ec2.InstanceType('m5.large')], + minSize: 4, + diskSize: 100, + amiType: eks.NodegroupAmiType.AL2_X86_64_GPU, +}); +``` + +To set node taints, you can set `taints` option. + +```ts +declare const cluster: eks.Cluster; +cluster.addNodegroupCapacity('custom-node-group', { + instanceTypes: [new ec2.InstanceType('m5.large')], + taints: [ + { + effect: eks.TaintEffect.NO_SCHEDULE, + key: 'foo', + value: 'bar', + }, + ], +}); +``` + +#### Spot Instances Support + +Use `capacityType` to create managed node groups comprised of spot instances. To maximize the availability of your applications while using +Spot Instances, we recommend that you configure a Spot managed node group to use multiple instance types with the `instanceTypes` property. + +> For more details visit [Managed node group capacity types](https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html#managed-node-group-capacity-types). + + +```ts +declare const cluster: eks.Cluster; +cluster.addNodegroupCapacity('extra-ng-spot', { + instanceTypes: [ + new ec2.InstanceType('c5.large'), + new ec2.InstanceType('c5a.large'), + new ec2.InstanceType('c5d.large'), + ], + minSize: 3, + capacityType: eks.CapacityType.SPOT, +}); + +``` + +#### Launch Template Support + +You can specify a launch template that the node group will use. For example, this can be useful if you want to use +a custom AMI or add custom user data. + +When supplying a custom user data script, it must be encoded in the MIME multi-part archive format, since Amazon EKS merges with its own user data. Visit the [Launch Template Docs](https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html#launch-template-user-data) +for mode details. + +```ts +declare const cluster: eks.Cluster; + +const userData = `MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="==MYBOUNDARY==" + +--==MYBOUNDARY== +Content-Type: text/x-shellscript; charset="us-ascii" + +#!/bin/bash +echo "Running custom user data script" + +--==MYBOUNDARY==--\\ +`; +const lt = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', { + launchTemplateData: { + instanceType: 't3.small', + userData: Fn.base64(userData), + }, +}); + +cluster.addNodegroupCapacity('extra-ng', { + launchTemplateSpec: { + id: lt.ref, + version: lt.attrLatestVersionNumber, + }, +}); + +``` + +Note that when using a custom AMI, Amazon EKS doesn't merge any user data. Which means you do not need the multi-part encoding. and are responsible for supplying the required bootstrap commands for nodes to join the cluster. +In the following example, `/ect/eks/bootstrap.sh` from the AMI will be used to bootstrap the node. + +```ts +declare const cluster: eks.Cluster; +const userData = ec2.UserData.forLinux(); +userData.addCommands( + 'set -o xtrace', + `/etc/eks/bootstrap.sh ${cluster.clusterName}`, +); +const lt = new ec2.CfnLaunchTemplate(this, 'LaunchTemplate', { + launchTemplateData: { + imageId: 'some-ami-id', // custom AMI + instanceType: 't3.small', + userData: Fn.base64(userData.render()), + }, +}); +cluster.addNodegroupCapacity('extra-ng', { + launchTemplateSpec: { + id: lt.ref, + version: lt.attrLatestVersionNumber, + }, +}); +``` + +You may specify one `instanceType` in the launch template or multiple `instanceTypes` in the node group, **but not both**. + +> For more details visit [Launch Template Support](https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html). + +Graviton 2 instance types are supported including `c6g`, `m6g`, `r6g` and `t4g`. +Graviton 3 instance types are supported including `c7g`. + +### Fargate profiles + +AWS Fargate is a technology that provides on-demand, right-sized compute +capacity for containers. With AWS Fargate, you no longer have to provision, +configure, or scale groups of virtual machines to run containers. This removes +the need to choose server types, decide when to scale your node groups, or +optimize cluster packing. + +You can control which pods start on Fargate and how they run with Fargate +Profiles, which are defined as part of your Amazon EKS cluster. + +See [Fargate Considerations](https://docs.aws.amazon.com/eks/latest/userguide/fargate.html#fargate-considerations) in the AWS EKS User Guide. + +You can add Fargate Profiles to any EKS cluster defined in your CDK app +through the `addFargateProfile()` method. The following example adds a profile +that will match all pods from the "default" namespace: + +```ts +declare const cluster: eks.Cluster; +cluster.addFargateProfile('MyProfile', { + selectors: [ { namespace: 'default' } ], +}); +``` + +You can also directly use the `FargateProfile` construct to create profiles under different scopes: + +```ts +declare const cluster: eks.Cluster; +new eks.FargateProfile(this, 'MyProfile', { + cluster, + selectors: [ { namespace: 'default' } ], +}); +``` + +To create an EKS cluster that **only** uses Fargate capacity, you can use `FargateCluster`. +The following code defines an Amazon EKS cluster with a default Fargate Profile that matches all pods from the "kube-system" and "default" namespaces. It is also configured to [run CoreDNS on Fargate](https://docs.aws.amazon.com/eks/latest/userguide/fargate-getting-started.html#fargate-gs-coredns). + +```ts +const cluster = new eks.FargateCluster(this, 'MyCluster', { + version: eks.KubernetesVersion.V1_21, +}); +``` + +`FargateCluster` will create a default `FargateProfile` which can be accessed via the cluster's `defaultProfile` property. The created profile can also be customized by passing options as with `addFargateProfile`. + +**NOTE**: Classic Load Balancers and Network Load Balancers are not supported on +pods running on Fargate. For ingress, we recommend that you use the [ALB Ingress +Controller](https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html) +on Amazon EKS (minimum version v1.1.4). + +### Self-managed nodes + +Another way of allocating capacity to an EKS cluster is by using self-managed nodes. +EC2 instances that are part of the auto-scaling group will serve as worker nodes for the cluster. +This type of capacity is also commonly referred to as *EC2 Capacity** or *EC2 Nodes*. + +For a detailed overview please visit [Self Managed Nodes](https://docs.aws.amazon.com/eks/latest/userguide/worker.html). + +Creating an auto-scaling group and connecting it to the cluster is done using the `cluster.addAutoScalingGroupCapacity` method: + +```ts +declare const cluster: eks.Cluster; +cluster.addAutoScalingGroupCapacity('frontend-nodes', { + instanceType: new ec2.InstanceType('t2.medium'), + minCapacity: 3, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, +}); +``` + +To connect an already initialized auto-scaling group, use the `cluster.connectAutoScalingGroupCapacity()` method: + +```ts +declare const cluster: eks.Cluster; +declare const asg: autoscaling.AutoScalingGroup; +cluster.connectAutoScalingGroupCapacity(asg, {}); +``` + +To connect a self-managed node group to an imported cluster, use the `cluster.connectAutoScalingGroupCapacity()` method: + +```ts +declare const cluster: eks.Cluster; +declare const asg: autoscaling.AutoScalingGroup; +const importedCluster = eks.Cluster.fromClusterAttributes(this, 'ImportedCluster', { + clusterName: cluster.clusterName, + clusterSecurityGroupId: cluster.clusterSecurityGroupId, +}); + +importedCluster.connectAutoScalingGroupCapacity(asg, {}); +``` + +In both cases, the [cluster security group](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html#cluster-sg) will be automatically attached to +the auto-scaling group, allowing for traffic to flow freely between managed and self-managed nodes. + +> **Note:** The default `updateType` for auto-scaling groups does not replace existing nodes. Since security groups are determined at launch time, self-managed nodes that were provisioned with version `1.78.0` or lower, will not be updated. +> To apply the new configuration on all your self-managed nodes, you'll need to replace the nodes using the `UpdateType.REPLACING_UPDATE` policy for the [`updateType`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-autoscaling.AutoScalingGroup.html#updatetypespan-classapi-icon-api-icon-deprecated-titlethis-api-element-is-deprecated-its-use-is-not-recommended%EF%B8%8Fspan) property. + +You can customize the [/etc/eks/boostrap.sh](https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh) script, which is responsible +for bootstrapping the node to the EKS cluster. For example, you can use `kubeletExtraArgs` to add custom node labels or taints. + +```ts +declare const cluster: eks.Cluster; +cluster.addAutoScalingGroupCapacity('spot', { + instanceType: new ec2.InstanceType('t3.large'), + minCapacity: 2, + bootstrapOptions: { + kubeletExtraArgs: '--node-labels foo=bar,goo=far', + awsApiRetryAttempts: 5, + }, +}); +``` + +To disable bootstrapping altogether (i.e. to fully customize user-data), set `bootstrapEnabled` to `false`. +You can also configure the cluster to use an auto-scaling group as the default capacity: + +```ts +const cluster = new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, + defaultCapacityType: eks.DefaultCapacityType.EC2, +}); +``` + +This will allocate an auto-scaling group with 2 *m5.large* instances (this instance type suits most common use-cases, and is good value for money). +To access the `AutoScalingGroup` that was created on your behalf, you can use `cluster.defaultCapacity`. +You can also independently create an `AutoScalingGroup` and connect it to the cluster using the `cluster.connectAutoScalingGroupCapacity` method: + +```ts +declare const cluster: eks.Cluster; +declare const asg: autoscaling.AutoScalingGroup; +cluster.connectAutoScalingGroupCapacity(asg, {}); +``` + +This will add the necessary user-data to access the apiserver and configure all connections, roles, and tags needed for the instances in the auto-scaling group to properly join the cluster. + +#### Spot Instances + +When using self-managed nodes, you can configure the capacity to use spot instances, greatly reducing capacity cost. +To enable spot capacity, use the `spotPrice` property: + +```ts +declare const cluster: eks.Cluster; +cluster.addAutoScalingGroupCapacity('spot', { + spotPrice: '0.1094', + instanceType: new ec2.InstanceType('t3.large'), + maxCapacity: 10, +}); +``` + +> Spot instance nodes will be labeled with `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. + +The [AWS Node Termination Handler](https://github.com/aws/aws-node-termination-handler) `DaemonSet` will be +installed from [Amazon EKS Helm chart repository](https://github.com/aws/eks-charts/tree/master/stable/aws-node-termination-handler) on these nodes. +The termination handler ensures that the Kubernetes control plane responds appropriately to events that +can cause your EC2 instance to become unavailable, such as [EC2 maintenance events](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html) +and [EC2 Spot interruptions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html) and helps gracefully stop all pods running on spot nodes that are about to be +terminated. + +> Handler Version: [1.7.0](https://github.com/aws/aws-node-termination-handler/releases/tag/v1.7.0) +> +> Chart Version: [0.9.5](https://github.com/aws/eks-charts/blob/v0.0.28/stable/aws-node-termination-handler/Chart.yaml) + +To disable the installation of the termination handler, set the `spotInterruptHandler` property to `false`. This applies both to `addAutoScalingGroupCapacity` and `connectAutoScalingGroupCapacity`. + +#### Bottlerocket + +[Bottlerocket](https://aws.amazon.com/bottlerocket/) is a Linux-based open-source operating system that is purpose-built by Amazon Web Services for running containers on virtual machines or bare metal hosts. + +`Bottlerocket` is supported when using managed nodegroups or self-managed auto-scaling groups. + +To create a Bottlerocket managed nodegroup: + +```ts +declare const cluster: eks.Cluster; +cluster.addNodegroupCapacity('BottlerocketNG', { + amiType: eks.NodegroupAmiType.BOTTLEROCKET_X86_64, +}); +``` + +The following example will create an auto-scaling group of 2 `t3.small` Linux instances running with the `Bottlerocket` AMI. + +```ts +declare const cluster: eks.Cluster; +cluster.addAutoScalingGroupCapacity('BottlerocketNodes', { + instanceType: new ec2.InstanceType('t3.small'), + minCapacity: 2, + machineImageType: eks.MachineImageType.BOTTLEROCKET, +}); +``` + +The specific Bottlerocket AMI variant will be auto selected according to the k8s version for the `x86_64` architecture. +For example, if the Amazon EKS cluster version is `1.17`, the Bottlerocket AMI variant will be auto selected as +`aws-k8s-1.17` behind the scene. + +> See [Variants](https://github.com/bottlerocket-os/bottlerocket/blob/develop/README.md#variants) for more details. + +Please note Bottlerocket does not allow to customize bootstrap options and `bootstrapOptions` properties is not supported when you create the `Bottlerocket` capacity. + +For more details about Bottlerocket, see [Bottlerocket FAQs](https://aws.amazon.com/bottlerocket/faqs/) and [Bottlerocket Open Source Blog](https://aws.amazon.com/blogs/opensource/announcing-the-general-availability-of-bottlerocket-an-open-source-linux-distribution-purpose-built-to-run-containers/). + +### Endpoint Access + +When you create a new cluster, Amazon EKS creates an endpoint for the managed Kubernetes API server that you use to communicate with your cluster (using Kubernetes management tools such as `kubectl`) + +By default, this API server endpoint is public to the internet, and access to the API server is secured using a combination of +AWS Identity and Access Management (IAM) and native Kubernetes [Role Based Access Control](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) (RBAC). + +You can configure the [cluster endpoint access](https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html) by using the `endpointAccess` property: + +```ts +const cluster = new eks.Cluster(this, 'hello-eks', { + version: eks.KubernetesVersion.V1_21, + endpointAccess: eks.EndpointAccess.PRIVATE, // No access outside of your VPC. +}); +``` + +The default value is `eks.EndpointAccess.PUBLIC_AND_PRIVATE`. Which means the cluster endpoint is accessible from outside of your VPC, but worker node traffic and `kubectl` commands issued by this library stay within your VPC. + +### Alb Controller + +Some Kubernetes resources are commonly implemented on AWS with the help of the [ALB Controller](https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.3/). + +From the docs: + +> AWS Load Balancer Controller is a controller to help manage Elastic Load Balancers for a Kubernetes cluster. +> +> * It satisfies Kubernetes Ingress resources by provisioning Application Load Balancers. +> * It satisfies Kubernetes Service resources by provisioning Network Load Balancers. + +To deploy the controller on your EKS cluster, configure the `albController` property: + +```ts +new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, + albController: { + version: eks.AlbControllerVersion.V2_4_1, + }, +}); +``` + +Querying the controller pods should look something like this: + +```console +❯ kubectl get pods -n kube-system +NAME READY STATUS RESTARTS AGE +aws-load-balancer-controller-76bd6c7586-d929p 1/1 Running 0 109m +aws-load-balancer-controller-76bd6c7586-fqxph 1/1 Running 0 109m +... +... +``` + +Every Kubernetes manifest that utilizes the ALB Controller is effectively dependant on the controller. +If the controller is deleted before the manifest, it might result in dangling ELB/ALB resources. +Currently, the EKS construct library does not detect such dependencies, and they should be done explicitly. + +For example: + +```ts +declare const cluster: eks.Cluster; +const manifest = cluster.addManifest('manifest', {/* ... */}); +if (cluster.albController) { + manifest.node.addDependency(cluster.albController); +} +``` + +### VPC Support + +You can specify the VPC of the cluster using the `vpc` and `vpcSubnets` properties: + +```ts +declare const vpc: ec2.Vpc; + +new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, + vpc, + vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }], +}); +``` + +> Note: Isolated VPCs (i.e with no internet access) are not currently supported. See https://github.com/aws/aws-cdk/issues/12171 + +If you do not specify a VPC, one will be created on your behalf, which you can then access via `cluster.vpc`. The cluster VPC will be associated to any EKS managed capacity (i.e Managed Node Groups and Fargate Profiles). + +Please note that the `vpcSubnets` property defines the subnets where EKS will place the _control plane_ ENIs. To choose +the subnets where EKS will place the worker nodes, please refer to the **Provisioning clusters** section above. + +If you allocate self managed capacity, you can specify which subnets should the auto-scaling group use: + +```ts +declare const vpc: ec2.Vpc; +declare const cluster: eks.Cluster; +cluster.addAutoScalingGroupCapacity('nodes', { + vpcSubnets: { subnets: vpc.privateSubnets }, + instanceType: new ec2.InstanceType('t2.medium'), +}); +``` + +There are two additional components you might want to provision within the VPC. + +#### Kubectl Handler + +The `KubectlHandler` is a Lambda function responsible to issuing `kubectl` and `helm` commands against the cluster when you add resource manifests to the cluster. + +The handler association to the VPC is derived from the `endpointAccess` configuration. The rule of thumb is: *If the cluster VPC can be associated, it will be*. + +Breaking this down, it means that if the endpoint exposes private access (via `EndpointAccess.PRIVATE` or `EndpointAccess.PUBLIC_AND_PRIVATE`), and the VPC contains **private** subnets, the Lambda function will be provisioned inside the VPC and use the private subnets to interact with the cluster. This is the common use-case. + +If the endpoint does not expose private access (via `EndpointAccess.PUBLIC`) **or** the VPC does not contain private subnets, the function will not be provisioned within the VPC. + +If your use-case requires control over the IAM role that the KubeCtl Handler assumes, a custom role can be passed through the ClusterProps (as `kubectlLambdaRole`) of the EKS Cluster construct. + +#### Cluster Handler + +The `ClusterHandler` is a set of Lambda functions (`onEventHandler`, `isCompleteHandler`) responsible for interacting with the EKS API in order to control the cluster lifecycle. To provision these functions inside the VPC, set the `placeClusterHandlerInVpc` property to `true`. This will place the functions inside the private subnets of the VPC based on the selection strategy specified in the [`vpcSubnets`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-eks.Cluster.html#vpcsubnetsspan-classapi-icon-api-icon-experimental-titlethis-api-element-is-experimental-it-may-change-without-noticespan) property. + +You can configure the environment of the Cluster Handler functions by specifying it at cluster instantiation. For example, this can be useful in order to configure an http proxy: + +```ts +declare const proxyInstanceSecurityGroup: ec2.SecurityGroup; +const cluster = new eks.Cluster(this, 'hello-eks', { + version: eks.KubernetesVersion.V1_21, + clusterHandlerEnvironment: { + https_proxy: 'http://proxy.myproxy.com', + }, + /** + * If the proxy is not open publicly, you can pass a security group to the + * Cluster Handler Lambdas so that it can reach the proxy. + */ + clusterHandlerSecurityGroup: proxyInstanceSecurityGroup, +}); +``` + +### Kubectl Support + +The resources are created in the cluster by running `kubectl apply` from a python lambda function. + +By default, CDK will create a new python lambda function to apply your k8s manifests. If you want to use an existing kubectl provider function, for example with tight trusted entities on your IAM Roles - you can import the existing provider and then use the imported provider when importing the cluster: + +```ts +const handlerRole = iam.Role.fromRoleArn(this, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); +const kubectlProvider = eks.KubectlProvider.fromKubectlProviderAttributes(this, 'KubectlProvider', { + functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', + kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', + handlerRole, +}); + +const cluster = eks.Cluster.fromClusterAttributes(this, 'Cluster', { + clusterName: 'cluster', + kubectlProvider, +}); +``` + +#### Environment + +You can configure the environment of this function by specifying it at cluster instantiation. For example, this can be useful in order to configure an http proxy: + +```ts +const cluster = new eks.Cluster(this, 'hello-eks', { + version: eks.KubernetesVersion.V1_21, + kubectlEnvironment: { + 'http_proxy': 'http://proxy.myproxy.com', + }, +}); +``` + +#### Runtime + +The kubectl handler uses `kubectl`, `helm` and the `aws` CLI in order to +interact with the cluster. These are bundled into AWS Lambda layers included in +the `@aws-cdk/lambda-layer-awscli` and `@aws-cdk/lambda-layer-kubectl` modules. + +The version of kubectl used must be compatible with the Kubernetes version of the +cluster. kubectl is supported within one minor version (older or newer) of Kubernetes +(see [Kubernetes version skew policy](https://kubernetes.io/releases/version-skew-policy/#kubectl)). +Only version 1.20 of kubectl is available in `aws-cdk-lib`. If you need a different +version, you will need to use one of the `@aws-cdk/lambda-layer-kubectl-vXY` packages. + +```ts +import { KubectlV25Layer } from 'aws-cdk-lib/lambda-layer-kubectl-v25'; + +const cluster = new eks.Cluster(this, 'hello-eks', { + version: eks.KubernetesVersion.V1_25, + kubectlLayer: new KubectlV25Layer(this, 'kubectl'), +}); +``` + +You can also specify a custom `lambda.LayerVersion` if you wish to use a +different version of these tools, or a version not available in any of the +`@aws-cdk/lambda-layer-kubectl-vXY` packages. The handler expects the layer to +include the following two executables: + +```text +helm/helm +kubectl/kubectl +``` + +See more information in the +[Dockerfile](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/lambda-layer-awscli/layer) for @aws-cdk/lambda-layer-awscli +and the +[Dockerfile](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/lambda-layer-kubectl/layer) for @aws-cdk/lambda-layer-kubectl. + +```ts +const layer = new lambda.LayerVersion(this, 'KubectlLayer', { + code: lambda.Code.fromAsset('layer.zip'), +}); +``` + +Now specify when the cluster is defined: + +```ts +declare const layer: lambda.LayerVersion; +declare const vpc: ec2.Vpc; + +const cluster1 = new eks.Cluster(this, 'MyCluster', { + kubectlLayer: layer, + vpc, + clusterName: 'cluster-name', + version: eks.KubernetesVersion.V1_21, +}); + +// or +const cluster2 = eks.Cluster.fromClusterAttributes(this, 'MyCluster', { + kubectlLayer: layer, + vpc, + clusterName: 'cluster-name', +}); +``` + +#### Memory + +By default, the kubectl provider is configured with 1024MiB of memory. You can use the `kubectlMemory` option to specify the memory size for the AWS Lambda function: + +```ts +new eks.Cluster(this, 'MyCluster', { + kubectlMemory: Size.gibibytes(4), + version: eks.KubernetesVersion.V1_21, +}); + +// or +declare const vpc: ec2.Vpc; +eks.Cluster.fromClusterAttributes(this, 'MyCluster', { + kubectlMemory: Size.gibibytes(4), + vpc, + clusterName: 'cluster-name', +}); +``` + +### ARM64 Support + +Instance types with `ARM64` architecture are supported in both managed nodegroup and self-managed capacity. Simply specify an ARM64 `instanceType` (such as `m6g.medium`), and the latest +Amazon Linux 2 AMI for ARM64 will be automatically selected. + +```ts +declare const cluster: eks.Cluster; +// add a managed ARM64 nodegroup +cluster.addNodegroupCapacity('extra-ng-arm', { + instanceTypes: [new ec2.InstanceType('m6g.medium')], + minSize: 2, +}); + +// add a self-managed ARM64 nodegroup +cluster.addAutoScalingGroupCapacity('self-ng-arm', { + instanceType: new ec2.InstanceType('m6g.medium'), + minCapacity: 2, +}) +``` + +### Masters Role + +When you create a cluster, you can specify a `mastersRole`. The `Cluster` construct will associate this role with the `system:masters` [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) group, giving it super-user access to the cluster. + +```ts +declare const role: iam.Role; +new eks.Cluster(this, 'HelloEKS', { + version: eks.KubernetesVersion.V1_21, + mastersRole: role, +}); +``` + +If you do not specify it, a default role will be created on your behalf, that can be assumed by anyone in the account with `sts:AssumeRole` permissions for this role. + +This is the role you see as part of the stack outputs mentioned in the [Quick Start](#quick-start). + +```console +$ aws eks update-kubeconfig --name cluster-xxxxx --role-arn arn:aws:iam::112233445566:role/yyyyy +Added new context arn:aws:eks:rrrrr:112233445566:cluster/cluster-xxxxx to /home/boom/.kube/config +``` + +### Encryption + +When you create an Amazon EKS cluster, envelope encryption of Kubernetes secrets using the AWS Key Management Service (AWS KMS) can be enabled. +The documentation on [creating a cluster](https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html) +can provide more details about the customer master key (CMK) that can be used for the encryption. + +You can use the `secretsEncryptionKey` to configure which key the cluster will use to encrypt Kubernetes secrets. By default, an AWS Managed key will be used. + +> This setting can only be specified when the cluster is created and cannot be updated. + +```ts +const secretsKey = new kms.Key(this, 'SecretsKey'); +const cluster = new eks.Cluster(this, 'MyCluster', { + secretsEncryptionKey: secretsKey, + version: eks.KubernetesVersion.V1_21, +}); +``` + +You can also use a similar configuration for running a cluster built using the FargateCluster construct. + +```ts +const secretsKey = new kms.Key(this, 'SecretsKey'); +const cluster = new eks.FargateCluster(this, 'MyFargateCluster', { + secretsEncryptionKey: secretsKey, + version: eks.KubernetesVersion.V1_21, +}); +``` + +The Amazon Resource Name (ARN) for that CMK can be retrieved. + +```ts +declare const cluster: eks.Cluster; +const clusterEncryptionConfigKeyArn = cluster.clusterEncryptionConfigKeyArn; +``` + +## Permissions and Security + +Amazon EKS provides several mechanism of securing the cluster and granting permissions to specific IAM users and roles. + +### AWS IAM Mapping + +As described in the [Amazon EKS User Guide](https://docs.aws.amazon.com/en_us/eks/latest/userguide/add-user-role.html), you can map AWS IAM users and roles to [Kubernetes Role-based access control (RBAC)](https://kubernetes.io/docs/reference/access-authn-authz/rbac). + +The Amazon EKS construct manages the *aws-auth* `ConfigMap` Kubernetes resource on your behalf and exposes an API through the `cluster.awsAuth` for mapping +users, roles and accounts. + +Furthermore, when auto-scaling group capacity is added to the cluster, the IAM instance role of the auto-scaling group will be automatically mapped to RBAC so nodes can connect to the cluster. No manual mapping is required. + +For example, let's say you want to grant an IAM user administrative privileges on your cluster: + +```ts +declare const cluster: eks.Cluster; +const adminUser = new iam.User(this, 'Admin'); +cluster.awsAuth.addUserMapping(adminUser, { groups: [ 'system:masters' ]}); +``` + +A convenience method for mapping a role to the `system:masters` group is also available: + +```ts +declare const cluster: eks.Cluster; +declare const role: iam.Role; +cluster.awsAuth.addMastersRole(role); +``` + +### Cluster Security Group + +When you create an Amazon EKS cluster, a [cluster security group](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html) +is automatically created as well. This security group is designed to allow all traffic from the control plane and managed node groups to flow freely +between each other. + +The ID for that security group can be retrieved after creating the cluster. + +```ts +declare const cluster: eks.Cluster; +const clusterSecurityGroupId = cluster.clusterSecurityGroupId; +``` + +### Node SSH Access + +If you want to be able to SSH into your worker nodes, you must already have an SSH key in the region you're connecting to and pass it when +you add capacity to the cluster. You must also be able to connect to the hosts (meaning they must have a public IP and you +should be allowed to connect to them on port 22): + +See [SSH into nodes](test/example.ssh-into-nodes.lit.ts) for a code example. + +If you want to SSH into nodes in a private subnet, you should set up a bastion host in a public subnet. That setup is recommended, but is +unfortunately beyond the scope of this documentation. + +### Service Accounts + +With services account you can provide Kubernetes Pods access to AWS resources. + +```ts +declare const cluster: eks.Cluster; +// add service account +const serviceAccount = cluster.addServiceAccount('MyServiceAccount'); + +const bucket = new s3.Bucket(this, 'Bucket'); +bucket.grantReadWrite(serviceAccount); + +const mypod = cluster.addManifest('mypod', { + apiVersion: 'v1', + kind: 'Pod', + metadata: { name: 'mypod' }, + spec: { + serviceAccountName: serviceAccount.serviceAccountName, + containers: [ + { + name: 'hello', + image: 'paulbouwer/hello-kubernetes:1.5', + ports: [ { containerPort: 8080 } ], + }, + ], + }, +}); + +// create the resource after the service account. +mypod.node.addDependency(serviceAccount); + +// print the IAM role arn for this service account +new CfnOutput(this, 'ServiceAccountIamRole', { value: serviceAccount.role.roleArn }); +``` + +Note that using `serviceAccount.serviceAccountName` above **does not** translate into a resource dependency. +This is why an explicit dependency is needed. See for more details. + +It is possible to pass annotations and labels to the service account. + +```ts +declare const cluster: eks.Cluster; +// add service account with annotations and labels +const serviceAccount = cluster.addServiceAccount('MyServiceAccount', { + annotations: { + 'eks.amazonaws.com/sts-regional-endpoints': 'false', + }, + labels: { + 'some-label': 'with-some-value', + }, +}); +``` + +You can also add service accounts to existing clusters. +To do so, pass the `openIdConnectProvider` property when you import the cluster into the application. + +```ts +// you can import an existing provider +const provider = eks.OpenIdConnectProvider.fromOpenIdConnectProviderArn(this, 'Provider', 'arn:aws:iam::123456:oidc-provider/oidc.eks.eu-west-1.amazonaws.com/id/AB123456ABC'); + +// or create a new one using an existing issuer url +declare const issuerUrl: string; +const provider2 = new eks.OpenIdConnectProvider(this, 'Provider', { + url: issuerUrl, +}); + +const cluster = eks.Cluster.fromClusterAttributes(this, 'MyCluster', { + clusterName: 'Cluster', + openIdConnectProvider: provider, + kubectlRoleArn: 'arn:aws:iam::123456:role/service-role/k8sservicerole', +}); + +const serviceAccount = cluster.addServiceAccount('MyServiceAccount'); + +const bucket = new s3.Bucket(this, 'Bucket'); +bucket.grantReadWrite(serviceAccount); +``` + +Note that adding service accounts requires running `kubectl` commands against the cluster. +This means you must also pass the `kubectlRoleArn` when importing the cluster. +See [Using existing Clusters](https://github.com/aws/aws-cdk/tree/main/packages/@aws-cdk/aws-eks#using-existing-clusters). + +## Applying Kubernetes Resources + +The library supports several popular resource deployment mechanisms, among which are: + +### Kubernetes Manifests + +The `KubernetesManifest` construct or `cluster.addManifest` method can be used +to apply Kubernetes resource manifests to this cluster. + +> When using `cluster.addManifest`, the manifest construct is defined within the cluster's stack scope. If the manifest contains +> attributes from a different stack which depend on the cluster stack, a circular dependency will be created and you will get a synth time error. +> To avoid this, directly use `new KubernetesManifest` to create the manifest in the scope of the other stack. + +The following examples will deploy the [paulbouwer/hello-kubernetes](https://github.com/paulbouwer/hello-kubernetes) +service on the cluster: + +```ts +declare const cluster: eks.Cluster; +const appLabel = { app: "hello-kubernetes" }; + +const deployment = { + apiVersion: "apps/v1", + kind: "Deployment", + metadata: { name: "hello-kubernetes" }, + spec: { + replicas: 3, + selector: { matchLabels: appLabel }, + template: { + metadata: { labels: appLabel }, + spec: { + containers: [ + { + name: "hello-kubernetes", + image: "paulbouwer/hello-kubernetes:1.5", + ports: [ { containerPort: 8080 } ], + }, + ], + }, + }, + }, +}; + +const service = { + apiVersion: "v1", + kind: "Service", + metadata: { name: "hello-kubernetes" }, + spec: { + type: "LoadBalancer", + ports: [ { port: 80, targetPort: 8080 } ], + selector: appLabel, + } +}; + +// option 1: use a construct +new eks.KubernetesManifest(this, 'hello-kub', { + cluster, + manifest: [ deployment, service ], +}); + +// or, option2: use `addManifest` +cluster.addManifest('hello-kub', service, deployment); +``` + +#### ALB Controller Integration + +The `KubernetesManifest` construct can detect ingress resources inside your manifest and automatically add the necessary annotations +so they are picked up by the ALB Controller. + +> See [Alb Controller](#alb-controller) + +To that end, it offers the following properties: + +* `ingressAlb` - Signal that the ingress detection should be done. +* `ingressAlbScheme` - Which ALB scheme should be applied. Defaults to `internal`. + +#### Adding resources from a URL + +The following example will deploy the resource manifest hosting on remote server: + +```text +// This example is only available in TypeScript + +import * as yaml from 'js-yaml'; +import * as request from 'sync-request'; + +declare const cluster: eks.Cluster; +const manifestUrl = 'https://url/of/manifest.yaml'; +const manifest = yaml.safeLoadAll(request('GET', manifestUrl).getBody()); +cluster.addManifest('my-resource', manifest); +``` + +#### Dependencies + +There are cases where Kubernetes resources must be deployed in a specific order. +For example, you cannot define a resource in a Kubernetes namespace before the +namespace was created. + +You can represent dependencies between `KubernetesManifest`s using +`resource.node.addDependency()`: + +```ts +declare const cluster: eks.Cluster; +const namespace = cluster.addManifest('my-namespace', { + apiVersion: 'v1', + kind: 'Namespace', + metadata: { name: 'my-app' }, +}); + +const service = cluster.addManifest('my-service', { + metadata: { + name: 'myservice', + namespace: 'my-app', + }, + spec: { }, // ... +}); + +service.node.addDependency(namespace); // will apply `my-namespace` before `my-service`. +``` + +**NOTE:** when a `KubernetesManifest` includes multiple resources (either directly +or through `cluster.addManifest()`) (e.g. `cluster.addManifest('foo', r1, r2, +r3,...)`), these resources will be applied as a single manifest via `kubectl` +and will be applied sequentially (the standard behavior in `kubectl`). + +--- + +Since Kubernetes manifests are implemented as CloudFormation resources in the +CDK. This means that if the manifest is deleted from your code (or the stack is +deleted), the next `cdk deploy` will issue a `kubectl delete` command and the +Kubernetes resources in that manifest will be deleted. + +#### Resource Pruning + +When a resource is deleted from a Kubernetes manifest, the EKS module will +automatically delete these resources by injecting a _prune label_ to all +manifest resources. This label is then passed to [`kubectl apply --prune`]. + +[`kubectl apply --prune`]: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/#alternative-kubectl-apply-f-directory-prune-l-your-label + +Pruning is enabled by default but can be disabled through the `prune` option +when a cluster is defined: + +```ts +new eks.Cluster(this, 'MyCluster', { + version: eks.KubernetesVersion.V1_21, + prune: false, +}); +``` + +#### Manifests Validation + +The `kubectl` CLI supports applying a manifest by skipping the validation. +This can be accomplished by setting the `skipValidation` flag to `true` in the `KubernetesManifest` props. + +```ts +declare const cluster: eks.Cluster; +new eks.KubernetesManifest(this, 'HelloAppWithoutValidation', { + cluster, + manifest: [{ foo: 'bar' }], + skipValidation: true, +}); +``` + +### Helm Charts + +The `HelmChart` construct or `cluster.addHelmChart` method can be used +to add Kubernetes resources to this cluster using Helm. + +> When using `cluster.addHelmChart`, the manifest construct is defined within the cluster's stack scope. If the manifest contains +> attributes from a different stack which depend on the cluster stack, a circular dependency will be created and you will get a synth time error. +> To avoid this, directly use `new HelmChart` to create the chart in the scope of the other stack. + +The following example will install the [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx/) to your cluster using Helm. + +```ts +declare const cluster: eks.Cluster; +// option 1: use a construct +new eks.HelmChart(this, 'NginxIngress', { + cluster, + chart: 'nginx-ingress', + repository: 'https://helm.nginx.com/stable', + namespace: 'kube-system', +}); + +// or, option2: use `addHelmChart` +cluster.addHelmChart('NginxIngress', { + chart: 'nginx-ingress', + repository: 'https://helm.nginx.com/stable', + namespace: 'kube-system', +}); +``` + +Helm charts will be installed and updated using `helm upgrade --install`, where a few parameters +are being passed down (such as `repo`, `values`, `version`, `namespace`, `wait`, `timeout`, etc). +This means that if the chart is added to CDK with the same release name, it will try to update +the chart in the cluster. + +Additionally, the `chartAsset` property can be an `aws-s3-assets.Asset`. This allows the use of local, private helm charts. + +```ts +import * as s3Assets from 'aws-cdk-lib/aws-s3-assets'; + +declare const cluster: eks.Cluster; +const chartAsset = new s3Assets.Asset(this, 'ChartAsset', { + path: '/path/to/asset' +}); + +cluster.addHelmChart('test-chart', { + chartAsset: chartAsset, +}); +``` + +Nested values passed to the `values` parameter should be provided as a nested dictionary: + +```ts +cluster.addHelmChart('ExternalSecretsOperator', { + chart: 'external-secrets', + release: 'external-secrets', + repository: 'https://charts.external-secrets.io', + namespace: 'external-secrets', + values: { + installCRDs: true, + webhook: { + port: 9443 + } + }, +}); +``` + +Helm chart can come with Custom Resource Definitions (CRDs) defined that by default will be installed by helm as well. However in special cases it might be needed to skip the installation of CRDs, for that the property `skipCrds` can be used. + +```ts +declare const cluster: eks.Cluster; +// option 1: use a construct +new eks.HelmChart(this, 'NginxIngress', { + cluster, + chart: 'nginx-ingress', + repository: 'https://helm.nginx.com/stable', + namespace: 'kube-system', + skipCrds: true, +}); +``` + +### OCI Charts + +OCI charts are also supported. +Also replace the `${VARS}` with appropriate values. + +```ts +declare const cluster: eks.Cluster; +// option 1: use a construct +new eks.HelmChart(this, 'MyOCIChart', { + cluster, + chart: 'some-chart', + repository: 'oci://${ACCOUNT_ID}.dkr.ecr.${ACCOUNT_REGION}.amazonaws.com/${REPO_NAME}', + namespace: 'oci', + version: '0.0.1' +}); + +``` + +Helm charts are implemented as CloudFormation resources in CDK. +This means that if the chart is deleted from your code (or the stack is +deleted), the next `cdk deploy` will issue a `helm uninstall` command and the +Helm chart will be deleted. + +When there is no `release` defined, a unique ID will be allocated for the release based +on the construct path. + +By default, all Helm charts will be installed concurrently. In some cases, this +could cause race conditions where two Helm charts attempt to deploy the same +resource or if Helm charts depend on each other. You can use +`chart.node.addDependency()` in order to declare a dependency order between +charts: + +```ts +declare const cluster: eks.Cluster; +const chart1 = cluster.addHelmChart('MyChart', { + chart: 'foo', +}); +const chart2 = cluster.addHelmChart('MyChart', { + chart: 'bar', +}); + +chart2.node.addDependency(chart1); +``` + +### CDK8s Charts + +[CDK8s](https://cdk8s.io/) is an open-source library that enables Kubernetes manifest authoring using familiar programming languages. It is founded on the same technologies as the AWS CDK, such as [`constructs`](https://github.com/aws/constructs) and [`jsii`](https://github.com/aws/jsii). + +> To learn more about cdk8s, visit the [Getting Started](https://cdk8s.io/docs/latest/getting-started/) tutorials. + +The EKS module natively integrates with cdk8s and allows you to apply cdk8s charts on AWS EKS clusters via the `cluster.addCdk8sChart` method. + +In addition to `cdk8s`, you can also use [`cdk8s+`](https://cdk8s.io/docs/latest/plus/), which provides higher level abstraction for the core kubernetes api objects. +You can think of it like the `L2` constructs for Kubernetes. Any other `cdk8s` based libraries are also supported, for example [`cdk8s-debore`](https://github.com/toricls/cdk8s-debore). + +To get started, add the following dependencies to your `package.json` file: + +```json +"dependencies": { + "cdk8s": "^2.0.0", + "cdk8s-plus-22": "^2.0.0-rc.30", + "constructs": "^10.0.0" +} +``` + +Note that here we are using `cdk8s-plus-22` as we are targeting Kubernetes version 1.22.0. If you operate a different kubernetes version, you should +use the corresponding `cdk8s-plus-XX` library. +See [Select the appropriate cdk8s+ library](https://cdk8s.io/docs/latest/plus/#i-operate-kubernetes-version-1xx-which-cdk8s-library-should-i-be-using) +for more details. + +Similarly to how you would create a stack by extending `aws-cdk-lib.Stack`, we recommend you create a chart of your own that extends `cdk8s.Chart`, +and add your kubernetes resources to it. You can use `aws-cdk` construct attributes and properties inside your `cdk8s` construct freely. + +In this example we create a chart that accepts an `s3.Bucket` and passes its name to a kubernetes pod as an environment variable. + +`+ my-chart.ts` + +```ts nofixture +import { aws_s3 as s3 } from 'aws-cdk-lib'; +import * as constructs from 'constructs'; +import * as cdk8s from 'cdk8s'; +import * as kplus from 'cdk8s-plus-22'; + +export interface MyChartProps { + readonly bucket: s3.Bucket; +} + +export class MyChart extends cdk8s.Chart { + constructor(scope: constructs.Construct, id: string, props: MyChartProps) { + super(scope, id); + + new kplus.Pod(this, 'Pod', { + containers: [ + { + image: 'my-image', + env: { + BUCKET_NAME: kplus.EnvValue.fromValue(props.bucket.bucketName), + }, + } + ], + }); + } +} +``` + +Then, in your AWS CDK app: + +```ts fixture=cdk8schart +declare const cluster: eks.Cluster; + +// some bucket.. +const bucket = new s3.Bucket(this, 'Bucket'); + +// create a cdk8s chart and use `cdk8s.App` as the scope. +const myChart = new MyChart(new cdk8s.App(), 'MyChart', { bucket }); + +// add the cdk8s chart to the cluster +cluster.addCdk8sChart('my-chart', myChart); +``` + +#### Custom CDK8s Constructs + +You can also compose a few stock `cdk8s+` constructs into your own custom construct. However, since mixing scopes between `aws-cdk` and `cdk8s` is currently not supported, the `Construct` class +you'll need to use is the one from the [`constructs`](https://github.com/aws/constructs) module, and not from `@aws-cdk/core` like you normally would. +This is why we used `new cdk8s.App()` as the scope of the chart above. + +```ts nofixture +import * as constructs from 'constructs'; +import * as cdk8s from 'cdk8s'; +import * as kplus from 'cdk8s-plus-21'; + +export interface LoadBalancedWebService { + readonly port: number; + readonly image: string; + readonly replicas: number; +} + +const app = new cdk8s.App(); +const chart = new cdk8s.Chart(app, 'my-chart'); + +export class LoadBalancedWebService extends constructs.Construct { + constructor(scope: constructs.Construct, id: string, props: LoadBalancedWebService) { + super(scope, id); + + const deployment = new kplus.Deployment(chart, 'Deployment', { + replicas: props.replicas, + containers: [ new kplus.Container({ image: props.image }) ], + }); + + deployment.exposeViaService({ + port: props.port, + serviceType: kplus.ServiceType.LOAD_BALANCER, + }); + } +} +``` + +#### Manually importing k8s specs and CRD's + +If you find yourself unable to use `cdk8s+`, or just like to directly use the `k8s` native objects or CRD's, you can do so by manually importing them using the `cdk8s-cli`. + +See [Importing kubernetes objects](https://cdk8s.io/docs/latest/cli/import/) for detailed instructions. + +## Patching Kubernetes Resources + +The `KubernetesPatch` construct can be used to update existing kubernetes +resources. The following example can be used to patch the `hello-kubernetes` +deployment from the example above with 5 replicas. + +```ts +declare const cluster: eks.Cluster; +new eks.KubernetesPatch(this, 'hello-kub-deployment-label', { + cluster, + resourceName: "deployment/hello-kubernetes", + applyPatch: { spec: { replicas: 5 } }, + restorePatch: { spec: { replicas: 3 } }, +}) +``` + +## Querying Kubernetes Resources + +The `KubernetesObjectValue` construct can be used to query for information about kubernetes objects, +and use that as part of your CDK application. + +For example, you can fetch the address of a [`LoadBalancer`](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) type service: + +```ts +declare const cluster: eks.Cluster; +// query the load balancer address +const myServiceAddress = new eks.KubernetesObjectValue(this, 'LoadBalancerAttribute', { + cluster: cluster, + objectType: 'service', + objectName: 'my-service', + jsonPath: '.status.loadBalancer.ingress[0].hostname', // https://kubernetes.io/docs/reference/kubectl/jsonpath/ +}); + +// pass the address to a lambda function +const proxyFunction = new lambda.Function(this, 'ProxyFunction', { + handler: 'index.handler', + code: lambda.Code.fromInline('my-code'), + runtime: lambda.Runtime.NODEJS_14_X, + environment: { + myServiceAddress: myServiceAddress.value, + }, +}) +``` + +Specifically, since the above use-case is quite common, there is an easier way to access that information: + +```ts +declare const cluster: eks.Cluster; +const loadBalancerAddress = cluster.getServiceLoadBalancerAddress('my-service'); +``` + +## Using existing clusters + +The Amazon EKS library allows defining Kubernetes resources such as [Kubernetes +manifests](#kubernetes-resources) and [Helm charts](#helm-charts) on clusters +that are not defined as part of your CDK app. + +First, you'll need to "import" a cluster to your CDK app. To do that, use the +`eks.Cluster.fromClusterAttributes()` static method: + +```ts +const cluster = eks.Cluster.fromClusterAttributes(this, 'MyCluster', { + clusterName: 'my-cluster-name', + kubectlRoleArn: 'arn:aws:iam::1111111:role/iam-role-that-has-masters-access', +}); +``` + +Then, you can use `addManifest` or `addHelmChart` to define resources inside +your Kubernetes cluster. For example: + +```ts +declare const cluster: eks.Cluster; +cluster.addManifest('Test', { + apiVersion: 'v1', + kind: 'ConfigMap', + metadata: { + name: 'myconfigmap', + }, + data: { + Key: 'value', + Another: '123454', + }, +}); +``` + +At the minimum, when importing clusters for `kubectl` management, you will need +to specify: + +* `clusterName` - the name of the cluster. +* `kubectlRoleArn` - the ARN of an IAM role mapped to the `system:masters` RBAC + role. If the cluster you are importing was created using the AWS CDK, the + CloudFormation stack has an output that includes an IAM role that can be used. + Otherwise, you can create an IAM role and map it to `system:masters` manually. + The trust policy of this role should include the the + `arn:aws::iam::${accountId}:root` principal in order to allow the execution + role of the kubectl resource to assume it. + +If the cluster is configured with private-only or private and restricted public +Kubernetes [endpoint access](#endpoint-access), you must also specify: + +* `kubectlSecurityGroupId` - the ID of an EC2 security group that is allowed + connections to the cluster's control security group. For example, the EKS managed [cluster security group](#cluster-security-group). +* `kubectlPrivateSubnetIds` - a list of private VPC subnets IDs that will be used + to access the Kubernetes endpoint. + +## Logging + +EKS supports cluster logging for 5 different types of events: + +* API requests to the cluster. +* Cluster access via the Kubernetes API. +* Authentication requests into the cluster. +* State of cluster controllers. +* Scheduling decisions. + +You can enable logging for each one separately using the `clusterLogging` +property. For example: + +```ts +const cluster = new eks.Cluster(this, 'Cluster', { + // ... + version: eks.KubernetesVersion.V1_21, + clusterLogging: [ + eks.ClusterLoggingTypes.API, + eks.ClusterLoggingTypes.AUTHENTICATOR, + eks.ClusterLoggingTypes.SCHEDULER, + ], +}); +``` + +## Known Issues and Limitations + +* [One cluster per stack](https://github.com/aws/aws-cdk/issues/10073) +* [Service Account dependencies](https://github.com/aws/aws-cdk/issues/9910) +* [Support isolated VPCs](https://github.com/aws/aws-cdk/issues/12171) diff --git a/packages/aws-cdk-lib/aws-eks/index.ts b/packages/aws-cdk-lib/aws-eks/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.0.0.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.0.0.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.0.0.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.0.0.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.0.1.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.0.1.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.0.1.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.0.1.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.0.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.0.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.0.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.0.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.1.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.1.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.1.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.1.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.2.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.2.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.2.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.2.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.3.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.3.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.1.3.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.1.3.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.0.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.0.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.0.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.0.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.1.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.1.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.1.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.1.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.2.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.2.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.2.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.2.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.3.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.3.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.3.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.3.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.4.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.4.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.2.4.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.2.4.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.3.0.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.3.0.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.3.0.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.3.0.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.3.1.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.3.1.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.3.1.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.3.1.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.4.1.json b/packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.4.1.json similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/alb-iam_policy-v2.4.1.json rename to packages/aws-cdk-lib/aws-eks/lib/addons/alb-iam_policy-v2.4.1.json diff --git a/packages/@aws-cdk/aws-eks/lib/addons/neuron-device-plugin.yaml b/packages/aws-cdk-lib/aws-eks/lib/addons/neuron-device-plugin.yaml similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/addons/neuron-device-plugin.yaml rename to packages/aws-cdk-lib/aws-eks/lib/addons/neuron-device-plugin.yaml diff --git a/packages/@aws-cdk/aws-eks/lib/alb-controller.ts b/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/lib/alb-controller.ts rename to packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts index bc0c3032a82b7..4de410208995b 100644 --- a/packages/@aws-cdk/aws-eks/lib/alb-controller.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/alb-controller.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import { Construct, Node } from 'constructs'; import { Cluster } from './cluster'; import { HelmChart } from './helm-chart'; @@ -8,7 +8,7 @@ import { ServiceAccount } from './service-account'; // v2 - keep this import as a separate section to reduce merge conflict when forward merging with the v2 branch. // eslint-disable-next-line -import { Duration, Names, Stack } from '@aws-cdk/core'; +import { Duration, Names, Stack } from '../../core'; /** * Controller version. diff --git a/packages/@aws-cdk/aws-eks/lib/aws-auth-mapping.ts b/packages/aws-cdk-lib/aws-eks/lib/aws-auth-mapping.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/aws-auth-mapping.ts rename to packages/aws-cdk-lib/aws-eks/lib/aws-auth-mapping.ts diff --git a/packages/@aws-cdk/aws-eks/lib/aws-auth.ts b/packages/aws-cdk-lib/aws-eks/lib/aws-auth.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/lib/aws-auth.ts rename to packages/aws-cdk-lib/aws-eks/lib/aws-auth.ts index 0a8a6d9051a6d..cfe6c8f16f8ab 100644 --- a/packages/@aws-cdk/aws-eks/lib/aws-auth.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/aws-auth.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Lazy, Stack } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Lazy, Stack } from '../../core'; import { Construct, IConstruct } from 'constructs'; import { AwsAuthMapping } from './aws-auth-mapping'; import { Cluster } from './cluster'; diff --git a/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/cluster.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/cluster.ts new file mode 100644 index 0000000000000..7516298cbab1c --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/cluster.ts @@ -0,0 +1,349 @@ +/* eslint-disable no-console */ + +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { EksClient, ResourceEvent, ResourceHandler } from './common'; +import { compareLoggingProps } from './compareLogging'; + + +const MAX_CLUSTER_NAME_LEN = 100; + +export class ClusterResourceHandler extends ResourceHandler { + public get clusterName() { + if (!this.physicalResourceId) { + throw new Error('Cannot determine cluster name without physical resource ID'); + } + + return this.physicalResourceId; + } + + private readonly newProps: aws.EKS.CreateClusterRequest; + private readonly oldProps: Partial; + + constructor(eks: EksClient, event: ResourceEvent) { + super(eks, event); + + this.newProps = parseProps(this.event.ResourceProperties); + this.oldProps = event.RequestType === 'Update' ? parseProps(event.OldResourceProperties) : {}; + // compare newProps and oldProps and update the newProps by appending disabled LogSetup if any + const compared: Partial = compareLoggingProps(this.oldProps, this.newProps); + this.newProps.logging = compared.logging; + } + + // ------ + // CREATE + // ------ + + protected async onCreate(): Promise { + console.log('onCreate: creating cluster with options:', JSON.stringify(this.newProps, undefined, 2)); + if (!this.newProps.roleArn) { + throw new Error('"roleArn" is required'); + } + + const clusterName = this.newProps.name || this.generateClusterName(); + + const resp = await this.eks.createCluster({ + ...this.newProps, + name: clusterName, + }); + + if (!resp.cluster) { + throw new Error(`Error when trying to create cluster ${clusterName}: CreateCluster returned without cluster information`); + } + + return { + PhysicalResourceId: resp.cluster.name, + }; + } + + protected async isCreateComplete() { + return this.isActive(); + } + + // ------ + // DELETE + // ------ + + protected async onDelete(): Promise { + console.log(`onDelete: deleting cluster ${this.clusterName}`); + try { + await this.eks.deleteCluster({ name: this.clusterName }); + } catch (e: any) { + if (e.code !== 'ResourceNotFoundException') { + throw e; + } else { + console.log(`cluster ${this.clusterName} not found, idempotently succeeded`); + } + } + return { + PhysicalResourceId: this.clusterName, + }; + } + + protected async isDeleteComplete(): Promise { + console.log(`isDeleteComplete: waiting for cluster ${this.clusterName} to be deleted`); + + try { + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster returned:', JSON.stringify(resp, undefined, 2)); + } catch (e: any) { + if (e.code === 'ResourceNotFoundException') { + console.log('received ResourceNotFoundException, this means the cluster has been deleted (or never existed)'); + return { IsComplete: true }; + } + + console.log('describeCluster error:', e); + throw e; + } + + return { + IsComplete: false, + }; + } + + // ------ + // UPDATE + // ------ + + protected async onUpdate() { + const updates = analyzeUpdate(this.oldProps, this.newProps); + console.log('onUpdate:', JSON.stringify({ updates }, undefined, 2)); + + // updates to encryption config is not supported + if (updates.updateEncryption) { + throw new Error('Cannot update cluster encryption configuration'); + } + + // if there is an update that requires replacement, go ahead and just create + // a new cluster with the new config. The old cluster will automatically be + // deleted by cloudformation upon success. + if (updates.replaceName || updates.replaceRole || updates.replaceVpc) { + + // if we are replacing this cluster and the cluster has an explicit + // physical name, the creation of the new cluster will fail with "there is + // already a cluster with that name". this is a common behavior for + // CloudFormation resources that support specifying a physical name. + if (this.oldProps.name === this.newProps.name && this.oldProps.name) { + throw new Error(`Cannot replace cluster "${this.oldProps.name}" since it has an explicit physical name. Either rename the cluster or remove the "name" configuration`); + } + + return this.onCreate(); + } + + // if a version update is required, issue the version update + if (updates.updateVersion) { + if (!this.newProps.version) { + throw new Error(`Cannot remove cluster version configuration. Current version is ${this.oldProps.version}`); + } + + return this.updateClusterVersion(this.newProps.version); + } + + if (updates.updateLogging && updates.updateAccess) { + throw new Error('Cannot update logging and access at the same time'); + } + + if (updates.updateLogging || updates.updateAccess) { + const config: aws.EKS.UpdateClusterConfigRequest = { + name: this.clusterName, + }; + if (updates.updateLogging) { + config.logging = this.newProps.logging; + }; + if (updates.updateAccess) { + // Updating the cluster with securityGroupIds and subnetIds (as specified in the warning here: + // https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html) + // will fail, therefore we take only the access fields explicitly + config.resourcesVpcConfig = { + endpointPrivateAccess: this.newProps.resourcesVpcConfig.endpointPrivateAccess, + endpointPublicAccess: this.newProps.resourcesVpcConfig.endpointPublicAccess, + publicAccessCidrs: this.newProps.resourcesVpcConfig.publicAccessCidrs, + }; + } + const updateResponse = await this.eks.updateClusterConfig(config); + + return { EksUpdateId: updateResponse.update?.id }; + } + + // no updates + return; + } + + protected async isUpdateComplete() { + console.log('isUpdateComplete'); + + // if this is an EKS update, we will monitor the update event itself + if (this.event.EksUpdateId) { + const complete = await this.isEksUpdateComplete(this.event.EksUpdateId); + if (!complete) { + return { IsComplete: false }; + } + + // fall through: if the update is done, we simply delegate to isActive() + // in order to extract attributes and state from the cluster itself, which + // is supposed to be in an ACTIVE state after the update is complete. + } + + return this.isActive(); + } + + private async updateClusterVersion(newVersion: string) { + console.log(`updating cluster version to ${newVersion}`); + + // update-cluster-version will fail if we try to update to the same version, + // so skip in this case. + const cluster = (await this.eks.describeCluster({ name: this.clusterName })).cluster; + if (cluster?.version === newVersion) { + console.log(`cluster already at version ${cluster.version}, skipping version update`); + return; + } + + const updateResponse = await this.eks.updateClusterVersion({ name: this.clusterName, version: newVersion }); + return { EksUpdateId: updateResponse.update?.id }; + } + + private async isActive(): Promise { + console.log('waiting for cluster to become ACTIVE'); + const resp = await this.eks.describeCluster({ name: this.clusterName }); + console.log('describeCluster result:', JSON.stringify(resp, undefined, 2)); + const cluster = resp.cluster; + + // if cluster is undefined (shouldnt happen) or status is not ACTIVE, we are + // not complete. note that the custom resource provider framework forbids + // returning attributes (Data) if isComplete is false. + if (cluster?.status === 'FAILED') { + // not very informative, unfortunately the response doesn't contain any error + // information :\ + throw new Error('Cluster is in a FAILED status'); + } else if (cluster?.status !== 'ACTIVE') { + return { + IsComplete: false, + }; + } else { + return { + IsComplete: true, + Data: { + Name: cluster.name, + Endpoint: cluster.endpoint, + Arn: cluster.arn, + + // IMPORTANT: CFN expects that attributes will *always* have values, + // so return an empty string in case the value is not defined. + // Otherwise, CFN will throw with `Vendor response doesn't contain + // XXXX key`. + + CertificateAuthorityData: cluster.certificateAuthority?.data ?? '', + ClusterSecurityGroupId: cluster.resourcesVpcConfig?.clusterSecurityGroupId ?? '', + OpenIdConnectIssuerUrl: cluster.identity?.oidc?.issuer ?? '', + OpenIdConnectIssuer: cluster.identity?.oidc?.issuer?.substring(8) ?? '', // Strips off https:// from the issuer url + + // We can safely return the first item from encryption configuration array, because it has a limit of 1 item + // https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html#AmazonEKS-CreateCluster-request-encryptionConfig + EncryptionConfigKeyArn: cluster.encryptionConfig?.shift()?.provider?.keyArn ?? '', + }, + }; + } + } + + private async isEksUpdateComplete(eksUpdateId: string) { + this.log({ isEksUpdateComplete: eksUpdateId }); + + const describeUpdateResponse = await this.eks.describeUpdate({ + name: this.clusterName, + updateId: eksUpdateId, + }); + + this.log({ describeUpdateResponse }); + + if (!describeUpdateResponse.update) { + throw new Error(`unable to describe update with id "${eksUpdateId}"`); + } + + switch (describeUpdateResponse.update.status) { + case 'InProgress': + return false; + case 'Successful': + return true; + case 'Failed': + case 'Cancelled': + throw new Error(`cluster update id "${eksUpdateId}" failed with errors: ${JSON.stringify(describeUpdateResponse.update.errors)}`); + default: + throw new Error(`unknown status "${describeUpdateResponse.update.status}" for update id "${eksUpdateId}"`); + } + } + + private generateClusterName() { + const suffix = this.requestId.replace(/-/g, ''); // 32 chars + const offset = MAX_CLUSTER_NAME_LEN - suffix.length - 1; + const prefix = this.logicalResourceId.slice(0, offset > 0 ? offset : 0); + return `${prefix}-${suffix}`; + } +} + +function parseProps(props: any): aws.EKS.CreateClusterRequest { + + const parsed = props?.Config ?? {}; + + // this is weird but these boolean properties are passed by CFN as a string, and we need them to be booleanic for the SDK. + // Otherwise it fails with 'Unexpected Parameter: params.resourcesVpcConfig.endpointPrivateAccess is expected to be a boolean' + + if (typeof (parsed.resourcesVpcConfig?.endpointPrivateAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPrivateAccess = parsed.resourcesVpcConfig.endpointPrivateAccess === 'true'; + } + + if (typeof (parsed.resourcesVpcConfig?.endpointPublicAccess) === 'string') { + parsed.resourcesVpcConfig.endpointPublicAccess = parsed.resourcesVpcConfig.endpointPublicAccess === 'true'; + } + + if (typeof (parsed.logging?.clusterLogging[0].enabled) === 'string') { + parsed.logging.clusterLogging[0].enabled = parsed.logging.clusterLogging[0].enabled === 'true'; + } + + return parsed; + +} + +interface UpdateMap { + replaceName: boolean; // name + replaceVpc: boolean; // resourcesVpcConfig.subnetIds and securityGroupIds + replaceRole: boolean; // roleArn + + updateVersion: boolean; // version + updateLogging: boolean; // logging + updateEncryption: boolean; // encryption (cannot be updated) + updateAccess: boolean; // resourcesVpcConfig.endpointPrivateAccess and endpointPublicAccess +} + +function analyzeUpdate(oldProps: Partial, newProps: aws.EKS.CreateClusterRequest): UpdateMap { + console.log('old props: ', JSON.stringify(oldProps)); + console.log('new props: ', JSON.stringify(newProps)); + + const newVpcProps = newProps.resourcesVpcConfig || {}; + const oldVpcProps = oldProps.resourcesVpcConfig || {}; + + const oldPublicAccessCidrs = new Set(oldVpcProps.publicAccessCidrs ?? []); + const newPublicAccessCidrs = new Set(newVpcProps.publicAccessCidrs ?? []); + const newEnc = newProps.encryptionConfig || {}; + const oldEnc = oldProps.encryptionConfig || {}; + + return { + replaceName: newProps.name !== oldProps.name, + replaceVpc: + JSON.stringify(newVpcProps.subnetIds?.sort()) !== JSON.stringify(oldVpcProps.subnetIds?.sort()) || + JSON.stringify(newVpcProps.securityGroupIds?.sort()) !== JSON.stringify(oldVpcProps.securityGroupIds?.sort()), + updateAccess: + newVpcProps.endpointPrivateAccess !== oldVpcProps.endpointPrivateAccess || + newVpcProps.endpointPublicAccess !== oldVpcProps.endpointPublicAccess || + !setsEqual(newPublicAccessCidrs, oldPublicAccessCidrs), + replaceRole: newProps.roleArn !== oldProps.roleArn, + updateVersion: newProps.version !== oldProps.version, + updateEncryption: JSON.stringify(newEnc) !== JSON.stringify(oldEnc), + updateLogging: JSON.stringify(newProps.logging) !== JSON.stringify(oldProps.logging), + }; +} + +function setsEqual(first: Set, second: Set) { + return first.size === second.size && [...first].every((e: string) => second.has(e)); +} diff --git a/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/common.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/common.ts new file mode 100644 index 0000000000000..20259e74056c2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/common.ts @@ -0,0 +1,87 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse, OnEventResponse } from '../../../custom-resources/lib/provider-framework/types'; + +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; + +export interface EksUpdateId { + /** + * If this field is included in an event passed to "IsComplete", it means we + * initiated an EKS update that should be monitored using eks:DescribeUpdate + * instead of just looking at the cluster status. + */ + EksUpdateId?: string +} + +export type ResourceEvent = AWSLambda.CloudFormationCustomResourceEvent & EksUpdateId; + +export abstract class ResourceHandler { + protected readonly requestId: string; + protected readonly logicalResourceId: string; + protected readonly requestType: 'Create' | 'Update' | 'Delete'; + protected readonly physicalResourceId?: string; + protected readonly event: ResourceEvent; + + constructor(protected readonly eks: EksClient, event: ResourceEvent) { + this.requestType = event.RequestType; + this.requestId = event.RequestId; + this.logicalResourceId = event.LogicalResourceId; + this.physicalResourceId = (event as any).PhysicalResourceId; + this.event = event; + + const roleToAssume = event.ResourceProperties.AssumeRoleArn; + if (!roleToAssume) { + throw new Error('AssumeRoleArn must be provided'); + } + + eks.configureAssumeRole({ + RoleArn: roleToAssume, + RoleSessionName: `AWSCDK.EKSCluster.${this.requestType}.${this.requestId}`, + }); + } + + public onEvent() { + switch (this.requestType) { + case 'Create': return this.onCreate(); + case 'Update': return this.onUpdate(); + case 'Delete': return this.onDelete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + public isComplete() { + switch (this.requestType) { + case 'Create': return this.isCreateComplete(); + case 'Update': return this.isUpdateComplete(); + case 'Delete': return this.isDeleteComplete(); + } + + throw new Error(`Invalid request type ${this.requestType}`); + } + + protected log(x: any) { + // eslint-disable-next-line no-console + console.log(JSON.stringify(x, undefined, 2)); + } + + protected abstract onCreate(): Promise; + protected abstract onDelete(): Promise; + protected abstract onUpdate(): Promise<(OnEventResponse & EksUpdateId) | void>; + protected abstract isCreateComplete(): Promise; + protected abstract isDeleteComplete(): Promise; + protected abstract isUpdateComplete(): Promise; +} + +export interface EksClient { + configureAssumeRole(request: aws.STS.AssumeRoleRequest): void; + createCluster(request: aws.EKS.CreateClusterRequest): Promise; + deleteCluster(request: aws.EKS.DeleteClusterRequest): Promise; + describeCluster(request: aws.EKS.DescribeClusterRequest): Promise; + updateClusterConfig(request: aws.EKS.UpdateClusterConfigRequest): Promise; + updateClusterVersion(request: aws.EKS.UpdateClusterVersionRequest): Promise; + describeUpdate(req: aws.EKS.DescribeUpdateRequest): Promise; + createFargateProfile(request: aws.EKS.CreateFargateProfileRequest): Promise; + describeFargateProfile(request: aws.EKS.DescribeFargateProfileRequest): Promise; + deleteFargateProfile(request: aws.EKS.DeleteFargateProfileRequest): Promise; +} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/compareLogging.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/compareLogging.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/cluster-resource-handler/compareLogging.ts rename to packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/compareLogging.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/consts.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/consts.ts rename to packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/consts.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/fargate.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.42ee7a787eab7842c3d815365d104cacb9168fb9beb8a1bc019b0a6d7e969bee/fargate.ts rename to packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/fargate.ts diff --git a/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/index.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/index.ts new file mode 100644 index 0000000000000..537277c83a226 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-handler/index.ts @@ -0,0 +1,67 @@ +/* eslint-disable no-console */ +// eslint-disable-next-line import/no-extraneous-dependencies +import { IsCompleteResponse } from '../../../custom-resources/lib/provider-framework/types'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as aws from 'aws-sdk'; +import { ClusterResourceHandler } from './cluster'; +import { EksClient } from './common'; +import * as consts from './consts'; +import { FargateProfileResourceHandler } from './fargate'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies +const ProxyAgent = require('proxy-agent'); + +aws.config.logger = console; +aws.config.update({ + httpOptions: { agent: new ProxyAgent() }, +}); + +let eks: aws.EKS | undefined; + +const defaultEksClient: EksClient = { + createCluster: req => getEksClient().createCluster(req).promise(), + deleteCluster: req => getEksClient().deleteCluster(req).promise(), + describeCluster: req => getEksClient().describeCluster(req).promise(), + describeUpdate: req => getEksClient().describeUpdate(req).promise(), + updateClusterConfig: req => getEksClient().updateClusterConfig(req).promise(), + updateClusterVersion: req => getEksClient().updateClusterVersion(req).promise(), + createFargateProfile: req => getEksClient().createFargateProfile(req).promise(), + deleteFargateProfile: req => getEksClient().deleteFargateProfile(req).promise(), + describeFargateProfile: req => getEksClient().describeFargateProfile(req).promise(), + configureAssumeRole: req => { + console.log(JSON.stringify({ assumeRole: req }, undefined, 2)); + const creds = new aws.ChainableTemporaryCredentials({ + params: req, + stsConfig: { stsRegionalEndpoints: 'regional' }, + }); + + eks = new aws.EKS({ credentials: creds }); + }, +}; + +function getEksClient() { + if (!eks) { + throw new Error('EKS client not initialized (call "configureAssumeRole")'); + } + + return eks; +} + +export async function onEvent(event: AWSLambda.CloudFormationCustomResourceEvent) { + const provider = createResourceHandler(event); + return provider.onEvent(); +} + +export async function isComplete(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + const provider = createResourceHandler(event); + return provider.isComplete(); +} + +function createResourceHandler(event: AWSLambda.CloudFormationCustomResourceEvent) { + switch (event.ResourceType) { + case consts.CLUSTER_RESOURCE_TYPE: return new ClusterResourceHandler(defaultEksClient, event); + case consts.FARGATE_PROFILE_RESOURCE_TYPE: return new FargateProfileResourceHandler(defaultEksClient, event); + default: + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource-provider.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-provider.ts similarity index 92% rename from packages/@aws-cdk/aws-eks/lib/cluster-resource-provider.ts rename to packages/aws-cdk-lib/aws-eks/lib/cluster-resource-provider.ts index cfffc90a83812..60865e7ddfe27 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource-provider.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource-provider.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, NestedStack, Stack } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import { NodeProxyAgentLayer } from '@aws-cdk/lambda-layer-node-proxy-agent'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import { Duration, NestedStack, Stack } from '../../core'; +import * as cr from '../../custom-resources'; +import { NodeProxyAgentLayer } from '../../lambda-layer-node-proxy-agent'; import { Construct } from 'constructs'; const HANDLER_DIR = path.join(__dirname, 'cluster-resource-handler'); diff --git a/packages/@aws-cdk/aws-eks/lib/cluster-resource.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource.ts similarity index 97% rename from packages/@aws-cdk/aws-eks/lib/cluster-resource.ts rename to packages/aws-cdk-lib/aws-eks/lib/cluster-resource.ts index 755b89eec135c..c450526357daf 100644 --- a/packages/@aws-cdk/aws-eks/lib/cluster-resource.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/cluster-resource.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { ArnComponents, CustomResource, Token, Stack, Lazy } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import { ArnComponents, CustomResource, Token, Stack, Lazy } from '../../core'; import { Construct } from 'constructs'; import { CLUSTER_RESOURCE_TYPE } from './cluster-resource-handler/consts'; import { ClusterResourceProvider } from './cluster-resource-provider'; diff --git a/packages/aws-cdk-lib/aws-eks/lib/cluster.ts b/packages/aws-cdk-lib/aws-eks/lib/cluster.ts new file mode 100644 index 0000000000000..bc2a09324a134 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/lib/cluster.ts @@ -0,0 +1,2382 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as autoscaling from '../../aws-autoscaling'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as ssm from '../../aws-ssm'; +import { Annotations, CfnOutput, CfnResource, IResource, Resource, Stack, Tags, Token, Duration, Size } from '../../core'; +import { Construct, Node } from 'constructs'; +import * as semver from 'semver'; +import * as YAML from 'yaml'; +import { AlbController, AlbControllerOptions } from './alb-controller'; +import { AwsAuth } from './aws-auth'; +import { ClusterResource, clusterArnComponents } from './cluster-resource'; +import { FargateProfile, FargateProfileOptions } from './fargate-profile'; +import { HelmChart, HelmChartOptions } from './helm-chart'; +import { INSTANCE_TYPES } from './instance-types'; +import { KubernetesManifest, KubernetesManifestOptions } from './k8s-manifest'; +import { KubernetesObjectValue } from './k8s-object-value'; +import { KubernetesPatch } from './k8s-patch'; +import { IKubectlProvider, KubectlProvider } from './kubectl-provider'; +import { Nodegroup, NodegroupOptions } from './managed-nodegroup'; +import { OpenIdConnectProvider } from './oidc-provider'; +import { BottleRocketImage } from './private/bottlerocket'; +import { ServiceAccount, ServiceAccountOptions } from './service-account'; +import { LifecycleLabel, renderAmazonLinuxUserData, renderBottlerocketUserData } from './user-data'; + +// defaults are based on https://eksctl.io +const DEFAULT_CAPACITY_COUNT = 2; +const DEFAULT_CAPACITY_TYPE = ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE); + +/** + * An EKS cluster + */ +export interface ICluster extends IResource, ec2.IConnectable { + /** + * The VPC in which this Cluster was created + */ + readonly vpc: ec2.IVpc; + + /** + * The physical name of the Cluster + * @attribute + */ + readonly clusterName: string; + + /** + * The unique ARN assigned to the service by AWS + * in the form of arn:aws:eks: + * @attribute + */ + readonly clusterArn: string; + + /** + * The API Server endpoint URL + * @attribute + */ + readonly clusterEndpoint: string; + + /** + * The certificate-authority-data for your cluster. + * @attribute + */ + readonly clusterCertificateAuthorityData: string; + + /** + * The id of the cluster security group that was created by Amazon EKS for the cluster. + * @attribute + */ + readonly clusterSecurityGroupId: string; + + /** + * The cluster security group that was created by Amazon EKS for the cluster. + * @attribute + */ + readonly clusterSecurityGroup: ec2.ISecurityGroup; + + /** + * Amazon Resource Name (ARN) or alias of the customer master key (CMK). + * @attribute + */ + readonly clusterEncryptionConfigKeyArn: string; + + /** + * The Open ID Connect Provider of the cluster used to configure Service Accounts. + */ + readonly openIdConnectProvider: iam.IOpenIdConnectProvider; + + /** + * An IAM role that can perform kubectl operations against this cluster. + * + * The role should be mapped to the `system:masters` Kubernetes RBAC role. + */ + readonly kubectlRole?: iam.IRole; + + /** + * Custom environment variables when running `kubectl` against this cluster. + */ + readonly kubectlEnvironment?: { [key: string]: string }; + + /** + * A security group to use for `kubectl` execution. + * + * If this is undefined, the k8s endpoint is expected to be accessible + * publicly. + */ + readonly kubectlSecurityGroup?: ec2.ISecurityGroup; + + /** + * Subnets to host the `kubectl` compute resources. + * + * If this is undefined, the k8s endpoint is expected to be accessible + * publicly. + */ + readonly kubectlPrivateSubnets?: ec2.ISubnet[]; + + /** + * An IAM role that can perform kubectl operations against this cluster. + * + * The role should be mapped to the `system:masters` Kubernetes RBAC role. + * + * This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster. + */ + readonly kubectlLambdaRole?: iam.IRole; + + /** + * An AWS Lambda layer that includes `kubectl` and `helm` + * + * If not defined, a default layer will be used containing Kubectl 1.20 and Helm 3.8 + */ + readonly kubectlLayer?: lambda.ILayerVersion; + + /** + * An AWS Lambda layer that contains the `aws` CLI. + * + * If not defined, a default layer will be used containing the AWS CLI 1.x. + */ + readonly awscliLayer?: lambda.ILayerVersion; + + /** + * Kubectl Provider for issuing kubectl commands against it + * + * If not defined, a default provider will be used + */ + readonly kubectlProvider?: IKubectlProvider; + + /** + * Amount of memory to allocate to the provider's lambda function. + */ + readonly kubectlMemory?: Size; + + /** + * A security group to associate with the Cluster Handler's Lambdas. + * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. + * + * Requires `placeClusterHandlerInVpc` to be set to true. + * + * @default - No security group. + * @attribute + */ + readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; + + /** + * An AWS Lambda layer that includes the NPM dependency `proxy-agent`. + * + * If not defined, a default layer will be used. + */ + readonly onEventLayer?: lambda.ILayerVersion; + + /** + * Indicates whether Kubernetes resources can be automatically pruned. When + * this is enabled (default), prune labels will be allocated and injected to + * each resource. These labels will then be used when issuing the `kubectl + * apply` operation with the `--prune` switch. + */ + readonly prune: boolean; + + /** + * Creates a new service account with corresponding IAM Role (IRSA). + * + * @param id logical id of service account + * @param options service account options + */ + addServiceAccount(id: string, options?: ServiceAccountOptions): ServiceAccount; + + /** + * Defines a Kubernetes resource in this cluster. + * + * The manifest will be applied/deleted using kubectl as needed. + * + * @param id logical id of this manifest + * @param manifest a list of Kubernetes resource specifications + * @returns a `KubernetesManifest` object. + */ + addManifest(id: string, ...manifest: Record[]): KubernetesManifest; + + /** + * Defines a Helm chart in this cluster. + * + * @param id logical id of this chart. + * @param options options of this chart. + * @returns a `HelmChart` construct + */ + addHelmChart(id: string, options: HelmChartOptions): HelmChart; + + /** + * Defines a CDK8s chart in this cluster. + * + * @param id logical id of this chart. + * @param chart the cdk8s chart. + * @returns a `KubernetesManifest` construct representing the chart. + */ + addCdk8sChart(id: string, chart: Construct, options?: KubernetesManifestOptions): KubernetesManifest; + + /** + * Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster. + * + * The AutoScalingGroup must be running an EKS-optimized AMI containing the + * /etc/eks/bootstrap.sh script. This method will configure Security Groups, + * add the right policies to the instance role, apply the right tags, and add + * the required user data to the instance's launch configuration. + * + * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. + * If kubectl is enabled, the + * [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) + * daemon will be installed on all spot instances to handle + * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). + * + * Prefer to use `addAutoScalingGroupCapacity` if possible. + * + * @see https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html + * @param autoScalingGroup [disable-awslint:ref-via-interface] + * @param options options for adding auto scaling groups, like customizing the bootstrap script + */ + connectAutoScalingGroupCapacity(autoScalingGroup: autoscaling.AutoScalingGroup, options: AutoScalingGroupOptions): void; +} + +/** + * Attributes for EKS clusters. + */ +export interface ClusterAttributes { + /** + * The VPC in which this Cluster was created + * @default - if not specified `cluster.vpc` will throw an error + */ + readonly vpc?: ec2.IVpc; + + /** + * The physical name of the Cluster + */ + readonly clusterName: string; + + /** + * The API Server endpoint URL + * @default - if not specified `cluster.clusterEndpoint` will throw an error. + */ + readonly clusterEndpoint?: string; + + /** + * The certificate-authority-data for your cluster. + * @default - if not specified `cluster.clusterCertificateAuthorityData` will + * throw an error + */ + readonly clusterCertificateAuthorityData?: string; + + /** + * The cluster security group that was created by Amazon EKS for the cluster. + * @default - if not specified `cluster.clusterSecurityGroupId` will throw an + * error + */ + readonly clusterSecurityGroupId?: string; + + /** + * Amazon Resource Name (ARN) or alias of the customer master key (CMK). + * @default - if not specified `cluster.clusterEncryptionConfigKeyArn` will + * throw an error + */ + readonly clusterEncryptionConfigKeyArn?: string; + + /** + * Additional security groups associated with this cluster. + * @default - if not specified, no additional security groups will be + * considered in `cluster.connections`. + */ + readonly securityGroupIds?: string[]; + + /** + * An IAM role with cluster administrator and "system:masters" permissions. + * @default - if not specified, it not be possible to issue `kubectl` commands + * against an imported cluster. + */ + readonly kubectlRoleArn?: string; + + /** + * An IAM role that can perform kubectl operations against this cluster. + * + * The role should be mapped to the `system:masters` Kubernetes RBAC role. + * + * This role is directly passed to the lambda handler that sends Kube Ctl commands + * to the cluster. + * @default - if not specified, the default role created by a lambda function will + * be used. + */ + readonly kubectlLambdaRole?: iam.IRole; + + /** + * Environment variables to use when running `kubectl` against this cluster. + * @default - no additional variables + */ + readonly kubectlEnvironment?: { [name: string]: string }; + + /** + * A security group to use for `kubectl` execution. If not specified, the k8s + * endpoint is expected to be accessible publicly. + * @default - k8s endpoint is expected to be accessible publicly + */ + readonly kubectlSecurityGroupId?: string; + + /** + * Subnets to host the `kubectl` compute resources. If not specified, the k8s + * endpoint is expected to be accessible publicly. + * @default - k8s endpoint is expected to be accessible publicly + */ + readonly kubectlPrivateSubnetIds?: string[]; + + /** + * An Open ID Connect provider for this cluster that can be used to configure service accounts. + * You can either import an existing provider using `iam.OpenIdConnectProvider.fromProviderArn`, + * or create a new provider using `new eks.OpenIdConnectProvider` + * @default - if not specified `cluster.openIdConnectProvider` and `cluster.addServiceAccount` will throw an error. + */ + readonly openIdConnectProvider?: iam.IOpenIdConnectProvider; + + /** + * An AWS Lambda Layer which includes `kubectl` and Helm. + * + * This layer is used by the kubectl handler to apply manifests and install + * helm charts. You must pick an appropriate releases of one of the + * `@aws-cdk/layer-kubectl-vXX` packages, that works with the version of + * Kubernetes you have chosen. If you don't supply this value `kubectl` + * 1.20 will be used, but that version is most likely too old. + * + * The handler expects the layer to include the following executables: + * + * ``` + * /opt/helm/helm + * /opt/kubectl/kubectl + * ``` + * + * @default - a default layer with Kubectl 1.20 and helm 3.8. + */ + readonly kubectlLayer?: lambda.ILayerVersion; + + /** + * An AWS Lambda layer that contains the `aws` CLI. + * + * The handler expects the layer to include the following executables: + * + * ``` + * /opt/awscli/aws + * ``` + * + * @default - a default layer with the AWS CLI 1.x + */ + readonly awscliLayer?: lambda.ILayerVersion; + + /** + * KubectlProvider for issuing kubectl commands. + * + * @default - Default CDK provider + */ + readonly kubectlProvider?: IKubectlProvider; + + /** + * Amount of memory to allocate to the provider's lambda function. + * + * @default Size.gibibytes(1) + */ + readonly kubectlMemory?: Size; + + /** + * A security group id to associate with the Cluster Handler's Lambdas. + * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. + * + * @default - No security group. + */ + readonly clusterHandlerSecurityGroupId?: string; + + /** + * An AWS Lambda Layer which includes the NPM dependency `proxy-agent`. This layer + * is used by the onEvent handler to route AWS SDK requests through a proxy. + * + * The handler expects the layer to include the following node_modules: + * + * proxy-agent + * + * @default - a layer bundled with this module. + */ + readonly onEventLayer?: lambda.ILayerVersion; + + /** + * Indicates whether Kubernetes resources added through `addManifest()` can be + * automatically pruned. When this is enabled (default), prune labels will be + * allocated and injected to each resource. These labels will then be used + * when issuing the `kubectl apply` operation with the `--prune` switch. + * + * @default true + */ + readonly prune?: boolean; +} + +/** + * Options for configuring an EKS cluster. + */ +export interface CommonClusterOptions { + /** + * The VPC in which to create the Cluster. + * + * @default - a VPC with default configuration will be created and can be accessed through `cluster.vpc`. + */ + readonly vpc?: ec2.IVpc; + + /** + * Where to place EKS Control Plane ENIs + * + * If you want to create public load balancers, this must include public subnets. + * + * For example, to only select private subnets, supply the following: + * + * `vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]` + * + * @default - All public and private subnets + */ + readonly vpcSubnets?: ec2.SubnetSelection[]; + + /** + * Role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf. + * + * @default - A role is automatically created for you + */ + readonly role?: iam.IRole; + + /** + * Name for the cluster. + * + * @default - Automatically generated name + */ + readonly clusterName?: string; + + /** + * Security Group to use for Control Plane ENIs + * + * @default - A security group is automatically created + */ + readonly securityGroup?: ec2.ISecurityGroup; + + /** + * The Kubernetes version to run in the cluster + */ + readonly version: KubernetesVersion; + + /** + * Determines whether a CloudFormation output with the name of the cluster + * will be synthesized. + * + * @default false + */ + readonly outputClusterName?: boolean; + + /** + * Determines whether a CloudFormation output with the `aws eks + * update-kubeconfig` command will be synthesized. This command will include + * the cluster name and, if applicable, the ARN of the masters IAM role. + * + * @default true + */ + readonly outputConfigCommand?: boolean; +} + +/** + * Options for EKS clusters. + */ +export interface ClusterOptions extends CommonClusterOptions { + /** + * An IAM role that will be added to the `system:masters` Kubernetes RBAC + * group. + * + * @see https://kubernetes.io/docs/reference/access-authn-authz/rbac/#default-roles-and-role-bindings + * + * @default - a role that assumable by anyone with permissions in the same + * account will automatically be defined + */ + readonly mastersRole?: iam.IRole; + + /** + * Controls the "eks.amazonaws.com/compute-type" annotation in the CoreDNS + * configuration on your cluster to determine which compute type to use + * for CoreDNS. + * + * @default CoreDnsComputeType.EC2 (for `FargateCluster` the default is FARGATE) + */ + readonly coreDnsComputeType?: CoreDnsComputeType; + + /** + * Determines whether a CloudFormation output with the ARN of the "masters" + * IAM role will be synthesized (if `mastersRole` is specified). + * + * @default false + */ + readonly outputMastersRoleArn?: boolean; + + /** + * Configure access to the Kubernetes API server endpoint.. + * + * @see https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html + * + * @default EndpointAccess.PUBLIC_AND_PRIVATE + */ + readonly endpointAccess?: EndpointAccess; + + /** + * Environment variables for the kubectl execution. Only relevant for kubectl enabled clusters. + * + * @default - No environment variables. + */ + readonly kubectlEnvironment?: { [key: string]: string }; + + /** + * An AWS Lambda Layer which includes `kubectl` and Helm. + * + * This layer is used by the kubectl handler to apply manifests and install + * helm charts. You must pick an appropriate releases of one of the + * `@aws-cdk/layer-kubectl-vXX` packages, that works with the version of + * Kubernetes you have chosen. If you don't supply this value `kubectl` + * 1.20 will be used, but that version is most likely too old. + * + * The handler expects the layer to include the following executables: + * + * ``` + * /opt/helm/helm + * /opt/kubectl/kubectl + * ``` + * + * @default - a default layer with Kubectl 1.20. + */ + readonly kubectlLayer?: lambda.ILayerVersion; + + /** + * An AWS Lambda layer that contains the `aws` CLI. + * + * The handler expects the layer to include the following executables: + * + * ``` + * /opt/awscli/aws + * ``` + * + * @default - a default layer with the AWS CLI 1.x + */ + readonly awscliLayer?: lambda.ILayerVersion; + + /** + * Amount of memory to allocate to the provider's lambda function. + * + * @default Size.gibibytes(1) + */ + readonly kubectlMemory?: Size; + + /** + * Custom environment variables when interacting with the EKS endpoint to manage the cluster lifecycle. + * + * @default - No environment variables. + */ + readonly clusterHandlerEnvironment?: { [key: string]: string }; + + /** + * A security group to associate with the Cluster Handler's Lambdas. + * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. + * + * Requires `placeClusterHandlerInVpc` to be set to true. + * + * @default - No security group. + */ + readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; + + /** + * An AWS Lambda Layer which includes the NPM dependency `proxy-agent`. This layer + * is used by the onEvent handler to route AWS SDK requests through a proxy. + * + * By default, the provider will use the layer included in the + * "aws-lambda-layer-node-proxy-agent" SAR application which is available in all + * commercial regions. + * + * To deploy the layer locally define it in your app as follows: + * + * ```ts + * const layer = new lambda.LayerVersion(this, 'proxy-agent-layer', { + * code: lambda.Code.fromAsset(`${__dirname}/layer.zip`), + * compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + * }); + * ``` + * + * @default - a layer bundled with this module. + */ + readonly onEventLayer?: lambda.ILayerVersion; + + /** + * Indicates whether Kubernetes resources added through `addManifest()` can be + * automatically pruned. When this is enabled (default), prune labels will be + * allocated and injected to each resource. These labels will then be used + * when issuing the `kubectl apply` operation with the `--prune` switch. + * + * @default true + */ + readonly prune?: boolean; + + /** + * If set to true, the cluster handler functions will be placed in the private subnets + * of the cluster vpc, subject to the `vpcSubnets` selection strategy. + * + * @default false + */ + readonly placeClusterHandlerInVpc?: boolean; + + /** + * KMS secret for envelope encryption for Kubernetes secrets. + * + * @default - By default, Kubernetes stores all secret object data within etcd and + * all etcd volumes used by Amazon EKS are encrypted at the disk-level + * using AWS-Managed encryption keys. + */ + readonly secretsEncryptionKey?: kms.IKey; + + /** + * The CIDR block to assign Kubernetes service IP addresses from. + * + * @default - Kubernetes assigns addresses from either the + * 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks + * @see https://docs.aws.amazon.com/eks/latest/APIReference/API_KubernetesNetworkConfigRequest.html#AmazonEKS-Type-KubernetesNetworkConfigRequest-serviceIpv4Cidr + */ + readonly serviceIpv4Cidr?: string; + + /** + * Install the AWS Load Balancer Controller onto the cluster. + * + * @see https://kubernetes-sigs.github.io/aws-load-balancer-controller + * + * @default - The controller is not installed. + */ + readonly albController?: AlbControllerOptions; + /** + * The cluster log types which you want to enable. + * + * @default - none + */ + readonly clusterLogging?: ClusterLoggingTypes[]; +} + +/** + * Group access configuration together. + */ +interface EndpointAccessConfig { + + /** + * Indicates if private access is enabled. + */ + readonly privateAccess: boolean; + + /** + * Indicates if public access is enabled. + */ + readonly publicAccess: boolean; + /** + * Public access is allowed only from these CIDR blocks. + * An empty array means access is open to any address. + * + * @default - No restrictions. + */ + readonly publicCidrs?: string[]; + +} + +/** + * Endpoint access characteristics. + */ +export class EndpointAccess { + + /** + * The cluster endpoint is accessible from outside of your VPC. + * Worker node traffic will leave your VPC to connect to the endpoint. + * + * By default, the endpoint is exposed to all adresses. You can optionally limit the CIDR blocks that can access the public endpoint using the `PUBLIC.onlyFrom` method. + * If you limit access to specific CIDR blocks, you must ensure that the CIDR blocks that you + * specify include the addresses that worker nodes and Fargate pods (if you use them) + * access the public endpoint from. + * + * @param cidr The CIDR blocks. + */ + public static readonly PUBLIC = new EndpointAccess({ privateAccess: false, publicAccess: true }); + + /** + * The cluster endpoint is only accessible through your VPC. + * Worker node traffic to the endpoint will stay within your VPC. + */ + public static readonly PRIVATE = new EndpointAccess({ privateAccess: true, publicAccess: false }); + + /** + * The cluster endpoint is accessible from outside of your VPC. + * Worker node traffic to the endpoint will stay within your VPC. + * + * By default, the endpoint is exposed to all adresses. You can optionally limit the CIDR blocks that can access the public endpoint using the `PUBLIC_AND_PRIVATE.onlyFrom` method. + * If you limit access to specific CIDR blocks, you must ensure that the CIDR blocks that you + * specify include the addresses that worker nodes and Fargate pods (if you use them) + * access the public endpoint from. + * + * @param cidr The CIDR blocks. + */ + public static readonly PUBLIC_AND_PRIVATE = new EndpointAccess({ privateAccess: true, publicAccess: true }); + + private constructor( + /** + * Configuration properties. + * + * @internal + */ + public readonly _config: EndpointAccessConfig) { + if (!_config.publicAccess && _config.publicCidrs && _config.publicCidrs.length > 0) { + throw new Error('CIDR blocks can only be configured when public access is enabled'); + } + } + + + /** + * Restrict public access to specific CIDR blocks. + * If public access is disabled, this method will result in an error. + * + * @param cidr CIDR blocks. + */ + public onlyFrom(...cidr: string[]) { + if (!this._config.privateAccess) { + // when private access is disabled, we can't restric public + // access since it will render the kubectl provider unusable. + throw new Error('Cannot restric public access to endpoint when private access is disabled. Use PUBLIC_AND_PRIVATE.onlyFrom() instead.'); + } + return new EndpointAccess({ + ...this._config, + // override CIDR + publicCidrs: cidr, + }); + } +} + +/** + * Common configuration props for EKS clusters. + */ +export interface ClusterProps extends ClusterOptions { + + /** + * Number of instances to allocate as an initial capacity for this cluster. + * Instance type can be configured through `defaultCapacityInstanceType`, + * which defaults to `m5.large`. + * + * Use `cluster.addAutoScalingGroupCapacity` to add additional customized capacity. Set this + * to `0` is you wish to avoid the initial capacity allocation. + * + * @default 2 + */ + readonly defaultCapacity?: number; + + /** + * The instance type to use for the default capacity. This will only be taken + * into account if `defaultCapacity` is > 0. + * + * @default m5.large + */ + readonly defaultCapacityInstance?: ec2.InstanceType; + + /** + * The default capacity type for the cluster. + * + * @default NODEGROUP + */ + readonly defaultCapacityType?: DefaultCapacityType; + + /** + * The IAM role to pass to the Kubectl Lambda Handler. + * + * @default - Default Lambda IAM Execution Role + */ + readonly kubectlLambdaRole?: iam.IRole; + + /** + * The tags assigned to the EKS cluster + * + * @default - none + */ + readonly tags?: { [key: string]: string }; +} + +/** + * Kubernetes cluster version + * @see https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html#kubernetes-release-calendar + */ +export class KubernetesVersion { + /** + * Kubernetes version 1.14 + * @deprecated Use newer version of EKS + */ + public static readonly V1_14 = KubernetesVersion.of('1.14'); + + /** + * Kubernetes version 1.15 + * @deprecated Use newer version of EKS + */ + public static readonly V1_15 = KubernetesVersion.of('1.15'); + + /** + * Kubernetes version 1.16 + * @deprecated Use newer version of EKS + */ + public static readonly V1_16 = KubernetesVersion.of('1.16'); + + /** + * Kubernetes version 1.17 + * @deprecated Use newer version of EKS + */ + public static readonly V1_17 = KubernetesVersion.of('1.17'); + + /** + * Kubernetes version 1.18 + * @deprecated Use newer version of EKS + */ + public static readonly V1_18 = KubernetesVersion.of('1.18'); + + /** + * Kubernetes version 1.19 + * @deprecated Use newer version of EKS + */ + public static readonly V1_19 = KubernetesVersion.of('1.19'); + + /** + * Kubernetes version 1.20 + * @deprecated Use newer version of EKS + */ + public static readonly V1_20 = KubernetesVersion.of('1.20'); + + /** + * Kubernetes version 1.21 + */ + public static readonly V1_21 = KubernetesVersion.of('1.21'); + + /** + * Kubernetes version 1.22 + * + * When creating a `Cluster` with this version, you need to also specify the + * `kubectlLayer` property with a `KubectlV22Layer` from + * `@aws-cdk/lambda-layer-kubectl-v22`. + */ + public static readonly V1_22 = KubernetesVersion.of('1.22'); + + /** + * Kubernetes version 1.23 + * + * When creating a `Cluster` with this version, you need to also specify the + * `kubectlLayer` property with a `KubectlV23Layer` from + * `@aws-cdk/lambda-layer-kubectl-v23`. + */ + public static readonly V1_23 = KubernetesVersion.of('1.23'); + + /** + * Kubernetes version 1.24 + * + * When creating a `Cluster` with this version, you need to also specify the + * `kubectlLayer` property with a `KubectlV24Layer` from + * `@aws-cdk/lambda-layer-kubectl-v24`. + */ + public static readonly V1_24 = KubernetesVersion.of('1.24'); + + /** + * Kubernetes version 1.25 + * + * When creating a `Cluster` with this version, you need to also specify the + * `kubectlLayer` property with a `KubectlV25Layer` from + * `@aws-cdk/lambda-layer-kubectl-v25`. + */ + public static readonly V1_25 = KubernetesVersion.of('1.25'); + + /** + * Custom cluster version + * @param version custom version number + */ + public static of(version: string) { return new KubernetesVersion(version); } + /** + * + * @param version cluster version number + */ + private constructor(public readonly version: string) { } +} + +/** + * EKS cluster logging types + */ +export enum ClusterLoggingTypes { + /** + * Logs pertaining to API requests to the cluster. + */ + API = 'api', + /** + * Logs pertaining to cluster access via the Kubernetes API. + */ + AUDIT = 'audit', + /** + * Logs pertaining to authentication requests into the cluster. + */ + AUTHENTICATOR = 'authenticator', + /** + * Logs pertaining to state of cluster controllers. + */ + CONTROLLER_MANAGER = 'controllerManager', + /** + * Logs pertaining to scheduling decisions. + */ + SCHEDULER = 'scheduler', +} + +abstract class ClusterBase extends Resource implements ICluster { + public abstract readonly connections: ec2.Connections; + public abstract readonly vpc: ec2.IVpc; + public abstract readonly clusterName: string; + public abstract readonly clusterArn: string; + public abstract readonly clusterEndpoint: string; + public abstract readonly clusterCertificateAuthorityData: string; + public abstract readonly clusterSecurityGroupId: string; + public abstract readonly clusterSecurityGroup: ec2.ISecurityGroup; + public abstract readonly clusterEncryptionConfigKeyArn: string; + public abstract readonly kubectlRole?: iam.IRole; + public abstract readonly kubectlLambdaRole?: iam.IRole; + public abstract readonly kubectlEnvironment?: { [key: string]: string }; + public abstract readonly kubectlSecurityGroup?: ec2.ISecurityGroup; + public abstract readonly kubectlPrivateSubnets?: ec2.ISubnet[]; + public abstract readonly kubectlMemory?: Size; + public abstract readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; + public abstract readonly prune: boolean; + public abstract readonly openIdConnectProvider: iam.IOpenIdConnectProvider; + public abstract readonly awsAuth: AwsAuth; + + private _spotInterruptHandler?: HelmChart; + + /** + * Manages the aws-auth config map. + * + * @internal + */ + protected _awsAuth?: AwsAuth; + + /** + * Defines a Kubernetes resource in this cluster. + * + * The manifest will be applied/deleted using kubectl as needed. + * + * @param id logical id of this manifest + * @param manifest a list of Kubernetes resource specifications + * @returns a `KubernetesResource` object. + */ + public addManifest(id: string, ...manifest: Record[]): KubernetesManifest { + return new KubernetesManifest(this, `manifest-${id}`, { cluster: this, manifest }); + } + + /** + * Defines a Helm chart in this cluster. + * + * @param id logical id of this chart. + * @param options options of this chart. + * @returns a `HelmChart` construct + */ + public addHelmChart(id: string, options: HelmChartOptions): HelmChart { + return new HelmChart(this, `chart-${id}`, { cluster: this, ...options }); + } + + /** + * Defines a CDK8s chart in this cluster. + * + * @param id logical id of this chart. + * @param chart the cdk8s chart. + * @returns a `KubernetesManifest` construct representing the chart. + */ + public addCdk8sChart(id: string, chart: Construct, options: KubernetesManifestOptions = {}): KubernetesManifest { + + const cdk8sChart = chart as any; + + // see https://github.com/awslabs/cdk8s/blob/master/packages/cdk8s/src/chart.ts#L84 + if (typeof cdk8sChart.toJson !== 'function') { + throw new Error(`Invalid cdk8s chart. Must contain a 'toJson' method, but found ${typeof cdk8sChart.toJson}`); + } + + const manifest = new KubernetesManifest(this, id, { + cluster: this, + manifest: cdk8sChart.toJson(), + ...options, + }); + + return manifest; + } + + public addServiceAccount(id: string, options: ServiceAccountOptions = {}): ServiceAccount { + return new ServiceAccount(this, id, { + ...options, + cluster: this, + }); + } + + /** + * Installs the AWS spot instance interrupt handler on the cluster if it's not + * already added. + */ + private addSpotInterruptHandler() { + if (!this._spotInterruptHandler) { + this._spotInterruptHandler = this.addHelmChart('spot-interrupt-handler', { + chart: 'aws-node-termination-handler', + version: '0.18.0', + repository: 'https://aws.github.io/eks-charts', + namespace: 'kube-system', + values: { + nodeSelector: { + lifecycle: LifecycleLabel.SPOT, + }, + }, + }); + } + + return this._spotInterruptHandler; + } + + /** + * Connect capacity in the form of an existing AutoScalingGroup to the EKS cluster. + * + * The AutoScalingGroup must be running an EKS-optimized AMI containing the + * /etc/eks/bootstrap.sh script. This method will configure Security Groups, + * add the right policies to the instance role, apply the right tags, and add + * the required user data to the instance's launch configuration. + * + * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. + * If kubectl is enabled, the + * [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) + * daemon will be installed on all spot instances to handle + * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). + * + * Prefer to use `addAutoScalingGroupCapacity` if possible. + * + * @see https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html + * @param autoScalingGroup [disable-awslint:ref-via-interface] + * @param options options for adding auto scaling groups, like customizing the bootstrap script + */ + public connectAutoScalingGroupCapacity(autoScalingGroup: autoscaling.AutoScalingGroup, options: AutoScalingGroupOptions) { + // self rules + autoScalingGroup.connections.allowInternally(ec2.Port.allTraffic()); + + // Cluster to:nodes rules + autoScalingGroup.connections.allowFrom(this, ec2.Port.tcp(443)); + autoScalingGroup.connections.allowFrom(this, ec2.Port.tcpRange(1025, 65535)); + + // Allow HTTPS from Nodes to Cluster + autoScalingGroup.connections.allowTo(this, ec2.Port.tcp(443)); + + // Allow all node outbound traffic + autoScalingGroup.connections.allowToAnyIpv4(ec2.Port.allTcp()); + autoScalingGroup.connections.allowToAnyIpv4(ec2.Port.allUdp()); + autoScalingGroup.connections.allowToAnyIpv4(ec2.Port.allIcmp()); + + // allow traffic to/from managed node groups (eks attaches this security group to the managed nodes) + autoScalingGroup.addSecurityGroup(this.clusterSecurityGroup); + + const bootstrapEnabled = options.bootstrapEnabled ?? true; + if (options.bootstrapOptions && !bootstrapEnabled) { + throw new Error('Cannot specify "bootstrapOptions" if "bootstrapEnabled" is false'); + } + + if (bootstrapEnabled) { + const userData = options.machineImageType === MachineImageType.BOTTLEROCKET ? + renderBottlerocketUserData(this) : + renderAmazonLinuxUserData(this, autoScalingGroup, options.bootstrapOptions); + autoScalingGroup.addUserData(...userData); + } + + autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEKSWorkerNodePolicy')); + autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEKS_CNI_Policy')); + autoScalingGroup.role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEC2ContainerRegistryReadOnly')); + + // EKS Required Tags + // https://docs.aws.amazon.com/eks/latest/userguide/worker.html + Tags.of(autoScalingGroup).add(`kubernetes.io/cluster/${this.clusterName}`, 'owned', { + applyToLaunchedInstances: true, + // exclude security groups to avoid multiple "owned" security groups. + // (the cluster security group already has this tag) + excludeResourceTypes: ['AWS::EC2::SecurityGroup'], + }); + + // do not attempt to map the role if `kubectl` is not enabled for this + // cluster or if `mapRole` is set to false. By default this should happen. + let mapRole = options.mapRole ?? true; + if (mapRole && !(this instanceof Cluster)) { + // do the mapping... + Annotations.of(autoScalingGroup).addWarning('Auto-mapping aws-auth role for imported cluster is not supported, please map role manually'); + mapRole = false; + } + if (mapRole) { + // see https://docs.aws.amazon.com/en_us/eks/latest/userguide/add-user-role.html + this.awsAuth.addRoleMapping(autoScalingGroup.role, { + username: 'system:node:{{EC2PrivateDNSName}}', + groups: [ + 'system:bootstrappers', + 'system:nodes', + ], + }); + } else { + // since we are not mapping the instance role to RBAC, synthesize an + // output so it can be pasted into `aws-auth-cm.yaml` + new CfnOutput(autoScalingGroup, 'InstanceRoleARN', { + value: autoScalingGroup.role.roleArn, + }); + } + + const addSpotInterruptHandler = options.spotInterruptHandler ?? true; + // if this is an ASG with spot instances, install the spot interrupt handler (only if kubectl is enabled). + if (autoScalingGroup.spotPrice && addSpotInterruptHandler) { + this.addSpotInterruptHandler(); + } + + if (this instanceof Cluster && this.albController) { + // the controller runs on the worker nodes so they cannot + // be deleted before the controller. + Node.of(this.albController).addDependency(autoScalingGroup); + } + } +} + +/** + * Options for fetching a ServiceLoadBalancerAddress. + */ +export interface ServiceLoadBalancerAddressOptions { + + /** + * Timeout for waiting on the load balancer address. + * + * @default Duration.minutes(5) + */ + readonly timeout?: Duration; + + /** + * The namespace the service belongs to. + * + * @default 'default' + */ + readonly namespace?: string; + +} + +/** + * Options for fetching an IngressLoadBalancerAddress. + */ +export interface IngressLoadBalancerAddressOptions extends ServiceLoadBalancerAddressOptions {}; + +/** + * A Cluster represents a managed Kubernetes Service (EKS) + * + * This is a fully managed cluster of API Servers (control-plane) + * The user is still required to create the worker nodes. + */ +export class Cluster extends ClusterBase { + /** + * Import an existing cluster + * + * @param scope the construct scope, in most cases 'this' + * @param id the id or name to import as + * @param attrs the cluster properties to use for importing information + */ + public static fromClusterAttributes(scope: Construct, id: string, attrs: ClusterAttributes): ICluster { + return new ImportedCluster(scope, id, attrs); + } + + /** + * The VPC in which this Cluster was created + */ + public readonly vpc: ec2.IVpc; + + /** + * The Name of the created EKS Cluster + */ + public readonly clusterName: string; + + /** + * The AWS generated ARN for the Cluster resource + * + * For example, `arn:aws:eks:us-west-2:666666666666:cluster/prod` + */ + public readonly clusterArn: string; + + /** + * The endpoint URL for the Cluster + * + * This is the URL inside the kubeconfig file to use with kubectl + * + * For example, `https://5E1D0CEXAMPLEA591B746AFC5AB30262.yl4.us-west-2.eks.amazonaws.com` + */ + public readonly clusterEndpoint: string; + + /** + * The certificate-authority-data for your cluster. + */ + public readonly clusterCertificateAuthorityData: string; + + /** + * The id of the cluster security group that was created by Amazon EKS for the cluster. + */ + public readonly clusterSecurityGroupId: string; + + /** + * The cluster security group that was created by Amazon EKS for the cluster. + */ + public readonly clusterSecurityGroup: ec2.ISecurityGroup; + + /** + * Amazon Resource Name (ARN) or alias of the customer master key (CMK). + */ + public readonly clusterEncryptionConfigKeyArn: string; + + /** + * Manages connection rules (Security Group Rules) for the cluster + * + * @type {ec2.Connections} + * @memberof Cluster + */ + public readonly connections: ec2.Connections; + + /** + * IAM role assumed by the EKS Control Plane + */ + public readonly role: iam.IRole; + + /** + * The auto scaling group that hosts the default capacity for this cluster. + * This will be `undefined` if the `defaultCapacityType` is not `EC2` or + * `defaultCapacityType` is `EC2` but default capacity is set to 0. + */ + public readonly defaultCapacity?: autoscaling.AutoScalingGroup; + + /** + * The node group that hosts the default capacity for this cluster. + * This will be `undefined` if the `defaultCapacityType` is `EC2` or + * `defaultCapacityType` is `NODEGROUP` but default capacity is set to 0. + */ + public readonly defaultNodegroup?: Nodegroup; + + /** + * An IAM role that can perform kubectl operations against this cluster. + * + * The role should be mapped to the `system:masters` Kubernetes RBAC role. + */ + public readonly kubectlRole?: iam.IRole; + + /** + * An IAM role that can perform kubectl operations against this cluster. + * + * The role should be mapped to the `system:masters` Kubernetes RBAC role. + * + * This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster. + * @default - if not specified, the default role created by a lambda function will + * be used. + */ + + public readonly kubectlLambdaRole?: iam.IRole; + + /** + * Custom environment variables when running `kubectl` against this cluster. + */ + public readonly kubectlEnvironment?: { [key: string]: string }; + + /** + * A security group to use for `kubectl` execution. + * + * @default - If not specified, the k8s endpoint is expected to be accessible + * publicly. + */ + public readonly kubectlSecurityGroup?: ec2.ISecurityGroup; + + /** + * Subnets to host the `kubectl` compute resources. + * + * @default - If not specified, the k8s endpoint is expected to be accessible + * publicly. + */ + public readonly kubectlPrivateSubnets?: ec2.ISubnet[]; + + /** + * An IAM role with administrative permissions to create or update the + * cluster. This role also has `systems:master` permissions. + */ + public readonly adminRole: iam.Role; + + /** + * If the cluster has one (or more) FargateProfiles associated, this array + * will hold a reference to each. + */ + private readonly _fargateProfiles: FargateProfile[] = []; + + /** + * an Open ID Connect Provider instance + */ + private _openIdConnectProvider?: iam.IOpenIdConnectProvider; + + /** + * An AWS Lambda layer that includes `kubectl` and `helm` + * + * If not defined, a default layer will be used containing Kubectl 1.20 and Helm 3.8 + */ + readonly kubectlLayer?: lambda.ILayerVersion; + + /** + * An AWS Lambda layer that contains the `aws` CLI. + * + * If not defined, a default layer will be used containing the AWS CLI 1.x. + */ + readonly awscliLayer?: lambda.ILayerVersion; + + /** + * The amount of memory allocated to the kubectl provider's lambda function. + */ + public readonly kubectlMemory?: Size; + + /** + * A security group to associate with the Cluster Handler's Lambdas. + * The Cluster Handler's Lambdas are responsible for calling AWS's EKS API. + * + * Requires `placeClusterHandlerInVpc` to be set to true. + * + * @default - No security group. + */ + public readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup; + + /** + * The AWS Lambda layer that contains the NPM dependency `proxy-agent`. If + * undefined, a SAR app that contains this layer will be used. + */ + readonly onEventLayer?: lambda.ILayerVersion; + + /** + * Determines if Kubernetes resources can be pruned automatically. + */ + public readonly prune: boolean; + + /** + * The ALB Controller construct defined for this cluster. + * Will be undefined if `albController` wasn't configured. + */ + public readonly albController?: AlbController; + + /** + * If this cluster is kubectl-enabled, returns the `ClusterResource` object + * that manages it. If this cluster is not kubectl-enabled (i.e. uses the + * stock `CfnCluster`), this is `undefined`. + */ + private readonly _clusterResource: ClusterResource; + + private _neuronDevicePlugin?: KubernetesManifest; + + private readonly endpointAccess: EndpointAccess; + + private readonly vpcSubnets: ec2.SubnetSelection[]; + + private readonly version: KubernetesVersion; + + private readonly logging?: { [key: string]: [ { [key: string]: any } ] }; + + /** + * A dummy CloudFormation resource that is used as a wait barrier which + * represents that the cluster is ready to receive "kubectl" commands. + * + * Specifically, all fargate profiles are automatically added as a dependency + * of this barrier, which means that it will only be "signaled" when all + * fargate profiles have been successfully created. + * + * When kubectl resources call `_attachKubectlResourceScope()`, this resource + * is added as their dependency which implies that they can only be deployed + * after the cluster is ready. + */ + private readonly _kubectlReadyBarrier: CfnResource; + + private readonly _kubectlResourceProvider: KubectlProvider; + + /** + * Initiates an EKS Cluster with the supplied arguments + * + * @param scope a Construct, most likely a cdk.Stack created + * @param id the id of the Construct to create + * @param props properties in the IClusterProps interface + */ + constructor(scope: Construct, id: string, props: ClusterProps) { + super(scope, id, { + physicalName: props.clusterName, + }); + + const stack = Stack.of(this); + + this.prune = props.prune ?? true; + this.vpc = props.vpc || new ec2.Vpc(this, 'DefaultVpc'); + + const kubectlVersion = new semver.SemVer(`${props.version.version}.0`); + if (semver.gte(kubectlVersion, '1.22.0') && !props.kubectlLayer) { + Annotations.of(this).addWarning(`You created a cluster with Kubernetes Version ${props.version.version} without specifying the kubectlLayer property. This may cause failures as the kubectl version provided with aws-cdk-lib is 1.20, which is only guaranteed to be compatible with Kubernetes versions 1.19-1.21. Please provide a kubectlLayer from @aws-cdk/lambda-layer-kubectl-v${kubectlVersion.minor}.`); + }; + this.version = props.version; + this.kubectlLambdaRole = props.kubectlLambdaRole ? props.kubectlLambdaRole : undefined; + + this.tagSubnets(); + + // this is the role used by EKS when interacting with AWS resources + this.role = props.role || new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('eks.amazonaws.com'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEKSClusterPolicy'), + ], + }); + + const securityGroup = props.securityGroup || new ec2.SecurityGroup(this, 'ControlPlaneSecurityGroup', { + vpc: this.vpc, + description: 'EKS Control Plane Security Group', + }); + + this.vpcSubnets = props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]; + + const selectedSubnetIdsPerGroup = this.vpcSubnets.map(s => this.vpc.selectSubnets(s).subnetIds); + if (selectedSubnetIdsPerGroup.some(Token.isUnresolved) && selectedSubnetIdsPerGroup.length > 1) { + throw new Error('eks.Cluster: cannot select multiple subnet groups from a VPC imported from list tokens with unknown length. Select only one subnet group, pass a length to Fn.split, or switch to Vpc.fromLookup.'); + } + + // Get subnetIds for all selected subnets + const subnetIds = Array.from(new Set(flatten(selectedSubnetIdsPerGroup))); + + this.logging = props.clusterLogging ? { + clusterLogging: [ + { + enabled: true, + types: Object.values(props.clusterLogging), + }, + ], + } : undefined; + + this.endpointAccess = props.endpointAccess ?? EndpointAccess.PUBLIC_AND_PRIVATE; + this.kubectlEnvironment = props.kubectlEnvironment; + this.kubectlLayer = props.kubectlLayer; + this.awscliLayer = props.awscliLayer; + this.kubectlMemory = props.kubectlMemory; + + this.onEventLayer = props.onEventLayer; + this.clusterHandlerSecurityGroup = props.clusterHandlerSecurityGroup; + + const privateSubnets = this.selectPrivateSubnets().slice(0, 16); + const publicAccessDisabled = !this.endpointAccess._config.publicAccess; + const publicAccessRestricted = !publicAccessDisabled + && this.endpointAccess._config.publicCidrs + && this.endpointAccess._config.publicCidrs.length !== 0; + + // validate endpoint access configuration + + if (privateSubnets.length === 0 && publicAccessDisabled) { + // no private subnets and no public access at all, no good. + throw new Error('Vpc must contain private subnets when public endpoint access is disabled'); + } + + if (privateSubnets.length === 0 && publicAccessRestricted) { + // no private subnets and public access is restricted, no good. + throw new Error('Vpc must contain private subnets when public endpoint access is restricted'); + } + + const placeClusterHandlerInVpc = props.placeClusterHandlerInVpc ?? false; + + if (placeClusterHandlerInVpc && privateSubnets.length === 0) { + throw new Error('Cannot place cluster handler in the VPC since no private subnets could be selected'); + } + + if (props.clusterHandlerSecurityGroup && !placeClusterHandlerInVpc) { + throw new Error('Cannot specify clusterHandlerSecurityGroup without placeClusterHandlerInVpc set to true'); + } + + const resource = this._clusterResource = new ClusterResource(this, 'Resource', { + name: this.physicalName, + environment: props.clusterHandlerEnvironment, + roleArn: this.role.roleArn, + version: props.version.version, + resourcesVpcConfig: { + securityGroupIds: [securityGroup.securityGroupId], + subnetIds, + }, + ...(props.secretsEncryptionKey ? { + encryptionConfig: [{ + provider: { + keyArn: props.secretsEncryptionKey.keyArn, + }, + resources: ['secrets'], + }], + } : {}), + kubernetesNetworkConfig: props.serviceIpv4Cidr ? { + serviceIpv4Cidr: props.serviceIpv4Cidr, + } : undefined, + endpointPrivateAccess: this.endpointAccess._config.privateAccess, + endpointPublicAccess: this.endpointAccess._config.publicAccess, + publicAccessCidrs: this.endpointAccess._config.publicCidrs, + secretsEncryptionKey: props.secretsEncryptionKey, + vpc: this.vpc, + subnets: placeClusterHandlerInVpc ? privateSubnets : undefined, + clusterHandlerSecurityGroup: this.clusterHandlerSecurityGroup, + onEventLayer: this.onEventLayer, + tags: props.tags, + logging: this.logging, + }); + + if (this.endpointAccess._config.privateAccess && privateSubnets.length !== 0) { + + // when private access is enabled and the vpc has private subnets, lets connect + // the provider to the vpc so that it will work even when restricting public access. + + // validate VPC properties according to: https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html + if (this.vpc instanceof ec2.Vpc && !(this.vpc.dnsHostnamesEnabled && this.vpc.dnsSupportEnabled)) { + throw new Error('Private endpoint access requires the VPC to have DNS support and DNS hostnames enabled. Use `enableDnsHostnames: true` and `enableDnsSupport: true` when creating the VPC.'); + } + + this.kubectlPrivateSubnets = privateSubnets; + + // the vpc must exist in order to properly delete the cluster (since we run `kubectl delete`). + // this ensures that. + this._clusterResource.node.addDependency(this.vpc); + } + + this.adminRole = resource.adminRole; + + // we use an SSM parameter as a barrier because it's free and fast. + this._kubectlReadyBarrier = new CfnResource(this, 'KubectlReadyBarrier', { + type: 'AWS::SSM::Parameter', + properties: { + Type: 'String', + Value: 'aws:cdk:eks:kubectl-ready', + }, + }); + + // add the cluster resource itself as a dependency of the barrier + this._kubectlReadyBarrier.node.addDependency(this._clusterResource); + + this.clusterName = this.getResourceNameAttribute(resource.ref); + this.clusterArn = this.getResourceArnAttribute(resource.attrArn, clusterArnComponents(this.physicalName)); + + this.clusterEndpoint = resource.attrEndpoint; + this.clusterCertificateAuthorityData = resource.attrCertificateAuthorityData; + this.clusterSecurityGroupId = resource.attrClusterSecurityGroupId; + this.clusterEncryptionConfigKeyArn = resource.attrEncryptionConfigKeyArn; + + this.clusterSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'ClusterSecurityGroup', this.clusterSecurityGroupId); + + this.connections = new ec2.Connections({ + securityGroups: [this.clusterSecurityGroup, securityGroup], + defaultPort: ec2.Port.tcp(443), // Control Plane has an HTTPS API + }); + + // we can use the cluster security group since its already attached to the cluster + // and configured to allow connections from itself. + this.kubectlSecurityGroup = this.clusterSecurityGroup; + + // use the cluster creation role to issue kubectl commands against the cluster because when the + // cluster is first created, that's the only role that has "system:masters" permissions + this.kubectlRole = this.adminRole; + + this._kubectlResourceProvider = this.defineKubectlProvider(); + + const updateConfigCommandPrefix = `aws eks update-kubeconfig --name ${this.clusterName}`; + const getTokenCommandPrefix = `aws eks get-token --cluster-name ${this.clusterName}`; + const commonCommandOptions = [`--region ${stack.region}`]; + + if (props.outputClusterName) { + new CfnOutput(this, 'ClusterName', { value: this.clusterName }); + } + + // if an explicit role is not configured, define a masters role that can + // be assumed by anyone in the account (with sts:AssumeRole permissions of + // course) + const mastersRole = props.mastersRole ?? new iam.Role(this, 'MastersRole', { + assumedBy: new iam.AccountRootPrincipal(), + }); + + // map the IAM role to the `system:masters` group. + this.awsAuth.addMastersRole(mastersRole); + + if (props.outputMastersRoleArn) { + new CfnOutput(this, 'MastersRoleArn', { value: mastersRole.roleArn }); + } + + commonCommandOptions.push(`--role-arn ${mastersRole.roleArn}`); + + if (props.albController) { + this.albController = AlbController.create(this, { ...props.albController, cluster: this }); + } + + // allocate default capacity if non-zero (or default). + const minCapacity = props.defaultCapacity ?? DEFAULT_CAPACITY_COUNT; + if (minCapacity > 0) { + const instanceType = props.defaultCapacityInstance || DEFAULT_CAPACITY_TYPE; + this.defaultCapacity = props.defaultCapacityType === DefaultCapacityType.EC2 ? + this.addAutoScalingGroupCapacity('DefaultCapacity', { instanceType, minCapacity }) : undefined; + + this.defaultNodegroup = props.defaultCapacityType !== DefaultCapacityType.EC2 ? + this.addNodegroupCapacity('DefaultCapacity', { instanceTypes: [instanceType], minSize: minCapacity }) : undefined; + } + + const outputConfigCommand = props.outputConfigCommand ?? true; + if (outputConfigCommand) { + const postfix = commonCommandOptions.join(' '); + new CfnOutput(this, 'ConfigCommand', { value: `${updateConfigCommandPrefix} ${postfix}` }); + new CfnOutput(this, 'GetTokenCommand', { value: `${getTokenCommandPrefix} ${postfix}` }); + } + + this.defineCoreDnsComputeType(props.coreDnsComputeType ?? CoreDnsComputeType.EC2); + + } + + /** + * Fetch the load balancer address of a service of type 'LoadBalancer'. + * + * @param serviceName The name of the service. + * @param options Additional operation options. + */ + public getServiceLoadBalancerAddress(serviceName: string, options: ServiceLoadBalancerAddressOptions = {}): string { + + const loadBalancerAddress = new KubernetesObjectValue(this, `${serviceName}LoadBalancerAddress`, { + cluster: this, + objectType: 'service', + objectName: serviceName, + objectNamespace: options.namespace, + jsonPath: '.status.loadBalancer.ingress[0].hostname', + timeout: options.timeout, + }); + + return loadBalancerAddress.value; + + } + + /** + * Fetch the load balancer address of an ingress backed by a load balancer. + * + * @param ingressName The name of the ingress. + * @param options Additional operation options. + */ + public getIngressLoadBalancerAddress(ingressName: string, options: IngressLoadBalancerAddressOptions = {}): string { + + const loadBalancerAddress = new KubernetesObjectValue(this, `${ingressName}LoadBalancerAddress`, { + cluster: this, + objectType: 'ingress', + objectName: ingressName, + objectNamespace: options.namespace, + jsonPath: '.status.loadBalancer.ingress[0].hostname', + timeout: options.timeout, + }); + + return loadBalancerAddress.value; + + } + + /** + * Add nodes to this EKS cluster + * + * The nodes will automatically be configured with the right VPC and AMI + * for the instance type and Kubernetes version. + * + * Note that if you specify `updateType: RollingUpdate` or `updateType: ReplacingUpdate`, your nodes might be replaced at deploy + * time without notice in case the recommended AMI for your machine image type has been updated by AWS. + * The default behavior for `updateType` is `None`, which means only new instances will be launched using the new AMI. + * + * Spot instances will be labeled `lifecycle=Ec2Spot` and tainted with `PreferNoSchedule`. + * In addition, the [spot interrupt handler](https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-eks-solution/spot-termination-handler) + * daemon will be installed on all spot instances to handle + * [EC2 Spot Instance Termination Notices](https://aws.amazon.com/blogs/aws/new-ec2-spot-instance-termination-notices/). + */ + public addAutoScalingGroupCapacity(id: string, options: AutoScalingGroupCapacityOptions): autoscaling.AutoScalingGroup { + if (options.machineImageType === MachineImageType.BOTTLEROCKET && options.bootstrapOptions !== undefined) { + throw new Error('bootstrapOptions is not supported for Bottlerocket'); + } + const asg = new autoscaling.AutoScalingGroup(this, id, { + ...options, + vpc: this.vpc, + machineImage: options.machineImageType === MachineImageType.BOTTLEROCKET ? + new BottleRocketImage({ + kubernetesVersion: this.version.version, + }) : + new EksOptimizedImage({ + nodeType: nodeTypeForInstanceType(options.instanceType), + cpuArch: cpuArchForInstanceType(options.instanceType), + kubernetesVersion: this.version.version, + }), + }); + + this.connectAutoScalingGroupCapacity(asg, { + mapRole: options.mapRole, + bootstrapOptions: options.bootstrapOptions, + bootstrapEnabled: options.bootstrapEnabled, + machineImageType: options.machineImageType, + spotInterruptHandler: options.spotInterruptHandler, + }); + + if (nodeTypeForInstanceType(options.instanceType) === NodeType.INFERENTIA) { + this.addNeuronDevicePlugin(); + } + + return asg; + } + + /** + * Add managed nodegroup to this Amazon EKS cluster + * + * This method will create a new managed nodegroup and add into the capacity. + * + * @see https://docs.aws.amazon.com/eks/latest/userguide/managed-node-groups.html + * @param id The ID of the nodegroup + * @param options options for creating a new nodegroup + */ + public addNodegroupCapacity(id: string, options?: NodegroupOptions): Nodegroup { + return new Nodegroup(this, `Nodegroup${id}`, { + cluster: this, + ...options, + }); + } + + /** + * Lazily creates the AwsAuth resource, which manages AWS authentication mapping. + */ + public get awsAuth() { + if (!this._awsAuth) { + this._awsAuth = new AwsAuth(this, 'AwsAuth', { cluster: this }); + } + + return this._awsAuth; + } + + /** + * If this cluster is kubectl-enabled, returns the OpenID Connect issuer url. + * This is because the values is only be retrieved by the API and not exposed + * by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the + * stock `CfnCluster`), this is `undefined`. + * @attribute + */ + public get clusterOpenIdConnectIssuerUrl(): string { + return this._clusterResource.attrOpenIdConnectIssuerUrl; + } + + /** + * If this cluster is kubectl-enabled, returns the OpenID Connect issuer. + * This is because the values is only be retrieved by the API and not exposed + * by CloudFormation. If this cluster is not kubectl-enabled (i.e. uses the + * stock `CfnCluster`), this is `undefined`. + * @attribute + */ + public get clusterOpenIdConnectIssuer(): string { + return this._clusterResource.attrOpenIdConnectIssuer; + } + + /** + * An `OpenIdConnectProvider` resource associated with this cluster, and which can be used + * to link this cluster to AWS IAM. + * + * A provider will only be defined if this property is accessed (lazy initialization). + */ + public get openIdConnectProvider() { + if (!this._openIdConnectProvider) { + this._openIdConnectProvider = new OpenIdConnectProvider(this, 'OpenIdConnectProvider', { + url: this.clusterOpenIdConnectIssuerUrl, + }); + } + + return this._openIdConnectProvider; + } + + /** + * Adds a Fargate profile to this cluster. + * @see https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html + * + * @param id the id of this profile + * @param options profile options + */ + public addFargateProfile(id: string, options: FargateProfileOptions) { + return new FargateProfile(this, `fargate-profile-${id}`, { + ...options, + cluster: this, + }); + } + + /** + * Internal API used by `FargateProfile` to keep inventory of Fargate profiles associated with + * this cluster, for the sake of ensuring the profiles are created sequentially. + * + * @returns the list of FargateProfiles attached to this cluster, including the one just attached. + * @internal + */ + public _attachFargateProfile(fargateProfile: FargateProfile): FargateProfile[] { + this._fargateProfiles.push(fargateProfile); + + // add all profiles as a dependency of the "kubectl-ready" barrier because all kubectl- + // resources can only be deployed after all fargate profiles are created. + this._kubectlReadyBarrier.node.addDependency(fargateProfile); + + return this._fargateProfiles; + } + + /** + * Adds a resource scope that requires `kubectl` to this cluster and returns + * the `KubectlProvider` which is the custom resource provider that should be + * used as the resource provider. + * + * Called from `HelmResource` and `KubernetesResource` + * + * @param resourceScope the construct scope in which kubectl resources are defined. + * + * @internal + */ + public _attachKubectlResourceScope(resourceScope: Construct): KubectlProvider { + Node.of(resourceScope).addDependency(this._kubectlReadyBarrier); + return this._kubectlResourceProvider; + } + + private defineKubectlProvider() { + const uid = '@aws-cdk/aws-eks.KubectlProvider'; + + // since we can't have the provider connect to multiple networks, and we + // wanted to avoid resource tear down, we decided for now that we will only + // support a single EKS cluster per CFN stack. + if (this.stack.node.tryFindChild(uid)) { + throw new Error('Only a single EKS cluster can be defined within a CloudFormation stack'); + } + + return new KubectlProvider(this.stack, uid, { cluster: this }); + } + + private selectPrivateSubnets(): ec2.ISubnet[] { + const privateSubnets: ec2.ISubnet[] = []; + const vpcPrivateSubnetIds = this.vpc.privateSubnets.map(s => s.subnetId); + const vpcPublicSubnetIds = this.vpc.publicSubnets.map(s => s.subnetId); + + for (const placement of this.vpcSubnets) { + + for (const subnet of this.vpc.selectSubnets(placement).subnets) { + + if (vpcPrivateSubnetIds.includes(subnet.subnetId)) { + // definitely private, take it. + privateSubnets.push(subnet); + continue; + } + + if (vpcPublicSubnetIds.includes(subnet.subnetId)) { + // definitely public, skip it. + continue; + } + + // neither public and nor private - what is it then? this means its a subnet instance that was explicitly passed + // in the subnet selection. since ISubnet doesn't contain information on type, we have to assume its private and let it + // fail at deploy time :\ (its better than filtering it out and preventing a possibly successful deployment) + privateSubnets.push(subnet); + } + + } + + return privateSubnets; + } + + /** + * Installs the Neuron device plugin on the cluster if it's not + * already added. + */ + private addNeuronDevicePlugin() { + if (!this._neuronDevicePlugin) { + const fileContents = fs.readFileSync(path.join(__dirname, 'addons/neuron-device-plugin.yaml'), 'utf8'); + const sanitized = YAML.parse(fileContents); + this._neuronDevicePlugin = this.addManifest('NeuronDevicePlugin', sanitized); + } + + return this._neuronDevicePlugin; + } + + /** + * Opportunistically tag subnets with the required tags. + * + * If no subnets could be found (because this is an imported VPC), add a warning. + * + * @see https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html + */ + private tagSubnets() { + const tagAllSubnets = (type: string, subnets: ec2.ISubnet[], tag: string) => { + for (const subnet of subnets) { + // if this is not a concrete subnet, attach a construct warning + if (!ec2.Subnet.isVpcSubnet(subnet)) { + // message (if token): "could not auto-tag public/private subnet with tag..." + // message (if not token): "count not auto-tag public/private subnet xxxxx with tag..." + const subnetID = Token.isUnresolved(subnet.subnetId) || Token.isUnresolved([subnet.subnetId]) ? '' : ` ${subnet.subnetId}`; + Annotations.of(this).addWarning(`Could not auto-tag ${type} subnet${subnetID} with "${tag}=1", please remember to do this manually`); + continue; + } + + Tags.of(subnet).add(tag, '1'); + } + }; + + // https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html + tagAllSubnets('private', this.vpc.privateSubnets, 'kubernetes.io/role/internal-elb'); + tagAllSubnets('public', this.vpc.publicSubnets, 'kubernetes.io/role/elb'); + } + + /** + * Patches the CoreDNS deployment configuration and sets the "eks.amazonaws.com/compute-type" + * annotation to either "ec2" or "fargate". Note that if "ec2" is selected, the resource is + * omitted/removed, since the cluster is created with the "ec2" compute type by default. + */ + private defineCoreDnsComputeType(type: CoreDnsComputeType) { + // ec2 is the "built in" compute type of the cluster so if this is the + // requested type we can simply omit the resource. since the resource's + // `restorePatch` is configured to restore the value to "ec2" this means + // that deletion of the resource will change to "ec2" as well. + if (type === CoreDnsComputeType.EC2) { + return; + } + + // this is the json patch we merge into the resource based off of: + // https://docs.aws.amazon.com/eks/latest/userguide/fargate-getting-started.html#fargate-gs-coredns + const renderPatch = (computeType: CoreDnsComputeType) => ({ + spec: { + template: { + metadata: { + annotations: { + 'eks.amazonaws.com/compute-type': computeType, + }, + }, + }, + }, + }); + + new KubernetesPatch(this, 'CoreDnsComputeTypePatch', { + cluster: this, + resourceName: 'deployment/coredns', + resourceNamespace: 'kube-system', + applyPatch: renderPatch(CoreDnsComputeType.FARGATE), + restorePatch: renderPatch(CoreDnsComputeType.EC2), + }); + } +} + +/** + * Options for adding worker nodes + */ +export interface AutoScalingGroupCapacityOptions extends autoscaling.CommonAutoScalingGroupProps { + /** + * Instance type of the instances to start + */ + readonly instanceType: ec2.InstanceType; + + /** + * Will automatically update the aws-auth ConfigMap to map the IAM instance + * role to RBAC. + * + * This cannot be explicitly set to `true` if the cluster has kubectl disabled. + * + * @default - true if the cluster has kubectl enabled (which is the default). + */ + readonly mapRole?: boolean; + + /** + * Configures the EC2 user-data script for instances in this autoscaling group + * to bootstrap the node (invoke `/etc/eks/bootstrap.sh`) and associate it + * with the EKS cluster. + * + * If you wish to provide a custom user data script, set this to `false` and + * manually invoke `autoscalingGroup.addUserData()`. + * + * @default true + */ + readonly bootstrapEnabled?: boolean; + + /** + * EKS node bootstrapping options. + * + * @default - none + */ + readonly bootstrapOptions?: BootstrapOptions; + + /** + * Machine image type + * + * @default MachineImageType.AMAZON_LINUX_2 + */ + readonly machineImageType?: MachineImageType; + + /** + * Installs the AWS spot instance interrupt handler on the cluster if it's not + * already added. Only relevant if `spotPrice` is used. + * + * @default true + */ + readonly spotInterruptHandler?: boolean; +} + +/** + * EKS node bootstrapping options. + */ +export interface BootstrapOptions { + /** + * Sets `--max-pods` for the kubelet based on the capacity of the EC2 instance. + * + * @default true + */ + readonly useMaxPods?: boolean; + + /** + * Restores the docker default bridge network. + * + * @default false + */ + readonly enableDockerBridge?: boolean; + + /** + * Number of retry attempts for AWS API call (DescribeCluster). + * + * @default 3 + */ + readonly awsApiRetryAttempts?: number; + + /** + * The contents of the `/etc/docker/daemon.json` file. Useful if you want a + * custom config differing from the default one in the EKS AMI. + * + * @default - none + */ + readonly dockerConfigJson?: string; + + /** + + * Overrides the IP address to use for DNS queries within the + * cluster. + * + * @default - 10.100.0.10 or 172.20.0.10 based on the IP + * address of the primary interface. + */ + readonly dnsClusterIp?: string; + + /** + * Extra arguments to add to the kubelet. Useful for adding labels or taints. + * + * For example, `--node-labels foo=bar,goo=far`. + * + * @default - none + */ + readonly kubeletExtraArgs?: string; + + /** + * Additional command line arguments to pass to the `/etc/eks/bootstrap.sh` + * command. + * + * @see https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh + * @default - none + */ + readonly additionalArgs?: string; +} + +/** + * Options for adding an AutoScalingGroup as capacity + */ +export interface AutoScalingGroupOptions { + /** + * Will automatically update the aws-auth ConfigMap to map the IAM instance + * role to RBAC. + * + * This cannot be explicitly set to `true` if the cluster has kubectl disabled. + * + * @default - true if the cluster has kubectl enabled (which is the default). + */ + readonly mapRole?: boolean; + + /** + * Configures the EC2 user-data script for instances in this autoscaling group + * to bootstrap the node (invoke `/etc/eks/bootstrap.sh`) and associate it + * with the EKS cluster. + * + * If you wish to provide a custom user data script, set this to `false` and + * manually invoke `autoscalingGroup.addUserData()`. + * + * @default true + */ + readonly bootstrapEnabled?: boolean; + + /** + * Allows options for node bootstrapping through EC2 user data. + * @default - default options + */ + readonly bootstrapOptions?: BootstrapOptions; + + /** + * Allow options to specify different machine image type + * + * @default MachineImageType.AMAZON_LINUX_2 + */ + readonly machineImageType?: MachineImageType; + + /** + * Installs the AWS spot instance interrupt handler on the cluster if it's not + * already added. Only relevant if `spotPrice` is configured on the auto-scaling group. + * + * @default true + */ + readonly spotInterruptHandler?: boolean; +} + +/** + * Import a cluster to use in another stack + */ +class ImportedCluster extends ClusterBase { + public readonly clusterName: string; + public readonly clusterArn: string; + public readonly connections = new ec2.Connections(); + public readonly kubectlRole?: iam.IRole; + public readonly kubectlLambdaRole?: iam.IRole; + public readonly kubectlEnvironment?: { [key: string]: string; } | undefined; + public readonly kubectlSecurityGroup?: ec2.ISecurityGroup | undefined; + public readonly kubectlPrivateSubnets?: ec2.ISubnet[] | undefined; + public readonly kubectlLayer?: lambda.ILayerVersion; + public readonly awscliLayer?: lambda.ILayerVersion; + public readonly kubectlProvider?: IKubectlProvider; + public readonly onEventLayer?: lambda.ILayerVersion; + public readonly kubectlMemory?: Size; + public readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup | undefined; + public readonly prune: boolean; + + // so that `clusterSecurityGroup` on `ICluster` can be configured without optionality, avoiding users from having + // to null check on an instance of `Cluster`, which will always have this configured. + private readonly _clusterSecurityGroup?: ec2.ISecurityGroup; + + constructor(scope: Construct, id: string, private readonly props: ClusterAttributes) { + super(scope, id); + + this.clusterName = props.clusterName; + this.clusterArn = this.stack.formatArn(clusterArnComponents(props.clusterName)); + this.kubectlRole = props.kubectlRoleArn ? iam.Role.fromRoleArn(this, 'KubectlRole', props.kubectlRoleArn) : undefined; + this.kubectlLambdaRole = props.kubectlLambdaRole; + this.kubectlSecurityGroup = props.kubectlSecurityGroupId ? ec2.SecurityGroup.fromSecurityGroupId(this, 'KubectlSecurityGroup', props.kubectlSecurityGroupId) : undefined; + this.kubectlEnvironment = props.kubectlEnvironment; + this.kubectlPrivateSubnets = props.kubectlPrivateSubnetIds ? props.kubectlPrivateSubnetIds.map((subnetid, index) => ec2.Subnet.fromSubnetId(this, `KubectlSubnet${index}`, subnetid)) : undefined; + this.kubectlLayer = props.kubectlLayer; + this.awscliLayer = props.awscliLayer; + this.kubectlMemory = props.kubectlMemory; + this.clusterHandlerSecurityGroup = props.clusterHandlerSecurityGroupId ? ec2.SecurityGroup.fromSecurityGroupId(this, 'ClusterHandlerSecurityGroup', props.clusterHandlerSecurityGroupId) : undefined; + this.kubectlProvider = props.kubectlProvider; + this.onEventLayer = props.onEventLayer; + this.prune = props.prune ?? true; + + let i = 1; + for (const sgid of props.securityGroupIds ?? []) { + this.connections.addSecurityGroup(ec2.SecurityGroup.fromSecurityGroupId(this, `SecurityGroup${i}`, sgid)); + i++; + } + + if (props.clusterSecurityGroupId) { + this._clusterSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'ClusterSecurityGroup', this.clusterSecurityGroupId); + this.connections.addSecurityGroup(this._clusterSecurityGroup); + } + } + + public get vpc() { + if (!this.props.vpc) { + throw new Error('"vpc" is not defined for this imported cluster'); + } + return this.props.vpc; + } + + public get clusterSecurityGroup(): ec2.ISecurityGroup { + if (!this._clusterSecurityGroup) { + throw new Error('"clusterSecurityGroup" is not defined for this imported cluster'); + } + return this._clusterSecurityGroup; + } + + public get clusterSecurityGroupId(): string { + if (!this.props.clusterSecurityGroupId) { + throw new Error('"clusterSecurityGroupId" is not defined for this imported cluster'); + } + return this.props.clusterSecurityGroupId; + } + + public get clusterEndpoint(): string { + if (!this.props.clusterEndpoint) { + throw new Error('"clusterEndpoint" is not defined for this imported cluster'); + } + return this.props.clusterEndpoint; + } + + public get clusterCertificateAuthorityData(): string { + if (!this.props.clusterCertificateAuthorityData) { + throw new Error('"clusterCertificateAuthorityData" is not defined for this imported cluster'); + } + return this.props.clusterCertificateAuthorityData; + } + + public get clusterEncryptionConfigKeyArn(): string { + if (!this.props.clusterEncryptionConfigKeyArn) { + throw new Error('"clusterEncryptionConfigKeyArn" is not defined for this imported cluster'); + } + return this.props.clusterEncryptionConfigKeyArn; + } + + public get openIdConnectProvider(): iam.IOpenIdConnectProvider { + if (!this.props.openIdConnectProvider) { + throw new Error('"openIdConnectProvider" is not defined for this imported cluster'); + } + return this.props.openIdConnectProvider; + } + + public get awsAuth(): AwsAuth { + throw new Error('"awsAuth" is not supported on imported clusters'); + } +} + +/** + * Properties for EksOptimizedImage + */ +export interface EksOptimizedImageProps { + /** + * What instance type to retrieve the image for (standard or GPU-optimized) + * + * @default NodeType.STANDARD + */ + readonly nodeType?: NodeType; + + /** + * What cpu architecture to retrieve the image for (arm64 or x86_64) + * + * @default CpuArch.X86_64 + */ + readonly cpuArch?: CpuArch; + + /** + * The Kubernetes version to use + * + * @default - The latest version + */ + readonly kubernetesVersion?: string; +} + +/** + * Construct an Amazon Linux 2 image from the latest EKS Optimized AMI published in SSM + */ +export class EksOptimizedImage implements ec2.IMachineImage { + private readonly nodeType?: NodeType; + private readonly cpuArch?: CpuArch; + private readonly kubernetesVersion?: string; + private readonly amiParameterName: string; + + /** + * Constructs a new instance of the EcsOptimizedAmi class. + */ + public constructor(props: EksOptimizedImageProps = {}) { + this.nodeType = props.nodeType ?? NodeType.STANDARD; + this.cpuArch = props.cpuArch ?? CpuArch.X86_64; + this.kubernetesVersion = props.kubernetesVersion ?? LATEST_KUBERNETES_VERSION; + + // set the SSM parameter name + this.amiParameterName = `/aws/service/eks/optimized-ami/${this.kubernetesVersion}/` + + (this.nodeType === NodeType.STANDARD ? this.cpuArch === CpuArch.X86_64 ? + 'amazon-linux-2/' : 'amazon-linux-2-arm64/' : '') + + (this.nodeType === NodeType.GPU ? 'amazon-linux-2-gpu/' : '') + + (this.nodeType === NodeType.INFERENTIA ? 'amazon-linux-2-gpu/' : '') + + 'recommended/image_id'; + } + + /** + * Return the correct image + */ + public getImage(scope: Construct): ec2.MachineImageConfig { + const ami = ssm.StringParameter.valueForStringParameter(scope, this.amiParameterName); + return { + imageId: ami, + osType: ec2.OperatingSystemType.LINUX, + userData: ec2.UserData.forLinux(), + }; + } +} + +// MAINTAINERS: use ./scripts/kube_bump.sh to update LATEST_KUBERNETES_VERSION +const LATEST_KUBERNETES_VERSION = '1.24'; + +/** + * Whether the worker nodes should support GPU or just standard instances + */ +export enum NodeType { + /** + * Standard instances + */ + STANDARD = 'Standard', + + /** + * GPU instances + */ + GPU = 'GPU', + + /** + * Inferentia instances + */ + INFERENTIA = 'INFERENTIA', +} + +/** + * CPU architecture + */ +export enum CpuArch { + /** + * arm64 CPU type + */ + ARM_64 = 'arm64', + + /** + * x86_64 CPU type + */ + X86_64 = 'x86_64', +} + +/** + * The type of compute resources to use for CoreDNS. + */ +export enum CoreDnsComputeType { + /** + * Deploy CoreDNS on EC2 instances. + */ + EC2 = 'ec2', + + /** + * Deploy CoreDNS on Fargate-managed instances. + */ + FARGATE = 'fargate', +} + +/** + * The default capacity type for the cluster + */ +export enum DefaultCapacityType { + /** + * managed node group + */ + NODEGROUP, + /** + * EC2 autoscaling group + */ + EC2, +} + +/** + * The machine image type + */ +export enum MachineImageType { + /** + * Amazon EKS-optimized Linux AMI + */ + AMAZON_LINUX_2, + /** + * Bottlerocket AMI + */ + BOTTLEROCKET, +} + +function nodeTypeForInstanceType(instanceType: ec2.InstanceType) { + return INSTANCE_TYPES.gpu.includes(instanceType.toString().substring(0, 2)) ? NodeType.GPU : + INSTANCE_TYPES.inferentia.includes(instanceType.toString().substring(0, 4)) ? NodeType.INFERENTIA : + NodeType.STANDARD; +} + +function cpuArchForInstanceType(instanceType: ec2.InstanceType) { + return INSTANCE_TYPES.graviton2.includes(instanceType.toString().substring(0, 3)) ? CpuArch.ARM_64 : + INSTANCE_TYPES.graviton3.includes(instanceType.toString().substring(0, 3)) ? CpuArch.ARM_64 : + INSTANCE_TYPES.graviton.includes(instanceType.toString().substring(0, 2)) ? CpuArch.ARM_64 : + CpuArch.X86_64; +} + +function flatten
(xss: A[][]): A[] { + return Array.prototype.concat.call([], ...xss); +} diff --git a/packages/@aws-cdk/aws-eks/lib/fargate-cluster.ts b/packages/aws-cdk-lib/aws-eks/lib/fargate-cluster.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/fargate-cluster.ts rename to packages/aws-cdk-lib/aws-eks/lib/fargate-cluster.ts diff --git a/packages/@aws-cdk/aws-eks/lib/fargate-profile.ts b/packages/aws-cdk-lib/aws-eks/lib/fargate-profile.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/lib/fargate-profile.ts rename to packages/aws-cdk-lib/aws-eks/lib/fargate-profile.ts index 8d2c9de6f97e6..db753ce283e8d 100644 --- a/packages/@aws-cdk/aws-eks/lib/fargate-profile.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/fargate-profile.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Annotations, CustomResource, ITaggable, Lazy, TagManager, TagType } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import { Annotations, CustomResource, ITaggable, Lazy, TagManager, TagType } from '../../core'; import { Construct } from 'constructs'; import { Cluster } from './cluster'; import { FARGATE_PROFILE_RESOURCE_TYPE } from './cluster-resource-handler/consts'; diff --git a/packages/@aws-cdk/aws-eks/lib/helm-chart.ts b/packages/aws-cdk-lib/aws-eks/lib/helm-chart.ts similarity index 97% rename from packages/@aws-cdk/aws-eks/lib/helm-chart.ts rename to packages/aws-cdk-lib/aws-eks/lib/helm-chart.ts index 40e062ff157bd..a8ea30baa43ae 100644 --- a/packages/@aws-cdk/aws-eks/lib/helm-chart.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/helm-chart.ts @@ -1,5 +1,5 @@ -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { CustomResource, Duration, Names, Stack } from '@aws-cdk/core'; +import { Asset } from '../../aws-s3-assets'; +import { CustomResource, Duration, Names, Stack } from '../../core'; import { Construct } from 'constructs'; import { ICluster } from './cluster'; import { KubectlProvider } from './kubectl-provider'; diff --git a/packages/@aws-cdk/aws-eks/lib/index.ts b/packages/aws-cdk-lib/aws-eks/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/index.ts rename to packages/aws-cdk-lib/aws-eks/lib/index.ts diff --git a/packages/@aws-cdk/aws-eks/lib/instance-types.ts b/packages/aws-cdk-lib/aws-eks/lib/instance-types.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/lib/instance-types.ts rename to packages/aws-cdk-lib/aws-eks/lib/instance-types.ts diff --git a/packages/@aws-cdk/aws-eks/lib/k8s-manifest.ts b/packages/aws-cdk-lib/aws-eks/lib/k8s-manifest.ts similarity index 99% rename from packages/@aws-cdk/aws-eks/lib/k8s-manifest.ts rename to packages/aws-cdk-lib/aws-eks/lib/k8s-manifest.ts index 60a9fb7209790..3354f9b288026 100644 --- a/packages/@aws-cdk/aws-eks/lib/k8s-manifest.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/k8s-manifest.ts @@ -1,4 +1,4 @@ -import { CustomResource, Stack } from '@aws-cdk/core'; +import { CustomResource, Stack } from '../../core'; import { Construct, Node } from 'constructs'; import { AlbScheme } from './alb-controller'; import { ICluster } from './cluster'; diff --git a/packages/@aws-cdk/aws-eks/lib/k8s-object-value.ts b/packages/aws-cdk-lib/aws-eks/lib/k8s-object-value.ts similarity index 97% rename from packages/@aws-cdk/aws-eks/lib/k8s-object-value.ts rename to packages/aws-cdk-lib/aws-eks/lib/k8s-object-value.ts index 6234aa6efc6ac..843cf5272d0da 100644 --- a/packages/@aws-cdk/aws-eks/lib/k8s-object-value.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/k8s-object-value.ts @@ -1,4 +1,4 @@ -import { CustomResource, Token, Duration } from '@aws-cdk/core'; +import { CustomResource, Token, Duration } from '../../core'; import { Construct } from 'constructs'; import { ICluster } from './cluster'; import { KubectlProvider } from './kubectl-provider'; diff --git a/packages/@aws-cdk/aws-eks/lib/k8s-patch.ts b/packages/aws-cdk-lib/aws-eks/lib/k8s-patch.ts similarity index 97% rename from packages/@aws-cdk/aws-eks/lib/k8s-patch.ts rename to packages/aws-cdk-lib/aws-eks/lib/k8s-patch.ts index 7d99bd3b6a428..866baf2a9113c 100644 --- a/packages/@aws-cdk/aws-eks/lib/k8s-patch.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/k8s-patch.ts @@ -1,4 +1,4 @@ -import { CustomResource, Stack } from '@aws-cdk/core'; +import { CustomResource, Stack } from '../../core'; import { Construct } from 'constructs'; import { ICluster } from './cluster'; import { KubectlProvider } from './kubectl-provider'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py b/packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/apply/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/apply/__init__.py rename to packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/apply/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py b/packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/get/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/get/__init__.py rename to packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/get/__init__.py diff --git a/packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py b/packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/helm/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-eks/test/integ.eks-helm-asset.js.snapshot/asset.92ea03f8b2e779503519f7781d06c03f95b46863db85f5c50a4e7debfd04be02/helm/__init__.py rename to packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/helm/__init__.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py b/packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/index.py rename to packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py b/packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/patch/__init__.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.c17e6c5822dd39738b3ba669bef4bb7c8fceaea76b51477bf94d6745d0c201c8/patch/__init__.py rename to packages/aws-cdk-lib/aws-eks/lib/kubectl-handler/patch/__init__.py diff --git a/packages/@aws-cdk/aws-eks/lib/kubectl-provider.ts b/packages/aws-cdk-lib/aws-eks/lib/kubectl-provider.ts similarity index 95% rename from packages/@aws-cdk/aws-eks/lib/kubectl-provider.ts rename to packages/aws-cdk-lib/aws-eks/lib/kubectl-provider.ts index 1c6236615dcd5..f373d3e07b4c1 100644 --- a/packages/@aws-cdk/aws-eks/lib/kubectl-provider.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/kubectl-provider.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, Stack, NestedStack, Names } from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; -import { AwsCliLayer } from '@aws-cdk/lambda-layer-awscli'; -import { KubectlLayer } from '@aws-cdk/lambda-layer-kubectl'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import { Duration, Stack, NestedStack, Names } from '../../core'; +import * as cr from '../../custom-resources'; +import { AwsCliLayer } from '../../lambda-layer-awscli'; +import { KubectlLayer } from '../../lambda-layer-kubectl'; import { Construct, IConstruct } from 'constructs'; import { ICluster, Cluster } from './cluster'; diff --git a/packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts similarity index 99% rename from packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts rename to packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts index 95963e0b5dc64..7d02c2c3c6f08 100644 --- a/packages/@aws-cdk/aws-eks/lib/managed-nodegroup.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/managed-nodegroup.ts @@ -1,6 +1,6 @@ -import { InstanceType, ISecurityGroup, SubnetSelection, InstanceArchitecture } from '@aws-cdk/aws-ec2'; -import { IRole, ManagedPolicy, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IResource, Resource, Annotations, withResolved } from '@aws-cdk/core'; +import { InstanceType, ISecurityGroup, SubnetSelection, InstanceArchitecture } from '../../aws-ec2'; +import { IRole, ManagedPolicy, Role, ServicePrincipal } from '../../aws-iam'; +import { IResource, Resource, Annotations, withResolved } from '../../core'; import { Construct, Node } from 'constructs'; import { Cluster, ICluster } from './cluster'; import { CfnNodegroup } from './eks.generated'; diff --git a/packages/aws-cdk-lib/aws-eks/lib/oidc-provider.ts b/packages/aws-cdk-lib/aws-eks/lib/oidc-provider.ts new file mode 100644 index 0000000000000..b46d38673ea01 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/lib/oidc-provider.ts @@ -0,0 +1,52 @@ +import * as iam from '../../aws-iam'; +import { Construct } from 'constructs'; + +/** + * Initialization properties for `OpenIdConnectProvider`. + */ +export interface OpenIdConnectProviderProps { + /** + * The URL of the identity provider. The URL must begin with https:// and + * should correspond to the iss claim in the provider's OpenID Connect ID + * tokens. Per the OIDC standard, path components are allowed but query + * parameters are not. Typically the URL consists of only a hostname, like + * https://server.example.org or https://example.com. + * + * You can find your OIDC Issuer URL by: + * aws eks describe-cluster --name %cluster_name% --query "cluster.identity.oidc.issuer" --output text + */ + readonly url: string; +} + +/** + * IAM OIDC identity providers are entities in IAM that describe an external + * identity provider (IdP) service that supports the OpenID Connect (OIDC) + * standard, such as Google or Salesforce. You use an IAM OIDC identity provider + * when you want to establish trust between an OIDC-compatible IdP and your AWS + * account. + * + * This implementation has default values for thumbprints and clientIds props + * that will be compatible with the eks cluster + * + * @see http://openid.net/connect + * @see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html + * + * @resource AWS::CloudFormation::CustomResource + */ +export class OpenIdConnectProvider extends iam.OpenIdConnectProvider { + /** + * Defines an OpenID Connect provider. + * @param scope The definition scope + * @param id Construct ID + * @param props Initialization properties + */ + public constructor(scope: Construct, id: string, props: OpenIdConnectProviderProps) { + + const clientIds = ['sts.amazonaws.com']; + + super(scope, id, { + url: props.url, + clientIds, + }); + } +} diff --git a/packages/@aws-cdk/aws-eks/lib/private/bottlerocket.ts b/packages/aws-cdk-lib/aws-eks/lib/private/bottlerocket.ts similarity index 93% rename from packages/@aws-cdk/aws-eks/lib/private/bottlerocket.ts rename to packages/aws-cdk-lib/aws-eks/lib/private/bottlerocket.ts index 952b308d7e160..08ef0583f704e 100644 --- a/packages/@aws-cdk/aws-eks/lib/private/bottlerocket.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/private/bottlerocket.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ssm from '@aws-cdk/aws-ssm'; +import * as ec2 from '../../../aws-ec2'; +import * as ssm from '../../../aws-ssm'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-eks/lib/service-account.ts b/packages/aws-cdk-lib/aws-eks/lib/service-account.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/lib/service-account.ts rename to packages/aws-cdk-lib/aws-eks/lib/service-account.ts index 7b66d139ce601..b27faaa360712 100644 --- a/packages/@aws-cdk/aws-eks/lib/service-account.ts +++ b/packages/aws-cdk-lib/aws-eks/lib/service-account.ts @@ -1,5 +1,5 @@ -import { AddToPrincipalPolicyResult, IPrincipal, IRole, OpenIdConnectPrincipal, PolicyStatement, PrincipalPolicyFragment, Role } from '@aws-cdk/aws-iam'; -import { CfnJson, Names } from '@aws-cdk/core'; +import { AddToPrincipalPolicyResult, IPrincipal, IRole, OpenIdConnectPrincipal, PolicyStatement, PrincipalPolicyFragment, Role } from '../../aws-iam'; +import { CfnJson, Names } from '../../core'; import { Construct } from 'constructs'; import { ICluster } from './cluster'; import { KubernetesManifest } from './k8s-manifest'; diff --git a/packages/aws-cdk-lib/aws-eks/lib/user-data.ts b/packages/aws-cdk-lib/aws-eks/lib/user-data.ts new file mode 100644 index 0000000000000..7a280571d5358 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/lib/user-data.ts @@ -0,0 +1,90 @@ +import * as autoscaling from '../../aws-autoscaling'; +import { Stack } from '../../core'; +import { BootstrapOptions, ICluster } from './cluster'; + +// eslint-disable-next-line max-len +export function renderAmazonLinuxUserData(cluster: ICluster, autoScalingGroup: autoscaling.AutoScalingGroup, options: BootstrapOptions = {}): string[] { + + const stack = Stack.of(autoScalingGroup); + + // determine logical id of ASG so we can signal cloudformation + const cfn = autoScalingGroup.node.defaultChild as autoscaling.CfnAutoScalingGroup; + const asgLogicalId = cfn.logicalId; + + const extraArgs = new Array(); + + try { + const clusterEndpoint = cluster.clusterEndpoint; + const clusterCertificateAuthorityData = + cluster.clusterCertificateAuthorityData; + extraArgs.push(`--apiserver-endpoint '${clusterEndpoint}'`); + extraArgs.push(`--b64-cluster-ca '${clusterCertificateAuthorityData}'`); + } catch (e) { + /** + * Errors are ignored here. + * apiserver-endpoint and b64-cluster-ca arguments are added in #12659 to make nodes join the cluster faster. + * As these are not necessary arguments, we don't need to pass these arguments when they don't exist. + * + * @see https://github.com/aws/aws-cdk/pull/12659 + */ + } + + extraArgs.push(`--use-max-pods ${options.useMaxPods ?? true}`); + + if (options.awsApiRetryAttempts) { + extraArgs.push(`--aws-api-retry-attempts ${options.awsApiRetryAttempts}`); + } + + if (options.enableDockerBridge) { + extraArgs.push('--enable-docker-bridge true'); + } + + if (options.dockerConfigJson) { + extraArgs.push(`--docker-config-json '${options.dockerConfigJson}'`); + } + + if (options.dnsClusterIp) { + extraArgs.push(`--dns-cluster-ip ${options.dnsClusterIp}`); + } + + if (options.additionalArgs) { + extraArgs.push(options.additionalArgs); + } + + const commandLineSuffix = extraArgs.join(' '); + const kubeletExtraArgsSuffix = options.kubeletExtraArgs || ''; + + // determine lifecycle label based on whether the ASG has a spot price. + const lifecycleLabel = autoScalingGroup.spotPrice ? LifecycleLabel.SPOT : LifecycleLabel.ON_DEMAND; + const withTaints = autoScalingGroup.spotPrice ? '--register-with-taints=spotInstance=true:PreferNoSchedule' : ''; + const kubeletExtraArgs = `--node-labels lifecycle=${lifecycleLabel} ${withTaints} ${kubeletExtraArgsSuffix}`.trim(); + + return [ + 'set -o xtrace', + `/etc/eks/bootstrap.sh ${cluster.clusterName} --kubelet-extra-args "${kubeletExtraArgs}" ${commandLineSuffix}`.trim(), + `/opt/aws/bin/cfn-signal --exit-code $? --stack ${stack.stackName} --resource ${asgLogicalId} --region ${stack.region}`, + ]; +} + +export function renderBottlerocketUserData(cluster: ICluster): string[] { + return [ + '[settings.kubernetes]', + `api-server="${cluster.clusterEndpoint}"`, + `cluster-certificate="${cluster.clusterCertificateAuthorityData}"`, + `cluster-name="${cluster.clusterName}"`, + ]; +} + +/** + * The lifecycle label for node selector + */ +export enum LifecycleLabel { + /** + * on-demand instances + */ + ON_DEMAND = 'OnDemand', + /** + * spot instances + */ + SPOT = 'Ec2Spot' +} diff --git a/packages/@aws-cdk/aws-eks/scripts/kube_bump.sh b/packages/aws-cdk-lib/aws-eks/scripts/kube_bump.sh similarity index 100% rename from packages/@aws-cdk/aws-eks/scripts/kube_bump.sh rename to packages/aws-cdk-lib/aws-eks/scripts/kube_bump.sh diff --git a/packages/@aws-cdk/aws-eks/test/MANUAL_TEST.md b/packages/aws-cdk-lib/aws-eks/test/MANUAL_TEST.md similarity index 100% rename from packages/@aws-cdk/aws-eks/test/MANUAL_TEST.md rename to packages/aws-cdk-lib/aws-eks/test/MANUAL_TEST.md diff --git a/packages/@aws-cdk/aws-eks/test/alb-controller.test.ts b/packages/aws-cdk-lib/aws-eks/test/alb-controller.test.ts similarity index 95% rename from packages/@aws-cdk/aws-eks/test/alb-controller.test.ts rename to packages/aws-cdk-lib/aws-eks/test/alb-controller.test.ts index 191a791316c62..4eb5c6d317f96 100644 --- a/packages/@aws-cdk/aws-eks/test/alb-controller.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/alb-controller.test.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; import { testFixture } from './util'; import { Cluster, KubernetesVersion, AlbController, AlbControllerVersion, HelmChart } from '../lib'; diff --git a/packages/@aws-cdk/aws-eks/test/awsauth.test.ts b/packages/aws-cdk-lib/aws-eks/test/awsauth.test.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/test/awsauth.test.ts rename to packages/aws-cdk-lib/aws-eks/test/awsauth.test.ts index fd8a3ef357870..9bd996210c421 100644 --- a/packages/@aws-cdk/aws-eks/test/awsauth.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/awsauth.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { testFixtureNoVpc } from './util'; import { Cluster, KubernetesManifest, KubernetesVersion } from '../lib'; import { AwsAuth } from '../lib/aws-auth'; diff --git a/packages/aws-cdk-lib/aws-eks/test/bucket-pinger/bucket-pinger.ts b/packages/aws-cdk-lib/aws-eks/test/bucket-pinger/bucket-pinger.ts new file mode 100644 index 0000000000000..3bc2cbab063f3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/bucket-pinger/bucket-pinger.ts @@ -0,0 +1,49 @@ +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import { CustomResource, Token, Duration } from '../../../core'; +import * as cr from '../../../custom-resources'; +import { Construct } from 'constructs'; + +export interface BucketPingerProps { + readonly bucketName: string; + readonly timeout?: Duration; +} +export class BucketPinger extends Construct { + + private _resource: CustomResource; + + constructor(scope: Construct, id: string, props: BucketPingerProps) { + super(scope, id); + + const func = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(`${__dirname}/function`), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + timeout: props.timeout ?? Duration.minutes(1), + environment: { + BUCKET_NAME: props.bucketName, + }, + }); + + if (!func.role) { + throw new Error('pinger lambda has no execution role!'); + } + + func.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['s3:DeleteBucket', 's3:ListBucket'], + resources: [`arn:aws:s3:::${props.bucketName}`], + })); + + const provider = new cr.Provider(this, 'Provider', { + onEventHandler: func, + }); + + this._resource = new CustomResource(this, 'Resource', { + serviceToken: provider.serviceToken, + }); + } + + public get response() { + return Token.asString(this._resource.getAtt('Value')); + } +} diff --git a/packages/aws-cdk-lib/aws-eks/test/bucket-pinger/function/index.py b/packages/aws-cdk-lib/aws-eks/test/bucket-pinger/function/index.py new file mode 100644 index 0000000000000..d12e185a0634e --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/bucket-pinger/function/index.py @@ -0,0 +1,38 @@ +import json +import logging +import boto3 +import time +import os + +logger = logging.getLogger() +logger.setLevel(logging.INFO) + +def handler(event, context): + print(json.dumps(event)) + + request_type = event['RequestType'] + props = event['ResourceProperties'] + + s3_bucket_name = os.environ['BUCKET_NAME'] + s3 = boto3.client('s3') + + if request_type in ['Create', 'Update']: + logger.info(f'making sdk call to check if bucket with name {s3_bucket_name} exists') + while (True): # lambda will eventually time this out in case of consistent failures + try: + s3.head_bucket(Bucket=s3_bucket_name) + return {'Data': {'Value': f'confirmed that bucket with name {s3_bucket_name} exists' }} + except Exception as error: + logger.error(f'failed to head bucket with error: {str(error)}') + time.sleep(5) + + + elif request_type == 'Delete': + logger.info(f'making sdk call to delete bucket with name {s3_bucket_name}') + + try: + s3.delete_bucket(Bucket=s3_bucket_name) + except Exception as error: + # If the bucket does not exist, then this error will be thrown + raise RuntimeError(f'failed to delete bucket: {str(error)}') + return {'Data': {'Value': f'bucket with name {s3_bucket_name} has been deleted' }} diff --git a/packages/@aws-cdk/aws-eks/test/cluster-resource-handler-mocks.ts b/packages/aws-cdk-lib/aws-eks/test/cluster-resource-handler-mocks.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/cluster-resource-handler-mocks.ts rename to packages/aws-cdk-lib/aws-eks/test/cluster-resource-handler-mocks.ts diff --git a/packages/@aws-cdk/aws-eks/test/cluster-resource-provider.test.ts b/packages/aws-cdk-lib/aws-eks/test/cluster-resource-provider.test.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/cluster-resource-provider.test.ts rename to packages/aws-cdk-lib/aws-eks/test/cluster-resource-provider.test.ts diff --git a/packages/aws-cdk-lib/aws-eks/test/cluster.test.ts b/packages/aws-cdk-lib/aws-eks/test/cluster.test.ts new file mode 100644 index 0000000000000..d1cad6c024878 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/cluster.test.ts @@ -0,0 +1,3190 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import { Annotations, Match, Template } from '../../assertions'; +import * as asg from '../../aws-autoscaling'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; +import * as cdk8s from 'cdk8s'; +import { Construct } from 'constructs'; +import * as YAML from 'yaml'; +import { testFixture, testFixtureNoVpc } from './util'; +import * as eks from '../lib'; +import { HelmChart } from '../lib'; +import { KubectlProvider } from '../lib/kubectl-provider'; +import { BottleRocketImage } from '../lib/private/bottlerocket'; + +/* eslint-disable max-len */ + +const CLUSTER_VERSION = eks.KubernetesVersion.V1_25; + +describe('cluster', () => { + test('can configure and access ALB controller', () => { + const { stack } = testFixture(); + + const cluster = new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + albController: { + version: eks.AlbControllerVersion.V2_4_1, + }, + }); + + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-HelmChart', { + Chart: 'aws-load-balancer-controller', + }); + expect(cluster.albController).toBeDefined(); + }); + + test('can specify custom environment to cluster resource handler', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + clusterHandlerEnvironment: { + foo: 'bar', + }, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; + + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + Environment: { Variables: { foo: 'bar' } }, + }); + }); + + test('can specify security group to cluster resource handler', () => { + const { stack, vpc } = testFixture(); + const securityGroup = new ec2.SecurityGroup(stack, 'ProxyInstanceSG', { + vpc, + allowAllOutbound: false, + }); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + placeClusterHandlerInVpc: true, + clusterHandlerSecurityGroup: securityGroup, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; + + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { + SecurityGroupIds: [{ Ref: 'referencetoStackProxyInstanceSG80B79D87GroupId' }], + }, + }); + }); + + test('throws when trying to place cluster handlers in a vpc with no private subnets', () => { + const { stack } = testFixture(); + + const vpc = new ec2.Vpc(stack, 'Vpc'); + + expect(() => { + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + placeClusterHandlerInVpc: true, + vpc: vpc, + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], + }); + }).toThrow(/Cannot place cluster handler in the VPC since no private subnets could be selected/); + }); + + test('throws when provided `clusterHandlerSecurityGroup` without `placeClusterHandlerInVpc: true`', () => { + const { stack, vpc } = testFixture(); + const securityGroup = new ec2.SecurityGroup(stack, 'ProxyInstanceSG', { + vpc, + allowAllOutbound: false, + }); + + expect(() => { + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + clusterHandlerSecurityGroup: securityGroup, + }); + }).toThrow(/Cannot specify clusterHandlerSecurityGroup without placeClusterHandlerInVpc set to true/); + }); + + describe('imported Vpc from unparseable list tokens', () => { + let stack: cdk.Stack; + let vpc: ec2.IVpc; + + beforeEach(() => { + stack = new cdk.Stack(); + const vpcId = cdk.Fn.importValue('myVpcId'); + const availabilityZones = cdk.Fn.split(',', cdk.Fn.importValue('myAvailabilityZones')); + const publicSubnetIds = cdk.Fn.split(',', cdk.Fn.importValue('myPublicSubnetIds')); + const privateSubnetIds = cdk.Fn.split(',', cdk.Fn.importValue('myPrivateSubnetIds')); + const isolatedSubnetIds = cdk.Fn.split(',', cdk.Fn.importValue('myIsolatedSubnetIds')); + + vpc = ec2.Vpc.fromVpcAttributes(stack, 'importedVpc', { + vpcId, + availabilityZones, + publicSubnetIds, + privateSubnetIds, + isolatedSubnetIds, + }); + }); + + test('throws if selecting more than one subnet group', () => { + expect(() => new eks.Cluster(stack, 'Cluster', { + vpc: vpc, + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }], + defaultCapacity: 0, + version: eks.KubernetesVersion.V1_21, + })).toThrow(/cannot select multiple subnet groups/); + }); + + test('synthesis works if only one subnet group is selected', () => { + // WHEN + new eks.Cluster(stack, 'Cluster', { + vpc: vpc, + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], + defaultCapacity: 0, + version: eks.KubernetesVersion.V1_21, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { + Config: { + resourcesVpcConfig: { + subnetIds: { + 'Fn::Split': [ + ',', + { 'Fn::ImportValue': 'myPublicSubnetIds' }, + ], + }, + }, + }, + }); + }); + }); + + test('throws when accessing cluster security group for imported cluster without cluster security group id', () => { + const { stack } = testFixture(); + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + }); + + expect(() => cluster.clusterSecurityGroup).toThrow(/"clusterSecurityGroup" is not defined for this imported cluster/); + }); + + test('can place cluster handlers in the cluster vpc', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + placeClusterHandlerInVpc: true, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; + const template = Template.fromStack(nested); + const resources = template.findResources('AWS::Lambda::Function'); + + function assertFunctionPlacedInVpc(id: string) { + expect(resources[id].Properties.VpcConfig.SubnetIds).toEqual([ + { Ref: 'referencetoStackClusterDefaultVpcPrivateSubnet1SubnetA64D1BF0Ref' }, + { Ref: 'referencetoStackClusterDefaultVpcPrivateSubnet2Subnet32D85AB8Ref' }, + ]); + } + + assertFunctionPlacedInVpc('OnEventHandler42BEBAE0'); + assertFunctionPlacedInVpc('IsCompleteHandler7073F4DA'); + assertFunctionPlacedInVpc('ProviderframeworkonEvent83C1D0A7'); + assertFunctionPlacedInVpc('ProviderframeworkisComplete26D7B0CB'); + assertFunctionPlacedInVpc('ProviderframeworkonTimeout0B47CA38'); + }); + + test('can access cluster security group for imported cluster with cluster security group id', () => { + const { stack } = testFixture(); + + const clusterSgId = 'cluster-sg-id'; + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + clusterSecurityGroupId: clusterSgId, + }); + + const clusterSg = cluster.clusterSecurityGroup; + + expect(clusterSg.securityGroupId).toEqual(clusterSgId); + }); + + test('cluster security group is attached when adding self-managed nodes', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('self-managed', { + instanceType: new ec2.InstanceType('t2.medium'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + SecurityGroups: [ + { 'Fn::GetAtt': ['ClusterselfmanagedInstanceSecurityGroup64468C3A', 'GroupId'] }, + { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, + ], + }); + }); + + test('security group of self-managed asg is not tagged with owned', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + version: CLUSTER_VERSION, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('self-managed', { + instanceType: new ec2.InstanceType('t2.medium'), + }); + + let template = Template.fromStack(stack); + template.hasResourceProperties('AWS::EC2::SecurityGroup', { + Tags: [{ Key: 'Name', Value: 'Stack/Cluster/self-managed' }], + }); + }); + + test('connect autoscaling group with imported cluster', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + const importedCluster = eks.Cluster.fromClusterAttributes(stack, 'ImportedCluster', { + clusterName: cluster.clusterName, + clusterSecurityGroupId: cluster.clusterSecurityGroupId, + }); + + const selfManaged = new asg.AutoScalingGroup(stack, 'self-managed', { + instanceType: new ec2.InstanceType('t2.medium'), + vpc: vpc, + machineImage: new ec2.AmazonLinuxImage(), + }); + + // WHEN + importedCluster.connectAutoScalingGroupCapacity(selfManaged, {}); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + SecurityGroups: [ + { 'Fn::GetAtt': ['selfmanagedInstanceSecurityGroupEA6D80C9', 'GroupId'] }, + { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, + ], + }); + }); + + test('cluster security group is attached when connecting self-managed nodes', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + const selfManaged = new asg.AutoScalingGroup(stack, 'self-managed', { + instanceType: new ec2.InstanceType('t2.medium'), + vpc: vpc, + machineImage: new ec2.AmazonLinuxImage(), + }); + + // WHEN + cluster.connectAutoScalingGroupCapacity(selfManaged, {}); + + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::LaunchConfiguration', { + SecurityGroups: [ + { 'Fn::GetAtt': ['selfmanagedInstanceSecurityGroupEA6D80C9', 'GroupId'] }, + { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, + ], + }); + }); + + test('spot interrupt handler is not added if spotInterruptHandler is false when connecting self-managed nodes', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + const selfManaged = new asg.AutoScalingGroup(stack, 'self-managed', { + instanceType: new ec2.InstanceType('t2.medium'), + vpc: vpc, + machineImage: new ec2.AmazonLinuxImage(), + spotPrice: '0.1', + }); + + // WHEN + cluster.connectAutoScalingGroupCapacity(selfManaged, { spotInterruptHandler: false }); + + expect(cluster.node.findAll().filter(c => c.node.id === 'chart-spot-interrupt-handler').length).toEqual(0); + }); + + test('throws when a non cdk8s chart construct is added as cdk8s chart', () => { + const { stack } = testFixture(); + + const cluster = new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + + // create a plain construct, not a cdk8s chart + const someConstruct = new Construct(stack, 'SomeConstruct'); + + expect(() => cluster.addCdk8sChart('chart', someConstruct)).toThrow(/Invalid cdk8s chart. Must contain a \'toJson\' method, but found undefined/); + }); + + test('throws when a core construct is added as cdk8s chart', () => { + const { stack } = testFixture(); + + const cluster = new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + + // create a plain construct, not a cdk8s chart + const someConstruct = new Construct(stack, 'SomeConstruct'); + + expect(() => cluster.addCdk8sChart('chart', someConstruct)).toThrow(/Invalid cdk8s chart. Must contain a \'toJson\' method, but found undefined/); + }); + + test('cdk8s chart can be added to cluster', () => { + const { stack } = testFixture(); + + const cluster = new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + + const app = new cdk8s.App(); + const chart = new cdk8s.Chart(app, 'Chart'); + + new cdk8s.ApiObject(chart, 'FakePod', { + apiVersion: 'v1', + kind: 'Pod', + metadata: { + name: 'fake-pod', + labels: { + // adding aws-cdk token to cdk8s chart + clusterName: cluster.clusterName, + }, + }, + }); + + cluster.addCdk8sChart('cdk8s-chart', chart); + + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesResource', { + Manifest: { + 'Fn::Join': [ + '', + [ + '[{"apiVersion":"v1","kind":"Pod","metadata":{"labels":{"clusterName":"', + { + Ref: 'Cluster9EE0221C', + }, + '"},"name":"fake-pod"}}]', + ], + ], + }, + }); + }); + + test('cluster connections include both control plane and cluster security group', () => { + const { stack } = testFixture(); + + const cluster = new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + + expect(cluster.connections.securityGroups.map(sg => stack.resolve(sg.securityGroupId))).toEqual([ + { 'Fn::GetAtt': ['Cluster9EE0221C', 'ClusterSecurityGroupId'] }, + { 'Fn::GetAtt': ['ClusterControlPlaneSecurityGroupD274242C', 'GroupId'] }, + ]); + }); + + test('can declare a security group from a different stack', () => { + class ClusterStack extends cdk.Stack { + public eksCluster: eks.Cluster; + + constructor(scope: Construct, id: string, props: { sg: ec2.ISecurityGroup, vpc: ec2.IVpc }) { + super(scope, id); + this.eksCluster = new eks.Cluster(this, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + securityGroup: props.sg, + vpc: props.vpc, + }); + } + } + + class NetworkStack extends cdk.Stack { + public readonly securityGroup: ec2.ISecurityGroup; + public readonly vpc: ec2.IVpc; + + constructor(scope: Construct, id: string) { + super(scope, id); + this.vpc = new ec2.Vpc(this, 'Vpc'); + this.securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc: this.vpc }); + } + } + + const { app } = testFixture(); + const networkStack = new NetworkStack(app, 'NetworkStack'); + new ClusterStack(app, 'ClusterStack', { sg: networkStack.securityGroup, vpc: networkStack.vpc }); + + // make sure we can synth (no circular dependencies between the stacks) + app.synth(); + }); + + test('can declare a manifest with a token from a different stack than the cluster that depends on the cluster stack', () => { + class ClusterStack extends cdk.Stack { + public eksCluster: eks.Cluster; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.eksCluster = new eks.Cluster(this, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + } + } + + class ManifestStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { + super(scope, id, props); + + // this role creates a dependency between this stack and the cluster stack + const role = new iam.Role(this, 'CrossRole', { + assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), + roleName: props.cluster.clusterArn, + }); + + // make sure this manifest doesn't create a dependency between the cluster stack + // and this stack + new eks.KubernetesManifest(this, 'cross-stack', { + manifest: [{ + kind: 'ConfigMap', + apiVersion: 'v1', + metadata: { + name: 'config-map', + }, + data: { + foo: role.roleArn, + }, + }], + cluster: props.cluster, + }); + } + } + + const { app } = testFixture(); + const clusterStack = new ClusterStack(app, 'ClusterStack'); + new ManifestStack(app, 'ManifestStack', { cluster: clusterStack.eksCluster }); + + // make sure we can synth (no circular dependencies between the stacks) + app.synth(); + }); + + test('can declare a chart with a token from a different stack than the cluster that depends on the cluster stack', () => { + class ClusterStack extends cdk.Stack { + public eksCluster: eks.Cluster; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.eksCluster = new eks.Cluster(this, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + } + } + + class ChartStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { + super(scope, id, props); + + // this role creates a dependency between this stack and the cluster stack + const role = new iam.Role(this, 'CrossRole', { + assumedBy: new iam.ServicePrincipal('sqs.amazonaws.com'), + roleName: props.cluster.clusterArn, + }); + + // make sure this chart doesn't create a dependency between the cluster stack + // and this stack + new eks.HelmChart(this, 'cross-stack', { + chart: role.roleArn, + cluster: props.cluster, + }); + } + } + + const { app } = testFixture(); + const clusterStack = new ClusterStack(app, 'ClusterStack'); + new ChartStack(app, 'ChartStack', { cluster: clusterStack.eksCluster }); + + // make sure we can synth (no circular dependencies between the stacks) + app.synth(); + }); + + test('can declare a HelmChart in a different stack than the cluster', () => { + class ClusterStack extends cdk.Stack { + public eksCluster: eks.Cluster; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.eksCluster = new eks.Cluster(this, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + } + } + + class ChartStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { + super(scope, id, props); + + const resource = new cdk.CfnResource(this, 'resource', { type: 'MyType' }); + new eks.HelmChart(this, `chart-${id}`, { cluster: props.cluster, chart: resource.ref }); + + } + } + + const { app } = testFixture(); + const clusterStack = new ClusterStack(app, 'ClusterStack'); + new ChartStack(app, 'ChartStack', { cluster: clusterStack.eksCluster }); + + // make sure we can synth (no circular dependencies between the stacks) + app.synth(); + }); + + test('throws when declaring an ASG role in a different stack than the cluster', () => { + class ClusterStack extends cdk.Stack { + public eksCluster: eks.Cluster; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.eksCluster = new eks.Cluster(this, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + }); + } + } + + class CapacityStack extends cdk.Stack { + + public group: asg.AutoScalingGroup; + + constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { + super(scope, id, props); + + // the role is create in this stack implicitly by the ASG + this.group = new asg.AutoScalingGroup(this, 'autoScaling', { + instanceType: new ec2.InstanceType('t3.medium'), + vpc: props.cluster.vpc, + machineImage: new eks.EksOptimizedImage({ + kubernetesVersion: CLUSTER_VERSION.version, + nodeType: eks.NodeType.STANDARD, + }), + }); + } + } + + const { app } = testFixture(); + const clusterStack = new ClusterStack(app, 'ClusterStack'); + const capacityStack = new CapacityStack(app, 'CapacityStack', { cluster: clusterStack.eksCluster }); + + expect(() => { + clusterStack.eksCluster.connectAutoScalingGroupCapacity(capacityStack.group, {}); + }).toThrow( + 'CapacityStack/autoScaling/InstanceRole should be defined in the scope of the ClusterStack stack to prevent circular dependencies', + ); + }); + + test('can declare a ServiceAccount in a different stack than the cluster', () => { + class ClusterStack extends cdk.Stack { + public eksCluster: eks.Cluster; + + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + this.eksCluster = new eks.Cluster(this, 'EKSCluster', { + version: CLUSTER_VERSION, + prune: false, + }); + } + } + + class AppStack extends cdk.Stack { + constructor(scope: Construct, id: string, props: cdk.StackProps & { cluster: eks.Cluster }) { + super(scope, id, props); + + new eks.ServiceAccount(this, 'testAccount', { cluster: props.cluster, name: 'test-account', namespace: 'test' }); + } + } + + const { app } = testFixture(); + const clusterStack = new ClusterStack(app, 'EKSCluster'); + new AppStack(app, 'KubeApp', { cluster: clusterStack.eksCluster }); + + // make sure we can synth (no circular dependencies between the stacks) + app.synth(); + }); + + test('a default cluster spans all subnets', () => { + // GIVEN + const { stack, vpc } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { + Config: { + roleArn: { 'Fn::GetAtt': ['ClusterRoleFA261979', 'Arn'] }, + version: CLUSTER_VERSION.version, + resourcesVpcConfig: { + securityGroupIds: [{ 'Fn::GetAtt': ['ClusterControlPlaneSecurityGroupD274242C', 'GroupId'] }], + subnetIds: [ + { Ref: 'VPCPublicSubnet1SubnetB4246D30' }, + { Ref: 'VPCPublicSubnet2Subnet74179F39' }, + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + ], + }, + }, + }); + }); + + test('cluster handler gets created with STS regional endpoint configuration', () => { + // This is necessary to make aws-sdk-jsv2 work in opt-in regions + + // GIVEN + const { stack, vpc } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // THEN + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.ClusterResourceProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + AWS_STS_REGIONAL_ENDPOINTS: 'regional', + }, + }, + }); + }); + + test('if "vpc" is not specified, vpc with default configuration will be created', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { version: CLUSTER_VERSION, prune: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPC', Match.anyValue()); + }); + + describe('default capacity', () => { + test('x2 m5.large by default', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + const cluster = new eks.Cluster(stack, 'cluster', { version: CLUSTER_VERSION, prune: false }); + + // THEN + expect(cluster.defaultNodegroup).toBeDefined(); + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + InstanceTypes: [ + 'm5.large', + ], + ScalingConfig: { + DesiredSize: 2, + MaxSize: 2, + MinSize: 2, + }, + }); + }); + + test('quantity and type can be customized', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + const cluster = new eks.Cluster(stack, 'cluster', { + defaultCapacity: 10, + defaultCapacityInstance: new ec2.InstanceType('m2.xlarge'), + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + expect(cluster.defaultNodegroup).toBeDefined(); + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + ScalingConfig: { + DesiredSize: 10, + MaxSize: 10, + MinSize: 10, + }, + }); + // expect(stack).toHaveResource('AWS::AutoScaling::LaunchConfiguration', { InstanceType: 'm2.xlarge' })); + }); + + test('defaultCapacity=0 will not allocate at all', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + const cluster = new eks.Cluster(stack, 'cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // THEN + expect(cluster.defaultCapacity).toBeUndefined(); + Template.fromStack(stack).resourceCountIs('AWS::AutoScaling::AutoScalingGroup', 0); + Template.fromStack(stack).resourceCountIs('AWS::AutoScaling::LaunchConfiguration', 0); + }); + }); + + test('creating a cluster tags the private VPC subnets', () => { + // GIVEN + const { stack, vpc } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', { + Tags: [ + { Key: 'aws-cdk:subnet-name', Value: 'Private' }, + { Key: 'aws-cdk:subnet-type', Value: 'Private' }, + { Key: 'kubernetes.io/role/internal-elb', Value: '1' }, + { Key: 'Name', Value: 'Stack/VPC/PrivateSubnet1' }, + ], + }); + }); + + test('creating a cluster tags the public VPC subnets', () => { + // GIVEN + const { stack, vpc } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { vpc, defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', { + MapPublicIpOnLaunch: true, + Tags: [ + { Key: 'aws-cdk:subnet-name', Value: 'Public' }, + { Key: 'aws-cdk:subnet-type', Value: 'Public' }, + { Key: 'kubernetes.io/role/elb', Value: '1' }, + { Key: 'Name', Value: 'Stack/VPC/PublicSubnet1' }, + ], + }); + }); + + test('adding capacity creates an ASG without a rolling update policy', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('Default', { + instanceType: new ec2.InstanceType('t2.medium'), + }); + + Template.fromStack(stack).hasResource('AWS::AutoScaling::AutoScalingGroup', { + UpdatePolicy: { AutoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: true } }, + }); + }); + + test('adding capacity creates an ASG with tags', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('Default', { + instanceType: new ec2.InstanceType('t2.medium'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + Tags: [ + { + Key: { 'Fn::Join': ['', ['kubernetes.io/cluster/', { Ref: 'Cluster9EE0221C' }]] }, + PropagateAtLaunch: true, + Value: 'owned', + }, + { + Key: 'Name', + PropagateAtLaunch: true, + Value: 'Stack/Cluster/Default', + }, + ], + }); + }); + + test('create nodegroup with existing role', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + const cluster = new eks.Cluster(stack, 'cluster', { + defaultCapacity: 10, + defaultCapacityInstance: new ec2.InstanceType('m2.xlarge'), + version: CLUSTER_VERSION, + prune: false, + }); + + const existingRole = new iam.Role(stack, 'ExistingRole', { + assumedBy: new iam.AccountRootPrincipal(), + }); + + new eks.Nodegroup(stack, 'Nodegroup', { + cluster, + nodeRole: existingRole, + }); + + // THEN + expect(cluster.defaultNodegroup).toBeDefined(); + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + ScalingConfig: { + DesiredSize: 10, + MaxSize: 10, + MinSize: 10, + }, + }); + }); + + test('adding bottlerocket capacity creates an ASG with tags', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('Bottlerocket', { + instanceType: new ec2.InstanceType('t2.medium'), + machineImageType: eks.MachineImageType.BOTTLEROCKET, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::AutoScaling::AutoScalingGroup', { + Tags: [ + { + Key: { 'Fn::Join': ['', ['kubernetes.io/cluster/', { Ref: 'Cluster9EE0221C' }]] }, + PropagateAtLaunch: true, + Value: 'owned', + }, + { + Key: 'Name', + PropagateAtLaunch: true, + Value: 'Stack/Cluster/Bottlerocket', + }, + ], + }); + }); + + test('adding bottlerocket capacity with bootstrapOptions throws error', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + expect(() => cluster.addAutoScalingGroupCapacity('Bottlerocket', { + instanceType: new ec2.InstanceType('t2.medium'), + machineImageType: eks.MachineImageType.BOTTLEROCKET, + bootstrapOptions: {}, + })).toThrow(/bootstrapOptions is not supported for Bottlerocket/); + }); + + test('import cluster with existing kubectl provider function', () => { + const { stack } = testFixture(); + + const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); + const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { + functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', + kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', + handlerRole: handlerRole, + }); + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + kubectlProvider: kubectlProvider, + }); + + expect(cluster.kubectlProvider).toEqual(kubectlProvider); + }); + + describe('import cluster with existing kubectl provider function should work as expected with resources relying on kubectl getOrCreate', () => { + test('creates helm chart', () => { + const { stack } = testFixture(); + + const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); + const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { + functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', + kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', + handlerRole: handlerRole, + }); + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + kubectlProvider: kubectlProvider, + }); + + new eks.HelmChart(stack, 'Chart', { + cluster: cluster, + chart: 'chart', + }); + + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-HelmChart', { + ServiceToken: kubectlProvider.serviceToken, + RoleArn: kubectlProvider.roleArn, + }); + }); + + test('creates Kubernetes patch', () => { + const { stack } = testFixture(); + + const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); + const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { + functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', + kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', + handlerRole: handlerRole, + }); + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + kubectlProvider: kubectlProvider, + }); + + new eks.HelmChart(stack, 'Chart', { + cluster: cluster, + chart: 'chart', + }); + + new eks.KubernetesPatch(stack, 'Patch', { + cluster: cluster, + applyPatch: {}, + restorePatch: {}, + resourceName: 'PatchResource', + }); + + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesPatch', { + ServiceToken: kubectlProvider.serviceToken, + RoleArn: kubectlProvider.roleArn, + }); + }); + + test('creates Kubernetes object value', () => { + const { stack } = testFixture(); + + const handlerRole = iam.Role.fromRoleArn(stack, 'HandlerRole', 'arn:aws:iam::123456789012:role/lambda-role'); + const kubectlProvider = KubectlProvider.fromKubectlProviderAttributes(stack, 'KubectlProvider', { + functionArn: 'arn:aws:lambda:us-east-2:123456789012:function:my-function:1', + kubectlRoleArn: 'arn:aws:iam::123456789012:role/kubectl-role', + handlerRole: handlerRole, + }); + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + kubectlProvider: kubectlProvider, + }); + + new eks.HelmChart(stack, 'Chart', { + cluster: cluster, + chart: 'chart', + }); + + new eks.KubernetesPatch(stack, 'Patch', { + cluster: cluster, + applyPatch: {}, + restorePatch: {}, + resourceName: 'PatchResource', + }); + + new eks.KubernetesManifest(stack, 'Manifest', { + cluster: cluster, + manifest: [], + }); + + new eks.KubernetesObjectValue(stack, 'ObjectValue', { + cluster: cluster, + jsonPath: '', + objectName: 'name', + objectType: 'type', + }); + + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesObjectValue', { + ServiceToken: kubectlProvider.serviceToken, + RoleArn: kubectlProvider.roleArn, + }); + + expect(cluster.kubectlProvider).not.toBeInstanceOf(eks.KubectlProvider); + }); + }); + + test('import cluster with new kubectl private subnets', () => { + const { stack, vpc } = testFixture(); + + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Cluster', { + clusterName: 'cluster', + kubectlPrivateSubnetIds: vpc.privateSubnets.map(s => s.subnetId), + }); + + expect(cluster.kubectlPrivateSubnets?.map(s => stack.resolve(s.subnetId))).toEqual([ + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + ]); + + expect(cluster.kubectlPrivateSubnets?.map(s => s.node.id)).toEqual([ + 'KubectlSubnet0', + 'KubectlSubnet1', + ]); + }); + + test('exercise export/import', () => { + // GIVEN + const { stack: stack1, vpc, app } = testFixture(); + const stack2 = new cdk.Stack(app, 'stack2', { env: { region: 'us-east-1' } }); + const cluster = new eks.Cluster(stack1, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + const imported = eks.Cluster.fromClusterAttributes(stack2, 'Imported', { + vpc: cluster.vpc, + clusterEndpoint: cluster.clusterEndpoint, + clusterName: cluster.clusterName, + securityGroupIds: cluster.connections.securityGroups.map(x => x.securityGroupId), + clusterCertificateAuthorityData: cluster.clusterCertificateAuthorityData, + clusterSecurityGroupId: cluster.clusterSecurityGroupId, + clusterEncryptionConfigKeyArn: cluster.clusterEncryptionConfigKeyArn, + }); + + // this should cause an export/import + new cdk.CfnOutput(stack2, 'ClusterARN', { value: imported.clusterArn }); + + // THEN + Template.fromStack(stack2).templateMatches({ + Outputs: { + ClusterARN: { + Value: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':eks:us-east-1:', + { + Ref: 'AWS::AccountId', + }, + ':cluster/', + { + 'Fn::ImportValue': 'Stack:ExportsOutputRefCluster9EE0221C4853B4C3', + }, + ], + ], + }, + }, + }, + }); + }); + + test('mastersRole can be used to map an IAM role to "system:masters"', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const role = new iam.Role(stack, 'role', { assumedBy: new iam.AnyPrincipal() }); + + // WHEN + new eks.Cluster(stack, 'Cluster', { + vpc, + mastersRole: role, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { + Manifest: { + 'Fn::Join': [ + '', + [ + '[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"aws-auth","namespace":"kube-system"},"data":{"mapRoles":"[{\\"rolearn\\":\\"', + { + 'Fn::GetAtt': [ + 'roleC7B7E775', + 'Arn', + ], + }, + '\\",\\"username\\":\\"', + { + 'Fn::GetAtt': [ + 'roleC7B7E775', + 'Arn', + ], + }, + '\\",\\"groups\\":[\\"system:masters\\"]}]","mapUsers":"[]","mapAccounts":"[]"}}]', + ], + ], + }, + }); + }); + + test('addManifest can be used to apply k8s manifests on this cluster', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addManifest('manifest1', { foo: 123 }); + cluster.addManifest('manifest2', { bar: 123 }, { boor: [1, 2, 3] }); + + // THEN + Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { + Manifest: '[{"foo":123}]', + }); + + Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { + Manifest: '[{"bar":123},{"boor":[1,2,3]}]', + }); + }); + + test('kubectl resources can be created in a separate stack', () => { + // GIVEN + const { stack, app } = testFixture(); + const cluster = new eks.Cluster(stack, 'cluster', { version: CLUSTER_VERSION, prune: false }); // cluster is under stack2 + + // WHEN resource is under stack2 + const stack2 = new cdk.Stack(app, 'stack2', { env: { account: stack.account, region: stack.region } }); + new eks.KubernetesManifest(stack2, 'myresource', { + cluster, + manifest: [{ foo: 'bar' }], + }); + + // THEN + app.synth(); // no cyclic dependency (see https://github.com/aws/aws-cdk/issues/7231) + + // expect a single resource in the 2nd stack + Template.fromStack(stack2).templateMatches({ + Resources: { + myresource49C6D325: { + Type: 'Custom::AWSCDK-EKS-KubernetesResource', + Properties: { + ServiceToken: { + 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttawscdkawseksKubectlProviderNestedStackawscdkawseksKubectlProviderNestedStackResourceA7AEBA6BOutputsStackawscdkawseksKubectlProviderframeworkonEvent8897FD9BArn49BEF20C', + }, + Manifest: '[{\"foo\":\"bar\"}]', + ClusterName: { 'Fn::ImportValue': 'Stack:ExportsOutputRefclusterC5B25D0D98D553F5' }, + RoleArn: { 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttclusterCreationRole2B3B5002ArnF05122FC' }, + }, + UpdateReplacePolicy: 'Delete', + DeletionPolicy: 'Delete', + }, + }, + }); + }); + + test('adding capacity will automatically map its IAM role', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('default', { + instanceType: new ec2.InstanceType('t2.nano'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { + Manifest: { + 'Fn::Join': [ + '', + [ + '[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"aws-auth","namespace":"kube-system"},"data":{"mapRoles":"[{\\"rolearn\\":\\"', + { + 'Fn::GetAtt': [ + 'ClusterMastersRole9AA35625', + 'Arn', + ], + }, + '\\",\\"username\\":\\"', + { + 'Fn::GetAtt': [ + 'ClusterMastersRole9AA35625', + 'Arn', + ], + }, + '\\",\\"groups\\":[\\"system:masters\\"]},{\\"rolearn\\":\\"', + { + 'Fn::GetAtt': [ + 'ClusterdefaultInstanceRoleF20A29CD', + 'Arn', + ], + }, + '\\",\\"username\\":\\"system:node:{{EC2PrivateDNSName}}\\",\\"groups\\":[\\"system:bootstrappers\\",\\"system:nodes\\"]}]","mapUsers":"[]","mapAccounts":"[]"}}]', + ], + ], + }, + }); + }); + + test('addAutoScalingGroupCapacity will *not* map the IAM role if mapRole is false', () => { + // GIVEN + const { stack, vpc } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { + vpc, + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addAutoScalingGroupCapacity('default', { + instanceType: new ec2.InstanceType('t2.nano'), + mapRole: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { + Manifest: { + 'Fn::Join': [ + '', + [ + '[{"apiVersion":"v1","kind":"ConfigMap","metadata":{"name":"aws-auth","namespace":"kube-system"},"data":{"mapRoles":"[{\\"rolearn\\":\\"', + { + 'Fn::GetAtt': [ + 'ClusterMastersRole9AA35625', + 'Arn', + ], + }, + '\\",\\"username\\":\\"', + { + 'Fn::GetAtt': [ + 'ClusterMastersRole9AA35625', + 'Arn', + ], + }, + '\\",\\"groups\\":[\\"system:masters\\"]}]","mapUsers":"[]","mapAccounts":"[]"}}]', + ], + ], + }, + }); + }); + + describe('outputs', () => { + test('aws eks update-kubeconfig is the only output synthesized by default', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { version: CLUSTER_VERSION, prune: false }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Outputs).toEqual({ + ClusterConfigCommand43AAE40F: { Value: { 'Fn::Join': ['', ['aws eks update-kubeconfig --name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['ClusterMastersRole9AA35625', 'Arn'] }]] } }, + ClusterGetTokenCommand06AE992E: { Value: { 'Fn::Join': ['', ['aws eks get-token --cluster-name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['ClusterMastersRole9AA35625', 'Arn'] }]] } }, + }); + }); + + test('if masters role is defined, it should be included in the config command', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + const mastersRole = new iam.Role(stack, 'masters', { assumedBy: new iam.AccountRootPrincipal() }); + new eks.Cluster(stack, 'Cluster', { + mastersRole, + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Outputs).toEqual({ + ClusterConfigCommand43AAE40F: { Value: { 'Fn::Join': ['', ['aws eks update-kubeconfig --name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['masters0D04F23D', 'Arn'] }]] } }, + ClusterGetTokenCommand06AE992E: { Value: { 'Fn::Join': ['', ['aws eks get-token --cluster-name ', { Ref: 'Cluster9EE0221C' }, ' --region us-east-1 --role-arn ', { 'Fn::GetAtt': ['masters0D04F23D', 'Arn'] }]] } }, + }); + }); + + test('if `outputConfigCommand=false` will disabled the output', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + const mastersRole = new iam.Role(stack, 'masters', { assumedBy: new iam.AccountRootPrincipal() }); + new eks.Cluster(stack, 'Cluster', { + mastersRole, + outputConfigCommand: false, + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Outputs).toBeUndefined(); // no outputs + }); + + test('`outputClusterName` can be used to synthesize an output with the cluster name', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { + outputConfigCommand: false, + outputClusterName: true, + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Outputs).toEqual({ + ClusterClusterNameEB26049E: { Value: { Ref: 'Cluster9EE0221C' } }, + }); + }); + + test('`outputMastersRoleArn` can be used to synthesize an output with the arn of the masters role if defined', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { + outputConfigCommand: false, + outputMastersRoleArn: true, + mastersRole: new iam.Role(stack, 'masters', { assumedBy: new iam.AccountRootPrincipal() }), + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + const assembly = app.synth(); + const template = assembly.getStackByName(stack.stackName).template; + expect(template.Outputs).toEqual({ + ClusterMastersRoleArnB15964B1: { Value: { 'Fn::GetAtt': ['masters0D04F23D', 'Arn'] } }, + }); + }); + + describe('boostrap user-data', () => { + test('rendered by default for ASGs', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('MyCapcity', { instanceType: new ec2.InstanceType('m3.xlargs') }); + + // THEN + const template = app.synth().getStackByName(stack.stackName).template; + const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; + expect(userData).toEqual({ 'Fn::Base64': { 'Fn::Join': ['', ['#!/bin/bash\nset -o xtrace\n/etc/eks/bootstrap.sh ', { Ref: 'Cluster9EE0221C' }, ' --kubelet-extra-args "--node-labels lifecycle=OnDemand" --apiserver-endpoint \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'Endpoint'] }, '\' --b64-cluster-ca \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'CertificateAuthorityData'] }, '\' --use-max-pods true\n/opt/aws/bin/cfn-signal --exit-code $? --stack Stack --resource ClusterMyCapcityASGD4CD8B97 --region us-east-1']] } }); + }); + + test('not rendered if bootstrap is disabled', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('MyCapcity', { + instanceType: new ec2.InstanceType('m3.xlargs'), + bootstrapEnabled: false, + }); + + // THEN + const template = app.synth().getStackByName(stack.stackName).template; + const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; + expect(userData).toEqual({ 'Fn::Base64': '#!/bin/bash' }); + }); + + // cursory test for options: see test.user-data.ts for full suite + test('bootstrap options', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('MyCapcity', { + instanceType: new ec2.InstanceType('m3.xlargs'), + bootstrapOptions: { + kubeletExtraArgs: '--node-labels FOO=42', + }, + }); + + // THEN + const template = app.synth().getStackByName(stack.stackName).template; + const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; + expect(userData).toEqual({ 'Fn::Base64': { 'Fn::Join': ['', ['#!/bin/bash\nset -o xtrace\n/etc/eks/bootstrap.sh ', { Ref: 'Cluster9EE0221C' }, ' --kubelet-extra-args "--node-labels lifecycle=OnDemand --node-labels FOO=42" --apiserver-endpoint \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'Endpoint'] }, '\' --b64-cluster-ca \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'CertificateAuthorityData'] }, '\' --use-max-pods true\n/opt/aws/bin/cfn-signal --exit-code $? --stack Stack --resource ClusterMyCapcityASGD4CD8B97 --region us-east-1']] } }); + }); + + describe('spot instances', () => { + + test('nodes labeled an tainted accordingly', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('MyCapcity', { + instanceType: new ec2.InstanceType('m3.xlargs'), + spotPrice: '0.01', + }); + + // THEN + const template = app.synth().getStackByName(stack.stackName).template; + const userData = template.Resources.ClusterMyCapcityLaunchConfig58583345.Properties.UserData; + expect(userData).toEqual({ 'Fn::Base64': { 'Fn::Join': ['', ['#!/bin/bash\nset -o xtrace\n/etc/eks/bootstrap.sh ', { Ref: 'Cluster9EE0221C' }, ' --kubelet-extra-args "--node-labels lifecycle=Ec2Spot --register-with-taints=spotInstance=true:PreferNoSchedule" --apiserver-endpoint \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'Endpoint'] }, '\' --b64-cluster-ca \'', { 'Fn::GetAtt': ['Cluster9EE0221C', 'CertificateAuthorityData'] }, '\' --use-max-pods true\n/opt/aws/bin/cfn-signal --exit-code $? --stack Stack --resource ClusterMyCapcityASGD4CD8B97 --region us-east-1']] } }); + }); + + test('interrupt handler is added', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('MyCapcity', { + instanceType: new ec2.InstanceType('m3.xlarge'), + spotPrice: '0.01', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties(eks.HelmChart.RESOURCE_TYPE, { + Release: 'stackclusterchartspotinterrupthandlerdec62e07', + Chart: 'aws-node-termination-handler', + Values: '{\"nodeSelector\":{\"lifecycle\":\"Ec2Spot\"}}', + Namespace: 'kube-system', + Repository: 'https://aws.github.io/eks-charts', + }); + }); + + test('interrupt handler is not added when spotInterruptHandler is false', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('MyCapcity', { + instanceType: new ec2.InstanceType('m3.xlarge'), + spotPrice: '0.01', + spotInterruptHandler: false, + }); + + // THEN + expect(cluster.node.findAll().filter(c => c.node.id === 'chart-spot-interrupt-handler').length).toEqual(0); + }); + + test('its possible to add two capacities with spot instances and only one stop handler will be installed', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('Spot1', { + instanceType: new ec2.InstanceType('m3.xlarge'), + spotPrice: '0.01', + }); + + cluster.addAutoScalingGroupCapacity('Spot2', { + instanceType: new ec2.InstanceType('m4.xlarge'), + spotPrice: '0.01', + }); + + // THEN + Template.fromStack(stack).resourceCountIs(eks.HelmChart.RESOURCE_TYPE, 1); + }); + }); + }); + + test('if bootstrap is disabled cannot specify options', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // THEN + expect(() => cluster.addAutoScalingGroupCapacity('MyCapcity', { + instanceType: new ec2.InstanceType('m3.xlargs'), + bootstrapEnabled: false, + bootstrapOptions: { awsApiRetryAttempts: 10 }, + })).toThrow(/Cannot specify "bootstrapOptions" if "bootstrapEnabled" is false/); + }); + + test('EksOptimizedImage() with no nodeType always uses STANDARD with LATEST_KUBERNETES_VERSION', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + const LATEST_KUBERNETES_VERSION = '1.24'; + + // WHEN + new eks.EksOptimizedImage().getImage(stack); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && + (v as any).Default.includes('/amazon-linux-2/'), + )).toEqual(true); + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && + (v as any).Default.includes(LATEST_KUBERNETES_VERSION), + )).toEqual(true); + }); + + test('EksOptimizedImage() with specific kubernetesVersion return correct AMI', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.EksOptimizedImage({ kubernetesVersion: CLUSTER_VERSION.version }).getImage(stack); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && + (v as any).Default.includes('/amazon-linux-2/'), + )).toEqual(true); + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && + (v as any).Default.includes('/1.25/'), + )).toEqual(true); + }); + + test('default cluster capacity with ARM64 instance type comes with nodegroup with correct AmiType', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 1, + version: CLUSTER_VERSION, + prune: false, + defaultCapacityInstance: new ec2.InstanceType('m6g.medium'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + AmiType: 'AL2_ARM_64', + }); + }); + + test('addNodegroup with ARM64 instance type comes with nodegroup with correct AmiType', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + defaultCapacityInstance: new ec2.InstanceType('m6g.medium'), + }).addNodegroupCapacity('ng', { + instanceTypes: [new ec2.InstanceType('m6g.medium')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + AmiType: 'AL2_ARM_64', + }); + }); + + test('addNodegroupCapacity with T4g instance type comes with nodegroup with correct AmiType', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + defaultCapacityInstance: new ec2.InstanceType('t4g.medium'), + }).addNodegroupCapacity('ng', { + instanceTypes: [new ec2.InstanceType('t4g.medium')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + AmiType: 'AL2_ARM_64', + }); + }); + + test('addAutoScalingGroupCapacity with T4g instance type comes with nodegroup with correct AmiType', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }).addAutoScalingGroupCapacity('ng', { + instanceType: new ec2.InstanceType('t4g.medium'), + }); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && + (v as any).Default.includes('amazon-linux-2-arm64/'), + )).toEqual(true); + }); + + test('addNodegroupCapacity with C7g instance type comes with nodegroup with correct AmiType', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + defaultCapacityInstance: new ec2.InstanceType('c7g.large'), + }).addNodegroupCapacity('ng', { + instanceTypes: [new ec2.InstanceType('c7g.large')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EKS::Nodegroup', { + AmiType: 'AL2_ARM_64', + }); + }); + + test('addAutoScalingGroupCapacity with C7g instance type comes with nodegroup with correct AmiType', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }).addAutoScalingGroupCapacity('ng', { + instanceType: new ec2.InstanceType('c7g.large'), + }); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && + (v as any).Default.includes('amazon-linux-2-arm64/'), + )).toEqual(true); + }); + + test('EKS-Optimized AMI with GPU support when addAutoScalingGroupCapacity', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }).addAutoScalingGroupCapacity('GPUCapacity', { + instanceType: new ec2.InstanceType('g4dn.xlarge'), + }); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && (v as any).Default.includes('amazon-linux-2-gpu'), + )).toEqual(true); + }); + + test('EKS-Optimized AMI with ARM64 when addAutoScalingGroupCapacity', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new eks.Cluster(stack, 'cluster', { + defaultCapacity: 0, + version: CLUSTER_VERSION, + prune: false, + }).addAutoScalingGroupCapacity('ARMCapacity', { + instanceType: new ec2.InstanceType('m6g.medium'), + }); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsserviceeksoptimizedami') && (v as any).Default.includes('/amazon-linux-2-arm64/'), + )).toEqual(true); + }); + + test('BottleRocketImage() with specific kubernetesVersion return correct AMI', () => { + // GIVEN + const { app, stack } = testFixtureNoVpc(); + + // WHEN + new BottleRocketImage({ kubernetesVersion: CLUSTER_VERSION.version }).getImage(stack); + + // THEN + const assembly = app.synth(); + const parameters = assembly.getStackByName(stack.stackName).template.Parameters; + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketaws') && + (v as any).Default.includes('/bottlerocket/'), + )).toEqual(true); + expect(Object.entries(parameters).some( + ([k, v]) => k.startsWith('SsmParameterValueawsservicebottlerocketaws') && + (v as any).Default.includes('/aws-k8s-1.25/'), + )).toEqual(true); + }); + + test('when using custom resource a creation role & policy is defined', () => { + // GIVEN + const { stack } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'MyCluster', { + clusterName: 'my-cluster-name', + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { + Config: { + name: 'my-cluster-name', + roleArn: { 'Fn::GetAtt': ['MyClusterRoleBA20FE72', 'Arn'] }, + version: CLUSTER_VERSION.version, + resourcesVpcConfig: { + securityGroupIds: [ + { 'Fn::GetAtt': ['MyClusterControlPlaneSecurityGroup6B658F79', 'GroupId'] }, + ], + subnetIds: [ + { Ref: 'MyClusterDefaultVpcPublicSubnet1SubnetFAE5A9B6' }, + { Ref: 'MyClusterDefaultVpcPublicSubnet2SubnetF6D028A0' }, + { Ref: 'MyClusterDefaultVpcPrivateSubnet1SubnetE1D0DCDB' }, + { Ref: 'MyClusterDefaultVpcPrivateSubnet2Subnet11FEA8D0' }, + ], + endpointPrivateAccess: true, + endpointPublicAccess: true, + }, + }, + }); + + // role can be assumed by 3 lambda handlers (2 for the cluster resource and 1 for the kubernetes resource) + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + AWS: { + 'Fn::Join': [ + '', + ['arn:', { Ref: 'AWS::Partition' }, ':iam::', { Ref: 'AWS::AccountId' }, ':root'], + ], + }, + }, + }, + ], + Version: '2012-10-17', + }, + }); + + // policy allows creation role to pass the cluster role and to interact with the cluster (given we know the explicit cluster name) + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'iam:PassRole', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'MyClusterRoleBA20FE72', + 'Arn', + ], + }, + }, + { + Action: [ + 'eks:CreateCluster', + 'eks:DescribeCluster', + 'eks:DescribeUpdate', + 'eks:DeleteCluster', + 'eks:UpdateClusterVersion', + 'eks:UpdateClusterConfig', + 'eks:CreateFargateProfile', + 'eks:TagResource', + 'eks:UntagResource', + ], + Effect: 'Allow', + Resource: [{ + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':eks:us-east-1:', + { + Ref: 'AWS::AccountId', + }, + ':cluster/my-cluster-name', + ], + ], + }, { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':eks:us-east-1:', + { + Ref: 'AWS::AccountId', + }, + ':cluster/my-cluster-name/*', + ], + ], + }], + }, + { + Action: [ + 'eks:DescribeFargateProfile', + 'eks:DeleteFargateProfile', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':eks:us-east-1:', + { + Ref: 'AWS::AccountId', + }, + ':fargateprofile/my-cluster-name/*', + ], + ], + }, + }, + { + Action: ['iam:GetRole', 'iam:listAttachedRolePolicies'], + Effect: 'Allow', + Resource: '*', + }, + { + Action: 'iam:CreateServiceLinkedRole', + Effect: 'Allow', + Resource: '*', + }, + { + Action: [ + 'ec2:DescribeInstances', + 'ec2:DescribeNetworkInterfaces', + 'ec2:DescribeSecurityGroups', + 'ec2:DescribeSubnets', + 'ec2:DescribeRouteTables', + 'ec2:DescribeDhcpOptions', + 'ec2:DescribeVpcs', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + }); + }); + + test('if an explicit cluster name is not provided, the creation role policy is wider (allows interacting with all clusters)', () => { + // GIVEN + const { stack } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'MyCluster', { version: CLUSTER_VERSION, prune: false }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'iam:PassRole', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'MyClusterRoleBA20FE72', + 'Arn', + ], + }, + }, + { + Action: [ + 'eks:CreateCluster', + 'eks:DescribeCluster', + 'eks:DescribeUpdate', + 'eks:DeleteCluster', + 'eks:UpdateClusterVersion', + 'eks:UpdateClusterConfig', + 'eks:CreateFargateProfile', + 'eks:TagResource', + 'eks:UntagResource', + ], + Effect: 'Allow', + Resource: ['*'], + }, + { + Action: [ + 'eks:DescribeFargateProfile', + 'eks:DeleteFargateProfile', + ], + Effect: 'Allow', + Resource: '*', + }, + { + Action: ['iam:GetRole', 'iam:listAttachedRolePolicies'], + Effect: 'Allow', + Resource: '*', + }, + { + Action: 'iam:CreateServiceLinkedRole', + Effect: 'Allow', + Resource: '*', + }, + { + Action: [ + 'ec2:DescribeInstances', + 'ec2:DescribeNetworkInterfaces', + 'ec2:DescribeSecurityGroups', + 'ec2:DescribeSubnets', + 'ec2:DescribeRouteTables', + 'ec2:DescribeDhcpOptions', + 'ec2:DescribeVpcs', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + }); + }); + + test('if helm charts are used, the provider role is allowed to assume the creation role', () => { + // GIVEN + const { stack } = testFixture(); + const cluster = new eks.Cluster(stack, 'MyCluster', { + clusterName: 'my-cluster-name', + version: CLUSTER_VERSION, + prune: false, + }); + + // WHEN + cluster.addHelmChart('MyChart', { + chart: 'foo', + }); + + // THEN + const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'eks:DescribeCluster', + Effect: 'Allow', + Resource: { + Ref: 'referencetoStackMyClusterD33CAEABArn', + }, + }, + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Resource: { + Ref: 'referencetoStackMyClusterCreationRoleA67486E4Arn', + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'HandlerServiceRoleDefaultPolicyCBD0CC91', + Roles: [ + { + Ref: 'HandlerServiceRoleFCDC14AE', + }, + ], + }); + + Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { Service: 'lambda.amazonaws.com' }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole', + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AmazonEC2ContainerRegistryReadOnly', + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AmazonElasticContainerRegistryPublicReadOnly', + ]], + }, + ], + }); + }); + + test('coreDnsComputeType will patch the coreDNS configuration to use a "fargate" compute type and restore to "ec2" upon removal', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new eks.Cluster(stack, 'MyCluster', { + coreDnsComputeType: eks.CoreDnsComputeType.FARGATE, + version: CLUSTER_VERSION, + prune: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-KubernetesPatch', { + ResourceName: 'deployment/coredns', + ResourceNamespace: 'kube-system', + ApplyPatchJson: '{"spec":{"template":{"metadata":{"annotations":{"eks.amazonaws.com/compute-type":"fargate"}}}}}', + RestorePatchJson: '{"spec":{"template":{"metadata":{"annotations":{"eks.amazonaws.com/compute-type":"ec2"}}}}}', + ClusterName: { + Ref: 'MyCluster8AD82BF8', + }, + RoleArn: { + 'Fn::GetAtt': [ + 'MyClusterCreationRoleB5FA4FF3', + 'Arn', + ], + }, + }); + }); + + test('if openIDConnectProvider a new OpenIDConnectProvider resource is created and exposed', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + const provider = cluster.openIdConnectProvider; + + // THEN + expect(provider).toEqual(cluster.openIdConnectProvider); + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDKOpenIdConnectProvider', { + ServiceToken: { + 'Fn::GetAtt': [ + 'CustomAWSCDKOpenIdConnectProviderCustomResourceProviderHandlerF2C543E0', + 'Arn', + ], + }, + ClientIDList: [ + 'sts.amazonaws.com', + ], + Url: { + 'Fn::GetAtt': [ + 'Cluster9EE0221C', + 'OpenIdConnectIssuerUrl', + ], + }, + }); + }); + test('inference instances are supported', () => { + // GIVEN + const { stack } = testFixtureNoVpc(); + const cluster = new eks.Cluster(stack, 'Cluster', { defaultCapacity: 0, version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addAutoScalingGroupCapacity('InferenceInstances', { + instanceType: new ec2.InstanceType('inf1.2xlarge'), + minCapacity: 1, + }); + const fileContents = fs.readFileSync(path.join(__dirname, '../lib', 'addons/neuron-device-plugin.yaml'), 'utf8'); + const sanitized = YAML.parse(fileContents); + + // THEN + Template.fromStack(stack).hasResourceProperties(eks.KubernetesManifest.RESOURCE_TYPE, { + Manifest: JSON.stringify([sanitized]), + }); + }); + + test('kubectl resources are always created after all fargate profiles', () => { + // GIVEN + const { stack, app } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster', { version: CLUSTER_VERSION, prune: false }); + + // WHEN + cluster.addFargateProfile('profile1', { selectors: [{ namespace: 'profile1' }] }); + cluster.addManifest('resource1', { foo: 123 }); + cluster.addFargateProfile('profile2', { selectors: [{ namespace: 'profile2' }] }); + new eks.HelmChart(stack, 'chart', { cluster, chart: 'mychart' }); + cluster.addFargateProfile('profile3', { selectors: [{ namespace: 'profile3' }] }); + new eks.KubernetesPatch(stack, 'patch1', { + cluster, + applyPatch: { foo: 123 }, + restorePatch: { bar: 123 }, + resourceName: 'foo/bar', + }); + cluster.addFargateProfile('profile4', { selectors: [{ namespace: 'profile4' }] }); + + // THEN + const template = app.synth().getStackArtifact(stack.artifactId).template; + + const barrier = template.Resources.ClusterKubectlReadyBarrier200052AF; + + expect(barrier.DependsOn).toEqual([ + 'Clusterfargateprofileprofile1PodExecutionRoleE85F87B5', + 'Clusterfargateprofileprofile129AEA3C6', + 'Clusterfargateprofileprofile2PodExecutionRole22670AF8', + 'Clusterfargateprofileprofile233B9A117', + 'Clusterfargateprofileprofile3PodExecutionRole475C0D8F', + 'Clusterfargateprofileprofile3D06F3076', + 'Clusterfargateprofileprofile4PodExecutionRole086057FB', + 'Clusterfargateprofileprofile4A0E3BBE8', + 'ClusterCreationRoleDefaultPolicyE8BDFC7B', + 'ClusterCreationRole360249B6', + 'Cluster9EE0221C', + ]); + + const kubectlResources = ['chartF2447AFC', 'patch1B964AC93', 'Clustermanifestresource10B1C9505', 'ClusterAwsAuthmanifestFE51F8AE']; + + // check that all kubectl resources depend on the barrier + for (const r of kubectlResources) { + expect(template.Resources[r].DependsOn).toEqual(['ClusterKubectlReadyBarrier200052AF']); + } + }); + + test('kubectl provider role can assume creation role', () => { + // GIVEN + const { stack } = testFixture(); + const c1 = new eks.Cluster(stack, 'Cluster1', { version: CLUSTER_VERSION, prune: false }); + + // WHEN + + // activate kubectl provider + c1.addManifest('c1a', { foo: 123 }); + c1.addManifest('c1b', { foo: 123 }); + + // THEN + const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'eks:DescribeCluster', + Effect: 'Allow', + Resource: { + Ref: 'referencetoStackCluster18DFEAC17Arn', + }, + }, + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Resource: { + Ref: 'referencetoStackCluster1CreationRoleEF7C9BBCArn', + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(providerStack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { Service: 'lambda.amazonaws.com' }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole', + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AmazonEC2ContainerRegistryReadOnly', + ]], + }, + { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':iam::aws:policy/AmazonElasticContainerRegistryPublicReadOnly', + ]], + }, + ], + }); + }); + }); + + test('kubectl provider passes security group to provider', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + kubectlEnvironment: { + Foo: 'Bar', + }, + }); + + // the kubectl provider is inside a nested stack. + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { + SecurityGroupIds: [{ Ref: 'referencetoStackCluster18DFEAC17ClusterSecurityGroupId' }], + }, + }); + }); + + test('kubectl provider passes environment to lambda', () => { + const { stack } = testFixture(); + + const cluster = new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + kubectlEnvironment: { + Foo: 'Bar', + }, + }); + + cluster.addManifest('resource', { + kind: 'ConfigMap', + apiVersion: 'v1', + data: { + hello: 'world', + }, + metadata: { + name: 'config-map', + }, + }); + + // the kubectl provider is inside a nested stack. + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + Foo: 'Bar', + }, + }, + }); + }); + + describe('kubectl provider passes iam role environment to kube ctl lambda', ()=>{ + test('new cluster', () => { + const { stack } = testFixture(); + + const kubectlRole = new iam.Role(stack, 'KubectlIamRole', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // using _ syntax to silence warning about _cluster not being used, when it is + const cluster = new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + kubectlLambdaRole: kubectlRole, + }); + + cluster.addManifest('resource', { + kind: 'ConfigMap', + apiVersion: 'v1', + data: { + hello: 'world', + }, + metadata: { + name: 'config-map', + }, + }); + + // the kubectl provider is inside a nested stack. + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + Role: { + Ref: 'referencetoStackKubectlIamRole02F8947EArn', + }, + }); + }); + + test('imported cluster', ()=> { + const clusterName = 'my-cluster'; + const stack = new cdk.Stack(); + const kubectlLambdaRole = new iam.Role(stack, 'KubectlLambdaRole', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Imported', { + clusterName, + kubectlRoleArn: 'arn:aws:iam::1111111:role/iam-role-that-has-masters-access', + kubectlLambdaRole: kubectlLambdaRole, + }); + + const chart = 'hello-world'; + cluster.addHelmChart('test-chart', { + chart, + }); + + const nested = stack.node.tryFindChild('Imported-KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + Role: { + Ref: 'referencetoKubectlLambdaRole7D084D94Arn', + }, + }); + Template.fromStack(stack).hasResourceProperties(HelmChart.RESOURCE_TYPE, { + ClusterName: clusterName, + RoleArn: 'arn:aws:iam::1111111:role/iam-role-that-has-masters-access', + Release: 'importedcharttestchartf3acd6e5', + Chart: chart, + Namespace: 'default', + CreateNamespace: true, + }); + }); + }); + + describe('endpoint access', () => { + test('public restricted', () => { + expect(() => { + eks.EndpointAccess.PUBLIC.onlyFrom('1.2.3.4/32'); + }).toThrow(/Cannot restric public access to endpoint when private access is disabled. Use PUBLIC_AND_PRIVATE.onlyFrom\(\) instead./); + }); + + test('public non restricted without private subnets', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PUBLIC, + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + + // we don't attach vpc config in case endpoint is public only, regardless of whether + // the vpc has private subnets or not. + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: Match.absent(), + }); + }); + + test('public non restricted with private subnets', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PUBLIC, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + + // we don't attach vpc config in case endpoint is public only, regardless of whether + // the vpc has private subnets or not. + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: Match.absent(), + }); + }); + + test('private without private subnets', () => { + const { stack } = testFixture(); + + expect(() => { + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], + }); + }).toThrow(/Vpc must contain private subnets when public endpoint access is disabled/); + }); + + test('private with private subnets', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + + const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); + expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).not.toEqual(0); + expect(functions.Handler886CB40B.Properties.VpcConfig.SecurityGroupIds.length).not.toEqual(0); + }); + + test('private and non restricted public without private subnets', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE, + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + + // we don't have private subnets, but we don't need them since public access + // is not restricted. + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: Match.absent(), + }); + }); + + test('private and non restricted public with private subnets', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + + // we have private subnets so we should use them. + const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); + expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).not.toEqual(0); + expect(functions.Handler886CB40B.Properties.VpcConfig.SecurityGroupIds.length).not.toEqual(0); + }); + + test('private and restricted public without private subnets', () => { + const { stack } = testFixture(); + + expect(() => { + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE.onlyFrom('1.2.3.4/32'), + vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }], + }); + }).toThrow(/Vpc must contain private subnets when public endpoint access is restricted/); + }); + + test('private and restricted public with private subnets', () => { + const { stack } = testFixture(); + + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PUBLIC_AND_PRIVATE.onlyFrom('1.2.3.4/32'), + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + + // we have private subnets so we should use them. + const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); + expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).not.toEqual(0); + expect(functions.Handler886CB40B.Properties.VpcConfig.SecurityGroupIds.length).not.toEqual(0); + }); + + test('private endpoint access selects only private subnets from looked up vpc', () => { + const vpcId = 'vpc-12345'; + // can't use the regular fixture because it also adds a VPC to the stack, which prevents + // us from setting context. + const stack = new cdk.Stack(new cdk.App(), 'Stack', { + env: { + account: '11112222', + region: 'us-east-1', + }, + }); + stack.node.setContext(`vpc-provider:account=${stack.account}:filter.vpc-id=${vpcId}:region=${stack.region}:returnAsymmetricSubnets=true`, { + vpcId: vpcId, + vpcCidrBlock: '10.0.0.0/16', + subnetGroups: [ + { + name: 'Private', + type: 'Private', + subnets: [ + { + subnetId: 'subnet-private-in-us-east-1a', + cidr: '10.0.1.0/24', + availabilityZone: 'us-east-1a', + routeTableId: 'rtb-06068e4c4049921ef', + }, + ], + }, + { + name: 'Public', + type: 'Public', + subnets: [ + { + subnetId: 'subnet-public-in-us-east-1c', + cidr: '10.0.0.0/24', + availabilityZone: 'us-east-1c', + routeTableId: 'rtb-0ff08e62195198dbb', + }, + ], + }, + ], + }); + const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { + vpcId: vpcId, + }); + + new eks.Cluster(stack, 'Cluster', { + vpc, + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { SubnetIds: ['subnet-private-in-us-east-1a'] }, + }); + }); + + test('private endpoint access selects only private subnets from looked up vpc with concrete subnet selection', () => { + const vpcId = 'vpc-12345'; + // can't use the regular fixture because it also adds a VPC to the stack, which prevents + // us from setting context. + const stack = new cdk.Stack(new cdk.App(), 'Stack', { + env: { + account: '11112222', + region: 'us-east-1', + }, + }); + + stack.node.setContext(`vpc-provider:account=${stack.account}:filter.vpc-id=${vpcId}:region=${stack.region}:returnAsymmetricSubnets=true`, { + vpcId: vpcId, + vpcCidrBlock: '10.0.0.0/16', + subnetGroups: [ + { + name: 'Private', + type: 'Private', + subnets: [ + { + subnetId: 'subnet-private-in-us-east-1a', + cidr: '10.0.1.0/24', + availabilityZone: 'us-east-1a', + routeTableId: 'rtb-06068e4c4049921ef', + }, + ], + }, + { + name: 'Public', + type: 'Public', + subnets: [ + { + subnetId: 'subnet-public-in-us-east-1c', + cidr: '10.0.0.0/24', + availabilityZone: 'us-east-1c', + routeTableId: 'rtb-0ff08e62195198dbb', + }, + ], + }, + ], + }); + + const vpc = ec2.Vpc.fromLookup(stack, 'Vpc', { + vpcId: vpcId, + }); + + new eks.Cluster(stack, 'Cluster', { + vpc, + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + vpcSubnets: [{ + subnets: [ + ec2.Subnet.fromSubnetId(stack, 'Private', 'subnet-private-in-us-east-1a'), + ec2.Subnet.fromSubnetId(stack, 'Public', 'subnet-public-in-us-east-1c'), + ], + }], + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { SubnetIds: ['subnet-private-in-us-east-1a'] }, + }); + }); + + test('private endpoint access selects only private subnets from managed vpc with concrete subnet selection', () => { + const { stack } = testFixture(); + + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new eks.Cluster(stack, 'Cluster', { + vpc, + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + vpcSubnets: [{ + subnets: [ + vpc.privateSubnets[0], + vpc.publicSubnets[1], + ec2.Subnet.fromSubnetId(stack, 'Private', 'subnet-unknown'), + ], + }], + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { + SubnetIds: [ + { Ref: 'referencetoStackVpcPrivateSubnet1Subnet8E6A14CBRef' }, + 'subnet-unknown', + ], + }, + }); + }); + + test('private endpoint access considers specific subnet selection', () => { + const { stack } = testFixture(); + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: + eks.EndpointAccess.PRIVATE, + vpcSubnets: [{ + subnets: [ec2.PrivateSubnet.fromSubnetAttributes(stack, 'Private1', { + subnetId: 'subnet1', + availabilityZone: 'us-east-1a', + })], + }], + }); + + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { SubnetIds: ['subnet1'] }, + }); + }); + + test('can configure private endpoint access', () => { + // GIVEN + const { stack } = testFixture(); + new eks.Cluster(stack, 'Cluster1', { version: CLUSTER_VERSION, endpointAccess: eks.EndpointAccess.PRIVATE, prune: false }); + + const app = stack.node.root as cdk.App; + const template = app.synth().getStackArtifact(stack.stackName).template; + expect(template.Resources.Cluster1B02DD5A2.Properties.Config.resourcesVpcConfig.endpointPrivateAccess).toEqual(true); + expect(template.Resources.Cluster1B02DD5A2.Properties.Config.resourcesVpcConfig.endpointPublicAccess).toEqual(false); + }); + + test('kubectl provider chooses only private subnets', () => { + const { stack } = testFixture(); + + const vpc = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 2, + natGateways: 1, + subnetConfiguration: [ + { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + name: 'Private1', + }, + { + subnetType: ec2.SubnetType.PUBLIC, + name: 'Public1', + }, + ], + }); + + const cluster = new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + vpc, + }); + + cluster.addManifest('resource', { + kind: 'ConfigMap', + apiVersion: 'v1', + data: { + hello: 'world', + }, + metadata: { + name: 'config-map', + }, + }); + + // the kubectl provider is inside a nested stack. + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { + SecurityGroupIds: [ + { + Ref: 'referencetoStackCluster18DFEAC17ClusterSecurityGroupId', + }, + ], + SubnetIds: [ + { + Ref: 'referencetoStackVpcPrivate1Subnet1Subnet6764A0F6Ref', + }, + { + Ref: 'referencetoStackVpcPrivate1Subnet2SubnetDFD49645Ref', + }, + ], + }, + }); + }); + + test('kubectl provider limits number of subnets to 16', () => { + const { stack } = testFixture(); + + const subnetConfiguration: ec2.SubnetConfiguration[] = []; + + for (let i = 0; i < 20; i++) { + subnetConfiguration.push({ + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + name: `Private${i}`, + }, + ); + } + + subnetConfiguration.push({ + subnetType: ec2.SubnetType.PUBLIC, + name: 'Public1', + }); + + const vpc2 = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 2, + natGateways: 1, + subnetConfiguration, + }); + + const cluster = new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + vpc: vpc2, + }); + + cluster.addManifest('resource', { + kind: 'ConfigMap', + apiVersion: 'v1', + data: { + hello: 'world', + }, + metadata: { + name: 'config-map', + }, + }); + + // the kubectl provider is inside a nested stack. + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + const functions = Template.fromStack(nested).findResources('AWS::Lambda::Function'); + expect(functions.Handler886CB40B.Properties.VpcConfig.SubnetIds.length).toEqual(16); + }); + + test('kubectl provider considers vpc subnet selection', () => { + const { stack } = testFixture(); + + const subnetConfiguration: ec2.SubnetConfiguration[] = []; + + for (let i = 0; i < 20; i++) { + subnetConfiguration.push({ + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + name: `Private${i}`, + }, + ); + } + + subnetConfiguration.push({ + subnetType: ec2.SubnetType.PUBLIC, + name: 'Public1', + }); + + const vpc2 = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 2, + natGateways: 1, + subnetConfiguration, + }); + + const cluster = new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + endpointAccess: eks.EndpointAccess.PRIVATE, + vpc: vpc2, + vpcSubnets: [{ subnetGroupName: 'Private1' }, { subnetGroupName: 'Private2' }], + }); + + cluster.addManifest('resource', { + kind: 'ConfigMap', + apiVersion: 'v1', + data: { + hello: 'world', + }, + metadata: { + name: 'config-map', + }, + }); + + // the kubectl provider is inside a nested stack. + const nested = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(nested).hasResourceProperties('AWS::Lambda::Function', { + VpcConfig: { + SecurityGroupIds: [ + { + Ref: 'referencetoStackCluster18DFEAC17ClusterSecurityGroupId', + }, + ], + SubnetIds: [ + { + Ref: 'referencetoStackVpcPrivate1Subnet1Subnet6764A0F6Ref', + }, + { + Ref: 'referencetoStackVpcPrivate1Subnet2SubnetDFD49645Ref', + }, + { + Ref: 'referencetoStackVpcPrivate2Subnet1Subnet586AD392Ref', + }, + { + Ref: 'referencetoStackVpcPrivate2Subnet2SubnetE42148C0Ref', + }, + ], + }, + }); + }); + + test('throw when private access is configured without dns support enabled for the VPC', () => { + const { stack } = testFixture(); + + expect(() => { + new eks.Cluster(stack, 'Cluster', { + vpc: new ec2.Vpc(stack, 'Vpc', { + enableDnsSupport: false, + }), + version: CLUSTER_VERSION, + prune: false, + }); + }).toThrow(/Private endpoint access requires the VPC to have DNS support and DNS hostnames enabled/); + }); + + test('throw when private access is configured without dns hostnames enabled for the VPC', () => { + const { stack } = testFixture(); + + expect(() => { + new eks.Cluster(stack, 'Cluster', { + vpc: new ec2.Vpc(stack, 'Vpc', { + enableDnsHostnames: false, + }), + version: CLUSTER_VERSION, + prune: false, + }); + }).toThrow(/Private endpoint access requires the VPC to have DNS support and DNS hostnames enabled/); + }); + + test('throw when cidrs are configured without public access endpoint', () => { + expect(() => { + eks.EndpointAccess.PRIVATE.onlyFrom('1.2.3.4/5'); + }).toThrow(/CIDR blocks can only be configured when public access is enabled/); + }); + }); + + test('getServiceLoadBalancerAddress', () => { + const { stack } = testFixture(); + const cluster = new eks.Cluster(stack, 'Cluster1', { version: CLUSTER_VERSION, prune: false }); + + const loadBalancerAddress = cluster.getServiceLoadBalancerAddress('myservice'); + + new cdk.CfnOutput(stack, 'LoadBalancerAddress', { + value: loadBalancerAddress, + }); + + const expectedKubernetesGetId = 'Cluster1myserviceLoadBalancerAddress198CCB03'; + + let template = Template.fromStack(stack); + const resources = template.findResources('Custom::AWSCDK-EKS-KubernetesObjectValue'); + + // make sure the custom resource is created correctly + expect(resources[expectedKubernetesGetId].Properties).toEqual({ + ServiceToken: { + 'Fn::GetAtt': [ + 'awscdkawseksKubectlProviderNestedStackawscdkawseksKubectlProviderNestedStackResourceA7AEBA6B', + 'Outputs.StackawscdkawseksKubectlProviderframeworkonEvent8897FD9BArn', + ], + }, + ClusterName: { + Ref: 'Cluster1B02DD5A2', + }, + RoleArn: { + 'Fn::GetAtt': [ + 'Cluster1CreationRoleA231BE8D', + 'Arn', + ], + }, + ObjectType: 'service', + ObjectName: 'myservice', + ObjectNamespace: 'default', + JsonPath: '.status.loadBalancer.ingress[0].hostname', + TimeoutSeconds: 300, + }); + + // make sure the attribute points to the expected custom resource and extracts the correct attribute + template.hasOutput('LoadBalancerAddress', { + Value: { 'Fn::GetAtt': [expectedKubernetesGetId, 'Value'] }, + }); + }); + + test('custom kubectl layer can be provided', () => { + // GIVEN + const { stack } = testFixture(); + + // WHEN + const layer = lambda.LayerVersion.fromLayerVersionArn(stack, 'MyLayer', 'arn:of:layer'); + new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + kubectlLayer: layer, + }); + + // THEN + const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(providerStack).hasResourceProperties('AWS::Lambda::Function', { + Layers: [ + { Ref: 'AwsCliLayerF44AAF94' }, + 'arn:of:layer', + ], + }); + }); + + describe('kubectlLayer annotation', () => { + function message(version: string) { + return [ + `You created a cluster with Kubernetes Version 1.${version} without specifying the kubectlLayer property.`, + 'This may cause failures as the kubectl version provided with aws-cdk-lib is 1.20, which is only guaranteed to be compatible with Kubernetes versions 1.19-1.21.', + `Please provide a kubectlLayer from @aws-cdk/lambda-layer-kubectl-v${version}.`, + ].join(' '); + } + + test('not added when version < 1.22 and no kubectl layer provided', () => { + // GIVEN + const { stack } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster1', { + version: eks.KubernetesVersion.V1_21, + prune: false, + }); + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Stack/Cluster1', message('21')); + }); + + test('added when version >= 1.22 and no kubectl layer provided', () => { + // GIVEN + const { stack } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster1', { + version: eks.KubernetesVersion.V1_24, + prune: false, + }); + + // THEN + Annotations.fromStack(stack).hasWarning('/Stack/Cluster1', message('24')); + }); + }); + + test('custom awscli layer can be provided', () => { + // GIVEN + const { stack } = testFixture(); + + // WHEN + const layer = lambda.LayerVersion.fromLayerVersionArn(stack, 'MyLayer', 'arn:of:layer'); + new eks.Cluster(stack, 'Cluster1', { + version: CLUSTER_VERSION, + prune: false, + awscliLayer: layer, + }); + + // THEN + const providerStack = stack.node.tryFindChild('@aws-cdk/aws-eks.KubectlProvider') as cdk.NestedStack; + Template.fromStack(providerStack).hasResourceProperties('AWS::Lambda::Function', { + Layers: [ + 'arn:of:layer', + { Ref: 'KubectlLayer600207B5' }, + ], + }); + }); + + test('create a cluster using custom resource with secrets encryption using KMS CMK', () => { + // GIVEN + const { stack, vpc } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { + vpc, + version: CLUSTER_VERSION, + prune: false, + secretsEncryptionKey: new kms.Key(stack, 'Key'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { + Config: { + encryptionConfig: [{ + provider: { + keyArn: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + }, + resources: ['secrets'], + }], + }, + }); + }); + + test('custom memory size for kubectl provider', () => { + // GIVEN + const { stack, vpc, app } = testFixture(); + + // WHEN + new eks.Cluster(stack, 'Cluster', { + vpc, + version: CLUSTER_VERSION, + kubectlMemory: cdk.Size.gibibytes(2), + }); + + // THEN + const casm = app.synth(); + const providerNestedStackTemplate = JSON.parse(fs.readFileSync(path.join(casm.directory, 'StackawscdkawseksKubectlProvider7346F799.nested.template.json'), 'utf-8')); + expect(providerNestedStackTemplate?.Resources?.Handler886CB40B?.Properties?.MemorySize).toEqual(2048); + }); + + test('custom memory size for imported clusters', () => { + // GIVEN + const { stack, app } = testFixture(); + + // WHEN + const cluster = eks.Cluster.fromClusterAttributes(stack, 'Imported', { + clusterName: 'my-cluster', + kubectlRoleArn: 'arn:aws:iam::123456789012:role/MyRole', + kubectlMemory: cdk.Size.gibibytes(4), + }); + + cluster.addManifest('foo', { bar: 123 }); + + // THEN + const casm = app.synth(); + const providerNestedStackTemplate = JSON.parse(fs.readFileSync(path.join(casm.directory, 'StackStackImported1CBA9C50KubectlProviderAA00BA49.nested.template.json'), 'utf-8')); + expect(providerNestedStackTemplate?.Resources?.Handler886CB40B?.Properties?.MemorySize).toEqual(4096); + }); + + test('create a cluster using custom kubernetes network config', () => { + // GIVEN + const { stack } = testFixture(); + const customCidr = '172.16.0.0/12'; + + // WHEN + new eks.Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + serviceIpv4Cidr: customCidr, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWSCDK-EKS-Cluster', { + Config: { + kubernetesNetworkConfig: { + serviceIpv4Cidr: customCidr, + }, + }, + }); + }); +}); diff --git a/packages/@aws-cdk/aws-eks/test/compareLog.test.ts b/packages/aws-cdk-lib/aws-eks/test/compareLog.test.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/compareLog.test.ts rename to packages/aws-cdk-lib/aws-eks/test/compareLog.test.ts diff --git a/packages/@aws-cdk/aws-eks/test/example.ssh-into-nodes.lit.ts b/packages/aws-cdk-lib/aws-eks/test/example.ssh-into-nodes.lit.ts similarity index 90% rename from packages/@aws-cdk/aws-eks/test/example.ssh-into-nodes.lit.ts rename to packages/aws-cdk-lib/aws-eks/test/example.ssh-into-nodes.lit.ts index 63cedbca45c53..7412b4b996a4d 100644 --- a/packages/@aws-cdk/aws-eks/test/example.ssh-into-nodes.lit.ts +++ b/packages/aws-cdk-lib/aws-eks/test/example.ssh-into-nodes.lit.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import * as eks from '../lib'; class EksClusterStack extends cdk.Stack { diff --git a/packages/@aws-cdk/aws-eks/test/fargate-resource-provider.test.ts b/packages/aws-cdk-lib/aws-eks/test/fargate-resource-provider.test.ts similarity index 100% rename from packages/@aws-cdk/aws-eks/test/fargate-resource-provider.test.ts rename to packages/aws-cdk-lib/aws-eks/test/fargate-resource-provider.test.ts diff --git a/packages/@aws-cdk/aws-eks/test/fargate.test.ts b/packages/aws-cdk-lib/aws-eks/test/fargate.test.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/test/fargate.test.ts rename to packages/aws-cdk-lib/aws-eks/test/fargate.test.ts index 9098a9e1b4777..639a0a6ab224a 100644 --- a/packages/@aws-cdk/aws-eks/test/fargate.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/fargate.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { Stack, Tags } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { Stack, Tags } from '../../core'; import * as eks from '../lib'; const CLUSTER_VERSION = eks.KubernetesVersion.V1_25; diff --git a/packages/aws-cdk-lib/aws-eks/test/hello-k8s.ts b/packages/aws-cdk-lib/aws-eks/test/hello-k8s.ts new file mode 100644 index 0000000000000..bcf0f464b2d07 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/hello-k8s.ts @@ -0,0 +1,35 @@ +export const resources = [ + { + apiVersion: 'v1', + kind: 'Service', + metadata: { name: 'hello-kubernetes' }, + spec: { + type: 'LoadBalancer', + ports: [{ port: 80, targetPort: 8080 }], + selector: { app: 'hello-kubernetes' }, + }, + }, + { + apiVersion: 'apps/v1', + kind: 'Deployment', + metadata: { name: 'hello-kubernetes' }, + spec: { + replicas: 1, + selector: { matchLabels: { app: 'hello-kubernetes' } }, + template: { + metadata: { + labels: { app: 'hello-kubernetes' }, + }, + spec: { + containers: [ + { + name: 'hello-kubernetes', + image: 'paulbouwer/hello-kubernetes:1.5', + ports: [{ containerPort: 8080 }], + }, + ], + }, + }, + }, + }, +]; \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/helm-chart.test.ts b/packages/aws-cdk-lib/aws-eks/test/helm-chart.test.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/test/helm-chart.test.ts rename to packages/aws-cdk-lib/aws-eks/test/helm-chart.test.ts index 3587d4071bb2d..f2cd895abbea9 100644 --- a/packages/@aws-cdk/aws-eks/test/helm-chart.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/helm-chart.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import { Asset } from '@aws-cdk/aws-s3-assets'; -import { Duration } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Asset } from '../../aws-s3-assets'; +import { Duration } from '../../core'; import { testFixtureCluster } from './util'; import * as eks from '../lib'; diff --git a/packages/@aws-cdk/aws-eks/test/k8s-manifest.test.ts b/packages/aws-cdk-lib/aws-eks/test/k8s-manifest.test.ts similarity index 99% rename from packages/@aws-cdk/aws-eks/test/k8s-manifest.test.ts rename to packages/aws-cdk-lib/aws-eks/test/k8s-manifest.test.ts index 739791e1b6f52..11bbac8ea653d 100644 --- a/packages/@aws-cdk/aws-eks/test/k8s-manifest.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/k8s-manifest.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { CfnResource, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { CfnResource, Stack } from '../../core'; import { testFixtureNoVpc, testFixtureCluster } from './util'; import { Cluster, KubernetesManifest, KubernetesVersion, HelmChart } from '../lib'; diff --git a/packages/@aws-cdk/aws-eks/test/k8s-object-value.test.ts b/packages/aws-cdk-lib/aws-eks/test/k8s-object-value.test.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/test/k8s-object-value.test.ts rename to packages/aws-cdk-lib/aws-eks/test/k8s-object-value.test.ts index 4e92a07db79a2..61224b0266888 100644 --- a/packages/@aws-cdk/aws-eks/test/k8s-object-value.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/k8s-object-value.test.ts @@ -1,4 +1,4 @@ -import { App, Stack, Duration } from '@aws-cdk/core'; +import { App, Stack, Duration } from '../../core'; import * as eks from '../lib'; import { KubernetesObjectValue } from '../lib/k8s-object-value'; diff --git a/packages/@aws-cdk/aws-eks/test/k8s-patch.test.ts b/packages/aws-cdk-lib/aws-eks/test/k8s-patch.test.ts similarity index 97% rename from packages/@aws-cdk/aws-eks/test/k8s-patch.test.ts rename to packages/aws-cdk-lib/aws-eks/test/k8s-patch.test.ts index e10039c0f6f13..91a4caf53f953 100644 --- a/packages/@aws-cdk/aws-eks/test/k8s-patch.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/k8s-patch.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Names, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Names, Stack } from '../../core'; import * as eks from '../lib'; import { KubernetesPatch, PatchType } from '../lib/k8s-patch'; diff --git a/packages/@aws-cdk/aws-eks/test/nodegroup.test.ts b/packages/aws-cdk-lib/aws-eks/test/nodegroup.test.ts similarity index 99% rename from packages/@aws-cdk/aws-eks/test/nodegroup.test.ts rename to packages/aws-cdk-lib/aws-eks/test/nodegroup.test.ts index 9b9cb82c688fb..47b9a2a496849 100644 --- a/packages/@aws-cdk/aws-eks/test/nodegroup.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/nodegroup.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { testFixture } from './util'; import * as eks from '../lib'; import { NodegroupAmiType } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-eks/test/pinger/function/index.py b/packages/aws-cdk-lib/aws-eks/test/pinger/function/index.py new file mode 100644 index 0000000000000..e8c0c218a031f --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/pinger/function/index.py @@ -0,0 +1,24 @@ +import json +import logging +import urllib3 + +logger = logging.getLogger() +logger.setLevel(logging.INFO) +http = urllib3.PoolManager() + +def handler(event, context): + print(json.dumps(event)) + + request_type = event['RequestType'] + props = event['ResourceProperties'] + + url = props['Url'] + + if request_type in ['Create', 'Update']: + logger.info(f'Sending request to {url}') + # this should a substantial retry because it has to wait for the ELB to actually + # be functioning + response = http.request('GET', url, retries=urllib3.Retry(10, backoff_factor=1)) + if response.status != 200: + raise RuntimeError(f'Request failed: {response.status} ({response.reason})') + return {'Data': {'Value': response.data.decode('utf-8')}} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-eks/test/pinger/pinger.ts b/packages/aws-cdk-lib/aws-eks/test/pinger/pinger.ts new file mode 100644 index 0000000000000..10b2efc626764 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/pinger/pinger.ts @@ -0,0 +1,45 @@ +import * as ec2 from '../../../aws-ec2'; +import * as lambda from '../../../aws-lambda'; +import { CustomResource, Token, Duration } from '../../../core'; +import * as cr from '../../../custom-resources'; +import { Construct } from 'constructs'; + +export interface PingerProps { + readonly url: string; + readonly securityGroup?: ec2.SecurityGroup; + readonly vpc?: ec2.IVpc; + readonly subnets?: ec2.ISubnet[]; +} +export class Pinger extends Construct { + + private _resource: CustomResource; + + constructor(scope: Construct, id: string, props: PingerProps) { + super(scope, id); + + const func = new lambda.Function(this, 'Function', { + code: lambda.Code.fromAsset(`${__dirname}/function`), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + vpc: props.vpc, + vpcSubnets: props.subnets ? { subnets: props.subnets } : undefined, + securityGroups: props.securityGroup ? [props.securityGroup] : undefined, + timeout: Duration.minutes(10), + }); + + const provider = new cr.Provider(this, 'Provider', { + onEventHandler: func, + }); + + this._resource = new CustomResource(this, 'Resource', { + serviceToken: provider.serviceToken, + properties: { + Url: props.url, + }, + }); + } + + public get response() { + return Token.asString(this._resource.getAtt('Value')); + } +} diff --git a/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore b/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore new file mode 100644 index 0000000000000..3c3629e647f5d --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/.dockerignore @@ -0,0 +1 @@ +node_modules diff --git a/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile b/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile new file mode 100644 index 0000000000000..0ad77c9878f25 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/Dockerfile @@ -0,0 +1,17 @@ +FROM public.ecr.aws/docker/library/node:16-alpine3.13 + +# Create app directory +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# Install app dependencies +COPY package.json /usr/src/app/ +COPY package-lock.json /usr/src/app/ +RUN npm ci + +# Bundle app source +COPY . /usr/src/app + +USER node + +CMD [ "node", "sdk-call.js" ] diff --git a/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json b/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json new file mode 100644 index 0000000000000..20b1107dec633 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/sdk-call-integ-test-docker-app/app/package-lock.json @@ -0,0 +1,1210 @@ +{ + "name": "eks-service-account-sdk-call-integ-test", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "eks-service-account-sdk-call-integ-test", + "dependencies": { + "aws-sdk": "^2.1226.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/aws-sdk": { + "version": "2.1241.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1241.0.tgz", + "integrity": "sha512-62Zhl5pVD5GN1ZdzEEyNxdH20zMlJBUaiQ7epCHnt+Zp12nd9y0uOHHiWWGDOrECQX/KAUIcDBiE4B04MeqP4g==", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-abstract": { + "version": "1.20.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz", + "integrity": "sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==", + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.3", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.2", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" + }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", + "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==", + "engines": { + "node": ">=4.0" + } + } + }, + "dependencies": { + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + }, + "aws-sdk": { + "version": "2.1241.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1241.0.tgz", + "integrity": "sha512-62Zhl5pVD5GN1ZdzEEyNxdH20zMlJBUaiQ7epCHnt+Zp12nd9y0uOHHiWWGDOrECQX/KAUIcDBiE4B04MeqP4g==", + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "util": "^0.12.4", + "uuid": "8.0.0", + "xml2js": "0.4.19" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "requires": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "es-abstract": { + "version": "1.20.4", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz", + "integrity": "sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA==", + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "function.prototype.name": "^1.1.5", + "get-intrinsic": "^1.1.3", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.2", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.4.3", + "safe-regex-test": "^1.0.0", + "string.prototype.trimend": "^1.0.5", + "string.prototype.trimstart": "^1.0.5", + "unbox-primitive": "^1.0.2" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==" + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "function.prototype.name": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", + "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0", + "functions-have-names": "^1.2.2" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==" + }, + "get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==" + }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "requires": { + "get-intrinsic": "^1.1.1" + } + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==" + }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0" + } + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "requires": { + "call-bind": "^1.0.2" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==" + }, + "object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==" + }, + "regexp.prototype.flags": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", + "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "functions-have-names": "^1.2.2" + } + }, + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + } + }, + "sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==" + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "string.prototype.trimend": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", + "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } + }, + "string.prototype.trimstart": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", + "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.19.5" + } + }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, + "url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "uuid": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz", + "integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw==" + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "which-typed-array": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.20.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.9" + } + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ==" + } + } +} diff --git a/packages/@aws-cdk/aws-eks/test/service-account.test.ts b/packages/aws-cdk-lib/aws-eks/test/service-account.test.ts similarity index 99% rename from packages/@aws-cdk/aws-eks/test/service-account.test.ts rename to packages/aws-cdk-lib/aws-eks/test/service-account.test.ts index 24ccce73ed1cf..d673f67ec0e70 100644 --- a/packages/@aws-cdk/aws-eks/test/service-account.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/service-account.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; import { testFixture, testFixtureCluster } from './util'; import * as eks from '../lib'; diff --git a/packages/aws-cdk-lib/aws-eks/test/test-chart/Chart.yaml b/packages/aws-cdk-lib/aws-eks/test/test-chart/Chart.yaml new file mode 100644 index 0000000000000..ec02a39ef974d --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/test-chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for kubernetes +name: test-chart +version: 0.0.0 \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/test/user-data.test.ts b/packages/aws-cdk-lib/aws-eks/test/user-data.test.ts similarity index 98% rename from packages/@aws-cdk/aws-eks/test/user-data.test.ts rename to packages/aws-cdk-lib/aws-eks/test/user-data.test.ts index ddcb2fcd3f647..0eee836277574 100644 --- a/packages/@aws-cdk/aws-eks/test/user-data.test.ts +++ b/packages/aws-cdk-lib/aws-eks/test/user-data.test.ts @@ -1,6 +1,6 @@ -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { App, Stack } from '@aws-cdk/core'; +import * as autoscaling from '../../aws-autoscaling'; +import * as ec2 from '../../aws-ec2'; +import { App, Stack } from '../../core'; import { Cluster, KubernetesVersion } from '../lib/cluster'; import { renderAmazonLinuxUserData } from '../lib/user-data'; diff --git a/packages/aws-cdk-lib/aws-eks/test/util.ts b/packages/aws-cdk-lib/aws-eks/test/util.ts new file mode 100644 index 0000000000000..eb3dde40a4560 --- /dev/null +++ b/packages/aws-cdk-lib/aws-eks/test/util.ts @@ -0,0 +1,29 @@ +import * as ec2 from '../../aws-ec2'; +import { App, Stack } from '../../core'; +import { Cluster, ClusterProps, KubernetesVersion } from '../lib'; + +const CLUSTER_VERSION = KubernetesVersion.V1_25; + +export function testFixture() { + const { stack, app } = testFixtureNoVpc(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + return { stack, vpc, app }; +} + +export function testFixtureNoVpc() { + const app = new App(); + const stack = new Stack(app, 'Stack', { env: { region: 'us-east-1' } }); + return { stack, app }; +} + +export function testFixtureCluster(props: Omit = {}) { + const { stack, app } = testFixtureNoVpc(); + const cluster = new Cluster(stack, 'Cluster', { + version: CLUSTER_VERSION, + prune: false, // mainly because this feature was added later and we wanted to avoid having to update all test expectations.... + ...props, + }); + + return { stack, app, cluster }; +} diff --git a/packages/aws-cdk-lib/aws-elasticache/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticache/.jsiirc.json new file mode 100644 index 0000000000000..6b52ef1216f1a --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticache/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticache" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ElastiCache" + }, + "python": { + "module": "aws_cdk.aws_elasticache" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticache/README.md b/packages/aws-cdk-lib/aws-elasticache/README.md new file mode 100644 index 0000000000000..6e6624c795b27 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticache/README.md @@ -0,0 +1,27 @@ +# Amazon ElastiCache Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as elasticache from 'aws-cdk-lib/aws-elasticache'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ElastiCache construct libraries](https://constructs.dev/search?q=elasticache) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ElastiCache resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElastiCache.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ElastiCache](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElastiCache.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-elasticache/index.ts b/packages/aws-cdk-lib/aws-elasticache/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticache/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-elasticache/lib/index.ts b/packages/aws-cdk-lib/aws-elasticache/lib/index.ts new file mode 100644 index 0000000000000..28eecafee35a1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticache/lib/index.ts @@ -0,0 +1 @@ +export * from './elasticache.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-elasticbeanstalk/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticbeanstalk/.jsiirc.json new file mode 100644 index 0000000000000..a2b74ff962941 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticbeanstalk/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticbeanstalk" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ElasticBeanstalk" + }, + "python": { + "module": "aws_cdk.aws_elasticbeanstalk" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticbeanstalk/README.md b/packages/aws-cdk-lib/aws-elasticbeanstalk/README.md new file mode 100644 index 0000000000000..24ecc96171550 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticbeanstalk/README.md @@ -0,0 +1,27 @@ +# AWS Elastic Beanstalk Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as elasticbeanstalk from 'aws-cdk-lib/aws-elasticbeanstalk'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ElasticBeanstalk construct libraries](https://constructs.dev/search?q=elasticbeanstalk) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ElasticBeanstalk resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElasticBeanstalk.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ElasticBeanstalk](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ElasticBeanstalk.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-elasticbeanstalk/index.ts b/packages/aws-cdk-lib/aws-elasticbeanstalk/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticbeanstalk/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-elasticbeanstalk/lib/index.ts b/packages/aws-cdk-lib/aws-elasticbeanstalk/lib/index.ts new file mode 100644 index 0000000000000..a744bf9659a81 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticbeanstalk/lib/index.ts @@ -0,0 +1 @@ +export * from './elasticbeanstalk.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancing/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticloadbalancing/.jsiirc.json new file mode 100644 index 0000000000000..1a1716b6eb4e3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancing/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticloadbalancing" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ElasticLoadBalancing" + }, + "python": { + "module": "aws_cdk.aws_elasticloadbalancing" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancing/README.md b/packages/aws-cdk-lib/aws-elasticloadbalancing/README.md new file mode 100644 index 0000000000000..7c98f5c3d5233 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancing/README.md @@ -0,0 +1,57 @@ +# Amazon Elastic Load Balancing Construct Library + + +The `@aws-cdk/aws-elasticloadbalancing` package provides constructs for configuring +classic load balancers. + +## Configuring a Load Balancer + +Load balancers send traffic to one or more AutoScalingGroups. Create a load +balancer, set up listeners and a health check, and supply the fleet(s) you want +to load balance to in the `targets` property. + +```ts +declare const vpc: ec2.IVpc; +const lb = new elb.LoadBalancer(this, 'LB', { + vpc, + internetFacing: true, + healthCheck: { + port: 80, + }, +}); + +declare const myAutoScalingGroup: autoscaling.AutoScalingGroup; +lb.addTarget(myAutoScalingGroup); +lb.addListener({ + externalPort: 80, +}); +``` + +The load balancer allows all connections by default. If you want to change that, +pass the `allowConnectionsFrom` property while setting up the listener: + +```ts +declare const mySecurityGroup: ec2.SecurityGroup; +declare const lb: elb.LoadBalancer; +lb.addListener({ + externalPort: 80, + allowConnectionsFrom: [mySecurityGroup], +}); +``` + +### Adding Ec2 Instance as a target for the load balancer + +You can add an EC2 instance to the load balancer by calling using `new InstanceTarget` as the argument to `addTarget()`: + +```ts +const lb = new elb.LoadBalancer(this, 'LB', { + vpc, +}); +// instance to add as the target for load balancer. +const instance = new Instance(stack, 'targetInstance', { + vpc: vpc, + instanceType: InstanceType.of(InstanceClass.BURSTABLE2, InstanceSize.MICRO), + machineImage: new AmazonLinuxImage(), +}); +lb.addTarget(elb.InstanceTarget(instance)); +``` diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancing/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancing/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancing/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/lib/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancing/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancing/lib/index.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancing/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancing/lib/load-balancer.ts b/packages/aws-cdk-lib/aws-elasticloadbalancing/lib/load-balancer.ts new file mode 100644 index 0000000000000..bba10b2e8f3d2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancing/lib/load-balancer.ts @@ -0,0 +1,511 @@ +import { + Connections, IConnectable, Instance, ISecurityGroup, IVpc, Peer, Port, + SecurityGroup, SelectedSubnets, SubnetSelection, SubnetType, +} from '../../aws-ec2'; +import { Duration, Lazy, Resource } from '../../core'; +import { Construct } from 'constructs'; +import { CfnLoadBalancer } from './elasticloadbalancing.generated'; + +/** + * Construction properties for a LoadBalancer + */ +export interface LoadBalancerProps { + /** + * VPC network of the fleet instances + */ + readonly vpc: IVpc; + + /** + * Whether this is an internet-facing Load Balancer + * + * This controls whether the LB has a public IP address assigned. It does + * not open up the Load Balancer's security groups to public internet access. + * + * @default false + */ + readonly internetFacing?: boolean; + + /** + * What listeners to set up for the load balancer. + * + * Can also be added by .addListener() + * + * @default - + */ + readonly listeners?: LoadBalancerListener[]; + + /** + * What targets to load balance to. + * + * Can also be added by .addTarget() + * + * @default - None. + */ + readonly targets?: ILoadBalancerTarget[]; + + /** + * Health check settings for the load balancing targets. + * + * Not required but recommended. + * + * @default - None. + */ + readonly healthCheck?: HealthCheck; + + /** + * Whether cross zone load balancing is enabled + * + * This controls whether the load balancer evenly distributes requests + * across each availability zone + * + * @default true + */ + readonly crossZone?: boolean; + + /** + * Which subnets to deploy the load balancer + * + * Can be used to define a specific set of subnets to deploy the load balancer to. + * Useful multiple public or private subnets are covering the same availability zone. + * + * @default - Public subnets if internetFacing, Private subnets otherwise + */ + readonly subnetSelection?: SubnetSelection; + + /** + * Enable Loadbalancer access logs + * Can be used to avoid manual work as aws console + * Required S3 bucket name , enabled flag + * Can add interval for pushing log + * Can set bucket prefix in order to provide folder name inside bucket + * @default - disabled + */ + readonly accessLoggingPolicy?: CfnLoadBalancer.AccessLoggingPolicyProperty; + +} + +/** + * Describe the health check to a load balancer + */ +export interface HealthCheck { + /** + * What port number to health check on + */ + readonly port: number; + + /** + * What protocol to use for health checking + * + * The protocol is automatically determined from the port if it's not supplied. + * + * @default Automatic + */ + readonly protocol?: LoadBalancingProtocol; + + /** + * What path to use for HTTP or HTTPS health check (must return 200) + * + * For SSL and TCP health checks, accepting connections is enough to be considered + * healthy. + * + * @default "/" + */ + readonly path?: string; + + /** + * After how many successful checks is an instance considered healthy + * + * @default 2 + */ + readonly healthyThreshold?: number; + + /** + * After how many unsuccessful checks is an instance considered unhealthy + * + * @default 5 + */ + readonly unhealthyThreshold?: number; + + /** + * Number of seconds between health checks + * + * @default Duration.seconds(30) + */ + readonly interval?: Duration; + + /** + * Health check timeout + * + * @default Duration.seconds(5) + */ + readonly timeout?: Duration; +} + +/** + * Interface that is going to be implemented by constructs that you can load balance to + */ +export interface ILoadBalancerTarget extends IConnectable { + /** + * Attach load-balanced target to a classic ELB + * @param loadBalancer [disable-awslint:ref-via-interface] The load balancer to attach the target to + */ + attachToClassicLB(loadBalancer: LoadBalancer): void; +} + +/** + * Add a backend to the load balancer + */ +export interface LoadBalancerListener { + /** + * External listening port + */ + readonly externalPort: number; + + /** + * What public protocol to use for load balancing + * + * Either 'tcp', 'ssl', 'http' or 'https'. + * + * May be omitted if the external port is either 80 or 443. + */ + readonly externalProtocol?: LoadBalancingProtocol; + + /** + * Instance listening port + * + * Same as the externalPort if not specified. + * + * @default externalPort + */ + readonly internalPort?: number; + + /** + * What public protocol to use for load balancing + * + * Either 'tcp', 'ssl', 'http' or 'https'. + * + * May be omitted if the internal port is either 80 or 443. + * + * The instance protocol is 'tcp' if the front-end protocol + * is 'tcp' or 'ssl', the instance protocol is 'http' if the + * front-end protocol is 'https'. + */ + readonly internalProtocol?: LoadBalancingProtocol; + + /** + * SSL policy names + */ + readonly policyNames?: string[]; + + /** + * the ARN of the SSL certificate + * @deprecated - use sslCertificateArn instead + */ + readonly sslCertificateId?: string; + + /** + * the ARN of the SSL certificate + * + * @default - none + */ + readonly sslCertificateArn?: string; + + /** + * Allow connections to the load balancer from the given set of connection peers + * + * By default, connections will be allowed from anywhere. Set this to an empty list + * to deny connections, or supply a custom list of peers to allow connections from + * (IP ranges or security groups). + * + * @default Anywhere + */ + readonly allowConnectionsFrom?: IConnectable[]; +} + +export enum LoadBalancingProtocol { + TCP = 'tcp', + SSL = 'ssl', + HTTP = 'http', + HTTPS = 'https' +} + +/** + * A load balancer with a single listener + * + * Routes to a fleet of of instances in a VPC. + */ +export class LoadBalancer extends Resource implements IConnectable { + /** + * Control all connections from and to this load balancer + */ + public readonly connections: Connections; + + /** + * An object controlling specifically the connections for each listener added to this load balancer + */ + public readonly listenerPorts: ListenerPort[] = []; + + private readonly elb: CfnLoadBalancer; + private readonly securityGroup: SecurityGroup; + private readonly listeners: CfnLoadBalancer.ListenersProperty[] = []; + + private readonly instancePorts: number[] = []; + private readonly targets: ILoadBalancerTarget[] = []; + private readonly instanceIds: string[] = []; + + constructor(scope: Construct, id: string, props: LoadBalancerProps) { + super(scope, id); + + this.securityGroup = new SecurityGroup(this, 'SecurityGroup', { vpc: props.vpc, allowAllOutbound: false }); + this.connections = new Connections({ securityGroups: [this.securityGroup] }); + // Depending on whether the ELB has public or internal IPs, pick the right backend subnets + const selectedSubnets: SelectedSubnets = loadBalancerSubnets(props); + + this.elb = new CfnLoadBalancer(this, 'Resource', { + securityGroups: [this.securityGroup.securityGroupId], + subnets: selectedSubnets.subnetIds, + listeners: Lazy.any({ produce: () => this.listeners }), + instances: Lazy.list({ produce: () => this.instanceIds }, { omitEmpty: true }), + scheme: props.internetFacing ? 'internet-facing' : 'internal', + healthCheck: props.healthCheck && healthCheckToJSON(props.healthCheck), + crossZone: props.crossZone ?? true, + }); + if (props.internetFacing) { + this.elb.node.addDependency(selectedSubnets.internetConnectivityEstablished); + } + + if (props.accessLoggingPolicy !== undefined) { + this.elb.accessLoggingPolicy = props.accessLoggingPolicy; + } + + ifUndefined(props.listeners, []).forEach(b => this.addListener(b)); + ifUndefined(props.targets, []).forEach(t => this.addTarget(t)); + } + + /** + * Add a backend to the load balancer + * + * @returns A ListenerPort object that controls connections to the listener port + */ + public addListener(listener: LoadBalancerListener): ListenerPort { + if (listener.sslCertificateArn && listener.sslCertificateId) { + throw new Error('"sslCertificateId" is deprecated, please use "sslCertificateArn" only.'); + } + const protocol = ifUndefinedLazy(listener.externalProtocol, () => wellKnownProtocol(listener.externalPort)); + const instancePort = listener.internalPort || listener.externalPort; + const sslCertificateArn = listener.sslCertificateArn || listener.sslCertificateId; + const instanceProtocol = ifUndefined(listener.internalProtocol, + ifUndefined(tryWellKnownProtocol(instancePort), + isHttpProtocol(protocol) ? LoadBalancingProtocol.HTTP : LoadBalancingProtocol.TCP)); + + this.listeners.push({ + loadBalancerPort: listener.externalPort.toString(), + protocol, + instancePort: instancePort.toString(), + instanceProtocol, + sslCertificateId: sslCertificateArn, + policyNames: listener.policyNames, + }); + + const port = new ListenerPort(this.securityGroup, Port.tcp(listener.externalPort)); + + // Allow connections on the public port for all supplied peers (default: everyone) + ifUndefined(listener.allowConnectionsFrom, [Peer.anyIpv4()]).forEach(peer => { + port.connections.allowDefaultPortFrom(peer, `Default rule allow on ${listener.externalPort}`); + }); + + this.newInstancePort(instancePort); + + // Keep track using array so user can get to them even if they were all supplied in the constructor + this.listenerPorts.push(port); + + return port; + } + + public addTarget(target: ILoadBalancerTarget) { + target.attachToClassicLB(this); + + this.newTarget(target); + } + + /** + * @attribute + */ + public get loadBalancerName() { + return this.elb.ref; + } + + /** + * @attribute + */ + public get loadBalancerCanonicalHostedZoneNameId() { + return this.elb.attrCanonicalHostedZoneNameId; + } + + /** + * @attribute + */ + public get loadBalancerCanonicalHostedZoneName() { + return this.elb.attrCanonicalHostedZoneName; + } + + /** + * @attribute + */ + public get loadBalancerDnsName() { + return this.elb.attrDnsName; + } + + /** + * @attribute + */ + public get loadBalancerSourceSecurityGroupGroupName() { + return this.elb.attrSourceSecurityGroupGroupName; + } + + /** + * @attribute + */ + public get loadBalancerSourceSecurityGroupOwnerAlias() { + return this.elb.attrSourceSecurityGroupOwnerAlias; + } + + /** + * Allow connections to all existing targets on new instance port + */ + private newInstancePort(instancePort: number) { + this.targets.forEach(t => this.allowTargetConnection(instancePort, t)); + + // Keep track of port for future targets + this.instancePorts.push(instancePort); + } + + /** + * Allow connections to target on all existing instance ports + */ + private newTarget(target: ILoadBalancerTarget) { + this.instancePorts.forEach(p => this.allowTargetConnection(p, target)); + + // Keep track of target for future listeners. + this.targets.push(target); + } + + /** + * Allow connections for a single (port, target) pair + */ + private allowTargetConnection(instancePort: number, target: ILoadBalancerTarget) { + this.connections.allowTo( + target, + Port.tcp(instancePort), + `Port ${instancePort} LB to fleet`); + } + + /** + * Add instance to the load balancer. + * @internal + */ + public _addInstanceId(instanceId: string) { + this.instanceIds.push(instanceId); + } +} + +/** + * An EC2 instance that is the target for load balancing + */ +export class InstanceTarget implements ILoadBalancerTarget { + readonly connections: Connections; + /** + * Create a new Instance target. + * + * @param instance Instance to register to. + */ + constructor(public readonly instance: Instance) { + this.connections = instance.connections; + } + + public attachToClassicLB(loadBalancer: LoadBalancer): void { + loadBalancer._addInstanceId(this.instance.instanceId); + } +} + +/** + * Reference to a listener's port just created. + * + * This implements IConnectable with a default port (the port that an ELB + * listener was just created on) for a given security group so that it can be + * conveniently used just like any Connectable. E.g: + * + * const listener = elb.addListener(...); + * + * listener.connections.allowDefaultPortFromAnyIPv4(); + * // or + * instance.connections.allowToDefaultPort(listener); + */ +export class ListenerPort implements IConnectable { + public readonly connections: Connections; + + constructor(securityGroup: ISecurityGroup, defaultPort: Port) { + this.connections = new Connections({ securityGroups: [securityGroup], defaultPort }); + } +} + +function wellKnownProtocol(port: number): LoadBalancingProtocol { + const proto = tryWellKnownProtocol(port); + if (!proto) { + throw new Error(`Please supply protocol to go with port ${port}`); + } + return proto; +} + +function tryWellKnownProtocol(port: number): LoadBalancingProtocol | undefined { + if (port === 80) { return LoadBalancingProtocol.HTTP; } + if (port === 443) { return LoadBalancingProtocol.HTTPS; } + return undefined; +} + +function isHttpProtocol(proto: LoadBalancingProtocol): boolean { + return proto === LoadBalancingProtocol.HTTPS || proto === LoadBalancingProtocol.HTTP; +} + +function ifUndefined(x: T | undefined, def: T): T { + return x != null ? x : def; +} + +function ifUndefinedLazy(x: T | undefined, def: () => T): T { + return x != null ? x : def(); +} + +/** + * Turn health check parameters into a parameter blob for the LB + */ +function healthCheckToJSON(healthCheck: HealthCheck): CfnLoadBalancer.HealthCheckProperty { + const protocol = ifUndefined(healthCheck.protocol, + ifUndefined(tryWellKnownProtocol(healthCheck.port), + LoadBalancingProtocol.TCP)); + + const path = protocol === LoadBalancingProtocol.HTTP || protocol === LoadBalancingProtocol.HTTPS ? ifUndefined(healthCheck.path, '/') : ''; + + const target = `${protocol.toUpperCase()}:${healthCheck.port}${path}`; + + return { + healthyThreshold: ifUndefined(healthCheck.healthyThreshold, 2).toString(), + interval: (healthCheck.interval || Duration.seconds(30)).toSeconds().toString(), + target, + timeout: (healthCheck.timeout || Duration.seconds(5)).toSeconds().toString(), + unhealthyThreshold: ifUndefined(healthCheck.unhealthyThreshold, 5).toString(), + }; +} + +function loadBalancerSubnets(props: LoadBalancerProps): SelectedSubnets { + if (props.subnetSelection !== undefined) { + return props.vpc.selectSubnets(props.subnetSelection); + } else if (props.internetFacing) { + return props.vpc.selectSubnets({ + subnetType: SubnetType.PUBLIC, + }); + } else { + return props.vpc.selectSubnets({ + subnetType: SubnetType.PRIVATE_WITH_EGRESS, + }); + } +} diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/test/loadbalancer.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancing/test/loadbalancer.test.ts similarity index 98% rename from packages/@aws-cdk/aws-elasticloadbalancing/test/loadbalancer.test.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancing/test/loadbalancer.test.ts index 8eabd5ffb1407..b190f2a9327cf 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/test/loadbalancer.test.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancing/test/loadbalancer.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { AmazonLinuxGeneration, Connections, Instance, InstanceClass, InstanceSize, InstanceType, MachineImage, Peer, SubnetType, Vpc } from '@aws-cdk/aws-ec2'; +import { Template } from '../../assertions'; +import { AmazonLinuxGeneration, Connections, Instance, InstanceClass, InstanceSize, InstanceType, MachineImage, Peer, SubnetType, Vpc } from '../../aws-ec2'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Duration, Stack } from '../../core'; import { ILoadBalancerTarget, InstanceTarget, LoadBalancer, LoadBalancingProtocol } from '../lib'; describe('tests', () => { diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/.jsiirc.json new file mode 100644 index 0000000000000..d1141936e6230 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticloadbalancingv2.actions" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ElasticLoadBalancingV2.Actions" + }, + "python": { + "module": "aws_cdk.aws_elasticloadbalancingv2_actions" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/README.md b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/README.md new file mode 100644 index 0000000000000..2aae5adeddecc --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/README.md @@ -0,0 +1,68 @@ +# Actions for AWS Elastic Load Balancing V2 + + +This package contains integration actions for ELBv2. See the README of the `@aws-cdk/aws-elasticloadbalancingv2` library. + +## Cognito + +ELB allows for requests to be authenticated against a Cognito user pool using +the `AuthenticateCognitoAction`. For details on the setup's requirements, +read [Prepare to use Amazon +Cognito](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html#cognito-requirements). +Here's an example: + +```ts +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, +}); + +const userPool = new cognito.UserPool(this, 'UserPool'); +const userPoolClient = new cognito.UserPoolClient(this, 'Client', { + userPool, + + // Required minimal configuration for use with an ELB + generateSecret: true, + authFlows: { + userPassword: true, + }, + oAuth: { + flows: { + authorizationCodeGrant: true, + }, + scopes: [cognito.OAuthScope.EMAIL], + callbackUrls: [ + `https://${lb.loadBalancerDnsName}/oauth2/idpresponse`, + ], + }, +}); +const cfnClient = userPoolClient.node.defaultChild as cognito.CfnUserPoolClient; +cfnClient.addPropertyOverride('RefreshTokenValidity', 1); +cfnClient.addPropertyOverride('SupportedIdentityProviders', ['COGNITO']); + +const userPoolDomain = new cognito.UserPoolDomain(this, 'Domain', { + userPool, + cognitoDomain: { + domainPrefix: 'test-cdk-prefix', + }, +}); + +lb.addListener('Listener', { + port: 443, + certificates: [certificate], + defaultAction: new actions.AuthenticateCognitoAction({ + userPool, + userPoolClient, + userPoolDomain, + next: elbv2.ListenerAction.fixedResponse(200, { + contentType: 'text/plain', + messageBody: 'Authenticated', + }), + }), +}); + +new CfnOutput(this, 'DNS', { + value: lb.loadBalancerDnsName, +}); + +``` diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/lib/cognito-action.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/lib/cognito-action.ts similarity index 94% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/lib/cognito-action.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/lib/cognito-action.ts index 13b725a3deb3b..48127a61d57e3 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/lib/cognito-action.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/lib/cognito-action.ts @@ -1,6 +1,6 @@ -import * as cognito from '@aws-cdk/aws-cognito'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Duration } from '@aws-cdk/core'; +import * as cognito from '../../aws-cognito'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { Duration } from '../../core'; /** * Properties for AuthenticateCognitoAction diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-actions/lib/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-actions/lib/index.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/test/cognito.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/test/cognito.test.ts new file mode 100644 index 0000000000000..9fcce5627a7b7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-actions/test/cognito.test.ts @@ -0,0 +1,60 @@ +import { Template } from '../../assertions'; +import * as cognito from '../../aws-cognito'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { Stack } from '../../core'; +import * as actions from '../lib'; + +test('Cognito Action', () => { + // GIVEN + const stack = new Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + const userPool = new cognito.UserPool(stack, 'UserPool'); + const userPoolClient = new cognito.UserPoolClient(stack, 'Client', { userPool }); + const userPoolDomain = new cognito.UserPoolDomain(stack, 'Domain', { + userPool, + cognitoDomain: { + domainPrefix: 'prefix', + }, + }); + + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: new actions.AuthenticateCognitoAction({ + userPool, + userPoolClient, + userPoolDomain, + next: elbv2.ListenerAction.fixedResponse(200, { + contentType: 'text/plain', + messageBody: 'Authenticated', + }), + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + AuthenticateCognitoConfig: { + UserPoolArn: { 'Fn::GetAtt': ['UserPool6BA7E5F2', 'Arn'] }, + UserPoolClientId: { Ref: 'Client4A7F64DF' }, + UserPoolDomain: { Ref: 'Domain66AC69E0' }, + }, + Order: 1, + Type: 'authenticate-cognito', + }, + { + FixedResponseConfig: { + ContentType: 'text/plain', + MessageBody: 'Authenticated', + StatusCode: '200', + }, + Order: 2, + Type: 'fixed-response', + }, + ], + }); +}); diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/.jsiirc.json new file mode 100644 index 0000000000000..0382fbbd40f65 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticloadbalancingv2.targets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets" + }, + "python": { + "module": "aws_cdk.aws_elasticloadbalancingv2_targets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/README.md b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/README.md new file mode 100644 index 0000000000000..928dc1068e09b --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/README.md @@ -0,0 +1,4 @@ +# Targets for AWS Elastic Load Balancing V2 + + +This package contains targets for ELBv2. See the README of the `@aws-cdk/aws-elasticloadbalancingv2` library. diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/alb-target.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/alb-target.ts similarity index 95% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/alb-target.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/alb-target.ts index 3cc67a0984a2e..c7d6968721ff5 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/alb-target.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/alb-target.ts @@ -1,4 +1,4 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; /** * A single Application Load Balancer as the target for load balancing. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/index.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/index.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/instance-target.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/instance-target.ts similarity index 94% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/instance-target.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/instance-target.ts index 9291b8e6d46cd..a3eb128f7ab80 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/instance-target.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/instance-target.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; /** * An EC2 instance that is the target for load balancing diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/ip-target.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/ip-target.ts similarity index 97% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/ip-target.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/ip-target.ts index e9365458bb75c..bc3129d4d1484 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/ip-target.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/ip-target.ts @@ -1,4 +1,4 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; /** * An IP address that is a target for load balancing. diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts similarity index 90% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts index be1f10d465b81..b861e125d5a18 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts @@ -1,6 +1,6 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; export class LambdaTarget implements elbv2.IApplicationLoadBalancerTarget { /** diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/alb-target.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/alb-target.test.ts similarity index 88% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/alb-target.test.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/alb-target.test.ts index b8c30af1f332a..c48812bcadc94 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/alb-target.test.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/alb-target.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('Can create target groups with alb target', () => { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/instance-target.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/instance-target.test.ts similarity index 88% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/instance-target.test.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/instance-target.test.ts index 55a731ac51dab..6bb0129a4ca83 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/instance-target.test.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/instance-target.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('Can create target groups with instance id target', () => { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/ip-target.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/ip-target.test.ts similarity index 77% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/ip-target.test.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/ip-target.test.ts index 185ad0c877574..0ffd8ec9f5f9d 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/ip-target.test.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/ip-target.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('Can create target groups with lambda targets', () => { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/lambda-target.test.ts similarity index 84% rename from packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.test.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/lambda-target.test.ts index 2b4764aad0c2d..7f3be404e0563 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2-targets/test/lambda-target.test.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/test/lambda-target.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as lambda from '../../aws-lambda'; +import { Stack } from '../../core'; import * as targets from '../lib'; let stack: Stack; diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/.jsiirc.json new file mode 100644 index 0000000000000..e2b7493c1d8dd --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticloadbalancingv2" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ElasticLoadBalancingV2" + }, + "python": { + "module": "aws_cdk.aws_elasticloadbalancingv2" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/README.md b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/README.md new file mode 100644 index 0000000000000..b1cc9ebae9eb1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/README.md @@ -0,0 +1,643 @@ +# Amazon Elastic Load Balancing V2 Construct Library + + + +The `@aws-cdk/aws-elasticloadbalancingv2` package provides constructs for +configuring application and network load balancers. + +For more information, see the AWS documentation for +[Application Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html) +and [Network Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html). + +## Defining an Application Load Balancer + +You define an application load balancer by creating an instance of +`ApplicationLoadBalancer`, adding a Listener to the load balancer +and adding Targets to the Listener: + +```ts +import { AutoScalingGroup } from 'aws-cdk-lib/aws-autoscaling'; +declare const asg: AutoScalingGroup; + +declare const vpc: ec2.Vpc; + +// Create the load balancer in a VPC. 'internetFacing' is 'false' +// by default, which creates an internal load balancer. +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true +}); + +// Add a listener and open up the load balancer's security group +// to the world. +const listener = lb.addListener('Listener', { + port: 80, + + // 'open: true' is the default, you can leave it out if you want. Set it + // to 'false' and use `listener.connections` if you want to be selective + // about who can access the load balancer. + open: true, +}); + +// Create an AutoScaling group and add it as a load balancing +// target to the listener. +listener.addTargets('ApplicationFleet', { + port: 8080, + targets: [asg] +}); +``` + +The security groups of the load balancer and the target are automatically +updated to allow the network traffic. + +One (or more) security groups can be associated with the load balancer; +if a security group isn't provided, one will be automatically created. + +```ts +declare const vpc: ec2.Vpc; + +const securityGroup1 = new ec2.SecurityGroup(this, 'SecurityGroup1', { vpc }); +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, + securityGroup: securityGroup1, // Optional - will be automatically created otherwise +}); + +const securityGroup2 = new ec2.SecurityGroup(this, 'SecurityGroup2', { vpc }); +lb.addSecurityGroup(securityGroup2); +``` + +### Conditions + +It's possible to route traffic to targets based on conditions in the incoming +HTTP request. For example, the following will route requests to the indicated +AutoScalingGroup only if the requested host in the request is either for +`example.com/ok` or `example.com/path`: + +```ts +declare const listener: elbv2.ApplicationListener; +declare const asg: autoscaling.AutoScalingGroup; + +listener.addTargets('Example.Com Fleet', { + priority: 10, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['example.com']), + elbv2.ListenerCondition.pathPatterns(['/ok', '/path']), + ], + port: 8080, + targets: [asg] +}); +``` + +A target with a condition contains either `pathPatterns` or `hostHeader`, or +both. If both are specified, both conditions must be met for the requests to +be routed to the given target. `priority` is a required field when you add +targets with conditions. The lowest number wins. + +Every listener must have at least one target without conditions, which is +where all requests that didn't match any of the conditions will be sent. + +### Convenience methods and more complex Actions + +Routing traffic from a Load Balancer to a Target involves the following steps: + +- Create a Target Group, register the Target into the Target Group +- Add an Action to the Listener which forwards traffic to the Target Group. + +A new listener can be added to the Load Balancer by calling `addListener()`. +Listeners that have been added to the load balancer can be listed using the +`listeners` property. Note that the `listeners` property will throw an Error +for imported or looked up Load Balancers. + +Various methods on the `Listener` take care of this work for you to a greater +or lesser extent: + +- `addTargets()` performs both steps: automatically creates a Target Group and the + required Action. +- `addTargetGroups()` gives you more control: you create the Target Group (or + Target Groups) yourself and the method creates Action that routes traffic to + the Target Groups. +- `addAction()` gives you full control: you supply the Action and wire it up + to the Target Groups yourself (or access one of the other ELB routing features). + +Using `addAction()` gives you access to some of the features of an Elastic Load +Balancer that the other two convenience methods don't: + +- **Routing stickiness**: use `ListenerAction.forward()` and supply a + `stickinessDuration` to make sure requests are routed to the same target group + for a given duration. +- **Weighted Target Groups**: use `ListenerAction.weightedForward()` + to give different weights to different target groups. +- **Fixed Responses**: use `ListenerAction.fixedResponse()` to serve + a static response (ALB only). +- **Redirects**: use `ListenerAction.redirect()` to serve an HTTP + redirect response (ALB only). +- **Authentication**: use `ListenerAction.authenticateOidc()` to + perform OpenID authentication before serving a request (see the + `@aws-cdk/aws-elasticloadbalancingv2-actions` package for direct authentication + integration with Cognito) (ALB only). + +Here's an example of serving a fixed response at the `/ok` URL: + +```ts +declare const listener: elbv2.ApplicationListener; + +listener.addAction('Fixed', { + priority: 10, + conditions: [ + elbv2.ListenerCondition.pathPatterns(['/ok']), + ], + action: elbv2.ListenerAction.fixedResponse(200, { + contentType: 'text/plain', + messageBody: 'OK', + }) +}); +``` + +Here's an example of using OIDC authentication before forwarding to a TargetGroup: + +```ts +declare const listener: elbv2.ApplicationListener; +declare const myTargetGroup: elbv2.ApplicationTargetGroup; + +listener.addAction('DefaultAction', { + action: elbv2.ListenerAction.authenticateOidc({ + authorizationEndpoint: 'https://example.com/openid', + // Other OIDC properties here + clientId: '...', + clientSecret: SecretValue.secretsManager('...'), + issuer: '...', + tokenEndpoint: '...', + userInfoEndpoint: '...', + + // Next + next: elbv2.ListenerAction.forward([myTargetGroup]), + }), +}); +``` + +If you just want to redirect all incoming traffic on one port to another port, you can use the following code: + +```ts +declare const lb: elbv2.ApplicationLoadBalancer; + +lb.addRedirect({ + sourceProtocol: elbv2.ApplicationProtocol.HTTPS, + sourcePort: 8443, + targetProtocol: elbv2.ApplicationProtocol.HTTP, + targetPort: 8080, +}); +``` + +If you do not provide any options for this method, it redirects HTTP port 80 to HTTPS port 443. + +By default all ingress traffic will be allowed on the source port. If you want to be more selective with your +ingress rules then set `open: false` and use the listener's `connections` object to selectively grant access to the listener. + +### Load Balancer attributes + +You can modify attributes of Application Load Balancers: + +```ts +const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', { + vpc, + internetFacing: true, + + // Whether HTTP/2 is enabled + http2Enabled: false, + + // The idle timeout value, in seconds + idleTimeout: cdk.Duration.seconds(1000), + + // Whether HTTP headers with header fields thatare not valid + // are removed by the load balancer (true), or routed to targets + dropInvalidHeaderFields: true, + + // How the load balancer handles requests that might + // pose a security risk to your application + desyncMitigationMode: elbv2.DesyncMitigationMode.DEFENSIVE, +}); +``` + +For more information, see [Load balancer attributes](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes) + +## Defining a Network Load Balancer + +Network Load Balancers are defined in a similar way to Application Load +Balancers: + +```ts +declare const vpc: ec2.Vpc; +declare const asg: autoscaling.AutoScalingGroup; + +// Create the load balancer in a VPC. 'internetFacing' is 'false' +// by default, which creates an internal load balancer. +const lb = new elbv2.NetworkLoadBalancer(this, 'LB', { + vpc, + internetFacing: true +}); + +// Add a listener on a particular port. +const listener = lb.addListener('Listener', { + port: 443, +}); + +// Add targets on a particular port. +listener.addTargets('AppFleet', { + port: 443, + targets: [asg] +}); +``` + +One thing to keep in mind is that network load balancers do not have security +groups, and no automatic security group configuration is done for you. You will +have to configure the security groups of the target yourself to allow traffic by +clients and/or load balancer instances, depending on your target types. See +[Target Groups for your Network Load +Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html) +and [Register targets with your Target +Group](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-register-targets.html) +for more information. + +## Targets and Target Groups + +Application and Network Load Balancers organize load balancing targets in Target +Groups. If you add your balancing targets (such as AutoScalingGroups, ECS +services or individual instances) to your listener directly, the appropriate +`TargetGroup` will be automatically created for you. + +If you need more control over the Target Groups created, create an instance of +`ApplicationTargetGroup` or `NetworkTargetGroup`, add the members you desire, +and add it to the listener by calling `addTargetGroups` instead of `addTargets`. + +`addTargets()` will always return the Target Group it just created for you: + +```ts +declare const listener: elbv2.NetworkListener; +declare const asg1: autoscaling.AutoScalingGroup; +declare const asg2: autoscaling.AutoScalingGroup; + +const group = listener.addTargets('AppFleet', { + port: 443, + targets: [asg1], +}); + +group.addTarget(asg2); +``` + +### Sticky sessions for your Application Load Balancer + +By default, an Application Load Balancer routes each request independently to a registered target based on the chosen load-balancing algorithm. However, you can use the sticky session feature (also known as session affinity) to enable the load balancer to bind a user's session to a specific target. This ensures that all requests from the user during the session are sent to the same target. This feature is useful for servers that maintain state information in order to provide a continuous experience to clients. To use sticky sessions, the client must support cookies. + +Application Load Balancers support both duration-based cookies (`lb_cookie`) and application-based cookies (`app_cookie`). The key to managing sticky sessions is determining how long your load balancer should consistently route the user's request to the same target. Sticky sessions are enabled at the target group level. You can use a combination of duration-based stickiness, application-based stickiness, and no stickiness across all of your target groups. + +```ts +declare const vpc: ec2.Vpc; + +// Target group with duration-based stickiness with load-balancer generated cookie +const tg1 = new elbv2.ApplicationTargetGroup(this, 'TG1', { + targetType: elbv2.TargetType.INSTANCE, + port: 80, + stickinessCookieDuration: Duration.minutes(5), + vpc, +}); + +// Target group with application-based stickiness +const tg2 = new elbv2.ApplicationTargetGroup(this, 'TG2', { + targetType: elbv2.TargetType.INSTANCE, + port: 80, + stickinessCookieDuration: Duration.minutes(5), + stickinessCookieName: 'MyDeliciousCookie', + vpc, +}); +``` + +For more information see: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html#application-based-stickiness + +### Setting the target group protocol version + +By default, Application Load Balancers send requests to targets using HTTP/1.1. You can use the [protocol version](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-protocol-version) to send requests to targets using HTTP/2 or gRPC. + +```ts +declare const vpc: ec2.Vpc; + +const tg = new elbv2.ApplicationTargetGroup(this, 'TG', { + targetType: elbv2.TargetType.IP, + port: 50051, + protocol: elbv2.ApplicationProtocol.HTTP, + protocolVersion: elbv2.ApplicationProtocolVersion.GRPC, + healthCheck: { + enabled: true, + healthyGrpcCodes: '0-99', + }, + vpc, +}); +``` + +## Using Lambda Targets + +To use a Lambda Function as a target, use the integration class in the +`@aws-cdk/aws-elasticloadbalancingv2-targets` package: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as targets from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets'; + +declare const lambdaFunction: lambda.Function; +declare const lb: elbv2.ApplicationLoadBalancer; + +const listener = lb.addListener('Listener', { port: 80 }); +listener.addTargets('Targets', { + targets: [new targets.LambdaTarget(lambdaFunction)], + + // For Lambda Targets, you need to explicitly enable health checks if you + // want them. + healthCheck: { + enabled: true, + } +}); +``` + +Only a single Lambda function can be added to a single listener rule. + +## Using Application Load Balancer Targets + +To use a single application load balancer as a target for the network load balancer, use the integration class in the +`@aws-cdk/aws-elasticloadbalancingv2-targets` package: + +```ts +import * as targets from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as patterns from 'aws-cdk-lib/aws-ecs-patterns'; + +declare const vpc: ec2.Vpc; + +const task = new ecs.FargateTaskDefinition(this, 'Task', { cpu: 256, memoryLimitMiB: 512 }); +task.addContainer('nginx', { + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/nginx/nginx:latest'), + portMappings: [{ containerPort: 80 }], +}); + +const svc = new patterns.ApplicationLoadBalancedFargateService(this, 'Service', { + vpc, + taskDefinition: task, + publicLoadBalancer: false, +}); + +const nlb = new elbv2.NetworkLoadBalancer(this, 'Nlb', { + vpc, + crossZoneEnabled: true, + internetFacing: true, +}); + +const listener = nlb.addListener('listener', { port: 80 }); + +listener.addTargets('Targets', { + targets: [new targets.AlbTarget(svc.loadBalancer, 80)], + port: 80, +}); + +new CfnOutput(this, 'NlbEndpoint', { value: `http://${nlb.loadBalancerDnsName}`}) +``` + +Only the network load balancer is allowed to add the application load balancer as the target. + +## Configuring Health Checks + +Health checks are configured upon creation of a target group: + +```ts +declare const listener: elbv2.ApplicationListener; +declare const asg: autoscaling.AutoScalingGroup; + +listener.addTargets('AppFleet', { + port: 8080, + targets: [asg], + healthCheck: { + path: '/ping', + interval: Duration.minutes(1), + } +}); +``` + +The health check can also be configured after creation by calling +`configureHealthCheck()` on the created object. + +No attempts are made to configure security groups for the port you're +configuring a health check for, but if the health check is on the same port +you're routing traffic to, the security group already allows the traffic. +If not, you will have to configure the security groups appropriately: + +```ts +declare const lb: elbv2.ApplicationLoadBalancer; +declare const listener: elbv2.ApplicationListener; +declare const asg: autoscaling.AutoScalingGroup; + +listener.addTargets('AppFleet', { + port: 8080, + targets: [asg], + healthCheck: { + port: '8088', + } +}); + +asg.connections.allowFrom(lb, ec2.Port.tcp(8088)); +``` + +## Using a Load Balancer from a different Stack + +If you want to put your Load Balancer and the Targets it is load balancing to in +different stacks, you may not be able to use the convenience methods +`loadBalancer.addListener()` and `listener.addTargets()`. + +The reason is that these methods will create resources in the same Stack as the +object they're called on, which may lead to cyclic references between stacks. +Instead, you will have to create an `ApplicationListener` in the target stack, +or an empty `TargetGroup` in the load balancer stack that you attach your +service to. + +For an example of the alternatives while load balancing to an ECS service, see the +[ecs/cross-stack-load-balancer +example](https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/ecs/cross-stack-load-balancer/). + +## Protocol for Load Balancer Targets + +Constructs that want to be a load balancer target should implement +`IApplicationLoadBalancerTarget` and/or `INetworkLoadBalancerTarget`, and +provide an implementation for the function `attachToXxxTargetGroup()`, which can +call functions on the load balancer and should return metadata about the +load balancing target: + +```ts +class MyTarget implements elbv2.IApplicationLoadBalancerTarget { + public attachToApplicationTargetGroup(targetGroup: elbv2.ApplicationTargetGroup): elbv2.LoadBalancerTargetProps { + // If we need to add security group rules + // targetGroup.registerConnectable(...); + return { + targetType: elbv2.TargetType.IP, + targetJson: { id: '1.2.3.4', port: 8080 }, + }; + } +} +``` + +`targetType` should be one of `Instance` or `Ip`. If the target can be +directly added to the target group, `targetJson` should contain the `id` of +the target (either instance ID or IP address depending on the type) and +optionally a `port` or `availabilityZone` override. + +Application load balancer targets can call `registerConnectable()` on the +target group to register themselves for addition to the load balancer's security +group rules. + +If your load balancer target requires that the TargetGroup has been +associated with a LoadBalancer before registration can happen (such as is the +case for ECS Services for example), take a resource dependency on +`targetGroup.loadBalancerAttached` as follows: + +```ts +declare const resource: Resource; +declare const targetGroup: elbv2.ApplicationTargetGroup; + +// Make sure that the listener has been created, and so the TargetGroup +// has been associated with the LoadBalancer, before 'resource' is created. + +Node.of(resource).addDependency(targetGroup.loadBalancerAttached); +``` + +## Looking up Load Balancers and Listeners + +You may look up load balancers and load balancer listeners by using one of the +following lookup methods: + +- `ApplicationLoadBalancer.fromlookup(options)` - Look up an application load + balancer. +- `ApplicationListener.fromLookup(options)` - Look up an application load + balancer listener. +- `NetworkLoadBalancer.fromLookup(options)` - Look up a network load balancer. +- `NetworkListener.fromLookup(options)` - Look up a network load balancer + listener. + +### Load Balancer lookup options + +You may look up a load balancer by ARN or by associated tags. When you look a +load balancer up by ARN, that load balancer will be returned unless CDK detects +that the load balancer is of the wrong type. When you look up a load balancer by +tags, CDK will return the load balancer matching all specified tags. If more +than one load balancer matches, CDK will throw an error requesting that you +provide more specific criteria. + +**Look up a Application Load Balancer by ARN** + +```ts +const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(this, 'ALB', { + loadBalancerArn: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456', +}); +``` + +**Look up an Application Load Balancer by tags** + +```ts +const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(this, 'ALB', { + loadBalancerTags: { + // Finds a load balancer matching all tags. + some: 'tag', + someother: 'tag', + }, +}); +``` + +## Load Balancer Listener lookup options + +You may look up a load balancer listener by the following criteria: + +- Associated load balancer ARN +- Associated load balancer tags +- Listener ARN +- Listener port +- Listener protocol + +The lookup method will return the matching listener. If more than one listener +matches, CDK will throw an error requesting that you specify additional +criteria. + +**Look up a Listener by associated Load Balancer, Port, and Protocol** + +```ts +const listener = elbv2.ApplicationListener.fromLookup(this, 'ALBListener', { + loadBalancerArn: 'arn:aws:elasticloadbalancing:us-east-2:123456789012:loadbalancer/app/my-load-balancer/1234567890123456', + listenerProtocol: elbv2.ApplicationProtocol.HTTPS, + listenerPort: 443, +}); +``` + +**Look up a Listener by associated Load Balancer Tag, Port, and Protocol** + +```ts +const listener = elbv2.ApplicationListener.fromLookup(this, 'ALBListener', { + loadBalancerTags: { + Cluster: 'MyClusterName', + }, + listenerProtocol: elbv2.ApplicationProtocol.HTTPS, + listenerPort: 443, +}); +``` + +**Look up a Network Listener by associated Load Balancer Tag, Port, and Protocol** + +```ts +const listener = elbv2.NetworkListener.fromLookup(this, 'ALBListener', { + loadBalancerTags: { + Cluster: 'MyClusterName', + }, + listenerProtocol: elbv2.Protocol.TCP, + listenerPort: 12345, +}); +``` + +## Metrics + +You may create metrics for Load Balancers and Target Groups through the `metrics` attribute: + +**Load Balancer:** + +```ts +declare const alb: elbv2.IApplicationLoadBalancer; + +const albMetrics: elbv2.IApplicationLoadBalancerMetrics = alb.metrics; +const metricConnectionCount: cloudwatch.Metric = albMetrics.activeConnectionCount(); +``` + +**Target Group:** + +```ts +declare const targetGroup: elbv2.IApplicationTargetGroup; + +const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; +const metricHealthyHostCount: cloudwatch.Metric = targetGroupMetrics.healthyHostCount(); +``` + +Metrics are also available to imported resources: + +```ts +declare const stack: Stack; + +const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'MyTargetGroup', { + targetGroupArn: Fn.importValue('TargetGroupArn'), + loadBalancerArns: Fn.importValue('LoadBalancerArn'), +}); + +const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; +``` + +Notice that TargetGroups must be imported by supplying the Load Balancer too, otherwise accessing the `metrics` will +throw an error: + +```ts +declare const stack: Stack; +const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'MyTargetGroup', { + targetGroupArn: Fn.importValue('TargetGroupArn'), +}); + +const targetGroupMetrics: elbv2.IApplicationTargetGroupMetrics = targetGroup.metrics; // throws an Error() +``` diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts index 0d16076d4cdf2..cb61e2ff5bf9b 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-action.ts @@ -1,4 +1,4 @@ -import { Duration, SecretValue, Tokenization } from '@aws-cdk/core'; +import { Duration, SecretValue, Tokenization } from '../../../core'; import { Construct, IConstruct } from 'constructs'; import { IApplicationListener } from './application-listener'; import { IApplicationTargetGroup } from './application-target-group'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-certificate.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts index 5c68c3d96b544..ec25a3d5b2fba 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener-rule.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { IApplicationListener } from './application-listener'; import { ListenerAction } from './application-listener-action'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener.ts index 5a4138101a11f..e51673f330ffc 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-listener.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-listener.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Duration, Lazy, Resource, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ec2 from '../../../aws-ec2'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { Duration, Lazy, Resource, Token } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ListenerAction } from './application-listener-action'; import { ApplicationListenerCertificate } from './application-listener-certificate'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts index 6e45f9749d12b..d0c339e23ddb0 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts @@ -1,8 +1,8 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Duration, Lazy, Names, Resource } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { Duration, Lazy, Names, Resource } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationListener, BaseApplicationListenerProps } from './application-listener'; import { ListenerAction } from './application-listener-action'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts index f82b6d0b26133..6d36aede10af7 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-target-group.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Aws, Annotations, Duration, Token } from '@aws-cdk/core'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import { Aws, Annotations, Duration, Token } from '../../../core'; import { IConstruct, Construct } from 'constructs'; import { IApplicationListener } from './application-listener'; import { HttpCodeTarget } from './application-load-balancer'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/conditions.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/conditions.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/alb/conditions.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/conditions.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/index.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/index.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/index.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener-action.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener-action.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener-action.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener-action.ts index ae36c01bdc692..181dafe410bcc 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener-action.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener-action.ts @@ -1,4 +1,4 @@ -import { Duration } from '@aws-cdk/core'; +import { Duration } from '../../../core'; import { Construct } from 'constructs'; import { INetworkListener } from './network-listener'; import { INetworkTargetGroup } from './network-target-group'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener-certificate.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener-certificate.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener-certificate.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener-certificate.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts index 34b1cdf9cbb4b..e2b25492af90c 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-listener.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Duration, Resource, Lazy } from '@aws-cdk/core'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { Duration, Resource, Lazy } from '../../../core'; import { Construct } from 'constructs'; import { NetworkListenerAction } from './network-listener-action'; import { NetworkListenerCertificate } from './network-listener-certificate'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts similarity index 98% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts index c5d42652eb160..e522fad91139d 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts @@ -1,8 +1,8 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Resource } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { Resource } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { BaseNetworkListenerProps, NetworkListener } from './network-listener'; import { NetworkELBMetrics } from '../elasticloadbalancingv2-canned-metrics.generated'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts index 5837d20928f6a..2ee05d6db10b8 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { INetworkListener } from './network-listener'; import { diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts similarity index 97% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts index 7302c9a5a6a70..f88496216ec1a 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-listener.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-listener.ts @@ -1,6 +1,6 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { Annotations, ContextProvider, IResource, Lazy, Resource, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { Annotations, ContextProvider, IResource, Lazy, Resource, Token } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { IListenerAction } from './listener-action'; import { mapTagMapToCxschema } from './util'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts similarity index 96% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts index cf554ed3aa717..739e7830dddcb 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts @@ -1,11 +1,11 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { PolicyStatement, ServicePrincipal } from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { ContextProvider, IResource, Lazy, Resource, Stack, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; -import { RegionInfo } from '@aws-cdk/region-info'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import { PolicyStatement, ServicePrincipal } from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { ContextProvider, IResource, Lazy, Resource, Stack, Token } from '../../../core'; +import * as cxapi from '../../../cx-api'; +import { RegionInfo } from '../../../region-info'; import { Construct } from 'constructs'; import { Attributes, ifUndefined, mapTagMapToCxschema, renderAttributes } from './util'; import { CfnLoadBalancer } from '../elasticloadbalancingv2.generated'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts similarity index 99% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts index 8e7af5cc20f05..826c7c1ad16bb 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/base-target-group.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as cdk from '../../../core'; import { Construct, DependencyGroup, IConstruct, IDependable } from 'constructs'; import { Protocol, TargetType } from './enums'; import { Attributes, renderAttributes } from './util'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/enums.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/enums.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/enums.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/enums.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/imported.ts similarity index 96% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/imported.ts index 889565ffb0d93..39c32216a54bb 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/imported.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/imported.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { Construct, DependencyGroup, IDependable } from 'constructs'; import { ITargetGroup, TargetGroupImportProps } from './base-target-group'; diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/listener-action.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/listener-action.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/listener-action.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/listener-action.ts diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts similarity index 94% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts index dae0b8250e026..9bee4dc7daf39 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/listener-certificate.ts @@ -1,4 +1,4 @@ -import * as acm from '@aws-cdk/aws-certificatemanager'; +import * as acm from '../../../aws-certificatemanager'; /** * A certificate source for an ELBv2 listener diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/load-balancer-targets.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/load-balancer-targets.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/load-balancer-targets.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/load-balancer-targets.ts diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/util.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/util.ts new file mode 100644 index 0000000000000..4ef628989d4f4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/util.ts @@ -0,0 +1,130 @@ +import * as cxschema from '../../../cloud-assembly-schema'; +import { Arn, ArnFormat, Fn, Token } from '../../../core'; +import { ApplicationProtocol, Protocol } from './enums'; + +export type Attributes = { [key: string]: string | undefined }; + +/** + * Render an attribute dict to a list of { key, value } pairs + */ +export function renderAttributes(attributes: Attributes) { + const ret: any[] = []; + for (const [key, value] of Object.entries(attributes)) { + if (value !== undefined) { + ret.push({ key, value }); + } + } + return ret; +} + +/** + * Return the appropriate default port for a given protocol + */ +export function defaultPortForProtocol(proto: ApplicationProtocol): number { + switch (proto) { + case ApplicationProtocol.HTTP: return 80; + case ApplicationProtocol.HTTPS: return 443; + default: + throw new Error(`Unrecognized protocol: ${proto}`); + } +} + +/** + * Return the appropriate default protocol for a given port + */ +export function defaultProtocolForPort(port: number): ApplicationProtocol { + switch (port) { + case 80: + case 8000: + case 8008: + case 8080: + return ApplicationProtocol.HTTP; + + case 443: + case 8443: + return ApplicationProtocol.HTTPS; + + default: + throw new Error(`Don't know default protocol for port: ${port}; please supply a protocol`); + } +} + +/** + * Given a protocol and a port, try to guess the other one if it's undefined + */ +// eslint-disable-next-line max-len +export function determineProtocolAndPort(protocol: ApplicationProtocol | undefined, port: number | undefined): [ApplicationProtocol | undefined, number | undefined] { + if (protocol === undefined && port === undefined) { + return [undefined, undefined]; + } + + if (protocol === undefined) { protocol = defaultProtocolForPort(port!); } + if (port === undefined) { port = defaultPortForProtocol(protocol!); } + + return [protocol, port]; +} + +/** + * Helper function to default undefined input props + */ +export function ifUndefined(x: T | undefined, def: T) { + return x ?? def; +} + +/** + * Helper function for ensuring network listeners and target groups only accept valid + * protocols. + */ +export function validateNetworkProtocol(protocol: Protocol) { + const NLB_PROTOCOLS = [Protocol.TCP, Protocol.TLS, Protocol.UDP, Protocol.TCP_UDP]; + + if (NLB_PROTOCOLS.indexOf(protocol) === -1) { + throw new Error(`The protocol must be one of ${NLB_PROTOCOLS.join(', ')}. Found ${protocol}`); + } +} + +/** + * Helper to map a map of tags to cxschema tag format. + * @internal + */ +export function mapTagMapToCxschema(tagMap: Record): cxschema.Tag[] { + return Object.entries(tagMap) + .map(([key, value]) => ({ key, value })); +} + +export function parseLoadBalancerFullName(arn: string): string { + if (Token.isUnresolved(arn)) { + // Unfortunately it is not possible to use Arn.split() because the ARNs have this shape: + // + // arn:...:loadbalancer/net/my-load-balancer/123456 + // + // And the way that Arn.split() handles this situation is not enough to obtain the full name + const arnParts = Fn.split('/', arn); + return `${Fn.select(1, arnParts)}/${Fn.select(2, arnParts)}/${Fn.select(3, arnParts)}`; + } else { + const arnComponents = Arn.split(arn, ArnFormat.SLASH_RESOURCE_NAME); + const resourceName = arnComponents.resourceName; + if (!resourceName) { + throw new Error(`Provided ARN does not belong to a load balancer: ${arn}`); + } + return resourceName; + } +} + +/** + * Transforms: + * + * arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/my-target-group/da693d633af407a0 + * + * Into: + * + * targetgroup/my-target-group/da693d633af407a0 + */ +export function parseTargetGroupFullName(arn: string): string { + const arnComponents = Arn.split(arn, ArnFormat.NO_RESOURCE_NAME); + const resource = arnComponents.resource; + if (!resource) { + throw new Error(`Provided ARN does not belong to a target group: ${arn}`); + } + return resource; +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/actions.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/actions.test.ts new file mode 100644 index 0000000000000..1e4483daa3d39 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/actions.test.ts @@ -0,0 +1,220 @@ +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; + +let stack: cdk.Stack; +let group1: elbv2.ApplicationTargetGroup; +let group2: elbv2.ApplicationTargetGroup; +let lb: elbv2.ApplicationLoadBalancer; + +beforeEach(() => { + stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + group1 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup1', { vpc, port: 80 }); + group2 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 }); + lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); +}); + +describe('tests', () => { + test('Forward action legacy rendering', () => { + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: elbv2.ListenerAction.forward([group1]), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, + Type: 'forward', + }, + ], + }); + }); + + test('Forward to multiple targetgroups with an Action and stickiness', () => { + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: elbv2.ListenerAction.forward([group1, group2], { + stickinessDuration: cdk.Duration.hours(1), + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + ForwardConfig: { + TargetGroupStickinessConfig: { + DurationSeconds: 3600, + Enabled: true, + }, + TargetGroups: [ + { + TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, + }, + { + TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, + }, + ], + }, + Type: 'forward', + }, + ], + }); + }); + + test('Weighted forward to multiple targetgroups with an Action', () => { + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: elbv2.ListenerAction.weightedForward([ + { targetGroup: group1, weight: 10 }, + { targetGroup: group2, weight: 50 }, + ], { + stickinessDuration: cdk.Duration.hours(1), + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + ForwardConfig: { + TargetGroupStickinessConfig: { + DurationSeconds: 3600, + Enabled: true, + }, + TargetGroups: [ + { + TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, + Weight: 10, + }, + { + TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, + Weight: 50, + }, + ], + }, + Type: 'forward', + }, + ], + }); + }); + + test('Chaining OIDC authentication action', () => { + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: elbv2.ListenerAction.authenticateOidc({ + authorizationEndpoint: 'A', + clientId: 'B', + clientSecret: cdk.SecretValue.unsafePlainText('C'), + issuer: 'D', + tokenEndpoint: 'E', + userInfoEndpoint: 'F', + next: elbv2.ListenerAction.forward([group1]), + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + AuthenticateOidcConfig: { + AuthorizationEndpoint: 'A', + ClientId: 'B', + ClientSecret: 'C', + Issuer: 'D', + TokenEndpoint: 'E', + UserInfoEndpoint: 'F', + }, + Order: 1, + Type: 'authenticate-oidc', + }, + { + Order: 2, + TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, + Type: 'forward', + }, + ], + }); + }); + + test('Add default Action and add Action with conditions', () => { + // GIVEN + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + listener.addAction('Action1', { + action: elbv2.ListenerAction.forward([group1]), + }); + + listener.addAction('Action2', { + conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], + priority: 10, + action: elbv2.ListenerAction.forward([group2]), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Actions: [ + { + TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, + Type: 'forward', + }, + ], + }); + }); + + test('Add Action with multiple Conditions', () => { + // GIVEN + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + listener.addAction('Action1', { + action: elbv2.ListenerAction.forward([group1]), + }); + + listener.addAction('Action2', { + conditions: [ + elbv2.ListenerCondition.hostHeaders(['example.com']), + elbv2.ListenerCondition.sourceIps(['1.1.1.1/32']), + ], + priority: 10, + action: elbv2.ListenerAction.forward([group2]), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Actions: [ + { + TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, + Type: 'forward', + }, + ], + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: [ + 'example.com', + ], + }, + }, + { + Field: 'source-ip', + SourceIpConfig: { + Values: [ + '1.1.1.1/32', + ], + }, + }, + ], + }); + }); +}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/conditions.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/conditions.test.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/alb/conditions.test.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/conditions.test.ts diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/listener.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/listener.test.ts new file mode 100644 index 0000000000000..8911186f0f98d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/listener.test.ts @@ -0,0 +1,1798 @@ +import { Match, Template } from '../../../assertions'; +import * as acm from '../../../aws-certificatemanager'; +import { Metric } from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import { describeDeprecated, testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../../core'; +import { SecretValue } from '../../../core'; +import * as constructs from 'constructs'; +import * as elbv2 from '../../lib'; +import { FakeSelfRegisteringTarget } from '../helpers'; + +describe('tests', () => { + test('Listener guesses protocol from port', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.addListener('Listener', { + port: 443, + certificates: [importedCertificate(stack)], + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'HTTPS', + }); + }); + + test('Listener guesses port from protocol', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.addListener('Listener', { + protocol: elbv2.ApplicationProtocol.HTTP, + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Port: 80, + }); + }); + + test('Listener default to open - IPv4', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + loadBalancer.addListener('MyListener', { + port: 80, + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [ + { + Description: 'Allow from anyone on port 80', + CidrIp: '0.0.0.0/0', + FromPort: 80, + IpProtocol: 'tcp', + ToPort: 80, + }, + ], + }); + }); + + test('Listener default to open - IPv4 and IPv6 (dual stack)', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, ipAddressType: elbv2.IpAddressType.DUAL_STACK }); + + // WHEN + loadBalancer.addListener('MyListener', { + port: 80, + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [ + { + Description: 'Allow from anyone on port 80', + CidrIp: '0.0.0.0/0', + FromPort: 80, + IpProtocol: 'tcp', + ToPort: 80, + }, + { + Description: 'Allow from anyone on port 80', + CidrIpv6: '::/0', + FromPort: 80, + IpProtocol: 'tcp', + ToPort: 80, + }, + ], + }); + }); + + test('HTTPS listener requires certificate', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + const errors = listener.node.validate(); + expect(errors).toEqual(['HTTPS Listener needs at least one certificate (call addCertificates)']); + }); + + test('HTTPS listener can add certificate after construction', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + listener.addCertificates('Certs', [importedCertificate(stack, 'cert')]); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Certificates: [ + { CertificateArn: 'cert' }, + ], + }); + }); + + test('HTTPS listener can add more than two certificates', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + defaultTargetGroups: [ + new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 }), + ], + certificates: [ + elbv2.ListenerCertificate.fromArn('cert1'), + elbv2.ListenerCertificate.fromArn('cert2'), + elbv2.ListenerCertificate.fromArn('cert3'), + ], + }); + + expect(listener.node.tryFindChild('DefaultCertificates1')).toBeDefined(); + expect(listener.node.tryFindChild('DefaultCertificates2')).toBeDefined(); + expect(listener.node.tryFindChild('DefaultCertificates3')).not.toBeDefined(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Certificates: [{ CertificateArn: 'cert1' }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert2' }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert3' }], + }); + }); + + test('Can configure targetType on TargetGroups', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + targetType: elbv2.TargetType.IP, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetType: 'ip', + }); + }); + + test('Can configure name on TargetGroups', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + targetGroupName: 'foo', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + Name: 'foo', + }); + }); + + test('Can add target groups with and without conditions', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + + // WHEN + listener.addTargetGroups('Default', { + targetGroups: [group], + }); + listener.addTargetGroups('WithPath', { + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + targetGroups: [group], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, + Type: 'forward', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 10, + Conditions: [ + { + Field: 'path-pattern', + PathPatternConfig: { Values: ['/hello'] }, + }, + ], + Actions: [ + { + TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, + Type: 'forward', + }, + ], + }); + }); + + test('bind is called for all next targets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + const fake = new FakeSelfRegisteringTarget(stack, 'FakeTG', vpc); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + targets: [fake], + }); + + // WHEN + listener.addAction('first-action', { + action: elbv2.ListenerAction.authenticateOidc({ + next: elbv2.ListenerAction.forward([group]), + issuer: 'dummy', + clientId: 'dummy', + clientSecret: SecretValue.unsafePlainText('dummy'), + tokenEndpoint: 'dummy', + userInfoEndpoint: 'dummy', + authorizationEndpoint: 'dummy', + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + IpProtocol: 'tcp', + Description: 'Load balancer to target', + FromPort: 80, + ToPort: 80, + GroupId: { + 'Fn::GetAtt': [ + 'FakeTGSG50E257DF', + 'GroupId', + ], + }, + SourceSecurityGroupId: { + 'Fn::GetAtt': [ + 'LBSecurityGroup8A41EA2B', + 'GroupId', + ], + }, + }); + }); + + testDeprecated('Can implicitly create target groups with and without conditions', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + listener.addTargets('Targets', { + port: 80, + targets: [new elbv2.InstanceTarget('i-12345')], + }); + listener.addTargets('WithPath', { + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + port: 80, + targets: [new elbv2.InstanceTarget('i-5678')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, + Type: 'forward', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + VpcId: { Ref: 'Stack8A423254' }, + Port: 80, + Protocol: 'HTTP', + Targets: [ + { Id: 'i-12345' }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Actions: [ + { + TargetGroupArn: { Ref: 'LBListenerWithPathGroupE889F9E5' }, + Type: 'forward', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + VpcId: { Ref: 'Stack8A423254' }, + Port: 80, + Protocol: 'HTTP', + Targets: [ + { Id: 'i-5678' }, + ], + }); + }); + + testDeprecated('Add certificate to constructed listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 443 }); + + // WHEN + listener.addCertificates('Certs', [importedCertificate(stack, 'cert')]); + listener.addTargets('Targets', { port: 8080, targets: [new elbv2.IpTarget('1.2.3.4')] }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Certificates: [ + { CertificateArn: 'cert' }, + ], + }); + }); + + test('Add certificate to imported listener', () => { + // GIVEN + const stack2 = new cdk.Stack(); + const listener2 = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'Listener', { + listenerArn: 'listener-arn', + defaultPort: 443, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SG', 'security-group-id'), + }); + + // WHEN + listener2.addCertificates('Certs', [importedCertificate(stack2, 'cert')]); + + // THEN + Template.fromStack(stack2).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [ + { CertificateArn: 'cert' }, + ], + }); + }); + + test('Enable alb stickiness for targets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + const group = listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + group.enableCookieStickiness(cdk.Duration.hours(1)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + Value: 'true', + }, + { + Key: 'stickiness.type', + Value: 'lb_cookie', + }, + { + Key: 'stickiness.lb_cookie.duration_seconds', + Value: '3600', + }, + ], + }); + }); + + test('Enable app stickiness for targets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + const group = listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + group.enableCookieStickiness(cdk.Duration.hours(1), 'MyDeliciousCookie'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + Value: 'true', + }, + { + Key: 'stickiness.type', + Value: 'app_cookie', + }, + { + Key: 'stickiness.app_cookie.cookie_name', + Value: 'MyDeliciousCookie', + }, + { + Key: 'stickiness.app_cookie.duration_seconds', + Value: '3600', + }, + ], + }); + }); + + test('Enable health check for targets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + const group = listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + group.configureHealthCheck({ + unhealthyThresholdCount: 3, + timeout: cdk.Duration.seconds(30), + interval: cdk.Duration.seconds(60), + path: '/test', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + UnhealthyThresholdCount: 3, + HealthCheckIntervalSeconds: 60, + HealthCheckPath: '/test', + HealthCheckTimeoutSeconds: 30, + }); + }); + + test('validation error if invalid health check protocol', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + const group = listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + + group.configureHealthCheck({ + unhealthyThresholdCount: 3, + timeout: cdk.Duration.seconds(30), + interval: cdk.Duration.seconds(60), + path: '/test', + protocol: elbv2.Protocol.TCP, + }); + + // THEN + const validationErrors: string[] = group.node.validate(); + expect(validationErrors).toEqual(["Health check protocol 'TCP' is not supported. Must be one of [HTTP, HTTPS]"]); + }); + + test('adding targets passes in provided protocol version', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 443, certificates: [importedCertificate(stack, 'arn:someCert')] }); + + // WHEN + listener.addTargets('Group', { + port: 443, + protocolVersion: elbv2.ApplicationProtocolVersion.GRPC, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + ProtocolVersion: 'GRPC', + }); + }); + + test('Can call addTargetGroups on imported listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { + listenerArn: 'ieks', + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-12345'), + }); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + + // WHEN + listener.addTargetGroups('Gruuup', { + priority: 30, + conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], + targetGroups: [group], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + ListenerArn: 'ieks', + Priority: 30, + Actions: [ + { + TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, + Type: 'forward', + }, + ], + }); + }); + + test('Can call addTargetGroups on imported listener with conditions prop', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { + listenerArn: 'ieks', + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-12345'), + }); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + + // WHEN + listener.addTargetGroups('Gruuup', { + priority: 30, + conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], + targetGroups: [group], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + ListenerArn: 'ieks', + Priority: 30, + Actions: [ + { + TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, + Type: 'forward', + }, + ], + }); + }); + + test('Can depend on eventual listener via TargetGroup', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { vpc }); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + + // WHEN + new ResourceWithLBDependency(stack, 'SomeResource', group); + + loadBalancer.addListener('Listener', { + port: 80, + defaultTargetGroups: [group], + }); + + // THEN + Template.fromStack(stack).templateMatches(Match.objectLike({ + Resources: { + SomeResource: { + Type: 'Test::Resource', + DependsOn: ['LoadBalancerListenerE1A099B9'], + }, + }, + })); + }); + + test('Exercise metrics', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + lb.addListener('SomeListener', { + port: 80, + defaultTargetGroups: [group], + }); + + // WHEN + const metrics = new Array(); + metrics.push(group.metrics.httpCodeTarget(elbv2.HttpCodeTarget.TARGET_3XX_COUNT)); + metrics.push(group.metrics.ipv6RequestCount()); + metrics.push(group.metrics.unhealthyHostCount()); + metrics.push(group.metrics.unhealthyHostCount()); + metrics.push(group.metrics.requestCount()); + metrics.push(group.metrics.targetConnectionErrorCount()); + metrics.push(group.metrics.targetResponseTime()); + metrics.push(group.metrics.targetTLSNegotiationErrorCount()); + + for (const metric of metrics) { + expect(metric.namespace).toEqual('AWS/ApplicationELB'); + const loadBalancerArn = { Ref: 'LBSomeListenerCA01F1A0' }; + + expect(stack.resolve(metric.dimensions)).toEqual({ + TargetGroup: { 'Fn::GetAtt': ['TargetGroup3D7CD9B8', 'TargetGroupFullName'] }, + LoadBalancer: { + 'Fn::Join': + ['', + [{ 'Fn::Select': [1, { 'Fn::Split': ['/', loadBalancerArn] }] }, + '/', + { 'Fn::Select': [2, { 'Fn::Split': ['/', loadBalancerArn] }] }, + '/', + { 'Fn::Select': [3, { 'Fn::Split': ['/', loadBalancerArn] }] }]], + }, + }); + } + }); + + test('Can add dependency on ListenerRule via TargetGroup', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { vpc }); + const group1 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup1', { vpc, port: 80 }); + const group2 = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 }); + const listener = loadBalancer.addListener('Listener', { + port: 80, + defaultTargetGroups: [group1], + }); + + // WHEN + new ResourceWithLBDependency(stack, 'SomeResource', group2); + + listener.addTargetGroups('SecondGroup', { + conditions: [elbv2.ListenerCondition.pathPatterns(['/bla'])], + priority: 10, + targetGroups: [group2], + }); + + // THEN + Template.fromStack(stack).templateMatches(Match.objectLike({ + Resources: { + SomeResource: { + Type: 'Test::Resource', + DependsOn: ['LoadBalancerListenerSecondGroupRuleF5FDC196'], + }, + }, + })); + }); + + test('Can add fixed responses', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // WHEN + listener.addAction('Default', { + action: elbv2.ListenerAction.fixedResponse(404, { + contentType: 'text/plain', + messageBody: 'Not Found', + }), + }); + listener.addAction('Hello', { + action: elbv2.ListenerAction.fixedResponse(503), + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + priority: 10, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + FixedResponseConfig: { + ContentType: 'text/plain', + MessageBody: 'Not Found', + StatusCode: '404', + }, + Type: 'fixed-response', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Actions: [ + { + FixedResponseConfig: { + StatusCode: '503', + }, + Type: 'fixed-response', + }, + ], + }); + }); + + test('imported listener only need securityGroup and listenerArn as attributes', () => { + // GIVEN + const stack = new cdk.Stack(); + + const importedListener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'listener', { + listenerArn: 'listener-arn', + defaultPort: 443, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id', { + allowAllOutbound: false, + }), + }); + importedListener.addAction('Hello', { + action: elbv2.ListenerAction.fixedResponse(503), + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + priority: 10, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + ListenerArn: 'listener-arn', + Priority: 10, + Actions: [ + { + FixedResponseConfig: { + StatusCode: '503', + }, + Type: 'fixed-response', + }, + ], + }); + }); + + test('Can add actions to an imported listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const stack2 = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // WHEN + listener.addAction('Default', { + action: elbv2.ListenerAction.fixedResponse(404, { + contentType: 'text/plain', + messageBody: 'Not Found', + }), + }); + + const importedListener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'listener', { + listenerArn: 'listener-arn', + defaultPort: 443, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SG', 'security-group-id', { + allowAllOutbound: false, + }), + }); + importedListener.addAction('Hello', { + action: elbv2.ListenerAction.fixedResponse(503), + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + priority: 10, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + FixedResponseConfig: { + ContentType: 'text/plain', + MessageBody: 'Not Found', + StatusCode: '404', + }, + Type: 'fixed-response', + }, + ], + }); + + Template.fromStack(stack2).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + ListenerArn: 'listener-arn', + Priority: 10, + Actions: [ + { + FixedResponseConfig: { + StatusCode: '503', + }, + Type: 'fixed-response', + }, + ], + }); + }); + + test('actions added to an imported listener must have a priority', () => { + // GIVEN + const stack = new cdk.Stack(); + + const importedListener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'listener', { + listenerArn: 'listener-arn', + defaultPort: 443, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id', { + allowAllOutbound: false, + }), + }); + expect(() => { + importedListener.addAction('Hello', { + action: elbv2.ListenerAction.fixedResponse(503), + }); + }).toThrow(/priority must be set for actions added to an imported listener/); + }); + + testDeprecated('Can add redirect responses', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // WHEN + listener.addRedirectResponse('Default', { + statusCode: 'HTTP_301', + port: '443', + protocol: 'HTTPS', + }); + listener.addRedirectResponse('Hello', { + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + path: '/new/#{path}', + statusCode: 'HTTP_302', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + RedirectConfig: { + Port: '443', + Protocol: 'HTTPS', + StatusCode: 'HTTP_301', + }, + Type: 'redirect', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Actions: [ + { + RedirectConfig: { + Path: '/new/#{path}', + StatusCode: 'HTTP_302', + }, + Type: 'redirect', + }, + ], + }); + }); + + test('Can add simple redirect responses', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + + // WHEN + lb.addRedirect(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Port: 80, + Protocol: 'HTTP', + DefaultActions: [ + { + RedirectConfig: { + Port: '443', + Protocol: 'HTTPS', + StatusCode: 'HTTP_301', + }, + Type: 'redirect', + }, + ], + }); + }); + + test('Can supress default ingress rules on a simple redirect response', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + }); + + // WHEN + loadBalancer.addRedirect({ open: false }); + + // THEN + const matchingGroups = Template.fromStack(stack).findResources('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Allow from anyone on port 80', + IpProtocol: 'tcp', + }, + ], + }); + expect(Object.keys(matchingGroups).length).toBe(0); + }); + + test('Can add simple redirect responses with custom values', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + + // WHEN + const listener = lb.addRedirect({ + sourceProtocol: elbv2.ApplicationProtocol.HTTPS, + sourcePort: 8443, + targetProtocol: elbv2.ApplicationProtocol.HTTP, + targetPort: 8080, + }); + listener.addCertificates('ListenerCertificateX', [importedCertificate(stack, 'cert3')]); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Port: 8443, + Protocol: 'HTTPS', + DefaultActions: [ + { + RedirectConfig: { + Port: '8080', + Protocol: 'HTTP', + StatusCode: 'HTTP_301', + }, + Type: 'redirect', + }, + ], + }); + }); + + test('Can configure deregistration_delay for targets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + deregistrationDelay: cdk.Duration.seconds(30), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'deregistration_delay.timeout_seconds', + Value: '30', + }, + { + Key: 'stickiness.enabled', + Value: 'false', + }, + ], + }); + }); + + test('Custom Load balancer algorithm type', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + // WHEN + listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + loadBalancingAlgorithmType: elbv2.TargetGroupLoadBalancingAlgorithmType.LEAST_OUTSTANDING_REQUESTS, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + Value: 'false', + }, + { + Key: 'load_balancing.algorithm.type', + Value: 'least_outstanding_requests', + }, + ], + }); + }); + + describeDeprecated('Throws with bad fixed responses', () => { + + test('status code', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => listener.addFixedResponse('Default', { + statusCode: '301', + })).toThrow(/`statusCode`/); + }); + + test('message body', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => listener.addFixedResponse('Default', { + messageBody: 'a'.repeat(1025), + statusCode: '500', + })).toThrow(/`messageBody`/); + }); + }); + + describeDeprecated('Throws with bad redirect responses', () => { + + test('status code', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => listener.addRedirectResponse('Default', { + statusCode: '301', + })).toThrow(/`statusCode`/); + }); + + test('protocol', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => listener.addRedirectResponse('Default', { + protocol: 'tcp', + statusCode: 'HTTP_301', + })).toThrow(/`protocol`/); + }); + }); + + test('Throws when specifying both target groups and an action', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { + action: elbv2.ListenerAction.fixedResponse(500), + listener, + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + targetGroups: [new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 })], + })).toThrow(/'action,targetGroups'.*/); + }); + + test('Throws when specifying priority 0', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { + action: elbv2.ListenerAction.fixedResponse(500), + listener, + priority: 0, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + })).toThrowError('Priority must have value greater than or equal to 1'); + }); + + test('Accepts unresolved priority', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { + listener, + priority: new cdk.CfnParameter(stack, 'PriorityParam', { type: 'Number' }).valueAsNumber, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + fixedResponse: { + statusCode: '500', + }, + })).not.toThrowError('Priority must have value greater than or equal to 1'); + }); + + testDeprecated('Throws when specifying both target groups and redirect response', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LoadBalancer', { + vpc, + }); + const listener = lb.addListener('Listener', { + port: 80, + }); + + // THEN + expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule', { + listener, + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + targetGroups: [new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 })], + redirectResponse: { + statusCode: 'HTTP_301', + }, + })).toThrow(/'targetGroups,redirectResponse'.*/); + + expect(() => new elbv2.ApplicationListenerRule(stack, 'Rule2', { + listener, + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + targetGroups: [new elbv2.ApplicationTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 })], + fixedResponse: { + statusCode: '500', + }, + redirectResponse: { + statusCode: 'HTTP_301', + }, + })).toThrow(/'targetGroups,fixedResponse,redirectResponse'.*/); + }); + + test('Imported listener with imported security group and allowAllOutbound set to false', () => { + // GIVEN + const stack = new cdk.Stack(); + const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { + listenerArn: 'listener-arn', + defaultPort: 443, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id', { + allowAllOutbound: false, + }), + }); + + // WHEN + listener.connections.allowToAnyIpv4(ec2.Port.tcp(443)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: 'security-group-id', + }); + }); + + test('Can pass multiple certificate arns to application listener constructor', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.addListener('Listener', { + port: 443, + certificates: [ + importedCertificate(stack, 'cert1'), + importedCertificate(stack, 'cert2'), + ], + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'HTTPS', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert2' }], + }); + }); + + test('Can use certificate wrapper class', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.addListener('Listener', { + port: 443, + certificates: [elbv2.ListenerCertificate.fromArn('cert1'), elbv2.ListenerCertificate.fromArn('cert2')], + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'HTTPS', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert2' }], + }); + }); + + testDeprecated('Can add additional certificates via addCertificateArns to application listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificateArns: ['cert1', 'cert2'], + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + listener.addCertificateArns('ListenerCertificateX', ['cert3']); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'HTTPS', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert2' }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert3' }], + }); + }); + + test('Can add multiple path patterns to listener rule', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificates: [importedCertificate(stack, 'cert1'), importedCertificate(stack, 'cert2')], + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + listener.addTargets('Target1', { + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/test/path/1', '/test/path/2'])], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 10, + Conditions: [ + { + Field: 'path-pattern', + PathPatternConfig: { Values: ['/test/path/1', '/test/path/2'] }, + }, + ], + }); + }); + + testDeprecated('Cannot add pathPattern and pathPatterns to listener rule', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificates: [importedCertificate(stack, 'cert1'), importedCertificate(stack, 'cert2')], + defaultTargetGroups: [new elbv2.ApplicationTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + expect(() => listener.addTargets('Target1', { + priority: 10, + pathPatterns: ['/test/path/1', '/test/path/2'], + pathPattern: '/test/path/3', + })).toThrowError('Both `pathPatterns` and `pathPattern` are specified, specify only one'); + }); + + test('Add additional condition to listener rule', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const group1 = new elbv2.ApplicationTargetGroup(stack, 'Group1', { vpc, port: 80 }); + const group2 = new elbv2.ApplicationTargetGroup(stack, 'Group2', { vpc, port: 81, protocol: elbv2.ApplicationProtocol.HTTP }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificates: [importedCertificate(stack, 'cert1')], + defaultTargetGroups: [group2], + }); + listener.addTargetGroups('TargetGroup1', { + priority: 10, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['app.test']), + elbv2.ListenerCondition.httpHeader('Accept', ['application/vnd.myapp.v2+json']), + ], + targetGroups: [group1], + }); + listener.addTargetGroups('TargetGroup2', { + priority: 20, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['app.test']), + ], + targetGroups: [group2], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 10, + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: ['app.test'], + }, + }, + { + Field: 'http-header', + HttpHeaderConfig: { + HttpHeaderName: 'Accept', + Values: ['application/vnd.myapp.v2+json'], + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 20, + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: ['app.test'], + }, + }, + ], + }); + }); + + test('Add multiple additonal condition to listener rule', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const group1 = new elbv2.ApplicationTargetGroup(stack, 'Group1', { vpc, port: 80 }); + const group2 = new elbv2.ApplicationTargetGroup(stack, 'Group2', { vpc, port: 81, protocol: elbv2.ApplicationProtocol.HTTP }); + const group3 = new elbv2.ApplicationTargetGroup(stack, 'Group3', { vpc, port: 82, protocol: elbv2.ApplicationProtocol.HTTP }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificates: [importedCertificate(stack, 'cert1')], + defaultTargetGroups: [group3], + }); + listener.addTargetGroups('TargetGroup1', { + priority: 10, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['app.test']), + elbv2.ListenerCondition.sourceIps(['192.0.2.0/24']), + elbv2.ListenerCondition.queryStrings([{ key: 'version', value: '2' }, { value: 'foo*' }]), + ], + targetGroups: [group1], + }); + listener.addTargetGroups('TargetGroup2', { + priority: 20, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['app.test']), + elbv2.ListenerCondition.httpHeader('Accept', ['application/vnd.myapp.v2+json']), + ], + targetGroups: [group1], + }); + listener.addTargetGroups('TargetGroup3', { + priority: 30, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['app.test']), + elbv2.ListenerCondition.httpRequestMethods(['PUT', 'COPY', 'LOCK', 'MKCOL', 'MOVE', 'PROPFIND', 'PROPPATCH', 'UNLOCK']), + ], + targetGroups: [group2], + }); + listener.addTargetGroups('TargetGroup4', { + priority: 40, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['app.test']), + ], + targetGroups: [group3], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 10, + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: ['app.test'], + }, + }, + { + Field: 'source-ip', + SourceIpConfig: { + Values: ['192.0.2.0/24'], + }, + }, + { + Field: 'query-string', + QueryStringConfig: { + Values: [ + { + Key: 'version', + Value: '2', + }, + { + Value: 'foo*', + }, + ], + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 20, + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: ['app.test'], + }, + }, + { + Field: 'http-header', + HttpHeaderConfig: { + HttpHeaderName: 'Accept', + Values: ['application/vnd.myapp.v2+json'], + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 30, + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: ['app.test'], + }, + }, + { + Field: 'http-request-method', + HttpRequestMethodConfig: { + Values: ['PUT', 'COPY', 'LOCK', 'MKCOL', 'MOVE', 'PROPFIND', 'PROPPATCH', 'UNLOCK'], + }, + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 40, + Conditions: [ + { + Field: 'host-header', + HostHeaderConfig: { + Values: ['app.test'], + }, + }, + ], + }); + }); + + testDeprecated('Can exist together legacy style conditions and modern style conditions', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const group1 = new elbv2.ApplicationTargetGroup(stack, 'Group1', { vpc, port: 80 }); + const group2 = new elbv2.ApplicationTargetGroup(stack, 'Group2', { vpc, port: 81, protocol: elbv2.ApplicationProtocol.HTTP }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificates: [importedCertificate(stack, 'cert1')], + defaultTargetGroups: [group2], + }); + listener.addTargetGroups('TargetGroup1', { + hostHeader: 'app.test', + pathPattern: '/test', + conditions: [ + elbv2.ListenerCondition.sourceIps(['192.0.2.0/24']), + ], + priority: 10, + targetGroups: [group1], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 10, + Conditions: [ + { + Field: 'host-header', + Values: ['app.test'], + }, + { + Field: 'path-pattern', + Values: ['/test'], + }, + { + Field: 'source-ip', + SourceIpConfig: { + Values: ['192.0.2.0/24'], + }, + }, + ], + }); + }); + + test('Add condition to imported application listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + const listener = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack, 'Listener', { + listenerArn: 'listener-arn', + defaultPort: 443, + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'security-group-id'), + }); + + // WHEN + listener.addTargetGroups('OtherTG', { + targetGroups: [group], + priority: 1, + conditions: [elbv2.ListenerCondition.pathPatterns(['/path1', '/path2'])], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 1, + Conditions: [ + { + Field: 'path-pattern', + PathPatternConfig: { Values: ['/path1', '/path2'] }, + }, + ], + }); + }); + + testDeprecated('not allowed to combine action specifiers when instantiating a Rule directly', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 80 }); + + const baseProps = { listener, priority: 1, pathPatterns: ['/path1', '/path2'] }; + + // WHEN + expect(() => { + new elbv2.ApplicationListenerRule(stack, 'Rule1', { + ...baseProps, + fixedResponse: { statusCode: '200' }, + action: elbv2.ListenerAction.fixedResponse(200), + }); + }).toThrow(/specify only one/); + + expect(() => { + new elbv2.ApplicationListenerRule(stack, 'Rule2', { + ...baseProps, + targetGroups: [group], + action: elbv2.ListenerAction.fixedResponse(200), + }); + }).toThrow(/specify only one/); + }); + + test('not allowed to specify defaultTargetGroups and defaultAction together', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const group = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + expect(() => { + lb.addListener('Listener1', { + port: 80, + defaultTargetGroups: [group], + defaultAction: elbv2.ListenerAction.fixedResponse(200), + }); + }).toThrow(/Specify at most one/); + }); + + describe('lookup', () => { + test('Can look up an ApplicationListener', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + // WHEN + const listener = elbv2.ApplicationListener.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 0); + expect(listener.listenerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/application/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2'); + expect(listener.connections.securityGroups[0].securityGroupId).toEqual('sg-12345678'); + }); + + test('Can add rules to a looked-up ApplicationListener', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + const listener = elbv2.ApplicationListener.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // WHEN + new elbv2.ApplicationListenerRule(stack, 'rule', { + listener, + conditions: [ + elbv2.ListenerCondition.hostHeaders(['example.com']), + ], + action: elbv2.ListenerAction.fixedResponse(200), + priority: 5, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerRule', { + Priority: 5, + }); + }); + + test('Can add certificates to a looked-up ApplicationListener', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + const listener = elbv2.ApplicationListener.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // WHEN + listener.addCertificates('certs', [ + importedCertificate(stack, 'arn:something'), + ]); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [ + { CertificateArn: 'arn:something' }, + ], + }); + }); + }); +}); + +class ResourceWithLBDependency extends cdk.CfnResource { + constructor(scope: constructs.Construct, id: string, targetGroup: elbv2.ITargetGroup) { + super(scope, id, { type: 'Test::Resource' }); + this.node.addDependency(targetGroup.loadBalancerAttached); + } +} + +function importedCertificate(stack: cdk.Stack, + certificateArn = 'arn:aws:certificatemanager:123456789012:testregion:certificate/fd0b8392-3c0e-4704-81b6-8edf8612c852') { + return acm.Certificate.fromCertificateArn(stack, certificateArn, certificateArn); +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts new file mode 100644 index 0000000000000..2013cedad9901 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts @@ -0,0 +1,658 @@ +import { Match, Template } from '../../../assertions'; +import { Metric } from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as s3 from '../../../aws-s3'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; + + +describe('tests', () => { + test('Trivial construction: internet facing', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internet-facing', + Subnets: [ + { Ref: 'StackPublicSubnet1Subnet0AD81D22' }, + { Ref: 'StackPublicSubnet2Subnet3C7D2288' }, + ], + Type: 'application', + }); + }); + + test('internet facing load balancer has dependency on IGW', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::ElasticLoadBalancingV2::LoadBalancer', { + DependsOn: [ + 'StackPublicSubnet1DefaultRoute16154E3D', + 'StackPublicSubnet1RouteTableAssociation74F1C1B6', + 'StackPublicSubnet2DefaultRoute0319539B', + 'StackPublicSubnet2RouteTableAssociation5E8F73F1', + ], + }); + }); + + test('Trivial construction: internal', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internal', + Subnets: [ + { Ref: 'StackPrivateSubnet1Subnet47AC2BC7' }, + { Ref: 'StackPrivateSubnet2SubnetA2F8EDD8' }, + ], + Type: 'application', + }); + }); + + test('Attributes', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + deletionProtection: true, + http2Enabled: false, + idleTimeout: cdk.Duration.seconds(1000), + dropInvalidHeaderFields: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: [ + { + Key: 'deletion_protection.enabled', + Value: 'true', + }, + { + Key: 'routing.http2.enabled', + Value: 'false', + }, + { + Key: 'idle_timeout.timeout_seconds', + Value: '1000', + }, + { + Key: 'routing.http.drop_invalid_header_fields.enabled', + Value: 'true', + }, + ], + }); + }); + + describe('Desync mitigation mode', () => { + test('Defensive', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + desyncMitigationMode: elbv2.DesyncMitigationMode.DEFENSIVE, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: [ + { + Key: 'deletion_protection.enabled', + Value: 'false', + }, + { + Key: 'routing.http.desync_mitigation_mode', + Value: 'defensive', + }, + ], + }); + }); + test('Monitor', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + desyncMitigationMode: elbv2.DesyncMitigationMode.MONITOR, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: [ + { + Key: 'deletion_protection.enabled', + Value: 'false', + }, + { + Key: 'routing.http.desync_mitigation_mode', + Value: 'monitor', + }, + ], + }); + }); + test('Strictest', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + desyncMitigationMode: elbv2.DesyncMitigationMode.STRICTEST, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: [ + { + Key: 'deletion_protection.enabled', + Value: 'false', + }, + { + Key: 'routing.http.desync_mitigation_mode', + Value: 'strictest', + }, + ], + }); + }); + }); + + test('Deletion protection false', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + deletionProtection: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: Match.arrayWith([ + { + Key: 'deletion_protection.enabled', + Value: 'false', + }, + ]), + }); + }); + + test('Can add and list listeners for an owned ApplicationLoadBalancer', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + const loadBalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + }); + + const listener = loadBalancer.addListener('listener', { + protocol: elbv2.ApplicationProtocol.HTTP, + defaultAction: elbv2.ListenerAction.fixedResponse(200), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); + expect(loadBalancer.listeners).toContain(listener); + }); + + describe('logAccessLogs', () => { + + function loggingSetup(): { stack: cdk.Stack, bucket: s3.Bucket, lb: elbv2.ApplicationLoadBalancer } { + const app = new cdk.App(); + const stack = new cdk.Stack(app, undefined, { env: { region: 'us-east-1' } }); + const vpc = new ec2.Vpc(stack, 'Stack'); + const bucket = new s3.Bucket(stack, 'AccessLoggingBucket'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + return { stack, bucket, lb }; + } + + test('sets load balancer attributes', () => { + // GIVEN + const { stack, bucket, lb } = loggingSetup(); + + // WHEN + lb.logAccessLogs(bucket); + + //THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: Match.arrayWith([ + { + Key: 'access_logs.s3.enabled', + Value: 'true', + }, + { + Key: 'access_logs.s3.bucket', + Value: { Ref: 'AccessLoggingBucketA6D88F29' }, + }, + { + Key: 'access_logs.s3.prefix', + Value: '', + }, + ]), + }); + }); + + test('adds a dependency on the bucket', () => { + // GIVEN + const { stack, bucket, lb } = loggingSetup(); + + // WHEN + lb.logAccessLogs(bucket); + + // THEN + // verify the ALB depends on the bucket *and* the bucket policy + Template.fromStack(stack).hasResource('AWS::ElasticLoadBalancingV2::LoadBalancer', { + DependsOn: ['AccessLoggingBucketPolicy700D7CC6', 'AccessLoggingBucketA6D88F29'], + }); + }); + + test('logging bucket permissions', () => { + // GIVEN + const { stack, bucket, lb } = loggingSetup(); + + // WHEN + lb.logAccessLogs(bucket); + + // THEN + // verify the bucket policy allows the ALB to put objects in the bucket + Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: [ + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + }, + { + Action: 's3:PutObject', + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, + }, + { + Action: 's3:GetBucketAcl', + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], + }, + }, + ], + }, + }); + }); + + test('access logging with prefix', () => { + // GIVEN + const { stack, bucket, lb } = loggingSetup(); + + // WHEN + lb.logAccessLogs(bucket, 'prefix-of-access-logs'); + + // THEN + // verify that the LB attributes reference the bucket + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: Match.arrayWith([ + { + Key: 'access_logs.s3.enabled', + Value: 'true', + }, + { + Key: 'access_logs.s3.bucket', + Value: { Ref: 'AccessLoggingBucketA6D88F29' }, + }, + { + Key: 'access_logs.s3.prefix', + Value: 'prefix-of-access-logs', + }, + ]), + }); + + // verify the bucket policy allows the ALB to put objects in the bucket + Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: [ + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + }, + { + Action: 's3:PutObject', + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, + }, + { + Action: 's3:GetBucketAcl', + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], + }, + }, + ], + }, + }); + }); + }); + + test('Exercise metrics', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const metrics = new Array(); + metrics.push(lb.metrics.activeConnectionCount()); + metrics.push(lb.metrics.clientTlsNegotiationErrorCount()); + metrics.push(lb.metrics.consumedLCUs()); + metrics.push(lb.metrics.elbAuthError()); + metrics.push(lb.metrics.elbAuthFailure()); + metrics.push(lb.metrics.elbAuthLatency()); + metrics.push(lb.metrics.elbAuthSuccess()); + metrics.push(lb.metrics.httpCodeElb(elbv2.HttpCodeElb.ELB_3XX_COUNT)); + metrics.push(lb.metrics.httpCodeTarget(elbv2.HttpCodeTarget.TARGET_3XX_COUNT)); + metrics.push(lb.metrics.httpFixedResponseCount()); + metrics.push(lb.metrics.httpRedirectCount()); + metrics.push(lb.metrics.httpRedirectUrlLimitExceededCount()); + metrics.push(lb.metrics.ipv6ProcessedBytes()); + metrics.push(lb.metrics.ipv6RequestCount()); + metrics.push(lb.metrics.newConnectionCount()); + metrics.push(lb.metrics.processedBytes()); + metrics.push(lb.metrics.rejectedConnectionCount()); + metrics.push(lb.metrics.requestCount()); + metrics.push(lb.metrics.ruleEvaluations()); + metrics.push(lb.metrics.targetConnectionErrorCount()); + metrics.push(lb.metrics.targetResponseTime()); + metrics.push(lb.metrics.targetTLSNegotiationErrorCount()); + + for (const metric of metrics) { + expect(metric.namespace).toEqual('AWS/ApplicationELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: { 'Fn::GetAtt': ['LB8A12904C', 'LoadBalancerFullName'] }, + }); + } + }); + + test('loadBalancerName', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.ApplicationLoadBalancer(stack, 'ALB', { + loadBalancerName: 'myLoadBalancer', + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Name: 'myLoadBalancer', + }); + }); + + test('imported load balancer with no vpc throws error when calling addTargets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const sg = new ec2.SecurityGroup(stack, 'sg', { + vpc, + securityGroupName: 'mySg', + }); + const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { + loadBalancerArn: albArn, + securityGroupId: sg.securityGroupId, + }); + + // WHEN + const listener = alb.addListener('Listener', { port: 80 }); + expect(() => listener.addTargets('Targets', { port: 8080 })).toThrow(); + }); + + test('imported load balancer with vpc does not throw error when calling addTargets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const sg = new ec2.SecurityGroup(stack, 'sg', { + vpc, + securityGroupName: 'mySg', + }); + const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { + loadBalancerArn: albArn, + securityGroupId: sg.securityGroupId, + vpc, + }); + + // WHEN + const listener = alb.addListener('Listener', { port: 80 }); + expect(() => listener.addTargets('Targets', { port: 8080 })).not.toThrow(); + }); + + test('imported load balancer with vpc can add but not list listeners', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const sg = new ec2.SecurityGroup(stack, 'sg', { + vpc, + securityGroupName: 'mySg', + }); + const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { + loadBalancerArn: albArn, + securityGroupId: sg.securityGroupId, + vpc, + }); + + // WHEN + const listener = alb.addListener('Listener', { port: 80 }); + listener.addTargets('Targets', { port: 8080 }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); + expect(() => alb.listeners).toThrow(); + }); + + test('imported load balancer knows its region', () => { + const stack = new cdk.Stack(); + + // WHEN + const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { + loadBalancerArn: albArn, + securityGroupId: 'sg-1234', + }); + + // THEN + expect(alb.env.region).toEqual('us-west-2'); + }); + + test('imported load balancer can produce metrics', () => { + const stack = new cdk.Stack(); + + // WHEN + const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const alb = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack, 'ALB', { + loadBalancerArn: albArn, + securityGroupId: 'sg-1234', + }); + + // THEN + const metric = alb.metrics.activeConnectionCount(); + expect(metric.namespace).toEqual('AWS/ApplicationELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: 'app/my-load-balancer/50dc6c495c0c9188', + }); + expect(alb.env.region).toEqual('us-west-2'); + }); + + test('can add secondary security groups', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + const alb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { + vpc, + securityGroup: new ec2.SecurityGroup(stack, 'SecurityGroup1', { vpc }), + }); + alb.addSecurityGroup(new ec2.SecurityGroup(stack, 'SecurityGroup2', { vpc })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + SecurityGroups: [ + { 'Fn::GetAtt': ['SecurityGroup1F554B36F', 'GroupId'] }, + { 'Fn::GetAtt': ['SecurityGroup23BE86BB7', 'GroupId'] }, + ], + Type: 'application', + }); + }); + + describe('lookup', () => { + test('Can look up an ApplicationLoadBalancer', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + // WHEN + const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::ApplicationLoadBalancer', 0); + expect(loadBalancer.loadBalancerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/application/my-load-balancer/50dc6c495c0c9188'); + expect(loadBalancer.loadBalancerCanonicalHostedZoneId).toEqual('Z3DZXE0EXAMPLE'); + expect(loadBalancer.loadBalancerDnsName).toEqual('my-load-balancer-1234567890.us-west-2.elb.amazonaws.com'); + expect(loadBalancer.ipAddressType).toEqual(elbv2.IpAddressType.DUAL_STACK); + expect(loadBalancer.connections.securityGroups[0].securityGroupId).toEqual('sg-12345678'); + expect(loadBalancer.env.region).toEqual('us-west-2'); + }); + + test('Can add but not list listeners for a looked-up ApplicationLoadBalancer', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // WHEN + loadBalancer.addListener('listener', { + protocol: elbv2.ApplicationProtocol.HTTP, + defaultAction: elbv2.ListenerAction.fixedResponse(200), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); + expect(() => loadBalancer.listeners).toThrow(); + }); + + test('Can create metrics for a looked-up ApplicationLoadBalancer', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + const loadBalancer = elbv2.ApplicationLoadBalancer.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // WHEN + const metric = loadBalancer.metrics.activeConnectionCount(); + + // THEN + expect(metric.namespace).toEqual('AWS/ApplicationELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: 'application/my-load-balancer/50dc6c495c0c9188', + }); + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/security-group.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/security-group.test.ts new file mode 100644 index 0000000000000..5e8f538064703 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/security-group.test.ts @@ -0,0 +1,289 @@ +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; +import { FakeSelfRegisteringTarget } from '../helpers'; + +describe('tests', () => { + test('security groups are automatically opened bidi for default rule', () => { + // GIVEN + const fixture = new TestFixture(); + const target = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); + + // WHEN + fixture.listener.addTargets('TargetGroup', { + port: 8008, + targets: [target], + }); + + // THEN + expectSameStackSGRules(fixture.stack); + }); + + test('security groups are automatically opened bidi for additional rule', () => { + // GIVEN + const fixture = new TestFixture(); + const target1 = new FakeSelfRegisteringTarget(fixture.stack, 'DefaultTarget', fixture.vpc); + const target2 = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); + + // WHEN + fixture.listener.addTargets('TargetGroup1', { + port: 80, + targets: [target1], + }); + + fixture.listener.addTargetGroups('Rule', { + priority: 10, + conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], + targetGroups: [new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup2', { + vpc: fixture.vpc, + port: 8008, + targets: [target2], + })], + }); + + // THEN + expectSameStackSGRules(fixture.stack); + }); + + test('adding the same targets twice also works', () => { + // GIVEN + const fixture = new TestFixture(); + const target = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); + + // WHEN + const group = new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup', { + vpc: fixture.vpc, + port: 8008, + targets: [target], + }); + + fixture.listener.addTargetGroups('Default', { + targetGroups: [group], + }); + fixture.listener.addTargetGroups('WithPath', { + priority: 10, + conditions: [elbv2.ListenerCondition.pathPatterns(['/hello'])], + targetGroups: [group], + }); + + // THEN + expectSameStackSGRules(fixture.stack); + }); + + test('same result if target is added to group after assigning to listener', () => { + // GIVEN + const fixture = new TestFixture(); + const group = new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup', { + vpc: fixture.vpc, + port: 8008, + }); + fixture.listener.addTargetGroups('Default', { + targetGroups: [group], + }); + + // WHEN + const target = new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc); + group.addTarget(target); + + // THEN + expectSameStackSGRules(fixture.stack); + }); + + test('ingress is added to child stack SG instead of parent stack', () => { + // GIVEN + const fixture = new TestFixture(true); + + const parentGroup = new elbv2.ApplicationTargetGroup(fixture.stack, 'TargetGroup', { + vpc: fixture.vpc, + port: 8008, + targets: [new FakeSelfRegisteringTarget(fixture.stack, 'Target', fixture.vpc)], + }); + + // listener requires at least one rule for ParentStack to create + fixture.listener.addTargetGroups('Default', { targetGroups: [parentGroup] }); + + const childStack = new cdk.Stack(fixture.app, 'childStack'); + + // WHEN + const childGroup = new elbv2.ApplicationTargetGroup(childStack, 'TargetGroup', { + // We're assuming the 2nd VPC is peered to the 1st, or something. + vpc: fixture.vpc, + port: 8008, + targets: [new FakeSelfRegisteringTarget(childStack, 'Target', fixture.vpc)], + }); + + new elbv2.ApplicationListenerRule(childStack, 'ListenerRule', { + listener: fixture.listener, + targetGroups: [childGroup], + priority: 100, + conditions: [elbv2.ListenerCondition.hostHeaders(['www.foo.com'])], + }); + + // THEN + expectSameStackSGRules(fixture.stack); + expectedImportedSGRules(childStack); + }); + + test('SG peering works on exported/imported load balancer', () => { + // GIVEN + const fixture = new TestFixture(false); + const stack2 = new cdk.Stack(fixture.app, 'stack2'); + const vpc2 = new ec2.Vpc(stack2, 'VPC'); + const group = new elbv2.ApplicationTargetGroup(stack2, 'TargetGroup', { + // We're assuming the 2nd VPC is peered to the 1st, or something. + vpc: vpc2, + port: 8008, + targets: [new FakeSelfRegisteringTarget(stack2, 'Target', vpc2)], + }); + + // WHEN + const lb2 = elbv2.ApplicationLoadBalancer.fromApplicationLoadBalancerAttributes(stack2, 'LB', { + loadBalancerArn: fixture.lb.loadBalancerArn, + securityGroupId: fixture.lb.connections.securityGroups[0].securityGroupId, + securityGroupAllowsAllOutbound: false, + }); + const listener2 = lb2.addListener('YetAnotherListener', { port: 80 }); + listener2.addTargetGroups('Default', { targetGroups: [group] }); + + // THEN + expectedImportedSGRules(stack2); + }); + + test('SG peering works on exported/imported listener', () => { + // GIVEN + const fixture = new TestFixture(); + const stack2 = new cdk.Stack(fixture.app, 'stack2'); + const vpc2 = new ec2.Vpc(stack2, 'VPC'); + const group = new elbv2.ApplicationTargetGroup(stack2, 'TargetGroup', { + // We're assuming the 2nd VPC is peered to the 1st, or something. + vpc: vpc2, + port: 8008, + targets: [new FakeSelfRegisteringTarget(stack2, 'Target', vpc2)], + }); + fixture.listener.addTargets('default', { port: 80 }); + + // WHEN + const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SecurityGroup', + fixture.listener.connections.securityGroups[0].securityGroupId, + { allowAllOutbound: false }); + const listener2 = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'YetAnotherListener', { + defaultPort: 8008, + listenerArn: fixture.listener.listenerArn, + securityGroup, + }); + listener2.addTargetGroups('Default', { + // Must be a non-default target + priority: 10, + conditions: [elbv2.ListenerCondition.hostHeaders(['example.com'])], + targetGroups: [group], + }); + + // THEN + expectedImportedSGRules(stack2); + }); + + testDeprecated('default port peering works on constructed listener', () => { + // GIVEN + const fixture = new TestFixture(); + fixture.listener.addTargets('Default', { port: 8080, targets: [new elbv2.InstanceTarget('i-12345')] }); + + // WHEN + fixture.listener.connections.allowDefaultPortFromAnyIpv4('Open to the world'); + + // THEN + Template.fromStack(fixture.stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + SecurityGroupIngress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'Open to the world', + FromPort: 80, + IpProtocol: 'tcp', + ToPort: 80, + }, + ], + }); + }); + + test('default port peering works on imported listener', () => { + // GIVEN + const stack2 = new cdk.Stack(); + const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack2, 'SecurityGroup', 'imported-security-group-id'); + + // WHEN + const listener2 = elbv2.ApplicationListener.fromApplicationListenerAttributes(stack2, 'YetAnotherListener', { + listenerArn: 'listener-arn', + securityGroup, + defaultPort: 8080, + }); + listener2.connections.allowDefaultPortFromAnyIpv4('Open to the world'); + + // THEN + Template.fromStack(stack2).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + CidrIp: '0.0.0.0/0', + Description: 'Open to the world', + IpProtocol: 'tcp', + FromPort: 8080, + ToPort: 8080, + GroupId: 'imported-security-group-id', + }); + }); +}); + +const LB_SECURITY_GROUP = { 'Fn::GetAtt': ['LBSecurityGroup8A41EA2B', 'GroupId'] }; +const IMPORTED_LB_SECURITY_GROUP = { 'Fn::ImportValue': 'Stack:ExportsOutputFnGetAttLBSecurityGroup8A41EA2BGroupId851EE1F6' }; + +function expectSameStackSGRules(stack: cdk.Stack) { + expectSGRules(stack, LB_SECURITY_GROUP); +} + +function expectedImportedSGRules(stack: cdk.Stack) { + expectSGRules(stack, IMPORTED_LB_SECURITY_GROUP); +} + +function expectSGRules(stack: cdk.Stack, lbGroup: any) { + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: lbGroup, + IpProtocol: 'tcp', + Description: 'Load balancer to target', + DestinationSecurityGroupId: { 'Fn::GetAtt': ['TargetSGDB98152D', 'GroupId'] }, + FromPort: 8008, + ToPort: 8008, + }); + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + IpProtocol: 'tcp', + Description: 'Load balancer to target', + FromPort: 8008, + GroupId: { 'Fn::GetAtt': ['TargetSGDB98152D', 'GroupId'] }, + SourceSecurityGroupId: lbGroup, + ToPort: 8008, + }); +} + +class TestFixture { + public readonly app: cdk.App; + public readonly stack: cdk.Stack; + public readonly vpc: ec2.Vpc; + public readonly lb: elbv2.ApplicationLoadBalancer; + public readonly _listener: elbv2.ApplicationListener | undefined; + + constructor(createListener?: boolean) { + this.app = new cdk.App(); + this.stack = new cdk.Stack(this.app, 'Stack'); + this.vpc = new ec2.Vpc(this.stack, 'VPC', { + maxAzs: 2, + }); + this.lb = new elbv2.ApplicationLoadBalancer(this.stack, 'LB', { vpc: this.vpc }); + + createListener = createListener ?? true; + if (createListener) { + this._listener = this.lb.addListener('Listener', { port: 80, open: false }); + } + } + + public get listener(): elbv2.ApplicationListener { + if (this._listener === undefined) { throw new Error('Did not create a listener'); } + return this._listener; + } +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/target-group.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/target-group.test.ts new file mode 100644 index 0000000000000..69c85c77205e2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/target-group.test.ts @@ -0,0 +1,646 @@ +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; +import { FakeSelfRegisteringTarget } from '../helpers'; + +describe('tests', () => { + test('Empty target Group without type still requires a VPC', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'LB', {}); + + // THEN + expect(() => { + app.synth(); + }).toThrow(/'vpc' is required for a non-Lambda TargetGroup/); + }); + + test('Lambda target should not have stickiness.enabled set', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + new elbv2.ApplicationTargetGroup(stack, 'TG', { + targetType: elbv2.TargetType.LAMBDA, + }); + + const tg = new elbv2.ApplicationTargetGroup(stack, 'TG2'); + tg.addTarget({ + attachToApplicationTargetGroup(_targetGroup: elbv2.IApplicationTargetGroup): elbv2.LoadBalancerTargetProps { + return { + targetType: elbv2.TargetType.LAMBDA, + targetJson: { id: 'arn:aws:lambda:eu-west-1:123456789012:function:myFn' }, + }; + }, + }); + + const matches = Template.fromStack(stack).findResources('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + }, + ], + }); + expect(Object.keys(matches).length).toBe(0); + }); + + test('Lambda target should not have port set', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + const tg = new elbv2.ApplicationTargetGroup(stack, 'TG2', { + protocol: elbv2.ApplicationProtocol.HTTPS, + }); + tg.addTarget({ + attachToApplicationTargetGroup(_targetGroup: elbv2.IApplicationTargetGroup): elbv2.LoadBalancerTargetProps { + return { + targetType: elbv2.TargetType.LAMBDA, + targetJson: { id: 'arn:aws:lambda:eu-west-1:123456789012:function:myFn' }, + }; + }, + }); + expect(() => app.synth()).toThrow(/port\/protocol should not be specified for Lambda targets/); + }); + + test('Lambda target should not have protocol set', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + new elbv2.ApplicationTargetGroup(stack, 'TG', { + port: 443, + targetType: elbv2.TargetType.LAMBDA, + }); + expect(() => app.synth()).toThrow(/port\/protocol should not be specified for Lambda targets/); + }); + + test('Can add self-registering target to imported TargetGroup', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + const tg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'TG', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', + }); + tg.addTarget(new FakeSelfRegisteringTarget(stack, 'Target', vpc)); + }); + + testDeprecated('Cannot add direct target to imported TargetGroup', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const tg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'TG', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', + }); + + // WHEN + expect(() => { + tg.addTarget(new elbv2.InstanceTarget('i-1234')); + }).toThrow(/Cannot add a non-self registering target to an imported TargetGroup/); + }); + + testDeprecated('HealthCheck fields set if provided', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const alb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', { vpc }); + const listener = new elbv2.ApplicationListener(stack, 'Listener', { + port: 80, + loadBalancer: alb, + open: false, + }); + + // WHEN + const ipTarget = new elbv2.IpTarget('10.10.12.12'); + listener.addTargets('TargetGroup', { + targets: [ipTarget], + port: 80, + healthCheck: { + enabled: true, + healthyHttpCodes: '255', + interval: cdk.Duration.seconds(255), + timeout: cdk.Duration.seconds(192), + healthyThresholdCount: 29, + unhealthyThresholdCount: 27, + path: '/arbitrary', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + HealthCheckEnabled: true, + HealthCheckIntervalSeconds: 255, + HealthCheckPath: '/arbitrary', + HealthCheckTimeoutSeconds: 192, + HealthyThresholdCount: 29, + Matcher: { + HttpCode: '255', + }, + Port: 80, + UnhealthyThresholdCount: 27, + }); + }); + + test('Load balancer duration cookie stickiness', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + stickinessCookieDuration: cdk.Duration.minutes(5), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + Value: 'true', + }, + { + Key: 'stickiness.type', + Value: 'lb_cookie', + }, + { + Key: 'stickiness.lb_cookie.duration_seconds', + Value: '300', + }, + ], + }); + }); + + test('Load balancer app cookie stickiness', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + stickinessCookieDuration: cdk.Duration.minutes(5), + stickinessCookieName: 'MyDeliciousCookie', + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + Value: 'true', + }, + { + Key: 'stickiness.type', + Value: 'app_cookie', + }, + { + Key: 'stickiness.app_cookie.cookie_name', + Value: 'MyDeliciousCookie', + }, + { + Key: 'stickiness.app_cookie.duration_seconds', + Value: '300', + }, + ], + }); + }); + + test('Custom Load balancer algorithm type', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + loadBalancingAlgorithmType: elbv2.TargetGroupLoadBalancingAlgorithmType.LEAST_OUTSTANDING_REQUESTS, + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'stickiness.enabled', + Value: 'false', + }, + { + Key: 'load_balancing.algorithm.type', + Value: 'least_outstanding_requests', + }, + ], + }); + }); + + test('Can set a protocol version', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + protocolVersion: elbv2.ApplicationProtocolVersion.GRPC, + healthCheck: { + enabled: true, + healthyGrpcCodes: '0-99', + interval: cdk.Duration.seconds(255), + timeout: cdk.Duration.seconds(192), + healthyThresholdCount: 29, + unhealthyThresholdCount: 27, + path: '/arbitrary', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + ProtocolVersion: 'GRPC', + HealthCheckEnabled: true, + HealthCheckIntervalSeconds: 255, + HealthCheckPath: '/arbitrary', + HealthCheckTimeoutSeconds: 192, + HealthyThresholdCount: 29, + Matcher: { + GrpcCode: '0-99', + }, + UnhealthyThresholdCount: 27, + }); + }); + + test('Bad stickiness cookie names', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const errMessage = 'App cookie names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they\'re reserved for use by the load balancer'; + + // THEN + ['AWSALBCookieName', 'AWSALBstickinessCookieName', 'AWSALBTGCookieName'].forEach((badCookieName, i) => { + expect(() => { + new elbv2.ApplicationTargetGroup(stack, `TargetGroup${i}`, { + stickinessCookieDuration: cdk.Duration.minutes(5), + stickinessCookieName: badCookieName, + vpc, + }); + }).toThrow(errMessage); + }); + }); + + test('Empty stickiness cookie name', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // THEN + expect(() => { + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + stickinessCookieDuration: cdk.Duration.minutes(5), + stickinessCookieName: '', + vpc, + }); + }).toThrow(/App cookie name cannot be an empty string./); + }); + + test('Bad stickiness duration value', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // THEN + expect(() => { + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + stickinessCookieDuration: cdk.Duration.days(8), + vpc, + }); + }).toThrow(/Stickiness cookie duration value must be between 1 second and 7 days \(604800 seconds\)./); + }); + + test('Bad slow start duration value', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // THEN + [cdk.Duration.minutes(16), cdk.Duration.seconds(29)].forEach((badDuration, i) => { + expect(() => { + new elbv2.ApplicationTargetGroup(stack, `TargetGroup${i}`, { + slowStart: badDuration, + vpc, + }); + }).toThrow(/Slow start duration value must be between 30 and 900 seconds./); + }); + }); + + test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( + 'Throws validation error, when `healthCheck` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + healthCheck: { + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS]`); + }); + + test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( + 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + }); + + // WHEN + tg.configureHealthCheck({ + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS]`); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Does not throw validation error, when `healthCheck` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + healthCheck: { + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Does not throw validation error, when `configureHealthCheck()` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + }); + + // WHEN + tg.configureHealthCheck({ + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Throws validation error, when `healthCheck` has `protocol` set to %s and `interval` is equal to `timeout`', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + healthCheck: { + interval: cdk.Duration.seconds(60), + timeout: cdk.Duration.seconds(60), + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 1 minute'); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Throws validation error, when `healthCheck` has `protocol` set to %s and `interval` is smaller than `timeout`', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + healthCheck: { + interval: cdk.Duration.seconds(60), + timeout: cdk.Duration.seconds(120), + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 2 minutes'); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s and `interval` is equal to `timeout`', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + }); + + // WHEN + tg.configureHealthCheck({ + interval: cdk.Duration.seconds(60), + timeout: cdk.Duration.seconds(60), + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 1 minute'); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s and `interval` is smaller than `timeout`', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + }); + + // WHEN + tg.configureHealthCheck({ + interval: cdk.Duration.seconds(60), + timeout: cdk.Duration.seconds(120), + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 2 minutes'); + }); + + test('Throws validation error, when `configureHealthCheck()`protocol is undefined and `interval` is smaller than `timeout`', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.ApplicationTargetGroup(stack, 'TargetGroup', { + vpc, + }); + + // WHEN + tg.configureHealthCheck({ + interval: cdk.Duration.seconds(60), + timeout: cdk.Duration.seconds(120), + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Healthcheck interval 1 minute must be greater than the timeout 2 minute'); + }); + + test('imported targetGroup has targetGroupName', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067', + }); + + // THEN + expect(importedTg.targetGroupName).toEqual('myAlbTargetGroup'); + }); + + test('imported targetGroup with imported ARN has targetGroupName', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const importedTgArn = cdk.Fn.importValue('ImportTargetGroupArn'); + const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: importedTgArn, + }); + new cdk.CfnOutput(stack, 'TargetGroupOutput', { + value: importedTg.targetGroupName, + }); + + // THEN + Template.fromStack(stack).hasOutput('TargetGroupOutput', { + Value: { + 'Fn::Select': [ + // myAlbTargetGroup + 1, + { + 'Fn::Split': [ + // [targetgroup, myAlbTargetGroup, 73e2d6bc24d8a067] + '/', + { + 'Fn::Select': [ + // targetgroup/myAlbTargetGroup/73e2d6bc24d8a067 + 5, + { + 'Fn::Split': [ + // [arn, aws, elasticloadbalancing, us-west-2, 123456789012, targetgroup/myAlbTargetGroup/73e2d6bc24d8a067] + ':', + { + // arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myAlbTargetGroup/73e2d6bc24d8a067 + 'Fn::ImportValue': 'ImportTargetGroupArn', + }, + ], + }, + ], + }, + ], + }, + ], + }, + }); + }); + + test('imported targetGroup has metrics', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', + loadBalancerArns: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/73e2d6bc24d8a067', + }); + + const metric = targetGroup.metrics.custom('MetricName'); + + // THEN + expect(metric.namespace).toEqual('AWS/ApplicationELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: 'app/my-load-balancer/73e2d6bc24d8a067', + TargetGroup: 'targetgroup/my-target-group/50dc6c495c0c9188', + }); + }); + + test('imported targetGroup without load balancer cannot have metrics', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const targetGroup = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', + }); + + expect(() => targetGroup.metrics.custom('MetricName')).toThrow(); + }); +}); diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/helpers.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/helpers.ts similarity index 95% rename from packages/@aws-cdk/aws-elasticloadbalancingv2/test/helpers.ts rename to packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/helpers.ts index 1df29adf5d6ba..c31d7f54fb05c 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/test/helpers.ts +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/helpers.ts @@ -1,4 +1,4 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; +import * as ec2 from '../../aws-ec2'; import { Construct } from 'constructs'; import * as elbv2 from '../lib'; diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/actions.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/actions.test.ts new file mode 100644 index 0000000000000..a2b42c8b4450a --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/actions.test.ts @@ -0,0 +1,90 @@ +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; + +let stack: cdk.Stack; +let group1: elbv2.NetworkTargetGroup; +let group2: elbv2.NetworkTargetGroup; +let lb: elbv2.NetworkLoadBalancer; + +beforeEach(() => { + stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + group1 = new elbv2.NetworkTargetGroup(stack, 'TargetGroup1', { vpc, port: 80 }); + group2 = new elbv2.NetworkTargetGroup(stack, 'TargetGroup2', { vpc, port: 80 }); + lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); +}); + +describe('tests', () => { + test('Forward to multiple targetgroups with an Action and stickiness', () => { + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: elbv2.NetworkListenerAction.forward([group1, group2], { + stickinessDuration: cdk.Duration.hours(1), + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + ForwardConfig: { + TargetGroupStickinessConfig: { + DurationSeconds: 3600, + Enabled: true, + }, + TargetGroups: [ + { + TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, + }, + { + TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, + }, + ], + }, + Type: 'forward', + }, + ], + }); + }); + + test('Weighted forward to multiple targetgroups with an Action', () => { + // WHEN + lb.addListener('Listener', { + port: 80, + defaultAction: elbv2.NetworkListenerAction.weightedForward([ + { targetGroup: group1, weight: 10 }, + { targetGroup: group2, weight: 50 }, + ], { + stickinessDuration: cdk.Duration.hours(1), + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + ForwardConfig: { + TargetGroupStickinessConfig: { + DurationSeconds: 3600, + Enabled: true, + }, + TargetGroups: [ + { + TargetGroupArn: { Ref: 'TargetGroup1E5480F51' }, + Weight: 10, + }, + { + TargetGroupArn: { Ref: 'TargetGroup2D571E5D7' }, + Weight: 50, + }, + ], + }, + Type: 'forward', + }, + ], + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/listener.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/listener.test.ts new file mode 100644 index 0000000000000..15ba68b9e0341 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/listener.test.ts @@ -0,0 +1,525 @@ +import { Match, Template } from '../../../assertions'; +import * as acm from '../../../aws-certificatemanager'; +import * as ec2 from '../../../aws-ec2'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../../core'; +import * as constructs from 'constructs'; +import * as elbv2 from '../../lib'; +import { FakeSelfRegisteringTarget } from '../helpers'; + +describe('tests', () => { + test('Trivial add listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.addListener('Listener', { + port: 443, + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'TCP', + Port: 443, + }); + }); + + test('Can add target groups', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 443 }); + const group = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + + // WHEN + listener.addTargetGroups('Default', group); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + TargetGroupArn: { Ref: 'TargetGroup3D7CD9B8' }, + Type: 'forward', + }, + ], + }); + }); + + testDeprecated('Can implicitly create target groups', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 443 }); + + // WHEN + listener.addTargets('Targets', { + port: 80, + targets: [new elbv2.InstanceTarget('i-12345')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, + Type: 'forward', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + VpcId: { Ref: 'Stack8A423254' }, + Port: 80, + Protocol: 'TCP', + Targets: [ + { Id: 'i-12345' }, + ], + }); + }); + + testDeprecated('implicitly created target group inherits protocol', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 9700, protocol: elbv2.Protocol.TCP_UDP }); + + // WHEN + listener.addTargets('Targets', { + port: 9700, + targets: [new elbv2.InstanceTarget('i-12345')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + DefaultActions: [ + { + TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, + Type: 'forward', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + VpcId: { Ref: 'Stack8A423254' }, + Port: 9700, + Protocol: 'TCP_UDP', + Targets: [ + { Id: 'i-12345' }, + ], + }); + }); + + testDeprecated('implicitly created target group but overrides inherited protocol', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const cert = new acm.Certificate(stack, 'Certificate', { + domainName: 'example.com', + }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.TLS, + certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)], + sslPolicy: elbv2.SslPolicy.TLS12, + }); + + // WHEN + listener.addTargets('Targets', { + port: 80, + protocol: elbv2.Protocol.TCP, + targets: [new elbv2.InstanceTarget('i-12345')], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'TLS', + Port: 443, + Certificates: [ + { CertificateArn: { Ref: 'Certificate4E7ABB08' } }, + ], + SslPolicy: 'ELBSecurityPolicy-TLS-1-2-2017-01', + DefaultActions: [ + { + TargetGroupArn: { Ref: 'LBListenerTargetsGroup76EF81E8' }, + Type: 'forward', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + VpcId: { Ref: 'Stack8A423254' }, + Port: 80, + Protocol: 'TCP', + Targets: [ + { Id: 'i-12345' }, + ], + }); + }); + + test('Enable health check for targets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 443 }); + + // WHEN + const group = listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + group.configureHealthCheck({ + interval: cdk.Duration.seconds(30), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + HealthCheckIntervalSeconds: 30, + }); + }); + + test('Enable taking a dependency on an NLB target group\'s load balancer', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('Listener', { port: 443 }); + const group = listener.addTargets('Group', { + port: 80, + targets: [new FakeSelfRegisteringTarget(stack, 'Target', vpc)], + }); + + // WHEN + new ResourceWithLBDependency(stack, 'MyResource', group); + + // THEN + Template.fromStack(stack).templateMatches(Match.objectLike({ + Resources: { + MyResource: { + Type: 'Test::Resource', + DependsOn: [ + // 2nd dependency is there because of the structure of the construct tree. + // It does not harm. + 'LBListenerGroupGroup79B304FF', + 'LBListener49E825B4', + ], + }, + }, + })); + }); + + test('Trivial add TLS listener', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const cert = new acm.Certificate(stack, 'Certificate', { + domainName: 'example.com', + }); + + // WHEN + lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.TLS, + certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)], + sslPolicy: elbv2.SslPolicy.TLS12, + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'TLS', + Port: 443, + Certificates: [ + { CertificateArn: { Ref: 'Certificate4E7ABB08' } }, + ], + SslPolicy: 'ELBSecurityPolicy-TLS-1-2-2017-01', + }); + }); + + test('Trivial add TLS listener with ALPN', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const cert = new acm.Certificate(stack, 'Certificate', { + domainName: 'example.com', + }); + + // WHEN + lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.TLS, + alpnPolicy: elbv2.AlpnPolicy.HTTP2_ONLY, + certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)], + sslPolicy: elbv2.SslPolicy.TLS12, + defaultTargetGroups: [ + new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 }), + ], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'TLS', + Port: 443, + AlpnPolicy: ['HTTP2Only'], + Certificates: [{ CertificateArn: { Ref: 'Certificate4E7ABB08' } }], + SslPolicy: 'ELBSecurityPolicy-TLS-1-2-2017-01', + }); + }); + + test('Incompatible Protocol with ALPN', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + expect(() => lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.TCP, + alpnPolicy: elbv2.AlpnPolicy.HTTP2_OPTIONAL, + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + })).toThrow(/Protocol must be TLS when alpnPolicy have been specified/); + }); + + test('Invalid Protocol listener', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + expect(() => lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.HTTP, + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + })).toThrow(/The protocol must be one of TCP, TLS, UDP, TCP_UDP\. Found HTTP/); + }); + + test('Invalid Listener Target Healthcheck Interval', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('PublicListener', { port: 80 }); + const targetGroup = listener.addTargets('ECS', { + port: 80, + healthCheck: { + interval: cdk.Duration.seconds(350), + }, + }); + + const validationErrors: string[] = targetGroup.node.validate(); + const intervalError = validationErrors.find((err) => /Health check interval '350' not supported. Must be between/.test(err)); + expect(intervalError).toBeDefined(); + }); + + test('validation error if invalid health check protocol', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('PublicListener', { port: 80 }); + const targetGroup = listener.addTargets('ECS', { + port: 80, + healthCheck: { + interval: cdk.Duration.seconds(60), + }, + }); + + targetGroup.configureHealthCheck({ + interval: cdk.Duration.seconds(30), + protocol: elbv2.Protocol.UDP, + }); + + // THEN + const validationErrors: string[] = targetGroup.node.validate(); + expect(validationErrors).toEqual(["Health check protocol 'UDP' is not supported. Must be one of [HTTP, HTTPS, TCP]"]); + }); + + test('validation error if invalid path health check protocol', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('PublicListener', { port: 80 }); + const targetGroup = listener.addTargets('ECS', { + port: 80, + healthCheck: { + interval: cdk.Duration.seconds(60), + }, + }); + + targetGroup.configureHealthCheck({ + interval: cdk.Duration.seconds(30), + protocol: elbv2.Protocol.TCP, + path: '/', + }); + + // THEN + const validationErrors: string[] = targetGroup.node.validate(); + expect(validationErrors).toEqual([ + "'TCP' health checks do not support the path property. Must be one of [HTTP, HTTPS]", + ]); + }); + + test('validation error if invalid timeout health check', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = lb.addListener('PublicListener', { port: 80 }); + const targetGroup = listener.addTargets('ECS', { + port: 80, + healthCheck: { + interval: cdk.Duration.seconds(60), + }, + }); + + targetGroup.configureHealthCheck({ + interval: cdk.Duration.seconds(30), + protocol: elbv2.Protocol.HTTP, + timeout: cdk.Duration.seconds(10), + }); + + // THEN + const validationErrors: string[] = targetGroup.node.validate(); + expect(validationErrors).toEqual([ + 'Custom health check timeouts are not supported for Network Load Balancer health checks. Expected 6 seconds for HTTP, got 10', + ]); + }); + + test('Protocol & certs TLS listener', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + expect(() => lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.TLS, + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + })).toThrow(/When the protocol is set to TLS, you must specify certificates/); + }); + + test('TLS and certs specified listener', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const cert = new acm.Certificate(stack, 'Certificate', { + domainName: 'example.com', + }); + + expect(() => lb.addListener('Listener', { + port: 443, + protocol: elbv2.Protocol.TCP, + certificates: [{ certificateArn: cert.certificateArn }], + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + })).toThrow(/Protocol must be TLS when certificates have been specified/); + }); + + test('Can pass multiple certificates to network listener constructor', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.addListener('Listener', { + port: 443, + certificates: [ + importedCertificate(stack, 'cert1'), + importedCertificate(stack, 'cert2'), + ], + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'TLS', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert2' }], + }); + }); + + test('Can add multiple certificates to network listener after construction', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + const listener = lb.addListener('Listener', { + port: 443, + certificates: [ + importedCertificate(stack, 'cert1'), + ], + defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })], + }); + + listener.addCertificates('extra', [ + importedCertificate(stack, 'cert2'), + ]); + + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', { + Protocol: 'TLS', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::ListenerCertificate', { + Certificates: [{ CertificateArn: 'cert2' }], + }); + }); + + test('not allowed to specify defaultTargetGroups and defaultAction together', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const group = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { vpc, port: 80 }); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + expect(() => { + lb.addListener('Listener1', { + port: 80, + defaultTargetGroups: [group], + defaultAction: elbv2.NetworkListenerAction.forward([group]), + }); + }).toThrow(/Specify at most one/); + }); + + test('Can look up an NetworkListener', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + // WHEN + const listener = elbv2.NetworkListener.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 0); + expect(listener.listenerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/network/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2'); + }); +}); + +class ResourceWithLBDependency extends cdk.CfnResource { + constructor(scope: constructs.Construct, id: string, targetGroup: elbv2.ITargetGroup) { + super(scope, id, { type: 'Test::Resource' }); + this.node.addDependency(targetGroup.loadBalancerAttached); + } +} + +function importedCertificate(stack: cdk.Stack, + certificateArn = 'arn:aws:certificatemanager:123456789012:testregion:certificate/fd0b8392-3c0e-4704-81b6-8edf8612c852') { + return acm.Certificate.fromCertificateArn(stack, certificateArn, certificateArn); +} diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts new file mode 100644 index 0000000000000..cbd1507cfe247 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts @@ -0,0 +1,654 @@ +import { Match, Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as route53 from '../../../aws-route53'; +import * as s3 from '../../../aws-s3'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; + +describe('tests', () => { + test('Trivial construction: internet facing', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internet-facing', + Subnets: [ + { Ref: 'StackPublicSubnet1Subnet0AD81D22' }, + { Ref: 'StackPublicSubnet2Subnet3C7D2288' }, + ], + Type: 'network', + }); + }); + + test('Trivial construction: internal', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internal', + Subnets: [ + { Ref: 'StackPrivateSubnet1Subnet47AC2BC7' }, + { Ref: 'StackPrivateSubnet2SubnetA2F8EDD8' }, + ], + Type: 'network', + }); + }); + + test('VpcEndpointService with Domain Name imported from public hosted zone', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const nlb = new elbv2.NetworkLoadBalancer(stack, 'Nlb', { vpc }); + const endpointService = new ec2.VpcEndpointService(stack, 'EndpointService', { vpcEndpointServiceLoadBalancers: [nlb] }); + + // WHEN + const importedPHZ = route53.PublicHostedZone.fromPublicHostedZoneAttributes(stack, 'MyPHZ', { + hostedZoneId: 'sampleid', + zoneName: 'MyZone', + }); + new route53.VpcEndpointServiceDomainName(stack, 'EndpointServiceDomainName', { + endpointService, + domainName: 'MyDomain', + publicHostedZone: importedPHZ, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + HostedZoneId: 'sampleid', + }); + }); + + test('Attributes', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + crossZoneEnabled: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: Match.arrayWith([ + { + Key: 'load_balancing.cross_zone.enabled', + Value: 'true', + }, + ]), + }); + }); + + test('Access logging', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, undefined, { env: { region: 'us-east-1' } }); + const vpc = new ec2.Vpc(stack, 'Stack'); + const bucket = new s3.Bucket(stack, 'AccessLoggingBucket'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.logAccessLogs(bucket); + + // THEN + + // verify that the LB attributes reference the bucket + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: Match.arrayWith([ + { + Key: 'access_logs.s3.enabled', + Value: 'true', + }, + { + Key: 'access_logs.s3.bucket', + Value: { Ref: 'AccessLoggingBucketA6D88F29' }, + }, + { + Key: 'access_logs.s3.prefix', + Value: '', + }, + ]), + }); + + // verify the bucket policy allows the ALB to put objects in the bucket + Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: [ + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + }, + { + Action: 's3:PutObject', + Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + }, + { + Action: 's3:GetBucketAcl', + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], + }, + }, + ], + }, + }); + + // verify the ALB depends on the bucket *and* the bucket policy + Template.fromStack(stack).hasResource('AWS::ElasticLoadBalancingV2::LoadBalancer', { + DependsOn: ['AccessLoggingBucketPolicy700D7CC6', 'AccessLoggingBucketA6D88F29'], + }); + }); + + test('access logging with prefix', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, undefined, { env: { region: 'us-east-1' } }); + const vpc = new ec2.Vpc(stack, 'Stack'); + const bucket = new s3.Bucket(stack, 'AccessLoggingBucket'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + + // WHEN + lb.logAccessLogs(bucket, 'prefix-of-access-logs'); + + // THEN + // verify that the LB attributes reference the bucket + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + LoadBalancerAttributes: Match.arrayWith([ + { + Key: 'access_logs.s3.enabled', + Value: 'true', + }, + { + Key: 'access_logs.s3.bucket', + Value: { Ref: 'AccessLoggingBucketA6D88F29' }, + }, + { + Key: 'access_logs.s3.prefix', + Value: 'prefix-of-access-logs', + }, + ]), + }); + + // verify the bucket policy allows the ALB to put objects in the bucket + Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: [ + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Principal: { AWS: { 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::127311923021:root']] } }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + }, + { + Action: 's3:PutObject', + Condition: { StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' } }, + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::Join': ['', [{ 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'] }, '/prefix-of-access-logs/AWSLogs/', + { Ref: 'AWS::AccountId' }, '/*']], + }, + }, + { + Action: 's3:GetBucketAcl', + Effect: 'Allow', + Principal: { Service: 'delivery.logs.amazonaws.com' }, + Resource: { + 'Fn::GetAtt': ['AccessLoggingBucketA6D88F29', 'Arn'], + }, + }, + ], + }, + }); + }); + + test('loadBalancerName', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'ALB', { + loadBalancerName: 'myLoadBalancer', + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Name: 'myLoadBalancer', + }); + }); + + test('loadBalancerName unallowed: more than 32 characters', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'NLB', { + loadBalancerName: 'a'.repeat(33), + vpc, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Load balancer name: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" can have a maximum of 32 characters.'); + }); + + test('loadBalancerName unallowed: starts with "internal-"', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'NLB', { + loadBalancerName: 'internal-myLoadBalancer', + vpc, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Load balancer name: "internal-myLoadBalancer" must not begin with "internal-".'); + }); + + test('loadBalancerName unallowed: starts with hyphen', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'NLB', { + loadBalancerName: '-myLoadBalancer', + vpc, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Load balancer name: "-myLoadBalancer" must not begin or end with a hyphen.'); + }); + + test('loadBalancerName unallowed: ends with hyphen', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'NLB', { + loadBalancerName: 'myLoadBalancer-', + vpc, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Load balancer name: "myLoadBalancer-" must not begin or end with a hyphen.'); + }); + + test('loadBalancerName unallowed: unallowed characters', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'NLB', { + loadBalancerName: 'my load balancer', + vpc, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Load balancer name: "my load balancer" must contain only alphanumeric characters or hyphens.'); + }); + + test('imported network load balancer with no vpc specified throws error when calling addTargets', () => { + // GIVEN + const stack = new cdk.Stack(); + const nlbArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const nlb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'NLB', { + loadBalancerArn: nlbArn, + }); + // WHEN + const listener = nlb.addListener('Listener', { port: 80 }); + expect(() => listener.addTargets('targetgroup', { port: 8080 })).toThrow(); + }); + + test('imported network load balancer with vpc does not throw error when calling addTargets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + const nlbArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const nlb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'NLB', { + loadBalancerArn: nlbArn, + vpc, + }); + // WHEN + const listener = nlb.addListener('Listener', { port: 80 }); + expect(() => listener.addTargets('targetgroup', { port: 8080 })).not.toThrow(); + }); + + test('imported load balancer knows its region', () => { + const stack = new cdk.Stack(); + + // WHEN + const albArn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'; + const alb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'ALB', { + loadBalancerArn: albArn, + }); + + // THEN + expect(alb.env.region).toEqual('us-west-2'); + }); + + test('imported load balancer can have metrics', () => { + const stack = new cdk.Stack(); + + // WHEN + const arn = 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188'; + const nlb = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(stack, 'NLB', { + loadBalancerArn: arn, + }); + + const metric = nlb.metrics.custom('MetricName'); + + // THEN + expect(metric.namespace).toEqual('AWS/NetworkELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: 'network/my-load-balancer/50dc6c495c0c9188', + }); + }); + + test('Trivial construction: internal with Isolated subnets only', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC', { + subnetConfiguration: [{ + cidrMask: 20, + name: 'Isolated', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + }], + }); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internal', + Subnets: [ + { Ref: 'VPCIsolatedSubnet1SubnetEBD00FC6' }, + { Ref: 'VPCIsolatedSubnet2Subnet4B1C8CAA' }, + ], + Type: 'network', + }); + }); + test('Internal with Public, Private, and Isolated subnets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC', { + subnetConfiguration: [{ + cidrMask: 24, + name: 'Public', + subnetType: ec2.SubnetType.PUBLIC, + }, { + cidrMask: 24, + name: 'Private', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, { + cidrMask: 28, + name: 'Isolated', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + }], + }); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internal', + Subnets: [ + { Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' }, + { Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' }, + ], + Type: 'network', + }); + }); + test('Internet-facing with Public, Private, and Isolated subnets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC', { + subnetConfiguration: [{ + cidrMask: 24, + name: 'Public', + subnetType: ec2.SubnetType.PUBLIC, + }, { + cidrMask: 24, + name: 'Private', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, { + cidrMask: 28, + name: 'Isolated', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + }], + }); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internet-facing', + Subnets: [ + { Ref: 'VPCPublicSubnet1SubnetB4246D30' }, + { Ref: 'VPCPublicSubnet2Subnet74179F39' }, + ], + Type: 'network', + }); + }); + test('Internal load balancer supplying public subnets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: false, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internal', + Subnets: [ + { Ref: 'VPCPublicSubnet1SubnetB4246D30' }, + { Ref: 'VPCPublicSubnet2Subnet74179F39' }, + ], + Type: 'network', + }); + }); + test('Internal load balancer supplying isolated subnets', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC', { + subnetConfiguration: [{ + cidrMask: 24, + name: 'Public', + subnetType: ec2.SubnetType.PUBLIC, + }, { + cidrMask: 24, + name: 'Private', + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, { + cidrMask: 28, + name: 'Isolated', + subnetType: ec2.SubnetType.PRIVATE_ISOLATED, + }], + }); + + // WHEN + new elbv2.NetworkLoadBalancer(stack, 'LB', { + vpc, + internetFacing: false, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::LoadBalancer', { + Scheme: 'internal', + Subnets: [ + { Ref: 'VPCIsolatedSubnet1SubnetEBD00FC6' }, + { Ref: 'VPCIsolatedSubnet2Subnet4B1C8CAA' }, + ], + Type: 'network', + }); + }); + + describe('lookup', () => { + test('Can look up a NetworkLoadBalancer', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + // WHEN + const loadBalancer = elbv2.NetworkLoadBalancer.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::NetworkLoadBalancer', 0); + expect(loadBalancer.loadBalancerArn).toEqual('arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/network/my-load-balancer/50dc6c495c0c9188'); + expect(loadBalancer.loadBalancerCanonicalHostedZoneId).toEqual('Z3DZXE0EXAMPLE'); + expect(loadBalancer.loadBalancerDnsName).toEqual('my-load-balancer-1234567890.us-west-2.elb.amazonaws.com'); + expect(loadBalancer.env.region).toEqual('us-west-2'); + }); + + test('Can add listeners to a looked-up NetworkLoadBalancer', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + const loadBalancer = elbv2.NetworkLoadBalancer.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + const targetGroup = new elbv2.NetworkTargetGroup(stack, 'tg', { + vpc: loadBalancer.vpc, + port: 3000, + }); + + // WHEN + loadBalancer.addListener('listener', { + protocol: elbv2.Protocol.TCP_UDP, + port: 3000, + defaultAction: elbv2.NetworkListenerAction.forward([targetGroup]), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::NetworkLoadBalancer', 0); + Template.fromStack(stack).resourceCountIs('AWS::ElasticLoadBalancingV2::Listener', 1); + }); + test('Can create metrics from a looked-up NetworkLoadBalancer', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack', { + env: { + account: '123456789012', + region: 'us-west-2', + }, + }); + + const loadBalancer = elbv2.NetworkLoadBalancer.fromLookup(stack, 'a', { + loadBalancerTags: { + some: 'tag', + }, + }); + + // WHEN + const metric = loadBalancer.metrics.custom('MetricName'); + + // THEN + expect(metric.namespace).toEqual('AWS/NetworkELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: 'network/my-load-balancer/50dc6c495c0c9188', + }); + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts new file mode 100644 index 0000000000000..cd44982380734 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts @@ -0,0 +1,719 @@ +import { Template } from '../../../assertions'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as ec2 from '../../../aws-ec2'; +import * as cdk from '../../../core'; +import * as elbv2 from '../../lib'; + +describe('tests', () => { + test('Enable proxy protocol v2 attribute for target group', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + proxyProtocolV2: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'proxy_protocol_v2.enabled', + Value: 'true', + }, + ], + }); + }); + + test('Enable preserve_client_ip attribute for target group', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + preserveClientIp: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'preserve_client_ip.enabled', + Value: 'true', + }, + ], + }); + }); + + test('Disable proxy protocol v2 for attribute target group', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + proxyProtocolV2: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'proxy_protocol_v2.enabled', + Value: 'false', + }, + ], + }); + }); + + test('Disable preserve_client_ip attribute for target group', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + preserveClientIp: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'preserve_client_ip.enabled', + Value: 'false', + }, + ], + }); + }); + + test('Configure protocols for target group', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + protocol: elbv2.Protocol.UDP, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + Protocol: 'UDP', + }); + }); + + test('Target group defaults to TCP', () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + Protocol: 'TCP', + }); + }); + + test('Throws error for invalid health check interval', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + healthCheck: { + interval: cdk.Duration.seconds(3), + }, + }); + + expect(() => { + app.synth(); + }).toThrow(/Health check interval '3' not supported. Must be between 5 and 300./); + }); + + test('targetGroupName unallowed: more than 32 characters', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + targetGroupName: 'a'.repeat(33), + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Target group name: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" can have a maximum of 32 characters.'); + }); + + test('targetGroupName unallowed: starts with hyphen', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + targetGroupName: '-myTargetGroup', + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Target group name: "-myTargetGroup" must not begin or end with a hyphen.'); + }); + + test('targetGroupName unallowed: ends with hyphen', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + targetGroupName: 'myTargetGroup-', + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Target group name: "myTargetGroup-" must not begin or end with a hyphen.'); + }); + + test('targetGroupName unallowed: unallowed characters', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + const vpc = new ec2.Vpc(stack, 'Stack'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + targetGroupName: 'my target group', + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow('Target group name: "my target group" must contain only alphanumeric characters or hyphens.'); + }); + + test('Disable deregistration_delay.connection_termination.enabled attribute for target group', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + connectionTermination: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'deregistration_delay.connection_termination.enabled', + Value: 'false', + }, + ], + }); + }); + + test('Enable deregistration_delay.connection_termination.enabled attribute for target group', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + connectionTermination: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', { + TargetGroupAttributes: [ + { + Key: 'deregistration_delay.connection_termination.enabled', + Value: 'true', + }, + ], + }); + }); + + test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( + 'Throws validation error, when `healthCheck` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + healthCheck: { + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS, TCP]`); + }); + + test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( + 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + }); + + // WHEN + tg.configureHealthCheck({ + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow(`Health check protocol '${protocol}' is not supported. Must be one of [HTTP, HTTPS, TCP]`); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS, elbv2.Protocol.TCP])( + 'Does not throw validation error, when `healthCheck` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + healthCheck: { + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS, elbv2.Protocol.TCP])( + 'Does not throw validation error, when `configureHealthCheck()` has `protocol` set to %s', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + }); + + // WHEN + tg.configureHealthCheck({ + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.TCP, elbv2.Protocol.HTTPS])( + 'Does not throw a validation error, when `healthCheck` has `protocol` set to %s and `interval` is equal to `timeout`', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + healthCheck: { + interval: cdk.Duration.seconds(10), + timeout: cdk.Duration.seconds(10), + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.TCP, elbv2.Protocol.HTTPS])( + 'Does not throw a validation error, when `configureHealthCheck()` has `protocol` set to %s and `interval` is equal to `timeout`', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + }); + + // WHEN + tg.configureHealthCheck({ + interval: cdk.Duration.seconds(10), + timeout: cdk.Duration.seconds(10), + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( + 'Throws validation error,`healthCheck` has `protocol` set to %s and `path` is provided', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + healthCheck: { + path: '/my-path', + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow(`'${protocol}' health checks do not support the path property. Must be one of [HTTP, HTTPS]`); + }); + + test.each([elbv2.Protocol.UDP, elbv2.Protocol.TCP_UDP, elbv2.Protocol.TLS])( + 'Throws validation error, when `configureHealthCheck()` has `protocol` set to %s and `path` is provided', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + }); + + // WHEN + tg.configureHealthCheck({ + path: '/my-path', + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).toThrow(`'${protocol}' health checks do not support the path property. Must be one of [HTTP, HTTPS]`); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Does not throw validation error, when `healthCheck` has `protocol` set to %s and `path` is provided', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + + // WHEN + new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + healthCheck: { + path: '/my-path', + protocol: protocol, + }, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test.each([elbv2.Protocol.HTTP, elbv2.Protocol.HTTPS])( + 'Does not throw validation error, when `configureHealthCheck()` has `protocol` set to %s and `path` is provided', + (protocol) => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'VPC', {}); + const tg = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', { + vpc, + port: 80, + }); + + // WHEN + tg.configureHealthCheck({ + path: '/my-path', + protocol: protocol, + }); + + // THEN + expect(() => { + app.synth(); + }).not.toThrowError(); + }); + + test('Throws error for invalid health check healthy threshold', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + healthCheck: { + protocol: elbv2.Protocol.TCP, + healthyThresholdCount: 11, + }, + }); + + expect(() => { + app.synth(); + }).toThrow(/Healthy Threshold Count '11' not supported. Must be a number between 2 and 10./); + }); + + test('Throws error for invalid health check unhealthy threshold', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + healthCheck: { + protocol: elbv2.Protocol.TCP, + unhealthyThresholdCount: 1, + }, + }); + + expect(() => { + app.synth(); + }).toThrow(/Unhealthy Threshold Count '1' not supported. Must be a number between 2 and 10./); + }); + + test('Throws error for unequal healthy and unhealthy threshold counts', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + healthCheck: { + protocol: elbv2.Protocol.TCP, + healthyThresholdCount: 5, + unhealthyThresholdCount: 3, + }, + }); + + expect(() => { + app.synth(); + }).toThrow(/Healthy and Unhealthy Threshold Counts must be the same: 5 is not equal to 3./); + }); + + test('Exercise metrics', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc }); + const listener = new elbv2.NetworkListener(stack, 'Listener', { + loadBalancer: lb, + port: 80, + }); + const targetGroup = new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + }); + listener.addTargetGroups('unused', targetGroup); + + // WHEN + const metrics = new Array(); + metrics.push(targetGroup.metrics.healthyHostCount()); + metrics.push(targetGroup.metrics.unHealthyHostCount()); + + // THEN + + // Ideally, this would just be a GetAtt of the LB name, but the target group + // doesn't have a direct reference to the LB, and instead builds up the LB name + // from the listener ARN. + const splitListenerName = { 'Fn::Split': ['/', { Ref: 'Listener828B0E81' }] }; + const loadBalancerNameFromListener = { + 'Fn::Join': ['', + [ + { 'Fn::Select': [1, splitListenerName] }, + '/', + { 'Fn::Select': [2, splitListenerName] }, + '/', + { 'Fn::Select': [3, splitListenerName] }, + ]], + }; + + for (const metric of metrics) { + expect(metric.namespace).toEqual('AWS/NetworkELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: loadBalancerNameFromListener, + TargetGroup: { 'Fn::GetAtt': ['GroupC77FDACD', 'TargetGroupFullName'] }, + }); + } + }); + + test('Metrics requires a listener to be present', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Stack'); + const targetGroup = new elbv2.NetworkTargetGroup(stack, 'Group', { + vpc, + port: 80, + }); + + // THEN + expect(() => targetGroup.metrics.healthyHostCount()).toThrow(/The TargetGroup needs to be attached to a LoadBalancer/); + expect(() => targetGroup.metrics.unHealthyHostCount()).toThrow(/The TargetGroup needs to be attached to a LoadBalancer/); + }); + + test('imported targetGroup has targetGroupName', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const importedTg = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myNlbTargetGroup/73e2d6bc24d8a067', + }); + + // THEN + expect(importedTg.targetGroupName).toEqual('myNlbTargetGroup'); + }); + + test('imported targetGroup with imported ARN has targetGroupName', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const importedTgArn = cdk.Fn.importValue('ImportTargetGroupArn'); + const importedTg = elbv2.ApplicationTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: importedTgArn, + }); + new cdk.CfnOutput(stack, 'TargetGroupOutput', { + value: importedTg.targetGroupName, + }); + + // THEN + Template.fromStack(stack).hasOutput('TargetGroupOutput', { + Value: { + 'Fn::Select': [ + // myNlbTargetGroup + 1, + { + 'Fn::Split': [ + // [targetgroup, myNlbTargetGroup, 73e2d6bc24d8a067] + '/', + { + 'Fn::Select': [ + // targetgroup/myNlbTargetGroup/73e2d6bc24d8a067 + 5, + { + 'Fn::Split': [ + // [arn, aws, elasticloadbalancing, us-west-2, 123456789012, targetgroup/myNlbTargetGroup/73e2d6bc24d8a067] + ':', + { + // arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/myNlbTargetGroup/73e2d6bc24d8a067 + 'Fn::ImportValue': 'ImportTargetGroupArn', + }, + ], + }, + ], + }, + ], + }, + ], + }, + }); + }); + + test('imported targetGroup has metrics', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const targetGroup = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', + loadBalancerArns: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/net/my-load-balancer/73e2d6bc24d8a067', + }); + + const metric = targetGroup.metrics.custom('MetricName'); + + // THEN + expect(metric.namespace).toEqual('AWS/NetworkELB'); + expect(stack.resolve(metric.dimensions)).toEqual({ + LoadBalancer: 'net/my-load-balancer/73e2d6bc24d8a067', + TargetGroup: 'targetgroup/my-target-group/50dc6c495c0c9188', + }); + }); + + test('imported targetGroup without load balancer cannot have metrics', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Stack'); + + // WHEN + const targetGroup = elbv2.NetworkTargetGroup.fromTargetGroupAttributes(stack, 'importedTg', { + targetGroupArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-target-group/50dc6c495c0c9188', + }); + + expect(() => targetGroup.metrics.custom('MetricName')).toThrow(); + }); +}); diff --git a/packages/aws-cdk-lib/aws-elasticsearch/.jsiirc.json b/packages/aws-cdk-lib/aws-elasticsearch/.jsiirc.json new file mode 100644 index 0000000000000..5ab8908efad12 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.elasticsearch" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Elasticsearch" + }, + "python": { + "module": "aws_cdk.aws_elasticsearch" + } + } +} diff --git a/packages/aws-cdk-lib/aws-elasticsearch/README.md b/packages/aws-cdk-lib/aws-elasticsearch/README.md new file mode 100644 index 0000000000000..4f65da745ea5e --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/README.md @@ -0,0 +1,441 @@ +# Amazon OpenSearch Service Construct Library + + +> Instead of this module, we recommend using the [@aws-cdk/aws-opensearchservice](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-opensearchservice-readme.html) module. See [Amazon OpenSearch Service FAQs](https://aws.amazon.com/opensearch-service/faqs/#Name_change) for details. See [Migrating to OpenSearch](#migrating-to-opensearch) for migration instructions. + +## Quick start + +Create a development cluster by simply specifying the version: + +```ts +const devDomain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, +}); +``` + +To perform version upgrades without replacing the entire domain, specify the `enableVersionUpgrade` property. + +```ts +const devDomain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_10, + enableVersionUpgrade: true, // defaults to false +}); +``` + +Create a production grade cluster by also specifying things like capacity and az distribution + +```ts +const prodDomain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, + capacity: { + masterNodes: 5, + dataNodes: 20, + }, + ebs: { + volumeSize: 20, + }, + zoneAwareness: { + availabilityZoneCount: 3, + }, + logging: { + slowSearchLogEnabled: true, + appLogEnabled: true, + slowIndexLogEnabled: true, + }, +}); +``` + +This creates an Elasticsearch cluster and automatically sets up log groups for +logging the domain logs and slow search logs. + +## A note about SLR + +Some cluster configurations (e.g VPC access) require the existence of the [`AWSServiceRoleForAmazonElasticsearchService`](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/slr.html) service-linked role. + +When performing such operations via the AWS Console, this SLR is created automatically when needed. However, this is not the behavior when using CloudFormation. If an SLR is needed, but doesn't exist, you will encounter a failure message similar to: + +```console +Before you can proceed, you must enable a service-linked role to give Amazon ES... +``` + +To resolve this, you need to [create](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#create-service-linked-role) the SLR. We recommend using the AWS CLI: + +```console +aws iam create-service-linked-role --aws-service-name es.amazonaws.com +``` + +You can also create it using the CDK, **but note that only the first application deploying this will succeed**: + +```ts +const slr = new iam.CfnServiceLinkedRole(this, 'ElasticSLR', { + awsServiceName: 'es.amazonaws.com', +}); +``` + +## Importing existing domains + +To import an existing domain into your CDK application, use the `Domain.fromDomainEndpoint` factory method. +This method accepts a domain endpoint of an already existing domain: + +```ts +const domainEndpoint = 'https://my-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com'; +const domain = es.Domain.fromDomainEndpoint(this, 'ImportedDomain', domainEndpoint); +``` + +## Permissions + +### IAM + +Helper methods also exist for managing access to the domain. + +```ts +declare const fn: lambda.Function; +declare const domain: es.Domain; + +// Grant write access to the app-search index +domain.grantIndexWrite('app-search', fn); + +// Grant read access to the 'app-search/_search' path +domain.grantPathRead('app-search/_search', fn); +``` + +## Encryption + +The domain can also be created with encryption enabled: + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_4, + ebs: { + volumeSize: 100, + volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, +}); +``` + +This sets up the domain with node to node encryption and encryption at +rest. You can also choose to supply your own KMS key to use for encryption at +rest. + +## VPC Support + +Elasticsearch domains can be placed inside a VPC, providing a secure communication between Amazon ES and other services within the VPC without the need for an internet gateway, NAT device, or VPN connection. + +> See [Launching your Amazon OpenSearch Service domains within a VPC](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html) for more details. + +```ts +const vpc = new ec2.Vpc(this, 'Vpc'); +const domainProps: es.DomainProps = { + version: es.ElasticsearchVersion.V7_1, + removalPolicy: RemovalPolicy.DESTROY, + vpc, + // must be enabled since our VPC contains multiple private subnets. + zoneAwareness: { + enabled: true, + }, + capacity: { + // must be an even number since the default az count is 2. + dataNodes: 2, + }, +}; +new es.Domain(this, 'Domain', domainProps); +``` + +In addition, you can use the `vpcSubnets` property to control which specific subnets will be used, and the `securityGroups` property to control +which security groups will be attached to the domain. By default, CDK will select all *private* subnets in the VPC, and create one dedicated security group. + +## Metrics + +Helper methods exist to access common domain metrics for example: + +```ts +declare const domain: es.Domain; +const freeStorageSpace = domain.metricFreeStorageSpace(); +const masterSysMemoryUtilization = domain.metric('MasterSysMemoryUtilization'); +``` + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Fine grained access control + +The domain can also be created with a master user configured. The password can +be supplied or dynamically created if not supplied. + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, + enforceHttps: true, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + fineGrainedAccessControl: { + masterUserName: 'master-user', + }, +}); + +const masterUserPassword = domain.masterUserPassword; +``` + +## Using unsigned basic auth + +For convenience, the domain can be configured to allow unsigned HTTP requests +that use basic auth. Unless the domain is configured to be part of a VPC this +means anyone can access the domain using the configured master username and +password. + +To enable unsigned basic auth access the domain is configured with an access +policy that allows anonymous requests, HTTPS required, node to node encryption, +encryption at rest and fine grained access control. + +If the above settings are not set they will be configured as part of enabling +unsigned basic auth. If they are set with conflicting values, an error will be +thrown. + +If no master user is configured a default master user is created with the +username `admin`. + +If no password is configured a default master user password is created and +stored in the AWS Secrets Manager as secret. The secret has the prefix +`MasterUser`. + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, + useUnsignedBasicAuth: true, +}); + +const masterUserPassword = domain.masterUserPassword; +``` + +## Custom access policies + +If the domain requires custom access control it can be configured either as a +constructor property, or later by means of a helper method. + +For simple permissions the `accessPolicies` constructor may be sufficient: + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, + accessPolicies: [ + new iam.PolicyStatement({ + actions: ['es:*ESHttpPost', 'es:ESHttpPut*'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('123456789012')], + resources: ['*'], + }), + ] +}); +``` + +For more complex use-cases, for example, to set the domain up to receive data from a +[cross-account Kinesis Firehose](https://aws.amazon.com/premiumsupport/knowledge-center/kinesis-firehose-cross-account-streaming/) the `addAccessPolicies` helper method +allows for policies that include the explicit domain ARN. + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, +}); + +domain.addAccessPolicies( + new iam.PolicyStatement({ + actions: ['es:ESHttpPost', 'es:ESHttpPut'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('123456789012')], + resources: [domain.domainArn, `${domain.domainArn}/*`], + }), + new iam.PolicyStatement({ + actions: ['es:ESHttpGet'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('123456789012')], + resources: [ + `${domain.domainArn}/_all/_settings`, + `${domain.domainArn}/_cluster/stats`, + `${domain.domainArn}/index-name*/_mapping/type-name`, + `${domain.domainArn}/roletest*/_mapping/roletest`, + `${domain.domainArn}/_nodes`, + `${domain.domainArn}/_nodes/stats`, + `${domain.domainArn}/_nodes/*/stats`, + `${domain.domainArn}/_stats`, + `${domain.domainArn}/index-name*/_stats`, + `${domain.domainArn}/roletest*/_stat`, + ], + }), +); +``` + +## Audit logs + +Audit logs can be enabled for a domain, but only when fine-grained access control is enabled. + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_1, + enforceHttps: true, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + fineGrainedAccessControl: { + masterUserName: 'master-user', + }, + logging: { + auditLogEnabled: true, + slowSearchLogEnabled: true, + appLogEnabled: true, + slowIndexLogEnabled: true, + }, +}); +``` + +## UltraWarm + +UltraWarm nodes can be enabled to provide a cost-effective way to store large amounts of read-only data. + +```ts +const domain = new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_10, + capacity: { + masterNodes: 2, + warmNodes: 2, + warmInstanceType: 'ultrawarm1.medium.elasticsearch', + }, +}); +``` + +## Custom endpoint + +Custom endpoints can be configured to reach the ES domain under a custom domain name. + +```ts +new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_7, + customEndpoint: { + domainName: 'search.example.com', + }, +}); +``` + +It is also possible to specify a custom certificate instead of the auto-generated one. + +Additionally, an automatic CNAME-Record is created if a hosted zone is provided for the custom endpoint + +## Advanced options + +[Advanced cluster settings](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options) can used to configure additional options. + +```ts +new es.Domain(this, 'Domain', { + version: es.ElasticsearchVersion.V7_7, + advancedOptions: { + 'rest.action.multi.allow_explicit_index': 'false', + 'indices.fielddata.cache.size': '25', + 'indices.query.bool.max_clause_count': '2048', + }, +}); +``` + +## Migrating to OpenSearch + +To migrate from this module (`@aws-cdk/aws-elasticsearch`) to the new `@aws-cdk/aws-opensearchservice` module, you must modify your CDK application to refer to the new module (including some associated changes) and then perform a CloudFormation resource deletion/import. + +### Necessary CDK Modifications + +Make the following modifications to your CDK application to migrate to the `@aws-cdk/aws-opensearchservice` module. + +- Rewrite module imports to use `'@aws-cdk/aws-opensearchservice` to `'@aws-cdk/aws-elasticsearch`. + For example: + + ```ts nofixture + import * as es from 'aws-cdk-lib/aws-elasticsearch'; + import { Domain } from 'aws-cdk-lib/aws-elasticsearch'; + ``` + + ...becomes... + + ```ts nofixture + import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; + import { Domain } from 'aws-cdk-lib/aws-opensearchservice'; + ``` + +- Replace instances of `es.ElasticsearchVersion` with `opensearch.EngineVersion`. + For example: + + ```ts fixture=migrate-opensearch + const version = es.ElasticsearchVersion.V7_1; + ``` + + ...becomes... + + ```ts fixture=migrate-opensearch + const version = opensearch.EngineVersion.ELASTICSEARCH_7_1; + ``` + +- Replace the `cognitoKibanaAuth` property of `DomainProps` with `cognitoDashboardsAuth`. + For example: + + ```ts fixture=migrate-opensearch + new es.Domain(this, 'Domain', { + cognitoKibanaAuth: { + identityPoolId: 'test-identity-pool-id', + userPoolId: 'test-user-pool-id', + role: role, + }, + version: elasticsearchVersion, + }); + ``` + + ...becomes... + + ```ts fixture=migrate-opensearch + new opensearch.Domain(this, 'Domain', { + cognitoDashboardsAuth: { + identityPoolId: 'test-identity-pool-id', + userPoolId: 'test-user-pool-id', + role: role, + }, + version: openSearchVersion, + }); + ``` + +- Rewrite instance type suffixes from `.elasticsearch` to `.search`. + For example: + + ```ts fixture=migrate-opensearch + new es.Domain(this, 'Domain', { + capacity: { + masterNodeInstanceType: 'r5.large.elasticsearch', + }, + version: elasticsearchVersion, + }); + ``` + + ...becomes... + + ```ts fixture=migrate-opensearch + new opensearch.Domain(this, 'Domain', { + capacity: { + masterNodeInstanceType: 'r5.large.search', + }, + version: openSearchVersion, + }); + ``` + +- Any `CfnInclude`'d domains will need to be re-written in their original template in + order to be successfully included as a `opensearch.CfnDomain` + +### CloudFormation Migration + +Follow these steps to migrate your application without data loss: + +- Ensure that the [removal policy](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.RemovalPolicy.html) on your domains are set to `RemovalPolicy.RETAIN`. This is the default for the domain construct, so nothing is required unless you have specifically set the removal policy to some other value. +- Remove the domain resource from your CloudFormation stacks by manually modifying the synthesized templates used to create the CloudFormation stacks. This may also involve modifying or deleting dependent resources, such as the custom resources that CDK creates to manage the domain's access policy or any other resource you have connected to the domain. You will need to search for references to each domain's logical ID to determine which other resources refer to it and replace or delete those references. Do not remove resources that are dependencies of the domain or you will have to recreate or import them before importing the domain. After modification, deploy the stacks through the AWS Management Console or using the AWS CLI. +- Migrate your CDK application to use the new `@aws-cdk/aws-opensearchservice` module by applying the necessary modifications listed above. Synthesize your application and obtain the resulting stack templates. +- Copy just the definition of the domain from the "migrated" templates to the corresponding "stripped" templates that you deployed above. [Import](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-existing-stack.html) the orphaned domains into your CloudFormation stacks using these templates. +- Synthesize and deploy your CDK application to reconfigure/recreate the modified dependent resources. The CloudFormation stacks should now contain the same resources as existed prior to migration. +- Proceed with development as normal! diff --git a/packages/aws-cdk-lib/aws-elasticsearch/index.ts b/packages/aws-cdk-lib/aws-elasticsearch/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-elasticsearch/lib/domain.ts b/packages/aws-cdk-lib/aws-elasticsearch/lib/domain.ts new file mode 100644 index 0000000000000..3867cf7f7d200 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/lib/domain.ts @@ -0,0 +1,2049 @@ +import { URL } from 'url'; + +import * as acm from '../../aws-certificatemanager'; +import { Metric, MetricOptions, Statistic } from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as route53 from '../../aws-route53'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; + +import { ElasticsearchAccessPolicy } from './elasticsearch-access-policy'; +import { CfnDomain } from './elasticsearch.generated'; +import { LogGroupResourcePolicy } from './log-group-resource-policy'; +import * as perms from './perms'; + +/** + * Elasticsearch version + */ +export class ElasticsearchVersion { + /** + * AWS Elasticsearch 1.5 + */ + public static readonly V1_5 = ElasticsearchVersion.of('1.5'); + + /** + * AWS Elasticsearch 2.3 + */ + public static readonly V2_3 = ElasticsearchVersion.of('2.3'); + + /** + * AWS Elasticsearch 5.1 + */ + public static readonly V5_1 = ElasticsearchVersion.of('5.1'); + + /** + * AWS Elasticsearch 5.3 + */ + public static readonly V5_3 = ElasticsearchVersion.of('5.3'); + + /** + * AWS Elasticsearch 5.5 + */ + public static readonly V5_5 = ElasticsearchVersion.of('5.5'); + + /** + * AWS Elasticsearch 5.6 + */ + public static readonly V5_6 = ElasticsearchVersion.of('5.6'); + + /** + * AWS Elasticsearch 6.0 + */ + public static readonly V6_0 = ElasticsearchVersion.of('6.0'); + + /** + * AWS Elasticsearch 6.2 + */ + public static readonly V6_2 = ElasticsearchVersion.of('6.2'); + + /** + * AWS Elasticsearch 6.3 + */ + public static readonly V6_3 = ElasticsearchVersion.of('6.3'); + + /** + * AWS Elasticsearch 6.4 + */ + public static readonly V6_4 = ElasticsearchVersion.of('6.4'); + + /** + * AWS Elasticsearch 6.5 + */ + public static readonly V6_5 = ElasticsearchVersion.of('6.5'); + + /** + * AWS Elasticsearch 6.7 + */ + public static readonly V6_7 = ElasticsearchVersion.of('6.7'); + + /** + * AWS Elasticsearch 6.8 + */ + public static readonly V6_8 = ElasticsearchVersion.of('6.8'); + + /** + * AWS Elasticsearch 7.1 + */ + public static readonly V7_1 = ElasticsearchVersion.of('7.1'); + + /** + * AWS Elasticsearch 7.4 + */ + public static readonly V7_4 = ElasticsearchVersion.of('7.4'); + + /** + * AWS Elasticsearch 7.7 + */ + public static readonly V7_7 = ElasticsearchVersion.of('7.7'); + + /** + * AWS Elasticsearch 7.8 + */ + public static readonly V7_8 = ElasticsearchVersion.of('7.8'); + + /** + * AWS Elasticsearch 7.9 + */ + public static readonly V7_9 = ElasticsearchVersion.of('7.9'); + + /** + * AWS Elasticsearch 7.10 + */ + public static readonly V7_10 = ElasticsearchVersion.of('7.10'); + + /** + * Custom Elasticsearch version + * @param version custom version number + */ + public static of(version: string) { return new ElasticsearchVersion(version); } + + /** + * + * @param version Elasticsearch version number + */ + private constructor(public readonly version: string) { } +} + +/** + * Configures the capacity of the cluster such as the instance type and the + * number of instances. + * + * @deprecated use opensearchservice module instead + */ +export interface CapacityConfig { + /** + * The number of instances to use for the master node. + * + * @default - no dedicated master nodes + * @deprecated use opensearchservice module instead + */ + readonly masterNodes?: number; + + /** + * The hardware configuration of the computer that hosts the dedicated master + * node, such as `m3.medium.elasticsearch`. For valid values, see [Supported + * Instance Types] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-instance-types.html) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default - r5.large.elasticsearch + * @deprecated use opensearchservice module instead + */ + readonly masterNodeInstanceType?: string; + + /** + * The number of data nodes (instances) to use in the Amazon ES domain. + * + * @default - 1 + * @deprecated use opensearchservice module instead + */ + readonly dataNodes?: number; + + /** + * The instance type for your data nodes, such as + * `m3.medium.elasticsearch`. For valid values, see [Supported Instance + * Types](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-instance-types.html) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default - r5.large.elasticsearch + * @deprecated use opensearchservice module instead + */ + readonly dataNodeInstanceType?: string; + + /** + * The number of UltraWarm nodes (instances) to use in the Amazon ES domain. + * + * @default - no UltraWarm nodes + * @deprecated use opensearchservice module instead + */ + readonly warmNodes?: number; + + /** + * The instance type for your UltraWarm node, such as `ultrawarm1.medium.elasticsearch`. + * For valid values, see [UltraWarm Storage Limits] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-limits.html#limits-ultrawarm) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default - ultrawarm1.medium.elasticsearch + * @deprecated use opensearchservice module instead + */ + readonly warmInstanceType?: string; + +} + +/** + * Specifies zone awareness configuration options. + * + * @deprecated use opensearchservice module instead + */ +export interface ZoneAwarenessConfig { + /** + * Indicates whether to enable zone awareness for the Amazon ES domain. + * When you enable zone awareness, Amazon ES allocates the nodes and replica + * index shards that belong to a cluster across two Availability Zones (AZs) + * in the same region to prevent data loss and minimize downtime in the event + * of node or data center failure. Don't enable zone awareness if your cluster + * has no replica index shards or is a single-node cluster. For more information, + * see [Configuring a Multi-AZ Domain] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-managedomains-multiaz) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly enabled?: boolean; + + /** + * If you enabled multiple Availability Zones (AZs), the number of AZs that you + * want the domain to use. Valid values are 2 and 3. + * + * @default - 2 if zone awareness is enabled. + * @deprecated use opensearchservice module instead + */ + readonly availabilityZoneCount?: number; +} + +/** + * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that + * are attached to data nodes in the Amazon ES domain. For more information, see + * [Configuring EBS-based Storage] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @deprecated use opensearchservice module instead + */ +export interface EbsOptions { + /** + * Specifies whether Amazon EBS volumes are attached to data nodes in the + * Amazon ES domain. + * + * @default - true + * @deprecated use opensearchservice module instead + */ + readonly enabled?: boolean; + + /** + * The number of I/O operations per second (IOPS) that the volume + * supports. This property applies only to the Provisioned IOPS (SSD) EBS + * volume type. + * + * @default - iops are not set. + * @deprecated use opensearchservice module instead + */ + readonly iops?: number; + + /** + * The size (in GiB) of the EBS volume for each data node. The minimum and + * maximum size of an EBS volume depends on the EBS volume type and the + * instance type to which it is attached. For more information, see + * [Configuring EBS-based Storage] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default 10 + * @deprecated use opensearchservice module instead + */ + readonly volumeSize?: number; + + /** + * The EBS volume type to use with the Amazon ES domain, such as standard, gp2, io1. + * For more information, see[Configuring EBS-based Storage] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default gp2 + * @deprecated use opensearchservice module instead + */ + readonly volumeType?: ec2.EbsDeviceVolumeType; +} + +/** + * Configures log settings for the domain. + * + * @deprecated use opensearchservice module instead + */ +export interface LoggingOptions { + /** + * Specify if slow search logging should be set up. + * Requires Elasticsearch version 5.1 or later. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly slowSearchLogEnabled?: boolean; + + /** + * Log slow searches to this log group. + * + * @default - a new log group is created if slow search logging is enabled + * @deprecated use opensearchservice module instead + */ + readonly slowSearchLogGroup?: logs.ILogGroup; + + /** + * Specify if slow index logging should be set up. + * Requires Elasticsearch version 5.1 or later. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly slowIndexLogEnabled?: boolean; + + /** + * Log slow indices to this log group. + * + * @default - a new log group is created if slow index logging is enabled + * @deprecated use opensearchservice module instead + */ + readonly slowIndexLogGroup?: logs.ILogGroup; + + /** + * Specify if Elasticsearch application logging should be set up. + * Requires Elasticsearch version 5.1 or later. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly appLogEnabled?: boolean; + + /** + * Log Elasticsearch application logs to this log group. + * + * @default - a new log group is created if app logging is enabled + * @deprecated use opensearchservice module instead + */ + readonly appLogGroup?: logs.ILogGroup; + + /** + * Specify if Elasticsearch audit logging should be set up. + * Requires Elasticsearch version 6.7 or later and fine grained access control to be enabled. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly auditLogEnabled?: boolean; + + /** + * Log Elasticsearch audit logs to this log group. + * + * @default - a new log group is created if audit logging is enabled + * @deprecated use opensearchservice module instead + */ + readonly auditLogGroup?: logs.ILogGroup; +} + +/** + * Whether the domain should encrypt data at rest, and if so, the AWS Key + * Management Service (KMS) key to use. Can only be used to create a new domain, + * not update an existing one. Requires Elasticsearch version 5.1 or later. + * + * @deprecated use opensearchservice module instead + */ +export interface EncryptionAtRestOptions { + /** + * Specify true to enable encryption at rest. + * + * @default - encryption at rest is disabled. + * @deprecated use opensearchservice module instead + */ + readonly enabled?: boolean; + + /** + * Supply if using KMS key for encryption at rest. + * + * @default - uses default aws/es KMS key. + * @deprecated use opensearchservice module instead + */ + readonly kmsKey?: kms.IKey; +} + +/** + * Configures Amazon ES to use Amazon Cognito authentication for Kibana. + * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-cognito-auth.html + * @deprecated use opensearchservice module instead + */ +export interface CognitoOptions { + /** + * The Amazon Cognito identity pool ID that you want Amazon ES to use for Kibana authentication. + * + * @deprecated use opensearchservice module instead + */ + readonly identityPoolId: string; + + /** + * A role that allows Amazon ES to configure your user pool and identity pool. It must have the `AmazonESCognitoAccess` policy attached to it. + * + * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-cognito-auth.html#es-cognito-auth-prereq + * @deprecated use opensearchservice module instead + */ + readonly role: iam.IRole; + + /** + * The Amazon Cognito user pool ID that you want Amazon ES to use for Kibana authentication. + * + * @deprecated use opensearchservice module instead + */ + readonly userPoolId: string; +} + +/** + * The minimum TLS version required for traffic to the domain. + * + * @deprecated use opensearchservice module instead + */ +export enum TLSSecurityPolicy { + /** Cipher suite TLS 1.0 */ + TLS_1_0 = 'Policy-Min-TLS-1-0-2019-07', + /** Cipher suite TLS 1.2 */ + TLS_1_2 = 'Policy-Min-TLS-1-2-2019-07' +} + +/** + * Specifies options for fine-grained access control. + * + * @deprecated use opensearchservice module instead + */ +export interface AdvancedSecurityOptions { + /** + * ARN for the master user. Only specify this or masterUserName, but not both. + * + * @default - fine-grained access control is disabled + * @deprecated use opensearchservice module instead + */ + readonly masterUserArn?: string; + + /** + * Username for the master user. Only specify this or masterUserArn, but not both. + * + * @default - fine-grained access control is disabled + * @deprecated use opensearchservice module instead + */ + readonly masterUserName?: string; + + /** + * Password for the master user. + * + * You can use `SecretValue.unsafePlainText` to specify a password in plain text or + * use `secretsmanager.Secret.fromSecretAttributes` to reference a secret in + * Secrets Manager. + * + * @default - A Secrets Manager generated password + * @deprecated use opensearchservice module instead + */ + readonly masterUserPassword?: cdk.SecretValue; +} + +/** + * Configures a custom domain endpoint for the ES domain + * + * @deprecated use opensearchservice module instead + */ +export interface CustomEndpointOptions { + /** + * The custom domain name to assign + * + * @deprecated use opensearchservice module instead + */ + readonly domainName: string; + + /** + * The certificate to use + * @default - create a new one + * @deprecated use opensearchservice module instead + */ + readonly certificate?: acm.ICertificate; + + /** + * The hosted zone in Route53 to create the CNAME record in + * @default - do not create a CNAME + * @deprecated use opensearchservice module instead + */ + readonly hostedZone?: route53.IHostedZone; +} + +/** + * Properties for an AWS Elasticsearch Domain. + * + * @deprecated use opensearchservice module instead + */ +export interface DomainProps { + /** + * Domain Access policies. + * + * @default - No access policies. + * @deprecated use opensearchservice module instead + */ + readonly accessPolicies?: iam.PolicyStatement[]; + + /** + * Additional options to specify for the Amazon ES domain. + * + * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-advanced-options + * @default - no advanced options are specified + * @deprecated use opensearchservice module instead + */ + readonly advancedOptions?: { [key: string]: (string) }; + + /** + * Configures Amazon ES to use Amazon Cognito authentication for Kibana. + * + * @default - Cognito not used for authentication to Kibana. + * @deprecated use opensearchservice module instead + */ + readonly cognitoKibanaAuth?: CognitoOptions; + + /** + * Enforces a particular physical domain name. + * + * @default - A name will be auto-generated. + * @deprecated use opensearchservice module instead + */ + readonly domainName?: string; + + /** + * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that + * are attached to data nodes in the Amazon ES domain. For more information, see + * [Configuring EBS-based Storage] + * (https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-createupdatedomains.html#es-createdomain-configure-ebs) + * in the Amazon Elasticsearch Service Developer Guide. + * + * @default - 10 GiB General Purpose (SSD) volumes per node. + * @deprecated use opensearchservice module instead + */ + readonly ebs?: EbsOptions; + + /** + * The cluster capacity configuration for the Amazon ES domain. + * + * @default - 1 r5.large.elasticsearch data node; no dedicated master nodes. + * @deprecated use opensearchservice module instead + */ + readonly capacity?: CapacityConfig; + + /** + * The cluster zone awareness configuration for the Amazon ES domain. + * + * @default - no zone awareness (1 AZ) + * @deprecated use opensearchservice module instead + */ + readonly zoneAwareness?: ZoneAwarenessConfig; + + /** + * The Elasticsearch version that your domain will leverage. + * + * @deprecated use opensearchservice module instead + */ + readonly version: ElasticsearchVersion; + + /** + * Encryption at rest options for the cluster. + * + * @default - No encryption at rest + * @deprecated use opensearchservice module instead + */ + readonly encryptionAtRest?: EncryptionAtRestOptions; + + /** + * Configuration log publishing configuration options. + * + * @default - No logs are published + * @deprecated use opensearchservice module instead + */ + readonly logging?: LoggingOptions; + + /** + * Specify true to enable node to node encryption. + * Requires Elasticsearch version 6.0 or later. + * + * @default - Node to node encryption is not enabled. + * @deprecated use opensearchservice module instead + */ + readonly nodeToNodeEncryption?: boolean; + + /** + * The hour in UTC during which the service takes an automated daily snapshot + * of the indices in the Amazon ES domain. Only applies for Elasticsearch + * versions below 5.3. + * + * @default - Hourly automated snapshots not used + * @deprecated use opensearchservice module instead + */ + readonly automatedSnapshotStartHour?: number; + + /** + * Place the domain inside this VPC. + * + * @see https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html + * @default - Domain is not placed in a VPC. + * @deprecated use opensearchservice module instead + */ + readonly vpc?: ec2.IVpc; + + /** + * The list of security groups that are associated with the VPC endpoints + * for the domain. + * + * Only used if `vpc` is specified. + * + * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html + * @default - One new security group is created. + * @deprecated use opensearchservice module instead + */ + readonly securityGroups?: ec2.ISecurityGroup[]; + + /** + * The specific vpc subnets the domain will be placed in. You must provide one subnet for each Availability Zone + * that your domain uses. For example, you must specify three subnet IDs for a three Availability Zone + * domain. + * + * Only used if `vpc` is specified. + * + * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html + * @default - All private subnets. + * @deprecated use opensearchservice module instead + */ + readonly vpcSubnets?: ec2.SubnetSelection[]; + + /** + * True to require that all traffic to the domain arrive over HTTPS. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly enforceHttps?: boolean; + + /** + * The minimum TLS version required for traffic to the domain. + * + * @default - TLSSecurityPolicy.TLS_1_0 + * @deprecated use opensearchservice module instead + */ + readonly tlsSecurityPolicy?: TLSSecurityPolicy; + + /** + * Specifies options for fine-grained access control. + * Requires Elasticsearch version 6.7 or later. Enabling fine-grained access control + * also requires encryption of data at rest and node-to-node encryption, along with + * enforced HTTPS. + * + * @default - fine-grained access control is disabled + * @deprecated use opensearchservice module instead + */ + readonly fineGrainedAccessControl?: AdvancedSecurityOptions; + + /** + * Configures the domain so that unsigned basic auth is enabled. If no master user is provided a default master user + * with username `admin` and a dynamically generated password stored in KMS is created. The password can be retrieved + * by getting `masterUserPassword` from the domain instance. + * + * Setting this to true will also add an access policy that allows unsigned + * access, enable node to node encryption, encryption at rest. If conflicting + * settings are encountered (like disabling encryption at rest) enabling this + * setting will cause a failure. + * + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly useUnsignedBasicAuth?: boolean; + + /** + * To upgrade an Amazon ES domain to a new version of Elasticsearch rather than replacing the entire + * domain resource, use the EnableVersionUpgrade update policy. + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-upgradeelasticsearchdomain + * @default - false + * @deprecated use opensearchservice module instead + */ + readonly enableVersionUpgrade?: boolean; + + /** + * Policy to apply when the domain is removed from the stack + * + * @default RemovalPolicy.RETAIN + * @deprecated use opensearchservice module instead + */ + readonly removalPolicy?: cdk.RemovalPolicy; + + /** + * To configure a custom domain configure these options + * + * If you specify a Route53 hosted zone it will create a CNAME record and use DNS validation for the certificate + * @default - no custom domain endpoint will be configured + * @deprecated use opensearchservice module instead + */ + readonly customEndpoint?: CustomEndpointOptions; +} + +/** + * An interface that represents an Elasticsearch domain - either created with the CDK, or an existing one. + * + * @deprecated use opensearchservice module instead + */ +export interface IDomain extends cdk.IResource { + /** + * Arn of the Elasticsearch domain. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + readonly domainArn: string; + + /** + * Domain name of the Elasticsearch domain. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + readonly domainName: string; + + /** + * Endpoint of the Elasticsearch domain. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + readonly domainEndpoint: string; + + /** + * Grant read permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantRead(identity: iam.IGrantable): iam.Grant; + + /** + * Grant write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantWrite(identity: iam.IGrantable): iam.Grant; + + /** + * Grant read/write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantReadWrite(identity: iam.IGrantable): iam.Grant; + + /** + * Grant read permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant read/write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant read permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantPathRead(path: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant read/write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant; + + /** + * Return the given named metric for this Domain. + * + * @deprecated use opensearchservice module instead + */ + metric(metricName: string, props?: MetricOptions): Metric; + + /** + * Metric for the time the cluster status is red. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricClusterStatusRed(props?: MetricOptions): Metric; + + /** + * Metric for the time the cluster status is yellow. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricClusterStatusYellow(props?: MetricOptions): Metric; + + /** + * Metric for the storage space of nodes in the cluster. + * + * @default minimum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricFreeStorageSpace(props?: MetricOptions): Metric; + + /** + * Metric for the cluster blocking index writes. + * + * @default maximum over 1 minute + * @deprecated use opensearchservice module instead + */ + metricClusterIndexWritesBlocked(props?: MetricOptions): Metric; + + /** + * Metric for the number of nodes. + * + * @default minimum over 1 hour + * @deprecated use opensearchservice module instead + */ + metricNodes(props?: MetricOptions): Metric; + + /** + * Metric for automated snapshot failures. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricAutomatedSnapshotFailure(props?: MetricOptions): Metric; + + /** + * Metric for CPU utilization. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricCPUUtilization(props?: MetricOptions): Metric; + + /** + * Metric for JVM memory pressure. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricJVMMemoryPressure(props?: MetricOptions): Metric; + + /** + * Metric for master CPU utilization. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricMasterCPUUtilization(props?: MetricOptions): Metric; + + /** + * Metric for master JVM memory pressure. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricMasterJVMMemoryPressure(props?: MetricOptions): Metric; + + /** + * Metric for KMS key errors. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricKMSKeyError(props?: MetricOptions): Metric; + + /** + * Metric for KMS key being inaccessible. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricKMSKeyInaccessible(props?: MetricOptions): Metric; + + /** + * Metric for number of searchable documents. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricSearchableDocuments(props?: MetricOptions): Metric; + + /** + * Metric for search latency. + * + * @default p99 over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricSearchLatency(props?: MetricOptions): Metric; + + /** + * Metric for indexing latency. + * + * @default p99 over 5 minutes + * @deprecated use opensearchservice module instead + */ + metricIndexingLatency(props?: MetricOptions): Metric; +} + + +/** + * A new or imported domain. + */ +abstract class DomainBase extends cdk.Resource implements IDomain { + public abstract readonly domainArn: string; + public abstract readonly domainName: string; + public abstract readonly domainEndpoint: string; + + /** + * Grant read permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantRead(identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_ACTIONS, + this.domainArn, + `${this.domainArn}/*`, + ); + } + + /** + * Grant write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantWrite(identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_WRITE_ACTIONS, + this.domainArn, + `${this.domainArn}/*`, + ); + } + + /** + * Grant read/write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantReadWrite(identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_WRITE_ACTIONS, + this.domainArn, + `${this.domainArn}/*`, + ); + } + + /** + * Grant read permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_ACTIONS, + `${this.domainArn}/${index}`, + `${this.domainArn}/${index}/*`, + ); + } + + /** + * Grant write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_WRITE_ACTIONS, + `${this.domainArn}/${index}`, + `${this.domainArn}/${index}/*`, + ); + } + + /** + * Grant read/write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_WRITE_ACTIONS, + `${this.domainArn}/${index}`, + `${this.domainArn}/${index}/*`, + ); + } + + /** + * Grant read permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantPathRead(path: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_ACTIONS, + `${this.domainArn}/${path}`, + ); + } + + /** + * Grant write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_WRITE_ACTIONS, + `${this.domainArn}/${path}`, + ); + } + + /** + * Grant read/write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + * @deprecated use opensearchservice module instead + */ + grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_WRITE_ACTIONS, + `${this.domainArn}/${path}`, + ); + } + + /** + * Return the given named metric for this Domain. + * + * @deprecated use opensearchservice module instead + */ + public metric(metricName: string, props?: MetricOptions): Metric { + return new Metric({ + namespace: 'AWS/ES', + metricName, + dimensionsMap: { + DomainName: this.domainName, + ClientId: this.env.account, + }, + ...props, + }).attachTo(this); + } + + /** + * Metric for the time the cluster status is red. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricClusterStatusRed(props?: MetricOptions): Metric { + return this.metric('ClusterStatus.red', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for the time the cluster status is yellow. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricClusterStatusYellow(props?: MetricOptions): Metric { + return this.metric('ClusterStatus.yellow', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for the storage space of nodes in the cluster. + * + * @default minimum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricFreeStorageSpace(props?: MetricOptions): Metric { + return this.metric('FreeStorageSpace', { + statistic: Statistic.MINIMUM, + ...props, + }); + } + + /** + * Metric for the cluster blocking index writes. + * + * @default maximum over 1 minute + * @deprecated use opensearchservice module instead + */ + public metricClusterIndexWritesBlocked(props?: MetricOptions): Metric { + return this.metric('ClusterIndexWritesBlocked', { + statistic: Statistic.MAXIMUM, + period: cdk.Duration.minutes(1), + ...props, + }); + } + + /** + * Metric for the number of nodes. + * + * @default minimum over 1 hour + * @deprecated use opensearchservice module instead + */ + public metricNodes(props?: MetricOptions): Metric { + return this.metric('Nodes', { + statistic: Statistic.MINIMUM, + period: cdk.Duration.hours(1), + ...props, + }); + } + + /** + * Metric for automated snapshot failures. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricAutomatedSnapshotFailure(props?: MetricOptions): Metric { + return this.metric('AutomatedSnapshotFailure', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for CPU utilization. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricCPUUtilization(props?: MetricOptions): Metric { + return this.metric('CPUUtilization', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for JVM memory pressure. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricJVMMemoryPressure(props?: MetricOptions): Metric { + return this.metric('JVMMemoryPressure', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for master CPU utilization. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricMasterCPUUtilization(props?: MetricOptions): Metric { + return this.metric('MasterCPUUtilization', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for master JVM memory pressure. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricMasterJVMMemoryPressure(props?: MetricOptions): Metric { + return this.metric('MasterJVMMemoryPressure', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for KMS key errors. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricKMSKeyError(props?: MetricOptions): Metric { + return this.metric('KMSKeyError', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for KMS key being inaccessible. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricKMSKeyInaccessible(props?: MetricOptions): Metric { + return this.metric('KMSKeyInaccessible', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for number of searchable documents. + * + * @default maximum over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricSearchableDocuments(props?: MetricOptions): Metric { + return this.metric('SearchableDocuments', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for search latency. + * + * @default p99 over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricSearchLatency(props?: MetricOptions): Metric { + return this.metric('SearchLatency', { statistic: 'p99', ...props }); + } + + /** + * Metric for indexing latency. + * + * @default p99 over 5 minutes + * @deprecated use opensearchservice module instead + */ + public metricIndexingLatency(props?: MetricOptions): Metric { + return this.metric('IndexingLatency', { statistic: 'p99', ...props }); + } + + private grant( + grantee: iam.IGrantable, + domainActions: string[], + resourceArn: string, + ...otherResourceArns: string[] + ): iam.Grant { + const resourceArns = [resourceArn, ...otherResourceArns]; + + const grant = iam.Grant.addToPrincipal({ + grantee, + actions: domainActions, + resourceArns, + scope: this, + }); + + return grant; + } + +} + + +/** + * Reference to an Elasticsearch domain. + * + * @deprecated use opensearchservice module instead + */ +export interface DomainAttributes { + /** + * The ARN of the Elasticsearch domain. + * + * @deprecated use opensearchservice module instead + */ + readonly domainArn: string; + + /** + * The domain endpoint of the Elasticsearch domain. + * + * @deprecated use opensearchservice module instead + */ + readonly domainEndpoint: string; +} + + +/** + * Provides an Elasticsearch domain. + * + * @deprecated use opensearchservice module instead + */ +export class Domain extends DomainBase implements IDomain, ec2.IConnectable { + /** + * Creates a Domain construct that represents an external domain via domain endpoint. + * + * @param scope The parent creating construct (usually `this`). + * @param id The construct's name. + * @param domainEndpoint The domain's endpoint. + * @deprecated use opensearchservice module instead + */ + public static fromDomainEndpoint( + scope: Construct, + id: string, + domainEndpoint: string, + ): IDomain { + const stack = cdk.Stack.of(scope); + const domainName = extractNameFromEndpoint(domainEndpoint); + const domainArn = stack.formatArn({ + service: 'es', + resource: 'domain', + resourceName: domainName, + }); + + return Domain.fromDomainAttributes(scope, id, { + domainArn, + domainEndpoint, + }); + } + + /** + * Creates a Domain construct that represents an external domain. + * + * @param scope The parent creating construct (usually `this`). + * @param id The construct's name. + * @param attrs A `DomainAttributes` object. + * @deprecated use opensearchservice module instead + */ + public static fromDomainAttributes(scope: Construct, id: string, attrs: DomainAttributes): IDomain { + const { domainArn, domainEndpoint } = attrs; + const domainName = cdk.Stack.of(scope).splitArn(domainArn, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName + ?? extractNameFromEndpoint(domainEndpoint); + + return new class extends DomainBase { + public readonly domainArn = domainArn; + public readonly domainName = domainName; + public readonly domainEndpoint = domainEndpoint.replace(/^https?:\/\//, ''); + + constructor() { super(scope, id); } + }; + } + + /** + * @deprecated use opensearchservice module instead + */ + public readonly domainArn: string; + + /** + * @deprecated use opensearchservice module instead + */ + public readonly domainName: string; + + /** + * @deprecated use opensearchservice module instead + */ + public readonly domainEndpoint: string; + + /** + * Log group that slow searches are logged to. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + public readonly slowSearchLogGroup?: logs.ILogGroup; + + /** + * Log group that slow indices are logged to. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + public readonly slowIndexLogGroup?: logs.ILogGroup; + + /** + * Log group that application logs are logged to. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + public readonly appLogGroup?: logs.ILogGroup; + + /** + * Log group that audit logs are logged to. + * + * @attribute + * @deprecated use opensearchservice module instead + */ + public readonly auditLogGroup?: logs.ILogGroup; + + /** + * Master user password if fine grained access control is configured. + * + * @deprecated use opensearchservice module instead + */ + public readonly masterUserPassword?: cdk.SecretValue; + + + private readonly domain: CfnDomain; + + private accessPolicy?: ElasticsearchAccessPolicy + private encryptionAtRestOptions?: EncryptionAtRestOptions + + private readonly _connections: ec2.Connections | undefined; + + constructor(scope: Construct, id: string, props: DomainProps) { + super(scope, id, { + physicalName: props.domainName, + }); + + const defaultInstanceType = 'r5.large.elasticsearch'; + const warmDefaultInstanceType = 'ultrawarm1.medium.elasticsearch'; + + const dedicatedMasterType = initializeInstanceType(defaultInstanceType, props.capacity?.masterNodeInstanceType); + const dedicatedMasterCount = props.capacity?.masterNodes ?? 0; + const dedicatedMasterEnabled = cdk.Token.isUnresolved(dedicatedMasterCount) ? true : dedicatedMasterCount > 0; + + const instanceType = initializeInstanceType(defaultInstanceType, props.capacity?.dataNodeInstanceType); + const instanceCount = props.capacity?.dataNodes ?? 1; + + const warmType = initializeInstanceType(warmDefaultInstanceType, props.capacity?.warmInstanceType); + const warmCount = props.capacity?.warmNodes ?? 0; + const warmEnabled = cdk.Token.isUnresolved(warmCount) ? true : warmCount > 0; + + const availabilityZoneCount = + props.zoneAwareness?.availabilityZoneCount ?? 2; + + if (![2, 3].includes(availabilityZoneCount)) { + throw new Error('Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3'); + } + + const zoneAwarenessEnabled = + props.zoneAwareness?.enabled ?? + props.zoneAwareness?.availabilityZoneCount != null; + + + let securityGroups: ec2.ISecurityGroup[] | undefined; + let subnets: ec2.ISubnet[] | undefined; + + if (props.vpc) { + subnets = selectSubnets(props.vpc, props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]); + securityGroups = props.securityGroups ?? [new ec2.SecurityGroup(this, 'SecurityGroup', { + vpc: props.vpc, + description: `Security group for domain ${this.node.id}`, + })]; + this._connections = new ec2.Connections({ securityGroups }); + } + + // If VPC options are supplied ensure that the number of subnets matches the number AZ + if (subnets && zoneAwarenessEnabled && new Set(subnets.map((subnet) => subnet.availabilityZone)).size < availabilityZoneCount) { + throw new Error('When providing vpc options you need to provide a subnet for each AZ you are using'); + } + + if ([dedicatedMasterType, instanceType, warmType].some(t => (!cdk.Token.isUnresolved(t) && !t.endsWith('.elasticsearch')))) { + throw new Error('Master, data and UltraWarm node instance types must end with ".elasticsearch".'); + } + + if (!cdk.Token.isUnresolved(warmType) && !warmType.startsWith('ultrawarm')) { + throw new Error('UltraWarm node instance type must start with "ultrawarm".'); + } + + const elasticsearchVersion = props.version.version; + const elasticsearchVersionNum = parseVersion(props.version); + + if ( + elasticsearchVersionNum <= 7.7 && + ![ + 1.5, 2.3, 5.1, 5.3, 5.5, 5.6, 6.0, + 6.2, 6.3, 6.4, 6.5, 6.7, 6.8, 7.1, 7.4, + 7.7, + ].includes(elasticsearchVersionNum) + ) { + throw new Error(`Unknown Elasticsearch version: ${elasticsearchVersion}`); + } + + const unsignedBasicAuthEnabled = props.useUnsignedBasicAuth ?? false; + + if (unsignedBasicAuthEnabled) { + if (props.enforceHttps == false) { + throw new Error('You cannot disable HTTPS and use unsigned basic auth'); + } + if (props.nodeToNodeEncryption == false) { + throw new Error('You cannot disable node to node encryption and use unsigned basic auth'); + } + if (props.encryptionAtRest?.enabled == false) { + throw new Error('You cannot disable encryption at rest and use unsigned basic auth'); + } + } + + const unsignedAccessPolicy = new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['es:ESHttp*'], + principals: [new iam.AnyPrincipal()], + resources: [cdk.Lazy.string({ produce: () => `${this.domainArn}/*` })], + }); + + const masterUserArn = props.fineGrainedAccessControl?.masterUserArn; + const masterUserNameProps = props.fineGrainedAccessControl?.masterUserName; + // If basic auth is enabled set the user name to admin if no other user info is supplied. + const masterUserName = unsignedBasicAuthEnabled + ? (masterUserArn == null ? (masterUserNameProps ?? 'admin') : undefined) + : masterUserNameProps; + + if (masterUserArn != null && masterUserName != null) { + throw new Error('Invalid fine grained access control settings. Only provide one of master user ARN or master user name. Not both.'); + } + + const advancedSecurityEnabled = (masterUserArn ?? masterUserName) != null; + const internalUserDatabaseEnabled = masterUserName != null; + const masterUserPasswordProp = props.fineGrainedAccessControl?.masterUserPassword; + const createMasterUserPassword = (): cdk.SecretValue => { + return new secretsmanager.Secret(this, 'MasterUser', { + generateSecretString: { + secretStringTemplate: JSON.stringify({ + username: masterUserName, + }), + generateStringKey: 'password', + excludeCharacters: "{}'\\*[]()`", + }, + }) + .secretValueFromJson('password'); + }; + this.masterUserPassword = internalUserDatabaseEnabled ? + (masterUserPasswordProp ?? createMasterUserPassword()) + : undefined; + + const encryptionAtRestEnabled = + props.encryptionAtRest?.enabled ?? (props.encryptionAtRest?.kmsKey != null || unsignedBasicAuthEnabled); + const nodeToNodeEncryptionEnabled = props.nodeToNodeEncryption ?? unsignedBasicAuthEnabled; + const volumeSize = props.ebs?.volumeSize ?? 10; + const volumeType = props.ebs?.volumeType ?? ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD; + const ebsEnabled = props.ebs?.enabled ?? true; + const enforceHttps = props.enforceHttps ?? unsignedBasicAuthEnabled; + + function isInstanceType(t: string): Boolean { + return dedicatedMasterType.startsWith(t) || instanceType.startsWith(t); + }; + + function isSomeInstanceType(...instanceTypes: string[]): Boolean { + return instanceTypes.some(isInstanceType); + }; + + function isEveryDatanodeInstanceType(...instanceTypes: string[]): Boolean { + return instanceTypes.some(t => instanceType.startsWith(t)); + }; + + // Validate feature support for the given Elasticsearch version, per + // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-features-by-version.html + if (elasticsearchVersionNum < 5.1) { + if (props.logging?.appLogEnabled) { + throw new Error('Error logs publishing requires Elasticsearch version 5.1 or later.'); + } + if (props.encryptionAtRest?.enabled) { + throw new Error('Encryption of data at rest requires Elasticsearch version 5.1 or later.'); + } + if (props.cognitoKibanaAuth != null) { + throw new Error('Cognito authentication for Kibana requires Elasticsearch version 5.1 or later.'); + } + if (isSomeInstanceType('c5', 'i3', 'm5', 'r5')) { + throw new Error('C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later.'); + } + } + + if (elasticsearchVersionNum < 6.0) { + if (props.nodeToNodeEncryption) { + throw new Error('Node-to-node encryption requires Elasticsearch version 6.0 or later.'); + } + } + + if (elasticsearchVersionNum < 6.7) { + if (unsignedBasicAuthEnabled) { + throw new Error('Using unsigned basic auth requires Elasticsearch version 6.7 or later.'); + } + if (advancedSecurityEnabled) { + throw new Error('Fine-grained access control requires Elasticsearch version 6.7 or later.'); + } + } + + if (elasticsearchVersionNum < 6.8 && warmEnabled) { + throw new Error('UltraWarm requires Elasticsearch 6.8 or later.'); + } + + // Validate against instance type restrictions, per + // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-instance-types.html + if (isSomeInstanceType('i3', 'r6gd') && ebsEnabled) { + throw new Error('I3 and R6GD instance types do not support EBS storage volumes.'); + } + + if (isSomeInstanceType('m3', 'r3', 't2') && encryptionAtRestEnabled) { + throw new Error('M3, R3, and T2 instance types do not support encryption of data at rest.'); + } + + if (isInstanceType('t2.micro') && elasticsearchVersionNum > 2.3) { + throw new Error('The t2.micro.elasticsearch instance type supports only Elasticsearch 1.5 and 2.3.'); + } + + if (isSomeInstanceType('t2', 't3') && warmEnabled) { + throw new Error('T2 and T3 instance types do not support UltraWarm storage.'); + } + + // Only R3, I3 and r6gd support instance storage, per + // https://aws.amazon.com/elasticsearch-service/pricing/ + if (!ebsEnabled && !isEveryDatanodeInstanceType('r3', 'i3', 'r6gd')) { + throw new Error('EBS volumes are required when using instance types other than r3, i3 or r6gd.'); + } + + // Fine-grained access control requires node-to-node encryption, encryption at rest, + // and enforced HTTPS. + if (advancedSecurityEnabled) { + if (!nodeToNodeEncryptionEnabled) { + throw new Error('Node-to-node encryption is required when fine-grained access control is enabled.'); + } + if (!encryptionAtRestEnabled) { + throw new Error('Encryption-at-rest is required when fine-grained access control is enabled.'); + } + if (!enforceHttps) { + throw new Error('Enforce HTTPS is required when fine-grained access control is enabled.'); + } + } + + // Validate fine grained access control enabled for audit logs, per + // https://aws.amazon.com/about-aws/whats-new/2020/09/elasticsearch-audit-logs-now-available-on-amazon-elasticsearch-service/ + if (props.logging?.auditLogEnabled && !advancedSecurityEnabled) { + throw new Error('Fine-grained access control is required when audit logs publishing is enabled.'); + } + + // Validate UltraWarm requirement for dedicated master nodes, per + // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/ultrawarm.html + if (warmEnabled && !dedicatedMasterEnabled) { + throw new Error('Dedicated master node is required when UltraWarm storage is enabled.'); + } + + let cfnVpcOptions: CfnDomain.VPCOptionsProperty | undefined; + + if (securityGroups && subnets) { + cfnVpcOptions = { + securityGroupIds: securityGroups.map((sg) => sg.securityGroupId), + subnetIds: subnets.map((subnet) => subnet.subnetId), + }; + } + + // Setup logging + const logGroups: logs.ILogGroup[] = []; + + if (props.logging?.slowSearchLogEnabled) { + this.slowSearchLogGroup = props.logging.slowSearchLogGroup ?? + new logs.LogGroup(this, 'SlowSearchLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.slowSearchLogGroup); + }; + + if (props.logging?.slowIndexLogEnabled) { + this.slowIndexLogGroup = props.logging.slowIndexLogGroup ?? + new logs.LogGroup(this, 'SlowIndexLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.slowIndexLogGroup); + }; + + if (props.logging?.appLogEnabled) { + this.appLogGroup = props.logging.appLogGroup ?? + new logs.LogGroup(this, 'AppLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.appLogGroup); + }; + + if (props.logging?.auditLogEnabled) { + this.auditLogGroup = props.logging.auditLogGroup ?? + new logs.LogGroup(this, 'AuditLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.auditLogGroup); + }; + + let logGroupResourcePolicy: LogGroupResourcePolicy | null = null; + if (logGroups.length > 0) { + const logPolicyStatement = new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], + resources: logGroups.map((lg) => lg.logGroupArn), + principals: [new iam.ServicePrincipal('es.amazonaws.com')], + }); + + // Use a custom resource to set the log group resource policy since it is not supported by CDK and cfn. + // https://github.com/aws/aws-cdk/issues/5343 + logGroupResourcePolicy = new LogGroupResourcePolicy(this, `ESLogGroupPolicy${this.node.addr}`, { + // create a cloudwatch logs resource policy name that is unique to this domain instance + policyName: `ESLogPolicy${this.node.addr}`, + policyStatements: [logPolicyStatement], + }); + } + + const logPublishing: Record = {}; + + if (this.appLogGroup) { + logPublishing.ES_APPLICATION_LOGS = { + enabled: true, + cloudWatchLogsLogGroupArn: this.appLogGroup.logGroupArn, + }; + } + + if (this.slowSearchLogGroup) { + logPublishing.SEARCH_SLOW_LOGS = { + enabled: true, + cloudWatchLogsLogGroupArn: this.slowSearchLogGroup.logGroupArn, + }; + } + + if (this.slowIndexLogGroup) { + logPublishing.INDEX_SLOW_LOGS = { + enabled: true, + cloudWatchLogsLogGroupArn: this.slowIndexLogGroup.logGroupArn, + }; + } + + if (this.auditLogGroup) { + logPublishing.AUDIT_LOGS = { + enabled: this.auditLogGroup != null, + cloudWatchLogsLogGroupArn: this.auditLogGroup?.logGroupArn, + }; + } + + let customEndpointCertificate: acm.ICertificate | undefined; + if (props.customEndpoint) { + if (props.customEndpoint.certificate) { + customEndpointCertificate = props.customEndpoint.certificate; + } else { + customEndpointCertificate = new acm.Certificate(this, 'CustomEndpointCertificate', { + domainName: props.customEndpoint.domainName, + validation: props.customEndpoint.hostedZone ? acm.CertificateValidation.fromDns(props.customEndpoint.hostedZone) : undefined, + }); + } + } + + // Create the domain + this.domain = new CfnDomain(this, 'Resource', { + domainName: this.physicalName, + elasticsearchVersion, + elasticsearchClusterConfig: { + dedicatedMasterEnabled, + dedicatedMasterCount: dedicatedMasterEnabled + ? dedicatedMasterCount + : undefined, + dedicatedMasterType: dedicatedMasterEnabled + ? dedicatedMasterType + : undefined, + instanceCount, + instanceType, + warmEnabled: warmEnabled + ? warmEnabled + : undefined, + warmCount: warmEnabled + ? warmCount + : undefined, + warmType: warmEnabled + ? warmType + : undefined, + zoneAwarenessEnabled, + zoneAwarenessConfig: zoneAwarenessEnabled + ? { availabilityZoneCount } + : undefined, + }, + ebsOptions: { + ebsEnabled, + volumeSize: ebsEnabled ? volumeSize : undefined, + volumeType: ebsEnabled ? volumeType : undefined, + iops: ebsEnabled ? props.ebs?.iops : undefined, + }, + encryptionAtRestOptions: { + enabled: encryptionAtRestEnabled, + kmsKeyId: encryptionAtRestEnabled + ? props.encryptionAtRest?.kmsKey?.keyId + : undefined, + }, + nodeToNodeEncryptionOptions: { enabled: nodeToNodeEncryptionEnabled }, + logPublishingOptions: logPublishing, + cognitoOptions: { + enabled: props.cognitoKibanaAuth != null, + identityPoolId: props.cognitoKibanaAuth?.identityPoolId, + roleArn: props.cognitoKibanaAuth?.role.roleArn, + userPoolId: props.cognitoKibanaAuth?.userPoolId, + }, + vpcOptions: cfnVpcOptions, + snapshotOptions: props.automatedSnapshotStartHour + ? { automatedSnapshotStartHour: props.automatedSnapshotStartHour } + : undefined, + domainEndpointOptions: { + enforceHttps, + tlsSecurityPolicy: props.tlsSecurityPolicy ?? TLSSecurityPolicy.TLS_1_0, + ...props.customEndpoint && { + customEndpointEnabled: true, + customEndpoint: props.customEndpoint.domainName, + customEndpointCertificateArn: customEndpointCertificate!.certificateArn, + }, + }, + advancedSecurityOptions: advancedSecurityEnabled + ? { + enabled: true, + internalUserDatabaseEnabled, + masterUserOptions: { + masterUserArn: masterUserArn, + masterUserName: masterUserName, + masterUserPassword: this.masterUserPassword?.unsafeUnwrap(), // Safe usage + }, + } + : undefined, + advancedOptions: props.advancedOptions, + }); + this.domain.applyRemovalPolicy(props.removalPolicy); + + if (props.enableVersionUpgrade) { + this.domain.cfnOptions.updatePolicy = { + ...this.domain.cfnOptions.updatePolicy, + enableVersionUpgrade: props.enableVersionUpgrade, + }; + } + + if (logGroupResourcePolicy) { this.domain.node.addDependency(logGroupResourcePolicy); } + + if (props.domainName) { + if (!cdk.Token.isUnresolved(props.domainName)) { + // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/configuration-api.html#configuration-api-datatypes-domainname + if (!props.domainName.match(/^[a-z0-9\-]+$/)) { + throw new Error(`Invalid domainName '${props.domainName}'. Valid characters are a-z (lowercase only), 0-9, and – (hyphen).`); + } + if (props.domainName.length < 3 || props.domainName.length > 28) { + throw new Error(`Invalid domainName '${props.domainName}'. It must be between 3 and 28 characters`); + } + if (props.domainName[0] < 'a' || props.domainName[0] > 'z') { + throw new Error(`Invalid domainName '${props.domainName}'. It must start with a lowercase letter`); + } + } + this.node.addMetadata('aws:cdk:hasPhysicalName', props.domainName); + } + + this.domainName = this.getResourceNameAttribute(this.domain.ref); + + this.domainEndpoint = this.domain.getAtt('DomainEndpoint').toString(); + + this.domainArn = this.getResourceArnAttribute(this.domain.attrArn, { + service: 'es', + resource: 'domain', + resourceName: this.physicalName, + }); + + if (props.customEndpoint?.hostedZone) { + new route53.CnameRecord(this, 'CnameRecord', { + recordName: props.customEndpoint.domainName, + zone: props.customEndpoint.hostedZone, + domainName: this.domainEndpoint, + }); + } + + this.encryptionAtRestOptions = props.encryptionAtRest; + if (props.accessPolicies) { + this.addAccessPolicies(...props.accessPolicies); + } + if (unsignedBasicAuthEnabled) { + this.addAccessPolicies(unsignedAccessPolicy); + } + } + + /** + * Manages network connections to the domain. This will throw an error in case the domain + * is not placed inside a VPC. + * + * @deprecated use opensearchservice module instead + */ + public get connections(): ec2.Connections { + if (!this._connections) { + throw new Error("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); + } + return this._connections; + } + + /** + * Add policy statements to the domain access policy + * + * @deprecated use opensearchservice module instead + */ + public addAccessPolicies(...accessPolicyStatements: iam.PolicyStatement[]) { + if (accessPolicyStatements.length > 0) { + if (!this.accessPolicy) { + // Only create the custom resource after there are statements to set. + this.accessPolicy = new ElasticsearchAccessPolicy(this, 'ESAccessPolicy', { + domainName: this.domainName, + domainArn: this.domainArn, + accessPolicies: accessPolicyStatements, + }); + + if (this.encryptionAtRestOptions?.kmsKey) { + // https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/encryption-at-rest.html + + // these permissions are documented as required during domain creation. + // while not strictly documented for updates as well, it stands to reason that an update + // operation might require these in case the cluster uses a kms key. + // empircal evidence shows this is indeed required: https://github.com/aws/aws-cdk/issues/11412 + this.accessPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['kms:List*', 'kms:Describe*', 'kms:CreateGrant'], + resources: [this.encryptionAtRestOptions.kmsKey.keyArn], + effect: iam.Effect.ALLOW, + })); + } + } else { + this.accessPolicy.addAccessPolicies(...accessPolicyStatements); + } + } + } +} + +/** + * Given an Elasticsearch domain endpoint, returns a CloudFormation expression that + * extracts the domain name. + * + * Domain endpoints look like this: + * + * https://example-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com + * https://-..es.amazonaws.com + * + * ..which means that in order to extract the domain name from the endpoint, we can + * split the endpoint using "-" and select the component in index 0. + * + * @param domainEndpoint The Elasticsearch domain endpoint + */ +function extractNameFromEndpoint(domainEndpoint: string) { + const { hostname } = new URL(domainEndpoint); + const domain = hostname.split('.')[0]; + const suffix = '-' + domain.split('-').slice(-1)[0]; + return domain.split(suffix)[0]; +} + +/** + * Converts an Elasticsearch version into a into a decimal number with major and minor version i.e x.y. + * + * @param version The Elasticsearch version object + */ +function parseVersion(version: ElasticsearchVersion): number { + const versionStr = version.version; + const firstDot = versionStr.indexOf('.'); + + if (firstDot < 1) { + throw new Error(`Invalid Elasticsearch version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); + } + + const secondDot = versionStr.indexOf('.', firstDot + 1); + + try { + if (secondDot == -1) { + return parseFloat(versionStr); + } else { + return parseFloat(versionStr.substring(0, secondDot)); + } + } catch { + throw new Error(`Invalid Elasticsearch version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); + } +} + +function selectSubnets(vpc: ec2.IVpc, vpcSubnets: ec2.SubnetSelection[]): ec2.ISubnet[] { + const selected = []; + for (const selection of vpcSubnets) { + selected.push(...vpc.selectSubnets(selection).subnets); + } + return selected; +} + +/** + * Initializes an instance type. + * + * @param defaultInstanceType Default instance type which is used if no instance type is provided + * @param instanceType Instance type + * @returns Instance type in lowercase (if provided) or default instance type + */ +function initializeInstanceType(defaultInstanceType: string, instanceType?: string): string { + if (instanceType) { + return cdk.Token.isUnresolved(instanceType) ? instanceType : instanceType.toLowerCase(); + } else { + return defaultInstanceType; + } +} diff --git a/packages/@aws-cdk/aws-elasticsearch/lib/elasticsearch-access-policy.ts b/packages/aws-cdk-lib/aws-elasticsearch/lib/elasticsearch-access-policy.ts similarity index 93% rename from packages/@aws-cdk/aws-elasticsearch/lib/elasticsearch-access-policy.ts rename to packages/aws-cdk-lib/aws-elasticsearch/lib/elasticsearch-access-policy.ts index af8a4d31a77ae..8a1626770a6e8 100644 --- a/packages/@aws-cdk/aws-elasticsearch/lib/elasticsearch-access-policy.ts +++ b/packages/aws-cdk-lib/aws-elasticsearch/lib/elasticsearch-access-policy.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as cr from '../../custom-resources'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-elasticsearch/lib/index.ts b/packages/aws-cdk-lib/aws-elasticsearch/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/lib/index.ts rename to packages/aws-cdk-lib/aws-elasticsearch/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-elasticsearch/lib/log-group-resource-policy.ts b/packages/aws-cdk-lib/aws-elasticsearch/lib/log-group-resource-policy.ts new file mode 100644 index 0000000000000..5a9058076016d --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/lib/log-group-resource-policy.ts @@ -0,0 +1,50 @@ +import * as iam from '../../aws-iam'; +import * as cr from '../../custom-resources'; +import { Construct } from 'constructs'; + +/** + * Construction properties for LogGroupResourcePolicy + */ +export interface LogGroupResourcePolicyProps { + /** + * The log group resource policy name + */ + readonly policyName: string; + /** + * The policy statements for the log group resource logs + */ + readonly policyStatements: [iam.PolicyStatement]; +} + +/** + * Creates LogGroup resource policies. + */ +export class LogGroupResourcePolicy extends cr.AwsCustomResource { + constructor(scope: Construct, id: string, props: LogGroupResourcePolicyProps) { + const policyDocument = new iam.PolicyDocument({ + statements: props.policyStatements, + }); + + super(scope, id, { + resourceType: 'Custom::CloudwatchLogResourcePolicy', + onUpdate: { + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: props.policyName, + policyDocument: JSON.stringify(policyDocument), + }, + physicalResourceId: cr.PhysicalResourceId.of(id), + }, + onDelete: { + service: 'CloudWatchLogs', + action: 'deleteResourcePolicy', + parameters: { + policyName: props.policyName, + }, + ignoreErrorCodesMatching: 'ResourceNotFoundException', + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: ['*'] }), + }); + } +} diff --git a/packages/@aws-cdk/aws-elasticsearch/lib/perms.ts b/packages/aws-cdk-lib/aws-elasticsearch/lib/perms.ts similarity index 100% rename from packages/@aws-cdk/aws-elasticsearch/lib/perms.ts rename to packages/aws-cdk-lib/aws-elasticsearch/lib/perms.ts diff --git a/packages/aws-cdk-lib/aws-elasticsearch/test/domain.test.ts b/packages/aws-cdk-lib/aws-elasticsearch/test/domain.test.ts new file mode 100644 index 0000000000000..2c55825bb24a9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/test/domain.test.ts @@ -0,0 +1,1903 @@ +/* eslint-disable jest/expect-expect */ +import { Match, Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import { Metric, Statistic } from '../../aws-cloudwatch'; +import { Vpc, EbsDeviceVolumeType, SecurityGroup } from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as route53 from '../../aws-route53'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { App, Stack, Duration, SecretValue, CfnParameter, Token } from '../../core'; + +import { Domain, ElasticsearchVersion } from '../lib/domain'; + +let app: App; +let stack: Stack; + +beforeEach(() => { + app = new App(); + stack = new Stack(app, 'Stack', { + env: { account: '1234', region: 'testregion' }, + }); + + jest.resetAllMocks(); +}); + +const readActions = ['ESHttpGet', 'ESHttpHead']; +const writeActions = ['ESHttpDelete', 'ESHttpPost', 'ESHttpPut', 'ESHttpPatch']; +const readWriteActions = [ + ...readActions, + ...writeActions, +]; + +testDeprecated('connections throws if domain is placed inside a vpc', () => { + + expect(() => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + }).connections; + }).toThrowError("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); +}); + +testDeprecated('subnets and security groups can be provided when vpc is used', () => { + + const vpc = new Vpc(stack, 'Vpc'); + const securityGroup = new SecurityGroup(stack, 'CustomSecurityGroup', { + vpc, + }); + const domain = new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_10, + vpc, + vpcSubnets: [{ subnets: [vpc.privateSubnets[0]] }], + securityGroups: [securityGroup], + }); + + expect(domain.connections.securityGroups[0].securityGroupId).toEqual(securityGroup.securityGroupId); + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + VPCOptions: { + SecurityGroupIds: [ + { + 'Fn::GetAtt': [ + 'CustomSecurityGroupE5E500E5', + 'GroupId', + ], + }, + ], + SubnetIds: [ + { + Ref: 'VpcPrivateSubnet1Subnet536B997A', + }, + ], + }, + }); +}); + +testDeprecated('default subnets and security group when vpc is used', () => { + + const vpc = new Vpc(stack, 'Vpc'); + const domain = new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_10, + vpc, + }); + + expect(stack.resolve(domain.connections.securityGroups[0].securityGroupId)).toEqual({ 'Fn::GetAtt': ['DomainSecurityGroup48AA5FD6', 'GroupId'] }); + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + VPCOptions: { + SecurityGroupIds: [ + { + 'Fn::GetAtt': [ + 'DomainSecurityGroup48AA5FD6', + 'GroupId', + ], + }, + ], + SubnetIds: [ + { + Ref: 'VpcPrivateSubnet1Subnet536B997A', + }, + { + Ref: 'VpcPrivateSubnet2Subnet3788AAA1', + }, + { + Ref: 'VpcPrivateSubnet3SubnetF258B56E', + }, + ], + }, + }); +}); + +testDeprecated('default removalpolicy is retain', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + }); + + Template.fromStack(stack).hasResource('AWS::Elasticsearch::Domain', { + DeletionPolicy: 'Retain', + }); +}); + +testDeprecated('grants kms permissions if needed', () => { + + const key = new kms.Key(stack, 'Key'); + + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + encryptionAtRest: { + kmsKey: key, + }, + // so that the access policy custom resource will be used. + useUnsignedBasicAuth: true, + }); + + const expectedPolicy = { + Statement: [ + { + Action: [ + 'kms:List*', + 'kms:Describe*', + 'kms:CreateGrant', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }; + + const resources = Template.fromStack(stack).toJSON().Resources; + expect(resources.AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E.Properties.PolicyDocument).toStrictEqual(expectedPolicy); + +}); + +testDeprecated('minimal example renders correctly', () => { + new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_1 }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + CognitoOptions: { + Enabled: false, + }, + EBSOptions: { + EBSEnabled: true, + VolumeSize: 10, + VolumeType: 'gp2', + }, + ElasticsearchClusterConfig: { + DedicatedMasterEnabled: false, + InstanceCount: 1, + InstanceType: 'r5.large.elasticsearch', + ZoneAwarenessEnabled: false, + }, + ElasticsearchVersion: '7.1', + EncryptionAtRestOptions: { + Enabled: false, + }, + LogPublishingOptions: { + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + NodeToNodeEncryptionOptions: { + Enabled: false, + }, + }); +}); + +testDeprecated('can enable version upgrade update policy', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + enableVersionUpgrade: true, + }); + + Template.fromStack(stack).hasResource('AWS::Elasticsearch::Domain', { + UpdatePolicy: { + EnableVersionUpgrade: true, + }, + }); +}); + +testDeprecated('can set a self-referencing custom policy', () => { + const domain = new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + }); + + domain.addAccessPolicies( + new iam.PolicyStatement({ + actions: ['es:ESHttpPost', 'es:ESHttpPut'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('5678')], + resources: [domain.domainArn, `${domain.domainArn}/*`], + }), + ); + + const expectedPolicy = { + 'Fn::Join': [ + '', + [ + '{"action":"updateElasticsearchDomainConfig","service":"ES","parameters":{"DomainName":"', + { + Ref: 'Domain66AC69E0', + }, + '","AccessPolicies":"{\\"Statement\\":[{\\"Action\\":[\\"es:ESHttpPost\\",\\"es:ESHttpPut\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"AWS\\":\\"arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::5678:root\\"},\\"Resource\\":[\\"', + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'Arn', + ], + }, + '\\",\\"', + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'Arn', + ], + }, + '/*\\"]}],\\"Version\\":\\"2012-10-17\\"}"},"outputPaths":["DomainConfig.ElasticsearchClusterConfig.AccessPolicies"],"physicalResourceId":{"id":"', + { + Ref: 'Domain66AC69E0', + }, + 'AccessPolicy"}}', + ], + ], + }; + Template.fromStack(stack).hasResourceProperties('Custom::ElasticsearchAccessPolicy', { + ServiceToken: { + 'Fn::GetAtt': [ + 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', + 'Arn', + ], + }, + Create: expectedPolicy, + Update: expectedPolicy, + }); +}); + + +describe('UltraWarm instances', () => { + + testDeprecated('can enable UltraWarm instances', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + capacity: { + masterNodes: 2, + warmNodes: 2, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + ElasticsearchClusterConfig: { + DedicatedMasterEnabled: true, + WarmEnabled: true, + WarmCount: 2, + WarmType: 'ultrawarm1.medium.elasticsearch', + }, + }); + }); + + testDeprecated('can enable UltraWarm instances with specific instance type', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + capacity: { + masterNodes: 2, + warmNodes: 2, + warmInstanceType: 'ultrawarm1.large.elasticsearch', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + ElasticsearchClusterConfig: { + DedicatedMasterEnabled: true, + WarmEnabled: true, + WarmCount: 2, + WarmType: 'ultrawarm1.large.elasticsearch', + }, + }); + }); + +}); + +testDeprecated('can use tokens in capacity configuration', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_10, + capacity: { + dataNodeInstanceType: Token.asString({ Ref: 'dataNodeInstanceType' }), + dataNodes: Token.asNumber({ Ref: 'dataNodes' }), + masterNodeInstanceType: Token.asString({ Ref: 'masterNodeInstanceType' }), + masterNodes: Token.asNumber({ Ref: 'masterNodes' }), + warmInstanceType: Token.asString({ Ref: 'warmInstanceType' }), + warmNodes: Token.asNumber({ Ref: 'warmNodes' }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + ElasticsearchClusterConfig: { + InstanceCount: { + Ref: 'dataNodes', + }, + InstanceType: { + Ref: 'dataNodeInstanceType', + }, + DedicatedMasterEnabled: true, + DedicatedMasterCount: { + Ref: 'masterNodes', + }, + DedicatedMasterType: { + Ref: 'masterNodeInstanceType', + }, + WarmEnabled: true, + WarmCount: { + Ref: 'warmNodes', + }, + WarmType: { + Ref: 'warmInstanceType', + }, + }, + }); +}); + +describe('log groups', () => { + + testDeprecated('slowSearchLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + slowSearchLogEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainSlowSearchLogs5B35A97A', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('slowIndexLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + slowIndexLogEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainSlowIndexLogsFE2F1061', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('appLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + appLogEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainAppLogs21698C1B', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('auditLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + auditLogEnabled: true, + }, + fineGrainedAccessControl: { + masterUserName: 'username', + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + AUDIT_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainAuditLogs608E0FA6', + 'Arn', + ], + }, + Enabled: true, + }, + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('two domains with logging enabled can be created in same stack', () => { + new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_7, + logging: { + appLogEnabled: true, + slowSearchLogEnabled: true, + slowIndexLogEnabled: true, + }, + }); + new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_7, + logging: { + appLogEnabled: true, + slowSearchLogEnabled: true, + slowIndexLogEnabled: true, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain1AppLogs6E8D1D67', + 'Arn', + ], + }, + Enabled: true, + }, + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain1SlowSearchLogs8F3B0506', + 'Arn', + ], + }, + Enabled: true, + }, + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain1SlowIndexLogs9354D098', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain2AppLogs810876E2', + 'Arn', + ], + }, + Enabled: true, + }, + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain2SlowSearchLogs0C75F64B', + 'Arn', + ], + }, + Enabled: true, + }, + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain2SlowIndexLogs0CB900D0', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('log group policy is uniquely named for each domain', () => { + new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + logging: { + appLogEnabled: true, + }, + }); + new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + logging: { + appLogEnabled: true, + }, + }); + + // Domain1 + Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { + Create: { + 'Fn::Join': [ + '', + [ + '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', + { + 'Fn::GetAtt': [ + 'Domain1AppLogs6E8D1D67', + 'Arn', + ], + }, + '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391"}}', + ], + ], + }, + }); + // Domain2 + Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { + Create: { + 'Fn::Join': [ + '', + [ + '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', + { + 'Fn::GetAtt': [ + 'Domain2AppLogs810876E2', + 'Arn', + ], + }, + '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2"}}', + ], + ], + }, + }); + }); + + testDeprecated('enabling audit logs throws without fine grained access control enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V6_7, + logging: { + auditLogEnabled: true, + }, + })).toThrow(/Fine-grained access control is required when audit logs publishing is enabled\./); + }); + + testDeprecated('slowSearchLogGroup should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + slowSearchLogEnabled: true, + slowSearchLogGroup: new logs.LogGroup(stack, 'SlowSearchLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'SlowSearchLogsE00DC2E7', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('slowIndexLogEnabled should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + slowIndexLogEnabled: true, + slowIndexLogGroup: new logs.LogGroup(stack, 'SlowIndexLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'SlowIndexLogsAD49DED0', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('appLogGroup should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + logging: { + appLogEnabled: true, + appLogGroup: new logs.LogGroup(stack, 'AppLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'AppLogsC5DF83A6', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + testDeprecated('auditLOgGroup should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + fineGrainedAccessControl: { + masterUserName: 'username', + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + enforceHttps: true, + logging: { + auditLogEnabled: true, + auditLogGroup: new logs.LogGroup(stack, 'AuditLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + LogPublishingOptions: { + AUDIT_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'AuditLogsB945E340', + 'Arn', + ], + }, + Enabled: true, + }, + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + +}); + +describe('grants', () => { + + testDeprecated('"grantRead" allows read actions associated with this domain resource', () => { + testGrant(readActions, (p, d) => d.grantRead(p)); + }); + + testDeprecated('"grantWrite" allows write actions associated with this domain resource', () => { + testGrant(writeActions, (p, d) => d.grantWrite(p)); + }); + + testDeprecated('"grantReadWrite" allows read and write actions associated with this domain resource', () => { + testGrant(readWriteActions, (p, d) => d.grantReadWrite(p)); + }); + + testDeprecated('"grantIndexRead" allows read actions associated with an index in this domain resource', () => { + testGrant( + readActions, + (p, d) => d.grantIndexRead('my-index', p), + false, + ['/my-index', '/my-index/*'], + ); + }); + + testDeprecated('"grantIndexWrite" allows write actions associated with an index in this domain resource', () => { + testGrant( + writeActions, + (p, d) => d.grantIndexWrite('my-index', p), + false, + ['/my-index', '/my-index/*'], + ); + }); + + testDeprecated('"grantIndexReadWrite" allows read and write actions associated with an index in this domain resource', () => { + testGrant( + readWriteActions, + (p, d) => d.grantIndexReadWrite('my-index', p), + false, + ['/my-index', '/my-index/*'], + ); + }); + + testDeprecated('"grantPathRead" allows read actions associated with a given path in this domain resource', () => { + testGrant( + readActions, + (p, d) => d.grantPathRead('my-index/my-path', p), + false, + ['/my-index/my-path'], + ); + }); + + testDeprecated('"grantPathWrite" allows write actions associated with a given path in this domain resource', () => { + testGrant( + writeActions, + (p, d) => d.grantPathWrite('my-index/my-path', p), + false, + ['/my-index/my-path'], + ); + }); + + testDeprecated('"grantPathReadWrite" allows read and write actions associated with a given path in this domain resource', () => { + testGrant( + readWriteActions, + (p, d) => d.grantPathReadWrite('my-index/my-path', p), + false, + ['/my-index/my-path'], + ); + }); + + testDeprecated('"grant" for an imported domain', () => { + const domainEndpoint = 'https://test-domain-2w2x2u3tifly-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com'; + const domain = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); + const user = new iam.User(stack, 'user'); + + domain.grantReadWrite(user); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'es:ESHttpGet', + 'es:ESHttpHead', + 'es:ESHttpDelete', + 'es:ESHttpPost', + 'es:ESHttpPut', + 'es:ESHttpPatch', + ], + Effect: 'Allow', + Resource: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':es:testregion:1234:domain/test-domain-2w2x2u3tifly', + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':es:testregion:1234:domain/test-domain-2w2x2u3tifly/*', + ], + ], + }, + ], + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'userDefaultPolicy083DF682', + Users: [ + { + Ref: 'user2C2B57AE', + }, + ], + }); + }); + +}); + +describe('metrics', () => { + + testDeprecated('Can use metricClusterStatusRed on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricClusterStatusRed(), + 'ClusterStatus.red', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricClusterStatusYellow on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricClusterStatusYellow(), + 'ClusterStatus.yellow', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricFreeStorageSpace on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricFreeStorageSpace(), + 'FreeStorageSpace', + Statistic.MINIMUM, + ); + }); + + testDeprecated('Can use metricClusterIndexWriteBlocked on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricClusterIndexWritesBlocked(), + 'ClusterIndexWritesBlocked', + Statistic.MAXIMUM, + Duration.minutes(1), + ); + }); + + testDeprecated('Can use metricNodes on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricNodes(), + 'Nodes', + Statistic.MINIMUM, + Duration.hours(1), + ); + }); + + testDeprecated('Can use metricAutomatedSnapshotFailure on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricAutomatedSnapshotFailure(), + 'AutomatedSnapshotFailure', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricCPUUtilization on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricCPUUtilization(), + 'CPUUtilization', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricJVMMemoryPressure on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricJVMMemoryPressure(), + 'JVMMemoryPressure', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricMasterCPUUtilization on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricMasterCPUUtilization(), + 'MasterCPUUtilization', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricMasterJVMMemoryPressure on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricMasterJVMMemoryPressure(), + 'MasterJVMMemoryPressure', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricKMSKeyError on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricKMSKeyError(), + 'KMSKeyError', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricKMSKeyInaccessible on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricKMSKeyInaccessible(), + 'KMSKeyInaccessible', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricSearchableDocuments on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricSearchableDocuments(), + 'SearchableDocuments', + Statistic.MAXIMUM, + ); + }); + + testDeprecated('Can use metricSearchLatency on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricSearchLatency(), + 'SearchLatency', + 'p99', + ); + }); + + testDeprecated('Can use metricIndexingLatency on an Elasticsearch Domain', () => { + testMetric( + (domain) => domain.metricIndexingLatency(), + 'IndexingLatency', + 'p99', + ); + }); + +}); + +describe('import', () => { + + testDeprecated('static fromDomainEndpoint(endpoint) allows importing an external/existing domain', () => { + const domainName = 'test-domain-2w2x2u3tifly'; + const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; + const domainEndpoint = `https://${domainEndpointWithoutHttps}`; + const imported = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); + + expect(imported.domainName).toEqual(domainName); + expect(imported.domainArn).toMatch(RegExp(`es:testregion:1234:domain/${domainName}$`)); + expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); + + Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 0); + }); + + testDeprecated('static fromDomainAttributes(attributes) allows importing an external/existing domain', () => { + const domainName = 'test-domain-2w2x2u3tifly'; + const domainArn = `arn:aws:es:testregion:1234:domain/${domainName}`; + const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; + const domainEndpoint = `https://${domainEndpointWithoutHttps}`; + const imported = Domain.fromDomainAttributes(stack, 'Domain', { + domainArn, + domainEndpoint, + }); + + expect(imported.domainName).toEqual(domainName); + expect(imported.domainArn).toEqual(domainArn); + expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); + + Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 0); + }); + + testDeprecated('static fromDomainAttributes(attributes) allows importing with token arn and endpoint', () => { + const domainArn = new CfnParameter(stack, 'domainArn', { type: 'String' }).valueAsString; + const domainEndpoint = new CfnParameter(stack, 'domainEndpoint', { type: 'String' }).valueAsString; + const imported = Domain.fromDomainAttributes(stack, 'Domain', { + domainArn, + domainEndpoint, + }); + const expectedDomainName = { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + '/', + { + 'Fn::Select': [ + 5, + { + 'Fn::Split': [ + ':', + { + Ref: 'domainArn', + }, + ], + }, + ], + }, + ], + }, + ], + }; + + expect(stack.resolve(imported.domainName)).toEqual(expectedDomainName); + expect(imported.domainArn).toEqual(domainArn); + expect(imported.domainEndpoint).toEqual(domainEndpoint); + + Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 0); + }); +}); + +describe('advanced security options', () => { + const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; + const masterUserName = 'JohnDoe'; + const password = 'password'; + const masterUserPassword = SecretValue.unsafePlainText(password); + + testDeprecated('enable fine-grained access control with a master user ARN', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: false, + MasterUserOptions: { + MasterUserARN: masterUserArn, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + testDeprecated('enable fine-grained access control with a master user name and password', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + fineGrainedAccessControl: { + masterUserName, + masterUserPassword, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: masterUserName, + MasterUserPassword: password, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + testDeprecated('enable fine-grained access control with a master user name and dynamically generated password', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + fineGrainedAccessControl: { + masterUserName, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: masterUserName, + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DomainMasterUserBFAFA7D9', + }, + ':SecretString:password::}}', + ], + ], + }, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: { + GenerateStringKey: 'password', + }, + }); + }); + + testDeprecated('enabling fine-grained access control throws with Elasticsearch < 6.7', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V6_5, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + })).toThrow(/Fine-grained access control requires Elasticsearch version 6\.7 or later/); + }); + + testDeprecated('enabling fine-grained access control throws without node-to-node encryption enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: false, + enforceHttps: true, + })).toThrow(/Node-to-node encryption is required when fine-grained access control is enabled/); + }); + + testDeprecated('enabling fine-grained access control throws without encryption-at-rest enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: false, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + })).toThrow(/Encryption-at-rest is required when fine-grained access control is enabled/); + }); + + testDeprecated('enabling fine-grained access control throws without enforceHttps enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: false, + })).toThrow(/Enforce HTTPS is required when fine-grained access control is enabled/); + }); +}); + +describe('custom endpoints', () => { + const customDomainName = 'search.example.com'; + + testDeprecated('custom domain without hosted zone and default cert', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + nodeToNodeEncryption: true, + enforceHttps: true, + customEndpoint: { + domainName: customDomainName, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + DomainEndpointOptions: { + EnforceHTTPS: true, + CustomEndpointEnabled: true, + CustomEndpoint: customDomainName, + CustomEndpointCertificateArn: { + Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: customDomainName, + ValidationMethod: 'EMAIL', + }); + }); + + testDeprecated('custom domain with hosted zone and default cert', () => { + const zone = new route53.HostedZone(stack, 'DummyZone', { zoneName: 'example.com' }); + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + nodeToNodeEncryption: true, + enforceHttps: true, + customEndpoint: { + domainName: customDomainName, + hostedZone: zone, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + DomainEndpointOptions: { + EnforceHTTPS: true, + CustomEndpointEnabled: true, + CustomEndpoint: customDomainName, + CustomEndpointCertificateArn: { + Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: customDomainName, + DomainValidationOptions: [ + { + DomainName: customDomainName, + HostedZoneId: { + Ref: 'DummyZone03E0FE81', + }, + }, + ], + ValidationMethod: 'DNS', + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Name: 'search.example.com.', + Type: 'CNAME', + HostedZoneId: { + Ref: 'DummyZone03E0FE81', + }, + ResourceRecords: [ + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'DomainEndpoint', + ], + }, + ], + }); + }); + + testDeprecated('custom domain with hosted zone and given cert', () => { + const zone = new route53.HostedZone(stack, 'DummyZone', { + zoneName: 'example.com', + }); + const certificate = new acm.Certificate(stack, 'DummyCert', { + domainName: customDomainName, + }); + + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + nodeToNodeEncryption: true, + enforceHttps: true, + customEndpoint: { + domainName: customDomainName, + hostedZone: zone, + certificate, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + DomainEndpointOptions: { + EnforceHTTPS: true, + CustomEndpointEnabled: true, + CustomEndpoint: customDomainName, + CustomEndpointCertificateArn: { + Ref: 'DummyCertFA37670B', + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Name: 'search.example.com.', + Type: 'CNAME', + HostedZoneId: { + Ref: 'DummyZone03E0FE81', + }, + ResourceRecords: [ + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'DomainEndpoint', + ], + }, + ], + }); + }); + +}); + +describe('custom error responses', () => { + + testDeprecated('error when availabilityZoneCount does not match vpcOptions.subnets length', () => { + const vpc = new Vpc(stack, 'Vpc', { + maxAzs: 1, + }); + + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_4, + zoneAwareness: { + enabled: true, + availabilityZoneCount: 2, + }, + vpc, + })).toThrow(/you need to provide a subnet for each AZ you are using/); + }); + + testDeprecated('error when master, data or Ultra Warm instance types do not end with .elasticsearch', () => { + const error = /instance types must end with ".elasticsearch"/; + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + capacity: { + masterNodeInstanceType: 'c5.large', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + capacity: { + dataNodeInstanceType: 'c5.2xlarge', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain3', { + version: ElasticsearchVersion.V7_4, + capacity: { + warmInstanceType: 'ultrawarm1.medium', + }, + })).toThrow(error); + }); + + testDeprecated('error when Ultra Warm instance types do not start with ultrawarm', () => { + const error = /UltraWarm node instance type must start with "ultrawarm"./; + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + capacity: { + warmInstanceType: 't3.small.elasticsearch', + }, + })).toThrow(error); + }); + + testDeprecated('error when elasticsearchVersion is unsupported/unknown', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.of('5.4'), + })).toThrow(/Unknown Elasticsearch version: 5\.4/); + }); + + testDeprecated('error when invalid domain name is given', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + domainName: 'InvalidName', + })).toThrow(/Valid characters are a-z/); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + domainName: 'a'.repeat(29), + })).toThrow(/It must be between 3 and 28 characters/); + expect(() => new Domain(stack, 'Domain3', { + version: ElasticsearchVersion.V7_4, + domainName: '123domain', + })).toThrow(/It must start with a lowercase letter/); + }); + + testDeprecated('error when error log publishing is enabled for elasticsearch version < 5.1', () => { + const error = /Error logs publishing requires Elasticsearch version 5.1 or later/; + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V2_3, + logging: { + appLogEnabled: true, + }, + })).toThrow(error); + }); + + testDeprecated('error when encryption at rest is enabled for elasticsearch version < 5.1', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V2_3, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(/Encryption of data at rest requires Elasticsearch version 5.1 or later/); + }); + + testDeprecated('error when cognito for kibana is enabled for elasticsearch version < 5.1', () => { + const user = new iam.User(stack, 'user'); + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V2_3, + cognitoKibanaAuth: { + identityPoolId: 'test-identity-pool-id', + role: new iam.Role(stack, 'Role', { assumedBy: user }), + userPoolId: 'test-user-pool-id', + }, + })).toThrow(/Cognito authentication for Kibana requires Elasticsearch version 5.1 or later/); + }); + + testDeprecated('error when C5, I3, M5, or R5 instance types are specified for elasticsearch version < 5.1', () => { + const error = /C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later/; + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V2_3, + capacity: { + masterNodeInstanceType: 'c5.medium.elasticsearch', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V1_5, + capacity: { + dataNodeInstanceType: 'i3.2xlarge.elasticsearch', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain3', { + version: ElasticsearchVersion.V1_5, + capacity: { + dataNodeInstanceType: 'm5.2xlarge.elasticsearch', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain4', { + version: ElasticsearchVersion.V1_5, + capacity: { + masterNodeInstanceType: 'r5.2xlarge.elasticsearch', + }, + })).toThrow(error); + }); + + testDeprecated('error when node to node encryption is enabled for elasticsearch version < 6.0', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V5_6, + nodeToNodeEncryption: true, + })).toThrow(/Node-to-node encryption requires Elasticsearch version 6.0 or later/); + }); + + testDeprecated('error when i3 or r6g instance types are specified with EBS enabled', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + capacity: { + dataNodeInstanceType: 'i3.2xlarge.elasticsearch', + }, + ebs: { + volumeSize: 100, + volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + capacity: { + dataNodeInstanceType: 'r6gd.large.elasticsearch', + }, + ebs: { + volumeSize: 100, + volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); + }); + + testDeprecated('error when m3, r3, or t2 instance types are specified with encryption at rest enabled', () => { + const error = /M3, R3, and T2 instance types do not support encryption of data at rest/; + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + capacity: { + masterNodeInstanceType: 'm3.2xlarge.elasticsearch', + }, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + capacity: { + dataNodeInstanceType: 'r3.2xlarge.elasticsearch', + }, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain3', { + version: ElasticsearchVersion.V7_4, + capacity: { + masterNodeInstanceType: 't2.2xlarge.elasticsearch', + }, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(error); + }); + + testDeprecated('error when t2.micro is specified with elasticsearch version > 2.3', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V6_7, + capacity: { + masterNodeInstanceType: 't2.micro.elasticsearch', + }, + })).toThrow(/t2.micro.elasticsearch instance type supports only Elasticsearch 1.5 and 2.3/); + }); + + testDeprecated('error when any instance type other than R3, I3 and R6GD are specified without EBS enabled', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + ebs: { + enabled: false, + }, + capacity: { + masterNodeInstanceType: 'm5.large.elasticsearch', + }, + })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + ebs: { + enabled: false, + }, + capacity: { + dataNodeInstanceType: 'm5.large.elasticsearch', + }, + })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); + }); + + testDeprecated('can use compatible master instance types that does not have local storage when data node type is i3 or r6gd', () => { + new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + ebs: { + enabled: false, + }, + capacity: { + masterNodeInstanceType: 'c5.2xlarge.elasticsearch', + dataNodeInstanceType: 'i3.2xlarge.elasticsearch', + }, + }); + new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + ebs: { + enabled: false, + }, + capacity: { + masterNodes: 3, + masterNodeInstanceType: 'c6g.large.elasticsearch', + dataNodeInstanceType: 'r6gd.large.elasticsearch', + }, + }); + // both configurations pass synth-time validation + Template.fromStack(stack).resourceCountIs('AWS::Elasticsearch::Domain', 2); + }); + + testDeprecated('error when availabilityZoneCount is not 2 or 3', () => { + const vpc = new Vpc(stack, 'Vpc'); + + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + vpc, + zoneAwareness: { + availabilityZoneCount: 4, + }, + })).toThrow(/Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3/); + }); + + testDeprecated('error when UltraWarm instance is used and not supported by elasticsearchVersion', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V6_7, + capacity: { + masterNodes: 1, + warmNodes: 1, + }, + })).toThrow(/UltraWarm requires Elasticsearch 6\.8 or later/); + }); + + testDeprecated('error when t2 or t3 instance types are specified with UltramWarm enabled', () => { + const error = /T2 and T3 instance types do not support UltraWarm storage/; + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + capacity: { + masterNodeInstanceType: 't2.2xlarge.elasticsearch', + warmNodes: 1, + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: ElasticsearchVersion.V7_4, + capacity: { + masterNodeInstanceType: 't3.2xlarge.elasticsearch', + warmNodes: 1, + }, + })).toThrow(error); + }); + + testDeprecated('error when UltraWarm instance is used and no dedicated master instance specified', () => { + expect(() => new Domain(stack, 'Domain1', { + version: ElasticsearchVersion.V7_4, + capacity: { + warmNodes: 1, + masterNodes: 0, + }, + })).toThrow(/Dedicated master node is required when UltraWarm storage is enabled/); + }); + +}); + +testDeprecated('can specify future version', () => { + new Domain(stack, 'Domain', { version: ElasticsearchVersion.of('8.2') }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + ElasticsearchVersion: '8.2', + }); +}); + +describe('unsigned basic auth', () => { + testDeprecated('can create a domain with unsigned basic auth', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + useUnsignedBasicAuth: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: 'admin', + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + testDeprecated('does not overwrite master user ARN configuration', () => { + const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; + + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + fineGrainedAccessControl: { + masterUserArn, + }, + useUnsignedBasicAuth: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: false, + MasterUserOptions: { + MasterUserARN: masterUserArn, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + testDeprecated('does not overwrite master user name and password', () => { + const masterUserName = 'JohnDoe'; + const password = 'password'; + const masterUserPassword = SecretValue.unsafePlainText(password); + + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + fineGrainedAccessControl: { + masterUserName, + masterUserPassword, + }, + useUnsignedBasicAuth: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: masterUserName, + MasterUserPassword: password, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + testDeprecated('fails to create a domain with unsigned basic auth when enforce HTTPS is disabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + useUnsignedBasicAuth: true, + enforceHttps: false, + })).toThrow(/You cannot disable HTTPS and use unsigned basic auth/); + }); + + testDeprecated('fails to create a domain with unsigned basic auth when node to node encryption is disabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + useUnsignedBasicAuth: true, + nodeToNodeEncryption: false, + })).toThrow(/You cannot disable node to node encryption and use unsigned basic auth/); + }); + + testDeprecated('fails to create a domain with unsigned basic auth when encryption at rest is disabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_7, + useUnsignedBasicAuth: true, + encryptionAtRest: { enabled: false }, + })).toThrow(/You cannot disable encryption at rest and use unsigned basic auth/); + }); + + testDeprecated('using unsigned basic auth throws with Elasticsearch < 6.7', () => { + expect(() => new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V6_5, + useUnsignedBasicAuth: true, + })).toThrow(/Using unsigned basic auth requires Elasticsearch version 6\.7 or later./); + }); +}); + +describe('advanced options', () => { + testDeprecated('use advanced options', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + advancedOptions: { + 'rest.action.multi.allow_explicit_index': 'true', + 'indices.fielddata.cache.size': '50', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedOptions: { + 'rest.action.multi.allow_explicit_index': 'true', + 'indices.fielddata.cache.size': '50', + }, + }); + }); + + testDeprecated('advanced options absent by default', () => { + new Domain(stack, 'Domain', { + version: ElasticsearchVersion.V7_1, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Elasticsearch::Domain', { + AdvancedOptions: Match.absent(), + }); + }); +}); + +function testGrant( + expectedActions: string[], + invocation: (user: iam.IPrincipal, domain: Domain) => void, + appliesToDomainRoot: Boolean = true, + paths: string[] = ['/*'], +) { + const domain = new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_4 }); + const user = new iam.User(stack, 'user'); + + invocation(user, domain); + + const action = expectedActions.length > 1 ? expectedActions.map(a => `es:${a}`) : `es:${expectedActions[0]}`; + const domainArn = { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'Arn', + ], + }; + const resolvedPaths = paths.map(path => { + return { + 'Fn::Join': [ + '', + [ + domainArn, + path, + ], + ], + }; + }); + const resource = appliesToDomainRoot + ? [domainArn, ...resolvedPaths] + : resolvedPaths.length > 1 + ? resolvedPaths + : resolvedPaths[0]; + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: action, + Effect: 'Allow', + Resource: resource, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'userDefaultPolicy083DF682', + Users: [ + { + Ref: 'user2C2B57AE', + }, + ], + }); +} + +function testMetric( + invocation: (domain: Domain) => Metric, + metricName: string, + statistic: string = Statistic.SUM, + period: Duration = Duration.minutes(5), +) { + const domain = new Domain(stack, 'Domain', { version: ElasticsearchVersion.V7_4 }); + + const metric = invocation(domain); + + expect(metric).toMatchObject({ + metricName, + namespace: 'AWS/ES', + period, + statistic, + dimensions: { + ClientId: '1234', + }, + }); + expect(metric.dimensions).toHaveProperty('DomainName'); +} diff --git a/packages/@aws-cdk/aws-elasticsearch/test/elasticsearch-access-policy.test.ts b/packages/aws-cdk-lib/aws-elasticsearch/test/elasticsearch-access-policy.test.ts similarity index 96% rename from packages/@aws-cdk/aws-elasticsearch/test/elasticsearch-access-policy.test.ts rename to packages/aws-cdk-lib/aws-elasticsearch/test/elasticsearch-access-policy.test.ts index 53086622c5231..6161ce2106472 100644 --- a/packages/@aws-cdk/aws-elasticsearch/test/elasticsearch-access-policy.test.ts +++ b/packages/aws-cdk-lib/aws-elasticsearch/test/elasticsearch-access-policy.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { App, Stack } from '../../core'; import { ElasticsearchAccessPolicy } from '../lib/elasticsearch-access-policy'; let app: App; diff --git a/packages/aws-cdk-lib/aws-elasticsearch/test/log-group-resource-policy.test.ts b/packages/aws-cdk-lib/aws-elasticsearch/test/log-group-resource-policy.test.ts new file mode 100644 index 0000000000000..8b5754be2bf06 --- /dev/null +++ b/packages/aws-cdk-lib/aws-elasticsearch/test/log-group-resource-policy.test.ts @@ -0,0 +1,65 @@ +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { App, Stack } from '../../core'; +import { LogGroupResourcePolicy } from '../lib/log-group-resource-policy'; + +let app: App; +let stack: Stack; + +beforeEach(() => { + app = new App(); + stack = new Stack(app, 'Stack', { + env: { account: '1234', region: 'testregion' }, + }); +}); + +test('minimal example renders correctly', () => { + new LogGroupResourcePolicy(stack, 'LogGroupResourcePolicy', { + policyName: 'TestPolicy', + policyStatements: [new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], + resources: ['*'], + principals: [new iam.ServicePrincipal('es.amazonaws.com')], + })], + }); + + Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { + ServiceToken: { + 'Fn::GetAtt': [ + 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', + 'Arn', + ], + }, + Create: JSON.stringify({ + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: 'TestPolicy', + policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', + }, + physicalResourceId: { + id: 'LogGroupResourcePolicy', + }, + }), + Update: JSON.stringify({ + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: 'TestPolicy', + policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', + }, + physicalResourceId: { + id: 'LogGroupResourcePolicy', + }, + }), + Delete: JSON.stringify({ + service: 'CloudWatchLogs', + action: 'deleteResourcePolicy', + parameters: { + policyName: 'TestPolicy', + }, + ignoreErrorCodesMatching: 'ResourceNotFoundException', + }), + }); +}); diff --git a/packages/aws-cdk-lib/aws-emr/.jsiirc.json b/packages/aws-cdk-lib/aws-emr/.jsiirc.json new file mode 100644 index 0000000000000..bfca6a4515b26 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emr/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.emr" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.EMR" + }, + "python": { + "module": "aws_cdk.aws_emr" + } + } +} diff --git a/packages/aws-cdk-lib/aws-emr/README.md b/packages/aws-cdk-lib/aws-emr/README.md new file mode 100644 index 0000000000000..3cbc634b4dccd --- /dev/null +++ b/packages/aws-cdk-lib/aws-emr/README.md @@ -0,0 +1,27 @@ +# Amazon EMR Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as emr from 'aws-cdk-lib/aws-emr'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for EMR construct libraries](https://constructs.dev/search?q=emr) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::EMR resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMR.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::EMR](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMR.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-emr/index.ts b/packages/aws-cdk-lib/aws-emr/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-emr/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-emr/lib/index.ts b/packages/aws-cdk-lib/aws-emr/lib/index.ts new file mode 100644 index 0000000000000..4a50dc091e967 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emr/lib/index.ts @@ -0,0 +1 @@ +export * from './emr.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-emrcontainers/.jsiirc.json b/packages/aws-cdk-lib/aws-emrcontainers/.jsiirc.json new file mode 100644 index 0000000000000..f7494286ba0e0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrcontainers/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.EMRContainers" + }, + "java": { + "package": "software.amazon.awscdk.services.emrcontainers" + }, + "python": { + "module": "aws_cdk.aws_emrcontainers" + } + } +} diff --git a/packages/aws-cdk-lib/aws-emrcontainers/README.md b/packages/aws-cdk-lib/aws-emrcontainers/README.md new file mode 100644 index 0000000000000..ee83a1387e940 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrcontainers/README.md @@ -0,0 +1,27 @@ +# AWS::EMRContainers Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as emrcontainers from 'aws-cdk-lib/aws-emrcontainers'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for EMRContainers construct libraries](https://constructs.dev/search?q=emrcontainers) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::EMRContainers resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRContainers.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::EMRContainers](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRContainers.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-emrcontainers/index.ts b/packages/aws-cdk-lib/aws-emrcontainers/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrcontainers/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-emrcontainers/lib/index.ts b/packages/aws-cdk-lib/aws-emrcontainers/lib/index.ts new file mode 100644 index 0000000000000..7a570f045ab04 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrcontainers/lib/index.ts @@ -0,0 +1 @@ +export * from './emrcontainers.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-emrserverless/.jsiirc.json b/packages/aws-cdk-lib/aws-emrserverless/.jsiirc.json new file mode 100644 index 0000000000000..1edff9140ca33 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrserverless/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.EMRServerless" + }, + "java": { + "package": "software.amazon.awscdk.services.emrserverless" + }, + "python": { + "module": "aws_cdk.aws_emrserverless" + } + } +} diff --git a/packages/aws-cdk-lib/aws-emrserverless/README.md b/packages/aws-cdk-lib/aws-emrserverless/README.md new file mode 100644 index 0000000000000..6c8f4ae3cd3a2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrserverless/README.md @@ -0,0 +1,27 @@ +# AWS::EMRServerless Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as emrserverless from 'aws-cdk-lib/aws-emrserverless'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for EMRServerless construct libraries](https://constructs.dev/search?q=emrserverless) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::EMRServerless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRServerless.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::EMRServerless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_EMRServerless.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-emrserverless/index.ts b/packages/aws-cdk-lib/aws-emrserverless/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrserverless/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-emrserverless/lib/index.ts b/packages/aws-cdk-lib/aws-emrserverless/lib/index.ts new file mode 100644 index 0000000000000..2ae9396f032c3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-emrserverless/lib/index.ts @@ -0,0 +1 @@ +export * from './emrserverless.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-events-targets/.gitignore b/packages/aws-cdk-lib/aws-events-targets/.gitignore new file mode 100644 index 0000000000000..3c0f97d2eb08b --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/.gitignore @@ -0,0 +1 @@ +!build-tools/*.js diff --git a/packages/aws-cdk-lib/aws-events-targets/.jsiirc.json b/packages/aws-cdk-lib/aws-events-targets/.jsiirc.json new file mode 100644 index 0000000000000..6f100181c2055 --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.events.targets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Events.Targets" + }, + "python": { + "module": "aws_cdk.aws_events_targets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-events-targets/README.md b/packages/aws-cdk-lib/aws-events-targets/README.md new file mode 100644 index 0000000000000..966fb0a34f9b6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/README.md @@ -0,0 +1,339 @@ +# Event Targets for Amazon EventBridge + + +This library contains integration classes to send Amazon EventBridge to any +number of supported AWS Services. Instances of these classes should be passed +to the `rule.addTarget()` method. + +Currently supported are: + +* [Start a CodeBuild build](#start-a-codebuild-build) +* [Start a CodePipeline pipeline](#start-a-codepipeline-pipeline) +* Run an ECS task +* [Invoke a Lambda function](#invoke-a-lambda-function) +* [Invoke a API Gateway REST API](#invoke-an-api-gateway-rest-api) +* Publish a message to an SNS topic +* Send a message to an SQS queue +* [Start a StepFunctions state machine](#start-a-stepfunctions-state-machine) +* [Queue a Batch job](#queue-a-batch-job) +* Make an AWS API call +* Put a record to a Kinesis stream +* [Log an event into a LogGroup](#log-an-event-into-a-loggroup) +* Put a record to a Kinesis Data Firehose stream +* [Put an event on an EventBridge bus](#put-an-event-on-an-eventbridge-bus) +* [Send an event to EventBridge API Destination](#invoke-an-api-destination) + +See the README of the `@aws-cdk/aws-events` library for more information on +EventBridge. + +## Event retry policy and using dead-letter queues + +The Codebuild, CodePipeline, Lambda, StepFunctions, LogGroup, SQSQueue, SNSTopic and ECSTask targets support attaching a [dead letter queue and setting retry policies](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html). See the [lambda example](#invoke-a-lambda-function). +Use [escape hatches](https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html) for the other target types. + +## Invoke a Lambda function + +Use the `LambdaFunction` target to invoke a lambda function. + +The code snippet below creates an event rule with a Lambda function as a target +triggered for every events from `aws.ec2` source. You can optionally attach a +[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html). + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const fn = new lambda.Function(this, 'MyFunc', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = handler.toString()`), +}); + +const rule = new events.Rule(this, 'rule', { + eventPattern: { + source: ["aws.ec2"], + }, +}); + +const queue = new sqs.Queue(this, 'Queue'); + +rule.addTarget(new targets.LambdaFunction(fn, { + deadLetterQueue: queue, // Optional: add a dead letter queue + maxEventAge: cdk.Duration.hours(2), // Optional: set the maxEventAge retry policy + retryAttempts: 2, // Optional: set the max number of retry attempts +})); +``` + +## Log an event into a LogGroup + +Use the `LogGroup` target to log your events in a CloudWatch LogGroup. + +For example, the following code snippet creates an event rule with a CloudWatch LogGroup as a target. +Every events sent from the `aws.ec2` source will be sent to the CloudWatch LogGroup. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; + +const logGroup = new logs.LogGroup(this, 'MyLogGroup', { + logGroupName: 'MyLogGroup', +}); + +const rule = new events.Rule(this, 'rule', { + eventPattern: { + source: ["aws.ec2"], + }, +}); + +rule.addTarget(new targets.CloudWatchLogGroup(logGroup)); +``` + +A rule target input can also be specified to modify the event that is sent to the log group. +Unlike other event targets, CloudWatchLogs requires a specific input template format. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; +declare const logGroup: logs.LogGroup; +declare const rule: events.Rule; + +rule.addTarget(new targets.CloudWatchLogGroup(logGroup, { + logEvent: targets.LogGroupTargetInput({ + timestamp: events.EventField.from('$.time'), + message: events.EventField.from('$.detail-type'), + }), +})); +``` + +If you want to use static values to overwrite the `message` make sure that you provide a `string` +value. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; +declare const logGroup: logs.LogGroup; +declare const rule: events.Rule; + +rule.addTarget(new targets.CloudWatchLogGroup(logGroup, { + logEvent: targets.LogGroupTargetInput({ + message: JSON.stringify({ + CustomField: 'CustomValue', + }), + }), +})); +``` + +## Start a CodeBuild build + +Use the `CodeBuildProject` target to trigger a CodeBuild project. + +The code snippet below creates a CodeCommit repository that triggers a CodeBuild project +on commit to the master branch. You can optionally attach a +[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html). + +```ts +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; + +const repo = new codecommit.Repository(this, 'MyRepo', { + repositoryName: 'aws-cdk-codebuild-events', +}); + +const project = new codebuild.Project(this, 'MyProject', { + source: codebuild.Source.codeCommit({ repository: repo }), +}); + +const deadLetterQueue = new sqs.Queue(this, 'DeadLetterQueue'); + +// trigger a build when a commit is pushed to the repo +const onCommitRule = repo.onCommit('OnCommit', { + target: new targets.CodeBuildProject(project, { + deadLetterQueue: deadLetterQueue, + }), + branches: ['master'], +}); +``` + +## Start a CodePipeline pipeline + +Use the `CodePipeline` target to trigger a CodePipeline pipeline. + +The code snippet below creates a CodePipeline pipeline that is triggered every hour + +```ts +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; + +const pipeline = new codepipeline.Pipeline(this, 'Pipeline'); + +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.expression('rate(1 hour)'), +}); + +rule.addTarget(new targets.CodePipeline(pipeline)); +``` + +## Start a StepFunctions state machine + +Use the `SfnStateMachine` target to trigger a State Machine. + +The code snippet below creates a Simple StateMachine that is triggered every minute with a +dummy object as input. +You can optionally attach a +[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html) +to the target. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; + +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); + +const dlq = new sqs.Queue(this, 'DeadLetterQueue'); + +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('events.amazonaws.com'), +}); +const stateMachine = new sfn.StateMachine(this, 'SM', { + definition: new sfn.Wait(this, 'Hello', { time: sfn.WaitTime.duration(cdk.Duration.seconds(10)) }) +}); + +rule.addTarget(new targets.SfnStateMachine(stateMachine, { + input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }), + deadLetterQueue: dlq, + role: role +})); +``` + +## Queue a Batch job + +Use the `BatchJob` target to queue a Batch job. + +The code snippet below creates a Simple JobQueue that is triggered every hour with a +dummy object as input. +You can optionally attach a +[dead letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html) +to the target. + +```ts +import * as batch from 'aws-cdk-lib/aws-batch'; +import { ContainerImage } from 'aws-cdk-lib/aws-ecs'; + +const jobQueue = new batch.JobQueue(this, 'MyQueue', { + computeEnvironments: [ + { + computeEnvironment: new batch.ComputeEnvironment(this, 'ComputeEnvironment', { + managed: false, + }), + order: 1, + }, + ], +}); + +const jobDefinition = new batch.JobDefinition(this, 'MyJob', { + container: { + image: ContainerImage.fromRegistry('test-repo'), + }, +}); + +const queue = new sqs.Queue(this, 'Queue'); + +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.hours(1)), +}); + +rule.addTarget(new targets.BatchJob( + jobQueue.jobQueueArn, + jobQueue, + jobDefinition.jobDefinitionArn, + jobDefinition, { + deadLetterQueue: queue, + event: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }), + retryAttempts: 2, + maxEventAge: cdk.Duration.hours(2), + }, +)); +``` + +## Invoke an API Gateway REST API + +Use the `ApiGateway` target to trigger a REST API. + +The code snippet below creates a Api Gateway REST API that is invoked every hour. + +```ts +import * as api from 'aws-cdk-lib/aws-apigateway'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), +}); + +const fn = new lambda.Function( this, 'MyFunc', { + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline( 'exports.handler = e => {}' ), +} ); + +const restApi = new api.LambdaRestApi( this, 'MyRestAPI', { handler: fn } ); + +const dlq = new sqs.Queue(this, 'DeadLetterQueue'); + +rule.addTarget( + new targets.ApiGateway( restApi, { + path: '/*/test', + method: 'GET', + stage: 'prod', + pathParameterValues: ['path-value'], + headerParameters: { + Header1: 'header1', + }, + queryStringParameters: { + QueryParam1: 'query-param-1', + }, + deadLetterQueue: dlq + } ), +) +``` + +## Invoke an API Destination + +Use the `targets.ApiDestination` target to trigger an external API. You need to +create an `events.Connection` and `events.ApiDestination` as well. + +The code snippet below creates an external destination that is invoked every hour. + +```ts +const connection = new events.Connection(this, 'Connection', { + authorization: events.Authorization.apiKey('x-api-key', SecretValue.secretsManager('ApiSecretName')), + description: 'Connection with API Key x-api-key', +}); + +const destination = new events.ApiDestination(this, 'Destination', { + connection, + endpoint: 'https://example.com', + description: 'Calling example.com with API key x-api-key', +}); + +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.rate(cdk.Duration.minutes(1)), + targets: [new targets.ApiDestination(destination)], +}); +``` + +## Put an event on an EventBridge bus + +Use the `EventBus` target to route event to a different EventBus. + +The code snippet below creates the scheduled event rule that route events to an imported event bus. + +```ts +const rule = new events.Rule(this, 'Rule', { + schedule: events.Schedule.expression('rate(1 minute)'), +}); + +rule.addTarget(new targets.EventBus( + events.EventBus.fromEventBusArn( + this, + 'External', + `arn:aws:events:eu-west-1:999999999999:event-bus/test-bus`, + ), +)); +``` diff --git a/packages/@aws-cdk/aws-events-targets/build-tools/gen.js b/packages/aws-cdk-lib/aws-events-targets/build-tools/gen.js similarity index 100% rename from packages/@aws-cdk/aws-events-targets/build-tools/gen.js rename to packages/aws-cdk-lib/aws-events-targets/build-tools/gen.js diff --git a/packages/aws-cdk-lib/aws-events-targets/index.ts b/packages/aws-cdk-lib/aws-events-targets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/api-destination.ts b/packages/aws-cdk-lib/aws-events-targets/lib/api-destination.ts new file mode 100644 index 0000000000000..538cdaaa356af --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/lib/api-destination.ts @@ -0,0 +1,101 @@ +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import { addToDeadLetterQueueResourcePolicy, bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; + +/** + * Customize the EventBridge Api Destinations Target + */ +export interface ApiDestinationProps extends TargetBaseProps { + /** + * The event to send + * + * @default - the entire EventBridge event + */ + readonly event?: events.RuleTargetInput; + + /** + * The role to assume before invoking the target + * + * @default - a new role will be created + */ + readonly eventRole?: iam.IRole; + + /** + * Additional headers sent to the API Destination + * + * These are merged with headers specified on the Connection, with + * the headers on the Connection taking precedence. + * + * You can only specify secret values on the Connection. + * + * @default - none + */ + readonly headerParameters?: Record; + + /** + * Path parameters to insert in place of path wildcards (`*`). + * + * If the API destination has a wilcard in the path, these path parts + * will be inserted in that place. + * + * @default - none + */ + readonly pathParameterValues?: string[] + + /** + * Additional query string parameters sent to the API Destination + * + * These are merged with headers specified on the Connection, with + * the headers on the Connection taking precedence. + * + * You can only specify secret values on the Connection. + * + * @default - none + */ + readonly queryStringParameters?: Record; +} + +/** + * Use an API Destination rule target. + */ +export class ApiDestination implements events.IRuleTarget { + constructor( + private readonly apiDestination: events.IApiDestination, + private readonly props: ApiDestinationProps = {}, + ) { } + + /** + * Returns a RuleTarget that can be used to trigger API destinations + * from an EventBridge event. + */ + public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { + const httpParameters: events.CfnRule.HttpParametersProperty | undefined = + this.props.headerParameters ?? + this.props.pathParameterValues ?? + this.props.queryStringParameters + ? { + headerParameters: this.props.headerParameters, + pathParameterValues: this.props.pathParameterValues, + queryStringParameters: this.props.queryStringParameters, + } : undefined; + + if (this.props?.deadLetterQueue) { + addToDeadLetterQueueResourcePolicy(_rule, this.props.deadLetterQueue); + } + + const role = this.props?.eventRole ?? singletonEventRole(this.apiDestination); + role.addToPrincipalPolicy(new iam.PolicyStatement({ + resources: [this.apiDestination.apiDestinationArn], + actions: ['events:InvokeApiDestination'], + })); + + return { + ...(this.props ? bindBaseTargetConfig(this.props) : {}), + arn: this.apiDestination.apiDestinationArn, + role, + input: this.props.event, + targetResource: this.apiDestination, + httpParameters, + }; + } +} diff --git a/packages/@aws-cdk/aws-events-targets/lib/api-gateway.ts b/packages/aws-cdk-lib/aws-events-targets/lib/api-gateway.ts similarity index 96% rename from packages/@aws-cdk/aws-events-targets/lib/api-gateway.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/api-gateway.ts index 04f073ad82fd6..b6e364d2dcf80 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/api-gateway.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/api-gateway.ts @@ -1,6 +1,6 @@ -import * as api from '@aws-cdk/aws-apigateway'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; +import * as api from '../../aws-apigateway'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; import { addToDeadLetterQueueResourcePolicy, bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; /** diff --git a/packages/@aws-cdk/aws-events-targets/lib/aws-api-handler/index.ts b/packages/aws-cdk-lib/aws-events-targets/lib/aws-api-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-events-targets/lib/aws-api-handler/index.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/aws-api-handler/index.ts diff --git a/packages/@aws-cdk/aws-events-targets/lib/aws-api.ts b/packages/aws-cdk-lib/aws-events-targets/lib/aws-api.ts similarity index 95% rename from packages/@aws-cdk/aws-events-targets/lib/aws-api.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/aws-api.ts index f2d1f40949400..74c09c0b9c94f 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/aws-api.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/aws-api.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Annotations } from '@aws-cdk/core'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import { Annotations } from '../../core'; import { metadata } from './sdk-api-metadata.generated'; import { addLambdaPermission } from './util'; diff --git a/packages/@aws-cdk/aws-events-targets/lib/batch.ts b/packages/aws-cdk-lib/aws-events-targets/lib/batch.ts similarity index 96% rename from packages/@aws-cdk/aws-events-targets/lib/batch.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/batch.ts index d5efdf1aca620..9fa180c146b43 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/batch.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/batch.ts @@ -1,6 +1,6 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { Names } from '@aws-cdk/core'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import { Names } from '../../core'; import { IConstruct } from 'constructs'; import { addToDeadLetterQueueResourcePolicy, bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; diff --git a/packages/@aws-cdk/aws-events-targets/lib/codebuild.ts b/packages/aws-cdk-lib/aws-events-targets/lib/codebuild.ts similarity index 91% rename from packages/@aws-cdk/aws-events-targets/lib/codebuild.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/codebuild.ts index 14f9dd4c0c626..9b58fce51e3ac 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/codebuild.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/codebuild.ts @@ -1,6 +1,6 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; +import * as codebuild from '../../aws-codebuild'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; import { addToDeadLetterQueueResourcePolicy, bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; /** diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/codepipeline.ts b/packages/aws-cdk-lib/aws-events-targets/lib/codepipeline.ts new file mode 100644 index 0000000000000..2c4c2cf7db95a --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/lib/codepipeline.ts @@ -0,0 +1,43 @@ +import * as codepipeline from '../../aws-codepipeline'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import { bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; + +/** + * Customization options when creating a `CodePipeline` event target. + */ +export interface CodePipelineTargetOptions extends TargetBaseProps { + /** + * The role to assume before invoking the target + * (i.e., the pipeline) when the given rule is triggered. + * + * @default - a new role will be created + */ + readonly eventRole?: iam.IRole; +} + +/** + * Allows the pipeline to be used as an EventBridge rule target. + */ +export class CodePipeline implements events.IRuleTarget { + constructor( + private readonly pipeline: codepipeline.IPipeline, + private readonly options: CodePipelineTargetOptions = {}) { + } + + public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { + const role = this.options.eventRole || singletonEventRole(this.pipeline); + role.addToPrincipalPolicy(new iam.PolicyStatement({ + resources: [this.pipeline.pipelineArn], + actions: ['codepipeline:StartPipelineExecution'], + })); + + return { + ...bindBaseTargetConfig(this.options), + id: '', + arn: this.pipeline.pipelineArn, + role, + targetResource: this.pipeline, + }; + } +} diff --git a/packages/@aws-cdk/aws-events-targets/lib/ecs-task-properties.ts b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task-properties.ts similarity index 100% rename from packages/@aws-cdk/aws-events-targets/lib/ecs-task-properties.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/ecs-task-properties.ts diff --git a/packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts similarity index 97% rename from packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts index c4736c0acb338..ff5d53bd752a5 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/ecs-task.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as ecs from '../../aws-ecs'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { ContainerOverride } from './ecs-task-properties'; import { addToDeadLetterQueueResourcePolicy, bindBaseTargetConfig, singletonEventRole, TargetBaseProps } from './util'; diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/event-bus.ts b/packages/aws-cdk-lib/aws-events-targets/lib/event-bus.ts new file mode 100644 index 0000000000000..034877bd1d896 --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/lib/event-bus.ts @@ -0,0 +1,59 @@ +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as sqs from '../../aws-sqs'; +import { singletonEventRole, addToDeadLetterQueueResourcePolicy } from './util'; + +/** + * Configuration properties of an Event Bus event + * + * Cannot extend TargetBaseProps. Retry policy is not supported for Event bus targets. + */ +export interface EventBusProps { + /** + * Role to be used to publish the event + * + * @default a new role is created. + */ + readonly role?: iam.IRole; + + /** + * The SQS queue to be used as deadLetterQueue. + * Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). + * + * The events not successfully delivered are automatically retried for a specified period of time, + * depending on the retry policy of the target. + * If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue. + * + * @default - no dead-letter queue + */ + readonly deadLetterQueue?: sqs.IQueue; +} + +/** + * Notify an existing Event Bus of an event + */ +export class EventBus implements events.IRuleTarget { + constructor(private readonly eventBus: events.IEventBus, private readonly props: EventBusProps = {}) { } + + bind(rule: events.IRule, _id?: string): events.RuleTargetConfig { + const role = this.props.role ?? singletonEventRole(rule); + role.addToPrincipalPolicy(this.putEventStatement()); + + if (this.props.deadLetterQueue) { + addToDeadLetterQueueResourcePolicy(rule, this.props.deadLetterQueue); + } + + return { + arn: this.eventBus.eventBusArn, + deadLetterConfig: this.props.deadLetterQueue ? { arn: this.props.deadLetterQueue?.queueArn } : undefined, + role, + }; + } + + private putEventStatement() { + return new iam.PolicyStatement({ + actions: ['events:PutEvents'], + resources: [this.eventBus.eventBusArn], + }); + } +} diff --git a/packages/@aws-cdk/aws-events-targets/lib/index.ts b/packages/aws-cdk-lib/aws-events-targets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-events-targets/lib/index.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/index.ts diff --git a/packages/@aws-cdk/aws-events-targets/lib/kinesis-firehose-stream.ts b/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-firehose-stream.ts similarity index 89% rename from packages/@aws-cdk/aws-events-targets/lib/kinesis-firehose-stream.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/kinesis-firehose-stream.ts index 2a454f5164d77..71ddb6ae37f0f 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/kinesis-firehose-stream.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-firehose-stream.ts @@ -1,6 +1,6 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as firehose from '@aws-cdk/aws-kinesisfirehose'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as firehose from '../../aws-kinesisfirehose'; import { singletonEventRole } from './util'; /** diff --git a/packages/@aws-cdk/aws-events-targets/lib/kinesis-stream.ts b/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts similarity index 92% rename from packages/@aws-cdk/aws-events-targets/lib/kinesis-stream.ts rename to packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts index 9114561a6ca97..fcd184044ce72 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/kinesis-stream.ts +++ b/packages/aws-cdk-lib/aws-events-targets/lib/kinesis-stream.ts @@ -1,6 +1,6 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kinesis from '@aws-cdk/aws-kinesis'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kinesis from '../../aws-kinesis'; import { singletonEventRole } from './util'; /** diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/lambda.ts b/packages/aws-cdk-lib/aws-events-targets/lib/lambda.ts new file mode 100644 index 0000000000000..8d1de3f3e29ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/lib/lambda.ts @@ -0,0 +1,46 @@ +import * as events from '../../aws-events'; +import * as lambda from '../../aws-lambda'; +import { addLambdaPermission, addToDeadLetterQueueResourcePolicy, TargetBaseProps, bindBaseTargetConfig } from './util'; + +/** + * Customize the Lambda Event Target + */ +export interface LambdaFunctionProps extends TargetBaseProps { + /** + * The event to send to the Lambda + * + * This will be the payload sent to the Lambda Function. + * + * @default the entire EventBridge event + */ + readonly event?: events.RuleTargetInput; +} + +/** + * Use an AWS Lambda function as an event rule target. + */ +export class LambdaFunction implements events.IRuleTarget { + constructor(private readonly handler: lambda.IFunction, private readonly props: LambdaFunctionProps = {}) { + + } + + /** + * Returns a RuleTarget that can be used to trigger this Lambda as a + * result from an EventBridge event. + */ + public bind(rule: events.IRule, _id?: string): events.RuleTargetConfig { + // Allow handler to be called from rule + addLambdaPermission(rule, this.handler); + + if (this.props.deadLetterQueue) { + addToDeadLetterQueueResourcePolicy(rule, this.props.deadLetterQueue); + } + + return { + ...bindBaseTargetConfig(this.props), + arn: this.handler.functionArn, + input: this.props.event, + targetResource: this.handler, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/log-group-resource-policy.ts b/packages/aws-cdk-lib/aws-events-targets/lib/log-group-resource-policy.ts new file mode 100644 index 0000000000000..bf923f4fb29aa --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/lib/log-group-resource-policy.ts @@ -0,0 +1,57 @@ +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as cr from '../../custom-resources'; +import { Construct } from 'constructs'; + +/** + * Properties to configure a log group resource policy + */ +export interface LogGroupResourcePolicyProps { + /** + * The log group resource policy name + */ + readonly policyName?: string; + /** + * The policy statements for the log group resource logs + */ + readonly policyStatements: [iam.PolicyStatement]; +} + +/** + * Creates LogGroup resource policies. + */ +export class LogGroupResourcePolicy extends cr.AwsCustomResource { + constructor(scope: Construct, id: string, props: LogGroupResourcePolicyProps) { + const policyDocument = new iam.PolicyDocument({ + statements: props.policyStatements, + }); + + let policyName = props.policyName || cdk.Lazy.string({ produce: () => cdk.Names.uniqueId(this) }); + + super(scope, id, { + resourceType: 'Custom::CloudwatchLogResourcePolicy', + onUpdate: { + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: policyName, + policyDocument: JSON.stringify(policyDocument), + }, + physicalResourceId: cr.PhysicalResourceId.of(id), + }, + onDelete: { + service: 'CloudWatchLogs', + action: 'deleteResourcePolicy', + parameters: { + policyName: policyName, + }, + ignoreErrorCodesMatching: '400', + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + // putResourcePolicy and deleteResourcePolicy don't support resource-level permissions. We must specify all resources ("*"). + // https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatchlogs.html + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), + }); + } +} diff --git a/packages/aws-cdk-lib/aws-events-targets/lib/log-group.ts b/packages/aws-cdk-lib/aws-events-targets/lib/log-group.ts new file mode 100644 index 0000000000000..b66b5c597a358 --- /dev/null +++ b/packages/aws-cdk-lib/aws-events-targets/lib/log-group.ts @@ -0,0 +1,165 @@ +import * as events from '../../aws-events'; +import { RuleTargetInputProperties, RuleTargetInput, EventField, IRule } from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; +import { ArnFormat, Stack } from '../../core'; +import { LogGroupResourcePolicy } from './log-group-resource-policy'; +import { TargetBaseProps, bindBaseTargetConfig } from './util'; + +/** + * Options used when creating a target input template + */ +export interface LogGroupTargetInputOptions { + /** + * The timestamp that will appear in the CloudWatch Logs record + * + * @default EventField.time + */ + readonly timestamp?: any; + + /** + * The value provided here will be used in the Log "message" field. + * + * This field must be a string. If an object is passed (e.g. JSON data) + * it will not throw an error, but the message that makes it to + * CloudWatch logs will be incorrect. This is a likely scenario if + * doing something like: EventField.fromPath('$.detail') since in most cases + * the `detail` field contains JSON data. + * + * @default EventField.detailType + */ + readonly message?: any; +} + +/** + * The input to send to the CloudWatch LogGroup target + */ +export abstract class LogGroupTargetInput { + + /** + * Pass a JSON object to the the log group event target + * + * May contain strings returned by `EventField.from()` to substitute in parts of the + * matched event. + */ + public static fromObject(options?: LogGroupTargetInputOptions): RuleTargetInput { + return RuleTargetInput.fromObject({ + timestamp: options?.timestamp ?? EventField.time, + message: options?.message ?? EventField.detailType, + }); + }; + + /** + * Return the input properties for this input object + */ + public abstract bind(rule: IRule): RuleTargetInputProperties; +} + +/** + * Customize the CloudWatch LogGroup Event Target + */ +export interface LogGroupProps extends TargetBaseProps { + /** + * The event to send to the CloudWatch LogGroup + * + * This will be the event logged into the CloudWatch LogGroup + * + * @default - the entire EventBridge event + * @deprecated use logEvent instead + */ + readonly event?: events.RuleTargetInput; + + /** + * The event to send to the CloudWatch LogGroup + * + * This will be the event logged into the CloudWatch LogGroup + * + * @default - the entire EventBridge event + */ + readonly logEvent?: LogGroupTargetInput; +} + +/** + * Use an AWS CloudWatch LogGroup as an event rule target. + */ +export class CloudWatchLogGroup implements events.IRuleTarget { + private target?: RuleTargetInputProperties; + constructor(private readonly logGroup: logs.ILogGroup, private readonly props: LogGroupProps = {}) {} + + /** + * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup + */ + public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig { + // Use a custom resource to set the log group resource policy since it is not supported by CDK and cfn. + const resourcePolicyId = `EventsLogGroupPolicy${cdk.Names.nodeUniqueId(_rule.node)}`; + + const logGroupStack = cdk.Stack.of(this.logGroup); + + if (this.props.event && this.props.logEvent) { + throw new Error('Only one of "event" or "logEvent" can be specified'); + } + + this.target = this.props.event?.bind(_rule); + if (this.target?.inputPath || this.target?.input) { + throw new Error('CloudWatchLogGroup targets does not support input or inputPath'); + } + + _rule.node.addValidation({ validate: () => this.validateInputTemplate() }); + + if (!this.logGroup.node.tryFindChild(resourcePolicyId)) { + new LogGroupResourcePolicy(logGroupStack, resourcePolicyId, { + policyStatements: [new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], + resources: [this.logGroup.logGroupArn], + principals: [new iam.ServicePrincipal('events.amazonaws.com')], + })], + }); + } + + return { + ...bindBaseTargetConfig(this.props), + arn: logGroupStack.formatArn({ + service: 'logs', + resource: 'log-group', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + resourceName: this.logGroup.logGroupName, + }), + input: this.props.event ?? this.props.logEvent, + targetResource: this.logGroup, + }; + } + + /** + * Validate that the target event input template has the correct format. + * The CloudWatchLogs target only supports a template with the format of: + * {"timestamp": (struct: A): A | undefined { + const allUndefined = Object.values(struct).every(val => val === undefined); + return allUndefined ? undefined : struct; +} + +/** + * Aspect for upgrading function versions when the feature flag + * provided feature flag present. This can be necessary when the feature flag + * changes the function hash, as such changes must be associated with a new + * version. This aspect will change the function description in these cases, + * which "validates" the new function hash. + */ +export class FunctionVersionUpgrade implements IAspect { + constructor(private readonly featureFlag: string, private readonly enabled=true) {} + + public visit(node: IConstruct): void { + if (node instanceof Function && + this.enabled === FeatureFlags.of(node).isEnabled(this.featureFlag)) { + const cfnFunction = node.node.defaultChild as CfnFunction; + const desc = cfnFunction.description ? `${cfnFunction.description} ` : ''; + cfnFunction.addPropertyOverride('Description', `${desc}version-hash:${calculateFunctionHash(node)}`); + } + }; +} diff --git a/packages/@aws-cdk/aws-lambda/lib/handler.ts b/packages/aws-cdk-lib/aws-lambda/lib/handler.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/lib/handler.ts rename to packages/aws-cdk-lib/aws-lambda/lib/handler.ts diff --git a/packages/@aws-cdk/aws-lambda/lib/image-function.ts b/packages/aws-cdk-lib/aws-lambda/lib/image-function.ts similarity index 96% rename from packages/@aws-cdk/aws-lambda/lib/image-function.ts rename to packages/aws-cdk-lib/aws-lambda/lib/image-function.ts index 5000bae85e2c2..237bdc535f0ea 100644 --- a/packages/@aws-cdk/aws-lambda/lib/image-function.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/image-function.ts @@ -1,5 +1,5 @@ -import * as ecr from '@aws-cdk/aws-ecr'; -import { Platform } from '@aws-cdk/aws-ecr-assets'; +import * as ecr from '../../aws-ecr'; +import { Platform } from '../../aws-ecr-assets'; import { Construct } from 'constructs'; import { Architecture } from './architecture'; import { AssetImageCode, AssetImageCodeProps, EcrImageCode, EcrImageCodeProps, Code } from './code'; diff --git a/packages/@aws-cdk/aws-lambda/lib/index.ts b/packages/aws-cdk-lib/aws-lambda/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/lib/index.ts rename to packages/aws-cdk-lib/aws-lambda/lib/index.ts diff --git a/packages/@aws-cdk/aws-lambda/lib/lambda-insights.ts b/packages/aws-cdk-lib/aws-lambda/lib/lambda-insights.ts similarity index 97% rename from packages/@aws-cdk/aws-lambda/lib/lambda-insights.ts rename to packages/aws-cdk-lib/aws-lambda/lib/lambda-insights.ts index 4e0398049fa05..20e1240eec704 100644 --- a/packages/@aws-cdk/aws-lambda/lib/lambda-insights.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/lambda-insights.ts @@ -1,5 +1,5 @@ -import { Lazy, Stack, Token } from '@aws-cdk/core'; -import { FactName, RegionInfo } from '@aws-cdk/region-info'; +import { Lazy, Stack, Token } from '../../core'; +import { FactName, RegionInfo } from '../../region-info'; import { Construct, IConstruct } from 'constructs'; import { Architecture } from './architecture'; import { IFunction } from './function-base'; diff --git a/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts b/packages/aws-cdk-lib/aws-lambda/lib/lambda-version.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/lib/lambda-version.ts rename to packages/aws-cdk-lib/aws-lambda/lib/lambda-version.ts index 1249c487466dd..20dfc00021752 100644 --- a/packages/@aws-cdk/aws-lambda/lib/lambda-version.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/lambda-version.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import { Fn, Lazy, RemovalPolicy } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { Fn, Lazy, RemovalPolicy } from '../../core'; import { Construct } from 'constructs'; import { Alias, AliasOptions } from './alias'; import { Architecture } from './architecture'; diff --git a/packages/@aws-cdk/aws-lambda/lib/layers.ts b/packages/aws-cdk-lib/aws-lambda/lib/layers.ts similarity index 99% rename from packages/@aws-cdk/aws-lambda/lib/layers.ts rename to packages/aws-cdk-lib/aws-lambda/lib/layers.ts index 83c548522600f..07d860f377767 100644 --- a/packages/@aws-cdk/aws-lambda/lib/layers.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/layers.ts @@ -1,4 +1,4 @@ -import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { IResource, RemovalPolicy, Resource } from '../../core'; import { Construct } from 'constructs'; import { Architecture } from './architecture'; import { Code } from './code'; diff --git a/packages/aws-cdk-lib/aws-lambda/lib/log-retention.ts b/packages/aws-cdk-lib/aws-lambda/lib/log-retention.ts new file mode 100644 index 0000000000000..8652a04abb718 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/lib/log-retention.ts @@ -0,0 +1,29 @@ +import * as logs from '../../aws-logs'; +import { Construct } from 'constructs'; + +/** + * Retry options for all AWS API calls. + */ +export interface LogRetentionRetryOptions extends logs.LogRetentionRetryOptions { +} + +/** + * Construction properties for a LogRetention. + * + * @deprecated use `LogRetentionProps` from '@aws-cdk/aws-logs' instead + */ +export interface LogRetentionProps extends logs.LogRetentionProps { +} + +/** + * Creates a custom resource to control the retention policy of a CloudWatch Logs + * log group. The log group is created if it doesn't already exist. The policy + * is removed when `retentionDays` is `undefined` or equal to `Infinity`. + * + * @deprecated use `LogRetention` from '@aws-cdk/aws-logs' instead + */ +export class LogRetention extends logs.LogRetention { + constructor(scope: Construct, id: string, props: LogRetentionProps) { + super(scope, id, { ...props }); + } +} diff --git a/packages/@aws-cdk/aws-lambda/lib/permission.ts b/packages/aws-cdk-lib/aws-lambda/lib/permission.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/lib/permission.ts rename to packages/aws-cdk-lib/aws-lambda/lib/permission.ts index 8f367dd63d312..2616cd14569e3 100644 --- a/packages/@aws-cdk/aws-lambda/lib/permission.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/permission.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import { Construct } from 'constructs'; import { FunctionUrlAuthType } from './function-url'; diff --git a/packages/@aws-cdk/aws-lambda/lib/private/scalable-function-attribute.ts b/packages/aws-cdk-lib/aws-lambda/lib/private/scalable-function-attribute.ts similarity index 93% rename from packages/@aws-cdk/aws-lambda/lib/private/scalable-function-attribute.ts rename to packages/aws-cdk-lib/aws-lambda/lib/private/scalable-function-attribute.ts index 8ac9400636eef..199669a9db622 100644 --- a/packages/@aws-cdk/aws-lambda/lib/private/scalable-function-attribute.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/private/scalable-function-attribute.ts @@ -1,5 +1,5 @@ -import * as appscaling from '@aws-cdk/aws-applicationautoscaling'; -import { Token } from '@aws-cdk/core'; +import * as appscaling from '../../../aws-applicationautoscaling'; +import { Token } from '../../../core'; import { Construct } from 'constructs'; import { IScalableFunctionAttribute, UtilizationScalingOptions } from '../scalable-attribute-api'; diff --git a/packages/@aws-cdk/aws-lambda/lib/runtime-management.ts b/packages/aws-cdk-lib/aws-lambda/lib/runtime-management.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/lib/runtime-management.ts rename to packages/aws-cdk-lib/aws-lambda/lib/runtime-management.ts diff --git a/packages/@aws-cdk/aws-lambda/lib/runtime.ts b/packages/aws-cdk-lib/aws-lambda/lib/runtime.ts similarity index 99% rename from packages/@aws-cdk/aws-lambda/lib/runtime.ts rename to packages/aws-cdk-lib/aws-lambda/lib/runtime.ts index 891c02c9c21b6..3336e32f3debe 100644 --- a/packages/@aws-cdk/aws-lambda/lib/runtime.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/runtime.ts @@ -1,4 +1,4 @@ -import { BundlingDockerImage, DockerImage } from '@aws-cdk/core'; +import { BundlingDockerImage, DockerImage } from '../../core'; export interface LambdaRuntimeProps { /** diff --git a/packages/aws-cdk-lib/aws-lambda/lib/scalable-attribute-api.ts b/packages/aws-cdk-lib/aws-lambda/lib/scalable-attribute-api.ts new file mode 100644 index 0000000000000..eab5ed845fac1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/lib/scalable-attribute-api.ts @@ -0,0 +1,45 @@ +import * as appscaling from '../../aws-applicationautoscaling'; +import { IConstruct } from 'constructs'; + +/** + * Interface for scalable attributes + */ +export interface IScalableFunctionAttribute extends IConstruct { + /** + * Scale out or in to keep utilization at a given level. The utilization is tracked by the + * LambdaProvisionedConcurrencyUtilization metric, emitted by lambda. See: + * https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency + */ + scaleOnUtilization(options: UtilizationScalingOptions): void; + /** + * Scale out or in based on schedule. + */ + scaleOnSchedule(id: string, actions: appscaling.ScalingSchedule): void; +} + +/** + * Options for enabling Lambda utilization tracking + */ +export interface UtilizationScalingOptions extends appscaling.BaseTargetTrackingProps { + /** + * Utilization target for the attribute. For example, .5 indicates that 50 percent of allocated provisioned concurrency is in use. + */ + readonly utilizationTarget: number; +} + +/** + * Properties for enabling Lambda autoscaling + */ +export interface AutoScalingOptions { + /** + * Minimum capacity to scale to + * + * @default 1 + */ + readonly minCapacity?: number; + + /** + * Maximum capacity to scale to + */ + readonly maxCapacity: number; +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts b/packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts similarity index 97% rename from packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts rename to packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts index ffe9fd558785c..a0c79b39c727c 100644 --- a/packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts +++ b/packages/aws-cdk-lib/aws-lambda/lib/singleton-lambda.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; import { Construct, IConstruct, IDependable, Node } from 'constructs'; import { Architecture } from './architecture'; import { Function as LambdaFunction, FunctionProps, EnvironmentOptions } from './function'; diff --git a/packages/@aws-cdk/aws-lambda/lib/util.ts b/packages/aws-cdk-lib/aws-lambda/lib/util.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/lib/util.ts rename to packages/aws-cdk-lib/aws-lambda/lib/util.ts diff --git a/packages/@aws-cdk/aws-lambda/test/adot.test.ts b/packages/aws-cdk-lib/aws-lambda/test/adot.test.ts similarity index 95% rename from packages/@aws-cdk/aws-lambda/test/adot.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/adot.test.ts index 93ff30eb9cf49..6f73bbc26f8df 100644 --- a/packages/@aws-cdk/aws-lambda/test/adot.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/adot.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; import * as lambda from '../lib'; describe('ADOT Lambda Layer', () => { diff --git a/packages/aws-cdk-lib/aws-lambda/test/alias.test.ts b/packages/aws-cdk-lib/aws-lambda/test/alias.test.ts new file mode 100644 index 0000000000000..c638af75d3162 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/alias.test.ts @@ -0,0 +1,660 @@ +import { Annotations, Match, Template } from '../../assertions'; +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cloudwatch from '../../aws-cloudwatch'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { Lazy, Stack } from '../../core'; +import * as lambda from '../lib'; + +describe('alias', () => { + testDeprecated('version and aliases', () => { + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.addVersion('1'); + + new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Version', { + FunctionName: { Ref: 'MyLambdaCCE802FB' }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + FunctionName: { Ref: 'MyLambdaCCE802FB' }, + FunctionVersion: stack.resolve(version.version), + Name: 'prod', + }); + }); + + test('can create an alias to $LATEST', () => { + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + new lambda.Alias(stack, 'Alias', { + aliasName: 'latest', + version: fn.latestVersion, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + FunctionName: { Ref: 'MyLambdaCCE802FB' }, + FunctionVersion: '$LATEST', + Name: 'latest', + }); + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Version', 0); + }); + + testDeprecated('can use newVersion to create a new Version', () => { + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.addVersion('NewVersion'); + + new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Version', { + FunctionName: { Ref: 'MyLambdaCCE802FB' }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + FunctionName: { Ref: 'MyLambdaCCE802FB' }, + Name: 'prod', + }); + }); + + testDeprecated('can add additional versions to alias', () => { + const stack = new Stack(); + + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version1 = fn.addVersion('1'); + const version2 = fn.addVersion('2'); + + new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: version1, + additionalVersions: [{ version: version2, weight: 0.1 }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + FunctionVersion: stack.resolve(version1.version), + RoutingConfig: { + AdditionalVersionWeights: [ + { + FunctionVersion: stack.resolve(version2.version), + FunctionWeight: 0.1, + }, + ], + }, + }); + }); + + testDeprecated('version and aliases with provisioned execution', () => { + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const pce = 5; + const version = fn.addVersion('1', undefined, 'testing', pce); + + new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version, + provisionedConcurrentExecutions: pce, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Version', { + ProvisionedConcurrencyConfig: { + ProvisionedConcurrentExecutions: 5, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + FunctionVersion: stack.resolve(version.version), + Name: 'prod', + ProvisionedConcurrencyConfig: { + ProvisionedConcurrentExecutions: 5, + }, + }); + }); + + test('sanity checks on version weights', () => { + const stack = new Stack(); + + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.currentVersion; + + // WHEN: Individual weight too high + expect(() => { + new lambda.Alias(stack, 'Alias1', { + aliasName: 'prod', + version, + additionalVersions: [{ version, weight: 5 }], + }); + }).toThrow(); + + // WHEN: Sum too high + expect(() => { + new lambda.Alias(stack, 'Alias2', { + aliasName: 'prod', + version, + additionalVersions: [{ version, weight: 0.5 }, { version, weight: 0.6 }], + }); + }).toThrow(); + }); + + test('metric adds Resource: aliasArn to dimensions', () => { + const stack = new Stack(); + + // GIVEN + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.currentVersion; + const alias = new lambda.Alias(stack, 'Alias', { aliasName: 'prod', version }); + + // WHEN + new cloudwatch.Alarm(stack, 'Alarm', { + metric: alias.metric('Test'), + alarmName: 'Test', + threshold: 1, + evaluationPeriods: 1, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', { + Dimensions: [{ + Name: 'FunctionName', + Value: { + Ref: 'MyLambdaCCE802FB', + }, + }, { + Name: 'Resource', + Value: { + 'Fn::Join': [ + '', + [ + { Ref: 'MyLambdaCCE802FB' }, + ':prod', + ], + ], + }, + }], + }); + }); + + testDeprecated('sanity checks provisionedConcurrentExecutions', () => { + const stack = new Stack(); + const pce = -1; + + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN: Alias provisionedConcurrencyConfig less than 0 + expect(() => { + new lambda.Alias(stack, 'Alias1', { + aliasName: 'prod', + version: fn.currentVersion, + provisionedConcurrentExecutions: pce, + }); + }).toThrow(); + + // WHEN: Version provisionedConcurrencyConfig less than 0 + expect(() => { + new lambda.Version(stack, 'Version 1', { + lambda: fn, + codeSha256: undefined, + description: undefined, + provisionedConcurrentExecutions: pce, + }); + }).toThrow(); + + // WHEN: Adding a version provisionedConcurrencyConfig less than 0 + expect(() => { + fn.addVersion('1', undefined, undefined, pce); + }).toThrow(); + }); + + test('alias exposes real Lambdas role', () => { + const stack = new Stack(); + + // GIVEN + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.currentVersion; + const alias = new lambda.Alias(stack, 'Alias', { aliasName: 'prod', version }); + + // THEN + expect(alias.role).toEqual(fn.role); + }); + + test('functionName is derived from the aliasArn so that dependencies are sound', () => { + const stack = new Stack(); + + // GIVEN + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.currentVersion; + const alias = new lambda.Alias(stack, 'Alias', { aliasName: 'prod', version }); + + // WHEN + expect(stack.resolve(alias.functionName)).toEqual({ + 'Fn::Join': [ + '', + [ + { + 'Fn::Select': [ + 6, + { + 'Fn::Split': [ + ':', + { + Ref: 'Alias325C5727', + }, + ], + }, + ], + }, + ':prod', + ], + ], + }); + }); + + test('with event invoke config', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + onSuccess: { + bind: () => ({ + destination: 'on-success-arn', + }), + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { + FunctionName: { + Ref: 'fn5FF616E3', + }, + Qualifier: { + 'Fn::Select': [ + 7, + { + 'Fn::Split': [ + ':', + { + Ref: 'Alias325C5727', + }, + ], + }, + ], + }, + DestinationConfig: { + OnSuccess: { + Destination: 'on-success-arn', + }, + }, + }); + }); + + test('throws when calling configureAsyncInvoke on already configured alias', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + onSuccess: { + bind: () => ({ + destination: 'on-success-arn', + }), + }, + }); + + // THEN + expect(() => alias.configureAsyncInvoke({ retryAttempts: 0 })).toThrow(/An EventInvokeConfig has already been configured/); + }); + + test('event invoke config on imported alias', () => { + // GIVEN + const stack = new Stack(); + const fn = lambda.Version.fromVersionArn(stack, 'Fn', 'arn:aws:lambda:region:account-id:function:function-name:version'); + const alias = lambda.Alias.fromAliasAttributes(stack, 'Alias', { aliasName: 'alias-name', aliasVersion: fn }); + + // WHEN + alias.configureAsyncInvoke({ + retryAttempts: 1, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { + FunctionName: 'function-name', + Qualifier: 'alias-name', + MaximumRetryAttempts: 1, + }); + }); + + testDeprecated('can enable AutoScaling on aliases', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + }); + + // WHEN + alias.addAutoScaling({ maxCapacity: 5 }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { + MinCapacity: 1, + MaxCapacity: 5, + ResourceId: Match.objectLike({ + 'Fn::Join': Match.arrayWith([Match.arrayWith([ + 'function:', + Match.objectLike({ + 'Fn::Select': Match.arrayWith([ + { + 'Fn::Split': Match.arrayWith([ + { Ref: 'Alias325C5727' }, + ]), + }, + ]), + }), + ':prod', + ])]), + }), + }); + }); + + test('can enable AutoScaling on aliases with Provisioned Concurrency set', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + provisionedConcurrentExecutions: 10, + }); + + // WHEN + alias.addAutoScaling({ maxCapacity: 5 }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { + MinCapacity: 1, + MaxCapacity: 5, + ResourceId: Match.objectLike({ + 'Fn::Join': Match.arrayWith([Match.arrayWith([ + 'function:', + Match.objectLike({ + 'Fn::Select': Match.arrayWith([ + { + 'Fn::Split': Match.arrayWith([ + { Ref: 'Alias325C5727' }, + ]), + }, + ]), + }), + ':prod', + ])]), + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + ProvisionedConcurrencyConfig: { + ProvisionedConcurrentExecutions: 10, + }, + }); + }); + + test('validation for utilizationTarget does not fail when using Tokens', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + provisionedConcurrentExecutions: 10, + }); + + // WHEN + const target = alias.addAutoScaling({ maxCapacity: 5 }); + + target.scaleOnUtilization({ utilizationTarget: Lazy.number({ produce: () => 0.95 }) }); + + // THEN: no exception + Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', { + PolicyType: 'TargetTrackingScaling', + TargetTrackingScalingPolicyConfiguration: { + PredefinedMetricSpecification: { PredefinedMetricType: 'LambdaProvisionedConcurrencyUtilization' }, + TargetValue: 0.95, + }, + }); + }); + + test('cannot enable AutoScaling twice on same property', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + }); + + // WHEN + alias.addAutoScaling({ maxCapacity: 5 }); + + // THEN + expect(() => alias.addAutoScaling({ maxCapacity: 8 })).toThrow(/AutoScaling already enabled for this alias/); + }); + + test('error when specifying invalid utilization value when AutoScaling on utilization', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + }); + + // WHEN + const target = alias.addAutoScaling({ maxCapacity: 5 }); + + // THEN + expect(() => target.scaleOnUtilization({ utilizationTarget: 0.95 })).toThrow(/Utilization Target should be between 0.1 and 0.9. Found 0.95/); + }); + + test('can autoscale on a schedule', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + }); + + // WHEN + const target = alias.addAutoScaling({ maxCapacity: 5 }); + target.scaleOnSchedule('Scheduling', { + schedule: appscaling.Schedule.cron({}), + maxCapacity: 10, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', { + ScheduledActions: [ + { + ScalableTargetAction: { MaxCapacity: 10 }, + Schedule: 'cron(* * * * ? *)', + ScheduledActionName: 'Scheduling', + }, + ], + }); + }); + + test('scheduled scaling shows warning when minute is not defined in cron', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + }); + + // WHEN + const target = alias.addAutoScaling({ maxCapacity: 5 }); + target.scaleOnSchedule('Scheduling', { + schedule: appscaling.Schedule.cron({}), + maxCapacity: 10, + }); + + // THEN + Annotations.fromStack(stack).hasWarning('/Default/Alias/AliasScaling/Target', "cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead."); + }); + + test('scheduled scaling shows no warning when minute is * in cron', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const alias = new lambda.Alias(stack, 'Alias', { + aliasName: 'prod', + version: fn.currentVersion, + }); + + // WHEN + const target = alias.addAutoScaling({ maxCapacity: 5 }); + target.scaleOnSchedule('Scheduling', { + schedule: appscaling.Schedule.cron({ minute: '*' }), + maxCapacity: 10, + }); + + // THEN + const annotations = Annotations.fromStack(stack).findWarning('*', Match.anyValue()); + expect(annotations.length).toBe(0); + }); + + test('addFunctionUrl creates a function url', () => { + // GIVEN + const stack = new Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const aliasName = 'prod'; + const alias = new lambda.Alias(stack, 'Alias', { + aliasName, + version: fn.currentVersion, + }); + + // WHEN + alias.addFunctionUrl(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Url', { + AuthType: 'AWS_IAM', + TargetFunctionArn: { + 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'], + }, + Qualifier: aliasName, + }); + }); +}); diff --git a/packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts b/packages/aws-cdk-lib/aws-lambda/test/code-signing-config.test.ts similarity index 96% rename from packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/code-signing-config.test.ts index 68674b6f4bf6a..80ff8860b6515 100644 --- a/packages/@aws-cdk/aws-lambda/test/code-signing-config.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/code-signing-config.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as signer from '@aws-cdk/aws-signer'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as signer from '../../aws-signer'; +import * as cdk from '../../core'; import * as lambda from '../lib'; let app: cdk.App; diff --git a/packages/@aws-cdk/aws-lambda/test/code.test.ts b/packages/aws-cdk-lib/aws-lambda/test/code.test.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/test/code.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/code.test.ts index f8ed89d1aceba..2808ac4fcefea 100644 --- a/packages/@aws-cdk/aws-lambda/test/code.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/code.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Match, Template } from '../../assertions'; +import * as ecr from '../../aws-ecr'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as lambda from '../lib'; /* eslint-disable dot-notation */ diff --git a/packages/aws-cdk-lib/aws-lambda/test/docker-arm64-handler/Dockerfile b/packages/aws-cdk-lib/aws-lambda/test/docker-arm64-handler/Dockerfile new file mode 100644 index 0000000000000..3da16ef980217 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/docker-arm64-handler/Dockerfile @@ -0,0 +1,6 @@ +FROM public.ecr.aws/lambda/python:latest + +ARG FUNCTION_DIR="/var/task" +COPY index.py ${FUNCTION_DIR} + +CMD [ "index.handler" ] \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-lambda/test/docker-arm64-handler/index.py b/packages/aws-cdk-lib/aws-lambda/test/docker-arm64-handler/index.py new file mode 100644 index 0000000000000..fe4f05995f6bd --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/docker-arm64-handler/index.py @@ -0,0 +1,6 @@ +import json, platform +def handler(event, context): + return { + 'statusCode': 200, + 'body': json.dumps( f'Hello CDK from Lambda({platform.platform()})!') + } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/docker-build-lambda/Dockerfile b/packages/aws-cdk-lib/aws-lambda/test/docker-build-lambda/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/docker-build-lambda/Dockerfile rename to packages/aws-cdk-lib/aws-lambda/test/docker-build-lambda/Dockerfile diff --git a/packages/@aws-cdk/aws-lambda/test/docker-build-lambda/index.ts b/packages/aws-cdk-lib/aws-lambda/test/docker-build-lambda/index.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/docker-build-lambda/index.ts rename to packages/aws-cdk-lib/aws-lambda/test/docker-build-lambda/index.ts diff --git a/packages/aws-cdk-lib/aws-lambda/test/docker-lambda-handler/Dockerfile b/packages/aws-cdk-lib/aws-lambda/test/docker-lambda-handler/Dockerfile new file mode 100644 index 0000000000000..f03af5f73f1a5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/docker-lambda-handler/Dockerfile @@ -0,0 +1,8 @@ +FROM public.ecr.aws/lambda/nodejs:12 +ARG FUNCTION_DIR="/var/task" +# Create function directory +RUN mkdir -p ${FUNCTION_DIR} +# Copy handler function and package.json +COPY app.js ${FUNCTION_DIR} +# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile) +CMD [ "app.handler" ] diff --git a/packages/aws-cdk-lib/aws-lambda/test/docker-lambda-handler/app.ts b/packages/aws-cdk-lib/aws-lambda/test/docker-lambda-handler/app.ts new file mode 100644 index 0000000000000..99155b53d5bf7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/docker-lambda-handler/app.ts @@ -0,0 +1,9 @@ +/* eslint-disable no-console */ + +exports.handler = async (event: any) => { + console.log('hello world'); + console.log(`event ${JSON.stringify(event)}`); + return { + statusCode: 200, + }; +}; \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/test/event-source-mapping.test.ts b/packages/aws-cdk-lib/aws-lambda/test/event-source-mapping.test.ts similarity index 99% rename from packages/@aws-cdk/aws-lambda/test/event-source-mapping.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/event-source-mapping.test.ts index 5031ad20b1cb3..14e945d1c4949 100644 --- a/packages/@aws-cdk/aws-lambda/test/event-source-mapping.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/event-source-mapping.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import { Code, EventSourceMapping, Function, Runtime, Alias, StartingPosition, FilterRule, FilterCriteria } from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-lambda/test/function-hash.test.ts b/packages/aws-cdk-lib/aws-lambda/test/function-hash.test.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/test/function-hash.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/function-hash.test.ts index 9cff57419184f..c9d3b28936fba 100644 --- a/packages/@aws-cdk/aws-lambda/test/function-hash.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/function-hash.test.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as ssm from '@aws-cdk/aws-ssm'; +import { Template } from '../../assertions'; +import * as ssm from '../../aws-ssm'; import { resourceSpecification } from '@aws-cdk/cfnspec'; -import { App, CfnOutput, CfnResource, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { App, CfnOutput, CfnResource, Stack } from '../../core'; +import * as cxapi from '../../cx-api'; import * as lambda from '../lib'; import { calculateFunctionHash, trimFromStart, VERSION_LOCKED } from '../lib/function-hash'; diff --git a/packages/@aws-cdk/aws-lambda/test/function-url.test.ts b/packages/aws-cdk-lib/aws-lambda/test/function-url.test.ts similarity index 97% rename from packages/@aws-cdk/aws-lambda/test/function-url.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/function-url.test.ts index 972c404e3b6ac..87a4838cda034 100644 --- a/packages/@aws-cdk/aws-lambda/test/function-url.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/function-url.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as lambda from '../lib'; describe('FunctionUrl', () => { diff --git a/packages/aws-cdk-lib/aws-lambda/test/function.test.ts b/packages/aws-cdk-lib/aws-lambda/test/function.test.ts new file mode 100644 index 0000000000000..e1727dfd25b42 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/function.test.ts @@ -0,0 +1,3212 @@ +import * as path from 'path'; +import { Annotations, Match, Template } from '../../assertions'; +import { ProfilingGroup } from '../../aws-codeguruprofiler'; +import * as ec2 from '../../aws-ec2'; +import * as efs from '../../aws-efs'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as signer from '../../aws-signer'; +import * as sns from '../../aws-sns'; +import * as sqs from '../../aws-sqs'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import * as cdk from '../../core'; +import { Aspects, Lazy, Size } from '../../core'; +import * as cxapi from '../../cx-api'; +import * as constructs from 'constructs'; +import * as _ from 'lodash'; +import * as lambda from '../lib'; +import { AdotLambdaLayerJavaSdkVersion } from '../lib/adot-layers'; +import { calculateFunctionHash } from '../lib/function-hash'; + +describe('function', () => { + const dockerLambdaHandlerPath = path.join(__dirname, 'docker-lambda-handler'); + test('default function', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: + { + Statement: + [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { Service: 'lambda.amazonaws.com' }, + }], + Version: '2012-10-17', + }, + ManagedPolicyArns: + [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: + { + Code: { ZipFile: 'foo' }, + Handler: 'index.handler', + Role: { 'Fn::GetAtt': ['MyLambdaServiceRole4539ECB6', 'Arn'] }, + Runtime: 'nodejs14.x', + }, + DependsOn: ['MyLambdaServiceRole4539ECB6'], + }); + }); + + test('adds policy permissions', () => { + const stack = new cdk.Stack(); + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + initialPolicy: [new iam.PolicyStatement({ actions: ['*'], resources: ['*'] })], + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: + { + Statement: + [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { Service: 'lambda.amazonaws.com' }, + }], + Version: '2012-10-17', + }, + ManagedPolicyArns: + // eslint-disable-next-line max-len + [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: '*', + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + Roles: [ + { + Ref: 'MyLambdaServiceRole4539ECB6', + }, + ], + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: { + Code: { ZipFile: 'foo' }, + Handler: 'index.handler', + Role: { 'Fn::GetAtt': ['MyLambdaServiceRole4539ECB6', 'Arn'] }, + Runtime: 'nodejs14.x', + }, + DependsOn: ['MyLambdaServiceRoleDefaultPolicy5BBC6F68', 'MyLambdaServiceRole4539ECB6'], + }); + }); + + test('fails if inline code is used for an invalid runtime', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'bar', + runtime: lambda.Runtime.DOTNET_CORE_2, + })).toThrow(); + }); + + describe('addPermissions', () => { + test('can be used to add permissions to the Lambda function', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + + fn.addPermission('S3Permission', { + action: 'lambda:*', + principal: new iam.ServicePrincipal('s3.amazonaws.com'), + sourceAccount: stack.account, + sourceArn: 'arn:aws:s3:::my_bucket', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'lambda.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: + // eslint-disable-next-line max-len + [{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole']] }], + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: { + Code: { + ZipFile: 'foo', + }, + Handler: 'bar', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'python3.9', + }, + DependsOn: [ + 'MyLambdaServiceRole4539ECB6', + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:*', + FunctionName: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + Principal: 's3.amazonaws.com', + SourceAccount: { + Ref: 'AWS::AccountId', + }, + SourceArn: 'arn:aws:s3:::my_bucket', + }); + }); + + test('can supply principalOrgID via permission property', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + const org = new iam.OrganizationPrincipal('o-xxxxxxxxxx'); + const account = new iam.AccountPrincipal('123456789012'); + + fn.addPermission('S3Permission', { + action: 'lambda:*', + principal: account, + organizationId: org.organizationId, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:*', + FunctionName: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + Principal: account.accountId, + PrincipalOrgID: org.organizationId, + }); + }); + + test('fails if the principal is not a service, account, arn, or organization principal', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + + expect(() => fn.addPermission('F1', { principal: new iam.CanonicalUserPrincipal('org') })) + .toThrow(/Invalid principal type for Lambda permission statement/); + + fn.addPermission('S1', { principal: new iam.ServicePrincipal('my-service') }); + fn.addPermission('S2', { principal: new iam.AccountPrincipal('account') }); + fn.addPermission('S3', { principal: new iam.ArnPrincipal('my:arn') }); + fn.addPermission('S4', { principal: new iam.OrganizationPrincipal('my:org') }); + }); + + test('applies source account/ARN conditions if the principal has conditions', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + const sourceAccount = 'some-account'; + const sourceArn = 'some-arn'; + const service = 'my-service'; + const principal = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { + ArnLike: { + 'aws:SourceArn': sourceArn, + }, + StringEquals: { + 'aws:SourceAccount': sourceAccount, + }, + }); + + fn.addPermission('S1', { principal: principal }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + Principal: service, + SourceAccount: sourceAccount, + SourceArn: sourceArn, + }); + }); + + test('applies source arn condition if principal has conditions', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + const sourceArn = 'some-arn'; + const service = 'my-service'; + const principal = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { + ArnLike: { + 'aws:SourceArn': sourceArn, + }, + }); + + fn.addPermission('S1', { principal: principal }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + Principal: service, + SourceArn: sourceArn, + }); + }); + + test('applies principal org id conditions if the principal has conditions', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + const principalOrgId = 'org-xxxxxxxxxx'; + const service = 'my-service'; + const principal = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { + StringEquals: { + 'aws:PrincipalOrgID': principalOrgId, + }, + }); + + fn.addPermission('S1', { principal: principal }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + Principal: service, + PrincipalOrgID: principalOrgId, + }); + }); + + test('fails if the principal has conditions that are not supported', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + + expect(() => fn.addPermission('F1', { + principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { + ArnEquals: { + 'aws:SourceArn': 'source-arn', + }, + }), + })).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/); + expect(() => fn.addPermission('F2', { + principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { + StringLike: { + 'aws:SourceAccount': 'source-account', + }, + }), + })).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/); + expect(() => fn.addPermission('F3', { + principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { + ArnLike: { + 's3:DataAccessPointArn': 'data-access-point-arn', + }, + }), + })).toThrow(/PrincipalWithConditions had unsupported conditions for Lambda permission statement/); + }); + + test('fails if the principal has condition combinations that are not supported', () => { + const stack = new cdk.Stack(); + const fn = newTestLambda(stack); + + expect(() => fn.addPermission('F2', { + principal: new iam.PrincipalWithConditions(new iam.ServicePrincipal('my-service'), { + StringEquals: { + 'aws:SourceAccount': 'source-account', + 'aws:PrincipalOrgID': 'principal-org-id', + }, + ArnLike: { + 'aws:SourceArn': 'source-arn', + }, + }), + })).toThrow(/PrincipalWithConditions had unsupported condition combinations for Lambda permission statement/); + }); + + test('BYORole', () => { + // GIVEN + const stack = new cdk.Stack(); + const role = new iam.Role(stack, 'SomeRole', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + role.addToPolicy(new iam.PolicyStatement({ actions: ['confirm:itsthesame'], resources: ['*'] })); + + // WHEN + const fn = new lambda.Function(stack, 'Function', { + code: new lambda.InlineCode('test'), + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'index.test', + role, + initialPolicy: [ + new iam.PolicyStatement({ actions: ['inline:inline'], resources: ['*'] }), + ], + }); + + fn.addToRolePolicy(new iam.PolicyStatement({ actions: ['explicit:explicit'], resources: ['*'] })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { Action: 'confirm:itsthesame', Effect: 'Allow', Resource: '*' }, + { Action: 'inline:inline', Effect: 'Allow', Resource: '*' }, + { Action: 'explicit:explicit', Effect: 'Allow', Resource: '*' }, + ], + }, + }); + }); + }); + + test('fromFunctionArn', () => { + // GIVEN + const stack2 = new cdk.Stack(); + + // WHEN + const imported = lambda.Function.fromFunctionArn(stack2, 'Imported', 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords'); + + // THEN + expect(imported.functionArn).toEqual('arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords'); + expect(imported.functionName).toEqual('ProcessKinesisRecords'); + }); + + test('Function.fromFunctionName', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const imported = lambda.Function.fromFunctionName(stack, 'Imported', 'my-function'); + + // THEN + expect(stack.resolve(imported.functionArn)).toStrictEqual({ + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':lambda:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':function:my-function', + ]], + }); + expect(stack.resolve(imported.functionName)).toStrictEqual({ + 'Fn::Select': [6, { + 'Fn::Split': [':', { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':lambda:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':function:my-function', + ]], + }], + }], + }); + }); + + describe('Function.fromFunctionAttributes()', () => { + let stack: cdk.Stack; + + beforeEach(() => { + const app = new cdk.App(); + stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'stack-region' }, + }); + }); + + describe('for a function in a different account and region', () => { + let func: lambda.IFunction; + + beforeEach(() => { + func = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { + functionArn: 'arn:aws:lambda:function-region:222222222222:function:function-name', + }); + }); + + test("the function's region is taken from the ARN", () => { + expect(func.env.region).toBe('function-region'); + }); + + test("the function's account is taken from the ARN", () => { + expect(func.env.account).toBe('222222222222'); + }); + }); + }); + + describe('addPermissions', () => { + test('imported Function w/ resolved account and function arn', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Imports', { + env: { account: '123456789012', region: 'us-east-1' }, + }); + + // WHEN + const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', + }); + iFunc.addPermission('iFunc', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); + }); + + test('imported Function w/ unresolved account', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Imports'); + + // WHEN + const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', + }); + iFunc.addPermission('iFunc', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); + }); + + test('imported Function w/ unresolved account & allowPermissions set', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Imports'); + + // WHEN + const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', + sameEnvironment: true, // since this is false, by default, for env agnostic stacks + }); + iFunc.addPermission('iFunc', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); + }); + + test('imported Function w/different account', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111' }, + }); + + // WHEN + const iFunc = lambda.Function.fromFunctionAttributes(stack, 'iFunc', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction', + }); + iFunc.addPermission('iFunc', { + principal: new iam.ServicePrincipal('cloudformation.amazonaws.com'), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); + }); + + describe('annotations on different IFunctions', () => { + let stack: cdk.Stack; + let fn: lambda.Function; + let warningMessage: string; + beforeEach(() => { + warningMessage = 'AWS Lambda has changed their authorization strategy'; + stack = new cdk.Stack(); + fn = new lambda.Function(stack, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + }); + }); + + describe('permissions on functions', () => { + test('without lambda:InvokeFunction', () => { + // WHEN + fn.addPermission('MyPermission', { + action: 'lambda.GetFunction', + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // Simulate a workflow where a user has created a currentVersion with the intent to invoke it later. + fn.currentVersion; + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); + }); + + describe('with lambda:InvokeFunction', () => { + test('without invoking currentVersion', () => { + // WHEN + fn.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); + }); + + test('with currentVersion invoked first', () => { + // GIVEN + // Simulate a workflow where a user has created a currentVersion with the intent to invoke it later. + fn.currentVersion; + + // WHEN + fn.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // THEN + Annotations.fromStack(stack).hasWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); + }); + + test('with currentVersion invoked after permissions created', () => { + // WHEN + fn.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // Simulate a workflow where a user has created a currentVersion after adding permissions to the function. + fn.currentVersion; + + // THEN + Annotations.fromStack(stack).hasWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); + }); + + test('multiple currentVersion calls does not result in multiple warnings', () => { + // WHEN + fn.currentVersion; + + fn.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + fn.currentVersion; + + // THEN + const warns = Annotations.fromStack(stack).findWarning('/Default/MyLambda', Match.stringLikeRegexp(warningMessage)); + expect(warns).toHaveLength(1); + }); + }); + }); + + test('permission on versions', () => { + // GIVEN + const version = new lambda.Version(stack, 'MyVersion', { + lambda: fn.currentVersion, + }); + + // WHEN + version.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Default/MyVersion', Match.stringLikeRegexp(warningMessage)); + }); + + test('permission on latest version', () => { + // WHEN + fn.latestVersion.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // THEN + // cannot add permissions on latest version, so no warning necessary + Annotations.fromStack(stack).hasNoWarning('/Default/MyLambda/$LATEST', Match.stringLikeRegexp(warningMessage)); + }); + + test('function.addAlias', () => { + // WHEN + fn.addAlias('prod'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Alias', { + Name: 'prod', + FunctionName: { Ref: 'MyLambdaCCE802FB' }, + FunctionVersion: { 'Fn::GetAtt': ['MyLambdaCurrentVersionE7A382CCe2d14849ae02766d3abd365a8a0f12ae', 'Version'] }, + }); + }); + + describe('permission on alias', () => { + test('of current version', () => { + // GIVEN + const version = new lambda.Version(stack, 'MyVersion', { + lambda: fn.currentVersion, + }); + const alias = new lambda.Alias(stack, 'MyAlias', { + aliasName: 'alias', + version, + }); + + // WHEN + alias.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Default/MyAlias', Match.stringLikeRegexp(warningMessage)); + }); + + test('of latest version', () => { + // GIVEN + const alias = new lambda.Alias(stack, 'MyAlias', { + aliasName: 'alias', + version: fn.latestVersion, + }); + + // WHEN + alias.addPermission('MyPermission', { + principal: new iam.ServicePrincipal('lambda.amazonaws.com'), + }); + + // THEN + Annotations.fromStack(stack).hasNoWarning('/Default/MyAlias', Match.stringLikeRegexp(warningMessage)); + }); + }); + }); + }); + + test('Lambda code can be read from a local directory via an asset', () => { + // GIVEN + const app = new cdk.App({ + context: { + [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false, + }, + }); + const stack = new cdk.Stack(app); + new lambda.Function(stack, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Code: { + S3Bucket: { + Ref: 'AssetParameters9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232S3Bucket1354C645', + }, + S3Key: { + 'Fn::Join': ['', [ + { 'Fn::Select': [0, { 'Fn::Split': ['||', { Ref: 'AssetParameters9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232S3VersionKey5D873FAC' }] }] }, + { 'Fn::Select': [1, { 'Fn::Split': ['||', { Ref: 'AssetParameters9678c34eca93259d11f2d714177347afd66c50116e1e08996eff893d3ca81232S3VersionKey5D873FAC' }] }] }, + ]], + }, + }, + Handler: 'index.handler', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'python3.9', + }); + }); + + test('default function with SQS DLQ when client sets deadLetterQueueEnabled to true and functionName defined by client', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + functionName: 'OneFunctionToRuleThemAll', + deadLetterQueueEnabled: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'lambda.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole', + ], + ], + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'sqs:SendMessage', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'MyLambdaDeadLetterQueue399EEA2D', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + Roles: [ + { + Ref: 'MyLambdaServiceRole4539ECB6', + }, + ], + }); + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: { + Code: { + ZipFile: 'foo', + }, + Handler: 'index.handler', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'nodejs14.x', + DeadLetterConfig: { + TargetArn: { + 'Fn::GetAtt': [ + 'MyLambdaDeadLetterQueue399EEA2D', + 'Arn', + ], + }, + }, + FunctionName: 'OneFunctionToRuleThemAll', + }, + DependsOn: [ + 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + 'MyLambdaServiceRole4539ECB6', + ], + }); + }); + + test('default function with SQS DLQ when client sets deadLetterQueueEnabled to true and functionName not defined by client', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueueEnabled: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { + MessageRetentionPeriod: 1209600, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + DeadLetterConfig: { + TargetArn: { + 'Fn::GetAtt': [ + 'MyLambdaDeadLetterQueue399EEA2D', + 'Arn', + ], + }, + }, + }); + }); + + test('default function with SQS DLQ when client sets deadLetterQueueEnabled to false', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueueEnabled: false, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Code: { + ZipFile: 'foo', + }, + Handler: 'index.handler', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'nodejs14.x', + }); + }); + + test('default function with SQS DLQ when client provides Queue to be used as DLQ', () => { + const stack = new cdk.Stack(); + + const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { + queueName: 'MyLambda_DLQ', + retentionPeriod: cdk.Duration.days(14), + }); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueue: dlQueue, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'sqs:SendMessage', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'DeadLetterQueue9F481546', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + DeadLetterConfig: { + TargetArn: { + 'Fn::GetAtt': [ + 'DeadLetterQueue9F481546', + 'Arn', + ], + }, + }, + }); + }); + + test('default function with SQS DLQ when client provides Queue to be used as DLQ and deadLetterQueueEnabled set to true', () => { + const stack = new cdk.Stack(); + + const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { + queueName: 'MyLambda_DLQ', + retentionPeriod: cdk.Duration.days(14), + }); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueueEnabled: true, + deadLetterQueue: dlQueue, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'sqs:SendMessage', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'DeadLetterQueue9F481546', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + DeadLetterConfig: { + TargetArn: { + 'Fn::GetAtt': [ + 'DeadLetterQueue9F481546', + 'Arn', + ], + }, + }, + }); + }); + + test('error when default function with SQS DLQ when client provides Queue to be used as DLQ and deadLetterQueueEnabled set to false', () => { + const stack = new cdk.Stack(); + + const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { + queueName: 'MyLambda_DLQ', + retentionPeriod: cdk.Duration.days(14), + }); + + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueueEnabled: false, + deadLetterQueue: dlQueue, + })).toThrow(/deadLetterQueue defined but deadLetterQueueEnabled explicitly set to false/); + }); + + test('default function with SNS DLQ when client provides Topic to be used as DLQ', () => { + const stack = new cdk.Stack(); + + const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterTopic: dlTopic, + }); + + const template = Template.fromStack(stack); + template.hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([ + { + Action: 'sns:Publish', + Effect: 'Allow', + Resource: { + Ref: 'DeadLetterTopicC237650B', + }, + }, + ]), + }, + }); + template.hasResourceProperties('AWS::Lambda::Function', { + DeadLetterConfig: { + TargetArn: { + Ref: 'DeadLetterTopicC237650B', + }, + }, + }); + }); + + test('error when default function with SNS DLQ when client provides Topic to be used as DLQ and deadLetterQueueEnabled set to false', () => { + const stack = new cdk.Stack(); + + const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); + + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueueEnabled: false, + deadLetterTopic: dlTopic, + })).toThrow(/deadLetterQueue and deadLetterTopic cannot be specified together at the same time/); + }); + + test('error when default function with SNS DLQ when client provides Topic to be used as DLQ and deadLetterQueueEnabled set to true', () => { + const stack = new cdk.Stack(); + + const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); + + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueueEnabled: true, + deadLetterTopic: dlTopic, + })).toThrow(/deadLetterQueue and deadLetterTopic cannot be specified together at the same time/); + }); + + test('error when both topic and queue are presented as DLQ', () => { + const stack = new cdk.Stack(); + + const dlQueue = new sqs.Queue(stack, 'DLQ'); + const dlTopic = new sns.Topic(stack, 'DeadLetterTopic'); + + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + deadLetterQueue: dlQueue, + deadLetterTopic: dlTopic, + })).toThrow(/deadLetterQueue and deadLetterTopic cannot be specified together at the same time/); + }); + + test('default function with Active tracing', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + tracing: lambda.Tracing.ACTIVE, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'xray:PutTraceSegments', + 'xray:PutTelemetryRecords', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + Roles: [ + { + Ref: 'MyLambdaServiceRole4539ECB6', + }, + ], + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: { + Code: { + ZipFile: 'foo', + }, + Handler: 'index.handler', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'nodejs14.x', + TracingConfig: { + Mode: 'Active', + }, + }, + DependsOn: [ + 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + 'MyLambdaServiceRole4539ECB6', + ], + }); + }); + + test('default function with PassThrough tracing', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + tracing: lambda.Tracing.PASS_THROUGH, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'xray:PutTraceSegments', + 'xray:PutTelemetryRecords', + ], + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + Roles: [ + { + Ref: 'MyLambdaServiceRole4539ECB6', + }, + ], + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: { + Code: { + ZipFile: 'foo', + }, + Handler: 'index.handler', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'nodejs14.x', + TracingConfig: { + Mode: 'PassThrough', + }, + }, + DependsOn: [ + 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + 'MyLambdaServiceRole4539ECB6', + ], + }); + }); + + test('default function with Disabled tracing', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + tracing: lambda.Tracing.DISABLED, + }); + + Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: { + Code: { + ZipFile: 'foo', + }, + Handler: 'index.handler', + Role: { + 'Fn::GetAtt': [ + 'MyLambdaServiceRole4539ECB6', + 'Arn', + ], + }, + Runtime: 'nodejs14.x', + }, + DependsOn: [ + 'MyLambdaServiceRole4539ECB6', + ], + }); + }); + + test('runtime and handler set to FROM_IMAGE are set to undefined in CloudFormation', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), + handler: lambda.Handler.FROM_IMAGE, + runtime: lambda.Runtime.FROM_IMAGE, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Runtime: Match.absent(), + Handler: Match.absent(), + PackageType: 'Image', + }); + }); + + describe('grantInvoke', () => { + test('adds iam:InvokeFunction', () => { + // GIVEN + const stack = new cdk.Stack(); + const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.AccountPrincipal('1234'), + }); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + fn.grantInvoke(role); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + Resource: [ + { 'Fn::GetAtt': ['Function76856677', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['Function76856677', 'Arn'] }, ':*']] }, + ], + }, + ], + }, + }); + }); + + test('with a service principal', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const service = new iam.ServicePrincipal('apigateway.amazonaws.com'); + + // WHEN + fn.grantInvoke(service); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'apigateway.amazonaws.com', + }); + }); + + test('with an account principal', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const account = new iam.AccountPrincipal('123456789012'); + + // WHEN + fn.grantInvoke(account); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: '123456789012', + }); + }); + + test('with an arn principal', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const account = new iam.ArnPrincipal('arn:aws:iam::123456789012:role/someRole'); + + // WHEN + fn.grantInvoke(account); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'arn:aws:iam::123456789012:role/someRole', + }); + }); + + test('with an organization principal', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const org = new iam.OrganizationPrincipal('my-org-id'); + + // WHEN + fn.grantInvoke(org); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: '*', + PrincipalOrgID: 'my-org-id', + }); + }); + + test('can be called twice for the same service principal', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const service = new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com'); + + // WHEN + fn.grantInvoke(service); + fn.grantInvoke(service); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'elasticloadbalancing.amazonaws.com', + }); + }); + + test('with an imported role (in the same account)', () => { + // GIVEN + const stack = new cdk.Stack(undefined, undefined, { + env: { account: '123456789012' }, + }); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + fn.grantInvoke(iam.Role.fromRoleArn(stack, 'ForeignRole', 'arn:aws:iam::123456789012:role/someRole')); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'lambda:InvokeFunction', + Effect: 'Allow', + Resource: [ + { 'Fn::GetAtt': ['Function76856677', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['Function76856677', 'Arn'] }, ':*']] }, + ], + }, + ], + }, + Roles: ['someRole'], + }); + }); + + test('with an imported role (from a different account)', () => { + // GIVEN + const stack = new cdk.Stack(undefined, undefined, { + env: { account: '3333' }, + }); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + fn.grantInvoke(iam.Role.fromRoleArn(stack, 'ForeignRole', 'arn:aws:iam::123456789012:role/someRole')); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'arn:aws:iam::123456789012:role/someRole', + }); + }); + + test('on an imported function (same account)', () => { + // GIVEN + const stack = new cdk.Stack(undefined, undefined, { + env: { account: '123456789012' }, + }); + const fn = lambda.Function.fromFunctionArn(stack, 'Function', 'arn:aws:lambda:us-east-1:123456789012:function:MyFn'); + + // WHEN + fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', + Principal: 'elasticloadbalancing.amazonaws.com', + }); + }); + + test('on an imported function (unresolved account)', () => { + const stack = new cdk.Stack(); + const fn = lambda.Function.fromFunctionArn(stack, 'Function', 'arn:aws:lambda:us-east-1:123456789012:function:MyFn'); + + expect( + () => fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')), + ).toThrow(/Cannot modify permission to lambda function/); + }); + + test('on an imported function (unresolved account & w/ allowPermissions)', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = lambda.Function.fromFunctionAttributes(stack, 'Function', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', + sameEnvironment: true, + }); + + // WHEN + fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', + Principal: 'elasticloadbalancing.amazonaws.com', + }); + }); + + test('on an imported function (different account)', () => { + // GIVEN + const stack = new cdk.Stack(undefined, undefined, { + env: { account: '111111111111' }, // Different account + }); + const fn = lambda.Function.fromFunctionArn(stack, 'Function', 'arn:aws:lambda:us-east-1:123456789012:function:MyFn'); + + // THEN + expect(() => { + fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); + }).toThrow(/Cannot modify permission to lambda function/); + }); + + test('on an imported function (different account & w/ skipPermissions', () => { + // GIVEN + const stack = new cdk.Stack(undefined, undefined, { + env: { account: '111111111111' }, // Different account + }); + const fn = lambda.Function.fromFunctionAttributes(stack, 'Function', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:MyFn', + skipPermissions: true, + }); + + // THEN + expect(() => { + fn.grantInvoke(new iam.ServicePrincipal('elasticloadbalancing.amazonaws.com')); + }).not.toThrow(); + }); + }); + + test('Can use metricErrors on a lambda Function', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // THEN + expect(stack.resolve(fn.metricErrors())).toEqual({ + dimensions: { FunctionName: { Ref: 'Function76856677' } }, + namespace: 'AWS/Lambda', + metricName: 'Errors', + period: cdk.Duration.minutes(5), + statistic: 'Sum', + }); + }); + + test('addEventSource calls bind', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + let bindTarget; + + class EventSourceMock implements lambda.IEventSource { + public bind(target: lambda.IFunction) { + bindTarget = target; + } + } + + // WHEN + fn.addEventSource(new EventSourceMock()); + + // THEN + expect(bindTarget).toEqual(fn); + }); + + test('layer is baked into the function version', () => { + // GIVEN + const stack = new cdk.Stack(undefined, 'TestStack'); + const bucket = new s3.Bucket(stack, 'Bucket'); + const code = new lambda.S3Code(bucket, 'ObjectKey'); + + const fn = new lambda.Function(stack, 'fn', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), + handler: 'index.main', + }); + + const fnHash = calculateFunctionHash(fn); + + // WHEN + const layer = new lambda.LayerVersion(stack, 'LayerVersion', { + code, + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + }); + + fn.addLayers(layer); + + const newFnHash = calculateFunctionHash(fn); + + expect(fnHash).not.toEqual(newFnHash); + }); + + test('with feature flag, layer version is baked into function version', () => { + // GIVEN + const app = new cdk.App({ context: { [cxapi.LAMBDA_RECOGNIZE_LAYER_VERSION]: true } }); + const stack = new cdk.Stack(app, 'TestStack'); + const bucket = new s3.Bucket(stack, 'Bucket'); + const code = new lambda.S3Code(bucket, 'ObjectKey'); + const layer = new lambda.LayerVersion(stack, 'LayerVersion', { + code, + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + }); + + // function with layer + const fn = new lambda.Function(stack, 'fn', { + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), + handler: 'index.main', + layers: [layer], + }); + + const fnHash = calculateFunctionHash(fn); + + // use escape hatch to change the content of the layer + // this simulates updating the layer code which changes the version. + const cfnLayer = layer.node.defaultChild as lambda.CfnLayerVersion; + const newCode = (new lambda.S3Code(bucket, 'NewObjectKey')).bind(layer); + cfnLayer.content = { + s3Bucket: newCode.s3Location!.bucketName, + s3Key: newCode.s3Location!.objectKey, + s3ObjectVersion: newCode.s3Location!.objectVersion, + }; + + const newFnHash = calculateFunctionHash(fn); + + expect(fnHash).not.toEqual(newFnHash); + }); + + test('using an incompatible layer', () => { + // GIVEN + const stack = new cdk.Stack(undefined, 'TestStack'); + const layer = lambda.LayerVersion.fromLayerVersionAttributes(stack, 'TestLayer', { + layerVersionArn: 'arn:aws:...', + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + }); + + // THEN + expect(() => new lambda.Function(stack, 'Function', { + layers: [layer], + runtime: lambda.Runtime.NODEJS_16_X, + code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), + handler: 'index.main', + })).toThrow(/nodejs16.x is not in \[nodejs14.x\]/); + }); + + test('using more than 5 layers', () => { + // GIVEN + const stack = new cdk.Stack(undefined, 'TestStack'); + const layers = new Array(6).fill(lambda.LayerVersion.fromLayerVersionAttributes(stack, 'TestLayer', { + layerVersionArn: 'arn:aws:...', + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + })); + + // THEN + expect(() => new lambda.Function(stack, 'Function', { + layers, + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('exports.main = function() { console.log("DONE"); }'), + handler: 'index.main', + })).toThrow(/Unable to add layer:/); + }); + + test('environment variables work in China', () => { + // GIVEN + const stack = new cdk.Stack(undefined, undefined, { env: { region: 'cn-north-1' } }); + + // WHEN + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS, + environment: { + SOME: 'Variable', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + SOME: 'Variable', + }, + }, + }); + }); + + test('environment variables work in an unspecified region', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS, + environment: { + SOME: 'Variable', + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + SOME: 'Variable', + }, + }, + }); + }); + + test('support reserved concurrent executions', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS, + reservedConcurrentExecutions: 10, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + ReservedConcurrentExecutions: 10, + }); + }); + + test('its possible to specify event sources upon creation', () => { + // GIVEN + const stack = new cdk.Stack(); + + let bindCount = 0; + + class EventSource implements lambda.IEventSource { + public bind(_fn: lambda.IFunction): void { + bindCount++; + } + } + + // WHEN + new lambda.Function(stack, 'fn', { + code: lambda.Code.fromInline('boom'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.bam', + events: [ + new EventSource(), + new EventSource(), + ], + }); + + // THEN + expect(bindCount).toEqual(2); + }); + + test('Provided Runtime returns the right values', () => { + const rt = lambda.Runtime.PROVIDED; + + expect(rt.name).toEqual('provided'); + expect(rt.supportsInlineCode).toEqual(false); + }); + + test('specify log retention', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS, + logRetention: logs.RetentionDays.ONE_MONTH, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { + LogGroupName: { + 'Fn::Join': [ + '', + [ + '/aws/lambda/', + { + Ref: 'MyLambdaCCE802FB', + }, + ], + ], + }, + RetentionInDays: 30, + }); + }); + + test('imported lambda with imported security group and allowAllOutbound set to false', () => { + // GIVEN + const stack = new cdk.Stack(); + + const fn = lambda.Function.fromFunctionAttributes(stack, 'fn', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:my-function', + securityGroup: ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + }), + }); + + // WHEN + fn.connections.allowToAnyIpv4(ec2.Port.tcp(443)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: 'sg-123456789', + }); + }); + + test('with event invoke config', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + onFailure: { + bind: () => ({ destination: 'on-failure-arn' }), + }, + onSuccess: { + bind: () => ({ destination: 'on-success-arn' }), + }, + maxEventAge: cdk.Duration.hours(1), + retryAttempts: 0, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { + FunctionName: { + Ref: 'fn5FF616E3', + }, + Qualifier: '$LATEST', + DestinationConfig: { + OnFailure: { + Destination: 'on-failure-arn', + }, + OnSuccess: { + Destination: 'on-success-arn', + }, + }, + MaximumEventAgeInSeconds: 3600, + MaximumRetryAttempts: 0, + }); + }); + + test('throws when calling configureAsyncInvoke on already configured function', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + maxEventAge: cdk.Duration.hours(1), + }); + + // THEN + expect(() => fn.configureAsyncInvoke({ retryAttempts: 0 })).toThrow(/An EventInvokeConfig has already been configured/); + }); + + test('event invoke config on imported lambda', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = lambda.Function.fromFunctionAttributes(stack, 'fn', { + functionArn: 'arn:aws:lambda:us-east-1:123456789012:function:my-function', + }); + + // WHEN + fn.configureAsyncInvoke({ + retryAttempts: 1, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { + FunctionName: 'my-function', + Qualifier: '$LATEST', + MaximumRetryAttempts: 1, + }); + }); + + testDeprecated('add a version with event invoke config', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + fn.addVersion('1', 'sha256', 'desc', undefined, { + retryAttempts: 0, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::EventInvokeConfig', { + FunctionName: { + Ref: 'fn5FF616E3', + }, + Qualifier: { + 'Fn::GetAtt': [ + 'fnVersion197FA813F', + 'Version', + ], + }, + MaximumRetryAttempts: 0, + }); + }); + + test('check edge compatibility with env vars that can be removed', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + fn.addEnvironment('KEY', 'value', { removeInEdge: true }); + + // WHEN + fn._checkEdgeCompatibility(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Environment: Match.absent(), + }); + }); + + test('check edge compatibility with env vars that cannot be removed', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + environment: { + KEY: 'value', + }, + }); + fn.addEnvironment('OTHER_KEY', 'other_value', { removeInEdge: true }); + + // THEN + expect(() => fn._checkEdgeCompatibility()).toThrow(/The function Default\/fn contains environment variables \[KEY\] and is not compatible with Lambda@Edge/); + }); + + test('add incompatible layer', () => { + // GIVEN + const stack = new cdk.Stack(undefined, 'TestStack'); + const bucket = new s3.Bucket(stack, 'Bucket'); + const code = new lambda.S3Code(bucket, 'ObjectKey'); + + const func = new lambda.Function(stack, 'myFunc', { + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.handler', + code, + }); + const layer = new lambda.LayerVersion(stack, 'myLayer', { + code, + compatibleRuntimes: [lambda.Runtime.NODEJS], + }); + + // THEN + expect(() => func.addLayers(layer)).toThrow( + /This lambda function uses a runtime that is incompatible with this layer/); + }); + + test('add compatible layer', () => { + // GIVEN + const stack = new cdk.Stack(undefined, 'TestStack'); + const bucket = new s3.Bucket(stack, 'Bucket'); + const code = new lambda.S3Code(bucket, 'ObjectKey'); + + const func = new lambda.Function(stack, 'myFunc', { + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.handler', + code, + }); + const layer = new lambda.LayerVersion(stack, 'myLayer', { + code, + compatibleRuntimes: [lambda.Runtime.PYTHON_3_7], + }); + + // THEN + // should not throw + expect(() => func.addLayers(layer)).not.toThrow(); + }); + + test('add compatible layer for deep clone', () => { + // GIVEN + const stack = new cdk.Stack(undefined, 'TestStack'); + const bucket = new s3.Bucket(stack, 'Bucket'); + const code = new lambda.S3Code(bucket, 'ObjectKey'); + + const runtime = lambda.Runtime.PYTHON_3_7; + const func = new lambda.Function(stack, 'myFunc', { + runtime, + handler: 'index.handler', + code, + }); + const clone = _.cloneDeep(runtime); + const layer = new lambda.LayerVersion(stack, 'myLayer', { + code, + compatibleRuntimes: [clone], + }); + + // THEN + // should not throw + expect(() => func.addLayers(layer)).not.toThrow(); + }); + + test('empty inline code is not allowed', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN/THEN + expect(() => new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline(''), + })).toThrow(/Lambda inline code cannot be empty/); + }); + + test('logGroup is correctly returned', () => { + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + }); + const logGroup = fn.logGroup; + expect(logGroup.logGroupName).toBeDefined(); + expect(logGroup.logGroupArn).toBeDefined(); + }); + + test('dlq is returned when provided by user and is Queue', () => { + const stack = new cdk.Stack(); + + const dlQueue = new sqs.Queue(stack, 'DeadLetterQueue', { + queueName: 'MyLambda_DLQ', + retentionPeriod: cdk.Duration.days(14), + }); + + const fn = new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + deadLetterQueue: dlQueue, + }); + const deadLetterQueue = fn.deadLetterQueue; + const deadLetterTopic = fn.deadLetterTopic; + + expect(deadLetterTopic).toBeUndefined(); + + expect(deadLetterQueue).toBeDefined(); + expect(deadLetterQueue).toBeInstanceOf(sqs.Queue); + }); + + test('dlq is returned when provided by user and is Topic', () => { + const stack = new cdk.Stack(); + + const dlTopic = new sns.Topic(stack, 'DeadLetterQueue', { + topicName: 'MyLambda_DLQ', + }); + + const fn = new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + deadLetterTopic: dlTopic, + }); + const deadLetterQueue = fn.deadLetterQueue; + const deadLetterTopic = fn.deadLetterTopic; + + expect(deadLetterQueue).toBeUndefined(); + + expect(deadLetterTopic).toBeDefined(); + expect(deadLetterTopic).toBeInstanceOf(sns.Topic); + }); + + test('dlq is returned when setup by cdk and is Queue', () => { + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + deadLetterQueueEnabled: true, + }); + const deadLetterQueue = fn.deadLetterQueue; + const deadLetterTopic = fn.deadLetterTopic; + + expect(deadLetterTopic).toBeUndefined(); + + expect(deadLetterQueue).toBeDefined(); + expect(deadLetterQueue).toBeInstanceOf(sqs.Queue); + }); + + test('dlq is undefined when not setup', () => { + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + }); + const deadLetterQueue = fn.deadLetterQueue; + const deadLetterTopic = fn.deadLetterTopic; + + expect(deadLetterQueue).toBeUndefined(); + expect(deadLetterTopic).toBeUndefined(); + }); + + test('one and only one child LogRetention construct will be created', () => { + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromInline('foo'), + logRetention: logs.RetentionDays.FIVE_DAYS, + }); + + // Call logGroup a few times. If more than one instance of LogRetention was created, + // the second call will fail on duplicate constructs. + fn.logGroup; + fn.logGroup; + fn.logGroup; + }); + + test('fails when inline code is specified on an incompatible runtime', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'fn', { + handler: 'foo', + runtime: lambda.Runtime.PROVIDED, + code: lambda.Code.fromInline('foo'), + })).toThrow(/Inline source not allowed for/); + }); + + test('multiple calls to latestVersion returns the same version', () => { + const stack = new cdk.Stack(); + + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version1 = fn.latestVersion; + const version2 = fn.latestVersion; + + const expectedArn = { + 'Fn::Join': ['', [ + { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + ':$LATEST', + ]], + }; + expect(version1).toEqual(version2); + expect(stack.resolve(version1.functionArn)).toEqual(expectedArn); + expect(stack.resolve(version2.functionArn)).toEqual(expectedArn); + }); + + test('default function with kmsKeyArn, environmentEncryption passed as props', () => { + // GIVEN + const stack = new cdk.Stack(); + const key: kms.IKey = new kms.Key(stack, 'EnvVarEncryptKey', { + description: 'sample key', + }); + + // WHEN + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + environment: { + SOME: 'Variable', + }, + environmentEncryption: key, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + SOME: 'Variable', + }, + }, + KmsKeyArn: { + 'Fn::GetAtt': [ + 'EnvVarEncryptKey1A7CABDB', + 'Arn', + ], + }, + }); + }); + + describe('profiling group', () => { + test('default function with CDK created Profiling Group', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + profiling: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeGuruProfiler::ProfilingGroup', { + ProfilingGroupName: 'MyLambdaProfilingGroupC5B6CCD8', + ComputePlatform: 'AWSLambda', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'codeguru-profiler:ConfigureAgent', + 'codeguru-profiler:PostAgentProfile', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': ['MyLambdaProfilingGroupEC6DE32F', 'Arn'], + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + Roles: [ + { + Ref: 'MyLambdaServiceRole4539ECB6', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + AWS_CODEGURU_PROFILER_GROUP_ARN: { 'Fn::GetAtt': ['MyLambdaProfilingGroupEC6DE32F', 'Arn'] }, + AWS_CODEGURU_PROFILER_ENABLED: 'TRUE', + }, + }, + }); + }); + + test('default function with client provided Profiling Group', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'codeguru-profiler:ConfigureAgent', + 'codeguru-profiler:PostAgentProfile', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': ['ProfilingGroup26979FD7', 'Arn'], + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'MyLambdaServiceRoleDefaultPolicy5BBC6F68', + Roles: [ + { + Ref: 'MyLambdaServiceRole4539ECB6', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Environment: { + Variables: { + AWS_CODEGURU_PROFILER_GROUP_ARN: { + 'Fn::Join': [ + '', + [ + 'arn:', { Ref: 'AWS::Partition' }, ':codeguru-profiler:', { Ref: 'AWS::Region' }, + ':', { Ref: 'AWS::AccountId' }, ':profilingGroup/', { Ref: 'ProfilingGroup26979FD7' }, + ], + ], + }, + AWS_CODEGURU_PROFILER_ENABLED: 'TRUE', + }, + }, + }); + }); + + test('default function with client provided Profiling Group but profiling set to false', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + profiling: false, + profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), + }); + + Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', Match.not({ + Environment: { + Variables: { + AWS_CODEGURU_PROFILER_GROUP_ARN: { + 'Fn::Join': [ + '', + [ + 'arn:', { Ref: 'AWS::Partition' }, ':codeguru-profiler:', { Ref: 'AWS::Region' }, + ':', { Ref: 'AWS::AccountId' }, ':profilingGroup/', { Ref: 'ProfilingGroup26979FD7' }, + ], + ], + }, + AWS_CODEGURU_PROFILER_ENABLED: 'TRUE', + }, + }, + })); + }); + + test('default function with profiling enabled and client provided env vars', () => { + const stack = new cdk.Stack(); + + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + profiling: true, + environment: { + AWS_CODEGURU_PROFILER_GROUP_ARN: 'profiler_group_arn', + AWS_CODEGURU_PROFILER_ENABLED: 'yes', + }, + })).toThrow(/AWS_CODEGURU_PROFILER_GROUP_ARN and AWS_CODEGURU_PROFILER_ENABLED must not be set when profiling options enabled/); + }); + + test('default function with client provided Profiling Group and client provided env vars', () => { + const stack = new cdk.Stack(); + + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), + environment: { + AWS_CODEGURU_PROFILER_GROUP_ARN: 'profiler_group_arn', + AWS_CODEGURU_PROFILER_ENABLED: 'yes', + }, + })).toThrow(/AWS_CODEGURU_PROFILER_GROUP_ARN and AWS_CODEGURU_PROFILER_ENABLED must not be set when profiling options enabled/); + }); + + test('throws an error when used with an unsupported runtime', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + profilingGroup: new ProfilingGroup(stack, 'ProfilingGroup'), + environment: { + AWS_CODEGURU_PROFILER_GROUP_ARN: 'profiler_group_arn', + AWS_CODEGURU_PROFILER_ENABLED: 'yes', + }, + })).toThrow(/not supported by runtime/); + }); + }); + + describe('lambda.Function timeout', () => { + test('should be a cdk.Duration when defined', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const { timeout } = new lambda.Function(stack, 'MyFunction', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + timeout: cdk.Duration.minutes(2), + }); + + // THEN + expect(timeout).toEqual(cdk.Duration.minutes(2)); + }); + + test('should be optional', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const { timeout } = new lambda.Function(stack, 'MyFunction', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + }); + + // THEN + expect(timeout).not.toBeDefined(); + }); + }); + + describe('currentVersion', () => { + // see test.function-hash.ts for more coverage for this + test('logical id of version is based on the function hash', () => { + // GIVEN + const stack1 = new cdk.Stack(); + const fn1 = new lambda.Function(stack1, 'MyFunction', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + environment: { + FOO: 'bar', + }, + }); + const stack2 = new cdk.Stack(); + const fn2 = new lambda.Function(stack2, 'MyFunction', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + environment: { + FOO: 'bear', + }, + }); + + // WHEN + new cdk.CfnOutput(stack1, 'CurrentVersionArn', { + value: fn1.currentVersion.functionArn, + }); + new cdk.CfnOutput(stack2, 'CurrentVersionArn', { + value: fn2.currentVersion.functionArn, + }); + + // THEN + const template1 = Template.fromStack(stack1).toJSON(); + const template2 = Template.fromStack(stack2).toJSON(); + + // these functions are different in their configuration but the original + // logical ID of the version would be the same unless the logical ID + // includes the hash of function's configuration. + expect(template1.Outputs.CurrentVersionArn.Value).not.toEqual(template2.Outputs.CurrentVersionArn.Value); + }); + }); + + describe('filesystem', () => { + + test('mount efs filesystem', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 3, + natGateways: 1, + }); + + const fs = new efs.FileSystem(stack, 'Efs', { + vpc, + }); + const accessPoint = fs.addAccessPoint('AccessPoint'); + // WHEN + new lambda.Function(stack, 'MyFunction', { + vpc, + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + FileSystemConfigs: [ + { + Arn: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':elasticfilesystem:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':access-point/', + { + Ref: 'EfsAccessPointE419FED9', + }, + ], + ], + }, + LocalMountPath: '/mnt/msg', + }, + ], + }); + }); + + test('throw error mounting efs with no vpc', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 3, + natGateways: 1, + }); + + const fs = new efs.FileSystem(stack, 'Efs', { + vpc, + }); + const accessPoint = fs.addAccessPoint('AccessPoint'); + + // THEN + expect(() => { + new lambda.Function(stack, 'MyFunction', { + handler: 'foo', + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), + }); + }).toThrow(); + }); + + test('verify deps when mounting efs', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc', { + maxAzs: 3, + natGateways: 1, + }); + const securityGroup = new ec2.SecurityGroup(stack, 'LambdaSG', { + vpc, + allowAllOutbound: false, + }); + + const fs = new efs.FileSystem(stack, 'Efs', { + vpc, + }); + const accessPoint = fs.addAccessPoint('AccessPoint'); + // WHEN + new lambda.Function(stack, 'MyFunction', { + vpc, + handler: 'foo', + securityGroups: [securityGroup], + runtime: lambda.Runtime.NODEJS_14_X, + code: lambda.Code.fromAsset(path.join(__dirname, 'handler.zip')), + filesystem: lambda.FileSystem.fromEfsAccessPoint(accessPoint, '/mnt/msg'), + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + DependsOn: [ + 'EfsEfsMountTarget195B2DD2E', + 'EfsEfsMountTarget2315C927F', + 'EfsEfsSecurityGroupfromLambdaSG20491B2F751D', + 'LambdaSGtoEfsEfsSecurityGroupFCE2954020499719694A', + 'MyFunctionServiceRoleDefaultPolicyB705ABD4', + 'MyFunctionServiceRole3C357FF2', + 'VpcPrivateSubnet1DefaultRouteBE02A9ED', + 'VpcPrivateSubnet1RouteTableAssociation70C59FA6', + 'VpcPrivateSubnet2DefaultRoute060D2087', + 'VpcPrivateSubnet2RouteTableAssociationA89CAD56', + ], + }); + }); + }); + + describe('code config', () => { + class MyCode extends lambda.Code { + public readonly isInline: boolean; + constructor(private readonly config: lambda.CodeConfig) { + super(); + this.isInline = 'inlineCode' in config; + } + + public bind(_scope: constructs.Construct): lambda.CodeConfig { + return this.config; + } + } + + test('only one of inline, s3 or imageConfig are allowed', () => { + const stack = new cdk.Stack(); + + expect(() => new lambda.Function(stack, 'Fn1', { + code: new MyCode({}), + handler: 'index.handler', + runtime: lambda.Runtime.GO_1_X, + })).toThrow(/lambda.Code must specify exactly one of/); + + expect(() => new lambda.Function(stack, 'Fn2', { + code: new MyCode({ + inlineCode: 'foo', + image: { imageUri: 'bar' }, + }), + handler: 'index.handler', + runtime: lambda.Runtime.GO_1_X, + })).toThrow(/lambda.Code must specify exactly one of/); + + expect(() => new lambda.Function(stack, 'Fn3', { + code: new MyCode({ + image: { imageUri: 'baz' }, + s3Location: { bucketName: 's3foo', objectKey: 's3bar' }, + }), + handler: 'index.handler', + runtime: lambda.Runtime.GO_1_X, + })).toThrow(/lambda.Code must specify exactly one of/); + + expect(() => new lambda.Function(stack, 'Fn4', { + code: new MyCode({ inlineCode: 'baz', s3Location: { bucketName: 's3foo', objectKey: 's3bar' } }), + handler: 'index.handler', + runtime: lambda.Runtime.GO_1_X, + })).toThrow(/lambda.Code must specify exactly one of/); + }); + + test('handler must be FROM_IMAGE when image asset is specified', () => { + const stack = new cdk.Stack(); + + expect(() => new lambda.Function(stack, 'Fn1', { + code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), + handler: lambda.Handler.FROM_IMAGE, + runtime: lambda.Runtime.FROM_IMAGE, + })).not.toThrow(); + + expect(() => new lambda.Function(stack, 'Fn2', { + code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), + handler: 'index.handler', + runtime: lambda.Runtime.FROM_IMAGE, + })).toThrow(/handler must be.*FROM_IMAGE/); + }); + + test('runtime must be FROM_IMAGE when image asset is specified', () => { + const stack = new cdk.Stack(); + + expect(() => new lambda.Function(stack, 'Fn1', { + code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), + handler: lambda.Handler.FROM_IMAGE, + runtime: lambda.Runtime.FROM_IMAGE, + })).not.toThrow(); + + expect(() => new lambda.Function(stack, 'Fn2', { + code: lambda.Code.fromAssetImage(dockerLambdaHandlerPath), + handler: lambda.Handler.FROM_IMAGE, + runtime: lambda.Runtime.GO_1_X, + })).toThrow(/runtime must be.*FROM_IMAGE/); + }); + + test('imageUri is correctly configured', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'Fn1', { + code: new MyCode({ + image: { + imageUri: 'ecr image uri', + }, + }), + handler: lambda.Handler.FROM_IMAGE, + runtime: lambda.Runtime.FROM_IMAGE, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Code: { + ImageUri: 'ecr image uri', + }, + ImageConfig: Match.absent(), + }); + }); + + test('imageConfig is correctly configured', () => { + const stack = new cdk.Stack(); + + new lambda.Function(stack, 'Fn1', { + code: new MyCode({ + image: { + imageUri: 'ecr image uri', + cmd: ['cmd', 'param1'], + entrypoint: ['entrypoint', 'param2'], + workingDirectory: '/some/path', + }, + }), + handler: lambda.Handler.FROM_IMAGE, + runtime: lambda.Runtime.FROM_IMAGE, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + ImageConfig: { + Command: ['cmd', 'param1'], + EntryPoint: ['entrypoint', 'param2'], + WorkingDirectory: '/some/path', + }, + }); + }); + }); + + describe('code signing config', () => { + test('default', () => { + const stack = new cdk.Stack(); + + const signingProfile = new signer.SigningProfile(stack, 'SigningProfile', { + platform: signer.Platform.AWS_LAMBDA_SHA384_ECDSA, + }); + + const codeSigningConfig = new lambda.CodeSigningConfig(stack, 'CodeSigningConfig', { + signingProfiles: [signingProfile], + }); + + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + codeSigningConfig, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + CodeSigningConfigArn: { + 'Fn::GetAtt': [ + 'CodeSigningConfigD8D41C10', + 'CodeSigningConfigArn', + ], + }, + }); + }); + }); + + test('error when layers set in a container function', () => { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'Bucket'); + const code = new lambda.S3Code(bucket, 'ObjectKey'); + + const layer = new lambda.LayerVersion(stack, 'Layer', { + code, + }); + + expect(() => new lambda.DockerImageFunction(stack, 'MyLambda', { + code: lambda.DockerImageCode.fromImageAsset(dockerLambdaHandlerPath), + layers: [layer], + })).toThrow(/Layers are not supported for container image functions/); + }); + + testDeprecated('specified architectures is recognized', () => { + const stack = new cdk.Stack(); + new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + + architectures: [lambda.Architecture.ARM_64], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Architectures: ['arm64'], + }); + }); + + test('specified architecture is recognized', () => { + const stack = new cdk.Stack(); + new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + + architecture: lambda.Architecture.ARM_64, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Architectures: ['arm64'], + }); + }); + + testDeprecated('both architectures and architecture are not recognized', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + + architecture: lambda.Architecture.ARM_64, + architectures: [lambda.Architecture.X86_64], + })).toThrow(/architecture or architectures must be specified/); + }); + + testDeprecated('Only one architecture allowed', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + + architectures: [lambda.Architecture.X86_64, lambda.Architecture.ARM_64], + })).toThrow(/one architecture must be specified/); + }); + + test('Architecture is properly readable from the function', () => { + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + architecture: lambda.Architecture.ARM_64, + }); + expect(fn.architecture?.name).toEqual('arm64'); + }); + + test('Error when function name is longer than 64 chars', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + functionName: 'a'.repeat(65), + })).toThrow(/Function name can not be longer than 64 characters/); + }); + + test('Error when function name contains invalid characters', () => { + const stack = new cdk.Stack(); + [' ', '\n', '\r', '[', ']', '<', '>', '$'].forEach(invalidChar => { + expect(() => { + new lambda.Function(stack, `foo${invalidChar}`, { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + functionName: `foo${invalidChar}`, + }); + }).toThrow(/can contain only letters, numbers, hyphens, or underscores with no spaces./); + }); + }); + + test('No error when function name is Tokenized and Unresolved', () => { + const stack = new cdk.Stack(); + expect(() => { + const realFunctionName = 'a'.repeat(141); + const tokenizedFunctionName = cdk.Token.asString(new cdk.Intrinsic(realFunctionName)); + + new lambda.Function(stack, 'foo', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + functionName: tokenizedFunctionName, + }); + }).not.toThrow(); + }); + + test('Error when function description is longer than 256 chars', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyFunction', { + code: lambda.Code.fromInline('foo'), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + description: 'a'.repeat(257), + })).toThrow(/Function description can not be longer than 256 characters/); + }); + + test('No error when function name is Tokenized and Unresolved', () => { + const stack = new cdk.Stack(); + expect(() => { + const realFunctionDescription = 'a'.repeat(257); + const tokenizedFunctionDescription = cdk.Token.asString(new cdk.Intrinsic(realFunctionDescription)); + + new lambda.Function(stack, 'foo', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + description: tokenizedFunctionDescription, + }); + }).not.toThrow(); + }); + + describe('FunctionUrl', () => { + test('addFunctionUrl creates a function url with default options', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + fn.addFunctionUrl(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Url', { + AuthType: 'AWS_IAM', + TargetFunctionArn: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + }); + }); + + test('addFunctionUrl creates a function url with all options', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + fn.addFunctionUrl({ + authType: lambda.FunctionUrlAuthType.NONE, + cors: { + allowCredentials: true, + allowedOrigins: ['https://example.com'], + allowedMethods: [lambda.HttpMethod.GET], + allowedHeaders: ['X-Custom-Header'], + maxAge: cdk.Duration.seconds(300), + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Url', { + AuthType: 'NONE', + TargetFunctionArn: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + Cors: { + AllowCredentials: true, + AllowHeaders: [ + 'X-Custom-Header', + ], + AllowMethods: [ + 'GET', + ], + AllowOrigins: [ + 'https://example.com', + ], + MaxAge: 300, + }, + }); + }); + + test('grantInvokeUrl: adds appropriate permissions', () => { + // GIVEN + const stack = new cdk.Stack(); + const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.AccountPrincipal('1234'), + }); + const fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('hello()'), + handler: 'index.hello', + runtime: lambda.Runtime.NODEJS_14_X, + }); + fn.addFunctionUrl(); + + // WHEN + fn.grantInvokeUrl(role); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: 'lambda:InvokeFunctionUrl', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'MyLambdaCCE802FB', + 'Arn', + ], + }, + }, + ], + }, + }); + }); + }); + + test('called twice for the same service principal but with different conditions', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('xxx'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + const sourceArnA = 'some-arn-a'; + const sourceArnB = 'some-arn-b'; + const service = 's3.amazonaws.com'; + const conditionalPrincipalA = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { + ArnLike: { + 'aws:SourceArn': sourceArnA, + }, + StringEquals: { + 'aws:SourceAccount': stack.account, + }, + }); + const conditionalPrincipalB = new iam.PrincipalWithConditions(new iam.ServicePrincipal(service), { + ArnLike: { + 'aws:SourceArn': sourceArnB, + }, + StringEquals: { + 'aws:SourceAccount': stack.account, + }, + }); + + // WHEN + fn.grantInvoke(conditionalPrincipalA); + fn.grantInvoke(conditionalPrincipalB); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 2); + Template.fromStack(stack).hasResource('AWS::Lambda::Permission', { + Properties: { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: service, + SourceAccount: { + Ref: 'AWS::AccountId', + }, + SourceArn: sourceArnA, + }, + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Permission', { + Properties: { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: service, + SourceAccount: { + Ref: 'AWS::AccountId', + }, + SourceArn: sourceArnB, + }, + }); + }); + + test('adds ADOT instrumentation to a ZIP Lambda function', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'us-west-2' }, + }); + + // WHEN + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + adotInstrumentation: { + layerVersion: lambda.AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_19_0), + execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Layers: ['arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1'], + Environment: { + Variables: { + AWS_LAMBDA_EXEC_WRAPPER: '/opt/otel-handler', + }, + }, + }); + }); + + test('adds ADOT instrumentation to a container image Lambda function', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'us-west-2' }, + }); + + // WHEN + expect( + () => + new lambda.DockerImageFunction(stack, 'MyLambda', { + code: lambda.DockerImageCode.fromImageAsset(dockerLambdaHandlerPath), + adotInstrumentation: { + layerVersion: lambda.AdotLayerVersion.fromJavaSdkLayerVersion(AdotLambdaLayerJavaSdkVersion.V1_19_0), + execWrapper: lambda.AdotLambdaExecWrapper.REGULAR_HANDLER, + }, + }), + ).toThrow(/ADOT Lambda layer can't be configured with container image package type/); + }); +}); + +test('throws if ephemeral storage size is out of bound', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'bar', + runtime: lambda.Runtime.NODEJS_14_X, + ephemeralStorageSize: Size.mebibytes(511), + })).toThrow(/Ephemeral storage size must be between 512 and 10240 MB/); +}); + +test('set ephemeral storage to desired size', () => { + const stack = new cdk.Stack(); + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'bar', + runtime: lambda.Runtime.NODEJS_14_X, + ephemeralStorageSize: Size.mebibytes(1024), + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: + { + Code: { ZipFile: 'foo' }, + Handler: 'bar', + Runtime: 'nodejs14.x', + EphemeralStorage: { + Size: 1024, + }, + }, + }); +}); + +test('ephemeral storage allows unresolved tokens', () => { + const stack = new cdk.Stack(); + expect(() => { + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'bar', + runtime: lambda.Runtime.NODEJS_14_X, + ephemeralStorageSize: Size.mebibytes(Lazy.number({ produce: () => 1024 })), + }); + }).not.toThrow(); +}); + +test('FunctionVersionUpgrade adds new description to function', () => { + const app = new cdk.App({ context: { [cxapi.LAMBDA_RECOGNIZE_LAYER_VERSION]: true } }); + const stack = new cdk.Stack(app); + new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'bar', + runtime: lambda.Runtime.NODEJS_14_X, + description: 'my description', + }); + + Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(cxapi.LAMBDA_RECOGNIZE_LAYER_VERSION)); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: + { + Code: { ZipFile: 'foo' }, + Handler: 'bar', + Runtime: 'nodejs14.x', + Description: 'my description version-hash:54f18c47346ed84843c2dac547de81fa', + }, + }); +}); + +test('function using a reserved environment variable', () => { + const stack = new cdk.Stack(); + expect(() => new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.PYTHON_3_9, + environment: { + AWS_REGION: 'ap-southeast-2', + }, + })).toThrow(/AWS_REGION environment variable is reserved/); +}); + +test('set SnapStart to desired value', () => { + const stack = new cdk.Stack(); + new lambda.CfnFunction(stack, 'MyLambda', { + code: { + zipFile: 'java11-test-function.zip', + }, + functionName: 'MyCDK-SnapStart-Function', + handler: 'example.Handler::handleRequest', + role: 'testRole', + runtime: 'java11', + snapStart: { applyOn: 'PublishedVersions' }, + }); + + Template.fromStack(stack).hasResource('AWS::Lambda::Function', { + Properties: + { + Code: { ZipFile: 'java11-test-function.zip' }, + Handler: 'example.Handler::handleRequest', + Runtime: 'java11', + SnapStart: { + ApplyOn: 'PublishedVersions', + }, + }, + }); +}); + +function newTestLambda(scope: constructs.Construct) { + return new lambda.Function(scope, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'bar', + runtime: lambda.Runtime.PYTHON_3_9, + }); +} diff --git a/packages/@aws-cdk/aws-lambda/test/handler.zip b/packages/aws-cdk-lib/aws-lambda/test/handler.zip similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/handler.zip rename to packages/aws-cdk-lib/aws-lambda/test/handler.zip diff --git a/packages/aws-cdk-lib/aws-lambda/test/integ.assets.lit.ts b/packages/aws-cdk-lib/aws-lambda/test/integ.assets.lit.ts new file mode 100644 index 0000000000000..3a38949760a1c --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/integ.assets.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as cdk from '../../core'; +import * as lambda from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + /// !show + new lambda.Function(this, 'MyLambda', { + code: lambda.Code.fromAsset(path.join(__dirname, 'my-lambda-handler')), + handler: 'index.main', + runtime: lambda.Runtime.PYTHON_3_9, + }); + /// !hide + } +} + +const app = new cdk.App(); + +new TestStack(app, 'lambda-test-assets'); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-lambda/test/integ.autoscaling.lit.ts b/packages/aws-cdk-lib/aws-lambda/test/integ.autoscaling.lit.ts new file mode 100644 index 0000000000000..5c760da9b0bc6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/integ.autoscaling.lit.ts @@ -0,0 +1,58 @@ +import * as appscaling from '../../aws-applicationautoscaling'; +import * as cdk from '../../core'; +import { LAMBDA_RECOGNIZE_LAYER_VERSION } from '../../cx-api'; +import * as lambda from '../lib'; + +/** +* Stack verification steps: +* aws application-autoscaling describe-scalable-targets --service-namespace lambda --resource-ids function::prod +* has a minCapacity of 3 and maxCapacity of 50 +*/ +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const fn = new lambda.Function(this, 'MyLambda', { + code: new lambda.InlineCode('exports.handler = async () => { console.log(\'hello world\'); };'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const version = fn.currentVersion; + + const alias = new lambda.Alias(this, 'Alias', { + aliasName: 'prod', + version, + }); + + const scalingTarget = alias.addAutoScaling({ minCapacity: 3, maxCapacity: 50 }); + + scalingTarget.scaleOnUtilization({ + utilizationTarget: 0.5, + }); + + scalingTarget.scaleOnSchedule('ScaleUpInTheMorning', { + schedule: appscaling.Schedule.cron({ hour: '8', minute: '0' }), + minCapacity: 20, + }); + + scalingTarget.scaleOnSchedule('ScaleDownAtNight', { + schedule: appscaling.Schedule.cron({ hour: '20', minute: '0' }), + maxCapacity: 20, + }); + + new cdk.CfnOutput(this, 'FunctionName', { + value: fn.functionName, + }); + } +} + +const app = new cdk.App(); + +const stack = new TestStack(app, 'aws-lambda-autoscaling'); + +// Changes the function description when the feature flag is present +// to validate the changed function hash. +cdk.Aspects.of(stack).add(new lambda.FunctionVersionUpgrade(LAMBDA_RECOGNIZE_LAYER_VERSION)); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-lambda/test/integ.layer-version.lit.ts b/packages/aws-cdk-lib/aws-lambda/test/integ.layer-version.lit.ts new file mode 100644 index 0000000000000..c6a5dab44ab41 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/integ.layer-version.lit.ts @@ -0,0 +1,34 @@ +import * as path from 'path'; +import * as cdk from '../../core'; +import * as lambda from '../lib'; + +const app = new cdk.App(); + +const stack = new cdk.Stack(app, 'aws-cdk-layer-version-1'); + +// Just for the example - granting to the current account is not necessary. +const awsAccountId = stack.account; + +/// !show +const layer = new lambda.LayerVersion(stack, 'MyLayer', { + code: lambda.Code.fromAsset(path.join(__dirname, 'layer-code')), + compatibleRuntimes: [lambda.Runtime.NODEJS_14_X], + license: 'Apache-2.0', + description: 'A layer to test the L2 construct', +}); + +// To grant usage by other AWS accounts +layer.addPermission('remote-account-grant', { accountId: awsAccountId }); + +// To grant usage to all accounts in some AWS Ogranization +// layer.grantUsage({ accountId: '*', organizationId }); + +new lambda.Function(stack, 'MyLayeredLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + layers: [layer], +}); +/// !hide + +app.synth(); diff --git a/packages/@aws-cdk/aws-lambda/test/lambda-insights.test.ts b/packages/aws-cdk-lib/aws-lambda/test/lambda-insights.test.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/test/lambda-insights.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/lambda-insights.test.ts index 814b1f523cf0f..667e612cab3a3 100644 --- a/packages/@aws-cdk/aws-lambda/test/lambda-insights.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/lambda-insights.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as cdk from '@aws-cdk/core'; -import { Fact, FactName } from '@aws-cdk/region-info'; +import { Match, Template } from '../../assertions'; +import * as ecr from '../../aws-ecr'; +import * as cdk from '../../core'; +import { Fact, FactName } from '../../region-info'; import * as lambda from '../lib'; /** diff --git a/packages/@aws-cdk/aws-lambda/test/lambda-platform.test.ts b/packages/aws-cdk-lib/aws-lambda/test/lambda-platform.test.ts similarity index 93% rename from packages/@aws-cdk/aws-lambda/test/lambda-platform.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/lambda-platform.test.ts index 1b38bd7ea2c8a..5350e89d1f92f 100644 --- a/packages/@aws-cdk/aws-lambda/test/lambda-platform.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/lambda-platform.test.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import { Architecture, DockerImageCode, DockerImageFunction } from '../lib'; describe('lambda platform', () => { diff --git a/packages/@aws-cdk/aws-lambda/test/lambda-version.test.ts b/packages/aws-cdk-lib/aws-lambda/test/lambda-version.test.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/test/lambda-version.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/lambda-version.test.ts index 980104cf626d9..2c7ec1294bbcb 100644 --- a/packages/@aws-cdk/aws-lambda/test/lambda-version.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/lambda-version.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; +import { Template } from '../../assertions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as lambda from '../lib'; describe('lambda version', () => { diff --git a/packages/aws-cdk-lib/aws-lambda/test/layer-code/layer.ts b/packages/aws-cdk-lib/aws-lambda/test/layer-code/layer.ts new file mode 100644 index 0000000000000..de36deb9a37a2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/layer-code/layer.ts @@ -0,0 +1,3 @@ +export async function main(_event: any, _context: any) { + return 'Done!'; +} diff --git a/packages/@aws-cdk/aws-lambda/test/layers.test.ts b/packages/aws-cdk-lib/aws-lambda/test/layers.test.ts similarity index 95% rename from packages/@aws-cdk/aws-lambda/test/layers.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/layers.test.ts index 55771493bebe9..4f04e61d0f23f 100644 --- a/packages/@aws-cdk/aws-lambda/test/layers.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/layers.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as lambda from '../lib'; describe('layers', () => { diff --git a/packages/aws-cdk-lib/aws-lambda/test/my-lambda-handler/index.py b/packages/aws-cdk-lib/aws-lambda/test/my-lambda-handler/index.py new file mode 100644 index 0000000000000..179dcbbb27423 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/my-lambda-handler/index.py @@ -0,0 +1,4 @@ +def main(event, context): + return { + 'message': 'Hello, world!' + } \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-lambda/test/python-lambda-handler/index.py b/packages/aws-cdk-lib/aws-lambda/test/python-lambda-handler/index.py new file mode 100644 index 0000000000000..175a36616590a --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/python-lambda-handler/index.py @@ -0,0 +1,8 @@ +import requests + +def handler(event, context): + r = requests.get('https://aws.amazon.com') + + print(r.status_code) + + return r.status_code diff --git a/packages/aws-cdk-lib/aws-lambda/test/python-lambda-handler/requirements.txt b/packages/aws-cdk-lib/aws-lambda/test/python-lambda-handler/requirements.txt new file mode 100644 index 0000000000000..a8ed785e41af0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lambda/test/python-lambda-handler/requirements.txt @@ -0,0 +1 @@ +requests==2.26.0 diff --git a/packages/@aws-cdk/aws-lambda/test/runtime-management.test.ts b/packages/aws-cdk-lib/aws-lambda/test/runtime-management.test.ts similarity index 95% rename from packages/@aws-cdk/aws-lambda/test/runtime-management.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/runtime-management.test.ts index 62a294e9724c7..a66b1a744834c 100644 --- a/packages/@aws-cdk/aws-lambda/test/runtime-management.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/runtime-management.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as lambda from '../lib'; describe('runtime', () => { diff --git a/packages/@aws-cdk/aws-lambda/test/runtime.test.ts b/packages/aws-cdk-lib/aws-lambda/test/runtime.test.ts similarity index 100% rename from packages/@aws-cdk/aws-lambda/test/runtime.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/runtime.test.ts diff --git a/packages/@aws-cdk/aws-lambda/test/singleton-lambda.test.ts b/packages/aws-cdk-lib/aws-lambda/test/singleton-lambda.test.ts similarity index 97% rename from packages/@aws-cdk/aws-lambda/test/singleton-lambda.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/singleton-lambda.test.ts index 5927cc3278798..b25b64879b0b2 100644 --- a/packages/@aws-cdk/aws-lambda/test/singleton-lambda.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/singleton-lambda.test.ts @@ -1,9 +1,9 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as lambda from '../lib'; describe('singleton lambda', () => { diff --git a/packages/@aws-cdk/aws-lambda/test/vpc-lambda.test.ts b/packages/aws-cdk-lib/aws-lambda/test/vpc-lambda.test.ts similarity index 98% rename from packages/@aws-cdk/aws-lambda/test/vpc-lambda.test.ts rename to packages/aws-cdk-lib/aws-lambda/test/vpc-lambda.test.ts index 7efe2dfceab49..5d27ef1623282 100644 --- a/packages/@aws-cdk/aws-lambda/test/vpc-lambda.test.ts +++ b/packages/aws-cdk-lib/aws-lambda/test/vpc-lambda.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as lambda from '../lib'; describe('lambda + vpc', () => { diff --git a/packages/aws-cdk-lib/aws-lex/.jsiirc.json b/packages/aws-cdk-lib/aws-lex/.jsiirc.json new file mode 100644 index 0000000000000..5f3177107c9d1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lex/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Lex" + }, + "java": { + "package": "software.amazon.awscdk.services.lex" + }, + "python": { + "module": "aws_cdk.aws_lex" + } + } +} diff --git a/packages/aws-cdk-lib/aws-lex/README.md b/packages/aws-cdk-lib/aws-lex/README.md new file mode 100644 index 0000000000000..d997c33d2c5dd --- /dev/null +++ b/packages/aws-cdk-lib/aws-lex/README.md @@ -0,0 +1,27 @@ +# AWS::Lex Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as lex from 'aws-cdk-lib/aws-lex'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Lex construct libraries](https://constructs.dev/search?q=lex) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Lex resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lex.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Lex](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lex.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-lex/index.ts b/packages/aws-cdk-lib/aws-lex/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-lex/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-lex/lib/index.ts b/packages/aws-cdk-lib/aws-lex/lib/index.ts new file mode 100644 index 0000000000000..36dbffa526a9b --- /dev/null +++ b/packages/aws-cdk-lib/aws-lex/lib/index.ts @@ -0,0 +1 @@ +export * from './lex.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-licensemanager/.jsiirc.json b/packages/aws-cdk-lib/aws-licensemanager/.jsiirc.json new file mode 100644 index 0000000000000..79127b945911b --- /dev/null +++ b/packages/aws-cdk-lib/aws-licensemanager/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.LicenseManager" + }, + "java": { + "package": "software.amazon.awscdk.services.licensemanager" + }, + "python": { + "module": "aws_cdk.aws_licensemanager" + } + } +} diff --git a/packages/aws-cdk-lib/aws-licensemanager/README.md b/packages/aws-cdk-lib/aws-licensemanager/README.md new file mode 100644 index 0000000000000..6a0345748228f --- /dev/null +++ b/packages/aws-cdk-lib/aws-licensemanager/README.md @@ -0,0 +1,27 @@ +# AWS::LicenseManager Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as licensemanager from 'aws-cdk-lib/aws-licensemanager'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for LicenseManager construct libraries](https://constructs.dev/search?q=licensemanager) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LicenseManager resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LicenseManager.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LicenseManager](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LicenseManager.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-licensemanager/index.ts b/packages/aws-cdk-lib/aws-licensemanager/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-licensemanager/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-licensemanager/lib/index.ts b/packages/aws-cdk-lib/aws-licensemanager/lib/index.ts new file mode 100644 index 0000000000000..65b4db24bb439 --- /dev/null +++ b/packages/aws-cdk-lib/aws-licensemanager/lib/index.ts @@ -0,0 +1 @@ +export * from './licensemanager.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-lightsail/.jsiirc.json b/packages/aws-cdk-lib/aws-lightsail/.jsiirc.json new file mode 100644 index 0000000000000..715d8c1610d55 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lightsail/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Lightsail" + }, + "java": { + "package": "software.amazon.awscdk.services.lightsail" + }, + "python": { + "module": "aws_cdk.aws_lightsail" + } + } +} diff --git a/packages/aws-cdk-lib/aws-lightsail/README.md b/packages/aws-cdk-lib/aws-lightsail/README.md new file mode 100644 index 0000000000000..f66bad0effc6e --- /dev/null +++ b/packages/aws-cdk-lib/aws-lightsail/README.md @@ -0,0 +1,27 @@ +# AWS::Lightsail Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as lightsail from 'aws-cdk-lib/aws-lightsail'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Lightsail construct libraries](https://constructs.dev/search?q=lightsail) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Lightsail resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lightsail.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Lightsail](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Lightsail.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-lightsail/index.ts b/packages/aws-cdk-lib/aws-lightsail/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-lightsail/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-lightsail/lib/index.ts b/packages/aws-cdk-lib/aws-lightsail/lib/index.ts new file mode 100644 index 0000000000000..8249cbc034312 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lightsail/lib/index.ts @@ -0,0 +1 @@ +export * from './lightsail.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-location/.jsiirc.json b/packages/aws-cdk-lib/aws-location/.jsiirc.json new file mode 100644 index 0000000000000..f3a33148ea4b1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-location/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Location" + }, + "java": { + "package": "software.amazon.awscdk.services.location" + }, + "python": { + "module": "aws_cdk.aws_location" + } + } +} diff --git a/packages/aws-cdk-lib/aws-location/README.md b/packages/aws-cdk-lib/aws-location/README.md new file mode 100644 index 0000000000000..4c67e9af9a645 --- /dev/null +++ b/packages/aws-cdk-lib/aws-location/README.md @@ -0,0 +1,32 @@ +# AWS::Location Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as location from 'aws-cdk-lib/aws-location'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Location construct libraries](https://constructs.dev/search?q=location) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Location resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Location.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-location-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Location](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Location.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-location/index.ts b/packages/aws-cdk-lib/aws-location/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-location/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-location/lib/index.ts b/packages/aws-cdk-lib/aws-location/lib/index.ts new file mode 100644 index 0000000000000..27245d1f48d4b --- /dev/null +++ b/packages/aws-cdk-lib/aws-location/lib/index.ts @@ -0,0 +1 @@ +export * from './location.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-logs-destinations/.jsiirc.json b/packages/aws-cdk-lib/aws-logs-destinations/.jsiirc.json new file mode 100644 index 0000000000000..98c5f8acd8ce7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.logs.destinations" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Logs.Destinations" + }, + "python": { + "module": "aws_cdk.aws_logs_destinations" + } + } +} diff --git a/packages/aws-cdk-lib/aws-logs-destinations/README.md b/packages/aws-cdk-lib/aws-logs-destinations/README.md new file mode 100644 index 0000000000000..89d2efc7b64c1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/README.md @@ -0,0 +1,7 @@ +# AWS CloudWatch Logs Subscription Destination Library + + +This library contains destinations for AWS CloudWatch Logs SubscriptionFilters. You +can send log data to Kinesis Streams or Lambda Functions. + +See the documentation of the `logs` module for more information. diff --git a/packages/aws-cdk-lib/aws-logs-destinations/index.ts b/packages/aws-cdk-lib/aws-logs-destinations/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-logs-destinations/lib/index.ts b/packages/aws-cdk-lib/aws-logs-destinations/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-logs-destinations/lib/index.ts rename to packages/aws-cdk-lib/aws-logs-destinations/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-logs-destinations/lib/kinesis.ts b/packages/aws-cdk-lib/aws-logs-destinations/lib/kinesis.ts new file mode 100644 index 0000000000000..87b3083a9eba7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/lib/kinesis.ts @@ -0,0 +1,52 @@ +import * as iam from '../../aws-iam'; +import * as kinesis from '../../aws-kinesis'; +import * as logs from '../../aws-logs'; +import { Construct } from 'constructs'; + +/** + * Customize the Kinesis Logs Destination + */ +export interface KinesisDestinationProps { + /** + * The role to assume to write log events to the destination + * + * @default - A new Role is created + */ + readonly role?: iam.IRole; +} + +/** + * Use a Kinesis stream as the destination for a log subscription + */ +export class KinesisDestination implements logs.ILogSubscriptionDestination { + /** + * @param stream The Kinesis stream to use as destination + * @param props The Kinesis Destination properties + * + */ + constructor(private readonly stream: kinesis.IStream, private readonly props: KinesisDestinationProps = {}) { + } + + public bind(scope: Construct, _sourceLogGroup: logs.ILogGroup): logs.LogSubscriptionDestinationConfig { + // Following example from https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#DestinationKinesisExample + // Create a role to be assumed by CWL that can write to this stream and pass itself. + const id = 'CloudWatchLogsCanPutRecords'; + const role = this.props.role ?? scope.node.tryFindChild(id) as iam.IRole ?? new iam.Role(scope, id, { + assumedBy: new iam.ServicePrincipal('logs.amazonaws.com'), + }); + this.stream.grantWrite(role); + role.grantPassRole(role); + + const policy = role.node.tryFindChild('DefaultPolicy') as iam.CfnPolicy; + if (policy) { + // Remove circular dependency + const cfnRole = role.node.defaultChild as iam.CfnRole; + cfnRole.addOverride('DependsOn', undefined); + + // Ensure policy is created before subscription filter + scope.node.addDependency(policy); + } + + return { arn: this.stream.streamArn, role }; + } +} diff --git a/packages/aws-cdk-lib/aws-logs-destinations/lib/lambda.ts b/packages/aws-cdk-lib/aws-logs-destinations/lib/lambda.ts new file mode 100644 index 0000000000000..5df8024a4a7b6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/lib/lambda.ts @@ -0,0 +1,46 @@ +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as logs from '../../aws-logs'; +import { Construct } from 'constructs'; + +/** + * Options that may be provided to LambdaDestination + */ +export interface LambdaDestinationOptions { + /** Whether or not to add Lambda Permissions. + * @default true + */ + readonly addPermissions?: boolean; +} + +/** + * Use a Lambda Function as the destination for a log subscription + */ +export class LambdaDestination implements logs.ILogSubscriptionDestination { + /** LambdaDestinationOptions */ + constructor(private readonly fn: lambda.IFunction, private readonly options: LambdaDestinationOptions = {}) { + } + + public bind(scope: Construct, logGroup: logs.ILogGroup): logs.LogSubscriptionDestinationConfig { + const arn = logGroup.logGroupArn; + if (this.options.addPermissions !== false) { + const permissionId = 'CanInvokeLambda'; + this.fn.addPermission(permissionId, { + principal: new iam.ServicePrincipal('logs.amazonaws.com'), + sourceArn: arn, + // Using SubScription Filter as scope is okay, since every Subscription Filter has only + // one destination. + scope, + }); + // Need to add a dependency, otherwise the SubscriptionFilter can be created before the + // Permission that allows the interaction. + const cfnPermission = scope.node.tryFindChild( + permissionId, + ) as lambda.CfnPermission; + if (cfnPermission) { + scope.node.addDependency(cfnPermission); + } + } + return { arn: this.fn.functionArn }; + } +} diff --git a/packages/aws-cdk-lib/aws-logs-destinations/test/kinesis.test.ts b/packages/aws-cdk-lib/aws-logs-destinations/test/kinesis.test.ts new file mode 100644 index 0000000000000..2062168fa3ee8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/test/kinesis.test.ts @@ -0,0 +1,195 @@ +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kinesis from '../../aws-kinesis'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; +import * as dests from '../lib'; + +test('stream can be subscription destination', () => { + // GIVEN + const stack = new cdk.Stack(); + const stream = new kinesis.Stream(stack, 'MyStream'); + const logGroup = new logs.LogGroup(stack, 'LogGroup'); + + // WHEN + new logs.SubscriptionFilter(stack, 'Subscription', { + logGroup, + destination: new dests.KinesisDestination(stream), + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN: subscription target is Stream + Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { + DestinationArn: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, + RoleArn: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, + }); + + // THEN: we have a role to write to the Stream + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Version: '2012-10-17', + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: { + 'Fn::Join': ['', [ + 'logs.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + }, + }], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: [ + 'kinesis:ListShards', + 'kinesis:PutRecord', + 'kinesis:PutRecords', + ], + Effect: 'Allow', + Resource: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, + }, + { + Action: 'iam:PassRole', + Effect: 'Allow', + Resource: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, + }, + ], + }, + }); +}); + +test('stream can be subscription destination twice, without duplicating permissions', () => { + // GIVEN + const stack = new cdk.Stack(); + const stream = new kinesis.Stream(stack, 'MyStream'); + const logGroup1 = new logs.LogGroup(stack, 'LogGroup'); + const logGroup2 = new logs.LogGroup(stack, 'LogGroup2'); + + // WHEN + new logs.SubscriptionFilter(stack, 'Subscription', { + logGroup: logGroup1, + destination: new dests.KinesisDestination(stream), + filterPattern: logs.FilterPattern.allEvents(), + }); + + new logs.SubscriptionFilter(stack, 'Subscription2', { + logGroup: logGroup2, + destination: new dests.KinesisDestination(stream), + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN: subscription target is Stream + Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { + DestinationArn: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, + RoleArn: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, + }); + + // THEN: we have a role to write to the Stream + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Version: '2012-10-17', + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: { + 'Fn::Join': ['', [ + 'logs.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + }, + }], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [ + { + Action: [ + 'kinesis:ListShards', + 'kinesis:PutRecord', + 'kinesis:PutRecords', + ], + Effect: 'Allow', + Resource: { 'Fn::GetAtt': ['MyStream5C050E93', 'Arn'] }, + }, + { + Action: 'iam:PassRole', + Effect: 'Allow', + Resource: { 'Fn::GetAtt': ['SubscriptionCloudWatchLogsCanPutRecords9C1223EC', 'Arn'] }, + }, + ], + }, + }); +}); + +test('an existing IAM role can be passed to new destination instance instead of auto-created ', ()=> { + // GIVEN + const stack = new cdk.Stack(); + const stream = new kinesis.Stream(stack, 'MyStream'); + const logGroup = new logs.LogGroup(stack, 'LogGroup'); + + const importedRole = iam.Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::123456789012:role/ImportedRoleKinesisDestinationTest'); + + const kinesisDestination = new dests.KinesisDestination(stream, { role: importedRole }); + + new logs.SubscriptionFilter(logGroup, 'MySubscriptionFilter', { + logGroup: logGroup, + destination: kinesisDestination, + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN + const template = Template.fromStack(stack); + template.resourceCountIs('AWS::IAM::Role', 0); + template.hasResourceProperties('AWS::Logs::SubscriptionFilter', { + RoleArn: importedRole.roleArn, + }); +}); + +test('creates a new IAM Role if not passed on new destination instance', ()=> { + // GIVEN + const stack = new cdk.Stack(); + const stream = new kinesis.Stream(stack, 'MyStream'); + const logGroup = new logs.LogGroup(stack, 'LogGroup'); + + const kinesisDestination = new dests.KinesisDestination(stream); + + new logs.SubscriptionFilter(logGroup, 'MySubscriptionFilter', { + logGroup: logGroup, + destination: kinesisDestination, + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN + const template = Template.fromStack(stack); + template.resourceCountIs('AWS::IAM::Role', 1); + template.hasResourceProperties('AWS::Logs::SubscriptionFilter', { + RoleArn: { + 'Fn::GetAtt': [ + 'LogGroupMySubscriptionFilterCloudWatchLogsCanPutRecords9112BD02', + 'Arn', + ], + }, + }); + + // THEN: SubscriptionFilter depends on the default Role's Policy + template.hasResource('AWS::Logs::SubscriptionFilter', { + DependsOn: ['LogGroupMySubscriptionFilterCloudWatchLogsCanPutRecordsDefaultPolicyEC6729D5'], + }); +}); diff --git a/packages/aws-cdk-lib/aws-logs-destinations/test/lambda.test.ts b/packages/aws-cdk-lib/aws-logs-destinations/test/lambda.test.ts new file mode 100644 index 0000000000000..1680e29aeba92 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs-destinations/test/lambda.test.ts @@ -0,0 +1,106 @@ +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; +import * as dests from '../lib'; + +let stack: cdk.Stack; +let fn: lambda.Function; +let logGroup: logs.LogGroup; + +beforeEach(() => { + // GIVEN + stack = new cdk.Stack(); + fn = new lambda.Function(stack, 'MyLambda', { + code: new lambda.InlineCode('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + logGroup = new logs.LogGroup(stack, 'LogGroup'); +}); + +test('lambda can be used as metric subscription destination', () => { + // WHEN + new logs.SubscriptionFilter(stack, 'Subscription', { + logGroup, + destination: new dests.LambdaDestination(fn), + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN: subscription target is Lambda + Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { + DestinationArn: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + }); + + // THEN: Lambda has permissions to be invoked by CWL + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + Principal: 'logs.amazonaws.com', + }); +}); + +test('can have multiple subscriptions use the same Lambda', () => { + // WHEN + new logs.SubscriptionFilter(stack, 'Subscription', { + logGroup, + destination: new dests.LambdaDestination(fn), + filterPattern: logs.FilterPattern.allEvents(), + }); + + new logs.SubscriptionFilter(stack, 'Subscription2', { + logGroup: new logs.LogGroup(stack, 'LG2'), + destination: new dests.LambdaDestination(fn), + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN: Lambda has permissions to be invoked by CWL from both Source Arns + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + SourceArn: { 'Fn::GetAtt': ['LogGroupF5B46931', 'Arn'] }, + Principal: 'logs.amazonaws.com', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + SourceArn: { 'Fn::GetAtt': ['LG224A94C8F', 'Arn'] }, + Principal: 'logs.amazonaws.com', + }); +}); + +test('lambda permissions are not added when addPermissions is false', () => { + // WHEN + new logs.SubscriptionFilter(stack, 'Subscription', { + logGroup, + destination: new dests.LambdaDestination(fn, { addPermissions: false }), + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN: subscription target is Lambda + Template.fromStack(stack).hasResourceProperties('AWS::Logs::SubscriptionFilter', { + DestinationArn: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + }); + + // THEN: Lambda does not have permissions to be invoked by CWL + expect(Template.fromStack(stack).findResources('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { 'Fn::GetAtt': ['MyLambdaCCE802FB', 'Arn'] }, + Principal: 'logs.amazonaws.com', + })).toEqual({}); +}); + +test('subscription depends on lambda\'s permission', () => { + // WHEN + new logs.SubscriptionFilter(stack, 'Subscription', { + logGroup, + destination: new dests.LambdaDestination(fn), + filterPattern: logs.FilterPattern.allEvents(), + }); + + // THEN: Subscription filter depends on Lambda's Permission + Template.fromStack(stack).hasResource('AWS::Logs::SubscriptionFilter', { + DependsOn: ['SubscriptionCanInvokeLambdaD31DEAD2'], + }); +}); diff --git a/packages/aws-cdk-lib/aws-logs/.jsiirc.json b/packages/aws-cdk-lib/aws-logs/.jsiirc.json new file mode 100644 index 0000000000000..87e056d6055ea --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.logs" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Logs" + }, + "python": { + "module": "aws_cdk.aws_logs" + } + } +} diff --git a/packages/aws-cdk-lib/aws-logs/README.md b/packages/aws-cdk-lib/aws-logs/README.md new file mode 100644 index 0000000000000..c0ae8f57858fc --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/README.md @@ -0,0 +1,341 @@ +# Amazon CloudWatch Logs Construct Library + + +This library supplies constructs for working with CloudWatch Logs. + +## Log Groups/Streams + +The basic unit of CloudWatch is a *Log Group*. Every log group typically has the +same kind of data logged to it, in the same format. If there are multiple +applications or services logging into the Log Group, each of them creates a new +*Log Stream*. + +Every log operation creates a "log event", which can consist of a simple string +or a single-line JSON object. JSON objects have the advantage that they afford +more filtering abilities (see below). + +The only configurable attribute for log streams is the retention period, which +configures after how much time the events in the log stream expire and are +deleted. + +The default retention period if not supplied is 2 years, but it can be set to +one of the values in the `RetentionDays` enum to configure a different +retention period (including infinite retention). + +[retention example](test/example.retention.lit.ts) + +## LogRetention + +The `LogRetention` construct is a way to control the retention period of log groups that are created outside of the CDK. The construct is usually +used on log groups that are auto created by AWS services, such as [AWS +lambda](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html). + +This is implemented using a [CloudFormation custom +resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html) +which pre-creates the log group if it doesn't exist, and sets the specified log retention period (never expire, by default). + +By default, the log group will be created in the same region as the stack. The `logGroupRegion` property can be used to configure +log groups in other regions. This is typically useful when controlling retention for log groups auto-created by global services that +publish their log group to a specific region, such as AWS Chatbot creating a log group in `us-east-1`. + +By default, the log group created by LogRetention will be retained after the stack is deleted. If the RemovalPolicy is set to DESTROY, then the log group will be deleted when the stack is deleted. + +## Resource Policy + +CloudWatch Resource Policies allow other AWS services or IAM Principals to put log events into the log groups. +A resource policy is automatically created when `addToResourcePolicy` is called on the LogGroup for the first time: + +```ts +const logGroup = new logs.LogGroup(this, 'LogGroup'); +logGroup.addToResourcePolicy(new iam.PolicyStatement({ + actions: ['logs:CreateLogStream', 'logs:PutLogEvents'], + principals: [new iam.ServicePrincipal('es.amazonaws.com')], + resources: [logGroup.logGroupArn], +})); +``` + +Or more conveniently, write permissions to the log group can be granted as follows which gives same result as in the above example. + +```ts +const logGroup = new logs.LogGroup(this, 'LogGroup'); +logGroup.grantWrite(new iam.ServicePrincipal('es.amazonaws.com')); +``` + +Similarily, read permissions can be granted to the log group as follows. + +```ts +const logGroup = new logs.LogGroup(this, 'LogGroup'); +logGroup.grantRead(new iam.ServicePrincipal('es.amazonaws.com')); +``` + +Be aware that any ARNs or tokenized values passed to the resource policy will be converted into AWS Account IDs. +This is because CloudWatch Logs Resource Policies do not accept ARNs as principals, but they do accept +Account ID strings. Non-ARN principals, like Service principals or Any principals, are accepted by CloudWatch. + +## Encrypting Log Groups + +By default, log group data is always encrypted in CloudWatch Logs. You have the +option to encrypt log group data using a AWS KMS customer master key (CMK) should +you not wish to use the default AWS encryption. Keep in mind that if you decide to +encrypt a log group, any service or IAM identity that needs to read the encrypted +log streams in the future will require the same CMK to decrypt the data. + +Here's a simple example of creating an encrypted Log Group using a KMS CMK. + +```ts +import * as kms from 'aws-cdk-lib/aws-kms'; + +new logs.LogGroup(this, 'LogGroup', { + encryptionKey: new kms.Key(this, 'Key'), +}); +``` + +See the AWS documentation for more detailed information about [encrypting CloudWatch +Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/encrypt-log-data-kms.html). + +## Subscriptions and Destinations + +Log events matching a particular filter can be sent to either a Lambda function +or a Kinesis stream. + +If the Kinesis stream lives in a different account, a `CrossAccountDestination` +object needs to be added in the destination account which will act as a proxy +for the remote Kinesis stream. This object is automatically created for you +if you use the CDK Kinesis library. + +Create a `SubscriptionFilter`, initialize it with an appropriate `Pattern` (see +below) and supply the intended destination: + +```ts +import * as destinations from 'aws-cdk-lib/aws-logs-destinations'; +declare const fn: lambda.Function; +declare const logGroup: logs.LogGroup; + +new logs.SubscriptionFilter(this, 'Subscription', { + logGroup, + destination: new destinations.LambdaDestination(fn), + filterPattern: logs.FilterPattern.allTerms("ERROR", "MainThread"), +}); +``` + +## Metric Filters + +CloudWatch Logs can extract and emit metrics based on a textual log stream. +Depending on your needs, this may be a more convenient way of generating metrics +for you application than making calls to CloudWatch Metrics yourself. + +A `MetricFilter` either emits a fixed number every time it sees a log event +matching a particular pattern (see below), or extracts a number from the log +event and uses that as the metric value. + +Example: + +[metricfilter example](test/integ.metricfilter.lit.ts) + +Remember that if you want to use a value from the log event as the metric value, +you must mention it in your pattern somewhere. + +A very simple MetricFilter can be created by using the `logGroup.extractMetric()` +helper function: + +```ts +declare const logGroup: logs.LogGroup; +logGroup.extractMetric('$.jsonField', 'Namespace', 'MetricName'); +``` + +Will extract the value of `jsonField` wherever it occurs in JSON-structured +log records in the LogGroup, and emit them to CloudWatch Metrics under +the name `Namespace/MetricName`. + +### Exposing Metric on a Metric Filter + +You can expose a metric on a metric filter by calling the `MetricFilter.metric()` API. +This has a default of `statistic = 'avg'` if the statistic is not set in the `props`. + +```ts +declare const logGroup: logs.LogGroup; +const mf = new logs.MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: logs.FilterPattern.exists('$.latency'), + metricValue: '$.latency', + dimensions: { + ErrorCode: '$.errorCode', + }, + unit: Unit.MILLISECONDS, +}); + +//expose a metric from the metric filter +const metric = mf.metric(); + +//you can use the metric to create a new alarm +new cloudwatch.Alarm(this, 'alarm from metric filter', { + metric, + threshold: 100, + evaluationPeriods: 2, +}); +``` + +## Patterns + +Patterns describe which log events match a subscription or metric filter. There +are three types of patterns: + +* Text patterns +* JSON patterns +* Space-delimited table patterns + +All patterns are constructed by using static functions on the `FilterPattern` +class. + +In addition to the patterns above, the following special patterns exist: + +* `FilterPattern.allEvents()`: matches all log events. +* `FilterPattern.literal(string)`: if you already know what pattern expression to + use, this function takes a string and will use that as the log pattern. For + more information, see the [Filter and Pattern + Syntax](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html). + +### Text Patterns + +Text patterns match if the literal strings appear in the text form of the log +line. + +* `FilterPattern.allTerms(term, term, ...)`: matches if all of the given terms + (substrings) appear in the log event. +* `FilterPattern.anyTerm(term, term, ...)`: matches if all of the given terms + (substrings) appear in the log event. +* `FilterPattern.anyTermGroup([term, term, ...], [term, term, ...], ...)`: matches if + all of the terms in any of the groups (specified as arrays) matches. This is + an OR match. + +Examples: + +```ts +// Search for lines that contain both "ERROR" and "MainThread" +const pattern1 = logs.FilterPattern.allTerms('ERROR', 'MainThread'); + +// Search for lines that either contain both "ERROR" and "MainThread", or +// both "WARN" and "Deadlock". +const pattern2 = logs.FilterPattern.anyTermGroup( + ['ERROR', 'MainThread'], + ['WARN', 'Deadlock'], +); +``` + +## JSON Patterns + +JSON patterns apply if the log event is the JSON representation of an object +(without any other characters, so it cannot include a prefix such as timestamp +or log level). JSON patterns can make comparisons on the values inside the +fields. + +* **Strings**: the comparison operators allowed for strings are `=` and `!=`. + String values can start or end with a `*` wildcard. +* **Numbers**: the comparison operators allowed for numbers are `=`, `!=`, + `<`, `<=`, `>`, `>=`. + +Fields in the JSON structure are identified by identifier the complete object as `$` +and then descending into it, such as `$.field` or `$.list[0].field`. + +* `FilterPattern.stringValue(field, comparison, string)`: matches if the given + field compares as indicated with the given string value. +* `FilterPattern.numberValue(field, comparison, number)`: matches if the given + field compares as indicated with the given numerical value. +* `FilterPattern.isNull(field)`: matches if the given field exists and has the + value `null`. +* `FilterPattern.notExists(field)`: matches if the given field is not in the JSON + structure. +* `FilterPattern.exists(field)`: matches if the given field is in the JSON + structure. +* `FilterPattern.booleanValue(field, boolean)`: matches if the given field + is exactly the given boolean value. +* `FilterPattern.all(jsonPattern, jsonPattern, ...)`: matches if all of the + given JSON patterns match. This makes an AND combination of the given + patterns. +* `FilterPattern.any(jsonPattern, jsonPattern, ...)`: matches if any of the + given JSON patterns match. This makes an OR combination of the given + patterns. + +Example: + +```ts +// Search for all events where the component field is equal to +// "HttpServer" and either error is true or the latency is higher +// than 1000. +const pattern = logs.FilterPattern.all( + logs.FilterPattern.stringValue('$.component', '=', 'HttpServer'), + logs.FilterPattern.any( + logs.FilterPattern.booleanValue('$.error', true), + logs.FilterPattern.numberValue('$.latency', '>', 1000), + ), +); +``` + +## Space-delimited table patterns + +If the log events are rows of a space-delimited table, this pattern can be used +to identify the columns in that structure and add conditions on any of them. The +canonical example where you would apply this type of pattern is Apache server +logs. + +Text that is surrounded by `"..."` quotes or `[...]` square brackets will +be treated as one column. + +* `FilterPattern.spaceDelimited(column, column, ...)`: construct a + `SpaceDelimitedTextPattern` object with the indicated columns. The columns + map one-by-one the columns found in the log event. The string `"..."` may + be used to specify an arbitrary number of unnamed columns anywhere in the + name list (but may only be specified once). + +After constructing a `SpaceDelimitedTextPattern`, you can use the following +two members to add restrictions: + +* `pattern.whereString(field, comparison, string)`: add a string condition. + The rules are the same as for JSON patterns. +* `pattern.whereNumber(field, comparison, number)`: add a numerical condition. + The rules are the same as for JSON patterns. + +Multiple restrictions can be added on the same column; they must all apply. + +Example: + +```ts +// Search for all events where the component is "HttpServer" and the +// result code is not equal to 200. +const pattern = logs.FilterPattern.spaceDelimited('time', 'component', '...', 'result_code', 'latency') + .whereString('component', '=', 'HttpServer') + .whereNumber('result_code', '!=', 200); +``` + +## Logs Insights Query Definition + +Creates a query definition for CloudWatch Logs Insights. + +Example: + +```ts +new logs.QueryDefinition(this, 'QueryDefinition', { + queryDefinitionName: 'MyQuery', + queryString: new logs.QueryString({ + fields: ['@timestamp', '@message'], + parseStatements: [ + '@message "[*] *" as loggingType, loggingMessage', + '@message "<*>: *" as differentLoggingType, differentLoggingMessage', + ], + filterStatements: [ + 'loggingType = "ERROR"', + 'loggingMessage = "A very strange error occurred!"', + ], + sort: '@timestamp desc', + limit: 20, + }), +}); +``` + +## Notes + +Be aware that Log Group ARNs will always have the string `:*` appended to +them, to match the behavior of [the CloudFormation `AWS::Logs::LogGroup` +resource](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#aws-resource-logs-loggroup-return-values). diff --git a/packages/aws-cdk-lib/aws-logs/index.ts b/packages/aws-cdk-lib/aws-logs/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts b/packages/aws-cdk-lib/aws-logs/lib/cross-account-destination.ts similarity index 96% rename from packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts rename to packages/aws-cdk-lib/aws-logs/lib/cross-account-destination.ts index c9f58d8b546a1..fa2df279497da 100644 --- a/packages/@aws-cdk/aws-logs/lib/cross-account-destination.ts +++ b/packages/aws-cdk-lib/aws-logs/lib/cross-account-destination.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import { ArnFormat } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import { ArnFormat } from '../../core'; import { Construct } from 'constructs'; import { ILogGroup } from './log-group'; import { CfnDestination } from './logs.generated'; diff --git a/packages/@aws-cdk/aws-logs/lib/index.ts b/packages/aws-cdk-lib/aws-logs/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-logs/lib/index.ts rename to packages/aws-cdk-lib/aws-logs/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-logs/lib/log-group.ts b/packages/aws-cdk-lib/aws-logs/lib/log-group.ts new file mode 100644 index 0000000000000..48c5f25bf632f --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/lib/log-group.ts @@ -0,0 +1,579 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { Arn, ArnFormat, RemovalPolicy, Resource, Stack, Token } from '../../core'; +import { Construct } from 'constructs'; +import { LogStream } from './log-stream'; +import { CfnLogGroup } from './logs.generated'; +import { MetricFilter } from './metric-filter'; +import { FilterPattern, IFilterPattern } from './pattern'; +import { ResourcePolicy } from './policy'; +import { ILogSubscriptionDestination, SubscriptionFilter } from './subscription-filter'; + +export interface ILogGroup extends iam.IResourceWithPolicy { + /** + * The ARN of this log group, with ':*' appended + * + * @attribute + */ + readonly logGroupArn: string; + + /** + * The name of this log group + * @attribute + */ + readonly logGroupName: string; + + /** + * Create a new Log Stream for this Log Group + * + * @param id Unique identifier for the construct in its parent + * @param props Properties for creating the LogStream + */ + addStream(id: string, props?: StreamOptions): LogStream; + + /** + * Create a new Subscription Filter on this Log Group + * + * @param id Unique identifier for the construct in its parent + * @param props Properties for creating the SubscriptionFilter + */ + addSubscriptionFilter(id: string, props: SubscriptionFilterOptions): SubscriptionFilter; + + /** + * Create a new Metric Filter on this Log Group + * + * @param id Unique identifier for the construct in its parent + * @param props Properties for creating the MetricFilter + */ + addMetricFilter(id: string, props: MetricFilterOptions): MetricFilter; + + /** + * Extract a metric from structured log events in the LogGroup + * + * Creates a MetricFilter on this LogGroup that will extract the value + * of the indicated JSON field in all records where it occurs. + * + * The metric will be available in CloudWatch Metrics under the + * indicated namespace and name. + * + * @param jsonField JSON field to extract (example: '$.myfield') + * @param metricNamespace Namespace to emit the metric under + * @param metricName Name to emit the metric under + * @returns A Metric object representing the extracted metric + */ + extractMetric(jsonField: string, metricNamespace: string, metricName: string): cloudwatch.Metric; + + /** + * Give permissions to write to create and write to streams in this log group + */ + grantWrite(grantee: iam.IGrantable): iam.Grant; + + /** + * Give permissions to read from this log group and streams + */ + grantRead(grantee: iam.IGrantable): iam.Grant; + + /** + * Give the indicated permissions on this log group and all streams + */ + grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant; + + /** + * Public method to get the physical name of this log group + */ + logGroupPhysicalName(): string; +} + +/** + * An CloudWatch Log Group + */ +abstract class LogGroupBase extends Resource implements ILogGroup { + /** + * The ARN of this log group, with ':*' appended + */ + public abstract readonly logGroupArn: string; + + /** + * The name of this log group + */ + public abstract readonly logGroupName: string; + + + private policy?: ResourcePolicy; + + /** + * Create a new Log Stream for this Log Group + * + * @param id Unique identifier for the construct in its parent + * @param props Properties for creating the LogStream + */ + public addStream(id: string, props: StreamOptions = {}): LogStream { + return new LogStream(this, id, { + logGroup: this, + ...props, + }); + } + + /** + * Create a new Subscription Filter on this Log Group + * + * @param id Unique identifier for the construct in its parent + * @param props Properties for creating the SubscriptionFilter + */ + public addSubscriptionFilter(id: string, props: SubscriptionFilterOptions): SubscriptionFilter { + return new SubscriptionFilter(this, id, { + logGroup: this, + ...props, + }); + } + + /** + * Create a new Metric Filter on this Log Group + * + * @param id Unique identifier for the construct in its parent + * @param props Properties for creating the MetricFilter + */ + public addMetricFilter(id: string, props: MetricFilterOptions): MetricFilter { + return new MetricFilter(this, id, { + logGroup: this, + ...props, + }); + } + + /** + * Extract a metric from structured log events in the LogGroup + * + * Creates a MetricFilter on this LogGroup that will extract the value + * of the indicated JSON field in all records where it occurs. + * + * The metric will be available in CloudWatch Metrics under the + * indicated namespace and name. + * + * @param jsonField JSON field to extract (example: '$.myfield') + * @param metricNamespace Namespace to emit the metric under + * @param metricName Name to emit the metric under + * @returns A Metric object representing the extracted metric + */ + public extractMetric(jsonField: string, metricNamespace: string, metricName: string) { + new MetricFilter(this, `${metricNamespace}_${metricName}`, { + logGroup: this, + metricNamespace, + metricName, + filterPattern: FilterPattern.exists(jsonField), + metricValue: jsonField, + }); + + return new cloudwatch.Metric({ metricName, namespace: metricNamespace }).attachTo(this); + } + + /** + * Give permissions to create and write to streams in this log group + */ + public grantWrite(grantee: iam.IGrantable) { + return this.grant(grantee, 'logs:CreateLogStream', 'logs:PutLogEvents'); + } + + /** + * Give permissions to read and filter events from this log group + */ + public grantRead(grantee: iam.IGrantable) { + return this.grant(grantee, + 'logs:FilterLogEvents', + 'logs:GetLogEvents', + 'logs:GetLogGroupFields', + 'logs:DescribeLogGroups', + 'logs:DescribeLogStreams', + ); + } + + /** + * Give the indicated permissions on this log group and all streams + */ + public grant(grantee: iam.IGrantable, ...actions: string[]) { + return iam.Grant.addToPrincipalOrResource({ + grantee, + actions, + // A LogGroup ARN out of CloudFormation already includes a ':*' at the end to include the log streams under the group. + // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#w2ab1c21c10c63c43c11 + resourceArns: [this.logGroupArn], + resource: this, + }); + } + + /** + * Public method to get the physical name of this log group + * @returns Physical name of log group + */ + public logGroupPhysicalName(): string { + return this.physicalName; + } + + /** + * Adds a statement to the resource policy associated with this log group. + * A resource policy will be automatically created upon the first call to `addToResourcePolicy`. + * + * Any ARN Principals inside of the statement will be converted into AWS Account ID strings + * because CloudWatch Logs Resource Policies do not accept ARN principals. + * + * @param statement The policy statement to add + */ + public addToResourcePolicy(statement: iam.PolicyStatement): iam.AddToResourcePolicyResult { + if (!this.policy) { + this.policy = new ResourcePolicy(this, 'Policy'); + } + this.policy.document.addStatements(statement.copy({ + principals: statement.principals.map(p => this.convertArnPrincpalToAccountId(p)), + })); + return { statementAdded: true, policyDependable: this.policy }; + } + + private convertArnPrincpalToAccountId(principal: iam.IPrincipal) { + if (principal.principalAccount) { + // we use ArnPrincipal here because the constructor inserts the argument + // into the template without mutating it, which means that there is no + // ARN created by this call. + return new iam.ArnPrincipal(principal.principalAccount); + } + + if (principal instanceof iam.ArnPrincipal) { + const parsedArn = Arn.split(principal.arn, ArnFormat.SLASH_RESOURCE_NAME); + if (parsedArn.account) { + return new iam.ArnPrincipal(parsedArn.account); + } + } + + return principal; + } +} + +/** + * How long, in days, the log contents will be retained. + */ +export enum RetentionDays { + /** + * 1 day + */ + ONE_DAY = 1, + + /** + * 3 days + */ + THREE_DAYS = 3, + + /** + * 5 days + */ + FIVE_DAYS = 5, + + /** + * 1 week + */ + ONE_WEEK = 7, + + /** + * 2 weeks + */ + TWO_WEEKS = 14, + + /** + * 1 month + */ + ONE_MONTH = 30, + + /** + * 2 months + */ + TWO_MONTHS = 60, + + /** + * 3 months + */ + THREE_MONTHS = 90, + + /** + * 4 months + */ + FOUR_MONTHS = 120, + + /** + * 5 months + */ + FIVE_MONTHS = 150, + + /** + * 6 months + */ + SIX_MONTHS = 180, + + /** + * 1 year + */ + ONE_YEAR = 365, + + /** + * 13 months + */ + THIRTEEN_MONTHS = 400, + + /** + * 18 months + */ + EIGHTEEN_MONTHS = 545, + + /** + * 2 years + */ + TWO_YEARS = 731, + + /** + * 3 years + */ + THREE_YEARS = 1096, + + /** + * 5 years + */ + FIVE_YEARS = 1827, + + /** + * 6 years + */ + SIX_YEARS = 2192, + + /** + * 7 years + */ + SEVEN_YEARS = 2557, + + /** + * 8 years + */ + EIGHT_YEARS = 2922, + + /** + * 9 years + */ + NINE_YEARS = 3288, + + /** + * 10 years + */ + TEN_YEARS = 3653, + + /** + * Retain logs forever + */ + INFINITE = 9999, +} + +/** + * Properties for a LogGroup + */ +export interface LogGroupProps { + /** + * The KMS customer managed key to encrypt the log group with. + * + * @default Server-side encrpytion managed by the CloudWatch Logs service + */ + readonly encryptionKey?: kms.IKey; + + /** + * Name of the log group. + * + * @default Automatically generated + */ + readonly logGroupName?: string; + + /** + * How long, in days, the log contents will be retained. + * + * To retain all logs, set this value to RetentionDays.INFINITE. + * + * @default RetentionDays.TWO_YEARS + */ + readonly retention?: RetentionDays; + + /** + * Determine the removal policy of this log group. + * + * Normally you want to retain the log group so you can diagnose issues + * from logs even after a deployment that no longer includes the log group. + * In that case, use the normal date-based retention policy to age out your + * logs. + * + * @default RemovalPolicy.Retain + */ + readonly removalPolicy?: RemovalPolicy; +} + +/** + * Define a CloudWatch Log Group + */ +export class LogGroup extends LogGroupBase { + /** + * Import an existing LogGroup given its ARN + */ + public static fromLogGroupArn(scope: Construct, id: string, logGroupArn: string): ILogGroup { + const baseLogGroupArn = logGroupArn.replace(/:\*$/, ''); + + class Import extends LogGroupBase { + public readonly logGroupArn = `${baseLogGroupArn}:*`; + public readonly logGroupName = Stack.of(scope).splitArn(baseLogGroupArn, ArnFormat.COLON_RESOURCE_NAME).resourceName!; + } + + return new Import(scope, id, { + environmentFromArn: baseLogGroupArn, + }); + } + + /** + * Import an existing LogGroup given its name + */ + public static fromLogGroupName(scope: Construct, id: string, logGroupName: string): ILogGroup { + const baseLogGroupName = logGroupName.replace(/:\*$/, ''); + + class Import extends LogGroupBase { + public readonly logGroupName = baseLogGroupName; + public readonly logGroupArn = Stack.of(scope).formatArn({ + service: 'logs', + resource: 'log-group', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + resourceName: baseLogGroupName + ':*', + }); + } + + return new Import(scope, id); + } + + /** + * The ARN of this log group + */ + public readonly logGroupArn: string; + + /** + * The name of this log group + */ + public readonly logGroupName: string; + + constructor(scope: Construct, id: string, props: LogGroupProps = {}) { + super(scope, id, { + physicalName: props.logGroupName, + }); + + let retentionInDays = props.retention; + if (retentionInDays === undefined) { retentionInDays = RetentionDays.TWO_YEARS; } + if (retentionInDays === Infinity || retentionInDays === RetentionDays.INFINITE) { retentionInDays = undefined; } + + if (retentionInDays !== undefined && !Token.isUnresolved(retentionInDays) && retentionInDays <= 0) { + throw new Error(`retentionInDays must be positive, got ${retentionInDays}`); + } + + const resource = new CfnLogGroup(this, 'Resource', { + kmsKeyId: props.encryptionKey?.keyArn, + logGroupName: this.physicalName, + retentionInDays, + }); + + resource.applyRemovalPolicy(props.removalPolicy); + + this.logGroupArn = this.getResourceArnAttribute(resource.attrArn, { + service: 'logs', + resource: 'log-group', + resourceName: this.physicalName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + this.logGroupName = this.getResourceNameAttribute(resource.ref); + } +} + +/** + * Properties for a new LogStream created from a LogGroup + */ +export interface StreamOptions { + /** + * The name of the log stream to create. + * + * The name must be unique within the log group. + * + * @default Automatically generated + */ + readonly logStreamName?: string; +} + +/** + * Properties for a new SubscriptionFilter created from a LogGroup + */ +export interface SubscriptionFilterOptions { + /** + * The destination to send the filtered events to. + * + * For example, a Kinesis stream or a Lambda function. + */ + readonly destination: ILogSubscriptionDestination; + + /** + * Log events matching this pattern will be sent to the destination. + */ + readonly filterPattern: IFilterPattern; +} + +/** + * Properties for a MetricFilter created from a LogGroup + */ +export interface MetricFilterOptions { + /** + * Pattern to search for log events. + */ + readonly filterPattern: IFilterPattern; + + /** + * The namespace of the metric to emit. + */ + readonly metricNamespace: string; + + /** + * The name of the metric to emit. + */ + readonly metricName: string; + + /** + * The value to emit for the metric. + * + * Can either be a literal number (typically "1"), or the name of a field in the structure + * to take the value from the matched event. If you are using a field value, the field + * value must have been matched using the pattern. + * + * If you want to specify a field from a matched JSON structure, use '$.fieldName', + * and make sure the field is in the pattern (if only as '$.fieldName = *'). + * + * If you want to specify a field from a matched space-delimited structure, + * use '$fieldName'. + * + * @default "1" + */ + readonly metricValue?: string; + + /** + * The value to emit if the pattern does not match a particular event. + * + * @default No metric emitted. + */ + readonly defaultValue?: number; + + /** + * The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions. + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-logs-metricfilter-metrictransformation-dimensions + * @default - No dimensions attached to metrics. + */ + readonly dimensions?: Record; + + /** + * The unit to assign to the metric. + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html#cfn-logs-metricfilter-metrictransformation-unit + * @default - No unit attached to metrics. + */ + readonly unit?: cloudwatch.Unit; +} diff --git a/packages/@aws-cdk/aws-logs/lib/log-retention-provider/index.ts b/packages/aws-cdk-lib/aws-logs/lib/log-retention-provider/index.ts similarity index 100% rename from packages/@aws-cdk/aws-logs/lib/log-retention-provider/index.ts rename to packages/aws-cdk-lib/aws-logs/lib/log-retention-provider/index.ts diff --git a/packages/aws-cdk-lib/aws-logs/lib/log-retention.ts b/packages/aws-cdk-lib/aws-logs/lib/log-retention.ts new file mode 100644 index 0000000000000..da109c9ab9e31 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/lib/log-retention.ts @@ -0,0 +1,212 @@ +import * as path from 'path'; +import * as iam from '../../aws-iam'; +import * as s3_assets from '../../aws-s3-assets'; +import * as cdk from '../../core'; +import { ArnFormat } from '../../core'; +import { Construct } from 'constructs'; +import { RetentionDays } from './log-group'; + +/** + * Construction properties for a LogRetention. + */ +export interface LogRetentionProps { + /** + * The log group name. + */ + readonly logGroupName: string; + + /** + * The region where the log group should be created + * @default - same region as the stack + */ + readonly logGroupRegion?: string; + + /** + * The number of days log events are kept in CloudWatch Logs. + */ + readonly retention: RetentionDays; + + /** + * The IAM role for the Lambda function associated with the custom resource. + * + * @default - A new role is created + */ + readonly role?: iam.IRole; + + /** + * Retry options for all AWS API calls. + * + * @default - AWS SDK default retry options + */ + readonly logRetentionRetryOptions?: LogRetentionRetryOptions; + + /** + * The removalPolicy for the log group when the stack is deleted + * @default RemovalPolicy.RETAIN + */ + readonly removalPolicy?: cdk.RemovalPolicy; +} + +/** + * Retry options for all AWS API calls. + */ +export interface LogRetentionRetryOptions { + /** + * The maximum amount of retries. + * + * @default 3 (AWS SDK default) + */ + readonly maxRetries?: number; + /** + * The base duration to use in the exponential backoff for operation retries. + * + * @default Duration.millis(100) (AWS SDK default) + */ + readonly base?: cdk.Duration; +} + +/** + * Creates a custom resource to control the retention policy of a CloudWatch Logs + * log group. The log group is created if it doesn't already exist. The policy + * is removed when `retentionDays` is `undefined` or equal to `Infinity`. + * Log group can be created in the region that is different from stack region by + * specifying `logGroupRegion` + */ +export class LogRetention extends Construct { + + /** + * The ARN of the LogGroup. + */ + public readonly logGroupArn: string; + + constructor(scope: Construct, id: string, props: LogRetentionProps) { + super(scope, id); + + // Custom resource provider + const provider = this.ensureSingletonLogRetentionFunction(props); + + // if removalPolicy is DESTROY, add action for DeleteLogGroup + if (props.removalPolicy === cdk.RemovalPolicy.DESTROY) { + provider.grantDeleteLogGroup(props.logGroupName); + } + + // Need to use a CfnResource here to prevent lerna dependency cycles + // @aws-cdk/aws-cloudformation -> @aws-cdk/aws-lambda -> @aws-cdk/aws-cloudformation + const retryOptions = props.logRetentionRetryOptions; + const resource = new cdk.CfnResource(this, 'Resource', { + type: 'Custom::LogRetention', + properties: { + ServiceToken: provider.functionArn, + LogGroupName: props.logGroupName, + LogGroupRegion: props.logGroupRegion, + SdkRetry: retryOptions ? { + maxRetries: retryOptions.maxRetries, + base: retryOptions.base?.toMilliseconds(), + } : undefined, + RetentionInDays: props.retention === RetentionDays.INFINITE ? undefined : props.retention, + RemovalPolicy: props.removalPolicy, + }, + }); + + const logGroupName = resource.getAtt('LogGroupName').toString(); + // Append ':*' at the end of the ARN to match with how CloudFormation does this for LogGroup ARNs + // See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html#aws-resource-logs-loggroup-return-values + this.logGroupArn = cdk.Stack.of(this).formatArn({ + region: props.logGroupRegion, + service: 'logs', + resource: 'log-group', + resourceName: `${logGroupName}:*`, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + } + + /** + * Helper method to ensure that only one instance of LogRetentionFunction resources are in the stack mimicking the + * behaviour of @aws-cdk/aws-lambda's SingletonFunction to prevent circular dependencies + */ + private ensureSingletonLogRetentionFunction(props: LogRetentionProps) { + const functionLogicalId = 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a'; + const existing = cdk.Stack.of(this).node.tryFindChild(functionLogicalId); + if (existing) { + return existing as LogRetentionFunction; + } + return new LogRetentionFunction(cdk.Stack.of(this), functionLogicalId, props); + } +} + +/** + * Private provider Lambda function to support the log retention custom resource. + */ +class LogRetentionFunction extends Construct implements cdk.ITaggable { + public readonly functionArn: cdk.Reference; + + public readonly tags: cdk.TagManager = new cdk.TagManager(cdk.TagType.KEY_VALUE, 'AWS::Lambda::Function'); + + private readonly role: iam.IRole; + + constructor(scope: Construct, id: string, props: LogRetentionProps) { + super(scope, id); + + const asset = new s3_assets.Asset(this, 'Code', { + path: path.join(__dirname, 'log-retention-provider'), + }); + + const role = props.role || new iam.Role(this, 'ServiceRole', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), + managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaBasicExecutionRole')], + }); + // Duplicate statements will be deduplicated by `PolicyDocument` + role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['logs:PutRetentionPolicy', 'logs:DeleteRetentionPolicy'], + // We need '*' here because we will also put a retention policy on + // the log group of the provider function. Referencing its name + // creates a CF circular dependency. + resources: ['*'], + })); + this.role = role; + + // Lambda function + const resource = new cdk.CfnResource(this, 'Resource', { + type: 'AWS::Lambda::Function', + properties: { + Handler: 'index.handler', + Runtime: 'nodejs14.x', // Equivalent to Runtime.NODEJS_14_X + Code: { + S3Bucket: asset.s3BucketName, + S3Key: asset.s3ObjectKey, + }, + Role: role.roleArn, + Tags: this.tags.renderedTags, + }, + }); + this.functionArn = resource.getAtt('Arn'); + + asset.addResourceMetadata(resource, 'Code'); + + // Function dependencies + role.node.children.forEach((child) => { + if (cdk.CfnResource.isCfnResource(child)) { + resource.addDependency(child); + } + if (Construct.isConstruct(child) && child.node.defaultChild && cdk.CfnResource.isCfnResource(child.node.defaultChild)) { + resource.addDependency(child.node.defaultChild); + } + }); + } + + /** + * @internal + */ + public grantDeleteLogGroup(logGroupName: string) { + this.role.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['logs:DeleteLogGroup'], + //Only allow deleting the specific log group. + resources: [cdk.Stack.of(this).formatArn({ + service: 'logs', + resource: 'log-group', + resourceName: `${logGroupName}:*`, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + })], + })); + } +} diff --git a/packages/@aws-cdk/aws-logs/lib/log-stream.ts b/packages/aws-cdk-lib/aws-logs/lib/log-stream.ts similarity index 96% rename from packages/@aws-cdk/aws-logs/lib/log-stream.ts rename to packages/aws-cdk-lib/aws-logs/lib/log-stream.ts index d6e072da8c3d6..110ccfb08c36d 100644 --- a/packages/@aws-cdk/aws-logs/lib/log-stream.ts +++ b/packages/aws-cdk-lib/aws-logs/lib/log-stream.ts @@ -1,4 +1,4 @@ -import { IResource, RemovalPolicy, Resource } from '@aws-cdk/core'; +import { IResource, RemovalPolicy, Resource } from '../../core'; import { Construct } from 'constructs'; import { ILogGroup } from './log-group'; import { CfnLogStream } from './logs.generated'; diff --git a/packages/@aws-cdk/aws-logs/lib/metric-filter.ts b/packages/aws-cdk-lib/aws-logs/lib/metric-filter.ts similarity index 95% rename from packages/@aws-cdk/aws-logs/lib/metric-filter.ts rename to packages/aws-cdk-lib/aws-logs/lib/metric-filter.ts index d3558641fd970..a567f3e84793c 100644 --- a/packages/@aws-cdk/aws-logs/lib/metric-filter.ts +++ b/packages/aws-cdk-lib/aws-logs/lib/metric-filter.ts @@ -1,5 +1,5 @@ -import { Metric, MetricOptions } from '@aws-cdk/aws-cloudwatch'; -import { Resource } from '@aws-cdk/core'; +import { Metric, MetricOptions } from '../../aws-cloudwatch'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { ILogGroup, MetricFilterOptions } from './log-group'; import { CfnMetricFilter } from './logs.generated'; diff --git a/packages/@aws-cdk/aws-logs/lib/pattern.ts b/packages/aws-cdk-lib/aws-logs/lib/pattern.ts similarity index 100% rename from packages/@aws-cdk/aws-logs/lib/pattern.ts rename to packages/aws-cdk-lib/aws-logs/lib/pattern.ts diff --git a/packages/aws-cdk-lib/aws-logs/lib/policy.ts b/packages/aws-cdk-lib/aws-logs/lib/policy.ts new file mode 100644 index 0000000000000..a094a4127a84f --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/lib/policy.ts @@ -0,0 +1,64 @@ +import { PolicyDocument, PolicyStatement } from '../../aws-iam'; +import { Resource, Lazy, Names } from '../../core'; +import { Construct } from 'constructs'; +import { CfnResourcePolicy } from './logs.generated'; + +/** + * Properties to define Cloudwatch log group resource policy + */ +export interface ResourcePolicyProps { + /** + * Name of the log group resource policy + * @default - Uses a unique id based on the construct path + */ + readonly resourcePolicyName?: string; + + /** + * Initial statements to add to the resource policy + * + * @default - No statements + */ + readonly policyStatements?: PolicyStatement[]; +} + +/** + * Resource Policy for CloudWatch Log Groups + * + * Policies define the operations that are allowed on this resource. + * + * You almost never need to define this construct directly. + * + * All AWS resources that support resource policies have a method called + * `addToResourcePolicy()`, which will automatically create a new resource + * policy if one doesn't exist yet, otherwise it will add to the existing + * policy. + * + * Prefer to use `addToResourcePolicy()` instead. + */ +export class ResourcePolicy extends Resource { + /** + * The IAM policy document for this resource policy. + */ + public readonly document = new PolicyDocument(); + + constructor(scope: Construct, id: string, props?: ResourcePolicyProps) { + super(scope, id, { + physicalName: props?.resourcePolicyName, + }); + + const l1 = new CfnResourcePolicy(this, 'ResourcePolicy', { + policyName: Lazy.string({ + produce: () => props?.resourcePolicyName ?? Names.uniqueId(this), + }), + policyDocument: Lazy.string({ + produce: () => JSON.stringify(this.document), + }), + }); + + this.node.defaultChild = l1; + + if (props?.policyStatements) { + this.document.addStatements(...props.policyStatements); + } + } +} diff --git a/packages/@aws-cdk/aws-logs/lib/query-definition.ts b/packages/aws-cdk-lib/aws-logs/lib/query-definition.ts similarity index 99% rename from packages/@aws-cdk/aws-logs/lib/query-definition.ts rename to packages/aws-cdk-lib/aws-logs/lib/query-definition.ts index 09594756d4cb2..f03f545a73d27 100644 --- a/packages/@aws-cdk/aws-logs/lib/query-definition.ts +++ b/packages/aws-cdk-lib/aws-logs/lib/query-definition.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnQueryDefinition } from '.'; import { ILogGroup } from './log-group'; diff --git a/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts b/packages/aws-cdk-lib/aws-logs/lib/subscription-filter.ts similarity index 95% rename from packages/@aws-cdk/aws-logs/lib/subscription-filter.ts rename to packages/aws-cdk-lib/aws-logs/lib/subscription-filter.ts index 099094032d3a1..5227478d071c9 100644 --- a/packages/@aws-cdk/aws-logs/lib/subscription-filter.ts +++ b/packages/aws-cdk-lib/aws-logs/lib/subscription-filter.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Resource } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { ILogGroup, SubscriptionFilterOptions } from './log-group'; import { CfnSubscriptionFilter } from './logs.generated'; diff --git a/packages/@aws-cdk/aws-logs/test/destination.test.ts b/packages/aws-cdk-lib/aws-logs/test/destination.test.ts similarity index 92% rename from packages/@aws-cdk/aws-logs/test/destination.test.ts rename to packages/aws-cdk-lib/aws-logs/test/destination.test.ts index 096addb02a885..f3ba1180515fa 100644 --- a/packages/@aws-cdk/aws-logs/test/destination.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/destination.test.ts @@ -1,6 +1,6 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { CrossAccountDestination } from '../lib'; describe('destination', () => { diff --git a/packages/@aws-cdk/aws-logs/test/example.retention.lit.ts b/packages/aws-cdk-lib/aws-logs/test/example.retention.lit.ts similarity index 93% rename from packages/@aws-cdk/aws-logs/test/example.retention.lit.ts rename to packages/aws-cdk-lib/aws-logs/test/example.retention.lit.ts index 5421ecd38a467..95baf7a5c9ea9 100644 --- a/packages/@aws-cdk/aws-logs/test/example.retention.lit.ts +++ b/packages/aws-cdk-lib/aws-logs/test/example.retention.lit.ts @@ -1,4 +1,4 @@ -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../core'; import { LogGroup, RetentionDays } from '../lib'; const stack = new Stack(); diff --git a/packages/aws-cdk-lib/aws-logs/test/integ.metricfilter.lit.ts b/packages/aws-cdk-lib/aws-logs/test/integ.metricfilter.lit.ts new file mode 100644 index 0000000000000..dd61bf8ddedc9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/test/integ.metricfilter.lit.ts @@ -0,0 +1,26 @@ +import { App, RemovalPolicy, Stack, StackProps } from '../../core'; +import { FilterPattern, LogGroup, MetricFilter } from '../lib'; + +class MetricFilterIntegStack extends Stack { + constructor(scope: App, id: string, props?: StackProps) { + super(scope, id, props); + + const logGroup = new LogGroup(this, 'LogGroup', { + removalPolicy: RemovalPolicy.DESTROY, + }); + + /// !show + new MetricFilter(this, 'MetricFilter', { + logGroup, + metricNamespace: 'MyApp', + metricName: 'Latency', + filterPattern: FilterPattern.exists('$.latency'), + metricValue: '$.latency', + }); + /// !hide + } +} + +const app = new App(); +new MetricFilterIntegStack(app, 'aws-cdk-metricfilter-integ'); +app.synth(); diff --git a/packages/@aws-cdk/aws-logs/test/log-retention-provider.test.ts b/packages/aws-cdk-lib/aws-logs/test/log-retention-provider.test.ts similarity index 100% rename from packages/@aws-cdk/aws-logs/test/log-retention-provider.test.ts rename to packages/aws-cdk-lib/aws-logs/test/log-retention-provider.test.ts diff --git a/packages/@aws-cdk/aws-logs/test/log-retention.test.ts b/packages/aws-cdk-lib/aws-logs/test/log-retention.test.ts similarity index 98% rename from packages/@aws-cdk/aws-logs/test/log-retention.test.ts rename to packages/aws-cdk-lib/aws-logs/test/log-retention.test.ts index 8d3de4c1db487..406d6042028e3 100644 --- a/packages/@aws-cdk/aws-logs/test/log-retention.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/log-retention.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import { LogRetention, RetentionDays } from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-logs/test/loggroup.test.ts b/packages/aws-cdk-lib/aws-logs/test/loggroup.test.ts similarity index 98% rename from packages/@aws-cdk/aws-logs/test/loggroup.test.ts rename to packages/aws-cdk-lib/aws-logs/test/loggroup.test.ts index 1a1205bcdcd9e..1520cec0dadd0 100644 --- a/packages/@aws-cdk/aws-logs/test/loggroup.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/loggroup.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { CfnParameter, Fn, RemovalPolicy, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { CfnParameter, Fn, RemovalPolicy, Stack } from '../../core'; import { LogGroup, RetentionDays } from '../lib'; describe('log group', () => { diff --git a/packages/@aws-cdk/aws-logs/test/logstream.test.ts b/packages/aws-cdk-lib/aws-logs/test/logstream.test.ts similarity index 81% rename from packages/@aws-cdk/aws-logs/test/logstream.test.ts rename to packages/aws-cdk-lib/aws-logs/test/logstream.test.ts index d599ca8bdbe0a..0aaacde647820 100644 --- a/packages/@aws-cdk/aws-logs/test/logstream.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/logstream.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { LogGroup, LogStream } from '../lib'; describe('log stream', () => { diff --git a/packages/@aws-cdk/aws-logs/test/metricfilter.test.ts b/packages/aws-cdk-lib/aws-logs/test/metricfilter.test.ts similarity index 97% rename from packages/@aws-cdk/aws-logs/test/metricfilter.test.ts rename to packages/aws-cdk-lib/aws-logs/test/metricfilter.test.ts index 39a2b58d39f35..0821d0a201003 100644 --- a/packages/@aws-cdk/aws-logs/test/metricfilter.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/metricfilter.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Metric, Unit } from '@aws-cdk/aws-cloudwatch'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Metric, Unit } from '../../aws-cloudwatch'; +import { Stack } from '../../core'; import { FilterPattern, LogGroup, MetricFilter } from '../lib'; describe('metric filter', () => { diff --git a/packages/@aws-cdk/aws-logs/test/pattern.test.ts b/packages/aws-cdk-lib/aws-logs/test/pattern.test.ts similarity index 100% rename from packages/@aws-cdk/aws-logs/test/pattern.test.ts rename to packages/aws-cdk-lib/aws-logs/test/pattern.test.ts diff --git a/packages/aws-cdk-lib/aws-logs/test/policy.test.ts b/packages/aws-cdk-lib/aws-logs/test/policy.test.ts new file mode 100644 index 0000000000000..2d79f017756a4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-logs/test/policy.test.ts @@ -0,0 +1,63 @@ +import { Template } from '../../assertions'; +import { PolicyStatement, ServicePrincipal } from '../../aws-iam'; +import { Stack } from '../../core'; +import { LogGroup, ResourcePolicy } from '../lib'; + +describe('resource policy', () => { + test('ResourcePolicy is added to stack, when .addToResourcePolicy() is provided a valid Statement', () => { + // GIVEN + const stack = new Stack(); + const logGroup = new LogGroup(stack, 'LogGroup'); + + // WHEN + logGroup.addToResourcePolicy(new PolicyStatement({ + actions: ['logs:CreateLogStream'], + resources: ['*'], + })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Logs::ResourcePolicy', { + PolicyName: 'LogGroupPolicy643B329C', + PolicyDocument: JSON.stringify({ + Statement: [ + { + Action: 'logs:CreateLogStream', + Effect: 'Allow', + Resource: '*', + }, + ], + Version: '2012-10-17', + }), + }); + }); + + test('ResourcePolicy is added to stack, when created manually/directly', () => { + // GIVEN + const stack = new Stack(); + const logGroup = new LogGroup(stack, 'LogGroup'); + + // WHEN + const resourcePolicy = new ResourcePolicy(stack, 'ResourcePolicy'); + resourcePolicy.document.addStatements(new PolicyStatement({ + actions: ['logs:CreateLogStream', 'logs:PutLogEvents'], + principals: [new ServicePrincipal('es.amazonaws.com')], + resources: [logGroup.logGroupArn], + })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Logs::ResourcePolicy', { + PolicyName: 'ResourcePolicy', + }); + }); + + test('ResourcePolicy has a defaultChild', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const resourcePolicy = new ResourcePolicy(stack, 'ResourcePolicy'); + + // THEN + expect(resourcePolicy.node.defaultChild).toBeDefined(); + }); +}); diff --git a/packages/@aws-cdk/aws-logs/test/query-definition.test.ts b/packages/aws-cdk-lib/aws-logs/test/query-definition.test.ts similarity index 98% rename from packages/@aws-cdk/aws-logs/test/query-definition.test.ts rename to packages/aws-cdk-lib/aws-logs/test/query-definition.test.ts index 10593be3c35f6..1ff7e49c7e6f5 100644 --- a/packages/@aws-cdk/aws-logs/test/query-definition.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/query-definition.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; +import { Template } from '../../assertions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../core'; import { LogGroup, QueryDefinition, QueryString } from '../lib'; describe('query definition', () => { diff --git a/packages/@aws-cdk/aws-logs/test/subscriptionfilter.test.ts b/packages/aws-cdk-lib/aws-logs/test/subscriptionfilter.test.ts similarity index 91% rename from packages/@aws-cdk/aws-logs/test/subscriptionfilter.test.ts rename to packages/aws-cdk-lib/aws-logs/test/subscriptionfilter.test.ts index bc691e26aaa96..d3505a415234a 100644 --- a/packages/@aws-cdk/aws-logs/test/subscriptionfilter.test.ts +++ b/packages/aws-cdk-lib/aws-logs/test/subscriptionfilter.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { Construct } from 'constructs'; import { FilterPattern, ILogGroup, ILogSubscriptionDestination, LogGroup, SubscriptionFilter } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-lookoutequipment/.jsiirc.json b/packages/aws-cdk-lib/aws-lookoutequipment/.jsiirc.json new file mode 100644 index 0000000000000..663e227404305 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutequipment/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.LookoutEquipment" + }, + "java": { + "package": "software.amazon.awscdk.services.lookoutequipment" + }, + "python": { + "module": "aws_cdk.aws_lookoutequipment" + } + } +} diff --git a/packages/aws-cdk-lib/aws-lookoutequipment/README.md b/packages/aws-cdk-lib/aws-lookoutequipment/README.md new file mode 100644 index 0000000000000..ee4c352ba83ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutequipment/README.md @@ -0,0 +1,27 @@ +# AWS::LookoutEquipment Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as lookoutequipment from 'aws-cdk-lib/aws-lookoutequipment'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for LookoutEquipment construct libraries](https://constructs.dev/search?q=lookoutequipment) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LookoutEquipment resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutEquipment.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LookoutEquipment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutEquipment.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-lookoutequipment/index.ts b/packages/aws-cdk-lib/aws-lookoutequipment/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutequipment/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-lookoutequipment/lib/index.ts b/packages/aws-cdk-lib/aws-lookoutequipment/lib/index.ts new file mode 100644 index 0000000000000..80b73d00a1bb0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutequipment/lib/index.ts @@ -0,0 +1 @@ +export * from './lookoutequipment.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-lookoutmetrics/.jsiirc.json b/packages/aws-cdk-lib/aws-lookoutmetrics/.jsiirc.json new file mode 100644 index 0000000000000..988a665575748 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutmetrics/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.LookoutMetrics" + }, + "java": { + "package": "software.amazon.awscdk.services.lookoutmetrics" + }, + "python": { + "module": "aws_cdk.aws_lookoutmetrics" + } + } +} diff --git a/packages/aws-cdk-lib/aws-lookoutmetrics/README.md b/packages/aws-cdk-lib/aws-lookoutmetrics/README.md new file mode 100644 index 0000000000000..2be60374104bc --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutmetrics/README.md @@ -0,0 +1,27 @@ +# AWS::LookoutMetrics Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as lookoutmetrics from 'aws-cdk-lib/aws-lookoutmetrics'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for LookoutMetrics construct libraries](https://constructs.dev/search?q=lookoutmetrics) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LookoutMetrics resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutMetrics.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LookoutMetrics](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutMetrics.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-lookoutmetrics/index.ts b/packages/aws-cdk-lib/aws-lookoutmetrics/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutmetrics/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-lookoutmetrics/lib/index.ts b/packages/aws-cdk-lib/aws-lookoutmetrics/lib/index.ts new file mode 100644 index 0000000000000..d8ef1b253c69d --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutmetrics/lib/index.ts @@ -0,0 +1 @@ +export * from './lookoutmetrics.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-lookoutvision/.jsiirc.json b/packages/aws-cdk-lib/aws-lookoutvision/.jsiirc.json new file mode 100644 index 0000000000000..8725907af4e15 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutvision/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.LookoutVision" + }, + "java": { + "package": "software.amazon.awscdk.services.lookoutvision" + }, + "python": { + "module": "aws_cdk.aws_lookoutvision" + } + } +} diff --git a/packages/aws-cdk-lib/aws-lookoutvision/README.md b/packages/aws-cdk-lib/aws-lookoutvision/README.md new file mode 100644 index 0000000000000..8aec23d40322b --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutvision/README.md @@ -0,0 +1,27 @@ +# AWS::LookoutVision Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as lookoutvision from 'aws-cdk-lib/aws-lookoutvision'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for LookoutVision construct libraries](https://constructs.dev/search?q=lookoutvision) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LookoutVision resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutVision.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LookoutVision](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LookoutVision.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-lookoutvision/index.ts b/packages/aws-cdk-lib/aws-lookoutvision/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutvision/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-lookoutvision/lib/index.ts b/packages/aws-cdk-lib/aws-lookoutvision/lib/index.ts new file mode 100644 index 0000000000000..bccb17c9bf609 --- /dev/null +++ b/packages/aws-cdk-lib/aws-lookoutvision/lib/index.ts @@ -0,0 +1 @@ +export * from './lookoutvision.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-m2/.jsiirc.json b/packages/aws-cdk-lib/aws-m2/.jsiirc.json new file mode 100644 index 0000000000000..618d87a7c7b10 --- /dev/null +++ b/packages/aws-cdk-lib/aws-m2/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.M2" + }, + "java": { + "package": "software.amazon.awscdk.services.m2" + }, + "python": { + "module": "aws_cdk.aws_m2" + } + } +} diff --git a/packages/aws-cdk-lib/aws-m2/README.md b/packages/aws-cdk-lib/aws-m2/README.md new file mode 100644 index 0000000000000..c67460b2e5a05 --- /dev/null +++ b/packages/aws-cdk-lib/aws-m2/README.md @@ -0,0 +1,27 @@ +# AWS::M2 Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as m2 from 'aws-cdk-lib/aws-m2'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for M2 construct libraries](https://constructs.dev/search?q=m2) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::M2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_M2.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::M2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_M2.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-m2/index.ts b/packages/aws-cdk-lib/aws-m2/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-m2/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-m2/lib/index.ts b/packages/aws-cdk-lib/aws-m2/lib/index.ts new file mode 100644 index 0000000000000..2e1b540fc8630 --- /dev/null +++ b/packages/aws-cdk-lib/aws-m2/lib/index.ts @@ -0,0 +1 @@ +export * from './m2.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-macie/.jsiirc.json b/packages/aws-cdk-lib/aws-macie/.jsiirc.json new file mode 100644 index 0000000000000..ad69aaa00cc2b --- /dev/null +++ b/packages/aws-cdk-lib/aws-macie/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Macie" + }, + "java": { + "package": "software.amazon.awscdk.services.macie" + }, + "python": { + "module": "aws_cdk.aws_macie" + } + } +} diff --git a/packages/aws-cdk-lib/aws-macie/README.md b/packages/aws-cdk-lib/aws-macie/README.md new file mode 100644 index 0000000000000..ccab4eb91359d --- /dev/null +++ b/packages/aws-cdk-lib/aws-macie/README.md @@ -0,0 +1,27 @@ +# AWS::Macie Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as macie from 'aws-cdk-lib/aws-macie'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Macie construct libraries](https://constructs.dev/search?q=macie) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Macie resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Macie.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Macie](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Macie.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-macie/index.ts b/packages/aws-cdk-lib/aws-macie/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-macie/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-macie/lib/index.ts b/packages/aws-cdk-lib/aws-macie/lib/index.ts new file mode 100644 index 0000000000000..434c303abb3ef --- /dev/null +++ b/packages/aws-cdk-lib/aws-macie/lib/index.ts @@ -0,0 +1 @@ +export * from './macie.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-managedblockchain/.jsiirc.json b/packages/aws-cdk-lib/aws-managedblockchain/.jsiirc.json new file mode 100644 index 0000000000000..c5957d6abe468 --- /dev/null +++ b/packages/aws-cdk-lib/aws-managedblockchain/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ManagedBlockchain" + }, + "java": { + "package": "software.amazon.awscdk.services.managedblockchain" + }, + "python": { + "module": "aws_cdk.aws_managedblockchain" + } + } +} diff --git a/packages/aws-cdk-lib/aws-managedblockchain/README.md b/packages/aws-cdk-lib/aws-managedblockchain/README.md new file mode 100644 index 0000000000000..770f1852a692a --- /dev/null +++ b/packages/aws-cdk-lib/aws-managedblockchain/README.md @@ -0,0 +1,27 @@ +# AWS::ManagedBlockchain Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as managedblockchain from 'aws-cdk-lib/aws-managedblockchain'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ManagedBlockchain construct libraries](https://constructs.dev/search?q=managedblockchain) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ManagedBlockchain resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ManagedBlockchain.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ManagedBlockchain](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ManagedBlockchain.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-managedblockchain/index.ts b/packages/aws-cdk-lib/aws-managedblockchain/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-managedblockchain/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-managedblockchain/lib/index.ts b/packages/aws-cdk-lib/aws-managedblockchain/lib/index.ts new file mode 100644 index 0000000000000..92ee5bf53b85e --- /dev/null +++ b/packages/aws-cdk-lib/aws-managedblockchain/lib/index.ts @@ -0,0 +1 @@ +export * from './managedblockchain.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-mediaconnect/.jsiirc.json b/packages/aws-cdk-lib/aws-mediaconnect/.jsiirc.json new file mode 100644 index 0000000000000..4a0ed000beb6d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconnect/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MediaConnect" + }, + "java": { + "package": "software.amazon.awscdk.services.mediaconnect" + }, + "python": { + "module": "aws_cdk.aws_mediaconnect" + } + } +} diff --git a/packages/aws-cdk-lib/aws-mediaconnect/README.md b/packages/aws-cdk-lib/aws-mediaconnect/README.md new file mode 100644 index 0000000000000..f53a2502b0f29 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconnect/README.md @@ -0,0 +1,27 @@ +# AWS::MediaConnect Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as mediaconnect from 'aws-cdk-lib/aws-mediaconnect'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MediaConnect construct libraries](https://constructs.dev/search?q=mediaconnect) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaConnect resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConnect.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaConnect](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConnect.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-mediaconnect/index.ts b/packages/aws-cdk-lib/aws-mediaconnect/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconnect/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-mediaconnect/lib/index.ts b/packages/aws-cdk-lib/aws-mediaconnect/lib/index.ts new file mode 100644 index 0000000000000..2211c723da4b6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconnect/lib/index.ts @@ -0,0 +1 @@ +export * from './mediaconnect.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-mediaconvert/.jsiirc.json b/packages/aws-cdk-lib/aws-mediaconvert/.jsiirc.json new file mode 100644 index 0000000000000..9a846aa36b077 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconvert/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MediaConvert" + }, + "java": { + "package": "software.amazon.awscdk.services.mediaconvert" + }, + "python": { + "module": "aws_cdk.aws_mediaconvert" + } + } +} diff --git a/packages/aws-cdk-lib/aws-mediaconvert/README.md b/packages/aws-cdk-lib/aws-mediaconvert/README.md new file mode 100644 index 0000000000000..0e40389c86ef5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconvert/README.md @@ -0,0 +1,27 @@ +# AWS::MediaConvert Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as mediaconvert from 'aws-cdk-lib/aws-mediaconvert'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MediaConvert construct libraries](https://constructs.dev/search?q=mediaconvert) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaConvert resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConvert.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaConvert](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaConvert.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-mediaconvert/index.ts b/packages/aws-cdk-lib/aws-mediaconvert/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconvert/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-mediaconvert/lib/index.ts b/packages/aws-cdk-lib/aws-mediaconvert/lib/index.ts new file mode 100644 index 0000000000000..65a3d8b91ae30 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediaconvert/lib/index.ts @@ -0,0 +1 @@ +export * from './mediaconvert.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-medialive/.jsiirc.json b/packages/aws-cdk-lib/aws-medialive/.jsiirc.json new file mode 100644 index 0000000000000..27d7a137cc947 --- /dev/null +++ b/packages/aws-cdk-lib/aws-medialive/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MediaLive" + }, + "java": { + "package": "software.amazon.awscdk.services.medialive" + }, + "python": { + "module": "aws_cdk.aws_medialive" + } + } +} diff --git a/packages/aws-cdk-lib/aws-medialive/README.md b/packages/aws-cdk-lib/aws-medialive/README.md new file mode 100644 index 0000000000000..29b62cc8210e5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-medialive/README.md @@ -0,0 +1,27 @@ +# AWS Elemental MediaLive Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as medialive from 'aws-cdk-lib/aws-medialive'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MediaLive construct libraries](https://constructs.dev/search?q=medialive) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaLive resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaLive.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaLive](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaLive.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-medialive/index.ts b/packages/aws-cdk-lib/aws-medialive/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-medialive/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-medialive/lib/index.ts b/packages/aws-cdk-lib/aws-medialive/lib/index.ts new file mode 100644 index 0000000000000..6e8282a115101 --- /dev/null +++ b/packages/aws-cdk-lib/aws-medialive/lib/index.ts @@ -0,0 +1 @@ +export * from './medialive.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-mediapackage/.jsiirc.json b/packages/aws-cdk-lib/aws-mediapackage/.jsiirc.json new file mode 100644 index 0000000000000..79caca7bdcafd --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediapackage/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MediaPackage" + }, + "java": { + "package": "software.amazon.awscdk.services.mediapackage" + }, + "python": { + "module": "aws_cdk.aws_mediapackage" + } + } +} diff --git a/packages/aws-cdk-lib/aws-mediapackage/README.md b/packages/aws-cdk-lib/aws-mediapackage/README.md new file mode 100644 index 0000000000000..2607cb49b150f --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediapackage/README.md @@ -0,0 +1,27 @@ +# AWS::MediaPackage Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as mediapackage from 'aws-cdk-lib/aws-mediapackage'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MediaPackage construct libraries](https://constructs.dev/search?q=mediapackage) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaPackage resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaPackage.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaPackage](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaPackage.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-mediapackage/index.ts b/packages/aws-cdk-lib/aws-mediapackage/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediapackage/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-mediapackage/lib/index.ts b/packages/aws-cdk-lib/aws-mediapackage/lib/index.ts new file mode 100644 index 0000000000000..33cf155f729d4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediapackage/lib/index.ts @@ -0,0 +1 @@ +export * from './mediapackage.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-mediastore/.jsiirc.json b/packages/aws-cdk-lib/aws-mediastore/.jsiirc.json new file mode 100644 index 0000000000000..ea30f491b8cb7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediastore/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MediaStore" + }, + "java": { + "package": "software.amazon.awscdk.services.mediastore" + }, + "python": { + "module": "aws_cdk.aws_mediastore" + } + } +} diff --git a/packages/aws-cdk-lib/aws-mediastore/README.md b/packages/aws-cdk-lib/aws-mediastore/README.md new file mode 100644 index 0000000000000..c6a187388657e --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediastore/README.md @@ -0,0 +1,27 @@ +# AWS Elemental MediaStore Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as mediastore from 'aws-cdk-lib/aws-mediastore'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MediaStore construct libraries](https://constructs.dev/search?q=mediastore) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaStore resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaStore.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaStore](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaStore.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-mediastore/index.ts b/packages/aws-cdk-lib/aws-mediastore/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediastore/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-mediastore/lib/index.ts b/packages/aws-cdk-lib/aws-mediastore/lib/index.ts new file mode 100644 index 0000000000000..691cc181e60f7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediastore/lib/index.ts @@ -0,0 +1 @@ +export * from './mediastore.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-mediatailor/.jsiirc.json b/packages/aws-cdk-lib/aws-mediatailor/.jsiirc.json new file mode 100644 index 0000000000000..2123acc4ccd94 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediatailor/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MediaTailor" + }, + "java": { + "package": "software.amazon.awscdk.services.mediatailor" + }, + "python": { + "module": "aws_cdk.aws_mediatailor" + } + } +} diff --git a/packages/aws-cdk-lib/aws-mediatailor/README.md b/packages/aws-cdk-lib/aws-mediatailor/README.md new file mode 100644 index 0000000000000..76a7f916afcf6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediatailor/README.md @@ -0,0 +1,27 @@ +# AWS::MediaTailor Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as mediatailor from 'aws-cdk-lib/aws-mediatailor'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MediaTailor construct libraries](https://constructs.dev/search?q=mediatailor) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MediaTailor resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaTailor.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MediaTailor](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MediaTailor.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-mediatailor/index.ts b/packages/aws-cdk-lib/aws-mediatailor/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediatailor/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-mediatailor/lib/index.ts b/packages/aws-cdk-lib/aws-mediatailor/lib/index.ts new file mode 100644 index 0000000000000..a7a773f89c528 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mediatailor/lib/index.ts @@ -0,0 +1 @@ +export * from './mediatailor.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-memorydb/.jsiirc.json b/packages/aws-cdk-lib/aws-memorydb/.jsiirc.json new file mode 100644 index 0000000000000..c30fc30e546f8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-memorydb/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MemoryDB" + }, + "java": { + "package": "software.amazon.awscdk.services.memorydb" + }, + "python": { + "module": "aws_cdk.aws_memorydb" + } + } +} diff --git a/packages/aws-cdk-lib/aws-memorydb/README.md b/packages/aws-cdk-lib/aws-memorydb/README.md new file mode 100644 index 0000000000000..ebf5baf39792a --- /dev/null +++ b/packages/aws-cdk-lib/aws-memorydb/README.md @@ -0,0 +1,27 @@ +# AWS::MemoryDB Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as memorydb from 'aws-cdk-lib/aws-memorydb'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MemoryDB construct libraries](https://constructs.dev/search?q=memorydb) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MemoryDB resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MemoryDB.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MemoryDB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MemoryDB.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-memorydb/index.ts b/packages/aws-cdk-lib/aws-memorydb/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-memorydb/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-memorydb/lib/index.ts b/packages/aws-cdk-lib/aws-memorydb/lib/index.ts new file mode 100644 index 0000000000000..8191c532390ec --- /dev/null +++ b/packages/aws-cdk-lib/aws-memorydb/lib/index.ts @@ -0,0 +1 @@ +export * from './memorydb.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-msk/.jsiirc.json b/packages/aws-cdk-lib/aws-msk/.jsiirc.json new file mode 100644 index 0000000000000..20e3c02bad4ee --- /dev/null +++ b/packages/aws-cdk-lib/aws-msk/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MSK" + }, + "java": { + "package": "software.amazon.awscdk.services.msk" + }, + "python": { + "module": "aws_cdk.aws_msk" + } + } +} diff --git a/packages/aws-cdk-lib/aws-msk/README.md b/packages/aws-cdk-lib/aws-msk/README.md new file mode 100644 index 0000000000000..368c8db22cb32 --- /dev/null +++ b/packages/aws-cdk-lib/aws-msk/README.md @@ -0,0 +1,32 @@ +# Amazon Managed Streaming for Apache Kafka Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as msk from 'aws-cdk-lib/aws-msk'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MSK construct libraries](https://constructs.dev/search?q=msk) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MSK resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MSK.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-msk-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MSK](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MSK.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-msk/index.ts b/packages/aws-cdk-lib/aws-msk/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-msk/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-msk/lib/index.ts b/packages/aws-cdk-lib/aws-msk/lib/index.ts new file mode 100644 index 0000000000000..9f8ed67efeb91 --- /dev/null +++ b/packages/aws-cdk-lib/aws-msk/lib/index.ts @@ -0,0 +1 @@ +export * from './msk.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-mwaa/.jsiirc.json b/packages/aws-cdk-lib/aws-mwaa/.jsiirc.json new file mode 100644 index 0000000000000..66cb4c43af8ae --- /dev/null +++ b/packages/aws-cdk-lib/aws-mwaa/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.MWAA" + }, + "java": { + "package": "software.amazon.awscdk.services.mwaa" + }, + "python": { + "module": "aws_cdk.aws_mwaa" + } + } +} diff --git a/packages/aws-cdk-lib/aws-mwaa/README.md b/packages/aws-cdk-lib/aws-mwaa/README.md new file mode 100644 index 0000000000000..6fa7265775873 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mwaa/README.md @@ -0,0 +1,27 @@ +# AWS::MWAA Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as mwaa from 'aws-cdk-lib/aws-mwaa'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for MWAA construct libraries](https://constructs.dev/search?q=mwaa) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::MWAA resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MWAA.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::MWAA](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_MWAA.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-mwaa/index.ts b/packages/aws-cdk-lib/aws-mwaa/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-mwaa/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-mwaa/lib/index.ts b/packages/aws-cdk-lib/aws-mwaa/lib/index.ts new file mode 100644 index 0000000000000..d3ced1d5f2006 --- /dev/null +++ b/packages/aws-cdk-lib/aws-mwaa/lib/index.ts @@ -0,0 +1 @@ +export * from './mwaa.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-neptune/.jsiirc.json b/packages/aws-cdk-lib/aws-neptune/.jsiirc.json new file mode 100644 index 0000000000000..aa658139d6c7c --- /dev/null +++ b/packages/aws-cdk-lib/aws-neptune/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Neptune" + }, + "java": { + "package": "software.amazon.awscdk.services.neptune" + }, + "python": { + "module": "aws_cdk.aws_neptune" + } + } +} diff --git a/packages/aws-cdk-lib/aws-neptune/README.md b/packages/aws-cdk-lib/aws-neptune/README.md new file mode 100644 index 0000000000000..2c4738ae4fbdf --- /dev/null +++ b/packages/aws-cdk-lib/aws-neptune/README.md @@ -0,0 +1,32 @@ +# Amazon Neptune Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as neptune from 'aws-cdk-lib/aws-neptune'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Neptune construct libraries](https://constructs.dev/search?q=neptune) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Neptune resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Neptune.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-neptune-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Neptune](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Neptune.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-neptune/index.ts b/packages/aws-cdk-lib/aws-neptune/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-neptune/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-neptune/lib/index.ts b/packages/aws-cdk-lib/aws-neptune/lib/index.ts new file mode 100644 index 0000000000000..fece5f94c15b2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-neptune/lib/index.ts @@ -0,0 +1 @@ +export * from './neptune.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-networkfirewall/.jsiirc.json b/packages/aws-cdk-lib/aws-networkfirewall/.jsiirc.json new file mode 100644 index 0000000000000..93e4d201b3c83 --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkfirewall/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.NetworkFirewall" + }, + "java": { + "package": "software.amazon.awscdk.services.networkfirewall" + }, + "python": { + "module": "aws_cdk.aws_networkfirewall" + } + } +} diff --git a/packages/aws-cdk-lib/aws-networkfirewall/README.md b/packages/aws-cdk-lib/aws-networkfirewall/README.md new file mode 100644 index 0000000000000..7c69bf2cd2c4a --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkfirewall/README.md @@ -0,0 +1,27 @@ +# AWS::NetworkFirewall Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as networkfirewall from 'aws-cdk-lib/aws-networkfirewall'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for NetworkFirewall construct libraries](https://constructs.dev/search?q=networkfirewall) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::NetworkFirewall resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkFirewall.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::NetworkFirewall](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkFirewall.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-networkfirewall/index.ts b/packages/aws-cdk-lib/aws-networkfirewall/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkfirewall/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-networkfirewall/lib/index.ts b/packages/aws-cdk-lib/aws-networkfirewall/lib/index.ts new file mode 100644 index 0000000000000..106950f2de3ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkfirewall/lib/index.ts @@ -0,0 +1 @@ +export * from './networkfirewall.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-networkmanager/.jsiirc.json b/packages/aws-cdk-lib/aws-networkmanager/.jsiirc.json new file mode 100644 index 0000000000000..d3ee256fa6653 --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkmanager/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.NetworkManager" + }, + "java": { + "package": "software.amazon.awscdk.services.networkmanager" + }, + "python": { + "module": "aws_cdk.aws_networkmanager" + } + } +} diff --git a/packages/aws-cdk-lib/aws-networkmanager/README.md b/packages/aws-cdk-lib/aws-networkmanager/README.md new file mode 100644 index 0000000000000..f28441ea9898c --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkmanager/README.md @@ -0,0 +1,27 @@ +# AWS::NetworkManager Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as networkmanager from 'aws-cdk-lib/aws-networkmanager'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for NetworkManager construct libraries](https://constructs.dev/search?q=networkmanager) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::NetworkManager resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkManager.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::NetworkManager](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NetworkManager.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-networkmanager/index.ts b/packages/aws-cdk-lib/aws-networkmanager/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkmanager/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-networkmanager/lib/index.ts b/packages/aws-cdk-lib/aws-networkmanager/lib/index.ts new file mode 100644 index 0000000000000..396abf43752b2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-networkmanager/lib/index.ts @@ -0,0 +1 @@ +export * from './networkmanager.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-nimblestudio/.jsiirc.json b/packages/aws-cdk-lib/aws-nimblestudio/.jsiirc.json new file mode 100644 index 0000000000000..0557623cabea6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-nimblestudio/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.NimbleStudio" + }, + "java": { + "package": "software.amazon.awscdk.services.nimblestudio" + }, + "python": { + "module": "aws_cdk.aws_nimblestudio" + } + } +} diff --git a/packages/aws-cdk-lib/aws-nimblestudio/README.md b/packages/aws-cdk-lib/aws-nimblestudio/README.md new file mode 100644 index 0000000000000..35199d5a084b4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-nimblestudio/README.md @@ -0,0 +1,27 @@ +# AWS::NimbleStudio Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as nimblestudio from 'aws-cdk-lib/aws-nimblestudio'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for NimbleStudio construct libraries](https://constructs.dev/search?q=nimblestudio) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::NimbleStudio resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NimbleStudio.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::NimbleStudio](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_NimbleStudio.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-nimblestudio/index.ts b/packages/aws-cdk-lib/aws-nimblestudio/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-nimblestudio/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-nimblestudio/lib/index.ts b/packages/aws-cdk-lib/aws-nimblestudio/lib/index.ts new file mode 100644 index 0000000000000..8412fc4eae02a --- /dev/null +++ b/packages/aws-cdk-lib/aws-nimblestudio/lib/index.ts @@ -0,0 +1 @@ +export * from './nimblestudio.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-oam/.jsiirc.json b/packages/aws-cdk-lib/aws-oam/.jsiirc.json new file mode 100644 index 0000000000000..15e485c815a5c --- /dev/null +++ b/packages/aws-cdk-lib/aws-oam/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Oam" + }, + "java": { + "package": "software.amazon.awscdk.services.oam" + }, + "python": { + "module": "aws_cdk.aws_oam" + } + } +} diff --git a/packages/aws-cdk-lib/aws-oam/README.md b/packages/aws-cdk-lib/aws-oam/README.md new file mode 100644 index 0000000000000..bb3e8e9829ccc --- /dev/null +++ b/packages/aws-cdk-lib/aws-oam/README.md @@ -0,0 +1,27 @@ +# AWS::Oam Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as oam from 'aws-cdk-lib/aws-oam'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Oam construct libraries](https://constructs.dev/search?q=oam) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Oam resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Oam.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Oam](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Oam.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-oam/index.ts b/packages/aws-cdk-lib/aws-oam/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-oam/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-oam/lib/index.ts b/packages/aws-cdk-lib/aws-oam/lib/index.ts new file mode 100644 index 0000000000000..4e064ea71f60d --- /dev/null +++ b/packages/aws-cdk-lib/aws-oam/lib/index.ts @@ -0,0 +1 @@ +export * from './oam.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-omics/.jsiirc.json b/packages/aws-cdk-lib/aws-omics/.jsiirc.json new file mode 100644 index 0000000000000..fc782e184eed9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-omics/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Omics" + }, + "java": { + "package": "software.amazon.awscdk.services.omics" + }, + "python": { + "module": "aws_cdk.aws_omics" + } + } +} diff --git a/packages/aws-cdk-lib/aws-omics/README.md b/packages/aws-cdk-lib/aws-omics/README.md new file mode 100644 index 0000000000000..859d166a4fa45 --- /dev/null +++ b/packages/aws-cdk-lib/aws-omics/README.md @@ -0,0 +1,27 @@ +# AWS::Omics Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as omics from 'aws-cdk-lib/aws-omics'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Omics construct libraries](https://constructs.dev/search?q=omics) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Omics resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Omics.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Omics](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Omics.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-omics/index.ts b/packages/aws-cdk-lib/aws-omics/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-omics/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-omics/lib/index.ts b/packages/aws-cdk-lib/aws-omics/lib/index.ts new file mode 100644 index 0000000000000..ca1130da126f5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-omics/lib/index.ts @@ -0,0 +1 @@ +export * from './omics.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-opensearchserverless/.jsiirc.json b/packages/aws-cdk-lib/aws-opensearchserverless/.jsiirc.json new file mode 100644 index 0000000000000..b6f4fee113f76 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchserverless/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.OpenSearchServerless" + }, + "java": { + "package": "software.amazon.awscdk.services.opensearchserverless" + }, + "python": { + "module": "aws_cdk.aws_opensearchserverless" + } + } +} diff --git a/packages/aws-cdk-lib/aws-opensearchserverless/README.md b/packages/aws-cdk-lib/aws-opensearchserverless/README.md new file mode 100644 index 0000000000000..102a056173d5c --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchserverless/README.md @@ -0,0 +1,27 @@ +# AWS::OpenSearchServerless Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as opensearchserverless from 'aws-cdk-lib/aws-opensearchserverless'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for OpenSearchServerless construct libraries](https://constructs.dev/search?q=opensearchserverless) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::OpenSearchServerless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpenSearchServerless.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::OpenSearchServerless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpenSearchServerless.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-opensearchserverless/index.ts b/packages/aws-cdk-lib/aws-opensearchserverless/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchserverless/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-opensearchserverless/lib/index.ts b/packages/aws-cdk-lib/aws-opensearchserverless/lib/index.ts new file mode 100644 index 0000000000000..362486cb7f5a5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchserverless/lib/index.ts @@ -0,0 +1 @@ +export * from './opensearchserverless.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-opensearchservice/.jsiirc.json b/packages/aws-cdk-lib/aws-opensearchservice/.jsiirc.json new file mode 100644 index 0000000000000..c1d6d5ba77c1c --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.OpenSearchService" + }, + "java": { + "package": "software.amazon.awscdk.services.opensearchservice" + }, + "python": { + "module": "aws_cdk.aws_opensearchservice" + } + } +} diff --git a/packages/aws-cdk-lib/aws-opensearchservice/README.md b/packages/aws-cdk-lib/aws-opensearchservice/README.md new file mode 100644 index 0000000000000..4cc95a5493a85 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/README.md @@ -0,0 +1,376 @@ +# Amazon OpenSearch Service Construct Library + + +See [Migrating to OpenSearch](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-elasticsearch-readme.html#migrating-to-opensearch) for migration instructions from `@aws-cdk/aws-elasticsearch` to this module, `@aws-cdk/aws-opensearchservice`. + +## Quick start + +Create a development cluster by simply specifying the version: + +```ts +const devDomain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, +}); +``` + +To perform version upgrades without replacing the entire domain, specify the `enableVersionUpgrade` property. + +```ts +const devDomain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + enableVersionUpgrade: true, // defaults to false +}); +``` + +Create a production grade cluster by also specifying things like capacity and az distribution + +```ts +const prodDomain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + capacity: { + masterNodes: 5, + dataNodes: 20, + }, + ebs: { + volumeSize: 20, + }, + zoneAwareness: { + availabilityZoneCount: 3, + }, + logging: { + slowSearchLogEnabled: true, + appLogEnabled: true, + slowIndexLogEnabled: true, + }, +}); +``` + +This creates an Amazon OpenSearch Service cluster and automatically sets up log groups for +logging the domain logs and slow search logs. + +## A note about SLR + +Some cluster configurations (e.g VPC access) require the existence of the [`AWSServiceRoleForAmazonElasticsearchService`](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/slr.html) Service-Linked Role. + +When performing such operations via the AWS Console, this SLR is created automatically when needed. However, this is not the behavior when using CloudFormation. If an SLR is needed, but doesn't exist, you will encounter a failure message similar to: + +```console +Before you can proceed, you must enable a service-linked role to give Amazon OpenSearch Service... +``` + +To resolve this, you need to [create](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#create-service-linked-role) the SLR. We recommend using the AWS CLI: + +```console +aws iam create-service-linked-role --aws-service-name es.amazonaws.com +``` + +You can also create it using the CDK, **but note that only the first application deploying this will succeed**: + +```ts +const slr = new iam.CfnServiceLinkedRole(this, 'Service Linked Role', { + awsServiceName: 'es.amazonaws.com', +}); +``` + +## Importing existing domains + +### Using a known domain endpoint + +To import an existing domain into your CDK application, use the `Domain.fromDomainEndpoint` factory method. +This method accepts a domain endpoint of an already existing domain: + +```ts +const domainEndpoint = 'https://my-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com'; +const domain = Domain.fromDomainEndpoint(this, 'ImportedDomain', domainEndpoint); +``` + +### Using the output of another CloudFormation stack + +To import an existing domain with the help of an exported value from another CloudFormation stack, +use the `Domain.fromDomainAttributes` factory method. This will accept tokens. + +```ts +const domainArn = Fn.importValue(`another-cf-stack-export-domain-arn`); +const domainEndpoint = Fn.importValue(`another-cf-stack-export-domain-endpoint`); +const domain = Domain.fromDomainAttributes(this, 'ImportedDomain', { + domainArn, + domainEndpoint, +}); +``` + +## Permissions + +### IAM + +Helper methods also exist for managing access to the domain. + +```ts +declare const fn: lambda.Function; +declare const domain: Domain; + +// Grant write access to the app-search index +domain.grantIndexWrite('app-search', fn); + +// Grant read access to the 'app-search/_search' path +domain.grantPathRead('app-search/_search', fn); +``` + +## Encryption + +The domain can also be created with encryption enabled: + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + ebs: { + volumeSize: 100, + volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, +}); +``` + +This sets up the domain with node to node encryption and encryption at +rest. You can also choose to supply your own KMS key to use for encryption at +rest. + +## VPC Support + +Domains can be placed inside a VPC, providing a secure communication between Amazon OpenSearch Service and other services within the VPC without the need for an internet gateway, NAT device, or VPN connection. + +> Visit [VPC Support for Amazon OpenSearch Service Domains](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html) for more details. + +```ts +const vpc = new ec2.Vpc(this, 'Vpc'); +const domainProps: DomainProps = { + version: EngineVersion.OPENSEARCH_1_0, + removalPolicy: RemovalPolicy.DESTROY, + vpc, + // must be enabled since our VPC contains multiple private subnets. + zoneAwareness: { + enabled: true, + }, + capacity: { + // must be an even number since the default az count is 2. + dataNodes: 2, + }, +}; +new Domain(this, 'Domain', domainProps); +``` + +In addition, you can use the `vpcSubnets` property to control which specific subnets will be used, and the `securityGroups` property to control +which security groups will be attached to the domain. By default, CDK will select all *private* subnets in the VPC, and create one dedicated security group. + +## Metrics + +Helper methods exist to access common domain metrics for example: + +```ts +declare const domain: Domain; +const freeStorageSpace = domain.metricFreeStorageSpace(); +const masterSysMemoryUtilization = domain.metric('MasterSysMemoryUtilization'); +``` + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Fine grained access control + +The domain can also be created with a master user configured. The password can +be supplied or dynamically created if not supplied. + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + enforceHttps: true, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + fineGrainedAccessControl: { + masterUserName: 'master-user', + }, +}); + +const masterUserPassword = domain.masterUserPassword; +``` + +## Using unsigned basic auth + +For convenience, the domain can be configured to allow unsigned HTTP requests +that use basic auth. Unless the domain is configured to be part of a VPC this +means anyone can access the domain using the configured master username and +password. + +To enable unsigned basic auth access the domain is configured with an access +policy that allows anonymous requests, HTTPS required, node to node encryption, +encryption at rest and fine grained access control. + +If the above settings are not set they will be configured as part of enabling +unsigned basic auth. If they are set with conflicting values, an error will be +thrown. + +If no master user is configured a default master user is created with the +username `admin`. + +If no password is configured a default master user password is created and +stored in the AWS Secrets Manager as secret. The secret has the prefix +`MasterUser`. + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + useUnsignedBasicAuth: true, +}); + +const masterUserPassword = domain.masterUserPassword; +``` + +## Custom access policies + +If the domain requires custom access control it can be configured either as a +constructor property, or later by means of a helper method. + +For simple permissions the `accessPolicies` constructor may be sufficient: + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + accessPolicies: [ + new iam.PolicyStatement({ + actions: ['es:*ESHttpPost', 'es:ESHttpPut*'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('123456789012')], + resources: ['*'], + }), + ] +}); +``` + +For more complex use-cases, for example, to set the domain up to receive data from a +[cross-account Kinesis Firehose](https://aws.amazon.com/premiumsupport/knowledge-center/kinesis-firehose-cross-account-streaming/) the `addAccessPolicies` helper method +allows for policies that include the explicit domain ARN. + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, +}); +domain.addAccessPolicies( + new iam.PolicyStatement({ + actions: ['es:ESHttpPost', 'es:ESHttpPut'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('123456789012')], + resources: [domain.domainArn, `${domain.domainArn}/*`], + }), + new iam.PolicyStatement({ + actions: ['es:ESHttpGet'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('123456789012')], + resources: [ + `${domain.domainArn}/_all/_settings`, + `${domain.domainArn}/_cluster/stats`, + `${domain.domainArn}/index-name*/_mapping/type-name`, + `${domain.domainArn}/roletest*/_mapping/roletest`, + `${domain.domainArn}/_nodes`, + `${domain.domainArn}/_nodes/stats`, + `${domain.domainArn}/_nodes/*/stats`, + `${domain.domainArn}/_stats`, + `${domain.domainArn}/index-name*/_stats`, + `${domain.domainArn}/roletest*/_stat`, + ], + }), +); +``` + + +## Audit logs + +Audit logs can be enabled for a domain, but only when fine grained access control is enabled. + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + enforceHttps: true, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + fineGrainedAccessControl: { + masterUserName: 'master-user', + }, + logging: { + auditLogEnabled: true, + slowSearchLogEnabled: true, + appLogEnabled: true, + slowIndexLogEnabled: true, + }, +}); +``` + +## UltraWarm + +UltraWarm nodes can be enabled to provide a cost-effective way to store large amounts of read-only data. + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + capacity: { + masterNodes: 2, + warmNodes: 2, + warmInstanceType: 'ultrawarm1.medium.search', + }, +}); +``` + +## Custom endpoint + +Custom endpoints can be configured to reach the domain under a custom domain name. + +```ts +new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + customEndpoint: { + domainName: 'search.example.com', + }, +}); +``` + +It is also possible to specify a custom certificate instead of the auto-generated one. + +Additionally, an automatic CNAME-Record is created if a hosted zone is provided for the custom endpoint + +## Advanced options + +[Advanced options](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options) can used to configure additional options. + +```ts +new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + advancedOptions: { + 'rest.action.multi.allow_explicit_index': 'false', + 'indices.fielddata.cache.size': '25', + 'indices.query.bool.max_clause_count': '2048', + }, +}); +``` + +## Amazon Cognito authentication for OpenSearch Dashboards + +The domain can be configured to use Amazon Cognito authentication for OpenSearch Dashboards. + +> Visit [Configuring Amazon Cognito authentication for OpenSearch Dashboards](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html) for more details. + +```ts +declare const cognitoConfigurationRole: iam.Role; + +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_0, + cognitoDashboardsAuth: { + role: cognitoConfigurationRole, + identityPoolId: 'example-identity-pool-id', + userPoolId: 'example-user-pool-id', + }, +}); +``` diff --git a/packages/aws-cdk-lib/aws-opensearchservice/index.ts b/packages/aws-cdk-lib/aws-opensearchservice/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts new file mode 100644 index 0000000000000..d37cf8e352860 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts @@ -0,0 +1,1815 @@ +import { URL } from 'url'; + +import * as acm from '../../aws-certificatemanager'; +import { Metric, MetricOptions, Statistic } from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as route53 from '../../aws-route53'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; +import { Construct } from 'constructs'; + +import { LogGroupResourcePolicy } from './log-group-resource-policy'; +import { OpenSearchAccessPolicy } from './opensearch-access-policy'; +import { CfnDomain } from './opensearchservice.generated'; +import * as perms from './perms'; +import { EngineVersion } from './version'; + +/** + * Configures the capacity of the cluster such as the instance type and the + * number of instances. + */ +export interface CapacityConfig { + /** + * The number of instances to use for the master node. + * + * @default - no dedicated master nodes + */ + readonly masterNodes?: number; + + /** + * The hardware configuration of the computer that hosts the dedicated master + * node, such as `m3.medium.search`. For valid values, see [Supported + * Instance Types] + * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html) + * in the Amazon OpenSearch Service Developer Guide. + * + * @default - r5.large.search + */ + readonly masterNodeInstanceType?: string; + + /** + * The number of data nodes (instances) to use in the Amazon OpenSearch Service domain. + * + * @default - 1 + */ + readonly dataNodes?: number; + + /** + * The instance type for your data nodes, such as + * `m3.medium.search`. For valid values, see [Supported Instance + * Types](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html) + * in the Amazon OpenSearch Service Developer Guide. + * + * @default - r5.large.search + */ + readonly dataNodeInstanceType?: string; + + /** + * The number of UltraWarm nodes (instances) to use in the Amazon OpenSearch Service domain. + * + * @default - no UltraWarm nodes + */ + readonly warmNodes?: number; + + /** + * The instance type for your UltraWarm node, such as `ultrawarm1.medium.search`. + * For valid values, see [UltraWarm Storage Limits] + * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#limits-ultrawarm) + * in the Amazon OpenSearch Service Developer Guide. + * + * @default - ultrawarm1.medium.search + */ + readonly warmInstanceType?: string; + +} + +/** + * Specifies zone awareness configuration options. + */ +export interface ZoneAwarenessConfig { + /** + * Indicates whether to enable zone awareness for the Amazon OpenSearch Service domain. + * When you enable zone awareness, Amazon OpenSearch Service allocates the nodes and replica + * index shards that belong to a cluster across two Availability Zones (AZs) + * in the same region to prevent data loss and minimize downtime in the event + * of node or data center failure. Don't enable zone awareness if your cluster + * has no replica index shards or is a single-node cluster. For more information, + * see [Configuring a Multi-AZ Domain] + * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html) + * in the Amazon OpenSearch Service Developer Guide. + * + * @default - false + */ + readonly enabled?: boolean; + + /** + * If you enabled multiple Availability Zones (AZs), the number of AZs that you + * want the domain to use. Valid values are 2 and 3. + * + * @default - 2 if zone awareness is enabled. + */ + readonly availabilityZoneCount?: number; +} + +/** + * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that + * are attached to data nodes in the Amazon OpenSearch Service domain. For more information, see + * [Amazon EBS] + * (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) + * in the Amazon Elastic Compute Cloud Developer Guide. + */ +export interface EbsOptions { + /** + * Specifies whether Amazon EBS volumes are attached to data nodes in the + * Amazon OpenSearch Service domain. + * + * @default - true + */ + readonly enabled?: boolean; + + /** + * The number of I/O operations per second (IOPS) that the volume + * supports. This property applies only to the Provisioned IOPS (SSD) EBS + * volume type. + * + * @default - iops are not set. + */ + readonly iops?: number; + + /** + * The size (in GiB) of the EBS volume for each data node. The minimum and + * maximum size of an EBS volume depends on the EBS volume type and the + * instance type to which it is attached. For valid values, see + * [EBS volume size limits] + * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#ebsresource) + * in the Amazon OpenSearch Service Developer Guide. + * + * @default 10 + */ + readonly volumeSize?: number; + + /** + * The EBS volume type to use with the Amazon OpenSearch Service domain, such as standard, gp2, io1. + * + * @default gp2 + */ + readonly volumeType?: ec2.EbsDeviceVolumeType; +} + +/** + * Configures log settings for the domain. + */ +export interface LoggingOptions { + /** + * Specify if slow search logging should be set up. + * Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. + * + * @default - false + */ + readonly slowSearchLogEnabled?: boolean; + + /** + * Log slow searches to this log group. + * + * @default - a new log group is created if slow search logging is enabled + */ + readonly slowSearchLogGroup?: logs.ILogGroup; + + /** + * Specify if slow index logging should be set up. + * Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. + * + * @default - false + */ + readonly slowIndexLogEnabled?: boolean; + + /** + * Log slow indices to this log group. + * + * @default - a new log group is created if slow index logging is enabled + */ + readonly slowIndexLogGroup?: logs.ILogGroup; + + /** + * Specify if Amazon OpenSearch Service application logging should be set up. + * Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. + * + * @default - false + */ + readonly appLogEnabled?: boolean; + + /** + * Log Amazon OpenSearch Service application logs to this log group. + * + * @default - a new log group is created if app logging is enabled + */ + readonly appLogGroup?: logs.ILogGroup; + + /** + * Specify if Amazon OpenSearch Service audit logging should be set up. + * Requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later and fine grained access control to be enabled. + * + * @default - false + */ + readonly auditLogEnabled?: boolean; + + /** + * Log Amazon OpenSearch Service audit logs to this log group. + * + * @default - a new log group is created if audit logging is enabled + */ + readonly auditLogGroup?: logs.ILogGroup; +} + +/** + * Whether the domain should encrypt data at rest, and if so, the AWS Key + * Management Service (KMS) key to use. Can only be used to create a new domain, + * not update an existing one. Requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later. + */ +export interface EncryptionAtRestOptions { + /** + * Specify true to enable encryption at rest. + * + * @default - encryption at rest is disabled. + */ + readonly enabled?: boolean; + + /** + * Supply if using KMS key for encryption at rest. + * + * @default - uses default aws/es KMS key. + */ + readonly kmsKey?: kms.IKey; +} + +/** + * Configures Amazon OpenSearch Service to use Amazon Cognito authentication for OpenSearch Dashboards. + * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html + */ +export interface CognitoOptions { + /** + * The Amazon Cognito identity pool ID that you want Amazon OpenSearch Service to use for OpenSearch Dashboards authentication. + */ + readonly identityPoolId: string; + + /** + * A role that allows Amazon OpenSearch Service to configure your user pool and identity pool. It must have the `AmazonESCognitoAccess` policy attached to it. + * + * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/cognito-auth.html#cognito-auth-prereq + */ + readonly role: iam.IRole; + + /** + * The Amazon Cognito user pool ID that you want Amazon OpenSearch Service to use for OpenSearch Dashboards authentication. + */ + readonly userPoolId: string; +} + +/** + * The minimum TLS version required for traffic to the domain. + */ +export enum TLSSecurityPolicy { + /** Cipher suite TLS 1.0 */ + TLS_1_0 = 'Policy-Min-TLS-1-0-2019-07', + /** Cipher suite TLS 1.2 */ + TLS_1_2 = 'Policy-Min-TLS-1-2-2019-07' +} + +/** + * Specifies options for fine-grained access control. + */ +export interface AdvancedSecurityOptions { + /** + * ARN for the master user. Only specify this or masterUserName, but not both. + * + * @default - fine-grained access control is disabled + */ + readonly masterUserArn?: string; + + /** + * Username for the master user. Only specify this or masterUserArn, but not both. + * + * @default - fine-grained access control is disabled + */ + readonly masterUserName?: string; + + /** + * Password for the master user. + * + * You can use `SecretValue.unsafePlainText` to specify a password in plain text or + * use `secretsmanager.Secret.fromSecretAttributes` to reference a secret in + * Secrets Manager. + * + * @default - A Secrets Manager generated password + */ + readonly masterUserPassword?: cdk.SecretValue; +} + +/** + * Configures a custom domain endpoint for the Amazon OpenSearch Service domain + */ +export interface CustomEndpointOptions { + /** + * The custom domain name to assign + */ + readonly domainName: string; + + /** + * The certificate to use + * @default - create a new one + */ + readonly certificate?: acm.ICertificate; + + /** + * The hosted zone in Route53 to create the CNAME record in + * @default - do not create a CNAME + */ + readonly hostedZone?: route53.IHostedZone; +} + +/** + * Properties for an Amazon OpenSearch Service domain. + */ +export interface DomainProps { + /** + * Domain access policies. + * + * @default - No access policies. + */ + readonly accessPolicies?: iam.PolicyStatement[]; + + /** + * Additional options to specify for the Amazon OpenSearch Service domain. + * + * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html#createdomain-configure-advanced-options + * @default - no advanced options are specified + */ + readonly advancedOptions?: { [key: string]: (string) }; + + /** + * Configures Amazon OpenSearch Service to use Amazon Cognito authentication for OpenSearch Dashboards. + * + * @default - Cognito not used for authentication to OpenSearch Dashboards. + */ + readonly cognitoDashboardsAuth?: CognitoOptions; + + /** + * Enforces a particular physical domain name. + * + * @default - A name will be auto-generated. + */ + readonly domainName?: string; + + /** + * The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that + * are attached to data nodes in the Amazon OpenSearch Service domain. + * + * @default - 10 GiB General Purpose (SSD) volumes per node. + */ + readonly ebs?: EbsOptions; + + /** + * The cluster capacity configuration for the Amazon OpenSearch Service domain. + * + * @default - 1 r5.large.search data node; no dedicated master nodes. + */ + readonly capacity?: CapacityConfig; + + /** + * The cluster zone awareness configuration for the Amazon OpenSearch Service domain. + * + * @default - no zone awareness (1 AZ) + */ + readonly zoneAwareness?: ZoneAwarenessConfig; + + /** + * The Elasticsearch/OpenSearch version that your domain will leverage. + */ + readonly version: EngineVersion; + + /** + * Encryption at rest options for the cluster. + * + * @default - No encryption at rest + */ + readonly encryptionAtRest?: EncryptionAtRestOptions; + + /** + * Configuration log publishing configuration options. + * + * @default - No logs are published + */ + readonly logging?: LoggingOptions; + + /** + * Specify true to enable node to node encryption. + * Requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later. + * + * @default - Node to node encryption is not enabled. + */ + readonly nodeToNodeEncryption?: boolean; + + /** + * The hour in UTC during which the service takes an automated daily snapshot + * of the indices in the Amazon OpenSearch Service domain. Only applies for Elasticsearch versions + * below 5.3. + * + * @default - Hourly automated snapshots not used + */ + readonly automatedSnapshotStartHour?: number; + + /** + * Place the domain inside this VPC. + * + * @see https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html + * @default - Domain is not placed in a VPC. + */ + readonly vpc?: ec2.IVpc; + + /** + * The list of security groups that are associated with the VPC endpoints + * for the domain. + * + * Only used if `vpc` is specified. + * + * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html + * @default - One new security group is created. + */ + readonly securityGroups?: ec2.ISecurityGroup[]; + + /** + * The specific vpc subnets the domain will be placed in. You must provide one subnet for each Availability Zone + * that your domain uses. For example, you must specify three subnet IDs for a three Availability Zone + * domain. + * + * Only used if `vpc` is specified. + * + * @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html + * @default - All private subnets. + */ + readonly vpcSubnets?: ec2.SubnetSelection[]; + + /** + * True to require that all traffic to the domain arrive over HTTPS. + * + * @default - false + */ + readonly enforceHttps?: boolean; + + /** + * The minimum TLS version required for traffic to the domain. + * + * @default - TLSSecurityPolicy.TLS_1_0 + */ + readonly tlsSecurityPolicy?: TLSSecurityPolicy; + + /** + * Specifies options for fine-grained access control. + * Requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later. Enabling fine-grained access control + * also requires encryption of data at rest and node-to-node encryption, along with + * enforced HTTPS. + * + * @default - fine-grained access control is disabled + */ + readonly fineGrainedAccessControl?: AdvancedSecurityOptions; + + /** + * Configures the domain so that unsigned basic auth is enabled. If no master user is provided a default master user + * with username `admin` and a dynamically generated password stored in KMS is created. The password can be retrieved + * by getting `masterUserPassword` from the domain instance. + * + * Setting this to true will also add an access policy that allows unsigned + * access, enable node to node encryption, encryption at rest. If conflicting + * settings are encountered (like disabling encryption at rest) enabling this + * setting will cause a failure. + * + * @default - false + */ + readonly useUnsignedBasicAuth?: boolean; + + /** + * To upgrade an Amazon OpenSearch Service domain to a new version, rather than replacing the entire + * domain resource, use the EnableVersionUpgrade update policy. + * + * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html#cfn-attributes-updatepolicy-upgradeopensearchdomain + * @default - false + */ + readonly enableVersionUpgrade?: boolean; + + /** + * Policy to apply when the domain is removed from the stack + * + * @default RemovalPolicy.RETAIN + */ + readonly removalPolicy?: cdk.RemovalPolicy; + + /** + * To configure a custom domain configure these options + * + * If you specify a Route53 hosted zone it will create a CNAME record and use DNS validation for the certificate + * @default - no custom domain endpoint will be configured + */ + readonly customEndpoint?: CustomEndpointOptions; +} + +/** + * An interface that represents an Amazon OpenSearch Service domain - either created with the CDK, or an existing one. + */ +export interface IDomain extends cdk.IResource { + /** + * Arn of the Amazon OpenSearch Service domain. + * + * @attribute + */ + readonly domainArn: string; + + /** + * Domain name of the Amazon OpenSearch Service domain. + * + * @attribute + */ + readonly domainName: string; + + /** + * Identifier of the Amazon OpenSearch Service domain. + * + * @attribute + */ + readonly domainId: string; + + /** + * Endpoint of the Amazon OpenSearch Service domain. + * + * @attribute + */ + readonly domainEndpoint: string; + + /** + * Grant read permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + */ + grantRead(identity: iam.IGrantable): iam.Grant; + + /** + * Grant write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + */ + grantWrite(identity: iam.IGrantable): iam.Grant; + + /** + * Grant read/write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + */ + grantReadWrite(identity: iam.IGrantable): iam.Grant; + + /** + * Grant read permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + */ + grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + */ + grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant read/write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + */ + grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant read permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + */ + grantPathRead(path: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + */ + grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant; + + /** + * Grant read/write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + */ + grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant; + + /** + * Return the given named metric for this domain. + */ + metric(metricName: string, props?: MetricOptions): Metric; + + /** + * Metric for the time the cluster status is red. + * + * @default maximum over 5 minutes + */ + metricClusterStatusRed(props?: MetricOptions): Metric; + + /** + * Metric for the time the cluster status is yellow. + * + * @default maximum over 5 minutes + */ + metricClusterStatusYellow(props?: MetricOptions): Metric; + + /** + * Metric for the storage space of nodes in the cluster. + * + * @default minimum over 5 minutes + */ + metricFreeStorageSpace(props?: MetricOptions): Metric; + + /** + * Metric for the cluster blocking index writes. + * + * @default maximum over 1 minute + */ + metricClusterIndexWritesBlocked(props?: MetricOptions): Metric; + + /** + * Metric for the number of nodes. + * + * @default minimum over 1 hour + */ + metricNodes(props?: MetricOptions): Metric; + + /** + * Metric for automated snapshot failures. + * + * @default maximum over 5 minutes + */ + metricAutomatedSnapshotFailure(props?: MetricOptions): Metric; + + /** + * Metric for CPU utilization. + * + * @default maximum over 5 minutes + */ + metricCPUUtilization(props?: MetricOptions): Metric; + + /** + * Metric for JVM memory pressure. + * + * @default maximum over 5 minutes + */ + metricJVMMemoryPressure(props?: MetricOptions): Metric; + + /** + * Metric for master CPU utilization. + * + * @default maximum over 5 minutes + */ + metricMasterCPUUtilization(props?: MetricOptions): Metric; + + /** + * Metric for master JVM memory pressure. + * + * @default maximum over 5 minutes + */ + metricMasterJVMMemoryPressure(props?: MetricOptions): Metric; + + /** + * Metric for KMS key errors. + * + * @default maximum over 5 minutes + */ + metricKMSKeyError(props?: MetricOptions): Metric; + + /** + * Metric for KMS key being inaccessible. + * + * @default maximum over 5 minutes + */ + metricKMSKeyInaccessible(props?: MetricOptions): Metric; + + /** + * Metric for number of searchable documents. + * + * @default maximum over 5 minutes + */ + metricSearchableDocuments(props?: MetricOptions): Metric; + + /** + * Metric for search latency. + * + * @default p99 over 5 minutes + */ + metricSearchLatency(props?: MetricOptions): Metric; + + /** + * Metric for indexing latency. + * + * @default p99 over 5 minutes + */ + metricIndexingLatency(props?: MetricOptions): Metric; +} + + +/** + * A new or imported domain. + */ +abstract class DomainBase extends cdk.Resource implements IDomain { + public abstract readonly domainArn: string; + public abstract readonly domainName: string; + public abstract readonly domainId: string; + public abstract readonly domainEndpoint: string; + + /** + * Grant read permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + */ + grantRead(identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_ACTIONS, + this.domainArn, + `${this.domainArn}/*`, + ); + } + + /** + * Grant write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + */ + grantWrite(identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_WRITE_ACTIONS, + this.domainArn, + `${this.domainArn}/*`, + ); + } + + /** + * Grant read/write permissions for this domain and its contents to an IAM + * principal (Role/Group/User). + * + * @param identity The principal + */ + grantReadWrite(identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_WRITE_ACTIONS, + this.domainArn, + `${this.domainArn}/*`, + ); + } + + /** + * Grant read permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + */ + grantIndexRead(index: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_ACTIONS, + `${this.domainArn}/${index}`, + `${this.domainArn}/${index}/*`, + ); + } + + /** + * Grant write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + */ + grantIndexWrite(index: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_WRITE_ACTIONS, + `${this.domainArn}/${index}`, + `${this.domainArn}/${index}/*`, + ); + } + + /** + * Grant read/write permissions for an index in this domain to an IAM + * principal (Role/Group/User). + * + * @param index The index to grant permissions for + * @param identity The principal + */ + grantIndexReadWrite(index: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_WRITE_ACTIONS, + `${this.domainArn}/${index}`, + `${this.domainArn}/${index}/*`, + ); + } + + /** + * Grant read permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + */ + grantPathRead(path: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_ACTIONS, + `${this.domainArn}/${path}`, + ); + } + + /** + * Grant write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + */ + grantPathWrite(path: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_WRITE_ACTIONS, + `${this.domainArn}/${path}`, + ); + } + + /** + * Grant read/write permissions for a specific path in this domain to an IAM + * principal (Role/Group/User). + * + * @param path The path to grant permissions for + * @param identity The principal + */ + grantPathReadWrite(path: string, identity: iam.IGrantable): iam.Grant { + return this.grant( + identity, + perms.ES_READ_WRITE_ACTIONS, + `${this.domainArn}/${path}`, + ); + } + + /** + * Return the given named metric for this domain. + */ + public metric(metricName: string, props?: MetricOptions): Metric { + return new Metric({ + namespace: 'AWS/ES', + metricName, + dimensionsMap: { + DomainName: this.domainName, + ClientId: this.env.account, + }, + ...props, + }).attachTo(this); + } + + /** + * Metric for the time the cluster status is red. + * + * @default maximum over 5 minutes + */ + public metricClusterStatusRed(props?: MetricOptions): Metric { + return this.metric('ClusterStatus.red', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for the time the cluster status is yellow. + * + * @default maximum over 5 minutes + */ + public metricClusterStatusYellow(props?: MetricOptions): Metric { + return this.metric('ClusterStatus.yellow', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for the storage space of nodes in the cluster. + * + * @default minimum over 5 minutes + */ + public metricFreeStorageSpace(props?: MetricOptions): Metric { + return this.metric('FreeStorageSpace', { + statistic: Statistic.MINIMUM, + ...props, + }); + } + + /** + * Metric for the cluster blocking index writes. + * + * @default maximum over 1 minute + */ + public metricClusterIndexWritesBlocked(props?: MetricOptions): Metric { + return this.metric('ClusterIndexWritesBlocked', { + statistic: Statistic.MAXIMUM, + period: cdk.Duration.minutes(1), + ...props, + }); + } + + /** + * Metric for the number of nodes. + * + * @default minimum over 1 hour + */ + public metricNodes(props?: MetricOptions): Metric { + return this.metric('Nodes', { + statistic: Statistic.MINIMUM, + period: cdk.Duration.hours(1), + ...props, + }); + } + + /** + * Metric for automated snapshot failures. + * + * @default maximum over 5 minutes + */ + public metricAutomatedSnapshotFailure(props?: MetricOptions): Metric { + return this.metric('AutomatedSnapshotFailure', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for CPU utilization. + * + * @default maximum over 5 minutes + */ + public metricCPUUtilization(props?: MetricOptions): Metric { + return this.metric('CPUUtilization', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for JVM memory pressure. + * + * @default maximum over 5 minutes + */ + public metricJVMMemoryPressure(props?: MetricOptions): Metric { + return this.metric('JVMMemoryPressure', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for master CPU utilization. + * + * @default maximum over 5 minutes + */ + public metricMasterCPUUtilization(props?: MetricOptions): Metric { + return this.metric('MasterCPUUtilization', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for master JVM memory pressure. + * + * @default maximum over 5 minutes + */ + public metricMasterJVMMemoryPressure(props?: MetricOptions): Metric { + return this.metric('MasterJVMMemoryPressure', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for KMS key errors. + * + * @default maximum over 5 minutes + */ + public metricKMSKeyError(props?: MetricOptions): Metric { + return this.metric('KMSKeyError', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for KMS key being inaccessible. + * + * @default maximum over 5 minutes + */ + public metricKMSKeyInaccessible(props?: MetricOptions): Metric { + return this.metric('KMSKeyInaccessible', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for number of searchable documents. + * + * @default maximum over 5 minutes + */ + public metricSearchableDocuments(props?: MetricOptions): Metric { + return this.metric('SearchableDocuments', { + statistic: Statistic.MAXIMUM, + ...props, + }); + } + + /** + * Metric for search latency. + * + * @default p99 over 5 minutes + */ + public metricSearchLatency(props?: MetricOptions): Metric { + return this.metric('SearchLatency', { statistic: 'p99', ...props }); + } + + /** + * Metric for indexing latency. + * + * @default p99 over 5 minutes + */ + public metricIndexingLatency(props?: MetricOptions): Metric { + return this.metric('IndexingLatency', { statistic: 'p99', ...props }); + } + + private grant( + grantee: iam.IGrantable, + domainActions: string[], + resourceArn: string, + ...otherResourceArns: string[] + ): iam.Grant { + const resourceArns = [resourceArn, ...otherResourceArns]; + + const grant = iam.Grant.addToPrincipal({ + grantee, + actions: domainActions, + resourceArns, + scope: this, + }); + + return grant; + } + +} + + +/** + * Reference to an Amazon OpenSearch Service domain. + */ +export interface DomainAttributes { + /** + * The ARN of the Amazon OpenSearch Service domain. + */ + readonly domainArn: string; + + /** + * The domain endpoint of the Amazon OpenSearch Service domain. + */ + readonly domainEndpoint: string; +} + + +/** + * Provides an Amazon OpenSearch Service domain. + */ +export class Domain extends DomainBase implements IDomain, ec2.IConnectable { + /** + * Creates a domain construct that represents an external domain via domain endpoint. + * + * @param scope The parent creating construct (usually `this`). + * @param id The construct's name. + * @param domainEndpoint The domain's endpoint. + */ + public static fromDomainEndpoint( + scope: Construct, + id: string, + domainEndpoint: string, + ): IDomain { + const stack = cdk.Stack.of(scope); + const domainName = extractNameFromEndpoint(domainEndpoint); + const domainArn = stack.formatArn({ + service: 'es', + resource: 'domain', + resourceName: domainName, + }); + + return Domain.fromDomainAttributes(scope, id, { + domainArn, + domainEndpoint, + }); + } + + /** + * Creates a domain construct that represents an external domain. + * + * @param scope The parent creating construct (usually `this`). + * @param id The construct's name. + * @param attrs A `DomainAttributes` object. + */ + public static fromDomainAttributes(scope: Construct, id: string, attrs: DomainAttributes): IDomain { + const { domainArn, domainEndpoint } = attrs; + const domainName = cdk.Stack.of(scope).splitArn(domainArn, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName + ?? extractNameFromEndpoint(domainEndpoint); + + return new class extends DomainBase { + public readonly domainArn = domainArn; + public readonly domainName = domainName; + public readonly domainId = domainName; + public readonly domainEndpoint = domainEndpoint.replace(/^https?:\/\//, ''); + + constructor() { super(scope, id); } + }; + } + + public readonly domainArn: string; + public readonly domainName: string; + public readonly domainId: string; + public readonly domainEndpoint: string; + + /** + * Log group that slow searches are logged to. + * + * @attribute + */ + public readonly slowSearchLogGroup?: logs.ILogGroup; + + /** + * Log group that slow indices are logged to. + * + * @attribute + */ + public readonly slowIndexLogGroup?: logs.ILogGroup; + + /** + * Log group that application logs are logged to. + * + * @attribute + */ + public readonly appLogGroup?: logs.ILogGroup; + + /** + * Log group that audit logs are logged to. + * + * @attribute + */ + public readonly auditLogGroup?: logs.ILogGroup; + + /** + * Master user password if fine grained access control is configured. + */ + public readonly masterUserPassword?: cdk.SecretValue; + + + private readonly domain: CfnDomain; + + private accessPolicy?: OpenSearchAccessPolicy + + private encryptionAtRestOptions?: EncryptionAtRestOptions + + private readonly _connections: ec2.Connections | undefined; + + constructor(scope: Construct, id: string, props: DomainProps) { + super(scope, id, { + physicalName: props.domainName, + }); + + const defaultInstanceType = 'r5.large.search'; + const warmDefaultInstanceType = 'ultrawarm1.medium.search'; + + const dedicatedMasterType = initializeInstanceType(defaultInstanceType, props.capacity?.masterNodeInstanceType); + const dedicatedMasterCount = props.capacity?.masterNodes ?? 0; + const dedicatedMasterEnabled = cdk.Token.isUnresolved(dedicatedMasterCount) ? true : dedicatedMasterCount > 0; + + const instanceType = initializeInstanceType(defaultInstanceType, props.capacity?.dataNodeInstanceType); + const instanceCount = props.capacity?.dataNodes ?? 1; + + const warmType = initializeInstanceType(warmDefaultInstanceType, props.capacity?.warmInstanceType); + const warmCount = props.capacity?.warmNodes ?? 0; + const warmEnabled = cdk.Token.isUnresolved(warmCount) ? true : warmCount > 0; + + const availabilityZoneCount = + props.zoneAwareness?.availabilityZoneCount ?? 2; + + if (![2, 3].includes(availabilityZoneCount)) { + throw new Error('Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3'); + } + + const zoneAwarenessEnabled = + props.zoneAwareness?.enabled ?? + props.zoneAwareness?.availabilityZoneCount != null; + + + let securityGroups: ec2.ISecurityGroup[] | undefined; + let subnets: ec2.ISubnet[] | undefined; + + let skipZoneAwarenessCheck: boolean = false; + if (props.vpc) { + const subnetSelections = props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }]; + subnets = selectSubnets(props.vpc, subnetSelections); + skipZoneAwarenessCheck = zoneAwarenessCheckShouldBeSkipped(props.vpc, subnetSelections); + securityGroups = props.securityGroups ?? [new ec2.SecurityGroup(this, 'SecurityGroup', { + vpc: props.vpc, + description: `Security group for domain ${this.node.id}`, + })]; + if (props.enforceHttps) { + this._connections = new ec2.Connections({ securityGroups, defaultPort: ec2.Port.tcp(443) }); + } else { + this._connections = new ec2.Connections({ securityGroups }); + } + } + + // If VPC options are supplied ensure that the number of subnets matches the number AZ (only if the vpc is not imported from another stack) + if (subnets && + zoneAwarenessEnabled && + !skipZoneAwarenessCheck && + new Set(subnets.map((subnet) => subnet.availabilityZone)).size < availabilityZoneCount + ) { + throw new Error('When providing vpc options you need to provide a subnet for each AZ you are using'); + } + + if ([dedicatedMasterType, instanceType, warmType].some(t => (!cdk.Token.isUnresolved(t) && !t.endsWith('.search')))) { + throw new Error('Master, data and UltraWarm node instance types must end with ".search".'); + } + + if (!cdk.Token.isUnresolved(warmType) && !warmType.startsWith('ultrawarm')) { + throw new Error('UltraWarm node instance type must start with "ultrawarm".'); + } + + const unsignedBasicAuthEnabled = props.useUnsignedBasicAuth ?? false; + + if (unsignedBasicAuthEnabled) { + if (props.enforceHttps == false) { + throw new Error('You cannot disable HTTPS and use unsigned basic auth'); + } + if (props.nodeToNodeEncryption == false) { + throw new Error('You cannot disable node to node encryption and use unsigned basic auth'); + } + if (props.encryptionAtRest?.enabled == false) { + throw new Error('You cannot disable encryption at rest and use unsigned basic auth'); + } + } + + const unsignedAccessPolicy = new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['es:ESHttp*'], + principals: [new iam.AnyPrincipal()], + resources: [cdk.Lazy.string({ produce: () => `${this.domainArn}/*` })], + }); + + const masterUserArn = props.fineGrainedAccessControl?.masterUserArn; + const masterUserNameProps = props.fineGrainedAccessControl?.masterUserName; + // If basic auth is enabled set the user name to admin if no other user info is supplied. + const masterUserName = unsignedBasicAuthEnabled + ? (masterUserArn == null ? (masterUserNameProps ?? 'admin') : undefined) + : masterUserNameProps; + + if (masterUserArn != null && masterUserName != null) { + throw new Error('Invalid fine grained access control settings. Only provide one of master user ARN or master user name. Not both.'); + } + + const advancedSecurityEnabled = (masterUserArn ?? masterUserName) != null; + const internalUserDatabaseEnabled = masterUserName != null; + const masterUserPasswordProp = props.fineGrainedAccessControl?.masterUserPassword; + const createMasterUserPassword = (): cdk.SecretValue => { + return new secretsmanager.Secret(this, 'MasterUser', { + generateSecretString: { + secretStringTemplate: JSON.stringify({ + username: masterUserName, + }), + generateStringKey: 'password', + excludeCharacters: "{}'\\*[]()`", + }, + }) + .secretValueFromJson('password'); + }; + this.masterUserPassword = internalUserDatabaseEnabled ? + (masterUserPasswordProp ?? createMasterUserPassword()) + : undefined; + + const encryptionAtRestEnabled = + props.encryptionAtRest?.enabled ?? (props.encryptionAtRest?.kmsKey != null || unsignedBasicAuthEnabled); + const nodeToNodeEncryptionEnabled = props.nodeToNodeEncryption ?? unsignedBasicAuthEnabled; + const volumeSize = props.ebs?.volumeSize ?? 10; + const volumeType = props.ebs?.volumeType ?? ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD; + const ebsEnabled = props.ebs?.enabled ?? true; + const enforceHttps = props.enforceHttps ?? unsignedBasicAuthEnabled; + + function isInstanceType(t: string): Boolean { + return dedicatedMasterType.startsWith(t) || instanceType.startsWith(t); + }; + + function isSomeInstanceType(...instanceTypes: string[]): Boolean { + return instanceTypes.some(isInstanceType); + }; + + function isEveryDatanodeInstanceType(...instanceTypes: string[]): Boolean { + return instanceTypes.some(t => instanceType.startsWith(t)); + }; + + // Validate feature support for the given Elasticsearch/OpenSearch version, per + // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/features-by-version.html + const { versionNum: versionNum, isElasticsearchVersion } = parseVersion(props.version); + if (isElasticsearchVersion) { + + if ( + versionNum <= 7.7 && + ![ + 1.5, 2.3, 5.1, 5.3, 5.5, 5.6, 6.0, + 6.2, 6.3, 6.4, 6.5, 6.7, 6.8, 7.1, 7.4, + 7.7, + ].includes(versionNum) + ) { + throw new Error(`Unknown Elasticsearch version: ${versionNum}`); + } + + if (versionNum < 5.1) { + if (props.logging?.appLogEnabled) { + throw new Error('Error logs publishing requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); + } + if (props.encryptionAtRest?.enabled) { + throw new Error('Encryption of data at rest requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); + } + if (props.cognitoDashboardsAuth != null) { + throw new Error('Cognito authentication for OpenSearch Dashboards requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); + } + if (isSomeInstanceType('c5', 'i3', 'm5', 'r5')) { + throw new Error('C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later.'); + } + } + + if (versionNum < 6.0) { + if (props.nodeToNodeEncryption) { + throw new Error('Node-to-node encryption requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later.'); + } + } + + if (versionNum < 6.7) { + if (unsignedBasicAuthEnabled) { + throw new Error('Using unsigned basic auth requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later.'); + } + if (advancedSecurityEnabled) { + throw new Error('Fine-grained access control requires Elasticsearch version 6.7 or later or OpenSearch version 1.0 or later.'); + } + } + + if (versionNum < 6.8 && warmEnabled) { + throw new Error('UltraWarm requires Elasticsearch version 6.8 or later or OpenSearch version 1.0 or later.'); + } + } + + // Validate against instance type restrictions, per + // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html + if (isSomeInstanceType('i3', 'r6gd') && ebsEnabled) { + throw new Error('I3 and R6GD instance types do not support EBS storage volumes.'); + } + + if (isSomeInstanceType('m3', 'r3', 't2') && encryptionAtRestEnabled) { + throw new Error('M3, R3, and T2 instance types do not support encryption of data at rest.'); + } + + if (isInstanceType('t2.micro') && !(isElasticsearchVersion && versionNum <= 2.3)) { + throw new Error('The t2.micro.search instance type supports only Elasticsearch versions 1.5 and 2.3.'); + } + + if (isSomeInstanceType('t2', 't3') && warmEnabled) { + throw new Error('T2 and T3 instance types do not support UltraWarm storage.'); + } + + // Only R3, I3 and r6gd support instance storage, per + // https://aws.amazon.com/opensearch-service/pricing/ + if (!ebsEnabled && !isEveryDatanodeInstanceType('r3', 'i3', 'r6gd')) { + throw new Error('EBS volumes are required when using instance types other than r3, i3 or r6gd.'); + } + + // Fine-grained access control requires node-to-node encryption, encryption at rest, + // and enforced HTTPS. + if (advancedSecurityEnabled) { + if (!nodeToNodeEncryptionEnabled) { + throw new Error('Node-to-node encryption is required when fine-grained access control is enabled.'); + } + if (!encryptionAtRestEnabled) { + throw new Error('Encryption-at-rest is required when fine-grained access control is enabled.'); + } + if (!enforceHttps) { + throw new Error('Enforce HTTPS is required when fine-grained access control is enabled.'); + } + } + + // Validate fine grained access control enabled for audit logs, per + // https://aws.amazon.com/about-aws/whats-new/2020/09/elasticsearch-audit-logs-now-available-on-amazon-elasticsearch-service/ + if (props.logging?.auditLogEnabled && !advancedSecurityEnabled) { + throw new Error('Fine-grained access control is required when audit logs publishing is enabled.'); + } + + // Validate UltraWarm requirement for dedicated master nodes, per + // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ultrawarm.html + if (warmEnabled && !dedicatedMasterEnabled) { + throw new Error('Dedicated master node is required when UltraWarm storage is enabled.'); + } + + let cfnVpcOptions: CfnDomain.VPCOptionsProperty | undefined; + + if (securityGroups && subnets) { + cfnVpcOptions = { + securityGroupIds: securityGroups.map((sg) => sg.securityGroupId), + subnetIds: subnets.map((subnet) => subnet.subnetId), + }; + } + + // Setup logging + const logGroups: logs.ILogGroup[] = []; + + if (props.logging?.slowSearchLogEnabled) { + this.slowSearchLogGroup = props.logging.slowSearchLogGroup ?? + new logs.LogGroup(this, 'SlowSearchLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.slowSearchLogGroup); + }; + + if (props.logging?.slowIndexLogEnabled) { + this.slowIndexLogGroup = props.logging.slowIndexLogGroup ?? + new logs.LogGroup(this, 'SlowIndexLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.slowIndexLogGroup); + }; + + if (props.logging?.appLogEnabled) { + this.appLogGroup = props.logging.appLogGroup ?? + new logs.LogGroup(this, 'AppLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.appLogGroup); + }; + + if (props.logging?.auditLogEnabled) { + this.auditLogGroup = props.logging.auditLogGroup ?? + new logs.LogGroup(this, 'AuditLogs', { + retention: logs.RetentionDays.ONE_MONTH, + }); + + logGroups.push(this.auditLogGroup); + }; + + let logGroupResourcePolicy: LogGroupResourcePolicy | null = null; + if (logGroups.length > 0) { + const logPolicyStatement = new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], + resources: logGroups.map((lg) => lg.logGroupArn), + principals: [new iam.ServicePrincipal('es.amazonaws.com')], + }); + + // Use a custom resource to set the log group resource policy since it is not supported by CDK and cfn. + // https://github.com/aws/aws-cdk/issues/5343 + logGroupResourcePolicy = new LogGroupResourcePolicy(this, `ESLogGroupPolicy${this.node.addr}`, { + // create a cloudwatch logs resource policy name that is unique to this domain instance + policyName: `ESLogPolicy${this.node.addr}`, + policyStatements: [logPolicyStatement], + }); + } + + const logPublishing: Record = {}; + + if (this.appLogGroup) { + logPublishing.ES_APPLICATION_LOGS = { + enabled: true, + cloudWatchLogsLogGroupArn: this.appLogGroup.logGroupArn, + }; + } + + if (this.slowSearchLogGroup) { + logPublishing.SEARCH_SLOW_LOGS = { + enabled: true, + cloudWatchLogsLogGroupArn: this.slowSearchLogGroup.logGroupArn, + }; + } + + if (this.slowIndexLogGroup) { + logPublishing.INDEX_SLOW_LOGS = { + enabled: true, + cloudWatchLogsLogGroupArn: this.slowIndexLogGroup.logGroupArn, + }; + } + + if (this.auditLogGroup) { + logPublishing.AUDIT_LOGS = { + enabled: this.auditLogGroup != null, + cloudWatchLogsLogGroupArn: this.auditLogGroup?.logGroupArn, + }; + } + + let customEndpointCertificate: acm.ICertificate | undefined; + if (props.customEndpoint) { + if (props.customEndpoint.certificate) { + customEndpointCertificate = props.customEndpoint.certificate; + } else { + customEndpointCertificate = new acm.Certificate(this, 'CustomEndpointCertificate', { + domainName: props.customEndpoint.domainName, + validation: props.customEndpoint.hostedZone ? acm.CertificateValidation.fromDns(props.customEndpoint.hostedZone) : undefined, + }); + } + } + + // Create the domain + this.domain = new CfnDomain(this, 'Resource', { + domainName: this.physicalName, + engineVersion: props.version.version, + clusterConfig: { + dedicatedMasterEnabled, + dedicatedMasterCount: dedicatedMasterEnabled + ? dedicatedMasterCount + : undefined, + dedicatedMasterType: dedicatedMasterEnabled + ? dedicatedMasterType + : undefined, + instanceCount, + instanceType, + warmEnabled: warmEnabled + ? warmEnabled + : undefined, + warmCount: warmEnabled + ? warmCount + : undefined, + warmType: warmEnabled + ? warmType + : undefined, + zoneAwarenessEnabled, + zoneAwarenessConfig: zoneAwarenessEnabled + ? { availabilityZoneCount } + : undefined, + }, + ebsOptions: { + ebsEnabled, + volumeSize: ebsEnabled ? volumeSize : undefined, + volumeType: ebsEnabled ? volumeType : undefined, + iops: ebsEnabled ? props.ebs?.iops : undefined, + }, + encryptionAtRestOptions: { + enabled: encryptionAtRestEnabled, + kmsKeyId: encryptionAtRestEnabled + ? props.encryptionAtRest?.kmsKey?.keyId + : undefined, + }, + nodeToNodeEncryptionOptions: { enabled: nodeToNodeEncryptionEnabled }, + logPublishingOptions: logPublishing, + cognitoOptions: props.cognitoDashboardsAuth ? { + enabled: true, + identityPoolId: props.cognitoDashboardsAuth?.identityPoolId, + roleArn: props.cognitoDashboardsAuth?.role.roleArn, + userPoolId: props.cognitoDashboardsAuth?.userPoolId, + }: undefined, + vpcOptions: cfnVpcOptions, + snapshotOptions: props.automatedSnapshotStartHour + ? { automatedSnapshotStartHour: props.automatedSnapshotStartHour } + : undefined, + domainEndpointOptions: { + enforceHttps, + tlsSecurityPolicy: props.tlsSecurityPolicy ?? TLSSecurityPolicy.TLS_1_0, + ...props.customEndpoint && { + customEndpointEnabled: true, + customEndpoint: props.customEndpoint.domainName, + customEndpointCertificateArn: customEndpointCertificate!.certificateArn, + }, + }, + advancedSecurityOptions: advancedSecurityEnabled + ? { + enabled: true, + internalUserDatabaseEnabled, + masterUserOptions: { + masterUserArn: masterUserArn, + masterUserName: masterUserName, + masterUserPassword: this.masterUserPassword?.unsafeUnwrap(), // Safe usage + }, + } + : undefined, + advancedOptions: props.advancedOptions, + }); + this.domain.applyRemovalPolicy(props.removalPolicy); + + if (props.enableVersionUpgrade) { + this.domain.cfnOptions.updatePolicy = { + ...this.domain.cfnOptions.updatePolicy, + enableVersionUpgrade: props.enableVersionUpgrade, + }; + } + + if (logGroupResourcePolicy) { this.domain.node.addDependency(logGroupResourcePolicy); } + + if (props.domainName) { + if (!cdk.Token.isUnresolved(props.domainName)) { + // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/configuration-api.html#configuration-api-datatypes-domainname + if (!props.domainName.match(/^[a-z0-9\-]+$/)) { + throw new Error(`Invalid domainName '${props.domainName}'. Valid characters are a-z (lowercase only), 0-9, and – (hyphen).`); + } + if (props.domainName.length < 3 || props.domainName.length > 28) { + throw new Error(`Invalid domainName '${props.domainName}'. It must be between 3 and 28 characters`); + } + if (props.domainName[0] < 'a' || props.domainName[0] > 'z') { + throw new Error(`Invalid domainName '${props.domainName}'. It must start with a lowercase letter`); + } + } + this.node.addMetadata('aws:cdk:hasPhysicalName', props.domainName); + } + + this.domainName = this.getResourceNameAttribute(this.domain.ref); + + this.domainId = this.domain.getAtt('Id').toString(); + + this.domainEndpoint = this.domain.getAtt('DomainEndpoint').toString(); + + this.domainArn = this.getResourceArnAttribute(this.domain.attrArn, { + service: 'es', + resource: 'domain', + resourceName: this.physicalName, + }); + + if (props.customEndpoint?.hostedZone) { + new route53.CnameRecord(this, 'CnameRecord', { + recordName: props.customEndpoint.domainName, + zone: props.customEndpoint.hostedZone, + domainName: this.domainEndpoint, + }); + } + + this.encryptionAtRestOptions = props.encryptionAtRest; + if (props.accessPolicies) { + this.addAccessPolicies(...props.accessPolicies); + } + if (unsignedBasicAuthEnabled) { + this.addAccessPolicies(unsignedAccessPolicy); + } + } + + /** + * Manages network connections to the domain. This will throw an error in case the domain + * is not placed inside a VPC. + */ + public get connections(): ec2.Connections { + if (!this._connections) { + throw new Error("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); + } + return this._connections; + } + + + /** + * Add policy statements to the domain access policy + */ + public addAccessPolicies(...accessPolicyStatements: iam.PolicyStatement[]) { + if (accessPolicyStatements.length > 0) { + if (!this.accessPolicy) { + // Only create the custom resource after there are statements to set. + this.accessPolicy = new OpenSearchAccessPolicy(this, 'AccessPolicy', { + domainName: this.domainName, + domainArn: this.domainArn, + accessPolicies: accessPolicyStatements, + }); + + if (this.encryptionAtRestOptions?.kmsKey) { + // https://docs.aws.amazon.com/opensearch-service/latest/developerguide/encryption-at-rest.html + + // these permissions are documented as required during domain creation. + // while not strictly documented for updates as well, it stands to reason that an update + // operation might require these in case the cluster uses a kms key. + // empircal evidence shows this is indeed required: https://github.com/aws/aws-cdk/issues/11412 + this.accessPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: ['kms:List*', 'kms:Describe*', 'kms:CreateGrant'], + resources: [this.encryptionAtRestOptions.kmsKey.keyArn], + effect: iam.Effect.ALLOW, + })); + } + } else { + this.accessPolicy.addAccessPolicies(...accessPolicyStatements); + } + } + } +} + +/** + * Given an Amazon OpenSearch Service domain endpoint, returns a CloudFormation expression that + * extracts the domain name. + * + * Domain endpoints look like this: + * + * https://example-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com + * https://-..es.amazonaws.com + * + * ..which means that in order to extract the domain name from the endpoint, we can + * split the endpoint using "-" and select the component in index 0. + * + * @param domainEndpoint The Amazon OpenSearch Service domain endpoint + */ +function extractNameFromEndpoint(domainEndpoint: string) { + const { hostname } = new URL(domainEndpoint); + const domain = hostname.split('.')[0]; + const suffix = '-' + domain.split('-').slice(-1)[0]; + return domain.split(suffix)[0]; +} + +/** + * Converts an engine version into a into a decimal number with major and minor version i.e x.y. + * + * @param version The engine version object + */ +function parseVersion(version: EngineVersion): { versionNum: number, isElasticsearchVersion: boolean } { + const elasticsearchPrefix = 'Elasticsearch_'; + const openSearchPrefix = 'OpenSearch_'; + const isElasticsearchVersion = version.version.startsWith(elasticsearchPrefix); + const versionStr = isElasticsearchVersion + ? version.version.substring(elasticsearchPrefix.length) + : version.version.substring(openSearchPrefix.length); + const firstDot = versionStr.indexOf('.'); + + if (firstDot < 1) { + throw new Error(`Invalid engine version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); + } + + const secondDot = versionStr.indexOf('.', firstDot + 1); + + try { + if (secondDot == -1) { + return { versionNum: parseFloat(versionStr), isElasticsearchVersion }; + } else { + return { versionNum: parseFloat(versionStr.substring(0, secondDot)), isElasticsearchVersion }; + } + } catch { + throw new Error(`Invalid engine version: ${versionStr}. Version string needs to start with major and minor version (x.y).`); + } +} + +function selectSubnets(vpc: ec2.IVpc, vpcSubnets: ec2.SubnetSelection[]): ec2.ISubnet[] { + const selected = []; + for (const selection of vpcSubnets) { + selected.push(...vpc.selectSubnets(selection).subnets); + } + return selected; +} + +/** + * Check if any of the subnets are pending lookups. If so, the zone awareness check should be skipped, otherwise it will always throw an error + * + * @param vpc The vpc to which the subnets apply + * @param vpcSubnets The vpc subnets that should be checked + * @returns true if there are pending lookups for the subnets + */ +function zoneAwarenessCheckShouldBeSkipped(vpc: ec2.IVpc, vpcSubnets: ec2.SubnetSelection[]): boolean { + for (const selection of vpcSubnets) { + if (vpc.selectSubnets(selection).isPendingLookup) { + return true; + }; + } + return false; +} + +/** + * Initializes an instance type. + * + * @param defaultInstanceType Default instance type which is used if no instance type is provided + * @param instanceType Instance type + * @returns Instance type in lowercase (if provided) or default instance type + */ +function initializeInstanceType(defaultInstanceType: string, instanceType?: string): string { + if (instanceType) { + return cdk.Token.isUnresolved(instanceType) ? instanceType : instanceType.toLowerCase(); + } else { + return defaultInstanceType; + } +} diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/index.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/lib/index.ts rename to packages/aws-cdk-lib/aws-opensearchservice/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-opensearchservice/lib/log-group-resource-policy.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/log-group-resource-policy.ts new file mode 100644 index 0000000000000..5a9058076016d --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/log-group-resource-policy.ts @@ -0,0 +1,50 @@ +import * as iam from '../../aws-iam'; +import * as cr from '../../custom-resources'; +import { Construct } from 'constructs'; + +/** + * Construction properties for LogGroupResourcePolicy + */ +export interface LogGroupResourcePolicyProps { + /** + * The log group resource policy name + */ + readonly policyName: string; + /** + * The policy statements for the log group resource logs + */ + readonly policyStatements: [iam.PolicyStatement]; +} + +/** + * Creates LogGroup resource policies. + */ +export class LogGroupResourcePolicy extends cr.AwsCustomResource { + constructor(scope: Construct, id: string, props: LogGroupResourcePolicyProps) { + const policyDocument = new iam.PolicyDocument({ + statements: props.policyStatements, + }); + + super(scope, id, { + resourceType: 'Custom::CloudwatchLogResourcePolicy', + onUpdate: { + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: props.policyName, + policyDocument: JSON.stringify(policyDocument), + }, + physicalResourceId: cr.PhysicalResourceId.of(id), + }, + onDelete: { + service: 'CloudWatchLogs', + action: 'deleteResourcePolicy', + parameters: { + policyName: props.policyName, + }, + ignoreErrorCodesMatching: 'ResourceNotFoundException', + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ resources: ['*'] }), + }); + } +} diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/opensearch-access-policy.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/opensearch-access-policy.ts similarity index 93% rename from packages/@aws-cdk/aws-opensearchservice/lib/opensearch-access-policy.ts rename to packages/aws-cdk-lib/aws-opensearchservice/lib/opensearch-access-policy.ts index b9e9acc3a37c6..ae95e3cd32255 100644 --- a/packages/@aws-cdk/aws-opensearchservice/lib/opensearch-access-policy.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/opensearch-access-policy.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; -import * as cr from '@aws-cdk/custom-resources'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as cr from '../../custom-resources'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/perms.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/perms.ts similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/lib/perms.ts rename to packages/aws-cdk-lib/aws-opensearchservice/lib/perms.ts diff --git a/packages/@aws-cdk/aws-opensearchservice/lib/version.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/version.ts similarity index 100% rename from packages/@aws-cdk/aws-opensearchservice/lib/version.ts rename to packages/aws-cdk-lib/aws-opensearchservice/lib/version.ts diff --git a/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts new file mode 100644 index 0000000000000..2b72d56522352 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts @@ -0,0 +1,2024 @@ +/* eslint-disable jest/expect-expect */ +import { Match, Template } from '../../assertions'; +import * as acm from '../../aws-certificatemanager'; +import { Metric, Statistic } from '../../aws-cloudwatch'; +import { Vpc, EbsDeviceVolumeType, Port, SecurityGroup, SubnetType } from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as route53 from '../../aws-route53'; +import { App, Stack, Duration, SecretValue, CfnParameter, Token } from '../../core'; +import each from 'jest-each'; +import { Domain, EngineVersion } from '../lib'; + +let app: App; +let stack: Stack; + +beforeEach(() => { + app = new App(); + stack = new Stack(app, 'Stack', { + env: { account: '1234', region: 'testregion' }, + }); + + jest.resetAllMocks(); +}); + +const readActions = ['ESHttpGet', 'ESHttpHead']; +const writeActions = ['ESHttpDelete', 'ESHttpPost', 'ESHttpPut', 'ESHttpPatch']; +const readWriteActions = [ + ...readActions, + ...writeActions, +]; + +const testedOpenSearchVersions = [ + EngineVersion.OPENSEARCH_1_0, + EngineVersion.OPENSEARCH_1_1, + EngineVersion.OPENSEARCH_1_2, + EngineVersion.OPENSEARCH_1_3, + EngineVersion.OPENSEARCH_2_3, +]; + +each(testedOpenSearchVersions).test('connections throws if domain is not placed inside a vpc', (engineVersion) => { + + expect(() => { + new Domain(stack, 'Domain', { + version: engineVersion, + }).connections; + }).toThrowError("Connections are only available on VPC enabled domains. Use the 'vpc' property to place a domain inside a VPC"); +}); + +each(testedOpenSearchVersions).test('subnets and security groups can be provided when vpc is used', (engineVersion) => { + + const vpc = new Vpc(stack, 'Vpc'); + const securityGroup = new SecurityGroup(stack, 'CustomSecurityGroup', { + vpc, + }); + const domain = new Domain(stack, 'Domain', { + version: engineVersion, + vpc, + vpcSubnets: [{ subnets: [vpc.privateSubnets[0]] }], + securityGroups: [securityGroup], + }); + + expect(domain.connections.securityGroups[0].securityGroupId).toEqual(securityGroup.securityGroupId); + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + VPCOptions: { + SecurityGroupIds: [ + { + 'Fn::GetAtt': [ + 'CustomSecurityGroupE5E500E5', + 'GroupId', + ], + }, + ], + SubnetIds: [ + { + Ref: 'VpcPrivateSubnet1Subnet536B997A', + }, + ], + }, + }); + +}); + +each(testedOpenSearchVersions).test('default subnets and security group when vpc is used', (engineVersion) => { + + const vpc = new Vpc(stack, 'Vpc'); + const domain = new Domain(stack, 'Domain', { + version: engineVersion, + vpc, + }); + + expect(stack.resolve(domain.connections.securityGroups[0].securityGroupId)).toEqual({ 'Fn::GetAtt': ['DomainSecurityGroup48AA5FD6', 'GroupId'] }); + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + VPCOptions: { + SecurityGroupIds: [ + { + 'Fn::GetAtt': [ + 'DomainSecurityGroup48AA5FD6', + 'GroupId', + ], + }, + ], + SubnetIds: [ + { + Ref: 'VpcPrivateSubnet1Subnet536B997A', + }, + { + Ref: 'VpcPrivateSubnet2Subnet3788AAA1', + }, + { + Ref: 'VpcPrivateSubnet3SubnetF258B56E', + }, + ], + }, + }); + +}); + +each(testedOpenSearchVersions).test('connections has no default port if enforceHttps is false', (engineVersion) => { + + const vpc = new Vpc(stack, 'Vpc'); + const domain = new Domain(stack, 'Domain', { + version: engineVersion, + vpc, + enforceHttps: false, + }); + + expect(domain.connections.defaultPort).toBeUndefined(); + +}); + +each(testedOpenSearchVersions).test('connections has default port 443 if enforceHttps is true', (engineVersion) => { + + const vpc = new Vpc(stack, 'Vpc'); + const domain = new Domain(stack, 'Domain', { + version: engineVersion, + vpc, + enforceHttps: true, + }); + + expect(domain.connections.defaultPort).toEqual(Port.tcp(443)); + +}); + +each(testedOpenSearchVersions).test('default removalpolicy is retain', (engineVersion) => { + new Domain(stack, 'Domain', { + version: engineVersion, + }); + + Template.fromStack(stack).hasResource('AWS::OpenSearchService::Domain', { + DeletionPolicy: 'Retain', + }); +}); + +each([testedOpenSearchVersions]).test('grants kms permissions if needed', (engineVersion) => { + + const key = new kms.Key(stack, 'Key'); + + new Domain(stack, 'Domain', { + version: engineVersion, + encryptionAtRest: { + kmsKey: key, + }, + // so that the access policy custom resource will be used. + useUnsignedBasicAuth: true, + }); + + const expectedPolicy = { + Statement: [ + { + Action: [ + 'kms:List*', + 'kms:Describe*', + 'kms:CreateGrant', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + }, + ], + Version: '2012-10-17', + }; + + const resources = Template.fromStack(stack).toJSON().Resources; + expect(resources.AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E.Properties.PolicyDocument).toStrictEqual(expectedPolicy); + +}); + +each([ + [EngineVersion.OPENSEARCH_1_0, 'OpenSearch_1.0'], + [EngineVersion.OPENSEARCH_1_1, 'OpenSearch_1.1'], + [EngineVersion.OPENSEARCH_1_2, 'OpenSearch_1.2'], + [EngineVersion.OPENSEARCH_1_3, 'OpenSearch_1.3'], + [EngineVersion.OPENSEARCH_2_3, 'OpenSearch_2.3'], +]).test('minimal example renders correctly', (engineVersion, expectedCfVersion) => { + new Domain(stack, 'Domain', { version: engineVersion }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + EBSOptions: { + EBSEnabled: true, + VolumeSize: 10, + VolumeType: 'gp2', + }, + ClusterConfig: { + DedicatedMasterEnabled: false, + InstanceCount: 1, + InstanceType: 'r5.large.search', + ZoneAwarenessEnabled: false, + }, + EngineVersion: expectedCfVersion, + EncryptionAtRestOptions: { + Enabled: false, + }, + LogPublishingOptions: { + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + NodeToNodeEncryptionOptions: { + Enabled: false, + }, + }); +}); + +each([testedOpenSearchVersions]).test('can enable version upgrade update policy', (engineVersion) => { + new Domain(stack, 'Domain', { + version: engineVersion, + enableVersionUpgrade: true, + }); + + Template.fromStack(stack).hasResource('AWS::OpenSearchService::Domain', { + UpdatePolicy: { + EnableVersionUpgrade: true, + }, + }); +}); + +each([testedOpenSearchVersions]).test('can set a self-referencing custom policy', (engineVersion) => { + const domain = new Domain(stack, 'Domain', { + version: engineVersion, + }); + + domain.addAccessPolicies( + new iam.PolicyStatement({ + actions: ['es:ESHttpPost', 'es:ESHttpPut'], + effect: iam.Effect.ALLOW, + principals: [new iam.AccountPrincipal('5678')], + resources: [domain.domainArn, `${domain.domainArn}/*`], + }), + ); + + const expectedPolicy = { + 'Fn::Join': [ + '', + [ + '{"action":"updateDomainConfig","service":"OpenSearch","parameters":{"DomainName":"', + { + Ref: 'Domain66AC69E0', + }, + '","AccessPolicies":"{\\"Statement\\":[{\\"Action\\":[\\"es:ESHttpPost\\",\\"es:ESHttpPut\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"AWS\\":\\"arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::5678:root\\"},\\"Resource\\":[\\"', + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'Arn', + ], + }, + '\\",\\"', + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'Arn', + ], + }, + '/*\\"]}],\\"Version\\":\\"2012-10-17\\"}"},"outputPaths":["DomainConfig.AccessPolicies"],"physicalResourceId":{"id":"', + { + Ref: 'Domain66AC69E0', + }, + 'AccessPolicy"}}', + ], + ], + }; + Template.fromStack(stack).hasResourceProperties('Custom::OpenSearchAccessPolicy', { + ServiceToken: { + 'Fn::GetAtt': [ + 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', + 'Arn', + ], + }, + Create: expectedPolicy, + Update: expectedPolicy, + }); +}); + +each([testedOpenSearchVersions]).describe('UltraWarm instances', (engineVersion) => { + + test('can enable UltraWarm instances', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + capacity: { + masterNodes: 2, + warmNodes: 2, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + ClusterConfig: { + DedicatedMasterEnabled: true, + WarmEnabled: true, + WarmCount: 2, + WarmType: 'ultrawarm1.medium.search', + }, + }); + }); + + test('can enable UltraWarm instances with specific instance type', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + capacity: { + masterNodes: 2, + warmNodes: 2, + warmInstanceType: 'ultrawarm1.large.search', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + ClusterConfig: { + DedicatedMasterEnabled: true, + WarmEnabled: true, + WarmCount: 2, + WarmType: 'ultrawarm1.large.search', + }, + }); + }); + +}); + +each([testedOpenSearchVersions]).test('can use tokens in capacity configuration', (engineVersion) => { + new Domain(stack, 'Domain', { + version: engineVersion, + capacity: { + dataNodeInstanceType: Token.asString({ Ref: 'dataNodeInstanceType' }), + dataNodes: Token.asNumber({ Ref: 'dataNodes' }), + masterNodeInstanceType: Token.asString({ Ref: 'masterNodeInstanceType' }), + masterNodes: Token.asNumber({ Ref: 'masterNodes' }), + warmInstanceType: Token.asString({ Ref: 'warmInstanceType' }), + warmNodes: Token.asNumber({ Ref: 'warmNodes' }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + ClusterConfig: { + InstanceCount: { + Ref: 'dataNodes', + }, + InstanceType: { + Ref: 'dataNodeInstanceType', + }, + DedicatedMasterEnabled: true, + DedicatedMasterCount: { + Ref: 'masterNodes', + }, + DedicatedMasterType: { + Ref: 'masterNodeInstanceType', + }, + WarmEnabled: true, + WarmCount: { + Ref: 'warmNodes', + }, + WarmType: { + Ref: 'warmInstanceType', + }, + }, + }); +}); + +each([testedOpenSearchVersions]).describe('log groups', (engineVersion) => { + + test('slowSearchLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + slowSearchLogEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainSlowSearchLogs5B35A97A', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('slowIndexLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + slowIndexLogEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainSlowIndexLogsFE2F1061', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('appLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + appLogEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainAppLogs21698C1B', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('auditLogEnabled should create a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + auditLogEnabled: true, + }, + fineGrainedAccessControl: { + masterUserName: 'username', + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + AUDIT_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'DomainAuditLogs608E0FA6', + 'Arn', + ], + }, + Enabled: true, + }, + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('two domains with logging enabled can be created in same stack', () => { + new Domain(stack, 'Domain1', { + version: engineVersion, + logging: { + appLogEnabled: true, + slowSearchLogEnabled: true, + slowIndexLogEnabled: true, + }, + }); + new Domain(stack, 'Domain2', { + version: engineVersion, + logging: { + appLogEnabled: true, + slowSearchLogEnabled: true, + slowIndexLogEnabled: true, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain1AppLogs6E8D1D67', + 'Arn', + ], + }, + Enabled: true, + }, + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain1SlowSearchLogs8F3B0506', + 'Arn', + ], + }, + Enabled: true, + }, + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain1SlowIndexLogs9354D098', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain2AppLogs810876E2', + 'Arn', + ], + }, + Enabled: true, + }, + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain2SlowSearchLogs0C75F64B', + 'Arn', + ], + }, + Enabled: true, + }, + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'Domain2SlowIndexLogs0CB900D0', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + }, + }); + }); + + test('log group policy is uniquely named for each domain', () => { + new Domain(stack, 'Domain1', { + version: engineVersion, + logging: { + appLogEnabled: true, + }, + }); + new Domain(stack, 'Domain2', { + version: engineVersion, + logging: { + appLogEnabled: true, + }, + }); + + // Domain1 + Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { + Create: { + 'Fn::Join': [ + '', + [ + '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', + { + 'Fn::GetAtt': [ + 'Domain1AppLogs6E8D1D67', + 'Arn', + ], + }, + '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc836fd92f07ec41eb70c2f6f08dc4b43cfb7c25391"}}', + ], + ], + }, + }); + // Domain2 + Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { + Create: { + 'Fn::Join': [ + '', + [ + '{"service":"CloudWatchLogs","action":"putResourcePolicy","parameters":{"policyName":"ESLogPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2","policyDocument":"{\\"Statement\\":[{\\"Action\\":[\\"logs:PutLogEvents\\",\\"logs:CreateLogStream\\"],\\"Effect\\":\\"Allow\\",\\"Principal\\":{\\"Service\\":\\"es.amazonaws.com\\"},\\"Resource\\":\\"', + { + 'Fn::GetAtt': [ + 'Domain2AppLogs810876E2', + 'Arn', + ], + }, + '\\"}],\\"Version\\":\\"2012-10-17\\"}"},"physicalResourceId":{"id":"ESLogGroupPolicyc8f05f015be3baf6ec1ee06cd1ee5cc8706ebbe5b2"}}', + ], + ], + }, + }); + }); + + test('enabling audit logs throws without fine grained access control enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + auditLogEnabled: true, + }, + })).toThrow(/Fine-grained access control is required when audit logs publishing is enabled\./); + }); + + test('slowSearchLogGroup should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + slowSearchLogEnabled: true, + slowSearchLogGroup: new logs.LogGroup(stack, 'SlowSearchLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + SEARCH_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'SlowSearchLogsE00DC2E7', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('slowIndexLogEnabled should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + slowIndexLogEnabled: true, + slowIndexLogGroup: new logs.LogGroup(stack, 'SlowIndexLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + INDEX_SLOW_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'SlowIndexLogsAD49DED0', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('appLogGroup should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + logging: { + appLogEnabled: true, + appLogGroup: new logs.LogGroup(stack, 'AppLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + ES_APPLICATION_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'AppLogsC5DF83A6', + 'Arn', + ], + }, + Enabled: true, + }, + AUDIT_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + + test('auditLOgGroup should use a custom log group', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserName: 'username', + }, + nodeToNodeEncryption: true, + encryptionAtRest: { + enabled: true, + }, + enforceHttps: true, + logging: { + auditLogEnabled: true, + auditLogGroup: new logs.LogGroup(stack, 'AuditLogs', { + retention: logs.RetentionDays.THREE_MONTHS, + }), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + LogPublishingOptions: { + AUDIT_LOGS: { + CloudWatchLogsLogGroupArn: { + 'Fn::GetAtt': [ + 'AuditLogsB945E340', + 'Arn', + ], + }, + Enabled: true, + }, + ES_APPLICATION_LOGS: Match.absent(), + SEARCH_SLOW_LOGS: Match.absent(), + INDEX_SLOW_LOGS: Match.absent(), + }, + }); + }); + +}); + +each(testedOpenSearchVersions).describe('grants', (engineVersion) => { + + test('"grantRead" allows read actions associated with this domain resource', () => { + testGrant(readActions, (p, d) => d.grantRead(p), engineVersion); + }); + + test('"grantWrite" allows write actions associated with this domain resource', () => { + testGrant(writeActions, (p, d) => d.grantWrite(p), engineVersion); + }); + + test('"grantReadWrite" allows read and write actions associated with this domain resource', () => { + testGrant(readWriteActions, (p, d) => d.grantReadWrite(p), engineVersion); + }); + + test('"grantIndexRead" allows read actions associated with an index in this domain resource', () => { + testGrant( + readActions, + (p, d) => d.grantIndexRead('my-index', p), + engineVersion, + false, + ['/my-index', '/my-index/*'], + ); + }); + + test('"grantIndexWrite" allows write actions associated with an index in this domain resource', () => { + testGrant( + writeActions, + (p, d) => d.grantIndexWrite('my-index', p), + engineVersion, + false, + ['/my-index', '/my-index/*'], + ); + }); + + test('"grantIndexReadWrite" allows read and write actions associated with an index in this domain resource', () => { + testGrant( + readWriteActions, + (p, d) => d.grantIndexReadWrite('my-index', p), + engineVersion, + false, + ['/my-index', '/my-index/*'], + ); + }); + + test('"grantPathRead" allows read actions associated with a given path in this domain resource', () => { + testGrant( + readActions, + (p, d) => d.grantPathRead('my-index/my-path', p), + engineVersion, + false, + ['/my-index/my-path'], + ); + }); + + test('"grantPathWrite" allows write actions associated with a given path in this domain resource', () => { + testGrant( + writeActions, + (p, d) => d.grantPathWrite('my-index/my-path', p), + engineVersion, + false, + ['/my-index/my-path'], + ); + }); + + test('"grantPathReadWrite" allows read and write actions associated with a given path in this domain resource', () => { + testGrant( + readWriteActions, + (p, d) => d.grantPathReadWrite('my-index/my-path', p), + engineVersion, + false, + ['/my-index/my-path'], + ); + }); + + test('"grant" for an imported domain', () => { + const domainEndpoint = 'https://test-domain-2w2x2u3tifly-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com'; + const domain = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); + const user = new iam.User(stack, 'user'); + + domain.grantReadWrite(user); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 'es:ESHttpGet', + 'es:ESHttpHead', + 'es:ESHttpDelete', + 'es:ESHttpPost', + 'es:ESHttpPut', + 'es:ESHttpPatch', + ], + Effect: 'Allow', + Resource: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':es:testregion:1234:domain/test-domain-2w2x2u3tifly', + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':es:testregion:1234:domain/test-domain-2w2x2u3tifly/*', + ], + ], + }, + ], + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'userDefaultPolicy083DF682', + Users: [ + { + Ref: 'user2C2B57AE', + }, + ], + }); + }); + +}); + +each(testedOpenSearchVersions).describe('metrics', (engineVersion) => { + + test('metricClusterStatusRed', () => { + testMetric( + (domain) => domain.metricClusterStatusRed(), + 'ClusterStatus.red', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricClusterStatusYellow', () => { + testMetric( + (domain) => domain.metricClusterStatusYellow(), + 'ClusterStatus.yellow', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricFreeStorageSpace', () => { + testMetric( + (domain) => domain.metricFreeStorageSpace(), + 'FreeStorageSpace', + engineVersion, + Statistic.MINIMUM, + ); + }); + + test('metricClusterIndexWriteBlocked', () => { + testMetric( + (domain) => domain.metricClusterIndexWritesBlocked(), + 'ClusterIndexWritesBlocked', + engineVersion, + Statistic.MAXIMUM, + Duration.minutes(1), + ); + }); + + test('metricNodes', () => { + testMetric( + (domain) => domain.metricNodes(), + 'Nodes', + engineVersion, + Statistic.MINIMUM, + Duration.hours(1), + ); + }); + + test('metricAutomatedSnapshotFailure', () => { + testMetric( + (domain) => domain.metricAutomatedSnapshotFailure(), + 'AutomatedSnapshotFailure', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricCPUUtilization', () => { + testMetric( + (domain) => domain.metricCPUUtilization(), + 'CPUUtilization', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricJVMMemoryPressure', () => { + testMetric( + (domain) => domain.metricJVMMemoryPressure(), + 'JVMMemoryPressure', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricMasterCPUUtilization', () => { + testMetric( + (domain) => domain.metricMasterCPUUtilization(), + 'MasterCPUUtilization', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricMasterJVMMemoryPressure', () => { + testMetric( + (domain) => domain.metricMasterJVMMemoryPressure(), + 'MasterJVMMemoryPressure', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricKMSKeyError', () => { + testMetric( + (domain) => domain.metricKMSKeyError(), + 'KMSKeyError', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricKMSKeyInaccessible', () => { + testMetric( + (domain) => domain.metricKMSKeyInaccessible(), + 'KMSKeyInaccessible', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricSearchableDocuments', () => { + testMetric( + (domain) => domain.metricSearchableDocuments(), + 'SearchableDocuments', + engineVersion, + Statistic.MAXIMUM, + ); + }); + + test('metricSearchLatency', () => { + testMetric( + (domain) => domain.metricSearchLatency(), + 'SearchLatency', + engineVersion, + 'p99', + ); + }); + + test('metricIndexingLatency', () => { + testMetric( + (domain) => domain.metricIndexingLatency(), + 'IndexingLatency', + engineVersion, + 'p99', + ); + }); + +}); + +describe('import', () => { + + test('static fromDomainEndpoint(endpoint) allows importing an external/existing domain', () => { + const domainName = 'test-domain-2w2x2u3tifly'; + const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; + const domainEndpoint = `https://${domainEndpointWithoutHttps}`; + const imported = Domain.fromDomainEndpoint(stack, 'Domain', domainEndpoint); + + expect(imported.domainName).toEqual(domainName); + expect(imported.domainArn).toMatch(RegExp(`es:testregion:1234:domain/${domainName}$`)); + expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); + + Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 0); + }); + + test('static fromDomainAttributes(attributes) allows importing an external/existing domain', () => { + const domainName = 'test-domain-2w2x2u3tifly'; + const domainArn = `arn:aws:es:testregion:1234:domain/${domainName}`; + const domainEndpointWithoutHttps = `${domainName}-jcjotrt6f7otem4sqcwbch3c4u.testregion.es.amazonaws.com`; + const domainEndpoint = `https://${domainEndpointWithoutHttps}`; + const imported = Domain.fromDomainAttributes(stack, 'Domain', { + domainArn, + domainEndpoint, + }); + + expect(imported.domainName).toEqual(domainName); + expect(imported.domainArn).toEqual(domainArn); + expect(imported.domainEndpoint).toEqual(domainEndpointWithoutHttps); + + Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 0); + }); + + test('static fromDomainAttributes(attributes) allows importing with token arn and endpoint', () => { + const domainArn = new CfnParameter(stack, 'domainArn', { type: 'String' }).valueAsString; + const domainEndpoint = new CfnParameter(stack, 'domainEndpoint', { type: 'String' }).valueAsString; + const imported = Domain.fromDomainAttributes(stack, 'Domain', { + domainArn, + domainEndpoint, + }); + const expectedDomainName = { + 'Fn::Select': [ + 1, + { + 'Fn::Split': [ + '/', + { + 'Fn::Select': [ + 5, + { + 'Fn::Split': [ + ':', + { + Ref: 'domainArn', + }, + ], + }, + ], + }, + ], + }, + ], + }; + + expect(stack.resolve(imported.domainName)).toEqual(expectedDomainName); + expect(imported.domainArn).toEqual(domainArn); + expect(imported.domainEndpoint).toEqual(domainEndpoint); + + Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 0); + }); +}); + +each(testedOpenSearchVersions).describe('advanced security options', (engineVersion) => { + const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; + const masterUserName = 'JohnDoe'; + const password = 'password'; + const masterUserPassword = SecretValue.unsafePlainText(password); + + test('enable fine-grained access control with a master user ARN', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: false, + MasterUserOptions: { + MasterUserARN: masterUserArn, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + test('enable fine-grained access control with a master user name and password', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserName, + masterUserPassword, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: masterUserName, + MasterUserPassword: password, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + test('enable fine-grained access control with a master user name and dynamically generated password', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserName, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: masterUserName, + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DomainMasterUserBFAFA7D9', + }, + ':SecretString:password::}}', + ], + ], + }, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: { + GenerateStringKey: 'password', + }, + }); + }); + + test('enabling fine-grained access control throws with Elasticsearch version < 6.7', () => { + expect(() => new Domain(stack, 'Domain', { + version: EngineVersion.ELASTICSEARCH_6_5, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + })).toThrow(/Fine-grained access control requires Elasticsearch version 6\.7 or later or OpenSearch version 1\.0 or later/); + }); + + test('enabling fine-grained access control throws without node-to-node encryption enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: false, + enforceHttps: true, + })).toThrow(/Node-to-node encryption is required when fine-grained access control is enabled/); + }); + + test('enabling fine-grained access control throws without encryption-at-rest enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: false, + }, + nodeToNodeEncryption: true, + enforceHttps: true, + })).toThrow(/Encryption-at-rest is required when fine-grained access control is enabled/); + }); + + test('enabling fine-grained access control throws without enforceHttps enabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserArn, + }, + encryptionAtRest: { + enabled: true, + }, + nodeToNodeEncryption: true, + enforceHttps: false, + })).toThrow(/Enforce HTTPS is required when fine-grained access control is enabled/); + }); +}); + +each(testedOpenSearchVersions).describe('custom endpoints', (engineVersion) => { + const customDomainName = 'search.example.com'; + + test('custom domain without hosted zone and default cert', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + nodeToNodeEncryption: true, + enforceHttps: true, + customEndpoint: { + domainName: customDomainName, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + DomainEndpointOptions: { + EnforceHTTPS: true, + CustomEndpointEnabled: true, + CustomEndpoint: customDomainName, + CustomEndpointCertificateArn: { + Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: customDomainName, + ValidationMethod: 'EMAIL', + }); + }); + + test('custom domain with hosted zone and default cert', () => { + const zone = new route53.HostedZone(stack, 'DummyZone', { zoneName: 'example.com' }); + new Domain(stack, 'Domain', { + version: engineVersion, + nodeToNodeEncryption: true, + enforceHttps: true, + customEndpoint: { + domainName: customDomainName, + hostedZone: zone, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + DomainEndpointOptions: { + EnforceHTTPS: true, + CustomEndpointEnabled: true, + CustomEndpoint: customDomainName, + CustomEndpointCertificateArn: { + Ref: 'DomainCustomEndpointCertificateD080A69E', // Auto-generated certificate + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: customDomainName, + DomainValidationOptions: [ + { + DomainName: customDomainName, + HostedZoneId: { + Ref: 'DummyZone03E0FE81', + }, + }, + ], + ValidationMethod: 'DNS', + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Name: 'search.example.com.', + Type: 'CNAME', + HostedZoneId: { + Ref: 'DummyZone03E0FE81', + }, + ResourceRecords: [ + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'DomainEndpoint', + ], + }, + ], + }); + }); + + test('custom domain with hosted zone and given cert', () => { + const zone = new route53.HostedZone(stack, 'DummyZone', { + zoneName: 'example.com', + }); + const certificate = new acm.Certificate(stack, 'DummyCert', { + domainName: customDomainName, + }); + + new Domain(stack, 'Domain', { + version: engineVersion, + nodeToNodeEncryption: true, + enforceHttps: true, + customEndpoint: { + domainName: customDomainName, + hostedZone: zone, + certificate, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + DomainEndpointOptions: { + EnforceHTTPS: true, + CustomEndpointEnabled: true, + CustomEndpoint: customDomainName, + CustomEndpointCertificateArn: { + Ref: 'DummyCertFA37670B', + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Name: 'search.example.com.', + Type: 'CNAME', + HostedZoneId: { + Ref: 'DummyZone03E0FE81', + }, + ResourceRecords: [ + { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'DomainEndpoint', + ], + }, + ], + }); + }); + +}); + +each(testedOpenSearchVersions).describe('custom error responses', (engineVersion) => { + + test('error when availabilityZoneCount does not match vpcOptions.subnets length', () => { + const vpc = new Vpc(stack, 'Vpc', { + maxAzs: 1, + }); + + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + zoneAwareness: { + enabled: true, + availabilityZoneCount: 2, + }, + vpc, + })).toThrow(/you need to provide a subnet for each AZ you are using/); + }); + + test('Imported VPC with subnets that are still pending lookup won\'t throw Az count mismatch', () => { + const vpc = Vpc.fromLookup(stack, 'ExampleVpc', { + vpcId: 'vpc-123', + }); + let subnets = vpc.selectSubnets({ + subnetType: SubnetType.PRIVATE_WITH_EGRESS, + }); + + new Domain(stack, 'Domain1', { + version: engineVersion, + vpc, + vpcSubnets: [subnets], + zoneAwareness: { + enabled: true, + availabilityZoneCount: 3, + }, + }); + + Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 1); + }); + + test('error when master, data or Ultra Warm instance types do not end with .search', () => { + const error = /instance types must end with ".search"/; + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 'c5.large', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: engineVersion, + capacity: { + dataNodeInstanceType: 'c5.2xlarge', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain3', { + version: engineVersion, + capacity: { + warmInstanceType: 'ultrawarm1.medium', + }, + })).toThrow(error); + }); + + test('error when Ultra Warm instance types do not start with ultrawarm', () => { + const error = /UltraWarm node instance type must start with "ultrawarm"./; + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + warmInstanceType: 't3.small.search', + }, + })).toThrow(error); + }); + + test('error when Elasticsearch version is unsupported/unknown', () => { + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.elasticsearch('5.4'), + })).toThrow('Unknown Elasticsearch version: 5.4'); + }); + + test('error when invalid domain name is given', () => { + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.OPENSEARCH_1_0, + domainName: 'InvalidName', + })).toThrow(/Valid characters are a-z/); + expect(() => new Domain(stack, 'Domain2', { + version: EngineVersion.OPENSEARCH_1_0, + domainName: 'a'.repeat(29), + })).toThrow(/It must be between 3 and 28 characters/); + expect(() => new Domain(stack, 'Domain3', { + version: EngineVersion.OPENSEARCH_1_0, + domainName: '123domain', + })).toThrow(/It must start with a lowercase letter/); + }); + + test('error when error log publishing is enabled for Elasticsearch version < 5.1', () => { + const error = /Error logs publishing requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/; + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.ELASTICSEARCH_2_3, + logging: { + appLogEnabled: true, + }, + })).toThrow(error); + }); + + test('error when encryption at rest is enabled for Elasticsearch version < 5.1', () => { + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.ELASTICSEARCH_2_3, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(/Encryption of data at rest requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/); + }); + + test('error when cognito for OpenSearch Dashboards is enabled for elasticsearch version < 5.1', () => { + const user = new iam.User(stack, 'user'); + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.ELASTICSEARCH_2_3, + cognitoDashboardsAuth: { + identityPoolId: 'test-identity-pool-id', + role: new iam.Role(stack, 'Role', { assumedBy: user }), + userPoolId: 'test-user-pool-id', + }, + })).toThrow(/Cognito authentication for OpenSearch Dashboards requires Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/); + }); + + test('error when C5, I3, M5, or R5 instance types are specified for Elasticsearch version < 5.1', () => { + const error = /C5, I3, M5, and R5 instance types require Elasticsearch version 5.1 or later or OpenSearch version 1.0 or later/; + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.ELASTICSEARCH_2_3, + capacity: { + masterNodeInstanceType: 'c5.medium.search', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: EngineVersion.ELASTICSEARCH_1_5, + capacity: { + dataNodeInstanceType: 'i3.2xlarge.search', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain3', { + version: EngineVersion.ELASTICSEARCH_1_5, + capacity: { + dataNodeInstanceType: 'm5.2xlarge.search', + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain4', { + version: EngineVersion.ELASTICSEARCH_1_5, + capacity: { + masterNodeInstanceType: 'r5.2xlarge.search', + }, + })).toThrow(error); + }); + + test('error when node to node encryption is enabled for Elasticsearch version < 6.0', () => { + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.ELASTICSEARCH_5_6, + nodeToNodeEncryption: true, + })).toThrow(/Node-to-node encryption requires Elasticsearch version 6.0 or later or OpenSearch version 1.0 or later/); + }); + + test('error when i3 or r6g instance types are specified with EBS enabled', () => { + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + dataNodeInstanceType: 'i3.2xlarge.search', + }, + ebs: { + volumeSize: 100, + volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); + expect(() => new Domain(stack, 'Domain2', { + version: engineVersion, + capacity: { + dataNodeInstanceType: 'r6gd.large.search', + }, + ebs: { + volumeSize: 100, + volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD, + }, + })).toThrow(/I3 and R6GD instance types do not support EBS storage volumes/); + }); + + test('error when m3, r3, or t2 instance types are specified with encryption at rest enabled', () => { + const error = /M3, R3, and T2 instance types do not support encryption of data at rest/; + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 'm3.2xlarge.search', + }, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: engineVersion, + capacity: { + dataNodeInstanceType: 'r3.2xlarge.search', + }, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain3', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 't2.2xlarge.search', + }, + encryptionAtRest: { + enabled: true, + }, + })).toThrow(error); + }); + + test('error when t2.micro is specified with Elasticsearch version > 2.3', () => { + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 't2.micro.search', + }, + })).toThrow(/t2.micro.search instance type supports only Elasticsearch versions 1.5 and 2.3/); + }); + + test('error when any instance type other than R3, I3 and R6GD are specified without EBS enabled', () => { + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + ebs: { + enabled: false, + }, + capacity: { + masterNodeInstanceType: 'm5.large.search', + }, + })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); + expect(() => new Domain(stack, 'Domain2', { + version: engineVersion, + ebs: { + enabled: false, + }, + capacity: { + dataNodeInstanceType: 'm5.large.search', + }, + })).toThrow(/EBS volumes are required when using instance types other than r3, i3 or r6gd/); + }); + + test('can use compatible master instance types that does not have local storage when data node type is i3 or r6gd', () => { + new Domain(stack, 'Domain1', { + version: engineVersion, + ebs: { + enabled: false, + }, + capacity: { + masterNodeInstanceType: 'c5.2xlarge.search', + dataNodeInstanceType: 'i3.2xlarge.search', + }, + }); + new Domain(stack, 'Domain2', { + version: engineVersion, + ebs: { + enabled: false, + }, + capacity: { + masterNodes: 3, + masterNodeInstanceType: 'c6g.large.search', + dataNodeInstanceType: 'r6gd.large.search', + }, + }); + // both configurations pass synth-time validation + Template.fromStack(stack).resourceCountIs('AWS::OpenSearchService::Domain', 2); + }); + + test('error when availabilityZoneCount is not 2 or 3', () => { + const vpc = new Vpc(stack, 'Vpc'); + + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + vpc, + zoneAwareness: { + availabilityZoneCount: 4, + }, + })).toThrow(/Invalid zone awareness configuration; availabilityZoneCount must be 2 or 3/); + }); + + test('error when UltraWarm instance is used with Elasticsearch version < 6.8', () => { + expect(() => new Domain(stack, 'Domain1', { + version: EngineVersion.ELASTICSEARCH_6_7, + capacity: { + masterNodes: 1, + warmNodes: 1, + }, + })).toThrow(/UltraWarm requires Elasticsearch version 6\.8 or later or OpenSearch version 1.0 or later/); + }); + + test('error when t2 or t3 instance types are specified with UltramWarm enabled', () => { + const error = /T2 and T3 instance types do not support UltraWarm storage/; + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 't2.2xlarge.search', + warmNodes: 1, + }, + })).toThrow(error); + expect(() => new Domain(stack, 'Domain2', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 't3.2xlarge.search', + warmNodes: 1, + }, + })).toThrow(error); + }); + + test('error when UltraWarm instance is used and no dedicated master instance specified', () => { + expect(() => new Domain(stack, 'Domain1', { + version: engineVersion, + capacity: { + warmNodes: 1, + masterNodes: 0, + }, + })).toThrow(/Dedicated master node is required when UltraWarm storage is enabled/); + }); + +}); + +test('can specify future version', () => { + new Domain(stack, 'Domain', { version: EngineVersion.elasticsearch('8.2') }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + EngineVersion: 'Elasticsearch_8.2', + }); +}); + +each(testedOpenSearchVersions).describe('unsigned basic auth', (engineVersion) => { + test('can create a domain with unsigned basic auth', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + useUnsignedBasicAuth: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: 'admin', + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + test('does not overwrite master user ARN configuration', () => { + const masterUserArn = 'arn:aws:iam::123456789012:user/JohnDoe'; + + new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserArn, + }, + useUnsignedBasicAuth: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: false, + MasterUserOptions: { + MasterUserARN: masterUserArn, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + test('does not overwrite master user name and password', () => { + const masterUserName = 'JohnDoe'; + const password = 'password'; + const masterUserPassword = SecretValue.unsafePlainText(password); + + new Domain(stack, 'Domain', { + version: engineVersion, + fineGrainedAccessControl: { + masterUserName, + masterUserPassword, + }, + useUnsignedBasicAuth: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedSecurityOptions: { + Enabled: true, + InternalUserDatabaseEnabled: true, + MasterUserOptions: { + MasterUserName: masterUserName, + MasterUserPassword: password, + }, + }, + EncryptionAtRestOptions: { + Enabled: true, + }, + NodeToNodeEncryptionOptions: { + Enabled: true, + }, + DomainEndpointOptions: { + EnforceHTTPS: true, + }, + }); + }); + + test('fails to create a domain with unsigned basic auth when enforce HTTPS is disabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + useUnsignedBasicAuth: true, + enforceHttps: false, + })).toThrow(/You cannot disable HTTPS and use unsigned basic auth/); + }); + + test('fails to create a domain with unsigned basic auth when node to node encryption is disabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + useUnsignedBasicAuth: true, + nodeToNodeEncryption: false, + })).toThrow(/You cannot disable node to node encryption and use unsigned basic auth/); + }); + + test('fails to create a domain with unsigned basic auth when encryption at rest is disabled', () => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + useUnsignedBasicAuth: true, + encryptionAtRest: { enabled: false }, + })).toThrow(/You cannot disable encryption at rest and use unsigned basic auth/); + }); + + test('using unsigned basic auth throws with Elasticsearch < 6.7', () => { + expect(() => new Domain(stack, 'Domain', { + version: EngineVersion.ELASTICSEARCH_6_5, + useUnsignedBasicAuth: true, + })).toThrow(/Using unsigned basic auth requires Elasticsearch version 6\.7 or later or OpenSearch version 1.0 or later/); + }); +}); + +each(testedOpenSearchVersions).describe('advanced options', (engineVersion) => { + test('use advanced options', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + advancedOptions: { + 'rest.action.multi.allow_explicit_index': 'true', + 'indices.fielddata.cache.size': '50', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedOptions: { + 'rest.action.multi.allow_explicit_index': 'true', + 'indices.fielddata.cache.size': '50', + }, + }); + }); + + test('advanced options absent by default', () => { + new Domain(stack, 'Domain', { + version: engineVersion, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + AdvancedOptions: Match.absent(), + }); + }); +}); + +each(testedOpenSearchVersions).describe('cognito dashboards auth', (engineVersion) => { + test('cognito dashboards auth is not configured by default', () => { + new Domain(stack, 'Domain', { version: engineVersion }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + CognitoOptions: Match.absent(), + }); + }); + + test('cognito dashboards auth can be configured', () => { + const identityPoolId = 'test-identity-pool-id'; + const userPoolId = 'test-user-pool-id'; + const user = new iam.User(stack, 'testuser'); + const role = new iam.Role(stack, 'testrole', { assumedBy: user }); + + new Domain(stack, 'Domain', { + version: engineVersion, + cognitoDashboardsAuth: { + role, + identityPoolId, + userPoolId, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + CognitoOptions: { + Enabled: true, + IdentityPoolId: identityPoolId, + RoleArn: { + 'Fn::GetAtt': [ + 'testroleFAA56B58', + 'Arn', + ], + }, + UserPoolId: userPoolId, + }, + }); + }); +}); + +function testGrant( + expectedActions: string[], + invocation: (user: iam.IPrincipal, domain: Domain) => void, + engineVersion: EngineVersion, + appliesToDomainRoot: Boolean = true, + paths: string[] = ['/*'], +) { + const domain = new Domain(stack, 'Domain', { version: engineVersion }); + const user = new iam.User(stack, 'user'); + + invocation(user, domain); + + const action = expectedActions.length > 1 ? expectedActions.map(a => `es:${a}`) : `es:${expectedActions[0]}`; + const domainArn = { + 'Fn::GetAtt': [ + 'Domain66AC69E0', + 'Arn', + ], + }; + const resolvedPaths = paths.map(path => { + return { + 'Fn::Join': [ + '', + [ + domainArn, + path, + ], + ], + }; + }); + const resource = appliesToDomainRoot + ? [domainArn, ...resolvedPaths] + : resolvedPaths.length > 1 + ? resolvedPaths + : resolvedPaths[0]; + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: action, + Effect: 'Allow', + Resource: resource, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'userDefaultPolicy083DF682', + Users: [ + { + Ref: 'user2C2B57AE', + }, + ], + }); +} + +function testMetric( + invocation: (domain: Domain) => Metric, + metricName: string, + engineVersion: EngineVersion, + statistic: string = Statistic.SUM, + period: Duration = Duration.minutes(5), +) { + const domain = new Domain(stack, 'Domain', { version: engineVersion }); + + const metric = invocation(domain); + + expect(metric).toMatchObject({ + metricName, + namespace: 'AWS/ES', + period, + statistic, + dimensions: { + ClientId: '1234', + }, + }); + expect(metric.dimensions).toHaveProperty('DomainName'); +} diff --git a/packages/aws-cdk-lib/aws-opensearchservice/test/log-group-resource-policy.test.ts b/packages/aws-cdk-lib/aws-opensearchservice/test/log-group-resource-policy.test.ts new file mode 100644 index 0000000000000..8b5754be2bf06 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/log-group-resource-policy.test.ts @@ -0,0 +1,65 @@ +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { App, Stack } from '../../core'; +import { LogGroupResourcePolicy } from '../lib/log-group-resource-policy'; + +let app: App; +let stack: Stack; + +beforeEach(() => { + app = new App(); + stack = new Stack(app, 'Stack', { + env: { account: '1234', region: 'testregion' }, + }); +}); + +test('minimal example renders correctly', () => { + new LogGroupResourcePolicy(stack, 'LogGroupResourcePolicy', { + policyName: 'TestPolicy', + policyStatements: [new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: ['logs:PutLogEvents', 'logs:CreateLogStream'], + resources: ['*'], + principals: [new iam.ServicePrincipal('es.amazonaws.com')], + })], + }); + + Template.fromStack(stack).hasResourceProperties('Custom::CloudwatchLogResourcePolicy', { + ServiceToken: { + 'Fn::GetAtt': [ + 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', + 'Arn', + ], + }, + Create: JSON.stringify({ + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: 'TestPolicy', + policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', + }, + physicalResourceId: { + id: 'LogGroupResourcePolicy', + }, + }), + Update: JSON.stringify({ + service: 'CloudWatchLogs', + action: 'putResourcePolicy', + parameters: { + policyName: 'TestPolicy', + policyDocument: '{"Statement":[{"Action":["logs:PutLogEvents","logs:CreateLogStream"],"Effect":"Allow","Principal":{"Service":"es.amazonaws.com"},"Resource":"*"}],"Version":"2012-10-17"}', + }, + physicalResourceId: { + id: 'LogGroupResourcePolicy', + }, + }), + Delete: JSON.stringify({ + service: 'CloudWatchLogs', + action: 'deleteResourcePolicy', + parameters: { + policyName: 'TestPolicy', + }, + ignoreErrorCodesMatching: 'ResourceNotFoundException', + }), + }); +}); diff --git a/packages/@aws-cdk/aws-opensearchservice/test/opensearch-access-policy.test.ts b/packages/aws-cdk-lib/aws-opensearchservice/test/opensearch-access-policy.test.ts similarity index 96% rename from packages/@aws-cdk/aws-opensearchservice/test/opensearch-access-policy.test.ts rename to packages/aws-cdk-lib/aws-opensearchservice/test/opensearch-access-policy.test.ts index 429cdca5a89cb..c99df125a59f5 100644 --- a/packages/@aws-cdk/aws-opensearchservice/test/opensearch-access-policy.test.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/opensearch-access-policy.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import { App, Stack } from '../../core'; import { OpenSearchAccessPolicy } from '../lib/opensearch-access-policy'; let app: App; diff --git a/packages/aws-cdk-lib/aws-opsworks/.jsiirc.json b/packages/aws-cdk-lib/aws-opsworks/.jsiirc.json new file mode 100644 index 0000000000000..73fa2e5dd38a4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworks/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.opsworks" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.OpsWorks" + }, + "python": { + "module": "aws_cdk.aws_opsworks" + } + } +} diff --git a/packages/aws-cdk-lib/aws-opsworks/README.md b/packages/aws-cdk-lib/aws-opsworks/README.md new file mode 100644 index 0000000000000..4a0d5ff302ed3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworks/README.md @@ -0,0 +1,27 @@ +# AWS OpsWorks Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as opsworks from 'aws-cdk-lib/aws-opsworks'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for OpsWorks construct libraries](https://constructs.dev/search?q=opsworks) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::OpsWorks resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorks.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::OpsWorks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorks.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-opsworks/index.ts b/packages/aws-cdk-lib/aws-opsworks/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworks/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-opsworks/lib/index.ts b/packages/aws-cdk-lib/aws-opsworks/lib/index.ts new file mode 100644 index 0000000000000..05beeddfdfba5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworks/lib/index.ts @@ -0,0 +1 @@ +export * from './opsworks.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-opsworkscm/.jsiirc.json b/packages/aws-cdk-lib/aws-opsworkscm/.jsiirc.json new file mode 100644 index 0000000000000..a4ddfe9a5c6ab --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworkscm/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.OpsWorksCM" + }, + "java": { + "package": "software.amazon.awscdk.services.opsworkscm" + }, + "python": { + "module": "aws_cdk.aws_opsworkscm" + } + } +} diff --git a/packages/aws-cdk-lib/aws-opsworkscm/README.md b/packages/aws-cdk-lib/aws-opsworkscm/README.md new file mode 100644 index 0000000000000..ee05490684466 --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworkscm/README.md @@ -0,0 +1,27 @@ +# AWS OpsWorks CM Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as opsworkscm from 'aws-cdk-lib/aws-opsworkscm'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for OpsWorksCM construct libraries](https://constructs.dev/search?q=opsworkscm) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::OpsWorksCM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorksCM.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::OpsWorksCM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_OpsWorksCM.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-opsworkscm/index.ts b/packages/aws-cdk-lib/aws-opsworkscm/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworkscm/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-opsworkscm/lib/index.ts b/packages/aws-cdk-lib/aws-opsworkscm/lib/index.ts new file mode 100644 index 0000000000000..7c5521d2e1b5b --- /dev/null +++ b/packages/aws-cdk-lib/aws-opsworkscm/lib/index.ts @@ -0,0 +1 @@ +export * from './opsworkscm.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-organizations/.jsiirc.json b/packages/aws-cdk-lib/aws-organizations/.jsiirc.json new file mode 100644 index 0000000000000..3ca25b4a68a34 --- /dev/null +++ b/packages/aws-cdk-lib/aws-organizations/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Organizations" + }, + "java": { + "package": "software.amazon.awscdk.services.organizations" + }, + "python": { + "module": "aws_cdk.aws_organizations" + } + } +} diff --git a/packages/aws-cdk-lib/aws-organizations/README.md b/packages/aws-cdk-lib/aws-organizations/README.md new file mode 100644 index 0000000000000..7cb4048d05d54 --- /dev/null +++ b/packages/aws-cdk-lib/aws-organizations/README.md @@ -0,0 +1,27 @@ +# AWS::Organizations Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as organizations from 'aws-cdk-lib/aws-organizations'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Organizations construct libraries](https://constructs.dev/search?q=organizations) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Organizations resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Organizations.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Organizations](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Organizations.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-organizations/index.ts b/packages/aws-cdk-lib/aws-organizations/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-organizations/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-organizations/lib/index.ts b/packages/aws-cdk-lib/aws-organizations/lib/index.ts new file mode 100644 index 0000000000000..82d2c8bb19950 --- /dev/null +++ b/packages/aws-cdk-lib/aws-organizations/lib/index.ts @@ -0,0 +1 @@ +export * from './organizations.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-panorama/.jsiirc.json b/packages/aws-cdk-lib/aws-panorama/.jsiirc.json new file mode 100644 index 0000000000000..bdb237696f250 --- /dev/null +++ b/packages/aws-cdk-lib/aws-panorama/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Panorama" + }, + "java": { + "package": "software.amazon.awscdk.services.panorama" + }, + "python": { + "module": "aws_cdk.aws_panorama" + } + } +} diff --git a/packages/aws-cdk-lib/aws-panorama/README.md b/packages/aws-cdk-lib/aws-panorama/README.md new file mode 100644 index 0000000000000..7c30ad947d4ac --- /dev/null +++ b/packages/aws-cdk-lib/aws-panorama/README.md @@ -0,0 +1,27 @@ +# AWS::Panorama Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as panorama from 'aws-cdk-lib/aws-panorama'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Panorama construct libraries](https://constructs.dev/search?q=panorama) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Panorama resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Panorama.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Panorama](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Panorama.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-panorama/index.ts b/packages/aws-cdk-lib/aws-panorama/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-panorama/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-panorama/lib/index.ts b/packages/aws-cdk-lib/aws-panorama/lib/index.ts new file mode 100644 index 0000000000000..083361a7fbe08 --- /dev/null +++ b/packages/aws-cdk-lib/aws-panorama/lib/index.ts @@ -0,0 +1 @@ +export * from './panorama.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-personalize/.jsiirc.json b/packages/aws-cdk-lib/aws-personalize/.jsiirc.json new file mode 100644 index 0000000000000..00b95e9976156 --- /dev/null +++ b/packages/aws-cdk-lib/aws-personalize/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Personalize" + }, + "java": { + "package": "software.amazon.awscdk.services.personalize" + }, + "python": { + "module": "aws_cdk.aws_personalize" + } + } +} diff --git a/packages/aws-cdk-lib/aws-personalize/README.md b/packages/aws-cdk-lib/aws-personalize/README.md new file mode 100644 index 0000000000000..a56638cf40179 --- /dev/null +++ b/packages/aws-cdk-lib/aws-personalize/README.md @@ -0,0 +1,27 @@ +# AWS::Personalize Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as personalize from 'aws-cdk-lib/aws-personalize'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Personalize construct libraries](https://constructs.dev/search?q=personalize) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Personalize resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Personalize.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Personalize](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Personalize.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-personalize/index.ts b/packages/aws-cdk-lib/aws-personalize/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-personalize/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-personalize/lib/index.ts b/packages/aws-cdk-lib/aws-personalize/lib/index.ts new file mode 100644 index 0000000000000..99362e08dcbcf --- /dev/null +++ b/packages/aws-cdk-lib/aws-personalize/lib/index.ts @@ -0,0 +1 @@ +export * from './personalize.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-pinpoint/.jsiirc.json b/packages/aws-cdk-lib/aws-pinpoint/.jsiirc.json new file mode 100644 index 0000000000000..79bc1c35cd94e --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpoint/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Pinpoint" + }, + "java": { + "package": "software.amazon.awscdk.services.pinpoint" + }, + "python": { + "module": "aws_cdk.aws_pinpoint" + } + } +} diff --git a/packages/aws-cdk-lib/aws-pinpoint/README.md b/packages/aws-cdk-lib/aws-pinpoint/README.md new file mode 100644 index 0000000000000..86b86dc8b8655 --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpoint/README.md @@ -0,0 +1,27 @@ +# Amazon Pinpoint Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as pinpoint from 'aws-cdk-lib/aws-pinpoint'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Pinpoint construct libraries](https://constructs.dev/search?q=pinpoint) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Pinpoint resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pinpoint.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Pinpoint](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pinpoint.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-pinpoint/index.ts b/packages/aws-cdk-lib/aws-pinpoint/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpoint/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-pinpoint/lib/index.ts b/packages/aws-cdk-lib/aws-pinpoint/lib/index.ts new file mode 100644 index 0000000000000..8f5c88a4c6d60 --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpoint/lib/index.ts @@ -0,0 +1 @@ +export * from './pinpoint.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-pinpointemail/.jsiirc.json b/packages/aws-cdk-lib/aws-pinpointemail/.jsiirc.json new file mode 100644 index 0000000000000..c80cdf2023d54 --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpointemail/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.PinpointEmail" + }, + "java": { + "package": "software.amazon.awscdk.services.pinpointemail" + }, + "python": { + "module": "aws_cdk.aws_pinpointemail" + } + } +} diff --git a/packages/aws-cdk-lib/aws-pinpointemail/README.md b/packages/aws-cdk-lib/aws-pinpointemail/README.md new file mode 100644 index 0000000000000..f2cffbb7c34e6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpointemail/README.md @@ -0,0 +1,27 @@ +# Amazon Pinpoint Email Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as pinpointemail from 'aws-cdk-lib/aws-pinpointemail'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for PinpointEmail construct libraries](https://constructs.dev/search?q=pinpointemail) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::PinpointEmail resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_PinpointEmail.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::PinpointEmail](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_PinpointEmail.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-pinpointemail/index.ts b/packages/aws-cdk-lib/aws-pinpointemail/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpointemail/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-pinpointemail/lib/index.ts b/packages/aws-cdk-lib/aws-pinpointemail/lib/index.ts new file mode 100644 index 0000000000000..51ef101092cfa --- /dev/null +++ b/packages/aws-cdk-lib/aws-pinpointemail/lib/index.ts @@ -0,0 +1 @@ +export * from './pinpointemail.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-pipes/.jsiirc.json b/packages/aws-cdk-lib/aws-pipes/.jsiirc.json new file mode 100644 index 0000000000000..60edbe81c404f --- /dev/null +++ b/packages/aws-cdk-lib/aws-pipes/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Pipes" + }, + "java": { + "package": "software.amazon.awscdk.services.pipes" + }, + "python": { + "module": "aws_cdk.aws_pipes" + } + } +} diff --git a/packages/aws-cdk-lib/aws-pipes/README.md b/packages/aws-cdk-lib/aws-pipes/README.md new file mode 100644 index 0000000000000..25d358fef0562 --- /dev/null +++ b/packages/aws-cdk-lib/aws-pipes/README.md @@ -0,0 +1,27 @@ +# AWS::Pipes Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as pipes from 'aws-cdk-lib/aws-pipes'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Pipes construct libraries](https://constructs.dev/search?q=pipes) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Pipes resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pipes.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Pipes](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Pipes.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-pipes/index.ts b/packages/aws-cdk-lib/aws-pipes/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-pipes/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-pipes/lib/index.ts b/packages/aws-cdk-lib/aws-pipes/lib/index.ts new file mode 100644 index 0000000000000..9da8d13dfd199 --- /dev/null +++ b/packages/aws-cdk-lib/aws-pipes/lib/index.ts @@ -0,0 +1 @@ +export * from './pipes.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-qldb/.jsiirc.json b/packages/aws-cdk-lib/aws-qldb/.jsiirc.json new file mode 100644 index 0000000000000..5427aca3ca044 --- /dev/null +++ b/packages/aws-cdk-lib/aws-qldb/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.QLDB" + }, + "java": { + "package": "software.amazon.awscdk.services.qldb" + }, + "python": { + "module": "aws_cdk.aws_qldb" + } + } +} diff --git a/packages/aws-cdk-lib/aws-qldb/README.md b/packages/aws-cdk-lib/aws-qldb/README.md new file mode 100644 index 0000000000000..16cd7a313bc35 --- /dev/null +++ b/packages/aws-cdk-lib/aws-qldb/README.md @@ -0,0 +1,27 @@ +# AWS::QLDB Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as qldb from 'aws-cdk-lib/aws-qldb'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for QLDB construct libraries](https://constructs.dev/search?q=qldb) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::QLDB resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QLDB.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::QLDB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QLDB.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-qldb/index.ts b/packages/aws-cdk-lib/aws-qldb/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-qldb/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-qldb/lib/index.ts b/packages/aws-cdk-lib/aws-qldb/lib/index.ts new file mode 100644 index 0000000000000..1ed0f80ae4629 --- /dev/null +++ b/packages/aws-cdk-lib/aws-qldb/lib/index.ts @@ -0,0 +1 @@ +export * from './qldb.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-quicksight/.jsiirc.json b/packages/aws-cdk-lib/aws-quicksight/.jsiirc.json new file mode 100644 index 0000000000000..7cd7526be131f --- /dev/null +++ b/packages/aws-cdk-lib/aws-quicksight/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.QuickSight" + }, + "java": { + "package": "software.amazon.awscdk.services.quicksight" + }, + "python": { + "module": "aws_cdk.aws_quicksight" + } + } +} diff --git a/packages/aws-cdk-lib/aws-quicksight/README.md b/packages/aws-cdk-lib/aws-quicksight/README.md new file mode 100644 index 0000000000000..31fe57689cfb6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-quicksight/README.md @@ -0,0 +1,27 @@ +# AWS::QuickSight Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as quicksight from 'aws-cdk-lib/aws-quicksight'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for QuickSight construct libraries](https://constructs.dev/search?q=quicksight) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::QuickSight resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QuickSight.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::QuickSight](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_QuickSight.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-quicksight/index.ts b/packages/aws-cdk-lib/aws-quicksight/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-quicksight/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-quicksight/lib/index.ts b/packages/aws-cdk-lib/aws-quicksight/lib/index.ts new file mode 100644 index 0000000000000..61a393a60a5d1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-quicksight/lib/index.ts @@ -0,0 +1 @@ +export * from './quicksight.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-ram/.jsiirc.json b/packages/aws-cdk-lib/aws-ram/.jsiirc.json new file mode 100644 index 0000000000000..87a83263a2f6d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ram/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.RAM" + }, + "java": { + "package": "software.amazon.awscdk.services.ram" + }, + "python": { + "module": "aws_cdk.aws_ram" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ram/README.md b/packages/aws-cdk-lib/aws-ram/README.md new file mode 100644 index 0000000000000..c0b025a9ee17a --- /dev/null +++ b/packages/aws-cdk-lib/aws-ram/README.md @@ -0,0 +1,27 @@ +# AWS Resource Access Manager Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as ram from 'aws-cdk-lib/aws-ram'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for RAM construct libraries](https://constructs.dev/search?q=ram) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RAM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RAM.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RAM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RAM.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-ram/index.ts b/packages/aws-cdk-lib/aws-ram/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ram/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-ram/lib/index.ts b/packages/aws-cdk-lib/aws-ram/lib/index.ts new file mode 100644 index 0000000000000..e2b3fc6be0b8d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ram/lib/index.ts @@ -0,0 +1 @@ +export * from './ram.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-rds/.jsiirc.json b/packages/aws-cdk-lib/aws-rds/.jsiirc.json new file mode 100644 index 0000000000000..41b89b52c86b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.rds" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.RDS" + }, + "python": { + "module": "aws_cdk.aws_rds" + } + } +} diff --git a/packages/aws-cdk-lib/aws-rds/README.md b/packages/aws-cdk-lib/aws-rds/README.md new file mode 100644 index 0000000000000..8737cc007791d --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/README.md @@ -0,0 +1,759 @@ +# Amazon Relational Database Service Construct Library + + + +```ts nofixture +import * as rds from 'aws-cdk-lib/aws-rds'; +``` + +## Starting a clustered database + +To set up a clustered database (like Aurora), define a `DatabaseCluster`. You must +always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether +your instances will be launched privately or publicly: + +```ts +declare const vpc: ec2.Vpc; +const cluster = new rds.DatabaseCluster(this, 'Database', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }), + credentials: rds.Credentials.fromGeneratedSecret('clusteradmin'), // Optional - will default to 'admin' username and generated password + instanceProps: { + // optional , defaults to t3.medium + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + vpc, + }, +}); +``` + +If there isn't a constant for the exact version you want to use, +all of the `Version` classes have a static `of` method that can be used to create an arbitrary version. + +```ts +const customEngineVersion = rds.AuroraMysqlEngineVersion.of('5.7.mysql_aurora.2.08.1'); +``` + +By default, the master password will be generated and stored in AWS Secrets Manager with auto-generated description. + +Your cluster will be empty by default. To add a default database upon construction, specify the +`defaultDatabaseName` attribute. + +To use dual-stack mode, specify `NetworkType.DUAL` on the `networkType` property: + +```ts +declare const vpc: ec2.Vpc; // VPC and subnets must have IPv6 CIDR blocks +const cluster = new rds.DatabaseCluster(this, 'Database', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_02_1 }), + instanceProps: { + vpc, + publiclyAccessible: false, + }, + networkType: rds.NetworkType.DUAL, +}); +``` + +For more information about dual-stack mode, see [Working with a DB cluster in a VPC](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html). + +Use `DatabaseClusterFromSnapshot` to create a cluster from a snapshot: + +```ts +declare const vpc: ec2.Vpc; +new rds.DatabaseClusterFromSnapshot(this, 'Database', { + engine: rds.DatabaseClusterEngine.aurora({ version: rds.AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', +}); +``` + +### Updating the database instances in a cluster + +Database cluster instances may be updated in bulk or on a rolling basis. + +An update to all instances in a cluster may cause significant downtime. To reduce the downtime, set the `instanceUpdateBehavior` property in `DatabaseClusterBaseProps` to `InstanceUpdateBehavior.ROLLING`. This adds a dependency between each instance so the update is performed on only one instance at a time. + +Use `InstanceUpdateBehavior.BULK` to update all instances at once. + +```ts +declare const vpc: ec2.Vpc; +const cluster = new rds.DatabaseCluster(this, 'Database', { + engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_3_01_0 }), + instances: 2, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, + instanceUpdateBehaviour: rds.InstanceUpdateBehaviour.ROLLING, // Optional - defaults to rds.InstanceUpdateBehaviour.BULK +}); +``` + +## Starting an instance database + +To set up an instance database, define a `DatabaseInstance`. You must +always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether +your instances will be launched privately or publicly: + +```ts +declare const vpc: ec2.Vpc; +const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + // optional, defaults to m5.large + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + credentials: rds.Credentials.fromGeneratedSecret('syscdk'), // Optional - will default to 'admin' username and generated password + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + } +}); +``` + +If there isn't a constant for the exact engine version you want to use, +all of the `Version` classes have a static `of` method that can be used to create an arbitrary version. + +```ts +const customEngineVersion = rds.OracleEngineVersion.of('19.0.0.0.ru-2020-04.rur-2020-04.r1', '19'); +``` + +By default, the master password will be generated and stored in AWS Secrets Manager. + +To use the storage auto scaling option of RDS you can specify the maximum allocated storage. +This is the upper limit to which RDS can automatically scale the storage. More info can be found +[here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling) +Example for max storage configuration: + +```ts +declare const vpc: ec2.Vpc; +const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + // optional, defaults to m5.large + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + maxAllocatedStorage: 200, +}); +``` + +To use dual-stack mode, specify `NetworkType.DUAL` on the `networkType` property: + +```ts +declare const vpc: ec2.Vpc; // VPC and subnets must have IPv6 CIDR blocks +const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + networkType: rds.NetworkType.DUAL, + publiclyAccessible: false, +}); +``` + +For more information about dual-stack mode, see [Working with a DB instance in a VPC](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html). + +Use `DatabaseInstanceFromSnapshot` and `DatabaseInstanceReadReplica` to create an instance from snapshot or +a source database respectively: + +```ts +declare const vpc: ec2.Vpc; +new rds.DatabaseInstanceFromSnapshot(this, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + // optional, defaults to m5.large + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), + vpc, +}); + +declare const sourceInstance: rds.DatabaseInstance; +new rds.DatabaseInstanceReadReplica(this, 'ReadReplica', { + sourceDatabaseInstance: sourceInstance, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), + vpc, +}); +``` + +Automatic backups of read replica instances are only supported for MySQL and MariaDB. By default, +automatic backups are disabled for read replicas and can only be enabled (using `backupRetention`) +if also enabled on the source instance. + +Creating a "production" Oracle database instance with option and parameter groups: + +[example of setting up a production oracle instance](test/integ.instance.lit.ts) + +Use the `storageType` property to specify the [type of storage](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html) +to use for the instance: + +```ts +declare const vpc: ec2.Vpc; + +const iopsInstance = new rds.DatabaseInstance(this, 'IopsInstance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: MysqlEngineVersion.VER_8_0_30 }), + vpc, + storageType: rds.StorageType.IO1, + iops: 5000, +}); + +const gp3Instance = new rds.DatabaseInstance(this, 'Gp3Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: MysqlEngineVersion.VER_8_0_30 }), + vpc, + allocatedStorage: 500, + storageType: rds.StorageType.GP3, + storageThroughput: 500, // only applicable for GP3 +}); +``` + +## Setting Public Accessibility + +You can set public accessibility for the database instance or cluster using the `publiclyAccessible` property. +If you specify `true`, it creates an instance with a publicly resolvable DNS name, which resolves to a public IP address. +If you specify `false`, it creates an internal instance with a DNS name that resolves to a private IP address. +The default value depends on `vpcSubnets`. +It will be `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise. + +```ts +declare const vpc: ec2.Vpc; +// Setting public accessibility for DB instance +new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + publiclyAccessible: true, +}); + +// Setting public accessibility for DB cluster +new rds.DatabaseCluster(this, 'DatabaseCluster', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + publiclyAccessible: true, + }, +}); +``` + +## Instance events + +To define Amazon CloudWatch event rules for database instances, use the `onEvent` +method: + +```ts +declare const instance: rds.DatabaseInstance; +declare const fn: lambda.Function; +const rule = instance.onEvent('InstanceEvent', { target: new targets.LambdaFunction(fn) }); +``` + +## Login credentials + +By default, database instances and clusters (with the exception of `DatabaseInstanceFromSnapshot` and `ServerlessClusterFromSnapshot`) will have `admin` user with an auto-generated password. +An alternative username (and password) may be specified for the admin user instead of the default. + +The following examples use a `DatabaseInstance`, but the same usage is applicable to `DatabaseCluster`. + +```ts +declare const vpc: ec2.Vpc; +const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); +new rds.DatabaseInstance(this, 'InstanceWithUsername', { + engine, + vpc, + credentials: rds.Credentials.fromGeneratedSecret('postgres'), // Creates an admin user of postgres with a generated password +}); + +new rds.DatabaseInstance(this, 'InstanceWithUsernameAndPassword', { + engine, + vpc, + credentials: rds.Credentials.fromPassword('postgres', SecretValue.ssmSecure('/dbPassword', '1')), // Use password from SSM +}); + +const mySecret = secretsmanager.Secret.fromSecretName(this, 'DBSecret', 'myDBLoginInfo'); +new rds.DatabaseInstance(this, 'InstanceWithSecretLogin', { + engine, + vpc, + credentials: rds.Credentials.fromSecret(mySecret), // Get both username and password from existing secret +}); +``` + +Secrets generated by `fromGeneratedSecret()` can be customized: + +```ts +declare const vpc: ec2.Vpc; +const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); +const myKey = new kms.Key(this, 'MyKey'); + +new rds.DatabaseInstance(this, 'InstanceWithCustomizedSecret', { + engine, + vpc, + credentials: rds.Credentials.fromGeneratedSecret('postgres', { + secretName: 'my-cool-name', + encryptionKey: myKey, + excludeCharacters: '!&*^#@()', + replicaRegions: [{ region: 'eu-west-1' }, { region: 'eu-west-2' }], + }), +}); +``` + +### Snapshot credentials + +As noted above, Databases created with `DatabaseInstanceFromSnapshot` or `ServerlessClusterFromSnapshot` will not create user and auto-generated password by default because it's not possible to change the master username for a snapshot. Instead, they will use the existing username and password from the snapshot. You can still generate a new password - to generate a secret similarly to the other constructs, pass in credentials with `fromGeneratedSecret()` or `fromGeneratedPassword()`. + +```ts +declare const vpc: ec2.Vpc; +const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); +const myKey = new kms.Key(this, 'MyKey'); + +new rds.DatabaseInstanceFromSnapshot(this, 'InstanceFromSnapshotWithCustomizedSecret', { + engine, + vpc, + snapshotIdentifier: 'mySnapshot', + credentials: rds.SnapshotCredentials.fromGeneratedSecret('username', { + encryptionKey: myKey, + excludeCharacters: '!&*^#@()', + replicaRegions: [{ region: 'eu-west-1' }, { region: 'eu-west-2' }], + }), +}); +``` + +## Connecting + +To control who can access the cluster or instance, use the `.connections` attribute. RDS databases have +a default port, so you don't need to specify the port: + +```ts +declare const cluster: rds.DatabaseCluster; +cluster.connections.allowFromAnyIpv4(ec2.Port.allTraffic(), 'Open to the world'); +``` + +The endpoints to access your database cluster will be available as the `.clusterEndpoint` and `.readerEndpoint` +attributes: + +```ts +declare const cluster: rds.DatabaseCluster; +const writeAddress = cluster.clusterEndpoint.socketAddress; // "HOSTNAME:PORT" +``` + +For an instance database: + +```ts +declare const instance: rds.DatabaseInstance; +const address = instance.instanceEndpoint.socketAddress; // "HOSTNAME:PORT" +``` + +## Rotating credentials + +When the master password is generated and stored in AWS Secrets Manager, it can be rotated automatically: + +```ts +import * as cdk from 'aws-cdk-lib'; + +declare const instance: rds.DatabaseInstance; +declare const mySecurityGroup: ec2.SecurityGroup; +instance.addRotationSingleUser({ + automaticallyAfter: cdk.Duration.days(7), // defaults to 30 days + excludeCharacters: '!@#$%^&*', // defaults to the set " %+~`#$&*()|[]{}:;<>?!'/@\"\\" + securityGroup: mySecurityGroup, // defaults to an auto-created security group +}); +``` + +[example of setting up master password rotation for a cluster](test/integ.cluster-rotation.lit.ts) + +The multi user rotation scheme is also available: + +```ts +declare const instance: rds.DatabaseInstance; +declare const myImportedSecret: rds.DatabaseSecret; +instance.addRotationMultiUser('MyUser', { + secret: myImportedSecret, // This secret must have the `masterarn` key +}); +``` + +It's also possible to create user credentials together with the instance/cluster and add rotation: + +```ts +declare const instance: rds.DatabaseInstance; +const myUserSecret = new rds.DatabaseSecret(this, 'MyUserSecret', { + username: 'myuser', + secretName: 'my-user-secret', // optional, defaults to a CloudFormation-generated name + dbname: 'mydb', //optional, defaults to the main database of the RDS cluster this secret gets attached to + masterSecret: instance.secret, + excludeCharacters: '{}[]()\'"/\\', // defaults to the set " %+~`#$&*()|[]{}:;<>?!'/@\"\\" +}); +const myUserSecretAttached = myUserSecret.attach(instance); // Adds DB connections information in the secret + +instance.addRotationMultiUser('MyUser', { // Add rotation using the multi user scheme + secret: myUserSecretAttached, +}); +``` + +**Note**: This user must be created manually in the database using the master credentials. +The rotation will start as soon as this user exists. + +Access to the Secrets Manager API is required for the secret rotation. This can be achieved either with +internet connectivity (through NAT) or with a VPC interface endpoint. By default, the rotation Lambda function +is deployed in the same subnets as the instance/cluster. If access to the Secrets Manager API is not possible from +those subnets or using the default API endpoint, use the `vpcSubnets` and/or `endpoint` options: + +```ts +declare const instance: rds.DatabaseInstance; +declare const myEndpoint: ec2.InterfaceVpcEndpoint; + +instance.addRotationSingleUser({ + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, // Place rotation Lambda in private subnets + endpoint: myEndpoint, // Use VPC interface endpoint +}); +``` + +See also [@aws-cdk/aws-secretsmanager](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-secretsmanager/README.md) for credentials rotation of existing clusters/instances. + +## IAM Authentication + +You can also authenticate to a database instance using AWS Identity and Access Management (IAM) database authentication; +See for more information +and a list of supported versions and limitations. + +**Note**: `grantConnect()` does not currently work - see [this GitHub issue](https://github.com/aws/aws-cdk/issues/11851). + +The following example shows enabling IAM authentication for a database instance and granting connection access to an IAM role. + +```ts +declare const vpc: ec2.Vpc; +const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + iamAuthentication: true, // Optional - will be automatically set if you call grantConnect(). +}); +const role = new iam.Role(this, 'DBRole', { assumedBy: new iam.AccountPrincipal(this.account) }); +instance.grantConnect(role); // Grant the role connection access to the DB. +``` + +The following example shows granting connection access for RDS Proxy to an IAM role. + +```ts +declare const vpc: ec2.Vpc; +const cluster = new rds.DatabaseCluster(this, 'Database', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { vpc }, +}); + +const proxy = new rds.DatabaseProxy(this, 'Proxy', { + proxyTarget: rds.ProxyTarget.fromCluster(cluster), + secrets: [cluster.secret!], + vpc, +}); + +const role = new iam.Role(this, 'DBProxyRole', { assumedBy: new iam.AccountPrincipal(this.account) }); +proxy.grantConnect(role, 'admin'); // Grant the role connection access to the DB Proxy for database user 'admin'. +``` + +**Note**: In addition to the setup above, a database user will need to be created to support IAM auth. +See for setup instructions. + +## Kerberos Authentication + +You can also authenticate using Kerberos to a database instance using AWS Managed Microsoft AD for authentication; +See for more information +and a list of supported versions and limitations. + +The following example shows enabling domain support for a database instance and creating an IAM role to access +Directory Services. + +```ts +declare const vpc: ec2.Vpc; +const role = new iam.Role(this, 'RDSDirectoryServicesRole', { + assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSDirectoryServiceAccess'), + ], +}); +const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + domain: 'd-????????', // The ID of the domain for the instance to join. + domainRole: role, // Optional - will be create automatically if not provided. +}); +``` + +**Note**: In addition to the setup above, you need to make sure that the database instance has network connectivity +to the domain controllers. This includes enabling cross-VPC traffic if in a different VPC and setting up the +appropriate security groups/network ACL to allow traffic between the database instance and domain controllers. +Once configured, see for details +on configuring users for each available database engine. + +## Metrics + +Database instances and clusters both expose metrics (`cloudwatch.Metric`): + +```ts +// The number of database connections in use (average over 5 minutes) +declare const instance: rds.DatabaseInstance; +const dbConnections = instance.metricDatabaseConnections(); + +// Average CPU utilization over 5 minutes +declare const cluster: rds.DatabaseCluster; +const cpuUtilization = cluster.metricCPUUtilization(); + +// The average amount of time taken per disk I/O operation (average over 1 minute) +const readLatency = instance.metric('ReadLatency', { statistic: 'Average', period: Duration.seconds(60) }); +``` + +## Enabling S3 integration + +Data in S3 buckets can be imported to and exported from certain database engines using SQL queries. To enable this +functionality, set the `s3ImportBuckets` and `s3ExportBuckets` properties for import and export respectively. When +configured, the CDK automatically creates and configures IAM roles as required. +Additionally, the `s3ImportRole` and `s3ExportRole` properties can be used to set this role directly. + +You can read more about loading data to (or from) S3 here: + +* Aurora MySQL - [import](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html) + and [export](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html). +* Aurora PostgreSQL - [import](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html#USER_PostgreSQL.S3Import) + and [export](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html). +* Microsoft SQL Server - [import and export](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html) +* PostgreSQL - [import](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html) + and [export](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/postgresql-s3-export.html) +* Oracle - [import and export](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html) + +The following snippet sets up a database cluster with different S3 buckets where the data is imported and exported - + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; + +declare const vpc: ec2.Vpc; +const importBucket = new s3.Bucket(this, 'importbucket'); +const exportBucket = new s3.Bucket(this, 'exportbucket'); +new rds.DatabaseCluster(this, 'dbcluster', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + }, + s3ImportBuckets: [importBucket], + s3ExportBuckets: [exportBucket], +}); +``` + +## Creating a Database Proxy + +Amazon RDS Proxy sits between your application and your relational database to efficiently manage +connections to the database and improve scalability of the application. Learn more about at [Amazon RDS Proxy](https://aws.amazon.com/rds/proxy/) + +The following code configures an RDS Proxy for a `DatabaseInstance`. + +```ts +declare const vpc: ec2.Vpc; +declare const securityGroup: ec2.SecurityGroup; +declare const secrets: secretsmanager.Secret[]; +declare const dbInstance: rds.DatabaseInstance; + +const proxy = dbInstance.addProxy('proxy', { + borrowTimeout: Duration.seconds(30), + maxConnectionsPercent: 50, + secrets, + vpc, +}); +``` + +## Exporting Logs + +You can publish database logs to Amazon CloudWatch Logs. With CloudWatch Logs, you can perform real-time analysis of the log data, +store the data in highly durable storage, and manage the data with the CloudWatch Logs Agent. This is available for both database +instances and clusters; the types of logs available depend on the database type and engine being used. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; +declare const myLogsPublishingRole: iam.Role; +declare const vpc: ec2.Vpc; + +// Exporting logs from a cluster +const cluster = new rds.DatabaseCluster(this, 'Database', { + engine: rds.DatabaseClusterEngine.aurora({ + version: rds.AuroraEngineVersion.VER_1_17_9, // different version class for each engine type + }), + instanceProps: { + vpc, + }, + cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], // Export all available MySQL-based logs + cloudwatchLogsRetention: logs.RetentionDays.THREE_MONTHS, // Optional - default is to never expire logs + cloudwatchLogsRetentionRole: myLogsPublishingRole, // Optional - a role will be created if not provided + // ... +}); + +// Exporting logs from an instance +const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.postgres({ + version: rds.PostgresEngineVersion.VER_15_2, + }), + vpc, + cloudwatchLogsExports: ['postgresql'], // Export the PostgreSQL logs + // ... +}); +``` + +## Option Groups + +Some DB engines offer additional features that make it easier to manage data and databases, and to provide additional security for your database. +Amazon RDS uses option groups to enable and configure these features. An option group can specify features, called options, +that are available for a particular Amazon RDS DB instance. + +```ts +declare const vpc: ec2.Vpc; +declare const securityGroup: ec2.SecurityGroup; + +new rds.OptionGroup(this, 'Options', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ + version: rds.OracleEngineVersion.VER_19, + }), + configurations: [ + { + name: 'OEM', + port: 5500, + vpc, + securityGroups: [securityGroup], // Optional - a default group will be created if not provided. + }, + ], +}); +``` + +## Parameter Groups + +Database parameters specify how the database is configured. +For example, database parameters can specify the amount of resources, such as memory, to allocate to a database. +You manage your database configuration by associating your DB instances with parameter groups. +Amazon RDS defines parameter groups with default settings. + +You can create your own parameter group for your cluster or instance and associate it with your database: + +```ts +declare const vpc: ec2.Vpc; + +const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ + version: rds.SqlServerEngineVersion.VER_11, + }), + parameters: { + locks: '100', + }, +}); + +new rds.DatabaseInstance(this, 'Database', { + engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, + vpc, + parameterGroup, +}); +``` + +Another way to specify parameters is to use the inline field `parameters` that creates an RDS parameter group for you. +You can use this if you do not want to reuse the parameter group instance for different instances: + +```ts +declare const vpc: ec2.Vpc; + +new rds.DatabaseInstance(this, 'Database', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_11 }), + vpc, + parameters: { + locks: '100', + }, +}); +``` + +You cannot specify a parameter map and a parameter group at the same time. + +## Serverless + +[Amazon Aurora Serverless](https://aws.amazon.com/rds/aurora/serverless/) is an on-demand, auto-scaling configuration for Amazon +Aurora. The database will automatically start up, shut down, and scale capacity +up or down based on your application's needs. It enables you to run your database +in the cloud without managing any database instances. + +The following example initializes an Aurora Serverless PostgreSql cluster. +Aurora Serverless clusters can specify scaling properties which will be used to +automatically scale the database cluster seamlessly based on the workload. + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', { + engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL, + copyTagsToSnapshot: true, // whether to save the cluster tags when creating the snapshot. Default is 'true' + parameterGroup: rds.ParameterGroup.fromParameterGroupName(this, 'ParameterGroup', 'default.aurora-postgresql10'), + vpc, + scaling: { + autoPause: Duration.minutes(10), // default is to pause after 5 minutes of idle time + minCapacity: rds.AuroraCapacityUnit.ACU_8, // default is 2 Aurora capacity units (ACUs) + maxCapacity: rds.AuroraCapacityUnit.ACU_32, // default is 16 Aurora capacity units (ACUs) + } +}); +``` + +Aurora Serverless Clusters do not support the following features: + +* Loading data from an Amazon S3 bucket +* Saving data to an Amazon S3 bucket +* Invoking an AWS Lambda function with an Aurora MySQL native function +* Aurora replicas +* Backtracking +* Multi-master clusters +* Database cloning +* IAM database cloning +* IAM database authentication +* Restoring a snapshot from MySQL DB instance +* Performance Insights +* RDS Proxy + +Read more about the [limitations of Aurora Serverless](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html#aurora-serverless.limitations) + +Learn more about using Amazon Aurora Serverless by reading the [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html) + +Use `ServerlessClusterFromSnapshot` to create a serverless cluster from a snapshot: + +```ts +declare const vpc: ec2.Vpc; +new rds.ServerlessClusterFromSnapshot(this, 'Cluster', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + vpc, + snapshotIdentifier: 'mySnapshot', +}); +``` + +### Data API + +You can access your Aurora Serverless DB cluster using the built-in Data API. The Data API doesn't require a persistent connection to the DB cluster. Instead, it provides a secure HTTP endpoint and integration with AWS SDKs. + +The following example shows granting Data API access to a Lamba function. + +```ts +declare const vpc: ec2.Vpc; + +const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', { + engine: rds.DatabaseClusterEngine.AURORA_MYSQL, + vpc, // this parameter is optional for serverless Clusters + enableDataApi: true, // Optional - will be automatically set if you call grantDataApiAccess() +}); + +declare const code: lambda.Code; +const fn = new lambda.Function(this, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code, + environment: { + CLUSTER_ARN: cluster.clusterArn, + SECRET_ARN: cluster.secret!.secretArn, + }, +}); +cluster.grantDataApiAccess(fn); +``` + +**Note**: To invoke the Data API, the resource will need to read the secret associated with the cluster. + +To learn more about using the Data API, see the [documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html). + +### Default VPC + +The `vpc` parameter is optional. + +If not provided, the cluster will be created in the default VPC of the account and region. +As this VPC is not deployed with AWS CDK, you can't configure the `vpcSubnets`, `subnetGroup` or `securityGroups` of the Aurora Serverless Cluster. +If you want to provide one of `vpcSubnets`, `subnetGroup` or `securityGroups` parameter, please provide a `vpc`. diff --git a/packages/aws-cdk-lib/aws-rds/index.ts b/packages/aws-cdk-lib/aws-rds/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-engine.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster-engine.ts similarity index 99% rename from packages/@aws-cdk/aws-rds/lib/cluster-engine.ts rename to packages/aws-cdk-lib/aws-rds/lib/cluster-engine.ts index 760abe90ac27e..fafa479ac084b 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-engine.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster-engine.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; +import * as iam from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; import { Construct } from 'constructs'; import { IEngine } from './engine'; import { EngineVersion } from './engine-version'; diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster-ref.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster-ref.ts new file mode 100644 index 0000000000000..8829ebac968d3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster-ref.ts @@ -0,0 +1,125 @@ +import * as ec2 from '../../aws-ec2'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { IResource } from '../../core'; +import { IClusterEngine } from './cluster-engine'; +import { Endpoint } from './endpoint'; +import { DatabaseProxy, DatabaseProxyOptions } from './proxy'; + +/** + * Create a clustered database with a given number of instances. + */ +export interface IDatabaseCluster extends IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { + /** + * Identifier of the cluster + */ + readonly clusterIdentifier: string; + + /** + * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. + * + * This AWS Region-unique identifier is used in things like IAM authentication policies. + */ + readonly clusterResourceIdentifier: string; + + /** + * Identifiers of the replicas + */ + readonly instanceIdentifiers: string[]; + + /** + * The endpoint to use for read/write operations + * @attribute EndpointAddress,EndpointPort + */ + readonly clusterEndpoint: Endpoint; + + /** + * Endpoint to use for load-balanced read-only operations. + * @attribute ReadEndpointAddress + */ + readonly clusterReadEndpoint: Endpoint; + + /** + * Endpoints which address each individual replica. + */ + readonly instanceEndpoints: Endpoint[]; + + /** + * The engine of this Cluster. + * May be not known for imported Clusters if it wasn't provided explicitly. + */ + readonly engine?: IClusterEngine; + + /** + * Add a new db proxy to this cluster. + */ + addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy; +} + +/** + * Properties that describe an existing cluster instance + */ +export interface DatabaseClusterAttributes { + /** + * Identifier for the cluster + */ + readonly clusterIdentifier: string; + + /** + * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. + * + * This AWS Region-unique identifier is used to grant access to the cluster. + * + * @default none + */ + readonly clusterResourceIdentifier?: string; + + /** + * The database port + * + * @default - none + */ + readonly port?: number; + + /** + * The security groups of the database cluster + * + * @default - no security groups + */ + readonly securityGroups?: ec2.ISecurityGroup[]; + + /** + * Identifier for the instances + * + * @default - no instance identifiers + */ + readonly instanceIdentifiers?: string[]; + // Actual underlying type: DBInstanceId[], but we have to type it more loosely for Java's benefit. + + /** + * Cluster endpoint address + * + * @default - no endpoint address + */ + readonly clusterEndpointAddress?: string; + + /** + * Reader endpoint address + * + * @default - no reader address + */ + readonly readerEndpointAddress?: string; + + /** + * Endpoint addresses of individual instances + * + * @default - no instance endpoints + */ + readonly instanceEndpointAddresses?: string[]; + + /** + * The engine of the existing Cluster. + * + * @default - the imported Cluster's engine is unknown + */ + readonly engine?: IClusterEngine; +} diff --git a/packages/aws-cdk-lib/aws-rds/lib/cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts new file mode 100644 index 0000000000000..ca2f1341f1f2d --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/cluster.ts @@ -0,0 +1,973 @@ +import * as ec2 from '../../aws-ec2'; +import { IRole, ManagedPolicy, Role, ServicePrincipal } from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { Annotations, Duration, FeatureFlags, RemovalPolicy, Resource, Token } from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { IClusterEngine } from './cluster-engine'; +import { DatabaseClusterAttributes, IDatabaseCluster } from './cluster-ref'; +import { DatabaseSecret } from './database-secret'; +import { Endpoint } from './endpoint'; +import { NetworkType } from './instance'; +import { IParameterGroup, ParameterGroup } from './parameter-group'; +import { applyDefaultRotationOptions, defaultDeletionProtection, renderCredentials, setupS3ImportExport, helperRemovalPolicy, renderUnless } from './private/util'; +import { BackupProps, Credentials, InstanceProps, PerformanceInsightRetention, RotationSingleUserOptions, RotationMultiUserOptions, SnapshotCredentials } from './props'; +import { DatabaseProxy, DatabaseProxyOptions, ProxyTarget } from './proxy'; +import { CfnDBCluster, CfnDBClusterProps, CfnDBInstance } from './rds.generated'; +import { ISubnetGroup, SubnetGroup } from './subnet-group'; + +/** + * Common properties for a new database cluster or cluster from snapshot. + */ +interface DatabaseClusterBaseProps { + /** + * What kind of database to start + */ + readonly engine: IClusterEngine; + + /** + * How many replicas/instances to create + * + * Has to be at least 1. + * + * @default 2 + */ + readonly instances?: number; + + /** + * Settings for the individual instances that are launched + */ + readonly instanceProps: InstanceProps; + + /** + * The ordering of updates for instances + * + * @default InstanceUpdateBehaviour.BULK + */ + readonly instanceUpdateBehaviour?: InstanceUpdateBehaviour; + + /** + * The number of seconds to set a cluster's target backtrack window to. + * This feature is only supported by the Aurora MySQL database engine and + * cannot be enabled on existing clusters. + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html + * @default 0 seconds (no backtrack) + */ + readonly backtrackWindow?: Duration + + /** + * Backup settings + * + * @default - Backup retention period for automated backups is 1 day. + * Backup preferred window is set to a 30-minute window selected at random from an + * 8-hour block of time for each AWS Region, occurring on a random day of the week. + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow + */ + readonly backup?: BackupProps; + + /** + * What port to listen on + * + * @default - The default for the engine is used. + */ + readonly port?: number; + + /** + * An optional identifier for the cluster + * + * @default - A name is automatically generated. + */ + readonly clusterIdentifier?: string; + + /** + * Base identifier for instances + * + * Every replica is named by appending the replica number to this string, 1-based. + * + * @default - clusterIdentifier is used with the word "Instance" appended. + * If clusterIdentifier is not provided, the identifier is automatically generated. + */ + readonly instanceIdentifierBase?: string; + + /** + * Name of a database which is automatically created inside the cluster + * + * @default - Database is not created in cluster. + */ + readonly defaultDatabaseName?: string; + + /** + * Indicates whether the DB cluster should have deletion protection enabled. + * + * @default - true if ``removalPolicy`` is RETAIN, false otherwise + */ + readonly deletionProtection?: boolean; + + /** + * A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). + * + * Example: 'Sun:23:45-Mon:00:15' + * + * @default - 30-minute window selected at random from an 8-hour block of time for + * each AWS Region, occurring on a random day of the week. + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance + */ + readonly preferredMaintenanceWindow?: string; + + /** + * Additional parameters to pass to the database engine + * + * @default - No parameter group. + */ + readonly parameterGroup?: IParameterGroup; + + /** + * The parameters in the DBClusterParameterGroup to create automatically + * + * You can only specify parameterGroup or parameters but not both. + * You need to use a versioned engine to auto-generate a DBClusterParameterGroup. + * + * @default - None + */ + readonly parameters?: { [key: string]: string }; + + /** + * The removal policy to apply when the cluster and its instances are removed + * from the stack or replaced during an update. + * + * @default - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data) + */ + readonly removalPolicy?: RemovalPolicy; + + /** + * The list of log types that need to be enabled for exporting to + * CloudWatch Logs. + * + * @default - no log exports + */ + readonly cloudwatchLogsExports?: string[]; + + /** + * The number of days log events are kept in CloudWatch Logs. When updating + * this property, unsetting it doesn't remove the log retention policy. To + * remove the retention policy, set the value to `Infinity`. + * + * @default - logs never expire + */ + readonly cloudwatchLogsRetention?: logs.RetentionDays; + + /** + * The IAM role for the Lambda function associated with the custom resource + * that sets the retention policy. + * + * @default - a new role is created. + */ + readonly cloudwatchLogsRetentionRole?: IRole; + + /** + * The interval, in seconds, between points when Amazon RDS collects enhanced + * monitoring metrics for the DB instances. + * + * @default no enhanced monitoring + */ + readonly monitoringInterval?: Duration; + + /** + * Role that will be used to manage DB instances monitoring. + * + * @default - A role is automatically created for you + */ + readonly monitoringRole?: IRole; + + /** + * Role that will be associated with this DB cluster to enable S3 import. + * This feature is only supported by the Aurora database engine. + * + * This property must not be used if `s3ImportBuckets` is used. + * + * For MySQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html + * + * For PostgreSQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html + * + * @default - New role is created if `s3ImportBuckets` is set, no role is defined otherwise + */ + readonly s3ImportRole?: IRole; + + /** + * S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. + * + * This property must not be used if `s3ImportRole` is used. + * + * For MySQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.LoadFromS3.html + * + * For PostgreSQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Migrating.html + * + * @default - None + */ + readonly s3ImportBuckets?: s3.IBucket[]; + + /** + * Role that will be associated with this DB cluster to enable S3 export. + * This feature is only supported by the Aurora database engine. + * + * This property must not be used if `s3ExportBuckets` is used. + * + * For MySQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html + * + * For PostgreSQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html + * + * @default - New role is created if `s3ExportBuckets` is set, no role is defined otherwise + */ + readonly s3ExportRole?: IRole; + + /** + * S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. + * + * This property must not be used if `s3ExportRole` is used. + * + * For MySQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Integrating.SaveIntoS3.html + * + * For PostgreSQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/postgresql-s3-export.html + * + * @default - None + */ + readonly s3ExportBuckets?: s3.IBucket[]; + + /** + * Existing subnet group for the cluster. + * + * @default - a new subnet group will be created. + */ + readonly subnetGroup?: ISubnetGroup; + + /** + * Whether to enable mapping of AWS Identity and Access Management (IAM) accounts + * to database accounts. + * + * @default false + */ + readonly iamAuthentication?: boolean; + + /** + * Whether to enable storage encryption. + * + * @default - true if storageEncryptionKey is provided, false otherwise + */ + readonly storageEncrypted?: boolean + + /** + * The KMS key for storage encryption. + * If specified, `storageEncrypted` will be set to `true`. + * + * @default - if storageEncrypted is true then the default master key, no key otherwise + */ + readonly storageEncryptionKey?: kms.IKey; + + /** + * Whether to copy tags to the snapshot when a snapshot is created. + * + * @default - true + */ + readonly copyTagsToSnapshot?: boolean; + + /** + * The network type of the DB instance. + * + * @default - IPV4 + */ + readonly networkType?: NetworkType; +} + +/** + * The orchestration of updates of multiple instances + */ +export enum InstanceUpdateBehaviour { + /** + * In a bulk update, all instances of the cluster are updated at the same time. + * This results in a faster update procedure. + * During the update, however, all instances might be unavailable at the same time and thus a downtime might occur. + */ + BULK = 'BULK', + + /** + * In a rolling update, one instance after another is updated. + * This results in at most one instance being unavailable during the update. + * If your cluster consists of more than 1 instance, the downtime periods are limited to the time a primary switch needs. + */ + ROLLING = 'ROLLING' +} + +/** + * A new or imported clustered database. + */ +export abstract class DatabaseClusterBase extends Resource implements IDatabaseCluster { + // only required because of JSII bug: https://github.com/aws/jsii/issues/2040 + public abstract readonly engine?: IClusterEngine; + + /** + * Identifier of the cluster + */ + public abstract readonly clusterIdentifier: string; + + /** + * The immutable identifier for the cluster; for example: cluster-ABCD1234EFGH5678IJKL90MNOP. + * + * This AWS Region-unique identifier is used in things like IAM authentication policies. + */ + public abstract readonly clusterResourceIdentifier: string; + + /** + * Identifiers of the replicas + */ + public abstract readonly instanceIdentifiers: string[]; + + /** + * The endpoint to use for read/write operations + */ + public abstract readonly clusterEndpoint: Endpoint; + + /** + * Endpoint to use for load-balanced read-only operations. + */ + public abstract readonly clusterReadEndpoint: Endpoint; + + /** + * Endpoints which address each individual replica. + */ + public abstract readonly instanceEndpoints: Endpoint[]; + + /** + * Access to the network connections + */ + public abstract readonly connections: ec2.Connections; + + /** + * Add a new db proxy to this cluster. + */ + public addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy { + return new DatabaseProxy(this, id, { + proxyTarget: ProxyTarget.fromCluster(this), + ...options, + }); + } + + /** + * Renders the secret attachment target specifications. + */ + public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { + return { + targetId: this.clusterIdentifier, + targetType: secretsmanager.AttachmentTargetType.RDS_DB_CLUSTER, + }; + } +} + +/** + * Abstract base for ``DatabaseCluster`` and ``DatabaseClusterFromSnapshot`` + */ +abstract class DatabaseClusterNew extends DatabaseClusterBase { + /** + * The engine for this Cluster. + * Never undefined. + */ + public readonly engine?: IClusterEngine; + + protected readonly newCfnProps: CfnDBClusterProps; + protected readonly securityGroups: ec2.ISecurityGroup[]; + protected readonly subnetGroup: ISubnetGroup; + + /** + * Secret in SecretsManager to store the database cluster user credentials. + */ + public abstract readonly secret?: secretsmanager.ISecret; + + /** + * The VPC network to place the cluster in. + */ + public readonly vpc: ec2.IVpc; + + /** + * The cluster's subnets. + */ + public readonly vpcSubnets?: ec2.SubnetSelection; + + /** + * Application for single user rotation of the master password to this cluster. + */ + public readonly singleUserRotationApplication: secretsmanager.SecretRotationApplication; + + /** + * Application for multi user rotation to this cluster. + */ + public readonly multiUserRotationApplication: secretsmanager.SecretRotationApplication; + + constructor(scope: Construct, id: string, props: DatabaseClusterBaseProps) { + super(scope, id); + + this.vpc = props.instanceProps.vpc; + this.vpcSubnets = props.instanceProps.vpcSubnets; + + this.singleUserRotationApplication = props.engine.singleUserRotationApplication; + this.multiUserRotationApplication = props.engine.multiUserRotationApplication; + + const { subnetIds } = props.instanceProps.vpc.selectSubnets(props.instanceProps.vpcSubnets); + + // Cannot test whether the subnets are in different AZs, but at least we can test the amount. + if (subnetIds.length < 2) { + Annotations.of(this).addError(`Cluster requires at least 2 subnets, got ${subnetIds.length}`); + } + + this.subnetGroup = props.subnetGroup ?? new SubnetGroup(this, 'Subnets', { + description: `Subnets for ${id} database`, + vpc: props.instanceProps.vpc, + vpcSubnets: props.instanceProps.vpcSubnets, + removalPolicy: renderUnless(helperRemovalPolicy(props.removalPolicy), RemovalPolicy.DESTROY), + }); + + this.securityGroups = props.instanceProps.securityGroups ?? [ + new ec2.SecurityGroup(this, 'SecurityGroup', { + description: 'RDS security group', + vpc: props.instanceProps.vpc, + }), + ]; + + const combineRoles = props.engine.combineImportAndExportRoles ?? false; + let { s3ImportRole, s3ExportRole } = setupS3ImportExport(this, props, combineRoles); + + if (props.parameterGroup && props.parameters) { + throw new Error('You cannot specify both parameterGroup and parameters'); + } + const parameterGroup = props.parameterGroup ?? ( + props.parameters + ? new ParameterGroup(this, 'ParameterGroup', { + engine: props.engine, + parameters: props.parameters, + }) + : undefined + ); + // bind the engine to the Cluster + const clusterEngineBindConfig = props.engine.bindToCluster(this, { + s3ImportRole, + s3ExportRole, + parameterGroup, + }); + + const clusterAssociatedRoles: CfnDBCluster.DBClusterRoleProperty[] = []; + if (s3ImportRole) { + clusterAssociatedRoles.push({ roleArn: s3ImportRole.roleArn, featureName: clusterEngineBindConfig.features?.s3Import }); + } + if (s3ExportRole && + // only add the second associated Role if it's different than the first + // (duplicates in the associated Roles array are not allowed by the RDS service) + (s3ExportRole !== s3ImportRole || + clusterEngineBindConfig.features?.s3Import !== clusterEngineBindConfig.features?.s3Export)) { + clusterAssociatedRoles.push({ roleArn: s3ExportRole.roleArn, featureName: clusterEngineBindConfig.features?.s3Export }); + } + + const clusterParameterGroup = props.parameterGroup ?? clusterEngineBindConfig.parameterGroup; + const clusterParameterGroupConfig = clusterParameterGroup?.bindToCluster({}); + this.engine = props.engine; + + const clusterIdentifier = FeatureFlags.of(this).isEnabled(cxapi.RDS_LOWERCASE_DB_IDENTIFIER) && !Token.isUnresolved(props.clusterIdentifier) + ? props.clusterIdentifier?.toLowerCase() + : props.clusterIdentifier; + + this.newCfnProps = { + // Basic + engine: props.engine.engineType, + engineVersion: props.engine.engineVersion?.fullVersion, + dbClusterIdentifier: clusterIdentifier, + dbSubnetGroupName: this.subnetGroup.subnetGroupName, + vpcSecurityGroupIds: this.securityGroups.map(sg => sg.securityGroupId), + port: props.port ?? clusterEngineBindConfig.port, + dbClusterParameterGroupName: clusterParameterGroupConfig?.parameterGroupName, + associatedRoles: clusterAssociatedRoles.length > 0 ? clusterAssociatedRoles : undefined, + deletionProtection: defaultDeletionProtection(props.deletionProtection, props.removalPolicy), + enableIamDatabaseAuthentication: props.iamAuthentication, + networkType: props.networkType, + // Admin + backtrackWindow: props.backtrackWindow?.toSeconds(), + backupRetentionPeriod: props.backup?.retention?.toDays(), + preferredBackupWindow: props.backup?.preferredWindow, + preferredMaintenanceWindow: props.preferredMaintenanceWindow, + databaseName: props.defaultDatabaseName, + enableCloudwatchLogsExports: props.cloudwatchLogsExports, + // Encryption + kmsKeyId: props.storageEncryptionKey?.keyArn, + storageEncrypted: props.storageEncryptionKey ? true : props.storageEncrypted, + // Tags + copyTagsToSnapshot: props.copyTagsToSnapshot ?? true, + }; + } + + /** + * Adds the single user rotation of the master password to this cluster. + * See [Single user rotation strategy](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-one-user-one-password) + */ + public addRotationSingleUser(options: RotationSingleUserOptions = {}): secretsmanager.SecretRotation { + if (!this.secret) { + throw new Error('Cannot add a single user rotation for a cluster without a secret.'); + } + + const id = 'RotationSingleUser'; + const existing = this.node.tryFindChild(id); + if (existing) { + throw new Error('A single user rotation was already added to this cluster.'); + } + + return new secretsmanager.SecretRotation(this, id, { + ...applyDefaultRotationOptions(options, this.vpcSubnets), + secret: this.secret, + application: this.singleUserRotationApplication, + vpc: this.vpc, + target: this, + }); + } + + /** + * Adds the multi user rotation to this cluster. + * See [Alternating users rotation strategy](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-two-users) + */ + public addRotationMultiUser(id: string, options: RotationMultiUserOptions): secretsmanager.SecretRotation { + if (!this.secret) { + throw new Error('Cannot add a multi user rotation for a cluster without a secret.'); + } + + return new secretsmanager.SecretRotation(this, id, { + ...applyDefaultRotationOptions(options, this.vpcSubnets), + secret: options.secret, + masterSecret: this.secret, + application: this.multiUserRotationApplication, + vpc: this.vpc, + target: this, + }); + } +} + +/** + * Represents an imported database cluster. + */ +class ImportedDatabaseCluster extends DatabaseClusterBase implements IDatabaseCluster { + public readonly clusterIdentifier: string; + public readonly connections: ec2.Connections; + public readonly engine?: IClusterEngine; + + private readonly _clusterResourceIdentifier?: string; + private readonly _clusterEndpoint?: Endpoint; + private readonly _clusterReadEndpoint?: Endpoint; + private readonly _instanceIdentifiers?: string[]; + private readonly _instanceEndpoints?: Endpoint[]; + + constructor(scope: Construct, id: string, attrs: DatabaseClusterAttributes) { + super(scope, id); + + this.clusterIdentifier = attrs.clusterIdentifier; + this._clusterResourceIdentifier = attrs.clusterResourceIdentifier; + + const defaultPort = attrs.port ? ec2.Port.tcp(attrs.port) : undefined; + this.connections = new ec2.Connections({ + securityGroups: attrs.securityGroups, + defaultPort, + }); + this.engine = attrs.engine; + + this._clusterEndpoint = (attrs.clusterEndpointAddress && attrs.port) ? new Endpoint(attrs.clusterEndpointAddress, attrs.port) : undefined; + this._clusterReadEndpoint = (attrs.readerEndpointAddress && attrs.port) ? new Endpoint(attrs.readerEndpointAddress, attrs.port) : undefined; + this._instanceIdentifiers = attrs.instanceIdentifiers; + this._instanceEndpoints = (attrs.instanceEndpointAddresses && attrs.port) + ? attrs.instanceEndpointAddresses.map(addr => new Endpoint(addr, attrs.port!)) + : undefined; + } + + public get clusterResourceIdentifier() { + if (!this._clusterResourceIdentifier) { + throw new Error('Cannot access `clusterResourceIdentifier` of an imported cluster without a clusterResourceIdentifier'); + } + return this._clusterResourceIdentifier; + } + + public get clusterEndpoint() { + if (!this._clusterEndpoint) { + throw new Error('Cannot access `clusterEndpoint` of an imported cluster without an endpoint address and port'); + } + return this._clusterEndpoint; + } + + public get clusterReadEndpoint() { + if (!this._clusterReadEndpoint) { + throw new Error('Cannot access `clusterReadEndpoint` of an imported cluster without a readerEndpointAddress and port'); + } + return this._clusterReadEndpoint; + } + + public get instanceIdentifiers() { + if (!this._instanceIdentifiers) { + throw new Error('Cannot access `instanceIdentifiers` of an imported cluster without provided instanceIdentifiers'); + } + return this._instanceIdentifiers; + } + + public get instanceEndpoints() { + if (!this._instanceEndpoints) { + throw new Error('Cannot access `instanceEndpoints` of an imported cluster without instanceEndpointAddresses and port'); + } + return this._instanceEndpoints; + } +} + +/** + * Properties for a new database cluster + */ +export interface DatabaseClusterProps extends DatabaseClusterBaseProps { + /** + * Credentials for the administrative user + * + * @default - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password + */ + readonly credentials?: Credentials; +} + +/** + * Create a clustered database with a given number of instances. + * + * @resource AWS::RDS::DBCluster + */ +export class DatabaseCluster extends DatabaseClusterNew { + /** + * Import an existing DatabaseCluster from properties + */ + public static fromDatabaseClusterAttributes(scope: Construct, id: string, attrs: DatabaseClusterAttributes): IDatabaseCluster { + return new ImportedDatabaseCluster(scope, id, attrs); + } + + public readonly clusterIdentifier: string; + public readonly clusterResourceIdentifier: string; + public readonly clusterEndpoint: Endpoint; + public readonly clusterReadEndpoint: Endpoint; + public readonly connections: ec2.Connections; + public readonly instanceIdentifiers: string[]; + public readonly instanceEndpoints: Endpoint[]; + + /** + * The secret attached to this cluster + */ + public readonly secret?: secretsmanager.ISecret; + + constructor(scope: Construct, id: string, props: DatabaseClusterProps) { + super(scope, id, props); + + const credentials = renderCredentials(this, props.engine, props.credentials); + const secret = credentials.secret; + + const cluster = new CfnDBCluster(this, 'Resource', { + ...this.newCfnProps, + // Admin + masterUsername: credentials.username, + masterUserPassword: credentials.password?.unsafeUnwrap(), + }); + + this.clusterIdentifier = cluster.ref; + this.clusterResourceIdentifier = cluster.attrDbClusterResourceId; + + if (secret) { + this.secret = secret.attach(this); + } + + // create a number token that represents the port of the cluster + const portAttribute = Token.asNumber(cluster.attrEndpointPort); + this.clusterEndpoint = new Endpoint(cluster.attrEndpointAddress, portAttribute); + this.clusterReadEndpoint = new Endpoint(cluster.attrReadEndpointAddress, portAttribute); + this.connections = new ec2.Connections({ + securityGroups: this.securityGroups, + defaultPort: ec2.Port.tcp(this.clusterEndpoint.port), + }); + + cluster.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); + + setLogRetention(this, props); + const createdInstances = createInstances(this, props, this.subnetGroup); + this.instanceIdentifiers = createdInstances.instanceIdentifiers; + this.instanceEndpoints = createdInstances.instanceEndpoints; + } +} + +/** + * Properties for ``DatabaseClusterFromSnapshot`` + */ +export interface DatabaseClusterFromSnapshotProps extends DatabaseClusterBaseProps { + /** + * The identifier for the DB instance snapshot or DB cluster snapshot to restore from. + * You can use either the name or the Amazon Resource Name (ARN) to specify a DB cluster snapshot. + * However, you can use only the ARN to specify a DB instance snapshot. + */ + readonly snapshotIdentifier: string; + + /** + * Credentials for the administrative user + * + * Note - using this prop only works with `Credentials.fromPassword()` with the + * username of the snapshot, `Credentials.fromUsername()` with the username and + * password of the snapshot or `Credentials.fromSecret()` with a secret containing + * the username and password of the snapshot. + * + * @default - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password + * that **will not be applied** to the cluster, use `snapshotCredentials` for the correct behavior. + * + * @deprecated use `snapshotCredentials` which allows to generate a new password + */ + readonly credentials?: Credentials; + + /** + * Master user credentials. + * + * Note - It is not possible to change the master username for a snapshot; + * however, it is possible to provide (or generate) a new password. + * + * @default - The existing username and password from the snapshot will be used. + */ + readonly snapshotCredentials?: SnapshotCredentials; +} + +/** + * A database cluster restored from a snapshot. + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseClusterFromSnapshot extends DatabaseClusterNew { + public readonly clusterIdentifier: string; + public readonly clusterResourceIdentifier: string; + public readonly clusterEndpoint: Endpoint; + public readonly clusterReadEndpoint: Endpoint; + public readonly connections: ec2.Connections; + public readonly instanceIdentifiers: string[]; + public readonly instanceEndpoints: Endpoint[]; + + /** + * The secret attached to this cluster + */ + public readonly secret?: secretsmanager.ISecret; + + constructor(scope: Construct, id: string, props: DatabaseClusterFromSnapshotProps) { + super(scope, id, props); + + if (props.credentials && !props.credentials.password && !props.credentials.secret) { + Annotations.of(this).addWarning('Use `snapshotCredentials` to modify password of a cluster created from a snapshot.'); + } + if (!props.credentials && !props.snapshotCredentials) { + Annotations.of(this).addWarning('Generated credentials will not be applied to cluster. Use `snapshotCredentials` instead. `addRotationSingleUser()` and `addRotationMultiUser()` cannot be used on this cluster.'); + } + const deprecatedCredentials = renderCredentials(this, props.engine, props.credentials); + + let credentials = props.snapshotCredentials; + let secret = credentials?.secret; + if (!secret && credentials?.generatePassword) { + if (!credentials.username) { + throw new Error('`snapshotCredentials` `username` must be specified when `generatePassword` is set to true'); + } + + secret = new DatabaseSecret(this, 'SnapshotSecret', { + username: credentials.username, + encryptionKey: credentials.encryptionKey, + excludeCharacters: credentials.excludeCharacters, + replaceOnPasswordCriteriaChanges: credentials.replaceOnPasswordCriteriaChanges, + replicaRegions: credentials.replicaRegions, + }); + } + + const cluster = new CfnDBCluster(this, 'Resource', { + ...this.newCfnProps, + snapshotIdentifier: props.snapshotIdentifier, + masterUserPassword: secret?.secretValueFromJson('password')?.unsafeUnwrap() ?? credentials?.password?.unsafeUnwrap(), // Safe usage + }); + + this.clusterIdentifier = cluster.ref; + this.clusterResourceIdentifier = cluster.attrDbClusterResourceId; + + if (secret) { + this.secret = secret.attach(this); + } + + if (deprecatedCredentials.secret) { + const deprecatedSecret = deprecatedCredentials.secret.attach(this); + if (!this.secret) { + this.secret = deprecatedSecret; + } + } + + // create a number token that represents the port of the cluster + const portAttribute = Token.asNumber(cluster.attrEndpointPort); + this.clusterEndpoint = new Endpoint(cluster.attrEndpointAddress, portAttribute); + this.clusterReadEndpoint = new Endpoint(cluster.attrReadEndpointAddress, portAttribute); + this.connections = new ec2.Connections({ + securityGroups: this.securityGroups, + defaultPort: ec2.Port.tcp(this.clusterEndpoint.port), + }); + + cluster.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); + + setLogRetention(this, props); + const createdInstances = createInstances(this, props, this.subnetGroup); + this.instanceIdentifiers = createdInstances.instanceIdentifiers; + this.instanceEndpoints = createdInstances.instanceEndpoints; + } +} + +/** + * Sets up CloudWatch log retention if configured. + * A function rather than protected member to prevent exposing ``DatabaseClusterBaseProps``. + */ +function setLogRetention(cluster: DatabaseClusterNew, props: DatabaseClusterBaseProps) { + if (props.cloudwatchLogsExports) { + const unsupportedLogTypes = props.cloudwatchLogsExports.filter(logType => !props.engine.supportedLogTypes.includes(logType)); + if (unsupportedLogTypes.length > 0) { + throw new Error(`Unsupported logs for the current engine type: ${unsupportedLogTypes.join(',')}`); + } + + if (props.cloudwatchLogsRetention) { + for (const log of props.cloudwatchLogsExports) { + new logs.LogRetention(cluster, `LogRetention${log}`, { + logGroupName: `/aws/rds/cluster/${cluster.clusterIdentifier}/${log}`, + retention: props.cloudwatchLogsRetention, + role: props.cloudwatchLogsRetentionRole, + }); + } + } + } +} + +/** Output from the createInstances method; used to set instance identifiers and endpoints */ +interface InstanceConfig { + readonly instanceIdentifiers: string[]; + readonly instanceEndpoints: Endpoint[]; +} + +/** + * Creates the instances for the cluster. + * A function rather than a protected method on ``DatabaseClusterNew`` to avoid exposing + * ``DatabaseClusterNew`` and ``DatabaseClusterBaseProps`` in the API. + */ +function createInstances(cluster: DatabaseClusterNew, props: DatabaseClusterBaseProps, subnetGroup: ISubnetGroup): InstanceConfig { + const instanceCount = props.instances != null ? props.instances : 2; + const instanceUpdateBehaviour = props.instanceUpdateBehaviour ?? InstanceUpdateBehaviour.BULK; + if (Token.isUnresolved(instanceCount)) { + throw new Error('The number of instances an RDS Cluster consists of cannot be provided as a deploy-time only value!'); + } + if (instanceCount < 1) { + throw new Error('At least one instance is required'); + } + + const instanceIdentifiers: string[] = []; + const instanceEndpoints: Endpoint[] = []; + const portAttribute = cluster.clusterEndpoint.port; + const instanceProps = props.instanceProps; + + // Get the actual subnet objects so we can depend on internet connectivity. + const internetConnected = instanceProps.vpc.selectSubnets(instanceProps.vpcSubnets).internetConnectivityEstablished; + + let monitoringRole; + if (props.monitoringInterval && props.monitoringInterval.toSeconds()) { + monitoringRole = props.monitoringRole || new Role(cluster, 'MonitoringRole', { + assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicies: [ + ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), + ], + }); + } + + const enablePerformanceInsights = instanceProps.enablePerformanceInsights + || instanceProps.performanceInsightRetention !== undefined || instanceProps.performanceInsightEncryptionKey !== undefined; + if (enablePerformanceInsights && instanceProps.enablePerformanceInsights === false) { + throw new Error('`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set'); + } + + const instanceType = instanceProps.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM); + + if (instanceProps.parameterGroup && instanceProps.parameters) { + throw new Error('You cannot specify both parameterGroup and parameters'); + } + + const instanceParameterGroup = instanceProps.parameterGroup ?? ( + instanceProps.parameters + ? new ParameterGroup(cluster, 'InstanceParameterGroup', { + engine: props.engine, + parameters: instanceProps.parameters, + }) + : undefined + ); + const instanceParameterGroupConfig = instanceParameterGroup?.bindToInstance({}); + + const instances: CfnDBInstance[] = []; + + for (let i = 0; i < instanceCount; i++) { + const instanceIndex = i + 1; + const instanceIdentifier = props.instanceIdentifierBase != null ? `${props.instanceIdentifierBase}${instanceIndex}` : + props.clusterIdentifier != null ? `${props.clusterIdentifier}instance${instanceIndex}` : + undefined; + + const instance = new CfnDBInstance(cluster, `Instance${instanceIndex}`, { + // Link to cluster + engine: props.engine.engineType, + dbClusterIdentifier: cluster.clusterIdentifier, + dbInstanceIdentifier: instanceIdentifier, + // Instance properties + dbInstanceClass: databaseInstanceType(instanceType), + publiclyAccessible: instanceProps.publiclyAccessible ?? + (instanceProps.vpcSubnets && instanceProps.vpcSubnets.subnetType === ec2.SubnetType.PUBLIC), + enablePerformanceInsights: enablePerformanceInsights || instanceProps.enablePerformanceInsights, // fall back to undefined if not set + performanceInsightsKmsKeyId: instanceProps.performanceInsightEncryptionKey?.keyArn, + performanceInsightsRetentionPeriod: enablePerformanceInsights + ? (instanceProps.performanceInsightRetention || PerformanceInsightRetention.DEFAULT) + : undefined, + // This is already set on the Cluster. Unclear to me whether it should be repeated or not. Better yes. + dbSubnetGroupName: subnetGroup.subnetGroupName, + dbParameterGroupName: instanceParameterGroupConfig?.parameterGroupName, + monitoringInterval: props.monitoringInterval && props.monitoringInterval.toSeconds(), + monitoringRoleArn: monitoringRole && monitoringRole.roleArn, + autoMinorVersionUpgrade: props.instanceProps.autoMinorVersionUpgrade, + allowMajorVersionUpgrade: props.instanceProps.allowMajorVersionUpgrade, + deleteAutomatedBackups: props.instanceProps.deleteAutomatedBackups, + }); + + // For instances that are part of a cluster: + // + // Cluster DESTROY or SNAPSHOT -> DESTROY (snapshot is good enough to recreate) + // Cluster RETAIN -> RETAIN (otherwise cluster state will disappear) + instance.applyRemovalPolicy(helperRemovalPolicy(props.removalPolicy)); + + // We must have a dependency on the NAT gateway provider here to create + // things in the right order. + instance.node.addDependency(internetConnected); + + instanceIdentifiers.push(instance.ref); + instanceEndpoints.push(new Endpoint(instance.attrEndpointAddress, portAttribute)); + instances.push(instance); + } + + // Adding dependencies here to ensure that the instances are updated one after the other. + if (instanceUpdateBehaviour === InstanceUpdateBehaviour.ROLLING) { + for (let i = 1; i < instanceCount; i++) { + instances[i].node.addDependency(instances[i-1]); + } + } + + return { instanceEndpoints, instanceIdentifiers }; +} + +/** + * Turn a regular instance type into a database instance type + */ +function databaseInstanceType(instanceType: ec2.InstanceType) { + return 'db.' + instanceType.toString(); +} diff --git a/packages/aws-cdk-lib/aws-rds/lib/database-secret.ts b/packages/aws-cdk-lib/aws-rds/lib/database-secret.ts new file mode 100644 index 0000000000000..6d3c3cc1b0b3f --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/database-secret.ts @@ -0,0 +1,111 @@ +import * as kms from '../../aws-kms'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { Aws, Names } from '../../core'; +import { md5hash } from '../../core/lib/helpers-internal'; +import { Construct } from 'constructs'; +import { DEFAULT_PASSWORD_EXCLUDE_CHARS } from './private/util'; + +/** + * Construction properties for a DatabaseSecret. + */ +export interface DatabaseSecretProps { + /** + * The username. + */ + readonly username: string; + + /** + * The database name, if not using the default one + * + * @default - whatever the secret generates after the attach method is run + */ + readonly dbname?: string; + + /** + * A name for the secret. + * + * @default - A name is generated by CloudFormation. + */ + readonly secretName?: string; + + /** + * The KMS key to use to encrypt the secret. + * + * @default default master key + */ + readonly encryptionKey?: kms.IKey; + + /** + * The master secret which will be used to rotate this secret. + * + * @default - no master secret information will be included + */ + readonly masterSecret?: secretsmanager.ISecret; + + /** + * Characters to not include in the generated password. + * + * @default " %+~`#$&*()|[]{}:;<>?!'/@\"\\" + */ + readonly excludeCharacters?: string; + + /** + * Whether to replace this secret when the criteria for the password change. + * + * This is achieved by overriding the logical id of the AWS::SecretsManager::Secret + * with a hash of the options that influence the password generation. This + * way a new secret will be created when the password is regenerated and the + * cluster or instance consuming this secret will have its credentials updated. + * + * @default false + */ + readonly replaceOnPasswordCriteriaChanges?: boolean; + + /** + * A list of regions where to replicate this secret. + * + * @default - Secret is not replicated + */ + readonly replicaRegions?: secretsmanager.ReplicaRegion[]; +} + +/** + * A database secret. + * + * @resource AWS::SecretsManager::Secret + */ +export class DatabaseSecret extends secretsmanager.Secret { + constructor(scope: Construct, id: string, props: DatabaseSecretProps) { + const excludeCharacters = props.excludeCharacters ?? DEFAULT_PASSWORD_EXCLUDE_CHARS; + + super(scope, id, { + encryptionKey: props.encryptionKey, + description: `Generated by the CDK for stack: ${Aws.STACK_NAME}`, + secretName: props.secretName, + generateSecretString: { + passwordLength: 30, // Oracle password cannot have more than 30 characters + secretStringTemplate: JSON.stringify({ + username: props.username, + dbname: props.dbname, + masterarn: props.masterSecret?.secretArn, + }), + generateStringKey: 'password', + excludeCharacters, + }, + replicaRegions: props.replicaRegions, + }); + + if (props.replaceOnPasswordCriteriaChanges) { + const hash = md5hash(JSON.stringify({ + // Use here the options that influence the password generation. + // If at some point we add other password customization options + // they sould be added here below (e.g. `passwordLength`). + excludeCharacters, + })); + const logicalId = `${Names.uniqueId(this)}${hash}`; + + const secret = this.node.defaultChild as secretsmanager.CfnSecret; + secret.overrideLogicalId(logicalId.slice(-255)); // Take last 255 chars + } + } +} diff --git a/packages/aws-cdk-lib/aws-rds/lib/endpoint.ts b/packages/aws-cdk-lib/aws-rds/lib/endpoint.ts new file mode 100644 index 0000000000000..1d93daa9baecd --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/endpoint.ts @@ -0,0 +1,31 @@ +import { Token } from '../../core'; + +/** + * Connection endpoint of a database cluster or instance + * + * Consists of a combination of hostname and port. + */ +export class Endpoint { + /** + * The hostname of the endpoint + */ + public readonly hostname: string; + + /** + * The port of the endpoint + */ + public readonly port: number; + + /** + * The combination of "HOSTNAME:PORT" for this endpoint + */ + public readonly socketAddress: string; + + constructor(address: string, port: number) { + this.hostname = address; + this.port = port; + + const portDesc = Token.isUnresolved(port) ? Token.asString(port) : port; + this.socketAddress = `${address}:${portDesc}`; + } +} diff --git a/packages/@aws-cdk/aws-rds/lib/engine-version.ts b/packages/aws-cdk-lib/aws-rds/lib/engine-version.ts similarity index 100% rename from packages/@aws-cdk/aws-rds/lib/engine-version.ts rename to packages/aws-cdk-lib/aws-rds/lib/engine-version.ts diff --git a/packages/@aws-cdk/aws-rds/lib/engine.ts b/packages/aws-cdk-lib/aws-rds/lib/engine.ts similarity index 100% rename from packages/@aws-cdk/aws-rds/lib/engine.ts rename to packages/aws-cdk-lib/aws-rds/lib/engine.ts diff --git a/packages/@aws-cdk/aws-rds/lib/index.ts b/packages/aws-cdk-lib/aws-rds/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-rds/lib/index.ts rename to packages/aws-cdk-lib/aws-rds/lib/index.ts diff --git a/packages/@aws-cdk/aws-rds/lib/instance-engine.ts b/packages/aws-cdk-lib/aws-rds/lib/instance-engine.ts similarity index 99% rename from packages/@aws-cdk/aws-rds/lib/instance-engine.ts rename to packages/aws-cdk-lib/aws-rds/lib/instance-engine.ts index df6a2fa3abb97..ef00de1d20b66 100644 --- a/packages/@aws-cdk/aws-rds/lib/instance-engine.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/instance-engine.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; +import * as iam from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; import { Construct } from 'constructs'; import { IEngine } from './engine'; import { EngineVersion } from './engine-version'; diff --git a/packages/aws-cdk-lib/aws-rds/lib/instance.ts b/packages/aws-cdk-lib/aws-rds/lib/instance.ts new file mode 100644 index 0000000000000..ebf5a4218f7d9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/instance.ts @@ -0,0 +1,1295 @@ +import * as ec2 from '../../aws-ec2'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { ArnComponents, ArnFormat, Duration, FeatureFlags, IResource, Lazy, RemovalPolicy, Resource, Stack, Token, Tokenization } from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { DatabaseSecret } from './database-secret'; +import { Endpoint } from './endpoint'; +import { IInstanceEngine } from './instance-engine'; +import { IOptionGroup } from './option-group'; +import { IParameterGroup, ParameterGroup } from './parameter-group'; +import { applyDefaultRotationOptions, defaultDeletionProtection, engineDescription, renderCredentials, setupS3ImportExport, helperRemovalPolicy, renderUnless } from './private/util'; +import { Credentials, PerformanceInsightRetention, RotationMultiUserOptions, RotationSingleUserOptions, SnapshotCredentials } from './props'; +import { DatabaseProxy, DatabaseProxyOptions, ProxyTarget } from './proxy'; +import { CfnDBInstance, CfnDBInstanceProps } from './rds.generated'; +import { ISubnetGroup, SubnetGroup } from './subnet-group'; + +/** + * A database instance + */ +export interface IDatabaseInstance extends IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { + /** + * The instance identifier. + */ + readonly instanceIdentifier: string; + + /** + * The instance arn. + */ + readonly instanceArn: string; + + /** + * The instance endpoint address. + * + * @attribute EndpointAddress + */ + readonly dbInstanceEndpointAddress: string; + + /** + * The instance endpoint port. + * + * @attribute EndpointPort + */ + readonly dbInstanceEndpointPort: string; + + /** + * The instance endpoint. + */ + readonly instanceEndpoint: Endpoint; + + /** + * The engine of this database Instance. + * May be not known for imported Instances if it wasn't provided explicitly, + * or for read replicas. + */ + readonly engine?: IInstanceEngine; + + /** + * Add a new db proxy to this instance. + */ + addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy; + + /** + * Grant the given identity connection access to the database. + * **Note**: this method does not currently work, see https://github.com/aws/aws-cdk/issues/11851 for details. + * @see https://github.com/aws/aws-cdk/issues/11851 + */ + grantConnect(grantee: iam.IGrantable): iam.Grant; + + /** + * Defines a CloudWatch event rule which triggers for instance events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + onEvent(id: string, options?: events.OnEventOptions): events.Rule; +} + +/** + * Properties that describe an existing instance + */ +export interface DatabaseInstanceAttributes { + /** + * The instance identifier. + */ + readonly instanceIdentifier: string; + + /** + * The endpoint address. + */ + readonly instanceEndpointAddress: string; + + /** + * The database port. + */ + readonly port: number; + + /** + * The security groups of the instance. + */ + readonly securityGroups: ec2.ISecurityGroup[]; + + /** + * The engine of the existing database Instance. + * + * @default - the imported Instance's engine is unknown + */ + readonly engine?: IInstanceEngine; +} + +/** + * A new or imported database instance. + */ +export abstract class DatabaseInstanceBase extends Resource implements IDatabaseInstance { + /** + * Import an existing database instance. + */ + public static fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance { + class Import extends DatabaseInstanceBase implements IDatabaseInstance { + public readonly defaultPort = ec2.Port.tcp(attrs.port); + public readonly connections = new ec2.Connections({ + securityGroups: attrs.securityGroups, + defaultPort: this.defaultPort, + }); + public readonly instanceIdentifier = attrs.instanceIdentifier; + public readonly dbInstanceEndpointAddress = attrs.instanceEndpointAddress; + public readonly dbInstanceEndpointPort = Tokenization.stringifyNumber(attrs.port); + public readonly instanceEndpoint = new Endpoint(attrs.instanceEndpointAddress, attrs.port); + public readonly engine = attrs.engine; + protected enableIamAuthentication = true; + } + + return new Import(scope, id); + } + + public abstract readonly instanceIdentifier: string; + public abstract readonly dbInstanceEndpointAddress: string; + public abstract readonly dbInstanceEndpointPort: string; + public abstract readonly instanceEndpoint: Endpoint; + // only required because of JSII bug: https://github.com/aws/jsii/issues/2040 + public abstract readonly engine?: IInstanceEngine; + protected abstract enableIamAuthentication?: boolean; + + /** + * Access to network connections. + */ + public abstract readonly connections: ec2.Connections; + + /** + * Add a new db proxy to this instance. + */ + public addProxy(id: string, options: DatabaseProxyOptions): DatabaseProxy { + return new DatabaseProxy(this, id, { + proxyTarget: ProxyTarget.fromInstance(this), + ...options, + }); + } + + public grantConnect(grantee: iam.IGrantable): iam.Grant { + if (this.enableIamAuthentication === false) { + throw new Error('Cannot grant connect when IAM authentication is disabled'); + } + + this.enableIamAuthentication = true; + return iam.Grant.addToPrincipal({ + grantee, + actions: ['rds-db:connect'], + resourceArns: [this.instanceArn], + }); + } + + /** + * Defines a CloudWatch event rule which triggers for instance events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + public onEvent(id: string, options: events.OnEventOptions = {}) { + const rule = new events.Rule(this, id, options); + rule.addEventPattern({ + source: ['aws.rds'], + resources: [this.instanceArn], + }); + rule.addTarget(options.target); + return rule; + } + + /** + * The instance arn. + */ + public get instanceArn(): string { + const commonAnComponents: ArnComponents = { + service: 'rds', + resource: 'db', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }; + const localArn = Stack.of(this).formatArn({ + ...commonAnComponents, + resourceName: this.instanceIdentifier, + }); + return this.getResourceArnAttribute(localArn, { + ...commonAnComponents, + resourceName: this.physicalName, + }); + } + + /** + * Renders the secret attachment target specifications. + */ + public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { + return { + targetId: this.instanceIdentifier, + targetType: secretsmanager.AttachmentTargetType.RDS_DB_INSTANCE, + }; + } +} + +/** + * The license model. + */ +export enum LicenseModel { + /** + * License included. + */ + LICENSE_INCLUDED = 'license-included', + + /** + * Bring your own licencse. + */ + BRING_YOUR_OWN_LICENSE = 'bring-your-own-license', + + /** + * General public license. + */ + GENERAL_PUBLIC_LICENSE = 'general-public-license' +} + +/** + * The processor features. + */ +export interface ProcessorFeatures { + /** + * The number of CPU core. + * + * @default - the default number of CPU cores for the chosen instance class. + */ + readonly coreCount?: number; + + /** + * The number of threads per core. + * + * @default - the default number of threads per core for the chosen instance class. + */ + readonly threadsPerCore?: number; +} + +/** + * The type of storage. + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html + */ +export enum StorageType { + /** + * Standard. + * + * Amazon RDS supports magnetic storage for backward compatibility. It is recommended to use + * General Purpose SSD or Provisioned IOPS SSD for any new storage needs. + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#CHAP_Storage.Magnetic + */ + STANDARD = 'standard', + + /** + * General purpose SSD (gp2). + * + * Baseline performance determined by volume size + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD + */ + GP2 = 'gp2', + + /** + * General purpose SSD (gp3). + * + * Performance scales independently from storage + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD + */ + GP3 = 'gp3', + + /** + * Provisioned IOPS (SSD). + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS + */ + IO1 = 'io1' +} + +/** + * The network type of the DB instance. + */ +export enum NetworkType { + /** + * IPv4 only network type. + */ + IPV4 = 'IPV4', + + /** + * Dual-stack network type. + */ + DUAL = 'DUAL' +} + +/** + * Construction properties for a DatabaseInstanceNew + */ +export interface DatabaseInstanceNewProps { + /** + * Specifies if the database instance is a multiple Availability Zone deployment. + * + * @default false + */ + readonly multiAz?: boolean; + + /** + * The name of the Availability Zone where the DB instance will be located. + * + * @default - no preference + */ + readonly availabilityZone?: string; + + /** + * The storage type. Storage types supported are gp2, io1, standard. + * + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD + * + * @default GP2 + */ + readonly storageType?: StorageType; + + /** + * The storage throughput, specified in mebibytes per second (MiBps). + * + * Only applicable for GP3. + * + * @see https://docs.aws.amazon.com//AmazonRDS/latest/UserGuide/CHAP_Storage.html#gp3-storage + * + * @default - 125 MiBps if allocated storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, + * less than 200 GiB for Oracle and less than 20 GiB for SQL Server. 500 MiBps otherwise (except for + * SQL Server where the default is always 125 MiBps). + */ + readonly storageThroughput?: number; + + /** + * The number of I/O operations per second (IOPS) that the database provisions. + * The value must be equal to or greater than 1000. + * + * @default - no provisioned iops if storage type is not specified. For GP3: 3,000 IOPS if allocated + * storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, less than 200 GiB for Oracle and + * less than 20 GiB for SQL Server. 12,000 IOPS otherwise (except for SQL Server where the default is + * always 3,000 IOPS). + */ + readonly iops?: number; + + /** + * The number of CPU cores and the number of threads per core. + * + * @default - the default number of CPU cores and threads per core for the + * chosen instance class. + * + * See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessor + */ + readonly processorFeatures?: ProcessorFeatures; + + /** + * A name for the DB instance. If you specify a name, AWS CloudFormation + * converts it to lowercase. + * + * @default - a CloudFormation generated name + */ + readonly instanceIdentifier?: string; + + /** + * The VPC network where the DB subnet group should be created. + */ + readonly vpc: ec2.IVpc; + + /** + * The type of subnets to add to the created DB subnet group. + * + * @deprecated use `vpcSubnets` + * @default - private subnets + */ + readonly vpcPlacement?: ec2.SubnetSelection; + + /** + * The type of subnets to add to the created DB subnet group. + * + * @default - private subnets + */ + readonly vpcSubnets?: ec2.SubnetSelection; + + /** + * The security groups to assign to the DB instance. + * + * @default - a new security group is created + */ + readonly securityGroups?: ec2.ISecurityGroup[]; + + /** + * The port for the instance. + * + * @default - the default port for the chosen engine. + */ + readonly port?: number; + + /** + * The DB parameter group to associate with the instance. + * + * @default - no parameter group + */ + readonly parameterGroup?: IParameterGroup; + + /** + * The option group to associate with the instance. + * + * @default - no option group + */ + readonly optionGroup?: IOptionGroup; + + /** + * Whether to enable mapping of AWS Identity and Access Management (IAM) accounts + * to database accounts. + * + * @default false + */ + readonly iamAuthentication?: boolean; + + /** + * The number of days during which automatic DB snapshots are retained. + * Set to zero to disable backups. + * When creating a read replica, you must enable automatic backups on the source + * database instance by setting the backup retention to a value other than zero. + * + * @default - Duration.days(1) for source instances, disabled for read replicas + */ + readonly backupRetention?: Duration; + + /** + * The daily time range during which automated backups are performed. + * + * Constraints: + * - Must be in the format `hh24:mi-hh24:mi`. + * - Must be in Universal Coordinated Time (UTC). + * - Must not conflict with the preferred maintenance window. + * - Must be at least 30 minutes. + * + * @default - a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region. To see the time blocks available, see + * https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow + */ + readonly preferredBackupWindow?: string; + + /** + * Indicates whether to copy all of the user-defined tags from the + * DB instance to snapshots of the DB instance. + * + * @default true + */ + readonly copyTagsToSnapshot?: boolean; + + /** + * Indicates whether automated backups should be deleted or retained when + * you delete a DB instance. + * + * @default false + */ + readonly deleteAutomatedBackups?: boolean; + + /** + * The interval, in seconds, between points when Amazon RDS collects enhanced + * monitoring metrics for the DB instance. + * + * @default - no enhanced monitoring + */ + readonly monitoringInterval?: Duration; + + /** + * Role that will be used to manage DB instance monitoring. + * + * @default - A role is automatically created for you + */ + readonly monitoringRole?: iam.IRole; + + /** + * Whether to enable Performance Insights for the DB instance. + * + * @default - false, unless ``performanceInsightRentention`` or ``performanceInsightEncryptionKey`` is set. + */ + readonly enablePerformanceInsights?: boolean; + + /** + * The amount of time, in days, to retain Performance Insights data. + * + * @default 7 + */ + readonly performanceInsightRetention?: PerformanceInsightRetention; + + /** + * The AWS KMS key for encryption of Performance Insights data. + * + * @default - default master key + */ + readonly performanceInsightEncryptionKey?: kms.IKey; + + /** + * The list of log types that need to be enabled for exporting to + * CloudWatch Logs. + * + * @default - no log exports + */ + readonly cloudwatchLogsExports?: string[]; + + /** + * The number of days log events are kept in CloudWatch Logs. When updating + * this property, unsetting it doesn't remove the log retention policy. To + * remove the retention policy, set the value to `Infinity`. + * + * @default - logs never expire + */ + readonly cloudwatchLogsRetention?: logs.RetentionDays; + + /** + * The IAM role for the Lambda function associated with the custom resource + * that sets the retention policy. + * + * @default - a new role is created. + */ + readonly cloudwatchLogsRetentionRole?: iam.IRole; + + /** + * Indicates that minor engine upgrades are applied automatically to the + * DB instance during the maintenance window. + * + * @default true + */ + readonly autoMinorVersionUpgrade?: boolean; + + /** + * The weekly time range (in UTC) during which system maintenance can occur. + * + * Format: `ddd:hh24:mi-ddd:hh24:mi` + * Constraint: Minimum 30-minute window + * + * @default - a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region, occurring on a random day of the week. To see + * the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance + */ + readonly preferredMaintenanceWindow?: string; + + /** + * Indicates whether the DB instance should have deletion protection enabled. + * + * @default - true if ``removalPolicy`` is RETAIN, false otherwise + */ + readonly deletionProtection?: boolean; + + /** + * The CloudFormation policy to apply when the instance is removed from the + * stack or replaced during an update. + * + * @default - RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data) + */ + readonly removalPolicy?: RemovalPolicy; + + /** + * Upper limit to which RDS can scale the storage in GiB(Gibibyte). + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling + * @default - No autoscaling of RDS instance + */ + readonly maxAllocatedStorage?: number; + + /** + * The Active Directory directory ID to create the DB instance in. + * + * @default - Do not join domain + */ + readonly domain?: string; + + /** + * The IAM role to be used when making API calls to the Directory Service. The role needs the AWS-managed policy + * AmazonRDSDirectoryServiceAccess or equivalent. + * + * @default - The role will be created for you if `DatabaseInstanceNewProps#domain` is specified + */ + readonly domainRole?: iam.IRole; + + /** + * Existing subnet group for the instance. + * + * @default - a new subnet group will be created. + */ + readonly subnetGroup?: ISubnetGroup; + + /** + * Role that will be associated with this DB instance to enable S3 import. + * This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. + * + * This property must not be used if `s3ImportBuckets` is used. + * + * For Microsoft SQL Server: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html + * For Oracle: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html + * For PostgreSQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html + * + * @default - New role is created if `s3ImportBuckets` is set, no role is defined otherwise + */ + readonly s3ImportRole?: iam.IRole; + + /** + * S3 buckets that you want to load data from. + * This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. + * + * This property must not be used if `s3ImportRole` is used. + * + * For Microsoft SQL Server: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html + * For Oracle: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html + * For PostgreSQL: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html + * + * @default - None + */ + readonly s3ImportBuckets?: s3.IBucket[]; + + /** + * Role that will be associated with this DB instance to enable S3 export. + * + * This property must not be used if `s3ExportBuckets` is used. + * + * For Microsoft SQL Server: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html + * For Oracle: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html + * + * @default - New role is created if `s3ExportBuckets` is set, no role is defined otherwise + */ + readonly s3ExportRole?: iam.IRole; + + /** + * S3 buckets that you want to load data into. + * + * This property must not be used if `s3ExportRole` is used. + * + * For Microsoft SQL Server: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html + * For Oracle: + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html + * + * @default - None + */ + readonly s3ExportBuckets?: s3.IBucket[]; + + /** + * Indicates whether the DB instance is an internet-facing instance. + * + * @default - `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise + */ + readonly publiclyAccessible?: boolean; + + /** + * The network type of the DB instance. + * + * @default - IPV4 + */ + readonly networkType?: NetworkType; +} + +/** + * A new database instance. + */ +abstract class DatabaseInstanceNew extends DatabaseInstanceBase implements IDatabaseInstance { + /** + * The VPC where this database instance is deployed. + */ + public readonly vpc: ec2.IVpc; + + public readonly connections: ec2.Connections; + + protected abstract readonly instanceType: ec2.InstanceType; + + protected readonly vpcPlacement?: ec2.SubnetSelection; + protected readonly newCfnProps: CfnDBInstanceProps; + + private readonly cloudwatchLogsExports?: string[]; + private readonly cloudwatchLogsRetention?: logs.RetentionDays; + private readonly cloudwatchLogsRetentionRole?: iam.IRole; + + private readonly domainId?: string; + private readonly domainRole?: iam.IRole; + + protected enableIamAuthentication?: boolean; + + constructor(scope: Construct, id: string, props: DatabaseInstanceNewProps) { + // RDS always lower-cases the ID of the database, so use that for the physical name + // (which is the name used for cross-environment access, so it needs to be correct, + // regardless of the feature flag that changes it in the template for the L1) + const instancePhysicalName = Token.isUnresolved(props.instanceIdentifier) + ? props.instanceIdentifier + : props.instanceIdentifier?.toLowerCase(); + super(scope, id, { + physicalName: instancePhysicalName, + }); + + this.vpc = props.vpc; + if (props.vpcSubnets && props.vpcPlacement) { + throw new Error('Only one of `vpcSubnets` or `vpcPlacement` can be specified'); + } + this.vpcPlacement = props.vpcSubnets ?? props.vpcPlacement; + + if (props.multiAz === true && props.availabilityZone) { + throw new Error('Requesting a specific availability zone is not valid for Multi-AZ instances'); + } + + const subnetGroup = props.subnetGroup ?? new SubnetGroup(this, 'SubnetGroup', { + description: `Subnet group for ${this.node.id} database`, + vpc: this.vpc, + vpcSubnets: this.vpcPlacement, + removalPolicy: renderUnless(helperRemovalPolicy(props.removalPolicy), RemovalPolicy.DESTROY), + }); + + const securityGroups = props.securityGroups || [new ec2.SecurityGroup(this, 'SecurityGroup', { + description: `Security group for ${this.node.id} database`, + vpc: props.vpc, + })]; + + this.connections = new ec2.Connections({ + securityGroups, + defaultPort: ec2.Port.tcp(Lazy.number({ produce: () => this.instanceEndpoint.port })), + }); + + let monitoringRole; + if (props.monitoringInterval && props.monitoringInterval.toSeconds()) { + monitoringRole = props.monitoringRole || new iam.Role(this, 'MonitoringRole', { + assumedBy: new iam.ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicies: [iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole')], + }); + } + + const storageType = props.storageType ?? StorageType.GP2; + const iops = defaultIops(storageType, props.iops); + if (props.storageThroughput && storageType !== StorageType.GP3) { + throw new Error(`The storage throughput can only be specified with GP3 storage type. Got ${storageType}.`); + } + if (storageType === StorageType.GP3 && props.storageThroughput && iops + && !Token.isUnresolved(props.storageThroughput) && !Token.isUnresolved(iops) + && props.storageThroughput/iops > 0.25) { + throw new Error(`The maximum ratio of storage throughput to IOPS is 0.25. Got ${props.storageThroughput/iops}.`); + } + + this.cloudwatchLogsExports = props.cloudwatchLogsExports; + this.cloudwatchLogsRetention = props.cloudwatchLogsRetention; + this.cloudwatchLogsRetentionRole = props.cloudwatchLogsRetentionRole; + this.enableIamAuthentication = props.iamAuthentication; + + const enablePerformanceInsights = props.enablePerformanceInsights + || props.performanceInsightRetention !== undefined || props.performanceInsightEncryptionKey !== undefined; + if (enablePerformanceInsights && props.enablePerformanceInsights === false) { + throw new Error('`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set'); + } + + if (props.domain) { + this.domainId = props.domain; + this.domainRole = props.domainRole || new iam.Role(this, 'RDSDirectoryServiceRole', { + assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), + managedPolicies: [ + iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSDirectoryServiceAccess'), + ], + }); + } + + const maybeLowercasedInstanceId = FeatureFlags.of(this).isEnabled(cxapi.RDS_LOWERCASE_DB_IDENTIFIER) + && !Token.isUnresolved(props.instanceIdentifier) + ? props.instanceIdentifier?.toLowerCase() + : props.instanceIdentifier; + + const instanceParameterGroupConfig = props.parameterGroup?.bindToInstance({}); + this.newCfnProps = { + autoMinorVersionUpgrade: props.autoMinorVersionUpgrade, + availabilityZone: props.multiAz ? undefined : props.availabilityZone, + backupRetentionPeriod: props.backupRetention?.toDays(), + copyTagsToSnapshot: props.copyTagsToSnapshot ?? true, + dbInstanceClass: Lazy.string({ produce: () => `db.${this.instanceType}` }), + dbInstanceIdentifier: Token.isUnresolved(props.instanceIdentifier) + // if the passed identifier is a Token, + // we need to use the physicalName of the database + // (we cannot change its case anyway), + // as it might be used in a cross-environment fashion + ? this.physicalName + : maybeLowercasedInstanceId, + dbSubnetGroupName: subnetGroup.subnetGroupName, + deleteAutomatedBackups: props.deleteAutomatedBackups, + deletionProtection: defaultDeletionProtection(props.deletionProtection, props.removalPolicy), + enableCloudwatchLogsExports: this.cloudwatchLogsExports, + enableIamDatabaseAuthentication: Lazy.any({ produce: () => this.enableIamAuthentication }), + enablePerformanceInsights: enablePerformanceInsights || props.enablePerformanceInsights, // fall back to undefined if not set, + iops, + monitoringInterval: props.monitoringInterval?.toSeconds(), + monitoringRoleArn: monitoringRole?.roleArn, + multiAz: props.multiAz, + dbParameterGroupName: instanceParameterGroupConfig?.parameterGroupName, + optionGroupName: props.optionGroup?.optionGroupName, + performanceInsightsKmsKeyId: props.performanceInsightEncryptionKey?.keyArn, + performanceInsightsRetentionPeriod: enablePerformanceInsights + ? (props.performanceInsightRetention || PerformanceInsightRetention.DEFAULT) + : undefined, + port: props.port !== undefined ? Tokenization.stringifyNumber(props.port) : undefined, + preferredBackupWindow: props.preferredBackupWindow, + preferredMaintenanceWindow: props.preferredMaintenanceWindow, + processorFeatures: props.processorFeatures && renderProcessorFeatures(props.processorFeatures), + publiclyAccessible: props.publiclyAccessible ?? (this.vpcPlacement && this.vpcPlacement.subnetType === ec2.SubnetType.PUBLIC), + storageType, + storageThroughput: props.storageThroughput, + vpcSecurityGroups: securityGroups.map(s => s.securityGroupId), + maxAllocatedStorage: props.maxAllocatedStorage, + domain: this.domainId, + domainIamRoleName: this.domainRole?.roleName, + networkType: props.networkType, + }; + } + + protected setLogRetention() { + if (this.cloudwatchLogsExports && this.cloudwatchLogsRetention) { + for (const log of this.cloudwatchLogsExports) { + new logs.LogRetention(this, `LogRetention${log}`, { + logGroupName: `/aws/rds/instance/${this.instanceIdentifier}/${log}`, + retention: this.cloudwatchLogsRetention, + role: this.cloudwatchLogsRetentionRole, + }); + } + } + } +} + +/** + * Construction properties for a DatabaseInstanceSource + */ +export interface DatabaseInstanceSourceProps extends DatabaseInstanceNewProps { + /** + * The database engine. + */ + readonly engine: IInstanceEngine; + + /** + * The name of the compute and memory capacity for the instance. + * + * @default - m5.large (or, more specifically, db.m5.large) + */ + readonly instanceType?: ec2.InstanceType; + + /** + * The license model. + * + * @default - RDS default license model + */ + readonly licenseModel?: LicenseModel; + + /** + * Whether to allow major version upgrades. + * + * @default false + */ + readonly allowMajorVersionUpgrade?: boolean; + + /** + * The time zone of the instance. This is currently supported only by Microsoft Sql Server. + * + * @default - RDS default timezone + */ + readonly timezone?: string; + + /** + * The allocated storage size, specified in gibibytes (GiB). + * + * @default 100 + */ + readonly allocatedStorage?: number; + + /** + * The name of the database. + * + * @default - no name + */ + readonly databaseName?: string; + + /** + * The parameters in the DBParameterGroup to create automatically + * + * You can only specify parameterGroup or parameters but not both. + * You need to use a versioned engine to auto-generate a DBParameterGroup. + * + * @default - None + */ + readonly parameters?: { [key: string]: string }; +} + +/** + * A new source database instance (not a read replica) + */ +abstract class DatabaseInstanceSource extends DatabaseInstanceNew implements IDatabaseInstance { + public readonly engine?: IInstanceEngine; + /** + * The AWS Secrets Manager secret attached to the instance. + */ + public abstract readonly secret?: secretsmanager.ISecret; + + protected readonly sourceCfnProps: CfnDBInstanceProps; + protected readonly instanceType: ec2.InstanceType; + + private readonly singleUserRotationApplication: secretsmanager.SecretRotationApplication; + private readonly multiUserRotationApplication: secretsmanager.SecretRotationApplication; + + constructor(scope: Construct, id: string, props: DatabaseInstanceSourceProps) { + super(scope, id, props); + + this.singleUserRotationApplication = props.engine.singleUserRotationApplication; + this.multiUserRotationApplication = props.engine.multiUserRotationApplication; + this.engine = props.engine; + + const engineType = props.engine.engineType; + // only Oracle and SQL Server require the import and export Roles to be the same + const combineRoles = engineType.startsWith('oracle-') || engineType.startsWith('sqlserver-'); + let { s3ImportRole, s3ExportRole } = setupS3ImportExport(this, props, combineRoles); + const engineConfig = props.engine.bindToInstance(this, { + ...props, + s3ImportRole, + s3ExportRole, + }); + + const instanceAssociatedRoles: CfnDBInstance.DBInstanceRoleProperty[] = []; + const engineFeatures = engineConfig.features; + if (s3ImportRole) { + if (!engineFeatures?.s3Import) { + throw new Error(`Engine '${engineDescription(props.engine)}' does not support S3 import`); + } + instanceAssociatedRoles.push({ roleArn: s3ImportRole.roleArn, featureName: engineFeatures?.s3Import }); + } + if (s3ExportRole) { + if (!engineFeatures?.s3Export) { + throw new Error(`Engine '${engineDescription(props.engine)}' does not support S3 export`); + } + // only add the export feature if it's different from the import feature + if (engineFeatures.s3Import !== engineFeatures?.s3Export) { + instanceAssociatedRoles.push({ roleArn: s3ExportRole.roleArn, featureName: engineFeatures?.s3Export }); + } + } + + this.instanceType = props.instanceType ?? ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE); + + if (props.parameterGroup && props.parameters) { + throw new Error('You cannot specify both parameterGroup and parameters'); + } + + const dbParameterGroupName = props.parameters + ? new ParameterGroup(this, 'ParameterGroup', { + engine: props.engine, + parameters: props.parameters, + }).bindToInstance({}).parameterGroupName + : this.newCfnProps.dbParameterGroupName; + + this.sourceCfnProps = { + ...this.newCfnProps, + associatedRoles: instanceAssociatedRoles.length > 0 ? instanceAssociatedRoles : undefined, + optionGroupName: engineConfig.optionGroup?.optionGroupName, + allocatedStorage: props.allocatedStorage?.toString() ?? '100', + allowMajorVersionUpgrade: props.allowMajorVersionUpgrade, + dbName: props.databaseName, + engine: engineType, + engineVersion: props.engine.engineVersion?.fullVersion, + licenseModel: props.licenseModel, + timezone: props.timezone, + dbParameterGroupName, + }; + } + + /** + * Adds the single user rotation of the master password to this instance. + * + * @param options the options for the rotation, + * if you want to override the defaults + */ + public addRotationSingleUser(options: RotationSingleUserOptions = {}): secretsmanager.SecretRotation { + if (!this.secret) { + throw new Error('Cannot add single user rotation for an instance without secret.'); + } + + const id = 'RotationSingleUser'; + const existing = this.node.tryFindChild(id); + if (existing) { + throw new Error('A single user rotation was already added to this instance.'); + } + + return new secretsmanager.SecretRotation(this, id, { + ...applyDefaultRotationOptions(options, this.vpcPlacement), + secret: this.secret, + application: this.singleUserRotationApplication, + vpc: this.vpc, + target: this, + }); + } + + /** + * Adds the multi user rotation to this instance. + */ + public addRotationMultiUser(id: string, options: RotationMultiUserOptions): secretsmanager.SecretRotation { + if (!this.secret) { + throw new Error('Cannot add multi user rotation for an instance without secret.'); + } + + return new secretsmanager.SecretRotation(this, id, { + ...applyDefaultRotationOptions(options, this.vpcPlacement), + secret: options.secret, + masterSecret: this.secret, + application: this.multiUserRotationApplication, + vpc: this.vpc, + target: this, + }); + } +} + +/** + * Construction properties for a DatabaseInstance. + */ +export interface DatabaseInstanceProps extends DatabaseInstanceSourceProps { + /** + * Credentials for the administrative user + * + * @default - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password + */ + readonly credentials?: Credentials; + + /** + * For supported engines, specifies the character set to associate with the + * DB instance. + * + * @default - RDS default character set name + */ + readonly characterSetName?: string; + + /** + * Indicates whether the DB instance is encrypted. + * + * @default - true if storageEncryptionKey has been provided, false otherwise + */ + readonly storageEncrypted?: boolean; + + /** + * The KMS key that's used to encrypt the DB instance. + * + * @default - default master key if storageEncrypted is true, no key otherwise + */ + readonly storageEncryptionKey?: kms.IKey; +} + +/** + * A database instance + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseInstance extends DatabaseInstanceSource implements IDatabaseInstance { + public readonly instanceIdentifier: string; + public readonly dbInstanceEndpointAddress: string; + public readonly dbInstanceEndpointPort: string; + public readonly instanceEndpoint: Endpoint; + public readonly secret?: secretsmanager.ISecret; + + constructor(scope: Construct, id: string, props: DatabaseInstanceProps) { + super(scope, id, props); + + const credentials = renderCredentials(this, props.engine, props.credentials); + const secret = credentials.secret; + + const instance = new CfnDBInstance(this, 'Resource', { + ...this.sourceCfnProps, + characterSetName: props.characterSetName, + kmsKeyId: props.storageEncryptionKey && props.storageEncryptionKey.keyArn, + masterUsername: credentials.username, + masterUserPassword: credentials.password?.unsafeUnwrap(), + storageEncrypted: props.storageEncryptionKey ? true : props.storageEncrypted, + }); + + this.instanceIdentifier = this.getResourceNameAttribute(instance.ref); + this.dbInstanceEndpointAddress = instance.attrEndpointAddress; + this.dbInstanceEndpointPort = instance.attrEndpointPort; + + // create a number token that represents the port of the instance + const portAttribute = Token.asNumber(instance.attrEndpointPort); + this.instanceEndpoint = new Endpoint(instance.attrEndpointAddress, portAttribute); + + instance.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); + + if (secret) { + this.secret = secret.attach(this); + } + + this.setLogRetention(); + } +} + +/** + * Construction properties for a DatabaseInstanceFromSnapshot. + */ +export interface DatabaseInstanceFromSnapshotProps extends DatabaseInstanceSourceProps { + /** + * The name or Amazon Resource Name (ARN) of the DB snapshot that's used to + * restore the DB instance. If you're restoring from a shared manual DB + * snapshot, you must specify the ARN of the snapshot. + */ + readonly snapshotIdentifier: string; + + /** + * Master user credentials. + * + * Note - It is not possible to change the master username for a snapshot; + * however, it is possible to provide (or generate) a new password. + * + * @default - The existing username and password from the snapshot will be used. + */ + readonly credentials?: SnapshotCredentials; +} + +/** + * A database instance restored from a snapshot. + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseInstanceFromSnapshot extends DatabaseInstanceSource implements IDatabaseInstance { + public readonly instanceIdentifier: string; + public readonly dbInstanceEndpointAddress: string; + public readonly dbInstanceEndpointPort: string; + public readonly instanceEndpoint: Endpoint; + public readonly secret?: secretsmanager.ISecret; + + constructor(scope: Construct, id: string, props: DatabaseInstanceFromSnapshotProps) { + super(scope, id, props); + + let credentials = props.credentials; + let secret = credentials?.secret; + if (!secret && credentials?.generatePassword) { + if (!credentials.username) { + throw new Error('`credentials` `username` must be specified when `generatePassword` is set to true'); + } + + secret = new DatabaseSecret(this, 'Secret', { + username: credentials.username, + encryptionKey: credentials.encryptionKey, + excludeCharacters: credentials.excludeCharacters, + replaceOnPasswordCriteriaChanges: credentials.replaceOnPasswordCriteriaChanges, + replicaRegions: credentials.replicaRegions, + }); + } + + const instance = new CfnDBInstance(this, 'Resource', { + ...this.sourceCfnProps, + dbSnapshotIdentifier: props.snapshotIdentifier, + masterUserPassword: secret?.secretValueFromJson('password')?.unsafeUnwrap() ?? credentials?.password?.unsafeUnwrap(), // Safe usage + }); + + this.instanceIdentifier = instance.ref; + this.dbInstanceEndpointAddress = instance.attrEndpointAddress; + this.dbInstanceEndpointPort = instance.attrEndpointPort; + + // create a number token that represents the port of the instance + const portAttribute = Token.asNumber(instance.attrEndpointPort); + this.instanceEndpoint = new Endpoint(instance.attrEndpointAddress, portAttribute); + + instance.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); + + if (secret) { + this.secret = secret.attach(this); + } + + this.setLogRetention(); + } +} + +/** + * Construction properties for a DatabaseInstanceReadReplica. + */ +export interface DatabaseInstanceReadReplicaProps extends DatabaseInstanceNewProps { + /** + * The name of the compute and memory capacity classes. + */ + readonly instanceType: ec2.InstanceType; + + /** + * The source database instance. + * + * Each DB instance can have a limited number of read replicas. For more + * information, see https://docs.aws.amazon.com/AmazonRDS/latest/DeveloperGuide/USER_ReadRepl.html. + * + */ + readonly sourceDatabaseInstance: IDatabaseInstance; + + /** + * Indicates whether the DB instance is encrypted. + * + * @default - true if storageEncryptionKey has been provided, false otherwise + */ + readonly storageEncrypted?: boolean; + + /** + * The KMS key that's used to encrypt the DB instance. + * + * @default - default master key if storageEncrypted is true, no key otherwise + */ + readonly storageEncryptionKey?: kms.IKey; +} + +/** + * A read replica database instance. + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseInstanceReadReplica extends DatabaseInstanceNew implements IDatabaseInstance { + public readonly instanceIdentifier: string; + public readonly dbInstanceEndpointAddress: string; + public readonly dbInstanceEndpointPort: string; + public readonly instanceEndpoint: Endpoint; + public readonly engine?: IInstanceEngine = undefined; + protected readonly instanceType: ec2.InstanceType; + + constructor(scope: Construct, id: string, props: DatabaseInstanceReadReplicaProps) { + super(scope, id, props); + + if (props.sourceDatabaseInstance.engine + && !props.sourceDatabaseInstance.engine.supportsReadReplicaBackups + && props.backupRetention) { + throw new Error(`Cannot set 'backupRetention', as engine '${engineDescription(props.sourceDatabaseInstance.engine)}' does not support automatic backups for read replicas`); + } + + // The read replica instance always uses the same engine as the source instance + // but some CF validations require the engine to be explicitely passed when some + // properties are specified. + const shouldPassEngine = props.domain != null; + + const instance = new CfnDBInstance(this, 'Resource', { + ...this.newCfnProps, + // this must be ARN, not ID, because of https://github.com/terraform-providers/terraform-provider-aws/issues/528#issuecomment-391169012 + sourceDbInstanceIdentifier: props.sourceDatabaseInstance.instanceArn, + kmsKeyId: props.storageEncryptionKey?.keyArn, + storageEncrypted: props.storageEncryptionKey ? true : props.storageEncrypted, + engine: shouldPassEngine ? props.sourceDatabaseInstance.engine?.engineType : undefined, + }); + + this.instanceType = props.instanceType; + this.instanceIdentifier = instance.ref; + this.dbInstanceEndpointAddress = instance.attrEndpointAddress; + this.dbInstanceEndpointPort = instance.attrEndpointPort; + + // create a number token that represents the port of the instance + const portAttribute = Token.asNumber(instance.attrEndpointPort); + this.instanceEndpoint = new Endpoint(instance.attrEndpointAddress, portAttribute); + + instance.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.SNAPSHOT); + + this.setLogRetention(); + } +} + +/** + * Renders the processor features specifications + * + * @param features the processor features + */ +function renderProcessorFeatures(features: ProcessorFeatures): CfnDBInstance.ProcessorFeatureProperty[] | undefined { + const featuresList = Object.entries(features).map(([name, value]) => ({ name, value: value.toString() })); + + return featuresList.length === 0 ? undefined : featuresList; +} + +function defaultIops(storageType: StorageType, iops?: number): number | undefined { + switch (storageType) { + case StorageType.STANDARD: + case StorageType.GP2: + return undefined; + case StorageType.GP3: + return iops; + case StorageType.IO1: + return iops ?? 1000; + } +} diff --git a/packages/@aws-cdk/aws-rds/lib/option-group.ts b/packages/aws-cdk-lib/aws-rds/lib/option-group.ts similarity index 98% rename from packages/@aws-cdk/aws-rds/lib/option-group.ts rename to packages/aws-cdk-lib/aws-rds/lib/option-group.ts index 91dad4f8caffa..701477ccfb4d2 100644 --- a/packages/@aws-cdk/aws-rds/lib/option-group.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/option-group.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IResource, Lazy, Resource } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import { IResource, Lazy, Resource } from '../../core'; import { Construct } from 'constructs'; import { IInstanceEngine } from './instance-engine'; import { CfnOptionGroup } from './rds.generated'; diff --git a/packages/aws-cdk-lib/aws-rds/lib/parameter-group.ts b/packages/aws-cdk-lib/aws-rds/lib/parameter-group.ts new file mode 100644 index 0000000000000..764eb1ca995c5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/parameter-group.ts @@ -0,0 +1,174 @@ +import { IResource, Lazy, Resource } from '../../core'; +import { Construct } from 'constructs'; +import { IEngine } from './engine'; +import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from './rds.generated'; + +/** + * Options for `IParameterGroup.bindToCluster`. + * Empty for now, but can be extended later. + */ +export interface ParameterGroupClusterBindOptions { +} + +/** + * The type returned from `IParameterGroup.bindToCluster`. + */ +export interface ParameterGroupClusterConfig { + /** The name of this parameter group. */ + readonly parameterGroupName: string; +} + +/** + * Options for `IParameterGroup.bindToInstance`. + * Empty for now, but can be extended later. + */ +export interface ParameterGroupInstanceBindOptions { +} + +/** + * The type returned from `IParameterGroup.bindToInstance`. + */ +export interface ParameterGroupInstanceConfig { + /** The name of this parameter group. */ + readonly parameterGroupName: string; +} + +/** + * A parameter group. + * Represents both a cluster parameter group, + * and an instance parameter group. + */ +export interface IParameterGroup extends IResource { + /** + * Method called when this Parameter Group is used when defining a database cluster. + */ + bindToCluster(options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig; + + /** + * Method called when this Parameter Group is used when defining a database instance. + */ + bindToInstance(options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig; + + /** + * Adds a parameter to this group. + * If this is an imported parameter group, + * this method does nothing. + * + * @returns true if the parameter was actually added + * (i.e., this ParameterGroup is not imported), + * false otherwise + */ + addParameter(key: string, value: string): boolean; +} + +/** + * Properties for a parameter group + */ +export interface ParameterGroupProps { + /** + * The database engine for this parameter group. + */ + readonly engine: IEngine; + + /** + * Description for this parameter group + * + * @default a CDK generated description + */ + readonly description?: string; + + /** + * The parameters in this parameter group + * + * @default - None + */ + readonly parameters?: { [key: string]: string }; +} + +/** + * A parameter group. + * Represents both a cluster parameter group, + * and an instance parameter group. + * + * @resource AWS::RDS::DBParameterGroup + */ +export class ParameterGroup extends Resource implements IParameterGroup { + /** + * Imports a parameter group + */ + public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IParameterGroup { + class Import extends Resource implements IParameterGroup { + public bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig { + return { parameterGroupName }; + } + + public bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig { + return { parameterGroupName }; + } + + public addParameter(_key: string, _value: string): boolean { + return false; + } + } + + return new Import(scope, id); + } + + private readonly parameters: { [key: string]: string }; + private readonly family: string; + private readonly description?: string; + + private clusterCfnGroup?: CfnDBClusterParameterGroup; + private instanceCfnGroup?: CfnDBParameterGroup; + + constructor(scope: Construct, id: string, props: ParameterGroupProps) { + super(scope, id); + + const family = props.engine.parameterGroupFamily; + if (!family) { + throw new Error("ParameterGroup cannot be used with an engine that doesn't specify a version"); + } + this.family = family; + this.description = props.description; + this.parameters = props.parameters ?? {}; + } + + public bindToCluster(_options: ParameterGroupClusterBindOptions): ParameterGroupClusterConfig { + if (!this.clusterCfnGroup) { + const id = this.instanceCfnGroup ? 'ClusterParameterGroup' : 'Resource'; + this.clusterCfnGroup = new CfnDBClusterParameterGroup(this, id, { + description: this.description || `Cluster parameter group for ${this.family}`, + family: this.family, + parameters: Lazy.any({ produce: () => this.parameters }), + }); + } + return { + parameterGroupName: this.clusterCfnGroup.ref, + }; + } + + public bindToInstance(_options: ParameterGroupInstanceBindOptions): ParameterGroupInstanceConfig { + if (!this.instanceCfnGroup) { + const id = this.clusterCfnGroup ? 'InstanceParameterGroup' : 'Resource'; + this.instanceCfnGroup = new CfnDBParameterGroup(this, id, { + description: this.description || `Parameter group for ${this.family}`, + family: this.family, + parameters: Lazy.any({ produce: () => this.parameters }), + }); + } + return { + parameterGroupName: this.instanceCfnGroup.ref, + }; + } + + /** + * Add a parameter to this parameter group + * + * @param key The key of the parameter to be added + * @param value The value of the parameter to be added + */ + public addParameter(key: string, value: string): boolean { + this.parameters[key] = value; + return true; + } +} diff --git a/packages/@aws-cdk/aws-rds/lib/perms.ts b/packages/aws-cdk-lib/aws-rds/lib/perms.ts similarity index 100% rename from packages/@aws-cdk/aws-rds/lib/perms.ts rename to packages/aws-cdk-lib/aws-rds/lib/perms.ts diff --git a/packages/aws-cdk-lib/aws-rds/lib/private/util.ts b/packages/aws-cdk-lib/aws-rds/lib/private/util.ts new file mode 100644 index 0000000000000..f8662fdde3714 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/private/util.ts @@ -0,0 +1,145 @@ +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import { RemovalPolicy } from '../../../core'; +import { Construct } from 'constructs'; +import { DatabaseSecret } from '../database-secret'; +import { IEngine } from '../engine'; +import { CommonRotationUserOptions, Credentials } from '../props'; + +/** + * The default set of characters we exclude from generated passwords for database users. + * It's a combination of characters that have a tendency to cause problems in shell scripts, + * some engine-specific characters (for example, Oracle doesn't like '@' in its passwords), + * and some that trip up other services, like DMS. + * + * This constant is private to the RDS module. + */ +export const DEFAULT_PASSWORD_EXCLUDE_CHARS = " %+~`#$&*()|[]{}:;<>?!'/@\"\\"; + +/** Common base of `DatabaseInstanceProps` and `DatabaseClusterBaseProps` that has only the S3 props */ +export interface DatabaseS3ImportExportProps { + readonly s3ImportRole?: iam.IRole; + readonly s3ImportBuckets?: s3.IBucket[]; + readonly s3ExportRole?: iam.IRole; + readonly s3ExportBuckets?: s3.IBucket[]; +} + +/** + * Validates the S3 import/export props and returns the import/export roles, if any. + * If `combineRoles` is true, will reuse the import role for export (or vice versa) if possible. + * + * Notably, `combineRoles` is set to true for instances, but false for clusters. + * This is because the `combineRoles` functionality is most applicable to instances and didn't exist + * for the initial clusters implementation. To maintain backwards compatibility, it is set to false for clusters. + */ +export function setupS3ImportExport( + scope: Construct, + props: DatabaseS3ImportExportProps, + combineRoles: boolean): { s3ImportRole?: iam.IRole, s3ExportRole?: iam.IRole } { + + let s3ImportRole = props.s3ImportRole; + let s3ExportRole = props.s3ExportRole; + + if (props.s3ImportBuckets && props.s3ImportBuckets.length > 0) { + if (props.s3ImportRole) { + throw new Error('Only one of s3ImportRole or s3ImportBuckets must be specified, not both.'); + } + + s3ImportRole = (combineRoles && s3ExportRole) ? s3ExportRole : new iam.Role(scope, 'S3ImportRole', { + assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), + }); + for (const bucket of props.s3ImportBuckets) { + bucket.grantRead(s3ImportRole); + } + } + + if (props.s3ExportBuckets && props.s3ExportBuckets.length > 0) { + if (props.s3ExportRole) { + throw new Error('Only one of s3ExportRole or s3ExportBuckets must be specified, not both.'); + } + + s3ExportRole = (combineRoles && s3ImportRole) ? s3ImportRole : new iam.Role(scope, 'S3ExportRole', { + assumedBy: new iam.ServicePrincipal('rds.amazonaws.com'), + }); + for (const bucket of props.s3ExportBuckets) { + bucket.grantReadWrite(s3ExportRole); + } + } + + return { s3ImportRole, s3ExportRole }; +} + +export function engineDescription(engine: IEngine) { + return engine.engineType + (engine.engineVersion?.fullVersion ? `-${engine.engineVersion.fullVersion}` : ''); +} + +/** + * By default, deletion protection is disabled. + * Enable if explicitly provided or if the RemovalPolicy has been set to RETAIN + */ +export function defaultDeletionProtection(deletionProtection?: boolean, removalPolicy?: RemovalPolicy): boolean | undefined { + return deletionProtection ?? (removalPolicy === RemovalPolicy.RETAIN ? true : undefined); +} + +/** + * Renders the credentials for an instance or cluster + */ +export function renderCredentials(scope: Construct, engine: IEngine, credentials?: Credentials): Credentials { + let renderedCredentials = credentials ?? Credentials.fromUsername(engine.defaultUsername ?? 'admin'); // For backwards compatibilty + + if (!renderedCredentials.secret && !renderedCredentials.password) { + renderedCredentials = Credentials.fromSecret( + new DatabaseSecret(scope, 'Secret', { + username: renderedCredentials.username, + secretName: renderedCredentials.secretName, + encryptionKey: renderedCredentials.encryptionKey, + excludeCharacters: renderedCredentials.excludeCharacters, + // if username must be referenced as a string we can safely replace the + // secret when customization options are changed without risking a replacement + replaceOnPasswordCriteriaChanges: credentials?.usernameAsString, + replicaRegions: renderedCredentials.replicaRegions, + }), + // pass username if it must be referenced as a string + credentials?.usernameAsString ? renderedCredentials.username : undefined, + ); + } + + return renderedCredentials; +} + +/** + * The RemovalPolicy that should be applied to a "helper" resource, if the base resource has the given removal policy + * + * - For Clusters, this determines the RemovalPolicy for Instances/SubnetGroups. + * - For Instances, this determines the RemovalPolicy for SubnetGroups. + * + * If the basePolicy is: + * + * DESTROY or SNAPSHOT -> DESTROY (snapshot is good enough to recreate) + * RETAIN -> RETAIN (anything else will lose data or fail to deploy) + * (undefined) -> DESTROY (base policy is assumed to be SNAPSHOT) + */ +export function helperRemovalPolicy(basePolicy?: RemovalPolicy): RemovalPolicy { + return basePolicy === RemovalPolicy.RETAIN + ? RemovalPolicy.RETAIN + : RemovalPolicy.DESTROY; +} + +/** + * Return a given value unless it's the same as another value + */ +export function renderUnless(value: A, suppressValue: A): A | undefined { + return value === suppressValue ? undefined : value; +} + +/** + * Applies defaults for rotation options + */ +export function applyDefaultRotationOptions(options: CommonRotationUserOptions, defaultvpcSubnets?: ec2.SubnetSelection): CommonRotationUserOptions { + return { + excludeCharacters: DEFAULT_PASSWORD_EXCLUDE_CHARS, + vpcSubnets: defaultvpcSubnets, + ...options, + }; +} diff --git a/packages/aws-cdk-lib/aws-rds/lib/props.ts b/packages/aws-cdk-lib/aws-rds/lib/props.ts new file mode 100644 index 0000000000000..c13074b8c16e7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/lib/props.ts @@ -0,0 +1,544 @@ +import * as ec2 from '../../aws-ec2'; +import * as kms from '../../aws-kms'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { Duration, SecretValue } from '../../core'; +import { IParameterGroup } from './parameter-group'; + +/** + * Instance properties for database instances + */ +export interface InstanceProps { + /** + * What type of instance to start for the replicas. + * + * @default - t3.medium (or, more precisely, db.t3.medium) + */ + readonly instanceType?: ec2.InstanceType; + + /** + * What subnets to run the RDS instances in. + * + * Must be at least 2 subnets in two different AZs. + */ + readonly vpc: ec2.IVpc; + + /** + * Where to place the instances within the VPC + * + * @default - the Vpc default strategy if not specified. + */ + readonly vpcSubnets?: ec2.SubnetSelection; + + /** + * Security group. + * + * @default a new security group is created. + */ + readonly securityGroups?: ec2.ISecurityGroup[]; + + /** + * The DB parameter group to associate with the instance. + * + * @default no parameter group + */ + readonly parameterGroup?: IParameterGroup; + + /** + * The parameters in the DBParameterGroup to create automatically + * + * You can only specify parameterGroup or parameters but not both. + * You need to use a versioned engine to auto-generate a DBParameterGroup. + * + * @default - None + */ + readonly parameters?: { [key: string]: string }; + + /** + * Whether to enable Performance Insights for the DB instance. + * + * @default - false, unless ``performanceInsightRentention`` or ``performanceInsightEncryptionKey`` is set. + */ + readonly enablePerformanceInsights?: boolean; + + /** + * The amount of time, in days, to retain Performance Insights data. + * + * @default 7 + */ + readonly performanceInsightRetention?: PerformanceInsightRetention; + + /** + * The AWS KMS key for encryption of Performance Insights data. + * + * @default - default master key + */ + readonly performanceInsightEncryptionKey?: kms.IKey; + + /** + * Whether to enable automatic upgrade of minor version for the DB instance. + * + * @default - true + */ + readonly autoMinorVersionUpgrade?: boolean; + + /** + * Whether to allow upgrade of major version for the DB instance. + * + * @default - false + */ + readonly allowMajorVersionUpgrade?: boolean; + + /** + * Whether to remove automated backups immediately after the DB instance is deleted for the DB instance. + * + * @default - true + */ + readonly deleteAutomatedBackups?: boolean; + + /** + * Indicates whether the DB instance is an internet-facing instance. + * + * @default - `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise + */ + readonly publiclyAccessible?: boolean; +} + +/** + * Backup configuration for RDS databases + * + * @default - The retention period for automated backups is 1 day. + * The preferred backup window will be a 30-minute window selected at random + * from an 8-hour block of time for each AWS Region. + * @see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow + */ +export interface BackupProps { + + /** + * How many days to retain the backup + */ + readonly retention: Duration; + + /** + * A daily time range in 24-hours UTC format in which backups preferably execute. + * + * Must be at least 30 minutes long. + * + * Example: '01:00-02:00' + * + * @default - a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region. To see the time blocks available, see + * https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow + */ + readonly preferredWindow?: string; +} + +/** + * Base options for creating Credentials. + */ +export interface CredentialsBaseOptions { + /** + * The name of the secret. + * + * @default - A name is generated by CloudFormation. + */ + readonly secretName?: string; + + /** + * KMS encryption key to encrypt the generated secret. + * + * @default - default master key + */ + readonly encryptionKey?: kms.IKey; + + /** + * The characters to exclude from the generated password. + * Has no effect if `password` has been provided. + * + * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") + */ + readonly excludeCharacters?: string; + + /** + * A list of regions where to replicate this secret. + * + * @default - Secret is not replicated + */ + readonly replicaRegions?: secretsmanager.ReplicaRegion[]; +} + +/** + * Options for creating Credentials from a username. + */ +export interface CredentialsFromUsernameOptions extends CredentialsBaseOptions { + /** + * Password + * + * Do not put passwords in your CDK code directly. + * + * @default - a Secrets Manager generated password + */ + readonly password?: SecretValue; +} + +/** + * Username and password combination + */ +export abstract class Credentials { + /** + * Creates Credentials with a password generated and stored in Secrets Manager. + */ + public static fromGeneratedSecret(username: string, options: CredentialsBaseOptions = {}): Credentials { + return { + ...options, + username, + usernameAsString: true, + }; + } + + /** + * Creates Credentials from a password + * + * Do not put passwords in your CDK code directly. + */ + public static fromPassword(username: string, password: SecretValue): Credentials { + return { + username, + password, + usernameAsString: true, + }; + } + + /** + * Creates Credentials for the given username, and optional password and key. + * If no password is provided, one will be generated and stored in Secrets Manager. + */ + public static fromUsername(username: string, options: CredentialsFromUsernameOptions = {}): Credentials { + return { + ...options, + username, + }; + } + + /** + * Creates Credentials from an existing Secrets Manager ``Secret`` (or ``DatabaseSecret``) + * + * The Secret must be a JSON string with a ``username`` and ``password`` field: + * ``` + * { + * ... + * "username": , + * "password": , + * } + * ``` + * + * @param secret The secret where the credentials are stored + * @param username The username defined in the secret. If specified the username + * will be referenced as a string and not a dynamic reference to the username + * field in the secret. This allows to replace the secret without replacing the + * instance or cluster. + */ + public static fromSecret(secret: secretsmanager.ISecret, username?: string): Credentials { + return { + username: username ?? secret.secretValueFromJson('username').unsafeUnwrap(), + password: secret.secretValueFromJson('password'), + encryptionKey: secret.encryptionKey, + secret, + }; + } + + /** + * Username + */ + public abstract readonly username: string; + + /** + * The name to use for the Secret if a new Secret is to be generated in + * SecretsManager for these Credentials. + * + * @default - A name is generated by CloudFormation. + */ + public abstract readonly secretName?: string; + + /** + * Whether the username should be referenced as a string and not as a dynamic + * reference to the username in the secret. + * + * @default false + */ + public abstract readonly usernameAsString?: boolean; + + /** + * Password + * + * Do not put passwords in your CDK code directly. + * + * @default - a Secrets Manager generated password + */ + public abstract readonly password?: SecretValue; + + /** + * KMS encryption key to encrypt the generated secret. + * + * @default - default master key + */ + public abstract readonly encryptionKey?: kms.IKey; + + /** + * Secret used to instantiate this Login. + * + * @default - none + */ + public abstract readonly secret?: secretsmanager.ISecret; + + /** + * The characters to exclude from the generated password. + * Only used if `password` has not been set. + * + * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") + */ + public abstract readonly excludeCharacters?: string; + + /** + * A list of regions where to replicate the generated secret. + * + * @default - Secret is not replicated + */ + public abstract readonly replicaRegions?: secretsmanager.ReplicaRegion[]; +} + +/** + * Options used in the `SnapshotCredentials.fromGeneratedPassword` method. + */ +export interface SnapshotCredentialsFromGeneratedPasswordOptions { + /** + * KMS encryption key to encrypt the generated secret. + * + * @default - default master key + */ + readonly encryptionKey?: kms.IKey; + + /** + * The characters to exclude from the generated password. + * + * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") + */ + readonly excludeCharacters?: string; + + /** + * A list of regions where to replicate this secret. + * + * @default - Secret is not replicated + */ + readonly replicaRegions?: secretsmanager.ReplicaRegion[]; +} + +/** + * Credentials to update the password for a ``DatabaseInstanceFromSnapshot``. + */ +export abstract class SnapshotCredentials { + /** + * Generate a new password for the snapshot, using the existing username and an optional encryption key. + * The new credentials are stored in Secrets Manager. + * + * Note - The username must match the existing master username of the snapshot. + */ + public static fromGeneratedSecret(username: string, options: SnapshotCredentialsFromGeneratedPasswordOptions = {}): SnapshotCredentials { + return { + ...options, + generatePassword: true, + replaceOnPasswordCriteriaChanges: true, + username, + }; + } + + /** + * Generate a new password for the snapshot, using the existing username and an optional encryption key. + * + * Note - The username must match the existing master username of the snapshot. + * + * NOTE: use `fromGeneratedSecret()` for new Clusters and Instances. Switching from + * `fromGeneratedPassword()` to `fromGeneratedSecret()` for already deployed Clusters + * or Instances will update their master password. + */ + public static fromGeneratedPassword(username: string, options: SnapshotCredentialsFromGeneratedPasswordOptions = {}): SnapshotCredentials { + return { + ...options, + generatePassword: true, + username, + }; + } + + /** + * Update the snapshot login with an existing password. + */ + public static fromPassword(password: SecretValue): SnapshotCredentials { + return { generatePassword: false, password }; + } + + /** + * Update the snapshot login with an existing password from a Secret. + * + * The Secret must be a JSON string with a ``password`` field: + * ``` + * { + * ... + * "password": , + * } + * ``` + */ + public static fromSecret(secret: secretsmanager.ISecret): SnapshotCredentials { + return { + generatePassword: false, + password: secret.secretValueFromJson('password'), + secret, + }; + } + + /** + * The master user name. + * + * Must be the **current** master user name of the snapshot. + * It is not possible to change the master user name of a RDS instance. + * + * @default - the existing username from the snapshot + */ + public abstract readonly username?: string; + + /** + * Whether a new password should be generated. + */ + public abstract readonly generatePassword: boolean; + + /** + * Whether to replace the generated secret when the criteria for the password change. + * + * @default false + */ + public abstract readonly replaceOnPasswordCriteriaChanges?: boolean; + + /** + * The master user password. + * + * Do not put passwords in your CDK code directly. + * + * @default - the existing password from the snapshot + */ + public abstract readonly password?: SecretValue; + + /** + * KMS encryption key to encrypt the generated secret. + * + * @default - default master key + */ + public abstract readonly encryptionKey?: kms.IKey; + + /** + * Secret used to instantiate this Login. + * + * @default - none + */ + public abstract readonly secret?: secretsmanager.ISecret; + + /** + * The characters to exclude from the generated password. + * Only used if `generatePassword` if true. + * + * @default - the DatabaseSecret default exclude character set (" %+~`#$&*()|[]{}:;<>?!'/@\"\\") + */ + public abstract readonly excludeCharacters?: string; + + /** + * A list of regions where to replicate the generated secret. + * + * @default - Secret is not replicated + */ + public abstract readonly replicaRegions?: secretsmanager.ReplicaRegion[]; +} + +/** + * Properties common to single-user and multi-user rotation options. + */ +export interface CommonRotationUserOptions { + /** + * Specifies the number of days after the previous rotation + * before Secrets Manager triggers the next automatic rotation. + * + * @default - 30 days + */ + readonly automaticallyAfter?: Duration; + + /** + * Specifies characters to not include in generated passwords. + * + * @default " %+~`#$&*()|[]{}:;<>?!'/@\"\\" + */ + readonly excludeCharacters?: string; + + /** + * Where to place the rotation Lambda function + * + * @default - same placement as instance or cluster + */ + readonly vpcSubnets?: ec2.SubnetSelection; + + /** + * The VPC interface endpoint to use for the Secrets Manager API + * + * If you enable private DNS hostnames for your VPC private endpoint (the default), you don't + * need to specify an endpoint. The standard Secrets Manager DNS hostname the Secrets Manager + * CLI and SDKs use by default (https://secretsmanager..amazonaws.com) automatically + * resolves to your VPC endpoint. + * + * @default https://secretsmanager..amazonaws.com + */ + readonly endpoint?: ec2.IInterfaceVpcEndpoint; + + /** + * The security group for the Lambda rotation function + * + * @default - a new security group is created + */ + readonly securityGroup?: ec2.ISecurityGroup; +} + +/** + * Options to add the multi user rotation + */ +export interface RotationSingleUserOptions extends CommonRotationUserOptions { +} + +/** + * Options to add the multi user rotation + */ +export interface RotationMultiUserOptions extends CommonRotationUserOptions { + /** + * The secret to rotate. It must be a JSON string with the following format: + * ``` + * { + * "engine": , + * "host": , + * "username": , + * "password": , + * "dbname": , + * "port": , + * "masterarn": + * } + * ``` + */ + readonly secret: secretsmanager.ISecret; +} + +/** + * The retention period for Performance Insight. + */ +export enum PerformanceInsightRetention { + /** + * Default retention period of 7 days. + */ + DEFAULT = 7, + + /** + * Long term retention period of 2 years. + */ + LONG_TERM = 731 +} diff --git a/packages/@aws-cdk/aws-rds/lib/proxy.ts b/packages/aws-cdk-lib/aws-rds/lib/proxy.ts similarity index 98% rename from packages/@aws-cdk/aws-rds/lib/proxy.ts rename to packages/aws-cdk-lib/aws-rds/lib/proxy.ts index 3632267542f89..b49f994e92494 100644 --- a/packages/@aws-cdk/aws-rds/lib/proxy.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/proxy.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { IDatabaseCluster } from './cluster-ref'; import { IEngine } from './engine'; diff --git a/packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts b/packages/aws-cdk-lib/aws-rds/lib/serverless-cluster.ts similarity index 98% rename from packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts rename to packages/aws-cdk-lib/aws-rds/lib/serverless-cluster.ts index f17ffdaf34d07..b7ebd199c8bc6 100644 --- a/packages/@aws-cdk/aws-rds/lib/serverless-cluster.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/serverless-cluster.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Resource, Duration, Token, Annotations, RemovalPolicy, IResource, Stack, Lazy, FeatureFlags, ArnFormat } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { Resource, Duration, Token, Annotations, RemovalPolicy, IResource, Stack, Lazy, FeatureFlags, ArnFormat } from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { IClusterEngine } from './cluster-engine'; import { DatabaseSecret } from './database-secret'; diff --git a/packages/@aws-cdk/aws-rds/lib/subnet-group.ts b/packages/aws-cdk-lib/aws-rds/lib/subnet-group.ts similarity index 95% rename from packages/@aws-cdk/aws-rds/lib/subnet-group.ts rename to packages/aws-cdk-lib/aws-rds/lib/subnet-group.ts index 1bc903331bcf3..215509090d6a2 100644 --- a/packages/@aws-cdk/aws-rds/lib/subnet-group.ts +++ b/packages/aws-cdk-lib/aws-rds/lib/subnet-group.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { IResource, RemovalPolicy, Resource, Token } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import { IResource, RemovalPolicy, Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { CfnDBSubnetGroup } from './rds.generated'; diff --git a/packages/@aws-cdk/aws-rds/test/cluster-engine.test.ts b/packages/aws-cdk-lib/aws-rds/test/cluster-engine.test.ts similarity index 100% rename from packages/@aws-cdk/aws-rds/test/cluster-engine.test.ts rename to packages/aws-cdk-lib/aws-rds/test/cluster-engine.test.ts diff --git a/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts b/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts new file mode 100644 index 0000000000000..c94632e3d23df --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/test/cluster.test.ts @@ -0,0 +1,2756 @@ +import { Annotations, Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import { ManagedPolicy, Role, ServicePrincipal } from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import { + AuroraEngineVersion, AuroraMysqlEngineVersion, AuroraPostgresEngineVersion, CfnDBCluster, Credentials, DatabaseCluster, + DatabaseClusterEngine, DatabaseClusterFromSnapshot, ParameterGroup, PerformanceInsightRetention, SubnetGroup, DatabaseSecret, + DatabaseInstanceEngine, SqlServerEngineVersion, SnapshotCredentials, InstanceUpdateBehaviour, NetworkType, +} from '../lib'; + +describe('cluster', () => { + test('creating a Cluster also creates 2 DB Instances', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + iamAuthentication: true, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { + Properties: { + Engine: 'aurora', + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + MasterUsername: 'admin', + MasterUserPassword: 'tooshort', + VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], + EnableIAMDatabaseAuthentication: true, + CopyTagsToSnapshot: true, + }, + DeletionPolicy: 'Snapshot', + UpdateReplacePolicy: 'Snapshot', + }); + + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBInstance', 2); + Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { + DeletionPolicy: 'Delete', + UpdateReplacePolicy: 'Delete', + }); + }); + + test('validates that the number of instances is not a deploy-time value', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const parameter = new cdk.CfnParameter(stack, 'Param', { type: 'Number' }); + + expect(() => { + new DatabaseCluster(stack, 'Database', { + instances: parameter.valueAsNumber, + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + }, + }); + }).toThrow('The number of instances an RDS Cluster consists of cannot be provided as a deploy-time only value!'); + }); + + test('can create a cluster with a single instance', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + Engine: 'aurora', + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + MasterUsername: 'admin', + MasterUserPassword: 'tooshort', + VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], + }); + + expect(stack.resolve(cluster.clusterResourceIdentifier)).toEqual({ 'Fn::GetAtt': ['DatabaseB269D8BB', 'DBClusterResourceId'] }); + expect(cluster.instanceIdentifiers).toHaveLength(1); + expect(stack.resolve(cluster.instanceIdentifiers[0])).toEqual({ + Ref: 'DatabaseInstance1844F58FD', + }); + + expect(cluster.instanceEndpoints).toHaveLength(1); + expect(stack.resolve(cluster.instanceEndpoints[0])).toEqual({ + hostname: { + 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'], + }, + port: { + 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'], + }, + socketAddress: { + 'Fn::Join': ['', [ + { 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'] }, + ':', + { 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'] }, + ]], + }, + }); + }); + + test('can create a cluster with ROLLING instance update behaviour', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 5, + instanceProps: { + vpc, + }, + instanceUpdateBehaviour: InstanceUpdateBehaviour.ROLLING, + }); + + // THEN + const instanceResources = Template.fromStack(stack).findResources('AWS::RDS::DBInstance'); + const instances = Object.keys(instanceResources); + const instanceDependencies = Object.values(instanceResources) + .map(properties => (properties.DependsOn as string[]).filter(dependency => instances.includes(dependency))); + // check that there are only required dependencies to form a chain of dependant instances + for (const dependencies of instanceDependencies) { + expect(dependencies.length).toBeLessThanOrEqual(1); + } + // check that all but one instance are a dependency of another instance + const dependantInstances = instanceDependencies.flat(); + expect(dependantInstances).toHaveLength(instances.length - 1); + expect(instances.filter(it => !dependantInstances.includes(it))).toHaveLength(1); + }); + + test('can create a cluster with imported vpc and security group', () => { + // GIVEN + const stack = testStack(); + const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { + vpcId: 'VPC12345', + }); + const sg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'SecurityGroupId12345'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + securityGroups: [sg], + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + Engine: 'aurora', + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + MasterUsername: 'admin', + MasterUserPassword: 'tooshort', + VpcSecurityGroupIds: ['SecurityGroupId12345'], + }); + }); + + test('cluster with parameter group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const group = new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'bye', + parameters: { + param: 'value', + }, + }); + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + parameterGroup: group, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DBClusterParameterGroupName: { Ref: 'ParamsA8366201' }, + }); + }); + + test("sets the retention policy of the SubnetGroup to 'Retain' if the Cluster is created with 'Retain'", () => { + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc'); + + new DatabaseCluster(stack, 'Cluster', { + credentials: { username: 'admin' }, + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), + vpc, + }, + removalPolicy: cdk.RemovalPolicy.RETAIN, + }); + + Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }); + }); + + test('creates a secret when master credentials are not specified', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + excludeCharacters: '"@/\\', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + MasterUsername: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DatabaseSecret3B817195', + }, + ':SecretString:username::}}', + ], + ], + }, + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DatabaseSecret3B817195', + }, + ':SecretString:password::}}', + ], + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: { + ExcludeCharacters: '\"@/\\', + GenerateStringKey: 'password', + PasswordLength: 30, + SecretStringTemplate: '{"username":"admin"}', + }, + }); + }); + + test('create an encrypted cluster with custom KMS key', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + storageEncryptionKey: new kms.Key(stack, 'Key'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + KmsKeyId: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + }); + }); + + test('cluster with instance parameter group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { + engine: DatabaseClusterEngine.AURORA, + parameters: { + key: 'value', + }, + }); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + parameterGroup, + vpc, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'ParameterGroup5E32DECB', + }, + }); + }); + + test('cluster with inline parameter group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + parameters: { + locks: '100', + }, + instanceProps: { + vpc, + parameters: { + locks: '200', + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DBClusterParameterGroupName: { + Ref: 'DatabaseParameterGroup2A921026', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + locks: '100', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'DatabaseInstanceParameterGroup6968C5BF', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBParameterGroup', { + Family: 'aurora5.6', + Parameters: { + locks: '200', + }, + }); + }); + + test('cluster with inline parameter group and parameterGroup arg fails', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { + engine: DatabaseInstanceEngine.sqlServerEe({ + version: SqlServerEngineVersion.VER_11, + }), + parameters: { + locks: '50', + }, + }); + + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + parameters: { + locks: '100', + }, + parameterGroup, + instanceProps: { + vpc, + parameters: { + locks: '200', + }, + }, + }); + }).toThrow(/You cannot specify both parameterGroup and parameters/); + }); + + test('instance with inline parameter group and parameterGroup arg fails', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { + engine: DatabaseInstanceEngine.sqlServerEe({ + version: SqlServerEngineVersion.VER_11, + }), + parameters: { + locks: '50', + }, + }); + + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + parameters: { + locks: '100', + }, + instanceProps: { + vpc, + parameterGroup, + parameters: { + locks: '200', + }, + }, + }); + }).toThrow(/You cannot specify both parameterGroup and parameters/); + }); + + test('instance with IPv4 network type', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + vpc, + }, + networkType: NetworkType.IPV4, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + NetworkType: 'IPV4', + }); + }); + + test('instance with dual-stack network type', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + vpc, + }, + networkType: NetworkType.DUAL, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + NetworkType: 'DUAL', + }); + }); + + describe('performance insights', () => { + test('cluster with all performance insights properties', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + }, + instanceProps: { + vpc, + enablePerformanceInsights: true, + performanceInsightRetention: PerformanceInsightRetention.LONG_TERM, + performanceInsightEncryptionKey: new kms.Key(stack, 'Key'), + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EnablePerformanceInsights: true, + PerformanceInsightsRetentionPeriod: 731, + PerformanceInsightsKMSKeyId: { 'Fn::GetAtt': ['Key961B73FD', 'Arn'] }, + }); + }); + + test('setting performance insights fields enables performance insights', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + }, + instanceProps: { + vpc, + performanceInsightRetention: PerformanceInsightRetention.LONG_TERM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EnablePerformanceInsights: true, + PerformanceInsightsRetentionPeriod: 731, + }); + }); + + test('throws if performance insights fields are set but performance insights is disabled', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + }, + instanceProps: { + vpc, + enablePerformanceInsights: false, + performanceInsightRetention: PerformanceInsightRetention.DEFAULT, + }, + }); + }).toThrow(/`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set/); + }); + }); + + test('cluster with disable automatic upgrade of minor version', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + autoMinorVersionUpgrade: false, + vpc, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + AutoMinorVersionUpgrade: false, + }); + }); + + test('cluster with allow upgrade of major version', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + allowMajorVersionUpgrade: true, + vpc, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + AllowMajorVersionUpgrade: true, + }); + }); + + test('cluster with disallow remove backups', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + deleteAutomatedBackups: false, + vpc, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DeleteAutomatedBackups: false, + }); + }); + + test('create a cluster using a specific version of MySQL', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraMysql({ + version: AuroraMysqlEngineVersion.VER_2_04_4, + }), + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + Engine: 'aurora-mysql', + EngineVersion: '5.7.mysql_aurora.2.04.4', + }); + }); + + test('create a cluster using a specific version of Postgresql', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_10_7, + }), + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + Engine: 'aurora-postgresql', + EngineVersion: '10.7', + }); + }); + + test('cluster exposes different read and write endpoints', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + expect(stack.resolve(cluster.clusterEndpoint)).not.toEqual(stack.resolve(cluster.clusterReadEndpoint)); + }); + + test('imported cluster with imported security group honors allowAllOutbound', () => { + // GIVEN + const stack = testStack(); + + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterEndpointAddress: 'addr', + clusterIdentifier: 'identifier', + instanceEndpointAddresses: ['addr'], + instanceIdentifiers: ['identifier'], + port: 3306, + readerEndpointAddress: 'reader-address', + securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + })], + }); + + // WHEN + cluster.connections.allowToAnyIpv4(ec2.Port.tcp(443)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: 'sg-123456789', + }); + }); + + test('can import a cluster with minimal attributes', () => { + const stack = testStack(); + + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterIdentifier: 'identifier', + }); + + expect(cluster.clusterIdentifier).toEqual('identifier'); + }); + + test('minimal imported cluster throws on accessing attributes for unprovided parameters', () => { + const stack = testStack(); + + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterIdentifier: 'identifier', + }); + + expect(() => cluster.clusterResourceIdentifier).toThrow(/Cannot access `clusterResourceIdentifier` of an imported cluster/); + expect(() => cluster.clusterEndpoint).toThrow(/Cannot access `clusterEndpoint` of an imported cluster/); + expect(() => cluster.clusterReadEndpoint).toThrow(/Cannot access `clusterReadEndpoint` of an imported cluster/); + expect(() => cluster.instanceIdentifiers).toThrow(/Cannot access `instanceIdentifiers` of an imported cluster/); + expect(() => cluster.instanceEndpoints).toThrow(/Cannot access `instanceEndpoints` of an imported cluster/); + }); + + test('imported cluster can access properties if attributes are provided', () => { + const stack = testStack(); + + const cluster = DatabaseCluster.fromDatabaseClusterAttributes(stack, 'Database', { + clusterEndpointAddress: 'addr', + clusterIdentifier: 'identifier', + clusterResourceIdentifier: 'identifier', + instanceEndpointAddresses: ['instance-addr'], + instanceIdentifiers: ['identifier'], + port: 3306, + readerEndpointAddress: 'reader-address', + securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + })], + }); + + expect(cluster.clusterResourceIdentifier).toEqual('identifier'); + expect(cluster.clusterEndpoint.socketAddress).toEqual('addr:3306'); + expect(cluster.clusterReadEndpoint.socketAddress).toEqual('reader-address:3306'); + expect(cluster.instanceIdentifiers).toEqual(['identifier']); + expect(cluster.instanceEndpoints.map(endpoint => endpoint.socketAddress)).toEqual(['instance-addr:3306']); + }); + + test('cluster supports metrics', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_02_0 }), + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + vpc, + }, + }); + + expect(stack.resolve(cluster.metricCPUUtilization())).toEqual({ + dimensions: { DBClusterIdentifier: { Ref: 'DatabaseB269D8BB' } }, + namespace: 'AWS/RDS', + metricName: 'CPUUtilization', + period: cdk.Duration.minutes(5), + statistic: 'Average', + account: '12345', + region: 'us-test-1', + }); + }); + + test('cluster with enabled monitoring', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + monitoringInterval: cdk.Duration.minutes(1), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['DatabaseMonitoringRole576991DA', 'Arn'], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', + ], + ], + }, + ], + }); + }); + + test('create a cluster with imported monitoring role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const monitoringRole = new Role(stack, 'MonitoringRole', { + assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicies: [ + ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), + ], + }); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + monitoringInterval: cdk.Duration.minutes(1), + monitoringRole, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['MonitoringRole90457BF9', 'Arn'], + }, + }); + }); + + test('addRotationSingleUser()', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // WHEN + cluster.addRotationSingleUser(); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { + Ref: 'DatabaseSecretAttachmentE5D1B020', + }, + RotationLambdaARN: { + 'Fn::GetAtt': [ + 'DatabaseRotationSingleUser65F55654', + 'Outputs.RotationLambdaARN', + ], + }, + RotationRules: { + AutomaticallyAfterDays: 30, + }, + }); + }); + + test('addRotationMultiUser()', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + const userSecret = new DatabaseSecret(stack, 'UserSecret', { username: 'user' }); + cluster.addRotationMultiUser('user', { secret: userSecret.attach(cluster) }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { + Ref: 'UserSecretAttachment16ACBE6D', + }, + RotationLambdaARN: { + 'Fn::GetAtt': [ + 'DatabaseuserECD1FB0C', + 'Outputs.RotationLambdaARN', + ], + }, + RotationRules: { + AutomaticallyAfterDays: 30, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + masterSecretArn: { + Ref: 'DatabaseSecretAttachmentE5D1B020', + }, + }, + }); + }); + + test('addRotationSingleUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { + vpcId: 'vpc-id', + availabilityZones: ['az1'], + publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], + publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], + privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], + privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], + isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], + isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], + }); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc: vpcWithIsolated, + }); + + // WHEN + // DB in isolated subnet (no internet connectivity) + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc: vpcWithIsolated, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }, + }); + + // Rotation in private subnet (internet via NAT) + cluster.addRotationSingleUser({ + automaticallyAfter: cdk.Duration.days(15), + excludeCharacters: '°_@', + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + securityGroup, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + RotationRules: { + AutomaticallyAfterDays: 15, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + endpoint: { + 'Fn::Join': ['', [ + 'https://secretsmanager.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', + excludeCharacters: '°_@', + vpcSecurityGroupIds: { + 'Fn::GetAtt': [ + stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), + 'GroupId', + ], + }, + }, + }); + }); + + test('addRotationMultiUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { + vpcId: 'vpc-id', + availabilityZones: ['az1'], + publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], + publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], + privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], + privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], + isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], + isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], + }); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc: vpcWithIsolated, + }); + const userSecret = new DatabaseSecret(stack, 'UserSecret', { username: 'user' }); + + // WHEN + // DB in isolated subnet (no internet connectivity) + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc: vpcWithIsolated, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }, + }); + + // Rotation in private subnet (internet via NAT) + cluster.addRotationMultiUser('user', { + secret: userSecret.attach(cluster), + automaticallyAfter: cdk.Duration.days(15), + excludeCharacters: '°_@', + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + securityGroup, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + RotationRules: { + AutomaticallyAfterDays: 15, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + endpoint: { + 'Fn::Join': ['', [ + 'https://secretsmanager.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', + excludeCharacters: '°_@', + vpcSecurityGroupIds: { + 'Fn::GetAtt': [ + stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), + 'GroupId', + ], + }, + }, + }); + }); + + test('addRotationSingleUser() with VPC interface endpoint', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpcIsolatedOnly = new ec2.Vpc(stack, 'Vpc', { natGateways: 0 }); + + const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { + service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, + vpc: vpcIsolatedOnly, + subnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }); + + // DB in isolated subnet (no internet connectivity) + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc: vpcIsolatedOnly, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }, + }); + + // Rotation in isolated subnet with access to Secrets Manager API via endpoint + cluster.addRotationSingleUser({ endpoint }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + endpoint: { + 'Fn::Join': ['', [ + 'https://', + { Ref: 'EndpointEEF1FD8F' }, + '.secretsmanager.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + functionName: 'DatabaseRotationSingleUser458A45BE', + vpcSubnetIds: { + 'Fn::Join': ['', [ + { Ref: 'VpcIsolatedSubnet1SubnetE48C5737' }, + ',', + { Ref: 'VpcIsolatedSubnet2Subnet16364B91' }, + ]], + }, + vpcSecurityGroupIds: { + 'Fn::GetAtt': [ + 'DatabaseRotationSingleUserSecurityGroupAC6E0E73', + 'GroupId', + ], + }, + excludeCharacters: " %+~`#$&*()|[]{}:;<>?!'/@\"\\", + }, + }); + }); + + test('throws when trying to add rotation to a cluster without secret', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + expect(() => cluster.addRotationSingleUser()).toThrow(/without a secret/); + }); + + test('throws when trying to add single user rotation multiple times', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + credentials: { username: 'admin' }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // WHEN + cluster.addRotationSingleUser(); + + // THEN + expect(() => cluster.addRotationSingleUser()).toThrow(/A single user rotation was already added to this cluster/); + }); + + test('create a cluster with s3 import role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const associatedRole = new Role(stack, 'AssociatedRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ImportRole: associatedRole, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'AssociatedRole824CFCD3', + 'Arn', + ], + }, + }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + aurora_load_from_s3_role: { + 'Fn::GetAtt': [ + 'AssociatedRole824CFCD3', + 'Arn', + ], + }, + }, + }); + }); + + test('create a cluster with s3 import buckets', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ImportBuckets: [bucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + aurora_load_from_s3_role: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + Effect: 'Allow', + Resource: [ + { + 'Fn::GetAtt': [ + 'Bucket83908E77', + 'Arn', + ], + }, + { + 'Fn::Join': [ + '', + [ + { + 'Fn::GetAtt': [ + 'Bucket83908E77', + 'Arn', + ], + }, + '/*', + ], + ], + }, + ], + }, + ], + Version: '2012-10-17', + }, + }); + }); + + test('cluster with s3 import bucket adds supported feature name to IAM role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_10_12, + }), + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ImportBuckets: [bucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + FeatureName: 's3Import', + }], + }); + }); + + test('throws when s3 import bucket or s3 export bucket is supplied for a Postgres version that does not support it', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN / THEN + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_10_4, + }), + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ImportBuckets: [bucket], + }); + }).toThrow(/s3Import is not supported for Postgres version: 10.4. Use a version that supports the s3Import feature./); + + expect(() => { + new DatabaseCluster(stack, 'AnotherDatabase', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_10_4, + }), + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ExportBuckets: [bucket], + }); + }).toThrow(/s3Export is not supported for Postgres version: 10.4. Use a version that supports the s3Export feature./); + }); + + test('cluster with s3 export bucket adds supported feature name to IAM role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_10_12, + }), + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ExportBuckets: [bucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + FeatureName: 's3Export', + }], + }); + }); + + test('create a cluster with s3 export role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const associatedRole = new Role(stack, 'AssociatedRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ExportRole: associatedRole, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'AssociatedRole824CFCD3', + 'Arn', + ], + }, + }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + aurora_select_into_s3_role: { + 'Fn::GetAtt': [ + 'AssociatedRole824CFCD3', + 'Arn', + ], + }, + }, + }); + }); + + test('create a cluster with s3 export buckets', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ExportBuckets: [bucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + aurora_select_into_s3_role: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Resource: [ + { + 'Fn::GetAtt': [ + 'Bucket83908E77', + 'Arn', + ], + }, + { + 'Fn::Join': [ + '', + [ + { + 'Fn::GetAtt': [ + 'Bucket83908E77', + 'Arn', + ], + }, + '/*', + ], + ], + }, + ], + }, + ], + Version: '2012-10-17', + }, + }); + }); + + test('create a cluster with s3 import and export buckets', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const importBucket = new s3.Bucket(stack, 'ImportBucket'); + const exportBucket = new s3.Bucket(stack, 'ExportBucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ImportBuckets: [importBucket], + s3ExportBuckets: [exportBucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + }, + { + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + aurora_load_from_s3_role: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + aurora_select_into_s3_role: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }, + }); + }); + + test('create a cluster with s3 import and export buckets and custom parameter group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { + engine: DatabaseClusterEngine.AURORA, + parameters: { + key: 'value', + }, + }); + + const importBucket = new s3.Bucket(stack, 'ImportBucket'); + const exportBucket = new s3.Bucket(stack, 'ExportBucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + parameterGroup, + s3ImportBuckets: [importBucket], + s3ExportBuckets: [exportBucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + }, + { + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora5.6', + Parameters: { + key: 'value', + aurora_load_from_s3_role: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + aurora_select_into_s3_role: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }, + }); + }); + + test('PostgreSQL cluster with s3 export buckets does not generate custom parameter group and specifies the correct port', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_11_6, + }), + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ExportBuckets: [bucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [{ + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }], + DBClusterParameterGroupName: 'default.aurora-postgresql11', + Port: 5432, + }); + + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 0); + }); + + test('unversioned PostgreSQL cluster can be used with s3 import and s3 export buckets', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const bucket = new s3.Bucket(stack, 'Bucket'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_POSTGRESQL, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + parameterGroup: ParameterGroup.fromParameterGroupName(stack, 'ParameterGroup', 'default.aurora-postgresql11'), + s3ImportBuckets: [bucket], + s3ExportBuckets: [bucket], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + AssociatedRoles: [ + { + FeatureName: 's3Import', + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ImportRole377BC9C0', + 'Arn', + ], + }, + }, + { + FeatureName: 's3Export', + RoleArn: { + 'Fn::GetAtt': [ + 'DatabaseS3ExportRole9E328562', + 'Arn', + ], + }, + }, + ], + }); + }); + + test("Aurora PostgreSQL cluster uses a different default master username than 'admin', which is a reserved word", () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ + version: AuroraPostgresEngineVersion.VER_9_6_12, + }), + instanceProps: { vpc }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: { + SecretStringTemplate: '{"username":"postgres"}', + }, + }); + }); + + test('MySQL cluster without S3 exports or imports references the correct default ParameterGroup', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA_MYSQL, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DBClusterParameterGroupName: 'default.aurora-mysql5.7', + }); + + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 0); + }); + + test('MySQL cluster in version 8.0 uses aws_default_s3_role as a Parameter for S3 import/export, instead of aurora_load/select_from_s3_role', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + instanceProps: { vpc }, + engine: DatabaseClusterEngine.auroraMysql({ version: AuroraMysqlEngineVersion.VER_3_01_0 }), + s3ImportBuckets: [new s3.Bucket(stack, 'ImportBucket')], + s3ExportBuckets: [new s3.Bucket(stack, 'ExportBucket')], + }); + + const assert = Template.fromStack(stack); + assert.hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Family: 'aurora-mysql8.0', + Parameters: { + aws_default_s3_role: { + 'Fn::GetAtt': ['DatabaseS3ImportRole377BC9C0', 'Arn'], + }, + aurora_load_from_s3_role: Match.absent(), + aurora_select_into_s3_role: Match.absent(), + }, + }); + assert.resourceCountIs('AWS::IAM::Role', 1); + }); + + test('throws when s3ExportRole and s3ExportBuckets properties are both specified', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const exportRole = new Role(stack, 'ExportRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + const exportBucket = new s3.Bucket(stack, 'ExportBucket'); + + // THEN + expect(() => new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ExportRole: exportRole, + s3ExportBuckets: [exportBucket], + })).toThrow(); + }); + + test('throws when s3ImportRole and s3ImportBuckets properties are both specified', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const importRole = new Role(stack, 'ImportRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + const importBucket = new s3.Bucket(stack, 'ImportBucket'); + + // THEN + expect(() => new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + s3ImportRole: importRole, + s3ImportBuckets: [importBucket], + })).toThrow(); + }); + + test('can set CloudWatch log exports', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + EnableCloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit'], + }); + }); + + test('can set CloudWatch log retention', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + cloudwatchLogsExports: ['error', 'general'], + cloudwatchLogsRetention: logs.RetentionDays.THREE_MONTHS, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { + ServiceToken: { + 'Fn::GetAtt': [ + 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', + 'Arn', + ], + }, + LogGroupName: { 'Fn::Join': ['', ['/aws/rds/cluster/', { Ref: 'DatabaseB269D8BB' }, '/error']] }, + RetentionInDays: 90, + }); + Template.fromStack(stack).hasResourceProperties('Custom::LogRetention', { + ServiceToken: { + 'Fn::GetAtt': [ + 'LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A', + 'Arn', + ], + }, + LogGroupName: { 'Fn::Join': ['', ['/aws/rds/cluster/', { Ref: 'DatabaseB269D8BB' }, '/general']] }, + RetentionInDays: 90, + }); + }); + + test('throws if given unsupported CloudWatch log exports', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + expect(() => { + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + cloudwatchLogsExports: ['error', 'general', 'slowquery', 'audit', 'thislogdoesnotexist', 'neitherdoesthisone'], + }); + }).toThrow(/Unsupported logs for the current engine type: thislogdoesnotexist,neitherdoesthisone/); + }); + + test('can set deletion protection', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + credentials: { + username: 'admin', + password: cdk.SecretValue.unsafePlainText('tooshort'), + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }, + deletionProtection: true, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DeletionProtection: true, + }); + }); + + test('does not throw (but adds a node error) if a (dummy) VPC does not have sufficient subnets', () => { + // GIVEN + const app = new cdk.App(); + const stack = testStack(app, 'TestStack'); + const vpc = ec2.Vpc.fromLookup(stack, 'VPC', { isDefault: true }); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instances: 1, + credentials: { + username: 'admin', + }, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + vpcSubnets: { + subnetName: 'DefinitelyDoesNotExist', + }, + }, + }); + + // THEN + const art = app.synth().getStackArtifact('TestStack'); + const meta = art.findMetadataByType('aws:cdk:error'); + expect(meta[0].data).toEqual('Cluster requires at least 2 subnets, got 0'); + }); + + test('create a cluster from a snapshot', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + iamAuthentication: true, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { + Properties: { + Engine: 'aurora', + EngineVersion: '5.6.mysql_aurora.1.22.2', + DBSubnetGroupName: { Ref: 'DatabaseSubnets56F17B9A' }, + VpcSecurityGroupIds: [{ 'Fn::GetAtt': ['DatabaseSecurityGroup5C91FDCB', 'GroupId'] }], + SnapshotIdentifier: 'mySnapshot', + EnableIAMDatabaseAuthentication: true, + CopyTagsToSnapshot: true, + }, + DeletionPolicy: 'Snapshot', + UpdateReplacePolicy: 'Snapshot', + }); + + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBInstance', 2); + + expect(stack.resolve(cluster.clusterResourceIdentifier)).toEqual({ 'Fn::GetAtt': ['DatabaseB269D8BB', 'DBClusterResourceId'] }); + expect(cluster.instanceIdentifiers).toHaveLength(2); + expect(stack.resolve(cluster.instanceIdentifiers[0])).toEqual({ + Ref: 'DatabaseInstance1844F58FD', + }); + + expect(cluster.instanceEndpoints).toHaveLength(2); + expect(stack.resolve(cluster.instanceEndpoints[0])).toEqual({ + hostname: { + 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'], + }, + port: { + 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'], + }, + socketAddress: { + 'Fn::Join': ['', [ + { 'Fn::GetAtt': ['DatabaseInstance1844F58FD', 'Endpoint.Address'] }, + ':', + { 'Fn::GetAtt': ['DatabaseB269D8BB', 'Endpoint.Port'] }, + ]], + }, + }); + + Annotations.fromStack(stack).hasWarning('/Default/Database', Match.stringLikeRegexp('Generated credentials will not be applied to cluster')); + }); + + test('can generate a new snapshot password', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + snapshotCredentials: SnapshotCredentials.fromGeneratedSecret('admin', { + excludeCharacters: '"@/\\', + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + MasterUsername: Match.absent(), + MasterUserPassword: { + 'Fn::Join': ['', [ + '{{resolve:secretsmanager:', + { Ref: 'DatabaseSnapshotSecret2B5748BB8ee0a797cad8a68dbeb85f8698cdb5bb' }, + ':SecretString:password::}}', + ]], + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Description: { + 'Fn::Join': ['', ['Generated by the CDK for stack: ', { Ref: 'AWS::StackName' }]], + }, + GenerateSecretString: { + ExcludeCharacters: '\"@/\\', + GenerateStringKey: 'password', + PasswordLength: 30, + SecretStringTemplate: '{"username":"admin"}', + }, + }); + }); + + test('fromGeneratedSecret with replica regions', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + snapshotCredentials: SnapshotCredentials.fromGeneratedSecret('admin', { + replicaRegions: [{ region: 'eu-west-1' }], + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + ReplicaRegions: [ + { + Region: 'eu-west-1', + }, + ], + }); + }); + + test('throws if generating a new password without a username', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + expect(() => new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + snapshotCredentials: { generatePassword: true }, + })).toThrow(/`snapshotCredentials` `username` must be specified when `generatePassword` is set to true/); + }); + + test('can set a new snapshot password from an existing Secret', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const secret = new DatabaseSecret(stack, 'DBSecret', { + username: 'admin', + encryptionKey: new kms.Key(stack, 'PasswordKey'), + }); + new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + snapshotCredentials: SnapshotCredentials.fromSecret(secret), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + MasterUsername: Match.absent(), + MasterUserPassword: { + 'Fn::Join': ['', ['{{resolve:secretsmanager:', { Ref: 'DBSecretD58955BC' }, ':SecretString:password::}}']], + }, + }); + }); + + test('create a cluster from a snapshot with encrypted storage', () => { + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + storageEncryptionKey: kms.Key.fromKeyArn(stack, 'Key', 'arn:aws:kms:us-east-1:456:key/my-key'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + KmsKeyId: 'arn:aws:kms:us-east-1:456:key/my-key', + StorageEncrypted: true, + }); + }); + + test('create a cluster from a snapshot with single user secret rotation', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + }); + + // WHEN + cluster.addRotationSingleUser(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + RotationRules: { + AutomaticallyAfterDays: 30, + }, + }); + }); + + test('throws when trying to add single user rotation multiple times on cluster from snapshot', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + }); + + // WHEN + cluster.addRotationSingleUser(); + + // THEN + expect(() => cluster.addRotationSingleUser()).toThrow(/A single user rotation was already added to this cluster/); + }); + + test('create a cluster from a snapshot with multi user secret rotation', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const cluster = new DatabaseClusterFromSnapshot(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + instanceProps: { + vpc, + }, + snapshotIdentifier: 'mySnapshot', + }); + + // WHEN + const userSecret = new DatabaseSecret(stack, 'UserSecret', { username: 'user' }); + cluster.addRotationMultiUser('user', { secret: userSecret.attach(cluster) }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { + Ref: 'UserSecretAttachment16ACBE6D', + }, + RotationLambdaARN: { + 'Fn::GetAtt': [ + 'DatabaseuserECD1FB0C', + 'Outputs.RotationLambdaARN', + ], + }, + RotationRules: { + AutomaticallyAfterDays: 30, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + masterSecretArn: { + Ref: 'DatabaseSecretAttachmentE5D1B020', + }, + }, + }); + }); + + test('reuse an existing subnet group', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + credentials: { + username: 'admin', + }, + instanceProps: { + vpc, + }, + subnetGroup: SubnetGroup.fromSubnetGroupName(stack, 'SubnetGroup', 'my-subnet-group'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DBSubnetGroupName: 'my-subnet-group', + }); + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBSubnetGroup', 0); + }); + + test('defaultChild returns the DB Cluster', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const cluster = new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + credentials: { + username: 'admin', + }, + instanceProps: { + vpc, + }, + }); + + // THEN + expect(cluster.node.defaultChild instanceof CfnDBCluster).toBeTruthy(); + }); + + test('fromGeneratedSecret', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + credentials: Credentials.fromGeneratedSecret('admin'), + instanceProps: { + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + MasterUsername: 'admin', // username is a string + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DatabaseSecretC9203AE33fdaad7efa858a3daf9490cf0a702aeb', // logical id is a hash + }, + ':SecretString:password::}}', + ], + ], + }, + }); + }); + + test('fromGeneratedSecret with replica regions', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + credentials: Credentials.fromGeneratedSecret('admin', { + replicaRegions: [{ region: 'eu-west-1' }], + }), + instanceProps: { + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + ReplicaRegions: [ + { + Region: 'eu-west-1', + }, + ], + }); + }); + + test('can set custom name to database secret by fromSecret', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const secretName = 'custom-secret-name'; + const secret = new DatabaseSecret(stack, 'Secret', { + username: 'admin', + secretName, + } ); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + credentials: Credentials.fromSecret(secret), + instanceProps: { + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Name: secretName, + }); + }); + + test('can set custom name to database secret by fromGeneratedSecret', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const secretName = 'custom-secret-name'; + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.aurora({ version: AuroraEngineVersion.VER_1_22_2 }), + credentials: Credentials.fromGeneratedSecret('admin', { secretName }), + instanceProps: { + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Name: secretName, + }); + }); + + test('can set public accessibility for database cluster with instances in private subnet', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + publiclyAccessible: true, + }, + }); + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Engine: 'aurora', + PubliclyAccessible: true, + }); + }); + + test('can set public accessibility for database cluster with instances in public subnet', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + publiclyAccessible: false, + }, + }); + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Engine: 'aurora', + PubliclyAccessible: false, + }); + }); + + test('database cluster instances in public subnet should by default have publiclyAccessible set to true', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + }, + }); + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Engine: 'aurora', + PubliclyAccessible: true, + }); + }); + + test('changes the case of the cluster identifier', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const clusterIdentifier = 'TestClusterIdentifier'; + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { vpc }, + clusterIdentifier, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DBClusterIdentifier: clusterIdentifier.toLowerCase(), + }); + }); + + test('does not changes the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled', () => { + // GIVEN + const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } }); + const stack = testStack(app); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const clusterIdentifier = 'TestClusterIdentifier'; + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { vpc }, + clusterIdentifier, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + DBClusterIdentifier: clusterIdentifier, + }); + }); + + test('cluster with copyTagsToSnapshot default', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + CopyTagsToSnapshot: true, + }); + }); + + test('cluster with copyTagsToSnapshot disabled', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + }, + copyTagsToSnapshot: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + CopyTagsToSnapshot: false, + }); + }); + + test('cluster with copyTagsToSnapshot enabled', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + copyTagsToSnapshot: true, + instanceProps: { + vpc, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + CopyTagsToSnapshot: true, + }); + }); + + test('cluster has BacktrackWindow in seconds', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + vpc, + }, + backtrackWindow: cdk.Duration.days(1), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBCluster', { + BacktrackWindow: 24 * 60 * 60, + }); + }); + + test('DB instances should not have engine version set when part of a cluster', () => { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.auroraPostgres({ version: AuroraPostgresEngineVersion.VER_14_3 }), + instanceProps: { vpc }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EngineVersion: Match.absent(), + }); + }); +}); + +test.each([ + [cdk.RemovalPolicy.RETAIN, 'Retain', 'Retain', 'Retain'], + [cdk.RemovalPolicy.SNAPSHOT, 'Snapshot', 'Delete', Match.absent()], + [cdk.RemovalPolicy.DESTROY, 'Delete', 'Delete', Match.absent()], +])('if Cluster RemovalPolicy is \'%s\', the DBCluster has DeletionPolicy \'%s\', the DBInstance has \'%s\' and the DBSubnetGroup has \'%s\'', (clusterRemovalPolicy, clusterValue, instanceValue, subnetValue) => { + const stack = new cdk.Stack(); + + // WHEN + new DatabaseCluster(stack, 'Cluster', { + credentials: { username: 'admin' }, + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), + vpc: new ec2.Vpc(stack, 'Vpc'), + }, + removalPolicy: clusterRemovalPolicy, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { + DeletionPolicy: clusterValue, + UpdateReplacePolicy: clusterValue, + }); + + Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { + DeletionPolicy: instanceValue, + UpdateReplacePolicy: instanceValue, + }); + + Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { + DeletionPolicy: subnetValue, + }); +}); + +test.each([ + [cdk.RemovalPolicy.RETAIN, 'Retain', 'Retain', 'Retain'], + [cdk.RemovalPolicy.SNAPSHOT, 'Snapshot', 'Delete', Match.absent()], + [cdk.RemovalPolicy.DESTROY, 'Delete', 'Delete', Match.absent()], +])('if Cluster RemovalPolicy is \'%s\', the DBCluster has DeletionPolicy \'%s\', the DBInstance has \'%s\' and the DBSubnetGroup has \'%s\'', (clusterRemovalPolicy, clusterValue, instanceValue, subnetValue) => { + const stack = new cdk.Stack(); + + // WHEN + new DatabaseCluster(stack, 'Cluster', { + credentials: { username: 'admin' }, + engine: DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.LARGE), + vpc: new ec2.Vpc(stack, 'Vpc'), + }, + removalPolicy: clusterRemovalPolicy, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::RDS::DBCluster', { + DeletionPolicy: clusterValue, + UpdateReplacePolicy: clusterValue, + }); + + Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { + DeletionPolicy: instanceValue, + UpdateReplacePolicy: instanceValue, + }); + + Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { + DeletionPolicy: subnetValue, + UpdateReplacePolicy: subnetValue, + }); +}); + +function testStack(app?: cdk.App, stackId?: string) { + const stack = new cdk.Stack(app, stackId, { env: { account: '12345', region: 'us-test-1' } }); + stack.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']); + return stack; +} diff --git a/packages/@aws-cdk/aws-rds/test/database-secret.test.ts b/packages/aws-cdk-lib/aws-rds/test/database-secret.test.ts similarity index 97% rename from packages/@aws-cdk/aws-rds/test/database-secret.test.ts rename to packages/aws-cdk-lib/aws-rds/test/database-secret.test.ts index b9db29f4d6192..ee18ded34397a 100644 --- a/packages/@aws-cdk/aws-rds/test/database-secret.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/database-secret.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { CfnResource, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { CfnResource, Stack } from '../../core'; import { DatabaseSecret } from '../lib'; import { DEFAULT_PASSWORD_EXCLUDE_CHARS } from '../lib/private/util'; diff --git a/packages/@aws-cdk/aws-rds/test/database-secretmanager.test.ts b/packages/aws-cdk-lib/aws-rds/test/database-secretmanager.test.ts similarity index 92% rename from packages/@aws-cdk/aws-rds/test/database-secretmanager.test.ts rename to packages/aws-cdk-lib/aws-rds/test/database-secretmanager.test.ts index 8d1da9e04b1b6..97ef79f06ae81 100644 --- a/packages/@aws-cdk/aws-rds/test/database-secretmanager.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/database-secretmanager.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; import { ServerlessCluster, DatabaseClusterEngine, ParameterGroup, Credentials } from '../lib'; describe('database secret manager', () => { diff --git a/packages/@aws-cdk/aws-rds/test/instance-engine.test.ts b/packages/aws-cdk-lib/aws-rds/test/instance-engine.test.ts similarity index 98% rename from packages/@aws-cdk/aws-rds/test/instance-engine.test.ts rename to packages/aws-cdk-lib/aws-rds/test/instance-engine.test.ts index 17611db2a4e7f..7011288790454 100644 --- a/packages/@aws-cdk/aws-rds/test/instance-engine.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/instance-engine.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as rds from '../lib'; describe('instance engine', () => { diff --git a/packages/aws-cdk-lib/aws-rds/test/instance.test.ts b/packages/aws-cdk-lib/aws-rds/test/instance.test.ts new file mode 100644 index 0000000000000..f171e8f03618a --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/test/instance.test.ts @@ -0,0 +1,1847 @@ +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as targets from '../../aws-events-targets'; +import { ManagedPolicy, Role, ServicePrincipal, AccountPrincipal } from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import * as rds from '../lib'; + +let stack: cdk.Stack; +let vpc: ec2.Vpc; + +describe('instance', () => { + beforeEach(() => { + stack = new cdk.Stack(); + vpc = new ec2.Vpc(stack, 'VPC'); + }); + + test('create a DB instance', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + licenseModel: rds.LicenseModel.BRING_YOUR_OWN_LICENSE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.MEDIUM), + multiAz: true, + storageType: rds.StorageType.IO1, + credentials: rds.Credentials.fromUsername('syscdk', { + excludeCharacters: '"@/\\', + }), + vpc, + databaseName: 'ORCL', + storageEncrypted: true, + backupRetention: cdk.Duration.days(7), + monitoringInterval: cdk.Duration.minutes(1), + enablePerformanceInsights: true, + cloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener', + ], + cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH, + autoMinorVersionUpgrade: false, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { + Properties: { + DBInstanceClass: 'db.t2.medium', + AllocatedStorage: '100', + AutoMinorVersionUpgrade: false, + BackupRetentionPeriod: 7, + CopyTagsToSnapshot: true, + DBName: 'ORCL', + DBSubnetGroupName: { + Ref: 'InstanceSubnetGroupF2CBA54F', + }, + EnableCloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener', + ], + EnablePerformanceInsights: true, + Engine: 'oracle-se2', + EngineVersion: '19.0.0.0.ru-2020-04.rur-2020-04.r1', + Iops: 1000, + LicenseModel: 'bring-your-own-license', + MasterUsername: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'InstanceSecret478E0A47', + }, + ':SecretString:username::}}', + ], + ], + }, + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'InstanceSecret478E0A47', + }, + ':SecretString:password::}}', + ], + ], + }, + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': [ + 'InstanceMonitoringRole3E2B4286', + 'Arn', + ], + }, + MultiAZ: true, + PerformanceInsightsRetentionPeriod: 7, + StorageEncrypted: true, + StorageType: 'io1', + VPCSecurityGroups: [ + { + 'Fn::GetAtt': [ + 'InstanceSecurityGroupB4E5FA83', + 'GroupId', + ], + }, + ], + }, + DeletionPolicy: 'Snapshot', + UpdateReplacePolicy: 'Snapshot', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBSubnetGroup', { + DBSubnetGroupDescription: 'Subnet group for Instance database', + SubnetIds: [ + { + Ref: 'VPCPrivateSubnet1Subnet8BCA10E0', + }, + { + Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A', + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroup', { + GroupDescription: 'Security group for Instance database', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole', + ], + ], + }, + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Description: { + 'Fn::Join': [ + '', + [ + 'Generated by the CDK for stack: ', + { + Ref: 'AWS::StackName', + }, + ], + ], + }, + GenerateSecretString: { + ExcludeCharacters: '\"@/\\', + GenerateStringKey: 'password', + PasswordLength: 30, + SecretStringTemplate: '{"username":"syscdk"}', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::SecretTargetAttachment', { + SecretId: { + Ref: 'InstanceSecret478E0A47', + }, + TargetId: { + Ref: 'InstanceC1063A87', + }, + TargetType: 'AWS::RDS::DBInstance', + }); + + Template.fromStack(stack).resourceCountIs('Custom::LogRetention', 4); + }); + + test('throws when create database with specific AZ and multiAZ enabled', () => { + expect(() => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + multiAz: true, + availabilityZone: 'ew-west-1a', + }); + }).toThrow(/Requesting a specific availability zone is not valid for Multi-AZ instances/); + }); + + test('instance with option and parameter group', () => { + const optionGroup = new rds.OptionGroup(stack, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + configurations: [ + { + name: 'XMLDB', + }, + ], + }); + + const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ + version: rds.SqlServerEngineVersion.VER_11, + }), + description: 'desc', + parameters: { + key: 'value', + }, + }); + + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + optionGroup, + parameterGroup, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'ParameterGroup5E32DECB', + }, + OptionGroupName: { + Ref: 'OptionGroupACA43DC1', + }, + }); + }); + + test('instance with inline parameter group', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_11 }), + vpc, + parameters: { + locks: '100', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'DatabaseParameterGroup2A921026', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBParameterGroup', { + Family: 'sqlserver-ee-11.0', + Parameters: { + locks: '100', + }, + }); + }); + + test('instance with inline parameter group and parameterGroup arg fails', () => { + const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ + version: rds.SqlServerEngineVersion.VER_11, + }), + parameters: { + key: 'value', + }, + }); + + expect(() => { + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_11 }), + vpc, + parameters: { + locks: '100', + }, + parameterGroup, + }); + }).toThrow(/You cannot specify both parameterGroup and parameters/); + }); + + test('can specify subnet type', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + credentials: rds.Credentials.fromUsername('syscdk'), + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBSubnetGroupName: { + Ref: 'InstanceSubnetGroupF2CBA54F', + }, + PubliclyAccessible: false, + }); + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBSubnetGroup', { + DBSubnetGroupDescription: 'Subnet group for Instance database', + SubnetIds: [ + { + Ref: 'VPCPrivateSubnet1Subnet8BCA10E0', + }, + { + Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A', + }, + ], + }); + }); + + test('instance with IPv4 network type', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + networkType: rds.NetworkType.IPV4, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + NetworkType: 'IPV4', + }); + }); + + test('instance with dual-stack network type', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + networkType: rds.NetworkType.DUAL, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + NetworkType: 'DUAL', + }); + }); + + describe('DatabaseInstanceFromSnapshot', () => { + test('create an instance from snapshot', () => { + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), + vpc, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBSnapshotIdentifier: 'my-snapshot', + }); + }); + + test('can generate a new snapshot password', () => { + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + credentials: rds.SnapshotCredentials.fromGeneratedSecret('admin', { + excludeCharacters: '"@/\\', + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MasterUsername: Match.absent(), + MasterUserPassword: { + 'Fn::Join': ['', [ + '{{resolve:secretsmanager:', + { Ref: 'InstanceSecretB6DFA6BE8ee0a797cad8a68dbeb85f8698cdb5bb' }, + ':SecretString:password::}}', + ]], + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Description: { + 'Fn::Join': ['', ['Generated by the CDK for stack: ', { Ref: 'AWS::StackName' }]], + }, + GenerateSecretString: { + ExcludeCharacters: '\"@/\\', + GenerateStringKey: 'password', + PasswordLength: 30, + SecretStringTemplate: '{"username":"admin"}', + }, + }); + }); + + test('fromGeneratedSecret with replica regions', () => { + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + credentials: rds.SnapshotCredentials.fromGeneratedSecret('admin', { + replicaRegions: [{ region: 'eu-west-1' }], + }), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + ReplicaRegions: [ + { + Region: 'eu-west-1', + }, + ], + }); + }); + + test('throws if generating a new password without a username', () => { + expect(() => new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + credentials: { generatePassword: true }, + })).toThrow(/`credentials` `username` must be specified when `generatePassword` is set to true/); + }); + + test('can set a new snapshot password from an existing SecretValue', () => { + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + credentials: rds.SnapshotCredentials.fromPassword(cdk.SecretValue.unsafePlainText('mysecretpassword')), + }); + + // TODO - Expect this to be broken + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MasterUsername: Match.absent(), + MasterUserPassword: 'mysecretpassword', + }); + }); + + test('can set a new snapshot password from an existing Secret', () => { + const secret = new rds.DatabaseSecret(stack, 'DBSecret', { + username: 'admin', + encryptionKey: new kms.Key(stack, 'PasswordKey'), + }); + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + credentials: rds.SnapshotCredentials.fromSecret(secret), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MasterUsername: Match.absent(), + MasterUserPassword: { + 'Fn::Join': ['', ['{{resolve:secretsmanager:', { Ref: 'DBSecretD58955BC' }, ':SecretString:password::}}']], + }, + }); + }); + + test('can create a new database instance with fromDatabaseInstanceAttributes using a token for the port', () => { + // GIVEN + const databasePort = new cdk.CfnParameter(stack, 'DatabasePort', { + type: 'Number', + default: 5432, + }).valueAsNumber; + + // WHEN + const instance = rds.DatabaseInstance.fromDatabaseInstanceAttributes(stack, 'DatabaseInstance', { + instanceIdentifier: '', + securityGroups: [], + instanceEndpointAddress: '', + port: databasePort, + }); + + new cdk.CfnOutput(stack, 'portOutput', { + exportName: 'databaseUrl', + value: `${instance.dbInstanceEndpointPort}`, + }); + + // THEN + Template.fromStack(stack).hasOutput('portOutput', { + Export: { Name: 'databaseUrl' }, + Value: { + Ref: 'DatabasePort', + }, + }); + }); + }); + + test('create a read replica in the same region - with the subnet group name', () => { + const sourceInstance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + }); + + // WHEN + new rds.DatabaseInstanceReadReplica(stack, 'ReadReplica', { + sourceDatabaseInstance: sourceInstance, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + SourceDBInstanceIdentifier: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':rds:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':db:', + { Ref: 'InstanceC1063A87' }, + ]], + }, + DBSubnetGroupName: { + Ref: 'ReadReplicaSubnetGroup680C605C', + }, + }); + }); + + test('on event', () => { + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + }); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('dummy'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + instance.onEvent('InstanceEvent', { target: new targets.LambdaFunction(fn) }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + EventPattern: { + source: [ + 'aws.rds', + ], + resources: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':rds:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':db:', + { + Ref: 'InstanceC1063A87', + }, + ], + ], + }, + ], + }, + Targets: [ + { + Arn: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Id: 'Target0', + }, + ], + }); + }); + + test('on event without target', () => { + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + }); + + // WHEN + instance.onEvent('InstanceEvent'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Events::Rule', { + EventPattern: { + source: [ + 'aws.rds', + ], + resources: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':rds:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':db:', + { + Ref: 'InstanceC1063A87', + }, + ], + ], + }, + ], + }, + }); + }); + + test('can use metricCPUUtilization', () => { + // WHEN + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + }); + + // THEN + expect(stack.resolve(instance.metricCPUUtilization())).toEqual({ + dimensions: { DBInstanceIdentifier: { Ref: 'InstanceC1063A87' } }, + namespace: 'AWS/RDS', + metricName: 'CPUUtilization', + period: cdk.Duration.minutes(5), + statistic: 'Average', + }); + }); + + test('can resolve endpoint port and socket address', () => { + // WHEN + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + }); + + expect(stack.resolve(instance.instanceEndpoint.port)).toEqual({ + 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint.Port'], + }); + + expect(stack.resolve(instance.instanceEndpoint.socketAddress)).toEqual({ + 'Fn::Join': [ + '', + [ + { 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint.Address'] }, + ':', + { 'Fn::GetAtt': ['InstanceC1063A87', 'Endpoint.Port'] }, + ], + ], + }); + }); + + test('can deactivate backup', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + backupRetention: cdk.Duration.seconds(0), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + BackupRetentionPeriod: 0, + }); + }); + + test('imported instance with imported security group with allowAllOutbound set to false', () => { + const instance = rds.DatabaseInstance.fromDatabaseInstanceAttributes(stack, 'Database', { + instanceEndpointAddress: 'address', + instanceIdentifier: 'identifier', + port: 3306, + securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + })], + }); + + // WHEN + instance.connections.allowToAnyIpv4(ec2.Port.tcp(443)); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupEgress', { + GroupId: 'sg-123456789', + }); + }); + + test('create an instance with imported monitoring role', () => { + const monitoringRole = new Role(stack, 'MonitoringRole', { + assumedBy: new ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicies: [ + ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonRDSEnhancedMonitoringRole'), + ], + }); + + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + monitoringInterval: cdk.Duration.minutes(1), + monitoringRole, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': ['MonitoringRole90457BF9', 'Arn'], + }, + }); + }); + + test('create an instance with an existing security group', () => { + const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(stack, 'SG', 'sg-123456789', { + allowAllOutbound: false, + }); + + // WHEN + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + securityGroups: [securityGroup], + }); + instance.connections.allowDefaultPortFromAnyIpv4(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + VPCSecurityGroups: ['sg-123456789'], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::EC2::SecurityGroupIngress', { + FromPort: { + 'Fn::GetAtt': [ + 'InstanceC1063A87', + 'Endpoint.Port', + ], + }, + GroupId: 'sg-123456789', + ToPort: { + 'Fn::GetAtt': [ + 'InstanceC1063A87', + 'Endpoint.Port', + ], + }, + }); + }); + + test('addRotationSingleUser()', () => { + // GIVEN + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + }); + + // WHEN + instance.addRotationSingleUser(); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { + Ref: 'DatabaseSecretAttachmentE5D1B020', + }, + RotationLambdaARN: { + 'Fn::GetAtt': [ + 'DatabaseRotationSingleUser65F55654', + 'Outputs.RotationLambdaARN', + ], + }, + RotationRules: { + AutomaticallyAfterDays: 30, + }, + }); + }); + + test('addRotationMultiUser()', () => { + // GIVEN + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + }); + + // WHEN + const userSecret = new rds.DatabaseSecret(stack, 'UserSecret', { username: 'user' }); + instance.addRotationMultiUser('user', { secret: userSecret.attach(instance) }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + SecretId: { + Ref: 'UserSecretAttachment16ACBE6D', + }, + RotationLambdaARN: { + 'Fn::GetAtt': [ + 'DatabaseuserECD1FB0C', + 'Outputs.RotationLambdaARN', + ], + }, + RotationRules: { + AutomaticallyAfterDays: 30, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + masterSecretArn: { + Ref: 'DatabaseSecretAttachmentE5D1B020', + }, + }, + }); + }); + + test('addRotationSingleUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { + // GIVEN + const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { + vpcId: 'vpc-id', + availabilityZones: ['az1'], + publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], + publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], + privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], + privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], + isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], + isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], + }); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc: vpcWithIsolated, + }); + + // WHEN + // DB in isolated subnet (no internet connectivity) + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc: vpcWithIsolated, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }); + + // Rotation in private subnet (internet via NAT) + instance.addRotationSingleUser({ + automaticallyAfter: cdk.Duration.days(15), + excludeCharacters: '°_@', + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + securityGroup, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + RotationRules: { + AutomaticallyAfterDays: 15, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + endpoint: { + 'Fn::Join': ['', [ + 'https://secretsmanager.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', + excludeCharacters: '°_@', + vpcSecurityGroupIds: { + 'Fn::GetAtt': [ + stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), + 'GroupId', + ], + }, + }, + }); + }); + + test('addRotationMultiUser() with custom automaticallyAfter, excludeCharacters, vpcSubnets and securityGroup', () => { + // GIVEN + const vpcWithIsolated = ec2.Vpc.fromVpcAttributes(stack, 'Vpc', { + vpcId: 'vpc-id', + availabilityZones: ['az1'], + publicSubnetIds: ['public-subnet-id-1', 'public-subnet-id-2'], + publicSubnetNames: ['public-subnet-name-1', 'public-subnet-name-2'], + privateSubnetIds: ['private-subnet-id-1', 'private-subnet-id-2'], + privateSubnetNames: ['private-subnet-name-1', 'private-subnet-name-2'], + isolatedSubnetIds: ['isolated-subnet-id-1', 'isolated-subnet-id-2'], + isolatedSubnetNames: ['isolated-subnet-name-1', 'isolated-subnet-name-2'], + }); + const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { + vpc: vpcWithIsolated, + }); + const userSecret = new rds.DatabaseSecret(stack, 'UserSecret', { username: 'user' }); + + // WHEN + // DB in isolated subnet (no internet connectivity) + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc: vpcWithIsolated, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }); + + // Rotation in private subnet (internet via NAT) + instance.addRotationMultiUser('user', { + secret: userSecret.attach(instance), + automaticallyAfter: cdk.Duration.days(15), + excludeCharacters: '°_@', + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + securityGroup, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::RotationSchedule', { + RotationRules: { + AutomaticallyAfterDays: 15, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + endpoint: { + 'Fn::Join': ['', [ + 'https://secretsmanager.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + vpcSubnetIds: 'private-subnet-id-1,private-subnet-id-2', + excludeCharacters: '°_@', + vpcSecurityGroupIds: { + 'Fn::GetAtt': [ + stack.getLogicalId(securityGroup.node.defaultChild as ec2.CfnSecurityGroup), + 'GroupId', + ], + }, + }, + }); + }); + + test('addRotationSingleUser() with VPC interface endpoint', () => { + // GIVEN + const vpcIsolatedOnly = new ec2.Vpc(stack, 'Vpc', { natGateways: 0 }); + + const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { + service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, + vpc: vpcIsolatedOnly, + subnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }); + + // WHEN + // DB in isolated subnet (no internet connectivity) + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc: vpcIsolatedOnly, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, + }); + + // Rotation in isolated subnet with access to Secrets Manager API via endpoint + instance.addRotationSingleUser({ endpoint }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Serverless::Application', { + Parameters: { + endpoint: { + 'Fn::Join': ['', [ + 'https://', + { Ref: 'EndpointEEF1FD8F' }, + '.secretsmanager.', + { Ref: 'AWS::Region' }, + '.', + { Ref: 'AWS::URLSuffix' }, + ]], + }, + functionName: 'DatabaseRotationSingleUser458A45BE', + vpcSubnetIds: { + 'Fn::Join': ['', [ + { Ref: 'VpcIsolatedSubnet1SubnetE48C5737' }, + ',', + { Ref: 'VpcIsolatedSubnet2Subnet16364B91' }, + ]], + }, + vpcSecurityGroupIds: { + 'Fn::GetAtt': [ + 'DatabaseRotationSingleUserSecurityGroupAC6E0E73', + 'GroupId', + ], + }, + excludeCharacters: " %+~`#$&*()|[]{}:;<>?!'/@\"\\", + }, + }); + }); + + test('throws when trying to add rotation to an instance without secret', () => { + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, + credentials: rds.Credentials.fromUsername('syscdk', { password: cdk.SecretValue.unsafePlainText('tooshort') }), + vpc, + }); + + // THEN + expect(() => instance.addRotationSingleUser()).toThrow(/without secret/); + }); + + test('throws when trying to add single user rotation multiple times', () => { + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SQL_SERVER_EE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + credentials: rds.Credentials.fromUsername('syscdk'), + vpc, + }); + + // WHEN + instance.addRotationSingleUser(); + + // THEN + expect(() => instance.addRotationSingleUser()).toThrow(/A single user rotation was already added to this instance/); + }); + + test('throws when timezone is set for non-sqlserver database engine', () => { + const tzSupportedEngines = [rds.DatabaseInstanceEngine.SQL_SERVER_EE, rds.DatabaseInstanceEngine.SQL_SERVER_EX, + rds.DatabaseInstanceEngine.SQL_SERVER_SE, rds.DatabaseInstanceEngine.SQL_SERVER_WEB]; + const tzUnsupportedEngines = [rds.DatabaseInstanceEngine.MYSQL, rds.DatabaseInstanceEngine.POSTGRES, + rds.DatabaseInstanceEngine.ORACLE_EE, rds.DatabaseInstanceEngine.MARIADB]; + + // THEN + tzSupportedEngines.forEach((engine) => { + expect(new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { + engine, + timezone: 'Europe/Zurich', + vpc, + })).toBeDefined(); + }); + + tzUnsupportedEngines.forEach((engine) => { + expect(() => new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { + engine, + timezone: 'Europe/Zurich', + vpc, + })).toThrow(/timezone property can not be configured for/); + }); + }); + + test('create an instance from snapshot with maximum allocated storage', () => { + // WHEN + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.POSTGRES, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), + vpc, + maxAllocatedStorage: 200, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBSnapshotIdentifier: 'my-snapshot', + MaxAllocatedStorage: 200, + }); + }); + + test('create a DB instance with maximum allocated storage', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.MYSQL, + vpc, + backupRetention: cdk.Duration.seconds(0), + maxAllocatedStorage: 250, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + BackupRetentionPeriod: 0, + MaxAllocatedStorage: 250, + }); + }); + + test('iam authentication - off by default', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EnableIAMDatabaseAuthentication: Match.absent(), + }); + }); + + test('createGrant - creates IAM policy and enables IAM auth', () => { + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + }); + const role = new Role(stack, 'DBRole', { + assumedBy: new AccountPrincipal(stack.account), + }); + instance.grantConnect(role); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EnableIAMDatabaseAuthentication: true, + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Effect: 'Allow', + Action: 'rds-db:connect', + Resource: { + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':rds:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':db:', { Ref: 'InstanceC1063A87' }]], + }, + }], + Version: '2012-10-17', + }, + }); + }); + + test('createGrant - throws if IAM auth disabled', () => { + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + iamAuthentication: false, + }); + const role = new Role(stack, 'DBRole', { + assumedBy: new AccountPrincipal(stack.account), + }); + + expect(() => { instance.grantConnect(role); }).toThrow(/Cannot grant connect when IAM authentication is disabled/); + }); + + test('domain - sets domain property', () => { + const domain = 'd-90670a8d36'; + + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.sqlServerWeb({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), + vpc, + domain: domain, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Domain: domain, + }); + }); + + test('domain - uses role if provided', () => { + const domain = 'd-90670a8d36'; + + // WHEN + const role = new Role(stack, 'DomainRole', { assumedBy: new ServicePrincipal('rds.amazonaws.com') }); + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.sqlServerWeb({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), + vpc, + domain: domain, + domainRole: role, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Domain: domain, + DomainIAMRoleName: stack.resolve(role.roleName), + }); + }); + + test('domain - creates role if not provided', () => { + const domain = 'd-90670a8d36'; + + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.sqlServerWeb({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), + vpc, + domain: domain, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Domain: domain, + DomainIAMRoleName: Match.anyValue(), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'rds.amazonaws.com', + }, + }, + ], + Version: '2012-10-17', + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':iam::aws:policy/service-role/AmazonRDSDirectoryServiceAccess', + ], + ], + }, + ], + }); + }); + + test('throws when domain is set for mariadb database engine', () => { + const domainSupportedEngines = [rds.DatabaseInstanceEngine.SQL_SERVER_EE, rds.DatabaseInstanceEngine.SQL_SERVER_EX, + rds.DatabaseInstanceEngine.SQL_SERVER_SE, rds.DatabaseInstanceEngine.SQL_SERVER_WEB, rds.DatabaseInstanceEngine.MYSQL, + rds.DatabaseInstanceEngine.POSTGRES, rds.DatabaseInstanceEngine.ORACLE_EE]; + const domainUnsupportedEngines = [rds.DatabaseInstanceEngine.MARIADB]; + + // THEN + domainSupportedEngines.forEach((engine) => { + expect(() => new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { + engine, + domain: 'd-90670a8d36', + vpc, + })).not.toThrow(); + }); + + domainUnsupportedEngines.forEach((engine) => { + const expectedError = new RegExp(`domain property cannot be configured for ${engine.engineType}`); + + expect(() => new rds.DatabaseInstance(stack, `${engine.engineType}-db`, { + engine, + domain: 'd-90670a8d36', + vpc, + })).toThrow(expectedError); + }); + }); + + describe('performance insights', () => { + test('instance with all performance insights properties', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + enablePerformanceInsights: true, + performanceInsightRetention: rds.PerformanceInsightRetention.LONG_TERM, + performanceInsightEncryptionKey: new kms.Key(stack, 'Key'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EnablePerformanceInsights: true, + PerformanceInsightsRetentionPeriod: 731, + PerformanceInsightsKMSKeyId: { 'Fn::GetAtt': ['Key961B73FD', 'Arn'] }, + }); + }); + + test('setting performance insights fields enables performance insights', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + performanceInsightRetention: rds.PerformanceInsightRetention.LONG_TERM, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + EnablePerformanceInsights: true, + PerformanceInsightsRetentionPeriod: 731, + }); + }); + + test('throws if performance insights fields are set but performance insights is disabled', () => { + expect(() => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + enablePerformanceInsights: false, + performanceInsightRetention: rds.PerformanceInsightRetention.DEFAULT, + }); + }).toThrow(/`enablePerformanceInsights` disabled, but `performanceInsightRetention` or `performanceInsightEncryptionKey` was set/); + }); + }); + + test('reuse an existing subnet group', () => { + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + subnetGroup: rds.SubnetGroup.fromSubnetGroupName(stack, 'SubnetGroup', 'my-subnet-group'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBSubnetGroupName: 'my-subnet-group', + }); + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBSubnetGroup', 0); + }); + + test('defaultChild returns the DB Instance', () => { + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + }); + + // THEN + expect(instance.node.defaultChild instanceof rds.CfnDBInstance).toBeTruthy(); + }); + + test("PostgreSQL database instance uses a different default master username than 'admin', which is a reserved word", () => { + new rds.DatabaseInstance(stack, 'Instance', { + vpc, + engine: rds.DatabaseInstanceEngine.postgres({ + version: rds.PostgresEngineVersion.VER_15_2, + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + GenerateSecretString: { + SecretStringTemplate: '{"username":"postgres"}', + }, + }); + }); + + describe('S3 Import/Export', () => { + test('instance with s3 import and export buckets', () => { + stack = new cdk.Stack(); + vpc = new ec2.Vpc(stack, 'VPC'); + new rds.DatabaseInstance(stack, 'DB', { + engine: rds.DatabaseInstanceEngine.sqlServerSe({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), + vpc, + s3ImportBuckets: [new s3.Bucket(stack, 'S3Import')], + s3ExportBuckets: [new s3.Bucket(stack, 'S3Export')], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + AssociatedRoles: [ + { + FeatureName: 'S3_INTEGRATION', + RoleArn: { 'Fn::GetAtt': ['DBS3ImportRoleEF69B7D7', 'Arn'] }, + }, + ], + OptionGroupName: { Ref: 'DBInstanceOptionGroup46C68006' }, + }); + + // Can read from import bucket, and read/write from export bucket + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + Effect: 'Allow', + Resource: [ + { 'Fn::GetAtt': ['S3ImportD5D5F2EB', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['S3ImportD5D5F2EB', 'Arn'] }, '/*']] }, + ], + }, + { + Action: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Resource: [ + { 'Fn::GetAtt': ['S3Export390B8694', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['S3Export390B8694', 'Arn'] }, '/*']] }, + ], + }], + Version: '2012-10-17', + }, + }); + }); + + test('throws if using s3 import on unsupported engine', () => { + const s3ImportRole = new Role(stack, 'S3ImportRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + + expect(() => { + new rds.DatabaseInstance(stack, 'DBWithImportBucket', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + s3ImportBuckets: [new s3.Bucket(stack, 'S3Import')], + }); + }).toThrow(/Engine 'mysql-8.0.19' does not support S3 import/); + expect(() => { + new rds.DatabaseInstance(stack, 'DBWithImportRole', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + s3ImportRole, + }); + }).toThrow(/Engine 'mysql-8.0.19' does not support S3 import/); + }); + + test('throws if using s3 export on unsupported engine', () => { + const s3ExportRole = new Role(stack, 'S3ExportRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + + expect(() => { + new rds.DatabaseInstance(stack, 'DBWithExportBucket', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + s3ExportBuckets: [new s3.Bucket(stack, 'S3Export')], + }); + }).toThrow(/Engine 'mysql-8.0.19' does not support S3 export/); + expect(() => { + new rds.DatabaseInstance(stack, 'DBWithExportRole', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_19 }), + vpc, + s3ExportRole: s3ExportRole, + }); + }).toThrow(/Engine 'mysql-8.0.19' does not support S3 export/); + }); + + test('throws if provided two different roles for import/export', () => { + const s3ImportRole = new Role(stack, 'S3ImportRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + const s3ExportRole = new Role(stack, 'S3ExportRole', { + assumedBy: new ServicePrincipal('rds.amazonaws.com'), + }); + + expect(() => { + new rds.DatabaseInstance(stack, 'DBWithExportBucket', { + engine: rds.DatabaseInstanceEngine.sqlServerEe({ version: rds.SqlServerEngineVersion.VER_14_00_3192_2_V1 }), + vpc, + s3ImportRole, + s3ExportRole, + }); + }).toThrow(/S3 import and export roles must be the same/); + }); + }); + + test('fromGeneratedSecret', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + credentials: rds.Credentials.fromGeneratedSecret('postgres'), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MasterUsername: 'postgres', // username is a string + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'DatabaseSecretC9203AE33fdaad7efa858a3daf9490cf0a702aeb', // logical id is a hash + }, + ':SecretString:password::}}', + ], + ], + }, + }); + }); + + test('fromGeneratedSecret with replica regions', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + credentials: rds.Credentials.fromGeneratedSecret('postgres', { + replicaRegions: [{ region: 'eu-west-1' }], + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + ReplicaRegions: [ + { + Region: 'eu-west-1', + }, + ], + }); + }); + + test('fromPassword', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + vpc, + credentials: rds.Credentials.fromPassword('postgres', cdk.SecretValue.ssmSecure('/dbPassword', '1')), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + MasterUsername: 'postgres', // username is a string + MasterUserPassword: '{{resolve:ssm-secure:/dbPassword:1}}', // reference to SSM + }); + }); + + test('can set custom name to database secret by fromSecret', () => { + // WHEN + const secretName = 'custom-secret-name'; + const secret = new rds.DatabaseSecret(stack, 'Secret', { + username: 'admin', + secretName, + } ); + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + credentials: rds.Credentials.fromSecret(secret), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Name: secretName, + }); + }); + + test('can set custom name to database secret by fromGeneratedSecret', () => { + // WHEN + const secretName = 'custom-secret-name'; + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + credentials: rds.Credentials.fromGeneratedSecret('admin', { secretName }), + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SecretsManager::Secret', { + Name: secretName, + }); + }); + + test('can set publiclyAccessible to false with public subnets', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + publiclyAccessible: false, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + PubliclyAccessible: false, + }); + }); + + test('can set publiclyAccessible to true with private subnets', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, + }, + publiclyAccessible: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + PubliclyAccessible: true, + }); + }); + + test('changes the case of the cluster identifier', () => { + // GIVEN + const app = new cdk.App(); + stack = new cdk.Stack( app ); + vpc = new ec2.Vpc( stack, 'VPC' ); + + // WHEN + const instanceIdentifier = 'TestInstanceIdentifier'; + new rds.DatabaseInstance( stack, 'DB', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + vpc, + instanceIdentifier, + } ); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBInstanceIdentifier: instanceIdentifier.toLowerCase(), + }); + }); + + test( 'does not changes the case of the cluster identifier if the lowercaseDbIdentifier feature flag is disabled', () => { + // GIVEN + const app = new cdk.App({ context: { '@aws-cdk/aws-rds:lowercaseDbIdentifier': false } }); + stack = new cdk.Stack(app); + vpc = new ec2.Vpc( stack, 'VPC' ); + + // WHEN + const instanceIdentifier = 'TestInstanceIdentifier'; + new rds.DatabaseInstance( stack, 'DB', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + vpc, + instanceIdentifier, + } ); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBInstanceIdentifier: instanceIdentifier, + }); + }); + + test('throws with backupRetention on a read replica if engine does not support it', () => { + // GIVEN + const instanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL); + const backupRetention = cdk.Duration.days(5); + const source = new rds.DatabaseInstance(stack, 'Source', { + engine: rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }), + backupRetention, + instanceType, + vpc, + }); + + expect(() => { + new rds.DatabaseInstanceReadReplica(stack, 'Replica', { + sourceDatabaseInstance: source, + backupRetention, + instanceType, + vpc, + }); + }).toThrow(/Cannot set 'backupRetention', as engine 'postgres-15.2' does not support automatic backups for read replicas/); + }); + + test('can set parameter group on read replica', () => { + // GIVEN + const instanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL); + const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); + const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { engine }); + const source = new rds.DatabaseInstance(stack, 'Source', { + engine, + instanceType, + vpc, + }); + + // WHEN + new rds.DatabaseInstanceReadReplica(stack, 'Replica', { + sourceDatabaseInstance: source, + parameterGroup, + instanceType, + vpc, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'ParameterGroup5E32DECB', + }, + }); + }); + + test('instance with port provided as a number', () => { + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.MYSQL, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + port: 3306, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Port: '3306', + }); + }); + + test('instance with port provided as a CloudFormation parameter', () => { + // GIVEN + const port = new cdk.CfnParameter(stack, 'Port', { + type: 'Number', + }).valueAsNumber; + + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.MYSQL, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL), + vpc, + port, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + Port: { + Ref: 'Port', + }, + }); + }); + + test('engine is specified for read replica using domain', () => { + // GIVEN + const instanceType = ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL); + const engine = rds.DatabaseInstanceEngine.postgres({ version: rds.PostgresEngineVersion.VER_15_2 }); + const source = new rds.DatabaseInstance(stack, 'Source', { + engine, + instanceType, + vpc, + }); + + // WHEN + new rds.DatabaseInstanceReadReplica(stack, 'Replica', { + sourceDatabaseInstance: source, + instanceType, + vpc, + domain: 'my-domain', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + SourceDBInstanceIdentifier: Match.anyValue(), + Engine: 'postgres', + }); + }); + + test('gp3 storage type', () => { + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + allocatedStorage: 500, + storageType: rds.StorageType.GP3, + storageThroughput: 500, + iops: 4000, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBInstance', { + StorageType: 'gp3', + StorageThroughput: 500, + Iops: 4000, + }); + }); + + test('throws with storage throughput and not GP3', () => { + expect(() => new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + storageType: rds.StorageType.GP2, + storageThroughput: 500, + })).toThrow(/storage throughput can only be specified with GP3 storage type/); + }); + + test('throws with a ratio of storage throughput to IOPS greater than 0.25', () => { + expect(() => new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ version: rds.MysqlEngineVersion.VER_8_0_30 }), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + allocatedStorage: 1000, + storageType: rds.StorageType.GP3, + iops: 5000, + storageThroughput: 2500, + })).toThrow(/maximum ratio of storage throughput to IOPS is 0.25/); + }); +}); + +test.each([ + [cdk.RemovalPolicy.RETAIN, 'Retain', 'Retain'], + [cdk.RemovalPolicy.SNAPSHOT, 'Snapshot', Match.absent()], + [cdk.RemovalPolicy.DESTROY, 'Delete', Match.absent()], +])('if Instance RemovalPolicy is \'%s\', the instance has DeletionPolicy \'%s\' and the DBSubnetGroup has \'%s\'', (instanceRemovalPolicy, instanceValue, subnetValue) => { + // GIVEN + stack = new cdk.Stack(); + vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.mysql({ + version: rds.MysqlEngineVersion.VER_8_0_19, + }), + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, + removalPolicy: instanceRemovalPolicy, + }); + + // THEN + Template.fromStack(stack).hasResource('AWS::RDS::DBInstance', { + DeletionPolicy: instanceValue, + UpdateReplacePolicy: instanceValue, + }); + + Template.fromStack(stack).hasResource('AWS::RDS::DBSubnetGroup', { + DeletionPolicy: subnetValue, + UpdateReplacePolicy: subnetValue, + }); +}); + +describe('cross-account instance', () => { + test.each([ + ['MyInstance', 'MyInstance', 'myinstance'], + ['PhysicalName.GENERATE_IF_NEEDED', cdk.PhysicalName.GENERATE_IF_NEEDED, 'instancestackncestackinstancec830ba83756a6dfc7154'], + ])("with database identifier '%s' can be referenced from a Stack in a different account", (_, providedInstanceId, expectedInstanceId) => { + const app = new cdk.App(); + const instanceStack = new cdk.Stack(app, 'InstanceStack', { + env: { account: '123', region: 'my-region' }, + }); + const instance = new rds.DatabaseInstance(instanceStack, 'Instance', { + vpc: new ec2.Vpc(instanceStack, 'Vpc'), + engine: rds.DatabaseInstanceEngine.mariaDb({ version: rds.MariaDbEngineVersion.VER_10_5 }), + // physical name set + instanceIdentifier: providedInstanceId, + }); + + const outputStack = new cdk.Stack(app, 'OutputStack', { + env: { account: '456', region: 'my-region' }, + }); + new cdk.CfnOutput(outputStack, 'DatabaseInstanceArn', { + value: instance.instanceArn, + }); + new cdk.CfnOutput(outputStack, 'DatabaseInstanceName', { + value: instance.instanceIdentifier, + }); + + Template.fromStack(outputStack).templateMatches({ + Outputs: { + DatabaseInstanceArn: { + Value: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + `:rds:my-region:123:db:${expectedInstanceId}`, + ]], + }, + }, + DatabaseInstanceName: { + Value: expectedInstanceId, + }, + }, + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-rds/test/integ.cluster-rotation.lit.ts b/packages/aws-cdk-lib/aws-rds/test/integ.cluster-rotation.lit.ts new file mode 100644 index 0000000000000..f43deaff352d3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/test/integ.cluster-rotation.lit.ts @@ -0,0 +1,42 @@ +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import * as rds from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-rds-cluster-rotation'); + +const vpc = new ec2.Vpc(stack, 'VPC'); +const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc }); +const endpoint = new ec2.InterfaceVpcEndpoint(stack, 'Endpoint', { + vpc, + service: ec2.InterfaceVpcEndpointAwsService.SECRETS_MANAGER, +}); + +/// !show +const cluster = new rds.DatabaseCluster(stack, 'Database', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, +}); + +cluster.addRotationSingleUser(); + +const clusterWithCustomRotationOptions = new rds.DatabaseCluster(stack, 'CustomRotationOptions', { + engine: rds.DatabaseClusterEngine.AURORA, + instanceProps: { + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL), + vpc, + }, +}); +clusterWithCustomRotationOptions.addRotationSingleUser({ + automaticallyAfter: cdk.Duration.days(7), + excludeCharacters: '!@#$%^&*', + securityGroup, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + endpoint: endpoint, +}); +/// !hide + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-rds/test/integ.instance.lit.ts b/packages/aws-cdk-lib/aws-rds/test/integ.instance.lit.ts new file mode 100644 index 0000000000000..32e3b8682ca49 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/test/integ.instance.lit.ts @@ -0,0 +1,105 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import * as ec2 from '../../aws-ec2'; +import * as targets from '../../aws-events-targets'; +import * as lambda from '../../aws-lambda'; +import * as logs from '../../aws-logs'; +import * as cdk from '../../core'; +import { RemovalPolicy } from '../../core'; +import * as rds from '../lib'; + +const app = new cdk.App(); + +class DatabaseInstanceStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + + /// !show + // Set open cursors with parameter group + const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + parameters: { + open_cursors: '2500', + }, + }); + + /// Add XMLDB and OEM with option group + const optionGroup = new rds.OptionGroup(this, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + configurations: [ + { + name: 'LOCATOR', + }, + { + name: 'OEM', + port: 1158, + vpc, + }, + ], + }); + + // Allow connections to OEM + optionGroup.optionConnections.OEM.connections.allowDefaultPortFromAnyIpv4(); + + // Database instance with production values + const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.oracleSe2({ version: rds.OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }), + licenseModel: rds.LicenseModel.BRING_YOUR_OWN_LICENSE, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.MEDIUM), + multiAz: true, + storageType: rds.StorageType.IO1, + credentials: rds.Credentials.fromUsername('syscdk'), + vpc, + databaseName: 'ORCL', + storageEncrypted: true, + backupRetention: cdk.Duration.days(7), + monitoringInterval: cdk.Duration.seconds(60), + enablePerformanceInsights: true, + cloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener', + ], + cloudwatchLogsRetention: logs.RetentionDays.ONE_MONTH, + autoMinorVersionUpgrade: true, // required to be true if LOCATOR is used in the option group + optionGroup, + parameterGroup, + removalPolicy: RemovalPolicy.DESTROY, + }); + + // Allow connections on default port from any IPV4 + instance.connections.allowDefaultPortFromAnyIpv4(); + + // Rotate the master user password every 30 days + instance.addRotationSingleUser(); + + // Add alarm for high CPU + new cloudwatch.Alarm(this, 'HighCPU', { + metric: instance.metricCPUUtilization(), + threshold: 90, + evaluationPeriods: 1, + }); + + // Trigger Lambda function on instance availability events + const fn = new lambda.Function(this, 'Function', { + code: lambda.Code.fromInline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const availabilityRule = instance.onEvent('Availability', { target: new targets.LambdaFunction(fn) }); + availabilityRule.addEventPattern({ + detail: { + EventCategories: [ + 'availability', + ], + }, + }); + /// !hide + } +} + +new DatabaseInstanceStack(app, 'aws-cdk-rds-instance'); +app.synth(); diff --git a/packages/@aws-cdk/aws-rds/test/mariadb/mariadb.instance-engine.test.ts b/packages/aws-cdk-lib/aws-rds/test/mariadb/mariadb.instance-engine.test.ts similarity index 96% rename from packages/@aws-cdk/aws-rds/test/mariadb/mariadb.instance-engine.test.ts rename to packages/aws-cdk-lib/aws-rds/test/mariadb/mariadb.instance-engine.test.ts index f2aa303812dfd..e5c16ba2912e9 100644 --- a/packages/@aws-cdk/aws-rds/test/mariadb/mariadb.instance-engine.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/mariadb/mariadb.instance-engine.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as core from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as core from '../../../core'; import * as rds from '../../lib'; describe('MariaDB server instance engine', () => { diff --git a/packages/@aws-cdk/aws-rds/test/option-group.test.ts b/packages/aws-cdk-lib/aws-rds/test/option-group.test.ts similarity index 96% rename from packages/@aws-cdk/aws-rds/test/option-group.test.ts rename to packages/aws-cdk-lib/aws-rds/test/option-group.test.ts index 5e8fb5b9f5261..e2f5cb9c21c3e 100644 --- a/packages/@aws-cdk/aws-rds/test/option-group.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/option-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import { DatabaseInstanceEngine, OptionGroup, OracleEngineVersion } from '../lib'; describe('option group', () => { diff --git a/packages/aws-cdk-lib/aws-rds/test/parameter-group.test.ts b/packages/aws-cdk-lib/aws-rds/test/parameter-group.test.ts new file mode 100644 index 0000000000000..7e3a8243e39f8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/test/parameter-group.test.ts @@ -0,0 +1,118 @@ +import { Template } from '../../assertions'; +import * as cdk from '../../core'; +import { DatabaseClusterEngine, ParameterGroup } from '../lib'; + +describe('parameter group', () => { + test("does not create a parameter group if it wasn't bound to a cluster or instance", () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'desc', + parameters: { + key: 'value', + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBParameterGroup', 0); + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 0); + }); + + test('create a parameter group when bound to an instance', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const parameterGroup = new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'desc', + parameters: { + key: 'value', + }, + }); + parameterGroup.bindToInstance({}); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBParameterGroup', { + Description: 'desc', + Family: 'aurora5.6', + Parameters: { + key: 'value', + }, + }); + }); + + test('create a parameter group when bound to a cluster', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const parameterGroup = new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'desc', + parameters: { + key: 'value', + }, + }); + parameterGroup.bindToCluster({}); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Description: 'desc', + Family: 'aurora5.6', + Parameters: { + key: 'value', + }, + }); + }); + + test('creates 2 parameter groups when bound to a cluster and an instance', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const parameterGroup = new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'desc', + parameters: { + key: 'value', + }, + }); + parameterGroup.bindToCluster({}); + parameterGroup.bindToInstance({}); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBParameterGroup', 1); + Template.fromStack(stack).resourceCountIs('AWS::RDS::DBClusterParameterGroup', 1); + }); + + test('Add an additional parameter to an existing parameter group', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const clusterParameterGroup = new ParameterGroup(stack, 'Params', { + engine: DatabaseClusterEngine.AURORA, + description: 'desc', + parameters: { + key1: 'value1', + }, + }); + clusterParameterGroup.bindToCluster({}); + + clusterParameterGroup.addParameter('key2', 'value2'); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::RDS::DBClusterParameterGroup', { + Description: 'desc', + Family: 'aurora5.6', + Parameters: { + key1: 'value1', + key2: 'value2', + }, + }); + }); +}); diff --git a/packages/@aws-cdk/aws-rds/test/proxy.test.ts b/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts similarity index 97% rename from packages/@aws-cdk/aws-rds/test/proxy.test.ts rename to packages/aws-cdk-lib/aws-rds/test/proxy.test.ts index 6d52115c667f2..1b9c7de783110 100644 --- a/packages/@aws-cdk/aws-rds/test/proxy.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/proxy.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import { AccountPrincipal, Role } from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import { AccountPrincipal, Role } from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as rds from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-rds/test/serverless-cluster-from-snapshot.test.ts b/packages/aws-cdk-lib/aws-rds/test/serverless-cluster-from-snapshot.test.ts similarity index 96% rename from packages/@aws-cdk/aws-rds/test/serverless-cluster-from-snapshot.test.ts rename to packages/aws-cdk-lib/aws-rds/test/serverless-cluster-from-snapshot.test.ts index 43c563491f807..9c289c472a4a9 100644 --- a/packages/@aws-cdk/aws-rds/test/serverless-cluster-from-snapshot.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/serverless-cluster-from-snapshot.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as kms from '../../aws-kms'; +import * as cdk from '../../core'; import { DatabaseClusterEngine, DatabaseSecret, ServerlessClusterFromSnapshot, SnapshotCredentials } from '../lib'; describe('serverless cluster from snapshot', () => { diff --git a/packages/@aws-cdk/aws-rds/test/serverless-cluster.test.ts b/packages/aws-cdk-lib/aws-rds/test/serverless-cluster.test.ts similarity index 99% rename from packages/@aws-cdk/aws-rds/test/serverless-cluster.test.ts rename to packages/aws-cdk-lib/aws-rds/test/serverless-cluster.test.ts index 19021f5a0fd8a..0cc1566e93464 100644 --- a/packages/@aws-cdk/aws-rds/test/serverless-cluster.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/serverless-cluster.test.ts @@ -1,9 +1,9 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template, Match } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import { AuroraPostgresEngineVersion, ServerlessCluster, DatabaseClusterEngine, ParameterGroup, AuroraCapacityUnit, DatabaseSecret, SubnetGroup } from '../lib'; describe('serverless cluster', () => { diff --git a/packages/aws-cdk-lib/aws-rds/test/snapshot-handler/index.ts b/packages/aws-cdk-lib/aws-rds/test/snapshot-handler/index.ts new file mode 100644 index 0000000000000..604e58bc99c55 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rds/test/snapshot-handler/index.ts @@ -0,0 +1,63 @@ +/* eslint-disable no-console */ +import * as AWSCDKAsyncCustomResource from '../../../custom-resources/lib/provider-framework/types'; +import { RDS } from 'aws-sdk'; // eslint-disable-line import/no-extraneous-dependencies + +export async function onEventHandler(event: AWSCDKAsyncCustomResource.OnEventRequest): Promise { + console.log('Event: %j', event); + + const rds = new RDS(); + + const physicalResourceId = `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`; + + if (event.RequestType === 'Create' || event.RequestType === 'Update') { + const data = await rds.createDBClusterSnapshot({ + DBClusterIdentifier: event.ResourceProperties.DBClusterIdentifier, + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + return { + PhysicalResourceId: physicalResourceId, + Data: { + DBClusterSnapshotArn: data.DBClusterSnapshot?.DBClusterSnapshotArn, + }, + }; + } + + if (event.RequestType === 'Delete') { + await rds.deleteDBClusterSnapshot({ + DBClusterSnapshotIdentifier: event.ResourceProperties.DBClusterSnapshotIdentifier, + }).promise(); + } + + return { + PhysicalResourceId: `${event.ResourceProperties.DBClusterIdentifier}-${event.ResourceProperties.DBClusterIdentifier}`, + }; +} + +export async function isCompleteHandler(event: AWSCDKAsyncCustomResource.IsCompleteRequest): Promise { + console.log('Event: %j', event); + + const snapshotStatus = await tryGetClusterSnapshotStatus(event.ResourceProperties.DBClusterSnapshotIdentifier); + + switch (event.RequestType) { + case 'Create': + case 'Update': + return { IsComplete: snapshotStatus === 'available' }; + case 'Delete': + return { IsComplete: snapshotStatus === undefined }; + } +} + +async function tryGetClusterSnapshotStatus(identifier: string): Promise { + try { + const rds = new RDS(); + const data = await rds.describeDBClusterSnapshots({ + DBClusterSnapshotIdentifier: identifier, + }).promise(); + return data.DBClusterSnapshots?.[0].Status; + } catch (err: any) { + if (err.code === 'DBClusterSnapshotNotFoundFault') { + return undefined; + } + throw err; + } +} diff --git a/packages/@aws-cdk/aws-rds/test/sql-server/sql-server.instance-engine.test.ts b/packages/aws-cdk-lib/aws-rds/test/sql-server/sql-server.instance-engine.test.ts similarity index 93% rename from packages/@aws-cdk/aws-rds/test/sql-server/sql-server.instance-engine.test.ts rename to packages/aws-cdk-lib/aws-rds/test/sql-server/sql-server.instance-engine.test.ts index a591dfd4a7bf1..675ed499c2d8f 100644 --- a/packages/@aws-cdk/aws-rds/test/sql-server/sql-server.instance-engine.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/sql-server/sql-server.instance-engine.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as core from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as core from '../../../core'; import * as rds from '../../lib'; describe('sql server instance engine', () => { diff --git a/packages/@aws-cdk/aws-rds/test/subnet-group.test.ts b/packages/aws-cdk-lib/aws-rds/test/subnet-group.test.ts similarity index 95% rename from packages/@aws-cdk/aws-rds/test/subnet-group.test.ts rename to packages/aws-cdk-lib/aws-rds/test/subnet-group.test.ts index 598873bbaa53a..9bbc5b5ec40b8 100644 --- a/packages/@aws-cdk/aws-rds/test/subnet-group.test.ts +++ b/packages/aws-cdk-lib/aws-rds/test/subnet-group.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import * as rds from '../lib'; let stack: cdk.Stack; diff --git a/packages/aws-cdk-lib/aws-redshift/.jsiirc.json b/packages/aws-cdk-lib/aws-redshift/.jsiirc.json new file mode 100644 index 0000000000000..6f24444197885 --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshift/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.redshift" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Redshift" + }, + "python": { + "module": "aws_cdk.aws_redshift" + } + } +} diff --git a/packages/aws-cdk-lib/aws-redshift/README.md b/packages/aws-cdk-lib/aws-redshift/README.md new file mode 100644 index 0000000000000..58fd8542a8800 --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshift/README.md @@ -0,0 +1,32 @@ +# Amazon Redshift Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as redshift from 'aws-cdk-lib/aws-redshift'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Redshift construct libraries](https://constructs.dev/search?q=redshift) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Redshift resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Redshift.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-redshift-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Redshift](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Redshift.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-redshift/index.ts b/packages/aws-cdk-lib/aws-redshift/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshift/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-redshift/lib/index.ts b/packages/aws-cdk-lib/aws-redshift/lib/index.ts new file mode 100644 index 0000000000000..134318a1dc98a --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshift/lib/index.ts @@ -0,0 +1 @@ +export * from './redshift.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-redshiftserverless/.jsiirc.json b/packages/aws-cdk-lib/aws-redshiftserverless/.jsiirc.json new file mode 100644 index 0000000000000..8ad2bbc0f38ec --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshiftserverless/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.RedshiftServerless" + }, + "java": { + "package": "software.amazon.awscdk.services.redshiftserverless" + }, + "python": { + "module": "aws_cdk.aws_redshiftserverless" + } + } +} diff --git a/packages/aws-cdk-lib/aws-redshiftserverless/README.md b/packages/aws-cdk-lib/aws-redshiftserverless/README.md new file mode 100644 index 0000000000000..2c4d77b5a20dc --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshiftserverless/README.md @@ -0,0 +1,27 @@ +# AWS::RedshiftServerless Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as redshiftserverless from 'aws-cdk-lib/aws-redshiftserverless'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for RedshiftServerless construct libraries](https://constructs.dev/search?q=redshiftserverless) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RedshiftServerless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RedshiftServerless.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RedshiftServerless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RedshiftServerless.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-redshiftserverless/index.ts b/packages/aws-cdk-lib/aws-redshiftserverless/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshiftserverless/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-redshiftserverless/lib/index.ts b/packages/aws-cdk-lib/aws-redshiftserverless/lib/index.ts new file mode 100644 index 0000000000000..f928ffdd1e288 --- /dev/null +++ b/packages/aws-cdk-lib/aws-redshiftserverless/lib/index.ts @@ -0,0 +1 @@ +export * from './redshiftserverless.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-refactorspaces/.jsiirc.json b/packages/aws-cdk-lib/aws-refactorspaces/.jsiirc.json new file mode 100644 index 0000000000000..495de2a33e6c1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-refactorspaces/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.RefactorSpaces" + }, + "java": { + "package": "software.amazon.awscdk.services.refactorspaces" + }, + "python": { + "module": "aws_cdk.aws_refactorspaces" + } + } +} diff --git a/packages/aws-cdk-lib/aws-refactorspaces/README.md b/packages/aws-cdk-lib/aws-refactorspaces/README.md new file mode 100644 index 0000000000000..fe407ef8f44c4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-refactorspaces/README.md @@ -0,0 +1,27 @@ +# AWS::RefactorSpaces Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as refactorspaces from 'aws-cdk-lib/aws-refactorspaces'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for RefactorSpaces construct libraries](https://constructs.dev/search?q=refactorspaces) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RefactorSpaces resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RefactorSpaces.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RefactorSpaces](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RefactorSpaces.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-refactorspaces/index.ts b/packages/aws-cdk-lib/aws-refactorspaces/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-refactorspaces/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-refactorspaces/lib/index.ts b/packages/aws-cdk-lib/aws-refactorspaces/lib/index.ts new file mode 100644 index 0000000000000..7b48a164c86c2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-refactorspaces/lib/index.ts @@ -0,0 +1 @@ +export * from './refactorspaces.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-rekognition/.jsiirc.json b/packages/aws-cdk-lib/aws-rekognition/.jsiirc.json new file mode 100644 index 0000000000000..ddda0bd6dc41e --- /dev/null +++ b/packages/aws-cdk-lib/aws-rekognition/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Rekognition" + }, + "java": { + "package": "software.amazon.awscdk.services.rekognition" + }, + "python": { + "module": "aws_cdk.aws_rekognition" + } + } +} diff --git a/packages/aws-cdk-lib/aws-rekognition/README.md b/packages/aws-cdk-lib/aws-rekognition/README.md new file mode 100644 index 0000000000000..47dadb5cd258a --- /dev/null +++ b/packages/aws-cdk-lib/aws-rekognition/README.md @@ -0,0 +1,27 @@ +# AWS::Rekognition Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as rekognition from 'aws-cdk-lib/aws-rekognition'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Rekognition construct libraries](https://constructs.dev/search?q=rekognition) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Rekognition resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Rekognition.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Rekognition](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Rekognition.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-rekognition/index.ts b/packages/aws-cdk-lib/aws-rekognition/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-rekognition/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-rekognition/lib/index.ts b/packages/aws-cdk-lib/aws-rekognition/lib/index.ts new file mode 100644 index 0000000000000..3528d5a7c9902 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rekognition/lib/index.ts @@ -0,0 +1 @@ +export * from './rekognition.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-resiliencehub/.jsiirc.json b/packages/aws-cdk-lib/aws-resiliencehub/.jsiirc.json new file mode 100644 index 0000000000000..0130bec1baf28 --- /dev/null +++ b/packages/aws-cdk-lib/aws-resiliencehub/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ResilienceHub" + }, + "java": { + "package": "software.amazon.awscdk.services.resiliencehub" + }, + "python": { + "module": "aws_cdk.aws_resiliencehub" + } + } +} diff --git a/packages/aws-cdk-lib/aws-resiliencehub/README.md b/packages/aws-cdk-lib/aws-resiliencehub/README.md new file mode 100644 index 0000000000000..fe583ad692021 --- /dev/null +++ b/packages/aws-cdk-lib/aws-resiliencehub/README.md @@ -0,0 +1,27 @@ +# AWS::ResilienceHub Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as resiliencehub from 'aws-cdk-lib/aws-resiliencehub'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ResilienceHub construct libraries](https://constructs.dev/search?q=resiliencehub) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ResilienceHub resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResilienceHub.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ResilienceHub](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResilienceHub.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-resiliencehub/index.ts b/packages/aws-cdk-lib/aws-resiliencehub/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-resiliencehub/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-resiliencehub/lib/index.ts b/packages/aws-cdk-lib/aws-resiliencehub/lib/index.ts new file mode 100644 index 0000000000000..13c740f289bab --- /dev/null +++ b/packages/aws-cdk-lib/aws-resiliencehub/lib/index.ts @@ -0,0 +1 @@ +export * from './resiliencehub.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-resourceexplorer2/.jsiirc.json b/packages/aws-cdk-lib/aws-resourceexplorer2/.jsiirc.json new file mode 100644 index 0000000000000..5470f55b0f21c --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourceexplorer2/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ResourceExplorer2" + }, + "java": { + "package": "software.amazon.awscdk.services.resourceexplorer2" + }, + "python": { + "module": "aws_cdk.aws_resourceexplorer2" + } + } +} diff --git a/packages/aws-cdk-lib/aws-resourceexplorer2/README.md b/packages/aws-cdk-lib/aws-resourceexplorer2/README.md new file mode 100644 index 0000000000000..3343e3446e389 --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourceexplorer2/README.md @@ -0,0 +1,27 @@ +# AWS::ResourceExplorer2 Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as resourceexplorer2 from 'aws-cdk-lib/aws-resourceexplorer2'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ResourceExplorer2 construct libraries](https://constructs.dev/search?q=resourceexplorer2) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ResourceExplorer2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceExplorer2.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ResourceExplorer2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceExplorer2.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-resourceexplorer2/index.ts b/packages/aws-cdk-lib/aws-resourceexplorer2/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourceexplorer2/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-resourceexplorer2/lib/index.ts b/packages/aws-cdk-lib/aws-resourceexplorer2/lib/index.ts new file mode 100644 index 0000000000000..8c5d9ce368aa3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourceexplorer2/lib/index.ts @@ -0,0 +1 @@ +export * from './resourceexplorer2.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-resourcegroups/.jsiirc.json b/packages/aws-cdk-lib/aws-resourcegroups/.jsiirc.json new file mode 100644 index 0000000000000..427543cbfdb9b --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourcegroups/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.ResourceGroups" + }, + "java": { + "package": "software.amazon.awscdk.services.resourcegroups" + }, + "python": { + "module": "aws_cdk.aws_resourcegroups" + } + } +} diff --git a/packages/aws-cdk-lib/aws-resourcegroups/README.md b/packages/aws-cdk-lib/aws-resourcegroups/README.md new file mode 100644 index 0000000000000..cc5df165e7f9e --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourcegroups/README.md @@ -0,0 +1,27 @@ +# AWS::ResourceGroups Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as resourcegroups from 'aws-cdk-lib/aws-resourcegroups'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ResourceGroups construct libraries](https://constructs.dev/search?q=resourcegroups) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ResourceGroups resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceGroups.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ResourceGroups](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ResourceGroups.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-resourcegroups/index.ts b/packages/aws-cdk-lib/aws-resourcegroups/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourcegroups/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-resourcegroups/lib/index.ts b/packages/aws-cdk-lib/aws-resourcegroups/lib/index.ts new file mode 100644 index 0000000000000..0abe0fb829f7a --- /dev/null +++ b/packages/aws-cdk-lib/aws-resourcegroups/lib/index.ts @@ -0,0 +1 @@ +export * from './resourcegroups.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-robomaker/.jsiirc.json b/packages/aws-cdk-lib/aws-robomaker/.jsiirc.json new file mode 100644 index 0000000000000..30fac02f6ef0c --- /dev/null +++ b/packages/aws-cdk-lib/aws-robomaker/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.RoboMaker" + }, + "java": { + "package": "software.amazon.awscdk.services.robomaker" + }, + "python": { + "module": "aws_cdk.aws_robomaker" + } + } +} diff --git a/packages/aws-cdk-lib/aws-robomaker/README.md b/packages/aws-cdk-lib/aws-robomaker/README.md new file mode 100644 index 0000000000000..9b19e82dcf49e --- /dev/null +++ b/packages/aws-cdk-lib/aws-robomaker/README.md @@ -0,0 +1,27 @@ +# AWS RoboMaker Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as robomaker from 'aws-cdk-lib/aws-robomaker'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for RoboMaker construct libraries](https://constructs.dev/search?q=robomaker) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RoboMaker resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RoboMaker.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RoboMaker](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RoboMaker.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-robomaker/index.ts b/packages/aws-cdk-lib/aws-robomaker/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-robomaker/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-robomaker/lib/index.ts b/packages/aws-cdk-lib/aws-robomaker/lib/index.ts new file mode 100644 index 0000000000000..cd1acc8fa96fe --- /dev/null +++ b/packages/aws-cdk-lib/aws-robomaker/lib/index.ts @@ -0,0 +1 @@ +export * from './robomaker.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-rolesanywhere/.jsiirc.json b/packages/aws-cdk-lib/aws-rolesanywhere/.jsiirc.json new file mode 100644 index 0000000000000..9c4293a70bea7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rolesanywhere/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.RolesAnywhere" + }, + "java": { + "package": "software.amazon.awscdk.services.rolesanywhere" + }, + "python": { + "module": "aws_cdk.aws_rolesanywhere" + } + } +} diff --git a/packages/aws-cdk-lib/aws-rolesanywhere/README.md b/packages/aws-cdk-lib/aws-rolesanywhere/README.md new file mode 100644 index 0000000000000..d45a3e7667686 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rolesanywhere/README.md @@ -0,0 +1,27 @@ +# AWS::RolesAnywhere Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as rolesanywhere from 'aws-cdk-lib/aws-rolesanywhere'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for RolesAnywhere construct libraries](https://constructs.dev/search?q=rolesanywhere) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RolesAnywhere resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RolesAnywhere.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RolesAnywhere](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RolesAnywhere.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-rolesanywhere/index.ts b/packages/aws-cdk-lib/aws-rolesanywhere/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-rolesanywhere/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-rolesanywhere/lib/index.ts b/packages/aws-cdk-lib/aws-rolesanywhere/lib/index.ts new file mode 100644 index 0000000000000..8d24150ec0cef --- /dev/null +++ b/packages/aws-cdk-lib/aws-rolesanywhere/lib/index.ts @@ -0,0 +1 @@ +export * from './rolesanywhere.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-route53-patterns/.jsiirc.json b/packages/aws-cdk-lib/aws-route53-patterns/.jsiirc.json new file mode 100644 index 0000000000000..38e6a282f08d0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-patterns/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.route53.patterns" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Route53.Patterns" + }, + "python": { + "module": "aws_cdk.aws_route53_patterns" + } + } +} diff --git a/packages/aws-cdk-lib/aws-route53-patterns/README.md b/packages/aws-cdk-lib/aws-route53-patterns/README.md new file mode 100644 index 0000000000000..93eb92bc8cf9a --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-patterns/README.md @@ -0,0 +1,74 @@ +# CDK Construct library for higher-level Route 53 Constructs + + +This library provides higher-level Amazon Route 53 constructs which follow common +architectural patterns. + +## HTTPS Redirect + +If you want to speed up delivery of your web content, you can use Amazon CloudFront, +the AWS content delivery network (CDN). CloudFront can deliver your entire website +—including dynamic, static, streaming, and interactive content—by using a global +network of edge locations. Requests for your content are automatically routed to the +edge location that gives your users the lowest latency. + +This construct allows creating a redirect from domainA to domainB using Amazon +CloudFront and Amazon S3. You can specify multiple domains to be redirected. +[Learn more](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html) about routing traffic to a CloudFront web distribution. + +The `HttpsRedirect` constructs creates: + +* Amazon CloudFront distribution - makes website available from data centres + around the world +* Amazon S3 bucket - empty bucket used for website hosting redirect (`websiteRedirect`) capabilities. +* Amazon Route 53 A/AAAA Alias records - routes traffic to the CloudFront distribution +* AWS Certificate Manager certificate - SSL/TLS certificate used by + CloudFront for your domain + +⚠️ The stack/construct can be used in any region for configuring an HTTPS redirect. +The certificate created in Amazon Certificate Manager (ACM) will be in US East (N. Virginia) +region. If you use an existing certificate, the AWS region of the certificate +must be in US East (N. Virginia). + +The following example creates an HTTPS redirect from `foo.example.com` to `bar.example.com` +As an existing certificate is not provided, one will be created in `us-east-1` by the CDK. + +```ts +new patterns.HttpsRedirect(this, 'Redirect', { + recordNames: ['foo.example.com'], + targetDomain: 'bar.example.com', + zone: route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), +}); +``` + +To have `HttpsRedirect` use the `Certificate` construct as the default +created certificate instead of the deprecated `DnsValidatedCertificate` +construct, enable the `@aws-cdk/aws-route53-patters:useCertificate` +feature flag. If you are creating the stack in a region other than `us-east-1` +you must also enable `crossRegionReferences` on the stack. + +```ts +declare const app: App; +const stack = new Stack(app, 'Stack', { + crossRegionReferences: true, + env: { + region: 'us-east-2', + }, +}); + +new patterns.HttpsRedirect(this, 'Redirect', { + recordNames: ['foo.example.com'], + targetDomain: 'bar.example.com', + zone: route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), +}); +``` + +It is safe to upgrade to `@aws-cdk/aws-route53-patterns:useCertificate` since +the new certificate will be created and updated on the CloudFront distribution +before the old certificate is deleted. diff --git a/packages/aws-cdk-lib/aws-route53-patterns/index.ts b/packages/aws-cdk-lib/aws-route53-patterns/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-patterns/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-route53-patterns/lib/index.ts b/packages/aws-cdk-lib/aws-route53-patterns/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-route53-patterns/lib/index.ts rename to packages/aws-cdk-lib/aws-route53-patterns/lib/index.ts diff --git a/packages/@aws-cdk/aws-route53-patterns/lib/website-redirect.ts b/packages/aws-cdk-lib/aws-route53-patterns/lib/website-redirect.ts similarity index 93% rename from packages/@aws-cdk/aws-route53-patterns/lib/website-redirect.ts rename to packages/aws-cdk-lib/aws-route53-patterns/lib/website-redirect.ts index dfb2e44be5c7b..c75242d9d1e4c 100644 --- a/packages/@aws-cdk/aws-route53-patterns/lib/website-redirect.ts +++ b/packages/aws-cdk-lib/aws-route53-patterns/lib/website-redirect.ts @@ -1,11 +1,11 @@ -import { DnsValidatedCertificate, ICertificate, Certificate, CertificateValidation } from '@aws-cdk/aws-certificatemanager'; -import { CloudFrontWebDistribution, OriginProtocolPolicy, PriceClass, ViewerCertificate, ViewerProtocolPolicy } from '@aws-cdk/aws-cloudfront'; -import { ARecord, AaaaRecord, IHostedZone, RecordTarget } from '@aws-cdk/aws-route53'; -import { CloudFrontTarget } from '@aws-cdk/aws-route53-targets'; -import { BlockPublicAccess, Bucket, RedirectProtocol } from '@aws-cdk/aws-s3'; -import { ArnFormat, RemovalPolicy, Stack, Token, FeatureFlags } from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; -import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '@aws-cdk/cx-api'; +import { DnsValidatedCertificate, ICertificate, Certificate, CertificateValidation } from '../../aws-certificatemanager'; +import { CloudFrontWebDistribution, OriginProtocolPolicy, PriceClass, ViewerCertificate, ViewerProtocolPolicy } from '../../aws-cloudfront'; +import { ARecord, AaaaRecord, IHostedZone, RecordTarget } from '../../aws-route53'; +import { CloudFrontTarget } from '../../aws-route53-targets'; +import { BlockPublicAccess, Bucket, RedirectProtocol } from '../../aws-s3'; +import { ArnFormat, RemovalPolicy, Stack, Token, FeatureFlags } from '../../core'; +import { md5hash } from '../../core/lib/helpers-internal'; +import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '../../cx-api'; import { Construct } from 'constructs'; /** diff --git a/packages/aws-cdk-lib/aws-route53-patterns/test/bucket-website-target.test.ts b/packages/aws-cdk-lib/aws-route53-patterns/test/bucket-website-target.test.ts new file mode 100644 index 0000000000000..1b37792b06666 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-patterns/test/bucket-website-target.test.ts @@ -0,0 +1,297 @@ +import { Template } from '../../assertions'; +import { Certificate } from '../../aws-certificatemanager'; +import { HostedZone } from '../../aws-route53'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { App, Stack } from '../../core'; +import { ROUTE53_PATTERNS_USE_CERTIFICATE } from '../../cx-api'; +import { HttpsRedirect } from '../lib'; + +testDeprecated('create HTTPS redirect', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); + + // WHEN + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com', 'baz.example.com'], + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + WebsiteConfiguration: { + RedirectAllRequestsTo: { + HostName: 'bar.example.com', + Protocol: 'https', + }, + }, + PublicAccessBlockConfiguration: { + BlockPublicAcls: true, + BlockPublicPolicy: true, + IgnorePublicAcls: true, + RestrictPublicBuckets: true, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { + DistributionConfig: { + Aliases: ['foo.example.com', 'baz.example.com'], + DefaultRootObject: '', + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Type: 'A', + Name: 'foo.example.com.', + HostedZoneId: 'ID', + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Type: 'AAAA', + Name: 'foo.example.com.', + HostedZoneId: 'ID', + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Type: 'A', + Name: 'baz.example.com.', + HostedZoneId: 'ID', + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Type: 'AAAA', + Name: 'baz.example.com.', + HostedZoneId: 'ID', + }); +}); + +testDeprecated('create HTTPS redirect for apex', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); + + // WHEN + new HttpsRedirect(stack, 'Redirect', { + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + WebsiteConfiguration: { + RedirectAllRequestsTo: { + HostName: 'bar.example.com', + Protocol: 'https', + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Type: 'A', + Name: 'example.com.', + }); + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + Type: 'AAAA', + Name: 'example.com.', + }); +}); + +testDeprecated('create HTTPS redirect with existing cert', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); + + // WHEN + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com'], + certificate: Certificate.fromCertificateArn( + stack, 'Certificate', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', + ), + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + WebsiteConfiguration: { + RedirectAllRequestsTo: { + HostName: 'bar.example.com', + Protocol: 'https', + }, + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { + DistributionConfig: { + ViewerCertificate: { + AcmCertificateArn: 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d', + }, + }, + }); +}); + +test('throws when certificate in region other than us-east-1 is supplied', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); + const certificate = Certificate.fromCertificateArn( + stack, 'Certificate', 'arn:aws:acm:us-east-2:123456789012:certificate/11-3336f1-44483d-adc7-9cd375c5169d', + ); + + // WHEN / THEN + expect(() => { + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com'], + certificate, + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + }).toThrow(/The certificate must be in the us-east-1 region and the certificate you provided is in us-east-2./); +}); + +describe('Uses Certificate when @aws-cdk/aws-route53-patters:useCertificate=true', () => { + test('explicit different region', () => { + // GIVEN + const app = new App({ + context: { + [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, + }, + }); + + // WHEN + const stack = new Stack(app, 'test', { env: { region: 'us-east-2' }, crossRegionReferences: true }); + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com'], + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + // THEN + const certStack = app.node.findChild(`certificate-redirect-stack-${stack.node.addr}`) as Stack; + Template.fromStack(certStack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: 'foo.example.com', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { + DistributionConfig: { + ViewerCertificate: { + AcmCertificateArn: { + 'Fn::GetAtt': [ + 'ExportsReader8B249524', + '/cdk/exports/test/certificateredirectstackc8e2763df63c0f7e0c9afe0394e299bb731e281e8euseast1RefRedirectCertificatec8693e36481e135aa76e35c2db892ec6a33a94c7461E1B6E15A36EB7DA', + ], + }, + }, + }, + }); + }); + + test('explicit same region', () => { + // GIVEN + const app = new App({ + context: { + [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, + }, + }); + + // WHEN + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' }, crossRegionReferences: true }); + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com'], + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + // THEN + const certStack = app.node.tryFindChild(`certificate-redirect-stack-${stack.node.addr}`); + expect(certStack).toBeUndefined(); + Template.fromStack(stack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: 'foo.example.com', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', { + DistributionConfig: { + ViewerCertificate: { + AcmCertificateArn: { + Ref: 'RedirectRedirectCertificateB4F2F130', + }, + }, + }, + }); + }); + + test('same support stack used for multiple certificates', () => { + // GIVEN + const app = new App({ + context: { + [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, + }, + }); + + // WHEN + const stack = new Stack(app, 'test', { env: { region: 'us-east-2' }, crossRegionReferences: true }); + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com'], + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + new HttpsRedirect(stack, 'Redirect2', { + recordNames: ['foo2.example.com'], + targetDomain: 'bar2.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone2', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + // THEN + const certStack = app.node.tryFindChild(`certificate-redirect-stack-${stack.node.addr}`) as Stack; + Template.fromStack(certStack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: 'foo.example.com', + }); + Template.fromStack(certStack).hasResourceProperties('AWS::CertificateManager::Certificate', { + DomainName: 'foo2.example.com', + }); + }); + + test('unresolved region throws', () => { + // GIVEN + const app = new App({ + context: { + [ROUTE53_PATTERNS_USE_CERTIFICATE]: true, + }, + }); + + // WHEN + const stack = new Stack(app, 'test'); + + // THEN + expect(() => { + new HttpsRedirect(stack, 'Redirect', { + recordNames: ['foo.example.com'], + targetDomain: 'bar.example.com', + zone: HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'ID', + zoneName: 'example.com', + }), + }); + + }).toThrow(/When @aws-cdk\/aws-route53-patters:useCertificate is enabled, a region must be defined on the Stack/); + }); +}); diff --git a/packages/aws-cdk-lib/aws-route53-targets/.jsiirc.json b/packages/aws-cdk-lib/aws-route53-targets/.jsiirc.json new file mode 100644 index 0000000000000..05321cb3a53fb --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-targets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.route53.targets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Route53.Targets" + }, + "python": { + "module": "aws_cdk.aws_route53_targets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-route53-targets/README.md b/packages/aws-cdk-lib/aws-route53-targets/README.md new file mode 100644 index 0000000000000..1d745b5ef6c7a --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-targets/README.md @@ -0,0 +1,181 @@ +# Route53 Alias Record Targets for the CDK Route53 Library + + +This library contains Route53 Alias Record targets for: + +* API Gateway custom domains + + ```ts + import * as apigw from 'aws-cdk-lib/aws-apigateway'; + + declare const zone: route53.HostedZone; + declare const restApi: apigw.LambdaRestApi; + + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.ApiGateway(restApi)), + // or - route53.RecordTarget.fromAlias(new alias.ApiGatewayDomain(domainName)), + }); + ``` + +* API Gateway V2 custom domains + + ```ts + import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2'; + + declare const zone: route53.HostedZone; + declare const domainName: apigwv2.DomainName; + + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.ApiGatewayv2DomainProperties(domainName.regionalDomainName, domainName.regionalHostedZoneId)), + }); + ``` + +* CloudFront distributions + + ```ts + import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; + + declare const zone: route53.HostedZone; + declare const distribution: cloudfront.CloudFrontWebDistribution; + + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), + }); + ``` + +* ELBv2 load balancers + + ```ts + import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; + + declare const zone: route53.HostedZone; + declare const lb: elbv2.ApplicationLoadBalancer; + + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.LoadBalancerTarget(lb)), + // or - route53.RecordTarget.fromAlias(new targets.ApiGatewayDomain(domainName)), + }); + ``` + +* Classic load balancers + + ```ts + import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; + + declare const zone: route53.HostedZone; + declare const lb: elb.LoadBalancer; + + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.ClassicLoadBalancerTarget(lb)), + // or - route53.RecordTarget.fromAlias(new alias.ApiGatewayDomain(domainName)), + }); + ``` + +**Important:** Based on [AWS documentation](https://aws.amazon.com/de/premiumsupport/knowledge-center/alias-resource-record-set-route53-cli/), all alias record in Route 53 that points to a Elastic Load Balancer will always include *dualstack* for the DNSName to resolve IPv4/IPv6 addresses (without *dualstack* IPv6 will not resolve). + +For example, if the Amazon-provided DNS for the load balancer is `ALB-xxxxxxx.us-west-2.elb.amazonaws.com`, CDK will create alias target in Route 53 will be `dualstack.ALB-xxxxxxx.us-west-2.elb.amazonaws.com`. + +* GlobalAccelerator + + ```ts + import * as globalaccelerator from 'aws-cdk-lib/aws-globalaccelerator'; + + declare const zone: route53.HostedZone; + declare const accelerator: globalaccelerator.Accelerator; + + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.GlobalAcceleratorTarget(accelerator)), + // or - route53.RecordTarget.fromAlias(new targets.GlobalAcceleratorDomainTarget('xyz.awsglobalaccelerator.com')), + }); + ``` + +**Important:** If you use GlobalAcceleratorDomainTarget, passing a string rather than an instance of IAccelerator, ensure that the string is a valid domain name of an existing Global Accelerator instance. +See [the documentation on DNS addressing](https://docs.aws.amazon.com/global-accelerator/latest/dg/dns-addressing-custom-domains.dns-addressing.html) with Global Accelerator for more info. + +* InterfaceVpcEndpoints + +**Important:** Based on the CFN docs for VPCEndpoints - [see here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#aws-resource-ec2-vpcendpoint-return-values) - the attributes returned for DnsEntries in CloudFormation is a combination of the hosted zone ID and the DNS name. The entries are ordered as follows: regional public DNS, zonal public DNS, private DNS, and wildcard DNS. This order is not enforced for AWS Marketplace services, and therefore this CDK construct is ONLY guaranteed to work with non-marketplace services. + + ```ts + import * as ec2 from 'aws-cdk-lib/aws-ec2'; + + declare const zone: route53.HostedZone; + declare const interfaceVpcEndpoint: ec2.InterfaceVpcEndpoint; + + new route53.ARecord(this, "AliasRecord", { + zone, + target: route53.RecordTarget.fromAlias(new targets.InterfaceVpcEndpointTarget(interfaceVpcEndpoint)), + }); + ``` + +* S3 Bucket Website: + +**Important:** The Bucket name must strictly match the full DNS name. +See [the Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) for more info. + + ```ts + import * as s3 from 'aws-cdk-lib/aws-s3'; + + const recordName = 'www'; + const domainName = 'example.com'; + + const bucketWebsite = new s3.Bucket(this, 'BucketWebsite', { + bucketName: [recordName, domainName].join('.'), // www.example.com + publicReadAccess: true, + websiteIndexDocument: 'index.html', + }); + + const zone = route53.HostedZone.fromLookup(this, 'Zone', {domainName}); // example.com + + new route53.ARecord(this, 'AliasRecord', { + zone, + recordName, // www + target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), + }); + ``` + +* User pool domain + + ```ts + import * as cognito from 'aws-cdk-lib/aws-cognito'; + + declare const zone: route53.HostedZone; + declare const domain: cognito.UserPoolDomain; + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.UserPoolDomainTarget(domain)), + }); + ``` + +* Route 53 record + + ```ts + declare const zone: route53.HostedZone; + declare const record: route53.ARecord; + new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.Route53RecordTarget(record)), + }); + ``` + +* Elastic Beanstalk environment: + +**Important:** Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint. + +```ts +declare const zone: route53.HostedZone; +declare const ebsEnvironmentUrl: string; + +new route53.ARecord(this, 'AliasRecord', { + zone, + target: route53.RecordTarget.fromAlias(new targets.ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl)), +}); +``` + +See the documentation of `@aws-cdk/aws-route53` for more information. diff --git a/packages/aws-cdk-lib/aws-route53-targets/index.ts b/packages/aws-cdk-lib/aws-route53-targets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-targets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-route53-targets/lib/api-gateway-domain-name.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/api-gateway-domain-name.ts similarity index 91% rename from packages/@aws-cdk/aws-route53-targets/lib/api-gateway-domain-name.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/api-gateway-domain-name.ts index 0cc215d5c5eed..5e20b107156db 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/api-gateway-domain-name.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/api-gateway-domain-name.ts @@ -1,5 +1,5 @@ -import * as apig from '@aws-cdk/aws-apigateway'; -import * as route53 from '@aws-cdk/aws-route53'; +import * as apig from '../../aws-apigateway'; +import * as route53 from '../../aws-route53'; /** * Defines an API Gateway domain name as the alias target. diff --git a/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/api-gatewayv2-domain-name.ts similarity index 93% rename from packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/api-gatewayv2-domain-name.ts index 962315ed2ab8c..0fba33822c24c 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/api-gatewayv2-domain-name.ts @@ -1,4 +1,4 @@ -import * as route53 from '@aws-cdk/aws-route53'; +import * as route53 from '../../aws-route53'; /** * Defines an API Gateway V2 domain name as the alias target. diff --git a/packages/@aws-cdk/aws-route53-targets/lib/bucket-website-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/bucket-website-target.ts similarity index 83% rename from packages/@aws-cdk/aws-route53-targets/lib/bucket-website-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/bucket-website-target.ts index a4497826828f1..baf0df131eb7d 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/bucket-website-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/bucket-website-target.ts @@ -1,7 +1,7 @@ -import * as route53 from '@aws-cdk/aws-route53'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack, Token } from '@aws-cdk/core'; -import { RegionInfo } from '@aws-cdk/region-info'; +import * as route53 from '../../aws-route53'; +import * as s3 from '../../aws-s3'; +import { Stack, Token } from '../../core'; +import { RegionInfo } from '../../region-info'; /** * Use a S3 as an alias record target diff --git a/packages/@aws-cdk/aws-route53-targets/lib/classic-load-balancer-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/classic-load-balancer-target.ts similarity index 81% rename from packages/@aws-cdk/aws-route53-targets/lib/classic-load-balancer-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/classic-load-balancer-target.ts index 54bf900b1f6c8..44b739fb89c91 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/classic-load-balancer-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/classic-load-balancer-target.ts @@ -1,5 +1,5 @@ -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as route53 from '@aws-cdk/aws-route53'; +import * as elb from '../../aws-elasticloadbalancing'; +import * as route53 from '../../aws-route53'; /** * Use a classic ELB as an alias record target diff --git a/packages/@aws-cdk/aws-route53-targets/lib/cloudfront-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/cloudfront-target.ts similarity index 90% rename from packages/@aws-cdk/aws-route53-targets/lib/cloudfront-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/cloudfront-target.ts index ec755114bfc5c..b50dd2d41c2bd 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/cloudfront-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/cloudfront-target.ts @@ -1,6 +1,6 @@ -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Aws, CfnMapping, Stack } from '@aws-cdk/core'; +import * as cloudfront from '../../aws-cloudfront'; +import * as route53 from '../../aws-route53'; +import { Aws, CfnMapping, Stack } from '../../core'; import { IConstruct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts similarity index 91% rename from packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts index 255114b773854..8f093a8547398 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/elastic-beanstalk-environment-target.ts @@ -1,6 +1,6 @@ -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; -import { RegionInfo } from '@aws-cdk/region-info'; +import * as route53 from '../../aws-route53'; +import * as cdk from '../../core'; +import { RegionInfo } from '../../region-info'; /** * Use an Elastic Beanstalk environment URL as an alias record target. diff --git a/packages/@aws-cdk/aws-route53-targets/lib/global-accelerator-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/global-accelerator-target.ts similarity index 90% rename from packages/@aws-cdk/aws-route53-targets/lib/global-accelerator-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/global-accelerator-target.ts index e9093265ea228..45161e5549b4b 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/global-accelerator-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/global-accelerator-target.ts @@ -1,5 +1,5 @@ -import * as globalaccelerator from '@aws-cdk/aws-globalaccelerator'; -import * as route53 from '@aws-cdk/aws-route53'; +import * as globalaccelerator from '../../aws-globalaccelerator'; +import * as route53 from '../../aws-route53'; /** diff --git a/packages/@aws-cdk/aws-route53-targets/lib/index.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-route53-targets/lib/index.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/index.ts diff --git a/packages/@aws-cdk/aws-route53-targets/lib/interface-vpc-endpoint-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/interface-vpc-endpoint-target.ts similarity index 84% rename from packages/@aws-cdk/aws-route53-targets/lib/interface-vpc-endpoint-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/interface-vpc-endpoint-target.ts index c19bf781fa10f..4153f6ac41185 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/interface-vpc-endpoint-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/interface-vpc-endpoint-target.ts @@ -1,6 +1,6 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as route53 from '../../aws-route53'; +import * as cdk from '../../core'; /** * Set an InterfaceVpcEndpoint as a target for an ARecord diff --git a/packages/@aws-cdk/aws-route53-targets/lib/load-balancer-target.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/load-balancer-target.ts similarity index 80% rename from packages/@aws-cdk/aws-route53-targets/lib/load-balancer-target.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/load-balancer-target.ts index d3bb10280690e..d19fb34b5a0ca 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/load-balancer-target.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/load-balancer-target.ts @@ -1,5 +1,5 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as route53 from '@aws-cdk/aws-route53'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as route53 from '../../aws-route53'; /** * Use an ELBv2 as an alias record target diff --git a/packages/@aws-cdk/aws-route53-targets/lib/route53-record.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/route53-record.ts similarity index 91% rename from packages/@aws-cdk/aws-route53-targets/lib/route53-record.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/route53-record.ts index e8a042c7e287c..1235a04ee0d61 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/route53-record.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/route53-record.ts @@ -1,4 +1,4 @@ -import * as route53 from '@aws-cdk/aws-route53'; +import * as route53 from '../../aws-route53'; /** * Use another Route 53 record as an alias record target diff --git a/packages/@aws-cdk/aws-route53-targets/lib/userpool-domain.ts b/packages/aws-cdk-lib/aws-route53-targets/lib/userpool-domain.ts similarity index 84% rename from packages/@aws-cdk/aws-route53-targets/lib/userpool-domain.ts rename to packages/aws-cdk-lib/aws-route53-targets/lib/userpool-domain.ts index a4e5c585f8927..36c3bfe529184 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/userpool-domain.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/lib/userpool-domain.ts @@ -1,5 +1,5 @@ -import { UserPoolDomain } from '@aws-cdk/aws-cognito'; -import { AliasRecordTargetConfig, IAliasRecordTarget, IHostedZone, IRecordSet } from '@aws-cdk/aws-route53'; +import { UserPoolDomain } from '../../aws-cognito'; +import { AliasRecordTargetConfig, IAliasRecordTarget, IHostedZone, IRecordSet } from '../../aws-route53'; import { CloudFrontTarget } from './cloudfront-target'; /** diff --git a/packages/@aws-cdk/aws-route53-targets/test/apigateway-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/apigateway-target.test.ts similarity index 94% rename from packages/@aws-cdk/aws-route53-targets/test/apigateway-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/apigateway-target.test.ts index f1561bd336d34..25e775435ae20 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/apigateway-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/apigateway-target.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as apigw from '@aws-cdk/aws-apigateway'; -import * as acm from '@aws-cdk/aws-certificatemanager'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as apigw from '../../aws-apigateway'; +import * as acm from '../../aws-certificatemanager'; +import * as route53 from '../../aws-route53'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('targets.ApiGateway can be used to the default domain of an APIGW', () => { diff --git a/packages/aws-cdk-lib/aws-route53-targets/test/bucket-website-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/bucket-website-target.test.ts new file mode 100644 index 0000000000000..7345f877aec3c --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53-targets/test/bucket-website-target.test.ts @@ -0,0 +1,95 @@ +import { Template } from '../../assertions'; +import * as route53 from '../../aws-route53'; +import * as s3 from '../../aws-s3'; +import { App, Stack } from '../../core'; +import * as targets from '../lib'; + +const [recordName, zoneName] = ['foo', 'test.public']; +const bucketName = [recordName, zoneName].join('.'); + +test('use S3 bucket website as record target', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); + + const bucketWebsite = new s3.Bucket(stack, 'Bucket', { bucketName }); + + // WHEN + const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); + new route53.ARecord(zone, 'Alias', { + zone, + recordName, + target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + AliasTarget: { + DNSName: 's3-website-us-east-1.amazonaws.com', + HostedZoneId: 'Z3AQBSTGFYJSTF', + }, + }); +}); + +test('use S3 bucket website as record target (fromBucketName)', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'us-east-1' } }); + + const bucketWebsite = s3.Bucket.fromBucketName(stack, 'Bucket', bucketName); + + // WHEN + const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); + new route53.ARecord(zone, 'Alias', { + zone, + recordName, + target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Route53::RecordSet', { + AliasTarget: { + DNSName: 's3-website-us-east-1.amazonaws.com', + HostedZoneId: 'Z3AQBSTGFYJSTF', + }, + }); +}); + +test('throws if region agnostic', () => { + // GIVEN + const stack = new Stack(); + + const bucketWebsite = new s3.Bucket(stack, 'Bucket', { bucketName }); + + // WHEN + const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); + + // THEN + expect(() => { + new route53.ARecord(zone, 'Alias', { + zone, + recordName, + target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), + }); + }).toThrow(/Cannot use an S3 record alias in region-agnostic stacks/); +}); + +test('throws if bucket website hosting is unavailable (cn-north-1)', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'test', { env: { region: 'cn-north-1' } }); + + const bucketWebsite = new s3.Bucket(stack, 'Bucket'); + + // WHEN + const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName }); + + // THEN + expect(() => { + new route53.ARecord(zone, 'Alias', { + zone, + recordName, + target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)), + }); + }).toThrow(/Bucket website target is not supported/); +}); diff --git a/packages/@aws-cdk/aws-route53-targets/test/classic-load-balancer-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/classic-load-balancer-target.test.ts similarity index 78% rename from packages/@aws-cdk/aws-route53-targets/test/classic-load-balancer-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/classic-load-balancer-target.test.ts index afeeb7640cd65..cf3cdfbd036b1 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/classic-load-balancer-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/classic-load-balancer-target.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elb from '@aws-cdk/aws-elasticloadbalancing'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elb from '../../aws-elasticloadbalancing'; +import * as route53 from '../../aws-route53'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('use classic ELB as record target', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/cloudfront-target.test.ts similarity index 90% rename from packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/cloudfront-target.test.ts index 321726a893eec..377b9867166fe 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/cloudfront-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/cloudfront-target.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as route53 from '@aws-cdk/aws-route53'; -import * as s3 from '@aws-cdk/aws-s3'; -import { NestedStack, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudfront from '../../aws-cloudfront'; +import * as route53 from '../../aws-route53'; +import * as s3 from '../../aws-s3'; +import { NestedStack, Stack } from '../../core'; import * as targets from '../lib'; test('use CloudFrontTarget partition hosted zone id mapping', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts similarity index 91% rename from packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts index a60fd9be58d5b..52b5367e3d653 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/elastic-beanstalk-environment-target.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as route53 from '../../aws-route53'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('use EBS environment as record target', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/global-accelerator-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/global-accelerator-target.test.ts similarity index 90% rename from packages/@aws-cdk/aws-route53-targets/test/global-accelerator-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/global-accelerator-target.test.ts index 0dc473d38c352..b0fcffcc7a712 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/global-accelerator-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/global-accelerator-target.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as globalaccelerator from '@aws-cdk/aws-globalaccelerator'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as globalaccelerator from '../../aws-globalaccelerator'; +import * as route53 from '../../aws-route53'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('GlobalAcceleratorTarget exposes a public constant of the zone id', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/interface-vpc-endpoint-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/interface-vpc-endpoint-target.test.ts similarity index 90% rename from packages/@aws-cdk/aws-route53-targets/test/interface-vpc-endpoint-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/interface-vpc-endpoint-target.test.ts index bcec3e3459a3a..d3caf6e81fb57 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/interface-vpc-endpoint-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/interface-vpc-endpoint-target.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as route53 from '../../aws-route53'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('use InterfaceVpcEndpoint as record target', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/load-balancer-target.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/load-balancer-target.test.ts similarity index 78% rename from packages/@aws-cdk/aws-route53-targets/test/load-balancer-target.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/load-balancer-target.test.ts index 00c3b1dde24ed..0db2e602de79d 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/load-balancer-target.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/load-balancer-target.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import * as route53 from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as route53 from '../../aws-route53'; +import { Stack } from '../../core'; import * as targets from '../lib'; test('use ALB as record target', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/route53-record.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/route53-record.test.ts similarity index 81% rename from packages/@aws-cdk/aws-route53-targets/test/route53-record.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/route53-record.test.ts index e4940198a6927..32ef862e2793e 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/route53-record.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/route53-record.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { ARecord, PublicHostedZone, RecordTarget } from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { ARecord, PublicHostedZone, RecordTarget } from '../../aws-route53'; +import { Stack } from '../../core'; import { Route53RecordTarget } from '../lib'; test('use another route 53 record as record target', () => { diff --git a/packages/@aws-cdk/aws-route53-targets/test/userpool-domain.test.ts b/packages/aws-cdk-lib/aws-route53-targets/test/userpool-domain.test.ts similarity index 81% rename from packages/@aws-cdk/aws-route53-targets/test/userpool-domain.test.ts rename to packages/aws-cdk-lib/aws-route53-targets/test/userpool-domain.test.ts index d098ef1293f49..0a9f6b4ecd336 100644 --- a/packages/@aws-cdk/aws-route53-targets/test/userpool-domain.test.ts +++ b/packages/aws-cdk-lib/aws-route53-targets/test/userpool-domain.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import { UserPool, UserPoolDomain } from '@aws-cdk/aws-cognito'; -import { ARecord, PublicHostedZone, RecordTarget } from '@aws-cdk/aws-route53'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { UserPool, UserPoolDomain } from '../../aws-cognito'; +import { ARecord, PublicHostedZone, RecordTarget } from '../../aws-route53'; +import { Stack } from '../../core'; import { UserPoolDomainTarget } from '../lib'; test('use user pool domain as record target', () => { diff --git a/packages/aws-cdk-lib/aws-route53/.jsiirc.json b/packages/aws-cdk-lib/aws-route53/.jsiirc.json new file mode 100644 index 0000000000000..2d01b60a2e3b9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.route53" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Route53" + }, + "python": { + "module": "aws_cdk.aws_route53" + } + } +} diff --git a/packages/aws-cdk-lib/aws-route53/README.md b/packages/aws-cdk-lib/aws-route53/README.md new file mode 100644 index 0000000000000..4c18a86469d42 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53/README.md @@ -0,0 +1,293 @@ +# Amazon Route53 Construct Library + + +To add a public hosted zone: + +```ts +new route53.PublicHostedZone(this, 'HostedZone', { + zoneName: 'fully.qualified.domain.com', +}); +``` + +To add a private hosted zone, use `PrivateHostedZone`. Note that +`enableDnsHostnames` and `enableDnsSupport` must have been enabled for the +VPC you're configuring for private hosted zones. + +```ts +declare const vpc: ec2.Vpc; + +const zone = new route53.PrivateHostedZone(this, 'HostedZone', { + zoneName: 'fully.qualified.domain.com', + vpc, // At least one VPC has to be added to a Private Hosted Zone. +}); +``` + +Additional VPCs can be added with `zone.addVpc()`. + +## Adding Records + +To add a TXT record to your zone: + +```ts +declare const myZone: route53.HostedZone; + +new route53.TxtRecord(this, 'TXTRecord', { + zone: myZone, + recordName: '_foo', // If the name ends with a ".", it will be used as-is; + // if it ends with a "." followed by the zone name, a trailing "." will be added automatically; + // otherwise, a ".", the zone name, and a trailing "." will be added automatically. + // Defaults to zone root if not specified. + values: [ // Will be quoted for you, and " will be escaped automatically. + 'Bar!', + 'Baz?', + ], + ttl: Duration.minutes(90), // Optional - default is 30 minutes +}); +``` + +To add a NS record to your zone: + +```ts +declare const myZone: route53.HostedZone; + +new route53.NsRecord(this, 'NSRecord', { + zone: myZone, + recordName: 'foo', + values: [ + 'ns-1.awsdns.co.uk.', + 'ns-2.awsdns.com.', + ], + ttl: Duration.minutes(90), // Optional - default is 30 minutes +}); +``` + +To add a DS record to your zone: + +```ts +declare const myZone: route53.HostedZone; + +new route53.DsRecord(this, 'DSRecord', { + zone: myZone, + recordName: 'foo', + values: [ + '12345 3 1 123456789abcdef67890123456789abcdef67890', + ], + ttl: Duration.minutes(90), // Optional - default is 30 minutes +}); +``` + +To add an A record to your zone: + +```ts +declare const myZone: route53.HostedZone; + +new route53.ARecord(this, 'ARecord', { + zone: myZone, + target: route53.RecordTarget.fromIpAddresses('1.2.3.4', '5.6.7.8'), +}); +``` + +To add an A record for an EC2 instance with an Elastic IP (EIP) to your zone: + +```ts +declare const instance: ec2.Instance; + +const elasticIp = new ec2.CfnEIP(this, 'EIP', { + domain: 'vpc', + instanceId: instance.instanceId, +}); + +declare const myZone: route53.HostedZone; +new route53.ARecord(this, 'ARecord', { + zone: myZone, + target: route53.RecordTarget.fromIpAddresses(elasticIp.ref), +}); +``` + +To add an AAAA record pointing to a CloudFront distribution: + +```ts +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; + +declare const myZone: route53.HostedZone; +declare const distribution: cloudfront.CloudFrontWebDistribution; +new route53.AaaaRecord(this, 'Alias', { + zone: myZone, + target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)), +}); +``` + +Constructs are available for A, AAAA, CAA, CNAME, MX, NS, SRV and TXT records. + +Use the `CaaAmazonRecord` construct to easily restrict certificate authorities +allowed to issue certificates for a domain to Amazon only. + +### Replacing existing record sets (dangerous!) + +Use the `deleteExisting` prop to delete an existing record set before deploying the new one. +This is useful if you want to minimize downtime and avoid "manual" actions while deploying a +stack with a record set that already exists. This is typically the case for record sets that +are not already "owned" by CloudFormation or "owned" by another stack or construct that is +going to be deleted (migration). + +> **N.B.:** this feature is dangerous, use with caution! It can only be used safely when +> `deleteExisting` is set to `true` as soon as the resource is added to the stack. Changing +> an existing Record Set's `deleteExisting` property from `false -> true` after deployment +> will delete the record! + +```ts +declare const myZone: route53.HostedZone; + +new route53.ARecord(this, 'ARecord', { + zone: myZone, + target: route53.RecordTarget.fromIpAddresses('1.2.3.4', '5.6.7.8'), + deleteExisting: true, +}); +``` + +### Cross Account Zone Delegation + +If you want to have your root domain hosted zone in one account and your subdomain hosted +zone in a diferent one, you can use `CrossAccountZoneDelegationRecord` to set up delegation +between them. + +In the account containing the parent hosted zone: + +```ts +const parentZone = new route53.PublicHostedZone(this, 'HostedZone', { + zoneName: 'someexample.com', +}); +const crossAccountRole = new iam.Role(this, 'CrossAccountRole', { + // The role name must be predictable + roleName: 'MyDelegationRole', + // The other account + assumedBy: new iam.AccountPrincipal('12345678901'), +}); +parentZone.grantDelegation(crossAccountRole); +``` + +In the account containing the child zone to be delegated: + +```ts +const subZone = new route53.PublicHostedZone(this, 'SubZone', { + zoneName: 'sub.someexample.com', +}); + +// import the delegation role by constructing the roleArn +const delegationRoleArn = Stack.of(this).formatArn({ + region: '', // IAM is global in each partition + service: 'iam', + account: 'parent-account-id', + resource: 'role', + resourceName: 'MyDelegationRole', +}); +const delegationRole = iam.Role.fromRoleArn(this, 'DelegationRole', delegationRoleArn); + +// create the record +new route53.CrossAccountZoneDelegationRecord(this, 'delegate', { + delegatedZone: subZone, + parentHostedZoneName: 'someexample.com', // or you can use parentHostedZoneId + delegationRole, +}); +``` + +## Imports + +If you don't know the ID of the Hosted Zone to import, you can use the +`HostedZone.fromLookup`: + +```ts +route53.HostedZone.fromLookup(this, 'MyZone', { + domainName: 'example.com', +}); +``` + +`HostedZone.fromLookup` requires an environment to be configured. Check +out the [documentation](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) for more documentation and examples. CDK +automatically looks into your `~/.aws/config` file for the `[default]` profile. +If you want to specify a different account run `cdk deploy --profile [profile]`. + +```text +new MyDevStack(app, 'dev', { + env: { + account: process.env.CDK_DEFAULT_ACCOUNT, + region: process.env.CDK_DEFAULT_REGION, + }, +}); +``` + +If you know the ID and Name of a Hosted Zone, you can import it directly: + +```ts +const zone = route53.HostedZone.fromHostedZoneAttributes(this, 'MyZone', { + zoneName: 'example.com', + hostedZoneId: 'ZOJJZC49E0EPZ', +}); +``` + +Alternatively, use the `HostedZone.fromHostedZoneId` to import hosted zones if +you know the ID and the retrieval for the `zoneName` is undesirable. + +```ts +const zone = route53.HostedZone.fromHostedZoneId(this, 'MyZone', 'ZOJJZC49E0EPZ'); +``` + +You can import a Public Hosted Zone as well with the similar `PublicHostedZone.fromPublicHostedZoneId` and `PublicHostedZone.fromPublicHostedZoneAttributes` methods: + +```ts +const zoneFromAttributes = route53.PublicHostedZone.fromPublicHostedZoneAttributes(this, 'MyZone', { + zoneName: 'example.com', + hostedZoneId: 'ZOJJZC49E0EPZ', +}); + +// Does not know zoneName +const zoneFromId = route53.PublicHostedZone.fromPublicHostedZoneId(this, 'MyZone', 'ZOJJZC49E0EPZ'); +``` + +## VPC Endpoint Service Private DNS + +When you create a VPC endpoint service, AWS generates endpoint-specific DNS hostnames that consumers use to communicate with the service. +For example, vpce-1234-abcdev-us-east-1.vpce-svc-123345.us-east-1.vpce.amazonaws.com. +By default, your consumers access the service with that DNS name. +This can cause problems with HTTPS traffic because the DNS will not match the backend certificate: + +```console +curl: (60) SSL: no alternative certificate subject name matches target host name 'vpce-abcdefghijklmnopq-rstuvwx.vpce-svc-abcdefghijklmnopq.us-east-1.vpce.amazonaws.com' +``` + +Effectively, the endpoint appears untrustworthy. To mitigate this, clients have to create an alias for this DNS name in Route53. + +Private DNS for an endpoint service lets you configure a private DNS name so consumers can +access the service using an existing DNS name without creating this Route53 DNS alias +This DNS name can also be guaranteed to match up with the backend certificate. + +Before consumers can use the private DNS name, you must verify that you have control of the domain/subdomain. + +Assuming your account has ownership of the particular domain/subdomain, +this construct sets up the private DNS configuration on the endpoint service, +creates all the necessary Route53 entries, and verifies domain ownership. + +```ts nofixture +import { Stack } from 'aws-cdk-lib'; +import { Vpc, VpcEndpointService } from 'aws-cdk-lib/aws-ec2'; +import { NetworkLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import { PublicHostedZone, VpcEndpointServiceDomainName } from 'aws-cdk-lib/aws-route53'; + +const stack = new Stack(); +const vpc = new Vpc(stack, 'VPC'); +const nlb = new NetworkLoadBalancer(stack, 'NLB', { + vpc, +}); +const vpces = new VpcEndpointService(stack, 'VPCES', { + vpcEndpointServiceLoadBalancers: [nlb], +}); +// You must use a public hosted zone so domain ownership can be verified +const zone = new PublicHostedZone(stack, 'PHZ', { + zoneName: 'aws-cdk.dev', +}); +new VpcEndpointServiceDomainName(stack, 'EndpointDomain', { + endpointService: vpces, + domainName: 'my-stuff.aws-cdk.dev', + publicHostedZone: zone, +}); +``` diff --git a/packages/aws-cdk-lib/aws-route53/index.ts b/packages/aws-cdk-lib/aws-route53/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-route53/lib/alias-record-target.ts b/packages/aws-cdk-lib/aws-route53/lib/alias-record-target.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/lib/alias-record-target.ts rename to packages/aws-cdk-lib/aws-route53/lib/alias-record-target.ts diff --git a/packages/@aws-cdk/aws-route53/lib/cross-account-zone-delegation-handler/index.ts b/packages/aws-cdk-lib/aws-route53/lib/cross-account-zone-delegation-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/lib/cross-account-zone-delegation-handler/index.ts rename to packages/aws-cdk-lib/aws-route53/lib/cross-account-zone-delegation-handler/index.ts diff --git a/packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.ts b/packages/aws-cdk-lib/aws-route53/lib/delete-existing-record-set-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/test/integ.delete-existing-record-set.js.snapshot/asset.421f670fab8460498f88755d8ad58385e2dec77a5f71a197a0f6452f8ba3c98e/index.ts rename to packages/aws-cdk-lib/aws-route53/lib/delete-existing-record-set-handler/index.ts diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone-provider.ts b/packages/aws-cdk-lib/aws-route53/lib/hosted-zone-provider.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/lib/hosted-zone-provider.ts rename to packages/aws-cdk-lib/aws-route53/lib/hosted-zone-provider.ts diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts b/packages/aws-cdk-lib/aws-route53/lib/hosted-zone-ref.ts similarity index 96% rename from packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts rename to packages/aws-cdk-lib/aws-route53/lib/hosted-zone-ref.ts index af190c99cee56..f18ccb608e59c 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone-ref.ts +++ b/packages/aws-cdk-lib/aws-route53/lib/hosted-zone-ref.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from '../../core'; /** * Imported or created hosted zone diff --git a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts b/packages/aws-cdk-lib/aws-route53/lib/hosted-zone.ts similarity index 98% rename from packages/@aws-cdk/aws-route53/lib/hosted-zone.ts rename to packages/aws-cdk-lib/aws-route53/lib/hosted-zone.ts index c3238dd7e3172..4ee4e92bc517f 100644 --- a/packages/@aws-cdk/aws-route53/lib/hosted-zone.ts +++ b/packages/aws-cdk-lib/aws-route53/lib/hosted-zone.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { ContextProvider, Duration, Lazy, Resource, Stack } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as cxschema from '../../cloud-assembly-schema'; +import { ContextProvider, Duration, Lazy, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { HostedZoneProviderProps } from './hosted-zone-provider'; import { HostedZoneAttributes, IHostedZone, PublicHostedZoneAttributes } from './hosted-zone-ref'; diff --git a/packages/@aws-cdk/aws-route53/lib/index.ts b/packages/aws-cdk-lib/aws-route53/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/lib/index.ts rename to packages/aws-cdk-lib/aws-route53/lib/index.ts diff --git a/packages/@aws-cdk/aws-route53/lib/record-set.ts b/packages/aws-cdk-lib/aws-route53/lib/record-set.ts similarity index 99% rename from packages/@aws-cdk/aws-route53/lib/record-set.ts rename to packages/aws-cdk-lib/aws-route53/lib/record-set.ts index 590bc31835ed2..a51f39af9338f 100644 --- a/packages/@aws-cdk/aws-route53/lib/record-set.ts +++ b/packages/aws-cdk-lib/aws-route53/lib/record-set.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import { CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Duration, IResource, RemovalPolicy, Resource, Token } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Duration, IResource, RemovalPolicy, Resource, Token } from '../../core'; import { Construct } from 'constructs'; import { IAliasRecordTarget } from './alias-record-target'; import { IHostedZone } from './hosted-zone-ref'; diff --git a/packages/aws-cdk-lib/aws-route53/lib/util.ts b/packages/aws-cdk-lib/aws-route53/lib/util.ts new file mode 100644 index 0000000000000..d43778e9b9b00 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53/lib/util.ts @@ -0,0 +1,74 @@ +import { Stack } from '../../core'; +import { Construct } from 'constructs'; +import { IHostedZone } from './hosted-zone-ref'; + +/** + * Validates a zone name is valid by Route53 specifc naming rules, + * and that there is no trailing dot in the name. + * + * @param zoneName the zone name to be validated. + * @returns +zoneName+ + * @throws ValidationError if the name is not valid. + */ +export function validateZoneName(zoneName: string) { + if (zoneName.endsWith('.')) { + throw new ValidationError('zone name must not end with a trailing dot'); + } + if (zoneName.length > 255) { + throw new ValidationError('zone name cannot be more than 255 bytes long'); + } + if (zoneName.split('.').find(label => label.length > 63)) { + throw new ValidationError('zone name labels cannot be more than 63 bytes long'); + } + if (!zoneName.match(/^[a-z0-9!"#$%&'()*+,/:;<=>?@[\\\]^_`{|}~.-]+$/i)) { + throw new ValidationError('zone names can only contain a-z, 0-9, -, ! " # $ % & \' ( ) * + , - / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ .'); + } +} + +class ValidationError extends Error { + constructor(message: string) { + super(message); + } +} + +/** + * Route53 requires the record names are specified as fully qualified names, but this + * forces lots of redundant work on the user (repeating the zone name over and over). + * This function allows the user to be lazier and offers a nicer experience, by + * qualifying relative names appropriately: + * + * @param providedName the user-specified name of the record. + * @param zoneName the fully-qualified name of the zone the record will be created in. + * + * @returns
    + *
  • If +providedName+ ends with a +.+, use it as-is
  • + *
  • If +providedName+ ends with or equals +zoneName+, append a trailing +.+
  • + *
  • Otherwise, append +.+, +zoneName+ and a trailing +.+
  • + *
+ */ +export function determineFullyQualifiedDomainName(providedName: string, hostedZone: IHostedZone): string { + if (providedName.endsWith('.')) { + return providedName; + } + + const hostedZoneName = hostedZone.zoneName.endsWith('.') + ? hostedZone.zoneName.substring(0, hostedZone.zoneName.length - 1) + : hostedZone.zoneName; + + const suffix = `.${hostedZoneName}`; + if (providedName.endsWith(suffix) || providedName === hostedZoneName) { + return `${providedName}.`; + } + + return `${providedName}${suffix}.`; +} + +export function makeHostedZoneArn(construct: Construct, hostedZoneId: string): string { + return Stack.of(construct).formatArn({ + account: '', + region: '', + service: 'route53', + resource: 'hostedzone', + resourceName: hostedZoneId, + }); +} diff --git a/packages/@aws-cdk/aws-route53/lib/vpc-endpoint-service-domain-name.ts b/packages/aws-cdk-lib/aws-route53/lib/vpc-endpoint-service-domain-name.ts similarity index 97% rename from packages/@aws-cdk/aws-route53/lib/vpc-endpoint-service-domain-name.ts rename to packages/aws-cdk-lib/aws-route53/lib/vpc-endpoint-service-domain-name.ts index bcd63db30ef70..35010fee7e7c7 100644 --- a/packages/@aws-cdk/aws-route53/lib/vpc-endpoint-service-domain-name.ts +++ b/packages/aws-cdk-lib/aws-route53/lib/vpc-endpoint-service-domain-name.ts @@ -1,7 +1,7 @@ -import { IVpcEndpointService } from '@aws-cdk/aws-ec2'; -import { Fn, Names, Stack } from '@aws-cdk/core'; -import { md5hash } from '@aws-cdk/core/lib/helpers-internal'; -import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '@aws-cdk/custom-resources'; +import { IVpcEndpointService } from '../../aws-ec2'; +import { Fn, Names, Stack } from '../../core'; +import { md5hash } from '../../core/lib/helpers-internal'; +import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId } from '../../custom-resources'; import { Construct } from 'constructs'; import { IPublicHostedZone, TxtRecord } from '../lib'; diff --git a/packages/@aws-cdk/aws-route53/test/cross-account-zone-delegation-handler/index.test.ts b/packages/aws-cdk-lib/aws-route53/test/cross-account-zone-delegation-handler/index.test.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/test/cross-account-zone-delegation-handler/index.test.ts rename to packages/aws-cdk-lib/aws-route53/test/cross-account-zone-delegation-handler/index.test.ts diff --git a/packages/@aws-cdk/aws-route53/test/delete-existing-record-set-handler.test.ts b/packages/aws-cdk-lib/aws-route53/test/delete-existing-record-set-handler.test.ts similarity index 100% rename from packages/@aws-cdk/aws-route53/test/delete-existing-record-set-handler.test.ts rename to packages/aws-cdk-lib/aws-route53/test/delete-existing-record-set-handler.test.ts diff --git a/packages/@aws-cdk/aws-route53/test/hosted-zone-provider.test.ts b/packages/aws-cdk-lib/aws-route53/test/hosted-zone-provider.test.ts similarity index 98% rename from packages/@aws-cdk/aws-route53/test/hosted-zone-provider.test.ts rename to packages/aws-cdk-lib/aws-route53/test/hosted-zone-provider.test.ts index e5f8fbe21d6c9..94a42bdf85920 100644 --- a/packages/@aws-cdk/aws-route53/test/hosted-zone-provider.test.ts +++ b/packages/aws-cdk-lib/aws-route53/test/hosted-zone-provider.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { HostedZone } from '../lib'; describe('hosted zone provider', () => { diff --git a/packages/@aws-cdk/aws-route53/test/hosted-zone.test.ts b/packages/aws-cdk-lib/aws-route53/test/hosted-zone.test.ts similarity index 97% rename from packages/@aws-cdk/aws-route53/test/hosted-zone.test.ts rename to packages/aws-cdk-lib/aws-route53/test/hosted-zone.test.ts index 8cd31471bad05..7738914302828 100644 --- a/packages/@aws-cdk/aws-route53/test/hosted-zone.test.ts +++ b/packages/aws-cdk-lib/aws-route53/test/hosted-zone.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { HostedZone, PrivateHostedZone, PublicHostedZone } from '../lib'; describe('hosted zone', () => { diff --git a/packages/@aws-cdk/aws-route53/test/record-set.test.ts b/packages/aws-cdk-lib/aws-route53/test/record-set.test.ts similarity index 99% rename from packages/@aws-cdk/aws-route53/test/record-set.test.ts rename to packages/aws-cdk-lib/aws-route53/test/record-set.test.ts index 78c5f7884446e..d52dae6f48c1d 100644 --- a/packages/@aws-cdk/aws-route53/test/record-set.test.ts +++ b/packages/aws-cdk-lib/aws-route53/test/record-set.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Duration, RemovalPolicy, Stack } from '@aws-cdk/core'; +import { Duration, RemovalPolicy, Stack } from '../../core'; import * as route53 from '../lib'; describe('record set', () => { diff --git a/packages/@aws-cdk/aws-route53/test/route53.test.ts b/packages/aws-cdk-lib/aws-route53/test/route53.test.ts similarity index 97% rename from packages/@aws-cdk/aws-route53/test/route53.test.ts rename to packages/aws-cdk-lib/aws-route53/test/route53.test.ts index d6a8a7ba63135..13468ea994008 100644 --- a/packages/@aws-cdk/aws-route53/test/route53.test.ts +++ b/packages/aws-cdk-lib/aws-route53/test/route53.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import { HostedZone, PrivateHostedZone, PublicHostedZone, TxtRecord } from '../lib'; describe('route53', () => { diff --git a/packages/aws-cdk-lib/aws-route53/test/util.test.ts b/packages/aws-cdk-lib/aws-route53/test/util.test.ts new file mode 100644 index 0000000000000..9b03df7815c71 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53/test/util.test.ts @@ -0,0 +1,74 @@ +import * as cdk from '../../core'; +import { HostedZone } from '../lib'; +import * as util from '../lib/util'; + +describe('util', () => { + test('throws when zone name ending with a \'.\'', () => { + expect(() => util.validateZoneName('zone.name.')).toThrow(/trailing dot/); + }); + + test('accepts a valid domain name', () => { + const domainName = 'amazonaws.com'; + util.validateZoneName(domainName); + }); + + test('providedName ending with a dot returns the name', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const providedName = 'test.domain.com.'; + const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'ignored', + })); + + // THEN + expect(qualified).toEqual('test.domain.com.'); + }); + + test('providedName that matches zoneName returns providedName with a trailing dot', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const providedName = 'test.domain.com'; + const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'test.domain.com.', + })); + + // THEN + expect(qualified).toEqual('test.domain.com.'); + }); + + test('providedName that ends with zoneName returns providedName with a trailing dot', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const providedName = 'test.domain.com'; + const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'domain.com.', + })); + + // THEN + expect(qualified).toEqual('test.domain.com.'); + }); + + test('providedName that does not match zoneName concatenates providedName and zoneName', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const providedName = 'test'; + const qualified = util.determineFullyQualifiedDomainName(providedName, HostedZone.fromHostedZoneAttributes(stack, 'HostedZone', { + hostedZoneId: 'fakeId', + zoneName: 'domain.com.', + })); + + // THEN + expect(qualified).toEqual('test.domain.com.'); + }); +}); diff --git a/packages/@aws-cdk/aws-route53/test/vpc-endpoint-service-domain-name.test.ts b/packages/aws-cdk-lib/aws-route53/test/vpc-endpoint-service-domain-name.test.ts similarity index 98% rename from packages/@aws-cdk/aws-route53/test/vpc-endpoint-service-domain-name.test.ts rename to packages/aws-cdk-lib/aws-route53/test/vpc-endpoint-service-domain-name.test.ts index e4155136af75a..51d29d3ba65f3 100644 --- a/packages/@aws-cdk/aws-route53/test/vpc-endpoint-service-domain-name.test.ts +++ b/packages/aws-cdk-lib/aws-route53/test/vpc-endpoint-service-domain-name.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { IVpcEndpointServiceLoadBalancer, VpcEndpointService } from '@aws-cdk/aws-ec2'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { IVpcEndpointServiceLoadBalancer, VpcEndpointService } from '../../aws-ec2'; +import { Stack } from '../../core'; import { PublicHostedZone, VpcEndpointServiceDomainName } from '../lib'; let stack: Stack; diff --git a/packages/aws-cdk-lib/aws-route53recoverycontrol/.jsiirc.json b/packages/aws-cdk-lib/aws-route53recoverycontrol/.jsiirc.json new file mode 100644 index 0000000000000..d7ce3a7d625d2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoverycontrol/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Route53RecoveryControl" + }, + "java": { + "package": "software.amazon.awscdk.services.route53recoverycontrol" + }, + "python": { + "module": "aws_cdk.aws_route53recoverycontrol" + } + } +} diff --git a/packages/aws-cdk-lib/aws-route53recoverycontrol/README.md b/packages/aws-cdk-lib/aws-route53recoverycontrol/README.md new file mode 100644 index 0000000000000..e1e2322e38cfb --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoverycontrol/README.md @@ -0,0 +1,27 @@ +# AWS::Route53RecoveryControl Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as route53recoverycontrol from 'aws-cdk-lib/aws-route53recoverycontrol'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Route53RecoveryControl construct libraries](https://constructs.dev/search?q=route53recoverycontrol) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Route53RecoveryControl resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryControl.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Route53RecoveryControl](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryControl.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-route53recoverycontrol/index.ts b/packages/aws-cdk-lib/aws-route53recoverycontrol/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoverycontrol/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-route53recoverycontrol/lib/index.ts b/packages/aws-cdk-lib/aws-route53recoverycontrol/lib/index.ts new file mode 100644 index 0000000000000..504033f8c7f04 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoverycontrol/lib/index.ts @@ -0,0 +1 @@ +export * from './route53recoverycontrol.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-route53recoveryreadiness/.jsiirc.json b/packages/aws-cdk-lib/aws-route53recoveryreadiness/.jsiirc.json new file mode 100644 index 0000000000000..9615d05cd06d4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoveryreadiness/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Route53RecoveryReadiness" + }, + "java": { + "package": "software.amazon.awscdk.services.route53recoveryreadiness" + }, + "python": { + "module": "aws_cdk.aws_route53recoveryreadiness" + } + } +} diff --git a/packages/aws-cdk-lib/aws-route53recoveryreadiness/README.md b/packages/aws-cdk-lib/aws-route53recoveryreadiness/README.md new file mode 100644 index 0000000000000..121c392ff5228 --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoveryreadiness/README.md @@ -0,0 +1,27 @@ +# AWS::Route53RecoveryReadiness Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as route53recoveryreadiness from 'aws-cdk-lib/aws-route53recoveryreadiness'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Route53RecoveryReadiness construct libraries](https://constructs.dev/search?q=route53recoveryreadiness) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Route53RecoveryReadiness resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryReadiness.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Route53RecoveryReadiness](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53RecoveryReadiness.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-route53recoveryreadiness/index.ts b/packages/aws-cdk-lib/aws-route53recoveryreadiness/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoveryreadiness/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-route53recoveryreadiness/lib/index.ts b/packages/aws-cdk-lib/aws-route53recoveryreadiness/lib/index.ts new file mode 100644 index 0000000000000..a632f8e94b19f --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53recoveryreadiness/lib/index.ts @@ -0,0 +1 @@ +export * from './route53recoveryreadiness.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-route53resolver/.jsiirc.json b/packages/aws-cdk-lib/aws-route53resolver/.jsiirc.json new file mode 100644 index 0000000000000..002128604582f --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53resolver/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Route53Resolver" + }, + "java": { + "package": "software.amazon.awscdk.services.route53resolver" + }, + "python": { + "module": "aws_cdk.aws_route53resolver" + } + } +} diff --git a/packages/aws-cdk-lib/aws-route53resolver/README.md b/packages/aws-cdk-lib/aws-route53resolver/README.md new file mode 100644 index 0000000000000..500c549d0dbff --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53resolver/README.md @@ -0,0 +1,32 @@ +# Amazon Route53 Resolver Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as route53resolver from 'aws-cdk-lib/aws-route53resolver'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Route53Resolver construct libraries](https://constructs.dev/search?q=route53resolver) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Route53Resolver resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53Resolver.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-route53resolver-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Route53Resolver](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Route53Resolver.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-route53resolver/index.ts b/packages/aws-cdk-lib/aws-route53resolver/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53resolver/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-route53resolver/lib/index.ts b/packages/aws-cdk-lib/aws-route53resolver/lib/index.ts new file mode 100644 index 0000000000000..e1eb42acf03fa --- /dev/null +++ b/packages/aws-cdk-lib/aws-route53resolver/lib/index.ts @@ -0,0 +1 @@ +export * from './route53resolver.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-rum/.jsiirc.json b/packages/aws-cdk-lib/aws-rum/.jsiirc.json new file mode 100644 index 0000000000000..eb25ba6ba21af --- /dev/null +++ b/packages/aws-cdk-lib/aws-rum/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.RUM" + }, + "java": { + "package": "software.amazon.awscdk.services.rum" + }, + "python": { + "module": "aws_cdk.aws_rum" + } + } +} diff --git a/packages/aws-cdk-lib/aws-rum/README.md b/packages/aws-cdk-lib/aws-rum/README.md new file mode 100644 index 0000000000000..e1182b10f0481 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rum/README.md @@ -0,0 +1,27 @@ +# AWS::RUM Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as rum from 'aws-cdk-lib/aws-rum'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for RUM construct libraries](https://constructs.dev/search?q=rum) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::RUM resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RUM.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::RUM](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_RUM.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-rum/index.ts b/packages/aws-cdk-lib/aws-rum/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-rum/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-rum/lib/index.ts b/packages/aws-cdk-lib/aws-rum/lib/index.ts new file mode 100644 index 0000000000000..b873a05256e13 --- /dev/null +++ b/packages/aws-cdk-lib/aws-rum/lib/index.ts @@ -0,0 +1 @@ +export * from './rum.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-s3-assets/.jsiirc.json b/packages/aws-cdk-lib/aws-s3-assets/.jsiirc.json new file mode 100644 index 0000000000000..55c4a2ca2aa1a --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.s3.assets" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.S3.Assets" + }, + "python": { + "module": "aws_cdk.aws_s3_assets" + } + } +} diff --git a/packages/aws-cdk-lib/aws-s3-assets/README.md b/packages/aws-cdk-lib/aws-s3-assets/README.md new file mode 100644 index 0000000000000..bf66827990d59 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/README.md @@ -0,0 +1,185 @@ +# AWS CDK Assets + + +Assets are local files or directories which are needed by a CDK app. A common +example is a directory which contains the handler code for a Lambda function, +but assets can represent any artifact that is needed for the app's operation. + +When deploying a CDK app that includes constructs with assets, the CDK toolkit +will first upload all the assets to S3, and only then deploy the stacks. The S3 +locations of the uploaded assets will be passed in as CloudFormation Parameters +to the relevant stacks. + +The following JavaScript example defines a directory asset which is archived as +a .zip file and uploaded to S3 during deployment. + +[Example of a ZipDirectoryAsset](./test/integ.assets.directory.lit.ts) + +The following JavaScript example defines a file asset, which is uploaded as-is +to an S3 bucket during deployment. + +[Example of a FileAsset](./test/integ.assets.file.lit.ts) + +## Attributes + +`Asset` constructs expose the following deploy-time attributes: + + * `s3BucketName` - the name of the assets S3 bucket. + * `s3ObjectKey` - the S3 object key of the asset file (whether it's a file or a zip archive) + * `s3ObjectUrl` - the S3 object URL of the asset (i.e. s3://mybucket/mykey.zip) + * `httpUrl` - the S3 HTTP URL of the asset (i.e. https://s3.us-east-1.amazonaws.com/mybucket/mykey.zip) + +In the following example, the various asset attributes are exported as stack outputs: + +[Example of referencing an asset](./test/integ.assets.refs.lit.ts) + +## Permissions + +IAM roles, users or groups which need to be able to read assets in runtime will should be +granted IAM permissions. To do that use the `asset.grantRead(principal)` method: + +The following example grants an IAM group read permissions on an asset: + +[Example of granting read access to an asset](./test/integ.assets.permissions.lit.ts) + +## How does it work + +When an asset is defined in a construct, a construct metadata entry +`aws:cdk:asset` is emitted with instructions on where to find the asset and what +type of packaging to perform (`zip` or `file`). Furthermore, the synthesized +CloudFormation template will also include two CloudFormation parameters: one for +the asset's bucket and one for the asset S3 key. Those parameters are used to +reference the deploy-time values of the asset (using `{ Ref: "Param" }`). + +Then, when the stack is deployed, the toolkit will package the asset (i.e. zip +the directory), calculate an MD5 hash of the contents and will render an S3 key +for this asset within the toolkit's asset store. If the file doesn't exist in +the asset store, it is uploaded during deployment. + +> The toolkit's asset store is an S3 bucket created by the toolkit for each + environment the toolkit operates in (environment = account + region). + +Now, when the toolkit deploys the stack, it will set the relevant CloudFormation +Parameters to point to the actual bucket and key for each asset. + +## Asset Bundling + +When defining an asset, you can use the `bundling` option to specify a command +to run inside a docker container. The command can read the contents of the asset +source from `/asset-input` and is expected to write files under `/asset-output` +(directories mapped inside the container). The files under `/asset-output` will +be zipped and uploaded to S3 as the asset. + +The following example uses custom asset bundling to convert a markdown file to html: + +[Example of using asset bundling](./test/integ.assets.bundling.lit.ts). + +The bundling docker image (`image`) can either come from a registry (`DockerImage.fromRegistry`) +or it can be built from a `Dockerfile` located inside your project (`DockerImage.fromBuild`). + +You can set the `CDK_DOCKER` environment variable in order to provide a custom +docker program to execute. This may sometime be needed when building in +environments where the standard docker cannot be executed (see +https://github.com/aws/aws-cdk/issues/8460 for details). + +Use `local` to specify a local bundling provider. The provider implements a +method `tryBundle()` which should return `true` if local bundling was performed. +If `false` is returned, docker bundling will be done: + +```ts +import * as cdk from 'aws-cdk-lib'; + +class MyBundle implements cdk.ILocalBundling { + public tryBundle(outputDir: string, options: cdk.BundlingOptions) { + const canRunLocally = true // replace with actual logic + if (canRunLocally) { + // perform local bundling here + return true; + } + return false; + } +} + +new Asset(this, 'BundledAsset', { + path: '/path/to/asset', + bundling: { + local: new MyBundle(), + // Docker bundling fallback + image: cdk.DockerImage.fromRegistry('alpine'), + entrypoint: ['/bin/sh', '-c'], + command: ['bundle'], + }, +}); +``` + +Although optional, it's recommended to provide a local bundling method which can +greatly improve performance. + +If the bundling output contains a single archive file (zip or jar) it will be +uploaded to S3 as-is and will not be zipped. Otherwise the contents of the +output directory will be zipped and the zip file will be uploaded to S3. This +is the default behavior for `bundling.outputType` (`BundlingOutput.AUTO_DISCOVER`). + +Use `BundlingOutput.NOT_ARCHIVED` if the bundling output must always be zipped: + +```ts +import * as cdk from 'aws-cdk-lib'; + +const asset = new Asset(this, 'BundledAsset', { + path: '/path/to/asset', + bundling: { + image: cdk.DockerImage.fromRegistry('alpine'), + command: ['command-that-produces-an-archive.sh'], + outputType: cdk.BundlingOutput.NOT_ARCHIVED, // Bundling output will be zipped even though it produces a single archive file. + }, +}); +``` + +Use `BundlingOutput.ARCHIVED` if the bundling output contains a single archive file and +you don't want it to be zipped. + +### Docker options + +Depending on your build environment, you may need to pass certain docker options to the `docker run` command that bundles assets. +This can be done using [BundlingOptions](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html) properties. + +Some optional properties to pass to the docker bundling + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const asset = new Asset(this, 'BundledAsset', { + path: '/path/to/asset', + bundling: { + image: lambda.Runtime.PYTHON_3_9.bundlingImage, + command: [ + 'bash', '-c', + 'pip install -r requirements.txt -t /asset-output && cp -au . /asset-output' + ], + securityOpt: 'no-new-privileges:true', // https://docs.docker.com/engine/reference/commandline/run/#optional-security-options---security-opt + network: 'host', //https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network---network + }, +}); +``` + +## CloudFormation Resource Metadata + +> NOTE: This section is relevant for authors of AWS Resource Constructs. + +In certain situations, it is desirable for tools to be able to know that a certain CloudFormation +resource is using a local asset. For example, SAM CLI can be used to invoke AWS Lambda functions +locally for debugging purposes. + +To enable such use cases, external tools will consult a set of metadata entries on AWS CloudFormation +resources: + +* `aws:asset:path` points to the local path of the asset. +* `aws:asset:property` is the name of the resource property where the asset is used + +Using these two metadata entries, tools will be able to identify that assets are used +by a certain resource, and enable advanced local experiences. + +To add these metadata entries to a resource, use the +`asset.addResourceMetadata(resource, property)` method. + +See https://github.com/aws/aws-cdk/issues/1432 for more details diff --git a/packages/aws-cdk-lib/aws-s3-assets/index.ts b/packages/aws-cdk-lib/aws-s3-assets/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-s3-assets/lib/asset.ts b/packages/aws-cdk-lib/aws-s3-assets/lib/asset.ts similarity index 96% rename from packages/@aws-cdk/aws-s3-assets/lib/asset.ts rename to packages/aws-cdk-lib/aws-s3-assets/lib/asset.ts index bd2fe20dfaeb7..0019e72d694ca 100644 --- a/packages/@aws-cdk/aws-s3-assets/lib/asset.ts +++ b/packages/aws-cdk-lib/aws-s3-assets/lib/asset.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import { CopyOptions } from '@aws-cdk/assets'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { CopyOptions } from '../../assets'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { toSymlinkFollow } from './compat'; diff --git a/packages/aws-cdk-lib/aws-s3-assets/lib/compat.ts b/packages/aws-cdk-lib/aws-s3-assets/lib/compat.ts new file mode 100644 index 0000000000000..b5eac2276ed94 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/lib/compat.ts @@ -0,0 +1,17 @@ +import { FollowMode } from '../../assets'; +import { SymlinkFollowMode } from '../../core'; + +export function toSymlinkFollow(follow?: FollowMode): SymlinkFollowMode | undefined { + if (!follow) { + return undefined; + } + + switch (follow) { + case FollowMode.NEVER: return SymlinkFollowMode.NEVER; + case FollowMode.ALWAYS: return SymlinkFollowMode.ALWAYS; + case FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL; + case FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL; + default: + throw new Error(`unknown follow mode: ${follow}`); + } +} diff --git a/packages/@aws-cdk/aws-s3-assets/lib/index.ts b/packages/aws-cdk-lib/aws-s3-assets/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-assets/lib/index.ts rename to packages/aws-cdk-lib/aws-s3-assets/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/alpine-markdown/Dockerfile b/packages/aws-cdk-lib/aws-s3-assets/test/alpine-markdown/Dockerfile new file mode 100644 index 0000000000000..d0ec147b4a786 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/alpine-markdown/Dockerfile @@ -0,0 +1,3 @@ +FROM public.ecr.aws/docker/library/alpine:latest + +RUN apk add markdown diff --git a/packages/@aws-cdk/aws-s3-assets/test/asset.test.ts b/packages/aws-cdk-lib/aws-s3-assets/test/asset.test.ts similarity index 98% rename from packages/@aws-cdk/aws-s3-assets/test/asset.test.ts rename to packages/aws-cdk-lib/aws-s3-assets/test/asset.test.ts index db8f6a2652cd8..4f9ec6f535e67 100644 --- a/packages/@aws-cdk/aws-s3-assets/test/asset.test.ts +++ b/packages/aws-cdk-lib/aws-s3-assets/test/asset.test.ts @@ -1,11 +1,11 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cxschema from '../../cloud-assembly-schema'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import { Asset } from '../lib/asset'; const SAMPLE_ASSET_DIR = path.join(__dirname, 'sample-asset-directory'); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/compat.test.ts b/packages/aws-cdk-lib/aws-s3-assets/test/compat.test.ts new file mode 100644 index 0000000000000..d3820a4cb70b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/compat.test.ts @@ -0,0 +1,11 @@ +import { FollowMode } from '../../assets'; +import { SymlinkFollowMode } from '../../core'; +import { toSymlinkFollow } from '../lib/compat'; + +test('FollowMode compatibility', () => { + expect(toSymlinkFollow(undefined)).toBeUndefined(); + expect(toSymlinkFollow(FollowMode.ALWAYS)).toBe(SymlinkFollowMode.ALWAYS); + expect(toSymlinkFollow(FollowMode.BLOCK_EXTERNAL)).toBe(SymlinkFollowMode.BLOCK_EXTERNAL); + expect(toSymlinkFollow(FollowMode.EXTERNAL)).toBe(SymlinkFollowMode.EXTERNAL); + expect(toSymlinkFollow(FollowMode.NEVER)).toBe(SymlinkFollowMode.NEVER); +}); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/custom-synthesis.test.ts b/packages/aws-cdk-lib/aws-s3-assets/test/custom-synthesis.test.ts new file mode 100644 index 0000000000000..b78b52bc131ec --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/custom-synthesis.test.ts @@ -0,0 +1,99 @@ +/** + * This file asserts that it is possible to write a custom stacksynthesizer that will synthesize + * ONE thing to the asset manifest, while returning another thing (including tokens) to the + * CloudFormation template -- without reaching into the library internals + */ + +import * as path from 'path'; +import { Template } from '../../assertions'; +import { StackSynthesizer, FileAssetSource, FileAssetLocation, DockerImageAssetSource, DockerImageAssetLocation, ISynthesisSession, App, Stack, AssetManifestBuilder, CfnParameter, CfnResource } from '../../core'; +import { AssetManifestArtifact } from '../../cx-api'; +import { Asset } from '../lib'; + +test('use custom synthesizer', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'Stack', { + synthesizer: new CustomSynthesizer(), + }); + + // WHEN + const asset = new Asset(stack, 'MyAsset', { + path: path.join(__dirname, 'file-asset.txt'), + }); + new CfnResource(stack, 'TestResource', { + type: 'CDK::TestResource', + properties: { + Bucket: asset.s3BucketName, + ObjectKey: asset.s3ObjectKey, + S3Url: asset.s3ObjectUrl, + HttpUrl: asset.httpUrl, + }, + }); + + // THEN + const assembly = app.synth(); + const stackArtifact = assembly.getStackArtifact(stack.artifactId); + const assetArtifact = stackArtifact.dependencies[0] as AssetManifestArtifact; + + const stackTemplate = Template.fromJSON(stackArtifact.template); + stackTemplate.hasResourceProperties('CDK::TestResource', { + Bucket: { 'Fn::Sub': '${BucketName}' }, + ObjectKey: '78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt', + S3Url: { 'Fn::Sub': 's3://${BucketName}/78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt' }, + HttpUrl: { 'Fn::Sub': 'https://s3.${AWS::Region}.${AWS::URLSuffix}/${BucketName}/78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt' }, + }); + + expect(assetArtifact.contents).toEqual(expect.objectContaining({ + files: expect.objectContaining({ + '78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197': { + destinations: { + 'current_account-current_region': { + bucketName: 'write-bucket', + objectKey: '78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt', + }, + }, + source: { + packaging: 'file', + path: 'asset.78add9eaf468dfa2191da44a7da92a21baba4c686cf6053d772556768ef21197.txt', + }, + }, + }), + })); +}); + +class CustomSynthesizer extends StackSynthesizer { + private readonly manifest = new AssetManifestBuilder(); + private parameter?: CfnParameter; + + override bind(stack: Stack) { + super.bind(stack); + + this.parameter = new CfnParameter(stack, 'BucketName'); + } + + addFileAsset(asset: FileAssetSource): FileAssetLocation { + const dest = this.manifest.defaultAddFileAsset(this.boundStack, asset, { + bucketName: 'write-bucket', + }); + return this.cloudFormationLocationFromFileAsset({ + ...dest, + bucketName: ['${', this.parameter!.logicalId, '}'].join(''), + }); + } + + addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation { + void(asset); + throw new Error('Docker images are not supported here'); + } + + synthesize(session: ISynthesisSession): void { + const templateAsset = this.addFileAsset(this.synthesizeTemplate(session)); + const assetManifestId = this.manifest.emitManifest(this.boundStack, session); + + this.emitArtifact(session, { + stackTemplateAssetObjectUrl: templateAsset.s3ObjectUrlWithPlaceholders, + additionalDependencies: [assetManifestId], + }); + } +} diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/file-asset.txt b/packages/aws-cdk-lib/aws-s3-assets/test/file-asset.txt new file mode 100644 index 0000000000000..87cda36f4da3e --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/file-asset.txt @@ -0,0 +1 @@ +Hello, this is a just a file! \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.bundling.lit.ts b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.bundling.lit.ts new file mode 100644 index 0000000000000..7d4c74c65a449 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.bundling.lit.ts @@ -0,0 +1,32 @@ +import * as path from 'path'; +import * as iam from '../../aws-iam'; +import { App, DockerImage, Stack, StackProps } from '../../core'; +import { Construct } from 'constructs'; +import * as assets from '../lib'; + +class TestStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'BundledAsset', { + path: path.join(__dirname, 'markdown-asset'), // /asset-input and working directory in the container + bundling: { + image: DockerImage.fromBuild(path.join(__dirname, 'alpine-markdown')), // Build an image + command: [ + 'sh', '-c', ` + markdown index.md > /asset-output/index.html + `, + ], + }, + }); + /// !hide + + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} + +const app = new App(); +new TestStack(app, 'cdk-integ-assets-bundling'); +app.synth(); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.directory.lit.ts b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.directory.lit.ts new file mode 100644 index 0000000000000..8b75c8edb03cc --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.directory.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as assets from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'sample-asset-directory'), + }); + /// !hide + + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-test'); +app.synth(); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.file.lit.ts b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.file.lit.ts new file mode 100644 index 0000000000000..11e3f37bbd49f --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.file.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as assets from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'file-asset.txt'), + }); + /// !hide + + const user = new iam.User(this, 'MyUser'); + asset.grantRead(user); + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-file-test'); +app.synth(); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.permissions.lit.ts b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.permissions.lit.ts new file mode 100644 index 0000000000000..68301c5ae082e --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.permissions.lit.ts @@ -0,0 +1,23 @@ +import * as path from 'path'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as assets from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const asset = new assets.Asset(this, 'MyFile', { + path: path.join(__dirname, 'file-asset.txt'), + }); + + /// !show + const group = new iam.Group(this, 'MyUserGroup'); + asset.grantRead(group); + /// !hide + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-refs'); +app.synth(); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.refs.lit.ts b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.refs.lit.ts new file mode 100644 index 0000000000000..fb43fd5b40479 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/integ.assets.refs.lit.ts @@ -0,0 +1,28 @@ +import * as path from 'path'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as assets from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const asset = new assets.Asset(this, 'SampleAsset', { + path: path.join(__dirname, 'sample-asset-directory'), + }); + + new cdk.CfnOutput(this, 'S3BucketName', { value: asset.s3BucketName }); + new cdk.CfnOutput(this, 'S3ObjectKey', { value: asset.s3ObjectKey }); + new cdk.CfnOutput(this, 'S3HttpURL', { value: asset.httpUrl }); + new cdk.CfnOutput(this, 'S3ObjectURL', { value: asset.s3ObjectUrl }); + /// !hide + + // we need at least one resource + asset.grantRead(new iam.User(this, 'MyUser')); + } +} + +const app = new cdk.App(); +new TestStack(app, 'aws-cdk-asset-refs'); +app.synth(); diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/markdown-asset/index.md b/packages/aws-cdk-lib/aws-s3-assets/test/markdown-asset/index.md new file mode 100644 index 0000000000000..64fdacbb595cb --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/markdown-asset/index.md @@ -0,0 +1,3 @@ +### This is a sample file + +With **markdown** diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt b/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt new file mode 100644 index 0000000000000..a21cdbf7d0691 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-asset-file.txt @@ -0,0 +1 @@ +// hello dear asset \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar b/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar new file mode 100644 index 0000000000000..71224bd574e4b Binary files /dev/null and b/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-jar-asset.jar differ diff --git a/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip b/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip new file mode 100644 index 0000000000000..71224bd574e4b Binary files /dev/null and b/packages/aws-cdk-lib/aws-s3-assets/test/sample-asset-directory/sample-zip-asset.zip differ diff --git a/packages/aws-cdk-lib/aws-s3-deployment/.jsiirc.json b/packages/aws-cdk-lib/aws-s3-deployment/.jsiirc.json new file mode 100644 index 0000000000000..247ee6f63db42 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-deployment/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.s3.deployment" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.S3.Deployment" + }, + "python": { + "module": "aws_cdk.aws_s3_deployment" + } + } +} diff --git a/packages/aws-cdk-lib/aws-s3-deployment/README.md b/packages/aws-cdk-lib/aws-s3-deployment/README.md new file mode 100644 index 0000000000000..357e44f0e551f --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-deployment/README.md @@ -0,0 +1,387 @@ +# AWS S3 Deployment Construct Library + + +This library allows populating an S3 bucket with the contents of .zip files +from other S3 buckets or from local disk. + +The following example defines a publicly accessible S3 bucket with web hosting +enabled and populates it from a local directory on disk. + +```ts +const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', { + websiteIndexDocument: 'index.html', + publicReadAccess: true, +}); + +new s3deploy.BucketDeployment(this, 'DeployWebsite', { + sources: [s3deploy.Source.asset('./website-dist')], + destinationBucket: websiteBucket, + destinationKeyPrefix: 'web/static', // optional prefix in destination bucket +}); +``` + +This is what happens under the hood: + +1. When this stack is deployed (either via `cdk deploy` or via CI/CD), the + contents of the local `website-dist` directory will be archived and uploaded + to an intermediary assets bucket. If there is more than one source, they will + be individually uploaded. +2. The `BucketDeployment` construct synthesizes a custom CloudFormation resource + of type `Custom::CDKBucketDeployment` into the template. The source bucket/key + is set to point to the assets bucket. +3. The custom resource downloads the .zip archive, extracts it and issues `aws + s3 sync --delete` against the destination bucket (in this case + `websiteBucket`). If there is more than one source, the sources will be + downloaded and merged pre-deployment at this step. + +If you are referencing the filled bucket in another construct that depends on +the files already be there, be sure to use `deployment.deployedBucket`. This +will ensure the bucket deployment has finished before the resource that uses +the bucket is created: + +```ts +declare const websiteBucket: s3.Bucket; + +const deployment = new s3deploy.BucketDeployment(this, 'DeployWebsite', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket: websiteBucket, +}); + +new ConstructThatReadsFromTheBucket(this, 'Consumer', { + // Use 'deployment.deployedBucket' instead of 'websiteBucket' here + bucket: deployment.deployedBucket, +}); +``` + +It is also possible to add additional sources using the `addSource` method. + +```ts +declare const websiteBucket: s3.IBucket; + +const deployment = new s3deploy.BucketDeployment(this, 'DeployWebsite', { + sources: [s3deploy.Source.asset('./website-dist')], + destinationBucket: websiteBucket, + destinationKeyPrefix: 'web/static', // optional prefix in destination bucket +}); + +deployment.addSource(s3deploy.Source.asset('./another-asset')); +``` + +## Supported sources + +The following source types are supported for bucket deployments: + +- Local .zip file: `s3deploy.Source.asset('/path/to/local/file.zip')` +- Local directory: `s3deploy.Source.asset('/path/to/local/directory')` +- Another bucket: `s3deploy.Source.bucket(bucket, zipObjectKey)` +- String data: `s3deploy.Source.data('object-key.txt', 'hello, world!')` + (supports [deploy-time values](#data-with-deploy-time-values)) +- JSON data: `s3deploy.Source.jsonData('object-key.json', { json: 'object' })` + (supports [deploy-time values](#data-with-deploy-time-values)) +- YAML data: `s3deploy.Source.yamlData('object-key.yaml', { yaml: 'object' })` + (supports [deploy-time values](#data-with-deploy-time-values)) + +To create a source from a single file, you can pass `AssetOptions` to exclude +all but a single file: + +- Single file: `s3deploy.Source.asset('/path/to/local/directory', { exclude: ['**', '!onlyThisFile.txt'] })` + +**IMPORTANT** The `aws-s3-deployment` module is only intended to be used with +zip files from trusted sources. Directories bundled by the CDK CLI (by using +`Source.asset()` on a directory) are safe. If you are using `Source.asset()` or +`Source.bucket()` to reference an existing zip file, make sure you trust the +file you are referencing. Zips from untrusted sources might be able to execute +arbitrary code in the Lambda Function used by this module, and use its permissions +to read or write unexpected files in the S3 bucket. + +## Retain on Delete + +By default, the contents of the destination bucket will **not** be deleted when the +`BucketDeployment` resource is removed from the stack or when the destination is +changed. You can use the option `retainOnDelete: false` to disable this behavior, +in which case the contents will be deleted. + +Configuring this has a few implications you should be aware of: + +- **Logical ID Changes** + + Changing the logical ID of the `BucketDeployment` construct, without changing the destination + (for example due to refactoring, or intentional ID change) **will result in the deletion of the objects**. + This is because CloudFormation will first create the new resource, which will have no affect, + followed by a deletion of the old resource, which will cause a deletion of the objects, + since the destination hasn't changed, and `retainOnDelete` is `false`. + +- **Destination Changes** + + When the destination bucket or prefix is changed, all files in the previous destination will **first** be + deleted and then uploaded to the new destination location. This could have availability implications + on your users. + +### General Recommendations + +#### Shared Bucket + +If the destination bucket **is not** dedicated to the specific `BucketDeployment` construct (i.e shared by other entities), +we recommend to always configure the `destinationKeyPrefix` property. This will prevent the deployment from +accidentally deleting data that wasn't uploaded by it. + +#### Dedicated Bucket + +If the destination bucket **is** dedicated, it might be reasonable to skip the prefix configuration, +in which case, we recommend to remove `retainOnDelete: false`, and instead, configure the +[`autoDeleteObjects`](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-readme.html#bucket-deletion) +property on the destination bucket. This will avoid the logical ID problem mentioned above. + +## Prune + +By default, files in the destination bucket that don't exist in the source will be deleted +when the `BucketDeployment` resource is created or updated. You can use the option `prune: false` to disable +this behavior, in which case the files will not be deleted. + +```ts +declare const destinationBucket: s3.Bucket; +new s3deploy.BucketDeployment(this, 'DeployMeWithoutDeletingFilesOnDestination', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + prune: false, +}); +``` + +This option also enables you to +multiple bucket deployments for the same destination bucket & prefix, +each with its own characteristics. For example, you can set different cache-control headers +based on file extensions: + +```ts +declare const destinationBucket: s3.Bucket; +new s3deploy.BucketDeployment(this, 'BucketDeployment', { + sources: [s3deploy.Source.asset('./website', { exclude: ['index.html'] })], + destinationBucket, + cacheControl: [s3deploy.CacheControl.fromString('max-age=31536000,public,immutable')], + prune: false, +}); + +new s3deploy.BucketDeployment(this, 'HTMLBucketDeployment', { + sources: [s3deploy.Source.asset('./website', { exclude: ['*', '!index.html'] })], + destinationBucket, + cacheControl: [s3deploy.CacheControl.fromString('max-age=0,no-cache,no-store,must-revalidate')], + prune: false, +}); +``` + +## Exclude and Include Filters + +There are two points at which filters are evaluated in a deployment: asset bundling and the actual deployment. If you simply want to exclude files in the asset bundling process, you should leverage the `exclude` property of `AssetOptions` when defining your source: + +```ts +declare const destinationBucket: s3.Bucket; +new s3deploy.BucketDeployment(this, 'HTMLBucketDeployment', { + sources: [s3deploy.Source.asset('./website', { exclude: ['*', '!index.html'] })], + destinationBucket, +}); +``` + +If you want to specify filters to be used in the deployment process, you can use the `exclude` and `include` filters on `BucketDeployment`. If excluded, these files will not be deployed to the destination bucket. In addition, if the file already exists in the destination bucket, it will not be deleted if you are using the `prune` option: + +```ts +declare const destinationBucket: s3.Bucket; +new s3deploy.BucketDeployment(this, 'DeployButExcludeSpecificFiles', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + exclude: ['*.txt'], +}); +``` + +These filters follow the same format that is used for the AWS CLI. See the CLI documentation for information on [Using Include and Exclude Filters](https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters). + +## Objects metadata + +You can specify metadata to be set on all the objects in your deployment. +There are 2 types of metadata in S3: system-defined metadata and user-defined metadata. +System-defined metadata have a special purpose, for example cache-control defines how long to keep an object cached. +User-defined metadata are not used by S3 and keys always begin with `x-amz-meta-` (this prefix is added automatically). + +System defined metadata keys include the following: + +- cache-control (`--cache-control` in `aws s3 sync`) +- content-disposition (`--content-disposition` in `aws s3 sync`) +- content-encoding (`--content-encoding` in `aws s3 sync`) +- content-language (`--content-language` in `aws s3 sync`) +- content-type (`--content-type` in `aws s3 sync`) +- expires (`--expires` in `aws s3 sync`) +- x-amz-storage-class (`--storage-class` in `aws s3 sync`) +- x-amz-website-redirect-location (`--website-redirect` in `aws s3 sync`) +- x-amz-server-side-encryption (`--sse` in `aws s3 sync`) +- x-amz-server-side-encryption-aws-kms-key-id (`--sse-kms-key-id` in `aws s3 sync`) +- x-amz-server-side-encryption-customer-algorithm (`--sse-c-copy-source` in `aws s3 sync`) +- x-amz-acl (`--acl` in `aws s3 sync`) + +You can find more information about system defined metadata keys in +[S3 PutObject documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) +and [`aws s3 sync` documentation](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html). + +```ts +const websiteBucket = new s3.Bucket(this, 'WebsiteBucket', { + websiteIndexDocument: 'index.html', + publicReadAccess: true, +}); + +new s3deploy.BucketDeployment(this, 'DeployWebsite', { + sources: [s3deploy.Source.asset('./website-dist')], + destinationBucket: websiteBucket, + destinationKeyPrefix: 'web/static', // optional prefix in destination bucket + metadata: { A: "1", b: "2" }, // user-defined metadata + + // system-defined metadata + contentType: "text/html", + contentLanguage: "en", + storageClass: s3deploy.StorageClass.INTELLIGENT_TIERING, + serverSideEncryption: s3deploy.ServerSideEncryption.AES_256, + cacheControl: [ + s3deploy.CacheControl.setPublic(), + s3deploy.CacheControl.maxAge(Duration.hours(1)), + ], + accessControl: s3.BucketAccessControl.BUCKET_OWNER_FULL_CONTROL, +}); +``` + +## CloudFront Invalidation + +You can provide a CloudFront distribution and optional paths to invalidate after the bucket deployment finishes. + +```ts +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; + +const bucket = new s3.Bucket(this, 'Destination'); + +// Handles buckets whether or not they are configured for website hosting. +const distribution = new cloudfront.Distribution(this, 'Distribution', { + defaultBehavior: { origin: new origins.S3Origin(bucket) }, +}); + +new s3deploy.BucketDeployment(this, 'DeployWithInvalidation', { + sources: [s3deploy.Source.asset('./website-dist')], + destinationBucket: bucket, + distribution, + distributionPaths: ['/images/*.png'], +}); +``` + +## Size Limits + +The default memory limit for the deployment resource is 128MiB. If you need to +copy larger files, you can use the `memoryLimit` configuration to increase the +size of the AWS Lambda resource handler. + +The default ephemeral storage size for the deployment resource is 512MiB. If you +need to upload larger files, you may hit this limit. You can use the +`ephemeralStorageSize` configuration to increase the storage size of the AWS Lambda +resource handler. + +> NOTE: a new AWS Lambda handler will be created in your stack for each combination +> of memory and storage size. + +## EFS Support + +If your workflow needs more disk space than default (512 MB) disk space, you may attach an EFS storage to underlying +lambda function. To Enable EFS support set `efs` and `vpc` props for BucketDeployment. + +Check sample usage below. +Please note that creating VPC inline may cause stack deletion failures. It is shown as below for simplicity. +To avoid such condition, keep your network infra (VPC) in a separate stack and pass as props. + +```ts +declare const destinationBucket: s3.Bucket; +declare const vpc: ec2.Vpc; + +new s3deploy.BucketDeployment(this, 'DeployMeWithEfsStorage', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + destinationKeyPrefix: 'efs/', + useEfs: true, + vpc, + retainOnDelete: false, +}); +``` + +## Data with deploy-time values + +The content passed to `Source.data()`, `Source.jsonData()`, or `Source.yamlData()` can include +references that will get resolved only during deployment. + +For example: + +```ts +import * as sns from 'aws-cdk-lib/aws-sns'; + +declare const destinationBucket: s3.Bucket; +declare const topic: sns.Topic; + +const appConfig = { + topic_arn: topic.topicArn, + base_url: 'https://my-endpoint', +}; + +new s3deploy.BucketDeployment(this, 'BucketDeployment', { + sources: [s3deploy.Source.jsonData('config.json', appConfig)], + destinationBucket, +}); +``` + +The value in `topic.topicArn` is a deploy-time value. It only gets resolved +during deployment by placing a marker in the generated source file and +substituting it when its deployed to the destination with the actual value. + +## Keep Files Zipped + +By default, files are zipped, then extracted into the destination bucket. + +You can use the option `extract: false` to disable this behavior, in which case, files will remain in a zip file when deployed to S3. To reference the object keys, or filenames, which will be deployed to the bucket, you can use the `objectKeys` getter on the bucket deployment. + +```ts +import * as cdk from 'aws-cdk-lib'; + +declare const destinationBucket: s3.Bucket; + +const myBucketDeployment = new s3deploy.BucketDeployment(this, 'DeployMeWithoutExtractingFilesOnDestination', { + sources: [s3deploy.Source.asset(path.join(__dirname, 'my-website'))], + destinationBucket, + extract: false, +}); + +new cdk.CfnOutput(this, 'ObjectKey', { + value: cdk.Fn.select(0, myBucketDeployment.objectKeys), +}); +``` + +## Notes + +- This library uses an AWS CloudFormation custom resource which is about 10MiB in + size. The code of this resource is bundled with this library. +- AWS Lambda execution time is limited to 15min. This limits the amount of data + which can be deployed into the bucket by this timeout. +- When the `BucketDeployment` is removed from the stack, the contents are retained + in the destination bucket ([#952](https://github.com/aws/aws-cdk/issues/952)). +- If you are using `s3deploy.Source.bucket()` to take the file source from + another bucket: the deployed files will only be updated if the key (file name) + of the file in the source bucket changes. Mutating the file in place will not + be good enough: the custom resource will simply not run if the properties don't + change. + - If you use assets (`s3deploy.Source.asset()`) you don't need to worry + about this: the asset system will make sure that if the files have changed, + the file name is unique and the deployment will run. + +## Development + +The custom resource is implemented in Python 3.9 in order to be able to leverage +the AWS CLI for "aws s3 sync". The code is under [`lib/lambda`](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-s3-deployment/lib/lambda) and +unit tests are under [`test/lambda`](https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-s3-deployment/test/lambda). + +This package requires Python 3.9 during build time in order to create the custom +resource Lambda bundle and test it. It also relies on a few bash scripts, so +might be tricky to build on Windows. + +## Roadmap + +- [ ] Support "blue/green" deployments ([#954](https://github.com/aws/aws-cdk/issues/954)) diff --git a/packages/aws-cdk-lib/aws-s3-deployment/index.ts b/packages/aws-cdk-lib/aws-s3-deployment/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-deployment/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts b/packages/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.ts similarity index 98% rename from packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts rename to packages/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.ts index 84838406c33a4..6a15474bf9bff 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/bucket-deployment.ts +++ b/packages/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.ts @@ -1,13 +1,13 @@ import * as path from 'path'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as efs from '@aws-cdk/aws-efs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; -import { AwsCliLayer } from '@aws-cdk/lambda-layer-awscli'; +import * as cloudfront from '../../aws-cloudfront'; +import * as ec2 from '../../aws-ec2'; +import * as efs from '../../aws-efs'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; +import { AwsCliLayer } from '../../lambda-layer-awscli'; import { kebab as toKebabCase } from 'case'; import { Construct } from 'constructs'; import { ISource, SourceConfig } from './source'; diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/index.ts b/packages/aws-cdk-lib/aws-s3-deployment/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/lib/index.ts rename to packages/aws-cdk-lib/aws-s3-deployment/lib/index.ts diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/lambda/index.py b/packages/aws-cdk-lib/aws-s3-deployment/lib/lambda/index.py similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/lib/lambda/index.py rename to packages/aws-cdk-lib/aws-s3-deployment/lib/lambda/index.py diff --git a/packages/@aws-cdk/aws-s3-deployment/lib/render-data.ts b/packages/aws-cdk-lib/aws-s3-deployment/lib/render-data.ts similarity index 98% rename from packages/@aws-cdk/aws-s3-deployment/lib/render-data.ts rename to packages/aws-cdk-lib/aws-s3-deployment/lib/render-data.ts index 24b13d3519f16..61ba5aebd4fe8 100644 --- a/packages/@aws-cdk/aws-s3-deployment/lib/render-data.ts +++ b/packages/aws-cdk-lib/aws-s3-deployment/lib/render-data.ts @@ -1,4 +1,4 @@ -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../core'; import { Construct } from 'constructs'; export interface Content { diff --git a/packages/aws-cdk-lib/aws-s3-deployment/lib/source.ts b/packages/aws-cdk-lib/aws-s3-deployment/lib/source.ts new file mode 100644 index 0000000000000..2de9e02f88cb0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-deployment/lib/source.ts @@ -0,0 +1,188 @@ +import * as fs from 'fs'; +import { join, dirname } from 'path'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as s3_assets from '../../aws-s3-assets'; +import { FileSystem, Stack } from '../../core'; +import { Construct } from 'constructs'; +import { renderData } from './render-data'; + +/** + * Source information. + */ +export interface SourceConfig { + /** + * The source bucket to deploy from. + */ + readonly bucket: s3.IBucket; + + /** + * An S3 object key in the source bucket that points to a zip file. + */ + readonly zipObjectKey: string; + + /** + * A set of markers to substitute in the source content. + * @default - no markers + */ + readonly markers?: Record; +} + +/** + * Bind context for ISources + */ +export interface DeploymentSourceContext { + /** + * The role for the handler + */ + readonly handlerRole: iam.IRole; +} + +/** + * Represents a source for bucket deployments. + */ +export interface ISource { + /** + * Binds the source to a bucket deployment. + * @param scope The construct tree context. + */ + bind(scope: Construct, context?: DeploymentSourceContext): SourceConfig; +} + +/** + * Specifies bucket deployment source. + * + * Usage: + * + * Source.bucket(bucket, key) + * Source.asset('/local/path/to/directory') + * Source.asset('/local/path/to/a/file.zip') + * Source.data('hello/world/file.txt', 'Hello, world!') + * Source.dataJson('config.json', { baz: topic.topicArn }) + * Source.dataYaml('config.yaml', { baz: topic.topicArn }) + * + */ +export class Source { + /** + * Uses a .zip file stored in an S3 bucket as the source for the destination bucket contents. + * + * Make sure you trust the producer of the archive. + * + * @param bucket The S3 Bucket + * @param zipObjectKey The S3 object key of the zip file with contents + */ + public static bucket(bucket: s3.IBucket, zipObjectKey: string): ISource { + return { + bind: (_: Construct, context?: DeploymentSourceContext) => { + if (!context) { + throw new Error('To use a Source.bucket(), context must be provided'); + } + + bucket.grantRead(context.handlerRole); + return { bucket, zipObjectKey }; + }, + }; + } + + /** + * Uses a local asset as the deployment source. + * + * If the local asset is a .zip archive, make sure you trust the + * producer of the archive. + * + * @param path The path to a local .zip file or a directory + */ + public static asset(path: string, options?: s3_assets.AssetOptions): ISource { + return { + bind(scope: Construct, context?: DeploymentSourceContext): SourceConfig { + if (!context) { + throw new Error('To use a Source.asset(), context must be provided'); + } + + let id = 1; + while (scope.node.tryFindChild(`Asset${id}`)) { + id++; + } + const asset = new s3_assets.Asset(scope, `Asset${id}`, { + path, + ...options, + }); + if (!asset.isZipArchive) { + throw new Error('Asset path must be either a .zip file or a directory'); + } + asset.grantRead(context.handlerRole); + + return { + bucket: asset.bucket, + zipObjectKey: asset.s3ObjectKey, + }; + }, + }; + } + + /** + * Deploys an object with the specified string contents into the bucket. The + * content can include deploy-time values (such as `snsTopic.topicArn`) that + * will get resolved only during deployment. + * + * To store a JSON object use `Source.jsonData()`. + * To store YAML content use `Source.yamlData()`. + * + * @param objectKey The destination S3 object key (relative to the root of the + * S3 deployment). + * @param data The data to be stored in the object. + */ + public static data(objectKey: string, data: string): ISource { + return { + bind: (scope: Construct, context?: DeploymentSourceContext) => { + const workdir = FileSystem.mkdtemp('s3-deployment'); + const outputPath = join(workdir, objectKey); + const rendered = renderData(scope, data); + fs.mkdirSync(dirname(outputPath), { recursive: true }); + fs.writeFileSync(outputPath, rendered.text); + const asset = this.asset(workdir).bind(scope, context); + return { + bucket: asset.bucket, + zipObjectKey: asset.zipObjectKey, + markers: rendered.markers, + }; + }, + }; + } + + /** + * Deploys an object with the specified JSON object into the bucket. The + * object can include deploy-time values (such as `snsTopic.topicArn`) that + * will get resolved only during deployment. + * + * @param objectKey The destination S3 object key (relative to the root of the + * S3 deployment). + * @param obj A JSON object. + */ + public static jsonData(objectKey: string, obj: any): ISource { + return { + bind: (scope: Construct, context?: DeploymentSourceContext) => { + return Source.data(objectKey, Stack.of(scope).toJsonString(obj)).bind(scope, context); + }, + }; + } + + /** + * Deploys an object with the specified JSON object formatted as YAML into the bucket. + * The object can include deploy-time values (such as `snsTopic.topicArn`) that + * will get resolved only during deployment. + * + * @param objectKey The destination S3 object key (relative to the root of the + * S3 deployment). + * @param obj A JSON object. + */ + public static yamlData(objectKey: string, obj: any): ISource { + return { + bind: (scope: Construct, context?: DeploymentSourceContext) => { + return Source.data(objectKey, Stack.of(scope).toYamlString(obj)).bind(scope, context); + }, + }; + } + + private constructor() { } +} diff --git a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts b/packages/aws-cdk-lib/aws-s3-deployment/test/bucket-deployment.test.ts similarity index 99% rename from packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts rename to packages/aws-cdk-lib/aws-s3-deployment/test/bucket-deployment.test.ts index 5c7d31690a7b4..3b004070a48e0 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/bucket-deployment.test.ts +++ b/packages/aws-cdk-lib/aws-s3-deployment/test/bucket-deployment.test.ts @@ -1,15 +1,15 @@ import { readdirSync, readFileSync, existsSync } from 'fs'; import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudfront from '@aws-cdk/aws-cloudfront'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; +import { Match, Template } from '../../assertions'; +import * as cloudfront from '../../aws-cloudfront'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as s3deploy from '../lib'; /* eslint-disable max-len */ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/content.test.ts b/packages/aws-cdk-lib/aws-s3-deployment/test/content.test.ts similarity index 96% rename from packages/@aws-cdk/aws-s3-deployment/test/content.test.ts rename to packages/aws-cdk-lib/aws-s3-deployment/test/content.test.ts index 3cc27a2dc7262..cfa7a01c5f464 100644 --- a/packages/@aws-cdk/aws-s3-deployment/test/content.test.ts +++ b/packages/aws-cdk-lib/aws-s3-deployment/test/content.test.ts @@ -1,6 +1,6 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Lazy, Stack } from '@aws-cdk/core'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import { Lazy, Stack } from '../../core'; import { Source } from '../lib'; import { renderData } from '../lib/render-data'; diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/Dockerfile b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/Dockerfile rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/Dockerfile diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/Dockerfile.debug b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/Dockerfile.debug similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/Dockerfile.debug rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/Dockerfile.debug diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/aws b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/aws similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/aws rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/aws diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/debug.sh b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/debug.sh similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/debug.sh rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/debug.sh diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/test.py b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/test.py similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/test.py rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/test.py diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/test.sh b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/test.sh similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/test.sh rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/test.sh diff --git a/packages/@aws-cdk/aws-s3-deployment/test/lambda/test.zip b/packages/aws-cdk-lib/aws-s3-deployment/test/lambda/test.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/lambda/test.zip rename to packages/aws-cdk-lib/aws-s3-deployment/test/lambda/test.zip diff --git a/packages/@aws-cdk/aws-s3-deployment/test/my-website-second.zip b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website-second.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/my-website-second.zip rename to packages/aws-cdk-lib/aws-s3-deployment/test/my-website-second.zip diff --git a/packages/aws-cdk-lib/aws-s3-deployment/test/my-website-second/403.html b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website-second/403.html new file mode 100644 index 0000000000000..2529e8a586eaa --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website-second/403.html @@ -0,0 +1,2 @@ +

Hello, S3 bucket deployments!

+ diff --git a/packages/@aws-cdk/aws-s3-deployment/test/my-website.zip b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website.zip similarity index 100% rename from packages/@aws-cdk/aws-s3-deployment/test/my-website.zip rename to packages/aws-cdk-lib/aws-s3-deployment/test/my-website.zip diff --git a/packages/aws-cdk-lib/aws-s3-deployment/test/my-website/index.html b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website/index.html new file mode 100644 index 0000000000000..2529e8a586eaa --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website/index.html @@ -0,0 +1,2 @@ +

Hello, S3 bucket deployments!

+ diff --git a/packages/aws-cdk-lib/aws-s3-deployment/test/my-website/rabir2v.gif b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website/rabir2v.gif new file mode 100644 index 0000000000000..e82b75cdb2187 Binary files /dev/null and b/packages/aws-cdk-lib/aws-s3-deployment/test/my-website/rabir2v.gif differ diff --git a/packages/aws-cdk-lib/aws-s3-notifications/.jsiirc.json b/packages/aws-cdk-lib/aws-s3-notifications/.jsiirc.json new file mode 100644 index 0000000000000..42ad1daa7f2ac --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.s3.notifications" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.S3.Notifications" + }, + "python": { + "module": "aws_cdk.aws_s3_notifications" + } + } +} diff --git a/packages/aws-cdk-lib/aws-s3-notifications/README.md b/packages/aws-cdk-lib/aws-s3-notifications/README.md new file mode 100644 index 0000000000000..8ce7a4972e291 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/README.md @@ -0,0 +1,46 @@ +# S3 Bucket Notifications Destinations + + +This module includes integration classes for using Topics, Queues or Lambdas +as S3 Notification Destinations. + +## Examples + +The following example shows how to send a notification to an SNS +topic when an object is created in an S3 bucket: + +```ts +import * as sns from 'aws-cdk-lib/aws-sns'; + +const bucket = new s3.Bucket(this, 'Bucket'); +const topic = new sns.Topic(this, 'Topic'); + +bucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.SnsDestination(topic)); +``` + +The following example shows how to send a notification to an SQS queue +when an object is created in an S3 bucket: + +```ts +import * as sqs from 'aws-cdk-lib/aws-sqs'; + +const bucket = new s3.Bucket(this, 'Bucket'); +const queue = new sqs.Queue(this, 'Queue'); + +bucket.addEventNotification(s3.EventType.OBJECT_CREATED_PUT, new s3n.SqsDestination(queue)); +``` + +The following example shows how to send a notification to a Lambda function when an object is created in an S3 bucket: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const bucket = new s3.Bucket(this, 'Bucket'); +const fn = new lambda.Function(this, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')), +}); + +bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(fn)); +``` diff --git a/packages/aws-cdk-lib/aws-s3-notifications/index.ts b/packages/aws-cdk-lib/aws-s3-notifications/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-s3-notifications/lib/index.ts b/packages/aws-cdk-lib/aws-s3-notifications/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3-notifications/lib/index.ts rename to packages/aws-cdk-lib/aws-s3-notifications/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-s3-notifications/lib/lambda.ts b/packages/aws-cdk-lib/aws-s3-notifications/lib/lambda.ts new file mode 100644 index 0000000000000..fb74dcc9dcee4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/lib/lambda.ts @@ -0,0 +1,44 @@ +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import { CfnResource, Names, Stack } from '../../core'; +import { Construct } from 'constructs'; + +/** + * Use a Lambda function as a bucket notification destination + */ +export class LambdaDestination implements s3.IBucketNotificationDestination { + constructor(private readonly fn: lambda.IFunction) { + } + + public bind(_scope: Construct, bucket: s3.IBucket): s3.BucketNotificationDestinationConfig { + const permissionId = `AllowBucketNotificationsTo${Names.nodeUniqueId(this.fn.permissionsNode)}`; + + if (!(bucket instanceof Construct)) { + throw new Error(`LambdaDestination for function ${Names.nodeUniqueId(this.fn.permissionsNode)} can only be configured on a + bucket construct (Bucket ${bucket.bucketName})`); + } + + if (bucket.node.tryFindChild(permissionId) === undefined) { + this.fn.addPermission(permissionId, { + sourceAccount: Stack.of(bucket).account, + principal: new iam.ServicePrincipal('s3.amazonaws.com'), + sourceArn: bucket.bucketArn, + // Placing the permissions node in the same scope as the s3 bucket. + // Otherwise, there is a circular dependency when the s3 bucket + // and lambda functions declared in different stacks. + scope: bucket, + }); + } + + // if we have a permission resource for this relationship, add it as a dependency + // to the bucket notifications resource, so it will be created first. + const permission = bucket.node.tryFindChild(permissionId) as CfnResource | undefined; + + return { + type: s3.BucketNotificationDestinationType.LAMBDA, + arn: this.fn.functionArn, + dependencies: permission ? [permission] : undefined, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-s3-notifications/lib/sns.ts b/packages/aws-cdk-lib/aws-s3-notifications/lib/sns.ts new file mode 100644 index 0000000000000..ca23855fd5e6a --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/lib/sns.ts @@ -0,0 +1,29 @@ +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import { Construct } from 'constructs'; + +/** + * Use an SNS topic as a bucket notification destination + */ +export class SnsDestination implements s3.IBucketNotificationDestination { + constructor(private readonly topic: sns.ITopic) { + } + + public bind(_scope: Construct, bucket: s3.IBucket): s3.BucketNotificationDestinationConfig { + this.topic.addToResourcePolicy(new iam.PolicyStatement({ + principals: [new iam.ServicePrincipal('s3.amazonaws.com')], + actions: ['sns:Publish'], + resources: [this.topic.topicArn], + conditions: { + ArnLike: { 'aws:SourceArn': bucket.bucketArn }, + }, + })); + + return { + arn: this.topic.topicArn, + type: s3.BucketNotificationDestinationType.TOPIC, + dependencies: [this.topic], // make sure the topic policy resource is created before the notification config + }; + } +} diff --git a/packages/aws-cdk-lib/aws-s3-notifications/lib/sqs.ts b/packages/aws-cdk-lib/aws-s3-notifications/lib/sqs.ts new file mode 100644 index 0000000000000..8ca96566537ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/lib/sqs.ts @@ -0,0 +1,46 @@ +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as sqs from '../../aws-sqs'; +import { Annotations } from '../../core'; +import { Construct } from 'constructs'; + +/** + * Use an SQS queue as a bucket notification destination + */ +export class SqsDestination implements s3.IBucketNotificationDestination { + constructor(private readonly queue: sqs.IQueue) { + } + + /** + * Allows using SQS queues as destinations for bucket notifications. + * Use `bucket.onEvent(event, queue)` to subscribe. + */ + public bind(_scope: Construct, bucket: s3.IBucket): s3.BucketNotificationDestinationConfig { + this.queue.grantSendMessages(new iam.ServicePrincipal('s3.amazonaws.com', { + conditions: { + ArnLike: { 'aws:SourceArn': bucket.bucketArn }, + }, + })); + + // if this queue is encrypted, we need to allow S3 to read messages since that's how + // it verifies that the notification destination configuration is valid. + if (this.queue.encryptionMasterKey) { + const statement = new iam.PolicyStatement({ + principals: [new iam.ServicePrincipal('s3.amazonaws.com')], + actions: ['kms:GenerateDataKey*', 'kms:Decrypt'], + resources: ['*'], + }); + const addResult = this.queue.encryptionMasterKey.addToResourcePolicy(statement, /* allowNoOp */ true); + if (!addResult.statementAdded) { + Annotations.of(this.queue.encryptionMasterKey).addWarning(`Can not change key policy of imported kms key. Ensure that your key policy contains the following permissions: \n${JSON.stringify(statement.toJSON(), null, 2)}`); + } + } + + return { + arn: this.queue.queueArn, + type: s3.BucketNotificationDestinationType.QUEUE, + dependencies: [this.queue], + }; + } + +} diff --git a/packages/aws-cdk-lib/aws-s3-notifications/test/lambda/lambda.test.ts b/packages/aws-cdk-lib/aws-s3-notifications/test/lambda/lambda.test.ts new file mode 100644 index 0000000000000..c05820c48e5aa --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/test/lambda/lambda.test.ts @@ -0,0 +1,230 @@ +import { Match, Template } from '../../../assertions'; +import * as lambda from '../../../aws-lambda'; +import * as s3 from '../../../aws-s3'; +import { Stack, App } from '../../../core'; +import * as s3n from '../../lib'; + +test('add notifications to multiple functions', () => { + + const stack = new Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const fn1 = new lambda.Function(stack, 'MyFunction1', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('foo'), + }); + + const fn2 = new lambda.Function(stack, 'MyFunction2', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('foo'), + }); + + const lambdaDestination1 = new s3n.LambdaDestination(fn1); + const lambdaDestination2 = new s3n.LambdaDestination(fn2); + + bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination1, { prefix: 'v1/' }); + bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination2, { prefix: 'v2/' }); + + // expecting notification configuration to have both events + Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { + NotificationConfiguration: Match.objectLike({ + LambdaFunctionConfigurations: [ + Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v1/' }] } } }), + Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v2/' }] } } }), + ], + }), + }); + + // expecting one permission for each function + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 2); + + // make sure each permission points to the correct function + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + FunctionName: { + 'Fn::GetAtt': [ + 'MyFunction12A744C2E', + 'Arn', + ], + }, + SourceArn: { + 'Fn::GetAtt': [ + 'MyBucketF68F3FF0', + 'Arn', + ], + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + FunctionName: { + 'Fn::GetAtt': [ + 'MyFunction2F2A964CA', + 'Arn', + ], + }, + SourceArn: { + 'Fn::GetAtt': [ + 'MyBucketF68F3FF0', + 'Arn', + ], + }, + }); + +}); + +test('lambda in a different stack as notification target', () => { + + const app = new App(); + const lambdaStack = new Stack(app, 'stack1'); + const bucketStack = new Stack(app, 'stack2'); + + const lambdaFunction = new lambda.Function(lambdaStack, 'lambdaFunction', { + code: lambda.Code.fromInline('whatever'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + const bucket = new s3.Bucket(bucketStack, 'bucket'); + bucket.addObjectCreatedNotification(new s3n.LambdaDestination(lambdaFunction)); + + // permission should be in the bucket stack + Template.fromStack(bucketStack).hasResourceProperties('AWS::Lambda::Permission', { + FunctionName: { + 'Fn::ImportValue': 'stack1:ExportsOutputFnGetAttlambdaFunction940E68ADArn6B2878AF', + }, + SourceArn: { + 'Fn::GetAtt': [ + 'bucket43879C71', + 'Arn', + ], + }, + }); +}); + +test('imported lambda in a different account as notification target', () => { + const app = new App(); + const stack = new Stack(app, 'stack', { + env: { account: '111111111111' }, + }); + + // Lambda account and stack account differ; no permissions should be created. + const lambdaFunction = lambda.Function.fromFunctionArn(stack, 'lambdaFunction', 'arn:aws:lambda:us-east-1:123456789012:function:BaseFunction'); + const bucket = new s3.Bucket(stack, 'bucket'); + + bucket.addObjectCreatedNotification(new s3n.LambdaDestination(lambdaFunction)); + + // no permissions created + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 0); +}); + +test('lambda as notification target', () => { + // GIVEN + const stack = new Stack(); + const bucketA = new s3.Bucket(stack, 'MyBucket'); + const fn = new lambda.Function(stack, 'MyFunction', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('foo'), + }); + + // WHEN + bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { 'Fn::GetAtt': ['MyFunction3BAA72D1', 'Arn'] }, + Principal: 's3.amazonaws.com', + SourceAccount: { Ref: 'AWS::AccountId' }, + SourceArn: { 'Fn::GetAtt': ['MyBucketF68F3FF0', 'Arn'] }, + }); + + Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { + NotificationConfiguration: { + LambdaFunctionConfigurations: [ + { + Events: ['s3:ObjectCreated:*'], + Filter: { + Key: { + FilterRules: [{ Name: 'suffix', Value: '.png' }], + }, + }, + LambdaFunctionArn: { 'Fn::GetAtt': ['MyFunction3BAA72D1', 'Arn'] }, + }, + ], + }, + }); +}); + +test('lambda as notification target specified by function arn', () => { + // GIVEN + const stack = new Stack(); + const bucketA = new s3.Bucket(stack, 'MyBucket'); + const fn = lambda.Function.fromFunctionArn(stack, 'MyFunction', 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords'); + + // WHEN + bucketA.addObjectCreatedNotification(new s3n.LambdaDestination(fn), { suffix: '.png' }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { + NotificationConfiguration: { + LambdaFunctionConfigurations: [ + { + Events: ['s3:ObjectCreated:*'], + Filter: { + Key: { + FilterRules: [{ Name: 'suffix', Value: '.png' }], + }, + }, + LambdaFunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:ProcessKinesisRecords', + }, + ], + }, + }); +}); + +test('permissions are added as a dependency to the notifications resource when using singleton function', () => { + + const stack = new Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const fn = new lambda.SingletonFunction(stack, 'MyFunction', { + uuid: 'uuid', + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('foo'), + }); + + const lambdaDestination = new s3n.LambdaDestination(fn); + + bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination, { prefix: 'v1/' }); + + Template.fromStack(stack).hasResource('Custom::S3BucketNotifications', { + DependsOn: ['MyBucketAllowBucketNotificationsToSingletonLambdauuid28C96883'], + }); +}); + +test('add multiple event notifications using a singleton function', () => { + + const stack = new Stack(); + const bucket = new s3.Bucket(stack, 'MyBucket'); + const fn = new lambda.SingletonFunction(stack, 'MyFunction', { + uuid: 'uuid', + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('foo'), + }); + + const lambdaDestination = new s3n.LambdaDestination(fn); + + bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination, { prefix: 'v1/' }); + bucket.addEventNotification(s3.EventType.OBJECT_CREATED, lambdaDestination, { prefix: 'v2/' }); + + Template.fromStack(stack).hasResourceProperties('Custom::S3BucketNotifications', { + NotificationConfiguration: Match.objectLike({ + LambdaFunctionConfigurations: [ + Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v1/' }] } } }), + Match.objectLike({ Filter: { Key: { FilterRules: [{ Name: 'prefix', Value: 'v2/' }] } } }), + ], + }), + }); + +}); diff --git a/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts b/packages/aws-cdk-lib/aws-s3-notifications/test/notifications.test.ts similarity index 98% rename from packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts rename to packages/aws-cdk-lib/aws-s3-notifications/test/notifications.test.ts index ee4cbc9c5c5d0..122a825ad5bed 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/notifications.test.ts +++ b/packages/aws-cdk-lib/aws-s3-notifications/test/notifications.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import * as s3n from '../lib'; /* eslint-disable max-len */ diff --git a/packages/@aws-cdk/aws-s3-notifications/test/queue.test.ts b/packages/aws-cdk-lib/aws-s3-notifications/test/queue.test.ts similarity index 93% rename from packages/@aws-cdk/aws-s3-notifications/test/queue.test.ts rename to packages/aws-cdk-lib/aws-s3-notifications/test/queue.test.ts index 44404de1b1d79..2433404fc7e2a 100644 --- a/packages/@aws-cdk/aws-s3-notifications/test/queue.test.ts +++ b/packages/aws-cdk-lib/aws-s3-notifications/test/queue.test.ts @@ -1,8 +1,8 @@ -import { Match, Template, Annotations } from '@aws-cdk/assertions'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template, Annotations } from '../../assertions'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as sqs from '../../aws-sqs'; +import { Stack } from '../../core'; import * as notif from '../lib'; test('queues can be used as destinations', () => { diff --git a/packages/aws-cdk-lib/aws-s3-notifications/test/sns.test.ts b/packages/aws-cdk-lib/aws-s3-notifications/test/sns.test.ts new file mode 100644 index 0000000000000..ff23359a3466c --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3-notifications/test/sns.test.ts @@ -0,0 +1,83 @@ +import { Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; +import * as notif from '../lib'; + +test('asBucketNotificationDestination adds bucket permissions only once for each bucket', () => { + const stack = new cdk.Stack(); + + const topic = new sns.Topic(stack, 'MyTopic'); + const bucket = new s3.Bucket(stack, 'Bucket'); + const bucket2 = new s3.Bucket(stack, 'Bucket2'); + + new notif.SnsDestination(topic).bind(bucket, bucket); + new notif.SnsDestination(topic).bind(bucket, bucket); + // another bucket will be added to the topic policy + new notif.SnsDestination(topic).bind(bucket2, bucket2); + + Template.fromStack(stack).templateMatches({ + Resources: { + Bucket83908E77: { + Type: 'AWS::S3::Bucket', + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }, + Bucket25524B414: { + Type: 'AWS::S3::Bucket', + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain', + }, + MyTopic86869434: { + Type: 'AWS::SNS::Topic', + }, + MyTopicPolicy12A5EC17: { + Type: 'AWS::SNS::TopicPolicy', + Properties: { + PolicyDocument: { + Statement: [ + { + Action: 'sns:Publish', + Condition: { + ArnLike: { + 'aws:SourceArn': { 'Fn::GetAtt': ['Bucket83908E77', 'Arn'] }, + }, + }, + Effect: 'Allow', + Principal: { + Service: 's3.amazonaws.com', + }, + Resource: { + Ref: 'MyTopic86869434', + }, + Sid: '0', + }, + { + Action: 'sns:Publish', + Condition: { + ArnLike: { + 'aws:SourceArn': { 'Fn::GetAtt': ['Bucket25524B414', 'Arn'] }, + }, + }, + Effect: 'Allow', + Principal: { + Service: 's3.amazonaws.com', + }, + Resource: { + Ref: 'MyTopic86869434', + }, + Sid: '1', + }, + ], + Version: '2012-10-17', + }, + Topics: [ + { + Ref: 'MyTopic86869434', + }, + ], + }, + }, + }, + }); +}); diff --git a/packages/aws-cdk-lib/aws-s3/.jsiirc.json b/packages/aws-cdk-lib/aws-s3/.jsiirc.json new file mode 100644 index 0000000000000..aff5e9b77c53c --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.s3" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.S3" + }, + "python": { + "module": "aws_cdk.aws_s3" + } + } +} diff --git a/packages/aws-cdk-lib/aws-s3/README.md b/packages/aws-cdk-lib/aws-s3/README.md new file mode 100644 index 0000000000000..dcb6f121f0373 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/README.md @@ -0,0 +1,693 @@ +# Amazon S3 Construct Library + + + +Define an unencrypted S3 bucket. + +```ts +const bucket = new s3.Bucket(this, 'MyFirstBucket'); +``` + +`Bucket` constructs expose the following deploy-time attributes: + +- `bucketArn` - the ARN of the bucket (i.e. `arn:aws:s3:::bucket_name`) +- `bucketName` - the name of the bucket (i.e. `bucket_name`) +- `bucketWebsiteUrl` - the Website URL of the bucket (i.e. + `http://bucket_name.s3-website-us-west-1.amazonaws.com`) +- `bucketDomainName` - the URL of the bucket (i.e. `bucket_name.s3.amazonaws.com`) +- `bucketDualStackDomainName` - the dual-stack URL of the bucket (i.e. + `bucket_name.s3.dualstack.eu-west-1.amazonaws.com`) +- `bucketRegionalDomainName` - the regional URL of the bucket (i.e. + `bucket_name.s3.eu-west-1.amazonaws.com`) +- `arnForObjects(pattern)` - the ARN of an object or objects within the bucket (i.e. + `arn:aws:s3:::bucket_name/exampleobject.png` or + `arn:aws:s3:::bucket_name/Development/*`) +- `urlForObject(key)` - the HTTP URL of an object within the bucket (i.e. + `https://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey`) +- `virtualHostedUrlForObject(key)` - the virtual-hosted style HTTP URL of an object + within the bucket (i.e. `https://china-bucket-s3.cn-north-1.amazonaws.com.cn/mykey`) +- `s3UrlForObject(key)` - the S3 URL of an object within the bucket (i.e. + `s3://bucket/mykey`) + +## Encryption + +Define a KMS-encrypted bucket: + +```ts +const bucket = new s3.Bucket(this, 'MyEncryptedBucket', { + encryption: s3.BucketEncryption.KMS, +}); + +// you can access the encryption key: +assert(bucket.encryptionKey instanceof kms.Key); +``` + +You can also supply your own key: + +```ts +const myKmsKey = new kms.Key(this, 'MyKey'); + +const bucket = new s3.Bucket(this, 'MyEncryptedBucket', { + encryption: s3.BucketEncryption.KMS, + encryptionKey: myKmsKey, +}); + +assert(bucket.encryptionKey === myKmsKey); +``` + +Enable KMS-SSE encryption via [S3 Bucket Keys](https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html): + +```ts +const bucket = new s3.Bucket(this, 'MyEncryptedBucket', { + encryption: s3.BucketEncryption.KMS, + bucketKeyEnabled: true, +}); +``` + +Use `BucketEncryption.ManagedKms` to use the S3 master KMS key: + +```ts +const bucket = new s3.Bucket(this, 'Buck', { + encryption: s3.BucketEncryption.KMS_MANAGED, +}); + +assert(bucket.encryptionKey == null); +``` + +## Permissions + +A bucket policy will be automatically created for the bucket upon the first call to +`addToResourcePolicy(statement)`: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket'); +const result = bucket.addToResourcePolicy( + new iam.PolicyStatement({ + actions: ['s3:GetObject'], + resources: [bucket.arnForObjects('file.txt')], + principals: [new iam.AccountRootPrincipal()], + }) +); +``` + +If you try to add a policy statement to an existing bucket, this method will +not do anything: + +```ts +const bucket = s3.Bucket.fromBucketName(this, 'existingBucket', 'bucket-name'); + +// No policy statement will be added to the resource +const result = bucket.addToResourcePolicy( + new iam.PolicyStatement({ + actions: ['s3:GetObject'], + resources: [bucket.arnForObjects('file.txt')], + principals: [new iam.AccountRootPrincipal()], + }) +); +``` + +That's because it's not possible to tell whether the bucket +already has a policy attached, let alone to re-use that policy to add more +statements to it. We recommend that you always check the result of the call: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket'); +const result = bucket.addToResourcePolicy( + new iam.PolicyStatement({ + actions: ['s3:GetObject'], + resources: [bucket.arnForObjects('file.txt')], + principals: [new iam.AccountRootPrincipal()], + }) +); + +if (!result.statementAdded) { + // Uh-oh! Someone probably made a mistake here. +} +``` + +The bucket policy can be directly accessed after creation to add statements or +adjust the removal policy. + +```ts +const bucket = new s3.Bucket(this, 'MyBucket'); +bucket.policy?.applyRemovalPolicy(cdk.RemovalPolicy.RETAIN); +``` + +Most of the time, you won't have to manipulate the bucket policy directly. +Instead, buckets have "grant" methods called to give prepackaged sets of permissions +to other resources. For example: + +```ts +declare const myLambda: lambda.Function; + +const bucket = new s3.Bucket(this, 'MyBucket'); +bucket.grantReadWrite(myLambda); +``` + +Will give the Lambda's execution role permissions to read and write +from the bucket. + +## AWS Foundational Security Best Practices + +### Enforcing SSL + +To require all requests use Secure Socket Layer (SSL): + +```ts +const bucket = new s3.Bucket(this, 'Bucket', { + enforceSSL: true, +}); +``` + +## Sharing buckets between stacks + +To use a bucket in a different stack in the same CDK application, pass the object to the other stack: + +```ts +/** + * Stack that defines the bucket + */ +class Producer extends cdk.Stack { + public readonly myBucket: s3.Bucket; + + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const bucket = new s3.Bucket(this, 'MyBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + }); + this.myBucket = bucket; + } +} + +interface ConsumerProps extends cdk.StackProps { + userBucket: s3.IBucket; +} + +/** + * Stack that consumes the bucket + */ +class Consumer extends cdk.Stack { + constructor(scope: cdk.App, id: string, props: ConsumerProps) { + super(scope, id, props); + + const user = new iam.User(this, 'MyUser'); + props.userBucket.grantReadWrite(user); + } +} + +const producer = new Producer(app, 'ProducerStack'); +new Consumer(app, 'ConsumerStack', { userBucket: producer.myBucket }); +``` + +## Importing existing buckets + +To import an existing bucket into your CDK application, use the `Bucket.fromBucketAttributes` +factory method. This method accepts `BucketAttributes` which describes the properties of an already +existing bucket: + +```ts +declare const myLambda: lambda.Function; +const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', { + bucketArn: 'arn:aws:s3:::my-bucket', +}); + +// now you can just call methods on the bucket +bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(myLambda), { + prefix: 'home/myusername/*', +}); +``` + +Alternatively, short-hand factories are available as `Bucket.fromBucketName` and +`Bucket.fromBucketArn`, which will derive all bucket attributes from the bucket +name or ARN respectively: + +```ts +const byName = s3.Bucket.fromBucketName(this, 'BucketByName', 'my-bucket'); +const byArn = s3.Bucket.fromBucketArn(this, 'BucketByArn', 'arn:aws:s3:::my-bucket'); +``` + +The bucket's region defaults to the current stack's region, but can also be explicitly set in cases where one of the bucket's +regional properties needs to contain the correct values. + +```ts +const myCrossRegionBucket = s3.Bucket.fromBucketAttributes(this, 'CrossRegionImport', { + bucketArn: 'arn:aws:s3:::my-bucket', + region: 'us-east-1', +}); +// myCrossRegionBucket.bucketRegionalDomainName === 'my-bucket.s3.us-east-1.amazonaws.com' +``` + +## Bucket Notifications + +The Amazon S3 notification feature enables you to receive notifications when +certain events happen in your bucket as described under [S3 Bucket +Notifications] of the S3 Developer Guide. + +To subscribe for bucket notifications, use the `bucket.addEventNotification` method. The +`bucket.addObjectCreatedNotification` and `bucket.addObjectRemovedNotification` can also be used for +these common use cases. + +The following example will subscribe an SNS topic to be notified of all `s3:ObjectCreated:*` events: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket'); +const topic = new sns.Topic(this, 'MyTopic'); +bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.SnsDestination(topic)); +``` + +This call will also ensure that the topic policy can accept notifications for +this specific bucket. + +Supported S3 notification targets are exposed by the `@aws-cdk/aws-s3-notifications` package. + +It is also possible to specify S3 object key filters when subscribing. The +following example will notify `myQueue` when objects prefixed with `foo/` and +have the `.jpg` suffix are removed from the bucket. + +```ts +declare const myQueue: sqs.Queue; +const bucket = new s3.Bucket(this, 'MyBucket'); +bucket.addEventNotification(s3.EventType.OBJECT_REMOVED, new s3n.SqsDestination(myQueue), { + prefix: 'foo/', + suffix: '.jpg', +}); +``` + +Adding notifications on existing buckets: + +```ts +declare const topic: sns.Topic; +const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', { + bucketArn: 'arn:aws:s3:::my-bucket', +}); +bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.SnsDestination(topic)); +``` + +When you add an event notification to a bucket, a custom resource is created to +manage the notifications. By default, a new role is created for the Lambda +function that implements this feature. If you want to use your own role instead, +you should provide it in the `Bucket` constructor: + +```ts +declare const myRole: iam.IRole; +const bucket = new s3.Bucket(this, 'MyBucket', { + notificationsHandlerRole: myRole, +}); +``` + +Whatever role you provide, the CDK will try to modify it by adding the +permissions from `AWSLambdaBasicExecutionRole` (an AWS managed policy) as well +as the permissions `s3:PutBucketNotification` and `s3:GetBucketNotification`. +If you’re passing an imported role, and you don’t want this to happen, configure +it to be immutable: + +```ts +const importedRole = iam.Role.fromRoleArn(this, 'role', 'arn:aws:iam::123456789012:role/RoleName', { + mutable: false, +}); +``` + +> If you provide an imported immutable role, make sure that it has at least all +> the permissions mentioned above. Otherwise, the deployment will fail! + +[s3 bucket notifications]: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html + +### EventBridge notifications + +Amazon S3 can send events to Amazon EventBridge whenever certain events happen in your bucket. +Unlike other destinations, you don't need to select which event types you want to deliver. + +The following example will enable EventBridge notifications: + +```ts +const bucket = new s3.Bucket(this, 'MyEventBridgeBucket', { + eventBridgeEnabled: true, +}); +``` + +[s3 eventbridge notifications]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html + +## Block Public Access + +Use `blockPublicAccess` to specify [block public access settings] on the bucket. + +Enable all block public access settings: + +```ts +const bucket = new s3.Bucket(this, 'MyBlockedBucket', { + blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL, +}); +``` + +Block and ignore public ACLs: + +```ts +const bucket = new s3.Bucket(this, 'MyBlockedBucket', { + blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS, +}); +``` + +Alternatively, specify the settings manually: + +```ts +const bucket = new s3.Bucket(this, 'MyBlockedBucket', { + blockPublicAccess: new s3.BlockPublicAccess({ blockPublicPolicy: true }), +}); +``` + +When `blockPublicPolicy` is set to `true`, `grantPublicRead()` throws an error. + +[block public access settings]: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html + +## Logging configuration + +Use `serverAccessLogsBucket` to describe where server access logs are to be stored. + +```ts +const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket'); + +const bucket = new s3.Bucket(this, 'MyBucket', { + serverAccessLogsBucket: accessLogsBucket, +}); +``` + +It's also possible to specify a prefix for Amazon S3 to assign to all log object keys. + +```ts +const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket'); + +const bucket = new s3.Bucket(this, 'MyBucket', { + serverAccessLogsBucket: accessLogsBucket, + serverAccessLogsPrefix: 'logs', +}); +``` + +### Allowing access log delivery using a Bucket Policy (recommended) + +When possible, it is recommended to use a bucket policy to grant access instead of +using ACLs. When the `@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy` feature flag +is enabled, this is done by default for server access logs. If S3 Server Access Logs +are the only logs delivered to your bucket (or if all other services logging to the +bucket support using bucket policy instead of ACLs), you can set object ownership +to [bucket owner enforced](#bucket-owner-enforced-recommended), as is recommended. + +```ts +const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket', { + objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED, +}); + +const bucket = new s3.Bucket(this, 'MyBucket', { + serverAccessLogsBucket: accessLogsBucket, + serverAccessLogsPrefix: 'logs', +}); +``` + +## S3 Inventory + +An [inventory](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) contains a list of the objects in the source bucket and metadata for each object. The inventory lists are stored in the destination bucket as a CSV file compressed with GZIP, as an Apache optimized row columnar (ORC) file compressed with ZLIB, or as an Apache Parquet (Parquet) file compressed with Snappy. + +You can configure multiple inventory lists for a bucket. You can configure what object metadata to include in the inventory, whether to list all object versions or only current versions, where to store the inventory list file output, and whether to generate the inventory on a daily or weekly basis. + +```ts +const inventoryBucket = new s3.Bucket(this, 'InventoryBucket'); + +const dataBucket = new s3.Bucket(this, 'DataBucket', { + inventories: [ + { + frequency: s3.InventoryFrequency.DAILY, + includeObjectVersions: s3.InventoryObjectVersion.CURRENT, + destination: { + bucket: inventoryBucket, + }, + }, + { + frequency: s3.InventoryFrequency.WEEKLY, + includeObjectVersions: s3.InventoryObjectVersion.ALL, + destination: { + bucket: inventoryBucket, + prefix: 'with-all-versions', + }, + }, + ], +}); +``` + +If the destination bucket is created as part of the same CDK application, the necessary permissions will be automatically added to the bucket policy. +However, if you use an imported bucket (i.e `Bucket.fromXXX()`), you'll have to make sure it contains the following policy document: + +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "InventoryAndAnalyticsExamplePolicy", + "Effect": "Allow", + "Principal": { "Service": "s3.amazonaws.com" }, + "Action": "s3:PutObject", + "Resource": ["arn:aws:s3:::destinationBucket/*"] + } + ] +} +``` + +## Website redirection + +You can use the two following properties to specify the bucket [redirection policy]. Please note that these methods cannot both be applied to the same bucket. + +[redirection policy]: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html#advanced-conditional-redirects + +### Static redirection + +You can statically redirect a to a given Bucket URL or any other host name with `websiteRedirect`: + +```ts +const bucket = new s3.Bucket(this, 'MyRedirectedBucket', { + websiteRedirect: { hostName: 'www.example.com' }, +}); +``` + +### Routing rules + +Alternatively, you can also define multiple `websiteRoutingRules`, to define complex, conditional redirections: + +```ts +const bucket = new s3.Bucket(this, 'MyRedirectedBucket', { + websiteRoutingRules: [ + { + hostName: 'www.example.com', + httpRedirectCode: '302', + protocol: s3.RedirectProtocol.HTTPS, + replaceKey: s3.ReplaceKey.prefixWith('test/'), + condition: { + httpErrorCodeReturnedEquals: '200', + keyPrefixEquals: 'prefix', + }, + }, + ], +}); +``` + +## Filling the bucket as part of deployment + +To put files into a bucket as part of a deployment (for example, to host a +website), see the `@aws-cdk/aws-s3-deployment` package, which provides a +resource that can do just that. + +## The URL for objects + +S3 provides two types of URLs for accessing objects via HTTP(S). Path-Style and +[Virtual Hosted-Style](https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html) +URL. Path-Style is a classic way and will be +[deprecated](https://aws.amazon.com/jp/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story). +We recommend to use Virtual Hosted-Style URL for newly made bucket. + +You can generate both of them. + +```ts +const bucket = new s3.Bucket(this, 'MyBucket'); +bucket.urlForObject('objectname'); // Path-Style URL +bucket.virtualHostedUrlForObject('objectname'); // Virtual Hosted-Style URL +bucket.virtualHostedUrlForObject('objectname', { regional: false }); // Virtual Hosted-Style URL but non-regional +``` + +## Object Ownership + +You can use one of following properties to specify the bucket [object Ownership]. + +[object ownership]: https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html + +### Object writer + +The Uploading account will own the object. + +```ts +new s3.Bucket(this, 'MyBucket', { + objectOwnership: s3.ObjectOwnership.OBJECT_WRITER, +}); +``` + +### Bucket owner preferred + +The bucket owner will own the object if the object is uploaded with the bucket-owner-full-control canned ACL. Without this setting and canned ACL, the object is uploaded and remains owned by the uploading account. + +```ts +new s3.Bucket(this, 'MyBucket', { + objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_PREFERRED, +}); +``` + +### Bucket owner enforced (recommended) + +ACLs are disabled, and the bucket owner automatically owns and has full control +over every object in the bucket. ACLs no longer affect permissions to data in the +S3 bucket. The bucket uses policies to define access control. + +```ts +new s3.Bucket(this, 'MyBucket', { + objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED, +}); +``` + +Some services may not not support log delivery to buckets that have object ownership +set to bucket owner enforced, such as +[S3 buckets using ACLs](#allowing-access-log-delivery-using-a-bucket-policy-recommended) +or [CloudFront Distributions][cloudfront s3 bucket]. + +[cloudfront s3 bucket]: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html#AccessLogsBucketAndFileOwnership + +## Bucket deletion + +When a bucket is removed from a stack (or the stack is deleted), the S3 +bucket will be removed according to its removal policy (which by default will +simply orphan the bucket and leave it in your AWS account). If the removal +policy is set to `RemovalPolicy.DESTROY`, the bucket will be deleted as long +as it does not contain any objects. + +To override this and force all objects to get deleted during bucket deletion, +enable the`autoDeleteObjects` option. + +```ts +const bucket = new s3.Bucket(this, 'MyTempFileBucket', { + removalPolicy: cdk.RemovalPolicy.DESTROY, + autoDeleteObjects: true, +}); +``` + +**Warning** if you have deployed a bucket with `autoDeleteObjects: true`, +switching this to `false` in a CDK version _before_ `1.126.0` will lead to +all objects in the bucket being deleted. Be sure to update your bucket resources +by deploying with CDK version `1.126.0` or later **before** switching this value to `false`. + +## Transfer Acceleration + +[Transfer Acceleration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html) can be configured to enable fast, easy, and secure transfers of files over long distances: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket', { + transferAcceleration: true, +}); +``` + +To access the bucket that is enabled for Transfer Acceleration, you must use a special endpoint. The URL can be generated using method `transferAccelerationUrlForObject`: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket', { + transferAcceleration: true, +}); +bucket.transferAccelerationUrlForObject('objectname'); +``` + +## Intelligent Tiering + +[Intelligent Tiering](https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html) can be configured to automatically move files to glacier: + +```ts +new s3.Bucket(this, 'MyBucket', { + intelligentTieringConfigurations: [ + { + name: 'foo', + prefix: 'folder/name', + archiveAccessTierTime: cdk.Duration.days(90), + deepArchiveAccessTierTime: cdk.Duration.days(180), + tags: [{ key: 'tagname', value: 'tagvalue' }], + }, + ], +}); +``` + +## Lifecycle Rule + +[Managing lifecycle](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) can be configured transition or expiration actions. + +```ts +const bucket = new s3.Bucket(this, 'MyBucket', { + lifecycleRules: [ + { + abortIncompleteMultipartUploadAfter: cdk.Duration.minutes(30), + enabled: false, + expiration: cdk.Duration.days(30), + expirationDate: new Date(), + expiredObjectDeleteMarker: false, + id: 'id', + noncurrentVersionExpiration: cdk.Duration.days(30), + + // the properties below are optional + noncurrentVersionsToRetain: 123, + noncurrentVersionTransitions: [ + { + storageClass: s3.StorageClass.GLACIER, + transitionAfter: cdk.Duration.days(30), + + // the properties below are optional + noncurrentVersionsToRetain: 123, + }, + ], + objectSizeGreaterThan: 500, + prefix: 'prefix', + objectSizeLessThan: 10000, + transitions: [ + { + storageClass: s3.StorageClass.GLACIER, + + // the properties below are optional + transitionAfter: cdk.Duration.days(30), + transitionDate: new Date(), + }, + ], + }, + ], +}); +``` + +## Object Lock Configuration + +[Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html) +can be configured to enable a write-once-read-many model for an S3 bucket. Object Lock must be +configured when a bucket is created; if a bucket is created without Object Lock, it cannot be +enabled later via the CDK. + +Object Lock can be enabled on an S3 bucket by specifying: + +```ts +const bucket = new s3.Bucket(this, 'MyBucket', { + objectLockEnabled: true, +}); +``` + +Usually, it is desired to not just enable Object Lock for a bucket but to also configure a +[retention mode](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html#object-lock-retention-modes) +and a [retention period](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-overview.html#object-lock-retention-periods). +These can be specified by providing `objectLockDefaultRetention`: + +```ts +// Configure for governance mode with a duration of 7 years +new s3.Bucket(this, 'Bucket1', { + objectLockDefaultRetention: s3.ObjectLockRetention.governance(cdk.Duration.days(7 * 365)), +}); + +// Configure for compliance mode with a duration of 1 year +new s3.Bucket(this, 'Bucket2', { + objectLockDefaultRetention: s3.ObjectLockRetention.compliance(cdk.Duration.days(365)), +}); +``` diff --git a/packages/aws-cdk-lib/aws-s3/index.ts b/packages/aws-cdk-lib/aws-s3/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-s3/lib/auto-delete-objects-handler/index.ts b/packages/aws-cdk-lib/aws-s3/lib/auto-delete-objects-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/auto-delete-objects-handler/index.ts rename to packages/aws-cdk-lib/aws-s3/lib/auto-delete-objects-handler/index.ts diff --git a/packages/@aws-cdk/aws-s3/lib/bucket-policy.ts b/packages/aws-cdk-lib/aws-s3/lib/bucket-policy.ts similarity index 94% rename from packages/@aws-cdk/aws-s3/lib/bucket-policy.ts rename to packages/aws-cdk-lib/aws-s3/lib/bucket-policy.ts index 991b0ece0864a..f4053c8c30a1c 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket-policy.ts +++ b/packages/aws-cdk-lib/aws-s3/lib/bucket-policy.ts @@ -1,6 +1,6 @@ -import { PolicyDocument } from '@aws-cdk/aws-iam'; -import { RemovalPolicy, Resource, Token, Tokenization } from '@aws-cdk/core'; -import { CfnReference } from '@aws-cdk/core/lib/private/cfn-reference'; +import { PolicyDocument } from '../../aws-iam'; +import { RemovalPolicy, Resource, Token, Tokenization } from '../../core'; +import { CfnReference } from '../../core/lib/private/cfn-reference'; import { Construct } from 'constructs'; import { Bucket, IBucket } from './bucket'; import { CfnBucket, CfnBucketPolicy } from './s3.generated'; diff --git a/packages/@aws-cdk/aws-s3/lib/bucket.ts b/packages/aws-cdk-lib/aws-s3/lib/bucket.ts similarity index 99% rename from packages/@aws-cdk/aws-s3/lib/bucket.ts rename to packages/aws-cdk-lib/aws-s3/lib/bucket.ts index ce1d28c775250..0f7d2360fce9e 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket.ts +++ b/packages/aws-cdk-lib/aws-s3/lib/bucket.ts @@ -1,8 +1,8 @@ import { EOL } from 'os'; import * as path from 'path'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; +import * as events from '../../aws-events'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; import { CustomResource, CustomResourceProvider, @@ -20,10 +20,10 @@ import { Token, Tokenization, Annotations, -} from '@aws-cdk/core'; -import { CfnReference } from '@aws-cdk/core/lib/private/cfn-reference'; -import * as cxapi from '@aws-cdk/cx-api'; -import * as regionInformation from '@aws-cdk/region-info'; +} from '../../core'; +import { CfnReference } from '../../core/lib/private/cfn-reference'; +import * as cxapi from '../../cx-api'; +import * as regionInformation from '../../region-info'; import { Construct } from 'constructs'; import { BucketPolicy } from './bucket-policy'; import { IBucketNotificationDestination } from './destination'; diff --git a/packages/@aws-cdk/aws-s3/lib/destination.ts b/packages/aws-cdk-lib/aws-s3/lib/destination.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/destination.ts rename to packages/aws-cdk-lib/aws-s3/lib/destination.ts diff --git a/packages/@aws-cdk/aws-s3/lib/index.ts b/packages/aws-cdk-lib/aws-s3/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/index.ts rename to packages/aws-cdk-lib/aws-s3/lib/index.ts diff --git a/packages/@aws-cdk/aws-s3/lib/location.ts b/packages/aws-cdk-lib/aws-s3/lib/location.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/location.ts rename to packages/aws-cdk-lib/aws-s3/lib/location.ts diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/index.ts b/packages/aws-cdk-lib/aws-s3/lib/notifications-resource/index.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/notifications-resource/index.ts rename to packages/aws-cdk-lib/aws-s3/lib/notifications-resource/index.ts diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/lambda/index.py b/packages/aws-cdk-lib/aws-s3/lib/notifications-resource/lambda/index.py similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/notifications-resource/lambda/index.py rename to packages/aws-cdk-lib/aws-s3/lib/notifications-resource/lambda/index.py diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts b/packages/aws-cdk-lib/aws-s3/lib/notifications-resource/notifications-resource-handler.ts similarity index 97% rename from packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts rename to packages/aws-cdk-lib/aws-s3/lib/notifications-resource/notifications-resource-handler.ts index a10048d5c5454..200a13f482512 100644 --- a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource-handler.ts +++ b/packages/aws-cdk-lib/aws-s3/lib/notifications-resource/notifications-resource-handler.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; export class NotificationsResourceHandlerProps { diff --git a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts b/packages/aws-cdk-lib/aws-s3/lib/notifications-resource/notifications-resource.ts similarity index 98% rename from packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts rename to packages/aws-cdk-lib/aws-s3/lib/notifications-resource/notifications-resource.ts index 73ddba171d5c7..b93bde18e4cd7 100644 --- a/packages/@aws-cdk/aws-s3/lib/notifications-resource/notifications-resource.ts +++ b/packages/aws-cdk-lib/aws-s3/lib/notifications-resource/notifications-resource.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { NotificationsResourceHandler } from './notifications-resource-handler'; import { Bucket, IBucket, EventType, NotificationKeyFilter } from '../bucket'; diff --git a/packages/@aws-cdk/aws-s3/lib/perms.ts b/packages/aws-cdk-lib/aws-s3/lib/perms.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/lib/perms.ts rename to packages/aws-cdk-lib/aws-s3/lib/perms.ts diff --git a/packages/aws-cdk-lib/aws-s3/lib/rule.ts b/packages/aws-cdk-lib/aws-s3/lib/rule.ts new file mode 100644 index 0000000000000..7d89af3760c0b --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/lib/rule.ts @@ -0,0 +1,262 @@ +import { Duration } from '../../core'; + +/** + * Declaration of a Life cycle rule + */ +export interface LifecycleRule { + /** + * A unique identifier for this rule. The value cannot be more than 255 characters. + */ + readonly id?: string; + + /** + * Whether this rule is enabled. + * + * @default true + */ + readonly enabled?: boolean; + + /** + * Specifies a lifecycle rule that aborts incomplete multipart uploads to an Amazon S3 bucket. + * + * The AbortIncompleteMultipartUpload property type creates a lifecycle + * rule that aborts incomplete multipart uploads to an Amazon S3 bucket. + * When Amazon S3 aborts a multipart upload, it deletes all parts + * associated with the multipart upload. + * + * The underlying configuration is expressed in whole numbers of days. Providing a Duration that + * does not represent a whole number of days will result in a runtime or deployment error. + * + * @default - Incomplete uploads are never aborted + */ + readonly abortIncompleteMultipartUploadAfter?: Duration; + + /** + * Indicates when objects are deleted from Amazon S3 and Amazon Glacier. + * + * The date value must be in ISO 8601 format. The time is always midnight UTC. + * + * If you specify an expiration and transition time, you must use the same + * time unit for both properties (either in days or by date). The + * expiration time must also be later than the transition time. + * + * @default - No expiration date + */ + readonly expirationDate?: Date; + + /** + * Indicates the number of days after creation when objects are deleted from Amazon S3 and Amazon Glacier. + * + * If you specify an expiration and transition time, you must use the same + * time unit for both properties (either in days or by date). The + * expiration time must also be later than the transition time. + * + * The underlying configuration is expressed in whole numbers of days. Providing a Duration that + * does not represent a whole number of days will result in a runtime or deployment error. + * + * @default - No expiration timeout + */ + readonly expiration?: Duration; + + /** + * Time between when a new version of the object is uploaded to the bucket and when old versions of the object expire. + * + * For buckets with versioning enabled (or suspended), specifies the time, + * in days, between when a new version of the object is uploaded to the + * bucket and when old versions of the object expire. When object versions + * expire, Amazon S3 permanently deletes them. If you specify a transition + * and expiration time, the expiration time must be later than the + * transition time. + * + * The underlying configuration is expressed in whole numbers of days. Providing a Duration that + * does not represent a whole number of days will result in a runtime or deployment error. + * + * @default - No noncurrent version expiration + */ + readonly noncurrentVersionExpiration?: Duration; + + /** + * Indicates a maximum number of noncurrent versions to retain. + * + * If there are this many more noncurrent versions, + * Amazon S3 permanently deletes them. + * + * @default - No noncurrent versions to retain + */ + readonly noncurrentVersionsToRetain?: number; + + /** + * One or more transition rules that specify when non-current objects transition to a specified storage class. + * + * Only for for buckets with versioning enabled (or suspended). + * + * If you specify a transition and expiration time, the expiration time + * must be later than the transition time. + */ + readonly noncurrentVersionTransitions?: NoncurrentVersionTransition[]; + + /** + * One or more transition rules that specify when an object transitions to a specified storage class. + * + * If you specify an expiration and transition time, you must use the same + * time unit for both properties (either in days or by date). The + * expiration time must also be later than the transition time. + * + * @default - No transition rules + */ + readonly transitions?: Transition[]; + + /** + * Object key prefix that identifies one or more objects to which this rule applies. + * + * @default - Rule applies to all objects + */ + readonly prefix?: string; + + /** + * The TagFilter property type specifies tags to use to identify a subset of objects for an Amazon S3 bucket. + * + * @default - Rule applies to all objects + */ + readonly tagFilters?: {[tag: string]: any}; + + /** + * Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. + * If set to true, the delete marker will be expired. + * + * @default false + */ + readonly expiredObjectDeleteMarker?: boolean; + + /** + * Specifies the maximum object size in bytes for this rule to apply to. + * + * @default - No rule + */ + readonly objectSizeLessThan?: number; + + /** Specifies the minimum object size in bytes for this rule to apply to. + * + * @default - No rule + */ + readonly objectSizeGreaterThan?: number; +} + +/** + * Describes when an object transitions to a specified storage class. + */ +export interface Transition { + /** + * The storage class to which you want the object to transition. + */ + readonly storageClass: StorageClass; + + /** + * Indicates when objects are transitioned to the specified storage class. + * + * The date value must be in ISO 8601 format. The time is always midnight UTC. + * + * @default - No transition date. + */ + readonly transitionDate?: Date; + + /** + * Indicates the number of days after creation when objects are transitioned to the specified storage class. + * + * @default - No transition count. + */ + readonly transitionAfter?: Duration; +} + +/** + * Describes when noncurrent versions transition to a specified storage class. + */ +export interface NoncurrentVersionTransition { + /** + * The storage class to which you want the object to transition. + */ + readonly storageClass: StorageClass; + + /** + * Indicates the number of days after creation when objects are transitioned to the specified storage class. + * + * @default - No transition count. + */ + readonly transitionAfter: Duration; + + /** + * Indicates the number of noncurrent version objects to be retained. Can be up to 100 noncurrent versions retained. + * + * @default - No noncurrent version retained. + */ + readonly noncurrentVersionsToRetain?: number; +} + +/** + * Storage class to move an object to + */ +export class StorageClass { + /** + * Storage class for data that is accessed less frequently, but requires rapid + * access when needed. + * + * Has lower availability than Standard storage. + */ + public static readonly INFREQUENT_ACCESS = new StorageClass('STANDARD_IA'); + + /** + * Infrequent Access that's only stored in one availability zone. + * + * Has lower availability than standard InfrequentAccess. + */ + public static readonly ONE_ZONE_INFREQUENT_ACCESS = new StorageClass('ONEZONE_IA'); + + /** + * Storage class for long-term archival that can take between minutes and + * hours to access. + * + * Use for archives where portions of the data might need to be retrieved in + * minutes. Data stored in the GLACIER storage class has a minimum storage + * duration period of 90 days and can be accessed in as little as 1-5 minutes + * using expedited retrieval. If you delete an object before the 90-day + * minimum, you are charged for 90 days. + */ + public static readonly GLACIER = new StorageClass('GLACIER'); + + /** + * Storage class for long-term archival that can be accessed in a few milliseconds. + * + * It is ideal for data that is accessed once or twice per quarter, and + * that requires immediate access. Data stored in the GLACIER_IR storage class + * has a minimum storage duration period of 90 days and can be accessed in + * as milliseconds. If you delete an object before the 90-day minimum, + * you are charged for 90 days. + */ + public static readonly GLACIER_INSTANT_RETRIEVAL = new StorageClass('GLACIER_IR'); + + /** + * Use for archiving data that rarely needs to be accessed. Data stored in the + * DEEP_ARCHIVE storage class has a minimum storage duration period of 180 + * days and a default retrieval time of 12 hours. If you delete an object + * before the 180-day minimum, you are charged for 180 days. For pricing + * information, see Amazon S3 Pricing. + */ + public static readonly DEEP_ARCHIVE = new StorageClass('DEEP_ARCHIVE'); + + /** + * The INTELLIGENT_TIERING storage class is designed to optimize storage costs + * by automatically moving data to the most cost-effective storage access + * tier, without performance impact or operational overhead. + * INTELLIGENT_TIERING delivers automatic cost savings by moving data on a + * granular object level between two access tiers, a frequent access tier and + * a lower-cost infrequent access tier, when access patterns change. The + * INTELLIGENT_TIERING storage class is ideal if you want to optimize storage + * costs automatically for long-lived data when access patterns are unknown or + * unpredictable. + */ + public static readonly INTELLIGENT_TIERING = new StorageClass('INTELLIGENT_TIERING'); + + constructor(public readonly value: string) { } + + public toString() { return this.value; } +} diff --git a/packages/aws-cdk-lib/aws-s3/lib/util.ts b/packages/aws-cdk-lib/aws-s3/lib/util.ts new file mode 100644 index 0000000000000..a4f676e5159ae --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/lib/util.ts @@ -0,0 +1,40 @@ +import * as cdk from '../../core'; +import { IConstruct } from 'constructs'; +import { BucketAttributes } from './bucket'; + +export function parseBucketArn(construct: IConstruct, props: BucketAttributes): string { + + // if we have an explicit bucket ARN, use it. + if (props.bucketArn) { + return props.bucketArn; + } + + if (props.bucketName) { + return cdk.Stack.of(construct).formatArn({ + // S3 Bucket names are globally unique in a partition, + // and so their ARNs have empty region and account components + region: '', + account: '', + service: 's3', + resource: props.bucketName, + }); + } + + throw new Error('Cannot determine bucket ARN. At least `bucketArn` or `bucketName` is needed'); +} + +export function parseBucketName(construct: IConstruct, props: BucketAttributes): string | undefined { + + // if we have an explicit bucket name, use it. + if (props.bucketName) { + return props.bucketName; + } + + // extract bucket name from bucket arn + if (props.bucketArn) { + return cdk.Stack.of(construct).splitArn(props.bucketArn, cdk.ArnFormat.SLASH_RESOURCE_NAME).resource; + } + + // no bucket name is okay since it's optional. + return undefined; +} diff --git a/packages/aws-cdk-lib/aws-s3/test/aspect.test.ts b/packages/aws-cdk-lib/aws-s3/test/aspect.test.ts new file mode 100644 index 0000000000000..aa136a9ee1bca --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/test/aspect.test.ts @@ -0,0 +1,45 @@ +import { Annotations } from '../../assertions'; +import * as cdk from '../../core'; +import { IConstruct } from 'constructs'; +import * as s3 from '../lib'; + +describe('aspect', () => { + test('bucket must have versioning: failure', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new s3.Bucket(stack, 'MyBucket'); + + // WHEN + cdk.Aspects.of(stack).add(new BucketVersioningChecker()); + + // THEN + Annotations.fromStack(stack).hasError('/Default/MyBucket/Resource', 'Bucket versioning is not enabled'); + }); + + test('bucket must have versioning: success', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app); + new s3.Bucket(stack, 'MyBucket', { + versioned: true, + }); + + // WHEN + cdk.Aspects.of(stack).add(new BucketVersioningChecker()); + + // THEN + Annotations.fromStack(stack).hasNoError('/Default/MyBucket/Resource', 'Bucket versioning is not enabled'); + }); +}); + +class BucketVersioningChecker implements cdk.IAspect { + public visit(node: IConstruct): void { + if (node instanceof s3.CfnBucket) { + if (!node.versioningConfiguration || + (!cdk.Tokenization.isResolvable(node.versioningConfiguration) && node.versioningConfiguration.status !== 'Enabled')) { + cdk.Annotations.of(node).addError('Bucket versioning is not enabled'); + } + } + } +} diff --git a/packages/@aws-cdk/aws-s3/test/auto-delete-objects-handler.test.ts b/packages/aws-cdk-lib/aws-s3/test/auto-delete-objects-handler.test.ts similarity index 100% rename from packages/@aws-cdk/aws-s3/test/auto-delete-objects-handler.test.ts rename to packages/aws-cdk-lib/aws-s3/test/auto-delete-objects-handler.test.ts diff --git a/packages/@aws-cdk/aws-s3/test/bucket-policy.test.ts b/packages/aws-cdk-lib/aws-s3/test/bucket-policy.test.ts similarity index 97% rename from packages/@aws-cdk/aws-s3/test/bucket-policy.test.ts rename to packages/aws-cdk-lib/aws-s3/test/bucket-policy.test.ts index 4a597f1343f42..94a26e24e8995 100644 --- a/packages/@aws-cdk/aws-s3/test/bucket-policy.test.ts +++ b/packages/aws-cdk-lib/aws-s3/test/bucket-policy.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { AnyPrincipal, PolicyStatement } from '@aws-cdk/aws-iam'; -import { RemovalPolicy, Stack, App } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { AnyPrincipal, PolicyStatement } from '../../aws-iam'; +import { RemovalPolicy, Stack, App } from '../../core'; import * as s3 from '../lib'; import { CfnBucketPolicy } from '../lib'; diff --git a/packages/@aws-cdk/aws-s3/test/bucket.test.ts b/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts similarity index 99% rename from packages/@aws-cdk/aws-s3/test/bucket.test.ts rename to packages/aws-cdk-lib/aws-s3/test/bucket.test.ts index 5384e51b5bd7c..c6ac8161870b1 100644 --- a/packages/@aws-cdk/aws-s3/test/bucket.test.ts +++ b/packages/aws-cdk-lib/aws-s3/test/bucket.test.ts @@ -1,9 +1,9 @@ import { EOL } from 'os'; -import { Annotations, Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; +import { Annotations, Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as s3 from '../lib'; // to make it easy to copy & paste from output: diff --git a/packages/aws-cdk-lib/aws-s3/test/cors.test.ts b/packages/aws-cdk-lib/aws-s3/test/cors.test.ts new file mode 100644 index 0000000000000..c4c62f4336d06 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/test/cors.test.ts @@ -0,0 +1,116 @@ +import { Template } from '../../assertions'; +import { Stack } from '../../core'; +import { Bucket, HttpMethods } from '../lib'; + +describe('cors', () => { + test('Can use addCors() to add a CORS configuration', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const bucket = new Bucket(stack, 'Bucket'); + bucket.addCorsRule({ + allowedMethods: [HttpMethods.GET, HttpMethods.HEAD], + allowedOrigins: ['https://example.com'], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + CorsConfiguration: { + CorsRules: [{ + AllowedMethods: ['GET', 'HEAD'], + AllowedOrigins: ['https://example.com'], + }], + }, + }); + }); + + test('Bucket with multiple cors configurations', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new Bucket(stack, 'Bucket', { + cors: [ + { + allowedHeaders: [ + '*', + ], + allowedMethods: [ + HttpMethods.GET, + ], + allowedOrigins: [ + '*', + ], + exposedHeaders: [ + 'Date', + ], + id: 'myCORSRuleId1', + maxAge: 3600, + }, + { + allowedHeaders: [ + 'x-amz-*', + ], + allowedMethods: [ + HttpMethods.DELETE, + ], + allowedOrigins: [ + 'http://www.example1.com', + 'http://www.example2.com', + ], + exposedHeaders: [ + 'Connection', + 'Server', + 'Date', + ], + id: 'myCORSRuleId2', + maxAge: 1800, + }, + ], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + CorsConfiguration: { + CorsRules: [ + { + AllowedHeaders: [ + '*', + ], + AllowedMethods: [ + 'GET', + ], + AllowedOrigins: [ + '*', + ], + ExposedHeaders: [ + 'Date', + ], + Id: 'myCORSRuleId1', + MaxAge: 3600, + }, + { + AllowedHeaders: [ + 'x-amz-*', + ], + AllowedMethods: [ + 'DELETE', + ], + AllowedOrigins: [ + 'http://www.example1.com', + 'http://www.example2.com', + ], + ExposedHeaders: [ + 'Connection', + 'Server', + 'Date', + ], + Id: 'myCORSRuleId2', + MaxAge: 1800, + }, + ], + }, + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-s3/test/metrics.test.ts b/packages/aws-cdk-lib/aws-s3/test/metrics.test.ts new file mode 100644 index 0000000000000..4f6642c1c25fb --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/test/metrics.test.ts @@ -0,0 +1,103 @@ +import { Template } from '../../assertions'; +import { Stack } from '../../core'; +import { Bucket } from '../lib'; + +describe('metrics', () => { + test('Can use addMetrics() to add a metric configuration', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const bucket = new Bucket(stack, 'Bucket'); + bucket.addMetric({ + id: 'test', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + MetricsConfigurations: [{ + Id: 'test', + }], + }); + }); + + test('Bucket with metrics on prefix', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new Bucket(stack, 'Bucket', { + metrics: [{ + id: 'test', + prefix: 'prefix', + }], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + MetricsConfigurations: [{ + Id: 'test', + Prefix: 'prefix', + }], + }); + }); + + test('Bucket with metrics on tag filter', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new Bucket(stack, 'Bucket', { + metrics: [{ + id: 'test', + tagFilters: { tagname1: 'tagvalue1', tagname2: 'tagvalue2' }, + }], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + MetricsConfigurations: [{ + Id: 'test', + TagFilters: [ + { Key: 'tagname1', Value: 'tagvalue1' }, + { Key: 'tagname2', Value: 'tagvalue2' }, + ], + }], + }); + }); + + test('Bucket with multiple metric configurations', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + new Bucket(stack, 'Bucket', { + metrics: [ + { + id: 'test', + tagFilters: { tagname1: 'tagvalue1', tagname2: 'tagvalue2' }, + + }, + { + id: 'test2', + prefix: 'prefix', + }, + ], + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::S3::Bucket', { + MetricsConfigurations: [{ + Id: 'test', + TagFilters: [ + { Key: 'tagname1', Value: 'tagvalue1' }, + { Key: 'tagname2', Value: 'tagvalue2' }, + ], + }, + { + Id: 'test2', + Prefix: 'prefix', + }], + }); + }); +}); diff --git a/packages/@aws-cdk/aws-s3/test/notification.test.ts b/packages/aws-cdk-lib/aws-s3/test/notification.test.ts similarity index 97% rename from packages/@aws-cdk/aws-s3/test/notification.test.ts rename to packages/aws-cdk-lib/aws-s3/test/notification.test.ts index 081d5443a2160..225fb4a6991f7 100644 --- a/packages/@aws-cdk/aws-s3/test/notification.test.ts +++ b/packages/aws-cdk-lib/aws-s3/test/notification.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as s3 from '../lib'; describe('notification', () => { diff --git a/packages/@aws-cdk/aws-s3/test/notifications-resource-handler/Dockerfile b/packages/aws-cdk-lib/aws-s3/test/notifications-resource-handler/Dockerfile similarity index 100% rename from packages/@aws-cdk/aws-s3/test/notifications-resource-handler/Dockerfile rename to packages/aws-cdk-lib/aws-s3/test/notifications-resource-handler/Dockerfile diff --git a/packages/@aws-cdk/aws-s3/test/notifications-resource-handler/test.sh b/packages/aws-cdk-lib/aws-s3/test/notifications-resource-handler/test.sh similarity index 100% rename from packages/@aws-cdk/aws-s3/test/notifications-resource-handler/test.sh rename to packages/aws-cdk-lib/aws-s3/test/notifications-resource-handler/test.sh diff --git a/packages/@aws-cdk/aws-s3/test/notifications-resource-handler/test_index.py b/packages/aws-cdk-lib/aws-s3/test/notifications-resource-handler/test_index.py similarity index 100% rename from packages/@aws-cdk/aws-s3/test/notifications-resource-handler/test_index.py rename to packages/aws-cdk-lib/aws-s3/test/notifications-resource-handler/test_index.py diff --git a/packages/aws-cdk-lib/aws-s3/test/put-objects-handler/index.ts b/packages/aws-cdk-lib/aws-s3/test/put-objects-handler/index.ts new file mode 100644 index 0000000000000..4a392db00cb66 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/test/put-objects-handler/index.ts @@ -0,0 +1,31 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { S3 } from 'aws-sdk'; + +const s3 = new S3(); + +export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent): Promise { + switch (event.RequestType) { + case 'Create': + if (event.ResourceProperties.Fail) { + throw new Error('Failing on request!'); + } + const bucketName = event.ResourceProperties.BucketName; + if (!bucketName) { + throw new Error('Missing BucketName'); + } + return putObjects(bucketName); + case 'Update': + case 'Delete': + return; + } +} + +async function putObjects(bucketName: string, n = 5) { + // Put n objects in parallel + await Promise.all([...Array(n).keys()] + .map(key => s3.putObject({ + Bucket: bucketName, + Key: `Key${key}`, + Body: `Body${key}`, + }).promise())); +} diff --git a/packages/@aws-cdk/aws-s3/test/rules.test.ts b/packages/aws-cdk-lib/aws-s3/test/rules.test.ts similarity index 98% rename from packages/@aws-cdk/aws-s3/test/rules.test.ts rename to packages/aws-cdk-lib/aws-s3/test/rules.test.ts index ac710da17e3ee..b218a098d4ff4 100644 --- a/packages/@aws-cdk/aws-s3/test/rules.test.ts +++ b/packages/aws-cdk-lib/aws-s3/test/rules.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Duration, Stack } from '../../core'; import { Bucket, StorageClass } from '../lib'; describe('rules', () => { diff --git a/packages/aws-cdk-lib/aws-s3/test/util.test.ts b/packages/aws-cdk-lib/aws-s3/test/util.test.ts new file mode 100644 index 0000000000000..7433661b26a26 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3/test/util.test.ts @@ -0,0 +1,61 @@ +import * as cdk from '../../core'; +import { parseBucketArn, parseBucketName } from '../lib/util'; + +describe('utils', () => { + describe('parseBucketArn', () => { + test('explicit arn', () => { + const stack = new cdk.Stack(); + const bucketArn = 'my:bucket:arn'; + expect(parseBucketArn(stack, { bucketArn })).toEqual(bucketArn); + }); + + test('produce arn from bucket name', () => { + const stack = new cdk.Stack(); + const bucketName = 'hello'; + expect(stack.resolve(parseBucketArn(stack, { bucketName }))).toEqual({ + 'Fn::Join': + ['', + ['arn:', + { Ref: 'AWS::Partition' }, + ':s3:::hello']], + }); + }); + + test('fails if neither arn nor name are provided', () => { + const stack = new cdk.Stack(); + expect(() => parseBucketArn(stack, {})).toThrow(/Cannot determine bucket ARN. At least `bucketArn` or `bucketName` is needed/); + }); + }); + + describe('parseBucketName', () => { + + test('explicit name', () => { + const stack = new cdk.Stack(); + const bucketName = 'foo'; + expect(stack.resolve(parseBucketName(stack, { bucketName }))).toEqual('foo'); + }); + + test('extract bucket name from string arn', () => { + const stack = new cdk.Stack(); + const bucketArn = 'arn:aws:s3:::my-bucket'; + expect(stack.resolve(parseBucketName(stack, { bucketArn }))).toEqual('my-bucket'); + }); + + test('can parse bucket name even if it contains a token', () => { + const stack = new cdk.Stack(); + const bucketArn = `arn:aws:s3:::${cdk.Token.asString({ Ref: 'my-bucket' })}`; + + expect( + stack.resolve(parseBucketName(stack, { bucketArn })), + ).toEqual( + { Ref: 'my-bucket' }, + ); + }); + + test('fails if ARN has invalid format', () => { + const stack = new cdk.Stack(); + const bucketArn = 'invalid-arn'; + expect(() => parseBucketName(stack, { bucketArn })).toThrow(/ARNs must/); + }); + }); +}); diff --git a/packages/aws-cdk-lib/aws-s3objectlambda/.jsiirc.json b/packages/aws-cdk-lib/aws-s3objectlambda/.jsiirc.json new file mode 100644 index 0000000000000..46ec92fc9d754 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3objectlambda/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.S3ObjectLambda" + }, + "java": { + "package": "software.amazon.awscdk.services.s3objectlambda" + }, + "python": { + "module": "aws_cdk.aws_s3objectlambda" + } + } +} diff --git a/packages/aws-cdk-lib/aws-s3objectlambda/README.md b/packages/aws-cdk-lib/aws-s3objectlambda/README.md new file mode 100644 index 0000000000000..71ac3e9a3d705 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3objectlambda/README.md @@ -0,0 +1,32 @@ +# AWS::S3ObjectLambda Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as s3objectlambda from 'aws-cdk-lib/aws-s3objectlambda'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for S3ObjectLambda construct libraries](https://constructs.dev/search?q=s3objectlambda) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::S3ObjectLambda resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_S3ObjectLambda.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-s3objectlambda-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::S3ObjectLambda](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_S3ObjectLambda.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-s3objectlambda/index.ts b/packages/aws-cdk-lib/aws-s3objectlambda/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3objectlambda/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-s3objectlambda/lib/index.ts b/packages/aws-cdk-lib/aws-s3objectlambda/lib/index.ts new file mode 100644 index 0000000000000..c97f93f4b76da --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3objectlambda/lib/index.ts @@ -0,0 +1 @@ +export * from './s3objectlambda.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-s3outposts/.jsiirc.json b/packages/aws-cdk-lib/aws-s3outposts/.jsiirc.json new file mode 100644 index 0000000000000..fd0c2f367d7ff --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3outposts/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.S3Outposts" + }, + "java": { + "package": "software.amazon.awscdk.services.s3outposts" + }, + "python": { + "module": "aws_cdk.aws_s3outposts" + } + } +} diff --git a/packages/aws-cdk-lib/aws-s3outposts/README.md b/packages/aws-cdk-lib/aws-s3outposts/README.md new file mode 100644 index 0000000000000..a571439620a9e --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3outposts/README.md @@ -0,0 +1,27 @@ +# AWS::S3Outposts Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as s3outposts from 'aws-cdk-lib/aws-s3outposts'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for S3Outposts construct libraries](https://constructs.dev/search?q=s3outposts) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::S3Outposts resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_S3Outposts.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::S3Outposts](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_S3Outposts.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-s3outposts/index.ts b/packages/aws-cdk-lib/aws-s3outposts/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3outposts/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-s3outposts/lib/index.ts b/packages/aws-cdk-lib/aws-s3outposts/lib/index.ts new file mode 100644 index 0000000000000..c7f9f8dad71f1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-s3outposts/lib/index.ts @@ -0,0 +1 @@ +export * from './s3outposts.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-sagemaker/.jsiirc.json b/packages/aws-cdk-lib/aws-sagemaker/.jsiirc.json new file mode 100644 index 0000000000000..db66ca6a2ec51 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sagemaker/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.sagemaker" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Sagemaker" + }, + "python": { + "module": "aws_cdk.aws_sagemaker" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sagemaker/README.md b/packages/aws-cdk-lib/aws-sagemaker/README.md new file mode 100644 index 0000000000000..d197841850fae --- /dev/null +++ b/packages/aws-cdk-lib/aws-sagemaker/README.md @@ -0,0 +1,32 @@ +# Amazon SageMaker Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as sagemaker from 'aws-cdk-lib/aws-sagemaker'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SageMaker construct libraries](https://constructs.dev/search?q=sagemaker) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SageMaker resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SageMaker.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-sagemaker-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SageMaker](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SageMaker.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-sagemaker/index.ts b/packages/aws-cdk-lib/aws-sagemaker/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sagemaker/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-sagemaker/lib/index.ts b/packages/aws-cdk-lib/aws-sagemaker/lib/index.ts new file mode 100644 index 0000000000000..f1fbeac96cc60 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sagemaker/lib/index.ts @@ -0,0 +1 @@ +export * from './sagemaker.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-sam/.jsiirc.json b/packages/aws-cdk-lib/aws-sam/.jsiirc.json new file mode 100644 index 0000000000000..bbb797c9d45a4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sam/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SAM" + }, + "java": { + "package": "software.amazon.awscdk.services.sam" + }, + "python": { + "module": "aws_cdk.aws_sam" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sam/README.md b/packages/aws-cdk-lib/aws-sam/README.md new file mode 100644 index 0000000000000..222ad29dd8fae --- /dev/null +++ b/packages/aws-cdk-lib/aws-sam/README.md @@ -0,0 +1,27 @@ +# AWS Serverless Application Model Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as serverless from 'aws-cdk-lib/aws-sam'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Serverless construct libraries](https://constructs.dev/search?q=serverless) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Serverless resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Serverless.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Serverless](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Serverless.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-sam/index.ts b/packages/aws-cdk-lib/aws-sam/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sam/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-sam/lib/index.ts b/packages/aws-cdk-lib/aws-sam/lib/index.ts new file mode 100644 index 0000000000000..8f7d31adc68ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-sam/lib/index.ts @@ -0,0 +1 @@ +export * from './sam.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-scheduler/.jsiirc.json b/packages/aws-cdk-lib/aws-scheduler/.jsiirc.json new file mode 100644 index 0000000000000..a799ecfdf1d25 --- /dev/null +++ b/packages/aws-cdk-lib/aws-scheduler/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Scheduler" + }, + "java": { + "package": "software.amazon.awscdk.services.scheduler" + }, + "python": { + "module": "aws_cdk.aws_scheduler" + } + } +} diff --git a/packages/aws-cdk-lib/aws-scheduler/README.md b/packages/aws-cdk-lib/aws-scheduler/README.md new file mode 100644 index 0000000000000..4f92747c20122 --- /dev/null +++ b/packages/aws-cdk-lib/aws-scheduler/README.md @@ -0,0 +1,27 @@ +# AWS::Scheduler Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as scheduler from 'aws-cdk-lib/aws-scheduler'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Scheduler construct libraries](https://constructs.dev/search?q=scheduler) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Scheduler resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Scheduler.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Scheduler](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Scheduler.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-scheduler/index.ts b/packages/aws-cdk-lib/aws-scheduler/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-scheduler/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-scheduler/lib/index.ts b/packages/aws-cdk-lib/aws-scheduler/lib/index.ts new file mode 100644 index 0000000000000..ae3df1e12b699 --- /dev/null +++ b/packages/aws-cdk-lib/aws-scheduler/lib/index.ts @@ -0,0 +1 @@ +export * from './scheduler.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-sdb/.jsiirc.json b/packages/aws-cdk-lib/aws-sdb/.jsiirc.json new file mode 100644 index 0000000000000..28da372f5610c --- /dev/null +++ b/packages/aws-cdk-lib/aws-sdb/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.sdb" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SDB" + }, + "python": { + "module": "aws_cdk.aws_sdb" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sdb/README.md b/packages/aws-cdk-lib/aws-sdb/README.md new file mode 100644 index 0000000000000..0f226a6b9da8a --- /dev/null +++ b/packages/aws-cdk-lib/aws-sdb/README.md @@ -0,0 +1,27 @@ +# Amazon SimpleDB Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as sdb from 'aws-cdk-lib/aws-sdb'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SDB construct libraries](https://constructs.dev/search?q=sdb) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SDB resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SDB.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SDB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SDB.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-sdb/index.ts b/packages/aws-cdk-lib/aws-sdb/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sdb/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-sdb/lib/index.ts b/packages/aws-cdk-lib/aws-sdb/lib/index.ts new file mode 100644 index 0000000000000..2fe371614e71e --- /dev/null +++ b/packages/aws-cdk-lib/aws-sdb/lib/index.ts @@ -0,0 +1 @@ +export * from './sdb.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-secretsmanager/.jsiirc.json b/packages/aws-cdk-lib/aws-secretsmanager/.jsiirc.json new file mode 100644 index 0000000000000..0b5c4a49e0b2e --- /dev/null +++ b/packages/aws-cdk-lib/aws-secretsmanager/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SecretsManager" + }, + "java": { + "package": "software.amazon.awscdk.services.secretsmanager" + }, + "python": { + "module": "aws_cdk.aws_secretsmanager" + } + } +} diff --git a/packages/aws-cdk-lib/aws-secretsmanager/README.md b/packages/aws-cdk-lib/aws-secretsmanager/README.md new file mode 100644 index 0000000000000..66f9c217da967 --- /dev/null +++ b/packages/aws-cdk-lib/aws-secretsmanager/README.md @@ -0,0 +1,285 @@ +# AWS Secrets Manager Construct Library + + + +```ts nofixture +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +``` + +## Create a new Secret in a Stack + +To have SecretsManager generate a new secret value automatically, +follow this example: + +```ts +declare const vpc: ec2.Vpc; + +// Simple secret +const secret = new secretsmanager.Secret(this, 'Secret'); +// Using the secret +const instance1 = new rds.DatabaseInstance(this, "PostgresInstance1", { + engine: rds.DatabaseInstanceEngine.POSTGRES, + credentials: rds.Credentials.fromSecret(secret), + vpc +}); +// Templated secret with username and password fields +const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { + generateSecretString: { + secretStringTemplate: JSON.stringify({ username: 'postgres' }), + generateStringKey: 'password', + }, +}); +// Using the templated secret as credentials +const instance2 = new rds.DatabaseInstance(this, "PostgresInstance2", { + engine: rds.DatabaseInstanceEngine.POSTGRES, + credentials: { + username: templatedSecret.secretValueFromJson('username').toString(), + password: templatedSecret.secretValueFromJson('password') + }, + vpc +}); +``` + +If you need to use a pre-existing secret, the recommended way is to manually +provision the secret in *AWS SecretsManager* and use the `Secret.fromSecretArn` +or `Secret.fromSecretAttributes` method to make it available in your CDK Application: + +```ts +declare const encryptionKey: kms.Key; +const secret = secretsmanager.Secret.fromSecretAttributes(this, 'ImportedSecret', { + secretArn: 'arn:aws:secretsmanager:::secret:-', + // If the secret is encrypted using a KMS-hosted CMK, either import or reference that key: + encryptionKey, +}); +``` + +SecretsManager secret values can only be used in select set of properties. For the +list of properties, see [the CloudFormation Dynamic References documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html). + +A secret can set `RemovalPolicy`. If it set to `RETAIN`, removing that secret will fail. + +## Grant permission to use the secret to a role + +You must grant permission to a resource for that resource to be allowed to +use a secret. This can be achieved with the `Secret.grantRead` and/or `Secret.grantWrite` + method, depending on your need: + +```ts +const role = new iam.Role(this, 'SomeRole', { assumedBy: new iam.AccountRootPrincipal() }); +const secret = new secretsmanager.Secret(this, 'Secret'); +secret.grantRead(role); +secret.grantWrite(role); +``` + +If, as in the following example, your secret was created with a KMS key: + +```ts +declare const role: iam.Role; +const key = new kms.Key(this, 'KMS'); +const secret = new secretsmanager.Secret(this, 'Secret', { encryptionKey: key }); +secret.grantRead(role); +secret.grantWrite(role); +``` + +then `Secret.grantRead` and `Secret.grantWrite` will also grant the role the +relevant encrypt and decrypt permissions to the KMS key through the +SecretsManager service principal. + +The principal is automatically added to Secret resource policy and KMS Key policy for cross account access: + +```ts +const otherAccount = new iam.AccountPrincipal('1234'); +const key = new kms.Key(this, 'KMS'); +const secret = new secretsmanager.Secret(this, 'Secret', { encryptionKey: key }); +secret.grantRead(otherAccount); +``` + +## Rotating a Secret + +### Using a Custom Lambda Function + +A rotation schedule can be added to a Secret using a custom Lambda function: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +declare const fn: lambda.Function; +const secret = new secretsmanager.Secret(this, 'Secret'); + +secret.addRotationSchedule('RotationSchedule', { + rotationLambda: fn, + automaticallyAfter: Duration.days(15), +}); +``` + +Note: The required permissions for Lambda to call SecretsManager and the other way round are automatically granted based on [AWS Documentation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions.html) as long as the Lambda is not imported. + +See [Overview of the Lambda Rotation Function](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-lambda-function-overview.html) on how to implement a Lambda Rotation Function. + +### Using a Hosted Lambda Function + +Use the `hostedRotation` prop to rotate a secret with a hosted Lambda function: + +```ts +const secret = new secretsmanager.Secret(this, 'Secret'); + +secret.addRotationSchedule('RotationSchedule', { + hostedRotation: secretsmanager.HostedRotation.mysqlSingleUser(), +}); +``` + +Hosted rotation is available for secrets representing credentials for MySQL, PostgreSQL, Oracle, +MariaDB, SQLServer, Redshift and MongoDB (both for the single and multi user schemes). + +When deployed in a VPC, the hosted rotation implements `ec2.IConnectable`: + +```ts +declare const myVpc: ec2.Vpc; +declare const dbConnections: ec2.Connections; +declare const secret: secretsmanager.Secret; + +const myHostedRotation = secretsmanager.HostedRotation.mysqlSingleUser({ vpc: myVpc }); +secret.addRotationSchedule('RotationSchedule', { hostedRotation: myHostedRotation }); +dbConnections.allowDefaultPortFrom(myHostedRotation); +``` + +Use the `excludeCharacters` option to customize the characters excluded from +the generated password when it is rotated. By default, the rotation excludes +the same characters as the ones excluded for the secret. If none are defined +then the following set is used: ``% +~`#$&*()|[]{}:;<>?!'/@"\``. + + +See also [Automating secret creation in AWS CloudFormation](https://docs.aws.amazon.com/secretsmanager/latest/userguide/integrating_cloudformation.html). + +## Rotating database credentials + +Define a `SecretRotation` to rotate database credentials: + +```ts +declare const mySecret: secretsmanager.Secret; +declare const myDatabase: ec2.IConnectable; +declare const myVpc: ec2.Vpc; + +new secretsmanager.SecretRotation(this, 'SecretRotation', { + application: secretsmanager.SecretRotationApplication.MYSQL_ROTATION_SINGLE_USER, // MySQL single user scheme + secret: mySecret, + target: myDatabase, // a Connectable + vpc: myVpc, // The VPC where the secret rotation application will be deployed + excludeCharacters: ' %+:;{}', // characters to never use when generating new passwords; + // by default, no characters are excluded, + // which might cause problems with some services, like DMS +}); +``` + +The secret must be a JSON string with the following format: + +```json +{ + "engine": "", + "host": "", + "username": "", + "password": "", + "dbname": "", + "port": "", + "masterarn": "" +} +``` + +For the multi user scheme, a `masterSecret` must be specified: + +```ts +declare const myUserSecret: secretsmanager.Secret; +declare const myMasterSecret: secretsmanager.Secret; +declare const myDatabase: ec2.IConnectable; +declare const myVpc: ec2.Vpc; + +new secretsmanager.SecretRotation(this, 'SecretRotation', { + application: secretsmanager.SecretRotationApplication.MYSQL_ROTATION_MULTI_USER, + secret: myUserSecret, // The secret that will be rotated + masterSecret: myMasterSecret, // The secret used for the rotation + target: myDatabase, + vpc: myVpc, +}); +``` + +See also [aws-rds](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-rds/README.md) where +credentials generation and rotation is integrated. + +## Importing Secrets + +Existing secrets can be imported by ARN, name, and other attributes (including the KMS key used to encrypt the secret). +Secrets imported by name should use the short-form of the name (without the SecretsManager-provided suffix); +the secret name must exist in the same account and region as the stack. +Importing by name makes it easier to reference secrets created in different regions, each with their own suffix and ARN. + +```ts +const secretCompleteArn = 'arn:aws:secretsmanager:eu-west-1:111111111111:secret:MySecret-f3gDy9'; +const secretPartialArn = 'arn:aws:secretsmanager:eu-west-1:111111111111:secret:MySecret'; // No Secrets Manager suffix +const encryptionKey = kms.Key.fromKeyArn(this, 'MyEncKey', 'arn:aws:kms:eu-west-1:111111111111:key/21c4b39b-fde2-4273-9ac0-d9bb5c0d0030'); +const mySecretFromCompleteArn = secretsmanager.Secret.fromSecretCompleteArn(this, 'SecretFromCompleteArn', secretCompleteArn); +const mySecretFromPartialArn = secretsmanager.Secret.fromSecretPartialArn(this, 'SecretFromPartialArn', secretPartialArn); +const mySecretFromName = secretsmanager.Secret.fromSecretNameV2(this, 'SecretFromName', 'MySecret') +const mySecretFromAttrs = secretsmanager.Secret.fromSecretAttributes(this, 'SecretFromAttributes', { + secretCompleteArn, + encryptionKey, +}); +``` + +## Replicating secrets + +Secrets can be replicated to multiple regions by specifying `replicaRegions`: + +```ts +declare const myKey: kms.Key; +new secretsmanager.Secret(this, 'Secret', { + replicaRegions: [ + { + region: 'eu-west-1', + }, + { + region: 'eu-central-1', + encryptionKey: myKey, + } + ] +}); +``` + +Alternatively, use `addReplicaRegion()`: + +```ts +const secret = new secretsmanager.Secret(this, 'Secret'); +secret.addReplicaRegion('eu-west-1'); +``` + +## Creating JSON Secrets + +Sometimes it is necessary to create a secret in SecretsManager that contains a JSON object. +For example: + +```json +{ + "username": "myUsername", + "database": "foo", + "password": "mypassword" +} +``` + +In order to create this type of secret, use the `secretObjectValue` input prop. + +```ts +const user = new iam.User(stack, 'User'); +const accessKey = new iam.AccessKey(stack, 'AccessKey', { user }); +declare const stack: Stack; + +new secretsmanager.Secret(stack, 'Secret', { + secretObjectValue: { + username: SecretValue.unsafePlainText(user.userName), + database: SecretValue.unsafePlainText('foo'), + password: accessKey.secretAccessKey, + }, +}) +``` + +In this case both the `username` and `database` are not a `Secret` so `SecretValue.unsafePlainText` needs to be used. +This means that they will be rendered as plain text in the template, but in this case neither of those +are actual "secrets". diff --git a/packages/aws-cdk-lib/aws-secretsmanager/index.ts b/packages/aws-cdk-lib/aws-secretsmanager/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-secretsmanager/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/index.ts b/packages/aws-cdk-lib/aws-secretsmanager/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-secretsmanager/lib/index.ts rename to packages/aws-cdk-lib/aws-secretsmanager/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-secretsmanager/lib/policy.ts b/packages/aws-cdk-lib/aws-secretsmanager/lib/policy.ts new file mode 100644 index 0000000000000..168ddd0096d57 --- /dev/null +++ b/packages/aws-cdk-lib/aws-secretsmanager/lib/policy.ts @@ -0,0 +1,45 @@ +import * as iam from '../../aws-iam'; +import { Resource } from '../../core'; +import { Construct } from 'constructs'; +import { ISecret } from './secret'; +import { CfnResourcePolicy } from './secretsmanager.generated'; + +/** + * Construction properties for a ResourcePolicy + */ +export interface ResourcePolicyProps { + /** + * The secret to attach a resource-based permissions policy + */ + readonly secret: ISecret; +} + +/** + * Resource Policy for SecretsManager Secrets + * + * Policies define the operations that are allowed on this resource. + * + * You almost never need to define this construct directly. + * + * All AWS resources that support resource policies have a method called + * `addToResourcePolicy()`, which will automatically create a new resource + * policy if one doesn't exist yet, otherwise it will add to the existing + * policy. + * + * Prefer to use `addToResourcePolicy()` instead. + */ +export class ResourcePolicy extends Resource { + /** + * The IAM policy document for this policy. + */ + public readonly document = new iam.PolicyDocument(); + + constructor(scope: Construct, id: string, props: ResourcePolicyProps) { + super(scope, id); + + new CfnResourcePolicy(this, 'Resource', { + resourcePolicy: this.document, + secretId: props.secret.secretArn, + }); + } +} diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts b/packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts similarity index 98% rename from packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts rename to packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts index 4174a56fa36a1..ec12478e55093 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/rotation-schedule.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, Resource, Stack } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import { Duration, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { ISecret, Secret } from './secret'; import { CfnRotationSchedule } from './secretsmanager.generated'; diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts b/packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts similarity index 98% rename from packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts rename to packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts index 41253801bc88e..a7cc04093608a 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret-rotation.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/lib/secret-rotation.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as serverless from '@aws-cdk/aws-sam'; -import { Duration, Names, Stack, Token, CfnMapping, Aws, RemovalPolicy } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as lambda from '../../aws-lambda'; +import * as serverless from '../../aws-sam'; +import { Duration, Names, Stack, Token, CfnMapping, Aws, RemovalPolicy } from '../../core'; import { Construct } from 'constructs'; import { ISecret } from './secret'; diff --git a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts b/packages/aws-cdk-lib/aws-secretsmanager/lib/secret.ts similarity index 99% rename from packages/@aws-cdk/aws-secretsmanager/lib/secret.ts rename to packages/aws-cdk-lib/aws-secretsmanager/lib/secret.ts index e05a14c89ee06..fba056ed26b82 100644 --- a/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/lib/secret.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { ArnFormat, FeatureFlags, Fn, IResource, Lazy, RemovalPolicy, Resource, ResourceProps, SecretValue, Stack, Token, TokenComparison } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { ArnFormat, FeatureFlags, Fn, IResource, Lazy, RemovalPolicy, Resource, ResourceProps, SecretValue, Stack, Token, TokenComparison } from '../../core'; +import * as cxapi from '../../cx-api'; import { IConstruct, Construct } from 'constructs'; import { ResourcePolicy } from './policy'; import { RotationSchedule, RotationScheduleOptions } from './rotation-schedule'; diff --git a/packages/@aws-cdk/aws-secretsmanager/test/example.app-with-secret.lit.ts b/packages/aws-cdk-lib/aws-secretsmanager/test/example.app-with-secret.lit.ts similarity index 88% rename from packages/@aws-cdk/aws-secretsmanager/test/example.app-with-secret.lit.ts rename to packages/aws-cdk-lib/aws-secretsmanager/test/example.app-with-secret.lit.ts index c57e831a9bb2a..f631e4d44be3a 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/example.app-with-secret.lit.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/test/example.app-with-secret.lit.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as secretsmanager from '../lib'; class ExampleStack extends cdk.Stack { diff --git a/packages/aws-cdk-lib/aws-secretsmanager/test/integ.secret.lit.ts b/packages/aws-cdk-lib/aws-secretsmanager/test/integ.secret.lit.ts new file mode 100644 index 0000000000000..881c7c1db3877 --- /dev/null +++ b/packages/aws-cdk-lib/aws-secretsmanager/test/integ.secret.lit.ts @@ -0,0 +1,57 @@ +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import { SecretValue } from '../../core'; +import * as secretsmanager from '../lib'; + +class SecretsManagerStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const role = new iam.Role(this, 'TestRole', { assumedBy: new iam.AccountRootPrincipal() }); + + /// !show + // Default secret + const secret = new secretsmanager.Secret(this, 'Secret'); + secret.grantRead(role); + + const user = new iam.User(this, 'User', { + password: secret.secretValue, + }); + + // Templated secret + const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', { + generateSecretString: { + secretStringTemplate: JSON.stringify({ username: 'user' }), + generateStringKey: 'password', + }, + }); + + new iam.User(this, 'OtherUser', { + // 'userName' is not actually a secret, so it's okay to use `unsafeUnwrap` to convert + // the `SecretValue` into a 'string'. + userName: templatedSecret.secretValueFromJson('username').unsafeUnwrap(), + password: templatedSecret.secretValueFromJson('password'), + }); + + // Secret with predefined value + const accessKey = new iam.AccessKey(this, 'AccessKey', { user }); + new secretsmanager.Secret(this, 'PredefinedSecret', { + secretStringValue: accessKey.secretAccessKey, + }); + + // JSON secret + new secretsmanager.Secret(this, 'JSONSecret', { + secretObjectValue: { + username: SecretValue.unsafePlainText(user.userName), + database: SecretValue.unsafePlainText('foo'), + password: accessKey.secretAccessKey, + }, + }); + /// !hide + } +} + +const app = new cdk.App(); +new SecretsManagerStack(app, 'Integ-SecretsManager-Secret'); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-secretsmanager/test/policy.test.ts b/packages/aws-cdk-lib/aws-secretsmanager/test/policy.test.ts new file mode 100644 index 0000000000000..a73191ba37f7b --- /dev/null +++ b/packages/aws-cdk-lib/aws-secretsmanager/test/policy.test.ts @@ -0,0 +1,43 @@ +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; +import * as secretsmanager from '../lib'; +import { AttachmentTargetType, ISecretAttachmentTarget } from '../lib'; + +class MockAttachmentTarget extends cdk.Resource implements ISecretAttachmentTarget { + asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { + return { + targetId: 'mock-id', + targetType: AttachmentTargetType.RDS_DB_INSTANCE, + }; + } +} + +describe.each([ + [false, 2], + [true, 1], +])('@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments=%s', (featureFlagValue, expectedResourcePolicyCount) => { + const app = new cdk.App({ + context: { + [cxapi.SECRETS_MANAGER_TARGET_ATTACHMENT_RESOURCE_POLICY]: featureFlagValue, + }, + }); + const stack = new cdk.Stack(app); + + test('using addToResourcePolicy on a Secret and on a SecretAttachmentTarget attaching this Secret', () => { + // GIVEN + + const secret = new secretsmanager.Secret(stack, 'Secret'); + const servicePrincipalOne = new iam.ServicePrincipal('some-service-a'); + const servicePrincipalTwo = new iam.ServicePrincipal('some-service-b'); + const secretAttachment = secret.attach(new MockAttachmentTarget(stack, 'mock-target')); + + // WHEN + secret.grantRead(servicePrincipalOne); + secretAttachment.grantRead(servicePrincipalTwo); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::SecretsManager::ResourcePolicy', expectedResourcePolicyCount); + }); +}); diff --git a/packages/@aws-cdk/aws-secretsmanager/test/rotation-schedule.test.ts b/packages/aws-cdk-lib/aws-secretsmanager/test/rotation-schedule.test.ts similarity index 98% rename from packages/@aws-cdk/aws-secretsmanager/test/rotation-schedule.test.ts rename to packages/aws-cdk-lib/aws-secretsmanager/test/rotation-schedule.test.ts index 9acb8991794ec..1fd2e7cd3268d 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/rotation-schedule.test.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/test/rotation-schedule.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as cdk from '@aws-cdk/core'; -import { Duration } from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as cdk from '../../core'; +import { Duration } from '../../core'; import * as secretsmanager from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-secretsmanager/test/secret-rotation.test.ts b/packages/aws-cdk-lib/aws-secretsmanager/test/secret-rotation.test.ts similarity index 98% rename from packages/@aws-cdk/aws-secretsmanager/test/secret-rotation.test.ts rename to packages/aws-cdk-lib/aws-secretsmanager/test/secret-rotation.test.ts index 81656443c5efe..62c9ac980ccb4 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/secret-rotation.test.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/test/secret-rotation.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import * as secretsmanager from '../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-secretsmanager/test/secret.test.ts b/packages/aws-cdk-lib/aws-secretsmanager/test/secret.test.ts similarity index 99% rename from packages/@aws-cdk/aws-secretsmanager/test/secret.test.ts rename to packages/aws-cdk-lib/aws-secretsmanager/test/secret.test.ts index 8380d14abc10d..823be63ae9ad9 100644 --- a/packages/@aws-cdk/aws-secretsmanager/test/secret.test.ts +++ b/packages/aws-cdk-lib/aws-secretsmanager/test/secret.test.ts @@ -1,9 +1,9 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as secretsmanager from '../lib'; let app: cdk.App; diff --git a/packages/aws-cdk-lib/aws-securityhub/.jsiirc.json b/packages/aws-cdk-lib/aws-securityhub/.jsiirc.json new file mode 100644 index 0000000000000..4b0b3d134ba8a --- /dev/null +++ b/packages/aws-cdk-lib/aws-securityhub/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SecurityHub" + }, + "java": { + "package": "software.amazon.awscdk.services.securityhub" + }, + "python": { + "module": "aws_cdk.aws_securityhub" + } + } +} diff --git a/packages/aws-cdk-lib/aws-securityhub/README.md b/packages/aws-cdk-lib/aws-securityhub/README.md new file mode 100644 index 0000000000000..ae9c3df468d22 --- /dev/null +++ b/packages/aws-cdk-lib/aws-securityhub/README.md @@ -0,0 +1,27 @@ +# AWS Security Hub Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as securityhub from 'aws-cdk-lib/aws-securityhub'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SecurityHub construct libraries](https://constructs.dev/search?q=securityhub) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SecurityHub resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SecurityHub.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SecurityHub](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SecurityHub.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-securityhub/index.ts b/packages/aws-cdk-lib/aws-securityhub/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-securityhub/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-securityhub/lib/index.ts b/packages/aws-cdk-lib/aws-securityhub/lib/index.ts new file mode 100644 index 0000000000000..81e410c83ebf7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-securityhub/lib/index.ts @@ -0,0 +1 @@ +export * from './securityhub.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-servicecatalog/.jsiirc.json b/packages/aws-cdk-lib/aws-servicecatalog/.jsiirc.json new file mode 100644 index 0000000000000..1d8072a4325ed --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.servicecatalog" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.Servicecatalog" + }, + "python": { + "module": "aws_cdk.aws_servicecatalog" + } + } +} diff --git a/packages/aws-cdk-lib/aws-servicecatalog/README.md b/packages/aws-cdk-lib/aws-servicecatalog/README.md new file mode 100644 index 0000000000000..f0db4e0f6f1a3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/README.md @@ -0,0 +1,594 @@ +# AWS Service Catalog Construct Library + + +[AWS Service Catalog](https://docs.aws.amazon.com/servicecatalog/latest/dg/what-is-service-catalog.html) +enables organizations to create and manage catalogs of products for their end users that are approved for use on AWS. + +## Table Of Contents + +- [Portfolio](#portfolio) + - [Granting access to a portfolio](#granting-access-to-a-portfolio) + - [Sharing a portfolio with another AWS account](#sharing-a-portfolio-with-another-aws-account) +- [Product](#product) + - [Creating a product from a local asset](#creating-a-product-from-local-asset) + - [Creating a product from a stack](#creating-a-product-from-a-stack) + - [Using Assets in your Product Stack](#using-aseets-in-your-product-stack) + - [Creating a Product from a stack with a history of previous versions](#creating-a-product-from-a-stack-with-a-history-of-all-previous-versions) + - [Adding a product to a portfolio](#adding-a-product-to-a-portfolio) +- [TagOptions](#tag-options) +- [Constraints](#constraints) + - [Tag update constraint](#tag-update-constraint) + - [Notify on stack events](#notify-on-stack-events) + - [CloudFormation template parameters constraint](#cloudformation-template-parameters-constraint) + - [Set launch role](#set-launch-role) + - [Deploy with StackSets](#deploy-with-stacksets) + + +The `@aws-cdk/aws-servicecatalog` package contains resources that enable users to automate governance and management of their AWS resources at scale. + +```ts nofixture +import * as servicecatalog from 'aws-cdk-lib/aws-servicecatalog'; +``` + +## Portfolio + +AWS Service Catalog portfolios allow administrators to organize, manage, and distribute cloud resources for their end users. +Using the CDK, a new portfolio can be created with the `Portfolio` construct: + +```ts +new servicecatalog.Portfolio(this, 'Portfolio', { + displayName: 'MyPortfolio', + providerName: 'MyTeam', +}); +``` + +You can also specify optional metadata properties such as `description` and `messageLanguage` +to help better catalog and manage your portfolios. + +```ts +new servicecatalog.Portfolio(this, 'Portfolio', { + displayName: 'MyFirstPortfolio', + providerName: 'SCAdmin', + description: 'Portfolio for a project', + messageLanguage: servicecatalog.MessageLanguage.EN, +}); +``` + +Read more at [Creating and Managing Portfolios](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/catalogs_portfolios.html). + +To reference an existing portfolio into your CDK application, use the `Portfolio.fromPortfolioArn()` factory method: + +```ts +const portfolio = servicecatalog.Portfolio.fromPortfolioArn(this, 'ReferencedPortfolio', + 'arn:aws:catalog:region:account-id:portfolio/port-abcdefghi'); +``` + +### Granting access to a portfolio + +You can grant access to and manage the `IAM` users, groups, or roles that have access to the products within a portfolio. +Entities with granted access will be able to utilize the portfolios resources and products via the console or AWS CLI. +Once resources are deployed end users will be able to access them via the console or service catalog CLI. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +declare const portfolio: servicecatalog.Portfolio; + +const user = new iam.User(this, 'User'); +portfolio.giveAccessToUser(user); + +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.AccountRootPrincipal(), +}); +portfolio.giveAccessToRole(role); + +const group = new iam.Group(this, 'Group'); +portfolio.giveAccessToGroup(group); +``` + +### Sharing a portfolio with another AWS account + +You can use account-to-account sharing to distribute a reference to your portfolio to other AWS accounts by passing the recipient account number. +After the share is initiated, the recipient account can accept the share via CLI or console by importing the portfolio ID. +Changes made to the shared portfolio will automatically propagate to recipients. + +```ts +declare const portfolio: servicecatalog.Portfolio; +portfolio.shareWithAccount('012345678901'); +``` + +## Product + +Products are version friendly infrastructure-as-code templates that admins create and add to portfolios for end users to provision and create AWS resources. +Service Catalog supports products from AWS Marketplace or ones defined by a CloudFormation template. +The CDK currently only supports adding products of type CloudFormation. +Using the CDK, a new Product can be created with the `CloudFormationProduct` construct. +You can use `CloudFormationTemplate.fromUrl` to create a Product from a CloudFormation template directly from a URL that points to the template in S3, GitHub, or CodeCommit: + +```ts +const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', { + productName: "My Product", + owner: "Product Owner", + productVersions: [ + { + productVersionName: "v1", + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromUrl( + 'https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/ServiceCatalog/Product.yaml'), + }, + ], +}); +``` + +### Creating a product from a local asset + +A `CloudFormationProduct` can also be created by using a CloudFormation template held locally on disk using Assets. +Assets are files that are uploaded to an S3 Bucket before deployment. +`CloudFormationTemplate.fromAsset` can be utilized to create a Product by passing the path to a local template file on your disk: + +```ts +import * as path from 'path'; + +const product = new servicecatalog.CloudFormationProduct(this, 'Product', { + productName: "My Product", + owner: "Product Owner", + productVersions: [ + { + productVersionName: "v1", + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromUrl( + 'https://raw.githubusercontent.com/awslabs/aws-cloudformation-templates/master/aws/services/ServiceCatalog/Product.yaml'), + }, + { + productVersionName: "v2", + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromAsset(path.join(__dirname, 'development-environment.template.json')), + }, + ], +}); +``` + +### Creating a product from a stack + +You can create a Service Catalog `CloudFormationProduct` entirely defined with CDK code using a service catalog `ProductStack`. +A separate child stack for your product is created and you can add resources like you would for any other CDK stack, +such as an S3 Bucket, IAM roles, and EC2 instances. This stack is passed in as a product version to your +product. This will not create a separate CloudFormation stack during deployment. + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; + +class S3BucketProduct extends servicecatalog.ProductStack { + constructor(scope: Construct, id: string) { + super(scope, id); + + new s3.Bucket(this, 'BucketProduct'); + } +} + +const product = new servicecatalog.CloudFormationProduct(this, 'Product', { + productName: "My Product", + owner: "Product Owner", + productVersions: [ + { + productVersionName: "v1", + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new S3BucketProduct(this, 'S3BucketProduct')), + }, + ], +}); +``` + +### Using Assets in your Product Stack + +You can reference assets in a Product Stack. For example, we can add a handler to a Lambda function or a S3 Asset directly from a local asset file. +In this case, you must provide a S3 Bucket with a bucketName to store your assets. + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as cdk from 'aws-cdk-lib'; +import { Bucket } from "aws-cdk-lib/aws-s3"; + +class LambdaProduct extends servicecatalog.ProductStack { + constructor(scope: Construct, id: string) { + super(scope, id); + + new lambda.Function(this, 'LambdaProduct', { + runtime: lambda.Runtime.PYTHON_3_9, + code: lambda.Code.fromAsset("./assets"), + handler: 'index.handler' + }); + } +} + +const userDefinedBucket = new Bucket(this, `UserDefinedBucket`, { + bucketName: 'user-defined-bucket-for-product-stack-assets', +}); + +const product = new servicecatalog.CloudFormationProduct(this, 'Product', { + productName: "My Product", + owner: "Product Owner", + productVersions: [ + { + productVersionName: "v1", + cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(new LambdaProduct(this, 'LambdaFunctionProduct', { + assetBucket: userDefinedBucket, + })), + }, + ], +}); +``` + +When a product containing an asset is shared with a spoke account, the corresponding asset bucket +will automatically grant read permissions to the spoke account. +Note, it is not recommended using a referenced bucket as permissions cannot be added from CDK. +In this case, it will be your responsibility to grant read permissions for the asset bucket to +the spoke account. +If you want to provide your own bucket policy or scope down your bucket policy further to only allow +reads from a specific launch role, refer to the following example policy: + +```ts +new iam.PolicyStatement({ + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', ], + effect: iam.Effect.ALLOW, + resources: [ + bucket.bucketArn, + bucket.arnForObjects('*'), + ], + principals: [ + new iam.ArnPrincipal(cdk.Stack.of(this).formatArn({ + service: 'iam', + region: '', + sharedAccount, + resource: 'role', + resourceName: launchRoleName, + })) + ], + conditions: { + 'ForAnyValue:StringEquals': { + 'aws:CalledVia': ['cloudformation.amazonaws.com'], + }, + 'Bool': { + 'aws:ViaAWSService': true, + }, + }, +}); +``` + +Furthermore, in order for a spoke account to provision a product with an asset, the role launching +the product needs permissions to read from the asset bucket. +We recommend you utilize a launch role with permissions to read from the asset bucket. +For example your launch role would need to include at least the following policy: + +```json +{ + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "s3:GetObject" + ], + "Resource": "*" + } + ] +} +``` + +Please refer to [Set launch role](#set-launch-role) for additional details about launch roles. +See [Launch Constraint](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/constraints-launch.html) documentation +to understand the permissions that launch roles need. + +### Creating a Product from a stack with a history of previous versions + +The default behavior of Service Catalog is to overwrite each product version upon deployment. +This applies to Product Stacks as well, where only the latest changes to your Product Stack will +be deployed. +To keep a history of the revisions of a ProductStack available in Service Catalog, +you would need to define a ProductStack for each historical copy. + +You can instead create a `ProductStackHistory` to maintain snapshots of all previous versions. +The `ProductStackHistory` can be created by passing the base `productStack`, +a `currentVersionName` for your current version and a `locked` boolean. +The `locked` boolean which when set to true will prevent your `currentVersionName` +from being overwritten when there is an existing snapshot for that version. + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; + +class S3BucketProduct extends servicecatalog.ProductStack { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + new s3.Bucket(this, 'BucketProduct'); + } +} + +const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', { + productStack: new S3BucketProduct(this, 'S3BucketProduct'), + currentVersionName: 'v1', + currentVersionLocked: true +}); +``` + +We can deploy the current version `v1` by using `productStackHistory.currentVersion()` + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; + +class S3BucketProduct extends servicecatalog.ProductStack { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + new s3.Bucket(this, 'BucketProductV2'); + } +} + +const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', { + productStack: new S3BucketProduct(this, 'S3BucketProduct'), + currentVersionName: 'v2', + currentVersionLocked: true +}); + +const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', { + productName: "My Product", + owner: "Product Owner", + productVersions: [ + productStackHistory.currentVersion(), + ], +}); +``` + +Using `ProductStackHistory` all deployed templates for the ProductStack will be written to disk, +so that they will still be available in the future as the definition of the `ProductStack` subclass changes over time. +**It is very important** that you commit these old versions to source control as these versions +determine whether a version has already been deployed and can also be deployed themselves. + +After using `ProductStackHistory` to deploy version `v1` of your `ProductStack`, we +make changes to the `ProductStack` and update the `currentVersionName` to `v2`. +We still want our `v1` version to still be deployed, so we reference it by calling `productStackHistory.versionFromSnapshot('v1')`. + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as cdk from 'aws-cdk-lib'; + +class S3BucketProduct extends servicecatalog.ProductStack { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + new s3.Bucket(this, 'BucketProductV2'); + } +} + +const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', { + productStack: new S3BucketProduct(this, 'S3BucketProduct'), + currentVersionName: 'v2', + currentVersionLocked: true +}); + +const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', { + productName: "My Product", + owner: "Product Owner", + productVersions: [ + productStackHistory.currentVersion(), + productStackHistory.versionFromSnapshot('v1') + ], +}); +``` + +### Adding a product to a portfolio + +You add products to a portfolio to organize and distribute your catalog at scale. Adding a product to a portfolio creates an association, +and the product will become visible within the portfolio side in both the Service Catalog console and AWS CLI. +You can add a product to multiple portfolios depending on your organizational structure and how you would like to group access to products. + +```ts +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +portfolio.addProduct(product); +``` + +## Tag Options + +TagOptions allow administrators to easily manage tags on provisioned products by providing a template for a selection of tags that end users choose from. +TagOptions are created by specifying a tag key with a set of allowed values and can be associated with both portfolios and products. +When launching a product, both the TagOptions associated with the product and the containing portfolio are made available. + +At the moment, TagOptions can only be deactivated in the console. + +```ts +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +const tagOptionsForPortfolio = new servicecatalog.TagOptions(this, 'OrgTagOptions', { + allowedValuesForTags: { + Group: ['finance', 'engineering', 'marketing', 'research'], + CostCenter: ['01', '02','03'], + }, +}); +portfolio.associateTagOptions(tagOptionsForPortfolio); + +const tagOptionsForProduct = new servicecatalog.TagOptions(this, 'ProductTagOptions', { + allowedValuesForTags: { + Environment: ['dev', 'alpha', 'prod'], + }, +}); +product.associateTagOptions(tagOptionsForProduct); +``` + +## Constraints + +Constraints are governance gestures that you place on product-portfolio associations that allow you to manage minimal launch permissions, notifications, and other optional actions that end users can perform on products. +Using the CDK, if you do not explicitly associate a product to a portfolio and add a constraint, it will automatically add an association for you. + +There are rules around how constraints are applied to portfolio-product associations. +For example, you can only have a single "launch role" constraint applied to a portfolio-product association. +If a misconfigured constraint is added, `synth` will fail with an error message. + +Read more at [Service Catalog Constraints](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/constraints.html). + +### Tag update constraint + +Tag update constraints allow or disallow end users to update tags on resources associated with an AWS Service Catalog product upon provisioning. +By default, if a Tag Update constraint is not configured, tag updating is not permitted. +If tag updating is allowed, then new tags associated with the product or portfolio will be applied to provisioned resources during a provisioned product update. + +```ts +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +portfolio.addProduct(product); +portfolio.constrainTagUpdates(product); +``` + +If you want to disable this feature later on, you can update it by setting the "allow" parameter to `false`: + +```ts +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +// to disable tag updates: +portfolio.constrainTagUpdates(product, { + allow: false, +}); +``` + +### Notify on stack events + +Allows users to subscribe an AWS `SNS` topic to a provisioned product's CloudFormation stack events. +When an end user provisions a product it creates a CloudFormation stack that notifies the subscribed topic on creation, edit, and delete events. +An individual `SNS` topic may only have a single subscription to any given portfolio-product association. + +```ts +import * as sns from 'aws-cdk-lib/aws-sns'; + +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +const topic1 = new sns.Topic(this, 'Topic1'); +portfolio.notifyOnStackEvents(product, topic1); + +const topic2 = new sns.Topic(this, 'Topic2'); +portfolio.notifyOnStackEvents(product, topic2, { + description: 'description for topic2', // description is an optional field. +}); +``` + +### CloudFormation template parameters constraint + +CloudFormation template parameter constraints allow you to configure the provisioning parameters that are available to end users when they launch a product. +Template constraint rules consist of one or more assertions that define the default and/or allowable values for a product’s provisioning parameters. +You can configure multiple parameter constraints to govern the different provisioning parameters within your products. +For example, a rule might define the `EC2` instance types that users can choose from when launching a product that includes one or more `EC2` instances. +Parameter rules have an optional `condition` field that allow for rule application to consider conditional evaluations. +If a `condition` is specified, all assertions will be applied if the condition evaluates to true. +For information on rule-specific intrinsic functions to define rule conditions and assertions, +see [AWS Rule Functions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html). + +```ts +import * as cdk from 'aws-cdk-lib'; + +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +portfolio.constrainCloudFormationParameters(product, { + rule: { + ruleName: 'testInstanceType', + condition: cdk.Fn.conditionEquals(cdk.Fn.ref('Environment'), 'test'), + assertions: [{ + assert: cdk.Fn.conditionContains(['t2.micro', 't2.small'], cdk.Fn.ref('InstanceType')), + description: 'For test environment, the instance type should be small', + }], + }, +}); +``` + +### Set launch role + +Allows you to configure a specific `IAM` role that Service Catalog assumes on behalf of the end user when launching a product. +By setting a launch role constraint, you can maintain least permissions for an end user when launching a product. +For example, a launch role can grant permissions for specific resource creation like an `S3` bucket that the user. +The launch role must be assumed by the Service Catalog principal. +You can only have one launch role set for a portfolio-product association, +and you cannot set a launch role on a product that already has a StackSets deployment configured. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +const launchRole = new iam.Role(this, 'LaunchRole', { + assumedBy: new iam.ServicePrincipal('servicecatalog.amazonaws.com'), +}); + +portfolio.setLaunchRole(product, launchRole); +``` + +You can also set the launch role using just the name of a role which is locally deployed in end user accounts. +This is useful for when roles and users are separately managed outside of the CDK. +The given role must exist in both the account that creates the launch role constraint, +as well as in any end user accounts that wish to provision a product with the launch role. + +You can do this by passing in the role with an explicitly set name: + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +const launchRole = new iam.Role(this, 'LaunchRole', { + roleName: 'MyRole', + assumedBy: new iam.ServicePrincipal('servicecatalog.amazonaws.com'), +}); + +portfolio.setLocalLaunchRole(product, launchRole); +``` + +Or you can simply pass in a role name and CDK will create a role with that name that trusts service catalog in the account: + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +const roleName = 'MyRole'; +const launchRole: iam.IRole = portfolio.setLocalLaunchRoleName(product, roleName); +``` + +See [Launch Constraint](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/constraints-launch.html) documentation +to understand the permissions that launch roles need. + +### Deploy with StackSets + +A StackSets deployment constraint allows you to configure product deployment options using +[AWS CloudFormation StackSets](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/using-stacksets.html). +You can specify one or more accounts and regions into which stack instances will launch when the product is provisioned. +There is an additional field `allowStackSetInstanceOperations` that sets ability for end users to create, edit, or delete the stacks created by the StackSet. +By default, this field is set to `false`. +When launching a StackSets product, end users can select from the list of accounts and regions configured in the constraint to determine where the Stack Instances will deploy and the order of deployment. +You can only define one StackSets deployment configuration per portfolio-product association, +and you cannot both set a launch role and StackSets deployment configuration for an assocation. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; + +declare const portfolio: servicecatalog.Portfolio; +declare const product: servicecatalog.CloudFormationProduct; + +const adminRole = new iam.Role(this, 'AdminRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); + +portfolio.deployWithStackSets(product, { + accounts: ['012345678901', '012345678902', '012345678903'], + regions: ['us-west-1', 'us-east-1', 'us-west-2', 'us-east-1'], + adminRole: adminRole, + executionRoleName: 'SCStackSetExecutionRole', // Name of role deployed in end users accounts. + allowStackSetInstanceOperations: true, +}); +``` diff --git a/packages/aws-cdk-lib/aws-servicecatalog/index.ts b/packages/aws-cdk-lib/aws-servicecatalog/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/cloudformation-template.ts similarity index 97% rename from packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/cloudformation-template.ts index d424d1a1ffcde..5ad6fe28cdb02 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/cloudformation-template.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/cloudformation-template.ts @@ -1,5 +1,5 @@ -import { IBucket } from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; +import { IBucket } from '../../aws-s3'; +import * as s3_assets from '../../aws-s3-assets'; import { Construct } from 'constructs'; import { hashValues } from './private/util'; import { ProductStack } from './product-stack'; diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/common.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/common.ts similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/lib/common.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/common.ts diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/constraints.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/constraints.ts similarity index 96% rename from packages/@aws-cdk/aws-servicecatalog/lib/constraints.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/constraints.ts index f3e2c32297003..e22a835e95154 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/constraints.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/constraints.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { MessageLanguage } from './common'; /** diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/index.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/lib/index.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/index.ts diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/portfolio.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/portfolio.ts similarity index 98% rename from packages/@aws-cdk/aws-servicecatalog/lib/portfolio.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/portfolio.ts index 725d2fb8936b4..06730303e4e18 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/portfolio.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/portfolio.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { IBucket } from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { IBucket } from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import { Construct, IConstruct } from 'constructs'; import { MessageLanguage } from './common'; import { diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/association-manager.ts similarity index 98% rename from packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/private/association-manager.ts index 0a10287683a93..8719c3d52226c 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/private/association-manager.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/association-manager.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sns from '../../../aws-sns'; +import * as cdk from '../../../core'; import { hashValues } from './util'; import { InputValidator } from './validation'; import { diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/product-stack-synthesizer.ts similarity index 94% rename from packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/private/product-stack-synthesizer.ts index 53a88bf463718..2971c6c0fceff 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/private/product-stack-synthesizer.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/product-stack-synthesizer.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { CfnBucket, IBucket } from '@aws-cdk/aws-s3'; -import { BucketDeployment, Source } from '@aws-cdk/aws-s3-deployment'; -import * as cdk from '@aws-cdk/core'; +import { CfnBucket, IBucket } from '../../../aws-s3'; +import { BucketDeployment, Source } from '../../../aws-s3-deployment'; +import * as cdk from '../../../core'; import { ProductStack } from '../product-stack'; /** diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/private/util.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/util.ts similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/lib/private/util.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/private/util.ts diff --git a/packages/aws-cdk-lib/aws-servicecatalog/lib/private/validation.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/validation.ts new file mode 100644 index 0000000000000..4e56a3911aae4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/private/validation.ts @@ -0,0 +1,57 @@ +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; + +/** + * Class to validate that inputs match requirements. + */ +export class InputValidator { + /** + * Validates length is between allowed min and max lengths. + */ + public static validateLength(resourceName: string, inputName: string, minLength: number, maxLength: number, inputString?: string): void { + if (!cdk.Token.isUnresolved(inputString) && inputString !== undefined && (inputString.length < minLength || inputString.length > maxLength)) { + throw new Error(`Invalid ${inputName} for resource ${resourceName}, must have length between ${minLength} and ${maxLength}, got: '${this.truncateString(inputString, 100)}'`); + } + } + + /** + * Validates string matches the allowed regex pattern. + */ + public static validateRegex(resourceName: string, inputName: string, regexp: RegExp, inputString?: string): void { + if (!cdk.Token.isUnresolved(inputString) && inputString !== undefined && !regexp.test(inputString)) { + throw new Error(`Invalid ${inputName} for resource ${resourceName}, must match regex pattern ${regexp}, got: '${this.truncateString(inputString, 100)}'`); + } + } + + /** + * Validates string matches the valid URL regex pattern. + */ + public static validateUrl(resourceName: string, inputName: string, inputString?: string): void { + this.validateRegex(resourceName, inputName, /^https?:\/\/.*/, inputString); + } + + /** + * Validates string matches the valid email regex pattern. + */ + public static validateEmail(resourceName: string, inputName: string, inputString?: string): void { + this.validateRegex(resourceName, inputName, /^[\w\d.%+\-]+@[a-z\d.\-]+\.[a-z]{2,4}$/i, inputString); + } + + /** + * Validates that a role being used as a local launch role has the role name set + */ + public static validateRoleNameSetForLocalLaunchRole(role: iam.IRole): void { + if (role.node.defaultChild) { + if (cdk.Token.isUnresolved((role.node.defaultChild as iam.CfnRole).roleName)) { + throw new Error(`Role ${role.node.id} used for Local Launch Role must have roleName explicitly set`); + } + } + } + + private static truncateString(string: string, maxLength: number): string { + if (string.length > maxLength) { + return string.substring(0, maxLength) + '[truncated]'; + } + return string; + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/product-stack-history.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/product-stack-history.ts similarity index 99% rename from packages/@aws-cdk/aws-servicecatalog/lib/product-stack-history.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/product-stack-history.ts index 5d62fa2e50547..0ec589e8bf8c7 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/product-stack-history.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/product-stack-history.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Names } from '@aws-cdk/core'; +import { Names } from '../../core'; import { Construct } from 'constructs'; import { CloudFormationTemplate } from './cloudformation-template'; import { DEFAULT_PRODUCT_STACK_SNAPSHOT_DIRECTORY } from './common'; diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/product-stack.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/product-stack.ts similarity index 97% rename from packages/@aws-cdk/aws-servicecatalog/lib/product-stack.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/product-stack.ts index 92822660318bc..6ec299427d5be 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/product-stack.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/product-stack.ts @@ -1,8 +1,8 @@ import * as crypto from 'crypto'; import * as fs from 'fs'; import * as path from 'path'; -import { IBucket } from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { IBucket } from '../../aws-s3'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { ProductStackSynthesizer } from './private/product-stack-synthesizer'; import { ProductStackHistory } from './product-stack-history'; diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/product.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/product.ts similarity index 98% rename from packages/@aws-cdk/aws-servicecatalog/lib/product.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/product.ts index 29bc47b76675a..f48becbc2294b 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/product.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/product.ts @@ -1,5 +1,5 @@ -import { IBucket } from '@aws-cdk/aws-s3'; -import { ArnFormat, IResource, Resource, Stack } from '@aws-cdk/core'; +import { IBucket } from '../../aws-s3'; +import { ArnFormat, IResource, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CloudFormationTemplate } from './cloudformation-template'; import { MessageLanguage } from './common'; diff --git a/packages/@aws-cdk/aws-servicecatalog/lib/tag-options.ts b/packages/aws-cdk-lib/aws-servicecatalog/lib/tag-options.ts similarity index 98% rename from packages/@aws-cdk/aws-servicecatalog/lib/tag-options.ts rename to packages/aws-cdk-lib/aws-servicecatalog/lib/tag-options.ts index 07a4cdcbe935c..5ef0a5d619707 100644 --- a/packages/@aws-cdk/aws-servicecatalog/lib/tag-options.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/lib/tag-options.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import { hashValues } from './private/util'; import { InputValidator } from './private/validation'; diff --git a/packages/aws-cdk-lib/aws-servicecatalog/test/assets/index.py b/packages/aws-cdk-lib/aws-servicecatalog/test/assets/index.py new file mode 100644 index 0000000000000..105bdadc3c1a8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/assets/index.py @@ -0,0 +1,7 @@ +import json + +def handler(event, context): + return { + 'statusCode': 200, + 'body': json.dumps('Hello from Lambda!') + } \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-servicecatalog/test/assetsv2/index.py b/packages/aws-cdk-lib/aws-servicecatalog/test/assetsv2/index.py new file mode 100644 index 0000000000000..059c625350f79 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/assetsv2/index.py @@ -0,0 +1,7 @@ +import json + +def handler(event, context): + return { + 'statusCode': 200, + 'body': json.dumps('Hello from Lambda again!') + } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-servicecatalog/test/portfolio.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sns/test/integ.sns-fifo.no-name.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-servicecatalog/test/portfolio.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicecatalog/test/portfolio.test.ts b/packages/aws-cdk-lib/aws-servicecatalog/test/portfolio.test.ts similarity index 99% rename from packages/@aws-cdk/aws-servicecatalog/test/portfolio.test.ts rename to packages/aws-cdk-lib/aws-servicecatalog/test/portfolio.test.ts index a85d1de05ae57..3f76f93c601c0 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/portfolio.test.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/portfolio.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import * as servicecatalog from '../lib'; describe('Portfolio', () => { diff --git a/packages/@aws-cdk/aws-servicecatalog/test/product-stack.test.ts b/packages/aws-cdk-lib/aws-servicecatalog/test/product-stack.test.ts similarity index 96% rename from packages/@aws-cdk/aws-servicecatalog/test/product-stack.test.ts rename to packages/aws-cdk-lib/aws-servicecatalog/test/product-stack.test.ts index 8a56bafa932f3..be0ed52d5b470 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/product-stack.test.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/product-stack.test.ts @@ -1,11 +1,11 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import * as s3_assets from '../../aws-s3-assets'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import * as servicecatalog from '../lib'; diff --git a/packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/cdk.out b/packages/aws-cdk-lib/aws-servicecatalog/test/product.integ.snapshot/cdk.out similarity index 100% rename from packages/@aws-cdk/aws-sqs/test/integ.sqs.js.snapshot/cdk.out rename to packages/aws-cdk-lib/aws-servicecatalog/test/product.integ.snapshot/cdk.out diff --git a/packages/@aws-cdk/aws-servicecatalog/test/product.test.ts b/packages/aws-cdk-lib/aws-servicecatalog/test/product.test.ts similarity index 99% rename from packages/@aws-cdk/aws-servicecatalog/test/product.test.ts rename to packages/aws-cdk-lib/aws-servicecatalog/test/product.test.ts index fdb4e7e5658b6..2b23f625e2005 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/product.test.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/product.test.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as sns from '@aws-cdk/aws-sns'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; import * as servicecatalog from '../lib'; import { DEFAULT_PRODUCT_STACK_SNAPSHOT_DIRECTORY } from '../lib'; import { ProductStackHistory } from '../lib/product-stack-history'; diff --git a/packages/aws-cdk-lib/aws-servicecatalog/test/product1.template.json b/packages/aws-cdk-lib/aws-servicecatalog/test/product1.template.json new file mode 100644 index 0000000000000..69c3138be93f4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/product1.template.json @@ -0,0 +1,98 @@ +{ + "AWSTemplateFormatVersion" : "2010-09-09", + + "Description" : "AWS Service Catalog sample template. Creates an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", + + "Parameters" : { + "KeyName": { + "Description" : "Name of an existing EC2 key pair for SSH access to the EC2 instance.", + "Type": "AWS::EC2::KeyPair::KeyName" + }, + + "InstanceType" : { + "Description" : "EC2 instance type.", + "Type" : "String", + "Default" : "t2.micro", + "AllowedValues" : [ "t2.micro", "t2.small", "t2.medium", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge" ] + }, + + "SSHLocation" : { + "Description" : "The IP address range that can SSH to the EC2 instance.", + "Type": "String", + "MinLength": "9", + "MaxLength": "18", + "Default": "0.0.0.0/0", + "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", + "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x." + } + }, + + "Metadata" : { + "AWS::CloudFormation::Interface" : { + "ParameterGroups" : [{ + "Label" : {"default": "Instance configuration"}, + "Parameters" : ["InstanceType"] + },{ + "Label" : {"default": "Security configuration"}, + "Parameters" : ["KeyName", "SSHLocation"] + }], + "ParameterLabels" : { + "InstanceType": {"default": "Server size:"}, + "KeyName": {"default": "Key pair:"}, + "SSHLocation": {"default": "CIDR range:"} + } + } + }, + + "Mappings" : { + "AWSRegionArch2AMI" : { + "us-east-1" : { "HVM64" : "ami-08842d60" }, + "us-west-2" : { "HVM64" : "ami-8786c6b7" }, + "us-west-1" : { "HVM64" : "ami-cfa8a18a" }, + "eu-west-1" : { "HVM64" : "ami-748e2903" }, + "ap-southeast-1" : { "HVM64" : "ami-d6e1c584" }, + "ap-northeast-1" : { "HVM64" : "ami-35072834" }, + "ap-southeast-2" : { "HVM64" : "ami-fd4724c7" }, + "sa-east-1" : { "HVM64" : "ami-956cc688" }, + "cn-north-1" : { "HVM64" : "ami-ac57c595" }, + "eu-central-1" : { "HVM64" : "ami-b43503a9" } + } + + }, + + "Resources" : { + "EC2Instance" : { + "Type" : "AWS::EC2::Instance", + "Properties" : { + "InstanceType" : { "Ref" : "InstanceType" }, + "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], + "KeyName" : { "Ref" : "KeyName" }, + "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "HVM64" ] } + } + }, + + "InstanceSecurityGroup" : { + "Type" : "AWS::EC2::SecurityGroup", + "Properties" : { + "GroupDescription" : "Enable SSH access via port 22", + "SecurityGroupIngress" : [ { + "IpProtocol" : "tcp", + "FromPort" : "22", + "ToPort" : "22", + "CidrIp" : { "Ref" : "SSHLocation"} + } ] + } + } + }, + + "Outputs" : { + "PublicDNSName" : { + "Description" : "Public DNS name of the new EC2 instance", + "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] } + }, + "PublicIPAddress" : { + "Description" : "Public IP address of the new EC2 instance", + "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicIp" ] } + } + } +} diff --git a/packages/aws-cdk-lib/aws-servicecatalog/test/product2.template.json b/packages/aws-cdk-lib/aws-servicecatalog/test/product2.template.json new file mode 100644 index 0000000000000..9785ab36f253f --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/product2.template.json @@ -0,0 +1,98 @@ +{ + "AWSTemplateFormatVersion" : "2010-09-09", + + "Description" : "AWS Service Catalog sample template. Creates an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", + + "Parameters" : { + "KeyName": { + "Description" : "Name of an existing EC2 key pair for SSH access to the EC2 instance.", + "Type": "AWS::EC2::KeyPair::KeyName" + }, + + "InstanceType" : { + "Description" : "EC2 instance type.", + "Type" : "String", + "Default" : "t2.micro", + "AllowedValues" : [ "t2.micro", "t2.small", "t2.medium"] + }, + + "SSHLocation" : { + "Description" : "The IP address range that can SSH to the EC2 instance.", + "Type": "String", + "MinLength": "9", + "MaxLength": "18", + "Default": "0.0.0.0/0", + "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", + "ConstraintDescription": "Must be a valid IP CIDR range of the form x.x.x.x/x." + } + }, + + "Metadata" : { + "AWS::CloudFormation::Interface" : { + "ParameterGroups" : [{ + "Label" : {"default": "Instance configuration"}, + "Parameters" : ["InstanceType"] + },{ + "Label" : {"default": "Security configuration"}, + "Parameters" : ["KeyName", "SSHLocation"] + }], + "ParameterLabels" : { + "InstanceType": {"default": "Server size:"}, + "KeyName": {"default": "Key pair:"}, + "SSHLocation": {"default": "CIDR range:"} + } + } + }, + + "Mappings" : { + "AWSRegionArch2AMI" : { + "us-east-1" : { "HVM64" : "ami-08842d60" }, + "us-west-2" : { "HVM64" : "ami-8786c6b7" }, + "us-west-1" : { "HVM64" : "ami-cfa8a18a" }, + "eu-west-1" : { "HVM64" : "ami-748e2903" }, + "ap-southeast-1" : { "HVM64" : "ami-d6e1c584" }, + "ap-northeast-1" : { "HVM64" : "ami-35072834" }, + "ap-southeast-2" : { "HVM64" : "ami-fd4724c7" }, + "sa-east-1" : { "HVM64" : "ami-956cc688" }, + "cn-north-1" : { "HVM64" : "ami-ac57c595" }, + "eu-central-1" : { "HVM64" : "ami-b43503a9" } + } + + }, + + "Resources" : { + "EC2Instance" : { + "Type" : "AWS::EC2::Instance", + "Properties" : { + "InstanceType" : { "Ref" : "InstanceType" }, + "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], + "KeyName" : { "Ref" : "KeyName" }, + "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "HVM64" ] } + } + }, + + "InstanceSecurityGroup" : { + "Type" : "AWS::EC2::SecurityGroup", + "Properties" : { + "GroupDescription" : "Enable SSH access via port 22", + "SecurityGroupIngress" : [ { + "IpProtocol" : "tcp", + "FromPort" : "22", + "ToPort" : "22", + "CidrIp" : { "Ref" : "SSHLocation"} + } ] + } + } + }, + + "Outputs" : { + "PublicDNSName" : { + "Description" : "Public DNS name of the new EC2 instance", + "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicDnsName" ] } + }, + "PublicIPAddress" : { + "Description" : "Public IP address of the new EC2 instance", + "Value" : { "Fn::GetAtt" : [ "EC2Instance", "PublicIp" ] } + } + } +} diff --git a/packages/@aws-cdk/aws-servicecatalog/test/tag-option.test.ts b/packages/aws-cdk-lib/aws-servicecatalog/test/tag-option.test.ts similarity index 98% rename from packages/@aws-cdk/aws-servicecatalog/test/tag-option.test.ts rename to packages/aws-cdk-lib/aws-servicecatalog/test/tag-option.test.ts index 54e0464da467e..d916834dc1b74 100644 --- a/packages/@aws-cdk/aws-servicecatalog/test/tag-option.test.ts +++ b/packages/aws-cdk-lib/aws-servicecatalog/test/tag-option.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as servicecatalog from '../lib'; describe('TagOptions', () => { diff --git a/packages/aws-cdk-lib/aws-servicecatalogappregistry/.jsiirc.json b/packages/aws-cdk-lib/aws-servicecatalogappregistry/.jsiirc.json new file mode 100644 index 0000000000000..7007ca5a43948 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalogappregistry/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Servicecatalogappregistry" + }, + "java": { + "package": "software.amazon.awscdk.services.servicecatalogappregistry" + }, + "python": { + "module": "aws_cdk.aws_servicecatalogappregistry" + } + } +} diff --git a/packages/aws-cdk-lib/aws-servicecatalogappregistry/README.md b/packages/aws-cdk-lib/aws-servicecatalogappregistry/README.md new file mode 100644 index 0000000000000..c2cec85d83bc7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalogappregistry/README.md @@ -0,0 +1,32 @@ +# AWS::ServiceCatalogAppRegistry Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as servicecatalogappregistry from 'aws-cdk-lib/aws-servicecatalogappregistry'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for ServiceCatalogAppRegistry construct libraries](https://constructs.dev/search?q=servicecatalogappregistry) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::ServiceCatalogAppRegistry resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ServiceCatalogAppRegistry.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-servicecatalogappregistry-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::ServiceCatalogAppRegistry](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_ServiceCatalogAppRegistry.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-servicecatalogappregistry/index.ts b/packages/aws-cdk-lib/aws-servicecatalogappregistry/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalogappregistry/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-servicecatalogappregistry/lib/index.ts b/packages/aws-cdk-lib/aws-servicecatalogappregistry/lib/index.ts new file mode 100644 index 0000000000000..16eba69aadf06 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicecatalogappregistry/lib/index.ts @@ -0,0 +1 @@ +export * from './servicecatalogappregistry.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-servicediscovery/.jsiirc.json b/packages/aws-cdk-lib/aws-servicediscovery/.jsiirc.json new file mode 100644 index 0000000000000..5cb9a44a29048 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.servicediscovery" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.ServiceDiscovery" + }, + "python": { + "module": "aws_cdk.aws_servicediscovery" + } + } +} diff --git a/packages/aws-cdk-lib/aws-servicediscovery/README.md b/packages/aws-cdk-lib/aws-servicediscovery/README.md new file mode 100644 index 0000000000000..5973d1d549c76 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/README.md @@ -0,0 +1,45 @@ +# Amazon ECS Service Discovery Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +This package contains constructs for working with **AWS Cloud Map** + +AWS Cloud Map is a fully managed service that you can use to create and +maintain a map of the backend services and resources that your applications +depend on. + +For further information on AWS Cloud Map, +see the [AWS Cloud Map documentation](https://docs.aws.amazon.com/cloud-map) + +## HTTP Namespace Example + +The following example creates an AWS Cloud Map namespace that +supports API calls, creates a service in that namespace, and +registers an instance to it: + +[Creating a Cloud Map service within an HTTP namespace](test/integ.service-with-http-namespace.lit.ts) + +## Private DNS Namespace Example + +The following example creates an AWS Cloud Map namespace that +supports both API calls and DNS queries within a vpc, creates a +service in that namespace, and registers a loadbalancer as an +instance. + +A secondary service is also configured which only supports API based discovery, a +non ip based resource is registered to this service: + +[Creating a Cloud Map service within a Private DNS namespace](test/integ.service-with-private-dns-namespace.lit.ts) + +## Public DNS Namespace Example + +The following example creates an AWS Cloud Map namespace that +supports both API calls and public DNS queries, creates a service in +that namespace, and registers an IP instance: + +[Creating a Cloud Map service within a Public namespace](test/integ.service-with-public-dns-namespace.lit.ts) + +For DNS namespaces, you can also register instances to services with CNAME records: + +[Creating a Cloud Map service within a Public namespace](test/integ.service-with-cname-record.lit.ts) diff --git a/packages/aws-cdk-lib/aws-servicediscovery/index.ts b/packages/aws-cdk-lib/aws-servicediscovery/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/alias-target-instance.ts similarity index 98% rename from packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/alias-target-instance.ts index 271b386963cab..defd9c6e324cf 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/alias-target-instance.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/alias-target-instance.ts @@ -1,4 +1,4 @@ -import { Names } from '@aws-cdk/core'; +import { Names } from '../../core'; import { Construct } from 'constructs'; import { BaseInstanceProps, InstanceBase } from './instance'; import { NamespaceType } from './namespace'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/cname-instance.ts similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/lib/cname-instance.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/cname-instance.ts diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/http-namespace.ts similarity index 98% rename from packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/http-namespace.ts index 6b614f3f0bfa7..845ada96911b8 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/http-namespace.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/http-namespace.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { BaseNamespaceProps, INamespace, NamespaceType } from './namespace'; import { BaseServiceProps, Service } from './service'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/index.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/lib/index.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-servicediscovery/lib/instance.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/instance.ts new file mode 100644 index 0000000000000..f5e933fa5b0c8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/instance.ts @@ -0,0 +1,56 @@ +import { IResource, Names, Resource } from '../../core'; +import { IService } from './service'; + +export interface IInstance extends IResource { + /** + * The id of the instance resource + * @attribute + */ + readonly instanceId: string; + + /** + * The Cloudmap service this resource is registered to. + */ + readonly service: IService; +} + +/** + * Used when the resource that's associated with the service instance is accessible using values other than an IP + * address or a domain name (CNAME), i.e. for non-ip-instances + */ +export interface BaseInstanceProps { + /** + * The id of the instance resource + * + * @default Automatically generated name + */ + readonly instanceId?: string; + + /** + * Custom attributes of the instance. + * + * @default none + */ + readonly customAttributes?: { [key: string]: string }; +} + +export abstract class InstanceBase extends Resource implements IInstance { + /** + * The Id of the instance + */ + public abstract readonly instanceId: string; + + /** + * The Cloudmap service to which the instance is registered. + */ + public abstract readonly service: IService; + + /** + * Generate a unique instance Id that is safe to pass to CloudMap + */ + protected uniqueInstanceId() { + // Max length of 64 chars, get the last 64 chars + const id = Names.uniqueId(this); + return id.substring(Math.max(id.length - 64, 0), id.length); + } +} diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/ip-instance.ts similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/lib/ip-instance.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/ip-instance.ts diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/namespace.ts similarity index 96% rename from packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/namespace.ts index 5073ab34db237..9bb3bba4800ca 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/namespace.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/namespace.ts @@ -1,4 +1,4 @@ -import { IResource } from '@aws-cdk/core'; +import { IResource } from '../../core'; export interface INamespace extends IResource { /** diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/non-ip-instance.ts similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/lib/non-ip-instance.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/non-ip-instance.ts diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/private-dns-namespace.ts similarity index 97% rename from packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/private-dns-namespace.ts index baf40ca47176f..75994718985e9 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/private-dns-namespace.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/private-dns-namespace.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import { Resource } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { BaseNamespaceProps, INamespace, NamespaceType } from './namespace'; import { DnsServiceProps, Service } from './service'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/private/utils.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/private/utils.ts similarity index 100% rename from packages/@aws-cdk/aws-servicediscovery/lib/private/utils.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/private/utils.ts diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/public-dns-namespace.ts similarity index 98% rename from packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/public-dns-namespace.ts index 5c18dce44bacf..fb9dcfa42ad75 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/public-dns-namespace.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/public-dns-namespace.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { BaseNamespaceProps, INamespace, NamespaceType } from './namespace'; import { DnsServiceProps, Service } from './service'; diff --git a/packages/@aws-cdk/aws-servicediscovery/lib/service.ts b/packages/aws-cdk-lib/aws-servicediscovery/lib/service.ts similarity index 99% rename from packages/@aws-cdk/aws-servicediscovery/lib/service.ts rename to packages/aws-cdk-lib/aws-servicediscovery/lib/service.ts index f61ce38ca5f1b..22cfd0b814343 100644 --- a/packages/@aws-cdk/aws-servicediscovery/lib/service.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/lib/service.ts @@ -1,5 +1,5 @@ -import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; -import { Duration, IResource, Resource } from '@aws-cdk/core'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import { Duration, IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { AliasTargetInstance } from './alias-target-instance'; import { CnameInstance, CnameInstanceBaseProps } from './cname-instance'; diff --git a/packages/aws-cdk-lib/aws-servicediscovery/test/instance.test.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/instance.test.ts new file mode 100644 index 0000000000000..c9db253947495 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/instance.test.ts @@ -0,0 +1,534 @@ +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as cdk from '../../core'; +import * as servicediscovery from '../lib'; + +describe('instance', () => { + test('IpInstance for service in HTTP namespace', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = namespace.createService('MyService', { + name: 'service', + }); + + service.registerIpInstance('IpInstance', { + ipv4: '10.0.0.0', + ipv6: '0:0:0:0:0:ffff:a00:0', + port: 443, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { + InstanceAttributes: { + AWS_INSTANCE_IPV4: '10.0.0.0', + AWS_INSTANCE_IPV6: '0:0:0:0:0:ffff:a00:0', + AWS_INSTANCE_PORT: '443', + }, + ServiceId: { + 'Fn::GetAtt': [ + 'MyNamespaceMyService365E2470', + 'Id', + ], + }, + InstanceId: 'MyNamespaceMyServiceIpInstanceBACEB9D2', + }); + + + }); + + test('IpInstance for service in PublicDnsNamespace', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'public', + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, + }); + + service.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', + ipv6: '0:0:0:0:0:ffff:a00:0', + port: 443, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { + InstanceAttributes: { + AWS_INSTANCE_IPV4: '54.239.25.192', + AWS_INSTANCE_IPV6: '0:0:0:0:0:ffff:a00:0', + AWS_INSTANCE_PORT: '443', + }, + ServiceId: { + 'Fn::GetAtt': [ + 'MyNamespaceMyService365E2470', + 'Id', + ], + }, + InstanceId: 'MyNamespaceMyServiceIpInstanceBACEB9D2', + }); + + + }); + + test('IpInstance for service in PrivateDnsNamespace', () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'MyVpc'); + + const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'MyNamespace', { + name: 'public', + vpc, + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, + }); + + service.registerIpInstance('IpInstance', { + ipv4: '10.0.0.0', + ipv6: '0:0:0:0:0:ffff:a00:0', + port: 443, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { + InstanceAttributes: { + AWS_INSTANCE_IPV4: '10.0.0.0', + AWS_INSTANCE_IPV6: '0:0:0:0:0:ffff:a00:0', + AWS_INSTANCE_PORT: '443', + }, + ServiceId: { + 'Fn::GetAtt': [ + 'MyNamespaceMyService365E2470', + 'Id', + ], + }, + InstanceId: 'MyNamespaceMyServiceIpInstanceBACEB9D2', + }); + + + }); + + test('Registering IpInstance throws when omitting port for a service using SRV', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'public', + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.SRV, + }); + + // THEN + expect(() => { + service.registerIpInstance('IpInstance', { + instanceId: 'id', + }); + }).toThrow(/A `port` must be specified for a service using a `SRV` record./); + + + }); + + test('Registering IpInstance throws when omitting ipv4 and ipv6 for a service using SRV', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'dns', + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.SRV, + }); + + // THEN + expect(() => { + service.registerIpInstance('IpInstance', { + port: 3306, + }); + }).toThrow(/At least `ipv4` or `ipv6` must be specified for a service using a `SRV` record./); + + + }); + + test('Registering IpInstance throws when omitting ipv4 for a service using A records', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'dns', + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.A, + }); + + // THEN + expect(() => { + service.registerIpInstance('IpInstance', { + port: 3306, + }); + }).toThrow(/An `ipv4` must be specified for a service using a `A` record./); + + + }); + + test('Registering IpInstance throws when omitting ipv6 for a service using AAAA records', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'dns', + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.AAAA, + }); + + // THEN + expect(() => { + service.registerIpInstance('IpInstance', { + port: 3306, + }); + }).toThrow(/An `ipv6` must be specified for a service using a `AAAA` record./); + + + }); + + test('Registering IpInstance throws with wrong DNS record type', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'dns', + }); + + const service = namespace.createService('MyService', { + name: 'service', + dnsRecordType: servicediscovery.DnsRecordType.CNAME, + }); + + // THEN + expect(() => { + service.registerIpInstance('IpInstance', { + port: 3306, + }); + }).toThrow(/Service must support `A`, `AAAA` or `SRV` records to register this instance type./); + + + }); + + test('Registering AliasTargetInstance', () => { + // GIVEN + const stack = new cdk.Stack(); + + const vpc = new ec2.Vpc(stack, 'MyVPC'); + const alb = new elbv2.ApplicationLoadBalancer(stack, 'MyALB', { vpc }); + + const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'MyNamespace', { + name: 'dns', + vpc, + }); + + const service = namespace.createService('MyService', { + name: 'service', + loadBalancer: true, + }); + const customAttributes = { foo: 'bar' }; + + service.registerLoadBalancer('Loadbalancer', alb, customAttributes); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { + InstanceAttributes: { + AWS_ALIAS_DNS_NAME: { + 'Fn::GetAtt': [ + 'MyALB911A8556', + 'DNSName', + ], + }, + foo: 'bar', + }, + ServiceId: { + 'Fn::GetAtt': [ + 'MyNamespaceMyService365E2470', + 'Id', + ], + }, + InstanceId: 'MyNamespaceMyServiceLoadbalancerD1112A76', + }); + + + }); + + test('Throws when registering AliasTargetInstance with Http Namespace', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = new servicediscovery.Service(stack, 'MyService', { + namespace, + }); + + const vpc = new ec2.Vpc(stack, 'MyVPC'); + const alb = new elbv2.ApplicationLoadBalancer(stack, 'MyALB', { vpc }); + + // THEN + expect(() => { + service.registerLoadBalancer('Loadbalancer', alb); + }).toThrow(/Namespace associated with Service must be a DNS Namespace./); + + + }); + + // TODO shouldn't be allowed to do this if loadbalancer on ServiceProps is not set to true. + test('Throws when registering AliasTargetInstance with wrong Routing Policy', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = namespace.createService('MyService', { + routingPolicy: servicediscovery.RoutingPolicy.MULTIVALUE, + }); + + const vpc = new ec2.Vpc(stack, 'MyVPC'); + const alb = new elbv2.ApplicationLoadBalancer(stack, 'MyALB', { vpc }); + + // THEN + expect(() => { + service.registerLoadBalancer('Loadbalancer', alb); + }).toThrow(/Service must use `WEIGHTED` routing policy./); + + + }); + + test('Register CnameInstance', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'dns', + }); + + const service = namespace.createService('MyService', { + dnsRecordType: servicediscovery.DnsRecordType.CNAME, + }); + + service.registerCnameInstance('CnameInstance', { + instanceCname: 'foo.com', + customAttributes: { dogs: 'good' }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { + InstanceAttributes: { + AWS_INSTANCE_CNAME: 'foo.com', + dogs: 'good', + }, + ServiceId: { + 'Fn::GetAtt': [ + 'MyNamespaceMyService365E2470', + 'Id', + ], + }, + InstanceId: 'MyNamespaceMyServiceCnameInstance0EB1C98D', + }); + + + }); + + test('Throws when registering CnameInstance for an HTTP namespace', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = new servicediscovery.Service(stack, 'MyService', { + namespace, + }); + + // THEN + expect(() => { + service.registerCnameInstance('CnameInstance', { + instanceCname: 'foo.com', + }); + }).toThrow(/Namespace associated with Service must be a DNS Namespace/); + + + }); + + test('Register NonIpInstance', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = namespace.createService('MyService'); + + service.registerNonIpInstance('NonIpInstance', { + customAttributes: { dogs: 'good' }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ServiceDiscovery::Instance', { + InstanceAttributes: { + dogs: 'good', + }, + ServiceId: { + 'Fn::GetAtt': [ + 'MyNamespaceMyService365E2470', + 'Id', + ], + }, + InstanceId: 'MyNamespaceMyServiceNonIpInstance7EFD703A', + }); + + + }); + + test('Register NonIpInstance, DNS Namespace, API Only service', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace( + stack, + 'MyNamespace', + { + name: 'http', + }, + ); + + const service = namespace.createService('MyService', { discoveryType: servicediscovery.DiscoveryType.API } ); + + service.registerNonIpInstance('NonIpInstance', { + customAttributes: { dogs: 'good' }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties( + 'AWS::ServiceDiscovery::Instance', + { + InstanceAttributes: { + dogs: 'good', + }, + ServiceId: { + 'Fn::GetAtt': ['MyNamespaceMyService365E2470', 'Id'], + }, + InstanceId: 'MyNamespaceMyServiceNonIpInstance7EFD703A', + }, + ); + }); + + test('Throws when registering NonIpInstance for an DNS discoverable service', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = namespace.createService('MyService'); + + // THEN + expect(() => { + service.registerNonIpInstance('NonIpInstance', { + instanceId: 'nonIp', + }); + }).toThrow(/This type of instance can only be registered for HTTP namespaces./); + + + }); + + test('Throws when no custom attribues specified for NonIpInstance', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = namespace.createService('MyService'); + + // THEN + expect(() => { + service.registerNonIpInstance('NonIpInstance', { + instanceId: 'nonIp', + }); + }).toThrow(/You must specify at least one custom attribute for this instance type./); + + + }); + + test('Throws when custom attribues are emptyfor NonIpInstance', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'http', + }); + + const service = namespace.createService('MyService'); + + // THEN + expect(() => { + service.registerNonIpInstance('NonIpInstance', { + instanceId: 'nonIp', + customAttributes: {}, + }); + }).toThrow(/You must specify at least one custom attribute for this instance type./); + + + }); + + test('Register multiple instances on the same service', () => { + // GIVEN + const stack = new cdk.Stack(); + + const namespace = new servicediscovery.PublicDnsNamespace(stack, 'MyNamespace', { + name: 'public', + }); + + const service = namespace.createService('MyService'); + + // WHEN + service.registerIpInstance('First', { + ipv4: '10.0.0.0', + }); + + service.registerIpInstance('Second', { + ipv4: '10.0.0.1', + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::ServiceDiscovery::Instance', 2); + + + }); +}); diff --git a/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts new file mode 100644 index 0000000000000..d5ab283e25cf0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-cname-record.lit.ts @@ -0,0 +1,21 @@ +import * as cdk from '../../core'; +import * as servicediscovery from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { + name: 'foobar.com', +}); + +const service = namespace.createService('Service', { + name: 'foo', + dnsRecordType: servicediscovery.DnsRecordType.CNAME, + dnsTtl: cdk.Duration.seconds(30), +}); + +service.registerCnameInstance('CnameInstance', { + instanceCname: 'service.pizza', +}); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts new file mode 100644 index 0000000000000..640684516f8c4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-http-namespace.lit.ts @@ -0,0 +1,31 @@ +import * as cdk from '../../core'; +import * as servicediscovery from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const namespace = new servicediscovery.HttpNamespace(stack, 'MyNamespace', { + name: 'MyHTTPNamespace', +}); + +const service1 = namespace.createService('NonIpService', { + description: 'service registering non-ip instances', +}); + +service1.registerNonIpInstance('NonIpInstance', { + customAttributes: { arn: 'arn:aws:s3:::mybucket' }, +}); + +const service2 = namespace.createService('IpService', { + description: 'service registering ip instances', + healthCheck: { + type: servicediscovery.HealthCheckType.HTTP, + resourcePath: '/check', + }, +}); + +service2.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', +}); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts new file mode 100644 index 0000000000000..68e0957200d83 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-private-dns-namespace.lit.ts @@ -0,0 +1,34 @@ +import * as ec2 from '../../aws-ec2'; +import * as elbv2 from '../../aws-elasticloadbalancingv2'; +import * as cdk from '../../core'; +import * as servicediscovery from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2 }); + +const namespace = new servicediscovery.PrivateDnsNamespace(stack, 'Namespace', { + name: 'boobar.com', + vpc, +}); + +const service = namespace.createService('Service', { + dnsRecordType: servicediscovery.DnsRecordType.A_AAAA, + dnsTtl: cdk.Duration.seconds(30), + loadBalancer: true, +}); + +const loadbalancer = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc, internetFacing: true }); + +service.registerLoadBalancer('Loadbalancer', loadbalancer); + +const arnService = namespace.createService('ArnService', { + discoveryType: servicediscovery.DiscoveryType.API, +}); + +arnService.registerNonIpInstance('NonIpInstance', { + customAttributes: { arn: 'arn://' }, +}); + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts new file mode 100644 index 0000000000000..facc65b3339a1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/integ.service-with-public-dns-namespace.lit.ts @@ -0,0 +1,27 @@ +import * as cdk from '../../core'; +import * as servicediscovery from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-servicediscovery-integ'); + +const namespace = new servicediscovery.PublicDnsNamespace(stack, 'Namespace', { + name: 'foobar.com', +}); + +const service = namespace.createService('Service', { + name: 'foo', + dnsRecordType: servicediscovery.DnsRecordType.A, + dnsTtl: cdk.Duration.seconds(30), + healthCheck: { + type: servicediscovery.HealthCheckType.HTTPS, + resourcePath: '/healthcheck', + failureThreshold: 2, + }, +}); + +service.registerIpInstance('IpInstance', { + ipv4: '54.239.25.192', + port: 443, +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-servicediscovery/test/namespace.test.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/namespace.test.ts similarity index 95% rename from packages/@aws-cdk/aws-servicediscovery/test/namespace.test.ts rename to packages/aws-cdk-lib/aws-servicediscovery/test/namespace.test.ts index eb5d9f920acef..af5fef6827318 100644 --- a/packages/@aws-cdk/aws-servicediscovery/test/namespace.test.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/namespace.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; -import { CfnOutput } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; +import { CfnOutput } from '../../core'; import * as servicediscovery from '../lib'; describe('namespace', () => { diff --git a/packages/@aws-cdk/aws-servicediscovery/test/service.test.ts b/packages/aws-cdk-lib/aws-servicediscovery/test/service.test.ts similarity index 98% rename from packages/@aws-cdk/aws-servicediscovery/test/service.test.ts rename to packages/aws-cdk-lib/aws-servicediscovery/test/service.test.ts index 989b20b44a418..7e41f99d86f39 100644 --- a/packages/@aws-cdk/aws-servicediscovery/test/service.test.ts +++ b/packages/aws-cdk-lib/aws-servicediscovery/test/service.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as cdk from '../../core'; import * as servicediscovery from '../lib'; import { DiscoveryType } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-ses-actions/.jsiirc.json b/packages/aws-cdk-lib/aws-ses-actions/.jsiirc.json new file mode 100644 index 0000000000000..4c95e654a225d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ses.actions" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SES.Actions" + }, + "python": { + "module": "aws_cdk.aws_ses_actions" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ses-actions/README.md b/packages/aws-cdk-lib/aws-ses-actions/README.md new file mode 100644 index 0000000000000..8c83782f58db5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/README.md @@ -0,0 +1,16 @@ +# Amazon Simple Email Service Actions Library + + +This module contains integration classes to add action to SES email receiving rules. +Instances of these classes should be passed to the `rule.addAction()` method. + +Currently supported are: + +* [Add header](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-add-header.html) +* [Bounce](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-bounce.html) +* [Lambda](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda.html) +* [S3](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-s3.html) +* [SNS](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-sns.html) +* [Stop](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-stop.html) + +See the README of `@aws-cdk/aws-ses` for more information. diff --git a/packages/aws-cdk-lib/aws-ses-actions/index.ts b/packages/aws-cdk-lib/aws-ses-actions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ses-actions/lib/add-header.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/add-header.ts similarity index 97% rename from packages/@aws-cdk/aws-ses-actions/lib/add-header.ts rename to packages/aws-cdk-lib/aws-ses-actions/lib/add-header.ts index 543a60c15e698..4c9a667f55dd3 100644 --- a/packages/@aws-cdk/aws-ses-actions/lib/add-header.ts +++ b/packages/aws-cdk-lib/aws-ses-actions/lib/add-header.ts @@ -1,4 +1,4 @@ -import * as ses from '@aws-cdk/aws-ses'; +import * as ses from '../../aws-ses'; /** * Construction properties for a add header action. diff --git a/packages/@aws-cdk/aws-ses-actions/lib/bounce.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/bounce.ts similarity index 96% rename from packages/@aws-cdk/aws-ses-actions/lib/bounce.ts rename to packages/aws-cdk-lib/aws-ses-actions/lib/bounce.ts index a1a385651614a..57000916f4e70 100644 --- a/packages/@aws-cdk/aws-ses-actions/lib/bounce.ts +++ b/packages/aws-cdk-lib/aws-ses-actions/lib/bounce.ts @@ -1,5 +1,5 @@ -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; +import * as ses from '../../aws-ses'; +import * as sns from '../../aws-sns'; /** * Construction properties for a BounceTemplate. diff --git a/packages/@aws-cdk/aws-ses-actions/lib/index.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ses-actions/lib/index.ts rename to packages/aws-cdk-lib/aws-ses-actions/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-ses-actions/lib/lambda.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/lambda.ts new file mode 100644 index 0000000000000..6917184924a74 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/lib/lambda.ts @@ -0,0 +1,85 @@ +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as ses from '../../aws-ses'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; + +/** + * The type of invocation to use for a Lambda Action. + */ +export enum LambdaInvocationType { + /** + * The function will be invoked asynchronously. + */ + EVENT = 'Event', + + /** + * The function will be invoked sychronously. Use RequestResponse only when + * you want to make a mail flow decision, such as whether to stop the receipt + * rule or the receipt rule set. + */ + REQUEST_RESPONSE = 'RequestResponse', +} + +/** + * Construction properties for a Lambda action. + */ +export interface LambdaProps { + /** + * The Lambda function to invoke. + */ + readonly function: lambda.IFunction + + /** + * The invocation type of the Lambda function. + * + * @default Event + */ + readonly invocationType?: LambdaInvocationType; + + /** + * The SNS topic to notify when the Lambda action is taken. + * + * @default no notification + */ + readonly topic?: sns.ITopic; +} + +/** + * Calls an AWS Lambda function, and optionally, publishes a notification to + * Amazon SNS. + */ +export class Lambda implements ses.IReceiptRuleAction { + constructor(private readonly props: LambdaProps) { + } + + public bind(rule: ses.IReceiptRule): ses.ReceiptRuleActionConfig { + // Allow SES to invoke Lambda function + // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-lambda + const permissionId = 'AllowSes'; + if (!this.props.function.permissionsNode.tryFindChild(permissionId)) { + this.props.function.addPermission(permissionId, { + action: 'lambda:InvokeFunction', + principal: new iam.ServicePrincipal('ses.amazonaws.com'), + sourceAccount: cdk.Aws.ACCOUNT_ID, + }); + } + + // Ensure permission is deployed before rule + const permission = this.props.function.permissionsNode.tryFindChild(permissionId) as lambda.CfnPermission; + if (permission) { // The Lambda could be imported + rule.node.addDependency(permission); + } else { + // eslint-disable-next-line max-len + cdk.Annotations.of(rule).addWarning('This rule is using a Lambda action with an imported function. Ensure permission is given to SES to invoke that function.'); + } + + return { + lambdaAction: { + functionArn: this.props.function.functionArn, + invocationType: this.props.invocationType, + topicArn: this.props.topic?.topicArn, + }, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-ses-actions/lib/s3.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/s3.ts new file mode 100644 index 0000000000000..4505090c30826 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/lib/s3.ts @@ -0,0 +1,101 @@ +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as s3 from '../../aws-s3'; +import * as ses from '../../aws-ses'; +import * as sns from '../../aws-sns'; +import * as cdk from '../../core'; + +/** + * Construction properties for a S3 action. + */ +export interface S3Props { + /** + * The S3 bucket that incoming email will be saved to. + */ + readonly bucket: s3.IBucket; + + /** + * The master key that SES should use to encrypt your emails before saving + * them to the S3 bucket. + * + * @default no encryption + */ + readonly kmsKey?: kms.IKey; + + /** + * The key prefix of the S3 bucket. + * + * @default no prefix + */ + readonly objectKeyPrefix?: string; + + /** + * The SNS topic to notify when the S3 action is taken. + * + * @default no notification + */ + readonly topic?: sns.ITopic; +} + +/** + * Saves the received message to an Amazon S3 bucket and, optionally, publishes + * a notification to Amazon SNS. + */ +export class S3 implements ses.IReceiptRuleAction { + constructor(private readonly props: S3Props) { + } + + public bind(rule: ses.IReceiptRule): ses.ReceiptRuleActionConfig { + // Allow SES to write to S3 bucket + // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-s3 + const keyPattern = this.props.objectKeyPrefix || ''; + const s3Statement = new iam.PolicyStatement({ + actions: ['s3:PutObject'], + principals: [new iam.ServicePrincipal('ses.amazonaws.com')], + resources: [this.props.bucket.arnForObjects(`${keyPattern}*`)], + conditions: { + StringEquals: { + 'aws:Referer': cdk.Aws.ACCOUNT_ID, + }, + }, + }); + this.props.bucket.addToResourcePolicy(s3Statement); + + const policy = this.props.bucket.node.tryFindChild('Policy') as s3.BucketPolicy; + if (policy) { // The bucket could be imported + rule.node.addDependency(policy); + } else { + cdk.Annotations.of(rule).addWarning('This rule is using a S3 action with an imported bucket. Ensure permission is given to SES to write to that bucket.'); + } + + // Allow SES to use KMS master key + // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-permissions.html#receiving-email-permissions-kms + if (this.props.kmsKey && !/alias\/aws\/ses$/.test(this.props.kmsKey.keyArn)) { + const kmsStatement = new iam.PolicyStatement({ + actions: ['kms:Encrypt', 'kms:GenerateDataKey'], + principals: [new iam.ServicePrincipal('ses.amazonaws.com')], + resources: ['*'], + conditions: { + Null: { + 'kms:EncryptionContext:aws:ses:rule-name': 'false', + 'kms:EncryptionContext:aws:ses:message-id': 'false', + }, + StringEquals: { + 'kms:EncryptionContext:aws:ses:source-account': cdk.Aws.ACCOUNT_ID, + }, + }, + }); + + this.props.kmsKey.addToResourcePolicy(kmsStatement); + } + + return { + s3Action: { + bucketName: this.props.bucket.bucketName, + kmsKeyArn: this.props.kmsKey?.keyArn, + objectKeyPrefix: this.props.objectKeyPrefix, + topicArn: this.props.topic?.topicArn, + }, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-ses-actions/lib/sns.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/sns.ts new file mode 100644 index 0000000000000..6f57588ed68dc --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/lib/sns.ts @@ -0,0 +1,51 @@ +import * as ses from '../../aws-ses'; +import * as sns from '../../aws-sns'; + +/** + * The type of email encoding to use for a SNS action. + */ +export enum EmailEncoding { + /** + * Base 64 + */ + BASE64 = 'Base64', + + /** + * UTF-8 + */ + UTF8 = 'UTF-8', +} + +/** + * Construction properties for a SNS action. + */ +export interface SnsProps { + /** + * The encoding to use for the email within the Amazon SNS notification. + * + * @default UTF-8 + */ + readonly encoding?: EmailEncoding; + + /** + * The SNS topic to notify. + */ + readonly topic: sns.ITopic; +} + +/** + * Publishes the email content within a notification to Amazon SNS. + */ +export class Sns implements ses.IReceiptRuleAction { + constructor(private readonly props: SnsProps) { + } + + public bind(_rule: ses.IReceiptRule): ses.ReceiptRuleActionConfig { + return { + snsAction: { + encoding: this.props.encoding, + topicArn: this.props.topic.topicArn, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-ses-actions/lib/stop.ts b/packages/aws-cdk-lib/aws-ses-actions/lib/stop.ts similarity index 88% rename from packages/@aws-cdk/aws-ses-actions/lib/stop.ts rename to packages/aws-cdk-lib/aws-ses-actions/lib/stop.ts index f42d206d3d350..bb764fd759400 100644 --- a/packages/@aws-cdk/aws-ses-actions/lib/stop.ts +++ b/packages/aws-cdk-lib/aws-ses-actions/lib/stop.ts @@ -1,5 +1,5 @@ -import * as ses from '@aws-cdk/aws-ses'; -import * as sns from '@aws-cdk/aws-sns'; +import * as ses from '../../aws-ses'; +import * as sns from '../../aws-sns'; /** * Construction properties for a stop action. diff --git a/packages/aws-cdk-lib/aws-ses-actions/test/actions.test.ts b/packages/aws-cdk-lib/aws-ses-actions/test/actions.test.ts new file mode 100644 index 0000000000000..696dece51137d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses-actions/test/actions.test.ts @@ -0,0 +1,296 @@ +import { Match, Template } from '../../assertions'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as s3 from '../../aws-s3'; +import * as ses from '../../aws-ses'; +import * as sns from '../../aws-sns'; +import { Stack } from '../../core'; +import * as actions from '../lib'; + +let stack: Stack; +let rule: ses.ReceiptRule; +let topic: sns.Topic; + +beforeEach(() => { + stack = new Stack(); + const ruleSet = new ses.ReceiptRuleSet(stack, 'RuleSet'); + rule = ruleSet.addRule('Rule'); + topic = new sns.Topic(stack, 'Topic'); +}); + +test('add header action', () => { + rule.addAction(new actions.AddHeader({ + name: 'X-My-Header', + value: 'value', + })); + + Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { + Rule: { + Actions: [ + { + AddHeaderAction: { + HeaderName: 'X-My-Header', + HeaderValue: 'value', + }, + }, + ], + Enabled: true, + }, + }); +}); + +test('add header action with invalid header name', () => { + expect(() => rule.addAction(new actions.AddHeader({ + name: 'He@der', + value: 'value', + }))).toThrow(/`name`/); +}); + +test('add header action with invalid header value', () => { + expect(() => rule.addAction(new actions.AddHeader({ + name: 'Header', + value: `va + lu`, + }))).toThrow(/`value`/); +}); + +test('add bounce action', () => { + rule.addAction(new actions.Bounce({ + sender: 'noreply@aws.com', + template: actions.BounceTemplate.MESSAGE_CONTENT_REJECTED, + topic, + })); + + Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { + Rule: { + Actions: [ + { + BounceAction: { + Message: 'Message content rejected', + Sender: 'noreply@aws.com', + SmtpReplyCode: '500', + TopicArn: { + Ref: 'TopicBFC7AF6E', + }, + StatusCode: '5.6.1', + }, + }, + ], + Enabled: true, + }, + }); +}); + +test('add lambda action', () => { + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.fromInline('boom'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + rule.addAction(new actions.Lambda({ + function: fn, + invocationType: actions.LambdaInvocationType.REQUEST_RESPONSE, + topic, + })); + + Template.fromStack(stack).hasResource('AWS::SES::ReceiptRule', { + Properties: { + Rule: { + Actions: [ + { + LambdaAction: { + FunctionArn: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + InvocationType: 'RequestResponse', + TopicArn: { + Ref: 'TopicBFC7AF6E', + }, + }, + }, + ], + Enabled: true, + }, + RuleSetName: { + Ref: 'RuleSetE30C6C48', + }, + }, + DependsOn: [ + 'FunctionAllowSes1829904A', + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'ses.amazonaws.com', + SourceAccount: { + Ref: 'AWS::AccountId', + }, + }); +}); + +test('add s3 action', () => { + const bucket = new s3.Bucket(stack, 'Bucket'); + const kmsKey = new kms.Key(stack, 'Key'); + + rule.addAction(new actions.S3({ + bucket, + kmsKey, + objectKeyPrefix: 'emails/', + topic, + })); + + Template.fromStack(stack).hasResource('AWS::SES::ReceiptRule', { + Properties: { + Rule: { + Actions: [ + { + S3Action: { + BucketName: { + Ref: 'Bucket83908E77', + }, + KmsKeyArn: { + 'Fn::GetAtt': [ + 'Key961B73FD', + 'Arn', + ], + }, + ObjectKeyPrefix: 'emails/', + TopicArn: { + Ref: 'TopicBFC7AF6E', + }, + }, + }, + ], + Enabled: true, + }, + RuleSetName: { + Ref: 'RuleSetE30C6C48', + }, + }, + DependsOn: [ + 'BucketPolicyE9A3008A', + ], + }); + + Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', { + Bucket: { + Ref: 'Bucket83908E77', + }, + PolicyDocument: { + Statement: [ + { + Action: 's3:PutObject', + Condition: { + StringEquals: { + 'aws:Referer': { + Ref: 'AWS::AccountId', + }, + }, + }, + Effect: 'Allow', + Principal: { + Service: 'ses.amazonaws.com', + }, + Resource: { + 'Fn::Join': [ + '', + [ + { + 'Fn::GetAtt': [ + 'Bucket83908E77', + 'Arn', + ], + }, + '/emails/*', + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', { + KeyPolicy: { + Statement: Match.arrayWith([{ + Action: [ + 'kms:Encrypt', + 'kms:GenerateDataKey', + ], + Condition: { + Null: { + 'kms:EncryptionContext:aws:ses:rule-name': 'false', + 'kms:EncryptionContext:aws:ses:message-id': 'false', + }, + StringEquals: { + 'kms:EncryptionContext:aws:ses:source-account': { + Ref: 'AWS::AccountId', + }, + }, + }, + Effect: 'Allow', + Principal: { + Service: 'ses.amazonaws.com', + }, + Resource: '*', + }]), + }, + }); +}); + +test('add sns action', () => { + rule.addAction(new actions.Sns({ + encoding: actions.EmailEncoding.BASE64, + topic, + })); + + Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { + Rule: { + Actions: [ + { + SNSAction: { + Encoding: 'Base64', + TopicArn: { + Ref: 'TopicBFC7AF6E', + }, + }, + }, + ], + Enabled: true, + }, + }); +}); + +test('add stop action', () => { + rule.addAction(new actions.Stop({ + topic, + })); + + Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', { + Rule: { + Actions: [ + { + StopAction: { + Scope: 'RuleSet', + TopicArn: { + Ref: 'TopicBFC7AF6E', + }, + }, + }, + ], + Enabled: true, + }, + }); +}); diff --git a/packages/aws-cdk-lib/aws-ses/.jsiirc.json b/packages/aws-cdk-lib/aws-ses/.jsiirc.json new file mode 100644 index 0000000000000..6d98d502a28b4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ses" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SES" + }, + "python": { + "module": "aws_cdk.aws_ses" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ses/README.md b/packages/aws-cdk-lib/aws-ses/README.md new file mode 100644 index 0000000000000..5367f2e2cc600 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses/README.md @@ -0,0 +1,208 @@ +# Amazon Simple Email Service Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Email receiving + +Create a receipt rule set with rules and actions (actions can be found in the +`@aws-cdk/aws-ses-actions` package): + +```ts +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as actions from 'aws-cdk-lib/aws-ses-actions'; + +const bucket = new s3.Bucket(this, 'Bucket'); +const topic = new sns.Topic(this, 'Topic'); + +new ses.ReceiptRuleSet(this, 'RuleSet', { + rules: [ + { + recipients: ['hello@aws.com'], + actions: [ + new actions.AddHeader({ + name: 'X-Special-Header', + value: 'aws', + }), + new actions.S3({ + bucket, + objectKeyPrefix: 'emails/', + topic, + }), + ], + }, + { + recipients: ['aws.com'], + actions: [ + new actions.Sns({ + topic, + }), + ], + }, + ], +}); +``` + +Alternatively, rules can be added to a rule set: + +```ts +const ruleSet = new ses.ReceiptRuleSet(this, 'RuleSet'); + +const awsRule = ruleSet.addRule('Aws', { + recipients: ['aws.com'], +}); +``` + +And actions to rules: + +```ts +import * as actions from 'aws-cdk-lib/aws-ses-actions'; + +declare const awsRule: ses.ReceiptRule; +declare const topic: sns.Topic; +awsRule.addAction(new actions.Sns({ + topic, +})); +``` + +When using `addRule`, the new rule is added after the last added rule unless `after` is specified. + +### Drop spams + +A rule to drop spam can be added by setting `dropSpam` to `true`: + +```ts +new ses.ReceiptRuleSet(this, 'RuleSet', { + dropSpam: true, +}); +``` + +This will add a rule at the top of the rule set with a Lambda action that stops processing messages that have at least one spam indicator. See [Lambda Function Examples](https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-lambda-example-functions.html). + + +### Receipt filter + +Create a receipt filter: + +```ts +new ses.ReceiptFilter(this, 'Filter', { + ip: '1.2.3.4/16', // Will be blocked +}); +``` + +An allow list filter is also available: + +```ts +new ses.AllowListReceiptFilter(this, 'AllowList', { + ips: [ + '10.0.0.0/16', + '1.2.3.4/16', + ], +}); +``` + +This will first create a block all filter and then create allow filters for the listed ip addresses. + +## Email sending + +### Dedicated IP pools + +When you create a new Amazon SES account, your emails are sent from IP addresses that are shared with other +Amazon SES users. For [an additional monthly charge](https://aws.amazon.com/ses/pricing/), you can lease +dedicated IP addresses that are reserved for your exclusive use. + +Use the `DedicatedIpPool` construct to create a pool of dedicated IP addresses: + +```ts +new ses.DedicatedIpPool(this, 'Pool'); +``` + +The pool can then be used in a configuration set. + +### Configuration sets + +Configuration sets are groups of rules that you can apply to your verified identities. A verified identity is +a domain, subdomain, or email address you use to send email through Amazon SES. When you apply a configuration +set to an email, all of the rules in that configuration set are applied to the email. + +Use the `ConfigurationSet` construct to create a configuration set: + +```ts +declare const myPool: ses.IDedicatedIpPool; + +new ses.ConfigurationSet(this, 'ConfigurationSet', { + customTrackingRedirectDomain: 'track.cdk.dev', + suppressionReasons: ses.SuppressionReasons.COMPLAINTS_ONLY, + tlsPolicy: ses.ConfigurationSetTlsPolicy.REQUIRE, + dedicatedIpPool: myPool, +}); +``` + +### Email identity + +In Amazon SES, a verified identity is a domain or email address that you use to send or receive email. Before you +can send an email using Amazon SES, you must create and verify each identity that you're going to use as a `From`, +`Source`, `Sender`, or `Return-Path` address. Verifying an identity with Amazon SES confirms that you own it and +helps prevent unauthorized use. + +To verify an identity for a hosted zone, you create an `EmailIdentity`: + +```ts +declare const myHostedZone: route53.IPublicHostedZone; + +const identity = new ses.EmailIdentity(stack, 'Identity', { + identity: ses.Identity.publicHostedZone(myHostedZone), + mailFromDomain: 'mail.cdk.dev', +}); +``` + +By default, [Easy DKIM](https://docs.aws.amazon.com/ses/latest/dg/send-email-authentication-dkim-easy.html) with +a 2048-bit DKIM key is used. + +You can instead configure DKIM authentication by using your own public-private key pair. This process is known +as [Bring Your Own DKIM (BYODKIM)](https://docs.aws.amazon.com/ses/latest/dg/send-email-authentication-dkim-bring-your-own.html): + +```ts +declare const myHostedZone: route53.IPublicHostedZone; + +new ses.EmailIdentity(stack, 'Identity', { + identity: ses.Identity.publicHostedZone(myHostedZone), + dkimIdentity: DkimIdentity.byoDkim({ + privateKey: SecretValue.secretsManager('dkim-private-key'), + publicKey: '...base64-encoded-public-key...', + selector: 'selector', + }), +}); +``` + +When using `publicHostedZone()` for the identity, all necessary Amazon Route 53 records are created automatically: + +* CNAME records for Easy DKIM +* TXT record for BYOD DKIM +* MX and TXT records for the custom MAIL FROM + +When working with `domain()`, records must be created manually: + +```ts +const identity = new ses.EmailIdentity(stack, 'Identity', { + identity: ses.Identity.domain('cdk.dev'), +}); + +for (const record of identity.dkimRecords) { + // create CNAME records using `record.name` and `record.value` +} +``` + +### Virtual Deliverability Manager (VDM) + +Virtual Deliverability Manager is an Amazon SES feature that helps you enhance email deliverability, +like increasing inbox deliverability and email conversions, by providing insights into your sending +and delivery data, and giving advice on how to fix the issues that are negatively affecting your +delivery success rate and reputation. + +Use the `VdmAttributes` construct to configure the Virtual Deliverability Manager for your account: + +```ts +// Enables engagement tracking and optimized shared delivery by default +new ses.VdmAttributes(this, 'Vdm'); +``` diff --git a/packages/aws-cdk-lib/aws-ses/index.ts b/packages/aws-cdk-lib/aws-ses/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ses/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ses/lib/configuration-set.ts b/packages/aws-cdk-lib/aws-ses/lib/configuration-set.ts similarity index 98% rename from packages/@aws-cdk/aws-ses/lib/configuration-set.ts rename to packages/aws-cdk-lib/aws-ses/lib/configuration-set.ts index 6e801a7f4f3f9..3a031e8058a01 100644 --- a/packages/@aws-cdk/aws-ses/lib/configuration-set.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/configuration-set.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { IDedicatedIpPool } from './dedicated-ip-pool'; import { undefinedIfNoKeys } from './private/utils'; diff --git a/packages/@aws-cdk/aws-ses/lib/dedicated-ip-pool.ts b/packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts similarity index 96% rename from packages/@aws-cdk/aws-ses/lib/dedicated-ip-pool.ts rename to packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts index f650c45465376..4a7feae90fab3 100644 --- a/packages/@aws-cdk/aws-ses/lib/dedicated-ip-pool.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/dedicated-ip-pool.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnDedicatedIpPool } from './ses.generated'; diff --git a/packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts b/packages/aws-cdk-lib/aws-ses/lib/drop-spam-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ses/test/integ.receipt.js.snapshot/asset.96d0b6be9a64ae309bf89a86f5515453f0fa1d07b4f6b37198051cc98e251f34/index.ts rename to packages/aws-cdk-lib/aws-ses/lib/drop-spam-handler/index.ts diff --git a/packages/@aws-cdk/aws-ses/lib/email-identity.ts b/packages/aws-cdk-lib/aws-ses/lib/email-identity.ts similarity index 98% rename from packages/@aws-cdk/aws-ses/lib/email-identity.ts rename to packages/aws-cdk-lib/aws-ses/lib/email-identity.ts index fec5c2bcba0bd..1a8e0ae582fed 100644 --- a/packages/@aws-cdk/aws-ses/lib/email-identity.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/email-identity.ts @@ -1,6 +1,6 @@ -import * as route53 from '@aws-cdk/aws-route53'; -import { IPublicHostedZone } from '@aws-cdk/aws-route53'; -import { IResource, Lazy, Resource, SecretValue, Stack } from '@aws-cdk/core'; +import * as route53 from '../../aws-route53'; +import { IPublicHostedZone } from '../../aws-route53'; +import { IResource, Lazy, Resource, SecretValue, Stack } from '../../core'; import { Construct } from 'constructs'; import { IConfigurationSet } from './configuration-set'; import { undefinedIfNoKeys } from './private/utils'; diff --git a/packages/@aws-cdk/aws-ses/lib/index.ts b/packages/aws-cdk-lib/aws-ses/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ses/lib/index.ts rename to packages/aws-cdk-lib/aws-ses/lib/index.ts diff --git a/packages/@aws-cdk/aws-ses/lib/private/utils.ts b/packages/aws-cdk-lib/aws-ses/lib/private/utils.ts similarity index 100% rename from packages/@aws-cdk/aws-ses/lib/private/utils.ts rename to packages/aws-cdk-lib/aws-ses/lib/private/utils.ts diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-filter.ts b/packages/aws-cdk-lib/aws-ses/lib/receipt-filter.ts similarity index 98% rename from packages/@aws-cdk/aws-ses/lib/receipt-filter.ts rename to packages/aws-cdk-lib/aws-ses/lib/receipt-filter.ts index 9c7de1ee3b807..b369998febda7 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-filter.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/receipt-filter.ts @@ -1,4 +1,4 @@ -import { Resource } from '@aws-cdk/core'; +import { Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnReceiptFilter } from './ses.generated'; diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule-action.ts b/packages/aws-cdk-lib/aws-ses/lib/receipt-rule-action.ts similarity index 100% rename from packages/@aws-cdk/aws-ses/lib/receipt-rule-action.ts rename to packages/aws-cdk-lib/aws-ses/lib/receipt-rule-action.ts diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts b/packages/aws-cdk-lib/aws-ses/lib/receipt-rule-set.ts similarity index 98% rename from packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts rename to packages/aws-cdk-lib/aws-ses/lib/receipt-rule-set.ts index d8590216f2460..a100f6278dd17 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-rule-set.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/receipt-rule-set.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { DropSpamReceiptRule, ReceiptRule, ReceiptRuleOptions } from './receipt-rule'; import { CfnReceiptRuleSet } from './ses.generated'; diff --git a/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts b/packages/aws-cdk-lib/aws-ses/lib/receipt-rule.ts similarity index 97% rename from packages/@aws-cdk/aws-ses/lib/receipt-rule.ts rename to packages/aws-cdk-lib/aws-ses/lib/receipt-rule.ts index cc8d3be77e758..aefcf7ed159dc 100644 --- a/packages/@aws-cdk/aws-ses/lib/receipt-rule.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/receipt-rule.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Aws, IResource, Lazy, Resource } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import { Aws, IResource, Lazy, Resource } from '../../core'; import { Construct } from 'constructs'; import { IReceiptRuleAction } from './receipt-rule-action'; import { IReceiptRuleSet } from './receipt-rule-set'; diff --git a/packages/@aws-cdk/aws-ses/lib/vdm-attributes.ts b/packages/aws-cdk-lib/aws-ses/lib/vdm-attributes.ts similarity index 97% rename from packages/@aws-cdk/aws-ses/lib/vdm-attributes.ts rename to packages/aws-cdk-lib/aws-ses/lib/vdm-attributes.ts index 481d0bb5763f0..7da38136f2d27 100644 --- a/packages/@aws-cdk/aws-ses/lib/vdm-attributes.ts +++ b/packages/aws-cdk-lib/aws-ses/lib/vdm-attributes.ts @@ -1,4 +1,4 @@ -import { IResource, Resource } from '@aws-cdk/core'; +import { IResource, Resource } from '../../core'; import { Construct } from 'constructs'; import { CfnVdmAttributes } from './ses.generated'; diff --git a/packages/@aws-cdk/aws-ses/test/configuration-set.test.ts b/packages/aws-cdk-lib/aws-ses/test/configuration-set.test.ts similarity index 92% rename from packages/@aws-cdk/aws-ses/test/configuration-set.test.ts rename to packages/aws-cdk-lib/aws-ses/test/configuration-set.test.ts index 9a9fb8ebb0dc9..49f77e5c3034b 100644 --- a/packages/@aws-cdk/aws-ses/test/configuration-set.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/configuration-set.test.ts @@ -1,5 +1,5 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import { Stack } from '../../core'; import { ConfigurationSet, ConfigurationSetTlsPolicy, DedicatedIpPool, SuppressionReasons } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-ses/test/dedicated-ip-pool.test.ts b/packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts similarity index 77% rename from packages/@aws-cdk/aws-ses/test/dedicated-ip-pool.test.ts rename to packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts index c635da3790319..ad5ef2d2e9d5b 100644 --- a/packages/@aws-cdk/aws-ses/test/dedicated-ip-pool.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/dedicated-ip-pool.test.ts @@ -1,5 +1,5 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../assertions'; +import { Stack } from '../../core'; import { DedicatedIpPool } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-ses/test/email-identity.test.ts b/packages/aws-cdk-lib/aws-ses/test/email-identity.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ses/test/email-identity.test.ts rename to packages/aws-cdk-lib/aws-ses/test/email-identity.test.ts index 9b8ac5ced9a5a..adf121a4586b5 100644 --- a/packages/@aws-cdk/aws-ses/test/email-identity.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/email-identity.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as route53 from '@aws-cdk/aws-route53'; -import { SecretValue, Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as route53 from '../../aws-route53'; +import { SecretValue, Stack } from '../../core'; import { ConfigurationSet, DkimIdentity, EmailIdentity, Identity, MailFromBehaviorOnMxFailure } from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-ses/test/receipt-filter.test.ts b/packages/aws-cdk-lib/aws-ses/test/receipt-filter.test.ts similarity index 95% rename from packages/@aws-cdk/aws-ses/test/receipt-filter.test.ts rename to packages/aws-cdk-lib/aws-ses/test/receipt-filter.test.ts index 74e6dc8742340..0d5a7492306fa 100644 --- a/packages/@aws-cdk/aws-ses/test/receipt-filter.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/receipt-filter.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { AllowListReceiptFilter, ReceiptFilter, ReceiptFilterPolicy } from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-ses/test/receipt-rule-set.test.ts b/packages/aws-cdk-lib/aws-ses/test/receipt-rule-set.test.ts similarity index 96% rename from packages/@aws-cdk/aws-ses/test/receipt-rule-set.test.ts rename to packages/aws-cdk-lib/aws-ses/test/receipt-rule-set.test.ts index 0386b71f39425..5a580020ec25d 100644 --- a/packages/@aws-cdk/aws-ses/test/receipt-rule-set.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/receipt-rule-set.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { ReceiptRuleSet } from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-ses/test/receipt-rule.test.ts b/packages/aws-cdk-lib/aws-ses/test/receipt-rule.test.ts similarity index 97% rename from packages/@aws-cdk/aws-ses/test/receipt-rule.test.ts rename to packages/aws-cdk-lib/aws-ses/test/receipt-rule.test.ts index d8a3805cee858..c2135efb07270 100644 --- a/packages/@aws-cdk/aws-ses/test/receipt-rule.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/receipt-rule.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { ReceiptRule, ReceiptRuleSet, TlsPolicy } from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/aws-ses/test/vdm-attributes.test.ts b/packages/aws-cdk-lib/aws-ses/test/vdm-attributes.test.ts similarity index 83% rename from packages/@aws-cdk/aws-ses/test/vdm-attributes.test.ts rename to packages/aws-cdk-lib/aws-ses/test/vdm-attributes.test.ts index 34045edaf7f14..ad68f4b9ddeb5 100644 --- a/packages/@aws-cdk/aws-ses/test/vdm-attributes.test.ts +++ b/packages/aws-cdk-lib/aws-ses/test/vdm-attributes.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { VdmAttributes } from '../lib'; let stack: Stack; diff --git a/packages/aws-cdk-lib/aws-signer/.jsiirc.json b/packages/aws-cdk-lib/aws-signer/.jsiirc.json new file mode 100644 index 0000000000000..9f809ffdc7bc7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-signer/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Signer" + }, + "java": { + "package": "software.amazon.awscdk.services.signer" + }, + "python": { + "module": "aws_cdk.aws_signer" + } + } +} diff --git a/packages/aws-cdk-lib/aws-signer/README.md b/packages/aws-cdk-lib/aws-signer/README.md new file mode 100644 index 0000000000000..99ed66cc2bbb8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-signer/README.md @@ -0,0 +1,41 @@ +# AWS::Signer Construct Library + + +AWS Signer is a fully managed code-signing service to ensure the trust and integrity of your code. Organizations validate code against +a digital signature to confirm that the code is unaltered and from a trusted publisher. For more information, see [What Is AWS +Signer?](https://docs.aws.amazon.com/signer/latest/developerguide/Welcome.html) + +## Table of Contents + +- [Signing Platform](#signing-platform) +- [Signing Profile](#signing-profile) + +## Signing Platform + +A signing platform is a predefined set of instructions that specifies the signature format and signing algorithms that AWS Signer should use +to sign a zip file. For more information go to [Signing Platforms in AWS Signer](https://docs.aws.amazon.com/signer/latest/developerguide/gs-platform.html). + +AWS Signer provides a pre-defined set of signing platforms. They are available in the CDK as - + +```text +Platform.AWS_IOT_DEVICE_MANAGEMENT_SHA256_ECDSA +Platform.AWS_LAMBDA_SHA384_ECDSA +Platform.AMAZON_FREE_RTOS_TI_CC3220SF +Platform.AMAZON_FREE_RTOS_DEFAULT +``` + +## Signing Profile + +A signing profile is a code-signing template that can be used to pre-define the signature specifications for a signing job. +A signing profile includes a signing platform to designate the file type to be signed, the signature format, and the signature algorithms. +For more information, visit [Signing Profiles in AWS Signer](https://docs.aws.amazon.com/signer/latest/developerguide/gs-profile.html). + +The following code sets up a signing profile for signing lambda code bundles - + +```ts +const signingProfile = new signer.SigningProfile(this, 'SigningProfile', { + platform: signer.Platform.AWS_LAMBDA_SHA384_ECDSA, +}); +``` + +A signing profile is valid by default for 135 months. This can be modified by specifying the `signatureValidityPeriod` property. diff --git a/packages/aws-cdk-lib/aws-signer/index.ts b/packages/aws-cdk-lib/aws-signer/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-signer/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-signer/lib/index.ts b/packages/aws-cdk-lib/aws-signer/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-signer/lib/index.ts rename to packages/aws-cdk-lib/aws-signer/lib/index.ts diff --git a/packages/@aws-cdk/aws-signer/lib/signing-profile.ts b/packages/aws-cdk-lib/aws-signer/lib/signing-profile.ts similarity index 98% rename from packages/@aws-cdk/aws-signer/lib/signing-profile.ts rename to packages/aws-cdk-lib/aws-signer/lib/signing-profile.ts index 8a0d14c3d194a..d1ae339b3fd1d 100644 --- a/packages/@aws-cdk/aws-signer/lib/signing-profile.ts +++ b/packages/aws-cdk-lib/aws-signer/lib/signing-profile.ts @@ -1,4 +1,4 @@ -import { Duration, IResource, Resource, Stack } from '@aws-cdk/core'; +import { Duration, IResource, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnSigningProfile } from './signer.generated'; diff --git a/packages/@aws-cdk/aws-signer/test/signing-profile.test.ts b/packages/aws-cdk-lib/aws-signer/test/signing-profile.test.ts similarity index 97% rename from packages/@aws-cdk/aws-signer/test/signing-profile.test.ts rename to packages/aws-cdk-lib/aws-signer/test/signing-profile.test.ts index 44db183b565a5..49075529598fb 100644 --- a/packages/@aws-cdk/aws-signer/test/signing-profile.test.ts +++ b/packages/aws-cdk-lib/aws-signer/test/signing-profile.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as signer from '../lib'; let app: cdk.App; diff --git a/packages/aws-cdk-lib/aws-simspaceweaver/.jsiirc.json b/packages/aws-cdk-lib/aws-simspaceweaver/.jsiirc.json new file mode 100644 index 0000000000000..b3e2af00af620 --- /dev/null +++ b/packages/aws-cdk-lib/aws-simspaceweaver/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SimSpaceWeaver" + }, + "java": { + "package": "software.amazon.awscdk.services.simspaceweaver" + }, + "python": { + "module": "aws_cdk.aws_simspaceweaver" + } + } +} diff --git a/packages/aws-cdk-lib/aws-simspaceweaver/README.md b/packages/aws-cdk-lib/aws-simspaceweaver/README.md new file mode 100644 index 0000000000000..da95e734b7e61 --- /dev/null +++ b/packages/aws-cdk-lib/aws-simspaceweaver/README.md @@ -0,0 +1,27 @@ +# AWS::SimSpaceWeaver Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as simspaceweaver from 'aws-cdk-lib/aws-simspaceweaver'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SimSpaceWeaver construct libraries](https://constructs.dev/search?q=simspaceweaver) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SimSpaceWeaver resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SimSpaceWeaver.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SimSpaceWeaver](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SimSpaceWeaver.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-simspaceweaver/index.ts b/packages/aws-cdk-lib/aws-simspaceweaver/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-simspaceweaver/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-simspaceweaver/lib/index.ts b/packages/aws-cdk-lib/aws-simspaceweaver/lib/index.ts new file mode 100644 index 0000000000000..2639167897ec6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-simspaceweaver/lib/index.ts @@ -0,0 +1 @@ +export * from './simspaceweaver.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/.jsiirc.json b/packages/aws-cdk-lib/aws-sns-subscriptions/.jsiirc.json new file mode 100644 index 0000000000000..e669b1bab73d0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.sns.subscriptions" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SNS.Subscriptions" + }, + "python": { + "module": "aws_cdk.aws_sns_subscriptions" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/README.md b/packages/aws-cdk-lib/aws-sns-subscriptions/README.md new file mode 100644 index 0000000000000..c7ab5ea003638 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/README.md @@ -0,0 +1,120 @@ +# CDK Construct Library for Amazon Simple Notification Service Subscriptions + + +This library provides constructs for adding subscriptions to an Amazon SNS topic. +Subscriptions can be added by calling the `.addSubscription(...)` method on the topic. + +## Subscriptions + +Subscriptions can be added to the following endpoints: + +* HTTPS +* Amazon SQS +* AWS Lambda +* Email +* SMS + +Subscriptions to Amazon SQS and AWS Lambda can be added on topics across regions. + +Create an Amazon SNS Topic to add subscriptions. + +```ts +const myTopic = new sns.Topic(this, 'MyTopic'); +``` + +### HTTPS + +Add an HTTP or HTTPS Subscription to your topic: + +```ts +const myTopic = new sns.Topic(this, 'MyTopic'); + +myTopic.addSubscription(new subscriptions.UrlSubscription('https://foobar.com/')); +``` + +The URL being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve +to a URL during deployment. A typical use case is when the URL is passed in as a [CloudFormation +parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The +following code defines a CloudFormation parameter and uses it in a URL subscription. + +```ts +const myTopic = new sns.Topic(this, 'MyTopic'); +const url = new CfnParameter(this, 'url-param'); + +myTopic.addSubscription(new subscriptions.UrlSubscription(url.valueAsString)); +``` + +### Amazon SQS + +Subscribe a queue to your topic: + +```ts +const myQueue = new sqs.Queue(this, 'MyQueue'); +const myTopic = new sns.Topic(this, 'MyTopic'); + +myTopic.addSubscription(new subscriptions.SqsSubscription(myQueue)); +``` + +KMS key permissions will automatically be granted to SNS when a subscription is made to +an encrypted queue. + +Note that subscriptions of queues in different accounts need to be manually confirmed by +reading the initial message from the queue and visiting the link found in it. + +### AWS Lambda + +Subscribe an AWS Lambda function to your topic: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const myTopic = new sns.Topic(this, 'myTopic'); +declare const myFunction: lambda.Function; +myTopic.addSubscription(new subscriptions.LambdaSubscription(myFunction)); +``` + +### Email + +Subscribe an email address to your topic: + +```ts +const myTopic = new sns.Topic(this, 'MyTopic'); +myTopic.addSubscription(new subscriptions.EmailSubscription('foo@bar.com')); +``` + +The email being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve +to an email address during deployment. A typical use case is when the email address is passed in as a [CloudFormation +parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The +following code defines a CloudFormation parameter and uses it in an email subscription. + +```ts +const myTopic = new sns.Topic(this, 'Topic'); +const emailAddress = new CfnParameter(this, 'email-param'); + +myTopic.addSubscription(new subscriptions.EmailSubscription(emailAddress.valueAsString)); +``` + +Note that email subscriptions require confirmation by visiting the link sent to the +email address. + +### SMS + +Subscribe an sms number to your topic: + +```ts +const myTopic = new sns.Topic(this, 'Topic'); + +myTopic.addSubscription(new subscriptions.SmsSubscription('+15551231234')); +``` + +The number being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve +to a number during deployment. A typical use case is when the number is passed in as a [CloudFormation +parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The +following code defines a CloudFormation parameter and uses it in an sms subscription. + +```ts +const myTopic = new sns.Topic(this, 'Topic'); +const smsNumber = new CfnParameter(this, 'sms-param'); + +myTopic.addSubscription(new subscriptions.SmsSubscription(smsNumber.valueAsString)); +``` diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/index.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/email.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/email.ts similarity index 96% rename from packages/@aws-cdk/aws-sns-subscriptions/lib/email.ts rename to packages/aws-cdk-lib/aws-sns-subscriptions/lib/email.ts index 81c71c4d13154..fc6ce5d5a52e9 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/lib/email.ts +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/email.ts @@ -1,4 +1,4 @@ -import * as sns from '@aws-cdk/aws-sns'; +import * as sns from '../../aws-sns'; import { SubscriptionProps } from './subscription'; /** diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/index.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-sns-subscriptions/lib/index.ts rename to packages/aws-cdk-lib/aws-sns-subscriptions/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/lib/lambda.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/lambda.ts new file mode 100644 index 0000000000000..36f6f647ac578 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/lambda.ts @@ -0,0 +1,69 @@ +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import { ArnFormat, Names, Stack, Token } from '../../core'; +import { Construct } from 'constructs'; +import { SubscriptionProps } from './subscription'; + +/** + * Properties for a Lambda subscription + */ +export interface LambdaSubscriptionProps extends SubscriptionProps { + +} +/** + * Use a Lambda function as a subscription target + */ +export class LambdaSubscription implements sns.ITopicSubscription { + constructor(private readonly fn: lambda.IFunction, private readonly props: LambdaSubscriptionProps = {}) { + } + + /** + * Returns a configuration for a Lambda function to subscribe to an SNS topic + */ + public bind(topic: sns.ITopic): sns.TopicSubscriptionConfig { + // Create subscription under *consuming* construct to make sure it ends up + // in the correct stack in cases of cross-stack subscriptions. + if (!(this.fn instanceof Construct)) { + throw new Error('The supplied lambda Function object must be an instance of Construct'); + } + + this.fn.addPermission(`AllowInvoke:${Names.nodeUniqueId(topic.node)}`, { + sourceArn: topic.topicArn, + principal: new iam.ServicePrincipal('sns.amazonaws.com'), + }); + + // if the topic and function are created in different stacks + // then we need to make sure the topic is created first + if (topic instanceof sns.Topic && topic.stack !== this.fn.stack) { + this.fn.stack.addDependency(topic.stack); + } + + return { + subscriberScope: this.fn, + subscriberId: topic.node.id, + endpoint: this.fn.functionArn, + protocol: sns.SubscriptionProtocol.LAMBDA, + filterPolicy: this.props.filterPolicy, + filterPolicyWithMessageBody: this.props.filterPolicyWithMessageBody, + region: this.regionFromArn(topic), + deadLetterQueue: this.props.deadLetterQueue, + }; + } + + private regionFromArn(topic: sns.ITopic): string | undefined { + // no need to specify `region` for topics defined within the same stack. + if (topic instanceof sns.Topic) { + if (topic.stack !== this.fn.stack) { + // only if we know the region, will not work for + // env agnostic stacks + if (!Token.isUnresolved(topic.env.region) && + (topic.env.region !== this.fn.env.region)) { + return topic.env.region; + } + } + return undefined; + } + return Stack.of(topic).splitArn(topic.topicArn, ArnFormat.SLASH_RESOURCE_NAME).region; + } +} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/sms.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sms.ts similarity index 94% rename from packages/@aws-cdk/aws-sns-subscriptions/lib/sms.ts rename to packages/aws-cdk-lib/aws-sns-subscriptions/lib/sms.ts index 0f2446278def3..180b26e7246fa 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/lib/sms.ts +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sms.ts @@ -1,4 +1,4 @@ -import * as sns from '@aws-cdk/aws-sns'; +import * as sns from '../../aws-sns'; import { SubscriptionProps } from './subscription'; /** diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts new file mode 100644 index 0000000000000..0509d3ff425b0 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts @@ -0,0 +1,100 @@ +import * as iam from '../../aws-iam'; +import * as sns from '../../aws-sns'; +import * as sqs from '../../aws-sqs'; +import { ArnFormat, FeatureFlags, Names, Stack, Token } from '../../core'; +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { SubscriptionProps } from './subscription'; + +/** + * Properties for an SQS subscription + */ +export interface SqsSubscriptionProps extends SubscriptionProps { + /** + * The message to the queue is the same as it was sent to the topic + * + * If false, the message will be wrapped in an SNS envelope. + * + * @default false + */ + readonly rawMessageDelivery?: boolean; +} + +/** + * Use an SQS queue as a subscription target + */ +export class SqsSubscription implements sns.ITopicSubscription { + constructor(private readonly queue: sqs.IQueue, private readonly props: SqsSubscriptionProps = {}) { + } + + /** + * Returns a configuration for an SQS queue to subscribe to an SNS topic + */ + public bind(topic: sns.ITopic): sns.TopicSubscriptionConfig { + // Create subscription under *consuming* construct to make sure it ends up + // in the correct stack in cases of cross-stack subscriptions. + if (!(this.queue instanceof Construct)) { + throw new Error('The supplied Queue object must be an instance of Construct'); + } + const snsServicePrincipal = new iam.ServicePrincipal('sns.amazonaws.com'); + + // add a statement to the queue resource policy which allows this topic + // to send messages to the queue. + const queuePolicyDependable = this.queue.addToResourcePolicy(new iam.PolicyStatement({ + resources: [this.queue.queueArn], + actions: ['sqs:SendMessage'], + principals: [snsServicePrincipal], + conditions: { + ArnEquals: { 'aws:SourceArn': topic.topicArn }, + }, + })).policyDependable; + + // if the queue is encrypted, add a statement to the key resource policy + // which allows this topic to decrypt KMS keys + if (this.queue.encryptionMasterKey) { + this.queue.encryptionMasterKey.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['kms:Decrypt', 'kms:GenerateDataKey'], + principals: [snsServicePrincipal], + conditions: FeatureFlags.of(topic).isEnabled(cxapi.SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY) + ? { ArnEquals: { 'aws:SourceArn': topic.topicArn } } + : undefined, + })); + } + + // if the topic and queue are created in different stacks + // then we need to make sure the topic is created first + if (topic instanceof sns.Topic && topic.stack !== this.queue.stack) { + this.queue.stack.addDependency(topic.stack); + } + + return { + subscriberScope: this.queue, + subscriberId: Names.nodeUniqueId(topic.node), + endpoint: this.queue.queueArn, + protocol: sns.SubscriptionProtocol.SQS, + rawMessageDelivery: this.props.rawMessageDelivery, + filterPolicy: this.props.filterPolicy, + filterPolicyWithMessageBody: this.props.filterPolicyWithMessageBody, + region: this.regionFromArn(topic), + deadLetterQueue: this.props.deadLetterQueue, + subscriptionDependency: queuePolicyDependable, + }; + } + + private regionFromArn(topic: sns.ITopic): string | undefined { + // no need to specify `region` for topics defined within the same stack + if (topic instanceof sns.Topic) { + if (topic.stack !== this.queue.stack) { + // only if we know the region, will not work for + // env agnostic stacks + if (!Token.isUnresolved(topic.env.region) && + (topic.env.region !== this.queue.env.region)) { + return topic.env.region; + } + } + return undefined; + } + return Stack.of(topic).splitArn(topic.topicArn, ArnFormat.SLASH_RESOURCE_NAME).region; + } +} diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/lib/subscription.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/subscription.ts new file mode 100644 index 0000000000000..cb00ef6507d53 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/subscription.ts @@ -0,0 +1,28 @@ +import * as sns from '../../aws-sns'; +import { IQueue } from '../../aws-sqs'; + +/** + * Options to subscribing to an SNS topic + */ +export interface SubscriptionProps { + /** + * The filter policy. + * + * @default - all messages are delivered + */ + readonly filterPolicy?: { [attribute: string]: sns.SubscriptionFilter }; + /** + * The filter policy that is applied on the message body. + * To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. + * + * @default - all messages are delivered + */ + readonly filterPolicyWithMessageBody?: { [attribute: string]: sns.FilterOrPolicy }; + /** + * Queue to be used as dead letter queue. + * If not passed no dead letter queue is enabled. + * + * @default - No dead letter queue enabled. + */ + readonly deadLetterQueue?: IQueue; +} diff --git a/packages/@aws-cdk/aws-sns-subscriptions/lib/url.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/url.ts similarity index 96% rename from packages/@aws-cdk/aws-sns-subscriptions/lib/url.ts rename to packages/aws-cdk-lib/aws-sns-subscriptions/lib/url.ts index bab121ba61a22..edbab8f8495f9 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/lib/url.ts +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/url.ts @@ -1,5 +1,5 @@ -import * as sns from '@aws-cdk/aws-sns'; -import { Token } from '@aws-cdk/core'; +import * as sns from '../../aws-sns'; +import { Token } from '../../core'; import { SubscriptionProps } from './subscription'; /** diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts new file mode 100644 index 0000000000000..5c1b5ac8fcd20 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/test/integ.sns-sqs-cross-region.lit.ts @@ -0,0 +1,28 @@ +import * as sns from '../../aws-sns'; +import * as sqs from '../../aws-sqs'; +import * as cdk from '../../core'; +import * as subs from '../lib'; + +/// !cdk-integ * pragma:enable-lookups +const app = new cdk.App(); + +/// !show +const topicStack = new cdk.Stack(app, 'TopicStack', { + env: { + account: process.env.CDK_INTEG_ACCOUNT || process.env.CDK_DEFAULT_ACCOUNT, + region: 'us-east-1', + }, +}); +const topic = new sns.Topic(topicStack, 'MyTopic', { + topicName: cdk.PhysicalName.GENERATE_IF_NEEDED, +}); + +const queueStack = new cdk.Stack(app, 'QueueStack', { + env: { region: 'us-east-2' }, +}); +const queue = new sqs.Queue(queueStack, 'MyQueue'); + +topic.addSubscription(new subs.SqsSubscription(queue)); +/// !hide + +app.synth(); diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts new file mode 100644 index 0000000000000..0e173d40022e4 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/test/integ.sns-sqs.lit.ts @@ -0,0 +1,33 @@ +import * as kms from '../../aws-kms'; +import * as sns from '../../aws-sns'; +import * as sqs from '../../aws-sqs'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; +import * as subs from '../lib'; + +const restrictSqsDescryption = { [cxapi.SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY]: true }; + +class SnsToSqs extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + /// !show + const topic = new sns.Topic(this, 'MyTopic'); + const queue = new sqs.Queue(this, 'MyQueue', { + encryptionMasterKey: new kms.Key(this, 'EncryptionMasterKey'), + }); + + topic.addSubscription(new subs.SqsSubscription(queue, { + deadLetterQueue: new sqs.Queue(this, 'DeadLetterQueue'), + })); + /// !hide + } +} + +const app = new cdk.App({ + context: restrictSqsDescryption, +}); + +new SnsToSqs(app, 'aws-cdk-sns-sqs'); + +app.synth(); diff --git a/packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/test/subs.test.ts similarity index 99% rename from packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts rename to packages/aws-cdk-lib/aws-sns-subscriptions/test/subs.test.ts index 0b768d668e698..09d099a40bbba 100644 --- a/packages/@aws-cdk/aws-sns-subscriptions/test/subs.test.ts +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/test/subs.test.ts @@ -1,10 +1,10 @@ -import { Template } from '@aws-cdk/assertions'; -import * as kms from '@aws-cdk/aws-kms'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sqs from '@aws-cdk/aws-sqs'; -import { App, CfnParameter, Duration, RemovalPolicy, Stack, Token } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from '../../assertions'; +import * as kms from '../../aws-kms'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import * as sqs from '../../aws-sqs'; +import { App, CfnParameter, Duration, RemovalPolicy, Stack, Token } from '../../core'; +import * as cxapi from '../../cx-api'; import * as subs from '../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-sns/.jsiirc.json b/packages/aws-cdk-lib/aws-sns/.jsiirc.json new file mode 100644 index 0000000000000..432b85522da24 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.sns" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SNS" + }, + "python": { + "module": "aws_cdk.aws_sns" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sns/README.md b/packages/aws-cdk-lib/aws-sns/README.md new file mode 100644 index 0000000000000..bcaeb08bc9090 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns/README.md @@ -0,0 +1,208 @@ +# Amazon Simple Notification Service Construct Library + + +Add an SNS Topic to your stack: + +```ts +const topic = new sns.Topic(this, 'Topic', { + displayName: 'Customer subscription topic', +}); +``` + +Add a FIFO SNS topic with content-based de-duplication to your stack: + +```ts +const topic = new sns.Topic(this, 'Topic', { + contentBasedDeduplication: true, + displayName: 'Customer subscription topic', + fifo: true, +}); +``` + +Note that FIFO topics require a topic name to be provided. The required `.fifo` suffix will be automatically generated and added to the topic name if it is not explicitly provided. + +## Subscriptions + +Various subscriptions can be added to the topic by calling the +`.addSubscription(...)` method on the topic. It accepts a *subscription* object, +default implementations of which can be found in the +`@aws-cdk/aws-sns-subscriptions` package: + +Add an HTTPS Subscription to your topic: + +```ts +const myTopic = new sns.Topic(this, 'MyTopic'); + +myTopic.addSubscription(new subscriptions.UrlSubscription('https://foobar.com/')); +``` + +Subscribe a queue to the topic: + +```ts +declare const queue: sqs.Queue; +const myTopic = new sns.Topic(this, 'MyTopic'); + +myTopic.addSubscription(new subscriptions.SqsSubscription(queue)); +``` + +Note that subscriptions of queues in different accounts need to be manually confirmed by +reading the initial message from the queue and visiting the link found in it. + +### Filter policy + +A filter policy can be specified when subscribing an endpoint to a topic. + +Example with a Lambda subscription: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const myTopic = new sns.Topic(this, 'MyTopic'); +declare const fn: lambda.Function; + +// Lambda should receive only message matching the following conditions on attributes: +// color: 'red' or 'orange' or begins with 'bl' +// size: anything but 'small' or 'medium' +// price: between 100 and 200 or greater than 300 +// store: attribute must be present +myTopic.addSubscription(new subscriptions.LambdaSubscription(fn, { + filterPolicy: { + color: sns.SubscriptionFilter.stringFilter({ + allowlist: ['red', 'orange'], + matchPrefixes: ['bl'], + }), + size: sns.SubscriptionFilter.stringFilter({ + denylist: ['small', 'medium'], + }), + price: sns.SubscriptionFilter.numericFilter({ + between: { start: 100, stop: 200 }, + greaterThan: 300, + }), + store: sns.SubscriptionFilter.existsFilter(), + }, +})); +``` + +#### Payload-based filtering + +To filter messages based on the payload or body of the message, use the `filterPolicyWithMessageBody` property. This type of filter policy supports creating filters on nested objects. + +Example with a Lambda subscription: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const myTopic = new sns.Topic(this, 'MyTopic'); +declare const fn: lambda.Function; + +// Lambda should receive only message matching the following conditions on message body: +// color: 'red' or 'orange' +myTopic.addSubscription(new subscriptions.LambdaSubscription(fn, { + filterPolicyWithMessageBody: { + background: sns.FilterOrPolicy.policy({ + color: sns.FilterOrPolicy.filter(sns.SubscriptionFilter.stringFilter({ + allowlist: ['red', 'orange'], + })), + }), + }, +})); +``` + +### Example of Firehose Subscription + +```ts +import { DeliveryStream } from 'aws-cdk-lib/aws-kinesisfirehose'; + +const topic = new sns.Topic(this, 'Topic'); +declare const stream: DeliveryStream; + +new sns.Subscription(this, 'Subscription', { + topic, + endpoint: stream.deliveryStreamArn, + protocol: sns.SubscriptionProtocol.FIREHOSE, + subscriptionRoleArn: "SAMPLE_ARN", //role with permissions to send messages to a firehose delivery stream +}); +``` + +## DLQ setup for SNS Subscription + +CDK can attach provided Queue as DLQ for your SNS subscription. +See the [SNS DLQ configuration docs](https://docs.aws.amazon.com/sns/latest/dg/sns-configure-dead-letter-queue.html) for more information about this feature. + +Example of usage with user provided DLQ. + +```ts +const topic = new sns.Topic(this, 'Topic'); +const dlQueue = new sqs.Queue(this, 'DeadLetterQueue', { + queueName: 'MySubscription_DLQ', + retentionPeriod: Duration.days(14), +}); + +new sns.Subscription(this, 'Subscription', { + endpoint: 'endpoint', + protocol: sns.SubscriptionProtocol.LAMBDA, + topic, + deadLetterQueue: dlQueue, +}); +``` + +## CloudWatch Event Rule Target + +SNS topics can be used as targets for CloudWatch event rules. + +Use the `@aws-cdk/aws-events-targets.SnsTopic`: + +```ts +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +declare const repo: codecommit.Repository; +const myTopic = new sns.Topic(this, 'Topic'); + +repo.onCommit('OnCommit', { + target: new targets.SnsTopic(myTopic), +}); +``` + +This will result in adding a target to the event rule and will also modify the +topic resource policy to allow CloudWatch events to publish to the topic. + +## Topic Policy + +A topic policy is automatically created when `addToResourcePolicy` is called, if +one doesn't already exist. Using `addToResourcePolicy` is the simplest way to +add policies, but a `TopicPolicy` can also be created manually. + +```ts +const topic = new sns.Topic(this, 'Topic'); +const topicPolicy = new sns.TopicPolicy(this, 'TopicPolicy', { + topics: [topic], +}); + +topicPolicy.document.addStatements(new iam.PolicyStatement({ + actions: ["sns:Subscribe"], + principals: [new iam.AnyPrincipal()], + resources: [topic.topicArn], +})); +``` + +A policy document can also be passed on `TopicPolicy` construction + +```ts +const topic = new sns.Topic(this, 'Topic'); +const policyDocument = new iam.PolicyDocument({ + assignSids: true, + statements: [ + new iam.PolicyStatement({ + actions: ["sns:Subscribe"], + principals: [new iam.AnyPrincipal()], + resources: [topic.topicArn], + }), + ], +}); + +const topicPolicy = new sns.TopicPolicy(this, 'Policy', { + topics: [topic], + policyDocument, +}); +``` diff --git a/packages/aws-cdk-lib/aws-sns/index.ts b/packages/aws-cdk-lib/aws-sns/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-sns/lib/index.ts b/packages/aws-cdk-lib/aws-sns/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-sns/lib/index.ts rename to packages/aws-cdk-lib/aws-sns/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-sns/lib/policy.ts b/packages/aws-cdk-lib/aws-sns/lib/policy.ts new file mode 100644 index 0000000000000..b921b2ba56a95 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns/lib/policy.ts @@ -0,0 +1,59 @@ +import { PolicyDocument } from '../../aws-iam'; +import { Resource } from '../../core'; +import { Construct } from 'constructs'; +import { CfnTopicPolicy } from './sns.generated'; +import { ITopic } from './topic-base'; + +/** + * Properties to associate SNS topics with a policy + */ +export interface TopicPolicyProps { + /** + * The set of topics this policy applies to. + */ + readonly topics: ITopic[]; + /** + * IAM policy document to apply to topic(s). + * @default empty policy document + */ + readonly policyDocument?: PolicyDocument; + +} + +/** + * The policy for an SNS Topic + * + * Policies define the operations that are allowed on this resource. + * + * You almost never need to define this construct directly. + * + * All AWS resources that support resource policies have a method called + * `addToResourcePolicy()`, which will automatically create a new resource + * policy if one doesn't exist yet, otherwise it will add to the existing + * policy. + * + * Prefer to use `addToResourcePolicy()` instead. + */ +export class TopicPolicy extends Resource { + /** + * The IAM policy document for this policy. + */ + public readonly document = new PolicyDocument({ + // statements must be unique, so we use the statement index. + // potantially SIDs can change as a result of order change, but this should + // not have an impact on the policy evaluation. + // https://docs.aws.amazon.com/sns/latest/dg/AccessPolicyLanguage_SpecialInfo.html + assignSids: true, + }); + + constructor(scope: Construct, id: string, props: TopicPolicyProps) { + super(scope, id); + + this.document = props.policyDocument ?? this.document; + + new CfnTopicPolicy(this, 'Resource', { + policyDocument: this.document, + topics: props.topics.map(t => t.topicArn), + }); + } +} diff --git a/packages/@aws-cdk/aws-sns/lib/subscriber.ts b/packages/aws-cdk-lib/aws-sns/lib/subscriber.ts similarity index 100% rename from packages/@aws-cdk/aws-sns/lib/subscriber.ts rename to packages/aws-cdk-lib/aws-sns/lib/subscriber.ts diff --git a/packages/@aws-cdk/aws-sns/lib/subscription-filter.ts b/packages/aws-cdk-lib/aws-sns/lib/subscription-filter.ts similarity index 100% rename from packages/@aws-cdk/aws-sns/lib/subscription-filter.ts rename to packages/aws-cdk-lib/aws-sns/lib/subscription-filter.ts diff --git a/packages/aws-cdk-lib/aws-sns/lib/subscription.ts b/packages/aws-cdk-lib/aws-sns/lib/subscription.ts new file mode 100644 index 0000000000000..7450e87a42550 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns/lib/subscription.ts @@ -0,0 +1,352 @@ +import { PolicyStatement, ServicePrincipal } from '../../aws-iam'; +import { IQueue } from '../../aws-sqs'; +import { Resource } from '../../core'; +import { Construct } from 'constructs'; +import { CfnSubscription } from './sns.generated'; +import { SubscriptionFilter } from './subscription-filter'; +import { ITopic } from './topic-base'; + +/** + * Options for creating a new subscription + */ +export interface SubscriptionOptions { + /** + * What type of subscription to add. + */ + readonly protocol: SubscriptionProtocol; + + /** + * The subscription endpoint. + * + * The meaning of this value depends on the value for 'protocol'. + */ + readonly endpoint: string; + + /** + * true if raw message delivery is enabled for the subscription. Raw messages are free of JSON formatting and can be + * sent to HTTP/S and Amazon SQS endpoints. For more information, see GetSubscriptionAttributes in the Amazon Simple + * Notification Service API Reference. + * + * @default false + */ + readonly rawMessageDelivery?: boolean; + + /** + * The filter policy. + * + * @default - all messages are delivered + */ + readonly filterPolicy? : { [attribute: string]: SubscriptionFilter }; + + /** + * The filter policy that is applied on the message body. + * To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used. + * + * @default - all messages are delivered + */ + readonly filterPolicyWithMessageBody?: { [attribute: string]: FilterOrPolicy }; + + /** + * The region where the topic resides, in the case of cross-region subscriptions + * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-subscription.html#cfn-sns-subscription-region + * @default - the region where the CloudFormation stack is being deployed. + */ + readonly region?: string; + + /** + * Queue to be used as dead letter queue. + * If not passed no dead letter queue is enabled. + * + * @default - No dead letter queue enabled. + */ + readonly deadLetterQueue?: IQueue; + + /** + * Arn of role allowing access to firehose delivery stream. + * Required for a firehose subscription protocol. + * @default - No subscription role is provided + */ + readonly subscriptionRoleArn?: string; +} +/** + * Properties for creating a new subscription + */ +export interface SubscriptionProps extends SubscriptionOptions { + /** + * The topic to subscribe to. + */ + readonly topic: ITopic; +} + +/** + * A new subscription. + * + * Prefer to use the `ITopic.addSubscription()` methods to create instances of + * this class. + */ +export class Subscription extends Resource { + + /** + * The DLQ associated with this subscription if present. + */ + public readonly deadLetterQueue?: IQueue; + + private readonly filterPolicy?: { [attribute: string]: any[] }; + + private readonly filterPolicyWithMessageBody? : {[attribute: string]: FilterOrPolicy }; + + constructor(scope: Construct, id: string, props: SubscriptionProps) { + super(scope, id); + + if (props.rawMessageDelivery && + [ + SubscriptionProtocol.HTTP, + SubscriptionProtocol.HTTPS, + SubscriptionProtocol.SQS, + SubscriptionProtocol.FIREHOSE, + ] + .indexOf(props.protocol) < 0) { + throw new Error('Raw message delivery can only be enabled for HTTP, HTTPS, SQS, and Firehose subscriptions.'); + } + + if (props.filterPolicy) { + if (Object.keys(props.filterPolicy).length > 5) { + throw new Error('A filter policy can have a maximum of 5 attribute names.'); + } + + this.filterPolicy = Object.entries(props.filterPolicy) + .reduce( + (acc, [k, v]) => ({ ...acc, [k]: v.conditions }), + {}, + ); + + let total = 1; + Object.values(this.filterPolicy).forEach(filter => { total *= filter.length; }); + if (total > 150) { + throw new Error(`The total combination of values (${total}) must not exceed 150.`); + } + } else if (props.filterPolicyWithMessageBody) { + if (Object.keys(props.filterPolicyWithMessageBody).length > 5) { + throw new Error('A filter policy can have a maximum of 5 attribute names.'); + } + this.filterPolicyWithMessageBody = props.filterPolicyWithMessageBody; + } + + if (props.protocol === SubscriptionProtocol.FIREHOSE && !props.subscriptionRoleArn) { + throw new Error('Subscription role arn is required field for subscriptions with a firehose protocol.'); + } + + // Format filter policy + const filterPolicy = this.filterPolicyWithMessageBody + ? buildFilterPolicyWithMessageBody(this.filterPolicyWithMessageBody) + : this.filterPolicy; + + this.deadLetterQueue = this.buildDeadLetterQueue(props); + new CfnSubscription(this, 'Resource', { + endpoint: props.endpoint, + protocol: props.protocol, + topicArn: props.topic.topicArn, + rawMessageDelivery: props.rawMessageDelivery, + filterPolicy, + filterPolicyScope: this.filterPolicyWithMessageBody ? 'MessageBody' : undefined, + region: props.region, + redrivePolicy: this.buildDeadLetterConfig(this.deadLetterQueue), + subscriptionRoleArn: props.subscriptionRoleArn, + }); + + } + + private buildDeadLetterQueue(props: SubscriptionProps) { + if (!props.deadLetterQueue) { + return undefined; + } + + const deadLetterQueue = props.deadLetterQueue; + + deadLetterQueue.addToResourcePolicy(new PolicyStatement({ + resources: [deadLetterQueue.queueArn], + actions: ['sqs:SendMessage'], + principals: [new ServicePrincipal('sns.amazonaws.com')], + conditions: { + ArnEquals: { 'aws:SourceArn': props.topic.topicArn }, + }, + })); + + return deadLetterQueue; + } + + private buildDeadLetterConfig(deadLetterQueue?: IQueue) { + if (deadLetterQueue) { + return { + deadLetterTargetArn: deadLetterQueue.queueArn, + }; + } else { + return undefined; + } + } +} + +/** + * The type of subscription, controlling the type of the endpoint parameter. + */ +export enum SubscriptionProtocol { + /** + * JSON-encoded message is POSTED to an HTTP url. + */ + HTTP = 'http', + + /** + * JSON-encoded message is POSTed to an HTTPS url. + */ + HTTPS = 'https', + + /** + * Notifications are sent via email. + */ + EMAIL = 'email', + + /** + * Notifications are JSON-encoded and sent via mail. + */ + EMAIL_JSON = 'email-json', + + /** + * Notification is delivered by SMS + */ + SMS = 'sms', + + /** + * Notifications are enqueued into an SQS queue. + */ + SQS = 'sqs', + + /** + * JSON-encoded notifications are sent to a mobile app endpoint. + */ + APPLICATION = 'application', + + /** + * Notifications trigger a Lambda function. + */ + LAMBDA = 'lambda', + + /** + * Notifications put records into a firehose delivery stream. + */ + FIREHOSE = 'firehose' +} + +function buildFilterPolicyWithMessageBody( + inputObject: { [key: string]: FilterOrPolicy }, + depth = 1, + totalCombinationValues = [1], +): { [key: string]: any } { + const result: { [key: string]: any } = {}; + + for (const [key, filterOrPolicy] of Object.entries(inputObject)) { + if (filterOrPolicy.isPolicy()) { + result[key] = buildFilterPolicyWithMessageBody(filterOrPolicy.policyDoc, depth + 1, totalCombinationValues); + } else if (filterOrPolicy.isFilter()) { + const filter = filterOrPolicy.filterDoc.conditions; + result[key] = filter; + totalCombinationValues[0] *= filter.length * depth; + } + } + + // https://docs.aws.amazon.com/sns/latest/dg/subscription-filter-policy-constraints.html + if (totalCombinationValues[0] > 150) { + throw new Error(`The total combination of values (${totalCombinationValues}) must not exceed 150.`); + } + + return result; +}; + +/** + * The type of the MessageBody at a given key value pair + */ +export enum FilterOrPolicyType { + /** + * The filter of the MessageBody + */ + FILTER, + /** + * A nested key of the MessageBody + */ + POLICY, +} + +/** + * Class for building the FilterPolicy by avoiding union types + */ +export abstract class FilterOrPolicy { + /** + * Filter of MessageBody + * @param filter + * @returns + */ + public static filter(filter: SubscriptionFilter) { + return new Filter(filter); + } + + /** + * Policy of MessageBody + * @param policy + * @returns + */ + public static policy(policy: { [attribute: string]: FilterOrPolicy }) { + return new Policy(policy); + } + + /** + * Type switch for disambiguating between subclasses + */ + abstract readonly type: FilterOrPolicyType; + + /** + * Check if instance is `Policy` type + */ + public isPolicy(): this is Policy { + return this.type === FilterOrPolicyType.POLICY; + } + + /** + * Check if instance is `Filter` type + */ + public isFilter(): this is Filter { + return this.type === FilterOrPolicyType.FILTER; + } +} + +/** + * Filter implementation of FilterOrPolicy + */ +export class Filter extends FilterOrPolicy { + /** + * Type used in DFS buildFilterPolicyWithMessageBody to determine json value type + */ + public readonly type = FilterOrPolicyType.FILTER; + /** + * Policy constructor + * @param filterDoc filter argument to construct + */ + public constructor(public readonly filterDoc: SubscriptionFilter) { + super(); + } +} + +/** + * Policy Implementation of FilterOrPolicy + */ +export class Policy extends FilterOrPolicy { + /** + * Type used in DFS buildFilterPolicyWithMessageBody to determine json value type + */ + public readonly type = FilterOrPolicyType.POLICY; + /** + * Policy constructor + * @param policyDoc policy argument to construct + */ + public constructor(public readonly policyDoc: { [attribute: string]: FilterOrPolicy }) { + super(); + } +} diff --git a/packages/@aws-cdk/aws-sns/lib/topic-base.ts b/packages/aws-cdk-lib/aws-sns/lib/topic-base.ts similarity index 96% rename from packages/@aws-cdk/aws-sns/lib/topic-base.ts rename to packages/aws-cdk-lib/aws-sns/lib/topic-base.ts index 4ace7453d7c67..262190441bb9b 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic-base.ts +++ b/packages/aws-cdk-lib/aws-sns/lib/topic-base.ts @@ -1,6 +1,6 @@ -import * as notifications from '@aws-cdk/aws-codestarnotifications'; -import * as iam from '@aws-cdk/aws-iam'; -import { IResource, Resource, ResourceProps, Token } from '@aws-cdk/core'; +import * as notifications from '../../aws-codestarnotifications'; +import * as iam from '../../aws-iam'; +import { IResource, Resource, ResourceProps, Token } from '../../core'; import * as constructs from 'constructs'; import { Construct } from 'constructs'; import { TopicPolicy } from './policy'; diff --git a/packages/@aws-cdk/aws-sns/lib/topic.ts b/packages/aws-cdk-lib/aws-sns/lib/topic.ts similarity index 97% rename from packages/@aws-cdk/aws-sns/lib/topic.ts rename to packages/aws-cdk-lib/aws-sns/lib/topic.ts index 71db859e7ed96..f76af6269aa3a 100644 --- a/packages/@aws-cdk/aws-sns/lib/topic.ts +++ b/packages/aws-cdk-lib/aws-sns/lib/topic.ts @@ -1,5 +1,5 @@ -import { IKey } from '@aws-cdk/aws-kms'; -import { ArnFormat, Names, Stack } from '@aws-cdk/core'; +import { IKey } from '../../aws-kms'; +import { ArnFormat, Names, Stack } from '../../core'; import { Construct } from 'constructs'; import { CfnTopic } from './sns.generated'; import { ITopic, TopicBase } from './topic-base'; diff --git a/packages/aws-cdk-lib/aws-sns/test/sns.test.ts b/packages/aws-cdk-lib/aws-sns/test/sns.test.ts new file mode 100644 index 0000000000000..aa14cdc2694b3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sns/test/sns.test.ts @@ -0,0 +1,499 @@ +import { Template } from '../../assertions'; +import * as notifications from '../../aws-codestarnotifications'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as cdk from '../../core'; +import * as sns from '../lib'; + +/* eslint-disable quote-props */ + +describe('Topic', () => { + describe('topic tests', () => { + test('all defaults', () => { + const stack = new cdk.Stack(); + new sns.Topic(stack, 'MyTopic'); + + Template.fromStack(stack).resourceCountIs('AWS::SNS::Topic', 1); + + }); + + test('specify topicName', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + topicName: 'topicName', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'TopicName': 'topicName', + }); + + + }); + + test('specify displayName', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + displayName: 'displayName', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'DisplayName': 'displayName', + }); + + + }); + + test('specify kmsMasterKey', () => { + const stack = new cdk.Stack(); + const key = new kms.Key(stack, 'CustomKey'); + + new sns.Topic(stack, 'MyTopic', { + masterKey: key, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'KmsMasterKeyId': { 'Fn::GetAtt': ['CustomKey1E6D0D07', 'Arn'] }, + }); + + + }); + + test('specify displayName and topicName', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + topicName: 'topicName', + displayName: 'displayName', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'DisplayName': 'displayName', + 'TopicName': 'topicName', + }); + + + }); + + test('Adds .fifo suffix when no topicName is passed', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + fifo: true, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'FifoTopic': true, + 'TopicName': 'MyTopic.fifo', + }); + + }); + + test('specify fifo without .fifo suffix in topicName', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + fifo: true, + topicName: 'topicName', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'FifoTopic': true, + 'TopicName': 'topicName.fifo', + }); + + + }); + + test('specify fifo with .fifo suffix in topicName', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + fifo: true, + topicName: 'topicName.fifo', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'FifoTopic': true, + 'TopicName': 'topicName.fifo', + }); + + + }); + + test('specify fifo without contentBasedDeduplication', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + fifo: true, + topicName: 'topicName', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'FifoTopic': true, + 'TopicName': 'topicName.fifo', + }); + + + }); + + test('specify fifo with contentBasedDeduplication', () => { + const stack = new cdk.Stack(); + + new sns.Topic(stack, 'MyTopic', { + contentBasedDeduplication: true, + fifo: true, + topicName: 'topicName', + }); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::Topic', { + 'ContentBasedDeduplication': true, + 'FifoTopic': true, + 'TopicName': 'topicName.fifo', + }); + + + }); + + test('throw with contentBasedDeduplication on non-fifo topic', () => { + const stack = new cdk.Stack(); + + expect(() => new sns.Topic(stack, 'MyTopic', { + contentBasedDeduplication: true, + })).toThrow(/Content based deduplication can only be enabled for FIFO SNS topics./); + + + }); + }); + + test('can add a policy to the topic', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'Topic'); + + // WHEN + topic.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['sns:*'], + principals: [new iam.ArnPrincipal('arn')], + })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [{ + 'Sid': '0', + 'Action': 'sns:*', + 'Effect': 'Allow', + 'Principal': { 'AWS': 'arn' }, + 'Resource': '*', + }], + }, + }); + + + }); + + test('give publishing permissions', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'Topic'); + const user = new iam.User(stack, 'User'); + + // WHEN + topic.grantPublish(user); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + Version: '2012-10-17', + 'Statement': [ + { + 'Action': 'sns:Publish', + 'Effect': 'Allow', + 'Resource': stack.resolve(topic.topicArn), + }, + ], + }, + }); + + + }); + + test('TopicPolicy passed document', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'MyTopic'); + const ps = new iam.PolicyStatement({ + actions: ['service:statement0'], + principals: [new iam.ArnPrincipal('arn')], + }); + + // WHEN + new sns.TopicPolicy(stack, 'topicpolicy', { topics: [topic], policyDocument: new iam.PolicyDocument({ assignSids: true, statements: [ps] }) }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': 'service:statement0', + 'Effect': 'Allow', + 'Principal': { 'AWS': 'arn' }, + 'Sid': '0', + }, + ], + 'Version': '2012-10-17', + }, + 'Topics': [ + { + 'Ref': 'MyTopic86869434', + }, + ], + }); + + + }); + + test('Add statements to policy', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'MyTopic'); + + // WHEN + const topicPolicy = new sns.TopicPolicy(stack, 'TopicPolicy', { + topics: [topic], + }); + topicPolicy.document.addStatements(new iam.PolicyStatement({ + actions: ['service:statement0'], + principals: [new iam.ArnPrincipal('arn')], + })); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': 'service:statement0', + 'Effect': 'Allow', + 'Principal': { 'AWS': 'arn' }, + 'Sid': '0', + }, + ], + 'Version': '2012-10-17', + }, + 'Topics': [ + { + 'Ref': 'MyTopic86869434', + }, + ], + }); + + }); + + test('topic resource policy includes unique SIDs', () => { + const stack = new cdk.Stack(); + + const topic = new sns.Topic(stack, 'MyTopic'); + + topic.addToResourcePolicy(new iam.PolicyStatement({ + actions: ['service:statement0'], + principals: [new iam.ArnPrincipal('arn')], + })); + topic.addToResourcePolicy(new iam.PolicyStatement({ + actions: ['service:statement1'], + principals: [new iam.ArnPrincipal('arn')], + })); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': 'service:statement0', + 'Effect': 'Allow', + 'Principal': { 'AWS': 'arn' }, + 'Sid': '0', + }, + { + 'Action': 'service:statement1', + 'Effect': 'Allow', + 'Principal': { 'AWS': 'arn' }, + 'Sid': '1', + }, + ], + 'Version': '2012-10-17', + }, + 'Topics': [ + { + 'Ref': 'MyTopic86869434', + }, + ], + }); + + + }); + + test('fromTopicArn', () => { + // GIVEN + const stack2 = new cdk.Stack(); + + // WHEN + const imported = sns.Topic.fromTopicArn(stack2, 'Imported', 'arn:aws:sns:*:123456789012:my_corporate_topic'); + + // THEN + expect(imported.topicName).toEqual('my_corporate_topic'); + expect(imported.topicArn).toEqual('arn:aws:sns:*:123456789012:my_corporate_topic'); + expect(imported.fifo).toEqual(false); + + }); + + test('fromTopicArn fifo', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const imported = sns.Topic.fromTopicArn(stack, 'Imported', 'arn:aws:sns:*:123456789012:mytopic.fifo'); + + // THEN + expect(imported.topicName).toEqual('mytopic.fifo'); + expect(imported.topicArn).toEqual('arn:aws:sns:*:123456789012:mytopic.fifo'); + expect(imported.fifo).toEqual(true); + }); + + test('test metrics', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'Topic'); + + // THEN + expect(stack.resolve(topic.metricNumberOfMessagesPublished())).toEqual({ + dimensions: { TopicName: { 'Fn::GetAtt': ['TopicBFC7AF6E', 'TopicName'] } }, + namespace: 'AWS/SNS', + metricName: 'NumberOfMessagesPublished', + period: cdk.Duration.minutes(5), + statistic: 'Sum', + }); + + expect(stack.resolve(topic.metricPublishSize())).toEqual({ + dimensions: { TopicName: { 'Fn::GetAtt': ['TopicBFC7AF6E', 'TopicName'] } }, + namespace: 'AWS/SNS', + metricName: 'PublishSize', + period: cdk.Duration.minutes(5), + statistic: 'Average', + }); + + + }); + + test('subscription is created under the topic scope by default', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'Topic'); + + // WHEN + topic.addSubscription({ + bind: () => ({ + protocol: sns.SubscriptionProtocol.HTTP, + endpoint: 'http://foo/bar', + subscriberId: 'my-subscription', + }), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::SNS::Subscription', 1); + + }); + + test('if "scope" is defined, subscription will be created under that scope', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'A'); + const stack2 = new cdk.Stack(app, 'B'); + const topic = new sns.Topic(stack, 'Topic'); + + // WHEN + topic.addSubscription({ + bind: () => ({ + protocol: sns.SubscriptionProtocol.HTTP, + endpoint: 'http://foo/bar', + subscriberScope: stack2, + subscriberId: 'subscriberId', + }), + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::SNS::Subscription', 0); + Template.fromStack(stack2).resourceCountIs('AWS::SNS::Subscription', 1); + + }); + + test('fails if topic policy has no actions', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'my-stack'); + const topic = new sns.Topic(stack, 'Topic'); + + // WHEN + topic.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + principals: [new iam.ArnPrincipal('arn')], + })); + + // THEN + expect(() => app.synth()).toThrow(/A PolicyStatement must specify at least one \'action\' or \'notAction\'/); + + }); + + test('fails if topic policy has no IAM principals', () => { + // GIVEN + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'my-stack'); + const topic = new sns.Topic(stack, 'Topic'); + + // WHEN + topic.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['sns:*'], + })); + + // THEN + expect(() => app.synth()).toThrow(/A PolicyStatement used in a resource-based policy must specify at least one IAM principal/); + + }); + + test('topic policy should be set if topic as a notifications rule target', () => { + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'my-stack'); + const topic = new sns.Topic(stack, 'Topic'); + const rule = new notifications.NotificationRule(stack, 'MyNotificationRule', { + source: { + bindAsNotificationRuleSource: () => ({ + sourceArn: 'ARN', + }), + }, + events: ['codebuild-project-build-state-succeeded'], + }); + + rule.addTarget(topic); + + Template.fromStack(stack).hasResourceProperties('AWS::SNS::TopicPolicy', { + PolicyDocument: { + Version: '2012-10-17', + Statement: [{ + 'Sid': '0', + 'Action': 'sns:Publish', + 'Effect': 'Allow', + 'Principal': { 'Service': 'codestar-notifications.amazonaws.com' }, + 'Resource': { 'Ref': 'TopicBFC7AF6E' }, + }], + }, + Topics: [{ + Ref: 'TopicBFC7AF6E', + }], + }); + + + }); +}); diff --git a/packages/@aws-cdk/aws-sns/test/subscription.test.ts b/packages/aws-cdk-lib/aws-sns/test/subscription.test.ts similarity index 98% rename from packages/@aws-cdk/aws-sns/test/subscription.test.ts rename to packages/aws-cdk-lib/aws-sns/test/subscription.test.ts index 5b5797c186cc0..51354fb7d55af 100644 --- a/packages/@aws-cdk/aws-sns/test/subscription.test.ts +++ b/packages/aws-cdk-lib/aws-sns/test/subscription.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Queue } from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Queue } from '../../aws-sqs'; +import * as cdk from '../../core'; import * as sns from '../lib'; import { SubscriptionProtocol } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-sqs/.jsiirc.json b/packages/aws-cdk-lib/aws-sqs/.jsiirc.json new file mode 100644 index 0000000000000..ced7832544ae8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sqs/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.sqs" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SQS" + }, + "python": { + "module": "aws_cdk.aws_sqs" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sqs/README.md b/packages/aws-cdk-lib/aws-sqs/README.md new file mode 100644 index 0000000000000..d910cd3d96b80 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sqs/README.md @@ -0,0 +1,86 @@ +# Amazon Simple Queue Service Construct Library + + +Amazon Simple Queue Service (SQS) is a fully managed message queuing service that +enables you to decouple and scale microservices, distributed systems, and serverless +applications. SQS eliminates the complexity and overhead associated with managing and +operating message oriented middleware, and empowers developers to focus on differentiating work. +Using SQS, you can send, store, and receive messages between software components at any volume, +without losing messages or requiring other services to be available. + +## Installation + +Import to your project: + +```ts nofixture +import * as sqs from 'aws-cdk-lib/aws-sqs'; +``` + +## Basic usage + + +Here's how to add a basic queue to your application: + +```ts +new sqs.Queue(this, 'Queue'); +``` + +## Encryption + +By default queues are encrypted using SSE-SQS. If you want to change the encryption mode, set the `encryption` property. +The following encryption modes are supported: + +* KMS key that SQS manages for you +* KMS key that you can managed yourself +* Server-side encryption managed by SQS (SSE-SQS) +* Unencrypted + +To learn more about SSE-SQS on Amazon SQS, please visit the +[Amazon SQS documentation](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html). + +```ts +// Use managed key +new sqs.Queue(this, 'Queue', { + encryption: sqs.QueueEncryption.KMS_MANAGED, +}); + +// Use custom key +const myKey = new kms.Key(this, 'Key'); + +new sqs.Queue(this, 'Queue', { + encryption: sqs.QueueEncryption.KMS, + encryptionMasterKey: myKey, +}); + +// Use SQS managed server side encryption (SSE-SQS) +new sqs.Queue(this, 'Queue', { + encryption: sqs.QueueEncryption.SQS_MANAGED, +}); + +// Unencrypted queue +new sqs.Queue(this, 'Queue', { + encryption: sqs.QueueEncryption.UNENCRYPTED, +}); +``` + +## Encryption in transit + +If you want to enforce encryption of data in transit, set the `enforceSSL` property to `true`. +A resource policy statement that allows only encrypted connections over HTTPS (TLS) +will be added to the queue. + +```ts +new sqs.Queue(this, 'Queue', { + enforceSSL: true, +}); +``` + +## First-In-First-Out (FIFO) queues + +FIFO queues give guarantees on the order in which messages are dequeued, and have additional +features in order to help guarantee exactly-once processing. For more information, see +the SQS manual. Note that FIFO queues are not available in all AWS regions. + +A queue can be made a FIFO queue by either setting `fifo: true`, giving it a name which ends +in `".fifo"`, or by enabling a FIFO specific feature such as: content-based deduplication, +deduplication scope or fifo throughput limit. diff --git a/packages/aws-cdk-lib/aws-sqs/index.ts b/packages/aws-cdk-lib/aws-sqs/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sqs/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-sqs/lib/index.ts b/packages/aws-cdk-lib/aws-sqs/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-sqs/lib/index.ts rename to packages/aws-cdk-lib/aws-sqs/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-sqs/lib/policy.ts b/packages/aws-cdk-lib/aws-sqs/lib/policy.ts new file mode 100644 index 0000000000000..1ceeeaa23a424 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sqs/lib/policy.ts @@ -0,0 +1,56 @@ +import { PolicyDocument } from '../../aws-iam'; +import { Resource } from '../../core'; +import { Construct } from 'constructs'; +import { IQueue } from './queue-base'; +import { CfnQueuePolicy } from './sqs.generated'; + +/** + * Properties to associate SQS queues with a policy + */ +export interface QueuePolicyProps { + /** + * The set of queues this policy applies to. + */ + readonly queues: IQueue[]; +} + +/** + * The policy for an SQS Queue + * + * Policies define the operations that are allowed on this resource. + * + * You almost never need to define this construct directly. + * + * All AWS resources that support resource policies have a method called + * `addToResourcePolicy()`, which will automatically create a new resource + * policy if one doesn't exist yet, otherwise it will add to the existing + * policy. + * + * Prefer to use `addToResourcePolicy()` instead. + */ +export class QueuePolicy extends Resource { + /** + * The IAM policy document for this policy. + */ + public readonly document = new PolicyDocument(); + + constructor(scope: Construct, id: string, props: QueuePolicyProps) { + super(scope, id); + + new CfnQueuePolicy(this, 'Resource', { + policyDocument: this.document, + queues: props.queues.map(q => q.queueUrl), + }); + } + + /** + * Not currently supported by AWS CloudFormation. + * + * This attribute temporarily existed in CloudFormation, and then was removed again. + * + * @attribute + */ + public get queuePolicyId(): string { + throw new Error('QueuePolicy.queuePolicyId has been removed from CloudFormation'); + } +} diff --git a/packages/@aws-cdk/aws-sqs/lib/queue-base.ts b/packages/aws-cdk-lib/aws-sqs/lib/queue-base.ts similarity index 98% rename from packages/@aws-cdk/aws-sqs/lib/queue-base.ts rename to packages/aws-cdk-lib/aws-sqs/lib/queue-base.ts index 3a4f9db51291d..2a80fcc574262 100644 --- a/packages/@aws-cdk/aws-sqs/lib/queue-base.ts +++ b/packages/aws-cdk-lib/aws-sqs/lib/queue-base.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { IResource, Resource, ResourceProps } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { IResource, Resource, ResourceProps } from '../../core'; import { Construct } from 'constructs'; import { QueuePolicy } from './policy'; diff --git a/packages/@aws-cdk/aws-sqs/lib/queue.ts b/packages/aws-cdk-lib/aws-sqs/lib/queue.ts similarity index 99% rename from packages/@aws-cdk/aws-sqs/lib/queue.ts rename to packages/aws-cdk-lib/aws-sqs/lib/queue.ts index 9cd755539b308..305865a43938e 100644 --- a/packages/@aws-cdk/aws-sqs/lib/queue.ts +++ b/packages/aws-cdk-lib/aws-sqs/lib/queue.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import { Duration, RemovalPolicy, Stack, Token, ArnFormat } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { Duration, RemovalPolicy, Stack, Token, ArnFormat } from '../../core'; import { Construct } from 'constructs'; import { IQueue, QueueAttributes, QueueBase } from './queue-base'; import { CfnQueue } from './sqs.generated'; diff --git a/packages/@aws-cdk/aws-sqs/lib/validate-props.ts b/packages/aws-cdk-lib/aws-sqs/lib/validate-props.ts similarity index 97% rename from packages/@aws-cdk/aws-sqs/lib/validate-props.ts rename to packages/aws-cdk-lib/aws-sqs/lib/validate-props.ts index b988e6e7fdf9a..b8f813cabafcb 100644 --- a/packages/@aws-cdk/aws-sqs/lib/validate-props.ts +++ b/packages/aws-cdk-lib/aws-sqs/lib/validate-props.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../core'; import { QueueProps } from './index'; export function validateProps(props: QueueProps) { diff --git a/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts b/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts new file mode 100644 index 0000000000000..4e226a39ef49e --- /dev/null +++ b/packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts @@ -0,0 +1,696 @@ +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import { CfnParameter, Duration, Stack, App, Token } from '../../core'; +import * as sqs from '../lib'; + +/* eslint-disable quote-props */ + +test('default properties', () => { + const stack = new Stack(); + const q = new sqs.Queue(stack, 'Queue'); + + expect(q.fifo).toEqual(false); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); + + Template.fromStack(stack).hasResource('AWS::SQS::Queue', { + DeletionPolicy: 'Delete', + }); +}); + +test('with a dead letter queue', () => { + const stack = new Stack(); + const dlq = new sqs.Queue(stack, 'DLQ'); + const dlqProps = { queue: dlq, maxReceiveCount: 3 }; + const queue = new sqs.Queue(stack, 'Queue', { deadLetterQueue: dlqProps }); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'DLQ581697C4': { + 'Type': 'AWS::SQS::Queue', + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'RedrivePolicy': { + 'deadLetterTargetArn': { + 'Fn::GetAtt': [ + 'DLQ581697C4', + 'Arn', + ], + }, + 'maxReceiveCount': 3, + }, + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); + + expect(queue.deadLetterQueue).toEqual(dlqProps); +}); + +test('message retention period must be between 1 minute to 14 days', () => { + // GIVEN + const stack = new Stack(); + + // THEN + expect(() => new sqs.Queue(stack, 'MyQueue', { + retentionPeriod: Duration.seconds(30), + })).toThrow(/message retention period must be 60 seconds or more/); + + expect(() => new sqs.Queue(stack, 'AnotherQueue', { + retentionPeriod: Duration.days(15), + })).toThrow(/message retention period must be 1209600 seconds or less/); +}); + +test('message retention period can be provided as a parameter', () => { + // GIVEN + const stack = new Stack(); + const parameter = new CfnParameter(stack, 'my-retention-period', { + type: 'Number', + default: 30, + }); + + // WHEN + new sqs.Queue(stack, 'MyQueue', { + retentionPeriod: Duration.seconds(parameter.valueAsNumber), + }); + + // THEN + Template.fromStack(stack).templateMatches({ + 'Parameters': { + 'myretentionperiod': { + 'Type': 'Number', + 'Default': 30, + }, + }, + 'Resources': { + 'MyQueueE6CA6235': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'MessageRetentionPeriod': { + 'Ref': 'myretentionperiod', + }, + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); +}); + +test('addToPolicy will automatically create a policy for this queue', () => { + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'MyQueue'); + queue.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['sqs:*'], + principals: [new iam.ArnPrincipal('arn')], + })); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'MyQueueE6CA6235': { + 'Type': 'AWS::SQS::Queue', + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + 'MyQueuePolicy6BBEDDAC': { + 'Type': 'AWS::SQS::QueuePolicy', + 'Properties': { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': 'sqs:*', + 'Effect': 'Allow', + 'Principal': { + 'AWS': 'arn', + }, + 'Resource': '*', + }, + ], + 'Version': '2012-10-17', + }, + 'Queues': [ + { + 'Ref': 'MyQueueE6CA6235', + }, + ], + }, + }, + }, + }); +}); + +describe('export and import', () => { + test('importing works correctly', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const imports = sqs.Queue.fromQueueArn(stack, 'Imported', 'arn:aws:sqs:us-east-1:123456789012:queue1'); + + // THEN + + // "import" returns an IQueue bound to `Fn::ImportValue`s. + expect(stack.resolve(imports.queueArn)).toEqual('arn:aws:sqs:us-east-1:123456789012:queue1'); + expect(stack.resolve(imports.queueUrl)).toEqual({ + 'Fn::Join': + ['', ['https://sqs.us-east-1.', { Ref: 'AWS::URLSuffix' }, '/123456789012/queue1']], + }); + expect(stack.resolve(imports.queueName)).toEqual('queue1'); + }); + + test('importing fifo and standard queues are detected correctly', () => { + const stack = new Stack(); + const stdQueue = sqs.Queue.fromQueueArn(stack, 'StdQueue', 'arn:aws:sqs:us-east-1:123456789012:queue1'); + const fifoQueue = sqs.Queue.fromQueueArn(stack, 'FifoQueue', 'arn:aws:sqs:us-east-1:123456789012:queue2.fifo'); + expect(stdQueue.fifo).toEqual(false); + expect(fifoQueue.fifo).toEqual(true); + }); + + test('import queueArn from token, fifo and standard queues can be defined', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const stdQueue1 = sqs.Queue.fromQueueAttributes(stack, 'StdQueue1', { + queueArn: Token.asString({ Ref: 'ARN' }), + }); + const stdQueue2 = sqs.Queue.fromQueueAttributes(stack, 'StdQueue2', { + queueArn: Token.asString({ Ref: 'ARN' }), + fifo: false, + }); + const fifoQueue = sqs.Queue.fromQueueAttributes(stack, 'FifoQueue', { + queueArn: Token.asString({ Ref: 'ARN' }), + fifo: true, + }); + + // THEN + expect(stdQueue1.fifo).toEqual(false); + expect(stdQueue2.fifo).toEqual(false); + expect(fifoQueue.fifo).toEqual(true); + }); + + test('import queueArn from token, check attributes', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const stdQueue1 = sqs.Queue.fromQueueArn(stack, 'StdQueue', Token.asString({ Ref: 'ARN' })); + + // THEN + expect(stack.resolve(stdQueue1.queueArn)).toEqual({ + Ref: 'ARN', + }); + expect(stack.resolve(stdQueue1.queueName)).toEqual({ + 'Fn::Select': [5, { 'Fn::Split': [':', { Ref: 'ARN' }] }], + }); + expect(stack.resolve(stdQueue1.queueUrl)).toEqual({ + 'Fn::Join': + ['', + ['https://sqs.', + { 'Fn::Select': [3, { 'Fn::Split': [':', { Ref: 'ARN' }] }] }, + '.', + { Ref: 'AWS::URLSuffix' }, + '/', + { 'Fn::Select': [4, { 'Fn::Split': [':', { Ref: 'ARN' }] }] }, + '/', + { 'Fn::Select': [5, { 'Fn::Split': [':', { Ref: 'ARN' }] }] }]], + }); + expect(stdQueue1.fifo).toEqual(false); + }); + + test('fails if fifo flag is set for non fifo queue name', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'my-stack'); + + // THEN + expect(() => sqs.Queue.fromQueueAttributes(stack, 'ImportedStdQueue', { + queueArn: 'arn:aws:sqs:us-west-2:123456789012:queue1', + fifo: true, + })).toThrow(/FIFO queue names must end in '.fifo'/); + }); + + test('fails if fifo flag is false for fifo queue name', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'my-stack'); + + // THEN + expect(() => sqs.Queue.fromQueueAttributes(stack, 'ImportedFifoQueue', { + queueArn: 'arn:aws:sqs:us-west-2:123456789012:queue1.fifo', + fifo: false, + })).toThrow(/Non-FIFO queue name may not end in '.fifo'/); + }); + + test('importing works correctly for cross region queue', () => { + // GIVEN + const stack = new Stack(undefined, 'Stack', { env: { region: 'us-east-1' } }); + + // WHEN + const imports = sqs.Queue.fromQueueArn(stack, 'Imported', 'arn:aws:sqs:us-west-2:123456789012:queue1'); + + // THEN + + // "import" returns an IQueue bound to `Fn::ImportValue`s. + expect(stack.resolve(imports.queueArn)).toEqual('arn:aws:sqs:us-west-2:123456789012:queue1'); + expect(stack.resolve(imports.queueUrl)).toEqual({ + 'Fn::Join': + ['', ['https://sqs.us-west-2.', { Ref: 'AWS::URLSuffix' }, '/123456789012/queue1']], + }); + expect(stack.resolve(imports.queueName)).toEqual('queue1'); + }); +}); + +describe('grants', () => { + test('grantConsumeMessages', () => { + testGrant((q, p) => q.grantConsumeMessages(p), + 'sqs:ReceiveMessage', + 'sqs:ChangeMessageVisibility', + 'sqs:GetQueueUrl', + 'sqs:DeleteMessage', + 'sqs:GetQueueAttributes', + ); + }); + + test('grantSendMessages', () => { + testGrant((q, p) => q.grantSendMessages(p), + 'sqs:SendMessage', + 'sqs:GetQueueAttributes', + 'sqs:GetQueueUrl', + ); + }); + + test('grantPurge', () => { + testGrant((q, p) => q.grantPurge(p), + 'sqs:PurgeQueue', + 'sqs:GetQueueAttributes', + 'sqs:GetQueueUrl', + ); + }); + + test('grant() is general purpose', () => { + testGrant((q, p) => q.grant(p, 'service:hello', 'service:world'), + 'service:hello', + 'service:world', + ); + }); + + test('grants also work on imported queues', () => { + const stack = new Stack(); + const queue = sqs.Queue.fromQueueAttributes(stack, 'Import', { + queueArn: 'arn:aws:sqs:us-east-1:123456789012:queue1', + queueUrl: 'https://queue-url', + }); + + const user = new iam.User(stack, 'User'); + + queue.grantPurge(user); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': [ + 'sqs:PurgeQueue', + 'sqs:GetQueueAttributes', + 'sqs:GetQueueUrl', + ], + 'Effect': 'Allow', + 'Resource': 'arn:aws:sqs:us-east-1:123456789012:queue1', + }, + ], + 'Version': '2012-10-17', + }, + }); + }); +}); + +describe('queue encryption', () => { + test('encryptionMasterKey can be set to a custom KMS key', () => { + const stack = new Stack(); + + const key = new kms.Key(stack, 'CustomKey'); + const queue = new sqs.Queue(stack, 'Queue', { encryptionMasterKey: key }); + + expect(queue.encryptionMasterKey).toEqual(key); + Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { + 'KmsMasterKeyId': { 'Fn::GetAtt': ['CustomKey1E6D0D07', 'Arn'] }, + }); + }); + + test('a kms key will be allocated if encryption = kms but a master key is not specified', () => { + const stack = new Stack(); + + new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.KMS }); + + Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', Match.anyValue()); + Template.fromStack(stack).hasResourceProperties('AWS::SQS::Queue', { + 'KmsMasterKeyId': { + 'Fn::GetAtt': [ + 'QueueKey39FCBAE6', + 'Arn', + ], + }, + }); + }); + + test('it is possible to use a managed kms key', () => { + const stack = new Stack(); + + new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.KMS_MANAGED }); + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'KmsMasterKeyId': 'alias/aws/sqs', + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); + }); + + test('grant also affects key on encrypted queue', () => { + // GIVEN + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'Queue', { + encryption: sqs.QueueEncryption.KMS, + }); + const role = new iam.Role(stack, 'Role', { + assumedBy: new iam.ServicePrincipal('someone'), + }); + + // WHEN + queue.grantSendMessages(role); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': [ + 'sqs:SendMessage', + 'sqs:GetQueueAttributes', + 'sqs:GetQueueUrl', + ], + 'Effect': 'Allow', + 'Resource': { 'Fn::GetAtt': ['Queue4A7E3555', 'Arn'] }, + }, + { + 'Action': [ + 'kms:Decrypt', + 'kms:Encrypt', + 'kms:ReEncrypt*', + 'kms:GenerateDataKey*', + ], + 'Effect': 'Allow', + 'Resource': { 'Fn::GetAtt': ['QueueKey39FCBAE6', 'Arn'] }, + }, + ], + 'Version': '2012-10-17', + }, + }); + }); + + test('it is possible to use sqs managed server side encryption', () => { + const stack = new Stack(); + + new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.SQS_MANAGED }); + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'SqsManagedSseEnabled': true, + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); + }); + + test('it is possible to disable encryption (unencrypted)', () => { + const stack = new Stack(); + + new sqs.Queue(stack, 'Queue', { encryption: sqs.QueueEncryption.UNENCRYPTED }); + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'SqsManagedSseEnabled': false, + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); + }); + + test('encryptionMasterKey is not supported if encryption type SQS_MANAGED is used', () => { + // GIVEN + const stack = new Stack(); + const key = new kms.Key(stack, 'CustomKey'); + + // THEN + expect(() => new sqs.Queue(stack, 'Queue', { + encryption: sqs.QueueEncryption.SQS_MANAGED, + encryptionMasterKey: key, + })).toThrow(/'encryptionMasterKey' is not supported if encryption type 'SQS_MANAGED' is used/); + }); +}); + +describe('encryption in transit', () => { + test('enforceSSL can be enabled', () => { + const stack = new Stack(); + new sqs.Queue(stack, 'Queue', { enforceSSL: true }); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + 'QueuePolicy25439813': { + 'Type': 'AWS::SQS::QueuePolicy', + 'Properties': { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': 'sqs:*', + 'Condition': { + 'Bool': { + 'aws:SecureTransport': 'false', + }, + }, + 'Effect': 'Deny', + 'Principal': { + 'AWS': '*', + }, + 'Resource': { + 'Fn::GetAtt': [ + 'Queue4A7E3555', + 'Arn', + ], + }, + }, + ], + 'Version': '2012-10-17', + }, + }, + }, + }, + }); + }); +}); + +test('test ".fifo" suffixed queues register as fifo', () => { + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'Queue', { + queueName: 'MyQueue.fifo', + }); + + expect(queue.fifo).toEqual(true); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'QueueName': 'MyQueue.fifo', + 'FifoQueue': true, + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); +}); + +test('test a fifo queue is observed when the "fifo" property is specified', () => { + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'Queue', { + fifo: true, + }); + + expect(queue.fifo).toEqual(true); + + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'FifoQueue': true, + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); +}); + +test('test a fifo queue is observed when high throughput properties are specified', () => { + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'Queue', { + fifo: true, + fifoThroughputLimit: sqs.FifoThroughputLimit.PER_MESSAGE_GROUP_ID, + deduplicationScope: sqs.DeduplicationScope.MESSAGE_GROUP, + }); + + expect(queue.fifo).toEqual(true); + Template.fromStack(stack).templateMatches({ + 'Resources': { + 'Queue4A7E3555': { + 'Type': 'AWS::SQS::Queue', + 'Properties': { + 'DeduplicationScope': 'messageGroup', + 'FifoQueue': true, + 'FifoThroughputLimit': 'perMessageGroupId', + }, + 'UpdateReplacePolicy': 'Delete', + 'DeletionPolicy': 'Delete', + }, + }, + }); +}); + +test('test a queue throws when fifoThroughputLimit specified on non fifo queue', () => { + const stack = new Stack(); + expect(() => { + new sqs.Queue(stack, 'Queue', { + fifo: false, + fifoThroughputLimit: sqs.FifoThroughputLimit.PER_MESSAGE_GROUP_ID, + }); + }).toThrow(); +}); + +test('test a queue throws when deduplicationScope specified on non fifo queue', () => { + const stack = new Stack(); + expect(() => { + new sqs.Queue(stack, 'Queue', { + fifo: false, + deduplicationScope: sqs.DeduplicationScope.MESSAGE_GROUP, + }); + }).toThrow(); +}); + +test('test metrics', () => { + // GIVEN + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'Queue'); + + // THEN + expect(stack.resolve(queue.metricNumberOfMessagesSent())).toEqual({ + dimensions: { QueueName: { 'Fn::GetAtt': ['Queue4A7E3555', 'QueueName'] } }, + namespace: 'AWS/SQS', + metricName: 'NumberOfMessagesSent', + period: Duration.minutes(5), + statistic: 'Sum', + }); + + expect(stack.resolve(queue.metricSentMessageSize())).toEqual({ + dimensions: { QueueName: { 'Fn::GetAtt': ['Queue4A7E3555', 'QueueName'] } }, + namespace: 'AWS/SQS', + metricName: 'SentMessageSize', + period: Duration.minutes(5), + statistic: 'Average', + }); +}); + +test('fails if queue policy has no actions', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'my-stack'); + const queue = new sqs.Queue(stack, 'Queue'); + + // WHEN + queue.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + principals: [new iam.ArnPrincipal('arn')], + })); + + // THEN + expect(() => app.synth()).toThrow(/A PolicyStatement must specify at least one \'action\' or \'notAction\'/); +}); + +test('fails if queue policy has no IAM principals', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'my-stack'); + const queue = new sqs.Queue(stack, 'Queue'); + + // WHEN + queue.addToResourcePolicy(new iam.PolicyStatement({ + resources: ['*'], + actions: ['sqs:*'], + })); + + // THEN + expect(() => app.synth()).toThrow(/A PolicyStatement used in a resource-based policy must specify at least one IAM principal/); +}); + +function testGrant(action: (q: sqs.Queue, principal: iam.IPrincipal) => void, ...expectedActions: string[]) { + const stack = new Stack(); + const queue = new sqs.Queue(stack, 'MyQueue'); + const principal = new iam.User(stack, 'User'); + + action(queue, principal); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + 'PolicyDocument': { + 'Statement': [ + { + 'Action': expectedActions, + 'Effect': 'Allow', + 'Resource': { + 'Fn::GetAtt': [ + 'MyQueueE6CA6235', + 'Arn', + ], + }, + }, + ], + 'Version': '2012-10-17', + }, + }); +} diff --git a/packages/aws-cdk-lib/aws-ssm/.jsiirc.json b/packages/aws-cdk-lib/aws-ssm/.jsiirc.json new file mode 100644 index 0000000000000..50e58787c3d07 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssm/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.ssm" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.SSM" + }, + "python": { + "module": "aws_cdk.aws_ssm" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ssm/README.md b/packages/aws-cdk-lib/aws-ssm/README.md new file mode 100644 index 0000000000000..cf7ca2a243bd7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssm/README.md @@ -0,0 +1,142 @@ +# AWS Systems Manager Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Using existing SSM Parameters in your CDK app + +You can reference existing SSM Parameter Store values that you want to use in +your CDK app by using `ssm.StringParameter.fromStringParameterAttributes`: + +```ts +// Retrieve the latest value of the non-secret parameter +// with name "/My/String/Parameter". +const stringValue = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValue', { + parameterName: '/My/Public/Parameter', + // 'version' can be specified but is optional. +}).stringValue; +const stringValueVersionFromToken = ssm.StringParameter.fromStringParameterAttributes(this, 'MyValueVersionFromToken', { + parameterName: '/My/Public/Parameter', + // parameter version from token + version: parameterVersion, +}).stringValue; + +// Retrieve a specific version of the secret (SecureString) parameter. +// 'version' is always required. +const secretValue = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValue', { + parameterName: '/My/Secret/Parameter', + version: 5, +}); +const secretValueVersionFromToken = ssm.StringParameter.fromSecureStringParameterAttributes(this, 'MySecureValueVersionFromToken', { + parameterName: '/My/Secret/Parameter', + // parameter version from token + version: parameterVersion, +}); +``` + +You can also reference an existing SSM Parameter Store value that matches an +[AWS specific parameter type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html#aws-specific-parameter-types): + +```ts +ssm.StringParameter.valueForTypedStringParameterV2(stack, '/My/Public/Parameter', ssm.ParameterValueType.AWS_EC2_IMAGE_ID); +``` + +To do the same for a SSM Parameter Store value that is stored as a list: + +```ts +ssm.StringListParameter.valueForTypedListParameter(stack, '/My/Public/Parameter', ssm.ParameterValueType.AWS_EC2_IMAGE_ID); +``` + +### Lookup existing parameters + +You can also use an existing parameter by looking up the parameter from the AWS environment. +This method uses AWS API calls to lookup the value from SSM during synthesis. + +```ts +const stringValue = ssm.StringParameter.valueFromLookup(stack, '/My/Public/Parameter'); +``` + +When using `valueFromLookup` an initial value of 'dummy-value-for-${parameterName}' +(`dummy-value-for-/My/Public/Parameter` in the above example) +is returned prior to the lookup being performed. This can lead to errors if you are using this +value in places that require a certain format. For example if you have stored the ARN for a SNS +topic in a SSM Parameter which you want to lookup and provide to `Topic.fromTopicArn()` + +```ts +const arnLookup = ssm.StringParameter.valueFromLookup(this, '/my/topic/arn'); +sns.Topic.fromTopicArn(this, 'Topic', arnLookup); +``` + +Initially `arnLookup` will be equal to `dummy-value-for-/my/topic/arn` which will cause +`Topic.fromTopicArn` to throw an error indicating that the value is not in `arn` format. + +For these use cases you need to handle the `dummy-value` in your code. For example: + +```ts +const arnLookup = ssm.StringParameter.valueFromLookup(this, '/my/topic/arn'); +let arnLookupValue: string; +if (arnLookup.includes('dummy-value')) { + arnLookupValue = this.formatArn({ + service: 'sns', + resource: 'topic', + resourceName: arnLookup, + }); + +} else { + arnLookupValue = arnLookup; +} + +sns.Topic.fromTopicArn(this, 'Topic', arnLookupValue); +``` + +Alternatively, if the property supports tokens you can convert the parameter value into a token +to be resolved _after_ the lookup has been completed. + +```ts +const arnLookup = ssm.StringParameter.valueFromLookup(this, '/my/role/arn'); +iam.Role.fromRoleArn(this, 'role', Lazy.string({ produce: () => arnLookup })); +``` + +## Creating new SSM Parameters in your CDK app + +You can create either `ssm.StringParameter` or `ssm.StringListParameter`s in +a CDK app. These are public (not secret) values. Parameters of type +*SecureString* cannot be created directly from a CDK application; if you want +to provision secrets automatically, use Secrets Manager Secrets (see the +`@aws-cdk/aws-secretsmanager` package). + +```ts +new ssm.StringParameter(this, 'Parameter', { + allowedPattern: '.*', + description: 'The value Foo', + parameterName: 'FooParameter', + stringValue: 'Foo', + tier: ssm.ParameterTier.ADVANCED, +}); +``` + +```ts +// Create a new SSM Parameter holding a String +const param = new ssm.StringParameter(stack, 'StringParameter', { + // description: 'Some user-friendly description', + // name: 'ParameterName', + stringValue: 'Initial parameter value', + // allowedPattern: '.*', +}); + +// Grant read access to some Role +param.grantRead(role); + +// Create a new SSM Parameter holding a StringList +const listParameter = new ssm.StringListParameter(stack, 'StringListParameter', { + // description: 'Some user-friendly description', + // name: 'ParameterName', + stringListValue: ['Initial parameter value A', 'Initial parameter value B'], + // allowedPattern: '.*', +}); +``` + +When specifying an `allowedPattern`, the values provided as string literals +are validated against the pattern and an exception is raised if a value +provided does not comply. + diff --git a/packages/aws-cdk-lib/aws-ssm/index.ts b/packages/aws-cdk-lib/aws-ssm/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssm/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-ssm/lib/index.ts b/packages/aws-cdk-lib/aws-ssm/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-ssm/lib/index.ts rename to packages/aws-cdk-lib/aws-ssm/lib/index.ts diff --git a/packages/@aws-cdk/aws-ssm/lib/parameter.ts b/packages/aws-cdk-lib/aws-ssm/lib/parameter.ts similarity index 99% rename from packages/@aws-cdk/aws-ssm/lib/parameter.ts rename to packages/aws-cdk-lib/aws-ssm/lib/parameter.ts index cf44b574bb1ea..aa521e2262d76 100644 --- a/packages/@aws-cdk/aws-ssm/lib/parameter.ts +++ b/packages/aws-cdk-lib/aws-ssm/lib/parameter.ts @@ -1,11 +1,11 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; +import * as cxschema from '../../cloud-assembly-schema'; import { CfnDynamicReference, CfnDynamicReferenceService, CfnParameter, ContextProvider, Fn, IResource, Resource, Stack, Token, Tokenization, -} from '@aws-cdk/core'; +} from '../../core'; import { Construct } from 'constructs'; import * as ssm from './ssm.generated'; import { arnForParameterName, AUTOGEN_MARKER } from './util'; diff --git a/packages/aws-cdk-lib/aws-ssm/lib/util.ts b/packages/aws-cdk-lib/aws-ssm/lib/util.ts new file mode 100644 index 0000000000000..4b2a3f421dfb7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssm/lib/util.ts @@ -0,0 +1,71 @@ +import { ArnFormat, Stack, Token } from '../../core'; +import { IConstruct } from 'constructs'; + +export const AUTOGEN_MARKER = '$$autogen$$'; + +export interface ArnForParameterNameOptions { + readonly physicalName?: string; + readonly simpleName?: boolean; +} + +/** + * Renders an ARN for an SSM parameter given a parameter name. + * @param scope definition scope + * @param parameterName the parameter name to include in the ARN + * @param physicalName optional physical name specified by the user (to auto-detect separator) + */ +export function arnForParameterName(scope: IConstruct, parameterName: string, options: ArnForParameterNameOptions = { }): string { + const physicalName = options.physicalName; + const nameToValidate = physicalName || parameterName; + + if (!Token.isUnresolved(nameToValidate) && nameToValidate.includes('/') && !nameToValidate.startsWith('/')) { + throw new Error(`Parameter names must be fully qualified (if they include "/" they must also begin with a "/"): ${nameToValidate}`); + } + + if (isSimpleName()) { + return Stack.of(scope).formatArn({ + service: 'ssm', + resource: 'parameter', + arnFormat: ArnFormat.SLASH_RESOURCE_NAME, + resourceName: parameterName, + }); + } else { + return Stack.of(scope).formatArn({ + service: 'ssm', + resource: `parameter${parameterName}`, + }); + } + + /** + * Determines the ARN separator for this parameter: if we have a concrete + * parameter name (or explicitly defined physical name), we will parse them + * and decide whether a "/" is needed or not. Otherwise, users will have to + * explicitly specify `simpleName` when they import the ARN. + */ + function isSimpleName(): boolean { + // look for a concrete name as a hint for determining the separator + const concreteName = !Token.isUnresolved(parameterName) ? parameterName : physicalName; + if (!concreteName || Token.isUnresolved(concreteName)) { + + if (options.simpleName === undefined) { + throw new Error('Unable to determine ARN separator for SSM parameter since the parameter name is an unresolved token. Use "fromAttributes" and specify "simpleName" explicitly'); + } + + return options.simpleName; + } + + const result = !concreteName.startsWith('/'); + + // if users explicitly specify the separator and it conflicts with the one we need, it's an error. + if (options.simpleName !== undefined && options.simpleName !== result) { + + if (concreteName === AUTOGEN_MARKER) { + throw new Error('If "parameterName" is not explicitly defined, "simpleName" must be "true" or undefined since auto-generated parameter names always have simple names'); + } + + throw new Error(`Parameter name "${concreteName}" is ${result ? 'a simple name' : 'not a simple name'}, but "simpleName" was explicitly set to ${options.simpleName}. Either omit it or set it to ${result}`); + } + + return result; + } +} diff --git a/packages/@aws-cdk/aws-ssm/test/parameter-store-string.test.ts b/packages/aws-cdk-lib/aws-ssm/test/parameter-store-string.test.ts similarity index 94% rename from packages/@aws-cdk/aws-ssm/test/parameter-store-string.test.ts rename to packages/aws-cdk-lib/aws-ssm/test/parameter-store-string.test.ts index d9da8a0697535..1df89de4fdd6c 100644 --- a/packages/@aws-cdk/aws-ssm/test/parameter-store-string.test.ts +++ b/packages/aws-cdk-lib/aws-ssm/test/parameter-store-string.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ssm from '../lib'; test('can reference SSMPS string - specific version', () => { diff --git a/packages/@aws-cdk/aws-ssm/test/parameter.test.ts b/packages/aws-cdk-lib/aws-ssm/test/parameter.test.ts similarity index 99% rename from packages/@aws-cdk/aws-ssm/test/parameter.test.ts rename to packages/aws-cdk-lib/aws-ssm/test/parameter.test.ts index c33bfaa01305f..aac8f1608dd2c 100644 --- a/packages/@aws-cdk/aws-ssm/test/parameter.test.ts +++ b/packages/aws-cdk-lib/aws-ssm/test/parameter.test.ts @@ -1,11 +1,11 @@ /* eslint-disable max-len */ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as kms from '../../aws-kms'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; import * as ssm from '../lib'; import { ParameterType, ParameterValueType } from '../lib'; diff --git a/packages/@aws-cdk/aws-ssm/test/ssm-document.test.ts b/packages/aws-cdk-lib/aws-ssm/test/ssm-document.test.ts similarity index 84% rename from packages/@aws-cdk/aws-ssm/test/ssm-document.test.ts rename to packages/aws-cdk-lib/aws-ssm/test/ssm-document.test.ts index ba57c2ed0e4a3..7e66e4426ce88 100644 --- a/packages/@aws-cdk/aws-ssm/test/ssm-document.test.ts +++ b/packages/aws-cdk-lib/aws-ssm/test/ssm-document.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cdk from '../../core'; import * as ssm from '../lib'; test('association name is rendered properly in L1 construct', () => { diff --git a/packages/aws-cdk-lib/aws-ssm/test/util.test.ts b/packages/aws-cdk-lib/aws-ssm/test/util.test.ts new file mode 100644 index 0000000000000..3da0f713ea952 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssm/test/util.test.ts @@ -0,0 +1,57 @@ +/* eslint-disable max-len */ + +import { Stack, Token } from '../../core'; +import { arnForParameterName } from '../lib/util'; + +describe('arnForParameterName', () => { + describe('simple names', () => { + test('concrete parameterName and no physical name (sep is "/")', () => { + const stack = new Stack(); + expect(stack.resolve(arnForParameterName(stack, 'myParam', undefined))).toEqual({ + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/myParam']], + }); + }); + + test('token parameterName and concrete physical name (no additional "/")', () => { + const stack = new Stack(); + expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { physicalName: 'myParam' }))).toEqual({ + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/', { Ref: 'Boom' }]], + }); + }); + + test('token parameterName, explicit "/" separator', () => { + const stack = new Stack(); + expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { simpleName: true }))).toEqual({ + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/', { Ref: 'Boom' }]], + }); + }); + }); + + describe('path names', () => { + test('concrete parameterName and no physical name (sep is "/")', () => { + const stack = new Stack(); + expect(stack.resolve(arnForParameterName(stack, '/foo/bar', undefined))).toEqual({ + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter/foo/bar']], + }); + }); + + test('token parameterName and concrete physical name (no sep)', () => { + const stack = new Stack(); + expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { physicalName: '/foo/bar' }))).toEqual({ + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter', { Ref: 'Boom' }]], + }); + }); + + test('token parameterName, explicit "" separator', () => { + const stack = new Stack(); + expect(stack.resolve(arnForParameterName(stack, Token.asString({ Ref: 'Boom' }), { simpleName: false }))).toEqual({ + 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':ssm:', { Ref: 'AWS::Region' }, ':', { Ref: 'AWS::AccountId' }, ':parameter', { Ref: 'Boom' }]], + }); + }); + }); + + test('fails if explicit separator is not defined and parameterName is a token', () => { + const stack = new Stack(); + expect(() => arnForParameterName(stack, Token.asString({ Ref: 'Boom' }))).toThrow(/Unable to determine ARN separator for SSM parameter since the parameter name is an unresolved token. Use "fromAttributes" and specify "simpleName" explicitly/); + }); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-ssmcontacts/.jsiirc.json b/packages/aws-cdk-lib/aws-ssmcontacts/.jsiirc.json new file mode 100644 index 0000000000000..ccffbaf8ec251 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmcontacts/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SSMContacts" + }, + "java": { + "package": "software.amazon.awscdk.services.ssmcontacts" + }, + "python": { + "module": "aws_cdk.aws_ssmcontacts" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ssmcontacts/README.md b/packages/aws-cdk-lib/aws-ssmcontacts/README.md new file mode 100644 index 0000000000000..d187b70070e1e --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmcontacts/README.md @@ -0,0 +1,27 @@ +# AWS::SSMContacts Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as ssmcontacts from 'aws-cdk-lib/aws-ssmcontacts'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SSMContacts construct libraries](https://constructs.dev/search?q=ssmcontacts) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SSMContacts resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMContacts.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SSMContacts](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMContacts.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-ssmcontacts/index.ts b/packages/aws-cdk-lib/aws-ssmcontacts/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmcontacts/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-ssmcontacts/lib/index.ts b/packages/aws-cdk-lib/aws-ssmcontacts/lib/index.ts new file mode 100644 index 0000000000000..5c768591b193f --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmcontacts/lib/index.ts @@ -0,0 +1 @@ +export * from './ssmcontacts.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-ssmincidents/.jsiirc.json b/packages/aws-cdk-lib/aws-ssmincidents/.jsiirc.json new file mode 100644 index 0000000000000..1bd9506e7bbbb --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmincidents/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SSMIncidents" + }, + "java": { + "package": "software.amazon.awscdk.services.ssmincidents" + }, + "python": { + "module": "aws_cdk.aws_ssmincidents" + } + } +} diff --git a/packages/aws-cdk-lib/aws-ssmincidents/README.md b/packages/aws-cdk-lib/aws-ssmincidents/README.md new file mode 100644 index 0000000000000..e4abe4d5f430a --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmincidents/README.md @@ -0,0 +1,27 @@ +# AWS::SSMIncidents Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as ssmincidents from 'aws-cdk-lib/aws-ssmincidents'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SSMIncidents construct libraries](https://constructs.dev/search?q=ssmincidents) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SSMIncidents resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMIncidents.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SSMIncidents](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSMIncidents.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-ssmincidents/index.ts b/packages/aws-cdk-lib/aws-ssmincidents/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmincidents/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-ssmincidents/lib/index.ts b/packages/aws-cdk-lib/aws-ssmincidents/lib/index.ts new file mode 100644 index 0000000000000..fbb392081f823 --- /dev/null +++ b/packages/aws-cdk-lib/aws-ssmincidents/lib/index.ts @@ -0,0 +1 @@ +export * from './ssmincidents.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-sso/.jsiirc.json b/packages/aws-cdk-lib/aws-sso/.jsiirc.json new file mode 100644 index 0000000000000..dbe79844028e5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sso/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SSO" + }, + "java": { + "package": "software.amazon.awscdk.services.sso" + }, + "python": { + "module": "aws_cdk.aws_sso" + } + } +} diff --git a/packages/aws-cdk-lib/aws-sso/README.md b/packages/aws-cdk-lib/aws-sso/README.md new file mode 100644 index 0000000000000..5a8f38f9b2e4e --- /dev/null +++ b/packages/aws-cdk-lib/aws-sso/README.md @@ -0,0 +1,27 @@ +# AWS::SSO Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as sso from 'aws-cdk-lib/aws-sso'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SSO construct libraries](https://constructs.dev/search?q=sso) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SSO resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSO.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SSO](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SSO.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-sso/index.ts b/packages/aws-cdk-lib/aws-sso/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-sso/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-sso/lib/index.ts b/packages/aws-cdk-lib/aws-sso/lib/index.ts new file mode 100644 index 0000000000000..4ff310a67a081 --- /dev/null +++ b/packages/aws-cdk-lib/aws-sso/lib/index.ts @@ -0,0 +1 @@ +export * from './sso.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/.jsiirc.json b/packages/aws-cdk-lib/aws-stepfunctions-tasks/.jsiirc.json new file mode 100644 index 0000000000000..6647940950def --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.stepfunctions.tasks" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.StepFunctions.Tasks" + }, + "python": { + "module": "aws_cdk.aws_stepfunctions_tasks" + } + } +} diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md b/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md new file mode 100644 index 0000000000000..c17cc5d45ce1b --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md @@ -0,0 +1,1306 @@ +# Tasks for AWS Step Functions + + +[AWS Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) is a web service that enables you to coordinate the +components of distributed applications and microservices using visual workflows. +You build applications from individual components that each perform a discrete +function, or task, allowing you to scale and change applications quickly. + +A [Task](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html) state represents a single unit of work performed by a state machine. +All work in your state machine is performed by tasks. This module contains a collection of classes that allow you to call various AWS services +from your Step Functions state machine. + +Be sure to familiarize yourself with the [`aws-stepfunctions` module documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions-readme.html) first. + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Table Of Contents + +- [Tasks for AWS Step Functions](#tasks-for-aws-step-functions) + - [Table Of Contents](#table-of-contents) + - [Evaluate Expression](#evaluate-expression) + - [API Gateway](#api-gateway) + - [Call REST API Endpoint](#call-rest-api-endpoint) + - [Call HTTP API Endpoint](#call-http-api-endpoint) + - [AWS SDK](#aws-sdk) + - [Athena](#athena) + - [StartQueryExecution](#startqueryexecution) + - [GetQueryExecution](#getqueryexecution) + - [GetQueryResults](#getqueryresults) + - [StopQueryExecution](#stopqueryexecution) + - [Batch](#batch) + - [SubmitJob](#submitjob) + - [CodeBuild](#codebuild) + - [StartBuild](#startbuild) + - [DynamoDB](#dynamodb) + - [GetItem](#getitem) + - [PutItem](#putitem) + - [DeleteItem](#deleteitem) + - [UpdateItem](#updateitem) + - [ECS](#ecs) + - [RunTask](#runtask) + - [EC2](#ec2) + - [Fargate](#fargate) + - [EMR](#emr) + - [Create Cluster](#create-cluster) + - [Termination Protection](#termination-protection) + - [Terminate Cluster](#terminate-cluster) + - [Add Step](#add-step) + - [Cancel Step](#cancel-step) + - [Modify Instance Fleet](#modify-instance-fleet) + - [Modify Instance Group](#modify-instance-group) + - [EMR on EKS](#emr-on-eks) + - [Create Virtual Cluster](#create-virtual-cluster) + - [Delete Virtual Cluster](#delete-virtual-cluster) + - [Start Job Run](#start-job-run) + - [EKS](#eks) + - [Call](#call) + - [EventBridge](#eventbridge) + - [Put Events](#put-events) + - [Glue](#glue) + - [Glue DataBrew](#glue-databrew) + - [Lambda](#lambda) + - [SageMaker](#sagemaker) + - [Create Training Job](#create-training-job) + - [Create Transform Job](#create-transform-job) + - [Create Endpoint](#create-endpoint) + - [Create Endpoint Config](#create-endpoint-config) + - [Create Model](#create-model) + - [Update Endpoint](#update-endpoint) + - [SNS](#sns) + - [Step Functions](#step-functions) + - [Start Execution](#start-execution) + - [Invoke Activity](#invoke-activity) + - [SQS](#sqs) + +## Paths + +Learn more about input and output processing in Step Functions [here](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html) + +## Evaluate Expression + +Use the `EvaluateExpression` to perform simple operations referencing state paths. The +`expression` referenced in the task will be evaluated in a Lambda function +(`eval()`). This allows you to not have to write Lambda code for simple operations. + +Example: convert a wait time from milliseconds to seconds, concat this in a message and wait: + +```ts +const convertToSeconds = new tasks.EvaluateExpression(this, 'Convert to seconds', { + expression: '$.waitMilliseconds / 1000', + resultPath: '$.waitSeconds', +}); + +const createMessage = new tasks.EvaluateExpression(this, 'Create message', { + // Note: this is a string inside a string. + expression: '`Now waiting ${$.waitSeconds} seconds...`', + runtime: lambda.Runtime.NODEJS_14_X, + resultPath: '$.message', +}); + +const publishMessage = new tasks.SnsPublish(this, 'Publish message', { + topic: new sns.Topic(this, 'cool-topic'), + message: sfn.TaskInput.fromJsonPathAt('$.message'), + resultPath: '$.sns', +}); + +const wait = new sfn.Wait(this, 'Wait', { + time: sfn.WaitTime.secondsPath('$.waitSeconds'), +}); + +new sfn.StateMachine(this, 'StateMachine', { + definition: convertToSeconds + .next(createMessage) + .next(publishMessage) + .next(wait), +}); +``` + +The `EvaluateExpression` supports a `runtime` prop to specify the Lambda +runtime to use to evaluate the expression. Currently, only runtimes +of the Node.js family are supported. + +## API Gateway + +Step Functions supports [API Gateway](https://docs.aws.amazon.com/step-functions/latest/dg/connect-api-gateway.html) through the service integration pattern. + +HTTP APIs are designed for low-latency, cost-effective integrations with AWS services, including AWS Lambda, and HTTP endpoints. +HTTP APIs support OIDC and OAuth 2.0 authorization, and come with built-in support for CORS and automatic deployments. +Previous-generation REST APIs currently offer more features. More details can be found [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html). + +### Call REST API Endpoint + +The `CallApiGatewayRestApiEndpoint` calls the REST API endpoint. + +```ts +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +const restApi = new apigateway.RestApi(this, 'MyRestApi'); + +const invokeTask = new tasks.CallApiGatewayRestApiEndpoint(this, 'Call REST API', { + api: restApi, + stageName: 'prod', + method: tasks.HttpMethod.GET, +}); +``` + +Be aware that the header values must be arrays. When passing the Task Token +in the headers field `WAIT_FOR_TASK_TOKEN` integration, use +`JsonPath.array()` to wrap the token in an array: + +```ts +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +declare const api: apigateway.RestApi; + +new tasks.CallApiGatewayRestApiEndpoint(this, 'Endpoint', { + api, + stageName: 'Stage', + method: tasks.HttpMethod.PUT, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + headers: sfn.TaskInput.fromObject({ + TaskToken: sfn.JsonPath.array(sfn.JsonPath.taskToken), + }), +}); +``` + +### Call HTTP API Endpoint + +The `CallApiGatewayHttpApiEndpoint` calls the HTTP API endpoint. + +```ts +import * as apigatewayv2 from 'aws-cdk-lib/aws-apigatewayv2'; +const httpApi = new apigatewayv2.HttpApi(this, 'MyHttpApi'); + +const invokeTask = new tasks.CallApiGatewayHttpApiEndpoint(this, 'Call HTTP API', { + apiId: httpApi.apiId, + apiStack: Stack.of(httpApi), + method: tasks.HttpMethod.GET, +}); +``` + +### AWS SDK + +Step Functions supports calling [AWS service's API actions](https://docs.aws.amazon.com/step-functions/latest/dg/supported-services-awssdk.html) +through the service integration pattern. + +You can use Step Functions' AWS SDK integrations to call any of the over two hundred AWS services +directly from your state machine, giving you access to over nine thousand API actions. + +```ts +declare const myBucket: s3.Bucket; +const getObject = new tasks.CallAwsService(this, 'GetObject', { + service: 's3', + action: 'getObject', + parameters: { + Bucket: myBucket.bucketName, + Key: sfn.JsonPath.stringAt('$.key') + }, + iamResources: [myBucket.arnForObjects('*')], +}); +``` + +Use camelCase for actions and PascalCase for parameter names. + +The task automatically adds an IAM statement to the state machine role's policy based on the +service and action called. The resources for this statement must be specified in `iamResources`. + +Use the `iamAction` prop to manually specify the IAM action name in the case where the IAM +action name does not match with the API service/action name: + +```ts +const listBuckets = new tasks.CallAwsService(this, 'ListBuckets', { + service: 's3', + action: 'listBuckets', + iamResources: ['*'], + iamAction: 's3:ListAllMyBuckets', +}); +``` + +Use the `additionalIamStatements` prop to pass additional IAM statements that will be added to the +state machine role's policy. Use it in the case where the call requires more than a single statement +to be executed: + +```ts +const detectLabels = new tasks.CallAwsService(this, 'DetectLabels', { + service: 'rekognition', + action: 'detectLabels', + iamResources: ['*'], + additionalIamStatements: [ + new iam.PolicyStatement({ + actions: ['s3:getObject'], + resources: ['arn:aws:s3:::my-bucket/*'], + }), + ], +}); +``` + +## Athena + +Step Functions supports [Athena](https://docs.aws.amazon.com/step-functions/latest/dg/connect-athena.html) through the service integration pattern. + +### StartQueryExecution + +The [StartQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_StartQueryExecution.html) API runs the SQL query statement. + +```ts +const startQueryExecutionJob = new tasks.AthenaStartQueryExecution(this, 'Start Athena Query', { + queryString: sfn.JsonPath.stringAt('$.queryString'), + queryExecutionContext: { + databaseName: 'mydatabase', + }, + resultConfiguration: { + encryptionConfiguration: { + encryptionOption: tasks.EncryptionOption.S3_MANAGED, + }, + outputLocation: { + bucketName: 'query-results-bucket', + objectKey: 'folder', + }, + }, +}); +``` + +### GetQueryExecution + +The [GetQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html) API gets information about a single execution of a query. + +```ts +const getQueryExecutionJob = new tasks.AthenaGetQueryExecution(this, 'Get Query Execution', { + queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), +}); +``` + +### GetQueryResults + +The [GetQueryResults](https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryResults.html) API that streams the results of a single query execution specified by QueryExecutionId from S3. + +```ts +const getQueryResultsJob = new tasks.AthenaGetQueryResults(this, 'Get Query Results', { + queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), +}); +``` + +### StopQueryExecution + +The [StopQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_StopQueryExecution.html) API that stops a query execution. + +```ts +const stopQueryExecutionJob = new tasks.AthenaStopQueryExecution(this, 'Stop Query Execution', { + queryExecutionId: sfn.JsonPath.stringAt('$.QueryExecutionId'), +}); +``` + +## Batch + +Step Functions supports [Batch](https://docs.aws.amazon.com/step-functions/latest/dg/connect-batch.html) through the service integration pattern. + +### SubmitJob + +The [SubmitJob](https://docs.aws.amazon.com/batch/latest/APIReference/API_SubmitJob.html) API submits an AWS Batch job from a job definition. + +```ts +import * as batch from 'aws-cdk-lib/aws-batch'; +declare const batchJobDefinition: batch.JobDefinition; +declare const batchQueue: batch.JobQueue; + +const task = new tasks.BatchSubmitJob(this, 'Submit Job', { + jobDefinitionArn: batchJobDefinition.jobDefinitionArn, + jobName: 'MyJob', + jobQueueArn: batchQueue.jobQueueArn, +}); +``` + +## CodeBuild + +Step Functions supports [CodeBuild](https://docs.aws.amazon.com/step-functions/latest/dg/connect-codebuild.html) through the service integration pattern. + +### StartBuild + +[StartBuild](https://docs.aws.amazon.com/codebuild/latest/APIReference/API_StartBuild.html) starts a CodeBuild Project by Project Name. + +```ts +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; + +const codebuildProject = new codebuild.Project(this, 'Project', { + projectName: 'MyTestProject', + buildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + phases: { + build: { + commands: [ + 'echo "Hello, CodeBuild!"', + ], + }, + }, + }), +}); + +const task = new tasks.CodeBuildStartBuild(this, 'Task', { + project: codebuildProject, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + environmentVariablesOverride: { + ZONE: { + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + value: sfn.JsonPath.stringAt('$.envVariables.zone'), + }, + }, +}); +``` + +## DynamoDB + +You can call DynamoDB APIs from a `Task` state. +Read more about calling DynamoDB APIs [here](https://docs.aws.amazon.com/step-functions/latest/dg/connect-ddb.html) + +### GetItem + +The [GetItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html) operation returns a set of attributes for the item with the given primary key. + +```ts +declare const myTable: dynamodb.Table; +new tasks.DynamoGetItem(this, 'Get Item', { + key: { messageId: tasks.DynamoAttributeValue.fromString('message-007') }, + table: myTable, +}); +``` + +### PutItem + +The [PutItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html) operation creates a new item, or replaces an old item with a new item. + +```ts +declare const myTable: dynamodb.Table; +new tasks.DynamoPutItem(this, 'PutItem', { + item: { + MessageId: tasks.DynamoAttributeValue.fromString('message-007'), + Text: tasks.DynamoAttributeValue.fromString(sfn.JsonPath.stringAt('$.bar')), + TotalCount: tasks.DynamoAttributeValue.fromNumber(10), + }, + table: myTable, +}); +``` + +### DeleteItem + +The [DeleteItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html) operation deletes a single item in a table by primary key. + +```ts +declare const myTable: dynamodb.Table; +new tasks.DynamoDeleteItem(this, 'DeleteItem', { + key: { MessageId: tasks.DynamoAttributeValue.fromString('message-007') }, + table: myTable, + resultPath: sfn.JsonPath.DISCARD, +}); +``` + +### UpdateItem + +The [UpdateItem](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html) operation edits an existing item's attributes, or adds a new item +to the table if it does not already exist. + +```ts +declare const myTable: dynamodb.Table; +new tasks.DynamoUpdateItem(this, 'UpdateItem', { + key: { + MessageId: tasks.DynamoAttributeValue.fromString('message-007') + }, + table: myTable, + expressionAttributeValues: { + ':val': tasks.DynamoAttributeValue.numberFromString(sfn.JsonPath.stringAt('$.Item.TotalCount.N')), + ':rand': tasks.DynamoAttributeValue.fromNumber(20), + }, + updateExpression: 'SET TotalCount = :val + :rand', +}); +``` + +## ECS + +Step Functions supports [ECS/Fargate](https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html) through the service integration pattern. + +### RunTask + +[RunTask](https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html) starts a new task using the specified task definition. + +#### EC2 + +The EC2 launch type allows you to run your containerized applications on a cluster +of Amazon EC2 instances that you manage. + +When a task that uses the EC2 launch type is launched, Amazon ECS must determine where +to place the task based on the requirements specified in the task definition, such as +CPU and memory. Similarly, when you scale down the task count, Amazon ECS must determine +which tasks to terminate. You can apply task placement strategies and constraints to +customize how Amazon ECS places and terminates tasks. Learn more about [task placement](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement.html) + +The latest ACTIVE revision of the passed task definition is used for running the task. + +The following example runs a job from a task definition on EC2 + +```ts +const vpc = ec2.Vpc.fromLookup(this, 'Vpc', { + isDefault: true, +}); + +const cluster = new ecs.Cluster(this, 'Ec2Cluster', { vpc }); +cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro'), + vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, +}); + +const taskDefinition = new ecs.TaskDefinition(this, 'TD', { + compatibility: ecs.Compatibility.EC2, +}); + +taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('foo/bar'), + memoryLimitMiB: 256, +}); + +const runTask = new tasks.EcsRunTask(this, 'Run', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + cluster, + taskDefinition, + launchTarget: new tasks.EcsEc2LaunchTarget({ + placementStrategies: [ + ecs.PlacementStrategy.spreadAcrossInstances(), + ecs.PlacementStrategy.packedByCpu(), + ecs.PlacementStrategy.randomly(), + ], + placementConstraints: [ + ecs.PlacementConstraint.memberOf('blieptuut'), + ], + }), +}); +``` + +#### Fargate + +AWS Fargate is a serverless compute engine for containers that works with Amazon +Elastic Container Service (ECS). Fargate makes it easy for you to focus on building +your applications. Fargate removes the need to provision and manage servers, lets you +specify and pay for resources per application, and improves security through application +isolation by design. Learn more about [Fargate](https://aws.amazon.com/fargate/) + +The Fargate launch type allows you to run your containerized applications without the need +to provision and manage the backend infrastructure. Just register your task definition and +Fargate launches the container for you. The latest ACTIVE revision of the passed +task definition is used for running the task. Learn more about +[Fargate Versioning](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTaskDefinition.html) + +The following example runs a job from a task definition on Fargate + +```ts +const vpc = ec2.Vpc.fromLookup(this, 'Vpc', { + isDefault: true, +}); + +const cluster = new ecs.Cluster(this, 'FargateCluster', { vpc }); + +const taskDefinition = new ecs.TaskDefinition(this, 'TD', { + memoryMiB: '512', + cpu: '256', + compatibility: ecs.Compatibility.FARGATE, +}); + +const containerDefinition = taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('foo/bar'), + memoryLimitMiB: 256, +}); + +const runTask = new tasks.EcsRunTask(this, 'RunFargate', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + cluster, + taskDefinition, + assignPublicIp: true, + containerOverrides: [{ + containerDefinition, + environment: [{ name: 'SOME_KEY', value: sfn.JsonPath.stringAt('$.SomeKey') }], + }], + launchTarget: new tasks.EcsFargateLaunchTarget(), +}); +``` + +## EMR + +Step Functions supports Amazon EMR through the service integration pattern. +The service integration APIs correspond to Amazon EMR APIs but differ in the +parameters that are used. + +[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr.html) about the differences when using these service integrations. + +### Create Cluster + +Creates and starts running a cluster (job flow). +Corresponds to the [`runJobFlow`](https://docs.aws.amazon.com/emr/latest/APIReference/API_RunJobFlow.html) API in EMR. + +```ts +const clusterRole = new iam.Role(this, 'ClusterRole', { + assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), +}); + +const serviceRole = new iam.Role(this, 'ServiceRole', { + assumedBy: new iam.ServicePrincipal('elasticmapreduce.amazonaws.com'), +}); + +const autoScalingRole = new iam.Role(this, 'AutoScalingRole', { + assumedBy: new iam.ServicePrincipal('elasticmapreduce.amazonaws.com'), +}); + +autoScalingRole.assumeRolePolicy?.addStatements( + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + principals: [ + new iam.ServicePrincipal('application-autoscaling.amazonaws.com'), + ], + actions: [ + 'sts:AssumeRole', + ], + })); +) + +new tasks.EmrCreateCluster(this, 'Create Cluster', { + instances: {}, + clusterRole, + name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value, + serviceRole, + autoScalingRole, +}); +``` + +If you want to run multiple steps in [parallel](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-concurrent-steps.html), +you can specify the `stepConcurrencyLevel` property. The concurrency range is between 1 +and 256 inclusive, where the default concurrency of 1 means no step concurrency is allowed. +`stepConcurrencyLevel` requires the EMR release label to be 5.28.0 or above. + +```ts +new tasks.EmrCreateCluster(this, 'Create Cluster', { + instances: {}, + name: sfn.TaskInput.fromJsonPathAt('$.ClusterName').value, + stepConcurrencyLevel: 10, +}); +``` + +### Termination Protection + +Locks a cluster (job flow) so the EC2 instances in the cluster cannot be +terminated by user intervention, an API call, or a job-flow error. + +Corresponds to the [`setTerminationProtection`](https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr.html) API in EMR. + +```ts +new tasks.EmrSetClusterTerminationProtection(this, 'Task', { + clusterId: 'ClusterId', + terminationProtected: false, +}); +``` + +### Terminate Cluster + +Shuts down a cluster (job flow). +Corresponds to the [`terminateJobFlows`](https://docs.aws.amazon.com/emr/latest/APIReference/API_TerminateJobFlows.html) API in EMR. + +```ts +new tasks.EmrTerminateCluster(this, 'Task', { + clusterId: 'ClusterId', +}); +``` + +### Add Step + +Adds a new step to a running cluster. +Corresponds to the [`addJobFlowSteps`](https://docs.aws.amazon.com/emr/latest/APIReference/API_AddJobFlowSteps.html) API in EMR. + +```ts +new tasks.EmrAddStep(this, 'Task', { + clusterId: 'ClusterId', + name: 'StepName', + jar: 'Jar', + actionOnFailure: tasks.ActionOnFailure.CONTINUE, +}); +``` + +### Cancel Step + +Cancels a pending step in a running cluster. +Corresponds to the [`cancelSteps`](https://docs.aws.amazon.com/emr/latest/APIReference/API_CancelSteps.html) API in EMR. + +```ts +new tasks.EmrCancelStep(this, 'Task', { + clusterId: 'ClusterId', + stepId: 'StepId', +}); +``` + +### Modify Instance Fleet + +Modifies the target On-Demand and target Spot capacities for the instance +fleet with the specified InstanceFleetName. + +Corresponds to the [`modifyInstanceFleet`](https://docs.aws.amazon.com/emr/latest/APIReference/API_ModifyInstanceFleet.html) API in EMR. + +```ts +new tasks.EmrModifyInstanceFleetByName(this, 'Task', { + clusterId: 'ClusterId', + instanceFleetName: 'InstanceFleetName', + targetOnDemandCapacity: 2, + targetSpotCapacity: 0, +}); +``` + +### Modify Instance Group + +Modifies the number of nodes and configuration settings of an instance group. + +Corresponds to the [`modifyInstanceGroups`](https://docs.aws.amazon.com/emr/latest/APIReference/API_ModifyInstanceGroups.html) API in EMR. + +```ts +new tasks.EmrModifyInstanceGroupByName(this, 'Task', { + clusterId: 'ClusterId', + instanceGroupName: sfn.JsonPath.stringAt('$.InstanceGroupName'), + instanceGroup: { + instanceCount: 1, + }, +}); +``` + +## EMR on EKS + +Step Functions supports Amazon EMR on EKS through the service integration pattern. +The service integration APIs correspond to Amazon EMR on EKS APIs, but differ in the parameters that are used. + +[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr-eks.html) about the differences when using these service integrations. + +[Setting up](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up.html) the EKS cluster is required. + +### Create Virtual Cluster + +The [CreateVirtualCluster](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_CreateVirtualCluster.html) API creates a single virtual cluster that's mapped to a single Kubernetes namespace. + +The EKS cluster containing the Kubernetes namespace where the virtual cluster will be mapped can be passed in from the task input. + +```ts +new tasks.EmrContainersCreateVirtualCluster(this, 'Create a Virtual Cluster', { + eksCluster: tasks.EksClusterInput.fromTaskInput(sfn.TaskInput.fromText('clusterId')), +}); +``` + +The EKS cluster can also be passed in directly. + +```ts +import * as eks from 'aws-cdk-lib/aws-eks'; + +declare const eksCluster: eks.Cluster; + +new tasks.EmrContainersCreateVirtualCluster(this, 'Create a Virtual Cluster', { + eksCluster: tasks.EksClusterInput.fromCluster(eksCluster), +}); +``` + +By default, the Kubernetes namespace that a virtual cluster maps to is "default", but a specific namespace within an EKS cluster can be selected. + +```ts +new tasks.EmrContainersCreateVirtualCluster(this, 'Create a Virtual Cluster', { + eksCluster: tasks.EksClusterInput.fromTaskInput(sfn.TaskInput.fromText('clusterId')), + eksNamespace: 'specified-namespace', +}); +``` + +### Delete Virtual Cluster + +The [DeleteVirtualCluster](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_DeleteVirtualCluster.html) API deletes a virtual cluster. + +```ts +new tasks.EmrContainersDeleteVirtualCluster(this, 'Delete a Virtual Cluster', { + virtualClusterId: sfn.TaskInput.fromJsonPathAt('$.virtualCluster'), +}); +``` + +### Start Job Run + +The [StartJobRun](https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_StartJobRun.html) API starts a job run. A job is a unit of work that you submit to Amazon EMR on EKS for execution. The work performed by the job can be defined by a Spark jar, PySpark script, or SparkSQL query. A job run is an execution of the job on the virtual cluster. + +Required setup: + + - If not done already, follow the [steps](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up.html) to setup EMR on EKS and [create an EKS Cluster](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-eks-readme.html#quick-start). + - Enable [Cluster access](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-cluster-access.html) + - Enable [IAM Role access](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-enable-IAM.html) + +The following actions must be performed if the virtual cluster ID is supplied from the task input. Otherwise, if it is supplied statically in the state machine definition, these actions will be done automatically. + + - Create an [IAM role](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html) + - Update the [Role Trust Policy](https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-trust-policy.html) of the Job Execution Role. + +The job can be configured with spark submit parameters: + +```ts +new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { + virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), + releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', + }, + }, +}); +``` + +Configuring the job can also be done via application configuration: + +```ts +new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { + virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), + releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, + jobName: 'EMR-Containers-Job', + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + }, + }, + applicationConfig: [{ + classification: tasks.Classification.SPARK_DEFAULTS, + properties: { + 'spark.executor.instances': '1', + 'spark.executor.memory': '512M', + }, + }], +}); +``` + +Job monitoring can be enabled if `monitoring.logging` is set true. This automatically generates an S3 bucket and CloudWatch logs. + +```ts +new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { + virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), + releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', + }, + }, + monitoring: { + logging: true, + }, +}); +``` + +Otherwise, providing monitoring for jobs with existing log groups and log buckets is also available. + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; + +const logGroup = new logs.LogGroup(this, 'Log Group'); +const logBucket = new s3.Bucket(this, 'S3 Bucket') + +new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { + virtualCluster: tasks.VirtualClusterInput.fromVirtualClusterId('de92jdei2910fwedz'), + releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', + }, + }, + monitoring: { + logGroup: logGroup, + logBucket: logBucket, + }, +}); +``` + +Users can provide their own existing Job Execution Role. + +```ts +new tasks.EmrContainersStartJobRun(this, 'EMR Containers Start Job Run', { + virtualCluster:tasks.VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.VirtualClusterId')), + releaseLabel: tasks.ReleaseLabel.EMR_6_2_0, + jobName: 'EMR-Containers-Job', + executionRole: iam.Role.fromRoleArn(this, 'Job-Execution-Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + sparkSubmitParameters: '--conf spark.executor.instances=2 --conf spark.executor.memory=2G --conf spark.executor.cores=2 --conf spark.driver.cores=1', + }, + }, +}); +``` + +## EKS + +Step Functions supports Amazon EKS through the service integration pattern. +The service integration APIs correspond to Amazon EKS APIs. + +[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html) about the differences when using these service integrations. + +### Call + +Read and write Kubernetes resource objects via a Kubernetes API endpoint. +Corresponds to the [`call`](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eks.html) API in Step Functions Connector. + +The following code snippet includes a Task state that uses eks:call to list the pods. + +```ts +import * as eks from 'aws-cdk-lib/aws-eks'; + +const myEksCluster = new eks.Cluster(this, 'my sample cluster', { + version: eks.KubernetesVersion.V1_18, + clusterName: 'myEksCluster', +}); + +new tasks.EksCall(this, 'Call a EKS Endpoint', { + cluster: myEksCluster, + httpMethod: tasks.HttpMethods.GET, + httpPath: '/api/v1/namespaces/default/pods', +}); +``` + +## EventBridge + +Step Functions supports Amazon EventBridge through the service integration pattern. +The service integration APIs correspond to Amazon EventBridge APIs. + +[Read more](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eventbridge.html) about the differences when using these service integrations. + +### Put Events + +Send events to an EventBridge bus. +Corresponds to the [`put-events`](https://docs.aws.amazon.com/step-functions/latest/dg/connect-eventbridge.html) API in Step Functions Connector. + +The following code snippet includes a Task state that uses events:putevents to send an event to the default bus. + +```ts +import * as events from 'aws-cdk-lib/aws-events'; + +const myEventBus = new events.EventBus(this, 'EventBus', { + eventBusName: 'MyEventBus1', +}); + +new tasks.EventBridgePutEvents(this, 'Send an event to EventBridge', { + entries: [{ + detail: sfn.TaskInput.fromObject({ + Message: 'Hello from Step Functions!', + }), + eventBus: myEventBus, + detailType: 'MessageFromStepFunctions', + source: 'step.functions', + }], +}); +``` + +## Glue + +Step Functions supports [AWS Glue](https://docs.aws.amazon.com/step-functions/latest/dg/connect-glue.html) through the service integration pattern. + +You can call the [`StartJobRun`](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html#aws-glue-api-jobs-runs-StartJobRun) API from a `Task` state. + +```ts +new tasks.GlueStartJobRun(this, 'Task', { + glueJobName: 'my-glue-job', + arguments: sfn.TaskInput.fromObject({ + key: 'value', + }), + taskTimeout: sfn.Timeout.duration(Duration.minutes(30)), + notifyDelayAfter: Duration.minutes(5), +}); +``` + +## Glue DataBrew + +Step Functions supports [AWS Glue DataBrew](https://docs.aws.amazon.com/step-functions/latest/dg/connect-databrew.html) through the service integration pattern. + +You can call the [`StartJobRun`](https://docs.aws.amazon.com/databrew/latest/dg/API_StartJobRun.html) API from a `Task` state. + +```ts +new tasks.GlueDataBrewStartJobRun(this, 'Task', { + name: 'databrew-job', +}); +``` + +## Lambda + +[Invoke](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html) a Lambda function. + +You can specify the input to your Lambda function through the `payload` attribute. +By default, Step Functions invokes Lambda function with the state input (JSON path '$') +as the input. + +The following snippet invokes a Lambda Function with the state input as the payload +by referencing the `$` path. + +```ts +declare const fn: lambda.Function; +new tasks.LambdaInvoke(this, 'Invoke with state input', { + lambdaFunction: fn, +}); +``` + +When a function is invoked, the Lambda service sends [these response +elements](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#API_Invoke_ResponseElements) +back. + +⚠️ The response from the Lambda function is in an attribute called `Payload` + +The following snippet invokes a Lambda Function by referencing the `$.Payload` path +to reference the output of a Lambda executed before it. + +```ts +declare const fn: lambda.Function; +new tasks.LambdaInvoke(this, 'Invoke with empty object as payload', { + lambdaFunction: fn, + payload: sfn.TaskInput.fromObject({}), +}); + +// use the output of fn as input +new tasks.LambdaInvoke(this, 'Invoke with payload field in the state input', { + lambdaFunction: fn, + payload: sfn.TaskInput.fromJsonPathAt('$.Payload'), +}); +``` + +The following snippet invokes a Lambda and sets the task output to only include +the Lambda function response. + +```ts +declare const fn: lambda.Function; +new tasks.LambdaInvoke(this, 'Invoke and set function response as task output', { + lambdaFunction: fn, + outputPath: '$.Payload', +}); +``` + +If you want to combine the input and the Lambda function response you can use +the `payloadResponseOnly` property and specify the `resultPath`. This will put the +Lambda function ARN directly in the "Resource" string, but it conflicts with the +integrationPattern, invocationType, clientContext, and qualifier properties. + +```ts +declare const fn: lambda.Function; +new tasks.LambdaInvoke(this, 'Invoke and combine function response with task input', { + lambdaFunction: fn, + payloadResponseOnly: true, + resultPath: '$.fn', +}); +``` + +You can have Step Functions pause a task, and wait for an external process to +return a task token. Read more about the [callback pattern](https://docs.aws.amazon.com/step-functions/latest/dg/callback-task-sample-sqs.html#call-back-lambda-example) + +To use the callback pattern, set the `token` property on the task. Call the Step +Functions `SendTaskSuccess` or `SendTaskFailure` APIs with the token to +indicate that the task has completed and the state machine should resume execution. + +The following snippet invokes a Lambda with the task token as part of the input +to the Lambda. + +```ts +declare const fn: lambda.Function; +new tasks.LambdaInvoke(this, 'Invoke with callback', { + lambdaFunction: fn, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + payload: sfn.TaskInput.fromObject({ + token: sfn.JsonPath.taskToken, + input: sfn.JsonPath.stringAt('$.someField'), + }), +}); +``` + +⚠️ The task will pause until it receives that task token back with a `SendTaskSuccess` or `SendTaskFailure` +call. Learn more about [Callback with the Task +Token](https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token). + +AWS Lambda can occasionally experience transient service errors. In this case, invoking Lambda +results in a 500 error, such as `ServiceException`, `AWSLambdaException`, or `SdkClientException`. +As a best practice, the `LambdaInvoke` task will retry on those errors with an interval of 2 seconds, +a back-off rate of 2 and 6 maximum attempts. Set the `retryOnServiceExceptions` prop to `false` to +disable this behavior. + +## SageMaker + +Step Functions supports [AWS SageMaker](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sagemaker.html) through the service integration pattern. + +If your training job or model uses resources from AWS Marketplace, +[network isolation is required](https://docs.aws.amazon.com/sagemaker/latest/dg/mkt-algo-model-internet-free.html). +To do so, set the `enableNetworkIsolation` property to `true` for `SageMakerCreateModel` or `SageMakerCreateTrainingJob`. + +To set environment variables for the Docker container use the `environment` property. + +### Create Training Job + +You can call the [`CreateTrainingJob`](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTrainingJob.html) API from a `Task` state. + +```ts +new tasks.SageMakerCreateTrainingJob(this, 'TrainSagemaker', { + trainingJobName: sfn.JsonPath.stringAt('$.JobName'), + algorithmSpecification: { + algorithmName: 'BlazingText', + trainingInputMode: tasks.InputMode.FILE, + }, + inputDataConfig: [{ + channelName: 'train', + dataSource: { + s3DataSource: { + s3DataType: tasks.S3DataType.S3_PREFIX, + s3Location: tasks.S3Location.fromJsonExpression('$.S3Bucket'), + }, + }, + }], + outputDataConfig: { + s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'mybucket'), 'myoutputpath'), + }, + resourceConfig: { + instanceCount: 1, + instanceType: new ec2.InstanceType(sfn.JsonPath.stringAt('$.InstanceType')), + volumeSize: Size.gibibytes(50), + }, // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume + stoppingCondition: { + maxRuntime: Duration.hours(2), + }, // optional: default is 1 hour +}); +``` + +### Create Transform Job + +You can call the [`CreateTransformJob`](https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateTransformJob.html) API from a `Task` state. + +```ts +new tasks.SageMakerCreateTransformJob(this, 'Batch Inference', { + transformJobName: 'MyTransformJob', + modelName: 'MyModelName', + modelClientOptions: { + invocationsMaxRetries: 3, // default is 0 + invocationsTimeout: Duration.minutes(5), // default is 60 seconds + }, + transformInput: { + transformDataSource: { + s3DataSource: { + s3Uri: 's3://inputbucket/train', + s3DataType: tasks.S3DataType.S3_PREFIX, + } + } + }, + transformOutput: { + s3OutputPath: 's3://outputbucket/TransformJobOutputPath', + }, + transformResources: { + instanceCount: 1, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M4, ec2.InstanceSize.XLARGE), + } +}); + +``` + +### Create Endpoint + +You can call the [`CreateEndpoint`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html) API from a `Task` state. + +```ts +new tasks.SageMakerCreateEndpoint(this, 'SagemakerEndpoint', { + endpointName: sfn.JsonPath.stringAt('$.EndpointName'), + endpointConfigName: sfn.JsonPath.stringAt('$.EndpointConfigName'), +}); +``` + +### Create Endpoint Config + +You can call the [`CreateEndpointConfig`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpointConfig.html) API from a `Task` state. + +```ts +new tasks.SageMakerCreateEndpointConfig(this, 'SagemakerEndpointConfig', { + endpointConfigName: 'MyEndpointConfig', + productionVariants: [{ + initialInstanceCount: 2, + instanceType: ec2.InstanceType.of(ec2.InstanceClass.M5, ec2.InstanceSize.XLARGE), + modelName: 'MyModel', + variantName: 'awesome-variant', + }], +}); +``` + +### Create Model + +You can call the [`CreateModel`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModel.html) API from a `Task` state. + +```ts +new tasks.SageMakerCreateModel(this, 'Sagemaker', { + modelName: 'MyModel', + primaryContainer: new tasks.ContainerDefinition({ + image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Model.imageName')), + mode: tasks.Mode.SINGLE_MODEL, + modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'), + }), +}); +``` + +### Update Endpoint + +You can call the [`UpdateEndpoint`](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateEndpoint.html) API from a `Task` state. + +```ts +new tasks.SageMakerUpdateEndpoint(this, 'SagemakerEndpoint', { + endpointName: sfn.JsonPath.stringAt('$.Endpoint.Name'), + endpointConfigName: sfn.JsonPath.stringAt('$.Endpoint.EndpointConfig'), +}); +``` + +## SNS + +Step Functions supports [Amazon SNS](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sns.html) through the service integration pattern. + +You can call the [`Publish`](https://docs.aws.amazon.com/sns/latest/api/API_Publish.html) API from a `Task` state to publish to an SNS topic. + +```ts +const topic = new sns.Topic(this, 'Topic'); + +// Use a field from the execution data as message. +const task1 = new tasks.SnsPublish(this, 'Publish1', { + topic, + integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, + message: sfn.TaskInput.fromDataAt('$.state.message'), + messageAttributes: { + place: { + value: sfn.JsonPath.stringAt('$.place'), + }, + pic: { + // BINARY must be explicitly set + dataType: tasks.MessageAttributeDataType.BINARY, + value: sfn.JsonPath.stringAt('$.pic'), + }, + people: { + value: 4, + }, + handles: { + value: ['@kslater', '@jjf', null, '@mfanning'], + }, + }, +}); + +// Combine a field from the execution data with +// a literal object. +const task2 = new tasks.SnsPublish(this, 'Publish2', { + topic, + message: sfn.TaskInput.fromObject({ + field1: 'somedata', + field2: sfn.JsonPath.stringAt('$.field2'), + }), +}); +``` + +## Step Functions + +### Start Execution + +You can manage [AWS Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/connect-stepfunctions.html) executions. + +AWS Step Functions supports it's own [`StartExecution`](https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html) API as a service integration. + +```ts +// Define a state machine with one Pass state +const child = new sfn.StateMachine(this, 'ChildStateMachine', { + definition: sfn.Chain.start(new sfn.Pass(this, 'PassState')), +}); + +// Include the state machine in a Task state with callback pattern +const task = new tasks.StepFunctionsStartExecution(this, 'ChildTask', { + stateMachine: child, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + input: sfn.TaskInput.fromObject({ + token: sfn.JsonPath.taskToken, + foo: 'bar', + }), + name: 'MyExecutionName', +}); + +// Define a second state machine with the Task state above +new sfn.StateMachine(this, 'ParentStateMachine', { + definition: task, +}); +``` + +You can utilize [Associate Workflow Executions](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-nested-workflows.html#nested-execution-startid) +via the `associateWithParent` property. This allows the Step Functions UI to link child +executions from parent executions, making it easier to trace execution flow across state machines. + +```ts +declare const child: sfn.StateMachine; +const task = new tasks.StepFunctionsStartExecution(this, 'ChildTask', { + stateMachine: child, + associateWithParent: true, +}); +``` + +This will add the payload `AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$: $$.Execution.Id` to the +`input`property for you, which will pass the execution ID from the context object to the +execution input. It requires `input` to be an object or not be set at all. + +### Invoke Activity + +You can invoke a [Step Functions Activity](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html) which enables you to have +a task in your state machine where the work is performed by a *worker* that can +be hosted on Amazon EC2, Amazon ECS, AWS Lambda, basically anywhere. Activities +are a way to associate code running somewhere (known as an activity worker) with +a specific task in a state machine. + +When Step Functions reaches an activity task state, the workflow waits for an +activity worker to poll for a task. An activity worker polls Step Functions by +using GetActivityTask, and sending the ARN for the related activity. + +After the activity worker completes its work, it can provide a report of its +success or failure by using `SendTaskSuccess` or `SendTaskFailure`. These two +calls use the taskToken provided by GetActivityTask to associate the result +with that task. + +The following example creates an activity and creates a task that invokes the activity. + +```ts +const submitJobActivity = new sfn.Activity(this, 'SubmitJob'); + +new tasks.StepFunctionsInvokeActivity(this, 'Submit Job', { + activity: submitJobActivity, +}); +``` + +Use the [Parameters](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters) field to create a collection of key-value pairs that are passed as input. +The values of each can either be static values that you include in your state machine definition, or selected from either the input or the context object with a path. + +```ts +const submitJobActivity = new sfn.Activity(this, 'SubmitJob'); + +new tasks.StepFunctionsInvokeActivity(this, 'Submit Job', { + activity: submitJobActivity, + parameters: { + comment: 'Selecting what I care about.', + MyDetails: { + size: sfn.JsonPath.stringAt('$.product.details.size'), + exists: sfn.JsonPath.stringAt('$.product.availability'), + StaticValue: 'foo' + }, + }, +}); +``` + +## SQS + +Step Functions supports [Amazon SQS](https://docs.aws.amazon.com/step-functions/latest/dg/connect-sqs.html) + +You can call the [`SendMessage`](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html) API from a `Task` state +to send a message to an SQS queue. + +```ts +const queue = new sqs.Queue(this, 'Queue'); + +// Use a field from the execution data as message. +const task1 = new tasks.SqsSendMessage(this, 'Send1', { + queue, + messageBody: sfn.TaskInput.fromJsonPathAt('$.message'), +}); + +// Combine a field from the execution data with +// a literal object. +const task2 = new tasks.SqsSendMessage(this, 'Send2', { + queue, + messageBody: sfn.TaskInput.fromObject({ + field1: 'somedata', + field2: sfn.JsonPath.stringAt('$.field2'), + }), +}); +``` diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/index.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/base-types.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/base-types.ts new file mode 100644 index 0000000000000..2d1e916bdb41b --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/base-types.ts @@ -0,0 +1,79 @@ +import * as sfn from '../../../aws-stepfunctions'; + +/** Http Methods that API Gateway supports */ +export enum HttpMethod { + /** Retreive data from a server at the specified resource */ + GET = 'GET', + + /** Send data to the API endpoint to create or udpate a resource */ + POST = 'POST', + + /** Send data to the API endpoint to update or create a resource */ + PUT = 'PUT', + + /** Delete the resource at the specified endpoint */ + DELETE = 'DELETE', + + /** Apply partial modifications to the resource */ + PATCH = 'PATCH', + + /** Retreive data from a server at the specified resource without the response body */ + HEAD = 'HEAD', + + /** Return data describing what other methods and operations the server supports */ + OPTIONS = 'OPTIONS' +} + +/** + * The authentication method used to call the endpoint + */ +export enum AuthType { + /** Call the API direclty with no authorization method */ + NO_AUTH = 'NO_AUTH', + + /** Use the IAM role associated with the current state machine for authorization */ + IAM_ROLE = 'IAM_ROLE', + + /** Use the resource policy of the API for authorization */ + RESOURCE_POLICY = 'RESOURCE_POLICY', +} + +/** + * Base CallApiGatewayEdnpoint Task Props + */ +export interface CallApiGatewayEndpointBaseProps extends sfn.TaskStateBaseProps { + /** + * Http method for the API + */ + readonly method: HttpMethod; + + /** + * HTTP request information that does not relate to contents of the request + * @default - No headers + */ + readonly headers?: sfn.TaskInput; + + /** + * Path parameters appended after API endpoint + * @default - No path + */ + readonly apiPath?: string; + + /** + * Query strings attatched to end of request + * @default - No query parameters + */ + readonly queryParameters?: sfn.TaskInput; + + /** + * HTTP Request body + * @default - No request body + */ + readonly requestBody?: sfn.TaskInput; + + /** + * Authentication methods + * @default AuthType.NO_AUTH + */ + readonly authType?: AuthType; +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/base.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/base.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/base.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/base.ts index 4bea8f1a38cab..fc702d5fb9078 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/base.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/base.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; import { Construct } from 'constructs'; import { AuthType, CallApiGatewayEndpointBaseProps } from './base-types'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts similarity index 93% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts index 67def4d6a4699..a5a8a92b0a220 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { CallApiGatewayEndpointBase } from './base'; import { CallApiGatewayEndpointBaseProps } from './base-types'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-rest-api.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-rest-api.ts similarity index 92% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-rest-api.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-rest-api.ts index 153331cb6dafb..8d0a2f7c2ed9d 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-rest-api.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/call-rest-api.ts @@ -1,7 +1,7 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as apigateway from '../../../aws-apigateway'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { CallApiGatewayEndpointBase } from './base'; import { CallApiGatewayEndpointBaseProps } from './base-types'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/index.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/index.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/index.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/apigateway/index.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/get-query-execution.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/get-query-execution.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/get-query-execution.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/get-query-execution.ts index 23e4079b77921..50bc392d3cf21 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/get-query-execution.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/get-query-execution.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/get-query-results.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/get-query-results.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/get-query-results.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/get-query-results.ts index 700b43fc2a599..c32638ba1f0cd 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/get-query-results.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/get-query-results.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts index 0973734194573..f2fad24358155 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/start-query-execution.ts @@ -1,8 +1,8 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as s3 from '../../../aws-s3'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/stop-query-execution.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/stop-query-execution.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/stop-query-execution.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/stop-query-execution.ts index a7c44cebfb4a0..0399bd89e4b41 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/athena/stop-query-execution.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/athena/stop-query-execution.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts index a00becd176307..516a745c8f669 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Token } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Token } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts index 9ee1cae598095..dc6b4999fa9f5 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/batch/run-batch-job.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Stack, withResolved } from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Stack, withResolved } from '../../../core'; import { getResourceArn } from '../resource-arn-suffix'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/batch/submit-job.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/batch/submit-job.ts index e85dd5d815423..5990f047d4cca 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/batch/submit-job.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/batch/submit-job.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Size, Stack, withResolved } from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Size, Stack, withResolved } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/codebuild/start-build.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/codebuild/start-build.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/codebuild/start-build.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/codebuild/start-build.ts index 939732e237d54..f11785ac6818f 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/codebuild/start-build.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/codebuild/start-build.ts @@ -1,7 +1,7 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as codebuild from '../../../aws-codebuild'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/databrew/start-job-run.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/databrew/start-job-run.ts new file mode 100644 index 0000000000000..5d0441f0342f1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/databrew/start-job-run.ts @@ -0,0 +1,77 @@ +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; +import { Construct } from 'constructs'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * Properties for starting a job run with StartJobRun + */ +export interface GlueDataBrewStartJobRunProps extends sfn.TaskStateBaseProps { + + /** + * Glue DataBrew Job to run + */ + readonly name: string; +} + +/** + * Start a Job run as a Task + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-databrew.html + */ +export class GlueDataBrewStartJobRun extends sfn.TaskStateBase { + + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + sfn.IntegrationPattern.RUN_JOB, + ]; + + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + + private readonly integrationPattern: sfn.IntegrationPattern; + + /** + */ + constructor(scope: Construct, id: string, private readonly props: GlueDataBrewStartJobRunProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.REQUEST_RESPONSE; + + validatePatternSupported(this.integrationPattern, GlueDataBrewStartJobRun.SUPPORTED_INTEGRATION_PATTERNS); + + const actions = ['databrew:startJobRun']; + + if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { + actions.push('databrew:stopJobRun', 'databrew:listJobRuns'); + } + + this.taskPolicies = [ + new iam.PolicyStatement({ + resources: [ + cdk.Stack.of(this).formatArn({ + service: 'databrew', + resource: 'job', + // If the name comes from input, we cannot target the policy to a particular ARN prefix reliably. + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.name) ? '*' : this.props.name, + }), + ], + actions: actions, + }), + ]; + } + + /** + * Provides the Glue DataBrew Start Job Run task configuration + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('databrew', 'startJobRun', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject({ + Name: this.props.name, + }), + }; + } +} + diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/delete-item.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/delete-item.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/delete-item.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/delete-item.ts index a90d6477c4456..c386e4ef3f287 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/delete-item.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/delete-item.ts @@ -1,7 +1,7 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { DynamoMethod, getDynamoResourceArn, transformAttributeValueMap } from './private/utils'; import { DynamoAttributeValue, DynamoConsumedCapacity, DynamoItemCollectionMetrics, DynamoReturnValues } from './shared-types'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/get-item.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/get-item.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/get-item.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/get-item.ts index a5d8c07e2e5cf..b249dbbb01596 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/get-item.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/get-item.ts @@ -1,7 +1,7 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { DynamoMethod, getDynamoResourceArn, transformAttributeValueMap } from './private/utils'; import { DynamoAttributeValue, DynamoConsumedCapacity, DynamoProjectionExpression } from './shared-types'; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/private/utils.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/private/utils.ts new file mode 100644 index 0000000000000..f4bc31483bfc9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/private/utils.ts @@ -0,0 +1,30 @@ +import * as sfn from '../../../../aws-stepfunctions'; +import { integrationResourceArn } from '../../private/task-utils'; +import { DynamoAttributeValue } from '../shared-types'; + +export enum DynamoMethod { + GET = 'Get', + PUT = 'Put', + DELETE = 'Delete', + UPDATE = 'Update', +} + +export function getDynamoResourceArn(method: DynamoMethod) { + return integrationResourceArn('dynamodb', `${method.toLowerCase()}Item`, sfn.IntegrationPattern.REQUEST_RESPONSE); +} + +export function transformAttributeValueMap(attrMap?: { [key: string]: DynamoAttributeValue }) { + const transformedValue: any = {}; + for (const key in attrMap) { + if (key) { + transformedValue[key] = attrMap[key].toObject(); + } + } + return attrMap ? transformedValue : undefined; +} + +export function validateJsonPath(value: string) { + if (!value.startsWith('$')) { + throw new Error("Data JSON path values must either be exactly equal to '$' or start with '$.'"); + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/put-item.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/put-item.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/put-item.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/put-item.ts index 9399667194027..35189f8bb47ff 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/put-item.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/put-item.ts @@ -1,7 +1,7 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { DynamoMethod, getDynamoResourceArn, transformAttributeValueMap } from './private/utils'; import { DynamoAttributeValue, DynamoConsumedCapacity, DynamoItemCollectionMetrics, DynamoReturnValues } from './shared-types'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/shared-types.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/shared-types.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/shared-types.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/shared-types.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/update-item.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/update-item.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/update-item.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/update-item.ts index 2025f1b5e259b..2101264466cb2 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/dynamodb/update-item.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/dynamodb/update-item.ts @@ -1,7 +1,7 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { DynamoMethod, getDynamoResourceArn, transformAttributeValueMap } from './private/utils'; import { DynamoAttributeValue, DynamoConsumedCapacity, DynamoItemCollectionMetrics, DynamoReturnValues } from './shared-types'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-ec2-task.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-ec2-task.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-ec2-task.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-ec2-task.ts index 7294707723210..ed2653d51718b 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-ec2-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-ec2-task.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; import { CommonEcsRunTaskProps, EcsRunTaskBase } from './run-ecs-task-base'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-fargate-task.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-fargate-task.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-fargate-task.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-fargate-task.ts index d89664d0e2713..333c166af9931 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-fargate-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-fargate-task.ts @@ -1,5 +1,5 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; import { CommonEcsRunTaskProps, EcsRunTaskBase } from './run-ecs-task-base'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base-types.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base-types.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base-types.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base-types.ts index 57221503a686e..6af81192f9cdc 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base-types.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base-types.ts @@ -1,4 +1,4 @@ -import { ContainerDefinition } from '@aws-cdk/aws-ecs'; +import { ContainerDefinition } from '../../../aws-ecs'; /** * A list of container overrides that specify the name of a container diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base.ts index 48b5a7ca007cc..6a56d7fbf53e6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-ecs-task-base.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { ContainerOverride } from './run-ecs-task-base-types'; import { getResourceArn } from '../resource-arn-suffix'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-task.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-task.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-task.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-task.ts index 6c02159a56bfe..77124067bfe2f 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/ecs/run-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/ecs/run-task.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { ContainerOverride } from '..'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eks/call.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eks/call.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/eks/call.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eks/call.ts index c94e745bb2451..dac3bb18054ef 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eks/call.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eks/call.ts @@ -1,6 +1,6 @@ -import * as eks from '@aws-cdk/aws-eks'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as eks from '../../../aws-eks'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-add-step.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-add-step.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-add-step.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-add-step.ts index 6e966ea738b2e..e6f58151e54f7 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-add-step.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-add-step.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-cancel-step.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-cancel-step.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-cancel-step.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-cancel-step.ts index cec4772436b7c..c764f12afc4d0 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-cancel-step.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-cancel-step.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts index e2a62f46b1f78..dfb084c6c3746 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-create-cluster.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; -import { ENABLE_EMR_SERVICE_POLICY_V2 } from '@aws-cdk/cx-api'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; +import { ENABLE_EMR_SERVICE_POLICY_V2 } from '../../../cx-api'; import { Construct } from 'constructs'; import { ApplicationConfigPropertyToJson, diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-fleet-by-name.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-fleet-by-name.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-fleet-by-name.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-fleet-by-name.ts index 3fed76b790a94..4f8bbff885b53 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-fleet-by-name.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-fleet-by-name.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-group-by-name.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-group-by-name.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-group-by-name.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-group-by-name.ts index 043f36f9229f2..448e065206247 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-group-by-name.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-modify-instance-group-by-name.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Stack } from '../../../core'; import { Construct } from 'constructs'; import { EmrCreateCluster } from './emr-create-cluster'; import { InstanceGroupModifyConfigPropertyToJson } from './private/cluster-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-set-cluster-termination-protection.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-set-cluster-termination-protection.ts similarity index 92% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-set-cluster-termination-protection.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-set-cluster-termination-protection.ts index 962bf710477c0..57f6efa08f2fb 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-set-cluster-termination-protection.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-set-cluster-termination-protection.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-terminate-cluster.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-terminate-cluster.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-terminate-cluster.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-terminate-cluster.ts index 04896ea40e2ff..f1995d1645033 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/emr-terminate-cluster.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/emr-terminate-cluster.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts index c8ae8a50a360c..9578c6ce13e45 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emr/private/cluster-utils.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../../core'; import { EmrCreateCluster } from '../emr-create-cluster'; import { EmrModifyInstanceGroupByName } from '../emr-modify-instance-group-by-name'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/create-virtual-cluster.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/create-virtual-cluster.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/create-virtual-cluster.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/create-virtual-cluster.ts index cb9458ef01e44..21ea3e8d729a7 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/create-virtual-cluster.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/create-virtual-cluster.ts @@ -1,7 +1,7 @@ -import * as eks from '@aws-cdk/aws-eks'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as eks from '../../../aws-eks'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/delete-virtual-cluster.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/delete-virtual-cluster.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/delete-virtual-cluster.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/delete-virtual-cluster.ts index b4e0e9c45e2ce..bffc37c3bdfc9 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/emrcontainers/delete-virtual-cluster.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/delete-virtual-cluster.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts new file mode 100644 index 0000000000000..10953ab2c24a9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/start-job-run.ts @@ -0,0 +1,689 @@ +import * as path from 'path'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as logs from '../../../aws-logs'; +import * as s3 from '../../../aws-s3'; +import * as sfn from '../../../aws-stepfunctions'; +import { TaskInput } from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; +import * as cr from '../../../custom-resources'; +import * as awscli from '../../../lambda-layer-awscli'; +import { Construct } from 'constructs'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * The props for a EMR Containers StartJobRun Task. + */ +export interface EmrContainersStartJobRunProps extends sfn.TaskStateBaseProps { + /** + * The ID of the virtual cluster where the job will be run + */ + readonly virtualCluster: VirtualClusterInput; + + /** + * The name of the job run. + * + * @default - No job run name + */ + readonly jobName?: string; + + /** + * The execution role for the job run. + * + * If `virtualClusterId` is from a JSON input path, an execution role must be provided. + * If an execution role is provided, follow the documentation to update the role trust policy. + * @see https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/setting-up-trust-policy.html + * + * @default - Automatically generated only when the provided `virtualClusterId` is not an encoded JSON path + */ + readonly executionRole?: iam.IRole; + + /** + * The Amazon EMR release version to use for the job run. + */ + readonly releaseLabel: ReleaseLabel; + + /** + * The configurations for the application running in the job run. + * + * Maximum of 100 items + * + * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_Configuration.html + * + * @default - No application config + */ + readonly applicationConfig?: ApplicationConfiguration[]; + + /** + * The job driver for the job run. + * + * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_JobDriver.html + */ + readonly jobDriver: JobDriver; + + /** + * Configuration for monitoring the job run + * + * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_MonitoringConfiguration.html + * + * @default - logging enabled and resources automatically generated if `monitoring.logging` is set to `true` + */ + readonly monitoring?: Monitoring; + + /** + * The tags assigned to job runs. + * + * @default - None + */ + readonly tags?: { [key: string]: string }; +} + +/** + * Starts a job run. + * + * A job is a unit of work that you submit to Amazon EMR on EKS for execution. + * The work performed by the job can be defined by a Spark jar, PySpark script, or SparkSQL query. + * A job run is an execution of the job on the virtual cluster. + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-emr-eks.html + */ +export class EmrContainersStartJobRun extends sfn.TaskStateBase implements iam.IGrantable { + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + sfn.IntegrationPattern.RUN_JOB, + ]; + + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + + public readonly grantPrincipal: iam.IPrincipal; + private role: iam.IRole; + private readonly logGroup?: logs.ILogGroup; + private readonly logBucket?: s3.IBucket; + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: Construct, id: string, private readonly props: EmrContainersStartJobRunProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.RUN_JOB; + validatePatternSupported(this.integrationPattern, EmrContainersStartJobRun.SUPPORTED_INTEGRATION_PATTERNS); + + if (this.props.applicationConfig) { + this.validateAppConfig(this.props.applicationConfig); + } + + if (this.props.jobDriver.sparkSubmitJobDriver) { + this.validateSparkSubmitJobDriver(props.jobDriver.sparkSubmitJobDriver); + } + + if (this.props.executionRole === undefined + && sfn.JsonPath.isEncodedJsonPath(props.virtualCluster.id)) { + throw new Error('Execution role cannot be undefined when the virtual cluster ID is not a concrete value. Provide an execution role with the correct trust policy'); + } + + this.logGroup = this.assignLogGroup(); + this.logBucket = this.assignLogBucket(); + this.role = this.props.executionRole ?? this.createJobExecutionRole(); + this.grantPrincipal = this.role; + + this.grantMonitoringPolicies(); + + this.taskPolicies = this.createPolicyStatements(); + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: integrationResourceArn('emr-containers', 'startJobRun', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject({ + VirtualClusterId: this.props.virtualCluster.id, + Name: this.props.jobName, + ExecutionRoleArn: this.role.roleArn, + ReleaseLabel: this.props.releaseLabel.label, + JobDriver: { + SparkSubmitJobDriver: { + EntryPoint: this.props.jobDriver.sparkSubmitJobDriver?.entryPoint.value, + EntryPointArguments: this.props.jobDriver.sparkSubmitJobDriver?.entryPointArguments?.value, + SparkSubmitParameters: this.props.jobDriver.sparkSubmitJobDriver?.sparkSubmitParameters, + }, + }, + ConfigurationOverrides: { + ApplicationConfiguration: cdk.listMapper(this.applicationConfigPropertyToJson)(this.props.applicationConfig), + MonitoringConfiguration: { + CloudWatchMonitoringConfiguration: this.logGroup ? { + LogGroupName: this.logGroup.logGroupName, + LogStreamNamePrefix: this.props.monitoring!.logStreamNamePrefix, + } : undefined, + PersistentAppUI: (this.props.monitoring?.persistentAppUI === false) + ? 'DISABLED' + : 'ENABLED', + S3MonitoringConfiguration: this.logBucket ? { + LogUri: this.logBucket.s3UrlForObject(), + } : undefined, + }, + }, + Tags: this.props.tags, + }), + }; + } + + /** + * Render the EMR Containers ConfigurationProperty as JSON + */ + private applicationConfigPropertyToJson = (property: ApplicationConfiguration) => { + return { + Classification: cdk.stringToCloudFormation(property.classification.classificationStatement), + Properties: property.properties ? cdk.objectToCloudFormation(property.properties) : undefined, + Configurations: property.nestedConfig ? cdk.listMapper(this.applicationConfigPropertyToJson)(property.nestedConfig) : undefined, + }; + } + + private validateAppConfigPropertiesLength(appConfig: ApplicationConfiguration) { + if (appConfig?.properties === undefined) { + return; + } else if (Object.keys(appConfig.properties).length > 100) { + throw new Error(`Application configuration properties must have 100 or fewer entries. Received ${Object.keys(appConfig.properties).length}`); + } + } + + private validatePropertiesNestedAppConfigBothNotUndefined(appConfig: ApplicationConfiguration) { + if (appConfig?.properties === undefined && appConfig?.nestedConfig === undefined) { + throw new Error('Application configuration must have either properties or nested app configurations defined.'); + } + } + + private validateAppConfig(config?: ApplicationConfiguration[]) { + if (config === undefined) { + return; + } else if (config.length > 100) { + throw new Error(`Application configuration array must have 100 or fewer entries. Received ${config.length}`); + } else { + config.forEach(element => this.validateAppConfig(element.nestedConfig)); + config.forEach(element => this.validateAppConfigPropertiesLength(element)); + config.forEach(element => this.validatePropertiesNestedAppConfigBothNotUndefined(element)); + } + } + + private isArrayOfStrings(value: any): boolean { + return Array.isArray(value) && value.every(item => typeof item === 'string'); + } + + private validateEntryPointArguments (entryPointArguments:sfn.TaskInput) { + if (typeof entryPointArguments.value === 'string') { + if (!sfn.JsonPath.isEncodedJsonPath(entryPointArguments.value)) { + throw new Error('Entry point arguments must be a string array or an encoded JSON path, but received a non JSON path string'); + } + } else if (!this.isArrayOfStrings(entryPointArguments.value)) { + throw new Error(`Entry point arguments must be a string array or an encoded JSON path but received ${typeof entryPointArguments.value}.`); + } + } + + private validateEntryPointArgumentsLength (entryPointArguments:sfn.TaskInput) { + if (this.isArrayOfStrings(entryPointArguments.value) + && (entryPointArguments.value.length > 10280 || entryPointArguments.value.length < 1)) { + throw new Error(`Entry point arguments must be a string array between 1 and 10280 in length. Received ${entryPointArguments.value.length}.`); + } + } + + private validateSparkSubmitParametersLength (sparkSubmitParameters : string) { + if (sparkSubmitParameters.length > 102400 || sparkSubmitParameters.length < 1) { + throw new Error(`Spark submit parameters must be between 1 and 102400 characters in length. Received ${sparkSubmitParameters.length}.`); + } + } + private validateEntryPoint (entryPoint: TaskInput) { + if (!sfn.JsonPath.isEncodedJsonPath(entryPoint.value) && (entryPoint.value.length > 256|| entryPoint.value.length < 1)) { + throw new Error(`Entry point must be between 1 and 256 characters in length. Received ${entryPoint.value.length}.`); + } + } + + private validateSparkSubmitJobDriver (driver:SparkSubmitJobDriver) { + this.validateEntryPoint(driver.entryPoint); + if (driver.entryPointArguments) { + this.validateEntryPointArguments(driver.entryPointArguments); + this.validateEntryPointArgumentsLength(driver.entryPointArguments); + } + if (driver.sparkSubmitParameters) { + this.validateSparkSubmitParametersLength(driver.sparkSubmitParameters); + } + } + + private assignLogGroup = () : any => { + if (this.props.monitoring?.logGroup) { + return (this.props.monitoring?.logGroup); + } else { + return (this.props.monitoring?.logging ? new logs.LogGroup(this, 'Monitoring Log Group') : undefined); + } + } + + private assignLogBucket = () : any => { + if (this.props.monitoring?.logBucket) { + return (this.props.monitoring?.logBucket); + } else { + return (this.props.monitoring?.logging ? new s3.Bucket(this, 'Monitoring Bucket') : undefined); + } + } + + // https://docs.aws.amazon.com/emr/latest/EMR-on-EKS-DevelopmentGuide/creating-job-execution-role.html + private createJobExecutionRole(): iam.Role { + const jobExecutionRole = new iam.Role(this, 'Job-Execution-Role', { + assumedBy: new iam.CompositePrincipal( + new iam.ServicePrincipal('emr-containers.amazonaws.com'), + new iam.ServicePrincipal('states.amazonaws.com'), + ), + }); + + this.logBucket?.grantReadWrite(jobExecutionRole); + this.logGroup?.grantWrite(jobExecutionRole); + this.logGroup?.grant(jobExecutionRole, 'logs:DescribeLogStreams'); + + jobExecutionRole.addToPrincipalPolicy( + new iam.PolicyStatement({ + resources: [ + cdk.Stack.of(this).formatArn({ + service: 'logs', + resource: '*', + }), + ], + actions: [ + 'logs:DescribeLogGroups', + ], + }), + ); + + this.updateRoleTrustPolicy(jobExecutionRole); + + return jobExecutionRole; + } + private grantMonitoringPolicies() { + + this.logBucket?.grantReadWrite(this.role); + this.logGroup?.grantWrite(this.role); + this.logGroup?.grant(this.role, 'logs:DescribeLogStreams'); + + this.role.addToPrincipalPolicy( + new iam.PolicyStatement({ + resources: [ + cdk.Stack.of(this).formatArn({ + service: 'logs', + resource: '*', + }), + ], + actions: [ + 'logs:DescribeLogGroups', + ], + }), + ); + } + + /** + * If an execution role is not provided by user, the automatically generated job execution role must create a trust relationship + * between itself and the identity of the EMR managed service account in order to run jobs on the Kubernetes namespace. + * + * This cannot occur if the user provided virtualClusterId is within an encoded JSON path. + * + * The trust relationship can be created by updating the trust policy of the job execution role. + * + * @param role the automatically generated job execution role + */ + private updateRoleTrustPolicy(role: iam.Role) { + const eksClusterInfo = new cr.AwsCustomResource(this, 'GetEksClusterInfo', { + onCreate: { + service: 'EMRcontainers', + action: 'describeVirtualCluster', + parameters: { + id: this.props.virtualCluster.id, + }, + outputPaths: ['virtualCluster.containerProvider.info.eksInfo.namespace', 'virtualCluster.containerProvider.id'], + physicalResourceId: cr.PhysicalResourceId.of('id'), + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), + // APIs are available in 2.1055.0 + installLatestAwsSdk: false, + }); + /* We make use of custom resources to call update-roll-trust-policy as this command is only available through + * aws cli because this is only used during the initial setup and is not available through the sdk. + * https://awscli.amazonaws.com/v2/documentation/api/latest/reference/emr-containers/update-role-trust-policy.html + * Commands available through SDK: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EMRcontainers.html + * Commands available through CLI: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/emr-containers/index.html + */ + const cliLayer = new awscli.AwsCliLayer(this, 'awsclilayer'); + const shellCliLambda = new lambda.SingletonFunction(this, 'Call Update-Role-Trust-Policy', { + uuid: '8693BB64-9689-44B6-9AAF-B0CC9EB8757C', + runtime: lambda.Runtime.PYTHON_3_9, + handler: 'index.handler', + code: lambda.Code.fromAsset(path.join(__dirname, 'utils/role-policy')), + timeout: cdk.Duration.seconds(30), + memorySize: 256, + layers: [cliLayer], + }); + shellCliLambda.addToRolePolicy( + new iam.PolicyStatement({ + resources: [ + cdk.Stack.of(this).formatArn({ + service: 'eks', + resource: 'cluster', + resourceName: eksClusterInfo.getResponseField('virtualCluster.containerProvider.id'), + }), + ], + actions: [ + 'eks:DescribeCluster', + ], + }), + ); + shellCliLambda.addToRolePolicy( + new iam.PolicyStatement({ + resources: [role.roleArn], + actions: [ + 'iam:GetRole', + 'iam:UpdateAssumeRolePolicy', + ], + }), + ); + const provider = new cr.Provider(this, 'CustomResourceProvider', { + onEventHandler: shellCliLambda, + }); + new cdk.CustomResource(this, 'Custom Resource', { + properties: { + eksNamespace: eksClusterInfo.getResponseField('virtualCluster.containerProvider.info.eksInfo.namespace'), + eksClusterId: eksClusterInfo.getResponseField('virtualCluster.containerProvider.id'), + roleName: role.roleName, + }, + serviceToken: provider.serviceToken, + }); + } + + private createPolicyStatements(): iam.PolicyStatement[] { + const policyStatements = [ + new iam.PolicyStatement({ + resources: [ + cdk.Stack.of(this).formatArn({ + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME, + service: 'emr-containers', + resource: 'virtualclusters', + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.virtualCluster.id) ? '*' : this.props.virtualCluster.id, // Need wild card for dynamic start job run https://docs.aws.amazon.com/step-functions/latest/dg/emr-eks-iam.html + }), + ], + actions: ['emr-containers:StartJobRun'], + conditions: { + StringEquals: { + 'emr-containers:ExecutionRoleArn': this.role.roleArn, + }, + }, + }), + ]; + + if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { + policyStatements.push( + new iam.PolicyStatement({ + resources: [ + cdk.Stack.of(this).formatArn({ + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME, + service: 'emr-containers', + resource: 'virtualclusters', + resourceName: sfn.JsonPath.isEncodedJsonPath(this.props.virtualCluster.id) ? '*' : `${this.props.virtualCluster.id}/jobruns/*`, // Need wild card for dynamic start job run https://docs.aws.amazon.com/step-functions/latest/dg/emr-eks-iam.html + }), + ], + actions: [ + 'emr-containers:DescribeJobRun', + 'emr-containers:CancelJobRun', + ], + }), + ); + } + + return policyStatements; + } +} + +/** + * The information about job driver for Spark submit. + */ +export interface SparkSubmitJobDriver { + /** + * The entry point of job application. + * + * Length Constraints: Minimum length of 1. Maximum length of 256. + */ + readonly entryPoint: sfn.TaskInput; + + /** + * The arguments for a job application in a task input object containing an array of strings + * + * Length Constraints: Minimum length of 1. Maximum length of 10280. + * @type sfn.TaskInput which expects payload as an array of strings + * + * @default - No arguments defined + */ + readonly entryPointArguments?: sfn.TaskInput; + + /** + * The Spark submit parameters that are used for job runs. + * + * Length Constraints: Minimum length of 1. Maximum length of 102400. + * + * @default - No spark submit parameters + */ + readonly sparkSubmitParameters?: string; +} + +/** + * Specify the driver that the EMR Containers job runs on. + * The job driver is used to provide an input for the job that will be run. + */ +export interface JobDriver { + /** + * The job driver parameters specified for spark submit. + * + * @see https://docs.aws.amazon.com/emr-on-eks/latest/APIReference/API_SparkSubmitJobDriver.html + * + */ + readonly sparkSubmitJobDriver: SparkSubmitJobDriver; +} + +/** + * The classification within a EMR Containers application configuration. + * Class can be extended to add other classifications. + * For example, new Classification('xxx-yyy'); + */ +export class Classification { + /** + * Sets the maximizeResourceAllocation property to true or false. + * When true, Amazon EMR automatically configures spark-defaults properties based on cluster hardware configuration. + * + * For more info: + * @see https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-spark-configure.html#emr-spark-maximizeresourceallocation + */ + static readonly SPARK = new Classification('spark'); + + /** + * Sets values in the spark-defaults.conf file. + * + * For more info: + * @see https://spark.apache.org/docs/latest/configuration.html + */ + static readonly SPARK_DEFAULTS = new Classification('spark-defaults'); + + /** + * Sets values in the spark-env.sh file. + * + * For more info: + * @see https://spark.apache.org/docs/latest/configuration.html#environment-variables + */ + static readonly SPARK_ENV = new Classification('spark-env'); + + /** + * Sets values in the hive-site.xml for Spark. + */ + static readonly SPARK_HIVE_SITE = new Classification('spark-hive-site'); + + /** + * Sets values in the log4j.properties file. + * + * For more settings and info: + * @see https://github.com/apache/spark/blob/master/conf/log4j.properties.template + */ + static readonly SPARK_LOG4J = new Classification('spark-log4j'); + + /** + * Sets values in the metrics.properties file. + * + * For more settings and info: + * @see https://github.com/apache/spark/blob/master/conf/metrics.properties.template + */ + static readonly SPARK_METRICS = new Classification('spark-metrics'); + + /** + * Creates a new Classification + * + * @param classificationStatement A literal string in case a new EMR classification is released, if not already defined. + */ + constructor(public readonly classificationStatement: string) { } +} + +/** + * A configuration specification to be used when provisioning virtual clusters, + * which can include configurations for applications and software bundled with Amazon EMR on EKS. + * + * A configuration consists of a classification, properties, and optional nested configurations. + * A classification refers to an application-specific configuration file. + * Properties are the settings you want to change in that file. + * @see https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-configure-apps.html + */ +export interface ApplicationConfiguration { + /** + * The classification within a configuration. + * + * Length Constraints: Minimum length of 1. Maximum length of 1024. + */ + readonly classification: Classification; + + /** + * A list of additional configurations to apply within a configuration object. + * + * Array Members: Maximum number of 100 items. + * + * @default - No other configurations + */ + readonly nestedConfig?: ApplicationConfiguration[]; + + /** + * A set of properties specified within a configuration classification. + * + * Map Entries: Maximum number of 100 items. + * + * @default - No properties + */ + readonly properties?: { [key: string]: string }; +} + +/** + * Configuration setting for monitoring. + */ +export interface Monitoring { + /** + * Enable logging for this job. + * + * If set to true, will automatically create a Cloudwatch Log Group and S3 bucket. + * This will be set to `true` implicitly if values are provided for `logGroup` or `logBucket`. + * + * @default true - true if values are provided for `logGroup` or `logBucket`, false otherwise + */ + readonly logging?: boolean + + /** + * A log group for CloudWatch monitoring. + * + * You can configure your jobs to send log information to CloudWatch Logs. + * + * @default - if `logging` is manually set to `true` and a `logGroup` is not provided, a `logGroup` will be automatically generated`. + */ + readonly logGroup?: logs.ILogGroup; + + /** + * A log stream name prefix for Cloudwatch monitoring. + * + * @default - Log streams created in this log group have no default prefix + */ + readonly logStreamNamePrefix?: string; + + /** + * Amazon S3 Bucket for monitoring log publishing. + * + * You can configure your jobs to send log information to Amazon S3. + * + * @default - if `logging` is manually set to `true` and a `logBucket` is not provided, a `logBucket` will be automatically generated`. + */ + readonly logBucket?: s3.IBucket; + + /** + * Monitoring configurations for the persistent application UI. + * + * @default true + */ + readonly persistentAppUI?: boolean; +} + +/** + * The Amazon EMR release version to use for the job run. + * + * Can be extended to include new EMR releases + * + * For example, `new ReleaseLabel('emr-x.xx.x-latest');` + */ +export class ReleaseLabel { + /** + * EMR Release version 5.32.0 + */ + static readonly EMR_5_32_0 = new ReleaseLabel('emr-5.32.0-latest'); + + /** + * EMR Release version 5.33.0 + */ + static readonly EMR_5_33_0 = new ReleaseLabel('emr-5.33.0-latest'); + + /** + * EMR Release version 6.2.0 + */ + static readonly EMR_6_2_0 = new ReleaseLabel('emr-6.2.0-latest'); + + /** + * EMR Release version 6.3.0 + */ + static readonly EMR_6_3_0 = new ReleaseLabel('emr-6.3.0-latest'); + + /** + * Initializes the label string. + * + * @param label A literal string that contains the release-version ex. 'emr-x.x.x-latest' + */ + constructor(public readonly label: string) { } +} + +/** + * Class that returns a virtual cluster's id depending on input type + */ +export class VirtualClusterInput { + /** + * Input for a virtualClusterId from a Task Input + */ + static fromTaskInput(taskInput: sfn.TaskInput): VirtualClusterInput { + return new VirtualClusterInput(taskInput.value); + } + + /** + * Input for virtualClusterId from a literal string + */ + static fromVirtualClusterId(virtualClusterId: string): VirtualClusterInput { + return new VirtualClusterInput(virtualClusterId); + } + + /** + * Initializes the virtual cluster ID. + * + * @param id The VirtualCluster Id + */ + private constructor(public readonly id: string) { } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.3c25783c134c6817b53033bdc57fc404bda6ba93392fcc7d3ca4d92bd072351f/index.py b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/utils/role-policy/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/integ.start-job-run.js.snapshot/asset.3c25783c134c6817b53033bdc57fc404bda6ba93392fcc7d3ca4d92bd072351f/index.py rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/emrcontainers/utils/role-policy/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eval-nodejs-handler/index.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eval-nodejs-handler/index.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/eval-nodejs-handler/index.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eval-nodejs-handler/index.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/evaluate-expression.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/evaluate-expression.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/evaluate-expression.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/evaluate-expression.ts index e4d7cc8c70fb5..238b82e5e8894 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/evaluate-expression.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/evaluate-expression.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../aws-iam'; +import * as lambda from '../../aws-lambda'; +import * as sfn from '../../aws-stepfunctions'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eventbridge/put-events.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eventbridge/put-events.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/eventbridge/put-events.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eventbridge/put-events.ts index 1c89d77babfb5..fddd807862646 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/eventbridge/put-events.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/eventbridge/put-events.ts @@ -1,7 +1,7 @@ -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as events from '../../../aws-events'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/glue/run-glue-job-task.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/glue/run-glue-job-task.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/glue/run-glue-job-task.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/glue/run-glue-job-task.ts index fd4722835a52e..4a0199f59bc26 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/glue/run-glue-job-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/glue/run-glue-job-task.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Stack } from '../../../core'; import { getResourceArn } from '../resource-arn-suffix'; /** diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/glue/start-job-run.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/glue/start-job-run.ts new file mode 100644 index 0000000000000..25aadfa2ccd22 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/glue/start-job-run.ts @@ -0,0 +1,134 @@ +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Stack } from '../../../core'; +import { Construct } from 'constructs'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * Properties for starting an AWS Glue job as a task + */ +export interface GlueStartJobRunProps extends sfn.TaskStateBaseProps { + + /** + * Glue job name + */ + readonly glueJobName: string; + + /** + * The job arguments specifically for this run. + * + * For this job run, they replace the default arguments set in the job + * definition itself. + * + * @default - Default arguments set in the job definition + */ + readonly arguments?: sfn.TaskInput; + + /** + * The name of the SecurityConfiguration structure to be used with this job run. + * + * This must match the Glue API + * @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-common.html#aws-glue-api-regex-oneLine + * + * @default - Default configuration set in the job definition + */ + readonly securityConfiguration?: string; + + /** + * After a job run starts, the number of minutes to wait before sending a job run delay notification. + * + * Must be at least 1 minute. + * + * @default - Default delay set in the job definition + */ + readonly notifyDelayAfter?: Duration; +} + +/** + * Starts an AWS Glue job in a Task state + * + * OUTPUT: the output of this task is a JobRun structure, for details consult + * https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-runs.html#aws-glue-api-jobs-runs-JobRun + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-glue.html + */ +export class GlueStartJobRun extends sfn.TaskStateBase { + private static readonly SUPPORTED_INTEGRATION_PATTERNS: sfn.IntegrationPattern[] = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + sfn.IntegrationPattern.RUN_JOB, + ]; + + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: Construct, id: string, private readonly props: GlueStartJobRunProps) { + super(scope, id, props); + this.integrationPattern = props.integrationPattern ?? sfn.IntegrationPattern.REQUEST_RESPONSE; + + validatePatternSupported(this.integrationPattern, GlueStartJobRun.SUPPORTED_INTEGRATION_PATTERNS); + + this.taskPolicies = this.getPolicies(); + + this.taskMetrics = { + metricPrefixSingular: 'GlueJob', + metricPrefixPlural: 'GlueJobs', + metricDimensions: { GlueJobName: this.props.glueJobName }, + }; + } + + /** + * @internal + */ + protected _renderTask(): any { + const notificationProperty = this.props.notifyDelayAfter ? { NotifyDelayAfter: this.props.notifyDelayAfter.toMinutes() } : null; + + let timeout: number | undefined = undefined; + if (this.props.timeout) { + timeout = this.props.timeout.toMinutes(); + } else if (this.props.taskTimeout?.seconds) { + timeout = Duration.seconds(this.props.taskTimeout.seconds).toMinutes(); + } else if (this.props.taskTimeout?.path) { + timeout = sfn.JsonPath.numberAt(this.props.taskTimeout.path); + } + + return { + Resource: integrationResourceArn('glue', 'startJobRun', this.integrationPattern), + Parameters: sfn.FieldUtils.renderObject({ + JobName: this.props.glueJobName, + Arguments: this.props.arguments?.value, + Timeout: timeout, + SecurityConfiguration: this.props.securityConfiguration, + NotificationProperty: notificationProperty, + }), + TimeoutSeconds: undefined, + TimeoutSecondsPath: undefined, + }; + } + + private getPolicies(): iam.PolicyStatement[] { + let iamActions: string[] | undefined; + if (this.integrationPattern === sfn.IntegrationPattern.REQUEST_RESPONSE) { + iamActions = ['glue:StartJobRun']; + } else if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { + iamActions = [ + 'glue:StartJobRun', + 'glue:GetJobRun', + 'glue:GetJobRuns', + 'glue:BatchStopJobRun', + ]; + } + + return [new iam.PolicyStatement({ + resources: [ + Stack.of(this).formatArn({ + service: 'glue', + resource: 'job', + resourceName: this.props.glueJobName, + }), + ], + actions: iamActions, + })]; + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/index.ts diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/invoke-activity.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/invoke-activity.ts new file mode 100644 index 0000000000000..100e213681a31 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/invoke-activity.ts @@ -0,0 +1,40 @@ +import * as sfn from '../../aws-stepfunctions'; +import { Duration } from '../../core'; + +/** + * Properties for FunctionTask + * @deprecated use `StepFunctionsInvokeActivity` and `StepFunctionsInvokeActivityProps`. + */ +export interface InvokeActivityProps { + /** + * Maximum time between heart beats + * + * If the time between heart beats takes longer than this, a 'Timeout' error is raised. + * + * @default No heart beat timeout + */ + readonly heartbeat?: Duration; +} + +/** + * A Step Functions Task to invoke an Activity worker. + * + * An Activity can be used directly as a Resource. + * + * @deprecated use `StepFunctionsInvokeActivity` + */ +export class InvokeActivity implements sfn.IStepFunctionsTask { + constructor(private readonly activity: sfn.IActivity, private readonly props: InvokeActivityProps = {}) { + } + + public bind(_task: sfn.Task): sfn.StepFunctionsTaskConfig { + return { + resourceArn: this.activity.activityArn, + metricDimensions: { ActivityArn: this.activity.activityArn }, + heartbeat: this.props.heartbeat, + // No IAM permissions necessary, execution role implicitly has Activity permissions. + metricPrefixSingular: 'Activity', + metricPrefixPlural: 'Activities', + }; + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/invoke-function.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke-function.ts similarity index 90% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/invoke-function.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke-function.ts index 7df2b839f63c7..322a7c6522617 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/invoke-function.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke-function.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as sfn from '../../../aws-stepfunctions'; /** * Properties for InvokeFunction diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/invoke.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/invoke.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke.ts index 1d682e7db1cdf..d3554031b0d2d 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/invoke.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/run-lambda-task.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/run-lambda-task.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/run-lambda-task.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/run-lambda-task.ts index 830b30cc4ae3e..60326a61142cd 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/lambda/run-lambda-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/run-lambda-task.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as sfn from '../../../aws-stepfunctions'; import { getResourceArn } from '../resource-arn-suffix'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/private/task-utils.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/private/task-utils.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/private/task-utils.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/private/task-utils.ts index a0b28323c7e85..c62677fa56c57 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/private/task-utils.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/private/task-utils.ts @@ -1,7 +1,7 @@ import { IntegrationPattern, -} from '@aws-cdk/aws-stepfunctions'; -import { Aws } from '@aws-cdk/core'; +} from '../../../aws-stepfunctions'; +import { Aws } from '../../../core'; /** * Verifies that a validation pattern is supported for a service integration diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/resource-arn-suffix.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/resource-arn-suffix.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/resource-arn-suffix.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/resource-arn-suffix.ts index c0b669f0dc190..9999ac89157a5 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/resource-arn-suffix.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/resource-arn-suffix.ts @@ -1,5 +1,5 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Aws } from '@aws-cdk/core'; +import * as sfn from '../../aws-stepfunctions'; +import { Aws } from '../../core'; /** * Suffixes corresponding to different service integration patterns diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts new file mode 100644 index 0000000000000..611b1b70f2a0f --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts @@ -0,0 +1,964 @@ +import * as ec2 from '../../../aws-ec2'; +import * as ecr from '../../../aws-ecr'; +import { DockerImageAsset, DockerImageAssetProps } from '../../../aws-ecr-assets'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as s3 from '../../../aws-s3'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Size } from '../../../core'; +import { Construct } from 'constructs'; + +/** + * Task to train a machine learning model using Amazon SageMaker + */ +export interface ISageMakerTask extends iam.IGrantable {} + +/** + * Specify the training algorithm and algorithm-specific metadata + */ +export interface AlgorithmSpecification { + + /** + * Name of the algorithm resource to use for the training job. + * This must be an algorithm resource that you created or subscribe to on AWS Marketplace. + * If you specify a value for this parameter, you can't specify a value for TrainingImage. + * + * @default - No algorithm is specified + */ + readonly algorithmName?: string; + + /** + * List of metric definition objects. Each object specifies the metric name and regular expressions used to parse algorithm logs. + * + * @default - No metrics + */ + readonly metricDefinitions?: MetricDefinition[]; + + /** + * Registry path of the Docker image that contains the training algorithm. + * + * @default - No Docker image is specified + */ + readonly trainingImage?: DockerImage; + + /** + * Input mode that the algorithm supports. + * + * @default 'File' mode + */ + readonly trainingInputMode?: InputMode; +} + +/** + * Describes the training, validation or test dataset and the Amazon S3 location where it is stored. + * + */ +export interface Channel { + + /** + * Name of the channel + */ + readonly channelName: string; + + /** + * Compression type if training data is compressed + * + * @default - None + */ + readonly compressionType?: CompressionType; + + /** + * The MIME type of the data. + * + * @default - None + */ + readonly contentType?: string; + + /** + * Location of the channel data. + */ + readonly dataSource: DataSource; + + /** + * Input mode to use for the data channel in a training job. + * + * @default - None + */ + readonly inputMode?: InputMode; + + /** + * Specify RecordIO as the value when input data is in raw format but the training algorithm requires the RecordIO format. + * In this case, Amazon SageMaker wraps each individual S3 object in a RecordIO record. + * If the input data is already in RecordIO format, you don't need to set this attribute. + * + * @default - None + */ + readonly recordWrapperType?: RecordWrapperType; + + /** + * Shuffle config option for input data in a channel. + * + * @default - None + */ + readonly shuffleConfig?: ShuffleConfig; +} + +/** + * Configuration for a shuffle option for input data in a channel. + * + */ +export interface ShuffleConfig { + /** + * Determines the shuffling order. + */ + readonly seed: number; +} + +/** + * Location of the channel data. + * + */ +export interface DataSource { + /** + * S3 location of the data source that is associated with a channel. + */ + readonly s3DataSource: S3DataSource; +} + +/** + * S3 location of the channel data. + * + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_S3DataSource.html + * + */ +export interface S3DataSource { + /** + * List of one or more attribute names to use that are found in a specified augmented manifest file. + * + * @default - No attribute names + */ + readonly attributeNames?: string[]; + + /** + * S3 Data Distribution Type + * + * @default - None + */ + readonly s3DataDistributionType?: S3DataDistributionType; + + /** + * S3 Data Type + * + * @default S3_PREFIX + */ + readonly s3DataType?: S3DataType; + + /** + * S3 Uri + */ + readonly s3Location: S3Location; +} + +/** + * Configures the S3 bucket where SageMaker will save the result of model training + */ +export interface OutputDataConfig { + /** + * Optional KMS encryption key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption. + * + * @default - Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account + */ + readonly encryptionKey?: kms.IKey; + + /** + * Identifies the S3 path where you want Amazon SageMaker to store the model artifacts. + */ + readonly s3OutputLocation: S3Location; +} + +/** + * Specifies a limit to how long a model training job can run. + * When the job reaches the time limit, Amazon SageMaker ends the training job. + * + */ +export interface StoppingCondition { + /** + * The maximum length of time, in seconds, that the training or compilation job can run. + * + * @default - 1 hour + */ + readonly maxRuntime?: Duration; +} + +/** + * Specifies the resources, ML compute instances, and ML storage volumes to deploy for model training. + * + */ +export interface ResourceConfig { + + /** + * The number of ML compute instances to use. + * + * @default 1 instance. + */ + readonly instanceCount: number; + + /** + * ML compute instance type. + * + * To provide an instance type from the task input, supply an instance type in the following way + * where the value in the task input is an EC2 instance type prepended with "ml.": + * + * ```ts + * new ec2.InstanceType(sfn.JsonPath.stringAt('$.path.to.instanceType')); + * ``` + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ResourceConfig.html#sagemaker-Type-ResourceConfig-InstanceType + * + * @default ec2.InstanceType(ec2.InstanceClass.M4, ec2.InstanceType.XLARGE) + */ + readonly instanceType: ec2.InstanceType; + + /** + * KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job. + * + * @default - Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account + */ + readonly volumeEncryptionKey?: kms.IKey; + + /** + * Size of the ML storage volume that you want to provision. + * + * @default 10 GB EBS volume. + */ + readonly volumeSize: Size; +} + +/** + * Specifies the VPC that you want your Amazon SageMaker training job to connect to. + * + */ +export interface VpcConfig { + /** + * VPC + */ + readonly vpc: ec2.IVpc; + + /** + * VPC subnets. + * + * @default - Private Subnets are selected + */ + readonly subnets?: ec2.SubnetSelection; +} + +/** + * Specifies the metric name and regular expressions used to parse algorithm logs. + * + */ +export interface MetricDefinition { + + /** + * Name of the metric. + */ + readonly name: string; + + /** + * Regular expression that searches the output of a training job and gets the value of the metric. + */ + readonly regex: string; +} + +/** + * Stores information about the location of an object in Amazon S3 + * + */ +export interface S3LocationConfig { + + /** + * Uniquely identifies the resource in Amazon S3 + */ + readonly uri: string; +} + +/** + * Constructs `IS3Location` objects. + * + */ +export abstract class S3Location { + /** + * An `IS3Location` built with a determined bucket and key prefix. + * + * @param bucket is the bucket where the objects are to be stored. + * @param keyPrefix is the key prefix used by the location. + */ + public static fromBucket(bucket: s3.IBucket, keyPrefix: string): S3Location { + return new StandardS3Location({ bucket, keyPrefix, uri: bucket.urlForObject(keyPrefix) }); + } + + /** + * An `IS3Location` determined fully by a JSON Path from the task input. + * + * Due to the dynamic nature of those locations, the IAM grants that will be set by `grantRead` and `grantWrite` + * apply to the `*` resource. + * + * @param expression the JSON expression resolving to an S3 location URI. + */ + public static fromJsonExpression(expression: string): S3Location { + return new StandardS3Location({ uri: sfn.JsonPath.stringAt(expression) }); + } + + /** + * Called when the S3Location is bound to a StepFunctions task. + */ + public abstract bind(task: ISageMakerTask, opts: S3LocationBindOptions): S3LocationConfig; +} + +/** + * Options for binding an S3 Location. + * + */ +export interface S3LocationBindOptions { + /** + * Allow reading from the S3 Location. + * + * @default false + */ + readonly forReading?: boolean; + + /** + * Allow writing to the S3 Location. + * + * @default false + */ + readonly forWriting?: boolean; +} + +/** + * Configuration for a using Docker image. + * + */ +export interface DockerImageConfig { + /** + * The fully qualified URI of the Docker image. + */ + readonly imageUri: string; +} + +/** + * Creates `IDockerImage` instances. + * + */ +export abstract class DockerImage { + /** + * Reference a Docker image stored in an ECR repository. + * + * @param repository the ECR repository where the image is hosted. + * @param tagOrDigest an optional tag or digest (digests must start with `sha256:`) + */ + public static fromEcrRepository(repository: ecr.IRepository, tagOrDigest: string = 'latest'): DockerImage { + return new StandardDockerImage({ repository, imageUri: repository.repositoryUriForTagOrDigest(tagOrDigest) }); + } + + /** + * Reference a Docker image which URI is obtained from the task's input. + * + * @param expression the JSON path expression with the task input. + * @param allowAnyEcrImagePull whether ECR access should be permitted (set to `false` if the image will never be in ECR). + */ + public static fromJsonExpression(expression: string, allowAnyEcrImagePull = true): DockerImage { + return new StandardDockerImage({ imageUri: expression, allowAnyEcrImagePull }); + } + + /** + * Reference a Docker image by it's URI. + * + * When referencing ECR images, prefer using `inEcr`. + * + * @param imageUri the URI to the docker image. + */ + public static fromRegistry(imageUri: string): DockerImage { + return new StandardDockerImage({ imageUri }); + } + + /** + * Reference a Docker image that is provided as an Asset in the current app. + * + * @param scope the scope in which to create the Asset. + * @param id the ID for the asset in the construct tree. + * @param props the configuration props of the asset. + */ + public static fromAsset(scope: Construct, id: string, props: DockerImageAssetProps): DockerImage { + const asset = new DockerImageAsset(scope, id, props); + return new StandardDockerImage({ repository: asset.repository, imageUri: asset.imageUri }); + } + + /** + * Called when the image is used by a SageMaker task. + */ + public abstract bind(task: ISageMakerTask): DockerImageConfig; +} + +/** + * S3 Data Type. + * + */ +export enum S3DataType { + /** + * Manifest File Data Type + */ + MANIFEST_FILE = 'ManifestFile', + + /** + * S3 Prefix Data Type + */ + S3_PREFIX = 'S3Prefix', + + /** + * Augmented Manifest File Data Type + */ + AUGMENTED_MANIFEST_FILE = 'AugmentedManifestFile' +} + +/** + * S3 Data Distribution Type. + * + */ +export enum S3DataDistributionType { + /** + * Fully replicated S3 Data Distribution Type + */ + FULLY_REPLICATED = 'FullyReplicated', + + /** + * Sharded By S3 Key Data Distribution Type + */ + SHARDED_BY_S3_KEY = 'ShardedByS3Key' +} + +/** + * Define the format of the input data. + * + */ +export enum RecordWrapperType { + /** + * None record wrapper type + */ + NONE = 'None', + + /** + * RecordIO record wrapper type + */ + RECORD_IO = 'RecordIO' +} + +/** + * Input mode that the algorithm supports. + * + */ +export enum InputMode { + /** + * Pipe mode + */ + PIPE = 'Pipe', + + /** + * File mode. + */ + FILE = 'File' +} + +/** + * Compression type of the data. + * + */ +export enum CompressionType { + /** + * None compression type + */ + NONE = 'None', + + /** + * Gzip compression type + */ + GZIP = 'Gzip' +} + +// +// Create Transform Job types +// + +/** + * Configures the timeout and maximum number of retries for processing a transform job invocation. + * + */ +export interface ModelClientOptions { + + /** + * The maximum number of retries when invocation requests are failing. + * + * @default 0 + */ + readonly invocationsMaxRetries?: number; + + /** + * The timeout duration for an invocation request. + * + * @default Duration.minutes(1) + */ + readonly invocationsTimeout?: Duration; +} + +/** + * Dataset to be transformed and the Amazon S3 location where it is stored. + * + */ +export interface TransformInput { + + /** + * The compression type of the transform data. + * + * @default NONE + */ + readonly compressionType?: CompressionType; + + /** + * Multipurpose internet mail extension (MIME) type of the data. + * + * @default - None + */ + readonly contentType?: string; + + /** + * S3 location of the channel data + */ + readonly transformDataSource: TransformDataSource; + + /** + * Method to use to split the transform job's data files into smaller batches. + * + * @default NONE + */ + readonly splitType?: SplitType; +} + +/** + * S3 location of the input data that the model can consume. + * + */ +export interface TransformDataSource { + + /** + * S3 location of the input data + */ + readonly s3DataSource: TransformS3DataSource; +} + +/** + * Location of the channel data. + * + */ +export interface TransformS3DataSource { + + /** + * S3 Data Type + * + * @default 'S3Prefix' + */ + readonly s3DataType?: S3DataType; + + /** + * Identifies either a key name prefix or a manifest. + */ + readonly s3Uri: string; +} + +/** + * S3 location where you want Amazon SageMaker to save the results from the transform job. + * + */ +export interface TransformOutput { + + /** + * MIME type used to specify the output data. + * + * @default - None + */ + readonly accept?: string; + + /** + * Defines how to assemble the results of the transform job as a single S3 object. + * + * @default - None + */ + readonly assembleWith?: AssembleWith; + + /** + * AWS KMS key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption. + * + * @default - default KMS key for Amazon S3 for your role's account. + */ + readonly encryptionKey?: kms.IKey; + + /** + * S3 path where you want Amazon SageMaker to store the results of the transform job. + */ + readonly s3OutputPath: string; +} + +/** + * ML compute instances for the transform job. + * + */ +export interface TransformResources { + + /** + * Number of ML compute instances to use in the transform job + */ + readonly instanceCount: number; + + /** + * ML compute instance type for the transform job. + */ + readonly instanceType: ec2.InstanceType; + + /** + * AWS KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s). + * + * @default - None + */ + readonly volumeEncryptionKey?: kms.IKey; +} + +/** + * Properties to define a ContainerDefinition + * + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html + */ +export interface ContainerDefinitionOptions { + /** + * The Amazon EC2 Container Registry (Amazon ECR) path where inference code is stored. + * + * @default - None + */ + readonly image?: DockerImage; + /** + * The environment variables to set in the Docker container + * + * @default - No variables + */ + readonly environmentVariables?: sfn.TaskInput; + /** + * The name or Amazon Resource Name (ARN) of the model package to use to create the model. + * + * @default - None + */ + readonly modelPackageName?: string; + /** + * Defines how many models the container hosts + * + * @default - Mode.SINGLE_MODEL + */ + readonly mode?: Mode; + /** + * This parameter is ignored for models that contain only a PrimaryContainer. + * When a ContainerDefinition is part of an inference pipeline, + * the value of the parameter uniquely identifies the container for the purposes of logging and metrics. + * + * @default - None + */ + readonly containerHostName?: string; + /** + * The S3 path where the model artifacts, which result from model training, are stored. + * This path must point to a single gzip compressed tar archive (.tar.gz suffix). + * The S3 path is required for Amazon SageMaker built-in algorithms, but not if you use your own algorithms. + * + * @default - None + */ + readonly modelS3Location?: S3Location; +} + +/** + * Describes the container, as part of model definition. + * + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html + */ +export class ContainerDefinition implements IContainerDefinition { + + constructor(private readonly options: ContainerDefinitionOptions) {} + + /** + * Called when the ContainerDefinition type configured on Sagemaker Task + */ + public bind(task: ISageMakerTask): ContainerDefinitionConfig { + return { + parameters: { + ContainerHostname: this.options.containerHostName, + Image: this.options.image?.bind(task).imageUri, + Mode: this.options.mode, + ModelDataUrl: this.options.modelS3Location?.bind(task, { forReading: true }).uri, + ModelPackageName: this.options.modelPackageName, + Environment: this.options.environmentVariables?.value, + }, + }; + } +} + +/** + * Configuration of the container used to host the model + * + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ContainerDefinition.html + */ +export interface IContainerDefinition { + /** + * Called when the ContainerDefinition is used by a SageMaker task. + */ + bind(task: ISageMakerTask): ContainerDefinitionConfig; +} + +/** + * Configuration options for the ContainerDefinition + */ +export interface ContainerDefinitionConfig { + /** + * Additional parameters to pass to the base task + * + * @default - No additional parameters passed + */ + readonly parameters?: { [key: string]: any }; +} + +/** + * Specifies how many models the container hosts + * + */ +export enum Mode { + /** + * Container hosts a single model + */ + SINGLE_MODEL = 'SingleModel', + /** + * Container hosts multiple models + * + * @see https://docs.aws.amazon.com/sagemaker/latest/dg/multi-model-endpoints.html + */ + MULTI_MODEL = 'MultiModel', +} + +/** + * Identifies a model that you want to host and the resources to deploy for hosting it. + * + * @see https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ProductionVariant.html + */ +export interface ProductionVariant { + /** + * The size of the Elastic Inference (EI) instance to use for the production variant. + * + * @default - None + */ + readonly acceleratorType?: AcceleratorType; + /** + * Number of instances to launch initially. + * + * @default - 1 + */ + readonly initialInstanceCount?: number; + /** + * Determines initial traffic distribution among all of the models that you specify in the endpoint configuration. + * + * @default - 1.0 + */ + readonly initialVariantWeight?: number; + /** + * The ML compute instance type + */ + readonly instanceType: ec2.InstanceType; + /** + * The name of the production variant. + */ + readonly variantName: string; + /** + * The name of the model that you want to host. This is the name that you specified when creating the model. + */ + readonly modelName: string; +} + +/** + * The generation of Elastic Inference (EI) instance + * + * @see https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html + */ +export class AcceleratorClass { + /** + * Elastic Inference accelerator 1st generation + */ + public static readonly EIA1 = AcceleratorClass.of('eia1'); + /** + * Elastic Inference accelerator 2nd generation + */ + public static readonly EIA2 = AcceleratorClass.of('eia2'); + /** + * Custom AcceleratorType + * @param version - Elastic Inference accelerator generation + */ + public static of(version: string) { return new AcceleratorClass(version); } + /** + * @param version - Elastic Inference accelerator generation + */ + private constructor(public readonly version: string) { } +} + +/** + * The size of the Elastic Inference (EI) instance to use for the production variant. + * EI instances provide on-demand GPU computing for inference + * + * @see https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html + */ +export class AcceleratorType { + /** + * AcceleratorType + * + * This class takes a combination of a class and size. + */ + public static of(acceleratorClass: AcceleratorClass, instanceSize: ec2.InstanceSize) { + return new AcceleratorType(`ml.${acceleratorClass}.${instanceSize}`); + } + + constructor(private readonly instanceTypeIdentifier: string) { + } + + /** + * Return the accelerator type as a dotted string + */ + public toString(): string { + return this.instanceTypeIdentifier; + } +} + +/** + * Specifies the number of records to include in a mini-batch for an HTTP inference request. + * + */ +export enum BatchStrategy { + + /** + * Fits multiple records in a mini-batch. + */ + MULTI_RECORD = 'MultiRecord', + + /** + * Use a single record when making an invocation request. + */ + SINGLE_RECORD = 'SingleRecord' +} + +/** + * Method to use to split the transform job's data files into smaller batches. + * + */ +export enum SplitType { + + /** + * Input data files are not split, + */ + NONE = 'None', + + /** + * Split records on a newline character boundary. + */ + LINE = 'Line', + + /** + * Split using MXNet RecordIO format. + */ + RECORD_IO = 'RecordIO', + + /** + * Split using TensorFlow TFRecord format. + */ + TF_RECORD = 'TFRecord' +} + +/** + * How to assemble the results of the transform job as a single S3 object. + * + */ +export enum AssembleWith { + + /** + * Concatenate the results in binary format. + */ + NONE = 'None', + + /** + * Add a newline character at the end of every transformed record. + */ + LINE = 'Line' + +} + +class StandardDockerImage extends DockerImage { + private readonly allowAnyEcrImagePull: boolean; + private readonly imageUri: string; + private readonly repository?: ecr.IRepository; + + constructor(opts: { allowAnyEcrImagePull?: boolean, imageUri: string, repository?: ecr.IRepository }) { + super(); + + this.allowAnyEcrImagePull = !!opts.allowAnyEcrImagePull; + this.imageUri = opts.imageUri; + this.repository = opts.repository; + } + + public bind(task: ISageMakerTask): DockerImageConfig { + if (this.repository) { + this.repository.grantPull(task); + } + if (this.allowAnyEcrImagePull) { + task.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ + actions: [ + 'ecr:BatchCheckLayerAvailability', + 'ecr:GetDownloadUrlForLayer', + 'ecr:BatchGetImage', + ], + resources: ['*'], + })); + } + return { + imageUri: this.imageUri, + }; + } +} + +class StandardS3Location extends S3Location { + private readonly bucket?: s3.IBucket; + private readonly keyGlob: string; + private readonly uri: string; + + constructor(opts: { bucket?: s3.IBucket, keyPrefix?: string, uri: string }) { + super(); + this.bucket = opts.bucket; + this.keyGlob = `${opts.keyPrefix || ''}*`; + this.uri = opts.uri; + } + + public bind(task: ISageMakerTask, opts: S3LocationBindOptions): S3LocationConfig { + if (this.bucket) { + if (opts.forReading) { + this.bucket.grantRead(task, this.keyGlob); + } + if (opts.forWriting) { + this.bucket.grantWrite(task, this.keyGlob); + } + } else { + const actions = new Array(); + if (opts.forReading) { + actions.push('s3:GetObject', 's3:ListBucket'); + } + if (opts.forWriting) { + actions.push('s3:PutObject'); + } + task.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ actions, resources: ['*'] })); + } + return { uri: this.uri }; + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts index 9952aab950d95..41efd2e283e9e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { ProductionVariant } from './base-types'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts index 6e46a7c129772..8171c6f2f1eca 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts index 860ff3f5cb5d0..181724c6f6712 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-model.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { IContainerDefinition } from './base-types'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts index eff3cd1163ab5..a0d5c3d51f2d9 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-training-job.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration, Lazy, Size, Stack } from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Lazy, Size, Stack } from '../../../core'; import { Construct } from 'constructs'; import { AlgorithmSpecification, Channel, InputMode, OutputDataConfig, ResourceConfig, S3DataType, StoppingCondition, VpcConfig } from './base-types'; import { renderEnvironment, renderTags } from './private/utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts index b07e8ed64192e..0ac6fbceb122e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/create-transform-job.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Size, Stack, Token } from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Size, Stack, Token } from '../../../core'; import { Construct } from 'constructs'; import { BatchStrategy, ModelClientOptions, S3DataType, TransformInput, TransformOutput, TransformResources } from './base-types'; import { renderEnvironment, renderTags } from './private/utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/private/utils.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts index 7d42a24c80714..efa2307725e7b 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/update-endpoint.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sns/publish-to-topic.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish-to-topic.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sns/publish-to-topic.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish-to-topic.ts index bc07f33b2bc9b..2d1d0df750543 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sns/publish-to-topic.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish-to-topic.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as iam from '../../../aws-iam'; +import * as sns from '../../../aws-sns'; +import * as sfn from '../../../aws-stepfunctions'; import { getResourceArn } from '../resource-arn-suffix'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sns/publish.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sns/publish.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish.ts index 8c37c35c9b9f9..23ee5cf8c3ef7 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sns/publish.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sns/publish.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sns from '@aws-cdk/aws-sns'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Token } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sns from '../../../aws-sns'; +import * as sfn from '../../../aws-stepfunctions'; +import { Token } from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sqs/send-message.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-message.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sqs/send-message.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-message.ts index 16a01bba5d05f..4720447d50be2 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sqs/send-message.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-message.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sqs from '../../../aws-sqs'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts index 36c1d1e7ac6be..f1ebe96dd76e6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sqs/send-to-queue.ts @@ -1,7 +1,7 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Duration } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sqs from '../../../aws-sqs'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration } from '../../../core'; import { getResourceArn } from '../resource-arn-suffix'; /** diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/start-execution.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/start-execution.ts new file mode 100644 index 0000000000000..e455cdc890fea --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/start-execution.ts @@ -0,0 +1,123 @@ +import * as iam from '../../aws-iam'; +import * as sfn from '../../aws-stepfunctions'; +import { ArnFormat, Stack } from '../../core'; +import { getResourceArn } from './resource-arn-suffix'; + +/** + * Properties for StartExecution + * + * @deprecated - use 'StepFunctionsStartExecution' + */ +export interface StartExecutionProps { + /** + * The JSON input for the execution, same as that of StartExecution. + * + * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html + * + * @default - No input + */ + readonly input?: { [key: string]: any }; + + /** + * The name of the execution, same as that of StartExecution. + * + * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html + * + * @default - None + */ + readonly name?: string; + + /** + * The service integration pattern indicates different ways to call StartExecution to Step Functions. + * + * @default FIRE_AND_FORGET + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html + */ + readonly integrationPattern?: sfn.ServiceIntegrationPattern; +} + +/** + * A Step Functions Task to call StartExecution on another state machine. + * + * It supports three service integration patterns: FIRE_AND_FORGET, SYNC and WAIT_FOR_TASK_TOKEN. + * + * @deprecated - use 'StepFunctionsStartExecution' + */ +export class StartExecution implements sfn.IStepFunctionsTask { + private readonly integrationPattern: sfn.ServiceIntegrationPattern; + + constructor(private readonly stateMachine: sfn.IStateMachine, private readonly props: StartExecutionProps = {}) { + this.integrationPattern = props.integrationPattern || sfn.ServiceIntegrationPattern.FIRE_AND_FORGET; + + const supportedPatterns = [ + sfn.ServiceIntegrationPattern.FIRE_AND_FORGET, + sfn.ServiceIntegrationPattern.SYNC, + sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, + ]; + + if (!supportedPatterns.includes(this.integrationPattern)) { + throw new Error(`Invalid Service Integration Pattern: ${this.integrationPattern} is not supported to call Step Functions.`); + } + + if (this.integrationPattern === sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN + && !sfn.FieldUtils.containsTaskToken(props.input)) { + throw new Error('Task Token is missing in input (pass JsonPath.taskToken somewhere in input)'); + } + } + + public bind(task: sfn.Task): sfn.StepFunctionsTaskConfig { + return { + resourceArn: getResourceArn('states', 'startExecution', this.integrationPattern), + policyStatements: this.createScopedAccessPolicy(task), + parameters: { + Input: this.props.input, + StateMachineArn: this.stateMachine.stateMachineArn, + Name: this.props.name, + }, + }; + } + + /** + * As StateMachineArn is extracted automatically from the state machine object included in the constructor, + * + * the scoped access policy should be generated accordingly. + * + * This means the action of StartExecution should be restricted on the given state machine, instead of being granted to all the resources (*). + */ + private createScopedAccessPolicy(task: sfn.Task): iam.PolicyStatement[] { + const stack = Stack.of(task); + + const policyStatements = [ + new iam.PolicyStatement({ + actions: ['states:StartExecution'], + resources: [this.stateMachine.stateMachineArn], + }), + ]; + + // Step Functions use Cloud Watch managed rules to deal with synchronous tasks. + if (this.integrationPattern === sfn.ServiceIntegrationPattern.SYNC) { + policyStatements.push(new iam.PolicyStatement({ + actions: ['states:DescribeExecution', 'states:StopExecution'], + // https://docs.aws.amazon.com/step-functions/latest/dg/concept-create-iam-advanced.html#concept-create-iam-advanced-execution + resources: [stack.formatArn({ + service: 'states', + resource: 'execution', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + resourceName: `${stack.splitArn(this.stateMachine.stateMachineArn, ArnFormat.COLON_RESOURCE_NAME).resourceName}*`, + })], + })); + + policyStatements.push(new iam.PolicyStatement({ + actions: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], + resources: [stack.formatArn({ + service: 'events', + resource: 'rule', + resourceName: 'StepFunctionsGetEventsForStepFunctionsExecutionRule', + })], + })); + } + + return policyStatements; + } +} diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/stepfunctions/invoke-activity.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/stepfunctions/invoke-activity.ts new file mode 100644 index 0000000000000..08ab3c3e3f696 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/stepfunctions/invoke-activity.ts @@ -0,0 +1,54 @@ +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { Construct } from 'constructs'; + +/** + * Properties for invoking an Activity worker + */ +export interface StepFunctionsInvokeActivityProps extends sfn.TaskStateBaseProps { + + /** + * Step Functions Activity to invoke + */ + readonly activity: sfn.IActivity + + /** + * Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input. + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters + * + * @default No parameters + */ + readonly parameters?: { [name: string]: any }; +} + +/** + * A Step Functions Task to invoke an Activity worker. + * + * An Activity can be used directly as a Resource. + */ +export class StepFunctionsInvokeActivity extends sfn.TaskStateBase { + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + // No IAM permissions necessary, execution role implicitly has Activity permissions. + protected readonly taskPolicies?: iam.PolicyStatement[]; + + constructor(scope: Construct, id: string, private readonly props: StepFunctionsInvokeActivityProps) { + super(scope, id, props); + + this.taskMetrics = { + metricDimensions: { ActivityArn: this.props.activity.activityArn }, + metricPrefixSingular: 'Activity', + metricPrefixPlural: 'Activities', + }; + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: this.props.activity.activityArn, + Parameters: this.props.parameters ? sfn.FieldUtils.renderObject(this.props.parameters) : undefined, + }; + } +} diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/stepfunctions/start-execution.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/stepfunctions/start-execution.ts new file mode 100644 index 0000000000000..67992982a699f --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/stepfunctions/start-execution.ts @@ -0,0 +1,159 @@ +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import { ArnFormat, Stack } from '../../../core'; +import { Construct } from 'constructs'; +import { integrationResourceArn, validatePatternSupported } from '../private/task-utils'; + +/** + * Properties for StartExecution + */ +export interface StepFunctionsStartExecutionProps extends sfn.TaskStateBaseProps { + /** + * The Step Functions state machine to start the execution on. + */ + readonly stateMachine: sfn.IStateMachine; + + /** + * The JSON input for the execution, same as that of StartExecution. + * + * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html + * + * @default - The state input (JSON path '$') + */ + readonly input?: sfn.TaskInput; + + /** + * The name of the execution, same as that of StartExecution. + * + * @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html + * + * @default - None + */ + readonly name?: string; + + /** + * Pass the execution ID from the context object to the execution input. + * This allows the Step Functions UI to link child executions from parent executions, making it easier to trace execution flow across state machines. + * + * If you set this property to `true`, the `input` property must be an object (provided by `sfn.TaskInput.fromObject`) or omitted entirely. + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-nested-workflows.html#nested-execution-startid + * + * @default - false + */ + readonly associateWithParent?: boolean; +} + +/** + * A Step Functions Task to call StartExecution on another state machine. + * + * It supports three service integration patterns: REQUEST_RESPONSE, RUN_JOB, and WAIT_FOR_TASK_TOKEN. + */ +export class StepFunctionsStartExecution extends sfn.TaskStateBase { + private static readonly SUPPORTED_INTEGRATION_PATTERNS = [ + sfn.IntegrationPattern.REQUEST_RESPONSE, + sfn.IntegrationPattern.RUN_JOB, + sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + ]; + + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + + private readonly integrationPattern: sfn.IntegrationPattern; + + constructor(scope: Construct, id: string, private readonly props: StepFunctionsStartExecutionProps) { + super(scope, id, props); + + this.integrationPattern = props.integrationPattern || sfn.IntegrationPattern.REQUEST_RESPONSE; + validatePatternSupported(this.integrationPattern, StepFunctionsStartExecution.SUPPORTED_INTEGRATION_PATTERNS); + + if (this.integrationPattern === sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN && !sfn.FieldUtils.containsTaskToken(props.input)) { + throw new Error('Task Token is required in `input` for callback. Use JsonPath.taskToken to set the token.'); + } + + if (this.props.associateWithParent && props.input && props.input.type !== sfn.InputType.OBJECT) { + throw new Error('Could not enable `associateWithParent` because `input` is taken directly from a JSON path. Use `sfn.TaskInput.fromObject` instead.'); + } + + this.taskPolicies = this.createScopedAccessPolicy(); + } + + /** + * @internal + */ + protected _renderTask(): any { + // suffix of ':2' indicates that the output of the nested state machine should be JSON + // suffix is only applicable when waiting for a nested state machine to complete (RUN_JOB) + // https://docs.aws.amazon.com/step-functions/latest/dg/connect-stepfunctions.html + const suffix = this.integrationPattern === sfn.IntegrationPattern.RUN_JOB ? ':2' : ''; + let input: any; + if (this.props.associateWithParent) { + const associateWithParentEntry = { + AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID: sfn.JsonPath.stringAt('$$.Execution.Id'), + }; + input = this.props.input ? { ...this.props.input.value, ...associateWithParentEntry } : associateWithParentEntry; + } else { + input = this.props.input ? this.props.input.value: sfn.TaskInput.fromJsonPathAt('$').value; + } + + return { + Resource: `${integrationResourceArn('states', 'startExecution', this.integrationPattern)}${suffix}`, + Parameters: sfn.FieldUtils.renderObject({ + Input: input, + StateMachineArn: this.props.stateMachine.stateMachineArn, + Name: this.props.name, + }), + }; + } + + /** + * As StateMachineArn is extracted automatically from the state machine object included in the constructor, + * + * the scoped access policy should be generated accordingly. + * + * This means the action of StartExecution should be restricted on the given state machine, instead of being granted to all the resources (*). + */ + private createScopedAccessPolicy(): iam.PolicyStatement[] { + const stack = Stack.of(this); + + const policyStatements = [ + new iam.PolicyStatement({ + actions: ['states:StartExecution'], + resources: [this.props.stateMachine.stateMachineArn], + }), + ]; + + // Step Functions use Cloud Watch managed rules to deal with synchronous tasks. + if (this.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { + policyStatements.push( + new iam.PolicyStatement({ + actions: ['states:DescribeExecution', 'states:StopExecution'], + // https://docs.aws.amazon.com/step-functions/latest/dg/concept-create-iam-advanced.html#concept-create-iam-advanced-execution + resources: [ + stack.formatArn({ + service: 'states', + resource: 'execution', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + resourceName: `${stack.splitArn(this.props.stateMachine.stateMachineArn, ArnFormat.COLON_RESOURCE_NAME).resourceName}*`, + }), + ], + }), + ); + + policyStatements.push( + new iam.PolicyStatement({ + actions: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], + resources: [ + stack.formatArn({ + service: 'events', + resource: 'rule', + resourceName: 'StepFunctionsGetEventsForStepFunctionsExecutionRule', + }), + ], + }), + ); + } + + return policyStatements; + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/apigateway/call-rest-api.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/apigateway/call-rest-api.test.ts index f47ca69e0dc0a..ff3349acd43ec 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/apigateway/call-rest-api.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/apigateway/call-rest-api.test.ts @@ -1,6 +1,6 @@ -import * as apigateway from '@aws-cdk/aws-apigateway'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as apigateway from '../../../aws-apigateway'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { HttpMethod, CallApiGatewayRestApiEndpoint } from '../../lib'; describe('CallApiGatewayRestApiEndpoint', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/get-query-execution.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/get-query-execution.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/get-query-execution.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/get-query-execution.test.ts index 3be50b20ec124..6b1b3f26dcb4e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/get-query-execution.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/get-query-execution.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { AthenaGetQueryExecution } from '../../lib/athena/get-query-execution'; describe('Get Query Execution', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/get-query-results.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/get-query-results.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/get-query-results.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/get-query-results.test.ts index 78ecc236bf363..db0476f5c2631 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/get-query-results.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/get-query-results.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { AthenaGetQueryResults } from '../../lib/athena/get-query-results'; describe('Get Query Results', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts index 5efe5525e9a99..f1b82866521df 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/start-query-execution.test.ts @@ -1,6 +1,6 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { AthenaStartQueryExecution, EncryptionOption } from '../../lib/athena/start-query-execution'; describe('Start Query Execution', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/stop-query-execution.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/stop-query-execution.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/stop-query-execution.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/stop-query-execution.test.ts index 69c5f215865b1..cf22a8c05090a 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/athena/stop-query-execution.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/athena/stop-query-execution.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { AthenaStopQueryExecution } from '../../lib/athena/stop-query-execution'; describe('Stop Query Execution', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts index df4f5bc0681f2..cce87e2739337 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/batch/batchjob-image/Dockerfile b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/batch/batchjob-image/Dockerfile new file mode 100644 index 0000000000000..235b30e9661ed --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/batch/batchjob-image/Dockerfile @@ -0,0 +1,5 @@ +FROM public.ecr.aws/lambda/python:3.6 +EXPOSE 8000 +WORKDIR /src +ADD . /src +CMD python3 index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/batchjob-image/index.py b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/batch/batchjob-image/index.py similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/batch/batchjob-image/index.py rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/batch/batchjob-image/index.py diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/start-build.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/codebuild/start-build.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/start-build.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/codebuild/start-build.test.ts index 0c71117392c5e..62630a6532f91 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/start-build.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/codebuild/start-build.test.ts @@ -1,6 +1,6 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as codebuild from '../../../aws-codebuild'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { CodeBuildStartBuild } from '../../lib'; let stack: cdk.Stack; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/databrew/start-job-run.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/databrew/start-job-run.test.ts new file mode 100644 index 0000000000000..37da51a96bea2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/databrew/start-job-run.test.ts @@ -0,0 +1,114 @@ +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; +import { GlueDataBrewStartJobRun } from '../../lib/databrew/start-job-run'; + +describe('Start Job Run', () => { + + test('default settings', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const task = new GlueDataBrewStartJobRun(stack, 'JobRun', { + name: 'jobName', + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::databrew:startJobRun', + ], + ], + }, + End: true, + Parameters: { + Name: 'jobName', + }, + }); + }); + + test('create job with input from task', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const task = new GlueDataBrewStartJobRun(stack, 'JobRun', { + name: sfn.JsonPath.stringAt('$.Name'), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::databrew:startJobRun', + ], + ], + }, + End: true, + Parameters: { + 'Name.$': '$.Name', + }, + }); + }); + + test('sync integrationPattern', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const task = new GlueDataBrewStartJobRun(stack, 'JobRun', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + name: 'jobName', + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::databrew:startJobRun.sync', + ], + ], + }, + End: true, + Parameters: { + Name: 'jobName', + }, + }); + }); + + + test('wait_for_task_token integrationPattern throws an error', () => { + // GIVEN + const stack = new cdk.Stack(); + + expect(() => { + new GlueDataBrewStartJobRun(stack, 'JobRun', { + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + name: 'jobName', + }); + }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE,RUN_JOB. Received: WAIT_FOR_TASK_TOKEN/i); + }); +}); + diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/delete-item.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/delete-item.test.ts similarity index 92% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/delete-item.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/delete-item.test.ts index 4a278249f4585..542db28832064 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/delete-item.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/delete-item.test.ts @@ -1,6 +1,6 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts index f5e5d7c76bd2a..fe8d6f96a0d78 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/get-item.test.ts @@ -1,6 +1,6 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/put-item.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/put-item.test.ts similarity index 93% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/put-item.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/put-item.test.ts index 1164a269522d1..7462ae0d1a3af 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/put-item.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/put-item.test.ts @@ -1,6 +1,6 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/shared-types.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/shared-types.test.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/shared-types.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/shared-types.test.ts index a882fb9f99b2b..5462f2285da9b 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/shared-types.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/shared-types.test.ts @@ -1,4 +1,4 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as sfn from '../../../aws-stepfunctions'; import * as tasks from '../../lib'; describe('DynamoProjectionExpression', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/update-item.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/update-item.test.ts similarity index 93% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/update-item.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/update-item.test.ts index 9a4eb3cbcb66a..ee94d106b87b4 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/update-item.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/dynamodb/update-item.test.ts @@ -1,6 +1,6 @@ -import * as ddb from '@aws-cdk/aws-dynamodb'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ddb from '../../../aws-dynamodb'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/ecs-tasks.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/ecs-tasks.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/ecs-tasks.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/ecs-tasks.test.ts index 10cb159a891dc..ab2548b9d8605 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/ecs-tasks.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/ecs-tasks.test.ts @@ -1,10 +1,10 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import { Template } from '../../../assertions'; +import * as autoscaling from '../../../aws-autoscaling'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as sfn from '../../../aws-stepfunctions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import * as tasks from '../../lib'; let stack: Stack; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile new file mode 100644 index 0000000000000..235b30e9661ed --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/eventhandler-image/Dockerfile @@ -0,0 +1,5 @@ +FROM public.ecr.aws/lambda/python:3.6 +EXPOSE 8000 +WORKDIR /src +ADD . /src +CMD python3 index.py diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py new file mode 100644 index 0000000000000..c4cab119afc2d --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/eventhandler-image/index.py @@ -0,0 +1,6 @@ +#!/usr/bin/python +import os +import pprint + +print('Hello from ECS!') +pprint.pprint(dict(os.environ)) diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts index a4074a7869d03..a7bfe67285af5 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/ecs/run-tasks.test.ts @@ -1,9 +1,9 @@ -import { Template } from '@aws-cdk/assertions'; -import * as autoscaling from '@aws-cdk/aws-autoscaling'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecs from '@aws-cdk/aws-ecs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as autoscaling from '../../../aws-autoscaling'; +import * as ec2 from '../../../aws-ec2'; +import * as ecs from '../../../aws-ecs'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import * as tasks from '../../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/call.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eks/call.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/call.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eks/call.test.ts index 98445c41c8bcd..807318c9f6db6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eks/call.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eks/call.test.ts @@ -1,6 +1,6 @@ -import * as eks from '@aws-cdk/aws-eks'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import * as eks from '../../../aws-eks'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { EksCall, HttpMethods } from '../../lib/eks/call'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-add-step.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-add-step.test.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-add-step.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-add-step.test.ts index 4f2c2f9c2b2d6..d6678cb09b9d9 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-add-step.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-add-step.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-cancel-step.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-cancel-step.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-cancel-step.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-cancel-step.test.ts index 16cfac3d07327..812a8fdfac616 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-cancel-step.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-cancel-step.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-create-cluster.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-create-cluster.test.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-create-cluster.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-create-cluster.test.ts index 9acaae07abae3..31195ba5c4776 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-create-cluster.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-create-cluster.test.ts @@ -1,9 +1,9 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; // eslint-disable-next-line import/no-extraneous-dependencies -import { ENABLE_EMR_SERVICE_POLICY_V2 } from '@aws-cdk/cx-api'; +import { ENABLE_EMR_SERVICE_POLICY_V2 } from '../../../cx-api'; import { EmrCreateCluster } from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-modify-instance-fleet-by-name.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-modify-instance-fleet-by-name.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-modify-instance-fleet-by-name.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-modify-instance-fleet-by-name.test.ts index 33fc2a2f14f81..f64864ba6ae71 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-modify-instance-fleet-by-name.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-modify-instance-fleet-by-name.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-modify-instance-group-by-name.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-modify-instance-group-by-name.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-modify-instance-group-by-name.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-modify-instance-group-by-name.test.ts index 4a44d0d64cd29..d38b820502d2d 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-modify-instance-group-by-name.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-modify-instance-group-by-name.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-set-cluster-termination-protection.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-set-cluster-termination-protection.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-set-cluster-termination-protection.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-set-cluster-termination-protection.test.ts index 8eb439d65e6f7..9c313754d7cf1 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-set-cluster-termination-protection.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-set-cluster-termination-protection.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-terminate-cluster.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-terminate-cluster.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-terminate-cluster.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-terminate-cluster.test.ts index 0b3391f24835b..11e3eb8320d8c 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emr/emr-terminate-cluster.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emr/emr-terminate-cluster.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/create-virtual-cluster.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/create-virtual-cluster.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/create-virtual-cluster.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/create-virtual-cluster.test.ts index d7b6a3d925626..0a8b5c35618ac 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/create-virtual-cluster.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/create-virtual-cluster.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as eks from '@aws-cdk/aws-eks'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as eks from '../../../aws-eks'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { EmrContainersCreateVirtualCluster, EksClusterInput } from '../../lib/emrcontainers/create-virtual-cluster'; const emrContainersVirtualClusterName = 'EMR Containers Virtual Cluster'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/delete-virtual-cluster.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/delete-virtual-cluster.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/delete-virtual-cluster.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/delete-virtual-cluster.test.ts index 484e3f21c342e..91e23714f5695 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/emrcontainers/delete-virtual-cluster.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/delete-virtual-cluster.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; import { EmrContainersDeleteVirtualCluster } from '../../lib/emrcontainers/delete-virtual-cluster'; let stack: Stack; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/start-job-run.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/start-job-run.test.ts new file mode 100644 index 0000000000000..3941e354fee7f --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/emrcontainers/start-job-run.test.ts @@ -0,0 +1,1068 @@ +import { Template } from '../../../assertions'; +import * as iam from '../../../aws-iam'; +import * as logs from '../../../aws-logs'; +import * as s3 from '../../../aws-s3'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; +import { EmrContainersStartJobRun, VirtualClusterInput, ReleaseLabel, ApplicationConfiguration, Classification, EmrContainersStartJobRunProps } from '../../lib/emrcontainers/start-job-run'; + +let stack: Stack; +let clusterId: string; +let defaultProps: EmrContainersStartJobRunProps; + +beforeEach(() => { + stack = new Stack(); + clusterId = 'clusterId'; + defaultProps = { + virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromText(clusterId)), + releaseLabel: ReleaseLabel.EMR_6_2_0, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('local:///usr/lib/spark/examples/src/main/python/pi.py'), + sparkSubmitParameters: '--conf spark.executor.instances=2', + }, + }, + }; +}); + +describe('Invoke EMR Containers Start Job Run with ', () => { + test('Request/Response integration pattern', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::emr-containers:startJobRun', + ], + ], + }, + }); + }); + + test('.sync integration pattern', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', defaultProps); + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::emr-containers:startJobRun.sync', + ], + ], + }, + }); + }); + + test('virtual cluster id from payload', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.ClusterId')), + executionRole: iam.Role.fromRoleArn(stack, 'Job Execution Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + 'VirtualClusterId.$': '$.ClusterId', + 'ExecutionRoleArn': 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole', + }, + }); + }); + + test('Tags', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + tags: { + key: 'value', + }, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + Tags: { + key: 'value', + }, + }, + }); + }); + + + test('Application Configuration', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + applicationConfig: [{ + classification: Classification.SPARK_DEFAULTS, + properties: { + 'spark.executor.instances': '1', + 'spark.executor.memory': '512M', + }, + }], + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + ConfigurationOverrides: { + ApplicationConfiguration: [{ + Classification: Classification.SPARK_DEFAULTS.classificationStatement, + Properties: { + 'spark.executor.instances': '1', + 'spark.executor.memory': '512M', + }, + }], + }, + }, + }); + }); + + test('Application Configuration with nested app config and no properties', () => { + const properties: { [key: string]: string } = { HADOOP_DATANODE_HEAPSIZE: '2048', HADOOP_NAMENODE_OPTS: '-XX:GCTimeRatio=19' }; + const struct = { classification: new Classification('export'), properties: properties }; + const appConfigNested: ApplicationConfiguration[] = [struct]; + + const mainConfig = { classification: new Classification('hadoop-env'), nestedConfig: appConfigNested }; + const appConfig: ApplicationConfiguration[] = [mainConfig]; + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + applicationConfig: appConfig, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + ConfigurationOverrides: { + ApplicationConfiguration: [{ + Classification: 'hadoop-env', + Configurations: [{ + Classification: 'export', + Properties: { + HADOOP_DATANODE_HEAPSIZE: '2048', + HADOOP_NAMENODE_OPTS: '-XX:GCTimeRatio=19', + }, + }], + }], + }, + }, + }); + }); + + test('Job Driver with Entry Point Arguments', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('entrypoint'), + entryPointArguments: sfn.TaskInput.fromJsonPathAt('$.entrypointArguments'), + }, + }, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + JobDriver: { + SparkSubmitJobDriver: { + 'EntryPoint': 'entrypoint', + 'EntryPointArguments.$': '$.entrypointArguments', + }, + }, + }, + }); + }); + + test('Job Execution Role', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + executionRole: iam.Role.fromRoleArn(stack, 'Job Execution Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + ExecutionRoleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole', + }, + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::CloudFormation::CustomResource', 0); + }); + + test('Virtual Cluster Input from virtualClusterId', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + virtualCluster: VirtualClusterInput.fromVirtualClusterId(clusterId), + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + VirtualClusterId: clusterId, + }, + }); + }); + + describe('Invoke EMR Containers Start Job Run with Monitoring ', () => { + test('generated automatically', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + monitoring: { + logging: true, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Resource: [ + { + 'Fn::GetAtt': [ + 'EMRContainersStartJobRunMonitoringBucket8BB3FC54', + 'Arn', + ], + }, + { + 'Fn::Join': [ + '', + [ + { + 'Fn::GetAtt': [ + 'EMRContainersStartJobRunMonitoringBucket8BB3FC54', + 'Arn', + ], + }, + '/*', + ], + ], + }, + ], + }, + { + Action: [ + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'EMRContainersStartJobRunMonitoringLogGroup882D450C', + 'Arn', + ], + }, + }, + { + Action: 'logs:DescribeLogStreams', + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'EMRContainersStartJobRunMonitoringLogGroup882D450C', + 'Arn', + ], + }, + }, + { + Action: 'logs:DescribeLogGroups', + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':logs:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':*', + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'EMRContainersStartJobRunJobExecutionRoleDefaultPolicyCDBDF13E', + Roles: [ + { + Ref: 'EMRContainersStartJobRunJobExecutionRole40B8DD81', + }, + ], + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + ConfigurationOverrides: { + MonitoringConfiguration: { + CloudWatchMonitoringConfiguration: { + LogGroupName: { + Ref: 'EMRContainersStartJobRunMonitoringLogGroup882D450C', + }, + }, + PersistentAppUI: 'ENABLED', + S3MonitoringConfiguration: { + LogUri: { + 'Fn::Join': [ + '', + [ + 's3://', + { + Ref: 'EMRContainersStartJobRunMonitoringBucket8BB3FC54', + }, + ], + ], + }, + }, + }, + }, + }, + }); + }); + + test('provided from user', () => { + // WHEN + const logGroup = logs.LogGroup.fromLogGroupName(stack, 'Monitoring Group', 'providedloggroup'); + const s3Bucket = s3.Bucket.fromBucketName(stack, 'Monitoring Bucket', 'providedbucket');; + const prefixName = 'prefix'; + + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + monitoring: { + logBucket: s3Bucket, + logGroup: logGroup, + logStreamNamePrefix: prefixName, + logging: false, + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject', + 's3:PutObjectLegalHold', + 's3:PutObjectRetention', + 's3:PutObjectTagging', + 's3:PutObjectVersionTagging', + 's3:Abort*', + ], + Effect: 'Allow', + Resource: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':s3:::providedbucket', + ], + ], + }, + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':s3:::providedbucket/*', + ], + ], + }, + ], + }, + { + Action: [ + 'logs:CreateLogStream', + 'logs:PutLogEvents', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':logs:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':log-group:providedloggroup:*', + ], + ], + }, + }, + { + Action: 'logs:DescribeLogStreams', + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':logs:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':log-group:providedloggroup:*', + ], + ], + }, + }, + { + Action: 'logs:DescribeLogGroups', + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':logs:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':*', + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + PolicyName: 'EMRContainersStartJobRunJobExecutionRoleDefaultPolicyCDBDF13E', + Roles: [ + { + Ref: 'EMRContainersStartJobRunJobExecutionRole40B8DD81', + }, + ], + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + ConfigurationOverrides: { + MonitoringConfiguration: { + CloudWatchMonitoringConfiguration: { + LogGroupName: logGroup.logGroupName, + LogStreamNamePrefix: prefixName, + }, + S3MonitoringConfiguration: { + LogUri: 's3://' + s3Bucket.bucketName, + }, + }, + }, + ExecutionRoleArn: { + 'Fn::GetAtt': [ + 'EMRContainersStartJobRunJobExecutionRole40B8DD81', + 'Arn', + ], + }, + }, + }); + }); + + test('PersistentAppUI to be disabled when set to false', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', { + ...defaultProps, + monitoring: { + persistentAppUI: false, + }, + }); + + // THEN + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + ConfigurationOverrides: { + MonitoringConfiguration: { + PersistentAppUI: 'DISABLED', + }, + }, + }, + }); + }); + }); + + describe('Task throws if ', () => { + test('Application Configuration array is larger than 100', () => { + // WHEN + const struct = { classification: Classification.SPARK }; + const appConfig: ApplicationConfiguration[] = new Array(101).fill(struct); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + applicationConfig: appConfig, + }); + }).toThrow(`Application configuration array must have 100 or fewer entries. Received ${appConfig.length}`); + }); + + test('Application Configuration nested configuration array is larger than 100', () => { + // WHEN + const struct = { classification: Classification.SPARK }; + let appConfig: ApplicationConfiguration[] = new Array(101).fill(struct); + + const nestedConfigStruct = { classification: Classification.SPARK, nestedConfig: appConfig }; + appConfig[0] = nestedConfigStruct; + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + applicationConfig: appConfig, + }); + }).toThrow(`Application configuration array must have 100 or fewer entries. Received ${appConfig.length}`); + }); + + test('Application Configuration properties is larger than 100 entries', () => { + // WHEN + const properties: { [key: string]: string } = {}; + for (let index = 0; index <= 100; index++) { + properties[index.toString()] = 'value'; + } + const appConfig: ApplicationConfiguration = { classification: Classification.SPARK, properties: properties }; + + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + applicationConfig: [appConfig], + }); + }).toThrow(`Application configuration properties must have 100 or fewer entries. Received ${Object.keys(properties).length}`); + }); + + test('Application Configuration properties is undefined and nested configuration array is undefined', () => { + // WHEN + const struct = { classification: Classification.SPARK }; + let appConfig: ApplicationConfiguration[] = new Array(1).fill(struct); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + applicationConfig: appConfig, + }); + }).toThrow('Application configuration must have either properties or nested app configurations defined.'); + }); + + test('Entry Point is not between 1 to 256 characters in length', () => { + // WHEN + const entryPointString = 'x'.repeat(257); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Start Job Run Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText(entryPointString), + }, + }, + }); + }).toThrow(`Entry point must be between 1 and 256 characters in length. Received ${entryPointString.length}.`); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText(''), + }, + }, + }); + }).toThrow('Entry point must be between 1 and 256 characters in length. Received 0.'); + }); + + test('Entry Point Arguments is not a string array that is between 1 and 10280 entries in length', () => { + // WHEN + const entryPointArgs = sfn.TaskInput.fromObject(new Array(10281).fill('x', 10281)); + const entryPointArgsNone = sfn.TaskInput.fromObject([]); + const entryPointNumbers = sfn.TaskInput.fromObject(new Array(1).fill(1)); + const entryPointJson = sfn.TaskInput.fromText('x'); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'String array error Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('job-location'), + entryPointArguments: entryPointNumbers, + }, + }, + }); + }).toThrow('Entry point arguments must be a string array or an encoded JSON path but received object'); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'JSON Path error Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('job-location'), + entryPointArguments: entryPointJson, + }, + }, + }); + }).toThrow('Entry point arguments must be a string array or an encoded JSON path, but received a non JSON path string'); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Greater than 256 Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('job-location'), + entryPointArguments: entryPointArgs, + }, + }, + }); + }).toThrow(`Entry point arguments must be a string array between 1 and 10280 in length. Received ${entryPointArgs.value.length}.`); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Less than 1 Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('job-location'), + entryPointArguments: entryPointArgsNone, + }, + }, + }); + }).toThrow(`Entry point arguments must be a string array between 1 and 10280 in length. Received ${entryPointArgsNone.value.length}.`); + }); + + test('Spark Submit Parameters is NOT between 1 characters and 102400 characters in length', () => { + // WHEN + const sparkSubmitParam = 'x'.repeat(102401); + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Spark Submit Parameter Task', { + ...defaultProps, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('job-location'), + sparkSubmitParameters: sparkSubmitParam, + }, + }, + }); + }).toThrow(`Spark submit parameters must be between 1 and 102400 characters in length. Received ${sparkSubmitParam.length}.`); + }); + + test('an execution role is undefined and the virtual cluster ID is not a concrete value', () => { + // WHEN + const jsonPath = '$.ClusterId'; + + // THEN + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt(jsonPath)), + }); + }).toThrow('Execution role cannot be undefined when the virtual cluster ID is not a concrete value. Provide an execution role with the correct trust policy'); + }); + }); + + test('Permitted role actions and resources with Start Job Run for SYNC integration pattern', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'EMR Containers Start Job Run', defaultProps); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: 'emr-containers:StartJobRun', + Condition: { + StringEquals: { + 'emr-containers:ExecutionRoleArn': { + 'Fn::GetAtt': [ + 'EMRContainersStartJobRunJobExecutionRole40B8DD81', + 'Arn', + ], + }, + }, + }, + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':emr-containers:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + `:/virtualclusters/${clusterId}`, + ], + ], + }, + }, + { + Action: [ + 'emr-containers:DescribeJobRun', + 'emr-containers:CancelJobRun', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':emr-containers:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + `:/virtualclusters/${clusterId}/jobruns/*`, + ], + ], + }, + }], + }, + }); + }); + + test('Permitted role actions and resources with Start Job Run from payload', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromJsonPathAt('$.ClusterId')), + executionRole: iam.Role.fromRoleArn(stack, 'Job Role', 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole'), + }); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: 'emr-containers:StartJobRun', + Condition: { + StringEquals: { + 'emr-containers:ExecutionRoleArn': 'arn:aws:iam::xxxxxxxxxxxx:role/JobExecutionRole', + }, + }, + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':emr-containers:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':/virtualclusters/*', + ], + ], + }, + }, + { + Action: [ + 'emr-containers:DescribeJobRun', + 'emr-containers:CancelJobRun', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':emr-containers:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':/virtualclusters/*', + ], + ], + }, + }], + }, + }); + }); + + test('Permitted role actions for Start Job Run with REQUEST/RESPONSE integration pattern', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'Task', { + ...defaultProps, + integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, + }); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: 'emr-containers:StartJobRun', + Condition: { + StringEquals: { + 'emr-containers:ExecutionRoleArn': { + 'Fn::GetAtt': [ + 'TaskJobExecutionRole5D5BBA5A', + 'Arn', + ], + }, + }, + }, + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':emr-containers:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + `:/virtualclusters/${clusterId}`, + ], + ], + }, + }], + }, + }); + }); + + test('Custom resource is created with EMR Containers Describe Virtual Cluster invocation and has correct IAM policy permissions', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'Task', defaultProps); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('Custom::AWS', { + ServiceToken: { + 'Fn::GetAtt': [ + 'AWS679f53fac002430cb0da5b7982bd22872D164C4C', + 'Arn', + ], + }, + Create: '{\"service\":\"EMRcontainers\",\"action\":\"describeVirtualCluster\",\"parameters\":{\"id\":\"clusterId\"},\"outputPaths\":[\"virtualCluster.containerProvider.info.eksInfo.namespace\",\"virtualCluster.containerProvider.id\"],\"physicalResourceId\":{\"id\":\"id\"}}', + InstallLatestAwsSdk: false, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: 'emr-containers:DescribeVirtualCluster', + Effect: 'Allow', + Resource: '*', + }], + }, + }); + }); + + test('Custom resource is created that has correct EKS namespace, environment, AWSCLI layer, and IAM policy permissions', () => { + // WHEN + const task = new EmrContainersStartJobRun(stack, 'Task', defaultProps); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'eks:DescribeCluster', + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':eks:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':cluster/', + { + 'Fn::GetAtt': [ + 'TaskGetEksClusterInfo2F156985', + 'virtualCluster.containerProvider.id', + ], + }, + ], + ], + }, + }, + { + Action: [ + 'iam:GetRole', + 'iam:UpdateAssumeRolePolicy', + ], + Effect: 'Allow', + Resource: { + 'Fn::GetAtt': [ + 'TaskJobExecutionRole5D5BBA5A', + 'Arn', + ], + }, + }, + ], + }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Function', { + Handler: 'index.handler', + Layers: [ + { + Ref: 'TaskawsclilayerB1A11740', + }, + ], + MemorySize: 256, + Runtime: 'python3.9', + Timeout: 30, + }); + }); +}); + +test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { + expect(() => { + new EmrContainersStartJobRun(stack, 'Task', { + virtualCluster: VirtualClusterInput.fromTaskInput(sfn.TaskInput.fromText(clusterId)), + releaseLabel: ReleaseLabel.EMR_6_2_0, + jobDriver: { + sparkSubmitJobDriver: { + entryPoint: sfn.TaskInput.fromText('job-location'), + }, + }, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + }); + }).toThrow(/Unsupported service integration pattern. Supported Patterns: REQUEST_RESPONSE,RUN_JOB. Received: WAIT_FOR_TASK_TOKEN/); +}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eval-nodejs-handler.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eval-nodejs-handler.test.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eval-nodejs-handler.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eval-nodejs-handler.test.ts diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/evaluate-expression.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/evaluate-expression.test.ts similarity index 94% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/evaluate-expression.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/evaluate-expression.test.ts index 95e27f0e71812..8e81c5a7e1d20 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/evaluate-expression.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/evaluate-expression.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as sfn from '../../aws-stepfunctions'; +import { Stack } from '../../core'; import * as tasks from '../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/put-events.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eventbridge/put-events.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/put-events.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eventbridge/put-events.test.ts index 1b1c3f6ebe669..529a8032c8e01 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/eventbridge/put-events.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/eventbridge/put-events.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as events from '@aws-cdk/aws-events'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as events from '../../../aws-events'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { EventBridgePutEvents } from '../../lib/eventbridge/put-events'; describe('Put Events', () => { diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py new file mode 100644 index 0000000000000..054cefb5a8804 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/my-glue-script/job.py @@ -0,0 +1,16 @@ +import sys + +from awsglue.context import GlueContext +from awsglue.job import Job +from awsglue.utils import getResolvedOptions +from pyspark.context import SparkContext + +spark_context = SparkContext() +glue_context = GlueContext(spark_context) +job = Job(glue_context) +args = getResolvedOptions(sys.argv, ["JOB_NAME"]) +job.init(args["JOB_NAME"], args) + +print("Hello, World!") + +job.commit() diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/run-glue-job-task.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/run-glue-job-task.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/run-glue-job-task.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/run-glue-job-task.test.ts index 71cb2edb793b2..816b789377031 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/glue/run-glue-job-task.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/run-glue-job-task.test.ts @@ -1,7 +1,7 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import { Match, Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Duration, Stack } from '../../../core'; import * as tasks from '../../lib'; const jobName = 'GlueJob'; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts new file mode 100644 index 0000000000000..d6c17d111db42 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/glue/start-job-run.test.ts @@ -0,0 +1,203 @@ +import { Match, Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import { Duration, Stack } from '../../../core'; +import * as tasks from '../../lib'; +import { GlueStartJobRun } from '../../lib/glue/start-job-run'; + +const glueJobName = 'GlueJob'; +let stack: Stack; +beforeEach(() => { + stack = new Stack(); +}); + +test('Invoke glue job with just job ARN', () => { + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + }); + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::glue:startJobRun', + ], + ], + }, + End: true, + Parameters: { + JobName: glueJobName, + }, + }); +}); + +test('Invoke glue job with full properties', () => { + const jobArguments = { + key: 'value', + }; + const timeoutMinutes = 1440; + const glueJobTimeout = Duration.minutes(timeoutMinutes); + const securityConfiguration = 'securityConfiguration'; + const notifyDelayAfterMinutes = 10; + const notifyDelayAfter = Duration.minutes(notifyDelayAfterMinutes); + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + arguments: sfn.TaskInput.fromObject(jobArguments), + taskTimeout: sfn.Timeout.duration(glueJobTimeout), + securityConfiguration, + notifyDelayAfter, + }); + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::glue:startJobRun.sync', + ], + ], + }, + End: true, + Parameters: { + JobName: glueJobName, + Arguments: jobArguments, + Timeout: timeoutMinutes, + SecurityConfiguration: securityConfiguration, + NotificationProperty: { + NotifyDelayAfter: notifyDelayAfterMinutes, + }, + }, + }); +}); + +test('Invoke glue job with Timeout.at()', () => { + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + taskTimeout: sfn.Timeout.at('$.timeout'), + }); + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::glue:startJobRun', + ], + ], + }, + End: true, + Parameters: { + 'JobName': glueJobName, + 'Timeout.$': '$.timeout', + }, + }); +}); + +test('job arguments can reference state input', () => { + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + arguments: sfn.TaskInput.fromJsonPathAt('$.input'), + }); + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::glue:startJobRun.sync', + ], + ], + }, + End: true, + Parameters: { + 'JobName': glueJobName, + 'Arguments.$': '$.input', + }, + }); +}); + +test('permitted role actions limited to start job run if service integration pattern is REQUEST_RESPONSE', () => { + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE, + }); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [Match.objectLike({ + Action: 'glue:StartJobRun', + })], + }, + }); +}); + +test('permitted role actions include start, get, and stop job run if service integration pattern is RUN_JOB', () => { + const task = new GlueStartJobRun(stack, 'Task', { + glueJobName, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + }); + + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [Match.objectLike({ + Action: [ + 'glue:StartJobRun', + 'glue:GetJobRun', + 'glue:GetJobRuns', + 'glue:BatchStopJobRun', + ], + })], + }, + }); +}); + +test('Task throws if WAIT_FOR_TASK_TOKEN is supplied as service integration pattern', () => { + expect(() => { + new tasks.GlueStartJobRun(stack, 'GlueJob', { + glueJobName, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + }); + }).toThrow(/unsupported service integration pattern/i); +}); diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/invoke-activity.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/invoke-activity.test.ts new file mode 100644 index 0000000000000..8b9cb3db630af --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/invoke-activity.test.ts @@ -0,0 +1,67 @@ +import { Template } from '../../assertions'; +import * as sfn from '../../aws-stepfunctions'; +import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; +import { Stack } from '../../core'; +import * as tasks from '../lib'; + +describeDeprecated('InvokeActivity', () => { + test('Activity can be used in a Task', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const activity = new sfn.Activity(stack, 'Activity'); + const task = new sfn.Task(stack, 'Task', { task: new tasks.InvokeActivity(activity) }); + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::StepFunctions::StateMachine', { + DefinitionString: { + 'Fn::Join': ['', [ + '{"StartAt":"Task","States":{"Task":{"End":true,"Type":"Task","Resource":"', + { Ref: 'Activity04690B0A' }, + '"}}}', + ]], + }, + }); + }); + + test('Activity Task metrics and Activity metrics are the same', () => { + // GIVEN + const stack = new Stack(); + const activity = new sfn.Activity(stack, 'Activity'); + const task = new sfn.Task(stack, 'Invoke', { task: new tasks.InvokeActivity(activity) }); + + // WHEN + const activityMetrics = [ + activity.metricFailed(), + activity.metricHeartbeatTimedOut(), + activity.metricRunTime(), + activity.metricScheduled(), + activity.metricScheduleTime(), + activity.metricStarted(), + activity.metricSucceeded(), + activity.metricTime(), + activity.metricTimedOut(), + ]; + + const taskMetrics = [ + task.metricFailed(), + task.metricHeartbeatTimedOut(), + task.metricRunTime(), + task.metricScheduled(), + task.metricScheduleTime(), + task.metricStarted(), + task.metricSucceeded(), + task.metricTime(), + task.metricTimedOut(), + ]; + + // THEN + for (let i = 0; i < activityMetrics.length; i++) { + expect(activityMetrics[i]).toEqual(taskMetrics[i]); + } + }); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke-function.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/invoke-function.test.ts similarity index 89% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke-function.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/invoke-function.test.ts index 57c36af15b234..d11e8dc1ff1ac 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke-function.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/invoke-function.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import { Template } from '../../../assertions'; +import * as lambda from '../../../aws-lambda'; +import * as sfn from '../../../aws-stepfunctions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import * as tasks from '../../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/invoke.test.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/invoke.test.ts index c76288702488f..c9b98ced49238 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/invoke.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/invoke.test.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as lambda from '../../../aws-lambda'; +import * as sfn from '../../../aws-stepfunctions'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import { LambdaInvocationType, LambdaInvoke } from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py new file mode 100644 index 0000000000000..179dcbbb27423 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/my-lambda-handler/index.py @@ -0,0 +1,4 @@ +def main(event, context): + return { + 'message': 'Hello, world!' + } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/run-lambda-task.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/run-lambda-task.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/run-lambda-task.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/run-lambda-task.test.ts index 5929a684485b0..8ea42bd4540d0 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/lambda/run-lambda-task.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/lambda/run-lambda-task.test.ts @@ -1,7 +1,7 @@ -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as lambda from '../../../aws-lambda'; +import * as sfn from '../../../aws-stepfunctions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import * as tasks from '../../lib'; let stack: Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/private/task-utils.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/private/task-utils.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/private/task-utils.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/private/task-utils.test.ts index bc4246442c865..76e4c57a990b4 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/private/task-utils.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/private/task-utils.test.ts @@ -1,5 +1,5 @@ -import { IntegrationPattern } from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import { IntegrationPattern } from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { integrationResourceArn, validatePatternSupported } from '../../lib/private/task-utils'; describe('Task utils', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts index 39c9f9a02278b..261afad00bc6c 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-endpoint-config.test.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as kms from '../../../aws-kms'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts index a48703d51df61..19b07f574c9c2 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-endpoint.test.ts @@ -1,5 +1,5 @@ -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts index 69c941b385579..1db88fa218075 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-model.test.ts @@ -1,7 +1,7 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-training-job.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-training-job.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-training-job.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-training-job.test.ts index 9d5ebb1f9711a..31bf02c7c8a18 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-training-job.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-training-job.test.ts @@ -1,9 +1,9 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as s3 from '../../../aws-s3'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; import { SageMakerCreateTrainingJob } from '../../lib/sagemaker/create-training-job'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-transform-job.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-transform-job.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-transform-job.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-transform-job.test.ts index a3fdf27ba7dbb..116da381909b2 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/create-transform-job.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/create-transform-job.test.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as kms from '@aws-cdk/aws-kms'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as kms from '../../../aws-kms'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; import { SageMakerCreateTransformJob } from '../../lib/sagemaker/create-transform-job'; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts index 90a58850e64a5..7b402d0650b90 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sagemaker/update-endpoint.test.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/publish-to-topic.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sns/publish-to-topic.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/publish-to-topic.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sns/publish-to-topic.test.ts index 59638c06d52d1..9faefdf38891d 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/publish-to-topic.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sns/publish-to-topic.test.ts @@ -1,7 +1,7 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as sns from '../../../aws-sns'; +import * as sfn from '../../../aws-stepfunctions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; describeDeprecated('PublishToTopic', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/publish.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sns/publish.test.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/publish.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sns/publish.test.ts index 5b81034e48cc2..d9c0ed107bd25 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sns/publish.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sns/publish.test.ts @@ -1,6 +1,6 @@ -import * as sns from '@aws-cdk/aws-sns'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as sns from '../../../aws-sns'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { SnsPublish, MessageAttributeDataType, MessageAttribute } from '../../lib/sns/publish'; describe('Publish', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/send-message.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sqs/send-message.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/send-message.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sqs/send-message.test.ts index 79459149732ae..f3b4428c3c0d6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/send-message.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sqs/send-message.test.ts @@ -1,6 +1,6 @@ -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; -import * as cdk from '@aws-cdk/core'; +import * as sqs from '../../../aws-sqs'; +import * as sfn from '../../../aws-stepfunctions'; +import * as cdk from '../../../core'; import { SqsSendMessage } from '../../lib/sqs/send-message'; describe('SqsSendMessage', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/send-to-queue.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sqs/send-to-queue.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/send-to-queue.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sqs/send-to-queue.test.ts index abf2fdd365268..7c5ad9f25aa83 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/sqs/send-to-queue.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/sqs/send-to-queue.test.ts @@ -1,7 +1,7 @@ -import * as sqs from '@aws-cdk/aws-sqs'; -import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as sqs from '../../../aws-sqs'; +import * as sfn from '../../../aws-stepfunctions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as tasks from '../../lib'; let stack: cdk.Stack; diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/start-execution.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/start-execution.test.ts new file mode 100644 index 0000000000000..14d6e89f64eb9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/start-execution.test.ts @@ -0,0 +1,230 @@ +import { Template } from '../../assertions'; +import * as sfn from '../../aws-stepfunctions'; +import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; +import { Stack } from '../../core'; +import * as tasks from '../lib'; + +let stack: Stack; +let child: sfn.StateMachine; +beforeEach(() => { + stack = new Stack(); + child = new sfn.StateMachine(stack, 'ChildStateMachine', { + definition: sfn.Chain.start(new sfn.Pass(stack, 'PassState')), + }); +}); + +describeDeprecated('StartExecution', () => { + test('Execute State Machine - Default - Fire and Forget', () => { + const task = new sfn.Task(stack, 'ChildTask', { + task: new tasks.StartExecution(child, { + input: { + foo: 'bar', + }, + name: 'myExecutionName', + }), + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::states:startExecution', + ], + ], + }, + End: true, + Parameters: { + Input: { + foo: 'bar', + }, + Name: 'myExecutionName', + StateMachineArn: { + Ref: 'ChildStateMachine9133117F', + }, + }, + }); + }); + + test('Execute State Machine - Sync', () => { + const task = new sfn.Task(stack, 'ChildTask', { + task: new tasks.StartExecution(child, { + integrationPattern: sfn.ServiceIntegrationPattern.SYNC, + }), + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::states:startExecution.sync', + ], + ], + }, + End: true, + Parameters: { + StateMachineArn: { + Ref: 'ChildStateMachine9133117F', + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'states:StartExecution', + Effect: 'Allow', + Resource: { + Ref: 'ChildStateMachine9133117F', + }, + }, + { + Action: [ + 'states:DescribeExecution', + 'states:StopExecution', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':execution:', + { + 'Fn::Select': [ + 6, + { + 'Fn::Split': [ + ':', + { + Ref: 'ChildStateMachine9133117F', + }, + ], + }, + ], + }, + '*', + ], + ], + }, + }, + { + Action: [ + 'events:PutTargets', + 'events:PutRule', + 'events:DescribeRule', + ], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':events:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':rule/StepFunctionsGetEventsForStepFunctionsExecutionRule', + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + Roles: [ + { + Ref: 'ParentStateMachineRoleE902D002', + }, + ], + }); + }); + + test('Execute State Machine - Wait For Task Token', () => { + const task = new sfn.Task(stack, 'ChildTask', { + task: new tasks.StartExecution(child, { + integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, + input: { + token: sfn.JsonPath.taskToken, + }, + }), + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::states:startExecution.waitForTaskToken', + ], + ], + }, + End: true, + Parameters: { + Input: { + 'token.$': '$$.Task.Token', + }, + StateMachineArn: { + Ref: 'ChildStateMachine9133117F', + }, + }, + }); + }); + + test('Execute State Machine - Wait For Task Token - Missing Task Token', () => { + expect(() => { + new sfn.Task(stack, 'ChildTask', { + task: new tasks.StartExecution(child, { + integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN, + }), + }); + }).toThrow('Task Token is missing in input (pass JsonPath.taskToken somewhere in input'); + }); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/stepfunctions/invoke-activity.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/stepfunctions/invoke-activity.test.ts new file mode 100644 index 0000000000000..c754775793aad --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/stepfunctions/invoke-activity.test.ts @@ -0,0 +1,64 @@ +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; +import { StepFunctionsInvokeActivity } from '../../lib/stepfunctions/invoke-activity'; + +test('Activity can be used in a Task', () => { + // GIVEN + const stack = new Stack(); + + // WHEN + const activity = new sfn.Activity(stack, 'Activity'); + const task = new StepFunctionsInvokeActivity(stack, 'Task', { activity }); + new sfn.StateMachine(stack, 'SM', { + definition: task, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::StepFunctions::StateMachine', { + DefinitionString: { + 'Fn::Join': ['', [ + '{"StartAt":"Task","States":{"Task":{"End":true,"Type":"Task","Resource":"', + { Ref: 'Activity04690B0A' }, + '"}}}', + ]], + }, + }); +}); + +test('Activity Task metrics and Activity metrics are the same', () => { + // GIVEN + const stack = new Stack(); + const activity = new sfn.Activity(stack, 'Activity'); + const task = new StepFunctionsInvokeActivity(stack, 'Invoke', { activity }); + + // WHEN + const activityMetrics = [ + activity.metricFailed(), + activity.metricHeartbeatTimedOut(), + activity.metricRunTime(), + activity.metricScheduled(), + activity.metricScheduleTime(), + activity.metricStarted(), + activity.metricSucceeded(), + activity.metricTime(), + activity.metricTimedOut(), + ]; + + const taskMetrics = [ + task.metricFailed(), + task.metricHeartbeatTimedOut(), + task.metricRunTime(), + task.metricScheduled(), + task.metricScheduleTime(), + task.metricStarted(), + task.metricSucceeded(), + task.metricTime(), + task.metricTimedOut(), + ]; + + // THEN + for (let i = 0; i < activityMetrics.length; i++) { + expect(activityMetrics[i]).toEqual(taskMetrics[i]); + } +}); diff --git a/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/stepfunctions/start-execution.test.ts b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/stepfunctions/start-execution.test.ts new file mode 100644 index 0000000000000..e21ee044937fe --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions-tasks/test/stepfunctions/start-execution.test.ts @@ -0,0 +1,269 @@ +import { Template } from '../../../assertions'; +import * as sfn from '../../../aws-stepfunctions'; +import { Stack } from '../../../core'; +import { StepFunctionsStartExecution } from '../../lib/stepfunctions/start-execution'; + +let stack: Stack; +let child: sfn.StateMachine; +beforeEach(() => { + stack = new Stack(); + child = new sfn.StateMachine(stack, 'ChildStateMachine', { + definition: sfn.Chain.start(new sfn.Pass(stack, 'PassState')), + }); +}); + +test('Execute State Machine - Default - Request Response', () => { + const task = new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + input: sfn.TaskInput.fromObject({ + foo: 'bar', + }), + name: 'myExecutionName', + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::states:startExecution', + ], + ], + }, + End: true, + Parameters: { + Input: { + foo: 'bar', + }, + Name: 'myExecutionName', + StateMachineArn: { + Ref: 'ChildStateMachine9133117F', + }, + }, + }); +}); + +test('Execute State Machine - Run Job', () => { + const task = new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::states:startExecution.sync:2', + ], + ], + }, + End: true, + Parameters: { + 'Input.$': '$', + 'StateMachineArn': { + Ref: 'ChildStateMachine9133117F', + }, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'states:StartExecution', + Effect: 'Allow', + Resource: { + Ref: 'ChildStateMachine9133117F', + }, + }, + { + Action: ['states:DescribeExecution', 'states:StopExecution'], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':execution:', + { + 'Fn::Select': [ + 6, + { + 'Fn::Split': [ + ':', + { + Ref: 'ChildStateMachine9133117F', + }, + ], + }, + ], + }, + '*', + ], + ], + }, + }, + { + Action: ['events:PutTargets', 'events:PutRule', 'events:DescribeRule'], + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':events:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':rule/StepFunctionsGetEventsForStepFunctionsExecutionRule', + ], + ], + }, + }, + ], + Version: '2012-10-17', + }, + Roles: [ + { + Ref: 'ParentStateMachineRoleE902D002', + }, + ], + }); +}); + +test('Execute State Machine - Wait For Task Token', () => { + const task = new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + input: sfn.TaskInput.fromObject({ + token: sfn.JsonPath.taskToken, + }), + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toEqual({ + Type: 'Task', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:::states:startExecution.waitForTaskToken', + ], + ], + }, + End: true, + Parameters: { + Input: { + 'token.$': '$$.Task.Token', + }, + StateMachineArn: { + Ref: 'ChildStateMachine9133117F', + }, + }, + }); +}); + +test('Execute State Machine - Wait For Task Token - Missing Task Token', () => { + expect(() => { + new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN, + }); + }).toThrow('Task Token is required in `input` for callback. Use JsonPath.taskToken to set the token.'); +}); + +test('Execute State Machine - Associate With Parent - Input Provided', () => { + const task = new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + input: sfn.TaskInput.fromObject({ + token: sfn.JsonPath.taskToken, + }), + associateWithParent: true, + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + Input: { + 'token.$': '$$.Task.Token', + 'AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$': '$$.Execution.Id', + }, + }, + }); +}); + +test('Execute State Machine - Associate With Parent - Input Not Provided', () => { + const task = new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + associateWithParent: true, + }); + + new sfn.StateMachine(stack, 'ParentStateMachine', { + definition: task, + }); + + expect(stack.resolve(task.toStateJson())).toMatchObject({ + Parameters: { + Input: { + 'AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$': '$$.Execution.Id', + }, + }, + }); +}); + +test('Execute State Machine - Associate With Parent - Incorrect Input Type', () => { + expect(() => { + new StepFunctionsStartExecution(stack, 'ChildTask', { + stateMachine: child, + associateWithParent: true, + input: sfn.TaskInput.fromText('{ "token.$": "$$.Task.Token" }'), + }); + }).toThrow('Could not enable `associateWithParent` because `input` is taken directly from a JSON path. Use `sfn.TaskInput.fromObject` instead.'); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-stepfunctions/.jsiirc.json b/packages/aws-cdk-lib/aws-stepfunctions/.jsiirc.json new file mode 100644 index 0000000000000..9eaf9ebe9e03d --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.stepfunctions" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.StepFunctions" + }, + "python": { + "module": "aws_cdk.aws_stepfunctions" + } + } +} diff --git a/packages/aws-cdk-lib/aws-stepfunctions/README.md b/packages/aws-cdk-lib/aws-stepfunctions/README.md new file mode 100644 index 0000000000000..f41088f0e61df --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/README.md @@ -0,0 +1,929 @@ +# AWS Step Functions Construct Library + + +The `@aws-cdk/aws-stepfunctions` package contains constructs for building +serverless workflows using objects. Use this in conjunction with the +`@aws-cdk/aws-stepfunctions-tasks` package, which contains classes used +to call other AWS services. + +Defining a workflow looks like this (for the [Step Functions Job Poller +example](https://docs.aws.amazon.com/step-functions/latest/dg/job-status-poller-sample.html)): + +## Example + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +declare const submitLambda: lambda.Function; +declare const getStatusLambda: lambda.Function; + +const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', { + lambdaFunction: submitLambda, + // Lambda's result is in the attribute `guid` + outputPath: '$.guid', +}); + +const waitX = new sfn.Wait(this, 'Wait X Seconds', { + time: sfn.WaitTime.secondsPath('$.waitSeconds'), +}); + +const getStatus = new tasks.LambdaInvoke(this, 'Get Job Status', { + lambdaFunction: getStatusLambda, + // Pass just the field named "guid" into the Lambda, put the + // Lambda's result in a field called "status" in the response + inputPath: '$.guid', + outputPath: '$.status', +}); + +const jobFailed = new sfn.Fail(this, 'Job Failed', { + cause: 'AWS Batch Job Failed', + error: 'DescribeJob returned FAILED', +}); + +const finalStatus = new tasks.LambdaInvoke(this, 'Get Final Job Status', { + lambdaFunction: getStatusLambda, + // Use "guid" field as input + inputPath: '$.guid', + outputPath: '$.Payload', +}); + +const definition = submitJob + .next(waitX) + .next(getStatus) + .next(new sfn.Choice(this, 'Job Complete?') + // Look at the "status" field + .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed) + .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus) + .otherwise(waitX)); + +new sfn.StateMachine(this, 'StateMachine', { + definition, + timeout: Duration.minutes(5), +}); +``` + +You can find more sample snippets and learn more about the service integrations +in the `@aws-cdk/aws-stepfunctions-tasks` package. + +## State Machine + +A `stepfunctions.StateMachine` is a resource that takes a state machine +definition. The definition is specified by its start state, and encompasses +all states reachable from the start state: + +```ts +const startState = new sfn.Pass(this, 'StartState'); + +new sfn.StateMachine(this, 'StateMachine', { + definition: startState, +}); +``` + +State machines are made up of a sequence of **Steps**, which represent different actions +taken in sequence. Some of these steps represent *control flow* (like `Choice`, `Map` and `Wait`) +while others represent calls made against other AWS services (like `LambdaInvoke`). +The second category are called `Task`s and they can all be found in the module [`aws-stepfunctions-tasks`]. + +[`aws-stepfunctions-tasks`]: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions_tasks-readme.html + +State machines execute using an IAM Role, which will automatically have all +permissions added that are required to make all state machine tasks execute +properly (for example, permissions to invoke any Lambda functions you add to +your workflow). A role will be created by default, but you can supply an +existing one as well. + +Set the `removalPolicy` prop to `RemovalPolicy.RETAIN` if you want to retain the execution +history when CloudFormation deletes your state machine. + +## State Machine Data + +An Execution represents each time the State Machine is run. Every Execution has [State Machine +Data](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-state-machine-data.html): +a JSON document containing keys and values that is fed into the state machine, +gets modified by individual steps as the state machine progresses, and finally +is produced as output. + +By default, the entire Data object is passed into every state, and the return data of the step +becomes new the new Data object. This behavior can be modified by supplying values for `inputPath`, +`resultSelector`, `resultPath` and `outputPath`. + +### Manipulating state machine data using inputPath, resultSelector, resultPath and outputPath + +These properties impact how each individual step interacts with the state machine data: + +* `inputPath`: the part of the data object that gets passed to the step (`itemsPath` for `Map` states) +* `resultSelector`: the part of the step result that should be added to the state machine data +* `resultPath`: where in the state machine data the step result should be inserted +* `outputPath`: what part of the state machine data should be retained + +Their values should be a string indicating a [JSON path](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html) into the State Machine Data object (like `"$.MyKey"`). If absent, the values are treated as if they were `"$"`, which means the entire object. + +The following pseudocode shows how AWS Step Functions uses these parameters when executing a step: + +```js +// Schematically show how Step Functions evaluates functions. +// [] represents indexing into an object by a using JSON path. + +input = state[inputPath] + +result = invoke_step(select_parameters(input)) + +state[resultPath] = result[resultSelector] + +state = state[outputPath] +``` + +Instead of a JSON path string, each of these paths can also have the special value `JsonPath.DISCARD`, which causes the corresponding indexing expression to return an empty object (`{}`). Effectively, that means there will be an empty input object, an empty result object, no effect on the state, or an empty state, respectively. + +Some steps (mostly Tasks) have *Parameters*, which are selected differently. See the next section. + +See the official documentation on [input and output processing in Step Functions](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html). + +### Passing Parameters to Tasks + +Tasks take parameters, whose values can be taken from the State Machine Data object. For example, your +workflow may want to start a CodeBuild with an environment variable that is taken from the State Machine data, or pass part of the State Machine Data into an AWS Lambda Function. + +In the original JSON-based states language used by AWS Step Functions, you would +add `.$` to the end of a key to indicate that a value needs to be interpreted as +a JSON path. In the CDK API you do not change the names of any keys. Instead, you +pass special values. There are 3 types of task inputs to consider: + +* Tasks that accept a "payload" type of input (like AWS Lambda invocations, or posting messages to SNS topics or SQS queues), will take an object of type `TaskInput`, like `TaskInput.fromObject()` or `TaskInput.fromJsonPathAt()`. +* When tasks expect individual string or number values to customize their behavior, you can also pass a value constructed by `JsonPath.stringAt()` or `JsonPath.numberAt()`. +* When tasks expect strongly-typed resources and you want to vary the resource that is referenced based on a name from the State Machine Data, reference the resource as if it was external (using `JsonPath.stringAt()`). For example, for a Lambda function: `Function.fromFunctionName(this, 'ReferencedFunction', JsonPath.stringAt('$.MyFunctionName'))`. + +For example, to pass the value that's in the data key of `OrderId` to a Lambda +function as you invoke it, use `JsonPath.stringAt('$.OrderId')`, like so: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +declare const orderFn: lambda.Function; + +const submitJob = new tasks.LambdaInvoke(this, 'InvokeOrderProcessor', { + lambdaFunction: orderFn, + payload: sfn.TaskInput.fromObject({ + OrderId: sfn.JsonPath.stringAt('$.OrderId'), + }), +}); +``` + +The following methods are available: + +| Method | Purpose | +|--------|---------| +| `JsonPath.stringAt('$.Field')` | reference a field, return the type as a `string`. | +| `JsonPath.listAt('$.Field')` | reference a field, return the type as a list of strings. | +| `JsonPath.numberAt('$.Field')` | reference a field, return the type as a number. Use this for functions that expect a number argument. | +| `JsonPath.objectAt('$.Field')` | reference a field, return the type as an `IResolvable`. Use this for functions that expect an object argument. | +| `JsonPath.entirePayload` | reference the entire data object (equivalent to a path of `$`). | +| `JsonPath.taskToken` | reference the [Task Token](https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token), used for integration patterns that need to run for a long time. | + +You can also call [intrinsic functions](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html) using the methods on `JsonPath`: + +| Method | Purpose | +|--------|---------| +| `JsonPath.array(JsonPath.stringAt('$.Field'), ...)` | make an array from other elements. | +| `JsonPath.arrayPartition(JsonPath.listAt('$.inputArray'), 4)` | partition an array. | +| `JsonPath.arrayContains(JsonPath.listAt('$.inputArray'), 5)` | determine if a specific value is present in an array. | +| `JsonPath.arrayRange(1, 9, 2)` | create a new array containing a specific range of elements. | +| `JsonPath.arrayGetItem(JsonPath.listAt('$.inputArray'), 5)` | get a specified index's value in an array. | +| `JsonPath.arrayLength(JsonPath.listAt('$.inputArray'))` | get the length of an array. | +| `JsonPath.arrayUnique(JsonPath.listAt('$.inputArray'))` | remove duplicate values from an array. | +| `JsonPath.base64Encode(JsonPath.stringAt('$.input'))` | encode data based on MIME Base64 encoding scheme. | +| `JsonPath.base64Decode(JsonPath.stringAt('$.base64'))` | decode data based on MIME Base64 decoding scheme. | +| `JsonPath.hash(JsonPath.objectAt('$.Data'), JsonPath.stringAt('$.Algorithm'))` | calculate the hash value of a given input. | +| `JsonPath.jsonMerge(JsonPath.objectAt('$.Obj1'), JsonPath.objectAt('$.Obj2'))` | merge two JSON objects into a single object. | +| `JsonPath.stringToJson(JsonPath.stringAt('$.ObjStr'))` | parse a JSON string to an object | +| `JsonPath.jsonToString(JsonPath.objectAt('$.Obj'))` | stringify an object to a JSON string | +| `JsonPath.mathRandom(1, 999)` | return a random number. | +| `JsonPath.mathAdd(JsonPath.numberAt('$.value1'), JsonPath.numberAt('$.step'))` | return the sum of two numbers. | +| `JsonPath.stringSplit(JsonPath.stringAt('$.inputString'), JsonPath.stringAt('$.splitter'))` | split a string into an array of values. | +| `JsonPath.uuid()` | return a version 4 universally unique identifier (v4 UUID). | +| `JsonPath.format('The value is {}.', JsonPath.stringAt('$.Value'))` | insert elements into a format string. | + +## Amazon States Language + +This library comes with a set of classes that model the [Amazon States +Language](https://states-language.net/spec.html). The following State classes +are supported: + +* [`Task`](#task) +* [`Pass`](#pass) +* [`Wait`](#wait) +* [`Choice`](#choice) +* [`Parallel`](#parallel) +* [`Succeed`](#succeed) +* [`Fail`](#fail) +* [`Map`](#map) +* [`Custom State`](#custom-state) + +An arbitrary JSON object (specified at execution start) is passed from state to +state and transformed during the execution of the workflow. For more +information, see the States Language spec. + +### Task + +A `Task` represents some work that needs to be done. Do not use the `Task` class directly. + +Instead, use one of the classes in the `@aws-cdk/aws-stepfunctions-tasks` module, +which provide a much more ergonomic way to integrate with various AWS services. + +### Pass + +A `Pass` state passes its input to its output, without performing work. +Pass states are useful when constructing and debugging state machines. + +The following example injects some fixed data into the state machine through +the `result` field. The `result` field will be added to the input and the result +will be passed as the state's output. + +```ts +// Makes the current JSON state { ..., "subObject": { "hello": "world" } } +const pass = new sfn.Pass(this, 'Add Hello World', { + result: sfn.Result.fromObject({ hello: 'world' }), + resultPath: '$.subObject', +}); + +// Set the next state +const nextState = new sfn.Pass(this, 'NextState'); +pass.next(nextState); +``` + +The `Pass` state also supports passing key-value pairs as input. Values can +be static, or selected from the input with a path. + +The following example filters the `greeting` field from the state input +and also injects a field called `otherData`. + +```ts +const pass = new sfn.Pass(this, 'Filter input and inject data', { + parameters: { // input to the pass state + input: sfn.JsonPath.stringAt('$.input.greeting'), + otherData: 'some-extra-stuff', + }, +}); +``` + +The object specified in `parameters` will be the input of the `Pass` state. +Since neither `Result` nor `ResultPath` are supplied, the `Pass` state copies +its input through to its output. + +Learn more about the [Pass state](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-pass-state.html) + +### Wait + +A `Wait` state waits for a given number of seconds, or until the current time +hits a particular time. The time to wait may be taken from the execution's JSON +state. + +```ts +// Wait until it's the time mentioned in the the state object's "triggerTime" +// field. +const wait = new sfn.Wait(this, 'Wait For Trigger Time', { + time: sfn.WaitTime.timestampPath('$.triggerTime'), +}); + +// Set the next state +const startTheWork = new sfn.Pass(this, 'StartTheWork'); +wait.next(startTheWork); +``` + +### Choice + +A `Choice` state can take a different path through the workflow based on the +values in the execution's JSON state: + +```ts +const choice = new sfn.Choice(this, 'Did it work?'); + +// Add conditions with .when() +const successState = new sfn.Pass(this, 'SuccessState'); +const failureState = new sfn.Pass(this, 'FailureState'); +choice.when(sfn.Condition.stringEquals('$.status', 'SUCCESS'), successState); +choice.when(sfn.Condition.numberGreaterThan('$.attempts', 5), failureState); + +// Use .otherwise() to indicate what should be done if none of the conditions match +const tryAgainState = new sfn.Pass(this, 'TryAgainState'); +choice.otherwise(tryAgainState); +``` + +If you want to temporarily branch your workflow based on a condition, but have +all branches come together and continuing as one (similar to how an `if ... +then ... else` works in a programming language), use the `.afterwards()` method: + +```ts +const choice = new sfn.Choice(this, 'What color is it?'); +const handleBlueItem = new sfn.Pass(this, 'HandleBlueItem'); +const handleRedItem = new sfn.Pass(this, 'HandleRedItem'); +const handleOtherItemColor = new sfn.Pass(this, 'HanldeOtherItemColor'); +choice.when(sfn.Condition.stringEquals('$.color', 'BLUE'), handleBlueItem); +choice.when(sfn.Condition.stringEquals('$.color', 'RED'), handleRedItem); +choice.otherwise(handleOtherItemColor); + +// Use .afterwards() to join all possible paths back together and continue +const shipTheItem = new sfn.Pass(this, 'ShipTheItem'); +choice.afterwards().next(shipTheItem); +``` + +If your `Choice` doesn't have an `otherwise()` and none of the conditions match +the JSON state, a `NoChoiceMatched` error will be thrown. Wrap the state machine +in a `Parallel` state if you want to catch and recover from this. + +#### Available Conditions + +see [step function comparison operators](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html#amazon-states-language-choice-state-rules) + +* `Condition.isPresent` - matches if a json path is present +* `Condition.isNotPresent` - matches if a json path is not present +* `Condition.isString` - matches if a json path contains a string +* `Condition.isNotString` - matches if a json path is not a string +* `Condition.isNumeric` - matches if a json path is numeric +* `Condition.isNotNumeric` - matches if a json path is not numeric +* `Condition.isBoolean` - matches if a json path is boolean +* `Condition.isNotBoolean` - matches if a json path is not boolean +* `Condition.isTimestamp` - matches if a json path is a timestamp +* `Condition.isNotTimestamp` - matches if a json path is not a timestamp +* `Condition.isNotNull` - matches if a json path is not null +* `Condition.isNull` - matches if a json path is null +* `Condition.booleanEquals` - matches if a boolean field has a given value +* `Condition.booleanEqualsJsonPath` - matches if a boolean field equals a value in a given mapping path +* `Condition.stringEqualsJsonPath` - matches if a string field equals a given mapping path +* `Condition.stringEquals` - matches if a field equals a string value +* `Condition.stringLessThan` - matches if a string field sorts before a given value +* `Condition.stringLessThanJsonPath` - matches if a string field sorts before a value at given mapping path +* `Condition.stringLessThanEquals` - matches if a string field sorts equal to or before a given value +* `Condition.stringLessThanEqualsJsonPath` - matches if a string field sorts equal to or before a given mapping +* `Condition.stringGreaterThan` - matches if a string field sorts after a given value +* `Condition.stringGreaterThanJsonPath` - matches if a string field sorts after a value at a given mapping path +* `Condition.stringGreaterThanEqualsJsonPath` - matches if a string field sorts after or equal to value at a given mapping path +* `Condition.stringGreaterThanEquals` - matches if a string field sorts after or equal to a given value +* `Condition.numberEquals` - matches if a numeric field has the given value +* `Condition.numberEqualsJsonPath` - matches if a numeric field has the value in a given mapping path +* `Condition.numberLessThan` - matches if a numeric field is less than the given value +* `Condition.numberLessThanJsonPath` - matches if a numeric field is less than the value at the given mapping path +* `Condition.numberLessThanEquals` - matches if a numeric field is less than or equal to the given value +* `Condition.numberLessThanEqualsJsonPath` - matches if a numeric field is less than or equal to the numeric value at given mapping path +* `Condition.numberGreaterThan` - matches if a numeric field is greater than the given value +* `Condition.numberGreaterThanJsonPath` - matches if a numeric field is greater than the value at a given mapping path +* `Condition.numberGreaterThanEquals` - matches if a numeric field is greater than or equal to the given value +* `Condition.numberGreaterThanEqualsJsonPath` - matches if a numeric field is greater than or equal to the value at a given mapping path +* `Condition.timestampEquals` - matches if a timestamp field is the same time as the given timestamp +* `Condition.timestampEqualsJsonPath` - matches if a timestamp field is the same time as the timestamp at a given mapping path +* `Condition.timestampLessThan` - matches if a timestamp field is before the given timestamp +* `Condition.timestampLessThanJsonPath` - matches if a timestamp field is before the timestamp at a given mapping path +* `Condition.timestampLessThanEquals` - matches if a timestamp field is before or equal to the given timestamp +* `Condition.timestampLessThanEqualsJsonPath` - matches if a timestamp field is before or equal to the timestamp at a given mapping path +* `Condition.timestampGreaterThan` - matches if a timestamp field is after the timestamp at a given mapping path +* `Condition.timestampGreaterThanJsonPath` - matches if a timestamp field is after the timestamp at a given mapping path +* `Condition.timestampGreaterThanEquals` - matches if a timestamp field is after or equal to the given timestamp +* `Condition.timestampGreaterThanEqualsJsonPath` - matches if a timestamp field is after or equal to the timestamp at a given mapping path +* `Condition.stringMatches` - matches if a field matches a string pattern that can contain a wild card (\*) e.g: log-\*.txt or \*LATEST\*. No other characters other than "\*" have any special meaning - \* can be escaped: \\\\* + +### Parallel + +A `Parallel` state executes one or more subworkflows in parallel. It can also +be used to catch and recover from errors in subworkflows. + +```ts +const parallel = new sfn.Parallel(this, 'Do the work in parallel'); + +// Add branches to be executed in parallel +const shipItem = new sfn.Pass(this, 'ShipItem'); +const sendInvoice = new sfn.Pass(this, 'SendInvoice'); +const restock = new sfn.Pass(this, 'Restock'); +parallel.branch(shipItem); +parallel.branch(sendInvoice); +parallel.branch(restock); + +// Retry the whole workflow if something goes wrong +parallel.addRetry({ maxAttempts: 1 }); + +// How to recover from errors +const sendFailureNotification = new sfn.Pass(this, 'SendFailureNotification'); +parallel.addCatch(sendFailureNotification); + +// What to do in case everything succeeded +const closeOrder = new sfn.Pass(this, 'CloseOrder'); +parallel.next(closeOrder); +``` + +### Succeed + +Reaching a `Succeed` state terminates the state machine execution with a +successful status. + +```ts +const success = new sfn.Succeed(this, 'We did it!'); +``` + +### Fail + +Reaching a `Fail` state terminates the state machine execution with a +failure status. The fail state should report the reason for the failure. +Failures can be caught by encompassing `Parallel` states. + +```ts +const success = new sfn.Fail(this, 'Fail', { + error: 'WorkflowFailure', + cause: "Something went wrong", +}); +``` + +### Map + +A `Map` state can be used to run a set of steps for each element of an input array. +A `Map` state will execute the same steps for multiple entries of an array in the state input. + +While the `Parallel` state executes multiple branches of steps using the same input, a `Map` state will +execute the same steps for multiple entries of an array in the state input. + +```ts +const map = new sfn.Map(this, 'Map State', { + maxConcurrency: 1, + itemsPath: sfn.JsonPath.stringAt('$.inputForMap'), +}); +map.iterator(new sfn.Pass(this, 'Pass State')); +``` + +### Custom State + +It's possible that the high-level constructs for the states or `stepfunctions-tasks` do not have +the states or service integrations you are looking for. The primary reasons for this lack of +functionality are: + +* A [service integration](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-service-integrations.html) is available through Amazon States Language, but not available as construct + classes in the CDK. +* The state or state properties are available through Step Functions, but are not configurable + through constructs + +If a feature is not available, a `CustomState` can be used to supply any Amazon States Language +JSON-based object as the state definition. + +[Code Snippets](https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1) are available and can be plugged in as the state definition. + +Custom states can be chained together with any of the other states to create your state machine +definition. You will also need to provide any permissions that are required to the `role` that +the State Machine uses. + +The following example uses the `DynamoDB` service integration to insert data into a DynamoDB table. + +```ts +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; + +// create a table +const table = new dynamodb.Table(this, 'montable', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING, + }, +}); + +const finalStatus = new sfn.Pass(this, 'final step'); + +// States language JSON to put an item into DynamoDB +// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1 +const stateJson = { + Type: 'Task', + Resource: 'arn:aws:states:::dynamodb:putItem', + Parameters: { + TableName: table.tableName, + Item: { + id: { + S: 'MyEntry', + }, + }, + }, + ResultPath: null, +}; + +// custom state which represents a task to insert data into DynamoDB +const custom = new sfn.CustomState(this, 'my custom task', { + stateJson, +}); + +const chain = sfn.Chain.start(custom) + .next(finalStatus); + +const sm = new sfn.StateMachine(this, 'StateMachine', { + definition: chain, + timeout: Duration.seconds(30), +}); + +// don't forget permissions. You need to assign them +table.grantWriteData(sm); +``` + +## Task Chaining + +To make defining work flows as convenient (and readable in a top-to-bottom way) +as writing regular programs, it is possible to chain most methods invocations. +In particular, the `.next()` method can be repeated. The result of a series of +`.next()` calls is called a **Chain**, and can be used when defining the jump +targets of `Choice.on` or `Parallel.branch`: + +```ts +const step1 = new sfn.Pass(this, 'Step1'); +const step2 = new sfn.Pass(this, 'Step2'); +const step3 = new sfn.Pass(this, 'Step3'); +const step4 = new sfn.Pass(this, 'Step4'); +const step5 = new sfn.Pass(this, 'Step5'); +const step6 = new sfn.Pass(this, 'Step6'); +const step7 = new sfn.Pass(this, 'Step7'); +const step8 = new sfn.Pass(this, 'Step8'); +const step9 = new sfn.Pass(this, 'Step9'); +const step10 = new sfn.Pass(this, 'Step10'); +const choice = new sfn.Choice(this, 'Choice'); +const condition1 = sfn.Condition.stringEquals('$.status', 'SUCCESS'); +const parallel = new sfn.Parallel(this, 'Parallel'); +const finish = new sfn.Pass(this, 'Finish'); + +const definition = step1 + .next(step2) + .next(choice + .when(condition1, step3.next(step4).next(step5)) + .otherwise(step6) + .afterwards()) + .next(parallel + .branch(step7.next(step8)) + .branch(step9.next(step10))) + .next(finish); + +new sfn.StateMachine(this, 'StateMachine', { + definition, +}); +``` + +If you don't like the visual look of starting a chain directly off the first +step, you can use `Chain.start`: + +```ts +const step1 = new sfn.Pass(this, 'Step1'); +const step2 = new sfn.Pass(this, 'Step2'); +const step3 = new sfn.Pass(this, 'Step3'); + +const definition = sfn.Chain + .start(step1) + .next(step2) + .next(step3) + // ... +``` + +## Task Credentials + +Tasks are executed using the State Machine's execution role. In some cases, e.g. cross-account access, an IAM role can be assumed by the State Machine's execution role to provide access to the resource. +This can be achieved by providing the optional `credentials` property which allows using a fixed role or a json expression to resolve the role at runtime from the task's inputs. + +```ts +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +declare const submitLambda: lambda.Function; +declare const iamRole: iam.Role; + +// use a fixed role for all task invocations +const role = sfn.TaskRole.fromRole(iamRole); +// or use a json expression to resolve the role at runtime based on task inputs +//const role = sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn'); + +const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', { + lambdaFunction: submitLambda, + outputPath: '$.Payload', + // use credentials + credentials: { role }, +}); +``` + +See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html) +to learn more about AWS Step Functions support for accessing resources in other AWS accounts. + +## State Machine Fragments + +It is possible to define reusable (or abstracted) mini-state machines by +defining a construct that implements `IChainable`, which requires you to define +two fields: + +* `startState: State`, representing the entry point into this state machine. +* `endStates: INextable[]`, representing the (one or more) states that outgoing + transitions will be added to if you chain onto the fragment. + +Since states will be named after their construct IDs, you may need to prefix the +IDs of states if you plan to instantiate the same state machine fragment +multiples times (otherwise all states in every instantiation would have the same +name). + +The class `StateMachineFragment` contains some helper functions (like +`prefixStates()`) to make it easier for you to do this. If you define your state +machine as a subclass of this, it will be convenient to use: + +```ts nofixture +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; + +interface MyJobProps { + jobFlavor: string; +} + +class MyJob extends sfn.StateMachineFragment { + public readonly startState: sfn.State; + public readonly endStates: sfn.INextable[]; + + constructor(parent: Construct, id: string, props: MyJobProps) { + super(parent, id); + + const choice = new sfn.Choice(this, 'Choice') + .when(sfn.Condition.stringEquals('$.branch', 'left'), new sfn.Pass(this, 'Left Branch')) + .when(sfn.Condition.stringEquals('$.branch', 'right'), new sfn.Pass(this, 'Right Branch')); + + // ... + + this.startState = choice; + this.endStates = choice.afterwards().endStates; + } +} + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + // Do 3 different variants of MyJob in parallel + const parallel = new sfn.Parallel(this, 'All jobs') + .branch(new MyJob(this, 'Quick', { jobFlavor: 'quick' }).prefixStates()) + .branch(new MyJob(this, 'Medium', { jobFlavor: 'medium' }).prefixStates()) + .branch(new MyJob(this, 'Slow', { jobFlavor: 'slow' }).prefixStates()); + + new sfn.StateMachine(this, 'MyStateMachine', { + definition: parallel, + }); + } +} +``` + +A few utility functions are available to parse state machine fragments. + +* `State.findReachableStates`: Retrieve the list of states reachable from a given state. +* `State.findReachableEndStates`: Retrieve the list of end or terminal states reachable from a given state. + +## Activity + +**Activities** represent work that is done on some non-Lambda worker pool. The +Step Functions workflow will submit work to this Activity, and a worker pool +that you run yourself, probably on EC2, will pull jobs from the Activity and +submit the results of individual jobs back. + +You need the ARN to do so, so if you use Activities be sure to pass the Activity +ARN into your worker pool: + +```ts +const activity = new sfn.Activity(this, 'Activity'); + +// Read this CloudFormation Output from your application and use it to poll for work on +// the activity. +new CfnOutput(this, 'ActivityArn', { value: activity.activityArn }); +``` + +### Activity-Level Permissions + +Granting IAM permissions to an activity can be achieved by calling the `grant(principal, actions)` API: + +```ts +const activity = new sfn.Activity(this, 'Activity'); + +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); + +activity.grant(role, 'states:SendTaskSuccess'); +``` + +This will grant the IAM principal the specified actions onto the activity. + +## Metrics + +`Task` object expose various metrics on the execution of that particular task. For example, +to create an alarm on a particular task failing: + +```ts +declare const task: sfn.Task; +new cloudwatch.Alarm(this, 'TaskAlarm', { + metric: task.metricFailed(), + threshold: 1, + evaluationPeriods: 1, +}); +``` + +There are also metrics on the complete state machine: + +```ts +declare const stateMachine: sfn.StateMachine; +new cloudwatch.Alarm(this, 'StateMachineAlarm', { + metric: stateMachine.metricFailed(), + threshold: 1, + evaluationPeriods: 1, +}); +``` + +And there are metrics on the capacity of all state machines in your account: + +```ts +new cloudwatch.Alarm(this, 'ThrottledAlarm', { + metric: sfn.StateTransitionMetric.metricThrottledEvents(), + threshold: 10, + evaluationPeriods: 2, +}); +``` + +## Error names + +Step Functions identifies errors in the Amazon States Language using case-sensitive strings, known as error names. +The Amazon States Language defines a set of built-in strings that name well-known errors, all beginning with the `States.` prefix. + +* `States.ALL` - A wildcard that matches any known error name. +* `States.Runtime` - An execution failed due to some exception that could not be processed. Often these are caused by errors at runtime, such as attempting to apply InputPath or OutputPath on a null JSON payload. A `States.Runtime` error is not retriable, and will always cause the execution to fail. A retry or catch on `States.ALL` will NOT catch States.Runtime errors. +* `States.DataLimitExceeded` - A States.DataLimitExceeded exception will be thrown for the following: + * When the output of a connector is larger than payload size quota. + * When the output of a state is larger than payload size quota. + * When, after Parameters processing, the input of a state is larger than the payload size quota. + * See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/limits-overview.html) to learn more about AWS Step Functions Quotas. +* `States.HeartbeatTimeout` - A Task state failed to send a heartbeat for a period longer than the HeartbeatSeconds value. +* `States.Timeout` - A Task state either ran longer than the TimeoutSeconds value, or failed to send a heartbeat for a period longer than the HeartbeatSeconds value. +* `States.TaskFailed`- A Task state failed during the execution. When used in a retry or catch, `States.TaskFailed` acts as a wildcard that matches any known error name except for `States.Timeout`. + +## Logging + +Enable logging to CloudWatch by passing a logging configuration with a +destination LogGroup: + +```ts +import * as logs from 'aws-cdk-lib/aws-logs'; + +const logGroup = new logs.LogGroup(this, 'MyLogGroup'); + +new sfn.StateMachine(this, 'MyStateMachine', { + definition: sfn.Chain.start(new sfn.Pass(this, 'Pass')), + logs: { + destination: logGroup, + level: sfn.LogLevel.ALL, + }, +}); +``` + +## X-Ray tracing + +Enable X-Ray tracing for StateMachine: + +```ts +new sfn.StateMachine(this, 'MyStateMachine', { + definition: sfn.Chain.start(new sfn.Pass(this, 'Pass')), + tracingEnabled: true, +}); +``` + +See [the AWS documentation](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-xray-tracing.html) +to learn more about AWS Step Functions's X-Ray support. + +## State Machine Permission Grants + +IAM roles, users, or groups which need to be able to work with a State Machine should be granted IAM permissions. + +Any object that implements the `IGrantable` interface (has an associated principal) can be granted permissions by calling: + +* `stateMachine.grantStartExecution(principal)` - grants the principal the ability to execute the state machine +* `stateMachine.grantRead(principal)` - grants the principal read access +* `stateMachine.grantTaskResponse(principal)` - grants the principal the ability to send task tokens to the state machine +* `stateMachine.grantExecution(principal, actions)` - grants the principal execution-level permissions for the IAM actions specified +* `stateMachine.grant(principal, actions)` - grants the principal state-machine-level permissions for the IAM actions specified + +### Start Execution Permission + +Grant permission to start an execution of a state machine by calling the `grantStartExecution()` API. + +```ts +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); + +declare const definition: sfn.IChainable; +const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, +}); + +// Give role permission to start execution of state machine +stateMachine.grantStartExecution(role); +``` + +The following permission is provided to a service principal by the `grantStartExecution()` API: + +* `states:StartExecution` - to state machine + +### Read Permissions + +Grant `read` access to a state machine by calling the `grantRead()` API. + +```ts +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); + +declare const definition: sfn.IChainable; +const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, +}); + +// Give role read access to state machine +stateMachine.grantRead(role); +``` + +The following read permissions are provided to a service principal by the `grantRead()` API: + +* `states:ListExecutions` - to state machine +* `states:ListStateMachines` - to state machine +* `states:DescribeExecution` - to executions +* `states:DescribeStateMachineForExecution` - to executions +* `states:GetExecutionHistory` - to executions +* `states:ListActivities` - to `*` +* `states:DescribeStateMachine` - to `*` +* `states:DescribeActivity` - to `*` + +### Task Response Permissions + +Grant permission to allow task responses to a state machine by calling the `grantTaskResponse()` API: + +```ts +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); + +declare const definition: sfn.IChainable; +const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, +}); + +// Give role task response permissions to the state machine +stateMachine.grantTaskResponse(role); +``` + +The following read permissions are provided to a service principal by the `grantRead()` API: + +* `states:SendTaskSuccess` - to state machine +* `states:SendTaskFailure` - to state machine +* `states:SendTaskHeartbeat` - to state machine + +### Execution-level Permissions + +Grant execution-level permissions to a state machine by calling the `grantExecution()` API: + +```ts +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), +}); + +declare const definition: sfn.IChainable; +const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, +}); + +// Give role permission to get execution history of ALL executions for the state machine +stateMachine.grantExecution(role, 'states:GetExecutionHistory'); +``` + +### Custom Permissions + +You can add any set of permissions to a state machine by calling the `grant()` API. + +```ts +const user = new iam.User(this, 'MyUser'); + +declare const definition: sfn.IChainable; +const stateMachine = new sfn.StateMachine(this, 'StateMachine', { + definition, +}); + +//give user permission to send task success to the state machine +stateMachine.grant(user, 'states:SendTaskSuccess'); +``` + +## Import + +Any Step Functions state machine that has been created outside the stack can be imported +into your CDK stack. + +State machines can be imported by their ARN via the `StateMachine.fromStateMachineArn()` API. +In addition, the StateMachine can be imported via the `StateMachine.fromStateMachineName()` method, as long as they are in the same account/region as the current construct. + +```ts +const app = new App(); +const stack = new Stack(app, 'MyStack'); +sfn.StateMachine.fromStateMachineArn( + stack, + "ViaArnImportedStateMachine", + "arn:aws:states:us-east-1:123456789012:stateMachine:StateMachine2E01A3A5-N5TJppzoevKQ" +); + +sfn.StateMachine.fromStateMachineName( + stack, + "ViaResourceNameImportedStateMachine", + "StateMachine2E01A3A5-N5TJppzoevKQ" +); +``` diff --git a/packages/aws-cdk-lib/aws-stepfunctions/index.ts b/packages/aws-cdk-lib/aws-stepfunctions/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/activity.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/lib/activity.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/activity.ts index a226142e11959..4edc810941d10 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/activity.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/activity.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import { ArnFormat, IResource, Lazy, Names, Resource, Stack } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import { ArnFormat, IResource, Lazy, Names, Resource, Stack } from '../../core'; import { Construct } from 'constructs'; import { StatesMetrics } from './stepfunctions-canned-metrics.generated'; import { CfnActivity } from './stepfunctions.generated'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/chain.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/chain.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/chain.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/chain.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/condition.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/condition.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/condition.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/condition.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/fields.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/lib/fields.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/fields.ts index 2d1405ffd1b72..48a44949cee71 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/fields.ts @@ -1,4 +1,4 @@ -import { Token, IResolvable, JsonNull } from '@aws-cdk/core'; +import { Token, IResolvable, JsonNull } from '../../core'; import { findReferencedPaths, jsonPathString, JsonPathToken, renderObject, renderInExpression, jsonPathFromAny } from './private/json-path'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/index.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/index.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/index.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/index.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/input.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/input.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/input.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/input.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/private/intrinstics.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/private/intrinstics.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/private/intrinstics.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/private/intrinstics.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/private/json-path.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/private/json-path.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/lib/private/json-path.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/private/json-path.ts index afcb4dcc22cd6..f54697d74d52b 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/private/json-path.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/private/json-path.ts @@ -1,4 +1,4 @@ -import { captureStackTrace, IResolvable, IResolveContext, Token, Tokenization } from '@aws-cdk/core'; +import { captureStackTrace, IResolvable, IResolveContext, Token, Tokenization } from '../../../core'; import { IntrinsicParser, IntrinsicExpression } from './intrinstics'; const JSON_PATH_TOKEN_SYMBOL = Symbol.for('@aws-cdk/aws-stepfunctions.JsonPathToken'); diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-graph.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-graph.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/lib/state-graph.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/state-graph.ts index 913879ebc7a29..b308c97b9b966 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-graph.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-graph.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { Duration } from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import { Duration } from '../../core'; import { State } from './states/state'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-machine-fragment.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine-fragment.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/state-machine-fragment.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine-fragment.ts diff --git a/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts new file mode 100644 index 0000000000000..a0710832d197a --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts @@ -0,0 +1,624 @@ +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import { Arn, ArnFormat, Duration, IResource, RemovalPolicy, Resource, Stack, Token } from '../../core'; +import { Construct } from 'constructs'; +import { StateGraph } from './state-graph'; +import { StatesMetrics } from './stepfunctions-canned-metrics.generated'; +import { CfnStateMachine } from './stepfunctions.generated'; +import { IChainable } from './types'; + +/** + * Two types of state machines are available in AWS Step Functions: EXPRESS AND STANDARD. + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html + * + * @default STANDARD + */ +export enum StateMachineType { + /** + * Express Workflows are ideal for high-volume, event processing workloads. + */ + EXPRESS = 'EXPRESS', + + /** + * Standard Workflows are ideal for long-running, durable, and auditable workflows. + */ + STANDARD = 'STANDARD' +} + +/** + * Defines which category of execution history events are logged. + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html + * + * @default ERROR + */ +export enum LogLevel { + /** + * No Logging + */ + OFF = 'OFF', + /** + * Log everything + */ + ALL = 'ALL', + /** + * Log all errors + */ + ERROR = 'ERROR', + /** + * Log fatal errors + */ + FATAL = 'FATAL' +} + +/** + * Defines what execution history events are logged and where they are logged. + */ +export interface LogOptions { + /** + * The log group where the execution history events will be logged. + */ + readonly destination: logs.ILogGroup; + + /** + * Determines whether execution data is included in your log. + * + * @default false + */ + readonly includeExecutionData?: boolean; + + /** + * Defines which category of execution history events are logged. + * + * @default ERROR + */ + readonly level?: LogLevel; +} + +/** + * Properties for defining a State Machine + */ +export interface StateMachineProps { + /** + * A name for the state machine + * + * @default A name is automatically generated + */ + readonly stateMachineName?: string; + + /** + * Definition for this state machine + */ + readonly definition: IChainable; + + /** + * The execution role for the state machine service + * + * @default A role is automatically created + */ + readonly role?: iam.IRole; + + /** + * Maximum run time for this state machine + * + * @default No timeout + */ + readonly timeout?: Duration; + + /** + * Type of the state machine + * + * @default StateMachineType.STANDARD + */ + readonly stateMachineType?: StateMachineType; + + /** + * Defines what execution history events are logged and where they are logged. + * + * @default No logging + */ + readonly logs?: LogOptions; + + /** + * Specifies whether Amazon X-Ray tracing is enabled for this state machine. + * + * @default false + */ + readonly tracingEnabled?: boolean; + + /** + * The removal policy to apply to state machine + * + * @default RemovalPolicy.DESTROY + */ + readonly removalPolicy?: RemovalPolicy; +} + +/** + * A new or imported state machine. + */ +abstract class StateMachineBase extends Resource implements IStateMachine { + + /** + * Import a state machine + */ + public static fromStateMachineArn(scope: Construct, id: string, stateMachineArn: string): IStateMachine { + class Import extends StateMachineBase { + public readonly stateMachineArn = stateMachineArn; + public readonly grantPrincipal = new iam.UnknownPrincipal({ resource: this }); + } + return new Import(scope, id, { + environmentFromArn: stateMachineArn, + }); + } + + /** + * Import a state machine via resource name + */ + public static fromStateMachineName(scope: Construct, id: string, stateMachineName: string): IStateMachine { + const stateMachineArn = Stack.of(scope).formatArn({ + service: 'states', + resource: 'stateMachine', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + resourceName: stateMachineName, + }); + return this.fromStateMachineArn(scope, id, stateMachineArn); + } + + public abstract readonly stateMachineArn: string; + + /** + * The principal this state machine is running as + */ + public abstract readonly grantPrincipal: iam.IPrincipal; + + /** + * Grant the given identity permissions to start an execution of this state + * machine. + */ + public grantStartExecution(identity: iam.IGrantable): iam.Grant { + return iam.Grant.addToPrincipal({ + grantee: identity, + actions: ['states:StartExecution'], + resourceArns: [this.stateMachineArn], + }); + } + + /** + * Grant the given identity permissions to start a synchronous execution of + * this state machine. + */ + public grantStartSyncExecution(identity: iam.IGrantable): iam.Grant { + return iam.Grant.addToPrincipal({ + grantee: identity, + actions: ['states:StartSyncExecution'], + resourceArns: [this.stateMachineArn], + }); + } + + /** + * Grant the given identity permissions to read results from state + * machine. + */ + public grantRead(identity: iam.IGrantable): iam.Grant { + iam.Grant.addToPrincipal({ + grantee: identity, + actions: [ + 'states:ListExecutions', + 'states:ListStateMachines', + ], + resourceArns: [this.stateMachineArn], + }); + iam.Grant.addToPrincipal({ + grantee: identity, + actions: [ + 'states:DescribeExecution', + 'states:DescribeStateMachineForExecution', + 'states:GetExecutionHistory', + ], + resourceArns: [`${this.executionArn()}:*`], + }); + return iam.Grant.addToPrincipal({ + grantee: identity, + actions: [ + 'states:ListActivities', + 'states:DescribeStateMachine', + 'states:DescribeActivity', + ], + resourceArns: ['*'], + }); + } + + /** + * Grant the given identity task response permissions on a state machine + */ + public grantTaskResponse(identity: iam.IGrantable): iam.Grant { + return iam.Grant.addToPrincipal({ + grantee: identity, + actions: [ + 'states:SendTaskSuccess', + 'states:SendTaskFailure', + 'states:SendTaskHeartbeat', + ], + resourceArns: [this.stateMachineArn], + }); + } + + /** + * Grant the given identity permissions on all executions of the state machine + */ + public grantExecution(identity: iam.IGrantable, ...actions: string[]) { + return iam.Grant.addToPrincipal({ + grantee: identity, + actions, + resourceArns: [`${this.executionArn()}:*`], + }); + } + + /** + * Grant the given identity custom permissions + */ + public grant(identity: iam.IGrantable, ...actions: string[]): iam.Grant { + return iam.Grant.addToPrincipal({ + grantee: identity, + actions, + resourceArns: [this.stateMachineArn], + }); + } + + + /** + * Return the given named metric for this State Machine's executions + * + * @default - sum over 5 minutes + */ + public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + namespace: 'AWS/States', + metricName, + dimensionsMap: { StateMachineArn: this.stateMachineArn }, + statistic: 'sum', + ...props, + }).attachTo(this); + } + + /** + * Metric for the number of executions that failed + * + * @default - sum over 5 minutes + */ + public metricFailed(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(StatesMetrics.executionsFailedSum, props); + } + + /** + * Metric for the number of executions that were throttled + * + * @default - sum over 5 minutes + */ + public metricThrottled(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + // There's a typo in the "canned" version of this + return this.metric('ExecutionThrottled', props); + } + + /** + * Metric for the number of executions that were aborted + * + * @default - sum over 5 minutes + */ + public metricAborted(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(StatesMetrics.executionsAbortedSum, props); + } + + /** + * Metric for the number of executions that succeeded + * + * @default - sum over 5 minutes + */ + public metricSucceeded(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(StatesMetrics.executionsSucceededSum, props); + } + + /** + * Metric for the number of executions that timed out + * + * @default - sum over 5 minutes + */ + public metricTimedOut(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(StatesMetrics.executionsTimedOutSum, props); + } + + /** + * Metric for the number of executions that were started + * + * @default - sum over 5 minutes + */ + public metricStarted(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.metric('ExecutionsStarted', props); + } + + /** + * Metric for the interval, in milliseconds, between the time the execution starts and the time it closes + * + * @default - average over 5 minutes + */ + public metricTime(props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return this.cannedMetric(StatesMetrics.executionTimeAverage, props); + } + + /** + * Returns the pattern for the execution ARN's of the state machine + */ + private executionArn(): string { + return Stack.of(this).formatArn({ + resource: 'execution', + service: 'states', + resourceName: Arn.split(this.stateMachineArn, ArnFormat.COLON_RESOURCE_NAME).resourceName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + } + + private cannedMetric( + fn: (dims: { StateMachineArn: string }) => cloudwatch.MetricProps, + props?: cloudwatch.MetricOptions): cloudwatch.Metric { + return new cloudwatch.Metric({ + ...fn({ StateMachineArn: this.stateMachineArn }), + ...props, + }).attachTo(this); + } +} + +/** + * Define a StepFunctions State Machine + */ +export class StateMachine extends StateMachineBase { + /** + * Execution role of this state machine + */ + public readonly role: iam.IRole; + + /** + * The name of the state machine + * @attribute + */ + public readonly stateMachineName: string; + + /** + * The ARN of the state machine + */ + public readonly stateMachineArn: string; + + /** + * Type of the state machine + * @attribute + */ + public readonly stateMachineType: StateMachineType; + + constructor(scope: Construct, id: string, props: StateMachineProps) { + super(scope, id, { + physicalName: props.stateMachineName, + }); + + if (props.stateMachineName !== undefined) { + this.validateStateMachineName(props.stateMachineName); + } + + this.role = props.role || new iam.Role(this, 'Role', { + assumedBy: new iam.ServicePrincipal('states.amazonaws.com'), + }); + + const graph = new StateGraph(props.definition.startState, `State Machine ${id} definition`); + graph.timeout = props.timeout; + + this.stateMachineType = props.stateMachineType ?? StateMachineType.STANDARD; + + const resource = new CfnStateMachine(this, 'Resource', { + stateMachineName: this.physicalName, + stateMachineType: props.stateMachineType ?? undefined, + roleArn: this.role.roleArn, + definitionString: Stack.of(this).toJsonString(graph.toGraphJson()), + loggingConfiguration: props.logs ? this.buildLoggingConfiguration(props.logs) : undefined, + tracingConfiguration: props.tracingEnabled ? this.buildTracingConfiguration() : undefined, + }); + resource.applyRemovalPolicy(props.removalPolicy, { default: RemovalPolicy.DESTROY }); + + resource.node.addDependency(this.role); + + for (const statement of graph.policyStatements) { + this.addToRolePolicy(statement); + } + + this.stateMachineName = this.getResourceNameAttribute(resource.attrName); + this.stateMachineArn = this.getResourceArnAttribute(resource.ref, { + service: 'states', + resource: 'stateMachine', + resourceName: this.physicalName, + arnFormat: ArnFormat.COLON_RESOURCE_NAME, + }); + } + + /** + * The principal this state machine is running as + */ + public get grantPrincipal() { + return this.role.grantPrincipal; + } + + /** + * Add the given statement to the role's policy + */ + public addToRolePolicy(statement: iam.PolicyStatement) { + this.role.addToPrincipalPolicy(statement); + } + + private validateStateMachineName(stateMachineName: string) { + if (!Token.isUnresolved(stateMachineName)) { + if (stateMachineName.length < 1 || stateMachineName.length > 80) { + throw new Error(`State Machine name must be between 1 and 80 characters. Received: ${stateMachineName}`); + } + + if (!stateMachineName.match(/^[a-z0-9\+\!\@\.\(\)\-\=\_\']+$/i)) { + throw new Error(`State Machine name must match "^[a-z0-9+!@.()-=_']+$/i". Received: ${stateMachineName}`); + } + } + } + + private buildLoggingConfiguration(logOptions: LogOptions): CfnStateMachine.LoggingConfigurationProperty { + // https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html#cloudwatch-iam-policy + this.addToRolePolicy(new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + actions: [ + 'logs:CreateLogDelivery', + 'logs:GetLogDelivery', + 'logs:UpdateLogDelivery', + 'logs:DeleteLogDelivery', + 'logs:ListLogDeliveries', + 'logs:PutResourcePolicy', + 'logs:DescribeResourcePolicies', + 'logs:DescribeLogGroups', + ], + resources: ['*'], + })); + + return { + destinations: [{ + cloudWatchLogsLogGroup: { logGroupArn: logOptions.destination.logGroupArn }, + }], + includeExecutionData: logOptions.includeExecutionData, + level: logOptions.level || 'ERROR', + }; + } + + private buildTracingConfiguration(): CfnStateMachine.TracingConfigurationProperty { + this.addToRolePolicy(new iam.PolicyStatement({ + // https://docs.aws.amazon.com/xray/latest/devguide/security_iam_id-based-policy-examples.html#xray-permissions-resources + // https://docs.aws.amazon.com/step-functions/latest/dg/xray-iam.html + actions: [ + 'xray:PutTraceSegments', + 'xray:PutTelemetryRecords', + 'xray:GetSamplingRules', + 'xray:GetSamplingTargets', + ], + resources: ['*'], + })); + + return { + enabled: true, + }; + } +} + +/** + * A State Machine + */ +export interface IStateMachine extends IResource, iam.IGrantable { + /** + * The ARN of the state machine + * @attribute + */ + readonly stateMachineArn: string; + + /** + * Grant the given identity permissions to start an execution of this state + * machine. + * + * @param identity The principal + */ + grantStartExecution(identity: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity permissions to start a synchronous execution of + * this state machine. + * + * @param identity The principal + */ + grantStartSyncExecution(identity: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity read permissions for this state machine + * + * @param identity The principal + */ + grantRead(identity: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity read permissions for this state machine + * + * @param identity The principal + */ + grantTaskResponse(identity: iam.IGrantable): iam.Grant; + + /** + * Grant the given identity permissions for all executions of a state machine + * + * @param identity The principal + * @param actions The list of desired actions + */ + grantExecution(identity: iam.IGrantable, ...actions: string[]): iam.Grant; + + /** + * Grant the given identity custom permissions + * + * @param identity The principal + * @param actions The list of desired actions + */ + grant(identity: iam.IGrantable, ...actions: string[]): iam.Grant; + + /** + * Return the given named metric for this State Machine's executions + * + * @default - sum over 5 minutes + */ + metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the number of executions that failed + * + * @default - sum over 5 minutes + */ + metricFailed(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the number of executions that were throttled + * + * @default sum over 5 minutes + */ + metricThrottled(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the number of executions that were aborted + * + * @default - sum over 5 minutes + */ + metricAborted(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the number of executions that succeeded + * + * @default - sum over 5 minutes + */ + metricSucceeded(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the number of executions that timed out + * + * @default - sum over 5 minutes + */ + metricTimedOut(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the number of executions that were started + * + * @default - sum over 5 minutes + */ + metricStarted(props?: cloudwatch.MetricOptions): cloudwatch.Metric; + + /** + * Metric for the interval, in milliseconds, between the time the execution starts and the time it closes + * + * @default - sum over 5 minutes + */ + metricTime(props?: cloudwatch.MetricOptions): cloudwatch.Metric; +} diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/state-transition-metrics.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-transition-metrics.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions/lib/state-transition-metrics.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/state-transition-metrics.ts index c3a9a12e2c111..b32865b27574b 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/state-transition-metrics.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/state-transition-metrics.ts @@ -1,4 +1,4 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; +import * as cloudwatch from '../../aws-cloudwatch'; /** * Metrics on the rate limiting performed on state machine execution. diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/choice.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/choice.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/choice.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/custom-state.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/custom-state.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/custom-state.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/fail.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/fail.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/map.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/map.ts index 28578245db868..017195d51ee93 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/map.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/map.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../../core'; import { Construct } from 'constructs'; import { StateType } from './private/state-type'; import { renderJsonPath, State } from './state'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/parallel.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/parallel.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/parallel.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/pass.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/pass.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/private/state-type.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/private/state-type.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/private/state-type.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/private/state-type.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/state.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/state.ts index 901743caec625..99240e45ba3d7 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/state.ts @@ -1,4 +1,4 @@ -import { Token } from '@aws-cdk/core'; +import { Token } from '../../../core'; import { IConstruct, Construct, Node } from 'constructs'; import { Condition } from '../condition'; import { FieldUtils } from '../fields'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/succeed.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/succeed.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/succeed.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/task-base.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/task-base.ts index 1225936ec66a5..b207ad4d3197f 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/task-base.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/task-base.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as iam from '../../../aws-iam'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { renderJsonPath, State } from './state'; import { Chain } from '../chain'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/task.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/task.ts index b13acdb83cca0..41a6f7d62716f 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/task.ts @@ -1,5 +1,5 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as cdk from '@aws-cdk/core'; +import * as cloudwatch from '../../../aws-cloudwatch'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { StateType } from './private/state-type'; import { renderJsonPath, State } from './state'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/wait.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/states/wait.ts index 2cceceb38b5cb..ec6d2e7731eb0 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/wait.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/states/wait.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { StateType } from './private/state-type'; import { State } from './state'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/step-functions-task.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/step-functions-task.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions/lib/step-functions-task.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/step-functions-task.ts index 21098e107ef86..59e19404e1046 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/step-functions-task.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/step-functions-task.ts @@ -1,6 +1,6 @@ -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; -import { Duration } from '@aws-cdk/core'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; +import { Duration } from '../../core'; import { Task } from './states/task'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/task-credentials.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/task-credentials.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/lib/task-credentials.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/task-credentials.ts index 391589b43882d..9454e16f999a6 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/task-credentials.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/task-credentials.ts @@ -1,4 +1,4 @@ -import * as iam from '@aws-cdk/aws-iam'; +import * as iam from '../../aws-iam'; import { JsonPath } from './fields'; /** diff --git a/packages/aws-cdk-lib/aws-stepfunctions/lib/types.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/types.ts new file mode 100644 index 0000000000000..884b7c1ac30fb --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/lib/types.ts @@ -0,0 +1,160 @@ +import { Duration } from '../../core'; +import { Chain } from './chain'; +import { State } from './states/state'; + +/** + * Interface for states that can have 'next' states + */ +export interface INextable { + /** + * Go to the indicated state after this state + * + * @returns The chain of states built up + */ + next(state: IChainable): Chain; +} + +/** + * Interface for objects that can be used in a Chain + */ +export interface IChainable { + /** + * Descriptive identifier for this chainable + */ + readonly id: string; + + /** + * The start state of this chainable + */ + readonly startState: State; + + /** + * The chainable end state(s) of this chainable + */ + readonly endStates: INextable[]; +} + +/** + * Predefined error strings + * Error names in Amazon States Language - https://states-language.net/spec.html#appendix-a + * Error handling in Step Functions - https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html + */ +export class Errors { + /** + * Matches any Error. + */ + public static readonly ALL = 'States.ALL'; + + /** + * A Task State failed to heartbeat for a time longer than the “HeartbeatSeconds” value. + */ + public static readonly HEARTBEAT_TIMEOUT = 'States.HeartbeatTimeout'; + + /** + * A Task State either ran longer than the “TimeoutSeconds” value, or + * failed to heartbeat for a time longer than the “HeartbeatSeconds” value. + */ + public static readonly TIMEOUT = 'States.Timeout'; + + /** + * A Task State failed during the execution. + */ + public static readonly TASKS_FAILED = 'States.TaskFailed'; + + /** + * A Task State failed because it had insufficient privileges to execute + * the specified code. + */ + public static readonly PERMISSIONS = 'States.Permissions'; + + /** + * A Task State’s “ResultPath” field cannot be applied to the input the state received. + */ + public static readonly RESULT_PATH_MATCH_FAILURE = 'States.ResultPathMatchFailure'; + + /** + * Within a state’s “Parameters” field, the attempt to replace a field whose + * name ends in “.$” using a Path failed. + */ + public static readonly PARAMETER_PATH_FAILURE = 'States.ParameterPathFailure'; + + /** + * A branch of a Parallel state failed. + */ + public static readonly BRANCH_FAILED = 'States.BranchFailed'; + + /** + * A Choice state failed to find a match for the condition field extracted + * from its input. + */ + public static readonly NO_CHOICE_MATCHED = 'States.NoChoiceMatched'; +} + +/** + * Retry details + */ +export interface RetryProps { + /** + * Errors to retry + * + * A list of error strings to retry, which can be either predefined errors + * (for example Errors.NoChoiceMatched) or a self-defined error. + * + * @default All errors + */ + readonly errors?: string[]; + + /** + * How many seconds to wait initially before retrying + * + * @default Duration.seconds(1) + */ + readonly interval?: Duration; + + /** + * How many times to retry this particular error. + * + * May be 0 to disable retry for specific errors (in case you have + * a catch-all retry policy). + * + * @default 3 + */ + readonly maxAttempts?: number; + + /** + * Multiplication for how much longer the wait interval gets on every retry + * + * @default 2 + */ + readonly backoffRate?: number; +} + +/** + * Error handler details + */ +export interface CatchProps { + /** + * Errors to recover from by going to the given state + * + * A list of error strings to retry, which can be either predefined errors + * (for example Errors.NoChoiceMatched) or a self-defined error. + * + * @default All errors + */ + readonly errors?: string[]; + + /** + * JSONPath expression to indicate where to inject the error data + * + * May also be the special value DISCARD, which will cause the error + * data to be discarded. + * + * @default $ + */ + readonly resultPath?: string; +} + +/** + * Special string value to discard state input, output or result + */ +export const DISCARD = 'DISCARD'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/util.ts b/packages/aws-cdk-lib/aws-stepfunctions/lib/util.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/lib/util.ts rename to packages/aws-cdk-lib/aws-stepfunctions/lib/util.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/test/activity.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/activity.test.ts similarity index 92% rename from packages/@aws-cdk/aws-stepfunctions/test/activity.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/activity.test.ts index ec89fbfe3a964..e1b0012c67890 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/activity.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/activity.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as stepfunctions from '../lib'; describe('Activity', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/test/condition.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/condition.test.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/condition.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/condition.test.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/test/custom-state.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/custom-state.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions/test/custom-state.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/custom-state.test.ts index 62a2a9e34f003..90823e9f6ec01 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/custom-state.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/custom-state.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { render } from './private/render-util'; import * as sfn from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/fail.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/fail.test.ts similarity index 83% rename from packages/@aws-cdk/aws-stepfunctions/test/fail.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/fail.test.ts index 98c3295d0a68a..dcb38e3c4976c 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/fail.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/fail.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as stepfunctions from '../lib'; describe('Fail State', () => { diff --git a/packages/aws-cdk-lib/aws-stepfunctions/test/fake-task.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/fake-task.ts new file mode 100644 index 0000000000000..841307d62bcf1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/fake-task.ts @@ -0,0 +1,37 @@ +import * as iam from '../../aws-iam'; +import * as constructs from 'constructs'; +import * as sfn from '../lib'; + +export interface FakeTaskProps extends sfn.TaskStateBaseProps { + parameters?: { [key: string]: string }; +} + +/** + * Task extending sfn.TaskStateBase to facilitate integ testing setting credentials + */ +export class FakeTask extends sfn.TaskStateBase { + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + protected readonly parameters?: { [key: string]: string }; + + constructor(scope: constructs.Construct, id: string, props: FakeTaskProps = {}) { + super(scope, id, props); + this.parameters = props.parameters; + } + + protected _renderTask(): any { + return { + Type: 'Task', + Resource: 'arn:aws:states:::dynamodb:putItem', + Parameters: { + TableName: 'my-cool-table', + Item: { + id: { + S: 'my-entry', + }, + }, + ...this.parameters, + }, + }; + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions/test/fields.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/fields.test.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/fields.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/fields.test.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/test/map.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/map.test.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/test/map.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/map.test.ts index 4e9a72bbc1693..9ea5dd0ee4f64 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/map.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/map.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as stepfunctions from '../lib'; describe('Map State', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/test/parallel.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/parallel.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions/test/parallel.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/parallel.test.ts index 9ca3bd8876781..5744cb50ac595 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/parallel.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/parallel.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as stepfunctions from '../lib'; describe('Parallel State', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/test/pass.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/pass.test.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/pass.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/pass.test.ts diff --git a/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts new file mode 100644 index 0000000000000..1faf6cdaf6a4d --- /dev/null +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/private/fake-task.ts @@ -0,0 +1,29 @@ +import * as iam from '../../../aws-iam'; +import * as constructs from 'constructs'; +import * as sfn from '../../lib'; + +export interface FakeTaskProps extends sfn.TaskStateBaseProps { + readonly metrics?: sfn.TaskMetricsConfig; +} + +export class FakeTask extends sfn.TaskStateBase { + protected readonly taskMetrics?: sfn.TaskMetricsConfig; + protected readonly taskPolicies?: iam.PolicyStatement[]; + + constructor(scope: constructs.Construct, id: string, props: FakeTaskProps = {}) { + super(scope, id, props); + this.taskMetrics = props.metrics; + } + + /** + * @internal + */ + protected _renderTask(): any { + return { + Resource: 'my-resource', + Parameters: sfn.FieldUtils.renderObject({ + MyParameter: 'myParameter', + }), + }; + } +} diff --git a/packages/@aws-cdk/aws-stepfunctions/test/private/intrinsics.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/private/intrinsics.test.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/private/intrinsics.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/private/intrinsics.test.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/test/private/json-path.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/private/json-path.test.ts similarity index 100% rename from packages/@aws-cdk/aws-stepfunctions/test/private/json-path.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/private/json-path.test.ts diff --git a/packages/@aws-cdk/aws-stepfunctions/test/private/render-util.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/private/render-util.ts similarity index 92% rename from packages/@aws-cdk/aws-stepfunctions/test/private/render-util.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/private/render-util.ts index ee1095bfd5e66..254025edc1325 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/private/render-util.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/private/render-util.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as sfn from '../../lib'; /** diff --git a/packages/@aws-cdk/aws-stepfunctions/test/state-machine-fragment.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine-fragment.test.ts similarity index 95% rename from packages/@aws-cdk/aws-stepfunctions/test/state-machine-fragment.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/state-machine-fragment.test.ts index 1264e41d62952..45d12b4a39b4a 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/state-machine-fragment.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine-fragment.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import { Match, Template } from '../../assertions'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import * as stepfunctions from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/state-machine-resources.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine-resources.test.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/test/state-machine-resources.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/state-machine-resources.test.ts index e80201f5d4adf..e4127b032ab3c 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/state-machine-resources.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine-resources.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; +import { Match, Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import * as stepfunctions from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/state-machine.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/test/state-machine.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts index 36d744ab8d52a..afdb8b19e4fb3 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/state-machine.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/state-machine.test.ts @@ -1,8 +1,8 @@ -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as cdk from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as logs from '../../aws-logs'; +import * as s3 from '../../aws-s3'; +import * as cdk from '../../core'; import { FakeTask } from './private/fake-task'; import * as sfn from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/state-transition-metrics.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/state-transition-metrics.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions/test/state-transition-metrics.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/state-transition-metrics.test.ts index fa8b54bc6df9f..9f64c2f145eba 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/state-transition-metrics.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/state-transition-metrics.test.ts @@ -1,4 +1,4 @@ -import { Metric } from '@aws-cdk/aws-cloudwatch'; +import { Metric } from '../../aws-cloudwatch'; import { StateTransitionMetric } from '../lib'; describe('State Transition Metrics', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/test/state.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/state.test.ts similarity index 91% rename from packages/@aws-cdk/aws-stepfunctions/test/state.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/state.test.ts index d878935dd5056..c42801e77b484 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/state.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/state.test.ts @@ -1,5 +1,5 @@ -import * as assert from '@aws-cdk/assertions'; -import * as cdk from '@aws-cdk/core'; +import * as assert from '../../assertions'; +import * as cdk from '../../core'; import { FakeTask } from './fake-task'; import { JsonPath, StateMachine } from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/states-language.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/states-language.test.ts similarity index 99% rename from packages/@aws-cdk/aws-stepfunctions/test/states-language.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/states-language.test.ts index c4fb88f67b6af..f69c07a98aa72 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/states-language.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/states-language.test.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import { Construct } from 'constructs'; import * as stepfunctions from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/task-base.test.ts similarity index 98% rename from packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/task-base.test.ts index c9971dbb485ea..7b7bc31f087e6 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/task-base.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/task-base.test.ts @@ -1,7 +1,7 @@ -import { Metric } from '@aws-cdk/aws-cloudwatch'; -import * as iam from '@aws-cdk/aws-iam'; +import { Metric } from '../../aws-cloudwatch'; +import * as iam from '../../aws-iam'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { FakeTask } from './private/fake-task'; import { renderGraph } from './private/render-util'; import * as sfn from '../lib'; diff --git a/packages/@aws-cdk/aws-stepfunctions/test/task-credentials.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/task-credentials.test.ts similarity index 92% rename from packages/@aws-cdk/aws-stepfunctions/test/task-credentials.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/task-credentials.test.ts index bffa9eb177454..ad10b1ea12224 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/task-credentials.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/task-credentials.test.ts @@ -1,5 +1,5 @@ -import * as iam from '@aws-cdk/aws-iam'; -import * as cdk from '@aws-cdk/core'; +import * as iam from '../../aws-iam'; +import * as cdk from '../../core'; import * as sfn from '../lib'; describe('TaskRole', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/test/task.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/task.test.ts similarity index 96% rename from packages/@aws-cdk/aws-stepfunctions/test/task.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/task.test.ts index ba4c2a79e660e..462c1bae7670a 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/task.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/task.test.ts @@ -1,6 +1,6 @@ -import { Metric } from '@aws-cdk/aws-cloudwatch'; +import { Metric } from '../../aws-cloudwatch'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import * as sfn from '../lib'; describeDeprecated('Task state', () => { diff --git a/packages/@aws-cdk/aws-stepfunctions/test/wait.test.ts b/packages/aws-cdk-lib/aws-stepfunctions/test/wait.test.ts similarity index 97% rename from packages/@aws-cdk/aws-stepfunctions/test/wait.test.ts rename to packages/aws-cdk-lib/aws-stepfunctions/test/wait.test.ts index 3d41693ac9c2e..7f0eda233013e 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/wait.test.ts +++ b/packages/aws-cdk-lib/aws-stepfunctions/test/wait.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../core'; import { render } from './private/render-util'; import { Pass, Wait, WaitTime } from '../lib'; diff --git a/packages/aws-cdk-lib/aws-supportapp/.jsiirc.json b/packages/aws-cdk-lib/aws-supportapp/.jsiirc.json new file mode 100644 index 0000000000000..1c2e92de44e11 --- /dev/null +++ b/packages/aws-cdk-lib/aws-supportapp/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SupportApp" + }, + "java": { + "package": "software.amazon.awscdk.services.supportapp" + }, + "python": { + "module": "aws_cdk.aws_supportapp" + } + } +} diff --git a/packages/aws-cdk-lib/aws-supportapp/README.md b/packages/aws-cdk-lib/aws-supportapp/README.md new file mode 100644 index 0000000000000..8cb59869f8abc --- /dev/null +++ b/packages/aws-cdk-lib/aws-supportapp/README.md @@ -0,0 +1,27 @@ +# AWS::SupportApp Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as supportapp from 'aws-cdk-lib/aws-supportapp'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SupportApp construct libraries](https://constructs.dev/search?q=supportapp) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SupportApp resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SupportApp.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SupportApp](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SupportApp.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-supportapp/index.ts b/packages/aws-cdk-lib/aws-supportapp/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-supportapp/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-supportapp/lib/index.ts b/packages/aws-cdk-lib/aws-supportapp/lib/index.ts new file mode 100644 index 0000000000000..1e3870a673c9b --- /dev/null +++ b/packages/aws-cdk-lib/aws-supportapp/lib/index.ts @@ -0,0 +1 @@ +export * from './supportapp.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-synthetics/.jsiirc.json b/packages/aws-cdk-lib/aws-synthetics/.jsiirc.json new file mode 100644 index 0000000000000..f5ed0d2df11ce --- /dev/null +++ b/packages/aws-cdk-lib/aws-synthetics/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Synthetics" + }, + "java": { + "package": "software.amazon.awscdk.services.synthetics" + }, + "python": { + "module": "aws_cdk.aws_synthetics" + } + } +} diff --git a/packages/aws-cdk-lib/aws-synthetics/README.md b/packages/aws-cdk-lib/aws-synthetics/README.md new file mode 100644 index 0000000000000..b8914384a868c --- /dev/null +++ b/packages/aws-cdk-lib/aws-synthetics/README.md @@ -0,0 +1,32 @@ +# AWS::Synthetics Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as synthetics from 'aws-cdk-lib/aws-synthetics'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Synthetics construct libraries](https://constructs.dev/search?q=synthetics) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Synthetics resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Synthetics.html) directly. + + +> An experimental construct library for this service is available in preview. Since it is not stable yet, it is distributed +> as a separate package so that you can pin its version independently of the rest of the CDK. See the package: +> +> @aws-cdk/aws-synthetics-alpha + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Synthetics](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Synthetics.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-synthetics/index.ts b/packages/aws-cdk-lib/aws-synthetics/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-synthetics/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-synthetics/lib/index.ts b/packages/aws-cdk-lib/aws-synthetics/lib/index.ts new file mode 100644 index 0000000000000..211c1ad4b58f9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-synthetics/lib/index.ts @@ -0,0 +1 @@ +export * from './synthetics.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-synthetics/test/canaries/python/canary.py b/packages/aws-cdk-lib/aws-synthetics/test/canaries/python/canary.py new file mode 100644 index 0000000000000..2dbed4e312afe --- /dev/null +++ b/packages/aws-cdk-lib/aws-synthetics/test/canaries/python/canary.py @@ -0,0 +1,61 @@ +# This example comes from the AWS Synthetics service console "API canary" blueprint + +import json +import http.client +import urllib.parse +from aws_synthetics.selenium import synthetics_webdriver as syn_webdriver +from aws_synthetics.common import synthetics_logger as logger + + +def verify_request(method, url, post_data=None, headers={}): + parsed_url = urllib.parse.urlparse(url) + user_agent = str(syn_webdriver.get_canary_user_agent_string()) + if "User-Agent" in headers: + headers["User-Agent"] = " ".join([user_agent, headers["User-Agent"]]) + else: + headers["User-Agent"] = "{}".format(user_agent) + + logger.info("Making request with Method: '%s' URL: %s: Data: %s Headers: %s" % ( + method, url, json.dumps(post_data), json.dumps(headers))) + + if parsed_url.scheme == "https": + conn = http.client.HTTPSConnection(parsed_url.hostname, parsed_url.port) + else: + conn = http.client.HTTPConnection(parsed_url.hostname, parsed_url.port) + + conn.request(method, url, str(post_data), headers) + response = conn.getresponse() + logger.info("Status Code: %s " % response.status) + logger.info("Response Headers: %s" % json.dumps(response.headers.as_string())) + + if not response.status or response.status < 200 or response.status > 299: + try: + logger.error("Response: %s" % response.read().decode()) + finally: + if response.reason: + conn.close() + raise Exception("Failed: %s" % response.reason) + else: + conn.close() + raise Exception("Failed with status code: %s" % response.status) + + logger.info("Response: %s" % response.read().decode()) + logger.info("HTTP request successfully executed") + conn.close() + + +def main(): + + url = 'https://example.com/' + method = 'GET' + postData = "" + headers = {} + + verify_request(method, url, None, headers) + + logger.info("Canary successfully executed") + + +def handler(event, context): + logger.info("Selenium Python API canary") + main() \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-systemsmanagersap/.jsiirc.json b/packages/aws-cdk-lib/aws-systemsmanagersap/.jsiirc.json new file mode 100644 index 0000000000000..f7c7ae498b5e7 --- /dev/null +++ b/packages/aws-cdk-lib/aws-systemsmanagersap/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.SystemsManagerSAP" + }, + "java": { + "package": "software.amazon.awscdk.services.systemsmanagersap" + }, + "python": { + "module": "aws_cdk.aws_systemsmanagersap" + } + } +} diff --git a/packages/aws-cdk-lib/aws-systemsmanagersap/README.md b/packages/aws-cdk-lib/aws-systemsmanagersap/README.md new file mode 100644 index 0000000000000..9b26b22f3f7b6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-systemsmanagersap/README.md @@ -0,0 +1,27 @@ +# AWS::SystemsManagerSAP Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as systemsmanagersap from 'aws-cdk-lib/aws-systemsmanagersap'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for SystemsManagerSAP construct libraries](https://constructs.dev/search?q=systemsmanagersap) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::SystemsManagerSAP resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SystemsManagerSAP.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::SystemsManagerSAP](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_SystemsManagerSAP.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-systemsmanagersap/index.ts b/packages/aws-cdk-lib/aws-systemsmanagersap/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-systemsmanagersap/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-systemsmanagersap/lib/index.ts b/packages/aws-cdk-lib/aws-systemsmanagersap/lib/index.ts new file mode 100644 index 0000000000000..99bcb3fe91c62 --- /dev/null +++ b/packages/aws-cdk-lib/aws-systemsmanagersap/lib/index.ts @@ -0,0 +1 @@ +export * from './systemsmanagersap.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-timestream/.jsiirc.json b/packages/aws-cdk-lib/aws-timestream/.jsiirc.json new file mode 100644 index 0000000000000..c3af7810ea73c --- /dev/null +++ b/packages/aws-cdk-lib/aws-timestream/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Timestream" + }, + "java": { + "package": "software.amazon.awscdk.services.timestream" + }, + "python": { + "module": "aws_cdk.aws_timestream" + } + } +} diff --git a/packages/aws-cdk-lib/aws-timestream/README.md b/packages/aws-cdk-lib/aws-timestream/README.md new file mode 100644 index 0000000000000..a24bbc86e27df --- /dev/null +++ b/packages/aws-cdk-lib/aws-timestream/README.md @@ -0,0 +1,27 @@ +# AWS::Timestream Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as timestream from 'aws-cdk-lib/aws-timestream'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Timestream construct libraries](https://constructs.dev/search?q=timestream) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Timestream resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Timestream.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Timestream](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Timestream.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-timestream/index.ts b/packages/aws-cdk-lib/aws-timestream/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-timestream/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-timestream/lib/index.ts b/packages/aws-cdk-lib/aws-timestream/lib/index.ts new file mode 100644 index 0000000000000..f7e68081273de --- /dev/null +++ b/packages/aws-cdk-lib/aws-timestream/lib/index.ts @@ -0,0 +1 @@ +export * from './timestream.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-transfer/.jsiirc.json b/packages/aws-cdk-lib/aws-transfer/.jsiirc.json new file mode 100644 index 0000000000000..1b35ebd5cb02d --- /dev/null +++ b/packages/aws-cdk-lib/aws-transfer/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Transfer" + }, + "java": { + "package": "software.amazon.awscdk.services.transfer" + }, + "python": { + "module": "aws_cdk.aws_transfer" + } + } +} diff --git a/packages/aws-cdk-lib/aws-transfer/README.md b/packages/aws-cdk-lib/aws-transfer/README.md new file mode 100644 index 0000000000000..5d31c3485a4c1 --- /dev/null +++ b/packages/aws-cdk-lib/aws-transfer/README.md @@ -0,0 +1,27 @@ +# AWS Transfer for SFTP Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as transfer from 'aws-cdk-lib/aws-transfer'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Transfer construct libraries](https://constructs.dev/search?q=transfer) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Transfer resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Transfer.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Transfer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Transfer.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-transfer/index.ts b/packages/aws-cdk-lib/aws-transfer/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-transfer/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-transfer/lib/index.ts b/packages/aws-cdk-lib/aws-transfer/lib/index.ts new file mode 100644 index 0000000000000..1ef2e61fb32d6 --- /dev/null +++ b/packages/aws-cdk-lib/aws-transfer/lib/index.ts @@ -0,0 +1 @@ +export * from './transfer.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-voiceid/.jsiirc.json b/packages/aws-cdk-lib/aws-voiceid/.jsiirc.json new file mode 100644 index 0000000000000..780d10ea71b4b --- /dev/null +++ b/packages/aws-cdk-lib/aws-voiceid/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.VoiceID" + }, + "java": { + "package": "software.amazon.awscdk.services.voiceid" + }, + "python": { + "module": "aws_cdk.aws_voiceid" + } + } +} diff --git a/packages/aws-cdk-lib/aws-voiceid/README.md b/packages/aws-cdk-lib/aws-voiceid/README.md new file mode 100644 index 0000000000000..60693d90065f5 --- /dev/null +++ b/packages/aws-cdk-lib/aws-voiceid/README.md @@ -0,0 +1,27 @@ +# AWS::VoiceID Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as voiceid from 'aws-cdk-lib/aws-voiceid'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for VoiceID construct libraries](https://constructs.dev/search?q=voiceid) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::VoiceID resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VoiceID.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::VoiceID](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VoiceID.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-voiceid/index.ts b/packages/aws-cdk-lib/aws-voiceid/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-voiceid/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-voiceid/lib/index.ts b/packages/aws-cdk-lib/aws-voiceid/lib/index.ts new file mode 100644 index 0000000000000..72792ba6d66be --- /dev/null +++ b/packages/aws-cdk-lib/aws-voiceid/lib/index.ts @@ -0,0 +1 @@ +export * from './voiceid.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-vpclattice/.jsiirc.json b/packages/aws-cdk-lib/aws-vpclattice/.jsiirc.json new file mode 100644 index 0000000000000..aa1b93363dae9 --- /dev/null +++ b/packages/aws-cdk-lib/aws-vpclattice/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.VpcLattice" + }, + "java": { + "package": "software.amazon.awscdk.services.vpclattice" + }, + "python": { + "module": "aws_cdk.aws_vpclattice" + } + } +} diff --git a/packages/aws-cdk-lib/aws-vpclattice/README.md b/packages/aws-cdk-lib/aws-vpclattice/README.md new file mode 100644 index 0000000000000..21b746085016f --- /dev/null +++ b/packages/aws-cdk-lib/aws-vpclattice/README.md @@ -0,0 +1,27 @@ +# AWS::VpcLattice Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as vpclattice from 'aws-cdk-lib/aws-vpclattice'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for VpcLattice construct libraries](https://constructs.dev/search?q=vpclattice) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::VpcLattice resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VpcLattice.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::VpcLattice](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_VpcLattice.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-vpclattice/index.ts b/packages/aws-cdk-lib/aws-vpclattice/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-vpclattice/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-vpclattice/lib/index.ts b/packages/aws-cdk-lib/aws-vpclattice/lib/index.ts new file mode 100644 index 0000000000000..a85c9e00f09a2 --- /dev/null +++ b/packages/aws-cdk-lib/aws-vpclattice/lib/index.ts @@ -0,0 +1 @@ +export * from './vpclattice.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-waf/.jsiirc.json b/packages/aws-cdk-lib/aws-waf/.jsiirc.json new file mode 100644 index 0000000000000..c430163e9d235 --- /dev/null +++ b/packages/aws-cdk-lib/aws-waf/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.waf" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.WAF" + }, + "python": { + "module": "aws_cdk.aws_waf" + } + } +} diff --git a/packages/aws-cdk-lib/aws-waf/README.md b/packages/aws-cdk-lib/aws-waf/README.md new file mode 100644 index 0000000000000..b84cddd3883f8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-waf/README.md @@ -0,0 +1,27 @@ +# AWS Web Application Firewall Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as waf from 'aws-cdk-lib/aws-waf'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for WAF construct libraries](https://constructs.dev/search?q=waf) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WAF resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAF.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WAF](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAF.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-waf/index.ts b/packages/aws-cdk-lib/aws-waf/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-waf/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-waf/lib/index.ts b/packages/aws-cdk-lib/aws-waf/lib/index.ts new file mode 100644 index 0000000000000..8f3a931d5ee34 --- /dev/null +++ b/packages/aws-cdk-lib/aws-waf/lib/index.ts @@ -0,0 +1 @@ +export * from './waf.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-wafregional/.jsiirc.json b/packages/aws-cdk-lib/aws-wafregional/.jsiirc.json new file mode 100644 index 0000000000000..6b983e507db4e --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafregional/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.waf.regional" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.WAFRegional" + }, + "python": { + "module": "aws_cdk.aws_wafregional" + } + } +} diff --git a/packages/aws-cdk-lib/aws-wafregional/README.md b/packages/aws-cdk-lib/aws-wafregional/README.md new file mode 100644 index 0000000000000..2703bb2e4e7bf --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafregional/README.md @@ -0,0 +1,27 @@ +# AWS WAF Regional Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as wafregional from 'aws-cdk-lib/aws-wafregional'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for WAFRegional construct libraries](https://constructs.dev/search?q=wafregional) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WAFRegional resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFRegional.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WAFRegional](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFRegional.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-wafregional/index.ts b/packages/aws-cdk-lib/aws-wafregional/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafregional/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-wafregional/lib/index.ts b/packages/aws-cdk-lib/aws-wafregional/lib/index.ts new file mode 100644 index 0000000000000..b9fb861d20255 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafregional/lib/index.ts @@ -0,0 +1 @@ +export * from './wafregional.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-wafv2/.jsiirc.json b/packages/aws-cdk-lib/aws-wafv2/.jsiirc.json new file mode 100644 index 0000000000000..35d62630b1f78 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafv2/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.WAFv2" + }, + "java": { + "package": "software.amazon.awscdk.services.wafv2" + }, + "python": { + "module": "aws_cdk.aws_wafv2" + } + } +} diff --git a/packages/aws-cdk-lib/aws-wafv2/README.md b/packages/aws-cdk-lib/aws-wafv2/README.md new file mode 100644 index 0000000000000..6361e71723f42 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafv2/README.md @@ -0,0 +1,27 @@ +# AWS::WAFv2 Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as wafv2 from 'aws-cdk-lib/aws-wafv2'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for WAFv2 construct libraries](https://constructs.dev/search?q=wafv2) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WAFv2 resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFv2.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WAFv2](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WAFv2.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-wafv2/index.ts b/packages/aws-cdk-lib/aws-wafv2/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafv2/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-wafv2/lib/index.ts b/packages/aws-cdk-lib/aws-wafv2/lib/index.ts new file mode 100644 index 0000000000000..9f399e0cb1ef8 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wafv2/lib/index.ts @@ -0,0 +1 @@ +export * from './wafv2.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-wisdom/.jsiirc.json b/packages/aws-cdk-lib/aws-wisdom/.jsiirc.json new file mode 100644 index 0000000000000..fb8b2b74796a3 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wisdom/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.Wisdom" + }, + "java": { + "package": "software.amazon.awscdk.services.wisdom" + }, + "python": { + "module": "aws_cdk.aws_wisdom" + } + } +} diff --git a/packages/aws-cdk-lib/aws-wisdom/README.md b/packages/aws-cdk-lib/aws-wisdom/README.md new file mode 100644 index 0000000000000..3d52e57a50789 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wisdom/README.md @@ -0,0 +1,27 @@ +# AWS::Wisdom Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as wisdom from 'aws-cdk-lib/aws-wisdom'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for Wisdom construct libraries](https://constructs.dev/search?q=wisdom) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::Wisdom resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Wisdom.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::Wisdom](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_Wisdom.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-wisdom/index.ts b/packages/aws-cdk-lib/aws-wisdom/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-wisdom/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-wisdom/lib/index.ts b/packages/aws-cdk-lib/aws-wisdom/lib/index.ts new file mode 100644 index 0000000000000..ef899ad26d550 --- /dev/null +++ b/packages/aws-cdk-lib/aws-wisdom/lib/index.ts @@ -0,0 +1 @@ +export * from './wisdom.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-workspaces/.jsiirc.json b/packages/aws-cdk-lib/aws-workspaces/.jsiirc.json new file mode 100644 index 0000000000000..bdeb4cd0b43bd --- /dev/null +++ b/packages/aws-cdk-lib/aws-workspaces/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.services.workspaces" + }, + "dotnet": { + "namespace": "Amazon.CDK.AWS.WorkSpaces" + }, + "python": { + "module": "aws_cdk.aws_workspaces" + } + } +} diff --git a/packages/aws-cdk-lib/aws-workspaces/README.md b/packages/aws-cdk-lib/aws-workspaces/README.md new file mode 100644 index 0000000000000..3eddbb58cdf37 --- /dev/null +++ b/packages/aws-cdk-lib/aws-workspaces/README.md @@ -0,0 +1,27 @@ +# Amazon WorkSpaces Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as workspaces from 'aws-cdk-lib/aws-workspaces'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for WorkSpaces construct libraries](https://constructs.dev/search?q=workspaces) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::WorkSpaces resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WorkSpaces.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::WorkSpaces](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_WorkSpaces.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-workspaces/index.ts b/packages/aws-cdk-lib/aws-workspaces/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-workspaces/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-workspaces/lib/index.ts b/packages/aws-cdk-lib/aws-workspaces/lib/index.ts new file mode 100644 index 0000000000000..84af29dc60f08 --- /dev/null +++ b/packages/aws-cdk-lib/aws-workspaces/lib/index.ts @@ -0,0 +1 @@ +export * from './workspaces.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-xray/.jsiirc.json b/packages/aws-cdk-lib/aws-xray/.jsiirc.json new file mode 100644 index 0000000000000..47f60fa798fce --- /dev/null +++ b/packages/aws-cdk-lib/aws-xray/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "dotnet": { + "namespace": "Amazon.CDK.AWS.XRay" + }, + "java": { + "package": "software.amazon.awscdk.services.xray" + }, + "python": { + "module": "aws_cdk.aws_xray" + } + } +} diff --git a/packages/aws-cdk-lib/aws-xray/README.md b/packages/aws-cdk-lib/aws-xray/README.md new file mode 100644 index 0000000000000..743b0408c482f --- /dev/null +++ b/packages/aws-cdk-lib/aws-xray/README.md @@ -0,0 +1,27 @@ +# AWS::XRay Construct Library + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +```ts nofixture +import * as xray from 'aws-cdk-lib/aws-xray'; +``` + + + +There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed: + +- Search [Construct Hub for XRay construct libraries](https://constructs.dev/search?q=xray) +- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::XRay resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_XRay.html) directly. + + + + +There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. +However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly. + +For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::XRay](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_XRay.html). + +(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.) + + diff --git a/packages/aws-cdk-lib/aws-xray/index.ts b/packages/aws-cdk-lib/aws-xray/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/aws-xray/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/aws-xray/lib/index.ts b/packages/aws-cdk-lib/aws-xray/lib/index.ts new file mode 100644 index 0000000000000..ad7554dc858eb --- /dev/null +++ b/packages/aws-cdk-lib/aws-xray/lib/index.ts @@ -0,0 +1 @@ +export * from './xray.generated'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/.jsiirc.json b/packages/aws-cdk-lib/cloud-assembly-schema/.jsiirc.json new file mode 100644 index 0000000000000..21db8e13672e1 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.cloudassembly.schema" + }, + "dotnet": { + "namespace": "Amazon.CDK.CloudAssembly.Schema" + }, + "python": { + "module": "aws_cdk.cloud_assembly_schema" + } + } +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/CONTRIBUTING.md b/packages/aws-cdk-lib/cloud-assembly-schema/CONTRIBUTING.md new file mode 100644 index 0000000000000..0a96c52f7ca1a --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/CONTRIBUTING.md @@ -0,0 +1,67 @@ +## Cloud Assembly Schema + +Making changes to this module should only happen when you introduce new cloud assembly capabilities. + +> For example: supporting the `--target` option when building docker containers. + +If you decided these changes are necessary, simply go ahead and make the necessary modifications to +the interfaces that describe the schema. Our tests and validation mechanisms will ensure you make those +changes correctly. + +### Module Structure + +There are two main things to understand about the files in this module: + +- [`lib/manifest.ts`](./lib/manifest.ts) + + This is the typescript code that defines our schema. It is solely comprised of structs (property only interfaces). + It directly maps to the way we want manifest files to be stored on disk. When you want to make changes to the schema, + this is the file you should be editing. + +- [`lib/schema`](./schema/) + + This directory contains the generated json [schema](./schema/cloud-assembly.schema.json) from the aforementioned + typescript code. It also contains a [version](./schema/cloud-assembly.version.json) file that holds the current version + of the schema. These files are **not** intended for manual editing. Keep reading to understand how they change and when. + +### Schema Generation + +The schema can be generated by running `yarn update-schema`. It reads the [`manifest.ts`](./lib/manifest.ts) file and writes +an updated json schema to [`cloud-assembly.schema.json`](./schema/cloud-assembly.schema.json). +In addition, this command also performs a `major` version bump on the [version](./schema/cloud-assembly.version.json) file. + +Note that it is not generated as part of the build, this is to ensure developers will be intentional when making +changes to the schema. If changes to the code are performed, without generating a new schema, the tests will fail: + +```console +$ yarn test +FAIL test/schema.test.js (5.902s) + ✓ manifest save (7ms) + ✕ cloud-assembly.json.schema is correct (5304ms) + ✓ manifest load (4ms) + ✓ manifest load fails for invalid nested property (5ms) + ✓ manifest load fails for invalid artifact type (1ms) + ✓ stack-tags are deserialized properly (1ms) + ✓ can access random metadata (1ms) + + ● cloud-assembly.json.schema is correct + + Whoops, Looks like the schema has changed. Did you forget to run 'yarn update-schema'? +``` + +### Schema Validation + +Being a **stable** `jsii` module, it undergoes strict API compatibility checks with the help +of [`jsii-diff`](https://github.com/aws/jsii/tree/master/packages/jsii-diff). +This means that breaking changes will be rejected. These include: + +- Adding a required property. (same as changing from *optional* to *required*) +- Changing the type of the property. + +In addition, the interfaces defined here are programmatically exposed to users, via the `manifest` +property of the [`CloudAssembly`](../cx-api/lib/cloud-assembly.ts) class. This means that the following are +also considered breaking changes: + +- Changing a property from *required* to *optional*. +- Removing an optional property. +- Removing a required property. diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/README.md b/packages/aws-cdk-lib/cloud-assembly-schema/README.md new file mode 100644 index 0000000000000..a102522dba4fd --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/README.md @@ -0,0 +1,55 @@ +# Cloud Assembly Schema + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## Cloud Assembly + +The *Cloud Assembly* is the output of the synthesis operation. It is produced as part of the +[`cdk synth`](https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk#cdk-synthesize) +command, or the [`app.synth()`](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/core/lib/app.ts#L135) method invocation. + +Its essentially a set of files and directories, one of which is the `manifest.json` file. It defines the set of instructions that are +needed in order to deploy the assembly directory. + +> For example, when `cdk deploy` is executed, the CLI reads this file and performs its instructions: +> +> - Build container images. +> - Upload assets. +> - Deploy CloudFormation templates. + +Therefore, the assembly is how the CDK class library and CDK CLI (or any other consumer) communicate. To ensure compatibility +between the assembly and its consumers, we treat the manifest file as a well defined, versioned schema. + +## Schema + +This module contains the typescript structs that comprise the `manifest.json` file, as well as the +generated [*json-schema*](./schema/cloud-assembly.schema.json). + +## Versioning + +The schema version is specified in the [`cloud-assembly.version.json`](./schema/cloud-assembly.schema.json) file, under the `version` property. +It follows semantic versioning, but with a small twist. + +When we add instructions to the assembly, they are reflected in the manifest file and the *json-schema* accordingly. +Every such instruction, is crucial for ensuring the correct deployment behavior. This means that to properly deploy a cloud assembly, +consumers must be aware of every such instruction modification. + +For this reason, every change to the schema, even though it might not strictly break validation of the *json-schema* format, +is considered `major` version bump. + +## How to consume + +If you'd like to consume the [schema file](./schema/cloud-assembly.schema.json) in order to do validations on `manifest.json` files, +simply download it from this repo and run it against standard *json-schema* validators, such as [jsonschema](https://www.npmjs.com/package/jsonschema). + +Consumers must take into account the `major` version of the schema they are consuming. They should reject cloud assemblies +with a `major` version that is higher than what they expect. While schema validation might pass on such assemblies, the deployment integrity +cannot be guaranteed because some instructions will be ignored. + +> For example, if your consumer was built when the schema version was 2.0.0, you should reject deploying cloud assemblies with a +> manifest version of 3.0.0. + +## Contributing + +See [Contribution Guide](./CONTRIBUTING.md) diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/index.ts b/packages/aws-cdk-lib/cloud-assembly-schema/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/aws-destination.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/aws-destination.ts new file mode 100644 index 0000000000000..f419fde03c56d --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/aws-destination.ts @@ -0,0 +1,25 @@ +/** + * Destination for assets that need to be uploaded to AWS + */ +export interface AwsDestination { + /** + * The region where this asset will need to be published + * + * @default - Current region + */ + readonly region?: string; + + /** + * The role that needs to be assumed while publishing this asset + * + * @default - No role will be assumed + */ + readonly assumeRoleArn?: string; + + /** + * The ExternalId that needs to be supplied while assuming this role + * + * @default - No ExternalId will be supplied + */ + readonly assumeRoleExternalId?: string; +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/docker-image-asset.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/docker-image-asset.ts new file mode 100644 index 0000000000000..6224af4fb6c77 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/docker-image-asset.ts @@ -0,0 +1,153 @@ +import { AwsDestination } from './aws-destination'; + +/** + * A file asset + */ +export interface DockerImageAsset { + /** + * Source description for file assets + */ + readonly source: DockerImageSource; + + /** + * Destinations for this file asset + */ + readonly destinations: { [id: string]: DockerImageDestination }; +} + +/** + * Properties for how to produce a Docker image from a source + */ +export interface DockerImageSource { + /** + * The directory containing the Docker image build instructions. + * + * This path is relative to the asset manifest location. + * + * @default - Exactly one of `directory` and `executable` is required + */ + readonly directory?: string; + + /** + * A command-line executable that returns the name of a local + * Docker image on stdout after being run. + * + * @default - Exactly one of `directory` and `executable` is required + */ + readonly executable?: string[]; + + /** + * The name of the file with build instructions + * + * Only allowed when `directory` is set. + * + * @default "Dockerfile" + */ + readonly dockerFile?: string; + + /** + * Target build stage in a Dockerfile with multiple build stages + * + * Only allowed when `directory` is set. + * + * @default - The last stage in the Dockerfile + */ + readonly dockerBuildTarget?: string; + + /** + * Additional build arguments + * + * Only allowed when `directory` is set. + * + * @default - No additional build arguments + */ + readonly dockerBuildArgs?: { [name: string]: string }; + + /** + * Additional build secrets + * + * Only allowed when `directory` is set. + * + * @default - No additional build secrets + */ + readonly dockerBuildSecrets?: { [name: string]: string }; + + /** + * Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_. + * + * Specify this property to build images on a specific networking mode. + * + * @default - no networking mode specified + */ + readonly networkMode?: string; + + /** + * Platform to build for. _Requires Docker Buildx_. + * + * Specify this property to build images on a specific platform/architecture. + * + * @default - current machine platform + */ + readonly platform?: string; + + /** + * Outputs + * + * @default - no outputs are passed to the build command (default outputs are used) + * @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs + */ + readonly dockerOutputs?: string[]; + + /** + * Cache from options to pass to the `docker build` command. + * + * @default - no cache from options are passed to the build command + * @see https://docs.docker.com/build/cache/backends/ + */ + readonly cacheFrom?: DockerCacheOption[]; + + /** + * Cache to options to pass to the `docker build` command. + * + * @default - no cache to options are passed to the build command + * @see https://docs.docker.com/build/cache/backends/ + */ + readonly cacheTo?: DockerCacheOption; +} + +/** + * Where to publish docker images + */ +export interface DockerImageDestination extends AwsDestination { + /** + * Name of the ECR repository to publish to + */ + readonly repositoryName: string; + + /** + * Tag of the image to publish + */ + readonly imageTag: string; +} + +/** + * Options for configuring the Docker cache backend + */ +export interface DockerCacheOption { + /** + * The type of cache to use. + * Refer to https://docs.docker.com/build/cache/backends/ for full list of backends. + * @default - unspecified + * + * @example 'registry' + */ + readonly type: string; + /** + * Any parameters to pass into the docker cache backend configuration. + * Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration. + * @default {} No options provided + * + * @example { ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`, mode: "max" } + */ + readonly params?: { [key: string]: string }; +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/file-asset.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/file-asset.ts new file mode 100644 index 0000000000000..58c7e0cc93ebc --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/file-asset.ts @@ -0,0 +1,76 @@ +import { AwsDestination } from './aws-destination'; + +/** + * A file asset + */ +export interface FileAsset { + /** + * Source description for file assets + */ + readonly source: FileSource; + + /** + * Destinations for this file asset + */ + readonly destinations: { [id: string]: FileDestination }; +} + +/** + * Packaging strategy for file assets + */ +export enum FileAssetPackaging { + /** + * Upload the given path as a file + */ + FILE = 'file', + + /** + * The given path is a directory, zip it and upload + */ + ZIP_DIRECTORY = 'zip', +} + +/** + * Describe the source of a file asset + */ +export interface FileSource { + /** + * External command which will produce the file asset to upload. + * + * @default - Exactly one of `executable` and `path` is required. + */ + readonly executable?: string[]; + + /** + * The filesystem object to upload + * + * This path is relative to the asset manifest location. + * + * @default - Exactly one of `executable` and `path` is required. + */ + readonly path?: string; + + /** + * Packaging method + * + * Only allowed when `path` is specified. + * + * @default FILE + */ + readonly packaging?: FileAssetPackaging; +} + +/** + * Where in S3 a file asset needs to be published + */ +export interface FileDestination extends AwsDestination { + /** + * The name of the bucket + */ + readonly bucketName: string; + + /** + * The destination object key + */ + readonly objectKey: string; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/index.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/index.ts new file mode 100644 index 0000000000000..49c126e3f2d9b --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/index.ts @@ -0,0 +1,4 @@ +export * from './schema'; +export * from './docker-image-asset'; +export * from './file-asset'; +export * from './aws-destination'; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/schema.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/schema.ts new file mode 100644 index 0000000000000..7f5b33da127cd --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/assets/schema.ts @@ -0,0 +1,26 @@ +import { DockerImageAsset } from './docker-image-asset'; +import { FileAsset } from './file-asset'; + +/** + * Definitions for the asset manifest + */ +export interface AssetManifest { + /** + * Version of the manifest + */ + readonly version: string; + + /** + * The file assets in this manifest + * + * @default - No files + */ + readonly files?: { [id: string]: FileAsset }; + + /** + * The Docker image assets in this manifest + * + * @default - No Docker images + */ + readonly dockerImages?: { [id: string]: DockerImageAsset }; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts new file mode 100644 index 0000000000000..66872401251aa --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/artifact-schema.ts @@ -0,0 +1,204 @@ + +/** + * Information needed to access an IAM role created + * as part of the bootstrap process + */ +export interface BootstrapRole { + /** + * The ARN of the IAM role created as part of bootrapping + * e.g. lookupRoleArn + */ + readonly arn: string; + + /** + * External ID to use when assuming the bootstrap role + * + * @default - No external ID + */ + readonly assumeRoleExternalId?: string; + + /** + * Version of bootstrap stack required to use this role + * + * @default - No bootstrap stack required + */ + readonly requiresBootstrapStackVersion?: number; + + /** + * Name of SSM parameter with bootstrap stack version + * + * @default - Discover SSM parameter by reading stack + */ + readonly bootstrapStackVersionSsmParameter?: string; +} + +/** + * Artifact properties for CloudFormation stacks. + */ +export interface AwsCloudFormationStackProperties { + /** + * A file relative to the assembly root which contains the CloudFormation template for this stack. + */ + readonly templateFile: string; + + /** + * Values for CloudFormation stack parameters that should be passed when the stack is deployed. + * + * @default - No parameters + */ + readonly parameters?: { [id: string]: string }; + + /** + * Values for CloudFormation stack tags that should be passed when the stack is deployed. + * + * @default - No tags + */ + readonly tags?: { [id: string]: string }; + + /** + * The name to use for the CloudFormation stack. + * @default - name derived from artifact ID + */ + readonly stackName?: string; + + /** + * Whether to enable termination protection for this stack. + * + * @default false + */ + readonly terminationProtection?: boolean; + + /** + * The role that needs to be assumed to deploy the stack + * + * @default - No role is assumed (current credentials are used) + */ + readonly assumeRoleArn?: string; + + /** + * External ID to use when assuming role for cloudformation deployments + * + * @default - No external ID + */ + readonly assumeRoleExternalId?: string; + + /** + * The role that is passed to CloudFormation to execute the change set + * + * @default - No role is passed (currently assumed role/credentials are used) + */ + readonly cloudFormationExecutionRoleArn?: string; + + /** + * The role to use to look up values from the target AWS account + * + * @default - No role is assumed (current credentials are used) + */ + readonly lookupRole?: BootstrapRole; + + /** + * If the stack template has already been included in the asset manifest, its asset URL + * + * @default - Not uploaded yet, upload just before deploying + */ + readonly stackTemplateAssetObjectUrl?: string; + + /** + * Version of bootstrap stack required to deploy this stack + * + * @default - No bootstrap stack required + */ + readonly requiresBootstrapStackVersion?: number; + + /** + * SSM parameter where the bootstrap stack version number can be found + * + * Only used if `requiresBootstrapStackVersion` is set. + * + * - If this value is not set, the bootstrap stack name must be known at + * deployment time so the stack version can be looked up from the stack + * outputs. + * - If this value is set, the bootstrap stack can have any name because + * we won't need to look it up. + * + * @default - Bootstrap stack version number looked up + */ + readonly bootstrapStackVersionSsmParameter?: string; + + /** + * Whether this stack should be validated by the CLI after synthesis + * + * @default - false + */ + readonly validateOnSynth?: boolean; +} + +/** + * Configuration options for the Asset Manifest + */ +export interface AssetManifestOptions { + /** + * Version of bootstrap stack required to deploy this stack + * + * @default - Version 1 (basic modern bootstrap stack) + */ + readonly requiresBootstrapStackVersion?: number; + + /** + * SSM parameter where the bootstrap stack version number can be found + * + * - If this value is not set, the bootstrap stack name must be known at + * deployment time so the stack version can be looked up from the stack + * outputs. + * - If this value is set, the bootstrap stack can have any name because + * we won't need to look it up. + * + * @default - Bootstrap stack version number looked up + */ + readonly bootstrapStackVersionSsmParameter?: string; +} + +/** + * Artifact properties for the Asset Manifest + */ +export interface AssetManifestProperties extends AssetManifestOptions { + /** + * Filename of the asset manifest + */ + readonly file: string; +} + +/** + * Artifact properties for the Construct Tree Artifact + */ +export interface TreeArtifactProperties { + /** + * Filename of the tree artifact + */ + readonly file: string; +} + +/** + * Artifact properties for nested cloud assemblies + */ +export interface NestedCloudAssemblyProperties { + /** + * Relative path to the nested cloud assembly + */ + readonly directoryName: string; + + /** + * Display name for the cloud assembly + * + * @default - The artifact ID + */ + readonly displayName?: string; +} + +/** + * Properties for manifest artifacts + */ +export type ArtifactProperties = AwsCloudFormationStackProperties +| AssetManifestProperties +| TreeArtifactProperties +| NestedCloudAssemblyProperties; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts new file mode 100644 index 0000000000000..bd35d023dfe69 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/context-queries.ts @@ -0,0 +1,514 @@ +import { Tag } from './metadata-schema'; + +/** + * Identifier for the context provider + */ +export enum ContextProvider { + /** + * AMI provider + */ + AMI_PROVIDER = 'ami', + + /** + * AZ provider + */ + AVAILABILITY_ZONE_PROVIDER = 'availability-zones', + + /** + * Route53 Hosted Zone provider + */ + HOSTED_ZONE_PROVIDER = 'hosted-zone', + + /** + * SSM Parameter Provider + */ + SSM_PARAMETER_PROVIDER = 'ssm', + + /** + * VPC Provider + */ + VPC_PROVIDER = 'vpc-provider', + + /** + * VPC Endpoint Service AZ Provider + */ + ENDPOINT_SERVICE_AVAILABILITY_ZONE_PROVIDER = 'endpoint-service-availability-zones', + + /** + * Load balancer provider + */ + LOAD_BALANCER_PROVIDER = 'load-balancer', + + /** + * Load balancer listener provider + */ + LOAD_BALANCER_LISTENER_PROVIDER = 'load-balancer-listener', + + /** + * Security group provider + */ + SECURITY_GROUP_PROVIDER = 'security-group', + + /** + * KMS Key Provider + */ + KEY_PROVIDER = 'key-provider', + + /** + * A plugin provider (the actual plugin name will be in the properties) + */ + PLUGIN = 'plugin', +} + +/** + * Query to AMI context provider + */ +export interface AmiContextQuery { + /** + * Account to query + */ + readonly account: string; + + /** + * Region to query + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Owners to DescribeImages call + * + * @default - All owners + */ + readonly owners?: string[]; + + /** + * Filters to DescribeImages call + */ + readonly filters: {[key: string]: string[]}; +} + +/** + * Query to availability zone context provider + */ +export interface AvailabilityZonesContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + +} + +/** + * Query to hosted zone context provider + */ +export interface HostedZoneContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * The domain name e.g. example.com to lookup + */ + readonly domainName: string; + + /** + * True if the zone you want to find is a private hosted zone + * + * @default false + */ + readonly privateZone?: boolean; + + /** + * The VPC ID to that the private zone must be associated with + * + * If you provide VPC ID and privateZone is false, this will return no results + * and raise an error. + * + * @default - Required if privateZone=true + */ + readonly vpcId?: string; +} + +/** + * Query to SSM Parameter Context Provider + */ +export interface SSMParameterContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Parameter name to query + */ + readonly parameterName: string; +} + +/** + * Query input for looking up a VPC + */ +export interface VpcContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Filters to apply to the VPC + * + * Filter parameters are the same as passed to DescribeVpcs. + * + * @see https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcs.html + */ + readonly filter: {[key: string]: string}; + + /** + * Whether to populate the subnetGroups field of the `VpcContextResponse`, + * which contains potentially asymmetric subnet groups. + * + * @default false + */ + readonly returnAsymmetricSubnets?: boolean; + + /** + * Optional tag for subnet group name. + * If not provided, we'll look at the aws-cdk:subnet-name tag. + * If the subnet does not have the specified tag, + * we'll use its type as the name. + * + * @default 'aws-cdk:subnet-name' + */ + readonly subnetGroupNameTag?: string; + + /** + * Whether to populate the `vpnGatewayId` field of the `VpcContextResponse`, + * which contains the VPN Gateway ID, if one exists. You can explicitly + * disable this in order to avoid the lookup if you know the VPC does not have + * a VPN Gatway attached. + * + * @default true + */ + readonly returnVpnGateways?: boolean; +} + +/** + * Query to endpoint service context provider + */ +export interface EndpointServiceAvailabilityZonesContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Query service name + */ + readonly serviceName: string; +} + +/** + * Type of load balancer + */ +export enum LoadBalancerType { + /** + * Network load balancer + */ + NETWORK = 'network', + + /** + * Application load balancer + */ + APPLICATION = 'application', +} + +/** + * Filters for selecting load balancers + */ +export interface LoadBalancerFilter { + /** + * Filter load balancers by their type + */ + readonly loadBalancerType: LoadBalancerType; + + /** + * Find by load balancer's ARN + * @default - does not search by load balancer arn + */ + readonly loadBalancerArn?: string; + + /** + * Match load balancer tags + * @default - does not match load balancers by tags + */ + readonly loadBalancerTags?: Tag[]; +} + +/** + * Query input for looking up a load balancer + */ +export interface LoadBalancerContextQuery extends LoadBalancerFilter { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; +} + +/** + * The protocol for connections from clients to the load balancer + */ +export enum LoadBalancerListenerProtocol { + /** + * HTTP protocol + */ + HTTP = 'HTTP', + + /** + * HTTPS protocol + */ + HTTPS = 'HTTPS', + + /** + * TCP protocol + */ + TCP = 'TCP', + + /** + * TLS protocol + */ + TLS = 'TLS', + + /** + * UDP protocol + * */ + UDP = 'UDP', + + /** + * TCP and UDP protocol + * */ + TCP_UDP = 'TCP_UDP', +} + +/** + * Query input for looking up a load balancer listener + */ +export interface LoadBalancerListenerContextQuery extends LoadBalancerFilter { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Find by listener's arn + * @default - does not find by listener arn + */ + readonly listenerArn?: string; + + /** + * Filter by listener protocol + * @default - does not filter by listener protocol + */ + readonly listenerProtocol?: LoadBalancerListenerProtocol; + + /** + * Filter listeners by listener port + * @default - does not filter by a listener port + */ + readonly listenerPort?: number; +} + +/** + * Query input for looking up a security group + */ +export interface SecurityGroupContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Security group id + * + * @default - None + */ + readonly securityGroupId?: string; + + /** + * Security group name + * + * @default - None + */ + readonly securityGroupName?: string; + + /** + * VPC ID + * + * @default - None + */ + readonly vpcId?: string; +} + +/** + * Query input for looking up a KMS Key + */ +export interface KeyContextQuery { + /** + * Query account + */ + readonly account: string; + + /** + * Query region + */ + readonly region: string; + + /** + * The ARN of the role that should be used to look up the missing values + * + * @default - None + */ + readonly lookupRoleArn?: string; + + /** + * Alias name used to search the Key + */ + readonly aliasName: string; +} + +/** + * Query input for plugins + * + * This alternate branch is necessary because it needs to be able to escape all type checking + * we do on on the cloud assembly -- we cannot know the properties that will be used a priori. + */ +export interface PluginContextQuery { + /** + * The name of the plugin + */ + readonly pluginName: string; + + /** + * Arbitrary other arguments for the plugin. + * + * This index signature is not usable in non-TypeScript/JavaScript languages. + * + * @jsii ignore + */ + [key: string]: any; +} + +export type ContextQueryProperties = AmiContextQuery +| AvailabilityZonesContextQuery +| HostedZoneContextQuery +| SSMParameterContextQuery +| VpcContextQuery +| EndpointServiceAvailabilityZonesContextQuery +| LoadBalancerContextQuery +| LoadBalancerListenerContextQuery +| SecurityGroupContextQuery +| KeyContextQuery +| PluginContextQuery; + diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/index.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/index.ts new file mode 100644 index 0000000000000..931538d80cf11 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/index.ts @@ -0,0 +1,4 @@ +export * from './schema'; +export * from './metadata-schema'; +export * from './artifact-schema'; +export * from './context-queries'; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts new file mode 100644 index 0000000000000..bcc67298ff308 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/metadata-schema.ts @@ -0,0 +1,290 @@ +/** + * Common properties for asset metadata. + */ +interface BaseAssetMetadataEntry { + /** + * Requested packaging style + */ + readonly packaging: string; + + /** + * Logical identifier for the asset + */ + readonly id: string; + + /** + * The hash of the asset source. + */ + readonly sourceHash: string; + + /** + * Path on disk to the asset + */ + readonly path: string; +} + +/** + * Metadata Entry spec for files. + */ +export interface FileAssetMetadataEntry extends BaseAssetMetadataEntry { + /** + * Requested packaging style + */ + readonly packaging: 'zip' | 'file'; + + /** + * Name of parameter where S3 bucket should be passed in + */ + readonly s3BucketParameter: string; + + /** + * Name of parameter where S3 key should be passed in + */ + readonly s3KeyParameter: string; + + /** + * The name of the parameter where the hash of the bundled asset should be passed in. + */ + readonly artifactHashParameter: string; +} + +/** + * Metadata Entry spec for stack tag. + */ +export interface Tag { + /** + * Tag key. + * + * (In the actual file on disk this will be cased as "Key", and the structure is + * patched to match this structure upon loading: + * https://github.com/aws/aws-cdk/blob/4aadaa779b48f35838cccd4e25107b2338f05547/packages/%40aws-cdk/cloud-assembly-schema/lib/manifest.ts#L137) + */ + readonly key: string + + /** + * Tag value. + * + * (In the actual file on disk this will be cased as "Value", and the structure is + * patched to match this structure upon loading: + * https://github.com/aws/aws-cdk/blob/4aadaa779b48f35838cccd4e25107b2338f05547/packages/%40aws-cdk/cloud-assembly-schema/lib/manifest.ts#L137) + */ + readonly value: string +} + +/** + * Options for configuring the Docker cache backend + */ +export interface ContainerImageAssetCacheOption { + /** + * The type of cache to use. + * Refer to https://docs.docker.com/build/cache/backends/ for full list of backends. + * @default - unspecified + * + * @example 'registry' + */ + readonly type: string; + /** + * Any parameters to pass into the docker cache backend configuration. + * Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration. + * @default {} No options provided + * + * @example { ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`, mode: "max" } + */ + readonly params?: { [key: string]: string }; +} + +/** + * Metadata Entry spec for container images. + */ +export interface ContainerImageAssetMetadataEntry extends BaseAssetMetadataEntry { + /** + * Type of asset + */ + readonly packaging: 'container-image'; + + /** + * ECR Repository name and repo digest (separated by "@sha256:") where this + * image is stored. + * + * @default undefined If not specified, `repositoryName` and `imageTag` are + * required because otherwise how will the stack know where to find the asset, + * ha? + * @deprecated specify `repositoryName` and `imageTag` instead, and then you + * know where the image will go. + */ + readonly imageNameParameter?: string; + + /** + * ECR repository name, if omitted a default name based on the asset's ID is + * used instead. Specify this property if you need to statically address the + * image, e.g. from a Kubernetes Pod. Note, this is only the repository name, + * without the registry and the tag parts. + * + * @default - this parameter is REQUIRED after 1.21.0 + */ + readonly repositoryName?: string; + + /** + * The docker image tag to use for tagging pushed images. This field is + * required if `imageParameterName` is ommited (otherwise, the app won't be + * able to find the image). + * + * @default - this parameter is REQUIRED after 1.21.0 + */ + readonly imageTag?: string; + + /** + * Build args to pass to the `docker build` command + * + * @default no build args are passed + */ + readonly buildArgs?: { [key: string]: string }; + + /** + * Build secrets to pass to the `docker build` command + * + * @default no build secrets are passed + */ + readonly buildSecrets?: { [key: string]: string }; + + /** + * Docker target to build to + * + * @default no build target + */ + readonly target?: string; + + /** + * Path to the Dockerfile (relative to the directory). + * + * @default - no file is passed + */ + readonly file?: string; + + /** + * Networking mode for the RUN commands during build. + * + * @default - no networking mode specified + */ + readonly networkMode?: string; + + /** + * Platform to build for. _Requires Docker Buildx_. + * + * @default - current machine platform + */ + readonly platform?: string; + + /** + * Outputs to pass to the `docker build` command. + * + * @default - no outputs are passed to the build command (default outputs are used) + * @see https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs + */ + readonly outputs?: string[]; + + /** + * Cache from options to pass to the `docker build` command. + * + * @default - no cache from options are passed to the build command + * @see https://docs.docker.com/build/cache/backends/ + */ + readonly cacheFrom?: ContainerImageAssetCacheOption[]; + + /** + * Cache to options to pass to the `docker build` command. + * + * @default - no cache to options are passed to the build command + * @see https://docs.docker.com/build/cache/backends/ + */ + readonly cacheTo?: ContainerImageAssetCacheOption; +} + +/** + * @see ArtifactMetadataEntryType.ASSET + */ +export type AssetMetadataEntry = FileAssetMetadataEntry | ContainerImageAssetMetadataEntry; + +// Type aliases for metadata entries. +// Used simply to assign names to data types for more clarity. + +/** + * @see ArtifactMetadataEntryType.INFO + * @see ArtifactMetadataEntryType.WARN + * @see ArtifactMetadataEntryType.ERROR + */ +export type LogMessageMetadataEntry = string; + +/** + * @see ArtifactMetadataEntryType.LOGICAL_ID + */ +export type LogicalIdMetadataEntry = string; + +/** + * @see ArtifactMetadataEntryType.STACK_TAGS + */ +export type StackTagsMetadataEntry = Tag[]; + +/** + * Union type for all metadata entries that might exist in the manifest. + */ +export type MetadataEntryData = AssetMetadataEntry | LogMessageMetadataEntry | LogicalIdMetadataEntry | StackTagsMetadataEntry; + +/** + * Type of artifact metadata entry. + */ +export enum ArtifactMetadataEntryType { + /** + * Asset in metadata. + */ + ASSET = 'aws:cdk:asset', + + /** + * Metadata key used to print INFO-level messages by the toolkit when an app is syntheized. + */ + INFO = 'aws:cdk:info', + + /** + * Metadata key used to print WARNING-level messages by the toolkit when an app is syntheized. + */ + WARN = 'aws:cdk:warning', + + /** + * Metadata key used to print ERROR-level messages by the toolkit when an app is syntheized. + */ + ERROR = 'aws:cdk:error', + + /** + * Represents the CloudFormation logical ID of a resource at a certain path. + */ + LOGICAL_ID = 'aws:cdk:logicalId', + + /** + * Represents tags of a stack. + */ + STACK_TAGS = 'aws:cdk:stack-tags' +} + +/** + * A metadata entry in a cloud assembly artifact. + */ +export interface MetadataEntry { + /** + * The type of the metadata entry. + */ + readonly type: string; + + /** + * The data. + * + * @default - no data. + */ + readonly data?: MetadataEntryData; + + /** + * A stack trace for when the entry was created. + * + * @default - no trace. + */ + readonly trace?: string[]; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/schema.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/schema.ts new file mode 100644 index 0000000000000..b6c9ba4ba39cd --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/cloud-assembly/schema.ts @@ -0,0 +1,140 @@ +import { ArtifactProperties } from './artifact-schema'; +import { ContextProvider, ContextQueryProperties } from './context-queries'; +import { MetadataEntry } from './metadata-schema'; + +/** + * Type of cloud artifact. + */ +export enum ArtifactType { + /** + * Stub required because of JSII. + */ + NONE = 'none', // required due to a jsii bug + + /** + * The artifact is an AWS CloudFormation stack. + */ + AWS_CLOUDFORMATION_STACK = 'aws:cloudformation:stack', + + /** + * The artifact contains the CDK application's construct tree. + */ + CDK_TREE = 'cdk:tree', + + /** + * Manifest for all assets in the Cloud Assembly + */ + ASSET_MANIFEST = 'cdk:asset-manifest', + + /** + * Nested Cloud Assembly + */ + NESTED_CLOUD_ASSEMBLY = 'cdk:cloud-assembly', +} + +/** + * Information about the application's runtime components. + */ +export interface RuntimeInfo { + /** + * The list of libraries loaded in the application, associated with their versions. + */ + readonly libraries: { [name: string]: string }; +} + +/** + * Represents a missing piece of context. + */ +export interface MissingContext { + /** + * The missing context key. + */ + readonly key: string; + + /** + * The provider from which we expect this context key to be obtained. + */ + readonly provider: ContextProvider; + + /** + * A set of provider-specific options. + */ + readonly props: ContextQueryProperties; +} + +/** + * A manifest for a single artifact within the cloud assembly. + */ +export interface ArtifactManifest { + /** + * The type of artifact. + */ + readonly type: ArtifactType; + + /** + * The environment into which this artifact is deployed. + * + * @default - no envrionment. + */ + readonly environment?: string; // format: aws://account/region + + /** + * Associated metadata. + * + * @default - no metadata. + */ + readonly metadata?: { [path: string]: MetadataEntry[] }; + + /** + * IDs of artifacts that must be deployed before this artifact. + * + * @default - no dependencies. + */ + readonly dependencies?: string[]; + + /** + * The set of properties for this artifact (depends on type) + * + * @default - no properties. + */ + readonly properties?: ArtifactProperties; + + /** + * A string that represents this artifact. Should only be used in user interfaces. + * + * @default - no display name + */ + readonly displayName?: string; +} + +/** + * A manifest which describes the cloud assembly. + */ +export interface AssemblyManifest { + /** + * Protocol version + */ + readonly version: string; + + /** + * The set of artifacts in this assembly. + * + * @default - no artifacts. + */ + readonly artifacts?: { [id: string]: ArtifactManifest }; + + /** + * Missing context information. If this field has values, it means that the + * cloud assembly is not complete and should not be deployed. + * + * @default - no missing context. + */ + readonly missing?: MissingContext[]; + + /** + * Runtime information. + * + * @default - no info. + */ + readonly runtime?: RuntimeInfo; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/index.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/index.ts new file mode 100644 index 0000000000000..5fd6eb6ceda07 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/index.ts @@ -0,0 +1,4 @@ +export * from './cloud-assembly'; +export * from './assets'; +export * from './manifest'; +export * from './integ-tests'; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/common.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/common.ts new file mode 100644 index 0000000000000..01ab969b63098 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/common.ts @@ -0,0 +1,202 @@ +/** + * In what scenarios should the CLI ask for approval + */ +export enum RequireApproval { + /** + * Never ask for approval + */ + NEVER = 'never', + + /** + * Prompt for approval for any type of change to the stack + */ + ANYCHANGE = 'any-change', + + /** + * Only prompt for approval if there are security related changes + */ + BROADENING = 'broadening' +} + +/** + * Default CDK CLI options that apply to all commands + */ +export interface DefaultCdkOptions { + /** + * List of stacks to deploy + * + * Requried if `all` is not set + * + * @default - [] + */ + readonly stacks?: string[]; + + /** + * Deploy all stacks + * + * Requried if `stacks` is not set + * + * @default - false + */ + readonly all?: boolean; + + /** + * command-line for executing your app or a cloud assembly directory + * e.g. "node bin/my-app.js" + * or + * "cdk.out" + * + * @default - read from cdk.json + */ + readonly app?: string; + + + /** + * Role to pass to CloudFormation for deployment + * + * @default - use the bootstrap cfn-exec role + */ + readonly roleArn?: string; + + /** + * Additional context + * + * @default - no additional context + */ + readonly context?: { [name: string]: string }; + + /** + * Print trace for stack warnings + * + * @default false + */ + readonly trace?: boolean; + + /** + * Do not construct stacks with warnings + * + * @default false + */ + readonly strict?: boolean; + + /** + * Perform context lookups. + * + * Synthesis fails if this is disabled and context lookups need + * to be performed + * + * @default true + */ + readonly lookups?: boolean; + + /** + * Ignores synthesis errors, which will likely produce an invalid output + * + * @default false + */ + readonly ignoreErrors?: boolean; + + /** + * Use JSON output instead of YAML when templates are printed + * to STDOUT + * + * @default false + */ + readonly json?: boolean; + + /** + * show debug logs + * + * @default false + */ + readonly verbose?: boolean; + + /** + * enable emission of additional debugging information, such as creation stack + * traces of tokens + * + * @default false + */ + readonly debug?: boolean; + + /** + * Use the indicated AWS profile as the default environment + * + * @default - no profile is used + */ + readonly profile?: string; + + /** + * Use the indicated proxy. Will read from + * HTTPS_PROXY environment if specified + * + * @default - no proxy + */ + readonly proxy?: string; + + /** + * Path to CA certificate to use when validating HTTPS + * requests. + * + * @default - read from AWS_CA_BUNDLE environment variable + */ + readonly caBundlePath?: string; + + /** + * Force trying to fetch EC2 instance credentials + * + * @default - guess EC2 instance status + */ + readonly ec2Creds?: boolean; + + /** + * Include "AWS::CDK::Metadata" resource in synthesized templates + * + * @default true + */ + readonly versionReporting?: boolean; + + /** + * Include "aws:cdk:path" CloudFormation metadata for each resource + * + * @default true + */ + readonly pathMetadata?: boolean; + + /** + * Include "aws:asset:*" CloudFormation metadata for resources that use assets + * + * @default true + */ + readonly assetMetadata?: boolean; + + /** + * Copy assets to the output directory + * + * Needed for local debugging the source files with SAM CLI + * + * @default false + */ + readonly staging?: boolean; + + /** + * Emits the synthesized cloud assembly into a directory + * + * @default cdk.out + */ + readonly output?: string; + + /** + * Show relevant notices + * + * @default true + */ + readonly notices?: boolean; + + /** + * Show colors and other style from console output + * + * @default true + */ + readonly color?: boolean; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts new file mode 100644 index 0000000000000..09a20c610f12d --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/deploy.ts @@ -0,0 +1,97 @@ +import { DefaultCdkOptions, RequireApproval } from './common'; + +/** + * Options to use with cdk deploy + */ +export interface DeployOptions extends DefaultCdkOptions { + /** + * Only perform action on the given stack + * + * @default false + */ + readonly exclusively?: boolean; + + /** + * Name of the toolkit stack to use/deploy + * + * @default CDKToolkit + */ + readonly toolkitStackName?: string; + + /** + * Reuse the assets with the given asset IDs + * + * @default - do not reuse assets + */ + readonly reuseAssets?: string[]; + + /** + * Optional name to use for the CloudFormation change set. + * If not provided, a name will be generated automatically. + * + * @default - auto generate a name + */ + readonly changeSetName?: string; + + /** + * Always deploy, even if templates are identical. + * @default false + */ + readonly force?: boolean; + + /** + * Rollback failed deployments + * + * @default true + */ + readonly rollback?: boolean; + + /** + * ARNs of SNS topics that CloudFormation will notify with stack related events + * + * @default - no notifications + */ + readonly notificationArns?: string[]; + + /** + * What kind of security changes require approval + * + * @default RequireApproval.Never + */ + readonly requireApproval?: RequireApproval; + + /** + * Whether to execute the ChangeSet + * Not providing `execute` parameter will result in execution of ChangeSet + * @default true + */ + readonly execute?: boolean; + + /** + * Additional parameters for CloudFormation at deploy time + * @default {} + */ + readonly parameters?: { [name: string]: string }; + + /** + * Use previous values for unspecified parameters + * + * If not set, all parameters must be specified for every deployment. + * + * @default true + */ + readonly usePreviousParameters?: boolean; + + /** + * Path to file where stack outputs will be written after a successful deploy as JSON + * @default - Outputs are not written to any file + */ + readonly outputsFile?: string; + + /** + * Whether we are on a CI system + * + * @default false + */ + readonly ci?: boolean; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts new file mode 100644 index 0000000000000..9dfe8f267c6db --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/destroy.ts @@ -0,0 +1,20 @@ +import { DefaultCdkOptions } from './common'; + +/** + * Options to use with cdk destroy + */ +export interface DestroyOptions extends DefaultCdkOptions { + /** + * Do not ask for permission before destroying stacks + * + * @default false + */ + readonly force?: boolean; + + /** + * Only destroy the given stack + * + * @default false + */ + readonly exclusively?: boolean; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/index.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/index.ts new file mode 100644 index 0000000000000..528980446938b --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/commands/index.ts @@ -0,0 +1,3 @@ +export * from './common'; +export * from './deploy'; +export * from './destroy'; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/index.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/index.ts new file mode 100644 index 0000000000000..5a08e62a47958 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/index.ts @@ -0,0 +1,3 @@ +export * from './schema'; +export * from './commands'; +export * from './test-case'; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/schema.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/schema.ts new file mode 100644 index 0000000000000..1a617e23cf959 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/schema.ts @@ -0,0 +1,35 @@ +import { TestCase } from './test-case'; +/** + * Definitions for the integration testing manifest + */ +export interface IntegManifest { + /** + * Version of the manifest + */ + readonly version: string; + + /** + * Enable lookups for this test. If lookups are enabled + * then `stackUpdateWorkflow` must be set to false. + * Lookups should only be enabled when you are explicitely testing + * lookups. + * + * @default false + */ + readonly enableLookups?: boolean; + + /** + * Additional context to use when performing + * a synth. Any context provided here will override + * any default context + * + * @default - no additional context + */ + readonly synthContext?: { [name: string]: string }; + + /** + * test cases + */ + readonly testCases: { [testName: string]: TestCase }; +} + diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/test-case.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/test-case.ts new file mode 100644 index 0000000000000..6878f9da2563c --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/integ-tests/test-case.ts @@ -0,0 +1,206 @@ +import { DeployOptions, DestroyOptions } from './commands'; + +/** + * The set of options to control the workflow of the test runner + */ +export interface TestOptions { + /** + * Run update workflow on this test case + * This should only be set to false to test scenarios + * that are not possible to test as part of the update workflow + * + * @default true + */ + readonly stackUpdateWorkflow?: boolean; + + /** + * Additional options to use for each CDK command + * + * @default - runner default options + */ + readonly cdkCommandOptions?: CdkCommands; + + /** + * Additional commands to run at predefined points in the test workflow + * + * e.g. { postDeploy: ['yarn', 'test'] } + * + * @default - no hooks + */ + readonly hooks?: Hooks; + + /** + * Whether or not to include asset hashes in the diff + * Asset hashes can introduces a lot of unneccessary noise into tests, + * but there are some cases where asset hashes _should_ be included. For example + * any tests involving custom resources or bundling + * + * @default false + */ + readonly diffAssets?: boolean; + + /** + * List of CloudFormation resource types in this stack that can + * be destroyed as part of an update without failing the test. + * + * This list should only include resources that for this specific + * integration test we are sure will not cause errors or an outage if + * destroyed. For example, maybe we know that a new resource will be created + * first before the old resource is destroyed which prevents any outage. + * + * e.g. ['AWS::IAM::Role'] + * + * @default - do not allow destruction of any resources on update + */ + readonly allowDestroy?: string[]; + + /** + * Limit deployment to these regions + * + * @default - can run in any region + */ + readonly regions?: string[]; +} + +/** + * Represents an integration test case + */ +export interface TestCase extends TestOptions { + /** + * Stacks that should be tested as part of this test case + * The stackNames will be passed as args to the cdk commands + * so dependent stacks will be automatically deployed unless + * `exclusively` is passed + */ + readonly stacks: string[]; + + /** + * The node id of the stack that contains assertions. + * This is the value that can be used to deploy the stack with the CDK CLI + * + * @default - no assertion stack + */ + readonly assertionStack?: string; + + /** + * The name of the stack that contains assertions + * + * @default - no assertion stack + */ + readonly assertionStackName?: string; +} + +/** + * Commands to run at predefined points during the + * integration test workflow + */ +export interface Hooks { + /** + * Commands to run prior to deploying the cdk stacks + * in the integration test + * + * @default - no commands + */ + readonly preDeploy?: string[]; + + /** + * Commands to run prior after deploying the cdk stacks + * in the integration test + * + * @default - no commands + */ + readonly postDeploy?: string[]; + + /** + * Commands to run prior to destroying the cdk stacks + * in the integration test + * + * @default - no commands + */ + readonly preDestroy?: string[]; + + /** + * Commands to run after destroying the cdk stacks + * in the integration test + * + * @default - no commands + */ + readonly postDestroy?: string[]; +} + +/** + * Represents a cdk command + * i.e. `synth`, `deploy`, & `destroy` + */ +export interface CdkCommand { + /** + * Whether or not to run this command as part of the workflow + * This can be used if you only want to test some of the workflow + * for example enable `synth` and disable `deploy` & `destroy` in order + * to limit the test to synthesis + * + * @default true + */ + readonly enabled?: boolean; + + /** + * If the runner should expect this command to fail + * + * @default false + */ + readonly expectError?: boolean; + + /** + * This can be used in combination with `expectedError` + * to validate that a specific message is returned. + * + * @default - do not validate message + */ + readonly expectedMessage?: string; +} + +/** + * Represents a cdk deploy command + */ +export interface DeployCommand extends CdkCommand { + /** + * Additional arguments to pass to the command + * This can be used to test specific CLI functionality + * + * @default - only default args are used + */ + readonly args?: DeployOptions; +} + +/** + * Represents a cdk destroy command + */ +export interface DestroyCommand extends CdkCommand { + /** + * Additional arguments to pass to the command + * This can be used to test specific CLI functionality + * + * @default - only default args are used + */ + readonly args?: DestroyOptions; +} + +/** + * Options for specific cdk commands that are run + * as part of the integration test workflow + */ +export interface CdkCommands { + /** + * Options to for the cdk deploy command + * + * @default - default deploy options + */ + readonly deploy?: DeployCommand; + + /** + * Options to for the cdk destroy command + * + * @default - default destroy options + */ + readonly destroy?: DestroyCommand; +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts b/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts new file mode 100644 index 0000000000000..61af3b69ddb24 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/lib/manifest.ts @@ -0,0 +1,282 @@ +import * as fs from 'fs'; +import * as jsonschema from 'jsonschema'; +import * as semver from 'semver'; +import * as assets from './assets'; +import * as assembly from './cloud-assembly'; +import * as integ from './integ-tests'; + +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-require-imports */ + +// this prefix is used by the CLI to identify this specific error. +// in which case we want to instruct the user to upgrade his CLI. +// see exec.ts#createAssembly +export const VERSION_MISMATCH: string = 'Cloud assembly schema version mismatch'; + +const ASSETS_SCHEMA = require('../schema/assets.schema.json'); + +const ASSEMBLY_SCHEMA = require('../schema/cloud-assembly.schema.json'); + +/** + * Version is shared for both manifests + */ +const SCHEMA_VERSION = require('../schema/cloud-assembly.version.json').version; + +const INTEG_SCHEMA = require('../schema/integ.schema.json'); + +/** + * Options for the loadManifest operation + */ +export interface LoadManifestOptions { + /** + * Skip the version check + * + * This means you may read a newer cloud assembly than the CX API is designed + * to support, and your application may not be aware of all features that in use + * in the Cloud Assembly. + * + * @default false + */ + readonly skipVersionCheck?: boolean; + + /** + * Skip enum checks + * + * This means you may read enum values you don't know about yet. Make sure to always + * check the values of enums you encounter in the manifest. + * + * @default false + */ + readonly skipEnumCheck?: boolean; +} + +/** + * Protocol utility class. + */ +export class Manifest { + /** + * Validates and saves the cloud assembly manifest to file. + * + * @param manifest - manifest. + * @param filePath - output file path. + */ + public static saveAssemblyManifest(manifest: assembly.AssemblyManifest, filePath: string) { + Manifest.saveManifest(manifest, filePath, ASSEMBLY_SCHEMA, Manifest.patchStackTagsOnWrite); + } + + /** + * Load and validates the cloud assembly manifest from file. + * + * @param filePath - path to the manifest file. + */ + public static loadAssemblyManifest(filePath: string, options?: LoadManifestOptions): assembly.AssemblyManifest { + return Manifest.loadManifest(filePath, ASSEMBLY_SCHEMA, Manifest.patchStackTagsOnRead, options); + } + + /** + * Validates and saves the asset manifest to file. + * + * @param manifest - manifest. + * @param filePath - output file path. + */ + public static saveAssetManifest(manifest: assets.AssetManifest, filePath: string) { + Manifest.saveManifest(manifest, filePath, ASSETS_SCHEMA, Manifest.patchStackTagsOnRead); + } + + /** + * Load and validates the asset manifest from file. + * + * @param filePath - path to the manifest file. + */ + public static loadAssetManifest(filePath: string): assets.AssetManifest { + return this.loadManifest(filePath, ASSETS_SCHEMA); + } + + /** + * Validates and saves the integ manifest to file. + * + * @param manifest - manifest. + * @param filePath - output file path. + */ + public static saveIntegManifest(manifest: integ.IntegManifest, filePath: string) { + Manifest.saveManifest(manifest, filePath, INTEG_SCHEMA); + } + + /** + * Load and validates the integ manifest from file. + * + * @param filePath - path to the manifest file. + */ + public static loadIntegManifest(filePath: string): integ.IntegManifest { + return this.loadManifest(filePath, INTEG_SCHEMA); + } + + /** + * Fetch the current schema version number. + */ + public static version(): string { + return SCHEMA_VERSION; + } + + /** + * Deprecated + * @deprecated use `saveAssemblyManifest()` + */ + public static save(manifest: assembly.AssemblyManifest, filePath: string) { return this.saveAssemblyManifest(manifest, filePath); } + + /** + * Deprecated + * @deprecated use `loadAssemblyManifest()` + */ + public static load(filePath: string): assembly.AssemblyManifest { return this.loadAssemblyManifest(filePath); } + + private static validate(manifest: { version: string }, schema: jsonschema.Schema, options?: LoadManifestOptions) { + function parseVersion(version: string) { + const ver = semver.valid(version); + if (!ver) { + throw new Error(`Invalid semver string: "${version}"`); + } + return ver; + } + + const maxSupported = parseVersion(Manifest.version()); + const actual = parseVersion(manifest.version); + + // first validate the version should be accepted. + if (semver.gt(actual, maxSupported) && !options?.skipVersionCheck) { + // we use a well known error prefix so that the CLI can identify this specific error + // and print some more context to the user. + throw new Error(`${VERSION_MISMATCH}: Maximum schema version supported is ${maxSupported}, but found ${actual}`); + } + + // now validate the format is good. + const validator = new jsonschema.Validator(); + const result = validator.validate(manifest, schema, { + + // does exist but is not in the TypeScript definitions + nestedErrors: true, + + allowUnknownAttributes: false, + + } as any); + + let errors = result.errors; + if (options?.skipEnumCheck) { + // Enum validations aren't useful when + errors = stripEnumErrors(errors); + } + + if (errors.length > 0) { + throw new Error(`Invalid assembly manifest:\n${errors.map(e => e.stack).join('\n')}`); + } + } + + private static saveManifest(manifest: any, filePath: string, schema: jsonschema.Schema, preprocess?: (obj: any) => any) { + let withVersion = { ...manifest, version: Manifest.version() }; + Manifest.validate(withVersion, schema); + if (preprocess) { + withVersion = preprocess(withVersion); + } + fs.writeFileSync(filePath, JSON.stringify(withVersion, undefined, 2)); + } + + private static loadManifest(filePath: string, schema: jsonschema.Schema, preprocess?: (obj: any) => any, options?: LoadManifestOptions) { + const contents = fs.readFileSync(filePath, { encoding: 'utf-8' }); + let obj; + try { + obj = JSON.parse(contents); + } catch (e: any) { + throw new Error(`${e.message}, while parsing ${JSON.stringify(contents)}`); + } + if (preprocess) { + obj = preprocess(obj); + } + Manifest.validate(obj, schema, options); + return obj; + } + + /** + * This requires some explaining... + * + * We previously used `{ Key, Value }` for the object that represents a stack tag. (Notice the casing) + * @link https://github.com/aws/aws-cdk/blob/v1.27.0/packages/aws-cdk/lib/api/cxapp/stacks.ts#L427. + * + * When that object moved to this package, it had to be JSII compliant, which meant the property + * names must be `camelCased`, and not `PascalCased`. This meant it no longer matches the structure in the `manifest.json` file. + * In order to support current manifest files, we have to translate the `PascalCased` representation to the new `camelCased` one. + * + * Note that the serialization itself still writes `PascalCased` because it relates to how CloudFormation expects it. + * + * Ideally, we would start writing the `camelCased` and translate to how CloudFormation expects it when needed. But this requires nasty + * backwards-compatibility code and it just doesn't seem to be worth the effort. + */ + private static patchStackTagsOnRead(manifest: assembly.AssemblyManifest) { + return Manifest.replaceStackTags(manifest, tags => tags.map((diskTag: any) => ({ + key: diskTag.Key, + value: diskTag.Value, + }))); + } + + /** + * See explanation on `patchStackTagsOnRead` + * + * Translate stack tags metadata if it has the "right" casing. + */ + private static patchStackTagsOnWrite(manifest: assembly.AssemblyManifest) { + return Manifest.replaceStackTags(manifest, tags => tags.map(memTag => + // Might already be uppercased (because stack synthesis generates it in final form yet) + ('Key' in memTag ? memTag : { Key: memTag.key, Value: memTag.value }) as any, + )); + } + + /** + * Recursively replace stack tags in the stack metadata + */ + private static replaceStackTags(manifest: assembly.AssemblyManifest, fn: Endofunctor): assembly.AssemblyManifest { + // Need to add in the `noUndefined`s because otherwise jest snapshot tests are going to freak out + // about the keys with values that are `undefined` (even though they would never be JSON.stringified) + return noUndefined({ + ...manifest, + artifacts: mapValues(manifest.artifacts, artifact => { + if (artifact.type !== assembly.ArtifactType.AWS_CLOUDFORMATION_STACK) { return artifact; } + return noUndefined({ + ...artifact, + metadata: mapValues(artifact.metadata, metadataEntries => metadataEntries.map(metadataEntry => { + if (metadataEntry.type !== assembly.ArtifactMetadataEntryType.STACK_TAGS || !metadataEntry.data) { return metadataEntry; } + return { + ...metadataEntry, + data: fn(metadataEntry.data as assembly.StackTagsMetadataEntry), + }; + })), + } as assembly.ArtifactManifest); + }), + }); + } + + private constructor() {} +} + +type Endofunctor
= (x: A) => A; + +function mapValues(xs: Record | undefined, fn: (x: A) => B): Record | undefined { + if (!xs) { return undefined; } + const ret: Record | undefined = {}; + for (const [k, v] of Object.entries(xs)) { + ret[k] = fn(v); + } + return ret; +} + +function noUndefined(xs: A): A { + const ret: any = {}; + for (const [k, v] of Object.entries(xs)) { + if (v !== undefined) { + ret[k] = v; + } + } + return ret; +} + +function stripEnumErrors(errors: jsonschema.ValidationError[]) { + return errors.filter(e => typeof e.schema ==='string' || !('enum' in e.schema)); +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/schema/README.md b/packages/aws-cdk-lib/cloud-assembly-schema/schema/README.md new file mode 100644 index 0000000000000..ae58ce74ee4e8 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/schema/README.md @@ -0,0 +1,5 @@ +## Cloud Assembly JSON Schema + +**DO NOT MODIFY FILES IN THIS DIRECTORY BY HAND** + +To modify, run `yarn update-schema`. \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/schema/assets.schema.json b/packages/aws-cdk-lib/cloud-assembly-schema/schema/assets.schema.json new file mode 100644 index 0000000000000..6e7f02037f744 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/schema/assets.schema.json @@ -0,0 +1,245 @@ +{ + "$ref": "#/definitions/AssetManifest", + "definitions": { + "AssetManifest": { + "description": "Definitions for the asset manifest", + "type": "object", + "properties": { + "version": { + "description": "Version of the manifest", + "type": "string" + }, + "files": { + "description": "The file assets in this manifest (Default - No files)", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/FileAsset" + } + }, + "dockerImages": { + "description": "The Docker image assets in this manifest (Default - No Docker images)", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/DockerImageAsset" + } + } + }, + "required": [ + "version" + ] + }, + "FileAsset": { + "description": "A file asset", + "type": "object", + "properties": { + "source": { + "$ref": "#/definitions/FileSource", + "description": "Source description for file assets" + }, + "destinations": { + "description": "Destinations for this file asset", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/FileDestination" + } + } + }, + "required": [ + "destinations", + "source" + ] + }, + "FileSource": { + "description": "Describe the source of a file asset", + "type": "object", + "properties": { + "executable": { + "description": "External command which will produce the file asset to upload. (Default - Exactly one of `executable` and `path` is required.)", + "type": "array", + "items": { + "type": "string" + } + }, + "path": { + "description": "The filesystem object to upload\n\nThis path is relative to the asset manifest location. (Default - Exactly one of `executable` and `path` is required.)", + "type": "string" + }, + "packaging": { + "description": "Packaging method\n\nOnly allowed when `path` is specified. (Default FILE)", + "enum": [ + "file", + "zip" + ], + "type": "string" + } + } + }, + "FileDestination": { + "description": "Where in S3 a file asset needs to be published", + "type": "object", + "properties": { + "bucketName": { + "description": "The name of the bucket", + "type": "string" + }, + "objectKey": { + "description": "The destination object key", + "type": "string" + }, + "region": { + "description": "The region where this asset will need to be published (Default - Current region)", + "type": "string" + }, + "assumeRoleArn": { + "description": "The role that needs to be assumed while publishing this asset (Default - No role will be assumed)", + "type": "string" + }, + "assumeRoleExternalId": { + "description": "The ExternalId that needs to be supplied while assuming this role (Default - No ExternalId will be supplied)", + "type": "string" + } + }, + "required": [ + "bucketName", + "objectKey" + ] + }, + "DockerImageAsset": { + "description": "A file asset", + "type": "object", + "properties": { + "source": { + "$ref": "#/definitions/DockerImageSource", + "description": "Source description for file assets" + }, + "destinations": { + "description": "Destinations for this file asset", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/DockerImageDestination" + } + } + }, + "required": [ + "destinations", + "source" + ] + }, + "DockerImageSource": { + "description": "Properties for how to produce a Docker image from a source", + "type": "object", + "properties": { + "directory": { + "description": "The directory containing the Docker image build instructions.\n\nThis path is relative to the asset manifest location. (Default - Exactly one of `directory` and `executable` is required)", + "type": "string" + }, + "executable": { + "description": "A command-line executable that returns the name of a local\nDocker image on stdout after being run. (Default - Exactly one of `directory` and `executable` is required)", + "type": "array", + "items": { + "type": "string" + } + }, + "dockerFile": { + "description": "The name of the file with build instructions\n\nOnly allowed when `directory` is set. (Default Dockerfile)", + "type": "string" + }, + "dockerBuildTarget": { + "description": "Target build stage in a Dockerfile with multiple build stages\n\nOnly allowed when `directory` is set. (Default - The last stage in the Dockerfile)", + "type": "string" + }, + "dockerBuildArgs": { + "description": "Additional build arguments\n\nOnly allowed when `directory` is set. (Default - No additional build arguments)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "dockerBuildSecrets": { + "description": "Additional build secrets\n\nOnly allowed when `directory` is set. (Default - No additional build secrets)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "networkMode": { + "description": "Networking mode for the RUN commands during build. _Requires Docker Engine API v1.25+_.\n\nSpecify this property to build images on a specific networking mode. (Default - no networking mode specified)", + "type": "string" + }, + "platform": { + "description": "Platform to build for. _Requires Docker Buildx_.\n\nSpecify this property to build images on a specific platform/architecture. (Default - current machine platform)", + "type": "string" + }, + "dockerOutputs": { + "description": "Outputs (Default - no outputs are passed to the build command (default outputs are used))", + "type": "array", + "items": { + "type": "string" + } + }, + "cacheFrom": { + "description": "Cache from options to pass to the `docker build` command. (Default - no cache from options are passed to the build command)", + "type": "array", + "items": { + "$ref": "#/definitions/DockerCacheOption" + } + }, + "cacheTo": { + "description": "Cache to options to pass to the `docker build` command. (Default - no cache to options are passed to the build command)", + "$ref": "#/definitions/DockerCacheOption" + } + } + }, + "DockerCacheOption": { + "description": "Options for configuring the Docker cache backend", + "type": "object", + "properties": { + "type": { + "description": "The type of cache to use.\nRefer to https://docs.docker.com/build/cache/backends/ for full list of backends. (Default - unspecified)", + "type": "string" + }, + "params": { + "description": "Any parameters to pass into the docker cache backend configuration.\nRefer to https://docs.docker.com/build/cache/backends/ for cache backend configuration. (Default {} No options provided)", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "type" + ] + }, + "DockerImageDestination": { + "description": "Where to publish docker images", + "type": "object", + "properties": { + "repositoryName": { + "description": "Name of the ECR repository to publish to", + "type": "string" + }, + "imageTag": { + "description": "Tag of the image to publish", + "type": "string" + }, + "region": { + "description": "The region where this asset will need to be published (Default - Current region)", + "type": "string" + }, + "assumeRoleArn": { + "description": "The role that needs to be assumed while publishing this asset (Default - No role will be assumed)", + "type": "string" + }, + "assumeRoleExternalId": { + "description": "The ExternalId that needs to be supplied while assuming this role (Default - No ExternalId will be supplied)", + "type": "string" + } + }, + "required": [ + "imageTag", + "repositoryName" + ] + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/schema/cloud-assembly.schema.json b/packages/aws-cdk-lib/cloud-assembly-schema/schema/cloud-assembly.schema.json new file mode 100644 index 0000000000000..12d263bfdea2f --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/schema/cloud-assembly.schema.json @@ -0,0 +1,933 @@ +{ + "$ref": "#/definitions/AssemblyManifest", + "definitions": { + "AssemblyManifest": { + "description": "A manifest which describes the cloud assembly.", + "type": "object", + "properties": { + "version": { + "description": "Protocol version", + "type": "string" + }, + "artifacts": { + "description": "The set of artifacts in this assembly. (Default - no artifacts.)", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/ArtifactManifest" + } + }, + "missing": { + "description": "Missing context information. If this field has values, it means that the\ncloud assembly is not complete and should not be deployed. (Default - no missing context.)", + "type": "array", + "items": { + "$ref": "#/definitions/MissingContext" + } + }, + "runtime": { + "description": "Runtime information. (Default - no info.)", + "$ref": "#/definitions/RuntimeInfo" + } + }, + "required": [ + "version" + ] + }, + "ArtifactManifest": { + "description": "A manifest for a single artifact within the cloud assembly.", + "type": "object", + "properties": { + "type": { + "$ref": "#/definitions/ArtifactType", + "description": "The type of artifact." + }, + "environment": { + "description": "The environment into which this artifact is deployed. (Default - no envrionment.)", + "type": "string" + }, + "metadata": { + "description": "Associated metadata. (Default - no metadata.)", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/MetadataEntry" + } + } + }, + "dependencies": { + "description": "IDs of artifacts that must be deployed before this artifact. (Default - no dependencies.)", + "type": "array", + "items": { + "type": "string" + } + }, + "properties": { + "description": "The set of properties for this artifact (depends on type) (Default - no properties.)", + "anyOf": [ + { + "$ref": "#/definitions/AwsCloudFormationStackProperties" + }, + { + "$ref": "#/definitions/AssetManifestProperties" + }, + { + "$ref": "#/definitions/TreeArtifactProperties" + }, + { + "$ref": "#/definitions/NestedCloudAssemblyProperties" + } + ] + }, + "displayName": { + "description": "A string that represents this artifact. Should only be used in user interfaces. (Default - no display name)", + "type": "string" + } + }, + "required": [ + "type" + ] + }, + "ArtifactType": { + "description": "Type of cloud artifact.", + "enum": [ + "aws:cloudformation:stack", + "cdk:asset-manifest", + "cdk:cloud-assembly", + "cdk:tree", + "none" + ], + "type": "string" + }, + "MetadataEntry": { + "description": "A metadata entry in a cloud assembly artifact.", + "type": "object", + "properties": { + "type": { + "description": "The type of the metadata entry.", + "type": "string" + }, + "data": { + "description": "The data. (Default - no data.)", + "anyOf": [ + { + "$ref": "#/definitions/FileAssetMetadataEntry" + }, + { + "$ref": "#/definitions/ContainerImageAssetMetadataEntry" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/Tag" + } + }, + { + "type": "string" + }, + { + "description": "Free form data." + } + ] + }, + "trace": { + "description": "A stack trace for when the entry was created. (Default - no trace.)", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "type" + ] + }, + "FileAssetMetadataEntry": { + "description": "Metadata Entry spec for files.", + "type": "object", + "properties": { + "packaging": { + "description": "Requested packaging style", + "enum": [ + "file", + "zip" + ], + "type": "string" + }, + "s3BucketParameter": { + "description": "Name of parameter where S3 bucket should be passed in", + "type": "string" + }, + "s3KeyParameter": { + "description": "Name of parameter where S3 key should be passed in", + "type": "string" + }, + "artifactHashParameter": { + "description": "The name of the parameter where the hash of the bundled asset should be passed in.", + "type": "string" + }, + "id": { + "description": "Logical identifier for the asset", + "type": "string" + }, + "sourceHash": { + "description": "The hash of the asset source.", + "type": "string" + }, + "path": { + "description": "Path on disk to the asset", + "type": "string" + } + }, + "required": [ + "artifactHashParameter", + "id", + "packaging", + "path", + "s3BucketParameter", + "s3KeyParameter", + "sourceHash" + ] + }, + "ContainerImageAssetMetadataEntry": { + "description": "Metadata Entry spec for container images.", + "type": "object", + "properties": { + "packaging": { + "description": "Type of asset", + "type": "string", + "enum": [ + "container-image" + ] + }, + "imageNameParameter": { + "description": "ECR Repository name and repo digest (separated by \"@sha256:\") where this\nimage is stored. (Default undefined If not specified, `repositoryName` and `imageTag` are\nrequired because otherwise how will the stack know where to find the asset,\nha?)", + "type": "string" + }, + "repositoryName": { + "description": "ECR repository name, if omitted a default name based on the asset's ID is\nused instead. Specify this property if you need to statically address the\nimage, e.g. from a Kubernetes Pod. Note, this is only the repository name,\nwithout the registry and the tag parts. (Default - this parameter is REQUIRED after 1.21.0)", + "type": "string" + }, + "imageTag": { + "description": "The docker image tag to use for tagging pushed images. This field is\nrequired if `imageParameterName` is ommited (otherwise, the app won't be\nable to find the image). (Default - this parameter is REQUIRED after 1.21.0)", + "type": "string" + }, + "buildArgs": { + "description": "Build args to pass to the `docker build` command (Default no build args are passed)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "buildSecrets": { + "description": "Build secrets to pass to the `docker build` command (Default no build secrets are passed)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "target": { + "description": "Docker target to build to (Default no build target)", + "type": "string" + }, + "file": { + "description": "Path to the Dockerfile (relative to the directory). (Default - no file is passed)", + "type": "string" + }, + "networkMode": { + "description": "Networking mode for the RUN commands during build. (Default - no networking mode specified)", + "type": "string" + }, + "platform": { + "description": "Platform to build for. _Requires Docker Buildx_. (Default - current machine platform)", + "type": "string" + }, + "outputs": { + "description": "Outputs to pass to the `docker build` command. (Default - no outputs are passed to the build command (default outputs are used))", + "type": "array", + "items": { + "type": "string" + } + }, + "cacheFrom": { + "description": "Cache from options to pass to the `docker build` command. (Default - no cache from options are passed to the build command)", + "type": "array", + "items": { + "$ref": "#/definitions/ContainerImageAssetCacheOption" + } + }, + "cacheTo": { + "description": "Cache to options to pass to the `docker build` command. (Default - no cache to options are passed to the build command)", + "$ref": "#/definitions/ContainerImageAssetCacheOption" + }, + "id": { + "description": "Logical identifier for the asset", + "type": "string" + }, + "sourceHash": { + "description": "The hash of the asset source.", + "type": "string" + }, + "path": { + "description": "Path on disk to the asset", + "type": "string" + } + }, + "required": [ + "id", + "packaging", + "path", + "sourceHash" + ] + }, + "ContainerImageAssetCacheOption": { + "description": "Options for configuring the Docker cache backend", + "type": "object", + "properties": { + "type": { + "description": "The type of cache to use.\nRefer to https://docs.docker.com/build/cache/backends/ for full list of backends. (Default - unspecified)", + "type": "string" + }, + "params": { + "description": "Any parameters to pass into the docker cache backend configuration.\nRefer to https://docs.docker.com/build/cache/backends/ for cache backend configuration. (Default {} No options provided)", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "type" + ] + }, + "Tag": { + "description": "Metadata Entry spec for stack tag.", + "type": "object", + "properties": { + "key": { + "description": "Tag key.\n\n(In the actual file on disk this will be cased as \"Key\", and the structure is\npatched to match this structure upon loading:\nhttps://github.com/aws/aws-cdk/blob/4aadaa779b48f35838cccd4e25107b2338f05547/packages/%40aws-cdk/cloud-assembly-schema/lib/manifest.ts#L137)", + "type": "string" + }, + "value": { + "description": "Tag value.\n\n(In the actual file on disk this will be cased as \"Value\", and the structure is\npatched to match this structure upon loading:\nhttps://github.com/aws/aws-cdk/blob/4aadaa779b48f35838cccd4e25107b2338f05547/packages/%40aws-cdk/cloud-assembly-schema/lib/manifest.ts#L137)", + "type": "string" + } + }, + "required": [ + "key", + "value" + ] + }, + "AwsCloudFormationStackProperties": { + "description": "Artifact properties for CloudFormation stacks.", + "type": "object", + "properties": { + "templateFile": { + "description": "A file relative to the assembly root which contains the CloudFormation template for this stack.", + "type": "string" + }, + "parameters": { + "description": "Values for CloudFormation stack parameters that should be passed when the stack is deployed. (Default - No parameters)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "tags": { + "description": "Values for CloudFormation stack tags that should be passed when the stack is deployed. (Default - No tags)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "stackName": { + "description": "The name to use for the CloudFormation stack. (Default - name derived from artifact ID)", + "type": "string" + }, + "terminationProtection": { + "description": "Whether to enable termination protection for this stack.", + "default": false, + "type": "boolean" + }, + "assumeRoleArn": { + "description": "The role that needs to be assumed to deploy the stack (Default - No role is assumed (current credentials are used))", + "type": "string" + }, + "assumeRoleExternalId": { + "description": "External ID to use when assuming role for cloudformation deployments (Default - No external ID)", + "type": "string" + }, + "cloudFormationExecutionRoleArn": { + "description": "The role that is passed to CloudFormation to execute the change set (Default - No role is passed (currently assumed role/credentials are used))", + "type": "string" + }, + "lookupRole": { + "description": "The role to use to look up values from the target AWS account (Default - No role is assumed (current credentials are used))", + "$ref": "#/definitions/BootstrapRole" + }, + "stackTemplateAssetObjectUrl": { + "description": "If the stack template has already been included in the asset manifest, its asset URL (Default - Not uploaded yet, upload just before deploying)", + "type": "string" + }, + "requiresBootstrapStackVersion": { + "description": "Version of bootstrap stack required to deploy this stack (Default - No bootstrap stack required)", + "type": "number" + }, + "bootstrapStackVersionSsmParameter": { + "description": "SSM parameter where the bootstrap stack version number can be found\n\nOnly used if `requiresBootstrapStackVersion` is set.\n\n- If this value is not set, the bootstrap stack name must be known at\n deployment time so the stack version can be looked up from the stack\n outputs.\n- If this value is set, the bootstrap stack can have any name because\n we won't need to look it up. (Default - Bootstrap stack version number looked up)", + "type": "string" + }, + "validateOnSynth": { + "description": "Whether this stack should be validated by the CLI after synthesis (Default - false)", + "type": "boolean" + } + }, + "required": [ + "templateFile" + ] + }, + "BootstrapRole": { + "description": "Information needed to access an IAM role created\nas part of the bootstrap process", + "type": "object", + "properties": { + "arn": { + "description": "The ARN of the IAM role created as part of bootrapping\ne.g. lookupRoleArn", + "type": "string" + }, + "assumeRoleExternalId": { + "description": "External ID to use when assuming the bootstrap role (Default - No external ID)", + "type": "string" + }, + "requiresBootstrapStackVersion": { + "description": "Version of bootstrap stack required to use this role (Default - No bootstrap stack required)", + "type": "number" + }, + "bootstrapStackVersionSsmParameter": { + "description": "Name of SSM parameter with bootstrap stack version (Default - Discover SSM parameter by reading stack)", + "type": "string" + } + }, + "required": [ + "arn" + ] + }, + "AssetManifestProperties": { + "description": "Artifact properties for the Asset Manifest", + "type": "object", + "properties": { + "file": { + "description": "Filename of the asset manifest", + "type": "string" + }, + "requiresBootstrapStackVersion": { + "description": "Version of bootstrap stack required to deploy this stack (Default - Version 1 (basic modern bootstrap stack))", + "type": "number" + }, + "bootstrapStackVersionSsmParameter": { + "description": "SSM parameter where the bootstrap stack version number can be found\n\n- If this value is not set, the bootstrap stack name must be known at\n deployment time so the stack version can be looked up from the stack\n outputs.\n- If this value is set, the bootstrap stack can have any name because\n we won't need to look it up. (Default - Bootstrap stack version number looked up)", + "type": "string" + } + }, + "required": [ + "file" + ] + }, + "TreeArtifactProperties": { + "description": "Artifact properties for the Construct Tree Artifact", + "type": "object", + "properties": { + "file": { + "description": "Filename of the tree artifact", + "type": "string" + } + }, + "required": [ + "file" + ] + }, + "NestedCloudAssemblyProperties": { + "description": "Artifact properties for nested cloud assemblies", + "type": "object", + "properties": { + "directoryName": { + "description": "Relative path to the nested cloud assembly", + "type": "string" + }, + "displayName": { + "description": "Display name for the cloud assembly (Default - The artifact ID)", + "type": "string" + } + }, + "required": [ + "directoryName" + ] + }, + "MissingContext": { + "description": "Represents a missing piece of context.", + "type": "object", + "properties": { + "key": { + "description": "The missing context key.", + "type": "string" + }, + "provider": { + "$ref": "#/definitions/ContextProvider", + "description": "The provider from which we expect this context key to be obtained." + }, + "props": { + "$ref": "#/definitions/ContextQueryProperties", + "description": "A set of provider-specific options." + } + }, + "required": [ + "key", + "props", + "provider" + ] + }, + "ContextProvider": { + "description": "Identifier for the context provider", + "enum": [ + "ami", + "availability-zones", + "endpoint-service-availability-zones", + "hosted-zone", + "key-provider", + "load-balancer", + "load-balancer-listener", + "plugin", + "security-group", + "ssm", + "vpc-provider" + ], + "type": "string" + }, + "ContextQueryProperties": { + "anyOf": [ + { + "$ref": "#/definitions/AmiContextQuery" + }, + { + "$ref": "#/definitions/AvailabilityZonesContextQuery" + }, + { + "$ref": "#/definitions/HostedZoneContextQuery" + }, + { + "$ref": "#/definitions/SSMParameterContextQuery" + }, + { + "$ref": "#/definitions/VpcContextQuery" + }, + { + "$ref": "#/definitions/EndpointServiceAvailabilityZonesContextQuery" + }, + { + "$ref": "#/definitions/LoadBalancerContextQuery" + }, + { + "$ref": "#/definitions/LoadBalancerListenerContextQuery" + }, + { + "$ref": "#/definitions/SecurityGroupContextQuery" + }, + { + "$ref": "#/definitions/KeyContextQuery" + }, + { + "$ref": "#/definitions/PluginContextQuery" + } + ] + }, + "AmiContextQuery": { + "description": "Query to AMI context provider", + "type": "object", + "properties": { + "account": { + "description": "Account to query", + "type": "string" + }, + "region": { + "description": "Region to query", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "owners": { + "description": "Owners to DescribeImages call (Default - All owners)", + "type": "array", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Filters to DescribeImages call", + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "required": [ + "account", + "filters", + "region" + ] + }, + "AvailabilityZonesContextQuery": { + "description": "Query to availability zone context provider", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + } + }, + "required": [ + "account", + "region" + ] + }, + "HostedZoneContextQuery": { + "description": "Query to hosted zone context provider", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "domainName": { + "description": "The domain name e.g. example.com to lookup", + "type": "string" + }, + "privateZone": { + "description": "True if the zone you want to find is a private hosted zone", + "default": false, + "type": "boolean" + }, + "vpcId": { + "description": "The VPC ID to that the private zone must be associated with\n\nIf you provide VPC ID and privateZone is false, this will return no results\nand raise an error. (Default - Required if privateZone=true)", + "type": "string" + } + }, + "required": [ + "account", + "domainName", + "region" + ] + }, + "SSMParameterContextQuery": { + "description": "Query to SSM Parameter Context Provider", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "parameterName": { + "description": "Parameter name to query", + "type": "string" + } + }, + "required": [ + "account", + "parameterName", + "region" + ] + }, + "VpcContextQuery": { + "description": "Query input for looking up a VPC", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "filter": { + "description": "Filters to apply to the VPC\n\nFilter parameters are the same as passed to DescribeVpcs.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "returnAsymmetricSubnets": { + "description": "Whether to populate the subnetGroups field of the `VpcContextResponse`,\nwhich contains potentially asymmetric subnet groups.", + "default": false, + "type": "boolean" + }, + "subnetGroupNameTag": { + "description": "Optional tag for subnet group name.\nIf not provided, we'll look at the aws-cdk:subnet-name tag.\nIf the subnet does not have the specified tag,\nwe'll use its type as the name. (Default 'aws-cdk:subnet-name')", + "type": "string" + }, + "returnVpnGateways": { + "description": "Whether to populate the `vpnGatewayId` field of the `VpcContextResponse`,\nwhich contains the VPN Gateway ID, if one exists. You can explicitly\ndisable this in order to avoid the lookup if you know the VPC does not have\na VPN Gatway attached. (Default true)", + "type": "boolean" + } + }, + "required": [ + "account", + "filter", + "region" + ] + }, + "EndpointServiceAvailabilityZonesContextQuery": { + "description": "Query to endpoint service context provider", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "serviceName": { + "description": "Query service name", + "type": "string" + } + }, + "required": [ + "account", + "region", + "serviceName" + ] + }, + "LoadBalancerContextQuery": { + "description": "Query input for looking up a load balancer", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "loadBalancerType": { + "$ref": "#/definitions/LoadBalancerType", + "description": "Filter load balancers by their type" + }, + "loadBalancerArn": { + "description": "Find by load balancer's ARN (Default - does not search by load balancer arn)", + "type": "string" + }, + "loadBalancerTags": { + "description": "Match load balancer tags (Default - does not match load balancers by tags)", + "type": "array", + "items": { + "$ref": "#/definitions/Tag" + } + } + }, + "required": [ + "account", + "loadBalancerType", + "region" + ] + }, + "LoadBalancerType": { + "description": "Type of load balancer", + "enum": [ + "application", + "network" + ], + "type": "string" + }, + "LoadBalancerListenerContextQuery": { + "description": "Query input for looking up a load balancer listener", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "listenerArn": { + "description": "Find by listener's arn (Default - does not find by listener arn)", + "type": "string" + }, + "listenerProtocol": { + "description": "Filter by listener protocol (Default - does not filter by listener protocol)", + "enum": [ + "HTTP", + "HTTPS", + "TCP", + "TCP_UDP", + "TLS", + "UDP" + ], + "type": "string" + }, + "listenerPort": { + "description": "Filter listeners by listener port (Default - does not filter by a listener port)", + "type": "number" + }, + "loadBalancerType": { + "$ref": "#/definitions/LoadBalancerType", + "description": "Filter load balancers by their type" + }, + "loadBalancerArn": { + "description": "Find by load balancer's ARN (Default - does not search by load balancer arn)", + "type": "string" + }, + "loadBalancerTags": { + "description": "Match load balancer tags (Default - does not match load balancers by tags)", + "type": "array", + "items": { + "$ref": "#/definitions/Tag" + } + } + }, + "required": [ + "account", + "loadBalancerType", + "region" + ] + }, + "SecurityGroupContextQuery": { + "description": "Query input for looking up a security group", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "securityGroupId": { + "description": "Security group id (Default - None)", + "type": "string" + }, + "securityGroupName": { + "description": "Security group name (Default - None)", + "type": "string" + }, + "vpcId": { + "description": "VPC ID (Default - None)", + "type": "string" + } + }, + "required": [ + "account", + "region" + ] + }, + "KeyContextQuery": { + "description": "Query input for looking up a KMS Key", + "type": "object", + "properties": { + "account": { + "description": "Query account", + "type": "string" + }, + "region": { + "description": "Query region", + "type": "string" + }, + "lookupRoleArn": { + "description": "The ARN of the role that should be used to look up the missing values (Default - None)", + "type": "string" + }, + "aliasName": { + "description": "Alias name used to search the Key", + "type": "string" + } + }, + "required": [ + "account", + "aliasName", + "region" + ] + }, + "PluginContextQuery": { + "description": "Query input for plugins\n\nThis alternate branch is necessary because it needs to be able to escape all type checking\nwe do on on the cloud assembly -- we cannot know the properties that will be used a priori.", + "type": "object", + "additionalProperties": {}, + "properties": { + "pluginName": { + "description": "The name of the plugin", + "type": "string" + } + }, + "required": [ + "pluginName" + ] + }, + "RuntimeInfo": { + "description": "Information about the application's runtime components.", + "type": "object", + "properties": { + "libraries": { + "description": "The list of libraries loaded in the application, associated with their versions.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "libraries" + ] + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/schema/cloud-assembly.version.json b/packages/aws-cdk-lib/cloud-assembly-schema/schema/cloud-assembly.version.json new file mode 100644 index 0000000000000..0d5aff521d3a2 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/schema/cloud-assembly.version.json @@ -0,0 +1 @@ +{"version":"31.0.0"} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/schema/integ.schema.json b/packages/aws-cdk-lib/cloud-assembly-schema/schema/integ.schema.json new file mode 100644 index 0000000000000..a098e4d72a134 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/schema/integ.schema.json @@ -0,0 +1,489 @@ +{ + "$ref": "#/definitions/IntegManifest", + "definitions": { + "IntegManifest": { + "description": "Definitions for the integration testing manifest", + "type": "object", + "properties": { + "version": { + "description": "Version of the manifest", + "type": "string" + }, + "enableLookups": { + "description": "Enable lookups for this test. If lookups are enabled\nthen `stackUpdateWorkflow` must be set to false.\nLookups should only be enabled when you are explicitely testing\nlookups.", + "default": false, + "type": "boolean" + }, + "synthContext": { + "description": "Additional context to use when performing\na synth. Any context provided here will override\nany default context (Default - no additional context)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "testCases": { + "description": "test cases", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/TestCase" + } + } + }, + "required": [ + "testCases", + "version" + ] + }, + "TestCase": { + "description": "Represents an integration test case", + "type": "object", + "properties": { + "stacks": { + "description": "Stacks that should be tested as part of this test case\nThe stackNames will be passed as args to the cdk commands\nso dependent stacks will be automatically deployed unless\n`exclusively` is passed", + "type": "array", + "items": { + "type": "string" + } + }, + "assertionStack": { + "description": "The node id of the stack that contains assertions.\nThis is the value that can be used to deploy the stack with the CDK CLI (Default - no assertion stack)", + "type": "string" + }, + "assertionStackName": { + "description": "The name of the stack that contains assertions (Default - no assertion stack)", + "type": "string" + }, + "stackUpdateWorkflow": { + "description": "Run update workflow on this test case\nThis should only be set to false to test scenarios\nthat are not possible to test as part of the update workflow (Default true)", + "type": "boolean" + }, + "cdkCommandOptions": { + "description": "Additional options to use for each CDK command (Default - runner default options)", + "$ref": "#/definitions/CdkCommands" + }, + "hooks": { + "description": "Additional commands to run at predefined points in the test workflow\n\ne.g. { postDeploy: ['yarn', 'test'] } (Default - no hooks)", + "$ref": "#/definitions/Hooks" + }, + "diffAssets": { + "description": "Whether or not to include asset hashes in the diff\nAsset hashes can introduces a lot of unneccessary noise into tests,\nbut there are some cases where asset hashes _should_ be included. For example\nany tests involving custom resources or bundling", + "default": false, + "type": "boolean" + }, + "allowDestroy": { + "description": "List of CloudFormation resource types in this stack that can\nbe destroyed as part of an update without failing the test.\n\nThis list should only include resources that for this specific\nintegration test we are sure will not cause errors or an outage if\ndestroyed. For example, maybe we know that a new resource will be created\nfirst before the old resource is destroyed which prevents any outage.\n\ne.g. ['AWS::IAM::Role'] (Default - do not allow destruction of any resources on update)", + "type": "array", + "items": { + "type": "string" + } + }, + "regions": { + "description": "Limit deployment to these regions (Default - can run in any region)", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "stacks" + ] + }, + "CdkCommands": { + "description": "Options for specific cdk commands that are run\nas part of the integration test workflow", + "type": "object", + "properties": { + "deploy": { + "description": "Options to for the cdk deploy command (Default - default deploy options)", + "$ref": "#/definitions/DeployCommand" + }, + "destroy": { + "description": "Options to for the cdk destroy command (Default - default destroy options)", + "$ref": "#/definitions/DestroyCommand" + } + } + }, + "DeployCommand": { + "description": "Represents a cdk deploy command", + "type": "object", + "properties": { + "args": { + "description": "Additional arguments to pass to the command\nThis can be used to test specific CLI functionality (Default - only default args are used)", + "$ref": "#/definitions/DeployOptions" + }, + "enabled": { + "description": "Whether or not to run this command as part of the workflow\nThis can be used if you only want to test some of the workflow\nfor example enable `synth` and disable `deploy` & `destroy` in order\nto limit the test to synthesis (Default true)", + "type": "boolean" + }, + "expectError": { + "description": "If the runner should expect this command to fail", + "default": false, + "type": "boolean" + }, + "expectedMessage": { + "description": "This can be used in combination with `expectedError`\nto validate that a specific message is returned. (Default - do not validate message)", + "type": "string" + } + } + }, + "DeployOptions": { + "description": "Options to use with cdk deploy", + "type": "object", + "properties": { + "exclusively": { + "description": "Only perform action on the given stack", + "default": false, + "type": "boolean" + }, + "toolkitStackName": { + "description": "Name of the toolkit stack to use/deploy (Default CDKToolkit)", + "type": "string" + }, + "reuseAssets": { + "description": "Reuse the assets with the given asset IDs (Default - do not reuse assets)", + "type": "array", + "items": { + "type": "string" + } + }, + "changeSetName": { + "description": "Optional name to use for the CloudFormation change set.\nIf not provided, a name will be generated automatically. (Default - auto generate a name)", + "type": "string" + }, + "force": { + "description": "Always deploy, even if templates are identical.", + "default": false, + "type": "boolean" + }, + "rollback": { + "description": "Rollback failed deployments (Default true)", + "type": "boolean" + }, + "notificationArns": { + "description": "ARNs of SNS topics that CloudFormation will notify with stack related events (Default - no notifications)", + "type": "array", + "items": { + "type": "string" + } + }, + "requireApproval": { + "description": "What kind of security changes require approval (Default RequireApproval.Never)", + "enum": [ + "any-change", + "broadening", + "never" + ], + "type": "string" + }, + "execute": { + "description": "Whether to execute the ChangeSet\nNot providing `execute` parameter will result in execution of ChangeSet (Default true)", + "type": "boolean" + }, + "parameters": { + "description": "Additional parameters for CloudFormation at deploy time (Default [object Object])", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "usePreviousParameters": { + "description": "Use previous values for unspecified parameters\n\nIf not set, all parameters must be specified for every deployment. (Default true)", + "type": "boolean" + }, + "outputsFile": { + "description": "Path to file where stack outputs will be written after a successful deploy as JSON (Default - Outputs are not written to any file)", + "type": "string" + }, + "ci": { + "description": "Whether we are on a CI system", + "default": false, + "type": "boolean" + }, + "stacks": { + "description": "List of stacks to deploy\n\nRequried if `all` is not set (Default - [])", + "type": "array", + "items": { + "type": "string" + } + }, + "all": { + "description": "Deploy all stacks\n\nRequried if `stacks` is not set (Default - false)", + "type": "boolean" + }, + "app": { + "description": "command-line for executing your app or a cloud assembly directory\ne.g. \"node bin/my-app.js\"\nor\n\"cdk.out\" (Default - read from cdk.json)", + "type": "string" + }, + "roleArn": { + "description": "Role to pass to CloudFormation for deployment (Default - use the bootstrap cfn-exec role)", + "type": "string" + }, + "context": { + "description": "Additional context (Default - no additional context)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "trace": { + "description": "Print trace for stack warnings", + "default": false, + "type": "boolean" + }, + "strict": { + "description": "Do not construct stacks with warnings", + "default": false, + "type": "boolean" + }, + "lookups": { + "description": "Perform context lookups.\n\nSynthesis fails if this is disabled and context lookups need\nto be performed (Default true)", + "type": "boolean" + }, + "ignoreErrors": { + "description": "Ignores synthesis errors, which will likely produce an invalid output", + "default": false, + "type": "boolean" + }, + "json": { + "description": "Use JSON output instead of YAML when templates are printed\nto STDOUT", + "default": false, + "type": "boolean" + }, + "verbose": { + "description": "show debug logs", + "default": false, + "type": "boolean" + }, + "debug": { + "description": "enable emission of additional debugging information, such as creation stack\ntraces of tokens", + "default": false, + "type": "boolean" + }, + "profile": { + "description": "Use the indicated AWS profile as the default environment (Default - no profile is used)", + "type": "string" + }, + "proxy": { + "description": "Use the indicated proxy. Will read from\nHTTPS_PROXY environment if specified (Default - no proxy)", + "type": "string" + }, + "caBundlePath": { + "description": "Path to CA certificate to use when validating HTTPS\nrequests. (Default - read from AWS_CA_BUNDLE environment variable)", + "type": "string" + }, + "ec2Creds": { + "description": "Force trying to fetch EC2 instance credentials (Default - guess EC2 instance status)", + "type": "boolean" + }, + "versionReporting": { + "description": "Include \"AWS::CDK::Metadata\" resource in synthesized templates (Default true)", + "type": "boolean" + }, + "pathMetadata": { + "description": "Include \"aws:cdk:path\" CloudFormation metadata for each resource (Default true)", + "type": "boolean" + }, + "assetMetadata": { + "description": "Include \"aws:asset:*\" CloudFormation metadata for resources that use assets (Default true)", + "type": "boolean" + }, + "staging": { + "description": "Copy assets to the output directory\n\nNeeded for local debugging the source files with SAM CLI", + "default": false, + "type": "boolean" + }, + "output": { + "description": "Emits the synthesized cloud assembly into a directory (Default cdk.out)", + "type": "string" + }, + "notices": { + "description": "Show relevant notices (Default true)", + "type": "boolean" + }, + "color": { + "description": "Show colors and other style from console output (Default true)", + "type": "boolean" + } + } + }, + "DestroyCommand": { + "description": "Represents a cdk destroy command", + "type": "object", + "properties": { + "args": { + "description": "Additional arguments to pass to the command\nThis can be used to test specific CLI functionality (Default - only default args are used)", + "$ref": "#/definitions/DestroyOptions" + }, + "enabled": { + "description": "Whether or not to run this command as part of the workflow\nThis can be used if you only want to test some of the workflow\nfor example enable `synth` and disable `deploy` & `destroy` in order\nto limit the test to synthesis (Default true)", + "type": "boolean" + }, + "expectError": { + "description": "If the runner should expect this command to fail", + "default": false, + "type": "boolean" + }, + "expectedMessage": { + "description": "This can be used in combination with `expectedError`\nto validate that a specific message is returned. (Default - do not validate message)", + "type": "string" + } + } + }, + "DestroyOptions": { + "description": "Options to use with cdk destroy", + "type": "object", + "properties": { + "force": { + "description": "Do not ask for permission before destroying stacks", + "default": false, + "type": "boolean" + }, + "exclusively": { + "description": "Only destroy the given stack", + "default": false, + "type": "boolean" + }, + "stacks": { + "description": "List of stacks to deploy\n\nRequried if `all` is not set (Default - [])", + "type": "array", + "items": { + "type": "string" + } + }, + "all": { + "description": "Deploy all stacks\n\nRequried if `stacks` is not set (Default - false)", + "type": "boolean" + }, + "app": { + "description": "command-line for executing your app or a cloud assembly directory\ne.g. \"node bin/my-app.js\"\nor\n\"cdk.out\" (Default - read from cdk.json)", + "type": "string" + }, + "roleArn": { + "description": "Role to pass to CloudFormation for deployment (Default - use the bootstrap cfn-exec role)", + "type": "string" + }, + "context": { + "description": "Additional context (Default - no additional context)", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "trace": { + "description": "Print trace for stack warnings", + "default": false, + "type": "boolean" + }, + "strict": { + "description": "Do not construct stacks with warnings", + "default": false, + "type": "boolean" + }, + "lookups": { + "description": "Perform context lookups.\n\nSynthesis fails if this is disabled and context lookups need\nto be performed (Default true)", + "type": "boolean" + }, + "ignoreErrors": { + "description": "Ignores synthesis errors, which will likely produce an invalid output", + "default": false, + "type": "boolean" + }, + "json": { + "description": "Use JSON output instead of YAML when templates are printed\nto STDOUT", + "default": false, + "type": "boolean" + }, + "verbose": { + "description": "show debug logs", + "default": false, + "type": "boolean" + }, + "debug": { + "description": "enable emission of additional debugging information, such as creation stack\ntraces of tokens", + "default": false, + "type": "boolean" + }, + "profile": { + "description": "Use the indicated AWS profile as the default environment (Default - no profile is used)", + "type": "string" + }, + "proxy": { + "description": "Use the indicated proxy. Will read from\nHTTPS_PROXY environment if specified (Default - no proxy)", + "type": "string" + }, + "caBundlePath": { + "description": "Path to CA certificate to use when validating HTTPS\nrequests. (Default - read from AWS_CA_BUNDLE environment variable)", + "type": "string" + }, + "ec2Creds": { + "description": "Force trying to fetch EC2 instance credentials (Default - guess EC2 instance status)", + "type": "boolean" + }, + "versionReporting": { + "description": "Include \"AWS::CDK::Metadata\" resource in synthesized templates (Default true)", + "type": "boolean" + }, + "pathMetadata": { + "description": "Include \"aws:cdk:path\" CloudFormation metadata for each resource (Default true)", + "type": "boolean" + }, + "assetMetadata": { + "description": "Include \"aws:asset:*\" CloudFormation metadata for resources that use assets (Default true)", + "type": "boolean" + }, + "staging": { + "description": "Copy assets to the output directory\n\nNeeded for local debugging the source files with SAM CLI", + "default": false, + "type": "boolean" + }, + "output": { + "description": "Emits the synthesized cloud assembly into a directory (Default cdk.out)", + "type": "string" + }, + "notices": { + "description": "Show relevant notices (Default true)", + "type": "boolean" + }, + "color": { + "description": "Show colors and other style from console output (Default true)", + "type": "boolean" + } + } + }, + "Hooks": { + "description": "Commands to run at predefined points during the\nintegration test workflow", + "type": "object", + "properties": { + "preDeploy": { + "description": "Commands to run prior to deploying the cdk stacks\nin the integration test (Default - no commands)", + "type": "array", + "items": { + "type": "string" + } + }, + "postDeploy": { + "description": "Commands to run prior after deploying the cdk stacks\nin the integration test (Default - no commands)", + "type": "array", + "items": { + "type": "string" + } + }, + "preDestroy": { + "description": "Commands to run prior to destroying the cdk stacks\nin the integration test (Default - no commands)", + "type": "array", + "items": { + "type": "string" + } + }, + "postDestroy": { + "description": "Commands to run after destroying the cdk stacks\nin the integration test (Default - no commands)", + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "$schema": "http://json-schema.org/draft-07/schema#" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/scripts/update-schema.sh b/packages/aws-cdk-lib/cloud-assembly-schema/scripts/update-schema.sh new file mode 100755 index 0000000000000..fa6322b9c29d3 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/scripts/update-schema.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -euo pipefail +scriptsdir=$(cd $(dirname $0) && pwd) +packagedir=$(cd ${scriptsdir}/.. && pwd) + +# Output +OUTPUT_DIR="${packagedir}/schema" +mkdir -p ${OUTPUT_DIR} + +# regenerate JSON schema and bumps the version +node -e "require('${packagedir}/scripts/update-schema.js').update()" diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/scripts/update-schema.ts b/packages/aws-cdk-lib/cloud-assembly-schema/scripts/update-schema.ts new file mode 100644 index 0000000000000..13a410cd4a36f --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/scripts/update-schema.ts @@ -0,0 +1,129 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as semver from 'semver'; +// eslint-disable-next-line import/no-extraneous-dependencies +import * as tjs from 'typescript-json-schema'; + +function log(message: string) { + // eslint-disable-next-line no-console + console.log(message); +} + +/** + * Where schemas are committed. + */ +const SCHEMA_DIR = path.resolve(__dirname, '../schema'); + +const SCHEMA_DEFINITIONS: { [schemaName: string]: { rootTypeName: string } } = { + 'assets': { rootTypeName: 'AssetManifest' }, + 'cloud-assembly': { rootTypeName: 'AssemblyManifest' }, + 'integ': { rootTypeName: 'IntegManifest' }, +}; + +export const SCHEMAS = Object.keys(SCHEMA_DEFINITIONS); + +export function update() { + for (const s of SCHEMAS) { + generateSchema(s); + } + + bump(); +} + +export function bump() { + const versionFile = path.join(SCHEMA_DIR, 'cloud-assembly.version.json'); + + // eslint-disable-next-line @typescript-eslint/no-require-imports + const metadata = require(versionFile); + + const oldVersion = metadata.version; + const newVersion = semver.inc(oldVersion, 'major'); + + log(`Updating schema version: ${oldVersion} -> ${newVersion}`); + fs.writeFileSync(versionFile, JSON.stringify({ version: newVersion })); +} + +/** + * Generates a schema from typescript types. + * @returns JSON schema + * @param schemaName the schema to generate + * @param shouldBump writes a new version of the schema and bumps the major version + */ +export function generateSchema(schemaName: string, saveToFile: boolean = true) { + const spec = SCHEMA_DEFINITIONS[schemaName]; + const out = saveToFile ? path.join(SCHEMA_DIR, `${schemaName}.schema.json`) : ''; + + const settings: Partial = { + required: true, + ref: true, + topRef: true, + noExtraProps: false, + out, + }; + + const compilerOptions = { + strictNullChecks: true, + }; + + const program = tjs.getProgramFromFiles([path.join(__dirname, '../lib/index.d.ts')], compilerOptions); + const schema = tjs.generateSchema(program, spec.rootTypeName, settings); + + augmentDescription(schema); + addAnyMetadataEntry(schema); + + if (out) { + log(`Generating schema to ${out}`); + fs.writeFileSync(out, JSON.stringify(schema, null, 4)); + } + + return schema; +} + +/** + * Remove 'default' from the schema since its generated + * from the tsdocs, which are not necessarily actual values, + * but rather descriptive behavior. + * + * To keep this inforamtion in the schema, we append it to the + * 'description' of the property. + */ +function augmentDescription(schema: any) { + + function _recurse(o: any) { + for (const prop in o) { + + if (prop === 'description' && typeof o[prop] === 'string') { + + const description = o[prop]; + const defaultValue = o.default; + + if (!defaultValue) { + // property doesn't have a default value + // skip + continue; + } + + const descriptionWithDefault = `${description} (Default ${defaultValue})`; + + delete o.default; + o[prop] = descriptionWithDefault; + + } else if (typeof o[prop] === 'object') { + _recurse(o[prop]); + } + } + } + + _recurse(schema); + +} + +/** + * Patch the properties of MetadataEntry to allow + * specifying any free form data. This is needed since source + * code doesn't allow this in order to enforce stricter jsii + * compatibility checks. + */ +function addAnyMetadataEntry(schema: any) { + schema.definitions.MetadataEntry?.properties.data.anyOf.push({ description: 'Free form data.' }); +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/__snapshots__/manifest.test.js.snap b/packages/aws-cdk-lib/cloud-assembly-schema/test/__snapshots__/manifest.test.js.snap new file mode 100644 index 0000000000000..58289c740c914 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/__snapshots__/manifest.test.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`manifest load 1`] = ` +Object { + "version": "0.0.0", +} +`; diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/assets.test.ts b/packages/aws-cdk-lib/cloud-assembly-schema/test/assets.test.ts new file mode 100644 index 0000000000000..24ddd465484b7 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/assets.test.ts @@ -0,0 +1,194 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { FileAssetPackaging, Manifest } from '../lib'; + +describe('Docker image asset', () => { + test('valid input', () => { + expect(() => { + validate({ + version: Manifest.version(), + dockerImages: { + asset: { + source: { + directory: '.', + }, + destinations: { + dest: { + region: 'us-north-20', + repositoryName: 'REPO', + imageTag: 'TAG', + }, + }, + }, + externalAsset: { + source: { + executable: ['sometool'], + }, + destinations: { + dest: { + region: 'us-north-20', + repositoryName: 'REPO', + imageTag: 'TAG', + }, + }, + }, + }, + }); + }).not.toThrow(); + }); + + test('invalid input', () => { + expect(() => { + validate({ + version: Manifest.version(), + dockerImages: { + asset: { + source: { + directory: true, + }, + destinations: {}, + }, + externalAsset: { + source: {}, + destinations: {}, + }, + }, + }); + }).toThrow(/instance\.dockerImages\.asset\.source\.directory is not of a type\(s\) string/); + }); +}); + +describe('File asset', () => { + describe('valid input', () => { + test('without packaging', () => { + expect(() => { + validate({ + version: Manifest.version(), + files: { + asset: { + source: { + path: 'a/b/c', + }, + destinations: { + dest: { + region: 'us-north-20', + bucketName: 'Bouquet', + objectKey: 'key', + }, + }, + }, + externalAsset: { + source: { + executable: ['sometool'], + }, + destinations: { + dest: { + region: 'us-north-20', + bucketName: 'Bouquet', + objectKey: 'key', + }, + }, + }, + }, + }); + }).not.toThrow(); + }); + + for (const packaging of Object.values(FileAssetPackaging)) { + test(`with "${packaging}" packaging`, () => { + expect(() => { + validate({ + version: Manifest.version(), + files: { + asset: { + source: { + path: 'a/b/c', + packaging, + }, + destinations: { + dest: { + region: 'us-north-20', + bucketName: 'Bouquet', + objectKey: 'key', + }, + }, + }, + }, + }); + }).not.toThrow(); + }); + } + }); + + describe('invalid input', () => { + test('bad "source.path" property', () => { + expect(() => { + validate({ + version: Manifest.version(), + files: { + asset: { + source: { + path: 3, + }, + destinations: { + dest: { + region: 'us-north-20', + bucketName: 'Bouquet', + objectKey: 'key', + }, + }, + }, + externalAsset: { + source: { + executable: ['sometool'], + }, + destinations: { + dest: { + region: 'us-north-20', + bucketName: 'Bouquet', + objectKey: 'key', + }, + }, + }, + }, + }); + }).toThrow(/instance\.files\.asset\.source\.path is not of a type\(s\) string/); + }); + + test('bad "source.packaging" property', () => { + expect(() => { + validate({ + version: Manifest.version(), + files: { + asset: { + source: { + path: 'a/b/c', + packaging: 'BLACK_HOLE', + }, + destinations: { + dest: { + region: 'us-north-20', + bucketName: 'Bouquet', + objectKey: 'key', + }, + }, + }, + }, + }); + }).toThrow(/instance\.files\.asset\.source\.packaging is not one of enum values: file,zip/); + }); + }); +}); + +function validate(manifest: any) { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'assets.test.')); + const filePath = path.join(dir, 'manifest.json'); + fs.writeFileSync(filePath, JSON.stringify(manifest, undefined, 2)); + try { + Manifest.loadAssetManifest(filePath); + } finally { + fs.unlinkSync(filePath); + fs.rmdirSync(dir); + } +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/high-version/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/high-version/manifest.json new file mode 100644 index 0000000000000..ef6fc1c901429 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/high-version/manifest.json @@ -0,0 +1,3 @@ +{ + "version": "99.99.99" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-artifact-type/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-artifact-type/manifest.json new file mode 100644 index 0000000000000..ea1558cb1e6f9 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-artifact-type/manifest.json @@ -0,0 +1,9 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyArt": { + "type": "who:am:i", + "environment": "aws://37736633/us-region-1" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-nested-property/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-nested-property/manifest.json new file mode 100644 index 0000000000000..da1a33b17936e --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-nested-property/manifest.json @@ -0,0 +1,6 @@ +{ + "version": "0.0.0", + "runtime": { + "libraries": ["should", "be", "a", "map"] + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-version/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-version/manifest.json new file mode 100644 index 0000000000000..36b2250cf8d33 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/invalid-version/manifest.json @@ -0,0 +1,3 @@ +{ + "version": "version" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/only-version/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/only-version/manifest.json new file mode 100644 index 0000000000000..c158d5be87422 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/only-version/manifest.json @@ -0,0 +1,3 @@ +{ + "version": "0.0.0" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/random-metadata/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/random-metadata/manifest.json new file mode 100644 index 0000000000000..cd2209c526595 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/random-metadata/manifest.json @@ -0,0 +1,35 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "stack": { + "type": "aws:cloudformation:stack", + "metadata": { + "AwsCdkPlaygroundBatch": [ + { + "type": "random-array", + "data": ["42"], + "trace": ["trace"] + }, + { + "type": "random-number", + "data": 42, + "trace": ["trace"] + }, + { + "type": "random-map", + "data": { + "key": "value" + }, + "trace": ["trace"] + } + ] + } + } + } + } \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/unknown-property/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/unknown-property/manifest.json new file mode 100644 index 0000000000000..d1f0bca305c81 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/unknown-property/manifest.json @@ -0,0 +1,4 @@ +{ + "version": "0.0.0", + "who-am-i": "unknown" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/with-stack-tags/manifest.json b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/with-stack-tags/manifest.json new file mode 100644 index 0000000000000..4d18eed47c8a0 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/fixtures/with-stack-tags/manifest.json @@ -0,0 +1,38 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "stack": { + "type": "aws:cloudformation:stack", + "metadata": { + "AwsCdkPlaygroundBatch": [ + { + "type": "aws:cdk:stack-tags", + "data": [{ + "Key": "hello", + "Value": "world" + }], + "trace": ["trace"] + }, + { + "type": "aws:cdk:asset", + "data": { + "repositoryName": "repo", + "imageTag": "tag", + "id": "id", + "packaging": "container-image", + "path": "path", + "sourceHash": "hash" + }, + "trace": ["trace"] + } + ] + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/integ-tests.test.ts b/packages/aws-cdk-lib/cloud-assembly-schema/test/integ-tests.test.ts new file mode 100644 index 0000000000000..3baefc89d750f --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/integ-tests.test.ts @@ -0,0 +1,137 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { Manifest } from '../lib'; + +describe('Integration test', () => { + test('valid input', () => { + expect(() => { + validate({ + version: Manifest.version(), + testCases: { + testCase1: { + stacks: ['stack1', 'stack2'], + stackUpdateWorkflow: true, + cdkCommandOptions: { + deploy: { + enabled: true, + expectError: false, + expectedMessage: 'some message', + args: { + exclusively: true, + toolkitStackName: 'Stack', + reuseAssets: ['asset1', 'asset2'], + changeSetName: 'changeset', + force: true, + rollback: false, + notificationArns: ['arn1', 'arn2'], + execute: true, + parameters: { + 'MYPARAM': 'Value', + 'Stack1:OtherParam': 'OtherValue', + }, + usePreviousParameters: true, + outputsFile: 'outputs.json', + ci: true, + requireApproval: 'never', + app: 'node bin/my-app.js', + roleArn: 'roleArn', + context: { + KEY: 'value', + }, + trace: true, + strict: true, + lookups: true, + ignoreErrors: true, + json: true, + verbose: true, + debug: true, + profile: 'profile', + proxy: 'https://proxy', + caBundlePath: 'path/to/bundle', + ec2Creds: true, + versionReporting: false, + pathMetadata: false, + assetMetadata: true, + staging: false, + output: true, + notices: true, + color: false, + }, + }, + synth: { + enabled: true, + expectError: false, + expectedMessage: 'some message', + args: { + quiet: true, + exclusively: true, + validation: true, + }, + }, + destroy: { + enabled: true, + expectError: false, + expectedMessage: 'some message', + args: { + force: true, + exclusively: true, + }, + }, + }, + hooks: { + preDeploy: ['yarn test'], + postDeploy: ['some other command'], + preDestroy: ['command1', 'command2'], + postDestroy: ['command3', 'command4'], + }, + diffAssets: true, + allowDestroy: ['AWS::IAM::Role'], + region: ['us-east-1', 'us-east-2'], + }, + }, + }); + }); + }); + + test('invalid input', () => { + expect(() => { + validate({ + version: Manifest.version(), + testCases: { + stacks: true, + }, + }); + }).toThrow(/instance\.testCases\.stacks is not of a type\(s\) object/); + }); + + test('without command options', () => { + expect(() => { + validate({ + version: Manifest.version(), + testCases: { + testCase1: { + stacks: ['stack1', 'stack2'], + stackUpdateWorkflow: true, + hooks: { + preDeploy: ['yarn test'], + }, + diffAssets: true, + }, + }, + }); + }); + }); +}); + +function validate(manifest: any) { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'integ.test.')); + const filePath = path.join(dir, 'manifest.json'); + fs.writeFileSync(filePath, JSON.stringify(manifest, undefined, 2)); + try { + Manifest.loadIntegManifest(filePath); + } finally { + fs.unlinkSync(filePath); + fs.rmdirSync(dir); + } +} diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/manifest.test.ts b/packages/aws-cdk-lib/cloud-assembly-schema/test/manifest.test.ts new file mode 100644 index 0000000000000..a8f1311a2dcc9 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/manifest.test.ts @@ -0,0 +1,162 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import * as semver from 'semver'; +import { AssemblyManifest, Manifest, StackTagsMetadataEntry } from '../lib'; + +const FIXTURES = path.join(__dirname, 'fixtures'); + +function fixture(name: string) { + return path.join(FIXTURES, name, 'manifest.json'); +} + +test('manifest save', () => { + + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'schema-tests')); + const manifestFile = path.join(outdir, 'manifest.json'); + + const assemblyManifest: AssemblyManifest = { + version: 'version', + runtime: { + libraries: { lib1: '1.2.3' }, + }, + }; + + Manifest.saveAssemblyManifest(assemblyManifest, manifestFile); + + const saved = JSON.parse(fs.readFileSync(manifestFile, { encoding: 'utf-8' })); + + expect(saved).toEqual({ + ...assemblyManifest, + version: Manifest.version(), // version is forced + }); +}); + +test('manifest load', () => { + const loaded = Manifest.loadAssemblyManifest(fixture('only-version')); + expect(loaded).toMatchSnapshot(); +}); + +test('manifest load fails for invalid nested property', () => { + expect(() => Manifest.loadAssemblyManifest(fixture('invalid-nested-property'))).toThrow(/Invalid assembly manifest/); +}); + +test('manifest load fails for invalid artifact type', () => { + expect(() => Manifest.loadAssemblyManifest(fixture('invalid-artifact-type'))).toThrow(/Invalid assembly manifest/); +}); + +test('manifest load fails on higher major version', () => { + expect(() => Manifest.loadAssemblyManifest(fixture('high-version'))).toThrow(/Cloud assembly schema version mismatch/); +}); + +// once we start introducing minor version bumps that are considered +// non breaking, this test can be removed. +test('manifest load fails on higher minor version', () => { + + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'schema-tests')); + const manifestFile = path.join(outdir, 'manifest.json'); + + const newVersion = semver.inc(Manifest.version(), 'minor'); + expect(newVersion).toBeTruthy(); + + if (newVersion) { + const assemblyManifest: AssemblyManifest = { + version: newVersion, + }; + + // can't use saveAssemblyManifest because it will force the correct version + fs.writeFileSync(manifestFile, JSON.stringify(assemblyManifest)); + + expect(() => Manifest.loadAssemblyManifest(manifestFile)).toThrow(/Cloud assembly schema version mismatch/); + } +}); + +test('manifest load doesnt fail if version checking is disabled, and unknown properties are added', () => { + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'schema-tests')); + const manifestFile = path.join(outdir, 'manifest.json'); + const newVersion = semver.inc(Manifest.version(), 'major'); + expect(newVersion).toBeTruthy(); + + const assemblyManifest: AssemblyManifest = { + version: newVersion!, + artifacts: { + SomeArtifact: { + type: 'aws:cloudformation:stack', + thisPropertyWillNeverBeInTheManifest: 'i_hope', + } as any, + UnknownArtifact: { + type: 'unknown-artifact-type', + } as any, + }, + }; + + // can't use saveAssemblyManifest because it will force the correct version + fs.writeFileSync(manifestFile, JSON.stringify(assemblyManifest)); + + Manifest.loadAssemblyManifest(manifestFile, { skipVersionCheck: true, skipEnumCheck: true }); +}); + +// once we start introducing patch version bumps that are considered +// non breaking, this test can be removed. +test('manifest load fails on higher patch version', () => { + + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'schema-tests')); + const manifestFile = path.join(outdir, 'manifest.json'); + + const newVersion = semver.inc(Manifest.version(), 'patch'); + expect(newVersion).toBeTruthy(); + + if (newVersion) { + const assemblyManifest: AssemblyManifest = { + version: newVersion, + }; + + // can't use saveAssemblyManifest because it will force the correct version + fs.writeFileSync(manifestFile, JSON.stringify(assemblyManifest)); + + expect(() => Manifest.loadAssemblyManifest(manifestFile)).toThrow(/Cloud assembly schema version mismatch/); + } +}); + +test('manifest load fails on invalid version', () => { + expect(() => Manifest.loadAssemblyManifest(fixture('invalid-version'))).toThrow(/Invalid semver string/); +}); + +test('manifest load succeeds on unknown properties', () => { + const manifest = Manifest.loadAssemblyManifest(fixture('unknown-property')); + expect(manifest.version).toEqual('0.0.0'); +}); + +test('stack-tags are deserialized properly', () => { + + const m: AssemblyManifest = Manifest.loadAssemblyManifest(fixture('with-stack-tags')); + + if (m.artifacts?.stack?.metadata?.AwsCdkPlaygroundBatch[0].data) { + const entry = m.artifacts.stack.metadata.AwsCdkPlaygroundBatch[0].data as StackTagsMetadataEntry; + expect(entry[0].key).toEqual('hello'); + expect(entry[0].value).toEqual('world'); + } + expect(m.version).toEqual('0.0.0'); + +}); + +test('can access random metadata', () => { + + const loaded = Manifest.loadAssemblyManifest(fixture('random-metadata')); + const randomArray = loaded.artifacts?.stack.metadata?.AwsCdkPlaygroundBatch[0].data; + const randomNumber = loaded.artifacts?.stack.metadata?.AwsCdkPlaygroundBatch[1].data; + const randomMap = loaded.artifacts?.stack.metadata?.AwsCdkPlaygroundBatch[2].data; + + expect(randomArray).toEqual(['42']); + expect(randomNumber).toEqual(42); + expect(randomMap).toEqual({ + key: 'value', + }); + + expect(randomMap).toBeTruthy(); + + if (randomMap) { + expect((randomMap as any).key).toEqual('value'); + } + +}); diff --git a/packages/aws-cdk-lib/cloud-assembly-schema/test/schema.test.ts b/packages/aws-cdk-lib/cloud-assembly-schema/test/schema.test.ts new file mode 100644 index 0000000000000..7b66dd89fc9d1 --- /dev/null +++ b/packages/aws-cdk-lib/cloud-assembly-schema/test/schema.test.ts @@ -0,0 +1,47 @@ +import { generateSchema, SCHEMAS } from '../scripts/update-schema'; + +test.skip('if this test fails, run "yarn update-schema"', () => { + + // when we compare schemas we ignore changes the + // description that is generated from the ts docstrings. + const docStringFields = [ + 'description', + ]; + + for (const schemaName of SCHEMAS) { + const expected = removeStringKeys(generateSchema(schemaName, false), docStringFields); + + // eslint-disable-next-line @typescript-eslint/no-require-imports + const actual = removeStringKeys(require(`../schema/${schemaName}.schema.json`), docStringFields); + + try { + expect(actual).toEqual(expected); + } catch (err: any) { + // I couldn't for the life of me figure out how to provide additional error message + // to jest...any ideas? + err.message = `Whoops, Looks like the schema has changed. Did you forget to run 'yarn update-schema'?\n\n${err.message}`; + throw err; + } + } + +}); + +function removeStringKeys(obj: any, keys: string[]) { + + function _recurse(o: any) { + for (const prop in o) { + if (keys.includes(prop) && typeof o[prop] === 'string') { + delete o[prop]; + } else if (typeof o[prop] === 'object') { + _recurse(o[prop]); + } + } + } + const cloned = clone(obj); + _recurse(cloned); + return cloned; +} + +function clone(obj: any) { + return JSON.parse(JSON.stringify(obj)); +} diff --git a/packages/aws-cdk-lib/cloudformation-include/.jsiirc.json b/packages/aws-cdk-lib/cloudformation-include/.jsiirc.json new file mode 100644 index 0000000000000..482c5cfc791a3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.cloudformation.include" + }, + "dotnet": { + "namespace": "Amazon.CDK.CloudFormation.Include" + }, + "python": { + "module": "aws_cdk.cloudformation_include" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/README.md b/packages/aws-cdk-lib/cloudformation-include/README.md new file mode 100644 index 0000000000000..754731d7c4439 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/README.md @@ -0,0 +1,468 @@ +# Include CloudFormation templates in the CDK + + + +This module contains a set of classes whose goal is to facilitate working +with existing CloudFormation templates in the CDK. +It can be thought of as an extension of the capabilities of the +[`CfnInclude` class](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.CfnInclude.html). + +## Basic usage + +Assume we have a file with an existing template. +It could be in JSON format, in a file `my-template.json`: + +```json +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": "some-bucket-name" + } + } + } +} +``` + +Or it could by in YAML format, in a file `my-template.yaml`: + +```yaml +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: some-bucket-name +``` + +It can be included in a CDK application with the following code: + +```ts +const cfnTemplate = new cfn_inc.CfnInclude(this, 'Template', { + templateFile: 'my-template.json', +}); +``` + +Or, if your template uses YAML: + +```ts +const cfnTemplate = new cfn_inc.CfnInclude(this, 'Template', { + templateFile: 'my-template.yaml', +}); +``` + +**Note**: different YAML parsers sometimes don't agree on what exactly constitutes valid YAML. +If you get a YAML exception when including your template, +try converting it to JSON, and including that file instead. +If you're downloading your template from the CloudFormation AWS Console, +you can easily get it in JSON format by clicking the 'View in Designer' +button on the 'Template' tab - +once in Designer, select JSON in the "Choose template language" +radio buttons on the bottom pane. + +This will add all resources from `my-template.json` / `my-template.yaml` into the CDK application, +preserving their original logical IDs from the template file. + +Any resource from the included template can be retrieved by referring to it by its logical ID from the template. +If you know the class of the CDK object that corresponds to that resource, +you can cast the returned object to the correct type: + +```ts +declare const cfnTemplate: cfn_inc.CfnInclude; +const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; +// cfnBucket is of type s3.CfnBucket +``` + +Note that any resources not present in the latest version of the CloudFormation schema +at the time of publishing the version of this module that you depend on, +including [Custom Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html), +will be returned as instances of the class `CfnResource`, +and so cannot be cast to a different resource type. + +Any modifications made to that resource will be reflected in the resulting CDK template; +for example, the name of the bucket can be changed: + +```ts +declare const cfnTemplate: cfn_inc.CfnInclude; +const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; +cfnBucket.bucketName = 'my-bucket-name'; +``` + +You can also refer to the resource when defining other constructs, +including the higher-level ones +(those whose name does not start with `Cfn`), +for example: + +```ts +declare const cfnTemplate: cfn_inc.CfnInclude; +const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; + +const role = new iam.Role(this, 'Role', { + assumedBy: new iam.AnyPrincipal(), +}); +role.addToPolicy(new iam.PolicyStatement({ + actions: ['s3:*'], + resources: [cfnBucket.attrArn], +})); +``` + +## Migrating templates that use Transforms + +You can use this module to migrate templates that use +[CloudFormation transforms](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-macros.html) - +including the [Serverless transform](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-aws-serverless.html). + +The CDK including process does not execute Transforms, +and the `cdk diff` command by default compares against the original +(meaning, unprocessed) template. +So, if you're downloading the template to include from the CloudFormation AWS Console, +make sure to download the unprocessed template +(the "View processed template" checkbox is left **unchecked**, which is the default): + +![unprocessed template in the CloudFormation AWS Console](doc-images/unprocessed-template.png) + +However, certain unprocessed templates can fail when used with the `CfnInclude` class. +The most common reason for the failure is that the unprocessed template can contain cycles between resources, +which get removed after the Transform is processed, +but is not allowed when being included (as pure CloudFormation does not permit cycles). To enable cycle processing behavior similar +to cloudformation, set `allowCyclicalReferences` of CfnIncludeProps to true. + + +When that happens, you should instead download the processed template from the CloudFormation AWS Console +(make sure the "View processed template" checkbox is **checked** in that case): + +![processed template in the CloudFormation AWS Console](doc-images/processed-template.png) + +When you include that processed template in your CDK application, +running `cdk diff` will now show a lot of differences with the deployed Stack, +because `cdk diff` uses the unprocessed template by default. +To alleviate that problem, you can pass the `--processed` switch to `cdk diff`, +which will make the diff command compare against the processed template of the deployed Stack, +which will give more precise results in this case. + +## Converting L1 resources to L2 + +The resources the `getResource` method returns are what the CDK calls +[Layer 1 resources](https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html#cfn_layer_cfn) +(like `CfnBucket`). +However, in many places in the Construct Library, +the CDK requires so-called Layer 2 resources, like `IBucket`. +There are two ways of going from an L1 to an L2 resource. + +### Using`fromCfn*()` methods + +This is the preferred method of converting an L1 resource to an L2. +It works by invoking a static method of the class of the L2 resource +whose name starts with `fromCfn` - +for example, for KMS Keys, that would be the `Kms.fromCfnKey()` method - +and passing the L1 instance as an argument: + +```ts +declare const cfnTemplate: cfn_inc.CfnInclude; +const cfnKey = cfnTemplate.getResource('Key') as kms.CfnKey; +const key = kms.Key.fromCfnKey(cfnKey); +``` + +This returns an instance of the `kms.IKey` type that can be passed anywhere in the CDK an `IKey` is expected. +What is more, that `IKey` instance will be mutable - +which means calling any mutating methods on it, +like `addToResourcePolicy()`, +will be reflected in the resulting template. + +Note that, in some cases, the `fromCfn*()` method might not be able to create an L2 from the underlying L1. +This can happen when the underlying L1 heavily uses CloudFormation functions. +For example, if you tried to create an L2 `IKey` +from an L1 represented as this CloudFormation template: + +```json +{ + "Resources": { + "Key": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Fn::If": [ + "Condition", + { + "Action": "kms:if-action", + "Resource": "*", + "Principal": "*", + "Effect": "Allow" + }, + { + "Action": "kms:else-action", + "Resource": "*", + "Principal": "*", + "Effect": "Allow" + } + ] + } + ], + "Version": "2012-10-17" + } + } + } + } +} +``` + +The `Key.fromCfnKey()` method does not know how to translate that into CDK L2 concepts, +and would throw an exception. + +In those cases, you need the use the second method of converting an L1 to an L2. + +### Using `from*Name/Arn/Attributes()` methods + +If the resource you need does not have a `fromCfn*()` method, +or if it does, but it throws an exception for your particular L1, +you need to use the second method of converting an L1 resource to L2. + +Each L2 class has static factory methods with names like `from*Name()`, +`from*Arn()`, and/or `from*Attributes()`. +You can obtain an L2 resource from an L1 by passing the correct properties of the L1 as the arguments to those methods: + +```ts +declare const cfnTemplate: cfn_inc.CfnInclude; + +// using from*Name() +const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket; +const bucket = s3.Bucket.fromBucketName(this, 'L2Bucket', cfnBucket.ref); + +// using from*Arn() +const cfnKey = cfnTemplate.getResource('Key') as kms.CfnKey; +const key = kms.Key.fromKeyArn(this, 'L2Key', cfnKey.attrArn); + +// using from*Attributes() +declare const privateCfnSubnet1: ec2.CfnSubnet; +declare const privateCfnSubnet2: ec2.CfnSubnet; +const cfnVpc = cfnTemplate.getResource('Vpc') as ec2.CfnVPC; +const vpc = ec2.Vpc.fromVpcAttributes(this, 'L2Vpc', { + vpcId: cfnVpc.ref, + availabilityZones: core.Fn.getAzs(), + privateSubnetIds: [privateCfnSubnet1.ref, privateCfnSubnet2.ref], +}); +``` + +As long as they just need to be referenced, +and not changed in any way, everything should work; +however, note that resources returned from those methods, +unlike those returned by `fromCfn*()` methods, +are immutable, which means calling any mutating methods on them will have no effect. +You will have to mutate the underlying L1 in order to change them. + +## Non-resource template elements + +In addition to resources, +you can also retrieve and mutate all other template elements: + +* [Parameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html): + + ```ts + declare const cfnTemplate: cfn_inc.CfnInclude; + const param: core.CfnParameter = cfnTemplate.getParameter('MyParameter'); + + // mutating the parameter + param.default = 'MyDefault'; + ``` + +* [Conditions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html): + + ```ts + declare const cfnTemplate: cfn_inc.CfnInclude; + const condition: core.CfnCondition = cfnTemplate.getCondition('MyCondition'); + + // mutating the condition + condition.expression = core.Fn.conditionEquals(1, 2); + ``` + +* [Mappings](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html): + + ```ts + declare const cfnTemplate: cfn_inc.CfnInclude; + const mapping: core.CfnMapping = cfnTemplate.getMapping('MyMapping'); + + // mutating the mapping + mapping.setValue('my-region', 'AMI', 'ami-04681a1dbd79675a5'); + ``` + +* [Service Catalog template Rules](https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html): + + ```ts + declare const cfnTemplate: cfn_inc.CfnInclude; + const rule: core.CfnRule = cfnTemplate.getRule('MyRule'); + + // mutating the rule + declare const myParameter: core.CfnParameter; + rule.addAssertion(core.Fn.conditionContains(['m1.small'], myParameter.valueAsString), + 'MyParameter has to be m1.small'); + ``` + +* [Outputs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html): + + ```ts + declare const cfnTemplate: cfn_inc.CfnInclude; + const output: core.CfnOutput = cfnTemplate.getOutput('MyOutput'); + + // mutating the output + declare const cfnBucket: s3.CfnBucket; + output.value = cfnBucket.attrArn; + ``` + +* [Hooks for blue-green deployments](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/blue-green.html): + + ```ts + declare const cfnTemplate: cfn_inc.CfnInclude; + const hook: core.CfnHook = cfnTemplate.getHook('MyOutput'); + + // mutating the hook + declare const myRole: iam.Role; + const codeDeployHook = hook as core.CfnCodeDeployBlueGreenHook; + codeDeployHook.serviceRole = myRole.roleArn; + ``` + +## Parameter replacement + +If your existing template uses CloudFormation Parameters, +you may want to remove them in favor of build-time values. +You can do that using the `parameters` property: + +```ts +new cfn_inc.CfnInclude(this, 'includeTemplate', { + templateFile: 'path/to/my/template', + parameters: { + 'MyParam': 'my-value', + }, +}); +``` + +This will replace all references to `MyParam` with the string `'my-value'`, +and `MyParam` will be removed from the 'Parameters' section of the resulting template. + +## Nested Stacks + +This module also supports templates that use [nested stacks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html). + +For example, if you have the following parent template: + +```json +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://my-s3-template-source.s3.amazonaws.com/child-stack.json" + } + } + } +} +``` + +where the child template pointed to by `https://my-s3-template-source.s3.amazonaws.com/child-stack.json` is: + +```json +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} +``` + +You can include both the parent stack, +and the nested stack in your CDK application as follows: + +```ts +const parentTemplate = new cfn_inc.CfnInclude(this, 'ParentStack', { + templateFile: 'path/to/my-parent-template.json', + loadNestedStacks: { + 'ChildStack': { + templateFile: 'path/to/my-nested-template.json', + }, + }, +}); +``` + +Here, `path/to/my-nested-template.json` +represents the path on disk to the downloaded template file from the original template URL of the nested stack +(`https://my-s3-template-source.s3.amazonaws.com/child-stack.json`). +In the CDK application, +this file will be turned into an [Asset](https://docs.aws.amazon.com/cdk/latest/guide/assets.html), +and the `TemplateURL` property of the nested stack resource +will be modified to point to that asset. + +The included nested stack can be accessed with the `getNestedStack` method: + +```ts +declare const parentTemplate: cfn_inc.CfnInclude; + +const includedChildStack = parentTemplate.getNestedStack('ChildStack'); +const childStack: core.NestedStack = includedChildStack.stack; +const childTemplate: cfn_inc.CfnInclude = includedChildStack.includedTemplate; +``` + +Now you can reference resources from `ChildStack`, +and modify them like any other included template: + +```ts +declare const childTemplate: cfn_inc.CfnInclude; + +const cfnBucket = childTemplate.getResource('MyBucket') as s3.CfnBucket; +cfnBucket.bucketName = 'my-new-bucket-name'; + +const role = new iam.Role(this, 'MyRole', { + assumedBy: new iam.AccountRootPrincipal(), +}); + +role.addToPolicy(new iam.PolicyStatement({ + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + resources: [cfnBucket.attrArn], +})); +``` + +You can also include the nested stack after the `CfnInclude` object was created, +instead of doing it on construction: + +```ts +declare const parentTemplate: cfn_inc.CfnInclude; +const includedChildStack = parentTemplate.loadNestedStack('ChildTemplate', { + templateFile: 'path/to/my-nested-template.json', +}); +``` + +## Vending CloudFormation templates as Constructs + +In many cases, there are existing CloudFormation templates that are not entire applications, +but more like specialized fragments, implementing a particular pattern or best practice. +If you have templates like that, +you can use the `CfnInclude` class to vend them as CDK Constructs: + +```ts nofixture +import { Construct } from 'constructs'; +import * as cfn_inc from 'aws-cdk-lib/cloudformation-include'; +import * as path from 'path'; + +export class MyConstruct extends Construct { + constructor(scope: Construct, id: string) { + super(scope, id); + + // include a template inside the Construct + new cfn_inc.CfnInclude(this, 'MyConstruct', { + templateFile: path.join(__dirname, 'my-template.json'), + preserveLogicalIds: false, // <--- !!! + }); + } +} +``` + +Notice the `preserveLogicalIds` parameter - +it makes sure the logical IDs of all the included template elements are re-named using CDK's algorithm, +guaranteeing they are unique within your application. +Without that parameter passed, +instantiating `MyConstruct` twice in the same Stack would result in duplicated logical IDs. diff --git a/packages/aws-cdk-lib/cloudformation-include/cfn-types-2-classes.json b/packages/aws-cdk-lib/cloudformation-include/cfn-types-2-classes.json new file mode 100644 index 0000000000000..64c0891a38da6 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/cfn-types-2-classes.json @@ -0,0 +1,1053 @@ +{ + "Alexa::ASK::Skill": "aws-cdk-lib/alexa-ask.CfnSkill", + "AWS::AccessAnalyzer::Analyzer": "aws-cdk-lib/aws-accessanalyzer.CfnAnalyzer", + "AWS::ACMPCA::Certificate": "aws-cdk-lib/aws-acmpca.CfnCertificate", + "AWS::ACMPCA::CertificateAuthority": "aws-cdk-lib/aws-acmpca.CfnCertificateAuthority", + "AWS::ACMPCA::CertificateAuthorityActivation": "aws-cdk-lib/aws-acmpca.CfnCertificateAuthorityActivation", + "AWS::ACMPCA::Permission": "aws-cdk-lib/aws-acmpca.CfnPermission", + "AWS::AmazonMQ::Broker": "aws-cdk-lib/aws-amazonmq.CfnBroker", + "AWS::AmazonMQ::Configuration": "aws-cdk-lib/aws-amazonmq.CfnConfiguration", + "AWS::AmazonMQ::ConfigurationAssociation": "aws-cdk-lib/aws-amazonmq.CfnConfigurationAssociation", + "AWS::Amplify::App": "aws-cdk-lib/aws-amplify.CfnApp", + "AWS::Amplify::Branch": "aws-cdk-lib/aws-amplify.CfnBranch", + "AWS::Amplify::Domain": "aws-cdk-lib/aws-amplify.CfnDomain", + "AWS::AmplifyUIBuilder::Component": "aws-cdk-lib/aws-amplifyuibuilder.CfnComponent", + "AWS::AmplifyUIBuilder::Form": "aws-cdk-lib/aws-amplifyuibuilder.CfnForm", + "AWS::AmplifyUIBuilder::Theme": "aws-cdk-lib/aws-amplifyuibuilder.CfnTheme", + "AWS::ApiGateway::Account": "aws-cdk-lib/aws-apigateway.CfnAccount", + "AWS::ApiGateway::ApiKey": "aws-cdk-lib/aws-apigateway.CfnApiKey", + "AWS::ApiGateway::Authorizer": "aws-cdk-lib/aws-apigateway.CfnAuthorizer", + "AWS::ApiGateway::BasePathMapping": "aws-cdk-lib/aws-apigateway.CfnBasePathMapping", + "AWS::ApiGateway::ClientCertificate": "aws-cdk-lib/aws-apigateway.CfnClientCertificate", + "AWS::ApiGateway::Deployment": "aws-cdk-lib/aws-apigateway.CfnDeployment", + "AWS::ApiGateway::DocumentationPart": "aws-cdk-lib/aws-apigateway.CfnDocumentationPart", + "AWS::ApiGateway::DocumentationVersion": "aws-cdk-lib/aws-apigateway.CfnDocumentationVersion", + "AWS::ApiGateway::DomainName": "aws-cdk-lib/aws-apigateway.CfnDomainName", + "AWS::ApiGateway::GatewayResponse": "aws-cdk-lib/aws-apigateway.CfnGatewayResponse", + "AWS::ApiGateway::Method": "aws-cdk-lib/aws-apigateway.CfnMethod", + "AWS::ApiGateway::Model": "aws-cdk-lib/aws-apigateway.CfnModel", + "AWS::ApiGateway::RequestValidator": "aws-cdk-lib/aws-apigateway.CfnRequestValidator", + "AWS::ApiGateway::Resource": "aws-cdk-lib/aws-apigateway.CfnResource", + "AWS::ApiGateway::RestApi": "aws-cdk-lib/aws-apigateway.CfnRestApi", + "AWS::ApiGateway::Stage": "aws-cdk-lib/aws-apigateway.CfnStage", + "AWS::ApiGateway::UsagePlan": "aws-cdk-lib/aws-apigateway.CfnUsagePlan", + "AWS::ApiGateway::UsagePlanKey": "aws-cdk-lib/aws-apigateway.CfnUsagePlanKey", + "AWS::ApiGateway::VpcLink": "aws-cdk-lib/aws-apigateway.CfnVpcLink", + "AWS::ApiGatewayV2::Api": "aws-cdk-lib/aws-apigatewayv2.CfnApi", + "AWS::ApiGatewayV2::ApiGatewayManagedOverrides": "aws-cdk-lib/aws-apigatewayv2.CfnApiGatewayManagedOverrides", + "AWS::ApiGatewayV2::ApiMapping": "aws-cdk-lib/aws-apigatewayv2.CfnApiMapping", + "AWS::ApiGatewayV2::Authorizer": "aws-cdk-lib/aws-apigatewayv2.CfnAuthorizer", + "AWS::ApiGatewayV2::Deployment": "aws-cdk-lib/aws-apigatewayv2.CfnDeployment", + "AWS::ApiGatewayV2::DomainName": "aws-cdk-lib/aws-apigatewayv2.CfnDomainName", + "AWS::ApiGatewayV2::Integration": "aws-cdk-lib/aws-apigatewayv2.CfnIntegration", + "AWS::ApiGatewayV2::IntegrationResponse": "aws-cdk-lib/aws-apigatewayv2.CfnIntegrationResponse", + "AWS::ApiGatewayV2::Model": "aws-cdk-lib/aws-apigatewayv2.CfnModel", + "AWS::ApiGatewayV2::Route": "aws-cdk-lib/aws-apigatewayv2.CfnRoute", + "AWS::ApiGatewayV2::RouteResponse": "aws-cdk-lib/aws-apigatewayv2.CfnRouteResponse", + "AWS::ApiGatewayV2::Stage": "aws-cdk-lib/aws-apigatewayv2.CfnStage", + "AWS::ApiGatewayV2::VpcLink": "aws-cdk-lib/aws-apigatewayv2.CfnVpcLink", + "AWS::AppConfig::Application": "aws-cdk-lib/aws-appconfig.CfnApplication", + "AWS::AppConfig::ConfigurationProfile": "aws-cdk-lib/aws-appconfig.CfnConfigurationProfile", + "AWS::AppConfig::Deployment": "aws-cdk-lib/aws-appconfig.CfnDeployment", + "AWS::AppConfig::DeploymentStrategy": "aws-cdk-lib/aws-appconfig.CfnDeploymentStrategy", + "AWS::AppConfig::Environment": "aws-cdk-lib/aws-appconfig.CfnEnvironment", + "AWS::AppConfig::HostedConfigurationVersion": "aws-cdk-lib/aws-appconfig.CfnHostedConfigurationVersion", + "AWS::AppFlow::Connector": "aws-cdk-lib/aws-appflow.CfnConnector", + "AWS::AppFlow::ConnectorProfile": "aws-cdk-lib/aws-appflow.CfnConnectorProfile", + "AWS::AppFlow::Flow": "aws-cdk-lib/aws-appflow.CfnFlow", + "AWS::AppIntegrations::DataIntegration": "aws-cdk-lib/aws-appintegrations.CfnDataIntegration", + "AWS::AppIntegrations::EventIntegration": "aws-cdk-lib/aws-appintegrations.CfnEventIntegration", + "AWS::ApplicationAutoScaling::ScalableTarget": "aws-cdk-lib/aws-applicationautoscaling.CfnScalableTarget", + "AWS::ApplicationAutoScaling::ScalingPolicy": "aws-cdk-lib/aws-applicationautoscaling.CfnScalingPolicy", + "AWS::ApplicationInsights::Application": "aws-cdk-lib/aws-applicationinsights.CfnApplication", + "AWS::AppMesh::GatewayRoute": "aws-cdk-lib/aws-appmesh.CfnGatewayRoute", + "AWS::AppMesh::Mesh": "aws-cdk-lib/aws-appmesh.CfnMesh", + "AWS::AppMesh::Route": "aws-cdk-lib/aws-appmesh.CfnRoute", + "AWS::AppMesh::VirtualGateway": "aws-cdk-lib/aws-appmesh.CfnVirtualGateway", + "AWS::AppMesh::VirtualNode": "aws-cdk-lib/aws-appmesh.CfnVirtualNode", + "AWS::AppMesh::VirtualRouter": "aws-cdk-lib/aws-appmesh.CfnVirtualRouter", + "AWS::AppMesh::VirtualService": "aws-cdk-lib/aws-appmesh.CfnVirtualService", + "AWS::AppRunner::ObservabilityConfiguration": "aws-cdk-lib/aws-apprunner.CfnObservabilityConfiguration", + "AWS::AppRunner::Service": "aws-cdk-lib/aws-apprunner.CfnService", + "AWS::AppRunner::VpcConnector": "aws-cdk-lib/aws-apprunner.CfnVpcConnector", + "AWS::AppRunner::VpcIngressConnection": "aws-cdk-lib/aws-apprunner.CfnVpcIngressConnection", + "AWS::AppStream::AppBlock": "aws-cdk-lib/aws-appstream.CfnAppBlock", + "AWS::AppStream::Application": "aws-cdk-lib/aws-appstream.CfnApplication", + "AWS::AppStream::ApplicationEntitlementAssociation": "aws-cdk-lib/aws-appstream.CfnApplicationEntitlementAssociation", + "AWS::AppStream::ApplicationFleetAssociation": "aws-cdk-lib/aws-appstream.CfnApplicationFleetAssociation", + "AWS::AppStream::DirectoryConfig": "aws-cdk-lib/aws-appstream.CfnDirectoryConfig", + "AWS::AppStream::Entitlement": "aws-cdk-lib/aws-appstream.CfnEntitlement", + "AWS::AppStream::Fleet": "aws-cdk-lib/aws-appstream.CfnFleet", + "AWS::AppStream::ImageBuilder": "aws-cdk-lib/aws-appstream.CfnImageBuilder", + "AWS::AppStream::Stack": "aws-cdk-lib/aws-appstream.CfnStack", + "AWS::AppStream::StackFleetAssociation": "aws-cdk-lib/aws-appstream.CfnStackFleetAssociation", + "AWS::AppStream::StackUserAssociation": "aws-cdk-lib/aws-appstream.CfnStackUserAssociation", + "AWS::AppStream::User": "aws-cdk-lib/aws-appstream.CfnUser", + "AWS::AppSync::ApiCache": "aws-cdk-lib/aws-appsync.CfnApiCache", + "AWS::AppSync::ApiKey": "aws-cdk-lib/aws-appsync.CfnApiKey", + "AWS::AppSync::DataSource": "aws-cdk-lib/aws-appsync.CfnDataSource", + "AWS::AppSync::DomainName": "aws-cdk-lib/aws-appsync.CfnDomainName", + "AWS::AppSync::DomainNameApiAssociation": "aws-cdk-lib/aws-appsync.CfnDomainNameApiAssociation", + "AWS::AppSync::FunctionConfiguration": "aws-cdk-lib/aws-appsync.CfnFunctionConfiguration", + "AWS::AppSync::GraphQLApi": "aws-cdk-lib/aws-appsync.CfnGraphQLApi", + "AWS::AppSync::GraphQLSchema": "aws-cdk-lib/aws-appsync.CfnGraphQLSchema", + "AWS::AppSync::Resolver": "aws-cdk-lib/aws-appsync.CfnResolver", + "AWS::APS::RuleGroupsNamespace": "aws-cdk-lib/aws-aps.CfnRuleGroupsNamespace", + "AWS::APS::Workspace": "aws-cdk-lib/aws-aps.CfnWorkspace", + "AWS::Athena::DataCatalog": "aws-cdk-lib/aws-athena.CfnDataCatalog", + "AWS::Athena::NamedQuery": "aws-cdk-lib/aws-athena.CfnNamedQuery", + "AWS::Athena::PreparedStatement": "aws-cdk-lib/aws-athena.CfnPreparedStatement", + "AWS::Athena::WorkGroup": "aws-cdk-lib/aws-athena.CfnWorkGroup", + "AWS::AuditManager::Assessment": "aws-cdk-lib/aws-auditmanager.CfnAssessment", + "AWS::AutoScaling::AutoScalingGroup": "aws-cdk-lib/aws-autoscaling.CfnAutoScalingGroup", + "AWS::AutoScaling::LaunchConfiguration": "aws-cdk-lib/aws-autoscaling.CfnLaunchConfiguration", + "AWS::AutoScaling::LifecycleHook": "aws-cdk-lib/aws-autoscaling.CfnLifecycleHook", + "AWS::AutoScaling::ScalingPolicy": "aws-cdk-lib/aws-autoscaling.CfnScalingPolicy", + "AWS::AutoScaling::ScheduledAction": "aws-cdk-lib/aws-autoscaling.CfnScheduledAction", + "AWS::AutoScaling::WarmPool": "aws-cdk-lib/aws-autoscaling.CfnWarmPool", + "AWS::AutoScalingPlans::ScalingPlan": "aws-cdk-lib/aws-autoscalingplans.CfnScalingPlan", + "AWS::Backup::BackupPlan": "aws-cdk-lib/aws-backup.CfnBackupPlan", + "AWS::Backup::BackupSelection": "aws-cdk-lib/aws-backup.CfnBackupSelection", + "AWS::Backup::BackupVault": "aws-cdk-lib/aws-backup.CfnBackupVault", + "AWS::Backup::Framework": "aws-cdk-lib/aws-backup.CfnFramework", + "AWS::Backup::ReportPlan": "aws-cdk-lib/aws-backup.CfnReportPlan", + "AWS::Batch::ComputeEnvironment": "aws-cdk-lib/aws-batch.CfnComputeEnvironment", + "AWS::Batch::JobDefinition": "aws-cdk-lib/aws-batch.CfnJobDefinition", + "AWS::Batch::JobQueue": "aws-cdk-lib/aws-batch.CfnJobQueue", + "AWS::Batch::SchedulingPolicy": "aws-cdk-lib/aws-batch.CfnSchedulingPolicy", + "AWS::BillingConductor::BillingGroup": "aws-cdk-lib/aws-billingconductor.CfnBillingGroup", + "AWS::BillingConductor::CustomLineItem": "aws-cdk-lib/aws-billingconductor.CfnCustomLineItem", + "AWS::BillingConductor::PricingPlan": "aws-cdk-lib/aws-billingconductor.CfnPricingPlan", + "AWS::BillingConductor::PricingRule": "aws-cdk-lib/aws-billingconductor.CfnPricingRule", + "AWS::Budgets::Budget": "aws-cdk-lib/aws-budgets.CfnBudget", + "AWS::Budgets::BudgetsAction": "aws-cdk-lib/aws-budgets.CfnBudgetsAction", + "AWS::Cassandra::Keyspace": "aws-cdk-lib/aws-cassandra.CfnKeyspace", + "AWS::Cassandra::Table": "aws-cdk-lib/aws-cassandra.CfnTable", + "AWS::CE::AnomalyMonitor": "aws-cdk-lib/aws-ce.CfnAnomalyMonitor", + "AWS::CE::AnomalySubscription": "aws-cdk-lib/aws-ce.CfnAnomalySubscription", + "AWS::CE::CostCategory": "aws-cdk-lib/aws-ce.CfnCostCategory", + "AWS::CertificateManager::Account": "aws-cdk-lib/aws-certificatemanager.CfnAccount", + "AWS::CertificateManager::Certificate": "aws-cdk-lib/aws-certificatemanager.CfnCertificate", + "AWS::Chatbot::MicrosoftTeamsChannelConfiguration": "aws-cdk-lib/aws-chatbot.CfnMicrosoftTeamsChannelConfiguration", + "AWS::Chatbot::SlackChannelConfiguration": "aws-cdk-lib/aws-chatbot.CfnSlackChannelConfiguration", + "AWS::Cloud9::EnvironmentEC2": "aws-cdk-lib/aws-cloud9.CfnEnvironmentEC2", + "AWS::CloudFormation::CustomResource": "aws-cdk-lib/core.CfnCustomResource", + "AWS::CloudFormation::HookDefaultVersion": "aws-cdk-lib/core.CfnHookDefaultVersion", + "AWS::CloudFormation::HookTypeConfig": "aws-cdk-lib/core.CfnHookTypeConfig", + "AWS::CloudFormation::HookVersion": "aws-cdk-lib/core.CfnHookVersion", + "AWS::CloudFormation::Macro": "aws-cdk-lib/core.CfnMacro", + "AWS::CloudFormation::ModuleDefaultVersion": "aws-cdk-lib/core.CfnModuleDefaultVersion", + "AWS::CloudFormation::ModuleVersion": "aws-cdk-lib/core.CfnModuleVersion", + "AWS::CloudFormation::PublicTypeVersion": "aws-cdk-lib/core.CfnPublicTypeVersion", + "AWS::CloudFormation::Publisher": "aws-cdk-lib/core.CfnPublisher", + "AWS::CloudFormation::ResourceDefaultVersion": "aws-cdk-lib/core.CfnResourceDefaultVersion", + "AWS::CloudFormation::ResourceVersion": "aws-cdk-lib/core.CfnResourceVersion", + "AWS::CloudFormation::Stack": "aws-cdk-lib/core.CfnStack", + "AWS::CloudFormation::StackSet": "aws-cdk-lib/core.CfnStackSet", + "AWS::CloudFormation::TypeActivation": "aws-cdk-lib/core.CfnTypeActivation", + "AWS::CloudFormation::WaitCondition": "aws-cdk-lib/core.CfnWaitCondition", + "AWS::CloudFormation::WaitConditionHandle": "aws-cdk-lib/core.CfnWaitConditionHandle", + "AWS::CloudFront::CachePolicy": "aws-cdk-lib/aws-cloudfront.CfnCachePolicy", + "AWS::CloudFront::CloudFrontOriginAccessIdentity": "aws-cdk-lib/aws-cloudfront.CfnCloudFrontOriginAccessIdentity", + "AWS::CloudFront::ContinuousDeploymentPolicy": "aws-cdk-lib/aws-cloudfront.CfnContinuousDeploymentPolicy", + "AWS::CloudFront::Distribution": "aws-cdk-lib/aws-cloudfront.CfnDistribution", + "AWS::CloudFront::Function": "aws-cdk-lib/aws-cloudfront.CfnFunction", + "AWS::CloudFront::KeyGroup": "aws-cdk-lib/aws-cloudfront.CfnKeyGroup", + "AWS::CloudFront::MonitoringSubscription": "aws-cdk-lib/aws-cloudfront.CfnMonitoringSubscription", + "AWS::CloudFront::OriginAccessControl": "aws-cdk-lib/aws-cloudfront.CfnOriginAccessControl", + "AWS::CloudFront::OriginRequestPolicy": "aws-cdk-lib/aws-cloudfront.CfnOriginRequestPolicy", + "AWS::CloudFront::PublicKey": "aws-cdk-lib/aws-cloudfront.CfnPublicKey", + "AWS::CloudFront::RealtimeLogConfig": "aws-cdk-lib/aws-cloudfront.CfnRealtimeLogConfig", + "AWS::CloudFront::ResponseHeadersPolicy": "aws-cdk-lib/aws-cloudfront.CfnResponseHeadersPolicy", + "AWS::CloudFront::StreamingDistribution": "aws-cdk-lib/aws-cloudfront.CfnStreamingDistribution", + "AWS::CloudTrail::Channel": "aws-cdk-lib/aws-cloudtrail.CfnChannel", + "AWS::CloudTrail::EventDataStore": "aws-cdk-lib/aws-cloudtrail.CfnEventDataStore", + "AWS::CloudTrail::ResourcePolicy": "aws-cdk-lib/aws-cloudtrail.CfnResourcePolicy", + "AWS::CloudTrail::Trail": "aws-cdk-lib/aws-cloudtrail.CfnTrail", + "AWS::CloudWatch::Alarm": "aws-cdk-lib/aws-cloudwatch.CfnAlarm", + "AWS::CloudWatch::AnomalyDetector": "aws-cdk-lib/aws-cloudwatch.CfnAnomalyDetector", + "AWS::CloudWatch::CompositeAlarm": "aws-cdk-lib/aws-cloudwatch.CfnCompositeAlarm", + "AWS::CloudWatch::Dashboard": "aws-cdk-lib/aws-cloudwatch.CfnDashboard", + "AWS::CloudWatch::InsightRule": "aws-cdk-lib/aws-cloudwatch.CfnInsightRule", + "AWS::CloudWatch::MetricStream": "aws-cdk-lib/aws-cloudwatch.CfnMetricStream", + "AWS::CodeArtifact::Domain": "aws-cdk-lib/aws-codeartifact.CfnDomain", + "AWS::CodeArtifact::Repository": "aws-cdk-lib/aws-codeartifact.CfnRepository", + "AWS::CodeBuild::Project": "aws-cdk-lib/aws-codebuild.CfnProject", + "AWS::CodeBuild::ReportGroup": "aws-cdk-lib/aws-codebuild.CfnReportGroup", + "AWS::CodeBuild::SourceCredential": "aws-cdk-lib/aws-codebuild.CfnSourceCredential", + "AWS::CodeCommit::Repository": "aws-cdk-lib/aws-codecommit.CfnRepository", + "AWS::CodeDeploy::Application": "aws-cdk-lib/aws-codedeploy.CfnApplication", + "AWS::CodeDeploy::DeploymentConfig": "aws-cdk-lib/aws-codedeploy.CfnDeploymentConfig", + "AWS::CodeDeploy::DeploymentGroup": "aws-cdk-lib/aws-codedeploy.CfnDeploymentGroup", + "AWS::CodeGuruProfiler::ProfilingGroup": "aws-cdk-lib/aws-codeguruprofiler.CfnProfilingGroup", + "AWS::CodeGuruReviewer::RepositoryAssociation": "aws-cdk-lib/aws-codegurureviewer.CfnRepositoryAssociation", + "AWS::CodePipeline::CustomActionType": "aws-cdk-lib/aws-codepipeline.CfnCustomActionType", + "AWS::CodePipeline::Pipeline": "aws-cdk-lib/aws-codepipeline.CfnPipeline", + "AWS::CodePipeline::Webhook": "aws-cdk-lib/aws-codepipeline.CfnWebhook", + "AWS::CodeStar::GitHubRepository": "aws-cdk-lib/aws-codestar.CfnGitHubRepository", + "AWS::CodeStarConnections::Connection": "aws-cdk-lib/aws-codestarconnections.CfnConnection", + "AWS::CodeStarNotifications::NotificationRule": "aws-cdk-lib/aws-codestarnotifications.CfnNotificationRule", + "AWS::Cognito::IdentityPool": "aws-cdk-lib/aws-cognito.CfnIdentityPool", + "AWS::Cognito::IdentityPoolRoleAttachment": "aws-cdk-lib/aws-cognito.CfnIdentityPoolRoleAttachment", + "AWS::Cognito::UserPool": "aws-cdk-lib/aws-cognito.CfnUserPool", + "AWS::Cognito::UserPoolClient": "aws-cdk-lib/aws-cognito.CfnUserPoolClient", + "AWS::Cognito::UserPoolDomain": "aws-cdk-lib/aws-cognito.CfnUserPoolDomain", + "AWS::Cognito::UserPoolGroup": "aws-cdk-lib/aws-cognito.CfnUserPoolGroup", + "AWS::Cognito::UserPoolIdentityProvider": "aws-cdk-lib/aws-cognito.CfnUserPoolIdentityProvider", + "AWS::Cognito::UserPoolResourceServer": "aws-cdk-lib/aws-cognito.CfnUserPoolResourceServer", + "AWS::Cognito::UserPoolRiskConfigurationAttachment": "aws-cdk-lib/aws-cognito.CfnUserPoolRiskConfigurationAttachment", + "AWS::Cognito::UserPoolUICustomizationAttachment": "aws-cdk-lib/aws-cognito.CfnUserPoolUICustomizationAttachment", + "AWS::Cognito::UserPoolUser": "aws-cdk-lib/aws-cognito.CfnUserPoolUser", + "AWS::Cognito::UserPoolUserToGroupAttachment": "aws-cdk-lib/aws-cognito.CfnUserPoolUserToGroupAttachment", + "AWS::Comprehend::Flywheel": "aws-cdk-lib/aws-comprehend.CfnFlywheel", + "AWS::Config::AggregationAuthorization": "aws-cdk-lib/aws-config.CfnAggregationAuthorization", + "AWS::Config::ConfigRule": "aws-cdk-lib/aws-config.CfnConfigRule", + "AWS::Config::ConfigurationAggregator": "aws-cdk-lib/aws-config.CfnConfigurationAggregator", + "AWS::Config::ConfigurationRecorder": "aws-cdk-lib/aws-config.CfnConfigurationRecorder", + "AWS::Config::ConformancePack": "aws-cdk-lib/aws-config.CfnConformancePack", + "AWS::Config::DeliveryChannel": "aws-cdk-lib/aws-config.CfnDeliveryChannel", + "AWS::Config::OrganizationConfigRule": "aws-cdk-lib/aws-config.CfnOrganizationConfigRule", + "AWS::Config::OrganizationConformancePack": "aws-cdk-lib/aws-config.CfnOrganizationConformancePack", + "AWS::Config::RemediationConfiguration": "aws-cdk-lib/aws-config.CfnRemediationConfiguration", + "AWS::Config::StoredQuery": "aws-cdk-lib/aws-config.CfnStoredQuery", + "AWS::Connect::ApprovedOrigin": "aws-cdk-lib/aws-connect.CfnApprovedOrigin", + "AWS::Connect::ContactFlow": "aws-cdk-lib/aws-connect.CfnContactFlow", + "AWS::Connect::ContactFlowModule": "aws-cdk-lib/aws-connect.CfnContactFlowModule", + "AWS::Connect::HoursOfOperation": "aws-cdk-lib/aws-connect.CfnHoursOfOperation", + "AWS::Connect::Instance": "aws-cdk-lib/aws-connect.CfnInstance", + "AWS::Connect::InstanceStorageConfig": "aws-cdk-lib/aws-connect.CfnInstanceStorageConfig", + "AWS::Connect::IntegrationAssociation": "aws-cdk-lib/aws-connect.CfnIntegrationAssociation", + "AWS::Connect::PhoneNumber": "aws-cdk-lib/aws-connect.CfnPhoneNumber", + "AWS::Connect::QuickConnect": "aws-cdk-lib/aws-connect.CfnQuickConnect", + "AWS::Connect::Rule": "aws-cdk-lib/aws-connect.CfnRule", + "AWS::Connect::SecurityKey": "aws-cdk-lib/aws-connect.CfnSecurityKey", + "AWS::Connect::TaskTemplate": "aws-cdk-lib/aws-connect.CfnTaskTemplate", + "AWS::Connect::User": "aws-cdk-lib/aws-connect.CfnUser", + "AWS::Connect::UserHierarchyGroup": "aws-cdk-lib/aws-connect.CfnUserHierarchyGroup", + "AWS::ConnectCampaigns::Campaign": "aws-cdk-lib/aws-connectcampaigns.CfnCampaign", + "AWS::ControlTower::EnabledControl": "aws-cdk-lib/aws-controltower.CfnEnabledControl", + "AWS::CUR::ReportDefinition": "aws-cdk-lib/aws-cur.CfnReportDefinition", + "AWS::CustomerProfiles::Domain": "aws-cdk-lib/aws-customerprofiles.CfnDomain", + "AWS::CustomerProfiles::Integration": "aws-cdk-lib/aws-customerprofiles.CfnIntegration", + "AWS::CustomerProfiles::ObjectType": "aws-cdk-lib/aws-customerprofiles.CfnObjectType", + "AWS::DataBrew::Dataset": "aws-cdk-lib/aws-databrew.CfnDataset", + "AWS::DataBrew::Job": "aws-cdk-lib/aws-databrew.CfnJob", + "AWS::DataBrew::Project": "aws-cdk-lib/aws-databrew.CfnProject", + "AWS::DataBrew::Recipe": "aws-cdk-lib/aws-databrew.CfnRecipe", + "AWS::DataBrew::Ruleset": "aws-cdk-lib/aws-databrew.CfnRuleset", + "AWS::DataBrew::Schedule": "aws-cdk-lib/aws-databrew.CfnSchedule", + "AWS::DataPipeline::Pipeline": "aws-cdk-lib/aws-datapipeline.CfnPipeline", + "AWS::DataSync::Agent": "aws-cdk-lib/aws-datasync.CfnAgent", + "AWS::DataSync::LocationEFS": "aws-cdk-lib/aws-datasync.CfnLocationEFS", + "AWS::DataSync::LocationFSxLustre": "aws-cdk-lib/aws-datasync.CfnLocationFSxLustre", + "AWS::DataSync::LocationFSxONTAP": "aws-cdk-lib/aws-datasync.CfnLocationFSxONTAP", + "AWS::DataSync::LocationFSxOpenZFS": "aws-cdk-lib/aws-datasync.CfnLocationFSxOpenZFS", + "AWS::DataSync::LocationFSxWindows": "aws-cdk-lib/aws-datasync.CfnLocationFSxWindows", + "AWS::DataSync::LocationHDFS": "aws-cdk-lib/aws-datasync.CfnLocationHDFS", + "AWS::DataSync::LocationNFS": "aws-cdk-lib/aws-datasync.CfnLocationNFS", + "AWS::DataSync::LocationObjectStorage": "aws-cdk-lib/aws-datasync.CfnLocationObjectStorage", + "AWS::DataSync::LocationS3": "aws-cdk-lib/aws-datasync.CfnLocationS3", + "AWS::DataSync::LocationSMB": "aws-cdk-lib/aws-datasync.CfnLocationSMB", + "AWS::DataSync::Task": "aws-cdk-lib/aws-datasync.CfnTask", + "AWS::DAX::Cluster": "aws-cdk-lib/aws-dax.CfnCluster", + "AWS::DAX::ParameterGroup": "aws-cdk-lib/aws-dax.CfnParameterGroup", + "AWS::DAX::SubnetGroup": "aws-cdk-lib/aws-dax.CfnSubnetGroup", + "AWS::Detective::Graph": "aws-cdk-lib/aws-detective.CfnGraph", + "AWS::Detective::MemberInvitation": "aws-cdk-lib/aws-detective.CfnMemberInvitation", + "AWS::DeviceFarm::DevicePool": "aws-cdk-lib/aws-devicefarm.CfnDevicePool", + "AWS::DeviceFarm::InstanceProfile": "aws-cdk-lib/aws-devicefarm.CfnInstanceProfile", + "AWS::DeviceFarm::NetworkProfile": "aws-cdk-lib/aws-devicefarm.CfnNetworkProfile", + "AWS::DeviceFarm::Project": "aws-cdk-lib/aws-devicefarm.CfnProject", + "AWS::DeviceFarm::TestGridProject": "aws-cdk-lib/aws-devicefarm.CfnTestGridProject", + "AWS::DeviceFarm::VPCEConfiguration": "aws-cdk-lib/aws-devicefarm.CfnVPCEConfiguration", + "AWS::DevOpsGuru::NotificationChannel": "aws-cdk-lib/aws-devopsguru.CfnNotificationChannel", + "AWS::DevOpsGuru::ResourceCollection": "aws-cdk-lib/aws-devopsguru.CfnResourceCollection", + "AWS::DirectoryService::MicrosoftAD": "aws-cdk-lib/aws-directoryservice.CfnMicrosoftAD", + "AWS::DirectoryService::SimpleAD": "aws-cdk-lib/aws-directoryservice.CfnSimpleAD", + "AWS::DLM::LifecyclePolicy": "aws-cdk-lib/aws-dlm.CfnLifecyclePolicy", + "AWS::DMS::Certificate": "aws-cdk-lib/aws-dms.CfnCertificate", + "AWS::DMS::Endpoint": "aws-cdk-lib/aws-dms.CfnEndpoint", + "AWS::DMS::EventSubscription": "aws-cdk-lib/aws-dms.CfnEventSubscription", + "AWS::DMS::ReplicationInstance": "aws-cdk-lib/aws-dms.CfnReplicationInstance", + "AWS::DMS::ReplicationSubnetGroup": "aws-cdk-lib/aws-dms.CfnReplicationSubnetGroup", + "AWS::DMS::ReplicationTask": "aws-cdk-lib/aws-dms.CfnReplicationTask", + "AWS::DocDB::DBCluster": "aws-cdk-lib/aws-docdb.CfnDBCluster", + "AWS::DocDB::DBClusterParameterGroup": "aws-cdk-lib/aws-docdb.CfnDBClusterParameterGroup", + "AWS::DocDB::DBInstance": "aws-cdk-lib/aws-docdb.CfnDBInstance", + "AWS::DocDB::DBSubnetGroup": "aws-cdk-lib/aws-docdb.CfnDBSubnetGroup", + "AWS::DocDBElastic::Cluster": "aws-cdk-lib/aws-docdbelastic.CfnCluster", + "AWS::DynamoDB::GlobalTable": "aws-cdk-lib/aws-dynamodb.CfnGlobalTable", + "AWS::DynamoDB::Table": "aws-cdk-lib/aws-dynamodb.CfnTable", + "AWS::EC2::CapacityReservation": "aws-cdk-lib/aws-ec2.CfnCapacityReservation", + "AWS::EC2::CapacityReservationFleet": "aws-cdk-lib/aws-ec2.CfnCapacityReservationFleet", + "AWS::EC2::CarrierGateway": "aws-cdk-lib/aws-ec2.CfnCarrierGateway", + "AWS::EC2::ClientVpnAuthorizationRule": "aws-cdk-lib/aws-ec2.CfnClientVpnAuthorizationRule", + "AWS::EC2::ClientVpnEndpoint": "aws-cdk-lib/aws-ec2.CfnClientVpnEndpoint", + "AWS::EC2::ClientVpnRoute": "aws-cdk-lib/aws-ec2.CfnClientVpnRoute", + "AWS::EC2::ClientVpnTargetNetworkAssociation": "aws-cdk-lib/aws-ec2.CfnClientVpnTargetNetworkAssociation", + "AWS::EC2::CustomerGateway": "aws-cdk-lib/aws-ec2.CfnCustomerGateway", + "AWS::EC2::DHCPOptions": "aws-cdk-lib/aws-ec2.CfnDHCPOptions", + "AWS::EC2::EC2Fleet": "aws-cdk-lib/aws-ec2.CfnEC2Fleet", + "AWS::EC2::EIP": "aws-cdk-lib/aws-ec2.CfnEIP", + "AWS::EC2::EIPAssociation": "aws-cdk-lib/aws-ec2.CfnEIPAssociation", + "AWS::EC2::EgressOnlyInternetGateway": "aws-cdk-lib/aws-ec2.CfnEgressOnlyInternetGateway", + "AWS::EC2::EnclaveCertificateIamRoleAssociation": "aws-cdk-lib/aws-ec2.CfnEnclaveCertificateIamRoleAssociation", + "AWS::EC2::FlowLog": "aws-cdk-lib/aws-ec2.CfnFlowLog", + "AWS::EC2::GatewayRouteTableAssociation": "aws-cdk-lib/aws-ec2.CfnGatewayRouteTableAssociation", + "AWS::EC2::Host": "aws-cdk-lib/aws-ec2.CfnHost", + "AWS::EC2::IPAM": "aws-cdk-lib/aws-ec2.CfnIPAM", + "AWS::EC2::IPAMAllocation": "aws-cdk-lib/aws-ec2.CfnIPAMAllocation", + "AWS::EC2::IPAMPool": "aws-cdk-lib/aws-ec2.CfnIPAMPool", + "AWS::EC2::IPAMPoolCidr": "aws-cdk-lib/aws-ec2.CfnIPAMPoolCidr", + "AWS::EC2::IPAMResourceDiscovery": "aws-cdk-lib/aws-ec2.CfnIPAMResourceDiscovery", + "AWS::EC2::IPAMResourceDiscoveryAssociation": "aws-cdk-lib/aws-ec2.CfnIPAMResourceDiscoveryAssociation", + "AWS::EC2::IPAMScope": "aws-cdk-lib/aws-ec2.CfnIPAMScope", + "AWS::EC2::Instance": "aws-cdk-lib/aws-ec2.CfnInstance", + "AWS::EC2::InternetGateway": "aws-cdk-lib/aws-ec2.CfnInternetGateway", + "AWS::EC2::KeyPair": "aws-cdk-lib/aws-ec2.CfnKeyPair", + "AWS::EC2::LaunchTemplate": "aws-cdk-lib/aws-ec2.CfnLaunchTemplate", + "AWS::EC2::LocalGatewayRoute": "aws-cdk-lib/aws-ec2.CfnLocalGatewayRoute", + "AWS::EC2::LocalGatewayRouteTable": "aws-cdk-lib/aws-ec2.CfnLocalGatewayRouteTable", + "AWS::EC2::LocalGatewayRouteTableVPCAssociation": "aws-cdk-lib/aws-ec2.CfnLocalGatewayRouteTableVPCAssociation", + "AWS::EC2::LocalGatewayRouteTableVirtualInterfaceGroupAssociation": "aws-cdk-lib/aws-ec2.CfnLocalGatewayRouteTableVirtualInterfaceGroupAssociation", + "AWS::EC2::NatGateway": "aws-cdk-lib/aws-ec2.CfnNatGateway", + "AWS::EC2::NetworkAcl": "aws-cdk-lib/aws-ec2.CfnNetworkAcl", + "AWS::EC2::NetworkAclEntry": "aws-cdk-lib/aws-ec2.CfnNetworkAclEntry", + "AWS::EC2::NetworkInsightsAccessScope": "aws-cdk-lib/aws-ec2.CfnNetworkInsightsAccessScope", + "AWS::EC2::NetworkInsightsAccessScopeAnalysis": "aws-cdk-lib/aws-ec2.CfnNetworkInsightsAccessScopeAnalysis", + "AWS::EC2::NetworkInsightsAnalysis": "aws-cdk-lib/aws-ec2.CfnNetworkInsightsAnalysis", + "AWS::EC2::NetworkInsightsPath": "aws-cdk-lib/aws-ec2.CfnNetworkInsightsPath", + "AWS::EC2::NetworkInterface": "aws-cdk-lib/aws-ec2.CfnNetworkInterface", + "AWS::EC2::NetworkInterfaceAttachment": "aws-cdk-lib/aws-ec2.CfnNetworkInterfaceAttachment", + "AWS::EC2::NetworkInterfacePermission": "aws-cdk-lib/aws-ec2.CfnNetworkInterfacePermission", + "AWS::EC2::NetworkPerformanceMetricSubscription": "aws-cdk-lib/aws-ec2.CfnNetworkPerformanceMetricSubscription", + "AWS::EC2::PlacementGroup": "aws-cdk-lib/aws-ec2.CfnPlacementGroup", + "AWS::EC2::PrefixList": "aws-cdk-lib/aws-ec2.CfnPrefixList", + "AWS::EC2::Route": "aws-cdk-lib/aws-ec2.CfnRoute", + "AWS::EC2::RouteTable": "aws-cdk-lib/aws-ec2.CfnRouteTable", + "AWS::EC2::SecurityGroup": "aws-cdk-lib/aws-ec2.CfnSecurityGroup", + "AWS::EC2::SecurityGroupEgress": "aws-cdk-lib/aws-ec2.CfnSecurityGroupEgress", + "AWS::EC2::SecurityGroupIngress": "aws-cdk-lib/aws-ec2.CfnSecurityGroupIngress", + "AWS::EC2::SpotFleet": "aws-cdk-lib/aws-ec2.CfnSpotFleet", + "AWS::EC2::Subnet": "aws-cdk-lib/aws-ec2.CfnSubnet", + "AWS::EC2::SubnetCidrBlock": "aws-cdk-lib/aws-ec2.CfnSubnetCidrBlock", + "AWS::EC2::SubnetNetworkAclAssociation": "aws-cdk-lib/aws-ec2.CfnSubnetNetworkAclAssociation", + "AWS::EC2::SubnetRouteTableAssociation": "aws-cdk-lib/aws-ec2.CfnSubnetRouteTableAssociation", + "AWS::EC2::TrafficMirrorFilter": "aws-cdk-lib/aws-ec2.CfnTrafficMirrorFilter", + "AWS::EC2::TrafficMirrorFilterRule": "aws-cdk-lib/aws-ec2.CfnTrafficMirrorFilterRule", + "AWS::EC2::TrafficMirrorSession": "aws-cdk-lib/aws-ec2.CfnTrafficMirrorSession", + "AWS::EC2::TrafficMirrorTarget": "aws-cdk-lib/aws-ec2.CfnTrafficMirrorTarget", + "AWS::EC2::TransitGateway": "aws-cdk-lib/aws-ec2.CfnTransitGateway", + "AWS::EC2::TransitGatewayAttachment": "aws-cdk-lib/aws-ec2.CfnTransitGatewayAttachment", + "AWS::EC2::TransitGatewayConnect": "aws-cdk-lib/aws-ec2.CfnTransitGatewayConnect", + "AWS::EC2::TransitGatewayMulticastDomain": "aws-cdk-lib/aws-ec2.CfnTransitGatewayMulticastDomain", + "AWS::EC2::TransitGatewayMulticastDomainAssociation": "aws-cdk-lib/aws-ec2.CfnTransitGatewayMulticastDomainAssociation", + "AWS::EC2::TransitGatewayMulticastGroupMember": "aws-cdk-lib/aws-ec2.CfnTransitGatewayMulticastGroupMember", + "AWS::EC2::TransitGatewayMulticastGroupSource": "aws-cdk-lib/aws-ec2.CfnTransitGatewayMulticastGroupSource", + "AWS::EC2::TransitGatewayPeeringAttachment": "aws-cdk-lib/aws-ec2.CfnTransitGatewayPeeringAttachment", + "AWS::EC2::TransitGatewayRoute": "aws-cdk-lib/aws-ec2.CfnTransitGatewayRoute", + "AWS::EC2::TransitGatewayRouteTable": "aws-cdk-lib/aws-ec2.CfnTransitGatewayRouteTable", + "AWS::EC2::TransitGatewayRouteTableAssociation": "aws-cdk-lib/aws-ec2.CfnTransitGatewayRouteTableAssociation", + "AWS::EC2::TransitGatewayRouteTablePropagation": "aws-cdk-lib/aws-ec2.CfnTransitGatewayRouteTablePropagation", + "AWS::EC2::TransitGatewayVpcAttachment": "aws-cdk-lib/aws-ec2.CfnTransitGatewayVpcAttachment", + "AWS::EC2::VPC": "aws-cdk-lib/aws-ec2.CfnVPC", + "AWS::EC2::VPCCidrBlock": "aws-cdk-lib/aws-ec2.CfnVPCCidrBlock", + "AWS::EC2::VPCDHCPOptionsAssociation": "aws-cdk-lib/aws-ec2.CfnVPCDHCPOptionsAssociation", + "AWS::EC2::VPCEndpoint": "aws-cdk-lib/aws-ec2.CfnVPCEndpoint", + "AWS::EC2::VPCEndpointConnectionNotification": "aws-cdk-lib/aws-ec2.CfnVPCEndpointConnectionNotification", + "AWS::EC2::VPCEndpointService": "aws-cdk-lib/aws-ec2.CfnVPCEndpointService", + "AWS::EC2::VPCEndpointServicePermissions": "aws-cdk-lib/aws-ec2.CfnVPCEndpointServicePermissions", + "AWS::EC2::VPCGatewayAttachment": "aws-cdk-lib/aws-ec2.CfnVPCGatewayAttachment", + "AWS::EC2::VPCPeeringConnection": "aws-cdk-lib/aws-ec2.CfnVPCPeeringConnection", + "AWS::EC2::VPNConnection": "aws-cdk-lib/aws-ec2.CfnVPNConnection", + "AWS::EC2::VPNConnectionRoute": "aws-cdk-lib/aws-ec2.CfnVPNConnectionRoute", + "AWS::EC2::VPNGateway": "aws-cdk-lib/aws-ec2.CfnVPNGateway", + "AWS::EC2::VPNGatewayRoutePropagation": "aws-cdk-lib/aws-ec2.CfnVPNGatewayRoutePropagation", + "AWS::EC2::Volume": "aws-cdk-lib/aws-ec2.CfnVolume", + "AWS::EC2::VolumeAttachment": "aws-cdk-lib/aws-ec2.CfnVolumeAttachment", + "AWS::ECR::PublicRepository": "aws-cdk-lib/aws-ecr.CfnPublicRepository", + "AWS::ECR::PullThroughCacheRule": "aws-cdk-lib/aws-ecr.CfnPullThroughCacheRule", + "AWS::ECR::RegistryPolicy": "aws-cdk-lib/aws-ecr.CfnRegistryPolicy", + "AWS::ECR::ReplicationConfiguration": "aws-cdk-lib/aws-ecr.CfnReplicationConfiguration", + "AWS::ECR::Repository": "aws-cdk-lib/aws-ecr.CfnRepository", + "AWS::ECS::CapacityProvider": "aws-cdk-lib/aws-ecs.CfnCapacityProvider", + "AWS::ECS::Cluster": "aws-cdk-lib/aws-ecs.CfnCluster", + "AWS::ECS::ClusterCapacityProviderAssociations": "aws-cdk-lib/aws-ecs.CfnClusterCapacityProviderAssociations", + "AWS::ECS::PrimaryTaskSet": "aws-cdk-lib/aws-ecs.CfnPrimaryTaskSet", + "AWS::ECS::Service": "aws-cdk-lib/aws-ecs.CfnService", + "AWS::ECS::TaskDefinition": "aws-cdk-lib/aws-ecs.CfnTaskDefinition", + "AWS::ECS::TaskSet": "aws-cdk-lib/aws-ecs.CfnTaskSet", + "AWS::EFS::AccessPoint": "aws-cdk-lib/aws-efs.CfnAccessPoint", + "AWS::EFS::FileSystem": "aws-cdk-lib/aws-efs.CfnFileSystem", + "AWS::EFS::MountTarget": "aws-cdk-lib/aws-efs.CfnMountTarget", + "AWS::EKS::Addon": "aws-cdk-lib/aws-eks.CfnAddon", + "AWS::EKS::Cluster": "aws-cdk-lib/aws-eks.CfnCluster", + "AWS::EKS::FargateProfile": "aws-cdk-lib/aws-eks.CfnFargateProfile", + "AWS::EKS::IdentityProviderConfig": "aws-cdk-lib/aws-eks.CfnIdentityProviderConfig", + "AWS::EKS::Nodegroup": "aws-cdk-lib/aws-eks.CfnNodegroup", + "AWS::ElastiCache::CacheCluster": "aws-cdk-lib/aws-elasticache.CfnCacheCluster", + "AWS::ElastiCache::GlobalReplicationGroup": "aws-cdk-lib/aws-elasticache.CfnGlobalReplicationGroup", + "AWS::ElastiCache::ParameterGroup": "aws-cdk-lib/aws-elasticache.CfnParameterGroup", + "AWS::ElastiCache::ReplicationGroup": "aws-cdk-lib/aws-elasticache.CfnReplicationGroup", + "AWS::ElastiCache::SecurityGroup": "aws-cdk-lib/aws-elasticache.CfnSecurityGroup", + "AWS::ElastiCache::SecurityGroupIngress": "aws-cdk-lib/aws-elasticache.CfnSecurityGroupIngress", + "AWS::ElastiCache::SubnetGroup": "aws-cdk-lib/aws-elasticache.CfnSubnetGroup", + "AWS::ElastiCache::User": "aws-cdk-lib/aws-elasticache.CfnUser", + "AWS::ElastiCache::UserGroup": "aws-cdk-lib/aws-elasticache.CfnUserGroup", + "AWS::ElasticBeanstalk::Application": "aws-cdk-lib/aws-elasticbeanstalk.CfnApplication", + "AWS::ElasticBeanstalk::ApplicationVersion": "aws-cdk-lib/aws-elasticbeanstalk.CfnApplicationVersion", + "AWS::ElasticBeanstalk::ConfigurationTemplate": "aws-cdk-lib/aws-elasticbeanstalk.CfnConfigurationTemplate", + "AWS::ElasticBeanstalk::Environment": "aws-cdk-lib/aws-elasticbeanstalk.CfnEnvironment", + "AWS::ElasticLoadBalancing::LoadBalancer": "aws-cdk-lib/aws-elasticloadbalancing.CfnLoadBalancer", + "AWS::ElasticLoadBalancingV2::Listener": "aws-cdk-lib/aws-elasticloadbalancingv2.CfnListener", + "AWS::ElasticLoadBalancingV2::ListenerCertificate": "aws-cdk-lib/aws-elasticloadbalancingv2.CfnListenerCertificate", + "AWS::ElasticLoadBalancingV2::ListenerRule": "aws-cdk-lib/aws-elasticloadbalancingv2.CfnListenerRule", + "AWS::ElasticLoadBalancingV2::LoadBalancer": "aws-cdk-lib/aws-elasticloadbalancingv2.CfnLoadBalancer", + "AWS::ElasticLoadBalancingV2::TargetGroup": "aws-cdk-lib/aws-elasticloadbalancingv2.CfnTargetGroup", + "AWS::Elasticsearch::Domain": "aws-cdk-lib/aws-elasticsearch.CfnDomain", + "AWS::EMR::Cluster": "aws-cdk-lib/aws-emr.CfnCluster", + "AWS::EMR::InstanceFleetConfig": "aws-cdk-lib/aws-emr.CfnInstanceFleetConfig", + "AWS::EMR::InstanceGroupConfig": "aws-cdk-lib/aws-emr.CfnInstanceGroupConfig", + "AWS::EMR::SecurityConfiguration": "aws-cdk-lib/aws-emr.CfnSecurityConfiguration", + "AWS::EMR::Step": "aws-cdk-lib/aws-emr.CfnStep", + "AWS::EMR::Studio": "aws-cdk-lib/aws-emr.CfnStudio", + "AWS::EMR::StudioSessionMapping": "aws-cdk-lib/aws-emr.CfnStudioSessionMapping", + "AWS::EMRContainers::VirtualCluster": "aws-cdk-lib/aws-emrcontainers.CfnVirtualCluster", + "AWS::EMRServerless::Application": "aws-cdk-lib/aws-emrserverless.CfnApplication", + "AWS::Events::ApiDestination": "aws-cdk-lib/aws-events.CfnApiDestination", + "AWS::Events::Archive": "aws-cdk-lib/aws-events.CfnArchive", + "AWS::Events::Connection": "aws-cdk-lib/aws-events.CfnConnection", + "AWS::Events::Endpoint": "aws-cdk-lib/aws-events.CfnEndpoint", + "AWS::Events::EventBus": "aws-cdk-lib/aws-events.CfnEventBus", + "AWS::Events::EventBusPolicy": "aws-cdk-lib/aws-events.CfnEventBusPolicy", + "AWS::Events::Rule": "aws-cdk-lib/aws-events.CfnRule", + "AWS::EventSchemas::Discoverer": "aws-cdk-lib/aws-eventschemas.CfnDiscoverer", + "AWS::EventSchemas::Registry": "aws-cdk-lib/aws-eventschemas.CfnRegistry", + "AWS::EventSchemas::RegistryPolicy": "aws-cdk-lib/aws-eventschemas.CfnRegistryPolicy", + "AWS::EventSchemas::Schema": "aws-cdk-lib/aws-eventschemas.CfnSchema", + "AWS::Evidently::Experiment": "aws-cdk-lib/aws-evidently.CfnExperiment", + "AWS::Evidently::Feature": "aws-cdk-lib/aws-evidently.CfnFeature", + "AWS::Evidently::Launch": "aws-cdk-lib/aws-evidently.CfnLaunch", + "AWS::Evidently::Project": "aws-cdk-lib/aws-evidently.CfnProject", + "AWS::Evidently::Segment": "aws-cdk-lib/aws-evidently.CfnSegment", + "AWS::FinSpace::Environment": "aws-cdk-lib/aws-finspace.CfnEnvironment", + "AWS::FIS::ExperimentTemplate": "aws-cdk-lib/aws-fis.CfnExperimentTemplate", + "AWS::FMS::NotificationChannel": "aws-cdk-lib/aws-fms.CfnNotificationChannel", + "AWS::FMS::Policy": "aws-cdk-lib/aws-fms.CfnPolicy", + "AWS::FMS::ResourceSet": "aws-cdk-lib/aws-fms.CfnResourceSet", + "AWS::Forecast::Dataset": "aws-cdk-lib/aws-forecast.CfnDataset", + "AWS::Forecast::DatasetGroup": "aws-cdk-lib/aws-forecast.CfnDatasetGroup", + "AWS::FraudDetector::Detector": "aws-cdk-lib/aws-frauddetector.CfnDetector", + "AWS::FraudDetector::EntityType": "aws-cdk-lib/aws-frauddetector.CfnEntityType", + "AWS::FraudDetector::EventType": "aws-cdk-lib/aws-frauddetector.CfnEventType", + "AWS::FraudDetector::Label": "aws-cdk-lib/aws-frauddetector.CfnLabel", + "AWS::FraudDetector::Outcome": "aws-cdk-lib/aws-frauddetector.CfnOutcome", + "AWS::FraudDetector::Variable": "aws-cdk-lib/aws-frauddetector.CfnVariable", + "AWS::FSx::DataRepositoryAssociation": "aws-cdk-lib/aws-fsx.CfnDataRepositoryAssociation", + "AWS::FSx::FileSystem": "aws-cdk-lib/aws-fsx.CfnFileSystem", + "AWS::FSx::Snapshot": "aws-cdk-lib/aws-fsx.CfnSnapshot", + "AWS::FSx::StorageVirtualMachine": "aws-cdk-lib/aws-fsx.CfnStorageVirtualMachine", + "AWS::FSx::Volume": "aws-cdk-lib/aws-fsx.CfnVolume", + "AWS::GameLift::Alias": "aws-cdk-lib/aws-gamelift.CfnAlias", + "AWS::GameLift::Build": "aws-cdk-lib/aws-gamelift.CfnBuild", + "AWS::GameLift::Fleet": "aws-cdk-lib/aws-gamelift.CfnFleet", + "AWS::GameLift::GameServerGroup": "aws-cdk-lib/aws-gamelift.CfnGameServerGroup", + "AWS::GameLift::GameSessionQueue": "aws-cdk-lib/aws-gamelift.CfnGameSessionQueue", + "AWS::GameLift::Location": "aws-cdk-lib/aws-gamelift.CfnLocation", + "AWS::GameLift::MatchmakingConfiguration": "aws-cdk-lib/aws-gamelift.CfnMatchmakingConfiguration", + "AWS::GameLift::MatchmakingRuleSet": "aws-cdk-lib/aws-gamelift.CfnMatchmakingRuleSet", + "AWS::GameLift::Script": "aws-cdk-lib/aws-gamelift.CfnScript", + "AWS::GlobalAccelerator::Accelerator": "aws-cdk-lib/aws-globalaccelerator.CfnAccelerator", + "AWS::GlobalAccelerator::EndpointGroup": "aws-cdk-lib/aws-globalaccelerator.CfnEndpointGroup", + "AWS::GlobalAccelerator::Listener": "aws-cdk-lib/aws-globalaccelerator.CfnListener", + "AWS::Glue::Classifier": "aws-cdk-lib/aws-glue.CfnClassifier", + "AWS::Glue::Connection": "aws-cdk-lib/aws-glue.CfnConnection", + "AWS::Glue::Crawler": "aws-cdk-lib/aws-glue.CfnCrawler", + "AWS::Glue::DataCatalogEncryptionSettings": "aws-cdk-lib/aws-glue.CfnDataCatalogEncryptionSettings", + "AWS::Glue::Database": "aws-cdk-lib/aws-glue.CfnDatabase", + "AWS::Glue::DevEndpoint": "aws-cdk-lib/aws-glue.CfnDevEndpoint", + "AWS::Glue::Job": "aws-cdk-lib/aws-glue.CfnJob", + "AWS::Glue::MLTransform": "aws-cdk-lib/aws-glue.CfnMLTransform", + "AWS::Glue::Partition": "aws-cdk-lib/aws-glue.CfnPartition", + "AWS::Glue::Registry": "aws-cdk-lib/aws-glue.CfnRegistry", + "AWS::Glue::Schema": "aws-cdk-lib/aws-glue.CfnSchema", + "AWS::Glue::SchemaVersion": "aws-cdk-lib/aws-glue.CfnSchemaVersion", + "AWS::Glue::SchemaVersionMetadata": "aws-cdk-lib/aws-glue.CfnSchemaVersionMetadata", + "AWS::Glue::SecurityConfiguration": "aws-cdk-lib/aws-glue.CfnSecurityConfiguration", + "AWS::Glue::Table": "aws-cdk-lib/aws-glue.CfnTable", + "AWS::Glue::Trigger": "aws-cdk-lib/aws-glue.CfnTrigger", + "AWS::Glue::Workflow": "aws-cdk-lib/aws-glue.CfnWorkflow", + "AWS::Grafana::Workspace": "aws-cdk-lib/aws-grafana.CfnWorkspace", + "AWS::Greengrass::ConnectorDefinition": "aws-cdk-lib/aws-greengrass.CfnConnectorDefinition", + "AWS::Greengrass::ConnectorDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnConnectorDefinitionVersion", + "AWS::Greengrass::CoreDefinition": "aws-cdk-lib/aws-greengrass.CfnCoreDefinition", + "AWS::Greengrass::CoreDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnCoreDefinitionVersion", + "AWS::Greengrass::DeviceDefinition": "aws-cdk-lib/aws-greengrass.CfnDeviceDefinition", + "AWS::Greengrass::DeviceDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnDeviceDefinitionVersion", + "AWS::Greengrass::FunctionDefinition": "aws-cdk-lib/aws-greengrass.CfnFunctionDefinition", + "AWS::Greengrass::FunctionDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnFunctionDefinitionVersion", + "AWS::Greengrass::Group": "aws-cdk-lib/aws-greengrass.CfnGroup", + "AWS::Greengrass::GroupVersion": "aws-cdk-lib/aws-greengrass.CfnGroupVersion", + "AWS::Greengrass::LoggerDefinition": "aws-cdk-lib/aws-greengrass.CfnLoggerDefinition", + "AWS::Greengrass::LoggerDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnLoggerDefinitionVersion", + "AWS::Greengrass::ResourceDefinition": "aws-cdk-lib/aws-greengrass.CfnResourceDefinition", + "AWS::Greengrass::ResourceDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnResourceDefinitionVersion", + "AWS::Greengrass::SubscriptionDefinition": "aws-cdk-lib/aws-greengrass.CfnSubscriptionDefinition", + "AWS::Greengrass::SubscriptionDefinitionVersion": "aws-cdk-lib/aws-greengrass.CfnSubscriptionDefinitionVersion", + "AWS::GreengrassV2::ComponentVersion": "aws-cdk-lib/aws-greengrassv2.CfnComponentVersion", + "AWS::GreengrassV2::Deployment": "aws-cdk-lib/aws-greengrassv2.CfnDeployment", + "AWS::GroundStation::Config": "aws-cdk-lib/aws-groundstation.CfnConfig", + "AWS::GroundStation::DataflowEndpointGroup": "aws-cdk-lib/aws-groundstation.CfnDataflowEndpointGroup", + "AWS::GroundStation::MissionProfile": "aws-cdk-lib/aws-groundstation.CfnMissionProfile", + "AWS::GuardDuty::Detector": "aws-cdk-lib/aws-guardduty.CfnDetector", + "AWS::GuardDuty::Filter": "aws-cdk-lib/aws-guardduty.CfnFilter", + "AWS::GuardDuty::IPSet": "aws-cdk-lib/aws-guardduty.CfnIPSet", + "AWS::GuardDuty::Master": "aws-cdk-lib/aws-guardduty.CfnMaster", + "AWS::GuardDuty::Member": "aws-cdk-lib/aws-guardduty.CfnMember", + "AWS::GuardDuty::ThreatIntelSet": "aws-cdk-lib/aws-guardduty.CfnThreatIntelSet", + "AWS::HealthLake::FHIRDatastore": "aws-cdk-lib/aws-healthlake.CfnFHIRDatastore", + "AWS::IAM::AccessKey": "aws-cdk-lib/aws-iam.CfnAccessKey", + "AWS::IAM::Group": "aws-cdk-lib/aws-iam.CfnGroup", + "AWS::IAM::InstanceProfile": "aws-cdk-lib/aws-iam.CfnInstanceProfile", + "AWS::IAM::ManagedPolicy": "aws-cdk-lib/aws-iam.CfnManagedPolicy", + "AWS::IAM::OIDCProvider": "aws-cdk-lib/aws-iam.CfnOIDCProvider", + "AWS::IAM::Policy": "aws-cdk-lib/aws-iam.CfnPolicy", + "AWS::IAM::Role": "aws-cdk-lib/aws-iam.CfnRole", + "AWS::IAM::SAMLProvider": "aws-cdk-lib/aws-iam.CfnSAMLProvider", + "AWS::IAM::ServerCertificate": "aws-cdk-lib/aws-iam.CfnServerCertificate", + "AWS::IAM::ServiceLinkedRole": "aws-cdk-lib/aws-iam.CfnServiceLinkedRole", + "AWS::IAM::User": "aws-cdk-lib/aws-iam.CfnUser", + "AWS::IAM::UserToGroupAddition": "aws-cdk-lib/aws-iam.CfnUserToGroupAddition", + "AWS::IAM::VirtualMFADevice": "aws-cdk-lib/aws-iam.CfnVirtualMFADevice", + "AWS::IdentityStore::Group": "aws-cdk-lib/aws-identitystore.CfnGroup", + "AWS::IdentityStore::GroupMembership": "aws-cdk-lib/aws-identitystore.CfnGroupMembership", + "AWS::ImageBuilder::Component": "aws-cdk-lib/aws-imagebuilder.CfnComponent", + "AWS::ImageBuilder::ContainerRecipe": "aws-cdk-lib/aws-imagebuilder.CfnContainerRecipe", + "AWS::ImageBuilder::DistributionConfiguration": "aws-cdk-lib/aws-imagebuilder.CfnDistributionConfiguration", + "AWS::ImageBuilder::Image": "aws-cdk-lib/aws-imagebuilder.CfnImage", + "AWS::ImageBuilder::ImagePipeline": "aws-cdk-lib/aws-imagebuilder.CfnImagePipeline", + "AWS::ImageBuilder::ImageRecipe": "aws-cdk-lib/aws-imagebuilder.CfnImageRecipe", + "AWS::ImageBuilder::InfrastructureConfiguration": "aws-cdk-lib/aws-imagebuilder.CfnInfrastructureConfiguration", + "AWS::Inspector::AssessmentTarget": "aws-cdk-lib/aws-inspector.CfnAssessmentTarget", + "AWS::Inspector::AssessmentTemplate": "aws-cdk-lib/aws-inspector.CfnAssessmentTemplate", + "AWS::Inspector::ResourceGroup": "aws-cdk-lib/aws-inspector.CfnResourceGroup", + "AWS::InspectorV2::Filter": "aws-cdk-lib/aws-inspectorv2.CfnFilter", + "AWS::InternetMonitor::Monitor": "aws-cdk-lib/aws-internetmonitor.CfnMonitor", + "AWS::IoT::AccountAuditConfiguration": "aws-cdk-lib/aws-iot.CfnAccountAuditConfiguration", + "AWS::IoT::Authorizer": "aws-cdk-lib/aws-iot.CfnAuthorizer", + "AWS::IoT::CACertificate": "aws-cdk-lib/aws-iot.CfnCACertificate", + "AWS::IoT::Certificate": "aws-cdk-lib/aws-iot.CfnCertificate", + "AWS::IoT::CustomMetric": "aws-cdk-lib/aws-iot.CfnCustomMetric", + "AWS::IoT::Dimension": "aws-cdk-lib/aws-iot.CfnDimension", + "AWS::IoT::DomainConfiguration": "aws-cdk-lib/aws-iot.CfnDomainConfiguration", + "AWS::IoT::FleetMetric": "aws-cdk-lib/aws-iot.CfnFleetMetric", + "AWS::IoT::JobTemplate": "aws-cdk-lib/aws-iot.CfnJobTemplate", + "AWS::IoT::Logging": "aws-cdk-lib/aws-iot.CfnLogging", + "AWS::IoT::MitigationAction": "aws-cdk-lib/aws-iot.CfnMitigationAction", + "AWS::IoT::Policy": "aws-cdk-lib/aws-iot.CfnPolicy", + "AWS::IoT::PolicyPrincipalAttachment": "aws-cdk-lib/aws-iot.CfnPolicyPrincipalAttachment", + "AWS::IoT::ProvisioningTemplate": "aws-cdk-lib/aws-iot.CfnProvisioningTemplate", + "AWS::IoT::ResourceSpecificLogging": "aws-cdk-lib/aws-iot.CfnResourceSpecificLogging", + "AWS::IoT::RoleAlias": "aws-cdk-lib/aws-iot.CfnRoleAlias", + "AWS::IoT::ScheduledAudit": "aws-cdk-lib/aws-iot.CfnScheduledAudit", + "AWS::IoT::SecurityProfile": "aws-cdk-lib/aws-iot.CfnSecurityProfile", + "AWS::IoT::Thing": "aws-cdk-lib/aws-iot.CfnThing", + "AWS::IoT::ThingPrincipalAttachment": "aws-cdk-lib/aws-iot.CfnThingPrincipalAttachment", + "AWS::IoT::TopicRule": "aws-cdk-lib/aws-iot.CfnTopicRule", + "AWS::IoT::TopicRuleDestination": "aws-cdk-lib/aws-iot.CfnTopicRuleDestination", + "AWS::IoT1Click::Device": "aws-cdk-lib/aws-iot1click.CfnDevice", + "AWS::IoT1Click::Placement": "aws-cdk-lib/aws-iot1click.CfnPlacement", + "AWS::IoT1Click::Project": "aws-cdk-lib/aws-iot1click.CfnProject", + "AWS::IoTAnalytics::Channel": "aws-cdk-lib/aws-iotanalytics.CfnChannel", + "AWS::IoTAnalytics::Dataset": "aws-cdk-lib/aws-iotanalytics.CfnDataset", + "AWS::IoTAnalytics::Datastore": "aws-cdk-lib/aws-iotanalytics.CfnDatastore", + "AWS::IoTAnalytics::Pipeline": "aws-cdk-lib/aws-iotanalytics.CfnPipeline", + "AWS::IoTCoreDeviceAdvisor::SuiteDefinition": "aws-cdk-lib/aws-iotcoredeviceadvisor.CfnSuiteDefinition", + "AWS::IoTEvents::AlarmModel": "aws-cdk-lib/aws-iotevents.CfnAlarmModel", + "AWS::IoTEvents::DetectorModel": "aws-cdk-lib/aws-iotevents.CfnDetectorModel", + "AWS::IoTEvents::Input": "aws-cdk-lib/aws-iotevents.CfnInput", + "AWS::IoTFleetHub::Application": "aws-cdk-lib/aws-iotfleethub.CfnApplication", + "AWS::IoTFleetWise::Campaign": "aws-cdk-lib/aws-iotfleetwise.CfnCampaign", + "AWS::IoTFleetWise::DecoderManifest": "aws-cdk-lib/aws-iotfleetwise.CfnDecoderManifest", + "AWS::IoTFleetWise::Fleet": "aws-cdk-lib/aws-iotfleetwise.CfnFleet", + "AWS::IoTFleetWise::ModelManifest": "aws-cdk-lib/aws-iotfleetwise.CfnModelManifest", + "AWS::IoTFleetWise::SignalCatalog": "aws-cdk-lib/aws-iotfleetwise.CfnSignalCatalog", + "AWS::IoTFleetWise::Vehicle": "aws-cdk-lib/aws-iotfleetwise.CfnVehicle", + "AWS::IoTSiteWise::AccessPolicy": "aws-cdk-lib/aws-iotsitewise.CfnAccessPolicy", + "AWS::IoTSiteWise::Asset": "aws-cdk-lib/aws-iotsitewise.CfnAsset", + "AWS::IoTSiteWise::AssetModel": "aws-cdk-lib/aws-iotsitewise.CfnAssetModel", + "AWS::IoTSiteWise::Dashboard": "aws-cdk-lib/aws-iotsitewise.CfnDashboard", + "AWS::IoTSiteWise::Gateway": "aws-cdk-lib/aws-iotsitewise.CfnGateway", + "AWS::IoTSiteWise::Portal": "aws-cdk-lib/aws-iotsitewise.CfnPortal", + "AWS::IoTSiteWise::Project": "aws-cdk-lib/aws-iotsitewise.CfnProject", + "AWS::IoTThingsGraph::FlowTemplate": "aws-cdk-lib/aws-iotthingsgraph.CfnFlowTemplate", + "AWS::IoTTwinMaker::ComponentType": "aws-cdk-lib/aws-iottwinmaker.CfnComponentType", + "AWS::IoTTwinMaker::Entity": "aws-cdk-lib/aws-iottwinmaker.CfnEntity", + "AWS::IoTTwinMaker::Scene": "aws-cdk-lib/aws-iottwinmaker.CfnScene", + "AWS::IoTTwinMaker::SyncJob": "aws-cdk-lib/aws-iottwinmaker.CfnSyncJob", + "AWS::IoTTwinMaker::Workspace": "aws-cdk-lib/aws-iottwinmaker.CfnWorkspace", + "AWS::IoTWireless::Destination": "aws-cdk-lib/aws-iotwireless.CfnDestination", + "AWS::IoTWireless::DeviceProfile": "aws-cdk-lib/aws-iotwireless.CfnDeviceProfile", + "AWS::IoTWireless::FuotaTask": "aws-cdk-lib/aws-iotwireless.CfnFuotaTask", + "AWS::IoTWireless::MulticastGroup": "aws-cdk-lib/aws-iotwireless.CfnMulticastGroup", + "AWS::IoTWireless::NetworkAnalyzerConfiguration": "aws-cdk-lib/aws-iotwireless.CfnNetworkAnalyzerConfiguration", + "AWS::IoTWireless::PartnerAccount": "aws-cdk-lib/aws-iotwireless.CfnPartnerAccount", + "AWS::IoTWireless::ServiceProfile": "aws-cdk-lib/aws-iotwireless.CfnServiceProfile", + "AWS::IoTWireless::TaskDefinition": "aws-cdk-lib/aws-iotwireless.CfnTaskDefinition", + "AWS::IoTWireless::WirelessDevice": "aws-cdk-lib/aws-iotwireless.CfnWirelessDevice", + "AWS::IoTWireless::WirelessGateway": "aws-cdk-lib/aws-iotwireless.CfnWirelessGateway", + "AWS::IVS::Channel": "aws-cdk-lib/aws-ivs.CfnChannel", + "AWS::IVS::PlaybackKeyPair": "aws-cdk-lib/aws-ivs.CfnPlaybackKeyPair", + "AWS::IVS::RecordingConfiguration": "aws-cdk-lib/aws-ivs.CfnRecordingConfiguration", + "AWS::IVS::StreamKey": "aws-cdk-lib/aws-ivs.CfnStreamKey", + "AWS::IVSChat::LoggingConfiguration": "aws-cdk-lib/aws-ivschat.CfnLoggingConfiguration", + "AWS::IVSChat::Room": "aws-cdk-lib/aws-ivschat.CfnRoom", + "AWS::KafkaConnect::Connector": "aws-cdk-lib/aws-kafkaconnect.CfnConnector", + "AWS::Kendra::DataSource": "aws-cdk-lib/aws-kendra.CfnDataSource", + "AWS::Kendra::Faq": "aws-cdk-lib/aws-kendra.CfnFaq", + "AWS::Kendra::Index": "aws-cdk-lib/aws-kendra.CfnIndex", + "AWS::KendraRanking::ExecutionPlan": "aws-cdk-lib/aws-kendraranking.CfnExecutionPlan", + "AWS::Kinesis::Stream": "aws-cdk-lib/aws-kinesis.CfnStream", + "AWS::Kinesis::StreamConsumer": "aws-cdk-lib/aws-kinesis.CfnStreamConsumer", + "AWS::KinesisAnalytics::Application": "aws-cdk-lib/aws-kinesisanalytics.CfnApplication", + "AWS::KinesisAnalytics::ApplicationOutput": "aws-cdk-lib/aws-kinesisanalytics.CfnApplicationOutput", + "AWS::KinesisAnalytics::ApplicationReferenceDataSource": "aws-cdk-lib/aws-kinesisanalytics.CfnApplicationReferenceDataSource", + "AWS::KinesisAnalyticsV2::Application": "aws-cdk-lib/aws-kinesisanalyticsv2.CfnApplication", + "AWS::KinesisAnalyticsV2::ApplicationCloudWatchLoggingOption": "aws-cdk-lib/aws-kinesisanalyticsv2.CfnApplicationCloudWatchLoggingOption", + "AWS::KinesisAnalyticsV2::ApplicationOutput": "aws-cdk-lib/aws-kinesisanalyticsv2.CfnApplicationOutput", + "AWS::KinesisAnalyticsV2::ApplicationReferenceDataSource": "aws-cdk-lib/aws-kinesisanalyticsv2.CfnApplicationReferenceDataSource", + "AWS::KinesisFirehose::DeliveryStream": "aws-cdk-lib/aws-kinesisfirehose.CfnDeliveryStream", + "AWS::KinesisVideo::SignalingChannel": "aws-cdk-lib/aws-kinesisvideo.CfnSignalingChannel", + "AWS::KinesisVideo::Stream": "aws-cdk-lib/aws-kinesisvideo.CfnStream", + "AWS::KMS::Alias": "aws-cdk-lib/aws-kms.CfnAlias", + "AWS::KMS::Key": "aws-cdk-lib/aws-kms.CfnKey", + "AWS::KMS::ReplicaKey": "aws-cdk-lib/aws-kms.CfnReplicaKey", + "AWS::LakeFormation::DataCellsFilter": "aws-cdk-lib/aws-lakeformation.CfnDataCellsFilter", + "AWS::LakeFormation::DataLakeSettings": "aws-cdk-lib/aws-lakeformation.CfnDataLakeSettings", + "AWS::LakeFormation::Permissions": "aws-cdk-lib/aws-lakeformation.CfnPermissions", + "AWS::LakeFormation::PrincipalPermissions": "aws-cdk-lib/aws-lakeformation.CfnPrincipalPermissions", + "AWS::LakeFormation::Resource": "aws-cdk-lib/aws-lakeformation.CfnResource", + "AWS::LakeFormation::Tag": "aws-cdk-lib/aws-lakeformation.CfnTag", + "AWS::LakeFormation::TagAssociation": "aws-cdk-lib/aws-lakeformation.CfnTagAssociation", + "AWS::Lambda::Alias": "aws-cdk-lib/aws-lambda.CfnAlias", + "AWS::Lambda::CodeSigningConfig": "aws-cdk-lib/aws-lambda.CfnCodeSigningConfig", + "AWS::Lambda::EventInvokeConfig": "aws-cdk-lib/aws-lambda.CfnEventInvokeConfig", + "AWS::Lambda::EventSourceMapping": "aws-cdk-lib/aws-lambda.CfnEventSourceMapping", + "AWS::Lambda::Function": "aws-cdk-lib/aws-lambda.CfnFunction", + "AWS::Lambda::LayerVersion": "aws-cdk-lib/aws-lambda.CfnLayerVersion", + "AWS::Lambda::LayerVersionPermission": "aws-cdk-lib/aws-lambda.CfnLayerVersionPermission", + "AWS::Lambda::Permission": "aws-cdk-lib/aws-lambda.CfnPermission", + "AWS::Lambda::Url": "aws-cdk-lib/aws-lambda.CfnUrl", + "AWS::Lambda::Version": "aws-cdk-lib/aws-lambda.CfnVersion", + "AWS::Lex::Bot": "aws-cdk-lib/aws-lex.CfnBot", + "AWS::Lex::BotAlias": "aws-cdk-lib/aws-lex.CfnBotAlias", + "AWS::Lex::BotVersion": "aws-cdk-lib/aws-lex.CfnBotVersion", + "AWS::Lex::ResourcePolicy": "aws-cdk-lib/aws-lex.CfnResourcePolicy", + "AWS::LicenseManager::Grant": "aws-cdk-lib/aws-licensemanager.CfnGrant", + "AWS::LicenseManager::License": "aws-cdk-lib/aws-licensemanager.CfnLicense", + "AWS::Lightsail::Alarm": "aws-cdk-lib/aws-lightsail.CfnAlarm", + "AWS::Lightsail::Bucket": "aws-cdk-lib/aws-lightsail.CfnBucket", + "AWS::Lightsail::Certificate": "aws-cdk-lib/aws-lightsail.CfnCertificate", + "AWS::Lightsail::Container": "aws-cdk-lib/aws-lightsail.CfnContainer", + "AWS::Lightsail::Database": "aws-cdk-lib/aws-lightsail.CfnDatabase", + "AWS::Lightsail::Disk": "aws-cdk-lib/aws-lightsail.CfnDisk", + "AWS::Lightsail::Distribution": "aws-cdk-lib/aws-lightsail.CfnDistribution", + "AWS::Lightsail::Instance": "aws-cdk-lib/aws-lightsail.CfnInstance", + "AWS::Lightsail::LoadBalancer": "aws-cdk-lib/aws-lightsail.CfnLoadBalancer", + "AWS::Lightsail::LoadBalancerTlsCertificate": "aws-cdk-lib/aws-lightsail.CfnLoadBalancerTlsCertificate", + "AWS::Lightsail::StaticIp": "aws-cdk-lib/aws-lightsail.CfnStaticIp", + "AWS::Location::GeofenceCollection": "aws-cdk-lib/aws-location.CfnGeofenceCollection", + "AWS::Location::Map": "aws-cdk-lib/aws-location.CfnMap", + "AWS::Location::PlaceIndex": "aws-cdk-lib/aws-location.CfnPlaceIndex", + "AWS::Location::RouteCalculator": "aws-cdk-lib/aws-location.CfnRouteCalculator", + "AWS::Location::Tracker": "aws-cdk-lib/aws-location.CfnTracker", + "AWS::Location::TrackerConsumer": "aws-cdk-lib/aws-location.CfnTrackerConsumer", + "AWS::Logs::Destination": "aws-cdk-lib/aws-logs.CfnDestination", + "AWS::Logs::LogGroup": "aws-cdk-lib/aws-logs.CfnLogGroup", + "AWS::Logs::LogStream": "aws-cdk-lib/aws-logs.CfnLogStream", + "AWS::Logs::MetricFilter": "aws-cdk-lib/aws-logs.CfnMetricFilter", + "AWS::Logs::QueryDefinition": "aws-cdk-lib/aws-logs.CfnQueryDefinition", + "AWS::Logs::ResourcePolicy": "aws-cdk-lib/aws-logs.CfnResourcePolicy", + "AWS::Logs::SubscriptionFilter": "aws-cdk-lib/aws-logs.CfnSubscriptionFilter", + "AWS::LookoutEquipment::InferenceScheduler": "aws-cdk-lib/aws-lookoutequipment.CfnInferenceScheduler", + "AWS::LookoutMetrics::Alert": "aws-cdk-lib/aws-lookoutmetrics.CfnAlert", + "AWS::LookoutMetrics::AnomalyDetector": "aws-cdk-lib/aws-lookoutmetrics.CfnAnomalyDetector", + "AWS::LookoutVision::Project": "aws-cdk-lib/aws-lookoutvision.CfnProject", + "AWS::M2::Application": "aws-cdk-lib/aws-m2.CfnApplication", + "AWS::M2::Environment": "aws-cdk-lib/aws-m2.CfnEnvironment", + "AWS::Macie::AllowList": "aws-cdk-lib/aws-macie.CfnAllowList", + "AWS::Macie::CustomDataIdentifier": "aws-cdk-lib/aws-macie.CfnCustomDataIdentifier", + "AWS::Macie::FindingsFilter": "aws-cdk-lib/aws-macie.CfnFindingsFilter", + "AWS::Macie::Session": "aws-cdk-lib/aws-macie.CfnSession", + "AWS::ManagedBlockchain::Accessor": "aws-cdk-lib/aws-managedblockchain.CfnAccessor", + "AWS::ManagedBlockchain::Member": "aws-cdk-lib/aws-managedblockchain.CfnMember", + "AWS::ManagedBlockchain::Node": "aws-cdk-lib/aws-managedblockchain.CfnNode", + "AWS::MediaConnect::Flow": "aws-cdk-lib/aws-mediaconnect.CfnFlow", + "AWS::MediaConnect::FlowEntitlement": "aws-cdk-lib/aws-mediaconnect.CfnFlowEntitlement", + "AWS::MediaConnect::FlowOutput": "aws-cdk-lib/aws-mediaconnect.CfnFlowOutput", + "AWS::MediaConnect::FlowSource": "aws-cdk-lib/aws-mediaconnect.CfnFlowSource", + "AWS::MediaConnect::FlowVpcInterface": "aws-cdk-lib/aws-mediaconnect.CfnFlowVpcInterface", + "AWS::MediaConvert::JobTemplate": "aws-cdk-lib/aws-mediaconvert.CfnJobTemplate", + "AWS::MediaConvert::Preset": "aws-cdk-lib/aws-mediaconvert.CfnPreset", + "AWS::MediaConvert::Queue": "aws-cdk-lib/aws-mediaconvert.CfnQueue", + "AWS::MediaLive::Channel": "aws-cdk-lib/aws-medialive.CfnChannel", + "AWS::MediaLive::Input": "aws-cdk-lib/aws-medialive.CfnInput", + "AWS::MediaLive::InputSecurityGroup": "aws-cdk-lib/aws-medialive.CfnInputSecurityGroup", + "AWS::MediaPackage::Asset": "aws-cdk-lib/aws-mediapackage.CfnAsset", + "AWS::MediaPackage::Channel": "aws-cdk-lib/aws-mediapackage.CfnChannel", + "AWS::MediaPackage::OriginEndpoint": "aws-cdk-lib/aws-mediapackage.CfnOriginEndpoint", + "AWS::MediaPackage::PackagingConfiguration": "aws-cdk-lib/aws-mediapackage.CfnPackagingConfiguration", + "AWS::MediaPackage::PackagingGroup": "aws-cdk-lib/aws-mediapackage.CfnPackagingGroup", + "AWS::MediaStore::Container": "aws-cdk-lib/aws-mediastore.CfnContainer", + "AWS::MediaTailor::PlaybackConfiguration": "aws-cdk-lib/aws-mediatailor.CfnPlaybackConfiguration", + "AWS::MemoryDB::ACL": "aws-cdk-lib/aws-memorydb.CfnACL", + "AWS::MemoryDB::Cluster": "aws-cdk-lib/aws-memorydb.CfnCluster", + "AWS::MemoryDB::ParameterGroup": "aws-cdk-lib/aws-memorydb.CfnParameterGroup", + "AWS::MemoryDB::SubnetGroup": "aws-cdk-lib/aws-memorydb.CfnSubnetGroup", + "AWS::MemoryDB::User": "aws-cdk-lib/aws-memorydb.CfnUser", + "AWS::MSK::BatchScramSecret": "aws-cdk-lib/aws-msk.CfnBatchScramSecret", + "AWS::MSK::Cluster": "aws-cdk-lib/aws-msk.CfnCluster", + "AWS::MSK::Configuration": "aws-cdk-lib/aws-msk.CfnConfiguration", + "AWS::MSK::ServerlessCluster": "aws-cdk-lib/aws-msk.CfnServerlessCluster", + "AWS::MWAA::Environment": "aws-cdk-lib/aws-mwaa.CfnEnvironment", + "AWS::Neptune::DBCluster": "aws-cdk-lib/aws-neptune.CfnDBCluster", + "AWS::Neptune::DBClusterParameterGroup": "aws-cdk-lib/aws-neptune.CfnDBClusterParameterGroup", + "AWS::Neptune::DBInstance": "aws-cdk-lib/aws-neptune.CfnDBInstance", + "AWS::Neptune::DBParameterGroup": "aws-cdk-lib/aws-neptune.CfnDBParameterGroup", + "AWS::Neptune::DBSubnetGroup": "aws-cdk-lib/aws-neptune.CfnDBSubnetGroup", + "AWS::NetworkFirewall::Firewall": "aws-cdk-lib/aws-networkfirewall.CfnFirewall", + "AWS::NetworkFirewall::FirewallPolicy": "aws-cdk-lib/aws-networkfirewall.CfnFirewallPolicy", + "AWS::NetworkFirewall::LoggingConfiguration": "aws-cdk-lib/aws-networkfirewall.CfnLoggingConfiguration", + "AWS::NetworkFirewall::RuleGroup": "aws-cdk-lib/aws-networkfirewall.CfnRuleGroup", + "AWS::NetworkManager::ConnectAttachment": "aws-cdk-lib/aws-networkmanager.CfnConnectAttachment", + "AWS::NetworkManager::ConnectPeer": "aws-cdk-lib/aws-networkmanager.CfnConnectPeer", + "AWS::NetworkManager::CoreNetwork": "aws-cdk-lib/aws-networkmanager.CfnCoreNetwork", + "AWS::NetworkManager::CustomerGatewayAssociation": "aws-cdk-lib/aws-networkmanager.CfnCustomerGatewayAssociation", + "AWS::NetworkManager::Device": "aws-cdk-lib/aws-networkmanager.CfnDevice", + "AWS::NetworkManager::GlobalNetwork": "aws-cdk-lib/aws-networkmanager.CfnGlobalNetwork", + "AWS::NetworkManager::Link": "aws-cdk-lib/aws-networkmanager.CfnLink", + "AWS::NetworkManager::LinkAssociation": "aws-cdk-lib/aws-networkmanager.CfnLinkAssociation", + "AWS::NetworkManager::Site": "aws-cdk-lib/aws-networkmanager.CfnSite", + "AWS::NetworkManager::SiteToSiteVpnAttachment": "aws-cdk-lib/aws-networkmanager.CfnSiteToSiteVpnAttachment", + "AWS::NetworkManager::TransitGatewayPeering": "aws-cdk-lib/aws-networkmanager.CfnTransitGatewayPeering", + "AWS::NetworkManager::TransitGatewayRegistration": "aws-cdk-lib/aws-networkmanager.CfnTransitGatewayRegistration", + "AWS::NetworkManager::TransitGatewayRouteTableAttachment": "aws-cdk-lib/aws-networkmanager.CfnTransitGatewayRouteTableAttachment", + "AWS::NetworkManager::VpcAttachment": "aws-cdk-lib/aws-networkmanager.CfnVpcAttachment", + "AWS::NimbleStudio::LaunchProfile": "aws-cdk-lib/aws-nimblestudio.CfnLaunchProfile", + "AWS::NimbleStudio::StreamingImage": "aws-cdk-lib/aws-nimblestudio.CfnStreamingImage", + "AWS::NimbleStudio::Studio": "aws-cdk-lib/aws-nimblestudio.CfnStudio", + "AWS::NimbleStudio::StudioComponent": "aws-cdk-lib/aws-nimblestudio.CfnStudioComponent", + "AWS::Oam::Link": "aws-cdk-lib/aws-oam.CfnLink", + "AWS::Oam::Sink": "aws-cdk-lib/aws-oam.CfnSink", + "AWS::Omics::AnnotationStore": "aws-cdk-lib/aws-omics.CfnAnnotationStore", + "AWS::Omics::ReferenceStore": "aws-cdk-lib/aws-omics.CfnReferenceStore", + "AWS::Omics::RunGroup": "aws-cdk-lib/aws-omics.CfnRunGroup", + "AWS::Omics::SequenceStore": "aws-cdk-lib/aws-omics.CfnSequenceStore", + "AWS::Omics::VariantStore": "aws-cdk-lib/aws-omics.CfnVariantStore", + "AWS::Omics::Workflow": "aws-cdk-lib/aws-omics.CfnWorkflow", + "AWS::OpenSearchServerless::AccessPolicy": "aws-cdk-lib/aws-opensearchserverless.CfnAccessPolicy", + "AWS::OpenSearchServerless::Collection": "aws-cdk-lib/aws-opensearchserverless.CfnCollection", + "AWS::OpenSearchServerless::SecurityConfig": "aws-cdk-lib/aws-opensearchserverless.CfnSecurityConfig", + "AWS::OpenSearchServerless::SecurityPolicy": "aws-cdk-lib/aws-opensearchserverless.CfnSecurityPolicy", + "AWS::OpenSearchServerless::VpcEndpoint": "aws-cdk-lib/aws-opensearchserverless.CfnVpcEndpoint", + "AWS::OpenSearchService::Domain": "aws-cdk-lib/aws-opensearchservice.CfnDomain", + "AWS::OpsWorks::App": "aws-cdk-lib/aws-opsworks.CfnApp", + "AWS::OpsWorks::ElasticLoadBalancerAttachment": "aws-cdk-lib/aws-opsworks.CfnElasticLoadBalancerAttachment", + "AWS::OpsWorks::Instance": "aws-cdk-lib/aws-opsworks.CfnInstance", + "AWS::OpsWorks::Layer": "aws-cdk-lib/aws-opsworks.CfnLayer", + "AWS::OpsWorks::Stack": "aws-cdk-lib/aws-opsworks.CfnStack", + "AWS::OpsWorks::UserProfile": "aws-cdk-lib/aws-opsworks.CfnUserProfile", + "AWS::OpsWorks::Volume": "aws-cdk-lib/aws-opsworks.CfnVolume", + "AWS::OpsWorksCM::Server": "aws-cdk-lib/aws-opsworkscm.CfnServer", + "AWS::Organizations::Account": "aws-cdk-lib/aws-organizations.CfnAccount", + "AWS::Organizations::OrganizationalUnit": "aws-cdk-lib/aws-organizations.CfnOrganizationalUnit", + "AWS::Organizations::Policy": "aws-cdk-lib/aws-organizations.CfnPolicy", + "AWS::Organizations::ResourcePolicy": "aws-cdk-lib/aws-organizations.CfnResourcePolicy", + "AWS::Panorama::ApplicationInstance": "aws-cdk-lib/aws-panorama.CfnApplicationInstance", + "AWS::Panorama::Package": "aws-cdk-lib/aws-panorama.CfnPackage", + "AWS::Panorama::PackageVersion": "aws-cdk-lib/aws-panorama.CfnPackageVersion", + "AWS::Personalize::Dataset": "aws-cdk-lib/aws-personalize.CfnDataset", + "AWS::Personalize::DatasetGroup": "aws-cdk-lib/aws-personalize.CfnDatasetGroup", + "AWS::Personalize::Schema": "aws-cdk-lib/aws-personalize.CfnSchema", + "AWS::Personalize::Solution": "aws-cdk-lib/aws-personalize.CfnSolution", + "AWS::Pinpoint::ADMChannel": "aws-cdk-lib/aws-pinpoint.CfnADMChannel", + "AWS::Pinpoint::APNSChannel": "aws-cdk-lib/aws-pinpoint.CfnAPNSChannel", + "AWS::Pinpoint::APNSSandboxChannel": "aws-cdk-lib/aws-pinpoint.CfnAPNSSandboxChannel", + "AWS::Pinpoint::APNSVoipChannel": "aws-cdk-lib/aws-pinpoint.CfnAPNSVoipChannel", + "AWS::Pinpoint::APNSVoipSandboxChannel": "aws-cdk-lib/aws-pinpoint.CfnAPNSVoipSandboxChannel", + "AWS::Pinpoint::App": "aws-cdk-lib/aws-pinpoint.CfnApp", + "AWS::Pinpoint::ApplicationSettings": "aws-cdk-lib/aws-pinpoint.CfnApplicationSettings", + "AWS::Pinpoint::BaiduChannel": "aws-cdk-lib/aws-pinpoint.CfnBaiduChannel", + "AWS::Pinpoint::Campaign": "aws-cdk-lib/aws-pinpoint.CfnCampaign", + "AWS::Pinpoint::EmailChannel": "aws-cdk-lib/aws-pinpoint.CfnEmailChannel", + "AWS::Pinpoint::EmailTemplate": "aws-cdk-lib/aws-pinpoint.CfnEmailTemplate", + "AWS::Pinpoint::EventStream": "aws-cdk-lib/aws-pinpoint.CfnEventStream", + "AWS::Pinpoint::GCMChannel": "aws-cdk-lib/aws-pinpoint.CfnGCMChannel", + "AWS::Pinpoint::InAppTemplate": "aws-cdk-lib/aws-pinpoint.CfnInAppTemplate", + "AWS::Pinpoint::PushTemplate": "aws-cdk-lib/aws-pinpoint.CfnPushTemplate", + "AWS::Pinpoint::SMSChannel": "aws-cdk-lib/aws-pinpoint.CfnSMSChannel", + "AWS::Pinpoint::Segment": "aws-cdk-lib/aws-pinpoint.CfnSegment", + "AWS::Pinpoint::SmsTemplate": "aws-cdk-lib/aws-pinpoint.CfnSmsTemplate", + "AWS::Pinpoint::VoiceChannel": "aws-cdk-lib/aws-pinpoint.CfnVoiceChannel", + "AWS::PinpointEmail::ConfigurationSet": "aws-cdk-lib/aws-pinpointemail.CfnConfigurationSet", + "AWS::PinpointEmail::ConfigurationSetEventDestination": "aws-cdk-lib/aws-pinpointemail.CfnConfigurationSetEventDestination", + "AWS::PinpointEmail::DedicatedIpPool": "aws-cdk-lib/aws-pinpointemail.CfnDedicatedIpPool", + "AWS::PinpointEmail::Identity": "aws-cdk-lib/aws-pinpointemail.CfnIdentity", + "AWS::Pipes::Pipe": "aws-cdk-lib/aws-pipes.CfnPipe", + "AWS::QLDB::Ledger": "aws-cdk-lib/aws-qldb.CfnLedger", + "AWS::QLDB::Stream": "aws-cdk-lib/aws-qldb.CfnStream", + "AWS::QuickSight::Analysis": "aws-cdk-lib/aws-quicksight.CfnAnalysis", + "AWS::QuickSight::Dashboard": "aws-cdk-lib/aws-quicksight.CfnDashboard", + "AWS::QuickSight::DataSet": "aws-cdk-lib/aws-quicksight.CfnDataSet", + "AWS::QuickSight::DataSource": "aws-cdk-lib/aws-quicksight.CfnDataSource", + "AWS::QuickSight::Template": "aws-cdk-lib/aws-quicksight.CfnTemplate", + "AWS::QuickSight::Theme": "aws-cdk-lib/aws-quicksight.CfnTheme", + "AWS::RAM::ResourceShare": "aws-cdk-lib/aws-ram.CfnResourceShare", + "AWS::RDS::DBCluster": "aws-cdk-lib/aws-rds.CfnDBCluster", + "AWS::RDS::DBClusterParameterGroup": "aws-cdk-lib/aws-rds.CfnDBClusterParameterGroup", + "AWS::RDS::DBInstance": "aws-cdk-lib/aws-rds.CfnDBInstance", + "AWS::RDS::DBParameterGroup": "aws-cdk-lib/aws-rds.CfnDBParameterGroup", + "AWS::RDS::DBProxy": "aws-cdk-lib/aws-rds.CfnDBProxy", + "AWS::RDS::DBProxyEndpoint": "aws-cdk-lib/aws-rds.CfnDBProxyEndpoint", + "AWS::RDS::DBProxyTargetGroup": "aws-cdk-lib/aws-rds.CfnDBProxyTargetGroup", + "AWS::RDS::DBSecurityGroup": "aws-cdk-lib/aws-rds.CfnDBSecurityGroup", + "AWS::RDS::DBSecurityGroupIngress": "aws-cdk-lib/aws-rds.CfnDBSecurityGroupIngress", + "AWS::RDS::DBSubnetGroup": "aws-cdk-lib/aws-rds.CfnDBSubnetGroup", + "AWS::RDS::EventSubscription": "aws-cdk-lib/aws-rds.CfnEventSubscription", + "AWS::RDS::GlobalCluster": "aws-cdk-lib/aws-rds.CfnGlobalCluster", + "AWS::RDS::OptionGroup": "aws-cdk-lib/aws-rds.CfnOptionGroup", + "AWS::Redshift::Cluster": "aws-cdk-lib/aws-redshift.CfnCluster", + "AWS::Redshift::ClusterParameterGroup": "aws-cdk-lib/aws-redshift.CfnClusterParameterGroup", + "AWS::Redshift::ClusterSecurityGroup": "aws-cdk-lib/aws-redshift.CfnClusterSecurityGroup", + "AWS::Redshift::ClusterSecurityGroupIngress": "aws-cdk-lib/aws-redshift.CfnClusterSecurityGroupIngress", + "AWS::Redshift::ClusterSubnetGroup": "aws-cdk-lib/aws-redshift.CfnClusterSubnetGroup", + "AWS::Redshift::EndpointAccess": "aws-cdk-lib/aws-redshift.CfnEndpointAccess", + "AWS::Redshift::EndpointAuthorization": "aws-cdk-lib/aws-redshift.CfnEndpointAuthorization", + "AWS::Redshift::EventSubscription": "aws-cdk-lib/aws-redshift.CfnEventSubscription", + "AWS::Redshift::ScheduledAction": "aws-cdk-lib/aws-redshift.CfnScheduledAction", + "AWS::RedshiftServerless::Namespace": "aws-cdk-lib/aws-redshiftserverless.CfnNamespace", + "AWS::RedshiftServerless::Workgroup": "aws-cdk-lib/aws-redshiftserverless.CfnWorkgroup", + "AWS::RefactorSpaces::Application": "aws-cdk-lib/aws-refactorspaces.CfnApplication", + "AWS::RefactorSpaces::Environment": "aws-cdk-lib/aws-refactorspaces.CfnEnvironment", + "AWS::RefactorSpaces::Route": "aws-cdk-lib/aws-refactorspaces.CfnRoute", + "AWS::RefactorSpaces::Service": "aws-cdk-lib/aws-refactorspaces.CfnService", + "AWS::Rekognition::Collection": "aws-cdk-lib/aws-rekognition.CfnCollection", + "AWS::Rekognition::Project": "aws-cdk-lib/aws-rekognition.CfnProject", + "AWS::Rekognition::StreamProcessor": "aws-cdk-lib/aws-rekognition.CfnStreamProcessor", + "AWS::ResilienceHub::App": "aws-cdk-lib/aws-resiliencehub.CfnApp", + "AWS::ResilienceHub::ResiliencyPolicy": "aws-cdk-lib/aws-resiliencehub.CfnResiliencyPolicy", + "AWS::ResourceExplorer2::DefaultViewAssociation": "aws-cdk-lib/aws-resourceexplorer2.CfnDefaultViewAssociation", + "AWS::ResourceExplorer2::Index": "aws-cdk-lib/aws-resourceexplorer2.CfnIndex", + "AWS::ResourceExplorer2::View": "aws-cdk-lib/aws-resourceexplorer2.CfnView", + "AWS::ResourceGroups::Group": "aws-cdk-lib/aws-resourcegroups.CfnGroup", + "AWS::RoboMaker::Fleet": "aws-cdk-lib/aws-robomaker.CfnFleet", + "AWS::RoboMaker::Robot": "aws-cdk-lib/aws-robomaker.CfnRobot", + "AWS::RoboMaker::RobotApplication": "aws-cdk-lib/aws-robomaker.CfnRobotApplication", + "AWS::RoboMaker::RobotApplicationVersion": "aws-cdk-lib/aws-robomaker.CfnRobotApplicationVersion", + "AWS::RoboMaker::SimulationApplication": "aws-cdk-lib/aws-robomaker.CfnSimulationApplication", + "AWS::RoboMaker::SimulationApplicationVersion": "aws-cdk-lib/aws-robomaker.CfnSimulationApplicationVersion", + "AWS::RolesAnywhere::CRL": "aws-cdk-lib/aws-rolesanywhere.CfnCRL", + "AWS::RolesAnywhere::Profile": "aws-cdk-lib/aws-rolesanywhere.CfnProfile", + "AWS::RolesAnywhere::TrustAnchor": "aws-cdk-lib/aws-rolesanywhere.CfnTrustAnchor", + "AWS::Route53::CidrCollection": "aws-cdk-lib/aws-route53.CfnCidrCollection", + "AWS::Route53::DNSSEC": "aws-cdk-lib/aws-route53.CfnDNSSEC", + "AWS::Route53::HealthCheck": "aws-cdk-lib/aws-route53.CfnHealthCheck", + "AWS::Route53::HostedZone": "aws-cdk-lib/aws-route53.CfnHostedZone", + "AWS::Route53::KeySigningKey": "aws-cdk-lib/aws-route53.CfnKeySigningKey", + "AWS::Route53::RecordSet": "aws-cdk-lib/aws-route53.CfnRecordSet", + "AWS::Route53::RecordSetGroup": "aws-cdk-lib/aws-route53.CfnRecordSetGroup", + "AWS::Route53RecoveryControl::Cluster": "aws-cdk-lib/aws-route53recoverycontrol.CfnCluster", + "AWS::Route53RecoveryControl::ControlPanel": "aws-cdk-lib/aws-route53recoverycontrol.CfnControlPanel", + "AWS::Route53RecoveryControl::RoutingControl": "aws-cdk-lib/aws-route53recoverycontrol.CfnRoutingControl", + "AWS::Route53RecoveryControl::SafetyRule": "aws-cdk-lib/aws-route53recoverycontrol.CfnSafetyRule", + "AWS::Route53RecoveryReadiness::Cell": "aws-cdk-lib/aws-route53recoveryreadiness.CfnCell", + "AWS::Route53RecoveryReadiness::ReadinessCheck": "aws-cdk-lib/aws-route53recoveryreadiness.CfnReadinessCheck", + "AWS::Route53RecoveryReadiness::RecoveryGroup": "aws-cdk-lib/aws-route53recoveryreadiness.CfnRecoveryGroup", + "AWS::Route53RecoveryReadiness::ResourceSet": "aws-cdk-lib/aws-route53recoveryreadiness.CfnResourceSet", + "AWS::Route53Resolver::FirewallDomainList": "aws-cdk-lib/aws-route53resolver.CfnFirewallDomainList", + "AWS::Route53Resolver::FirewallRuleGroup": "aws-cdk-lib/aws-route53resolver.CfnFirewallRuleGroup", + "AWS::Route53Resolver::FirewallRuleGroupAssociation": "aws-cdk-lib/aws-route53resolver.CfnFirewallRuleGroupAssociation", + "AWS::Route53Resolver::ResolverConfig": "aws-cdk-lib/aws-route53resolver.CfnResolverConfig", + "AWS::Route53Resolver::ResolverDNSSECConfig": "aws-cdk-lib/aws-route53resolver.CfnResolverDNSSECConfig", + "AWS::Route53Resolver::ResolverEndpoint": "aws-cdk-lib/aws-route53resolver.CfnResolverEndpoint", + "AWS::Route53Resolver::ResolverQueryLoggingConfig": "aws-cdk-lib/aws-route53resolver.CfnResolverQueryLoggingConfig", + "AWS::Route53Resolver::ResolverQueryLoggingConfigAssociation": "aws-cdk-lib/aws-route53resolver.CfnResolverQueryLoggingConfigAssociation", + "AWS::Route53Resolver::ResolverRule": "aws-cdk-lib/aws-route53resolver.CfnResolverRule", + "AWS::Route53Resolver::ResolverRuleAssociation": "aws-cdk-lib/aws-route53resolver.CfnResolverRuleAssociation", + "AWS::RUM::AppMonitor": "aws-cdk-lib/aws-rum.CfnAppMonitor", + "AWS::S3::AccessPoint": "aws-cdk-lib/aws-s3.CfnAccessPoint", + "AWS::S3::Bucket": "aws-cdk-lib/aws-s3.CfnBucket", + "AWS::S3::BucketPolicy": "aws-cdk-lib/aws-s3.CfnBucketPolicy", + "AWS::S3::MultiRegionAccessPoint": "aws-cdk-lib/aws-s3.CfnMultiRegionAccessPoint", + "AWS::S3::MultiRegionAccessPointPolicy": "aws-cdk-lib/aws-s3.CfnMultiRegionAccessPointPolicy", + "AWS::S3::StorageLens": "aws-cdk-lib/aws-s3.CfnStorageLens", + "AWS::S3ObjectLambda::AccessPoint": "aws-cdk-lib/aws-s3objectlambda.CfnAccessPoint", + "AWS::S3ObjectLambda::AccessPointPolicy": "aws-cdk-lib/aws-s3objectlambda.CfnAccessPointPolicy", + "AWS::S3Outposts::AccessPoint": "aws-cdk-lib/aws-s3outposts.CfnAccessPoint", + "AWS::S3Outposts::Bucket": "aws-cdk-lib/aws-s3outposts.CfnBucket", + "AWS::S3Outposts::BucketPolicy": "aws-cdk-lib/aws-s3outposts.CfnBucketPolicy", + "AWS::S3Outposts::Endpoint": "aws-cdk-lib/aws-s3outposts.CfnEndpoint", + "AWS::SageMaker::App": "aws-cdk-lib/aws-sagemaker.CfnApp", + "AWS::SageMaker::AppImageConfig": "aws-cdk-lib/aws-sagemaker.CfnAppImageConfig", + "AWS::SageMaker::CodeRepository": "aws-cdk-lib/aws-sagemaker.CfnCodeRepository", + "AWS::SageMaker::DataQualityJobDefinition": "aws-cdk-lib/aws-sagemaker.CfnDataQualityJobDefinition", + "AWS::SageMaker::Device": "aws-cdk-lib/aws-sagemaker.CfnDevice", + "AWS::SageMaker::DeviceFleet": "aws-cdk-lib/aws-sagemaker.CfnDeviceFleet", + "AWS::SageMaker::Domain": "aws-cdk-lib/aws-sagemaker.CfnDomain", + "AWS::SageMaker::Endpoint": "aws-cdk-lib/aws-sagemaker.CfnEndpoint", + "AWS::SageMaker::EndpointConfig": "aws-cdk-lib/aws-sagemaker.CfnEndpointConfig", + "AWS::SageMaker::FeatureGroup": "aws-cdk-lib/aws-sagemaker.CfnFeatureGroup", + "AWS::SageMaker::Image": "aws-cdk-lib/aws-sagemaker.CfnImage", + "AWS::SageMaker::ImageVersion": "aws-cdk-lib/aws-sagemaker.CfnImageVersion", + "AWS::SageMaker::InferenceExperiment": "aws-cdk-lib/aws-sagemaker.CfnInferenceExperiment", + "AWS::SageMaker::Model": "aws-cdk-lib/aws-sagemaker.CfnModel", + "AWS::SageMaker::ModelBiasJobDefinition": "aws-cdk-lib/aws-sagemaker.CfnModelBiasJobDefinition", + "AWS::SageMaker::ModelCard": "aws-cdk-lib/aws-sagemaker.CfnModelCard", + "AWS::SageMaker::ModelExplainabilityJobDefinition": "aws-cdk-lib/aws-sagemaker.CfnModelExplainabilityJobDefinition", + "AWS::SageMaker::ModelPackage": "aws-cdk-lib/aws-sagemaker.CfnModelPackage", + "AWS::SageMaker::ModelPackageGroup": "aws-cdk-lib/aws-sagemaker.CfnModelPackageGroup", + "AWS::SageMaker::ModelQualityJobDefinition": "aws-cdk-lib/aws-sagemaker.CfnModelQualityJobDefinition", + "AWS::SageMaker::MonitoringSchedule": "aws-cdk-lib/aws-sagemaker.CfnMonitoringSchedule", + "AWS::SageMaker::NotebookInstance": "aws-cdk-lib/aws-sagemaker.CfnNotebookInstance", + "AWS::SageMaker::NotebookInstanceLifecycleConfig": "aws-cdk-lib/aws-sagemaker.CfnNotebookInstanceLifecycleConfig", + "AWS::SageMaker::Pipeline": "aws-cdk-lib/aws-sagemaker.CfnPipeline", + "AWS::SageMaker::Project": "aws-cdk-lib/aws-sagemaker.CfnProject", + "AWS::SageMaker::Space": "aws-cdk-lib/aws-sagemaker.CfnSpace", + "AWS::SageMaker::UserProfile": "aws-cdk-lib/aws-sagemaker.CfnUserProfile", + "AWS::SageMaker::Workteam": "aws-cdk-lib/aws-sagemaker.CfnWorkteam", + "AWS::Serverless::Api": "aws-cdk-lib/aws-sam.CfnApi", + "AWS::Serverless::Application": "aws-cdk-lib/aws-sam.CfnApplication", + "AWS::Serverless::Function": "aws-cdk-lib/aws-sam.CfnFunction", + "AWS::Serverless::HttpApi": "aws-cdk-lib/aws-sam.CfnHttpApi", + "AWS::Serverless::LayerVersion": "aws-cdk-lib/aws-sam.CfnLayerVersion", + "AWS::Serverless::SimpleTable": "aws-cdk-lib/aws-sam.CfnSimpleTable", + "AWS::Serverless::StateMachine": "aws-cdk-lib/aws-sam.CfnStateMachine", + "AWS::Scheduler::Schedule": "aws-cdk-lib/aws-scheduler.CfnSchedule", + "AWS::Scheduler::ScheduleGroup": "aws-cdk-lib/aws-scheduler.CfnScheduleGroup", + "AWS::SDB::Domain": "aws-cdk-lib/aws-sdb.CfnDomain", + "AWS::SecretsManager::ResourcePolicy": "aws-cdk-lib/aws-secretsmanager.CfnResourcePolicy", + "AWS::SecretsManager::RotationSchedule": "aws-cdk-lib/aws-secretsmanager.CfnRotationSchedule", + "AWS::SecretsManager::Secret": "aws-cdk-lib/aws-secretsmanager.CfnSecret", + "AWS::SecretsManager::SecretTargetAttachment": "aws-cdk-lib/aws-secretsmanager.CfnSecretTargetAttachment", + "AWS::SecurityHub::Hub": "aws-cdk-lib/aws-securityhub.CfnHub", + "AWS::ServiceCatalog::AcceptedPortfolioShare": "aws-cdk-lib/aws-servicecatalog.CfnAcceptedPortfolioShare", + "AWS::ServiceCatalog::CloudFormationProduct": "aws-cdk-lib/aws-servicecatalog.CfnCloudFormationProduct", + "AWS::ServiceCatalog::CloudFormationProvisionedProduct": "aws-cdk-lib/aws-servicecatalog.CfnCloudFormationProvisionedProduct", + "AWS::ServiceCatalog::LaunchNotificationConstraint": "aws-cdk-lib/aws-servicecatalog.CfnLaunchNotificationConstraint", + "AWS::ServiceCatalog::LaunchRoleConstraint": "aws-cdk-lib/aws-servicecatalog.CfnLaunchRoleConstraint", + "AWS::ServiceCatalog::LaunchTemplateConstraint": "aws-cdk-lib/aws-servicecatalog.CfnLaunchTemplateConstraint", + "AWS::ServiceCatalog::Portfolio": "aws-cdk-lib/aws-servicecatalog.CfnPortfolio", + "AWS::ServiceCatalog::PortfolioPrincipalAssociation": "aws-cdk-lib/aws-servicecatalog.CfnPortfolioPrincipalAssociation", + "AWS::ServiceCatalog::PortfolioProductAssociation": "aws-cdk-lib/aws-servicecatalog.CfnPortfolioProductAssociation", + "AWS::ServiceCatalog::PortfolioShare": "aws-cdk-lib/aws-servicecatalog.CfnPortfolioShare", + "AWS::ServiceCatalog::ResourceUpdateConstraint": "aws-cdk-lib/aws-servicecatalog.CfnResourceUpdateConstraint", + "AWS::ServiceCatalog::ServiceAction": "aws-cdk-lib/aws-servicecatalog.CfnServiceAction", + "AWS::ServiceCatalog::ServiceActionAssociation": "aws-cdk-lib/aws-servicecatalog.CfnServiceActionAssociation", + "AWS::ServiceCatalog::StackSetConstraint": "aws-cdk-lib/aws-servicecatalog.CfnStackSetConstraint", + "AWS::ServiceCatalog::TagOption": "aws-cdk-lib/aws-servicecatalog.CfnTagOption", + "AWS::ServiceCatalog::TagOptionAssociation": "aws-cdk-lib/aws-servicecatalog.CfnTagOptionAssociation", + "AWS::ServiceCatalogAppRegistry::Application": "aws-cdk-lib/aws-servicecatalogappregistry.CfnApplication", + "AWS::ServiceCatalogAppRegistry::AttributeGroup": "aws-cdk-lib/aws-servicecatalogappregistry.CfnAttributeGroup", + "AWS::ServiceCatalogAppRegistry::AttributeGroupAssociation": "aws-cdk-lib/aws-servicecatalogappregistry.CfnAttributeGroupAssociation", + "AWS::ServiceCatalogAppRegistry::ResourceAssociation": "aws-cdk-lib/aws-servicecatalogappregistry.CfnResourceAssociation", + "AWS::ServiceDiscovery::HttpNamespace": "aws-cdk-lib/aws-servicediscovery.CfnHttpNamespace", + "AWS::ServiceDiscovery::Instance": "aws-cdk-lib/aws-servicediscovery.CfnInstance", + "AWS::ServiceDiscovery::PrivateDnsNamespace": "aws-cdk-lib/aws-servicediscovery.CfnPrivateDnsNamespace", + "AWS::ServiceDiscovery::PublicDnsNamespace": "aws-cdk-lib/aws-servicediscovery.CfnPublicDnsNamespace", + "AWS::ServiceDiscovery::Service": "aws-cdk-lib/aws-servicediscovery.CfnService", + "AWS::SES::ConfigurationSet": "aws-cdk-lib/aws-ses.CfnConfigurationSet", + "AWS::SES::ConfigurationSetEventDestination": "aws-cdk-lib/aws-ses.CfnConfigurationSetEventDestination", + "AWS::SES::ContactList": "aws-cdk-lib/aws-ses.CfnContactList", + "AWS::SES::DedicatedIpPool": "aws-cdk-lib/aws-ses.CfnDedicatedIpPool", + "AWS::SES::EmailIdentity": "aws-cdk-lib/aws-ses.CfnEmailIdentity", + "AWS::SES::ReceiptFilter": "aws-cdk-lib/aws-ses.CfnReceiptFilter", + "AWS::SES::ReceiptRule": "aws-cdk-lib/aws-ses.CfnReceiptRule", + "AWS::SES::ReceiptRuleSet": "aws-cdk-lib/aws-ses.CfnReceiptRuleSet", + "AWS::SES::Template": "aws-cdk-lib/aws-ses.CfnTemplate", + "AWS::SES::VdmAttributes": "aws-cdk-lib/aws-ses.CfnVdmAttributes", + "AWS::Signer::ProfilePermission": "aws-cdk-lib/aws-signer.CfnProfilePermission", + "AWS::Signer::SigningProfile": "aws-cdk-lib/aws-signer.CfnSigningProfile", + "AWS::SimSpaceWeaver::Simulation": "aws-cdk-lib/aws-simspaceweaver.CfnSimulation", + "AWS::SNS::Subscription": "aws-cdk-lib/aws-sns.CfnSubscription", + "AWS::SNS::Topic": "aws-cdk-lib/aws-sns.CfnTopic", + "AWS::SNS::TopicPolicy": "aws-cdk-lib/aws-sns.CfnTopicPolicy", + "AWS::SQS::Queue": "aws-cdk-lib/aws-sqs.CfnQueue", + "AWS::SQS::QueuePolicy": "aws-cdk-lib/aws-sqs.CfnQueuePolicy", + "AWS::SSM::Association": "aws-cdk-lib/aws-ssm.CfnAssociation", + "AWS::SSM::Document": "aws-cdk-lib/aws-ssm.CfnDocument", + "AWS::SSM::MaintenanceWindow": "aws-cdk-lib/aws-ssm.CfnMaintenanceWindow", + "AWS::SSM::MaintenanceWindowTarget": "aws-cdk-lib/aws-ssm.CfnMaintenanceWindowTarget", + "AWS::SSM::MaintenanceWindowTask": "aws-cdk-lib/aws-ssm.CfnMaintenanceWindowTask", + "AWS::SSM::Parameter": "aws-cdk-lib/aws-ssm.CfnParameter", + "AWS::SSM::PatchBaseline": "aws-cdk-lib/aws-ssm.CfnPatchBaseline", + "AWS::SSM::ResourceDataSync": "aws-cdk-lib/aws-ssm.CfnResourceDataSync", + "AWS::SSM::ResourcePolicy": "aws-cdk-lib/aws-ssm.CfnResourcePolicy", + "AWS::SSMContacts::Contact": "aws-cdk-lib/aws-ssmcontacts.CfnContact", + "AWS::SSMContacts::ContactChannel": "aws-cdk-lib/aws-ssmcontacts.CfnContactChannel", + "AWS::SSMIncidents::ReplicationSet": "aws-cdk-lib/aws-ssmincidents.CfnReplicationSet", + "AWS::SSMIncidents::ResponsePlan": "aws-cdk-lib/aws-ssmincidents.CfnResponsePlan", + "AWS::SSO::Assignment": "aws-cdk-lib/aws-sso.CfnAssignment", + "AWS::SSO::InstanceAccessControlAttributeConfiguration": "aws-cdk-lib/aws-sso.CfnInstanceAccessControlAttributeConfiguration", + "AWS::SSO::PermissionSet": "aws-cdk-lib/aws-sso.CfnPermissionSet", + "AWS::StepFunctions::Activity": "aws-cdk-lib/aws-stepfunctions.CfnActivity", + "AWS::StepFunctions::StateMachine": "aws-cdk-lib/aws-stepfunctions.CfnStateMachine", + "AWS::SupportApp::AccountAlias": "aws-cdk-lib/aws-supportapp.CfnAccountAlias", + "AWS::SupportApp::SlackChannelConfiguration": "aws-cdk-lib/aws-supportapp.CfnSlackChannelConfiguration", + "AWS::SupportApp::SlackWorkspaceConfiguration": "aws-cdk-lib/aws-supportapp.CfnSlackWorkspaceConfiguration", + "AWS::Synthetics::Canary": "aws-cdk-lib/aws-synthetics.CfnCanary", + "AWS::Synthetics::Group": "aws-cdk-lib/aws-synthetics.CfnGroup", + "AWS::SystemsManagerSAP::Application": "aws-cdk-lib/aws-systemsmanagersap.CfnApplication", + "AWS::Timestream::Database": "aws-cdk-lib/aws-timestream.CfnDatabase", + "AWS::Timestream::ScheduledQuery": "aws-cdk-lib/aws-timestream.CfnScheduledQuery", + "AWS::Timestream::Table": "aws-cdk-lib/aws-timestream.CfnTable", + "AWS::Transfer::Agreement": "aws-cdk-lib/aws-transfer.CfnAgreement", + "AWS::Transfer::Certificate": "aws-cdk-lib/aws-transfer.CfnCertificate", + "AWS::Transfer::Connector": "aws-cdk-lib/aws-transfer.CfnConnector", + "AWS::Transfer::Profile": "aws-cdk-lib/aws-transfer.CfnProfile", + "AWS::Transfer::Server": "aws-cdk-lib/aws-transfer.CfnServer", + "AWS::Transfer::User": "aws-cdk-lib/aws-transfer.CfnUser", + "AWS::Transfer::Workflow": "aws-cdk-lib/aws-transfer.CfnWorkflow", + "AWS::VoiceID::Domain": "aws-cdk-lib/aws-voiceid.CfnDomain", + "AWS::VpcLattice::AccessLogSubscription": "aws-cdk-lib/aws-vpclattice.CfnAccessLogSubscription", + "AWS::VpcLattice::AuthPolicy": "aws-cdk-lib/aws-vpclattice.CfnAuthPolicy", + "AWS::VpcLattice::Listener": "aws-cdk-lib/aws-vpclattice.CfnListener", + "AWS::VpcLattice::ResourcePolicy": "aws-cdk-lib/aws-vpclattice.CfnResourcePolicy", + "AWS::VpcLattice::Rule": "aws-cdk-lib/aws-vpclattice.CfnRule", + "AWS::VpcLattice::Service": "aws-cdk-lib/aws-vpclattice.CfnService", + "AWS::VpcLattice::ServiceNetwork": "aws-cdk-lib/aws-vpclattice.CfnServiceNetwork", + "AWS::VpcLattice::ServiceNetworkServiceAssociation": "aws-cdk-lib/aws-vpclattice.CfnServiceNetworkServiceAssociation", + "AWS::VpcLattice::ServiceNetworkVpcAssociation": "aws-cdk-lib/aws-vpclattice.CfnServiceNetworkVpcAssociation", + "AWS::VpcLattice::TargetGroup": "aws-cdk-lib/aws-vpclattice.CfnTargetGroup", + "AWS::WAF::ByteMatchSet": "aws-cdk-lib/aws-waf.CfnByteMatchSet", + "AWS::WAF::IPSet": "aws-cdk-lib/aws-waf.CfnIPSet", + "AWS::WAF::Rule": "aws-cdk-lib/aws-waf.CfnRule", + "AWS::WAF::SizeConstraintSet": "aws-cdk-lib/aws-waf.CfnSizeConstraintSet", + "AWS::WAF::SqlInjectionMatchSet": "aws-cdk-lib/aws-waf.CfnSqlInjectionMatchSet", + "AWS::WAF::WebACL": "aws-cdk-lib/aws-waf.CfnWebACL", + "AWS::WAF::XssMatchSet": "aws-cdk-lib/aws-waf.CfnXssMatchSet", + "AWS::WAFRegional::ByteMatchSet": "aws-cdk-lib/aws-wafregional.CfnByteMatchSet", + "AWS::WAFRegional::GeoMatchSet": "aws-cdk-lib/aws-wafregional.CfnGeoMatchSet", + "AWS::WAFRegional::IPSet": "aws-cdk-lib/aws-wafregional.CfnIPSet", + "AWS::WAFRegional::RateBasedRule": "aws-cdk-lib/aws-wafregional.CfnRateBasedRule", + "AWS::WAFRegional::RegexPatternSet": "aws-cdk-lib/aws-wafregional.CfnRegexPatternSet", + "AWS::WAFRegional::Rule": "aws-cdk-lib/aws-wafregional.CfnRule", + "AWS::WAFRegional::SizeConstraintSet": "aws-cdk-lib/aws-wafregional.CfnSizeConstraintSet", + "AWS::WAFRegional::SqlInjectionMatchSet": "aws-cdk-lib/aws-wafregional.CfnSqlInjectionMatchSet", + "AWS::WAFRegional::WebACL": "aws-cdk-lib/aws-wafregional.CfnWebACL", + "AWS::WAFRegional::WebACLAssociation": "aws-cdk-lib/aws-wafregional.CfnWebACLAssociation", + "AWS::WAFRegional::XssMatchSet": "aws-cdk-lib/aws-wafregional.CfnXssMatchSet", + "AWS::WAFv2::IPSet": "aws-cdk-lib/aws-wafv2.CfnIPSet", + "AWS::WAFv2::LoggingConfiguration": "aws-cdk-lib/aws-wafv2.CfnLoggingConfiguration", + "AWS::WAFv2::RegexPatternSet": "aws-cdk-lib/aws-wafv2.CfnRegexPatternSet", + "AWS::WAFv2::RuleGroup": "aws-cdk-lib/aws-wafv2.CfnRuleGroup", + "AWS::WAFv2::WebACL": "aws-cdk-lib/aws-wafv2.CfnWebACL", + "AWS::WAFv2::WebACLAssociation": "aws-cdk-lib/aws-wafv2.CfnWebACLAssociation", + "AWS::Wisdom::Assistant": "aws-cdk-lib/aws-wisdom.CfnAssistant", + "AWS::Wisdom::AssistantAssociation": "aws-cdk-lib/aws-wisdom.CfnAssistantAssociation", + "AWS::Wisdom::KnowledgeBase": "aws-cdk-lib/aws-wisdom.CfnKnowledgeBase", + "AWS::WorkSpaces::ConnectionAlias": "aws-cdk-lib/aws-workspaces.CfnConnectionAlias", + "AWS::WorkSpaces::Workspace": "aws-cdk-lib/aws-workspaces.CfnWorkspace", + "AWS::XRay::Group": "aws-cdk-lib/aws-xray.CfnGroup", + "AWS::XRay::ResourcePolicy": "aws-cdk-lib/aws-xray.CfnResourcePolicy", + "AWS::XRay::SamplingRule": "aws-cdk-lib/aws-xray.CfnSamplingRule" +} diff --git a/packages/@aws-cdk/cloudformation-include/doc-images/processed-template.png b/packages/aws-cdk-lib/cloudformation-include/doc-images/processed-template.png similarity index 100% rename from packages/@aws-cdk/cloudformation-include/doc-images/processed-template.png rename to packages/aws-cdk-lib/cloudformation-include/doc-images/processed-template.png diff --git a/packages/@aws-cdk/cloudformation-include/doc-images/unprocessed-template.png b/packages/aws-cdk-lib/cloudformation-include/doc-images/unprocessed-template.png similarity index 100% rename from packages/@aws-cdk/cloudformation-include/doc-images/unprocessed-template.png rename to packages/aws-cdk-lib/cloudformation-include/doc-images/unprocessed-template.png diff --git a/packages/aws-cdk-lib/cloudformation-include/index.ts b/packages/aws-cdk-lib/cloudformation-include/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/cloudformation-include/lib/cfn-include.ts b/packages/aws-cdk-lib/cloudformation-include/lib/cfn-include.ts similarity index 99% rename from packages/@aws-cdk/cloudformation-include/lib/cfn-include.ts rename to packages/aws-cdk-lib/cloudformation-include/lib/cfn-include.ts index 72a729fcbca0b..7bc02b04e3ede 100644 --- a/packages/@aws-cdk/cloudformation-include/lib/cfn-include.ts +++ b/packages/aws-cdk-lib/cloudformation-include/lib/cfn-include.ts @@ -1,5 +1,5 @@ -import * as core from '@aws-cdk/core'; -import * as cfn_parse from '@aws-cdk/core/lib/helpers-internal'; +import * as core from '../../core'; +import * as cfn_parse from '../../core/lib/helpers-internal'; import { Construct } from 'constructs'; import * as cfn_type_to_l1_mapping from './cfn-type-to-l1-mapping'; import * as futils from './file-utils'; diff --git a/packages/@aws-cdk/cloudformation-include/lib/cfn-type-to-l1-mapping.ts b/packages/aws-cdk-lib/cloudformation-include/lib/cfn-type-to-l1-mapping.ts similarity index 100% rename from packages/@aws-cdk/cloudformation-include/lib/cfn-type-to-l1-mapping.ts rename to packages/aws-cdk-lib/cloudformation-include/lib/cfn-type-to-l1-mapping.ts diff --git a/packages/@aws-cdk/cloudformation-include/lib/file-utils.ts b/packages/aws-cdk-lib/cloudformation-include/lib/file-utils.ts similarity index 100% rename from packages/@aws-cdk/cloudformation-include/lib/file-utils.ts rename to packages/aws-cdk-lib/cloudformation-include/lib/file-utils.ts diff --git a/packages/@aws-cdk/cloudformation-include/lib/index.ts b/packages/aws-cdk-lib/cloudformation-include/lib/index.ts similarity index 100% rename from packages/@aws-cdk/cloudformation-include/lib/index.ts rename to packages/aws-cdk-lib/cloudformation-include/lib/index.ts diff --git a/packages/@aws-cdk/cloudformation-include/lib/private/yaml-cfn.ts b/packages/aws-cdk-lib/cloudformation-include/lib/private/yaml-cfn.ts similarity index 100% rename from packages/@aws-cdk/cloudformation-include/lib/private/yaml-cfn.ts rename to packages/aws-cdk-lib/cloudformation-include/lib/private/yaml-cfn.ts diff --git a/packages/@aws-cdk/cloudformation-include/test/invalid-templates.test.ts b/packages/aws-cdk-lib/cloudformation-include/test/invalid-templates.test.ts similarity index 98% rename from packages/@aws-cdk/cloudformation-include/test/invalid-templates.test.ts rename to packages/aws-cdk-lib/cloudformation-include/test/invalid-templates.test.ts index dcdade326cb62..66c5b9bbf803c 100644 --- a/packages/@aws-cdk/cloudformation-include/test/invalid-templates.test.ts +++ b/packages/aws-cdk-lib/cloudformation-include/test/invalid-templates.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as core from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from '../../assertions'; +import * as core from '../../core'; +import * as cxapi from '../../cx-api'; import * as constructs from 'constructs'; import * as inc from '../lib'; diff --git a/packages/@aws-cdk/cloudformation-include/test/nested-stacks.test.ts b/packages/aws-cdk-lib/cloudformation-include/test/nested-stacks.test.ts similarity index 99% rename from packages/@aws-cdk/cloudformation-include/test/nested-stacks.test.ts rename to packages/aws-cdk-lib/cloudformation-include/test/nested-stacks.test.ts index 32342680016b7..e29277e605cd8 100644 --- a/packages/@aws-cdk/cloudformation-include/test/nested-stacks.test.ts +++ b/packages/aws-cdk-lib/cloudformation-include/test/nested-stacks.test.ts @@ -1,8 +1,8 @@ import * as path from 'path'; -import { Match, Template } from '@aws-cdk/assertions'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as core from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Match, Template } from '../../assertions'; +import * as s3 from '../../aws-s3'; +import * as core from '../../core'; +import * as cxapi from '../../cx-api'; import * as inc from '../lib'; import * as futils from '../lib/file-utils'; diff --git a/packages/@aws-cdk/cloudformation-include/test/serverless-transform.test.ts b/packages/aws-cdk-lib/cloudformation-include/test/serverless-transform.test.ts similarity index 96% rename from packages/@aws-cdk/cloudformation-include/test/serverless-transform.test.ts rename to packages/aws-cdk-lib/cloudformation-include/test/serverless-transform.test.ts index f1aaf93ecaacb..07e32fe0246e6 100644 --- a/packages/@aws-cdk/cloudformation-include/test/serverless-transform.test.ts +++ b/packages/aws-cdk-lib/cloudformation-include/test/serverless-transform.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as core from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { Template } from '../../assertions'; +import * as core from '../../core'; +import * as cxapi from '../../cx-api'; import * as constructs from 'constructs'; import * as inc from '../lib'; import * as futils from '../lib/file-utils'; diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/boolean-for-string.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/boolean-for-string.json new file mode 100644 index 0000000000000..1ef8d59e40b89 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/boolean-for-string.json @@ -0,0 +1,10 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "AccessControl": true + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/bucket-with-encryption-key.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/bucket-with-encryption-key.json new file mode 100644 index 0000000000000..75bb7d0c72b54 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/bucket-with-encryption-key.json @@ -0,0 +1,75 @@ +{ + "Resources": { + "Key": { + "Type": "AWS::KMS::Key", + "Properties": { + "KeyPolicy": { + "Statement": [ + { + "Action": [ + "kms:*" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "DeletionPolicy": "Delete", + "UpdateReplacePolicy": "Delete" + }, + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "KMSMasterKeyID": { + "Fn::GetAtt": [ + "Key", + "Arn" + ] + }, + "SSEAlgorithm": "aws:kms" + } + } + ] + } + }, + "Metadata" : { + "Object1" : "Location1", + "KeyRef": { + "Ref": "Key" + }, + "KeyArn": { + "Fn::GetAtt": [ + "Key", + "Arn" + ] + } + }, + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/bucket-with-parameters.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/bucket-with-parameters.json new file mode 100644 index 0000000000000..5268e6495b074 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/bucket-with-parameters.json @@ -0,0 +1,48 @@ +{ + "Parameters": { + "BucketName": { + "Default": "MyS3Bucket", + "AllowedPattern": "^[a-zA-Z0-9]*$", + "ConstraintDescription": "a string consisting only of alphanumeric characters", + "Description": "The name of your bucket", + "MaxLength": "10", + "MinLength": "1", + "Type": "String", + "NoEcho": "true" + }, + "CorsMaxAge": { + "Default": "3", + "Description": "the time in seconds that a browser will cache the preflight response", + "MaxValue": "300", + "MinValue": "0", + "AllowedValues": [1, 2, 3, 10, 100, 300], + "Type": "Number", + "NoEcho": "true" + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "BucketName" + }, + "CorsConfiguration": { + "CorsRules": [{ + "AllowedMethods": [ + "GET", + "POST" + ], + "AllowedOrigins": [ + "origin1", + "origin2" + ], + "MaxAge": { + "Ref": "CorsMaxAge" + } + }] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/condition-same-name-as-resource.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/condition-same-name-as-resource.json new file mode 100644 index 0000000000000..d7220fd1df1ba --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/condition-same-name-as-resource.json @@ -0,0 +1,28 @@ +{ + "Parameters": { + "Param": { + "Type": "String" + } + }, + "Conditions": { + "AlwaysTrue": { + "Fn::Not": [{ "Condition": "AlwaysFalse" }] + }, + "AlwaysFalse": { + "Fn::Equals": [{ "Ref": "Param" }, 2] + } + }, + "Resources": { + "AlwaysTrue": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": ["AlwaysFalse", + { "Ref": "Param" }, + { "Ref": "AWS::NoValue" } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/condition-using-mapping.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/condition-using-mapping.json new file mode 100644 index 0000000000000..a24003fc17bed --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/condition-using-mapping.json @@ -0,0 +1,17 @@ +{ + "Conditions": { + "AlwaysTrue": { + "Fn::Equals": [ + { "Fn::FindInMap": ["Mapping01", "Key01", "Name"] }, + "Value01" + ] + } + }, + "Mappings" : { + "Mapping01" : { + "Key01" : { + "Name" : "Value01" + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/custom-resource-with-attributes.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/custom-resource-with-attributes.json new file mode 100644 index 0000000000000..b1dcf4d219bf1 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/custom-resource-with-attributes.json @@ -0,0 +1,46 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "CustomBucket": { + "Type": "AWS::MyService::Custom", + "Condition": "AlwaysFalseCond", + "Version": "1.0", + "Metadata": { + "Object1": "Value1", + "Object2": "Value2" + }, + "CreationPolicy": { + "AutoScalingCreationPolicy": { + "MinSuccessfulInstancesPercent" : 90 + } + }, + "DeletionPolicy": "Retain", + "DependsOn": [ "CustomResource" ] + }, + "CustomResource": { + "Type": "AWS::CloudFormation::CustomResource", + "Description": "some random custom resource", + "Properties": { + "ServiceToken": "CustomValue", + "CustomFuncProp": { + "Ref": "AWS::NoValue" + } + }, + "UpdatePolicy": { + "AutoScalingReplacingUpdate": { + "WillReplace" : "false" + } + }, + "UpdateReplacePolicy": "Retain" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json new file mode 100644 index 0000000000000..43365aa151e9c --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/custom-resource-with-bad-condition.json @@ -0,0 +1,8 @@ +{ + "Resources": { + "CustomResource": { + "Type": "AWS::MyService::Custom", + "Condition": "AlwaysFalseCond" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json new file mode 100644 index 0000000000000..cdc5181de12e9 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/find-in-map-for-boolean-property.json @@ -0,0 +1,25 @@ +{ + "Mappings": { + "SomeMapping": { + "region": { + "key1": true + } + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": { + "Fn::FindInMap": [ + "SomeMapping", + { "Ref": "AWS::Region" }, + "key1" + ] + } + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json new file mode 100644 index 0000000000000..aedf3250272fc --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json @@ -0,0 +1,30 @@ +{ + "Parameters": { + "Stage": { + "Type": "String", + "AllowedValues": ["beta"], + "Default": "beta" + } + }, + "Mappings": { + "beta": { + "region": { + "key1": "name" + } + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::FindInMap": [ + { "Ref": "Stage" }, + "region", + "key1" + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-select-with-novalue.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-select-with-novalue.json new file mode 100644 index 0000000000000..861387e330ee7 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-select-with-novalue.json @@ -0,0 +1,23 @@ +{ + "Parameters": { + "DoIt": { + "Type": "String" + } + }, + "Conditions": { + "MyCondition": { + "Fn::Equals": [{ "Ref": "DoIt" }, "Yes"] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { "Fn::Select": [0, [ + { "Fn::If": ["MyCondition", "doing-it", { "Ref": "AWS::NoValue" }] }, + "not-doingit" + ]]} + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-brace-edges.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-brace-edges.json new file mode 100644 index 0000000000000..b8ef634ac6cd0 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-brace-edges.json @@ -0,0 +1,55 @@ +{ + "Resources": { + "Bucket": { + "Type": "Custom::ManyStrings", + "Properties": { + "SymbolsOnly": { + "DollarSign": { + "Fn::Sub": "$" + }, + "OpeningBrace": { + "Fn::Sub": "{" + }, + "ClosingBrace": { + "Fn::Sub": "}" + }, + "DollarOpeningBrace": { + "Fn::Sub": "${" + }, + "DollarClosingBrace": { + "Fn::Sub": "$}" + }, + "OpeningBraceDollar": { + "Fn::Sub": "{$" + }, + "ClosingBraceDollar": { + "Fn::Sub": "}$" + } + }, + "SymbolsAndResources": { + "DollarSign": { + "Fn::Sub": "DoesNotExist$DoesNotExist" + }, + "OpeningBrace": { + "Fn::Sub": "DoesNotExist{DoesNotExist" + }, + "ClosingBrace": { + "Fn::Sub": "DoesNotExist}DoesNotExist" + }, + "DollarOpeningBrace": { + "Fn::Sub": "DoesNotExist${DoesNotExist" + }, + "DollarClosingBrace": { + "Fn::Sub": "DoesNotExist$}DoesNotExist" + }, + "OpeningBraceDollar": { + "Fn::Sub": "DoesNotExist{$DoesNotExist" + }, + "ClosingBraceDollar": { + "Fn::Sub": "DoesNotExist}$DoesNotExist" + } + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-escaping.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-escaping.json new file mode 100644 index 0000000000000..915a65819aec7 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-escaping.json @@ -0,0 +1,10 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { "Fn::Sub": "some-bucket${!AWS::AccountId}7896${ ! DoesNotExist}${!Immediate}234" } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json new file mode 100644 index 0000000000000..7daef9f79f9a4 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-map-dotted-attributes.json @@ -0,0 +1,33 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": [ + "${ELB.SourceSecurityGroup.GroupName}-${LoadBalancerName}", + { + "LoadBalancerName": { + "Ref": "ELB" + } + } + ] + } + } + }, + "ELB": { + "Type": "AWS::ElasticLoadBalancing::LoadBalancer", + "Properties": { + "AvailabilityZones": [ + "us-east-1a" + ], + "CrossZone": true, + "Listeners": [{ + "LoadBalancerPort": "80", + "InstancePort": "80", + "Protocol": "HTTP" + }] + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-map-empty.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-map-empty.json new file mode 100644 index 0000000000000..07def731df41f --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-map-empty.json @@ -0,0 +1,12 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": ["my-bucket", {}] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-override.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-override.json new file mode 100644 index 0000000000000..cdaa623bfd7fa --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-override.json @@ -0,0 +1,16 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": "bucket" + } + }, + "AnotherBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { "Fn::Sub": "${Bucket}-${!Bucket}-${Bucket.DomainName}" } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-parameters.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-parameters.json new file mode 100644 index 0000000000000..d1bfe825b2514 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-parameters.json @@ -0,0 +1,19 @@ +{ + "Parameters": { + "MyParam": { + "Type": "String" + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": [ + "${MyParam}" + ] + } + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/node_modules/one b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-parsing-edges.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/node_modules/one rename to packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-parsing-edges.json diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json new file mode 100644 index 0000000000000..8401ee9a79ccb --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow-attribute.json @@ -0,0 +1,20 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": [ + "${AnotherBucket.DomainName}", + { + "AnotherBucket": "whatever" + } + ] + } + } + }, + "AnotherBucket": { + "Type": "AWS::S3::Bucket" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json new file mode 100644 index 0000000000000..1e47c582ba875 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow-parameter.json @@ -0,0 +1,22 @@ +{ + "Parameters": { + "MyParam": { + "Type": "String" + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": [ + "${MyParam}", + { + "MyParam": { "Ref" : "MyParam" } + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow.json new file mode 100644 index 0000000000000..6e5cdbee0be2c --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-shadow.json @@ -0,0 +1,20 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": [ + "${AnotherBucket}", + { + "AnotherBucket": { "Ref" : "AnotherBucket" } + } + ] + } + } + }, + "AnotherBucket": { + "Type": "AWS::S3::Bucket" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-string.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-string.json new file mode 100644 index 0000000000000..2936a59bb55fc --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/fn-sub-string.json @@ -0,0 +1,16 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": "bucket" + } + }, + "AnotherBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { "Fn::Sub": "1-${AWS::Region}-foo-${Bucket}-${!Literal}-${Bucket.DomainName}-${AWS::Region}" } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/functions-and-conditions.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/functions-and-conditions.json new file mode 100644 index 0000000000000..e36cef5796891 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/functions-and-conditions.json @@ -0,0 +1,160 @@ +{ + "Mappings": { + "RegionMap": { + "region-1": { + "HVM64": "name1", + "HVMG2": "name2" + } + } + }, + "Conditions": { + "AlwaysTrueCond": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + ] + }, + "AndCond": { + "Fn::And": [ + { + "Condition": "AlwaysTrueCond" + }, + { + "Fn::Or": [ + { + "Condition": "AlwaysTrueCond" + }, + { + "Condition": "AlwaysTrueCond" + } + ] + } + ] + } + }, + "Resources": { + "Vpc": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": { + "Fn::If": [ + "AlwaysTrueCond", + { + "Fn::Cidr": [ + "192.168.1.1/24", + 2, + 5 + ] + }, + { + "Fn::Cidr": [ + "10.0.0.0/24", + "6", + "5" + ] + } + ] + } + } + }, + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": [ + "AndCond", + { + "Fn::FindInMap": [ + "RegionMap", + "region-1", + "HVM64" + ] + }, + "Unreachable" + ] + } + } + }, + "Subnet1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Fn::If": [ + "AlwaysTrueCond", + { + "Fn::Split": [ + ",", + { + "Fn::ImportValue": "ImportedVpcId" + } + ] + }, + "Unreachable" + ] + }, + "CidrBlock": "10.0.0.0/24", + "AvailabilityZone": { + "Fn::Select": [ + "0", + { + "Fn::GetAZs": "" + } + ] + } + } + }, + "Subnet2": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Fn::Select": [ + 0, + { + "Fn::Cidr": [ + "10.0.0.0/24", + 5, + 2 + ] + } + ] + }, + "CidrBlock": "10.0.0.0/24", + "AvailabilityZone": { + "Fn::Select": [ + "0", + { + "Fn::GetAZs": "eu-west-2" + } + ] + } + } + }, + "TransformBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": [ + "AndCond", + { + "Fn::Transform": { + "Name": "AWS::Include", + "Parameters": { + "Location": "location", + "AnotherParameter": { + "Fn::Base64": "AnotherValue" + } + } + } + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/get-att-string-form.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/get-att-string-form.json new file mode 100644 index 0000000000000..c76fc888ba6a6 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/get-att-string-form.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "Bucket1": { + "Type": "AWS::S3::Bucket" + }, + "Bucket2": { + "Type": "AWS::S3::Bucket", + "Metadata": { + "Bucket1Arn": { + "Fn::GetAtt": "Bucket1.Arn" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json new file mode 100644 index 0000000000000..fc4abcab4e1ad --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/hook-code-deploy-blue-green-ecs.json @@ -0,0 +1,95 @@ +{ + "Hooks": { + "RandomHook": { + "Type": "UnknownToday" + }, + "EcsBlueGreenCodeDeployHook": { + "Type": "AWS::CodeDeploy::BlueGreen", + "Properties": { + "ServiceRole": "CodeDeployServiceRoleName", + "Applications": [ + { + "Target": { + "Type": "AWS::ECS::Service", + "LogicalID": "MyService" + }, + "ECSAttributes": { + "TaskDefinitions": [ + "MyTaskDefinition", "MyTaskDefinition" + ], + "TaskSets": [ + "MyTaskSet", "MyTaskSet" + ], + "TrafficRouting": { + "ProdTrafficRoute": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "LogicalID": "AlbListener" + }, + "TestTrafficRoute": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "LogicalID": "AlbListener" + }, + "TargetGroups": [ + "AlbTargetGroup", "AlbTargetGroup" + ] + } + } + } + ], + "TrafficRoutingConfig": { + "Type": "AllAtOnce", + "TimeBasedCanary": { + "StepPercentage": 1, + "BakeTimeMins": "2" + }, + "TimeBasedLinear": { + "StepPercentage": "3", + "BakeTimeMins": 4 + } + }, + "AdditionalOptions": { + "TerminationWaitTimeInMinutes": 5 + }, + "LifecycleEventHooks": { + "BeforeInstall": "f1", + "AfterInstall": "f2", + "AfterAllowTestTraffic": "f3", + "BeforeAllowTraffic": "f4", + "AfterAllowTraffic": "f5" + } + } + } + }, + "Resources": { + "MyService": { + "Type": "AWS::ECS::Service" + }, + "MyTaskDefinition": { + "Type": "AWS::ECS::TaskDefinition" + }, + "MyTaskSet": { + "Type": "AWS::ECS::TaskSet", + "Properties": { + "Cluster": "my-cluster", + "Service": { "Ref": "MyService" }, + "TaskDefinition": { "Fn::Sub": "${MyTaskDefinition}" } + } + }, + "AlbTargetGroup": { + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup" + }, + "AlbListener": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "Properties": { + "Port": 80, + "Protocol": "HTTP", + "DefaultActions": [ + { + "Type": "forward" + } + ], + "LoadBalancerArn": "my-lb" + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-complex-property.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-complex-property.json new file mode 100644 index 0000000000000..8a6e83480f782 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-complex-property.json @@ -0,0 +1,46 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + { + "Fn::If": [ + "AlwaysFalseCond", + { + "AllowedMethods": [ + "GET" + ], + "AllowedOrigins": [ + "*" + ], + "MaxAge": 10 + }, + { + "AllowedMethods": [ + "POST" + ], + "AllowedOrigins": [ + "/path/*" + ], + "MaxAge": 20 + } + ] + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-in-tags.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-in-tags.json new file mode 100644 index 0000000000000..8b7a21358d10a --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-in-tags.json @@ -0,0 +1,29 @@ +{ + "Conditions": { + "ValcacheServerEnabled": true + }, + "Resources": { + "TxAutoScalingGroup": { + "Type": "AWS::AutoScaling::AutoScalingGroup", + "Properties": { + "MinSize": "1", + "MaxSize": "3", + "Tags": [ + { + "Fn::If": [ + "ValcacheServerEnabled", + { + "Key": "datomic:cache-group", + "Value": "SystemName", + "PropagateAtLaunch": true + }, + { + "Ref": "AWS::NoValue" + } + ] + } + ] + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-simple-property.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-simple-property.json new file mode 100644 index 0000000000000..0d833ec8031d1 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/if-simple-property.json @@ -0,0 +1,26 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": [ + "AlwaysFalseCond", + "Name1", + "Name2" + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json new file mode 100644 index 0000000000000..c97850b3ba0e7 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/alphabetical-string-passed-to-number.json @@ -0,0 +1,18 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedMethods": ["GET"], + "AllowedOrigins": ["*"], + "MaxAge": "abc" + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json new file mode 100644 index 0000000000000..56ab850b8736d --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-policy-without-bucket.json @@ -0,0 +1,36 @@ +{ + "Resources": { + "BucketPolicy": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:GetObject", + "Effect": "Allow", + "Principal": "*", + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "Bucket2", + "Arn" + ] + }, + "/*" + ] + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "Bucket2": { + "Type": "AWS::S3::Bucket" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json new file mode 100644 index 0000000000000..52bbe7131c709 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-not-an-array.json @@ -0,0 +1,12 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": "CorsRules!" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json new file mode 100644 index 0000000000000..e7d41a13d4360 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-cors-rules-null-element.json @@ -0,0 +1,14 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + null + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json new file mode 100644 index 0000000000000..a58f9e7867c9c --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/bucket-with-invalid-cors-rule.json @@ -0,0 +1,16 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedMethods": [] + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json new file mode 100644 index 0000000000000..61ab0a4b692a2 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/cycle-in-resources.json @@ -0,0 +1,16 @@ +{ + "Resources": { + "Bucket1": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "Bucket2" + } + } + }, + "Bucket2": { + "Type": "AWS::S3::Bucket", + "DependsOn": "Bucket1" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json new file mode 100644 index 0000000000000..87f9556e5a6b0 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/fn-sub-${}-only.json @@ -0,0 +1,12 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Sub": "${}" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json new file mode 100644 index 0000000000000..c5e9ff5b13b8d --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/fn-sub-key-not-in-template-string.json @@ -0,0 +1,10 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "AccessControl": { "Fn::Sub": "${AFakeResource}" } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json new file mode 100644 index 0000000000000..31b818da764ed --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/getatt-in-conditions.json @@ -0,0 +1,15 @@ +{ + "Conditions": { + "MyCond": { + "Fn::Equals": [ + { "Fn::GetAtt": ["Bucket", "Arn"] }, + "my-arn" + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json new file mode 100644 index 0000000000000..1b575ce7cbeac --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/getting-attribute-of-a-non-existent-resource.json @@ -0,0 +1,12 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::GetAtt": ["DoesNotExist", "SomeAttribute"] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json new file mode 100644 index 0000000000000..06d96804f91c3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/multi-cycle-in-resources.json @@ -0,0 +1,24 @@ +{ + "Resources": { + "Bucket1": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "Bucket2" + } + } + }, + "Bucket2": { + "Type": "AWS::S3::Bucket", + "DependsOn": "Bucket3" + }, + "Bucket3": { + "Type": "AWS::S3::Bucket", + "DependsOn": ["Bucket4", "Bucket1"] + }, + "Bucket4": { + "Type": "AWS::S3::Bucket", + "DependsOn": "Bucket2" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json new file mode 100644 index 0000000000000..d8ed03161b255 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/multi-cycle-multi-dest-in-resources.json @@ -0,0 +1,20 @@ +{ + "Resources": { + "Bucket1": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "Bucket2" + } + } + }, + "Bucket2": { + "Type": "AWS::S3::Bucket", + "DependsOn": ["Bucket3", "Bucket1"] + }, + "Bucket3": { + "Type": "AWS::S3::Bucket", + "DependsOn": ["Bucket1"] + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json new file mode 100644 index 0000000000000..c35e3922b357a --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-conditions.json @@ -0,0 +1,7 @@ +{ + "Conditions": { + "AlwaysTrue": { + "Fn::Not": [{ "Condition": "AlwaysFalse" }] + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json new file mode 100644 index 0000000000000..fb35fb6d8bff9 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition-in-if.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": ["AlwaysFalse", + "ThenName", + "ElseName" + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition.json new file mode 100644 index 0000000000000..dbaef4fd3a5ed --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-condition.json @@ -0,0 +1,8 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Condition": "AlwaysFalseCond" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json new file mode 100644 index 0000000000000..442e9c70d80c0 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json @@ -0,0 +1,11 @@ +{ + "Resources": { + "Bucket2": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": "bucket2" + }, + "DependsOn": "Bucket1" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json new file mode 100644 index 0000000000000..1af26779590f4 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-mapping.json @@ -0,0 +1,16 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::FindInMap": [ + "NonExistentMapping", + { "Ref": "AWS::Region" }, + "key1" + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json new file mode 100644 index 0000000000000..075766e90e7dd --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/non-existent-resource-attribute.json @@ -0,0 +1,12 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "NonExistentResourceAttribute": { + "SomeProp": { + "Ref": "NonExistentResource" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json new file mode 100644 index 0000000000000..34056ea81668b --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/only-codecommit-repo-using-cfn-functions.json @@ -0,0 +1,13 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::CodeCommit::Repository", + "Properties": { + "RepositoryName": "my-repository", + "RepositoryDescription": { + "Fn::Select": [0, { "Fn::ValueOfAll": ["AWS::EC2::Subnet::Id", "VpcId"]}] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json new file mode 100644 index 0000000000000..fbb06694b8ae6 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/output-referencing-nonexistant-condition.json @@ -0,0 +1,7 @@ +{ + "Outputs": { + "SomeOutput": { + "Condition": "NonexistantCondition" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json new file mode 100644 index 0000000000000..f62b346ed25f3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/ref-ing-a-non-existent-element.json @@ -0,0 +1,12 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "DoesNotExist" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json new file mode 100644 index 0000000000000..4041800551cb3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/rule-referencing-a-non-existent-parameter.json @@ -0,0 +1,14 @@ +{ + "Rules": { + "VpcRule": { + "Assertions": [ + { + "Fn::EachMemberIn": [ + { "Fn::ValueOfAll": ["AWS::EC2::Subnet::Id", "VpcId"] }, + { "Fn::ValueOf": ["Subnets", "VpcId"] } + ] + } + ] + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml new file mode 100644 index 0000000000000..d91ae5a5cbcf2 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/invalid/short-form-get-att-no-dot.yaml @@ -0,0 +1,7 @@ +Resources: + Bucket1: + Type: AWS::S3::Bucket + Bucket2: + Type: AWS::S3::Bucket + Metadata: + Bucket1Name: !GetAtt Bucket1Arn diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json new file mode 100644 index 0000000000000..d1edb5eabf11c --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-import-stack.expected.json @@ -0,0 +1,78 @@ +{ + "Parameters": { + "MyBucketParameter": { + "Type": "String", + "Default": "default-bucket-param-name" + }, + "referencetoAssetParameters5dc7d4a99cfe2979687dc74f2db9fd75f253b5505a1912b5ceecf70c9aefba50S3BucketEAA24F0CRef": { + "Type": "String" + }, + "referencetoAssetParameters5dc7d4a99cfe2979687dc74f2db9fd75f253b5505a1912b5ceecf70c9aefba50S3VersionKey1194CAB2Ref": { + "Type": "String" + } + }, + "Resources": { + "GrandChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": { + "Fn::Join": [ + "", + [ + "https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "referencetoAssetParameters5dc7d4a99cfe2979687dc74f2db9fd75f253b5505a1912b5ceecf70c9aefba50S3BucketEAA24F0CRef" + }, + "/", + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "referencetoAssetParameters5dc7d4a99cfe2979687dc74f2db9fd75f253b5505a1912b5ceecf70c9aefba50S3VersionKey1194CAB2Ref" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "referencetoAssetParameters5dc7d4a99cfe2979687dc74f2db9fd75f253b5505a1912b5ceecf70c9aefba50S3VersionKey1194CAB2Ref" + } + ] + } + ] + } + ] + ] + }, + "Parameters": { + "MyBucketParameter": "some-other-bucket-name" + } + } + }, + "BucketImport": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "MyBucketParameter" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-import-stack.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-import-stack.json new file mode 100644 index 0000000000000..25e2e5f9bf183 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-import-stack.json @@ -0,0 +1,27 @@ +{ + "Parameters": { + "MyBucketParameter": { + "Type": "String", + "Default": "default-bucket-param-name" + } + }, + "Resources": { + "BucketImport": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "MyBucketParameter" + } + } + }, + "GrandChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-other-bucket-name" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-no-bucket.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-no-bucket.json new file mode 100644 index 0000000000000..63ede414bbdaa --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-no-bucket.json @@ -0,0 +1,19 @@ +{ + "Parameters": { + "MyBucketParameter": { + "Type": "String", + "Default": "default-bucket-param-name" + } + }, + "Resources": { + "GrandChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-other-bucket-name" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-two-parameters.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-two-parameters.json new file mode 100644 index 0000000000000..462f9a78d9389 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-two-parameters.json @@ -0,0 +1,34 @@ +{ + "Parameters": { + "FirstParameter": { + "Type": "String" + }, + "SecondParameter": { + "Type": "String" + } + }, + "Resources": { + "BucketImport": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "FirstParameter" + }, + "AccessControl": { + "Ref": "SecondParameter" + } + } + }, + "GrandChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "FirstParameter": { + "Ref": "FirstParameter" + } + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml new file mode 100644 index 0000000000000..0101bc0c91baa --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/child-with-number-parameter.yaml @@ -0,0 +1,9 @@ +AWSTemplateFormatVersion: '2010-09-09' +Parameters: + Number: + Type: Number +Resources: + S3Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: 'testbucket1234unique' diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/cross-stack-refs.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/cross-stack-refs.json new file mode 100644 index 0000000000000..d51bd69c1a26c --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/cross-stack-refs.json @@ -0,0 +1,22 @@ +{ + "Parameters": { + "Param": { + "Type": "String" + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket" + }, + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/child-import-stack.json", + "Parameters": { + "Param1": { "Ref": "Param" }, + "Param2": { "Fn::GetAtt": ["Bucket", "Arn"] } + } + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/custom-resource.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/custom-resource.json new file mode 100644 index 0000000000000..23c13fd6946bc --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/custom-resource.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "CustomResource": { + "Type": "AWS::CustomResource::Type" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json new file mode 100644 index 0000000000000..cf8b9a7953356 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/grandchild-import-stack.json @@ -0,0 +1,26 @@ +{ + "Parameters": { + "MyBucketParameter": { + "Type": "String", + "Default": "default-bucket-param-name" + } + }, + "Resources": { + "BucketImport": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::Join": [ + "-", + [ + "bucket-name-prefix", + { + "Ref": "MyBucketParameter" + } + ] + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json new file mode 100644 index 0000000000000..e29a1437b87ff --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/only-nested-stack.expected.json @@ -0,0 +1,69 @@ +{ + "Resources": { + "NestedStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": { + "Fn::Join": [ + "", + [ + "https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "AssetParameters6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7S3BucketC8A1BF52" + }, + "/", + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "AssetParameters6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7S3VersionKeyA9E03E19" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "AssetParameters6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7S3VersionKeyA9E03E19" + } + ] + } + ] + } + ] + ] + } + } + } + }, + "Parameters": { + "AssetParameters6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7S3BucketC8A1BF52": { + "Type": "String", + "Description": "S3 bucket for asset \"6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7\"" + }, + "AssetParameters6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7S3VersionKeyA9E03E19": { + "Type": "String", + "Description": "S3 key for asset version \"6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7\"" + }, + "AssetParameters6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7ArtifactHash605B2835": { + "Type": "String", + "Description": "Artifact hash for asset \"6b884775090ed88cd1a143f64442a92a6c34eaeff3857976d15ef2e3beee05d7\"" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/only-nested-stack.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/only-nested-stack.json new file mode 100644 index 0000000000000..af762ed14cb89 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/only-nested-stack.json @@ -0,0 +1,10 @@ +{ + "Resources": { + "NestedStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "doesnt-matter" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json new file mode 100644 index 0000000000000..badd2f7d78f9e --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-bad-depends-on.json @@ -0,0 +1,13 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/child-import-stack.json" + }, + "DependsOn": [ + "AFakeResource" + ] + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-creation-policy.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-creation-policy.json new file mode 100644 index 0000000000000..1143271208967 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-creation-policy.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-magic-bucket-name" + } + }, + "CreationPolicy": { + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json new file mode 100644 index 0000000000000..5d042b11b02b3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-invalid-condition.json @@ -0,0 +1,14 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-magic-bucket-name" + } + }, + "Condition": "FakeCondition" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml new file mode 100644 index 0000000000000..10ad404e4dc44 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-number-in-child-params.yaml @@ -0,0 +1,8 @@ +AWSTemplateFormatVersion: '2010-09-09' +Resources: + NestedStack: + Type: AWS::CloudFormation::Stack + Properties: + TemplateURL: 'https://s3.amazonaws.com/masonme-cdk-test/templates/nested-bucket.yaml' + Parameters: + Number: 60 diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-one-child.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-one-child.json new file mode 100644 index 0000000000000..1fd331f53213f --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-one-child.json @@ -0,0 +1,13 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-magic-bucket-name" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-two-children.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-two-children.json new file mode 100644 index 0000000000000..1ed2a9403afb6 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-two-children.json @@ -0,0 +1,22 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/child-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-magic-bucket-name" + } + } + }, + "AnotherChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/child-import-stack.json", + "Parameters": { + "MyBucketParameter": "another-magic-bucket-name" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-two-parameters.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-two-parameters.json new file mode 100644 index 0000000000000..cf1b9dc8fcbf8 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-two-parameters.json @@ -0,0 +1,14 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "FirstParameter": "first-value", + "SecondParameter": "second-value" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-update-policy.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-update-policy.json new file mode 100644 index 0000000000000..8e4daa8f65014 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-update-policy.json @@ -0,0 +1,15 @@ +{ + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-magic-bucket-name" + } + }, + "UpdatePolicy": { + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-valid-condition.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-valid-condition.json new file mode 100644 index 0000000000000..6f7ebee7b51b0 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-valid-condition.json @@ -0,0 +1,24 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/grandchild-import-stack.json", + "Parameters": { + "MyBucketParameter": "some-magic-bucket-name" + } + }, + "Condition": "AlwaysFalseCond" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-with-attributes.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-with-attributes.json new file mode 100644 index 0000000000000..8307976b35ba1 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/nested/parent-with-attributes.json @@ -0,0 +1,37 @@ +{ + "Parameters": { + "ArrayParam": { + "Type": "CommaDelimitedList" + } + }, + "Resources": { + "ChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/child-import-stack.json", + "NotificationARNs": { "Ref": "ArrayParam" }, + "TimeoutInMinutes": { + "Fn::Select": [0, { + "Ref": "ArrayParam" + }] + } + }, + "DependsOn": [ + "AnotherChildStack" + ], + "Metadata": { + "Property1": "Value1" + }, + "DeletionPolicy": "Retain", + "UpdateReplacePolicy": "Retain" + }, + "AnotherChildStack": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://cfn-templates-set.s3.amazonaws.com/child-import-stack.json", + "NotificationARNs": [ "arn1" ], + "TimeoutInMinutes": 5 + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/non-existent-resource-attribute.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/non-existent-resource-attribute.json new file mode 100644 index 0000000000000..fc8d8f5f83454 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/non-existent-resource-attribute.json @@ -0,0 +1,8 @@ +{ + "Resources": { + "Bucket2": { + "Type": "AWS::S3::Bucket", + "NonExistentResourceAttribute": "Bucket1" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/number-for-string.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/number-for-string.json new file mode 100644 index 0000000000000..b9cf1b8198033 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/number-for-string.json @@ -0,0 +1,18 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "WebsiteConfiguration": { + "RoutingRules": [ + { + "RedirectRule": { + "HttpRedirectCode": 403 + } + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-bucket-complex-props.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-bucket-complex-props.json new file mode 100644 index 0000000000000..afaa16a4ab17a --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-bucket-complex-props.json @@ -0,0 +1,22 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedMethods": [ + "GET" + ], + "AllowedOrigins": [ + "*" + ], + "MaxAge": 10 + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json new file mode 100644 index 0000000000000..efab5517fdbff --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-empty-bucket-with-parameters.json @@ -0,0 +1,45 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "My template description", + "Parameters": { + "Param": { + "Description": "The description of the parameter", + "Type": "String", + "Default": "" + } + }, + "Conditions": { + "Cond1": { + "Fn::Equals": ["a", "b"] + } + }, + "Outputs": { + "Output1": { + "Value": { + "Fn::If": [ + "Cond1", + { "Fn::Base64": "Output1Value" }, + { "Fn::GetAtt": ["Bucket", "DualStackDomainName"] } + ] + } + } + }, + "Metadata": { + "Instances" : { + "Description" : "Information about the instances" + } + }, + "Mappings" : { + "Mapping01" : { + "Key01" : { + "Name" : "Value01" + } + } + }, + "Transform": "AWS::Serverless-2016-10-31", + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-empty-bucket.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-empty-bucket.json new file mode 100644 index 0000000000000..ead9c6c0e35a6 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-empty-bucket.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-mapping-and-bucket.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-mapping-and-bucket.json new file mode 100644 index 0000000000000..a71a2c62bcf55 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-mapping-and-bucket.json @@ -0,0 +1,23 @@ +{ + "Mappings": { + "SomeMapping": { + "region": { + "key1": "value1" + } + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::FindInMap": [ + "SomeMapping", + { "Ref": "AWS::Region" }, + "key1" + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-parameters-and-rule.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-parameters-and-rule.json new file mode 100644 index 0000000000000..d1d15650f5113 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/only-parameters-and-rule.json @@ -0,0 +1,42 @@ +{ + "Parameters": { + "Env": { + "Type": "String" + }, + "Subnets": { + "Type": "List" + } + }, + "Conditions": { + "IsProduction": { + "Fn::Equals": [ + { "Ref": "Env" }, + "prod" + ] + } + }, + "Rules": { + "TestVpcRule": { + "RuleCondition": { + "Fn::If": [ + "IsProduction", + true, + { + "Fn::Contains": [ + ["test", "pre-prod", "preprod"], + { "Ref": "Env" } + ] + } + ] + }, + "Assertions": [ + { + "Fn::EachMemberIn": [ + { "Fn::ValueOfAll": ["AWS::EC2::Subnet::Id", "VpcId"] }, + { "Fn::ValueOf": ["Subnets", "VpcId"] } + ] + } + ] + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/outputs-with-references.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/outputs-with-references.json new file mode 100644 index 0000000000000..206b1d1d15009 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/outputs-with-references.json @@ -0,0 +1,45 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Parameters": { + "MyParam": { + "Type": "String" + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket" + }, + "Output1": { + "Type": "AWS::S3::Bucket" + } + }, + "Outputs": { + "Output1": { + "Value": { + "Fn::Join": [ "", [ + { "Ref": "MyParam" }, + { "Fn::GetAtt": [ "Bucket", "Arn" ] } ] + ] + }, + "Description": { + "Ref": "Bucket" + }, + "Condition": "AlwaysFalseCond", + "Export": { + "Name": "Bucket" + } + }, + "OutputWithNoCondition": { + "Value": "some-value" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/parameter-references.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/parameter-references.json new file mode 100644 index 0000000000000..2da6e28215241 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/parameter-references.json @@ -0,0 +1,54 @@ +{ + "Transform" : { + "Name" : "AWS::Include", + "Parameters" : { + "Location" : { + "Ref": "MyParam" + } + } + }, + "Parameters": { + "MyParam": { + "Type": "String", + "Default": "MyValue" + } + }, + "Conditions": { + "AlwaysFalse": { + "Fn::Equals": [ { "Ref": "MyParam" }, "Invalid?BucketName"] + } + }, + "Metadata": { + "Field": { + "Fn::If": [ + "AlwaysFalse", + "AWS::NoValue", + { + "Ref": "MyParam" + } + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Metadata": { + "Field": { + "Ref": "MyParam" + } + }, + "Properties": { + "BucketName": { + "Ref": "MyParam" + } + } + } + }, + "Outputs": { + "MyOutput": { + "Value": { + "Ref": "MyParam" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json new file mode 100644 index 0000000000000..dde5dbe4f2d74 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/properties-not-in-cfn-spec.json @@ -0,0 +1,55 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "PropertyNotInCfnSchema": 1, + "AccelerateConfiguration": { + "AccelerationStatus": "Enabled", + "PropertyNotInCfnSchema": false + }, + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedMethods": [ + "GET" + ], + "AllowedOrigins": [ + "origin1" + ], + "MaxAge": 5, + "PropertyNotInCfnSchema": "unmodeled property in array" + } + ] + } + } + }, + "Function": { + "Type": "AWS::Serverless::Function", + "Properties": { + "Handler": "index.handler", + "Runtime": "nodejs14.x", + "CodeUri": { + "Bucket": "bucket", + "Key": "key" + }, + "Events": { + "Api": { + "Properties": { + "Method": "GET", + "Path": "/" + }, + "Type": "Api", + "PropertyNotInCfnSchema": "unmodeled property in map" + } + }, + "ParentPropertyNotInCfnSchema": { + "ChildPropertyNotInCfnSchema": { + "Ref": "Bucket" + } + } + } + } + }, + "Transform": "AWS::Serverless-2016-10-31" +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/ref-array-property.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/ref-array-property.json new file mode 100644 index 0000000000000..4c0c277c382ae --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/ref-array-property.json @@ -0,0 +1,29 @@ +{ + "Parameters": { + "Methods": { + "Description": "The description of the parameter", + "Type": "CommaDelimitedList", + "Default": "GET,PUT" + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedMethods": { + "Ref": "Methods" + }, + "AllowedOrigins": [ + "/path/*" + ], + "MaxAge": 20 + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-condition.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-condition.json new file mode 100644 index 0000000000000..77caf02cb0357 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-condition.json @@ -0,0 +1,18 @@ +{ + "Conditions": { + "AlwaysFalseCond": { + "Fn::Equals": [ + { + "Ref": "AWS::Region" + }, + "completely-made-up-region" + ] + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Condition": "AlwaysFalseCond" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json new file mode 100644 index 0000000000000..a3c1f9e69e88f --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-creation-policy.json @@ -0,0 +1,24 @@ +{ + "Parameters": { + "CountParameter": { + "Type": "Number", + "Default": 3 + } + }, + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "CreationPolicy": { + "AutoScalingCreationPolicy": { + "MinSuccessfulInstancesPercent": 50 + }, + "ResourceSignal": { + "Count": { + "Ref": "CountParameter" + }, + "Timeout":"PT5H4M3S" + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json new file mode 100644 index 0000000000000..a456c9a5a6b16 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json @@ -0,0 +1,17 @@ +{ + "Resources": { + "Bucket0": { + "Type": "AWS::S3::Bucket" + }, + "Bucket1": { + "Type": "AWS::S3::Bucket" + }, + "Bucket2": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": "bucket2" + }, + "DependsOn": ["Bucket0", "Bucket1"] + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-depends-on.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-depends-on.json new file mode 100644 index 0000000000000..82b049a7fd2ac --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-depends-on.json @@ -0,0 +1,14 @@ +{ + "Resources": { + "Bucket1": { + "Type": "AWS::S3::Bucket" + }, + "Bucket2": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": "bucket2" + }, + "DependsOn": "Bucket1" + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-update-policy.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-update-policy.json new file mode 100644 index 0000000000000..e1440a46193be --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/resource-attribute-update-policy.json @@ -0,0 +1,61 @@ +{ + "Parameters": { + "WaitOnResourceSignals": { + "Type": "String", + "Default": "true" + } + }, + "Resources": { + "CodeDeployApp": { + "Type": "AWS::CodeDeploy::Application" + }, + "CodeDeployDg": { + "Type": "AWS::CodeDeploy::DeploymentGroup", + "Properties": { + "ApplicationName": { "Ref": "CodeDeployApp" }, + "ServiceRoleArn": "my-role-arn" + } + }, + "Bucket": { + "Type": "AWS::S3::Bucket", + "UpdatePolicy": { + "AutoScalingReplacingUpdate": { + "WillReplace": false + }, + "AutoScalingRollingUpdate": { + "MaxBatchSize" : 1, + "MinInstancesInService" : 2, + "MinSuccessfulInstancesPercent" : 3, + "PauseTime" : "PT4M3S", + "SuspendProcesses" : [ + "Launch", + "Terminate", + "HealthCheck", + "ReplaceUnhealthy", + "AZRebalance", + "AlarmNotification", + "ScheduledActions", + "AddToLoadBalancer" + ], + "WaitOnResourceSignals" : { + "Fn::Equals": [ + "true", + { "Ref": "WaitOnResourceSignals" } + ] + } + }, + "AutoScalingScheduledAction": { + "IgnoreUnmodifiedGroupSizeProperties": true + }, + "CodeDeployLambdaAliasUpdate" : { + "AfterAllowTrafficHook" : "Lambda1", + "ApplicationName" : { "Ref": "CodeDeployApp" }, + "BeforeAllowTrafficHook" : "Lambda2", + "DeploymentGroupName" : { "Ref": "CodeDeployDg" } + }, + "EnableVersionUpgrade": true, + "UseOnlineResharding": false + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml new file mode 100644 index 0000000000000..77be57c23823c --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-object.yaml @@ -0,0 +1,11 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Resources: + Api: + Type: AWS::Serverless::Api + Properties: + StageName: prod + DefinitionBody: + Body: DefinitionBody + EndpointConfiguration: + Type: GLOBAL diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml new file mode 100644 index 0000000000000..1898e5105a864 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-string-empty.yaml @@ -0,0 +1,10 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Resources: + Api: + Type: AWS::Serverless::Api + Properties: + StageName: prod + DefinitionBody: + Body: DefinitionBody + EndpointConfiguration: '' # empty string diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml new file mode 100644 index 0000000000000..a12949dabd226 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/api-endpoint-config-string.yaml @@ -0,0 +1,10 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Resources: + Api: + Type: AWS::Serverless::Api + Properties: + StageName: prod + DefinitionBody: + Body: DefinitionBody + EndpointConfiguration: GLOBAL diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml new file mode 100644 index 0000000000000..5337644447d8f --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-param.yaml @@ -0,0 +1,13 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Parameters: + CodeLocation: + Type: String +Resources: + MicroserviceHttpEndpoint: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs12.x + CodeUri: + Ref: CodeLocation diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml new file mode 100644 index 0000000000000..0c6b8a60f367b --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-as-s3location.yaml @@ -0,0 +1,11 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Resources: + MicroserviceHttpEndpoint: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs12.x + CodeUri: + Bucket: awsserverlessrepo-changesets-1f9ifp952i9h0 + Key: 123456789012/arn:aws:serverlessrepo:us-east-1:077246666028:applications-microservice-http-endpoint-versions-1.0.4/dc38a8c1-d27f-44f3-b545-4cfff4f8b865 diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml new file mode 100644 index 0000000000000..edcec53936097 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-minimal-sam-function-codeuri-bucket-as-param.yaml @@ -0,0 +1,15 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Parameters: + CodeLocation: + Type: String +Resources: + MicroserviceHttpEndpoint: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs12.x + CodeUri: + Bucket: + Ref: CodeLocation + Key: my-key diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml new file mode 100644 index 0000000000000..f8d6a15bf5cdb --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud-if.yaml @@ -0,0 +1,26 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Conditions: + SomeCondition: + Fn::Equals: [1, 2] +Parameters: + TableNameParameter: + Type: String +Resources: + MicroserviceHttpEndpoint: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs12.x + CodeUri: + Bucket: awsserverlessrepo-changesets-1f9ifp952i9h0 + Key: 828671620168/arn:aws:serverlessrepo:us-east-1:077246666028:applications-microservice-http-endpoint-versions-1.0.4/dc38a8c1-d27f-44f3-b545-4cfff4f8b865 + Policies: + - Fn::If: + - SomeCondition + - DynamoDBCrudPolicy: + TableName: + Ref: TableNameParameter + - DynamoDBCrudPolicy: + TableName: + Ref: TableNameParameter diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml new file mode 100644 index 0000000000000..6b68a0a2fdec3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/sam/only-sam-function-policies-array-ddb-crud.yaml @@ -0,0 +1,16 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Parameters: + TableNameParameter: + Type: String +Resources: + MicroserviceHttpEndpoint: + Type: AWS::Serverless::Function + Properties: + Handler: index.handler + Runtime: nodejs12.x + CodeUri: my-code-uri + Policies: + - DynamoDBCrudPolicy: + TableName: + Ref: TableNameParameter diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/ssm-association.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/ssm-association.json new file mode 100644 index 0000000000000..5b115bff34b5b --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/ssm-association.json @@ -0,0 +1,14 @@ +{ + "Resources": { + "Association": { + "Type": "AWS::SSM::Association", + "Properties": { + "Name": "association", + "Parameters": { + "P1": ["a", "b"], + "p2": [] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/string-for-number.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/string-for-number.json new file mode 100644 index 0000000000000..a623ff02c6217 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/string-for-number.json @@ -0,0 +1,18 @@ +{ + "Resources": { + "Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedMethods": ["GET"], + "AllowedOrigins": ["*"], + "MaxAge": "10" + } + ] + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/user-data.json b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/user-data.json new file mode 100644 index 0000000000000..81f926fcbf3cf --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/user-data.json @@ -0,0 +1,30 @@ +{ + "Resources": { + "LaunchConfig": { + "Type" : "AWS::AutoScaling::LaunchConfiguration", + "Properties": { + "ImageId": "ami-01e24be29428c15b2", + "InstanceType": "t1.micro", + "UserData": { + "Fn::Base64": { + "Fn::Join": ["", [ + "#!/bin/bash -xe\n", + "yum update -y aws-cfn-bootstrap\n", + + "/opt/aws/bin/cfn-init -v ", + " --stack ", { "Ref" : "AWS::StackName" }, + " --resource LaunchConfig ", + " --configsets wordpress_install ", + " --region ", { "Ref" : "AWS::Region" }, "\n", + + "/opt/aws/bin/cfn-signal -e $? ", + " --stack ", { "Ref" : "AWS::StackName" }, + " --resource WebServerGroup ", + " --region ", { "Ref" : "AWS::Region" }, "\n" + ]] + } + } + } + } + } +} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml new file mode 100644 index 0000000000000..899904f61a8cf --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/invalid/short-form-import-sub.yaml @@ -0,0 +1,7 @@ +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !ImportValue + !Sub ${AWS::Region} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml new file mode 100644 index 0000000000000..d1bb1598365f1 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/invalid/short-form-transform.yaml @@ -0,0 +1,12 @@ +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !Transform { + "Name": "SomeMacroName", + "Parameters": { + key1: value1, + key2: value2, + } + } \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml new file mode 100644 index 0000000000000..111490f99c9db --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/json-in-fn-sub.yaml @@ -0,0 +1,26 @@ +AWSTemplateFormatVersion: 2010-09-09 +Parameters: + Stage: + Type: String +Resources: + Dashboard: + Type: AWS::CloudWatch::Dashboard + Properties: + DashboardName: !Sub ${Stage}-Dashboard + DashboardBody: !Sub | + { + "widgets": [ + { + "type": "text", + "properties": { + "markdown": "${Stage} ${Stage}" + } + }, + { + "type": "text", + "properties": { + "markdown": "${Stage} ${Stage}" + } + } + ] + } diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml new file mode 100644 index 0000000000000..34fbe929fca1f --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/long-form-subnet.yaml @@ -0,0 +1,45 @@ +Conditions: + AlwaysTrueCond: + Fn::Not: + - Fn::Equals: + - Ref: AWS::Region + - completely-made-up-region +Resources: + Bucket1: + Type: AWS::S3::Bucket + Properties: + BucketName: SomeBucketName + Bucket2: + Type: AWS::S3::Bucket + Properties: + BucketName: + Fn::GetAtt: [ Bucket1, Arn ] + CorsConfiguration: + CorsRules: + - AllowedMethods: + - GET + - POST + AllowedOrigins: + - Fn::Join: ['', [{ Ref: Bucket1 }, '1']] + - origin2 + MaxAge: + 2 + Subnet: + Type: AWS::EC2::Subnet + Properties: + VpcId: + Fn::If: + - AlwaysTrueCond + - Fn::Select: + - 0 + - Fn::Split: + - "," + - Fn::ImportValue: ImportedVpcId + - Fn::Select: + - 0 + - Fn::GetAZs: eu-west-2 + CidrBlock: 10.0.0.0/24 + AvailabilityZone: + Fn::Select: + - '0' + - Fn::GetAZs: '' diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml new file mode 100644 index 0000000000000..f32def7fd072a --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/long-form-vpc.yaml @@ -0,0 +1,52 @@ +Mappings: + RegionMap: + region-1: + HVM64: name1 + HVMG2: name2 +Conditions: + AlwaysTrueCond: + Fn::And: + - Fn::Not: + - Fn::Equals: [ Ref: "AWS::Region", completely-made-up-region] + - Fn::Or: + - Fn::Equals: [ Ref: "AWS::Region", completely-made-up-region] + - Fn::Equals: [ Ref: "AWS::Region", completely-made-up-region] +Resources: + Vpc: + Type: AWS::EC2::VPC + Properties: + CidrBlock: + Fn::If: + - AlwaysTrueCond + - Fn::Cidr: + - 192.168.1.1/24 + - 2 + - 5 + - Fn::Cidr: + - 10.0.0.0/24 + - '6' + - '5' + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + Fn::If: + - AlwaysTrueCond + - Fn::FindInMap: + - RegionMap + - region-1 + - HVM64 + - Fn::Transform: + Name: AWS::Include + Parameters: + Location: location, + AnotherParameter: + Fn::Base64: AnotherValue + AccessControl: + Fn::ImportValue: + Fn::Sub: + - "${Region}-foo-${!Immediate}-foo-${Vpc}-${Vpc.Id}-${Name}" + - Name: + Ref: Vpc + Region: + Fn::Base64: AWS::Region diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml new file mode 100644 index 0000000000000..5047abd64962d --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-base64.yaml @@ -0,0 +1,6 @@ +Resources: + Base64Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !Base64 NonBase64BucketName diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml new file mode 100644 index 0000000000000..ed77a78548925 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-cidr.yaml @@ -0,0 +1,14 @@ +Resources: + CidrVpc1: + Type: AWS::EC2::VPC + Properties: + CidrBlock: + !Cidr [ 192.168.1.1/24, 2, 5 ] + CidrVpc2: + Type: AWS::EC2::VPC + Properties: + CidrBlock: + !Cidr + - "192.168.1.1/24" + - "2" + - "5" diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml new file mode 100644 index 0000000000000..0eb44349d1775 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-conditionals.yaml @@ -0,0 +1,14 @@ +Conditions: + AlwaysTrueCond: + !And + - !Not [ !Equals [ !Ref "AWS::Region", completely-made-up-region ] ] + - !Or [ !Equals [ !Ref "AWS::Region", completely-made-up-region ], !Equals [ !Ref "AWS::Region", completely-made-up-region] ] +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !If + - AlwaysTrueCond + - MyBucketName + - !Ref AWS::NoValue \ No newline at end of file diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml new file mode 100644 index 0000000000000..376f77921ab5f --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-conditions.yaml @@ -0,0 +1,18 @@ +Conditions: + AlwaysTrueCond: + !Not [ !Equals [ !Ref "AWS::Region", completely-made-up-region1 ] ] + AnotherAlwaysTrueCond: + !Not [ !Equals [ !Ref "AWS::Region", completely-made-up-region2 ] ] + ThirdAlwaysTrueCond: + !Not [ !Equals [ !Ref "AWS::Region", completely-made-up-region3 ] ] + CombinedCond: + !Or [!Condition AlwaysTrueCond, !Condition AnotherAlwaysTrueCond, !Condition ThirdAlwaysTrueCond] +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !If + - CombinedCond + - MyBucketName + - !Ref AWS::NoValue diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml new file mode 100644 index 0000000000000..39d8e582473f6 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-find-in-map.yaml @@ -0,0 +1,19 @@ +Mappings: + RegionMap: + region-1: + HVM64: name1 + HVMG2: name2 +Resources: + Bucket1: + Type: AWS::S3::Bucket + Properties: + BucketName: + !FindInMap + - RegionMap + - region-1 + - HVM64 + Bucket2: + Type: AWS::S3::Bucket + Properties: + BucketName: + !FindInMap [ RegionMap, region-1, HVMG2 ] diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml new file mode 100644 index 0000000000000..72ccedb2c61c9 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-fnsub-string.yaml @@ -0,0 +1,11 @@ +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + Fn::Sub: some-bucket${!AWS::AccountId}7896${ ! AWS::Region}1-1${!Immediate}234 + AnotherBucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !Sub 1-${AWS::Region}-foo-${Bucket}-${!Literal}-${Bucket.DomainName}-${AWS::Region} diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml new file mode 100644 index 0000000000000..146f04045d380 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-get-att.yaml @@ -0,0 +1,24 @@ +Resources: + ELB: + Type: AWS::ElasticLoadBalancing::LoadBalancer + Properties: + AvailabilityZones: + - us-east-1a + Listeners: + - LoadBalancerPort: '80' + InstancePort: '80' + Protocol: HTTP + Bucket0: + Type: AWS::S3::Bucket + Properties: + BucketName: some-bucket + Bucket1: + Type: AWS::S3::Bucket + Properties: + BucketName: !GetAtt Bucket0.Arn + AccessControl: !GetAtt [ELB, SourceSecurityGroup.GroupName] + Bucket2: + Type: AWS::S3::Bucket + Properties: + BucketName: !GetAtt [ Bucket1, Arn ] + AccessControl: !GetAtt 'ELB.SourceSecurityGroup.GroupName' diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml new file mode 100644 index 0000000000000..1d5d4dabea4bc --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-import-value.yaml @@ -0,0 +1,6 @@ +Resources: + Bucket1: + Type: AWS::S3::Bucket + Properties: + BucketName: + !ImportValue SomeSharedValue diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-join.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-join.yaml new file mode 100644 index 0000000000000..ca9ab12b6521d --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-join.yaml @@ -0,0 +1,11 @@ +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: !Join [ + ' ', + [ + "NamePart1 ", + !ImportValue SomeSharedValue + ] + ] diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-select.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-select.yaml new file mode 100644 index 0000000000000..8e0374a8413e3 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-select.yaml @@ -0,0 +1,17 @@ +Resources: + Subnet1: + Type: AWS::EC2::Subnet + Properties: + VpcId: + !Select [ 0, !GetAZs "" ] + CidrBlock: 10.0.0.0/24 + AvailabilityZone: + !Select [ '0', !GetAZs eu-west-2 ] + Subnet2: + Type: AWS::EC2::Subnet + Properties: + VpcId: + !Ref Subnet1 + CidrBlock: 10.0.0.0/24 + AvailabilityZone: + !Select [ 0, !GetAZs eu-west-2 ] diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-split.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-split.yaml new file mode 100644 index 0000000000000..17661580f0246 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-split.yaml @@ -0,0 +1,15 @@ +Resources: + Bucket1: + Type: AWS::S3::Bucket + Properties: + BucketName: !Split [ + ' ', + !ImportValue SomeSharedBucketName + ] + Bucket2: + Type: AWS::S3::Bucket + Properties: + BucketName: + !Split + - ' ' + - !ImportValue SomeSharedBucketName diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml new file mode 100644 index 0000000000000..80450b205abba --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/short-form-sub-map.yaml @@ -0,0 +1,15 @@ +Resources: + Bucket: + Type: AWS::S3::Bucket + Properties: + BucketName: + !Sub + - "${Region}-foo-${!Immediate}-foo-${AnotherBucket}-${AnotherBucket.DomainName}-${Name}" + - Name: + Ref: AnotherBucket + Region: + Fn::Base64: AWS::Region + AnotherBucket: + Type: AWS::S3::Bucket + Properties: + BucketName: another-bucket diff --git a/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml new file mode 100644 index 0000000000000..f25f363879810 --- /dev/null +++ b/packages/aws-cdk-lib/cloudformation-include/test/test-templates/yaml/year-month-date-as-strings.yaml @@ -0,0 +1,14 @@ +AWSTemplateFormatVersion: 2010-09-09 +Resources: + Role: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: 2012-10-17 + Statement: + - Effect: Allow + Principal: + Service: + - ec2.amazonaws.com + Action: + - sts:AssumeRole diff --git a/packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts b/packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts similarity index 99% rename from packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts rename to packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts index dd7ce7e875a23..ff0e8b99f1f6f 100644 --- a/packages/@aws-cdk/cloudformation-include/test/valid-templates.test.ts +++ b/packages/aws-cdk-lib/cloudformation-include/test/valid-templates.test.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as ssm from '@aws-cdk/aws-ssm'; -import * as core from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as iam from '../../aws-iam'; +import * as s3 from '../../aws-s3'; +import * as ssm from '../../aws-ssm'; +import * as core from '../../core'; import * as constructs from 'constructs'; import * as inc from '../lib'; import * as futils from '../lib/file-utils'; diff --git a/packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts b/packages/aws-cdk-lib/cloudformation-include/test/yaml-templates.test.ts similarity index 98% rename from packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts rename to packages/aws-cdk-lib/cloudformation-include/test/yaml-templates.test.ts index 4c693bd1026dc..7497ebaf1ca92 100644 --- a/packages/@aws-cdk/cloudformation-include/test/yaml-templates.test.ts +++ b/packages/aws-cdk-lib/cloudformation-include/test/yaml-templates.test.ts @@ -1,7 +1,7 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; -import * as core from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as cloudwatch from '../../aws-cloudwatch'; +import * as core from '../../core'; import * as constructs from 'constructs'; import * as inc from '../lib'; import * as futils from '../lib/file-utils'; diff --git a/packages/aws-cdk-lib/core/README.md b/packages/aws-cdk-lib/core/README.md new file mode 100644 index 0000000000000..92b3c137a06c5 --- /dev/null +++ b/packages/aws-cdk-lib/core/README.md @@ -0,0 +1,1419 @@ +# AWS Cloud Development Kit Library + +The AWS CDK construct library provides APIs to define your CDK application and add +CDK constructs to the application. + +## Usage + +### Upgrade from CDK 1.x + +When upgrading from CDK 1.x, remove all dependencies to individual CDK packages +from your dependencies file and follow the rest of the sections. + +### Installation + +To use this package, you need to declare this package and the `constructs` package as +dependencies. + +According to the kind of project you are developing: + +- For projects that are CDK libraries, declare them both under the `devDependencies` + **and** `peerDependencies` sections. +- For CDK apps, declare them under the `dependencies` section only. + +### Use in your code + +#### Classic import + +You can use a classic import to get access to each service namespaces: + +```ts +import { Stack, App, aws_s3 as s3 } from 'aws-cdk-lib'; + +const app = new App(); +const stack = new Stack(app, 'TestStack'); + +new s3.Bucket(stack, 'TestBucket'); +``` + +#### Barrel import + +Alternatively, you can use "barrel" imports: + +```ts +import { App, Stack } from 'aws-cdk-lib'; +import { Bucket } from 'aws-cdk-lib/aws-s3'; + +const app = new App(); +const stack = new Stack(app, 'TestStack'); + +new Bucket(stack, 'TestBucket'); +``` + + + +## Stacks and Stages + +A `Stack` is the smallest physical unit of deployment, and maps directly onto +a CloudFormation Stack. You define a Stack by defining a subclass of `Stack` +-- let's call it `MyStack` -- and instantiating the constructs that make up +your application in `MyStack`'s constructor. You then instantiate this stack +one or more times to define different instances of your application. For example, +you can instantiate it once using few and cheap EC2 instances for testing, +and once again using more and bigger EC2 instances for production. + +When your application grows, you may decide that it makes more sense to split it +out across multiple `Stack` classes. This can happen for a number of reasons: + +- You could be starting to reach the maximum number of resources allowed in a single + stack (this is currently 500). +- You could decide you want to separate out stateful resources and stateless resources + into separate stacks, so that it becomes easy to tear down and recreate the stacks + that don't have stateful resources. +- There could be a single stack with resources (like a VPC) that are shared + between multiple instances of other stacks containing your applications. + +As soon as your conceptual application starts to encompass multiple stacks, +it is convenient to wrap them in another construct that represents your +logical application. You can then treat that new unit the same way you used +to be able to treat a single stack: by instantiating it multiple times +for different instances of your application. + +You can define a custom subclass of `Stage`, holding one or more +`Stack`s, to represent a single logical instance of your application. + +As a final note: `Stack`s are not a unit of reuse. They describe physical +deployment layouts, and as such are best left to application builders to +organize their deployments with. If you want to vend a reusable construct, +define it as a subclasses of `Construct`: the consumers of your construct +will decide where to place it in their own stacks. + +## Stack Synthesizers + +Each Stack has a *synthesizer*, an object that determines how and where +the Stack should be synthesized and deployed. The synthesizer controls +aspects like: + +- How does the stack reference assets? (Either through CloudFormation + parameters the CLI supplies, or because the Stack knows a predefined + location where assets will be uploaded). +- What roles are used to deploy the stack? These can be bootstrapped + roles, roles created in some other way, or just the CLI's current + credentials. + +The following synthesizers are available: + +- `DefaultStackSynthesizer`: recommended. Uses predefined asset locations and + roles created by the modern bootstrap template. Access control is done by + controlling who can assume the deploy role. This is the default stack + synthesizer in CDKv2. +- `LegacyStackSynthesizer`: Uses CloudFormation parameters to communicate + asset locations, and the CLI's current permissions to deploy stacks. The + is the default stack synthesizer in CDKv1. +- `CliCredentialsStackSynthesizer`: Uses predefined asset locations, and the + CLI's current permissions. + +Each of these synthesizers takes configuration arguments. To configure +a stack with a synthesizer, pass it as one of its properties: + +```ts +new MyStack(app, 'MyStack', { + synthesizer: new DefaultStackSynthesizer({ + fileAssetsBucketName: 'my-orgs-asset-bucket', + }), +}); +``` + +For more information on bootstrapping accounts and customizing synthesis, +see [Bootstrapping in the CDK Developer Guide](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html). + +## Nested Stacks + +[Nested stacks](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-nested-stacks.html) are stacks created as part of other stacks. You create a nested stack within another stack by using the `NestedStack` construct. + +As your infrastructure grows, common patterns can emerge in which you declare the same components in multiple templates. You can separate out these common components and create dedicated templates for them. Then use the resource in your template to reference other templates, creating nested stacks. + +For example, assume that you have a load balancer configuration that you use for most of your stacks. Instead of copying and pasting the same configurations into your templates, you can create a dedicated template for the load balancer. Then, you just use the resource to reference that template from within other templates. + +The following example will define a single top-level stack that contains two nested stacks: each one with a single Amazon S3 bucket: + +```ts +class MyNestedStack extends cfn.NestedStack { + constructor(scope: Construct, id: string, props?: cfn.NestedStackProps) { + super(scope, id, props); + + new s3.Bucket(this, 'NestedBucket'); + } +} + +class MyParentStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + new MyNestedStack(this, 'Nested1'); + new MyNestedStack(this, 'Nested2'); + } +} +``` + +Resources references across nested/parent boundaries (even with multiple levels of nesting) will be wired by the AWS CDK +through CloudFormation parameters and outputs. When a resource from a parent stack is referenced by a nested stack, +a CloudFormation parameter will automatically be added to the nested stack and assigned from the parent; when a resource +from a nested stack is referenced by a parent stack, a CloudFormation output will be automatically be added to the +nested stack and referenced using `Fn::GetAtt "Outputs.Xxx"` from the parent. + +Nested stacks also support the use of Docker image and file assets. + +## Accessing resources in a different stack + +You can access resources in a different stack, as long as they are in the +same account and AWS Region (see [next section](#accessing-resources-in-a-different-stack-and-region) for an exception). +The following example defines the stack `stack1`, +which defines an Amazon S3 bucket. Then it defines a second stack, `stack2`, +which takes the bucket from stack1 as a constructor property. + +```ts +const prod = { account: '123456789012', region: 'us-east-1' }; + +const stack1 = new StackThatProvidesABucket(app, 'Stack1' , { env: prod }); + +// stack2 will take a property { bucket: IBucket } +const stack2 = new StackThatExpectsABucket(app, 'Stack2', { + bucket: stack1.bucket, + env: prod +}); +``` + +If the AWS CDK determines that the resource is in the same account and +Region, but in a different stack, it automatically synthesizes AWS +CloudFormation +[Exports](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-exports.html) +in the producing stack and an +[Fn::ImportValue](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-importvalue.html) +in the consuming stack to transfer that information from one stack to the +other. + +## Accessing resources in a different stack and region + +> **This feature is currently experimental** + +You can enable the Stack property `crossRegionReferences` +in order to access resources in a different stack _and_ region. With this feature flag +enabled it is possible to do something like creating a CloudFront distribution in `us-east-2` and +an ACM certificate in `us-east-1`. + +```ts +const stack1 = new Stack(app, 'Stack1', { + env: { + region: 'us-east-1', + }, + crossRegionReferences: true, +}); +const cert = new acm.Certificate(stack1, 'Cert', { + domainName: '*.example.com', + validation: acm.CertificateValidation.fromDns(route53.PublicHostedZone.fromHostedZoneId(stack1, 'Zone', 'Z0329774B51CGXTDQV3X')), +}); + +const stack2 = new Stack(app, 'Stack2', { + env: { + region: 'us-east-2', + }, + crossRegionReferences: true, +}); +new cloudfront.Distribution(stack2, 'Distribution', { + defaultBehavior: { + origin: new origins.HttpOrigin('example.com'), + }, + domainNames: ['dev.example.com'], + certificate: cert, +}); +``` + +When the AWS CDK determines that the resource is in a different stack _and_ is in a different +region, it will "export" the value by creating a custom resource in the producing stack which +creates SSM Parameters in the consuming region for each exported value. The parameters will be +created with the name '/cdk/exports/${consumingStackName}/${export-name}'. +In order to "import" the exports into the consuming stack a [SSM Dynamic reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-ssm) +is used to reference the SSM parameter which was created. + +In order to mimic strong references, a Custom Resource is also created in the consuming +stack which marks the SSM parameters as being "imported". When a parameter has been successfully +imported, the producing stack cannot update the value. + +See the [adr](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/core/adr/cross-region-stack-references) +for more details on this feature. + +### Removing automatic cross-stack references + +The automatic references created by CDK when you use resources across stacks +are convenient, but may block your deployments if you want to remove the +resources that are referenced in this way. You will see an error like: + +```text +Export Stack1:ExportsOutputFnGetAtt-****** cannot be deleted as it is in use by Stack1 +``` + +Let's say there is a Bucket in the `stack1`, and the `stack2` references its +`bucket.bucketName`. You now want to remove the bucket and run into the error above. + +It's not safe to remove `stack1.bucket` while `stack2` is still using it, so +unblocking yourself from this is a two-step process. This is how it works: + +DEPLOYMENT 1: break the relationship + +- Make sure `stack2` no longer references `bucket.bucketName` (maybe the consumer + stack now uses its own bucket, or it writes to an AWS DynamoDB table, or maybe you just + remove the Lambda Function altogether). +- In the `stack1` class, call `this.exportValue(this.bucket.bucketName)`. This + will make sure the CloudFormation Export continues to exist while the relationship + between the two stacks is being broken. +- Deploy (this will effectively only change the `stack2`, but it's safe to deploy both). + +DEPLOYMENT 2: remove the resource + +- You are now free to remove the `bucket` resource from `stack1`. +- Don't forget to remove the `exportValue()` call as well. +- Deploy again (this time only the `stack1` will be changed -- the bucket will be deleted). + +## Durations + +To make specifications of time intervals unambiguous, a single class called +`Duration` is used throughout the AWS Construct Library by all constructs +that that take a time interval as a parameter (be it for a timeout, a +rate, or something else). + +An instance of Duration is constructed by using one of the static factory +methods on it: + +```ts +Duration.seconds(300) // 5 minutes +Duration.minutes(5) // 5 minutes +Duration.hours(1) // 1 hour +Duration.days(7) // 7 days +Duration.parse('PT5M') // 5 minutes +``` + +Durations can be added or subtracted together: + +```ts +Duration.minutes(1).plus(Duration.seconds(60)); // 2 minutes +Duration.minutes(5).minus(Duration.seconds(10)); // 290 secondes +``` + +## Size (Digital Information Quantity) + +To make specification of digital storage quantities unambiguous, a class called +`Size` is available. + +An instance of `Size` is initialized through one of its static factory methods: + +```ts +Size.kibibytes(200) // 200 KiB +Size.mebibytes(5) // 5 MiB +Size.gibibytes(40) // 40 GiB +Size.tebibytes(200) // 200 TiB +Size.pebibytes(3) // 3 PiB +``` + +Instances of `Size` created with one of the units can be converted into others. +By default, conversion to a higher unit will fail if the conversion does not produce +a whole number. This can be overridden by unsetting `integral` property. + +```ts +Size.mebibytes(2).toKibibytes() // yields 2048 +Size.kibibytes(2050).toMebibytes({ rounding: SizeRoundingBehavior.FLOOR }) // yields 2 +``` + +## Secrets + +To help avoid accidental storage of secrets as plain text, we use the `SecretValue` type to +represent secrets. Any construct that takes a value that should be a secret (such as +a password or an access key) will take a parameter of type `SecretValue`. + +The best practice is to store secrets in AWS Secrets Manager and reference them using `SecretValue.secretsManager`: + +```ts +const secret = SecretValue.secretsManager('secretId', { + jsonField: 'password', // optional: key of a JSON field to retrieve (defaults to all content), + versionId: 'id', // optional: id of the version (default AWSCURRENT) + versionStage: 'stage', // optional: version stage name (default AWSCURRENT) +}); +``` + +Using AWS Secrets Manager is the recommended way to reference secrets in a CDK app. +`SecretValue` also supports the following secret sources: + +- `SecretValue.unsafePlainText(secret)`: stores the secret as plain text in your app and the resulting template (not recommended). +- `SecretValue.secretsManager(secret)`: refers to a secret stored in Secrets Manager +- `SecretValue.ssmSecure(param, version)`: refers to a secret stored as a SecureString in the SSM + Parameter Store. If you don't specify the exact version, AWS CloudFormation uses the latest + version of the parameter. +- `SecretValue.cfnParameter(param)`: refers to a secret passed through a CloudFormation parameter (must have `NoEcho: true`). +- `SecretValue.cfnDynamicReference(dynref)`: refers to a secret described by a CloudFormation dynamic reference (used by `ssmSecure` and `secretsManager`). +- `SecretValue.resourceAttribute(attr)`: refers to a secret returned from a CloudFormation resource creation. + +`SecretValue`s should only be passed to constructs that accept properties of type +`SecretValue`. These constructs are written to ensure your secrets will not be +exposed where they shouldn't be. If you try to use a `SecretValue` in a +different location, an error about unsafe secret usage will be thrown at +synthesis time. + +If you rotate the secret's value in Secrets Manager, you must also change at +least one property on the resource where you are using the secret, to force +CloudFormation to re-read the secret. + +`SecretValue.ssmSecure()` is only supported for a limited set of resources. +[Click here for a list of supported resources and properties](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#template-parameters-dynamic-patterns-resources). + +## ARN manipulation + +Sometimes you will need to put together or pick apart Amazon Resource Names +(ARNs). The functions `stack.formatArn()` and `stack.parseArn()` exist for +this purpose. + +`formatArn()` can be used to build an ARN from components. It will automatically +use the region and account of the stack you're calling it on: + +```ts +declare const stack: Stack; + +// Builds "arn::lambda:::function:MyFunction" +stack.formatArn({ + service: 'lambda', + resource: 'function', + sep: ':', + resourceName: 'MyFunction' +}); +``` + +`parseArn()` can be used to get a single component from an ARN. `parseArn()` +will correctly deal with both literal ARNs and deploy-time values (tokens), +but in case of a deploy-time value be aware that the result will be another +deploy-time value which cannot be inspected in the CDK application. + +```ts +declare const stack: Stack; + +// Extracts the function name out of an AWS Lambda Function ARN +const arnComponents = stack.parseArn(arn, ':'); +const functionName = arnComponents.resourceName; +``` + +Note that depending on the service, the resource separator can be either +`:` or `/`, and the resource name can be either the 6th or 7th +component in the ARN. When using these functions, you will need to know +the format of the ARN you are dealing with. + +For an exhaustive list of ARN formats used in AWS, see [AWS ARNs and +Namespaces](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +in the AWS General Reference. + +## Dependencies + +### Construct Dependencies + +Sometimes AWS resources depend on other resources, and the creation of one +resource must be completed before the next one can be started. + +In general, CloudFormation will correctly infer the dependency relationship +between resources based on the property values that are used. In the cases where +it doesn't, the AWS Construct Library will add the dependency relationship for +you. + +If you need to add an ordering dependency that is not automatically inferred, +you do so by adding a dependency relationship using +`constructA.node.addDependency(constructB)`. This will add a dependency +relationship between all resources in the scope of `constructA` and all +resources in the scope of `constructB`. + +If you want a single object to represent a set of constructs that are not +necessarily in the same scope, you can use a `DependencyGroup`. The +following creates a single object that represents a dependency on two +constructs, `constructB` and `constructC`: + +```ts +// Declare the dependable object +const bAndC = new DependencyGroup(); +bAndC.add(constructB); +bAndC.add(constructC); + +// Take the dependency +constructA.node.addDependency(bAndC); +``` + +### Stack Dependencies + +Two different stack instances can have a dependency on one another. This +happens when an resource from one stack is referenced in another stack. In +that case, CDK records the cross-stack referencing of resources, +automatically produces the right CloudFormation primitives, and adds a +dependency between the two stacks. You can also manually add a dependency +between two stacks by using the `stackA.addDependency(stackB)` method. + +A stack dependency has the following implications: + +- Cyclic dependencies are not allowed, so if `stackA` is using resources from + `stackB`, the reverse is not possible anymore. +- Stacks with dependencies between them are treated specially by the CDK + toolkit: + - If `stackA` depends on `stackB`, running `cdk deploy stackA` will also + automatically deploy `stackB`. + - `stackB`'s deployment will be performed *before* `stackA`'s deployment. + +### CfnResource Dependencies + +To make declaring dependencies between `CfnResource` objects easier, you can declare dependencies from one `CfnResource` object on another by using the `cfnResource1.addDependency(cfnResource2)` method. This method will work for resources both within the same stack and across stacks as it detects the relative location of the two resources and adds the dependency either to the resource or between the relevant stacks, as appropriate. If more complex logic is in needed, you can similarly remove, replace, or view dependencies between `CfnResource` objects with the `CfnResource` `removeDependency`, `replaceDependency`, and `obtainDependencies` methods, respectively. + +## Custom Resources + +Custom Resources are CloudFormation resources that are implemented by arbitrary +user code. They can do arbitrary lookups or modifications during a +CloudFormation deployment. + +Custom resources are backed by *custom resource providers*. Commonly, these are +Lambda Functions that are deployed in the same deployment as the one that +defines the custom resource itself, but they can also be backed by Lambda +Functions deployed previously, or code responding to SNS Topic events running on +EC2 instances in a completely different account. For more information on custom +resource providers, see the next section. + +Once you have a provider, each definition of a `CustomResource` construct +represents one invocation. A single provider can be used for the implementation +of arbitrarily many custom resource definitions. A single definition looks like +this: + +```ts +new CustomResource(this, 'MyMagicalResource', { + resourceType: 'Custom::MyCustomResource', // must start with 'Custom::' + + // the resource properties + properties: { + Property1: 'foo', + Property2: 'bar' + }, + + // the ARN of the provider (SNS/Lambda) which handles + // CREATE, UPDATE or DELETE events for this resource type + // see next section for details + serviceToken: 'ARN' +}); +``` + +### Custom Resource Providers + +Custom resources are backed by a **custom resource provider** which can be +implemented in one of the following ways. The following table compares the +various provider types (ordered from low-level to high-level): + +| Provider | Compute Type | Error Handling | Submit to CloudFormation | Max Timeout | Language | Footprint | +|----------------------------------------------------------------------|:------------:|:--------------:|:------------------------:|:---------------:|:--------:|:---------:| +| [sns.Topic](#amazon-sns-topic) | Self-managed | Manual | Manual | Unlimited | Any | Depends | +| [lambda.Function](#aws-lambda-function) | AWS Lambda | Manual | Manual | 15min | Any | Small | +| [core.CustomResourceProvider](#the-corecustomresourceprovider-class) | AWS Lambda | Auto | Auto | 15min | Node.js | Small | +| [custom-resources.Provider](#the-custom-resource-provider-framework) | AWS Lambda | Auto | Auto | Unlimited Async | Any | Large | + +Legend: + +- **Compute type**: which type of compute can be used to execute the handler. +- **Error Handling**: whether errors thrown by handler code are automatically + trapped and a FAILED response is submitted to CloudFormation. If this is + "Manual", developers must take care of trapping errors. Otherwise, events + could cause stacks to hang. +- **Submit to CloudFormation**: whether the framework takes care of submitting + SUCCESS/FAILED responses to CloudFormation through the event's response URL. +- **Max Timeout**: maximum allows/possible timeout. +- **Language**: which programming languages can be used to implement handlers. +- **Footprint**: how many resources are used by the provider framework itself. + +**A NOTE ABOUT SINGLETONS** + +When defining resources for a custom resource provider, you will likely want to +define them as a *stack singleton* so that only a single instance of the +provider is created in your stack and which is used by all custom resources of +that type. + +Here is a basic pattern for defining stack singletons in the CDK. The following +examples ensures that only a single SNS topic is defined: + +```ts +function getOrCreate(scope: Construct): sns.Topic { + const stack = Stack.of(scope); + const uniqueid = 'GloballyUniqueIdForSingleton'; // For example, a UUID from `uuidgen` + const existing = stack.node.tryFindChild(uniqueid); + if (existing) { + return existing as sns.Topic; + } + return new sns.Topic(stack, uniqueid); +} +``` + +#### Amazon SNS Topic + +Every time a resource event occurs (CREATE/UPDATE/DELETE), an SNS notification +is sent to the SNS topic. Users must process these notifications (e.g. through a +fleet of worker hosts) and submit success/failure responses to the +CloudFormation service. + +> You only need to use this type of provider if your custom resource cannot run on AWS Lambda, for reasons other than the 15 +> minute timeout. If you are considering using this type of provider because you want to write a custom resource provider that may need +> to wait for more than 15 minutes for the API calls to stabilize, have a look at the [`custom-resources`](#the-custom-resource-provider-framework) module first. +> +> Refer to the [CloudFormation Custom Resource documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) for information on the contract your custom resource needs to adhere to. + +Set `serviceToken` to `topic.topicArn` in order to use this provider: + +```ts +const topic = new sns.Topic(this, 'MyProvider'); + +new CustomResource(this, 'MyResource', { + serviceToken: topic.topicArn +}); +``` + +#### AWS Lambda Function + +An AWS lambda function is called *directly* by CloudFormation for all resource +events. The handler must take care of explicitly submitting a success/failure +response to the CloudFormation service and handle various error cases. + +> **We do not recommend you use this provider type.** The CDK has wrappers around Lambda Functions that make them easier to work with. +> +> If you do want to use this provider, refer to the [CloudFormation Custom Resource documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) for information on the contract your custom resource needs to adhere to. + +Set `serviceToken` to `lambda.functionArn` to use this provider: + +```ts +const fn = new lambda.Function(this, 'MyProvider', functionProps); + +new CustomResource(this, 'MyResource', { + serviceToken: fn.functionArn, +}); +``` + +#### The `core.CustomResourceProvider` class + +The class [`@aws-cdk/core.CustomResourceProvider`] offers a basic low-level +framework designed to implement simple and slim custom resource providers. It +currently only supports Node.js-based user handlers, represents permissions as raw +JSON blobs instead of `iam.PolicyStatement` objects, and it does not have +support for asynchronous waiting (handler cannot exceed the 15min lambda +timeout). + +[`@aws-cdk/core.CustomResourceProvider`]: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.CustomResourceProvider.html + +> **As an application builder, we do not recommend you use this provider type.** This provider exists purely for custom resources that are part of the AWS Construct Library. +> +> The [`custom-resources`](#the-custom-resource-provider-framework) provider is more convenient to work with and more fully-featured. + +The provider has a built-in singleton method which uses the resource type as a +stack-unique identifier and returns the service token: + +```ts +const serviceToken = CustomResourceProvider.getOrCreate(this, 'Custom::MyCustomResourceType', { + codeDirectory: `${__dirname}/my-handler`, + runtime: CustomResourceProviderRuntime.NODEJS_14_X, + description: "Lambda function created by the custom resource provider", +}); + +new CustomResource(this, 'MyResource', { + resourceType: 'Custom::MyCustomResourceType', + serviceToken: serviceToken +}); +``` + +The directory (`my-handler` in the above example) must include an `index.js` file. It cannot import +external dependencies or files outside this directory. It must export an async +function named `handler`. This function accepts the CloudFormation resource +event object and returns an object with the following structure: + +```js +exports.handler = async function(event) { + const id = event.PhysicalResourceId; // only for "Update" and "Delete" + const props = event.ResourceProperties; + const oldProps = event.OldResourceProperties; // only for "Update"s + + switch (event.RequestType) { + case "Create": + // ... + + case "Update": + // ... + + // if an error is thrown, a FAILED response will be submitted to CFN + throw new Error('Failed!'); + + case "Delete": + // ... + } + + return { + // (optional) the value resolved from `resource.ref` + // defaults to "event.PhysicalResourceId" or "event.RequestId" + PhysicalResourceId: "REF", + + // (optional) calling `resource.getAtt("Att1")` on the custom resource in the CDK app + // will return the value "BAR". + Data: { + Att1: "BAR", + Att2: "BAZ" + }, + + // (optional) user-visible message + Reason: "User-visible message", + + // (optional) hides values from the console + NoEcho: true + }; +} +``` + +Here is an complete example of a custom resource that summarizes two numbers: + +`sum-handler/index.js`: + +```js +exports.handler = async (e) => { + return { + Data: { + Result: e.ResourceProperties.lhs + e.ResourceProperties.rhs, + }, + }; +}; +``` + +`sum.ts`: + +```ts nofixture +import { + Construct, + CustomResource, + CustomResourceProvider, + CustomResourceProviderRuntime, + Token, +} from 'aws-cdk-lib'; + +export interface SumProps { + readonly lhs: number; + readonly rhs: number; +} + +export class Sum extends Construct { + public readonly result: number; + + constructor(scope: Construct, id: string, props: SumProps) { + super(scope, id); + + const resourceType = 'Custom::Sum'; + const serviceToken = CustomResourceProvider.getOrCreate(this, resourceType, { + codeDirectory: `${__dirname}/sum-handler`, + runtime: CustomResourceProviderRuntime.NODEJS_14_X, + }); + + const resource = new CustomResource(this, 'Resource', { + resourceType: resourceType, + serviceToken: serviceToken, + properties: { + lhs: props.lhs, + rhs: props.rhs + } + }); + + this.result = Token.asNumber(resource.getAtt('Result')); + } +} +``` + +Usage will look like this: + +```ts fixture=README-custom-resource-provider +const sum = new Sum(this, 'MySum', { lhs: 40, rhs: 2 }); +new CfnOutput(this, 'Result', { value: Token.asString(sum.result) }); +``` + +To access the ARN of the provider's AWS Lambda function role, use the `getOrCreateProvider()` +built-in singleton method: + +```ts +const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', { + codeDirectory: `${__dirname}/my-handler`, + runtime: CustomResourceProviderRuntime.NODEJS_14_X, +}); + +const roleArn = provider.roleArn; +``` + +This role ARN can then be used in resource-based IAM policies. + +To add IAM policy statements to this role, use `addToRolePolicy()`: + +```ts +const provider = CustomResourceProvider.getOrCreateProvider(this, 'Custom::MyCustomResourceType', { + codeDirectory: `${__dirname}/my-handler`, + runtime: CustomResourceProviderRuntime.NODEJS_14_X, +}); +provider.addToRolePolicy({ + Effect: 'Allow', + Action: 's3:GetObject', + Resource: '*', +}) +``` + +Note that `addToRolePolicy()` uses direct IAM JSON policy blobs, *not* a +`iam.PolicyStatement` object like you will see in the rest of the CDK. + +#### The Custom Resource Provider Framework + +The [`@aws-cdk/custom-resources`] module includes an advanced framework for +implementing custom resource providers. + +[`@aws-cdk/custom-resources`]: https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html + +Handlers are implemented as AWS Lambda functions, which means that they can be +implemented in any Lambda-supported runtime. Furthermore, this provider has an +asynchronous mode, which means that users can provide an `isComplete` lambda +function which is called periodically until the operation is complete. This +allows implementing providers that can take up to two hours to stabilize. + +Set `serviceToken` to `provider.serviceToken` to use this type of provider: + +```ts +const provider = new customresources.Provider(this, 'MyProvider', { + onEventHandler, + isCompleteHandler, // optional async waiter +}); + +new CustomResource(this, 'MyResource', { + serviceToken: provider.serviceToken +}); +``` + +See the [documentation](https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html) for more details. + +## AWS CloudFormation features + +A CDK stack synthesizes to an AWS CloudFormation Template. This section +explains how this module allows users to access low-level CloudFormation +features when needed. + +### Stack Outputs + +CloudFormation [stack outputs][cfn-stack-output] and exports are created using +the `CfnOutput` class: + +```ts +new CfnOutput(this, 'OutputName', { + value: myBucket.bucketName, + description: 'The name of an S3 bucket', // Optional + exportName: 'TheAwesomeBucket', // Registers a CloudFormation export named "TheAwesomeBucket" +}); +``` + +[cfn-stack-output]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html + +### Parameters + +CloudFormation templates support the use of [Parameters][cfn-parameters] to +customize a template. They enable CloudFormation users to input custom values to +a template each time a stack is created or updated. While the CDK design +philosophy favors using build-time parameterization, users may need to use +CloudFormation in a number of cases (for example, when migrating an existing +stack to the AWS CDK). + +Template parameters can be added to a stack by using the `CfnParameter` class: + +```ts +new CfnParameter(this, 'MyParameter', { + type: 'Number', + default: 1337, + // See the API reference for more configuration props +}); +``` + +The value of parameters can then be obtained using one of the `value` methods. +As parameters are only resolved at deployment time, the values obtained are +placeholder tokens for the real value (`Token.isUnresolved()` would return `true` +for those): + +```ts +const param = new CfnParameter(this, 'ParameterName', { /* config */ }); + +// If the parameter is a String +param.valueAsString; + +// If the parameter is a Number +param.valueAsNumber; + +// If the parameter is a List +param.valueAsList; +``` + +[cfn-parameters]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html + +### Pseudo Parameters + +CloudFormation supports a number of [pseudo parameters][cfn-pseudo-params], +which resolve to useful values at deployment time. CloudFormation pseudo +parameters can be obtained from static members of the `Aws` class. + +It is generally recommended to access pseudo parameters from the scope's `stack` +instead, which guarantees the values produced are qualifying the designated +stack, which is essential in cases where resources are shared cross-stack: + +```ts +// "this" is the current construct +const stack = Stack.of(this); + +stack.account; // Returns the AWS::AccountId for this stack (or the literal value if known) +stack.region; // Returns the AWS::Region for this stack (or the literal value if known) +stack.partition; // Returns the AWS::Partition for this stack (or the literal value if known) +``` + +[cfn-pseudo-params]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html + +### Resource Options + +CloudFormation resources can also specify [resource +attributes][cfn-resource-attributes]. The `CfnResource` class allows +accessing those through the `cfnOptions` property: + +```ts +const rawBucket = new s3.CfnBucket(this, 'Bucket', { /* ... */ }); +// -or- +const rawBucketAlt = myBucket.node.defaultChild as s3.CfnBucket; + +// then +rawBucket.cfnOptions.condition = new CfnCondition(this, 'EnableBucket', { /* ... */ }); +rawBucket.cfnOptions.metadata = { + metadataKey: 'MetadataValue', +}; +``` + +Resource dependencies (the `DependsOn` attribute) is modified using the +`cfnResource.addDependency` method: + +```ts +const resourceA = new CfnResource(this, 'ResourceA', resourceProps); +const resourceB = new CfnResource(this, 'ResourceB', resourceProps); + +resourceB.addDependency(resourceA); +``` + +[cfn-resource-attributes]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-product-attribute-reference.html + +#### CreationPolicy + +Some resources support a [CreationPolicy][creation-policy] to be specified as a CfnOption. + +The creation policy is invoked only when AWS CloudFormation creates the associated resource. Currently, the only AWS CloudFormation resources that support creation policies are `CfnAutoScalingGroup`, `CfnInstance`, `CfnWaitCondition` and `CfnFleet`. + +The `CfnFleet` resource from the `aws-appstream` module supports specifying `startFleet` as +a property of the creationPolicy on the resource options. Setting it to true will make AWS CloudFormation wait until the fleet is started before continuing with the creation of +resources that depend on the fleet resource. + +```ts +const fleet = new CfnFleet(stack, 'Fleet', { + instanceType: 'stream.standard.small', + name: 'Fleet', + computeCapacity: { + desiredInstances: 1, + }, + imageName: 'AppStream-AmazonLinux2-09-21-2022', +}); +fleet.cfnOptions.creationPolicy = { + startFleet: true, +}; +``` + +The properties passed to the level 2 constructs `AutoScalingGroup` and `Instance` from the +`aws-ec2` module abstract what is passed into the `CfnOption` properties `resourceSignal` and +`autoScalingCreationPolicy`, but when using level 1 constructs you can specify these yourself. + +The CfnWaitCondition resource from the `aws-cloudformation` module suppports the `resourceSignal`. +The format of the timeout is `PT#H#M#S`. In the example below AWS Cloudformation will wait for +3 success signals to occur within 15 minutes before the status of the resource will be set to +`CREATE_COMPLETE`. + +```ts +resource.cfnOptions.resourceSignal = { + count: 3, + timeout: 'PR15M', +} +``` + +[creation-policy]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-creationpolicy.html + +### Intrinsic Functions and Condition Expressions + +CloudFormation supports [intrinsic functions][cfn-intrinsics]. These functions +can be accessed from the `Fn` class, which provides type-safe methods for each +intrinsic function as well as condition expressions: + +```ts +declare const myObjectOrArray: any; +declare const myArray: any; + +// To use Fn::Base64 +Fn.base64('SGVsbG8gQ0RLIQo='); + +// To compose condition expressions: +const environmentParameter = new CfnParameter(this, 'Environment'); +Fn.conditionAnd( + // The "Environment" CloudFormation template parameter evaluates to "Production" + Fn.conditionEquals('Production', environmentParameter), + // The AWS::Region pseudo-parameter value is NOT equal to "us-east-1" + Fn.conditionNot(Fn.conditionEquals('us-east-1', Aws.REGION)), +); + +// To use Fn::ToJsonString +Fn.toJsonString(myObjectOrArray); + +// To use Fn::Length +Fn.len(Fn.split(',', myArray)); +``` + +When working with deploy-time values (those for which `Token.isUnresolved` +returns `true`), idiomatic conditionals from the programming language cannot be +used (the value will not be known until deployment time). When conditional logic +needs to be expressed with un-resolved values, it is necessary to use +CloudFormation conditions by means of the `CfnCondition` class: + +```ts +const environmentParameter = new CfnParameter(this, 'Environment'); +const isProd = new CfnCondition(this, 'IsProduction', { + expression: Fn.conditionEquals('Production', environmentParameter), +}); + +// Configuration value that is a different string based on IsProduction +const stage = Fn.conditionIf(isProd.logicalId, 'Beta', 'Prod').toString(); + +// Make Bucket creation condition to IsProduction by accessing +// and overriding the CloudFormation resource +const bucket = new s3.Bucket(this, 'Bucket'); +const cfnBucket = myBucket.node.defaultChild as s3.CfnBucket; +cfnBucket.cfnOptions.condition = isProd; +``` + +[cfn-intrinsics]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html + +### Mappings + +CloudFormation [mappings][cfn-mappings] are created and queried using the +`CfnMappings` class: + +```ts +const regionTable = new CfnMapping(this, 'RegionTable', { + mapping: { + 'us-east-1': { + regionName: 'US East (N. Virginia)', + // ... + }, + 'us-east-2': { + regionName: 'US East (Ohio)', + // ... + }, + // ... + } +}); + +regionTable.findInMap(Aws.REGION, 'regionName') +``` + +This will yield the following template: + +```yaml +Mappings: + RegionTable: + us-east-1: + regionName: US East (N. Virginia) + us-east-2: + regionName: US East (Ohio) +``` + +Mappings can also be synthesized "lazily"; lazy mappings will only render a "Mappings" +section in the synthesized CloudFormation template if some `findInMap` call is unable to +immediately return a concrete value due to one or both of the keys being unresolved tokens +(some value only available at deploy-time). + +For example, the following code will not produce anything in the "Mappings" section. The +call to `findInMap` will be able to resolve the value during synthesis and simply return +`'US East (Ohio)'`. + +```ts +const regionTable = new CfnMapping(this, 'RegionTable', { + mapping: { + 'us-east-1': { + regionName: 'US East (N. Virginia)', + }, + 'us-east-2': { + regionName: 'US East (Ohio)', + }, + }, + lazy: true, +}); + +regionTable.findInMap('us-east-2', 'regionName'); +``` + +On the other hand, the following code will produce the "Mappings" section shown above, +since the top-level key is an unresolved token. The call to `findInMap` will return a token that resolves to +`{ "Fn::FindInMap": [ "RegionTable", { "Ref": "AWS::Region" }, "regionName" ] }`. + +```ts +declare const regionTable: CfnMapping; + +regionTable.findInMap(Aws.REGION, 'regionName'); +``` + +[cfn-mappings]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html + +### Dynamic References + +CloudFormation supports [dynamically resolving][cfn-dynamic-references] values +for SSM parameters (including secure strings) and Secrets Manager. Encoding such +references is done using the `CfnDynamicReference` class: + +```ts +new CfnDynamicReference( + CfnDynamicReferenceService.SECRETS_MANAGER, + 'secret-id:secret-string:json-key:version-stage:version-id', +); +``` + +[cfn-dynamic-references]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html + +### Template Options & Transform + +CloudFormation templates support a number of options, including which Macros or +[Transforms][cfn-transform] to use when deploying the stack. Those can be +configured using the `stack.templateOptions` property: + +```ts +const stack = new Stack(app, 'StackName'); + +stack.templateOptions.description = 'This will appear in the AWS console'; +stack.templateOptions.transforms = ['AWS::Serverless-2016-10-31']; +stack.templateOptions.metadata = { + metadataKey: 'MetadataValue', +}; +``` + +[cfn-transform]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html + +### Emitting Raw Resources + +The `CfnResource` class allows emitting arbitrary entries in the +[Resources][cfn-resources] section of the CloudFormation template. + +```ts +new CfnResource(this, 'ResourceId', { + type: 'AWS::S3::Bucket', + properties: { + BucketName: 'bucket-name' + }, +}); +``` + +As for any other resource, the logical ID in the CloudFormation template will be +generated by the AWS CDK, but the type and properties will be copied verbatim in +the synthesized template. + +[cfn-resources]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html + +### Including raw CloudFormation template fragments + +When migrating a CloudFormation stack to the AWS CDK, it can be useful to +include fragments of an existing template verbatim in the synthesized template. +This can be achieved using the `CfnInclude` class. + +```ts +new CfnInclude(this, 'ID', { + template: { + Resources: { + Bucket: { + Type: 'AWS::S3::Bucket', + Properties: { + BucketName: 'my-shiny-bucket' + } + } + } + }, +}); +``` + +### Termination Protection + +You can prevent a stack from being accidentally deleted by enabling termination +protection on the stack. If a user attempts to delete a stack with termination +protection enabled, the deletion fails and the stack--including its status--remains +unchanged. Enabling or disabling termination protection on a stack sets it for any +nested stacks belonging to that stack as well. You can enable termination protection +on a stack by setting the `terminationProtection` prop to `true`. + +```ts +const stack = new Stack(app, 'StackName', { + terminationProtection: true, +}); +``` + +By default, termination protection is disabled. + +### Description + +You can add a description of the stack in the same way as `StackProps`. + +```ts +const stack = new Stack(app, 'StackName', { + description: 'This is a description.', +}); +``` + +### CfnJson + +`CfnJson` allows you to postpone the resolution of a JSON blob from +deployment-time. This is useful in cases where the CloudFormation JSON template +cannot express a certain value. + +A common example is to use `CfnJson` in order to render a JSON map which needs +to use intrinsic functions in keys. Since JSON map keys must be strings, it is +impossible to use intrinsics in keys and `CfnJson` can help. + +The following example defines an IAM role which can only be assumed by +principals that are tagged with a specific tag. + +```ts +const tagParam = new CfnParameter(this, 'TagName'); + +const stringEquals = new CfnJson(this, 'ConditionJson', { + value: { + [`aws:PrincipalTag/${tagParam.valueAsString}`]: true, + }, +}); + +const principal = new iam.AccountRootPrincipal().withConditions({ + StringEquals: stringEquals, +}); + +new iam.Role(this, 'MyRole', { assumedBy: principal }); +``` + +**Explanation**: since in this example we pass the tag name through a parameter, it +can only be resolved during deployment. The resolved value can be represented in +the template through a `{ "Ref": "TagName" }`. However, since we want to use +this value inside a [`aws:PrincipalTag/TAG-NAME`](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltag) +IAM operator, we need it in the *key* of a `StringEquals` condition. JSON keys +*must be* strings, so to circumvent this limitation, we use `CfnJson` +to "delay" the rendition of this template section to deploy-time. This means +that the value of `StringEquals` in the template will be `{ "Fn::GetAtt": [ "ConditionJson", "Value" ] }`, and will only "expand" to the operator we synthesized during deployment. + +### Stack Resource Limit + +When deploying to AWS CloudFormation, it needs to keep in check the amount of resources being added inside a Stack. Currently it's possible to check the limits in the [AWS CloudFormation quotas](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html) page. + +It's possible to synthesize the project with more Resources than the allowed (or even reduce the number of Resources). + +Set the context key `@aws-cdk/core:stackResourceLimit` with the proper value, being 0 for disable the limit of resources. + +## App Context + +[Context values](https://docs.aws.amazon.com/cdk/v2/guide/context.html) are key-value pairs that can be associated with an app, stack, or construct. +One common use case for context is to use it for enabling/disabling [feature flags](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html). There are several places +where context can be specified. They are listed below in the order they are evaluated (items at the +top take precedence over those below). + +- The `node.setContext()` method +- The `postCliContext` prop when you create an `App` +- The CLI via the `--context` CLI argument +- The `cdk.json` file via the `context` key: +- The `cdk.context.json` file: +- The `~/.cdk.json` file via the `context` key: +- The `context` prop when you create an `App` + +### Examples of setting context + +```ts +new App({ + context: { + '@aws-cdk/core:newStyleStackSynthesis': true, + }, +}); +``` + +```ts +const app = new App(); +app.node.setContext('@aws-cdk/core:newStyleStackSynthesis', true); +``` + +```ts +new App({ + postCliContext: { + '@aws-cdk/core:newStyleStackSynthesis': true, + }, +}); +``` + +```console +cdk synth --context @aws-cdk/core:newStyleStackSynthesis=true +``` + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/core:newStyleStackSynthesis": true + } +} +``` + +_cdk.context.json_ + +```json +{ + "@aws-cdk/core:newStyleStackSynthesis": true +} +``` + +_~/.cdk.json_ + +```json +{ + "context": { + "@aws-cdk/core:newStyleStackSynthesis": true + } +} +``` + +## IAM Permissions Boundary + +It is possible to apply an [IAM permissions boundary](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) +to all roles within a specific construct scope. The most common use case would +be to apply a permissions boundary at the `Stage` level. + +```ts +declare const app: App; + +const prodStage = new Stage(app, 'ProdStage', { + permissionsBoundary: PermissionsBoundary.fromName('cdk-${Qualifier}-PermissionsBoundary'), +}); +``` + +Any IAM Roles or Users created within this Stage will have the default +permissions boundary attached. + +For more details see the [Permissions Boundary](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam-readme.html#permissions-boundaries) section in the IAM guide. + +## Policy Validation + +If you or your organization use (or would like to use) any policy validation tool, such as +[CloudFormation +Guard](https://docs.aws.amazon.com/cfn-guard/latest/ug/what-is-guard.html) or +[OPA](https://www.openpolicyagent.org/), to define constraints on your +CloudFormation template, you can incorporate them into the CDK application. +By using the appropriate plugin, you can make the CDK application check the +generated CloudFormation templates against your policies immediately after +synthesis. If there are any violations, the synthesis will fail and a report +will be printed to the console or to a file (see below). + +> **Note** +> This feature is considered experimental, and both the plugin API and the +> format of the validation report are subject to change in the future. + +### For application developers + +To use one or more validation plugins in your application, use the +`policyValidationBeta1` property of `Stage`: + +```ts +// globally for the entire app (an app is a stage) +const app = new App({ + policyValidationBeta1: [ + // These hypothetical classes implement IValidationPlugin: + new ThirdPartyPluginX(), + new ThirdPartyPluginY(), + ], +}); + +// only apply to a particular stage +const prodStage = new Stage(app, 'ProdStage', { + policyValidationBeta1: [...], +}); +``` + +Immediately after synthesis, all plugins registered this way will be invoked to +validate all the templates generated in the scope you defined. In particular, if +you register the templates in the `App` object, all templates will be subject to +validation. + +> **Warning** +> Other than modifying the cloud assembly, plugins can do anything that your CDK +> application can. They can read data from the filesystem, access the network +> etc. It's your responsibility as the consumer of a plugin to verify that it is +> secure to use. + +By default, the report will be printed in a human readable format. If you want a +report in JSON format, enable it using the `@aws-cdk/core:validationReportJson` +context passing it directly to the application: + +```ts +const app = new App({ + context: { '@aws-cdk/core:validationReportJson': true }, +}); +``` + +Alternatively, you can set this context key-value pair using the `cdk.json` or +`cdk.context.json` files in your project directory (see +[Runtime context](https://docs.aws.amazon.com/cdk/v2/guide/context.html)). + +If you choose the JSON format, the CDK will print the policy validation report +to a file called `policy-validation-report.json` in the cloud assembly +directory. For the default, human-readable format, the report will be printed to +the standard output. + +### For plugin authors + +The communication protocol between the CDK core module and your policy tool is +defined by the `IValidationPluginBeta1` interface. To create a new plugin you must +write a class that implements this interface. There are two things you need to +implement: the plugin name (by overriding the `name` property), and the +`validate()` method. + +The framework will call `validate()`, passing an `IValidationContextBeta1` object. +The location of the templates to be validated is given by `templatePaths`. The +plugin should return an instance of `ValidationPluginReportBeta1`. This object +represents the report that the user wil receive at the end of the synthesis. + +```ts +validate(context: ValidationContextBeta1): ValidationReportBeta1 { + // First read the templates using context.templatePaths... + + // ...then perform the validation, and then compose and return the report. + // Using hard-coded values here for better clarity: + return { + success: false, + violations: [{ + ruleName: 'CKV_AWS_117', + recommendation: 'Ensure that AWS Lambda function is configured inside a VPC', + fix: 'https://docs.bridgecrew.io/docs/ensure-that-aws-lambda-function-is-configured-inside-a-vpc-1', + violatingResources: [{ + resourceName: 'MyFunction3BAA72D1', + templatePath: '/home/johndoe/myapp/cdk.out/MyService.template.json', + locations: 'Properties/VpcConfig', + }], + }], + }; +} +``` + +Note that plugins are not allowed to modify anything in the cloud assembly. Any +attempt to do so will result in synthesis failure. + +If your plugin depends on an external tool, keep in mind that some developers may +not have that tool installed in their workstations yet. To minimize friction, we +highly recommend that you provide some installation script along with your +plugin package, to automate the whole process. Better yet, run that script as +part of the installation of your package. With `npm`, for example, you can run +add it to the `postinstall` +[script](https://docs.npmjs.com/cli/v9/using-npm/scripts) in the `package.json` +file. + + diff --git a/packages/@aws-cdk/core/adr/cross-region-stack-references.md b/packages/aws-cdk-lib/core/adr/cross-region-stack-references.md similarity index 100% rename from packages/@aws-cdk/core/adr/cross-region-stack-references.md rename to packages/aws-cdk-lib/core/adr/cross-region-stack-references.md diff --git a/packages/aws-cdk-lib/core/index.ts b/packages/aws-cdk-lib/core/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/core/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/core/lib/annotations.ts b/packages/aws-cdk-lib/core/lib/annotations.ts new file mode 100644 index 0000000000000..6192a71e39d1e --- /dev/null +++ b/packages/aws-cdk-lib/core/lib/annotations.ts @@ -0,0 +1,97 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; +import { IConstruct } from 'constructs'; + +/** + * Includes API for attaching annotations such as warning messages to constructs. + */ +export class Annotations { + /** + * Returns the annotations API for a construct scope. + * @param scope The scope + */ + public static of(scope: IConstruct) { + return new Annotations(scope); + } + + private readonly stackTraces: boolean; + + private constructor(private readonly scope: IConstruct) { + const disableTrace = + scope.node.tryGetContext(cxapi.DISABLE_METADATA_STACK_TRACE) || + process.env.CDK_DISABLE_STACK_TRACE; + + this.stackTraces = !disableTrace; + } + + /** + * Adds a warning metadata entry to this construct. + * + * The CLI will display the warning when an app is synthesized, or fail if run + * in --strict mode. + * + * @param message The warning message. + */ + public addWarning(message: string) { + this.addMessage(cxschema.ArtifactMetadataEntryType.WARN, message); + } + + /** + * Adds an info metadata entry to this construct. + * + * The CLI will display the info message when apps are synthesized. + * + * @param message The info message. + */ + public addInfo(message: string): void { + this.addMessage(cxschema.ArtifactMetadataEntryType.INFO, message); + } + + /** + * Adds an { "error": } metadata entry to this construct. + * The toolkit will fail deployment of any stack that has errors reported against it. + * @param message The error message. + */ + public addError(message: string) { + this.addMessage(cxschema.ArtifactMetadataEntryType.ERROR, message); + } + + /** + * Adds a deprecation warning for a specific API. + * + * Deprecations will be added only once per construct as a warning and will be + * deduplicated based on the `api`. + * + * If the environment variable `CDK_BLOCK_DEPRECATIONS` is set, this method + * will throw an error instead with the deprecation message. + * + * @param api The API being deprecated in the format `module.Class.property` + * (e.g. `@aws-cdk/core.Construct.node`). + * @param message The deprecation message to display, with information about + * alternatives. + */ + public addDeprecation(api: string, message: string) { + const text = `The API ${api} is deprecated: ${message}. This API will be removed in the next major release`; + + // throw if CDK_BLOCK_DEPRECATIONS is set + if (process.env.CDK_BLOCK_DEPRECATIONS) { + throw new Error(`${this.scope.node.path}: ${text}`); + } + + this.addWarning(text); + } + + /** + * Adds a message metadata entry to the construct node, to be displayed by the CDK CLI. + * + * Records the message once per construct. + * @param level The message level + * @param message The message itself + */ + private addMessage(level: string, message: string) { + const isNew = !this.scope.node.metadata.find((x) => x.data === message); + if (isNew) { + this.scope.node.addMetadata(level, message, { stackTrace: this.stackTraces }); + } + } +} diff --git a/packages/aws-cdk-lib/core/lib/app.ts b/packages/aws-cdk-lib/core/lib/app.ts new file mode 100644 index 0000000000000..ae41727bf7d24 --- /dev/null +++ b/packages/aws-cdk-lib/core/lib/app.ts @@ -0,0 +1,248 @@ +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import * as fs from 'fs-extra'; +import { PRIVATE_CONTEXT_DEFAULT_STACK_SYNTHESIZER } from './private/private-context'; +import { addCustomSynthesis, ICustomSynthesis } from './private/synthesis'; +import { IReusableStackSynthesizer } from './stack-synthesizers'; +import { Stage } from './stage'; +import { IPolicyValidationPluginBeta1 } from './validation/validation'; + +const APP_SYMBOL = Symbol.for('@aws-cdk/core.App'); + +/** + * Initialization props for apps. + */ +export interface AppProps { + /** + * Automatically call `synth()` before the program exits. + * + * If you set this, you don't have to call `synth()` explicitly. Note that + * this feature is only available for certain programming languages, and + * calling `synth()` is still recommended. + * + * @default true if running via CDK CLI (`CDK_OUTDIR` is set), `false` + * otherwise + */ + readonly autoSynth?: boolean; + + /** + * The output directory into which to emit synthesized artifacts. + * + * You should never need to set this value. By default, the value you pass to + * the CLI's `--output` flag will be used, and if you change it to a different + * directory the CLI will fail to pick up the generated Cloud Assembly. + * + * This property is intended for internal and testing use. + * + * @default - If this value is _not_ set, considers the environment variable `CDK_OUTDIR`. + * If `CDK_OUTDIR` is not defined, uses a temp directory. + */ + readonly outdir?: string; + + /** + * Include construct creation stack trace in the `aws:cdk:trace` metadata key of all constructs. + * @default true stack traces are included unless `aws:cdk:disable-stack-trace` is set in the context. + */ + readonly stackTraces?: boolean; + + /** + * Include runtime versioning information in the Stacks of this app + * + * @deprecated use `versionReporting` instead + * @default Value of 'aws:cdk:version-reporting' context key + */ + readonly runtimeInfo?: boolean; + + /** + * Include runtime versioning information in the Stacks of this app + * + * @default Value of 'aws:cdk:version-reporting' context key + */ + readonly analyticsReporting?: boolean; + + /** + * Additional context values for the application. + * + * Context set by the CLI or the `context` key in `cdk.json` has precedence. + * + * Context can be read from any construct using `node.getContext(key)`. + * + * @default - no additional context + */ + readonly context?: { [key: string]: any }; + + /** + * Additional context values for the application. + * + * Context provided here has precedence over context set by: + * + * - The CLI via --context + * - The `context` key in `cdk.json` + * - The `AppProps.context` property + * + * This property is recommended over the `AppProps.context` property since you + * can make final decision over which context value to take in your app. + * + * Context can be read from any construct using `node.getContext(key)`. + * + * @example + * // context from the CLI and from `cdk.json` are stored in the + * // CDK_CONTEXT env variable + * const cliContext = JSON.parse(process.env.CDK_CONTEXT!); + * + * // determine whether to take the context passed in the CLI or not + * const determineValue = process.env.PROD ? cliContext.SOMEKEY : 'my-prod-value'; + * new App({ + * postCliContext: { + * SOMEKEY: determineValue, + * }, + * }); + * + * @default - no additional context + */ + readonly postCliContext?: { [key: string]: any }; + + /** + * Include construct tree metadata as part of the Cloud Assembly. + * + * @default true + */ + readonly treeMetadata?: boolean; + + /** + * The stack synthesizer to use by default for all Stacks in the App + * + * The Stack Synthesizer controls aspects of synthesis and deployment, + * like how assets are referenced and what IAM roles to use. For more + * information, see the README of the main CDK package. + * + * @default - A `DefaultStackSynthesizer` with default settings + */ + readonly defaultStackSynthesizer?: IReusableStackSynthesizer; + + /** + * Validation plugins to run after synthesis + * + * @default - no validation plugins + */ + readonly policyValidationBeta1?: IPolicyValidationPluginBeta1[]; +} + +/** + * A construct which represents an entire CDK app. This construct is normally + * the root of the construct tree. + * + * You would normally define an `App` instance in your program's entrypoint, + * then define constructs where the app is used as the parent scope. + * + * After all the child constructs are defined within the app, you should call + * `app.synth()` which will emit a "cloud assembly" from this app into the + * directory specified by `outdir`. Cloud assemblies includes artifacts such as + * CloudFormation templates and assets that are needed to deploy this app into + * the AWS cloud. + * + * @see https://docs.aws.amazon.com/cdk/latest/guide/apps.html + */ +export class App extends Stage { + /** + * Checks if an object is an instance of the `App` class. + * @returns `true` if `obj` is an `App`. + * @param obj The object to evaluate + */ + public static isApp(obj: any): obj is App { + return APP_SYMBOL in obj; + } + + /** + * Include construct tree metadata as part of the Cloud Assembly. + * + * @internal + */ + public readonly _treeMetadata: boolean; + + /** + * Initializes a CDK application. + * @param props initialization properties + */ + constructor(props: AppProps = {}) { + super(undefined as any, '', { + outdir: props.outdir ?? process.env[cxapi.OUTDIR_ENV], + policyValidationBeta1: props.policyValidationBeta1, + }); + + Object.defineProperty(this, APP_SYMBOL, { value: true }); + + this.loadContext(props.context, props.postCliContext); + + if (props.stackTraces === false) { + this.node.setContext(cxapi.DISABLE_METADATA_STACK_TRACE, true); + } + + if (props.defaultStackSynthesizer) { + this.node.setContext(PRIVATE_CONTEXT_DEFAULT_STACK_SYNTHESIZER, props.defaultStackSynthesizer); + } + + const analyticsReporting = props.analyticsReporting ?? props.runtimeInfo; + + if (analyticsReporting !== undefined) { + this.node.setContext(cxapi.ANALYTICS_REPORTING_ENABLED_CONTEXT, analyticsReporting); + } + + const autoSynth = props.autoSynth ?? cxapi.OUTDIR_ENV in process.env; + if (autoSynth) { + // synth() guarantees it will only execute once, so a default of 'true' + // doesn't bite manual calling of the function. + process.once('beforeExit', () => this.synth()); + } + + this._treeMetadata = props.treeMetadata ?? true; + } + + private loadContext(defaults: { [key: string]: string } = { }, final: { [key: string]: string } = {}) { + // prime with defaults passed through constructor + for (const [k, v] of Object.entries(defaults)) { + this.node.setContext(k, v); + } + + // reconstructing the context from the two possible sources: + const context = { + ...this.readContextFromEnvironment(), + ...this.readContextFromTempFile(), + }; + + for (const [k, v] of Object.entries(context)) { + this.node.setContext(k, v); + } + + // finalContext passed through constructor overwrites + for (const [k, v] of Object.entries(final)) { + this.node.setContext(k, v); + } + } + + private readContextFromTempFile() { + const location = process.env[cxapi.CONTEXT_OVERFLOW_LOCATION_ENV]; + return location ? fs.readJSONSync(location) : {}; + } + + private readContextFromEnvironment() { + const contextJson = process.env[cxapi.CONTEXT_ENV]; + return contextJson ? JSON.parse(contextJson) : {}; + } +} + +/** + * Add a custom synthesis for the given construct + * + * When the construct is being synthesized, this allows it to add additional items + * into the Cloud Assembly output. + * + * This feature is intended for use by official AWS CDK libraries only; 3rd party + * library authors and CDK users should not use this function. That's why it's not + * exposed via jsii. + */ +export function attachCustomSynthesis(construct: Construct, synthesis: ICustomSynthesis): void { + // synthesis.ts where the implementation lives is not exported. So + // this function is just a re-export of that function. + addCustomSynthesis(construct, synthesis); +} diff --git a/packages/@aws-cdk/core/lib/arn.ts b/packages/aws-cdk-lib/core/lib/arn.ts similarity index 100% rename from packages/@aws-cdk/core/lib/arn.ts rename to packages/aws-cdk-lib/core/lib/arn.ts diff --git a/packages/@aws-cdk/core/lib/aspect.ts b/packages/aws-cdk-lib/core/lib/aspect.ts similarity index 100% rename from packages/@aws-cdk/core/lib/aspect.ts rename to packages/aws-cdk-lib/core/lib/aspect.ts diff --git a/packages/@aws-cdk/core/lib/asset-staging.ts b/packages/aws-cdk-lib/core/lib/asset-staging.ts similarity index 99% rename from packages/@aws-cdk/core/lib/asset-staging.ts rename to packages/aws-cdk-lib/core/lib/asset-staging.ts index aae0b1641f077..a018f371e54a3 100644 --- a/packages/@aws-cdk/core/lib/asset-staging.ts +++ b/packages/aws-cdk-lib/core/lib/asset-staging.ts @@ -1,6 +1,6 @@ import * as crypto from 'crypto'; import * as path from 'path'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import * as fs from 'fs-extra'; import { AssetHashType, AssetOptions, FileAssetPackaging } from './assets'; diff --git a/packages/@aws-cdk/core/lib/assets.ts b/packages/aws-cdk-lib/core/lib/assets.ts similarity index 100% rename from packages/@aws-cdk/core/lib/assets.ts rename to packages/aws-cdk-lib/core/lib/assets.ts diff --git a/packages/@aws-cdk/core/lib/bundling.ts b/packages/aws-cdk-lib/core/lib/bundling.ts similarity index 100% rename from packages/@aws-cdk/core/lib/bundling.ts rename to packages/aws-cdk-lib/core/lib/bundling.ts diff --git a/packages/@aws-cdk/core/lib/cfn-capabilities.ts b/packages/aws-cdk-lib/core/lib/cfn-capabilities.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-capabilities.ts rename to packages/aws-cdk-lib/core/lib/cfn-capabilities.ts diff --git a/packages/@aws-cdk/core/lib/cfn-codedeploy-blue-green-hook.ts b/packages/aws-cdk-lib/core/lib/cfn-codedeploy-blue-green-hook.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-codedeploy-blue-green-hook.ts rename to packages/aws-cdk-lib/core/lib/cfn-codedeploy-blue-green-hook.ts diff --git a/packages/@aws-cdk/core/lib/cfn-condition.ts b/packages/aws-cdk-lib/core/lib/cfn-condition.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-condition.ts rename to packages/aws-cdk-lib/core/lib/cfn-condition.ts diff --git a/packages/@aws-cdk/core/lib/cfn-dynamic-reference.ts b/packages/aws-cdk-lib/core/lib/cfn-dynamic-reference.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-dynamic-reference.ts rename to packages/aws-cdk-lib/core/lib/cfn-dynamic-reference.ts diff --git a/packages/@aws-cdk/core/lib/cfn-element.ts b/packages/aws-cdk-lib/core/lib/cfn-element.ts similarity index 98% rename from packages/@aws-cdk/core/lib/cfn-element.ts rename to packages/aws-cdk-lib/core/lib/cfn-element.ts index 790fcc458e779..4780ec17dd9a2 100644 --- a/packages/@aws-cdk/core/lib/cfn-element.ts +++ b/packages/aws-cdk-lib/core/lib/cfn-element.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; import { Construct, Node } from 'constructs'; import { debugModeEnabled } from './debug'; import { Lazy } from './lazy'; diff --git a/packages/@aws-cdk/core/lib/cfn-fn.ts b/packages/aws-cdk-lib/core/lib/cfn-fn.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-fn.ts rename to packages/aws-cdk-lib/core/lib/cfn-fn.ts diff --git a/packages/@aws-cdk/core/lib/cfn-hook.ts b/packages/aws-cdk-lib/core/lib/cfn-hook.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-hook.ts rename to packages/aws-cdk-lib/core/lib/cfn-hook.ts diff --git a/packages/@aws-cdk/core/lib/cfn-include.ts b/packages/aws-cdk-lib/core/lib/cfn-include.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-include.ts rename to packages/aws-cdk-lib/core/lib/cfn-include.ts diff --git a/packages/@aws-cdk/core/lib/cfn-json.ts b/packages/aws-cdk-lib/core/lib/cfn-json.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-json.ts rename to packages/aws-cdk-lib/core/lib/cfn-json.ts diff --git a/packages/@aws-cdk/core/lib/cfn-mapping.ts b/packages/aws-cdk-lib/core/lib/cfn-mapping.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-mapping.ts rename to packages/aws-cdk-lib/core/lib/cfn-mapping.ts diff --git a/packages/@aws-cdk/core/lib/cfn-output.ts b/packages/aws-cdk-lib/core/lib/cfn-output.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-output.ts rename to packages/aws-cdk-lib/core/lib/cfn-output.ts diff --git a/packages/@aws-cdk/core/lib/cfn-parameter.ts b/packages/aws-cdk-lib/core/lib/cfn-parameter.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-parameter.ts rename to packages/aws-cdk-lib/core/lib/cfn-parameter.ts diff --git a/packages/@aws-cdk/core/lib/cfn-parse.ts b/packages/aws-cdk-lib/core/lib/cfn-parse.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-parse.ts rename to packages/aws-cdk-lib/core/lib/cfn-parse.ts diff --git a/packages/@aws-cdk/core/lib/cfn-pseudo.ts b/packages/aws-cdk-lib/core/lib/cfn-pseudo.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-pseudo.ts rename to packages/aws-cdk-lib/core/lib/cfn-pseudo.ts diff --git a/packages/@aws-cdk/core/lib/cfn-resource-policy.ts b/packages/aws-cdk-lib/core/lib/cfn-resource-policy.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-resource-policy.ts rename to packages/aws-cdk-lib/core/lib/cfn-resource-policy.ts diff --git a/packages/@aws-cdk/core/lib/cfn-resource.ts b/packages/aws-cdk-lib/core/lib/cfn-resource.ts similarity index 99% rename from packages/@aws-cdk/core/lib/cfn-resource.ts rename to packages/aws-cdk-lib/core/lib/cfn-resource.ts index 115d6e8075217..3740752c2b5d9 100644 --- a/packages/@aws-cdk/core/lib/cfn-resource.ts +++ b/packages/aws-cdk-lib/core/lib/cfn-resource.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../cx-api'; import { Annotations } from './annotations'; import { CfnCondition } from './cfn-condition'; // import required to be here, otherwise causes a cycle when running the generated JavaScript diff --git a/packages/@aws-cdk/core/lib/cfn-rule.ts b/packages/aws-cdk-lib/core/lib/cfn-rule.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-rule.ts rename to packages/aws-cdk-lib/core/lib/cfn-rule.ts diff --git a/packages/@aws-cdk/core/lib/cfn-tag.ts b/packages/aws-cdk-lib/core/lib/cfn-tag.ts similarity index 100% rename from packages/@aws-cdk/core/lib/cfn-tag.ts rename to packages/aws-cdk-lib/core/lib/cfn-tag.ts diff --git a/packages/@aws-cdk/core/lib/context-provider.ts b/packages/aws-cdk-lib/core/lib/context-provider.ts similarity index 97% rename from packages/@aws-cdk/core/lib/context-provider.ts rename to packages/aws-cdk-lib/core/lib/context-provider.ts index a74623f087802..75715f4a52146 100644 --- a/packages/@aws-cdk/core/lib/context-provider.ts +++ b/packages/aws-cdk-lib/core/lib/context-provider.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; import { Construct, Node } from 'constructs'; import { Annotations } from './annotations'; import { Stack } from './stack'; diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-reader-handler/index.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-reader-handler/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-reader-handler/index.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-reader-handler/index.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-writer-handler/index.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-writer-handler/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-writer-handler/index.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/cross-region-ssm-writer-handler/index.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/export-reader-provider.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/export-reader-provider.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/export-reader-provider.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/export-reader-provider.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/export-writer-provider.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/export-writer-provider.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/export-writer-provider.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/export-writer-provider.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/types.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/types.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/cross-region-export-providers/types.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/cross-region-export-providers/types.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/custom-resource-provider.ts similarity index 99% rename from packages/@aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/custom-resource-provider.ts index 0eadacf4ebbb2..f22de7bc3693d 100644 --- a/packages/@aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.ts +++ b/packages/aws-cdk-lib/core/lib/custom-resource-provider/custom-resource-provider.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import * as fse from 'fs-extra'; import { AssetStaging } from '../asset-staging'; diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/index.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/index.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/index.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.ts b/packages/aws-cdk-lib/core/lib/custom-resource-provider/nodejs-entrypoint.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource-provider/nodejs-entrypoint.ts rename to packages/aws-cdk-lib/core/lib/custom-resource-provider/nodejs-entrypoint.ts diff --git a/packages/@aws-cdk/core/lib/custom-resource.ts b/packages/aws-cdk-lib/core/lib/custom-resource.ts similarity index 100% rename from packages/@aws-cdk/core/lib/custom-resource.ts rename to packages/aws-cdk-lib/core/lib/custom-resource.ts diff --git a/packages/@aws-cdk/core/lib/debug.ts b/packages/aws-cdk-lib/core/lib/debug.ts similarity index 100% rename from packages/@aws-cdk/core/lib/debug.ts rename to packages/aws-cdk-lib/core/lib/debug.ts diff --git a/packages/@aws-cdk/core/lib/deps.ts b/packages/aws-cdk-lib/core/lib/deps.ts similarity index 100% rename from packages/@aws-cdk/core/lib/deps.ts rename to packages/aws-cdk-lib/core/lib/deps.ts diff --git a/packages/@aws-cdk/core/lib/duration.ts b/packages/aws-cdk-lib/core/lib/duration.ts similarity index 100% rename from packages/@aws-cdk/core/lib/duration.ts rename to packages/aws-cdk-lib/core/lib/duration.ts diff --git a/packages/@aws-cdk/core/lib/environment.ts b/packages/aws-cdk-lib/core/lib/environment.ts similarity index 100% rename from packages/@aws-cdk/core/lib/environment.ts rename to packages/aws-cdk-lib/core/lib/environment.ts diff --git a/packages/@aws-cdk/core/lib/expiration.ts b/packages/aws-cdk-lib/core/lib/expiration.ts similarity index 100% rename from packages/@aws-cdk/core/lib/expiration.ts rename to packages/aws-cdk-lib/core/lib/expiration.ts diff --git a/packages/@aws-cdk/core/lib/feature-flags.ts b/packages/aws-cdk-lib/core/lib/feature-flags.ts similarity index 96% rename from packages/@aws-cdk/core/lib/feature-flags.ts rename to packages/aws-cdk-lib/core/lib/feature-flags.ts index 3d020323f6b9a..2f5bf933e0eb9 100644 --- a/packages/@aws-cdk/core/lib/feature-flags.ts +++ b/packages/aws-cdk-lib/core/lib/feature-flags.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../cx-api'; import { IConstruct, Node } from 'constructs'; /** diff --git a/packages/@aws-cdk/core/lib/fs/copy.ts b/packages/aws-cdk-lib/core/lib/fs/copy.ts similarity index 100% rename from packages/@aws-cdk/core/lib/fs/copy.ts rename to packages/aws-cdk-lib/core/lib/fs/copy.ts diff --git a/packages/@aws-cdk/core/lib/fs/fingerprint.ts b/packages/aws-cdk-lib/core/lib/fs/fingerprint.ts similarity index 100% rename from packages/@aws-cdk/core/lib/fs/fingerprint.ts rename to packages/aws-cdk-lib/core/lib/fs/fingerprint.ts diff --git a/packages/@aws-cdk/core/lib/fs/ignore.ts b/packages/aws-cdk-lib/core/lib/fs/ignore.ts similarity index 100% rename from packages/@aws-cdk/core/lib/fs/ignore.ts rename to packages/aws-cdk-lib/core/lib/fs/ignore.ts diff --git a/packages/@aws-cdk/core/lib/fs/index.ts b/packages/aws-cdk-lib/core/lib/fs/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/fs/index.ts rename to packages/aws-cdk-lib/core/lib/fs/index.ts diff --git a/packages/@aws-cdk/core/lib/fs/options.ts b/packages/aws-cdk-lib/core/lib/fs/options.ts similarity index 100% rename from packages/@aws-cdk/core/lib/fs/options.ts rename to packages/aws-cdk-lib/core/lib/fs/options.ts diff --git a/packages/@aws-cdk/core/lib/fs/utils.ts b/packages/aws-cdk-lib/core/lib/fs/utils.ts similarity index 100% rename from packages/@aws-cdk/core/lib/fs/utils.ts rename to packages/aws-cdk-lib/core/lib/fs/utils.ts diff --git a/packages/@aws-cdk/core/lib/helpers-internal/cfn-parse.ts b/packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts similarity index 100% rename from packages/@aws-cdk/core/lib/helpers-internal/cfn-parse.ts rename to packages/aws-cdk-lib/core/lib/helpers-internal/cfn-parse.ts diff --git a/packages/@aws-cdk/core/lib/helpers-internal/customize-roles.ts b/packages/aws-cdk-lib/core/lib/helpers-internal/customize-roles.ts similarity index 100% rename from packages/@aws-cdk/core/lib/helpers-internal/customize-roles.ts rename to packages/aws-cdk-lib/core/lib/helpers-internal/customize-roles.ts diff --git a/packages/@aws-cdk/core/lib/helpers-internal/index.ts b/packages/aws-cdk-lib/core/lib/helpers-internal/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/helpers-internal/index.ts rename to packages/aws-cdk-lib/core/lib/helpers-internal/index.ts diff --git a/packages/@aws-cdk/core/lib/index.ts b/packages/aws-cdk-lib/core/lib/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/index.ts rename to packages/aws-cdk-lib/core/lib/index.ts diff --git a/packages/@aws-cdk/core/lib/lazy.ts b/packages/aws-cdk-lib/core/lib/lazy.ts similarity index 100% rename from packages/@aws-cdk/core/lib/lazy.ts rename to packages/aws-cdk-lib/core/lib/lazy.ts diff --git a/packages/@aws-cdk/core/lib/names.ts b/packages/aws-cdk-lib/core/lib/names.ts similarity index 100% rename from packages/@aws-cdk/core/lib/names.ts rename to packages/aws-cdk-lib/core/lib/names.ts diff --git a/packages/aws-cdk-lib/core/lib/nested-stack.ts b/packages/aws-cdk-lib/core/lib/nested-stack.ts new file mode 100644 index 0000000000000..0f1f8a4f0d3dc --- /dev/null +++ b/packages/aws-cdk-lib/core/lib/nested-stack.ts @@ -0,0 +1,279 @@ +import * as crypto from 'crypto'; +import * as cxapi from '../../cx-api'; +import { Construct, Node } from 'constructs'; +import { FileAssetPackaging } from './assets'; +import { Fn } from './cfn-fn'; +import { Aws } from './cfn-pseudo'; +import { CfnResource } from './cfn-resource'; +import { CfnStack } from './cloudformation.generated'; +import { Duration } from './duration'; +import { Lazy } from './lazy'; +import { Names } from './names'; +import { RemovalPolicy } from './removal-policy'; +import { IResolveContext } from './resolvable'; +import { Stack } from './stack'; +import { NestedStackSynthesizer } from './stack-synthesizers'; +import { Token } from './token'; + +const NESTED_STACK_SYMBOL = Symbol.for('@aws-cdk/core.NestedStack'); + +/** + * Initialization props for the `NestedStack` construct. + * + */ +export interface NestedStackProps { + /** + * The set value pairs that represent the parameters passed to CloudFormation + * when this nested stack is created. Each parameter has a name corresponding + * to a parameter defined in the embedded template and a value representing + * the value that you want to set for the parameter. + * + * The nested stack construct will automatically synthesize parameters in order + * to bind references from the parent stack(s) into the nested stack. + * + * @default - no user-defined parameters are passed to the nested stack + */ + readonly parameters?: { [key: string]: string }; + + /** + * The length of time that CloudFormation waits for the nested stack to reach + * the CREATE_COMPLETE state. + * + * When CloudFormation detects that the nested stack has reached the + * CREATE_COMPLETE state, it marks the nested stack resource as + * CREATE_COMPLETE in the parent stack and resumes creating the parent stack. + * If the timeout period expires before the nested stack reaches + * CREATE_COMPLETE, CloudFormation marks the nested stack as failed and rolls + * back both the nested stack and parent stack. + * + * @default - no timeout + */ + readonly timeout?: Duration; + + /** + * The Simple Notification Service (SNS) topics to publish stack related + * events. + * + * @default - notifications are not sent for this stack. + */ + readonly notificationArns?: string[]; + + /** + * Policy to apply when the nested stack is removed + * + * The default is `Destroy`, because all Removal Policies of resources inside the + * Nested Stack should already have been set correctly. You normally should + * not need to set this value. + * + * @default RemovalPolicy.DESTROY + */ + readonly removalPolicy?: RemovalPolicy; + + /** + * A description of the stack. + * + * @default - No description. + */ + readonly description?: string; +} + +/** + * A CloudFormation nested stack. + * + * When you apply template changes to update a top-level stack, CloudFormation + * updates the top-level stack and initiates an update to its nested stacks. + * CloudFormation updates the resources of modified nested stacks, but does not + * update the resources of unmodified nested stacks. + * + * Furthermore, this stack will not be treated as an independent deployment + * artifact (won't be listed in "cdk list" or deployable through "cdk deploy"), + * but rather only synthesized as a template and uploaded as an asset to S3. + * + * Cross references of resource attributes between the parent stack and the + * nested stack will automatically be translated to stack parameters and + * outputs. + * + */ +export class NestedStack extends Stack { + + /** + * Checks if `x` is an object of type `NestedStack`. + */ + public static isNestedStack(x: any): x is NestedStack { + return x != null && typeof(x) === 'object' && NESTED_STACK_SYMBOL in x; + } + + public readonly templateFile: string; + public readonly nestedStackResource?: CfnResource; + + private readonly parameters: { [name: string]: string }; + private readonly resource: CfnStack; + private readonly _contextualStackId: string; + private readonly _contextualStackName: string; + private _templateUrl?: string; + private _parentStack: Stack; + + constructor(scope: Construct, id: string, props: NestedStackProps = { }) { + const parentStack = findParentStack(scope); + + super(scope, id, { + env: { account: parentStack.account, region: parentStack.region }, + synthesizer: new NestedStackSynthesizer(parentStack.synthesizer), + description: props.description, + crossRegionReferences: parentStack._crossRegionReferences, + }); + + this._parentStack = parentStack; + + const parentScope = new Construct(scope, id + '.NestedStack'); + + Object.defineProperty(this, NESTED_STACK_SYMBOL, { value: true }); + + // this is the file name of the synthesized template file within the cloud assembly + this.templateFile = `${Names.uniqueId(this)}.nested.template.json`; + + this.parameters = props.parameters || {}; + + this.resource = new CfnStack(parentScope, `${id}.NestedStackResource`, { + // This value cannot be cached since it changes during the synthesis phase + templateUrl: Lazy.uncachedString({ produce: () => this._templateUrl || '' }), + parameters: Lazy.any({ produce: () => Object.keys(this.parameters).length > 0 ? this.parameters : undefined }), + notificationArns: props.notificationArns, + timeoutInMinutes: props.timeout ? props.timeout.toMinutes() : undefined, + }); + this.resource.applyRemovalPolicy(props.removalPolicy ?? RemovalPolicy.DESTROY); + + this.nestedStackResource = this.resource; + this.node.defaultChild = this.resource; + + // context-aware stack name: if resolved from within this stack, return AWS::StackName + // if resolved from the outer stack, use the { Ref } of the AWS::CloudFormation::Stack resource + // which resolves the ARN of the stack. We need to extract the stack name, which is the second + // component after splitting by "/" + this._contextualStackName = this.contextualAttribute(Aws.STACK_NAME, Fn.select(1, Fn.split('/', this.resource.ref))); + this._contextualStackId = this.contextualAttribute(Aws.STACK_ID, this.resource.ref); + } + + /** + * An attribute that represents the name of the nested stack. + * + * This is a context aware attribute: + * - If this is referenced from the parent stack, it will return a token that parses the name from the stack ID. + * - If this is referenced from the context of the nested stack, it will return `{ "Ref": "AWS::StackName" }` + * + * Example value: `mystack-mynestedstack-sggfrhxhum7w` + * @attribute + */ + public get stackName() { + return this._contextualStackName; + } + + /** + * An attribute that represents the ID of the stack. + * + * This is a context aware attribute: + * - If this is referenced from the parent stack, it will return `{ "Ref": "LogicalIdOfNestedStackResource" }`. + * - If this is referenced from the context of the nested stack, it will return `{ "Ref": "AWS::StackId" }` + * + * Example value: `arn:aws:cloudformation:us-east-2:123456789012:stack/mystack-mynestedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786` + * @attribute + */ + public get stackId() { + return this._contextualStackId; + } + + /** + * Assign a value to one of the nested stack parameters. + * @param name The parameter name (ID) + * @param value The value to assign + */ + public setParameter(name: string, value: string) { + this.parameters[name] = value; + } + + /** + * Defines an asset at the parent stack which represents the template of this + * nested stack. + * + * This private API is used by `App.prepare()` within a loop that rectifies + * references every time an asset is added. This is because (at the moment) + * assets are addressed using CloudFormation parameters. + * + * @returns `true` if a new asset was added or `false` if an asset was + * previously added. When this returns `true`, App will do another reference + * rectification cycle. + * + * @internal + */ + public _prepareTemplateAsset() { + if (this._templateUrl) { + return false; + } + + // When adding tags to nested stack, the tags need to be added to all the resources in + // nested stack, which is handled by the `tags` property, But to tag the + // tags have to be added in the parent stack CfnStack resource. The CfnStack resource created + // by this class don't share the same TagManager as that of the one exposed by the `tag` property of the + // class, all the tags need to be copied to the CfnStack resource before synthesizing the resource. + // See https://github.com/aws/aws-cdk/pull/19128 + Object.entries(this.tags.tagValues()).forEach(([key, value]) => { + this.resource.tags.setTag(key, value); + }); + + const cfn = JSON.stringify(this._toCloudFormation()); + const templateHash = crypto.createHash('sha256').update(cfn).digest('hex'); + + const templateLocation = this._parentStack.synthesizer.addFileAsset({ + packaging: FileAssetPackaging.FILE, + sourceHash: templateHash, + fileName: this.templateFile, + }); + + this.addResourceMetadata(this.resource, 'TemplateURL'); + + // if bucketName/objectKey are cfn parameters from a stack other than the parent stack, they will + // be resolved as cross-stack references like any other (see "multi" tests). + this._templateUrl = `https://s3.${this._parentStack.region}.${this._parentStack.urlSuffix}/${templateLocation.bucketName}/${templateLocation.objectKey}`; + return true; + } + + private contextualAttribute(innerValue: string, outerValue: string) { + return Token.asString({ + resolve: (context: IResolveContext) => { + if (Stack.of(context.scope) === this) { + return innerValue; + } else { + return outerValue; + } + }, + }); + } + + private addResourceMetadata(resource: CfnResource, resourceProperty: string) { + if (!this.node.tryGetContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)) { + return; // not enabled + } + + // tell tools such as SAM CLI that the "TemplateURL" property of this resource + // points to the nested stack template for local emulation + resource.cfnOptions.metadata = resource.cfnOptions.metadata || { }; + resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PATH_KEY] = this.templateFile; + resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PROPERTY_KEY] = resourceProperty; + } +} + +/** + * Validates the scope for a nested stack. Nested stacks must be defined within the scope of another `Stack`. + */ +function findParentStack(scope: Construct): Stack { + if (!scope) { + throw new Error('Nested stacks cannot be defined as a root construct'); + } + + const parentStack = Node.of(scope).scopes.reverse().find(p => Stack.isStack(p)); + if (!parentStack) { + throw new Error('Nested stacks must be defined within scope of another non-nested stack'); + } + + return parentStack as Stack; +} diff --git a/packages/@aws-cdk/core/lib/permissions-boundary.ts b/packages/aws-cdk-lib/core/lib/permissions-boundary.ts similarity index 100% rename from packages/@aws-cdk/core/lib/permissions-boundary.ts rename to packages/aws-cdk-lib/core/lib/permissions-boundary.ts diff --git a/packages/@aws-cdk/core/lib/physical-name.ts b/packages/aws-cdk-lib/core/lib/physical-name.ts similarity index 100% rename from packages/@aws-cdk/core/lib/physical-name.ts rename to packages/aws-cdk-lib/core/lib/physical-name.ts diff --git a/packages/@aws-cdk/core/lib/private/asset-parameters.ts b/packages/aws-cdk-lib/core/lib/private/asset-parameters.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/asset-parameters.ts rename to packages/aws-cdk-lib/core/lib/private/asset-parameters.ts diff --git a/packages/@aws-cdk/core/lib/private/asset-staging.ts b/packages/aws-cdk-lib/core/lib/private/asset-staging.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/asset-staging.ts rename to packages/aws-cdk-lib/core/lib/private/asset-staging.ts diff --git a/packages/@aws-cdk/core/lib/private/cache.ts b/packages/aws-cdk-lib/core/lib/private/cache.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/cache.ts rename to packages/aws-cdk-lib/core/lib/private/cache.ts diff --git a/packages/@aws-cdk/core/lib/private/cfn-reference.ts b/packages/aws-cdk-lib/core/lib/private/cfn-reference.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/cfn-reference.ts rename to packages/aws-cdk-lib/core/lib/private/cfn-reference.ts diff --git a/packages/@aws-cdk/core/lib/private/cfn-utils-provider.ts b/packages/aws-cdk-lib/core/lib/private/cfn-utils-provider.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/cfn-utils-provider.ts rename to packages/aws-cdk-lib/core/lib/private/cfn-utils-provider.ts diff --git a/packages/@aws-cdk/core/lib/private/cfn-utils-provider/consts.ts b/packages/aws-cdk-lib/core/lib/private/cfn-utils-provider/consts.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/cfn-utils-provider/consts.ts rename to packages/aws-cdk-lib/core/lib/private/cfn-utils-provider/consts.ts diff --git a/packages/@aws-cdk/core/lib/private/cfn-utils-provider/index.ts b/packages/aws-cdk-lib/core/lib/private/cfn-utils-provider/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/cfn-utils-provider/index.ts rename to packages/aws-cdk-lib/core/lib/private/cfn-utils-provider/index.ts diff --git a/packages/@aws-cdk/core/lib/private/cloudformation-lang.ts b/packages/aws-cdk-lib/core/lib/private/cloudformation-lang.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/cloudformation-lang.ts rename to packages/aws-cdk-lib/core/lib/private/cloudformation-lang.ts diff --git a/packages/@aws-cdk/core/lib/private/encoding.ts b/packages/aws-cdk-lib/core/lib/private/encoding.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/encoding.ts rename to packages/aws-cdk-lib/core/lib/private/encoding.ts diff --git a/packages/@aws-cdk/core/lib/private/intrinsic.ts b/packages/aws-cdk-lib/core/lib/private/intrinsic.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/intrinsic.ts rename to packages/aws-cdk-lib/core/lib/private/intrinsic.ts diff --git a/packages/@aws-cdk/core/lib/private/jsii-deprecated.ts b/packages/aws-cdk-lib/core/lib/private/jsii-deprecated.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/jsii-deprecated.ts rename to packages/aws-cdk-lib/core/lib/private/jsii-deprecated.ts diff --git a/packages/@aws-cdk/core/lib/private/logical-id.ts b/packages/aws-cdk-lib/core/lib/private/logical-id.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/logical-id.ts rename to packages/aws-cdk-lib/core/lib/private/logical-id.ts diff --git a/packages/@aws-cdk/core/lib/private/md5.ts b/packages/aws-cdk-lib/core/lib/private/md5.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/md5.ts rename to packages/aws-cdk-lib/core/lib/private/md5.ts diff --git a/packages/@aws-cdk/core/lib/private/metadata-resource.ts b/packages/aws-cdk-lib/core/lib/private/metadata-resource.ts similarity index 99% rename from packages/@aws-cdk/core/lib/private/metadata-resource.ts rename to packages/aws-cdk-lib/core/lib/private/metadata-resource.ts index 08f9e76e06e93..0f27a0f4e65ce 100644 --- a/packages/@aws-cdk/core/lib/private/metadata-resource.ts +++ b/packages/aws-cdk-lib/core/lib/private/metadata-resource.ts @@ -1,5 +1,5 @@ import * as zlib from 'zlib'; -import { RegionInfo } from '@aws-cdk/region-info'; +import { RegionInfo } from '../../../region-info'; import { Construct } from 'constructs'; import { ConstructInfo, constructInfoFromStack } from './runtime-info'; import { CfnCondition } from '../cfn-condition'; diff --git a/packages/@aws-cdk/core/lib/private/node-version.ts b/packages/aws-cdk-lib/core/lib/private/node-version.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/node-version.ts rename to packages/aws-cdk-lib/core/lib/private/node-version.ts diff --git a/packages/@aws-cdk/core/lib/private/physical-name-generator.ts b/packages/aws-cdk-lib/core/lib/private/physical-name-generator.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/physical-name-generator.ts rename to packages/aws-cdk-lib/core/lib/private/physical-name-generator.ts diff --git a/packages/@aws-cdk/core/lib/private/prepare-app.ts b/packages/aws-cdk-lib/core/lib/private/prepare-app.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/prepare-app.ts rename to packages/aws-cdk-lib/core/lib/private/prepare-app.ts diff --git a/packages/@aws-cdk/core/lib/private/private-context.ts b/packages/aws-cdk-lib/core/lib/private/private-context.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/private-context.ts rename to packages/aws-cdk-lib/core/lib/private/private-context.ts diff --git a/packages/@aws-cdk/core/lib/private/refs.ts b/packages/aws-cdk-lib/core/lib/private/refs.ts similarity index 99% rename from packages/@aws-cdk/core/lib/private/refs.ts rename to packages/aws-cdk-lib/core/lib/private/refs.ts index d3856366ca380..cdc62723e146a 100644 --- a/packages/@aws-cdk/core/lib/private/refs.ts +++ b/packages/aws-cdk-lib/core/lib/private/refs.ts @@ -2,7 +2,7 @@ // CROSS REFERENCES // ---------------------------------------------------- -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; import { IConstruct } from 'constructs'; import { CfnReference } from './cfn-reference'; import { Intrinsic } from './intrinsic'; diff --git a/packages/@aws-cdk/core/lib/private/region-lookup.ts b/packages/aws-cdk-lib/core/lib/private/region-lookup.ts similarity index 97% rename from packages/@aws-cdk/core/lib/private/region-lookup.ts rename to packages/aws-cdk-lib/core/lib/private/region-lookup.ts index d81facdac0d12..fb44a9a7c1a60 100644 --- a/packages/@aws-cdk/core/lib/private/region-lookup.ts +++ b/packages/aws-cdk-lib/core/lib/private/region-lookup.ts @@ -1,5 +1,5 @@ -import * as cxapi from '@aws-cdk/cx-api'; -import { RegionInfo } from '@aws-cdk/region-info'; +import * as cxapi from '../../../cx-api'; +import { RegionInfo } from '../../../region-info'; import { CfnMapping } from '../cfn-mapping'; import { Aws } from '../cfn-pseudo'; import { Stack } from '../stack'; diff --git a/packages/@aws-cdk/core/lib/private/resolve.ts b/packages/aws-cdk-lib/core/lib/private/resolve.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/resolve.ts rename to packages/aws-cdk-lib/core/lib/private/resolve.ts diff --git a/packages/@aws-cdk/core/lib/private/runtime-info.ts b/packages/aws-cdk-lib/core/lib/private/runtime-info.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/runtime-info.ts rename to packages/aws-cdk-lib/core/lib/private/runtime-info.ts diff --git a/packages/@aws-cdk/core/lib/private/synthesis.ts b/packages/aws-cdk-lib/core/lib/private/synthesis.ts similarity index 99% rename from packages/@aws-cdk/core/lib/private/synthesis.ts rename to packages/aws-cdk-lib/core/lib/private/synthesis.ts index b88f676f73b5d..386ad8d0b583e 100644 --- a/packages/@aws-cdk/core/lib/private/synthesis.ts +++ b/packages/aws-cdk-lib/core/lib/private/synthesis.ts @@ -1,8 +1,8 @@ import { createHash } from 'crypto'; import * as fs from 'fs'; import * as path from 'path'; -import * as cxapi from '@aws-cdk/cx-api'; -import { CloudAssembly } from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; +import { CloudAssembly } from '../../../cx-api'; import { IConstruct } from 'constructs'; import { MetadataResource } from './metadata-resource'; import { prepareApp } from './prepare-app'; diff --git a/packages/@aws-cdk/core/lib/private/token-map.ts b/packages/aws-cdk-lib/core/lib/private/token-map.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/token-map.ts rename to packages/aws-cdk-lib/core/lib/private/token-map.ts diff --git a/packages/@aws-cdk/core/lib/private/tree-metadata.ts b/packages/aws-cdk-lib/core/lib/private/tree-metadata.ts similarity index 98% rename from packages/@aws-cdk/core/lib/private/tree-metadata.ts rename to packages/aws-cdk-lib/core/lib/private/tree-metadata.ts index 23a6bb116feb8..0441bea237cd7 100644 --- a/packages/@aws-cdk/core/lib/private/tree-metadata.ts +++ b/packages/aws-cdk-lib/core/lib/private/tree-metadata.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import { ArtifactType } from '@aws-cdk/cloud-assembly-schema'; +import { ArtifactType } from '../../../cloud-assembly-schema'; import { Construct, IConstruct } from 'constructs'; import { ConstructInfo, constructInfoFromConstruct } from './runtime-info'; import { Annotations } from '../annotations'; diff --git a/packages/@aws-cdk/core/lib/private/unique-resource-name.ts b/packages/aws-cdk-lib/core/lib/private/unique-resource-name.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/unique-resource-name.ts rename to packages/aws-cdk-lib/core/lib/private/unique-resource-name.ts diff --git a/packages/@aws-cdk/core/lib/private/uniqueid.ts b/packages/aws-cdk-lib/core/lib/private/uniqueid.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/uniqueid.ts rename to packages/aws-cdk-lib/core/lib/private/uniqueid.ts diff --git a/packages/@aws-cdk/core/lib/private/yaml-cfn.ts b/packages/aws-cdk-lib/core/lib/private/yaml-cfn.ts similarity index 100% rename from packages/@aws-cdk/core/lib/private/yaml-cfn.ts rename to packages/aws-cdk-lib/core/lib/private/yaml-cfn.ts diff --git a/packages/@aws-cdk/core/lib/reference.ts b/packages/aws-cdk-lib/core/lib/reference.ts similarity index 100% rename from packages/@aws-cdk/core/lib/reference.ts rename to packages/aws-cdk-lib/core/lib/reference.ts diff --git a/packages/@aws-cdk/core/lib/removal-policy.ts b/packages/aws-cdk-lib/core/lib/removal-policy.ts similarity index 100% rename from packages/@aws-cdk/core/lib/removal-policy.ts rename to packages/aws-cdk-lib/core/lib/removal-policy.ts diff --git a/packages/@aws-cdk/core/lib/resolvable.ts b/packages/aws-cdk-lib/core/lib/resolvable.ts similarity index 100% rename from packages/@aws-cdk/core/lib/resolvable.ts rename to packages/aws-cdk-lib/core/lib/resolvable.ts diff --git a/packages/@aws-cdk/core/lib/resource.ts b/packages/aws-cdk-lib/core/lib/resource.ts similarity index 100% rename from packages/@aws-cdk/core/lib/resource.ts rename to packages/aws-cdk-lib/core/lib/resource.ts diff --git a/packages/@aws-cdk/core/lib/runtime.ts b/packages/aws-cdk-lib/core/lib/runtime.ts similarity index 100% rename from packages/@aws-cdk/core/lib/runtime.ts rename to packages/aws-cdk-lib/core/lib/runtime.ts diff --git a/packages/@aws-cdk/core/lib/secret-value.ts b/packages/aws-cdk-lib/core/lib/secret-value.ts similarity index 99% rename from packages/@aws-cdk/core/lib/secret-value.ts rename to packages/aws-cdk-lib/core/lib/secret-value.ts index b560417066df4..8f9af0e6bfca9 100644 --- a/packages/@aws-cdk/core/lib/secret-value.ts +++ b/packages/aws-cdk-lib/core/lib/secret-value.ts @@ -1,4 +1,4 @@ -import { CHECK_SECRET_USAGE } from '@aws-cdk/cx-api'; +import { CHECK_SECRET_USAGE } from '../../cx-api'; import { CfnDynamicReference, CfnDynamicReferenceService } from './cfn-dynamic-reference'; import { CfnParameter } from './cfn-parameter'; import { CfnResource } from './cfn-resource'; diff --git a/packages/@aws-cdk/core/lib/size.ts b/packages/aws-cdk-lib/core/lib/size.ts similarity index 100% rename from packages/@aws-cdk/core/lib/size.ts rename to packages/aws-cdk-lib/core/lib/size.ts diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/_shared.ts similarity index 98% rename from packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/_shared.ts index f4627ecc26821..c8165e72f9c0a 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/_shared.ts +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/_shared.ts @@ -1,6 +1,6 @@ import * as crypto from 'crypto'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../../cloud-assembly-schema'; +import * as cxapi from '../../../cx-api'; import { Node, IConstruct } from 'constructs'; import { ISynthesisSession } from './types'; import { Stack } from '../stack'; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/asset-manifest-builder.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/asset-manifest-builder.ts similarity index 99% rename from packages/@aws-cdk/core/lib/stack-synthesizers/asset-manifest-builder.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/asset-manifest-builder.ts index 7a985abf2347e..c25f620a314db 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/asset-manifest-builder.ts +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/asset-manifest-builder.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxschema from '../../../cloud-assembly-schema'; import { resolvedOr } from './_shared'; import { ISynthesisSession } from './types'; import { FileAssetSource, FileAssetPackaging, DockerImageAssetSource } from '../assets'; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/bootstrapless-synthesizer.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/bootstrapless-synthesizer.ts similarity index 100% rename from packages/@aws-cdk/core/lib/stack-synthesizers/bootstrapless-synthesizer.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/bootstrapless-synthesizer.ts diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts similarity index 99% rename from packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts index e8be1ba70e15c..a85f483c3654c 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/cli-credentials-synthesizer.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; import { assertBound, StringSpecializer } from './_shared'; import { AssetManifestBuilder } from './asset-manifest-builder'; import { BOOTSTRAP_QUALIFIER_CONTEXT, DefaultStackSynthesizer } from './default-synthesizer'; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/default-synthesizer.ts similarity index 99% rename from packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/default-synthesizer.ts index 88b3eaa3177d4..9185b5e05016e 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/default-synthesizer.ts +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/default-synthesizer.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; import { assertBound, StringSpecializer } from './_shared'; import { AssetManifestBuilder } from './asset-manifest-builder'; import { StackSynthesizer } from './stack-synthesizer'; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/index.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/stack-synthesizers/index.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/index.ts diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/legacy.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/legacy.ts similarity index 98% rename from packages/@aws-cdk/core/lib/stack-synthesizers/legacy.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/legacy.ts index 5131fc3d06416..1717859f38e62 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/legacy.ts +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/legacy.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../../cloud-assembly-schema'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { assertBound } from './_shared'; import { StackSynthesizer } from './stack-synthesizer'; diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/nested.ts similarity index 100% rename from packages/@aws-cdk/core/lib/stack-synthesizers/nested.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/nested.ts diff --git a/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/stack-synthesizer.ts similarity index 99% rename from packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts rename to packages/aws-cdk-lib/core/lib/stack-synthesizers/stack-synthesizer.ts index 8d4f37d6924a8..5306d98b4789e 100644 --- a/packages/@aws-cdk/core/lib/stack-synthesizers/stack-synthesizer.ts +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/stack-synthesizer.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../../cloud-assembly-schema'; +import * as cxapi from '../../../cx-api'; import { addStackArtifactToAssembly, contentHash, resolvedOr } from './_shared'; import { IStackSynthesizer, ISynthesisSession } from './types'; import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetSource, FileAssetPackaging } from '../assets'; diff --git a/packages/aws-cdk-lib/core/lib/stack-synthesizers/types.ts b/packages/aws-cdk-lib/core/lib/stack-synthesizers/types.ts new file mode 100644 index 0000000000000..c26ffd6707110 --- /dev/null +++ b/packages/aws-cdk-lib/core/lib/stack-synthesizers/types.ts @@ -0,0 +1,97 @@ +import { CloudAssemblyBuilder } from '../../../cx-api'; +import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetSource } from '../assets'; +import { Stack } from '../stack'; + +/** + * Encodes information how a certain Stack should be deployed + */ +export interface IStackSynthesizer { + /** + * The qualifier used to bootstrap this stack + * + * @default - no qualifier + */ + readonly bootstrapQualifier?: string; + + /** + * Bind to the stack this environment is going to be used on + * + * Must be called before any of the other methods are called, and can only be called once. + */ + bind(stack: Stack): void; + + /** + * Register a File Asset + * + * Returns the parameters that can be used to refer to the asset inside the template. + */ + addFileAsset(asset: FileAssetSource): FileAssetLocation; + + /** + * Register a Docker Image Asset + * + * Returns the parameters that can be used to refer to the asset inside the template. + */ + addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation; + + /** + * Synthesize the associated stack to the session + */ + synthesize(session: ISynthesisSession): void; +} + +/** + * Interface for Stack Synthesizers that can be used for more than one stack. + * + * Regular `IStackSynthesizer` instances can only be bound to a Stack once. + * `IReusableStackSynthesizer` instances. + * + * For backwards compatibility reasons, this class inherits from + * `IStackSynthesizer`, but if an object implements `IReusableStackSynthesizer`, + * no other methods than `reusableBind()` will be called. + */ +export interface IReusableStackSynthesizer extends IStackSynthesizer { + /** + * Produce a bound Stack Synthesizer for the given stack. + * + * This method may be called more than once on the same object. + */ + reusableBind(stack: Stack): IBoundStackSynthesizer; +} + +/** + * A Stack Synthesizer, obtained from `IReusableStackSynthesizer.` + * + * Just a type alias with a very concrete contract. + */ +export interface IBoundStackSynthesizer extends IStackSynthesizer { +} + +/** + * Represents a single session of synthesis. Passed into `Construct.synthesize()` methods. + */ +export interface ISynthesisSession { + /** + * The output directory for this synthesis session. + */ + outdir: string; + + /** + * Cloud assembly builder. + */ + assembly: CloudAssemblyBuilder; + + /** + * Whether the stack should be validated after synthesis to check for error metadata + * + * @default - false + */ + validateOnSynth?: boolean; +} + +/** + * Whether the given Stack Synthesizer is reusable or not + */ +export function isReusableStackSynthesizer(x: IStackSynthesizer): x is IReusableStackSynthesizer { + return !!(x as any).reusableBind; +} \ No newline at end of file diff --git a/packages/@aws-cdk/core/lib/stack-trace.ts b/packages/aws-cdk-lib/core/lib/stack-trace.ts similarity index 100% rename from packages/@aws-cdk/core/lib/stack-trace.ts rename to packages/aws-cdk-lib/core/lib/stack-trace.ts diff --git a/packages/@aws-cdk/core/lib/stack.ts b/packages/aws-cdk-lib/core/lib/stack.ts similarity index 99% rename from packages/@aws-cdk/core/lib/stack.ts rename to packages/aws-cdk-lib/core/lib/stack.ts index 88f8fe59c4a97..d798d0a50e50a 100644 --- a/packages/@aws-cdk/core/lib/stack.ts +++ b/packages/aws-cdk-lib/core/lib/stack.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; import { IConstruct, Construct, Node } from 'constructs'; import * as minimatch from 'minimatch'; import { Annotations } from './annotations'; @@ -1722,7 +1722,7 @@ import { Stage } from './stage'; import { ITaggable, TagManager } from './tag-manager'; import { Token, Tokenization } from './token'; import { getExportable } from './private/refs'; -import { Fact, RegionInfo } from '@aws-cdk/region-info'; +import { Fact, RegionInfo } from '../../region-info'; import { deployTimeLookup } from './private/region-lookup'; import { makeUniqueResourceName } from './private/unique-resource-name';import { PRIVATE_CONTEXT_DEFAULT_STACK_SYNTHESIZER } from './private/private-context'; /* eslint-enable import/order */ diff --git a/packages/aws-cdk-lib/core/lib/stage.ts b/packages/aws-cdk-lib/core/lib/stage.ts new file mode 100644 index 0000000000000..495af9712eaec --- /dev/null +++ b/packages/aws-cdk-lib/core/lib/stage.ts @@ -0,0 +1,265 @@ +import * as cxapi from '../../cx-api'; +import { IConstruct, Construct, Node } from 'constructs'; +import { Environment } from './environment'; +import { PermissionsBoundary } from './permissions-boundary'; +import { synthesize } from './private/synthesis'; +import { IPolicyValidationPluginBeta1 } from './validation'; + +const STAGE_SYMBOL = Symbol.for('@aws-cdk/core.Stage'); + +/** + * Initialization props for a stage. + */ +export interface StageProps { + /** + * Default AWS environment (account/region) for `Stack`s in this `Stage`. + * + * Stacks defined inside this `Stage` with either `region` or `account` missing + * from its env will use the corresponding field given here. + * + * If either `region` or `account`is is not configured for `Stack` (either on + * the `Stack` itself or on the containing `Stage`), the Stack will be + * *environment-agnostic*. + * + * Environment-agnostic stacks can be deployed to any environment, may not be + * able to take advantage of all features of the CDK. For example, they will + * not be able to use environmental context lookups, will not automatically + * translate Service Principals to the right format based on the environment's + * AWS partition, and other such enhancements. + * + * @example + * + * // Use a concrete account and region to deploy this Stage to + * new Stage(app, 'Stage1', { + * env: { account: '123456789012', region: 'us-east-1' }, + * }); + * + * // Use the CLI's current credentials to determine the target environment + * new Stage(app, 'Stage2', { + * env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION }, + * }); + * + * @default - The environments should be configured on the `Stack`s. + */ + readonly env?: Environment; + + /** + * The output directory into which to emit synthesized artifacts. + * + * Can only be specified if this stage is the root stage (the app). If this is + * specified and this stage is nested within another stage, an error will be + * thrown. + * + * @default - for nested stages, outdir will be determined as a relative + * directory to the outdir of the app. For apps, if outdir is not specified, a + * temporary directory will be created. + */ + readonly outdir?: string; + + /** + * Name of this stage. + * + * @default - Derived from the id. + */ + readonly stageName?: string; + + /** + * Options for applying a permissions boundary to all IAM Roles + * and Users created within this Stage + * + * @default - no permissions boundary is applied + */ + readonly permissionsBoundary?: PermissionsBoundary; + + /** + * Validation plugins to run during synthesis. If any plugin reports any violation, + * synthesis will be interrupted and the report displayed to the user. + * + * @default - no validation plugins are used + */ + readonly policyValidationBeta1?: IPolicyValidationPluginBeta1[] +} + +/** + * An abstract application modeling unit consisting of Stacks that should be + * deployed together. + * + * Derive a subclass of `Stage` and use it to model a single instance of your + * application. + * + * You can then instantiate your subclass multiple times to model multiple + * copies of your application which should be be deployed to different + * environments. + */ +export class Stage extends Construct { + /** + * Return the stage this construct is contained with, if available. If called + * on a nested stage, returns its parent. + * + */ + public static of(construct: IConstruct): Stage | undefined { + return Node.of(construct).scopes.reverse().slice(1).find(Stage.isStage); + } + + /** + * Test whether the given construct is a stage. + * + */ + public static isStage(x: any ): x is Stage { + return x !== null && typeof(x) === 'object' && STAGE_SYMBOL in x; + } + + /** + * The default region for all resources defined within this stage. + * + */ + public readonly region?: string; + + /** + * The default account for all resources defined within this stage. + * + */ + public readonly account?: string; + + /** + * The cloud assembly builder that is being used for this App + * + * @internal + */ + public readonly _assemblyBuilder: cxapi.CloudAssemblyBuilder; + + /** + * The name of the stage. Based on names of the parent stages separated by + * hypens. + * + */ + public readonly stageName: string; + + /** + * The parent stage or `undefined` if this is the app. + * * + */ + public readonly parentStage?: Stage; + + /** + * The cached assembly if it was already built + */ + private assembly?: cxapi.CloudAssembly; + + /** + * Validation plugins to run during synthesis. If any plugin reports any violation, + * synthesis will be interrupted and the report displayed to the user. + * + * @default - no validation plugins are used + */ + public readonly policyValidationBeta1: IPolicyValidationPluginBeta1[] = []; + + + constructor(scope: Construct, id: string, props: StageProps = {}) { + super(scope, id); + + if (id !== '' && !/^[a-z][a-z0-9\-\_\.]+$/i.test(id)) { + throw new Error(`invalid stage name "${id}". Stage name must start with a letter and contain only alphanumeric characters, hypens ('-'), underscores ('_') and periods ('.')`); + } + + Object.defineProperty(this, STAGE_SYMBOL, { value: true }); + + this.parentStage = Stage.of(this); + + this.region = props.env?.region ?? this.parentStage?.region; + this.account = props.env?.account ?? this.parentStage?.account; + + + props.permissionsBoundary?._bind(this); + + this._assemblyBuilder = this.createBuilder(props.outdir); + this.stageName = [this.parentStage?.stageName, props.stageName ?? id].filter(x => x).join('-'); + + if (props.policyValidationBeta1) { + this.policyValidationBeta1 = props.policyValidationBeta1; + } + } + + /** + * The cloud assembly output directory. + */ + public get outdir() { + return this._assemblyBuilder.outdir; + } + + /** + * The cloud assembly asset output directory. + */ + public get assetOutdir() { + return this._assemblyBuilder.assetOutdir; + } + + /** + * Artifact ID of the assembly if it is a nested stage. The root stage (app) + * will return an empty string. + * + * Derived from the construct path. + * + */ + public get artifactId() { + if (!this.node.path) { return ''; } + return `assembly-${this.node.path.replace(/\//g, '-').replace(/^-+|-+$/g, '')}`; + } + + /** + * Synthesize this stage into a cloud assembly. + * + * Once an assembly has been synthesized, it cannot be modified. Subsequent + * calls will return the same assembly. + */ + public synth(options: StageSynthesisOptions = { }): cxapi.CloudAssembly { + if (!this.assembly || options.force) { + this.assembly = synthesize(this, { + skipValidation: options.skipValidation, + validateOnSynthesis: options.validateOnSynthesis, + }); + } + + return this.assembly; + } + + private createBuilder(outdir?: string) { + // cannot specify "outdir" if we are a nested stage + if (this.parentStage && outdir) { + throw new Error('"outdir" cannot be specified for nested stages'); + } + + // Need to determine fixed output directory already, because we must know where + // to write sub-assemblies (which must happen before we actually get to this app's + // synthesize() phase). + return this.parentStage + ? this.parentStage._assemblyBuilder.createNestedAssembly(this.artifactId, this.node.path) + : new cxapi.CloudAssemblyBuilder(outdir); + } +} + +/** + * Options for assembly synthesis. + */ +export interface StageSynthesisOptions { + /** + * Should we skip construct validation. + * @default - false + */ + readonly skipValidation?: boolean; + + /** + * Whether the stack should be validated after synthesis to check for error metadata + * + * @default - false + */ + readonly validateOnSynthesis?: boolean; + + /** + * Force a re-synth, even if the stage has already been synthesized. + * This is used by tests to allow for incremental verification of the output. + * Do not use in production. + * @default false + */ + readonly force?: boolean; +} diff --git a/packages/@aws-cdk/core/lib/string-fragments.ts b/packages/aws-cdk-lib/core/lib/string-fragments.ts similarity index 100% rename from packages/@aws-cdk/core/lib/string-fragments.ts rename to packages/aws-cdk-lib/core/lib/string-fragments.ts diff --git a/packages/@aws-cdk/core/lib/tag-aspect.ts b/packages/aws-cdk-lib/core/lib/tag-aspect.ts similarity index 100% rename from packages/@aws-cdk/core/lib/tag-aspect.ts rename to packages/aws-cdk-lib/core/lib/tag-aspect.ts diff --git a/packages/@aws-cdk/core/lib/tag-manager.ts b/packages/aws-cdk-lib/core/lib/tag-manager.ts similarity index 100% rename from packages/@aws-cdk/core/lib/tag-manager.ts rename to packages/aws-cdk-lib/core/lib/tag-manager.ts diff --git a/packages/@aws-cdk/core/lib/time-zone.ts b/packages/aws-cdk-lib/core/lib/time-zone.ts similarity index 100% rename from packages/@aws-cdk/core/lib/time-zone.ts rename to packages/aws-cdk-lib/core/lib/time-zone.ts diff --git a/packages/@aws-cdk/core/lib/token.ts b/packages/aws-cdk-lib/core/lib/token.ts similarity index 100% rename from packages/@aws-cdk/core/lib/token.ts rename to packages/aws-cdk-lib/core/lib/token.ts diff --git a/packages/@aws-cdk/core/lib/tree.ts b/packages/aws-cdk-lib/core/lib/tree.ts similarity index 100% rename from packages/@aws-cdk/core/lib/tree.ts rename to packages/aws-cdk-lib/core/lib/tree.ts diff --git a/packages/@aws-cdk/core/lib/type-hints.ts b/packages/aws-cdk-lib/core/lib/type-hints.ts similarity index 100% rename from packages/@aws-cdk/core/lib/type-hints.ts rename to packages/aws-cdk-lib/core/lib/type-hints.ts diff --git a/packages/@aws-cdk/core/lib/util.ts b/packages/aws-cdk-lib/core/lib/util.ts similarity index 100% rename from packages/@aws-cdk/core/lib/util.ts rename to packages/aws-cdk-lib/core/lib/util.ts diff --git a/packages/@aws-cdk/core/lib/validation/index.ts b/packages/aws-cdk-lib/core/lib/validation/index.ts similarity index 100% rename from packages/@aws-cdk/core/lib/validation/index.ts rename to packages/aws-cdk-lib/core/lib/validation/index.ts diff --git a/packages/@aws-cdk/core/lib/validation/private/construct-tree.ts b/packages/aws-cdk-lib/core/lib/validation/private/construct-tree.ts similarity index 100% rename from packages/@aws-cdk/core/lib/validation/private/construct-tree.ts rename to packages/aws-cdk-lib/core/lib/validation/private/construct-tree.ts diff --git a/packages/@aws-cdk/core/lib/validation/private/report.ts b/packages/aws-cdk-lib/core/lib/validation/private/report.ts similarity index 100% rename from packages/@aws-cdk/core/lib/validation/private/report.ts rename to packages/aws-cdk-lib/core/lib/validation/private/report.ts diff --git a/packages/@aws-cdk/core/lib/validation/private/trace.ts b/packages/aws-cdk-lib/core/lib/validation/private/trace.ts similarity index 100% rename from packages/@aws-cdk/core/lib/validation/private/trace.ts rename to packages/aws-cdk-lib/core/lib/validation/private/trace.ts diff --git a/packages/@aws-cdk/core/lib/validation/report.ts b/packages/aws-cdk-lib/core/lib/validation/report.ts similarity index 100% rename from packages/@aws-cdk/core/lib/validation/report.ts rename to packages/aws-cdk-lib/core/lib/validation/report.ts diff --git a/packages/@aws-cdk/core/lib/validation/validation.ts b/packages/aws-cdk-lib/core/lib/validation/validation.ts similarity index 100% rename from packages/@aws-cdk/core/lib/validation/validation.ts rename to packages/aws-cdk-lib/core/lib/validation/validation.ts diff --git a/packages/@aws-cdk/core/test/annotations.test.ts b/packages/aws-cdk-lib/core/test/annotations.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/annotations.test.ts rename to packages/aws-cdk-lib/core/test/annotations.test.ts diff --git a/packages/@aws-cdk/core/test/app.test.ts b/packages/aws-cdk-lib/core/test/app.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/app.test.ts rename to packages/aws-cdk-lib/core/test/app.test.ts index ea9c58551d530..57cc29d379e14 100644 --- a/packages/@aws-cdk/core/test/app.test.ts +++ b/packages/aws-cdk-lib/core/test/app.test.ts @@ -1,7 +1,7 @@ import * as os from 'os'; import * as path from 'path'; -import { ContextProvider } from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import { ContextProvider } from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import * as fs from 'fs-extra'; import { CfnResource, DefaultStackSynthesizer, Stack, StackProps } from '../lib'; diff --git a/packages/@aws-cdk/core/test/archive/DockerFile b/packages/aws-cdk-lib/core/test/archive/DockerFile similarity index 100% rename from packages/@aws-cdk/core/test/archive/DockerFile rename to packages/aws-cdk-lib/core/test/archive/DockerFile diff --git a/packages/@aws-cdk/core/test/archive/archive.zip b/packages/aws-cdk-lib/core/test/archive/archive.zip similarity index 100% rename from packages/@aws-cdk/core/test/archive/archive.zip rename to packages/aws-cdk-lib/core/test/archive/archive.zip diff --git a/packages/@aws-cdk/core/test/archive/artifact.da.vinci.monalisa.tar.gz b/packages/aws-cdk-lib/core/test/archive/artifact.da.vinci.monalisa.tar.gz similarity index 100% rename from packages/@aws-cdk/core/test/archive/artifact.da.vinci.monalisa.tar.gz rename to packages/aws-cdk-lib/core/test/archive/artifact.da.vinci.monalisa.tar.gz diff --git a/packages/@aws-cdk/core/test/archive/artifact.tar b/packages/aws-cdk-lib/core/test/archive/artifact.tar similarity index 100% rename from packages/@aws-cdk/core/test/archive/artifact.tar rename to packages/aws-cdk-lib/core/test/archive/artifact.tar diff --git a/packages/@aws-cdk/core/test/archive/artifact.tar.gz b/packages/aws-cdk-lib/core/test/archive/artifact.tar.gz similarity index 100% rename from packages/@aws-cdk/core/test/archive/artifact.tar.gz rename to packages/aws-cdk-lib/core/test/archive/artifact.tar.gz diff --git a/packages/@aws-cdk/core/test/archive/artifact.tgz b/packages/aws-cdk-lib/core/test/archive/artifact.tgz similarity index 100% rename from packages/@aws-cdk/core/test/archive/artifact.tgz rename to packages/aws-cdk-lib/core/test/archive/artifact.tgz diff --git a/packages/@aws-cdk/core/test/archive/artifact.zip.txt b/packages/aws-cdk-lib/core/test/archive/artifact.zip.txt similarity index 100% rename from packages/@aws-cdk/core/test/archive/artifact.zip.txt rename to packages/aws-cdk-lib/core/test/archive/artifact.zip.txt diff --git a/packages/@aws-cdk/core/test/arn.test.ts b/packages/aws-cdk-lib/core/test/arn.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/arn.test.ts rename to packages/aws-cdk-lib/core/test/arn.test.ts diff --git a/packages/aws-cdk-lib/core/test/aspect.test.ts b/packages/aws-cdk-lib/core/test/aspect.test.ts new file mode 100644 index 0000000000000..b39f762912c2e --- /dev/null +++ b/packages/aws-cdk-lib/core/test/aspect.test.ts @@ -0,0 +1,72 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import { Construct, IConstruct } from 'constructs'; +import { App } from '../lib'; +import { IAspect, Aspects } from '../lib/aspect'; + +class MyConstruct extends Construct { + public static IsMyConstruct(x: any): x is MyConstruct { + return x.visitCounter !== undefined; + } + public visitCounter: number = 0; +} + +class VisitOnce implements IAspect { + public visit(node: IConstruct): void { + if (MyConstruct.IsMyConstruct(node)) { + node.visitCounter += 1; + } + } +} + +class MyAspect implements IAspect { + public visit(node: IConstruct): void { + node.node.addMetadata('foo', 'bar'); + } +} + +describe('aspect', () => { + test('Aspects are invoked only once', () => { + const app = new App(); + const root = new MyConstruct(app, 'MyConstruct'); + Aspects.of(root).add(new VisitOnce()); + app.synth(); + expect(root.visitCounter).toEqual(1); + app.synth(); + expect(root.visitCounter).toEqual(1); + }); + + test('Warn if an Aspect is added via another Aspect', () => { + const app = new App(); + const root = new MyConstruct(app, 'MyConstruct'); + const child = new MyConstruct(root, 'ChildConstruct'); + Aspects.of(root).add({ + visit(construct: IConstruct) { + Aspects.of(construct).add({ + visit(inner: IConstruct) { + inner.node.addMetadata('test', 'would-be-ignored'); + }, + }); + }, + }); + app.synth(); + expect(root.node.metadata[0].type).toEqual(cxschema.ArtifactMetadataEntryType.WARN); + expect(root.node.metadata[0].data).toEqual('We detected an Aspect was added via another Aspect, and will not be applied'); + // warning is not added to child construct + expect(child.node.metadata.length).toEqual(0); + }); + + test('Do not warn if an Aspect is added directly (not by another aspect)', () => { + const app = new App(); + const root = new MyConstruct(app, 'Construct'); + const child = new MyConstruct(root, 'ChildConstruct'); + Aspects.of(root).add(new MyAspect()); + app.synth(); + expect(root.node.metadata[0].type).toEqual('foo'); + expect(root.node.metadata[0].data).toEqual('bar'); + expect(child.node.metadata[0].type).toEqual('foo'); + expect(child.node.metadata[0].data).toEqual('bar'); + // no warning is added + expect(root.node.metadata.length).toEqual(1); + expect(child.node.metadata.length).toEqual(1); + }); +}); diff --git a/packages/aws-cdk-lib/core/test/assets.test.ts b/packages/aws-cdk-lib/core/test/assets.test.ts new file mode 100644 index 0000000000000..0eff5b096a855 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/assets.test.ts @@ -0,0 +1,146 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; +import { toCloudFormation } from './util'; +import { App, FileAssetPackaging, Stack } from '../lib'; + +describe('assets', () => { + let app: App; + let stack: Stack; + + beforeEach(() => { + app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + stack = new Stack(app); + }); + + test('addFileAsset correctly sets metadata and creates S3 parameters', () => { + // WHEN + stack.synthesizer.addFileAsset({ + fileName: 'file-name', + packaging: FileAssetPackaging.ZIP_DIRECTORY, + sourceHash: 'source-hash', + }); + + // THEN + const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); + + expect(assetMetadata && assetMetadata.data).toBeDefined(); + + if (assetMetadata && assetMetadata.data) { + const data = assetMetadata.data as cxschema.AssetMetadataEntry; + expect(data.path).toEqual('file-name'); + expect(data.id).toEqual('source-hash'); + expect(data.packaging).toEqual(FileAssetPackaging.ZIP_DIRECTORY); + expect(data.sourceHash).toEqual('source-hash'); + } + + expect(toCloudFormation(stack)).toEqual({ + Parameters: { + AssetParameterssourcehashS3BucketE6E91E3E: { + Type: 'String', + Description: 'S3 bucket for asset "source-hash"', + }, + AssetParameterssourcehashS3VersionKeyAC4157C3: { + Type: 'String', + Description: 'S3 key for asset version "source-hash"', + }, + AssetParameterssourcehashArtifactHashADBAE418: { + Type: 'String', + Description: 'Artifact hash for asset "source-hash"', + }, + }, + }); + }); + + test('addFileAsset correctly sets object urls', () => { + // WHEN + const assetLocation = stack.synthesizer.addFileAsset({ + fileName: 'file-name', + packaging: FileAssetPackaging.ZIP_DIRECTORY, + sourceHash: 'source-hash', + }); + + // THEN + const expectedS3UrlPrefix = 's3://'; + const expectedHttpUrlPrefix = `https://s3.${stack.region}.${stack.urlSuffix}/`; + + expect( + assetLocation.s3ObjectUrl.replace(expectedS3UrlPrefix, '')).toEqual( + assetLocation.httpUrl.replace(expectedHttpUrlPrefix, ''), + ); + }); + + test('addDockerImageAsset correctly sets metadata', () => { + // WHEN + stack.synthesizer.addDockerImageAsset({ + sourceHash: 'source-hash', + directoryName: 'directory-name', + }); + + // THEN + const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); + + expect(assetMetadata && assetMetadata.data).toBeDefined(); + + if (assetMetadata && assetMetadata.data) { + const data = assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry; + expect(data.packaging).toEqual('container-image'); + expect(data.path).toEqual('directory-name'); + expect(data.sourceHash).toEqual('source-hash'); + expect(data.imageTag).toEqual('source-hash'); + } + + expect(toCloudFormation(stack)).toEqual({ }); + + }); + + test('addDockerImageAsset uses the default repository name', () => { + // WHEN + stack.synthesizer.addDockerImageAsset({ + sourceHash: 'source-hash', + directoryName: 'directory-name', + }); + + // THEN + const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); + + expect(assetMetadata && assetMetadata.data).toBeDefined(); + + if (assetMetadata && assetMetadata.data) { + const data = assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry; + expect(data.packaging).toEqual('container-image'); + expect(data.path).toEqual('directory-name'); + expect(data.sourceHash).toEqual('source-hash'); + expect(data.imageTag).toEqual('source-hash'); + } + + expect(toCloudFormation(stack)).toEqual({ }); + + }); + + test('addDockerImageAsset supports overriding repository name through a context key as a workaround until we have API for that', () => { + stack.node.setContext('assets-ecr-repository-name', 'my-custom-repo-name'); + + // WHEN + stack.synthesizer.addDockerImageAsset({ + sourceHash: 'source-hash', + directoryName: 'directory-name', + }); + + // THEN + const assetMetadata = stack.node.metadata.find(({ type }) => type === cxschema.ArtifactMetadataEntryType.ASSET); + + expect(assetMetadata && assetMetadata.data).toBeDefined(); + + if (assetMetadata && assetMetadata.data) { + const data = assetMetadata.data as cxschema.ContainerImageAssetMetadataEntry; + expect(data.packaging).toEqual('container-image'); + expect(data.path).toEqual('directory-name'); + expect(data.sourceHash).toEqual('source-hash'); + expect(data.repositoryName).toEqual('my-custom-repo-name'); + expect(data.imageTag).toEqual('source-hash'); + } + + expect(toCloudFormation(stack)).toEqual({ }); + + }); +}); diff --git a/packages/@aws-cdk/core/test/bundling.test.ts b/packages/aws-cdk-lib/core/test/bundling.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/bundling.test.ts rename to packages/aws-cdk-lib/core/test/bundling.test.ts diff --git a/packages/@aws-cdk/core/test/cfn-codedeploy-blue-green-hook.test.ts b/packages/aws-cdk-lib/core/test/cfn-codedeploy-blue-green-hook.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/cfn-codedeploy-blue-green-hook.test.ts rename to packages/aws-cdk-lib/core/test/cfn-codedeploy-blue-green-hook.test.ts diff --git a/packages/@aws-cdk/core/test/cfn-json.test.ts b/packages/aws-cdk-lib/core/test/cfn-json.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/cfn-json.test.ts rename to packages/aws-cdk-lib/core/test/cfn-json.test.ts diff --git a/packages/@aws-cdk/core/test/cfn-parameter.test.ts b/packages/aws-cdk-lib/core/test/cfn-parameter.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/cfn-parameter.test.ts rename to packages/aws-cdk-lib/core/test/cfn-parameter.test.ts diff --git a/packages/@aws-cdk/core/test/cfn-resource.test.ts b/packages/aws-cdk-lib/core/test/cfn-resource.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/cfn-resource.test.ts rename to packages/aws-cdk-lib/core/test/cfn-resource.test.ts index 7b1b6342a6429..d4dd2227b79ad 100644 --- a/packages/@aws-cdk/core/test/cfn-resource.test.ts +++ b/packages/aws-cdk-lib/core/test/cfn-resource.test.ts @@ -1,5 +1,5 @@ -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { VALIDATE_SNAPSHOT_REMOVAL_POLICY } from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import { VALIDATE_SNAPSHOT_REMOVAL_POLICY } from '../../cx-api'; import { Construct } from 'constructs'; import { getWarnings } from './util'; import * as core from '../lib'; diff --git a/packages/@aws-cdk/core/test/cloudformation-json.test.ts b/packages/aws-cdk-lib/core/test/cloudformation-json.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/cloudformation-json.test.ts rename to packages/aws-cdk-lib/core/test/cloudformation-json.test.ts diff --git a/packages/@aws-cdk/core/test/condition.test.ts b/packages/aws-cdk-lib/core/test/condition.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/condition.test.ts rename to packages/aws-cdk-lib/core/test/condition.test.ts diff --git a/packages/@aws-cdk/core/test/construct.test.ts b/packages/aws-cdk-lib/core/test/construct.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/construct.test.ts rename to packages/aws-cdk-lib/core/test/construct.test.ts index 1d01f3158d9c8..4356cfad8dd3d 100644 --- a/packages/@aws-cdk/core/test/construct.test.ts +++ b/packages/aws-cdk-lib/core/test/construct.test.ts @@ -1,5 +1,5 @@ import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxschema from '../../cloud-assembly-schema'; import { Construct, ConstructOrder, IConstruct } from 'constructs'; import { reEnableStackTraceCollection, restoreStackTraceColection } from './util'; import { Names } from '../lib'; diff --git a/packages/@aws-cdk/core/test/context.test.ts b/packages/aws-cdk-lib/core/test/context.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/context.test.ts rename to packages/aws-cdk-lib/core/test/context.test.ts index 46d9e66d35775..803396346436f 100644 --- a/packages/@aws-cdk/core/test/context.test.ts +++ b/packages/aws-cdk-lib/core/test/context.test.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { App, Stack } from '../lib'; import { ContextProvider } from '../lib/context-provider'; diff --git a/packages/@aws-cdk/core/test/cross-environment-token.test.ts b/packages/aws-cdk-lib/core/test/cross-environment-token.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/cross-environment-token.test.ts rename to packages/aws-cdk-lib/core/test/cross-environment-token.test.ts diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/cross-region-ssm-reader-handler.test.ts b/packages/aws-cdk-lib/core/test/custom-resource-provider/cross-region-ssm-reader-handler.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/custom-resource-provider/cross-region-ssm-reader-handler.test.ts rename to packages/aws-cdk-lib/core/test/custom-resource-provider/cross-region-ssm-reader-handler.test.ts diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/cross-region-ssm-writer-handler.test.ts b/packages/aws-cdk-lib/core/test/custom-resource-provider/cross-region-ssm-writer-handler.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/custom-resource-provider/cross-region-ssm-writer-handler.test.ts rename to packages/aws-cdk-lib/core/test/custom-resource-provider/cross-region-ssm-writer-handler.test.ts diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/custom-resource-provider.test.ts b/packages/aws-cdk-lib/core/test/custom-resource-provider/custom-resource-provider.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/custom-resource-provider/custom-resource-provider.test.ts rename to packages/aws-cdk-lib/core/test/custom-resource-provider/custom-resource-provider.test.ts index 31d6e335ed727..d18575883cf3e 100644 --- a/packages/@aws-cdk/core/test/custom-resource-provider/custom-resource-provider.test.ts +++ b/packages/aws-cdk-lib/core/test/custom-resource-provider/custom-resource-provider.test.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; import { App, AssetStaging, CustomResourceProvider, CustomResourceProviderRuntime, DockerImageAssetLocation, DockerImageAssetSource, Duration, FileAssetLocation, FileAssetSource, ISynthesisSession, Size, Stack, CfnResource } from '../../lib'; import { CUSTOMIZE_ROLES_CONTEXT_KEY } from '../../lib/helpers-internal'; import { toCloudFormation } from '../util'; diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/export-writer-provider.test.ts b/packages/aws-cdk-lib/core/test/custom-resource-provider/export-writer-provider.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/custom-resource-provider/export-writer-provider.test.ts rename to packages/aws-cdk-lib/core/test/custom-resource-provider/export-writer-provider.test.ts diff --git a/packages/aws-cdk-lib/core/test/custom-resource-provider/mock-provider/index.ts b/packages/aws-cdk-lib/core/test/custom-resource-provider/mock-provider/index.ts new file mode 100644 index 0000000000000..7ed7ebf8df0b3 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/custom-resource-provider/mock-provider/index.ts @@ -0,0 +1,10 @@ +/* eslint-disable no-console */ + +export function handler(event: any) { + console.log('I am a custom resource'); + console.log({ ...event, ResponseURL: undefined }); + return { + PhysicalResourceId: event.ResourceProperties.physicalResourceId, + Data: event.ResourceProperties.attributes, + }; +} diff --git a/packages/@aws-cdk/core/test/custom-resource-provider/nodejs-entrypoint.test.ts b/packages/aws-cdk-lib/core/test/custom-resource-provider/nodejs-entrypoint.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/custom-resource-provider/nodejs-entrypoint.test.ts rename to packages/aws-cdk-lib/core/test/custom-resource-provider/nodejs-entrypoint.test.ts diff --git a/packages/@aws-cdk/core/test/custom-resource.test.ts b/packages/aws-cdk-lib/core/test/custom-resource.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/custom-resource.test.ts rename to packages/aws-cdk-lib/core/test/custom-resource.test.ts diff --git a/packages/@aws-cdk/core/test/deps.test.ts b/packages/aws-cdk-lib/core/test/deps.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/deps.test.ts rename to packages/aws-cdk-lib/core/test/deps.test.ts diff --git a/packages/@aws-cdk/core/test/docker-stub-cp.sh b/packages/aws-cdk-lib/core/test/docker-stub-cp.sh similarity index 100% rename from packages/@aws-cdk/core/test/docker-stub-cp.sh rename to packages/aws-cdk-lib/core/test/docker-stub-cp.sh diff --git a/packages/@aws-cdk/core/test/docker-stub.sh b/packages/aws-cdk-lib/core/test/docker-stub.sh similarity index 100% rename from packages/@aws-cdk/core/test/docker-stub.sh rename to packages/aws-cdk-lib/core/test/docker-stub.sh diff --git a/packages/@aws-cdk/core/test/duration.test.ts b/packages/aws-cdk-lib/core/test/duration.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/duration.test.ts rename to packages/aws-cdk-lib/core/test/duration.test.ts diff --git a/packages/@aws-cdk/core/test/dynamic-reference.test.ts b/packages/aws-cdk-lib/core/test/dynamic-reference.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/dynamic-reference.test.ts rename to packages/aws-cdk-lib/core/test/dynamic-reference.test.ts diff --git a/packages/@aws-cdk/core/test/environment.test.ts b/packages/aws-cdk-lib/core/test/environment.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/environment.test.ts rename to packages/aws-cdk-lib/core/test/environment.test.ts diff --git a/packages/@aws-cdk/core/test/evaluate-cfn.ts b/packages/aws-cdk-lib/core/test/evaluate-cfn.ts similarity index 100% rename from packages/@aws-cdk/core/test/evaluate-cfn.ts rename to packages/aws-cdk-lib/core/test/evaluate-cfn.ts diff --git a/packages/@aws-cdk/core/test/expiration.test.ts b/packages/aws-cdk-lib/core/test/expiration.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/expiration.test.ts rename to packages/aws-cdk-lib/core/test/expiration.test.ts diff --git a/packages/@aws-cdk/core/test/feature-flags.test.ts b/packages/aws-cdk-lib/core/test/feature-flags.test.ts similarity index 96% rename from packages/@aws-cdk/core/test/feature-flags.test.ts rename to packages/aws-cdk-lib/core/test/feature-flags.test.ts index 0e4a267452dd6..5b6f662948d9c 100644 --- a/packages/@aws-cdk/core/test/feature-flags.test.ts +++ b/packages/aws-cdk-lib/core/test/feature-flags.test.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../cx-api'; import { FeatureFlags, Stack } from '../lib'; describe('feature flags', () => { diff --git a/packages/@aws-cdk/core/test/fn.test.ts b/packages/aws-cdk-lib/core/test/fn.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/fn.test.ts rename to packages/aws-cdk-lib/core/test/fn.test.ts diff --git a/packages/@aws-cdk/core/test/fs/eol/lf.txt b/packages/aws-cdk-lib/core/test/fs/eol/lf.txt similarity index 100% rename from packages/@aws-cdk/core/test/fs/eol/lf.txt rename to packages/aws-cdk-lib/core/test/fs/eol/lf.txt diff --git a/packages/@aws-cdk/core/test/fs/fixtures.tar.gz b/packages/aws-cdk-lib/core/test/fs/fixtures.tar.gz similarity index 100% rename from packages/@aws-cdk/core/test/fs/fixtures.tar.gz rename to packages/aws-cdk-lib/core/test/fs/fixtures.tar.gz diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/external-dir-link b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/external-dir-link new file mode 120000 index 0000000000000..b9447033a4279 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/external-dir-link @@ -0,0 +1 @@ +../test1/subdir \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/external-link.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/external-link.txt new file mode 120000 index 0000000000000..267020c936652 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/external-link.txt @@ -0,0 +1 @@ +../test1/subdir2/subdir3/file3.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/indirect-external-link.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/indirect-external-link.txt new file mode 120000 index 0000000000000..907a2a65b1515 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/indirect-external-link.txt @@ -0,0 +1 @@ +external-link.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/local-dir-link b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/local-dir-link new file mode 120000 index 0000000000000..42101049ac31a --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/local-dir-link @@ -0,0 +1 @@ +normal-dir \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/local-link.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/local-link.txt new file mode 120000 index 0000000000000..b3c6fdbd8bfad --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/local-link.txt @@ -0,0 +1 @@ +normal-file.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/normal-dir/file-in-subdir.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/normal-dir/file-in-subdir.txt new file mode 100644 index 0000000000000..f52de026412b3 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/normal-dir/file-in-subdir.txt @@ -0,0 +1 @@ +file in subdir diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/normal-file.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/normal-file.txt new file mode 100644 index 0000000000000..d627587e36e77 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/symlinks/normal-file.txt @@ -0,0 +1 @@ +this is a normal file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/test1/external-link.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/external-link.txt new file mode 120000 index 0000000000000..c7ba61290b25a --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/external-link.txt @@ -0,0 +1 @@ +../symlinks/normal-file.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/test1/file1.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/file1.txt new file mode 100644 index 0000000000000..e2129701f1a4d --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/file1.txt @@ -0,0 +1 @@ +file1 diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/test1/local-link.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/local-link.txt new file mode 120000 index 0000000000000..39cd5762dce4e --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/local-link.txt @@ -0,0 +1 @@ +file1.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir/file2.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir/file2.txt new file mode 100644 index 0000000000000..97bbbd35efdff --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir/file2.txt @@ -0,0 +1 @@ +file2 in subdir \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir2/empty-subdir/.hidden b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir2/empty-subdir/.hidden new file mode 100644 index 0000000000000..b96b7256c6541 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir2/empty-subdir/.hidden @@ -0,0 +1 @@ +hidden file \ No newline at end of file diff --git a/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir2/subdir3/file3.txt b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir2/subdir3/file3.txt new file mode 100644 index 0000000000000..eae5e936a040d --- /dev/null +++ b/packages/aws-cdk-lib/core/test/fs/fixtures/test1/subdir2/subdir3/file3.txt @@ -0,0 +1 @@ +file3 in subdir2/subdir3 diff --git a/packages/@aws-cdk/core/test/fs/fs-copy.test.ts b/packages/aws-cdk-lib/core/test/fs/fs-copy.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/fs/fs-copy.test.ts rename to packages/aws-cdk-lib/core/test/fs/fs-copy.test.ts diff --git a/packages/@aws-cdk/core/test/fs/fs-fingerprint.test.ts b/packages/aws-cdk-lib/core/test/fs/fs-fingerprint.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/fs/fs-fingerprint.test.ts rename to packages/aws-cdk-lib/core/test/fs/fs-fingerprint.test.ts diff --git a/packages/@aws-cdk/core/test/fs/fs-ignore.test.ts b/packages/aws-cdk-lib/core/test/fs/fs-ignore.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/fs/fs-ignore.test.ts rename to packages/aws-cdk-lib/core/test/fs/fs-ignore.test.ts diff --git a/packages/@aws-cdk/core/test/fs/fs.test.ts b/packages/aws-cdk-lib/core/test/fs/fs.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/fs/fs.test.ts rename to packages/aws-cdk-lib/core/test/fs/fs.test.ts diff --git a/packages/@aws-cdk/core/test/fs/utils.test.ts b/packages/aws-cdk-lib/core/test/fs/utils.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/fs/utils.test.ts rename to packages/aws-cdk-lib/core/test/fs/utils.test.ts diff --git a/packages/@aws-cdk/core/test/include.test.ts b/packages/aws-cdk-lib/core/test/include.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/include.test.ts rename to packages/aws-cdk-lib/core/test/include.test.ts diff --git a/packages/@aws-cdk/core/test/integration.custom-resources.readme b/packages/aws-cdk-lib/core/test/integration.custom-resources.readme similarity index 100% rename from packages/@aws-cdk/core/test/integration.custom-resources.readme rename to packages/aws-cdk-lib/core/test/integration.custom-resources.readme diff --git a/packages/@aws-cdk/core/test/integration.deps.readme b/packages/aws-cdk-lib/core/test/integration.deps.readme similarity index 100% rename from packages/@aws-cdk/core/test/integration.deps.readme rename to packages/aws-cdk-lib/core/test/integration.deps.readme diff --git a/packages/@aws-cdk/core/test/logical-id.test.ts b/packages/aws-cdk-lib/core/test/logical-id.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/logical-id.test.ts rename to packages/aws-cdk-lib/core/test/logical-id.test.ts index 613d3a64b3dc4..a2ade3ae2a58c 100644 --- a/packages/@aws-cdk/core/test/logical-id.test.ts +++ b/packages/aws-cdk-lib/core/test/logical-id.test.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import { toCloudFormation } from './util'; import { App, CfnElement, CfnResource, Stack } from '../lib'; diff --git a/packages/@aws-cdk/core/test/mappings.test.ts b/packages/aws-cdk-lib/core/test/mappings.test.ts similarity index 98% rename from packages/@aws-cdk/core/test/mappings.test.ts rename to packages/aws-cdk-lib/core/test/mappings.test.ts index de75307e1cf61..9a630abd209a9 100644 --- a/packages/@aws-cdk/core/test/mappings.test.ts +++ b/packages/aws-cdk-lib/core/test/mappings.test.ts @@ -1,5 +1,5 @@ -import { ArtifactMetadataEntryType } from '@aws-cdk/cloud-assembly-schema'; -import { CloudAssembly } from '@aws-cdk/cx-api'; +import { ArtifactMetadataEntryType } from '../../cloud-assembly-schema'; +import { CloudAssembly } from '../../cx-api'; import { toCloudFormation } from './util'; import { App, Aws, CfnMapping, CfnResource, CfnOutput, Fn, Stack } from '../lib'; diff --git a/packages/@aws-cdk/core/test/metadata-resource.test.ts b/packages/aws-cdk-lib/core/test/metadata-resource.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/metadata-resource.test.ts rename to packages/aws-cdk-lib/core/test/metadata-resource.test.ts diff --git a/packages/@aws-cdk/core/test/nested-stack.test.ts b/packages/aws-cdk-lib/core/test/nested-stack.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/nested-stack.test.ts rename to packages/aws-cdk-lib/core/test/nested-stack.test.ts diff --git a/packages/@aws-cdk/core/test/output.test.ts b/packages/aws-cdk-lib/core/test/output.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/output.test.ts rename to packages/aws-cdk-lib/core/test/output.test.ts diff --git a/packages/@aws-cdk/core/test/parameter.test.ts b/packages/aws-cdk-lib/core/test/parameter.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/parameter.test.ts rename to packages/aws-cdk-lib/core/test/parameter.test.ts diff --git a/packages/@aws-cdk/core/test/private/asset-staging.test.ts b/packages/aws-cdk-lib/core/test/private/asset-staging.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/private/asset-staging.test.ts rename to packages/aws-cdk-lib/core/test/private/asset-staging.test.ts diff --git a/packages/@aws-cdk/core/test/private/cache.test.ts b/packages/aws-cdk-lib/core/test/private/cache.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/private/cache.test.ts rename to packages/aws-cdk-lib/core/test/private/cache.test.ts diff --git a/packages/@aws-cdk/core/test/private/md5.test.ts b/packages/aws-cdk-lib/core/test/private/md5.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/private/md5.test.ts rename to packages/aws-cdk-lib/core/test/private/md5.test.ts diff --git a/packages/@aws-cdk/core/test/private/physical-name-generator.test.ts b/packages/aws-cdk-lib/core/test/private/physical-name-generator.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/private/physical-name-generator.test.ts rename to packages/aws-cdk-lib/core/test/private/physical-name-generator.test.ts diff --git a/packages/@aws-cdk/core/test/private/tree-metadata.test.ts b/packages/aws-cdk-lib/core/test/private/tree-metadata.test.ts similarity index 98% rename from packages/@aws-cdk/core/test/private/tree-metadata.test.ts rename to packages/aws-cdk-lib/core/test/private/tree-metadata.test.ts index a19118f750535..c3b7b534778b9 100644 --- a/packages/@aws-cdk/core/test/private/tree-metadata.test.ts +++ b/packages/aws-cdk-lib/core/test/private/tree-metadata.test.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; +import * as cxschema from '../../../cloud-assembly-schema'; import { Construct } from 'constructs'; import { App, CfnParameter, CfnResource, Lazy, Stack, TreeInspector } from '../../lib/index'; @@ -46,7 +46,7 @@ describe('tree metadata', () => { children: { BootstrapVersion: { constructInfo: { - fqn: '@aws-cdk/core.CfnParameter', + fqn: 'aws-cdk-lib.CfnParameter', version: expect.any(String), }, id: 'BootstrapVersion', @@ -54,7 +54,7 @@ describe('tree metadata', () => { }, CheckBootstrapVersion: { constructInfo: { - fqn: '@aws-cdk/core.CfnRule', + fqn: 'aws-cdk-lib.CfnRule', version: expect.any(String), }, id: 'CheckBootstrapVersion', diff --git a/packages/@aws-cdk/core/test/private/unique-resource-name.test.ts b/packages/aws-cdk-lib/core/test/private/unique-resource-name.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/private/unique-resource-name.test.ts rename to packages/aws-cdk-lib/core/test/private/unique-resource-name.test.ts diff --git a/packages/aws-cdk-lib/core/test/resource.test.ts b/packages/aws-cdk-lib/core/test/resource.test.ts new file mode 100644 index 0000000000000..a57294fa9a425 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/resource.test.ts @@ -0,0 +1,1038 @@ +import * as cxapi from '../../cx-api'; +import { Construct } from 'constructs'; +import { toCloudFormation } from './util'; +import { + App, App as Root, CfnCondition, + CfnDeletionPolicy, CfnResource, + Fn, IResource, RemovalPolicy, Resource, Stack, +} from '../lib'; +import { synthesize } from '../lib/private/synthesis'; + +describe('resource', () => { + test('all resources derive from Resource, which derives from Entity', () => { + const stack = new Stack(); + + new CfnResource(stack, 'MyResource', { + type: 'MyResourceType', + properties: { + Prop1: 'p1', Prop2: 123, + }, + }); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + MyResource: { + Type: 'MyResourceType', + Properties: { + Prop1: 'p1', + Prop2: 123, + }, + }, + }, + }); + }); + + test('resources must reside within a Stack and fail upon creation if not', () => { + const root = new Root(); + expect(() => new CfnResource(root, 'R1', { type: 'ResourceType' })).toThrow(); + }); + + test('all entities have a logical ID calculated based on their full path in the tree', () => { + const stack = new Stack(undefined, 'TestStack'); + const level1 = new Construct(stack, 'level1'); + const level2 = new Construct(level1, 'level2'); + const level3 = new Construct(level2, 'level3'); + const res1 = new CfnResource(level1, 'childoflevel1', { type: 'MyResourceType1' }); + const res2 = new CfnResource(level3, 'childoflevel3', { type: 'MyResourceType2' }); + + expect(withoutHash(stack.resolve(res1.logicalId))).toEqual('level1childoflevel1'); + expect(withoutHash(stack.resolve(res2.logicalId))).toEqual('level1level2level3childoflevel3'); + }); + + test('resource.props can only be accessed by derived classes', () => { + const stack = new Stack(); + const res = new Counter(stack, 'MyResource', { Count: 10 }); + res.increment(); + res.increment(2); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + MyResource: { Type: 'My::Counter', Properties: { Count: 13 } }, + }, + }); + }); + + test('resource attributes can be retrieved using getAtt(s) or attribute properties', () => { + const stack = new Stack(); + const res = new Counter(stack, 'MyResource', { Count: 10 }); + + new CfnResource(stack, 'YourResource', { + type: 'Type', + properties: { + CounterName: res.getAtt('Name'), + CounterArn: res.arn, + CounterURL: res.url, + }, + }); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + MyResource: { Type: 'My::Counter', Properties: { Count: 10 } }, + YourResource: { + Type: 'Type', + Properties: { + CounterName: { 'Fn::GetAtt': ['MyResource', 'Name'] }, + CounterArn: { 'Fn::GetAtt': ['MyResource', 'Arn'] }, + CounterURL: { 'Fn::GetAtt': ['MyResource', 'URL'] }, + }, + }, + }, + }); + }); + + test('ARN-type resource attributes have some common functionality', () => { + const stack = new Stack(); + const res = new Counter(stack, 'MyResource', { Count: 1 }); + new CfnResource(stack, 'MyResource2', { + type: 'Type', + properties: { + Perm: res.arn, + }, + }); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + MyResource: { Type: 'My::Counter', Properties: { Count: 1 } }, + MyResource2: { + Type: 'Type', + Properties: { + Perm: { + 'Fn::GetAtt': ['MyResource', 'Arn'], + }, + }, + }, + }, + }); + }); + + test('resource.addDependency(e) can be used to add a DependsOn on another resource', () => { + const stack = new Stack(); + const r1 = new Counter(stack, 'Counter1', { Count: 1 }); + const r2 = new Counter(stack, 'Counter2', { Count: 1 }); + const r3 = new CfnResource(stack, 'Resource3', { type: 'MyResourceType' }); + r2.node.addDependency(r1); + r2.node.addDependency(r3); + + synthesize(stack); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Counter1: { + Type: 'My::Counter', + Properties: { Count: 1 }, + }, + Counter2: { + Type: 'My::Counter', + Properties: { Count: 1 }, + DependsOn: [ + 'Counter1', + 'Resource3', + ], + }, + Resource3: { Type: 'MyResourceType' }, + }, + }); + }); + + test('if addDependency is called multiple times with the same resource, it will only appear once', () => { + // GIVEN + const stack = new Stack(); + const r1 = new Counter(stack, 'Counter1', { Count: 1 }); + const dependent = new CfnResource(stack, 'Dependent', { type: 'R' }); + + // WHEN + dependent.addDependency(r1); + dependent.addDependency(r1); + dependent.addDependency(r1); + dependent.addDependency(r1); + dependent.addDependency(r1); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Counter1: { + Type: 'My::Counter', + Properties: { + Count: 1, + }, + }, + Dependent: { + Type: 'R', + DependsOn: [ + 'Counter1', + ], + }, + }, + }); + }); + + test('conditions can be attached to a resource', () => { + const stack = new Stack(); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); + const cond = new CfnCondition(stack, 'MyCondition', { expression: Fn.conditionNot(Fn.conditionEquals('a', 'b')) }); + r1.cfnOptions.condition = cond; + + expect(toCloudFormation(stack)).toEqual({ + Resources: { Resource: { Type: 'Type', Condition: 'MyCondition' } }, + Conditions: { MyCondition: { 'Fn::Not': [{ 'Fn::Equals': ['a', 'b'] }] } }, + }); + }); + + test('creation/update/updateReplace/deletion policies can be set on a resource', () => { + const stack = new Stack(); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); + + r1.cfnOptions.creationPolicy = { + autoScalingCreationPolicy: { minSuccessfulInstancesPercent: 10 }, + startFleet: true, + }; + // eslint-disable-next-line max-len + r1.cfnOptions.updatePolicy = { + autoScalingScheduledAction: { ignoreUnmodifiedGroupSizeProperties: false }, + autoScalingReplacingUpdate: { willReplace: true }, + codeDeployLambdaAliasUpdate: { + applicationName: 'CodeDeployApplication', + deploymentGroupName: 'CodeDeployDeploymentGroup', + beforeAllowTrafficHook: 'lambda1', + }, + }; + r1.cfnOptions.deletionPolicy = CfnDeletionPolicy.RETAIN; + r1.cfnOptions.updateReplacePolicy = CfnDeletionPolicy.SNAPSHOT; + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Resource: { + Type: 'Type', + CreationPolicy: { + AutoScalingCreationPolicy: { MinSuccessfulInstancesPercent: 10 }, + StartFleet: true, + }, + UpdatePolicy: { + AutoScalingScheduledAction: { IgnoreUnmodifiedGroupSizeProperties: false }, + AutoScalingReplacingUpdate: { WillReplace: true }, + CodeDeployLambdaAliasUpdate: { + ApplicationName: 'CodeDeployApplication', + DeploymentGroupName: 'CodeDeployDeploymentGroup', + BeforeAllowTrafficHook: 'lambda1', + }, + }, + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Snapshot', + }, + }, + }); + }); + + test('update policies UseOnlineResharding flag', () => { + const stack = new Stack(); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); + + r1.cfnOptions.updatePolicy = { useOnlineResharding: true }; + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Resource: { + Type: 'Type', + UpdatePolicy: { + UseOnlineResharding: true, + }, + }, + }, + }); + }); + + test('metadata can be set on a resource', () => { + const stack = new Stack(); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); + + r1.cfnOptions.metadata = { + MyKey: 10, + MyValue: 99, + }; + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Resource: { + Type: 'Type', + Metadata: { + MyKey: 10, + MyValue: 99, + }, + }, + }, + }); + }); + + test('the "type" property is required when creating a resource', () => { + const stack = new Stack(); + expect(() => new CfnResource(stack, 'Resource', { notypehere: true } as any)).toThrow(); + }); + + test('removal policy is a high level abstraction of deletion policy used by l2', () => { + const stack = new Stack(); + + const retain = new CfnResource(stack, 'Retain', { type: 'T1' }); + const destroy = new CfnResource(stack, 'Destroy', { type: 'T3' }); + const def = new CfnResource(stack, 'Default1', { type: 'T4' }); + const def2 = new CfnResource(stack, 'Default2', { type: 'T4' }); + + retain.applyRemovalPolicy(RemovalPolicy.RETAIN); + destroy.applyRemovalPolicy(RemovalPolicy.DESTROY); + def.applyRemovalPolicy(undefined, { default: RemovalPolicy.DESTROY }); + def2.applyRemovalPolicy(undefined); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Retain: { Type: 'T1', DeletionPolicy: 'Retain', UpdateReplacePolicy: 'Retain' }, + Destroy: { Type: 'T3', DeletionPolicy: 'Delete', UpdateReplacePolicy: 'Delete' }, + Default1: { Type: 'T4', DeletionPolicy: 'Delete', UpdateReplacePolicy: 'Delete' }, // explicit default + Default2: { Type: 'T4', DeletionPolicy: 'Retain', UpdateReplacePolicy: 'Retain' }, // implicit default + }, + }); + }); + + test('applyRemovalPolicy available for interface resources', () => { + class Child extends Resource { + constructor(scope: Construct, id: string) { + super(scope, id); + + new CfnResource(this, 'Resource', { + type: 'ChildResourceType', + }); + } + } + + const stack = new Stack(); + const child: IResource = new Child(stack, 'Child'); + + child.applyRemovalPolicy(RemovalPolicy.RETAIN); + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + ChildDAB30558: { + DeletionPolicy: 'Retain', + Type: 'ChildResourceType', + UpdateReplacePolicy: 'Retain', + }, + }, + }); + }); + + test('addDependency adds all dependencyElements of dependent constructs', () => { + + class C1 extends Construct { + public readonly r1: CfnResource; + public readonly r2: CfnResource; + + constructor(scope: Construct, id: string) { + super(scope, id); + + this.r1 = new CfnResource(this, 'R1', { type: 'T1' }); + this.r2 = new CfnResource(this, 'R2', { type: 'T2' }); + } + } + + class C2 extends Construct { + public readonly r3: CfnResource; + + constructor(scope: Construct, id: string) { + super(scope, id); + + this.r3 = new CfnResource(this, 'R3', { type: 'T3' }); + } + } + + // C3 returns [ c2 ] for it's dependency elements + // this should result in 'flattening' the list of elements. + class C3 extends Construct { + constructor(scope: Construct, id: string) { + super(scope, id); + + new C2(this, 'C2'); + } + } + + const stack = new Stack(); + const c1 = new C1(stack, 'MyC1'); + const c2 = new C2(stack, 'MyC2'); + const c3 = new C3(stack, 'MyC3'); + + const dependingResource = new CfnResource(stack, 'MyResource', { type: 'R' }); + dependingResource.node.addDependency(c1, c2); + dependingResource.node.addDependency(c3); + + synthesize(stack); + + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyC1R1FB2A562F: { Type: 'T1' }, + MyC1R2AE2B5066: { Type: 'T2' }, + MyC2R3809EEAD6: { Type: 'T3' }, + MyC3C2R38CE6F9F7: { Type: 'T3' }, + MyResource: + { + Type: 'R', + DependsOn: + ['MyC1R1FB2A562F', + 'MyC1R2AE2B5066', + 'MyC2R3809EEAD6', + 'MyC3C2R38CE6F9F7'], + }, + }, + }); + }); + + test('resource.ref returns the {Ref} token', () => { + const stack = new Stack(); + const r = new CfnResource(stack, 'MyResource', { type: 'R' }); + + expect(stack.resolve(r.ref)).toEqual({ Ref: 'MyResource' }); + }); + + describe('overrides', () => { + test('addOverride(p, v) allows assigning arbitrary values to synthesized resource definitions', () => { + // GIVEN + const stack = new Stack(); + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); + + // WHEN + r.addOverride('Type', 'YouCanEvenOverrideTheType'); + r.addOverride('Metadata', { Key: 12 }); + r.addOverride('Use.Dot.Notation', 'To create subtrees'); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'YouCanEvenOverrideTheType', + Use: { Dot: { Notation: 'To create subtrees' } }, + Metadata: { Key: 12 }, + }, + }, + }); + }); + + test('addPropertyOverride() allows assigning an attribute of a different resource', () => { + // GIVEN + const stack = new Stack(); + const r1 = new CfnResource(stack, 'MyResource1', { type: 'AWS::Resource::Type' }); + const r2 = new CfnResource(stack, 'MyResource2', { type: 'AWS::Resource::Type' }); + + // WHEN + r2.addPropertyOverride('A', { + B: r1.getAtt('Arn'), + }); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: { + MyResource1: { + Type: 'AWS::Resource::Type', + }, + MyResource2: { + Type: 'AWS::Resource::Type', + Properties: { + A: { + B: { 'Fn::GetAtt': ['MyResource1', 'Arn'] }, + }, + }, + }, + }, + }); + }); + + test('addOverride(p, null) will assign an "null" value', () => { + // GIVEN + const stack = new Stack(); + + const r = new CfnResource(stack, 'MyResource', { + type: 'AWS::Resource::Type', + properties: { + Hello: { + World: { + Value1: 'Hello', + Value2: 129, + }, + }, + }, + }); + + // WHEN + r.addOverride('Properties.Hello.World.Value2', null); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: { Hello: { World: { Value1: 'Hello', Value2: null } } }, + }, + }, + }); + }); + + test('addOverride(p, undefined) can be used to delete a value', () => { + // GIVEN + const stack = new Stack(); + + const r = new CfnResource(stack, 'MyResource', { + type: 'AWS::Resource::Type', + properties: { + Hello: { + World: { + Value1: 'Hello', + Value2: 129, + }, + }, + }, + }); + + // WHEN + r.addOverride('Properties.Hello.World.Value2', undefined); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: { Hello: { World: { Value1: 'Hello' } } }, + }, + }, + }); + }); + + test('addOverride(p, undefined) will not create empty trees', () => { + // GIVEN + const stack = new Stack(); + + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); + + // WHEN + r.addPropertyOverride('Tree.Exists', 42); + r.addPropertyOverride('Tree.Does.Not.Exist', undefined); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: { Tree: { Exists: 42 } }, + }, + }, + }); + }); + + test('addDeletionOverride(p) and addPropertyDeletionOverride(pp) are sugar for `undefined`', () => { + // GIVEN + const stack = new Stack(); + + const r = new CfnResource(stack, 'MyResource', { + type: 'AWS::Resource::Type', + properties: { + Hello: { + World: { + Value1: 'Hello', + Value2: 129, + Value3: ['foo', 'bar'], + }, + }, + }, + }); + + // WHEN + r.addDeletionOverride('Properties.Hello.World.Value2'); + r.addPropertyDeletionOverride('Hello.World.Value3'); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: { Hello: { World: { Value1: 'Hello' } } }, + }, + }, + }); + }); + + test('addOverride(p, v) will overwrite any non-objects along the path', () => { + // GIVEN + const stack = new Stack(); + const r = new CfnResource(stack, 'MyResource', { + type: 'AWS::Resource::Type', + properties: { + Hello: { + World: 42, + }, + }, + }); + + // WHEN + r.addOverride('Properties.Override1', ['Hello', 123]); + r.addOverride('Properties.Override1.Override2', { Heyy: [1] }); + r.addOverride('Properties.Hello.World.Foo.Bar', 42); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: + { + Hello: { World: { Foo: { Bar: 42 } } }, + Override1: { + Override2: { Heyy: [1] }, + }, + }, + }, + }, + }); + }); + + test('addOverride(p, v) will not split on escaped dots', () => { + // GIVEN + const stack = new Stack(); + const r = new CfnResource(stack, 'MyResource', { type: 'AWS::Resource::Type' }); + + // WHEN + r.addOverride(String.raw`Properties.Hello\.World.Foo\.Bar\.Baz`, 42); + r.addOverride(String.raw`Properties.Single\Back\Slashes`, 42); + r.addOverride(String.raw`Properties.Escaped\\.Back\\.Slashes`, 42); + r.addOverride(String.raw`Properties.DoublyEscaped\\\\Back\\\\Slashes`, 42); + r.addOverride('Properties.EndWith\\', 42); // Raw string cannot end with a backslash + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: + { + 'Hello.World': { 'Foo.Bar.Baz': 42 }, + 'SingleBackSlashes': 42, + 'Escaped\\': { 'Back\\': { Slashes: 42 } }, + 'DoublyEscaped\\\\Back\\\\Slashes': 42, + 'EndWith\\': 42, + }, + }, + }, + }); + }); + + test('addPropertyOverride(pp, v) is a sugar for overriding properties', () => { + // GIVEN + const stack = new Stack(); + const r = new CfnResource(stack, 'MyResource', { + type: 'AWS::Resource::Type', + properties: { Hello: { World: 42 } }, + }); + + // WHEN + r.addPropertyOverride('Hello.World', { Hey: 'Jude' }); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'AWS::Resource::Type', + Properties: { Hello: { World: { Hey: 'Jude' } } }, + }, + }, + }); + }); + + test('overrides are applied after render', () => { + // GIVEN + class MyResource extends CfnResource { + public renderProperties() { + return { Fixed: 123 }; + } + } + const stack = new Stack(); + const cfn = new MyResource(stack, 'rr', { type: 'AWS::Resource::Type' }); + + // WHEN + cfn.addPropertyOverride('Boom', 'Hi'); + cfn.addOverride('Properties.Foo.Bar', 'Bar'); + + // THEN + expect(toCloudFormation(stack)).toEqual({ + Resources: { + rr: { + Type: 'AWS::Resource::Type', + Properties: { + Fixed: 123, + Boom: 'Hi', + Foo: { + Bar: 'Bar', + }, + }, + }, + }, + }); + }); + + test('overrides allow overriding one intrinsic with another', () => { + // GIVEN + const stack = new Stack(); + + const resource = new CfnResource(stack, 'MyResource', { + type: 'MyResourceType', + properties: { + prop1: Fn.ref('Param'), + }, + }); + + // WHEN + resource.addPropertyOverride('prop1', Fn.join('-', ['hello', Fn.ref('Param')])); + const cfn = toCloudFormation(stack); + + // THEN + expect(cfn.Resources.MyResource).toEqual({ + Type: 'MyResourceType', + Properties: { + prop1: { + 'Fn::Join': [ + '-', + [ + 'hello', + { + Ref: 'Param', + }, + ], + ], + }, + }, + }); + }); + + test('Can override a an object with an intrinsic', () => { + // GIVEN + const stack = new Stack(); + + const condition = new CfnCondition(stack, 'MyCondition', { + expression: Fn.conditionEquals('us-east-1', 'us-east-1'), + }); + const resource = new CfnResource(stack, 'MyResource', { + type: 'MyResourceType', + properties: { + prop1: { + subprop: { + name: Fn.getAtt('resource', 'abc'), + }, + }, + }, + }); + const isEnabled = Fn.conditionIf(condition.logicalId, { + Ref: 'AWS::NoValue', + }, { + name: Fn.getAtt('resource', 'abc'), + }); + + // WHEN + resource.addPropertyOverride('prop1.subprop', isEnabled); + const cfn = toCloudFormation(stack); + + // THEN + expect(cfn.Resources.MyResource).toEqual({ + Type: 'MyResourceType', + Properties: { + prop1: { + subprop: { + 'Fn::If': [ + 'MyCondition', + { + Ref: 'AWS::NoValue', + }, + { + name: { + 'Fn::GetAtt': [ + 'resource', + 'abc', + ], + }, + }, + ], + }, + }, + }, + }); + }); + + test('overrides allow overriding a nested intrinsic', () => { + // GIVEN + const stack = new Stack(); + + const resource = new CfnResource(stack, 'MyResource', { + type: 'MyResourceType', + properties: { + prop1: Fn.importValue(Fn.sub('${Sub}', { Sub: 'Value' })), + }, + }); + + // WHEN + resource.addPropertyOverride('prop1', Fn.importValue(Fn.join('-', ['abc', Fn.sub('${Sub}', { Sub: 'Value' })]))); + const cfn = toCloudFormation(stack); + + // THEN + expect(cfn.Resources.MyResource).toEqual({ + Type: 'MyResourceType', + Properties: { + prop1: { + 'Fn::ImportValue': { + 'Fn::Join': [ + '-', + [ + 'abc', + { + 'Fn::Sub': ['${Sub}', { Sub: 'Value' }], + }, + ], + ], + }, + }, + }, + }); + }); + + describe('using mutable properties', () => { + test('can be used by derived classes to specify overrides before render()', () => { + const stack = new Stack(); + + const r = new CustomizableResource(stack, 'MyResource', { + prop1: 'foo', + }); + + r.prop2 = 'bar'; + + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'MyResourceType', + Properties: { PROP1: 'foo', PROP2: 'bar' }, + }, + }, + }); + }); + + test('"properties" is undefined', () => { + const stack = new Stack(); + + const r = new CustomizableResource(stack, 'MyResource'); + + r.prop3 = 'zoo'; + + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'MyResourceType', + Properties: { PROP3: 'zoo' }, + }, + }, + }); + }); + + test('"properties" is empty', () => { + const stack = new Stack(); + + const r = new CustomizableResource(stack, 'MyResource', { }); + + r.prop3 = 'zoo'; + r.prop2 = 'hey'; + + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + MyResource: + { + Type: 'MyResourceType', + Properties: { PROP2: 'hey', PROP3: 'zoo' }, + }, + }, + }); + }); + }); + }); + + test('"aws:cdk:path" metadata is added if "aws:cdk:path-metadata" context is set to true', () => { + const stack = new Stack(); + stack.node.setContext(cxapi.PATH_METADATA_ENABLE_CONTEXT, true); + + const parent = new Construct(stack, 'Parent'); + + new CfnResource(parent, 'MyResource', { + type: 'MyResourceType', + }); + + expect(toCloudFormation(stack)).toEqual({ + Resources: + { + ParentMyResource4B1FDBCC: + { + Type: 'MyResourceType', + Metadata: { [cxapi.PATH_METADATA_KEY]: 'Default/Parent/MyResource' }, + }, + }, + }); + }); + + test('cross-stack construct dependencies are not rendered but turned into stack dependencies', () => { + // GIVEN + const app = new App(); + const stackA = new Stack(app, 'StackA'); + const resA = new CfnResource(stackA, 'Resource', { type: 'R' }); + const stackB = new Stack(app, 'StackB'); + const resB = new CfnResource(stackB, 'Resource', { type: 'R' }); + + // WHEN + resB.node.addDependency(resA); + + // THEN + const assembly = app.synth(); + const templateB = assembly.getStackByName(stackB.stackName).template; + + expect(templateB?.Resources?.Resource).toEqual({ + Type: 'R', + // Notice absence of 'DependsOn' + }); + expect(stackB.dependencies.map(s => s.node.id)).toEqual(['StackA']); + }); + + test('enableVersionUpgrade can be set on a resource', () => { + const stack = new Stack(); + const r1 = new CfnResource(stack, 'Resource', { type: 'Type' }); + + r1.cfnOptions.updatePolicy = { + enableVersionUpgrade: true, + }; + + expect(toCloudFormation(stack)).toEqual({ + Resources: { + Resource: { + Type: 'Type', + UpdatePolicy: { + EnableVersionUpgrade: true, + }, + }, + }, + }); + }); +}); + +test('Resource can get account and Region from ARN', () => { + const stack = new Stack(); + + // WHEN + const resource = new TestResource(stack, 'Resource', { + environmentFromArn: 'arn:partition:service:region:account:relative-id', + }); + + // THEN + expect(resource.env.account).toEqual('account'); + expect(resource.env.region).toEqual('region'); +}); + +interface CounterProps { + Count: number; +} + +class Counter extends CfnResource { + public readonly arn: string; + public readonly url: string; + + public count: number; + + constructor(scope: Construct, id: string, props: CounterProps) { + super(scope, id, { type: 'My::Counter', properties: { Count: props.Count } }); + this.arn = this.getAtt('Arn').toString(); + this.url = this.getAtt('URL').toString(); + this.count = props.Count; + } + + public increment(by = 1) { + this.count += by; + } + + protected get cfnProperties(): { [key: string]: any } { + return { Count: this.count }; + } +} + +function withoutHash(logId: string) { + return logId.slice(0, -8); +} + +class CustomizableResource extends CfnResource { + public prop1: any; + public prop2: any; + public prop3: any; + + constructor(scope: Construct, id: string, props?: any) { + super(scope, id, { type: 'MyResourceType', properties: props }); + if (props !== undefined) { + this.prop1 = props.prop1; + this.prop2 = props.prop2; + this.prop3 = props.prop3; + } + } + + public renderProperties(): { [key: string]: any } { + const props = this.updatedProperties; + const render: { [key: string]: any } = {}; + for (const key of Object.keys(props)) { + render[key.toUpperCase()] = props[key]; + } + return render; + } + + protected get updatedProperties(): { [key: string]: any } { + const props: { [key: string]: any } = { + prop1: this.prop1, + prop2: this.prop2, + prop3: this.prop3, + }; + const cleanProps: { [key: string]: any } = { }; + for (const key of Object.keys(props)) { + if (props[key] === undefined) { + continue; + } + cleanProps[key] = props[key]; + } + return cleanProps; + } +} + +/** + * Because Resource is abstract + */ +class TestResource extends Resource {} diff --git a/packages/@aws-cdk/core/test/rule.test.ts b/packages/aws-cdk-lib/core/test/rule.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/rule.test.ts rename to packages/aws-cdk-lib/core/test/rule.test.ts diff --git a/packages/@aws-cdk/core/test/runtime-info.test.ts b/packages/aws-cdk-lib/core/test/runtime-info.test.ts similarity index 98% rename from packages/@aws-cdk/core/test/runtime-info.test.ts rename to packages/aws-cdk-lib/core/test/runtime-info.test.ts index 9979b4ef0cf22..7a26a4328c51c 100644 --- a/packages/@aws-cdk/core/test/runtime-info.test.ts +++ b/packages/aws-cdk-lib/core/test/runtime-info.test.ts @@ -38,7 +38,7 @@ describeTscSafe('constructInfoFromConstruct', () => { test('returns fqn and version for core constructs', () => { const constructInfo = constructInfoFromConstruct(stack); expect(constructInfo).toBeDefined(); - expect(constructInfo?.fqn).toEqual('@aws-cdk/core.Stack'); + expect(constructInfo?.fqn).toEqual('aws-cdk-lib.Stack'); expect(constructInfo?.version).toEqual(localCdkVersion()); }); @@ -78,7 +78,7 @@ describeTscSafe('constructInfoForStack', () => { const stackInfo = constructInfos.find(i => /Stack/.test(i.fqn)); const jsiiInfo = constructInfos.find(i => i.fqn === 'jsii-runtime.Runtime'); - expect(stackInfo?.fqn).toEqual('@aws-cdk/core.Stack'); + expect(stackInfo?.fqn).toEqual('aws-cdk-lib.Stack'); expect(stackInfo?.version).toEqual(localCdkVersion()); expect(jsiiInfo?.version).toMatch(/node.js/); }); diff --git a/packages/@aws-cdk/core/test/secret-value.test.ts b/packages/aws-cdk-lib/core/test/secret-value.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/secret-value.test.ts rename to packages/aws-cdk-lib/core/test/secret-value.test.ts diff --git a/packages/@aws-cdk/core/test/size.test.ts b/packages/aws-cdk-lib/core/test/size.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/size.test.ts rename to packages/aws-cdk-lib/core/test/size.test.ts diff --git a/packages/@aws-cdk/core/test/stack-synthesis/clicreds-synthesis.test.ts b/packages/aws-cdk-lib/core/test/stack-synthesis/clicreds-synthesis.test.ts similarity index 98% rename from packages/@aws-cdk/core/test/stack-synthesis/clicreds-synthesis.test.ts rename to packages/aws-cdk-lib/core/test/stack-synthesis/clicreds-synthesis.test.ts index 84229aa34e7fd..32b79089443a7 100644 --- a/packages/@aws-cdk/core/test/stack-synthesis/clicreds-synthesis.test.ts +++ b/packages/aws-cdk-lib/core/test/stack-synthesis/clicreds-synthesis.test.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../../cloud-assembly-schema'; +import * as cxapi from '../../../cx-api'; import { App, Aws, CfnResource, CliCredentialsStackSynthesizer, FileAssetPackaging, Stack } from '../../lib'; import { evaluateCFN } from '../evaluate-cfn'; diff --git a/packages/@aws-cdk/core/test/stack-synthesis/new-style-synthesis.test.ts b/packages/aws-cdk-lib/core/test/stack-synthesis/new-style-synthesis.test.ts similarity index 98% rename from packages/@aws-cdk/core/test/stack-synthesis/new-style-synthesis.test.ts rename to packages/aws-cdk-lib/core/test/stack-synthesis/new-style-synthesis.test.ts index 7d8ffbc2635ea..b36f96b5897ee 100644 --- a/packages/@aws-cdk/core/test/stack-synthesis/new-style-synthesis.test.ts +++ b/packages/aws-cdk-lib/core/test/stack-synthesis/new-style-synthesis.test.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import { ArtifactType } from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { ArtifactType } from '../../../cloud-assembly-schema'; +import * as cxapi from '../../../cx-api'; import { App, Aws, CfnResource, ContextProvider, DefaultStackSynthesizer, FileAssetPackaging, Stack } from '../../lib'; import { ISynthesisSession } from '../../lib/stack-synthesizers/types'; import { evaluateCFN } from '../evaluate-cfn'; diff --git a/packages/@aws-cdk/core/test/stack-synthesis/old-style-synthesis.test.ts b/packages/aws-cdk-lib/core/test/stack-synthesis/old-style-synthesis.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/stack-synthesis/old-style-synthesis.test.ts rename to packages/aws-cdk-lib/core/test/stack-synthesis/old-style-synthesis.test.ts diff --git a/packages/@aws-cdk/core/test/stack.test.ts b/packages/aws-cdk-lib/core/test/stack.test.ts similarity index 99% rename from packages/@aws-cdk/core/test/stack.test.ts rename to packages/aws-cdk-lib/core/test/stack.test.ts index 3b37086b6c796..71097ab0c9584 100644 --- a/packages/@aws-cdk/core/test/stack.test.ts +++ b/packages/aws-cdk-lib/core/test/stack.test.ts @@ -1,6 +1,6 @@ import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cxapi from '@aws-cdk/cx-api'; -import { Fact, RegionInfo } from '@aws-cdk/region-info'; +import * as cxapi from '../../cx-api'; +import { Fact, RegionInfo } from '../../region-info'; import { Construct, Node } from 'constructs'; import { toCloudFormation } from './util'; import { diff --git a/packages/aws-cdk-lib/core/test/stage.test.ts b/packages/aws-cdk-lib/core/test/stage.test.ts new file mode 100644 index 0000000000000..80b471140a6d3 --- /dev/null +++ b/packages/aws-cdk-lib/core/test/stage.test.ts @@ -0,0 +1,332 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; +import { Construct, IConstruct } from 'constructs'; +import { App, CfnResource, IAspect, Stack, Stage, Aspects } from '../lib'; + +describe('stage', () => { + test('Stack inherits unspecified part of the env from Stage', () => { + // GIVEN + const app = new App(); + const stage = new Stage(app, 'Stage', { + env: { account: 'account', region: 'region' }, + }); + + // WHEN + const stack1 = new Stack(stage, 'Stack1', { env: { region: 'elsewhere' } }); + const stack2 = new Stack(stage, 'Stack2', { env: { account: 'tnuocca' } }); + + // THEN + expect(acctRegion(stack1)).toEqual(['account', 'elsewhere']); + expect(acctRegion(stack2)).toEqual(['tnuocca', 'region']); + }); + + test('envs are inherited deeply', () => { + // GIVEN + const app = new App(); + const outer = new Stage(app, 'Stage', { + env: { account: 'account', region: 'region' }, + }); + + // WHEN + const innerAcct = new Stage(outer, 'Acct', { env: { account: 'tnuocca' } }); + const innerRegion = new Stage(outer, 'Rgn', { env: { region: 'elsewhere' } }); + const innerNeither = new Stage(outer, 'Neither'); + + // THEN + expect(acctRegion(new Stack(innerAcct, 'Stack'))).toEqual(['tnuocca', 'region']); + expect(acctRegion(new Stack(innerRegion, 'Stack'))).toEqual(['account', 'elsewhere']); + expect(acctRegion(new Stack(innerNeither, 'Stack'))).toEqual(['account', 'region']); + }); + + test('The Stage Assembly is in the app Assembly\'s manifest', () => { + // WHEN + const app = new App(); + const stage = new Stage(app, 'Stage'); + new BogusStack(stage, 'Stack2'); + + // THEN -- app manifest contains a nested cloud assembly + const appAsm = app.synth(); + + const artifact = appAsm.artifacts.find(x => x instanceof cxapi.NestedCloudAssemblyArtifact); + expect(artifact).toBeDefined(); + }); + + test('Stacks in Stage are in a different cxasm than Stacks in App', () => { + // WHEN + const app = new App(); + const stack1 = new BogusStack(app, 'Stack1'); + const stage = new Stage(app, 'Stage'); + const stack2 = new BogusStack(stage, 'Stack2'); + + // THEN + const stageAsm = stage.synth(); + expect(stageAsm.stacks.map(s => s.stackName)).toEqual([stack2.stackName]); + + const appAsm = app.synth(); + expect(appAsm.stacks.map(s => s.stackName)).toEqual([stack1.stackName]); + }); + + test('Can nest Stages inside other Stages', () => { + // WHEN + const app = new App(); + const outer = new Stage(app, 'Outer'); + const inner = new Stage(outer, 'Inner'); + const stack = new BogusStack(inner, 'Stack'); + + // WHEN + const appAsm = app.synth(); + const outerAsm = appAsm.getNestedAssembly(outer.artifactId); + const innerAsm = outerAsm.getNestedAssembly(inner.artifactId); + + expect(innerAsm.tryGetArtifact(stack.artifactId)).toBeDefined(); + }); + + test('Default stack name in Stage objects incorporates the Stage name and no hash', () => { + // WHEN + const app = new App(); + const stage = new Stage(app, 'MyStage'); + const stack = new BogusStack(stage, 'MyStack'); + + // THEN + expect(stage.stageName).toEqual('MyStage'); + expect(stack.stackName).toEqual('MyStage-MyStack'); + }); + + test('can override the stage name', () => { + // WHEN + const app = new App(); + const stage = new Stage(app, 'NotMyStageName', { stageName: 'MyStage' }); + const stack = new BogusStack(stage, 'MyStack'); + + // THEN + expect(stage.stageName).toEqual('MyStage'); + expect(stack.stackName).toEqual('MyStage-MyStack'); + }); + + test('Can not have dependencies to stacks outside the nested asm', () => { + // GIVEN + const app = new App(); + const stack1 = new BogusStack(app, 'Stack1'); + const stage = new Stage(app, 'MyStage'); + const stack2 = new BogusStack(stage, 'Stack2'); + + // WHEN + expect(() => { + stack2.addDependency(stack1); + }).toThrow(/dependency cannot cross stage boundaries/); + }); + + test('When we synth() a stage, aspects inside it must have been applied', () => { + // GIVEN + const app = new App(); + const stage = new Stage(app, 'MyStage'); + const stack = new BogusStack(stage, 'Stack'); + + // WHEN + const aspect = new TouchingAspect(); + Aspects.of(stack).add(aspect); + + // THEN + app.synth(); + expect(aspect.visits.map(c => c.node.path)).toEqual([ + 'MyStage/Stack', + 'MyStage/Stack/Resource', + ]); + }); + + test('Aspects do not apply inside a Stage', () => { + // GIVEN + const app = new App(); + const stage = new Stage(app, 'MyStage'); + new BogusStack(stage, 'Stack'); + + // WHEN + const aspect = new TouchingAspect(); + Aspects.of(app).add(aspect); + + // THEN + app.synth(); + expect(aspect.visits.map(c => c.node.path)).toEqual([ + '', + 'Tree', + ]); + }); + + test('Automatic dependencies inside a stage are available immediately after synth', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stage = new Stage(app, 'MyStage'); + const stack1 = new Stack(stage, 'Stack1'); + const stack2 = new Stack(stage, 'Stack2'); + + // WHEN + const resource1 = new CfnResource(stack1, 'Resource', { + type: 'CDK::Test::Resource', + }); + new CfnResource(stack2, 'Resource', { + type: 'CDK::Test::Resource', + properties: { + OtherThing: resource1.ref, + }, + }); + + const asm = stage.synth(); + + // THEN + expect( + asm.getStackArtifact(stack2.artifactId).dependencies.map(d => d.id)).toEqual( + [stack1.artifactId]); + }); + + test('Assemblies can be deeply nested', () => { + // GIVEN + const app = new App({ treeMetadata: false }); + + const level1 = new Stage(app, 'StageLevel1'); + const level2 = new Stage(level1, 'StageLevel2'); + new Stage(level2, 'StageLevel3'); + + // WHEN + const rootAssembly = app.synth(); + + // THEN + expect(rootAssembly.manifest.artifacts).toEqual({ + 'assembly-StageLevel1': { + type: 'cdk:cloud-assembly', + properties: { + directoryName: 'assembly-StageLevel1', + displayName: 'StageLevel1', + }, + }, + }); + + const assemblyLevel1 = rootAssembly.getNestedAssembly('assembly-StageLevel1'); + expect(assemblyLevel1.manifest.artifacts).toEqual({ + 'assembly-StageLevel1-StageLevel2': { + type: 'cdk:cloud-assembly', + properties: { + directoryName: 'assembly-StageLevel1-StageLevel2', + displayName: 'StageLevel1/StageLevel2', + }, + }, + }); + + const assemblyLevel2 = assemblyLevel1.getNestedAssembly('assembly-StageLevel1-StageLevel2'); + expect(assemblyLevel2.manifest.artifacts).toEqual({ + 'assembly-StageLevel1-StageLevel2-StageLevel3': { + type: 'cdk:cloud-assembly', + properties: { + directoryName: 'assembly-StageLevel1-StageLevel2-StageLevel3', + displayName: 'StageLevel1/StageLevel2/StageLevel3', + }, + }, + }); + }); + + test('stage name validation', () => { + const app = new App(); + + new Stage(app, 'abcd'); + new Stage(app, 'abcd123'); + new Stage(app, 'abcd123-588dfjjk'); + new Stage(app, 'abcd123-588dfjjk.sss'); + new Stage(app, 'abcd123-588dfjjk.sss_ajsid'); + + expect(() => new Stage(app, 'abcd123-588dfjjk.sss_ajsid ')).toThrow(/invalid stage name "abcd123-588dfjjk.sss_ajsid "/); + expect(() => new Stage(app, 'abcd123-588dfjjk.sss_ajsid/dfo')).toThrow(/invalid stage name "abcd123-588dfjjk.sss_ajsid\/dfo"/); + expect(() => new Stage(app, '&')).toThrow(/invalid stage name "&"/); + expect(() => new Stage(app, '45hello')).toThrow(/invalid stage name "45hello"/); + expect(() => new Stage(app, 'f')).toThrow(/invalid stage name "f"/); + }); + + test('outdir cannot be specified for nested stages', () => { + // WHEN + const app = new App(); + + // THEN + expect(() => new Stage(app, 'mystage', { outdir: '/tmp/foo/bar' })).toThrow(/"outdir" cannot be specified for nested stages/); + }); + + test('Stage.isStage indicates that a construct is a stage', () => { + // WHEN + const app = new App(); + const stack = new Stack(); + const stage = new Stage(app, 'Stage'); + + // THEN + expect(Stage.isStage(stage)).toEqual(true); + expect(Stage.isStage(app)).toEqual(true); + expect(Stage.isStage(stack)).toEqual(false); + }); + + test('Stage.isStage indicates that a construct is a stage based on symbol', () => { + // WHEN + const app = new App(); + const stage = new Stage(app, 'Stage'); + + const externalStage = {}; + const STAGE_SYMBOL = Symbol.for('@aws-cdk/core.Stage'); + Object.defineProperty(externalStage, STAGE_SYMBOL, { value: true }); + + // THEN + expect(Stage.isStage(stage)).toEqual(true); + expect(Stage.isStage(app)).toEqual(true); + expect(Stage.isStage(externalStage)).toEqual(true); + }); +}); + +test('missing context in Stages is propagated up to root assembly', () => { + // GIVEN + const app = new App(); + const stage = new Stage(app, 'Stage', { + env: { account: 'account', region: 'region' }, + }); + const stack = new Stack(stage, 'Stack'); + new CfnResource(stack, 'Resource', { type: 'Something' }); + + // WHEN + stack.reportMissingContextKey({ + key: 'missing-context-key', + provider: cxschema.ContextProvider.AVAILABILITY_ZONE_PROVIDER, + props: { + account: 'account', + region: 'region', + }, + }); + + // THEN + const assembly = app.synth(); + + expect(assembly.manifest.missing).toEqual([ + { + key: 'missing-context-key', + provider: cxschema.ContextProvider.AVAILABILITY_ZONE_PROVIDER, + props: { + account: 'account', + lookupRoleArn: 'arn:${AWS::Partition}:iam::account:role/cdk-hnb659fds-lookup-role-account-region', + region: 'region', + }, + }, + ]); +}); + +class TouchingAspect implements IAspect { + public readonly visits = new Array(); + public visit(node: IConstruct): void { + this.visits.push(node); + } +} + +class BogusStack extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + new CfnResource(this, 'Resource', { + type: 'CDK::Test::Resource', + }); + } +} + +function acctRegion(s: Stack) { + return [s.account, s.region]; +} diff --git a/packages/aws-cdk-lib/core/test/staging.test.ts b/packages/aws-cdk-lib/core/test/staging.test.ts new file mode 100644 index 0000000000000..818b016ffd81c --- /dev/null +++ b/packages/aws-cdk-lib/core/test/staging.test.ts @@ -0,0 +1,1348 @@ +import * as os from 'os'; +import * as path from 'path'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { FileAssetPackaging } from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; +import * as fs from 'fs-extra'; +import * as sinon from 'sinon'; +import { App, AssetHashType, AssetStaging, DockerImage, BundlingOptions, BundlingOutput, FileSystem, Stack, Stage, BundlingFileAccess } from '../lib'; + +const STUB_INPUT_FILE = '/tmp/docker-stub.input'; +const STUB_INPUT_CONCAT_FILE = '/tmp/docker-stub.input.concat'; + +const STUB_INPUT_CP_FILE = '/tmp/docker-stub-cp.input'; +const STUB_INPUT_CP_CONCAT_FILE = '/tmp/docker-stub-cp.input.concat'; + +enum DockerStubCommand { + SUCCESS = 'DOCKER_STUB_SUCCESS', + FAIL = 'DOCKER_STUB_FAIL', + SUCCESS_NO_OUTPUT = 'DOCKER_STUB_SUCCESS_NO_OUTPUT', + MULTIPLE_FILES = 'DOCKER_STUB_MULTIPLE_FILES', + SINGLE_ARCHIVE = 'DOCKER_STUB_SINGLE_ARCHIVE', + VOLUME_SINGLE_ARCHIVE = 'DOCKER_STUB_VOLUME_SINGLE_ARCHIVE', +} + +const FIXTURE_TEST1_DIR = path.join(__dirname, 'fs', 'fixtures', 'test1'); +const FIXTURE_TEST1_HASH = '2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00'; +const FIXTURE_TARBALL = path.join(__dirname, 'fs', 'fixtures.tar.gz'); +const NOT_ARCHIVED_ZIP_TXT_HASH = '95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df'; +const ARCHIVE_TARBALL_TEST_HASH = '3e948ff54a277d6001e2452fdbc4a9ef61f916ff662ba5e05ece1e2ec6dec9f5'; + +const userInfo = os.userInfo(); +const USER_ARG = `-u ${userInfo.uid}:${userInfo.gid}`; + + +describe('staging', () => { + beforeAll(() => { + // this is a way to provide a custom "docker" command for staging. + process.env.CDK_DOCKER = `${__dirname}/docker-stub.sh`; + }); + + afterAll(() => { + delete process.env.CDK_DOCKER; + }); + + afterEach(() => { + AssetStaging.clearAssetHashCache(); + if (fs.existsSync(STUB_INPUT_FILE)) { + fs.unlinkSync(STUB_INPUT_FILE); + } + if (fs.existsSync(STUB_INPUT_CONCAT_FILE)) { + fs.unlinkSync(STUB_INPUT_CONCAT_FILE); + } + sinon.restore(); + }); + + test('base case', () => { + // GIVEN + const stack = new Stack(); + const sourcePath = FIXTURE_TEST1_DIR; + + // WHEN + const staging = new AssetStaging(stack, 's1', { sourcePath }); + + expect(staging.assetHash).toEqual(FIXTURE_TEST1_HASH); + expect(staging.sourcePath).toEqual(sourcePath); + expect(path.basename(staging.absoluteStagedPath)).toEqual(`asset.${FIXTURE_TEST1_HASH}`); + expect(path.basename(staging.relativeStagedPath(stack))).toEqual(`asset.${FIXTURE_TEST1_HASH}`); + expect(staging.packaging).toEqual(FileAssetPackaging.ZIP_DIRECTORY); + expect(staging.isArchive).toEqual(true); + }); + + test('base case if source directory is a symlink', () => { + // GIVEN + const stack = new Stack(); + const sourcePath = path.join(os.tmpdir(), 'asset-symlink'); + if (fs.existsSync(sourcePath)) { fs.unlinkSync(sourcePath); } + fs.symlinkSync(FIXTURE_TEST1_DIR, sourcePath); + + try { + const staging = new AssetStaging(stack, 's1', { sourcePath }); + + // Should be the same asset hash as in the previous test + expect(staging.assetHash).toEqual(FIXTURE_TEST1_HASH); + } finally { + if (fs.existsSync(sourcePath)) { + fs.unlinkSync(sourcePath); + } + } + }); + + test('staging of an archive file correctly sets packaging and isArchive', () => { + // GIVEN + const stack = new Stack(); + const sourcePath = path.join(__dirname, 'archive', 'archive.zip'); + + // WHEN + const staging = new AssetStaging(stack, 's1', { sourcePath }); + + expect(staging.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging.isArchive).toEqual(true); + }); + + test('staging of an archive with multiple extension name correctly sets packaging and isArchive', () => { + // GIVEN + const stack = new Stack(); + const sourcePathTarGz1 = path.join(__dirname, 'archive', 'artifact.tar.gz'); + const sourcePathTarGz2 = path.join(__dirname, 'archive', 'artifact.da.vinci.monalisa.tar.gz'); + const sourcePathTgz = path.join(__dirname, 'archive', 'artifact.tgz'); + const sourcePathTar = path.join(__dirname, 'archive', 'artifact.tar'); + const sourcePathNotArchive = path.join(__dirname, 'archive', 'artifact.zip.txt'); + const sourcePathDockerFile = path.join(__dirname, 'archive', 'DockerFile'); + + // WHEN + const stagingTarGz1 = new AssetStaging(stack, 's1', { sourcePath: sourcePathTarGz1 }); + const stagingTarGz2 = new AssetStaging(stack, 's2', { sourcePath: sourcePathTarGz2 }); + const stagingTgz = new AssetStaging(stack, 's3', { sourcePath: sourcePathTgz }); + const stagingTar = new AssetStaging(stack, 's4', { sourcePath: sourcePathTar }); + const stagingNotArchive = new AssetStaging(stack, 's5', { sourcePath: sourcePathNotArchive }); + const stagingDockerFile = new AssetStaging(stack, 's6', { sourcePath: sourcePathDockerFile }); + + expect(stagingTarGz1.packaging).toEqual(FileAssetPackaging.FILE); + expect(stagingTarGz1.isArchive).toEqual(true); + expect(stagingTarGz2.packaging).toEqual(FileAssetPackaging.FILE); + expect(path.basename(stagingTarGz2.absoluteStagedPath)).toEqual(`asset.${ARCHIVE_TARBALL_TEST_HASH}.tar.gz`); + expect(path.basename(stagingTarGz2.relativeStagedPath(stack))).toEqual(`asset.${ARCHIVE_TARBALL_TEST_HASH}.tar.gz`); + expect(stagingTarGz2.isArchive).toEqual(true); + expect(stagingTgz.packaging).toEqual(FileAssetPackaging.FILE); + expect(stagingTgz.isArchive).toEqual(true); + expect(stagingTar.packaging).toEqual(FileAssetPackaging.FILE); + expect(stagingTar.isArchive).toEqual(true); + expect(stagingNotArchive.packaging).toEqual(FileAssetPackaging.FILE); + expect(path.basename(stagingNotArchive.absoluteStagedPath)).toEqual(`asset.${NOT_ARCHIVED_ZIP_TXT_HASH}.txt`); + expect(path.basename(stagingNotArchive.relativeStagedPath(stack))).toEqual(`asset.${NOT_ARCHIVED_ZIP_TXT_HASH}.txt`); + expect(stagingNotArchive.isArchive).toEqual(false); + expect(stagingDockerFile.packaging).toEqual(FileAssetPackaging.FILE); + expect(stagingDockerFile.isArchive).toEqual(false); + + }); + + test('asset packaging type is correct when staging is skipped because of memory cache', () => { + // GIVEN + const stack = new Stack(); + const sourcePath = path.join(__dirname, 'archive', 'archive.zip'); + + // WHEN + const staging1 = new AssetStaging(stack, 's1', { sourcePath }); + const staging2 = new AssetStaging(stack, 's2', { sourcePath }); + + expect(staging1.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging1.isArchive).toEqual(true); + expect(staging2.packaging).toEqual(staging1.packaging); + expect(staging2.isArchive).toEqual(staging1.isArchive); + }); + + test('asset packaging type is correct when staging is skipped because of disk cache', () => { + // GIVEN + const TEST_OUTDIR = path.join(__dirname, 'cdk.out'); + if (fs.existsSync(TEST_OUTDIR)) { + fs.removeSync(TEST_OUTDIR); + } + + const sourcePath = path.join(__dirname, 'archive', 'archive.zip'); + + const app1 = new App({ outdir: TEST_OUTDIR }); + const stack1 = new Stack(app1, 'Stack'); + + const app2 = new App({ outdir: TEST_OUTDIR }); // same OUTDIR + const stack2 = new Stack(app2, 'stack'); + + // WHEN + const staging1 = new AssetStaging(stack1, 'Asset', { sourcePath }); + + // Now clear asset hash cache to show that during the second staging + // even though the asset is already available on disk it will correctly + // be considered as a FileAssetPackaging.FILE. + AssetStaging.clearAssetHashCache(); + + const staging2 = new AssetStaging(stack2, 'Asset', { sourcePath }); + + // THEN + expect(staging1.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging1.isArchive).toEqual(true); + expect(staging2.packaging).toEqual(staging1.packaging); + expect(staging2.isArchive).toEqual(staging1.isArchive); + }); + + test('staging of a non-archive file correctly sets packaging and isArchive', () => { + // GIVEN + const stack = new Stack(); + const sourcePath = __filename; + + // WHEN + const staging = new AssetStaging(stack, 's1', { sourcePath }); + + expect(staging.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging.isArchive).toEqual(false); + }); + + test('staging can be disabled through context', () => { + // GIVEN + const stack = new Stack(); + stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true); + const sourcePath = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const staging = new AssetStaging(stack, 's1', { sourcePath }); + + expect(staging.assetHash).toEqual(FIXTURE_TEST1_HASH); + expect(staging.sourcePath).toEqual(sourcePath); + expect(staging.absoluteStagedPath).toEqual(sourcePath); + expect(staging.relativeStagedPath(stack)).toEqual(sourcePath); + }); + + test('files are copied to the output directory during synth', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + + // WHEN + new AssetStaging(stack, 's1', { sourcePath: FIXTURE_TEST1_DIR }); + new AssetStaging(stack, 'file', { sourcePath: FIXTURE_TARBALL }); + + // THEN + const assembly = app.synth(); + expect(fs.readdirSync(assembly.directory)).toEqual([ + `asset.${FIXTURE_TEST1_HASH}`, + 'asset.af10ac04b3b607b0f8659c8f0cee8c343025ee75baf0b146f10f0e5311d2c46b.tar.gz', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + }); + + test('assets in nested assemblies get staged into assembly root directory', () => { + // GIVEN + const app = new App(); + const stack1 = new Stack(new Stage(app, 'Stage1'), 'Stack'); + const stack2 = new Stack(new Stage(app, 'Stage2'), 'Stack'); + + // WHEN + new AssetStaging(stack1, 's1', { sourcePath: FIXTURE_TEST1_DIR }); + new AssetStaging(stack2, 's1', { sourcePath: FIXTURE_TEST1_DIR }); + + // THEN + const assembly = app.synth(); + + // One asset directory at the top + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'assembly-Stage1', + 'assembly-Stage2', + `asset.${FIXTURE_TEST1_HASH}`, + 'cdk.out', + 'manifest.json', + 'tree.json', + ]); + }); + + test('allow specifying extra data to include in the source hash', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const withoutExtra = new AssetStaging(stack, 'withoutExtra', { sourcePath: directory }); + const withExtra = new AssetStaging(stack, 'withExtra', { sourcePath: directory, extraHash: 'boom' }); + + // THEN + expect(withoutExtra.assetHash).not.toEqual(withExtra.assetHash); + expect(withoutExtra.assetHash).toEqual(FIXTURE_TEST1_HASH); + expect(withExtra.assetHash).toEqual('c95c915a5722bb9019e2c725d11868e5a619b55f36172f76bcbcaa8bb2d10c5f'); + }); + + test('can specify extra asset salt via context key', () => { + // GIVEN + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + const app = new App(); + const stack = new Stack(app, 'stack'); + + const saltedApp = new App({ context: { '@aws-cdk/core:assetHashSalt': 'magic' } }); + const saltedStack = new Stack(saltedApp, 'stack'); + + // WHEN + const asset = new AssetStaging(stack, 'X', { sourcePath: directory }); + const saltedAsset = new AssetStaging(saltedStack, 'X', { sourcePath: directory }); + + // THEN + expect(asset.assetHash).not.toEqual(saltedAsset.assetHash); + }); + + test('with bundling', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + const processStdErrWriteSpy = sinon.spy(process.stderr, 'write'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + // THEN + const assembly = app.synth(); + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + + // shows a message before bundling + expect(processStdErrWriteSpy.calledWith('Bundling asset stack/Asset...\n')).toEqual(true); + }); + + test('bundled resources have absolute path when staging is disabled', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + stack.node.setContext(cxapi.DISABLE_ASSET_STAGING_CONTEXT, true); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + // THEN + const assembly = app.synth(); + + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + + expect(asset.assetHash).toEqual('b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4'); + expect(asset.sourcePath).toEqual(directory); + + const resolvedStagePath = asset.relativeStagedPath(stack); + // absolute path ending with bundling dir + expect(path.isAbsolute(resolvedStagePath)).toEqual(true); + expect(new RegExp('asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4$').test(resolvedStagePath)).toEqual(true); + }); + + test('bundler reuses its output when it can', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack, 'AssetDuplicate', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + // THEN + const assembly = app.synth(); + + // We're testing that docker was run exactly once even though there are two bundling assets. + expect( + readDockerStubInputConcat()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + }); + + test('uses asset hash cache with AssetHashType.OUTPUT', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + const fingerPrintSpy = sinon.spy(FileSystem, 'fingerprint'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack, 'AssetDuplicate', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { // Same bundling but with keys ordered differently + command: [DockerStubCommand.SUCCESS], + image: DockerImage.fromRegistry('alpine'), + }, + }); + + // THEN + const assembly = app.synth(); + + // We're testing that docker was run exactly once even though there are two bundling assets + // and that the hash is based on the output + expect( + readDockerStubInputConcat()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + + // Only one fingerprinting + expect(fingerPrintSpy.calledOnce).toEqual(true); + }); + + test('bundler considers its options when reusing bundle output', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack, 'AssetWithDifferentBundlingOptions', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + environment: { + UNIQUE_ENV_VAR: 'SOMEVALUE', + }, + }, + }); + + // THEN + const assembly = app.synth(); + + // We're testing that docker was run twice - once for each set of bundler options + // operating on the same source asset. + expect( + readDockerStubInputConcat()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS\n` + + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated --env UNIQUE_ENV_VAR=SOMEVALUE -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', // 'Asset' + 'asset.e80bb8f931b87e84975de193f5a7ecddd7558d3caf3d35d3a536d9ae6539234f', // 'AssetWithDifferentBundlingOptions' + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + }); + + test('bundler outputs to intermediate dir and renames to asset', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + const ensureDirSync = sinon.spy(fs, 'ensureDirSync'); + const chmodSyncSpy = sinon.spy(fs, 'chmodSync'); + const renameSyncSpy = sinon.spy(fs, 'renameSync'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + // THEN + const assembly = app.synth(); + + expect(ensureDirSync.calledWith(sinon.match(path.join(assembly.directory, 'bundling-temp-')))).toEqual(true); + expect(chmodSyncSpy.calledWith(sinon.match(path.join(assembly.directory, 'bundling-temp-')), 0o777)).toEqual(true); + expect(renameSyncSpy.calledWith(sinon.match(path.join(assembly.directory, 'bundling-temp-')), sinon.match(path.join(assembly.directory, 'asset.')))).toEqual(true); + + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f', // 'Asset' + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + }); + + test('bundling failure preserves the bundleDir for diagnosability', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.FAIL], + }, + })).toThrow(/Failed.*bundl.*asset.*-error/); + + // THEN + const assembly = app.synth(); + + const dir = fs.readdirSync(assembly.directory); + expect(dir.some(entry => entry.match(/asset.*-error/))).toEqual(true); + }); + + test('bundler re-uses assets from previous synths', () => { + // GIVEN + const TEST_OUTDIR = path.join(__dirname, 'cdk.out'); + if (fs.existsSync(TEST_OUTDIR)) { + fs.removeSync(TEST_OUTDIR); + } + + const app = new App({ outdir: TEST_OUTDIR, context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + // Clear asset hash cache to show that during the second synth bundling + // will consider the existing bundling dir (file system cache). + AssetStaging.clearAssetHashCache(); + + // GIVEN + const app2 = new App({ outdir: TEST_OUTDIR, context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack2 = new Stack(app2, 'stack'); + + // WHEN + new AssetStaging(stack2, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + // THEN + const appAssembly = app.synth(); + const app2Assembly = app2.synth(); + + expect( + readDockerStubInputConcat()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + + expect(appAssembly.directory).toEqual(app2Assembly.directory); + expect(fs.readdirSync(appAssembly.directory)).toEqual([ + 'asset.b1e32e86b3523f2fa512eb99180ee2975a50a4439e63e8badd153f2a68d61aa4', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + }); + + test('bundling throws when /asset-output is empty', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // THEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS_NO_OUTPUT], + }, + })).toThrow(/Bundling did not produce any output/); + + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS_NO_OUTPUT`, + ); + }); + + testDeprecated('bundling with BUNDLE asset hash type', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + assetHashType: AssetHashType.BUNDLE, + }); + + // THEN + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); + }); + + test('bundling with docker security option', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + securityOpt: 'no-new-privileges', + }, + assetHashType: AssetHashType.BUNDLE, + }); + + // THEN + expect( + readDockerStubInput()).toEqual( + `run --rm --security-opt no-new-privileges ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); + }); + + test('bundling with docker entrypoint', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + entrypoint: [DockerStubCommand.SUCCESS], + command: [DockerStubCommand.SUCCESS], + }, + assetHashType: AssetHashType.OUTPUT, + }); + + // THEN + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input --entrypoint DOCKER_STUB_SUCCESS alpine DOCKER_STUB_SUCCESS`, + ); + expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); + }); + + test('bundling with OUTPUT asset hash type', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + assetHashType: AssetHashType.OUTPUT, + }); + + // THEN + expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); + }); + + test('custom hash', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHash: 'my-custom-hash', + }); + + // THEN + expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); + expect(asset.assetHash).toEqual('b9c77053f5b83bbe5ba343bc18e92db939a49017010813225fea91fa892c4823'); // hash of 'my-custom-hash' + }); + + test('throws with assetHash and not CUSTOM hash type', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // THEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + assetHash: 'my-custom-hash', + assetHashType: AssetHashType.OUTPUT, + })).toThrow(/Cannot specify `output` for `assetHashType`/); + }); + + testDeprecated('throws with BUNDLE hash type and no bundling', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // THEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.BUNDLE, + })).toThrow(/Cannot use `bundle` hash type when `bundling` is not specified/); + expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); + }); + + test('throws with OUTPUT hash type and no bundling', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // THEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + })).toThrow(/Cannot use `output` hash type when `bundling` is not specified/); + expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); + }); + + test('throws with CUSTOM and no hash', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // THEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.CUSTOM, + })).toThrow(/`assetHash` must be specified when `assetHashType` is set to `AssetHashType.CUSTOM`/); + expect(fs.existsSync(STUB_INPUT_FILE)).toEqual(false); // "docker" not executed + }); + + test('throws when bundling fails', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // THEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('this-is-an-invalid-docker-image'), + command: [DockerStubCommand.FAIL], + }, + })).toThrow(/Failed to bundle asset stack\/Asset/); + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input this-is-an-invalid-docker-image DOCKER_STUB_FAIL`, + ); + }); + + test('with local bundling', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + let dir: string | undefined; + let opts: BundlingOptions | undefined; + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + local: { + tryBundle(outputDir: string, options: BundlingOptions): boolean { + dir = outputDir; + opts = options; + fs.writeFileSync(path.join(outputDir, 'hello.txt'), 'hello'); // output cannot be empty + return true; + }, + }, + }, + }); + + // THEN + expect(dir && /asset.[0-9a-f]{16,}/.test(dir)).toEqual(true); + expect(opts?.command?.[0]).toEqual(DockerStubCommand.SUCCESS); + expect(() => readDockerStubInput()).toThrow(); + + if (dir) { + fs.removeSync(path.join(dir, 'hello.txt')); + } + }); + + test('with local bundling returning false', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + local: { + tryBundle(_bundleDir: string): boolean { + return false; + }, + }, + }, + }); + + // THEN + expect(readDockerStubInput()).toBeDefined(); + }); + + test('bundling can be skipped by setting context', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'MyStack'); + stack.node.setContext(cxapi.BUNDLING_STACKS, ['OtherStack']); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + expect(() => readDockerStubInput()).toThrow(); // Bundling did not run + expect(asset.sourcePath).toEqual(directory); + expect(asset.stagedPath).toEqual(directory); + expect(asset.relativeStagedPath(stack)).toEqual(directory); + expect(asset.assetHash).toEqual('f66d7421aa2d044a6c1f60ddfc76dc78571fcd8bd228eb48eb394e2dbad94a5c'); + }); + + test('correctly skips bundling with stack under stage', () => { + // GIVEN + const app = new App(); + + const stage = new Stage(app, 'Stage'); + stage.node.setContext(cxapi.BUNDLING_STACKS, ['Stage/Stack1']); + + const stack1 = new Stack(stage, 'Stack1'); + const stack2 = new Stack(stage, 'Stack2'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + new AssetStaging(stack1, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack2, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.MULTIPLE_FILES], + }, + }); + + const dockerStubInput = readDockerStubInputConcat(); + // Docker ran for the asset in Stack1 + expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); + // DOcker did not run for the asset in Stack2 + expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); + }); + + test('correctly skips bundling with stack under stage and custom stack name', () => { + // GIVEN + const app = new App(); + + const stage = new Stage(app, 'Stage'); + stage.node.setContext(cxapi.BUNDLING_STACKS, ['Stage/Stack1']); + + const stack1 = new Stack(stage, 'Stack1', { stackName: 'unrelated-stack1-name' }); + const stack2 = new Stack(stage, 'Stack2', { stackName: 'unrelated-stack2-name' }); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack1, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack2, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.MULTIPLE_FILES], + }, + }); + + // THEN + const dockerStubInput = readDockerStubInputConcat(); + // Docker ran for the asset in Stack1 + expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); + // Docker did not run for the asset in Stack2 + expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); + }); + + test('correctly bundles with stack under stage and the default stack pattern', () => { + // GIVEN + const app = new App(); + + const stage = new Stage(app, 'Stage'); + + const stack1 = new Stack(stage, 'Stack1'); + const stack2 = new Stack(stage, 'Stack2'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack1, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack2, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.MULTIPLE_FILES], + }, + }); + + // THEN + const dockerStubInput = readDockerStubInputConcat(); + // Docker ran for the asset in Stack1 + expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); + // Docker ran for the asset in Stack2 + expect(dockerStubInput).toMatch(DockerStubCommand.MULTIPLE_FILES); + }); + + test('correctly bundles with stack under stage and partial globstar wildcard', () => { + // GIVEN + const app = new App(); + + const stage = new Stage(app, 'Stage'); + stage.node.setContext(cxapi.BUNDLING_STACKS, ['**/Stack1']); // a single wildcard prefix ('*Stack1') won't match + + const stack1 = new Stack(stage, 'Stack1'); + const stack2 = new Stack(stage, 'Stack2'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(stack1, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + new AssetStaging(stack2, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.MULTIPLE_FILES], + }, + }); + + // THEN + const dockerStubInput = readDockerStubInputConcat(); + // Docker ran for the asset in Stack1 + expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); + // Docker did not run for the asset in Stack2 + expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); + }); + + test('correctly bundles selected stacks nested in Stack/Stage/Stack', () => { + // GIVEN + const app = new App(); + + const topStack = new Stack(app, 'TopStack'); + topStack.node.setContext(cxapi.BUNDLING_STACKS, ['TopStack/MiddleStage/BottomStack']); + + const middleStage = new Stage(topStack, 'MiddleStage'); + const bottomStack = new Stack(middleStage, 'BottomStack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + new AssetStaging(bottomStack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + new AssetStaging(topStack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.MULTIPLE_FILES], + }, + }); + + const dockerStubInput = readDockerStubInputConcat(); + // Docker ran for the asset in BottomStack + expect(dockerStubInput).toMatch(DockerStubCommand.SUCCESS); + // Docker did not run for the asset in TopStack + expect(dockerStubInput).not.toMatch(DockerStubCommand.MULTIPLE_FILES); + }); + + test('bundling still occurs with partial wildcard', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'MyStack'); + stack.node.setContext(cxapi.BUNDLING_STACKS, ['*Stack']); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); // hash of MyStack/Asset + }); + + test('bundling still occurs with a single wildcard', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'MyStack'); + stack.node.setContext(cxapi.BUNDLING_STACKS, ['*']); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const asset = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + assetHashType: AssetHashType.OUTPUT, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SUCCESS], + }, + }); + + expect( + readDockerStubInput()).toEqual( + `run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`, + ); + expect(asset.assetHash).toEqual('33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f'); // hash of MyStack/Asset + }); + + test('bundling that produces a single archive file is autodiscovered', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const staging = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SINGLE_ARCHIVE], + }, + }); + + // THEN + const assembly = app.synth(); + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.f43148c61174f444925231b5849b468f21e93b5d1469cd07c53625ffd039ef48', // this is the bundle dir + 'asset.f43148c61174f444925231b5849b468f21e93b5d1469cd07c53625ffd039ef48.zip', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + expect(fs.readdirSync(path.join(assembly.directory, 'asset.f43148c61174f444925231b5849b468f21e93b5d1469cd07c53625ffd039ef48'))).toEqual([ + 'test.zip', // bundle dir with "touched" bundled output file + ]); + expect(staging.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging.isArchive).toEqual(true); + }); + + test('bundling that produces a single archive file with disk cache', () => { + // GIVEN + const TEST_OUTDIR = path.join(__dirname, 'cdk.out'); + if (fs.existsSync(TEST_OUTDIR)) { + fs.removeSync(TEST_OUTDIR); + } + + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + const app1 = new App({ outdir: TEST_OUTDIR }); + const stack1 = new Stack(app1, 'Stack'); + + const app2 = new App({ outdir: TEST_OUTDIR }); // same OUTDIR + const stack2 = new Stack(app2, 'stack'); + + // WHEN + const staging1 = new AssetStaging(stack1, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SINGLE_ARCHIVE], + outputType: BundlingOutput.ARCHIVED, + }, + }); + + // Now clear asset hash cache to show that during the second staging + // even though bundling is skipped it will correctly be considered + // as a FileAssetPackaging.FILE. + AssetStaging.clearAssetHashCache(); + + const staging2 = new AssetStaging(stack2, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SINGLE_ARCHIVE], + outputType: BundlingOutput.ARCHIVED, + }, + }); + + // THEN + expect(staging1.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging1.isArchive).toEqual(true); + expect(staging2.packaging).toEqual(staging1.packaging); + expect(staging2.isArchive).toEqual(staging1.isArchive); + }); + + test('bundling that produces a single archive file with NOT_ARCHIVED', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const staging = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.SINGLE_ARCHIVE], + outputType: BundlingOutput.NOT_ARCHIVED, + }, + }); + + // THEN + const assembly = app.synth(); + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.86ec07746e1d859290cfd8b9c648e581555649c75f51f741f11e22cab6775abc', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + expect(staging.packaging).toEqual(FileAssetPackaging.ZIP_DIRECTORY); + expect(staging.isArchive).toEqual(true); + }); + + test('throws with ARCHIVED and bundling that does not produce a single archive file', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + expect(() => new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.MULTIPLE_FILES], + outputType: BundlingOutput.ARCHIVED, + }, + })).toThrow(/Bundling output directory is expected to include only a single archive file when `output` is set to `ARCHIVED`/); + }); +}); + +describe('staging with docker cp', () => { + beforeAll(() => { + // this is a way to provide a custom "docker" command for staging. + process.env.CDK_DOCKER = `${__dirname}/docker-stub-cp.sh`; + }); + + afterAll(() => { + delete process.env.CDK_DOCKER; + }); + + afterEach(() => { + AssetStaging.clearAssetHashCache(); + if (fs.existsSync(STUB_INPUT_CP_FILE)) { + fs.unlinkSync(STUB_INPUT_CP_FILE); + } + if (fs.existsSync(STUB_INPUT_CP_CONCAT_FILE)) { + fs.unlinkSync(STUB_INPUT_CP_CONCAT_FILE); + } + sinon.restore(); + }); + + test('bundling with docker image copy variant', () => { + // GIVEN + const app = new App({ context: { [cxapi.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: false } }); + const stack = new Stack(app, 'stack'); + const directory = path.join(__dirname, 'fs', 'fixtures', 'test1'); + + // WHEN + const staging = new AssetStaging(stack, 'Asset', { + sourcePath: directory, + bundling: { + image: DockerImage.fromRegistry('alpine'), + command: [DockerStubCommand.VOLUME_SINGLE_ARCHIVE], + bundlingFileAccess: BundlingFileAccess.VOLUME_COPY, + }, + }); + + // THEN + const assembly = app.synth(); + expect(fs.readdirSync(assembly.directory)).toEqual([ + 'asset.0ec371a2022d29dfd83f5df104e0f01b34233a4e3e839c3c4ec62008f0b9a0e8', // this is the bundle dir + 'asset.0ec371a2022d29dfd83f5df104e0f01b34233a4e3e839c3c4ec62008f0b9a0e8.zip', + 'cdk.out', + 'manifest.json', + 'stack.template.json', + 'tree.json', + ]); + expect(fs.readdirSync(path.join(assembly.directory, 'asset.0ec371a2022d29dfd83f5df104e0f01b34233a4e3e839c3c4ec62008f0b9a0e8'))).toEqual([ + 'test.zip', // bundle dir with "touched" bundled output file + ]); + expect(staging.packaging).toEqual(FileAssetPackaging.FILE); + expect(staging.isArchive).toEqual(true); + const dockerCalls: string[] = readDockerStubInputConcat(STUB_INPUT_CP_CONCAT_FILE).split(/\r?\n/); + expect(dockerCalls).toEqual(expect.arrayContaining([ + expect.stringContaining('volume create assetInput'), + expect.stringContaining('volume create assetOutput'), + expect.stringMatching('run --name copyContainer.* -v /input:/asset-input -v /output:/asset-output alpine sh -c mkdir -p /asset-input && chown -R .* /asset-output && chown -R .* /asset-input'), + expect.stringMatching('cp .*fs/fixtures/test1/\. copyContainer.*:/asset-input'), + expect.stringMatching('run --rm -u .* --volumes-from copyContainer.* -w /asset-input alpine DOCKER_STUB_VOLUME_SINGLE_ARCHIVE'), + expect.stringMatching('cp copyContainer.*:/asset-output/\. .*'), + expect.stringContaining('rm copyContainer'), + expect.stringContaining('volume rm assetInput'), + expect.stringContaining('volume rm assetOutput'), + ])); + }); +}); + +// Reads a docker stub and cleans the volume paths out of the stub. +function readAndCleanDockerStubInput(file: string) { + return fs + .readFileSync(file, 'utf-8') + .trim() + .replace(/-v ([^:]+):\/asset-input/g, '-v /input:/asset-input') + .replace(/-v ([^:]+):\/asset-output/g, '-v /output:/asset-output'); +} + +// Last docker input since last teardown +function readDockerStubInput(file?: string) { + return readAndCleanDockerStubInput(file ?? STUB_INPUT_FILE); +} +// Concatenated docker inputs since last teardown +function readDockerStubInputConcat(file?: string) { + return readAndCleanDockerStubInput(file ?? STUB_INPUT_CONCAT_FILE); +} diff --git a/packages/@aws-cdk/core/test/synthesis.test.ts b/packages/aws-cdk-lib/core/test/synthesis.test.ts similarity index 98% rename from packages/@aws-cdk/core/test/synthesis.test.ts rename to packages/aws-cdk-lib/core/test/synthesis.test.ts index 359601dac62f7..c196b023cdb82 100644 --- a/packages/@aws-cdk/core/test/synthesis.test.ts +++ b/packages/aws-cdk-lib/core/test/synthesis.test.ts @@ -2,8 +2,8 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import { testDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../../cx-api'; import { Construct } from 'constructs'; import * as cdk from '../lib'; import { synthesize } from '../lib/private/synthesis'; diff --git a/packages/@aws-cdk/core/test/tag-aspect.test.ts b/packages/aws-cdk-lib/core/test/tag-aspect.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/tag-aspect.test.ts rename to packages/aws-cdk-lib/core/test/tag-aspect.test.ts diff --git a/packages/@aws-cdk/core/test/tag-manager.test.ts b/packages/aws-cdk-lib/core/test/tag-manager.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/tag-manager.test.ts rename to packages/aws-cdk-lib/core/test/tag-manager.test.ts diff --git a/packages/@aws-cdk/core/test/time-zone.test.ts b/packages/aws-cdk-lib/core/test/time-zone.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/time-zone.test.ts rename to packages/aws-cdk-lib/core/test/time-zone.test.ts diff --git a/packages/@aws-cdk/core/test/tokens.test.ts b/packages/aws-cdk-lib/core/test/tokens.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/tokens.test.ts rename to packages/aws-cdk-lib/core/test/tokens.test.ts diff --git a/packages/@aws-cdk/core/test/util.test.ts b/packages/aws-cdk-lib/core/test/util.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/util.test.ts rename to packages/aws-cdk-lib/core/test/util.test.ts diff --git a/packages/aws-cdk-lib/core/test/util.ts b/packages/aws-cdk-lib/core/test/util.ts new file mode 100644 index 0000000000000..6c5c2eba6dbad --- /dev/null +++ b/packages/aws-cdk-lib/core/test/util.ts @@ -0,0 +1,47 @@ +import { CloudAssembly } from '../../cx-api'; +import { Stack } from '../lib'; +import { CDK_DEBUG } from '../lib/debug'; +import { synthesize } from '../lib/private/synthesis'; + +export function toCloudFormation(stack: Stack): any { + const synthesizedTemplate = synthesize(stack, { skipValidation: true }).getStackByName(stack.stackName).template; + + // if new-style synthesis is not explicitly set, remove the extra generated Rule and Parameter from the synthesized template, + // to avoid changing many tests that rely on the template being exactly what it is + delete synthesizedTemplate?.Rules?.CheckBootstrapVersion; + if (Object.keys(synthesizedTemplate?.Rules ?? {}).length === 0) { + delete synthesizedTemplate?.Rules; + } + delete synthesizedTemplate?.Parameters?.BootstrapVersion; + if (Object.keys(synthesizedTemplate?.Parameters ?? {}).length === 0) { + delete synthesizedTemplate?.Parameters; + } + + return synthesizedTemplate; +} + +export function reEnableStackTraceCollection(): string | undefined { + const previousValue = process.env.CDK_DISABLE_STACK_TRACE; + process.env.CDK_DISABLE_STACK_TRACE = ''; + process.env[CDK_DEBUG] = 'true'; + return previousValue; +} + +export function restoreStackTraceColection(previousValue: string | undefined): void { + process.env.CDK_DISABLE_STACK_TRACE = previousValue; + delete process.env[CDK_DEBUG]; +} + +export function getWarnings(casm: CloudAssembly) { + const result = new Array<{ path: string, message: string }>(); + for (const stack of Object.values(casm.manifest.artifacts ?? {})) { + for (const [path, md] of Object.entries(stack.metadata ?? {})) { + for (const x of md) { + if (x.type === 'aws:cdk:warning') { + result.push({ path, message: x.data as string }); + } + } + } + } + return result; +} diff --git a/packages/@aws-cdk/core/test/validation/trace.test.ts b/packages/aws-cdk-lib/core/test/validation/trace.test.ts similarity index 100% rename from packages/@aws-cdk/core/test/validation/trace.test.ts rename to packages/aws-cdk-lib/core/test/validation/trace.test.ts diff --git a/packages/@aws-cdk/core/test/validation/validation.test.ts b/packages/aws-cdk-lib/core/test/validation/validation.test.ts similarity index 97% rename from packages/@aws-cdk/core/test/validation/validation.test.ts rename to packages/aws-cdk-lib/core/test/validation/validation.test.ts index 52b6b915b81de..af5dd9d448e26 100644 --- a/packages/@aws-cdk/core/test/validation/validation.test.ts +++ b/packages/aws-cdk-lib/core/test/validation/validation.test.ts @@ -62,11 +62,11 @@ describe('validations', () => { severity: 'medium', creationStack: [ expect.stringMatching(/Default \(Default\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.Stack/), + expect.stringMatching(/│ Construct: aws-cdk-lib.Stack/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), expect.stringMatching(/└── Fake \(Default\/Fake\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.CfnResource/), + expect.stringMatching(/│ Construct: aws-cdk-lib.CfnResource/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), ], @@ -246,15 +246,15 @@ Policy Validation Report Summary title: 'test-rule2', creationStack: [ expect.stringMatching(/Stage1 \(Stage1\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.Stage/), + expect.stringMatching(/│ Construct: aws-cdk-lib.Stage/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), expect.stringMatching(/└── stack1 \(Stage1\/stack1\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.Stack/), + expect.stringMatching(/│ Construct: aws-cdk-lib.Stack/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), expect.stringMatching(/└── DefaultResource \(Stage1\/stack1\/DefaultResource\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.CfnResource/), + expect.stringMatching(/│ Construct: aws-cdk-lib.CfnResource/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), ], @@ -477,11 +477,11 @@ Policy Validation Report Summary title: 'rule-1', creationStack: [ expect.stringMatching(/Default \(Default\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.Stack/), + expect.stringMatching(/│ Construct: aws-cdk-lib.Stack/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), expect.stringMatching(/└── Fake \(Default\/Fake\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.CfnResource/), + expect.stringMatching(/│ Construct: aws-cdk-lib.CfnResource/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), ], @@ -544,11 +544,11 @@ Policy Validation Report Summary title: 'rule-2', creationStack: [ expect.stringMatching(/Default \(Default\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.Stack/), + expect.stringMatching(/│ Construct: aws-cdk-lib.Stack/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), expect.stringMatching(/└── Fake \(Default\/Fake\)/), - expect.stringMatching(/│ Construct: @aws-cdk\/core.CfnResource/), + expect.stringMatching(/│ Construct: aws-cdk-lib.CfnResource/), expect.stringMatching(/│ Library Version: .*/), expect.stringMatching(/│ Location: Run with '--debug' to include location info/), ], @@ -665,13 +665,13 @@ Policy Validation Report Summary { constructStack: { 'id': 'Default', - 'construct': '@aws-cdk/core.Stack', + 'construct': 'aws-cdk-lib.Stack', 'libraryVersion': expect.any(String), 'location': "Run with '--debug' to include location info", 'path': 'Default', 'child': { 'id': 'Fake', - 'construct': '@aws-cdk/core.CfnResource', + 'construct': 'aws-cdk-lib.CfnResource', 'libraryVersion': expect.any(String), 'location': "Run with '--debug' to include location info", 'path': 'Default/Fake', diff --git a/packages/aws-cdk-lib/custom-resources/.gitignore b/packages/aws-cdk-lib/custom-resources/.gitignore new file mode 100644 index 0000000000000..5deb4a3572088 --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/.gitignore @@ -0,0 +1 @@ +!lib/provider-framework/types.d.ts diff --git a/packages/aws-cdk-lib/custom-resources/.jsiirc.json b/packages/aws-cdk-lib/custom-resources/.jsiirc.json new file mode 100644 index 0000000000000..cc3af08a6c134 --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.customresources" + }, + "dotnet": { + "namespace": "Amazon.CDK.CustomResources" + }, + "python": { + "module": "aws_cdk.custom_resources" + } + } +} diff --git a/packages/aws-cdk-lib/custom-resources/README.md b/packages/aws-cdk-lib/custom-resources/README.md new file mode 100644 index 0000000000000..bb8b2247f4163 --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/README.md @@ -0,0 +1,628 @@ +# AWS CDK Custom Resources + + +## Provider Framework + +AWS CloudFormation [custom resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html) are extension points to the provisioning +engine. When CloudFormation needs to create, update or delete a custom resource, +it sends a lifecycle event notification to a **custom resource provider**. The provider +handles the event (e.g. creates a resource) and sends back a response to CloudFormation. + +The `@aws-cdk/custom-resources.Provider` construct is a "mini-framework" for +implementing providers for AWS CloudFormation custom resources. The framework offers a high-level API which makes it easier to implement robust +and powerful custom resources. If you are looking to implement a custom resource provider, we recommend +you use this module unless you have good reasons not to. For an overview of different provider types you +could be using, see the [Custom Resource Providers section in the core library documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib-readme.html#custom-resource-providers). + +> **N.B.**: if you use the provider framework in this module you will write AWS Lambda Functions that look a lot like, but aren't exactly the same as the Lambda Functions you would write if you wrote CloudFormation Custom Resources directly, without this framework. +> +> Specifically, to report success or failure, have your Lambda Function exit in the right way: return data for success, or throw an +> exception for failure. *Do not* post the success or failure of your custom resource to an HTTPS URL as the CloudFormation +> documentation tells you to do. + +The framework has the following capabilities: + +* Handles responses to AWS CloudFormation and protects against blocked + deployments +* Validates handler return values to help with correct handler implementation +* Supports asynchronous handlers to enable operations that require a long waiting period for a resource, which can exceed the AWS Lambda timeout +* Implements default behavior for physical resource IDs. + +The following code shows how the `Provider` construct is used in conjunction +with a `CustomResource` and a user-provided AWS Lambda function which implements +the actual handler. + +```ts +declare const onEvent: lambda.Function; +declare const isComplete: lambda.Function; +declare const myRole: iam.Role; + +const myProvider = new cr.Provider(this, 'MyProvider', { + onEventHandler: onEvent, + isCompleteHandler: isComplete, // optional async "waiter" + logRetention: logs.RetentionDays.ONE_DAY, // default is INFINITE + role: myRole, // must be assumable by the `lambda.amazonaws.com` service principal +}); + +new CustomResource(this, 'Resource1', { serviceToken: myProvider.serviceToken }); +new CustomResource(this, 'Resource2', { serviceToken: myProvider.serviceToken }); +``` + +Providers are implemented through AWS Lambda functions that are triggered by the +provider framework in response to lifecycle events. + +At the minimum, users must define the `onEvent` handler, which is invoked by the +framework for all resource lifecycle events (`Create`, `Update` and `Delete`) +and returns a result which is then submitted to CloudFormation. + +The following example is a skeleton for a Python implementation of `onEvent`: + +```py +def on_event(event, context): + print(event) + request_type = event['RequestType'] + if request_type == 'Create': return on_create(event) + if request_type == 'Update': return on_update(event) + if request_type == 'Delete': return on_delete(event) + raise Exception("Invalid request type: %s" % request_type) + +def on_create(event): + props = event["ResourceProperties"] + print("create new resource with props %s" % props) + + # add your create code here... + physical_id = ... + + return { 'PhysicalResourceId': physical_id } + +def on_update(event): + physical_id = event["PhysicalResourceId"] + props = event["ResourceProperties"] + print("update resource %s with props %s" % (physical_id, props)) + # ... + +def on_delete(event): + physical_id = event["PhysicalResourceId"] + print("delete resource %s" % physical_id) + # ... +``` + +> When writing your handlers, there are a couple of non-obvious corner cases you need to +> pay attention to. See the [important cases to handle](#important-cases-to-handle) section for more information. + +Users may also provide an additional handler called `isComplete`, for cases +where the lifecycle operation cannot be completed immediately. The +`isComplete` handler will be retried asynchronously after `onEvent` until it +returns `IsComplete: true`, or until the total provider timeout has expired. + +The following example is a skeleton for a Python implementation of `isComplete`: + +```py +def is_complete(event, context): + physical_id = event["PhysicalResourceId"] + request_type = event["RequestType"] + + # check if resource is stable based on request_type + is_ready = ... + + return { 'IsComplete': is_ready } +``` + +> **Security Note**: the Custom Resource Provider Framework will write the value of `ResponseURL`, +> which is a pre-signed S3 URL used to report the success or failure of the Custom Resource execution +> back to CloudFormation, in a readable form to the AWS Step Functions execution history. +> +> Anybody who can list and read AWS StepFunction executions in your account will be able to write +> a fake response to this URL and make your CloudFormation deployments fail. +> +> Do not use this library if your threat model requires that you cannot trust actors who are able +> to list StepFunction executions in your account. + +### Handling Lifecycle Events: onEvent + +The user-defined `onEvent` AWS Lambda function is invoked whenever a resource +lifecycle event occurs. The function is expected to handle the event and return +a response to the framework that, at least, includes the physical resource ID. + +If `onEvent` returns successfully, the framework will submit a "SUCCESS" response +to AWS CloudFormation for this resource operation. If the provider is +[asynchronous](#asynchronous-providers-iscomplete) (`isCompleteHandler` is +defined), the framework will only submit a response based on the result of +`isComplete`. + +If `onEvent` throws an error, the framework will submit a "FAILED" response to +AWS CloudFormation. + +The input event includes the following fields derived from the [Custom Resource +Provider Request]: + +|Field|Type|Description +|-----|----|---------------- +|`RequestType`|String|The type of lifecycle event: `Create`, `Update` or `Delete`. +|`LogicalResourceId`|String|The template developer-chosen name (logical ID) of the custom resource in the AWS CloudFormation template. +|`PhysicalResourceId`|String|This field will only be present for `Update` and `Delete` events and includes the value returned in `PhysicalResourceId` of the previous operation. +|`ResourceProperties`|JSON|This field contains the properties defined in the template for this custom resource. +|`OldResourceProperties`|JSON|This field will only be present for `Update` events and contains the resource properties that were declared previous to the update request. +|`ResourceType`|String|The resource type defined for this custom resource in the template. A provider may handle any number of custom resource types. +|`RequestId`|String|A unique ID for the request. +|`StackId`|String|The ARN that identifies the stack that contains the custom resource. + +The return value from `onEvent` must be a JSON object with the following fields: + +|Field|Type|Required|Description +|-----|----|--------|----------- +|`PhysicalResourceId`|String|No|The allocated/assigned physical ID of the resource. If omitted for `Create` events, the event's `RequestId` will be used. For `Update`, the current physical ID will be used. If a different value is returned, CloudFormation will follow with a subsequent `Delete` for the previous ID (resource replacement). For `Delete`, it will always return the current physical resource ID, and if the user returns a different one, an error will occur. +|`Data`|JSON|No|Resource attributes, which can later be retrieved through `Fn::GetAtt` on the custom resource object. +|`NoEcho`|Boolean|No|Whether to mask the output of the custom resource when retrieved by using the `Fn::GetAtt` function. +|*any*|*any*|No|Any other field included in the response will be passed through to `isComplete`. This can sometimes be useful to pass state between the handlers. + +[Custom Resource Provider Request]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref-requests.html#crpg-ref-request-fields + +### Asynchronous Providers: isComplete + +It is not uncommon for the provisioning of resources to be an asynchronous +operation, which means that the operation does not immediately finish, and we +need to "wait" until the resource stabilizes. + +The provider framework makes it easy to implement "waiters" by allowing users to +specify an additional AWS Lambda function in `isCompleteHandler`. + +The framework will repeatedly invoke the handler every `queryInterval`. When +`isComplete` returns with `IsComplete: true`, the framework will submit a +"SUCCESS" response to AWS CloudFormation. If `totalTimeout` expires and the +operation has not yet completed, the framework will submit a "FAILED" response +with the message "Operation timed out". + +If an error is thrown, the framework will submit a "FAILED" response to AWS +CloudFormation. + +The input event to `isComplete` includes all request fields, combined with all +fields returned from `onEvent`. If `PhysicalResourceId` has not been explicitly +returned from `onEvent`, it's value will be calculated based on the heuristics +described above. + +The return value must be a JSON object with the following fields: + +|Field|Type|Required|Description +|-----|----|--------|----------- +|`IsComplete`|Boolean|Yes|Indicates if the operation has finished or not. +|`Data`|JSON|No|May only be sent if `IsComplete` is `true` and includes additional resource attributes. These attributes will be **merged** with the ones returned from `onEvent` + +### Physical Resource IDs + +Every resource in CloudFormation has a physical resource ID. When a resource is +created, the `PhysicalResourceId` returned from the `Create` operation is stored +by AWS CloudFormation and assigned to the logical ID defined for this resource +in the template. If a `Create` operation returns without a `PhysicalResourceId`, +the framework will use `RequestId` as the default. This is sufficient for +various cases such as "pseudo-resources" which only query data. + +For `Update` and `Delete` operations, the resource event will always include the +current `PhysicalResourceId` of the resource. + +When an `Update` operation occurs, the default behavior is to return the current +physical resource ID. if the `onEvent` returns a `PhysicalResourceId` which is +different from the current one, AWS CloudFormation will treat this as a +**resource replacement**, and it will issue a subsequent `Delete` operation for +the old resource. + +As a rule of thumb, if your custom resource supports configuring a physical name +(e.g. you can specify a `BucketName` when you define an `AWS::S3::Bucket`), you +must return this name in `PhysicalResourceId` and make sure to handle +replacement properly. The `S3File` example demonstrates this +through the `objectKey` property. + +### When there are errors + +As mentioned above, if any of the user handlers fail (i.e. throws an exception) +or times out (due to their AWS Lambda timing out), the framework will trap these +errors and submit a "FAILED" response to AWS CloudFormation, along with the error +message. + +Since errors can occur in multiple places in the provider (framework, `onEvent`, +`isComplete`), it is important to know that there could situations where a +resource operation fails even though the operation technically succeeded (i.e. +isComplete throws an error). + +When AWS CloudFormation receives a "FAILED" response, it will attempt to roll +back the stack to it's last state. This has different meanings for different +lifecycle events: + +* If a `Create` event fails, the resource provider framework will automatically + ignore the subsequent `Delete` operation issued by AWS CloudFormation. The + framework currently does not support customizing this behavior (see + https://github.com/aws/aws-cdk/issues/5524). +* If an `Update` event fails, CloudFormation will issue an additional `Update` + with the previous properties. +* If a `Delete` event fails, CloudFormation will abandon this resource. + +### Important cases to handle + +You should keep the following list in mind when writing custom resources to +make sure your custom resource behaves correctly in all cases: + +* During `Create`: + * If the create fails, the *provider framework* will make sure you + don't get a subsequent `Delete` event. If your create involves multiple distinct + operations, it is your responsibility to catch and rethrow and clean up + any partial updates that have already been performed. Make sure your + API call timeouts and Lambda timeouts allow for this. +* During `Update`: + * If the update fails, you will get a subsequent `Update` event + to roll back to the previous state (with `ResourceProperties` and + `OldResourceProperties` reversed). + * If you return a different `PhysicalResourceId`, you will subsequently + receive a `Delete` event to clean up the previous state of the resource. +* During `Delete`: + * If the behavior of your custom resource is tied to another AWS resource + (for example, it exists to clean the contents of a stateful resource), keep + in mind that your custom resource may be deleted independently of the other + resource and you must confirm that it is appropriate to perform the action. + * (only if you are *not* using the provider framework) a `Delete` event + may be caused by a failed `Create`. You must be able to handle the case + where the resource you are trying to delete hasn't even been created yet. +* If you update the code of your custom resource and change the format of the + resource properties, be aware that there may still be already-deployed + instances of your custom resource out there, and you may still receive + the *old* property format in `ResourceProperties` (during `Delete` and + rollback `Updates`) or in `OldResourceProperties` (during rollforward + `Update`). You must continue to handle all possible sets of properties + your custom resource could have ever been created with in the past. + +### Provider Framework Execution Policy + +Similarly to any AWS Lambda function, if the user-defined handlers require +access to AWS resources, you will have to define these permissions +by calling "grant" methods such as `myBucket.grantRead(myHandler)`), using `myHandler.addToRolePolicy` +or specifying an `initialPolicy` when defining the function. + +Bear in mind that in most cases, a single provider will be used for multiple +resource instances. This means that the execution policy of the provider must +have the appropriate privileges. + +The following example grants the `onEvent` handler `s3:GetObject*` permissions +to all buckets: + +```ts +new lambda.Function(this, 'OnEventHandler', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromInline('my code'), + initialPolicy: [ + new iam.PolicyStatement({ actions: [ 's3:GetObject*' ], resources: [ '*' ] }), + ], +}); +``` + +### Timeouts + +Users are responsible to define the timeouts for the AWS Lambda functions for +user-defined handlers. It is recommended not to exceed a **14 minutes** timeout, +since all framework functions are configured to time out after 15 minutes, which +is the maximal AWS Lambda timeout. + +If your operation takes over **14 minutes**, the recommended approach is to +implement an [asynchronous provider](#asynchronous-providers-iscomplete), and +then configure the timeouts for the asynchronous retries through the +`queryInterval` and the `totalTimeout` options. + +### Provider Framework Examples + +This module includes a few examples for custom resource implementations: + +#### S3File + +Provisions an object in an S3 bucket with textual contents. See the source code +for the +[construct](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts) and +[handler](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts). + +The following example will create the file `folder/file1.txt` inside `myBucket` +with the contents `hello!`. + + +```plaintext +// This example exists only for TypeScript + +declare const myBucket: s3.Bucket; +new cr.S3File(this, 'MyFile', { + bucket: myBucket, + objectKey: 'folder/file1.txt', // optional + content: 'hello!', + public: true, // optional +}); +``` + +This sample demonstrates the following concepts: + +* Synchronous implementation (`isComplete` is not defined) +* Automatically generates the physical name if `objectKey` is not defined +* Handles physical name changes +* Returns resource attributes +* Handles deletions +* Implemented in TypeScript + +#### S3Assert + +Checks that the textual contents of an S3 object matches a certain value. The check will be retried for 5 minutes as long as the object is not found or the value is different. See the source code for the [construct](test/provider-framework/integration-test-fixtures/s3-assert.ts) and [handler](test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py). + +The following example defines an `S3Assert` resource which waits until +`myfile.txt` in `myBucket` exists and includes the contents `foo bar`: + +```plaintext +// This example exists only for TypeScript + +declare const myBucket: s3.Bucket; +new cr.S3Assert(this, 'AssertMyFile', { + bucket: myBucket, + objectKey: 'myfile.txt', + expectedContent: 'foo bar', +}); +``` + +This sample demonstrates the following concepts: + +* Asynchronous implementation +* Non-intrinsic physical IDs +* Implemented in Python + + +### Customizing Provider Function name + +In multi-account environments or when the custom resource may be re-utilized across several +stacks it may be useful to manually set a name for the Provider Function Lambda and therefore +have a predefined service token ARN. + +```ts +declare const onEvent: lambda.Function; +declare const isComplete: lambda.Function; +declare const myRole: iam.Role; +const myProvider = new cr.Provider(this, 'MyProvider', { + onEventHandler: onEvent, + isCompleteHandler: isComplete, + logRetention: logs.RetentionDays.ONE_DAY, + role: myRole, + providerFunctionName: 'the-lambda-name', // Optional +}); + +``` + +## Custom Resources for AWS APIs + +Sometimes a single API call can fill the gap in the CloudFormation coverage. In +this case you can use the `AwsCustomResource` construct. This construct creates +a custom resource that can be customized to make specific API calls for the +`CREATE`, `UPDATE` and `DELETE` events. Additionally, data returned by the API +call can be extracted and used in other constructs/resources (creating a real +CloudFormation dependency using `Fn::GetAtt` under the hood). + +The physical id of the custom resource can be specified or derived from the data +returned by the API call. + +The `AwsCustomResource` uses the AWS SDK for JavaScript. Services, actions and +parameters can be found in the [API documentation](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html). + +Path to data must be specified using a dot notation, e.g. to get the string value +of the `Title` attribute for the first item returned by `dynamodb.query` it should +be `Items.0.Title.S`. + +To make sure that the newest API calls are available the latest AWS SDK v2 is installed +in the Lambda function implementing the custom resource. The installation takes around 60 +seconds. If you prefer to optimize for speed, you can disable the installation by setting +the `installLatestAwsSdk` prop to `false`. + +### Custom Resource Execution Policy + +The `policy` property defines the IAM Policy that will be applied to the API calls. This must be provided +if an existing `role` is not specified and is optional otherwise. The library provides two factory methods +to quickly configure this: + +* **`AwsCustomResourcePolicy.fromSdkCalls`** - Use this to auto-generate IAM + Policy statements based on the configured SDK calls. Keep two things in mind + when using this policy: + * This policy variant assumes the IAM policy name has the same name as the API + call. This is true in 99% of cases, but there are exceptions (for example, + S3's `PutBucketLifecycleConfiguration` requires + `s3:PutLifecycleConfiguration` permissions, Lambda's `Invoke` requires + `lambda:InvokeFunction` permissions). Use `fromStatements` if you want to + do a call that requires different IAM action names. + * You will have to either provide specific ARNs, or explicitly use + `AwsCustomResourcePolicy.ANY_RESOURCE` to allow access to any resource. +* **`AwsCustomResourcePolicy.fromStatements`** - Use this to specify your own + custom statements. + +The custom resource also implements `iam.IGrantable`, making it possible to use the `grantXxx()` methods. + +As this custom resource uses a singleton Lambda function, it's important to note +that the function's role will eventually accumulate the permissions/grants from all +resources. + +Chained API calls can be achieved by creating dependencies: + +```ts +const awsCustom1 = new cr.AwsCustomResource(this, 'API1', { + onCreate: { + service: '...', + action: '...', + physicalResourceId: cr.PhysicalResourceId.of('...'), + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}); + +const awsCustom2 = new cr.AwsCustomResource(this, 'API2', { + onCreate: { + service: '...', + action: '...', + parameters: { + text: awsCustom1.getResponseField('Items.0.text'), + }, + physicalResourceId: cr.PhysicalResourceId.of('...'), + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}); +``` + +### Physical Resource Id Parameter + +Some AWS APIs may require passing the physical resource id in as a parameter for doing updates and deletes. You can pass it by using `PhysicalResourceIdReference`. + +```ts +const awsCustom = new cr.AwsCustomResource(this, 'aws-custom', { + onCreate: { + service: '...', + action: '...', + parameters: { + text: '...', + }, + physicalResourceId: cr.PhysicalResourceId.of('...'), + }, + onUpdate: { + service: '...', + action: '...', + parameters: { + text: '...', + resourceId: new cr.PhysicalResourceIdReference(), + }, + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}) +``` + +You can omit `PhysicalResourceId` property in `onUpdate` to passthrough the value in `onCreate`. This behavior is useful when using Update APIs that response with an empty body. + +> AwsCustomResource.getResponseField() and .getResponseFieldReference() will not work if the Create and Update APIs don't consistently return the same fields. + +### Handling Custom Resource Errors + +Every error produced by the API call is treated as is and will cause a "FAILED" response to be submitted to CloudFormation. +You can ignore some errors by specifying the `ignoreErrorCodesMatching` property, which accepts a regular expression that is +tested against the `code` property of the response. If matched, a "SUCCESS" response is submitted. +Note that in such a case, the call response data and the `Data` key submitted to CloudFormation would both be an empty JSON object. +Since a successful resource provisioning might or might not produce outputs, this presents us with some limitations: + +* `PhysicalResourceId.fromResponse` - Since the call response data might be empty, we cannot use it to extract the physical id. +* `getResponseField` and `getResponseFieldReference` - Since the `Data` key is empty, the resource will not have any attributes, and therefore, invoking these functions will result in an error. + +In both the cases, you will get a synth time error if you attempt to use it in conjunction with `ignoreErrorCodesMatching`. + +### Customizing the Lambda function implementing the custom resource + +Use the `role`, `timeout`, `logRetention` and `functionName` properties to customize +the Lambda function implementing the custom resource: + +```ts +declare const myRole: iam.Role; +new cr.AwsCustomResource(this, 'Customized', { + role: myRole, // must be assumable by the `lambda.amazonaws.com` service principal + timeout: Duration.minutes(10), // defaults to 2 minutes + logRetention: logs.RetentionDays.ONE_WEEK, // defaults to never delete logs + functionName: 'my-custom-name', // defaults to a CloudFormation generated name + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}); +``` + +Additionally, the Lambda function can be placed in a private VPC by using the `vpc` +and `vpcSubnets` properties. + +```ts +declare const myVpc: ec2.Vpc; +new cr.AwsCustomResource(this, 'CustomizedInVpc', { + vpc, + vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_NAT }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + } +}) +``` + +Note that Lambda functions in a VPC +[require Network Address Translation (NAT) in order to access the internet][vpc-internet]. +The subnets specified in `vpcSubnets` must be private subnets. + +[vpc-internet]: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html#vpc-internet + +### Restricting the output of the Custom Resource + +CloudFormation imposes a hard limit of 4096 bytes for custom resources response +objects. If your API call returns an object that exceeds this limit, you can restrict +the data returned by the custom resource to specific paths in the API response: + +```ts +new cr.AwsCustomResource(this, 'ListObjects', { + onCreate: { + service: 's3', + action: 'listObjectsV2', + parameters: { + Bucket: 'my-bucket', + }, + physicalResourceId: cr.PhysicalResourceId.of('id'), + outputPaths: ['Contents.0.Key', 'Contents.1.Key'], // Output only the two first keys + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}); +``` + +Note that even if you restrict the output of your custom resource you can still use any +path in `PhysicalResourceId.fromResponse()`. + +### Custom Resource Examples + +#### Get the latest version of a secure SSM parameter + +```ts +const getParameter = new cr.AwsCustomResource(this, 'GetParameter', { + onUpdate: { // will also be called for a CREATE event + service: 'SSM', + action: 'getParameter', + parameters: { + Name: 'my-parameter', + WithDecryption: true, + }, + physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()), // Update physical id to always fetch the latest version + }, + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}); + +// Use the value in another construct with +getParameter.getResponseField('Parameter.Value'); +``` + +#### Associate a PrivateHostedZone with VPC shared from another account + +```ts +const getParameter = new cr.AwsCustomResource(this, 'AssociateVPCWithHostedZone', { + onCreate: { + assumedRoleArn: 'arn:aws:iam::OTHERACCOUNT:role/CrossAccount/ManageHostedZoneConnections', + service: 'Route53', + action: 'associateVPCWithHostedZone', + parameters: { + HostedZoneId: 'hz-123', + VPC: { + VPCId: 'vpc-123', + VPCRegion: 'region-for-vpc', + }, + }, + physicalResourceId: cr.PhysicalResourceId.of('${vpcStack.SharedVpc.VpcId}-${vpcStack.Region}-${PrivateHostedZone.HostedZoneId}'), + }, + //Will ignore any resource and use the assumedRoleArn as resource and 'sts:AssumeRole' for service:action + policy: cr.AwsCustomResourcePolicy.fromSdkCalls({ + resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE, + }), +}); +``` + +--- + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/aws-cdk-lib/custom-resources/index.ts b/packages/aws-cdk-lib/custom-resources/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts b/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts similarity index 98% rename from packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts rename to packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts index 4f323576ca461..2c9d160c56f0e 100644 --- a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts +++ b/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts @@ -1,12 +1,12 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { Annotations } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as logs from '../../../aws-logs'; +import * as cdk from '../../../core'; +import { Annotations } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct } from 'constructs'; import { PHYSICAL_RESOURCE_ID_REFERENCE } from './runtime'; diff --git a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/index.ts b/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/index.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/aws-custom-resource/index.ts rename to packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/index.ts diff --git a/packages/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts b/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/runtime/index.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.ts rename to packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/runtime/index.ts diff --git a/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/sdk-api-metadata.json b/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/sdk-api-metadata.json new file mode 100644 index 0000000000000..c1f19ce849b8e --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/lib/aws-custom-resource/sdk-api-metadata.json @@ -0,0 +1,1288 @@ +{ + "acm": { + "name": "ACM", + "cors": true + }, + "apigateway": { + "name": "APIGateway", + "cors": true + }, + "applicationautoscaling": { + "prefix": "application-autoscaling", + "name": "ApplicationAutoScaling", + "cors": true + }, + "appstream": { + "name": "AppStream" + }, + "autoscaling": { + "name": "AutoScaling", + "cors": true + }, + "batch": { + "name": "Batch" + }, + "budgets": { + "name": "Budgets" + }, + "clouddirectory": { + "name": "CloudDirectory", + "versions": [ + "2016-05-10*" + ] + }, + "cloudformation": { + "name": "CloudFormation", + "cors": true + }, + "cloudfront": { + "name": "CloudFront", + "versions": [ + "2013-05-12*", + "2013-11-11*", + "2014-05-31*", + "2014-10-21*", + "2014-11-06*", + "2015-04-17*", + "2015-07-27*", + "2015-09-17*", + "2016-01-13*", + "2016-01-28*", + "2016-08-01*", + "2016-08-20*", + "2016-09-07*", + "2016-09-29*", + "2016-11-25*", + "2017-03-25*", + "2017-10-30*", + "2018-06-18*", + "2018-11-05*", + "2019-03-26*" + ], + "cors": true + }, + "cloudhsm": { + "name": "CloudHSM", + "cors": true + }, + "cloudsearch": { + "name": "CloudSearch" + }, + "cloudsearchdomain": { + "name": "CloudSearchDomain" + }, + "cloudtrail": { + "name": "CloudTrail", + "cors": true + }, + "cloudwatch": { + "prefix": "monitoring", + "name": "CloudWatch", + "cors": true + }, + "cloudwatchevents": { + "prefix": "events", + "name": "CloudWatchEvents", + "versions": [ + "2014-02-03*" + ], + "cors": true + }, + "cloudwatchlogs": { + "prefix": "logs", + "name": "CloudWatchLogs", + "cors": true + }, + "codebuild": { + "name": "CodeBuild", + "cors": true + }, + "codecommit": { + "name": "CodeCommit", + "cors": true + }, + "codedeploy": { + "name": "CodeDeploy", + "cors": true + }, + "codepipeline": { + "name": "CodePipeline", + "cors": true + }, + "cognitoidentity": { + "prefix": "cognito-identity", + "name": "CognitoIdentity", + "cors": true + }, + "cognitoidentityserviceprovider": { + "prefix": "cognito-idp", + "name": "CognitoIdentityServiceProvider", + "cors": true + }, + "cognitosync": { + "prefix": "cognito-sync", + "name": "CognitoSync", + "cors": true + }, + "configservice": { + "prefix": "config", + "name": "ConfigService", + "cors": true + }, + "cur": { + "name": "CUR", + "cors": true + }, + "datapipeline": { + "name": "DataPipeline" + }, + "devicefarm": { + "name": "DeviceFarm", + "cors": true + }, + "directconnect": { + "name": "DirectConnect", + "cors": true + }, + "directoryservice": { + "prefix": "ds", + "name": "DirectoryService" + }, + "discovery": { + "name": "Discovery" + }, + "dms": { + "name": "DMS" + }, + "dynamodb": { + "name": "DynamoDB", + "cors": true + }, + "dynamodbstreams": { + "prefix": "streams.dynamodb", + "name": "DynamoDBStreams", + "cors": true + }, + "ec2": { + "name": "EC2", + "versions": [ + "2013-06-15*", + "2013-10-15*", + "2014-02-01*", + "2014-05-01*", + "2014-06-15*", + "2014-09-01*", + "2014-10-01*", + "2015-03-01*", + "2015-04-15*", + "2015-10-01*", + "2016-04-01*", + "2016-09-15*" + ], + "cors": true + }, + "ecr": { + "name": "ECR", + "cors": true + }, + "ecs": { + "name": "ECS", + "cors": true + }, + "efs": { + "prefix": "elasticfilesystem", + "name": "EFS", + "cors": true + }, + "elasticache": { + "name": "ElastiCache", + "versions": [ + "2012-11-15*", + "2014-03-24*", + "2014-07-15*", + "2014-09-30*" + ], + "cors": true + }, + "elasticbeanstalk": { + "name": "ElasticBeanstalk", + "cors": true + }, + "elb": { + "prefix": "elasticloadbalancing", + "name": "ELB", + "cors": true + }, + "elbv2": { + "prefix": "elasticloadbalancingv2", + "name": "ELBv2", + "cors": true + }, + "emr": { + "prefix": "elasticmapreduce", + "name": "EMR", + "cors": true + }, + "es": { + "name": "ES" + }, + "elastictranscoder": { + "name": "ElasticTranscoder", + "cors": true + }, + "firehose": { + "name": "Firehose", + "cors": true + }, + "gamelift": { + "name": "GameLift", + "cors": true + }, + "glacier": { + "name": "Glacier" + }, + "health": { + "name": "Health" + }, + "iam": { + "name": "IAM", + "cors": true + }, + "importexport": { + "name": "ImportExport" + }, + "inspector": { + "name": "Inspector", + "versions": [ + "2015-08-18*" + ], + "cors": true + }, + "iot": { + "name": "Iot", + "cors": true + }, + "iotdata": { + "prefix": "iot-data", + "name": "IotData", + "cors": true + }, + "kinesis": { + "name": "Kinesis", + "cors": true + }, + "kinesisanalytics": { + "name": "KinesisAnalytics" + }, + "kms": { + "name": "KMS", + "cors": true + }, + "lambda": { + "name": "Lambda", + "cors": true + }, + "lexruntime": { + "prefix": "runtime.lex", + "name": "LexRuntime", + "cors": true + }, + "lightsail": { + "name": "Lightsail" + }, + "machinelearning": { + "name": "MachineLearning", + "cors": true + }, + "marketplacecommerceanalytics": { + "name": "MarketplaceCommerceAnalytics", + "cors": true + }, + "marketplacemetering": { + "prefix": "meteringmarketplace", + "name": "MarketplaceMetering" + }, + "mturk": { + "prefix": "mturk-requester", + "name": "MTurk", + "cors": true + }, + "mobileanalytics": { + "name": "MobileAnalytics", + "cors": true + }, + "opsworks": { + "name": "OpsWorks", + "cors": true + }, + "opsworkscm": { + "name": "OpsWorksCM" + }, + "organizations": { + "name": "Organizations" + }, + "pinpoint": { + "name": "Pinpoint" + }, + "polly": { + "name": "Polly", + "cors": true + }, + "rds": { + "name": "RDS", + "versions": [ + "2014-09-01*" + ], + "cors": true + }, + "redshift": { + "name": "Redshift", + "cors": true + }, + "rekognition": { + "name": "Rekognition", + "cors": true + }, + "resourcegroupstaggingapi": { + "name": "ResourceGroupsTaggingAPI" + }, + "route53": { + "name": "Route53", + "cors": true + }, + "route53domains": { + "name": "Route53Domains", + "cors": true + }, + "s3": { + "name": "S3", + "dualstackAvailable": true, + "cors": true + }, + "s3control": { + "name": "S3Control", + "dualstackAvailable": true, + "xmlNoDefaultLists": true + }, + "servicecatalog": { + "name": "ServiceCatalog", + "cors": true + }, + "ses": { + "prefix": "email", + "name": "SES", + "cors": true + }, + "shield": { + "name": "Shield" + }, + "simpledb": { + "prefix": "sdb", + "name": "SimpleDB" + }, + "sms": { + "name": "SMS" + }, + "snowball": { + "name": "Snowball" + }, + "sns": { + "name": "SNS", + "cors": true + }, + "sqs": { + "name": "SQS", + "cors": true + }, + "ssm": { + "name": "SSM", + "cors": true + }, + "storagegateway": { + "name": "StorageGateway", + "cors": true + }, + "stepfunctions": { + "prefix": "states", + "name": "StepFunctions" + }, + "sts": { + "name": "STS", + "cors": true + }, + "support": { + "name": "Support" + }, + "swf": { + "name": "SWF" + }, + "xray": { + "name": "XRay", + "cors": true + }, + "waf": { + "name": "WAF", + "cors": true + }, + "wafregional": { + "prefix": "waf-regional", + "name": "WAFRegional" + }, + "workdocs": { + "name": "WorkDocs", + "cors": true + }, + "workspaces": { + "name": "WorkSpaces" + }, + "codestar": { + "name": "CodeStar" + }, + "lexmodelbuildingservice": { + "prefix": "lex-models", + "name": "LexModelBuildingService", + "cors": true + }, + "marketplaceentitlementservice": { + "prefix": "entitlement.marketplace", + "name": "MarketplaceEntitlementService" + }, + "athena": { + "name": "Athena", + "cors": true + }, + "greengrass": { + "name": "Greengrass" + }, + "dax": { + "name": "DAX" + }, + "migrationhub": { + "prefix": "AWSMigrationHub", + "name": "MigrationHub" + }, + "cloudhsmv2": { + "name": "CloudHSMV2", + "cors": true + }, + "glue": { + "name": "Glue" + }, + "mobile": { + "name": "Mobile" + }, + "pricing": { + "name": "Pricing", + "cors": true + }, + "costexplorer": { + "prefix": "ce", + "name": "CostExplorer", + "cors": true + }, + "mediaconvert": { + "name": "MediaConvert" + }, + "medialive": { + "name": "MediaLive" + }, + "mediapackage": { + "name": "MediaPackage" + }, + "mediastore": { + "name": "MediaStore" + }, + "mediastoredata": { + "prefix": "mediastore-data", + "name": "MediaStoreData", + "cors": true + }, + "appsync": { + "name": "AppSync" + }, + "guardduty": { + "name": "GuardDuty" + }, + "mq": { + "name": "MQ" + }, + "comprehend": { + "name": "Comprehend", + "cors": true + }, + "iotjobsdataplane": { + "prefix": "iot-jobs-data", + "name": "IoTJobsDataPlane" + }, + "kinesisvideoarchivedmedia": { + "prefix": "kinesis-video-archived-media", + "name": "KinesisVideoArchivedMedia", + "cors": true + }, + "kinesisvideomedia": { + "prefix": "kinesis-video-media", + "name": "KinesisVideoMedia", + "cors": true + }, + "kinesisvideo": { + "name": "KinesisVideo", + "cors": true + }, + "sagemakerruntime": { + "prefix": "runtime.sagemaker", + "name": "SageMakerRuntime" + }, + "sagemaker": { + "name": "SageMaker" + }, + "translate": { + "name": "Translate", + "cors": true + }, + "resourcegroups": { + "prefix": "resource-groups", + "name": "ResourceGroups", + "cors": true + }, + "alexaforbusiness": { + "name": "AlexaForBusiness" + }, + "cloud9": { + "name": "Cloud9" + }, + "serverlessapplicationrepository": { + "prefix": "serverlessrepo", + "name": "ServerlessApplicationRepository" + }, + "servicediscovery": { + "name": "ServiceDiscovery" + }, + "workmail": { + "name": "WorkMail" + }, + "autoscalingplans": { + "prefix": "autoscaling-plans", + "name": "AutoScalingPlans" + }, + "transcribeservice": { + "prefix": "transcribe", + "name": "TranscribeService" + }, + "connect": { + "name": "Connect", + "cors": true + }, + "acmpca": { + "prefix": "acm-pca", + "name": "ACMPCA" + }, + "fms": { + "name": "FMS" + }, + "secretsmanager": { + "name": "SecretsManager", + "cors": true + }, + "iotanalytics": { + "name": "IoTAnalytics", + "cors": true + }, + "iot1clickdevicesservice": { + "prefix": "iot1click-devices", + "name": "IoT1ClickDevicesService" + }, + "iot1clickprojects": { + "prefix": "iot1click-projects", + "name": "IoT1ClickProjects" + }, + "pi": { + "name": "PI" + }, + "neptune": { + "name": "Neptune" + }, + "mediatailor": { + "name": "MediaTailor" + }, + "eks": { + "name": "EKS" + }, + "macie": { + "name": "Macie" + }, + "dlm": { + "name": "DLM" + }, + "signer": { + "name": "Signer" + }, + "chime": { + "name": "Chime" + }, + "pinpointemail": { + "prefix": "pinpoint-email", + "name": "PinpointEmail" + }, + "ram": { + "name": "RAM" + }, + "route53resolver": { + "name": "Route53Resolver" + }, + "pinpointsmsvoice": { + "prefix": "sms-voice", + "name": "PinpointSMSVoice" + }, + "quicksight": { + "name": "QuickSight" + }, + "rdsdataservice": { + "prefix": "rds-data", + "name": "RDSDataService" + }, + "amplify": { + "name": "Amplify" + }, + "datasync": { + "name": "DataSync" + }, + "robomaker": { + "name": "RoboMaker" + }, + "transfer": { + "name": "Transfer" + }, + "globalaccelerator": { + "name": "GlobalAccelerator" + }, + "comprehendmedical": { + "name": "ComprehendMedical", + "cors": true + }, + "kinesisanalyticsv2": { + "name": "KinesisAnalyticsV2" + }, + "mediaconnect": { + "name": "MediaConnect" + }, + "fsx": { + "name": "FSx" + }, + "securityhub": { + "name": "SecurityHub" + }, + "appmesh": { + "name": "AppMesh", + "versions": [ + "2018-10-01*" + ] + }, + "licensemanager": { + "prefix": "license-manager", + "name": "LicenseManager" + }, + "kafka": { + "name": "Kafka" + }, + "apigatewaymanagementapi": { + "name": "ApiGatewayManagementApi" + }, + "apigatewayv2": { + "name": "ApiGatewayV2" + }, + "docdb": { + "name": "DocDB" + }, + "backup": { + "name": "Backup" + }, + "worklink": { + "name": "WorkLink" + }, + "textract": { + "name": "Textract" + }, + "managedblockchain": { + "name": "ManagedBlockchain" + }, + "mediapackagevod": { + "prefix": "mediapackage-vod", + "name": "MediaPackageVod" + }, + "groundstation": { + "name": "GroundStation" + }, + "iotthingsgraph": { + "name": "IoTThingsGraph" + }, + "iotevents": { + "name": "IoTEvents" + }, + "ioteventsdata": { + "prefix": "iotevents-data", + "name": "IoTEventsData" + }, + "personalize": { + "name": "Personalize", + "cors": true + }, + "personalizeevents": { + "prefix": "personalize-events", + "name": "PersonalizeEvents", + "cors": true + }, + "personalizeruntime": { + "prefix": "personalize-runtime", + "name": "PersonalizeRuntime", + "cors": true + }, + "applicationinsights": { + "prefix": "application-insights", + "name": "ApplicationInsights" + }, + "servicequotas": { + "prefix": "service-quotas", + "name": "ServiceQuotas" + }, + "ec2instanceconnect": { + "prefix": "ec2-instance-connect", + "name": "EC2InstanceConnect" + }, + "eventbridge": { + "name": "EventBridge" + }, + "lakeformation": { + "name": "LakeFormation" + }, + "forecastservice": { + "prefix": "forecast", + "name": "ForecastService", + "cors": true + }, + "forecastqueryservice": { + "prefix": "forecastquery", + "name": "ForecastQueryService", + "cors": true + }, + "qldb": { + "name": "QLDB" + }, + "qldbsession": { + "prefix": "qldb-session", + "name": "QLDBSession" + }, + "workmailmessageflow": { + "name": "WorkMailMessageFlow" + }, + "codestarnotifications": { + "prefix": "codestar-notifications", + "name": "CodeStarNotifications" + }, + "savingsplans": { + "name": "SavingsPlans" + }, + "sso": { + "name": "SSO" + }, + "ssooidc": { + "prefix": "sso-oidc", + "name": "SSOOIDC" + }, + "marketplacecatalog": { + "prefix": "marketplace-catalog", + "name": "MarketplaceCatalog", + "cors": true + }, + "dataexchange": { + "name": "DataExchange" + }, + "sesv2": { + "name": "SESV2" + }, + "migrationhubconfig": { + "prefix": "migrationhub-config", + "name": "MigrationHubConfig" + }, + "connectparticipant": { + "name": "ConnectParticipant" + }, + "appconfig": { + "name": "AppConfig" + }, + "iotsecuretunneling": { + "name": "IoTSecureTunneling" + }, + "wafv2": { + "name": "WAFV2" + }, + "elasticinference": { + "prefix": "elastic-inference", + "name": "ElasticInference" + }, + "imagebuilder": { + "name": "Imagebuilder" + }, + "schemas": { + "name": "Schemas" + }, + "accessanalyzer": { + "name": "AccessAnalyzer" + }, + "codegurureviewer": { + "prefix": "codeguru-reviewer", + "name": "CodeGuruReviewer" + }, + "codeguruprofiler": { + "name": "CodeGuruProfiler" + }, + "computeoptimizer": { + "prefix": "compute-optimizer", + "name": "ComputeOptimizer" + }, + "frauddetector": { + "name": "FraudDetector" + }, + "kendra": { + "name": "Kendra" + }, + "networkmanager": { + "name": "NetworkManager" + }, + "outposts": { + "name": "Outposts" + }, + "augmentedairuntime": { + "prefix": "sagemaker-a2i-runtime", + "name": "AugmentedAIRuntime" + }, + "ebs": { + "name": "EBS" + }, + "kinesisvideosignalingchannels": { + "prefix": "kinesis-video-signaling", + "name": "KinesisVideoSignalingChannels", + "cors": true + }, + "detective": { + "name": "Detective" + }, + "codestarconnections": { + "prefix": "codestar-connections", + "name": "CodeStarconnections" + }, + "synthetics": { + "name": "Synthetics" + }, + "iotsitewise": { + "name": "IoTSiteWise" + }, + "macie2": { + "name": "Macie2" + }, + "codeartifact": { + "name": "CodeArtifact" + }, + "honeycode": { + "name": "Honeycode" + }, + "ivs": { + "name": "IVS" + }, + "braket": { + "name": "Braket" + }, + "identitystore": { + "name": "IdentityStore" + }, + "appflow": { + "name": "Appflow" + }, + "redshiftdata": { + "prefix": "redshift-data", + "name": "RedshiftData" + }, + "ssoadmin": { + "prefix": "sso-admin", + "name": "SSOAdmin" + }, + "timestreamquery": { + "prefix": "timestream-query", + "name": "TimestreamQuery" + }, + "timestreamwrite": { + "prefix": "timestream-write", + "name": "TimestreamWrite" + }, + "s3outposts": { + "name": "S3Outposts" + }, + "databrew": { + "name": "DataBrew" + }, + "servicecatalogappregistry": { + "prefix": "servicecatalog-appregistry", + "name": "ServiceCatalogAppRegistry" + }, + "networkfirewall": { + "prefix": "network-firewall", + "name": "NetworkFirewall" + }, + "mwaa": { + "name": "MWAA" + }, + "amplifybackend": { + "name": "AmplifyBackend" + }, + "appintegrations": { + "name": "AppIntegrations" + }, + "connectcontactlens": { + "prefix": "connect-contact-lens", + "name": "ConnectContactLens" + }, + "devopsguru": { + "prefix": "devops-guru", + "name": "DevOpsGuru" + }, + "ecrpublic": { + "prefix": "ecr-public", + "name": "ECRPUBLIC" + }, + "lookoutvision": { + "name": "LookoutVision" + }, + "sagemakerfeaturestoreruntime": { + "prefix": "sagemaker-featurestore-runtime", + "name": "SageMakerFeatureStoreRuntime" + }, + "customerprofiles": { + "prefix": "customer-profiles", + "name": "CustomerProfiles" + }, + "auditmanager": { + "name": "AuditManager" + }, + "emrcontainers": { + "prefix": "emr-containers", + "name": "EMRcontainers" + }, + "healthlake": { + "name": "HealthLake" + }, + "sagemakeredge": { + "prefix": "sagemaker-edge", + "name": "SagemakerEdge" + }, + "amp": { + "name": "Amp" + }, + "greengrassv2": { + "name": "GreengrassV2" + }, + "iotdeviceadvisor": { + "name": "IotDeviceAdvisor" + }, + "iotfleethub": { + "name": "IoTFleetHub" + }, + "iotwireless": { + "name": "IoTWireless" + }, + "location": { + "name": "Location", + "cors": true + }, + "wellarchitected": { + "name": "WellArchitected" + }, + "lexmodelsv2": { + "prefix": "models.lex.v2", + "name": "LexModelsV2" + }, + "lexruntimev2": { + "prefix": "runtime.lex.v2", + "name": "LexRuntimeV2", + "cors": true + }, + "fis": { + "name": "Fis" + }, + "lookoutmetrics": { + "name": "LookoutMetrics" + }, + "mgn": { + "name": "Mgn" + }, + "lookoutequipment": { + "name": "LookoutEquipment" + }, + "nimble": { + "name": "Nimble" + }, + "finspace": { + "name": "Finspace" + }, + "finspacedata": { + "prefix": "finspace-data", + "name": "Finspacedata" + }, + "ssmcontacts": { + "prefix": "ssm-contacts", + "name": "SSMContacts" + }, + "ssmincidents": { + "prefix": "ssm-incidents", + "name": "SSMIncidents" + }, + "applicationcostprofiler": { + "name": "ApplicationCostProfiler" + }, + "apprunner": { + "name": "AppRunner" + }, + "proton": { + "name": "Proton" + }, + "route53recoverycluster": { + "prefix": "route53-recovery-cluster", + "name": "Route53RecoveryCluster" + }, + "route53recoverycontrolconfig": { + "prefix": "route53-recovery-control-config", + "name": "Route53RecoveryControlConfig" + }, + "route53recoveryreadiness": { + "prefix": "route53-recovery-readiness", + "name": "Route53RecoveryReadiness" + }, + "chimesdkidentity": { + "prefix": "chime-sdk-identity", + "name": "ChimeSDKIdentity" + }, + "chimesdkmessaging": { + "prefix": "chime-sdk-messaging", + "name": "ChimeSDKMessaging" + }, + "snowdevicemanagement": { + "prefix": "snow-device-management", + "name": "SnowDeviceManagement" + }, + "memorydb": { + "name": "MemoryDB" + }, + "opensearch": { + "name": "OpenSearch" + }, + "kafkaconnect": { + "name": "KafkaConnect" + }, + "voiceid": { + "prefix": "voice-id", + "name": "VoiceID" + }, + "wisdom": { + "name": "Wisdom" + }, + "account": { + "name": "Account" + }, + "cloudcontrol": { + "name": "CloudControl" + }, + "grafana": { + "name": "Grafana" + }, + "panorama": { + "name": "Panorama" + }, + "chimesdkmeetings": { + "prefix": "chime-sdk-meetings", + "name": "ChimeSDKMeetings" + }, + "resiliencehub": { + "name": "Resiliencehub" + }, + "migrationhubstrategy": { + "name": "MigrationHubStrategy" + }, + "appconfigdata": { + "name": "AppConfigData" + }, + "drs": { + "name": "Drs" + }, + "migrationhubrefactorspaces": { + "prefix": "migration-hub-refactor-spaces", + "name": "MigrationHubRefactorSpaces" + }, + "evidently": { + "name": "Evidently" + }, + "inspector2": { + "name": "Inspector2" + }, + "rbin": { + "name": "Rbin" + }, + "rum": { + "name": "RUM" + }, + "backupgateway": { + "prefix": "backup-gateway", + "name": "BackupGateway" + }, + "iottwinmaker": { + "name": "IoTTwinMaker" + }, + "workspacesweb": { + "prefix": "workspaces-web", + "name": "WorkSpacesWeb" + }, + "amplifyuibuilder": { + "name": "AmplifyUIBuilder" + }, + "keyspaces": { + "name": "Keyspaces" + }, + "billingconductor": { + "name": "Billingconductor" + }, + "gamesparks": { + "name": "GameSparks" + }, + "pinpointsmsvoicev2": { + "prefix": "pinpoint-sms-voice-v2", + "name": "PinpointSMSVoiceV2" + }, + "ivschat": { + "name": "Ivschat" + }, + "chimesdkmediapipelines": { + "prefix": "chime-sdk-media-pipelines", + "name": "ChimeSDKMediaPipelines" + }, + "emrserverless": { + "prefix": "emr-serverless", + "name": "EMRServerless" + }, + "m2": { + "name": "M2" + }, + "connectcampaigns": { + "name": "ConnectCampaigns" + }, + "redshiftserverless": { + "prefix": "redshift-serverless", + "name": "RedshiftServerless" + }, + "rolesanywhere": { + "name": "RolesAnywhere" + }, + "licensemanagerusersubscriptions": { + "prefix": "license-manager-user-subscriptions", + "name": "LicenseManagerUserSubscriptions" + }, + "backupstorage": { + "name": "BackupStorage" + }, + "privatenetworks": { + "name": "PrivateNetworks" + }, + "supportapp": { + "prefix": "support-app", + "name": "SupportApp" + }, + "controltower": { + "name": "ControlTower" + }, + "iotfleetwise": { + "name": "IoTFleetWise" + }, + "migrationhuborchestrator": { + "name": "MigrationHubOrchestrator" + }, + "connectcases": { + "name": "ConnectCases" + }, + "resourceexplorer2": { + "prefix": "resource-explorer-2", + "name": "ResourceExplorer2" + }, + "scheduler": { + "name": "Scheduler" + }, + "chimesdkvoice": { + "prefix": "chime-sdk-voice", + "name": "ChimeSDKVoice" + }, + "iotroborunner": { + "prefix": "iot-roborunner", + "name": "IoTRoboRunner" + }, + "ssmsap": { + "prefix": "ssm-sap", + "name": "SsmSap" + }, + "oam": { + "name": "OAM" + }, + "arczonalshift": { + "prefix": "arc-zonal-shift", + "name": "ARCZonalShift" + }, + "omics": { + "name": "Omics" + }, + "opensearchserverless": { + "name": "OpenSearchServerless" + }, + "securitylake": { + "name": "SecurityLake" + }, + "simspaceweaver": { + "name": "SimSpaceWeaver" + }, + "docdbelastic": { + "prefix": "docdb-elastic", + "name": "DocDBElastic" + }, + "sagemakergeospatial": { + "prefix": "sagemaker-geospatial", + "name": "SageMakerGeospatial" + }, + "codecatalyst": { + "name": "CodeCatalyst" + }, + "pipes": { + "name": "Pipes" + }, + "sagemakermetrics": { + "prefix": "sagemaker-metrics", + "name": "SageMakerMetrics" + }, + "kinesisvideowebrtcstorage": { + "prefix": "kinesis-video-webrtc-storage", + "name": "KinesisVideoWebRTCStorage" + }, + "licensemanagerlinuxsubscriptions": { + "prefix": "license-manager-linux-subscriptions", + "name": "LicenseManagerLinuxSubscriptions" + }, + "kendraranking": { + "prefix": "kendra-ranking", + "name": "KendraRanking" + }, + "cleanrooms": { + "name": "CleanRooms" + }, + "cloudtraildata": { + "prefix": "cloudtrail-data", + "name": "CloudTrailData" + }, + "tnb": { + "name": "Tnb" + }, + "internetmonitor": { + "name": "InternetMonitor" + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/custom-resources/lib/index.ts b/packages/aws-cdk-lib/custom-resources/lib/index.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/index.ts rename to packages/aws-cdk-lib/custom-resources/lib/index.ts diff --git a/packages/aws-cdk-lib/custom-resources/lib/provider-framework/index.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/index.ts new file mode 100644 index 0000000000000..03be03e588e4a --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/index.ts @@ -0,0 +1 @@ +export * from './provider'; diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/provider.ts similarity index 96% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/provider.ts index 1f48b3801bad9..15a542d45f49f 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/provider.ts +++ b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/provider.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import { CustomResourceProviderConfig, ICustomResourceProvider } from '@aws-cdk/aws-cloudformation'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import { Duration } from '@aws-cdk/core'; +import { CustomResourceProviderConfig, ICustomResourceProvider } from '../../../aws-cloudformation'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as logs from '../../../aws-logs'; +import { Duration } from '../../../core'; import { Construct } from 'constructs'; import * as consts from './runtime/consts'; import { calculateRetryPolicy } from './util'; diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/cfn-response.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/cfn-response.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/cfn-response.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/cfn-response.ts diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/consts.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/consts.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/consts.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/consts.ts diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/framework.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/framework.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/framework.ts diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/outbound.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/outbound.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/outbound.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/outbound.ts diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/util.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/util.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/runtime/util.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/runtime/util.ts diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/types.d.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/types.d.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/types.d.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/types.d.ts diff --git a/packages/aws-cdk-lib/custom-resources/lib/provider-framework/util.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/util.ts new file mode 100644 index 0000000000000..7c50158849be9 --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/util.ts @@ -0,0 +1,20 @@ +import { Duration } from '../../../core'; + +const DEFAULT_TIMEOUT = Duration.minutes(30); +const DEFAULT_INTERVAL = Duration.seconds(5); + +export function calculateRetryPolicy(props: { totalTimeout?: Duration, queryInterval?: Duration } = { }) { + const totalTimeout = props.totalTimeout || DEFAULT_TIMEOUT; + const interval = props.queryInterval || DEFAULT_INTERVAL; + const maxAttempts = totalTimeout.toSeconds() / interval.toSeconds(); + + if (Math.round(maxAttempts) !== maxAttempts) { + throw new Error(`Cannot determine retry count since totalTimeout=${totalTimeout.toSeconds()}s is not integrally dividable by queryInterval=${interval.toSeconds()}s`); + } + + return { + maxAttempts, + interval, + backoffRate: 1, + }; +} diff --git a/packages/@aws-cdk/custom-resources/lib/provider-framework/waiter-state-machine.ts b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/waiter-state-machine.ts similarity index 93% rename from packages/@aws-cdk/custom-resources/lib/provider-framework/waiter-state-machine.ts rename to packages/aws-cdk-lib/custom-resources/lib/provider-framework/waiter-state-machine.ts index 90d2fd34dcf9a..da28ec6740d3e 100644 --- a/packages/@aws-cdk/custom-resources/lib/provider-framework/waiter-state-machine.ts +++ b/packages/aws-cdk-lib/custom-resources/lib/provider-framework/waiter-state-machine.ts @@ -1,6 +1,6 @@ -import { Grant, IGrantable, Role, ServicePrincipal } from '@aws-cdk/aws-iam'; -import { IFunction } from '@aws-cdk/aws-lambda'; -import { CfnResource, Duration, Stack } from '@aws-cdk/core'; +import { Grant, IGrantable, Role, ServicePrincipal } from '../../../aws-iam'; +import { IFunction } from '../../../aws-lambda'; +import { CfnResource, Duration, Stack } from '../../../core'; import { Construct } from 'constructs'; export interface WaiterStateMachineProps { diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts b/packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts rename to packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/aws-custom-resource-provider.test.ts diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts b/packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts similarity index 99% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts rename to packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts index 4abe91ce97038..b26c9fae1beaa 100644 --- a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts +++ b/packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/aws-custom-resource.test.ts @@ -1,9 +1,9 @@ -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as logs from '@aws-cdk/aws-logs'; -import * as cdk from '@aws-cdk/core'; -import { App, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as logs from '../../../aws-logs'; +import * as cdk from '../../../core'; +import { App, Stack } from '../../../core'; import { AwsCustomResource, AwsCustomResourcePolicy, PhysicalResourceId, PhysicalResourceIdReference } from '../../lib'; /* eslint-disable quote-props */ diff --git a/packages/@aws-cdk/custom-resources/test/aws-custom-resource/runtime/index.test.ts b/packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/runtime/index.test.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/aws-custom-resource/runtime/index.test.ts rename to packages/aws-cdk-lib/custom-resources/test/aws-custom-resource/runtime/index.test.ts diff --git a/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py new file mode 100644 index 0000000000000..0f99bdca49aa9 --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert-handler/index.py @@ -0,0 +1,44 @@ +import boto3 + +s3 = boto3.client('s3') + +def on_event(event, ctx): + print(event) + return { + 'ArbitraryField': 12345 + } + +def is_complete(event, ctx): + print(event) + + # verify result from on_event is passed through + if event.get('ArbitraryField', None) != 12345: + raise 'Error: expecting "event" to include "ArbitraryField" with value 12345' + + # nothing to assert if this resource is being deleted + if event['RequestType'] == 'Delete': + return { 'IsComplete': True } + + props = event['ResourceProperties'] + bucket_name = props['BucketName'] + object_key = props['ObjectKey'] + expected_content = props['ExpectedContent'] + + print("reading content from s3://%s/%s" % (bucket_name, object_key)) + content = None + try: + result = s3.get_object(Bucket=bucket_name, Key=object_key) + content = result['Body'].read().decode('utf-8') + except s3.exceptions.NoSuchKey: + print("file not found") + pass + + print("actual content: %s" % content) + print("expected content: %s" % expected_content) + + is_equal = content == expected_content + + if is_equal: + print("s3 content matches expected") + + return { 'IsComplete': is_equal } diff --git a/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts new file mode 100644 index 0000000000000..9cca6d2c436ab --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-assert.ts @@ -0,0 +1,95 @@ +import * as path from 'path'; +import * as iam from '../../../../aws-iam'; +import * as lambda from '../../../../aws-lambda'; +import * as s3 from '../../../../aws-s3'; +import { CustomResource, Duration, Stack } from '../../../../core'; +import { Construct, Node } from 'constructs'; +import * as cr from '../../../lib'; + +export interface S3AssertProps { + /** + * The s3 bucket to query. + */ + readonly bucket: s3.IBucket; + + /** + * The object key. + */ + readonly objectKey: string; + + /** + * The expected contents. + */ + readonly expectedContent: string; +} + +/** + * A custom resource that asserts that a file on s3 has the specified contents. + * This resource will wait 10 minutes before, allowing for eventual consistency + * to stabilize (and also exercises the idea of asynchronous custom resources). + * + * Code is written in Python because why not. + */ +export class S3Assert extends Construct { + + constructor(scope: Construct, id: string, props: S3AssertProps) { + super(scope, id); + + new CustomResource(this, 'Resource', { + serviceToken: S3AssertProvider.getOrCreate(this), + resourceType: 'Custom::S3Assert', + properties: { + BucketName: props.bucket.bucketName, + ObjectKey: props.objectKey, + ExpectedContent: props.expectedContent, + }, + }); + } +} + +class S3AssertProvider extends Construct { + + /** + * Returns the singleton provider. + */ + public static getOrCreate(scope: Construct) { + const providerId = 'com.amazonaws.cdk.custom-resources.s3assert-provider'; + const stack = Stack.of(scope); + const group = Node.of(stack).tryFindChild(providerId) as S3AssertProvider || new S3AssertProvider(stack, providerId); + return group.provider.serviceToken; + } + + private readonly provider: cr.Provider; + + constructor(scope: Construct, id: string) { + super(scope, id); + + const onEvent = new lambda.Function(this, 's3assert-on-event', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.on_event', + }); + + const isComplete = new lambda.Function(this, 's3assert-is-complete', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-assert-handler')), + runtime: lambda.Runtime.PYTHON_3_7, + handler: 'index.is_complete', + initialPolicy: [ + new iam.PolicyStatement({ + resources: ['*'], + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + ], + }), + ], + }); + + this.provider = new cr.Provider(this, 's3assert-provider', { + onEventHandler: onEvent, + isCompleteHandler: isComplete, + totalTimeout: Duration.minutes(5), + }); + } +} diff --git a/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts new file mode 100644 index 0000000000000..79b07bda5a43b --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/api.ts @@ -0,0 +1,8 @@ +export const PROP_BUCKET_NAME = 'BucketName'; +export const PROP_OBJECT_KEY = 'ObjectKey'; +export const PROP_CONTENTS = 'Contents'; +export const PROP_PUBLIC = 'PublicRead'; + +export const ATTR_ETAG = 'ETag'; +export const ATTR_URL = 'URL'; +export const ATTR_OBJECT_KEY = 'ObjectKey'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file-handler/index.ts diff --git a/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts new file mode 100644 index 0000000000000..9f8baedcdacd2 --- /dev/null +++ b/packages/aws-cdk-lib/custom-resources/test/provider-framework/integration-test-fixtures/s3-file.ts @@ -0,0 +1,99 @@ +import * as path from 'path'; +import * as iam from '../../../../aws-iam'; +import * as lambda from '../../../../aws-lambda'; +import * as s3 from '../../../../aws-s3'; +import { CustomResource, Stack } from '../../../../core'; +import { Construct, Node } from 'constructs'; +import * as api from './s3-file-handler/api'; +import * as cr from '../../../lib'; + +interface S3FileProps { + /** + * The bucket in which the file will be created. + */ + readonly bucket: s3.IBucket; + + /** + * The object key. + * + * @default - automatically-generated + */ + readonly objectKey?: string; + + /** + * The contents of the file. + */ + readonly contents: string; + + /** + * Indicates if this file should have public-read permissions. + * + * @default false + */ + readonly public?: boolean; +} + +export class S3File extends Construct { + public readonly objectKey: string; + public readonly url: string; + public readonly etag: string; + + constructor(scope: Construct, id: string, props: S3FileProps) { + super(scope, id); + + const resource = new CustomResource(this, 'Resource', { + serviceToken: S3FileProvider.getOrCreate(this), + resourceType: 'Custom::S3File', + properties: { + [api.PROP_BUCKET_NAME]: props.bucket.bucketName, + [api.PROP_CONTENTS]: props.contents, + [api.PROP_OBJECT_KEY]: props.objectKey, + [api.PROP_PUBLIC]: props.public, + }, + }); + + this.objectKey = resource.getAttString(api.ATTR_OBJECT_KEY); + this.url = resource.getAttString(api.ATTR_URL); + this.etag = resource.getAttString(api.ATTR_ETAG); + } +} + +class S3FileProvider extends Construct { + + /** + * Returns the singleton provider. + */ + public static getOrCreate(scope: Construct) { + const stack = Stack.of(scope); + const id = 'com.amazonaws.cdk.custom-resources.s3file-provider'; + const x = Node.of(stack).tryFindChild(id) as S3FileProvider || new S3FileProvider(stack, id); + return x.provider.serviceToken; + } + + private readonly provider: cr.Provider; + + constructor(scope: Construct, id: string) { + super(scope, id); + + this.provider = new cr.Provider(this, 's3file-provider', { + onEventHandler: new lambda.Function(this, 's3file-on-event', { + code: lambda.Code.fromAsset(path.join(__dirname, 's3-file-handler')), + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.onEvent', + initialPolicy: [ + new iam.PolicyStatement({ + resources: ['*'], + actions: [ + 's3:GetObject*', + 's3:GetBucket*', + 's3:List*', + 's3:DeleteObject*', + 's3:PutObject*', + 's3:Abort*', + ], + }), + ], + }), + }); + } +} diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/mocks.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/mocks.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/mocks.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/mocks.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/outbound.test.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/outbound.test.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/outbound.test.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/outbound.test.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/provider.test.ts similarity index 97% rename from packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/provider.test.ts index 290a79abbe7e6..0a69d13b1f0ce 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/provider.test.ts +++ b/packages/aws-cdk-lib/custom-resources/test/provider-framework/provider.test.ts @@ -1,10 +1,10 @@ import * as path from 'path'; -import { Template } from '@aws-cdk/assertions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as logs from '@aws-cdk/aws-logs'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import * as logs from '../../../aws-logs'; +import { Duration, Stack } from '../../../core'; import * as cr from '../../lib'; import * as util from '../../lib/provider-framework/util'; diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/runtime.test.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/runtime.test.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/runtime.test.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/runtime.test.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/util.test.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/util.test.ts similarity index 100% rename from packages/@aws-cdk/custom-resources/test/provider-framework/util.test.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/util.test.ts diff --git a/packages/@aws-cdk/custom-resources/test/provider-framework/waiter-state-machine.test.ts b/packages/aws-cdk-lib/custom-resources/test/provider-framework/waiter-state-machine.test.ts similarity index 95% rename from packages/@aws-cdk/custom-resources/test/provider-framework/waiter-state-machine.test.ts rename to packages/aws-cdk-lib/custom-resources/test/provider-framework/waiter-state-machine.test.ts index fb23819791a97..2f010529b5021 100644 --- a/packages/@aws-cdk/custom-resources/test/provider-framework/waiter-state-machine.test.ts +++ b/packages/aws-cdk-lib/custom-resources/test/provider-framework/waiter-state-machine.test.ts @@ -1,6 +1,6 @@ -import { Template } from '@aws-cdk/assertions'; -import { Code, Function as lambdaFn, Runtime } from '@aws-cdk/aws-lambda'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template } from '../../../assertions'; +import { Code, Function as lambdaFn, Runtime } from '../../../aws-lambda'; +import { Duration, Stack } from '../../../core'; import { Node } from 'constructs'; import { WaiterStateMachine } from '../../lib/provider-framework/waiter-state-machine'; diff --git a/packages/aws-cdk-lib/cx-api/.jsiirc.json b/packages/aws-cdk-lib/cx-api/.jsiirc.json new file mode 100644 index 0000000000000..ed32b289fd20d --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.cxapi" + }, + "dotnet": { + "namespace": "Amazon.CDK.CXAPI" + }, + "python": { + "module": "aws_cdk.cx_api" + } + } +} diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md new file mode 100644 index 0000000000000..8162a400fa326 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -0,0 +1,925 @@ +# CDK Feature Flags + +[CDK Feature Flags](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html) are a mechanism that allows the CDK to evolve and change the behavior of certain classes and methods, without causing disruption to existing deployed infrastructure. + +Feature flags are [context values](https://docs.aws.amazon.com/cdk/v2/guide/context.html) and can be configured using any of the context management methods, at any level of the construct tree. Commonly, they are specified in the `cdk.json` file. +`cdk init` will create new CDK projects with a `cdk.json` file containing all recommended feature flags enabled. + +## Current list of feature flags + +Flags come in three types: + +- **Default change**: The default behavior of an API has been changed in order to improve its ergonomics. The old behavior can still be achieved, but requires source changes. +- **Fix/deprecation**: The old behavior was incorrect or not recommended for new users. The only way to keep it is to not set this flag. +- **Config**: Configurable behavior that we recommend you turn on. + + + +| Flag | Summary | Since | Type | +| ----- | ----- | ----- | ----- | +| [@aws-cdk/aws-route53-patters:useCertificate](#aws-cdkaws-route53-pattersusecertificate) | Use the official `Certificate` resource instead of `DnsValidatedCertificate` | V2·NEXT | (default) | +| [@aws-cdk/core:newStyleStackSynthesis](#aws-cdkcorenewstylestacksynthesis) | Switch to new stack synthesis method which enables CI/CD | 2.0.0 | (fix) | +| [@aws-cdk/core:stackRelativeExports](#aws-cdkcorestackrelativeexports) | Name exports based on the construct paths relative to the stack, rather than the global construct path | 2.0.0 | (fix) | +| [@aws-cdk/aws-rds:lowercaseDbIdentifier](#aws-cdkaws-rdslowercasedbidentifier) | Force lowercasing of RDS Cluster names in CDK | 2.0.0 | (fix) | +| [@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId](#aws-cdkaws-apigatewayusageplankeyorderinsensitiveid) | Allow adding/removing multiple UsagePlanKeys independently | 2.0.0 | (fix) | +| [@aws-cdk/aws-lambda:recognizeVersionProps](#aws-cdkaws-lambdarecognizeversionprops) | Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`. | 2.0.0 | (fix) | +| [@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2\_2021](#aws-cdkaws-cloudfrontdefaultsecuritypolicytlsv12_2021) | Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default. | 2.0.0 | (fix) | +| [@aws-cdk/core:target-partitions](#aws-cdkcoretarget-partitions) | What regions to include in lookup tables of environment agnostic stacks | 2.4.0 | (config) | +| [@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver](#aws-cdk-containersecs-service-extensionsenabledefaultlogdriver) | ECS extensions will automatically add an `awslogs` driver if no logging is specified | 2.8.0 | (default) | +| [@aws-cdk/aws-ec2:uniqueImdsv2TemplateName](#aws-cdkaws-ec2uniqueimdsv2templatename) | Enable this feature flag to have Launch Templates generated by the `InstanceRequireImdsv2Aspect` use unique names. | 2.8.0 | (fix) | +| [@aws-cdk/aws-iam:minimizePolicies](#aws-cdkaws-iamminimizepolicies) | Minimize IAM policies by combining Statements | 2.18.0 | (config) | +| [@aws-cdk/core:checkSecretUsage](#aws-cdkcorechecksecretusage) | Enable this flag to make it impossible to accidentally use SecretValues in unsafe locations | 2.21.0 | (config) | +| [@aws-cdk/aws-lambda:recognizeLayerVersion](#aws-cdkaws-lambdarecognizelayerversion) | Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`. | 2.27.0 | (fix) | +| [@aws-cdk/core:validateSnapshotRemovalPolicy](#aws-cdkcorevalidatesnapshotremovalpolicy) | Error on snapshot removal policies on resources that do not support it. | 2.28.0 | (default) | +| [@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName](#aws-cdkaws-codepipelinecrossaccountkeyaliasstacksaferesourcename) | Generate key aliases that include the stack name | 2.29.0 | (fix) | +| [@aws-cdk/aws-s3:createDefaultLoggingPolicy](#aws-cdkaws-s3createdefaultloggingpolicy) | Enable this feature flag to create an S3 bucket policy by default in cases where an AWS service would automatically create the Policy if one does not exist. | 2.31.0 | (fix) | +| [@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption](#aws-cdkaws-sns-subscriptionsrestrictsqsdescryption) | Restrict KMS key policy for encrypted Queues a bit more | 2.32.0 | (fix) | +| [@aws-cdk/aws-ecs:arnFormatIncludesClusterName](#aws-cdkaws-ecsarnformatincludesclustername) | ARN format used by ECS. In the new ARN format, the cluster name is part of the resource ID. | 2.35.0 | (fix) | +| [@aws-cdk/aws-apigateway:disableCloudWatchRole](#aws-cdkaws-apigatewaydisablecloudwatchrole) | Make default CloudWatch Role behavior safe for multiple API Gateways in one environment | 2.38.0 | (fix) | +| [@aws-cdk/core:enablePartitionLiterals](#aws-cdkcoreenablepartitionliterals) | Make ARNs concrete if AWS partition is known | 2.38.0 | (fix) | +| [@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker](#aws-cdkaws-ecsdisableexplicitdeploymentcontrollerforcircuitbreaker) | Avoid setting the "ECS" deployment controller when adding a circuit breaker | 2.51.0 | (fix) | +| [@aws-cdk/aws-events:eventsTargetQueueSameAccount](#aws-cdkaws-eventseventstargetqueuesameaccount) | Event Rules may only push to encrypted SQS queues in the same account | 2.51.0 | (fix) | +| [@aws-cdk/aws-iam:standardizedServicePrincipals](#aws-cdkaws-iamstandardizedserviceprincipals) | Use standardized (global) service principals everywhere | 2.51.0 | (fix) | +| [@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy](#aws-cdkaws-s3serveraccesslogsusebucketpolicy) | Use S3 Bucket Policy instead of ACLs for Server Access Logging | 2.59.0 | (fix) | +| [@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName](#aws-cdkaws-iamimportedrolestacksafedefaultpolicyname) | Enable this feature to by default create default policy names for imported roles that depend on the stack the role is in. | 2.60.0 | (fix) | +| [@aws-cdk/customresources:installLatestAwsSdkDefault](#aws-cdkcustomresourcesinstalllatestawssdkdefault) | Whether to install the latest SDK by default in AwsCustomResource | 2.60.0 | (default) | +| [@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup](#aws-cdkaws-codedeployremovealarmsfromdeploymentgroup) | Remove CloudWatch alarms from deployment group | 2.65.0 | (fix) | +| [@aws-cdk/aws-rds:databaseProxyUniqueResourceName](#aws-cdkaws-rdsdatabaseproxyuniqueresourcename) | Use unique resource name for Database Proxy | 2.65.0 | (fix) | +| [@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId](#aws-cdkaws-apigatewayauthorizerchangedeploymentlogicalid) | Include authorizer configuration in the calculation of the API deployment logical ID. | 2.66.0 | (fix) | +| [@aws-cdk/aws-ec2:launchTemplateDefaultUserData](#aws-cdkaws-ec2launchtemplatedefaultuserdata) | Define user data for a launch template by default when a machine image is provided. | 2.67.0 | (fix) | +| [@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments](#aws-cdkaws-secretsmanageruseattachedsecretresourcepolicyforsecrettargetattachments) | SecretTargetAttachments uses the ResourcePolicy of the attached Secret. | 2.67.0 | (fix) | +| [@aws-cdk/aws-redshift:columnId](#aws-cdkaws-redshiftcolumnid) | Whether to use an ID to track Redshift column changes | 2.68.0 | (fix) | +| [@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2](#aws-cdkaws-stepfunctions-tasksenableemrservicepolicyv2) | Enable AmazonEMRServicePolicy_v2 managed policies | 2.72.0 | (fix) | + + + +## Currently recommended cdk.json + +The following json shows the current recommended set of flags, as `cdk init` would generate it for new projects. + + +```json +{ + "context": { + "@aws-cdk/aws-lambda:recognizeLayerVersion": true, + "@aws-cdk/core:checkSecretUsage": true, + "@aws-cdk/core:target-partitions": [ + "aws", + "aws-cn" + ], + "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, + "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, + "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, + "@aws-cdk/aws-iam:minimizePolicies": true, + "@aws-cdk/core:validateSnapshotRemovalPolicy": true, + "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, + "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, + "@aws-cdk/core:enablePartitionLiterals": true, + "@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, + "@aws-cdk/aws-iam:standardizedServicePrincipals": true, + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, + "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true, + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true, + "@aws-cdk/aws-route53-patters:useCertificate": true, + "@aws-cdk/customresources:installLatestAwsSdkDefault": false, + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true, + "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true, + "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true, + "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, + "@aws-cdk/aws-redshift:columnId": true, + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true + } +} +``` + + +## Flags removed in v2 + +These **default change** flags have been removed in v2. These used to be configurable in v1, but in v2 their +behavior has become the default. Remove these from your `cdk.json` file. If the old behavior is important +for your infrastructure, see the flag's description on how to achieve it. + + + +| Flag | Summary | Type | Since | +| ----- | ----- | ----- | ----- | +| [@aws-cdk/core:enableStackNameDuplicates](#aws-cdkcoreenablestacknameduplicates) | Allow multiple stacks with the same name | (default) | 1.16.0 | +| [aws-cdk:enableDiffNoFail](#aws-cdkenablediffnofail) | Make `cdk diff` not fail when there are differences | (default) | 1.19.0 | +| [@aws-cdk/aws-ecr-assets:dockerIgnoreSupport](#aws-cdkaws-ecr-assetsdockerignoresupport) | DockerImageAsset properly supports `.dockerignore` files by default | (default) | 1.73.0 | +| [@aws-cdk/aws-secretsmanager:parseOwnedSecretName](#aws-cdkaws-secretsmanagerparseownedsecretname) | Fix the referencing of SecretsManager names from ARNs | (default) | 1.77.0 | +| [@aws-cdk/aws-kms:defaultKeyPolicies](#aws-cdkaws-kmsdefaultkeypolicies) | Tighten default KMS key policies | (default) | 1.78.0 | +| [@aws-cdk/aws-s3:grantWriteWithoutAcl](#aws-cdkaws-s3grantwritewithoutacl) | Remove `PutObjectAcl` from Bucket.grantWrite | (default) | 1.85.0 | +| [@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount](#aws-cdkaws-ecs-patternsremovedefaultdesiredcount) | Do not specify a default DesiredCount for ECS services | (default) | 1.92.0 | +| [@aws-cdk/aws-efs:defaultEncryptionAtRest](#aws-cdkaws-efsdefaultencryptionatrest) | Enable this feature flag to have elastic file systems encrypted at rest by default. | (default) | 1.98.0 | + + + +## Flags with a different default in v2 + +These **fix/deprecation** flags are still configurable in v2, but their default has changed compared to v1. If you +are migrating a v1 CDK project to v2, explicitly set any of these flags which does not currently appear in your +`cdk.json` to `false`, to avoid unexpected infrastructure changes. + + + +| Flag | Summary | Type | Since | v1 default | v2 default | +| ----- | ----- | ----- | ----- | ----- | ----- | +| [@aws-cdk/core:newStyleStackSynthesis](#aws-cdkcorenewstylestacksynthesis) | Switch to new stack synthesis method which enables CI/CD | (fix) | 1.39.0 | `false` | `true` | +| [@aws-cdk/core:stackRelativeExports](#aws-cdkcorestackrelativeexports) | Name exports based on the construct paths relative to the stack, rather than the global construct path | (fix) | 1.58.0 | `false` | `true` | +| [@aws-cdk/aws-rds:lowercaseDbIdentifier](#aws-cdkaws-rdslowercasedbidentifier) | Force lowercasing of RDS Cluster names in CDK | (fix) | 1.97.0 | `false` | `true` | +| [@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId](#aws-cdkaws-apigatewayusageplankeyorderinsensitiveid) | Allow adding/removing multiple UsagePlanKeys independently | (fix) | 1.98.0 | `false` | `true` | +| [@aws-cdk/aws-lambda:recognizeVersionProps](#aws-cdkaws-lambdarecognizeversionprops) | Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`. | (fix) | 1.106.0 | `false` | `true` | +| [@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2\_2021](#aws-cdkaws-cloudfrontdefaultsecuritypolicytlsv12_2021) | Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default. | (fix) | 1.117.0 | `false` | `true` | + + + +Here is an example of a `cdk.json` file that restores v1 behavior for these flags: + + +```json +{ + "context": { + "@aws-cdk/core:newStyleStackSynthesis": false, + "@aws-cdk/core:stackRelativeExports": false, + "@aws-cdk/aws-rds:lowercaseDbIdentifier": false, + "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": false, + "@aws-cdk/aws-lambda:recognizeVersionProps": false, + "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": false + } +} +``` + +## Feature flag details + +Here are more details about each of the flags: + + +### @aws-cdk/core:enableStackNameDuplicates + +*Allow multiple stacks with the same name* (default) + +If this is set, multiple stacks can use the same stack name (e.g. deployed to +different environments). This means that the name of the synthesized template +file will be based on the construct path and not on the defined `stackName` +of the stack. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.16.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Pass stack identifiers to the CLI instead of stack names. + + +### aws-cdk:enableDiffNoFail + +*Make `cdk diff` not fail when there are differences* (default) + +Determines what status code `cdk diff` should return when the specified stack +differs from the deployed stack or the local CloudFormation template: + +* `aws-cdk:enableDiffNoFail=true` => status code == 0 +* `aws-cdk:enableDiffNoFail=false` => status code == 1 + +You can override this behavior with the --fail flag: + +* `--fail` => status code == 1 +* `--no-fail` => status code == 0 + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.19.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Specify `--fail` to the CLI. + + +### @aws-cdk/aws-ecr-assets:dockerIgnoreSupport + +*DockerImageAsset properly supports `.dockerignore` files by default* (default) + +If this flag is not set, the default behavior for `DockerImageAsset` is to use +glob semantics for `.dockerignore` files. If this flag is set, the default behavior +is standard Docker ignore semantics. + +This is a feature flag as the old behavior was technically incorrect but +users may have come to depend on it. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.73.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Update your `.dockerignore` file to match standard Docker ignore rules, if necessary. + + +### @aws-cdk/aws-secretsmanager:parseOwnedSecretName + +*Fix the referencing of SecretsManager names from ARNs* (default) + +Secret.secretName for an "owned" secret will attempt to parse the secretName from the ARN, +rather than the default full resource name, which includes the SecretsManager suffix. + +If this flag is not set, Secret.secretName will include the SecretsManager suffix, which cannot be directly +used by SecretsManager.DescribeSecret, and must be parsed by the user first (e.g., Fn:Join, Fn:Select, Fn:Split). + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.77.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Use `parseArn(secret.secretName).resourceName` to emulate the incorrect old parsing. + + +### @aws-cdk/aws-kms:defaultKeyPolicies + +*Tighten default KMS key policies* (default) + +KMS Keys start with a default key policy that grants the account access to administer the key, +mirroring the behavior of the KMS SDK/CLI/Console experience. Users may override the default key +policy by specifying their own. + +If this flag is not set, the default key policy depends on the setting of the `trustAccountIdentities` +flag. If false (the default, for backwards-compatibility reasons), the default key policy somewhat +resembles the default admin key policy, but with the addition of 'GenerateDataKey' permissions. If +true, the policy matches what happens when this feature flag is set. + +Additionally, if this flag is not set and the user supplies a custom key policy, this will be appended +to the key's default policy (rather than replacing it). + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.78.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Pass `trustAccountIdentities: false` to `Key` construct to restore the old behavior. + + +### @aws-cdk/aws-s3:grantWriteWithoutAcl + +*Remove `PutObjectAcl` from Bucket.grantWrite* (default) + +Change the old 's3:PutObject*' permission to 's3:PutObject' on Bucket, +as the former includes 's3:PutObjectAcl', +which could be used to grant read/write object access to IAM principals in other accounts. +Use a feature flag to make sure existing customers who might be relying +on the overly-broad permissions are not broken. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.85.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Call `bucket.grantPutAcl()` in addition to `bucket.grantWrite()` to grant ACL permissions. + + +### @aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount + +*Do not specify a default DesiredCount for ECS services* (default) + +ApplicationLoadBalancedServiceBase, ApplicationMultipleTargetGroupServiceBase, +NetworkLoadBalancedServiceBase, NetworkMultipleTargetGroupServiceBase, and +QueueProcessingServiceBase currently determine a default value for the desired count of +a CfnService if a desiredCount is not provided. The result of this is that on every +deployment, the service count is reset to the fixed value, even if it was autoscaled. + +If this flag is not set, the default behaviour for CfnService.desiredCount is to set a +desiredCount of 1, if one is not provided. If true, a default will not be defined for +CfnService.desiredCount and as such desiredCount will be undefined, if one is not provided. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.92.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** You can pass `desiredCount: 1` explicitly, but you should never need this. + + +### @aws-cdk/aws-efs:defaultEncryptionAtRest + +*Enable this feature flag to have elastic file systems encrypted at rest by default.* (default) + +Encryption can also be configured explicitly using the `encrypted` property. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.98.0 | `false` | `true` | +| (default in v2) | `true` | | + +**Compatibility with old behavior:** Pass the `encrypted: false` property to the `FileSystem` construct to disable encryption. + + +### @aws-cdk/aws-route53-patters:useCertificate + +*Use the official `Certificate` resource instead of `DnsValidatedCertificate`* (default) + +Enable this feature flag to use the official CloudFormation supported `Certificate` resource instead +of the deprecated `DnsValidatedCertificate` construct. If this flag is enabled and you are creating +the stack in a region other than us-east-1 then you must also set `crossRegionReferences=true` on the +stack. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| V2·NEXT | `false` | `true` | + +**Compatibility with old behavior:** Define a `DnsValidatedCertificate` explicitly and pass in the `certificate` property + + +### @aws-cdk/core:newStyleStackSynthesis + +*Switch to new stack synthesis method which enables CI/CD* (fix) + +If this flag is specified, all `Stack`s will use the `DefaultStackSynthesizer` by +default. If it is not set, they will use the `LegacyStackSynthesizer`. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.39.0 | `false` | `true` | +| 2.0.0 | `true` | `true` | + + +### @aws-cdk/core:stackRelativeExports + +*Name exports based on the construct paths relative to the stack, rather than the global construct path* (fix) + +Combined with the stack name this relative construct path is good enough to +ensure uniqueness, and makes the export names robust against refactoring +the location of the stack in the construct tree (specifically, moving the Stack +into a Stage). + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.58.0 | `false` | `true` | +| 2.0.0 | `true` | `true` | + + +### @aws-cdk/aws-rds:lowercaseDbIdentifier + +*Force lowercasing of RDS Cluster names in CDK* (fix) + +Cluster names must be lowercase, and the service will lowercase the name when the cluster +is created. However, CDK did not use to know about this, and would use the user-provided name +referencing the cluster, which would fail if it happened to be mixed-case. + +With this flag, lowercase the name in CDK so we can reference it properly. + +Must be behind a permanent flag because changing a name from mixed case to lowercase between deployments +would lead CloudFormation to think the name was changed and would trigger a cluster replacement +(losing data!). + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.97.0 | `false` | `true` | +| 2.0.0 | `true` | `true` | + + +### @aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId + +*Allow adding/removing multiple UsagePlanKeys independently* (fix) + +The UsagePlanKey resource connects an ApiKey with a UsagePlan. API Gateway does not allow more than one UsagePlanKey +for any given UsagePlan and ApiKey combination. For this reason, CloudFormation cannot replace this resource without +either the UsagePlan or ApiKey changing. + +The feature addition to support multiple UsagePlanKey resources - 142bd0e2 - recognized this and attempted to keep +existing UsagePlanKey logical ids unchanged. +However, this intentionally caused the logical id of the UsagePlanKey to be sensitive to order. That is, when +the 'first' UsagePlanKey resource is removed, the logical id of the 'second' assumes what was originally the 'first', +which again is disallowed. + +In effect, there is no way to get out of this mess in a backwards compatible way, while supporting existing stacks. +This flag changes the logical id layout of UsagePlanKey to not be sensitive to order. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.98.0 | `false` | `true` | +| 2.0.0 | `true` | `true` | + + +### @aws-cdk/aws-lambda:recognizeVersionProps + +*Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.* (fix) + +The previous calculation incorrectly considered properties of the `AWS::Lambda::Function` resource that did +not constitute creating a new Version. + +See 'currentVersion' section in the aws-lambda module's README for more details. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.106.0 | `false` | `true` | +| 2.0.0 | `true` | `true` | + + +### @aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021 + +*Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default.* (fix) + +The security policy can also be configured explicitly using the `minimumProtocolVersion` property. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.117.0 | `false` | `true` | +| 2.0.0 | `true` | `true` | + + +### @aws-cdk/core:target-partitions + +*What regions to include in lookup tables of environment agnostic stacks* (config) + +Has no effect on stacks that have a defined region, but will limit the amount +of unnecessary regions included in stacks without a known region. + +The type of this value should be a list of strings. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.137.0 | `false` | `["aws","aws-cn"]` | +| 2.4.0 | `false` | `["aws","aws-cn"]` | + + +### @aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver + +*ECS extensions will automatically add an `awslogs` driver if no logging is specified* (default) + +Enable this feature flag to configure default logging behavior for the ECS Service Extensions. This will enable the +`awslogs` log driver for the application container of the service to send the container logs to CloudWatch Logs. + +This is a feature flag as the new behavior provides a better default experience for the users. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.140.0 | `false` | `true` | +| 2.8.0 | `false` | `true` | + +**Compatibility with old behavior:** Specify a log driver explicitly. + + +### @aws-cdk/aws-ec2:uniqueImdsv2TemplateName + +*Enable this feature flag to have Launch Templates generated by the `InstanceRequireImdsv2Aspect` use unique names.* (fix) + +Previously, the generated Launch Template names were only unique within a stack because they were based only on the +`Instance` construct ID. If another stack that has an `Instance` with the same construct ID is deployed in the same +account and region, the deployments would always fail as the generated Launch Template names were the same. + +The new implementation addresses this issue by generating the Launch Template name with the `Names.uniqueId` method. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.140.0 | `false` | `true` | +| 2.8.0 | `false` | `true` | + + +### @aws-cdk/aws-iam:minimizePolicies + +*Minimize IAM policies by combining Statements* (config) + +Minimize IAM policies by combining Principals, Actions and Resources of two +Statements in the policies, as long as it doesn't change the meaning of the +policy. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.150.0 | `false` | `true` | +| 2.18.0 | `false` | `true` | + + +### @aws-cdk/core:checkSecretUsage + +*Enable this flag to make it impossible to accidentally use SecretValues in unsafe locations* (config) + +With this flag enabled, `SecretValue` instances can only be passed to +constructs that accept `SecretValue`s; otherwise, `unsafeUnwrap()` must be +called to use it as a regular string. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.153.0 | `false` | `true` | +| 2.21.0 | `false` | `true` | + + +### @aws-cdk/aws-lambda:recognizeLayerVersion + +*Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.* (fix) + +This flag correct incorporates Lambda Layer properties into the Lambda Function Version. + +See 'currentVersion' section in the aws-lambda module's README for more details. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| 1.159.0 | `false` | `true` | +| 2.27.0 | `false` | `true` | + + +### @aws-cdk/core:validateSnapshotRemovalPolicy + +*Error on snapshot removal policies on resources that do not support it.* (default) + +Makes sure we do not allow snapshot removal policy on resources that do not support it. +If supplied on an unsupported resource, CloudFormation ignores the policy altogether. +This flag will reduce confusion and unexpected loss of data when erroneously supplying +the snapshot removal policy. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.28.0 | `false` | `true` | + +**Compatibility with old behavior:** The old behavior was incorrect. Update your source to not specify SNAPSHOT policies on resources that do not support it. + + +### @aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName + +*Generate key aliases that include the stack name* (fix) + +Enable this feature flag to have CodePipeline generate a unique cross account key alias name using the stack name. + +Previously, when creating multiple pipelines with similar naming conventions and when crossAccountKeys is true, +the KMS key alias name created for these pipelines may be the same due to how the uniqueId is generated. + +This new implementation creates a stack safe resource name for the alias using the stack name instead of the stack ID. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.29.0 | `false` | `true` | + + +### @aws-cdk/aws-s3:createDefaultLoggingPolicy + +*Enable this feature flag to create an S3 bucket policy by default in cases where an AWS service would automatically create the Policy if one does not exist.* (fix) + +For example, in order to send VPC flow logs to an S3 bucket, there is a specific Bucket Policy +that needs to be attached to the bucket. If you create the bucket without a policy and then add the +bucket as the flow log destination, the service will automatically create the bucket policy with the +necessary permissions. If you were to then try and add your own bucket policy CloudFormation will throw +and error indicating that a bucket policy already exists. + +In cases where we know what the required policy is we can go ahead and create the policy so we can +remain in control of it. + +@see https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-S3 + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.31.0 | `false` | `true` | + + +### @aws-cdk/aws-sns-subscriptions:restrictSqsDescryption + +*Restrict KMS key policy for encrypted Queues a bit more* (fix) + +Enable this feature flag to restrict the decryption of a SQS queue, which is subscribed to a SNS topic, to +only the topic which it is subscribed to and not the whole SNS service of an account. + +Previously the decryption was only restricted to the SNS service principal. To make the SQS subscription more +secure, it is a good practice to restrict the decryption further and only allow the connected SNS topic to decryption +the subscribed queue. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.32.0 | `false` | `true` | + + +### @aws-cdk/aws-ecs:arnFormatIncludesClusterName + +*ARN format used by ECS. In the new ARN format, the cluster name is part of the resource ID.* (fix) + +If this flag is not set, the old ARN format (without cluster name) for ECS is used. +If this flag is set, the new ARN format (with cluster name) for ECS is used. + +This is a feature flag as the old format is still valid for existing ECS clusters. + +See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.35.0 | `false` | `true` | + + +### @aws-cdk/aws-apigateway:disableCloudWatchRole + +*Make default CloudWatch Role behavior safe for multiple API Gateways in one environment* (fix) + +Enable this feature flag to change the default behavior for aws-apigateway.RestApi and aws-apigateway.SpecRestApi +to _not_ create a CloudWatch role and Account. There is only a single ApiGateway account per AWS +environment which means that each time you create a RestApi in your account the ApiGateway account +is overwritten. If at some point the newest RestApi is deleted, the ApiGateway Account and CloudWatch +role will also be deleted, breaking any existing ApiGateways that were depending on them. + +When this flag is enabled you should either create the ApiGateway account and CloudWatch role +separately _or_ only enable the cloudWatchRole on a single RestApi. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.38.0 | `false` | `true` | + + +### @aws-cdk/core:enablePartitionLiterals + +*Make ARNs concrete if AWS partition is known* (fix) + +Enable this feature flag to get partition names as string literals in Stacks with known regions defined in +their environment, such as "aws" or "aws-cn". Previously the CloudFormation intrinsic function +"Ref: AWS::Partition" was used. For example: + +```yaml +Principal: + AWS: + Fn::Join: + - "" + - - "arn:" + - Ref: AWS::Partition + - :iam::123456789876:root +``` + +becomes: + +```yaml +Principal: + AWS: "arn:aws:iam::123456789876:root" +``` + +The intrinsic function will still be used in Stacks where no region is defined or the region's partition +is unknown. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.38.0 | `false` | `true` | + + +### @aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker + +*Avoid setting the "ECS" deployment controller when adding a circuit breaker* (fix) + +Enable this feature flag to avoid setting the "ECS" deployment controller when adding a circuit breaker to an +ECS Service, as this will trigger a full replacement which fails to deploy when using set service names. +This does not change any behaviour as the default deployment controller when it is not defined is ECS. + +This is a feature flag as the new behavior provides a better default experience for the users. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.51.0 | `false` | `true` | + + +### @aws-cdk/aws-events:eventsTargetQueueSameAccount + +*Event Rules may only push to encrypted SQS queues in the same account* (fix) + +This flag applies to SQS Queues that are used as the target of event Rules. When enabled, only principals +from the same account as the Rule can send messages. If a queue is unencrypted, this restriction will +always apply, regardless of the value of this flag. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.51.0 | `false` | `true` | + + +### @aws-cdk/aws-iam:standardizedServicePrincipals + +*Use standardized (global) service principals everywhere* (fix) + +We used to maintain a database of exceptions to Service Principal names in various regions. This database +is no longer necessary: all service principals names have been standardized to their global form (`SERVICE.amazonaws.com`). + +This flag disables use of that exceptions database and always uses the global service principal. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.51.0 | `false` | `true` | + + +### @aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy + +*Use S3 Bucket Policy instead of ACLs for Server Access Logging* (fix) + +Enable this feature flag to use S3 Bucket Policy for granting permission fo Server Access Logging +rather than using the canned `LogDeliveryWrite` ACL. ACLs do not work when Object Ownership is +enabled on the bucket. + +This flag uses a Bucket Policy statement to allow Server Access Log delivery, following best +practices for S3. + +@see https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.59.0 | `false` | `true` | + + +### @aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName + +*Enable this feature to by default create default policy names for imported roles that depend on the stack the role is in.* (fix) + +Without this, importing the same role in multiple places could lead to the permissions given for one version of the imported role +to overwrite permissions given to the role at a different place where it was imported. This was due to all imported instances +of a role using the same default policy name. + +This new implementation creates default policy names based on the constructs node path in their stack. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.60.0 | `false` | `true` | + + +### @aws-cdk/customresources:installLatestAwsSdkDefault + +*Whether to install the latest SDK by default in AwsCustomResource* (default) + +This was originally introduced and enabled by default to not be limited by the SDK version +that's installed on AWS Lambda. However, it creates issues for Lambdas bound to VPCs that +do not have internet access, or in environments where 'npmjs.com' is not available. + +The recommended setting is to disable the default installation behavior, and pass the +flag on a resource-by-resource basis to enable it if necessary. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.60.0 | `false` | `false` | + +**Compatibility with old behavior:** Set installLatestAwsSdk: true on all resources that need it. + + +### @aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup + +*Remove CloudWatch alarms from deployment group* (fix) + +Enable this flag to be able to remove all CloudWatch alarms from a deployment group by removing +the alarms from the construct. If this flag is not set, removing all alarms from the construct +will still leave the alarms configured for the deployment group. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.65.0 | `false` | `true` | + + +### @aws-cdk/aws-rds:databaseProxyUniqueResourceName + +*Use unique resource name for Database Proxy* (fix) + +If this flag is not set, the default behavior for `DatabaseProxy` is +to use `id` of the constructor for `dbProxyName` when it's not specified in the argument. +In this case, users can't deploy `DatabaseProxy`s that have the same `id` in the same region. + +If this flag is set, the default behavior is to use unique resource names for each `DatabaseProxy`. + +This is a feature flag as the old behavior was technically incorrect, but users may have come to depend on it. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.65.0 | `false` | `true` | + + +### @aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId + +*Include authorizer configuration in the calculation of the API deployment logical ID.* (fix) + +The logical ID of the AWS::ApiGateway::Deployment resource is calculated by hashing +the API configuration, including methods, and resources, etc. Enable this feature flag +to also include the configuration of any authorizer attached to the API in the +calculation, so any changes made to an authorizer will create a new deployment. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.66.0 | `false` | `true` | + + +### @aws-cdk/aws-ec2:launchTemplateDefaultUserData + +*Define user data for a launch template by default when a machine image is provided.* (fix) + +The ec2.LaunchTemplate construct did not define user data when a machine image is +provided despite the document. If this is set, a user data is automatically defined +according to the OS of the machine image. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.67.0 | `false` | `true` | + + +### @aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments + +*SecretTargetAttachments uses the ResourcePolicy of the attached Secret.* (fix) + +Enable this feature flag to make SecretTargetAttachments use the ResourcePolicy of the attached Secret. +SecretTargetAttachments are created to connect a Secret to a target resource. +In CDK code, they behave like regular Secret and can be used as a stand-in in most situations. +Previously, adding to the ResourcePolicy of a SecretTargetAttachment did attempt to create a separate ResourcePolicy for the same Secret. +However Secrets can only have a single ResourcePolicy, causing the CloudFormation deployment to fail. + +When enabling this feature flag for an existing Stack, ResourcePolicies created via a SecretTargetAttachment will need replacement. +This won't be possible without intervention due to limitation outlined above. +First remove all permissions granted to the Secret and deploy without the ResourcePolicies. +Then you can re-add the permissions and deploy again. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.67.0 | `false` | `true` | + + +### @aws-cdk/aws-redshift:columnId + +*Whether to use an ID to track Redshift column changes* (fix) + +Redshift columns are identified by their `name`. If a column is renamed, the old column +will be dropped and a new column will be created. This can cause data loss. + +This flag enables the use of an `id` attribute for Redshift columns. If this flag is enabled, the +internal CDK architecture will track changes of Redshift columns through their `id`, rather +than their `name`. This will prevent data loss when columns are renamed. + +**NOTE** - Enabling this flag comes at a **risk**. When enabled, update the `id`s of all columns, +**however** do not change the `names`s of the columns. If the `name`s of the columns are changed during +initial deployment, the columns will be dropped and recreated, causing data loss. After the initial deployment +of the `id`s, the `name`s of the columns can be changed without data loss. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.68.0 | `false` | `true` | + + +### @aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2 + +*Enable AmazonEMRServicePolicy_v2 managed policies* (fix) + +If this flag is not set, the default behavior for `EmrCreateCluster` is +to use `AmazonElasticMapReduceRole` managed policies. + +If this flag is set, the default behavior is to use the new `AmazonEMRServicePolicy_v2` +managed policies. + +This is a feature flag as the old behavior will be deprecated, but some resources may require manual +intervention since they might not have the appropriate tags propagated automatically. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.72.0 | `false` | `true` | + + + diff --git a/packages/aws-cdk-lib/cx-api/README.md b/packages/aws-cdk-lib/cx-api/README.md new file mode 100644 index 0000000000000..99fff59a1c7c8 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/README.md @@ -0,0 +1,185 @@ +# Cloud Executable API + + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. + +## V2 Feature Flags + +* `@aws-cdk/aws-s3:createDefaultLoggingPolicy` + +Enable this feature flag to create an S3 bucket policy by default in cases where +an AWS service would automatically create the Policy if one does not exist. + +For example, in order to send VPC flow logs to an S3 bucket, there is a specific Bucket Policy +that needs to be attached to the bucket. If you create the bucket without a policy and then add the +bucket as the flow log destination, the service will automatically create the bucket policy with the +necessary permissions. If you were to then try and add your own bucket policy CloudFormation will throw +and error indicating that a bucket policy already exists. + +In cases where we know what the required policy is we can go ahead and create the policy so we can +remain in control of it. + +https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-S3 + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true + } +} +``` + +* `@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption` + +Enable this feature flag to restrict the decryption of a SQS queue, which is subscribed to a SNS topic, to +only the topic which it is subscribed to and not the whole SNS service of an account. + +Previously the decryption was only restricted to the SNS service principal. To make the SQS subscription more +secure, it is a good practice to restrict the decryption further and only allow the connected SNS topic to decryption +the subscribed queue. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true + } +} +``` + +* @aws-cdk/aws-apigateway:disableCloudWatchRole + +Enable this feature flag to change the default behavior for aws-apigateway.RestApi and aws-apigateway.SpecRestApi +to _not_ create a CloudWatch role and Account. There is only a single ApiGateway account per AWS +environment which means that each time you create a RestApi in your account the ApiGateway account +is overwritten. If at some point the newest RestApi is deleted, the ApiGateway Account and CloudWatch +role will also be deleted, breaking any existing ApiGateways that were depending on them. + +When this flag is enabled you should either create the ApiGateway account and CloudWatch role +separately _or_ only enable the cloudWatchRole on a single RestApi. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-apigateway:disableCloudWatchRole": true + } +} +``` + +* `@aws-cdk/core:enablePartitionLiterals` + +Enable this feature flag to have `Stack.partition` return a literal string for a stack's partition +when the stack has a known region configured. If the region is undefined, or set to an unknown value, the +`Stack.partition` will be the CloudFormation intrinsic value `AWS::Partition`. Without this feature flag, +`Stack.partition` always returns the CloudFormation intrinsic value `AWS::Partition`. + +This feature will often simplify ARN strings in CDK generated templates, for example: + +```yaml + Principal: + AWS: + Fn::Join: + - "" + - - "arn:" + - Ref: AWS::Partition + - :iam::123456789876:root +``` + +becomes: + +```yaml + Principal: + AWS: "arn:aws:iam::123456789876:root" +``` + +* `@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker` + +Enable this feature flag to avoid setting the "ECS" deployment controller when adding a circuit breaker to an +ECS Service, as this will trigger a full replacement which fails to deploy when using set service names. +This does not change any behaviour as the default deployment controller when it is not defined is ECS. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true + } +} +``` + +* `@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy` + +Enable this feature flag to use S3 Bucket Policy for granting permission fo Server Access Logging +rather than using the canned \`LogDeliveryWrite\` ACL. ACLs do not work when Object Ownership is +enabled on the bucket. + +This flag uses a Bucket Policy statement to allow Server Access Log delivery, following best +practices for S3. + +https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html + +```json +{ + "context": { + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true + } +} +``` + +* `@aws-cdk/aws-rds:databaseProxyUniqueResourceName` + +Enable this feature flag to use unique resource names for each `DatabaseProxy`. + +Previously, the default behavior for `DatabaseProxy` was to use `id` of the constructor for `dbProxyName`. +In this case, users couldn't deploy `DatabaseProxy`s that have the same `id` in the same region. + +This is a feature flag as the old behavior was technically incorrect, but users may have come to depend on it. + +```json +{ + "context": { + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true + } +} +``` + +* `@aws-cdk/aws-redshift:columnId` + +Enable this feature flag to allow the CDK to track changes in Redshift columns through their `id` attribute. This is a breaking change, as the `name` attribute was currently being used to track changes to Redshift columns. + +Enabling this feature flag comes at a risk for existing Redshift columns, as the `name` attribute of a redshift column was currently being used. Therefore, to change a Redshift columns' `name` will essentially create a new column and delete the old one. This will cause data loss. If you choose to enable this flag, ensure that upon intial deployment (the first deployment after setting this feature flag), the `name` attribute of every column is not changed. After the intial deployment, you can freely change the `name` attribute of a column. + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-redshift:columnId": true + } +} +``` + +* `@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2` + +Enable this feature flag to use the \`AmazonEMRServicePolicy_v2\` managed policies for the EMR service role. + +This is a feature flag as the old behavior will be deprecated, but some resources may require manual +intervention since they might not have the appropriate tags propagated automatically. + +https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-managed-iam-policies.html + +_cdk.json_ + +```json +{ + "context": { + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true + } +} +``` diff --git a/packages/aws-cdk-lib/cx-api/build-tools/flag-report.ts b/packages/aws-cdk-lib/cx-api/build-tools/flag-report.ts new file mode 100644 index 0000000000000..b6d4de3778c73 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/build-tools/flag-report.ts @@ -0,0 +1,217 @@ +/** + * Generate FEATURE_FLAGS.md, a report of all current feature flags + */ +import { promises as fs } from 'fs'; +import * as path from 'path'; +import * as feats from '../lib/features'; +import { FlagInfo, FlagType, compareVersions } from '../lib/private/flag-modeling'; + +async function main() { + await updateMarkdownFile(path.join(__dirname, '..', 'FEATURE_FLAGS.md'), { + table: flagsTable(), + details: flagsDetails(), + json: recommendedJson(), + removed: removedFlags(), + diff: changedFlags(), + migratejson: migrateJson(), + }); +} + +function flagsTable() { + return renderTable([ + ['Flag', 'Summary', 'Since', 'Type'], + ...v2flags().map(([name, flag]) => + [ + renderLink(mdEsc(name), githubHeadingLink(flagDetailsHeading(name, flag))), + flag.summary, + flag.introducedIn.v2 ?? '', + renderType(flag.type), + ], + ), + ]); +} + +function removedFlags() { + const removedInV2 = flags(flag => flag.introducedIn.v2 === undefined && flag.introducedIn.v1 !== undefined); + + return renderTable([ + ['Flag', 'Summary', 'Type', 'Since'], + ...removedInV2.map(([name, flag]) => [ + renderLink(mdEsc(name), githubHeadingLink(flagDetailsHeading(name, flag))), + flag.summary, + renderType(flag.type), + flag.introducedIn.v1 ?? '', + ]), + ]); +} + +function changedFlags() { + const changedInV2 = flags(flag => !!flag.defaults?.v2 && !!flag.introducedIn.v2); + + return renderTable([ + ['Flag', 'Summary', 'Type', 'Since', 'v1 default', 'v2 default'], + ...changedInV2.map(([name, flag]) => [ + renderLink(mdEsc(name), githubHeadingLink(flagDetailsHeading(name, flag))), + flag.summary, + renderType(flag.type), + flag.introducedIn.v1 ?? '', + renderValue(false), + renderValue(flag.defaults?.v2), + ]), + ]); +} + +function migrateJson() { + const changedInV2 = flags(flag => !!flag.defaults?.v2 && !!flag.introducedIn.v2); + + const context = Object.fromEntries(changedInV2.map(([name, _]) => [name, false])); + + return [ + '```json', + JSON.stringify({ context }, undefined, 2), + '```', + ].join('\n'); +} + +function flagsDetails() { + const allFlags = flags(_ => true); + + return allFlags.flatMap(([name, flag]) => [ + `### ${flagDetailsHeading(name, flag)}`, + '', + `*${flag.summary}* ${renderType(flag.type)}`, + '', + dedent(flag.detailsMd), + '', + renderTable([ + ['Since', 'Default', 'Recommended'], + + // V1 + flag.introducedIn.v1 + ? [flag.introducedIn.v1, renderValue(false), renderValue(flag.recommendedValue)] + : ['(not in v1)', '', ''], + + // V2 + flag.introducedIn.v2 + ? [flag.introducedIn.v2, renderValue(flag.defaults?.v2 ?? false), renderValue(flag.recommendedValue)] + : flag.defaults?.v2 !== undefined + ? ['(default in v2)', renderValue(flag.defaults?.v2), ''] + : ['(not in v2)', '', ''], + ]), + ...oldBehavior(flag) ? [ + `**Compatibility with old behavior:** ${oldBehavior(flag)}`, + '', + ] : [], + '', + ]).join('\n'); +} + +function oldBehavior(flag: FlagInfo): string | undefined { + switch (flag.type) { + case FlagType.ApiDefault: return flag.compatibilityWithOldBehaviorMd; + case FlagType.BugFix: return flag.compatibilityWithOldBehaviorMd; + case FlagType.VisibleContext: return undefined; + } +} + +function recommendedJson() { + return [ + '```json', + JSON.stringify({ context: feats.NEW_PROJECT_CONTEXT }, undefined, 2), + '```', + ].join('\n'); +} + +function v2flags() { + return flags(flag => flag.introducedIn.v2 !== undefined); +} + +function flags(pred: (x: FlagInfo) => boolean) { + const entries = Object.entries(feats.FLAGS) + .filter(([_, flag]) => pred(flag)); + + entries.sort((a, b) => firstCmp( + // Sort by versions first + compareVersions(a[1].introducedIn.v2, b[1].introducedIn.v2), + compareVersions(a[1].introducedIn.v1, b[1].introducedIn.v1), + // Then sort by name + a[0].localeCompare(b[0]))); + + return entries; +} + +function renderType(type: FlagType): string { + switch (type) { + case FlagType.ApiDefault: return '(default)'; + case FlagType.BugFix: return '(fix)'; + case FlagType.VisibleContext: return '(config)'; + } +} + +function renderTable(rows: string[][]) { + return [ + '', + '| ' + rows[0].join(' | ') + ' |', + '| ' + rows[0].map(_ => '-----').join(' | ') + ' |', + ...rows.slice(1).map(row => '| ' + row.join(' | ') + ' |'), + '', + ].join('\n'); +} + +/** + * Return the heading that will be used to caption this flag's details + */ +function flagDetailsHeading(name: string, _: FlagInfo) { + return name; +} + +/** + * Return a link that is valid on GitHub to refer to a heading + */ +function githubHeadingLink(heading: string) { + return `#${heading.toLowerCase().replace(/ /g, '-').replace(/[^a-z0-9_-]/g, '')}`; +} + +/** + * Remove shared leading whitespace from all non-empty lines + */ +function dedent(body: string) { + const lines = body.split('\n').filter((x) => x.trim() !== ''); + const leadingWs = lines.map(x => x.match(/^ */)?.[0].length ?? 0); + const sharedWs = Math.min(...leadingWs); + const re = new RegExp('^' + ' '.repeat(sharedWs), 'mg'); + return body.replace(re, '').trim(); +} + +function renderValue(x: any) { + return `\`${JSON.stringify(x)}\``; +} + +function renderLink(caption: string, link: string) { + return `[${caption}](${link})`; +} + +function mdEsc(x: string) { + return x.replace(/_/g, '\\_'); +} + +async function updateMarkdownFile(filename: string, sections: Record) { + let contents = await fs.readFile(filename, { encoding: 'utf-8' }); + + for (const [section, value] of Object.entries(sections)) { + const re = new RegExp(`(.*)`, 's'); + contents = contents.replace(re, `\n${value}\n`); + } + + await fs.writeFile(filename, contents, { encoding: 'utf-8' }); +} + +function firstCmp(...xs: number[]) { + return xs.find(x => x !== 0) ?? 0; +} + +main().catch(e => { + // eslint-disable-next-line no-console + console.error(e); + process.exitCode = 1; +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts b/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts new file mode 100644 index 0000000000000..554eeb4b2e699 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/build-tools/update-vnext.ts @@ -0,0 +1,28 @@ +/** + * Load the `features.ts` source file, and replace the "V2NEXT" version markers with the actual current version + */ +import { promises as fs } from 'fs'; +import * as path from 'path'; +import { MAGIC_V2NEXT } from '../lib/private/flag-modeling'; + +async function main() { + const featuresSourceFile = path.join(__dirname, '..', 'lib', 'features.ts'); + + let currentv2: string | undefined = JSON.parse(await fs.readFile(path.join(__dirname, '../../../../version.v2.json'), { encoding: 'utf-8' })).version; + currentv2 = currentv2?.match(/^[0-9\.]+/)?.[0]; // Make sure to only retain the actual version number, not any '-rc.X' suffix + + if (!currentv2) { + throw new Error('Could not determine current v2 version number'); + } + + let source = await fs.readFile(featuresSourceFile, { encoding: 'utf-8' }); + source = source.replace(new RegExp(MAGIC_V2NEXT, 'g'), currentv2); + + await fs.writeFile(featuresSourceFile, source, { encoding: 'utf-8' }); +} + +main().catch(e => { + // eslint-disable-next-line no-console + console.error(e); + process.exitCode = 1; +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/design/NESTED_ASSEMBLIES.md b/packages/aws-cdk-lib/cx-api/design/NESTED_ASSEMBLIES.md new file mode 100644 index 0000000000000..c58caf6ee938b --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/design/NESTED_ASSEMBLIES.md @@ -0,0 +1,93 @@ +# Nested Assemblies + +For the CI/CD project we need to be able to a final, authoritative, immutable +rendition of part of the construct tree. This is a part of the application +that we can ask the CI/CD system to deploy as a unit, and have it get a fighting +chance of getting it right. This is because: + +- The stacks will be known. +- Their interdependencies will be known, and won't change anymore. + +To that end, we're introducing the concept of an "nested cloud assembly". +This is a part of the construct tree that is finalized independently of the +rest, so that other constructs can reflect on it. + +Constructs of type `Stage` will produce nested cloud assemblies. + +## Restrictions + +### Assets + +Right now, if the same asset is used in multiple cloud assemblies, it will +be staged independently in ever Cloud Assembly (making it take up more +space than necessary). + +This is unfortunate. We can think about sharing the staging directories +between Stages, should be an easy optimization that can be applied later. + +### Dependencies + +It seems that it might be desirable to have dependencies that reach outside +a single `Stage`. Consider the case where we have shared resources that +may be shared between Stages. A typical example would be a VPC: + +``` + ┌───────────────┐ + │ │ + │ VpcStack │ + │ │ + └───────────────┘ + ▲ + │ + │ + ┌─────────────┴─────────────┐ + │ │ +┌───────────────┼──────────┐ ┌──────────┼───────────────┐ +│Stage │ │ │ │ Stage│ +│ │ │ │ │ │ +│ ┌───────────────┐ │ │ ┌───────────────┐ │ +│ │ │ │ │ │ │ │ +│ │ App1Stack │ │ │ │ App2Stack │ │ +│ │ │ │ │ │ │ │ +│ └───────────────┘ │ │ └───────────────┘ │ +│ │ │ │ +└──────────────────────────┘ └──────────────────────────┘ +``` + +This seems like a reasonable thing to want to be able to do. + + +Right now, for practical reasons we're disallowing dependencies outside +nested assemblies. That is not to say that this can never be made to work, +but as it's really rather a significant chunk of work it has not been +implemented yet. Things to consider: + +- Do artifact identifiers need to be globally unique? (Does that destroy + local assumptions around naming that constructs can make?) +- How are artifacts addressed across assembly boundaries? Are they just the + absolute name, wherever in the Cloud Assembly tree the artifact is? Do they + represent a path from the top-level cloud assembly + (`SubAsm/SubAsm/Artifact`)? Are they relative paths (`../SubAsm/Artifact`)? +- Can there be cyclic dependencies between nested assemblies? Is it okay to + have both dependencies `AsmA/Stack1 -> AsmB/Stack1`, and `AsmB/Stack2 -> + AsmA/Stack2`? Why, or why not? How will we ensure that? + +Even if we can make the addressing work at the artifact level, at the +construct tree level we'd be giving up the guarantees we are getting from +having `Stage` constructs produce isolated Cloud Assemblies by having +dependencies outside them. Consider having two stages, `StageA` with `StackA` +and `StageB` with `StackB`. We must `synth()` them in some order, either A or +B first. Let's say A goes first (but the same argument obviously holds in +reverse). What if during the `synth()` of `StageB`, we discover `StackB` +introduces a dependency on `StackA`? By that point, `StageA` has already +synthesized and `StackA` has produced a (so-called "immutable") template. +Obviously we can't change that anymore, so we can't introduce that dependency +anymore. + +Seems like we should be calling `synth()` on multiple stages consumer-first! + +The problem is that we are generally building a Pipeline *producer*-first, since +we are modeling and building it in deployment order, which is the reverse order +the pipeline would `synth()` each of the stages in, in order to build itself. + +Since this is all very tricky, let's consider it out of scope for now. \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/index.ts b/packages/aws-cdk-lib/cx-api/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/cx-api/lib/app.ts b/packages/aws-cdk-lib/cx-api/lib/app.ts new file mode 100644 index 0000000000000..c08fd5868207b --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/app.ts @@ -0,0 +1,51 @@ +// -------------------------------------------------------------------------------- +// This file declares context keys that are used by the CLI to control the +// behavior of CDK apps. Contrary to feature flags (which are defined under +// `features.ts`) these options are not bound to be removed in the next major +// version. +// -------------------------------------------------------------------------------- + +/** + * Enables the embedding of the "aws:cdk:path" in CloudFormation template metadata. + */ +export const PATH_METADATA_ENABLE_CONTEXT = 'aws:cdk:enable-path-metadata'; + +/** + * Enable the collection and reporting of version information. + */ +export const ANALYTICS_REPORTING_ENABLED_CONTEXT = 'aws:cdk:version-reporting'; + +/** + * Disable asset staging (for use with SAM CLI). + * + * Disabling asset staging means that copyable assets will not be copied to the + * output directory and will be referenced with absolute paths. + * + * Not copied to the output directory: this is so users can iterate on the + * Lambda source and run SAM CLI without having to re-run CDK (note: we + * cannot achieve this for bundled assets, if assets are bundled they + * will have to re-run CDK CLI to re-bundle updated versions). + * + * Absolute path: SAM CLI expects `cwd`-relative paths in a resource's + * `aws:asset:path` metadata. In order to be predictable, we will always output + * absolute paths. + */ +export const DISABLE_ASSET_STAGING_CONTEXT = 'aws:cdk:disable-asset-staging'; + +/** + * If this context key is set, the CDK will stage assets under the specified + * directory. Otherwise, assets will not be staged. + * Omits stack traces from construct metadata entries. + */ +export const DISABLE_METADATA_STACK_TRACE = 'aws:cdk:disable-stack-trace'; + +/** + * If this context key is set, the CDK will not store logical ID + * metadata in the manifest. + */ +export const DISABLE_LOGICAL_ID_METADATA = 'aws:cdk:disable-logicalId-metadata'; + +/** + * Run bundling for stacks specified in this context key + */ +export const BUNDLING_STACKS = 'aws:cdk:bundling-stacks'; diff --git a/packages/aws-cdk-lib/cx-api/lib/artifacts/asset-manifest-artifact.ts b/packages/aws-cdk-lib/cx-api/lib/artifacts/asset-manifest-artifact.ts new file mode 100644 index 0000000000000..e96a45b63529a --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/artifacts/asset-manifest-artifact.ts @@ -0,0 +1,89 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { CloudArtifact } from '../cloud-artifact'; +import { CloudAssembly } from '../cloud-assembly'; + +const ASSET_MANIFEST_ARTIFACT_SYM = Symbol.for('@aws-cdk/cx-api.AssetManifestArtifact'); + +/** + * Asset manifest is a description of a set of assets which need to be built and published + */ +export class AssetManifestArtifact extends CloudArtifact { + /** + * Checks if `art` is an instance of this class. + * + * Use this method instead of `instanceof` to properly detect `AssetManifestArtifact` + * instances, even when the construct library is symlinked. + * + * Explanation: in JavaScript, multiple copies of the `cx-api` library on + * disk are seen as independent, completely different libraries. As a + * consequence, the class `AssetManifestArtifact` in each copy of the `cx-api` library + * is seen as a different class, and an instance of one class will not test as + * `instanceof` the other class. `npm install` will not create installations + * like this, but users may manually symlink construct libraries together or + * use a monorepo tool: in those cases, multiple copies of the `cx-api` + * library can be accidentally installed, and `instanceof` will behave + * unpredictably. It is safest to avoid using `instanceof`, and using + * this type-testing method instead. + */ + public static isAssetManifestArtifact(art: any): art is AssetManifestArtifact { + return art && typeof art === 'object' && art[ASSET_MANIFEST_ARTIFACT_SYM]; + } + + /** + * The file name of the asset manifest + */ + public readonly file: string; + + /** + * Version of bootstrap stack required to deploy this stack + */ + public readonly requiresBootstrapStackVersion: number | undefined; + + /** + * Name of SSM parameter with bootstrap stack version + * + * @default - Discover SSM parameter by reading stack + */ + public readonly bootstrapStackVersionSsmParameter?: string; + + private _contents?: cxschema.AssetManifest; + + constructor(assembly: CloudAssembly, name: string, artifact: cxschema.ArtifactManifest) { + super(assembly, name, artifact); + + const properties = (this.manifest.properties || {}) as cxschema.AssetManifestProperties; + if (!properties.file) { + throw new Error('Invalid AssetManifestArtifact. Missing "file" property'); + } + this.file = path.resolve(this.assembly.directory, properties.file); + this.requiresBootstrapStackVersion = properties.requiresBootstrapStackVersion; + this.bootstrapStackVersionSsmParameter = properties.bootstrapStackVersionSsmParameter; + } + + /** + * The Asset Manifest contents + */ + public get contents(): cxschema.AssetManifest { + if (this._contents !== undefined) { + return this._contents; + } + + const contents = this._contents = JSON.parse(fs.readFileSync(this.file, 'utf-8')); + return contents; + } + +} + +/** + * Mark all instances of 'AssetManifestArtifact' + * + * Why not put this in the constructor? Because this is a class property, + * not an instance property. It applies to all instances of the class. + */ +Object.defineProperty(AssetManifestArtifact.prototype, ASSET_MANIFEST_ARTIFACT_SYM, { + value: true, + enumerable: false, + writable: false, +}); diff --git a/packages/aws-cdk-lib/cx-api/lib/artifacts/cloudformation-artifact.ts b/packages/aws-cdk-lib/cx-api/lib/artifacts/cloudformation-artifact.ts new file mode 100644 index 0000000000000..0ca21e10ea772 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/artifacts/cloudformation-artifact.ts @@ -0,0 +1,185 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { CloudArtifact } from '../cloud-artifact'; +import type { CloudAssembly } from '../cloud-assembly'; +import { Environment, EnvironmentUtils } from '../environment'; + +export class CloudFormationStackArtifact extends CloudArtifact { + /** + * The file name of the template. + */ + public readonly templateFile: string; + + /** + * The original name as defined in the CDK app. + */ + public readonly originalName: string; + + /** + * Any assets associated with this stack. + */ + public readonly assets: cxschema.AssetMetadataEntry[]; + + /** + * CloudFormation parameters to pass to the stack. + */ + public readonly parameters: { [id: string]: string }; + + /** + * CloudFormation tags to pass to the stack. + */ + public readonly tags: { [id: string]: string }; + + /** + * The physical name of this stack. + */ + public readonly stackName: string; + + /** + * A string that represents this stack. Should only be used in user + * interfaces. If the stackName has not been set explicitly, or has been set + * to artifactId, it will return the hierarchicalId of the stack. Otherwise, + * it will return something like " ()" + */ + public readonly displayName: string; + + /** + * The physical name of this stack. + * @deprecated renamed to `stackName` + */ + public readonly name: string; + + /** + * The environment into which to deploy this artifact. + */ + public readonly environment: Environment; + + /** + * The role that needs to be assumed to deploy the stack + * + * @default - No role is assumed (current credentials are used) + */ + public readonly assumeRoleArn?: string; + + /** + * External ID to use when assuming role for cloudformation deployments + * + * @default - No external ID + */ + readonly assumeRoleExternalId?: string; + + /** + * The role that is passed to CloudFormation to execute the change set + * + * @default - No role is passed (currently assumed role/credentials are used) + */ + public readonly cloudFormationExecutionRoleArn?: string; + + /** + * The role to use to look up values from the target AWS account + * + * @default - No role is assumed (current credentials are used) + */ + public readonly lookupRole?: cxschema.BootstrapRole; + + /** + * If the stack template has already been included in the asset manifest, its asset URL + * + * @default - Not uploaded yet, upload just before deploying + */ + public readonly stackTemplateAssetObjectUrl?: string; + + /** + * Version of bootstrap stack required to deploy this stack + * + * @default - No bootstrap stack required + */ + public readonly requiresBootstrapStackVersion?: number; + + /** + * Name of SSM parameter with bootstrap stack version + * + * @default - Discover SSM parameter by reading stack + */ + public readonly bootstrapStackVersionSsmParameter?: string; + + /** + * Whether termination protection is enabled for this stack. + */ + public readonly terminationProtection?: boolean; + + /** + * Whether this stack should be validated by the CLI after synthesis + * + * @default - false + */ + public readonly validateOnSynth?: boolean; + + private _template: any | undefined; + + constructor(assembly: CloudAssembly, artifactId: string, artifact: cxschema.ArtifactManifest) { + super(assembly, artifactId, artifact); + + const properties = (this.manifest.properties || {}) as cxschema.AwsCloudFormationStackProperties; + if (!properties.templateFile) { + throw new Error('Invalid CloudFormation stack artifact. Missing "templateFile" property in cloud assembly manifest'); + } + if (!artifact.environment) { + throw new Error('Invalid CloudFormation stack artifact. Missing environment'); + } + this.environment = EnvironmentUtils.parse(artifact.environment); + this.templateFile = properties.templateFile; + this.parameters = properties.parameters ?? {}; + + // We get the tags from 'properties' if available (cloud assembly format >= 6.0.0), otherwise + // from the stack metadata + this.tags = properties.tags ?? this.tagsFromMetadata(); + this.assumeRoleArn = properties.assumeRoleArn; + this.assumeRoleExternalId = properties.assumeRoleExternalId; + this.cloudFormationExecutionRoleArn = properties.cloudFormationExecutionRoleArn; + this.stackTemplateAssetObjectUrl = properties.stackTemplateAssetObjectUrl; + this.requiresBootstrapStackVersion = properties.requiresBootstrapStackVersion; + this.bootstrapStackVersionSsmParameter = properties.bootstrapStackVersionSsmParameter; + this.terminationProtection = properties.terminationProtection; + this.validateOnSynth = properties.validateOnSynth; + this.lookupRole = properties.lookupRole; + + this.stackName = properties.stackName || artifactId; + this.assets = this.findMetadataByType(cxschema.ArtifactMetadataEntryType.ASSET).map(e => e.data as cxschema.AssetMetadataEntry); + + this.displayName = this.stackName === artifactId + ? this.hierarchicalId + : `${this.hierarchicalId} (${this.stackName})`; + + this.name = this.stackName; // backwards compat + this.originalName = this.stackName; + } + + /** + * Full path to the template file + */ + public get templateFullPath() { + return path.join(this.assembly.directory, this.templateFile); + } + + /** + * The CloudFormation template for this stack. + */ + public get template(): any { + if (this._template === undefined) { + this._template = JSON.parse(fs.readFileSync(this.templateFullPath, 'utf-8')); + } + return this._template; + } + + private tagsFromMetadata() { + const ret: Record = {}; + for (const metadataEntry of this.findMetadataByType(cxschema.ArtifactMetadataEntryType.STACK_TAGS)) { + for (const tag of (metadataEntry.data ?? []) as cxschema.StackTagsMetadataEntry) { + ret[tag.key] = tag.value; + } + } + return ret; + } +} diff --git a/packages/aws-cdk-lib/cx-api/lib/artifacts/nested-cloud-assembly-artifact-aug.ts b/packages/aws-cdk-lib/cx-api/lib/artifacts/nested-cloud-assembly-artifact-aug.ts new file mode 100644 index 0000000000000..862571a191d41 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/artifacts/nested-cloud-assembly-artifact-aug.ts @@ -0,0 +1,18 @@ +import { NestedCloudAssemblyArtifact } from './nested-cloud-assembly-artifact'; +import { CloudAssembly } from '../cloud-assembly'; + +const cacheSym = Symbol(); + +/** + * The nested Assembly + * + * Declared in a different file to break circular dep between CloudAssembly and NestedCloudAssemblyArtifact + */ +Object.defineProperty(NestedCloudAssemblyArtifact.prototype, 'nestedAssembly', { + get() { + if (!this[cacheSym]) { + this[cacheSym] = new CloudAssembly(this.fullPath); + } + return this[cacheSym]; + }, +}); diff --git a/packages/aws-cdk-lib/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts b/packages/aws-cdk-lib/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts new file mode 100644 index 0000000000000..c8e6a266ac337 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/artifacts/nested-cloud-assembly-artifact.ts @@ -0,0 +1,43 @@ +import * as path from 'path'; +import * as cxschema from '../../../cloud-assembly-schema'; +import { CloudArtifact } from '../cloud-artifact'; +import type { CloudAssembly } from '../cloud-assembly'; + +/** + * Asset manifest is a description of a set of assets which need to be built and published + */ +export class NestedCloudAssemblyArtifact extends CloudArtifact { + /** + * The relative directory name of the asset manifest + */ + public readonly directoryName: string; + + /** + * Display name + */ + public readonly displayName: string; + + constructor(assembly: CloudAssembly, name: string, artifact: cxschema.ArtifactManifest) { + super(assembly, name, artifact); + + const properties = (this.manifest.properties || {}) as cxschema.NestedCloudAssemblyProperties; + this.directoryName = properties.directoryName; + this.displayName = properties.displayName ?? name; + } + + /** + * Full path to the nested assembly directory + */ + public get fullPath(): string { + return path.join(this.assembly.directory, this.directoryName); + } +} + +export interface NestedCloudAssemblyArtifact { + /** + * The nested Assembly + */ + readonly nestedAssembly: CloudAssembly; + + // Declared in a different file +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/artifacts/tree-cloud-artifact.ts b/packages/aws-cdk-lib/cx-api/lib/artifacts/tree-cloud-artifact.ts new file mode 100644 index 0000000000000..84f7c2474d94b --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/artifacts/tree-cloud-artifact.ts @@ -0,0 +1,17 @@ +import * as cxschema from '../../../cloud-assembly-schema'; +import { CloudArtifact } from '../cloud-artifact'; +import { CloudAssembly } from '../cloud-assembly'; + +export class TreeCloudArtifact extends CloudArtifact { + public readonly file: string; + + constructor(assembly: CloudAssembly, name: string, artifact: cxschema.ArtifactManifest) { + super(assembly, name, artifact); + + const properties = (this.manifest.properties || {}) as cxschema.TreeArtifactProperties; + if (!properties.file) { + throw new Error('Invalid TreeCloudArtifact. Missing "file" property'); + } + this.file = properties.file; + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/assets.ts b/packages/aws-cdk-lib/cx-api/lib/assets.ts new file mode 100644 index 0000000000000..42461895828be --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/assets.ts @@ -0,0 +1,33 @@ +/** + * If this is set in the context, the aws:asset:xxx metadata entries will not be + * added to the template. This is used, for example, when we run integrationt + * tests. + */ +export const ASSET_RESOURCE_METADATA_ENABLED_CONTEXT = 'aws:cdk:enable-asset-metadata'; + +/** + * Metadata added to the CloudFormation template entries that map local assets + * to resources. + */ +export const ASSET_RESOURCE_METADATA_PATH_KEY = 'aws:asset:path'; +export const ASSET_RESOURCE_METADATA_DOCKERFILE_PATH_KEY = 'aws:asset:dockerfile-path'; +export const ASSET_RESOURCE_METADATA_DOCKER_BUILD_ARGS_KEY = 'aws:asset:docker-build-args'; +export const ASSET_RESOURCE_METADATA_DOCKER_BUILD_SECRETS_KEY = 'aws:asset:docker-build-secrets'; +export const ASSET_RESOURCE_METADATA_DOCKER_BUILD_TARGET_KEY = 'aws:asset:docker-build-target'; +export const ASSET_RESOURCE_METADATA_PROPERTY_KEY = 'aws:asset:property'; +export const ASSET_RESOURCE_METADATA_IS_BUNDLED_KEY = 'aws:asset:is-bundled'; +export const ASSET_RESOURCE_METADATA_DOCKER_OUTPUTS_KEY = 'aws:asset:docker-outputs'; +export const ASSET_RESOURCE_METADATA_DOCKER_CACHE_FROM_KEY = 'aws:asset:docker-cache-from'; +export const ASSET_RESOURCE_METADATA_DOCKER_CACHE_TO_KEY = 'aws:asset:docker-cache-to'; + +/** + * Separator string that separates the prefix separator from the object key separator. + * + * Asset keys will look like: + * + * /assets/MyConstruct12345678/||abcdef12345.zip + * + * This allows us to encode both the prefix and the full location in a single + * CloudFormation Template Parameter. + */ +export const ASSET_PREFIX_SEPARATOR = '||'; diff --git a/packages/aws-cdk-lib/cx-api/lib/cloud-artifact-aug.ts b/packages/aws-cdk-lib/cx-api/lib/cloud-artifact-aug.ts new file mode 100644 index 0000000000000..02b3106ba64b0 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/cloud-artifact-aug.ts @@ -0,0 +1,32 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import { AssetManifestArtifact } from './artifacts/asset-manifest-artifact'; +import { CloudFormationStackArtifact } from './artifacts/cloudformation-artifact'; +import { NestedCloudAssemblyArtifact } from './artifacts/nested-cloud-assembly-artifact'; +import { TreeCloudArtifact } from './artifacts/tree-cloud-artifact'; +import { CloudArtifact } from './cloud-artifact'; +import { CloudAssembly } from './cloud-assembly'; + +/** + * Add the 'fromManifest' factory function + * + * It is defined in a separate file to avoid circular dependencies between 'cloud-artifact.ts' + * and all of its subclass files. + */ +CloudArtifact.fromManifest = function fromManifest( + assembly: CloudAssembly, + id: string, + artifact: cxschema.ArtifactManifest, +): CloudArtifact | undefined { + switch (artifact.type) { + case cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK: + return new CloudFormationStackArtifact(assembly, id, artifact); + case cxschema.ArtifactType.CDK_TREE: + return new TreeCloudArtifact(assembly, id, artifact); + case cxschema.ArtifactType.ASSET_MANIFEST: + return new AssetManifestArtifact(assembly, id, artifact); + case cxschema.ArtifactType.NESTED_CLOUD_ASSEMBLY: + return new NestedCloudAssemblyArtifact(assembly, id, artifact); + default: + return undefined; + } +}; \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/cloud-artifact.ts b/packages/aws-cdk-lib/cx-api/lib/cloud-artifact.ts new file mode 100644 index 0000000000000..c7b16ee421a8b --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/cloud-artifact.ts @@ -0,0 +1,146 @@ +import * as cxschema from '../../cloud-assembly-schema'; +import type { CloudAssembly } from './cloud-assembly'; +import { MetadataEntryResult, SynthesisMessage, SynthesisMessageLevel } from './metadata'; + +/** + * Artifact properties for CloudFormation stacks. + */ +export interface AwsCloudFormationStackProperties { + /** + * A file relative to the assembly root which contains the CloudFormation template for this stack. + */ + readonly templateFile: string; + + /** + * Values for CloudFormation stack parameters that should be passed when the stack is deployed. + */ + readonly parameters?: { [id: string]: string }; + + /** + * The name to use for the CloudFormation stack. + * @default - name derived from artifact ID + */ + readonly stackName?: string; + + /** + * Whether to enable termination protection for this stack. + * + * @default false + */ + readonly terminationProtection?: boolean; +} + +/** + * Represents an artifact within a cloud assembly. + */ +export class CloudArtifact { + /** + * Returns a subclass of `CloudArtifact` based on the artifact type defined in the artifact manifest. + * + * @param assembly The cloud assembly from which to load the artifact + * @param id The artifact ID + * @param artifact The artifact manifest + * @returns the `CloudArtifact` that matches the artifact type or `undefined` if it's an artifact type that is unrecognized by this module. + */ + public static fromManifest(assembly: CloudAssembly, id: string, artifact: cxschema.ArtifactManifest): CloudArtifact | undefined { + // Implementation is defined in a separate file to break cyclic dependencies + void(assembly), void(id), void(artifact); + throw new Error('Implementation not overridden yet'); + } + + /** + * The artifact's manifest + */ + public readonly manifest: cxschema.ArtifactManifest; + + /** + * The set of messages extracted from the artifact's metadata. + */ + public readonly messages: SynthesisMessage[]; + + /** + * IDs of all dependencies. Used when topologically sorting the artifacts within the cloud assembly. + * @internal + */ + public readonly _dependencyIDs: string[]; + + /** + * Cache of resolved dependencies. + */ + private _deps?: CloudArtifact[]; + + protected constructor(public readonly assembly: CloudAssembly, public readonly id: string, manifest: cxschema.ArtifactManifest) { + this.manifest = manifest; + this.messages = this.renderMessages(); + this._dependencyIDs = manifest.dependencies || []; + } + + /** + * Returns all the artifacts that this artifact depends on. + */ + public get dependencies(): CloudArtifact[] { + if (this._deps) { return this._deps; } + + this._deps = this._dependencyIDs.map(id => { + const dep = this.assembly.tryGetArtifact(id); + if (!dep) { + throw new Error(`Artifact ${this.id} depends on non-existing artifact ${id}`); + } + return dep; + }); + + return this._deps; + } + + /** + * @returns all the metadata entries of a specific type in this artifact. + * @param type + */ + public findMetadataByType(type: string): MetadataEntryResult[] { + const result = new Array(); + for (const path of Object.keys(this.manifest.metadata || {})) { + for (const entry of (this.manifest.metadata || {})[path]) { + if (entry.type === type) { + result.push({ path, ...entry }); + } + } + } + return result; + } + + private renderMessages() { + const messages = new Array(); + + for (const [id, metadata] of Object.entries(this.manifest.metadata || { })) { + for (const entry of metadata) { + let level: SynthesisMessageLevel; + switch (entry.type) { + case cxschema.ArtifactMetadataEntryType.WARN: + level = SynthesisMessageLevel.WARNING; + break; + case cxschema.ArtifactMetadataEntryType.ERROR: + level = SynthesisMessageLevel.ERROR; + break; + case cxschema.ArtifactMetadataEntryType.INFO: + level = SynthesisMessageLevel.INFO; + break; + default: + continue; + } + + messages.push({ level, entry, id }); + } + } + + return messages; + } + + /** + * An identifier that shows where this artifact is located in the tree + * of nested assemblies, based on their manifests. Defaults to the normal + * id. Should only be used in user interfaces. + */ + public get hierarchicalId(): string { + return this.manifest.displayName ?? this.id; + } +} diff --git a/packages/aws-cdk-lib/cx-api/lib/cloud-assembly.ts b/packages/aws-cdk-lib/cx-api/lib/cloud-assembly.ts new file mode 100644 index 0000000000000..61fc3cae92b77 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/cloud-assembly.ts @@ -0,0 +1,468 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import * as cxschema from '../../cloud-assembly-schema'; +import { LoadManifestOptions } from '../../cloud-assembly-schema'; +import { CloudFormationStackArtifact } from './artifacts/cloudformation-artifact'; +import { NestedCloudAssemblyArtifact } from './artifacts/nested-cloud-assembly-artifact'; +import { TreeCloudArtifact } from './artifacts/tree-cloud-artifact'; +import { CloudArtifact } from './cloud-artifact'; +import { topologicalSort } from './toposort'; + +/** + * The name of the root manifest file of the assembly. + */ +const MANIFEST_FILE = 'manifest.json'; + +/** + * Represents a deployable cloud application. + */ +export class CloudAssembly { + /** + * The root directory of the cloud assembly. + */ + public readonly directory: string; + + /** + * The schema version of the assembly manifest. + */ + public readonly version: string; + + /** + * All artifacts included in this assembly. + */ + public readonly artifacts: CloudArtifact[]; + + /** + * Runtime information such as module versions used to synthesize this assembly. + */ + public readonly runtime: cxschema.RuntimeInfo; + + /** + * The raw assembly manifest. + */ + public readonly manifest: cxschema.AssemblyManifest; + + /** + * Reads a cloud assembly from the specified directory. + * @param directory The root directory of the assembly. + */ + constructor(directory: string, loadOptions?: LoadManifestOptions) { + this.directory = directory; + + this.manifest = cxschema.Manifest.loadAssemblyManifest(path.join(directory, MANIFEST_FILE), loadOptions); + this.version = this.manifest.version; + this.artifacts = this.renderArtifacts(); + this.runtime = this.manifest.runtime || { libraries: { } }; + + // force validation of deps by accessing 'depends' on all artifacts + this.validateDeps(); + } + + /** + * Attempts to find an artifact with a specific identity. + * @returns A `CloudArtifact` object or `undefined` if the artifact does not exist in this assembly. + * @param id The artifact ID + */ + public tryGetArtifact(id: string): CloudArtifact | undefined { + return this.artifacts.find(a => a.id === id); + } + + /** + * Returns a CloudFormation stack artifact from this assembly. + * + * Will only search the current assembly. + * + * @param stackName the name of the CloudFormation stack. + * @throws if there is no stack artifact by that name + * @throws if there is more than one stack with the same stack name. You can + * use `getStackArtifact(stack.artifactId)` instead. + * @returns a `CloudFormationStackArtifact` object. + */ + public getStackByName(stackName: string): CloudFormationStackArtifact { + const artifacts = this.artifacts.filter(a => a instanceof CloudFormationStackArtifact && a.stackName === stackName); + if (!artifacts || artifacts.length === 0) { + throw new Error(`Unable to find stack with stack name "${stackName}"`); + } + + if (artifacts.length > 1) { + // eslint-disable-next-line max-len + throw new Error(`There are multiple stacks with the stack name "${stackName}" (${artifacts.map(a => a.id).join(',')}). Use "getStackArtifact(id)" instead`); + } + + return artifacts[0] as CloudFormationStackArtifact; + } + + /** + * Returns a CloudFormation stack artifact by name from this assembly. + * @deprecated renamed to `getStackByName` (or `getStackArtifact(id)`) + */ + public getStack(stackName: string) { + return this.getStackByName(stackName); + } + + /** + * Returns a CloudFormation stack artifact from this assembly. + * + * @param artifactId the artifact id of the stack (can be obtained through `stack.artifactId`). + * @throws if there is no stack artifact with that id + * @returns a `CloudFormationStackArtifact` object. + */ + public getStackArtifact(artifactId: string): CloudFormationStackArtifact { + const artifact = this.tryGetArtifactRecursively(artifactId); + + if (!artifact) { + throw new Error(`Unable to find artifact with id "${artifactId}"`); + } + + if (!(artifact instanceof CloudFormationStackArtifact)) { + throw new Error(`Artifact ${artifactId} is not a CloudFormation stack`); + } + + return artifact; + } + + private tryGetArtifactRecursively(artifactId: string): CloudArtifact | undefined { + return this.stacksRecursively.find(a => a.id === artifactId); + } + + /** + * Returns all the stacks, including the ones in nested assemblies + */ + public get stacksRecursively(): CloudFormationStackArtifact[] { + function search(stackArtifacts: CloudFormationStackArtifact[], assemblies: CloudAssembly[]): CloudFormationStackArtifact[] { + if (assemblies.length === 0) { + return stackArtifacts; + } + + const [head, ...tail] = assemblies; + const nestedAssemblies = head.nestedAssemblies.map(asm => asm.nestedAssembly); + return search(stackArtifacts.concat(head.stacks), tail.concat(nestedAssemblies)); + }; + + return search([], [this]); + } + + /** + * Returns a nested assembly artifact. + * + * @param artifactId The artifact ID of the nested assembly + */ + public getNestedAssemblyArtifact(artifactId: string): NestedCloudAssemblyArtifact { + const artifact = this.tryGetArtifact(artifactId); + if (!artifact) { + throw new Error(`Unable to find artifact with id "${artifactId}"`); + } + + if (!(artifact instanceof NestedCloudAssemblyArtifact)) { + throw new Error(`Found artifact '${artifactId}' but it's not a nested cloud assembly`); + } + + return artifact; + } + + /** + * Returns a nested assembly. + * + * @param artifactId The artifact ID of the nested assembly + */ + public getNestedAssembly(artifactId: string): CloudAssembly { + return this.getNestedAssemblyArtifact(artifactId).nestedAssembly; + } + + /** + * Returns the tree metadata artifact from this assembly. + * @throws if there is no metadata artifact by that name + * @returns a `TreeCloudArtifact` object if there is one defined in the manifest, `undefined` otherwise. + */ + public tree(): TreeCloudArtifact | undefined { + const trees = this.artifacts.filter(a => a.manifest.type === cxschema.ArtifactType.CDK_TREE); + if (trees.length === 0) { + return undefined; + } else if (trees.length > 1) { + throw new Error(`Multiple artifacts of type ${cxschema.ArtifactType.CDK_TREE} found in manifest`); + } + const tree = trees[0]; + + if (!(tree instanceof TreeCloudArtifact)) { + throw new Error('"Tree" artifact is not of expected type'); + } + + return tree; + } + + /** + * @returns all the CloudFormation stack artifacts that are included in this assembly. + */ + public get stacks(): CloudFormationStackArtifact[] { + return this.artifacts.filter(isCloudFormationStackArtifact); + + function isCloudFormationStackArtifact(x: any): x is CloudFormationStackArtifact { + return x instanceof CloudFormationStackArtifact; + } + } + + /** + * The nested assembly artifacts in this assembly + */ + public get nestedAssemblies(): NestedCloudAssemblyArtifact[] { + return this.artifacts.filter(isNestedCloudAssemblyArtifact); + + function isNestedCloudAssemblyArtifact(x: any): x is NestedCloudAssemblyArtifact { + return x instanceof NestedCloudAssemblyArtifact; + } + } + + private validateDeps() { + for (const artifact of this.artifacts) { + ignore(artifact.dependencies); + } + } + + private renderArtifacts() { + const result = new Array(); + for (const [name, artifact] of Object.entries(this.manifest.artifacts || { })) { + const cloudartifact = CloudArtifact.fromManifest(this, name, artifact); + if (cloudartifact) { + result.push(cloudartifact); + } + } + + return topologicalSort(result, x => x.id, x => x._dependencyIDs); + } +} + +/** + * Construction properties for CloudAssemblyBuilder + */ +export interface CloudAssemblyBuilderProps { + /** + * Use the given asset output directory + * + * @default - Same as the manifest outdir + */ + readonly assetOutdir?: string; + + /** + * If this builder is for a nested assembly, the parent assembly builder + * + * @default - This is a root assembly + */ + readonly parentBuilder?: CloudAssemblyBuilder; +} + +/** + * Can be used to build a cloud assembly. + */ +export class CloudAssemblyBuilder { + /** + * The root directory of the resulting cloud assembly. + */ + public readonly outdir: string; + + /** + * The directory where assets of this Cloud Assembly should be stored + */ + public readonly assetOutdir: string; + + private readonly artifacts: { [id: string]: cxschema.ArtifactManifest } = { }; + private readonly missing = new Array(); + private readonly parentBuilder?: CloudAssemblyBuilder; + + /** + * Initializes a cloud assembly builder. + * @param outdir The output directory, uses temporary directory if undefined + */ + constructor(outdir?: string, props: CloudAssemblyBuilderProps = {}) { + this.outdir = determineOutputDirectory(outdir); + this.assetOutdir = props.assetOutdir ?? this.outdir; + this.parentBuilder = props.parentBuilder; + + // we leverage the fact that outdir is long-lived to avoid staging assets into it + // that were already staged (copying can be expensive). this is achieved by the fact + // that assets use a source hash as their name. other artifacts, and the manifest itself, + // will overwrite existing files as needed. + ensureDirSync(this.outdir); + } + + /** + * Adds an artifact into the cloud assembly. + * @param id The ID of the artifact. + * @param manifest The artifact manifest + */ + public addArtifact(id: string, manifest: cxschema.ArtifactManifest) { + this.artifacts[id] = filterUndefined(manifest); + } + + /** + * Reports that some context is missing in order for this cloud assembly to be fully synthesized. + * @param missing Missing context information. + */ + public addMissing(missing: cxschema.MissingContext) { + if (this.missing.every(m => m.key !== missing.key)) { + this.missing.push(missing); + } + // Also report in parent + this.parentBuilder?.addMissing(missing); + } + + /** + * Finalizes the cloud assembly into the output directory returns a + * `CloudAssembly` object that can be used to inspect the assembly. + * @param options + */ + public buildAssembly(options: AssemblyBuildOptions = { }): CloudAssembly { + + // explicitly initializing this type will help us detect + // breaking changes. (For example adding a required property will break compilation). + let manifest: cxschema.AssemblyManifest = { + version: cxschema.Manifest.version(), + artifacts: this.artifacts, + runtime: options.runtimeInfo, + missing: this.missing.length > 0 ? this.missing : undefined, + }; + + // now we can filter + manifest = filterUndefined(manifest); + + const manifestFilePath = path.join(this.outdir, MANIFEST_FILE); + cxschema.Manifest.saveAssemblyManifest(manifest, manifestFilePath); + + // "backwards compatibility": in order for the old CLI to tell the user they + // need a new version, we'll emit the legacy manifest with only "version". + // this will result in an error "CDK Toolkit >= CLOUD_ASSEMBLY_VERSION is required in order to interact with this program." + fs.writeFileSync(path.join(this.outdir, 'cdk.out'), JSON.stringify({ version: manifest.version })); + + return new CloudAssembly(this.outdir); + } + + /** + * Creates a nested cloud assembly + */ + public createNestedAssembly(artifactId: string, displayName: string) { + const directoryName = artifactId; + const innerAsmDir = path.join(this.outdir, directoryName); + + this.addArtifact(artifactId, { + type: cxschema.ArtifactType.NESTED_CLOUD_ASSEMBLY, + properties: { + directoryName, + displayName, + } as cxschema.NestedCloudAssemblyProperties, + }); + + return new CloudAssemblyBuilder(innerAsmDir, { + // Reuse the same asset output directory as the current Casm builder + assetOutdir: this.assetOutdir, + parentBuilder: this, + }); + } +} + +/** + * Backwards compatibility for when `RuntimeInfo` + * was defined here. This is necessary because its used as an input in the stable + * @aws-cdk/core library. + * + * @deprecated moved to package 'cloud-assembly-schema' + * @see core.ConstructNode.synth + */ +export interface RuntimeInfo extends cxschema.RuntimeInfo { + +} + +/** + * Backwards compatibility for when `MetadataEntry` + * was defined here. This is necessary because its used as an input in the stable + * @aws-cdk/core library. + * + * @deprecated moved to package 'cloud-assembly-schema' + * @see core.ConstructNode.metadata + */ +export interface MetadataEntry extends cxschema.MetadataEntry { + +} + +/** + * Backwards compatibility for when `MissingContext` + * was defined here. This is necessary because its used as an input in the stable + * @aws-cdk/core library. + * + * @deprecated moved to package 'cloud-assembly-schema' + * @see core.Stack.reportMissingContext + */ +export interface MissingContext { + /** + * The missing context key. + */ + readonly key: string; + + /** + * The provider from which we expect this context key to be obtained. + * + * (This is the old untyped definition, which is necessary for backwards compatibility. + * See cxschema for a type definition.) + */ + readonly provider: string; + + /** + * A set of provider-specific options. + * + * (This is the old untyped definition, which is necessary for backwards compatibility. + * See cxschema for a type definition.) + */ + readonly props: Record; +} + +export interface AssemblyBuildOptions { + /** + * Include the specified runtime information (module versions) in manifest. + * @default - if this option is not specified, runtime info will not be included + * @deprecated All template modifications that should result from this should + * have already been inserted into the template. + */ + readonly runtimeInfo?: RuntimeInfo; +} + +/** + * Returns a copy of `obj` without undefined values in maps or arrays. + */ +function filterUndefined(obj: any): any { + if (Array.isArray(obj)) { + return obj.filter(x => x !== undefined).map(x => filterUndefined(x)); + } + + if (typeof(obj) === 'object') { + const ret: any = { }; + for (const [key, value] of Object.entries(obj)) { + if (value === undefined) { + continue; + } + ret[key] = filterUndefined(value); + } + return ret; + } + + return obj; +} + +function ignore(_x: any) { + return; +} + +/** + * Turn the given optional output directory into a fixed output directory + */ +function determineOutputDirectory(outdir?: string) { + return outdir ?? fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'cdk.out')); +} + +function ensureDirSync(dir: string) { + if (fs.existsSync(dir)) { + if (!fs.statSync(dir).isDirectory()) { + throw new Error(`${dir} must be a directory`); + } + } else { + fs.mkdirSync(dir, { recursive: true }); + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/context/ami.ts b/packages/aws-cdk-lib/cx-api/lib/context/ami.ts new file mode 100644 index 0000000000000..00908a5e4798c --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/ami.ts @@ -0,0 +1,4 @@ +/** + * Returns just an AMI ID + */ +export type AmiContextResponse = string; diff --git a/packages/aws-cdk-lib/cx-api/lib/context/availability-zones.ts b/packages/aws-cdk-lib/cx-api/lib/context/availability-zones.ts new file mode 100644 index 0000000000000..fe1f484ba8b6f --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/availability-zones.ts @@ -0,0 +1,13 @@ +/** + * This context key is used to determine the value of `stack.availabilityZones` + * when a stack is not associated with a specific account/region (env-agnostic). + * + * If this key is passed in the context, the values will be used. Otherwise, a + * system-fallback which uses `Fn::GetAZs` will be used. + */ +export const AVAILABILITY_ZONE_FALLBACK_CONTEXT_KEY = 'aws:cdk:availability-zones:fallback'; + +/** + * Response of the AZ provider looks like this + */ +export type AvailabilityZonesContextResponse = string[]; \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/context/endpoint-service-availability-zones.ts b/packages/aws-cdk-lib/cx-api/lib/context/endpoint-service-availability-zones.ts new file mode 100644 index 0000000000000..657a402cb2548 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/endpoint-service-availability-zones.ts @@ -0,0 +1,26 @@ +export const ENDPOINT_SERVICE_AVAILABILITY_ZONE_PROVIDER = 'endpoint-service-availability-zones'; + +/** + * Query to hosted zone context provider + */ +export interface EndpointServiceAvailabilityZonesContextQuery { + /** + * Query account + */ + readonly account?: string; + + /** + * Query region + */ + readonly region?: string; + + /** + * Query service name + */ + readonly serviceName?: string; +} + +/** + * Response of the AZ provider looks like this + */ +export type EndpointServiceAvailabilityZonesContextResponse = string[]; diff --git a/packages/aws-cdk-lib/cx-api/lib/context/key.ts b/packages/aws-cdk-lib/cx-api/lib/context/key.ts new file mode 100644 index 0000000000000..00693711eb7f4 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/key.ts @@ -0,0 +1,11 @@ +/** + * Properties of a discovered key + */ +export interface KeyContextResponse { + + /** + * Id of the key + */ + readonly keyId: string; + +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/context/load-balancer.ts b/packages/aws-cdk-lib/cx-api/lib/context/load-balancer.ts new file mode 100644 index 0000000000000..bea7c432de57f --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/load-balancer.ts @@ -0,0 +1,69 @@ +/** + * Load balancer ip address type. + */ +export enum LoadBalancerIpAddressType { + /** + * IPV4 ip address + */ + IPV4 = 'ipv4', + + /** + * Dual stack address + */ + DUAL_STACK = 'dualstack', +} + +/** + * Properties of a discovered load balancer + */ +export interface LoadBalancerContextResponse { + /** + * The ARN of the load balancer. + */ + readonly loadBalancerArn: string; + + /** + * The hosted zone ID of the load balancer's name. + */ + readonly loadBalancerCanonicalHostedZoneId: string; + + /** + * Load balancer's DNS name + */ + readonly loadBalancerDnsName: string; + + /** + * Type of IP address + */ + readonly ipAddressType: LoadBalancerIpAddressType; + + /** + * Load balancer's security groups + */ + readonly securityGroupIds: string[]; + + /** + * Load balancer's VPC + */ + readonly vpcId: string; +} + +/** + * Properties of a discovered load balancer listener. + */ +export interface LoadBalancerListenerContextResponse { + /** + * The ARN of the listener. + */ + readonly listenerArn: string; + + /** + * The port the listener is listening on. + */ + readonly listenerPort: number; + + /** + * The security groups of the load balancer. + */ + readonly securityGroupIds: string[]; +} diff --git a/packages/aws-cdk-lib/cx-api/lib/context/security-group.ts b/packages/aws-cdk-lib/cx-api/lib/context/security-group.ts new file mode 100644 index 0000000000000..f1ea8c2a7ca37 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/security-group.ts @@ -0,0 +1,17 @@ + +/** + * Properties of a discovered SecurityGroup. + */ +export interface SecurityGroupContextResponse { + /** + * The security group's id. + */ + readonly securityGroupId: string; + + /** + * Whether the security group allows all outbound traffic. This will be true + * when the security group has all-protocol egress permissions to access both + * `0.0.0.0/0` and `::/0`. + */ + readonly allowAllOutbound: boolean; +} diff --git a/packages/aws-cdk-lib/cx-api/lib/context/vpc.ts b/packages/aws-cdk-lib/cx-api/lib/context/vpc.ts new file mode 100644 index 0000000000000..a1eac4cd7ed39 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/context/vpc.ts @@ -0,0 +1,171 @@ +/** + * The type of subnet group. + * Same as SubnetType in the @aws-cdk/aws-ec2 package, + * but we can't use that because of cyclical dependencies. + */ +export enum VpcSubnetGroupType { + /** Public subnet group type. */ + PUBLIC = 'Public', + + /** Private subnet group type. */ + PRIVATE = 'Private', + + /** Isolated subnet group type. */ + ISOLATED = 'Isolated', +} + +/** + * A subnet representation that the VPC provider uses. + */ +export interface VpcSubnet { + /** The identifier of the subnet. */ + readonly subnetId: string; + + /** + * The code of the availability zone this subnet is in + * (for example, 'us-west-2a'). + */ + readonly availabilityZone: string; + + /** The identifier of the route table for this subnet. */ + readonly routeTableId: string; + + /** + * CIDR range of the subnet + * + * @default - CIDR information not available + */ + readonly cidr?: string; +} + +/** + * A group of subnets returned by the VPC provider. + * The included subnets do NOT have to be symmetric! + */ +export interface VpcSubnetGroup { + /** + * The name of the subnet group, + * determined by looking at the tags of of the subnets + * that belong to it. + */ + readonly name: string; + + /** The type of the subnet group. */ + readonly type: VpcSubnetGroupType; + + /** + * The subnets that are part of this group. + * There is no condition that the subnets have to be symmetric + * in the group. + */ + readonly subnets: VpcSubnet[]; +} + +/** + * Properties of a discovered VPC + */ +export interface VpcContextResponse { + + /** + * VPC id + */ + readonly vpcId: string; + + /** + * VPC cidr + * + * @default - CIDR information not available + */ + readonly vpcCidrBlock?: string; + + /** + * AZs + */ + readonly availabilityZones: string[]; + + /** + * IDs of all public subnets + * + * Element count: #(availabilityZones) · #(publicGroups) + */ + readonly publicSubnetIds?: string[]; + + /** + * Name of public subnet groups + * + * Element count: #(publicGroups) + */ + readonly publicSubnetNames?: string[]; + + /** + * Route Table IDs of public subnet groups. + * + * Element count: #(availabilityZones) · #(publicGroups) + */ + readonly publicSubnetRouteTableIds?: string[]; + + /** + * IDs of all private subnets + * + * Element count: #(availabilityZones) · #(privateGroups) + */ + readonly privateSubnetIds?: string[]; + + /** + * Name of private subnet groups + * + * Element count: #(privateGroups) + */ + readonly privateSubnetNames?: string[]; + + /** + * Route Table IDs of private subnet groups. + * + * Element count: #(availabilityZones) · #(privateGroups) + */ + readonly privateSubnetRouteTableIds?: string[]; + + /** + * IDs of all isolated subnets + * + * Element count: #(availabilityZones) · #(isolatedGroups) + */ + readonly isolatedSubnetIds?: string[]; + + /** + * Name of isolated subnet groups + * + * Element count: #(isolatedGroups) + */ + readonly isolatedSubnetNames?: string[]; + + /** + * Route Table IDs of isolated subnet groups. + * + * Element count: #(availabilityZones) · #(isolatedGroups) + */ + readonly isolatedSubnetRouteTableIds?: string[]; + + /** + * The VPN gateway ID + */ + readonly vpnGatewayId?: string; + + /** + * The subnet groups discovered for the given VPC. + * Unlike the above properties, this will include asymmetric subnets, + * if the VPC has any. + * This property will only be populated if `VpcContextQuery.returnAsymmetricSubnets` + * is true. + * + * @default - no subnet groups will be returned unless `VpcContextQuery.returnAsymmetricSubnets` is true + */ + readonly subnetGroups?: VpcSubnetGroup[]; + + /** + * The region in which the VPC is in. + * + * @default - Region of the parent stack + */ + readonly region?: string; +} diff --git a/packages/aws-cdk-lib/cx-api/lib/cxapi.ts b/packages/aws-cdk-lib/cx-api/lib/cxapi.ts new file mode 100644 index 0000000000000..8137dcf3907f6 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/cxapi.ts @@ -0,0 +1,48 @@ +// output directory into which to emit synthesis outputs. CDK doesn't allow outdir +// to be specified both through the CDK_OUTDIR environment variable and the through +// aws:cdk:outdir context. +export const OUTDIR_ENV = 'CDK_OUTDIR'; +export const CONTEXT_ENV = 'CDK_CONTEXT_JSON'; + +/** + * The name of the temporary file where the context is stored. + */ +export const CONTEXT_OVERFLOW_LOCATION_ENV = 'CONTEXT_OVERFLOW_LOCATION_ENV'; + +/** + * Environment variable set by the CDK CLI with the default AWS account ID. + */ +export const DEFAULT_ACCOUNT_ENV = 'CDK_DEFAULT_ACCOUNT'; + +/** + * Environment variable set by the CDK CLI with the default AWS region. + */ +export const DEFAULT_REGION_ENV = 'CDK_DEFAULT_REGION'; + +/** + * Version of Cloud Assembly expected by CDK CLI. + * + * CLI started emitting this at 1.10.1 + */ +export const CLI_ASM_VERSION_ENV = 'CDK_CLI_ASM_VERSION'; + +/** + * Version of the CLI currently running. + * + * CLI started emitting this at 1.10.1 + */ +export const CLI_VERSION_ENV = 'CDK_CLI_VERSION'; + +/** + * If a context value is an object with this key, it indicates an error + */ +export const PROVIDER_ERROR_KEY = '$providerError'; + + +/** + * This SSM parameter does not invalidate the template + * + * If this string occurs in the description of an SSM parameter, the CLI + * will not assume that the stack must always be redeployed. + */ +export const SSMPARAM_NO_INVALIDATE = '[cdk:skip]'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/lib/environment.ts b/packages/aws-cdk-lib/cx-api/lib/environment.ts new file mode 100644 index 0000000000000..3ba1369e76850 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/environment.ts @@ -0,0 +1,55 @@ +/** + * Parser for the artifact environment field. + * + * Account validation is relaxed to allow account aliasing in the future. + */ +const AWS_ENV_REGEX = /aws\:\/\/([a-z0-9A-Z\-\@\.\_]+)\/([a-z\-0-9]+)/; + +/** + * Models an AWS execution environment, for use within the CDK toolkit. + */ +export interface Environment { + /** The arbitrary name of this environment (user-set, or at least user-meaningful) */ + readonly name: string; + + /** The AWS account this environment deploys into */ + readonly account: string; + + /** The AWS region name where this environment deploys into */ + readonly region: string; +} + +export const UNKNOWN_ACCOUNT = 'unknown-account'; +export const UNKNOWN_REGION = 'unknown-region'; + +export class EnvironmentUtils { + public static parse(environment: string): Environment { + const env = AWS_ENV_REGEX.exec(environment); + if (!env) { + throw new Error( + `Unable to parse environment specification "${environment}". ` + + 'Expected format: aws://account/region'); + } + + const [, account, region] = env; + if (!account || !region) { + throw new Error(`Invalid environment specification: ${environment}`); + } + + return { account, region, name: environment }; + } + + /** + * Build an environment object from an account and region + */ + public static make(account: string, region: string): Environment { + return { account, region, name: this.format(account, region) }; + } + + /** + * Format an environment string from an account and region + */ + public static format(account: string, region: string): string { + return `aws://${account}/${region}`; + } +} diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts new file mode 100644 index 0000000000000..c5800e628c13f --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -0,0 +1,811 @@ +import { FlagInfo, FlagType } from './private/flag-modeling'; + +//////////////////////////////////////////////////////////////////////// +// +// This file defines context keys that enable certain features that are +// implemented behind a flag in order to preserve backwards compatibility for +// existing apps. When a new app is initialized through `cdk init`, the CLI will +// automatically add enable these features by adding them to the generated +// `cdk.json` file. +// +//////////////////////////////////////////////////////////////////////// +// +// !!! IMPORTANT !!! +// +// When you introduce a new flag, set its 'introducedIn.v2' value to the literal string +// 'V2·NEXT', without the dot. +// +// DO NOT USE A VARIABLE. DO NOT DEFINE A CONSTANT. The actual value will be string-replaced at +// version bump time. +// +//////////////////////////////////////////////////////////////////////// +// +// There are three types of flags: ApiDefault, BugFix, and VisibleContext flags. +// +// - ApiDefault flags: change the behavior or defaults of the construct library. When +// set, the infrastructure that is generated may be different but there is +// a way to get the old infrastructure setup by using the API in a different way. +// +// - BugFix flags: the old infra we used to generate is no longer recommended, +// and there is no way to achieve that result anymore except by making sure the +// flag is unset, or set to `false`. Mostly used for infra-impacting bugfixes or +// enhanced security defaults. +// +// - VisibleContext flags: not really a feature flag, but configurable context which is +// advertised by putting the context in the `cdk.json` file of new projects. +// +// In future major versions, the "newProjectValues" will become the version +// default for both DefaultBehavior and BugFix flags, and DefaultBehavior flags +// will be removed (i.e., their new behavior will become the *only* behavior). +// +// See https://github.com/aws/aws-cdk-rfcs/blob/master/text/0055-feature-flags.md +// -------------------------------------------------------------------------------- + + +export const ENABLE_STACK_NAME_DUPLICATES_CONTEXT = '@aws-cdk/core:enableStackNameDuplicates'; +export const ENABLE_DIFF_NO_FAIL_CONTEXT = 'aws-cdk:enableDiffNoFail'; +/** @deprecated use `ENABLE_DIFF_NO_FAIL_CONTEXT` */ +export const ENABLE_DIFF_NO_FAIL = ENABLE_DIFF_NO_FAIL_CONTEXT; +export const NEW_STYLE_STACK_SYNTHESIS_CONTEXT = '@aws-cdk/core:newStyleStackSynthesis'; +export const STACK_RELATIVE_EXPORTS_CONTEXT = '@aws-cdk/core:stackRelativeExports'; +export const DOCKER_IGNORE_SUPPORT = '@aws-cdk/aws-ecr-assets:dockerIgnoreSupport'; +export const SECRETS_MANAGER_PARSE_OWNED_SECRET_NAME = '@aws-cdk/aws-secretsmanager:parseOwnedSecretName'; +export const KMS_DEFAULT_KEY_POLICIES = '@aws-cdk/aws-kms:defaultKeyPolicies'; +export const S3_GRANT_WRITE_WITHOUT_ACL = '@aws-cdk/aws-s3:grantWriteWithoutAcl'; +export const ECS_REMOVE_DEFAULT_DESIRED_COUNT = '@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount'; +export const RDS_LOWERCASE_DB_IDENTIFIER = '@aws-cdk/aws-rds:lowercaseDbIdentifier'; +export const APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID = '@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId'; +export const EFS_DEFAULT_ENCRYPTION_AT_REST = '@aws-cdk/aws-efs:defaultEncryptionAtRest'; +export const LAMBDA_RECOGNIZE_VERSION_PROPS = '@aws-cdk/aws-lambda:recognizeVersionProps'; +export const LAMBDA_RECOGNIZE_LAYER_VERSION = '@aws-cdk/aws-lambda:recognizeLayerVersion'; +export const CLOUDFRONT_DEFAULT_SECURITY_POLICY_TLS_V1_2_2021 = '@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021'; +export const CHECK_SECRET_USAGE = '@aws-cdk/core:checkSecretUsage'; +export const TARGET_PARTITIONS = '@aws-cdk/core:target-partitions'; +export const ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER = '@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver'; +export const EC2_UNIQUE_IMDSV2_LAUNCH_TEMPLATE_NAME = '@aws-cdk/aws-ec2:uniqueImdsv2TemplateName'; +export const ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME = '@aws-cdk/aws-ecs:arnFormatIncludesClusterName'; +export const IAM_MINIMIZE_POLICIES = '@aws-cdk/aws-iam:minimizePolicies'; +export const IAM_IMPORTED_ROLE_STACK_SAFE_DEFAULT_POLICY_NAME = '@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName'; +export const VALIDATE_SNAPSHOT_REMOVAL_POLICY = '@aws-cdk/core:validateSnapshotRemovalPolicy'; +export const CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME = '@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName'; +export const S3_CREATE_DEFAULT_LOGGING_POLICY = '@aws-cdk/aws-s3:createDefaultLoggingPolicy'; +export const SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY = '@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption'; +export const APIGATEWAY_DISABLE_CLOUDWATCH_ROLE = '@aws-cdk/aws-apigateway:disableCloudWatchRole'; +export const ENABLE_PARTITION_LITERALS = '@aws-cdk/core:enablePartitionLiterals'; +export const EVENTS_TARGET_QUEUE_SAME_ACCOUNT = '@aws-cdk/aws-events:eventsTargetQueueSameAccount'; +export const IAM_STANDARDIZED_SERVICE_PRINCIPALS = '@aws-cdk/aws-iam:standardizedServicePrincipals'; +export const ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER = '@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker'; +export const S3_SERVER_ACCESS_LOGS_USE_BUCKET_POLICY = '@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy'; +export const ROUTE53_PATTERNS_USE_CERTIFICATE = '@aws-cdk/aws-route53-patters:useCertificate'; +export const AWS_CUSTOM_RESOURCE_LATEST_SDK_DEFAULT = '@aws-cdk/customresources:installLatestAwsSdkDefault'; +export const DATABASE_PROXY_UNIQUE_RESOURCE_NAME = '@aws-cdk/aws-rds:databaseProxyUniqueResourceName'; +export const CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP = '@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup'; +export const APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID = '@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId'; +export const EC2_LAUNCH_TEMPLATE_DEFAULT_USER_DATA = '@aws-cdk/aws-ec2:launchTemplateDefaultUserData'; +export const SECRETS_MANAGER_TARGET_ATTACHMENT_RESOURCE_POLICY = '@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments'; +export const REDSHIFT_COLUMN_ID = '@aws-cdk/aws-redshift:columnId'; +export const ENABLE_EMR_SERVICE_POLICY_V2 = '@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2'; + +export const FLAGS: Record = { + ////////////////////////////////////////////////////////////////////// + [ENABLE_STACK_NAME_DUPLICATES_CONTEXT]: { + type: FlagType.ApiDefault, + summary: 'Allow multiple stacks with the same name', + detailsMd: ` + If this is set, multiple stacks can use the same stack name (e.g. deployed to + different environments). This means that the name of the synthesized template + file will be based on the construct path and not on the defined \`stackName\` + of the stack.`, + recommendedValue: true, + introducedIn: { v1: '1.16.0' }, + defaults: { v2: true }, + compatibilityWithOldBehaviorMd: 'Pass stack identifiers to the CLI instead of stack names.', + }, + + ////////////////////////////////////////////////////////////////////// + [ENABLE_DIFF_NO_FAIL_CONTEXT]: { + type: FlagType.ApiDefault, + summary: 'Make `cdk diff` not fail when there are differences', + detailsMd: ` + Determines what status code \`cdk diff\` should return when the specified stack + differs from the deployed stack or the local CloudFormation template: + + * \`aws-cdk:enableDiffNoFail=true\` => status code == 0 + * \`aws-cdk:enableDiffNoFail=false\` => status code == 1 + + You can override this behavior with the --fail flag: + + * \`--fail\` => status code == 1 + * \`--no-fail\` => status code == 0`, + introducedIn: { v1: '1.19.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Specify `--fail` to the CLI.', + }, + + ////////////////////////////////////////////////////////////////////// + [NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: { + type: FlagType.BugFix, + summary: 'Switch to new stack synthesis method which enables CI/CD', + detailsMd: ` + If this flag is specified, all \`Stack\`s will use the \`DefaultStackSynthesizer\` by + default. If it is not set, they will use the \`LegacyStackSynthesizer\`.`, + introducedIn: { v1: '1.39.0', v2: '2.0.0' }, + defaults: { v2: true }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [STACK_RELATIVE_EXPORTS_CONTEXT]: { + type: FlagType.BugFix, + summary: 'Name exports based on the construct paths relative to the stack, rather than the global construct path', + detailsMd: ` + Combined with the stack name this relative construct path is good enough to + ensure uniqueness, and makes the export names robust against refactoring + the location of the stack in the construct tree (specifically, moving the Stack + into a Stage).`, + introducedIn: { v1: '1.58.0', v2: '2.0.0' }, + defaults: { v2: true }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [DOCKER_IGNORE_SUPPORT]: { + type: FlagType.ApiDefault, + summary: 'DockerImageAsset properly supports `.dockerignore` files by default', + detailsMd: ` + If this flag is not set, the default behavior for \`DockerImageAsset\` is to use + glob semantics for \`.dockerignore\` files. If this flag is set, the default behavior + is standard Docker ignore semantics. + + This is a feature flag as the old behavior was technically incorrect but + users may have come to depend on it.`, + introducedIn: { v1: '1.73.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Update your `.dockerignore` file to match standard Docker ignore rules, if necessary.', + }, + + ////////////////////////////////////////////////////////////////////// + [SECRETS_MANAGER_PARSE_OWNED_SECRET_NAME]: { + type: FlagType.ApiDefault, + summary: 'Fix the referencing of SecretsManager names from ARNs', + detailsMd: ` + Secret.secretName for an "owned" secret will attempt to parse the secretName from the ARN, + rather than the default full resource name, which includes the SecretsManager suffix. + + If this flag is not set, Secret.secretName will include the SecretsManager suffix, which cannot be directly + used by SecretsManager.DescribeSecret, and must be parsed by the user first (e.g., Fn:Join, Fn:Select, Fn:Split).`, + introducedIn: { v1: '1.77.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Use `parseArn(secret.secretName).resourceName` to emulate the incorrect old parsing.', + }, + + ////////////////////////////////////////////////////////////////////// + [KMS_DEFAULT_KEY_POLICIES]: { + type: FlagType.ApiDefault, + summary: 'Tighten default KMS key policies', + detailsMd: ` + KMS Keys start with a default key policy that grants the account access to administer the key, + mirroring the behavior of the KMS SDK/CLI/Console experience. Users may override the default key + policy by specifying their own. + + If this flag is not set, the default key policy depends on the setting of the \`trustAccountIdentities\` + flag. If false (the default, for backwards-compatibility reasons), the default key policy somewhat + resembles the default admin key policy, but with the addition of 'GenerateDataKey' permissions. If + true, the policy matches what happens when this feature flag is set. + + Additionally, if this flag is not set and the user supplies a custom key policy, this will be appended + to the key's default policy (rather than replacing it).`, + introducedIn: { v1: '1.78.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Pass `trustAccountIdentities: false` to `Key` construct to restore the old behavior.', + }, + + ////////////////////////////////////////////////////////////////////// + [S3_GRANT_WRITE_WITHOUT_ACL]: { + type: FlagType.ApiDefault, + summary: 'Remove `PutObjectAcl` from Bucket.grantWrite', + detailsMd: ` + Change the old 's3:PutObject*' permission to 's3:PutObject' on Bucket, + as the former includes 's3:PutObjectAcl', + which could be used to grant read/write object access to IAM principals in other accounts. + Use a feature flag to make sure existing customers who might be relying + on the overly-broad permissions are not broken.`, + introducedIn: { v1: '1.85.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Call `bucket.grantPutAcl()` in addition to `bucket.grantWrite()` to grant ACL permissions.', + }, + + ////////////////////////////////////////////////////////////////////// + [ECS_REMOVE_DEFAULT_DESIRED_COUNT]: { + type: FlagType.ApiDefault, + summary: 'Do not specify a default DesiredCount for ECS services', + detailsMd: ` + ApplicationLoadBalancedServiceBase, ApplicationMultipleTargetGroupServiceBase, + NetworkLoadBalancedServiceBase, NetworkMultipleTargetGroupServiceBase, and + QueueProcessingServiceBase currently determine a default value for the desired count of + a CfnService if a desiredCount is not provided. The result of this is that on every + deployment, the service count is reset to the fixed value, even if it was autoscaled. + + If this flag is not set, the default behaviour for CfnService.desiredCount is to set a + desiredCount of 1, if one is not provided. If true, a default will not be defined for + CfnService.desiredCount and as such desiredCount will be undefined, if one is not provided.`, + introducedIn: { v1: '1.92.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'You can pass `desiredCount: 1` explicitly, but you should never need this.', + }, + + ////////////////////////////////////////////////////////////////////// + [RDS_LOWERCASE_DB_IDENTIFIER]: { + type: FlagType.BugFix, + summary: 'Force lowercasing of RDS Cluster names in CDK', + detailsMd: ` + Cluster names must be lowercase, and the service will lowercase the name when the cluster + is created. However, CDK did not use to know about this, and would use the user-provided name + referencing the cluster, which would fail if it happened to be mixed-case. + + With this flag, lowercase the name in CDK so we can reference it properly. + + Must be behind a permanent flag because changing a name from mixed case to lowercase between deployments + would lead CloudFormation to think the name was changed and would trigger a cluster replacement + (losing data!).`, + introducedIn: { v1: '1.97.0', v2: '2.0.0' }, + defaults: { v2: true }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID]: { + type: FlagType.BugFix, + summary: 'Allow adding/removing multiple UsagePlanKeys independently', + detailsMd: ` + The UsagePlanKey resource connects an ApiKey with a UsagePlan. API Gateway does not allow more than one UsagePlanKey + for any given UsagePlan and ApiKey combination. For this reason, CloudFormation cannot replace this resource without + either the UsagePlan or ApiKey changing. + + The feature addition to support multiple UsagePlanKey resources - 142bd0e2 - recognized this and attempted to keep + existing UsagePlanKey logical ids unchanged. + However, this intentionally caused the logical id of the UsagePlanKey to be sensitive to order. That is, when + the 'first' UsagePlanKey resource is removed, the logical id of the 'second' assumes what was originally the 'first', + which again is disallowed. + + In effect, there is no way to get out of this mess in a backwards compatible way, while supporting existing stacks. + This flag changes the logical id layout of UsagePlanKey to not be sensitive to order.`, + introducedIn: { v1: '1.98.0', v2: '2.0.0' }, + defaults: { v2: true }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [EFS_DEFAULT_ENCRYPTION_AT_REST]: { + type: FlagType.ApiDefault, + summary: 'Enable this feature flag to have elastic file systems encrypted at rest by default.', + detailsMd: ` + Encryption can also be configured explicitly using the \`encrypted\` property. + `, + introducedIn: { v1: '1.98.0' }, + defaults: { v2: true }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Pass the `encrypted: false` property to the `FileSystem` construct to disable encryption.', + }, + + ////////////////////////////////////////////////////////////////////// + [LAMBDA_RECOGNIZE_VERSION_PROPS]: { + type: FlagType.BugFix, + summary: 'Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.', + detailsMd: ` + The previous calculation incorrectly considered properties of the \`AWS::Lambda::Function\` resource that did + not constitute creating a new Version. + + See 'currentVersion' section in the aws-lambda module's README for more details.`, + introducedIn: { v1: '1.106.0', v2: '2.0.0' }, + defaults: { v2: true }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [LAMBDA_RECOGNIZE_LAYER_VERSION]: { + type: FlagType.BugFix, + summary: 'Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.', + detailsMd: ` + This flag correct incorporates Lambda Layer properties into the Lambda Function Version. + + See 'currentVersion' section in the aws-lambda module's README for more details.`, + introducedIn: { v1: '1.159.0', v2: '2.27.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [CLOUDFRONT_DEFAULT_SECURITY_POLICY_TLS_V1_2_2021]: { + type: FlagType.BugFix, + summary: 'Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default.', + detailsMd: ` + The security policy can also be configured explicitly using the \`minimumProtocolVersion\` property.`, + introducedIn: { v1: '1.117.0', v2: '2.0.0' }, + defaults: { v2: true }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [CHECK_SECRET_USAGE]: { + type: FlagType.VisibleContext, + summary: 'Enable this flag to make it impossible to accidentally use SecretValues in unsafe locations', + detailsMd: ` + With this flag enabled, \`SecretValue\` instances can only be passed to + constructs that accept \`SecretValue\`s; otherwise, \`unsafeUnwrap()\` must be + called to use it as a regular string.`, + introducedIn: { v1: '1.153.0', v2: '2.21.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [TARGET_PARTITIONS]: { + type: FlagType.VisibleContext, + summary: 'What regions to include in lookup tables of environment agnostic stacks', + detailsMd: ` + Has no effect on stacks that have a defined region, but will limit the amount + of unnecessary regions included in stacks without a known region. + + The type of this value should be a list of strings.`, + introducedIn: { v1: '1.137.0', v2: '2.4.0' }, + recommendedValue: ['aws', 'aws-cn'], + }, + + ////////////////////////////////////////////////////////////////////// + [ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER]: { + type: FlagType.ApiDefault, + summary: 'ECS extensions will automatically add an `awslogs` driver if no logging is specified', + detailsMd: ` + Enable this feature flag to configure default logging behavior for the ECS Service Extensions. This will enable the + \`awslogs\` log driver for the application container of the service to send the container logs to CloudWatch Logs. + + This is a feature flag as the new behavior provides a better default experience for the users.`, + introducedIn: { v1: '1.140.0', v2: '2.8.0' }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Specify a log driver explicitly.', + }, + + ////////////////////////////////////////////////////////////////////// + [EC2_UNIQUE_IMDSV2_LAUNCH_TEMPLATE_NAME]: { + type: FlagType.BugFix, + summary: 'Enable this feature flag to have Launch Templates generated by the `InstanceRequireImdsv2Aspect` use unique names.', + detailsMd: ` + Previously, the generated Launch Template names were only unique within a stack because they were based only on the + \`Instance\` construct ID. If another stack that has an \`Instance\` with the same construct ID is deployed in the same + account and region, the deployments would always fail as the generated Launch Template names were the same. + + The new implementation addresses this issue by generating the Launch Template name with the \`Names.uniqueId\` method.`, + introducedIn: { v1: '1.140.0', v2: '2.8.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [ECS_ARN_FORMAT_INCLUDES_CLUSTER_NAME]: { + type: FlagType.BugFix, + summary: 'ARN format used by ECS. In the new ARN format, the cluster name is part of the resource ID.', + detailsMd: ` + If this flag is not set, the old ARN format (without cluster name) for ECS is used. + If this flag is set, the new ARN format (with cluster name) for ECS is used. + + This is a feature flag as the old format is still valid for existing ECS clusters. + + See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids + `, + introducedIn: { v2: '2.35.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [IAM_MINIMIZE_POLICIES]: { + type: FlagType.VisibleContext, + summary: 'Minimize IAM policies by combining Statements', + detailsMd: ` + Minimize IAM policies by combining Principals, Actions and Resources of two + Statements in the policies, as long as it doesn't change the meaning of the + policy.`, + introducedIn: { v1: '1.150.0', v2: '2.18.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [VALIDATE_SNAPSHOT_REMOVAL_POLICY]: { + type: FlagType.ApiDefault, + summary: 'Error on snapshot removal policies on resources that do not support it.', + detailsMd: ` + Makes sure we do not allow snapshot removal policy on resources that do not support it. + If supplied on an unsupported resource, CloudFormation ignores the policy altogether. + This flag will reduce confusion and unexpected loss of data when erroneously supplying + the snapshot removal policy.`, + introducedIn: { v2: '2.28.0' }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'The old behavior was incorrect. Update your source to not specify SNAPSHOT policies on resources that do not support it.', + }, + + ////////////////////////////////////////////////////////////////////// + [CODEPIPELINE_CROSS_ACCOUNT_KEY_ALIAS_STACK_SAFE_RESOURCE_NAME]: { + type: FlagType.BugFix, + summary: 'Generate key aliases that include the stack name', + detailsMd: ` + Enable this feature flag to have CodePipeline generate a unique cross account key alias name using the stack name. + + Previously, when creating multiple pipelines with similar naming conventions and when crossAccountKeys is true, + the KMS key alias name created for these pipelines may be the same due to how the uniqueId is generated. + + This new implementation creates a stack safe resource name for the alias using the stack name instead of the stack ID. + `, + introducedIn: { v2: '2.29.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [S3_CREATE_DEFAULT_LOGGING_POLICY]: { + type: FlagType.BugFix, + summary: 'Enable this feature flag to create an S3 bucket policy by default in cases where an AWS service would automatically create the Policy if one does not exist.', + detailsMd: ` + For example, in order to send VPC flow logs to an S3 bucket, there is a specific Bucket Policy + that needs to be attached to the bucket. If you create the bucket without a policy and then add the + bucket as the flow log destination, the service will automatically create the bucket policy with the + necessary permissions. If you were to then try and add your own bucket policy CloudFormation will throw + and error indicating that a bucket policy already exists. + + In cases where we know what the required policy is we can go ahead and create the policy so we can + remain in control of it. + + @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-infrastructure-S3 + `, + introducedIn: { v2: '2.31.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY]: { + type: FlagType.BugFix, + summary: 'Restrict KMS key policy for encrypted Queues a bit more', + detailsMd: ` + Enable this feature flag to restrict the decryption of a SQS queue, which is subscribed to a SNS topic, to + only the topic which it is subscribed to and not the whole SNS service of an account. + + Previously the decryption was only restricted to the SNS service principal. To make the SQS subscription more + secure, it is a good practice to restrict the decryption further and only allow the connected SNS topic to decryption + the subscribed queue.`, + introducedIn: { v2: '2.32.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [APIGATEWAY_DISABLE_CLOUDWATCH_ROLE]: { + type: FlagType.BugFix, + summary: 'Make default CloudWatch Role behavior safe for multiple API Gateways in one environment', + detailsMd: ` + Enable this feature flag to change the default behavior for aws-apigateway.RestApi and aws-apigateway.SpecRestApi + to _not_ create a CloudWatch role and Account. There is only a single ApiGateway account per AWS + environment which means that each time you create a RestApi in your account the ApiGateway account + is overwritten. If at some point the newest RestApi is deleted, the ApiGateway Account and CloudWatch + role will also be deleted, breaking any existing ApiGateways that were depending on them. + + When this flag is enabled you should either create the ApiGateway account and CloudWatch role + separately _or_ only enable the cloudWatchRole on a single RestApi. + `, + introducedIn: { v2: '2.38.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [ENABLE_PARTITION_LITERALS]: { + type: FlagType.BugFix, + summary: 'Make ARNs concrete if AWS partition is known', + detailsMd: ` + Enable this feature flag to get partition names as string literals in Stacks with known regions defined in + their environment, such as "aws" or "aws-cn". Previously the CloudFormation intrinsic function + "Ref: AWS::Partition" was used. For example: + + \`\`\`yaml + Principal: + AWS: + Fn::Join: + - "" + - - "arn:" + - Ref: AWS::Partition + - :iam::123456789876:root + \`\`\` + + becomes: + + \`\`\`yaml + Principal: + AWS: "arn:aws:iam::123456789876:root" + \`\`\` + + The intrinsic function will still be used in Stacks where no region is defined or the region's partition + is unknown. + `, + introducedIn: { v2: '2.38.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [EVENTS_TARGET_QUEUE_SAME_ACCOUNT]: { + type: FlagType.BugFix, + summary: 'Event Rules may only push to encrypted SQS queues in the same account', + detailsMd: ` + This flag applies to SQS Queues that are used as the target of event Rules. When enabled, only principals + from the same account as the Rule can send messages. If a queue is unencrypted, this restriction will + always apply, regardless of the value of this flag. + `, + introducedIn: { v2: '2.51.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [IAM_STANDARDIZED_SERVICE_PRINCIPALS]: { + type: FlagType.BugFix, + summary: 'Use standardized (global) service principals everywhere', + detailsMd: ` + We used to maintain a database of exceptions to Service Principal names in various regions. This database + is no longer necessary: all service principals names have been standardized to their global form (\`SERVICE.amazonaws.com\`). + + This flag disables use of that exceptions database and always uses the global service principal. + `, + introducedIn: { v2: '2.51.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [ECS_DISABLE_EXPLICIT_DEPLOYMENT_CONTROLLER_FOR_CIRCUIT_BREAKER]: { + type: FlagType.BugFix, + summary: 'Avoid setting the "ECS" deployment controller when adding a circuit breaker', + detailsMd: ` + Enable this feature flag to avoid setting the "ECS" deployment controller when adding a circuit breaker to an + ECS Service, as this will trigger a full replacement which fails to deploy when using set service names. + This does not change any behaviour as the default deployment controller when it is not defined is ECS. + + This is a feature flag as the new behavior provides a better default experience for the users. + `, + introducedIn: { v2: '2.51.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [IAM_IMPORTED_ROLE_STACK_SAFE_DEFAULT_POLICY_NAME]: { + type: FlagType.BugFix, + summary: 'Enable this feature to by default create default policy names for imported roles that depend on the stack the role is in.', + detailsMd: ` + Without this, importing the same role in multiple places could lead to the permissions given for one version of the imported role + to overwrite permissions given to the role at a different place where it was imported. This was due to all imported instances + of a role using the same default policy name. + + This new implementation creates default policy names based on the constructs node path in their stack. + `, + introducedIn: { v2: '2.60.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [S3_SERVER_ACCESS_LOGS_USE_BUCKET_POLICY]: { + type: FlagType.BugFix, + summary: 'Use S3 Bucket Policy instead of ACLs for Server Access Logging', + detailsMd: ` + Enable this feature flag to use S3 Bucket Policy for granting permission fo Server Access Logging + rather than using the canned \`LogDeliveryWrite\` ACL. ACLs do not work when Object Ownership is + enabled on the bucket. + + This flag uses a Bucket Policy statement to allow Server Access Log delivery, following best + practices for S3. + + @see https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html + `, + introducedIn: { v2: '2.59.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [ROUTE53_PATTERNS_USE_CERTIFICATE]: { + type: FlagType.ApiDefault, + summary: 'Use the official `Certificate` resource instead of `DnsValidatedCertificate`', + detailsMd: ` + Enable this feature flag to use the official CloudFormation supported \`Certificate\` resource instead + of the deprecated \`DnsValidatedCertificate\` construct. If this flag is enabled and you are creating + the stack in a region other than us-east-1 then you must also set \`crossRegionReferences=true\` on the + stack. + `, + introducedIn: { v2: 'V2·NEXT' }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Define a `DnsValidatedCertificate` explicitly and pass in the `certificate` property', + }, + + ////////////////////////////////////////////////////////////////////// + [AWS_CUSTOM_RESOURCE_LATEST_SDK_DEFAULT]: { + type: FlagType.ApiDefault, + summary: 'Whether to install the latest SDK by default in AwsCustomResource', + detailsMd: ` + This was originally introduced and enabled by default to not be limited by the SDK version + that's installed on AWS Lambda. However, it creates issues for Lambdas bound to VPCs that + do not have internet access, or in environments where 'npmjs.com' is not available. + + The recommended setting is to disable the default installation behavior, and pass the + flag on a resource-by-resource basis to enable it if necessary. + `, + compatibilityWithOldBehaviorMd: 'Set installLatestAwsSdk: true on all resources that need it.', + introducedIn: { v2: '2.60.0' }, + recommendedValue: false, + }, + + ////////////////////////////////////////////////////////////////////// + [DATABASE_PROXY_UNIQUE_RESOURCE_NAME]: { + type: FlagType.BugFix, + summary: 'Use unique resource name for Database Proxy', + detailsMd: ` + If this flag is not set, the default behavior for \`DatabaseProxy\` is + to use \`id\` of the constructor for \`dbProxyName\` when it's not specified in the argument. + In this case, users can't deploy \`DatabaseProxy\`s that have the same \`id\` in the same region. + + If this flag is set, the default behavior is to use unique resource names for each \`DatabaseProxy\`. + + This is a feature flag as the old behavior was technically incorrect, but users may have come to depend on it. + `, + introducedIn: { v2: '2.65.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [CODEDEPLOY_REMOVE_ALARMS_FROM_DEPLOYMENT_GROUP]: { + type: FlagType.BugFix, + summary: 'Remove CloudWatch alarms from deployment group', + detailsMd: ` + Enable this flag to be able to remove all CloudWatch alarms from a deployment group by removing + the alarms from the construct. If this flag is not set, removing all alarms from the construct + will still leave the alarms configured for the deployment group. + `, + introducedIn: { v2: '2.65.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [APIGATEWAY_AUTHORIZER_CHANGE_DEPLOYMENT_LOGICAL_ID]: { + type: FlagType.BugFix, + summary: 'Include authorizer configuration in the calculation of the API deployment logical ID.', + detailsMd: ` + The logical ID of the AWS::ApiGateway::Deployment resource is calculated by hashing + the API configuration, including methods, and resources, etc. Enable this feature flag + to also include the configuration of any authorizer attached to the API in the + calculation, so any changes made to an authorizer will create a new deployment. + `, + introducedIn: { v2: '2.66.0' }, + recommendedValue: true, + }, + + ////////////////////////////////////////////////////////////////////// + [EC2_LAUNCH_TEMPLATE_DEFAULT_USER_DATA]: { + type: FlagType.BugFix, + summary: 'Define user data for a launch template by default when a machine image is provided.', + detailsMd: ` + The ec2.LaunchTemplate construct did not define user data when a machine image is + provided despite the document. If this is set, a user data is automatically defined + according to the OS of the machine image. + `, + recommendedValue: true, + introducedIn: { v2: '2.67.0' }, + }, + + ////////////////////////////////////////////////////////////////////// + [SECRETS_MANAGER_TARGET_ATTACHMENT_RESOURCE_POLICY]: { + type: FlagType.BugFix, + summary: 'SecretTargetAttachments uses the ResourcePolicy of the attached Secret.', + detailsMd: ` + Enable this feature flag to make SecretTargetAttachments use the ResourcePolicy of the attached Secret. + SecretTargetAttachments are created to connect a Secret to a target resource. + In CDK code, they behave like regular Secret and can be used as a stand-in in most situations. + Previously, adding to the ResourcePolicy of a SecretTargetAttachment did attempt to create a separate ResourcePolicy for the same Secret. + However Secrets can only have a single ResourcePolicy, causing the CloudFormation deployment to fail. + + When enabling this feature flag for an existing Stack, ResourcePolicies created via a SecretTargetAttachment will need replacement. + This won't be possible without intervention due to limitation outlined above. + First remove all permissions granted to the Secret and deploy without the ResourcePolicies. + Then you can re-add the permissions and deploy again. + `, + recommendedValue: true, + introducedIn: { v2: '2.67.0' }, + }, + + ////////////////////////////////////////////////////////////////////// + [REDSHIFT_COLUMN_ID]: { + type: FlagType.BugFix, + summary: 'Whether to use an ID to track Redshift column changes', + detailsMd: ` + Redshift columns are identified by their \`name\`. If a column is renamed, the old column + will be dropped and a new column will be created. This can cause data loss. + + This flag enables the use of an \`id\` attribute for Redshift columns. If this flag is enabled, the + internal CDK architecture will track changes of Redshift columns through their \`id\`, rather + than their \`name\`. This will prevent data loss when columns are renamed. + + **NOTE** - Enabling this flag comes at a **risk**. When enabled, update the \`id\`s of all columns, + **however** do not change the \`names\`s of the columns. If the \`name\`s of the columns are changed during + initial deployment, the columns will be dropped and recreated, causing data loss. After the initial deployment + of the \`id\`s, the \`name\`s of the columns can be changed without data loss. + `, + introducedIn: { v2: '2.68.0' }, + recommendedValue: true, + }, + + [ENABLE_EMR_SERVICE_POLICY_V2]: { + type: FlagType.BugFix, + summary: 'Enable AmazonEMRServicePolicy_v2 managed policies', + detailsMd: ` + If this flag is not set, the default behavior for \`EmrCreateCluster\` is + to use \`AmazonElasticMapReduceRole\` managed policies. + + If this flag is set, the default behavior is to use the new \`AmazonEMRServicePolicy_v2\` + managed policies. + + This is a feature flag as the old behavior will be deprecated, but some resources may require manual + intervention since they might not have the appropriate tags propagated automatically. + `, + introducedIn: { v2: '2.72.0' }, + recommendedValue: true, + }, +}; + +const CURRENT_MV = 'v2'; + +/** + * The list of future flags that are now expired. This is going to be used to identify + * and block usages of old feature flags in the new major version of CDK. + */ +export const CURRENT_VERSION_EXPIRED_FLAGS: string[] = Object.entries(FLAGS) + .filter(([_, flag]) => flag.introducedIn[CURRENT_MV] === undefined) + .map(([name, _]) => name).sort(); + +/** + * Flag values that should apply for new projects + * + * Add a flag in here (typically with the value `true`), to enable + * backwards-breaking behavior changes only for new projects. New projects + * generated through `cdk init` will include these flags in their generated + * + * Tests must cover the default (disabled) case and the future (enabled) case. + */ +export const NEW_PROJECT_CONTEXT = Object.fromEntries( + Object.entries(FLAGS) + .filter(([_, flag]) => flag.recommendedValue !== flag.defaults?.[CURRENT_MV] && flag.introducedIn[CURRENT_MV]) + .map(([name, flag]) => [name, flag.recommendedValue]), +); + +/** + * The default values of each of these flags in the current major version. + * + * This is the effective value of the flag, unless it's overriden via + * context. + * + * Adding new flags here is only allowed during the pre-release period of a new + * major version! + */ +export const CURRENT_VERSION_FLAG_DEFAULTS = Object.fromEntries(Object.entries(FLAGS) + .filter(([_, flag]) => flag.defaults?.[CURRENT_MV] !== undefined) + .map(([name, flag]) => [name, flag.defaults?.[CURRENT_MV]])); + +export function futureFlagDefault(flag: string): boolean { + const value = CURRENT_VERSION_FLAG_DEFAULTS[flag] ?? false; + if (typeof value !== 'boolean') { + throw new Error(`futureFlagDefault: default type of flag '${flag}' should be boolean, got '${typeof value}'`); + } + return value; +} + +// Nobody should have been using any of this, but you never know + +/** @deprecated use CURRENT_VERSION_EXPIRED_FLAGS instead */ +export const FUTURE_FLAGS_EXPIRED = CURRENT_VERSION_EXPIRED_FLAGS; + +/** @deprecated use NEW_PROJECT_CONTEXT instead */ +export const FUTURE_FLAGS = Object.fromEntries(Object.entries(NEW_PROJECT_CONTEXT) + .filter(([_, v]) => typeof v === 'boolean')); + +/** @deprecated use NEW_PROJECT_CONTEXT instead */ +export const NEW_PROJECT_DEFAULT_CONTEXT = Object.fromEntries(Object.entries(NEW_PROJECT_CONTEXT) + .filter(([_, v]) => typeof v !== 'boolean')); diff --git a/packages/aws-cdk-lib/cx-api/lib/index.ts b/packages/aws-cdk-lib/cx-api/lib/index.ts new file mode 100644 index 0000000000000..f5db330871753 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/index.ts @@ -0,0 +1,22 @@ +export * from './cxapi'; +export * from './context/vpc'; +export * from './context/ami'; +export * from './context/load-balancer'; +export * from './context/availability-zones'; +export * from './context/endpoint-service-availability-zones'; +export * from './context/security-group'; +export * from './context/key'; +export * from './cloud-artifact'; +import './cloud-artifact-aug'; +export * from './artifacts/asset-manifest-artifact'; +export * from './artifacts/cloudformation-artifact'; +export * from './artifacts/tree-cloud-artifact'; +export * from './artifacts/nested-cloud-assembly-artifact'; +import './artifacts/nested-cloud-assembly-artifact-aug'; +export * from './cloud-assembly'; +export * from './assets'; +export * from './environment'; +export * from './metadata'; +export * from './features'; +export * from './placeholders'; +export * from './app'; diff --git a/packages/aws-cdk-lib/cx-api/lib/metadata.ts b/packages/aws-cdk-lib/cx-api/lib/metadata.ts new file mode 100644 index 0000000000000..c30759f001b15 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/metadata.ts @@ -0,0 +1,30 @@ +import * as cxschema from '../../cloud-assembly-schema'; + +/** + * The key used when CDK path is embedded in **CloudFormation template** metadata (not cdk metadata). + */ +export const PATH_METADATA_KEY = 'aws:cdk:path'; + +export enum SynthesisMessageLevel { + INFO = 'info', + WARNING = 'warning', + ERROR = 'error' +} + +export interface MetadataEntryResult extends cxschema.MetadataEntry { + /** + * The path in which this entry was defined. + */ + readonly path: string; +} + +/** + * Metadata associated with the objects in the stack's Construct tree + */ +export type StackMetadata = { [path: string]: cxschema.MetadataEntry[] }; + +export interface SynthesisMessage { + readonly level: SynthesisMessageLevel; + readonly id: string; + readonly entry: cxschema.MetadataEntry; +} diff --git a/packages/aws-cdk-lib/cx-api/lib/placeholders.ts b/packages/aws-cdk-lib/cx-api/lib/placeholders.ts new file mode 100644 index 0000000000000..89d34736b6c83 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/placeholders.ts @@ -0,0 +1,123 @@ +/** + * Placeholders which can be used manifests + * + * These can occur both in the Asset Manifest as well as the general + * Cloud Assembly manifest. + */ +export class EnvironmentPlaceholders { + /** + * Insert this into the destination fields to be replaced with the current region + */ + public static readonly CURRENT_REGION = '${AWS::Region}'; + + /** + * Insert this into the destination fields to be replaced with the current account + */ + public static readonly CURRENT_ACCOUNT = '${AWS::AccountId}'; + + /** + * Insert this into the destination fields to be replaced with the current partition + */ + public static readonly CURRENT_PARTITION = '${AWS::Partition}'; + + /** + * Replace the environment placeholders in all strings found in a complex object. + * + * Duplicated between cdk-assets and aws-cdk CLI because we don't have a good single place to put it + * (they're nominally independent tools). + */ + public static replace(object: any, values: EnvironmentPlaceholderValues): any { + return this.recurse(object, value => { + value = replaceAll(value, EnvironmentPlaceholders.CURRENT_REGION, values.region); + value = replaceAll(value, EnvironmentPlaceholders.CURRENT_ACCOUNT, values.accountId); + value = replaceAll(value, EnvironmentPlaceholders.CURRENT_PARTITION, values.partition); + return value; + }); + } + + /** + * Like 'replace', but asynchronous + */ + public static async replaceAsync(object: any, provider: IEnvironmentPlaceholderProvider): Promise { + let needRegion = false; + let needAccountId = false; + let needPartition = false; + + this.recurse(object, value => { + if (value.indexOf(EnvironmentPlaceholders.CURRENT_REGION) > 1) { needRegion = true; } + if (value.indexOf(EnvironmentPlaceholders.CURRENT_ACCOUNT) > 1) { needAccountId = true; } + if (value.indexOf(EnvironmentPlaceholders.CURRENT_PARTITION) > 1) { needPartition = true; } + return value; + }); + + const region = needRegion ? await provider.region() : undefined; + const accountId = needAccountId ? await provider.accountId() : undefined; + const partition = needPartition ? await provider.partition() : undefined; + + return this.recurse(object, value => { + value = replaceAll(value, EnvironmentPlaceholders.CURRENT_REGION, region ?? 'WONTHAPPEN'); + value = replaceAll(value, EnvironmentPlaceholders.CURRENT_ACCOUNT, accountId ?? 'WONTHAPPEN'); + value = replaceAll(value, EnvironmentPlaceholders.CURRENT_PARTITION, partition ?? 'WONTHAPPEN'); + return value; + }); + } + + private static recurse(value: any, cb: (x: string) => string): any { + if (typeof value === 'string') { return cb(value); } + if (typeof value !== 'object' || value === null) { return value; } + if (Array.isArray(value)) { return value.map(x => this.recurse(x, cb)); } + + const ret: Record = {}; + for (const [key, inner] of Object.entries(value)) { + ret[key] = this.recurse(inner, cb); + } + return ret; + } +} + +/** + * Return the appropriate values for the environment placeholders + */ +export interface EnvironmentPlaceholderValues { + /** + * Return the region + */ + readonly region: string; + + /** + * Return the account + */ + readonly accountId: string; + + /** + * Return the partition + */ + readonly partition: string; +} + +/** + * Return the appropriate values for the environment placeholders + */ +export interface IEnvironmentPlaceholderProvider { + /** + * Return the region + */ + region(): Promise; + + /** + * Return the account + */ + accountId(): Promise; + + /** + * Return the partition + */ + partition(): Promise; +} + +/** + * A "replace-all" function that doesn't require us escaping a literal string to a regex + */ +function replaceAll(s: string, search: string, replace: string) { + return s.split(search).join(replace); +} diff --git a/packages/aws-cdk-lib/cx-api/lib/private/flag-modeling.ts b/packages/aws-cdk-lib/cx-api/lib/private/flag-modeling.ts new file mode 100644 index 0000000000000..0f4d34200ee8b --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/private/flag-modeling.ts @@ -0,0 +1,78 @@ +export enum FlagType { + /** + * Change the default behavior of the API + * + * The old behavior is not disrecommended, and possible to achieve with source + * code changes. Also valid for changes that don't affect CloudFormation, but + * the CXAPI contract. + */ + ApiDefault, + + /** + * Address a bug/introduce a recommended change + * + * The old behavior is no longer recommended. The only way to achieve it is by + * keeping the flag at the legacy value. + */ + BugFix, + + /** + * Advertise the presence of this context option in `cdk.json` + */ + VisibleContext, +}; + +export interface FlagInfoBase { + /** Single-line description for the flag */ + readonly summary: string; + /** Detailed description for the flag (Markdown) */ + readonly detailsMd: string; + /** Version number the flag was introduced in each version line. `undefined` means flag does not exist in that line. */ + readonly introducedIn: { v1?: string; v2?: string }; + /** Default value, if flag is unset by user. Adding a flag with a default may not change behavior after GA! */ + readonly defaults?: { v2?: any }; + /** Default in new projects */ + readonly recommendedValue: any; +}; + +/** Flag information, adding required fields if present */ +export type FlagInfo = FlagInfoBase & ( + | { readonly type: FlagType.ApiDefault; + + /** Describe restoring old behavior or dealing with the change (Markdown) */ + readonly compatibilityWithOldBehaviorMd: string } + | { readonly type: FlagType.BugFix; + /** Describe restoring old behavior or dealing with the change (Markdown) */ + readonly compatibilityWithOldBehaviorMd?: string } + | { readonly type: FlagType.VisibleContext } +); + +/** + * The magic value that will be substituted at version bump time with the actual + * new V2 version. + * + * Do not import this constant in the `features.ts` file, or the substitution + * process won't work. + */ +export const MAGIC_V2NEXT = 'V2NEXT'; + +/** + * Compare two versions, returning -1, 0, or 1. + */ +export function compareVersions(a: string | undefined, b: string | undefined): number { + if (a === b) { return 0; } + if (a === undefined) { return -1; } + if (b === undefined) { return 1; } + + const as = a.split('.').map(x => parseInt(x, 10)); + const bs = b.split('.').map(x => parseInt(x, 10)); + + if (a === MAGIC_V2NEXT) { return bs[0] <= 2 ? 1 : -1; } + if (b === MAGIC_V2NEXT) { return as[0] <= 2 ? -1 : 1; } + + for (let i = 0; i < Math.min(as.length, bs.length); i++) { + if (as[i] < bs[i]) { return -1; } + if (as[i] > bs[i]) { return 1; } + } + return as.length - bs.length; +} diff --git a/packages/aws-cdk-lib/cx-api/lib/toposort.ts b/packages/aws-cdk-lib/cx-api/lib/toposort.ts new file mode 100644 index 0000000000000..97dd35ea8bb46 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/lib/toposort.ts @@ -0,0 +1,44 @@ +export type KeyFunc = (x: T) => string; +export type DepFunc = (x: T) => string[]; + +/** + * Return a topological sort of all elements of xs, according to the given dependency functions + * + * Dependencies outside the referenced set are ignored. + * + * Not a stable sort, but in order to keep the order as stable as possible, we'll sort by key + * among elements of equal precedence. + */ +export function topologicalSort(xs: Iterable, keyFn: KeyFunc, depFn: DepFunc): T[] { + const remaining = new Map>(); + for (const element of xs) { + const key = keyFn(element); + remaining.set(key, { key, element, dependencies: depFn(element) }); + } + + const ret = new Array(); + while (remaining.size > 0) { + // All elements with no more deps in the set can be ordered + const selectable = Array.from(remaining.values()).filter(e => e.dependencies.every(d => !remaining.has(d))); + + selectable.sort((a, b) => a.key < b.key ? -1 : b.key < a.key ? 1 : 0); + + for (const selected of selectable) { + ret.push(selected.element); + remaining.delete(selected.key); + } + + // If we didn't make any progress, we got stuck + if (selectable.length === 0) { + throw new Error(`Could not determine ordering between: ${Array.from(remaining.keys()).join(', ')}`); + } + } + + return ret; +} + +interface TopoElement { + key: string; + dependencies: string[]; + element: T; +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/__snapshots__/cloud-assembly.test.js.snap b/packages/aws-cdk-lib/cx-api/test/__snapshots__/cloud-assembly.test.js.snap new file mode 100644 index 0000000000000..6aa2a5490d445 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/__snapshots__/cloud-assembly.test.js.snap @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`assembly with a single cloudformation stack and tree metadata 1`] = ` +Object { + "environment": "aws://37736633/us-region-1", + "properties": Object { + "templateFile": "template.json", + }, + "type": "aws:cloudformation:stack", +} +`; + +exports[`assembly with a single cloudformation stack and tree metadata 2`] = ` +Object { + "properties": Object { + "file": "foo.tree.json", + }, + "type": "cdk:tree", +} +`; + +exports[`assembly with missing context 1`] = ` +Array [ + Object { + "key": "missing:context:key", + "props": Object { + "account": "1234", + "filter": Object { + "foo": 123, + }, + "region": "us-east-1", + }, + "provider": "vpc-provider", + }, +] +`; + +exports[`assets 1`] = ` +Array [ + Object { + "artifactHashParameter": "hashParameter", + "id": "logical-id-of-the-asset", + "packaging": "zip", + "path": "asset-dir", + "s3BucketParameter": "bucketParameter", + "s3KeyParameter": "keyParameter", + "sourceHash": "xoxoxox", + }, + Object { + "id": "logical-id-of-the-asset-x1234", + "packaging": "container-image", + "path": "docker-asset", + "sourceHash": "docker-asset-source", + }, +] +`; + +exports[`empty assembly 1`] = ` +Object { + "version": "0.0.0", +} +`; + +exports[`messages 1`] = ` +Array [ + Object { + "entry": Object { + "data": "boom", + "trace": Array [ + "bam", + ], + "type": "aws:cdk:warning", + }, + "id": "foo", + "level": "warning", + }, + Object { + "entry": Object { + "data": "error!!", + "trace": Array [ + "bam!Error", + ], + "type": "aws:cdk:error", + }, + "id": "foo", + "level": "error", + }, + Object { + "entry": Object { + "data": "info?", + "trace": Array [ + "bam!Error", + ], + "type": "aws:cdk:info", + }, + "id": "bar", + "level": "info", + }, +] +`; diff --git a/packages/aws-cdk-lib/cx-api/test/cloud-assembly-builder.test.ts b/packages/aws-cdk-lib/cx-api/test/cloud-assembly-builder.test.ts new file mode 100644 index 0000000000000..46f71ac6ebdca --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/cloud-assembly-builder.test.ts @@ -0,0 +1,255 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import * as cxschema from '../../cloud-assembly-schema'; +import * as cxapi from '../lib'; + +test('cloud assembly builder', () => { + // GIVEN + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cloud-assembly-builder-tests')); + const session = new cxapi.CloudAssemblyBuilder(outdir); + const templateFile = 'foo.template.json'; + + // WHEN + session.addArtifact('my-first-artifact', { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + dependencies: ['minimal-artifact'], + metadata: { + foo: [{ data: '123', type: 'foo', trace: [] }], + }, + properties: { + templateFile, + parameters: { + prop1: '1234', + prop2: '555', + }, + }, + }); + + session.addArtifact('tree-artifact', { + type: cxschema.ArtifactType.CDK_TREE, + properties: { + file: 'foo.tree.json', + }, + }); + + session.addMissing({ + key: 'foo', + provider: cxschema.ContextProvider.VPC_PROVIDER, + props: { + account: '1234', + region: 'us-east-1', + filter: { + a: 'a', + }, + }, + }); + + session.addArtifact('minimal-artifact', { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://111/helo-world', + properties: { + templateFile, + }, + }); + + fs.writeFileSync(path.join(session.outdir, templateFile), JSON.stringify({ + Resources: { + MyTopic: { + Type: 'AWS::S3::Topic', + }, + }, + })); + + const assembly = session.buildAssembly(); + const manifest = assembly.manifest; + + // THEN + // verify the manifest looks right + expect(manifest).toStrictEqual({ + version: cxschema.Manifest.version(), + missing: [ + { + key: 'foo', + provider: cxschema.ContextProvider.VPC_PROVIDER, + props: { + account: '1234', + region: 'us-east-1', + filter: { + a: 'a', + }, + }, + }, + ], + artifacts: { + 'tree-artifact': { + type: cxschema.ArtifactType.CDK_TREE, + properties: { + file: 'foo.tree.json', + }, + }, + 'my-first-artifact': { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + dependencies: ['minimal-artifact'], + metadata: { foo: [{ data: '123', type: 'foo', trace: [] }] }, + properties: { + templateFile: 'foo.template.json', + parameters: { + prop1: '1234', + prop2: '555', + }, + }, + }, + 'minimal-artifact': { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://111/helo-world', + properties: { templateFile: 'foo.template.json' }, + }, + }, + }); + + // verify we have a template file + expect(assembly.getStackByName('minimal-artifact').template).toStrictEqual({ + Resources: { + MyTopic: { + Type: 'AWS::S3::Topic', + }, + }, + }); +}); + +test('outdir must be a directory', () => { + expect(() => new cxapi.CloudAssemblyBuilder(__filename)).toThrow('must be a directory'); +}); + +test('outdir defaults to a temporary directory', () => { + const assembly = new cxapi.CloudAssemblyBuilder(); + const realTmpDir = fs.realpathSync(os.tmpdir()); + expect(assembly.outdir).toMatch(new RegExp(`^${path.join(realTmpDir, 'cdk.out')}`)); +}); + +test('duplicate missing values with the same key are only reported once', () => { + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cloud-assembly-builder-tests')); + const session = new cxapi.CloudAssemblyBuilder(outdir); + + const props: cxschema.ContextQueryProperties = { + account: '1234', + region: 'asdf', + filter: { a: 'a' }, + }; + + session.addMissing({ key: 'foo', provider: cxschema.ContextProvider.VPC_PROVIDER, props }); + session.addMissing({ key: 'foo', provider: cxschema.ContextProvider.VPC_PROVIDER, props }); + + const assembly = session.buildAssembly(); + + expect(assembly.manifest.missing!.length).toEqual(1); +}); + +test('write and read nested cloud assembly artifact', () => { + // GIVEN + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cloud-assembly-builder-tests')); + const session = new cxapi.CloudAssemblyBuilder(outdir); + + const innerAsmDir = path.join(outdir, 'hello'); + new cxapi.CloudAssemblyBuilder(innerAsmDir).buildAssembly(); + + // WHEN + session.addArtifact('Assembly', { + type: cxschema.ArtifactType.NESTED_CLOUD_ASSEMBLY, + properties: { + directoryName: 'hello', + } as cxschema.NestedCloudAssemblyProperties, + }); + const asm = session.buildAssembly(); + + // THEN + const art = asm.tryGetArtifact('Assembly') as cxapi.NestedCloudAssemblyArtifact | undefined; + expect(art).toBeInstanceOf(cxapi.NestedCloudAssemblyArtifact); + expect(art?.fullPath).toEqual(path.join(outdir, 'hello')); + + const nested = art?.nestedAssembly; + expect(nested?.artifacts.length).toEqual(0); +}); + +test('missing values are reported to top-level asm', () => { + // GIVEN + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cloud-assembly-builder-tests')); + const session = new cxapi.CloudAssemblyBuilder(outdir); + + const innerAsm = session.createNestedAssembly('hello', 'hello'); + + // WHEN + const props: cxschema.ContextQueryProperties = { + account: '1234', + region: 'asdf', + filter: { a: 'a' }, + }; + + innerAsm.addMissing({ key: 'foo', provider: cxschema.ContextProvider.VPC_PROVIDER, props }); + + // THEN + const assembly = session.buildAssembly(); + + expect(assembly.manifest.missing?.length).toEqual(1); +}); + +test('artifcats are written in topological order', () => { + // GIVEN + const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'cloud-assembly-builder-tests')); + const session = new cxapi.CloudAssemblyBuilder(outdir); + const templateFile = 'foo.template.json'; + + const innerAsmDir = path.join(outdir, 'hello'); + new cxapi.CloudAssemblyBuilder(innerAsmDir).buildAssembly(); + + // WHEN + + // Create the following dependency order: + // A -> + // C -> D + // B -> + session.addArtifact('artifact-D', { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + dependencies: ['artifact-C'], + properties: { + templateFile, + }, + }); + + session.addArtifact('artifact-C', { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + dependencies: ['artifact-B', 'artifact-A'], + properties: { + templateFile, + }, + }); + + session.addArtifact('artifact-B', { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + properties: { + templateFile, + }, + }); + + session.addArtifact('artifact-A', { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + properties: { + templateFile, + }, + }); + + const asm = session.buildAssembly(); + const artifactsIds = asm.artifacts.map(a => a.id); + + // THEN + expect(artifactsIds.indexOf('artifact-A')).toBeLessThan(artifactsIds.indexOf('artifact-C')); + expect(artifactsIds.indexOf('artifact-B')).toBeLessThan(artifactsIds.indexOf('artifact-C')); + expect(artifactsIds.indexOf('artifact-C')).toBeLessThan(artifactsIds.indexOf('artifact-D')); +}); diff --git a/packages/aws-cdk-lib/cx-api/test/cloud-assembly.test.ts b/packages/aws-cdk-lib/cx-api/test/cloud-assembly.test.ts new file mode 100644 index 0000000000000..804d1e43e16b6 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/cloud-assembly.test.ts @@ -0,0 +1,180 @@ +import * as path from 'path'; +import { testDeprecated } from '@aws-cdk/cdk-build-tools'; +import { CloudAssembly } from '../lib'; + +const FIXTURES = path.join(__dirname, 'fixtures'); + +test('empty assembly', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'empty')); + expect(assembly.artifacts).toEqual([]); + expect(assembly.runtime).toEqual({ libraries: { } }); + expect(assembly.stacks).toEqual([]); + expect(assembly.version).toEqual('0.0.0'); + expect(assembly.manifest).toMatchSnapshot(); + expect(assembly.tree()).toBeUndefined(); +}); + +test('assembly with a single cloudformation stack and tree metadata', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'single-stack')); + expect(assembly.artifacts).toHaveLength(2); + expect(assembly.stacks).toHaveLength(1); + expect(assembly.manifest.missing).toBeUndefined(); + expect(assembly.runtime).toEqual({ libraries: { } }); + + const stack = assembly.stacks[0]; + expect(stack.manifest).toMatchSnapshot(); + expect(stack.assets).toHaveLength(0); + expect(stack.dependencies).toEqual([]); + expect(stack.environment).toEqual({ account: '37736633', region: 'us-region-1', name: 'aws://37736633/us-region-1' }); + expect(stack.template).toEqual({ Resources: { MyBucket: { Type: 'AWS::S3::Bucket' } } }); + expect(stack.messages).toEqual([]); + expect(stack.manifest.metadata).toEqual(undefined); + expect(stack.originalName).toEqual('MyStackName'); + expect(stack.stackName).toEqual('MyStackName'); + expect(stack.id).toEqual('MyStackName'); + + const treeArtifact = assembly.tree(); + expect(treeArtifact).toBeDefined(); + expect(treeArtifact!.file).toEqual('foo.tree.json'); + expect(treeArtifact!.manifest).toMatchSnapshot(); +}); + +test('assembly with invalid tree metadata', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'invalid-manifest-type-tree')); + expect(() => assembly.tree()).toThrow(/Multiple artifacts/); +}); + +test('assembly with tree metadata having no file property specified', () => { + expect(() => new CloudAssembly(path.join(FIXTURES, 'tree-no-file-property'))).toThrow(/Invalid assembly manifest/); +}); + +test('assembly with cloudformation artifact having no environment property specified', () => { + expect(() => new CloudAssembly(path.join(FIXTURES, 'invalid-manifest-type-cloudformation'))).toThrow(/Invalid CloudFormation stack artifact/); +}); + +test('assembly with missing context', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'missing-context')); + expect(assembly.manifest.missing).toMatchSnapshot(); +}); + +test('assembly with multiple stacks', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'multiple-stacks')); + expect(assembly.stacks).toHaveLength(2); + expect(assembly.artifacts).toHaveLength(2); +}); + +test('fails for invalid environment format', () => { + expect(() => new CloudAssembly(path.join(FIXTURES, 'invalid-env-format'))) + .toThrow('Unable to parse environment specification'); +}); + +test('fails if stack artifact does not have properties', () => { + expect(() => new CloudAssembly(path.join(FIXTURES, 'stack-without-params'))) + .toThrow('Invalid CloudFormation stack artifact. Missing \"templateFile\" property in cloud assembly manifest'); +}); + +test('messages', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'messages')); + expect(assembly.stacks[0].messages).toMatchSnapshot(); +}); + +test('assets', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'assets')); + expect(assembly.stacks[0].assets).toMatchSnapshot(); +}); + +test('can-read-0.36.0', () => { + // WHEN + new CloudAssembly(path.join(FIXTURES, 'single-stack-0.36')); + // THEN: no exception + expect(true).toBeTruthy(); +}); + +test('dependencies', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'depends')); + expect(assembly.stacks).toHaveLength(4); + + // expect stacks to be listed in topological order + expect(assembly.stacks.map(s => s.id)).toEqual(['StackA', 'StackD', 'StackC', 'StackB']); + expect(assembly.stacks[0].dependencies).toEqual([]); + expect(assembly.stacks[1].dependencies).toEqual([]); + expect(assembly.stacks[2].dependencies.map(x => x.id)).toEqual(['StackD']); + expect(assembly.stacks[3].dependencies.map(x => x.id)).toEqual(['StackC', 'StackD']); +}); + +test('fails for invalid dependencies', () => { + expect(() => new CloudAssembly(path.join(FIXTURES, 'invalid-depends'))).toThrow('Artifact StackC depends on non-existing artifact StackX'); +}); + +testDeprecated('stack artifacts can specify an explicit stack name that is different from the artifact id', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'explicit-stack-name')); + + expect(assembly.getStackByName('TheStackName').stackName).toStrictEqual('TheStackName'); + expect(assembly.getStackByName('TheStackName').id).toStrictEqual('stackid1'); + + // deprecated but still test + expect(assembly.getStack('TheStackName').stackName).toStrictEqual('TheStackName'); + expect(assembly.getStack('TheStackName').id).toStrictEqual('stackid1'); +}); + +test('getStackByName fails if there are multiple stacks with the same name', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'multiple-stacks-same-name')); + // eslint-disable-next-line max-len + expect(() => assembly.getStackByName('the-physical-name-of-the-stack')).toThrow(/There are multiple stacks with the stack name \"the-physical-name-of-the-stack\" \(stack1\,stack2\)\. Use \"getStackArtifact\(id\)\" instead/); +}); + +test('getStackArtifact retrieves a stack by artifact id', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'multiple-stacks-same-name')); + + expect(assembly.getStackArtifact('stack1').stackName).toEqual('the-physical-name-of-the-stack'); + expect(assembly.getStackArtifact('stack2').stackName).toEqual('the-physical-name-of-the-stack'); + expect(assembly.getStackArtifact('stack2').id).toEqual('stack2'); + expect(assembly.getStackArtifact('stack1').id).toEqual('stack1'); +}); + +test('displayName shows hierarchical ID for nested stack without explicit stackName', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'nested-stacks')); + const stackArtifact = assembly.getStackArtifact('topLevelStackNestedStackDAC87084'); + expect(stackArtifact.hierarchicalId).toStrictEqual('topLevelStack/nestedStack'); + expect(stackArtifact.displayName).toStrictEqual('topLevelStack/nestedStack'); +}); + +test('displayName shows hierarchical ID and stackName for nested stack with explicit stackName', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'nested-stacks')); + const nestedStack = assembly.getStackArtifact('topLevelStackNestedStackWithStackName6D28EAEF'); + expect(nestedStack.hierarchicalId).toStrictEqual('topLevelStack/nestedStackWithStackName'); + expect(nestedStack.stackName).toStrictEqual('explicitStackName'); + expect(nestedStack.displayName).toStrictEqual('topLevelStack/nestedStackWithStackName (explicitStackName)'); +}); + +test('displayName shows both hierarchical ID and stack name if needed', () => { + const a1 = new CloudAssembly(path.join(FIXTURES, 'multiple-stacks-same-name')); + expect(a1.getStackArtifact('stack1').displayName).toStrictEqual('stack1 (the-physical-name-of-the-stack)'); + expect(a1.getStackArtifact('stack2').displayName).toStrictEqual('stack2 (the-physical-name-of-the-stack)'); + + const a2 = new CloudAssembly(path.join(FIXTURES, 'single-stack')); + const art1 = a2.getStackArtifact('MyStackName'); + const art2 = a2.getStackByName('MyStackName'); + + expect(art1).toBe(art2); + expect(art1.displayName).toBe('MyStackName'); + expect(art1.id).toBe('MyStackName'); + expect(art1.stackName).toBe('MyStackName'); +}); + +test('can read assembly with asset manifest', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'asset-manifest')); + expect(assembly.stacks).toHaveLength(1); + expect(assembly.artifacts).toHaveLength(2); +}); + +test('getStackArtifact retrieves a stack by artifact id from a nested assembly', () => { + const assembly = new CloudAssembly(path.join(FIXTURES, 'nested-assemblies')); + + expect(assembly.getStackArtifact('topLevelStack').stackName).toEqual('topLevelStack'); + expect(assembly.getStackArtifact('stack1').stackName).toEqual('first-stack'); + expect(assembly.getStackArtifact('stack2').stackName).toEqual('second-stack'); + expect(assembly.getStackArtifact('topLevelStack').id).toEqual('topLevelStack'); + expect(assembly.getStackArtifact('stack1').id).toEqual('stack1'); + expect(assembly.getStackArtifact('stack2').id).toEqual('stack2'); +}); diff --git a/packages/aws-cdk-lib/cx-api/test/environment.test.ts b/packages/aws-cdk-lib/cx-api/test/environment.test.ts new file mode 100644 index 0000000000000..898ae7ca30946 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/environment.test.ts @@ -0,0 +1,27 @@ +import { EnvironmentUtils } from '../lib'; + +test('format', () => { + expect(EnvironmentUtils.format('my-account', 'my-region')).toBe('aws://my-account/my-region'); +}); + +test('parse', () => { + expect(EnvironmentUtils.parse('aws://123456789/us-east-1')).toStrictEqual({ + name: 'aws://123456789/us-east-1', + account: '123456789', + region: 'us-east-1', + }); + + // parser is not super strict to allow users to do some magical things if they want + expect(EnvironmentUtils.parse('aws://boom@voom.com/ok-x-x-123')).toStrictEqual({ + name: 'aws://boom@voom.com/ok-x-x-123', + account: 'boom@voom.com', + region: 'ok-x-x-123', + }); +}); + +test('parse failures', () => { + expect(() => EnvironmentUtils.parse('boom')).toThrow('Unable to parse environment specification'); + expect(() => EnvironmentUtils.parse('boom://boom/boom')).toThrow('Unable to parse environment specification'); + expect(() => EnvironmentUtils.parse('boom://xx//xz/x/boom')).toThrow('Unable to parse environment specification'); + expect(() => EnvironmentUtils.parse('aws:://998988383/fu-x-x')).toThrow('Unable to parse environment specification'); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/features.test.ts b/packages/aws-cdk-lib/cx-api/test/features.test.ts new file mode 100644 index 0000000000000..1aa592b15114c --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/features.test.ts @@ -0,0 +1,91 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as feats from '../lib/features'; +import { MAGIC_V2NEXT, compareVersions } from '../lib/private/flag-modeling'; + +test('all future flags have defaults configured', () => { + Object.keys(feats.FLAGS).forEach(flag => { + expect(typeof(feats.futureFlagDefault(flag))).toEqual('boolean'); + }); +}); + +test('futureFlagDefault returns false if non existent flag was given', () => { + expect(feats.futureFlagDefault('non-existent-flag')).toEqual(false); +}); + +test('feature flag defaults may not be changed anymore', () => { + // In principle, these flags were decided upon during the v2 alpha period, and they are now frozen + // and may not be changed anymore. + // + // One exception is allowed: to avoid a double negative in your flag name (`disableOldBehavior: true`). + // + // In that case, it is permitted to name the flag `oldBehavior`, add a new default set to `true`, + // and have the recommended value be `false`. + expect(feats.CURRENT_VERSION_FLAG_DEFAULTS).toEqual({ + // V1->V2 defaults below here + [feats.APIGATEWAY_USAGEPLANKEY_ORDERINSENSITIVE_ID]: true, + [feats.ENABLE_STACK_NAME_DUPLICATES_CONTEXT]: true, + [feats.ENABLE_DIFF_NO_FAIL_CONTEXT]: true, + [feats.STACK_RELATIVE_EXPORTS_CONTEXT]: true, + [feats.NEW_STYLE_STACK_SYNTHESIS_CONTEXT]: true, + [feats.DOCKER_IGNORE_SUPPORT]: true, + [feats.SECRETS_MANAGER_PARSE_OWNED_SECRET_NAME]: true, + [feats.KMS_DEFAULT_KEY_POLICIES]: true, + [feats.S3_GRANT_WRITE_WITHOUT_ACL]: true, + [feats.ECS_REMOVE_DEFAULT_DESIRED_COUNT]: true, + [feats.RDS_LOWERCASE_DB_IDENTIFIER]: true, + [feats.EFS_DEFAULT_ENCRYPTION_AT_REST]: true, + [feats.LAMBDA_RECOGNIZE_VERSION_PROPS]: true, + [feats.CLOUDFRONT_DEFAULT_SECURITY_POLICY_TLS_V1_2_2021]: true, + // Add new disabling feature flags below this line + // ... + + }); +}); + +test('expired feature flags may not be changed anymore', () => { + expect(feats.CURRENT_VERSION_EXPIRED_FLAGS).toEqual([ + feats.DOCKER_IGNORE_SUPPORT, + feats.ECS_REMOVE_DEFAULT_DESIRED_COUNT, + feats.EFS_DEFAULT_ENCRYPTION_AT_REST, + feats.ENABLE_DIFF_NO_FAIL_CONTEXT, + feats.ENABLE_STACK_NAME_DUPLICATES_CONTEXT, + feats.KMS_DEFAULT_KEY_POLICIES, + feats.S3_GRANT_WRITE_WITHOUT_ACL, + feats.SECRETS_MANAGER_PARSE_OWNED_SECRET_NAME, + ].sort()); +}); + +test.each([ + ['1.2.3', '1.2.3', 0], + ['1.2.3', '1.2.4', -1], + ['1.2.3', '2.0.0', -1], + ['100.2.3', '2.0.0', 1], + ['V2NEXT', 'V2NEXT', 0], + ['1.0.0', 'V2NEXT', -1], + ['2.100.0', 'V2NEXT', -1], + ['3.100.0', 'V2NEXT', 1], +])('compareVersions(%p, %p) -> %p (and the reverse)', (a, b, expected) => { + expect(compareVersions(a, b)).toEqual(expected); + expect(compareVersions(b, a)).toBeCloseTo(-expected, 10); // Gets around expect(-0).toEqual(0) failing... :x +}); + +const currentv2: string = JSON.parse(fs.readFileSync(path.join(__dirname, '../../../../version.v2.json'), { encoding: 'utf-8' })).version; + +describe(`introducedIn.v2 is either <= ${currentv2} or magic value "${MAGIC_V2NEXT}"`, () => { + test.each(Object.keys(feats.FLAGS))('for flag %p', flag => { + const v2In = feats.FLAGS[flag].introducedIn.v2; + if (v2In === undefined || v2In === MAGIC_V2NEXT) { + return; + } + + // If defined and not magic, it must be in the past w.r.t. the current v2 version + expect(compareVersions(v2In, currentv2)).not.toEqual(1); + }); +}); + +test('features.ts should not contain a reference to the constant with the magic value', () => { + // If it did, the above test would succeed but we would not be able to substitute the string at bump time + const featuresSourceFile = path.join(__dirname, '..', 'lib', 'features.ts'); + expect(fs.readFileSync(featuresSourceFile, { encoding: 'utf-8' })).not.toContain('MAGIC_V2NEXT'); +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/asset-dir/foo.txt b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/asset-dir/foo.txt new file mode 100644 index 0000000000000..5783cb7e31483 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/asset-dir/foo.txt @@ -0,0 +1 @@ +hello, assets! diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/assets.json b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/assets.json new file mode 100644 index 0000000000000..eced01a4b1814 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/assets.json @@ -0,0 +1,3 @@ +{ + "$comment": "Empty on purpose for now" +} diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/docker-asset/Dockerfile b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/docker-asset/Dockerfile new file mode 100644 index 0000000000000..9b247ee4463fa --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/docker-asset/Dockerfile @@ -0,0 +1 @@ +FROM public.ecr.aws/docker/library/ubuntu:latest diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/manifest.json new file mode 100644 index 0000000000000..fa63832eea44d --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/manifest.json @@ -0,0 +1,21 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "dependencies": ["AssetManifest"], + "metadata": { + } + }, + "AssetManifest": { + "type": "cdk:asset-manifest", + "properties": { + "file": "asset.json" + } + } + } +} diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/asset-manifest/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/assets/asset-dir/foo.txt b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/asset-dir/foo.txt new file mode 100644 index 0000000000000..5783cb7e31483 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/asset-dir/foo.txt @@ -0,0 +1 @@ +hello, assets! diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/assets/docker-asset/Dockerfile b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/docker-asset/Dockerfile new file mode 100644 index 0000000000000..9b247ee4463fa --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/docker-asset/Dockerfile @@ -0,0 +1 @@ +FROM public.ecr.aws/docker/library/ubuntu:latest diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/assets/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/manifest.json new file mode 100644 index 0000000000000..8c52c21ba9129 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/manifest.json @@ -0,0 +1,39 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "metadata": { + "foo": [ + { + "type": "aws:cdk:asset", + "data": { + "packaging": "zip", + "id": "logical-id-of-the-asset", + "sourceHash": "xoxoxox", + "path": "asset-dir", + "artifactHashParameter": "hashParameter", + "s3BucketParameter": "bucketParameter", + "s3KeyParameter": "keyParameter" + }, + "trace": ["bam"] + }, + { + "type": "aws:cdk:asset", + "data": { + "packaging": "container-image", + "id": "logical-id-of-the-asset-x1234", + "sourceHash": "docker-asset-source", + "path": "docker-asset" + }, + "trace": ["bam:ssss"] + } + ] + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/assets/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/assets/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/depends/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/depends/manifest.json new file mode 100644 index 0000000000000..a9d9463a63842 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/depends/manifest.json @@ -0,0 +1,35 @@ +{ + "version": "0.0.0", + "artifacts": { + "StackA": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + }, + "StackB": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "dependencies": [ "StackC", "StackD" ] + }, + "StackC": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "dependencies": [ "StackD" ] + }, + "StackD": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/depends/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/depends/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/depends/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/empty/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/empty/manifest.json new file mode 100644 index 0000000000000..c158d5be87422 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/empty/manifest.json @@ -0,0 +1,3 @@ +{ + "version": "0.0.0" +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/explicit-stack-name/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/explicit-stack-name/manifest.json new file mode 100644 index 0000000000000..44f5005e3446b --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/explicit-stack-name/manifest.json @@ -0,0 +1,19 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "foo.tree.json" + } + }, + "stackid1": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "stackName": "TheStackName", + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/explicit-stack-name/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/explicit-stack-name/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/explicit-stack-name/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-depends/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-depends/manifest.json new file mode 100644 index 0000000000000..1add9a85ee121 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-depends/manifest.json @@ -0,0 +1,35 @@ +{ + "version": "0.0.0", + "artifacts": { + "StackA": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + }, + "StackB": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "dependencies": [ "StackC", "StackD" ] + }, + "StackC": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "dependencies": [ "StackX" ] + }, + "StackD": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-depends/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-depends/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-depends/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-env-format/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-env-format/manifest.json new file mode 100644 index 0000000000000..7a09d59deecb9 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-env-format/manifest.json @@ -0,0 +1,12 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "awsx://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-cloudformation/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-cloudformation/manifest.json new file mode 100644 index 0000000000000..bc17a8cd5b5fd --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-cloudformation/manifest.json @@ -0,0 +1,11 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "properties": { + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-cloudformation/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-cloudformation/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-cloudformation/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-tree/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-tree/manifest.json new file mode 100644 index 0000000000000..1aba8f840e432 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/invalid-manifest-type-tree/manifest.json @@ -0,0 +1,17 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree1": { + "type": "cdk:tree", + "properties": { + "file": "tree1.json" + } + }, + "Tree2": { + "type": "cdk:tree", + "properties": { + "file": "tree2.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/logical-id-map/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/logical-id-map/manifest.json new file mode 100644 index 0000000000000..3126c3f17ae42 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/logical-id-map/manifest.json @@ -0,0 +1,21 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "metadata": { + "/foo/bar": [ + { + "type": "aws:cdk:logicalId", + "data": "logicalIdOfFooBar", + "trace": "bam" + } + ] + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/logical-id-map/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/logical-id-map/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/logical-id-map/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/messages/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/messages/manifest.json new file mode 100644 index 0000000000000..5be0b37f60d9d --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/messages/manifest.json @@ -0,0 +1,22 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + }, + "metadata": { + "foo": [ + { "type": "aws:cdk:warning", "data": "boom", "trace": ["bam"] }, + { "type": "aws:cdk:error", "data": "error!!", "trace": ["bam!Error"] } + ], + "bar": [ + { "type": "aws:cdk:info", "data": "info?", "trace": ["bam!Error"] }, + { "type": "aws:foo", "data": "info?", "trace": ["bam!Error"] } + ] + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/messages/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/messages/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/messages/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/missing-context/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/missing-context/manifest.json new file mode 100644 index 0000000000000..72bc48f404e6e --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/missing-context/manifest.json @@ -0,0 +1,31 @@ +{ + "version": "0.0.0", + "missing": [{ + "key": "missing:context:key", + "provider": "vpc-provider", + "props": { + "account": "1234", + "region": "us-east-1", + "filter": { + "foo": 123 + } + } + }], + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + }, + "MyStackName1234": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + } + + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/missing-context/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/missing-context/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/missing-context/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/manifest.json new file mode 100644 index 0000000000000..d6dfe8f443830 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/manifest.json @@ -0,0 +1,21 @@ +{ + "version": "0.0.0", + "artifacts": { + "stack1": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "stackName": "the-physical-name-of-the-stack", + "templateFile": "template.json" + } + }, + "stack2": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "stackName": "the-physical-name-of-the-stack", + "templateFile": "template.2.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/template.2.json b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/template.2.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/template.2.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks-same-name/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/manifest.json new file mode 100644 index 0000000000000..6d4a54915030f --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/manifest.json @@ -0,0 +1,19 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + }, + "MyStackName1234": { + "type": "aws:cloudformation:stack", + "environment": "aws://1111/us-region-1", + "properties": { + "templateFile": "template.2.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/template.2.json b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/template.2.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/template.2.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/multiple-stacks/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/manifest.json new file mode 100644 index 0000000000000..b79e280d6a1fb --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/manifest.json @@ -0,0 +1,21 @@ +{ + "version": "0.0.0", + "artifacts": { + "subassembly": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "subassembly", + "displayName": "subassembly" + } + }, + "topLevelStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://111111111111/us-east-1", + "properties": { + "templateFile": "topLevelStack.template.json", + "stackName": "topLevelStack" + }, + "displayName": "topLevelStack" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/manifest.json new file mode 100644 index 0000000000000..703e640daea91 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/manifest.json @@ -0,0 +1,20 @@ +{ + "version": "0.0.0", + "artifacts": { + "subsubassembly": { + "type": "cdk:cloud-assembly", + "properties": { + "directoryName": "subsubassembly", + "displayName": "subsubassembly" + } + }, + "stack1": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json", + "stackName": "first-stack" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/subsubassembly/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/subsubassembly/manifest.json new file mode 100644 index 0000000000000..4166babad9831 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/subsubassembly/manifest.json @@ -0,0 +1,13 @@ +{ + "version": "0.0.0", + "artifacts": { + "stack2": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.2.json", + "stackName": "second-stack" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/subsubassembly/template.2.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/subsubassembly/template.2.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/subsubassembly/template.2.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/subassembly/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/node_modules/some_dep/file b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/topLevelStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-ecr-assets/test/allow-listed-image/node_modules/some_dep/file rename to packages/aws-cdk-lib/cx-api/test/fixtures/nested-assemblies/topLevelStack.template.json diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/manifest.json new file mode 100644 index 0000000000000..8d732d2105e2d --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/manifest.json @@ -0,0 +1,30 @@ +{ + "version": "0.0.0", + "artifacts": { + "topLevelStack": { + "type": "aws:cloudformation:stack", + "environment": "aws://111111111111/us-east-1", + "properties": { + "templateFile": "topLevelStack.template.json" + }, + "displayName": "topLevelStack" + }, + "topLevelStackNestedStackDAC87084": { + "type": "aws:cloudformation:stack", + "environment": "aws://111111111111/us-east-1", + "properties": { + "templateFile": "nestedStack.template.json" + }, + "displayName": "topLevelStack/nestedStack" + }, + "topLevelStackNestedStackWithStackName6D28EAEF": { + "type": "aws:cloudformation:stack", + "environment": "aws://111111111111/us-east-1", + "properties": { + "templateFile": "nestedStackWithStackName.template.json", + "stackName": "explicitStackName" + }, + "displayName": "topLevelStack/nestedStackWithStackName" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/test/cdk.out/asset.95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/nestedStack.template.json similarity index 100% rename from packages/@aws-cdk/aws-servicecatalog/test/cdk.out/asset.95c924c84f5d023be4edee540cb2cb401a49f115d01ed403b288f6cb412771df.zip rename to packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/nestedStack.template.json diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/.no-packagejson-validator b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/nestedStackWithStackName.template.json similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/.no-packagejson-validator rename to packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/nestedStackWithStackName.template.json diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/topLevelStack.template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/nested-stacks/topLevelStack.template.json new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack-0.36/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack-0.36/manifest.json new file mode 100644 index 0000000000000..b62b16726d762 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack-0.36/manifest.json @@ -0,0 +1,18 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "foo.tree.json" + } + }, + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack-0.36/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack-0.36/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack-0.36/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack/manifest.json new file mode 100644 index 0000000000000..b62b16726d762 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack/manifest.json @@ -0,0 +1,18 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "foo.tree.json" + } + }, + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1", + "properties": { + "templateFile": "template.json" + } + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack/template.json b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack/template.json new file mode 100644 index 0000000000000..284fd64cffc21 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/single-stack/template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "MyBucket": { + "Type": "AWS::S3::Bucket" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/stack-without-params/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/stack-without-params/manifest.json new file mode 100644 index 0000000000000..e65d503231914 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/stack-without-params/manifest.json @@ -0,0 +1,9 @@ +{ + "version": "0.0.0", + "artifacts": { + "MyStackName": { + "type": "aws:cloudformation:stack", + "environment": "aws://37736633/us-region-1" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/fixtures/tree-no-file-property/manifest.json b/packages/aws-cdk-lib/cx-api/test/fixtures/tree-no-file-property/manifest.json new file mode 100644 index 0000000000000..53f36cd322b4c --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/fixtures/tree-no-file-property/manifest.json @@ -0,0 +1,9 @@ +{ + "version": "0.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": {} + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/cx-api/test/placeholders.test.ts b/packages/aws-cdk-lib/cx-api/test/placeholders.test.ts new file mode 100644 index 0000000000000..658d8a4670433 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/placeholders.test.ts @@ -0,0 +1,54 @@ +import { EnvironmentPlaceholders, EnvironmentPlaceholderValues, IEnvironmentPlaceholderProvider } from '../lib'; + +test('complex placeholder substitution', async () => { + const replacer: IEnvironmentPlaceholderProvider = { + accountId: () => Promise.resolve('current_account'), + region: () => Promise.resolve('current_region'), + partition: () => Promise.resolve('current_partition'), + }; + + expect(await EnvironmentPlaceholders.replaceAsync({ + destinations: { + theDestination: { + assumeRoleArn: 'arn:${AWS::Partition}:role-${AWS::AccountId}', + bucketName: 'some_bucket-${AWS::AccountId}-${AWS::Region}', + objectKey: 'some_key-${AWS::AccountId}-${AWS::Region}', + }, + }, + }, replacer)).toEqual({ + destinations: { + theDestination: { + assumeRoleArn: 'arn:current_partition:role-current_account', + bucketName: 'some_bucket-current_account-current_region', + objectKey: 'some_key-current_account-current_region', + }, + }, + }); +}); + +test('sync placeholder substitution', () => { + const replacer: EnvironmentPlaceholderValues = { + accountId: 'current_account', + region: 'current_region', + partition: 'current_partition', + }; + + expect(EnvironmentPlaceholders.replace({ + destinations: { + theDestination: { + assumeRoleArn: 'arn:${AWS::Partition}:role-${AWS::AccountId}', + bucketName: 'some_bucket-${AWS::AccountId}-${AWS::Region}', + objectKey: 'some_key-${AWS::AccountId}-${AWS::Region}', + }, + }, + }, replacer)).toEqual({ + destinations: { + theDestination: { + assumeRoleArn: 'arn:current_partition:role-current_account', + bucketName: 'some_bucket-current_account-current_region', + objectKey: 'some_key-current_account-current_region', + }, + }, + }); + +}); diff --git a/packages/aws-cdk-lib/cx-api/test/stack-artifact.test.ts b/packages/aws-cdk-lib/cx-api/test/stack-artifact.test.ts new file mode 100644 index 0000000000000..4dd5ddecddfe5 --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/stack-artifact.test.ts @@ -0,0 +1,159 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as cxschema from '../../cloud-assembly-schema'; +import { rimraf } from './util'; +import * as cxapi from '../lib'; + +const stackBase = { + type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK, + environment: 'aws://1222344/us-east-1', + properties: { + templateFile: 'bla.json', + }, +}; + +let builder: cxapi.CloudAssemblyBuilder; +beforeEach(() => { + builder = new cxapi.CloudAssemblyBuilder(); +}); + +afterEach(() => { + rimraf(builder.outdir); +}); + +test('read tags from artifact properties', () => { + // GIVEN + builder.addArtifact('Stack', { + ...stackBase, + properties: { + ...stackBase.properties, + tags: { + foo: 'bar', + }, + }, + }); + + // WHEN + const assembly = builder.buildAssembly(); + + // THEN + expect(assembly.getStackByName('Stack').tags).toEqual({ foo: 'bar' }); +}); + +test('stack tags get uppercased when written to Cloud Assembly', () => { + // Backwards compatibility test + // GIVEN + builder.addArtifact('Stack', { + ...stackBase, + metadata: { + '/Stack': [ + { + type: 'aws:cdk:stack-tags', + data: [{ key: 'foo', value: 'bar' }], + }, + ], + }, + }); + + // WHEN + const assembly = builder.buildAssembly(); + + // THEN + const manifestStructure = JSON.parse(fs.readFileSync(path.join(assembly.directory, 'manifest.json'), { encoding: 'utf-8' })); + expect(manifestStructure.artifacts.Stack.metadata['/Stack']).toEqual([ + { + type: 'aws:cdk:stack-tags', + data: [ + { + // Note: uppercase due to historical accident + Key: 'foo', + Value: 'bar', + }, + ], + }, + ]); +}); + +test('already uppercased stack tags get left alone', () => { + // Backwards compatibility test + // GIVEN + builder.addArtifact('Stack', { + ...stackBase, + metadata: { + '/Stack': [ + { + type: 'aws:cdk:stack-tags', + data: [{ Key: 'foo', Value: 'bar' } as any], + }, + ], + }, + }); + + // WHEN + const assembly = builder.buildAssembly(); + + // THEN + const manifestStructure = JSON.parse(fs.readFileSync(path.join(assembly.directory, 'manifest.json'), { encoding: 'utf-8' })); + expect(manifestStructure.artifacts.Stack.metadata['/Stack']).toEqual([ + { + type: 'aws:cdk:stack-tags', + data: [ + { + // Note: uppercase due to historical accident + Key: 'foo', + Value: 'bar', + }, + ], + }, + ]); +}); + + +test('read tags from stack metadata', () => { + // Backwards compatibility test + // GIVEN + builder.addArtifact('Stack', { + ...stackBase, + metadata: { + '/Stack': [ + { + type: 'aws:cdk:stack-tags', + data: [{ key: 'foo', value: 'bar' }], + }, + ], + }, + }); + + // WHEN + const assembly = builder.buildAssembly(); + + // THEN + expect(assembly.getStackByName('Stack').tags).toEqual({ foo: 'bar' }); +}); + +test('user friendly id is the assembly display name', () => { + // GIVEN + builder.addArtifact('Stack', { + ...stackBase, + displayName: 'some/path/to/the/stack', + }); + + // WHEN + const assembly = builder.buildAssembly(); + + // THEN + expect(assembly.getStackByName('Stack').hierarchicalId).toEqual('some/path/to/the/stack'); +}); + +test('user friendly id is the id itself if no display name is given', () => { + // GIVEN + builder.addArtifact('Stack', { + ...stackBase, + }); + + // WHEN + const assembly = builder.buildAssembly(); + + // THEN + expect(assembly.getStackByName('Stack').hierarchicalId).toEqual('Stack'); +}); diff --git a/packages/aws-cdk-lib/cx-api/test/util.ts b/packages/aws-cdk-lib/cx-api/test/util.ts new file mode 100644 index 0000000000000..4f558dadd05bd --- /dev/null +++ b/packages/aws-cdk-lib/cx-api/test/util.ts @@ -0,0 +1,23 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +/** + * rm -rf reimplementation, don't want to depend on an NPM package for this + */ +export function rimraf(fsPath: string) { + try { + const isDir = fs.lstatSync(fsPath).isDirectory(); + + if (isDir) { + for (const file of fs.readdirSync(fsPath)) { + rimraf(path.join(fsPath, file)); + } + fs.rmdirSync(fsPath); + } else { + fs.unlinkSync(fsPath); + } + } catch (e: any) { + // We will survive ENOENT + if (e.code !== 'ENOENT') { throw e; } + } +} diff --git a/packages/aws-cdk-lib/index.ts b/packages/aws-cdk-lib/index.ts new file mode 100644 index 0000000000000..f5783728d116a --- /dev/null +++ b/packages/aws-cdk-lib/index.ts @@ -0,0 +1,252 @@ +export * as alexa_ask from './alexa-ask'; +export * as assertions from './assertions'; +export * as assets from './assets'; +export * as aws_accessanalyzer from './aws-accessanalyzer'; +export * as aws_acmpca from './aws-acmpca'; +export * as aws_amazonmq from './aws-amazonmq'; +export * as aws_amplify from './aws-amplify'; +export * as aws_amplifyuibuilder from './aws-amplifyuibuilder'; +export * as aws_apigateway from './aws-apigateway'; +export * as aws_apigatewayv2 from './aws-apigatewayv2'; +export * as aws_appconfig from './aws-appconfig'; +export * as aws_appflow from './aws-appflow'; +export * as aws_appintegrations from './aws-appintegrations'; +export * as aws_applicationautoscaling from './aws-applicationautoscaling'; +export * as aws_applicationinsights from './aws-applicationinsights'; +export * as aws_appmesh from './aws-appmesh'; +export * as aws_apprunner from './aws-apprunner'; +export * as aws_appstream from './aws-appstream'; +export * as aws_appsync from './aws-appsync'; +export * as aws_aps from './aws-aps'; +export * as aws_athena from './aws-athena'; +export * as aws_auditmanager from './aws-auditmanager'; +export * as aws_autoscaling from './aws-autoscaling'; +export * as aws_autoscaling_common from './aws-autoscaling-common'; +export * as aws_autoscaling_hooktargets from './aws-autoscaling-hooktargets'; +export * as aws_autoscalingplans from './aws-autoscalingplans'; +export * as aws_backup from './aws-backup'; +export * as aws_batch from './aws-batch'; +export * as aws_billingconductor from './aws-billingconductor'; +export * as aws_budgets from './aws-budgets'; +export * as aws_cassandra from './aws-cassandra'; +export * as aws_ce from './aws-ce'; +export * as aws_certificatemanager from './aws-certificatemanager'; +export * as aws_chatbot from './aws-chatbot'; +export * as aws_cloud9 from './aws-cloud9'; +export * as aws_cloudformation from './aws-cloudformation'; +export * as aws_cloudfront from './aws-cloudfront'; +export * as aws_cloudfront_origins from './aws-cloudfront-origins'; +export * as aws_cloudtrail from './aws-cloudtrail'; +export * as aws_cloudwatch from './aws-cloudwatch'; +export * as aws_cloudwatch_actions from './aws-cloudwatch-actions'; +export * as aws_codeartifact from './aws-codeartifact'; +export * as aws_codebuild from './aws-codebuild'; +export * as aws_codecommit from './aws-codecommit'; +export * as aws_codedeploy from './aws-codedeploy'; +export * as aws_codeguruprofiler from './aws-codeguruprofiler'; +export * as aws_codegurureviewer from './aws-codegurureviewer'; +export * as aws_codepipeline from './aws-codepipeline'; +export * as aws_codepipeline_actions from './aws-codepipeline-actions'; +export * as aws_codestar from './aws-codestar'; +export * as aws_codestarconnections from './aws-codestarconnections'; +export * as aws_codestarnotifications from './aws-codestarnotifications'; +export * as aws_cognito from './aws-cognito'; +export * as aws_comprehend from './aws-comprehend'; +export * as aws_config from './aws-config'; +export * as aws_connect from './aws-connect'; +export * as aws_connectcampaigns from './aws-connectcampaigns'; +export * as aws_controltower from './aws-controltower'; +export * as aws_cur from './aws-cur'; +export * as aws_customerprofiles from './aws-customerprofiles'; +export * as aws_databrew from './aws-databrew'; +export * as aws_datapipeline from './aws-datapipeline'; +export * as aws_datasync from './aws-datasync'; +export * as aws_dax from './aws-dax'; +export * as aws_detective from './aws-detective'; +export * as aws_devicefarm from './aws-devicefarm'; +export * as aws_devopsguru from './aws-devopsguru'; +export * as aws_directoryservice from './aws-directoryservice'; +export * as aws_dlm from './aws-dlm'; +export * as aws_dms from './aws-dms'; +export * as aws_docdb from './aws-docdb'; +export * as aws_docdbelastic from './aws-docdbelastic'; +export * as aws_dynamodb from './aws-dynamodb'; +export * as aws_ec2 from './aws-ec2'; +export * as aws_ecr from './aws-ecr'; +export * as aws_ecr_assets from './aws-ecr-assets'; +export * as aws_ecs from './aws-ecs'; +export * as aws_ecs_patterns from './aws-ecs-patterns'; +export * as aws_efs from './aws-efs'; +export * as aws_eks from './aws-eks'; +export * as aws_elasticache from './aws-elasticache'; +export * as aws_elasticbeanstalk from './aws-elasticbeanstalk'; +export * as aws_elasticloadbalancing from './aws-elasticloadbalancing'; +export * as aws_elasticloadbalancingv2 from './aws-elasticloadbalancingv2'; +export * as aws_elasticloadbalancingv2_actions from './aws-elasticloadbalancingv2-actions'; +export * as aws_elasticloadbalancingv2_targets from './aws-elasticloadbalancingv2-targets'; +export * as aws_elasticsearch from './aws-elasticsearch'; +export * as aws_emr from './aws-emr'; +export * as aws_emrcontainers from './aws-emrcontainers'; +export * as aws_emrserverless from './aws-emrserverless'; +export * as aws_events from './aws-events'; +export * as aws_events_targets from './aws-events-targets'; +export * as aws_eventschemas from './aws-eventschemas'; +export * as aws_evidently from './aws-evidently'; +export * as aws_finspace from './aws-finspace'; +export * as aws_fis from './aws-fis'; +export * as aws_fms from './aws-fms'; +export * as aws_forecast from './aws-forecast'; +export * as aws_frauddetector from './aws-frauddetector'; +export * as aws_fsx from './aws-fsx'; +export * as aws_gamelift from './aws-gamelift'; +export * as aws_globalaccelerator from './aws-globalaccelerator'; +export * as aws_globalaccelerator_endpoints from './aws-globalaccelerator-endpoints'; +export * as aws_glue from './aws-glue'; +export * as aws_grafana from './aws-grafana'; +export * as aws_greengrass from './aws-greengrass'; +export * as aws_greengrassv2 from './aws-greengrassv2'; +export * as aws_groundstation from './aws-groundstation'; +export * as aws_guardduty from './aws-guardduty'; +export * as aws_healthlake from './aws-healthlake'; +export * as aws_iam from './aws-iam'; +export * as aws_identitystore from './aws-identitystore'; +export * as aws_imagebuilder from './aws-imagebuilder'; +export * as aws_inspector from './aws-inspector'; +export * as aws_inspectorv2 from './aws-inspectorv2'; +export * as aws_internetmonitor from './aws-internetmonitor'; +export * as aws_iot from './aws-iot'; +export * as aws_iot1click from './aws-iot1click'; +export * as aws_iotanalytics from './aws-iotanalytics'; +export * as aws_iotcoredeviceadvisor from './aws-iotcoredeviceadvisor'; +export * as aws_iotevents from './aws-iotevents'; +export * as aws_iotfleethub from './aws-iotfleethub'; +export * as aws_iotfleetwise from './aws-iotfleetwise'; +export * as aws_iotsitewise from './aws-iotsitewise'; +export * as aws_iotthingsgraph from './aws-iotthingsgraph'; +export * as aws_iottwinmaker from './aws-iottwinmaker'; +export * as aws_iotwireless from './aws-iotwireless'; +export * as aws_ivs from './aws-ivs'; +export * as aws_ivschat from './aws-ivschat'; +export * as aws_kafkaconnect from './aws-kafkaconnect'; +export * as aws_kendra from './aws-kendra'; +export * as aws_kendraranking from './aws-kendraranking'; +export * as aws_kinesis from './aws-kinesis'; +export * as aws_kinesisanalytics from './aws-kinesisanalytics'; +export * as aws_kinesisanalyticsv2 from './aws-kinesisanalyticsv2'; +export * as aws_kinesisfirehose from './aws-kinesisfirehose'; +export * as aws_kinesisvideo from './aws-kinesisvideo'; +export * as aws_kms from './aws-kms'; +export * as aws_lakeformation from './aws-lakeformation'; +export * as aws_lambda from './aws-lambda'; +export * as aws_lambda_destinations from './aws-lambda-destinations'; +export * as aws_lambda_event_sources from './aws-lambda-event-sources'; +export * as aws_lambda_nodejs from './aws-lambda-nodejs'; +export * as aws_lex from './aws-lex'; +export * as aws_licensemanager from './aws-licensemanager'; +export * as aws_lightsail from './aws-lightsail'; +export * as aws_location from './aws-location'; +export * as aws_logs from './aws-logs'; +export * as aws_logs_destinations from './aws-logs-destinations'; +export * as aws_lookoutequipment from './aws-lookoutequipment'; +export * as aws_lookoutmetrics from './aws-lookoutmetrics'; +export * as aws_lookoutvision from './aws-lookoutvision'; +export * as aws_m2 from './aws-m2'; +export * as aws_macie from './aws-macie'; +export * as aws_managedblockchain from './aws-managedblockchain'; +export * as aws_mediaconnect from './aws-mediaconnect'; +export * as aws_mediaconvert from './aws-mediaconvert'; +export * as aws_medialive from './aws-medialive'; +export * as aws_mediapackage from './aws-mediapackage'; +export * as aws_mediastore from './aws-mediastore'; +export * as aws_mediatailor from './aws-mediatailor'; +export * as aws_memorydb from './aws-memorydb'; +export * as aws_msk from './aws-msk'; +export * as aws_mwaa from './aws-mwaa'; +export * as aws_neptune from './aws-neptune'; +export * as aws_networkfirewall from './aws-networkfirewall'; +export * as aws_networkmanager from './aws-networkmanager'; +export * as aws_nimblestudio from './aws-nimblestudio'; +export * as aws_oam from './aws-oam'; +export * as aws_omics from './aws-omics'; +export * as aws_opensearchserverless from './aws-opensearchserverless'; +export * as aws_opensearchservice from './aws-opensearchservice'; +export * as aws_opsworks from './aws-opsworks'; +export * as aws_opsworkscm from './aws-opsworkscm'; +export * as aws_organizations from './aws-organizations'; +export * as aws_panorama from './aws-panorama'; +export * as aws_personalize from './aws-personalize'; +export * as aws_pinpoint from './aws-pinpoint'; +export * as aws_pinpointemail from './aws-pinpointemail'; +export * as aws_pipes from './aws-pipes'; +export * as aws_qldb from './aws-qldb'; +export * as aws_quicksight from './aws-quicksight'; +export * as aws_ram from './aws-ram'; +export * as aws_rds from './aws-rds'; +export * as aws_redshift from './aws-redshift'; +export * as aws_redshiftserverless from './aws-redshiftserverless'; +export * as aws_refactorspaces from './aws-refactorspaces'; +export * as aws_rekognition from './aws-rekognition'; +export * as aws_resiliencehub from './aws-resiliencehub'; +export * as aws_resourceexplorer2 from './aws-resourceexplorer2'; +export * as aws_resourcegroups from './aws-resourcegroups'; +export * as aws_robomaker from './aws-robomaker'; +export * as aws_rolesanywhere from './aws-rolesanywhere'; +export * as aws_route53 from './aws-route53'; +export * as aws_route53_patterns from './aws-route53-patterns'; +export * as aws_route53_targets from './aws-route53-targets'; +export * as aws_route53recoverycontrol from './aws-route53recoverycontrol'; +export * as aws_route53recoveryreadiness from './aws-route53recoveryreadiness'; +export * as aws_route53resolver from './aws-route53resolver'; +export * as aws_rum from './aws-rum'; +export * as aws_s3 from './aws-s3'; +export * as aws_s3_assets from './aws-s3-assets'; +export * as aws_s3_deployment from './aws-s3-deployment'; +export * as aws_s3_notifications from './aws-s3-notifications'; +export * as aws_s3objectlambda from './aws-s3objectlambda'; +export * as aws_s3outposts from './aws-s3outposts'; +export * as aws_sagemaker from './aws-sagemaker'; +export * as aws_sam from './aws-sam'; +export * as aws_scheduler from './aws-scheduler'; +export * as aws_sdb from './aws-sdb'; +export * as aws_secretsmanager from './aws-secretsmanager'; +export * as aws_securityhub from './aws-securityhub'; +export * as aws_servicecatalog from './aws-servicecatalog'; +export * as aws_servicecatalogappregistry from './aws-servicecatalogappregistry'; +export * as aws_servicediscovery from './aws-servicediscovery'; +export * as aws_ses from './aws-ses'; +export * as aws_ses_actions from './aws-ses-actions'; +export * as aws_signer from './aws-signer'; +export * as aws_simspaceweaver from './aws-simspaceweaver'; +export * as aws_sns from './aws-sns'; +export * as aws_sns_subscriptions from './aws-sns-subscriptions'; +export * as aws_sqs from './aws-sqs'; +export * as aws_ssm from './aws-ssm'; +export * as aws_ssmcontacts from './aws-ssmcontacts'; +export * as aws_ssmincidents from './aws-ssmincidents'; +export * as aws_sso from './aws-sso'; +export * as aws_stepfunctions from './aws-stepfunctions'; +export * as aws_stepfunctions_tasks from './aws-stepfunctions-tasks'; +export * as aws_supportapp from './aws-supportapp'; +export * as aws_synthetics from './aws-synthetics'; +export * as aws_systemsmanagersap from './aws-systemsmanagersap'; +export * as aws_timestream from './aws-timestream'; +export * as aws_transfer from './aws-transfer'; +export * as aws_voiceid from './aws-voiceid'; +export * as aws_vpclattice from './aws-vpclattice'; +export * as aws_waf from './aws-waf'; +export * as aws_wafregional from './aws-wafregional'; +export * as aws_wafv2 from './aws-wafv2'; +export * as aws_wisdom from './aws-wisdom'; +export * as aws_workspaces from './aws-workspaces'; +export * as aws_xray from './aws-xray'; +export * as cloud_assembly_schema from './cloud-assembly-schema'; +export * as cloudformation_include from './cloudformation-include'; +export * from './core'; +export * as custom_resources from './custom-resources'; +export * as cx_api from './cx-api'; +export * as lambda_layer_awscli from './lambda-layer-awscli'; +export * as lambda_layer_kubectl from './lambda-layer-kubectl'; +export * as lambda_layer_node_proxy_agent from './lambda-layer-node-proxy-agent'; +export * as pipelines from './pipelines'; +export * as region_info from './region-info'; +export * as triggers from './triggers'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/jest.config.js b/packages/aws-cdk-lib/jest.config.js new file mode 100644 index 0000000000000..6c006365c8d35 --- /dev/null +++ b/packages/aws-cdk-lib/jest.config.js @@ -0,0 +1,15 @@ +const baseConfig = require('@aws-cdk/cdk-build-tools/config/jest.config'); + +module.exports = { + ...baseConfig, + testMatch: [ + "/**/test/**/?(*.)+(test).js", + ], + testEnvironment: 'node', + coverageThreshold: { + global: { + branches: 40, + statements: 55, + }, + }, +}; diff --git a/packages/aws-cdk-lib/lambda-layer-awscli/.jsiirc.json b/packages/aws-cdk-lib/lambda-layer-awscli/.jsiirc.json new file mode 100644 index 0000000000000..265dd420599bf --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-awscli/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.lambdalayer.awscli" + }, + "dotnet": { + "namespace": "Amazon.CDK.LambdaLayer.AwsCli" + }, + "python": { + "module": "aws_cdk.lambda_layer_awscli" + } + } +} diff --git a/packages/aws-cdk-lib/lambda-layer-awscli/README.md b/packages/aws-cdk-lib/lambda-layer-awscli/README.md new file mode 100644 index 0000000000000..d58a2638958a2 --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-awscli/README.md @@ -0,0 +1,24 @@ +# AWS Lambda Layer with AWS CLI + + + +This module exports a single class called `AwsCliLayer` which is a `lambda.Layer` that bundles the AWS CLI. + +Any Lambda Function that uses this layer must use a Python 3.x runtime. + +Usage: + +```ts +// AwsCliLayer bundles the AWS CLI in a lambda layer +import { AwsCliLayer } from 'aws-cdk-lib/lambda-layer-awscli'; + +declare const fn: lambda.Function; +fn.addLayers(new AwsCliLayer(this, 'AwsCliLayer')); +``` + +The CLI will be installed under `/opt/awscli/aws`. + +## Alternatives + +This module bundles AWS cli v1. To use AWS cli v2, you can use the +external module [awscdk-asset-awscli](https://github.com/cdklabs/awscdk-asset-awscli/tree/awscli-v2/main). diff --git a/packages/aws-cdk-lib/lambda-layer-awscli/index.ts b/packages/aws-cdk-lib/lambda-layer-awscli/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-awscli/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/lambda-layer-awscli/lib/awscli-layer.ts b/packages/aws-cdk-lib/lambda-layer-awscli/lib/awscli-layer.ts similarity index 86% rename from packages/@aws-cdk/lambda-layer-awscli/lib/awscli-layer.ts rename to packages/aws-cdk-lib/lambda-layer-awscli/lib/awscli-layer.ts index b62f66e4858c2..0da0d29c0edfd 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/lib/awscli-layer.ts +++ b/packages/aws-cdk-lib/lambda-layer-awscli/lib/awscli-layer.ts @@ -1,6 +1,6 @@ import { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-awscli-v1'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { FileSystem } from '@aws-cdk/core'; +import * as lambda from '../../aws-lambda'; +import { FileSystem } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/lambda-layer-awscli/lib/index.ts b/packages/aws-cdk-lib/lambda-layer-awscli/lib/index.ts similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/lib/index.ts rename to packages/aws-cdk-lib/lambda-layer-awscli/lib/index.ts diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.test.ts b/packages/aws-cdk-lib/lambda-layer-awscli/test/awscli-layer.test.ts similarity index 78% rename from packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.test.ts rename to packages/aws-cdk-lib/lambda-layer-awscli/test/awscli-layer.test.ts index b8f84b3fb6af8..4d3dbe94edfcc 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.test.ts +++ b/packages/aws-cdk-lib/lambda-layer-awscli/test/awscli-layer.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { AwsCliLayer } from '../lib'; test('synthesized to a layer version', () => { diff --git a/packages/aws-cdk-lib/lambda-layer-awscli/test/lambda-handler/index.py b/packages/aws-cdk-lib/lambda-layer-awscli/test/lambda-handler/index.py new file mode 100644 index 0000000000000..dafef9f351903 --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-awscli/test/lambda-handler/index.py @@ -0,0 +1,5 @@ +import subprocess + +def handler(event, context): + subprocess.check_call(["/opt/awscli/aws", "--version"]) + return diff --git a/packages/aws-cdk-lib/lambda-layer-kubectl/.jsiirc.json b/packages/aws-cdk-lib/lambda-layer-kubectl/.jsiirc.json new file mode 100644 index 0000000000000..16c7f2fa380f0 --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-kubectl/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.lambdalayer.kubectl" + }, + "dotnet": { + "namespace": "Amazon.CDK.LambdaLayer.Kubectl" + }, + "python": { + "module": "aws_cdk.lambda_layer_kubectl" + } + } +} diff --git a/packages/aws-cdk-lib/lambda-layer-kubectl/README.md b/packages/aws-cdk-lib/lambda-layer-kubectl/README.md new file mode 100644 index 0000000000000..63c6ed18d4610 --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-kubectl/README.md @@ -0,0 +1,27 @@ +# AWS Lambda Layer with kubectl (and helm) + + +This module exports a single class called `KubectlLayer` which is a `lambda.Layer` that bundles the [`kubectl`](https://kubernetes.io/docs/reference/kubectl/kubectl/) and the [`helm`](https://helm.sh/) command line. + +> - Helm Version: 3.5.4 +> - Kubectl Version: 1.20.0 +> + +Usage: + +```ts +// KubectlLayer bundles the 'kubectl' and 'helm' command lines +import { KubectlLayer } from 'aws-cdk-lib/lambda-layer-kubectl'; + +declare const fn: lambda.Function; +fn.addLayers(new KubectlLayer(this, 'KubectlLayer')); +``` + +`kubectl` will be installed under `/opt/kubectl/kubectl`, and `helm` will be installed under `/opt/helm/helm`. + +## Alternatives + +This module bundles Kubectl v1.20.0 and the associated helm version +To use alternative Kubectl versions, including the latest available, +you can use the external module +[awscdk-asset-kubectl](https://github.com/cdklabs/awscdk-asset-kubectl). diff --git a/packages/aws-cdk-lib/lambda-layer-kubectl/index.ts b/packages/aws-cdk-lib/lambda-layer-kubectl/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-kubectl/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/lambda-layer-kubectl/lib/index.ts b/packages/aws-cdk-lib/lambda-layer-kubectl/lib/index.ts similarity index 100% rename from packages/@aws-cdk/lambda-layer-kubectl/lib/index.ts rename to packages/aws-cdk-lib/lambda-layer-kubectl/lib/index.ts diff --git a/packages/@aws-cdk/lambda-layer-kubectl/lib/kubectl-layer.ts b/packages/aws-cdk-lib/lambda-layer-kubectl/lib/kubectl-layer.ts similarity index 87% rename from packages/@aws-cdk/lambda-layer-kubectl/lib/kubectl-layer.ts rename to packages/aws-cdk-lib/lambda-layer-kubectl/lib/kubectl-layer.ts index 93c0ab5284322..cdf62af42d9c2 100644 --- a/packages/@aws-cdk/lambda-layer-kubectl/lib/kubectl-layer.ts +++ b/packages/aws-cdk-lib/lambda-layer-kubectl/lib/kubectl-layer.ts @@ -1,6 +1,6 @@ import { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-kubectl-v20'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { FileSystem } from '@aws-cdk/core'; +import * as lambda from '../../aws-lambda'; +import { FileSystem } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/lambda-layer-kubectl/test/kubectl-layer.test.ts b/packages/aws-cdk-lib/lambda-layer-kubectl/test/kubectl-layer.test.ts similarity index 79% rename from packages/@aws-cdk/lambda-layer-kubectl/test/kubectl-layer.test.ts rename to packages/aws-cdk-lib/lambda-layer-kubectl/test/kubectl-layer.test.ts index c46796cbb1bb2..f5a78a689d6f9 100644 --- a/packages/@aws-cdk/lambda-layer-kubectl/test/kubectl-layer.test.ts +++ b/packages/aws-cdk-lib/lambda-layer-kubectl/test/kubectl-layer.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { KubectlLayer } from '../lib'; test('synthesized to a layer version', () => { diff --git a/packages/aws-cdk-lib/lambda-layer-kubectl/test/lambda-handler/index.py b/packages/aws-cdk-lib/lambda-layer-kubectl/test/lambda-handler/index.py new file mode 100644 index 0000000000000..701a6f18fe0ab --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-kubectl/test/lambda-handler/index.py @@ -0,0 +1,6 @@ +import subprocess + +def handler(event, context): + subprocess.check_call(["/opt/kubectl/kubectl", "config", "view"]) + subprocess.check_call(["/opt/helm/helm", "version"]) + return \ No newline at end of file diff --git a/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/.jsiirc.json b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/.jsiirc.json new file mode 100644 index 0000000000000..cb55eb4ef2da0 --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.lambda.layer.node.proxy.agent" + }, + "dotnet": { + "namespace": "Amazon.CDK.LambdaLayer.NodeProxyAgent" + }, + "python": { + "module": "aws_cdk.lambda_layer_node_proxy_agent" + } + } +} diff --git a/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/.no-packagejson-validator b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/.no-packagejson-validator new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/README.md b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/README.md new file mode 100644 index 0000000000000..7fcafaaea9075 --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/README.md @@ -0,0 +1,18 @@ +# AWS Lambda Layer with the NPM dependency proxy-agent + + +This module exports a single class called `NodeProxyAgentLayer` which is a `lambda.Layer` that bundles the NPM dependency [`proxy-agent`](https://www.npmjs.com/package/proxy-agent). + +> - proxy-agent Version: 5.0.0 + +Usage: + +```ts +import { NodeProxyAgentLayer } from 'aws-cdk-lib/lambda-layer-node-proxy-agent'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +declare const fn: lambda.Function; +fn.addLayers(new NodeProxyAgentLayer(this, 'NodeProxyAgentLayer')); +``` + +[`proxy-agent`](https://www.npmjs.com/package/proxy-agent) will be installed under `/nodejs/node_modules`. diff --git a/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/index.ts b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/lib/index.ts b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/lib/index.ts similarity index 100% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/lib/index.ts rename to packages/aws-cdk-lib/lambda-layer-node-proxy-agent/lib/index.ts diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/lib/node-proxy-agent-layer.ts b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/lib/node-proxy-agent-layer.ts similarity index 87% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/lib/node-proxy-agent-layer.ts rename to packages/aws-cdk-lib/lambda-layer-node-proxy-agent/lib/node-proxy-agent-layer.ts index 8a2f431512df5..bc7b31709f644 100644 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/lib/node-proxy-agent-layer.ts +++ b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/lib/node-proxy-agent-layer.ts @@ -1,6 +1,6 @@ import { ASSET_FILE, LAYER_SOURCE_DIR } from '@aws-cdk/asset-node-proxy-agent-v5'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { FileSystem } from '@aws-cdk/core'; +import * as lambda from '../../aws-lambda'; +import { FileSystem } from '../../core'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/proxy-agent-layer.test.ts b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/test/proxy-agent-layer.test.ts similarity index 80% rename from packages/@aws-cdk/lambda-layer-node-proxy-agent/test/proxy-agent-layer.test.ts rename to packages/aws-cdk-lib/lambda-layer-node-proxy-agent/test/proxy-agent-layer.test.ts index 72b1b1f85d4a0..69e022e35899e 100644 --- a/packages/@aws-cdk/lambda-layer-node-proxy-agent/test/proxy-agent-layer.test.ts +++ b/packages/aws-cdk-lib/lambda-layer-node-proxy-agent/test/proxy-agent-layer.test.ts @@ -1,5 +1,5 @@ -import { Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import { Stack } from '../../core'; import { NodeProxyAgentLayer } from '../lib'; test('synthesized to a layer version', () => { diff --git a/packages/aws-cdk-lib/lazy-index.ts b/packages/aws-cdk-lib/lazy-index.ts new file mode 100644 index 0000000000000..a637fb48448af --- /dev/null +++ b/packages/aws-cdk-lib/lazy-index.ts @@ -0,0 +1,253 @@ +/* eslint-disable @typescript-eslint/no-require-imports */ +export * from './core'; +Object.defineProperty(exports, 'alexa_ask', { get: function () { return require('./alexa-ask'); } }); +Object.defineProperty(exports, 'assertions', { get: function () { return require('./assertions'); } }); +Object.defineProperty(exports, 'assets', { get: function () { return require('./assets'); } }); +Object.defineProperty(exports, 'aws_accessanalyzer', { get: function () { return require('./aws-accessanalyzer'); } }); +Object.defineProperty(exports, 'aws_acmpca', { get: function () { return require('./aws-acmpca'); } }); +Object.defineProperty(exports, 'aws_amazonmq', { get: function () { return require('./aws-amazonmq'); } }); +Object.defineProperty(exports, 'aws_amplify', { get: function () { return require('./aws-amplify'); } }); +Object.defineProperty(exports, 'aws_amplifyuibuilder', { get: function () { return require('./aws-amplifyuibuilder'); } }); +Object.defineProperty(exports, 'aws_apigateway', { get: function () { return require('./aws-apigateway'); } }); +Object.defineProperty(exports, 'aws_apigatewayv2', { get: function () { return require('./aws-apigatewayv2'); } }); +Object.defineProperty(exports, 'aws_appconfig', { get: function () { return require('./aws-appconfig'); } }); +Object.defineProperty(exports, 'aws_appflow', { get: function () { return require('./aws-appflow'); } }); +Object.defineProperty(exports, 'aws_appintegrations', { get: function () { return require('./aws-appintegrations'); } }); +Object.defineProperty(exports, 'aws_applicationautoscaling', { get: function () { return require('./aws-applicationautoscaling'); } }); +Object.defineProperty(exports, 'aws_applicationinsights', { get: function () { return require('./aws-applicationinsights'); } }); +Object.defineProperty(exports, 'aws_appmesh', { get: function () { return require('./aws-appmesh'); } }); +Object.defineProperty(exports, 'aws_apprunner', { get: function () { return require('./aws-apprunner'); } }); +Object.defineProperty(exports, 'aws_appstream', { get: function () { return require('./aws-appstream'); } }); +Object.defineProperty(exports, 'aws_appsync', { get: function () { return require('./aws-appsync'); } }); +Object.defineProperty(exports, 'aws_aps', { get: function () { return require('./aws-aps'); } }); +Object.defineProperty(exports, 'aws_athena', { get: function () { return require('./aws-athena'); } }); +Object.defineProperty(exports, 'aws_auditmanager', { get: function () { return require('./aws-auditmanager'); } }); +Object.defineProperty(exports, 'aws_autoscaling', { get: function () { return require('./aws-autoscaling'); } }); +Object.defineProperty(exports, 'aws_autoscaling_common', { get: function () { return require('./aws-autoscaling-common'); } }); +Object.defineProperty(exports, 'aws_autoscaling_hooktargets', { get: function () { return require('./aws-autoscaling-hooktargets'); } }); +Object.defineProperty(exports, 'aws_autoscalingplans', { get: function () { return require('./aws-autoscalingplans'); } }); +Object.defineProperty(exports, 'aws_backup', { get: function () { return require('./aws-backup'); } }); +Object.defineProperty(exports, 'aws_batch', { get: function () { return require('./aws-batch'); } }); +Object.defineProperty(exports, 'aws_billingconductor', { get: function () { return require('./aws-billingconductor'); } }); +Object.defineProperty(exports, 'aws_budgets', { get: function () { return require('./aws-budgets'); } }); +Object.defineProperty(exports, 'aws_cassandra', { get: function () { return require('./aws-cassandra'); } }); +Object.defineProperty(exports, 'aws_ce', { get: function () { return require('./aws-ce'); } }); +Object.defineProperty(exports, 'aws_certificatemanager', { get: function () { return require('./aws-certificatemanager'); } }); +Object.defineProperty(exports, 'aws_chatbot', { get: function () { return require('./aws-chatbot'); } }); +Object.defineProperty(exports, 'aws_cloud9', { get: function () { return require('./aws-cloud9'); } }); +Object.defineProperty(exports, 'aws_cloudformation', { get: function () { return require('./aws-cloudformation'); } }); +Object.defineProperty(exports, 'aws_cloudfront', { get: function () { return require('./aws-cloudfront'); } }); +Object.defineProperty(exports, 'aws_cloudfront_origins', { get: function () { return require('./aws-cloudfront-origins'); } }); +Object.defineProperty(exports, 'aws_cloudtrail', { get: function () { return require('./aws-cloudtrail'); } }); +Object.defineProperty(exports, 'aws_cloudwatch', { get: function () { return require('./aws-cloudwatch'); } }); +Object.defineProperty(exports, 'aws_cloudwatch_actions', { get: function () { return require('./aws-cloudwatch-actions'); } }); +Object.defineProperty(exports, 'aws_codeartifact', { get: function () { return require('./aws-codeartifact'); } }); +Object.defineProperty(exports, 'aws_codebuild', { get: function () { return require('./aws-codebuild'); } }); +Object.defineProperty(exports, 'aws_codecommit', { get: function () { return require('./aws-codecommit'); } }); +Object.defineProperty(exports, 'aws_codedeploy', { get: function () { return require('./aws-codedeploy'); } }); +Object.defineProperty(exports, 'aws_codeguruprofiler', { get: function () { return require('./aws-codeguruprofiler'); } }); +Object.defineProperty(exports, 'aws_codegurureviewer', { get: function () { return require('./aws-codegurureviewer'); } }); +Object.defineProperty(exports, 'aws_codepipeline', { get: function () { return require('./aws-codepipeline'); } }); +Object.defineProperty(exports, 'aws_codepipeline_actions', { get: function () { return require('./aws-codepipeline-actions'); } }); +Object.defineProperty(exports, 'aws_codestar', { get: function () { return require('./aws-codestar'); } }); +Object.defineProperty(exports, 'aws_codestarconnections', { get: function () { return require('./aws-codestarconnections'); } }); +Object.defineProperty(exports, 'aws_codestarnotifications', { get: function () { return require('./aws-codestarnotifications'); } }); +Object.defineProperty(exports, 'aws_cognito', { get: function () { return require('./aws-cognito'); } }); +Object.defineProperty(exports, 'aws_comprehend', { get: function () { return require('./aws-comprehend'); } }); +Object.defineProperty(exports, 'aws_config', { get: function () { return require('./aws-config'); } }); +Object.defineProperty(exports, 'aws_connect', { get: function () { return require('./aws-connect'); } }); +Object.defineProperty(exports, 'aws_connectcampaigns', { get: function () { return require('./aws-connectcampaigns'); } }); +Object.defineProperty(exports, 'aws_controltower', { get: function () { return require('./aws-controltower'); } }); +Object.defineProperty(exports, 'aws_cur', { get: function () { return require('./aws-cur'); } }); +Object.defineProperty(exports, 'aws_customerprofiles', { get: function () { return require('./aws-customerprofiles'); } }); +Object.defineProperty(exports, 'aws_databrew', { get: function () { return require('./aws-databrew'); } }); +Object.defineProperty(exports, 'aws_datapipeline', { get: function () { return require('./aws-datapipeline'); } }); +Object.defineProperty(exports, 'aws_datasync', { get: function () { return require('./aws-datasync'); } }); +Object.defineProperty(exports, 'aws_dax', { get: function () { return require('./aws-dax'); } }); +Object.defineProperty(exports, 'aws_detective', { get: function () { return require('./aws-detective'); } }); +Object.defineProperty(exports, 'aws_devicefarm', { get: function () { return require('./aws-devicefarm'); } }); +Object.defineProperty(exports, 'aws_devopsguru', { get: function () { return require('./aws-devopsguru'); } }); +Object.defineProperty(exports, 'aws_directoryservice', { get: function () { return require('./aws-directoryservice'); } }); +Object.defineProperty(exports, 'aws_dlm', { get: function () { return require('./aws-dlm'); } }); +Object.defineProperty(exports, 'aws_dms', { get: function () { return require('./aws-dms'); } }); +Object.defineProperty(exports, 'aws_docdb', { get: function () { return require('./aws-docdb'); } }); +Object.defineProperty(exports, 'aws_docdbelastic', { get: function () { return require('./aws-docdbelastic'); } }); +Object.defineProperty(exports, 'aws_dynamodb', { get: function () { return require('./aws-dynamodb'); } }); +Object.defineProperty(exports, 'aws_ec2', { get: function () { return require('./aws-ec2'); } }); +Object.defineProperty(exports, 'aws_ecr', { get: function () { return require('./aws-ecr'); } }); +Object.defineProperty(exports, 'aws_ecr_assets', { get: function () { return require('./aws-ecr-assets'); } }); +Object.defineProperty(exports, 'aws_ecs', { get: function () { return require('./aws-ecs'); } }); +Object.defineProperty(exports, 'aws_ecs_patterns', { get: function () { return require('./aws-ecs-patterns'); } }); +Object.defineProperty(exports, 'aws_efs', { get: function () { return require('./aws-efs'); } }); +Object.defineProperty(exports, 'aws_eks', { get: function () { return require('./aws-eks'); } }); +Object.defineProperty(exports, 'aws_elasticache', { get: function () { return require('./aws-elasticache'); } }); +Object.defineProperty(exports, 'aws_elasticbeanstalk', { get: function () { return require('./aws-elasticbeanstalk'); } }); +Object.defineProperty(exports, 'aws_elasticloadbalancing', { get: function () { return require('./aws-elasticloadbalancing'); } }); +Object.defineProperty(exports, 'aws_elasticloadbalancingv2', { get: function () { return require('./aws-elasticloadbalancingv2'); } }); +Object.defineProperty(exports, 'aws_elasticloadbalancingv2_actions', { get: function () { return require('./aws-elasticloadbalancingv2-actions'); } }); +Object.defineProperty(exports, 'aws_elasticloadbalancingv2_targets', { get: function () { return require('./aws-elasticloadbalancingv2-targets'); } }); +Object.defineProperty(exports, 'aws_elasticsearch', { get: function () { return require('./aws-elasticsearch'); } }); +Object.defineProperty(exports, 'aws_emr', { get: function () { return require('./aws-emr'); } }); +Object.defineProperty(exports, 'aws_emrcontainers', { get: function () { return require('./aws-emrcontainers'); } }); +Object.defineProperty(exports, 'aws_emrserverless', { get: function () { return require('./aws-emrserverless'); } }); +Object.defineProperty(exports, 'aws_events', { get: function () { return require('./aws-events'); } }); +Object.defineProperty(exports, 'aws_events_targets', { get: function () { return require('./aws-events-targets'); } }); +Object.defineProperty(exports, 'aws_eventschemas', { get: function () { return require('./aws-eventschemas'); } }); +Object.defineProperty(exports, 'aws_evidently', { get: function () { return require('./aws-evidently'); } }); +Object.defineProperty(exports, 'aws_finspace', { get: function () { return require('./aws-finspace'); } }); +Object.defineProperty(exports, 'aws_fis', { get: function () { return require('./aws-fis'); } }); +Object.defineProperty(exports, 'aws_fms', { get: function () { return require('./aws-fms'); } }); +Object.defineProperty(exports, 'aws_forecast', { get: function () { return require('./aws-forecast'); } }); +Object.defineProperty(exports, 'aws_frauddetector', { get: function () { return require('./aws-frauddetector'); } }); +Object.defineProperty(exports, 'aws_fsx', { get: function () { return require('./aws-fsx'); } }); +Object.defineProperty(exports, 'aws_gamelift', { get: function () { return require('./aws-gamelift'); } }); +Object.defineProperty(exports, 'aws_globalaccelerator', { get: function () { return require('./aws-globalaccelerator'); } }); +Object.defineProperty(exports, 'aws_globalaccelerator_endpoints', { get: function () { return require('./aws-globalaccelerator-endpoints'); } }); +Object.defineProperty(exports, 'aws_glue', { get: function () { return require('./aws-glue'); } }); +Object.defineProperty(exports, 'aws_grafana', { get: function () { return require('./aws-grafana'); } }); +Object.defineProperty(exports, 'aws_greengrass', { get: function () { return require('./aws-greengrass'); } }); +Object.defineProperty(exports, 'aws_greengrassv2', { get: function () { return require('./aws-greengrassv2'); } }); +Object.defineProperty(exports, 'aws_groundstation', { get: function () { return require('./aws-groundstation'); } }); +Object.defineProperty(exports, 'aws_guardduty', { get: function () { return require('./aws-guardduty'); } }); +Object.defineProperty(exports, 'aws_healthlake', { get: function () { return require('./aws-healthlake'); } }); +Object.defineProperty(exports, 'aws_iam', { get: function () { return require('./aws-iam'); } }); +Object.defineProperty(exports, 'aws_identitystore', { get: function () { return require('./aws-identitystore'); } }); +Object.defineProperty(exports, 'aws_imagebuilder', { get: function () { return require('./aws-imagebuilder'); } }); +Object.defineProperty(exports, 'aws_inspector', { get: function () { return require('./aws-inspector'); } }); +Object.defineProperty(exports, 'aws_inspectorv2', { get: function () { return require('./aws-inspectorv2'); } }); +Object.defineProperty(exports, 'aws_internetmonitor', { get: function () { return require('./aws-internetmonitor'); } }); +Object.defineProperty(exports, 'aws_iot', { get: function () { return require('./aws-iot'); } }); +Object.defineProperty(exports, 'aws_iot1click', { get: function () { return require('./aws-iot1click'); } }); +Object.defineProperty(exports, 'aws_iotanalytics', { get: function () { return require('./aws-iotanalytics'); } }); +Object.defineProperty(exports, 'aws_iotcoredeviceadvisor', { get: function () { return require('./aws-iotcoredeviceadvisor'); } }); +Object.defineProperty(exports, 'aws_iotevents', { get: function () { return require('./aws-iotevents'); } }); +Object.defineProperty(exports, 'aws_iotfleethub', { get: function () { return require('./aws-iotfleethub'); } }); +Object.defineProperty(exports, 'aws_iotfleetwise', { get: function () { return require('./aws-iotfleetwise'); } }); +Object.defineProperty(exports, 'aws_iotsitewise', { get: function () { return require('./aws-iotsitewise'); } }); +Object.defineProperty(exports, 'aws_iotthingsgraph', { get: function () { return require('./aws-iotthingsgraph'); } }); +Object.defineProperty(exports, 'aws_iottwinmaker', { get: function () { return require('./aws-iottwinmaker'); } }); +Object.defineProperty(exports, 'aws_iotwireless', { get: function () { return require('./aws-iotwireless'); } }); +Object.defineProperty(exports, 'aws_ivs', { get: function () { return require('./aws-ivs'); } }); +Object.defineProperty(exports, 'aws_ivschat', { get: function () { return require('./aws-ivschat'); } }); +Object.defineProperty(exports, 'aws_kafkaconnect', { get: function () { return require('./aws-kafkaconnect'); } }); +Object.defineProperty(exports, 'aws_kendra', { get: function () { return require('./aws-kendra'); } }); +Object.defineProperty(exports, 'aws_kendraranking', { get: function () { return require('./aws-kendraranking'); } }); +Object.defineProperty(exports, 'aws_kinesis', { get: function () { return require('./aws-kinesis'); } }); +Object.defineProperty(exports, 'aws_kinesisanalytics', { get: function () { return require('./aws-kinesisanalytics'); } }); +Object.defineProperty(exports, 'aws_kinesisanalyticsv2', { get: function () { return require('./aws-kinesisanalyticsv2'); } }); +Object.defineProperty(exports, 'aws_kinesisfirehose', { get: function () { return require('./aws-kinesisfirehose'); } }); +Object.defineProperty(exports, 'aws_kinesisvideo', { get: function () { return require('./aws-kinesisvideo'); } }); +Object.defineProperty(exports, 'aws_kms', { get: function () { return require('./aws-kms'); } }); +Object.defineProperty(exports, 'aws_lakeformation', { get: function () { return require('./aws-lakeformation'); } }); +Object.defineProperty(exports, 'aws_lambda', { get: function () { return require('./aws-lambda'); } }); +Object.defineProperty(exports, 'aws_lambda_destinations', { get: function () { return require('./aws-lambda-destinations'); } }); +Object.defineProperty(exports, 'aws_lambda_event_sources', { get: function () { return require('./aws-lambda-event-sources'); } }); +Object.defineProperty(exports, 'aws_lambda_nodejs', { get: function () { return require('./aws-lambda-nodejs'); } }); +Object.defineProperty(exports, 'aws_lex', { get: function () { return require('./aws-lex'); } }); +Object.defineProperty(exports, 'aws_licensemanager', { get: function () { return require('./aws-licensemanager'); } }); +Object.defineProperty(exports, 'aws_lightsail', { get: function () { return require('./aws-lightsail'); } }); +Object.defineProperty(exports, 'aws_location', { get: function () { return require('./aws-location'); } }); +Object.defineProperty(exports, 'aws_logs', { get: function () { return require('./aws-logs'); } }); +Object.defineProperty(exports, 'aws_logs_destinations', { get: function () { return require('./aws-logs-destinations'); } }); +Object.defineProperty(exports, 'aws_lookoutequipment', { get: function () { return require('./aws-lookoutequipment'); } }); +Object.defineProperty(exports, 'aws_lookoutmetrics', { get: function () { return require('./aws-lookoutmetrics'); } }); +Object.defineProperty(exports, 'aws_lookoutvision', { get: function () { return require('./aws-lookoutvision'); } }); +Object.defineProperty(exports, 'aws_m2', { get: function () { return require('./aws-m2'); } }); +Object.defineProperty(exports, 'aws_macie', { get: function () { return require('./aws-macie'); } }); +Object.defineProperty(exports, 'aws_managedblockchain', { get: function () { return require('./aws-managedblockchain'); } }); +Object.defineProperty(exports, 'aws_mediaconnect', { get: function () { return require('./aws-mediaconnect'); } }); +Object.defineProperty(exports, 'aws_mediaconvert', { get: function () { return require('./aws-mediaconvert'); } }); +Object.defineProperty(exports, 'aws_medialive', { get: function () { return require('./aws-medialive'); } }); +Object.defineProperty(exports, 'aws_mediapackage', { get: function () { return require('./aws-mediapackage'); } }); +Object.defineProperty(exports, 'aws_mediastore', { get: function () { return require('./aws-mediastore'); } }); +Object.defineProperty(exports, 'aws_mediatailor', { get: function () { return require('./aws-mediatailor'); } }); +Object.defineProperty(exports, 'aws_memorydb', { get: function () { return require('./aws-memorydb'); } }); +Object.defineProperty(exports, 'aws_msk', { get: function () { return require('./aws-msk'); } }); +Object.defineProperty(exports, 'aws_mwaa', { get: function () { return require('./aws-mwaa'); } }); +Object.defineProperty(exports, 'aws_neptune', { get: function () { return require('./aws-neptune'); } }); +Object.defineProperty(exports, 'aws_networkfirewall', { get: function () { return require('./aws-networkfirewall'); } }); +Object.defineProperty(exports, 'aws_networkmanager', { get: function () { return require('./aws-networkmanager'); } }); +Object.defineProperty(exports, 'aws_nimblestudio', { get: function () { return require('./aws-nimblestudio'); } }); +Object.defineProperty(exports, 'aws_oam', { get: function () { return require('./aws-oam'); } }); +Object.defineProperty(exports, 'aws_omics', { get: function () { return require('./aws-omics'); } }); +Object.defineProperty(exports, 'aws_opensearchserverless', { get: function () { return require('./aws-opensearchserverless'); } }); +Object.defineProperty(exports, 'aws_opensearchservice', { get: function () { return require('./aws-opensearchservice'); } }); +Object.defineProperty(exports, 'aws_opsworks', { get: function () { return require('./aws-opsworks'); } }); +Object.defineProperty(exports, 'aws_opsworkscm', { get: function () { return require('./aws-opsworkscm'); } }); +Object.defineProperty(exports, 'aws_organizations', { get: function () { return require('./aws-organizations'); } }); +Object.defineProperty(exports, 'aws_panorama', { get: function () { return require('./aws-panorama'); } }); +Object.defineProperty(exports, 'aws_personalize', { get: function () { return require('./aws-personalize'); } }); +Object.defineProperty(exports, 'aws_pinpoint', { get: function () { return require('./aws-pinpoint'); } }); +Object.defineProperty(exports, 'aws_pinpointemail', { get: function () { return require('./aws-pinpointemail'); } }); +Object.defineProperty(exports, 'aws_pipes', { get: function () { return require('./aws-pipes'); } }); +Object.defineProperty(exports, 'aws_qldb', { get: function () { return require('./aws-qldb'); } }); +Object.defineProperty(exports, 'aws_quicksight', { get: function () { return require('./aws-quicksight'); } }); +Object.defineProperty(exports, 'aws_ram', { get: function () { return require('./aws-ram'); } }); +Object.defineProperty(exports, 'aws_rds', { get: function () { return require('./aws-rds'); } }); +Object.defineProperty(exports, 'aws_redshift', { get: function () { return require('./aws-redshift'); } }); +Object.defineProperty(exports, 'aws_redshiftserverless', { get: function () { return require('./aws-redshiftserverless'); } }); +Object.defineProperty(exports, 'aws_refactorspaces', { get: function () { return require('./aws-refactorspaces'); } }); +Object.defineProperty(exports, 'aws_rekognition', { get: function () { return require('./aws-rekognition'); } }); +Object.defineProperty(exports, 'aws_resiliencehub', { get: function () { return require('./aws-resiliencehub'); } }); +Object.defineProperty(exports, 'aws_resourceexplorer2', { get: function () { return require('./aws-resourceexplorer2'); } }); +Object.defineProperty(exports, 'aws_resourcegroups', { get: function () { return require('./aws-resourcegroups'); } }); +Object.defineProperty(exports, 'aws_robomaker', { get: function () { return require('./aws-robomaker'); } }); +Object.defineProperty(exports, 'aws_rolesanywhere', { get: function () { return require('./aws-rolesanywhere'); } }); +Object.defineProperty(exports, 'aws_route53', { get: function () { return require('./aws-route53'); } }); +Object.defineProperty(exports, 'aws_route53_patterns', { get: function () { return require('./aws-route53-patterns'); } }); +Object.defineProperty(exports, 'aws_route53_targets', { get: function () { return require('./aws-route53-targets'); } }); +Object.defineProperty(exports, 'aws_route53recoverycontrol', { get: function () { return require('./aws-route53recoverycontrol'); } }); +Object.defineProperty(exports, 'aws_route53recoveryreadiness', { get: function () { return require('./aws-route53recoveryreadiness'); } }); +Object.defineProperty(exports, 'aws_route53resolver', { get: function () { return require('./aws-route53resolver'); } }); +Object.defineProperty(exports, 'aws_rum', { get: function () { return require('./aws-rum'); } }); +Object.defineProperty(exports, 'aws_s3', { get: function () { return require('./aws-s3'); } }); +Object.defineProperty(exports, 'aws_s3_assets', { get: function () { return require('./aws-s3-assets'); } }); +Object.defineProperty(exports, 'aws_s3_deployment', { get: function () { return require('./aws-s3-deployment'); } }); +Object.defineProperty(exports, 'aws_s3_notifications', { get: function () { return require('./aws-s3-notifications'); } }); +Object.defineProperty(exports, 'aws_s3objectlambda', { get: function () { return require('./aws-s3objectlambda'); } }); +Object.defineProperty(exports, 'aws_s3outposts', { get: function () { return require('./aws-s3outposts'); } }); +Object.defineProperty(exports, 'aws_sagemaker', { get: function () { return require('./aws-sagemaker'); } }); +Object.defineProperty(exports, 'aws_sam', { get: function () { return require('./aws-sam'); } }); +Object.defineProperty(exports, 'aws_scheduler', { get: function () { return require('./aws-scheduler'); } }); +Object.defineProperty(exports, 'aws_sdb', { get: function () { return require('./aws-sdb'); } }); +Object.defineProperty(exports, 'aws_secretsmanager', { get: function () { return require('./aws-secretsmanager'); } }); +Object.defineProperty(exports, 'aws_securityhub', { get: function () { return require('./aws-securityhub'); } }); +Object.defineProperty(exports, 'aws_servicecatalog', { get: function () { return require('./aws-servicecatalog'); } }); +Object.defineProperty(exports, 'aws_servicecatalogappregistry', { get: function () { return require('./aws-servicecatalogappregistry'); } }); +Object.defineProperty(exports, 'aws_servicediscovery', { get: function () { return require('./aws-servicediscovery'); } }); +Object.defineProperty(exports, 'aws_ses', { get: function () { return require('./aws-ses'); } }); +Object.defineProperty(exports, 'aws_ses_actions', { get: function () { return require('./aws-ses-actions'); } }); +Object.defineProperty(exports, 'aws_signer', { get: function () { return require('./aws-signer'); } }); +Object.defineProperty(exports, 'aws_simspaceweaver', { get: function () { return require('./aws-simspaceweaver'); } }); +Object.defineProperty(exports, 'aws_sns', { get: function () { return require('./aws-sns'); } }); +Object.defineProperty(exports, 'aws_sns_subscriptions', { get: function () { return require('./aws-sns-subscriptions'); } }); +Object.defineProperty(exports, 'aws_sqs', { get: function () { return require('./aws-sqs'); } }); +Object.defineProperty(exports, 'aws_ssm', { get: function () { return require('./aws-ssm'); } }); +Object.defineProperty(exports, 'aws_ssmcontacts', { get: function () { return require('./aws-ssmcontacts'); } }); +Object.defineProperty(exports, 'aws_ssmincidents', { get: function () { return require('./aws-ssmincidents'); } }); +Object.defineProperty(exports, 'aws_sso', { get: function () { return require('./aws-sso'); } }); +Object.defineProperty(exports, 'aws_stepfunctions', { get: function () { return require('./aws-stepfunctions'); } }); +Object.defineProperty(exports, 'aws_stepfunctions_tasks', { get: function () { return require('./aws-stepfunctions-tasks'); } }); +Object.defineProperty(exports, 'aws_supportapp', { get: function () { return require('./aws-supportapp'); } }); +Object.defineProperty(exports, 'aws_synthetics', { get: function () { return require('./aws-synthetics'); } }); +Object.defineProperty(exports, 'aws_systemsmanagersap', { get: function () { return require('./aws-systemsmanagersap'); } }); +Object.defineProperty(exports, 'aws_timestream', { get: function () { return require('./aws-timestream'); } }); +Object.defineProperty(exports, 'aws_transfer', { get: function () { return require('./aws-transfer'); } }); +Object.defineProperty(exports, 'aws_voiceid', { get: function () { return require('./aws-voiceid'); } }); +Object.defineProperty(exports, 'aws_vpclattice', { get: function () { return require('./aws-vpclattice'); } }); +Object.defineProperty(exports, 'aws_waf', { get: function () { return require('./aws-waf'); } }); +Object.defineProperty(exports, 'aws_wafregional', { get: function () { return require('./aws-wafregional'); } }); +Object.defineProperty(exports, 'aws_wafv2', { get: function () { return require('./aws-wafv2'); } }); +Object.defineProperty(exports, 'aws_wisdom', { get: function () { return require('./aws-wisdom'); } }); +Object.defineProperty(exports, 'aws_workspaces', { get: function () { return require('./aws-workspaces'); } }); +Object.defineProperty(exports, 'aws_xray', { get: function () { return require('./aws-xray'); } }); +Object.defineProperty(exports, 'cloud_assembly_schema', { get: function () { return require('./cloud-assembly-schema'); } }); +Object.defineProperty(exports, 'cloudformation_include', { get: function () { return require('./cloudformation-include'); } }); +Object.defineProperty(exports, 'custom_resources', { get: function () { return require('./custom-resources'); } }); +Object.defineProperty(exports, 'cx_api', { get: function () { return require('./cx-api'); } }); +Object.defineProperty(exports, 'lambda_layer_awscli', { get: function () { return require('./lambda-layer-awscli'); } }); +Object.defineProperty(exports, 'lambda_layer_kubectl', { get: function () { return require('./lambda-layer-kubectl'); } }); +Object.defineProperty(exports, 'lambda_layer_node_proxy_agent', { get: function () { return require('./lambda-layer-node-proxy-agent'); } }); +Object.defineProperty(exports, 'pipelines', { get: function () { return require('./pipelines'); } }); +Object.defineProperty(exports, 'region_info', { get: function () { return require('./region-info'); } }); +Object.defineProperty(exports, 'triggers', { get: function () { return require('./triggers'); } }); \ No newline at end of file diff --git a/packages/aws-cdk-lib/package.json b/packages/aws-cdk-lib/package.json index 55cc031ea3c92..fee64f316e61d 100644 --- a/packages/aws-cdk-lib/package.json +++ b/packages/aws-cdk-lib/package.json @@ -20,10 +20,10 @@ "stability": "stable", "maturity": "stable", "scripts": { - "gen": "ubergen", + "gen": "ts-node scripts/gen.ts", "build": "cdk-build", "lint": "cdk-lint", - "test": "echo done", + "test": "jest --detectOpenHandles", "package": "cdk-package", "pkglint": "pkglint -f", "build+test": "yarn build && yarn test", @@ -46,9 +46,15 @@ "stripDeprecated": true, "compressAssembly": true, "post": [ - "node ./scripts/verify-imports-resolve-same.js", - "node ./scripts/verify-imports-shielded.js", - "/bin/bash ./scripts/minify-sources.sh" + "ts-node ./scripts/verify-imports-resolve-same.ts", + "ts-node ./scripts/verify-imports-shielded.ts" + ], + "pre": [ + "npx ts-node region-info/build-tools/generate-static-data.ts", + "node aws-events-targets/build-tools/gen.js", + "(cp -f $(node -p 'require.resolve(\"aws-sdk/apis/metadata.json\")') custom-resources/lib/aws-custom-resource/sdk-api-metadata.json && rm -rf custom-resources/test/aws-custom-resource/cdk.out)", + "(rm -rf core/test/fs/fixtures && cd core/test/fs && tar -xzf fixtures.tar.gz)", + "(rm -rf assets/test/fs/fixtures && cd assets/test/fs && tar -xzvf fixtures.tar.gz)" ] }, "cdk-package": { @@ -68,7 +74,7 @@ }, "jsii": { "excludeTypescript": [ - "build-tools/*" + "scripts" ], "outdir": "dist", "targets": { @@ -129,276 +135,20 @@ "yaml": "1.10.2" }, "devDependencies": { - "@aws-cdk/alexa-ask": "0.0.0", - "@aws-cdk/assertions": "0.0.0", - "@aws-cdk/assets": "0.0.0", - "@aws-cdk/aws-accessanalyzer": "0.0.0", - "@aws-cdk/aws-acmpca": "0.0.0", - "@aws-cdk/aws-amazonmq": "0.0.0", - "@aws-cdk/aws-amplify": "0.0.0", - "@aws-cdk/aws-amplifyuibuilder": "0.0.0", - "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-apigatewayv2-authorizers": "0.0.0", - "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", - "@aws-cdk/aws-appconfig": "0.0.0", - "@aws-cdk/aws-appflow": "0.0.0", - "@aws-cdk/aws-appintegrations": "0.0.0", - "@aws-cdk/aws-applicationautoscaling": "0.0.0", - "@aws-cdk/aws-applicationinsights": "0.0.0", - "@aws-cdk/aws-appmesh": "0.0.0", - "@aws-cdk/aws-apprunner": "0.0.0", - "@aws-cdk/aws-appstream": "0.0.0", - "@aws-cdk/aws-appsync": "0.0.0", - "@aws-cdk/aws-aps": "0.0.0", - "@aws-cdk/aws-athena": "0.0.0", - "@aws-cdk/aws-auditmanager": "0.0.0", - "@aws-cdk/aws-autoscaling": "0.0.0", - "@aws-cdk/aws-autoscaling-common": "0.0.0", - "@aws-cdk/aws-autoscaling-hooktargets": "0.0.0", - "@aws-cdk/aws-autoscalingplans": "0.0.0", - "@aws-cdk/aws-backup": "0.0.0", - "@aws-cdk/aws-batch": "0.0.0", - "@aws-cdk/aws-billingconductor": "0.0.0", - "@aws-cdk/aws-budgets": "0.0.0", - "@aws-cdk/aws-cassandra": "0.0.0", - "@aws-cdk/aws-ce": "0.0.0", - "@aws-cdk/aws-certificatemanager": "0.0.0", - "@aws-cdk/aws-chatbot": "0.0.0", - "@aws-cdk/aws-cloud9": "0.0.0", - "@aws-cdk/aws-cloudformation": "0.0.0", - "@aws-cdk/aws-cloudfront": "0.0.0", - "@aws-cdk/aws-cloudfront-origins": "0.0.0", - "@aws-cdk/aws-cloudtrail": "0.0.0", - "@aws-cdk/aws-cloudwatch": "0.0.0", - "@aws-cdk/aws-cloudwatch-actions": "0.0.0", - "@aws-cdk/aws-codeartifact": "0.0.0", - "@aws-cdk/aws-codebuild": "0.0.0", - "@aws-cdk/aws-codecommit": "0.0.0", - "@aws-cdk/aws-codedeploy": "0.0.0", - "@aws-cdk/aws-codeguruprofiler": "0.0.0", - "@aws-cdk/aws-codegurureviewer": "0.0.0", - "@aws-cdk/aws-codepipeline": "0.0.0", - "@aws-cdk/aws-codepipeline-actions": "0.0.0", - "@aws-cdk/aws-codestar": "0.0.0", - "@aws-cdk/aws-codestarconnections": "0.0.0", - "@aws-cdk/aws-codestarnotifications": "0.0.0", - "@aws-cdk/aws-cognito": "0.0.0", - "@aws-cdk/aws-cognito-identitypool": "0.0.0", - "@aws-cdk/aws-comprehend": "0.0.0", - "@aws-cdk/aws-config": "0.0.0", - "@aws-cdk/aws-connect": "0.0.0", - "@aws-cdk/aws-connectcampaigns": "0.0.0", - "@aws-cdk/aws-controltower": "0.0.0", - "@aws-cdk/aws-cur": "0.0.0", - "@aws-cdk/aws-customerprofiles": "0.0.0", - "@aws-cdk/aws-databrew": "0.0.0", - "@aws-cdk/aws-datapipeline": "0.0.0", - "@aws-cdk/aws-datasync": "0.0.0", - "@aws-cdk/aws-dax": "0.0.0", - "@aws-cdk/aws-detective": "0.0.0", - "@aws-cdk/aws-devicefarm": "0.0.0", - "@aws-cdk/aws-devopsguru": "0.0.0", - "@aws-cdk/aws-directoryservice": "0.0.0", - "@aws-cdk/aws-dlm": "0.0.0", - "@aws-cdk/aws-dms": "0.0.0", - "@aws-cdk/aws-docdb": "0.0.0", - "@aws-cdk/aws-docdbelastic": "0.0.0", - "@aws-cdk/aws-dynamodb": "0.0.0", - "@aws-cdk/aws-ec2": "0.0.0", - "@aws-cdk/aws-ecr": "0.0.0", - "@aws-cdk/aws-ecr-assets": "0.0.0", - "@aws-cdk/aws-ecs": "0.0.0", - "@aws-cdk/aws-ecs-patterns": "0.0.0", - "@aws-cdk/aws-efs": "0.0.0", - "@aws-cdk/aws-eks": "0.0.0", - "@aws-cdk/aws-elasticache": "0.0.0", - "@aws-cdk/aws-elasticbeanstalk": "0.0.0", - "@aws-cdk/aws-elasticloadbalancing": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2-actions": "0.0.0", - "@aws-cdk/aws-elasticloadbalancingv2-targets": "0.0.0", - "@aws-cdk/aws-elasticsearch": "0.0.0", - "@aws-cdk/aws-emr": "0.0.0", - "@aws-cdk/aws-emrcontainers": "0.0.0", - "@aws-cdk/aws-emrserverless": "0.0.0", - "@aws-cdk/aws-events": "0.0.0", - "@aws-cdk/aws-events-targets": "0.0.0", - "@aws-cdk/aws-eventschemas": "0.0.0", - "@aws-cdk/aws-evidently": "0.0.0", - "@aws-cdk/aws-finspace": "0.0.0", - "@aws-cdk/aws-fis": "0.0.0", - "@aws-cdk/aws-fms": "0.0.0", - "@aws-cdk/aws-forecast": "0.0.0", - "@aws-cdk/aws-frauddetector": "0.0.0", - "@aws-cdk/aws-fsx": "0.0.0", - "@aws-cdk/aws-gamelift": "0.0.0", - "@aws-cdk/aws-globalaccelerator": "0.0.0", - "@aws-cdk/aws-globalaccelerator-endpoints": "0.0.0", - "@aws-cdk/aws-glue": "0.0.0", - "@aws-cdk/aws-grafana": "0.0.0", - "@aws-cdk/aws-greengrass": "0.0.0", - "@aws-cdk/aws-greengrassv2": "0.0.0", - "@aws-cdk/aws-groundstation": "0.0.0", - "@aws-cdk/aws-guardduty": "0.0.0", - "@aws-cdk/aws-healthlake": "0.0.0", - "@aws-cdk/aws-iam": "0.0.0", - "@aws-cdk/aws-identitystore": "0.0.0", - "@aws-cdk/aws-imagebuilder": "0.0.0", - "@aws-cdk/aws-inspector": "0.0.0", - "@aws-cdk/aws-inspectorv2": "0.0.0", - "@aws-cdk/aws-internetmonitor": "0.0.0", - "@aws-cdk/aws-iot": "0.0.0", - "@aws-cdk/aws-iot-actions": "0.0.0", - "@aws-cdk/aws-iot1click": "0.0.0", - "@aws-cdk/aws-iotanalytics": "0.0.0", - "@aws-cdk/aws-iotcoredeviceadvisor": "0.0.0", - "@aws-cdk/aws-iotevents": "0.0.0", - "@aws-cdk/aws-iotevents-actions": "0.0.0", - "@aws-cdk/aws-iotfleethub": "0.0.0", - "@aws-cdk/aws-iotfleetwise": "0.0.0", - "@aws-cdk/aws-iotsitewise": "0.0.0", - "@aws-cdk/aws-iotthingsgraph": "0.0.0", - "@aws-cdk/aws-iottwinmaker": "0.0.0", - "@aws-cdk/aws-iotwireless": "0.0.0", - "@aws-cdk/aws-ivs": "0.0.0", - "@aws-cdk/aws-ivschat": "0.0.0", - "@aws-cdk/aws-kafkaconnect": "0.0.0", - "@aws-cdk/aws-kendra": "0.0.0", - "@aws-cdk/aws-kendraranking": "0.0.0", - "@aws-cdk/aws-kinesis": "0.0.0", - "@aws-cdk/aws-kinesisanalytics": "0.0.0", - "@aws-cdk/aws-kinesisanalytics-flink": "0.0.0", - "@aws-cdk/aws-kinesisanalyticsv2": "0.0.0", - "@aws-cdk/aws-kinesisfirehose": "0.0.0", - "@aws-cdk/aws-kinesisfirehose-destinations": "0.0.0", - "@aws-cdk/aws-kinesisvideo": "0.0.0", - "@aws-cdk/aws-kms": "0.0.0", - "@aws-cdk/aws-lakeformation": "0.0.0", - "@aws-cdk/aws-lambda": "0.0.0", - "@aws-cdk/aws-lambda-destinations": "0.0.0", - "@aws-cdk/aws-lambda-event-sources": "0.0.0", - "@aws-cdk/aws-lambda-go": "0.0.0", - "@aws-cdk/aws-lambda-nodejs": "0.0.0", - "@aws-cdk/aws-lambda-python": "0.0.0", - "@aws-cdk/aws-lex": "0.0.0", - "@aws-cdk/aws-licensemanager": "0.0.0", - "@aws-cdk/aws-lightsail": "0.0.0", - "@aws-cdk/aws-location": "0.0.0", - "@aws-cdk/aws-logs": "0.0.0", - "@aws-cdk/aws-logs-destinations": "0.0.0", - "@aws-cdk/aws-lookoutequipment": "0.0.0", - "@aws-cdk/aws-lookoutmetrics": "0.0.0", - "@aws-cdk/aws-lookoutvision": "0.0.0", - "@aws-cdk/aws-m2": "0.0.0", - "@aws-cdk/aws-macie": "0.0.0", - "@aws-cdk/aws-managedblockchain": "0.0.0", - "@aws-cdk/aws-mediaconnect": "0.0.0", - "@aws-cdk/aws-mediaconvert": "0.0.0", - "@aws-cdk/aws-medialive": "0.0.0", - "@aws-cdk/aws-mediapackage": "0.0.0", - "@aws-cdk/aws-mediastore": "0.0.0", - "@aws-cdk/aws-mediatailor": "0.0.0", - "@aws-cdk/aws-memorydb": "0.0.0", - "@aws-cdk/aws-msk": "0.0.0", - "@aws-cdk/aws-mwaa": "0.0.0", - "@aws-cdk/aws-neptune": "0.0.0", - "@aws-cdk/aws-networkfirewall": "0.0.0", - "@aws-cdk/aws-networkmanager": "0.0.0", - "@aws-cdk/aws-nimblestudio": "0.0.0", - "@aws-cdk/aws-oam": "0.0.0", - "@aws-cdk/aws-omics": "0.0.0", - "@aws-cdk/aws-opensearchserverless": "0.0.0", - "@aws-cdk/aws-opensearchservice": "0.0.0", - "@aws-cdk/aws-opsworks": "0.0.0", - "@aws-cdk/aws-opsworkscm": "0.0.0", - "@aws-cdk/aws-organizations": "0.0.0", - "@aws-cdk/aws-panorama": "0.0.0", - "@aws-cdk/aws-personalize": "0.0.0", - "@aws-cdk/aws-pinpoint": "0.0.0", - "@aws-cdk/aws-pinpointemail": "0.0.0", - "@aws-cdk/aws-pipes": "0.0.0", - "@aws-cdk/aws-qldb": "0.0.0", - "@aws-cdk/aws-quicksight": "0.0.0", - "@aws-cdk/aws-ram": "0.0.0", - "@aws-cdk/aws-rds": "0.0.0", - "@aws-cdk/aws-redshift": "0.0.0", - "@aws-cdk/aws-redshiftserverless": "0.0.0", - "@aws-cdk/aws-refactorspaces": "0.0.0", - "@aws-cdk/aws-rekognition": "0.0.0", - "@aws-cdk/aws-resiliencehub": "0.0.0", - "@aws-cdk/aws-resourceexplorer2": "0.0.0", - "@aws-cdk/aws-resourcegroups": "0.0.0", - "@aws-cdk/aws-robomaker": "0.0.0", - "@aws-cdk/aws-rolesanywhere": "0.0.0", - "@aws-cdk/aws-route53": "0.0.0", - "@aws-cdk/aws-route53-patterns": "0.0.0", - "@aws-cdk/aws-route53-targets": "0.0.0", - "@aws-cdk/aws-route53recoverycontrol": "0.0.0", - "@aws-cdk/aws-route53recoveryreadiness": "0.0.0", - "@aws-cdk/aws-route53resolver": "0.0.0", - "@aws-cdk/aws-rum": "0.0.0", - "@aws-cdk/aws-s3": "0.0.0", - "@aws-cdk/aws-s3-assets": "0.0.0", - "@aws-cdk/aws-s3-deployment": "0.0.0", - "@aws-cdk/aws-s3-notifications": "0.0.0", - "@aws-cdk/aws-s3objectlambda": "0.0.0", - "@aws-cdk/aws-s3outposts": "0.0.0", - "@aws-cdk/aws-sagemaker": "0.0.0", - "@aws-cdk/aws-sam": "0.0.0", - "@aws-cdk/aws-scheduler": "0.0.0", - "@aws-cdk/aws-sdb": "0.0.0", - "@aws-cdk/aws-secretsmanager": "0.0.0", - "@aws-cdk/aws-securityhub": "0.0.0", - "@aws-cdk/aws-servicecatalog": "0.0.0", - "@aws-cdk/aws-servicecatalogappregistry": "0.0.0", - "@aws-cdk/aws-servicediscovery": "0.0.0", - "@aws-cdk/aws-ses": "0.0.0", - "@aws-cdk/aws-ses-actions": "0.0.0", - "@aws-cdk/aws-signer": "0.0.0", - "@aws-cdk/aws-simspaceweaver": "0.0.0", - "@aws-cdk/aws-sns": "0.0.0", - "@aws-cdk/aws-sns-subscriptions": "0.0.0", - "@aws-cdk/aws-sqs": "0.0.0", - "@aws-cdk/aws-ssm": "0.0.0", - "@aws-cdk/aws-ssmcontacts": "0.0.0", - "@aws-cdk/aws-ssmincidents": "0.0.0", - "@aws-cdk/aws-sso": "0.0.0", - "@aws-cdk/aws-stepfunctions": "0.0.0", - "@aws-cdk/aws-stepfunctions-tasks": "0.0.0", - "@aws-cdk/aws-supportapp": "0.0.0", - "@aws-cdk/aws-synthetics": "0.0.0", - "@aws-cdk/aws-systemsmanagersap": "0.0.0", - "@aws-cdk/aws-timestream": "0.0.0", - "@aws-cdk/aws-transfer": "0.0.0", - "@aws-cdk/aws-voiceid": "0.0.0", - "@aws-cdk/aws-vpclattice": "0.0.0", - "@aws-cdk/aws-waf": "0.0.0", - "@aws-cdk/aws-wafregional": "0.0.0", - "@aws-cdk/aws-wafv2": "0.0.0", - "@aws-cdk/aws-wisdom": "0.0.0", - "@aws-cdk/aws-workspaces": "0.0.0", - "@aws-cdk/aws-xray": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/cloud-assembly-schema": "0.0.0", - "@aws-cdk/cloudformation-include": "0.0.0", - "@aws-cdk/core": "0.0.0", - "@aws-cdk/custom-resources": "0.0.0", - "@aws-cdk/cx-api": "0.0.0", - "@aws-cdk/integ-tests": "0.0.0", - "@aws-cdk/lambda-layer-awscli": "0.0.0", - "@aws-cdk/lambda-layer-kubectl": "0.0.0", - "@aws-cdk/lambda-layer-node-proxy-agent": "0.0.0", - "@aws-cdk/pipelines": "0.0.0", "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/region-info": "0.0.0", - "@aws-cdk/triggers": "0.0.0", - "@aws-cdk/ubergen": "0.0.0", "constructs": "^10.0.0", "esbuild": "^0.17.11", "fs-extra": "^9.1.0", - "ts-node": "^9.1.1", - "typescript": "~4.9.5" + "ts-node": "^10.9.1", + "typescript": "~4.9.5", + "@aws-cdk/cfn2ts": "0.0.0", + "lambda-tester": "^3.6.0", + "@types/aws-lambda": "^8.10.111", + "@types/jest": "^27.5.2", + "@types/lodash": "^4.14.191", + "@types/punycode": "^2.1.0", + "typescript-json-schema": "^0.55.0" }, "peerDependencies": { "constructs": "^10.0.0" @@ -418,7 +168,8 @@ }, "ubergen": { "exclude": true, - "excludeExperimentalModules": true + "excludeExperimentalModules": true, + "libRoot": "/root/remodel/packages/aws-cdk-lib" }, "exports": { ".": { @@ -685,7 +436,11 @@ "./pipelines/.warnings.jsii.js": "./pipelines/.warnings.jsii.js", "./pipelines/lib/helpers-internal": "./pipelines/lib/helpers-internal/index.js", "./region-info": "./region-info/index.js", - "./triggers": "./triggers/index.js" + "./triggers": "./triggers/index.js", + "./aws-kinesisfirehose/lib/kinesisfirehose-canned-metrics.generated": "./aws-kinesisfirehose/lib/kinesisfirehose-canned-metrics.generated.js", + "./aws-synthetics/lib/synthetics-canned-metrics.generated": "./aws-synthetics/lib/synthetics-canned-metrics.generated.js", + "./aws-gamelift/lib/gamelift-canned-metrics.generated": "./aws-gamelift/lib/gamelift-canned-metrics.generated.js", + "./core": "./core/index.js" }, "preferredCdkCliVersion": "2", "publishConfig": { diff --git a/packages/aws-cdk-lib/pipelines/.jsiirc.json b/packages/aws-cdk-lib/pipelines/.jsiirc.json new file mode 100644 index 0000000000000..ab6e6f2b3ed85 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.pipelines" + }, + "dotnet": { + "namespace": "Amazon.CDK.Pipelines" + }, + "python": { + "module": "aws_cdk.pipelines" + } + } +} diff --git a/packages/@aws-cdk/pipelines/ORIGINAL_API.md b/packages/aws-cdk-lib/pipelines/ORIGINAL_API.md similarity index 100% rename from packages/@aws-cdk/pipelines/ORIGINAL_API.md rename to packages/aws-cdk-lib/pipelines/ORIGINAL_API.md diff --git a/packages/aws-cdk-lib/pipelines/README.md b/packages/aws-cdk-lib/pipelines/README.md new file mode 100644 index 0000000000000..a4ee3f5ec8c00 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/README.md @@ -0,0 +1,1742 @@ +# CDK Pipelines + + +A construct library for painless Continuous Delivery of CDK applications. + +CDK Pipelines is an *opinionated construct library*. It is purpose-built to +deploy one or more copies of your CDK applications using CloudFormation with a +minimal amount of effort on your part. It is *not* intended to support arbitrary +deployment pipelines, and very specifically it is not built to use CodeDeploy to +deploy applications to instances, or deploy your custom-built ECR images to an ECS +cluster directly: use CDK file assets with CloudFormation Init for instances, or +CDK container assets for ECS clusters instead. + +Give the CDK Pipelines way of doing things a shot first: you might find it does +everything you need. If you want or need more control, we recommend you drop +down to using the `aws-codepipeline` construct library directly. + +> This module contains two sets of APIs: an **original** and a **modern** version of +CDK Pipelines. The *modern* API has been updated to be easier to work with and +customize, and will be the preferred API going forward. The *original* version +of the API is still available for backwards compatibility, but we recommend migrating +to the new version if possible. +> +> Compared to the original API, the modern API: has more sensible defaults; is +> more flexible; supports parallel deployments; supports multiple synth inputs; +> allows more control of CodeBuild project generation; supports deployment +> engines other than CodePipeline. +> +> The README for the original API, as well as a migration guide, can be found in [our GitHub repository](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/pipelines/ORIGINAL_API.md). + +## At a glance + +Deploying your application continuously starts by defining a +`MyApplicationStage`, a subclass of `Stage` that contains the stacks that make +up a single copy of your application. + +You then define a `Pipeline`, instantiate as many instances of +`MyApplicationStage` as you want for your test and production environments, with +different parameters for each, and calling `pipeline.addStage()` for each of +them. You can deploy to the same account and Region, or to a different one, +with the same amount of code. The *CDK Pipelines* library takes care of the +details. + +CDK Pipelines supports multiple *deployment engines* (see +[Using a different deployment engine](#using-a-different-deployment-engine)), +and comes with a deployment engine that deploys CDK apps using AWS CodePipeline. +To use the CodePipeline engine, define a `CodePipeline` construct. The following +example creates a CodePipeline that deploys an application from GitHub: + +```ts +/** The stacks for our app are minimally defined here. The internals of these + * stacks aren't important, except that DatabaseStack exposes an attribute + * "table" for a database table it defines, and ComputeStack accepts a reference + * to this table in its properties. + */ +class DatabaseStack extends Stack { + public readonly table: dynamodb.Table; + + constructor(scope: Construct, id: string) { + super(scope, id); + this.table = new dynamodb.Table(this, 'Table', { + partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING } + }); + } +} + +interface ComputeProps { + readonly table: dynamodb.Table; +} + +class ComputeStack extends Stack { + constructor(scope: Construct, id: string, props: ComputeProps) { + super(scope, id); + } +} + +/** + * Stack to hold the pipeline + */ +class MyPipelineStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + // Use a connection created using the AWS console to authenticate to GitHub + // Other sources are available. + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), + }); + + // 'MyApplication' is defined below. Call `addStage` as many times as + // necessary with any account and region (may be different from the + // pipeline's). + pipeline.addStage(new MyApplication(this, 'Prod', { + env: { + account: '123456789012', + region: 'eu-west-1', + }, + })); + } +} + +/** + * Your application + * + * May consist of one or more Stacks (here, two) + * + * By declaring our DatabaseStack and our ComputeStack inside a Stage, + * we make sure they are deployed together, or not at all. + */ +class MyApplication extends Stage { + constructor(scope: Construct, id: string, props?: StageProps) { + super(scope, id, props); + + const dbStack = new DatabaseStack(this, 'Database'); + new ComputeStack(this, 'Compute', { + table: dbStack.table, + }); + } +} + +// In your main file +new MyPipelineStack(this, 'PipelineStack', { + env: { + account: '123456789012', + region: 'eu-west-1', + } +}); +``` + +The pipeline is **self-mutating**, which means that if you add new +application stages in the source code, or new stacks to `MyApplication`, the +pipeline will automatically reconfigure itself to deploy those new stages and +stacks. + +(Note that you have to *bootstrap* all environments before the above code +will work, and switch on "Modern synthesis" if you are using +CDKv1. See the section **CDK Environment Bootstrapping** below for +more information). + +## Provisioning the pipeline + +To provision the pipeline you have defined, make sure the target environment +has been bootstrapped (see below), and then execute deploying the +`PipelineStack` *once*. Afterwards, the pipeline will keep itself up-to-date. + +> **Important**: be sure to `git commit` and `git push` before deploying the +> Pipeline stack using `cdk deploy`! +> +> The reason is that the pipeline will start deploying and self-mutating +> right away based on the sources in the repository, so the sources it finds +> in there should be the ones you want it to find. + +Run the following commands to get the pipeline going: + +```console +$ git commit -a +$ git push +$ cdk deploy PipelineStack +``` + +Administrative permissions to the account are only necessary up until +this point. We recommend you remove access to these credentials after doing this. + +### Working on the pipeline + +The self-mutation feature of the Pipeline might at times get in the way +of the pipeline development workflow. Each change to the pipeline must be pushed +to git, otherwise, after the pipeline was updated using `cdk deploy`, it will +automatically revert to the state found in git. + +To make the development more convenient, the self-mutation feature can be turned +off temporarily, by passing `selfMutation: false` property, example: + +```ts +// Modern API +const modernPipeline = new pipelines.CodePipeline(this, 'Pipeline', { + selfMutation: false, + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), +}); + +// Original API +const cloudAssemblyArtifact = new codepipeline.Artifact(); +const originalPipeline = new pipelines.CdkPipeline(this, 'Pipeline', { + selfMutating: false, + cloudAssemblyArtifact, +}); +``` + +## Defining the pipeline + +This section of the documentation describes the AWS CodePipeline engine, +which comes with this library. If you want to use a different deployment +engine, read the section +[Using a different deployment engine](#using-a-different-deployment-engine) below. + +### Synth and sources + +To define a pipeline, instantiate a `CodePipeline` construct from the +`@aws-cdk/pipelines` module. It takes one argument, a `synth` step, which is +expected to produce the CDK Cloud Assembly as its single output (the contents of +the `cdk.out` directory after running `cdk synth`). "Steps" are arbitrary +actions in the pipeline, typically used to run scripts or commands. + +For the synth, use a `ShellStep` and specify the commands necessary to install +dependencies, the CDK CLI, build your project and run `cdk synth`; the specific +commands required will depend on the programming language you are using. For a +typical NPM-based project, the synth will look like this: + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), +}); +``` + +The pipeline assumes that your `ShellStep` will produce a `cdk.out` +directory in the root, containing the CDK cloud assembly. If your +CDK project lives in a subdirectory, be sure to adjust the +`primaryOutputDirectory` to match: + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: [ + 'cd mysubdir', + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + primaryOutputDirectory: 'mysubdir/cdk.out', + }), +}); +``` + +The underlying `@aws-cdk/aws-codepipeline.Pipeline` construct will be produced +when `app.synth()` is called. You can also force it to be produced +earlier by calling `pipeline.buildPipeline()`. After you've called +that method, you can inspect the constructs that were produced by +accessing the properties of the `pipeline` object. + +#### Commands for other languages and package managers + +The commands you pass to `new ShellStep` will be very similar to the commands +you run on your own workstation to install dependencies and synth your CDK +project. Here are some (non-exhaustive) examples for what those commands might +look like in a number of different situations. + +For Yarn, the install commands are different: + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: [ + 'yarn install --frozen-lockfile', + 'yarn build', + 'npx cdk synth', + ], + }) +}); +``` + +For Python projects, remember to install the CDK CLI globally (as +there is no `package.json` to automatically install it for you): + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: [ + 'pip install -r requirements.txt', + 'npm install -g aws-cdk', + 'cdk synth', + ], + }) +}); +``` + +For Java projects, remember to install the CDK CLI globally (as +there is no `package.json` to automatically install it for you), +and the Maven compilation step is automatically executed for you +as you run `cdk synth`: + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: [ + 'npm install -g aws-cdk', + 'cdk synth', + ], + }) +}); +``` + +You can adapt these examples to your own situation. + +#### Migrating from buildspec.yml files + +You may currently have the build instructions for your CodeBuild Projects in a +`buildspec.yml` file in your source repository. In addition to your build +commands, the CodeBuild Project's buildspec also controls some information that +CDK Pipelines manages for you, like artifact identifiers, input artifact +locations, Docker authorization, and exported variables. + +Since there is no way in general for CDK Pipelines to modify the file in your +resource repository, CDK Pipelines configures the BuildSpec directly on the +CodeBuild Project, instead of loading it from the `buildspec.yml` file. +This requires a pipeline self-mutation to update. + +To avoid this, put your build instructions in a separate script, for example +`build.sh`, and call that script from the build `commands` array: + +```ts +declare const source: pipelines.IFileSetProducer; + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: [ + // Abstract over doing the build + './build.sh', + ], + }) +}); +``` + +Doing so keeps your exact build instructions in sync with your source code in +the source repository where it belongs, and provides a convenient build script +for developers at the same time. + +#### CodePipeline Sources + +In CodePipeline, *Sources* define where the source of your application lives. +When a change to the source is detected, the pipeline will start executing. +Source objects can be created by factory methods on the `CodePipelineSource` class: + +##### GitHub, GitHub Enterprise, BitBucket using a connection + +The recommended way of connecting to GitHub or BitBucket is by using a *connection*. +You will first use the AWS Console to authenticate to the source control +provider, and then use the connection ARN in your pipeline definition: + +```ts +pipelines.CodePipelineSource.connection('org/repo', 'branch', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', +}); +``` + +##### GitHub using OAuth + +You can also authenticate to GitHub using a personal access token. This expects +that you've created a personal access token and stored it in Secrets Manager. +By default, the source object will look for a secret named **github-token**, but +you can change the name. The token should have the **repo** and **admin:repo_hook** +scopes. + +```ts +pipelines.CodePipelineSource.gitHub('org/repo', 'branch', { + // This is optional + authentication: cdk.SecretValue.secretsManager('my-token'), +}); +``` + +##### CodeCommit + +You can use a CodeCommit repository as the source. Either create or import +that the CodeCommit repository and then use `CodePipelineSource.codeCommit` +to reference it: + +```ts +const repository = codecommit.Repository.fromRepositoryName(this, 'Repository', 'my-repository'); +pipelines.CodePipelineSource.codeCommit(repository, 'main'); +``` + +##### S3 + +You can use a zip file in S3 as the source of the pipeline. The pipeline will be +triggered every time the file in S3 is changed: + +```ts +const bucket = s3.Bucket.fromBucketName(this, 'Bucket', 'my-bucket'); +pipelines.CodePipelineSource.s3(bucket, 'my/source.zip'); +``` + +##### ECR + +You can use a Docker image in ECR as the source of the pipeline. The pipeline will be +triggered every time an image is pushed to ECR: + +```ts +const repository = new ecr.Repository(this, 'Repository'); +pipelines.CodePipelineSource.ecr(repository); +``` + +#### Additional inputs + +`ShellStep` allows passing in more than one input: additional +inputs will be placed in the directories you specify. Any step that produces an +output file set can be used as an input, such as a `CodePipelineSource`, but +also other `ShellStep`: + +```ts +const prebuild = new pipelines.ShellStep('Prebuild', { + input: pipelines.CodePipelineSource.gitHub('myorg/repo1', 'main'), + primaryOutputDirectory: './build', + commands: ['./build.sh'], +}); + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.gitHub('myorg/repo2', 'main'), + additionalInputs: { + 'subdir': pipelines.CodePipelineSource.gitHub('myorg/repo3', 'main'), + '../siblingdir': prebuild, + }, + + commands: ['./build.sh'], + }) +}); +``` + +### CDK application deployments + +After you have defined the pipeline and the `synth` step, you can add one or +more CDK `Stages` which will be deployed to their target environments. To do +so, call `pipeline.addStage()` on the Stage object: + +```ts +declare const pipeline: pipelines.CodePipeline; +// Do this as many times as necessary with any account and region +// Account and region may different from the pipeline's. +pipeline.addStage(new MyApplicationStage(this, 'Prod', { + env: { + account: '123456789012', + region: 'eu-west-1', + } +})); +``` + +CDK Pipelines will automatically discover all `Stacks` in the given `Stage` +object, determine their dependency order, and add appropriate actions to the +pipeline to publish the assets referenced in those stacks and deploy the stacks +in the right order. + +If the `Stacks` are targeted at an environment in a different AWS account or +Region and that environment has been +[bootstrapped](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html) +, CDK Pipelines will transparently make sure the IAM roles are set up +correctly and any requisite replication Buckets are created. + +#### Deploying in parallel + +By default, all applications added to CDK Pipelines by calling `addStage()` will +be deployed in sequence, one after the other. If you have a lot of stages, you can +speed up the pipeline by choosing to deploy some stages in parallel. You do this +by calling `addWave()` instead of `addStage()`: a *wave* is a set of stages that +are all deployed in parallel instead of sequentially. Waves themselves are still +deployed in sequence. For example, the following will deploy two copies of your +application to `eu-west-1` and `eu-central-1` in parallel: + +```ts +declare const pipeline: pipelines.CodePipeline; +const europeWave = pipeline.addWave('Europe'); +europeWave.addStage(new MyApplicationStage(this, 'Ireland', { + env: { region: 'eu-west-1' } +})); +europeWave.addStage(new MyApplicationStage(this, 'Germany', { + env: { region: 'eu-central-1' } +})); +``` + +#### Deploying to other accounts / encrypting the Artifact Bucket + +CDK Pipelines can transparently deploy to other Regions and other accounts +(provided those target environments have been +[*bootstrapped*](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)). +However, deploying to another account requires one additional piece of +configuration: you need to enable `crossAccountKeys: true` when creating the +pipeline. + +This will encrypt the artifact bucket(s), but incurs a cost for maintaining the +KMS key. + +You may also wish to enable automatic key rotation for the created KMS key. + +Example: + +```ts +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + // Encrypt artifacts, required for cross-account deployments + crossAccountKeys: true, + enableKeyRotation: true, // optional + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), +}); +``` + +#### Deploying without change sets + +Deployment is done by default with `CodePipeline` engine using change sets, +i.e. to first create a change set and then execute it. This allows you to inject +steps that inspect the change set and approve or reject it, but failed deployments +are not retryable and creation of the change set costs time. + +The creation of change sets can be switched off by setting `useChangeSets: false`: + +```ts +declare const synth: pipelines.ShellStep; + +class PipelineStack extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth, + + // Disable change set creation and make deployments in pipeline as single step + useChangeSets: false, + }); + } +} +``` + +### Validation + +Every `addStage()` and `addWave()` command takes additional options. As part of these options, +you can specify `pre` and `post` steps, which are arbitrary steps that run before or after +the contents of the stage or wave, respectively. You can use these to add validations like +manual or automated gates to your pipeline. We recommend putting manual approval gates in the set of `pre` steps, and automated approval gates in +the set of `post` steps. + +The following example shows both an automated approval in the form of a `ShellStep`, and +a manual approval in the form of a `ManualApprovalStep` added to the pipeline. Both must +pass in order to promote from the `PreProd` to the `Prod` environment: + +```ts +declare const pipeline: pipelines.CodePipeline; +const preprod = new MyApplicationStage(this, 'PreProd'); +const prod = new MyApplicationStage(this, 'Prod'); + +pipeline.addStage(preprod, { + post: [ + new pipelines.ShellStep('Validate Endpoint', { + commands: ['curl -Ssf https://my.webservice.com/'], + }), + ], +}); +pipeline.addStage(prod, { + pre: [ + new pipelines.ManualApprovalStep('PromoteToProd'), + ], +}); +``` + +You can also specify steps to be executed at the stack level. To achieve this, you can specify the stack and step via the `stackSteps` property: + +```ts +class MyStacksStage extends Stage { + public readonly stack1: Stack; + public readonly stack2: Stack; + + constructor(scope: Construct, id: string, props?: StageProps) { + super(scope, id, props); + this.stack1 = new Stack(this, 'stack1'); + this.stack2 = new Stack(this, 'stack2'); + } +} + +declare const pipeline: pipelines.CodePipeline; +const prod = new MyStacksStage(this, 'Prod'); + +pipeline.addStage(prod, { + stackSteps: [{ + stack: prod.stack1, + pre: [new pipelines.ManualApprovalStep('Pre-Stack Check')], // Executed before stack is prepared + changeSet: [new pipelines.ManualApprovalStep('ChangeSet Approval')], // Executed after stack is prepared but before the stack is deployed + post: [new pipelines.ManualApprovalStep('Post-Deploy Check')], // Executed after stack is deployed + }, { + stack: prod.stack2, + post: [new pipelines.ManualApprovalStep('Post-Deploy Check')], // Executed after stack is deployed + }], +}); +``` + +If you specify multiple steps, they will execute in parallel by default. You can add dependencies between them +to if you wish to specify an order. To add a dependency, call `step.addStepDependency()`: + +```ts +const firstStep = new pipelines.ManualApprovalStep('A'); +const secondStep = new pipelines.ManualApprovalStep('B'); +secondStep.addStepDependency(firstStep); +``` + +For convenience, `Step.sequence()` will take an array of steps and dependencies between adjacent steps, +so that the whole list executes in order: + +```ts +// Step A will depend on step B and step B will depend on step C +const orderedSteps = pipelines.Step.sequence([ + new pipelines.ManualApprovalStep('A'), + new pipelines.ManualApprovalStep('B'), + new pipelines.ManualApprovalStep('C'), +]); +``` + +#### Using CloudFormation Stack Outputs in approvals + +Because many CloudFormation deployments result in the generation of resources with unpredictable +names, validations have support for reading back CloudFormation Outputs after a deployment. This +makes it possible to pass (for example) the generated URL of a load balancer to the test set. + +To use Stack Outputs, expose the `CfnOutput` object you're interested in, and +pass it to `envFromCfnOutputs` of the `ShellStep`: + +```ts +class MyOutputStage extends Stage { + public readonly loadBalancerAddress: CfnOutput; + + constructor(scope: Construct, id: string, props?: StageProps) { + super(scope, id, props); + this.loadBalancerAddress = new CfnOutput(this, 'Output', {value: 'value'}); + } +} + +const lbApp = new MyOutputStage(this, 'MyApp'); +declare const pipeline: pipelines.CodePipeline; +pipeline.addStage(lbApp, { + post: [ + new pipelines.ShellStep('HitEndpoint', { + envFromCfnOutputs: { + // Make the load balancer address available as $URL inside the commands + URL: lbApp.loadBalancerAddress, + }, + commands: ['curl -Ssf $URL'], + }), + ], +}); +``` + +#### Running scripts compiled during the synth step + +As part of a validation, you probably want to run a test suite that's more +elaborate than what can be expressed in a couple of lines of shell script. +You can bring additional files into the shell script validation by supplying +the `input` or `additionalInputs` property of `ShellStep`. The input can +be produced by the `Synth` step, or come from a source or any other build +step. + +Here's an example that captures an additional output directory in the synth +step and runs tests from there: + +```ts +declare const synth: pipelines.ShellStep; +const stage = new MyApplicationStage(this, 'MyApplication'); +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { synth }); + +pipeline.addStage(stage, { + post: [ + new pipelines.ShellStep('Approve', { + // Use the contents of the 'integ' directory from the synth step as the input + input: synth.addOutputDirectory('integ'), + commands: ['cd integ && ./run.sh'], + }), + ], +}); +``` + +### Customizing CodeBuild Projects + +CDK pipelines will generate CodeBuild projects for each `ShellStep` you use, and it +will also generate CodeBuild projects to publish assets and perform the self-mutation +of the pipeline. To control the various aspects of the CodeBuild projects that get +generated, use a `CodeBuildStep` instead of a `ShellStep`. This class has a number +of properties that allow you to customize various aspects of the projects: + +```ts +declare const vpc: ec2.Vpc; +declare const mySecurityGroup: ec2.SecurityGroup; +new pipelines.CodeBuildStep('Synth', { + // ...standard ShellStep props... + commands: [/* ... */], + env: { /* ... */ }, + + // If you are using a CodeBuildStep explicitly, set the 'cdk.out' directory + // to be the synth step's output. + primaryOutputDirectory: 'cdk.out', + + // Control the name of the project + projectName: 'MyProject', + + // Control parts of the BuildSpec other than the regular 'build' and 'install' commands + partialBuildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + // ... + }), + + // Control the build environment + buildEnvironment: { + computeType: codebuild.ComputeType.LARGE, + }, + timeout: Duration.minutes(90), + + // Control Elastic Network Interface creation + vpc: vpc, + subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + securityGroups: [mySecurityGroup], + + // Control caching + cache: codebuild.Cache.bucket(new s3.Bucket(this, 'Cache')), + + // Additional policy statements for the execution role + rolePolicyStatements: [ + new iam.PolicyStatement({ /* ... */ }), + ], +}); +``` + +You can also configure defaults for *all* CodeBuild projects by passing `codeBuildDefaults`, +or just for the synth, asset publishing, and self-mutation projects by passing `synthCodeBuildDefaults`, +`assetPublishingCodeBuildDefaults`, or `selfMutationCodeBuildDefaults`: + +```ts +declare const vpc: ec2.Vpc; +declare const mySecurityGroup: ec2.SecurityGroup; +new pipelines.CodePipeline(this, 'Pipeline', { + // Standard CodePipeline properties + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: [ + 'npm ci', + 'npm run build', + 'npx cdk synth', + ], + }), + + // Defaults for all CodeBuild projects + codeBuildDefaults: { + // Prepend commands and configuration to all projects + partialBuildSpec: codebuild.BuildSpec.fromObject({ + version: '0.2', + // ... + }), + + // Control the build environment + buildEnvironment: { + computeType: codebuild.ComputeType.LARGE, + }, + + // Control Elastic Network Interface creation + vpc: vpc, + subnetSelection: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }, + securityGroups: [mySecurityGroup], + + // Additional policy statements for the execution role + rolePolicy: [ + new iam.PolicyStatement({ /* ... */ }), + ], + }, + + synthCodeBuildDefaults: { /* ... */ }, + assetPublishingCodeBuildDefaults: { /* ... */ }, + selfMutationCodeBuildDefaults: { /* ... */ }, +}); +``` + +### Arbitrary CodePipeline actions + +If you want to add a type of CodePipeline action to the CDK Pipeline that +doesn't have a matching class yet, you can define your own step class that extends +`Step` and implements `ICodePipelineActionFactory`. + +Here's an example that adds a Jenkins step: + +```ts +class MyJenkinsStep extends pipelines.Step implements pipelines.ICodePipelineActionFactory { + constructor( + private readonly provider: cpactions.JenkinsProvider, + private readonly input: pipelines.FileSet, + ) { + super('MyJenkinsStep'); + + // This is necessary if your step accepts parameters, like environment variables, + // that may contain outputs from other steps. It doesn't matter what the + // structure is, as long as it contains the values that may contain outputs. + this.discoverReferencedOutputs({ + env: { /* ... */ } + }); + } + + public produceAction(stage: codepipeline.IStage, options: pipelines.ProduceActionOptions): pipelines.CodePipelineActionFactoryResult { + + // This is where you control what type of Action gets added to the + // CodePipeline + stage.addAction(new cpactions.JenkinsAction({ + // Copy 'actionName' and 'runOrder' from the options + actionName: options.actionName, + runOrder: options.runOrder, + + // Jenkins-specific configuration + type: cpactions.JenkinsActionType.TEST, + jenkinsProvider: this.provider, + projectName: 'MyJenkinsProject', + + // Translate the FileSet into a codepipeline.Artifact + inputs: [options.artifacts.toCodePipeline(this.input)], + })); + + return { runOrdersConsumed: 1 }; + } +} +``` + +Another example, adding a lambda step referencing outputs from a stack: + +```ts +class MyLambdaStep extends pipelines.Step implements pipelines.ICodePipelineActionFactory { + private stackOutputReference: pipelines.StackOutputReference + + constructor( + private readonly function: lambda.Function, + stackOutput: CfnOutput, + ) { + super('MyLambdaStep'); + this.stackOutputReference = pipelines.StackOutputReference.fromCfnOutput(stackOutput); + } + + public produceAction(stage: codepipeline.IStage, options: pipelines.ProduceActionOptions): pipelines.CodePipelineActionFactoryResult { + + stage.addAction(new cpactions.LambdaInvokeAction({ + actionName: options.actionName, + runOrder: options.runOrder, + // Map the reference to the variable name the CDK has generated for you. + userParameters: {stackOutput: options.stackOutputsMap.toCodePipeline(this.stackOutputReference)}, + lambda: this.function, + })); + + return { runOrdersConsumed: 1 }; + } + + /** + * Expose stack output references, letting the CDK know + * we want these variables accessible for this step. + */ + public get consumedStackOutputs(): pipelines.StackOutputReference[] { + return [this.stackOutputReference]; + } +} +``` + +### Using an existing AWS Codepipeline + +If you wish to use an existing `CodePipeline.Pipeline` while using the modern API's +methods and classes, you can pass in the existing `CodePipeline.Pipeline` to be built upon +instead of having the `pipelines.CodePipeline` construct create a new `CodePipeline.Pipeline`. +This also gives you more direct control over the underlying `CodePipeline.Pipeline` construct +if the way the modern API creates it doesn't allow for desired configurations. Use `CodePipelineFileset` to convert CodePipeline **artifacts** into CDK Pipelines **file sets**, +that can be used everywhere a file set or file set producer is expected. + +Here's an example of passing in an existing pipeline and using a *source* that's already +in the pipeline: + +```ts +declare const codePipeline: codepipeline.Pipeline; + +const sourceArtifact = new codepipeline.Artifact('MySourceArtifact'); + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + codePipeline: codePipeline, + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineFileSet.fromArtifact(sourceArtifact), + commands: ['npm ci','npm run build','npx cdk synth'], + }), +}); +``` + +If your existing pipeline already provides a synth step, pass the existing +artifact in place of the `synth` step: + +```ts +declare const codePipeline: codepipeline.Pipeline; + +const buildArtifact = new codepipeline.Artifact('MyBuildArtifact'); + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + codePipeline: codePipeline, + synth: pipelines.CodePipelineFileSet.fromArtifact(buildArtifact), +}); +``` + +Note that if you provide an existing pipeline, you cannot provide values for +`pipelineName`, `crossAccountKeys`, `reuseCrossRegionSupportStacks`, or `role` +because those values are passed in directly to the underlying `codepipeline.Pipeline`. + +## Using Docker in the pipeline + +Docker can be used in 3 different places in the pipeline: + +- If you are using Docker image assets in your application stages: Docker will + run in the asset publishing projects. +- If you are using Docker image assets in your stack (for example as + images for your CodeBuild projects): Docker will run in the self-mutate project. +- If you are using Docker to bundle file assets anywhere in your project (for + example, if you are using such construct libraries as + `@aws-cdk/aws-lambda-nodejs`): Docker will run in the + *synth* project. + +For the first case, you don't need to do anything special. For the other two cases, +you need to make sure that **privileged mode** is enabled on the correct CodeBuild +projects, so that Docker can run correctly. The follow sections describe how to do +that. + +You may also need to authenticate to Docker registries to avoid being throttled. +See the section **Authenticating to Docker registries** below for information on how to do +that. + +### Using Docker image assets in the pipeline + +If your `PipelineStack` is using Docker image assets (as opposed to the application +stacks the pipeline is deploying), for example by the use of `LinuxBuildImage.fromAsset()`, +you need to pass `dockerEnabledForSelfMutation: true` to the pipeline. For example: + +```ts +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: ['npm ci','npm run build','npx cdk synth'], + }), + + // Turn this on because the pipeline uses Docker image assets + dockerEnabledForSelfMutation: true, +}); + +pipeline.addWave('MyWave', { + post: [ + new pipelines.CodeBuildStep('RunApproval', { + commands: ['command-from-image'], + buildEnvironment: { + // The user of a Docker image asset in the pipeline requires turning on + // 'dockerEnabledForSelfMutation'. + buildImage: codebuild.LinuxBuildImage.fromAsset(this, 'Image', { + directory: './docker-image', + }), + }, + }), + ], +}); +``` + +> **Important**: You must turn on the `dockerEnabledForSelfMutation` flag, +> commit and allow the pipeline to self-update *before* adding the actual +> Docker asset. + +### Using bundled file assets + +If you are using asset bundling anywhere (such as automatically done for you +if you add a construct like `@aws-cdk/aws-lambda-nodejs`), you need to pass +`dockerEnabledForSynth: true` to the pipeline. For example: + +```ts +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: ['npm ci','npm run build','npx cdk synth'], + }), + + // Turn this on because the application uses bundled file assets + dockerEnabledForSynth: true, +}); +``` + +> **Important**: You must turn on the `dockerEnabledForSynth` flag, +> commit and allow the pipeline to self-update *before* adding the actual +> Docker asset. + +### Authenticating to Docker registries + +You can specify credentials to use for authenticating to Docker registries as part of the +pipeline definition. This can be useful if any Docker image assets — in the pipeline or +any of the application stages — require authentication, either due to being in a +different environment (e.g., ECR repo) or to avoid throttling (e.g., DockerHub). + +```ts +const dockerHubSecret = secretsmanager.Secret.fromSecretCompleteArn(this, 'DHSecret', 'arn:aws:...'); +const customRegSecret = secretsmanager.Secret.fromSecretCompleteArn(this, 'CRSecret', 'arn:aws:...'); +const repo1 = ecr.Repository.fromRepositoryArn(this, 'Repo', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo1'); +const repo2 = ecr.Repository.fromRepositoryArn(this, 'Repo', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2'); + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + dockerCredentials: [ + pipelines.DockerCredential.dockerHub(dockerHubSecret), + pipelines.DockerCredential.customRegistry('dockerregistry.example.com', customRegSecret), + pipelines.DockerCredential.ecr([repo1, repo2]), + ], + synth: new pipelines.ShellStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: ['npm ci','npm run build','npx cdk synth'], + }), +}); +``` + +For authenticating to Docker registries that require a username and password combination +(like DockerHub), create a Secrets Manager Secret with fields named `username` +and `secret`, and import it (the field names change be customized). + +Authentication to ECR repositories is done using the execution role of the +relevant CodeBuild job. Both types of credentials can be provided with an +optional role to assume before requesting the credentials. + +By default, the Docker credentials provided to the pipeline will be available to +the **Synth**, **Self-Update**, and **Asset Publishing** actions within the +*pipeline. The scope of the credentials can be limited via the `DockerCredentialUsage` option. + +```ts +const dockerHubSecret = secretsmanager.Secret.fromSecretCompleteArn(this, 'DHSecret', 'arn:aws:...'); +// Only the image asset publishing actions will be granted read access to the secret. +const creds = pipelines.DockerCredential.dockerHub(dockerHubSecret, { usages: [pipelines.DockerCredentialUsage.ASSET_PUBLISHING] }); +``` + +## CDK Environment Bootstrapping + +An *environment* is an *(account, region)* pair where you want to deploy a +CDK stack (see +[Environments](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) +in the CDK Developer Guide). In a Continuous Deployment pipeline, there are +at least two environments involved: the environment where the pipeline is +provisioned, and the environment where you want to deploy the application (or +different stages of the application). These can be the same, though best +practices recommend you isolate your different application stages from each +other in different AWS accounts or regions. + +Before you can provision the pipeline, you have to *bootstrap* the environment you want +to create it in. If you are deploying your application to different environments, you +also have to bootstrap those and be sure to add a *trust* relationship. + +After you have bootstrapped an environment and created a pipeline that deploys +to it, it's important that you don't delete the stack or change its *Qualifier*, +or future deployments to this environment will fail. If you want to upgrade +the bootstrap stack to a newer version, do that by updating it in-place. + +> This library requires the *modern* bootstrapping stack which has +> been updated specifically to support cross-account continuous delivery. +> +> If you are using CDKv2, you do not need to do anything else. Modern +> bootstrapping and modern stack synthesis (also known as "default stack +> synthesis") is the default. +> +> If you are using CDKv1, you need to opt in to modern bootstrapping and +> modern stack synthesis using a feature flag. Make sure `cdk.json` includes: +> +> ```json +> { +> "context": { +> "@aws-cdk/core:newStyleStackSynthesis": true +> } +> } +> ``` +> +> And be sure to run `cdk bootstrap` in the same directory as the `cdk.json` +> file. + +To bootstrap an environment for provisioning the pipeline: + +```console +$ npx cdk bootstrap \ + [--profile admin-profile-1] \ + --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \ + aws://111111111111/us-east-1 +``` + +To bootstrap a different environment for deploying CDK applications into using +a pipeline in account `111111111111`: + +```console +$ npx cdk bootstrap \ + [--profile admin-profile-2] \ + --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \ + --trust 11111111111 \ + aws://222222222222/us-east-2 +``` + +If you only want to trust an account to do lookups (e.g, when your CDK application has a +`Vpc.fromLookup()` call), use the option `--trust-for-lookup`: + +```console +$ npx cdk bootstrap \ + [--profile admin-profile-2] \ + --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess \ + --trust-for-lookup 11111111111 \ + aws://222222222222/us-east-2 +``` + +These command lines explained: + +- `npx`: means to use the CDK CLI from the current NPM install. If you are using + a global install of the CDK CLI, leave this out. +- `--profile`: should indicate a profile with administrator privileges that has + permissions to provision a pipeline in the indicated account. You can leave this + flag out if either the AWS default credentials or the `AWS_*` environment + variables confer these permissions. +- `--cloudformation-execution-policies`: ARN of the managed policy that future CDK + deployments should execute with. By default this is `AdministratorAccess`, but + if you also specify the `--trust` flag to give another Account permissions to + deploy into the current account, you must specify a value here. +- `--trust`: indicates which other account(s) should have permissions to deploy + CDK applications into this account. In this case we indicate the Pipeline's account, + but you could also use this for developer accounts (don't do that for production + application accounts though!). +- `--trust-for-lookup`: gives a more limited set of permissions to the + trusted account, only allowing it to look up values such as availability zones, EC2 images and + VPCs. `--trust-for-lookup` does not give permissions to modify anything in the account. + Note that `--trust` implies `--trust-for-lookup`, so you don't need to specify + the same account twice. +- `aws://222222222222/us-east-2`: the account and region we're bootstrapping. + +> Be aware that anyone who has access to the trusted Accounts **effectively has all +> permissions conferred by the configured CloudFormation execution policies**, +> allowing them to do things like read arbitrary S3 buckets and create arbitrary +> infrastructure in the bootstrapped account. Restrict the list of `--trust`ed Accounts, +> or restrict the policies configured by `--cloudformation-execution-policies`. + +
+ +> **Security tip**: we recommend that you use administrative credentials to an +> account only to bootstrap it and provision the initial pipeline. Otherwise, +> access to administrative credentials should be dropped as soon as possible. + +
+ +> **On the use of AdministratorAccess**: The use of the `AdministratorAccess` policy +> ensures that your pipeline can deploy every type of AWS resource to your account. +> Make sure you trust all the code and dependencies that make up your CDK app. +> Check with the appropriate department within your organization to decide on the +> proper policy to use. +> +> If your policy includes permissions to create on attach permission to a role, +> developers can escalate their privilege with more permissive permission. +> Thus, we recommend implementing [permissions boundary](https://aws.amazon.com/premiumsupport/knowledge-center/iam-permission-boundaries/) +> in the CDK Execution role. To do this, you can bootstrap with the `--template` option with +> [a customized template](https://github.com/aws-samples/aws-bootstrap-kit-examples/blob/ba28a97d289128281bc9483bcba12c1793f2c27a/source/1-SDLC-organization/lib/cdk-bootstrap-template.yml#L395) that contains a permission boundary. + +### Migrating from old bootstrap stack + +The bootstrap stack is a CloudFormation stack in your account named +**CDKToolkit** that provisions a set of resources required for the CDK +to deploy into that environment. + +The "new" bootstrap stack (obtained by running `cdk bootstrap` with +`CDK_NEW_BOOTSTRAP=1`) is slightly more elaborate than the "old" stack. It +contains: + +- An S3 bucket and ECR repository with predictable names, so that we can reference + assets in these storage locations *without* the use of CloudFormation template + parameters. +- A set of roles with permissions to access these asset locations and to execute + CloudFormation, assumable from whatever accounts you specify under `--trust`. + +It is possible and safe to migrate from the old bootstrap stack to the new +bootstrap stack. This will create a new S3 file asset bucket in your account +and orphan the old bucket. You should manually delete the orphaned bucket +after you are sure you have redeployed all CDK applications and there are no +more references to the old asset bucket. + +## Context Lookups + +You might be using CDK constructs that need to look up [runtime +context](https://docs.aws.amazon.com/cdk/latest/guide/context.html#context_methods), +which is information from the target AWS Account and Region the CDK needs to +synthesize CloudFormation templates appropriate for that environment. Examples +of this kind of context lookups are the number of Availability Zones available +to you, a Route53 Hosted Zone ID, or the ID of an AMI in a given region. This +information is automatically looked up when you run `cdk synth`. + +By default, a `cdk synth` performed in a pipeline will not have permissions +to perform these lookups, and the lookups will fail. This is by design. + +**Our recommended way of using lookups** is by running `cdk synth` on the +developer workstation and checking in the `cdk.context.json` file, which +contains the results of the context lookups. This will make sure your +synthesized infrastructure is consistent and repeatable. If you do not commit +`cdk.context.json`, the results of the lookups may suddenly be different in +unexpected ways, and even produce results that cannot be deployed or will cause +data loss. To give an account permissions to perform lookups against an +environment, without being able to deploy to it and make changes, run +`cdk bootstrap --trust-for-lookup=`. + +If you want to use lookups directly from the pipeline, you either need to accept +the risk of nondeterminism, or make sure you save and load the +`cdk.context.json` file somewhere between synth runs. Finally, you should +give the synth CodeBuild execution role permissions to assume the bootstrapped +lookup roles. As an example, doing so would look like this: + +```ts +new pipelines.CodePipeline(this, 'Pipeline', { + synth: new pipelines.CodeBuildStep('Synth', { + input: pipelines.CodePipelineSource.connection('my-org/my-app', 'main', { + connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console * });', + }), + commands: [ + // Commands to load cdk.context.json from somewhere here + '...', + 'npm ci', + 'npm run build', + 'npx cdk synth', + // Commands to store cdk.context.json back here + '...', + ], + rolePolicyStatements: [ + new iam.PolicyStatement({ + actions: ['sts:AssumeRole'], + resources: ['*'], + conditions: { + StringEquals: { + 'iam:ResourceTag/aws-cdk:bootstrap-role': 'lookup', + }, + }, + }), + ], + }), +}); +``` + +The above example requires that the target environments have all +been bootstrapped with bootstrap stack version `8`, released with +CDK CLI `1.114.0`. + +## Security Considerations + +It's important to stay safe while employing Continuous Delivery. The CDK Pipelines +library comes with secure defaults to the best of our ability, but by its +very nature the library cannot take care of everything. + +We therefore expect you to mind the following: + +- Maintain dependency hygiene and vet 3rd-party software you use. Any software you + run on your build machine has the ability to change the infrastructure that gets + deployed. Be careful with the software you depend on. + +- Use dependency locking to prevent accidental upgrades! The default `CdkSynths` that + come with CDK Pipelines will expect `package-lock.json` and `yarn.lock` to + ensure your dependencies are the ones you expect. + +- Credentials to production environments should be short-lived. After + bootstrapping and the initial pipeline provisioning, there is no more need for + developers to have access to any of the account credentials; all further + changes can be deployed through git. Avoid the chances of credentials leaking + by not having them in the first place! + +### Confirm permissions broadening + +To keep tabs on the security impact of changes going out through your pipeline, +you can insert a security check before any stage deployment. This security check +will check if the upcoming deployment would add any new IAM permissions or +security group rules, and if so pause the pipeline and require you to confirm +the changes. + +The security check will appear as two distinct actions in your pipeline: first +a CodeBuild project that runs `cdk diff` on the stage that's about to be deployed, +followed by a Manual Approval action that pauses the pipeline. If it so happens +that there no new IAM permissions or security group rules will be added by the deployment, +the manual approval step is automatically satisfied. The pipeline will look like this: + +```txt +Pipeline +├── ... +├── MyApplicationStage +│   ├── MyApplicationSecurityCheck // Security Diff Action +│   ├── MyApplicationManualApproval // Manual Approval Action +│   ├── Stack.Prepare +│   └── Stack.Deploy +└── ... +``` + +You can insert the security check by using a `ConfirmPermissionsBroadening` step: + +```ts +declare const pipeline: pipelines.CodePipeline; +const stage = new MyApplicationStage(this, 'MyApplication'); +pipeline.addStage(stage, { + pre: [ + new pipelines.ConfirmPermissionsBroadening('Check', { stage }), + ], +}); +``` + +To get notified when there is a change that needs your manual approval, +create an SNS Topic, subscribe your own email address, and pass it in as +as the `notificationTopic` property: + +```ts +declare const pipeline: pipelines.CodePipeline; +const topic = new sns.Topic(this, 'SecurityChangesTopic'); +topic.addSubscription(new subscriptions.EmailSubscription('test@email.com')); + +const stage = new MyApplicationStage(this, 'MyApplication'); +pipeline.addStage(stage, { + pre: [ + new pipelines.ConfirmPermissionsBroadening('Check', { + stage, + notificationTopic: topic, + }), + ], +}); +``` + +**Note**: Manual Approvals notifications only apply when an application has security +check enabled. + +## Using a different deployment engine + +CDK Pipelines supports multiple *deployment engines*, but this module vends a +construct for only one such engine: AWS CodePipeline. It is also possible to +use CDK Pipelines to build pipelines backed by other deployment engines. + +Here is a list of CDK Libraries that integrate CDK Pipelines with +alternative deployment engines: + +- GitHub Workflows: [`cdk-pipelines-github`](https://github.com/cdklabs/cdk-pipelines-github) + +## Troubleshooting + +Here are some common errors you may encounter while using this library. + +### Pipeline: Internal Failure + +If you see the following error during deployment of your pipeline: + +```plaintext +CREATE_FAILED | AWS::CodePipeline::Pipeline | Pipeline/Pipeline +Internal Failure +``` + +There's something wrong with your GitHub access token. It might be missing, or not have the +right permissions to access the repository you're trying to access. + +### Key: Policy contains a statement with one or more invalid principals + +If you see the following error during deployment of your pipeline: + +```plaintext +CREATE_FAILED | AWS::KMS::Key | Pipeline/Pipeline/ArtifactsBucketEncryptionKey +Policy contains a statement with one or more invalid principals. +``` + +One of the target (account, region) environments has not been bootstrapped +with the new bootstrap stack. Check your target environments and make sure +they are all bootstrapped. + +### Message: no matching base directory path found for cdk.out + +If you see this error during the **Synth** step, it means that CodeBuild +is expecting to find a `cdk.out` directory in the root of your CodeBuild project, +but the directory wasn't there. There are two common causes for this: + +- `cdk synth` is not being executed: `cdk synth` used to be run + implicitly for you, but you now have to explicitly include the command. + For NPM-based projects, add `npx cdk synth` to the end of the `commands` + property, for other languages add `npm install -g aws-cdk` and `cdk synth`. +- Your CDK project lives in a subdirectory: you added a `cd ` command + to the list of commands; don't forget to tell the `ScriptStep` about the + different location of `cdk.out`, by passing `primaryOutputDirectory: '/cdk.out'`. + +### is in ROLLBACK_COMPLETE state and can not be updated + +If you see the following error during execution of your pipeline: + +```plaintext +Stack ... is in ROLLBACK_COMPLETE state and can not be updated. (Service: +AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request +ID: ...) +``` + +The stack failed its previous deployment, and is in a non-retryable state. +Go into the CloudFormation console, delete the stack, and retry the deployment. + +### Cannot find module 'xxxx' or its corresponding type declarations + +You may see this if you are using TypeScript or other NPM-based languages, +when using NPM 7 on your workstation (where you generate `package-lock.json`) +and NPM 6 on the CodeBuild image used for synthesizing. + +It looks like NPM 7 has started writing less information to `package-lock.json`, +leading NPM 6 reading that same file to not install all required packages anymore. + +Make sure you are using the same NPM version everywhere, either downgrade your +workstation's version or upgrade the CodeBuild version. + +### Cannot find module '.../check-node-version.js' (MODULE_NOT_FOUND) + +The above error may be produced by `npx` when executing the CDK CLI, or any +project that uses the AWS SDK for JavaScript, without the target application +having been installed yet. For example, it can be triggered by `npx cdk synth` +if `aws-cdk` is not in your `package.json`. + +Work around this by either installing the target application using NPM *before* +running `npx`, or set the environment variable `NPM_CONFIG_UNSAFE_PERM=true`. + +### Cannot connect to the Docker daemon at unix:///var/run/docker.sock + +If, in the 'Synth' action (inside the 'Build' stage) of your pipeline, you get an error like this: + +```console +stderr: docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. +See 'docker run --help'. +``` + +It means that the AWS CodeBuild project for 'Synth' is not configured to run in privileged mode, +which prevents Docker builds from happening. This typically happens if you use a CDK construct +that bundles asset using tools run via Docker, like `aws-lambda-nodejs`, `aws-lambda-python`, +`aws-lambda-go` and others. + +Make sure you set the `privileged` environment variable to `true` in the synth definition: + +```ts +const sourceArtifact = new codepipeline.Artifact(); +const cloudAssemblyArtifact = new codepipeline.Artifact(); +const pipeline = new pipelines.CdkPipeline(this, 'MyPipeline', { + cloudAssemblyArtifact, + synthAction: pipelines.SimpleSynthAction.standardNpmSynth({ + sourceArtifact, + cloudAssemblyArtifact, + environment: { + privileged: true, + }, + }), +}); +``` + +After turning on `privilegedMode: true`, you will need to do a one-time manual cdk deploy of your +pipeline to get it going again (as with a broken 'synth' the pipeline will not be able to self +update to the right state). + +### Not authorized to perform sts:AssumeRole on arn:aws:iam::\*:role/\*-lookup-role-\* + +You may get an error like the following in the **Synth** step: + +```text +Could not assume role in target account using current credentials (which are for account 111111111111). User: +arn:aws:sts::111111111111:assumed-role/PipelineStack-PipelineBuildSynthCdkBuildProje-..../AWSCodeBuild-.... +is not authorized to perform: sts:AssumeRole on resource: +arn:aws:iam::222222222222:role/cdk-hnb659fds-lookup-role-222222222222-us-east-1. +Please make sure that this role exists in the account. If it doesn't exist, (re)-bootstrap the environment with +the right '--trust', using the latest version of the CDK CLI. +``` + +This is a sign that the CLI is trying to do Context Lookups during the **Synth** step, which are failing +because it cannot assume the right role. We recommend you don't rely on Context Lookups in the pipeline at +all, and commit a file called `cdk.context.json` with the right lookup values in it to source control. + +If you do want to do lookups in the pipeline, the cause is one of the following: + +- The target environment has not been bootstrapped; OR +- The target environment has been bootstrapped without the right `--trust` relationship; OR +- The CodeBuild execution role does not have permissions to call `sts:AssumeRole`. + +See the section called **Context Lookups** for more information on using this feature. + +### IAM policies: Cannot exceed quota for PoliciesPerRole / Maximum policy size exceeded + +This happens as a result of having a lot of targets in the Pipeline: the IAM policies that +get generated enumerate all required roles and grow too large. + +Make sure you are on version `2.26.0` or higher, and that your `cdk.json` contains the +following: + +```json +{ + "context": { + "@aws-cdk/aws-iam:minimizePolicies": true + } +} +``` + +### S3 error: Access Denied + +An "S3 Access Denied" error can have two causes: + +- Asset hashes have changed, but self-mutation has been disabled in the pipeline. +- You have deleted and recreated the bootstrap stack, or changed its qualifier. + +#### Self-mutation step has been removed + +Some constructs, such as EKS clusters, generate nested stacks. When CloudFormation tries +to deploy those stacks, it may fail with this error: + +```console +S3 error: Access Denied For more information check http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html +``` + +This happens because the pipeline is not self-mutating and, as a consequence, the `FileAssetX` +build projects get out-of-sync with the generated templates. To fix this, make sure the +`selfMutating` property is set to `true`: + +```ts +const cloudAssemblyArtifact = new codepipeline.Artifact(); +const pipeline = new pipelines.CdkPipeline(this, 'MyPipeline', { + selfMutating: true, + cloudAssemblyArtifact, +}); +``` + +#### Bootstrap roles have been renamed or recreated + +While attempting to deploy an application stage, the "Prepare" or "Deploy" stage may fail with a cryptic error like: + +`Action execution failed +Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: 0123456ABCDEFGH; +S3 Extended Request ID: 3hWcrVkhFGxfiMb/rTJO0Bk7Qn95x5ll4gyHiFsX6Pmk/NT+uX9+Z1moEcfkL7H3cjH7sWZfeD0=; Proxy: null)` + +This generally indicates that the roles necessary to deploy have been deleted (or deleted and re-created); +for example, if the bootstrap stack has been deleted and re-created, this scenario will happen. Under the hood, +the resources that rely on these roles (e.g., `cdk-$qualifier-deploy-role-$account-$region`) point to different +canonical IDs than the recreated versions of these roles, which causes the errors. There are no simple solutions +to this issue, and for that reason we **strongly recommend** that bootstrap stacks not be deleted and re-created +once created. + +The most automated way to solve the issue is to introduce a secondary bootstrap stack. By changing the qualifier +that the pipeline stack looks for, a change will be detected and the impacted policies and resources will be updated. +A hypothetical recovery workflow would look something like this: + +- First, for all impacted environments, create a secondary bootstrap stack: + +```sh +$ env CDK_NEW_BOOTSTRAP=1 npx cdk bootstrap \ + --qualifier random1234 \ + --toolkit-stack-name CDKToolkitTemp \ + aws://111111111111/us-east-1 +``` + +- Update all impacted stacks in the pipeline to use this new qualifier. +See https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html for more info. + +```ts +new Stack(this, 'MyStack', { + // Update this qualifier to match the one used above. + synthesizer: new cdk.DefaultStackSynthesizer({ + qualifier: 'randchars1234', + }), +}); +``` + +- Deploy the updated stacks. This will update the stacks to use the roles created in the new bootstrap stack. +- (Optional) Restore back to the original state: + - Revert the change made in step #2 above + - Re-deploy the pipeline to use the original qualifier. + - Delete the temporary bootstrap stack(s) + +##### Manual Alternative + +Alternatively, the errors can be resolved by finding each impacted resource and policy, and correcting the policies +by replacing the canonical IDs (e.g., `AROAYBRETNYCYV6ZF2R93`) with the appropriate ARNs. As an example, the KMS +encryption key policy for the artifacts bucket may have a statement that looks like the following: + +```json +{ + "Effect" : "Allow", + "Principal" : { + // "AWS" : "AROAYBRETNYCYV6ZF2R93" // Indicates this issue; replace this value + "AWS": "arn:aws:iam::0123456789012:role/cdk-hnb659fds-deploy-role-0123456789012-eu-west-1", // Correct value + }, + "Action" : [ "kms:Decrypt", "kms:DescribeKey" ], + "Resource" : "*" +} +``` + +Any resource or policy that references the qualifier (`hnb659fds` by default) will need to be updated. + +### This CDK CLI is not compatible with the CDK library used by your application + +The CDK CLI version used in your pipeline is too old to read the Cloud Assembly +produced by your CDK app. + +Most likely this happens in the `SelfMutate` action, you are passing the `cliVersion` +parameter to control the version of the CDK CLI, and you just updated the CDK +framework version that your application uses. You either forgot to change the +`cliVersion` parameter, or changed the `cliVersion` in the same commit in which +you changed the framework version. Because a change to the pipeline settings needs +a successful run of the `SelfMutate` step to be applied, the next iteration of the +`SelfMutate` step still executes with the *old* CLI version, and that old CLI version +is not able to read the cloud assembly produced by the new framework version. + +Solution: change the `cliVersion` first, commit, push and deploy, and only then +change the framework version. + +We recommend you avoid specifying the `cliVersion` parameter at all. By default +the pipeline will use the latest CLI version, which will support all cloud assembly +versions. + +## Using Drop-in Docker Replacements + +By default, the AWS CDK will build and publish Docker image assets using the +`docker` command. However, by specifying the `CDK_DOCKER` environment variable, +you can override the command that will be used to build and publish your +assets. + +In CDK Pipelines, the drop-in replacement for the `docker` command must be +included in the CodeBuild environment and configured for your pipeline. + +### Adding to the default CodeBuild image + +You can add a drop-in Docker replacement command to the default CodeBuild +environment by adding install-phase commands that encode how to install +your tooling and by adding the `CDK_DOCKER` environment variable to your +build environment. + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source +declare const synthCommands: string[]; // Commands to synthesize your app +declare const installCommands: string[]; // Commands to install your toolchain + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + // Standard CodePipeline properties... + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: synthCommands, + }), + + // Configure CodeBuild to use a drop-in Docker replacement. + codeBuildDefaults: { + buildEnvironment: { + partialBuildSpec: Codebuild.BuildSpec.fromObject({ + phases: { + install: { + // Add the shell commands to install your drop-in Docker + // replacement to the CodeBuild enviromment. + commands: installCommands, + } + } + }), + environmentVariables: { + // Instruct the AWS CDK to use `drop-in-replacement` instead of + // `docker` when building / publishing docker images. + // e.g., `drop-in-replacement build . -f path/to/Dockerfile` + CDK_DOCKER: 'drop-in-replacement', + } + } + }, +}); +``` + +### Using a custom build image + +If you're using a custom build image in CodeBuild, you can override the +command the AWS CDK uses to build Docker images by providing `CDK_DOCKER` as +an `ENV` in your `Dockerfile` or by providing the environment variable in the +pipeline as shown below. + +```ts +declare const source: pipelines.IFileSetProducer; // the repository source +declare const synthCommands: string[]; // Commands to synthesize your app + +const pipeline = new pipelines.CodePipeline(this, 'Pipeline', { + // Standard CodePipeline properties... + synth: new pipelines.ShellStep('Synth', { + input: source, + commands: synthCommands, + }), + + // Configure CodeBuild to use a drop-in Docker replacement. + codeBuildDefaults: { + buildEnvironment: { + // Provide a custom build image containing your toolchain and the + // pre-installed replacement for the `docker` command. + buildImage: codebuild.LinuxBuildImage.fromDockerRegistry('your-docker-registry'), + environmentVariables: { + // If you haven't provided an `ENV` in your Dockerfile that overrides + // `CDK_DOCKER`, then you must provide the name of the command that + // the AWS CDK should run instead of `docker` here. + CDK_DOCKER: 'drop-in-replacement', + } + } + }, +}); +``` + +## Known Issues + +There are some usability issues that are caused by underlying technology, and +cannot be remedied by CDK at this point. They are reproduced here for completeness. + +- **Console links to other accounts will not work**: the AWS CodePipeline + console will assume all links are relative to the current account. You will + not be able to use the pipeline console to click through to a CloudFormation + stack in a different account. +- **If a change set failed to apply the pipeline must be restarted**: if a change + set failed to apply, it cannot be retried. The pipeline must be restarted from + the top by clicking **Release Change**. +- **A stack that failed to create must be deleted manually**: if a stack + failed to create on the first attempt, you must delete it using the + CloudFormation console before starting the pipeline again by clicking + **Release Change**. diff --git a/packages/aws-cdk-lib/pipelines/index.ts b/packages/aws-cdk-lib/pipelines/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/asset-type.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/asset-type.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/blueprint/asset-type.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/asset-type.ts diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/file-set.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/file-set.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/blueprint/file-set.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/file-set.ts diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/index.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/blueprint/index.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/manual-approval.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/manual-approval.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/blueprint/manual-approval.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/manual-approval.ts diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/shell-step.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/shell-step.ts similarity index 99% rename from packages/@aws-cdk/pipelines/lib/blueprint/shell-step.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/shell-step.ts index 59d492aa6a34b..9ed7ee022c69c 100644 --- a/packages/@aws-cdk/pipelines/lib/blueprint/shell-step.ts +++ b/packages/aws-cdk-lib/pipelines/lib/blueprint/shell-step.ts @@ -1,4 +1,4 @@ -import { CfnOutput, Stack } from '@aws-cdk/core'; +import { CfnOutput, Stack } from '../../../core'; import { FileSet, IFileSetProducer } from './file-set'; import { StackDeployment } from './stack-deployment'; import { Step } from './step'; diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/stack-deployment.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/stack-deployment.ts similarity index 99% rename from packages/@aws-cdk/pipelines/lib/blueprint/stack-deployment.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/stack-deployment.ts index 66adb5f738847..6bfcb46339877 100644 --- a/packages/@aws-cdk/pipelines/lib/blueprint/stack-deployment.ts +++ b/packages/aws-cdk-lib/pipelines/lib/blueprint/stack-deployment.ts @@ -1,6 +1,6 @@ import * as path from 'path'; import { parse as parseUrl } from 'url'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; import { AssetType } from './asset-type'; import { Step } from './step'; import { AssetManifestReader, DockerImageManifestEntry, FileManifestEntry } from '../private/asset-manifest'; diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/stage-deployment.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/stage-deployment.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/blueprint/stage-deployment.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/stage-deployment.ts index 82b8e54d3f678..b2fedfcc0dd9f 100644 --- a/packages/@aws-cdk/pipelines/lib/blueprint/stage-deployment.ts +++ b/packages/aws-cdk-lib/pipelines/lib/blueprint/stage-deployment.ts @@ -1,5 +1,5 @@ -import * as cdk from '@aws-cdk/core'; -import { CloudFormationStackArtifact } from '@aws-cdk/cx-api'; +import * as cdk from '../../../core'; +import { CloudFormationStackArtifact } from '../../../cx-api'; import { StackDeployment } from './stack-deployment'; import { StackSteps, Step } from './step'; import { isStackArtifact } from '../private/cloud-assembly-internals'; diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/step.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/step.ts similarity index 98% rename from packages/@aws-cdk/pipelines/lib/blueprint/step.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/step.ts index bdf561ce4b7c0..3c61e7df5d309 100644 --- a/packages/@aws-cdk/pipelines/lib/blueprint/step.ts +++ b/packages/aws-cdk-lib/pipelines/lib/blueprint/step.ts @@ -1,4 +1,4 @@ -import { Stack, Token } from '@aws-cdk/core'; +import { Stack, Token } from '../../../core'; import { FileSet, IFileSetProducer } from './file-set'; import { StackOutputReference } from './shell-step'; import { StepOutput } from '../helpers-internal/step-output'; diff --git a/packages/@aws-cdk/pipelines/lib/blueprint/wave.ts b/packages/aws-cdk-lib/pipelines/lib/blueprint/wave.ts similarity index 98% rename from packages/@aws-cdk/pipelines/lib/blueprint/wave.ts rename to packages/aws-cdk-lib/pipelines/lib/blueprint/wave.ts index b419277c51132..5234ae18c8aec 100644 --- a/packages/@aws-cdk/pipelines/lib/blueprint/wave.ts +++ b/packages/aws-cdk-lib/pipelines/lib/blueprint/wave.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { StageDeployment } from './stage-deployment'; import { StackSteps, Step } from './step'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/artifact-map.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/artifact-map.ts similarity index 98% rename from packages/@aws-cdk/pipelines/lib/codepipeline/artifact-map.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/artifact-map.ts index 5379811427286..7cda63b7c90dd 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/artifact-map.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/artifact-map.ts @@ -1,5 +1,5 @@ import * as crypto from 'crypto'; -import * as cp from '@aws-cdk/aws-codepipeline'; +import * as cp from '../../../aws-codepipeline'; import { FileSet } from '../blueprint'; import { PipelineGraph } from '../helpers-internal'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codebuild-step.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/codebuild-step.ts index d64a0f72bef07..46ce67c765a8b 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/codebuild-step.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codebuild-step.ts @@ -1,7 +1,7 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Duration } from '@aws-cdk/core'; +import * as codebuild from '../../../aws-codebuild'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import { Duration } from '../../../core'; import { mergeBuildSpecs } from './private/buildspecs'; import { makeCodePipelineOutput } from './private/outputs'; import { ShellStep, ShellStepProps } from '../blueprint'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-action-factory.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-action-factory.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-action-factory.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-action-factory.ts index 16b01c42d6d09..4a19cbda1b3a6 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-action-factory.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-action-factory.ts @@ -1,5 +1,5 @@ -import * as cb from '@aws-cdk/aws-codebuild'; -import * as cp from '@aws-cdk/aws-codepipeline'; +import * as cb from '../../../aws-codebuild'; +import * as cp from '../../../aws-codepipeline'; import { Construct } from 'constructs'; import { ArtifactMap } from './artifact-map'; import { CodeBuildOptions, CodePipeline } from './codepipeline'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-source.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-source.ts index 234ea74237326..ca187fda5981e 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/codepipeline-source.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline-source.ts @@ -1,12 +1,12 @@ -import * as codecommit from '@aws-cdk/aws-codecommit'; -import * as cp from '@aws-cdk/aws-codepipeline'; -import { Artifact } from '@aws-cdk/aws-codepipeline'; -import * as cp_actions from '@aws-cdk/aws-codepipeline-actions'; -import { Action, CodeCommitTrigger, GitHubTrigger, S3Trigger } from '@aws-cdk/aws-codepipeline-actions'; -import { IRepository } from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import { IBucket } from '@aws-cdk/aws-s3'; -import { Fn, SecretValue, Token } from '@aws-cdk/core'; +import * as codecommit from '../../../aws-codecommit'; +import * as cp from '../../../aws-codepipeline'; +import { Artifact } from '../../../aws-codepipeline'; +import * as cp_actions from '../../../aws-codepipeline-actions'; +import { Action, CodeCommitTrigger, GitHubTrigger, S3Trigger } from '../../../aws-codepipeline-actions'; +import { IRepository } from '../../../aws-ecr'; +import * as iam from '../../../aws-iam'; +import { IBucket } from '../../../aws-s3'; +import { Fn, SecretValue, Token } from '../../../core'; import { Node } from 'constructs'; import { CodePipelineActionFactoryResult, ProduceActionOptions, ICodePipelineActionFactory } from './codepipeline-action-factory'; import { makeCodePipelineOutput } from './private/outputs'; diff --git a/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline.ts new file mode 100644 index 0000000000000..5fc8175b0005c --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/codepipeline.ts @@ -0,0 +1,1012 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as cb from '../../../aws-codebuild'; +import * as cp from '../../../aws-codepipeline'; +import * as cpa from '../../../aws-codepipeline-actions'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import { Aws, CfnCapabilities, Duration, PhysicalName, Stack, Names } from '../../../core'; +import * as cxapi from '../../../cx-api'; +import { Construct } from 'constructs'; +import { ArtifactMap } from './artifact-map'; +import { CodeBuildStep } from './codebuild-step'; +import { CodePipelineActionFactoryResult, ICodePipelineActionFactory } from './codepipeline-action-factory'; +import { CodeBuildFactory, mergeCodeBuildOptions } from './private/codebuild-factory'; +import { namespaceStepOutputs } from './private/outputs'; +import { StackOutputsMap } from './stack-outputs-map'; +import { AssetType, FileSet, IFileSetProducer, ManualApprovalStep, ShellStep, StackAsset, StackDeployment, Step } from '../blueprint'; +import { DockerCredential, dockerCredentialsInstallCommands, DockerCredentialUsage } from '../docker-credentials'; +import { GraphNodeCollection, isGraph, AGraphNode, PipelineGraph } from '../helpers-internal'; +import { PipelineBase } from '../main'; +import { AssetSingletonRole } from '../private/asset-singleton-role'; +import { CachedFnSub } from '../private/cached-fnsub'; +import { preferredCliVersion } from '../private/cli-version'; +import { appOf, assemblyBuilderOf, embeddedAsmPath, obtainScope } from '../private/construct-internals'; +import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../private/default-codebuild-image'; +import { toPosixPath } from '../private/fs'; +import { actionName, stackVariableNamespace } from '../private/identifiers'; +import { enumerate, flatten, maybeSuffix, noUndefined } from '../private/javascript'; +import { writeTemplateConfiguration } from '../private/template-configuration'; + + +/** + * Properties for a `CodePipeline` + */ +export interface CodePipelineProps { + /** + * The build step that produces the CDK Cloud Assembly + * + * The primary output of this step needs to be the `cdk.out` directory + * generated by the `cdk synth` command. + * + * If you use a `ShellStep` here and you don't configure an output directory, + * the output directory will automatically be assumed to be `cdk.out`. + */ + readonly synth: IFileSetProducer; + + /** + * The name of the CodePipeline pipeline + * + * @default - Automatically generated + */ + readonly pipelineName?: string; + + /** + * Create KMS keys for the artifact buckets, allowing cross-account deployments + * + * The artifact buckets have to be encrypted to support deploying CDK apps to + * another account, so if you want to do that or want to have your artifact + * buckets encrypted, be sure to set this value to `true`. + * + * Be aware there is a cost associated with maintaining the KMS keys. + * + * @default false + */ + readonly crossAccountKeys?: boolean; + + /** + * CDK CLI version to use in self-mutation and asset publishing steps + * + * If you want to lock the CDK CLI version used in the pipeline, by steps + * that are automatically generated for you, specify the version here. + * + * We recommend you do not specify this value, as not specifying it always + * uses the latest CLI version which is backwards compatible with old versions. + * + * If you do specify it, be aware that this version should always be equal to or higher than the + * version of the CDK framework used by the CDK app, when the CDK commands are + * run during your pipeline execution. When you change this version, the *next + * time* the `SelfMutate` step runs it will still be using the CLI of the the + * *previous* version that was in this property: it will only start using the + * new version after `SelfMutate` completes successfully. That means that if + * you want to update both framework and CLI version, you should update the + * CLI version first, commit, push and deploy, and only then update the + * framework version. + * + * @default - Latest version + */ + readonly cliVersion?: string; + + /** + * Whether the pipeline will update itself + * + * This needs to be set to `true` to allow the pipeline to reconfigure + * itself when assets or stages are being added to it, and `true` is the + * recommended setting. + * + * You can temporarily set this to `false` while you are iterating + * on the pipeline itself and prefer to deploy changes using `cdk deploy`. + * + * @default true + */ + readonly selfMutation?: boolean; + + /** + * Enable Docker for the self-mutate step + * + * Set this to true if the pipeline itself uses Docker container assets + * (for example, if you use `LinuxBuildImage.fromAsset()` as the build + * image of a CodeBuild step in the pipeline). + * + * You do not need to set it if you build Docker image assets in the + * application Stages and Stacks that are *deployed* by this pipeline. + * + * Configures privileged mode for the self-mutation CodeBuild action. + * + * If you are about to turn this on in an already-deployed Pipeline, + * set the value to `true` first, commit and allow the pipeline to + * self-update, and only then use the Docker asset in the pipeline. + * + * @default false + */ + readonly dockerEnabledForSelfMutation?: boolean; + + /** + * Enable Docker for the 'synth' step + * + * Set this to true if you are using file assets that require + * "bundling" anywhere in your application (meaning an asset + * compilation step will be run with the tools provided by + * a Docker image), both for the Pipeline stack as well as the + * application stacks. + * + * A common way to use bundling assets in your application is by + * using the `@aws-cdk/aws-lambda-nodejs` library. + * + * Configures privileged mode for the synth CodeBuild action. + * + * If you are about to turn this on in an already-deployed Pipeline, + * set the value to `true` first, commit and allow the pipeline to + * self-update, and only then use the bundled asset. + * + * @default false + */ + readonly dockerEnabledForSynth?: boolean; + + /** + * Customize the CodeBuild projects created for this pipeline + * + * @default - All projects run non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_6_0 + */ + readonly codeBuildDefaults?: CodeBuildOptions; + + /** + * Additional customizations to apply to the synthesize CodeBuild projects + * + * @default - Only `codeBuildDefaults` are applied + */ + readonly synthCodeBuildDefaults?: CodeBuildOptions; + + /** + * Additional customizations to apply to the asset publishing CodeBuild projects + * + * @default - Only `codeBuildDefaults` are applied + */ + readonly assetPublishingCodeBuildDefaults?: CodeBuildOptions; + + /** + * Additional customizations to apply to the self mutation CodeBuild projects + * + * @default - Only `codeBuildDefaults` are applied + */ + readonly selfMutationCodeBuildDefaults?: CodeBuildOptions; + + /** + * Publish assets in multiple CodeBuild projects + * + * If set to false, use one Project per type to publish all assets. + * + * Publishing in parallel improves concurrency and may reduce publishing + * latency, but may also increase overall provisioning time of the CodeBuild + * projects. + * + * Experiment and see what value works best for you. + * + * @default true + */ + readonly publishAssetsInParallel?: boolean; + + /** + * A list of credentials used to authenticate to Docker registries. + * + * Specify any credentials necessary within the pipeline to build, synth, update, or publish assets. + * + * @default [] + */ + readonly dockerCredentials?: DockerCredential[]; + + /** + * An existing Pipeline to be reused and built upon. + * + * [disable-awslint:ref-via-interface] + * + * @default - a new underlying pipeline is created. + */ + readonly codePipeline?: cp.Pipeline; + + /** + * Reuse the same cross region support stack for all pipelines in the App. + * + * @default - true (Use the same support stack for all pipelines in App) + */ + readonly reuseCrossRegionSupportStacks?: boolean; + + /** + * The IAM role to be assumed by this Pipeline + * + * @default - A new role is created + */ + readonly role?: iam.IRole; + + /** + * Deploy every stack by creating a change set and executing it + * + * When enabled, creates a "Prepare" and "Execute" action for each stack. Disable + * to deploy the stack in one pipeline action. + * + * @default true + */ + readonly useChangeSets?: boolean; + + /** + * Enable KMS key rotation for the generated KMS keys. + * + * By default KMS key rotation is disabled, but will add + * additional costs when enabled. + * + * @default - false (key rotation is disabled) + */ + readonly enableKeyRotation?: boolean; +} + +/** + * Options for customizing a single CodeBuild project + */ +export interface CodeBuildOptions { + /** + * Partial build environment, will be combined with other build environments that apply + * + * @default - Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_6_0 + */ + readonly buildEnvironment?: cb.BuildEnvironment; + + /** + * Policy statements to add to role + * + * @default - No policy statements added to CodeBuild Project Role + */ + readonly rolePolicy?: iam.PolicyStatement[]; + + /** + * Partial buildspec, will be combined with other buildspecs that apply + * + * The BuildSpec must be available inline--it cannot reference a file + * on disk. + * + * @default - No initial BuildSpec + */ + readonly partialBuildSpec?: cb.BuildSpec; + + /** + * Which security group(s) to associate with the project network interfaces. + * + * Only used if 'vpc' is supplied. + * + * @default - Security group will be automatically created. + */ + readonly securityGroups?: ec2.ISecurityGroup[]; + + /** + * The VPC where to create the CodeBuild network interfaces in. + * + * @default - No VPC + */ + readonly vpc?: ec2.IVpc; + + /** + * Which subnets to use. + * + * Only used if 'vpc' is supplied. + * + * @default - All private subnets. + */ + readonly subnetSelection?: ec2.SubnetSelection; + + /** + * Caching strategy to use. + * + * @default - No cache + */ + readonly cache?: cb.Cache; + + /** + * The number of minutes after which AWS CodeBuild stops the build if it's + * not complete. For valid values, see the timeoutInMinutes field in the AWS + * CodeBuild User Guide. + * + * @default Duration.hours(1) + */ + readonly timeout?: Duration; +} + + +/** + * A CDK Pipeline that uses CodePipeline to deploy CDK apps + * + * This is a `Pipeline` with its `engine` property set to + * `CodePipelineEngine`, and exists for nicer ergonomics for + * users that don't need to switch out engines. + */ +export class CodePipeline extends PipelineBase { + /** + * Whether SelfMutation is enabled for this CDK Pipeline + */ + public readonly selfMutationEnabled: boolean; + + private _pipeline?: cp.Pipeline; + private artifacts = new ArtifactMap(); + private _synthProject?: cb.IProject; + private _selfMutationProject?: cb.IProject; + private readonly useChangeSets: boolean; + private _myCxAsmRoot?: string; + private readonly dockerCredentials: DockerCredential[]; + private readonly cachedFnSub = new CachedFnSub(); + private stackOutputs: StackOutputsMap; + + /** + * Asset roles shared for publishing + */ + private readonly assetCodeBuildRoles: Map = new Map(); + + /** + * This is set to the very first artifact produced in the pipeline + */ + private _fallbackArtifact?: cp.Artifact; + + private _cloudAssemblyFileSet?: FileSet; + + private readonly singlePublisherPerAssetType: boolean; + private readonly cliVersion?: string; + + constructor(scope: Construct, id: string, private readonly props: CodePipelineProps) { + super(scope, id, props); + + this.selfMutationEnabled = props.selfMutation ?? true; + this.dockerCredentials = props.dockerCredentials ?? []; + this.singlePublisherPerAssetType = !(props.publishAssetsInParallel ?? true); + this.cliVersion = props.cliVersion ?? preferredCliVersion(); + this.useChangeSets = props.useChangeSets ?? true; + this.stackOutputs = new StackOutputsMap(this); + } + + /** + * The CodeBuild project that performs the Synth + * + * Only available after the pipeline has been built. + */ + public get synthProject(): cb.IProject { + if (!this._synthProject) { + throw new Error('Call pipeline.buildPipeline() before reading this property'); + } + return this._synthProject; + } + + /** + * The CodeBuild project that performs the SelfMutation + * + * Will throw an error if this is accessed before `buildPipeline()` + * is called, or if selfMutation has been disabled. + */ + public get selfMutationProject(): cb.IProject { + if (!this._pipeline) { + throw new Error('Call pipeline.buildPipeline() before reading this property'); + } + if (!this._selfMutationProject) { + throw new Error('No selfMutationProject since the selfMutation property was set to false'); + } + return this._selfMutationProject; + } + + /** + * The CodePipeline pipeline that deploys the CDK app + * + * Only available after the pipeline has been built. + */ + public get pipeline(): cp.Pipeline { + if (!this._pipeline) { + throw new Error('Pipeline not created yet'); + } + return this._pipeline; + } + + + protected doBuildPipeline(): void { + if (this._pipeline) { + throw new Error('Pipeline already created'); + } + + this._myCxAsmRoot = path.resolve(assemblyBuilderOf(appOf(this)).outdir); + + if (this.props.codePipeline) { + if (this.props.pipelineName) { + throw new Error('Cannot set \'pipelineName\' if an existing CodePipeline is given using \'codePipeline\''); + } + if (this.props.crossAccountKeys !== undefined) { + throw new Error('Cannot set \'crossAccountKeys\' if an existing CodePipeline is given using \'codePipeline\''); + } + if (this.props.enableKeyRotation !== undefined) { + throw new Error('Cannot set \'enableKeyRotation\' if an existing CodePipeline is given using \'codePipeline\''); + } + if (this.props.reuseCrossRegionSupportStacks !== undefined) { + throw new Error('Cannot set \'reuseCrossRegionSupportStacks\' if an existing CodePipeline is given using \'codePipeline\''); + } + if (this.props.role !== undefined) { + throw new Error('Cannot set \'role\' if an existing CodePipeline is given using \'codePipeline\''); + } + + this._pipeline = this.props.codePipeline; + } else { + this._pipeline = new cp.Pipeline(this, 'Pipeline', { + pipelineName: this.props.pipelineName, + crossAccountKeys: this.props.crossAccountKeys ?? false, + reuseCrossRegionSupportStacks: this.props.reuseCrossRegionSupportStacks, + // This is necessary to make self-mutation work (deployments are guaranteed + // to happen only after the builds of the latest pipeline definition). + restartExecutionOnUpdate: true, + role: this.props.role, + enableKeyRotation: this.props.enableKeyRotation, + }); + } + + const graphFromBp = new PipelineGraph(this, { + selfMutation: this.selfMutationEnabled, + singlePublisherPerAssetType: this.singlePublisherPerAssetType, + prepareStep: this.useChangeSets, + }); + this._cloudAssemblyFileSet = graphFromBp.cloudAssemblyFileSet; + + this.pipelineStagesAndActionsFromGraph(graphFromBp); + + // Write a dotfile for the pipeline layout + const dotFile = `${Names.uniqueId(this)}.dot`; + fs.writeFileSync(path.join(this.myCxAsmRoot, dotFile), graphFromBp.graph.renderDot().replace(/input\.dot/, dotFile), { encoding: 'utf-8' }); + } + + private get myCxAsmRoot(): string { + if (!this._myCxAsmRoot) { + throw new Error('Can\'t read \'myCxAsmRoot\' if build deployment not called yet'); + } + return this._myCxAsmRoot; + } + + /** + * Scope for Assets-related resources. + * + * Purely exists for construct tree backwards compatibility with legacy pipelines + */ + private get assetsScope(): Construct { + return obtainScope(this, 'Assets'); + } + + private pipelineStagesAndActionsFromGraph(structure: PipelineGraph) { + // Translate graph into Pipeline Stages and Actions + let beforeSelfMutation = this.selfMutationEnabled; + for (const stageNode of flatten(structure.graph.sortedChildren())) { + if (!isGraph(stageNode)) { + throw new Error(`Top-level children must be graphs, got '${stageNode}'`); + } + + // Group our ordered tranches into blocks of 50. + // We can map these onto stages without exceeding the capacity of a Stage. + const chunks = chunkTranches(50, stageNode.sortedLeaves()); + const actionsOverflowStage = chunks.length > 1; + for (const [i, tranches] of enumerate(chunks)) { + const stageName = actionsOverflowStage ? `${stageNode.id}.${i + 1}` : stageNode.id; + const pipelineStage = this.pipeline.addStage({ stageName }); + + const sharedParent = new GraphNodeCollection(flatten(tranches)).commonAncestor(); + + let runOrder = 1; + for (const tranche of tranches) { + const runOrdersConsumed = [0]; + + for (const node of tranche) { + const factory = this.actionFromNode(node); + + const nodeType = this.nodeTypeFromNode(node); + const name = actionName(node, sharedParent); + + const variablesNamespace = node.data?.type === 'step' + ? namespaceStepOutputs(node.data.step, pipelineStage, name) + : undefined; + + const result = factory.produceAction(pipelineStage, { + actionName: name, + runOrder, + artifacts: this.artifacts, + scope: obtainScope(this.pipeline, stageName), + fallbackArtifact: this._fallbackArtifact, + pipeline: this, + // If this step happens to produce a CodeBuild job, set the default options + codeBuildDefaults: nodeType ? this.codeBuildDefaultsFor(nodeType) : undefined, + beforeSelfMutation, + variablesNamespace, + stackOutputsMap: this.stackOutputs, + }); + + if (node.data?.type === 'self-update') { + beforeSelfMutation = false; + } + + this.postProcessNode(node, result); + + runOrdersConsumed.push(result.runOrdersConsumed); + } + + runOrder += Math.max(...runOrdersConsumed); + } + } + } + } + + /** + * Do additional things after the action got added to the pipeline + * + * Some minor state manipulation of CodeBuild projects and pipeline + * artifacts. + */ + private postProcessNode(node: AGraphNode, result: CodePipelineActionFactoryResult) { + const nodeType = this.nodeTypeFromNode(node); + + if (result.project) { + const dockerUsage = dockerUsageFromCodeBuild(nodeType ?? CodeBuildProjectType.STEP); + if (dockerUsage) { + for (const c of this.dockerCredentials) { + c.grantRead(result.project, dockerUsage); + } + } + + if (nodeType === CodeBuildProjectType.SYNTH) { + this._synthProject = result.project; + } + if (nodeType === CodeBuildProjectType.SELF_MUTATE) { + this._selfMutationProject = result.project; + } + } + + if (node.data?.type === 'step' && node.data.step.primaryOutput?.primaryOutput && !this._fallbackArtifact) { + this._fallbackArtifact = this.artifacts.toCodePipeline(node.data.step.primaryOutput?.primaryOutput); + } + } + + /** + * Make an action from the given node and/or step + */ + private actionFromNode(node: AGraphNode): ICodePipelineActionFactory { + switch (node.data?.type) { + // Nothing for these, they are groupings (shouldn't even have popped up here) + case 'group': + case 'stack-group': + case undefined: + throw new Error(`actionFromNode: did not expect to get group nodes: ${node.data?.type}`); + + case 'self-update': + return this.selfMutateAction(); + + case 'publish-assets': + return this.publishAssetsAction(node, node.data.assets); + + case 'prepare': + return this.createChangeSetAction(node.data.stack); + + case 'execute': + return node.data.withoutChangeSet + ? this.executeDeploymentAction(node.data.stack, node.data.captureOutputs) + : this.executeChangeSetAction(node.data.stack, node.data.captureOutputs); + + case 'step': + return this.actionFromStep(node, node.data.step); + + default: + throw new Error(`CodePipeline does not support graph nodes of type '${node.data?.type}'. You are probably using a feature this CDK Pipelines implementation does not support.`); + } + } + + /** + * Take a Step and turn it into a CodePipeline Action + * + * There are only 3 types of Steps we need to support: + * + * - Shell (generic) + * - ManualApproval (generic) + * - CodePipelineActionFactory (CodePipeline-specific) + * + * The rest is expressed in terms of these 3, or in terms of graph nodes + * which are handled elsewhere. + */ + private actionFromStep(node: AGraphNode, step: Step): ICodePipelineActionFactory { + const nodeType = this.nodeTypeFromNode(node); + + // CodePipeline-specific steps first -- this includes Sources + if (isCodePipelineActionFactory(step)) { + return step; + } + + // Now built-in steps + if (step instanceof ShellStep || step instanceof CodeBuildStep) { + // The 'CdkBuildProject' will be the construct ID of the CodeBuild project, necessary for backwards compat + let constructId = nodeType === CodeBuildProjectType.SYNTH + ? 'CdkBuildProject' + : step.id; + + return step instanceof CodeBuildStep + ? CodeBuildFactory.fromCodeBuildStep(constructId, step) + : CodeBuildFactory.fromShellStep(constructId, step); + } + + if (step instanceof ManualApprovalStep) { + return { + produceAction: (stage, options) => { + stage.addAction(new cpa.ManualApprovalAction({ + actionName: options.actionName, + runOrder: options.runOrder, + additionalInformation: step.comment, + })); + return { runOrdersConsumed: 1 }; + }, + }; + } + + throw new Error(`Deployment step '${step}' is not supported for CodePipeline-backed pipelines`); + } + + private createChangeSetAction(stack: StackDeployment): ICodePipelineActionFactory { + const changeSetName = 'PipelineChange'; + + const templateArtifact = this.artifacts.toCodePipeline(this._cloudAssemblyFileSet!); + const templateConfigurationPath = this.writeTemplateConfiguration(stack); + + const region = stack.region !== Stack.of(this).region ? stack.region : undefined; + const account = stack.account !== Stack.of(this).account ? stack.account : undefined; + + const relativeTemplatePath = path.relative(this.myCxAsmRoot, stack.absoluteTemplatePath); + + return { + produceAction: (stage, options) => { + stage.addAction(new cpa.CloudFormationCreateReplaceChangeSetAction({ + actionName: options.actionName, + runOrder: options.runOrder, + changeSetName, + stackName: stack.stackName, + templatePath: templateArtifact.atPath(toPosixPath(relativeTemplatePath)), + adminPermissions: true, + role: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.assumeRoleArn), + deploymentRole: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.executionRoleArn), + region: region, + templateConfiguration: templateConfigurationPath + ? templateArtifact.atPath(toPosixPath(templateConfigurationPath)) + : undefined, + cfnCapabilities: [CfnCapabilities.NAMED_IAM, CfnCapabilities.AUTO_EXPAND], + })); + return { runOrdersConsumed: 1 }; + }, + }; + } + + private executeChangeSetAction(stack: StackDeployment, captureOutputs: boolean): ICodePipelineActionFactory { + const changeSetName = 'PipelineChange'; + + const region = stack.region !== Stack.of(this).region ? stack.region : undefined; + const account = stack.account !== Stack.of(this).account ? stack.account : undefined; + + return { + produceAction: (stage, options) => { + stage.addAction(new cpa.CloudFormationExecuteChangeSetAction({ + actionName: options.actionName, + runOrder: options.runOrder, + changeSetName, + stackName: stack.stackName, + role: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.assumeRoleArn), + region: region, + variablesNamespace: captureOutputs ? stackVariableNamespace(stack) : undefined, + })); + + return { runOrdersConsumed: 1 }; + }, + }; + } + + private executeDeploymentAction(stack: StackDeployment, captureOutputs: boolean): ICodePipelineActionFactory { + const templateArtifact = this.artifacts.toCodePipeline(this._cloudAssemblyFileSet!); + const templateConfigurationPath = this.writeTemplateConfiguration(stack); + + const region = stack.region !== Stack.of(this).region ? stack.region : undefined; + const account = stack.account !== Stack.of(this).account ? stack.account : undefined; + + const relativeTemplatePath = path.relative(this.myCxAsmRoot, stack.absoluteTemplatePath); + + return { + produceAction: (stage, options) => { + stage.addAction(new cpa.CloudFormationCreateUpdateStackAction({ + actionName: options.actionName, + runOrder: options.runOrder, + stackName: stack.stackName, + templatePath: templateArtifact.atPath(toPosixPath(relativeTemplatePath)), + adminPermissions: true, + role: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.assumeRoleArn), + deploymentRole: this.roleFromPlaceholderArn(this.pipeline, region, account, stack.executionRoleArn), + region: region, + templateConfiguration: templateConfigurationPath + ? templateArtifact.atPath(toPosixPath(templateConfigurationPath)) + : undefined, + cfnCapabilities: [CfnCapabilities.NAMED_IAM, CfnCapabilities.AUTO_EXPAND], + variablesNamespace: captureOutputs ? stackVariableNamespace(stack) : undefined, + })); + + return { runOrdersConsumed: 1 }; + }, + }; + } + + private selfMutateAction(): ICodePipelineActionFactory { + const installSuffix = this.cliVersion ? `@${this.cliVersion}` : ''; + + const pipelineStack = Stack.of(this.pipeline); + const pipelineStackIdentifier = pipelineStack.node.path ?? pipelineStack.stackName; + + const step = new CodeBuildStep('SelfMutate', { + projectName: maybeSuffix(this.props.pipelineName, '-selfupdate'), + input: this._cloudAssemblyFileSet, + installCommands: [ + `npm install -g aws-cdk${installSuffix}`, + ], + commands: [ + `cdk -a ${toPosixPath(embeddedAsmPath(this.pipeline))} deploy ${pipelineStackIdentifier} --require-approval=never --verbose`, + ], + + rolePolicyStatements: [ + // allow the self-mutating project permissions to assume the bootstrap Action role + new iam.PolicyStatement({ + actions: ['sts:AssumeRole'], + resources: [`arn:*:iam::${Stack.of(this.pipeline).account}:role/*`], + conditions: { + 'ForAnyValue:StringEquals': { + 'iam:ResourceTag/aws-cdk:bootstrap-role': ['image-publishing', 'file-publishing', 'deploy'], + }, + }, + }), + new iam.PolicyStatement({ + actions: ['cloudformation:DescribeStacks'], + resources: ['*'], // this is needed to check the status of the bootstrap stack when doing `cdk deploy` + }), + // S3 checks for the presence of the ListBucket permission + new iam.PolicyStatement({ + actions: ['s3:ListBucket'], + resources: ['*'], + }), + ], + }); + + // Different on purpose -- id needed for backwards compatible LogicalID + return CodeBuildFactory.fromCodeBuildStep('SelfMutation', step, { + additionalConstructLevel: false, + scope: obtainScope(this, 'UpdatePipeline'), + }); + } + + private publishAssetsAction(node: AGraphNode, assets: StackAsset[]): ICodePipelineActionFactory { + const installSuffix = this.cliVersion ? `@${this.cliVersion}` : ''; + + const commands = assets.map(asset => { + const relativeAssetManifestPath = path.relative(this.myCxAsmRoot, asset.assetManifestPath); + return `cdk-assets --path "${toPosixPath(relativeAssetManifestPath)}" --verbose publish "${asset.assetSelector}"`; + }); + + const assetType = assets[0].assetType; + if (assets.some(a => a.assetType !== assetType)) { + throw new Error('All assets in a single publishing step must be of the same type'); + } + + const role = this.obtainAssetCodeBuildRole(assets[0].assetType); + + for (const roleArn of assets.flatMap(a => a.assetPublishingRoleArn ? [a.assetPublishingRoleArn] : [])) { + // The ARNs include raw AWS pseudo parameters (e.g., ${AWS::Partition}), which need to be substituted. + role.addAssumeRole(this.cachedFnSub.fnSub(roleArn)); + }; + + // The base commands that need to be run + const script = new CodeBuildStep(node.id, { + commands, + installCommands: [ + `npm install -g cdk-assets${installSuffix}`, + ], + input: this._cloudAssemblyFileSet, + buildEnvironment: { + privileged: assets.some(asset => asset.assetType === AssetType.DOCKER_IMAGE), + }, + role, + }); + + // Customizations that are not accessible to regular users + return CodeBuildFactory.fromCodeBuildStep(node.id, script, { + additionalConstructLevel: false, + + // If we use a single publisher, pass buildspec via file otherwise it'll + // grow too big. + passBuildSpecViaCloudAssembly: this.singlePublisherPerAssetType, + scope: this.assetsScope, + }); + } + + private nodeTypeFromNode(node: AGraphNode) { + if (node.data?.type === 'step') { + return !!node.data?.isBuildStep ? CodeBuildProjectType.SYNTH : CodeBuildProjectType.STEP; + } + if (node.data?.type === 'publish-assets') { + return CodeBuildProjectType.ASSETS; + } + if (node.data?.type === 'self-update') { + return CodeBuildProjectType.SELF_MUTATE; + } + return undefined; + } + + private codeBuildDefaultsFor(nodeType: CodeBuildProjectType): CodeBuildOptions | undefined { + const defaultOptions: CodeBuildOptions = { + buildEnvironment: { + buildImage: CDKP_DEFAULT_CODEBUILD_IMAGE, + computeType: cb.ComputeType.SMALL, + }, + }; + + const typeBasedCustomizations = { + [CodeBuildProjectType.SYNTH]: this.props.dockerEnabledForSynth + ? mergeCodeBuildOptions(this.props.synthCodeBuildDefaults, { buildEnvironment: { privileged: true } }) + : this.props.synthCodeBuildDefaults, + + [CodeBuildProjectType.ASSETS]: this.props.assetPublishingCodeBuildDefaults, + + [CodeBuildProjectType.SELF_MUTATE]: this.props.dockerEnabledForSelfMutation + ? mergeCodeBuildOptions(this.props.selfMutationCodeBuildDefaults, { buildEnvironment: { privileged: true } }) + : this.props.selfMutationCodeBuildDefaults, + + [CodeBuildProjectType.STEP]: {}, + }; + + const dockerUsage = dockerUsageFromCodeBuild(nodeType); + const dockerCommands = dockerUsage !== undefined + ? dockerCredentialsInstallCommands(dockerUsage, this.dockerCredentials, 'both') + : []; + const typeBasedDockerCommands = dockerCommands.length > 0 ? { + partialBuildSpec: cb.BuildSpec.fromObject({ + version: '0.2', + phases: { + pre_build: { + commands: dockerCommands, + }, + }, + }), + } : {}; + + return mergeCodeBuildOptions( + defaultOptions, + this.props.codeBuildDefaults, + typeBasedCustomizations[nodeType], + typeBasedDockerCommands, + ); + } + + private roleFromPlaceholderArn(scope: Construct, region: string | undefined, + account: string | undefined, arn: string): iam.IRole; + private roleFromPlaceholderArn(scope: Construct, region: string | undefined, + account: string | undefined, arn: string | undefined): iam.IRole | undefined; + private roleFromPlaceholderArn(scope: Construct, region: string | undefined, + account: string | undefined, arn: string | undefined): iam.IRole | undefined { + + if (!arn) { return undefined; } + + // Use placeholder arn as construct ID. + const id = arn; + + // https://github.com/aws/aws-cdk/issues/7255 + let existingRole = scope.node.tryFindChild(`ImmutableRole${id}`) as iam.IRole; + if (existingRole) { return existingRole; } + // For when #7255 is fixed. + existingRole = scope.node.tryFindChild(id) as iam.IRole; + if (existingRole) { return existingRole; } + + const arnToImport = cxapi.EnvironmentPlaceholders.replace(arn, { + region: region ?? Aws.REGION, + accountId: account ?? Aws.ACCOUNT_ID, + partition: Aws.PARTITION, + }); + return iam.Role.fromRoleArn(scope, id, arnToImport, { mutable: false, addGrantsToResources: true }); + } + + /** + * Non-template config files for CodePipeline actions + * + * Currently only supports tags. + */ + private writeTemplateConfiguration(stack: StackDeployment): string | undefined { + if (Object.keys(stack.tags).length === 0) { return undefined; } + + const absConfigPath = `${stack.absoluteTemplatePath}.config.json`; + const relativeConfigPath = path.relative(this.myCxAsmRoot, absConfigPath); + + // Write the template configuration file (for parameters into CreateChangeSet call that + // cannot be configured any other way). They must come from a file, and there's unfortunately + // no better hook to write this file (`construct.onSynthesize()` would have been the prime candidate + // but that is being deprecated--and DeployCdkStackAction isn't even a construct). + writeTemplateConfiguration(absConfigPath, { + Tags: noUndefined(stack.tags), + }); + + return relativeConfigPath; + } + + /** + * This role is used by both the CodePipeline build action and related CodeBuild project. Consolidating these two + * roles into one, and re-using across all assets, saves significant size of the final synthesized output. + * Modeled after the CodePipeline role and 'CodePipelineActionRole' roles. + * Generates one role per asset type to separate file and Docker/image-based permissions. + */ + private obtainAssetCodeBuildRole(assetType: AssetType): AssetSingletonRole { + const existing = this.assetCodeBuildRoles.get(assetType); + if (existing) { + return existing; + } + + const stack = Stack.of(this); + + const rolePrefix = assetType === AssetType.DOCKER_IMAGE ? 'Docker' : 'File'; + const assetRole = new AssetSingletonRole(this.assetsScope, `${rolePrefix}Role`, { + roleName: PhysicalName.GENERATE_IF_NEEDED, + assumedBy: new iam.CompositePrincipal( + new iam.ServicePrincipal('codebuild.amazonaws.com'), + new iam.AccountPrincipal(stack.account), + ), + }); + + // Grant pull access for any ECR registries and secrets that exist + if (assetType === AssetType.DOCKER_IMAGE) { + this.dockerCredentials.forEach(reg => reg.grantRead(assetRole, DockerCredentialUsage.ASSET_PUBLISHING)); + } + + this.assetCodeBuildRoles.set(assetType, assetRole); + return assetRole; + } + +} + +function dockerUsageFromCodeBuild(cbt: CodeBuildProjectType): DockerCredentialUsage | undefined { + switch (cbt) { + case CodeBuildProjectType.ASSETS: return DockerCredentialUsage.ASSET_PUBLISHING; + case CodeBuildProjectType.SELF_MUTATE: return DockerCredentialUsage.SELF_UPDATE; + case CodeBuildProjectType.SYNTH: return DockerCredentialUsage.SYNTH; + case CodeBuildProjectType.STEP: return undefined; + } +} + +enum CodeBuildProjectType { + SYNTH = 'SYNTH', + ASSETS = 'ASSETS', + SELF_MUTATE = 'SELF_MUTATE', + STEP = 'STEP', +} + +/** + * Take a set of tranches and split them up into groups so + * that no set of tranches has more than n items total + */ +function chunkTranches
(n: number, xss: A[][]): A[][][] { + const ret: A[][][] = []; + + while (xss.length > 0) { + const tranches: A[][] = []; + let count = 0; + + while (xss.length > 0) { + const xs = xss[0]; + const spaceRemaining = n - count; + if (xs.length <= spaceRemaining) { + tranches.push(xs); + count += xs.length; + xss.shift(); + } else { + tranches.push(xs.splice(0, spaceRemaining)); + count = n; + break; + } + } + + ret.push(tranches); + } + + + return ret; +} + +function isCodePipelineActionFactory(x: any): x is ICodePipelineActionFactory { + return !!(x as ICodePipelineActionFactory).produceAction; +} diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/confirm-permissions-broadening.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/confirm-permissions-broadening.ts similarity index 94% rename from packages/@aws-cdk/pipelines/lib/codepipeline/confirm-permissions-broadening.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/confirm-permissions-broadening.ts index b14dee628d988..7811cf8854f55 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/confirm-permissions-broadening.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/confirm-permissions-broadening.ts @@ -1,7 +1,7 @@ -import { IStage } from '@aws-cdk/aws-codepipeline'; -import * as cpa from '@aws-cdk/aws-codepipeline-actions'; -import * as sns from '@aws-cdk/aws-sns'; -import { Stage } from '@aws-cdk/core'; +import { IStage } from '../../../aws-codepipeline'; +import * as cpa from '../../../aws-codepipeline-actions'; +import * as sns from '../../../aws-sns'; +import { Stage } from '../../../core'; import { Node } from 'constructs'; import { CodePipeline } from './codepipeline'; import { CodePipelineActionFactoryResult, ICodePipelineActionFactory, ProduceActionOptions } from './codepipeline-action-factory'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/index.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/codepipeline/index.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/private/buildspecs.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/private/buildspecs.ts similarity index 89% rename from packages/@aws-cdk/pipelines/lib/codepipeline/private/buildspecs.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/private/buildspecs.ts index f904d7c174629..4541c7ce50250 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/private/buildspecs.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/private/buildspecs.ts @@ -1,4 +1,4 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; +import * as codebuild from '../../../../aws-codebuild'; export function mergeBuildSpecs(a: codebuild.BuildSpec, b?: codebuild.BuildSpec): codebuild.BuildSpec; export function mergeBuildSpecs(a: codebuild.BuildSpec | undefined, b: codebuild.BuildSpec): codebuild.BuildSpec; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/private/codebuild-factory.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/private/codebuild-factory.ts similarity index 98% rename from packages/@aws-cdk/pipelines/lib/codepipeline/private/codebuild-factory.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/private/codebuild-factory.ts index b062c6ba4fa43..ff0f5bab2cc91 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/private/codebuild-factory.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/private/codebuild-factory.ts @@ -1,11 +1,11 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import { Stack, Token } from '@aws-cdk/core'; +import * as codebuild from '../../../../aws-codebuild'; +import * as codepipeline from '../../../../aws-codepipeline'; +import * as codepipeline_actions from '../../../../aws-codepipeline-actions'; +import * as ec2 from '../../../../aws-ec2'; +import * as iam from '../../../../aws-iam'; +import { Stack, Token } from '../../../../core'; import { Construct, IDependable, Node } from 'constructs'; import { mergeBuildSpecs } from './buildspecs'; import { FileSetLocation, ShellStep, StackOutputReference } from '../../blueprint'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/private/outputs.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/private/outputs.ts similarity index 96% rename from packages/@aws-cdk/pipelines/lib/codepipeline/private/outputs.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/private/outputs.ts index f721cb3e5212e..d4cee13fa0152 100644 --- a/packages/@aws-cdk/pipelines/lib/codepipeline/private/outputs.ts +++ b/packages/aws-cdk-lib/pipelines/lib/codepipeline/private/outputs.ts @@ -1,4 +1,4 @@ -import * as cp from '@aws-cdk/aws-codepipeline'; +import * as cp from '../../../../aws-codepipeline'; import { Step } from '../../blueprint/step'; import { StepOutput } from '../../helpers-internal'; diff --git a/packages/@aws-cdk/pipelines/lib/codepipeline/stack-outputs-map.ts b/packages/aws-cdk-lib/pipelines/lib/codepipeline/stack-outputs-map.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/codepipeline/stack-outputs-map.ts rename to packages/aws-cdk-lib/pipelines/lib/codepipeline/stack-outputs-map.ts diff --git a/packages/@aws-cdk/pipelines/lib/docker-credentials.ts b/packages/aws-cdk-lib/pipelines/lib/docker-credentials.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/docker-credentials.ts rename to packages/aws-cdk-lib/pipelines/lib/docker-credentials.ts index 05144d4957771..397c04c8fd6be 100644 --- a/packages/@aws-cdk/pipelines/lib/docker-credentials.ts +++ b/packages/aws-cdk-lib/pipelines/lib/docker-credentials.ts @@ -1,8 +1,8 @@ -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as secretsmanager from '@aws-cdk/aws-secretsmanager'; -import { Fn } from '@aws-cdk/core'; +import * as ec2 from '../../aws-ec2'; +import * as ecr from '../../aws-ecr'; +import * as iam from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; +import { Fn } from '../../core'; /** * Represents credentials used to access a Docker registry. diff --git a/packages/@aws-cdk/pipelines/lib/helpers-internal/graph.ts b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/graph.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/helpers-internal/graph.ts rename to packages/aws-cdk-lib/pipelines/lib/helpers-internal/graph.ts diff --git a/packages/@aws-cdk/pipelines/lib/helpers-internal/index.ts b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/helpers-internal/index.ts rename to packages/aws-cdk-lib/pipelines/lib/helpers-internal/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/helpers-internal/pipeline-graph.ts b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/pipeline-graph.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/helpers-internal/pipeline-graph.ts rename to packages/aws-cdk-lib/pipelines/lib/helpers-internal/pipeline-graph.ts diff --git a/packages/@aws-cdk/pipelines/lib/helpers-internal/pipeline-queries.ts b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/pipeline-queries.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/helpers-internal/pipeline-queries.ts rename to packages/aws-cdk-lib/pipelines/lib/helpers-internal/pipeline-queries.ts diff --git a/packages/@aws-cdk/pipelines/lib/helpers-internal/step-output.ts b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/step-output.ts similarity index 99% rename from packages/@aws-cdk/pipelines/lib/helpers-internal/step-output.ts rename to packages/aws-cdk-lib/pipelines/lib/helpers-internal/step-output.ts index 1ac53575acafe..0c9bb2c646084 100644 --- a/packages/@aws-cdk/pipelines/lib/helpers-internal/step-output.ts +++ b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/step-output.ts @@ -1,4 +1,4 @@ -import { IResolvable, IResolveContext, Token, Tokenization } from '@aws-cdk/core'; +import { IResolvable, IResolveContext, Token, Tokenization } from '../../../core'; import { Step } from '../blueprint/step'; diff --git a/packages/@aws-cdk/pipelines/lib/helpers-internal/toposort.ts b/packages/aws-cdk-lib/pipelines/lib/helpers-internal/toposort.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/helpers-internal/toposort.ts rename to packages/aws-cdk-lib/pipelines/lib/helpers-internal/toposort.ts diff --git a/packages/@aws-cdk/pipelines/lib/index.ts b/packages/aws-cdk-lib/pipelines/lib/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/index.ts rename to packages/aws-cdk-lib/pipelines/lib/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/legacy/actions/deploy-cdk-stack-action.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/deploy-cdk-stack-action.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/legacy/actions/deploy-cdk-stack-action.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/actions/deploy-cdk-stack-action.ts index da0b21a99bd1f..8602cf078d41e 100644 --- a/packages/@aws-cdk/pipelines/lib/legacy/actions/deploy-cdk-stack-action.ts +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/deploy-cdk-stack-action.ts @@ -1,11 +1,11 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cpactions from '@aws-cdk/aws-codepipeline-actions'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { Aws, CfnCapabilities, Stack } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import * as codepipeline from '../../../../aws-codepipeline'; +import * as cpactions from '../../../../aws-codepipeline-actions'; +import * as events from '../../../../aws-events'; +import * as iam from '../../../../aws-iam'; +import { Aws, CfnCapabilities, Stack } from '../../../../core'; +import * as cxapi from '../../../../cx-api'; import { Construct, Node } from 'constructs'; import { appOf, assemblyBuilderOf } from '../../private/construct-internals'; import { toPosixPath } from '../../private/fs'; diff --git a/packages/@aws-cdk/pipelines/lib/legacy/actions/index.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/legacy/actions/index.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/actions/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/legacy/actions/publish-assets-action.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/publish-assets-action.ts similarity index 95% rename from packages/@aws-cdk/pipelines/lib/legacy/actions/publish-assets-action.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/actions/publish-assets-action.ts index 283e995229a37..bb7f53dce2f54 100644 --- a/packages/@aws-cdk/pipelines/lib/legacy/actions/publish-assets-action.ts +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/publish-assets-action.ts @@ -1,12 +1,12 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { ISynthesisSession, Lazy, Stack, attachCustomSynthesis } from '@aws-cdk/core'; +import * as codebuild from '../../../../aws-codebuild'; +import * as codepipeline from '../../../../aws-codepipeline'; +import * as codepipeline_actions from '../../../../aws-codepipeline-actions'; +import * as ec2 from '../../../../aws-ec2'; +import * as events from '../../../../aws-events'; +import * as iam from '../../../../aws-iam'; +import { ISynthesisSession, Lazy, Stack, attachCustomSynthesis } from '../../../../core'; import { IDependable, Construct } from 'constructs'; import { AssetType } from '../../blueprint/asset-type'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../private/default-codebuild-image'; diff --git a/packages/@aws-cdk/pipelines/lib/legacy/actions/update-pipeline-action.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/update-pipeline-action.ts similarity index 94% rename from packages/@aws-cdk/pipelines/lib/legacy/actions/update-pipeline-action.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/actions/update-pipeline-action.ts index 0bd6ff52543fc..76e01645dc1ef 100644 --- a/packages/@aws-cdk/pipelines/lib/legacy/actions/update-pipeline-action.ts +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/actions/update-pipeline-action.ts @@ -1,9 +1,9 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as cpactions from '@aws-cdk/aws-codepipeline-actions'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import * as codebuild from '../../../../aws-codebuild'; +import * as codepipeline from '../../../../aws-codepipeline'; +import * as cpactions from '../../../../aws-codepipeline-actions'; +import * as events from '../../../../aws-events'; +import * as iam from '../../../../aws-iam'; +import { Stack } from '../../../../core'; import { Construct } from 'constructs'; import { dockerCredentialsInstallCommands, DockerCredential, DockerCredentialUsage } from '../../docker-credentials'; import { embeddedAsmPath } from '../../private/construct-internals'; diff --git a/packages/@aws-cdk/pipelines/lib/legacy/index.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/legacy/index.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/index.ts diff --git a/packages/aws-cdk-lib/pipelines/lib/legacy/pipeline.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/pipeline.ts new file mode 100644 index 0000000000000..5d1a3832f2dbb --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/pipeline.ts @@ -0,0 +1,626 @@ +import * as path from 'path'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import { Annotations, App, CfnOutput, PhysicalName, Stack, Stage } from '../../../core'; +import { Construct } from 'constructs'; +import { DeployCdkStackAction, PublishAssetsAction, UpdatePipelineAction } from './actions'; +import { AddStageOptions, AssetPublishingCommand, BaseStageOptions, CdkStage, StackOutput } from './stage'; +import { SimpleSynthAction } from './synths'; +import { AssetType } from '../blueprint/asset-type'; +import { dockerCredentialsInstallCommands, DockerCredential, DockerCredentialUsage } from '../docker-credentials'; +import { ApplicationSecurityCheck } from '../private/application-security-check'; +import { AssetSingletonRole } from '../private/asset-singleton-role'; +import { CachedFnSub } from '../private/cached-fnsub'; +import { preferredCliVersion } from '../private/cli-version'; +import { appOf, assemblyBuilderOf } from '../private/construct-internals'; + +const CODE_BUILD_LENGTH_LIMIT = 100; +/** + * Properties for a CdkPipeline + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface CdkPipelineProps { + /** + * The CodePipeline action used to retrieve the CDK app's source + * + * @default - Required unless `codePipeline` is given + */ + readonly sourceAction?: codepipeline.IAction; + + /** + * The CodePipeline action build and synthesis step of the CDK app + * + * @default - Required unless `codePipeline` or `sourceAction` is given + */ + readonly synthAction?: codepipeline.IAction; + + /** + * The artifact you have defined to be the artifact to hold the cloudAssemblyArtifact for the synth action + */ + readonly cloudAssemblyArtifact: codepipeline.Artifact; + + /** + * Existing CodePipeline to add deployment stages to + * + * Use this if you want more control over the CodePipeline that gets created. + * You can choose to not pass this value, in which case a new CodePipeline is + * created with default settings. + * + * If you pass an existing CodePipeline, it should have been created + * with `restartExecutionOnUpdate: true`. + * + * [disable-awslint:ref-via-interface] + * + * @default - A new CodePipeline is automatically generated + */ + readonly codePipeline?: codepipeline.Pipeline; + + /** + * Name of the pipeline + * + * Can only be set if `codePipeline` is not set. + * + * @default - A name is automatically generated + */ + readonly pipelineName?: string; + + /** + * Create KMS keys for cross-account deployments + * + * This controls whether the pipeline is enabled for cross-account deployments. + * + * Can only be set if `codePipeline` is not set. + * + * By default cross-account deployments are enabled, but this feature requires + * that KMS Customer Master Keys are created which have a cost of $1/month. + * + * If you do not need cross-account deployments, you can set this to `false` to + * not create those keys and save on that cost (the artifact bucket will be + * encrypted with an AWS-managed key). However, cross-account deployments will + * no longer be possible. + * + * @default true + */ + readonly crossAccountKeys?: boolean; + // @deprecated(v2): switch to default false + + + /** + * Enables KMS key rotation for cross-account keys. + * + * Cannot be set if `crossAccountKeys` was set to `false`. + * + * Key rotation costs $1/month when enabled. + * + * @default - false (key rotation is disabled) + */ + readonly enableKeyRotation?: boolean; + + + /** + * CDK CLI version to use in pipeline + * + * Some Actions in the pipeline will download and run a version of the CDK + * CLI. Specify the version here. + * + * @default - Latest version + */ + readonly cdkCliVersion?: string; + + /** + * The VPC where to execute the CdkPipeline actions. + * + * @default - No VPC + */ + readonly vpc?: ec2.IVpc; + + /** + * Which subnets to use. + * + * Only used if 'vpc' is supplied. + * + * @default - All private subnets. + */ + readonly subnetSelection?: ec2.SubnetSelection; + + /** + * Whether the pipeline will update itself + * + * This needs to be set to `true` to allow the pipeline to reconfigure + * itself when assets or stages are being added to it, and `true` is the + * recommended setting. + * + * You can temporarily set this to `false` while you are iterating + * on the pipeline itself and prefer to deploy changes using `cdk deploy`. + * + * @default true + */ + readonly selfMutating?: boolean; + + /** + * Custom BuildSpec that is merged with generated one (for self-mutation stage) + * + * @default - none + */ + readonly selfMutationBuildSpec?: codebuild.BuildSpec; + + /** + * Whether this pipeline creates one asset upload action per asset type or one asset upload per asset + * + * @default false + */ + readonly singlePublisherPerType?: boolean; + + /** + * Additional commands to run before installing cdk-assets during the asset publishing step + * Use this to setup proxies or npm mirrors + * + * @default - + */ + readonly assetPreInstallCommands?: string[]; + + /** + * Custom BuildSpec that is merged with generated one (for asset publishing actions) + * + * @default - none + */ + readonly assetBuildSpec?: codebuild.BuildSpec; + + /** + * Whether the pipeline needs to build Docker images in the UpdatePipeline stage. + * + * If the UpdatePipeline stage tries to build a Docker image and this flag is not + * set to `true`, the build step will run in non-privileged mode and consequently + * will fail with a message like: + * + * > Cannot connect to the Docker daemon at unix:///var/run/docker.sock. + * > Is the docker daemon running? + * + * This flag has an effect only if `selfMutating` is also `true`. + * + * @default - false + */ + readonly supportDockerAssets?: boolean; + + /** + * A list of credentials used to authenticate to Docker registries. + * + * Specify any credentials necessary within the pipeline to build, synth, update, or publish assets. + * + * @default [] + */ + readonly dockerCredentials?: DockerCredential[]; +} + +/** + * A Pipeline to deploy CDK apps + * + * Defines an AWS CodePipeline-based Pipeline to deploy CDK applications. + * + * Automatically manages the following: + * + * - Stack dependency order. + * - Asset publishing. + * - Keeping the pipeline up-to-date as the CDK apps change. + * - Using stack outputs later on in the pipeline. + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export class CdkPipeline extends Construct { + private readonly _pipeline: codepipeline.Pipeline; + private readonly _assets: AssetPublishing; + private readonly _stages: CdkStage[] = []; + private readonly _outputArtifacts: Record = {}; + private readonly _cloudAssemblyArtifact: codepipeline.Artifact; + private readonly _dockerCredentials: DockerCredential[]; + private _applicationSecurityCheck?: ApplicationSecurityCheck; + private readonly cliVersion?: string; + + constructor(scope: Construct, id: string, props: CdkPipelineProps) { + super(scope, id); + this.cliVersion = props.cdkCliVersion ?? preferredCliVersion(); + + if (!App.isApp(this.node.root)) { + throw new Error('CdkPipeline must be created under an App'); + } + + this._cloudAssemblyArtifact = props.cloudAssemblyArtifact; + this._dockerCredentials = props.dockerCredentials ?? []; + const pipelineStack = Stack.of(this); + + if (props.codePipeline) { + if (props.pipelineName) { + throw new Error('Cannot set \'pipelineName\' if an existing CodePipeline is given using \'codePipeline\''); + } + if (props.crossAccountKeys !== undefined) { + throw new Error('Cannot set \'crossAccountKeys\' if an existing CodePipeline is given using \'codePipeline\''); + } + if (props.enableKeyRotation !== undefined) { + throw new Error('Cannot set \'enableKeyRotation\' if an existing CodePipeline is given using \'codePipeline\''); + } + + this._pipeline = props.codePipeline; + } else { + this._pipeline = new codepipeline.Pipeline(this, 'Pipeline', { + pipelineName: props.pipelineName, + crossAccountKeys: props.crossAccountKeys, + enableKeyRotation: props.enableKeyRotation, + restartExecutionOnUpdate: true, + }); + } + + if (props.sourceAction && !props.synthAction) { + // Because of ordering limitations, you can: bring your own Source, bring your own + // Both, or bring your own Nothing. You cannot bring your own Build (which because of the + // current CodePipeline API must go BEFORE what we're adding) and then having us add a + // Source after it. That doesn't make any sense. + throw new Error('When passing a \'sourceAction\' you must also pass a \'synthAction\' (or a \'codePipeline\' that already has both)'); + } + if (!props.sourceAction && (!props.codePipeline || props.codePipeline.stages.length < 1)) { + throw new Error('You must pass a \'sourceAction\' (or a \'codePipeline\' that already has a Source stage)'); + } + + if (props.sourceAction) { + this._pipeline.addStage({ + stageName: 'Source', + actions: [props.sourceAction], + }); + } + + if (props.synthAction) { + if (props.synthAction instanceof SimpleSynthAction && this._dockerCredentials.length > 0) { + props.synthAction._addDockerCredentials(this._dockerCredentials); + } + + this._pipeline.addStage({ + stageName: 'Build', + actions: [props.synthAction], + }); + } + + if (props.selfMutating ?? true) { + this._pipeline.addStage({ + stageName: 'UpdatePipeline', + actions: [new UpdatePipelineAction(this, 'UpdatePipeline', { + cloudAssemblyInput: this._cloudAssemblyArtifact, + pipelineStackHierarchicalId: pipelineStack.node.path, + cdkCliVersion: this.cliVersion, + projectName: maybeSuffix(props.pipelineName, '-selfupdate'), + privileged: props.supportDockerAssets, + dockerCredentials: this._dockerCredentials, + buildSpec: props.selfMutationBuildSpec, + })], + }); + } + + this._assets = new AssetPublishing(this, 'Assets', { + cloudAssemblyInput: this._cloudAssemblyArtifact, + cdkCliVersion: this.cliVersion, + pipeline: this._pipeline, + projectName: maybeSuffix(props.pipelineName, '-publish'), + vpc: props.vpc, + subnetSelection: props.subnetSelection, + singlePublisherPerType: props.singlePublisherPerType, + preInstallCommands: props.assetPreInstallCommands, + buildSpec: props.assetBuildSpec, + dockerCredentials: this._dockerCredentials, + }); + + this.node.addValidation({ validate: () => this.validatePipeline() }); + } + + /** + * The underlying CodePipeline object + * + * You can use this to add more Stages to the pipeline, or Actions + * to Stages. + */ + public get codePipeline(): codepipeline.Pipeline { + return this._pipeline; + } + + /** + * Access one of the pipeline's stages by stage name + * + * You can use this to add more Actions to a stage. + */ + public stage(stageName: string): codepipeline.IStage { + return this._pipeline.stage(stageName); + } + + /** + * Get a cached version of an Application Security Check, which consists of: + * - CodeBuild Project to check for security changes in a stage + * - Lambda Function that approves the manual approval if no security changes are detected + * + * @internal + */ + public _getApplicationSecurityCheck(): ApplicationSecurityCheck { + if (!this._applicationSecurityCheck) { + this._applicationSecurityCheck = new ApplicationSecurityCheck(this, 'PipelineApplicationSecurityCheck', { + codePipeline: this._pipeline, + }); + } + return this._applicationSecurityCheck; + } + + /** + * Add pipeline stage that will deploy the given application stage + * + * The application construct should subclass `Stage` and can contain any + * number of `Stacks` inside it that may have dependency relationships + * on one another. + * + * All stacks in the application will be deployed in the appropriate order, + * and all assets found in the application will be added to the asset + * publishing stage. + */ + public addApplicationStage(appStage: Stage, options: AddStageOptions = {}): CdkStage { + const stage = this.addStage(appStage.stageName, options); + stage.addApplication(appStage, options); + return stage; + } + + /** + * Add a new, empty stage to the pipeline + * + * Prefer to use `addApplicationStage` if you are intended to deploy a CDK + * application, but you can use this method if you want to add other kinds of + * Actions to a pipeline. + */ + public addStage(stageName: string, options?: BaseStageOptions) { + const pipelineStage = this._pipeline.addStage({ + stageName, + }); + + const stage = new CdkStage(this, stageName, { + cloudAssemblyArtifact: this._cloudAssemblyArtifact, + pipelineStage, + stageName, + host: { + publishAsset: this._assets.addPublishAssetAction.bind(this._assets), + stackOutputArtifact: (artifactId) => this._outputArtifacts[artifactId], + }, + ...options, + }); + this._stages.push(stage); + return stage; + } + + /** + * Get the StackOutput object that holds this CfnOutput's value in this pipeline + * + * `StackOutput` can be used in validation actions later in the pipeline. + */ + public stackOutput(cfnOutput: CfnOutput): StackOutput { + const stack = Stack.of(cfnOutput); + + if (!this._outputArtifacts[stack.artifactId]) { + // We should have stored the ArtifactPath in the map, but its Artifact + // property isn't publicly readable... + const artifactName = `${stack.artifactId}_Outputs`; + const compactName = artifactName.slice(artifactName.length - Math.min(artifactName.length, CODE_BUILD_LENGTH_LIMIT)); + this._outputArtifacts[stack.artifactId] = new codepipeline.Artifact(compactName); + } + + return new StackOutput(this._outputArtifacts[stack.artifactId].atPath('outputs.json'), cfnOutput.logicalId); + } + + /** + * Validate that we don't have any stacks violating dependency order in the pipeline + * + * Our own convenience methods will never generate a pipeline that does that (although + * this is a nice verification), but a user can also add the stacks by hand. + */ + private validatePipeline(): string[] { + const ret = new Array(); + + ret.push(...this.validateDeployOrder()); + ret.push(...this.validateRequestedOutputs()); + + return ret; + } + + /** + * Return all StackDeployActions in an ordered list + */ + private get stackActions(): DeployCdkStackAction[] { + return flatMap(this._pipeline.stages, s => s.actions.filter(isDeployAction)); + } + + private * validateDeployOrder(): IterableIterator { + const stackActions = this.stackActions; + for (const stackAction of stackActions) { + // For every dependency, it must be executed in an action before this one is prepared. + for (const depId of stackAction.dependencyStackArtifactIds) { + const depAction = stackActions.find(s => s.stackArtifactId === depId); + + if (depAction === undefined) { + Annotations.of(this).addWarning(`Stack '${stackAction.stackName}' depends on stack ` + + `'${depId}', but that dependency is not deployed through the pipeline!`); + } else if (!(depAction.executeRunOrder < stackAction.prepareRunOrder)) { + yield `Stack '${stackAction.stackName}' depends on stack ` + + `'${depAction.stackName}', but is deployed before it in the pipeline!`; + } + } + } + } + + private * validateRequestedOutputs(): IterableIterator { + const artifactIds = this.stackActions.map(s => s.stackArtifactId); + + for (const artifactId of Object.keys(this._outputArtifacts)) { + if (!artifactIds.includes(artifactId)) { + yield `Trying to use outputs for Stack '${artifactId}', but Stack is not deployed in this pipeline. Add it to the pipeline.`; + } + } + } +} + +function isDeployAction(a: codepipeline.IAction): a is DeployCdkStackAction { + return a instanceof DeployCdkStackAction; +} + +function flatMap(xs: A[], f: (x: A) => B[]): B[] { + return Array.prototype.concat([], ...xs.map(f)); +} + +interface AssetPublishingProps { + readonly cloudAssemblyInput: codepipeline.Artifact; + readonly pipeline: codepipeline.Pipeline; + readonly cdkCliVersion?: string; + readonly projectName?: string; + readonly vpc?: ec2.IVpc; + readonly subnetSelection?: ec2.SubnetSelection; + readonly singlePublisherPerType?: boolean; + readonly preInstallCommands?: string[]; + readonly buildSpec?: codebuild.BuildSpec; + readonly dockerCredentials: DockerCredential[]; +} + +/** + * Add appropriate publishing actions to the asset publishing stage + */ +class AssetPublishing extends Construct { + // CodePipelines has a hard limit of 50 actions per stage. See https://github.com/aws/aws-cdk/issues/9353 + private readonly MAX_PUBLISHERS_PER_STAGE = 50; + + private readonly publishers: Record = {}; + private readonly assetRoles: Map = new Map(); + private readonly assetAttachedPolicies: Record = {}; + private readonly myCxAsmRoot: string; + private readonly cachedFnSub = new CachedFnSub(); + + private readonly lastStageBeforePublishing?: codepipeline.IStage; + private readonly stages: codepipeline.IStage[] = []; + private readonly pipeline: codepipeline.Pipeline; + private readonly dockerCredentials: DockerCredential[]; + + private _fileAssetCtr = 0; + private _dockerAssetCtr = 0; + + constructor(scope: Construct, id: string, private readonly props: AssetPublishingProps) { + super(scope, id); + this.myCxAsmRoot = path.resolve(assemblyBuilderOf(appOf(this)).outdir); + + this.pipeline = this.props.pipeline; + // Hacks to get access to the innards of Pipeline + const stages: codepipeline.IStage[] = (this.props.pipeline as any)._stages; + // Any asset publishing stages will be added directly after the last stage that currently exists. + this.lastStageBeforePublishing = stages.slice(-1)[0]; + + this.dockerCredentials = props.dockerCredentials; + } + + /** + * Make sure there is an action in the stage to publish the given asset + * + * Assets are grouped by asset ID (which represent individual assets) so all assets + * are published in parallel. For each assets, all destinations are published sequentially + * so that we can reuse expensive operations between them (mostly: building a Docker image). + */ + public addPublishAssetAction(command: AssetPublishingCommand) { + // FIXME: this is silly, we need the relative path here but no easy way to get it + const relativePath = path.relative(this.myCxAsmRoot, command.assetManifestPath); + + // The path cannot be outside the asm root. I don't really understand how this could ever + // come to pass, but apparently it has (see https://github.com/aws/aws-cdk/issues/9766). + // Add a sanity check here so we can catch it more quickly next time. + if (relativePath.startsWith(`..${path.sep}`)) { + throw new Error(`The asset manifest (${command.assetManifestPath}) cannot be outside the Cloud Assembly directory (${this.myCxAsmRoot}). Please report this error at https://github.com/aws/aws-cdk/issues to help us debug why this is happening.`); + } + + // Late-binding here (rather than in the constructor) to prevent creating the role in cases where no asset actions are created. + const assetRole = this.generateAssetRole(command.assetType); + // The ARNs include raw AWS pseudo parameters (e.g., ${AWS::Partition}), which need to be substituted. + assetRole.addAssumeRole(this.cachedFnSub.fnSub(command.assetPublishingRoleArn)); + const publisherKey = this.props.singlePublisherPerType ? command.assetType.toString() : command.assetId; + + let action = this.publishers[publisherKey]; + if (!action) { + // Dynamically create new stages as needed, with `MAX_PUBLISHERS_PER_STAGE` assets per stage. + const stageIndex = this.props.singlePublisherPerType ? 0 : + Math.floor((this._fileAssetCtr + this._dockerAssetCtr) / this.MAX_PUBLISHERS_PER_STAGE); + + if (!this.props.singlePublisherPerType && stageIndex >= this.stages.length) { + const previousStage = this.stages.slice(-1)[0] ?? this.lastStageBeforePublishing; + this.stages.push(this.pipeline.addStage({ + stageName: `Assets${stageIndex > 0 ? stageIndex + 1 : ''}`, + placement: { justAfter: previousStage }, + })); + } else if (this.props.singlePublisherPerType && this.stages.length == 0) { + this.stages.push(this.pipeline.addStage({ + stageName: 'Assets', + placement: { justAfter: this.lastStageBeforePublishing }, + })); + } + + // The asset ID would be a logical candidate for the construct path and project names, but if the asset + // changes it leads to recreation of a number of Role/Policy/Project resources which is slower than + // necessary. Number sequentially instead. + // + // FIXME: The ultimate best solution is probably to generate a single Project per asset type + // and reuse that for all assets. + const id = this.props.singlePublisherPerType ? + command.assetType === AssetType.FILE ? 'FileAsset' : 'DockerAsset' : + command.assetType === AssetType.FILE ? `FileAsset${++this._fileAssetCtr}` : `DockerAsset${++this._dockerAssetCtr}`; + + const credsInstallCommands = dockerCredentialsInstallCommands(DockerCredentialUsage.ASSET_PUBLISHING, this.dockerCredentials); + + // NOTE: It's important that asset changes don't force a pipeline self-mutation. + // This can cause an infinite loop of updates (see https://github.com/aws/aws-cdk/issues/9080). + // For that reason, we use the id as the actionName below, rather than the asset hash. + action = this.publishers[publisherKey] = new PublishAssetsAction(this, id, { + actionName: id, + cloudAssemblyInput: this.props.cloudAssemblyInput, + cdkCliVersion: this.props.cdkCliVersion, + assetType: command.assetType, + role: this.assetRoles.get(command.assetType), + dependable: this.assetAttachedPolicies[command.assetType], + vpc: this.props.vpc, + subnetSelection: this.props.subnetSelection, + buildSpec: this.props.buildSpec, + createBuildspecFile: this.props.singlePublisherPerType, + preInstallCommands: [...(this.props.preInstallCommands ?? []), ...credsInstallCommands], + }); + this.stages[stageIndex].addAction(action); + } + + action.addPublishCommand(relativePath, command.assetSelector); + } + + /** + * This role is used by both the CodePipeline build action and related CodeBuild project. Consolidating these two + * roles into one, and re-using across all assets, saves significant size of the final synthesized output. + * Modeled after the CodePipeline role and 'CodePipelineActionRole' roles. + * Generates one role per asset type to separate file and Docker/image-based permissions. + */ + private generateAssetRole(assetType: AssetType) { + const existing = this.assetRoles.get(assetType); + if (existing) { + return existing; + } + + const rolePrefix = assetType === AssetType.DOCKER_IMAGE ? 'Docker' : 'File'; + const assetRole = new AssetSingletonRole(this, `${rolePrefix}Role`, { + roleName: PhysicalName.GENERATE_IF_NEEDED, + assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('codebuild.amazonaws.com'), new iam.AccountPrincipal(Stack.of(this).account)), + }); + + // Grant pull access for any ECR registries and secrets that exist + if (assetType === AssetType.DOCKER_IMAGE) { + this.dockerCredentials.forEach(reg => reg.grantRead(assetRole, DockerCredentialUsage.ASSET_PUBLISHING)); + } + + this.assetRoles.set(assetType, assetRole); + return assetRole; + } +} + +function maybeSuffix(x: string | undefined, suffix: string): string | undefined { + if (x === undefined) { return undefined; } + return `${x}${suffix}`; +} diff --git a/packages/aws-cdk-lib/pipelines/lib/legacy/stage.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/stage.ts new file mode 100644 index 0000000000000..e40eb54d7459a --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/stage.ts @@ -0,0 +1,587 @@ +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as cpactions from '../../../aws-codepipeline-actions'; +import { CodeBuildAction } from '../../../aws-codepipeline-actions'; +import * as sns from '../../../aws-sns'; +import { Stage, Aspects } from '../../../core'; +import * as cxapi from '../../../cx-api'; +import { Construct, Node } from 'constructs'; +import { DeployCdkStackAction } from './actions'; +import { CdkPipeline } from './pipeline'; +import { AssetType } from '../blueprint/asset-type'; +import { ApplicationSecurityCheck } from '../private/application-security-check'; +import { AssetManifestReader, DockerImageManifestEntry, FileManifestEntry } from '../private/asset-manifest'; +import { pipelineSynth } from '../private/construct-internals'; +import { topologicalSort } from '../private/toposort'; + +/** + * Construction properties for a CdkStage + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface CdkStageProps { + /** + * Name of the stage that should be created + */ + readonly stageName: string; + + /** + * The underlying Pipeline Stage associated with thisCdkStage + */ + readonly pipelineStage: codepipeline.IStage; + + /** + * The CodePipeline Artifact with the Cloud Assembly + */ + readonly cloudAssemblyArtifact: codepipeline.Artifact; + + /** + * Features the Stage needs from its environment + */ + readonly host: IStageHost; + + /** + * Run a security check before every application prepare/deploy actions. + * + * Note: Stage level security check can be overriden per application as follows: + * `stage.addApplication(app, { confirmBroadeningPermissions: false })` + * + * @default false + */ + readonly confirmBroadeningPermissions?: boolean; + + /** + * Optional SNS topic to send notifications to when any security check registers + * changes within a application. + * + * Note: The Stage Notification Topic can be overriden per application as follows: + * `stage.addApplication(app, { securityNotificationTopic: newTopic })` + * + * @default undefined no stage level notification topic + */ + readonly securityNotificationTopic?: sns.ITopic; +} + + +/** + * Stage in a CdkPipeline + * + * You don't need to instantiate this class directly. Use + * `cdkPipeline.addStage()` instead. + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export class CdkStage extends Construct { + private _nextSequentialRunOrder = 1; // Must start at 1 eh + private _manualApprovalCounter = 1; + private readonly pipelineStage: codepipeline.IStage; + private readonly cloudAssemblyArtifact: codepipeline.Artifact; + private readonly stacksToDeploy = new Array(); + private readonly stageName: string; + private readonly host: IStageHost; + private readonly confirmBroadeningPermissions: boolean; + private readonly pipeline?: CdkPipeline; + private readonly securityNotificationTopic?: sns.ITopic; + private _applicationSecurityCheck?: ApplicationSecurityCheck; + private _prepared = false; + + constructor(scope: Construct, id: string, props: CdkStageProps) { + super(scope, id); + + if (scope instanceof CdkPipeline) { + this.pipeline = scope; + } + + this.stageName = props.stageName; + this.pipelineStage = props.pipelineStage; + this.cloudAssemblyArtifact = props.cloudAssemblyArtifact; + this.host = props.host; + this.confirmBroadeningPermissions = props.confirmBroadeningPermissions ?? false; + this.securityNotificationTopic = props.securityNotificationTopic; + + Aspects.of(this).add({ visit: () => this.prepareStage() }); + } + + /** + * Add all stacks in the application Stage to this stage + * + * The application construct should subclass `Stage` and can contain any + * number of `Stacks` inside it that may have dependency relationships + * on one another. + * + * All stacks in the application will be deployed in the appropriate order, + * and all assets found in the application will be added to the asset + * publishing stage. + */ + public addApplication(appStage: Stage, options: AddStageOptions = {}) { + const asm = pipelineSynth(appStage); + const extraRunOrderSpace = options.extraRunOrderSpace ?? 0; + + if (options.confirmBroadeningPermissions ?? this.confirmBroadeningPermissions) { + this.addSecurityCheck(appStage, options); + } + + if (asm.stacks.length === 0) { + // If we don't check here, a more puzzling "stage contains no actions" + // error will be thrown come deployment time. + throw new Error(`The given Stage construct ('${appStage.node.path}') should contain at least one Stack`); + } + + const sortedTranches = topologicalSort(asm.stacks, + stack => stack.id, + stack => stack.dependencies.map(d => d.id)); + + for (const stacks of sortedTranches) { + const runOrder = this.nextSequentialRunOrder(extraRunOrderSpace + 2); // 2 actions for Prepare/Execute ChangeSet + let executeRunOrder = runOrder + extraRunOrderSpace + 1; + + // If we need to insert a manual approval action, then what's the executeRunOrder + // now is where we add a manual approval step, and we allocate 1 more runOrder + // for the execute. + if (options.manualApprovals) { + this.addManualApprovalAction({ runOrder: runOrder + 1 }); + executeRunOrder = this.nextSequentialRunOrder(); + } + + // These don't have a dependency on each other, so can all be added in parallel + for (const stack of stacks) { + this.addStackArtifactDeployment(stack, { runOrder, executeRunOrder }); + } + } + } + + /** + * Get a cached version of an ApplicationSecurityCheck, which consists of: + * - CodeBuild Project to check for security changes in a stage + * - Lambda Function that approves the manual approval if no security changes are detected + * + * The ApplicationSecurityCheck is cached from the pipeline **if** this stage is scoped + * to a CDK Pipeline. If this stage **is not** scoped to a pipeline, create an ApplicationSecurityCheck + * scoped to the stage itself. + * + * @internal + */ + private getApplicationSecurityCheck(): ApplicationSecurityCheck { + if (this._applicationSecurityCheck) { + return this._applicationSecurityCheck; + } + + this._applicationSecurityCheck = this.pipeline + ? this.pipeline._getApplicationSecurityCheck() + : new ApplicationSecurityCheck(this, 'StageApplicationSecurityCheck', { + codePipeline: this.pipelineStage.pipeline as codepipeline.Pipeline, + }); + return this._applicationSecurityCheck; + } + + /** + * Add a deployment action based on a stack artifact + */ + public addStackArtifactDeployment(stackArtifact: cxapi.CloudFormationStackArtifact, options: AddStackOptions = {}) { + // Get all assets manifests and add the assets in 'em to the asset publishing stage. + this.publishAssetDependencies(stackArtifact); + + // Remember for later, see 'prepare()' + // We know that deploying a stack is going to take up 2 runorder slots later on. + const runOrder = options.runOrder ?? this.nextSequentialRunOrder(2); + const executeRunOrder = options.executeRunOrder ?? runOrder + 1; + this.stacksToDeploy.push({ + prepareRunOrder: runOrder, + executeRunOrder, + stackArtifact, + }); + + this.advanceRunOrderPast(runOrder); + this.advanceRunOrderPast(executeRunOrder); + } + + /** + * Add a manual approval action + * + * If you need more flexibility than what this method offers, + * use `addAction` with a `ManualApprovalAction`. + */ + public addManualApprovalAction(options: AddManualApprovalOptions = {}) { + let actionName = options.actionName; + if (!actionName) { + actionName = `ManualApproval${this._manualApprovalCounter > 1 ? this._manualApprovalCounter : ''}`; + this._manualApprovalCounter += 1; + } + + this.addActions(new cpactions.ManualApprovalAction({ + actionName, + runOrder: options.runOrder ?? this.nextSequentialRunOrder(), + })); + } + + /** + * Add one or more CodePipeline Actions + * + * You need to make sure it is created with the right runOrder. Call `nextSequentialRunOrder()` + * for every action to get actions to execute in sequence. + */ + public addActions(...actions: codepipeline.IAction[]) { + for (const action of actions) { + this.pipelineStage.addAction(action); + } + } + + /** + * Return the runOrder number necessary to run the next Action in sequence with the rest + * + * FIXME: This is here because Actions are immutable and can't be reordered + * after creation, nor is there a way to specify relative priorities, which + * is a limitation that we should take away in the base library. + */ + public nextSequentialRunOrder(count: number = 1): number { + const ret = this._nextSequentialRunOrder; + this._nextSequentialRunOrder += count; + return ret; + } + + /** + * Whether this Stage contains an action to deploy the given stack, identified by its artifact ID + */ + public deploysStack(artifactId: string) { + return this.stacksToDeploy.map(s => s.stackArtifact.id).includes(artifactId); + } + + /** + * Actually add all the DeployStack actions to the stage. + * + * We do this late because before we can render the actual DeployActions, + * we need to know whether or not we need to capture the stack outputs. + * + * FIXME: This is here because Actions are immutable and can't be reordered + * after creation, nor is there a way to specify relative priorities, which + * is a limitation that we should take away in the base library. + */ + private prepareStage() { + // FIXME: Make sure this only gets run once. There seems to be an issue in the reconciliation + // loop that may trigger this more than once if it throws an error somewhere, and the exception + // that gets thrown here will then override the actual failure. + if (this._prepared) { return; } + this._prepared = true; + + for (const { prepareRunOrder, stackArtifact, executeRunOrder } of this.stacksToDeploy) { + const artifact = this.host.stackOutputArtifact(stackArtifact.id); + + this.pipelineStage.addAction(DeployCdkStackAction.fromStackArtifact(this, stackArtifact, { + baseActionName: this.simplifyStackName(stackArtifact.stackName), + cloudAssemblyInput: this.cloudAssemblyArtifact, + output: artifact, + outputFileName: artifact ? 'outputs.json' : undefined, + prepareRunOrder, + executeRunOrder, + })); + } + } + + /** + * Advance the runorder counter so that the next sequential number is higher than the given one + */ + private advanceRunOrderPast(lastUsed: number) { + this._nextSequentialRunOrder = Math.max(lastUsed + 1, this._nextSequentialRunOrder); + } + + /** + * Simplify the stack name by removing the `Stage-` prefix if it exists. + */ + private simplifyStackName(s: string) { + return stripPrefix(s, `${this.stageName}-`); + } + + /** + * Add a security check before the prepare/deploy actions of an CDK stage. + * The security check consists of two actions: + * - CodeBuild Action to check for security changes in a stage + * - Manual Approval Action that is auto approved via a Lambda if no security changes detected + */ + private addSecurityCheck(appStage: Stage, options?: BaseStageOptions) { + const { cdkDiffProject } = this.getApplicationSecurityCheck(); + const notificationTopic: sns.ITopic | undefined = options?.securityNotificationTopic ?? this.securityNotificationTopic; + notificationTopic?.grantPublish(cdkDiffProject); + + const appStageName = appStage.stageName; + const approveActionName = `${appStageName}ManualApproval`; + const diffAction = new CodeBuildAction({ + runOrder: this.nextSequentialRunOrder(), + actionName: `${appStageName}SecurityCheck`, + input: this.cloudAssemblyArtifact, + project: cdkDiffProject, + variablesNamespace: `${appStageName}SecurityCheck`, + environmentVariables: { + STAGE_PATH: { + value: Node.of(appStage).path, + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + }, + STAGE_NAME: { + value: this.stageName, + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + }, + ACTION_NAME: { + value: approveActionName, + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + }, + ...notificationTopic ? { + NOTIFICATION_ARN: { + value: notificationTopic.topicArn, + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + }, + NOTIFICATION_SUBJECT: { + value: `Confirm permission broadening in ${appStageName}`, + type: codebuild.BuildEnvironmentVariableType.PLAINTEXT, + }, + } : {}, + }, + }); + + const approve = new cpactions.ManualApprovalAction({ + actionName: approveActionName, + runOrder: this.nextSequentialRunOrder(), + additionalInformation: `#{${appStageName}SecurityCheck.MESSAGE}`, + externalEntityLink: `#{${appStageName}SecurityCheck.LINK}`, + }); + + this.addActions(diffAction, approve); + } + + /** + * Make sure all assets depended on by this stack are published in this pipeline + * + * Taking care to exclude the stack template itself -- it is being published + * as an asset because the CLI needs to know the asset publishing role when + * pushing the template to S3, but in the case of CodePipeline we always + * reference the template from the artifact bucket. + * + * (NOTE: this is only true for top-level stacks, not nested stacks. Nested + * Stack templates are always published as assets). + */ + private publishAssetDependencies(stackArtifact: cxapi.CloudFormationStackArtifact) { + const assetManifests = stackArtifact.dependencies.filter(isAssetManifest); + + for (const manifestArtifact of assetManifests) { + const manifest = AssetManifestReader.fromFile(manifestArtifact.file); + + for (const entry of manifest.entries) { + let assetType: AssetType; + if (entry instanceof DockerImageManifestEntry) { + assetType = AssetType.DOCKER_IMAGE; + } else if (entry instanceof FileManifestEntry) { + // Don't publish the template for this stack + if (entry.source.packaging === 'file' && entry.source.path === stackArtifact.templateFile) { + continue; + } + + assetType = AssetType.FILE; + } else { + throw new Error(`Unrecognized asset type: ${entry.type}`); + } + + if (!entry.destination.assumeRoleArn) { + throw new Error('assumeRoleArn is missing on asset and required'); + } + + this.host.publishAsset({ + assetManifestPath: manifestArtifact.file, + assetId: entry.id.assetId, + assetSelector: entry.id.toString(), + assetType, + assetPublishingRoleArn: entry.destination.assumeRoleArn, + }); + } + } + } +} + +/** + * Additional options for adding a stack deployment + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface AddStackOptions { + /** + * Base runorder + * + * @default - Next sequential runorder + */ + readonly runOrder?: number; + + /** + * Base runorder + * + * @default - runOrder + 1 + */ + readonly executeRunOrder?: number; +} + +/** + * A single output of a Stack + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export class StackOutput { + /** + * The artifact and file the output is stored in + */ + public readonly artifactFile: codepipeline.ArtifactPath; + + /** + * The name of the output in the JSON object in the file + */ + public readonly outputName: string; + + /** + * Build a StackOutput from a known artifact and an output name + */ + constructor(artifactFile: codepipeline.ArtifactPath, outputName: string) { + this.artifactFile = artifactFile; + this.outputName = outputName; + } +} + +function stripPrefix(s: string, prefix: string) { + return s.startsWith(prefix) ? s.slice(prefix.length) : s; +} + +function isAssetManifest(s: cxapi.CloudArtifact): s is cxapi.AssetManifestArtifact { + // instanceof is too risky, and we're at a too late stage to properly fix. + // return s instanceof cxapi.AssetManifestArtifact; + return s.constructor.name === 'AssetManifestArtifact'; +} + +/** + * Features that the Stage needs from its environment + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface IStageHost { + /** + * Make sure all the assets from the given manifest are published + */ + publishAsset(command: AssetPublishingCommand): void; + + /** + * Return the Artifact the given stack has to emit its outputs into, if any + */ + stackOutputArtifact(stackArtifactId: string): codepipeline.Artifact | undefined; +} + +/** + * Instructions to publish certain assets + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface AssetPublishingCommand { + /** + * Asset manifest path + */ + readonly assetManifestPath: string; + + /** + * Asset identifier + */ + readonly assetId: string; + + /** + * Asset selector to pass to `cdk-assets`. + */ + readonly assetSelector: string; + + /** + * Type of asset to publish + */ + readonly assetType: AssetType; + + /** + * ARN of the IAM Role used to publish this asset. + */ + readonly assetPublishingRoleArn: string; +} + +/** + * Base options for a pipelines stage + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface BaseStageOptions { + /** + * Runs a `cdk diff --security-only --fail` to pause the pipeline if there + * are any security changes. + * + * If the stage is configured with `confirmBroadeningPermissions` enabled, you can use this + * property to override the stage configuration. For example, Pipeline Stage + * "Prod" has confirmBroadeningPermissions enabled, with applications "A", "B", "C". All three + * applications will run a security check, but if we want to disable the one for "C", + * we run `stage.addApplication(C, { confirmBroadeningPermissions: false })` to override the pipeline + * stage behavior. + * + * Adds 1 to the run order space. + * + * @default false + */ + readonly confirmBroadeningPermissions?: boolean; + /** + * Optional SNS topic to send notifications to when the security check registers + * changes within the application. + * + * @default undefined no notification topic for security check manual approval action + */ + readonly securityNotificationTopic?: sns.ITopic; +} + +/** + * Options for adding an application stage to a pipeline + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface AddStageOptions extends BaseStageOptions { + /** + * Add manual approvals before executing change sets + * + * This gives humans the opportunity to confirm the change set looks alright + * before deploying it. + * + * @default false + */ + readonly manualApprovals?: boolean; + /** + * Add room for extra actions + * + * You can use this to make extra room in the runOrder sequence between the + * changeset 'prepare' and 'execute' actions and insert your own actions there. + * + * @default 0 + */ + readonly extraRunOrderSpace?: number; +} + +/** + * Options for addManualApproval + * + * @deprecated This class is part of the old API. Use the API based on the `CodePipeline` class instead + */ +export interface AddManualApprovalOptions { + /** + * The name of the manual approval action + * + * @default 'ManualApproval' with a rolling counter + */ + readonly actionName?: string; + + /** + * The runOrder for this action + * + * @default - The next sequential runOrder + */ + readonly runOrder?: number; +} + +/** + * Queued "deploy stack" command that is reified during prepare() + */ +interface DeployStackCommand { + prepareRunOrder: number; + executeRunOrder: number; + stackArtifact: cxapi.CloudFormationStackArtifact; +} diff --git a/packages/aws-cdk-lib/pipelines/lib/legacy/synths/_util.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/synths/_util.ts new file mode 100644 index 0000000000000..0a5a34c6f0eaa --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/synths/_util.ts @@ -0,0 +1,15 @@ +import * as codebuild from '../../../../aws-codebuild'; + +export function copyEnvironmentVariables(...names: string[]): Record { + const ret: Record = {}; + for (const name of names) { + if (process.env[name]) { + ret[name] = { value: process.env[name] }; + } + } + return ret; +} + +export function filterEmpty(xs: Array): string[] { + return xs.filter(x => x) as any; +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/lib/legacy/synths/index.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/synths/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/legacy/synths/index.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/synths/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/legacy/synths/simple-synth-action.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/synths/simple-synth-action.ts similarity index 97% rename from packages/@aws-cdk/pipelines/lib/legacy/synths/simple-synth-action.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/synths/simple-synth-action.ts index 9a9aefb6a379e..4b372349adfb0 100644 --- a/packages/@aws-cdk/pipelines/lib/legacy/synths/simple-synth-action.ts +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/synths/simple-synth-action.ts @@ -1,12 +1,12 @@ import * as crypto from 'crypto'; import * as path from 'path'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; -import { Stack } from '@aws-cdk/core'; +import * as codebuild from '../../../../aws-codebuild'; +import * as codepipeline from '../../../../aws-codepipeline'; +import * as codepipeline_actions from '../../../../aws-codepipeline-actions'; +import * as ec2 from '../../../../aws-ec2'; +import * as events from '../../../../aws-events'; +import * as iam from '../../../../aws-iam'; +import { Stack } from '../../../../core'; import { Construct } from 'constructs'; import { copyEnvironmentVariables, filterEmpty } from './_util'; import { dockerCredentialsInstallCommands, DockerCredential, DockerCredentialUsage } from '../../docker-credentials'; diff --git a/packages/@aws-cdk/pipelines/lib/legacy/validation/_files.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/validation/_files.ts similarity index 92% rename from packages/@aws-cdk/pipelines/lib/legacy/validation/_files.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/validation/_files.ts index fc54c1f69930b..78ae0354ddf3d 100644 --- a/packages/@aws-cdk/pipelines/lib/legacy/validation/_files.ts +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/validation/_files.ts @@ -1,6 +1,6 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import { IGrantable } from '@aws-cdk/aws-iam'; -import * as s3assets from '@aws-cdk/aws-s3-assets'; +import * as codepipeline from '../../../../aws-codepipeline'; +import { IGrantable } from '../../../../aws-iam'; +import * as s3assets from '../../../../aws-s3-assets'; import { Construct } from 'constructs'; /** diff --git a/packages/@aws-cdk/pipelines/lib/legacy/validation/index.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/validation/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/legacy/validation/index.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/validation/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/legacy/validation/shell-script-action.ts b/packages/aws-cdk-lib/pipelines/lib/legacy/validation/shell-script-action.ts similarity index 95% rename from packages/@aws-cdk/pipelines/lib/legacy/validation/shell-script-action.ts rename to packages/aws-cdk-lib/pipelines/lib/legacy/validation/shell-script-action.ts index 8dab045c6cdee..b9399d1eeafe4 100644 --- a/packages/@aws-cdk/pipelines/lib/legacy/validation/shell-script-action.ts +++ b/packages/aws-cdk-lib/pipelines/lib/legacy/validation/shell-script-action.ts @@ -1,9 +1,9 @@ -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as events from '@aws-cdk/aws-events'; -import * as iam from '@aws-cdk/aws-iam'; +import * as codebuild from '../../../../aws-codebuild'; +import * as codepipeline from '../../../../aws-codepipeline'; +import * as codepipeline_actions from '../../../../aws-codepipeline-actions'; +import * as ec2 from '../../../../aws-ec2'; +import * as events from '../../../../aws-events'; +import * as iam from '../../../../aws-iam'; import { Construct } from 'constructs'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../private/default-codebuild-image'; import { StackOutput } from '../stage'; diff --git a/packages/@aws-cdk/pipelines/lib/main/index.ts b/packages/aws-cdk-lib/pipelines/lib/main/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/main/index.ts rename to packages/aws-cdk-lib/pipelines/lib/main/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/main/pipeline-base.ts b/packages/aws-cdk-lib/pipelines/lib/main/pipeline-base.ts similarity index 98% rename from packages/@aws-cdk/pipelines/lib/main/pipeline-base.ts rename to packages/aws-cdk-lib/pipelines/lib/main/pipeline-base.ts index bff7cbf68a1da..583c030022e8a 100644 --- a/packages/@aws-cdk/pipelines/lib/main/pipeline-base.ts +++ b/packages/aws-cdk-lib/pipelines/lib/main/pipeline-base.ts @@ -1,4 +1,4 @@ -import { Aspects, Stage } from '@aws-cdk/core'; +import { Aspects, Stage } from '../../../core'; import { Construct } from 'constructs'; import { AddStageOpts as StageOptions, WaveOptions, Wave, IFileSetProducer, ShellStep, FileSet } from '../blueprint'; diff --git a/packages/@aws-cdk/pipelines/lib/private/application-security-check.ts b/packages/aws-cdk-lib/pipelines/lib/private/application-security-check.ts similarity index 96% rename from packages/@aws-cdk/pipelines/lib/private/application-security-check.ts rename to packages/aws-cdk-lib/pipelines/lib/private/application-security-check.ts index 0c0fa6d8b56a0..3f88175f0b7bc 100644 --- a/packages/@aws-cdk/pipelines/lib/private/application-security-check.ts +++ b/packages/aws-cdk-lib/pipelines/lib/private/application-security-check.ts @@ -1,9 +1,9 @@ import * as path from 'path'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as cp from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { Duration, Tags } from '@aws-cdk/core'; +import * as codebuild from '../../../aws-codebuild'; +import * as cp from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as lambda from '../../../aws-lambda'; +import { Duration, Tags } from '../../../core'; import { Construct } from 'constructs'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from './default-codebuild-image'; diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.ts b/packages/aws-cdk-lib/pipelines/lib/private/approve-lambda/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/integ.pipeline-security.js.snapshot/asset.3e97a33351ca88612e307e6409bd3556457d97bc85dce281e230b8aad8bc66ff/index.ts rename to packages/aws-cdk-lib/pipelines/lib/private/approve-lambda/index.ts diff --git a/packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts b/packages/aws-cdk-lib/pipelines/lib/private/asset-manifest.ts similarity index 99% rename from packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts rename to packages/aws-cdk-lib/pipelines/lib/private/asset-manifest.ts index 52cd46a8ec933..2391401f8c282 100644 --- a/packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts +++ b/packages/aws-cdk-lib/pipelines/lib/private/asset-manifest.ts @@ -1,7 +1,7 @@ // FIXME: copied from `ckd-assets`, because this tool needs to read the asset manifest aswell. import * as fs from 'fs'; import * as path from 'path'; -import { AssetManifest, AwsDestination, DockerImageDestination, DockerImageSource, FileDestination, FileSource, Manifest } from '@aws-cdk/cloud-assembly-schema'; +import { AssetManifest, AwsDestination, DockerImageDestination, DockerImageSource, FileDestination, FileSource, Manifest } from '../../../cloud-assembly-schema'; /** * A manifest of assets diff --git a/packages/@aws-cdk/pipelines/lib/private/asset-singleton-role.ts b/packages/aws-cdk-lib/pipelines/lib/private/asset-singleton-role.ts similarity index 96% rename from packages/@aws-cdk/pipelines/lib/private/asset-singleton-role.ts rename to packages/aws-cdk-lib/pipelines/lib/private/asset-singleton-role.ts index d43dfba61613d..f78c737271c5c 100644 --- a/packages/@aws-cdk/pipelines/lib/private/asset-singleton-role.ts +++ b/packages/aws-cdk-lib/pipelines/lib/private/asset-singleton-role.ts @@ -1,6 +1,6 @@ -import * as iam from '@aws-cdk/aws-iam'; -import { PolicyStatement } from '@aws-cdk/aws-iam'; -import { ArnFormat, Stack } from '@aws-cdk/core'; +import * as iam from '../../../aws-iam'; +import { PolicyStatement } from '../../../aws-iam'; +import { ArnFormat, Stack } from '../../../core'; import { Construct, IDependable } from 'constructs'; /** diff --git a/packages/@aws-cdk/pipelines/lib/private/cached-fnsub.ts b/packages/aws-cdk-lib/pipelines/lib/private/cached-fnsub.ts similarity index 95% rename from packages/@aws-cdk/pipelines/lib/private/cached-fnsub.ts rename to packages/aws-cdk-lib/pipelines/lib/private/cached-fnsub.ts index 1a7e5595140b1..0f94048bb5dd2 100644 --- a/packages/@aws-cdk/pipelines/lib/private/cached-fnsub.ts +++ b/packages/aws-cdk-lib/pipelines/lib/private/cached-fnsub.ts @@ -1,4 +1,4 @@ -import { Fn } from '@aws-cdk/core'; +import { Fn } from '../../../core'; /** * Wrap a string in `Fn.sub`, but return the same `Fn.sub` value for the same string diff --git a/packages/@aws-cdk/pipelines/lib/private/cli-version.ts b/packages/aws-cdk-lib/pipelines/lib/private/cli-version.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/cli-version.ts rename to packages/aws-cdk-lib/pipelines/lib/private/cli-version.ts diff --git a/packages/@aws-cdk/pipelines/lib/private/cloud-assembly-internals.ts b/packages/aws-cdk-lib/pipelines/lib/private/cloud-assembly-internals.ts similarity index 93% rename from packages/@aws-cdk/pipelines/lib/private/cloud-assembly-internals.ts rename to packages/aws-cdk-lib/pipelines/lib/private/cloud-assembly-internals.ts index 114ec2e228fbf..18ecb446c942b 100644 --- a/packages/@aws-cdk/pipelines/lib/private/cloud-assembly-internals.ts +++ b/packages/aws-cdk-lib/pipelines/lib/private/cloud-assembly-internals.ts @@ -1,4 +1,4 @@ -import * as cxapi from '@aws-cdk/cx-api'; +import * as cxapi from '../../../cx-api'; export function isAssetManifest(s: cxapi.CloudArtifact): s is cxapi.AssetManifestArtifact { // instanceof is too risky, and we're at a too late stage to properly fix. diff --git a/packages/@aws-cdk/pipelines/lib/private/construct-internals.ts b/packages/aws-cdk-lib/pipelines/lib/private/construct-internals.ts similarity index 94% rename from packages/@aws-cdk/pipelines/lib/private/construct-internals.ts rename to packages/aws-cdk-lib/pipelines/lib/private/construct-internals.ts index 9d89feadb2d35..b13c740cbf965 100644 --- a/packages/@aws-cdk/pipelines/lib/private/construct-internals.ts +++ b/packages/aws-cdk-lib/pipelines/lib/private/construct-internals.ts @@ -2,8 +2,8 @@ * Get access to construct internals that we need but got removed from the Stages PR. */ import * as path from 'path'; -import { App, Stage } from '@aws-cdk/core'; -import * as cxapi from '@aws-cdk/cx-api'; +import { App, Stage } from '../../../core'; +import * as cxapi from '../../../cx-api'; import { Construct, IConstruct, Node } from 'constructs'; export function appOf(construct: IConstruct): App { diff --git a/packages/aws-cdk-lib/pipelines/lib/private/default-codebuild-image.ts b/packages/aws-cdk-lib/pipelines/lib/private/default-codebuild-image.ts new file mode 100644 index 0000000000000..6f32753b13ff3 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/lib/private/default-codebuild-image.ts @@ -0,0 +1,3 @@ +import { LinuxBuildImage } from '../../../aws-codebuild'; + +export const CDKP_DEFAULT_CODEBUILD_IMAGE = LinuxBuildImage.STANDARD_6_0; \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/lib/private/fs.ts b/packages/aws-cdk-lib/pipelines/lib/private/fs.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/fs.ts rename to packages/aws-cdk-lib/pipelines/lib/private/fs.ts diff --git a/packages/@aws-cdk/pipelines/lib/private/identifiers.ts b/packages/aws-cdk-lib/pipelines/lib/private/identifiers.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/identifiers.ts rename to packages/aws-cdk-lib/pipelines/lib/private/identifiers.ts diff --git a/packages/@aws-cdk/pipelines/lib/private/javascript.ts b/packages/aws-cdk-lib/pipelines/lib/private/javascript.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/javascript.ts rename to packages/aws-cdk-lib/pipelines/lib/private/javascript.ts diff --git a/packages/@aws-cdk/pipelines/lib/private/template-configuration.ts b/packages/aws-cdk-lib/pipelines/lib/private/template-configuration.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/template-configuration.ts rename to packages/aws-cdk-lib/pipelines/lib/private/template-configuration.ts diff --git a/packages/@aws-cdk/pipelines/lib/private/toposort.ts b/packages/aws-cdk-lib/pipelines/lib/private/toposort.ts similarity index 100% rename from packages/@aws-cdk/pipelines/lib/private/toposort.ts rename to packages/aws-cdk-lib/pipelines/lib/private/toposort.ts diff --git a/packages/@aws-cdk/pipelines/test/blueprint/fixtures/file-asset1.txt b/packages/aws-cdk-lib/pipelines/test/blueprint/fixtures/file-asset1.txt similarity index 100% rename from packages/@aws-cdk/pipelines/test/blueprint/fixtures/file-asset1.txt rename to packages/aws-cdk-lib/pipelines/test/blueprint/fixtures/file-asset1.txt diff --git a/packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/dependencies.test.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/dependencies.test.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/dependencies.test.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/dependencies.test.ts diff --git a/packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/graph.test.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/graph.test.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/graph.test.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/graph.test.ts diff --git a/packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/pipeline-graph.test.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/pipeline-graph.test.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/pipeline-graph.test.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/pipeline-graph.test.ts diff --git a/packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/pipeline-queries.test.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/pipeline-queries.test.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/pipeline-queries.test.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/pipeline-queries.test.ts diff --git a/packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/util.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/util.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/blueprint/helpers-internal/util.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/helpers-internal/util.ts diff --git a/packages/@aws-cdk/pipelines/test/blueprint/logicalid-stability.test.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/logicalid-stability.test.ts similarity index 99% rename from packages/@aws-cdk/pipelines/test/blueprint/logicalid-stability.test.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/logicalid-stability.test.ts index 358d22454a035..4f12ae53a3542 100644 --- a/packages/@aws-cdk/pipelines/test/blueprint/logicalid-stability.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/blueprint/logicalid-stability.test.ts @@ -1,5 +1,5 @@ import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { Stack } from '@aws-cdk/core'; +import { Stack } from '../../../core'; import { mkdict } from '../../lib/private/javascript'; import { PIPELINE_ENV, TestApp, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, MegaAssetsApp, stackTemplate } from '../testhelpers'; diff --git a/packages/@aws-cdk/pipelines/test/blueprint/stack-deployment.test.ts b/packages/aws-cdk-lib/pipelines/test/blueprint/stack-deployment.test.ts similarity index 95% rename from packages/@aws-cdk/pipelines/test/blueprint/stack-deployment.test.ts rename to packages/aws-cdk-lib/pipelines/test/blueprint/stack-deployment.test.ts index 005b49586b500..76dbc568733e8 100644 --- a/packages/@aws-cdk/pipelines/test/blueprint/stack-deployment.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/blueprint/stack-deployment.test.ts @@ -1,6 +1,6 @@ import * as path from 'path'; -import * as assets from '@aws-cdk/aws-s3-assets'; -import { Stack, Stage } from '@aws-cdk/core'; +import * as assets from '../../../aws-s3-assets'; +import { Stack, Stage } from '../../../core'; import { StageDeployment } from '../../lib'; import { TestApp } from '../testhelpers/test-app'; diff --git a/packages/@aws-cdk/pipelines/test/codepipeline/codebuild-step.test.ts b/packages/aws-cdk-lib/pipelines/test/codepipeline/codebuild-step.test.ts similarity index 97% rename from packages/@aws-cdk/pipelines/test/codepipeline/codebuild-step.test.ts rename to packages/aws-cdk-lib/pipelines/test/codepipeline/codebuild-step.test.ts index 46ce77904ebbe..fb4c1885c70c7 100644 --- a/packages/@aws-cdk/pipelines/test/codepipeline/codebuild-step.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/codepipeline/codebuild-step.test.ts @@ -1,8 +1,8 @@ -import { Template, Match } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Duration, Stack } from '@aws-cdk/core'; +import { Template, Match } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import { Duration, Stack } from '../../../core'; import * as cdkp from '../../lib'; import { StackOutputReference } from '../../lib'; import { PIPELINE_ENV, TestApp, ModernTestGitHubNpmPipeline, AppWithOutput } from '../testhelpers'; diff --git a/packages/@aws-cdk/pipelines/test/codepipeline/codepipeline-existing.test.ts b/packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline-existing.test.ts similarity index 95% rename from packages/@aws-cdk/pipelines/test/codepipeline/codepipeline-existing.test.ts rename to packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline-existing.test.ts index 42c951cfaed2d..f8bb40204d27e 100644 --- a/packages/@aws-cdk/pipelines/test/codepipeline/codepipeline-existing.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline-existing.test.ts @@ -1,6 +1,6 @@ -import * as codePipeline from '@aws-cdk/aws-codepipeline'; +import * as codePipeline from '../../../aws-codepipeline'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import * as cdkp from '../../lib'; describeDeprecated('codepipeline existing', () => { diff --git a/packages/@aws-cdk/pipelines/test/codepipeline/codepipeline-sources.test.ts b/packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline-sources.test.ts similarity index 96% rename from packages/@aws-cdk/pipelines/test/codepipeline/codepipeline-sources.test.ts rename to packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline-sources.test.ts index d8a795d0b3e45..d721b23a1c026 100644 --- a/packages/@aws-cdk/pipelines/test/codepipeline/codepipeline-sources.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline-sources.test.ts @@ -1,10 +1,10 @@ -import { Capture, Match, Template } from '@aws-cdk/assertions'; -import * as ccommit from '@aws-cdk/aws-codecommit'; -import { CodeCommitTrigger, GitHubTrigger } from '@aws-cdk/aws-codepipeline-actions'; -import * as ecr from '@aws-cdk/aws-ecr'; -import { AnyPrincipal, Role } from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { SecretValue, Stack, Token } from '@aws-cdk/core'; +import { Capture, Match, Template } from '../../../assertions'; +import * as ccommit from '../../../aws-codecommit'; +import { CodeCommitTrigger, GitHubTrigger } from '../../../aws-codepipeline-actions'; +import * as ecr from '../../../aws-ecr'; +import { AnyPrincipal, Role } from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import { SecretValue, Stack, Token } from '../../../core'; import * as cdkp from '../../lib'; import { PIPELINE_ENV, TestApp, ModernTestGitHubNpmPipeline } from '../testhelpers'; diff --git a/packages/@aws-cdk/pipelines/test/codepipeline/codepipeline.test.ts b/packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline.test.ts similarity index 98% rename from packages/@aws-cdk/pipelines/test/codepipeline/codepipeline.test.ts rename to packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline.test.ts index a23adc4a06009..5cd2cc0613c77 100644 --- a/packages/@aws-cdk/pipelines/test/codepipeline/codepipeline.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/codepipeline/codepipeline.test.ts @@ -1,10 +1,10 @@ -import { Template, Annotations, Match } from '@aws-cdk/assertions'; -import * as ccommit from '@aws-cdk/aws-codecommit'; -import { Pipeline } from '@aws-cdk/aws-codepipeline'; -import * as iam from '@aws-cdk/aws-iam'; -import * as sqs from '@aws-cdk/aws-sqs'; -import * as cdk from '@aws-cdk/core'; -import { Stack } from '@aws-cdk/core'; +import { Template, Annotations, Match } from '../../../assertions'; +import * as ccommit from '../../../aws-codecommit'; +import { Pipeline } from '../../../aws-codepipeline'; +import * as iam from '../../../aws-iam'; +import * as sqs from '../../../aws-sqs'; +import * as cdk from '../../../core'; +import { Stack } from '../../../core'; import { Construct } from 'constructs'; import * as cdkp from '../../lib'; import { CodePipeline } from '../../lib'; diff --git a/packages/aws-cdk-lib/pipelines/test/compliance/assets.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/assets.test.ts new file mode 100644 index 0000000000000..5effeabeb95b7 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/test/compliance/assets.test.ts @@ -0,0 +1,1074 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import { Capture, Match, Template } from '../../../assertions'; +import * as cb from '../../../aws-codebuild'; +import * as ec2 from '../../../aws-ec2'; +import { Stack, Stage } from '../../../core'; +import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; +import { behavior, PIPELINE_ENV, TestApp, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, FileAssetApp, MegaAssetsApp, TwoFileAssetsApp, DockerAssetApp, PlainStackApp, stringLike } from '../testhelpers'; + +const FILE_ASSET_SOURCE_HASH = '8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5'; +const FILE_ASSET_SOURCE_HASH2 = 'ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e'; + +const FILE_PUBLISHING_ROLE = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}'; +const IMAGE_PUBLISHING_ROLE = 'arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-image-publishing-role-${AWS::AccountId}-${AWS::Region}'; + +let app: TestApp; +let pipelineStack: Stack; + +beforeEach(() => { + app = new TestApp(); + pipelineStack = new Stack(app, 'PipelineStack', { env: PIPELINE_ENV }); +}); + +afterEach(() => { + app.cleanup(); +}); + +describe('basic pipeline', () => { + behavior('no assets stage if the application has no assets', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new PlainStackApp(app, 'App')); + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new PlainStackApp(app, 'App')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + // THEN + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: Match.not(Match.arrayWith([Match.objectLike({ + Name: 'Assets', + })])), + }); + } + }); + + describe('asset stage placement', () => { + behavior('assets stage comes before any user-defined stages', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'App')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new FileAssetApp(app, 'App')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + Match.objectLike({ Name: 'Source' }), + Match.objectLike({ Name: 'Build' }), + Match.objectLike({ Name: 'UpdatePipeline' }), + Match.objectLike({ Name: 'Assets' }), + Match.objectLike({ Name: 'App' }), + ], + }); + } + }); + + behavior('up to 50 assets fit in a single stage', (suite) => { + suite.legacy(() => { + // WHEN + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new MegaAssetsApp(app, 'App', { numAssets: 50 })); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new MegaAssetsApp(app, 'App', { numAssets: 50 })); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + Match.objectLike({ Name: 'Source' }), + Match.objectLike({ Name: 'Build' }), + Match.objectLike({ Name: 'UpdatePipeline' }), + Match.objectLike({ Name: 'Assets' }), + Match.objectLike({ Name: 'App' }), + ], + }); + } + }); + + behavior('51 assets triggers a second stage', (suite) => { + suite.legacy(() => { + // WHEN + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new MegaAssetsApp(app, 'App', { numAssets: 51 })); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + // WHEN + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new MegaAssetsApp(app, 'App', { numAssets: 51 })); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + Match.objectLike({ Name: 'Source' }), + Match.objectLike({ Name: 'Build' }), + Match.objectLike({ Name: 'UpdatePipeline' }), + Match.objectLike({ Name: stringLike('Assets*') }), + Match.objectLike({ Name: stringLike('Assets*2') }), + Match.objectLike({ Name: 'App' }), + ], + }); + } + }); + + behavior('101 assets triggers a third stage', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new MegaAssetsApp(app, 'App', { numAssets: 101 })); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new MegaAssetsApp(app, 'App', { numAssets: 101 })); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: [ + Match.objectLike({ Name: 'Source' }), + Match.objectLike({ Name: 'Build' }), + Match.objectLike({ Name: 'UpdatePipeline' }), + Match.objectLike({ Name: stringLike('Assets*') }), // 'Assets' vs 'Assets.1' + Match.objectLike({ Name: stringLike('Assets*2') }), + Match.objectLike({ Name: stringLike('Assets*3') }), + Match.objectLike({ Name: 'App' }), + ], + }); + } + }); + }); + + behavior('command line properly locates assets in subassembly', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new FileAssetApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + build: { + commands: Match.arrayWith([`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH}:current_account-current_region"`]), + }, + }, + })), + }, + }); + } + }); + + behavior('multiple assets are published in parallel', (suite) => { + suite.legacy(() => { + // WHEN + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: Match.arrayWith([{ + Name: 'Assets', + Actions: [ + Match.objectLike({ RunOrder: 1 }), + Match.objectLike({ RunOrder: 1 }), + ], + }]), + }); + } + }); + + behavior('assets are also published when using the lower-level addStackArtifactDeployment', (suite) => { + suite.legacy(() => { + // GIVEN + const asm = new FileAssetApp(app, 'FileAssetApp').synth(); + + // WHEN + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage('SomeStage').addStackArtifactDeployment(asm.getStackByName('FileAssetApp-Stack')); + + // THEN + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: Match.arrayWith([{ + Name: 'Assets', + Actions: [ + Match.objectLike({ + Name: 'FileAsset1', + RunOrder: 1, + }), + ], + }]), + }); + }); + + // This function does not exist in the modern API + suite.doesNotApply.modern(); + }); + + behavior('file image asset publishers do not use privilegedmode', (suite) => { + suite.legacy(() => { + // WHEN + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + // WHEN + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new FileAssetApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + build: { + commands: Match.arrayWith([stringLike('cdk-assets *')]), + }, + }, + })), + }, + Environment: Match.objectLike({ + PrivilegedMode: false, + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + }), + }); + } + }); + + behavior('docker image asset publishers use privilegedmode', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + build: { + commands: Match.arrayWith([stringLike('cdk-assets *')]), + }, + }, + })), + }, + Environment: Match.objectLike({ + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + PrivilegedMode: true, + }), + }); + } + }); + + behavior('can control fix/CLI version used in asset publishing', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + cdkCliVersion: '1.2.3', + }); + pipeline.addApplicationStage(new FileAssetApp(pipelineStack, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + cliVersion: '1.2.3', + }); + pipeline.addStage(new FileAssetApp(pipelineStack, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + install: { + commands: ['npm install -g cdk-assets@1.2.3'], + }, + }, + })), + }, + }); + } + }); + + describe('asset roles and policies', () => { + behavior('includes file publishing assets role for apps with file assets', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + // Expectation expects to see KMS key policy permissions + crossAccountKeys: true, + }); + pipeline.addStage(new FileAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'codebuild.amazonaws.com', + }, + }, + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + AWS: { + 'Fn::Join': ['', [ + 'arn:', { Ref: 'AWS::Partition' }, `:iam::${PIPELINE_ENV.account}:root`, + ]], + }, + }, + }, + ], + }, + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', + expectedAssetRolePolicy(FILE_PUBLISHING_ROLE, 'CdkAssetsFileRole6BE17A07')); + } + }); + + behavior('publishing assets role may assume roles from multiple environments', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); + pipeline.addApplicationStage(new FileAssetApp(app, 'App2', { + env: { + account: '0123456789012', + region: 'eu-west-1', + }, + })); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + // Expectation expects to see KMS key policy permissions + crossAccountKeys: true, + }); + + pipeline.addStage(new FileAssetApp(app, 'App1')); + pipeline.addStage(new FileAssetApp(app, 'App2', { + env: { + account: '0123456789012', + region: 'eu-west-1', + }, + })); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', + expectedAssetRolePolicy([FILE_PUBLISHING_ROLE, 'arn:${AWS::Partition}:iam::0123456789012:role/cdk-hnb659fds-file-publishing-role-0123456789012-eu-west-1'], + 'CdkAssetsFileRole6BE17A07')); + } + }); + + behavior('publishing assets role de-dupes assumed roles', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); + pipeline.addApplicationStage(new FileAssetApp(app, 'App2')); + pipeline.addApplicationStage(new FileAssetApp(app, 'App3')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + // Expectation expects to see KMS key policy permissions + crossAccountKeys: true, + }); + pipeline.addStage(new FileAssetApp(app, 'App1')); + pipeline.addStage(new FileAssetApp(app, 'App2')); + pipeline.addStage(new FileAssetApp(app, 'App3')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', + expectedAssetRolePolicy(FILE_PUBLISHING_ROLE, 'CdkAssetsFileRole6BE17A07')); + } + }); + + behavior('includes image publishing assets role for apps with Docker assets', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + // Expectation expects to see KMS key policy permissions + crossAccountKeys: true, + }); + pipeline.addStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'codebuild.amazonaws.com', + }, + }, + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + AWS: { + 'Fn::Join': ['', [ + 'arn:', { Ref: 'AWS::Partition' }, `:iam::${PIPELINE_ENV.account}:root`, + ]], + }, + }, + }, + ], + }, + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', + expectedAssetRolePolicy(IMAGE_PUBLISHING_ROLE, 'CdkAssetsDockerRole484B6DD3')); + } + }); + + behavior('includes both roles for apps with both file and Docker assets', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new FileAssetApp(app, 'App1')); + pipeline.addApplicationStage(new DockerAssetApp(app, 'App2')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + // Expectation expects to see KMS key policy permissions + crossAccountKeys: true, + }); + pipeline.addStage(new FileAssetApp(app, 'App1')); + pipeline.addStage(new DockerAssetApp(app, 'App2')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', + expectedAssetRolePolicy(FILE_PUBLISHING_ROLE, 'CdkAssetsFileRole6BE17A07')); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', + expectedAssetRolePolicy(IMAGE_PUBLISHING_ROLE, 'CdkAssetsDockerRole484B6DD3')); + } + }); + }); +}); + +behavior('can supply pre-install scripts to asset upload', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + assetPreInstallCommands: [ + 'npm config set registry https://registry.com', + ], + }); + pipeline.addApplicationStage(new FileAssetApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + assetPublishingCodeBuildDefaults: { + partialBuildSpec: cb.BuildSpec.fromObject({ + version: '0.2', + phases: { + install: { + commands: [ + 'npm config set registry https://registry.com', + ], + }, + }, + }), + }, + }); + pipeline.addStage(new FileAssetApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + install: { + commands: ['npm config set registry https://registry.com', 'npm install -g cdk-assets@2'], + }, + }, + })), + }, + }); + } +}); + +describe('pipeline with VPC', () => { + let vpc: ec2.Vpc; + beforeEach(() => { + vpc = new ec2.Vpc(pipelineStack, 'Vpc'); + }); + + behavior('asset CodeBuild Project uses VPC subnets', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + vpc, + }); + pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + codeBuildDefaults: { vpc }, + }); + pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + // THEN + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + VpcConfig: Match.objectLike({ + SecurityGroupIds: [ + { 'Fn::GetAtt': ['CdkAssetsDockerAsset1SecurityGroup078F5C66', 'GroupId'] }, + ], + Subnets: [ + { Ref: 'VpcPrivateSubnet1Subnet536B997A' }, + { Ref: 'VpcPrivateSubnet2Subnet3788AAA1' }, + { Ref: 'VpcPrivateSubnet3SubnetF258B56E' }, + ], + VpcId: { Ref: 'Vpc8378EB38' }, + }), + }); + } + }); + + behavior('Pipeline-generated CodeBuild Projects have appropriate execution role permissions', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + vpc, + }); + pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + codeBuildDefaults: { vpc }, + }); + pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + // Assets Project + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + Roles: [ + { Ref: 'CdkAssetsDockerRole484B6DD3' }, + ], + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: Match.arrayWith(['ec2:DescribeSecurityGroups']), + Effect: 'Allow', + Resource: '*', + }]), + }, + }); + } + }); + + behavior('Asset publishing CodeBuild Projects have correct VPC permissions', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + vpc, + }); + pipeline.addApplicationStage(new DockerAssetApp(app, 'DockerAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + codeBuildDefaults: { vpc }, + }); + pipeline.addStage(new DockerAssetApp(app, 'DockerAssetApp')); + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + // Assets Project + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + Match.objectLike({ + Resource: '*', + Action: [ + 'ec2:CreateNetworkInterface', + 'ec2:DescribeNetworkInterfaces', + 'ec2:DeleteNetworkInterface', + 'ec2:DescribeSubnets', + 'ec2:DescribeSecurityGroups', + 'ec2:DescribeDhcpOptions', + 'ec2:DescribeVpcs', + ], + }), + ], + }, + Roles: [{ Ref: 'CdkAssetsDockerRole484B6DD3' }], + }); + Template.fromStack(pipelineStack).hasResource('AWS::CodeBuild::Project', { + Properties: { + ServiceRole: { 'Fn::GetAtt': ['CdkAssetsDockerRole484B6DD3', 'Arn'] }, + }, + DependsOn: [ + 'CdkAssetsDockerAsset1PolicyDocument8DA96A22', + ], + }); + } + }); +}); + +describe('pipeline with single asset publisher', () => { + behavior('multiple assets are using the same job in singlePublisherMode', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + singlePublisherPerType: true, + }); + pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + publishAssetsInParallel: false, + }); + pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + // THEN + const buildSpecName = new Capture(stringLike('buildspec-*.yaml')); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: Match.arrayWith([{ + Name: 'Assets', + Actions: [ + // Only one file asset action + Match.objectLike({ RunOrder: 1, Name: 'FileAsset' }), + ], + }]), + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + }, + Source: { + BuildSpec: buildSpecName, + }, + }); + const assembly = synthesize(pipelineStack); + + const actualFileName = buildSpecName.asString(); + + const buildSpec = JSON.parse(fs.readFileSync(path.join(assembly.directory, actualFileName), { encoding: 'utf-8' })); + expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH}:current_account-current_region"`); + expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH2}:current_account-current_region"`); + } + }); + + behavior('other pipeline writes to separate assets build spec file', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + singlePublisherPerType: true, + }); + pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + const pipelineStack2 = new Stack(app, 'PipelineStack2', { env: PIPELINE_ENV }); + const otherPipeline = new LegacyTestGitHubNpmPipeline(pipelineStack2, 'Cdk', { + singlePublisherPerType: true, + }); + otherPipeline.addApplicationStage(new TwoFileAssetsApp(app, 'OtherFileAssetApp')); + + THEN_codePipelineExpectation(pipelineStack2); + }); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + publishAssetsInParallel: false, + }); + pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + const pipelineStack2 = new Stack(app, 'PipelineStack2', { env: PIPELINE_ENV }); + const otherPipeline = new ModernTestGitHubNpmPipeline(pipelineStack2, 'Cdk', { + publishAssetsInParallel: false, + }); + otherPipeline.addStage(new TwoFileAssetsApp(app, 'OtherFileAssetApp')); + + THEN_codePipelineExpectation(pipelineStack2); + }); + + function THEN_codePipelineExpectation(pipelineStack2: Stack) { + // THEN + const buildSpecName1 = new Capture(stringLike('buildspec-*.yaml')); + const buildSpecName2 = new Capture(stringLike('buildspec-*.yaml')); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + BuildSpec: buildSpecName1, + }, + }); + Template.fromStack(pipelineStack2).hasResourceProperties('AWS::CodeBuild::Project', { + Source: { + BuildSpec: buildSpecName2, + }, + }); + + expect(buildSpecName1.asString()).not.toEqual(buildSpecName2.asString()); + } + }); +}); + + +describe('pipeline with custom asset publisher BuildSpec', () => { + + behavior('custom buildspec is merged correctly', (suite) => { + suite.legacy(() => { + // WHEN + const pipeline = new LegacyTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + singlePublisherPerType: true, + assetBuildSpec: cb.BuildSpec.fromObject({ + phases: { + pre_install: { + commands: 'preinstall', + }, + }, + cache: { + paths: 'node_modules', + }, + }), + }); + pipeline.addApplicationStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + // WHEN + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Cdk', { + publishAssetsInParallel: false, + assetPublishingCodeBuildDefaults: { + partialBuildSpec: cb.BuildSpec.fromObject({ + phases: { + pre_install: { + commands: 'preinstall', + }, + }, + cache: { + paths: 'node_modules', + }, + }), + }, + }); + pipeline.addStage(new TwoFileAssetsApp(app, 'FileAssetApp')); + + THEN_codePipelineExpectation(); + }); + + + function THEN_codePipelineExpectation() { + const buildSpecName = new Capture(stringLike('buildspec-*')); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodePipeline::Pipeline', { + Stages: Match.arrayWith([{ + Name: 'Assets', + Actions: [ + // Only one file asset action + Match.objectLike({ RunOrder: 1, Name: 'FileAsset' }), + ], + }]), + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId, + }, + Source: { + BuildSpec: buildSpecName, + }, + }); + const assembly = synthesize(pipelineStack); + const buildSpec = JSON.parse(fs.readFileSync(path.join(assembly.directory, buildSpecName.asString())).toString()); + expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH}:current_account-current_region"`); + expect(buildSpec.phases.build.commands).toContain(`cdk-assets --path "assembly-FileAssetApp/FileAssetAppStackEADD68C5.assets.json" --verbose publish "${FILE_ASSET_SOURCE_HASH2}:current_account-current_region"`); + expect(buildSpec.phases.pre_install.commands).toContain('preinstall'); + expect(buildSpec.cache.paths).toContain('node_modules'); + } + }); +}); + +function expectedAssetRolePolicy(assumeRolePattern: string | string[], attachedRole: string) { + if (typeof assumeRolePattern === 'string') { assumeRolePattern = [assumeRolePattern]; } + + return { + PolicyDocument: { + Statement: [{ + Action: ['logs:CreateLogGroup', 'logs:CreateLogStream', 'logs:PutLogEvents'], + Effect: 'Allow', + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + `:logs:${PIPELINE_ENV.region}:${PIPELINE_ENV.account}:log-group:/aws/codebuild/*`, + ]], + }, + }, + { + Action: ['codebuild:CreateReportGroup', 'codebuild:CreateReport', 'codebuild:UpdateReport', 'codebuild:BatchPutTestCases', 'codebuild:BatchPutCodeCoverages'], + Effect: 'Allow', + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + `:codebuild:${PIPELINE_ENV.region}:${PIPELINE_ENV.account}:report-group/*`, + ]], + }, + }, + { + Action: ['codebuild:BatchGetBuilds', 'codebuild:StartBuild', 'codebuild:StopBuild'], + Effect: 'Allow', + Resource: '*', + }, + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Resource: unsingleton(assumeRolePattern.map(arn => { return { 'Fn::Sub': arn }; })), + }, + { + Action: ['s3:GetObject*', 's3:GetBucket*', 's3:List*'], + Effect: 'Allow', + Resource: [ + { 'Fn::GetAtt': ['CdkPipelineArtifactsBucket7B46C7BF', 'Arn'] }, + { 'Fn::Join': ['', [{ 'Fn::GetAtt': ['CdkPipelineArtifactsBucket7B46C7BF', 'Arn'] }, '/*']] }, + ], + }, + { + Action: ['kms:Decrypt', 'kms:DescribeKey'], + Effect: 'Allow', + Resource: { 'Fn::GetAtt': ['CdkPipelineArtifactsBucketEncryptionKeyDDD3258C', 'Arn'] }, + }], + }, + Roles: [{ Ref: attachedRole }], + }; +} + + +behavior('necessary secrets manager permissions get added to asset roles', suite => { + // Not possible to configure this for legacy pipelines + suite.doesNotApply.legacy(); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Pipeline', { + assetPublishingCodeBuildDefaults: { + buildEnvironment: { + environmentVariables: { + FOOBAR: { + value: 'FoobarSecret', + type: cb.BuildEnvironmentVariableType.SECRETS_MANAGER, + }, + }, + }, + }, + }); + pipeline.addStage(new FileAssetApp(pipelineStack, 'MyApp')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: 'secretsmanager:GetSecretValue', + Effect: 'Allow', + Resource: { + 'Fn::Join': [ + '', + [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':secretsmanager:us-pipeline:123pipeline:secret:FoobarSecret-??????', + ], + ], + }, + }]), + }, + Roles: [ + { Ref: 'PipelineAssetsFileRole59943A77' }, + ], + }); + } +}); + +behavior('adding environment variable to assets job adds SecretsManager permissions', suite => { + // No way to manipulate buildEnvironment in legacy API + suite.doesNotApply.legacy(); + + suite.modern(() => { + const pipeline = new ModernTestGitHubNpmPipeline(pipelineStack, 'Pipeline', { + assetPublishingCodeBuildDefaults: { + buildEnvironment: { + environmentVariables: { + FOOBAR: { + value: 'FoobarSecret', + type: cb.BuildEnvironmentVariableType.SECRETS_MANAGER, + }, + }, + }, + }, + }); + pipeline.addStage(new FileAssetApp(pipelineStack, 'MyApp')); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([ + Match.objectLike({ + Action: 'secretsmanager:GetSecretValue', + Effect: 'Allow', + Resource: { + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':secretsmanager:us-pipeline:123pipeline:secret:FoobarSecret-??????', + ]], + }, + }), + ]), + }, + }); + }); +}); + +function synthesize(stack: Stack) { + const root = stack.node.root; + if (!Stage.isStage(root)) { + throw new Error('unexpected: all stacks must be part of a Stage'); + } + + return root.synth({ skipValidation: true }); +} + +function unsingleton(xs: A[]): A | A[] { + if (xs.length === 1) { + return xs[0]; + } + return xs; +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/compliance/basic-behavior.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/basic-behavior.test.ts similarity index 98% rename from packages/@aws-cdk/pipelines/test/compliance/basic-behavior.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/basic-behavior.test.ts index 26a570d602f0d..5eeccc0527de4 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/basic-behavior.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/basic-behavior.test.ts @@ -1,8 +1,8 @@ /* eslint-disable import/no-extraneous-dependencies */ import * as fs from 'fs'; import * as path from 'path'; -import { Capture, Match, Template } from '@aws-cdk/assertions'; -import { Stack, Stage, StageProps, Tags } from '@aws-cdk/core'; +import { Capture, Match, Template } from '../../../assertions'; +import { Stack, Stage, StageProps, Tags } from '../../../core'; import { Construct } from 'constructs'; import { behavior, LegacyTestGitHubNpmPipeline, OneStackApp, BucketStack, PIPELINE_ENV, TestApp, ModernTestGitHubNpmPipeline, stringLike } from '../testhelpers'; diff --git a/packages/aws-cdk-lib/pipelines/test/compliance/docker-credentials.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/docker-credentials.test.ts new file mode 100644 index 0000000000000..1209627eddf3c --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/test/compliance/docker-credentials.test.ts @@ -0,0 +1,292 @@ +import { Match, Template } from '../../../assertions'; +import * as cb from '../../../aws-codebuild'; +import * as secretsmanager from '../../../aws-secretsmanager'; +import { Stack } from '../../../core'; +import { Construct } from 'constructs'; +import * as cdkp from '../../lib'; +import { CodeBuildStep } from '../../lib'; +import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; +import { behavior, PIPELINE_ENV, TestApp, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, DockerAssetApp, stringLike } from '../testhelpers'; + +const secretSynthArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:synth-012345'; +const secretUpdateArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:update-012345'; +const secretPublishArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:publish-012345'; + +let app: TestApp; +let pipelineStack: Stack; +let secretSynth: secretsmanager.ISecret; +let secretUpdate: secretsmanager.ISecret; +let secretPublish: secretsmanager.ISecret; + +beforeEach(() => { + app = new TestApp(); + pipelineStack = new Stack(app, 'PipelineStack', { env: PIPELINE_ENV }); + secretSynth = secretsmanager.Secret.fromSecretCompleteArn(pipelineStack, 'Secret1', secretSynthArn); + secretUpdate = secretsmanager.Secret.fromSecretCompleteArn(pipelineStack, 'Secret2', secretUpdateArn); + secretPublish = secretsmanager.Secret.fromSecretCompleteArn(pipelineStack, 'Secret3', secretPublishArn); +}); + +afterEach(() => { + app.cleanup(); +}); + +behavior('synth action receives install commands and access to relevant credentials', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk'); + pipeline.addStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + const expectedCredsConfig = JSON.stringify({ + version: '1.0', + domainCredentials: { 'synth.example.com': { secretsManagerSecretId: secretSynthArn } }, + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + pre_build: { + commands: Match.arrayWith([ + 'mkdir $HOME/.cdk', + `echo '${expectedCredsConfig}' > $HOME/.cdk/cdk-docker-creds.json`, + ]), + }, + // Prove we're looking at the Synth project + build: { + commands: Match.arrayWith([stringLike('*cdk*synth*')]), + }, + }, + })), + }, + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], + Effect: 'Allow', + Resource: secretSynthArn, + }]), + Version: '2012-10-17', + }, + Roles: [{ Ref: stringLike('Cdk*BuildProjectRole*') }], + }); + } +}); + +behavior('synth action receives Windows install commands if a Windows image is detected', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk2', { + npmSynthOptions: { + environment: { + buildImage: cb.WindowsBuildImage.WINDOWS_BASE_2_0, + }, + }, + }); + pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + suite.modern(() => { + const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk2', { + synth: new CodeBuildStep('Synth', { + commands: ['cdk synth'], + primaryOutputDirectory: 'cdk.out', + input: cdkp.CodePipelineSource.gitHub('test/test', 'main'), + buildEnvironment: { + buildImage: cb.WindowsBuildImage.WINDOWS_BASE_2_0, + computeType: cb.ComputeType.MEDIUM, + }, + }), + }); + pipeline.addStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation(); + }); + + function THEN_codePipelineExpectation() { + const expectedCredsConfig = JSON.stringify({ + version: '1.0', + domainCredentials: { 'synth.example.com': { secretsManagerSecretId: secretSynthArn } }, + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { Image: 'aws/codebuild/windows-base:2.0' }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + pre_build: { + commands: Match.arrayWith([ + 'mkdir %USERPROFILE%\\.cdk', + `echo '${expectedCredsConfig}' > %USERPROFILE%\\.cdk\\cdk-docker-creds.json`, + ]), + }, + // Prove we're looking at the Synth project + build: { + commands: Match.arrayWith([stringLike('*cdk*synth*')]), + }, + }, + })), + }, + }); + } +}); + +behavior('self-update receives install commands and access to relevant credentials', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation('install'); + }); + + suite.modern(() => { + const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk'); + pipeline.addStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation('pre_build'); + }); + + function THEN_codePipelineExpectation(expectedPhase: string) { + const expectedCredsConfig = JSON.stringify({ + version: '1.0', + domainCredentials: { 'selfupdate.example.com': { secretsManagerSecretId: secretUpdateArn } }, + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + [expectedPhase]: { + commands: Match.arrayWith([ + 'mkdir $HOME/.cdk', + `echo '${expectedCredsConfig}' > $HOME/.cdk/cdk-docker-creds.json`, + ]), + }, + // Prove we're looking at the SelfMutate project + build: { + commands: Match.arrayWith([ + stringLike('cdk * deploy PipelineStack*'), + ]), + }, + }, + })), + }, + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], + Effect: 'Allow', + Resource: secretUpdateArn, + }]), + Version: '2012-10-17', + }, + Roles: [{ Ref: stringLike('*SelfMutat*Role*') }], + }); + } +}); + +behavior('asset publishing receives install commands and access to relevant credentials', (suite) => { + suite.legacy(() => { + const pipeline = new LegacyPipelineWithCreds(pipelineStack, 'Cdk'); + pipeline.addApplicationStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation('install'); + }); + + suite.modern(() => { + const pipeline = new ModernPipelineWithCreds(pipelineStack, 'Cdk'); + pipeline.addStage(new DockerAssetApp(app, 'App1')); + + THEN_codePipelineExpectation('pre_build'); + }); + + function THEN_codePipelineExpectation(expectedPhase: string) { + const expectedCredsConfig = JSON.stringify({ + version: '1.0', + domainCredentials: { 'publish.example.com': { secretsManagerSecretId: secretPublishArn } }, + }); + + Template.fromStack(pipelineStack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { Image: CDKP_DEFAULT_CODEBUILD_IMAGE.imageId }, + Source: { + BuildSpec: Match.serializedJson(Match.objectLike({ + phases: { + [expectedPhase]: { + commands: Match.arrayWith([ + 'mkdir $HOME/.cdk', + `echo '${expectedCredsConfig}' > $HOME/.cdk/cdk-docker-creds.json`, + ]), + }, + // Prove we're looking at the Publishing project + build: { + commands: Match.arrayWith([stringLike('cdk-assets*')]), + }, + }, + })), + }, + }); + Template.fromStack(pipelineStack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], + Effect: 'Allow', + Resource: secretPublishArn, + }]), + Version: '2012-10-17', + }, + Roles: [{ Ref: 'CdkAssetsDockerRole484B6DD3' }], + }); + } +}); + +class LegacyPipelineWithCreds extends LegacyTestGitHubNpmPipeline { + constructor(scope: Construct, id: string, props?: ConstructorParameters[2]) { + super(scope, id, { + dockerCredentials: [ + cdkp.DockerCredential.customRegistry('synth.example.com', secretSynth, { + usages: [cdkp.DockerCredentialUsage.SYNTH], + }), + cdkp.DockerCredential.customRegistry('selfupdate.example.com', secretUpdate, { + usages: [cdkp.DockerCredentialUsage.SELF_UPDATE], + }), + cdkp.DockerCredential.customRegistry('publish.example.com', secretPublish, { + usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], + }), + ], + ...props, + }); + } +} + +class ModernPipelineWithCreds extends ModernTestGitHubNpmPipeline { + constructor(scope: Construct, id: string, props?: ConstructorParameters[2]) { + super(scope, id, { + dockerCredentials: [ + cdkp.DockerCredential.customRegistry('synth.example.com', secretSynth, { + usages: [cdkp.DockerCredentialUsage.SYNTH], + }), + cdkp.DockerCredential.customRegistry('selfupdate.example.com', secretUpdate, { + usages: [cdkp.DockerCredentialUsage.SELF_UPDATE], + }), + cdkp.DockerCredential.customRegistry('publish.example.com', secretPublish, { + usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], + }), + ], + ...props, + }); + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/compliance/environments.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/environments.test.ts similarity index 99% rename from packages/@aws-cdk/pipelines/test/compliance/environments.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/environments.test.ts index 6ab303e7df43d..d543769de4262 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/environments.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/environments.test.ts @@ -1,6 +1,6 @@ /* eslint-disable import/no-extraneous-dependencies */ -import { Match, Template } from '@aws-cdk/assertions'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import { Stack } from '../../../core'; import { behavior, LegacyTestGitHubNpmPipeline, OneStackApp, PIPELINE_ENV, TestApp, ModernTestGitHubNpmPipeline, stringLike } from '../testhelpers'; let app: TestApp; diff --git a/packages/@aws-cdk/pipelines/test/compliance/escape-hatching.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/escape-hatching.test.ts similarity index 97% rename from packages/@aws-cdk/pipelines/test/compliance/escape-hatching.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/escape-hatching.test.ts index e7d7539fb33f5..bc63841e496ca 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/escape-hatching.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/escape-hatching.test.ts @@ -1,8 +1,8 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cp from '@aws-cdk/aws-codepipeline'; -import * as cpa from '@aws-cdk/aws-codepipeline-actions'; +import { Match, Template } from '../../../assertions'; +import * as cp from '../../../aws-codepipeline'; +import * as cpa from '../../../aws-codepipeline-actions'; import { describeDeprecated } from '@aws-cdk/cdk-build-tools'; -import { SecretValue, Stack } from '@aws-cdk/core'; +import { SecretValue, Stack } from '../../../core'; import * as cdkp from '../../lib'; import { CodePipelineFileSet } from '../../lib'; import { behavior, FileAssetApp, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, PIPELINE_ENV, TestApp, TestGitHubAction } from '../testhelpers'; diff --git a/packages/@aws-cdk/pipelines/test/compliance/security-check.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/security-check.test.ts similarity index 99% rename from packages/@aws-cdk/pipelines/test/compliance/security-check.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/security-check.test.ts index a2700fa9c782b..88138cb2b840f 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/security-check.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/security-check.test.ts @@ -1,6 +1,6 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { Topic } from '@aws-cdk/aws-sns'; -import { Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import { Topic } from '../../../aws-sns'; +import { Stack } from '../../../core'; import * as cdkp from '../../lib'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; import { LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, OneStackApp, PIPELINE_ENV, TestApp, stringLike } from '../testhelpers'; diff --git a/packages/@aws-cdk/pipelines/test/compliance/self-mutation.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/self-mutation.test.ts similarity index 96% rename from packages/@aws-cdk/pipelines/test/compliance/self-mutation.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/self-mutation.test.ts index e42a9ae14a0ab..ba0a532653426 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/self-mutation.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/self-mutation.test.ts @@ -1,8 +1,8 @@ /* eslint-disable import/no-extraneous-dependencies */ -import { Match, Template } from '@aws-cdk/assertions'; -import * as cb from '@aws-cdk/aws-codebuild'; -import * as cp from '@aws-cdk/aws-codepipeline'; -import { Stack, Stage } from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import * as cb from '../../../aws-codebuild'; +import * as cp from '../../../aws-codepipeline'; +import { Stack, Stage } from '../../../core'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; import { behavior, LegacyTestGitHubNpmPipeline, PIPELINE_ENV, TestApp, ModernTestGitHubNpmPipeline } from '../testhelpers'; @@ -53,7 +53,7 @@ behavior('CodePipeline has self-mutation stage', (suite) => { BuildSpec: Match.serializedJson(Match.objectLike({ phases: { install: { - commands: ['npm install -g aws-cdk@1'], + commands: ['npm install -g aws-cdk@2'], }, build: { commands: Match.arrayWith(['cdk -a . deploy PipelineStack --require-approval=never --verbose']), @@ -289,7 +289,7 @@ behavior('self-mutation stage can be customized with BuildSpec', (suite) => { BuildSpec: Match.serializedJson(Match.objectLike({ phases: { install: { - commands: ['npm config set registry example.com', 'npm install -g aws-cdk@1'], + commands: ['npm config set registry example.com', 'npm install -g aws-cdk@2'], }, build: { commands: Match.arrayWith(['cdk -a . deploy PipelineStack --require-approval=never --verbose']), diff --git a/packages/@aws-cdk/pipelines/test/compliance/stack-ordering.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/stack-ordering.test.ts similarity index 98% rename from packages/@aws-cdk/pipelines/test/compliance/stack-ordering.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/stack-ordering.test.ts index 9b056b8af2ece..827c2839a6462 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/stack-ordering.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/stack-ordering.test.ts @@ -1,5 +1,5 @@ -import { Match, Template } from '@aws-cdk/assertions'; -import { App, Stack } from '@aws-cdk/core'; +import { Match, Template } from '../../../assertions'; +import { App, Stack } from '../../../core'; import { behavior, LegacyTestGitHubNpmPipeline, ModernTestGitHubNpmPipeline, OneStackApp, PIPELINE_ENV, sortByRunOrder, TestApp, ThreeStackApp, TwoStackApp } from '../testhelpers'; let app: App; diff --git a/packages/@aws-cdk/pipelines/test/compliance/synths.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/synths.test.ts similarity index 98% rename from packages/@aws-cdk/pipelines/test/compliance/synths.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/synths.test.ts index 4b93acd5657ca..46024a653d0cf 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/synths.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/synths.test.ts @@ -1,11 +1,11 @@ -import { Capture, Match, Template } from '@aws-cdk/assertions'; -import * as cbuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as ecr from '@aws-cdk/aws-ecr'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack } from '@aws-cdk/core'; +import { Capture, Match, Template } from '../../../assertions'; +import * as cbuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as ec2 from '../../../aws-ec2'; +import * as ecr from '../../../aws-ecr'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import { Stack } from '../../../core'; import * as cdkp from '../../lib'; import { CodeBuildStep } from '../../lib'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; diff --git a/packages/@aws-cdk/pipelines/test/compliance/validations.test.ts b/packages/aws-cdk-lib/pipelines/test/compliance/validations.test.ts similarity index 98% rename from packages/@aws-cdk/pipelines/test/compliance/validations.test.ts rename to packages/aws-cdk-lib/pipelines/test/compliance/validations.test.ts index 2c8a2b6309d3a..13d5777602b53 100644 --- a/packages/@aws-cdk/pipelines/test/compliance/validations.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/compliance/validations.test.ts @@ -1,11 +1,11 @@ /* eslint-disable import/no-extraneous-dependencies */ -import { Capture, Match, Template } from '@aws-cdk/assertions'; -import * as codebuild from '@aws-cdk/aws-codebuild'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; -import * as s3 from '@aws-cdk/aws-s3'; -import { Stack } from '@aws-cdk/core'; +import { Capture, Match, Template } from '../../../assertions'; +import * as codebuild from '../../../aws-codebuild'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as ec2 from '../../../aws-ec2'; +import * as iam from '../../../aws-iam'; +import * as s3 from '../../../aws-s3'; +import { Stack } from '../../../core'; import * as cdkp from '../../lib'; import { CodePipelineSource, ShellStep } from '../../lib'; import { CDKP_DEFAULT_CODEBUILD_IMAGE } from '../../lib/private/default-codebuild-image'; diff --git a/packages/aws-cdk-lib/pipelines/test/docker-credentials.test.ts b/packages/aws-cdk-lib/pipelines/test/docker-credentials.test.ts new file mode 100644 index 0000000000000..41f363a5d3488 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/test/docker-credentials.test.ts @@ -0,0 +1,400 @@ +import { Match, Template } from '../../assertions'; +import * as ec2 from '../../aws-ec2'; +import * as ecr from '../../aws-ecr'; +import * as iam from '../../aws-iam'; +import * as secretsmanager from '../../aws-secretsmanager'; +import * as cdk from '../../core'; +import { DockerAssetApp, TestApp } from './testhelpers'; +import * as cdkp from '../lib'; +import { ShellStep } from '../lib'; + +let app: cdk.App; +let stack: cdk.Stack; + +beforeEach(() => { + app = new TestApp(); + stack = new cdk.Stack(app, 'Stack', { + env: { account: '0123456789012', region: 'eu-west-1' }, + }); +}); + +describe('ExternalDockerCredential', () => { + + let secret: secretsmanager.ISecret; + + beforeEach(() => { + secret = new secretsmanager.Secret(stack, 'Secret'); + }); + + test('dockerHub defaults registry domain', () => { + const creds = cdkp.DockerCredential.dockerHub(secret); + + expect(Object.keys(creds._renderCdkAssetsConfig())).toEqual(['https://index.docker.io/v1/']); + }); + + test('minimal example only renders secret', () => { + const creds = cdkp.DockerCredential.customRegistry('example.com', secret); + + const config = creds._renderCdkAssetsConfig(); + expect(stack.resolve(config)).toEqual({ + 'example.com': { + secretsManagerSecretId: { Ref: 'SecretA720EF05' }, + }, + }); + }); + + test('maximum example includes all expected properties', () => { + const roleArn = 'arn:aws:iam::0123456789012:role/MyRole'; + const creds = cdkp.DockerCredential.customRegistry('example.com', secret, { + secretUsernameField: 'login', + secretPasswordField: 'pass', + assumeRole: iam.Role.fromRoleArn(stack, 'Role', roleArn), + }); + + const config = creds._renderCdkAssetsConfig(); + expect(stack.resolve(config)).toEqual({ + 'example.com': { + secretsManagerSecretId: { Ref: 'SecretA720EF05' }, + secretsUsernameField: 'login', + secretsPasswordField: 'pass', + assumeRoleArn: roleArn, + }, + }); + }); + + describe('grantRead', () => { + + test('grants read access to the secret', () => { + const creds = cdkp.DockerCredential.customRegistry('example.com', secret); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], + Effect: 'Allow', + Resource: { Ref: 'SecretA720EF05' }, + }, + ], + Version: '2012-10-17', + }, + Users: [{ Ref: 'User00B015A1' }], + }); + }); + + test('grants read access to the secret to the assumeRole if provided', () => { + const assumeRole = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::0123456789012:role/MyRole'); + const creds = cdkp.DockerCredential.customRegistry('example.com', secret, { assumeRole }); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: ['secretsmanager:GetSecretValue', 'secretsmanager:DescribeSecret'], + Effect: 'Allow', + Resource: { Ref: 'SecretA720EF05' }, + }], + Version: '2012-10-17', + }, + Roles: ['MyRole'], + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Resource: 'arn:aws:iam::0123456789012:role/MyRole', + }], + Version: '2012-10-17', + }, + Users: [{ Ref: 'User00B015A1' }], + }); + }); + + test('does not grant any access if the usage does not match', () => { + const assumeRole = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::0123456789012:role/MyRole'); + const creds = cdkp.DockerCredential.customRegistry('example.com', secret, { + assumeRole, + usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], + }); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.SELF_UPDATE); + + Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); + }); + + }); + +}); + +describe('EcrDockerCredential', () => { + + let repo: ecr.IRepository; + + beforeEach(() => { + repo = ecr.Repository.fromRepositoryArn(stack, 'Repo', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo'); + }); + + test('minimal example only renders ecrRepository', () => { + const creds = cdkp.DockerCredential.ecr([repo]); + + const config = creds._renderCdkAssetsConfig(); + + expect(stack.resolve(Object.keys(config))).toEqual([{ + 'Fn::Select': [ + 0, { + 'Fn::Split': ['/', { + 'Fn::Join': ['', ['0123456789012.dkr.ecr.eu-west-1.', { Ref: 'AWS::URLSuffix' }, '/Repo']], + }], + }, + ], + }]); + expect(Object.values(config)).toEqual([{ + ecrRepository: true, + }]); + }); + + test('maximum example renders all fields', () => { + const roleArn = 'arn:aws:iam::0123456789012:role/MyRole'; + const creds = cdkp.DockerCredential.ecr([repo], { + assumeRole: iam.Role.fromRoleArn(stack, 'Role', roleArn), + usages: [cdkp.DockerCredentialUsage.SYNTH], + }); + + const config = creds._renderCdkAssetsConfig(); + + expect(stack.resolve(Object.keys(config))).toEqual([{ + 'Fn::Select': [ + 0, { + 'Fn::Split': ['/', { + 'Fn::Join': ['', ['0123456789012.dkr.ecr.eu-west-1.', { Ref: 'AWS::URLSuffix' }, '/Repo']], + }], + }, + ], + }]); + expect(Object.values(config)).toEqual([{ + assumeRoleArn: roleArn, + ecrRepository: true, + }]); + }); + + describe('grantRead', () => { + + test('grants pull access to the repo', () => { + const creds = cdkp.DockerCredential.ecr([repo]); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: [ + 'ecr:BatchCheckLayerAvailability', + 'ecr:GetDownloadUrlForLayer', + 'ecr:BatchGetImage', + ], + Effect: 'Allow', + Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo', + }, + { + Action: 'ecr:GetAuthorizationToken', + Effect: 'Allow', + Resource: '*', + }], + Version: '2012-10-17', + }, + Users: [{ Ref: 'User00B015A1' }], + }); + }); + + test('grants pull access to the assumed role', () => { + const assumeRole = iam.Role.fromRoleArn(stack, 'Role', 'arn:aws:iam::0123456789012:role/MyRole'); + const creds = cdkp.DockerCredential.ecr([repo], { assumeRole }); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: [ + 'ecr:BatchCheckLayerAvailability', + 'ecr:GetDownloadUrlForLayer', + 'ecr:BatchGetImage', + ], + Effect: 'Allow', + Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo', + }, + { + Action: 'ecr:GetAuthorizationToken', + Effect: 'Allow', + Resource: '*', + }], + Version: '2012-10-17', + }, + Roles: ['MyRole'], + }); + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [{ + Action: 'sts:AssumeRole', + Effect: 'Allow', + Resource: 'arn:aws:iam::0123456789012:role/MyRole', + }], + Version: '2012-10-17', + }, + Users: [{ Ref: 'User00B015A1' }], + }); + }); + + test('grants pull access to multiple repos if provided', () => { + const repo2 = ecr.Repository.fromRepositoryArn(stack, 'Repo2', 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2'); + const creds = cdkp.DockerCredential.ecr([repo, repo2]); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: Match.arrayWith([{ + Action: [ + 'ecr:BatchCheckLayerAvailability', + 'ecr:GetDownloadUrlForLayer', + 'ecr:BatchGetImage', + ], + Effect: 'Allow', + Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo', + }, + { + Action: 'ecr:GetAuthorizationToken', + Effect: 'Allow', + Resource: '*', + }, + { + Action: [ + 'ecr:BatchCheckLayerAvailability', + 'ecr:GetDownloadUrlForLayer', + 'ecr:BatchGetImage', + ], + Effect: 'Allow', + Resource: 'arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2', + }]), + Version: '2012-10-17', + }, + Users: [{ Ref: 'User00B015A1' }], + }); + }); + + test('does not grant any access if the usage does not match', () => { + const creds = cdkp.DockerCredential.ecr([repo], { usages: [cdkp.DockerCredentialUsage.SYNTH] }); + + const user = new iam.User(stack, 'User'); + creds.grantRead(user, cdkp.DockerCredentialUsage.ASSET_PUBLISHING); + + Template.fromStack(stack).resourceCountIs('AWS::IAM::Policy', 0); + }); + }); + + // This test doesn't actually work yet. See https://github.com/aws/aws-cdk/issues/16164 + // eslint-disable-next-line jest/no-disabled-tests + test.skip('with non-parallel publishing', () => { + const pipelines = new cdkp.CodePipeline(stack, 'Pipeline', { + synth: new ShellStep('Build', { + input: cdkp.CodePipelineSource.gitHub('test/test', 'test'), + commands: ['cdk synth'], + }), + + publishAssetsInParallel: false, + dockerCredentials: [ + cdkp.DockerCredential.ecr([repo]), + ], + }); + pipelines.addStage(new DockerAssetApp(stack, 'AssetApp')); + + // Should not throw + app.synth(); + }); +}); + +describe('dockerCredentialsInstallCommands', () => { + const secretArn = 'arn:aws:secretsmanager:eu-west-1:0123456789012:secret:mySecret-012345'; + let secret: secretsmanager.ISecret; + + beforeEach(() => { + secret = secretsmanager.Secret.fromSecretCompleteArn(stack, 'Secret', secretArn); + }); + + test('returns a blank array for empty inputs', () => { + expect(cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH)).toEqual([]); + expect(cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [])).toEqual([]); + }); + + test('returns only credentials relevant to the current usage', () => { + const synthCreds = cdkp.DockerCredential.customRegistry('synth.example.com', secret, { + usages: [cdkp.DockerCredentialUsage.SYNTH], + }); + const selfUpdateCreds = cdkp.DockerCredential.customRegistry('selfupdate.example.com', secret, { + usages: [cdkp.DockerCredentialUsage.SELF_UPDATE], + }); + const assetPublishingCreds = cdkp.DockerCredential.customRegistry('assetpublishing.example.com', secret, { + usages: [cdkp.DockerCredentialUsage.ASSET_PUBLISHING], + }); + + const commands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, + [synthCreds, selfUpdateCreds, assetPublishingCreds]).join('|'); + + expect(commands.includes('synth')).toBeTruthy(); + expect(commands.includes('selfupdate')).toBeFalsy(); + expect(commands.includes('assetpublishing')).toBeFalsy(); + }); + + test('defaults to Linux-style commands', () => { + const creds = cdkp.DockerCredential.dockerHub(secret); + + const defaultCommands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds]); + const linuxCommands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds], ec2.OperatingSystemType.LINUX); + + expect(defaultCommands).toEqual(linuxCommands); + }); + + test('Linux commands', () => { + const creds = cdkp.DockerCredential.customRegistry('example.com', secret); + const expectedCredsFile = JSON.stringify({ + version: '1.0', + domainCredentials: { + 'example.com': { secretsManagerSecretId: secretArn }, + }, + }); + + const commands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds], ec2.OperatingSystemType.LINUX); + + expect(commands).toEqual([ + 'mkdir $HOME/.cdk', + `echo '${expectedCredsFile}' > $HOME/.cdk/cdk-docker-creds.json`, + ]); + }); + + test('Windows commands', () => { + const creds = cdkp.DockerCredential.customRegistry('example.com', secret); + const expectedCredsFile = JSON.stringify({ + version: '1.0', + domainCredentials: { + 'example.com': { secretsManagerSecretId: secretArn }, + }, + }); + + const commands = cdkp.dockerCredentialsInstallCommands(cdkp.DockerCredentialUsage.SYNTH, [creds], ec2.OperatingSystemType.WINDOWS); + + expect(commands).toEqual([ + 'mkdir %USERPROFILE%\\.cdk', + `echo '${expectedCredsFile}' > %USERPROFILE%\\.cdk\\cdk-docker-creds.json`, + ]); + }); +}); diff --git a/packages/@aws-cdk/pipelines/test/legacy/fs.test.ts b/packages/aws-cdk-lib/pipelines/test/legacy/fs.test.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/legacy/fs.test.ts rename to packages/aws-cdk-lib/pipelines/test/legacy/fs.test.ts diff --git a/packages/@aws-cdk/pipelines/test/main/pipeline-base.test.ts b/packages/aws-cdk-lib/pipelines/test/main/pipeline-base.test.ts similarity index 96% rename from packages/@aws-cdk/pipelines/test/main/pipeline-base.test.ts rename to packages/aws-cdk-lib/pipelines/test/main/pipeline-base.test.ts index 680f33f7dc602..eced0f15babed 100644 --- a/packages/@aws-cdk/pipelines/test/main/pipeline-base.test.ts +++ b/packages/aws-cdk-lib/pipelines/test/main/pipeline-base.test.ts @@ -1,4 +1,4 @@ -import * as cdk from '@aws-cdk/core'; +import * as cdk from '../../../core'; import { Construct } from 'constructs'; import { App } from '../../../core/lib'; import { PipelineBase, IFileSetProducer, FileSet } from '../../lib'; diff --git a/packages/@aws-cdk/pipelines/test/private/identifiers.test.ts b/packages/aws-cdk-lib/pipelines/test/private/identifiers.test.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/private/identifiers.test.ts rename to packages/aws-cdk-lib/pipelines/test/private/identifiers.test.ts diff --git a/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile b/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile new file mode 100644 index 0000000000000..d67ab4b1cc12c --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-docker-asset/Dockerfile @@ -0,0 +1,2 @@ +FROM scratch +RUN touch built.txt \ No newline at end of file diff --git a/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-file-asset-two.txt b/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-file-asset-two.txt new file mode 100644 index 0000000000000..8b1c7231bf2f4 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-file-asset-two.txt @@ -0,0 +1 @@ +Here's a second file asset. \ No newline at end of file diff --git a/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-file-asset.txt b/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-file-asset.txt new file mode 100644 index 0000000000000..95e9dcd2e3bf0 --- /dev/null +++ b/packages/aws-cdk-lib/pipelines/test/testhelpers/assets/test-file-asset.txt @@ -0,0 +1 @@ +This is a file asset that's just here for kicks. \ No newline at end of file diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/compliance.ts b/packages/aws-cdk-lib/pipelines/test/testhelpers/compliance.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/testhelpers/compliance.ts rename to packages/aws-cdk-lib/pipelines/test/testhelpers/compliance.ts diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/index.ts b/packages/aws-cdk-lib/pipelines/test/testhelpers/index.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/testhelpers/index.ts rename to packages/aws-cdk-lib/pipelines/test/testhelpers/index.ts diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/legacy-pipeline.ts b/packages/aws-cdk-lib/pipelines/test/testhelpers/legacy-pipeline.ts similarity index 90% rename from packages/@aws-cdk/pipelines/test/testhelpers/legacy-pipeline.ts rename to packages/aws-cdk-lib/pipelines/test/testhelpers/legacy-pipeline.ts index e5435b3315aa9..4b7b76d5dbcc9 100644 --- a/packages/@aws-cdk/pipelines/test/testhelpers/legacy-pipeline.ts +++ b/packages/aws-cdk-lib/pipelines/test/testhelpers/legacy-pipeline.ts @@ -1,6 +1,6 @@ -import * as codepipeline from '@aws-cdk/aws-codepipeline'; -import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; -import { SecretValue } from '@aws-cdk/core'; +import * as codepipeline from '../../../aws-codepipeline'; +import * as codepipeline_actions from '../../../aws-codepipeline-actions'; +import { SecretValue } from '../../../core'; import { Construct } from 'constructs'; import * as cdkp from '../../lib'; diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/matchers.ts b/packages/aws-cdk-lib/pipelines/test/testhelpers/matchers.ts similarity index 97% rename from packages/@aws-cdk/pipelines/test/testhelpers/matchers.ts rename to packages/aws-cdk-lib/pipelines/test/testhelpers/matchers.ts index e0d5f270a9952..ea64e02a0a469 100644 --- a/packages/@aws-cdk/pipelines/test/testhelpers/matchers.ts +++ b/packages/aws-cdk-lib/pipelines/test/testhelpers/matchers.ts @@ -1,4 +1,4 @@ -import { Match, Matcher, MatchResult } from '@aws-cdk/assertions'; +import { Match, Matcher, MatchResult } from '../../../assertions'; export function stringLike(pattern: string) { return new StringLike(pattern); diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/modern-pipeline.ts b/packages/aws-cdk-lib/pipelines/test/testhelpers/modern-pipeline.ts similarity index 100% rename from packages/@aws-cdk/pipelines/test/testhelpers/modern-pipeline.ts rename to packages/aws-cdk-lib/pipelines/test/testhelpers/modern-pipeline.ts diff --git a/packages/@aws-cdk/pipelines/test/testhelpers/test-app.ts b/packages/aws-cdk-lib/pipelines/test/testhelpers/test-app.ts similarity index 97% rename from packages/@aws-cdk/pipelines/test/testhelpers/test-app.ts rename to packages/aws-cdk-lib/pipelines/test/testhelpers/test-app.ts index 051407f946370..06d770e81fd0f 100644 --- a/packages/@aws-cdk/pipelines/test/testhelpers/test-app.ts +++ b/packages/aws-cdk-lib/pipelines/test/testhelpers/test-app.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as ecr_assets from '@aws-cdk/aws-ecr-assets'; -import * as s3 from '@aws-cdk/aws-s3'; -import * as s3_assets from '@aws-cdk/aws-s3-assets'; -import { App, AppProps, Environment, CfnOutput, Stage, StageProps, Stack, StackProps } from '@aws-cdk/core'; +import * as ecr_assets from '../../../aws-ecr-assets'; +import * as s3 from '../../../aws-s3'; +import * as s3_assets from '../../../aws-s3-assets'; +import { App, AppProps, Environment, CfnOutput, Stage, StageProps, Stack, StackProps } from '../../../core'; import { Construct } from 'constructs'; import { assemblyBuilderOf } from '../../lib/private/construct-internals'; diff --git a/packages/aws-cdk-lib/product-stack-snapshots/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v1.product.template.json b/packages/aws-cdk-lib/product-stack-snapshots/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v1.product.template.json new file mode 100644 index 0000000000000..2aed5b94c12d2 --- /dev/null +++ b/packages/aws-cdk-lib/product-stack-snapshots/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v1.product.template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "SNSTopicProductStack2A8A6280F": { + "Type": "AWS::SNS::Topic" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/product-stack-snapshots/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v2.product.template.json b/packages/aws-cdk-lib/product-stack-snapshots/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v2.product.template.json new file mode 100644 index 0000000000000..9e26dfeeb6e64 --- /dev/null +++ b/packages/aws-cdk-lib/product-stack-snapshots/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v2.product.template.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/aws-cdk-lib/product-stack-snapshots/nested/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v1.product.template.json b/packages/aws-cdk-lib/product-stack-snapshots/nested/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v1.product.template.json new file mode 100644 index 0000000000000..86a6e4c7fffbf --- /dev/null +++ b/packages/aws-cdk-lib/product-stack-snapshots/nested/StackMyProductStackHistory8F05371C.StackProductStack190B56DE.v1.product.template.json @@ -0,0 +1,7 @@ +{ + "Resources": { + "SNSTopicProductStack331064FB": { + "Type": "AWS::SNS::Topic" + } + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/region-info/.jsiirc.json b/packages/aws-cdk-lib/region-info/.jsiirc.json new file mode 100644 index 0000000000000..07270ae91503b --- /dev/null +++ b/packages/aws-cdk-lib/region-info/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.regioninfo" + }, + "dotnet": { + "namespace": "Amazon.CDK.RegionInfo" + }, + "python": { + "module": "aws_cdk.region_info" + } + } +} diff --git a/packages/aws-cdk-lib/region-info/README.md b/packages/aws-cdk-lib/region-info/README.md new file mode 100644 index 0000000000000..fcbbeeeceda26 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/README.md @@ -0,0 +1,84 @@ +# AWS Region-Specific Information Directory + + +## Usage + +Some information used in CDK Applications differs from one AWS region to +another, such as service principals used in IAM policies, S3 static website +endpoints, ... + +### The `RegionInfo` class + +The library offers a simple interface to obtain region specific information in +the form of the `RegionInfo` class. This is the preferred way to interact with +the regional information database: + +```ts +// Get the information for "eu-west-1": +const region = regionInfo.RegionInfo.get('eu-west-1'); + +// Access attributes: +region.s3StaticWebsiteEndpoint; // s3-website-eu-west-1.amazonaws.com +region.servicePrincipal('logs.amazonaws.com'); // logs.eu-west-1.amazonaws.com +``` + +The `RegionInfo` layer is built on top of the Low-Level API, which is described +below and can be used to register additional data, including user-defined facts +that are not available through the `RegionInfo` interface. + +### Low-Level API + +This library offers a primitive database of such information so that CDK +constructs can easily access regional information. The `FactName` class provides +a list of known fact names, which can then be used with the `RegionInfo` to +retrieve a particular value: + +```ts +const codeDeployPrincipal = regionInfo.Fact.find('us-east-1', regionInfo.FactName.servicePrincipal('codedeploy.amazonaws.com')); +// => codedeploy.us-east-1.amazonaws.com + +const staticWebsite = regionInfo.Fact.find('ap-northeast-1', regionInfo.FactName.S3_STATIC_WEBSITE_ENDPOINT); +// => s3-website-ap-northeast-1.amazonaws.com +``` + +## Supplying new or missing information + +As new regions are released, it might happen that a particular fact you need is +missing from the library. In such cases, the `Fact.register` method can be used +to inject FactName into the database: + +```ts +class MyFact implements regionInfo.IFact { + public readonly region = 'bermuda-triangle-1'; + public readonly name = regionInfo.FactName.servicePrincipal('s3.amazonaws.com'); + public readonly value = 's3-website.bermuda-triangle-1.nowhere.com'; +} + +regionInfo.Fact.register(new MyFact()); +``` + +## Overriding incorrect information + +In the event information provided by the library is incorrect, it can be +overridden using the same `Fact.register` method demonstrated above, simply +adding an extra boolean argument: + +```ts +class MyFact implements regionInfo.IFact { + public readonly region = 'us-east-1'; + public readonly name = regionInfo.FactName.servicePrincipal('service.amazonaws.com'); + public readonly value = 'the-correct-principal.amazonaws.com'; +} + +regionInfo.Fact.register(new MyFact(), true /* Allow overriding information */); +``` + +If you happen to have stumbled upon incorrect data built into this library, it +is always a good idea to report your findings in a [GitHub issue], so we can fix +it for everyone else! + +[GitHub issue]: https://github.com/aws/aws-cdk/issues + +--- + +This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. diff --git a/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts b/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts new file mode 100644 index 0000000000000..f7f7bd911d226 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/build-tools/fact-tables.ts @@ -0,0 +1,1236 @@ +export const AWS_CDK_METADATA = new Set([ + 'us-east-2', + 'us-east-1', + 'us-west-1', + 'us-west-2', + // 'us-gov-east-1', + // 'us-gov-west-1', + // 'us-iso-east-1', + // 'us-isob-east-1', + 'af-south-1', + 'ap-south-1', + 'ap-east-1', + // 'ap-northeast-3', + 'ap-northeast-2', + 'ap-southeast-1', + 'ap-southeast-2', + 'ap-northeast-1', + 'ca-central-1', + 'cn-north-1', + 'cn-northwest-1', + 'eu-central-1', + 'eu-west-1', + 'eu-west-2', + 'eu-west-3', + 'eu-north-1', + 'eu-south-1', + // 'eu-south-2', + 'me-south-1', + // 'me-central-1', + 'sa-east-1', + // 'ap-south-2', + // 'eu-central-2', +]); + +/** + * The hosted zone Id if using an alias record in Route53. + * + * @see https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_region + */ +export const ROUTE_53_BUCKET_WEBSITE_ZONE_IDS: { [region: string]: string } = { + 'af-south-1': 'Z11KHD8FBVPUYU', + 'ap-east-1': 'ZNB98KWMFR0R6', + 'ap-northeast-1': 'Z2M4EHUR26P7ZW', + 'ap-northeast-2': 'Z3W03O7B5YMIYP', + 'ap-northeast-3': 'Z2YQB5RD63NC85', + 'ap-south-1': 'Z11RGJOFQNVJUP', + 'ap-south-2': 'Z02976202B4EZMXIPMXF7', + 'ap-southeast-1': 'Z3O0J2DXBE1FTB', + 'ap-southeast-2': 'Z1WCIGYICN2BYD', + 'ap-southeast-3': 'Z01846753K324LI26A3VV', + 'ca-central-1': 'Z1QDHH18159H29', + 'cn-northwest-1': 'Z282HJ1KT0DH03', + 'eu-central-1': 'Z21DNDUVLTQW6Q', + 'eu-central-2': 'Z030506016YDQGETNASS', + 'eu-north-1': 'Z3BAZG2TWCNX0D', + 'eu-south-1': 'Z3IXVV8C73GIO3', + 'eu-south-2': 'Z0081959F7139GRJC19J', + 'eu-west-1': 'Z1BKCTXD74EZPE', + 'eu-west-2': 'Z3GKZC51ZF0DB4', + 'eu-west-3': 'Z3R1K369G5AVDG', + 'me-south-1': 'Z1MPMWCPA7YB62', + 'me-central-1': 'Z06143092I8HRXZRUZROF', + 'sa-east-1': 'Z7KQH4QJS55SO', + 'us-east-1': 'Z3AQBSTGFYJSTF', + 'us-east-2': 'Z2O1EMRO9K5GLX', + 'us-gov-east-1': 'Z2NIFVYYW2VKV1', + 'us-gov-west-1': 'Z31GFT0UA1I2HV', + 'us-west-1': 'Z2F56UZL2M1ACD', + 'us-west-2': 'Z3BJ6K6RIION7M', +}; + +/** + * The hosted zone Id of the Elastic Beanstalk environment. + * + * @see https://docs.aws.amazon.com/general/latest/gr/elasticbeanstalk.html + */ +export const EBS_ENV_ENDPOINT_HOSTED_ZONE_IDS: { [region: string]: string } = { + 'af-south-1': 'Z1EI3BVKMKK4AM', + 'ap-east-1': 'ZPWYUBWRU171A', + 'ap-northeast-1': 'Z1R25G3KIG2GBW', + 'ap-northeast-2': 'Z3JE5OI70TWKCP', + 'ap-northeast-3': 'ZNE5GEY1TIAGY', + 'ap-south-1': 'Z18NTBI3Y7N9TZ', + 'ap-southeast-1': 'Z16FZ9L249IFLT', + 'ap-southeast-2': 'Z2PCDNR3VC2G1N', + 'ca-central-1': 'ZJFCZL7SSZB5I', + 'eu-central-1': 'Z1FRNW7UH4DEZJ', + 'eu-north-1': 'Z23GO28BZ5AETM', + 'eu-south-1': 'Z10VDYYOA2JFKM', + 'eu-west-1': 'Z2NYPWQ7DFZAZH', + 'eu-west-2': 'Z1GKAAAUGATPF1', + 'eu-west-3': 'Z5WN6GAYWG5OB', + 'me-south-1': 'Z2BBTEKR2I36N2', + 'sa-east-1': 'Z10X7K2B4QSOFV', + 'us-east-1': 'Z117KPS5GTRQ2G', + 'us-east-2': 'Z14LCN19Q5QHIC', + 'us-gov-east-1': 'Z35TSARG0EJ4VU', + 'us-gov-west-1': 'Z4KAURWC4UUUG', + 'us-west-1': 'Z1LQECGX5PH1X', + 'us-west-2': 'Z38NKT9BP95V3O', +}; + +interface Region { partition: string, domainSuffix: string } + +export const PARTITION_MAP: { [region: string]: Region } = { + 'default': { partition: 'aws', domainSuffix: 'amazonaws.com' }, + 'cn-': { partition: 'aws-cn', domainSuffix: 'amazonaws.com.cn' }, + 'us-gov-': { partition: 'aws-us-gov', domainSuffix: 'amazonaws.com' }, + 'us-iso-': { partition: 'aws-iso', domainSuffix: 'c2s.ic.gov' }, + 'us-isob-': { partition: 'aws-iso-b', domainSuffix: 'sc2s.sgov.gov' }, +}; + +// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html#access-logging-bucket-permissions +// https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy +// Any not listed regions use the service principal "logdelivery.elasticloadbalancing.amazonaws.com" +export const ELBV2_ACCOUNTS: { [region: string]: string } = { + 'af-south-1': '098369216593', + 'ap-east-1': '754344448648', + 'ap-northeast-1': '582318560864', + 'ap-northeast-2': '600734575887', + 'ap-northeast-3': '383597477331', + 'ap-south-1': '718504428378', + 'ap-southeast-1': '114774131450', + 'ap-southeast-2': '783225319266', + 'ap-southeast-3': '589379963580', + 'ca-central-1': '985666609251', + 'cn-north-1': '638102146993', + 'cn-northwest-1': '037604701340', + 'eu-central-1': '054676820928', + 'eu-north-1': '897822967062', + 'eu-south-1': '635631232127', + 'eu-west-1': '156460612806', + 'eu-west-2': '652711504416', + 'eu-west-3': '009996457667', + 'me-south-1': '076674570225', + 'sa-east-1': '507241528517', + 'us-east-1': '127311923021', + 'us-east-2': '033677994240', + 'us-gov-east-1': '190560391635', + 'us-gov-west-1': '048591011584', + 'us-west-1': '027434742980', + 'us-west-2': '797873946194', + 'us-iso-east-1': '770363063475', + 'us-iso-west-1': '121062877647', + 'us-isob-east-1': '740734521339', +}; + +// https://aws.amazon.com/releasenotes/available-deep-learning-containers-images +export const DLC_REPOSITORY_ACCOUNTS: { [region: string]: string } = { + 'ap-east-1': '871362719292', + 'ap-northeast-1': '763104351884', + 'ap-northeast-2': '763104351884', + 'ap-south-1': '763104351884', + 'ap-southeast-1': '763104351884', + 'ap-southeast-2': '763104351884', + 'ca-central-1': '763104351884', + 'cn-north-1': '727897471807', + 'cn-northwest-1': '727897471807', + 'eu-central-1': '763104351884', + 'eu-north-1': '763104351884', + 'eu-west-1': '763104351884', + 'eu-west-2': '763104351884', + 'eu-west-3': '763104351884', + 'me-south-1': '217643126080', + 'sa-east-1': '763104351884', + 'us-east-1': '763104351884', + 'us-east-2': '763104351884', + 'us-west-1': '763104351884', + 'us-west-2': '763104351884', +}; + +// https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html +// https://docs.amazonaws.cn/app-mesh/latest/userguide/envoy.html +export const APPMESH_ECR_ACCOUNTS: { [region: string]: string } = { + 'af-south-1': '924023996002', + 'ap-east-1': '856666278305', + 'ap-northeast-1': '840364872350', + 'ap-northeast-2': '840364872350', + 'ap-northeast-3': '840364872350', + 'ap-south-1': '840364872350', + 'ap-southeast-1': '840364872350', + 'ap-southeast-2': '840364872350', + 'ap-southeast-3': '909464085924', + 'ca-central-1': '840364872350', + 'cn-north-1': '919366029133', + 'cn-northwest-1': '919830735681', + 'eu-central-1': '840364872350', + 'eu-north-1': '840364872350', + 'eu-south-1': '422531588944', + 'eu-west-1': '840364872350', + 'eu-west-2': '840364872350', + 'eu-west-3': '840364872350', + 'me-south-1': '772975370895', + 'sa-east-1': '840364872350', + 'us-east-1': '840364872350', + 'us-east-2': '840364872350', + 'us-west-1': '840364872350', + 'us-west-2': '840364872350', +}; + +// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versions.html +export const CLOUDWATCH_LAMBDA_INSIGHTS_ARNS: { [key: string]: any } = { + '1.0.178.0': { + x86_64: { + // Asia Pacific (Hyderabad) + 'ap-south-2': 'arn:aws:lambda:ap-south-2:891564319516:layer:LambdaInsightsExtension:6', + // Asia Pacific (Jakarta) + 'ap-southeast-3': 'arn:aws:lambda:ap-southeast-3:439286490199:layer:LambdaInsightsExtension:8', + // Europe (Spain) + 'eu-south-2': 'arn:aws:lambda:eu-south-2:352183217350:layer:LambdaInsightsExtension:2', + // Europe (Zurich) + 'eu-central-2': 'arn:aws:lambda:eu-central-2:033019950311:layer:LambdaInsightsExtension:7', + // Middle East (UAE) + 'me-central-1': 'arn:aws:lambda:me-central-1:732604637566:layer:LambdaInsightsExtension:6', + }, + }, + '1.0.143.0': { + x86_64: { + // US East (N. Virginia) + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:21', + // US East (Ohio) + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:21', + // US West (N. California) + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:20', + // US West (Oregon) + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:21', + // Africa (Cape Town) + 'af-south-1': 'arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:13', + // Asia Pacific (Hong Kong) + 'ap-east-1': 'arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:13', + // Asia Pacific (Mumbai) + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:21', + // Asia Pacific (Osaka) + 'ap-northeast-3': 'arn:aws:lambda:ap-northeast-3:194566237122:layer:LambdaInsightsExtension:2', + // Asia Pacific (Seoul) + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:20', + // Asia Pacific (Singapore) + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:21', + // Asia Pacific (Sydney) + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:21', + // Asia Pacific (Tokyo) + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:31', + // Canada (Central) + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:20', + // China (Beijing) + 'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:14', + // China (Ningxia) + 'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:14', + // Europe (Frankfurt) + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:21', + // Europe (Ireland) + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:21', + // Europe (London) + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:21', + // Europe (Milan) + 'eu-south-1': 'arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:13', + // Europe (Paris) + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:20', + // Europe (Stockholm) + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:20', + // Middle East (Bahrain) + 'me-south-1': 'arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:13', + // South America (Sao Paulo) + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:20', + }, + }, + '1.0.135.0': { + arm64: { + // US East (N. Virginia) + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // US East (Ohio) + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // US West (Oregon) + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Asia Pacific (Mumbai) + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Asia Pacific (Singapore) + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Asia Pacific (Sydney) + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Asia Pacific (Tokyo) + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Europe (Frankfurt) + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Europe (Ireland) + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension-Arm64:2', + // Europe (London) + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:2', + }, + x86_64: { + // US East (N. Virginia) + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:18', + // US East (Ohio) + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:18', + // US West (N. California) + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:18', + // US West (Oregon) + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:18', + // Africa (Cape Town) + 'af-south-1': 'arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:11', + // Asia Pacific (Hong Kong) + 'ap-east-1': 'arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:11', + // Asia Pacific (Mumbai) + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:18', + // Asia Pacific (Osaka) + 'ap-northeast-3': 'arn:aws:lambda:ap-northeast-3:194566237122:layer:LambdaInsightsExtension:1', + // Asia Pacific (Seoul) + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:18', + // Asia Pacific (Singapore) + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:18', + // Asia Pacific (Sydney) + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:18', + // Asia Pacific (Tokyo) + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:25', + // Canada (Central) + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:18', + // China (Beijing) + 'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:11', + // China (Ningxia) + 'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:11', + // Europe (Frankfurt) + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:18', + // Europe (Ireland) + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:18', + // Europe (London) + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:18', + // Europe (Milan) + 'eu-south-1': 'arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:11', + // Europe (Paris) + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:18', + // Europe (Stockholm) + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:18', + // Middle East (Bahrain) + 'me-south-1': 'arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:11', + // South America (Sao Paulo) + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:18', + }, + }, + '1.0.119.0': { + arm64: { + // US East (N. Virginia) + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // US East (Ohio) + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // US West (Oregon) + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Asia Pacific (Mumbai) + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Asia Pacific (Singapore) + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Asia Pacific (Sydney) + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Asia Pacific (Tokyo) + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Europe (Frankfurt) + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Europe (Ireland) + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension-Arm64:1', + // Europe (London) + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:1', + }, + x86_64: { + // US East (N. Virginia) + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:16', + // US East (Ohio) + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:16', + // US West (N. California) + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:16', + // US West (Oregon) + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:16', + // Africa (Cape Town) + 'af-south-1': 'arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:9', + // Asia Pacific (Hong Kong) + 'ap-east-1': 'arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:9', + // Asia Pacific (Mumbai) + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:16', + // Asia Pacific (Seoul) + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:16', + // Asia Pacific (Singapore) + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:16', + // Asia Pacific (Sydney) + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:16', + // Asia Pacific (Tokyo) + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:23', + // Canada (Central) + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:16', + // China (Beijing) + 'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:9', + // China (Ningxia) + 'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:9', + // Europe (Frankfurt) + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:16', + // Europe (Ireland) + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:16', + // Europe (London) + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:16', + // Europe (Milan) + 'eu-south-1': 'arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:9', + // Europe (Paris) + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:16', + // Europe (Stockholm) + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:16', + // Middle East (Bahrain) + 'me-south-1': 'arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:9', + // South America (Sao Paulo) + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:16', + }, + }, + '1.0.98.0': { + x86_64: { + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:14', + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:14', + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:14', + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:14', + 'af-south-1': 'arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:8', + 'ap-east-1': 'arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:8', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:14', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:14', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:14', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:14', + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:14', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:14', + 'cn-north-1': 'arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:8', + 'cn-northwest-1': 'arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:8', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:14', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:14', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:14', + 'eu-south-1': 'arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:8', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:14', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:14', + 'me-south-1': 'arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:8', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:14', + }, + }, + '1.0.89.0': { + x86_64: { + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:12', + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:12', + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:12', + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:12', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:12', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:12', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:12', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:12', + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:12', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:12', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:12', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:12', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:12', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:12', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:12', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:12', + }, + }, + '1.0.86.0': { + x86_64: { + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:11', + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:11', + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:11', + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:11', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:11', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:11', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:11', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:11', + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:11', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:11', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:11', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:11', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:11', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:11', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:11', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:11', + }, + }, + '1.0.54.0': { + x86_64: { + 'us-east-1': 'arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:2', + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:2', + }, + }, +}; + +// https://docs.aws.amazon.com/firehose/latest/dev/controlling-access.html#using-iam-rs-vpc +export const FIREHOSE_CIDR_BLOCKS: { [region: string]: string } = { + 'af-south-1': '13.244.121.224', + 'ap-east-1': '18.162.221.32', + 'ap-northeast-1': '13.113.196.224', + 'ap-northeast-2': '13.209.1.64', + 'ap-northeast-3': '13.208.177.192', + 'ap-south-1': '13.232.67.32', + 'ap-southeast-1': '13.228.64.192', + 'ap-southeast-2': '13.210.67.224', + 'ap-southeast-3': '108.136.221.64', + 'ca-central-1': '35.183.92.128', + 'cn-north-1': '52.81.151.32', + 'cn-northwest-1': '161.189.23.64', + 'eu-central-1': '35.158.127.160', + 'eu-central-2': '16.62.183.32', + 'eu-north-1': '13.53.63.224', + 'eu-south-1': '15.161.135.128', + 'eu-south-2': '18.100.71.96', + 'eu-west-1': '52.19.239.192', + 'eu-west-2': '18.130.1.96', + 'eu-west-3': '35.180.1.96', + 'me-south-1': '15.185.91.0', + 'sa-east-1': '18.228.1.128', + 'us-east-1': '52.70.63.192', + 'us-east-2': '13.58.135.96', + 'us-gov-east-1': '18.253.138.96', + 'us-gov-west-1': '52.61.204.160', + 'us-west-1': '13.57.135.192', + 'us-west-2': '52.89.255.224', +}; + +const ADOT_LAMBDA_LAYER_JAVA_SDK_ARNS: { [version: string]: { [arch: string]: { [region: string]: string } } } = { + '1.23.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-23-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-23-0:1', + }, + }, + '1.21.1': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-1:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-1:1', + }, + }, + '1.21.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-21-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-21-0:1', + }, + }, + '1.19.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-amd64-ver-1-19-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-wrapper-arm64-ver-1-19-0:1', + }, + }, +}; + +const ADOT_LAMBDA_LAYER_JAVA_AUTO_INSTRUMENTATION_ARNS: { + [version: string]: { [arch: string]: { [region: string]: string } }; +} = { + '1.23.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-23-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-23-0:1', + }, + }, + '1.21.1': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-1:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-1:1', + }, + }, + '1.21.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-21-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-21-0:1', + }, + }, + '1.19.2': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-amd64-ver-1-19-2:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-java-agent-arm64-ver-1-19-2:1', + }, + }, +}; + +const ADOT_LAMBDA_LAYER_JAVASCRIPT_SDK_ARNS: { [version: string]: { [arch: string]: { [region: string]: string } } } = { + '1.9.1': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-9-1:2', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-9-1:2', + }, + }, + '1.8.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-8-0:2', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-8-0:2', + }, + }, + '1.7.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-amd64-ver-1-7-0:2', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-arm64-ver-1-7-0:2', + }, + }, +}; + +const ADOT_LAMBDA_LAYER_PYTHON_SDK_ARNS: { [version: string]: { [arch: string]: { [region: string]: string } } } = { + '1.16.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-16-0:2', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-arm64-ver-1-16-0:2', + }, + }, + '1.15.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-15-0:2', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-arm64-ver-1-15-0:2', + }, + }, + '1.13.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-amd64-ver-1-13-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-python-arm64-ver-1-13-0:1', + }, + }, +}; + +const ADOT_LAMBDA_LAYER_GENERIC_ARNS: { [version: string]: { [arch: string]: { [region: string]: string } } } = { + '0.72.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-72-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-72-0:1', + }, + }, + '0.70.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-70-0:4', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-70-0:4', + }, + }, + '0.68.0': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-68-0:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-68-0:1', + }, + }, + '0.62.1': { + x86_64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-amd64-ver-0-62-1:1', + }, + arm64: { + 'ap-northeast-1': 'arn:aws:lambda:ap-northeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'ap-northeast-2': 'arn:aws:lambda:ap-northeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'ap-south-1': 'arn:aws:lambda:ap-south-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'ap-southeast-1': 'arn:aws:lambda:ap-southeast-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'ap-southeast-2': 'arn:aws:lambda:ap-southeast-2:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'ca-central-1': 'arn:aws:lambda:ca-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'eu-central-1': 'arn:aws:lambda:eu-central-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'eu-north-1': 'arn:aws:lambda:eu-north-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'eu-west-1': 'arn:aws:lambda:eu-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'eu-west-2': 'arn:aws:lambda:eu-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'eu-west-3': 'arn:aws:lambda:eu-west-3:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'sa-east-1': 'arn:aws:lambda:sa-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'us-east-1': 'arn:aws:lambda:us-east-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'us-east-2': 'arn:aws:lambda:us-east-2:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'us-west-1': 'arn:aws:lambda:us-west-1:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + 'us-west-2': 'arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-collector-arm64-ver-0-62-1:1', + }, + }, +}; + +export const ADOT_LAMBDA_LAYER_ARNS: { [key: string]: any } = { + JAVA_SDK: ADOT_LAMBDA_LAYER_JAVA_SDK_ARNS, + JAVA_AUTO_INSTRUMENTATION: ADOT_LAMBDA_LAYER_JAVA_AUTO_INSTRUMENTATION_ARNS, + JAVASCRIPT_SDK: ADOT_LAMBDA_LAYER_JAVASCRIPT_SDK_ARNS, + PYTHON_SDK: ADOT_LAMBDA_LAYER_PYTHON_SDK_ARNS, + GENERIC: ADOT_LAMBDA_LAYER_GENERIC_ARNS, +}; diff --git a/packages/aws-cdk-lib/region-info/build-tools/generate-static-data.ts b/packages/aws-cdk-lib/region-info/build-tools/generate-static-data.ts new file mode 100644 index 0000000000000..4db884ef2d892 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/build-tools/generate-static-data.ts @@ -0,0 +1,159 @@ +import * as path from 'path'; +import * as fs from 'fs-extra'; +import { + APPMESH_ECR_ACCOUNTS, AWS_CDK_METADATA, CLOUDWATCH_LAMBDA_INSIGHTS_ARNS, DLC_REPOSITORY_ACCOUNTS, + ELBV2_ACCOUNTS, FIREHOSE_CIDR_BLOCKS, PARTITION_MAP, ROUTE_53_BUCKET_WEBSITE_ZONE_IDS, EBS_ENV_ENDPOINT_HOSTED_ZONE_IDS, ADOT_LAMBDA_LAYER_ARNS, +} from './fact-tables'; +import { + AWS_REGIONS, + AWS_SERVICES, + before, + RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN, + RULE_CLASSIC_PARTITION_BECOMES_OPT_IN, +} from '../lib/aws-entities'; +import { Default } from '../lib/default'; + +export async function main(): Promise { + checkRegions(APPMESH_ECR_ACCOUNTS); + checkRegions(DLC_REPOSITORY_ACCOUNTS); + checkRegions(ELBV2_ACCOUNTS); + checkRegions(FIREHOSE_CIDR_BLOCKS); + checkRegions(ROUTE_53_BUCKET_WEBSITE_ZONE_IDS); + checkRegionsSubMap(CLOUDWATCH_LAMBDA_INSIGHTS_ARNS); + + const lines = [ + "import { Fact, FactName } from './fact';", + '', + '/* eslint-disable quote-props */', + '/* eslint-disable max-len */', + '', + '/**', + ' * Built-in regional information, re-generated by `npm run build`.', + ' *', + ` * @generated ${new Date().toISOString()}`, + ' */', + 'export class BuiltIns {', + ' /**', + ' * Registers all the built in regional data in the RegionInfo database.', + ' */', + ' public static register(): void {', + ]; + + const defaultMap = 'default'; + + for (const region of AWS_REGIONS) { + let partition = PARTITION_MAP[defaultMap].partition; + let domainSuffix = PARTITION_MAP[defaultMap].domainSuffix; + + for (const key in PARTITION_MAP) { + if (region.startsWith(key)) { + partition = PARTITION_MAP[key].partition; + domainSuffix = PARTITION_MAP[key].domainSuffix; + } + } + + registerFact(region, 'PARTITION', partition); + registerFact(region, 'DOMAIN_SUFFIX', domainSuffix); + + registerFact(region, 'CDK_METADATA_RESOURCE_AVAILABLE', AWS_CDK_METADATA.has(region) ? 'YES' : 'NO'); + + registerFact(region, 'IS_OPT_IN_REGION', partition === 'aws' && after(region, RULE_CLASSIC_PARTITION_BECOMES_OPT_IN) ? 'YES' : 'NO'); + + registerFact(region, 'S3_STATIC_WEBSITE_ENDPOINT', before(region, RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN) + ? `s3-website-${region}.${domainSuffix}` + : `s3-website.${region}.${domainSuffix}`); + + registerFact(region, 'S3_STATIC_WEBSITE_ZONE_53_HOSTED_ZONE_ID', ROUTE_53_BUCKET_WEBSITE_ZONE_IDS[region] || ''); + + registerFact(region, 'EBS_ENV_ENDPOINT_HOSTED_ZONE_ID', EBS_ENV_ENDPOINT_HOSTED_ZONE_IDS[region] || ''); + + registerFact(region, 'ELBV2_ACCOUNT', ELBV2_ACCOUNTS[region]); + + registerFact(region, 'DLC_REPOSITORY_ACCOUNT', DLC_REPOSITORY_ACCOUNTS[region]); + + registerFact(region, 'APPMESH_ECR_ACCOUNT', APPMESH_ECR_ACCOUNTS[region]); + + const firehoseCidrBlock = FIREHOSE_CIDR_BLOCKS[region]; + if (firehoseCidrBlock) { + registerFact(region, 'FIREHOSE_CIDR_BLOCK', `${FIREHOSE_CIDR_BLOCKS[region]}/27`); + } + + const vpcEndpointServiceNamePrefix = `${domainSuffix.split('.').reverse().join('.')}.vpce`; + registerFact(region, 'VPC_ENDPOINT_SERVICE_NAME_PREFIX', vpcEndpointServiceNamePrefix); + + for (const service of AWS_SERVICES) { + registerFact(region, ['servicePrincipal', service], Default.servicePrincipal(service, region, domainSuffix)); + } + + for (const version in CLOUDWATCH_LAMBDA_INSIGHTS_ARNS) { + for (const arch in CLOUDWATCH_LAMBDA_INSIGHTS_ARNS[version]) { + registerFact(region, ['cloudwatchLambdaInsightsVersion', version, arch], CLOUDWATCH_LAMBDA_INSIGHTS_ARNS[version][arch][region]); + + } + } + + for (const type in ADOT_LAMBDA_LAYER_ARNS) { + for (const version in ADOT_LAMBDA_LAYER_ARNS[type]) { + for (const arch in ADOT_LAMBDA_LAYER_ARNS[type][version]) { + registerFact( + region, + ['adotLambdaLayer', type, version, arch], + ADOT_LAMBDA_LAYER_ARNS[type][version][arch][region], + ); + } + } + } + } + lines.push(' }'); + lines.push(''); + lines.push(' private constructor() {}'); + lines.push('}'); + + await fs.writeFile(path.resolve(__dirname, '..', 'lib', 'built-ins.generated.ts'), lines.join('\n')); + + function registerFact(region: string, name: string | string[], value: string) { + const factName = typeof name === 'string' ? name : `${name[0]}(${name.slice(1).map(s => JSON.stringify(s)).join(', ')})`; + lines.push(` Fact.register({ region: ${JSON.stringify(region)}, name: FactName.${factName}, value: ${JSON.stringify(value)} });`); + } +} + +/** + * Verifies that the provided map of region to fact does not contain an entry + * for a region that was not registered in `AWS_REGIONS`. + */ +function checkRegions(map: Record) { + const allRegions = new Set(AWS_REGIONS); + for (const region of Object.keys(map)) { + if (!allRegions.has(region)) { + throw new Error(`Un-registered region fact found: ${region}. Add to AWS_REGIONS list!`); + } + } +} + +/** + * Verifies that the provided map of to region to fact does not contain an entry + * for a region that was not registered in `AWS_REGIONS`. + */ +function checkRegionsSubMap(map: Record>>) { + const allRegions = new Set(AWS_REGIONS); + for (const key of Object.keys(map)) { + for (const subKey of Object.keys(map[key])) { + for (const region of Object.keys(map[key][subKey])) { + if (!allRegions.has(region)) { + throw new Error(`Un-registered region fact found: ${region}. Add to AWS_REGIONS list!`); + } + } + + } + } +} + +export function after(region: string, ruleOrRegion: string | symbol) { + return region !== ruleOrRegion && !before(region, ruleOrRegion); +} + +main().catch(e => { + // eslint-disable-next-line no-console + console.error(e); + process.exit(-1); +}); diff --git a/packages/aws-cdk-lib/region-info/build-tools/generate.sh b/packages/aws-cdk-lib/region-info/build-tools/generate.sh new file mode 100644 index 0000000000000..66bb576070aa0 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/build-tools/generate.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -euo pipefail + +echo "⏳ Compiling static data generator..." +tsc \ + --alwaysStrict \ + --lib ES2017 \ + --module CommonJS \ + --noFallthroughCasesInSwitch \ + --noImplicitAny \ + --noImplicitReturns \ + --noImplicitThis \ + --noUnusedLocals \ + --noUnusedParameters \ + --resolveJsonModule \ + --strict \ + --strictNullChecks \ + --target ES2020 \ + build-tools/*.ts + +echo "⌛️ Generating the static data..." +node build-tools/generate-static-data.js + +echo "🍻 Pre-Build Complete!" diff --git a/packages/aws-cdk-lib/region-info/index.ts b/packages/aws-cdk-lib/region-info/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/region-info/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/aws-cdk-lib/region-info/lib/aws-entities.ts b/packages/aws-cdk-lib/region-info/lib/aws-entities.ts new file mode 100644 index 0000000000000..1a3e8895c25ee --- /dev/null +++ b/packages/aws-cdk-lib/region-info/lib/aws-entities.ts @@ -0,0 +1,138 @@ +/** + * After this point, S3 website domains look like `s3-website.REGION.s3.amazonaws.com` + * + * Before this point, S3 website domains look like `s3-website-REGION.s3.amazonaws.com`. + */ +export const RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN = Symbol('S3_WEBSITE_REGIONAL_SUBDOMAIN'); + +/** + * After this point, all regions in the 'aws' partition are opt-in. + */ +export const RULE_CLASSIC_PARTITION_BECOMES_OPT_IN = Symbol('CLASSIC_PARTITION_BECOMES_OPT_IN'); + +/** + * List of AWS region, ordered by launch date (oldest to newest) + * + * The significance of this is that standards and conventions change over time. + * Generally, as rules are changed they only apply to new regions, and old + * regions are left as-is. + * + * We mix the list of regions with a list of rules that were introduced over + * time (rules are symbols). + * + * Therefore, if we want to know if a rule applies to a certain region, we + * only need to check its position in the list and compare it to when a + * rule was introduced. + */ +export const AWS_REGIONS_AND_RULES: readonly (string | symbol)[] = [ + 'us-east-1', // US East (N. Virginia) + 'eu-west-1', // Europe (Ireland) + 'us-west-1', // US West (N. California) + 'ap-southeast-1', // Asia Pacific (Singapore) + 'ap-northeast-1', // Asia Pacific (Tokyo) + 'us-gov-west-1', // AWS GovCloud (US-West) + 'us-west-2', // US West (Oregon) + 'sa-east-1', // South America (São Paulo) + 'ap-southeast-2', // Asia Pacific (Sydney) + RULE_S3_WEBSITE_REGIONAL_SUBDOMAIN, + 'cn-north-1', // China (Beijing) + 'us-iso-east-1', // AWS ISO + 'eu-central-1', // Europe (Frankfurt) + 'ap-northeast-2', // Asia Pacific (Seoul) + 'ap-south-1', // Asia Pacific (Mumbai) + 'us-east-2', // US East (Ohio) + 'ca-central-1', // Canada (Central) + 'eu-west-2', // Europe (London) + 'us-isob-east-1', // AWS ISO-B + 'cn-northwest-1', // China (Ningxia) + 'eu-west-3', // Europe (Paris) + 'ap-northeast-3', // Asia Pacific (Osaka) + 'us-gov-east-1', // AWS GovCloud (US-East) + 'eu-north-1', // Europe (Stockholm) + RULE_CLASSIC_PARTITION_BECOMES_OPT_IN, + 'ap-east-1', // Asia Pacific (Hong Kong) + 'me-south-1', // Middle East (Bahrain) + 'eu-south-1', // Europe (Milan) + 'af-south-1', // Africa (Cape Town) + 'us-iso-west-1', // US ISO West + 'eu-south-2', // Europe (Spain) + 'ap-southeast-3', // Asia Pacific (Jakarta) + 'me-central-1', // Middle East (UAE) + 'ap-south-2', // Asia Pacific (Hyderabad) + 'eu-central-2', // Europe (Zurich) +]; + +/** + * The names of all (known) AWS regions + * + * Not in the list ==> no built-in data for that region. + */ +export const AWS_REGIONS = AWS_REGIONS_AND_RULES + .filter((x) => typeof x === 'string') + .sort() as readonly string[]; + +/** + * Possibly non-exhaustive list of all service names, used to locate service principals. + * + * Not in the list ==> default service principal mappings. + */ +export const AWS_SERVICES: readonly string[] = [ + 'application-autoscaling', + 'autoscaling', + 'codedeploy', + 'ec2', + 'events', + 'lambda', + 'logs', + 's3', + 'ssm', + 'sns', + 'sqs', + 'states', +].sort(); + +/** + * Whether or not a region predates a given rule (or region). + * + * Unknown region => we have to assume no. + */ +export function before(region: string, ruleOrRegion: string | symbol) { + const ruleIx = AWS_REGIONS_AND_RULES.indexOf(ruleOrRegion); + if (ruleIx === -1) { + throw new Error(`Unknown rule: ${String(ruleOrRegion)}`); + } + const regionIx = AWS_REGIONS_AND_RULES.indexOf(region); + return regionIx === -1 ? false : regionIx < ruleIx; +} + +/** + * Return all regions before a given rule was introduced (or region) + */ +export function regionsBefore(ruleOrRegion: string | symbol): string[] { + const ruleIx = AWS_REGIONS_AND_RULES.indexOf(ruleOrRegion); + if (ruleIx === -1) { + throw new Error(`Unknown rule: ${String(ruleOrRegion)}`); + } + return AWS_REGIONS_AND_RULES.slice(0, ruleIx) + .filter((entry) => typeof entry === 'string') + .sort() as string[]; +} + +export interface Region { readonly partition: string, readonly domainSuffix: string } + +const PARTITION_MAP: {readonly [region: string]: Region } = { + 'default': { partition: 'aws', domainSuffix: 'amazonaws.com' }, + 'cn-': { partition: 'aws-cn', domainSuffix: 'amazonaws.com.cn' }, + 'us-gov-': { partition: 'aws-us-gov', domainSuffix: 'amazonaws.com' }, + 'us-iso-': { partition: 'aws-iso', domainSuffix: 'c2s.ic.gov' }, + 'us-isob-': { partition: 'aws-iso-b', domainSuffix: 'sc2s.sgov.gov' }, +}; + +export function partitionInformation(region: string): Region { + for (const [prefix, info] of Object.entries(PARTITION_MAP)) { + if (region.startsWith(prefix)) { + return info; + } + } + return PARTITION_MAP.default; +} diff --git a/packages/aws-cdk-lib/region-info/lib/default.ts b/packages/aws-cdk-lib/region-info/lib/default.ts new file mode 100644 index 0000000000000..ded4f1d36551b --- /dev/null +++ b/packages/aws-cdk-lib/region-info/lib/default.ts @@ -0,0 +1,127 @@ +/** + * Provides default values for certain regional information points. + */ +export class Default { + + /** + * The default value for a VPC Endpoint Service name prefix, useful if you do + * not have a synthesize-time region literal available (all you have is + * `{ "Ref": "AWS::Region" }`) + */ + public static readonly VPC_ENDPOINT_SERVICE_NAME_PREFIX = 'com.amazonaws.vpce'; + + /** + * Computes a "standard" AWS Service principal for a given service, region and suffix. This is useful for example when + * you need to compute a service principal name, but you do not have a synthesize-time region literal available (so + * all you have is `{ "Ref": "AWS::Region" }`). This way you get the same defaulting behavior that is normally used + * for built-in data. + * + * @param serviceFqn the name of the service (s3, s3.amazonaws.com, ...) + * @param region the region in which the service principal is needed. + * @param urlSuffix deprecated and ignored. + */ + public static servicePrincipal(serviceFqn: string, region: string, urlSuffix: string): string { + // NOTE: this whole method is deprecated, and should not be used or updated anymore. The global service + // principal is always correct, when referenced from within a region. + // (As a note, regional principals (`..amazonaws.com`) are required in + // case of a cross-region reference to an opt-in region, but that's the only case, and that is not + // controlled here). + // + // (It cannot be actually @deprecated since many of our tests use it :D) + + const serviceName = extractSimpleName(serviceFqn); + if (!serviceName) { + // Return "service" if it does not look like any of the following: + // - s3 + // - s3.amazonaws.com + // - s3.amazonaws.com.cn + // - s3.c2s.ic.gov + // - s3.sc2s.sgov.gov + return serviceFqn; + } + + function determineConfiguration(service: string): (service: string, region: string, urlSuffix: string) => string { + function universal(s: string) { return `${s}.amazonaws.com`; } + function partitional(s: string, _: string, u: string) { return `${s}.${u}`; } + function regional(s: string, r: string) { return `${s}.${r}.amazonaws.com`; } + function regionalPartitional(s: string, r: string, u: string) { return `${s}.${r}.${u}`; } + + // Exceptions for Service Principals in us-iso-* + const US_ISO_EXCEPTIONS = new Set([ + 'cloudhsm', + 'config', + 'states', + 'workspaces', + ]); + + // Account for idiosyncratic Service Principals in `us-iso-*` regions + if (region.startsWith('us-iso-') && US_ISO_EXCEPTIONS.has(service)) { + switch (service) { + // Services with universal principal + case ('states'): + return universal; + + // Services with a partitional principal + default: + return partitional; + } + } + + // Exceptions for Service Principals in us-isob-* + const US_ISOB_EXCEPTIONS = new Set([ + 'dms', + 'states', + ]); + + // Account for idiosyncratic Service Principals in `us-isob-*` regions + if (region.startsWith('us-isob-') && US_ISOB_EXCEPTIONS.has(service)) { + switch (service) { + // Services with universal principal + case ('states'): + return universal; + + // Services with a partitional principal + default: + return partitional; + } + } + + switch (service) { + // CodeDeploy is regional+partitional in CN, only regional everywhere else + case 'codedeploy': + return region.startsWith('cn-') + ? regionalPartitional + // ...except in the isolated regions, where it's universal + : (region.startsWith('us-iso') ? universal : regional); + + // Services with a regional AND partitional principal + case 'logs': + return regionalPartitional; + + // Services with a regional principal + case 'states': + return regional; + + case 'elasticmapreduce': + return region.startsWith('cn-') + ? partitional + : universal; + + // Services with a universal principal across all regions/partitions (the default case) + default: + return universal; + + } + }; + + const configuration = determineConfiguration(serviceName); + return configuration(serviceName, region, urlSuffix); + } + + private constructor() { } +} + +function extractSimpleName(serviceFqn: string) { + const matches = serviceFqn.match(/^([^.]+)(?:(?:\.amazonaws\.com(?:\.cn)?)|(?:\.c2s\.ic\.gov)|(?:\.sc2s\.sgov\.gov))?$/); + return matches ? matches[1] : undefined; +} diff --git a/packages/aws-cdk-lib/region-info/lib/fact.ts b/packages/aws-cdk-lib/region-info/lib/fact.ts new file mode 100644 index 0000000000000..efd9932e31908 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/lib/fact.ts @@ -0,0 +1,206 @@ +import { AWS_REGIONS } from './aws-entities'; + +/** + * A database of regional information. + */ +export class Fact { + /** + * @returns the list of names of AWS regions for which there is at least one registered fact. This + * may not be an exhaustive list of all available AWS regions. + */ + public static get regions(): string[] { + // Return by copy to ensure no modifications can be made to the undelying constant. + return Array.from(AWS_REGIONS); + } + + /** + * Retrieves a fact from this Fact database. + * + * @param region the name of the region (e.g: `us-east-1`) + * @param name the name of the fact being looked up (see the `FactName` class for details) + * + * @returns the fact value if it is known, and `undefined` otherwise. + */ + public static find(region: string, name: string): string | undefined { + const regionFacts = this.database[region]; + return regionFacts && regionFacts[name]; + } + + /** + * Retrieve a fact from the Fact database. (retrieval will fail if the specified region or + * fact name does not exist.) + * + * @param region the name of the region (e.g: `us-east-1`) + * @param name the name of the fact being looked up (see the `FactName` class for details) + */ + public static requireFact(region: string, name: string): string { + const foundFact = this.find(region, name); + + if (!foundFact) { + throw new Error(`No fact ${name} could be found for region: ${region} and name: ${name}`); + } + + return foundFact; + } + + /** + * Registers a new fact in this Fact database. + * + * @param fact the new fact to be registered. + * @param allowReplacing whether new facts can replace existing facts or not. + */ + public static register(fact: IFact, allowReplacing = false): void { + const regionFacts = this.database[fact.region] || (this.database[fact.region] = {}); + if (fact.name in regionFacts && regionFacts[fact.name] !== fact.value && !allowReplacing) { + throw new Error(`Region ${fact.region} already has a fact ${fact.name}, with value ${regionFacts[fact.name]}`); + } + if (fact.value !== undefined) { + regionFacts[fact.name] = fact.value; + } + } + + /** + * Removes a fact from the database. + * @param region the region for which the fact is to be removed. + * @param name the name of the fact to remove. + * @param value the value that should be removed (removal will fail if the value is specified, but does not match the + * current stored value). + */ + public static unregister(region: string, name: string, value?: string): void { + const regionFacts = this.database[region] || {}; + if (name in regionFacts && value && regionFacts[name] !== value) { + throw new Error(`Attempted to remove ${name} from ${region} with value ${value}, but the fact's value is ${regionFacts[name]}`); + } + delete regionFacts[name]; + } + + private static readonly database: { [region: string]: { [name: string]: string } } = {}; + + private constructor() { + throw new Error('Use the static methods of Fact instead!'); + } +} + +/** + * A fact that can be registered about a particular region. + */ +export interface IFact { + /** + * The region for which this fact applies. + */ + readonly region: string; + + /** + * The name of this fact. Standardized values are provided by the `Facts` class. + */ + readonly name: string; + + /** + * The value of this fact. + */ + readonly value: string | undefined; +} + +/** + * All standardized fact names. + */ +export class FactName { + /** + * The name of the partition for a region (e.g: 'aws', 'aws-cn', ...) + */ + public static readonly PARTITION = 'partition'; + + /** + * The domain suffix for a region (e.g: 'amazonaws.com`) + */ + public static readonly DOMAIN_SUFFIX = 'domainSuffix'; + + /** + * Whether the AWS::CDK::Metadata CloudFormation Resource is available in-region or not. The value is a boolean + * modelled as `YES` or `NO`. + */ + public static readonly CDK_METADATA_RESOURCE_AVAILABLE = 'cdk:metadata-resource:available'; + + /** + * Whether the given region is an opt-in region or not. The value is a boolean + * modelled as `YES` or `NO`. + */ + public static readonly IS_OPT_IN_REGION = 'aws:is-opt-in-region'; + + /** + * The endpoint used for hosting S3 static websites + */ + public static readonly S3_STATIC_WEBSITE_ENDPOINT = 's3-static-website:endpoint'; + + /** + * The endpoint used for aliasing S3 static websites in Route 53 + */ + public static readonly S3_STATIC_WEBSITE_ZONE_53_HOSTED_ZONE_ID = 's3-static-website:route-53-hosted-zone-id'; + + /** + * The hosted zone ID used by Route 53 to alias a EBS environment endpoint in this region (e.g: Z2O1EMRO9K5GLX) + */ + public static readonly EBS_ENV_ENDPOINT_HOSTED_ZONE_ID = 'ebs-environment:route-53-hosted-zone-id'; + + /** + * The prefix for VPC Endpoint Service names, + * cn.com.amazonaws.vpce for China regions, + * com.amazonaws.vpce otherwise. + */ + public static readonly VPC_ENDPOINT_SERVICE_NAME_PREFIX = 'vpcEndpointServiceNamePrefix'; + + /** + * The account for ELBv2 in this region + */ + public static readonly ELBV2_ACCOUNT = 'elbv2Account'; + + /** + * The ID of the AWS account that owns the public ECR repository that contains the + * AWS Deep Learning Containers images in a given region. + */ + public static readonly DLC_REPOSITORY_ACCOUNT = 'dlcRepositoryAccount'; + + /** + * The ID of the AWS account that owns the public ECR repository that contains the + * AWS App Mesh Envoy Proxy images in a given region. + */ + public static readonly APPMESH_ECR_ACCOUNT = 'appMeshRepositoryAccount'; + + /** + * The CIDR block used by Kinesis Data Firehose servers. + */ + public static readonly FIREHOSE_CIDR_BLOCK = 'firehoseCidrBlock'; + + /** + * The ARN of CloudWatch Lambda Insights for a version (e.g. 1.0.98.0) + */ + public static cloudwatchLambdaInsightsVersion(version: string, arch?: string) { + // if we are provided an architecture use that, otherwise + // default to x86_64 for backwards compatibility + const suffix = version.split('.').join('_') + `_${arch ?? 'x86_64'}`; + return `cloudwatch-lambda-insights-version:${suffix}`; + } + + /** + * The name of the regional service principal for a given service. + * + * @param service the service name, either simple (e.g: `s3`, `codedeploy`) or qualified (e.g: `s3.amazonaws.com`). + * The `.amazonaws.com` and `.amazonaws.com.cn` domains are stripped from service names, so they are + * canonicalized in that respect. + */ + public static servicePrincipal(service: string): string { + return `service-principal:${service.replace(/\.amazonaws\.com(\.cn)?$/, '')}`; + } + + /** + * The ARN of Amazon Distro for OpenTelemetry (ADOT) Lambda layer for a given lambda type, version and architecture. + * + * @param type the type of the ADOT lambda layer + * @param version the layer version. + * @param architecture the Lambda Function architecture (e.g. 'x86_64' or 'arm64') + */ + public static adotLambdaLayer(type: string, version: string, architecture: string): string { + const suffix = type + '_' + version.split('.').join('_') + '_' + architecture; + return `adot-lambda-layer:${suffix}`; + } +} diff --git a/packages/aws-cdk-lib/region-info/lib/index.ts b/packages/aws-cdk-lib/region-info/lib/index.ts new file mode 100644 index 0000000000000..88d63dffc1c7d --- /dev/null +++ b/packages/aws-cdk-lib/region-info/lib/index.ts @@ -0,0 +1,8 @@ +export * from './default'; + +export * from './fact'; +export * from './region-info'; + +import { BuiltIns } from './built-ins.generated'; + +BuiltIns.register(); diff --git a/packages/aws-cdk-lib/region-info/lib/region-info.ts b/packages/aws-cdk-lib/region-info/lib/region-info.ts new file mode 100644 index 0000000000000..099218434c2c7 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/lib/region-info.ts @@ -0,0 +1,181 @@ +import { partitionInformation } from './aws-entities'; +import { Fact, FactName } from './fact'; + +/** + * Information pertaining to an AWS region. + */ +export class RegionInfo { + /** + * @returns the list of names of AWS regions for which there is at least one registered fact. This + * may not be an exaustive list of all available AWS regions. + */ + public static get regions(): RegionInfo[] { + return Fact.regions.map(RegionInfo.get); + } + + /** + * Retrieves a collection of all fact values for all regions that fact is defined in. + * + * @param factName the name of the fact to retrieve values for. + * For a list of common fact names, see the FactName class + * @returns a mapping with AWS region codes as the keys, + * and the fact in the given region as the value for that key + */ + public static regionMap(factName: string): { [region: string]: string } { + const ret: { [region: string]: string } = {}; + for (const regionInfo of RegionInfo.regions) { + const fact = Fact.find(regionInfo.name, factName); + if (fact) { + ret[regionInfo.name] = fact; + } + } + return ret; + } + + /** + * Retrieves a collection of all fact values for all regions, limited to some partitions + * + * @param factName the name of the fact to retrieve values for. + * For a list of common fact names, see the FactName class + * @param partitions list of partitions to retrieve facts for. Defaults + * to `['aws', 'aws-cn']`. + * @returns a mapping with AWS region codes as the keys, + * and the fact in the given region as the value for that key + */ + public static limitedRegionMap(factName: string, partitions: string[]): { [region: string]: string } { + const ret: Record = {}; + for (const [region, value] of Object.entries(RegionInfo.regionMap(factName))) { + if (partitions.includes(partitionInformation(region).partition)) { + ret[region] = value; + } + } + return ret; + } + + /** + * Obtain region info for a given region name. + * + * @param name the name of the region (e.g: us-east-1) + */ + public static get(name: string): RegionInfo { + return new RegionInfo(name); + } + + private constructor(public readonly name: string) {} + + /** + * Whether the `AWS::CDK::Metadata` CloudFormation Resource is available in this region or not. + */ + public get cdkMetadataResourceAvailable(): boolean { + return Fact.find(this.name, FactName.CDK_METADATA_RESOURCE_AVAILABLE) === 'YES'; + } + + /** + * Whether the given region is an opt-in region + */ + public get isOptInRegion(): boolean { + return Fact.find(this.name, FactName.IS_OPT_IN_REGION) === 'YES'; + } + + /** + * The domain name suffix (e.g: amazonaws.com) for this region. + */ + public get domainSuffix(): string | undefined { + return Fact.find(this.name, FactName.DOMAIN_SUFFIX); + } + + /** + * The name of the ARN partition for this region (e.g: aws). + */ + public get partition(): string | undefined { + return Fact.find(this.name, FactName.PARTITION); + } + + /** + * The endpoint used by S3 static website hosting in this region (e.g: s3-static-website-us-east-1.amazonaws.com) + */ + public get s3StaticWebsiteEndpoint(): string | undefined { + return Fact.find(this.name, FactName.S3_STATIC_WEBSITE_ENDPOINT); + } + + /** + * The hosted zone ID used by Route 53 to alias a S3 static website in this region (e.g: Z2O1EMRO9K5GLX) + */ + public get s3StaticWebsiteHostedZoneId(): string | undefined { + return Fact.find(this.name, FactName.S3_STATIC_WEBSITE_ZONE_53_HOSTED_ZONE_ID); + } + + /** + * The hosted zone ID used by Route 53 to alias a EBS environment endpoint in this region (e.g: Z2O1EMRO9K5GLX) + */ + public get ebsEnvEndpointHostedZoneId(): string | undefined { + return Fact.find(this.name, FactName.EBS_ENV_ENDPOINT_HOSTED_ZONE_ID); + } + + /** + * The prefix for VPC Endpoint Service names, + * cn.com.amazonaws.vpce for China regions, + * com.amazonaws.vpce otherwise. + */ + public get vpcEndpointServiceNamePrefix(): string | undefined { + return Fact.find(this.name, FactName.VPC_ENDPOINT_SERVICE_NAME_PREFIX); + } + + /** + * The name of the service principal for a given service in this region. + * @param service the service name (e.g: s3.amazonaws.com) + */ + public servicePrincipal(service: string): string | undefined { + return Fact.find(this.name, FactName.servicePrincipal(service)); + } + + /** + * The account ID for ELBv2 in this region + */ + public get elbv2Account(): string | undefined { + return Fact.find(this.name, FactName.ELBV2_ACCOUNT); + } + + /** + * The ID of the AWS account that owns the public ECR repository containing the + * AWS Deep Learning Containers images in this region. + */ + public get dlcRepositoryAccount(): string | undefined { + return Fact.find(this.name, FactName.DLC_REPOSITORY_ACCOUNT); + } + + /** + * The ARN of the CloudWatch Lambda Insights extension, for the given version. + * @param insightsVersion the version (e.g. 1.0.98.0) + * @param architecture the Lambda Function architecture (e.g. 'x86_64' or 'arm64') + */ + public cloudwatchLambdaInsightsArn(insightsVersion: string, architecture?: string): string | undefined { + return Fact.find(this.name, FactName.cloudwatchLambdaInsightsVersion(insightsVersion, architecture)); + } + + /** + * The ID of the AWS account that owns the public ECR repository that contains the + * AWS App Mesh Envoy Proxy images in a given region. + */ + public get appMeshRepositoryAccount(): string | undefined { + return Fact.find(this.name, FactName.APPMESH_ECR_ACCOUNT); + } + + /** + * The CIDR block used by Kinesis Data Firehose servers. + */ + public get firehoseCidrBlock(): string | undefined { + return Fact.find(this.name, FactName.FIREHOSE_CIDR_BLOCK); + } + + /** + * The ARN of the ADOT Lambda layer, for the given layer type, version and architecture. + * + * @param type the type of the ADOT lambda layer + * @param version the layer version. + * @param architecture the Lambda Function architecture (e.g. 'x86_64' or 'arm64') + */ + public adotLambdaLayerArn(type: string, version: string, architecture: string): string | undefined { + return Fact.find(this.name, FactName.adotLambdaLayer(type, version, architecture)); + } +} diff --git a/packages/aws-cdk-lib/region-info/test/__snapshots__/region-info.test.js.snap b/packages/aws-cdk-lib/region-info/test/__snapshots__/region-info.test.js.snap new file mode 100644 index 0000000000000..d3d67ac32bcd7 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/test/__snapshots__/region-info.test.js.snap @@ -0,0 +1,1161 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`built-in data is correct 1`] = ` +Object { + "af-south-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:9", + "1.0.135.0": "arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:11", + "1.0.143.0": "arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:13", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": "arn:aws:lambda:af-south-1:012438385374:layer:LambdaInsightsExtension:8", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.af-south-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.af-south-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.af-south-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.af-south-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-east-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:9", + "1.0.135.0": "arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:11", + "1.0.143.0": "arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:13", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": "arn:aws:lambda:ap-east-1:519774774795:layer:LambdaInsightsExtension:8", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ap-east-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-east-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-east-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-east-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-northeast-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:23", + "1.0.135.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:25", + "1.0.143.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:31", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:ap-northeast-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-ap-northeast-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-northeast-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-northeast-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-northeast-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-northeast-2": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:20", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:ap-northeast-2:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ap-northeast-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-northeast-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-northeast-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-northeast-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-northeast-3": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": "arn:aws:lambda:ap-northeast-3:194566237122:layer:LambdaInsightsExtension:1", + "1.0.143.0": "arn:aws:lambda:ap-northeast-3:194566237122:layer:LambdaInsightsExtension:2", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ap-northeast-3.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-northeast-3.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-northeast-3.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-northeast-3.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-south-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:ap-south-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ap-south-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-south-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-south-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-south-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-south-2": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": "arn:aws:lambda:ap-south-2:891564319516:layer:LambdaInsightsExtension:6", + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ap-south-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-south-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-south-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-south-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-southeast-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:ap-southeast-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-ap-southeast-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-southeast-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-southeast-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-southeast-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-southeast-2": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:ap-southeast-2:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-ap-southeast-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-southeast-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-southeast-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-southeast-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ap-southeast-3": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": "arn:aws:lambda:ap-southeast-3:439286490199:layer:LambdaInsightsExtension:8", + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ap-southeast-3.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ap-southeast-3.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ap-southeast-3.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ap-southeast-3.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "ca-central-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:20", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:ca-central-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.ca-central-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.ca-central-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.ca-central-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.ca-central-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "cn-north-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com.cn", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:9", + "1.0.135.0": "arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:11", + "1.0.143.0": "arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:14", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": "arn:aws-cn:lambda:cn-north-1:488211338238:layer:LambdaInsightsExtension:8", + }, + "partition": "aws-cn", + "s3StaticWebsiteEndpoint": "s3-website.cn-north-1.amazonaws.com.cn", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.cn-north-1.amazonaws.com.cn", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.cn-north-1.amazonaws.com.cn", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.cn-north-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "cn.com.amazonaws.vpce", + }, + "cn-northwest-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com.cn", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:9", + "1.0.135.0": "arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:11", + "1.0.143.0": "arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:14", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": "arn:aws-cn:lambda:cn-northwest-1:488211338238:layer:LambdaInsightsExtension:8", + }, + "partition": "aws-cn", + "s3StaticWebsiteEndpoint": "s3-website.cn-northwest-1.amazonaws.com.cn", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.cn-northwest-1.amazonaws.com.cn", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.cn-northwest-1.amazonaws.com.cn", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.cn-northwest-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "cn.com.amazonaws.vpce", + }, + "eu-central-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:eu-central-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-central-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-central-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-central-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-central-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-central-2": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": "arn:aws:lambda:eu-central-2:033019950311:layer:LambdaInsightsExtension:7", + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-central-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-central-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-central-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-central-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-north-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:20", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-north-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-north-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-north-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-north-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-south-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:9", + "1.0.135.0": "arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:11", + "1.0.143.0": "arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:13", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": "arn:aws:lambda:eu-south-1:339249233099:layer:LambdaInsightsExtension:8", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-south-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-south-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-south-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-south-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-south-2": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": "arn:aws:lambda:eu-south-2:352183217350:layer:LambdaInsightsExtension:2", + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-south-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-south-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-south-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-south-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-west-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-eu-west-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-west-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-west-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-west-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-west-2": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:eu-west-2:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-west-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-west-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-west-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-west-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "eu-west-3": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:20", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:eu-west-3:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.eu-west-3.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.eu-west-3.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.eu-west-3.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.eu-west-3.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "me-central-1": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": "arn:aws:lambda:me-central-1:732604637566:layer:LambdaInsightsExtension:6", + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.me-central-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.me-central-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.me-central-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.me-central-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "me-south-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:9", + "1.0.135.0": "arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:11", + "1.0.143.0": "arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:13", + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": "arn:aws:lambda:me-south-1:285320876703:layer:LambdaInsightsExtension:8", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.me-south-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.me-south-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.me-south-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.me-south-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "sa-east-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:20", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:sa-east-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-sa-east-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.sa-east-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.sa-east-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.sa-east-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "us-east-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-us-east-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.us-east-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-east-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.us-east-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "us-east-2": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:us-east-2:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website.us-east-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.us-east-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-east-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.us-east-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "us-gov-east-1": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws-us-gov", + "s3StaticWebsiteEndpoint": "s3-website.us-gov-east-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.us-gov-east-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-gov-east-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.us-gov-east-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "us-gov-west-1": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws-us-gov", + "s3StaticWebsiteEndpoint": "s3-website-us-gov-west-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.us-gov-west-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-gov-west-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.us-gov-west-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "us-iso-east-1": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "c2s.ic.gov", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws-iso", + "s3StaticWebsiteEndpoint": "s3-website.us-iso-east-1.c2s.ic.gov", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-iso-east-1.c2s.ic.gov", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "gov.ic.c2s.vpce", + }, + "us-iso-west-1": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "c2s.ic.gov", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws-iso", + "s3StaticWebsiteEndpoint": "s3-website.us-iso-west-1.c2s.ic.gov", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-iso-west-1.c2s.ic.gov", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "gov.ic.c2s.vpce", + }, + "us-isob-east-1": Object { + "cdkMetadataResourceAvailable": false, + "domainSuffix": "sc2s.sgov.gov", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + "1.0.143.0": undefined, + "1.0.178.0": undefined, + "1.0.54.0": undefined, + "1.0.86.0": undefined, + "1.0.89.0": undefined, + "1.0.98.0": undefined, + }, + "partition": "aws-iso-b", + "s3StaticWebsiteEndpoint": "s3-website.us-isob-east-1.sc2s.sgov.gov", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-isob-east-1.sc2s.sgov.gov", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "gov.sgov.sc2s.vpce", + }, + "us-west-1": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": undefined, + "1.0.135.0": undefined, + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:20", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:us-west-1:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-us-west-1.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.us-west-1.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-west-1.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.us-west-1.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, + "us-west-2": Object { + "cdkMetadataResourceAvailable": true, + "domainSuffix": "amazonaws.com", + "lambdaInsightsArmVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:1", + "1.0.135.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension-Arm64:2", + }, + "lambdaInsightsVersions": Object { + "1.0.119.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:16", + "1.0.135.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:18", + "1.0.143.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:21", + "1.0.178.0": undefined, + "1.0.54.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:2", + "1.0.86.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:11", + "1.0.89.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:12", + "1.0.98.0": "arn:aws:lambda:us-west-2:580247275435:layer:LambdaInsightsExtension:14", + }, + "partition": "aws", + "s3StaticWebsiteEndpoint": "s3-website-us-west-2.amazonaws.com", + "servicePrincipals": Object { + "application-autoscaling": "application-autoscaling.amazonaws.com", + "autoscaling": "autoscaling.amazonaws.com", + "codedeploy": "codedeploy.us-west-2.amazonaws.com", + "ec2": "ec2.amazonaws.com", + "events": "events.amazonaws.com", + "lambda": "lambda.amazonaws.com", + "logs": "logs.us-west-2.amazonaws.com", + "s3": "s3.amazonaws.com", + "sns": "sns.amazonaws.com", + "sqs": "sqs.amazonaws.com", + "ssm": "ssm.amazonaws.com", + "states": "states.us-west-2.amazonaws.com", + }, + "vpcEndPointServiceNamePrefix": "com.amazonaws.vpce", + }, +} +`; diff --git a/packages/aws-cdk-lib/region-info/test/default.test.ts b/packages/aws-cdk-lib/region-info/test/default.test.ts new file mode 100644 index 0000000000000..7c5a0e64ec9ac --- /dev/null +++ b/packages/aws-cdk-lib/region-info/test/default.test.ts @@ -0,0 +1,84 @@ +import { Default } from '../lib'; + +const region = 'bermuda-triangle-42'; +const urlSuffix = '.nowhere.null'; + +describe('servicePrincipal', () => { + for (const suffix of ['', '.amazonaws.com', '.amazonaws.com.cn']) { + for (const service of ['codedeploy', 'states']) { + test(`${service}${suffix}`, () => { + expect(Default.servicePrincipal(`${service}${suffix}`, region, urlSuffix)).toBe(`${service}.${region}.amazonaws.com`); + }); + } + for (const service of ['logs']) { + test(`${service}${suffix}`, () => { + expect(Default.servicePrincipal(`${service}${suffix}`, region, urlSuffix)).toBe(`${service}.${region}.${urlSuffix}`); + }); + } + + for (const service of ['ec2']) { + test(`${service}${suffix}`, () => { + expect(Default.servicePrincipal(`${service}${suffix}`, region, urlSuffix)).toBe(`${service}.amazonaws.com`); + }); + } + + for (const service of ['autoscaling', 'lambda', 'events', 'sns', 'sqs', 'foo-service']) { + test(`${service}${suffix}`, () => { + expect(Default.servicePrincipal(`${service}${suffix}`, region, urlSuffix)).toBe(`${service}.amazonaws.com`); + }); + } + + } + + test('with an "exotic" DNS suffix (.local)', () => { + expect(Default.servicePrincipal('foo-service.local', region, urlSuffix)).toBe('foo-service.local'); + }); + + test('Exceptions: states in us-iso-east-1', () => { + expect(Default.servicePrincipal('states.amazonaws.com', 'us-iso-east-1', 'c2s.ic.gov')).toBe('states.amazonaws.com'); + }); + + test('Exceptions: states in us-isob-east-1', () => { + expect(Default.servicePrincipal('states.amazonaws.com', 'us-isob-east-1', 'sc2s.sgov.gov')).toBe('states.amazonaws.com'); + }); + + for (const service of ['cloudhsm', 'config', 'workspaces']) { + test(`Exceptions: ${service}.amazonaws.com is us-iso-east-1`, () => { + expect(Default.servicePrincipal(`${service}.amazonaws.com`, 'us-iso-east-1', 'c2s.ic.gov')).toBe(`${service}.c2s.ic.gov`); + }); + } + + for (const cnRegion of ['cn-north-1', 'cn-northwest-1']) { + test(`Exceptions: codedeploy in ${cnRegion}`, () => { + expect(Default.servicePrincipal('codedeploy', cnRegion, 'amazonaws.com.cn')).toBe(`codedeploy.${cnRegion}.amazonaws.com.cn`); + }); + } +}); + + +describe('spot-check some service principals', () => { + test('ssm', () => { + // SSM has advertised in its documentation that it is regional after a certain point, but that + // documentation only applies to SSM Inventory, not SSM Automation. Plus, there is no need for + // a different service principal, as all accounts are (at least currently) included in the global + // one. + expectServicePrincipals('ssm.amazonaws.com', { + 'us-east-1': 'ssm.amazonaws.com', + 'eu-north-1': 'ssm.amazonaws.com', + 'ap-east-1': 'ssm.amazonaws.com', + 'eu-south-1': 'ssm.amazonaws.com', + }); + }); + + test('EMR', () => { + expectServicePrincipals('elasticmapreduce.amazonaws.com', { + 'us-east-1': 'elasticmapreduce.amazonaws.com', + 'cn-north-1': 'elasticmapreduce.EXTENSION', // amazonaws.com.cn in China + 'us-iso-east-1': 'elasticmapreduce.amazonaws.com', + }); + }); + + function expectServicePrincipals(principal: string, regionMap: Record) { + expect(Object.fromEntries(Object.keys(regionMap).map(reg => [reg, Default.servicePrincipal(principal, reg, 'EXTENSION')]))).toEqual(regionMap); + } +}); \ No newline at end of file diff --git a/packages/aws-cdk-lib/region-info/test/fact.test.ts b/packages/aws-cdk-lib/region-info/test/fact.test.ts new file mode 100644 index 0000000000000..b3e3bab7fdab7 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/test/fact.test.ts @@ -0,0 +1,92 @@ +import { Fact, FactName } from '../lib'; +import { AWS_REGIONS } from '../lib/aws-entities'; + +describe('find', () => { + test('returns undefined for an unknown fact', () => { + expect(Fact.find(AWS_REGIONS[0], 'not:a:known:fact')).toBe(undefined); + }); + + test('returns undefined for an unknown region', () => { + expect(Fact.find('bermuda-triangle-42', FactName.PARTITION)).toBe(undefined); + }); +}); + +describe('requireFact', () => { + test('throws error for an unknown fact', () => { + expect(() => Fact.requireFact(AWS_REGIONS[0], 'not:a:known:fact')).toThrowError(); + }); + + test('throws error for an unknown region', () => { + expect(() => Fact.requireFact('bermuda-triangle-42', FactName.PARTITION)).toThrowError(); + }); +}); + +describe('register', () => { + test('allows registering an arbitrary fact', () => { + // GIVEN + const region = AWS_REGIONS[0]; + const name = 'my:custom:fact'; + const value = '1337'; + + // WHEN + expect(Fact.find(region, name)).toBe(undefined); + expect(() => Fact.register({ region, name, value })).not.toThrowError(); + + // THEN + expect(Fact.find(region, name)).toBe(value); + + // Cleanup + Fact.unregister(region, name); + }); + + test('allows re-registering a fact with the same value', () => { + // GIVEN + const region = AWS_REGIONS[0]; + const name = 'my:custom:fact'; + const value = '1337'; + + // WHEN + expect(Fact.find(region, name)).toBe(undefined); + expect(() => Fact.register({ region, name, value })).not.toThrowError(); + + // THEN + expect(() => Fact.register({ region, name, value })).not.toThrowError(); + expect(Fact.find(region, name)).toBe(value); + + // Cleanup + Fact.unregister(region, name); + }); + + test('disallows re-registering a fact with a different value', () => { + // GIVEN + const region = AWS_REGIONS[0]; + const name = FactName.PARTITION; + const value = '1337'; + + // WHEN + expect(Fact.find(region, name)).not.toBe(value); + + // THEN + expect(() => Fact.register({ region, name, value })) + .toThrowError(/already has a fact/); + }); + + test('allows overriding an arbitrary fact', () => { + // GIVEN + const region = AWS_REGIONS[0]; + const name = 'my:custom:fact'; + const value = '1337'; + + // WHEN + expect(Fact.find(region, name)).toBe(undefined); + expect(() => Fact.register({ region, name, value })).not.toThrowError(); + expect(Fact.find(region, name)).toBe(value); + + // THEN + expect(() => Fact.register({ region, name, value: 'Foo' }, true)).not.toThrowError(); + expect(Fact.find(region, name)).toBe('Foo'); + + // Cleanup + Fact.unregister(region, name); + }); +}); diff --git a/packages/aws-cdk-lib/region-info/test/region-info.test.ts b/packages/aws-cdk-lib/region-info/test/region-info.test.ts new file mode 100644 index 0000000000000..ef2d92e4cd8a8 --- /dev/null +++ b/packages/aws-cdk-lib/region-info/test/region-info.test.ts @@ -0,0 +1,64 @@ +import { CLOUDWATCH_LAMBDA_INSIGHTS_ARNS } from '../build-tools/fact-tables'; +import { FactName, RegionInfo } from '../lib'; +import { AWS_REGIONS, AWS_SERVICES } from '../lib/aws-entities'; + +test('built-in data is correct', () => { + const snapshot: any = {}; + for (const name of AWS_REGIONS) { + const region = RegionInfo.get(name); + + const servicePrincipals: { [service: string]: string | undefined } = {}; + const lambdaInsightsVersions: { [service: string]: string | undefined } = {}; + const lambdaInsightsArmVersions: { [service: string]: string | undefined } = {}; + + AWS_SERVICES.forEach(service => servicePrincipals[service] = region.servicePrincipal(service)); + + for (const version in CLOUDWATCH_LAMBDA_INSIGHTS_ARNS) { + lambdaInsightsVersions[version] = region.cloudwatchLambdaInsightsArn(version); + + if ('arm64' in CLOUDWATCH_LAMBDA_INSIGHTS_ARNS[version]) { + lambdaInsightsArmVersions[version] = region.cloudwatchLambdaInsightsArn(version, 'arm64'); + } + }; + + snapshot[name] = { + cdkMetadataResourceAvailable: region.cdkMetadataResourceAvailable, + domainSuffix: region.domainSuffix, + partition: region.partition, + s3StaticWebsiteEndpoint: region.s3StaticWebsiteEndpoint, + vpcEndPointServiceNamePrefix: region.vpcEndpointServiceNamePrefix, + servicePrincipals, + lambdaInsightsVersions, + lambdaInsightsArmVersions, + }; + } + expect(snapshot).toMatchSnapshot(); +}); + +test('built-in data features known regions', () => { + const regions = RegionInfo.regions; + + for (const expected of AWS_REGIONS) { + expect(regions.map(region => region.name)).toContain(expected); + } +}); + +test('limitedRegionMap only returns information for certain regions', () => { + + const map = RegionInfo.limitedRegionMap(FactName.ELBV2_ACCOUNT, ['aws']); + expect(map['us-east-1']).toBeDefined(); + expect(map['cn-north-1']).not.toBeDefined(); + + const map2 = RegionInfo.limitedRegionMap(FactName.ELBV2_ACCOUNT, ['aws-cn']); + expect(map2['us-east-1']).not.toBeDefined(); + expect(map2['cn-north-1']).toBeDefined(); +}); + + +test.each([ + ['us-east-1', false], + ['me-south-1', true], + ['us-iso-west-1', false], +])('%p should be opt-in: %p', (region, expected) => { + expect(RegionInfo.get(region).isOptInRegion).toEqual(expected); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/core/rosetta/README-custom-resource-provider.ts-fixture b/packages/aws-cdk-lib/rosetta/README-custom-resource-provider.ts-fixture similarity index 88% rename from packages/@aws-cdk/core/rosetta/README-custom-resource-provider.ts-fixture rename to packages/aws-cdk-lib/rosetta/README-custom-resource-provider.ts-fixture index 832388f862131..a116224f856db 100644 --- a/packages/@aws-cdk/core/rosetta/README-custom-resource-provider.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/README-custom-resource-provider.ts-fixture @@ -1,4 +1,4 @@ -import { CfnOutput, Construct, Token } from '@aws-cdk/core'; +import { CfnOutput, Construct, Token } from 'aws-cdk-lib'; declare interface SumProps { readonly lhs: number; diff --git a/packages/aws-cdk-lib/rosetta/assertions/default.ts-fixture b/packages/aws-cdk-lib/rosetta/assertions/default.ts-fixture new file mode 100644 index 0000000000000..eedc5c2216ab2 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/assertions/default.ts-fixture @@ -0,0 +1,14 @@ +import { Construct } from 'constructs'; +import { Aspects, CfnResource, Stack } from 'aws-cdk-lib'; +import { Annotations, Capture, Match, Template } from 'aws-cdk-lib/assertions'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const stack = new Stack(); + const template = Template.fromStack(stack); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/assertions/init.ts-fixture b/packages/aws-cdk-lib/rosetta/assertions/init.ts-fixture new file mode 100644 index 0000000000000..2b8f6ab6d2ebe --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/assertions/init.ts-fixture @@ -0,0 +1,3 @@ +import { Template } from 'aws-cdk-lib/assertions'; + +/// here \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_acmpca/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_acmpca/default.ts-fixture new file mode 100644 index 0000000000000..87e4149154fd6 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_acmpca/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as acmpca from 'aws-cdk-lib/aws-acmpca'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_amplify/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_amplify/default.ts-fixture new file mode 100644 index 0000000000000..8127629192381 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_amplify/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { SecretValue, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as amplify from 'aws-cdk-lib/aws-amplify'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_amplifyuibuilder/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_amplifyuibuilder/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_amplifyuibuilder/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_apigateway/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_apigateway/default.ts-fixture new file mode 100644 index 0000000000000..03215bb08180f --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_apigateway/default.ts-fixture @@ -0,0 +1,19 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import apigateway = require('aws-cdk-lib/aws-apigateway'); +import cognito = require('aws-cdk-lib/aws-cognito'); +import lambda = require('aws-cdk-lib/aws-lambda'); +import iam = require('aws-cdk-lib/aws-iam'); +import s3 = require('aws-cdk-lib/aws-s3'); +import ec2 = require('aws-cdk-lib/aws-ec2'); +import logs = require('aws-cdk-lib/aws-logs'); +import stepfunctions = require('aws-cdk-lib/aws-stepfunctions'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_apigateway/stepfunctions.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_apigateway/stepfunctions.ts-fixture new file mode 100644 index 0000000000000..a9db92f540f96 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_apigateway/stepfunctions.ts-fixture @@ -0,0 +1,17 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import apigateway = require('aws-cdk-lib/aws-apigateway'); +import stepfunctions = require('aws-cdk-lib/aws-stepfunctions'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const machine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', { + definition: new stepfunctions.Pass(this, 'PassState'), + stateMachineType: stepfunctions.StateMachineType.EXPRESS, + }); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_apigatewayv2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_apigatewayv2/default.ts-fixture new file mode 100644 index 0000000000000..f2c8cd0b461fb --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_apigatewayv2/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_apigatewayv2_authorizers/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_apigatewayv2_authorizers/default.ts-fixture new file mode 100644 index 0000000000000..5372db35bfa04 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_apigatewayv2_authorizers/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_apigatewayv2_integrations/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_apigatewayv2_integrations/default.ts-fixture new file mode 100644 index 0000000000000..e8a4ef15ba9ce --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_apigatewayv2_integrations/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_applicationautoscaling/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_applicationautoscaling/default.ts-fixture new file mode 100644 index 0000000000000..688a36acee234 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_applicationautoscaling/default.ts-fixture @@ -0,0 +1,48 @@ +// Fixture with packages imported, but nothing else +import { Construct, Node } from 'constructs'; +import { Aspects, CfnOutput, Stack, Duration, Resource, SecretValue } from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as appscaling from 'aws-cdk-lib/aws-applicationautoscaling'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as iam from 'aws-cdk-lib/aws-iam'; + + +interface UtilizationScalingProps { + readonly targetUtilizationPercent: number; +} + +class ScalableAttribute { + public scaleOnSchedule(id: string, action: appscaling.ScalingSchedule) { + Array.isArray(id); + Array.isArray(action); + } + public scaleOnUtilization(props: UtilizationScalingProps) { + Array.isArray(props); + } + public scaleOnMetric(id: string, props: appscaling.BasicStepScalingPolicyProps) { + Array.isArray(id); + Array.isArray(props); + } +} + +interface Caps { + readonly minCapacity: number; + readonly maxCapacity: number; +} + +class SomeScalableResource { + public autoScaleCapacity(caps: Caps) { + return new ScalableAttribute(); + } +} + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + + + diff --git a/packages/aws-cdk-lib/rosetta/aws_appmesh/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_appmesh/default.ts-fixture new file mode 100644 index 0000000000000..63925abad6183 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_appmesh/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import cdk = require('aws-cdk-lib'); +import acmpca = require('aws-cdk-lib/aws-acmpca'); +import appmesh = require('aws-cdk-lib/aws-appmesh'); +import certificatemanager = require('aws-cdk-lib/aws-certificatemanager'); +import cloudmap = require('aws-cdk-lib/aws-servicediscovery'); +import ec2 = require('aws-cdk-lib/aws-ec2'); +import iam = require('aws-cdk-lib/aws-iam'); + +class Fixture extends cdk.Stack { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_apprunner/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_apprunner/default.ts-fixture new file mode 100644 index 0000000000000..e7c8348cad8b4 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_apprunner/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Stack, SecretValue } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as apprunner from 'aws-cdk-lib/aws-apprunner'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_appsync/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_appsync/default.ts-fixture new file mode 100644 index 0000000000000..fdd7572a2db26 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_appsync/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import appsync = require('aws-cdk-lib/aws-appsync'); +import ec2 = require('aws-cdk-lib/aws-ec2'); +import dynamodb = require('aws-cdk-lib/aws-dynamodb'); +import iam = require('aws-cdk-lib/aws-iam'); +import rds = require('aws-cdk-lib/aws-rds'); +import path = require('path'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_autoscaling/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_autoscaling/default.ts-fixture new file mode 100644 index 0000000000000..e693c62833df0 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_autoscaling/default.ts-fixture @@ -0,0 +1,18 @@ +// Fixture with packages imported, but nothing else +import { Construct, Node } from 'constructs'; +import { Aspects, CfnOutput, Stack, Duration, Resource, SecretValue } from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + + + diff --git a/packages/aws-cdk-lib/rosetta/aws_backup/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_backup/default.ts-fixture new file mode 100644 index 0000000000000..997a397e1ad70 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_backup/default.ts-fixture @@ -0,0 +1,19 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as backup from 'aws-cdk-lib/aws-backup'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as rds from 'aws-cdk-lib/aws-rds'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_batch/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_batch/default.ts-fixture new file mode 100644 index 0000000000000..a8b555f06b49e --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_batch/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as batch from 'aws-cdk-lib/aws-batch'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_billingconductor/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_billingconductor/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_billingconductor/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_certificatemanager/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_certificatemanager/default.ts-fixture new file mode 100644 index 0000000000000..055a744ffa1f0 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_certificatemanager/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import { PublicHostedZone } from 'aws-cdk-lib/aws-route53'; +import { StringParameter } from 'aws-cdk-lib/aws-ssm'; +import { Stack, Names } from 'aws-cdk-lib'; +import { AwsCustomResource, PhysicalResourceId, AwsCustomResourcePolicy } from 'aws-cdk-lib/custom-resources'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_chatbot/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_chatbot/default.ts-fixture new file mode 100644 index 0000000000000..ed819bc36fa2d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_chatbot/default.ts-fixture @@ -0,0 +1,10 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_cloud9/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cloud9/default.ts-fixture new file mode 100644 index 0000000000000..83060146bb266 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cloud9/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { CfnOutput, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as cloud9 from 'aws-cdk-lib/aws-cloud9'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_cloudfront/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cloudfront/default.ts-fixture new file mode 100644 index 0000000000000..3daab43d74b1c --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cloudfront/default.ts-fixture @@ -0,0 +1,17 @@ +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as path from 'path'; + +class Context extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_cloudfront_origins/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cloudfront_origins/default.ts-fixture new file mode 100644 index 0000000000000..ec844c9ddc3bd --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cloudfront_origins/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as apigateway from 'aws-cdk-lib/aws-apigateway'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_cloudtrail/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cloudtrail/default.ts-fixture new file mode 100644 index 0000000000000..829851dc11fb6 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cloudtrail/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as cloudtrail from 'aws-cdk-lib/aws-cloudtrail'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_cloudwatch/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cloudwatch/default.ts-fixture new file mode 100644 index 0000000000000..8783a1272fe84 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cloudwatch/default.ts-fixture @@ -0,0 +1,17 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack, Duration } from 'aws-cdk-lib'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + + diff --git a/packages/aws-cdk-lib/rosetta/aws_cloudwatch_actions/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cloudwatch_actions/default.ts-fixture new file mode 100644 index 0000000000000..75f52022dfaea --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cloudwatch_actions/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as actions from 'aws-cdk-lib/aws-cloudwatch-actions'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_codebuild/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codebuild/default.ts-fixture new file mode 100644 index 0000000000000..c1fc2dc3a8ed4 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codebuild/default.ts-fixture @@ -0,0 +1,19 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack, Duration, SecretValue } from 'aws-cdk-lib'; +import codebuild = require('aws-cdk-lib/aws-codebuild'); +import iam = require('aws-cdk-lib/aws-iam'); +import ec2 = require('aws-cdk-lib/aws-ec2'); +import lambda = require('aws-cdk-lib/aws-lambda'); +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as logs from 'aws-cdk-lib/aws-logs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_codecommit/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codecommit/default.ts-fixture new file mode 100644 index 0000000000000..47777c263e11d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codecommit/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_codedeploy/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codedeploy/default.ts-fixture new file mode 100644 index 0000000000000..0c5e226fe2320 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codedeploy/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as codedeploy from 'aws-cdk-lib/aws-codedeploy'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_codeguruprofiler/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codeguruprofiler/default.ts-fixture new file mode 100644 index 0000000000000..de8b5126fc319 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codeguruprofiler/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as codeguruprofiler from 'aws-cdk-lib/aws-codeguruprofiler'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/@aws-cdk/aws-codepipeline/rosetta/action.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codepipeline/action.ts-fixture similarity index 93% rename from packages/@aws-cdk/aws-codepipeline/rosetta/action.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_codepipeline/action.ts-fixture index 43b0b75b3788e..7ca50b604d7a7 100644 --- a/packages/@aws-cdk/aws-codepipeline/rosetta/action.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_codepipeline/action.ts-fixture @@ -1,6 +1,6 @@ import { Construct } from 'constructs'; -import { Duration, Stack } from '@aws-cdk/core'; -import * as codepipeline from '@aws-cdk/aws-codepipeline'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; interface MyActionProps { variablesNamespace?: string; diff --git a/packages/aws-cdk-lib/rosetta/aws_codepipeline/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codepipeline/default.ts-fixture new file mode 100644 index 0000000000000..2a2e0c8a8e119 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codepipeline/default.ts-fixture @@ -0,0 +1,15 @@ +import { Construct } from 'constructs'; +import { App, Duration, PhysicalName, Stack } from 'aws-cdk-lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as codepipeline_actions from 'aws-cdk-lib/aws-codepipeline-actions'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; + +class Context extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_codepipeline_actions/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codepipeline_actions/default.ts-fixture new file mode 100644 index 0000000000000..240e431aa1537 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codepipeline_actions/default.ts-fixture @@ -0,0 +1,17 @@ +// Fixture with packages imported, but nothing else +import { Arn, Construct, Duration, SecretValue, Stack } from 'aws-cdk-lib'; +import codebuild = require('aws-cdk-lib/aws-codebuild'); +import codedeploy = require('aws-cdk-lib/aws-codedeploy'); +import codepipeline = require('aws-cdk-lib/aws-codepipeline'); +import codepipeline_actions = require('aws-cdk-lib/aws-codepipeline-actions'); +import codecommit = require('aws-cdk-lib/aws-codecommit'); +import iam = require('aws-cdk-lib/aws-iam'); +import lambda = require('aws-cdk-lib/aws-lambda'); +import s3 = require('aws-cdk-lib/aws-s3'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_codestar/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codestar/default.ts-fixture new file mode 100644 index 0000000000000..4a1a344e6cc02 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codestar/default.ts-fixture @@ -0,0 +1,10 @@ +// Fixture with packages imported, but nothing else +import { SecretValue, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_codestarnotifications/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_codestarnotifications/default.ts-fixture new file mode 100644 index 0000000000000..ed819bc36fa2d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_codestarnotifications/default.ts-fixture @@ -0,0 +1,10 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_cognito/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cognito/default.ts-fixture new file mode 100644 index 0000000000000..b8d85f501d6eb --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cognito/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as certificatemanager from 'aws-cdk-lib/aws-certificatemanager'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_cognito_identitypool/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_cognito_identitypool/default.ts-fixture new file mode 100644 index 0000000000000..5e43b12f6c9bf --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_cognito_identitypool/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as cognito from 'aws-cdk-lib/aws-cognito'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { IdentityPool, UserPoolAuthenticationProvider } from 'aws-cdk-lib/aws-cognito-identitypool'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_comprehend/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_comprehend/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_comprehend/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_config/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_config/default.ts-fixture new file mode 100644 index 0000000000000..74c3f251d6ab6 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_config/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as config from 'aws-cdk-lib/aws-config'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_connectcampaigns/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_connectcampaigns/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_connectcampaigns/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_controltower/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_controltower/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_controltower/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_devicefarm/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_devicefarm/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_devicefarm/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_docdb/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_docdb/default.ts-fixture new file mode 100644 index 0000000000000..c006c67447724 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_docdb/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as docdb from 'aws-cdk-lib/aws-docdb'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_docdbelastic/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_docdbelastic/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_docdbelastic/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_dynamodb/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_dynamodb/default.ts-fixture new file mode 100644 index 0000000000000..5e7c5343c2b1e --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_dynamodb/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import dynamodb = require('aws-cdk-lib/aws-dynamodb'); +import iam = require('aws-cdk-lib/aws-iam'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/@aws-cdk/aws-ec2/rosetta/client-vpn.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ec2/client-vpn.ts-fixture similarity index 75% rename from packages/@aws-cdk/aws-ec2/rosetta/client-vpn.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_ec2/client-vpn.ts-fixture index 150da8ab8e0f9..537b8d92dd49d 100644 --- a/packages/@aws-cdk/aws-ec2/rosetta/client-vpn.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_ec2/client-vpn.ts-fixture @@ -1,8 +1,8 @@ // Fixture with packages imported and a VPC created import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import iam = require('@aws-cdk/aws-iam'); -import ec2 = require('@aws-cdk/aws-ec2'); +import { Stack } from 'aws-cdk-lib'; +import iam = require('aws-cdk-lib/aws-iam'); +import ec2 = require('aws-cdk-lib/aws-ec2'); class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/aws-cdk-lib/rosetta/aws_ec2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ec2/default.ts-fixture new file mode 100644 index 0000000000000..5a83aebb9a81d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ec2/default.ts-fixture @@ -0,0 +1,18 @@ +// Fixture with packages imported, but nothing else +import { Aspects, Construct, Duration, Fn, Size, Stack, StackProps } from 'aws-cdk-lib'; +import ec2 = require('aws-cdk-lib/aws-ec2'); +import s3 = require('aws-cdk-lib/aws-s3'); +import iam = require('aws-cdk-lib/aws-iam'); +import logs = require('aws-cdk-lib/aws-logs'); +import ssm = require('aws-cdk-lib/aws-ssm'); +import autoscaling = require('aws-cdk-lib/aws-autoscaling'); +import elbv2 = require('aws-cdk-lib/aws-elasticloadbalancingv2'); +import rds = require('aws-cdk-lib/aws-rds'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/@aws-cdk/aws-ec2/rosetta/with-vpc.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ec2/with-vpc.ts-fixture similarity index 75% rename from packages/@aws-cdk/aws-ec2/rosetta/with-vpc.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_ec2/with-vpc.ts-fixture index 02aebc1c77a4f..7506f20155063 100644 --- a/packages/@aws-cdk/aws-ec2/rosetta/with-vpc.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_ec2/with-vpc.ts-fixture @@ -1,7 +1,7 @@ // Fixture with packages imported and a VPC created import { Construct } from 'constructs'; -import { Stack } from '@aws-cdk/core'; -import ec2 = require('@aws-cdk/aws-ec2'); +import { Stack } from 'aws-cdk-lib'; +import ec2 = require('aws-cdk-lib/aws-ec2'); class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/aws-cdk-lib/rosetta/aws_ecr/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ecr/default.ts-fixture new file mode 100644 index 0000000000000..c29188647439b --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ecr/default.ts-fixture @@ -0,0 +1,23 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as ecr from 'aws-cdk-lib/aws-ecr'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class SomeTarget implements events.IRuleTarget { + public bind(): events.RuleTargetConfig { + return { + arn: 'ARN1', + }; + } +} + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + diff --git a/packages/aws-cdk-lib/rosetta/aws_ecr_assets/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ecr_assets/default.ts-fixture new file mode 100644 index 0000000000000..eaf5d09feafb2 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ecr_assets/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_ecs/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ecs/default.ts-fixture new file mode 100644 index 0000000000000..09d0cdb164a1b --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ecs/default.ts-fixture @@ -0,0 +1,26 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { SecretValue, Stack, Size } from 'aws-cdk-lib'; +import autoscaling = require('aws-cdk-lib/aws-autoscaling'); +import cloudmap = require('aws-cdk-lib/aws-servicediscovery'); +import ecs = require('aws-cdk-lib/aws-ecs'); +import ec2 = require('aws-cdk-lib/aws-ec2'); +import elb = require('aws-cdk-lib/aws-elasticloadbalancing'); +import elbv2 = require('aws-cdk-lib/aws-elasticloadbalancingv2'); +import events = require('aws-cdk-lib/aws-events'); +import kms = require('aws-cdk-lib/aws-kms'); +import logs = require('aws-cdk-lib/aws-logs'); +import s3 = require('aws-cdk-lib/aws-s3'); +import secretsmanager = require('aws-cdk-lib/aws-secretsmanager'); +import ssm = require('aws-cdk-lib/aws-ssm'); +import targets = require('aws-cdk-lib/aws-events-targets'); +import iam = require('aws-cdk-lib/aws-iam'); +import path = require('path'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_ecs_patterns/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ecs_patterns/default.ts-fixture new file mode 100644 index 0000000000000..efbf3551d8905 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ecs_patterns/default.ts-fixture @@ -0,0 +1,17 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as appscaling from 'aws-cdk-lib/aws-applicationautoscaling'; +import * as cxapi from 'aws-cdk-lib/cx-api'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + diff --git a/packages/aws-cdk-lib/rosetta/aws_efs/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_efs/default.ts-fixture new file mode 100644 index 0000000000000..11d7f0338cf2c --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_efs/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as efs from 'aws-cdk-lib/aws-efs'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/@aws-cdk/aws-efs/rosetta/with-filesystem-instance.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_efs/with-filesystem-instance.ts-fixture similarity index 80% rename from packages/@aws-cdk/aws-efs/rosetta/with-filesystem-instance.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_efs/with-filesystem-instance.ts-fixture index 427e2ed030b4b..8018bc8b425f4 100644 --- a/packages/@aws-cdk/aws-efs/rosetta/with-filesystem-instance.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_efs/with-filesystem-instance.ts-fixture @@ -1,9 +1,9 @@ // Fixture with file system and an EC2 instance created in a VPC -import { Stack } from '@aws-cdk/core'; +import { Stack } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import * as efs from '@aws-cdk/aws-efs'; -import * as ec2 from '@aws-cdk/aws-ec2'; -import * as iam from '@aws-cdk/aws-iam'; +import * as efs from 'aws-cdk-lib/aws-efs'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/@aws-cdk/aws-eks/rosetta/cdk8schart.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_eks/cdk8schart.ts-fixture similarity index 82% rename from packages/@aws-cdk/aws-eks/rosetta/cdk8schart.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_eks/cdk8schart.ts-fixture index 8307843e4e173..127d807e43bd2 100644 --- a/packages/@aws-cdk/aws-eks/rosetta/cdk8schart.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_eks/cdk8schart.ts-fixture @@ -1,7 +1,7 @@ import { Construct } from 'constructs'; -import { CfnOutput, Fn, Size, Stack } from '@aws-cdk/core'; -import * as eks from '@aws-cdk/aws-eks'; -import * as s3 from '@aws-cdk/aws-s3'; +import { CfnOutput, Fn, Size, Stack } from 'aws-cdk-lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; +import * as s3 from 'aws-cdk-lib/aws-s3'; import * as cdk8s from 'cdk8s'; import * as kplus from 'cdk8s-plus-21'; diff --git a/packages/aws-cdk-lib/rosetta/aws_eks/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_eks/default.ts-fixture new file mode 100644 index 0000000000000..6d8df145f32c1 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_eks/default.ts-fixture @@ -0,0 +1,17 @@ +import { Construct } from 'constructs'; +import { CfnOutput, Fn, Size, Stack } from 'aws-cdk-lib'; +import * as eks from 'aws-cdk-lib/aws-eks'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; + +class Context extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_elasticloadbalancing/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_elasticloadbalancing/default.ts-fixture new file mode 100644 index 0000000000000..a584c62774f28 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_elasticloadbalancing/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_elasticloadbalancingv2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_elasticloadbalancingv2/default.ts-fixture new file mode 100644 index 0000000000000..4153aacc0e615 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_elasticloadbalancingv2/default.ts-fixture @@ -0,0 +1,17 @@ +// Fixture with packages imported, but nothing else +import { Construct, Node } from 'constructs'; +import { CfnOutput, Stack, Duration, Resource, SecretValue } from 'aws-cdk-lib'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as autoscaling from 'aws-cdk-lib/aws-autoscaling'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + + + diff --git a/packages/aws-cdk-lib/rosetta/aws_elasticsearch/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_elasticsearch/default.ts-fixture new file mode 100644 index 0000000000000..7014190007ae3 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_elasticsearch/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_elasticsearch/migrate-opensearch.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_elasticsearch/migrate-opensearch.ts-fixture new file mode 100644 index 0000000000000..0fc63076669ae --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_elasticsearch/migrate-opensearch.ts-fixture @@ -0,0 +1,16 @@ +import * as cdk from 'aws-cdk-lib'; +import * as es from 'aws-cdk-lib/aws-elasticsearch'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; + +declare const role: iam.IRole; +declare const elasticsearchVersion: es.ElasticsearchVersion; +declare const openSearchVersion: opensearch.EngineVersion; + +class Fixture extends cdk.Construct { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_emrserverless/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_emrserverless/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_emrserverless/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/@aws-cdk/aws-events/rosetta/basic.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_events/basic.ts-fixture similarity index 81% rename from packages/@aws-cdk/aws-events/rosetta/basic.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_events/basic.ts-fixture index 0cc6d1104d521..7182b02bd2b4b 100644 --- a/packages/@aws-cdk/aws-events/rosetta/basic.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_events/basic.ts-fixture @@ -1,6 +1,6 @@ // Fixture with packages imported, but nothing else import { Construct } from 'constructs'; -import { Stack, Duration } from '@aws-cdk/core'; +import { Stack, Duration } from 'aws-cdk-lib'; class Fixture extends Stack { constructor(scope: Construct, id: string) { diff --git a/packages/aws-cdk-lib/rosetta/aws_events/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_events/default.ts-fixture new file mode 100644 index 0000000000000..052892124ff3e --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_events/default.ts-fixture @@ -0,0 +1,20 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack, Duration } from 'aws-cdk-lib'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + diff --git a/packages/aws-cdk-lib/rosetta/aws_events_targets/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_events_targets/default.ts-fixture new file mode 100644 index 0000000000000..acd7fe1de2f9e --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_events_targets/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, SecretValue, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as cdk from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndKinesisStream.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndKinesisStream.ts-fixture new file mode 100644 index 0000000000000..3af4a71ba22fc --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndKinesisStream.ts-fixture @@ -0,0 +1,23 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as cdk from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const repository = new codecommit.Repository(this, 'MyRepo', { + repositoryName: 'aws-cdk-events', + }); + + const stream = new kinesis.Stream(this, 'MyStream'); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndSqsQueue.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndSqsQueue.ts-fixture new file mode 100644 index 0000000000000..a9f623db0a33b --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndSqsQueue.ts-fixture @@ -0,0 +1,23 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as cdk from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const repository = new codecommit.Repository(this, 'MyRepo', { + repositoryName: 'aws-cdk-events', + }); + + const queue = new sqs.Queue(this, 'MyQueue'); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndTopic.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndTopic.ts-fixture new file mode 100644 index 0000000000000..3ef9e0e04fc63 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_events_targets/withRepoAndTopic.ts-fixture @@ -0,0 +1,23 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +import * as targets from 'aws-cdk-lib/aws-events-targets'; +import * as events from 'aws-cdk-lib/aws-events'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as codecommit from 'aws-cdk-lib/aws-codecommit'; +import * as cdk from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const repository = new codecommit.Repository(this, 'MyRepo', { + repositoryName: 'aws-cdk-events', + }); + + const topic = new sns.Topic(this, 'MyTopic'); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_evidently/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_evidently/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_evidently/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_forecast/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_forecast/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_forecast/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_fsx/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_fsx/default.ts-fixture new file mode 100644 index 0000000000000..29144eae69947 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_fsx/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as fsx from 'aws-cdk-lib/aws-fsx'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_gamelift/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_gamelift/default.ts-fixture new file mode 100644 index 0000000000000..44384315ba921 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_gamelift/default.ts-fixture @@ -0,0 +1,18 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Size, Stack, CfnOutput } from 'aws-cdk-lib'; +import * as gamelift from 'aws-cdk-lib/aws-gamelift'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_globalaccelerator/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_globalaccelerator/default.ts-fixture new file mode 100644 index 0000000000000..1c8a3751b0b2d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_globalaccelerator/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as globalaccelerator from 'aws-cdk-lib/aws-globalaccelerator'; +import * as ga_endpoints from 'aws-cdk-lib/aws-globalaccelerator-endpoints'; +import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_glue/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_glue/default.ts-fixture new file mode 100644 index 0000000000000..ee04d2d9245c5 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_glue/default.ts-fixture @@ -0,0 +1,17 @@ +// Fixture with packages imported, but nothing else +import * as path from 'path'; +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as glue from 'aws-cdk-lib/aws-glue'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as rds from 'aws-cdk-lib/aws-rds'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_grafana/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_grafana/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_grafana/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_iam/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_iam/default.ts-fixture new file mode 100644 index 0000000000000..5236db6bc45d6 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_iam/default.ts-fixture @@ -0,0 +1,23 @@ +import { Construct } from 'constructs'; +import { + CustomResource, + Stack, + App, + DefaultStackSynthesizer, + Stage, + PermissionsBoundary, + PERMISSIONS_BOUNDARY_CONTEXT_KEY, +} from 'aws-cdk-lib'; +import * as codepipeline from 'aws-cdk-lib/aws-codepipeline'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_identitystore/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_identitystore/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_identitystore/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_inspectorv2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_inspectorv2/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_inspectorv2/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_internetmonitor/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_internetmonitor/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_internetmonitor/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_iot/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_iot/default.ts-fixture new file mode 100644 index 0000000000000..05efd2d0d783c --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_iot/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as actions from 'aws-cdk-lib/aws-iot-actions'; +import * as iot from 'aws-cdk-lib/aws-iot'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_iot_actions/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_iot_actions/default.ts-fixture new file mode 100644 index 0000000000000..05efd2d0d783c --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_iot_actions/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as actions from 'aws-cdk-lib/aws-iot-actions'; +import * as iot from 'aws-cdk-lib/aws-iot'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_iotevents/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_iotevents/default.ts-fixture new file mode 100644 index 0000000000000..ed819bc36fa2d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_iotevents/default.ts-fixture @@ -0,0 +1,10 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_iotfleetwise/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_iotfleetwise/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_iotfleetwise/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_iottwinmaker/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_iottwinmaker/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_iottwinmaker/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_ivs/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ivs/default.ts-fixture new file mode 100644 index 0000000000000..b9e6fce3a6d90 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ivs/default.ts-fixture @@ -0,0 +1,19 @@ +// Fixture with packages imported, but nothing else +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as ivs from 'aws-cdk-lib/aws-ivs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const myChannelArn = 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh'; + const myPublicKeyPemString = `-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEmL8CBtm6KLUegSd5IJexniN8LItJiDwg +zlYiti/ZTP/JPoUMb0fjqBDKZRhGbA6gSHdcm5YkdbGzIsQRnIqfhYy52kO13miR +d2/EL+sn3x1/ziRhvZ2elvpaZAN68QiM +-----END PUBLIC KEY-----`; + + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_ivs/with-channel.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ivs/with-channel.ts-fixture new file mode 100644 index 0000000000000..ebd2fe59cd07b --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ivs/with-channel.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as ivs from 'aws-cdk-lib/aws-ivs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const myChannelArn = 'arn:aws:ivs:us-west-2:123456789012:channel/abcdABCDefgh'; + const myChannel = ivs.Channel.fromChannelArn(this, 'Channel', myChannelArn); + + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_ivschat/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ivschat/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ivschat/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kafkaconnect/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kafkaconnect/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kafkaconnect/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kendraranking/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kendraranking/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kendraranking/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kinesis/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kinesis/default.ts-fixture new file mode 100644 index 0000000000000..bd6d4e9cc7b7f --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kinesis/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_kinesisanalytics_flink/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kinesisanalytics_flink/default.ts-fixture new file mode 100644 index 0000000000000..ec523c86ddfc5 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kinesisanalytics_flink/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as flink from 'aws-cdk-lib/aws-kinesisanalytics-flink'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kinesisanalyticsv2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kinesisanalyticsv2/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kinesisanalyticsv2/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kinesisfirehose/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kinesisfirehose/default.ts-fixture new file mode 100644 index 0000000000000..7c106c5bb0307 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kinesisfirehose/default.ts-fixture @@ -0,0 +1,19 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Size, Stack } from 'aws-cdk-lib'; +import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose'; +import * as kinesis from 'aws-cdk-lib/aws-kinesis'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as destinations from 'aws-cdk-lib/aws-kinesisfirehose-destinations'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kinesisfirehose_destinations/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kinesisfirehose_destinations/default.ts-fixture new file mode 100644 index 0000000000000..41ee95c793551 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kinesisfirehose_destinations/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as destinations from 'aws-cdk-lib/aws-kinesisfirehose-destinations'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kinesisvideo/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kinesisvideo/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kinesisvideo/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_kms/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_kms/default.ts-fixture new file mode 100644 index 0000000000000..fa268d792893a --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_kms/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + diff --git a/packages/aws-cdk-lib/rosetta/aws_lambda/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lambda/default.ts-fixture new file mode 100644 index 0000000000000..f16a5ee930b18 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lambda/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import * as path from 'path'; +import { Construct } from 'constructs'; +import { Aspects, CfnOutput, DockerImage, Duration, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { LAMBDA_RECOGNIZE_VERSION_PROPS, LAMBDA_RECOGNIZE_LAYER_VERSION } from 'aws-cdk-lib/cx-api'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_lambda_destinations/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lambda_destinations/default.ts-fixture new file mode 100644 index 0000000000000..72194e3642f28 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lambda_destinations/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as destinations from 'aws-cdk-lib/aws-lambda-destinations'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_lambda_event_sources/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lambda_event_sources/default.ts-fixture new file mode 100644 index 0000000000000..e89d126480413 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lambda_event_sources/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_lambda_go/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lambda_go/default.ts-fixture new file mode 100644 index 0000000000000..29d5c24db9505 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lambda_go/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { DockerImage, Stack, BundlingFileAccess } from 'aws-cdk-lib'; +import * as go from 'aws-cdk-lib/aws-lambda-go'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_lambda_nodejs/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lambda_nodejs/default.ts-fixture new file mode 100644 index 0000000000000..713e91c11a8c4 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lambda_nodejs/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { DockerImage, Stack, BundlingFileAccess } from 'aws-cdk-lib'; +import * as nodejs from 'aws-cdk-lib/aws-lambda-nodejs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_lambda_python/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lambda_python/default.ts-fixture new file mode 100644 index 0000000000000..44233416f8e4e --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lambda_python/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { DockerImage, Stack, BundlingFileAccess } from 'aws-cdk-lib'; +import { Runtime } from 'aws-cdk-lib/aws-lambda'; +import * as python from 'aws-cdk-lib/aws-lambda-python'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_lex/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_lex/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_lex/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_location/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_location/default.ts-fixture new file mode 100644 index 0000000000000..424f437d21bc5 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_location/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as location from 'aws-cdk-lib/aws-location'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_logs/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_logs/default.ts-fixture new file mode 100644 index 0000000000000..3c2c490434a31 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_logs/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + diff --git a/packages/aws-cdk-lib/rosetta/aws_m2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_m2/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_m2/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_mediatailor/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_mediatailor/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_mediatailor/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_msk/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_msk/default.ts-fixture new file mode 100644 index 0000000000000..b2ef1373209f8 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_msk/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { CfnOutput, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as msk from 'aws-cdk-lib/aws-msk'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as s3 from 'aws-cdk-lib/aws-s3'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_neptune/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_neptune/default.ts-fixture new file mode 100644 index 0000000000000..25f06bb05b39d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_neptune/default.ts-fixture @@ -0,0 +1,16 @@ +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as neptune from 'aws-cdk-lib/aws-neptune'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_neptune/with-cluster.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_neptune/with-cluster.ts-fixture new file mode 100644 index 0000000000000..6a1683973b205 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_neptune/with-cluster.ts-fixture @@ -0,0 +1,19 @@ +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as neptune from 'aws-cdk-lib/aws-neptune'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const vpc = new ec2.Vpc(this, 'VPC', { maxAzs: 2 }); + + const cluster = new neptune.DatabaseCluster(this, 'Database', { + vpc, + instanceType: neptune.InstanceType.R5_LARGE, + }); + + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_oam/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_oam/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_oam/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_omics/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_omics/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_omics/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_opensearchserverless/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_opensearchserverless/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_opensearchserverless/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_opensearchservice/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_opensearchservice/default.ts-fixture new file mode 100644 index 0000000000000..de5a6b7d22adc --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_opensearchservice/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { RemovalPolicy, Stack, Fn } from 'aws-cdk-lib'; +import { Domain, DomainProps, EngineVersion } from 'aws-cdk-lib/aws-opensearchservice'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_organizations/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_organizations/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_organizations/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_personalize/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_personalize/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_personalize/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_pipes/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_pipes/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_pipes/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_rds/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_rds/default.ts-fixture new file mode 100644 index 0000000000000..8ea8b2e5863dd --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_rds/default.ts-fixture @@ -0,0 +1,18 @@ +// Fixture with packages imported, but nothing else +import { Duration, SecretValue, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import ec2 = require('aws-cdk-lib/aws-ec2'); +import rds = require('aws-cdk-lib/aws-rds'); +import targets = require('aws-cdk-lib/aws-events-targets'); +import lambda = require('aws-cdk-lib/aws-lambda'); +import kms = require('aws-cdk-lib/aws-kms'); +import iam = require('aws-cdk-lib/aws-iam'); +import secretsmanager = require('aws-cdk-lib/aws-secretsmanager'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_redshift/cluster.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_redshift/cluster.ts-fixture new file mode 100644 index 0000000000000..f885753a73570 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_redshift/cluster.ts-fixture @@ -0,0 +1,21 @@ +// Fixture with cluster already created +import { SecretValue, Stack } from 'aws-cdk-lib'; +import { Vpc } from 'aws-cdk-lib/aws-ec2'; +import { Cluster, Table, TableAction, TableDistStyle, TableSortStyle, User } from 'aws-cdk-lib/aws-redshift'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + const vpc = new Vpc(this, 'Vpc'); + const cluster = new Cluster(this, 'Cluster', { + vpc, + masterUser: { + masterUsername: 'admin', + }, + }); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_redshift/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_redshift/default.ts-fixture new file mode 100644 index 0000000000000..85c850257658d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_redshift/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Cluster } from 'aws-cdk-lib/aws-redshift'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_redshiftserverless/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_redshiftserverless/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_redshiftserverless/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_refactorspaces/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_refactorspaces/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_refactorspaces/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_resiliencehub/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_resiliencehub/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_resiliencehub/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_resourceexplorer2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_resourceexplorer2/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_resourceexplorer2/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_rolesanywhere/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_rolesanywhere/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_rolesanywhere/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_route53/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_route53/default.ts-fixture new file mode 100644 index 0000000000000..64766986db800 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_route53/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_route53_patterns/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_route53_patterns/default.ts-fixture new file mode 100644 index 0000000000000..7166b2fb97fe5 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_route53_patterns/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack, App } from 'aws-cdk-lib'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as patterns from 'aws-cdk-lib/aws-route53-patterns'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_route53_targets/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_route53_targets/default.ts-fixture new file mode 100644 index 0000000000000..29201718614f1 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_route53_targets/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as targets from 'aws-cdk-lib/aws-route53-targets'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_route53resolver/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_route53resolver/default.ts-fixture new file mode 100644 index 0000000000000..dbeefa32004e4 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_route53resolver/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as route53resolver from 'aws-cdk-lib/aws-route53resolver'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_rum/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_rum/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_rum/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_s3/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_s3/default.ts-fixture new file mode 100644 index 0000000000000..abc63a21970db --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_s3/default.ts-fixture @@ -0,0 +1,18 @@ +// Fixture with packages imported, but nothing else +import cdk = require('aws-cdk-lib'); +import s3 = require('aws-cdk-lib/aws-s3'); +import kms = require('aws-cdk-lib/aws-kms'); +import iam = require('aws-cdk-lib/aws-iam'); +import lambda = require('aws-cdk-lib/aws-lambda'); +import s3n = require('aws-cdk-lib/aws-s3-notifications'); +import sns = require('aws-cdk-lib/aws-sns'); +import sqs = require('aws-cdk-lib/aws-sqs'); +import assert = require('assert'); + +class Fixture extends cdk.Stack { + constructor(scope: cdk.Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_s3_assets/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_s3_assets/default.ts-fixture new file mode 100644 index 0000000000000..39ab6a7b911ea --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_s3_assets/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import { Asset } from 'aws-cdk-lib/aws-s3-assets'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_s3_deployment/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_s3_deployment/default.ts-fixture new file mode 100644 index 0000000000000..f074d1326e124 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_s3_deployment/default.ts-fixture @@ -0,0 +1,20 @@ +// Fixture with packages imported, but nothing else +import { Duration, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as ec2 from'aws-cdk-lib/aws-ec2'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} + +class ConstructThatReadsFromTheBucket { + constructor(...args: any[]) { + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/aws_s3_notifications/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_s3_notifications/default.ts-fixture new file mode 100644 index 0000000000000..ffc73adb3a1c1 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_s3_notifications/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as s3n from 'aws-cdk-lib/aws-s3-notifications'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_sagemaker/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_sagemaker/default.ts-fixture new file mode 100644 index 0000000000000..e4fae5f06e628 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_sagemaker/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import * as cdk from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +class Fixture extends cdk.Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_scheduler/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_scheduler/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_scheduler/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_secretsmanager/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_secretsmanager/default.ts-fixture new file mode 100644 index 0000000000000..212ff16d6c6ae --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_secretsmanager/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack, SecretValue } from 'aws-cdk-lib'; +import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as rds from 'aws-cdk-lib/aws-rds'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/@aws-cdk/aws-servicecatalog/rosetta/basic-portfolio.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_servicecatalog/basic-portfolio.ts-fixture similarity index 78% rename from packages/@aws-cdk/aws-servicecatalog/rosetta/basic-portfolio.ts-fixture rename to packages/aws-cdk-lib/rosetta/aws_servicecatalog/basic-portfolio.ts-fixture index f63c01cff86a4..e3701efc77400 100644 --- a/packages/@aws-cdk/aws-servicecatalog/rosetta/basic-portfolio.ts-fixture +++ b/packages/aws-cdk-lib/rosetta/aws_servicecatalog/basic-portfolio.ts-fixture @@ -1,6 +1,6 @@ // Fixture with packages imported, but nothing else -import * as cdk from '@aws-cdk/core'; -import * as servicecatalog from '@aws-cdk/aws-servicecatalog'; +import * as cdk from 'aws-cdk-lib'; +import * as servicecatalog from 'aws-cdk-lib/aws-servicecatalog'; import { Construct } from 'constructs'; class Fixture extends cdk.Stack { diff --git a/packages/aws-cdk-lib/rosetta/aws_servicecatalog/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_servicecatalog/default.ts-fixture new file mode 100644 index 0000000000000..3c6e918e15ed4 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_servicecatalog/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as servicecatalog from 'aws-cdk-lib/aws-servicecatalog'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_servicecatalogappregistry/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_servicecatalogappregistry/default.ts-fixture new file mode 100644 index 0000000000000..863923b1b4388 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_servicecatalogappregistry/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { App, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as appreg from 'aws-cdk-lib/aws-servicecatalogappregistry'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_ses/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ses/default.ts-fixture new file mode 100644 index 0000000000000..69c2454dd0346 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ses/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as ses from 'aws-cdk-lib/aws-ses'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as route53 from 'aws-cdk-lib/aws-route53'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_signer/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_signer/default.ts-fixture new file mode 100644 index 0000000000000..7c12417cc667b --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_signer/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as signer from 'aws-cdk-lib/aws-signer'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_simspaceweaver/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_simspaceweaver/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_simspaceweaver/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_sns/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_sns/default.ts-fixture new file mode 100644 index 0000000000000..a39971f4c2d11 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_sns/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as subscriptions from 'aws-cdk-lib/aws-sns-subscriptions'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_sns_subscriptions/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_sns_subscriptions/default.ts-fixture new file mode 100644 index 0000000000000..625ceddfa9872 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_sns_subscriptions/default.ts-fixture @@ -0,0 +1,15 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { CfnParameter, Duration, Stack } from 'aws-cdk-lib'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as subscriptions from 'aws-cdk-lib/aws-sns-subscriptions'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_sqs/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_sqs/default.ts-fixture new file mode 100644 index 0000000000000..bd33fe7cb4fec --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_sqs/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import sqs = require('aws-cdk-lib/aws-sqs'); +import kms = require('aws-cdk-lib/aws-kms'); + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_ssm/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ssm/default.ts-fixture new file mode 100644 index 0000000000000..6e1471e325d23 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ssm/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack, Lazy } from 'aws-cdk-lib'; +import * as ssm from 'aws-cdk-lib/aws-ssm'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_ssmcontacts/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ssmcontacts/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ssmcontacts/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_ssmincidents/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_ssmincidents/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_ssmincidents/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_stepfunctions/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_stepfunctions/default.ts-fixture new file mode 100644 index 0000000000000..7094e889dafa2 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_stepfunctions/default.ts-fixture @@ -0,0 +1,14 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { App, CfnOutput, Duration, Stack } from 'aws-cdk-lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as iam from 'aws-cdk-lib/aws-iam'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_stepfunctions_tasks/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_stepfunctions_tasks/default.ts-fixture new file mode 100644 index 0000000000000..90812a1cd3e1a --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_stepfunctions_tasks/default.ts-fixture @@ -0,0 +1,21 @@ +// Fixture with packages imported, but nothing else +import { Duration, RemovalPolicy, Size, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; +import * as ecs from 'aws-cdk-lib/aws-ecs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_supportapp/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_supportapp/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_supportapp/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_synthetics/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_synthetics/default.ts-fixture new file mode 100644 index 0000000000000..e5ed4fde3b41c --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_synthetics/default.ts-fixture @@ -0,0 +1,13 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Duration, Stack } from 'aws-cdk-lib'; +import * as synthetics from 'aws-cdk-lib/aws-synthetics'; +import * as path from 'path'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_systemsmanagersap/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_systemsmanagersap/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_systemsmanagersap/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_timestream/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_timestream/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_timestream/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_transfer/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_transfer/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_transfer/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_voiceid/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_voiceid/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_voiceid/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_vpclattice/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_vpclattice/default.ts-fixture new file mode 100644 index 0000000000000..09580478d1084 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_vpclattice/default.ts-fixture @@ -0,0 +1,8 @@ +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class MyStack extends Stack { + constructor(scope: Construct, id: string) { + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_wafv2/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_wafv2/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_wafv2/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_wisdom/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_wisdom/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_wisdom/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/aws_xray/default.ts-fixture b/packages/aws-cdk-lib/rosetta/aws_xray/default.ts-fixture new file mode 100644 index 0000000000000..9c5da1decd609 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/aws_xray/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/cloudformation_include/default.ts-fixture b/packages/aws-cdk-lib/rosetta/cloudformation_include/default.ts-fixture new file mode 100644 index 0000000000000..32552110057cf --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/cloudformation_include/default.ts-fixture @@ -0,0 +1,18 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as core from 'aws-cdk-lib'; +import * as path from 'path'; +import * as cfn_inc from 'aws-cdk-lib/cloudformation-include'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as kms from 'aws-cdk-lib/aws-kms'; +import * as ec2 from 'aws-cdk-lib/aws-ec2'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/custom_resources/default.ts-fixture b/packages/aws-cdk-lib/rosetta/custom_resources/default.ts-fixture new file mode 100644 index 0000000000000..ecbbae00ffdd7 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/custom_resources/default.ts-fixture @@ -0,0 +1,16 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { CustomResource, Duration, Stack } from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cr from 'aws-cdk-lib/custom-resources'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import * as logs from 'aws-cdk-lib/aws-logs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/default.ts-fixture b/packages/aws-cdk-lib/rosetta/default.ts-fixture new file mode 100644 index 0000000000000..a015e286782c5 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/default.ts-fixture @@ -0,0 +1,84 @@ +import * as cfn from 'aws-cdk-lib/aws-cloudformation'; +import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; +import * as acm from 'aws-cdk-lib/aws-certificatemanager'; +import * as route53 from 'aws-cdk-lib/aws-route53'; +import * as origins from 'aws-cdk-lib/aws-cloudfront-origins'; +import * as customresources from 'aws-cdk-lib/custom-resources'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as sns from 'aws-cdk-lib/aws-sns'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as s3 from 'aws-cdk-lib/aws-s3'; +import { + App, + Aws, + CfnCondition, + CfnDynamicReference, + CfnDynamicReferenceService, + CfnInclude, + CfnJson, + CfnMapping, + CfnOutput, + CfnParameter, + CfnResource, + CfnResourceProps, + CustomResource, + CustomResourceProvider, + CustomResourceProviderRuntime, + DefaultStackSynthesizer, + Duration, + Fn, + IConstruct, + RemovalPolicy, + SecretValue, + Size, + SizeRoundingBehavior, + Stack, + StackProps, + Stage, + Token, +} from 'aws-cdk-lib'; +import { + Construct, + DependencyGroup, +} from 'constructs'; + +declare const app: App; +declare const arn: 'arn:partition:service:region:account-id:resource-id'; +declare const cfnResource: CfnResource; +declare const construct: Construct; +declare const constructA: Construct; +declare const constructB: Construct; +declare const constructC: Construct; +declare const functionProps: lambda.FunctionProps; +declare const isCompleteHandler: lambda.Function; +declare const myBucket: s3.IBucket; +declare const myFunction: lambda.IFunction; +declare const myTopic: sns.ITopic; +declare const onEventHandler: lambda.Function; +declare const resourceProps: CfnResourceProps; + +declare class MyStack extends Stack {} +declare class YourStack extends Stack {} + +class StackThatProvidesABucket extends Stack { + public readonly bucket!: s3.IBucket; +} + +interface StackThatExpectsABucketProps extends StackProps { + readonly bucket: s3.IBucket; +} + +class StackThatExpectsABucket extends Stack { + constructor(scope: Construct, id: string, props: StackThatExpectsABucketProps) { + super(scope, id, props); + } +} + +class fixture$construct extends Construct { + public constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/lambda_layer_awscli/default.ts-fixture b/packages/aws-cdk-lib/rosetta/lambda_layer_awscli/default.ts-fixture new file mode 100644 index 0000000000000..4634d7935b090 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/lambda_layer_awscli/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/lambda_layer_kubectl/default.ts-fixture b/packages/aws-cdk-lib/rosetta/lambda_layer_kubectl/default.ts-fixture new file mode 100644 index 0000000000000..4634d7935b090 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/lambda_layer_kubectl/default.ts-fixture @@ -0,0 +1,12 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { Stack } from 'aws-cdk-lib'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/lambda_layer_node_proxy_agent/default.ts-fixture b/packages/aws-cdk-lib/rosetta/lambda_layer_node_proxy_agent/default.ts-fixture new file mode 100644 index 0000000000000..ed819bc36fa2d --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/lambda_layer_node_proxy_agent/default.ts-fixture @@ -0,0 +1,10 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/rosetta/pipelines/default.ts-fixture b/packages/aws-cdk-lib/rosetta/pipelines/default.ts-fixture new file mode 100644 index 0000000000000..8f9837178accb --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/pipelines/default.ts-fixture @@ -0,0 +1,31 @@ +// Fixture with packages imported, but nothing else +import { Construct } from 'constructs'; +import { CfnOutput, Duration, Stage, Stack, StackProps, StageProps } from 'aws-cdk-lib'; +import cdk = require('aws-cdk-lib'); +import codepipeline = require('aws-cdk-lib/aws-codepipeline'); +import cpactions = require('aws-cdk-lib/aws-codepipeline-actions'); +import codebuild = require('aws-cdk-lib/aws-codebuild'); +import codecommit = require('aws-cdk-lib/aws-codecommit'); +import dynamodb = require('aws-cdk-lib/aws-dynamodb'); +import ecr = require('aws-cdk-lib/aws-ecr'); +import ec2 = require('aws-cdk-lib/aws-ec2'); +import iam = require('aws-cdk-lib/aws-iam'); +import lambda = require('aws-cdk-lib/lambda'); +import pipelines = require('aws-cdk-lib/pipelines'); +import secretsmanager = require('aws-cdk-lib/aws-secretsmanager'); +import sns = require('aws-cdk-lib/aws-sns'); +import subscriptions = require('aws-cdk-lib/aws-sns-subscriptions'); +import s3 = require('aws-cdk-lib/aws-s3'); + +class MyApplicationStage extends Stage { + constructor(scope: Construct, id: string, props?: StageProps) { + super(scope, id, props); + } +} + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} diff --git a/packages/aws-cdk-lib/rosetta/region_info/default.ts-fixture b/packages/aws-cdk-lib/rosetta/region_info/default.ts-fixture new file mode 100644 index 0000000000000..763f7d2ff7394 --- /dev/null +++ b/packages/aws-cdk-lib/rosetta/region_info/default.ts-fixture @@ -0,0 +1,11 @@ +// Fixture with packages imported, but nothing else +import { Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import * as regionInfo from 'aws-cdk-lib/region-info'; + +class Fixture extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + /// here + } +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/scripts/gen.ts b/packages/aws-cdk-lib/scripts/gen.ts new file mode 100644 index 0000000000000..4b64fae992d3a --- /dev/null +++ b/packages/aws-cdk-lib/scripts/gen.ts @@ -0,0 +1,92 @@ +import { generateAll, ModuleMap } from '@aws-cdk/cfn2ts'; +import * as fs from 'fs-extra'; +import * as path from 'path'; + +const awsCdkLibDir = path.join(__dirname, '..'); +const pkgJsonPath = path.join(awsCdkLibDir, 'package.json'); +const topLevelIndexFilePath = path.join(awsCdkLibDir, 'index.ts'); + +main() + .then(() => process.exit(0)) + // eslint-ignore-next-line no-console + .catch(console.error) + +async function main() { + // Generate all L1s based on config in scope-map.json + const scopeMapPath = path.join(__dirname, 'scope-map.json'); + + const generated = await generateAll(awsCdkLibDir, { + coreImport: '../../core', + cloudwatchImport: '../../aws-cloudwatch', + scopeMapPath, + }); + + // Add any new cfn modules to exports in package.json and index.ts + await updatePackageJsonAndIndexFiles(generated); + + // Update scope-map config with any changes + const newScopeMap = Object.entries(generated) + .reduce((accum, [moduleName, { scopes }]) => { + return { + ...accum, + [moduleName]: scopes, + } + }, {}); + await fs.writeJson(scopeMapPath, newScopeMap, { spaces: 2 }); + + // Call build-tools within modules for other codegen + // TODO: Move these up into aws-cdk-libs/scripts + require('../aws-events-targets/build-tools/gen.js'); + await genCfnIncludeMap(generated); +} + +async function updatePackageJsonAndIndexFiles(modules: ModuleMap) { + const pkgJson = await fs.readJson(pkgJsonPath); + + const topLevelIndexFileEntries = new Array(); + if (fs.existsSync(topLevelIndexFilePath)) { + const indexFile = await fs.readFile(topLevelIndexFilePath); + topLevelIndexFileEntries.push(...indexFile.toString('utf-8').split('\n')); + } + + Object.entries(modules) + .forEach(([moduleName, { module }]) => { + let moduleConfig: { name: string, submodule: string }; + if (module) { + moduleConfig = { + name: module.moduleName, + submodule: module.submoduleName, + }; + } else { + moduleConfig = { + name: moduleName, + submodule: moduleName.replace(/-/g, '_'), + } + } + + const exportName = `./${moduleConfig.name}`; + if (!pkgJson.exports[exportName]) { + pkgJson.exports[exportName] = `./${moduleConfig.name}/index.js`; + } + + if (!topLevelIndexFileEntries.find(e => e.includes(moduleConfig.name))) { + topLevelIndexFileEntries.push(`export * as ${moduleConfig.submodule} from './${moduleConfig.name}';`); + } + }); + + await fs.writeJson(pkgJsonPath, pkgJson, { spaces: 2 }); + await fs.writeFile(topLevelIndexFilePath, topLevelIndexFileEntries.join('\n')); +} + +async function genCfnIncludeMap(generated: ModuleMap) { + const classMap: { [cfnType: string]: string } = {}; + Object.entries(generated).forEach(([moduleName, { resources }]) => { + const modulePath = `aws-cdk-lib/${moduleName}`; + Object.entries(resources).forEach(([resourceName, resourceClassName]) => { + classMap[resourceName] = `${modulePath}.${resourceClassName}`; + }); + }); + + const filePath = path.join(__dirname, '..', 'cloudformation-include', 'cfn-types-2-classes.json'); + await fs.writeJson(filePath, classMap, { spaces: 2 }); +} diff --git a/packages/aws-cdk-lib/scripts/scope-map.json b/packages/aws-cdk-lib/scripts/scope-map.json new file mode 100644 index 0000000000000..02e6a3ad1b40a --- /dev/null +++ b/packages/aws-cdk-lib/scripts/scope-map.json @@ -0,0 +1,654 @@ +{ + "alexa-ask": [ + "Alexa::ASK" + ], + "aws-accessanalyzer": [ + "AWS::AccessAnalyzer" + ], + "aws-acmpca": [ + "AWS::ACMPCA" + ], + "aws-amazonmq": [ + "AWS::AmazonMQ" + ], + "aws-amplify": [ + "AWS::Amplify" + ], + "aws-amplifyuibuilder": [ + "AWS::AmplifyUIBuilder" + ], + "aws-apigateway": [ + "AWS::ApiGateway" + ], + "aws-apigatewayv2": [ + "AWS::ApiGatewayV2" + ], + "aws-appconfig": [ + "AWS::AppConfig" + ], + "aws-appflow": [ + "AWS::AppFlow" + ], + "aws-appintegrations": [ + "AWS::AppIntegrations" + ], + "aws-applicationautoscaling": [ + "AWS::ApplicationAutoScaling" + ], + "aws-applicationinsights": [ + "AWS::ApplicationInsights" + ], + "aws-appmesh": [ + "AWS::AppMesh" + ], + "aws-apprunner": [ + "AWS::AppRunner" + ], + "aws-appstream": [ + "AWS::AppStream" + ], + "aws-appsync": [ + "AWS::AppSync" + ], + "aws-aps": [ + "AWS::APS" + ], + "aws-athena": [ + "AWS::Athena" + ], + "aws-auditmanager": [ + "AWS::AuditManager" + ], + "aws-autoscaling": [ + "AWS::AutoScaling" + ], + "aws-autoscalingplans": [ + "AWS::AutoScalingPlans" + ], + "aws-backup": [ + "AWS::Backup" + ], + "aws-batch": [ + "AWS::Batch" + ], + "aws-billingconductor": [ + "AWS::BillingConductor" + ], + "aws-budgets": [ + "AWS::Budgets" + ], + "aws-cassandra": [ + "AWS::Cassandra" + ], + "aws-ce": [ + "AWS::CE" + ], + "aws-certificatemanager": [ + "AWS::CertificateManager" + ], + "aws-chatbot": [ + "AWS::Chatbot" + ], + "aws-cloud9": [ + "AWS::Cloud9" + ], + "aws-cloudformation": [ + "AWS::CloudFormation" + ], + "aws-cloudfront": [ + "AWS::CloudFront" + ], + "aws-cloudtrail": [ + "AWS::CloudTrail" + ], + "aws-cloudwatch": [ + "AWS::CloudWatch" + ], + "aws-codeartifact": [ + "AWS::CodeArtifact" + ], + "aws-codebuild": [ + "AWS::CodeBuild" + ], + "aws-codecommit": [ + "AWS::CodeCommit" + ], + "aws-codedeploy": [ + "AWS::CodeDeploy" + ], + "aws-codeguruprofiler": [ + "AWS::CodeGuruProfiler" + ], + "aws-codegurureviewer": [ + "AWS::CodeGuruReviewer" + ], + "aws-codepipeline": [ + "AWS::CodePipeline" + ], + "aws-codestar": [ + "AWS::CodeStar" + ], + "aws-codestarconnections": [ + "AWS::CodeStarConnections" + ], + "aws-codestarnotifications": [ + "AWS::CodeStarNotifications" + ], + "aws-cognito": [ + "AWS::Cognito" + ], + "aws-comprehend": [ + "AWS::Comprehend" + ], + "aws-config": [ + "AWS::Config" + ], + "aws-connect": [ + "AWS::Connect" + ], + "aws-connectcampaigns": [ + "AWS::ConnectCampaigns" + ], + "aws-controltower": [ + "AWS::ControlTower" + ], + "aws-cur": [ + "AWS::CUR" + ], + "aws-customerprofiles": [ + "AWS::CustomerProfiles" + ], + "aws-databrew": [ + "AWS::DataBrew" + ], + "aws-datapipeline": [ + "AWS::DataPipeline" + ], + "aws-datasync": [ + "AWS::DataSync" + ], + "aws-dax": [ + "AWS::DAX" + ], + "aws-detective": [ + "AWS::Detective" + ], + "aws-devicefarm": [ + "AWS::DeviceFarm" + ], + "aws-devopsguru": [ + "AWS::DevOpsGuru" + ], + "aws-directoryservice": [ + "AWS::DirectoryService" + ], + "aws-dlm": [ + "AWS::DLM" + ], + "aws-dms": [ + "AWS::DMS" + ], + "aws-docdb": [ + "AWS::DocDB" + ], + "aws-docdbelastic": [ + "AWS::DocDBElastic" + ], + "aws-dynamodb": [ + "AWS::DynamoDB" + ], + "aws-ec2": [ + "AWS::EC2" + ], + "aws-ecr": [ + "AWS::ECR" + ], + "aws-ecs": [ + "AWS::ECS" + ], + "aws-efs": [ + "AWS::EFS" + ], + "aws-eks": [ + "AWS::EKS" + ], + "aws-elasticache": [ + "AWS::ElastiCache" + ], + "aws-elasticbeanstalk": [ + "AWS::ElasticBeanstalk" + ], + "aws-elasticloadbalancing": [ + "AWS::ElasticLoadBalancing" + ], + "aws-elasticloadbalancingv2": [ + "AWS::ElasticLoadBalancingV2" + ], + "aws-elasticsearch": [ + "AWS::Elasticsearch" + ], + "aws-emr": [ + "AWS::EMR" + ], + "aws-emrcontainers": [ + "AWS::EMRContainers" + ], + "aws-emrserverless": [ + "AWS::EMRServerless" + ], + "aws-events": [ + "AWS::Events" + ], + "aws-eventschemas": [ + "AWS::EventSchemas" + ], + "aws-evidently": [ + "AWS::Evidently" + ], + "aws-finspace": [ + "AWS::FinSpace" + ], + "aws-fis": [ + "AWS::FIS" + ], + "aws-fms": [ + "AWS::FMS" + ], + "aws-forecast": [ + "AWS::Forecast" + ], + "aws-frauddetector": [ + "AWS::FraudDetector" + ], + "aws-fsx": [ + "AWS::FSx" + ], + "aws-gamelift": [ + "AWS::GameLift" + ], + "aws-globalaccelerator": [ + "AWS::GlobalAccelerator" + ], + "aws-glue": [ + "AWS::Glue" + ], + "aws-grafana": [ + "AWS::Grafana" + ], + "aws-greengrass": [ + "AWS::Greengrass" + ], + "aws-greengrassv2": [ + "AWS::GreengrassV2" + ], + "aws-groundstation": [ + "AWS::GroundStation" + ], + "aws-guardduty": [ + "AWS::GuardDuty" + ], + "aws-healthlake": [ + "AWS::HealthLake" + ], + "aws-iam": [ + "AWS::IAM" + ], + "aws-identitystore": [ + "AWS::IdentityStore" + ], + "aws-imagebuilder": [ + "AWS::ImageBuilder" + ], + "aws-inspector": [ + "AWS::Inspector" + ], + "aws-inspectorv2": [ + "AWS::InspectorV2" + ], + "aws-internetmonitor": [ + "AWS::InternetMonitor" + ], + "aws-iot": [ + "AWS::IoT" + ], + "aws-iot1click": [ + "AWS::IoT1Click" + ], + "aws-iotanalytics": [ + "AWS::IoTAnalytics" + ], + "aws-iotcoredeviceadvisor": [ + "AWS::IoTCoreDeviceAdvisor" + ], + "aws-iotevents": [ + "AWS::IoTEvents" + ], + "aws-iotfleethub": [ + "AWS::IoTFleetHub" + ], + "aws-iotfleetwise": [ + "AWS::IoTFleetWise" + ], + "aws-iotsitewise": [ + "AWS::IoTSiteWise" + ], + "aws-iotthingsgraph": [ + "AWS::IoTThingsGraph" + ], + "aws-iottwinmaker": [ + "AWS::IoTTwinMaker" + ], + "aws-iotwireless": [ + "AWS::IoTWireless" + ], + "aws-ivs": [ + "AWS::IVS" + ], + "aws-ivschat": [ + "AWS::IVSChat" + ], + "aws-kafkaconnect": [ + "AWS::KafkaConnect" + ], + "aws-kendra": [ + "AWS::Kendra" + ], + "aws-kendraranking": [ + "AWS::KendraRanking" + ], + "aws-kinesis": [ + "AWS::Kinesis" + ], + "aws-kinesisanalytics": [ + "AWS::KinesisAnalytics", + "AWS::KinesisAnalyticsV2" + ], + "aws-kinesisanalyticsv2": [ + "AWS::KinesisAnalyticsV2" + ], + "aws-kinesisfirehose": [ + "AWS::KinesisFirehose" + ], + "aws-kinesisvideo": [ + "AWS::KinesisVideo" + ], + "aws-kms": [ + "AWS::KMS" + ], + "aws-lakeformation": [ + "AWS::LakeFormation" + ], + "aws-lambda": [ + "AWS::Lambda" + ], + "aws-lex": [ + "AWS::Lex" + ], + "aws-licensemanager": [ + "AWS::LicenseManager" + ], + "aws-lightsail": [ + "AWS::Lightsail" + ], + "aws-location": [ + "AWS::Location" + ], + "aws-logs": [ + "AWS::Logs" + ], + "aws-lookoutequipment": [ + "AWS::LookoutEquipment" + ], + "aws-lookoutmetrics": [ + "AWS::LookoutMetrics" + ], + "aws-lookoutvision": [ + "AWS::LookoutVision" + ], + "aws-m2": [ + "AWS::M2" + ], + "aws-macie": [ + "AWS::Macie" + ], + "aws-managedblockchain": [ + "AWS::ManagedBlockchain" + ], + "aws-mediaconnect": [ + "AWS::MediaConnect" + ], + "aws-mediaconvert": [ + "AWS::MediaConvert" + ], + "aws-medialive": [ + "AWS::MediaLive" + ], + "aws-mediapackage": [ + "AWS::MediaPackage" + ], + "aws-mediastore": [ + "AWS::MediaStore" + ], + "aws-mediatailor": [ + "AWS::MediaTailor" + ], + "aws-memorydb": [ + "AWS::MemoryDB" + ], + "aws-msk": [ + "AWS::MSK" + ], + "aws-mwaa": [ + "AWS::MWAA" + ], + "aws-neptune": [ + "AWS::Neptune" + ], + "aws-networkfirewall": [ + "AWS::NetworkFirewall" + ], + "aws-networkmanager": [ + "AWS::NetworkManager" + ], + "aws-nimblestudio": [ + "AWS::NimbleStudio" + ], + "aws-oam": [ + "AWS::Oam" + ], + "aws-omics": [ + "AWS::Omics" + ], + "aws-opensearchserverless": [ + "AWS::OpenSearchServerless" + ], + "aws-opensearchservice": [ + "AWS::OpenSearchService" + ], + "aws-opsworks": [ + "AWS::OpsWorks" + ], + "aws-opsworkscm": [ + "AWS::OpsWorksCM" + ], + "aws-organizations": [ + "AWS::Organizations" + ], + "aws-panorama": [ + "AWS::Panorama" + ], + "aws-personalize": [ + "AWS::Personalize" + ], + "aws-pinpoint": [ + "AWS::Pinpoint" + ], + "aws-pinpointemail": [ + "AWS::PinpointEmail" + ], + "aws-pipes": [ + "AWS::Pipes" + ], + "aws-qldb": [ + "AWS::QLDB" + ], + "aws-quicksight": [ + "AWS::QuickSight" + ], + "aws-ram": [ + "AWS::RAM" + ], + "aws-rds": [ + "AWS::RDS" + ], + "aws-redshift": [ + "AWS::Redshift" + ], + "aws-redshiftserverless": [ + "AWS::RedshiftServerless" + ], + "aws-refactorspaces": [ + "AWS::RefactorSpaces" + ], + "aws-rekognition": [ + "AWS::Rekognition" + ], + "aws-resiliencehub": [ + "AWS::ResilienceHub" + ], + "aws-resourceexplorer2": [ + "AWS::ResourceExplorer2" + ], + "aws-resourcegroups": [ + "AWS::ResourceGroups" + ], + "aws-robomaker": [ + "AWS::RoboMaker" + ], + "aws-rolesanywhere": [ + "AWS::RolesAnywhere" + ], + "aws-route53": [ + "AWS::Route53" + ], + "aws-route53recoverycontrol": [ + "AWS::Route53RecoveryControl" + ], + "aws-route53recoveryreadiness": [ + "AWS::Route53RecoveryReadiness" + ], + "aws-route53resolver": [ + "AWS::Route53Resolver" + ], + "aws-rum": [ + "AWS::RUM" + ], + "aws-s3": [ + "AWS::S3" + ], + "aws-s3objectlambda": [ + "AWS::S3ObjectLambda" + ], + "aws-s3outposts": [ + "AWS::S3Outposts" + ], + "aws-sagemaker": [ + "AWS::SageMaker" + ], + "aws-sam": [ + "AWS::Serverless" + ], + "aws-scheduler": [ + "AWS::Scheduler" + ], + "aws-sdb": [ + "AWS::SDB" + ], + "aws-secretsmanager": [ + "AWS::SecretsManager" + ], + "aws-securityhub": [ + "AWS::SecurityHub" + ], + "aws-servicecatalog": [ + "AWS::ServiceCatalog" + ], + "aws-servicecatalogappregistry": [ + "AWS::ServiceCatalogAppRegistry" + ], + "aws-servicediscovery": [ + "AWS::ServiceDiscovery" + ], + "aws-ses": [ + "AWS::SES" + ], + "aws-signer": [ + "AWS::Signer" + ], + "aws-simspaceweaver": [ + "AWS::SimSpaceWeaver" + ], + "aws-sns": [ + "AWS::SNS" + ], + "aws-sqs": [ + "AWS::SQS" + ], + "aws-ssm": [ + "AWS::SSM" + ], + "aws-ssmcontacts": [ + "AWS::SSMContacts" + ], + "aws-ssmincidents": [ + "AWS::SSMIncidents" + ], + "aws-sso": [ + "AWS::SSO" + ], + "aws-stepfunctions": [ + "AWS::StepFunctions" + ], + "aws-supportapp": [ + "AWS::SupportApp" + ], + "aws-synthetics": [ + "AWS::Synthetics" + ], + "aws-systemsmanagersap": [ + "AWS::SystemsManagerSAP" + ], + "aws-timestream": [ + "AWS::Timestream" + ], + "aws-transfer": [ + "AWS::Transfer" + ], + "aws-voiceid": [ + "AWS::VoiceID" + ], + "aws-vpclattice": [ + "AWS::VpcLattice" + ], + "aws-waf": [ + "AWS::WAF" + ], + "aws-wafregional": [ + "AWS::WAFRegional" + ], + "aws-wafv2": [ + "AWS::WAFv2" + ], + "aws-wisdom": [ + "AWS::Wisdom" + ], + "aws-workspaces": [ + "AWS::WorkSpaces" + ], + "aws-xray": [ + "AWS::XRay" + ], + "core": [ + "AWS::CloudFormation" + ] +} diff --git a/packages/aws-cdk-lib/triggers/.jsiirc.json b/packages/aws-cdk-lib/triggers/.jsiirc.json new file mode 100644 index 0000000000000..c1f8e82721310 --- /dev/null +++ b/packages/aws-cdk-lib/triggers/.jsiirc.json @@ -0,0 +1,13 @@ +{ + "targets": { + "java": { + "package": "software.amazon.awscdk.triggers" + }, + "dotnet": { + "namespace": "Amazon.CDK.Triggers" + }, + "python": { + "module": "aws_cdk.triggers" + } + } +} diff --git a/packages/aws-cdk-lib/triggers/README.md b/packages/aws-cdk-lib/triggers/README.md new file mode 100644 index 0000000000000..8f1756fff13bc --- /dev/null +++ b/packages/aws-cdk-lib/triggers/README.md @@ -0,0 +1,86 @@ +# Triggers + + +Triggers allows you to execute code during deployments. This can be used for a +variety of use cases such as: + +* Self tests: validate something after a resource/construct been provisioned +* Data priming: add initial data to resources after they are created +* Preconditions: check things such as account limits or external dependencies + before deployment. + +## Usage + +The `TriggerFunction` construct will define an AWS Lambda function which is +triggered *during* deployment: + +```ts +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as triggers from 'aws-cdk-lib/triggers'; +import { Stack } from 'aws-cdk-lib'; + +declare const stack: Stack; + +new triggers.TriggerFunction(stack, 'MyTrigger', { + runtime: lambda.Runtime.NODEJS_14_X, + handler: 'index.handler', + code: lambda.Code.fromAsset(__dirname + '/my-trigger'), +}); +``` + +In the above example, the AWS Lambda function defined in `myLambdaFunction` will +be invoked when the stack is deployed. + +## Trigger Failures + +If the trigger handler fails (e.g. an exception is raised), the CloudFormation +deployment will fail, as if a resource failed to provision. This makes it easy +to implement "self tests" via triggers by simply making a set of assertions on +some provisioned infrastructure. + +## Order of Execution + +By default, a trigger will be executed by CloudFormation after the associated +handler is provisioned. This means that if the handler takes an implicit +dependency on other resources (e.g. via environment variables), those resources +will be provisioned *before* the trigger is executed. + +In most cases, implicit ordering should be sufficient, but you can also use +`executeAfter` and `executeBefore` to control the order of execution. + +The following example defines the following order: `(hello, world) => myTrigger => goodbye`. +The resources under `hello` and `world` will be provisioned in +parallel, and then the trigger `myTrigger` will be executed. Only then the +resources under `goodbye` will be provisioned: + +```ts +import { Construct, Node } from 'constructs'; +import * as triggers from 'aws-cdk-lib/triggers'; + +declare const myTrigger: triggers.Trigger; +declare const hello: Construct; +declare const world: Construct; +declare const goodbye: Construct; + +myTrigger.executeAfter(hello, world); +myTrigger.executeBefore(goodbye); +``` + +Note that `hello` and `world` are construct *scopes*. This means that they can +be specific resources (such as an `s3.Bucket` object) or groups of resources +composed together into constructs. + +## Re-execution of Triggers + +By default, `executeOnHandlerChange` is enabled. This implies that the trigger +is re-executed every time the handler function code or configuration changes. If +this option is disabled, the trigger will be executed only once upon first +deployment. + +In the future we will consider adding support for additional re-execution modes: + +* `executeOnEveryDeployment: boolean` - re-executes every time the stack is + deployed (add random "salt" during synthesis). +* `executeOnResourceChange: Construct[]` - re-executes when one of the resources + under the specified scopes has changed (add the hash the CloudFormation + resource specs). diff --git a/packages/aws-cdk-lib/triggers/index.ts b/packages/aws-cdk-lib/triggers/index.ts new file mode 100644 index 0000000000000..f41a696fd204d --- /dev/null +++ b/packages/aws-cdk-lib/triggers/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/packages/@aws-cdk/triggers/lib/index.ts b/packages/aws-cdk-lib/triggers/lib/index.ts similarity index 100% rename from packages/@aws-cdk/triggers/lib/index.ts rename to packages/aws-cdk-lib/triggers/lib/index.ts diff --git a/packages/@aws-cdk/triggers/lib/lambda/index.ts b/packages/aws-cdk-lib/triggers/lib/lambda/index.ts similarity index 100% rename from packages/@aws-cdk/triggers/lib/lambda/index.ts rename to packages/aws-cdk-lib/triggers/lib/lambda/index.ts diff --git a/packages/@aws-cdk/triggers/lib/trigger-function.ts b/packages/aws-cdk-lib/triggers/lib/trigger-function.ts similarity index 94% rename from packages/@aws-cdk/triggers/lib/trigger-function.ts rename to packages/aws-cdk-lib/triggers/lib/trigger-function.ts index 6504c9f5d1334..0d99ba5628fc4 100644 --- a/packages/@aws-cdk/triggers/lib/trigger-function.ts +++ b/packages/aws-cdk-lib/triggers/lib/trigger-function.ts @@ -1,4 +1,4 @@ -import * as lambda from '@aws-cdk/aws-lambda'; +import * as lambda from '../../aws-lambda'; import { Construct } from 'constructs'; import { ITrigger, Trigger, TriggerOptions } from '.'; diff --git a/packages/@aws-cdk/triggers/lib/trigger.ts b/packages/aws-cdk-lib/triggers/lib/trigger.ts similarity index 97% rename from packages/@aws-cdk/triggers/lib/trigger.ts rename to packages/aws-cdk-lib/triggers/lib/trigger.ts index 6febb482966cf..d065a541734fe 100644 --- a/packages/@aws-cdk/triggers/lib/trigger.ts +++ b/packages/aws-cdk-lib/triggers/lib/trigger.ts @@ -1,6 +1,6 @@ import { join } from 'path'; -import * as lambda from '@aws-cdk/aws-lambda'; -import { CustomResource, CustomResourceProvider, CustomResourceProviderRuntime } from '@aws-cdk/core'; +import * as lambda from '../../aws-lambda'; +import { CustomResource, CustomResourceProvider, CustomResourceProviderRuntime } from '../../core'; import { Construct, IConstruct, Node } from 'constructs'; /** diff --git a/packages/@aws-cdk/triggers/test/trigger-handler.test.ts b/packages/aws-cdk-lib/triggers/test/trigger-handler.test.ts similarity index 100% rename from packages/@aws-cdk/triggers/test/trigger-handler.test.ts rename to packages/aws-cdk-lib/triggers/test/trigger-handler.test.ts diff --git a/packages/@aws-cdk/triggers/test/triggers.test.ts b/packages/aws-cdk-lib/triggers/test/triggers.test.ts similarity index 93% rename from packages/@aws-cdk/triggers/test/triggers.test.ts rename to packages/aws-cdk-lib/triggers/test/triggers.test.ts index cc4edb610bade..c76a4d76c2876 100644 --- a/packages/@aws-cdk/triggers/test/triggers.test.ts +++ b/packages/aws-cdk-lib/triggers/test/triggers.test.ts @@ -1,7 +1,7 @@ -import { Template } from '@aws-cdk/assertions'; -import * as lambda from '@aws-cdk/aws-lambda'; -import * as sns from '@aws-cdk/aws-sns'; -import { Stack } from '@aws-cdk/core'; +import { Template } from '../../assertions'; +import * as lambda from '../../aws-lambda'; +import * as sns from '../../aws-sns'; +import { Stack } from '../../core'; import * as triggers from '../lib'; test('minimal', () => { diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json index cddd01a2d856f..7cae0e17ed9ae 100644 --- a/packages/aws-cdk/package.json +++ b/packages/aws-cdk/package.json @@ -61,7 +61,7 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/core": "0.0.0", + "aws-cdk-lib": "0.0.0", "@octokit/rest": "^18.12.0", "@types/archiver": "^5.3.1", "@types/fs-extra": "^9.0.13", diff --git a/packages/aws-cdk/test/account-cache.test.ts b/packages/aws-cdk/test/account-cache.test.ts index 5c338fd42e3e1..0c8334136c6f1 100644 --- a/packages/aws-cdk/test/account-cache.test.ts +++ b/packages/aws-cdk/test/account-cache.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as path from 'path'; import * as fs from 'fs-extra'; import { withMocked } from './util'; diff --git a/packages/aws-cdk/test/api/bootstrap.test.ts b/packages/aws-cdk/test/api/bootstrap.test.ts index 0362ad8089b40..11fdac8cce89e 100644 --- a/packages/aws-cdk/test/api/bootstrap.test.ts +++ b/packages/aws-cdk/test/api/bootstrap.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { CreateChangeSetInput } from 'aws-sdk/clients/cloudformation'; import { parse } from 'yaml'; import { Bootstrapper } from '../../lib/api/bootstrap'; diff --git a/packages/aws-cdk/test/api/bootstrap2.test.ts b/packages/aws-cdk/test/api/bootstrap2.test.ts index bedd4f968c2e5..b7e48f8493069 100644 --- a/packages/aws-cdk/test/api/bootstrap2.test.ts +++ b/packages/aws-cdk/test/api/bootstrap2.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ const mockDeployStack = jest.fn(); diff --git a/packages/aws-cdk/test/api/cloud-assembly.test.ts b/packages/aws-cdk/test/api/cloud-assembly.test.ts index de60d00486c17..a1e4e68b42bce 100644 --- a/packages/aws-cdk/test/api/cloud-assembly.test.ts +++ b/packages/aws-cdk/test/api/cloud-assembly.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import { DefaultSelection } from '../../lib/api/cxapp/cloud-assembly'; import { MockCloudExecutable } from '../util'; diff --git a/packages/aws-cdk/test/api/cloud-executable.test.ts b/packages/aws-cdk/test/api/cloud-executable.test.ts index f59e1ba88e579..3d7bc6c5cedbb 100644 --- a/packages/aws-cdk/test/api/cloud-executable.test.ts +++ b/packages/aws-cdk/test/api/cloud-executable.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as cxapi from '@aws-cdk/cx-api'; import { DefaultSelection } from '../../lib/api/cxapp/cloud-assembly'; diff --git a/packages/aws-cdk/test/api/cloudformation-deployments.test.ts b/packages/aws-cdk/test/api/cloudformation-deployments.test.ts index 40cc63e2edf68..baae814a09aef 100644 --- a/packages/aws-cdk/test/api/cloudformation-deployments.test.ts +++ b/packages/aws-cdk/test/api/cloudformation-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ jest.mock('../../lib/api/deploy-stack'); jest.mock('../../lib/util/asset-publishing'); diff --git a/packages/aws-cdk/test/api/console-listener.ts b/packages/aws-cdk/test/api/console-listener.ts index 5a43b662ba217..944da3821dad3 100644 --- a/packages/aws-cdk/test/api/console-listener.ts +++ b/packages/aws-cdk/test/api/console-listener.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { EventEmitter } from 'events'; export type Output = ReadonlyArray; diff --git a/packages/aws-cdk/test/api/deploy-stack.test.ts b/packages/aws-cdk/test/api/deploy-stack.test.ts index 8565c1c7760c3..f4c23b00db1c3 100644 --- a/packages/aws-cdk/test/api/deploy-stack.test.ts +++ b/packages/aws-cdk/test/api/deploy-stack.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { deployStack, DeployStackOptions, ToolkitInfo } from '../../lib/api'; import { HotswapMode } from '../../lib/api/hotswap/common'; import { tryHotswapDeployment } from '../../lib/api/hotswap-deployments'; diff --git a/packages/aws-cdk/test/api/exec.test.ts b/packages/aws-cdk/test/api/exec.test.ts index e52b4485da2cd..e8ecd3d766f0f 100644 --- a/packages/aws-cdk/test/api/exec.test.ts +++ b/packages/aws-cdk/test/api/exec.test.ts @@ -1,6 +1,7 @@ +/* eslint-disable import/order */ jest.mock('child_process'); -import * as cxschema from '@aws-cdk/cloud-assembly-schema'; -import * as cdk from '@aws-cdk/core'; +import * as cxschema from 'aws-cdk-lib/cloud-assembly-schema'; +import * as cdk from 'aws-cdk-lib'; import * as semver from 'semver'; import * as sinon from 'sinon'; import { ImportMock } from 'ts-mock-imports'; diff --git a/packages/aws-cdk/test/api/fake-cloudformation-stack.ts b/packages/aws-cdk/test/api/fake-cloudformation-stack.ts index 3e722f3cad249..1668ea0b55d33 100644 --- a/packages/aws-cdk/test/api/fake-cloudformation-stack.ts +++ b/packages/aws-cdk/test/api/fake-cloudformation-stack.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { CloudFormation } from 'aws-sdk'; import { CloudFormationStack, Template } from '../../lib/api/util/cloudformation'; import { instanceMockFrom } from '../util'; diff --git a/packages/aws-cdk/test/api/fake-sts.ts b/packages/aws-cdk/test/api/fake-sts.ts index 65d54da4d6ef6..026caecb2810f 100644 --- a/packages/aws-cdk/test/api/fake-sts.ts +++ b/packages/aws-cdk/test/api/fake-sts.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as nock from 'nock'; import * as uuid from 'uuid'; import * as xmlJs from 'xml-js'; diff --git a/packages/aws-cdk/test/api/hotswap/appsync-mapping-templates-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/appsync-mapping-templates-hotswap-deployments.test.ts index 3403fc77c74cc..f7780b873806b 100644 --- a/packages/aws-cdk/test/api/hotswap/appsync-mapping-templates-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/appsync-mapping-templates-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { AppSync } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/code-build-projects-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/code-build-projects-hotswap-deployments.test.ts index 9a1d9c403c5d9..7af2fc6addcc2 100644 --- a/packages/aws-cdk/test/api/hotswap/code-build-projects-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/code-build-projects-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { CodeBuild } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts index a9b8660db6f42..e0267635a59d8 100644 --- a/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/ecs-services-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as AWS from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts index 05a320ba58776..aab805a441f5b 100644 --- a/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda, StepFunctions } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { CfnEvaluationException } from '../../../lib/api/evaluate-cloudformation-template'; diff --git a/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts b/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts index 7540aaffccf15..3483ae67118dc 100644 --- a/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts +++ b/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxapi from '@aws-cdk/cx-api'; import * as AWS from 'aws-sdk'; import * as codebuild from 'aws-sdk/clients/codebuild'; diff --git a/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts index c7647de983e0d..b599d41301dc0 100644 --- a/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts index 47fa7669f931e..e4eff93a3d155 100644 --- a/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/lambda-functions-inline-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/lambda-functions-inline-hotswap-deployments.test.ts index cff249ca51004..562a007b86d8d 100644 --- a/packages/aws-cdk/test/api/hotswap/lambda-functions-inline-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/lambda-functions-inline-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/lambda-versions-aliases-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/lambda-versions-aliases-hotswap-deployments.test.ts index 20e08ef4952b4..16f1db3851f98 100644 --- a/packages/aws-cdk/test/api/hotswap/lambda-versions-aliases-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/lambda-versions-aliases-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts b/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts index b9b46d9d5cf54..747a34fd12c8a 100644 --- a/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts +++ b/packages/aws-cdk/test/api/hotswap/nested-stacks-hotswap.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts index 0a30b1ddaa7f2..105f00e0aeac2 100644 --- a/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/s3-bucket-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Lambda } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/hotswap/state-machine-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/state-machine-hotswap-deployments.test.ts index 56a111f04b32d..663542c84c48b 100644 --- a/packages/aws-cdk/test/api/hotswap/state-machine-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/state-machine-hotswap-deployments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { StepFunctions } from 'aws-sdk'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; diff --git a/packages/aws-cdk/test/api/lazy-list-stack-resources.test.ts b/packages/aws-cdk/test/api/lazy-list-stack-resources.test.ts index 64d0b98d62733..ee41a07366a4f 100644 --- a/packages/aws-cdk/test/api/lazy-list-stack-resources.test.ts +++ b/packages/aws-cdk/test/api/lazy-list-stack-resources.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as AWS from 'aws-sdk'; import { LazyListStackResources } from '../../lib/api/evaluate-cloudformation-template'; import { MockSdk } from '../util/mock-sdk'; diff --git a/packages/aws-cdk/test/api/logs/find-cloudwatch-logs.test.ts b/packages/aws-cdk/test/api/logs/find-cloudwatch-logs.test.ts index c4402c37cc4cd..6e693fee10477 100644 --- a/packages/aws-cdk/test/api/logs/find-cloudwatch-logs.test.ts +++ b/packages/aws-cdk/test/api/logs/find-cloudwatch-logs.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxapi from '@aws-cdk/cx-api'; import { CloudFormation } from 'aws-sdk'; import { findCloudWatchLogGroups } from '../../../lib/api/logs/find-cloudwatch-logs'; diff --git a/packages/aws-cdk/test/api/logs/logs-monitor.test.ts b/packages/aws-cdk/test/api/logs/logs-monitor.test.ts index 7f5e54a89b300..5d35455b0c846 100644 --- a/packages/aws-cdk/test/api/logs/logs-monitor.test.ts +++ b/packages/aws-cdk/test/api/logs/logs-monitor.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { blue, yellow } from 'chalk'; import { CloudWatchLogEventMonitor } from '../../../lib/api/logs/logs-monitor'; import { sleep } from '../../util'; diff --git a/packages/aws-cdk/test/api/sdk-provider.test.ts b/packages/aws-cdk/test/api/sdk-provider.test.ts index bd2c19bc6e321..11cda15a9cbf6 100644 --- a/packages/aws-cdk/test/api/sdk-provider.test.ts +++ b/packages/aws-cdk/test/api/sdk-provider.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as os from 'os'; import * as cxapi from '@aws-cdk/cx-api'; import * as AWS from 'aws-sdk'; diff --git a/packages/aws-cdk/test/api/stack-activity-monitor.test.ts b/packages/aws-cdk/test/api/stack-activity-monitor.test.ts index 596064c66c070..9d5a2074b2285 100644 --- a/packages/aws-cdk/test/api/stack-activity-monitor.test.ts +++ b/packages/aws-cdk/test/api/stack-activity-monitor.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { bold, reset, green, yellow, red } from 'chalk'; import { stderr } from './console-listener'; import { HistoryActivityPrinter } from '../../lib/api/util/cloudformation/stack-activity-monitor'; diff --git a/packages/aws-cdk/test/api/toolkit-info.test.ts b/packages/aws-cdk/test/api/toolkit-info.test.ts index 1ef00d113142f..f88bcc855fe0d 100644 --- a/packages/aws-cdk/test/api/toolkit-info.test.ts +++ b/packages/aws-cdk/test/api/toolkit-info.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { ToolkitInfo } from '../../lib/api'; import { errorWithCode, mockBootstrapStack, MockSdk } from '../util/mock-sdk'; diff --git a/packages/aws-cdk/test/api/util/display.test.ts b/packages/aws-cdk/test/api/util/display.test.ts index 6d909d8d03421..09fe52dea6416 100644 --- a/packages/aws-cdk/test/api/util/display.test.ts +++ b/packages/aws-cdk/test/api/util/display.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { RewritableBlock } from '../../../lib/api/util/display'; import { stderr } from '../console-listener'; diff --git a/packages/aws-cdk/test/assets.test.ts b/packages/aws-cdk/test/assets.test.ts index a65679aecc37f..366730bbb612a 100644 --- a/packages/aws-cdk/test/assets.test.ts +++ b/packages/aws-cdk/test/assets.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { AssetMetadataEntry } from '@aws-cdk/cloud-assembly-schema'; import { testStack } from './util'; import { MockSdk } from './util/mock-sdk'; diff --git a/packages/aws-cdk/test/aws-sdk-non-public-apis.test.ts b/packages/aws-cdk/test/aws-sdk-non-public-apis.test.ts index 7b7c5b42d8ecb..5ea8284690f7d 100644 --- a/packages/aws-cdk/test/aws-sdk-non-public-apis.test.ts +++ b/packages/aws-cdk/test/aws-sdk-non-public-apis.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ // The ECS hotswapping functionality in lib/api/hotswap/ecs-services.ts // uses some non-public APIs of the JS AWS SDK for waiting on the deployment to finish. // These unit tests are here to confirm the non-public elements are present and working as expected, diff --git a/packages/aws-cdk/test/bockfs.ts b/packages/aws-cdk/test/bockfs.ts index 72aa13109183c..5158d7633f94d 100644 --- a/packages/aws-cdk/test/bockfs.ts +++ b/packages/aws-cdk/test/bockfs.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ // A not-so-fake filesystem mock similar to mock-fs // // mock-fs is super convenient but we can't always use it: diff --git a/packages/aws-cdk/test/build.test.ts b/packages/aws-cdk/test/build.test.ts index 526307cfc7719..52d389cb4abed 100644 --- a/packages/aws-cdk/test/build.test.ts +++ b/packages/aws-cdk/test/build.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxapi from '@aws-cdk/cx-api'; import { buildAllStackAssets } from '../lib/build'; diff --git a/packages/aws-cdk/test/cdk-docs.test.ts b/packages/aws-cdk/test/cdk-docs.test.ts index f278ae2718fd9..4bacaa8201731 100644 --- a/packages/aws-cdk/test/cdk-docs.test.ts +++ b/packages/aws-cdk/test/cdk-docs.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as mockery from 'mockery'; import { CommandHandler } from '../lib/command-api'; import { realHandler } from '../lib/commands/docs'; diff --git a/packages/aws-cdk/test/cdk-doctor.test.ts b/packages/aws-cdk/test/cdk-doctor.test.ts index 77a0cc46fb650..9f36d63630445 100644 --- a/packages/aws-cdk/test/cdk-doctor.test.ts +++ b/packages/aws-cdk/test/cdk-doctor.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as mockery from 'mockery'; import { realHandler } from '../lib/commands/doctor'; diff --git a/packages/aws-cdk/test/cdk-toolkit.test.ts b/packages/aws-cdk/test/cdk-toolkit.test.ts index 842861dd7b28d..aa5d65c75b964 100644 --- a/packages/aws-cdk/test/cdk-toolkit.test.ts +++ b/packages/aws-cdk/test/cdk-toolkit.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ // We need to mock the chokidar library, used by 'cdk watch' const mockChokidarWatcherOn = jest.fn(); const fakeChokidarWatcher = { diff --git a/packages/aws-cdk/test/commands/context-command.test.ts b/packages/aws-cdk/test/commands/context-command.test.ts index 3da5b2b9b7065..542da7dce863f 100644 --- a/packages/aws-cdk/test/commands/context-command.test.ts +++ b/packages/aws-cdk/test/commands/context-command.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { realHandler } from '../../lib/commands/context'; import { Configuration, Settings, Context } from '../../lib/settings'; diff --git a/packages/aws-cdk/test/context-providers/amis.test.ts b/packages/aws-cdk/test/context-providers/amis.test.ts index a3cdf4a49c65c..70018ed8eaf84 100644 --- a/packages/aws-cdk/test/context-providers/amis.test.ts +++ b/packages/aws-cdk/test/context-providers/amis.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as aws from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; import { AmiContextProviderPlugin } from '../../lib/context-providers/ami'; diff --git a/packages/aws-cdk/test/context-providers/asymmetric-vpcs.test.ts b/packages/aws-cdk/test/context-providers/asymmetric-vpcs.test.ts index 2056e44b724a9..7d572685f0343 100644 --- a/packages/aws-cdk/test/context-providers/asymmetric-vpcs.test.ts +++ b/packages/aws-cdk/test/context-providers/asymmetric-vpcs.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as aws from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; import { VpcNetworkContextProviderPlugin } from '../../lib/context-providers/vpcs'; diff --git a/packages/aws-cdk/test/context-providers/generic.test.ts b/packages/aws-cdk/test/context-providers/generic.test.ts index 58a084598bf75..07bfe967a635e 100644 --- a/packages/aws-cdk/test/context-providers/generic.test.ts +++ b/packages/aws-cdk/test/context-providers/generic.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { PluginHost } from '../../lib/api/plugin'; import * as contextproviders from '../../lib/context-providers'; import { Context, TRANSIENT_CONTEXT_KEY } from '../../lib/settings'; diff --git a/packages/aws-cdk/test/context-providers/keys.test.ts b/packages/aws-cdk/test/context-providers/keys.test.ts index bed1d1fa8f02c..cb6dbe77f2097 100644 --- a/packages/aws-cdk/test/context-providers/keys.test.ts +++ b/packages/aws-cdk/test/context-providers/keys.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as aws from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; import { KeyContextProviderPlugin } from '../../lib/context-providers/keys'; diff --git a/packages/aws-cdk/test/context-providers/load-balancers.test.ts b/packages/aws-cdk/test/context-providers/load-balancers.test.ts index 3546555f9d8f3..a6a3a61b50264 100644 --- a/packages/aws-cdk/test/context-providers/load-balancers.test.ts +++ b/packages/aws-cdk/test/context-providers/load-balancers.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxschema from '@aws-cdk/cloud-assembly-schema'; import * as aws from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; diff --git a/packages/aws-cdk/test/context-providers/security-groups.test.ts b/packages/aws-cdk/test/context-providers/security-groups.test.ts index 2d64961af7fe4..c7bdc586ad7bc 100644 --- a/packages/aws-cdk/test/context-providers/security-groups.test.ts +++ b/packages/aws-cdk/test/context-providers/security-groups.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as aws from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; import { hasAllTrafficEgress, SecurityGroupContextProviderPlugin } from '../../lib/context-providers/security-groups'; diff --git a/packages/aws-cdk/test/context-providers/vpcs.test.ts b/packages/aws-cdk/test/context-providers/vpcs.test.ts index 0b03aaf4cacd9..57e9843690259 100644 --- a/packages/aws-cdk/test/context-providers/vpcs.test.ts +++ b/packages/aws-cdk/test/context-providers/vpcs.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as aws from 'aws-sdk'; import * as AWS from 'aws-sdk-mock'; import { VpcNetworkContextProviderPlugin } from '../../lib/context-providers/vpcs'; diff --git a/packages/aws-cdk/test/context.test.ts b/packages/aws-cdk/test/context.test.ts index ac84fdb49a309..a882c2266d658 100644 --- a/packages/aws-cdk/test/context.test.ts +++ b/packages/aws-cdk/test/context.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as os from 'os'; import * as path from 'path'; import * as fs from 'fs-extra'; diff --git a/packages/aws-cdk/test/deploy.test.ts b/packages/aws-cdk/test/deploy.test.ts index a6121d7f5d1a5..a161867b8db48 100644 --- a/packages/aws-cdk/test/deploy.test.ts +++ b/packages/aws-cdk/test/deploy.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxapi from '@aws-cdk/cx-api'; import { deployStacks } from '../lib/deploy'; diff --git a/packages/aws-cdk/test/diff.test.ts b/packages/aws-cdk/test/diff.test.ts index 3331c56afdc61..c93d91dd85aef 100644 --- a/packages/aws-cdk/test/diff.test.ts +++ b/packages/aws-cdk/test/diff.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Writable } from 'stream'; import { StringDecoder } from 'string_decoder'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; diff --git a/packages/aws-cdk/test/import.test.ts b/packages/aws-cdk/test/import.test.ts index 9bbbc7b98a24f..19d97ed38285d 100644 --- a/packages/aws-cdk/test/import.test.ts +++ b/packages/aws-cdk/test/import.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ jest.mock('promptly', () => { return { ...jest.requireActual('promptly'), diff --git a/packages/aws-cdk/test/init.test.ts b/packages/aws-cdk/test/init.test.ts index 4ecdc53789530..632c579fca329 100644 --- a/packages/aws-cdk/test/init.test.ts +++ b/packages/aws-cdk/test/init.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as os from 'os'; import * as path from 'path'; import * as cxapi from '@aws-cdk/cx-api'; diff --git a/packages/aws-cdk/test/notices.test.ts b/packages/aws-cdk/test/notices.test.ts index 25eb0538314e7..f95605a710cdb 100644 --- a/packages/aws-cdk/test/notices.test.ts +++ b/packages/aws-cdk/test/notices.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as https from 'https'; import * as os from 'os'; import * as path from 'path'; diff --git a/packages/aws-cdk/test/platform-warnings.test.ts b/packages/aws-cdk/test/platform-warnings.test.ts index f2199c2dc7e11..8fbf9e5815228 100644 --- a/packages/aws-cdk/test/platform-warnings.test.ts +++ b/packages/aws-cdk/test/platform-warnings.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { isVersionBetween } from '../lib/platform-warnings'; diff --git a/packages/aws-cdk/test/rwlock.test.ts b/packages/aws-cdk/test/rwlock.test.ts index d241eaaf96844..a376c71e9b999 100644 --- a/packages/aws-cdk/test/rwlock.test.ts +++ b/packages/aws-cdk/test/rwlock.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as os from 'os'; import * as path from 'path'; import { RWLock } from '../lib/api/util/rwlock'; diff --git a/packages/aws-cdk/test/serialize.test.ts b/packages/aws-cdk/test/serialize.test.ts index 1a1ebd8ced4d9..c30e3caec2715 100644 --- a/packages/aws-cdk/test/serialize.test.ts +++ b/packages/aws-cdk/test/serialize.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { toYAML } from '../lib/serialize'; describe(toYAML, () => { diff --git a/packages/aws-cdk/test/settings.test.ts b/packages/aws-cdk/test/settings.test.ts index 3e0c6e49586ac..0738febc435c0 100644 --- a/packages/aws-cdk/test/settings.test.ts +++ b/packages/aws-cdk/test/settings.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { Command, Context, Settings } from '../lib/settings'; test('can delete values from Context object', () => { diff --git a/packages/aws-cdk/test/tree.test.ts b/packages/aws-cdk/test/tree.test.ts index 0feb5725c21df..e6e92579f2282 100644 --- a/packages/aws-cdk/test/tree.test.ts +++ b/packages/aws-cdk/test/tree.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as path from 'path'; import { ConstructTreeNode, loadTreeFromDir, some } from '../lib/tree'; @@ -10,7 +11,7 @@ describe('some', () => { id: 'Tree', path: 'Tree', constructInfo: { - fqn: '@aws-cdk/core.Construct', + fqn: 'aws-cdk-lib.Construct', version: '1.162.0', }, }, @@ -48,7 +49,7 @@ describe('some', () => { id: 'Default', path: 'stack/CDKMetadata/Default', constructInfo: { - fqn: '@aws-cdk/core.CfnResource', + fqn: 'aws-cdk-lib.CfnResource', version: '1.162.0', }, }, @@ -56,25 +57,25 @@ describe('some', () => { id: 'Condition', path: 'stack/CDKMetadata/Condition', constructInfo: { - fqn: '@aws-cdk/core.CfnCondition', + fqn: 'aws-cdk-lib.CfnCondition', version: '1.162.0', }, }, }, constructInfo: { - fqn: '@aws-cdk/core.Construct', + fqn: 'aws-cdk-lib.Construct', version: '1.162.0', }, }, }, constructInfo: { - fqn: '@aws-cdk/core.Stack', + fqn: 'aws-cdk-lib.Stack', version: '1.162.0', }, }, }, constructInfo: { - fqn: '@aws-cdk/core.App', + fqn: 'aws-cdk-lib.App', version: '1.162.0', }, }; @@ -92,7 +93,7 @@ describe('some', () => { id: 'App', path: '', constructInfo: { - fqn: '@aws-cdk/core.App', + fqn: 'aws-cdk-lib.App', version: '1.162.0', }, }; diff --git a/packages/aws-cdk/test/usersettings.test.ts b/packages/aws-cdk/test/usersettings.test.ts index b8b324c3ccd0a..ce14677a6e83f 100644 --- a/packages/aws-cdk/test/usersettings.test.ts +++ b/packages/aws-cdk/test/usersettings.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as os from 'os'; import * as fs_path from 'path'; import * as fs from 'fs-extra'; diff --git a/packages/aws-cdk/test/util.ts b/packages/aws-cdk/test/util.ts index de2a82323efe6..32e49f4512f71 100644 --- a/packages/aws-cdk/test/util.ts +++ b/packages/aws-cdk/test/util.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as fs from 'fs'; import * as path from 'path'; import * as cxschema from '@aws-cdk/cloud-assembly-schema'; @@ -146,7 +147,7 @@ export function testAssembly(assembly: TestAssembly): cxapi.CloudAssembly { * to how they are stored on disk (upper cased). In real synthesis this is done * by a special tags formatter. * - * @see @aws-cdk/core/lib/stack.ts + * @see aws-cdk-lib/lib/stack.ts */ function patchStackTags(metadata: { [path: string]: cxschema.MetadataEntry[] }): { [path: string]: cxschema.MetadataEntry[] } { diff --git a/packages/aws-cdk/test/util/applydefaults.test.ts b/packages/aws-cdk/test/util/applydefaults.test.ts index d7d301f1dbeca..925adf753a09f 100644 --- a/packages/aws-cdk/test/util/applydefaults.test.ts +++ b/packages/aws-cdk/test/util/applydefaults.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { applyDefaults } from '../../lib/util'; test('applyDefaults() works', () => { diff --git a/packages/aws-cdk/test/util/arrays.test.ts b/packages/aws-cdk/test/util/arrays.test.ts index 65695997f9f4d..b9d09c2b1c5e3 100644 --- a/packages/aws-cdk/test/util/arrays.test.ts +++ b/packages/aws-cdk/test/util/arrays.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { flatMap, flatten, partition } from '../../lib/util'; test('flatten combines arrays', () => { diff --git a/packages/aws-cdk/test/util/awscli-compatible.test.ts b/packages/aws-cdk/test/util/awscli-compatible.test.ts index cc9ebf5e020ac..3970cc9d9181b 100644 --- a/packages/aws-cdk/test/util/awscli-compatible.test.ts +++ b/packages/aws-cdk/test/util/awscli-compatible.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as AWS from 'aws-sdk'; import { AwsCliCompatible } from '../../lib/api/aws-auth/awscli-compatible'; import { withMockedClassSingleton } from '../util'; diff --git a/packages/aws-cdk/test/util/cloudformation.test.ts b/packages/aws-cdk/test/util/cloudformation.test.ts index eee77976bdadd..81aab7eb93549 100644 --- a/packages/aws-cdk/test/util/cloudformation.test.ts +++ b/packages/aws-cdk/test/util/cloudformation.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { SSMPARAM_NO_INVALIDATE } from '@aws-cdk/cx-api'; import { MockedObject, MockSdkProvider, SyncHandlerSubsetOf } from './mock-sdk'; import { CloudFormationStack, TemplateParameters } from '../../lib/api/util/cloudformation'; diff --git a/packages/aws-cdk/test/util/console-formatters.test.ts b/packages/aws-cdk/test/util/console-formatters.test.ts index 738a7fee283f6..b4b9457a43f13 100644 --- a/packages/aws-cdk/test/util/console-formatters.test.ts +++ b/packages/aws-cdk/test/util/console-formatters.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as chalk from 'chalk'; import { formatAsBanner } from '../../lib/util/console-formatters'; diff --git a/packages/aws-cdk/test/util/mock-child_process.ts b/packages/aws-cdk/test/util/mock-child_process.ts index d7645b4c2ce1a..641d652ab2554 100644 --- a/packages/aws-cdk/test/util/mock-child_process.ts +++ b/packages/aws-cdk/test/util/mock-child_process.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as child_process from 'child_process'; import * as events from 'events'; diff --git a/packages/aws-cdk/test/util/mock-sdk.ts b/packages/aws-cdk/test/util/mock-sdk.ts index 7a16fda09b132..6ce37d295a0f8 100644 --- a/packages/aws-cdk/test/util/mock-sdk.ts +++ b/packages/aws-cdk/test/util/mock-sdk.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as cxapi from '@aws-cdk/cx-api'; import * as AWS from 'aws-sdk'; import { Account, ISDK, SDK, SdkProvider, SdkForEnvironment } from '../../lib/api/aws-auth'; diff --git a/packages/aws-cdk/test/util/mock-toolkitinfo.ts b/packages/aws-cdk/test/util/mock-toolkitinfo.ts index e46054e5a5d4a..b848304148a08 100644 --- a/packages/aws-cdk/test/util/mock-toolkitinfo.ts +++ b/packages/aws-cdk/test/util/mock-toolkitinfo.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { ISDK, ToolkitInfo, DEFAULT_BOOTSTRAP_VARIANT } from '../../lib/api'; import { CloudFormationStack } from '../../lib/api/util/cloudformation'; diff --git a/packages/aws-cdk/test/util/objects.test.ts b/packages/aws-cdk/test/util/objects.test.ts index ef9b23d2e4aed..7d3036caf5992 100644 --- a/packages/aws-cdk/test/util/objects.test.ts +++ b/packages/aws-cdk/test/util/objects.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as fc from 'fast-check'; import { deepClone, deepGet, deepMerge, deepSet, splitBySize } from '../../lib/util'; diff --git a/packages/aws-cdk/test/util/stack-monitor.test.ts b/packages/aws-cdk/test/util/stack-monitor.test.ts index 5925e00e34f60..26d9beeff806c 100644 --- a/packages/aws-cdk/test/util/stack-monitor.test.ts +++ b/packages/aws-cdk/test/util/stack-monitor.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { MockSdk } from './mock-sdk'; import { StackActivityMonitor, IActivityPrinter, StackActivity } from '../../lib/api/util/cloudformation/stack-activity-monitor'; import { sleep } from '../util'; diff --git a/packages/aws-cdk/test/util/validate-notification-arn.test.ts b/packages/aws-cdk/test/util/validate-notification-arn.test.ts index 75e7d1a857d6a..d418546eda923 100644 --- a/packages/aws-cdk/test/util/validate-notification-arn.test.ts +++ b/packages/aws-cdk/test/util/validate-notification-arn.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { validateSnsTopicArn } from '../../lib/util/validate-notification-arn'; describe('validate sns arns', () => { diff --git a/packages/aws-cdk/test/util/version-range.test.ts b/packages/aws-cdk/test/util/version-range.test.ts index 9057edbcc2699..1be467df23d8c 100644 --- a/packages/aws-cdk/test/util/version-range.test.ts +++ b/packages/aws-cdk/test/util/version-range.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { rangeFromSemver } from '../../lib/util/version-range'; describe('rangeFromSemver', () => { diff --git a/packages/aws-cdk/test/version.test.ts b/packages/aws-cdk/test/version.test.ts index 8dcf220f74632..b743d0e8ed347 100644 --- a/packages/aws-cdk/test/version.test.ts +++ b/packages/aws-cdk/test/version.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import * as path from 'path'; import { setTimeout as _setTimeout } from 'timers'; import { promisify } from 'util'; diff --git a/packages/aws-cdk/test/yaml.test.ts b/packages/aws-cdk/test/yaml.test.ts index e953e70758e63..f7cfc8fd7586f 100644 --- a/packages/aws-cdk/test/yaml.test.ts +++ b/packages/aws-cdk/test/yaml.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable import/order */ import { deserializeStructure, toYAML } from '../lib/serialize'; // Preferred quote of the YAML library diff --git a/packages/aws-cdk/tsconfig.json b/packages/aws-cdk/tsconfig.json index cff3bb8ec0b83..8a4b0569d9fd7 100644 --- a/packages/aws-cdk/tsconfig.json +++ b/packages/aws-cdk/tsconfig.json @@ -27,21 +27,9 @@ "test/integ/cli/sam_cdk_integ_app/**/*" ], "references": [ - { - "path": "../@aws-cdk/cloud-assembly-schema" - }, { "path": "../@aws-cdk/cloudformation-diff" }, - { - "path": "../@aws-cdk/core" - }, - { - "path": "../@aws-cdk/cx-api" - }, - { - "path": "../@aws-cdk/region-info" - }, { "path": "../cdk-assets" }, diff --git a/packages/cdk-dasm/.gitignore b/packages/cdk-dasm/.gitignore deleted file mode 100644 index 871afacdb4bbf..0000000000000 --- a/packages/cdk-dasm/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.js -*.d.ts -!deps.js -test/fixture/.jsii -cdk.schema.json -!jest.config.js \ No newline at end of file diff --git a/packages/cdk-dasm/.npmignore b/packages/cdk-dasm/.npmignore deleted file mode 100644 index 4974bc8dffa66..0000000000000 --- a/packages/cdk-dasm/.npmignore +++ /dev/null @@ -1,21 +0,0 @@ -# The basics -*.ts -*.tgz -*.snk -!*.d.ts -!*.js - -# Coverage -coverage -.nyc_output -.nycrc - -# Build gear -dist -.LAST_BUILD -.LAST_PACKAGE -.jsii - -# Include .jsii -!.jsii -*.tsbuildinfo diff --git a/packages/cdk-dasm/README.md b/packages/cdk-dasm/README.md deleted file mode 100644 index db806ea07bbc8..0000000000000 --- a/packages/cdk-dasm/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# CDK CloudFormation Disassembler - -[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges) - ----- - -## __WIP__ - this module is still not fully functional: - -- [ ] Does not handle intrinsic functions -- [ ] Only handles the "Resources" section (parameters, outputs, mappings, - conditions, ...) -- [ ] Keys in JSON blobs (such as IAM policies) are converted to camel case - (instead of remain as pascal case). -- [ ] Only TypeScript is supported - ------ - -Converts an AWS CloudFormation template into AWS CDK code which synthesizes the -same exact template. - -## Why you should not use this tool? - -Generally, this is not a recommended approach when using the AWS CDK, but some -people may find this useful as a means to get started or migrate an existing -template. - -Using this method means that you will have to use the low-level resources (e.g. -`s3.CfnBucket` instead of `s3.Bucket`). This means that you lose a substantial -portion of the value of the CDK, which abstracts away much of the boilerplate -and glue logic required to work with AWS resources. - -For example, this is how you would define an S3 bucket encrypted with a KMS key -with high-level resources: - -```ts -new s3.Bucket(this, 'MyBucket', { - encryption: s3.BucketEncryption.Kms -}); -``` - -And this is how the same exact configuration will be defined using low-level -resources: - -```ts -new kms.CfnKey(this, 'MyBucketKeyC17130CF', { - keyPolicy: { - "statement": [ - { - "action": [ "kms:Create*", "kms:Describe*", "kms:Enable*", "kms:List*", "kms:Put*", "kms:Update*", "kms:Revoke*", "kms:Disable*", "kms:Get*", "kms:Delete*", "kms:ScheduleKeyDeletion", "kms:CancelKeyDeletion" ], - "effect": "Allow", - "principal": { - "aws": { "Fn::Join": [ "", [ "arn:", { "Ref": "AWS::Partition" }, ":iam::", { "Ref": "AWS::AccountId" }, ":root" ] ] } - }, - "resource": "*" - } - ], - "version": "2012-10-17" - } -}); - -new s3.CfnBucket(this, 'MyBucketF68F3FF0', { - bucketEncryption: { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "kmsMasterKeyId": Fn.getAtt('MyBucketKeyC17130CF', 'Arn').toString(), - "sseAlgorithm": "aws:kms" - } - } - ] - }, -}); -``` -As you can see, there are a lot of details here that you really don't want to -care about (like the value to put under `sseAlgorithm` or which actions are -required in the key policy so the key can be managed by administrators. Also, -this is actually one of the more simple examples we have in the CDK. - -The AWS Construct Library includes a very large amount of "undifferentiated -heavy lifting" that you can only enjoy if you use the high level resources which -encapsulate all this goodness for you behind a nice clean object-oriented API. - -Therefore, we encourage you to use the high-level constructs in the AWS -Construct Library as much as possible. If you encounter a gap or missing -capability or resource, take a look at the [Escape -Hatches](https://docs.aws.amazon.com/CDK/latest/userguide/cfn_layer.html) -section of the User Guide. - -## Usage - -```console -$ cdk-dasm < my-stack-template.json > my-stack.ts -``` - -For example, given: - -```json -{ - "Resources": { - "MyTopic": { - "Type": "AWS::SNS::Topic", - "Properties": { - "DisplayName": "YoTopic" - } - } - } -} -``` - -The output will be: - -```ts -// generated by cdk-dasm at 2019-08-07T02:52:01.561Z - -import { Stack, StackProps, Fn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import * as sns from '@aws-cdk/aws-sns'; - -export class MyStack extends Stack { - constructor(scope: Construct, id: string, props: StackProps = {}) { - super(scope, id, props); - new sns.CfnTopic(this, 'MyTopic', { - displayName: "YoTopic", - }); - } -} -``` \ No newline at end of file diff --git a/packages/cdk-dasm/bin/cdk-dasm b/packages/cdk-dasm/bin/cdk-dasm deleted file mode 100755 index 01f5d76dbdc6d..0000000000000 --- a/packages/cdk-dasm/bin/cdk-dasm +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./cdk-dasm.js'); \ No newline at end of file diff --git a/packages/cdk-dasm/bin/cdk-dasm.ts b/packages/cdk-dasm/bin/cdk-dasm.ts deleted file mode 100644 index 7835ebe6f8434..0000000000000 --- a/packages/cdk-dasm/bin/cdk-dasm.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as YAML from 'yaml'; -import { dasmTypeScript } from '../lib'; - -let s = ''; -process.stdin.resume(); -process.stdin.on('data', data => { - s += data.toString('utf-8'); -}); - -process.stdin.on('end', () => { - dasmTypeScript(YAML.parse(s)).then(out => { - process.stdout.write(out); - }); -}); diff --git a/packages/cdk-dasm/jest.config.js b/packages/cdk-dasm/jest.config.js deleted file mode 100644 index 31ffb09bc460e..0000000000000 --- a/packages/cdk-dasm/jest.config.js +++ /dev/null @@ -1,180 +0,0 @@ -// For a detailed explanation regarding each configuration property, visit: -// https://jestjs.io/docs/en/configuration.html - -module.exports = { - // All imported modules in your tests should be mocked automatically - // automock: false, - - // Stop running tests after `n` failures - // bail: 0, - - // Respect "browser" field in package.json when resolving modules - // browser: false, - - // The directory where Jest should store its cached dependency information - // cacheDirectory: "/private/var/folders/n2/6v4_tbz97ws0h4bn5gbyvzb0m8vcjb/T/jest_b92skr", - - // Automatically clear mock calls and instances between every test - // clearMocks: false, - - // Indicates whether the coverage information should be collected while executing the test - // collectCoverage: false, - - // An array of glob patterns indicating a set of files for which coverage information should be collected - // collectCoverageFrom: null, - - // The directory where Jest should output its coverage files - coverageDirectory: "coverage", - - // An array of regexp pattern strings used to skip coverage collection - // coveragePathIgnorePatterns: [ - // "/node_modules/" - // ], - - // A list of reporter names that Jest uses when writing coverage reports - // coverageReporters: [ - // "json", - // "text", - // "lcov", - // "clover" - // ], - - // An object that configures minimum threshold enforcement for coverage results - // coverageThreshold: null, - - // A path to a custom dependency extractor - // dependencyExtractor: null, - - // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, - - // Force coverage collection from ignored files using an array of glob patterns - // forceCoverageMatch: [], - - // A path to a module which exports an async function that is triggered once before all test suites - // globalSetup: null, - - // A path to a module which exports an async function that is triggered once after all test suites - // globalTeardown: null, - - // A set of global variables that need to be available in all test environments - // globals: {}, - - // An array of directory names to be searched recursively up from the requiring module's location - // moduleDirectories: [ - // "node_modules" - // ], - - // An array of file extensions your modules use - moduleFileExtensions: [ - "js" - ], - - // A map from regular expressions to module names that allow to stub out resources with a single module - // moduleNameMapper: {}, - - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader - // modulePathIgnorePatterns: [], - - // Activates notifications for test results - // notify: false, - - // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: "failure-change", - - // A preset that is used as a base for Jest's configuration - // preset: null, - - // Run tests from one or more projects - // projects: null, - - // Use this configuration option to add custom reporters to Jest - // reporters: undefined, - - // Automatically reset mock state between every test - // resetMocks: false, - - // Reset the module registry before running each individual test - // resetModules: false, - - // A path to a custom resolver - // resolver: null, - - // Automatically restore mock state between every test - // restoreMocks: false, - - // The root directory that Jest should scan for tests and modules within - // rootDir: null, - - // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], - - // Allows you to use a custom runner instead of Jest's default test runner - // runner: "jest-runner", - - // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], - - // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], - - // A list of paths to snapshot serializer modules Jest should use for snapshot testing - // snapshotSerializers: [], - - // The test environment that will be used for testing - testEnvironment: "node", - - // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, - - // Adds a location field to test results - // testLocationInResults: false, - - // The glob patterns Jest uses to detect test files - // testMatch: [ - // "**/__tests__/**/*.[jt]s?(x)", - // "**/?(*.)+(spec|test).[tj]s?(x)" - // ], - - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "/node_modules/" - // ], - - // The regexp pattern or array of patterns that Jest uses to detect test files - // testRegex: [], - - // This option allows the use of a custom results processor - // testResultsProcessor: null, - - // This option allows use of a custom test runner - // testRunner: "jasmine2", - - // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href - // testURL: "http://localhost", - - // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" - // timers: "real", - - // A map from regular expressions to paths to transformers - // transform: null, - - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - // transformIgnorePatterns: [ - // "/node_modules/" - // ], - - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them - // unmockedModulePathPatterns: undefined, - - // Indicates whether each individual test should be reported during the run - // verbose: null, - - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode - // watchPathIgnorePatterns: [], - - // Whether to use watchman for file crawling - // watchman: true, -}; diff --git a/packages/cdk-dasm/lib/dasm.ts b/packages/cdk-dasm/lib/dasm.ts deleted file mode 100644 index a34d8fd57cf75..0000000000000 --- a/packages/cdk-dasm/lib/dasm.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { CodeMaker, toCamelCase } from 'codemaker'; -import * as fs from 'fs'; -import * as os from 'os'; -import * as path from 'path'; -import { promisify } from 'util'; - -const mkdtemp = promisify(fs.mkdtemp); -const readFile = promisify(fs.readFile); - -interface ConstructDefinition { - namespace: string; - className: string; - id: string; - props: { [key: string]: any }; -} - -export interface DisassemblerOptions { - /** - * Include a timestamp in the generated output. - * - * @default true - */ - readonly timestamp?: boolean; -} - -export async function dasmTypeScript(template: Template, options: DisassemblerOptions = {}) { - const definitions = new Array(); - - for (const [ id, resource ] of Object.entries(template.Resources || {})) { - const type = resource.Type; - const props = resource.Properties || {}; - - definitions.push({ - id, - ...toCfnClassName(type), - props: capitalizeKeys(props) - }); - } - - const code = new CodeMaker(); - - const outFile = 'out.ts'; - - code.openFile(outFile); - - const timestamp = options.timestamp !== undefined ? options.timestamp : true; - const suffix = timestamp ? `at ${new Date().toISOString()}` : ''; - - code.line(`// generated by cdk-dasm ${suffix}`); - code.line(); - - // - // imports - // - - code.line(`import { Stack, StackProps, Fn } from '@aws-cdk/core';`); - code.line(`import { Construct } from 'constructs';`); - - for (const ns of getUniqueNamespaces(definitions)) { - const importName = `@aws-cdk/aws-${ns}`; - code.line(`import ${ns} = require('${importName}');`); - } - - code.line(); - - // - // stack - // - - code.openBlock(`export class MyStack extends Stack`); - code.openBlock(`constructor(scope: Construct, id: string, props: StackProps = {})`); - code.line(`super(scope, id, props);`); - - for (const def of definitions) { - - // no props - if (Object.keys(def.props).length === 0) { - code.line(`new ${def.className}(this, '${def.id}');`); - continue; - } - - code.indent(`new ${def.className}(this, '${def.id}', {`); - - for (const [key, value] of Object.entries(def.props)) { - const json = JSON.stringify(value, undefined, 2); - const [ first, ...rest ] = json.split('\n'); - - if (rest.length === 0) { - code.line(`${key}: ${first},`); // single line - } else { - code.line(`${key}: ${first}`); - rest.forEach((r, i) => { - code.line(r + ((i === rest.length - 1) ? ',' : '')); - }); - } - } - - code.unindent('});'); - } - - code.closeBlock(); - - code.closeBlock(' // MyStack'); - - code.closeFile(outFile); - - const workdir = await mkdtemp(path.join(os.tmpdir(), 'cdk-dasm-typescript')); - await code.save(workdir); - - return (await readFile(path.join(workdir, outFile))).toString(); -} - -function capitalizeKeys(x: any): any { - if (typeof(x) === 'function') { - throw new Error(`function?`); - } - - if (Array.isArray(x)) { - return x.map(i => capitalizeKeys(i)); - } - - if (typeof(x) === 'object') { - const ret: { [key: string]: any } = {}; - for (const [ key, value ] of Object.entries(x)) { - let newKey; - if (key === 'Ref' || key.startsWith('Fn::')) { - newKey = key; - } else { - newKey = toCamelCase(key); - } - - ret[newKey] = capitalizeKeys(value); - } - return ret; - } - - // primitive - return x; -} - -function toCfnClassName(resourceType: string) { - const [ , namespace, type ] = resourceType.split('::'); - const className = `${namespace.toLocaleLowerCase()}.Cfn${type}`; - return { namespace: namespace.toLocaleLowerCase(), className }; -} - -function getUniqueNamespaces(definitions: Array): String[] { - return [... new Set(definitions.map(definition => definition.namespace))]; -} - -interface Template { - Resources: { [id: string]: Resource }; -} - -interface Resource { - Type: string; - Properties?: { [prop: string]: any } -} diff --git a/packages/cdk-dasm/lib/index.ts b/packages/cdk-dasm/lib/index.ts deleted file mode 100644 index c0fffbca00353..0000000000000 --- a/packages/cdk-dasm/lib/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dasm'; \ No newline at end of file diff --git a/packages/cdk-dasm/package.json b/packages/cdk-dasm/package.json deleted file mode 100644 index 49a4f6c9c20f5..0000000000000 --- a/packages/cdk-dasm/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "cdk-dasm", - "version": "0.0.0", - "private": true, - "description": "AWS CDK disassembler: convert CloudFormation to code", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "packages/cdk-dasm" - }, - "bin": { - "cdk-dasm": "bin/cdk-dasm" - }, - "scripts": { - "build": "tsc -b && chmod +x bin/cdk-dasm", - "watch": "tsc -b -w", - "test": "jest", - "package": "mkdir -p dist/js && cd dist/js && npm pack ../../", - "build+test+package": "npm run build+test && npm run package", - "build+test": "npm run build && npm test", - "build+test+extract": "npm run build+test", - "build+extract": "npm run build" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "dependencies": { - "codemaker": "1.78.1", - "yaml": "1.10.2" - }, - "devDependencies": { - "@types/jest": "^27.5.2", - "@types/yaml": "1.9.7", - "jest": "^27.5.1", - "typescript": "~4.9.5" - }, - "keywords": [ - "aws", - "cdk" - ], - "nozem": { - "ostools": [ - "chmod" - ] - }, - "homepage": "https://github.com/aws/aws-cdk", - "engines": { - "node": ">= 8.10.0" - } -} diff --git a/packages/cdk-dasm/test/__snapshots__/dasm.test.js.snap b/packages/cdk-dasm/test/__snapshots__/dasm.test.js.snap deleted file mode 100644 index 46e4e6a312ce2..0000000000000 --- a/packages/cdk-dasm/test/__snapshots__/dasm.test.js.snap +++ /dev/null @@ -1,137 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`basic test 1`] = ` -"// generated by cdk-dasm - -import { Stack, StackProps, Fn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import sns = require('@aws-cdk/aws-sns'); - -export class MyStack extends Stack { - constructor(scope: Construct, id: string, props: StackProps = {}) { - super(scope, id, props); - new sns.CfnTopic(this, 'MyTopic', { - displayName: \\"hello hello\\", - }); - } -} -" -`; - -exports[`bucket-and-key 1`] = ` -"// generated by cdk-dasm - -import { Stack, StackProps, Fn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import kms = require('@aws-cdk/aws-kms'); -import s3 = require('@aws-cdk/aws-s3'); -import cdk = require('@aws-cdk/aws-cdk'); - -export class MyStack extends Stack { - constructor(scope: Construct, id: string, props: StackProps = {}) { - super(scope, id, props); - new kms.CfnKey(this, 'MyBucketKeyC17130CF', { - keyPolicy: { - \\"statement\\": [ - { - \\"action\\": [ - \\"kms:Create*\\", - \\"kms:Describe*\\", - \\"kms:Enable*\\", - \\"kms:List*\\", - \\"kms:Put*\\", - \\"kms:Update*\\", - \\"kms:Revoke*\\", - \\"kms:Disable*\\", - \\"kms:Get*\\", - \\"kms:Delete*\\", - \\"kms:ScheduleKeyDeletion\\", - \\"kms:CancelKeyDeletion\\" - ], - \\"effect\\": \\"Allow\\", - \\"principal\\": { - \\"aws\\": { - \\"Fn::Join\\": [ - \\"\\", - [ - \\"arn:\\", - { - \\"Ref\\": \\"AWS::Partition\\" - }, - \\":iam::\\", - { - \\"Ref\\": \\"AWS::AccountId\\" - }, - \\":root\\" - ] - ] - } - }, - \\"resource\\": \\"*\\" - } - ], - \\"version\\": \\"2012-10-17\\" - }, - description: \\"Created by Pg12321Stack/MyBucket\\", - }); - new s3.CfnBucket(this, 'MyBucketF68F3FF0', { - bucketEncryption: { - \\"serverSideEncryptionConfiguration\\": [ - { - \\"serverSideEncryptionByDefault\\": { - \\"kmsMasterKeyId\\": { - \\"Fn::GetAtt\\": [ - \\"MyBucketKeyC17130CF\\", - \\"Arn\\" - ] - }, - \\"sseAlgorithm\\": \\"aws:kms\\" - } - } - ] - }, - }); - new cdk.CfnMetadata(this, 'CDKMetadata', { - modules: \\"aws-cdk=0.28.0,@aws-cdk/aws-events=0.28.0,@aws-cdk/aws-iam=0.28.0,@aws-cdk/aws-kms=0.28.0,@aws-cdk/aws-s3=0.28.0,@aws-cdk/aws-s3-notifications=0.28.0,@aws-cdk/core=0.28.0,@aws-cdk/cx-api=0.28.0,@aws-cdk/region-info=0.28.0,jsii-runtime=node.js/v10.13.0\\", - }); - } -} -" -`; - -exports[`multiple of same type 1`] = ` -"// generated by cdk-dasm - -import { Stack, StackProps, Fn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import sns = require('@aws-cdk/aws-sns'); - -export class MyStack extends Stack { - constructor(scope: Construct, id: string, props: StackProps = {}) { - super(scope, id, props); - new sns.CfnTopic(this, 'MyTopic', { - displayName: \\"hello hello\\", - }); - new sns.CfnTopic(this, 'MyTopicDos', { - displayName: \\"hello again\\", - }); - } -} -" -`; - -exports[`no props 1`] = ` -"// generated by cdk-dasm - -import { Stack, StackProps, Fn } from '@aws-cdk/core'; -import { Construct } from 'constructs'; -import s3 = require('@aws-cdk/aws-s3'); - -export class MyStack extends Stack { - constructor(scope: Construct, id: string, props: StackProps = {}) { - super(scope, id, props); - new s3.CfnBucket(this, 'Boom'); - } -} -" -`; diff --git a/packages/cdk-dasm/test/bucket-key.json b/packages/cdk-dasm/test/bucket-key.json deleted file mode 100644 index 840d9d99e137f..0000000000000 --- a/packages/cdk-dasm/test/bucket-key.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "Resources": { - "MyBucketKeyC17130CF": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "Description": "Created by Pg12321Stack/MyBucket" - }, - "DeletionPolicy": "Retain", - "UpdateReplacePolicy": "Retain", - "Metadata": { - "aws:cdk:path": "Pg12321Stack/MyBucket/Key/Resource" - } - }, - "MyBucketF68F3FF0": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "KMSMasterKeyID": { - "Fn::GetAtt": [ - "MyBucketKeyC17130CF", - "Arn" - ] - }, - "SSEAlgorithm": "aws:kms" - } - } - ] - } - }, - "DeletionPolicy": "Retain", - "UpdateReplacePolicy": "Retain", - "Metadata": { - "aws:cdk:path": "Pg12321Stack/MyBucket/Resource" - } - }, - "CDKMetadata": { - "Type": "AWS::CDK::Metadata", - "Properties": { - "Modules": "aws-cdk=0.28.0,@aws-cdk/aws-events=0.28.0,@aws-cdk/aws-iam=0.28.0,@aws-cdk/aws-kms=0.28.0,@aws-cdk/aws-s3=0.28.0,@aws-cdk/aws-s3-notifications=0.28.0,@aws-cdk/core=0.28.0,@aws-cdk/cx-api=0.28.0,@aws-cdk/region-info=0.28.0,jsii-runtime=node.js/v10.13.0" - } - } - } -} diff --git a/packages/cdk-dasm/test/dasm.test.ts b/packages/cdk-dasm/test/dasm.test.ts deleted file mode 100644 index e4c3f7d7be903..0000000000000 --- a/packages/cdk-dasm/test/dasm.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { dasmTypeScript } from '../lib'; - -test('basic test', async () => { - expect(await dasm({ - Resources: { - MyTopic: { - Type: 'AWS::SNS::Topic', - Properties: { - DisplayName: 'hello hello' - } - } - } - })).toMatchSnapshot(); -}); - -test('no props', async () => { - expect(await dasm({ - Resources: { - Boom: { - Type: 'AWS::S3::Bucket' - } - } - })).toMatchSnapshot(); -}); - -test('multiple of same type', async () => { - expect(await dasm({ - Resources: { - MyTopic: { - Type: 'AWS::SNS::Topic', - Properties: { - DisplayName: 'hello hello' - } - }, - MyTopicDos: { - Type: 'AWS::SNS::Topic', - Properties: { - DisplayName: 'hello again' - } - } - } - })).toMatchSnapshot(); -}); - -test('bucket-and-key', async () => { - expect(await dasm(require('./bucket-key.json'))).toMatchSnapshot(); -}); - -async function dasm(template: any) { - return dasmTypeScript(template, { timestamp: false }); -} \ No newline at end of file diff --git a/packages/cdk-dasm/tsconfig.json b/packages/cdk-dasm/tsconfig.json deleted file mode 100644 index 53c673ac6eba5..0000000000000 --- a/packages/cdk-dasm/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "lib": ["es2020"], - "strict": true, - "alwaysStrict": true, - "declaration": true, - "inlineSourceMap": true, - "inlineSources": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "composite": true, - "incremental": true - }, - "exclude": [ - "test/enrichments/**" - ] -} diff --git a/packages/individual-packages/.gitignore b/packages/individual-packages/.gitignore deleted file mode 100644 index 150f68c80f529..0000000000000 --- a/packages/individual-packages/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*/* diff --git a/packages/individual-packages/README.md b/packages/individual-packages/README.md deleted file mode 100644 index 8d19054a47db7..0000000000000 --- a/packages/individual-packages/README.md +++ /dev/null @@ -1,5 +0,0 @@ -In this directory we generate at build time all individual packages in V2 -that we release separately from `aws-cdk-lib` -(right now, those are the experimental and developer preview packages). - -The packages are generated by the [`individual-pkg-gen` tool](../../tools/@aws-cdk/individual-pkg-gen). diff --git a/packages/individual-packages/lerna.json b/packages/individual-packages/lerna.json deleted file mode 100644 index 739e009202549..0000000000000 --- a/packages/individual-packages/lerna.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "lerna": "^4.0.0", - "npmClient": "yarn", - "packages": [ - "*" - ], - "rejectCycles": "true", - "version": "independent" -} diff --git a/packages/individual-packages/package.json b/packages/individual-packages/package.json deleted file mode 100644 index 4922b1e2d9bee..0000000000000 --- a/packages/individual-packages/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@aws-cdk/individual-packages", - "version": "0.0.0", - "private": true, - "scripts": { - "build": "echo OK", - "test": "echo OK" - }, - "devDependencies": { - "lerna": "^4.0.0" - } -} diff --git a/scripts/align-version.js b/scripts/align-version.js index 950e7bf251d85..4376b24de71dc 100755 --- a/scripts/align-version.js +++ b/scripts/align-version.js @@ -6,29 +6,47 @@ const fs = require('fs'); const ver = require('./resolve-version'); const marker = ver.marker; -const repoVersion = ver.version; -for (const file of process.argv.splice(2)) { +const files = process.argv.splice(2); +const packageVersionMap = files.reduce((accum, file) => { + const pkg = JSON.parse(fs.readFileSync(file).toString()); + const version = pkg.stability !== 'stable' ? ver.alphaVersion : ver.version; + + return { + ...accum, + [pkg.name]: version, + }; +}, {}); + +for (const file of files) { const pkg = JSON.parse(fs.readFileSync(file).toString()); if (pkg.version !== marker) { throw new Error(`unexpected - all package.json files in this repo should have a version of ${marker}: ${file}`); } - pkg.version = repoVersion; + const version = packageVersionMap[pkg.name] + console.log(version); + pkg.version = version; processSection(pkg.dependencies || { }, file); processSection(pkg.devDependencies || { }, file); processSection(pkg.peerDependencies || { }, file); - console.error(`${file} => ${repoVersion}`); + console.error(`${file} => ${version}`); fs.writeFileSync(file, JSON.stringify(pkg, undefined, 2)); } function processSection(section, file) { for (const [ name, version ] of Object.entries(section)) { if (version === marker || version === '^' + marker) { - section[name] = version.replace(marker, repoVersion); + const version = packageVersionMap[name]; + + if (!version) { + throw new Error(`No package found ${name} within repository, which has version 0.0.0`); + } + + section[name] = version.replace(marker, version); } } } diff --git a/tools/@aws-cdk/cfn2ts/lib/augmentation-generator.ts b/tools/@aws-cdk/cfn2ts/lib/augmentation-generator.ts index ec7500f05a1dc..e993489ae43ee 100644 --- a/tools/@aws-cdk/cfn2ts/lib/augmentation-generator.ts +++ b/tools/@aws-cdk/cfn2ts/lib/augmentation-generator.ts @@ -32,11 +32,26 @@ import { SpecName } from './spec-utils'; * .prototype. = // ...impl... * ``` */ +export interface AugmentationsGeneratorOptions { + /** + * Path of cloudwatch import to use when generating augmentation source + * files. + * + * @default '@aws-cdk/aws-cloudwatch' + */ + cloudwatchImport?: string; +} + export class AugmentationGenerator { + public readonly outputFile: string; private readonly code = new CodeMaker(); - private readonly outputFile: string; - constructor(moduleName: string, private readonly spec: schema.Specification, private readonly affix: string) { + constructor( + moduleName: string, + private readonly spec: schema.Specification, + private readonly affix: string, + private readonly config?: AugmentationsGeneratorOptions, + ) { this.outputFile = `${moduleName}-augmentations.generated.ts`; this.code.openFile(this.outputFile); @@ -53,7 +68,7 @@ export class AugmentationGenerator { if (aug.metrics) { if (!importedCloudWatch) { - this.code.line("import * as cloudwatch from '@aws-cdk/aws-cloudwatch';"); + this.code.line(`import * as cloudwatch from '${this.config?.cloudwatchImport ?? '@aws-cdk/aws-cloudwatch'}';`); importedCloudWatch = true; } this.emitMetricAugmentations(resourceTypeName, aug.metrics, aug.options); diff --git a/tools/@aws-cdk/cfn2ts/lib/canned-metrics-generator.ts b/tools/@aws-cdk/cfn2ts/lib/canned-metrics-generator.ts index facb1c4aff476..93bed92b35e65 100644 --- a/tools/@aws-cdk/cfn2ts/lib/canned-metrics-generator.ts +++ b/tools/@aws-cdk/cfn2ts/lib/canned-metrics-generator.ts @@ -25,8 +25,8 @@ import { CodeMaker, toCamelCase } from 'codemaker'; * ``` */ export class CannedMetricsGenerator { + public readonly outputFile: string; private readonly code = new CodeMaker({ indentationLevel: 2 }); - private readonly outputFile: string; constructor(moduleName: string, private readonly namespace: string) { this.outputFile = `${moduleName}-canned-metrics.generated.ts`; diff --git a/tools/@aws-cdk/cfn2ts/lib/codegen.ts b/tools/@aws-cdk/cfn2ts/lib/codegen.ts index dfda055258abb..1e9a0637d3e86 100644 --- a/tools/@aws-cdk/cfn2ts/lib/codegen.ts +++ b/tools/@aws-cdk/cfn2ts/lib/codegen.ts @@ -33,6 +33,7 @@ export interface CodeGeneratorOptions { */ export default class CodeGenerator { public readonly outputFile: string; + public readonly resources: Record = {}; private code = new CodeMaker(); @@ -72,6 +73,7 @@ export default class CodeGenerator { const resourceName = genspec.CodeName.forCfnResource(cfnName, this.affix); this.code.line(); + this.resources[resourceName.specName!.fqn] = resourceName.className; this.emitResourceType(resourceName, resourceType); this.emitPropertyTypes(name, resourceName); } diff --git a/tools/@aws-cdk/cfn2ts/lib/index.ts b/tools/@aws-cdk/cfn2ts/lib/index.ts index 5763e4d746546..ee03c418a2549 100644 --- a/tools/@aws-cdk/cfn2ts/lib/index.ts +++ b/tools/@aws-cdk/cfn2ts/lib/index.ts @@ -1,14 +1,34 @@ +import * as path from 'path'; import * as cfnSpec from '@aws-cdk/cfnspec'; +import * as pkglint from '@aws-cdk/pkglint'; import * as fs from 'fs-extra'; -import { AugmentationGenerator } from './augmentation-generator'; +import { AugmentationGenerator, AugmentationsGeneratorOptions } from './augmentation-generator'; import { CannedMetricsGenerator } from './canned-metrics-generator'; import CodeGenerator, { CodeGeneratorOptions } from './codegen'; import { packageName } from './genspec'; -export default async function(scopes: string | string[], outPath: string, options: CodeGeneratorOptions = { }): Promise { +interface GenerateOutput { + outputFiles: string[]; + resources: Record; +} + +export default async function generate( + scopes: string | string[], + outPath: string, + options: CodeGeneratorOptions & AugmentationsGeneratorOptions = { }, +): Promise { + const result: GenerateOutput = { + outputFiles: [], + resources: {}, + }; + if (outPath !== '.') { await fs.mkdirp(outPath); } - if (typeof scopes === 'string') { scopes = [scopes]; } + if (scopes === '*') { + scopes = cfnSpec.namespaces(); + } else if (typeof scopes === 'string') { + scopes = [scopes]; + } for (const scope of scopes) { const spec = cfnSpec.filteredSpecification(s => s.startsWith(`${scope}::`)); @@ -21,17 +41,131 @@ export default async function(scopes: string | string[], outPath: string, option const generator = new CodeGenerator(name, spec, affix, options); generator.emitCode(); await generator.save(outPath); + result.outputFiles.push(generator.outputFile); + result.resources = { + ...result.resources, + ...generator.resources, + }; - const augs = new AugmentationGenerator(name, spec, affix); + const augs = new AugmentationGenerator(name, spec, affix, options); if (augs.emitCode()) { await augs.save(outPath); + result.outputFiles.push(augs.outputFile); } const canned = new CannedMetricsGenerator(name, scope); if (canned.generate()) { await canned.save(outPath); + result.outputFiles.push(canned.outputFile); } } + + return result; +} + +/** + * Configuration options for the generateAll function + */ +export interface GenerateAllOptions extends CodeGeneratorOptions, AugmentationsGeneratorOptions { + /** + * Path of the file containing the map of module names to their CFN Scopes + */ + scopeMapPath: string; +} + +/** + * A data structure holding information about generated modules. It maps + * module names to their full module definition and their CFN scopes. + */ +export interface ModuleMap { + [moduleName: string]: { + module?: pkglint.ModuleDefinition; + scopes: string[]; + resources: Record; + } +} + +/** + * Generates L1s for all submodules of a monomodule. Modules to generate are + * chosen based on the contents of the `scopeMapPath` file. This is intended for + * use in generated L1s in aws-cdk-lib. + * @param outPath The root directory to generate L1s in + * @param param1 Options + * @returns A ModuleMap containing the ModuleDefinition and CFN scopes for each generated module. + */ +export async function generateAll( + outPath: string, + { scopeMapPath, ...options }: GenerateAllOptions, +): Promise { + const scopes = cfnSpec.namespaces(); + const moduleMap = await readScopeMap(scopeMapPath); + + // Make sure all scopes have their own dedicated package/namespace. + // Adds new submodules for new namespaces. + for (const scope of scopes) { + const module = pkglint.createModuleDefinitionFromCfnNamespace(scope); + const currentScopes = moduleMap[module.moduleName]?.scopes ?? []; + // remove dupes + const newScopes = [...new Set([...currentScopes, scope])]; + + // Add new modules to module map and return to caller + moduleMap[module.moduleName] = { + scopes: newScopes, + module, + resources: {}, + }; + } + + await Promise.all(Object.entries(moduleMap).map( + async ([moduleName, { scopes: moduleScopes, module }]) => { + const packagePath = path.join(outPath, moduleName); + const sourcePath = path.join(packagePath, 'lib'); + + const isCore = moduleName === 'core'; + const { outputFiles, resources } = await generate(moduleScopes, sourcePath, { + ...options, + coreImport: isCore ? '.' : options.coreImport, + }); + + if (!fs.existsSync(path.join(packagePath, 'index.ts'))) { + let lines = moduleScopes.map((s: string) => `// ${s} Cloudformation Resources`); + lines.push(...outputFiles.map((f) => `export * from './lib/${f.replace('.ts', '')}'`)); + + await fs.writeFile(path.join(packagePath, 'index.ts'), lines.join('\n') + '\n'); + } + + // Create .jsiirc.json file if needed + if ( + !fs.existsSync(path.join(packagePath, '.jsiirc.json')) + && !isCore + ) { + if (!module) { + throw new Error( + `Cannot infer path or namespace for submodule named "${moduleName}". Manually create ${packagePath}/.jsiirc.json file.`, + ); + } + + const jsiirc = { + targets: { + java: { + package: module.javaPackage, + }, + dotnet: { + package: module.dotnetPackage, + }, + python: { + module: module.pythonModuleName, + }, + }, + }; + await fs.writeJson(path.join(packagePath, '.jsiirc.json'), jsiirc, { spaces: 2 }); + } + + // Add generated resources to module in map + moduleMap[moduleName].resources = resources; + })); + + return moduleMap; } /** @@ -54,3 +188,17 @@ function computeAffix(scope: string, allScopes: string[]): string { } return ''; } + +/** + * Reads the scope map from a file and transforms it into the type we need. + */ +async function readScopeMap(filepath: string) : Promise { + const scopeMap: Record = await fs.readJson(filepath); + return Object.entries(scopeMap) + .reduce((accum, [name, moduleScopes]) => { + return { + ...accum, + [name]: { scopes: moduleScopes }, + }; + }, {}); +} diff --git a/tools/@aws-cdk/cfn2ts/package.json b/tools/@aws-cdk/cfn2ts/package.json index d9e489d6b43f3..1577da1e13057 100644 --- a/tools/@aws-cdk/cfn2ts/package.json +++ b/tools/@aws-cdk/cfn2ts/package.json @@ -32,6 +32,7 @@ "license": "Apache-2.0", "dependencies": { "@aws-cdk/cfnspec": "0.0.0", + "@aws-cdk/pkglint": "0.0.0", "codemaker": "1.78.1", "fast-json-patch": "^3.1.1", "fs-extra": "^9.1.0", diff --git a/tools/@aws-cdk/individual-pkg-gen/.eslintrc.js b/tools/@aws-cdk/individual-pkg-gen/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/tools/@aws-cdk/individual-pkg-gen/.gitignore b/tools/@aws-cdk/individual-pkg-gen/.gitignore deleted file mode 100644 index acdfee7f84c04..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.js -node_modules -*.js.map -*.d.ts - -.LAST_BUILD -.nyc_output -coverage -nyc.config.js -*.snk -!.eslintrc.js - -junit.xml - -!jest.config.js \ No newline at end of file diff --git a/tools/@aws-cdk/individual-pkg-gen/.npmignore b/tools/@aws-cdk/individual-pkg-gen/.npmignore deleted file mode 100644 index c480a1570dbe3..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/.npmignore +++ /dev/null @@ -1,16 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -.LAST_BUILD -*.snk -.eslintrc.js - -# exclude cdk artifacts -**/cdk.out -junit.xml - -jest.config.js \ No newline at end of file diff --git a/tools/@aws-cdk/individual-pkg-gen/LICENSE b/tools/@aws-cdk/individual-pkg-gen/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/@aws-cdk/individual-pkg-gen/NOTICE b/tools/@aws-cdk/individual-pkg-gen/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/tools/@aws-cdk/individual-pkg-gen/README.md b/tools/@aws-cdk/individual-pkg-gen/README.md deleted file mode 100644 index a5a18e66093a6..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# `individual-pkg-gen` - -The tool contains the logic of the copying the packages we release individually, -instead of vending them inside `aws-cdk-lib`, -from their original V1 form in `packages/@aws-cdk/` to `packages/individual-packages`. -It's called from the [`transform.sh` script](../../../scripts/transform.sh). - -We do the translation in 2 phases: - -1. Copy all files from the V1 versions of the modules, - and remove all dependencies from the packages besides other experimental ones. - Save the original dependencies in a `_package.json` files of the copied modules. - This is done in the [`transform-packages.ts` file](transform-packages.ts). -2. Run `lerna bootstrap`. -3. In phase 2, bring back the dependencies by renaming the `_package.json` files to `package.json`. - This is done in the [`restore-package-jsons.ts` file](restore-package-jsons.ts). - -We have to do it this way, -because otherwise `lerna bootstrap` would fail on the main monorepo packages like `cdk-build-tools`. - -The entrypoint of the package is the [`bin/individual-pkg-gen` file](bin/individual-pkg-gen). diff --git a/tools/@aws-cdk/individual-pkg-gen/bin/individual-pkg-gen b/tools/@aws-cdk/individual-pkg-gen/bin/individual-pkg-gen deleted file mode 100755 index cb693f991e2e8..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/bin/individual-pkg-gen +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -euo pipefail -scriptdir=$(cd $(dirname $0) && pwd) - -node $scriptdir/../transform-packages.js -yarn lerna bootstrap -node $scriptdir/../restore-package-jsons.js diff --git a/tools/@aws-cdk/individual-pkg-gen/jest.config.js b/tools/@aws-cdk/individual-pkg-gen/jest.config.js deleted file mode 100644 index c4f65f19ab3d7..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/jest.config.js +++ /dev/null @@ -1,10 +0,0 @@ -const baseConfig = require('../cdk-build-tools/config/jest.config'); -module.exports = { - ...baseConfig, - coverageThreshold: { - global: { - ...baseConfig.coverageThreshold.global, - branches: 60, - }, - }, -}; diff --git a/tools/@aws-cdk/individual-pkg-gen/package.json b/tools/@aws-cdk/individual-pkg-gen/package.json deleted file mode 100644 index 3d4fb30e20215..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@aws-cdk/individual-pkg-gen", - "version": "0.0.0", - "private": true, - "description": "A tool for copying V1 packages to be released separately in V2", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "tools/@aws-cdk/individual-pkg-gen" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "build+test+package": "yarn build+test", - "build+test": "yarn build && yarn test", - "build+extract": "yarn build", - "build+test+extract": "yarn build+test" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/fs-extra": "^9.0.13", - "@types/jest": "^27.5.2" - }, - "dependencies": { - "aws-cdk-migration": "0.0.0", - "fs-extra": "^9.1.0", - "@lerna/project": "4.0.0" - }, - "keywords": [ - "aws", - "cdk" - ], - "homepage": "https://github.com/aws/aws-cdk", - "engines": { - "node": ">= 14.15.0" - }, - "ubergen": { - "exclude": true - } -} diff --git a/tools/@aws-cdk/individual-pkg-gen/restore-package-jsons.ts b/tools/@aws-cdk/individual-pkg-gen/restore-package-jsons.ts deleted file mode 100644 index bb87064cbc9da..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/restore-package-jsons.ts +++ /dev/null @@ -1,20 +0,0 @@ -import * as path from 'path'; -import * as fs from 'fs-extra'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const lerna_project = require('@lerna/project'); - -bringBackDependencies().catch(e => { - // eslint-disable-next-line no-console - console.error(e); - process.exit(1); -}); - -async function bringBackDependencies(): Promise { - const project = new lerna_project.Project(); - const separatePackages = project.getPackagesSync(); - const promises = new Array>(); - for (const separatePkg of separatePackages) { - promises.push(fs.rename(path.join(separatePkg.location, '_package.json'), separatePkg.manifestLocation)); - } - return Promise.all(promises); -} diff --git a/tools/@aws-cdk/individual-pkg-gen/test/gen.test.ts b/tools/@aws-cdk/individual-pkg-gen/test/gen.test.ts deleted file mode 100644 index c0c8b49fba246..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/test/gen.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -test('No tests are specified for this package', () => { - expect(true).toBe(true); -}); diff --git a/tools/@aws-cdk/individual-pkg-gen/transform-packages.ts b/tools/@aws-cdk/individual-pkg-gen/transform-packages.ts deleted file mode 100644 index 49b23ba45bb3b..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/transform-packages.ts +++ /dev/null @@ -1,346 +0,0 @@ -import * as path from 'path'; -import * as awsCdkMigration from 'aws-cdk-migration'; -import * as fs from 'fs-extra'; -// eslint-disable-next-line @typescript-eslint/no-require-imports -const lerna_project = require('@lerna/project'); -// eslint-disable-next-line @typescript-eslint/no-require-imports -const ver = require('../../../scripts/resolve-version'); - -const CFN_STABILITY_BANNER = `${[ - '![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)', - '', - '> All classes with the `Cfn` prefix in this module ([CFN Resources]) are always stable and safe to use.', - '>', - '> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib', -].join('\n')}\n\n`; - -const FEATURE_CFN_STABILITY_BANNER = `> **CFN Resources:** All classes with the \`Cfn\` prefix in this module ([CFN Resources]) are always -> stable and safe to use. -> -> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib\n\n\n\n`; - -const FEATURE_CFN_STABILITY_LINE = /CFN Resources\s+\| !\[Stable]\(https:\/\/img\.shields\.io\/badge\/stable-success\.svg\?style=for-the-badge\)\n/gm; - -/** - * @aws-cdk/ scoped packages that may be present in devDependencies and need to - * be retained (or else pkglint might declare the package unworthy). - */ -const REQUIRED_TOOLS = new Set([ - '@aws-cdk/cdk-build-tools', - '@aws-cdk/integ-runner', - '@aws-cdk/cfn2ts', - '@aws-cdk/eslint-plugin', - '@aws-cdk/pkglint', -]); - -transformPackages(); - -function transformPackages(): void { - // there is a lerna.json in the individual-packages directory, where this script executes - const project = new lerna_project.Project(__dirname); - const packages = project.getPackagesSync(); - const alphaPackages = getAlphaPackages(packages); - - for (const pkg of packages) { - if (!packageIsAlpha(pkg)) { - continue; - } - - const srcDir = pkg.location; - const packageUnscopedName = `${pkg.name.substring('@aws-cdk/'.length)}`; - const destDir = path.join('.', packageUnscopedName); - fs.mkdirpSync(destDir); - - copyOrTransformFiles(pkg, srcDir, destDir, [ - // list of files to _not_ copy from the V1 package root - // .gitignore is not on the list, because pkglint checks it - 'dist', - 'node_modules', - 'coverage', - '.nyc_output', - 'nyc.config.js', - '.jsii', - 'tsconfig.json', - 'tsconfig.tsbuildinfo', - ]); - } - - function copyOrTransformFiles(pkg: any, srcDir: string, destDir: string, ignoredFiles: string[]): void { - const sourceFiles = fs.readdirSync(srcDir); - for (const sourceFileName of sourceFiles) { - if (ignoredFiles.includes(sourceFileName)) { - continue; - } - - const serviceName = pkg.name.substring('@aws-cdk/aws-'.length); - if (sourceFileName.startsWith(`${serviceName}.generated`)) { - // Skip copying the generated L1 files: foo.generated.* - // Don't skip the augmentations and canned metrics: foo-augmentations.generated.*, foo-canned-metrics.generated.*, - // or any other new foo-x.generated.* format that might be introduced. - continue; - } - - const source = path.join(srcDir, sourceFileName); - const destination = path.join(destDir, sourceFileName); - - if (srcDir === pkg.location && sourceFileName === 'package.json') { - // Only transform packageJsons at the package root, not in any nested packages. - transformPackageJson(pkg, source, destination, alphaPackages); - } else if (sourceFileName === '.gitignore') { - // ignore everything, otherwise there are uncommitted files present in testing, - // because the module's .gitignore file has entries like !.eslintrc.js - const gitIgnoreContents = fs.readFileSync(source); - fs.outputFileSync(destination, Buffer.concat([gitIgnoreContents, Buffer.from('\n*\n')])); - } else if (sourceFileName === '.eslintrc.js') { - // We need to change some eslint rules - // Unstable packages are generated and it's not required for them to strictly follow our code style guide - const esLintRcLines = fs.readFileSync(source).toString().split('\n'); - const resultFileLines = []; - for (const line of esLintRcLines) { - // put our new lines right after the parserOptions.project setting line, - // as some files export a copy of this object, - // in which case putting it at the end doesn't work - resultFileLines.push(line); - if (line.startsWith('baseConfig.parserOptions.project')) { - // Add some extra whitespace before our rule changes - resultFileLines.push(''); - - // Change the default of the import/no-extraneous-dependencies rule: - // Unstable packages don't use direct dependencies, but instead a combination of devDependencies + peerDependencies - resultFileLines.push("baseConfig.rules['import/no-extraneous-dependencies'] = ['error', " + - '{ devDependencies: true, peerDependencies: true } ];'); - // Disable the import/order rule: - // Imports of the unstable packages are rewritten from an ordered source - // It's not required and therefore reasonable to ensure order after the imports are rewritten - resultFileLines.push("baseConfig.rules['import/order'] = 'off';"); - - // Add some extra whitespace at the end - resultFileLines.push(''); - } - } - fs.outputFileSync(destination, resultFileLines.join('\n')); - } else if (sourceFileName === 'index.ts') { - // Remove any exports for generated L1s, e.g.: - // export * from './apigatewayv2.generated'; - const indexLines = fs.readFileSync(source, 'utf8') - .split('\n') - .filter(line => !line.match(/export \* from '.*\.generated'/)) - .join('\n'); - fs.outputFileSync(destination, indexLines); - } else if (sourceFileName.endsWith('.ts') && !sourceFileName.endsWith('.d.ts') || sourceFileName.endsWith('.ts-fixture')) { - const sourceCode = fs.readFileSync(source).toString(); - const sourceCodeOutput = awsCdkMigration.rewriteMonoPackageImports(sourceCode, 'aws-cdk-lib', sourceFileName, { - customModules: alphaPackages, - rewriteCfnImports: true, - packageUnscopedName: `${pkg.name.substring('@aws-cdk/'.length)}`, - }); - fs.outputFileSync(destination, sourceCodeOutput); - } else if (sourceFileName === 'README.md') { - // Remove the stability banner for Cfn constructs, since they don't exist in the alpha modules - let sourceCode = fs.readFileSync(source).toString(); - [CFN_STABILITY_BANNER, FEATURE_CFN_STABILITY_BANNER, FEATURE_CFN_STABILITY_LINE].forEach(pattern => { - sourceCode = sourceCode.replace(pattern, ''); - }); - const sourceCodeOutput = awsCdkMigration.rewriteReadmeImports(sourceCode, 'aws-cdk-lib', sourceFileName, { - customModules: alphaPackages, - rewriteCfnImports: true, - packageUnscopedName: `${pkg.name.substring('@aws-cdk/'.length)}`, - }); - fs.outputFileSync(destination, sourceCodeOutput); - } else { - const stat = fs.statSync(source); - if (stat.isDirectory()) { - // we only ignore files on the top level in the package, - // as some subdirectories we do want to copy over - // (for example, synthetics contains a node_modules/ in the test/ directory - // that is needed for running the tests) - copyOrTransformFiles(pkg, source, destination, []); - } else { - fs.copySync(source, destination); - } - } - } - } -} - -function transformPackageJson(pkg: any, source: string, destination: string, alphaPackages: { [dep: string]: string; }) { - const packageJson = fs.readJsonSync(source); - const pkgUnscopedName = `${pkg.name.substring('@aws-cdk/'.length)}`; - - packageJson.name += '-alpha'; - if (ver.alphaVersion) { - packageJson.version = ver.alphaVersion; - } - packageJson.repository.directory = `packages/individual-packages/${pkgUnscopedName}`; - - // All individual packages are public by default on v1, and private by default on v2. - // We need to flip these around, so we don't publish alphas on v1, but *do* on v2. - // We also should only do this for packages we intend to publish (those with a `publishConfig`) - if (packageJson.publishConfig) { - packageJson.private = !packageJson.private; - packageJson.publishConfig.tag = 'latest'; - if (packageJson.private) { - packageJson.ubergen = { exclude: true }; - } - } - - // disable the 'cloudformation' directive since alpha modules don't contain L1 resources. - const cdkBuild = packageJson['cdk-build']; - if (cdkBuild) { - delete cdkBuild.cloudformation; - packageJson['cdk-build'] = cdkBuild; - } - - // disable `cfn2ts` script since alpha modules don't contain L1 resources. - delete packageJson.scripts.cfn2ts; - - // disable awslint (some rules are hard-coded to @aws-cdk/core) - packageJson.awslint = { - exclude: ['*:*'], - }; - - // add a pkglint exemption for the 'package name = dir name' rule - const pkglint = packageJson.pkglint || {}; - pkglint.exclude = [ - ...(pkglint.exclude || []), - 'naming/package-matches-directory', - // the experimental packages need the "real" assert dependency - 'assert/assert-dependency', - ]; - packageJson.pkglint = pkglint; - - // turn off the L1 generation, which uses @aws-cdk/ modules - if (packageJson.scripts?.gen === 'cfn2ts') { - delete packageJson.scripts.gen; - } - - // https://github.com/aws/aws-cdk/issues/15576 - const jsiiTargets = packageJson.jsii.targets; - jsiiTargets.dotnet.namespace += '.Alpha'; - jsiiTargets.dotnet.packageId += '.Alpha'; - jsiiTargets.java.package += '.alpha'; - jsiiTargets.java.maven.artifactId += '-alpha'; - jsiiTargets.python.distName += '-alpha'; - jsiiTargets.python.module += '_alpha'; - // Typically, only our top-level packages have a Go target. - // packageName has unusable chars and redundant 'aws' stripped. - // This generates names like 'awscdkfoobaralpha' (rather than 'awscdkawsfoobaralpha'). - jsiiTargets.go = { - moduleName: 'github.com/aws/aws-cdk-go', - packageName: packageJson.name.replace('/aws-', '').replace(/[^a-z0-9.]/gi, '').toLowerCase(), - }; - - const finalPackageJson = transformPackageJsonDependencies(packageJson, pkg, alphaPackages); - - fs.writeJsonSync(destination, packageJson, { spaces: 2 }); - fs.writeJsonSync(path.join(path.dirname(destination), '_package.json'), finalPackageJson, { spaces: 2 }); -} - -function transformPackageJsonDependencies(packageJson: any, pkg: any, alphaPackages: { [dep: string]: string; }) { - // regular dependencies - const alphaDependencies: { [dep: string]: string; } = {}; - const constructsAndCdkLibDevDeps: { [dep: string]: string; } = {}; - const bundledDependencies: { [dep: string]: string } = {}; - const v1BundledDependencies: string[] = packageJson.bundledDependencies || []; - for (const dependency of Object.keys(packageJson.dependencies || {})) { - // all 'regular' dependencies on alpha modules will be converted to - // a pair of devDependency on '0.0.0' and peerDependency on '^0.0.0', - // and the package will have no regular dependencies anymore - switch (dependency) { - // @core corresponds to aws-cdk-lib - case '@aws-cdk/core': - constructsAndCdkLibDevDeps['aws-cdk-lib'] = pkg.version; - break; - case 'constructs': - constructsAndCdkLibDevDeps.constructs = packageJson.dependencies.constructs; - break; - default: - if (alphaPackages[dependency]) { - alphaDependencies[alphaPackages[dependency]] = packageJson.version; - } else if (v1BundledDependencies.indexOf(dependency) !== -1) { - // ...other than third-party dependencies, which are in bundledDependencies - bundledDependencies[dependency] = packageJson.dependencies[dependency]; - } - } - } - packageJson.dependencies = bundledDependencies; - - // devDependencies - const alphaDevDependencies: { [dep: string]: string; } = {}; - const devDependencies: { [dep: string]: string; } = {}; - for (const v1DevDependency of Object.keys(packageJson.devDependencies || {})) { - switch (v1DevDependency) { - // @core corresponds to aws-cdk-lib - // this is needed for packages that only have a dev dependency on @core - case '@aws-cdk/core': - devDependencies['aws-cdk-lib'] = pkg.version; - break; - default: - if (alphaPackages[v1DevDependency]) { - alphaDevDependencies[alphaPackages[v1DevDependency]] = packageJson.version; - } else if (!v1DevDependency.startsWith('@aws-cdk/') || isRequiredTool(v1DevDependency)) { - devDependencies[v1DevDependency] = packageJson.devDependencies[v1DevDependency]; - } - } - } - const finalPackageJson = { ...packageJson }; - // we save the devDependencies in a temporary _package.json - finalPackageJson.devDependencies = { - ...devDependencies, - ...constructsAndCdkLibDevDeps, - ...alphaDevDependencies, - ...alphaDependencies, - }; - packageJson.devDependencies = { - ...alphaDevDependencies, - ...alphaDependencies, - }; - - // peer dependencies - finalPackageJson.peerDependencies = { - ...(Object.entries(alphaDependencies) - // for other alpha dependencies, we need to depend on exact versions - // (because of the braking changes between them) - .reduce((acc, [depName, depVersion]) => { - acc[depName] = depVersion; - return acc; - }, {} as { [dep: string]: string; })), - ...(Object.entries(constructsAndCdkLibDevDeps) - .reduce((acc, [depName, depVersion]) => { - acc[depName] = `${depVersion.startsWith('^') ? '' : '^'}${depVersion}`; - return acc; - }, {} as { [dep: string]: string; })), - }; - packageJson.peerDependencies = undefined; - return finalPackageJson; -} - -function getAlphaPackages(packages: any[]): { [dep: string]: string } { - return packages - .filter(packageIsAlpha) - .reduce((acc, pkg: any) => { - acc[pkg.name] = `${pkg.name}-alpha`; - return acc; - }, {}); -} - -function packageIsAlpha(pkg: any): boolean { - // allow modules to decide themselves whether they should be packaged separately - const separateModule = pkg.get('separate-module'); - if (separateModule !== undefined) { - return separateModule; - } - - const maturity = pkg.get('maturity'); - if (maturity !== 'experimental' && maturity !== 'developer-preview') { - return false; - } - // we're only interested in '@aws-cdk/' packages, - // and those that are JSII-enabled - // Also, don't re-transform already alpha-ed packages - return pkg.name.startsWith('@aws-cdk/') && !!pkg.get('jsii') && !pkg.name.endsWith('-alpha'); -} - -function isRequiredTool(name: string) { - return REQUIRED_TOOLS.has(name); -} diff --git a/tools/@aws-cdk/individual-pkg-gen/tsconfig.json b/tools/@aws-cdk/individual-pkg-gen/tsconfig.json deleted file mode 100644 index d34fdc6881bb3..0000000000000 --- a/tools/@aws-cdk/individual-pkg-gen/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "lib": ["es2020"], - "strict": true, - "alwaysStrict": true, - "declaration": true, - "inlineSourceMap": true, - "inlineSources": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "composite": true, - "incremental": true - }, - "include": ["**/*.ts"] -} diff --git a/tools/@aws-cdk/pkglint/lib/library-creation.ts b/tools/@aws-cdk/pkglint/lib/library-creation.ts index 8ebe4e8db479d..44c0a878c9615 100644 --- a/tools/@aws-cdk/pkglint/lib/library-creation.ts +++ b/tools/@aws-cdk/pkglint/lib/library-creation.ts @@ -4,6 +4,7 @@ import { cfnOnlyReadmeContents } from './readme-contents'; export interface ModuleDefinition { readonly namespace: string; readonly moduleName: string; + readonly submoduleName: string; readonly moduleFamily: string; readonly moduleBaseName: string; readonly packageName: string; @@ -20,6 +21,7 @@ export interface ModuleDefinition { export function createModuleDefinitionFromCfnNamespace(namespace: string): ModuleDefinition { const [moduleFamily, moduleBaseName] = (namespace === 'AWS::Serverless' ? 'AWS::SAM' : namespace).split('::'); const moduleName = `${moduleFamily}-${moduleBaseName}`.toLocaleLowerCase(); + const submoduleName = moduleName.replace('-', '_'); const lowcaseModuleName = moduleBaseName.toLocaleLowerCase(); const packageName = `@aws-cdk/${moduleName}`; @@ -43,6 +45,7 @@ export function createModuleDefinitionFromCfnNamespace(namespace: string): Modul return { namespace, moduleName, + submoduleName, moduleFamily, moduleBaseName, packageName, diff --git a/tools/@aws-cdk/pkglint/lib/rules.ts b/tools/@aws-cdk/pkglint/lib/rules.ts index 4684d94d9efde..730132923256e 100644 --- a/tools/@aws-cdk/pkglint/lib/rules.ts +++ b/tools/@aws-cdk/pkglint/lib/rules.ts @@ -1719,46 +1719,6 @@ export class NoExperimentalDependents extends ValidationRule { } -/* - * Enforces that the aws-cdk-lib README contains all of the core documentation from the @aws-cdk/core README - * so users of CDKv2 see all of the core documentation when viewing the aws-cdk-lib docs. - */ -export class AwsCdkLibReadmeMatchesCore extends ValidationRule { - public readonly name = 'package-info/README.md/aws-cdk-lib-and-core'; - private readonly CORE_DOC_SECTION_REGEX = /<\!--BEGIN CORE DOCUMENTATION-->[\s\S]+<\!--END CORE DOCUMENTATION-->/m; - - public validate(pkg: PackageJson): void { - if (pkg.json.name !== 'aws-cdk-lib') { return; } - - const coreReadmeFile = path.join(monoRepoRoot(), 'packages', '@aws-cdk', 'core', 'README.md'); - const readmeFile = path.join(pkg.packageRoot, 'README.md'); - - const awsCoreMatch = fs.readFileSync(coreReadmeFile, { encoding: 'utf8' }).match(this.CORE_DOC_SECTION_REGEX); - const awsCdkLibReadme = fs.readFileSync(readmeFile, { encoding: 'utf8' }); - const awsCdkLibMatch = awsCdkLibReadme.match(this.CORE_DOC_SECTION_REGEX); - - const missingSectionMsg = '@aws-cdk/core and aws-cdk-lib READMEs must include section markers () to define what content should be shared between them'; - if (!awsCoreMatch) { - pkg.report({ - ruleName: this.name, - message: missingSectionMsg, - }); - } else if (!awsCdkLibMatch) { - pkg.report({ - ruleName: this.name, - message: missingSectionMsg, - fix: () => fs.writeFileSync(readmeFile, [awsCdkLibReadme, awsCoreMatch[0]].join('\n')), - }); - } else if (awsCoreMatch[0] !== awsCdkLibMatch[0]) { - pkg.report({ - ruleName: this.name, - message: 'aws-cdk-lib README does not include a core documentation section that matches @aws-cdk/core', - fix: () => fs.writeFileSync(readmeFile, awsCdkLibMatch.input!.replace(this.CORE_DOC_SECTION_REGEX, awsCoreMatch[0])), - }); - } - } -} - /** * Enforces that the aws-cdk's package.json on the V2 branch does not have the "main" * and "types" keys filled. diff --git a/tools/@aws-cdk/pkglint/test/libary-creation.test.ts b/tools/@aws-cdk/pkglint/test/libary-creation.test.ts index 78b0a1c533070..bf7a2e03ed5ca 100644 --- a/tools/@aws-cdk/pkglint/test/libary-creation.test.ts +++ b/tools/@aws-cdk/pkglint/test/libary-creation.test.ts @@ -18,6 +18,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => { javaArtifactId: 'ec2', pythonDistName: 'aws-cdk.aws-ec2', pythonModuleName: 'aws_cdk.aws_ec2', + submoduleName: 'aws_ec2', }); }); @@ -36,6 +37,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => { javaArtifactId: 'sam', pythonDistName: 'aws-cdk.aws-sam', pythonModuleName: 'aws_cdk.aws_sam', + submoduleName: 'aws_sam', }); }); @@ -54,6 +56,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => { javaArtifactId: 'alexa-ask', pythonDistName: 'aws-cdk.alexa-ask', pythonModuleName: 'aws_cdk.alexa_ask', + submoduleName: 'alexa_ask', }); }); }); diff --git a/tools/@aws-cdk/prlint/module.ts b/tools/@aws-cdk/prlint/module.ts index 73ea9ba960464..7e0834f79497e 100644 --- a/tools/@aws-cdk/prlint/module.ts +++ b/tools/@aws-cdk/prlint/module.ts @@ -2,13 +2,20 @@ import * as fs from 'fs-extra'; import * as glob from 'glob'; import * as path from 'path'; +let awsCdkLibPath: string; const modules: string[] = []; +const awsCdkLibModules: string[] = []; export function findModulePath(fuzz: string): string { discoverModules(); const regex = new RegExp(`[-_/]${fuzz}$`) - const matched = modules.filter(m => regex.test(m)); + const matched = [ + ...modules.filter(m => regex.test(m)), + ...(awsCdkLibModules.some(m => regex.test(m)) ? [awsCdkLibPath] : []), + ]; + console.log({ matched }); + if (matched.length === 0) { throw new Error(`No module with name '${fuzz}' in the repo`); } else if (matched.length > 1) { @@ -27,19 +34,35 @@ function discoverModules() { const repoRoot = process.env.REPO_ROOT; const lernaConfig = require(path.join(repoRoot, 'lerna.json')); const searchPaths: string[] = lernaConfig.packages; + awsCdkLibPath = path.join(repoRoot, 'packages', 'aws-cdk-lib'); searchPaths.forEach(p => { const globMatches = glob.sync(path.join(repoRoot, p, 'package.json')); const trimmed = globMatches.map(m => path.dirname(m)); modules.push(...trimmed); }); + discoverAwsCdkLibModules(); - if (modules.length === 0) { + if (modules.length === 0 || awsCdkLibModules.length === 0) { throw new Error('unexpected: discovered no modules. ' + 'Check that you have set REPO_ROOT correctly.'); } } } +function discoverAwsCdkLibModules() { + if (!process.env.REPO_ROOT) { + throw new Error('env REPO_ROOT must be set'); + } + + if (awsCdkLibModules.length === 0) { + const pkgJson = fs.readJsonSync(path.join(awsCdkLibPath, 'package.json')); + Object.keys(pkgJson.exports ?? {}).forEach((exportKey) => { + const formatted = exportKey.replace('./', ''); + awsCdkLibModules.push(formatted); + }); + } +} + export function moduleStability(loc: string): 'stable' | 'experimental' | undefined { if (!fs.existsSync(path.join(loc, 'package.json'))) { throw new Error(`unexpected: no package.json found at location "${loc}"`); diff --git a/tools/@aws-cdk/prlint/parser.ts b/tools/@aws-cdk/prlint/parser.ts index 3751ef3f40abb..6358de68ff847 100644 --- a/tools/@aws-cdk/prlint/parser.ts +++ b/tools/@aws-cdk/prlint/parser.ts @@ -18,4 +18,4 @@ export function breakingModules(title: string, body: string): string[] { match && breakingModules.push(match[1]); } return breakingModules; -} \ No newline at end of file +} diff --git a/tools/@aws-cdk/prlint/test/lint.test.ts b/tools/@aws-cdk/prlint/test/lint.test.ts index 8afc6e33452fa..40094190c666a 100644 --- a/tools/@aws-cdk/prlint/test/lint.test.ts +++ b/tools/@aws-cdk/prlint/test/lint.test.ts @@ -142,8 +142,8 @@ describe('commit message format', () => { }) }); -describe('ban breaking changes in stable modules', () => { - test('breaking change in stable module', async () => { +describe.only('ban breaking changes in stable modules', () => { + test.only('breaking change in stable module', async () => { const issue = { number: 1, title: 'chore(s3): some title', diff --git a/tools/@aws-cdk/prlint/test/module.test.ts b/tools/@aws-cdk/prlint/test/module.test.ts index e732133b5ed2c..88cc3a6cabb1c 100644 --- a/tools/@aws-cdk/prlint/test/module.test.ts +++ b/tools/@aws-cdk/prlint/test/module.test.ts @@ -13,8 +13,9 @@ describe('findModulePath', () => { }); test('single fuzzy match', () => { - expect(relative(findModulePath('lambda'))).toEqual('packages/@aws-cdk/aws-lambda'); - expect(relative(findModulePath('s3'))).toEqual('packages/@aws-cdk/aws-s3'); + expect(relative(findModulePath('lambda'))).toEqual('packages/aws-cdk-lib'); + expect(relative(findModulePath('s3'))).toEqual('packages/aws-cdk-lib'); + expect(relative(findModulePath('gamelift'))).toEqual('packages/@aws-cdk/aws-gamelift'); expect(relative(findModulePath('cdk-build-tools'))).toEqual('tools/@aws-cdk/cdk-build-tools'); }); @@ -34,8 +35,7 @@ describe('findModulePath', () => { describe('moduleStability', () => { test('happy', () => { - expect(moduleStability(absolute('packages/@aws-cdk/aws-lambda'))).toEqual('stable'); - expect(moduleStability(absolute('packages/@aws-cdk/aws-s3'))).toEqual('stable'); + expect(moduleStability(absolute('packages/aws-cdk-lib'))).toEqual('stable'); // The list of experimental modules is constantly changing. Comment out the assertion. // expect(moduleStability(absolute('packages/@aws-cdk/aws-apigatewayv2'))).toEqual('experimental'); diff --git a/tools/@aws-cdk/ubergen/.eslintrc.js b/tools/@aws-cdk/ubergen/.eslintrc.js deleted file mode 100644 index 2658ee8727166..0000000000000 --- a/tools/@aws-cdk/ubergen/.eslintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('@aws-cdk/cdk-build-tools/config/eslintrc'); -baseConfig.parserOptions.project = __dirname + '/tsconfig.json'; -module.exports = baseConfig; diff --git a/tools/@aws-cdk/ubergen/.gitignore b/tools/@aws-cdk/ubergen/.gitignore deleted file mode 100644 index bbaee6515fdd0..0000000000000 --- a/tools/@aws-cdk/ubergen/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.snk -.LAST_BUILD -junit.xml -*.js -*.d.ts -!.eslintrc.js diff --git a/tools/@aws-cdk/ubergen/.npmignore b/tools/@aws-cdk/ubergen/.npmignore deleted file mode 100644 index 3ea8254615ff6..0000000000000 --- a/tools/@aws-cdk/ubergen/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -*.snk -.eslintrc.js -junit.xml -.LAST_BUILD -**/cdk.out \ No newline at end of file diff --git a/tools/@aws-cdk/ubergen/LICENSE b/tools/@aws-cdk/ubergen/LICENSE deleted file mode 100644 index 9b722c65c5481..0000000000000 --- a/tools/@aws-cdk/ubergen/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/tools/@aws-cdk/ubergen/NOTICE b/tools/@aws-cdk/ubergen/NOTICE deleted file mode 100644 index a27b7dd317649..0000000000000 --- a/tools/@aws-cdk/ubergen/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/tools/@aws-cdk/ubergen/README.md b/tools/@aws-cdk/ubergen/README.md deleted file mode 100644 index 98fbb47c7caad..0000000000000 --- a/tools/@aws-cdk/ubergen/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# ubergen - -Aggregates all individual CDK construct library modules into a single -uber package. - -This is used in the CDK to create a monolithic package that is then -published for customers to consume. diff --git a/tools/@aws-cdk/ubergen/bin/ubergen b/tools/@aws-cdk/ubergen/bin/ubergen deleted file mode 100755 index dd62f3f249e59..0000000000000 --- a/tools/@aws-cdk/ubergen/bin/ubergen +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./ubergen.js'); \ No newline at end of file diff --git a/tools/@aws-cdk/ubergen/bin/ubergen.ts b/tools/@aws-cdk/ubergen/bin/ubergen.ts deleted file mode 100644 index e9f072ea42eb7..0000000000000 --- a/tools/@aws-cdk/ubergen/bin/ubergen.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { main } from '../lib'; - -main().then( - () => process.exit(0), - (err) => { - // eslint-disable-next-line no-console - console.error('❌ An error occurred: ', err.stack); - process.exit(1); - }, -); diff --git a/tools/@aws-cdk/ubergen/lib/index.ts b/tools/@aws-cdk/ubergen/lib/index.ts deleted file mode 100644 index 3af15c3a31d64..0000000000000 --- a/tools/@aws-cdk/ubergen/lib/index.ts +++ /dev/null @@ -1,679 +0,0 @@ -import * as console from 'console'; -import * as path from 'path'; -import * as process from 'process'; -import cfn2ts from '@aws-cdk/cfn2ts'; -import * as pkglint from '@aws-cdk/pkglint'; -import * as awsCdkMigration from 'aws-cdk-migration'; -import * as fs from 'fs-extra'; - -// The directory where our 'package.json' lives -const MONOPACKAGE_ROOT = process.cwd(); - -const ROOT_PATH = findWorkspacePath(); -const UBER_PACKAGE_JSON_PATH = path.join(MONOPACKAGE_ROOT, 'package.json'); - -const EXCLUDED_PACKAGES = ['@aws-cdk/example-construct-library']; - -export async function main() { - console.log(`🌴 workspace root path is: ${ROOT_PATH}`); - const uberPackageJson = await fs.readJson(UBER_PACKAGE_JSON_PATH) as PackageJson; - const libraries = await findLibrariesToPackage(uberPackageJson); - await verifyDependencies(uberPackageJson, libraries); - await prepareSourceFiles(libraries, uberPackageJson); - await combineRosettaFixtures(libraries, uberPackageJson); - - // if explicitExports is set to `false`, remove the "exports" section from package.json - const explicitExports = uberPackageJson.ubergen?.explicitExports ?? true; - if (!explicitExports) { - delete uberPackageJson.exports; - } - - // Rewrite package.json (exports will have changed) - await fs.writeJson(UBER_PACKAGE_JSON_PATH, uberPackageJson, { spaces: 2 }); -} - -interface LibraryReference { - readonly packageJson: PackageJson; - readonly root: string; - readonly shortName: string; -} - -type Export = string | { - readonly types?: string; - readonly import?: string; - readonly require?: string; -}; - -interface PackageJson { - readonly main?: string; - readonly description?: string; - readonly bundleDependencies?: readonly string[]; - readonly bundledDependencies?: readonly string[]; - readonly dependencies?: { readonly [name: string]: string }; - readonly devDependencies?: { readonly [name: string]: string }; - readonly jsii: { - readonly targets?: { - readonly dotnet?: { - readonly namespace: string; - readonly [key: string]: unknown; - }, - readonly java?: { - readonly package: string; - readonly [key: string]: unknown; - }, - readonly python?: { - readonly module: string; - readonly [key: string]: unknown; - }, - readonly [language: string]: unknown, - }, - }; - readonly name: string; - readonly types: string; - readonly version: string; - readonly stability: string; - readonly [key: string]: unknown; - readonly 'cdk-build'?: { - readonly cloudformation: string[] | string; - }; - readonly ubergen?: { - readonly deprecatedPackages?: readonly string[]; - readonly excludeExperimentalModules?: boolean; - - /** - * The directory where we're going to collect all the libraries. - * - * @default - root of the ubergen package - */ - readonly libRoot?: string; - - /** - * Adds an `exports` section to the ubergen package.json file to ensure that - * consumers won't be able to accidentally import a private file. - * - * @default true - */ - readonly explicitExports?: boolean; - - /** - * An exports section that should be ignored for v1 but included for ubergen - */ - readonly exports?: Record; - }; - exports?: Record; -} - -/** - * Find the workspace root path. Walk up the directory tree until you find lerna.json - */ -function findWorkspacePath(): string { - - return _findRootPath(process.cwd()); - - function _findRootPath(part: string): string { - if (part === path.resolve(part, '..')) { - throw new Error('couldn\'t find a \'lerna.json\' file when walking up the directory tree, are you in a aws-cdk project?'); - } - - if (fs.existsSync(path.resolve(part, 'lerna.json'))) { - return part; - } - - return _findRootPath(path.resolve(part, '..')); - } -} - -async function findLibrariesToPackage(uberPackageJson: PackageJson): Promise { - console.log('🔍 Discovering libraries that need packaging...'); - - const deprecatedPackages = uberPackageJson.ubergen?.deprecatedPackages; - const result = new Array(); - const librariesRoot = path.resolve(ROOT_PATH, 'packages', '@aws-cdk'); - - for (const dir of await fs.readdir(librariesRoot)) { - const packageJson = await fs.readJson(path.resolve(librariesRoot, dir, 'package.json')); - - if (packageJson.ubergen?.exclude || EXCLUDED_PACKAGES.includes(packageJson.name)) { - console.log(`\t⚠️ Skipping (ubergen excluded): ${packageJson.name}`); - continue; - } else if (packageJson.jsii == null ) { - console.log(`\t⚠️ Skipping (not jsii-enabled): ${packageJson.name}`); - continue; - } else if (deprecatedPackages) { - if (deprecatedPackages.some(packageName => packageName === packageJson.name)) { - console.log(`\t⚠️ Skipping (ubergen deprecated): ${packageJson.name}`); - continue; - } - } else if (packageJson.deprecated) { - console.log(`\t⚠️ Skipping (deprecated): ${packageJson.name}`); - continue; - } - result.push({ - packageJson, - root: path.join(librariesRoot, dir), - shortName: packageJson.name.slice('@aws-cdk/'.length), - }); - } - - console.log(`\tℹ️ Found ${result.length} relevant packages!`); - - return result; -} - -async function verifyDependencies(packageJson: any, libraries: readonly LibraryReference[]): Promise { - console.log('🧐 Verifying dependencies are complete...'); - - let changed = false; - const toBundle: Record = {}; - - for (const library of libraries) { - for (const depName of library.packageJson.bundleDependencies ?? library.packageJson.bundledDependencies ?? []) { - const requiredVersion = library.packageJson.devDependencies?.[depName] - ?? library.packageJson.dependencies?.[depName] - ?? '*'; - if (toBundle[depName] != null && toBundle[depName] !== requiredVersion) { - throw new Error(`Required to bundle different versions of ${depName}: ${toBundle[depName]} and ${requiredVersion}.`); - } - toBundle[depName] = requiredVersion; - } - - if (library.packageJson.name in packageJson.devDependencies) { - const existingVersion = packageJson.devDependencies[library.packageJson.name]; - if (existingVersion !== library.packageJson.version) { - console.log(`\t⚠️ Incorrect dependency: ${library.packageJson.name} (expected ${library.packageJson.version}, found ${packageJson.devDependencies[library.packageJson.name]})`); - packageJson.devDependencies[library.packageJson.name] = library.packageJson.version; - changed = true; - } - continue; - } - console.log(`\t⚠️ Missing dependency: ${library.packageJson.name}`); - changed = true; - packageJson.devDependencies = sortObject({ - ...packageJson.devDependencies ?? {}, - [library.packageJson.name]: library.packageJson.version, - }); - } - const workspacePath = path.resolve(ROOT_PATH, 'package.json'); - const workspace = await fs.readJson(workspacePath); - let workspaceChanged = false; - - const spuriousBundledDeps = new Set(packageJson.bundledDependencies ?? []); - for (const [name, version] of Object.entries(toBundle)) { - spuriousBundledDeps.delete(name); - - const nohoist = `${packageJson.name}/${name}`; - if (!workspace.workspaces.nohoist?.includes(nohoist)) { - console.log(`\t⚠️ Missing yarn workspace nohoist: ${nohoist}`); - workspace.workspaces.nohoist = Array.from(new Set([ - ...workspace.workspaces.nohoist ?? [], - nohoist, - `${nohoist}/**`, - ])).sort(); - workspaceChanged = true; - } - - if (!(packageJson.bundledDependencies?.includes(name))) { - console.log(`\t⚠️ Missing bundled dependency: ${name} at ${version}`); - packageJson.bundledDependencies = [ - ...packageJson.bundledDependencies ?? [], - name, - ].sort(); - changed = true; - } - - if (packageJson.dependencies?.[name] !== version) { - console.log(`\t⚠️ Missing or incorrect dependency: ${name} at ${version}`); - packageJson.dependencies = sortObject({ - ...packageJson.dependencies ?? {}, - [name]: version, - }); - changed = true; - } - } - packageJson.bundledDependencies = packageJson.bundledDependencies?.filter((dep: string) => !spuriousBundledDeps.has(dep)); - for (const toRemove of Array.from(spuriousBundledDeps)) { - delete packageJson.dependencies[toRemove]; - changed = true; - } - - if (workspaceChanged) { - await fs.writeFile(workspacePath, JSON.stringify(workspace, null, 2) + '\n', { encoding: 'utf-8' }); - console.log('\t❌ Updated the yarn workspace configuration. Re-run "yarn install", and commit the changes.'); - } - - if (changed) { - await fs.writeFile(UBER_PACKAGE_JSON_PATH, JSON.stringify(packageJson, null, 2) + '\n', { encoding: 'utf8' }); - - throw new Error('Fixed dependency inconsistencies. Commit the updated package.json file.'); - } - console.log('\t✅ Dependencies are correct!'); -} - -async function prepareSourceFiles(libraries: readonly LibraryReference[], packageJson: PackageJson) { - console.log('📝 Preparing source files...'); - - if (packageJson.ubergen?.excludeExperimentalModules) { - console.log('\t 👩🏻‍🔬 \'excludeExperimentalModules\' enabled. Regenerating all experimental modules as L1s using cfn2ts...'); - } - - const libRoot = resolveLibRoot(packageJson); - - // Should not remove collection directory if we're currently in it. The OS would be unhappy. - if (libRoot !== process.cwd()) { - await fs.remove(libRoot); - } - - // Control 'exports' field of the 'package.json'. This will control what kind of 'import' statements are - // allowed for this package: we only want to allow the exact import statements that we want to support. - packageJson.exports = { - '.': { - types: './index.d.ts', - import: './index.js', - require: './lazy-index.js', - }, - - // We need to expose 'package.json' and '.jsii' because 'jsii' and 'jsii-reflect' load them using - // require(). (-_-). Can be removed after https://github.com/aws/jsii/pull/3205 gets merged. - './package.json': './package.json', - './.jsii': './.jsii', - - // This is necessary to support jsii cross-module warnings - './.warnings.jsii.js': './.warnings.jsii.js', - }; - - // We use the index.ts to compile type definitions. - // - // We build two indexes: one for eager loading (used by ESM modules), and one - // for lazy loading (used by CJS modules). The lazy loading will result in faster - // loading times, because we don't have to load and parse all submodules right away, - // but is not compatible with ESM's loading algorithm. - // - // This improves AWS CDK app performance by ~400ms. - const indexStatements = new Array(); - const lazyExports = new Array(); - - for (const library of libraries) { - const libDir = path.join(libRoot, library.shortName); - const copied = await transformPackage(library, packageJson, libDir, libraries); - - if (!copied) { - continue; - } - if (library.shortName === 'core') { - indexStatements.push(`export * from './${library.shortName}';`); - lazyExports.unshift(`export * from './${library.shortName}';`); - } else { - const exportName = library.shortName.replace(/-/g, '_'); - - indexStatements.push(`export * as ${exportName} from './${library.shortName}';`); - lazyExports.push(`Object.defineProperty(exports, '${exportName}', { get: function () { return require('./${library.shortName}'); } });`); - } - copySubmoduleExports(packageJson.exports, library, library.shortName); - } - - // make the exports.ts file pass linting - lazyExports.unshift('/* eslint-disable @typescript-eslint/no-require-imports */'); - - await fs.writeFile(path.join(libRoot, 'index.ts'), indexStatements.join('\n'), { encoding: 'utf8' }); - await fs.writeFile(path.join(libRoot, 'lazy-index.ts'), lazyExports.join('\n'), { encoding: 'utf8' }); - - console.log('\t🍺 Success!'); -} - -/** - * Copy the sublibrary's exports into the 'exports' of the main library. - * - * Replace the original 'main' export with an export of the new '/index.ts` file we've written - * in 'transformPackage'. - */ -function copySubmoduleExports(targetExports: Record, library: LibraryReference, subdirectory: string) { - const visibleName = library.shortName; - - // Do both REAL "exports" section, as well as virtual, ubergen-only "exports" section - for (const exportSet of [library.packageJson.exports, library.packageJson.ubergen?.exports]) { - for (const [relPath, relSource] of Object.entries(exportSet ?? {})) { - targetExports[`./${unixPath(path.join(visibleName, relPath))}`] = resolveExport(relSource); - } - } - - function resolveExport(exp: A): A { - if (typeof exp === 'string') { - return `./${unixPath(path.join(subdirectory, exp))}` as any; - } else { - return Object.fromEntries(Object.entries(exp).map(([k, v]) => [k, v ? resolveExport(v) : undefined])) as any; - } - } - - if (visibleName !== 'core') { - // If there was an export for '.' in the original submodule, this assignment will overwrite it, - // which is exactly what we want. - targetExports[`./${unixPath(visibleName)}`] = `./${unixPath(subdirectory)}/index.js`; - } -} - -async function combineRosettaFixtures(libraries: readonly LibraryReference[], uberPackageJson: PackageJson) { - console.log('📝 Combining Rosetta fixtures...'); - - const uberRosettaDir = path.resolve(MONOPACKAGE_ROOT, 'rosetta'); - await fs.remove(uberRosettaDir); - await fs.mkdir(uberRosettaDir); - - for (const library of libraries) { - const packageRosettaDir = path.join(library.root, 'rosetta'); - const uberRosettaTargetDir = library.shortName === 'core' ? uberRosettaDir : path.join(uberRosettaDir, library.shortName.replace(/-/g, '_')); - if (await fs.pathExists(packageRosettaDir)) { - if (!fs.existsSync(uberRosettaTargetDir)) { - await fs.mkdir(uberRosettaTargetDir); - } - const files = await fs.readdir(packageRosettaDir); - for (const file of files) { - await fs.writeFile( - path.join(uberRosettaTargetDir, file), - await rewriteRosettaFixtureImports( - path.join(packageRosettaDir, file), - uberPackageJson.name, - ), - { encoding: 'utf8' }, - ); - } - } - } - - console.log('\t🍺 Success!'); -} - -async function transformPackage( - library: LibraryReference, - uberPackageJson: PackageJson, - destination: string, - allLibraries: readonly LibraryReference[], -) { - await fs.mkdirp(destination); - - if (uberPackageJson.ubergen?.excludeExperimentalModules && library.packageJson.stability === 'experimental') { - // when stripExperimental is enabled, we only want to add the L1s of experimental modules. - let cfnScopes = library.packageJson['cdk-build']?.cloudformation; - - if (cfnScopes === undefined) { - return false; - } - cfnScopes = Array.isArray(cfnScopes) ? cfnScopes : [cfnScopes]; - - const destinationLib = path.join(destination, 'lib'); - await fs.mkdirp(destinationLib); - await cfn2ts(cfnScopes, destinationLib); - - // We know what this is going to be, so predict it - const alphaPackageName = hasL2s(library) ? `${library.packageJson.name}-alpha` : undefined; - - // create a lib/index.ts which only exports the generated files - fs.writeFileSync(path.join(destinationLib, 'index.ts'), - /// logic copied from `create-missing-libraries.ts` - cfnScopes.map(s => (s === 'AWS::Serverless' ? 'AWS::SAM' : s).split('::')[1].toLocaleLowerCase()) - .map(s => `export * from './${s}.generated';`) - .join('\n')); - await pkglint.createLibraryReadme(cfnScopes[0], path.join(destination, 'README.md'), alphaPackageName); - - await copyOrTransformFiles(destination, destination, allLibraries, uberPackageJson); - } else { - await copyOrTransformFiles(library.root, destination, allLibraries, uberPackageJson); - await copyLiterateSources(path.join(library.root, 'test'), path.join(destination, 'test'), allLibraries, uberPackageJson); - } - - await fs.writeFile( - path.join(destination, 'index.ts'), - `export * from './${library.packageJson.types.replace(/(\/index)?(\.d)?\.ts$/, '')}';\n`, - { encoding: 'utf8' }, - ); - - if (library.shortName !== 'core') { - const config = uberPackageJson.jsii.targets; - await fs.writeJson( - path.join(destination, '.jsiirc.json'), - { - targets: transformTargets(config, library.packageJson.jsii.targets), - }, - { spaces: 2 }, - ); - } - - // if libRoot is _not_ under the root of the package, generate a file at the - // root that will refer to the one under lib/ so that users can still import - // from "aws-cdk-lib/aws-lambda". - const relativeLibRoot = uberPackageJson.ubergen?.libRoot; - if (relativeLibRoot && relativeLibRoot !== '.') { - await fs.writeFile( - path.resolve(MONOPACKAGE_ROOT, `${library.shortName}.ts`), - `export * from './${relativeLibRoot}/${library.shortName}';\n`, - { encoding: 'utf8' }, - ); - } - - return true; -} - -/** - * Return whether a package has L2s - * - * We determine this on the cheap: the answer is yes if the package has - * any .ts files in the `lib` directory other than `index.ts` and `*.generated.ts`. - */ -function hasL2s(library: LibraryReference) { - try { - const sourceFiles = fs.readdirSync(path.join(library.root, 'lib')).filter(n => n.endsWith('.ts') && !n.endsWith('.d.ts')); - return sourceFiles.some(n => n !== 'index.ts' && !n.includes('.generated.')); - } catch (e: any) { - if (e.code === 'ENOENT') { return false; } - - throw e; - } -} - -function transformTargets(monoConfig: PackageJson['jsii']['targets'], targets: PackageJson['jsii']['targets']): PackageJson['jsii']['targets'] { - if (targets == null) { return targets; } - - const result: Record = {}; - for (const [language, config] of Object.entries(targets)) { - switch (language) { - case 'dotnet': - if (monoConfig?.dotnet != null) { - result[language] = { - namespace: (config as any).namespace, - }; - } - break; - case 'java': - if (monoConfig?.java != null) { - result[language] = { - package: (config as any).package, - }; - } - break; - case 'python': - if (monoConfig?.python != null) { - result[language] = { - module: `${monoConfig.python.module}.${(config as any).module.replace(/^aws_cdk\./, '')}`, - }; - } - break; - default: - throw new Error(`Unsupported language for submodule configuration translation: ${language}`); - } - } - - return result; -} - -async function copyOrTransformFiles(from: string, to: string, libraries: readonly LibraryReference[], uberPackageJson: PackageJson) { - const libRoot = resolveLibRoot(uberPackageJson); - const promises = (await fs.readdir(from)).map(async name => { - if (shouldIgnoreFile(name)) { return; } - - if (name.endsWith('.d.ts') || name.endsWith('.js')) { - if (await fs.pathExists(path.join(from, name.replace(/\.(d\.ts|js)$/, '.ts')))) { - // We won't copy .d.ts and .js files with a corresponding .ts file - return; - } - } - - const source = path.join(from, name); - const destination = path.join(to, name); - - const stat = await fs.stat(source); - if (stat.isDirectory()) { - await fs.mkdirp(destination); - return copyOrTransformFiles(source, destination, libraries, uberPackageJson); - } - - if (name.endsWith('.ts')) { - return fs.writeFile( - destination, - await rewriteLibraryImports(source, to, libRoot, libraries), - { encoding: 'utf8' }, - ); - } else if (name === 'cfn-types-2-classes.json') { - // This is a special file used by the cloudformation-include module that contains mappings - // of CFN resource types to the fully-qualified class names of the CDK L1 classes. - // We need to rewrite it to refer to the uberpackage instead of the individual packages - const cfnTypes2Classes: { [key: string]: string } = await fs.readJson(source); - for (const cfnType of Object.keys(cfnTypes2Classes)) { - const fqn = cfnTypes2Classes[cfnType]; - // replace @aws-cdk/aws- with /aws-, - // except for @aws-cdk/core, which maps just to the name of the uberpackage - cfnTypes2Classes[cfnType] = fqn.startsWith('@aws-cdk/core.') - ? fqn.replace('@aws-cdk/core', uberPackageJson.name) - : fqn.replace('@aws-cdk', uberPackageJson.name); - } - await fs.writeJson(destination, cfnTypes2Classes, { spaces: 2 }); - } else if (name === 'README.md') { - // Rewrite the README to both adjust imports and remove the redundant stability banner. - // (All modules included in ubergen-ed packages must be stable, so the banner is unnecessary.) - const newReadme = (await rewriteReadmeImports(source, uberPackageJson.name)) - .replace(/[\s\S]+/gm, ''); - - return fs.writeFile( - destination, - newReadme, - { encoding: 'utf8' }, - ); - } else { - return fs.copyFile(source, destination); - } - }); - - await Promise.all(promises); -} - -async function copyLiterateSources(from: string, to: string, libraries: readonly LibraryReference[], uberPackageJson: PackageJson) { - const libRoot = resolveLibRoot(uberPackageJson); - await Promise.all((await fs.readdir(from)).flatMap(async name => { - const source = path.join(from, name); - const stat = await fs.stat(source); - - if (stat.isDirectory()) { - await copyLiterateSources(source, path.join(to, name), libraries, uberPackageJson); - return; - } - - if (!name.endsWith('.lit.ts')) { - return []; - } - - await fs.mkdirp(to); - - return fs.writeFile( - path.join(to, name), - await rewriteLibraryImports(path.join(from, name), to, libRoot, libraries), - { encoding: 'utf8' }, - ); - })); -} - -/** - * Rewrites the imports in README.md from v1 ('@aws-cdk') to v2 ('aws-cdk-lib'). - */ -async function rewriteReadmeImports(fromFile: string, libName: string): Promise { - const sourceCode = await fs.readFile(fromFile, { encoding: 'utf8' }); - return awsCdkMigration.rewriteReadmeImports(sourceCode, libName); -} - -/** - * Rewrites imports in libaries, using the relative path (i.e. '../../assertions'). - */ -async function rewriteLibraryImports(fromFile: string, targetDir: string, libRoot: string, libraries: readonly LibraryReference[]): Promise { - const source = await fs.readFile(fromFile, { encoding: 'utf8' }); - return awsCdkMigration.rewriteImports(source, relativeImport); - - function relativeImport(modulePath: string): string | undefined { - const sourceLibrary = libraries.find( - lib => - modulePath === lib.packageJson.name || - modulePath.startsWith(`${lib.packageJson.name}/`), - ); - if (sourceLibrary == null) { return undefined; } - - const importedFile = modulePath === sourceLibrary.packageJson.name - ? path.join(libRoot, sourceLibrary.shortName) - : path.join(libRoot, sourceLibrary.shortName, modulePath.slice(sourceLibrary.packageJson.name.length + 1)); - - return path.relative(targetDir, importedFile); - } -} - -/** - * Rewrites imports in rosetta fixtures, using the external path (i.e. 'aws-cdk-lib/assertions'). - */ -async function rewriteRosettaFixtureImports(fromFile: string, libName: string): Promise { - const source = await fs.readFile(fromFile, { encoding: 'utf8' }); - return awsCdkMigration.rewriteMonoPackageImports(source, libName); -} - -const IGNORED_FILE_NAMES = new Set([ - '.eslintrc.js', - '.gitignore', - '.jest.config.js', - '.jsii', - '.npmignore', - 'node_modules', - 'package.json', - 'test', - 'tsconfig.json', - 'tsconfig.tsbuildinfo', - 'LICENSE', - 'NOTICE', -]); - -function shouldIgnoreFile(name: string): boolean { - return IGNORED_FILE_NAMES.has(name); -} - -function sortObject(obj: Record): Record { - const result: Record = {}; - - for (const [key, value] of Object.entries(obj).sort((l, r) => l[0].localeCompare(r[0]))) { - result[key] = value; - } - - return result; -} - -/** - * Turn potential backslashes into forward slashes - */ -function unixPath(x: string) { - return x.replace(/\\/g, '/'); -} - -/** - * Resolves the directory where we're going to collect all the libraries. - * - * By default, this is purposely the same as the monopackage root so that our - * two import styles resolve to the same files but it can be overridden by - * seeting `ubergen.libRoot` in the package.json of the uber package. - * - * @param uberPackageJson package.json contents of the uber package - * @returns The directory where we should collect all the libraries. - */ -function resolveLibRoot(uberPackageJson: PackageJson): string { - return path.resolve(uberPackageJson.ubergen?.libRoot ?? MONOPACKAGE_ROOT); -} diff --git a/tools/@aws-cdk/ubergen/package.json b/tools/@aws-cdk/ubergen/package.json deleted file mode 100644 index 265621802ea11..0000000000000 --- a/tools/@aws-cdk/ubergen/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@aws-cdk/ubergen", - "private": true, - "version": "0.0.0", - "description": "Generate an uber CDK package from all individual CDK construct libraries", - "main": "lib/index.js", - "repository": { - "type": "git", - "url": "https://github.com/aws/aws-cdk.git", - "directory": "tools/@aws-cdk/ubergen" - }, - "bin": { - "ubergen": "bin/ubergen" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "pkglint": "pkglint -f", - "test": "echo success", - "build+test+package": "yarn build+test", - "build+test": "yarn build && yarn test", - "build+extract": "yarn build", - "build+test+extract": "yarn build+test" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@types/fs-extra": "^9.0.13" - }, - "dependencies": { - "@aws-cdk/cfn2ts": "0.0.0", - "@aws-cdk/pkglint": "0.0.0", - "@aws-cdk/cfnspec": "0.0.0", - "aws-cdk-migration": "0.0.0", - "fs-extra": "^9.1.0", - "typescript": "~4.9.5" - }, - "keywords": [ - "aws", - "cdk" - ], - "homepage": "https://github.com/aws/aws-cdk", - "engines": { - "node": ">= 14.15.0" - }, - "ubergen": { - "exclude": true - } -} diff --git a/tools/@aws-cdk/ubergen/tsconfig.json b/tools/@aws-cdk/ubergen/tsconfig.json deleted file mode 100644 index d34fdc6881bb3..0000000000000 --- a/tools/@aws-cdk/ubergen/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "lib": ["es2020"], - "strict": true, - "alwaysStrict": true, - "declaration": true, - "inlineSourceMap": true, - "inlineSources": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "composite": true, - "incremental": true - }, - "include": ["**/*.ts"] -} diff --git a/yarn.lock b/yarn.lock index a6d380f54df86..20016addec681 100644 --- a/yarn.lock +++ b/yarn.lock @@ -50,10 +50,10 @@ resolved "https://registry.npmjs.org/@aws-cdk/asset-node-proxy-agent-v5/-/asset-node-proxy-agent-v5-2.0.77.tgz#25ad8e416945c3a51881eedad3ee84516f23ecee" integrity sha512-KKrnyIujGN38yOb0MIm0EnB3n7z83NRl9VgKvN0flOyB8C+3Ey+XKxLYfjoXJ/BulB0161eBJXXwGdP8xQrQJw== -"@aws-cdk/lambda-layer-kubectl-v24@^2.0.121": - version "2.0.121" - resolved "https://registry.npmjs.org/@aws-cdk/lambda-layer-kubectl-v24/-/lambda-layer-kubectl-v24-2.0.121.tgz#eddc9dca05add57bcd15301356b74a616e016630" - integrity sha512-jCoOZMzizRga6rhIkFS5xRIgJjxTPdq6L4a7oIO0fDPLqohS9KWX3XKB0vOEIafmLrZ27BDSql39s7y5xkj33w== +"@aws-cdk/lambda-layer-kubectl-v24@^2.0.100": + version "2.0.149" + resolved "https://registry.npmjs.org/@aws-cdk/lambda-layer-kubectl-v24/-/lambda-layer-kubectl-v24-2.0.149.tgz#d298c78a2595bc4aaf6a67484660d7092fa057da" + integrity sha512-qAGs7GkJopXTQgo220hLBGM9jTCaA32amGopKRxki/dbScVSyaCugqMRm6CFkW8lVTnjuQDyEJrA+1pfdR9vuw== "@babel/code-frame@7.12.11": version "7.12.11" @@ -2250,11 +2250,6 @@ dependencies: "@types/node" "*" -"@types/proxyquire@^1.3.28": - version "1.3.28" - resolved "https://registry.npmjs.org/@types/proxyquire/-/proxyquire-1.3.28.tgz#05a647bb0d8fe48fc8edcc193e43cc79310faa7d" - integrity sha512-SQaNzWQ2YZSr7FqAyPPiA3FYpux2Lqh3HWMZQk47x3xbMCqgC/w0dY3dw9rGqlweDDkrySQBcaScXWeR+Yb11Q== - "@types/punycode@^2.1.0": version "2.1.0" resolved "https://registry.npmjs.org/@types/punycode/-/punycode-2.1.0.tgz#89e4f3d09b3f92e87a80505af19be7e0c31d4e83" @@ -2320,20 +2315,6 @@ resolved "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd" integrity sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g== -"@types/yaml@1.9.6": - version "1.9.6" - resolved "https://registry.npmjs.org/@types/yaml/-/yaml-1.9.6.tgz#9e30a14aecbba978ad7156d03201ecd97478a712" - integrity sha512-VKOCuDN57wngmyQnRqcn4vuGWCXViISHv+UCCjrKcf1yt4zyfMmOGlZDI2ucTHK72V8ki+sd7h21OZL6O5S52A== - dependencies: - yaml "*" - -"@types/yaml@1.9.7", "@types/yaml@^1.9.7": - version "1.9.7" - resolved "https://registry.npmjs.org/@types/yaml/-/yaml-1.9.7.tgz#2331f36e0aac91311a63d33eb026c21687729679" - integrity sha512-8WMXRDD1D+wCohjfslHDgICd2JtMATZU8CkhH8LVJqcJs6dyYj5TGptzP8wApbmEullGBSsCEzzap73DQ1HJaA== - dependencies: - yaml "*" - "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" @@ -2908,21 +2889,6 @@ available-typed-arrays@^1.0.5: resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-cdk-lib@2.47.0: - version "2.47.0" - resolved "https://registry.npmjs.org/aws-cdk-lib/-/aws-cdk-lib-2.47.0.tgz#0f4f6adf2439caffd26686393a6e58ced3995833" - integrity sha512-XnxA7FMhJljsj6OtMMDbUi5lPPYcrehAxqpui5b2Nv2cBWhiG7Wb5baOuQy7niyPhZEX03A4k0vYFas/nnB91g== - dependencies: - "@balena/dockerignore" "^1.0.2" - case "1.6.3" - fs-extra "^9.1.0" - ignore "^5.2.0" - jsonschema "^1.4.1" - minimatch "^3.1.2" - punycode "^2.1.1" - semver "^7.3.8" - yaml "1.10.2" - aws-sdk-mock@5.6.0: version "5.6.0" resolved "https://registry.npmjs.org/aws-sdk-mock/-/aws-sdk-mock-5.6.0.tgz#8cd44e2e8d65f7f38dea8d1ad073fa38f9c719d8" @@ -2932,6 +2898,22 @@ aws-sdk-mock@5.6.0: sinon "^11.1.1" traverse "^0.6.6" +aws-sdk@^2.1317.0: + version "2.1347.0" + resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1347.0.tgz#691001b69aa2b6def58644169caba77e0bc3aee1" + integrity sha512-4c4dZc2kxUPnXrzm0HmLqZ6n1dLClFNnPBfvEAq5pJRz0p+KVzIvV1zJ8wyH5AGhzTjdODt6h2n+bvLgF85PXw== + dependencies: + buffer "4.9.2" + events "1.1.1" + ieee754 "1.1.13" + jmespath "0.16.0" + querystring "0.2.0" + sax "1.2.1" + url "0.10.3" + util "^0.12.4" + uuid "8.0.0" + xml2js "0.4.19" + aws-sdk@^2.1329.0, aws-sdk@^2.928.0: version "2.1329.0" resolved "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1329.0.tgz#6a83a1f7f8e1b3cdc8f8bdc3b7db7bfd43812b78" @@ -3329,17 +3311,17 @@ cdk-generate-synthetic-examples@^0.1.173: jsii-rosetta "^1.77.0" yargs "^17.7.1" -cdk8s-plus-24@2.4.46: - version "2.4.46" - resolved "https://registry.npmjs.org/cdk8s-plus-24/-/cdk8s-plus-24-2.4.46.tgz#4168a1cda18daa828494384f6866a7c35bb3578c" - integrity sha512-GMkCQ5NpKxFgbSy8eKCGWr3Eu5QeL2cmNQ1tcQYE7VELhoJfGVxOESRmdN8W6f9eik50mHql2V0Np/kKpNQhtA== +cdk8s-plus-24@2.4.40: + version "2.4.40" + resolved "https://registry.npmjs.org/cdk8s-plus-24/-/cdk8s-plus-24-2.4.40.tgz#f27c4c5f0adf20ec58294ac7452fdbe3bcb64a9a" + integrity sha512-vDs1Q1XJ1cVg9ap/onOPEC4QRhuCMIHod7TeeQqO8v6I1bB2W9sZc52aLBEc4u9yEuI7/pP2t1rL9m+obcITvw== dependencies: minimatch "^3.1.2" -cdk8s@^2.7.23: - version "2.7.23" - resolved "https://registry.npmjs.org/cdk8s/-/cdk8s-2.7.23.tgz#d9be5e0ec64ac2f4e8427b5c6710e716117cd85b" - integrity sha512-mofg+0B6VkIXMbW6yWNW6fxAiiMZMUllRm5MDtWby+WuNEKVVHNmtRXD2CtJrrdZ1HVOUJwF9C5+/h2yJC/XYA== +cdk8s@^2.7.15: + version "2.7.50" + resolved "https://registry.npmjs.org/cdk8s/-/cdk8s-2.7.50.tgz#483c8748cea9304128278bb1e8e5ef8e1311c0f9" + integrity sha512-edpQJdQ5vSnFx+LQ/Cs9PQtlCI7OL1io2rC+Y/+R6OpRzPPakahHO3nrP+hxp0XrRcmsvzaCDbbjslgXMXzvXw== dependencies: fast-json-patch "^3.1.1" follow-redirects "^1.15.2" @@ -4716,11 +4698,6 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-standard@^14.1.1: - version "14.1.1" - resolved "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.1.tgz#830a8e44e7aef7de67464979ad06b406026c56ea" - integrity sha512-Z9B+VR+JIXRxz21udPTL9HpFMyoMUEeX1G251EQ6e05WD9aPVtVBn09XUmZ259wCMlCDmYDSZG62Hhm+ZTJcUg== - eslint-import-resolver-node@^0.3.7: version "0.3.7" resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7" @@ -4748,14 +4725,6 @@ eslint-module-utils@^2.7.4: dependencies: debug "^3.2.7" -eslint-plugin-es@^3.0.0: - version "3.0.1" - resolved "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz#75a7cdfdccddc0589934aeeb384175f221c57893" - integrity sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ== - dependencies: - eslint-utils "^2.0.0" - regexpp "^3.0.0" - eslint-plugin-import@^2.27.5: version "2.27.5" resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz#876a6d03f52608a3e5bb439c2550588e51dd6c65" @@ -4784,28 +4753,6 @@ eslint-plugin-jest@^24.7.0: dependencies: "@typescript-eslint/experimental-utils" "^4.0.1" -eslint-plugin-node@^11.1.0: - version "11.1.0" - resolved "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d" - integrity sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g== - dependencies: - eslint-plugin-es "^3.0.0" - eslint-utils "^2.0.0" - ignore "^5.1.1" - minimatch "^3.0.4" - resolve "^1.10.1" - semver "^6.1.0" - -eslint-plugin-promise@^4.3.1: - version "4.3.1" - resolved "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.3.1.tgz#61485df2a359e03149fdafc0a68b0e030ad2ac45" - integrity sha512-bY2sGqyptzFBDLh/GMbAxfdJC+b0f23ME63FOE4+Jao0oZ3E1LEwFtWJX/1pGMJLiTtrSSern2CRM/g+dfc0eQ== - -eslint-plugin-standard@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.1.0.tgz#0c3bf3a67e853f8bbbc580fb4945fbf16f41b7c5" - integrity sha512-ZL7+QRixjTR6/528YNGyDotyffm5OQst/sGxKDwGb9Uqs4In5Egi4+jbobhqJoyoCM6/7v/1A5fhQ7ScMtDjaQ== - eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -4822,7 +4769,7 @@ eslint-scope@^7.1.1: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-utils@^2.0.0, eslint-utils@^2.1.0: +eslint-utils@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== @@ -5179,14 +5126,6 @@ filing-cabinet@^3.0.1: tsconfig-paths "^3.10.1" typescript "^3.9.7" -fill-keys@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz#9a8fa36f4e8ad634e3bf6b4f3c8882551452eb20" - integrity sha512-tcgI872xXjwFF4xgQmLxi76GnwJG3g/3isB1l4/G5Z4zrbddGpBjqZCO9oEAcB5wX0Hj/5iQB3toxfO7in1hHA== - dependencies: - is-object "~1.0.1" - merge-descriptors "~1.0.0" - fill-range@^7.0.1: version "7.0.1" resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -5975,7 +5914,7 @@ ignore@^4.0.6: resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.1, ignore@^5.1.8, ignore@^5.2.0, ignore@^5.2.4, ignore@~5.2.4: +ignore@^5.1.8, ignore@^5.2.0, ignore@^5.2.4, ignore@~5.2.4: version "5.2.4" resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== @@ -6294,11 +6233,6 @@ is-obj@^2.0.0: resolved "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w== -is-object@~1.0.1: - version "1.0.2" - resolved "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz#a56552e1c665c9e950b4a025461da87e72f86fcf" - integrity sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA== - is-path-inside@^3.0.2, is-path-inside@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" @@ -8079,11 +8013,6 @@ meow@^8.0.0: type-fest "^0.18.0" yargs-parser "^20.2.3" -merge-descriptors@~1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== - merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -8317,11 +8246,6 @@ module-lookup-amd@^7.0.1: requirejs "^2.3.5" requirejs-config-file "^4.0.0" -module-not-found-error@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz#cf8b4ff4f29640674d6cdd02b0e3bc523c2bbdc0" - integrity sha512-pEk4ECWQXV6z2zjhRZUongnLJNUeGQJ3w6OQ5ctGwD+i5o93qjRQUk2Rt6VdNeu3sEP0AB4LcfvdebpxBRVr4g== - ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -9687,15 +9611,6 @@ proxy-from-env@^1.0.0: resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== -proxyquire@^2.1.3: - version "2.1.3" - resolved "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz#2049a7eefa10a9a953346a18e54aab2b4268df39" - integrity sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg== - dependencies: - fill-keys "^1.0.2" - module-not-found-error "^1.0.1" - resolve "^1.11.1" - psl@^1.1.28, psl@^1.1.33: version "1.9.0" resolved "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" @@ -10027,7 +9942,7 @@ regexp.prototype.flags@^1.4.3: define-properties "^1.1.3" functions-have-names "^1.2.2" -regexpp@^3.0.0, regexpp@^3.1.0, regexpp@^3.2.0: +regexpp@^3.1.0, regexpp@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== @@ -10154,7 +10069,7 @@ resolve.exports@^1.1.0: resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.1.tgz#05cfd5b3edf641571fd46fa608b610dda9ead999" integrity sha512-/NtpHNDN7jWhAaQ9BvBUYZ6YTXsRBgfqWFWP7BZBaoMJO/I3G5OFzvTuWNlZC3aPjins1F+TNrLKsGbH4rfsRQ== -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.1, resolve@^1.20.0, resolve@^1.21.0, resolve@^1.22.0, resolve@^1.22.1: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.20.0, resolve@^1.21.0, resolve@^1.22.0, resolve@^1.22.1: version "1.22.1" resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== @@ -10320,7 +10235,7 @@ semver@7.x, semver@^7.0.0, semver@^7.1.1, semver@^7.1.3, semver@^7.2.1, semver@^ dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.1, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -10528,7 +10443,7 @@ source-map-js@^1.0.2: resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== -source-map-support@^0.5.17, source-map-support@^0.5.21, source-map-support@^0.5.6: +source-map-support@^0.5.21, source-map-support@^0.5.6: version "0.5.21" resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== @@ -11164,18 +11079,6 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -ts-node@^9.1.1: - version "9.1.1" - resolved "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" - integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== - dependencies: - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - source-map-support "^0.5.17" - yn "3.1.1" - tsconfig-paths@^3.10.1, tsconfig-paths@^3.14.1: version "3.14.2" resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" @@ -11930,11 +11833,6 @@ yallist@^4.0.0: resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@*: - version "2.2.1" - resolved "https://registry.npmjs.org/yaml/-/yaml-2.2.1.tgz#3014bf0482dcd15147aa8e56109ce8632cd60ce4" - integrity sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw== - yaml@1.10.2, yaml@^1.10.0, yaml@^1.10.2: version "1.10.2" resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"